From 3ceadc0a0dbb2fc2f8b7c37960d7d1daca340fb3 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 21 Apr 2024 08:39:26 +0000 Subject: [PATCH] nightly update --- .../Cxx/Developers/AlgorithmFilter/index.html | 56 +- .../Cxx/Developers/AlgorithmSource/index.html | 38 +- .../Developers/FilterSelfProgress/index.html | 62 +- .../GraphAlgorithmFilter/index.html | 58 +- .../Developers/MultipleInputPorts/index.html | 64 +- site/Cxx/Developers/ProgressReport/index.html | 56 +- site/Cxx/Qt/BarChartQt/index.html | 40 +- site/Cxx/Qt/BorderWidgetQt/index.html | 64 +- .../index.html | 66 +- site/Cxx/Qt/ShareCameraQt/index.html | 38 +- site/Cxx/Qt/ShowEvent/index.html | 24 +- site/Cxx/Widgets/BoxWidget2/index.html | 2 +- .../RectilinearGridToTetrahedra/index.html | 2 +- site/VTKBook/03Chapter3/index.html | 4 +- site/VTKBook/04Chapter4/index.html | 2 +- site/VTKBook/06Chapter6/index.html | 2 +- site/VTKBook/08Chapter8/index.html | 2 +- site/search/search_index.json | 2 +- site/sitemap.xml | 3822 ++++++++--------- site/sitemap.xml.gz | Bin 16061 -> 16061 bytes src/Coverage/vtk_vtk-examples_xref.json | 2 +- 21 files changed, 2203 insertions(+), 2203 deletions(-) diff --git a/site/Cxx/Developers/AlgorithmFilter/index.html b/site/Cxx/Developers/AlgorithmFilter/index.html index 35819b5d4b0..18e5dcf2c26 100644 --- a/site/Cxx/Developers/AlgorithmFilter/index.html +++ b/site/Cxx/Developers/AlgorithmFilter/index.html @@ -84,34 +84,6 @@ return EXIT_SUCCESS; } -

vtkTest.h

#ifndef __vtkTest_h
-#define __vtkTest_h
-
-#include <vtkDataObject.h>
-
-class vtkTest : public vtkDataObject
-{
-public:
-  static vtkTest* New();
-  vtkTypeMacro(vtkTest, vtkDataObject);
-  void PrintSelf(ostream& os, vtkIndent indent) override;
-  void ShallowCopy(vtkDataObject* t) override;
-
-  vtkGetMacro(Value, double);
-  vtkSetMacro(Value, double);
-
-protected:
-  vtkTest();
-  ~vtkTest();
-
-private:
-  vtkTest(const vtkTest&);        // Not implemented.
-  void operator=(const vtkTest&); // Not implemented.
-
-  double Value;
-};
-
-#endif
 

vtkTestAlgorithmFilter.cxx

#include "vtkTestAlgorithmFilter.h"
 #include "vtkTest.h"
 
@@ -361,6 +333,34 @@
   vtkTest* m = dynamic_cast<vtkTest*>(t);
   this->Value = m->GetValue();
 }
+

vtkTest.h

#ifndef __vtkTest_h
+#define __vtkTest_h
+
+#include <vtkDataObject.h>
+
+class vtkTest : public vtkDataObject
+{
+public:
+  static vtkTest* New();
+  vtkTypeMacro(vtkTest, vtkDataObject);
+  void PrintSelf(ostream& os, vtkIndent indent) override;
+  void ShallowCopy(vtkDataObject* t) override;
+
+  vtkGetMacro(Value, double);
+  vtkSetMacro(Value, double);
+
+protected:
+  vtkTest();
+  ~vtkTest();
+
+private:
+  vtkTest(const vtkTest&);        // Not implemented.
+  void operator=(const vtkTest&); // Not implemented.
+
+  double Value;
+};
+
+#endif
 

vtkTestAlgorithmFilter.h

#ifndef __vtkTestAlgorithmFilter_h
 #define __vtkTestAlgorithmFilter_h
 
diff --git a/site/Cxx/Developers/AlgorithmSource/index.html b/site/Cxx/Developers/AlgorithmSource/index.html
index 78d55ab3d56..3605793c0a7 100644
--- a/site/Cxx/Developers/AlgorithmSource/index.html
+++ b/site/Cxx/Developers/AlgorithmSource/index.html
@@ -76,6 +76,25 @@
 
   return EXIT_SUCCESS;
 }
+

vtkTest1.cxx

#include "vtkTest1.h"
+
+#include <vtkObjectFactory.h>
+
+vtkStandardNewMacro(vtkTest1);
+
+vtkTest1::vtkTest1()
+{
+  this->Value = 4.5;
+}
+
+vtkTest1::~vtkTest1()
+{
+}
+
+void vtkTest1::PrintSelf(ostream& os, vtkIndent indent)
+{
+  this->Superclass::PrintSelf(os, indent);
+}
 

vtkTestAlgorithmSource.cxx

#include "vtkTestAlgorithmSource.h"
 #include "vtkTest1.h"
 
@@ -288,25 +307,6 @@
 };
 
 #endif
-

vtkTest1.cxx

#include "vtkTest1.h"
-
-#include <vtkObjectFactory.h>
-
-vtkStandardNewMacro(vtkTest1);
-
-vtkTest1::vtkTest1()
-{
-  this->Value = 4.5;
-}
-
-vtkTest1::~vtkTest1()
-{
-}
-
-void vtkTest1::PrintSelf(ostream& os, vtkIndent indent)
-{
-  this->Superclass::PrintSelf(os, indent);
-}
 

vtkTest1.h

#ifndef __vtkTest1_h
 #define __vtkTest1_h
 
diff --git a/site/Cxx/Developers/FilterSelfProgress/index.html b/site/Cxx/Developers/FilterSelfProgress/index.html
index c33136ba533..b7ded1faab0 100644
--- a/site/Cxx/Developers/FilterSelfProgress/index.html
+++ b/site/Cxx/Developers/FilterSelfProgress/index.html
@@ -78,37 +78,6 @@
 
   return EXIT_SUCCESS;
 }
-

vtkTestFilterSelfProgressFilter.h

#ifndef __vtkTestFilterSelfProgressFilter_h
-#define __vtkTestFilterSelfProgressFilter_h
-
-#include <vtkPolyDataAlgorithm.h>
-
-class vtkTestFilterSelfProgressFilter : public vtkPolyDataAlgorithm
-{
-public:
-  vtkTypeMacro(vtkTestFilterSelfProgressFilter, vtkAlgorithm);
-
-  static vtkTestFilterSelfProgressFilter* New();
-
-protected:
-  vtkTestFilterSelfProgressFilter();
-  ~vtkTestFilterSelfProgressFilter()
-  {
-  }
-
-  int RequestData(vtkInformation*, vtkInformationVector**,
-                  vtkInformationVector*) override;
-
-  static void ProgressFunction(vtkObject* caller, long unsigned int eventId,
-                               void* clientData, void* callData);
-
-private:
-  vtkTestFilterSelfProgressFilter(const vtkTestFilterSelfProgressFilter&) =
-      delete;
-  void operator=(const vtkTestFilterSelfProgressFilter&) = delete;
-};
-
-#endif
 

vtkTestFilterSelfProgressFilter.cxx

#include <vtkCallbackCommand.h>
 #include <vtkDataObject.h>
 #include <vtkInformation.h>
@@ -163,6 +132,37 @@
 
   return 1;
 }
+

vtkTestFilterSelfProgressFilter.h

#ifndef __vtkTestFilterSelfProgressFilter_h
+#define __vtkTestFilterSelfProgressFilter_h
+
+#include <vtkPolyDataAlgorithm.h>
+
+class vtkTestFilterSelfProgressFilter : public vtkPolyDataAlgorithm
+{
+public:
+  vtkTypeMacro(vtkTestFilterSelfProgressFilter, vtkAlgorithm);
+
+  static vtkTestFilterSelfProgressFilter* New();
+
+protected:
+  vtkTestFilterSelfProgressFilter();
+  ~vtkTestFilterSelfProgressFilter()
+  {
+  }
+
+  int RequestData(vtkInformation*, vtkInformationVector**,
+                  vtkInformationVector*) override;
+
+  static void ProgressFunction(vtkObject* caller, long unsigned int eventId,
+                               void* clientData, void* callData);
+
+private:
+  vtkTestFilterSelfProgressFilter(const vtkTestFilterSelfProgressFilter&) =
+      delete;
+  void operator=(const vtkTestFilterSelfProgressFilter&) = delete;
+};
+
+#endif
 

CMakeLists.txt

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
 
 project(FilterSelfProgress)
diff --git a/site/Cxx/Developers/GraphAlgorithmFilter/index.html b/site/Cxx/Developers/GraphAlgorithmFilter/index.html
index 16254912a41..3043a3f820b 100644
--- a/site/Cxx/Developers/GraphAlgorithmFilter/index.html
+++ b/site/Cxx/Developers/GraphAlgorithmFilter/index.html
@@ -121,35 +121,6 @@
   std::cout << "Output has " << filter->GetOutput()->GetNumberOfVertices()
             << " vertices." << std::endl;
 }
-

vtkTestGraphAlgorithmFilter.h

#ifndef __vtkTestGraphAlgorithmFilter_h
-#define __vtkTestGraphAlgorithmFilter_h
-
-#include <vtkGraphAlgorithm.h>
-
-class vtkTestGraphAlgorithmFilter : public vtkGraphAlgorithm
-{
-public:
-  vtkTypeMacro(vtkTestGraphAlgorithmFilter, vtkGraphAlgorithm);
-  static vtkTestGraphAlgorithmFilter* New();
-
-protected:
-  vtkTestGraphAlgorithmFilter()
-  {
-  }
-  ~vtkTestGraphAlgorithmFilter()
-  {
-  }
-
-  int RequestData(vtkInformation*, vtkInformationVector**,
-                  vtkInformationVector*) override;
-
-private:
-  vtkTestGraphAlgorithmFilter(
-      const vtkTestGraphAlgorithmFilter&);            // Not implemented.
-  void operator=(const vtkTestGraphAlgorithmFilter&); // Not implemented.
-};
-
-#endif
 

vtkTestGraphAlgorithmFilter.cxx

#include "vtkTestGraphAlgorithmFilter.h"
 
 #include <vtkDataObject.h>
@@ -201,6 +172,35 @@
 
   return 1;
 }
+

vtkTestGraphAlgorithmFilter.h

#ifndef __vtkTestGraphAlgorithmFilter_h
+#define __vtkTestGraphAlgorithmFilter_h
+
+#include <vtkGraphAlgorithm.h>
+
+class vtkTestGraphAlgorithmFilter : public vtkGraphAlgorithm
+{
+public:
+  vtkTypeMacro(vtkTestGraphAlgorithmFilter, vtkGraphAlgorithm);
+  static vtkTestGraphAlgorithmFilter* New();
+
+protected:
+  vtkTestGraphAlgorithmFilter()
+  {
+  }
+  ~vtkTestGraphAlgorithmFilter()
+  {
+  }
+
+  int RequestData(vtkInformation*, vtkInformationVector**,
+                  vtkInformationVector*) override;
+
+private:
+  vtkTestGraphAlgorithmFilter(
+      const vtkTestGraphAlgorithmFilter&);            // Not implemented.
+  void operator=(const vtkTestGraphAlgorithmFilter&); // Not implemented.
+};
+
+#endif
 

CMakeLists.txt

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
 
 project(GraphAlgorithmFilter)
diff --git a/site/Cxx/Developers/MultipleInputPorts/index.html b/site/Cxx/Developers/MultipleInputPorts/index.html
index 750bdfc57e2..be8f703a9c9 100644
--- a/site/Cxx/Developers/MultipleInputPorts/index.html
+++ b/site/Cxx/Developers/MultipleInputPorts/index.html
@@ -77,6 +77,38 @@
 
   return EXIT_SUCCESS;
 }
+

vtkTestMultipleInputPortsFilter.h

// .NAME vtkTestMultipleInputPortsFilter
+// .SECTION Description
+// vtkTestMultipleInputPortsFilter
+
+#ifndef __vtkTestMultipleInputPortsFilter_h
+#define __vtkTestMultipleInputPortsFilter_h
+
+#include <vtkPolyDataAlgorithm.h>
+
+class vtkTestMultipleInputPortsFilter : public vtkPolyDataAlgorithm
+{
+public:
+  static vtkTestMultipleInputPortsFilter* New();
+  vtkTypeMacro(vtkTestMultipleInputPortsFilter, vtkPolyDataAlgorithm);
+
+protected:
+  vtkTestMultipleInputPortsFilter();
+  ~vtkTestMultipleInputPortsFilter()
+  {
+  }
+
+  int FillInputPortInformation(int port, vtkInformation* info) override;
+  int RequestData(vtkInformation*, vtkInformationVector**,
+                  vtkInformationVector*) override;
+
+private:
+  vtkTestMultipleInputPortsFilter(const vtkTestMultipleInputPortsFilter&) =
+      delete;
+  void operator=(const vtkTestMultipleInputPortsFilter&) = delete;
+};
+
+#endif
 

vtkTestMultipleInputPortsFilter.cxx

#include "vtkTestMultipleInputPortsFilter.h"
 
 #include <vtkDataObject.h>
@@ -141,38 +173,6 @@
 
   return 1;
 }
-

vtkTestMultipleInputPortsFilter.h

// .NAME vtkTestMultipleInputPortsFilter
-// .SECTION Description
-// vtkTestMultipleInputPortsFilter
-
-#ifndef __vtkTestMultipleInputPortsFilter_h
-#define __vtkTestMultipleInputPortsFilter_h
-
-#include <vtkPolyDataAlgorithm.h>
-
-class vtkTestMultipleInputPortsFilter : public vtkPolyDataAlgorithm
-{
-public:
-  static vtkTestMultipleInputPortsFilter* New();
-  vtkTypeMacro(vtkTestMultipleInputPortsFilter, vtkPolyDataAlgorithm);
-
-protected:
-  vtkTestMultipleInputPortsFilter();
-  ~vtkTestMultipleInputPortsFilter()
-  {
-  }
-
-  int FillInputPortInformation(int port, vtkInformation* info) override;
-  int RequestData(vtkInformation*, vtkInformationVector**,
-                  vtkInformationVector*) override;
-
-private:
-  vtkTestMultipleInputPortsFilter(const vtkTestMultipleInputPortsFilter&) =
-      delete;
-  void operator=(const vtkTestMultipleInputPortsFilter&) = delete;
-};
-
-#endif
 

CMakeLists.txt

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
 
 project(MultipleInputPorts)
diff --git a/site/Cxx/Developers/ProgressReport/index.html b/site/Cxx/Developers/ProgressReport/index.html
index 0cf1acfc890..184368bb035 100644
--- a/site/Cxx/Developers/ProgressReport/index.html
+++ b/site/Cxx/Developers/ProgressReport/index.html
@@ -98,6 +98,34 @@
       static_cast<vtkTestProgressReportFilter*>(caller);
   std::cout << "Progress: " << testFilter->GetProgress() << std::endl;
 }
+

vtkTestProgressReportFilter.h

#ifndef __vtkTestProgressReportFilter_h
+#define __vtkTestProgressReportFilter_h
+
+#include <vtkPolyDataAlgorithm.h>
+
+class vtkTestProgressReportFilter : public vtkPolyDataAlgorithm
+{
+public:
+  static vtkTestProgressReportFilter* New();
+  vtkTypeMacro(vtkTestProgressReportFilter, vtkAlgorithm);
+
+protected:
+  vtkTestProgressReportFilter()
+  {
+  }
+  ~vtkTestProgressReportFilter()
+  {
+  }
+
+  int RequestData(vtkInformation*, vtkInformationVector**,
+                  vtkInformationVector*) override;
+
+private:
+  vtkTestProgressReportFilter(const vtkTestProgressReportFilter&) = delete;
+  void operator=(const vtkTestProgressReportFilter&) = delete;
+};
+
+#endif
 

vtkTestProgressReportFilter.cxx

#include "vtkTestProgressReportFilter.h"
 
 #include <vtkDataObject.h>
@@ -134,34 +162,6 @@
 
   return 1;
 }
-

vtkTestProgressReportFilter.h

#ifndef __vtkTestProgressReportFilter_h
-#define __vtkTestProgressReportFilter_h
-
-#include <vtkPolyDataAlgorithm.h>
-
-class vtkTestProgressReportFilter : public vtkPolyDataAlgorithm
-{
-public:
-  static vtkTestProgressReportFilter* New();
-  vtkTypeMacro(vtkTestProgressReportFilter, vtkAlgorithm);
-
-protected:
-  vtkTestProgressReportFilter()
-  {
-  }
-  ~vtkTestProgressReportFilter()
-  {
-  }
-
-  int RequestData(vtkInformation*, vtkInformationVector**,
-                  vtkInformationVector*) override;
-
-private:
-  vtkTestProgressReportFilter(const vtkTestProgressReportFilter&) = delete;
-  void operator=(const vtkTestProgressReportFilter&) = delete;
-};
-
-#endif
 

CMakeLists.txt

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
 
 project(ProgressReport)
diff --git a/site/Cxx/Qt/BarChartQt/index.html b/site/Cxx/Qt/BarChartQt/index.html
index de52cd7c503..d47c769d0de 100644
--- a/site/Cxx/Qt/BarChartQt/index.html
+++ b/site/Cxx/Qt/BarChartQt/index.html
@@ -217,26 +217,6 @@
   std::cout << "Exiting" << std::endl;
   qApp->exit();
 }
-

BarChartQtDriver.cxx

#include <QApplication>
-#include <QSurfaceFormat>
-
-#include <QVTKOpenGLNativeWidget.h>
-
-#include "BarChartQt.h"
-
-int main(int argc, char** argv)
-{
-  // Needed to ensure appropriate OpenGL context is created for VTK rendering.
-  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
-
-  // QT Stuff
-  QApplication app(argc, argv);
-
-  BarChartQt BarChartQt;
-  BarChartQt.show();
-
-  return app.exec();
-}
 

BarChartQt.h

#ifndef BarChartQt_H
 #define BarChartQt_H
 
@@ -337,6 +317,26 @@
  </resources>
  <connections/>
 </ui>
+

BarChartQtDriver.cxx

#include <QApplication>
+#include <QSurfaceFormat>
+
+#include <QVTKOpenGLNativeWidget.h>
+
+#include "BarChartQt.h"
+
+int main(int argc, char** argv)
+{
+  // Needed to ensure appropriate OpenGL context is created for VTK rendering.
+  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
+
+  // QT Stuff
+  QApplication app(argc, argv);
+
+  BarChartQt BarChartQt;
+  BarChartQt.show();
+
+  return app.exec();
+}
 

CMakeLists.txt

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
 
 if(POLICY CMP0020)
diff --git a/site/Cxx/Qt/BorderWidgetQt/index.html b/site/Cxx/Qt/BorderWidgetQt/index.html
index 4603b2ef7ba..1f833c5fcab 100644
--- a/site/Cxx/Qt/BorderWidgetQt/index.html
+++ b/site/Cxx/Qt/BorderWidgetQt/index.html
@@ -231,6 +231,38 @@
 }
 
 } // namespace
+

BorderWidgetQt.h

#ifndef BorderWidgetQt_H
+#define BorderWidgetQt_H
+
+#include <QMainWindow>
+#include <vtkSmartPointer.h>
+
+class vtkBorderWidget;
+
+/*
+ * See "The Single Inheritance Approach" in this link:
+ * [Using a Designer UI File in Your C++
+ * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)
+ */
+namespace Ui {
+class BorderWidgetQt;
+}
+
+class BorderWidgetQt : public QMainWindow
+{
+  Q_OBJECT
+public:
+  // Constructor/Destructor
+  explicit BorderWidgetQt(QWidget* parent = nullptr);
+  virtual ~BorderWidgetQt();
+
+private:
+  vtkSmartPointer<vtkBorderWidget> BorderWidget;
+  // Designer form
+  Ui::BorderWidgetQt* ui;
+};
+
+#endif
 

BorderWidgetQt.ui

<?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>BorderWidgetQt</class>
@@ -348,38 +380,6 @@
 
   return app.exec();
 }
-

BorderWidgetQt.h

#ifndef BorderWidgetQt_H
-#define BorderWidgetQt_H
-
-#include <QMainWindow>
-#include <vtkSmartPointer.h>
-
-class vtkBorderWidget;
-
-/*
- * See "The Single Inheritance Approach" in this link:
- * [Using a Designer UI File in Your C++
- * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)
- */
-namespace Ui {
-class BorderWidgetQt;
-}
-
-class BorderWidgetQt : public QMainWindow
-{
-  Q_OBJECT
-public:
-  // Constructor/Destructor
-  explicit BorderWidgetQt(QWidget* parent = nullptr);
-  virtual ~BorderWidgetQt();
-
-private:
-  vtkSmartPointer<vtkBorderWidget> BorderWidget;
-  // Designer form
-  Ui::BorderWidgetQt* ui;
-};
-
-#endif
 

CMakeLists.txt

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
 
 if(POLICY CMP0020)
diff --git a/site/Cxx/Qt/RenderWindowUISingleInheritance/index.html b/site/Cxx/Qt/RenderWindowUISingleInheritance/index.html
index fd81ba4ac60..bdff87efc13 100644
--- a/site/Cxx/Qt/RenderWindowUISingleInheritance/index.html
+++ b/site/Cxx/Qt/RenderWindowUISingleInheritance/index.html
@@ -203,39 +203,6 @@
 
   return app.exec();
 }
-

RenderWindowUISingleInheritance.h

#ifndef RenderWindowUISingleInheritance_H
-#define RenderWindowUISingleInheritance_H
-
-#include <vtkSmartPointer.h>
-
-#include <QMainWindow>
-
-/*
- * See "The Single Inheritance Approach" in this link:
- * [Using a Designer UI File in Your C++
- * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)
- */
-namespace Ui {
-class RenderWindowUISingleInheritance;
-}
-
-class RenderWindowUISingleInheritance : public QMainWindow
-{
-  Q_OBJECT
-public:
-  // Constructor/Destructor
-  explicit RenderWindowUISingleInheritance(QWidget* parent = nullptr);
-  virtual ~RenderWindowUISingleInheritance();
-
-private:
-  // Designer form
-  Ui::RenderWindowUISingleInheritance* ui;
-
-public slots:
-  void slotExit();
-};
-
-#endif
 

RenderWindowUISingleInheritance.ui

<?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>RenderWindowUISingleInheritance</class>
@@ -304,6 +271,39 @@
  </resources>
  <connections/>
 </ui>
+

RenderWindowUISingleInheritance.h

#ifndef RenderWindowUISingleInheritance_H
+#define RenderWindowUISingleInheritance_H
+
+#include <vtkSmartPointer.h>
+
+#include <QMainWindow>
+
+/*
+ * See "The Single Inheritance Approach" in this link:
+ * [Using a Designer UI File in Your C++
+ * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)
+ */
+namespace Ui {
+class RenderWindowUISingleInheritance;
+}
+
+class RenderWindowUISingleInheritance : public QMainWindow
+{
+  Q_OBJECT
+public:
+  // Constructor/Destructor
+  explicit RenderWindowUISingleInheritance(QWidget* parent = nullptr);
+  virtual ~RenderWindowUISingleInheritance();
+
+private:
+  // Designer form
+  Ui::RenderWindowUISingleInheritance* ui;
+
+public slots:
+  void slotExit();
+};
+
+#endif
 

CMakeLists.txt

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
 
 if(POLICY CMP0020)
diff --git a/site/Cxx/Qt/ShareCameraQt/index.html b/site/Cxx/Qt/ShareCameraQt/index.html
index abb3bbffeb2..5e690cb78da 100644
--- a/site/Cxx/Qt/ShareCameraQt/index.html
+++ b/site/Cxx/Qt/ShareCameraQt/index.html
@@ -169,25 +169,6 @@
 {
   qApp->exit();
 }
-

ShareCameraQtDriver.cxx

#include <QApplication>
-#include <QSurfaceFormat>
-#include <QVTKOpenGLNativeWidget.h>
-
-#include "ShareCameraQt.h"
-
-int main(int argc, char** argv)
-{
-  // needed to ensure appropriate OpenGL context is created for VTK rendering.
-  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
-
-  // QT Stuff
-  QApplication app(argc, argv);
-
-  ShareCameraQt shareCameraQt;
-  shareCameraQt.show();
-
-  return app.exec();
-}
 

ShareCameraQt.h

#ifndef ShareCameraQt_H
 #define ShareCameraQt_H
 
@@ -331,6 +312,25 @@
  </resources>
  <connections/>
 </ui>
+

ShareCameraQtDriver.cxx

#include <QApplication>
+#include <QSurfaceFormat>
+#include <QVTKOpenGLNativeWidget.h>
+
+#include "ShareCameraQt.h"
+
+int main(int argc, char** argv)
+{
+  // needed to ensure appropriate OpenGL context is created for VTK rendering.
+  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
+
+  // QT Stuff
+  QApplication app(argc, argv);
+
+  ShareCameraQt shareCameraQt;
+  shareCameraQt.show();
+
+  return app.exec();
+}
 

CMakeLists.txt

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
 
 if(POLICY CMP0020)
diff --git a/site/Cxx/Qt/ShowEvent/index.html b/site/Cxx/Qt/ShowEvent/index.html
index a8255870b16..f87bf53b6b8 100644
--- a/site/Cxx/Qt/ShowEvent/index.html
+++ b/site/Cxx/Qt/ShowEvent/index.html
@@ -73,18 +73,6 @@
   // Instead, do the VTK display things here!
   std::cout << "VTK Stuff" << std::endl;
 }
-

ShowEventDriver.cxx

#include <QApplication>
-
-#include "ShowEvent.h"
-
-int main(int argc, char* argv[])
-{
-  QApplication app(argc, argv);
-  ShowEvent showEvent;
-
-  showEvent.show();
-  return app.exec();
-}
 

ShowEvent.h

#ifndef ShowEventQt_H
 #define ShowEventQt_H
 
@@ -115,6 +103,18 @@
 };
 
 #endif
+

ShowEventDriver.cxx

#include <QApplication>
+
+#include "ShowEvent.h"
+
+int main(int argc, char* argv[])
+{
+  QApplication app(argc, argv);
+  ShowEvent showEvent;
+
+  showEvent.show();
+  return app.exec();
+}
 

ShowEvent.ui

<?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>ShowEvent</class>
diff --git a/site/Cxx/Widgets/BoxWidget2/index.html b/site/Cxx/Widgets/BoxWidget2/index.html
index 6659080eb1d..7637dbcb600 100644
--- a/site/Cxx/Widgets/BoxWidget2/index.html
+++ b/site/Cxx/Widgets/BoxWidget2/index.html
@@ -95,7 +95,7 @@
                                       checkbox.addEventListener('change', (event) => {
                                         frame.contentWindow.postMessage("ToggleOutput", "https://vtk.org")
                                       })
-                         

Description

This example uses a [vtkBoxWidget](https://www.vtk.org/doc/nightly/html/classvtkBoxWidget.html#details)2 to manipulate an actor. The widget only contains the interaction logic; the actual box is drawn by the accompanying vtkBoxRepresentation. Contrary to the older vtkBoxWidget, this widget doesn't provide functionality to assign it to one or more actors, so that has to be implemented manually. The box is dimensioned and positioned by passing a bounding box to PlaceWidget method, with the SetPlaceFactor method providing a scaling factor in relation to that bounding box. The transformations applied to the box can be used to manipulate any number of object(s), via a custom callback class, which is passed to the box widget through the AddObserver method.

The older implementation vtkBoxWidget provides functionality to receive a vtkProp3D for the initial positioning and sizing, but the transformation synchronization still needs to be done manually. See BoxWidget for a simple example of how to use it.

Question

If you have a question about this example, please use the VTK Discourse Forum

Code

BoxWidget2.cxx

#include <vtkActor.h>
+                         

Description

This example uses a vtkBoxWidget2 to manipulate an actor. The widget only contains the interaction logic; the actual box is drawn by the accompanying vtkBoxRepresentation. Contrary to the older vtkBoxWidget, this widget doesn't provide functionality to assign it to one or more actors, so that has to be implemented manually. The box is dimensioned and positioned by passing a bounding box to PlaceWidget method, with the SetPlaceFactor method providing a scaling factor in relation to that bounding box. The transformations applied to the box can be used to manipulate any number of object(s), via a custom callback class, which is passed to the box widget through the AddObserver method.

The older implementation vtkBoxWidget provides functionality to receive a vtkProp3D for the initial positioning and sizing, but the transformation synchronization still needs to be done manually. See BoxWidget for a simple example of how to use it.

Question

If you have a question about this example, please use the VTK Discourse Forum

Code

BoxWidget2.cxx

#include <vtkActor.h>
 #include <vtkBoxRepresentation.h>
 #include <vtkBoxWidget2.h>
 #include <vtkCommand.h>
diff --git a/site/Java/RectilinearGrid/RectilinearGridToTetrahedra/index.html b/site/Java/RectilinearGrid/RectilinearGridToTetrahedra/index.html
index 67ac9660c92..df7bb0b1822 100644
--- a/site/Java/RectilinearGrid/RectilinearGridToTetrahedra/index.html
+++ b/site/Java/RectilinearGrid/RectilinearGridToTetrahedra/index.html
@@ -55,7 +55,7 @@
         window.attachEvent('on' + event, func)
     }
 }
-      

RectilinearGridToTetrahedra

vtk-examples/Java/RectilinearGrid/RectilinearGridToTetrahedra

Description

vtkRectilinearGridToTetrahedra object forms a mesh of Tetrahedra from a vtkRectilinearGrid.

The tetrahedra can be 5 per cell, 6 per cell, or a mixture of 5 or 12 per cell. The resulting mesh is consistent, meaning that there are no edge crossings and that each tetrahedron face is shared by two tetrahedra, except those tetrahedra on the boundary. All tetrahedra are right handed.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

Code

RectilinearGridToTetrahedra.java

import vtk.vtkDoubleArray;
+      

RectilinearGridToTetrahedra

vtk-examples/Java/RectilinearGrid/RectilinearGridToTetrahedra

Description

[vtkRectilinearGrid](https://www.vtk.org/doc/nightly/html/classvtkRectilinearGrid.html#details)ToTetrahedra object forms a mesh of Tetrahedra from a vtkRectilinearGrid.

The tetrahedra can be 5 per cell, 6 per cell, or a mixture of 5 or 12 per cell. The resulting mesh is consistent, meaning that there are no edge crossings and that each tetrahedron face is shared by two tetrahedra, except those tetrahedra on the boundary. All tetrahedra are right handed.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

Code

RectilinearGridToTetrahedra.java

import vtk.vtkDoubleArray;
 import vtk.vtkNativeLibrary;
 import vtk.vtkRectilinearGrid;
 import vtk.vtkRectilinearGridToTetrahedra;
diff --git a/site/VTKBook/03Chapter3/index.html b/site/VTKBook/03Chapter3/index.html
index 2d8481d40b5..3e2c95abcbc 100644
--- a/site/VTKBook/03Chapter3/index.html
+++ b/site/VTKBook/03Chapter3/index.html
@@ -143,7 +143,7 @@
 0 & 0 & 0 & 1
 \end{array}\right]
 \bf\tag{3-13}
- 

Rotations occur about the coordinate origin. It is often more convenient to rotate around the center of the object (or a user-specified point). Assume that we call this point the object's center. To rotate around O_c we must first translate the object from O_c to the origin, apply rotations, and then translate the object back to O_c.

Transformation matrices can be combined by matrix multiplication to achieve combinations of translation, rotation, and scaling. It is possible for a single transformation matrix to represent all types of transformation simultaneously. This matrix is the result of repeated matrix multiplications. A word of warning: The order of the multiplication is important. For example, multiplying a translation matrix by a rotation matrix will not yield the same result as multiplying the rotation matrix by the translation matrix.

3.8 Actor Geometry

We have seen how lighting properties control the appearance of an actor, and how the camera in combination with transformation matrices is used to project an actor to the image plane. What is left to define is the geometry of the actor, and how we position it in the world coordinate system.

Modelling

A major topic in the study of computer graphics is modelling or representing the geometry of physical objects. Various mathematical techniques have been applied including combinations of points, lines, polygons, curves, and splines of various forms, and even implicit mathematical functions.

This topic is beyond the scope of the text. The important point here is that there is an underlying geometric model that specifies what the object's shape is and where it is located in the model coordinate system.

In data visualization, modelling takes a different role. Instead of directly creating geometry to represent an object, visualization algorithms compute these forms. Often the geometry is abstract (like a contour line) and has little relationship to real world geometry. We will see how these models are computed when we describe visualization algorithms in Chapter 6 - Fundamental Algorithms and Chapter 9 - Advanced Algorithms.

The representation of geometry for data visualization tends to be simple, even though computing the representations is not. These forms are most often primitives like points, lines, and polygons, or visualization data such as volume data. We use simple forms because we desire high performance and interactive systems. Thus we take advantage of computer hardware (to be covered in "Graphics Hardware") or special rendering techniques like volume rendering (see "Volume Rendering" in Chapter 7).

Actor Location and Orientation

Every actor has a transformation matrix that controls its location and scaling in world space. The actor's geometry is defined by a model in model coordinates. We specify the actor's location using orientation, position, and scale factors along the coordinate axes. In addition, we can define an origin around which the actor rotates. This feature is useful because we can rotate the actor around its center or some other meaningful point.

The orientation of an actor is determined by rotations stored in an orientation vector (Ox,Roy,Oz). This vector defines a series of rotational transformation matrices. As we saw in the previous section on transformation matrices, the order of application of the transformations is not arbitrary. We have chosen a fixed order based on what we think is natural to users. The order of transformation is a rotation by O y around the y axis, then by around Ox the x axis, and finally by O z around the z axis. This ordering is arbitrary and is based on the standard camera operations. These operations (in order) are a camera azimuth, followed by an elevation, and then a roll (Figure 3-15).

All of these rotations take place around the origin of the actor. Typically this is set to the center of its bounding box, but it can be set to any convenient point. There are many different methods for changing an actor's orientation. RotateX(), RotateY(), and RotateZ() are common methods that rotate about their respective axes. Many systems also include a method to rotate about a userdefined axis. In the Visualization Toolkit the RotateXYZ() method is used to rotate around an arbitrary vector passing through the origin.

Figure 3-15
Figure 3-15. Actor coordinate system.

3.9 Graphics Hardware

Earlier we mentioned that advances in graphics hardware have had a large impact on how rendering is performed. Now that we have covered the fundamentals of rendering a scene, we look at some of the hardware issues. First, we discuss raster devices that have replaced vector displays as the primary output device. Then, we look at how our programs communicate to the graphics hardware. We also examine the different coordinate systems used in computer graphics, hidden line/surface removal, and z-buffering.

Raster Devices

The results of computer graphics is pervasive in today's world---digital images (generated with computer graphics) may be found on cell phones, displayed on computer monitors, broadcast on TV, shown at the movie theatre and presented on electronic billboards. All of these, and many more, display mediums are raster devices. A raster device represents an image using a two dimensional array of picture elements called pixels. For example, the word "hello" can be represented as an array of pixels. as shown in Figure 3-16. Here the word "hello" is written within a pixel array that is twenty-five pixels wide and ten pixels high. Each pixel stores one bit of information, whether it is black or white. This is how a black and white laser printer works, for each point on the paper it either prints a black dot or leaves it the color of the paper. Due to hardware limitations, raster devices such as laser printers and computer monitors do not actually draw accurate square pixels like those in Figure 3-16. Instead, they tend to be slightly blurred and overlapping. Another hardware limitation of raster devices is their resolution. This is what causes a 300 dpi (dots per inch) laser printer to produce more detailed output than a nine pin dot matrix printer. A 300 dpi laser printer has a resolution of 300 pixels per inch compared to roughly 50 dpi for the dot matrix printer.

Figure 3-16
Figure 3-16. A pixel array for the word "hello."
Figure 3-17
Figure 3-17. Black and white dithering.

Color computer monitors typically have a resolution of about 80 pixels per inch, making the screen a pixel array roughly one thousand pixels in width and height. This results in over one million pixels, each with a value that indicates what color it should be. Since the hardware in color monitors uses the RGB system, it makes sense to use that to describe the colors in the pixels. Unfortunately, having over one million pixels, each with a red, green, and blue component, can take up a lot of memory. This is part of what differentiates the variety of graphics hardware on the market. Some companies use 24 bits of storage per pixel, others use eight, some advanced systems use more than 100 bits of storage per pixel. Typically, the more bits per pixel the more accurate the colors will be.

One way to work around color limitations in the graphics hardware is by using a technique called dithering. Say, for example, that you want to use some different shades of gray, but your graphics hardware only supports black and white. Dithering lets you approximate shades of gray by using a mixture of both black and white pixels. In Figure 3-17, seven gray squares are drawn using a mixture of black and white pixels. From a distance the seven squares look like different shades of gray even though up close, it's clear that they are just different mixtures of black and white pixels. This same technique works just as well for other colors. For example, if your graphics hardware supports primary blue, primary green, and white but not a pastel sea green, you can approximate this color by dithering the green, blue, and white that the hardware does support.

Interfacing to the Hardware

Now that we have covered the basics of display hardware, the good news is that you rarely need to worry about them. Most graphics programming is done using higher-level primitives than individual pixels. Figure 3-18 shows a typical arrangement for a visualization program. At the bottom of the hierarchy is the display hardware that we already discussed; chances are your programs will not interact directly with it. The top three layers above the hardware are the layers you may need to be concerned with.

Many programs take advantage of application libraries as a high-level interface to the graphics capabilities of a system. The Visualization Toolkit accompanying this book is a prime example of this. It allows you to display a complex object or graph using just a few commands. It is also possible to interface to a number of different graphics libraries, since different libraries may be supported on different hardware platforms.

The graphics library and graphics hardware layers both perform similar functions. They are responsible for taking high-level commands from an application library or program, and executing them. This makes programming much easier by providing more complex primitives to work with. Instead of drawing pixels one at a time, we can draw primitives like polygons, triangles, and lines, without worrying about the details of which pixels are being set to which colors. Figure 3-19 illustrates some high-level primitives that all mainstream graphics libraries support.

This functionality is broken into two different layers because different machines may have vastly different graphics hardware. If you write a program that draws a red polygon, either the graphics library or the graphics hardware must be able to execute that command. On high-end systems, this may be done in the graphics hardware, on others it will be done by the graphics library in software. So the same commands can be used with a wide variety of machines, without worrying about the underlying graphics hardware.

The fundamental building block of the primitives in Figure 3-19 is a point (or vertex). A vertex has a position, normal, and color, each of which is a three element vector. The position specifies where the vertex is located, its normal specifies which direction the vertex is facing, and its color specifies the vertex's red, green, and blue components.

A polygon is built by connecting a series of points or vertices as shown in Figure 3-20. You may be wondering why each vertex has a normal, instead of having just one normal for the entire polygon. A planar polygon can only be facing one direction regardless of what the normals of its vertices indicate. The reason is that sometimes a polygon is used as an approximation of something else, like a curve. Figure 3-21 shows a top-down view of a cylinder. As you can see, it's not really a cylinder but rather a polygonal approximation of the cylinder drawn in gray. Each vertex is shared by two polygons and the correct normal for the vertex is not the same as the normal for the polygon. Similar logic explains why each vertex has a color instead of just having one color for an entire polygon.

Figure 3-18
Figure 3-18. Typical graphics interface hierarchy.
Figure 3-19
Figure 3-19. Graphics primitives.

When you limit yourself to the types of primitives described above, there are some additional properties that many graphics systems support. Edge color and edge visibility can be used to highlight the polygon primitives that make up an actor. Another way to do this is by adjusting the representation from surface to wireframe or points. This replaces surfaces such as polygons with either their boundary edges or points respectively. While this may not make much sense from a physical perspective, it can help in some illustrations. Using edge visibility when rendering a CAD model can help to show the different pieces that comprise the model.

Rasterization

At this point in the text we have described how to represent graphics data using rendering primitives, and we have described how to represent images using raster display devices. The question remains, how do we convert graphics primitives into a raster image? This is the topic we address in this section. Although a thorough treatise on this topic is beyond the scope of this text, we will do our best to provide a high-level overview.

Figure 3-20
Figure 3-20. An example polygon.
Figure 3-21
Figure 3-21. Vertex and polygon normals.

The process of converting a geometric representation into a raster image is called rasterization or scan conversion. In the description that follows we assume that the graphics primitives are triangle polygons. This is not as limiting as you might think, because any general polygon can be tessellated into a set of triangles. Moreover, other surface representations such as splines are usually tessellated by the graphics system into triangles or polygons. (The method described here is actually applicable to convex polygons.)

Most of today's hardware is based on object-order rasterization techniques. As we saw earlier in this chapter, this means processing our actors in order. And since our actors are represented by polygon primitives, we process polygons one at a time. So although we describe the processing of one polygon, bear in mind that many polygons and possibly many actors are processed.

The first step is to transform the polygon using the appropriate transformation matrix. We also project the polygon to the image plane using either parallel or orthographic projection. Part of this process involves clipping the polygons. Not only do we use the front and back clipping planes to clip polygons too close or too far, but we must also clip polygons crossing the boundaries of the image plane. Clipping polygons that cross the boundary of the view frustum means we have to generate new polygonal boundaries.

Figure 3-22
Figure 3-22. Rasterizing a convex polygon. Pixels are processed in horizontal spans (or scan-lines) in the image plane. Data values $d_i$ at point $p_i$ are interpolated along the edges and then along the scan-line using delta data values. Typical data values are RGB components of color.

With the polygon clipped and projected to the image plane, we can begin scan-line processing (Figure 3-22). The first step identifies the initial scan-line intersected by the projected polygon. This is found by sorting the vertices' y values. We then find the two edges joining the vertex on the left and right sides. Using the slopes of the edges along with the data values we compute delta data values. These data are typically the R, G, and B color components. Other data values include transparency values and z depth values. (The z values are necessary if we are using a z-buffer, described in the next section.) The row of pixels within the polygon (i.e., starting at the left and right edges) is called a span. Data values are interpolated from the edges on either side of the span to compute the internal pixel values. This process continues span-by-span, until the entire polygon is filled. Note that as new vertices are encountered, it is necessary to recompute the delta data values.

The shading of the polygon (i.e., color interpolation across the polygon) varies depending on the actor's interpolation attribute. There are three possibilities: flat, Gouraud, or Phong shading. Figure 3-7 illustrates the difference between flat and Gouraud interpolation. Flat shading calculates the color of a polygon by applying the lighting equations to just one normal (typically the surface normal) of the polygon. Gouraud shading calculates the color of a polygon at all of its vertices using the vertices' normals and the standard lighting equations. The interior and edges of the poly-gon are then filled in by applying the scan-line interpolation process. Phong shading is the most realistic of the three. It calculates a normal at every location on the polygon by interpolating the vertex normals. These are then used in the lighting equations to determine the resulting pixel colors. Both flat and Gouraud shading are commonly used methods. The complexity of Phong shading has prevented it from being widely supported in hardware.

Z-Buffer

In our earlier description of the rendering process, we followed rays of light from our eye through a pixel in the image plane to the actors and back to the light source. A nice side effect of ray tracing is that viewing rays strike the first actor they encounter and ignore any actors that are hidden behind it. When rendering actors using the polygonal methods described above, we have no such method of computing which polygons are hidden and which are not. We cannot generally count on the polygons being ordered correctly. Instead, we can use a number of hidden-surface methods for polygon rendering.

One method is to sort all of our polygons from back to front (along the camera's view vector) and then render them in that order. This is called the painter's algorithm or painter's sort, and has one major weakness illustrated in Figure 3-23. Regardless of the order in which we draw these three triangles, we cannot obtain the desired result, since each triangle is both in front of, and behind, another triangle. There are algorithms that sort and split polygons as necessary to treat such a situation [Carlson85]. This requires more initial processing to perform the sorting and splitting. If the geometric primitives change between images or the camera view changes, then this processing must be performed before each render.

Figure 3-23
Figure 3-23. Problem with Painter's algorithm.

Another hidden surface algorithm, z-buffering, takes care of this problem and does not require sorting. Z-buffering takes advantage of the z-value (i.e., depth value along direction of projection) in the view coordinate system. Before a new pixel is drawn, its z-value is compared against the current z-value for that pixel location. If the new pixel would be in front of the current pixel, then it is drawn and the z-value for that pixel location is updated. Otherwise the current pixel remains and the new pixel is ignored. Z-buffering has been widely implemented in hardware because of its simplicity and robustness. The downside to z-buffering is that it requires a large amount of memory, called a z-buffer, to store a z-value of every pixel. Most systems use a z-buffer with a depth of 24 or 32 bits. For a 1000 by 1000 display that translates into three to four megabytes just for the z-buffer. Another problem with z-buffering is that its accuracy is limited depending on its depth. A 24-bit z-buffer yields a precision of one part in 16,777,216 over the height of the viewing frustum. This resolution is often insufficient if objects are close together. If you do run into situations with z-buffering accuracy, make sure that the front and back clipping planes are as close to the visible geometry as possible.

3.10 Putting It All Together

This section provides an overview of the graphics objects and how to use them in VTK.

The Graphics Model

Figure 3-24
Figure 3-24. Illustrative diagram of graphics objects. See Model.cxx and Model.py.

We have discussed many of the objects that play a part in the rendering of a scene. Now it's time to put them together into a comprehensive object model for graphics and visualization.

In the Visualization Toolkit there are seven basic objects that we use to render a scene. There are many more objects behind the scenes, but these seven are the ones we use most frequently. The objects are listed in the following and illustrated in Figure 3-24.

  1. vtkRenderWindow --- manages a window on the display device; one or more renderers draw into an instance of vtkRenderWindow.

  2. vtkRenderer --- coordinates the rendering process involving lights, cameras, and actors.

  3. vtkLight --- a source of light to illuminate the scene.

  4. vtkCamera --- defines the view position, focal point, and other viewing properties of the scene.

  5. vtkActor --- represents an object rendered in the scene, including its properties and position in the world coordinate system. (Note: vtkActor is a subclass of vtkProp. vtkProp is a more general form of actor that includes annotation and 2D drawing classes. See "Assemblies and Other Types of vtkProp" for more information.)

  6. vtkProperty --- defines the appearance properties of an actor including color, transparency, and lighting properties such as specular and diffuse. Also representational properties like wireframe and solid surface.

  7. vtkMapper --- the geometric representation for an actor. More than one actor may refer to the same mapper.

The class vtkRenderWindow ties the rendering process together. It is responsible for managing a window on the display device. For PCs running Windows, this will be a Microsoft display window, for Linux and UNIX systems this will be an X window, and on the Mac (OSX) a Quartz window. In VTK, instances of vtkRenderWindow are device independent. This means that you do not need to be concerned about what underlying graphics hardware or software is being used, the software automatically adapts to your computer as instances of vtkRenderWindow are created. (See "Achieving Device Independence" for more information.)

In addition to window management, vtkRenderWindow objects are used to manage renderers and store graphics specific characteristics of the display window such as size, position, window title, window depth, and the double buffering flag. The depth of a window indicates how many bits are allocated per pixel. Double buffering is a technique where a window is logically divided into two buffers. At any given time one buffer is currently visible to the user. Meanwhile, the second buffer can be used to draw the next image in an animation. Once the rendering is complete, the two buffers can be swapped so that the new image is visible. This common technique allows animations to be displayed without the user seeing the actual rendering of the primitives. High-end graphics systems perform double buffering in hardware. A typical system would have a rendering window with a depth of 72 bits. The first 24 bits are used to store the red, green, and blue (RGB) pixel components for the front buffer. The next 24 bits store the RGB values for the back buffer. The last 24 bits are used as a z-buffer.

The class vtkRenderer is responsible for coordinating its lights, camera, and actors to produce an image. Each instance maintains a list of the actors, lights, and an active camera in a particular scene. At least one actor must be defined, but if lights and a camera are not defined, they will be created automatically by the renderer. In such a case the actors are centered in the image and the default camera view is down the z-axis. Instances of the class vtkRenderer also provide methods to specify the background and ambient lighting colors. Methods are also available to convert to and from world, view, and display coordinate systems.

One important aspect of a renderer is that it must be associated with an instance of the vtkRenderWindow class into which it is to draw, and the area in the render window into which it draws must be defined by a rectangular viewport. The viewport is defined by normalized coordinates (0,1) in both the x and y image coordinate axes. By default, the renderer draws into the full extent of the rendering window (viewpoint coordinates (0,0,1,1)). It is possible to specify a smaller viewport. and to have more than one renderer draw into the same rendering window.

Instances of the class vtkLight illuminate the scene. Various instance variables for orienting and positioning the light are available. It is also possible to turn on/off lights as well as setting their color. Normally at least one light is "on" to illuminate the scene. If no lights are defined and turned on, the renderer constructs a light automatically. Lights in VTK can be either positional or infinite. Positional lights have an associated cone angle and attenuation factors. Infinite lights project light rays parallel to one another.

Cameras are constructed by the class vtkCamera. Important parameters include camera position, focal point, location of front and back clipping planes, view up vector, and field of view. Cameras also have special methods to simplify manipulation as described previously in this chapter.

These include elevation, azimuth, zoom, and roll. Similar to vtkLight, an instance of vtkCamera will be created automatically by the renderer if none is defined.

Instances of the class vtkActor represent objects in the scene. In particular, vtkActor combines object properties (color, shading type, etc.), geometric definition, and orientation in the world coordinate system. This is implemented behind the scenes by maintaining instance variables that refer to instances of vtkProperty, vtkMapper, and vtkTransform. Normally you need not create properties or transformations explicitly, since these are automatically created and manipulated using vtkActor 's methods. You do need to create an instance of vtkMapper (or one of its subclasses). The mapper ties the data visualization pipeline to the graphics device. (We will say more about the pipeline in the next chapter.)

In VTK, actors are actually subclasses of vtkProp (arbitrary props) and [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)3D (those that can be transformed in 3D space. (The word "prop" is derived from the stage, where a prop is an object in the scene.) There are other subclasses of props and actors with specialized behavior (see "Assemblies and Other Types of vtkProp" for more information). One example is vtkFollower. Instances of this class always face the active camera. This is useful when designing signs or text that must be readable from any camera position in the scene.

Instances of the class vtkProperty affect the rendered appearance of an actor. When actors are created, a property instance is automatically created with them. It is also possible to create property objects directly and then associate the property object with one or more actors. In this way actors can share common properties.

Finally, vtkMapper (and its subclasses) defines object geometry and, optionally, vertex colors. In addition, vtkMapper refers to a table of colors (i.e., vtkLookupTable) that are used to color the geometry. (We discuss mapping of data to colors in "Color Mapping" in Chapter 6.) We will examine the mapping process in more detail in "Mapper Design" in Chapter 6. For now assume that vtkMapper is an object that represents geometry and other types of visualization data.

There is another important object, vtkRenderWindowInteractor, that captures events (such as mouse clicks and mouse motion) for a renderer in the rendering window. vtkRenderWindowInteractor captures these events and then triggers certain operations like camera dolly, pan, and rotate, actor picking, into/out of stereo mode, and so on. Instances of this class are associated with a rendering window using the SetRenderWindow() method.

Achieving Device Independence

A desirable property of applications built with VTK is that they are device independent. This means that computer code that runs on one operating system with a particular software/hardware configuration runs unchanged on a different operating system and software/hardware configuration. The advantage of this is that the programmer does not need to expend effort porting an application between different computer systems. Also, existing applications do not need to be rewritten to take advantage of new developments in hardware or software technology. Instead, VTK handles this transparently by a combination of inheritance and a technique known as object factories.

Figure3-25a
(a) Inheritance of device classes. (Note: in VTK 4.2 the Starbase and XGL graphics libraries are no longer supported.)
Figure3-25b
(b) Code fragment from vtkActor::New()
Figure3-25c
(c) Code fragment from vtkGraphicsFactory::CreateInstance(vtkclassname).
Figure 3-25. Achieving device independence using (a) inheritance and object factories (b) and (c).

Figure 3-25a illustrates the use of inheritance to achieve device independence. Certain classes like vtkActor are broken into two parts: a device independent superclass and a device dependent subclass. The trick here is that the user creates a device dependent subclass by invoking the special constructor New() in the device independent superclass. For example we would use (in C++)

vtkActor *anActor = vtkActor::New()
+ 

Rotations occur about the coordinate origin. It is often more convenient to rotate around the center of the object (or a user-specified point). Assume that we call this point the object's center. To rotate around O_c we must first translate the object from O_c to the origin, apply rotations, and then translate the object back to O_c.

Transformation matrices can be combined by matrix multiplication to achieve combinations of translation, rotation, and scaling. It is possible for a single transformation matrix to represent all types of transformation simultaneously. This matrix is the result of repeated matrix multiplications. A word of warning: The order of the multiplication is important. For example, multiplying a translation matrix by a rotation matrix will not yield the same result as multiplying the rotation matrix by the translation matrix.

3.8 Actor Geometry

We have seen how lighting properties control the appearance of an actor, and how the camera in combination with transformation matrices is used to project an actor to the image plane. What is left to define is the geometry of the actor, and how we position it in the world coordinate system.

Modelling

A major topic in the study of computer graphics is modelling or representing the geometry of physical objects. Various mathematical techniques have been applied including combinations of points, lines, polygons, curves, and splines of various forms, and even implicit mathematical functions.

This topic is beyond the scope of the text. The important point here is that there is an underlying geometric model that specifies what the object's shape is and where it is located in the model coordinate system.

In data visualization, modelling takes a different role. Instead of directly creating geometry to represent an object, visualization algorithms compute these forms. Often the geometry is abstract (like a contour line) and has little relationship to real world geometry. We will see how these models are computed when we describe visualization algorithms in Chapter 6 - Fundamental Algorithms and Chapter 9 - Advanced Algorithms.

The representation of geometry for data visualization tends to be simple, even though computing the representations is not. These forms are most often primitives like points, lines, and polygons, or visualization data such as volume data. We use simple forms because we desire high performance and interactive systems. Thus we take advantage of computer hardware (to be covered in "Graphics Hardware") or special rendering techniques like volume rendering (see "Volume Rendering" in Chapter 7).

Actor Location and Orientation

Every actor has a transformation matrix that controls its location and scaling in world space. The actor's geometry is defined by a model in model coordinates. We specify the actor's location using orientation, position, and scale factors along the coordinate axes. In addition, we can define an origin around which the actor rotates. This feature is useful because we can rotate the actor around its center or some other meaningful point.

The orientation of an actor is determined by rotations stored in an orientation vector (Ox,Roy,Oz). This vector defines a series of rotational transformation matrices. As we saw in the previous section on transformation matrices, the order of application of the transformations is not arbitrary. We have chosen a fixed order based on what we think is natural to users. The order of transformation is a rotation by O y around the y axis, then by around Ox the x axis, and finally by O z around the z axis. This ordering is arbitrary and is based on the standard camera operations. These operations (in order) are a camera azimuth, followed by an elevation, and then a roll (Figure 3-15).

All of these rotations take place around the origin of the actor. Typically this is set to the center of its bounding box, but it can be set to any convenient point. There are many different methods for changing an actor's orientation. RotateX(), RotateY(), and RotateZ() are common methods that rotate about their respective axes. Many systems also include a method to rotate about a userdefined axis. In the Visualization Toolkit the RotateXYZ() method is used to rotate around an arbitrary vector passing through the origin.

Figure 3-15
Figure 3-15. Actor coordinate system.

3.9 Graphics Hardware

Earlier we mentioned that advances in graphics hardware have had a large impact on how rendering is performed. Now that we have covered the fundamentals of rendering a scene, we look at some of the hardware issues. First, we discuss raster devices that have replaced vector displays as the primary output device. Then, we look at how our programs communicate to the graphics hardware. We also examine the different coordinate systems used in computer graphics, hidden line/surface removal, and z-buffering.

Raster Devices

The results of computer graphics is pervasive in today's world---digital images (generated with computer graphics) may be found on cell phones, displayed on computer monitors, broadcast on TV, shown at the movie theatre and presented on electronic billboards. All of these, and many more, display mediums are raster devices. A raster device represents an image using a two dimensional array of picture elements called pixels. For example, the word "hello" can be represented as an array of pixels. as shown in Figure 3-16. Here the word "hello" is written within a pixel array that is twenty-five pixels wide and ten pixels high. Each pixel stores one bit of information, whether it is black or white. This is how a black and white laser printer works, for each point on the paper it either prints a black dot or leaves it the color of the paper. Due to hardware limitations, raster devices such as laser printers and computer monitors do not actually draw accurate square pixels like those in Figure 3-16. Instead, they tend to be slightly blurred and overlapping. Another hardware limitation of raster devices is their resolution. This is what causes a 300 dpi (dots per inch) laser printer to produce more detailed output than a nine pin dot matrix printer. A 300 dpi laser printer has a resolution of 300 pixels per inch compared to roughly 50 dpi for the dot matrix printer.

Figure 3-16
Figure 3-16. A pixel array for the word "hello."
Figure 3-17
Figure 3-17. Black and white dithering.

Color computer monitors typically have a resolution of about 80 pixels per inch, making the screen a pixel array roughly one thousand pixels in width and height. This results in over one million pixels, each with a value that indicates what color it should be. Since the hardware in color monitors uses the RGB system, it makes sense to use that to describe the colors in the pixels. Unfortunately, having over one million pixels, each with a red, green, and blue component, can take up a lot of memory. This is part of what differentiates the variety of graphics hardware on the market. Some companies use 24 bits of storage per pixel, others use eight, some advanced systems use more than 100 bits of storage per pixel. Typically, the more bits per pixel the more accurate the colors will be.

One way to work around color limitations in the graphics hardware is by using a technique called dithering. Say, for example, that you want to use some different shades of gray, but your graphics hardware only supports black and white. Dithering lets you approximate shades of gray by using a mixture of both black and white pixels. In Figure 3-17, seven gray squares are drawn using a mixture of black and white pixels. From a distance the seven squares look like different shades of gray even though up close, it's clear that they are just different mixtures of black and white pixels. This same technique works just as well for other colors. For example, if your graphics hardware supports primary blue, primary green, and white but not a pastel sea green, you can approximate this color by dithering the green, blue, and white that the hardware does support.

Interfacing to the Hardware

Now that we have covered the basics of display hardware, the good news is that you rarely need to worry about them. Most graphics programming is done using higher-level primitives than individual pixels. Figure 3-18 shows a typical arrangement for a visualization program. At the bottom of the hierarchy is the display hardware that we already discussed; chances are your programs will not interact directly with it. The top three layers above the hardware are the layers you may need to be concerned with.

Many programs take advantage of application libraries as a high-level interface to the graphics capabilities of a system. The Visualization Toolkit accompanying this book is a prime example of this. It allows you to display a complex object or graph using just a few commands. It is also possible to interface to a number of different graphics libraries, since different libraries may be supported on different hardware platforms.

The graphics library and graphics hardware layers both perform similar functions. They are responsible for taking high-level commands from an application library or program, and executing them. This makes programming much easier by providing more complex primitives to work with. Instead of drawing pixels one at a time, we can draw primitives like polygons, triangles, and lines, without worrying about the details of which pixels are being set to which colors. Figure 3-19 illustrates some high-level primitives that all mainstream graphics libraries support.

This functionality is broken into two different layers because different machines may have vastly different graphics hardware. If you write a program that draws a red polygon, either the graphics library or the graphics hardware must be able to execute that command. On high-end systems, this may be done in the graphics hardware, on others it will be done by the graphics library in software. So the same commands can be used with a wide variety of machines, without worrying about the underlying graphics hardware.

The fundamental building block of the primitives in Figure 3-19 is a point (or vertex). A vertex has a position, normal, and color, each of which is a three element vector. The position specifies where the vertex is located, its normal specifies which direction the vertex is facing, and its color specifies the vertex's red, green, and blue components.

A polygon is built by connecting a series of points or vertices as shown in Figure 3-20. You may be wondering why each vertex has a normal, instead of having just one normal for the entire polygon. A planar polygon can only be facing one direction regardless of what the normals of its vertices indicate. The reason is that sometimes a polygon is used as an approximation of something else, like a curve. Figure 3-21 shows a top-down view of a cylinder. As you can see, it's not really a cylinder but rather a polygonal approximation of the cylinder drawn in gray. Each vertex is shared by two polygons and the correct normal for the vertex is not the same as the normal for the polygon. Similar logic explains why each vertex has a color instead of just having one color for an entire polygon.

Figure 3-18
Figure 3-18. Typical graphics interface hierarchy.
Figure 3-19
Figure 3-19. Graphics primitives.

When you limit yourself to the types of primitives described above, there are some additional properties that many graphics systems support. Edge color and edge visibility can be used to highlight the polygon primitives that make up an actor. Another way to do this is by adjusting the representation from surface to wireframe or points. This replaces surfaces such as polygons with either their boundary edges or points respectively. While this may not make much sense from a physical perspective, it can help in some illustrations. Using edge visibility when rendering a CAD model can help to show the different pieces that comprise the model.

Rasterization

At this point in the text we have described how to represent graphics data using rendering primitives, and we have described how to represent images using raster display devices. The question remains, how do we convert graphics primitives into a raster image? This is the topic we address in this section. Although a thorough treatise on this topic is beyond the scope of this text, we will do our best to provide a high-level overview.

Figure 3-20
Figure 3-20. An example polygon.
Figure 3-21
Figure 3-21. Vertex and polygon normals.

The process of converting a geometric representation into a raster image is called rasterization or scan conversion. In the description that follows we assume that the graphics primitives are triangle polygons. This is not as limiting as you might think, because any general polygon can be tessellated into a set of triangles. Moreover, other surface representations such as splines are usually tessellated by the graphics system into triangles or polygons. (The method described here is actually applicable to convex polygons.)

Most of today's hardware is based on object-order rasterization techniques. As we saw earlier in this chapter, this means processing our actors in order. And since our actors are represented by polygon primitives, we process polygons one at a time. So although we describe the processing of one polygon, bear in mind that many polygons and possibly many actors are processed.

The first step is to transform the polygon using the appropriate transformation matrix. We also project the polygon to the image plane using either parallel or orthographic projection. Part of this process involves clipping the polygons. Not only do we use the front and back clipping planes to clip polygons too close or too far, but we must also clip polygons crossing the boundaries of the image plane. Clipping polygons that cross the boundary of the view frustum means we have to generate new polygonal boundaries.

Figure 3-22
Figure 3-22. Rasterizing a convex polygon. Pixels are processed in horizontal spans (or scan-lines) in the image plane. Data values $d_i$ at point $p_i$ are interpolated along the edges and then along the scan-line using delta data values. Typical data values are RGB components of color.

With the polygon clipped and projected to the image plane, we can begin scan-line processing (Figure 3-22). The first step identifies the initial scan-line intersected by the projected polygon. This is found by sorting the vertices' y values. We then find the two edges joining the vertex on the left and right sides. Using the slopes of the edges along with the data values we compute delta data values. These data are typically the R, G, and B color components. Other data values include transparency values and z depth values. (The z values are necessary if we are using a z-buffer, described in the next section.) The row of pixels within the polygon (i.e., starting at the left and right edges) is called a span. Data values are interpolated from the edges on either side of the span to compute the internal pixel values. This process continues span-by-span, until the entire polygon is filled. Note that as new vertices are encountered, it is necessary to recompute the delta data values.

The shading of the polygon (i.e., color interpolation across the polygon) varies depending on the actor's interpolation attribute. There are three possibilities: flat, Gouraud, or Phong shading. Figure 3-7 illustrates the difference between flat and Gouraud interpolation. Flat shading calculates the color of a polygon by applying the lighting equations to just one normal (typically the surface normal) of the polygon. Gouraud shading calculates the color of a polygon at all of its vertices using the vertices' normals and the standard lighting equations. The interior and edges of the poly-gon are then filled in by applying the scan-line interpolation process. Phong shading is the most realistic of the three. It calculates a normal at every location on the polygon by interpolating the vertex normals. These are then used in the lighting equations to determine the resulting pixel colors. Both flat and Gouraud shading are commonly used methods. The complexity of Phong shading has prevented it from being widely supported in hardware.

Z-Buffer

In our earlier description of the rendering process, we followed rays of light from our eye through a pixel in the image plane to the actors and back to the light source. A nice side effect of ray tracing is that viewing rays strike the first actor they encounter and ignore any actors that are hidden behind it. When rendering actors using the polygonal methods described above, we have no such method of computing which polygons are hidden and which are not. We cannot generally count on the polygons being ordered correctly. Instead, we can use a number of hidden-surface methods for polygon rendering.

One method is to sort all of our polygons from back to front (along the camera's view vector) and then render them in that order. This is called the painter's algorithm or painter's sort, and has one major weakness illustrated in Figure 3-23. Regardless of the order in which we draw these three triangles, we cannot obtain the desired result, since each triangle is both in front of, and behind, another triangle. There are algorithms that sort and split polygons as necessary to treat such a situation [Carlson85]. This requires more initial processing to perform the sorting and splitting. If the geometric primitives change between images or the camera view changes, then this processing must be performed before each render.

Figure 3-23
Figure 3-23. Problem with Painter's algorithm.

Another hidden surface algorithm, z-buffering, takes care of this problem and does not require sorting. Z-buffering takes advantage of the z-value (i.e., depth value along direction of projection) in the view coordinate system. Before a new pixel is drawn, its z-value is compared against the current z-value for that pixel location. If the new pixel would be in front of the current pixel, then it is drawn and the z-value for that pixel location is updated. Otherwise the current pixel remains and the new pixel is ignored. Z-buffering has been widely implemented in hardware because of its simplicity and robustness. The downside to z-buffering is that it requires a large amount of memory, called a z-buffer, to store a z-value of every pixel. Most systems use a z-buffer with a depth of 24 or 32 bits. For a 1000 by 1000 display that translates into three to four megabytes just for the z-buffer. Another problem with z-buffering is that its accuracy is limited depending on its depth. A 24-bit z-buffer yields a precision of one part in 16,777,216 over the height of the viewing frustum. This resolution is often insufficient if objects are close together. If you do run into situations with z-buffering accuracy, make sure that the front and back clipping planes are as close to the visible geometry as possible.

3.10 Putting It All Together

This section provides an overview of the graphics objects and how to use them in VTK.

The Graphics Model

Figure 3-24
Figure 3-24. Illustrative diagram of graphics objects. See Model.cxx and Model.py.

We have discussed many of the objects that play a part in the rendering of a scene. Now it's time to put them together into a comprehensive object model for graphics and visualization.

In the Visualization Toolkit there are seven basic objects that we use to render a scene. There are many more objects behind the scenes, but these seven are the ones we use most frequently. The objects are listed in the following and illustrated in Figure 3-24.

  1. vtkRenderWindow --- manages a window on the display device; one or more renderers draw into an instance of vtkRenderWindow.

  2. vtkRenderer --- coordinates the rendering process involving lights, cameras, and actors.

  3. vtkLight --- a source of light to illuminate the scene.

  4. vtkCamera --- defines the view position, focal point, and other viewing properties of the scene.

  5. vtkActor --- represents an object rendered in the scene, including its properties and position in the world coordinate system. (Note: vtkActor is a subclass of vtkProp. vtkProp is a more general form of actor that includes annotation and 2D drawing classes. See "Assemblies and Other Types of vtkProp" for more information.)

  6. vtkProperty --- defines the appearance properties of an actor including color, transparency, and lighting properties such as specular and diffuse. Also representational properties like wireframe and solid surface.

  7. vtkMapper --- the geometric representation for an actor. More than one actor may refer to the same mapper.

The class vtkRenderWindow ties the rendering process together. It is responsible for managing a window on the display device. For PCs running Windows, this will be a Microsoft display window, for Linux and UNIX systems this will be an X window, and on the Mac (OSX) a Quartz window. In VTK, instances of vtkRenderWindow are device independent. This means that you do not need to be concerned about what underlying graphics hardware or software is being used, the software automatically adapts to your computer as instances of vtkRenderWindow are created. (See "Achieving Device Independence" for more information.)

In addition to window management, vtkRenderWindow objects are used to manage renderers and store graphics specific characteristics of the display window such as size, position, window title, window depth, and the double buffering flag. The depth of a window indicates how many bits are allocated per pixel. Double buffering is a technique where a window is logically divided into two buffers. At any given time one buffer is currently visible to the user. Meanwhile, the second buffer can be used to draw the next image in an animation. Once the rendering is complete, the two buffers can be swapped so that the new image is visible. This common technique allows animations to be displayed without the user seeing the actual rendering of the primitives. High-end graphics systems perform double buffering in hardware. A typical system would have a rendering window with a depth of 72 bits. The first 24 bits are used to store the red, green, and blue (RGB) pixel components for the front buffer. The next 24 bits store the RGB values for the back buffer. The last 24 bits are used as a z-buffer.

The class vtkRenderer is responsible for coordinating its lights, camera, and actors to produce an image. Each instance maintains a list of the actors, lights, and an active camera in a particular scene. At least one actor must be defined, but if lights and a camera are not defined, they will be created automatically by the renderer. In such a case the actors are centered in the image and the default camera view is down the z-axis. Instances of the class vtkRenderer also provide methods to specify the background and ambient lighting colors. Methods are also available to convert to and from world, view, and display coordinate systems.

One important aspect of a renderer is that it must be associated with an instance of the vtkRenderWindow class into which it is to draw, and the area in the render window into which it draws must be defined by a rectangular viewport. The viewport is defined by normalized coordinates (0,1) in both the x and y image coordinate axes. By default, the renderer draws into the full extent of the rendering window (viewpoint coordinates (0,0,1,1)). It is possible to specify a smaller viewport. and to have more than one renderer draw into the same rendering window.

Instances of the class vtkLight illuminate the scene. Various instance variables for orienting and positioning the light are available. It is also possible to turn on/off lights as well as setting their color. Normally at least one light is "on" to illuminate the scene. If no lights are defined and turned on, the renderer constructs a light automatically. Lights in VTK can be either positional or infinite. Positional lights have an associated cone angle and attenuation factors. Infinite lights project light rays parallel to one another.

Cameras are constructed by the class vtkCamera. Important parameters include camera position, focal point, location of front and back clipping planes, view up vector, and field of view. Cameras also have special methods to simplify manipulation as described previously in this chapter.

These include elevation, azimuth, zoom, and roll. Similar to vtkLight, an instance of vtkCamera will be created automatically by the renderer if none is defined.

Instances of the class vtkActor represent objects in the scene. In particular, vtkActor combines object properties (color, shading type, etc.), geometric definition, and orientation in the world coordinate system. This is implemented behind the scenes by maintaining instance variables that refer to instances of vtkProperty, vtkMapper, and vtkTransform. Normally you need not create properties or transformations explicitly, since these are automatically created and manipulated using vtkActor 's methods. You do need to create an instance of vtkMapper (or one of its subclasses). The mapper ties the data visualization pipeline to the graphics device. (We will say more about the pipeline in the next chapter.)

In VTK, actors are actually subclasses of vtkProp (arbitrary props) and vtkProp3D (those that can be transformed in 3D space. (The word "prop" is derived from the stage, where a prop is an object in the scene.) There are other subclasses of props and actors with specialized behavior (see "Assemblies and Other Types of vtkProp" for more information). One example is vtkFollower. Instances of this class always face the active camera. This is useful when designing signs or text that must be readable from any camera position in the scene.

Instances of the class vtkProperty affect the rendered appearance of an actor. When actors are created, a property instance is automatically created with them. It is also possible to create property objects directly and then associate the property object with one or more actors. In this way actors can share common properties.

Finally, vtkMapper (and its subclasses) defines object geometry and, optionally, vertex colors. In addition, vtkMapper refers to a table of colors (i.e., vtkLookupTable) that are used to color the geometry. (We discuss mapping of data to colors in "Color Mapping" in Chapter 6.) We will examine the mapping process in more detail in "Mapper Design" in Chapter 6. For now assume that vtkMapper is an object that represents geometry and other types of visualization data.

There is another important object, vtkRenderWindowInteractor, that captures events (such as mouse clicks and mouse motion) for a renderer in the rendering window. vtkRenderWindowInteractor captures these events and then triggers certain operations like camera dolly, pan, and rotate, actor picking, into/out of stereo mode, and so on. Instances of this class are associated with a rendering window using the SetRenderWindow() method.

Achieving Device Independence

A desirable property of applications built with VTK is that they are device independent. This means that computer code that runs on one operating system with a particular software/hardware configuration runs unchanged on a different operating system and software/hardware configuration. The advantage of this is that the programmer does not need to expend effort porting an application between different computer systems. Also, existing applications do not need to be rewritten to take advantage of new developments in hardware or software technology. Instead, VTK handles this transparently by a combination of inheritance and a technique known as object factories.

Figure3-25a
(a) Inheritance of device classes. (Note: in VTK 4.2 the Starbase and XGL graphics libraries are no longer supported.)
Figure3-25b
(b) Code fragment from vtkActor::New()
Figure3-25c
(c) Code fragment from vtkGraphicsFactory::CreateInstance(vtkclassname).
Figure 3-25. Achieving device independence using (a) inheritance and object factories (b) and (c).

Figure 3-25a illustrates the use of inheritance to achieve device independence. Certain classes like vtkActor are broken into two parts: a device independent superclass and a device dependent subclass. The trick here is that the user creates a device dependent subclass by invoking the special constructor New() in the device independent superclass. For example we would use (in C++)

vtkActor *anActor = vtkActor::New()
 

to create a device dependent instance of vtkActor. The user sees no device dependent code, but in actuality anActor is a pointer to a device dependent subclass of vtkActor. Figure 3-25b is a code fragment of the constructor method New() which uses VTK's object factory mechanism. In turn, the vtkGraphicsFactory (used to instantiate graphical classes) produces the appropriate concrete subclass when requested to instantiate an actor as shown in Figure 3-25c.

The use of object factories as implemented using the New() method allows us to create device independent code that can move from computer to computer and adapt to changing technology. For example, if a new graphics library became available, we would only have to create a new device dependent subclass, and then modify the graphics factory to instantiate the appropriate sub-class based on environment variables or other system information. This extension would be localized and only done once, and all applications based on these object factories would be automatically ported without change.

Examples

This section works through some simple applications implemented with VTK graphics objects. The focus is on the basics: how to create renderers, lights, cameras, and actors. Later chapters tie together these basic principles to create applications for data visualization.

. The following C++ code uses most of the objects introduced in this section to create an image of a cone. The vtkConeSource generates a polygonal representation of a cone and vtkPolyDataMapper maps the geometry (in conjunction with the actor) to the underlying graphics library. (The source code to this example can be found in Cone.cxx. The source code contains additional documentation as well.) 2

#include <vtkSmartPointer.h>
 #include <vtkConeSource.h>
 
@@ -417,4 +417,4 @@
 
 ren1 AddActor assembly
 ren1 AddActor coneActor
-
Figure3-34
Figure 3-34. Figure 3-34 The vtkProp hierarchy. Props that can be transformed in 3D space are a subclass of vtkProp3D. Images can be drawn effectively with vtkImageActor. Overlay text and graphics use vtkActor2D. Hierarchical groups of vtkProps are gathered into a vtkPropAssembly. Volume rendering uses vtkVolume. Collections of transformable props create a vtkAssembly. Level-of-detail rendering uses vtkLODProp3D and vtkLODActor. A vtkFollower allows faces a specified camera and is used for billboards.

Note that in this example various actors are added to the assembly with the AddPart() method. The top-level element of the assembly is the only prop in the hierarchy added to the renderer (with AddActor()). Note also that the coneActor appears twice: once as a part of the assembly, and once as a separate actor added to the renderer with AddActor(). As you might imagine, this means that the rendering of assemblies requires concatenation of transformation matrices to insure the correct positioning of each [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)3D. Furthermore, hierarchical assemblies require special treatment during picking (i.e., graphically selecting props) since a vtkProp can appear more than once in differ-ent assembly hierarchies. Picking issues are discussed in more detail in "Picking" in Chapter 8.

As Figure 3-34 indicates, there are other types of vtkProp as well. Most of these will be informally described in the many examples found in this book. In particular, extensive coverage is given to vtkVolume when we describe volume rendering (see "Volume Rendering" in Chapter 7).

3.11 Chapter Summary

Rendering is the process of generating an image using a computer. Computer graphics is the field of study that encompasses rendering techniques, and forms the foundation of data visualization.

Three-dimensional rendering techniques simulate the interaction of lights and cameras with objects, or actors, to generate images. A scene consists of a combination of lights, cameras, and actors. Object-order rendering techniques generate images by rendering actors in a scene in order. Image-order techniques render the image one pixel at a time. Polygonbased graphics hardware is based on object-order techniques. Ray tracing or ray-casting is an image-order technique.

Lighting models require a specification of color. We saw both the RGB (red-green-blue) and HSV (hue-saturation-value) color models. The HSV model is a more natural model than the RGB model for most users. Lighting models also include effects due to ambient, diffuse, and specular lighting.

There are four important coordinate systems in computer graphics. The model system is the 3D coordinate system where our geometry is defined. The world system is the global Cartesian system. All modeled data is eventually transformed into the world system. The view coordinate system represents what is visible to the camera. It is a 2D system scaled from (-1,1). The display coordinate system uses actual pixel locations on the computer display.

Homogeneous coordinates are a 4D coordinate system in which we can include the effects of perspective transformation. Transformation matrices are 4x4 matrices that operate on homogeneous coordinates. Transformation matrices can represent the effects of translation, scaling, and rotation of an actor. These matrices can be multiplied together to give combined transformations.

Graphics programming is usually implemented using higher-level graphics libraries and specialized hardware systems. These dedicated systems offer better performance and easier implemen-tation of graphics applications. Common techniques implemented in these systems include dithering and z-buffering. Dithering is a technique to simulate colors by mixing combinations of available colors . Z-buffering is a technique to perform hidden-line and hidden-surface removal.

The Visualization Toolkit uses a graphics model based on lights, cameras, actors, and render-ers. The renderers draw into rendering windows. Actor properties are represented by a property object and their geometry by a mapper object. Taken together, the instantiations of these various classes form a scene. Interaction with the objects in a scene is facilitated by the vtkRenderWindowInteractor and vtkInteractorStyle classes. These use the command/observer design pattern that triggers and responds to events. Users can observe particular events and write callbacks that can perform arbitrary tasks, easily extending the toolkit for a particular application.

3.12 Bibliographic Notes

This chapter provides the reader with enough information to understand the basic issues and terms used in computer graphics. There are a number of good text books that cover computer graphics in more detail and are recommended to readers who would like a more thorough understanding. The bible of computer graphics is [FoleyVanDam90]. For those wishing for less intimidating books [BurgerGillies89] and [Watt93] are also useful references. You also may wish to peruse proceedings of the ACM SIGGRAPH conferences. These include papers and references to other papers for some of the most important work in computer graphics. [Carlson85] provides a good introduction for those who wish to learn more about the human vision system.

3.13 References

[Bresenham65] J. E. Bresenham."Algorithm for Computer Control of a Digital Plotter." IBM Systems Journal, 4(1): 25--30, January 1965.

[BurgerGillies89] P. Burger and D. Gillies. Interactive Compute Graphics Functional, Procedural and Device-Level Methods. Addison-Wesley, Reading, MA, 1989.

[Carlson85] N. R. Carlson. Physiology of Behaviour (3d Edition). Allyn and Bacon Inc., Newton, MA, 1985.

[Dartnall83] H. J. A. Dartnall, J. K. Bowmaker, and J. D. Mollon. "Human Visual Pigments: Microspectropho-tometric Results from the Eyes of Seven Persons." Proceedings of the Royal Society, London, 1983.

[FoleyVanDam90] J. D. Foley, A. van Dam, S. K. Feiner, and J. F. Hughes. Computer Graphics Principles and Practice (2d Edition). Addison-Wesley, Reading, MA, 1990.

[Fuchs80] H. Fuchs, Z. M. Kedem, and B. F. Naylor. "On Visible Surface Generation By A Priori Tree Structure." Computer Graphics (SIGGRAPH '80), 14(3):124--133, 1980.

[Gamma95] E. Gamma, R. Helm, R. Johnson, J. Vlissides. Design Patterns Elements of Reusable Object-Oriented Software. Addison-Wesley 1995. ISBN0-201-63361-2.

[Ousterhout94] J. K.Ousterhout. Tcl and the Tk Toolkit. Addison-Wesley Publishing Company, Reading, MA, 1994.

[Watt93] A. Watt. 3D Computer Graphics (2d Edition). Addison-Wesley, Reading, MA, 1993.

[Whitted80] T. Whitted. "An Improved Illumination Model for Shaded Display." Communications of the ACM, 23(6):343-349, 1980.

3.14 Exercises

3.1 Estimate the odds of a ray of light being emitted from the sun, traveling to earth and hitting a one meter square picnic blanket. You can assume that the sun is a point light source that emits light uniformly in all directions. The approximate distance from the sun to the earth is 150,000,000 km.

a) What are the odds when the sun is directly overhead?

b) What are the odds when the sun is inclined 45 degrees relative to the surface normal of the picnic blanket?

c) What assumptions or approximations did you make?

3.2 Proceeding from your result of Exercise 3.1, what are the difficulties in determining the odds of a ray of light traveling from the sun to hit the picnic blanket and then entering a viewer's eye?

3.3 The color cyan can be represented in both the HSV and RGB color spaces as shown in Figure 3-4. These two representations for cyan do not yield the same wavelength intensity plots. How do they differ?

3.4 The vtkSphereSource class generates a polygonal model of a sphere. Using the examples at the end of this chapter as starting points, create a program to display a white sphere. Set the ambient and diffuse intensities to 0.5. Then add a for-loop to this program that adjusts the ambient and diffuse color of this sphere so that as the loop progresses, the diffuse color goes from red to blue, and the ambient color goes from blue to green. You might also try adjusting other lighting parameters such as specular color, ambient, diffuse, and specular intensity.

3.5 Using the vtkSphereSource as described in Exercise 3.4, create a program to display the sphere with a light source positioned at (1,1,1). Then extend this program by adding a forloop that will adjust the active camera's clipping range so that increasing portions of the interior of the sphere can be seen. By increasing the first value of the clipping range, you will be adjusting the position of the front clipping plane. Once the front clipping plane starts intersecting the sphere, you should be able to see inside of it. The default radius of the vtkSphereSource is 0.5, so make sure that you adjust the clipping range in increments less than 1.0.

3.6 Modify the program presented in "Render a Cone" so that the user can enter in a world coordinate in homogenous coordinates and the program will print out the resulting display coordinate. Refer to the reference page for vtkRenderer for some useful methods.

a) Are there any world coordinates that you would expect to be undefined in display coordinates?

b) What happens when the world coordinates are behind the camera?

3.7 Consider rasterizing a ten by ten pixel square. Contrast the approximate difference in the number of arithmetic operations that would need to be done for the cases where it is flat, Gouraud, or Phong shaded.

3.8 When using a z-buffer, we must also interpolate the z-values (or depth) when rasterizing a primitive. Working from Exercise 3.7, what is the additional burden of computing z-buffer values while rasterizing our square?

3.9 vtkTransform has a method GetOrientation() that looks at the resulting transformation matrix built from a series of rotations and provides the single x, y, and z rotations that will reproduce the matrix. Specify a series of rotations in a variety of orders and request the orientation with GetOrientation(). Then apply the rotations in the same order that vtkActor does and verify that the resulting 4 x 4 transformation matrix is the same.

3.10 vtkTransform, by default, applies new transformations at the right of the current transformation. The method PostMultiply() changes the behavior so that the transformations are applied to the left.

a) Use vtkTransform to create a transform using a variety of transformation operators including Scale(), RotateXYZ(), and Translate(). Then create the same matrix with PostMultiplyOn().

b) Applying rotations at the right of a series of transformations in effect rotates the object about its own coordinate system. Use the rotations.tcl script to verify this. Can you explain this?

c) Applying rotations at the left of a series of transformations in effect rotates the object about the world coordinate system. Modify the rotations.tcl script to illustrate this. (Hint: you will have to create an explicit transform with vtkTransform and set the actor's transform with SetUserMatrix().)

LocalWords: sp postmultiply premultiply Similaryly TT userdefined RotateXYZ LocalWords: theatre

\ No newline at end of file +
Figure3-34
Figure 3-34. Figure 3-34 The vtkProp hierarchy. Props that can be transformed in 3D space are a subclass of vtkProp3D. Images can be drawn effectively with vtkImageActor. Overlay text and graphics use vtkActor2D. Hierarchical groups of vtkProps are gathered into a vtkPropAssembly. Volume rendering uses vtkVolume. Collections of transformable props create a vtkAssembly. Level-of-detail rendering uses vtkLODProp3D and vtkLODActor. A vtkFollower allows faces a specified camera and is used for billboards.

Note that in this example various actors are added to the assembly with the AddPart() method. The top-level element of the assembly is the only prop in the hierarchy added to the renderer (with AddActor()). Note also that the coneActor appears twice: once as a part of the assembly, and once as a separate actor added to the renderer with AddActor(). As you might imagine, this means that the rendering of assemblies requires concatenation of transformation matrices to insure the correct positioning of each vtkProp3D. Furthermore, hierarchical assemblies require special treatment during picking (i.e., graphically selecting props) since a vtkProp can appear more than once in differ-ent assembly hierarchies. Picking issues are discussed in more detail in "Picking" in Chapter 8.

As Figure 3-34 indicates, there are other types of vtkProp as well. Most of these will be informally described in the many examples found in this book. In particular, extensive coverage is given to vtkVolume when we describe volume rendering (see "Volume Rendering" in Chapter 7).

3.11 Chapter Summary

Rendering is the process of generating an image using a computer. Computer graphics is the field of study that encompasses rendering techniques, and forms the foundation of data visualization.

Three-dimensional rendering techniques simulate the interaction of lights and cameras with objects, or actors, to generate images. A scene consists of a combination of lights, cameras, and actors. Object-order rendering techniques generate images by rendering actors in a scene in order. Image-order techniques render the image one pixel at a time. Polygonbased graphics hardware is based on object-order techniques. Ray tracing or ray-casting is an image-order technique.

Lighting models require a specification of color. We saw both the RGB (red-green-blue) and HSV (hue-saturation-value) color models. The HSV model is a more natural model than the RGB model for most users. Lighting models also include effects due to ambient, diffuse, and specular lighting.

There are four important coordinate systems in computer graphics. The model system is the 3D coordinate system where our geometry is defined. The world system is the global Cartesian system. All modeled data is eventually transformed into the world system. The view coordinate system represents what is visible to the camera. It is a 2D system scaled from (-1,1). The display coordinate system uses actual pixel locations on the computer display.

Homogeneous coordinates are a 4D coordinate system in which we can include the effects of perspective transformation. Transformation matrices are 4x4 matrices that operate on homogeneous coordinates. Transformation matrices can represent the effects of translation, scaling, and rotation of an actor. These matrices can be multiplied together to give combined transformations.

Graphics programming is usually implemented using higher-level graphics libraries and specialized hardware systems. These dedicated systems offer better performance and easier implemen-tation of graphics applications. Common techniques implemented in these systems include dithering and z-buffering. Dithering is a technique to simulate colors by mixing combinations of available colors . Z-buffering is a technique to perform hidden-line and hidden-surface removal.

The Visualization Toolkit uses a graphics model based on lights, cameras, actors, and render-ers. The renderers draw into rendering windows. Actor properties are represented by a property object and their geometry by a mapper object. Taken together, the instantiations of these various classes form a scene. Interaction with the objects in a scene is facilitated by the vtkRenderWindowInteractor and vtkInteractorStyle classes. These use the command/observer design pattern that triggers and responds to events. Users can observe particular events and write callbacks that can perform arbitrary tasks, easily extending the toolkit for a particular application.

3.12 Bibliographic Notes

This chapter provides the reader with enough information to understand the basic issues and terms used in computer graphics. There are a number of good text books that cover computer graphics in more detail and are recommended to readers who would like a more thorough understanding. The bible of computer graphics is [FoleyVanDam90]. For those wishing for less intimidating books [BurgerGillies89] and [Watt93] are also useful references. You also may wish to peruse proceedings of the ACM SIGGRAPH conferences. These include papers and references to other papers for some of the most important work in computer graphics. [Carlson85] provides a good introduction for those who wish to learn more about the human vision system.

3.13 References

[Bresenham65] J. E. Bresenham."Algorithm for Computer Control of a Digital Plotter." IBM Systems Journal, 4(1): 25--30, January 1965.

[BurgerGillies89] P. Burger and D. Gillies. Interactive Compute Graphics Functional, Procedural and Device-Level Methods. Addison-Wesley, Reading, MA, 1989.

[Carlson85] N. R. Carlson. Physiology of Behaviour (3d Edition). Allyn and Bacon Inc., Newton, MA, 1985.

[Dartnall83] H. J. A. Dartnall, J. K. Bowmaker, and J. D. Mollon. "Human Visual Pigments: Microspectropho-tometric Results from the Eyes of Seven Persons." Proceedings of the Royal Society, London, 1983.

[FoleyVanDam90] J. D. Foley, A. van Dam, S. K. Feiner, and J. F. Hughes. Computer Graphics Principles and Practice (2d Edition). Addison-Wesley, Reading, MA, 1990.

[Fuchs80] H. Fuchs, Z. M. Kedem, and B. F. Naylor. "On Visible Surface Generation By A Priori Tree Structure." Computer Graphics (SIGGRAPH '80), 14(3):124--133, 1980.

[Gamma95] E. Gamma, R. Helm, R. Johnson, J. Vlissides. Design Patterns Elements of Reusable Object-Oriented Software. Addison-Wesley 1995. ISBN0-201-63361-2.

[Ousterhout94] J. K.Ousterhout. Tcl and the Tk Toolkit. Addison-Wesley Publishing Company, Reading, MA, 1994.

[Watt93] A. Watt. 3D Computer Graphics (2d Edition). Addison-Wesley, Reading, MA, 1993.

[Whitted80] T. Whitted. "An Improved Illumination Model for Shaded Display." Communications of the ACM, 23(6):343-349, 1980.

3.14 Exercises

3.1 Estimate the odds of a ray of light being emitted from the sun, traveling to earth and hitting a one meter square picnic blanket. You can assume that the sun is a point light source that emits light uniformly in all directions. The approximate distance from the sun to the earth is 150,000,000 km.

a) What are the odds when the sun is directly overhead?

b) What are the odds when the sun is inclined 45 degrees relative to the surface normal of the picnic blanket?

c) What assumptions or approximations did you make?

3.2 Proceeding from your result of Exercise 3.1, what are the difficulties in determining the odds of a ray of light traveling from the sun to hit the picnic blanket and then entering a viewer's eye?

3.3 The color cyan can be represented in both the HSV and RGB color spaces as shown in Figure 3-4. These two representations for cyan do not yield the same wavelength intensity plots. How do they differ?

3.4 The vtkSphereSource class generates a polygonal model of a sphere. Using the examples at the end of this chapter as starting points, create a program to display a white sphere. Set the ambient and diffuse intensities to 0.5. Then add a for-loop to this program that adjusts the ambient and diffuse color of this sphere so that as the loop progresses, the diffuse color goes from red to blue, and the ambient color goes from blue to green. You might also try adjusting other lighting parameters such as specular color, ambient, diffuse, and specular intensity.

3.5 Using the vtkSphereSource as described in Exercise 3.4, create a program to display the sphere with a light source positioned at (1,1,1). Then extend this program by adding a forloop that will adjust the active camera's clipping range so that increasing portions of the interior of the sphere can be seen. By increasing the first value of the clipping range, you will be adjusting the position of the front clipping plane. Once the front clipping plane starts intersecting the sphere, you should be able to see inside of it. The default radius of the vtkSphereSource is 0.5, so make sure that you adjust the clipping range in increments less than 1.0.

3.6 Modify the program presented in "Render a Cone" so that the user can enter in a world coordinate in homogenous coordinates and the program will print out the resulting display coordinate. Refer to the reference page for vtkRenderer for some useful methods.

a) Are there any world coordinates that you would expect to be undefined in display coordinates?

b) What happens when the world coordinates are behind the camera?

3.7 Consider rasterizing a ten by ten pixel square. Contrast the approximate difference in the number of arithmetic operations that would need to be done for the cases where it is flat, Gouraud, or Phong shaded.

3.8 When using a z-buffer, we must also interpolate the z-values (or depth) when rasterizing a primitive. Working from Exercise 3.7, what is the additional burden of computing z-buffer values while rasterizing our square?

3.9 vtkTransform has a method GetOrientation() that looks at the resulting transformation matrix built from a series of rotations and provides the single x, y, and z rotations that will reproduce the matrix. Specify a series of rotations in a variety of orders and request the orientation with GetOrientation(). Then apply the rotations in the same order that vtkActor does and verify that the resulting 4 x 4 transformation matrix is the same.

3.10 vtkTransform, by default, applies new transformations at the right of the current transformation. The method PostMultiply() changes the behavior so that the transformations are applied to the left.

a) Use vtkTransform to create a transform using a variety of transformation operators including Scale(), RotateXYZ(), and Translate(). Then create the same matrix with PostMultiplyOn().

b) Applying rotations at the right of a series of transformations in effect rotates the object about its own coordinate system. Use the rotations.tcl script to verify this. Can you explain this?

c) Applying rotations at the left of a series of transformations in effect rotates the object about the world coordinate system. Modify the rotations.tcl script to illustrate this. (Hint: you will have to create an explicit transform with vtkTransform and set the actor's transform with SetUserMatrix().)

LocalWords: sp postmultiply premultiply Similaryly TT userdefined RotateXYZ LocalWords: theatre

\ No newline at end of file diff --git a/site/VTKBook/04Chapter4/index.html b/site/VTKBook/04Chapter4/index.html index c5cc6a3759f..f86bafae399 100644 --- a/site/VTKBook/04Chapter4/index.html +++ b/site/VTKBook/04Chapter4/index.html @@ -85,4 +85,4 @@

and

append = vtkAppendFilter::New();
 append->AddInputConnection(foo->GetOutputPort());
 append->AddInputConnection(bar->GetOutputPort());
-

Notice the use of the method AddInputConnection(). This method adds to the list of connections, whereas SetInputConnection() clears the list and specifies the single connection to the port.

Another important filtering class is vtkProbeFilter. This filter takes two inputs. The first input is the data we wish to probe. The second input supplies a set of points that are used as probe points. Some process objects take a list of input data. Another interesting filter is the vtkBooleanStructuredPoints class which performs set operations on volume datasets. The first data item in the list is used to initialize the set operation. Each subsequent item in the list is combined with the result of previous operations using a boolean operation specified by the user.

For more details regarding the object design of filters and data objects, please see Chapter 5 - Data Representation and Chapter 6 - Fundamental Algorithms .

Pipeline Execution and Information Objects

Until now, we have used the terms metadata and information objects rather informally. As described previously, in the context of VTK, these terms refer to data that describes datasets. In this section, we show how these objects, which are subclasses of vtkInformation, are used to facilitate the execution of the VTK pipeline.

Information Objects. Information objects are the basic containers used throughout the VTK pipeline to hold a wide variety of metadata. They are heterogeneous key-to-value maps in which the type of the key determines the type of the value. The following is an enumeration of the places information objects are used.

  • Pipeline information objects hold information for pipeline execution. They are stored in instances of vtkExecutive or subclasses and are accessible via the method vtkExecutive::GetOutputInformation(). There is one pipeline information object per output port. It contains an entry pointing to the output vtkDataObject on the corresponding port (if it has been created). The vtkDataObject contains a pointer back to its corresponding pipeline information object, accessible via vtkDataObject::GetPipelineInformation(). The pipeline information object also holds information about what will populate the data object when the filter executes and generates the output. The actual information contained is determined by the output data type and the execution model in use. Pipeline information objects for input connections are accessible via the method vtkExecutive::GetInputInformation(), and they are the pipeline information objects on the output ports to which the input ports are connected.

  • Port information objects hold information about the data types produced on output ports and consumed by input ports. They are stored by instances of vtkAlgorithm. There is one input port information object per input port and one output port information object per output port. They are accessible via the methods vtkAlgorithm::GetInputPortInformation() and vtkAlgorithm::GetOutputPortInformation(). Port information objects are usually created and populated by subclasses of vtkAlgorithm in order to specify the interface of the filter.

  • Request information objects hold information about a specific request being sent to an executive or algorithm. There is one entry indicating what request is being sent and possibly other entries giving additional details about the specific request. These information objects are not accessible via any public method but are passed to ProcessRequest() methods that implement the requests.

  • Data information objects hold information about what is currently stored in a vtkDataObject. There is one data information object in each data object, accessible via vtkDataObject::GetInformation(). The actual information contained is determined by the data object type.

  • Algorithm information objects hold information about an instance of vtkAlgorithm. There is one algorithm information object per algorithm object, accessible via vtkAlgorithm::GetInformation(). The actual information contained is determined by the algorithm object type.

The importance of the information objects in VTK is that they are flexible (e.g., new key-value pairs can be easily added) and extensible. That is, readers, filters and mappers can add new information to the containers without requiring the API of the pipeline-related classes to change.

** Pipeline Execution Models. In VTK, the fundamental pipeline update mechanism is based on the request. A request is the basic pipeline operation (or "pipeline pass") that generally asks for particular piece of information to be propagated through the pipeline. An execution model is a set of requests defined by a specific executive. Refer to Figure 4-18** in the following description of the execution process.

Figure4-18
Figure 4-18. Path of a request sent through a pipeline. For example, assume the consumer (at the far right) needs only a single piece of this data (e.g., piece 1 of 4); also assume that the producer (on the far left) is a reader that can partition its data into pieces. The consumer passes this request upstream, and it continues upstream (via executives) until it reaches a producer that can fulfill the request. When the reader algorithm is asked for a piece of the data, it provides it, and passes the new data back (with the information that it is piece 1 of 4) down the pipeline. It stops when it reaches the consumer who made the request.

Requests are generated by the executive object of a filter that has been explicitly asked to update by its algorithm due to some user call. For example, when the Write() method of a writer is called, the algorithm object asks its executive to update the pipeline, and execute the writer, by calling this->GetExecutive()->Update(). Several requests may be sent through the pipeline in order to bring it up to date.

A request is implemented as an information object. There is one key of type vtkInformationRequestKey specifying the request itself. This key is typically defined by the executive's class. Additional information about the request may also be stored in the request information object.

Requests are propagated through the pipeline by the executives of each filter. The vtkExecutive::ProcessRequest() method is invoked on an executive given the request information object. This method is implemented by each executive and is responsible for fulfilling the request as it sees fit. Many requests may be fulfilled for a filter only after it has been fulfilled for the filters providing its inputs. For these requests the executive will pass the request on to the executives of these upstream filters and then handle the request itself.

An executive often asks its algorithm object for help in fulfilling a request. It sends the request to the algorithm object by invoking the vtkAlgorithm::ProcessRequest() method. This method is implemented by all algorithms and is responsible for handling the request. Input and output pipeline information objects are provided as arguments to the method. The algorithm must handle the request using only its own filter parameter settings and the pipeline information objects given. An algorithm is not allowed to ask its executive for any additional information. This insures that the algorithms are independent of the executives. Figure 4-18 shows a typical path taken by a request as it is sent through a pipeline. Typically the request originates in a consumer at the end of the pipeline. It is sent back through the pipeline by the executives. Each executive asks its algorithm to help handle the request.

Flexible Computation / Memory Trade-off

By default, networks constructed using the Visualization Toolkit store intermediate computational results (i.e., favor computation). However, a single class variable can be set to discard intermediate data when they are no longer needed (i.e., favor memory). In addition, a local parameter can be set within each process object to control this trade-off at object level.

This global variable is set as follows. Given the data object O, (or the output of a filter obtained using O=filter->GetOutput()), invoke O->SetGlobalReleaseDataFlagOn() to enable data release. To enable data release for a particular object use O->SetReleaseDataFlagOn(). Appropriate methods exist to disable memory release as well.

High-Level Object Design

At this point in the text it is premature to describe design details of the various objects making up the visualization pipeline. However, there are two important classes that affect many of the objects in the text. These are the classes vtkObject and [vtkObject](https://www.vtk.org/doc/nightly/html/classvtkObject.html#details)Base.

vtkObjectBase is the base object for almost all inheritance hierarchies found in VTK. vtkObjectBase implements data object reference counting (see "Reference Counting & Garbage Collection"). Subclasses of vtkObjectBase may be shared by other objects, without duplicating memory. It also defines an API for objects to print information about themselves.

vtkObject is a subclass of [vtkObject](https://www.vtk.org/doc/nightly/html/classvtkObject.html#details)Base. It provides methods and instance variables to control run-time debugging and maintains internal object modification time. In particular, the method Modified() is used to update the modification time, and the method GetMTime() is used to retrieve it. vtkObject also provides a framework for the event callbacks that we saw in the previous chapter (see "Events and Observers" in Chapter 3).

Note that we do not always include vtkObject and [vtkObject](https://www.vtk.org/doc/nightly/html/classvtkObject.html#details)Base in object diagrams to conserve space. Refer to the source code for a definitive statement.

Examples

We will now demonstrate some of the features of the visualization pipeline with four examples. Some of the objects used here will be unfamiliar to you. Please overlook missing details until we cover the information later in the book. The goal here is to provide a flavor and familiarity with the software architecture and its use.

** Simple Sphere. The first example demonstrates a simple visualization pipeline. A polygonal representation of a sphere is created with the source object (vtkSphereSource). The sphere is passed through a filter (vtkElevationFilter) that computes the height of each point of the sphere above a plane. The plane is perpendicular to the z-axis, and passes through the point (0,0,-1). The data is finally mapped (vtkDataSetMapper) through a lookup table. The mapping process converts height value into colors, and interfaces the sphere geometry to the rendering library. The mapper is assigned to an actor, and then the actor is displayed. The visualization network, a portion of code, and output image are shown in Figure 4-19**.

Figure4-19a
Figure 4-19
Figure 4-19. A simple sphere example. See ColoredSphere.cxx and ColoredSphere.py.

The execution of the pipeline occurs implicitly when we render the actor. Each actor asks its mapper to update itself. The mapper in turn asks its input to update itself. This process continues until a source object is encountered. Then the source will execute if modified since the last render.

Then the system walks through the network and executes each object if its input or instance variables are out of date. When completed, the actor's mapper is up to date and an image is generated.

Now let's reexamine the same process of pipeline execution by following method invocation. The process begins when the actor receives a Render() message from a renderer. The actor in turn sends a Render() message to its mapper. The mapper begins network execution by asking its input to update itself via the Update() operation. This causes a cascade of Update() methods as each filter in turn asks its input to update itself. If branching in the pipeline is present, the update method will branch as well. Finally, the cascade terminates when a source object is encountered. If the source object is out of date, it will send itself an RequestData() command. Each filter will send itself an RequestData() as necessary to bring itself up to date. Finally, the mapper will perform operations to transform its input into rendering primitives.

In the Visualization Toolkit, the Update() method is public while the RequestData() method is protected. Thus, you can manually cause network execution to occur by invoking the Update() operation. This can be useful when you want to set instance variables in the network based on the results of upstream execution, but do not want the whole network to update. The RequestData() method is protected because it requires a certain object state to exist. The Update() method insures that this state exists.

One final note. The indentation of the code serves to indicate where objects are instantiated and modified. The first line (i.e., the New() operator) is where the object is created. The indented lines that follow indicate that various operations are being performed on the object. We encourage you to use a similar indenting scheme in your own work.

Warped Sphere. This example extends the pipeline of the previous example and shows the effects of type checking on the connectivity of process objects. We add a transform filter (vtkTransformFilter) to non-uniformly scale the sphere in the x-y-z directions.

The transform filter only operates on objects with explicit point coordinate representation (i.e., a subclass of vtkPointSet). However, the elevation filter generates the more general form vtkDataSet as output. Hence we cannot connect the transform filter to the elevation filter. But we can connect the transform filter to the sphere source, and then the elevation filter to the transform filter. The result is shown in Figure 4-20. (Note: an alternative method is to use vtkCastToConcrete to perform run-time casting.)

Figure4-20a
Figure 4-20
Figure 4-20. The addition of a transform filter to the previous example. See TransformSphere.cxx and TransformSphere.py.

The C++ compiler enforces the proper connections of sources, filters, and mappers. To decide which objects are compatible, we check the type specification of the SetInput() method. If the input object returns an output object or a subclass of that type, the two objects are compatible and may be connected.

Generating Oriented Glyphs. This example demonstrates the use of an object with multiple inputs. vtkGlyph3D places 3D icons or glyphs (i.e., any polygonal geometry) at every input point. The icon geometry is specified with the instance variable Source, and the input points are obtained from the Input instance variable. Each glyph may be oriented and scaled in a variety of ways, depending upon the input and instance variables. In our example we place cones oriented in the direction of the point normals (Figure 4-21).

Figure4-21a
Figure 4-21
Figure 4-21. An example of multiple inputs and outputs. See Mace.cxx and Mace.py.

The visualization network branches at vtkGlyph3D. If either branch is modified, then this filter will re-execute. Network updates must branch in both directions, and both branches must be up to date when vtkGlyph3D executes. These requirements are enforced by the Update() method, and pose no problem to the implicit execution method.

Disappearing Sphere. In our last example we construct a visualization network with a feedback loop, and show how we can use procedural programming to change the topology of the network. The network consists of four objects: vtkSphereSource to create an initial polygonal geometry, vtkShrinkFilter to shrink the polygons and create a gap or space between neighbors, vtkElevationFilter to color the geometry according to height above the x-y plane, and vtkDataSetMapper to map the data through a lookup table and interface to the rendering library. The network topology, a portion of the C++ code, and output are shown in Figure 4-22.

Figure4-22a
Figure 4-22
Figure 4-22. A network with a loop (LoopShrk.cxx). VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK. See LoopShrink.cxx and LoopShrink.py.

After vtkSphereSource generates an initial geometry (in response to a render request), the input of vtkShrinkFilter is changed to the output of the vtkElevationFilter. Because of the feedback loop, vtkShrinkFilter will always re-execute. Thus, the behavior of the network is to re-execute each time a render is performed. Because the shrink filter is reapplied to the same data, the polygons become smaller and smaller and eventually disappear.

4.10 Chapter Summary

The visualization process is naturally modelled using a combination of functional and object models. The functional model can be simplified and used to describe visualization networks. The object model specifies the components of the visualization network. Visualization networks consist of process objects and data objects. Data objects represent information; process objects transform the data from one form to another. There are three types of process objects sources have no input and at least one output; filters have at least one input and output; sinks, or mappers, terminate the visualization network. The execution of the network can be controlled implicitly or explicitly. Implicit control means that each object must insure its input is up to date, thereby distributing the control mechanism. Explicit control means that there is a centralized executive to coordinate the execution of each object. Many techniques are available to program visualization networks. Direct visual programming is most common in commercial systems. At a higher level, applications provide tailored but more rigid interfaces to visualize information. At the lowest level, subroutine or object libraries provide the greatest flexibility. The Visualization Toolkit contains an object library implemented in C++ for constructing visualization networks.

4.11 Bibliographic Notes

The practical way to learn about the visualization process is to study commercially available systems. These systems can be categorized as either direct visual programming environments or as applications. Common visual programming systems include AVS [AVS89], Iris Explorer [IrisExplorer], IBM Data Explorer [DataExplorer], aPE [aPE90], and Khoros [Rasure91]. Application systems generally provide less flexibility than visual programming systems, but are better tailored to a particular problem domain. PLOT3D [PLOT3D] is an early example of a tool for CFD visualization. This has since been superseded by FAST [FAST90]. FieldView is another popular CFD visualizer [FieldView91]. VISUAL3 [VISUAL3] is a general tool for unstructured or structured grid visualization. PV-WAVE [Charal90] can be considered a hybrid system, since it has both simple visual programming techniques to interface to data files as well as a more structured user-interface than the visual programming environments. Wavefront's DataVisualizer [DataVisualizer] is a general-purpose visualization tool. It is unique in that it is part of a powerful rendering and animation package. A nice system for visualizing 3D gridded data (such as that produced by numerical weather models) is VIS5D. Find out more at the VIS5D Web site.

Although many visualization systems claim to be object-oriented, this is often more in appearance than implementation. Little has been written on object-oriented design issues for visualization. VISAGE [VISAGE92] presents an architecture similar to that described in this chapter. Favre [Favre94] describes a more conventional object-oriented approach. His dataset classes are based on topological dimension and both data and methods are combined into classes.

4.12 References

[aPE90] D. S. Dyer. "A Dataflow Toolkit For Visualization." IEEE Computer Graphics and Applications. 10(4):60-69, July 1990.

[AVS89] C. Upson, T. Faulhaber Jr., D. Kamins and others. "The Application Visualization System: A Computational Environment for Scientific Visualization." IEEE Computer Graphics and Applications. 9(4):30-42, July 1989.

[Bavoil2005] L. Bavoil, S.P. Callahan, P.J. Crossno, J. Freire, C.E. Scheidegger, C.T. Silva and H.T. Vo. "VisTrails: Enabling Interactive Multiple-View Visualizations." In Proceedings of IEEE Visualization 2005. IEEE Computer Society Press, 2005.

[Berger84] M. Berger and J. Oliger. Adaptive Mesh Refinement for Hyperbolic Partial Differential Equations. Journal of Computational Physics, 53:484-512, March 1984.

[Charal90] S. Charalamides. "New Wave Technical Graphics Is Welcome." DEC USER , August 1990.

[CruzNeira93] C. CruzNeira, D.J. Sandin, and T. DeFanti. "Surround-screen projection-based virtual reality: The design and implementation of the CAVE." In Proceedings of SIGGRAPH 93, pp. 135--142, August 1993.

[DataExplorer] Data Explorer Reference Manual. IBM Corp, Armonk, NY, 1991.

[DataVisualizer] Data Visualizer User Manual. Wavefront Technologies, Santa Barbara, CA, 1990.

[FAST90] G. V. Bancroft, F. J. Merritt, T. C. Plessell, P. G. Kelaita, R. K. McCabe, and A.Globus. "FAST: A Multi-Processed Environment for Visualization." In Proceedings of Visualization '90. pp. 14-27, IEEE Computer Society Press, Los Alamitos, CA, 1990.

[Favre94] J. M. Favre and J. Hahn. "An Object-Oriented Design for the Visualization of Multi-Variate Data Objects." In Proceedings of Visualization '94. pp. 319-325, IEEE Computer Society Press, Los Alamitos, CA, 1994.

[FieldView91] S. M. Legensky. "Advanced Visualization on Desktop Workstations." In Proceedings of Visualization '91. pp. 372-378, IEEE Computer Society Press, Los Alamitos, CA, 1991.

[Haeberli88] P. E. Haeberli. "ConMan: A Visual Programming Language for Interactive Graphics." Computer Graphics (SIGGRAPH '88). 22(4):103-11, 1988.

[Humphreys99] G. Humphreys and P. Hanrahan. "A Distributed Graphics System for Large Tiled Displays." In Proc. IEEE Visualization '99, pp. 215-224, IEEE Computer Society Press, October 1999.

[IrisExplorer] Iris Explorer User's Guide. Silicon Graphics Inc., Mountain View, CA, 1991.

[King03] B. King and W. Schroeder. "Automated Wrapping of Complex C++ Code." C/C++ Users Journal, January 2003.

[Law99] C. Charles Law, K. M. Martin, W. J. Schroeder, J. E. Temkin. "A Multi-Threaded Streaming Pipe-line Architecture for Large Structured Data Sets." In Proc. of Visualization \'99. IEEE Computer Society Press, 1999.

[Levoy94] M. Levoy. "Spreadsheets for Images." In Proceedings of SIGGRAPH '94 . pp. 139--146, 1994.

[Martin2001] K.M. Martin, B. Geveci, J. Ahrens, C. Law. "Large Scale Data Visualization Using Parallel Data Streaming." IEEE Computer Graphics & Applications, 21(4):34-41, July 2001.

[PLOT3D] P. P. Walatka and P. G. Buning. PLOT3D User's Manual. NASA Fluid Dynamics Division, 1988.

[Rasure91] J. Rasure, D. Argiro, T. Sauer, and C. Williams. "A Visual Language and Software Development Environment for Image Processing." International Journal of Imaging Systems and Technology. 1991.

[VISAGE92] W. J. Schroeder, W. E. Lorensen, G. D. Montanaro, and C. R. Volpe. "VISAGE: An Object-Oriented Visualization System." In Proceedings of Visualization '92. pp. 219-226, IEEE Computer Society Press, Los Alamitos, CA, 1992.

[VISUAL3] R. Haimes and M. Giles. "VISUAL3: Interactive Unsteady Unstructured 3D Visualization." AIAA Report No. AIAA-91-0794. January 1991.

[Wernecke94] J. Wernecke. The Inventor Mentor. Addison-Wesley Publishing Company, ISBN 0-201-62495-8, 1994.

4.13 Exercises

4.1 Consider the following 2D visualization techniques: x-y plotting, bar charts, and pie charts.

For each technique:

a) Construct functional models.

b) Construct object models.

4.2 A height field is a regular array of 2D points where h = f(x,y), h is an altitude above the point (x,y). Height fields are often used to represent terrain data. Design an object-oriented system to visualize height fields.

a) How would you represent the height field?

b) What methods would you use to access this data?

c) Develop one process object (i.e., visualization technique) to visualize a height field. Describe the methods used by the object to access and manipulate the height field.

4.3 Describe how you would implement an explicit control mechanism for network execution.

a) How do process objects register their input data with the executive?

b) How is the executive notified of object modification?

c) By what method is the executive notified that network execution is necessary?

d) Describe an approach for network dependency analysis. How does the executive invoke execution of the process objects?

4.4 Visual programming environments enable the user to construct visualization applications by graphically connecting process objects.

a) Design a graphical notation to represent process objects, their input and output, and data flow direction.

b) How would you modify instance variables of process objects (using a graphical technique)?

c) By what mechanism would network execution be initiated?

d) How would you control conditional execution and looping in your network?

e) How would you take advantage of parallel computing?

f) How would you distribute network execution across two or more computers sharing a network connection?

4.5 Place oriented cylinders (instead of cones) on the mace in Figure 4-20. (Hint: use vtkCylinderSource.)

4.6 The implicit update method for the visualization network used by VTK is simple to implement and understand. However, it is prone to a common programming error. What is this error?

4.7 Experiment with the transformation object in Figure 4-20.

a) Translate the actor with vtkTransform's Translate() method.

b) Rotate the actor with the RotateX(), RotateY(), and RotateZ() methods.

c) Scale the actor with the Scale() method.

d) Try combinations of these methods. Does the actor transform in ways that you expect?

4.8 Visualize the following functions. (Hint: use vtkSampleFunction and refer to Figure 4.1.)

a) F(x,y,z)=x^2

b) F(x,y,z) = x_2 + 2 y + 3 z +1

c) F(x,y,z) = x+2 + y^2 - \cos (z) + 1

\ No newline at end of file +

Notice the use of the method AddInputConnection(). This method adds to the list of connections, whereas SetInputConnection() clears the list and specifies the single connection to the port.

Another important filtering class is vtkProbeFilter. This filter takes two inputs. The first input is the data we wish to probe. The second input supplies a set of points that are used as probe points. Some process objects take a list of input data. Another interesting filter is the vtkBooleanStructuredPoints class which performs set operations on volume datasets. The first data item in the list is used to initialize the set operation. Each subsequent item in the list is combined with the result of previous operations using a boolean operation specified by the user.

For more details regarding the object design of filters and data objects, please see Chapter 5 - Data Representation and Chapter 6 - Fundamental Algorithms .

Pipeline Execution and Information Objects

Until now, we have used the terms metadata and information objects rather informally. As described previously, in the context of VTK, these terms refer to data that describes datasets. In this section, we show how these objects, which are subclasses of vtkInformation, are used to facilitate the execution of the VTK pipeline.

Information Objects. Information objects are the basic containers used throughout the VTK pipeline to hold a wide variety of metadata. They are heterogeneous key-to-value maps in which the type of the key determines the type of the value. The following is an enumeration of the places information objects are used.

The importance of the information objects in VTK is that they are flexible (e.g., new key-value pairs can be easily added) and extensible. That is, readers, filters and mappers can add new information to the containers without requiring the API of the pipeline-related classes to change.

** Pipeline Execution Models. In VTK, the fundamental pipeline update mechanism is based on the request. A request is the basic pipeline operation (or "pipeline pass") that generally asks for particular piece of information to be propagated through the pipeline. An execution model is a set of requests defined by a specific executive. Refer to Figure 4-18** in the following description of the execution process.

Figure4-18
Figure 4-18. Path of a request sent through a pipeline. For example, assume the consumer (at the far right) needs only a single piece of this data (e.g., piece 1 of 4); also assume that the producer (on the far left) is a reader that can partition its data into pieces. The consumer passes this request upstream, and it continues upstream (via executives) until it reaches a producer that can fulfill the request. When the reader algorithm is asked for a piece of the data, it provides it, and passes the new data back (with the information that it is piece 1 of 4) down the pipeline. It stops when it reaches the consumer who made the request.

Requests are generated by the executive object of a filter that has been explicitly asked to update by its algorithm due to some user call. For example, when the Write() method of a writer is called, the algorithm object asks its executive to update the pipeline, and execute the writer, by calling this->GetExecutive()->Update(). Several requests may be sent through the pipeline in order to bring it up to date.

A request is implemented as an information object. There is one key of type vtkInformationRequestKey specifying the request itself. This key is typically defined by the executive's class. Additional information about the request may also be stored in the request information object.

Requests are propagated through the pipeline by the executives of each filter. The vtkExecutive::ProcessRequest() method is invoked on an executive given the request information object. This method is implemented by each executive and is responsible for fulfilling the request as it sees fit. Many requests may be fulfilled for a filter only after it has been fulfilled for the filters providing its inputs. For these requests the executive will pass the request on to the executives of these upstream filters and then handle the request itself.

An executive often asks its algorithm object for help in fulfilling a request. It sends the request to the algorithm object by invoking the vtkAlgorithm::ProcessRequest() method. This method is implemented by all algorithms and is responsible for handling the request. Input and output pipeline information objects are provided as arguments to the method. The algorithm must handle the request using only its own filter parameter settings and the pipeline information objects given. An algorithm is not allowed to ask its executive for any additional information. This insures that the algorithms are independent of the executives. Figure 4-18 shows a typical path taken by a request as it is sent through a pipeline. Typically the request originates in a consumer at the end of the pipeline. It is sent back through the pipeline by the executives. Each executive asks its algorithm to help handle the request.

Flexible Computation / Memory Trade-off

By default, networks constructed using the Visualization Toolkit store intermediate computational results (i.e., favor computation). However, a single class variable can be set to discard intermediate data when they are no longer needed (i.e., favor memory). In addition, a local parameter can be set within each process object to control this trade-off at object level.

This global variable is set as follows. Given the data object O, (or the output of a filter obtained using O=filter->GetOutput()), invoke O->SetGlobalReleaseDataFlagOn() to enable data release. To enable data release for a particular object use O->SetReleaseDataFlagOn(). Appropriate methods exist to disable memory release as well.

High-Level Object Design

At this point in the text it is premature to describe design details of the various objects making up the visualization pipeline. However, there are two important classes that affect many of the objects in the text. These are the classes vtkObject and vtkObjectBase.

vtkObjectBase is the base object for almost all inheritance hierarchies found in VTK. vtkObjectBase implements data object reference counting (see "Reference Counting & Garbage Collection"). Subclasses of vtkObjectBase may be shared by other objects, without duplicating memory. It also defines an API for objects to print information about themselves.

vtkObject is a subclass of vtkObjectBase. It provides methods and instance variables to control run-time debugging and maintains internal object modification time. In particular, the method Modified() is used to update the modification time, and the method GetMTime() is used to retrieve it. vtkObject also provides a framework for the event callbacks that we saw in the previous chapter (see "Events and Observers" in Chapter 3).

Note that we do not always include vtkObject and vtkObjectBase in object diagrams to conserve space. Refer to the source code for a definitive statement.

Examples

We will now demonstrate some of the features of the visualization pipeline with four examples. Some of the objects used here will be unfamiliar to you. Please overlook missing details until we cover the information later in the book. The goal here is to provide a flavor and familiarity with the software architecture and its use.

** Simple Sphere. The first example demonstrates a simple visualization pipeline. A polygonal representation of a sphere is created with the source object (vtkSphereSource). The sphere is passed through a filter (vtkElevationFilter) that computes the height of each point of the sphere above a plane. The plane is perpendicular to the z-axis, and passes through the point (0,0,-1). The data is finally mapped (vtkDataSetMapper) through a lookup table. The mapping process converts height value into colors, and interfaces the sphere geometry to the rendering library. The mapper is assigned to an actor, and then the actor is displayed. The visualization network, a portion of code, and output image are shown in Figure 4-19**.

Figure4-19a
Figure 4-19
Figure 4-19. A simple sphere example. See ColoredSphere.cxx and ColoredSphere.py.

The execution of the pipeline occurs implicitly when we render the actor. Each actor asks its mapper to update itself. The mapper in turn asks its input to update itself. This process continues until a source object is encountered. Then the source will execute if modified since the last render.

Then the system walks through the network and executes each object if its input or instance variables are out of date. When completed, the actor's mapper is up to date and an image is generated.

Now let's reexamine the same process of pipeline execution by following method invocation. The process begins when the actor receives a Render() message from a renderer. The actor in turn sends a Render() message to its mapper. The mapper begins network execution by asking its input to update itself via the Update() operation. This causes a cascade of Update() methods as each filter in turn asks its input to update itself. If branching in the pipeline is present, the update method will branch as well. Finally, the cascade terminates when a source object is encountered. If the source object is out of date, it will send itself an RequestData() command. Each filter will send itself an RequestData() as necessary to bring itself up to date. Finally, the mapper will perform operations to transform its input into rendering primitives.

In the Visualization Toolkit, the Update() method is public while the RequestData() method is protected. Thus, you can manually cause network execution to occur by invoking the Update() operation. This can be useful when you want to set instance variables in the network based on the results of upstream execution, but do not want the whole network to update. The RequestData() method is protected because it requires a certain object state to exist. The Update() method insures that this state exists.

One final note. The indentation of the code serves to indicate where objects are instantiated and modified. The first line (i.e., the New() operator) is where the object is created. The indented lines that follow indicate that various operations are being performed on the object. We encourage you to use a similar indenting scheme in your own work.

Warped Sphere. This example extends the pipeline of the previous example and shows the effects of type checking on the connectivity of process objects. We add a transform filter (vtkTransformFilter) to non-uniformly scale the sphere in the x-y-z directions.

The transform filter only operates on objects with explicit point coordinate representation (i.e., a subclass of vtkPointSet). However, the elevation filter generates the more general form vtkDataSet as output. Hence we cannot connect the transform filter to the elevation filter. But we can connect the transform filter to the sphere source, and then the elevation filter to the transform filter. The result is shown in Figure 4-20. (Note: an alternative method is to use vtkCastToConcrete to perform run-time casting.)

Figure4-20a
Figure 4-20
Figure 4-20. The addition of a transform filter to the previous example. See TransformSphere.cxx and TransformSphere.py.

The C++ compiler enforces the proper connections of sources, filters, and mappers. To decide which objects are compatible, we check the type specification of the SetInput() method. If the input object returns an output object or a subclass of that type, the two objects are compatible and may be connected.

Generating Oriented Glyphs. This example demonstrates the use of an object with multiple inputs. vtkGlyph3D places 3D icons or glyphs (i.e., any polygonal geometry) at every input point. The icon geometry is specified with the instance variable Source, and the input points are obtained from the Input instance variable. Each glyph may be oriented and scaled in a variety of ways, depending upon the input and instance variables. In our example we place cones oriented in the direction of the point normals (Figure 4-21).

Figure4-21a
Figure 4-21
Figure 4-21. An example of multiple inputs and outputs. See Mace.cxx and Mace.py.

The visualization network branches at vtkGlyph3D. If either branch is modified, then this filter will re-execute. Network updates must branch in both directions, and both branches must be up to date when vtkGlyph3D executes. These requirements are enforced by the Update() method, and pose no problem to the implicit execution method.

Disappearing Sphere. In our last example we construct a visualization network with a feedback loop, and show how we can use procedural programming to change the topology of the network. The network consists of four objects: vtkSphereSource to create an initial polygonal geometry, vtkShrinkFilter to shrink the polygons and create a gap or space between neighbors, vtkElevationFilter to color the geometry according to height above the x-y plane, and vtkDataSetMapper to map the data through a lookup table and interface to the rendering library. The network topology, a portion of the C++ code, and output are shown in Figure 4-22.

Figure4-22a
Figure 4-22
Figure 4-22. A network with a loop (LoopShrk.cxx). VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK. See LoopShrink.cxx and LoopShrink.py.

After vtkSphereSource generates an initial geometry (in response to a render request), the input of vtkShrinkFilter is changed to the output of the vtkElevationFilter. Because of the feedback loop, vtkShrinkFilter will always re-execute. Thus, the behavior of the network is to re-execute each time a render is performed. Because the shrink filter is reapplied to the same data, the polygons become smaller and smaller and eventually disappear.

4.10 Chapter Summary

The visualization process is naturally modelled using a combination of functional and object models. The functional model can be simplified and used to describe visualization networks. The object model specifies the components of the visualization network. Visualization networks consist of process objects and data objects. Data objects represent information; process objects transform the data from one form to another. There are three types of process objects sources have no input and at least one output; filters have at least one input and output; sinks, or mappers, terminate the visualization network. The execution of the network can be controlled implicitly or explicitly. Implicit control means that each object must insure its input is up to date, thereby distributing the control mechanism. Explicit control means that there is a centralized executive to coordinate the execution of each object. Many techniques are available to program visualization networks. Direct visual programming is most common in commercial systems. At a higher level, applications provide tailored but more rigid interfaces to visualize information. At the lowest level, subroutine or object libraries provide the greatest flexibility. The Visualization Toolkit contains an object library implemented in C++ for constructing visualization networks.

4.11 Bibliographic Notes

The practical way to learn about the visualization process is to study commercially available systems. These systems can be categorized as either direct visual programming environments or as applications. Common visual programming systems include AVS [AVS89], Iris Explorer [IrisExplorer], IBM Data Explorer [DataExplorer], aPE [aPE90], and Khoros [Rasure91]. Application systems generally provide less flexibility than visual programming systems, but are better tailored to a particular problem domain. PLOT3D [PLOT3D] is an early example of a tool for CFD visualization. This has since been superseded by FAST [FAST90]. FieldView is another popular CFD visualizer [FieldView91]. VISUAL3 [VISUAL3] is a general tool for unstructured or structured grid visualization. PV-WAVE [Charal90] can be considered a hybrid system, since it has both simple visual programming techniques to interface to data files as well as a more structured user-interface than the visual programming environments. Wavefront's DataVisualizer [DataVisualizer] is a general-purpose visualization tool. It is unique in that it is part of a powerful rendering and animation package. A nice system for visualizing 3D gridded data (such as that produced by numerical weather models) is VIS5D. Find out more at the VIS5D Web site.

Although many visualization systems claim to be object-oriented, this is often more in appearance than implementation. Little has been written on object-oriented design issues for visualization. VISAGE [VISAGE92] presents an architecture similar to that described in this chapter. Favre [Favre94] describes a more conventional object-oriented approach. His dataset classes are based on topological dimension and both data and methods are combined into classes.

4.12 References

[aPE90] D. S. Dyer. "A Dataflow Toolkit For Visualization." IEEE Computer Graphics and Applications. 10(4):60-69, July 1990.

[AVS89] C. Upson, T. Faulhaber Jr., D. Kamins and others. "The Application Visualization System: A Computational Environment for Scientific Visualization." IEEE Computer Graphics and Applications. 9(4):30-42, July 1989.

[Bavoil2005] L. Bavoil, S.P. Callahan, P.J. Crossno, J. Freire, C.E. Scheidegger, C.T. Silva and H.T. Vo. "VisTrails: Enabling Interactive Multiple-View Visualizations." In Proceedings of IEEE Visualization 2005. IEEE Computer Society Press, 2005.

[Berger84] M. Berger and J. Oliger. Adaptive Mesh Refinement for Hyperbolic Partial Differential Equations. Journal of Computational Physics, 53:484-512, March 1984.

[Charal90] S. Charalamides. "New Wave Technical Graphics Is Welcome." DEC USER , August 1990.

[CruzNeira93] C. CruzNeira, D.J. Sandin, and T. DeFanti. "Surround-screen projection-based virtual reality: The design and implementation of the CAVE." In Proceedings of SIGGRAPH 93, pp. 135--142, August 1993.

[DataExplorer] Data Explorer Reference Manual. IBM Corp, Armonk, NY, 1991.

[DataVisualizer] Data Visualizer User Manual. Wavefront Technologies, Santa Barbara, CA, 1990.

[FAST90] G. V. Bancroft, F. J. Merritt, T. C. Plessell, P. G. Kelaita, R. K. McCabe, and A.Globus. "FAST: A Multi-Processed Environment for Visualization." In Proceedings of Visualization '90. pp. 14-27, IEEE Computer Society Press, Los Alamitos, CA, 1990.

[Favre94] J. M. Favre and J. Hahn. "An Object-Oriented Design for the Visualization of Multi-Variate Data Objects." In Proceedings of Visualization '94. pp. 319-325, IEEE Computer Society Press, Los Alamitos, CA, 1994.

[FieldView91] S. M. Legensky. "Advanced Visualization on Desktop Workstations." In Proceedings of Visualization '91. pp. 372-378, IEEE Computer Society Press, Los Alamitos, CA, 1991.

[Haeberli88] P. E. Haeberli. "ConMan: A Visual Programming Language for Interactive Graphics." Computer Graphics (SIGGRAPH '88). 22(4):103-11, 1988.

[Humphreys99] G. Humphreys and P. Hanrahan. "A Distributed Graphics System for Large Tiled Displays." In Proc. IEEE Visualization '99, pp. 215-224, IEEE Computer Society Press, October 1999.

[IrisExplorer] Iris Explorer User's Guide. Silicon Graphics Inc., Mountain View, CA, 1991.

[King03] B. King and W. Schroeder. "Automated Wrapping of Complex C++ Code." C/C++ Users Journal, January 2003.

[Law99] C. Charles Law, K. M. Martin, W. J. Schroeder, J. E. Temkin. "A Multi-Threaded Streaming Pipe-line Architecture for Large Structured Data Sets." In Proc. of Visualization \'99. IEEE Computer Society Press, 1999.

[Levoy94] M. Levoy. "Spreadsheets for Images." In Proceedings of SIGGRAPH '94 . pp. 139--146, 1994.

[Martin2001] K.M. Martin, B. Geveci, J. Ahrens, C. Law. "Large Scale Data Visualization Using Parallel Data Streaming." IEEE Computer Graphics & Applications, 21(4):34-41, July 2001.

[PLOT3D] P. P. Walatka and P. G. Buning. PLOT3D User's Manual. NASA Fluid Dynamics Division, 1988.

[Rasure91] J. Rasure, D. Argiro, T. Sauer, and C. Williams. "A Visual Language and Software Development Environment for Image Processing." International Journal of Imaging Systems and Technology. 1991.

[VISAGE92] W. J. Schroeder, W. E. Lorensen, G. D. Montanaro, and C. R. Volpe. "VISAGE: An Object-Oriented Visualization System." In Proceedings of Visualization '92. pp. 219-226, IEEE Computer Society Press, Los Alamitos, CA, 1992.

[VISUAL3] R. Haimes and M. Giles. "VISUAL3: Interactive Unsteady Unstructured 3D Visualization." AIAA Report No. AIAA-91-0794. January 1991.

[Wernecke94] J. Wernecke. The Inventor Mentor. Addison-Wesley Publishing Company, ISBN 0-201-62495-8, 1994.

4.13 Exercises

4.1 Consider the following 2D visualization techniques: x-y plotting, bar charts, and pie charts.

For each technique:

a) Construct functional models.

b) Construct object models.

4.2 A height field is a regular array of 2D points where h = f(x,y), h is an altitude above the point (x,y). Height fields are often used to represent terrain data. Design an object-oriented system to visualize height fields.

a) How would you represent the height field?

b) What methods would you use to access this data?

c) Develop one process object (i.e., visualization technique) to visualize a height field. Describe the methods used by the object to access and manipulate the height field.

4.3 Describe how you would implement an explicit control mechanism for network execution.

a) How do process objects register their input data with the executive?

b) How is the executive notified of object modification?

c) By what method is the executive notified that network execution is necessary?

d) Describe an approach for network dependency analysis. How does the executive invoke execution of the process objects?

4.4 Visual programming environments enable the user to construct visualization applications by graphically connecting process objects.

a) Design a graphical notation to represent process objects, their input and output, and data flow direction.

b) How would you modify instance variables of process objects (using a graphical technique)?

c) By what mechanism would network execution be initiated?

d) How would you control conditional execution and looping in your network?

e) How would you take advantage of parallel computing?

f) How would you distribute network execution across two or more computers sharing a network connection?

4.5 Place oriented cylinders (instead of cones) on the mace in Figure 4-20. (Hint: use vtkCylinderSource.)

4.6 The implicit update method for the visualization network used by VTK is simple to implement and understand. However, it is prone to a common programming error. What is this error?

4.7 Experiment with the transformation object in Figure 4-20.

a) Translate the actor with vtkTransform's Translate() method.

b) Rotate the actor with the RotateX(), RotateY(), and RotateZ() methods.

c) Scale the actor with the Scale() method.

d) Try combinations of these methods. Does the actor transform in ways that you expect?

4.8 Visualize the following functions. (Hint: use vtkSampleFunction and refer to Figure 4.1.)

a) F(x,y,z)=x^2

b) F(x,y,z) = x_2 + 2 y + 3 z +1

c) F(x,y,z) = x+2 + y^2 - \cos (z) + 1

\ No newline at end of file diff --git a/site/VTKBook/06Chapter6/index.html b/site/VTKBook/06Chapter6/index.html index 0feb6ae0d24..c23251fc5c9 100644 --- a/site/VTKBook/06Chapter6/index.html +++ b/site/VTKBook/06Chapter6/index.html @@ -136,7 +136,7 @@ lut->SetTableValue(0, 1.0, 0.0, 0.0, 1.0); lut->SetTableValue(0, 0.0, 1.0, 0.0, 1.0); lut->SetTableValue(0, 0.0, 0.0, 1.0, 1.0); -

Lookup tables in the Visualization Toolkit are associated with the graphics mappers. Mappers will automatically create a red to blue lookup table if no table is specified, but if you want to create your own, use the mapper->SetLookupTable(lut) operation where mapper is an instance of vtkMapper or its subclasses.

A few final notes on using lookup tables.

You can also derive your own lookup table types. Look at vtkLogLookupTable for an example. This particular lookup table inherits from vtkLookupTable. It performs logarithmic mapping of scalar value to table entry, a useful capability when scalar values span many orders of magnitude.

Implicit Functions

Figure6-37
Figure 6-37. Inheritance hierarchy of vtkImplicitFunction and subclasses.

As we have seen, implicit functions can be used for visualizing functions, creating geometry, and cutting or selecting datasets. VTK includes several implicit functions including a single plane (vtkPlane), multiple convex planes ([vtkPlane](https://www.vtk.org/doc/nightly/html/classvtkPlane.html#details)s), spheres (vtkSphere), cones (vtkCone), cylinders (vtkCylinder), and the general quadric (vtkQuadric). The class vtkImplicitBoolean allows you to create boolean combinations of these implicit function primitives. Other implicit functions can be added to VTK by deriving from the abstract base class vtkImplicitFunction.

The existing inheritance hierarchy for implicit functions is shown in Figure 6-37. Subclasses of vtkImplicitFunction must implement the two methods Evaluate() and Gradient(x). The method Evaluate() returns the value of the function at point (x,y,z), while the method Gradient() returns the gradient vector to the function at point (x,y,z).

Contouring

Scalar contouring is implemented in the Visualization Toolkit with vtkContourFilter. This filter object accepts as input any dataset type. Thus, vtkContourFilter treats every cell type and each cell type must provide a method for contouring itself.

Contouring in VTK is implemented using variations of the marching cubes algorithm presented earlier. That is, a contour case table is associated with each cell type, so each cell will generate contouring primitives as appropriate. For example, the tetrahedron cell type implements "marching tetrahedron" and creates triangle primitives, while the triangle cell type implements "marching triangles" and generates lines segments.

The implication of this arrangement is that vtkContourFilter will generate point, line, and surface contouring primitives depending on the combination of input cell types. Thus vtkContourFilter is completely general. We have created another contour filter, vtkMarchingCubes, that is specific to the dataset type image data (in particular, 3D volumes). These two filters allow us to compare (at least for this one algorithm) the cost of generality.

Recall from "Generality Versus Efficiency" the issues regarding the trade-offs between general and specific algorithms. Figure 6-38 shows a comparison of CPU times for a volume dataset at, 64 \times 64 \times 93, and resolution 128 \times 128 \times 93. The volume is a CT dataset of a human head. Three cases were run. In the first case the vtkMarchingCubes object was used. The output of this filter is triangles plus point normals. In the second case, vtkContourFilter was run. The output of this filter is just triangles. In the last case, vtkContourFilter was combined with vtkPolyDataNormals (to generate point normals). The output of the combined filters is also triangles plus point normals.

The execution times are normalized to the smallest dataset using the vtkMarchingCubes object. The results are clear: The specific object outperforms the general object by a factor of 1.4 to 7, depending on data size and whether normals are computed. The larger differences occur on the smaller datasets. This is because the ratio of voxel cells containing the isosurface to the total number of voxels is larger for smaller datasets. (Generally the total number of voxels increases as the resolution cubed, while the voxels containing the isosurface increase as the resolution squared.) As a result, more voxels are processed in the smaller datasets relative to the total number of voxels than in the larger datasets. When the datasets become larger, more voxels are "empty" and are not processed.

Although these results do not represent all implementations or the behavior of other algorithms, they do point to the cost of generality. Of course, there is a cost to specialization as well. This cost is typically in programmer time, since the programmer must rewrite code to adapt to new circumstances and data. Like all trade-offs, resolution of this issue requires knowledge of the application.

Figure6-38
Figure 6-38. The cost of generality. Isosurface generation of three volumes of different sizes are compared. The results show normalized execution times for two different implementations of the marching cubes isosurface algorithm. The specialized filter is vtkMarchingCubes. The general algorithms are first vtkContourFilter and then in combination with vtkPolyDataNormals.

An example use of vtkContourFilter is shown in Figure 6-39. This example is taken from Figure4-1, which is a visualization of a quadric function. The class vtkSampleFunction samples the implicit quadric function using the vtkQuadric class. Although vtkQuadric does not participate in the pipeline in terms of data flow, it is used to define and evaluate the quadric function. It is possible to generate one or more isolines/isosurfaces simultaneously using vtkContourFilter. As Figure 6-39 shows, we use the GenerateValues() method to specify a scalar range, and the number of contours within this range (including the initial and final scalar values). vtkContourFilter generates duplicate vertices, so we can use vtkCleanPolyData to remove them. To improve the rendered appearance of the isosurface, we use vtkPolyDataNormals to create surface normals. (We describe normal generation in Chapter 9 - Advanced Algorithms.)

// Define implicit function
+

Lookup tables in the Visualization Toolkit are associated with the graphics mappers. Mappers will automatically create a red to blue lookup table if no table is specified, but if you want to create your own, use the mapper->SetLookupTable(lut) operation where mapper is an instance of vtkMapper or its subclasses.

A few final notes on using lookup tables.

You can also derive your own lookup table types. Look at vtkLogLookupTable for an example. This particular lookup table inherits from vtkLookupTable. It performs logarithmic mapping of scalar value to table entry, a useful capability when scalar values span many orders of magnitude.

Implicit Functions

Figure6-37
Figure 6-37. Inheritance hierarchy of vtkImplicitFunction and subclasses.

As we have seen, implicit functions can be used for visualizing functions, creating geometry, and cutting or selecting datasets. VTK includes several implicit functions including a single plane (vtkPlane), multiple convex planes (vtkPlanes), spheres (vtkSphere), cones (vtkCone), cylinders (vtkCylinder), and the general quadric (vtkQuadric). The class vtkImplicitBoolean allows you to create boolean combinations of these implicit function primitives. Other implicit functions can be added to VTK by deriving from the abstract base class vtkImplicitFunction.

The existing inheritance hierarchy for implicit functions is shown in Figure 6-37. Subclasses of vtkImplicitFunction must implement the two methods Evaluate() and Gradient(x). The method Evaluate() returns the value of the function at point (x,y,z), while the method Gradient() returns the gradient vector to the function at point (x,y,z).

Contouring

Scalar contouring is implemented in the Visualization Toolkit with vtkContourFilter. This filter object accepts as input any dataset type. Thus, vtkContourFilter treats every cell type and each cell type must provide a method for contouring itself.

Contouring in VTK is implemented using variations of the marching cubes algorithm presented earlier. That is, a contour case table is associated with each cell type, so each cell will generate contouring primitives as appropriate. For example, the tetrahedron cell type implements "marching tetrahedron" and creates triangle primitives, while the triangle cell type implements "marching triangles" and generates lines segments.

The implication of this arrangement is that vtkContourFilter will generate point, line, and surface contouring primitives depending on the combination of input cell types. Thus vtkContourFilter is completely general. We have created another contour filter, vtkMarchingCubes, that is specific to the dataset type image data (in particular, 3D volumes). These two filters allow us to compare (at least for this one algorithm) the cost of generality.

Recall from "Generality Versus Efficiency" the issues regarding the trade-offs between general and specific algorithms. Figure 6-38 shows a comparison of CPU times for a volume dataset at, 64 \times 64 \times 93, and resolution 128 \times 128 \times 93. The volume is a CT dataset of a human head. Three cases were run. In the first case the vtkMarchingCubes object was used. The output of this filter is triangles plus point normals. In the second case, vtkContourFilter was run. The output of this filter is just triangles. In the last case, vtkContourFilter was combined with vtkPolyDataNormals (to generate point normals). The output of the combined filters is also triangles plus point normals.

The execution times are normalized to the smallest dataset using the vtkMarchingCubes object. The results are clear: The specific object outperforms the general object by a factor of 1.4 to 7, depending on data size and whether normals are computed. The larger differences occur on the smaller datasets. This is because the ratio of voxel cells containing the isosurface to the total number of voxels is larger for smaller datasets. (Generally the total number of voxels increases as the resolution cubed, while the voxels containing the isosurface increase as the resolution squared.) As a result, more voxels are processed in the smaller datasets relative to the total number of voxels than in the larger datasets. When the datasets become larger, more voxels are "empty" and are not processed.

Although these results do not represent all implementations or the behavior of other algorithms, they do point to the cost of generality. Of course, there is a cost to specialization as well. This cost is typically in programmer time, since the programmer must rewrite code to adapt to new circumstances and data. Like all trade-offs, resolution of this issue requires knowledge of the application.

Figure6-38
Figure 6-38. The cost of generality. Isosurface generation of three volumes of different sizes are compared. The results show normalized execution times for two different implementations of the marching cubes isosurface algorithm. The specialized filter is vtkMarchingCubes. The general algorithms are first vtkContourFilter and then in combination with vtkPolyDataNormals.

An example use of vtkContourFilter is shown in Figure 6-39. This example is taken from Figure4-1, which is a visualization of a quadric function. The class vtkSampleFunction samples the implicit quadric function using the vtkQuadric class. Although vtkQuadric does not participate in the pipeline in terms of data flow, it is used to define and evaluate the quadric function. It is possible to generate one or more isolines/isosurfaces simultaneously using vtkContourFilter. As Figure 6-39 shows, we use the GenerateValues() method to specify a scalar range, and the number of contours within this range (including the initial and final scalar values). vtkContourFilter generates duplicate vertices, so we can use vtkCleanPolyData to remove them. To improve the rendered appearance of the isosurface, we use vtkPolyDataNormals to create surface normals. (We describe normal generation in Chapter 9 - Advanced Algorithms.)

// Define implicit function
 vtkQuadric *quadric = vtkQuadric::New();
   quadric->SetCoefficients(.5,1,.2,0,.1,0,0,.2,0,0);
 vtkSampleFunction *sample = vtkSampleFunction::New();
diff --git a/site/VTKBook/08Chapter8/index.html b/site/VTKBook/08Chapter8/index.html
index 8597b7e1422..c42ecbd5772 100644
--- a/site/VTKBook/08Chapter8/index.html
+++ b/site/VTKBook/08Chapter8/index.html
@@ -511,7 +511,7 @@
      SetTextureCoords() / GetTextureCoords()
           Set / return texture coordinate data. The GetTextureCoords() method may return a
           NULL value, in which case the texture coordinates are not defined.
-

Traversing Intermediate Topology

The dataset abstraction implemented by VTK provides simple techniques to traverse points and cells. Sometimes we want to traverse intermediate topology such as edges or faces. For example, to identify boundary edges in a triangular mesh we must traverse each edge, counting the number of triangles that use each edge. (Recall that boundary edges are used by just one triangle.) Unfortunately, there is no obvious way to traverse edges. The same problem holds true if we want to traverse the faces of a dataset containing 3D cells.

A simple solution is to traverse each cell and then obtain the edges (or faces) that compose the cell. The problem with this approach is that edges and faces are generally used by more than one cell, resulting in multiple visits to the same face or edge. This may be acceptable in some algorithms, but usually we count on visiting each edge or face only once.

A better solution to this problem is to traverse each cell as before, but only process intermediate topology if the current cell has the smallest cell id. (The current cell is the cell being visited in the traversal process.) To determine whether the current cell has the smallest cell id, we obtain all cells using the intermediate topology. This information can be obtained using the topological adjacency operators described earlier (e.g., Equation 8-25).

To illustrate this process consider visiting the edges of a triangle mesh. We begin by visiting the first triangle, t, and then its edges. For each edge we determine the adjacent triangle(s) (if any) that use the edge. If the id of the adjacent triangle(s) is greater than triangle t's id, or there are no adjacent triangles, then we know to process the current edge. (Of course the first triangle will always have the smallest id but this will change as the traversal proceeds.) We then continue traversing the triangle list for new t's. In this way all the edges of the mesh will be visited.

Color Scalar Data

Multi-valued scalar data, or scalars represented by various color representations, are treated specially by the Visualization Toolkit. These data arise, for example, when using a color specification to directly control the color of objects rather than mapping a scalar value through a lookup table. (See "Color Mapping" in Chapter 6 for more information.)

By default, the mapping of scalars into colors proceeds as follows (vtkMapper and subclasses are responsible for implementing this behavior):

It is possible to force unsigned char data to be mapped through a lookup table. The vtkMapper method SetColorModeToMapScalars() forces all data regardless of type to be mapped through the lookup table.

Searching

The Visualization Toolkit provides two classes to perform searches for dataset points and cells. These are vtkPointLocator and vtkCellLocator. (Both of these classes are subclasses of vtkLocator, which is an abstract base class for spatial search objects.) vtkPointLocator is used to search for points and, if used with the topological dataset operator GetPointCells(), to search for cells as well. vtkCellLocator is used to search for cells.

vtkPointLocator is implemented as a regular grid of buckets (i.e., same topology and geometry as an image dataset). The number of buckets can be user-specified, or more conveniently, automatically computed based on the number of dataset points. On average, vtkPointLocator provides constant time access to points. However, in cases where the point distribution is not uniform, the number of points in a bucket may vary widely, giving O(n) worst-case behavior. In practice this is rarely a problem, but adaptive spatial search structures (e.g., an octree) may sometimes be a better choice.

Determining closest point to a point p using vtkPointLocator (as well as other spatial search structures) is a three-step process. In the first step, the bucket containing p is found using the appropriate insertion scheme. (For vtkPointLocator this is three divisions to determine bucket indices (i, j, k).) Next, the list of points in this bucket is searched to determine the closest point. However, as Figure 8-36 shows, this may not be the true closest point, since points in neighboring buckets may be closer. Consequently, a final search of neighboring buckets is necessary. The search distance is a function of the distance to the current closest point. Once all neighbors within this distance are searched, the closest point is returned.

Figure8-36
Figure 8-36. Determining closest point to $p$ in vtkPointLocator. Initial search in bucket results in point a. Search must extend beyond local bucket as a function of search radius R, resulting in point b.
Figure8-37
Figure 8-37. Structure of spatial search structure vtkCellLocator. The data structure represents a uniformly subdivided octree.

vtkCellLocator is implemented as a uniformly subdivided octree with some peculiar characteristics (Figure 8-37). Conventional octree representations use upward parent and downward children pointers to track parent and children octants. Besides the required list of entities (i.e., points or cells) in each octant, additional information about octant level, center, and size may also be maintained. This results in a flexible structure with significant overhead. The overhead is the memory resources to maintain pointers, plus the cost to allocate and delete memory.

In contrast, vtkCellLocator uses a single array to represent the octree. The array is divided into two parts. The first part contains a list of parent octants, ordered according to level and octant child number. In the second part are the terminal, or leaf octants. The terminal octants are ordered on a regular array of buckets, just the same as vtkLocator. The terminal octants contain a list of the entities inside the octant. The parent octants maintain a value indicating whether the octant is empty, or whether something is inside it. (Both types of information are represented in the same portion of the octant structure.) Because the octree is uniformly subdivided, parent-child relationships, as well as octant locations, can be computed quickly using simple division operations.

Figure8-38
Figure 8-38. The picking hierarchy in VTK. All subclasses of vtkAbstractPropPicker return the picked instance of vtkProp. The information is returned as a vtkAssemblyPath. The assembly path is necessary because some props may exist in an assembly hierarchy. The classes vtkWorldPointPicker and vtkPropPicker are hardware accelerated picking classes. All others use software ray casting.

The advantage of this structure is that memory can be allocated and deleted quickly. In addition, insertion into the octree is exactly the same as with vtkLocator, and is simpler than conventional octrees. The parent octants provide quick culling capability, since their status (empty or nonempty) allows us to stop certain types of search operations. On the downside, because the octree is uniformly subdivided, this structure is wasteful of memory resources if the data is non-uniformly distributed.

Our experience with the search structures described here is that they work well for many types of visualization data. However, if your data is non-uniform, you may want to implement your own special search classes.

Picking

The Visualization Toolkit provides a variety of classes to perform actor (or vtkProp), point, cell, and world point picking (Figure 8-38). Depending on which picker is used, either software-based geometric intersection or hardware picking is used. The following describes each of the picker types in detail.

All pickers are subclasses of vtkAbstractPicker which defines the basic pick interface. The user must specify a selection point in display coordinates for a specified instance of vtkRenderWindow and invoke the Pick() method. At a minimum, the class must return an x-y-z pick position in world coordinates. It is possible to limit the pick candidates to a list of vtkProps (the PickList). The class also invokes the StartPickEvent, PickEvent, and EndPickEvent events that are invoked prior to picking, during picking, and after picking, respectively.

Classes that can return information indicating which vtkProp they have picked are subclasses of vtkAbstractPropPicker. After the pick operation, vtkAbstractPropPicker returns a vtkAssemblyPath. The assembly path is an ordered list of instances of vtkProp and possibly associated 4x4 transformation matrices. The path represents a concatenated hierarchy of assembly nodes if an assembly has been defined (see "Assemblies and Other Types of [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)" in Chapter 3) for more information about props and assemblies).

The object vtkPicker intersects a ray defined from camera position to a screen (i.e., pixel) coordinate against the bounding box of all pickable and nontransparent [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)3D's. (A vtkProp is pickable if its Pickable instance variable is true.) The result of the vtkPicker pick operation is to return a list of the [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)3D's whose bounding box is intersected. The prop closest to the camera position is also returned.

The object vtkPointPicker intersects the ray against the points defining each vtkProp3D, and returns the point coordinate closest to the camera position, as well as the vtkProp3D that the point belongs to. Since screen resolution prevents precise selection of a point, a tolerance around the ray must be specified. The tolerance is expressed as a fraction of the rendering window size. (Rendering window size is measured across the window diagonal.) Points must lie within this tolerance to be picked.

The object vtkCellPicker intersects the ray with the cells defining each vtkProp3D, and returns the point of intersection, as well as the vtkProp3D that the cell belongs to. If you are trying to select a cell belonging to a particular vtkProp3D, vtkCellPicker is the object to use because it performs surface (or cell) intersection. Unfortunately, vtkCellPicker is the slowest of the pickers because of greater computational requirements.

The class vtkWorldPointPicker returns the (x,y,z) coordinate value of a pick in the rendering window. To determine this information, it combines the display (x,y) values with the z-buffer depth values. Of all the pickers this is the fastest, but it cannot determine the actual cell, point or vtkProp that is selected since it is not a subclass of vtkAbstractPropPicker. (Note: on some systems z-buffer operations are inoperative and this object will not function properly.)

By default picking is performed with the class vtkPropPicker. This class uses hardware-accelerated picking so it is generally faster than software based picking. Unlike the other hardware accelerated class (vtkWorldPointPicker), it returns the instance of vtkProp that was picked as well as the (x,y,z) world coordinate value

Figure8-39 summarizes the five concrete picking classes. Picking is built into the vtkRenderWindowInteractor class using the "p" key (see "RenderWindowInteractor" in Chapter 3). By default a vtkPropPicker is created and used, but you are free to specify your own picker type.

Examples

To conclude this section, we will examine how some of the dataset, cell, and point attribute operations are used. These operations tend to be used by class developers. You will not need to use them if you build applications by constructing visualization pipelines with existing filters.

Find Free Edges. In our first example we will take a peek inside the filter vtkLinearExtrusionFilter. This filter implements the following modelling operation. Given a polygonal mesh, extrude the mesh in a given direction, constructing a "skirt" or "walls" from the free edges. If the polygonal example is a single square, the result of this operation is a cube. Or, if the polygonal data consists of a single line, the result of the operation is a quadrilateral. A point will generate a line as shown in Figure 8-40(a).

Figure8-39
Figure 8-39. Summary of picking operations. The top three pick classes (a)-(c) use software ray casting. The bottom two pick classes (d)-(e) use hardware acceleration.
Figure8-40
Figure 8-40. Depiction of linear and rotational extrusion.

Recall that free edges are edges used by only one polygon. We can determine this information using the dataset topology operation GetCellEdgeNeigbors(). We use Equation 8-25 and the two points defining the edge of the polygon to determine the adjacency set (i.e., the polygons sharing this edge). If no other polygon uses this edge, then the edge is extruded to generate a triangle strip. The C++ pseudo code is as follows.

for (cellId=0; cellId < numCells; cellId++) {
+

Traversing Intermediate Topology

The dataset abstraction implemented by VTK provides simple techniques to traverse points and cells. Sometimes we want to traverse intermediate topology such as edges or faces. For example, to identify boundary edges in a triangular mesh we must traverse each edge, counting the number of triangles that use each edge. (Recall that boundary edges are used by just one triangle.) Unfortunately, there is no obvious way to traverse edges. The same problem holds true if we want to traverse the faces of a dataset containing 3D cells.

A simple solution is to traverse each cell and then obtain the edges (or faces) that compose the cell. The problem with this approach is that edges and faces are generally used by more than one cell, resulting in multiple visits to the same face or edge. This may be acceptable in some algorithms, but usually we count on visiting each edge or face only once.

A better solution to this problem is to traverse each cell as before, but only process intermediate topology if the current cell has the smallest cell id. (The current cell is the cell being visited in the traversal process.) To determine whether the current cell has the smallest cell id, we obtain all cells using the intermediate topology. This information can be obtained using the topological adjacency operators described earlier (e.g., Equation 8-25).

To illustrate this process consider visiting the edges of a triangle mesh. We begin by visiting the first triangle, t, and then its edges. For each edge we determine the adjacent triangle(s) (if any) that use the edge. If the id of the adjacent triangle(s) is greater than triangle t's id, or there are no adjacent triangles, then we know to process the current edge. (Of course the first triangle will always have the smallest id but this will change as the traversal proceeds.) We then continue traversing the triangle list for new t's. In this way all the edges of the mesh will be visited.

Color Scalar Data

Multi-valued scalar data, or scalars represented by various color representations, are treated specially by the Visualization Toolkit. These data arise, for example, when using a color specification to directly control the color of objects rather than mapping a scalar value through a lookup table. (See "Color Mapping" in Chapter 6 for more information.)

By default, the mapping of scalars into colors proceeds as follows (vtkMapper and subclasses are responsible for implementing this behavior):

It is possible to force unsigned char data to be mapped through a lookup table. The vtkMapper method SetColorModeToMapScalars() forces all data regardless of type to be mapped through the lookup table.

Searching

The Visualization Toolkit provides two classes to perform searches for dataset points and cells. These are vtkPointLocator and vtkCellLocator. (Both of these classes are subclasses of vtkLocator, which is an abstract base class for spatial search objects.) vtkPointLocator is used to search for points and, if used with the topological dataset operator GetPointCells(), to search for cells as well. vtkCellLocator is used to search for cells.

vtkPointLocator is implemented as a regular grid of buckets (i.e., same topology and geometry as an image dataset). The number of buckets can be user-specified, or more conveniently, automatically computed based on the number of dataset points. On average, vtkPointLocator provides constant time access to points. However, in cases where the point distribution is not uniform, the number of points in a bucket may vary widely, giving O(n) worst-case behavior. In practice this is rarely a problem, but adaptive spatial search structures (e.g., an octree) may sometimes be a better choice.

Determining closest point to a point p using vtkPointLocator (as well as other spatial search structures) is a three-step process. In the first step, the bucket containing p is found using the appropriate insertion scheme. (For vtkPointLocator this is three divisions to determine bucket indices (i, j, k).) Next, the list of points in this bucket is searched to determine the closest point. However, as Figure 8-36 shows, this may not be the true closest point, since points in neighboring buckets may be closer. Consequently, a final search of neighboring buckets is necessary. The search distance is a function of the distance to the current closest point. Once all neighbors within this distance are searched, the closest point is returned.

Figure8-36
Figure 8-36. Determining closest point to $p$ in vtkPointLocator. Initial search in bucket results in point a. Search must extend beyond local bucket as a function of search radius R, resulting in point b.
Figure8-37
Figure 8-37. Structure of spatial search structure vtkCellLocator. The data structure represents a uniformly subdivided octree.

vtkCellLocator is implemented as a uniformly subdivided octree with some peculiar characteristics (Figure 8-37). Conventional octree representations use upward parent and downward children pointers to track parent and children octants. Besides the required list of entities (i.e., points or cells) in each octant, additional information about octant level, center, and size may also be maintained. This results in a flexible structure with significant overhead. The overhead is the memory resources to maintain pointers, plus the cost to allocate and delete memory.

In contrast, vtkCellLocator uses a single array to represent the octree. The array is divided into two parts. The first part contains a list of parent octants, ordered according to level and octant child number. In the second part are the terminal, or leaf octants. The terminal octants are ordered on a regular array of buckets, just the same as vtkLocator. The terminal octants contain a list of the entities inside the octant. The parent octants maintain a value indicating whether the octant is empty, or whether something is inside it. (Both types of information are represented in the same portion of the octant structure.) Because the octree is uniformly subdivided, parent-child relationships, as well as octant locations, can be computed quickly using simple division operations.

Figure8-38
Figure 8-38. The picking hierarchy in VTK. All subclasses of vtkAbstractPropPicker return the picked instance of vtkProp. The information is returned as a vtkAssemblyPath. The assembly path is necessary because some props may exist in an assembly hierarchy. The classes vtkWorldPointPicker and vtkPropPicker are hardware accelerated picking classes. All others use software ray casting.

The advantage of this structure is that memory can be allocated and deleted quickly. In addition, insertion into the octree is exactly the same as with vtkLocator, and is simpler than conventional octrees. The parent octants provide quick culling capability, since their status (empty or nonempty) allows us to stop certain types of search operations. On the downside, because the octree is uniformly subdivided, this structure is wasteful of memory resources if the data is non-uniformly distributed.

Our experience with the search structures described here is that they work well for many types of visualization data. However, if your data is non-uniform, you may want to implement your own special search classes.

Picking

The Visualization Toolkit provides a variety of classes to perform actor (or vtkProp), point, cell, and world point picking (Figure 8-38). Depending on which picker is used, either software-based geometric intersection or hardware picking is used. The following describes each of the picker types in detail.

All pickers are subclasses of vtkAbstractPicker which defines the basic pick interface. The user must specify a selection point in display coordinates for a specified instance of vtkRenderWindow and invoke the Pick() method. At a minimum, the class must return an x-y-z pick position in world coordinates. It is possible to limit the pick candidates to a list of vtkProps (the PickList). The class also invokes the StartPickEvent, PickEvent, and EndPickEvent events that are invoked prior to picking, during picking, and after picking, respectively.

Classes that can return information indicating which vtkProp they have picked are subclasses of vtkAbstractPropPicker. After the pick operation, vtkAbstractPropPicker returns a vtkAssemblyPath. The assembly path is an ordered list of instances of vtkProp and possibly associated 4x4 transformation matrices. The path represents a concatenated hierarchy of assembly nodes if an assembly has been defined (see "Assemblies and Other Types of [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)" in Chapter 3) for more information about props and assemblies).

The object vtkPicker intersects a ray defined from camera position to a screen (i.e., pixel) coordinate against the bounding box of all pickable and nontransparent vtkProp3D's. (A vtkProp is pickable if its Pickable instance variable is true.) The result of the vtkPicker pick operation is to return a list of the vtkProp3D's whose bounding box is intersected. The prop closest to the camera position is also returned.

The object vtkPointPicker intersects the ray against the points defining each vtkProp3D, and returns the point coordinate closest to the camera position, as well as the vtkProp3D that the point belongs to. Since screen resolution prevents precise selection of a point, a tolerance around the ray must be specified. The tolerance is expressed as a fraction of the rendering window size. (Rendering window size is measured across the window diagonal.) Points must lie within this tolerance to be picked.

The object vtkCellPicker intersects the ray with the cells defining each vtkProp3D, and returns the point of intersection, as well as the vtkProp3D that the cell belongs to. If you are trying to select a cell belonging to a particular vtkProp3D, vtkCellPicker is the object to use because it performs surface (or cell) intersection. Unfortunately, vtkCellPicker is the slowest of the pickers because of greater computational requirements.

The class vtkWorldPointPicker returns the (x,y,z) coordinate value of a pick in the rendering window. To determine this information, it combines the display (x,y) values with the z-buffer depth values. Of all the pickers this is the fastest, but it cannot determine the actual cell, point or vtkProp that is selected since it is not a subclass of vtkAbstractPropPicker. (Note: on some systems z-buffer operations are inoperative and this object will not function properly.)

By default picking is performed with the class vtkPropPicker. This class uses hardware-accelerated picking so it is generally faster than software based picking. Unlike the other hardware accelerated class (vtkWorldPointPicker), it returns the instance of vtkProp that was picked as well as the (x,y,z) world coordinate value

Figure8-39 summarizes the five concrete picking classes. Picking is built into the vtkRenderWindowInteractor class using the "p" key (see "RenderWindowInteractor" in Chapter 3). By default a vtkPropPicker is created and used, but you are free to specify your own picker type.

Examples

To conclude this section, we will examine how some of the dataset, cell, and point attribute operations are used. These operations tend to be used by class developers. You will not need to use them if you build applications by constructing visualization pipelines with existing filters.

Find Free Edges. In our first example we will take a peek inside the filter vtkLinearExtrusionFilter. This filter implements the following modelling operation. Given a polygonal mesh, extrude the mesh in a given direction, constructing a "skirt" or "walls" from the free edges. If the polygonal example is a single square, the result of this operation is a cube. Or, if the polygonal data consists of a single line, the result of the operation is a quadrilateral. A point will generate a line as shown in Figure 8-40(a).

Figure8-39
Figure 8-39. Summary of picking operations. The top three pick classes (a)-(c) use software ray casting. The bottom two pick classes (d)-(e) use hardware acceleration.
Figure8-40
Figure 8-40. Depiction of linear and rotational extrusion.

Recall that free edges are edges used by only one polygon. We can determine this information using the dataset topology operation GetCellEdgeNeigbors(). We use Equation 8-25 and the two points defining the edge of the polygon to determine the adjacency set (i.e., the polygons sharing this edge). If no other polygon uses this edge, then the edge is extruded to generate a triangle strip. The C++ pseudo code is as follows.

for (cellId=0; cellId < numCells; cellId++) {
   cell = mesh->GetCell(cellId);
   if ((dim=cell->GetCellDimension()) == 0)
   //create lines from points
diff --git a/site/search/search_index.json b/site/search/search_index.json
index 293dac94754..8da8af357f4 100644
--- a/site/search/search_index.json
+++ b/site/search/search_index.json
@@ -1 +1 @@
-{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"About the Examples","text":"

The VTK source distribution includes a sizeable number of examples. The goal of the VTK examples is to illustrate specific VTK concepts in a consistent and simple format. Some have been there since the inception of the toolkit. These examples have been subject to peer review and revision over the years. However, these examples only cover a small part of the capabilities of VTK.

Hundreds of tests are distributed with the toolkit source. The tests reside in ''Kit''/Testing directories (for example, Filters/Points/Testing) in the source distribution. However, these tests are meant to exercise the toolkit rather than illustrate how to use it. For the most part, the tests are not good educational resources.

We are now using github pages to provide examples that will help both new and experienced VTK users. The examples can be used to find examples that answer questions like, \"How do I extract normals from a filter's output?\", \"How do I generate models from segmented data?\", and \"How do I compute the area of a triangle?\", just to name a few.

Over time we hope that the examples will answer many of the users' questions. Some questions won't have a solution in the current example repertoire. For those questions, we encourage the user to create a simple example that illustrates either a dilemma or a new solution.

"},{"location":"#examples-are-available-for-the-following-programming-languages","title":"Examples are available for the following programming languages:","text":"
  • C++
  • Python
  • Java
  • C#
  • js

The above examples demonstrate how to use VTK functionalities. There are also examples specifically to demonstrate how to write code as a VTK filter using VTK techniques. This is helpful so that your custom code can be called in a fashion that other people are already familiar with. It is also necessary if you plan to contribute your classes to VTK.

"},{"location":"#examples-for-visualising","title":"Examples for visualising:","text":"
  • Trame

These examples consist of tarfiles that you download, set up and run.

"},{"location":"#information-about-the-vtk-examples","title":"Information about the VTK Examples","text":"
  • Users: If you just want to use the VTK Examples, this is the place for you. You will learn how to search for examples, build a few examples and build all of the examples.
  • Developers: If you want to contribute examples, this section explains everything you need to know. You will learn how to add a new example and the guidelines for writing an example.
  • Adminstrators: This section is for a VTK Example Administrators or people want to learn more about the process. You will learn how the VTK Examples repository is organized, how the repository is synced to the repository and how to add new topics, tests and regression baselines.
"},{"location":"#how-can-i-help","title":"How can I help?","text":"

This project has grown to be very large. We are always looking for people to help the cause. You can help by:

  • Adding new examples (see procedure here)
  • Proof reading existing examples, for correctness, style, and clarity.
  • Add comments to existing examples where they are unclear.
"},{"location":"CSharp/","title":"CSharp Examples","text":""},{"location":"CSharp/#vtk-classes-summary","title":"VTK Classes Summary","text":"

This Python script, SelectExamples, will let you select examples based on a VTK Class and language. It requires Python 3.7 or later. The following tables will produce similar information.

  • VTK Classes with Examples, this table is really useful when searching for example(s) using a particular class.

  • VTK Classes with No Examples, please add examples in your area of expertise!

"},{"location":"CSharp/#simple-operations","title":"Simple Operations","text":"Example Name Description Image DistanceBetweenPoints Computes the distance between two point Distance between two points DistancePointToLine Distance between a point and a line GaussianRandomNumber Generates Gaussian random number Random number (Gaussian distribution) PerspectiveTransform Apply a perspective transformation to a point ProjectPointPlane Project a point onto a plan Project a point onto a plane RandomSequence This is the preferred way to generate random numbers Random sequence UniformRandomNumber Generates uniform random number Random number (uniform distribution)"},{"location":"CSharp/#input-and-output","title":"Input and Output","text":""},{"location":"CSharp/#graph-formats","title":"Graph Formats","text":""},{"location":"CSharp/#3d-file-formats","title":"3D File Formats","text":"Example Name Description Image ConvertFile Convert a file from one type to another XGMLReader Read a .gml file"},{"location":"CSharp/#standard-formats","title":"Standard Formats","text":""},{"location":"CSharp/#input","title":"Input","text":"Example Name Description Image DEMReader Read DEM (elevation map) files ReadDICOMSeries This example demonstates how to read a series of DICOM images and scroll through slice Convert a series of DICOM files into a VTI File ReadPDB Read Protein Data Bank Files Read Protein Data Bank files (.pdb) files ReadPLOT3D Read CFD (computational fluid dynamics) data produced by PLOT3D Read PLOT3D (.bin) files ReadPLY Read PLY (.ply) files ReadSTL Read stereo lithography STL (.stl) files SimplePointsReader Read a simple \"xyz\" file of points VRML Read a VRML (WRL) file"},{"location":"CSharp/#vtk-formats","title":"VTK Formats","text":""},{"location":"CSharp/#input_1","title":"Input","text":"Example Name Description Image ParticleReader Read an ASCII file ReadImageData Read a image data (.vti) file ReadOBJ Read a Wavefront OBJ file ReadPlainText Read a plain text file ReadPolyData Read a polygonal data (.vtp) file ReadRectilinearGrid Read a rectilinear grid (.vtr) file ReadStructuredGrid Read a structured grid (.vts) file ReadUnknownTypeXMLFile Read an XML file and later decide what kind it is ReadUnstructuredGrid Demonstrates how to read a .vtu fil Read an unstructured grid (.vtu) file"},{"location":"CSharp/#output","title":"Output","text":"Example Name Description Image WriteVTI VTI is an \"ImageData\" Write a .vti file WriteVTP VTP is a \"PolyData\". This format allows for the most complex geometric objects to be stored Write a .vtp file WriteVTU VTU is an \"Unstructured Grid\". This format allows for 3D data to be stored Write a .vtu file XMLStructuredGridWriter Write a .vts file from a vtkStructuredGrid"},{"location":"CSharp/#image-formats","title":"Image Formats","text":""},{"location":"CSharp/#input_2","title":"Input","text":"Example Name Description Image ImageReader2Factory This class tries to find an appropriate reader. It is very convenient to use this when you don't know what kind of file to expect Read most standard image formats. JPEGReader Read a JPG image MetaImageReader Read .mha files PNGReader Read a PNG image ReadBMP Read BMP (.bmp) files ReadPNM Read PNM (.pnm) files ReadTIFF Read TIFF (.tif) files"},{"location":"CSharp/#output_1","title":"Output","text":"Example Name Description Image JPEGWriter Write a JPEG (.jpg) file MetaImageWriter Write a .mha/.mhd + .raw file WriteBMP Write a BMP (.bmp) file WritePNG Write a PNG (.png) file WritePNM Write a PNM (.pnm) file WriteTIFF Write a TIFF (.tif) file"},{"location":"CSharp/#geometric-objects","title":"Geometric Objects","text":"Example Name Description Image Arrow Arrow Axes Axes ColoredLines Colored Lines Cone Cone Cube Cube Cylinder Cylinder Disk A circle with a hole in it Disk Frustum Frustum GeometricObjectsDemo A demonstration of all geometric objects that work the same way Hexahedron Hexahedron Line Line LongLine Manually create a polyline OrientedArrow Oriented Arrow Plane Plane Planes Planes PlanesIntersection PlanesIntersection PlatonicSolid PlatonicSolid Point Point PolyLine PolyLine Polygon Polygon PolygonIntersection IntersectWithLine( Compute the intersection of a line segment with a polygon Pyramid Pyramid Quad Quad RegularPolygonSource Regular Polygon Sphere Sphere Tetrahedron Tetrahedron Triangle Triangle TriangleStrip Triangle strip Vertex Vertex"},{"location":"CSharp/#parametric-objects","title":"Parametric Objects","text":"

These examples demonstrate how to create an display one of the many vtkParametric* objects. All of the classes listed can be used in an identical fashion.

Example Name Description Image ParametricObjects Create and display a parametric object ParametricObjectsDemo Demonstration of all of the vtkParametric* classes"},{"location":"CSharp/#implicit-functions-and-iso-surfaces","title":"Implicit Functions and Iso-surfaces","text":"Example Name Description Image BandedPolyDataContourFilter BandedPolyDataContourFilter ExtractLargestIsosurface Extract largest isosurface FilledContours Create filled contours (vtkClipPolyData) ImplicitSphere An implicit representation of a sphere IsoContours Visualize different isocontours using a slider MarchingCubes Create a voxelized spher Marching cubes MarchingSquares Create a contour from a structured point set (image Marching squares) SampleFunction Sample and visualize an implicit function"},{"location":"CSharp/#working-with-3d-data","title":"Working with 3D Data","text":"Example Name Description Image AlignFrames Align coordinate frames ContoursFromPolyData Create contours from PolyData FindAllArrayNames Get the names of all of the data arrays ImplicitBoolean Operations include intersection and union. IterateOverLines Iterate through the lines of a PolyData MultiBlockMergeFilter Combine MultiBlockDataSets NullPoint Set everything in PointData at a specified index to NUL NullPoint PolyDataGetPoint Get point locations/coordinates from a vtkPolyData ShrinkPolyData Move all items in a PolyData towards their centroid VectorFieldNonZeroExtraction This example shows how to create an imagedata object, associate scalar data with some points and visualize only nonzero scalar value Extract non-zero vectors from a vtkImageData WarpVector vtkWarpVector"},{"location":"CSharp/#working-with-meshes","title":"Working with Meshes","text":"Example Name Description Image BoundaryEdges Find the edges that are used by only one face Finding Boundary Edges CapClip Cap a clipped polydata with a polygon CellEdges Get edges of cells ClosedSurface Check if a surface is closed ColorDisconnectedRegions Color each disconnected region of a vtkPolyData a different color ColoredElevationMap Colormap, color ma Color a mesh by height Curvature Compute Gaussian, Mean, Min, and Max Curvatures Decimate Reduce the number of triangles in a mesh Decimation DijkstraGraphGeodesicPath Find the shortest path between two points on a mesh ElevationFilter Color a mesh by height ExtractEdges Extract Edges FillHoles Close holes in a mesh Fill Holes GreedyTerrainDecimation Create a mesh from an ImageData HighlightBadCells Highlight Bad Cells LargestRegion Extract the largest connected region in a polydata MatrixMathFilter Compute various quantities on cell and points in a mesh Matrix math filter OBBDicer Breakup a mesh into pieces OBBDicer PolygonalSurfaceContourLineInterpolator Interactively find the shortest path between two points on a mesh QuadricClustering Reduce the number of triangles in a mesh Decimation (quadric clustering) QuadricDecimation Reduce the number of triangles in a mesh Decimation (quadric decimation) SelectPolyData Select a region of a mesh SimpleElevationFilter Color a mesh by dotting a vector from the origin to each point with a specified vector SolidClip Create a \"solid\" clip SpecifiedRegion Extract a specific (specified) connected region in a polydata Subdivision Increase the number of triangles in a mesh Subdivision Triangulate Convert all polygons in a mesh to triangles Triangulate a mesh WeightedTransformFilter vtkWeightedTransformFilter WindowedSincPolyDataFilter Smooth a mesh."},{"location":"CSharp/#working-with-structured-3d-data","title":"Working with Structured 3D Data","text":"

This section includes vtkImageData, vtkStructuredGrid, and vtkRectilinearGrid.

\"ImageData\" is not the traditional \"flat, 2D image\" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Here is an overview of these data structures: [http://vtk.org/Wiki/VTK/Tutorials/3DDataTypes]. Image data can represent at typical 2D image, but also, a 3D volume.

"},{"location":"CSharpHowTo/","title":"CSharp How To","text":"

Often you just need a \"pointer\" to an example that shows you how to do something.

Here are some snippets or examples that highlight interesting features that may help you:

"},{"location":"CSharpHowTo/#no-examples-or-snippets-yet","title":"No examples or snippets yet","text":"Example Name Comments Image"},{"location":"Cxx/","title":"C++ Examples","text":"

These are fully independent, compilable examples. There is significant overlap in the examples, but they are each intended to illustrate a different concept and be fully stand alone compilable.

"},{"location":"Cxx/#vtk-classes-summary","title":"VTK Classes Summary","text":"

This Python script, SelectExamples, will let you select examples based on a VTK Class and language. It requires Python 3.7 or later. The following tables will produce similar information.

  • VTK Classes with Examples, this table is really useful when searching for example(s) using a particular class.

  • VTK Classes with No Examples, please add examples in your area of expertise!

"},{"location":"Cxx/#tutorials","title":"Tutorials","text":"

If you are new to VTK then these tutorials will help to get you started.

"},{"location":"Cxx/#hello-world","title":"Hello World","text":"Example Name Description Image A hello world example Cylinder example from the VTK Textbook and source code. A hello world example."},{"location":"Cxx/#simple-operations","title":"Simple Operations","text":"Example Name Description Image DistanceBetweenPoints Distance between two points. DistancePointToLine Distance between a point and a line. FloatingPointExceptions Floating Point Exceptions GaussianRandomNumber Generates Gaussian random numbers. PerspectiveTransform Apply a perspective transformation to a point. ProjectPointPlane Project a point onto a plane. RandomSequence This is the preferred way to generate random numbers. UniformRandomNumber Generates uniform random numbers."},{"location":"Cxx/#input-and-output","title":"Input and Output","text":""},{"location":"Cxx/#graph-formats","title":"Graph Formats","text":""},{"location":"Cxx/#3d-file-formats","title":"3D File Formats","text":"Example Name Description Image ConvertFile Convert a file from one type to another XGMLReader Read a .gml file"},{"location":"Cxx/#standard-formats","title":"Standard Formats","text":""},{"location":"Cxx/#input","title":"Input","text":"Example Name Description Image DEMReader Read DEM (elevation map) files DelimitedTextReader Read a delimited file into a polydata. DumpXMLFile Report the contents of a VTK XML or legacy file IndividualVRML This example is used to get each actor and object from a scene and verify axes correspondence ParticleReader This example reads ASCII files where each line consists of points with its position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file format. ReadAllPolyDataTypes Read any VTK polydata file. ReadAllPolyDataTypesDemo Read all VTK polydata file types. ReadAllUnstructuredGridTypes Read any VTK unstructuredgrid file. ReadCML Read Chemistry Markup Language files. ReadExodusData Read and view ExodusII data. ReadOBJ Read an OBJ (.obj) file. ReadPDB Read Protein Data Bank Files. ReadPLOT3D Read CFD (computational fluid dynamics) data produced by PLOT3D. ReadPLY Read PLY (.ply) files ReadPlainTextTriangles Read a plain text file into a polydata. ReadSLC Read VolVis file. ReadSTL Read stereo lithography STL (.stl) files ReadTextFile Read a plain text file into a polydata. SimplePointsReader Read a simple \"xyz\" file of points. TransientHDFReader Read transient data written inside a vtkhdf file."},{"location":"Cxx/#importers","title":"Importers","text":"Example Name Description Image 3DSImporter Import a 3D Studio scene that includes multiple actors. GLTFImporter Import a glTF scene. ImportPolyDataScene Import a polydata scene using multiblock datasets. OBJImporter Import an OBJ scene that includes actors, materials and textures. VRMLImporter Import a VRML 2.0 (WRL) file. VRMLImporterDemo Import a VRML 2.0 (WRL) file and add normals if necessary."},{"location":"Cxx/#output","title":"Output","text":"Example Name Description Image DelimitedTextWriter Write data to a delimited file SimplePointsWriter Write a simple \".xyz\" file WritePLY Write PLY (.ply) files WriteSTL Write stereo lithography STL (.stl) files"},{"location":"Cxx/#exporters","title":"Exporters","text":"Example Name Description Image ExportPolyDataScene Export a polydata scene using multiblock datasets."},{"location":"Cxx/#vtk-formats","title":"VTK Formats","text":""},{"location":"Cxx/#input_1","title":"Input","text":"Example Name Description Image ReadImageData Read a image data (.vti) file ReadPolyData Read a polygonal data (.vtp) file ReadRectilinearGrid Read a rectilinear grid (.vtr) file ReadStructuredGrid Read a structured grid (.vts) file ReadUnknownTypeXMLFile Read an XML file and later decide what kind it is ReadUnstructuredGrid Read an unstructured grid (.vtu) file"},{"location":"Cxx/#output_1","title":"Output","text":"Example Name Description Image ExodusIIWriter Write a time varying ExodusII file. WriteVTI Write a .vti file. VTI is an \"ImageData\". WriteVTP Write a .vtp file. VTP is a \"PolyData\". This format allows for the most complex geometric objects to be stored. WriteVTU Write a .vtu file. VTU is an \"Unstructured Grid\". This format allows for 3D data to be stored. XMLPImageDataWriter Write a .pvti file with 4 .vti pieces. XMLPUnstructuredGridWriter Write a .pvtu with 4 .vtu pieces. XMLStructuredGridWriter Write a .vts file from a vtkStructuredGrid."},{"location":"Cxx/#legacy-vtk-formats","title":"Legacy VTK Formats","text":"Example Name Description Image GenericDataObjectReader Read any type of legacy .vtk file. ReadLegacyUnstructuredGrid Read an unstructured grid that contains 11 linear cells. StructuredGridReader Read a structured grid (.vtk) file. StructuredPointsReader Read a structured points (.vtk) file. WriteLegacyLinearCells Write each linear cell into a legacy UnstructuredGrid file. WriteXMLLinearCells Write each linear cell into an XML UnstructuredGrid file (.vtu)."},{"location":"Cxx/#image-format","title":"Image Format","text":""},{"location":"Cxx/#input_2","title":"Input","text":"Example Name Description Image HDRReader Read a high-dynamic-range imaging file. ImageReader2Factory This class tries to find an appropriate reader. It is very convenient to use this when you don't know what kind of file to expect. JPEGReader Read a JPEG image. MetaImageReader Read .mha files. PNGReader Read a PNG image. ReadBMP Read BMP (.bmp) files. ReadDICOM Read DICOM file ReadDICOMSeries This example demonstrates how to read a series of DICOM images and scroll through slices ReadPNM Read PNM (.pnm) files. ReadTIFF Read TIFF (.tif) files."},{"location":"Cxx/#output_2","title":"Output","text":"Example Name Description Image ImageWriter Write an imagefile based on the file extension. JPEGWriter Write a JPEG (.jpg) file. MetaImageWriter Write a .mha/.mhd + .raw file. PNGWriter Write a PNG (.png) file. WriteBMP Write a BMP (.bmp) file. WritePNM Write a PNM (.pnm) file. WriteTIFF Write a TIFF (.tif) file."},{"location":"Cxx/#geometric-objects","title":"Geometric Objects","text":"Example Name Description Image Axes ColoredLines Cube Manually build a polygonal cube. Cube1 A nice simple example that demonstrates the operation of the VTK pipeline. Dodecahedron Create a dodecahedron using vtkPolyhedron. EllipticalCylinder Create an elliptical cylinder using extrusion. EllipticalCylinderDemo Show the base and extrusion vector. GeometricObjectsDemo A demonstration of all geometric objects that work the same way. OpenVRFrustum VTK + OpenVR Example. OpenVROrientedArrow VTK + OpenVR Example. OpenVROrientedCylinder VTK + OpenVR Example. OpenVRTessellatedBoxSource VTK + OpenVR Example. PlaneSourceDemo Display the instance variables that define a vtkPlaneSource. Planes PlanesIntersection PolygonIntersection Compute the intersection of a line segment with a polygon. ShrinkCube Applying shrink filter to an object. SourceObjectsDemo Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source. Other polygonal source objects are available; check subclasses of vtkPolyDataAlgorithm."},{"location":"Cxx/#cells","title":"Cells","text":"Example Name Description Image Cell3DDemonstration Demonstrate the use of vtkCell3D to construct geometric objects. Sample objects are generated from the classes derived from vtkCell3D and displayed. CellTypeSource Generate tessellated cells. ConvexPointSet Generate a ConvexPointSetCell. Hexahedron LinearCellDemo Linear cell types found in VTK. Numbers define ordering of the defining points. LongLine Manually create a polyline. Point PolyLine Polygon Polyhedron Create an unstructured grid representation of a polyhedron (cube) and write it out to a file. Pyramid Quad Tetrahedron Triangle Triangle strip Vertex"},{"location":"Cxx/#sources","title":"Sources","text":"Example Name Description Image Arrow Cone Display a cone ConeDemo Disolay four different resolution cones. Cylinder Disk A circle with a hole in it. EarthSource Create the Earth. Frustum Line OrientedArrow Orient an arrow along an arbitrary vector. OrientedCylinder Orient a cylinder along an arbitrary vector. Plane PlatonicSolids PolyLine1 This example demonstrates how to create a polygon through several ordered points. RegularPolygonSource Sphere TessellatedBoxSource Generate a box with tessellated sides. TextActor 2D \"HUD-type\" text"},{"location":"Cxx/#non-linear","title":"Non Linear","text":"Example Name Description Image IsoparametricCellsDemo Nonlinear isoparametric cell types in VTK. QuadraticHexahedron Create and tessellate a nonlinear cell. QuadraticHexahedronDemo Interactively adjust chord error. QuadraticTetra Create and tessellate a nonlinear cell. QuadraticTetraDemo Interactively adjust chord error."},{"location":"Cxx/#parametric-objects","title":"Parametric Objects","text":"

These examples demonstrate how to create an display one of the many vtkParametric objects. All of the classes listed can be used in an identical fashion.

Example Name Description Image ParametricKuenDemo Interactively change the parameters for a Kuen Surface. ParametricObjectsDemo Demonstrates the Parametric classes added by Andrew Maclean and additional classes added by Tim Meehan. The parametric spline is also included. Options are provided to display single objects, add backface, add normals and print out an image. ParametricSuperEllipsoidDemo Interactively change the parameters for a SuperEllipsoid Surface. ParametricSuperToroidDemo Interactively change the parameters for a SuperToroid Surface."},{"location":"Cxx/#implicit-functions-and-iso-surfaces","title":"Implicit Functions and Iso-surfaces","text":"Example Name Description Image BandedPolyDataContourFilter Create filled contours. BooleanOperationImplicitFunctions Demonstrate booleans of two different implicit functions ContourTriangulator Create a contour from a structured point set (image) and triangulate it. CutWithCutFunction Cut a surface with an implicit plane using vtkCutter. CutWithScalars Cut a surface with scalars. DiscreteMarchingCubes Generate surfaces from labeled data. ExtractData Implicit functions used to select data: Two ellipsoids are combined using the union operation used to select voxels from a volume. Voxels are shrunk 50 percent. ExtractLargestIsosurface Extract largest isosurface. FilledContours Create filled contours (using vtkClipPolyData). Hello Implicit modelling used to thicken a stroked font. IceCream How to use boolean combinations of implicit functions to create a model of an ice cream cone. ImplicitDataSet Convert an imagedata to an implicit function. ImplicitQuadric Create an ellipsoid using an implicit quadric. ImplicitSphere An implicit representation of a sphere. ImplicitSphere1 Demonstrate sampling of a sphere implicit function. IsoContours Visualize different isocontours using a slider. Lorenz Visualizing a Lorenz strange attractor by integrating the Lorenz equations in a volume. MarchingCases Explore the Marching Cubes cases. MarchingCasesA The 256 possible cases have been reduced to 15 cases using symmetry. MarchingCasesB Marching cubes complementary cases. Cases 3c, 6c, 7c, 10c, 12c and 13c are displayed. MarchingCasesC Marching cubes, case 3 is rotated 90 degrees about the y-axis with no label. MarchingCasesD Marching cubes. Case 7 is rotated 180 degrees about the y-axis with no label. MarchingCubes Create a voxelized sphere. MarchingSquares Create a contour from a structured point set (image). SampleFunction Sample and visualize an implicit function. ShepardInterpolation Interpolate scalar data. SmoothDiscreteMarchingCubes Generate smooth surfaces from labeled data."},{"location":"Cxx/#working-with-3d-data","title":"Working with 3D Data","text":"Example Name Description Image AlignFrames Align coordinate frames. AlignTwoPolyDatas Align two vtkPolyData's. AppendFilter Append different types of data, BooleanOperationPolyDataFilter Perform boolean operations on two vtkPolyData objects. Bottle Rotationally symmetric objects. CappedSphere Rotate an arc to create a capped sphere. CellCenters Compute points at the center of every cell. CellCentersDemo Visualize points at the center of every cell. CellEdgeNeighbors Determine which cells share an edge with a specific cell. CellPointNeighbors Determine which cells share a single point with a specific cell. CellsInsideObject Extract cells inside a closed surface. CenterOfMass Compute the center of mass of the points. Circle Create a circle by cutting through a sphere. CleanPolyData Remove coincident points. ColorCells Color individual cells of a polydata with scalar index. ColorCellsWithRGB Color individual cells of a polydata with rgb colors. ColoredPoints Add three points to a polydata and associate a color with each of them. CombinePolyData Combine/Append PolyData. ConnectivityFilter Color any dataset type based on connectivity. ConnectivityFilterDemo Color any dataset type based on connectivity. ContoursFromPolyData Create contours from PolyData. ContoursToSurface Convert contours to a surface. ConvexHull Convex hull using vtkHull. ConvexHullShrinkWrap Convex hull using shrink wrapping. CopyAllArrays Copy all arrays from one vtkPolyData to another. CurvaturesAdjustEdges Get the Gaussian and Mean curvatures of a surface with adjustments for edge effects. CurvaturesDemo Demonstrates how to get the Gaussian and Mean curvatures of a surface. DataBounds Get the minimum and maximum value in each dimension. (Axis aligned bounding box) DataSetSurfaceFilter Convert vtkUnstructuredGrid to vtkPolyData. DecimatePolyline Decimate polyline. DeleteCells Delete a cell from a vtkPolyData DeletePoint DetermineArrayDataTypes Determine data types of arrays. DistancePolyDataFilter Compute the distance function from one vtkPolyData to another. EmbedPointsIntoVolume Embed points into a volume. ExternalContour Get the External Contour from Polydata. ExtractCellsUsingPoints Extract points but bring cells that are still complete with them. ExtractOutsideSurface Extract the outer surface of a multiple surface polydata. ExtractPolyLinesFromPolyData Extract polylines from polydata. ExtractSelection Extract selected points. ExtractSelectionCells Extract cell, select cell. ExtractSelectionOriginalId Extract selection and find correspondence between new and original Id. ExtractVisibleCells Extract and highlight visible cells. FieldData Add Global Miscellaneous Data (FieldData) to a Polydata. Finance Visualization of multidimensional financial data. The gray/wireframe surface represents the total data population. The red surface represents data points delinquent on loan payment. FinanceFieldData Visualization of multidimensional financial data. The yellow surface represents the total data population. The red surface represents data points delinquent on loan payment. FindAllArrayNames Get the names of all of the data arrays. FitSplineToCutterOutput Fit a spline to cutter output. GeometryFilter Convert vtkUnstructuredGrid to vtkPolyData (another way). GetMiscCellData Get Miscellaneous Data from Cells in a Polydata. GetMiscPointData Get Miscellaneous Data from Points in a Polydata. GradientFilter Compute the gradient of a scalar field on a data set. ImplicitBoolean Operations include intersection and union. ImplicitBooleanDemo Demo Union, Difference and Intersection. ImplicitModeller Compute the distance from an object to every point on a uniform grid. ImplicitPolyDataDistance Compute the distance function in a space around a vtkPolyData. InterpolateMeshOnGrid Interpolate a mesh over a grid. InterpolateTerrain vtkProbeFilter Interpolate terrain. IntersectionPolyDataFilter Compute the intersection of two vtkPolyData objects. IterateOverLines Iterate through the lines of a PolyData. KMeansClustering KMeans Clustering KochanekSpline Create an Kochanek spline on a set of points. KochanekSplineDemo Interactively change the parameters of the Kochanek spline. LinearExtrusion Extrude a shape. LoopBooleanPolyDataFilter Perform boolean operations on two vtkPolyData objects. MaskPoints Select a subset (mask) of a point set. MergePoints Remove duplicate (merge) points. MergeSelections Merge selected points. MiscCellData Add Miscellaneous Data to Cells in a Polydata. MiscPointData Add Miscellaneous Data to Points in a Polydata. MultiBlockMergeFilter Combine MultiBlockDataSets. NullPoint Set everything in PointData at a specified index to NULL Outline Draw the bounding box of the data PKMeansClustering Parallel KMeans Clustering. ParametricSpline Create a Cardinal spline on a set of points. PerlinNoise PointCellIds Generate point and cell id arrays. PointInsideObject Check if a point is inside an object. PointInsideObject2 This uses a Delaunay triangulation to compute a volume. This gives more of an \"is inside convex hull\" effect than an \"is inside object\". PointsProjectedHull Convex hull of points projected onto the coordinate planes. PolyDataCellNormals Add/Get Normals to/from cells in a Polydata. PolyDataContourToImageData Generate a binarized image from a closed contour. PolyDataExtractNormals Extract Normals from a Polydata. PolyDataGetPoint Get point locations/coordinates from a vtkPolyData. PolyDataIsoLines Iso lines on the surface of a polydata PolyDataPointNormals Add/Get Normals to/from points in a Polydata. PolyDataPointSampler Sample the edges or surfaces of a polydata. PolyDataToImageData Generate a binarized volume from a closed surface. ProcrustesAlignmentFilter Align point sets. ProgrammableFilter Create a custom filter without subclassing. ProgrammableSource Create points using a programmable source. Generates points for a strange attractor. ProjectSphere Unroll a sphere or spherical-like model. QuantizePolyDataPoints Snap (quantize) points to a grid. Reflection Mirror a DataSet. RemoveOutsideSurface Remove the outer surface of a multiple surface polydata. RemoveVertices ResampleAppendedPolyData Resample a flat terrain containing multiple objects. ResamplePolyLine ReverseSense Flip normals. RibbonFilter RotationAroundLine Rotation around a line. RuledSurfaceFilter Create a surface between lines. SCurveSpline Create an SCurve spline on a set of points. SelectVisiblePoints Select visible points. SelectionSource Specify a selection. ShrinkPolyData Move all items in a PolyData towards their centroid. Silhouette Spring Rotation in combination with linear displacement and radius variation. Stripper Convert triangles to triangle strips. ThinPlateSplineTransform ThresholdCells Thresholding Cells. ThresholdPoints Thresholding Points. TransformFilter Transform a data set. TransformOrderDemo Demonstrate how the order of applying transforms affects the result. TransformPipeline Combining the transformation, in order to manipulate a group of vtkActor. Shown in the example robot arm motion. TransformPolyData Apply a Transformation to a PolyData. TriangleArea Compute the area of all triangles in a polydata. TriangleColoredPoints Set the color of each point of a triangle. You will be able to interpolate the colors across the triangle. TriangleSolidColor Create a solid colored triangle. TubeFilter Give lines a thickness (produce a cylinder around lines. VectorFieldNonZeroExtraction Extract non-zero vectors from a vtkImageData. VertexConnectivity Get a list of vertices attached (through an edge) to a vertex. WarpScalar Move vertices along normals. WarpSurface Warp a surface along its normal. WarpTo Bend an object. WarpVector"},{"location":"Cxx/#data-types","title":"Data Types","text":"Example Name Description Image CompositePolyDataMapper Generate2DAMRDataSetWithPulse Generates sample 2-D AMR dataset. Generate3DAMRDataSetWithPulse Generates sample 3-D AMR dataset. MultiBlockDataSet Demonstrates how to make and use VTK's MultiBlock type data OverlappingAMR Demonstrates how to create and populate a VTK's Overlapping AMR Grid type Data"},{"location":"Cxx/#data-type-conversions","title":"Data Type Conversions","text":"Example Name Description Image PolyDataToUnstructuredGrid Convert a vtkPolyData to a vtkUnstructuredGrid."},{"location":"Cxx/#point-cloud-operations","title":"Point Cloud Operations","text":"Example Name Description Image ColorIsosurface Color an isosurface with a data array. CompareExtractSurface Compare three extract surface algorithms. DensifyPoints Add points to a point cloud. DownsamplePointCloud Down sample a point cloud. Remove points so that there are no points within a tolerance of any point. ExtractClusters From a set of randomly distributed spheres, extract connected clusters. ExtractEnclosedPoints Extract points inside a vtkPolyData surface. ExtractPointsDemo Extract points inside an implicit function. ExtractSurface Create a surface from Unorganized Points using Point filters. ExtractSurfaceDemo Create a surface from Unorganized Points using Point filters (DEMO). FitImplicitFunction Extract points within a distance to an implicit function. MaskPointsFilter Extract points within an image mask. NormalEstimation Estimate the normals of a random points that lie on a sphere. PointOccupancy Show which voxels contain points. PointSource Generate a random point cloud. PoissonExtractSurface Create a surface from Unorganized Points using the PoissonReconstruction algorithm. PowercrustExtractSurface Create a surface from Unorganized Points using the Powercrust algorithm. RadiusOutlierRemoval Remove outliers. SignedDistance Compute signed distance to a point cloud. UnsignedDistance Compute unsigned distance to a point cloud."},{"location":"Cxx/#working-with-meshes","title":"Working with Meshes","text":"Example Name Description Image AddCell Add a cell to an existing mesh. BoundaryEdges Find the edges that are used by only one face. CellEdges Get edges of cells. ClosedSurface Check if a surface is closed. ColorDisconnectedRegions Color each disconnected region of a vtkPolyData a different color. ColorDisconnectedRegionsDemo Color each disconnected region of a vtkPolyData a different color for any vtkPolyData. ColoredElevationMap Color a mesh by height. Curvatures Compute Gaussian and Mean Curvatures. Decimation Reduce the number of triangles in a mesh. DeformPointSet Deform a point set with a control polyhedra. DelaunayMesh Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes. DijkstraGraphGeodesicPath Find the shortest path between two points on a mesh. ElevationFilter Color a mesh by height. ExtractEdges FillHoles Close holes in a mesh. FitToHeightMap Drape a polydata over an elevation map. GreedyTerrainDecimation Create a mesh from an ImageData HighlightBadCells IdentifyHoles Close holes in a mesh and identify the holes. ImplicitSelectionLoop Select a region of a mesh with an implicit function. InterpolateFieldDataDemo Resample a fine grid and interpolate field data. LargestRegion Extract the largest connected region in a polydata. MatrixMathFilter Compute various quantities on cell and points in a mesh. MeshQuality OBBDicer Breakup a mesh into pieces. PointInterpolator Plot a scalar field of points onto a PolyData surface. PolygonalSurfaceContourLineInterpolator Interactively find the shortest path between two points on a mesh. QuadricClustering Reduce the number of triangles in a mesh. QuadricDecimation Reduce the number of triangles in a mesh. SelectPolyData Select a region of a mesh. SimpleElevationFilter Color a mesh by dotting a vector from the origin to each point with a specified vector. SmoothPolyDataFilter Laplacian smoothing. SpecifiedRegion Extract a specific (specified) connected region in a polydata. SplitPolyData Breakup a mesh into pieces and save the pieces into files Subdivision Increase the number of triangles in a mesh. SubdivisionDemo Subdivision of any vtkPolyData Triangulate Convert all polygons in a mesh to triangles. WeightedTransformFilter WindowedSincPolyDataFilter Smooth a mesh (windowed sinc filter)."},{"location":"Cxx/#clipping","title":"Clipping","text":"Example Name Description Image BoxClipStructuredPoints Clip vtkStructuredPoints with a box. The results are unstructured grids with tetrahedra. BoxClipUnstructuredGrid Clip a vtkUnstructuredGrid with a box. The results are unstructured grids with tetrahedra. CapClip Cap a clipped polydata with a polygon. ClipClosedSurface Clip a surface with multiple planes. ClipDataSetWithPolyData Clip a vtkRectilinearGrid with arbitrary polydata. In this example, use a vtkConeSource to generate polydata to slice the grid, resulting in an unstructured grid. Contrast this with the next example. ClipFrustum Clip a vtkPolyData with the vtkCamera's view frustum. GenericClip ImplicitDataSetClipping Clip using an implicit data set. SolidClip Create a \"solid\" clip. The \"ghost\" of the part clipped away is also shown. TableBasedClipDataSetWithPolyData Clip a vtkRectilinearGrid with arbitrary polydata. In this example, use a vtkConeSource to generate polydata to slice the grid, resulting in an unstructured grid. Contrast this with the previous example. TableBasedClipDataSetWithPolyData2 Clip a vtkRectilinearGrid with a checkerboard pattern."},{"location":"Cxx/#working-with-structured-3d-data","title":"Working with Structured 3D Data","text":"

This section includes vtkImageData vtkStructuredGrid and vtkRectilinearGrid.

\"ImageData\" is not the traditional \"flat, 2D image\" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Here is an overview of these data structures. Image data can represent at typical 2D image, but also, a 3D volume.

  • Demonstration of structured data types
  • Get the linear point id of a point in a grid
"},{"location":"Cxx/#vtkimagedata","title":"vtkImageData","text":"Example Name Description Image CellIdFromGridCoordinates Get the id of a cell from its grid coordinates. ClipVolume Clip a volumeand produce a vtkUnhstructuredGrid. ExtractVOI Extract a volume of interest (subvolume). GetCellCenter Get the coordinates of the center of a cell. ImageIterator ImageIteratorDemo Demonstrate using an iterator to access pixels in a region. ImageNormalize Normalize an image. ImageReslice Resize a vtkImageData. ImageTranslateExtent Change the extent of a vtkImageData. ImageWeightedSum Add two or more images. IntersectLine Intersect a line with all cells of a vtkImageData. IterateImageData Iterating over a vtkImageData."},{"location":"Cxx/#conversions","title":"Conversions","text":"Example Name Description Image ImageDataGeometryFilter Convert a vtkImageData to a vtkPolyData ImageDataToPointSet Convert a vtkImageData to a vtkStructuredGrid."},{"location":"Cxx/#vtkexplicitstructuredgrid","title":"vtkExplicitStructuredGrid","text":"Example Name Description Image CreateESGrid Create an explicit structured grid and convert this to an unstructured grid or vice versa. LoadESGrid Load a VTU file and convert the dataset to an explicit structured grid."},{"location":"Cxx/#vtkstructuredgrid","title":"vtkStructuredGrid","text":"Example Name Description Image BlankPoint Blank a point of a vtkStructuredGrid. GetLinearPointId Get the linear point id of a point in a grid. SGrid Creating a structured grid dataset of a semi-cylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction. StructuredGrid Reads and writes points into a structured grid. The grid is also colored by point data and how to iterate through the structured grid is demonstrated. StructuredGridOutline Visualize the outline of a structured grid. VisualizeStructuredGrid Visualize the points of a structured grid. VisualizeStructuredGridCells Visualize the cells of a structured grid."},{"location":"Cxx/#vtkstructuredpoints","title":"vtkStructuredPoints","text":"Example Name Description Image StructuredPointsToUnstructuredGrid Convert a vtkStructuredPoints to a vtkUnstructuredGrid. Vol Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26 x 26 x 26."},{"location":"Cxx/#vtkrectilineargrid","title":"vtkRectilinearGrid","text":"Example Name Description Image RGrid Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray. RectilinearGrid Create a rectilinear grid. RectilinearGridToTetrahedra Convert a vtkRectilinearGrid to a vtkUnstructuredGrid mesh. VisualizeRectilinearGrid Visualize the cells of a rectilinear grid."},{"location":"Cxx/#working-with-unstructured-3d-data","title":"Working with Unstructured 3D Data","text":"

This section includes vtkUnstructuredGrid.

"},{"location":"Cxx/#vtkunstructuredgrid","title":"vtkUnstructuredGrid","text":"Example Name Description Image ClipUnstructuredGridWithPlane Clip a UGrid with a plane. ClipUnstructuredGridWithPlane2 Clip a UGrid with a plane. UGrid Creation of an unstructured grid."},{"location":"Cxx/#registration","title":"Registration","text":"Example Name Description Image IterativeClosestPointsTransform Iterative Closest Points (ICP) Transform. LandmarkTransform Landmark Transform."},{"location":"Cxx/#medical","title":"Medical","text":"Example Name Description Image GenerateCubesFromLabels Create cubes from labeled volume data. GenerateModelsFromLabels Create models from labeled volume data. MedicalDemo1 Create a skin surface from volume data. MedicalDemo2 Create a skin and bone surface from volume data. MedicalDemo3 Create skin, bone and slices from volume data. MedicalDemo4 Create a volume rendering. TissueLens Cut a volume with a sphere."},{"location":"Cxx/#surface-reconstruction","title":"Surface reconstruction","text":"Example Name Description Image Delaunay3D Create a solid mesh from Unorganized Points. Delaunay3DDemo Interactively adjust Alpha for Delaunay3D. ExtractSurface Create a surface from Unorganized Points using Point filters. ExtractSurfaceDemo Create a surface from Unorganized Points using Point filters (DEMO). GaussianSplat Create a surface from Unorganized Points (Gaussian Splat). SurfaceFromUnorganizedPoints Create a surface from Unorganized Points. SurfaceFromUnorganizedPointsWithPostProc Create a surface from Unorganized Points (with post processing). TriangulateTerrainMap Generate heights (z values) on a 10x10 grid (a terrain map) and then triangulate the points to form a surface."},{"location":"Cxx/#utilities","title":"Utilities","text":"Example Name Description Image BoundingBox Bounding Box construction. BoundingBoxIntersection Box intersection and Inside tests. Box Intersect a box with a ray. BrownianPoints Produce a random vector at each point in a dataset. CardinalSpline Cardinal spline Interpolation. Casting Casting VTK objects. CheckVTKVersion Check VTK Version and provide alternatives for different VTK versions ColorLookupTable Color Lookup Table. ColorMapToLUT Use vtkDiscretizableColorTransferFunction to generate a VTK colormap. ColorTransferFunction Color Transfer Function. CommandSubclass Instead of using a callback function, it is more powerful to subclass vtkCommand. ConstrainedDelaunay2D Perform a 2D Delaunay triangulation on a point set respecting a specified boundary. Coordinate Coordinate system conversions. DeepCopy Deep copy a VTK object. Delaunay2D Perform a 2D Delaunay triangulation on a point set. DetermineActorType Determine the type of an actor. DiscretizableColorTransferFunction Discretizable Color Transfer Function. ExtractFaces Extract faces froam vtkUnstructuredGrid. FileOutputWindow Write errors to a log file instead of the screen. FilenameFunctions Do things like get the file extension, strip the file extension, etc. FilterSelfProgress Monitor a filters progress. ForLoop Demonstrating various ways of implementing a for loop in VTK. FrameRate Get the frame rate of the rendering. FullScreen Maximize/full screen a vtkRenderWindow. FunctionParser String function parser. GetClassName Determine the type of a VTK variable. GetDataRoot Find the path of VTK_DATA_ROOT. LUTUtilities A utility class for vtkLookupTable allowing you to output the table contents or to compare tables. MassProperties Compute volume and surface area of a closed, triangulated mesh. MultipleRenderWindows Multiple Render Windows. MultipleViewports Multiple Viewports. OffScreenRendering Off Screen Rendering. PCADemo Project 2D points onto the best 1D subspace (PCA Demo). PCAStatistics Compute Principal Component Analysis (PCA) values. PassThrough Pass input along to outpu. PiecewiseFunction Interpolation using a piecewise function. PointInPolygon Point inside polygon test. RenderScalarToFloatBuffer Demonstrates how to render scalars in a vtkPolyData object into a vtkFloatArray buffer for further processing. RescaleReverseLUT Demonstrate how to adjust a colormap so that the colormap scalar range matches the scalar range on the object. You can optionally reverse the colors. ResetCameraOrientation Reset camera orientation to a previously saved orientation. ReportRenderWindowCapabilities Report the capabilities of a render window. SaveSceneToFieldData Save a vtkCamera's state in a vtkDataSet's vtkFieldData and restore it. SaveSceneToFile Save a vtkCamera's state in a file and restore it. Screenshot ShallowCopy Shallow copy a VTK object. ShareCamera Share a camera between multiple renderers. ShepardMethod Shepard method interpolation. SideBySideViewports Side by side viewports. TimeStamp Time stamp. Timer TimerLog Timer log. Variant Convert between data types. Vector Mathematical vector class. ViewportBorders Draw a border around each viewport. VisualDebugging Update the screen from inside an algorithm. ZBuffer zbuffer."},{"location":"Cxx/#arrays","title":"Arrays","text":"Example Name Description Image 2DArray 2D Array. 3DArray 3D Array. ArrayCalculator Perform in-place operations on arrays. ArrayLookup Find the location of a value in a vtkDataArray. ArrayRange Get the bounds (min,max) of a vtk array. ArrayToTable Convert a vtkDenseArray to a vtkTable. ArrayWriter Write a DenseArray or SparseArray to a file. ConstructTable A table is a 2D array of any type of elements. They do not all have to be the same type. This is achieved using vtkVariant. CustomDenseArray Custom type Dense (2D) Array. DenseArrayRange Get the bounds of a vtkDenseArray. ExtractArrayComponent Extract a component of an array. KnownLengthArray Known Length Array. SortDataArray Reorder array values based on an ordering (key) array. SparseArray Sparse Array. UnknownLengthArray Unknown Length Array. VectorArrayKnownLength Array of Vectors (Known Length). VectorArrayUnknownLength Array of Vectors (Unknown Length)."},{"location":"Cxx/#events","title":"Events","text":"Example Name Description Image CameraModifiedEvent Catch the camera modified event. ObserveError Catch errors and warnings. WindowModifiedEvent Catch the window modified event."},{"location":"Cxx/#cmake-techniques","title":"CMake Techniques","text":"Example Name Description Image Check if a specific module is present"},{"location":"Cxx/#math-operations","title":"Math Operations","text":"Example Name Description Image 1DTupleInterpolation A simple example demonstrating how functions defined by sparsely distributed supporting points can be interpolated at arbitrary positions. EigenSymmetric Compute eigenvalues and eigenvectors of a symmetric matrix. HomogeneousLeastSquares Homogeneous Least Squares. LUFactorization LU Factorization. LeastSquares Least Squares. MatrixInverse Matrix inverse. MatrixTranspose Matrix transpose. NormalizeVector Normalize a vector. PerpendicularVector Get a vector perpendicular to another vector. VectorDot VectorNorm Get the lengths of an array of vectors."},{"location":"Cxx/#graphs","title":"Graphs","text":"Example Name Description Image AdjacencyMatrixToEdgeTable Convert an adjacency matrix to an edge table. AdjacentVertexIterator Get all vertices connected to a specified vertex. BoostBreadthFirstSearchTree Breadth first search tree. Can also be used to convert a graph to a tree. BreadthFirstDistance Distance from origin. ColorEdges Color edges. ColorVertexLabels Set the color of vertex labels. ColorVerticesLookupTable Color vertices. ConnectedComponents Find connected components of a graph. ConstructGraph Construct a graph. ConstructTree Construct a tree. CreateTree Create a tree and label the vertices and edges. DepthFirstSearchAnimation Depth First Search Animation. DepthFirstSearchIterator Depth First Search iterator. EdgeListIterator Iterate over edges of a graph. EdgeWeights Edge weights. GraphPoints Manually set coordinates of vertices in a graph. GraphToPolyData Convert a graph to a PolyData. InEdgeIterator Iterate over edges incoming to a vertex. LabelVerticesAndEdges Label vertices and edges. MinimumSpanningTree Minimum spanning tree of a graph. MutableGraphHelper Create either a vtkMutableDirectedGraph or vtkMutableUndirectedGraph. NOVCAGraph Create a graph & visualize it in ParaView/VisIt. OutEdgeIterator Iterate over edges outgoing from a vertex. RandomGraphSource Create a random graph. RemoveIsolatedVertices Remove vertices of degree 0 from a vtkGraph. ScaleVertices Size/scale vertices based on a data array. SelectedVerticesAndEdges Get a list of selected vertices and edges. SelectedVerticesAndEdgesObserver Get a list of selected vertices and edges using an observer of AnnotationChangedEvent. ShortestPath Find the shortest path on a graph. SideBySideGraphs Display two graphs side by side. TreeBFSIterator Breadth First Search iterator. VertexSize Set the size of vertices. VisualizeDirectedGraph Visualize a directed graph. VisualizeGraph Visualize a graph."},{"location":"Cxx/#graph-conversions","title":"Graph Conversions","text":"Example Name Description Image DirectedGraphToMutableDirectedGraph vtkDirectedGraph to vtkMutableDirectedGraph. MutableDirectedGraphToDirectedGraph vtkMutableDirectedGraph to vtkDirectedGraph. TreeToMutableDirectedGraph vtkTree to vtkMutableDirectedGraph"},{"location":"Cxx/#data-structures","title":"Data Structures","text":"Example Name Description Image AttachAttributes Attach attributes to a VTK array CellLocator Project a point onto a mesh. Closest point on a mesh.Efficient 3D cell query. CellLocatorVisualization Visualization of the tree of a vtkCellLocator. CellTreeLocator Points inside an object using vtkCellTreeLocator. PointLocator Efficient 3D point query. PointLocatorRadius Find all points within a radius of a specified point. PointLocatorVisualization Visualization of the tree of a vtkPointLocator."},{"location":"Cxx/#timing-demonstrations","title":"Timing Demonstrations","text":"Example Name Description Image KDTreeTimingDemo Plot the runtime vs MaxLevel (doesn't seem correct) ModifiedBSPTreeTimingDemo Plot the runtime vs MaxLevel OBBTreeTimingDemo Plot the runtime vs MaxLevel OctreeTimingDemo Plot the runtime vs MaxPointsPerRegionOctree timing demo."},{"location":"Cxx/#kd-tree","title":"KD-Tree","text":"Example Name Description Image BuildLocatorFromKClosestPoints ClosestNPoints Find the closest N points to a query point. DataStructureComparison Illustrates, side by side, the differences between several spatial data structures KDTreeAccessPoints Access the points of a KDTree. KDTreeFindPointsWithinRadius Find points within a specified radius of a query point. KDTreeFindPointsWithinRadiusDemo Find points within a range of radii. KdTree KdTreePointLocatorClosestPoint Find the closest point to a query point. OctreeFindPointsWithinRadiusDemo Find points within a range of radii. PointLocatorFindPointsWithinRadiusDemo Find points within a range of radii. StaticLocatorFindPointsWithinRadiusDemo Find points within a range of radii. VisualizeKDTree Visualize levels of the tree."},{"location":"Cxx/#oriented-bounding-box-obb-tree","title":"Oriented Bounding Box (OBB) Tree","text":"Example Name Description Image OBBTreeExtractCells Intersect a line with an OBB Tree and display all intersected cells. OBBTreeIntersectWithLine Intersect a line with a vtkOBBTree. VisualizeOBBTree Visualize levels of the tree."},{"location":"Cxx/#octree","title":"Octree","text":"Example Name Description Image BuildOctree Create an octree. IncrementalOctreePointLocator Insert points into an octree without rebuilding it. OctreeClosestPoint Find the closest point to a query point. OctreeFindPointsWithinRadius Find the points within a sphere of specified radius to a query point. OctreeKClosestPoints Find the K closest points to a query point. OctreeVisualize Visualize levels of the tree."},{"location":"Cxx/#modified-bsp-tree","title":"Modified BSP Tree","text":"Example Name Description Image ModifiedBSPTreeExtractCells Intersect a line with a modified BSP Tree and display all intersected cells. ModifiedBSPTreeIntersectWithLine Intersect a line with a modified BSP Tree. VisualizeModifiedBSPTree Visualize levels of the tree."},{"location":"Cxx/#hypertreegrid","title":"HyperTreeGrid","text":"Example Name Description Image HyperTreeGridSource Create a vtkHyperTreeGrid."},{"location":"Cxx/#vtk-concepts","title":"VTK Concepts","text":"Example Name Description Image Scalars Attach a scalar value to each point (PointData) or cell (CellData) in a data set."},{"location":"Cxx/#rendering","title":"Rendering","text":"Example Name Description Image AmbientSpheres Demonstrates the effect of ambient lighting on spheres. CameraBlur Example of a scene rendered with focal depth. ColoredSphere A simple sphere. Cone3 Four frames of output, based on the VTK example Cone3.cxx. Cone4 Modifying properties and transformation matrix based on the VTK example Cone4.cxx. DiffuseSpheres Demonstrates the effect of diffuse lighting on spheres. FlatVersusGouraud Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look. GradientBackground Demonstrates the background shading options. HiddenLineRemoval Hidden lines removed. LayeredActors Demonstrates the use of two linked renderers. The orientation of objects in the non active layer is linked to those in the active layer. Mace An example of multiple inputs and outputs. Model Illustrative diagram of graphics objects. MotionBlur Example of motion blur. OutlineGlowPass Demonstrates how to render a object in a scene with a glowing outline. PBR_Anisotropy Render spheres with different anisotropy values. PBR_Clear_Coat Render a cube with custom texture mapping and a coat normal texture. PBR_Edge_Tint Render spheres with different edge colors using a skybox as image based lighting. PBR_HDR_Environment Renders spheres with different materials using a skybox as image based lighting. PBR_Mapping Render a cube with custom texture mapping. PBR_Materials Renders spheres with different materials using a skybox as image based lighting. PBR_Materials_Coat Render spheres with different coat materials using a skybox as image based lighting. PBR_Skybox Demonstrates physically based rendering, a skybox and image based lighting. PBR_Skybox_Texturing Demonstrates physically based rendering, a skybox, image based lighting and texturing. PBR_Skybox_Anisotropy Demonstrates physically based rendering, a skybox, image based lighting, and anisotropic texturing. Rainbow Use and manipulation of vtkLookupTables. Rotations Rotations of a cow about her axes. RotationsA Perform six rotations of a cow about her x-axis (Figure 3-31a). RotationsB Perform six rotations of a cow about her y-axis (Figure 3-31b). RotationsC Perform six rotations of a cow about her z-axis (Figure 3-31c). RotationsD First a rotation of a cow about her x-axis, then six rotations about her y-axis (Figure 3-31d). Shadows Draw model with shadows. SpecularSpheres Demonstrates the effect of specular lighting on spheres. StippledLine Draw a stippled line. StringToImageDemo Demonstrates how to generate images from strings. StripFran Triangle strip examples. (a) Structured triangle mesh consisting of 134 strips each of 390 triangles. (b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip. TransformSphere The addition of a transform filter to ColoredSphere. TransparentBackground Demonstrates the use of two renderers. Notice that the second (and subsequent) renderers will have a transparent background. WalkCow This generates Figs. 3-32, 3-33 found in VTKTextbook.pdf. WalkCowA This generates Fig. 3-33a found in VTKTextbook.pdf. WalkCowB This generates Fig. 3-33b found in VTKTextbook.pdf."},{"location":"Cxx/#lighting","title":"Lighting","text":"Example Name Description Image Light Add a directional light to a scene. LightActor Display the location and direction of a light. ShadowsLightsDemo Show lights casting shadows. SpotLights Create two positional(spot) lights."},{"location":"Cxx/#shaders","title":"Shaders","text":"Example Name Description Image BozoShader Modify the shader to load and use noise functions for color selection. BozoShaderDemo Show the bozo shader on a variety of polydata models. ColorByNormal Modify the shader to color based on model normal. CubeMap Modify the Vertex and Frament shaders to apply a 6-sided cube map. MarbleShader Modify the shader to load and use noise functions for color selection. MarbleShaderDemo Explore parameter space with sliders. SpatterShader Modify the shader to load and use noise functions for color selection. SphereMap Modify the Vertex and Frament shaders to apply a spherical map."},{"location":"Cxx/#annotation","title":"Annotation","text":"Example Name Description Image MultiLineText Display multiline text. TextOrigin The 3D text always faces the active camera. XYPlot Display line probes."},{"location":"Cxx/#texture-mapping","title":"Texture Mapping","text":"Example Name Description Image AnimateVectors One frame from a vector field animation using texture maps (animVectors.tcl). BackgroundTexture Use a texture for the background of a vtkRenderer. ClipArt Generate 3D clip art from an image. ProjectedTexture Project a texture onto ovtkPolyData. TextureCutQuadric Cut a quadric with boolean textures. TextureCutSphere Cut a sphere using texture coordinates. TextureMapImageData Texture map an ImageData. TextureMapPlane Texture map a plane. TextureMapQuad Texture map a quad. TexturePlane Example of texture mapping. TextureThreshold Demonstrate the use of scalar thresholds to show values of flow density on three planes. TexturedSphere Texture a sphere."},{"location":"Cxx/#tutorial","title":"Tutorial","text":"

If you are new to VTK then these tutorials will help to get you started.

Tutorial Description Image Step 1 Create a cone, render it and rotate it through 360\u00b0. Step 2 Adding an observer. Step 3 Using multiple renderers within a render window. Step 4 The creation of multiple actors and the manipulation of their properties and transformations. Step 5 Introducing the concept of interaction. Step 6 Using a 3D widget."},{"location":"Cxx/#visualization","title":"Visualization","text":"

See this tutorial for a brief explanation of the VTK terminology of mappers, actors, etc.

Example Name Description Image AlphaFrequency Linearly extrude fonts to show letter frequencies in text. AnatomicalOrientation Show a labelled set of anatomical planes transecting a human figure. AnnotatedCubeActor Annotated cube. Arbitrary3DCursor Track a 3D cursor. AssignCellColorsFromLUT Demonstrates how to assign colors to cells in a vtkPolyData structure using lookup tables. AxisActor Generate a single axis. BackfaceCulling Backface culling. BackgroundColor Background color. BackgroundGradient Background gradient. BillboardTextActor3D Label points with billboards. BlobbyLogo Blobby logo from VTK textbook. Blow Ten frames from a blow molding finite element analysis. BluntStreamlines Demonstrates airflow around a blunt fin using streamlines. Camera Positioning and aiming the camera. CameraActor Visualize a camera (frustum) in a scene. CameraModel1 Illustrate camera movement around the focal point. CameraModel2 Illustrate camera movement centered at the camera position. CaptionActor2D Draw a caption/bubble pointing to a particular point. CarotidFlow Visualizing blood flow in the human carotid arteries. Streamtubes of flow velocity are generated. CarotidFlowGlyphs Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude. ChooseTextColor Choose a text color that contrasts with a background color. ChooseTextColorDemo Create a grid of random colored viewpports and pick a good text color. ClipSphereCylinder A plane clipped with a sphere and an ellipse. The two transforms place each implicit function into the appropriate position. Two outputs are generated by the clipper. CloseWindow Close a render window. CollisionDetection Collison between two spheres. ColorActorEdges Color the edges of an Actor. ColorAnActor Color an Actor. ColorGlyphs Color glyphs. ColorSeriesPatches Creates a HTML file called VTKColorSeriesPatches ColoredAnnotatedCube How to color the individual faces of an annotated cube. CombustorIsosurface Generate an isosurface of constant flow density. ComplexV ComplexV from the VTK Textbook. ContourQuadric Contouring a quadric function. CornerAnnotation Write text in the corners of a window. CorrectlyRenderTranslucentGeometry Correctly Rendering Translucent Geometry. CreateBFont A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles. CreateColorSeriesDemo Create a custom vtkColorSeries. CubeAxesActor Display three orthogonal axes with labels. CubeAxesActor2D This example uses the vtkCubeAxesActor2D to show your scene with axes to indicate the spatial extent of your data. Cursor3D CursorShape Change the shape of the cursor. CurvatureBandsWithGlyphs Demonstrates the coloring of a surface by partitioning the gaussian curvature of a surface into bands and using arrows to display the normals on the surface. CurvedReformation Sample a volume with a curved surface. In medical imaging, this is often called curved multi planar reformation. CutStructuredGrid Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. Cutter How to use vtkCutter by cutting through a cube. DataSetSurface Cutting a hexahedron with a plane. The red line on the surface shows the cut. DecimateFran Examples of decimation algorithm. (a) Decimation of laser digitizer data. DecimateHawaii Examples of decimation algorithm. (b) Decimation of terrain data. DepthSortPolyData Poly Data Depth Sorting. DisplacementPlot Show modal lines for a vibrating beam. DisplayCoordinateAxes Display coordinate axes. DisplayQuadricSurfaces Display Quadric Surfaces. DistanceToCamera DrawText Display Text. EdgePoints Generate points along an edge. ElevationBandsWithGlyphs Demonstrates the coloring of a surface by partitioning the elevation into bands and using arrows to display the normals on the surface. ExponentialCosine Carpet plots. Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values. ExtrudePolyDataAlongLine Extrude a 2D polydata along a line in 3D space. FastSplatter Convolve a splat image with every point in an input image. FindCellIntersections Find the intersection of a line and the cells in an unstructured dataset FireFlow Combine geometry from a VRML file and a solution from a vtkUnstructuredGrid file. FireFlowDemo Combine geometry from a VRML file and a solution from a vtkUnstructuredGrid file (interactive). FlatShading FlyingHeadSlice Flying edges used to generate contour lines. Follower Draw text that stays right side up. FontFile Use an external font. FrogBrain The frog\u2019s brain. Model extracted without smoothing (left) and with smoothing (right). FroggieSurface Construct surfaces from a segmented frog dataset. Up to fifteen different surfaces may be extracted. You can turn on and off surfaces and control the camera position. FroggieView View surfaces of a segmented frog dataset using preprocessed *.vtk tissue files. You can turn on and off surfaces, control their opacity through the use of sliders and control the camera position. FrogSlice Photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow. Glyph2D Glyph3D Glyph3DImage Glyph the points in a vtkImageData. Glyph3DMapper Hanoi Towers of Hanoi. HanoiInitial Towers of Hanoi - Initial configuration. HanoiIntermediate Towers of Hanoi - Intermediate configuration. Hawaii Visualize elevations by coloring the scalar values with a lookup table. HeadBone Marching cubes surface of human bone. HeadSlice Marching squares used to generate contour lines. HedgeHog Create oriented lines (hedgehogs) from vector data. HideActor visible HideAllActors Hide all actors. HyperStreamline Example of hyperstreamlines, the four hyperstreamlines shown are integrated along the minor principle stress axis. A plane (colored with a different lookup table) is also shown. IronIsoSurface Marching cubes surface of iron-protein. IsosurfaceSampling Demonstrates how to create point data on an isosurface. Kitchen Demonstrates stream tracing in a kitchen. KochSnowflake Use recursion to represent a Koch snowflake fractal. LODProp3D Level of detail rendering. LOx Streamtubes created by using the computational grid just in front of the post as a source for seeds. LOxGrid Portion of computational grid for the LOx post. LOxSeeds Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown. LabelContours Label Contours. LabelPlacementMapper Display a non-overlapping text label at each point. LabeledDataMapper Display the point ID at each point. LabeledMesh Label Mesh. Legend LegendScaleActor Display the scale of a scene. LineWidth Change the width/thickness of lines in an actor. LoopShrink A network with a loop. VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK. Morph3D Interpolate between datasets. Motor Texture cut used to reveal internal structure of a motor. Two cut planes are used in combination with transparent texture. MovableAxes Movable axes. MoveActor Moving an Actor. MoveCamera Moving the Camera. MultipleActors Multiple Actors. NamedColorPatches Creates a HTML file called VTKNamedColorPatches NamedColors Demonstrate the use of the vtkNamedColors class. NoShading NormalsDemo Demo different options to generate normals. Office Using random point seeds to create streamlines. OfficeA Corresponds to Fig 9-47(a) in the VTK textbook. OfficeTube The stream polygon. Sweeping a polygon to form a tube. Opacity Transparency, transparent. OrientedGlyphs Create oriented glyphs from vector data. PineRootConnectivity Applying the connectivity filter to remove noisy isosurfaces. PineRootConnectivityA The isosurface, with no connectivity filter applied. PineRootDecimation Applying the decimation and connectivity filters to remove noisy isosurfaces and reduce data size. PlateVibration Demonstrates the motion of a vibrating beam. PointDataSubdivision Demonstrates the effect of applying these filters on various sources. PointSize ProbeCombustor Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. ProgrammableGlyphFilter Generate a custom glyph at each point. ProteinRibbons Display pdb ribbons. PseudoVolumeRendering Here we use 100 cut planes, each with an opacity of 0.05. They are then rendered back-to-front to simulate volume rendering. QuadraticSurface Display a quadratic surface. QuadricLODActor Level of detail adjustment. QuadricVisualization Visualizing a quadric function. RandomProbe Demonstrates how to probe a dataset with random points and select points inside the data set. RenderLargeImage Render a large image, larger than a window. RenderView A little bit easier rendering. ReverseAccess Demonstrates how to access the source (e.g. vtkSphereSource) of an actor reversely. RotateActor Rotate an Actor. ScalarBarActor Display a color bar. ScalarBarActorColorSeries Display a color bar with a color series lookup table. ScalarVisibility Switch between coloring the actor and coloring the data. ScaleGlyphs Scale glyphs. SceneBounds Get the bounds of the whole scene. SelectWindowRegion Select a region of a window. SingleSplat Elliptical splatting. (a) Single elliptical splat with eccentricity E=10. Cone shows orientation of vector. SpikeFran Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected. SplatFace Elliptical splatting. (b) Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction. Points regularly subsampled and overlaid on original mesh. Stocks Two views from the stock visualization script. The top shows closing price over time; the bottom shows volume over time. StreamLines Seed streamlines with vectors from a structured grid. StreamlinesWithLineWidget Using the vtkLineWidget to produce streamlines in the combustor dataset. The StartInteractionEvent turns the visibility of the streamlines on; the InteractionEvent causes the streamlines to regenerate themselves. StructuredDataTypes Demonstration of structured data types. TensorAxes Display the scaled and oriented principal axes of the stress tensor. TensorEllipsoids Display the scaled and oriented principal axes as tensor ellipsoids representing the stress tensor. TensorGlyph Draw a rotated/scaled glyph at each point. TextSource Display text. TransformActor Transform an Actor. TransformActorCollection Transform an actor collection. TubesFromSplines Create tubes from interpolated points and scalars. TubesWithVaryingRadiusAndColors Create tubes with varying radius and colors. VectorField VectorOfActors Multiple Actors in a Vector. VectorText Display high resolution text. VelocityProfile Warping the geometry of three planes to show flow momentum. VertexGlyphFilter Add a vertex to each point. Visualize2DPoints Visualize a 2D Set of Points. VisualizeImageData Visualize the points of an ImageData. VisualizeVTP Visualize a VTP File. VoxelsOnBoundary Extract voxels on the border of an isosurface. WarpCombustor Carpet plots of combustor flow energy in a structured grid. Colors and plane displacement represent energy values. WindowSize Change the size of a window. WindowTitle Change the title of a window. Wireframe"},{"location":"Cxx/#volume-rendering","title":"Volume Rendering","text":"Example Name Description Image FixedPointVolumeRayCastMapperCT Volume render DICOM or Meta volumes with various vtkColorTransferFunction's. HAVS IntermixedUnstructuredGrid mix of poly data and unstructured grid volume mapper. MinIntensityRendering Min intensity rendering. RayCastIsosurface Isosufaces produced by volume rendering. SimpleRayCast Volume rendering of a high potential iron protein. SmartVolumeMapper Smart volume mapper."},{"location":"Cxx/#user-interaction","title":"User Interaction","text":"Example Name Description Image AreaPicking Area Picking. Assembly Combine/group actors into an assembly. CallBack Setting up a callback with client data. Two different methods are demonstrated. CallData Pass an observer a value (via CallData). CellPicking Cell Picking. ClientData Give an observer access to an object (via ClientData). DoubleClick Catch a double click. EllipticalButton Create an elliptical button. Game Move a cube into a sphere. HighlightPickedActor Highlight a picked actor by changing its color. HighlightSelectedPoints Highlight Selected Points. HighlightSelection Highlight selection. HighlightWithSilhouette Highlight a picked actor by adding a silhouette. ImageClip Demonstrates how to interactively select and display a region of an image. ImageRegion Select a region of an image. InteractorStyleTerrain Terrain mode. InteractorStyleUser Create a completely custom interactor style (no default functionality is provided) KeypressEvents Handle keypress events. KeypressObserver This uses a callback function rather than a derived interactor class. Handle keypress events (lightweight). MouseEvents Subclass the interactor style. Handle mouse events. MouseEventsObserver Use an observer. Handle mouse events (light weight). MoveAGlyph Drag a glyph around. MoveAVertexUnstructuredGrid Click and drag a vertex of a vtkUnstructuredGrid. ObserverMemberFunction Set observers to be class member functions. PickableOff Disallow interaction with a specific actor. Picking Get the world coordinate of the mouse click (if you clicked an actor) PointPicker Get the coordinates of the closest point in the data set to the mouse click. RubberBand2D RubberBand2DObserver RubberBand2D Observer. RubberBand3D RubberBandPick RubberBandZoom SelectAVertex Click and drag a vertex of a vtkPolyData. SelectAnActor Select an actor. ShiftAndControl Hold/holding down a key. Check if shift or control is being held. StyleSwitch Choose between multiple interaction modes. TrackballActor Trackball actor mode. TrackballCamera Trackball camera mode. UserEvent Simple observer. Create, invoke, and handle a custom event. WorldPointPicker Get world coordinates of mouse click."},{"location":"Cxx/#working-with-images","title":"Working with Images","text":"Example Name Description Image Actor2D 2D actor and mapper. BackgroundImage Display an image as the background of a scene. BorderPixelSize Set the size of border pixels. CannyEdgeDetector Perform Canny edge detection on an image. Cast Cast an image to a different type. DotProduct Compute the pixel-wise dot product of two vector images. DrawOnAnImage Drawing on an image. DrawShapes Drawing shapes in an image. ExtractComponents Extract components of an image. This can be used to get, for example, the red channel of an image. FillWindow Fit imageSetup the camera to fill the window with an image. ImageAccumulateGreyscale Display a grey scale histogram. ImageCheckerboard Visually Compare Two Images. ImageCityBlockDistance Compute the Manhattan distance from every point to every black point in a binary image. ImageDilateErode3D Dilate or erode an image. ImageExport Export an image to a C array. ImageGridSource Create a image of a grid. ImageHistogram Compute the histogram of an image. ImageHybridMedian2D Median filter an image. ImageIdealHighPass High pass filter an image. ImageImport Import an image from a C array. ImageIslandRemoval2D Remove small patches from an image. ImageMagnify Supersample and stretch an image. ImageMandelbrotSource Create a Mandelbrot image. ImageMapper Display an image in 2D. ImageMask Mask a region of an image. ImageMathematics Perform mathematical operations on an image. ImageMedian3D Median filter a 3d or 2d image. ImageMirrorPad Pad the edges of an extended image by mirror existing pixels. ImageNonMaximumSuppression Find peaks in an image using non maximum suppression. ImageOpenClose3D Open or close (morphologically) an image. ImageOrder Determine the display order of a stack of images. ImageOrientation Orientation of the view of an image. ImageRFFT Inverse FFT. ImageRange3D Replace every pixel with the range of its neighbors according to a kernel. ImageRotate Rotate a 2D image. This is even more powerful than vtkImageSliceMapper. It can also do oblique slices. ImageSeparableConvolution Convolve a separable kernel with an image. ImageShiftScale Shift and scale an image. ImageSinusoidSource Create a sinusoidal image. ImageSlice Visualize and interact with an image. This is even more powerful than vtkImageSliceMapper. It can also do oblique slices. ImageSliceMapper Visualize and interact with an image. This is the new way to do this. It is much more powerful. ImageStack Display layers of images. ImageStencil Copy one image into another image. ImageText Draw text in an image. ImageThreshold Threshold an image. ImageToPolyDataFilter Convert a vtkImageData to a vtkPolyData. ImageToStructuredPoints Convert a vtkImageData to a vtkStructuredPoints. ImageTransparency Set transparency of image pixels. InteractWithImage Visualize and interact with an image. Interpolation Set the interpolation type for the display of an image. If pixels look blurry instead of sharp when zoomed in, change this. MarkKeypoints Mark keypoints in an image. NegativeIndices A very powerful feature of vtkImageData is that you can use negative indices. PickPixel Picking a pixel. PickPixel2 Picking a pixel 2 - modified version for exact pixel values. RTAnalyticSource An image source that can be used for regression testing StaticImage This will display the image, but not allow you to interact with it. Transparency Make part of an image transparent."},{"location":"Cxx/#image-processing","title":"Image Processing","text":"Example Name Description Image Attenuation This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. CenterAnImage Center an image. Colored2DImageFusion Blending 2D images with different color maps. CombineImages Combine two images. CombiningRGBChannels Combine layers into an RGB image. EnhanceEdges High-pass filters can extract and enhance edges in an image. Subtraction of the Laplacian (middle) from the original image (left) results in edge enhancement or a sharpening operation (right). Flip Flip an image. GaussianSmooth Low-pass filters can be implemented as convolution with a Gaussian kernel. Gradient Compute the gradient vector at every pixel. HybridMedianComparison Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. IdealHighPass This figure shows two high-pass filters in the frequency domain. The Butterworth high-pass filter has a gradual attenuation that avoids ringing produced by the ideal high-pass filter with an abrupt transition. ImageAccumulate Histogram ImageAnisotropicDiffusion2D Anisotropic diffusion (2D). ImageContinuousDilate3D Dilate an image. ImageContinuousErode3D Erode an image. ImageConvolve Convolve an image with a kernel. ImageCorrelation Correlate two images. ImageDifference Compute the difference image of two images. ImageDivergence Divergence of a vector field. ImageEllipsoidSource Create an image of an ellipsoid. ImageFFT Compute the FFT of an image. ImageGaussianSmooth Smooth an image. ImageGradient Create an imaging pipeline to visualize gradient information. ImageGradientMagnitude Compute the magnitude of the gradient at each pixel of an image. ImageLaplacian Compute the Laplacian of an image. ImageLuminance Convert RGB image to greyscale (luminance). ImageMagnitude grayscaleConvert RGB image to grey scale. ImageMapToColors Use a lookup table to map scalar (gray scale) values to colorsConvert grey scale image to RGB. ImageNoiseSource Create an image of noise. ImagePermute Switch axes of an image. ImageShrink3D Resample an image. ImageSobel2D Sobel edge detection 2D. ImageValueRange Get the range of image pixel values (min/max). ImageVariance3D Construct a new image consisting of the variance of the input image at each pixel. ImageWarp Combine the imaging and visualization pipelines to deform an image in the z-direction. The vtkMergeFilter is used to combine the warped surface with the original color data. IsoSubsample This figure demonstrates aliasing that occurs when a high-frequency signal is subsampled. High frequencies appear as low frequency artifacts. The left image is an isosurface of a skull after subsampling. The right image used a low-pass filter before subsampling to reduce aliasing. MedianComparison Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise. MorphologyComparison This figure demonstrates various binary filters that can alter the shape of segmented regions. Pad Convolution in frequency space treats the image as a periodic function. A large kernel can pick up features from both sides of the image. The lower-left image has been padded with zeros to eliminate wraparound during convolution. On the right, mirror padding has been used to remove artificial edges introduced by borders. RGBToHSI Convert RGB to HSI. RGBToHSV Convert RGB to HSV. RGBToYIQ Convert RGB to YIQ. RescaleAnImage Rescale an image ResizeImage Resize an image using a sinc interpolator. ResizeImageDemo Demonstrate allsinc interpolators to resize an image. VTKSpectrum The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This figure shows an image and its power spectrum displayed using a logarithmic transfer function."},{"location":"Cxx/#widgets","title":"Widgets","text":"Example Name Description Image AffineWidget Apply an affine transformation interactively. AngleWidget AngleWidget2D vtkAngleWidget + vtkAngleRepresentation2D. BalloonWidget BiDimensionalWidget When would you use this? BorderWidget 2D selection, 2D box. BoxWidget BoxWidget2 CameraOrientationWidget Demonstrates a 3D camera orientation widget. CaptionWidget CheckerboardWidget Compare two images using a checkerboard. CompassWidget Draws an interactive compass. ContourWidget Create a contour from a set of points and dynamically change the contour using the points as control points. Cursor2D DistanceWidget HoverWidget How to detect a hover? ImagePlaneWidget ImageTracerWidget Scribble on an image. ImageTracerWidgetInsideContour Highlight pixels inside a non-regular region scribbled on an image. ImageTracerWidgetNonPlanar Draw on a non-planar surface. ImplicitPlaneWidget2 Clip polydata with an implicit plane. LineWidget2 LogoWidget Logo widget. OrientationMarkerWidget Draws two cubes. One of them can be clicked to be rotated, and will rotate the second one. The second one has annotations on it, and can also be moved. OrientationMarkerWidget1 Display a polydata as an orientation icon. PlaneWidget Interact with a plane. PolygonalSurfacePointPlacer Used in conjunction with vtkContourWidget to draw curves on a surface. RectilinearWipeWidget Compare two images. ScalarBarWidget The ScalarBarWidget displays a scalar bar that is movable and changes orientation automatically when close to the borders of the image. It needs a ScalarBarActor SeedWidget Seed widget. SeedWidgetImage How to start the interaction? SeedWidgetWithCustomCallback How to place points in a scene using a custom callback. Slider 3D Slider. Slider2D 2D Slider. SphereWidget Sphere widget. SphereWidget2 SphereWidgetEvents Sphere widget events. SplineWidget TextWidget Draw movable text. TexturedButtonWidget Create a textured 2D button."},{"location":"Cxx/#plotting","title":"Plotting","text":"Example Name Description Image AreaPlot Plot area between two curves. BarChart Bar chart. BoxChart Box plot. ChartMatrix Create a marix of plots. ChartsOn3DScene Draw a chart in a 3D scene. CompareRandomGeneratorsCxx Compare STL random number generators. Diagram Draw a custom diagram. FunctionalBagPlot Functional Bag Plot. Histogram2D 2D Histogram of a vtkImageData. HistogramBarChart Histogram using bar chart. LinePlot Line plot. LinePlot3D Line plot of 3d data. MultiplePlots Display multiple plots by using viewports in a single render window. ParallelCoordinates Parallel coordinates. PieChart Pie chart. PieChartActor Pie chart. ScatterPlot Scatter plot. SpiderPlot Spider plot. StackedBar Stacked bar. StackedPlot Stacked plot. SurfacePlot SurfacePlot."},{"location":"Cxx/#animation","title":"Animation","text":"Example Name Description Image AnimateActors Animate actors. Animation Move a sphere across a scene. AnimationScene Animation (the right way). Zoom in on a sphere. DataAnimation Data Animation. Update points in a dataset every specified interval. DataAnimationSubclass Update points in a dataset every specified interval (using a vtkCommand subclass instead of a callback function. RotatingSphere A rotating sphere."},{"location":"Cxx/#infovis","title":"InfoVis","text":"Example Name Description Image ParallelCoordinatesView Parallel coordinates. TreeMapView Tree map. WordCloud Create a word cloud."},{"location":"Cxx/#qt","title":"Qt","text":"

Click here for a tutorial on how to setup Qt.

Example Name Description Image BarChartQt Bar chart. BorderWidgetQt 2D selection, 2D box. EventQtSlotConnect Connect a VTK event to a Qt slot. ImageDataToQImage Convert a vtkImageData to a QImage. MinimalQtVTKApp A minimal Qt/VTK application. QImageToImageSource Convert a QImage to a vtkImageData. RenderWindowNoUiFile This is a very basic example that shows how to create a Qt window. Typically, one would want to design a form in the QtDesigner (this is shown in RenderWindowUISingleInheritance). RenderWindowUISingleInheritance Using a QVTKOpenGLWidget with the Qt Single Inheritance model. ShareCameraQt Share the camera between QVTKOpenGLWidgets. ShowEvent Use QMainWindow::showEvent event to do things that you might want to do in the constructor SideBySideRenderWindowsQt Side by side render windows."},{"location":"Cxx/#matlab","title":"Matlab","text":"

You must turn on VTK_USE_MATLAB_MEX to use these.

Example Name Description Image MatlabEngineFilter"},{"location":"Cxx/#databases","title":"Databases","text":""},{"location":"Cxx/#sql","title":"SQL","text":"

If you have any trouble or errors with the following examples, please troubleshoot using these instructions.

Example Name Description Image ConnectAndRead Connect to and read a MySQL database. CreateDatabase Create a MySQL database. WriteToDatabase Write to a MySQL database."},{"location":"Cxx/#renderman","title":"RenderMan","text":"

RenderMan is a high quality rendering system created by Pixar. VTK can export RenderMan RIB files for rendering by prman. In the spring of 2015, Pixar released a non-commercial version of its RenderMan products.

Example Name Description Image PolyDataRIB Apply a RenderMan Shader to a PolyData."},{"location":"CxxHowTo/","title":"C++ How To","text":"

Often you just need a \"pointer\" to an example that shows you how to do something.

Here are some snippets and examples that highlight interesting features that may help you:

"},{"location":"CxxHowTo/#callback","title":"Callback","text":"Example Name Comments Image CallBack Setting up a callback with client data. Two different methods are demonstrated."},{"location":"CxxHowTo/#camera","title":"Camera","text":"Example Name Comments Image CameraModel1 Illustrate camera movement around the focal point. CameraModel2 camera movement centered at the camera position. CameraOrientationWidget This 3D camera orientation widget can be used in conjunction with CameraPosition to get a nice camera position. CameraPosition Get the camera position while moving the image. MergeSelections Use the same camera for all renderers. ResetCameraOrientation Reset camera orientation to a previously saved orientation. ShareCamera Use the same camera for all renderers."},{"location":"CxxHowTo/#check-the-vtk-version","title":"Check the VTK Version","text":"Example Name Comments Image CheckVTKVersion-Snippet Check the VTK version returning true if the requested VTK version is >= the current version. CheckVTKVersion-Example Check the VTK version and provide alternatives for different VTK versions."},{"location":"CxxHowTo/#coloring","title":"Coloring","text":"Example Name Comments Image BackgroundGradient Background gradient. KochanekSplineDemo How to color the slider components. MergeSelections A nifty way to get a \"harmonious\" set of window colors, using vtkNamedColors and vtkColorSeries. ShareCamera Store background colors in a vector for later extraction of the red, green and blue components."},{"location":"CxxHowTo/#glyphing","title":"Glyphing","text":"Example Name Comments Image PointToGlyph How to represent points as glyphs. QuantizePolyDataPoints Represent a point by a glyph."},{"location":"CxxHowTo/#image","title":"Image","text":"Example Name Comments Image WriteImage Write out an image of various types."},{"location":"CxxHowTo/#multiple-view-ports-and-render-windows","title":"Multiple view ports and render windows","text":"Example Name Comments Image MultipleRenderWindows Multiple Render Windows. MultipleViewports Multiple Viewports."},{"location":"CxxHowTo/#physically-based-rendering","title":"Physically Based Rendering","text":"

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings.

The results can be quite spectacular, it is hoped that these examples will help you to get started.

Example Name Comments Image PBR_Anisotropy Render spheres with different anisotropy values. PBR_Clear_Coat Render a cube with custom texture mapping and a coat normal texture. PBR_Edge_Tint Render spheres with different edge colors using a skybox as image based lighting. PBR_HDR_Environment Renders spheres with different materials using a skybox as image based lighting. PBR_Mapping Render a cube with custom texture mapping. PBR_Materials Renders spheres with different materials using a skybox as image based lighting. PBR_Materials_Coat Render spheres with different coat materials using a skybox as image based lighting. PBR_Skybox Demonstrates physically based rendering, a skybox and image based lighting. PBR_Skybox_Texturing Demonstrates physically based rendering, a skybox, image based lighting and texturing. PBR_Skybox_Anisotropy Demonstrates physically based rendering, a skybox, image based lighting, and anisotropic texturing."},{"location":"CxxHowTo/#polydata","title":"Polydata","text":"Example Name Comments Image ReadPolyData This snippet works for most PolyData."},{"location":"CxxHowTo/#random","title":"Random","text":"

If you want to ensure that the same random points/colors are used in C++ and other languages then it is best to use vtkMinimalStandardRandomSequence.

Example Name Comments Image ColorDisconnectedRegionsDemo A vtkLookupTable is filled with random colors. HighlightWithSilhouette Here we use randomly positioned spheres with random colors. A vtkLookupTable is filled with random colors."},{"location":"CxxHowTo/#render-windows","title":"Render Windows","text":"Example Name Comments Image Model Multiple render windows."},{"location":"CxxHowTo/#structureddataset","title":"StructuredDataset","text":"

How to visualise the information in a structured dataset. All these examples use the combustor dataset.

Example Name Comments Image ColorIsosurface Color an isosurface with a data array. CombustorIsosurface Generate an isosurface of constant flow density. CutStructuredGrid Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. ProbeCombustor Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. PseudoVolumeRendering Here we use 100 cut planes, each with an opacity of 0.05. They are then rendered back-to-front to simulate volume rendering. Rainbow Using different vtkLookupTables. StreamLines Seed streamlines with vectors from a structured grid. StreamlinesWithLineWidget Interact with the streamlines in the combustor dataset. VelocityProfile Warping the geometry of three planes to show flow momentum. WarpCombustor Carpet plots of combustor flow energy in a structured grid. Colors and plane displacement represent energy values. XYPlot Display line probes."},{"location":"Java/","title":"Java Examples","text":"

Click here for a tutorial on setting up your Java environment.

It would be appreciated if there are any Java VTK experts who could convert any of the c++ examples to Java!

"},{"location":"Java/#vtk-classes-summary","title":"VTK Classes Summary","text":"

This Python script, SelectExamples, will let you select examples based on a VTK Class and language. It requires Python 3.7 or later. The following tables will produce similar information.

  • VTK Classes with Examples, this table is really useful when searching for example(s) using a particular class.

  • VTK Classes with No Examples, please add examples in your area of expertise!

"},{"location":"Java/#hello-world","title":"Hello World","text":"Example Name Description Image A hello world example Cylinder example from the VTK Textbook and source code. A hello world example."},{"location":"Java/#input-and-output","title":"Input and Output","text":""},{"location":"Java/#graph-formats","title":"Graph Formats","text":""},{"location":"Java/#3d-file-formats","title":"3D File Formats","text":"Example Name Description Image ConvertFile Convert a file from one type to another"},{"location":"Java/#standard-formats","title":"Standard Formats","text":""},{"location":"Java/#input","title":"Input","text":"Example Name Description Image DEMReader Read DEM (elevation map) files ParticleReader This example reads ASCII files where each line consists of points with its position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file format. ReadCML Read Chemistry Markup Language files. ReadOBJ Read an OBJ (.obj) file. ReadPLOT3D Read PLOT3D data files. ReadPLY Read PLY (.ply) files ReadSLC Read an SLC volume file. ReadSTL Read stereo lithography STL (.stl) files. SimplePointsReader Read a simple \"xyz\" file of points."},{"location":"Java/#importers","title":"Importers","text":"Example Name Description Image ThreeDSImporter Import a 3D Studio scene that includes multiple actors. VRMLImporter Import a VRML 2.0 (WRL) file."},{"location":"Java/#output","title":"Output","text":"Example Name Description Image SimplePointsWriter Write a simple \".xyz\" file WritePLY Write PLY (.ply) files. WriteSTL Write stereo lithography STL (.stl) files."},{"location":"Java/#vtk-formats","title":"VTK Formats","text":""},{"location":"Java/#input_1","title":"Input","text":"Example Name Description Image ReadPolyData Read VTK XML PolyData files. ReadRectilinearGrid Read VTK XML RectilinearGrid files. ReadStructuredGrid Read VTK XML StructuredGrid files. ReadVTP Read a VTK XML PolyData file."},{"location":"Java/#output_1","title":"Output","text":"Example Name Description Image WriteVTP Write a VTK XML PolyData file. WriteVTU Write a .vtu file. VTU is an \"Unstructured Grid\". This format allows for 3D data to be stored. XMLPImageDataWriter Write a .pvti file with 4 .vti pieces. XMLPUnstructuredGridWriter Write a .pvtu with 4 .vtu pieces. XMLStructuredGridWriter Write a .vts file from a vtkStructuredGrid."},{"location":"Java/#legacy-vtk-formats","title":"Legacy VTK Formats","text":"Example Name Description Image StructuredPointsReader Read a structured points (.vtk) file."},{"location":"Java/#image-format","title":"Image Format","text":""},{"location":"Java/#input_2","title":"Input","text":"Example Name Description Image JPEGReader Read a JPEG image. ReadBMP Read Windows BMP files. ReadDICOM Read DICOM images. ReadPNM Read PNM (.pnm) files. ReadTIFF Read TIFF (.tif) files."},{"location":"Java/#output_2","title":"Output","text":"Example Name Description Image JPEGWriter Write a JPEG file. PNGReader Read a PNG image. WritePNM Write a PNM (.pnm) file. WriteTIFF Write a TIFF (.tif) file."},{"location":"Java/#annotation","title":"Annotation","text":"Example Name Description Image MultiLineText MultiLineText TextOrigin TextOrigin"},{"location":"Java/#compositedata","title":"CompositeData","text":"Example Name Description Image CompositePolyDataMapper CompositePolyDataMapper"},{"location":"Java/#filtering","title":"Filtering","text":"Example Name Description Image Delaunay2D An example to generate set of points and to triangulate using Delaunay2D Glyph2D Example to copy a polydata to everypoint in the input set. Glyph3D This example applies an object at every point using vtkGlyph3D PerlinNoise An implicit function that implements Perlin noise. TransformPolyData Transforms points, associated normals and vectors for polygonal dataset VertexGlyphFilter Creates a set of points and adds a vertex at each point. WarpTo Deform geometry by warping towards a point"},{"location":"Java/#geometricobjects","title":"GeometricObjects","text":"Example Name Description Image Arrow Arrow Visualization Circle Circle Visualization Cone Cone Visualization ConvexPointSet ConvexPointSet Visualization Disk Disk Visualization EllipticalCylinder EllipticalCylinder Frustum Frustum Visualization Line Line Visualization LongLine A visualization of a long line OrientedArrow Oriented Arrow visualization. OrientedCylinder Oriented Cylinder visualization ParametricObjects ParametricObjects Visualization PlanesIntersection PlanesIntersection Polygon Polygon Visualization Pyramid Pyramid Visualization Quad Quad Visualization RegularPolygonSource RegularPolygon Visualization ShrinkCube Applying shrink filter to an object. TextActor TextActor Demonstration Triangle Triangle Visualization TriangleStrip Triangle Strip Visualization Vertex Vertex Visualization"},{"location":"Java/#hypertreegrid","title":"HyperTreeGrid","text":"Example Name Description Image HyperTreeGridSource Demonstration of a hyper-tree grid source."},{"location":"Java/#geographic-visualization-geovis","title":"Geographic Visualization (Geovis)","text":"Example Name Description Image CompassWidget CompassWidget Visualization EarthSource Earth Source Visualization GeoAssignCoordinates Convert latitude and longitude coordinates to world coordinates."},{"location":"Java/#graphs","title":"Graphs","text":"Example Name Description Image GraphPoints Manually set the coordinates of vertices in a graph. RandomGraphSource A graph with random edges. VisualizeGraph An example to construct a graph and visualize it."},{"location":"Java/#working-with-images","title":"Working with Images","text":"Example Name Description Image Actor2D A actor that draws 2D data Cast Image Data type Casting Filter. ImageSinusoidSource Creates an image with sinusoidal pixel values. RTAnalyticSource Creates an image for regression testing StaticImage Displays a 2D image"},{"location":"Java/#image-processing","title":"Image Processing","text":"Example Name Description Image Flip Flips an image. ImageFFT Compute the Fast Fourier Transform of an image. ImageTest Use Java file dialog to select an image file to display. ShotNoise Create an image using vtkImageCanvasSource2D and write it to a file."},{"location":"Java/#implicit-functions-and-iso-surfaces","title":"Implicit Functions and Iso-surfaces","text":"Example Name Description Image IceCream How to use boolean combinations of implicit functions to create a model of an ice cream cone. ImplicitDataSet Implicit functions, implicit data set. ImplicitSphere ImplicitFunctions, Append poly data, tube filter, sphere SampleFunction Sample an implicit function over a structured point set."},{"location":"Java/#user-interaction","title":"User Interaction","text":"Example Name Description Image Assembly Combine/group actors into an assembly. InteractorStyleTerrain Manipulate camera in scene with natural view up. PickableOff Disallow interaction with a specific actor. RubberBandPick Pick props underneath a rubber band selection rectangle. RubberBandZoom Zoom in by amount indicated by rubber band box. StyleSwitch Choose between multiple interaction modes. TrackballActor Trackball actor mode. TrackballCamera Trackball camera mode."},{"location":"Java/#working-with-meshes","title":"Working with Meshes","text":"Example Name Description Image AddCell Add a cell to an existing mesh. BoundaryEdges Find the edges that are used by only one face. DelaunayMesh Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes."},{"location":"Java/#working-with-3d-data","title":"Working with 3D Data","text":"Example Name Description Image Bottle Sweeps polygonal data creating \"skirt\" from free edges and lines, and lines from vertices CellCenters Compute points at the center of every cell. CenterOfMass Compute the center of mass of the points. ProjectSphere Unroll a sphere or spherical-like model. Spring Rotation in combination with linear displacement and radius variation."},{"location":"Java/#working-with-structured-3d-data","title":"Working with Structured 3D Data","text":"

This section includes vtkImageData vtkStructuredGrid and vtkRectilinearGrid.

\"ImageData\" is not the traditional \"flat, 2D image\" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Here is an overview of these data structures. Image data can represent at typical 2D image, but also, a 3D volume.

"},{"location":"Java/#vtkimagedata","title":"vtkImageData","text":"Example Name Description Image ImageNormalize Normalizes the scalar components for each point. ImageWeightedSum Add two or more images."},{"location":"Java/#vtkstructuredpoints","title":"vtkStructuredPoints","text":"Example Name Description Image StructuredPointsToUnstructuredGrid Convert a vtkStructuredPoints to a vtkUnstructuredGrid. Vol Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26 x 26 x 26."},{"location":"Java/#vtkstructuredgrid","title":"vtkStructuredGrid","text":"Example Name Description Image BlankPoint Blank a point of a vtkStructuredGrid. StructuredGridOutline Creates a wireframe outline for structured grid.

This section includes vtkImageData, vtkStructuredGrid and vtkRectilinearGrid.

\"ImageData\" is not the traditional \"flat, 2D image\" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Here is an overview of these data structures. Image data can represent at typical 2D image, but also, a 3D volume.

"},{"location":"Java/#vtkrectilineargrid","title":"vtkRectilinearGrid","text":"Example Name Description Image RectilinearGrid A dataset that is topologically regular with variable spacing in the three coordinate directions RectilinearGridToTetrahedra Convert a vtkRectilinearGrid to a vtkUnstructuredGrid mesh. VisualizeRectilinearGrid Visualize the cells of a rectilinear grid."},{"location":"Java/#point-cloud-operations","title":"Point Cloud Operations","text":"Example Name Description Image FitImplicitFunction Extract points within a distance to an implicit function."},{"location":"Java/#data-structures","title":"Data Structures","text":""},{"location":"Java/#kd-tree","title":"KD-Tree","text":"Example Name Description Image VisualizeKDTree Show the levels of a KD Tree."},{"location":"Java/#octree","title":"Octree","text":"Example Name Description Image BuildOctree Create an octree."},{"location":"Java/#rendering","title":"Rendering","text":"Example Name Description Image AmbientSpheres Demonstrates the effect of ambient lighting on spheres. ColoredSphere A simple sphere. Cone6 This example introduces 3D widgets. 3D widgets take advantage of the event/observer design pattern. Corresponds to the missing Step 6 Java example from VTK/Examples/Tutorial. Mace An example of multiple inputs and outputs. SpecularSpheres Demonstrates the effect of specular lighting on spheres."},{"location":"Java/#lighting","title":"Lighting","text":"Example Name Description Image LightActor vtkLightActor Demonstration SpotLight vtkSpotLight Demonstration"},{"location":"Java/#math-operations","title":"Math Operations","text":"Example Name Description Image MatrixInverse Represents and manipulates 3x3 transformation matrices. MatrixTranspose The transpose of a matrix is a new matrix whose rows are the columns of the original. NormalizeVector Normalize a vector."},{"location":"Java/#parallel","title":"Parallel","text":"Example Name Description Image ExodusIIWriter Example Program to demonstrates how to use vtkExodusIIWriter"},{"location":"Java/#polydata","title":"PolyData","text":"Example Name Description Image ColorCells ColorCells ColorCellsWithRGB ColorCellsWithRGB ColorDisconnectedRegions ColorDisconnectedRegions ColoredPoints Example to visualize Colored Points. ConvexHullShrinkWrap ConvexHullShrinkWrap KochanekSpline KochanekSpline MeshQuality MeshQuality Outline Outline Reflection Reflection RibbonFilter RibbonFilter RotationAroundLine Rotation around a line. RuledSurfaceFilter Create a surface between lines. Stripper Stripper ThinPlateSplineTransform A nonlinear warp transformation. TransformFilter Transforms points, associated normals and vectors TransformPipeline Combining the transformation, in order to manipulate a group of vtkActor. Shown in the example robot arm motion. TriangleColoredPoints Adding color to each vertex of a triangle TubeFilter TubeFilter Example Name Description Image AVI An example to demonstrate how to make an AVI video using vtkAVIWriter Example Name Description Image RenderView An easier way to make objects appear on the screen using RenderView"},{"location":"Java/#texture-mapping","title":"Texture Mapping","text":"Example Name Description Image TexturePlane Example of texture mapping. TexturedSphere Texture a sphere."},{"location":"Java/#utilities","title":"Utilities","text":"Example Name Description Image BrownianPoints Produce a random vector at each point in a dataset. ColorLookupTable Color Lookup Table. DiscretizableColorTransferFunction Discretizable Color Transfer Function. FullScreen Example to Display Actors in a Full Screen Render Window. FunctionParser String function parser. GetDataRoot Find the path of VTK_DATA_ROOT. PassThrough Shallow copies the input into the output. PiecewiseFunction Interpolation using a piecewise function. ReportRenderWindowCapabilities Report the capabilities of a render window. Screenshot Use a vtkWindow as input to image pipeline. TimerLog Example to Demonstrate Timer support and logging."},{"location":"Java/#arrays","title":"Arrays","text":"Example Name Description Image KnownLengthArray Known Length Array UnknownLengthArray UnKnown Length Array"},{"location":"Java/#video","title":"Video","text":"Example Name Description Image OggTheora Uses the ogg and theora libraries to write video files."},{"location":"Java/#visualization","title":"Visualization","text":"Example Name Description Image AnimDataCone Animate a cone by modifying the polydata points - uses Interaction M key (Motion) to toggle animation. Animation Move a sphere across a scene AnnotatedCubeActor A 3D cube with face labels. BackfaceCulling Turn on/off fast culling of polygons based on orientation of normal with respect to camera. BackgroundColor Example program to set the background color of the render window BackgroundGradient viewport having gradient background using the Background (bottom) and Background2 (top) colors. BlobbyLogo Blobby logo from VTK textbook. Camera A virtual camera for 3D rendering. CameraActor A frustum to represent a camera. ColorActorEdges Color the edges of an Actor. ColorAnActor Switch style interaction adds C and A key actions for selecting Camera or Actor interaction, and T and J key actions for Trackball or Joystick interaction mode. Adds charEvent observer callback to restore the missing E and Q events to quit. ComplexV ComplexV from the VTK Textbook. CornerAnnotation Write text in the corners of a window. CubeAxesActor Display three orthogonal axes with labels. CubeAxesActor2D This example uses the vtkCubeAxesActor2D to show your scene with axes to indicate the spatial extent of your data. Cursor2D Generates a 2D Cursor Representation. Cursor3D Generates a 3D Cursor Representation CursorShape Change the shape of the cursor. Cutter How to use vtkCutter by cutting through a cube. DisplayCoordinateAxes Display coordinate axes. DistanceToCamera Calculate distance from points to the camera. DrawText Display Text. Follower Draw text that stays right side up. ImageOrientation Orientation of the view of an image. Legend Draw symbols with text. LegendScaleActor Display the scale of a scene. LineWidth Change the width/thickness of lines in an actor. LoopShrink A network with a loop. MoveActor Moving an Actor. MoveCamera Moving the Camera. MultipleActors Multiple Actors. MultipleViewports Multiple Viewports. NoShading Opacity Transparency, transparent. OrientedGlyphs Copies oriented and scaled glyph geometry to every input point ProteinRibbons Display pdb ribbons. RandomProbe Demonstrates how to probe a dataset with random points and select points inside the data set. ScalarBarActor Display a color bar. ScalarBarActorColorSeries Display a color bar with a color series lookup table. ScalarVisibility Switch between coloring the actor and coloring the data. SideBySideViewports Side by side viewports. SpikeFran Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected. VectorFieldExample A vector field visualisation. VisualizeImageData Visualize the points of an ImageData. VisualizeVTP Visualize a VTP File. WindowSize Change the size of a window. WireframeSphere A Wireframe Sphere Visualization."},{"location":"Java/#volume-rendering","title":"Volume Rendering","text":"Example Name Description Image SimpleRayCast Volume rendering of a high potential iron protein."},{"location":"Java/#graphs_1","title":"Graphs","text":"Example Name Description Image SelectGraphVertices Select Edges and vertices in a graph"},{"location":"Java/#simpleoperations","title":"SimpleOperations","text":"Example Name Description Image DistanceBetweenPoints Example Program to find squared distance and the Euclidean distance between two 3D points. PerspectiveTransform It is used to describe the full range of homogeneous transformations. It was designed in particular to describe a camera-view of a scene ProjectPointPlane Performs various plane computations. RandomSequence Park and Miller Sequence of pseudo random numbers."},{"location":"Java/#swing-integration","title":"Swing Integration","text":"Example Name Description Image JFrameRender Render a scene in a JFrame using a vtkRenderWindowPanel SwingHandleMouseEvent Display in a JLabel the point the mouse is hovering over using a mouse listener"},{"location":"Java/#widgets","title":"Widgets","text":"Example Name Description Image AngleWidget AngleWidget Demonstration AngleWidget2D AngleWidget2D Demonstration BalloonWidget The balloon text describes each object when you hover it. CaptionWidget Widget for placing a caption (text plus leader) DistanceWidget Measures the distance between two points. ImagePlaneWidget 3D widget for reslicing image data. ImageTracerWidgetNonPlanar 3D widget for tracing on planar props. LogoWidget 2D widget for placing and manipulating a logo OrientationMarkerWidget Display a polydata as an orientation icon. PlaneWidget A finite (bounded) plane that can be interactively placed in a scene. SeedWidget Places multiple seed points, where a user moves the cursor to and clicks it. SplineWidget SplineWidget Demonstration TextWidget Widget for placing text on overlay plane."},{"location":"JavaHowTo/","title":"Java How To","text":"

Often you just need a \"pointer\" to an example that shows you how to do something.

Here are some snippets or examples that highlight interesting features that may help you:

"},{"location":"JavaHowTo/#no-examples-or-snippets-yet","title":"No examples or snippets yet","text":"Example Name Comments Image"},{"location":"JavaScript/","title":"JavaScript","text":"

The vtk.js project is an exciting new way to use VTK. vtk.js let's you run much of VTK from a browser. Rather than repeat those examples here, please visit the vtk.js examples.

Info

This is a very active project. Be sure to visit the project frequently.

"},{"location":"Python/","title":"Python Examples","text":"

Please see this page to learn how to setup your environment to use VTK in Python.

It would be appreciated if there are any Python VTK experts who could convert any of the c++ examples to Python!

"},{"location":"Python/#vtk-classes-summary","title":"VTK Classes Summary","text":"

This Python script, SelectExamples, will let you select examples based on a VTK Class and language. It requires Python 3.7 or later. The following tables will produce similar information.

  • VTK Classes with Examples, this table is really useful when searching for example(s) using a particular class.

  • VTK Classes with No Examples, please add examples in your area of expertise!

"},{"location":"Python/#tutorials","title":"Tutorials","text":"

If you are new to VTK then these tutorials will help to get you started.

"},{"location":"Python/#hello-world","title":"Hello World","text":"Example Name Description Image A hello world example Cylinder example from the VTK Textbook and source code. A hello world example."},{"location":"Python/#simple-operations","title":"Simple Operations","text":"Example Name Description Image DistanceBetweenPoints"},{"location":"Python/#input-and-output","title":"Input and Output","text":""},{"location":"Python/#graph-formats","title":"Graph Formats","text":""},{"location":"Python/#3d-file-formats","title":"3D File Formats","text":""},{"location":"Python/#standard-formats","title":"Standard Formats","text":""},{"location":"Python/#input","title":"Input","text":"Example Name Description Image CSVReadEdit Read and edit a CSV file using pandas and numpy. CSVReadEdit1 Read and edit a CSV file using pandas and vtkDelimitedTextReader. ReadExodusData A simple script for reading and viewing ExodusII data interactively. ReadPLOT3D Read CFD (computational fluid dynamics) data produced by PLOT3D. ReadSLC Read an SLC file. ReadSTL Read an STL file. ReadUnstructuredGrid Using vtkUnstructuredGridReader to read a (legacy) *.vtk file ReadVTP Read a VTK XML PolyData file. TransientHDFReader Read transient data written inside a vtkhdf file."},{"location":"Python/#importers","title":"Importers","text":"Example Name Description Image 3DSImporter Import a 3D Studio scene that includes multiple actors."},{"location":"Python/#output","title":"Output","text":"Example Name Description Image WritePLY WriteSTL"},{"location":"Python/#vtk-formats","title":"VTK Formats","text":""},{"location":"Python/#input_1","title":"Input","text":"Example Name Description Image ReadImageData Read an image data (.vti) file ReadPolyData Read a polygonal data (.vtp) file"},{"location":"Python/#output_1","title":"Output","text":""},{"location":"Python/#legacy-vtk-formats","title":"Legacy VTK Formats","text":"Example Name Description Image ReadLegacyUnstructuredGrid Read an unstructured grid that contains 11 linear cells. WriteLegacyLinearCells Write each linear cell into a legacy UnstructuredGrid file. WriteXMLLinearCells Write each linear cell into an XML UnstructuredGrid file (.vtu)."},{"location":"Python/#image-format","title":"Image Format","text":""},{"location":"Python/#input_2","title":"Input","text":"Example Name Description Image HDRReader Read a high-dynamic-range imaging file. ReadDICOM Read DICOM file. ReadDICOMSeries This example demonstrates how to read a series of DICOM images and scroll through slices"},{"location":"Python/#output_2","title":"Output","text":"Example Name Description Image ImageWriter Write an imagefile based on the file extension."},{"location":"Python/#geometric-objects","title":"Geometric Objects","text":"Example Name Description Image Axes Circle A disk is shown however this can be modified to show a circle. ColoredLines Dodecahedron Create a dodecahedron using vtkPolyhedron. EllipticalCylinder Create an elliptical cylinder using extrusion. EllipticalCylinderDemo Show the base and extrusion vector. GeometricObjectsDemo Planes We create a convex hull of the planes for display purposes. PlanesIntersection PolygonIntersection IntersectWithLine() SourceObjectsDemo Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source. Other polygonal source objects are available; check subclasses of vtkPolyDataAlgorithm."},{"location":"Python/#cells","title":"Cells","text":"Example Name Description Image Cell3DDemonstration Sample objects are generated from the classes derived from vtkCell3D and displayed. CellTypeSource Generate tessellated cells. ConvexPointSet Generate a ConvexPointSetCell. Hexahedron LinearCellDemo Linear cell types found in VTK. Numbers define ordering of the defining points. LongLine Manually create a polyline. Point PolyLine Polygon Polyhedron Create an unstructured grid representation of a polyhedron (cube) and write it out to a file. Pyramid Quad Tetrahedron Triangle TriangleStrip Vertex"},{"location":"Python/#sources","title":"Sources","text":"Example Name Description Image Arrow Cone Cube Manually build a polygonal cube. Cube1 A nice simple example that demonstrates the operation of the VTK pipeline. Cylinder Disk A circle with a hole in it. EarthSource Create the Earth. Frustum Line OrientedArrow Orient an arrow along an arbitrary vector. OrientedCylinder Orient a cylinder along an arbitrary vector. Plane PlatonicSolids All five platonic solids are displayed. PolyLine1 This example demonstrates how to create a polygon through several ordered points. RegularPolygonSource ShrinkCube Applying shrink filter to an object. Sphere TessellatedBoxSource Generate a box with tessellated sides. TextActor 2D \"HUD-type\" text"},{"location":"Python/#non-linear","title":"Non Linear","text":"Example Name Description Image IsoparametricCellsDemo Nonlinear isoparametric cell types in VTK. QuadraticHexahedron Create and tessellate a nonlinear cell. QuadraticHexahedronDemo Interactively adjust chord error. QuadraticTetra Create and tessellate a nonlinear cell. QuadraticTetraDemo Interactively adjust chord error."},{"location":"Python/#parametric-objects","title":"Parametric Objects","text":"Example Name Description Image ParametricKuenDemo Interactively change the parameters for a Kuen Surface. ParametricObjectsDemo Demonstrates the Parametric classes added by Andrew Maclean and additional classes added by Tim Meehan. The parametric spline is also included. Options are provided to display single objects, add backface, add normals and print out an image. ParametricSuperEllipsoidDemo Interactively change the parameters for a SuperEllipsoid Surface. ParametricSuperToroidDemo Interactively change the parameters for a SuperToroid Surface."},{"location":"Python/#implicit-functions-and-iso-surfaces","title":"Implicit Functions and Iso-surfaces","text":"Example Name Description Image BooleanOperationImplicitFunctions Demonstrate booleans of two different implicit functions ContourTriangulator Create a contour from a structured point set (image) and triangulate it. CutWithScalars Cut a surface with scalars. DiscreteMarchingCubes Generate surfaces from labeled data. ExtractData Implicit functions used to select data: Two ellipsoids are combined using the union operation used to select voxels from a volume. Voxels are shrunk 50 percent. ExtractLargestIsosurface Extract largest isosurface. Hello Implicit modelling used to thicken a stroked font. IceCream How to use boolean combinations of implicit functions to create a model of an ice cream cone. ImplicitQuadric Create an ellipsoid using an implicit quadric ImplicitSphere Demonstrate sampling of a sphere implicit function ImplicitSphere1 Demonstrate sampling of a sphere implicit function Lorenz Visualizing a Lorenz strange attractor by integrating the Lorenz equations in a volume. MarchingCases Explore the Marching Cubes cases. MarchingCasesA The 256 possible cases have been reduced to 15 cases using symmetry. MarchingCasesB Marching cubes complementary cases. Cases 3c, 6c, 7c, 10c, 12c and 13c are displayed. MarchingCasesC Marching cubes, case 3 is rotated 90 degrees about the y-axis with no label. MarchingCasesD Marching cubes, case 7 is rotated 180 degrees about the y-axis with no label. MarchingCubes Create a voxelized sphere. SampleFunction Sample and visualize an implicit function. SmoothDiscreteMarchingCubes Generate smooth surfaces from labeled data."},{"location":"Python/#working-with-3d-data","title":"Working with 3D Data","text":"Example Name Description Image AlignTwoPolyDatas Align two vtkPolyData's. AppendFilter Append different types of data, BooleanOperationPolyDataFilter This example performs a boolean operation (Intersection, Union, Difference) of two PolyData Bottle Rotationally symmetric objects. CappedSphere Rotate an arc to create a capped sphere. CellsInsideObject Extract cells inside a closed surface. ColoredTriangle Creates a file TriangleColored.vtp. CombinePolyData This example combines Polydata objects, and displays the result to the screen. ConnectivityFilter Color any dataset type based on connectivity. CurvaturesAdjustEdges Get the Gaussian and Mean curvatures of a surface with adjustments for edge effects. CurvaturesDemo Demonstrates how to get the Gaussian and Mean curvatures of a surface. ExtractPolyLinesFromPolyData Extract polylines from polydata. ExtractSelection Extract selected points. ExtractSelectionCells Extract cell, select cell. FilledPolygon Finance Visualization of multidimensional financial data. The gray/wireframe surface represents the total data population. The red surface represents data points delinquent on loan payment. FinanceFieldData Visualization of multidimensional financial data. The yellow surface represents the total data population. The red surface represents data points delinquent on loan payment. Glyph2D Glyph3D ImplicitPolyDataDistance IterateOverLines Iterate through the lines of a PolyData. IterativeClosestPoints LineOnMesh MeshLabelImageColor Outline PerlinNoise PolyDataContourToImageData PolyDataToImageDataStencil RotationAroundLine RuledSurfaceFilter SmoothMeshGrid SolidColoredTriangle Writes out a file TriangleSolidColor.vtp. Spring Rotation in combination with linear displacement and radius variation. TransformPolyData Apply a Transformation to a PolyData. TriangleColoredPoints TriangleCornerVertices TriangleCorners TriangulateTerrainMap Generate heights (z values) on a 10x10 grid (a terrain map) and then triangulate the points to form a surface. TubeFilter Give lines a thickness (produce a cylinder around lines). VertexGlyphFilter Add a vertex to each point. WarpTo Deform geometry by warping towards a point. WarpVector This example warps/deflects a line. WriteTriangleToFile"},{"location":"Python/#data-types","title":"Data Types","text":"Example Name Description Image CompositePolyDataMapper MultiBlockDataSet Demonstrates how to make and use VTK's MultiBlock type data OverlappingAMR Demonstrates how to create and populate a VTK's Overlapping AMR Grid type Data"},{"location":"Python/#data-type-conversions","title":"Data Type Conversions","text":""},{"location":"Python/#point-cloud-operations","title":"Point Cloud Operations","text":"Example Name Description Image PointSource Generate a random point cloud."},{"location":"Python/#working-with-meshes","title":"Working with Meshes","text":"

This section includes examples of manipulating meshes.

Example Name Description Image BoundaryEdges Find the edges that are used by only one face. ClosedSurface Check if a surface is closed. ColoredElevationMap Color a mesh by height. Curvatures Compute Gaussian, and Mean Curvatures. Decimation Reduce the number of triangles in a mesh. DeformPointSet Use the vtkDeformPointSet filter to deform a vtkSphereSource with arbitrary polydata. DelaunayMesh Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes. PointInterpolator Plot a scalar field of points onto a PolyData surface."},{"location":"Python/#clipping","title":"Clipping","text":"Example Name Description Image CapClip Cap a clipped polydata with a polygon. ClipDataSetWithPolyData Clip a vtkRectilinearGrid with arbitrary polydata. In this example, use a vtkConeSource to generate polydata to slice the grid, resulting in an unstructured grid. ClipDataSetWithPolyData1 Clip a vtkRectilinearGrid with arbitrary polydata. In this example, use a vtkConeSource to generate polydata to slice the grid, resulting in an unstructured grid. SolidClip Create a \"solid\" clip. The \"ghost\" of the part clipped away is also shown."},{"location":"Python/#working-with-structured-3d-data","title":"Working with Structured 3D Data","text":"

This section includes vtkImageData, vtkExplicitStructuredGrid, vtkStructuredGrid, vtkStructuredPoints and vtkRectilinearGrid.

\"ImageData\" is not the traditional \"flat, 2D image\" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Image data can represent at typical 2D image, but also, a 3D volume.

"},{"location":"Python/#vtkimagedata","title":"vtkImageData","text":"Example Name Description Image ImageWeightedSum Add two or more images."},{"location":"Python/#vtkexplicitstructuredgrid","title":"vtkExplicitStructuredGrid","text":"Example Name Description Image CreateESGrid Create an explicit structured grid and convert this to an unstructured grid or vice versa. LoadESGrid Load a VTU file and convert the dataset to an explicit structured grid."},{"location":"Python/#vtkstructuredgrid","title":"vtkStructuredGrid","text":"Example Name Description Image BlankPoint Blank a point of a vtkStructuredGrid. SGrid Creating a structured grid dataset of a semi-cylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction."},{"location":"Python/#vtkstructuredpoints","title":"vtkStructuredPoints","text":"Example Name Description Image Vol Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26 x 26 x 26."},{"location":"Python/#vtkrectilineargrid","title":"vtkRectilinearGrid","text":"Example Name Description Image RGrid Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray. RectilinearGrid Create a rectilinear grid. VisualizeRectilinearGrid Visualize the cells of a rectilinear grid."},{"location":"Python/#working-with-unstructured-3d-data","title":"Working with Unstructured 3D Data","text":"

This section includes vtkUnstructuredGrid.

"},{"location":"Python/#vtkunstructuredgrid","title":"vtkUnstructuredGrid","text":"Example Name Description Image ClipUnstructuredGridWithPlane Clip a UGrid with a plane. ClipUnstructuredGridWithPlane2 Clip a UGrid with a plane. UGrid Creation of an unstructured grid."},{"location":"Python/#registration","title":"Registration","text":""},{"location":"Python/#medical","title":"Medical","text":"Example Name Description Image GenerateCubesFromLabels Create cubes from labeled volume data. GenerateModelsFromLabels Create models from labeled volume data. MedicalDemo1 Create a skin surface from volume data. MedicalDemo2 Create a skin and bone surface from volume data. MedicalDemo3 Create skin, bone and slices from volume data. MedicalDemo4 Create a volume rendering. TissueLens Cut a volume with a sphere."},{"location":"Python/#surface-reconstruction","title":"Surface reconstruction","text":"Example Name Description Image GaussianSplat Create a surface from Unorganized Points (Gaussian Splat)."},{"location":"Python/#utilities","title":"Utilities","text":"Example Name Description Image CheckVTKVersion Check the VTK version and provide alternatives for different VTK versions. ColorMapToLUT_JSON Take an JSON description of a colormap and convert it to a VTK colormap. ColorMapToLUT_XML Take an XML description of a colormap and convert it to a VTK colormap. ColorMapToLUT Use vtkDiscretizableColorTransferFunction to generate a VTK colormap. ConstrainedDelaunay2D Perform a 2D Delaunay triangulation on a point set respecting a specified boundary. Delaunay2D LUTUtilities A utility class for vtkLookupTable allowing you to output the table contents or to compare tables. MultipleRenderWindows Multiple Render Windows. MultipleViewports Multiple Viewports. RescaleReverseLUT Demonstrate how to adjust a colormap so that the colormap scalar range matches the scalar range on the object. You can optionally reverse the colors. ResetCameraOrientation Reset camera orientation to a previously saved orientation. SaveSceneToFieldData Save a vtkCamera's state in a vtkDataSet's vtkFieldData and restore it. SaveSceneToFile Save a vtkCamera's state in a file and restore it. SelectExamples Given a VTK Class and a language, select the matching examples. Screenshot ShareCamera Share a camera between multiple renderers. VTKImportsForPython Generate import statements for the VTK classes in your Python code. VTKModulesForCxx Generate a find_package(VTK COMPONENTS ...) command for CMake. VTKWithNumpy Variant"},{"location":"Python/#arrays","title":"Arrays","text":"Example Name Description Image GetValues RenameArray"},{"location":"Python/#events","title":"Events","text":""},{"location":"Python/#math-operations","title":"Math Operations","text":""},{"location":"Python/#graphs","title":"Graphs","text":"Example Name Description Image ColorEdges Color edges. ColorVertexLabels Set the color of vertex labels. ColorVerticesLookupTable Color vertices. ConstructGraph Construct a graph. ConstructTree Construct a tree. CreateTree Create a tree and label the vertices and edges. EdgeWeights GraphToPolyData Convert a graph to a PolyData. LabelVerticesAndEdges Label vertices and edges. NOVCAGraph RandomGraphSource Create a random graph. ScaleVertices Size/scale vertices based on a data array. SelectedVerticesAndEdges SideBySideGraphs Display two graphs side by side. VisualizeDirectedGraph Visualize a directed graph. VisualizeGraph"},{"location":"Python/#graph-conversions","title":"Graph Conversions","text":""},{"location":"Python/#data-structures","title":"Data Structures","text":""},{"location":"Python/#timing-demonstrations","title":"Timing Demonstrations","text":""},{"location":"Python/#kd-tree","title":"KD-Tree","text":""},{"location":"Python/#oriented-bounding-box-obb-tree","title":"Oriented Bounding Box (OBB) Tree","text":""},{"location":"Python/#octree","title":"Octree","text":""},{"location":"Python/#modified-bsp-tree","title":"Modified BSP Tree","text":""},{"location":"Python/#hypertreegrid","title":"HyperTreeGrid","text":"Example Name Description Image HyperTreeGridSource Create a vtkHyperTreeGrid."},{"location":"Python/#vtk-concepts","title":"VTK Concepts","text":""},{"location":"Python/#rendering","title":"Rendering","text":"Example Name Description Image AmbientSpheres Demonstrates the effect of ambient lighting on spheres. CameraBlur Example of a scene rendered with focal depth. ColoredSphere A simple sphere. Cone3 Four frames of output, based on the VTK example Cone3.py. Cone4 Modifying properties and transformation matrix based on the VTK example Cone4.py. DiffuseSpheres Demonstrates the effect of diffuse lighting on spheres. FlatVersusGouraud Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look. GradientBackground Demonstrates the background shading options. LayeredActors Demonstrates the use of two linked renderers. The orientation of objects in the non active layer is linked to those in the active layer. Mace An example of multiple inputs and outputs. Model Illustrative diagram of graphics objects. MotionBlur Example of motion blur. OutlineGlowPass Demonstrates how to render a object in a scene with a glowing outline. PBR_Anisotropy Render spheres with different anisotropy values. PBR_Clear_Coat Render a cube with custom texture mapping and a coat normal texture. PBR_Edge_Tint Render spheres with different edge colors using a skybox as image based lighting. PBR_HDR_Environment Renders spheres with different materials using a skybox as image based lighting. PBR_Mapping Render a cube with custom texture mapping. PBR_Materials Renders spheres with different materials using a skybox as image based lighting. PBR_Materials_Coat Render spheres with different coat materials using a skybox as image based lighting. PBR_Skybox Demonstrates physically based rendering, a skybox and image based lighting. PBR_Skybox_Texturing Demonstrates physically based rendering, a skybox, image based lighting and texturing. PBR_Skybox_Anisotropy Demonstrates physically based rendering, a skybox, image based lighting, and anisotropic texturing. Rainbow Use and manipulation of vtkLookupTables. Rotations Rotations of a cow about her axes. RotationsA Perform six rotations of a cow about her x-axis (Figure 3-31a). RotationsB Perform six rotations of a cow about her y-axis (Figure 3-31b). RotationsC Perform six rotations of a cow about her z-axis (Figure 3-31c). RotationsD First a rotation of a cow about her x-axis, then six rotations about her y-axis (Figure 3-31d). Shadows Draw model with shadows. SpecularSpheres Demonstrates the effect of specular lighting on spheres. StippledLine Draw a stippled line. StripFran Triangle strip examples. (a) Structured triangle mesh consisting of 134 strips each of 390 triangles. (b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip. TransformSphere The addition of a transform filter to ColoredSphere. TransparentBackground Demonstrates the use of two renderers. Notice that the second (and subsequent) renderers will have a transparent background. WalkCow This generates Figs. 3-32, 3-33 found in VTKTextbook.pdf. WalkCowA This generates Fig. 3-33a found in VTKTextbook.pdf. WalkCowB This generates Fig. 3-33b found in VTKTextbook.pdf."},{"location":"Python/#lighting","title":"Lighting","text":"Example Name Description Image ShadowsLightsDemo Show lights casting shadows."},{"location":"Python/#texture-mapping","title":"Texture Mapping","text":"Example Name Description Image AnimateVectors One frame from a vector field animation using texture maps. TextureCutQuadric Cut a quadric with boolean textures. TextureCutSphere Examples of texture thresholding. (b) Boolean combination of two planes to cut nested spheres. TexturePlane Example of texture mapping. TextureThreshold Demonstrate the use of scalar thresholds to show values of flow density on three planes."},{"location":"Python/#tutorial","title":"Tutorial","text":"

If you are new to VTK then these tutorials will help to get you started.

Tutorial Description Image Step 1 Create a cone, render it and rotate it through 360\u00b0. Step 2 Adding an observer. Step 3 Using multiple renderers within a render window. Step 4 The creation of multiple actors and the manipulation of their properties and transformations. Step 5 Introducing the concept of interaction. Step 6 Using a 3D widget."},{"location":"Python/#visualization","title":"Visualization","text":"

See this tutorial for a brief explanation of the VTK terminology of mappers, actors, etc.

Example Name Description Image AlphaFrequency Linearly extrude fonts to show letter frequencies in text. AnatomicalOrientation Show a labelled set of anatomical planes transecting a human figure. AnnotatedCubeActor Annotated cube. AssignCellColorsFromLUT Demonstrates how to assign colors to cells in a vtkPolyData structure using lookup tables. BillboardTextActor3D Label points with billboards. BlobbyLogo A logo created with vtkImplicitModeller. Blow Ten frames from a blow molding finite element analysis. BluntStreamlines Demonstrates airflow around a blunt fin using streamlines. Camera Positioning and aiming the camera. CameraModel1 Illustrate camera movement around the focal point. CameraModel2 camera movement centered at the camera position. CarotidFlow Visualizing blood flow in the human carotid arteries. Streamtubes of flow velocity are generated. CarotidFlowGlyphs Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude. ClampGlyphSizes Use vtkGlyph3D with ClampingOn to limit glyph sizes ClipSphereCylinder A plane clipped with a sphere and an ellipse. The two transforms place each implicit function into the appropriate position. Two outputs are generated by the clipper. CollisionDetection Collison between two spheres. ColorAnActor Colour the actor. ColorSeriesPatches Creates a HTML file called VTKColorSeriesPatches ColoredAnnotatedCube How to color the individual faces of an annotated cube. CombustorIsosurface Generate an isosurface of constant flow density. ComplexV ComplexV from the VTK Textbook. ContourQuadric Contouring a quadric function. CreateBFont A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles. CreateColorSeriesDemo Create a custom vtkColorSeries. CubeAxesActor Display three orthogonal axes with labels.FWorking with 3D CurvatureBandsWithGlyphs Demonstrates the coloring of a surface by partitioning the gaussian curvature of a surface into bands and using arrows to display the normals on the surface. CutStructuredGrid Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. Cutter How to use vtkCutter by cutting through a cube. DataSetSurface Cutting a hexahedron with a plane. The red line on the surface shows the cut. DecimateFran Examples of decimation algorithm. (a) Decimation of laser digitizer data. DecimateHawaii Examples of decimation algorithm. (b) Decimation of terrain data. DisplacementPlot Show modal lines for a vibrating beam. DisplayCoordinateAxes Display coordinate axes. DisplayQuadricSurfaces Create and display a quadratic surface. ElevationBandsWithGlyphs Demonstrates the coloring of a surface by partitioning the elevation into bands and using arrows to display the normals on the surface. ExponentialCosine Carpet plots. Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values. FlyingHeadSlice Flying edges used to generate contour lines. FrogBrain The frog's brain. Model extracted without smoothing (left) and with smoothing (right). FroggieSurface Construct surfaces from a segmented frog dataset. Up to fifteen different surfaces may be extracted. You can turn on and off surfaces and control the camera position. FroggieView View surfaces of a segmented frog dataset using preprocessed *.vtk tissue files. You can turn on and off surfaces, control their opacity through the use of sliders and control the camera position. FrogSlice Photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow. GlyphTable Vary the shapes of glyphed points using a glyph table Hanoi Towers of Hanoi. HanoiInitial Towers of Hanoi - Initial configuration. HanoiIntermediate Towers of Hanoi - Intermediate configuration. HardwareSelector Hawaii Visualize elevations by coloring the scalar values with a lookup table. HeadBone Marching cubes surface of human bone. HeadSlice Marching squares used to generate contour lines. HyperStreamline Example of hyperstreamlines, the four hyperstreamlines shown are integrated along the minor principle stress axis. A plane (colored with a different lookup table) is also shown. IronIsoSurface Marching cubes surface of iron-protein. IsosurfaceSampling Demonstrates how to create point data on an isosurface. Kitchen Demonstrates stream tracing in a kitchen. KochSnowflake This example draws a Koch snowflake fractal using recursive functions and some of the convenient tools in the toolkit. LOx Streamtubes created by using the computational grid just in front of the post as a source for seeds. LOxGrid Portion of computational grid for the LOx post. LOxSeeds Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown. LoopShrink A network with a loop. VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK. Motor Texture cut used to reveal internal structure of a motor. Two cut planes are used in combination with transparent texture. NamedColorPatches Creates a HTML file called VTKNamedColorPatches NamedColors Demonstrates how to use the vtkNamedColors class. NormalsDemo Demo different options to generate normals. Office Using random point seeds to create streamlines. OfficeA Corresponds to Fig 9-47(a) in the VTK textbook. OfficeTube The stream polygon. Sweeping a polygon to form a tube. OrientedGlyphs Create oriented glyphs from vector data. PineRootConnectivity Applying the connectivity filter to remove noisy isosurfaces. PineRootConnectivityA The isosurface, with no connectivity filter applied. PineRootDecimation Applying the decimation and connectivity filters to remove noisy isosurfaces and reduce data size. PlateVibration Demonstrates the motion of a vibrating beam. PointDataSubdivision Vary the shapes of glyphed points using a programmable glyph filter PointSize ProbeCombustor Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. ProgrammableGlyphFilter Generate a custom glyph at each point. ProgrammableGlyphs Generate programmable glyphs. PseudoVolumeRendering Here we use 100 cut planes, each with an opacity of 0.05. They are then rendered back-to-front to simulate volume rendering. QuadricVisualization Visualizing a quadric function. SingleSplat Elliptical splatting. (a) Single elliptical splat with eccentricity E=10. Cone shows orientation of vector. SphereTexture Apply an ImageData texture to an sphere SpikeFran Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected. SplatFace Elliptical splatting. (b) Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction. Points regularly subsampled and overlaid on original mesh. Stocks Two views from the stock visualization script. The top shows closing price over time; the bottom shows volume over time. StreamLines Seed streamlines with vectors from a structured grid. StreamlinesWithLineWidget Using the vtkLineWidget to produce streamlines in the combustor dataset. The StartInteractionEvent turns the visibility of the streamlines on; the InteractionEvent causes the streamlines to regenerate themselves. TensorAxes Display the scaled and oriented principal axes of the stress tensor. TensorEllipsoids Display the scaled and oriented principal axes as tensor ellipsoids representing the stress tensor. TextSource VectorText Display high resolution text. VelocityProfile Warping the geometry of three planes to show flow momentum. WarpCombustor Carpet plots of combustor flow energy in a structured grid. Colors and plane displacement represent energy values. WindowTitle"},{"location":"Python/#working-with-vtkimagedata","title":"Working with vtkImageData","text":"Example Name Description Image ImageDataGeometryFilter Convert a vtkImageData to a vtkPolyData. ImageNormalize Normalize an image. SumVTKImages A function to simplify the summing of images, where you can pass a list of images and weights. WriteReadVtkImageData Generate, edit and read out vtk image data."},{"location":"Python/#volume-rendering","title":"Volume Rendering","text":"Example Name Description Image SimpleRayCast Volume rendering of a high potential iron protein."},{"location":"Python/#user-interaction","title":"User Interaction","text":"Example Name Description Image CallBack Setting up a callback with client data. Two different methods are demonstrated. CellPicking Cell Picking. HighlightPickedActor Pick and highlight an actor based on mouse clicks. HighlightWithSilhouette Highlight a picked actor by adding a silhouette. InteractorStyleTrackballActor InteractorStyleTrackballCamera MouseEvents Subclass the interactor style. MouseEventsObserver Use an observer."},{"location":"Python/#working-with-images","title":"Working with Images","text":"Example Name Description Image Actor2D 2D actor and mapper. BackgroundImage Display an image as the \"background\" of a scene, and render a superquadric in front of it. Cast Cast an image to a different type."},{"location":"Python/#image-processing","title":"Image Processing","text":"Example Name Description Image Attenuation This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. EnhanceEdges High-pass filters can extract and enhance edges in an image. Subtraction of the Laplacian (middle) from the original image (left) results in edge enhancement or a sharpening operation (right). GaussianSmooth Low-pass filters can be implemented as convolution with a Gaussian kernel. HybridMedianComparison Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. IdealHighPass This figure shows two high-pass filters in the frequency domain. The Butterworth high-pass filter has a gradual attenuation that avoids ringing produced by the ideal high-pass filter with an abrupt transition. ImageGradient Create an imaging pipeline to visualize gradient information. ImageWarp Combine the imaging and visualization pipelines to deform an image in the z-direction. The vtkMergeFilter is used to combine the warped surface with the original color data. IsoSubsample This figure demonstrates aliasing that occurs when a high-frequency signal is subsampled. High frequencies appear as low frequency artifacts. The left image is an isosurface of a skull after subsampling. The right image used a low-pass filter before subsampling to reduce aliasing. MedianComparison Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise. MorphologyComparison This figure demonstrates various binary filters that can alter the shape of segmented regions. Pad Convolution in frequency space treats the image as a periodic function. A large kernel can pick up features from both sides of the image. The lower-left image has been padded with zeros to eliminate wraparound during convolution. On the right, mirror padding has been used to remove artificial edges introduced by borders. VTKSpectrum The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This figure shows an image and its power spectrum displayed using a logarithmic transfer function."},{"location":"Python/#widgets","title":"Widgets","text":"Example Name Description Image BalloonWidget Uses a vtkBalloonWidget to draw labels when the mouse stays above an actor. BoxWidget This 3D widget defines a region of interest that is represented by an arbitrarily oriented hexahedron with interior face angles of 90 degrees (orthogonal faces). The object creates 7 handles that can be moused on and manipulated. CameraOrientationWidget Demonstrates a 3D camera orientation widget. CompassWidget Draws an interactive compass. ContourWidget Draw a contour (line) which can be deformed by the user ImplicitPlaneWidget2 Clip polydata with an implicit plane. OrientationMarkerWidget Draws two cubes. One of them can be clicked to be rotated, and will rotate the second one. The second one has annotations on it, and can also be moved. OrientationMarkerWidget1 Display a polydata as an orientation icon. ScalarBarWidget The ScalarBarWidget displays a scalar bar that is movable and changes orientation automatically when close to the borders of the image. It needs a ScalarBarActor SphereWidget This 3D widget defines a sphere that can be interactively placed in a scene. SplineWidget This example shows how to use vtkSplineWidget with a callback being used to get the length of the spline widget. TextWidget Annotate a VTK image with movable text"},{"location":"Python/#plotting","title":"Plotting","text":"Example Name Description Image MultiplePlots Display multiple plots by using viewports in a single render window. ScatterPlot Scatter plot. SpiderPlot Spider plot. SurfacePlot Surface plot."},{"location":"Python/#animation","title":"Animation","text":"Example Name Description Image Animation Move a sphere across a scene."},{"location":"Python/#annotation","title":"Annotation","text":"Example Name Description Image MultiLineText Display multiline text. TextOrigin This example demonstrates the use of vtkVectorText and vtkFollower. vtkVectorText is used to create 3D annotation."},{"location":"Python/#infovis","title":"InfoVis","text":"Example Name Description Image ParallelCoordinatesExtraction Extract data based on a selection in a Parallel Coordinates View SelectedGraphIDs Callback on vtkAnnotationLink in a Graph Layout View when selection is changed"},{"location":"Python/#pyqt","title":"PyQt","text":"Example Name Description Image EmbedInPyQt Shows how to easily embed VTK in PyQt with QVTKRenderWindowInteractor, first example EmbedInPyQt2 Shows how to embed VTK in PyQt with QVTKRenderWindowInteractor, second example"},{"location":"PythonHowTo/","title":"Python How To","text":"

Often you just need a \"pointer\" to an example that shows you how to do something.

Here are some snippets and examples that highlight interesting features that may help you:

"},{"location":"PythonHowTo/#callback","title":"Callback","text":"Example Name Comments Image CallBack Setting up a callback with client data. Two different methods are demonstrated."},{"location":"PythonHowTo/#camera","title":"Camera","text":"Example Name Comments Image CameraModel1 Illustrate camera movement around the focal point. CameraModel2 camera movement centered at the camera position. CameraOrientationWidget This 3D camera orientation widget can be used in conjunction with CameraPosition to get a nice camera position. CameraPosition Get the camera position while moving the image. ResetCameraOrientation Reset camera orientation to a previously saved orientation. ShareCamera Use the same camera for all renderers."},{"location":"PythonHowTo/#check-the-vtk-version","title":"Check the VTK Version","text":"Example Name Comments Image CheckVTKVersion-Snippet Check the VTK version returning True if the requested VTK version is >= the current version. CheckVTKVersion-Example Check the VTK version and provide alternatives for different VTK versions."},{"location":"PythonHowTo/#coloring","title":"Coloring","text":"Example Name Comments Image ShareCamera Store background colors in a vector for later extraction of the red, green and blue components."},{"location":"PythonHowTo/#glyphing","title":"Glyphing","text":"Example Name Comments Image InteractorStyleTrackballCamera Here points are represented as glyphs. PointToGlyph How to represent points as glyphs."},{"location":"PythonHowTo/#image","title":"Image","text":"Example Name Comments Image WriteImage Write out an image of various types."},{"location":"PythonHowTo/#multiple-view-ports-and-render-windows","title":"Multiple view ports and render windows","text":"Example Name Comments Image MultipleRenderWindows Multiple Render Windows. MultipleViewports Multiple Viewports."},{"location":"PythonHowTo/#physically-based-rendering","title":"Physically Based Rendering","text":"

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings.

The results can be quite spectacular, it is hoped that these examples will help you to get started.

Example Name Comments Image PBR_Anisotropy Render spheres with different anisotropy values. PBR_Clear_Coat Render a cube with custom texture mapping and a coat normal texture. PBR_Edge_Tint Render spheres with different edge colors using a skybox as image based lighting. PBR_HDR_Environment Renders spheres with different materials using a skybox as image based lighting. PBR_Mapping Render a cube with custom texture mapping. PBR_Materials Renders spheres with different materials using a skybox as image based lighting. PBR_Materials_Coat Render spheres with different coat materials using a skybox as image based lighting. PBR_Skybox Demonstrates physically based rendering, a skybox and image based lighting. PBR_Skybox_Texturing Demonstrates physically based rendering, a skybox, image based lighting and texturing. PBR_Skybox_Anisotropy Demonstrates physically based rendering, a skybox, image based lighting, and anisotropic texturing."},{"location":"PythonHowTo/#polydata","title":"Polydata","text":"Example Name Comments Image ReadPolyData This snippet works for most PolyData."},{"location":"PythonHowTo/#random","title":"Random","text":"

If you want to ensure that the same random points/colors are used in C++ and other languages then it is best to use vtkMinimalStandardRandomSequence.

Example Name Comments Image HighlightWithSilhouette Here we use randomly positioned spheres with random colors. A vtkLookupTable is filled with random colors."},{"location":"PythonHowTo/#render-windows","title":"Render Windows","text":"Example Name Comments Image Model Multiple render windows."},{"location":"PythonHowTo/#searching-for-relevant-examples","title":"Searching for relevant examples?","text":"Example Name Comments Image SelectExamples Given a VTK Class and a language, select the matching examples."},{"location":"PythonHowTo/#structureddataset","title":"StructuredDataset","text":"

How to visualise the information in a structured dataset. All these examples use the combustor dataset.

Example Name Comments Image CombustorIsosurface Generate an isosurface of constant flow density. CutStructuredGrid Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. ProbeCombustor Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. PseudoVolumeRendering Here we use 100 cut planes, each with an opacity of 0.05. They are then rendered back-to-front to simulate volume rendering. Rainbow Using different vtkLookupTables. StreamLines Seed streamlines with vectors from a structured grid. StreamlinesWithLineWidget Interact with the streamlines in the combustor dataset. VelocityProfile Warping the geometry of three planes to show flow momentum. WarpCombustor Carpet plots of combustor flow energy in a structured grid. Colors and plane displacement represent energy values."},{"location":"PythonHowTo/#transforms","title":"Transforms","text":"Example Name Comments Image Frog This code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder."},{"location":"PythonicAPI/","title":"PythonicAPI Examples","text":"

These examples use the improved VTK Python interface.

The examples here are either newly crafted ones or upgraded existing Python examples using the improved VTK Python interface.

See More Pythonic VTK wrapping for the VTK Discourse discussion and Wrap VTK properties to pythonic properties with snake_case names for the merge request.

"},{"location":"PythonicAPI/#upgrading-an-existing-example-to-use-the-improved-vtk-python-interface","title":"Upgrading an existing example to use the improved VTK Python interface","text":"
  1. Copy the example from the src/Python folder into the src/PythonicAPI folder maintaining the same path structure. If there is a corresponding markdown file, copy it.
  2. Copy the corresponding test image from src/Testing/Baseline/Python/ into src/Testing/Baseline/PythonicAPI/
  3. Edit src/PythonicAPI.md, possibly creating a table and headings to match the original example in src/Python.
  4. Upgrade the Python example.
  5. The associated markdown file (if any) may need checking to ensure any links in the document remain valid.
  6. Check everything is working and do a Merge Request.
"},{"location":"PythonicAPI/#adding-a-new-example","title":"Adding a new example","text":"

Follow the documented procedure ForDevelopers remembering that the folder to use is PythonicAPI.

"},{"location":"PythonicAPI/#vtk-classes-summary","title":"VTK Classes Summary","text":"

This Python script, SelectExamples, will let you select examples based on a VTK Class and language. It requires Python 3.7 or later. The following tables will produce similar information.

  • VTK Classes with Examples, this table is really useful when searching for example(s) using a particular class.

  • VTK Classes with No Examples, please add examples in your area of expertise!

"},{"location":"PythonicAPI/#hello-world","title":"Hello World","text":"Example Name Description Image A hello world example Cylinder example from the VTK Textbook and source code. A hello world example."},{"location":"Trame/","title":"Trame Examples","text":"

Trame is a web framework that weaves together open source components into customized visual analytics easily. It uses the VTK and ParaView platforms as its core, trame provides complete control of 3D visualizations and data movements.

To familiarize yourself, this tutorial, will teach you

  • how to setup virtual environments in Python for trame
  • how to run an application
  • how to build applications.

The example applications here are available as tarballs that you download and open on your computer. Once this is done, you will be able to interact with, and also modify, the application.

"},{"location":"Trame/#vtk-examples","title":"VTK Examples","text":""},{"location":"Trame/#applications","title":"Applications","text":"Example Name Description Image FiniteElementAnalysis Finite element analysis. Multi Filter A multi filter example using VTK. RemoteSelection How to select a data file remotely."},{"location":"Trame/#miniapps","title":"MiniApps","text":"Example Name Description Image SimpleCone Demonstrate basic usage of trame with VTK."},{"location":"Trame/#advanced","title":"Advanced","text":""},{"location":"Trame/#paraview-examples","title":"ParaView Examples","text":""},{"location":"Trame/#applications_1","title":"Applications","text":""},{"location":"Trame/#miniapps_1","title":"MiniApps","text":""},{"location":"Trame/#advanced_1","title":"Advanced","text":""},{"location":"VTKBook/","title":"VTK Textbook Updates","text":"

Warning

This is a work in progress.

We are pleased to provide an update on efforts to update the online resources for the fourth edition of the VTK textbook

"},{"location":"VTKBook/#the-three-efforts","title":"The Three Efforts","text":"

There are three coordinated efforts ongoing each with a different goal. Currently, none of the efforts will rewrite sections of the fourth edition. These are the first steps to a possible fifth edition, but that effort will require significant resources.

  • The printed and free online PDF of the VTK textbook is the gold standard for this edition. The online PDF is a low-resolution version that exhibits some difficulty converting equations. It is available as one, down-loadable PDF with no active links. FrameMaker produces the PDF from FrameMaker files capable of producing different PDF resolutions. Editing the FrameMaker files requires a license from Adobe. It is unlikely the VTK community will have access to these proprietary files. Major contributors include Will Schroeder and other Kitware employees. See the PDF here.

  • A VTK LaTeX version of the VTK textbook is a work-in-progress effort. The goal is to produce a version populated with links to figures, references, equations, examples, etc. The PDF version is down-loadable as a single file. The figures that exist as VTK Examples are linked to the nightly output of the regression testing. Once this work is stable, the user community will be able to push merge requests to fix problems with the Latex. The major contributor is Andrew Maclean. You can follow the progress here.

  • A markdown version of the VTK textbook is also a work-in-progress. The goal is to produce an interactive, platform friendly version of the book. The entire text is available on as a Chapter by Chapter web site. The figures that exist as VTK Examples are linked to the nightly output of the regression testing. Once this work is stable, the user community will be able to push merge requests to fix problems with the markdown. The major contributors are Bill Lorensen and Bernhard Meehan. Bernhard has produced Latex for all 100 equations in the text. You can follow the progress here and other chapters.

"},{"location":"VTKBook/#the-markdown-effort","title":"The Markdown Effort","text":"

The markdown chapters started with the textbook PDF. We used a PDF to HTML Converter followed by an HTML to Markdown converter. The resulting Markdown file requires lots of hand editing, but much of this editing is repetitive. For the most part we did not edit the text. This means that Tcl in-line code still remains. Also API changes and new features in VTK are not included. A rewrite of the text is a much larger effort and may happen in the future.

We did add code to link figure references to the figures. We used a set of standard templates to caption the figures. We also link all references to VTK classes to their Doxygen documentation.

We handle two special cases:

1) Equations - Berhdard Meehan encoded all of the 100 equations in the text into Latex equations.

2) Figures - We used the VTKBookFigures to populate all of the figures generated by C++ or Tcl examples. Since Tcl is no longer supported, We translated the Tcl to C++ and Python. Also, Andrew Maclean created Python examples for all of the VTKBookFigures. Some figures do not have associated code, so we captured those figures from the PDF using screen captures.

"},{"location":"VTKBookFigures/","title":"VTK Book Figure Examples","text":"

The Visualization Toolkit Text Book was first published in 1995. At that time, the book was unique. It presented the theory behind computer graphics and visualization algorithms. It also provided a free C++ toolkit called VTK. Each theory chapter of the book wrapped up with a section called Putting It All Together. These sections provided examples using the VTK software. The examples were written in C++ or Tcl. As VTK matured, the Application Programming Interface (API) also matured. For example, today, C++ and Python are the preferred languages, although Java is still available. Tcl is no longer supported. Although the VTK software has always been free, until recently the VTK Book was only available commercially. Now, the book, like the software, is also free. View or download the book here.

Even though the book is over 20 years old, the concepts in the book are still relevant. The dozens of examples in the book are also still valuable for learning and using VTK. We have begun an effort to convert all of the examples in the book into C++ and present them Chapter by Chapter. These examples supplement the hundreds of examples on the VTK Examples web site.

Since some of the API's have changed, the new implementations may differ from those in the book. Also, since Tcl used less frequently, the examples have been converted to C++. The examples are also enhanced by newer VTK features, like vtkNamedColors and vtkSmartPointer.

Each Figure example

  1. links to the source code of the new implementation,

  2. links to the doxygen documentation for classes demonstrated,

  3. shows the original figure caption and,

  4. if the example produces an image, links to the full resolution image. If the caption includes a source file reference, e.g. bluntStr.cxx or rotations.tcl, that reference links to the original source code.

  5. if there is a corresponding Python example, a link to that example follows the figure line.

Please enjoy this new effort to revive and maintain the VTK Figure examples.

"},{"location":"VTKBookFigures/#chapter-3-computer-graphics","title":"Chapter 3 - Computer Graphics","text":"Figure Caption Image Figure 3-7 Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look. Figure 3-10 Effects of specular coefficients. Specular coefficients control the apparent \u201cshininess\u201d of objects. The top row has a specular intensity value of 0.5; the bottom row 1.0. Along the horizontal direction the specular power changes. The values (from left to right) are 5, 10, 20, and 40 (SpecularSpheres.cxx). Figure 3-12 Camera movements around focal point (camera.tcl). Figure 3-13 Camera movements centered at camera position (camera2.tcl). Figure 3-24 Illustrative diagram of graphics objects (Model.cxx). Figure 3-26 Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source. Other polygonal source objects are available; check subclasses of vtkPolyDataAlgorithm. Figure 3-27 Four frames of output from Cone3.cxx. Figure 3-28 Modifying properties and transformation matrix (Cone4.cxx) Figure 3-31 Rotations of a cow about her axes. In this model, the x axis is from the left to right; the y axis is from bottom to top; and the z axis emerges from the image. The camera location is the same in this and the following four images (rotations.tcl). Figure 3-31a Perform six rotations of a cow about her x-axis. Figure 3-31b Perform six rotations of a cow about her y-axis. Figure 3-31c Perform six rotations of a cow about her z-axis. Figure 3-31d First a rotation of a cow about her x-axis, then six rotations about her y-axis. Figure 3-32 The cow \"walking\" around the global origin (walkCow.tcl). Figure 3-33a The cow rotating about a vector passing through her nose. (a) With origin (0,0,0). (walkCow.tcl). Figure 3-33b The cow rotating about a vector passing through her nose. (b) With origin at (6.1,1.3,.02). (walkCow.tcl)."},{"location":"VTKBookFigures/#chapter-4-the-visualization-pipeline","title":"Chapter 4 - The Visualization Pipeline","text":"Figure Caption Image Figure 4\u20131 Visualizing a quadric function (Sample.cxx) Figure 4-13 Importing and exporting files in VTK. An importer creates a vtkRenderWindow that describes the scene. Exporters use an instance of vtkRenderWindow to obtain a description of the scene (3dsToRIB.tcl) and (flamingo.tcl). Figure 4-19 A simple sphere (ColorSph.cxx). Figure 4-20 The addition of a transform filter to the previous example. (StrSph.cxx). Figure 4-21 An example of multiple inputs and outputs (Mace.cxx). Figure 4-22 A network with a loop. VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK. (LoopShrk.cxx)."},{"location":"VTKBookFigures/#chapter-5-basic-data-representation","title":"Chapter 5 - Basic Data Representation","text":"Figure Caption Image Figure 5-17 Creation of polygonal cube (Cube.cxx). Figure 5-18 Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26 x 26 x 26 (Vol.cxx). Figure 5-19 Creating a structured grid dataset of a semi-cylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction (SGrid.cxx). Figure 5-20 Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray (RGrid.cxx). Figure 5-21 Creation of an unstructured grid (UGrid.cxx)."},{"location":"VTKBookFigures/#chapter-6-fundamental-algorithms","title":"Chapter 6 - Fundamental Algorithms","text":"Figure Caption Image Figure 6-6 Marching cubes cases for 3D isosurface generation. The 256 possible cases have been reduced to 15 cases using symmetry. Dark vertices are greater than the selected isosurface value. Figure 6-9a Marching cubes, case 3 is rotated 90 degrees about the y-axis with no label. Figure 6-9b Marching cubes, case 7 is rotated 180 degrees about the y-axis with no label. Figure 6-10 Marching cubes complementary cases. Cases 3c, 6c, 7c, 10c, 12c and 13c are displayed. Figure 6-11a Contouring examples. (a) Marching squares used to generate contour lines (headSlic.tcl). Also see FlyingHeadSlice (cxx) and FlyingHeadSlice (Python) Figure 6-11b Contouring examples. (b) Marching cubes surface of human bone (headBone.tcl). Figure 6-11c Contouring examples. (c) Marching cubes surface of flow density (combIso.tcl). Figure 6-11d Contouring examples. (d) Marching cubes surface of iron-protein (ironPIso.tcl). Figure 6-12 Computing scalars using normalized dot product. Bottom half of figure illustrates technique applied to terrain data from Honolulu, Hawaii (hawaii.tcl). Figure 6-13 Vector visualization techniques: (a) oriented lines; (b) using oriented glyphs; (c) complex vector visualization (complexV.tcl). Figure 6-14a Warping geometry to show vector field: (a) Beam displacement (vib.tcl). Figure 6-14b Warping geometry to show vector field: (b) Flow momentum (velProf.tcl). Figure 6-15b Vector displacement plots. (b) Surface plot of vibrating plate. Dark areas show nodal lines. Bright areas show maximum motion (dispPlot.tcl). Figure 6-18 Flow velocity computed for a small kitchen (top and side view). Forty streamlines start along the rake positioned under the window. Some eventually travel over the hot stove and are convected upwards (Kitchen.cxx). Figure 6-19 Dashed streamlines around a blunt fin. Each dash is a constant time increment. Fast moving particles create longer dashes than slower moving particles. The streamlines also are colored by flow density scalar (bluntStr.cxx). Figure 6-22a Tensor visualization techniques; (a) Tensor axes TenAxes.tcl Figure 6-22b Tensor visualization techniques; (b) Tensor ellipsoids TenEllip.tcl Figure 6-23b Sampling functions: (b) Isosurface of sampled sphere (sphere.tcl). Figure 6-23c Sampling functions: (b) Isosurface of sampled sphere; (c) Boolean combination of two spheres, a cone, and two planes. (One sphere intersects the other, the planes clip the cone.) (iceCream.tcl). Figure 6-24b Implicit functions used to select data: (b) Two ellipsoids combined using the union operation used to select voxels from a volume. Voxels shrunk 50 percent (extractD.tcl). Figure 6-25 Visualizing a Lorenz strange attractor by integrating the Lorenz equations in a volume. The number of visits in each voxel is recorded as a scalar function. The surface is extracted via marching cubes using a visit value of 50. The number of integration steps is 10 million, in a volume of dimensions 200 3 . The surface roughness is caused by the discrete nature of the evaluation function (Lorenz.cxx) Figure 6-28 Implicit modelling used to thicken a stroked font. Original lines can be seen within the translucent implicit surface ((hello.tcl). Figure 6-3 Flow density colored with different lookup tables. Top-left: grayscale; Top-right rainbow (blue to red); lower-left rainbow (red to blue); lower-right large contrast (rainbow.tcl). Figure 6-30 Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected (spikeF.tcl). Figure 6-31 Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison (cut.tcl). The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. Figure 6-32 100 cut planes with opacity of 0.05. Rendered back-to-front to simulate volume rendering (PseudoVolumeRendering.tcl). Figure 6-33 Cutting a surface model of the skin with a series of planes produces contour lines (cutModel.tcl). Lines are wrapped with tubes for visual clarity. Figure 6-39 Contouring quadric function. Pipeline topology, C++ code, and resulting image are shown (contQuad.cxx). Figure 6-43 Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude. The code fragment shown is from the Tcl script thrshldV.tcl and shows creation of vector glyphs. Figure 6-44 Visualizing blood flow in the human carotid arteries. Streamtubes of flow vectors (streamV.tcl)."},{"location":"VTKBookFigures/#chapter-7-advanced-computer-graphics","title":"Chapter 7 - Advanced Computer Graphics","text":"Figure Caption Image Figure 7-3 One frame from a vector field animation using texture maps (animVectors.tcl). Figure 7-33 Example of texture mapping (TPlane.tcl). Figure 7-34 Volume rendering of a high potential iron protein (SimpleRayCast.tcl). Figure 7-36 Example of motion blur (MotBlur.cxx). Figure 7-37 Example of a scene rendered with focal depth (CamBlur.cxx). Figure 7-39 Using the vtkLineWidget to produce streamlines in the combustor dataset. The StartInteractionEvent turns the visibility of the streamlines on; the InteractionEvent causes the streamlines to regenerate themselves (LineWidget.tcl)."},{"location":"VTKBookFigures/#chapter-8-advanced-data-representation","title":"Chapter 8 - Advanced Data Representation","text":"Figure Caption Image Figure 8-41a (a) Linearly extruded fonts to show letter frequency in text (alphaFreq.cxx). Figure 8-41b (b) Rotationally symmetric objects(bottle.tcl). Figure 8-41c (c) Rotation in combination with linear displacement and radius variation (spring.tcl)."},{"location":"VTKBookFigures/#chapter-9-advanced-algorithms","title":"Chapter 9 - Advanced Algorithms","text":"Figure Caption Image Figure 9-4a Carpet plots. (a) Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values (expCos.cxx). Figure 9-4b Carpet plots. (b) Carpet plot of combustor flow energy in a structured grid. Colors and plane displacement represent energy values (warpComb.tcl). Figure 9-10 A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles (createBFont.tcl). Figure 9-12d The stream polygon. (d) Sweeping polygon to form tube (officeTube.tcl) . Figure 9-15 Example of hyperstreamlines (Hyper.tcl). The four hyperstreamlines shown are integrated along the minor principle stress axis. A plane (colored with a different lookup table) is also shown. Figure 9-19 Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter (probeComb.tcl). Figure 9-21 Triangle strip examples. (a) Structured triangle mesh consisting of 134 strips each of 390 triangles (stripF.tcl). (b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip (uStripeF.tcl). Figure 9-24 Surface normal generation. (a) Faceted model without normals. (b)Polygons must be consistently oriented to accurately compute normals. (c)Sharp edges are poorly represented using shared normals as shown on the corners of this model. (d) Normal generation with sharp edges split (Normals.cxx). Figure 9-27a Examples of decimation algorithm. (a) Decimation of laser digitizer data (deciFran.tcl). Figure 9-27b Examples of decimation algorithm. (b) Decimation of terrain data (deciHawa.tcl). Figure 9-38a Elliptical splatting. (a) Single elliptical splat with eccentricity E=10. Cone shows orientation of vector (singleSplat.cxx). Figure 9-38b Elliptical splatting. (b) Surface reconstructed using elliptical splats into 100 3 volume followed by isosurface extraction. Points regularly subsampled and overlaid on original mesh (splatFace.tcl). Figure 9-43a Examples of texture thresholding. (a) Using scalar threshold to show values of flow density on planes for various values (texThresh.tcl). Figure 9-43b Examples of texture thresholding. (b) Boolean combination of two planes to cut nested spheres (tcutSph.cxx). Figure 9-45b (b) Sixteen boolean textures applied to sphere (quadricCut.cxx). Figure 9-47a Using random point seeds to create streamlines (office.tcl). Figure 9-47b Using random point seeds to create streamlines (office.tcl). Figure 9-48 A plane clipped with a sphere and an ellipse. The two transforms place each implicit function into the appropriate position. Two outputs are generated by the clipper. (clipSphCyl.tcl). Figure 9-50 Visualization of multidimensional financial data. (finance.cxx). The gray/wireframe surface represents the total data population. The red surface represents data points delinquent on loan payment. Figure 9-51a The isosurface, with no connectivity filter applied connPineRoot.tcl. Data is from 256^3 volume data of the root system of a pine tree. Figure 9-51b The isosurface after applying the connectivity filter to remove noisy isosurfaces connPineRoot.tcl. Data is from 256^3 volume data of the root system of a pine tree. Figure 9-52a The isosurface after applying the connectivity filter to remove noisy isosurfaces and reduce data size connPineRoot.tcl. Data is from 256^3 volume data of the root system of a pine tree. Figure 9-52b The isosurface after applying the decimation and connectivity filters to remove noisy isosurfaces and reduce data size deciPineRoot.tcl. Data is from 256^3 volume data of the root system of a pine tree. Figure 9-53 Texture cut used to reveal internal structure of a motor. Two cut planes are used in combination with transparent texture (motor.tcl). Figure 9-54 Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes (DelMesh.tcl) . Only the pipeline to generate triangulation is shown."},{"location":"VTKBookFigures/#chapter-10-image-processing","title":"Chapter 10 - Image Processing","text":"Figure Caption Image Figure 10-3 Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise (MedianComparison..tcl) Figure 10-4 Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. hybrid median (HybridMedianComparison.tcl. Figure 10-5 This figure demonstrates aliasing that occurs when a high-frequency signal is subsampled. High frequencies appear as low frequency artifacts. The lower left image is an isosurface of a skull after subsampling. The right image used a low-pass filter before subsampling to reduce aliasing (IsoSubsample.tcl). Figure 10-6 This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. (Attenuation.tcl).. Figure 10-9 High-pass filters can extract and enhance edges in an image. Subtraction of the Laplacian (middle) from the original image (left) results in edge enhancement or a sharpening operation (right) (EnhanceEdges.tcl). Figure 10-10 The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This figure show an image and its power spectrum displayed using a logarithmic transfer function (VTKSpectrum.tcl). Figure 10-11 This figure shows two high-pass filters in the frequency domain. The Butterworth high-pass filter has a gradual attenuation that avoids ringing produced by the ideal high-pass filter with an abrupt transition (IdealHighPass.tcl). Figure 10-12 Convolution in frequency space treats the image as a periodic function. A large kernel can pick up features from both sides of the image. The lower-left image has been padded with zeros to eliminate wraparound during convolution. On the right, mirror padding has been used to remove artificial edges introduced by borders (Pad.tcl). Figure 10-14 This figure demonstrates various binary filters that can alter the shape of segmented regions (MorphComparison.tcl). Figure 10-16 An imaging pipeline to visualize gradient information. The gradient direction is mapped into color hue value while the gradient magnitude is mapped into the color saturation (ImageGradient.tcl). Figure 10-17 Combining the imaging and visualization pipelines to deform an image in the z-direction (imageWarp.tcl). The vtkMergeFilter is used to combine the warped surface with the original color data. Figure 10-2 Low-pass filters can be implemented as convolution with a Gaussian kernel. (GaussianSmooth.tcl)."},{"location":"VTKBookFigures/#chapter-12-applications","title":"Chapter 12 - Applications","text":"Figure Caption Image Figure 12-2 The skin extracted from a CT dataset of the head (Medical1.cxx). Figure 12-3 Skin and bone isosurfaces (Medical2.cxx). Figure 12-4 Composite image of three planes and translucent skin Medical3.cxx. Figure 12-6 Photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow (frogSlice.tcl). Figure 12-7 The frog\u2019s brain. Model extracted without smoothing (left) and with smoothing (right). Figure 12-9a-d All frog parts and translucent skin. This script generates all four images. Figure 12-11 Two views from the stock visualization script. The top shows closing price over time; the bottom shows volume over time (stocks.tcl). Figure 12-13 A logo created with vtkImplicitModeller (vtkLogo.cxx). Figure 12-14 Portion of computational grid for the LOx post (LOxGrid.tcl). Figure 12-15 Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown. Figure 12-16 Streamtubes created by using the computational grid just in front of the post as a source for seeds (LOx.tcl). Figure 12-17 Ten frames from a blow molding finite element analysis. Mold halves (shown in wireframe) are closed around a parison as the parison is inflated. Coloring indicates thickness\u2014red areas are thinner than blue (blow.tcl) Figure 12-20a Towers of Hanoi. (a) Initial configuration. Figure 12-20b Towers of Hanoi. (b) Intermediate configuration. Figure 12-20c Towers of Hanoi. (c) Final configuration Hanoi.cxx."},{"location":"VTKFileFormats/","title":"VTK File Formats","text":"

For the latest information relating to the VTK File formats, please refer to this link: VTK File Formats.

"},{"location":"CSharp/Coverage/CSharpVTKClassesNotUsed/","title":"VTK Classes not used in the Examples","text":""},{"location":"CSharp/Coverage/CSharpVTKClassesNotUsed/#csharp","title":"CSharp","text":"

Out of 3113 available VTK classes, 2923 have not been used.

VTK Class VTK Class VTK Class VTK Class VTK Class vtk2DHistogramItem vtk3DCursorRepresentation vtk3DCursorWidget vtk3DLinearGridCrinkleExtractor vtk3DLinearGridInternal vtk3DLinearGridPlaneCutter vtk3DSImporter vtk3DWidget vtkABI vtkADIOS2CoreImageReader vtkADIOS2VTXReader vtkAMRBaseParticlesReader vtkAMRBaseReader vtkAMRBox vtkAMRCutPlane vtkAMRDataInternals vtkAMRDataSetCache vtkAMREnzoParticlesReader vtkAMREnzoReader vtkAMREnzoReaderInternal vtkAMRFlashParticlesReader vtkAMRFlashReader vtkAMRFlashReaderInternal vtkAMRGaussianPulseSource vtkAMRInformation vtkAMRInterpolatedVelocityField vtkAMRResampleFilter vtkAMRSliceFilter vtkAMRToMultiBlockFilter vtkAMRUtilities vtkAMRVelodyneReader vtkAMRVelodyneReaderInternal vtkAMRVolumeMapper vtkAMReXGridHeader vtkAMReXGridLevelHeader vtkAMReXGridReader vtkAMReXGridReaderInternal vtkAMReXParticlesReader vtkAOSDataArrayTemplate vtkASCIITextCodec vtkAVIWriter vtkAVSucdReader vtkAbstractArray vtkAbstractCellArray vtkAbstractCellLinks vtkAbstractCellLocator vtkAbstractContextBufferId vtkAbstractContextItem vtkAbstractElectronicData vtkAbstractGridConnectivity vtkAbstractHyperTreeGridMapper vtkAbstractImageInterpolator vtkAbstractInteractionDevice vtkAbstractInterpolatedVelocityField vtkAbstractMapper vtkAbstractMapper3D vtkAbstractParticleWriter vtkAbstractPicker vtkAbstractPointLocator vtkAbstractPolyDataReader vtkAbstractPolygonalHandleRepresentation3D vtkAbstractPropPicker vtkAbstractRenderDevice vtkAbstractSplineRepresentation vtkAbstractTransform vtkAbstractVolumeMapper vtkAbstractWidget vtkActor2DCollection vtkActorCollection vtkActorNode vtkAdaptiveDataSetSurfaceFilter vtkAdaptiveResampleToImage vtkAdaptiveSubdivisionFilter vtkAdaptiveTemporalInterpolator vtkAddMembershipArray vtkAdjacencyMatrixToEdgeTable vtkAdjacentVertexIterator vtkAffineRepresentation vtkAffineRepresentation2D vtkAffineWidget vtkAggregateDataSetFilter vtkAggregateToPartitionedDataSetCollection vtkAlembicExporter vtkAlgorithm vtkAlgorithmOutput vtkAlignImageDataSetFilter vtkAmoebaMinimizer vtkAnariActorNode vtkAnariCameraNode vtkAnariCompositePolyDataMapperNode vtkAnariFollowerNode vtkAnariLightNode vtkAnariPass vtkAnariPolyDataMapperNode vtkAnariProfiling vtkAnariRendererNode vtkAnariTestInteractor vtkAnariViewNodeFactory vtkAnariVolumeInterface vtkAnariVolumeMapper vtkAnariVolumeMapperNode vtkAnariVolumeNode vtkAnariWindowNode vtkAndroidOutputWindow vtkAndroidRenderWindowInteractor vtkAngleRepresentation vtkAngleRepresentation2D vtkAngleRepresentation3D vtkAngleWidget vtkAngularPeriodicDataArray vtkAngularPeriodicFilter vtkAnimateModes vtkAnimationCue vtkAnimationScene vtkAnnotatedCubeActor vtkAnnotation vtkAnnotationLayers vtkAnnotationLayersAlgorithm vtkAnnotationLink vtkAppendArcLength vtkAppendCompositeDataLeaves vtkAppendDataSets vtkAppendFilter vtkAppendLocationAttributes vtkAppendPartitionedDataSetCollection vtkAppendPoints vtkAppendSelection vtkApplyColors vtkApplyIcons vtkApproximatingSubdivisionFilter vtkArcGridActorPrivate vtkArcParallelEdgeStrategy vtkArcPlotter vtkArcSource vtkArchiver vtkAreaContourSpectrumFilter vtkAreaLayout vtkAreaLayoutStrategy vtkAreaPicker vtkArray vtkArrayCalculator vtkArrayCoordinates vtkArrayData vtkArrayDataAlgorithm vtkArrayDataReader vtkArrayDataWriter vtkArrayDispatch vtkArrayExtents vtkArrayExtentsList vtkArrayInterpolate vtkArrayIterator vtkArrayIteratorIncludes vtkArrayIteratorTemplate vtkArrayListTemplate vtkArrayNorm vtkArrayPrint vtkArrayRange vtkArrayReader vtkArrayRename vtkArrayRenderer vtkArraySort vtkArrayToTable vtkArrayWeights vtkArrayWriter vtkAssembly vtkAssemblyNode vtkAssemblyPath vtkAssemblyPaths vtkAssignAttribute vtkAssignCoordinates vtkAssignCoordinatesLayoutStrategy vtkAtom vtkAtomicMutex vtkAttributeClustering2DLayoutStrategy vtkAttributeDataToFieldDataFilter vtkAttributeDataToTableFilter vtkAttributeSmoothingFilter vtkAttributesErrorMetric vtkAutoCorrelativeStatistics vtkAvatar vtkAxes vtkAxesTransformRepresentation vtkAxesTransformWidget vtkAxis vtkAxisActor vtkAxisActor2D vtkAxisActor2DMock vtkAxisExtended vtkAxisFollower vtkAxisGridActorPrivate vtkBSPCuts vtkBSPIntersections vtkBSplineTransform vtkBTSReader vtkBYUReader vtkBYUWriter vtkBackgroundColorMonitor vtkBalloonRepresentation vtkBalloonWidget vtkBarChartActor vtkBase64InputStream vtkBase64OutputStream vtkBase64Utilities vtkBatchedSurfaceLICMapper vtkBatches vtkBezierContourLineInterpolator vtkBezierCurve vtkBezierHexahedron vtkBezierInterpolation vtkBezierQuadrilateral vtkBezierTetra vtkBezierTriangle vtkBezierWedge vtkBiDimensionalRepresentation vtkBiDimensionalRepresentation2D vtkBiDimensionalWidget vtkBiQuadraticQuad vtkBiQuadraticQuadraticHexahedron vtkBiQuadraticQuadraticWedge vtkBiQuadraticTriangle vtkBilinearQuadIntersection vtkBillboardTextActor3D vtkBinCellDataFilter vtkBinnedDecimation vtkBiomTableReader vtkBitArray vtkBitArrayIterator vtkBivariateLinearTableThreshold vtkBlankStructuredGrid vtkBlankStructuredGridWithImage vtkBlockDistribution vtkBlockIdScalars vtkBlockItem vtkBlockSelector vtkBlueObeliskData vtkBlueObeliskDataParser vtkBond vtkBooleanOperationPolyDataFilter vtkBooleanTexture vtkBoostBetweennessClustering vtkBoostBiconnectedComponents vtkBoostBrandesCentrality vtkBoostBreadthFirstSearch vtkBoostBreadthFirstSearchTree vtkBoostConnectedComponents vtkBoostDividedEdgeBundling vtkBoostExtractLargestComponent vtkBoostKruskalMinimumSpanningTree vtkBoostLogWeighting vtkBoostPrimMinimumSpanningTree vtkBoostRandomSparseArraySource vtkBoostSplitTableField vtkBorderRepresentation vtkBorderWidget vtkBoundaryMeshQuality vtkBoundedPlanePointPlacer vtkBoundedPointSource vtkBoundingBox vtkBox vtkBoxClipDataSet vtkBoxLayoutStrategy vtkBoxMuellerRandomSequence vtkBoxRepresentation vtkBoxWidget vtkBoxWidget2 vtkBreakPoint vtkBrokenLineWidget vtkBrownianPoints vtkBrush vtkBuffer vtkBufferedArchiver vtkButtonRepresentation vtkButtonSource vtkButtonWidget vtkByteSwap vtkCGMWriter vtkCGNSCache vtkCGNSFileSeriesReader vtkCGNSReader vtkCGNSReaderInternal vtkCMLMoleculeReader vtkCONVERGECFDCGNSReader vtkCONVERGECFDReader vtkCPExodusIIElementBlock vtkCPExodusIIElementBlockCellIterator vtkCPExodusIIElementBlockImpl vtkCPExodusIIInSituReader vtkCPExodusIINodalCoordinatesTemplate vtkCPExodusIIResultsArrayTemplate vtkCachedStreamingDemandDrivenPipeline vtkCallbackCommand vtkCamera3DRepresentation vtkCamera3DWidget vtkCameraActor vtkCameraHandleSource vtkCameraInterpolator vtkCameraNode vtkCameraOrientationRepresentation vtkCameraOrientationWidget vtkCameraPass vtkCameraPathRepresentation vtkCameraPathWidget vtkCameraRepresentation vtkCameraWidget vtkCapsuleSource vtkCaptionActor2D vtkCaptionRepresentation vtkCaptionWidget vtkCardinalSpline vtkCastToConcrete vtkCategoryLegend vtkCell3D vtkCellArrayIterator vtkCellAttribute vtkCellAttributeCalculator vtkCellAttributeInformation vtkCellCenterDepthSort vtkCellCenters vtkCellCentersPointPlacer vtkCellData vtkCellDataToPointData vtkCellDerivatives vtkCellDistanceSelector vtkCellGraphicsPrimitiveMap vtkCellGrid vtkCellGridAlgorithm vtkCellGridBoundsQuery vtkCellGridComputeSurface vtkCellGridElevation vtkCellGridElevationQuery vtkCellGridEvaluator vtkCellGridIOQuery vtkCellGridMapper vtkCellGridPointProbe vtkCellGridQuery vtkCellGridRangeQuery vtkCellGridReader vtkCellGridRenderRequest vtkCellGridResponder vtkCellGridResponderBase vtkCellGridResponders vtkCellGridSidesQuery vtkCellGridWriter vtkCellIterator vtkCellLinks vtkCellLocator vtkCellLocatorStrategy vtkCellMetadata vtkCellPicker vtkCellQuality vtkCellSizeFilter vtkCellTreeLocator vtkCellType vtkCellTypeSource vtkCellTypes vtkCellValidator vtkCenterOfMass vtkCenteredSliderRepresentation vtkCenteredSliderWidget vtkCesium3DTilesReader vtkCesium3DTilesWriter vtkCesiumB3DMReader vtkCesiumPointCloudWriter vtkChacoGraphReader vtkChacoReader vtkCharArray vtkChart vtkChart2DHistogram vtkChartBox vtkChartHistogram2D vtkChartLegend vtkChartMatrix vtkChartParallelCoordinates vtkChartPie vtkChartXY vtkChartXYZ vtkCheckerboardRepresentation vtkCheckerboardSplatter vtkCheckerboardWidget vtkCirclePackFrontChainLayoutStrategy vtkCirclePackLayout vtkCirclePackLayoutStrategy vtkCirclePackToPolyData vtkCircularLayoutStrategy vtkCityGMLReader vtkCleanUnstructuredGrid vtkCleanUnstructuredGridCells vtkClearRGBPass vtkClearZPass vtkClientServerCompositePass vtkClientServerSynchronizedRenderers vtkClientSocket vtkClipClosedSurface vtkClipConvexPolyData vtkClipDataSet vtkClipVolume vtkClosedSurfacePointPlacer vtkClosestNPointsStrategy vtkClosestPointStrategy vtkClustering2DLayoutStrategy vtkCocoaMacOSXSDKCompatibility vtkCocoaRenderWindow vtkCocoaRenderWindowInteractor vtkCocoaTkUtilities vtkCoincidentPoints vtkCollapseGraph vtkCollapseVerticesByArray vtkCollectGraph vtkCollectPolyData vtkCollectTable vtkCollection vtkCollectionElement vtkCollectionIterator vtkCollisionDetectionFilter vtkColor vtkColor3 vtkColor3d vtkColor3f vtkColor3ub vtkColor4 vtkColor4d vtkColor4f vtkColor4ub vtkColorLegend vtkColorSeries vtkColorTransferControlPointsItem vtkColorTransferFunction vtkColorTransferFunctionItem vtkCommand vtkCommonInformationKeyManager vtkCommunicator vtkCommunity2DLayoutStrategy vtkCompassRepresentation vtkCompassWidget vtkCompositeCellGridMapper vtkCompositeCellGridReader vtkCompositeControlPointsItem vtkCompositeCutter vtkCompositeDataDisplayAttributes vtkCompositeDataDisplayAttributesLegacy vtkCompositeDataGeometryFilter vtkCompositeDataIterator vtkCompositeDataPipeline vtkCompositeDataProbeFilter vtkCompositeDataReader vtkCompositeDataSet vtkCompositeDataSetAlgorithm vtkCompositeDataWriter vtkCompositeImplicitBackend vtkCompositeInterpolatedVelocityField vtkCompositeMapperHelper2 vtkCompositeMapperHelperData vtkCompositePolyDataMapper vtkCompositePolyDataMapper2 vtkCompositePolyDataMapperDelegator vtkCompositeRGBAPass vtkCompositeRenderManager vtkCompositeSurfaceLICMapper vtkCompositeSurfaceLICMapperDelegator vtkCompositeTransferFunctionItem vtkCompositeZPass vtkCompositedSynchronizedRenderers vtkCompositer vtkCompressCompositer vtkComputeHistogram2DOutliers vtkComputeQuantiles vtkComputeQuartiles vtkConduitArrayUtilities vtkConduitSource vtkConduitToDataObject vtkCone vtkConeLayoutStrategy vtkConnectedPointsFilter vtkConnectivityFilter vtkConstrained2DLayoutStrategy vtkConstrainedPointHandleRepresentation vtkConstrainedSmoothingFilter vtkConsumerDataFilter vtkContext2D vtkContext3D vtkContextActor vtkContextArea vtkContextClip vtkContextDevice2D vtkContextDevice3D vtkContextInteractorStyle vtkContextItem vtkContextKeyEvent vtkContextMapper2D vtkContextMouseEvent vtkContextPolygon vtkContextScene vtkContextScenePrivate vtkContextTransform vtkContextView vtkContingencyStatistics vtkContinuousScatterplot vtkContinuousValueWidget vtkContinuousValueWidgetRepresentation vtkContour3DLinearGrid vtkContourGrid vtkContourHelper vtkContourLineInterpolator vtkContourLoopExtraction vtkContourRepresentation vtkContourRepresentationInternals vtkContourRepresentationNode vtkContourRepresentationPoint vtkContourTriangulator vtkContourValues vtkControlPointsItem vtkConvertSelection vtkConvertSelectionDomain vtkConvertToMultiBlockDataSet vtkConvertToPartitionedDataSetCollection vtkConvertToPointCloud vtkConvertToPolyhedra vtkConvexHull2D vtkConvexPointSet vtkCookieCutter vtkCoordinate vtkCoordinateFrame vtkCoordinateFrameRepresentation vtkCoordinateFrameWidget vtkCornerAnnotation vtkCorrelativeStatistics vtkCosmicTreeLayoutStrategy vtkCountFaces vtkCountVertices vtkCubeAxesActor vtkCubeAxesActor2D vtkCubicLine vtkCuller vtkCullerCollection vtkCursor2D vtkCursor3D vtkCurveRepresentation vtkCutMaterial vtkCylinder vtkCylindricalTransform vtkDGAttributeInformation vtkDGBoundsResponder vtkDGCell vtkDGEdge vtkDGElevationResponder vtkDGEvaluator vtkDGHex vtkDGIOResponder vtkDGInterpolateCalculator vtkDGPyr vtkDGQuad vtkDGRangeResponder vtkDGRenderResponder vtkDGSidesResponder vtkDGTet vtkDGTranscribeUnstructuredCells vtkDGTri vtkDGVert vtkDGWdg vtkDIMACSGraphReader vtkDIMACSGraphWriter vtkDIYAggregateDataSetFilter vtkDIYDataExchanger vtkDIYExplicitAssigner vtkDIYGhostUtilities vtkDIYKdTreeUtilities vtkDIYUtilities vtkDIYUtilitiesCleanup vtkDSPFilterDefinition vtkDSPFilterGroup vtkDataArray vtkDataArrayCollection vtkDataArrayCollectionIterator vtkDataArraySelection vtkDataAssembly vtkDataAssemblyUtilities vtkDataAssemblyVisitor vtkDataCompressor vtkDataEncoder vtkDataObjectAlgorithm vtkDataObjectCollection vtkDataObjectGenerator vtkDataObjectMeshCache vtkDataObjectReader vtkDataObjectToConduit vtkDataObjectToDataSetFilter vtkDataObjectToTable vtkDataObjectTree vtkDataObjectTreeIndex vtkDataObjectTreeInternals vtkDataObjectTreeIterator vtkDataObjectTypes vtkDataObjectWriter vtkDataReader vtkDataRepresentation vtkDataSetAlgorithm vtkDataSetAttributesFieldList vtkDataSetCellIterator vtkDataSetCollection vtkDataSetEdgeSubdivisionCriterion vtkDataSetGradient vtkDataSetGradientPrecompute vtkDataSetReader vtkDataSetRegionSurfaceFilter vtkDataSetToDataObjectFilter vtkDataSetTriangleFilter vtkDataSetWriter vtkDataTransferHelper vtkDataWriter vtkDatabaseToTableReader vtkDateToNumeric vtkDeRhamCell vtkDebugLeaks vtkDebugLeaksManager vtkDebugLeaksObserver vtkDecimatePolylineFilter vtkDefaultPass vtkDeflectNormals vtkDeformPointSet vtkDelaunay3D vtkDelimitedTextReader vtkDelimitedTextWriter vtkDemandDrivenPipeline vtkDendrogramItem vtkDenseArray vtkDensifyPointCloudFilter vtkDensifyPolyData vtkDependentDimensionInfo vtkDepthImageProcessingPass vtkDepthImageToPointCloud vtkDepthOfFieldPass vtkDepthPeelingPass vtkDepthSortPolyData vtkDescriptiveStatistics vtkDeserializer vtkDiagonalMatrixSource vtkDicer vtkDijkstraGraphInternals vtkDijkstraImageContourLineInterpolator vtkDijkstraImageGeodesicPath vtkDimensionInfo vtkDirectedAcyclicGraph vtkDirectedGraph vtkDirectedGraphAlgorithm vtkDirectionEncoder vtkDirectory vtkDiscreteFlyingEdges2D vtkDiscreteFlyingEdges3D vtkDiscreteFlyingEdgesClipper2D vtkDiscreteMarchingCubes vtkDiscretizableColorTransferFunction vtkDisplaySizedImplicitPlaneRepresentation vtkDisplaySizedImplicitPlaneWidget vtkDistancePolyDataFilter vtkDistanceRepresentation vtkDistanceRepresentation2D vtkDistanceRepresentation3D vtkDistanceToCamera vtkDistanceWidget vtkDistributedDataFilter vtkDistributedGraphHelper vtkDistributedPointCloudFilter vtkDotProductSimilarity vtkDrawTexturedElements vtkDualDepthPeelingPass vtkDummyCommunicator vtkDummyController vtkDummyGPUInfoList vtkDuplicatePolyData vtkDynamic2DLabelMapper vtkDynamicLoader vtkEDLShading vtkEGLRenderWindow vtkERFReader vtkEdgeCenters vtkEdgeLayout vtkEdgeLayoutStrategy vtkEdgeListIterator vtkEdgePoints vtkEdgeSubdivisionCriterion vtkEdgeTable vtkEllipseArcSource vtkEllipsoidTensorProbeRepresentation vtkEllipsoidalGaussianKernel vtkEllipticalButtonSource vtkEmptyCell vtkEmptyRepresentation vtkEnSight6BinaryReader vtkEnSight6Reader vtkEnSightGoldBinaryReader vtkEnSightGoldReader vtkEnSightMasterServerReader vtkEnSightReader vtkEnSightWriter vtkEncodedGradientEstimator vtkEncodedGradientShader vtkEndFor vtkEnsembleSource vtkEnzoReaderBlock vtkEnzoReaderInternal vtkEqualizerContextItem vtkEqualizerFilter vtkEquirectangularToCubeMapTexture vtkErrorCode vtkEuclideanClusterExtraction vtkEvenlySpacedStreamlines2D vtkEvent vtkEventData vtkEventDataDevice3D vtkEventDataForDevice vtkEventForwarderCommand vtkEventQtSlotConnect vtkExecutableRunner vtkExecutionAggregator vtkExecutionRange vtkExecutionTimer vtkExecutive vtkExodusIICache vtkExodusIICacheEntry vtkExodusIICacheKey vtkExodusIIReader vtkExodusIIReaderIntPointCheck vtkExodusIIReaderParser vtkExodusIIReaderPrivate vtkExodusIIReaderScalarCheck vtkExodusIIReaderTensorCheck vtkExodusIIReaderVariableCheck vtkExodusIIReaderVectorCheck vtkExodusIIWriter vtkExpandMarkedElements vtkExpandSelectedGraph vtkExplicitStructuredGrid vtkExplicitStructuredGridAlgorithm vtkExplicitStructuredGridCrop vtkExplicitStructuredGridSurfaceFilter vtkExplicitStructuredGridToUnstructuredGrid vtkExporter vtkExprTkFunctionParser vtkExtentRCBPartitioner vtkExtentSplitter vtkExtentTranslator vtkExternalLight vtkExternalOpenGLCamera vtkExternalOpenGLRenderWindow vtkExternalOpenGLRenderer vtkExtractArray vtkExtractBlock vtkExtractBlockUsingDataAssembly vtkExtractCTHPart vtkExtractCells vtkExtractCellsAlongPolyLine vtkExtractCellsByType vtkExtractDataArraysOverTime vtkExtractDataOverTime vtkExtractDataSets vtkExtractEnclosedPoints vtkExtractExodusGlobalTemporalVariables vtkExtractFunctionalBagPlot vtkExtractGeometry vtkExtractGhostCells vtkExtractGrid vtkExtractHierarchicalBins vtkExtractHistogram vtkExtractHistogram2D vtkExtractLevel vtkExtractParticlesOverTime vtkExtractPiece vtkExtractPointCloudPiece vtkExtractPoints vtkExtractPolyDataGeometry vtkExtractPolyDataPiece vtkExtractRectilinearGrid vtkExtractSelectedArraysOverTime vtkExtractSelectedFrustum vtkExtractSelectedGraph vtkExtractSelectedRows vtkExtractSelectedTree vtkExtractSelectionBase vtkExtractStructuredGridHelper vtkExtractSubsetWithSeed vtkExtractSurface vtkExtractTensorComponents vtkExtractTimeSteps vtkExtractUnstructuredGrid vtkExtractUnstructuredGridPiece vtkExtractUserDefinedPiece vtkExtractVOI vtkExtractVectorComponents vtkFDSReader vtkFFMPEGVideoSource vtkFFMPEGWriter vtkFFT vtkFLUENTCFFReader vtkFLUENTReader vtkFXAAOptions vtkFacetReader vtkFacetWriter vtkFast2DLayoutStrategy vtkFastSplatter vtkFiberSurface vtkFidesReader vtkFieldDataSerializer vtkFieldDataToAttributeDataFilter vtkFieldDataToDataSetAttribute vtkFileOutputWindow vtkFileResourceStream vtkFileSeriesHelper vtkFilteringInformationKeyManager vtkFiltersCellGrid vtkFindCellStrategy vtkFiniteDifferenceGradientEstimator vtkFiniteElementFieldDistributor vtkFinitePlaneRepresentation vtkFinitePlaneWidget vtkFitImplicitFunction vtkFitToHeightMapFilter vtkFixedPointRayCastImage vtkFixedPointVolumeRayCastCompositeGOHelper vtkFixedPointVolumeRayCastCompositeGOShadeHelper vtkFixedPointVolumeRayCastCompositeHelper vtkFixedPointVolumeRayCastCompositeShadeHelper vtkFixedPointVolumeRayCastHelper vtkFixedPointVolumeRayCastMIPHelper vtkFixedPointVolumeRayCastMapper vtkFixedSizeHandleRepresentation vtkFixedSizeHandleRepresentation3D vtkFixedWidthTextReader vtkFlagpoleLabel vtkFlashReaderInternal vtkFloatingPointExceptions vtkFlyingEdges2D vtkFlyingEdges3D vtkFlyingEdgesPlaneCutter vtkFocalPlaneContourRepresentation vtkFocalPlanePointPlacer vtkFollower vtkFontConfigFreeTypeTools vtkForEach vtkForceDirectedLayoutStrategy vtkForceStaticMesh vtkForceTime vtkFrameBufferObjectBase vtkFramebufferPass vtkFreeTypeLabelRenderStrategy vtkFreeTypeStringToImage vtkFreeTypeTools vtkFreeTypeToolsCleanup vtkFrustumCoverageCuller vtkFrustumSelector vtkFunctionParser vtkFunctionSet vtkGAMBITReader vtkGDAL vtkGDALRasterConverter vtkGDALRasterReader vtkGDALRasterReprojection vtkGDALVectorReader vtkGESignaReader vtkGL2PSExporter vtkGLSLModCamera vtkGLSLModCoincidentTopology vtkGLSLModLight vtkGLSLModPixelDebugger vtkGLSLModifierBase vtkGLSLModifierFactory vtkGLTFDocumentLoader vtkGLTFDocumentLoaderInternals vtkGLTFExporter vtkGLTFImporter vtkGLTFReader vtkGLTFTexture vtkGLTFWriter vtkGLTFWriterUtils vtkGPUInfo vtkGPUInfoList vtkGPUInfoListArray vtkGPUVolumeRayCastMapper vtkGarbageCollector vtkGarbageCollectorManager vtkGaussianBlurPass vtkGaussianCubeReader vtkGaussianCubeReader2 vtkGaussianKernel vtkGaussianRandomSequence vtkGaussianSplatter vtkGeneralTransform vtkGeneralizedKernel vtkGenerateGlobalIds vtkGenerateIndexArray vtkGenerateProcessIds vtkGenerateTimeSteps vtkGenericAdaptorCell vtkGenericAttribute vtkGenericAttributeCollection vtkGenericCell vtkGenericCellIterator vtkGenericCellTessellator vtkGenericClip vtkGenericContourFilter vtkGenericCutter vtkGenericDataArray vtkGenericDataArrayLookupHelper vtkGenericDataObjectReader vtkGenericDataObjectWriter vtkGenericDataSet vtkGenericDataSetTessellator vtkGenericEdgeTable vtkGenericEnSightReader vtkGenericGeometryFilter vtkGenericGlyph3DFilter vtkGenericImageInterpolator vtkGenericInterpolatedVelocityField vtkGenericMovieWriter vtkGenericOpenGLRenderWindow vtkGenericOpenGLResourceFreeCallback vtkGenericOutlineFilter vtkGenericPointIterator vtkGenericProbeFilter vtkGenericRenderWindowInteractor vtkGenericStreamTracer vtkGenericSubdivisionErrorMetric vtkGenericVertexAttributeMapping vtkGeoEdgeStrategy vtkGeoJSONFeature vtkGeoJSONReader vtkGeoJSONWriter vtkGeoMath vtkGeoProjection vtkGeoTransform vtkGeodesicPath vtkGeometricErrorMetric vtkGeometryFilter vtkGhostCellsGenerator vtkGlobFileNames vtkGlyph2D vtkGlyph3DMapper vtkGlyphSource2D vtkGradientFilter vtkGraph vtkGraphAlgorithm vtkGraphAnnotationLayersFilter vtkGraphEdge vtkGraphGeodesicPath vtkGraphHierarchicalBundleEdges vtkGraphInternals vtkGraphItem vtkGraphLayout vtkGraphLayoutFilter vtkGraphLayoutStrategy vtkGraphMapper vtkGraphReader vtkGraphToGlyphs vtkGraphToPoints vtkGraphToPolyData vtkGraphWeightEuclideanDistanceFilter vtkGraphWeightFilter vtkGraphWriter vtkGraphicsFactory vtkGridSynchronizedTemplates3D vtkGridTransform vtkGroupDataSetsFilter vtkGroupLeafVertices vtkGroupTimeStepsFilter vtkH5PartReader vtkH5RageReader vtkHDF5Helper vtkHDFReader vtkHDFReaderImplementation vtkHDFVersion vtkHDFWriter vtkHDFWriterImplementation vtkHDRReader vtkHandleRepresentation vtkHandleSource vtkHandleWidget vtkHardwarePicker vtkHardwareSelector vtkHardwareWindow vtkHausdorffDistancePointSetFilter vtkHeap vtkHeatmapItem vtkHedgeHog vtkHexagonalPrism vtkHiddenLineRemovalPass vtkHierarchicalBinningFilter vtkHierarchicalBoxDataSet vtkHierarchicalBoxDataSetAlgorithm vtkHierarchicalDataExtractDataSets vtkHierarchicalDataExtractLevel vtkHierarchicalDataLevelFilter vtkHierarchicalDataSetGeometryFilter vtkHierarchicalGraphPipeline vtkHierarchicalGraphView vtkHierarchicalPolyDataMapper vtkHigherOrderCurve vtkHigherOrderHexahedron vtkHigherOrderInterpolation vtkHigherOrderQuadrilateral vtkHigherOrderTetra vtkHigherOrderTriangle vtkHigherOrderWedge vtkHighestDensityRegionsStatistics vtkHomogeneousTransform vtkHoudiniPolyDataWriter vtkHoverWidget vtkHull vtkHyperStreamline vtkHyperTree vtkHyperTreeGrid vtkHyperTreeGridAlgorithm vtkHyperTreeGridAxisClip vtkHyperTreeGridAxisCut vtkHyperTreeGridAxisReflection vtkHyperTreeGridCellCenters vtkHyperTreeGridContour vtkHyperTreeGridDepthLimiter vtkHyperTreeGridEntry vtkHyperTreeGridEvaluateCoarse vtkHyperTreeGridExtractGhostCells vtkHyperTreeGridFeatureEdges vtkHyperTreeGridGeometricLocator vtkHyperTreeGridGeometry vtkHyperTreeGridGeometry1DImpl vtkHyperTreeGridGeometry2DImpl vtkHyperTreeGridGeometry3DImpl vtkHyperTreeGridGeometryEntry vtkHyperTreeGridGeometryImpl vtkHyperTreeGridGeometryLevelEntry vtkHyperTreeGridGeometrySmallDimensionsImpl vtkHyperTreeGridGeometryUnlimitedEntry vtkHyperTreeGridGeometryUnlimitedLevelEntry vtkHyperTreeGridGhostCellsGenerator vtkHyperTreeGridGhostCellsGeneratorInternals vtkHyperTreeGridGradient vtkHyperTreeGridIterator vtkHyperTreeGridLevelEntry vtkHyperTreeGridLocator vtkHyperTreeGridMapper vtkHyperTreeGridNonOrientedCursor vtkHyperTreeGridNonOrientedGeometryCursor vtkHyperTreeGridNonOrientedMooreSuperCursor vtkHyperTreeGridNonOrientedMooreSuperCursorLight vtkHyperTreeGridNonOrientedSuperCursor vtkHyperTreeGridNonOrientedSuperCursorLight vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor vtkHyperTreeGridNonOrientedUnlimitedSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight vtkHyperTreeGridOrientedCursor vtkHyperTreeGridOrientedGeometryCursor vtkHyperTreeGridOutlineFilter vtkHyperTreeGridPlaneCutter vtkHyperTreeGridPreConfiguredSource vtkHyperTreeGridProbeFilter vtkHyperTreeGridScales vtkHyperTreeGridSource vtkHyperTreeGridThreshold vtkHyperTreeGridToDualGrid vtkHyperTreeGridToUnstructuredGrid vtkHyperTreeGridVisibleLeavesSize vtkIOCellGrid vtkIOSRenderWindow vtkIOSRenderWindowInteractor vtkIOSSFilesScanner vtkIOSSModel vtkIOSSReader vtkIOSSReaderInternal vtkIOSSWriter vtkIOStream vtkIOStreamFwd vtkISIReader vtkIVExporter vtkIVWriter vtkIcicleView vtkIconGlyphFilter vtkIdFilter vtkIdListCollection vtkIdentityTransform vtkImageAccumulate vtkImageActorPointPlacer vtkImageAlgorithm vtkImageAnisotropicDiffusion2D vtkImageAnisotropicDiffusion3D vtkImageAppend vtkImageAppendComponents vtkImageBSplineCoefficients vtkImageBSplineInternals vtkImageBSplineInterpolator vtkImageBlend vtkImageButterworthHighPass vtkImageButterworthLowPass vtkImageCacheFilter vtkImageChangeInformation vtkImageCheckerboard vtkImageCityBlockDistance vtkImageClip vtkImageConnectivityFilter vtkImageConnector vtkImageConnectorSeed vtkImageConstantPad vtkImageContinuousDilate3D vtkImageContinuousErode3D vtkImageConvolve vtkImageCorrelation vtkImageCroppingRegionsWidget vtkImageCursor3D vtkImageDataLIC2D vtkImageDataOutlineFilter vtkImageDataStreamer vtkImageDataToExplicitStructuredGrid vtkImageDataToHyperTreeGrid vtkImageDataToPointSet vtkImageDataToUniformGrid vtkImageDecomposeFilter vtkImageDifference vtkImageDilateErode3D vtkImageDivergence vtkImageDotProduct vtkImageEllipsoidSource vtkImageEuclideanDistance vtkImageEuclideanToPolar vtkImageExport vtkImageExtractComponents vtkImageFFT vtkImageFlip vtkImageFourierCenter vtkImageFourierFilter vtkImageGaussianSmooth vtkImageGaussianSource vtkImageGradient vtkImageGradientMagnitude vtkImageGridSource vtkImageHSIToRGB vtkImageHSVToRGB vtkImageHistogram vtkImageHistogramStatistics vtkImageHybridMedian2D vtkImageIdealHighPass vtkImageIdealLowPass vtkImageImport vtkImageImportExecutive vtkImageInPlaceFilter vtkImageInterpolator vtkImageIslandRemoval2D vtkImageItem vtkImageIterateFilter vtkImageIterator vtkImageLaplacian vtkImageLogarithmicScale vtkImageLogic vtkImageLuminance vtkImageMagnify vtkImageMapToRGBA vtkImageMapToWindowLevelColors vtkImageMapper vtkImageMapper3D vtkImageMarchingCubes vtkImageMask vtkImageMaskBits vtkImageMathematics vtkImageMedian3D vtkImageMirrorPad vtkImageNoiseSource vtkImageNonMaximumSuppression vtkImageNormalize vtkImageOpenClose3D vtkImageOrthoPlanes vtkImagePadFilter vtkImagePermute vtkImagePlaneWidget vtkImagePointDataIterator vtkImagePointIterator vtkImageProbeFilter vtkImageProcessingPass vtkImageProgressIterator vtkImageProperty vtkImageQuantizeRGBToIndex vtkImageRFFT vtkImageRGBToHSI vtkImageRGBToHSV vtkImageRGBToXYZ vtkImageRGBToYIQ vtkImageRange3D vtkImageReader vtkImageReader2Collection vtkImageRectilinearWipe vtkImageRenderManager vtkImageResample vtkImageResize vtkImageReslice vtkImageResliceMapper vtkImageResliceToColors vtkImageSSIM vtkImageSeedConnectivity vtkImageSeparableConvolution vtkImageShiftScale vtkImageShrink3D vtkImageSincInterpolator vtkImageSinusoidSource vtkImageSkeleton2D vtkImageSlab vtkImageSlabReslice vtkImageSlice vtkImageSliceCollection vtkImageSliceMapper vtkImageSobel2D vtkImageSobel3D vtkImageSpatialAlgorithm vtkImageStack vtkImageStencil vtkImageStencilAlgorithm vtkImageStencilData vtkImageStencilIterator vtkImageStencilRaster vtkImageStencilSource vtkImageStencilToImage vtkImageThreshold vtkImageThresholdConnectivity vtkImageToAMR vtkImageToImageStencil vtkImageToPoints vtkImageToPolyDataFilter vtkImageToStructuredGrid vtkImageToStructuredPoints vtkImageTracerWidget vtkImageTransform vtkImageTranslateExtent vtkImageVariance3D vtkImageViewer vtkImageWeightedSum vtkImageWrapPad vtkImageWriter vtkImageXYZToLAB vtkImageYIQToRGB vtkImplicitArray vtkImplicitCylinderRepresentation vtkImplicitCylinderWidget vtkImplicitDataSet vtkImplicitFunction vtkImplicitFunctionCollection vtkImplicitFunctionToImageStencil vtkImplicitHalo vtkImplicitImageRepresentation vtkImplicitModeller vtkImplicitPlaneRepresentation vtkImplicitPlaneWidget vtkImplicitPlaneWidget2 vtkImplicitPolyDataDistance vtkImplicitProjectOnPlaneDistance vtkImplicitSelectionLoop vtkImplicitSum vtkImplicitTextureCoords vtkImplicitVolume vtkImplicitWindowFunction vtkImporter vtkImprintFilter vtkInEdgeIterator vtkIncrementalForceLayout vtkIncrementalOctreeNode vtkIncrementalOctreePointLocator vtkIncrementalPointLocator vtkIndent vtkIndexedImplicitBackend vtkInformation vtkInformationDataObjectKey vtkInformationDataObjectMetaDataKey vtkInformationDoubleKey vtkInformationDoubleVectorKey vtkInformationExecutivePortKey vtkInformationExecutivePortVectorKey vtkInformationIdTypeKey vtkInformationInformationKey vtkInformationInformationVectorKey vtkInformationIntegerKey vtkInformationIntegerPointerKey vtkInformationIntegerRequestKey vtkInformationIntegerVectorKey vtkInformationInternals vtkInformationIterator vtkInformationKey vtkInformationKeyLookup vtkInformationKeyVectorKey vtkInformationObjectBaseKey vtkInformationObjectBaseVectorKey vtkInformationQuadratureSchemeDefinitionVectorKey vtkInformationRequestKey vtkInformationStringKey vtkInformationStringVectorKey vtkInformationUnsignedLongKey vtkInformationVariantKey vtkInformationVariantVectorKey vtkInformationVector vtkInitialValueProblemSolver vtkInputStream vtkIntegrateAttributes vtkInteractiveArea vtkInteractorEventRecorder vtkInteractorObserver vtkInteractorStyle vtkInteractorStyle3D vtkInteractorStyleAreaSelectHover vtkInteractorStyleDrawPolygon vtkInteractorStyleFlight vtkInteractorStyleJoystickActor vtkInteractorStyleJoystickCamera vtkInteractorStyleMultiTouchCamera vtkInteractorStyleRubberBand2D vtkInteractorStyleRubberBand3D vtkInteractorStyleRubberBandPick vtkInteractorStyleRubberBandZoom vtkInteractorStyleSwitch vtkInteractorStyleSwitchBase vtkInteractorStyleTerrain vtkInteractorStyleTrackball vtkInteractorStyleTrackballActor vtkInteractorStyleTrackballCamera vtkInteractorStyleTreeMapHover vtkInteractorStyleUnicam vtkInteractorStyleUser vtkInterpolateCalculator vtkInterpolateDataSetAttributes vtkInterpolatingSubdivisionFilter vtkInterpolationKernel vtkInterpolatorInternals vtkIntersectionCounter vtkIntersectionPolyDataFilter vtkIterativeClosestPointTransform vtkJSONDataSetWriter vtkJSONImageWriter vtkJSONRenderWindowExporter vtkJSONSceneExporter vtkJavaScriptDataWriter vtkJoinTables vtkKCoreDecomposition vtkKCoreLayout vtkKMeansAssessFunctor vtkKMeansDistanceFunctor vtkKMeansDistanceFunctorCalculator vtkKMeansStatistics vtkKdNode vtkKdTree vtkKdTreePointLocator vtkKdTreeSelector vtkKochanekSpline vtkLASRasterReader vtkLASReader vtkLICNoiseHelper vtkLICRandomNoise2D vtkLICRandomNumberGeneratorInterface vtkLODProp3D vtkLSDynaPart vtkLSDynaPartCollection vtkLSDynaReader vtkLSDynaSummaryParser vtkLZ4DataCompressor vtkLZMADataCompressor vtkLabelHierarchy vtkLabelHierarchyAlgorithm vtkLabelHierarchyCompositeIterator vtkLabelHierarchyIterator vtkLabelPlacementMapper vtkLabelPlacer vtkLabelRenderStrategy vtkLabelSizeCalculator vtkLabeledContourMapper vtkLabeledContourPolyDataItem vtkLabeledDataMapper vtkLabeledTreeMapDataMapper vtkLagrangeCurve vtkLagrangeHexahedron vtkLagrangeInterpolation vtkLagrangeQuadrilateral vtkLagrangeTetra vtkLagrangeTriangle vtkLagrangeWedge vtkLagrangianBasicIntegrationModel vtkLagrangianMatidaIntegrationModel vtkLagrangianParticle vtkLagrangianParticleTracker vtkLargeInteger vtkLassoStencilSource vtkLeaderActor2D vtkLegacyReaderVersion vtkLegendBoxActor vtkLegendScaleActor vtkLengthDistribution vtkLevelIdScalars vtkLight vtkLightActor vtkLightCollection vtkLightKit vtkLightNode vtkLightRepresentation vtkLightWidget vtkLightingMapPass vtkLightsPass vtkLineIntegralConvolution2D vtkLineRepresentation vtkLineWidget vtkLineWidget2 vtkLinearCellExtrusionFilter vtkLinearContourLineInterpolator vtkLinearExtrusionFilter vtkLinearKernel vtkLinearSelector vtkLinearToQuadraticCellsFilter vtkLinearTransform vtkLinearTransformCellLocator vtkLinkEdgels vtkLocationSelector vtkLocator vtkLogLookupTable vtkLogger vtkLogoRepresentation vtkLogoWidget vtkLongArray vtkLongLongArray vtkLookupTableItem vtkLookupTableWithEnabling vtkLoopBooleanPolyDataFilter vtkMCubesReader vtkMCubesWriter vtkMFCWindow vtkMFIXReader vtkMINCImageAttributes vtkMINCImageReader vtkMINCImageWriter vtkMNIObjectReader vtkMNIObjectWriter vtkMNITagPointReader vtkMNITagPointWriter vtkMNITransformReader vtkMNITransformWriter vtkMP4Writer vtkMPASReader vtkMPI4PyCommunicator vtkMPICommunicator vtkMPIController vtkMPIEventLog vtkMPIImageReader vtkMPIMultiBlockPLOT3DReader vtkMPIPixelTT vtkMPIPixelView vtkMRCReader vtkMagnifierRepresentation vtkMagnifierWidget vtkMapArrayValues vtkMapMaskTextureId vtkMappedDataArray vtkMappedUnstructuredGrid vtkMappedUnstructuredGridCellIterator vtkMapper vtkMapper2D vtkMapperCollection vtkMapperNode vtkMarchingContourFilter vtkMarkBoundaryFilter vtkMarkerUtilities vtkMarshalContext vtkMaskFields vtkMaskPoints vtkMaskPointsFilter vtkMaskPolyData vtkMassProperties vtkMathPrivate vtkMathTextFreeTypeTextRenderer vtkMathTextUtilities vtkMathTextUtilitiesCleanup vtkMathUtilities vtkMatplotlibMathTextUtilities vtkMatricizeArray vtkMatrix3x3 vtkMatrixToHomogeneousTransform vtkMatrixToLinearTransform vtkMeanValueCoordinatesInterpolator vtkMeasurementCubeHandleRepresentation3D vtkMedicalImageProperties vtkMedicalImageReader2 vtkMemkindRAII vtkMemoryLimitImageDataStreamer vtkMemoryResourceStream vtkMergeArrays vtkMergeCells vtkMergeColumns vtkMergeDataObjectFilter vtkMergeFields vtkMergeFilter vtkMergeGraphs vtkMergeTables vtkMergeTimeFilter vtkMergeVectorComponents vtkMersenneTwister vtkModelMetadata vtkModifiedBSPTree vtkMolecule vtkMoleculeAlgorithm vtkMoleculeAppend vtkMoleculeMapper vtkMoleculeReaderBase vtkMoleculeToAtomBallFilter vtkMoleculeToBondStickFilter vtkMoleculeToLinesFilter vtkMoleculeToPolyDataFilter vtkMotionFXCFGReader vtkMultiBlockDataGroupFilter vtkMultiBlockDataSetAlgorithm vtkMultiBlockPLOT3DReaderRecord vtkMultiBlockUnstructuredGridVolumeMapper vtkMultiBlockVolumeMapper vtkMultiCorrelativeAssessFunctor vtkMultiCorrelativeStatistics vtkMultiNewickTreeReader vtkMultiObjectMassProperties vtkMultiPieceDataSet vtkMultiProcessController vtkMultiProcessStream vtkMultiThreader vtkMultiThreshold vtkMultiTimeStepAlgorithm vtkMultiVolume vtkMutableDirectedGraph vtkMutableGraphHelper vtkMutableUndirectedGraph vtkMySQLDatabase vtkMySQLDatabasePrivate vtkMySQLQuery vtkMySQLToTableReader vtkNIFTIImageHeader vtkNIFTIImageReader vtkNIFTIImageWriter vtkNamedColors vtkNativePartitioningStrategy vtkNeighborCells vtkNek5000Reader vtkNetCDFCAMReader vtkNetCDFCFReader vtkNetCDFCFWriter vtkNetCDFPOPReader vtkNetCDFReader vtkNetCDFUGRIDReader vtkNetCDFUGRIDeader vtkNetworkHierarchy vtkNew vtkNewickTreeReader vtkNewickTreeWriter vtkNonLinearCell vtkNonMergingPointLocator vtkNonOverlappingAMR vtkNonOverlappingAMRAlgorithm vtkNonOverlappingAMRLevelIdScalars vtkNormalizeMatrixVectors vtkNrrdReader vtkNumberToString vtkOBBNode vtkOBBTree vtkOBJExporter vtkOBJImporter vtkOBJPolyDataProcessor vtkOBJWriter vtkOCCTReader vtkODBCDatabase vtkODBCInternals vtkODBCQuery vtkOMETIFFReader vtkOMFReader vtkOOGLExporter vtkOSOpenGLRenderWindow vtkOSPRayAMRVolumeMapperNode vtkOSPRayActorNode vtkOSPRayCache vtkOSPRayCacheItemObject vtkOSPRayCameraNode vtkOSPRayCompositePolyDataMapper2Node vtkOSPRayCompositePolyDataMapperNode vtkOSPRayLightNode vtkOSPRayMaterialHelpers vtkOSPRayMaterialLibrary vtkOSPRayMoleculeMapperNode vtkOSPRayPass vtkOSPRayPointGaussianMapperNode vtkOSPRayPolyDataMapperNode vtkOSPRayRendererNode vtkOSPRayTestInteractor vtkOSPRayUnstructuredVolumeMapperNode vtkOSPRayViewNodeFactory vtkOSPRayVolumeInterface vtkOSPRayVolumeMapper vtkOSPRayVolumeMapperNode vtkOSPRayVolumeNode vtkOSPRayWindowNode vtkOStrStreamWrapper vtkOStreamWrapper vtkOTDensityMap vtkOTFilter vtkOTKernelSmoothing vtkOTScatterPlotMatrix vtkOTUtilities vtkObjectBase vtkObjectFactory vtkObjectFactoryCollection vtkObjectFactoryRegistryCleanup vtkObjectIdMap vtkObserverMediator vtkOctreeImageToPointSetFilter vtkOctreePointLocator vtkOctreePointLocatorNode vtkOggTheoraWriter vtkOldStyleCallbackCommand vtkOpaquePass vtkOpenFOAMReader vtkOpenGL2ContextDevice2DCellArrayHelper vtkOpenGL2ContextDevice2DPrivate vtkOpenGLActor vtkOpenGLArrayTextureBufferAdapter vtkOpenGLAvatar vtkOpenGLBatchedPolyDataMapper vtkOpenGLBillboardTextActor3D vtkOpenGLBufferObject vtkOpenGLCamera vtkOpenGLCellGridMapper vtkOpenGLCellToVTKCellMap vtkOpenGLCompositePolyDataMapperDelegator vtkOpenGLContextActor vtkOpenGLContextBufferId vtkOpenGLContextDevice2D vtkOpenGLContextDevice3D vtkOpenGLContextDeviceBufferObjectBuilder vtkOpenGLES30PolyDataMapper2D vtkOpenGLFXAAFilter vtkOpenGLFXAAPass vtkOpenGLFluidMapper vtkOpenGLFramebufferObject vtkOpenGLGL2PSExporter vtkOpenGLGL2PSHelper vtkOpenGLGL2PSHelperImpl vtkOpenGLGPUVolumeRayCastMapper vtkOpenGLGlyph3DHelper vtkOpenGLGlyph3DMapper vtkOpenGLHardwareSelector vtkOpenGLHelper vtkOpenGLHyperTreeGridMapper vtkOpenGLImageAlgorithmCallback vtkOpenGLImageAlgorithmHelper vtkOpenGLImageGradient vtkOpenGLImageMapper vtkOpenGLImageSliceMapper vtkOpenGLIndexBufferObject vtkOpenGLInstanceCulling vtkOpenGLLabeledContourMapper vtkOpenGLLight vtkOpenGLLowMemoryBatchedPolyDataMapper vtkOpenGLLowMemoryCellTypeAgent vtkOpenGLLowMemoryLinesAgent vtkOpenGLLowMemoryPolyDataMapper vtkOpenGLLowMemoryPolygonsAgent vtkOpenGLLowMemoryStripsAgent vtkOpenGLLowMemoryVerticesAgent vtkOpenGLMoleculeMapper vtkOpenGLMovieSphere vtkOpenGLPointGaussianMapper vtkOpenGLPointGaussianMapperHelper vtkOpenGLPolyDataMapper vtkOpenGLPolyDataMapper2D vtkOpenGLProjectedTetrahedraMapper vtkOpenGLPropItem vtkOpenGLProperty vtkOpenGLQuadHelper vtkOpenGLRayCastImageDisplayHelper vtkOpenGLRenderPass vtkOpenGLRenderTimer vtkOpenGLRenderTimerLog vtkOpenGLRenderUtilities vtkOpenGLRenderWindow vtkOpenGLRenderer vtkOpenGLResourceFreeCallback vtkOpenGLShaderCache vtkOpenGLShaderDeclaration vtkOpenGLShaderProperty vtkOpenGLSkybox vtkOpenGLSphereMapper vtkOpenGLState vtkOpenGLStickMapper vtkOpenGLTextActor vtkOpenGLTextActor3D vtkOpenGLTextMapper vtkOpenGLTexture vtkOpenGLUniforms vtkOpenGLVertexArrayObject vtkOpenGLVertexBufferObject vtkOpenGLVertexBufferObjectCache vtkOpenGLVertexBufferObjectGroup vtkOpenGLVolumeGradientOpacityTable vtkOpenGLVolumeLookupTable vtkOpenGLVolumeLookupTables vtkOpenGLVolumeMaskGradientOpacityTransferFunction2D vtkOpenGLVolumeMaskTransferFunction2D vtkOpenGLVolumeOpacityTable vtkOpenGLVolumeRGBTable vtkOpenGLVolumeTransferFunction2D vtkOpenQubeElectronicData vtkOpenQubeMoleculeSource vtkOpenSlideReader vtkOpenVDBReader vtkOpenVDBWriter vtkOpenVRCamera vtkOpenVRCameraPose vtkOpenVRControlsHelper vtkOpenVRDefaultOverlay vtkOpenVRInteractorStyle vtkOpenVRModel vtkOpenVROverlay vtkOpenVROverlaySpot vtkOpenVRRenderWindow vtkOpenVRRenderWindowInteractor vtkOpenVRRenderer vtkOpenXRCamera vtkOpenXRControlsHelper vtkOpenXRInteractorStyle vtkOpenXRManager vtkOpenXRManagerConnection vtkOpenXRManagerD3DGraphics vtkOpenXRManagerGraphics vtkOpenXRManagerOpenGLGraphics vtkOpenXRManagerRemoteConnection vtkOpenXRModel vtkOpenXRRemotingRenderWindow vtkOpenXRRenderWindow vtkOpenXRRenderWindowInteractor vtkOpenXRRenderer vtkOpenXRUtilities vtkOrderIndependentTranslucentPass vtkOrderStatistics vtkOrderedTriangulator vtkOrientPolyData vtkOrientationMarkerWidget vtkOrientationRepresentation vtkOrientationWidget vtkOrientedGlyphFocalPlaneContourRepresentation vtkOrientedPolygonalHandleRepresentation3D vtkOutEdgeIterator vtkOutlineCornerSource vtkOutlineGlowPass vtkOutlineSource vtkOutputStream vtkOutputWindow vtkOutputWindowCleanup vtkOverlappingAMR vtkOverlappingAMRAlgorithm vtkOverlappingAMRLevelIdScalars vtkOverlappingCellsDetector vtkOverlayPass vtkOverrideInformation vtkOverrideInformationCollection vtkPAutoCorrelativeStatistics vtkPBRIrradianceTexture vtkPBRLUTTexture vtkPBRPrefilterTexture vtkPBivariateLinearTableThreshold vtkPCAAnalysisFilter vtkPCACurvatureEstimation vtkPCANormalEstimation vtkPCAStatistics vtkPCellDataToPointData vtkPCellSizeFilter vtkPChacoReader vtkPComputeHistogram2DOutliers vtkPComputeQuantiles vtkPComputeQuartiles vtkPConnectivityFilter vtkPContingencyStatistics vtkPConvertToMultiBlockDataSet vtkPCorrelativeStatistics vtkPDALReader vtkPDFContextDevice2D vtkPDFExporter vtkPDataSetReader vtkPDataSetWriter vtkPDescriptiveStatistics vtkPDirectory vtkPDistributedDataFilter vtkPExodusIIReader vtkPExodusIIWriter vtkPExtractDataArraysOverTime vtkPExtractExodusGlobalTemporalVariables vtkPExtractGrid vtkPExtractHistogram2D vtkPExtractRectilinearGrid vtkPExtractSelectedArraysOverTime vtkPExtractVOI vtkPHardwareSelector vtkPHyperTreeGridProbeFilter vtkPIOReader vtkPImageWriter vtkPKMeansStatisitcs vtkPKMeansStatistics vtkPKdTree vtkPLSDynaReader vtkPLagrangianParticleTracker vtkPLineIntegralConvolution2D vtkPLinearExtrusionFilter vtkPMaskPoints vtkPMergeArrays vtkPMultiCorrelativeStatistics vtkPNetCDFPOPReader vtkPNrrdReader vtkPOVExporter vtkPOpenFOAMReader vtkPOrderStatistics vtkPOutlineCornerFilter vtkPOutlineFilter vtkPOutlineFilterInternals vtkPPCAStatistics vtkPPainterCommunicator vtkPPairwiseExtractHistogram2D vtkPParticlePathFilter vtkPParticleTracer vtkPParticleTracerBase vtkPPixelTransfer vtkPPolyDataNormals vtkPProbeFilter vtkPProjectSphereFilter vtkPReflectionFilter vtkPResampleFilter vtkPResampleToImage vtkPResampleWithDataSet vtkPSLACReader vtkPSimpleBondPerceiver vtkPSphereSource vtkPStreaklineFilter vtkPStreamTracer vtkPStructuredGridConnectivity vtkPSurfaceLICComposite vtkPSurfaceLICInterface vtkPSystemTools vtkPTSReader vtkPTextureMapToSphere vtkPVWebGLExporter vtkPWindBladeReader vtkPXdmf3Writer vtkPYoungsMaterialInterface vtkPackLabels vtkPainterCommunicator vtkPairwiseExtractHistogram2D vtkPanoramicProjectionPass vtkParallelAMRUtilities vtkParallelCoordinatesActor vtkParallelCoordinatesHistogramRepresentation vtkParallelCoordinatesInteractorStyle vtkParallelCoordinatesRepresentation vtkParallelCoordinatesView vtkParallelReader vtkParallelRenderManager vtkParallelTimer vtkParallelVectors vtkParallelopipedRepresentation vtkParallelopipedWidget vtkParametricBohemianDome vtkParametricBour vtkParametricCatalanMinimal vtkParametricHenneberg vtkParametricKuen vtkParametricPluckerConoid vtkParametricPseudosphere vtkParticlePathFilter vtkParticleTracer vtkParticleTracerBase vtkPartitionBalancer vtkPartitionedArchiver vtkPartitionedDataSet vtkPartitionedDataSetAlgorithm vtkPartitionedDataSetCollection vtkPartitionedDataSetCollectionAlgorithm vtkPartitionedDataSetCollectionSource vtkPartitionedDataSetSource vtkPartitioningStrategy vtkPassArrays vtkPassInputTypeAlgorithm vtkPassSelectedArrays vtkPassThrough vtkPassThroughEdgeStrategy vtkPassThroughLayoutStrategy vtkPath vtkPen vtkPentagonalPrism vtkPeriodicDataArray vtkPeriodicFilter vtkPeriodicTable vtkPerlinNoise vtkPerturbCoincidentVertices vtkPhyloXMLTreeReader vtkPhyloXMLTreeWriter vtkPicker vtkPickingManager vtkPieChartActor vtkPieceRequestFilter vtkPieceScalars vtkPiecewiseControlPointsItem vtkPiecewiseFunction vtkPiecewiseFunctionAlgorithm vtkPiecewiseFunctionItem vtkPiecewiseFunctionShiftScale vtkPiecewisePointHandleItem vtkPipelineGraphSource vtkPipelineSize vtkPixel vtkPixelBufferObject vtkPixelExtent vtkPixelExtentIO vtkPixelTransfer vtkPlaneCollection vtkPlaneCutter vtkPlaneWidget vtkPlaybackRepresentation vtkPlaybackWidget vtkPlot vtkPlot3D vtkPlot3DMetaReader vtkPlotArea vtkPlotBag vtkPlotBar vtkPlotBarRangeHandlesItem vtkPlotBox vtkPlotFunctionalBag vtkPlotGrid vtkPlotHistogram2D vtkPlotLine vtkPlotLine3D vtkPlotParallelCoordinates vtkPlotPie vtkPlotPoints vtkPlotPoints3D vtkPlotRangeHandlesItem vtkPlotStacked vtkPlotSurface vtkPointCloudFilter vtkPointCloudRepresentation vtkPointCloudWidget vtkPointConnectivityFilter vtkPointData vtkPointDataToCellData vtkPointDensityFilter vtkPointFillPass vtkPointGaussianMapper vtkPointHandleRepresentation2D vtkPointHandleRepresentation3D vtkPointHandleSource vtkPointInterpolator vtkPointInterpolator2D vtkPointLoad vtkPointLocator vtkPointOccupancyFilter vtkPointPicker vtkPointPlacer vtkPointSet vtkPointSetAlgorithm vtkPointSetCellIterator vtkPointSetStreamer vtkPointSetToLabelHierarchy vtkPointSetToMoleculeFilter vtkPointSetToOctreeImageFilter vtkPointSmoothingFilter vtkPointSource vtkPointWidget vtkPoints2D vtkPointsProjectedHull vtkPoissonDiskSampler vtkPolarAxesActor vtkPolarAxesActor2D vtkPolyDataCollection vtkPolyDataContourLineInterpolator vtkPolyDataEdgeConnectivityFilter vtkPolyDataInternals vtkPolyDataItem vtkPolyDataMapper2D vtkPolyDataMapperNode vtkPolyDataNormals vtkPolyDataPlaneClipper vtkPolyDataPlaneCutter vtkPolyDataPointPlacer vtkPolyDataPointSampler vtkPolyDataReader vtkPolyDataSilhouette vtkPolyDataSourceWidget vtkPolyDataStreamer vtkPolyDataTangents vtkPolyDataToImageStencil vtkPolyDataToReebGraphFilter vtkPolyDataToUnstructuredGrid vtkPolyDataWriter vtkPolyLineRepresentation vtkPolyLineSource vtkPolyLineWidget vtkPolyPlane vtkPolyPointSource vtkPolyVertex vtkPolygonBuilder vtkPolygonalHandleRepresentation3D vtkPolyhedron vtkPolyhedronUtilities vtkPolynomialSolversUnivariate vtkPostScriptWriter vtkPostgreSQLDatabase vtkPostgreSQLDatabasePrivate vtkPostgreSQLQuery vtkPostgreSQLToTableReader vtkPriorityQueue vtkProStarReader vtkProbabilisticVoronoiKernel vtkProbeFilter vtkProbeLineFilter vtkProbePolyhedron vtkProbeSelectedLocations vtkProcess vtkProcessGroup vtkProcessIdScalars vtkProcrustesAlignmentFilter vtkProgrammableAttributeDataFilter vtkProgrammableDataObjectSource vtkProgrammableElectronicData vtkProgrammableFilter vtkProgrammableGlyphFilter vtkProgrammableSource vtkProgressBarRepresentation vtkProgressBarWidget vtkProgressObserver vtkProjectPointsToPlane vtkProjectSphereFilter vtkProjectedTerrainPath vtkProjectedTetrahedraMapper vtkProjectedTexture vtkProp vtkProp3D vtkProp3DAxisFollower vtkProp3DButtonRepresentation vtkProp3DCollection vtkProp3DFollower vtkPropAssembly vtkPropCollection vtkPropItem vtkPropPicker vtkProperty2D vtkProteinRibbonFilter vtkPruneTreeFilter vtkPythonAlgorithm vtkPythonArchiver vtkPythonItem vtkQImageToImageSource vtkQWidgetRepresentation vtkQWidgetTexture vtkQWidgetWidget vtkQtAbstractModelAdapter vtkQtAnnotationLayersModelAdapter vtkQtAnnotationView vtkQtConnection vtkQtDebugLeaksModel vtkQtDebugLeaksView vtkQtInitialization vtkQtLabelRenderStrategy vtkQtListView vtkQtRecordView vtkQtSQLDatabase vtkQtSQLQuery vtkQtStringToImage vtkQtTableModelAdapter vtkQtTableRepresentation vtkQtTableView vtkQtTimePointUtility vtkQtTreeModelAdapter vtkQtTreeRingLabelMapper vtkQtTreeView vtkQtView vtkQuadRotationalExtrusionFilter vtkQuadraticEdge vtkQuadraticHexahedron vtkQuadraticLinearQuad vtkQuadraticLinearWedge vtkQuadraticPolygon vtkQuadraticPyramid vtkQuadraticQuad vtkQuadraticTetra vtkQuadraticTriangle vtkQuadraticWedge vtkQuadraturePointInterpolator vtkQuadraturePointsGenerator vtkQuadratureSchemeDefinition vtkQuadratureSchemeDictionaryGenerator vtkQuadric vtkQuadricLODActor vtkQuantizePolyDataPoints vtkQuaternion vtkQuaternionInterpolator vtkQuaterniond vtkQuaternionf vtkRIBExporter vtkRIBLight vtkRIBProperty vtkRISReader vtkROIStencilSource vtkRTAnalyticSource vtkRTXMLPolyDataReader vtkRadialGridActor2D vtkRadiusOutlierRemoval vtkRandomAttributeGenerator vtkRandomGraphSource vtkRandomHyperTreeGridSource vtkRandomLayoutStrategy vtkRandomPool vtkRandomSequence vtkRangeHandlesItem vtkRasterReprojectionFilter vtkRayCastImageDisplayHelper vtkRayCastStructures vtkReaderAlgorithm vtkRearrangeFields vtkRecoverGeometryWireframe vtkRect vtkRectangularButtonSource vtkRectd vtkRectf vtkRecti vtkRectilinearGrid vtkRectilinearGridAlgorithm vtkRectilinearGridClip vtkRectilinearGridGeometryFilter vtkRectilinearGridOutlineFilter vtkRectilinearGridPartitioner vtkRectilinearGridReader vtkRectilinearGridToPointSet vtkRectilinearGridToTetrahedra vtkRectilinearGridWriter vtkRectilinearSynchronizedTemplates vtkRectilinearWipeRepresentation vtkRectilinearWipeWidget vtkRecursiveDividingCubes vtkRecursiveSphereDirectionEncoder vtkRedistributeDataSetFilter vtkReduceTable vtkReebGraph vtkReebGraphSimplificationFilter vtkReebGraphSimplificationMetric vtkReebGraphSurfaceSkeletonFilter vtkReebGraphToJoinSplitTreeFilter vtkReebGraphVolumeSkeletonFilter vtkReferenceCount vtkReflectionFilter vtkRemoteInteractionAdapter vtkRemoveDuplicatePolys vtkRemoveGhosts vtkRemoveHiddenData vtkRemoveIsolatedVertices vtkRemovePolyData vtkRemoveUnusedPoints vtkRenderLargeImage vtkRenderPass vtkRenderPassCollection vtkRenderState vtkRenderStepsPass vtkRenderTimerLog vtkRenderView vtkRenderViewBase vtkRenderWidget vtkRenderWindowCollection vtkRenderWindowInteractor vtkRenderWindowInteractor3D vtkRenderbuffer vtkRenderedAreaPicker vtkRenderedGraphRepresentation vtkRenderedHierarchyRepresentation vtkRenderedRepresentation vtkRenderedSurfaceRepresentation vtkRenderedTreeAreaRepresentation vtkRendererCollection vtkRendererDelegate vtkRendererNode vtkRendererSource vtkRenderingCellGrid vtkResampleToImage vtkResampleWithDataSet vtkReservoirSampler vtkReservoirSamplerBase vtkResizingWindowToImageFilter vtkResliceCursor vtkResliceCursorActor vtkResliceCursorLineRepresentation vtkResliceCursorPicker vtkResliceCursorPolyDataAlgorithm vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation vtkResliceCursorWidget vtkResliceImageViewer vtkResliceImageViewerMeasurements vtkResourceFileLocator vtkResourceParser vtkResourceStream vtkReverseSense vtkRibbonFilter vtkRotationFilter vtkRotationalExtrusionFilter vtkRowQuery vtkRowQueryToTable vtkRuledSurfaceFilter vtkRungeKutta2 vtkRungeKutta4 vtkRungeKutta45 vtkSCurveSpline vtkSDL2OpenGL2RenderWindow vtkSDL2OpenGLRenderWindow vtkSDL2RenderWindowInteractor vtkSDL2WebGPURenderWindow vtkSEPReader vtkSILBuilder vtkSLACParticleReader vtkSLACReader vtkSLCReader vtkSMPContourGrid vtkSMPMergePoints vtkSMPMergePolyDataHelper vtkSMPProgressObserver vtkSMPThreadLocal vtkSMPThreadLocalAPI vtkSMPThreadLocalImpl vtkSMPThreadLocalImplAbstract vtkSMPThreadLocalObject vtkSMPThreadPool vtkSMPTools vtkSMPToolsAPI vtkSMPToolsAPIInitialize vtkSMPToolsImpl vtkSOADataArrayTemplate vtkSPHCubicKernel vtkSPHInterpolator vtkSPHKernel vtkSPHQuarticKernel vtkSPHQuinticKernel vtkSQLDatabase vtkSQLDatabaseGraphSource vtkSQLDatabaseSchema vtkSQLDatabaseTableSource vtkSQLGraphReader vtkSQLQuery vtkSQLiteDatabase vtkSQLiteDatabaseInternals vtkSQLiteQuery vtkSQLiteToTableReader vtkSSAAPass vtkSSAOPass vtkSTLWriter vtkSVGContextDevice2D vtkSVGExporter vtkSampleImplicitFunctionFilter vtkScalarBarActor vtkScalarBarActorInternal vtkScalarBarRepresentation vtkScalarBarWidget vtkScalarTree vtkScalarsToColors vtkScalarsToColorsItem vtkScalarsToTextureFilter vtkScaledSOADataArrayTemplate vtkScaledTextActor vtkScatterPlotMatrix vtkScenePicker vtkSectorSource vtkSeedRepresentation vtkSeedWidget vtkSegYBinaryHeaderBytesPositions vtkSegYIOUtils vtkSegYReader vtkSegYReaderInternal vtkSegYTrace vtkSegYTraceHeaderBytesPositions vtkSegYTraceReader vtkSelectEnclosedPoints vtkSelectVisiblePoints vtkSelectionAlgorithm vtkSelectionSource vtkSelector vtkSequencePass vtkSerializer vtkServerSocket vtkShader vtkShaderProgram vtkShaderProperty vtkShadowMapBakerPass vtkShadowMapPass vtkSharedFuture vtkSharedFutureBase vtkShepardKernel vtkShepardMethod vtkShortArray vtkShrinkFilter vtkSignedCharArray vtkSignedDistance vtkSimple2DLayoutStrategy vtkSimple3DCirclesStrategy vtkSimpleBondPerceiver vtkSimpleCellTessellator vtkSimpleImageToImageFilter vtkSimpleMotionBlurPass vtkSimplePointsWriter vtkSimpleReader vtkSimpleScalarTree vtkSingleVTPExporter vtkSkybox vtkSliceAndDiceLayoutStrategy vtkSliceCubes vtkSliderRepresentation vtkSliderRepresentation2D vtkSliderRepresentation3D vtkSliderWidget vtkSmartPointer vtkSmartPointerBase vtkSmartVector vtkSmartVolumeMapper vtkSmoothErrorMetric vtkSmoothPolyDataFilter vtkSobelGradientMagnitudePass vtkSocket vtkSocketCollection vtkSocketCommunicator vtkSocketController vtkSortDataArray vtkSortFieldData vtkSortFileNames vtkSpanSpace vtkSpanTreeLayoutStrategy vtkSparseArray vtkSparseArrayToTable vtkSpatialRepresentationFilter vtkSpatioTemporalHarmonicsAttribute vtkSpatioTemporalHarmonicsSource vtkSphereHandleRepresentation vtkSpherePuzzle vtkSpherePuzzleArrows vtkSphereRepresentation vtkSphereTree vtkSphereTreeFilter vtkSphereWidget vtkSphereWidget2 vtkSpheres vtkSphericalDirectionEncoder vtkSphericalHarmonics vtkSphericalPointIterator vtkSphericalTransform vtkSpiderPlotActor vtkSpline vtkSplineFilter vtkSplineGraphEdges vtkSplineRepresentation vtkSplineWidget vtkSplineWidget2 vtkSplitByCellScalarFilter vtkSplitColumnComponents vtkSplitField vtkSplitSharpEdgesPolyData vtkSquarifyLayoutStrategy vtkStackedTreeLayoutStrategy vtkStateStorage vtkStaticCellLinks vtkStaticCellLinksTemplate vtkStaticCellLocator vtkStaticCleanPolyData vtkStaticCleanUnstructuredGrid vtkStaticCompositeSource vtkStaticDataSource vtkStaticEdgeLocatorTemplate vtkStaticFaceHashLinksTemplate vtkStaticPointLocator vtkStaticPointLocator2D vtkStatisticalOutlierRemoval vtkStatisticsAlgorithm vtkStatisticsAlgorithmPrivate vtkStdString vtkStereoCompositor vtkStitchImageDataWithGhosts vtkStrahlerMetric vtkStreaklineFilter vtkStreamGraph vtkStreamSurface vtkStreamTracer vtkStreamerBase vtkStreamingDemandDrivenPipeline vtkStreamingStatistics vtkStreamingTessellator vtkStringArray vtkStringOutputWindow vtkStringToCategory vtkStringToImage vtkStringToNumeric vtkStringToken vtkStructuredAMRGridConnectivity vtkStructuredAMRNeighbor vtkStructuredCellArray vtkStructuredData vtkStructuredDataPlaneCutter vtkStructuredExtent vtkStructuredGridAlgorithm vtkStructuredGridAppend vtkStructuredGridClip vtkStructuredGridConnectivity vtkStructuredGridLIC2D vtkStructuredGridOutlineFilter vtkStructuredGridPartitioner vtkStructuredGridReader vtkStructuredGridWriter vtkStructuredImplicitConnectivity vtkStructuredNeighbor vtkStructuredPointArray vtkStructuredPointBackend vtkStructuredPoints vtkStructuredPointsCollection vtkStructuredPointsGeometryFilter vtkStructuredPointsWriter vtkStructuredTPointBackend vtkSubCommunicator vtkSubGroup vtkSubPixelPositionEdgels vtkSubdivideTetra vtkSubdivisionFilter vtkSuperquadric vtkSurfaceLICComposite vtkSurfaceLICHelper vtkSurfaceLICInterface vtkSurfaceLICMapper vtkSurfaceNets2D vtkSurfaceNets3D vtkSurfaceReconstructionFilter vtkSynchronizeTimeFilter vtkSynchronizedRenderWindows vtkSynchronizedRenderers vtkSynchronizedTemplates2D vtkSynchronizedTemplates3D vtkSynchronizedTemplatesCutter3D vtkSystemIncludes vtkTDxInteractorStyle vtkTDxInteractorStyleCamera vtkTDxInteractorStyleSettings vtkTDxMotionEventInfo vtkTDxQtUnixDevices vtkTGAReader vtkTIFFReaderInternal vtkTRUCHASReader vtkTable vtkTableAlgorithm vtkTableBasedClipCases vtkTableBasedClipDataSet vtkTableFFT vtkTableReader vtkTableToArray vtkTableToDatabaseWriter vtkTableToGraph vtkTableToMySQLWriter vtkTableToPolyData vtkTableToPostgreSQLWriter vtkTableToSQLiteWriter vtkTableToSparseArray vtkTableToStructuredGrid vtkTableToTreeFilter vtkTableWriter vtkTanglegramItem vtkTclCommand vtkTecplotReader vtkTecplotTableReader vtkTemplateAliasMacro vtkTemporalAlgorithm vtkTemporalArrayOperatorFilter vtkTemporalDataSetCache vtkTemporalDelimitedTextReader vtkTemporalFractal vtkTemporalInterpolatedVelocityField vtkTemporalInterpolator vtkTemporalPathLineFilter vtkTemporalShiftScale vtkTemporalSnapToTimeStep vtkTemporalStatistics vtkTensorGlyph vtkTensorPrincipalInvariants vtkTensorProbeRepresentation vtkTensorProbeWidget vtkTensorRepresentation vtkTensorWidget vtkTerrainContourLineInterpolator vtkTerrainDataPointPlacer vtkTessellatedBoxSource vtkTessellatorFilter vtkTestDataArray vtkTestNewVar vtkTextActor vtkTextActor3D vtkTextCodec vtkTextCodecFactory vtkTextPropertyCollection vtkTextRenderer vtkTextRendererCleanup vtkTextRendererStringToImage vtkTextRepresentation vtkTextSource vtkTextWidget vtkTexture vtkTextureIO vtkTextureImageCache vtkTextureMapToCylinder vtkTextureMapToPlane vtkTextureMapToSphere vtkTextureObject vtkTextureUnitManager vtkTexturedActor2D vtkTexturedButtonRepresentation vtkTexturedButtonRepresentation2D vtkTexturedSphereSource vtkThinPlateSplineTransform vtkThreadedCallbackQueue vtkThreadedCompositeDataPipeline vtkThreadedImageAlgorithm vtkThreadedImageWriter vtkThreadedTaskQueue vtkThresholdGraph vtkThresholdTable vtkThresholdTextureCoords vtkTimeInformation vtkTimePointUtility vtkTimeRange vtkTimeSource vtkTimeSourceExample vtkTimeStamp vtkTimerLog vtkTimerLogCleanup vtkTimerLogScope vtkToAffineArrayStrategy vtkToConstantArrayStrategy vtkToImplicitArrayFilter vtkToImplicitRamerDouglasPeuckerStrategy vtkToImplicitStrategy vtkToImplicitTypeErasureStrategy vtkToneMappingPass vtkTooltipItem vtkTransferAttributes vtkTransform2D vtkTransformCollection vtkTransformConcatenation vtkTransformConcatenationStack vtkTransformCoordinateSystems vtkTransformFeedback vtkTransformInterpolator vtkTransformPair vtkTransformTextureCoords vtkTransformToGrid vtkTranslucentPass vtkTransmitImageDataPiece vtkTransmitPolyDataPiece vtkTransmitRectilinearGridPiece vtkTransmitStructuredDataPiece vtkTransmitStructuredGridPiece vtkTransmitUnstructuredGridPiece vtkTransposeMatrix vtkTransposeTable vtkTree vtkTreeAlgorithm vtkTreeAreaView vtkTreeBFSIterator vtkTreeCompositer vtkTreeDFSIterator vtkTreeDifferenceFilter vtkTreeFieldAggregator vtkTreeHeatmapItem vtkTreeIterator vtkTreeLayoutStrategy vtkTreeLevelsFilter vtkTreeMapLayout vtkTreeMapLayoutStrategy vtkTreeMapToPolyData vtkTreeMapView vtkTreeOrbitLayoutStrategy vtkTreeReader vtkTreeRingToPolyData vtkTreeRingView vtkTreeWriter vtkTriQuadraticHexahedron vtkTriQuadraticPyramid vtkTriangleMeshPointNormals vtkTriangularTCoords vtkTriangularTexture vtkTrimmedExtrusionFilter vtkTrivialConsumer vtkTrivialProducer vtkTryDowncastHelper1 vtkTryDowncastHelper2 vtkTryDowncastHelper3 vtkTubeBender vtkTulipReader vtkTuple vtkTupleInterpolator vtkTypeList vtkTypedArray vtkTypedDataArray vtkTypedDataArrayIterator vtkURI vtkURIComponent vtkURILoader vtkUTF16TextCodec vtkUTF8TextCodec vtkUncertaintyTubeFilter vtkUndirectedGraphAlgorithm vtkUniformGrid vtkUniformGridAMR vtkUniformGridAMRAlgorithm vtkUniformGridAMRDataIterator vtkUniformGridPartitioner vtkUniformHyperTreeGrid vtkUniformHyperTreeGridSource vtkUniforms vtkUnsignedDistance vtkUnsignedIntArray vtkUnsignedLongArray vtkUnsignedLongLongArray vtkUnsignedShortArray vtkUnstructuredGridAlgorithm vtkUnstructuredGridBase vtkUnstructuredGridBaseAlgorithm vtkUnstructuredGridBunykRayCastFunction vtkUnstructuredGridCellIterator vtkUnstructuredGridGeometryFilter vtkUnstructuredGridHomogeneousRayIntegrator vtkUnstructuredGridLinearRayIntegrator vtkUnstructuredGridPartialPreIntegration vtkUnstructuredGridPreIntegration vtkUnstructuredGridQuadricDecimation vtkUnstructuredGridToCellGrid vtkUnstructuredGridToExplicitStructuredGrid vtkUnstructuredGridToReebGraphFilter vtkUnstructuredGridVolumeMapper vtkUnstructuredGridVolumeRayCastFunction vtkUnstructuredGridVolumeRayCastIterator vtkUnstructuredGridVolumeRayCastMapper vtkUnstructuredGridVolumeRayIntegrator vtkUnstructuredGridVolumeZSweepMapper vtkUnstructuredGridWriter vtkUpdateCellsV8toV9 vtkVASPAnimationReader vtkVASPTessellationReader vtkVPICReader vtkVRCamera vtkVRCollaborationClient vtkVRControlsHelper vtkVRFollower vtkVRHMDCamera vtkVRHardwarePicker vtkVRInteractorStyle vtkVRMLExporter vtkVRMLUseStruct vtkVRMLYaccData vtkVRMenuRepresentation vtkVRMenuWidget vtkVRModel vtkVRPanelRepresentation vtkVRPanelWidget vtkVRRay vtkVRRenderWindow vtkVRRenderWindowInteractor vtkVRRenderer vtkValuePass vtkValueSelector vtkVariant vtkVariantArray vtkVariantBoostSerialization vtkVariantCast vtkVariantCreate vtkVariantExtract vtkVector vtkVector2 vtkVector2d vtkVector2f vtkVector2i vtkVector3 vtkVector3d vtkVector3f vtkVector3i vtkVector4 vtkVector4d vtkVector4i vtkVectorDot vtkVectorFieldTopology vtkVectorNorm vtkVectorText vtkVeraOutReader vtkVersion vtkVertexAdjacencyList vtkVertexDegree vtkVertexListIterator vtkVideoSource vtkView vtkViewDependentErrorMetric vtkViewNode vtkViewNodeFactory vtkViewTheme vtkViewUpdater vtkViewport vtkVisibilitySort vtkVoidArray vtkVolume vtkVolumeCollection vtkVolumeContourSpectrumFilter vtkVolumeInputHelper vtkVolumeMapper vtkVolumeMapperNode vtkVolumeMask vtkVolumeNode vtkVolumeOfRevolutionFilter vtkVolumeOutlineSource vtkVolumePicker vtkVolumeProperty vtkVolumeRayCastSpaceLeapingImageFilter vtkVolumeReader vtkVolumeStateRAII vtkVolumeTexture vtkVolumetricPass vtkVoronoi2D vtkVoronoiKernel vtkVortexCore vtkVoxel vtkVoxelContoursToSurfaceFilter vtkVoxelGrid vtkVtkJSSceneGraphSerializer vtkVtkJSViewNodeFactory vtkWGPUContext vtkWarpLens vtkWarpScalar vtkWarpTo vtkWarpTransform vtkWasmSceneManager vtkWeakPointer vtkWeakPointerBase vtkWeakReference vtkWebApplication vtkWebAssemblyRenderWindowInteractor vtkWebGLDataSet vtkWebGLExporter vtkWebGLObject vtkWebGLPolyData vtkWebGLWidget vtkWebGPUActor vtkWebGPUCamera vtkWebGPUClearPass vtkWebGPUHardwareSelector vtkWebGPUInternalsBindGroup vtkWebGPUInternalsBindGroupLayout vtkWebGPUInternalsBuffer vtkWebGPUInternalsPipelineLayout vtkWebGPUInternalsRenderPassCreateInfo vtkWebGPUInternalsRenderPassDescriptor vtkWebGPUInternalsRenderPipelineDescriptor vtkWebGPUInternalsShaderModule vtkWebGPULight vtkWebGPUPolyDataMapper vtkWebGPUProperty vtkWebGPURenderPass vtkWebGPURenderWindow vtkWebGPURenderer vtkWebInteractionEvent vtkWebUtilities vtkWedge vtkWendlandQuinticKernel vtkWidgetCallbackMapper vtkWidgetEvent vtkWidgetEventTranslator vtkWidgetRepresentation vtkWidgetSet vtkWin32HardwareWindow vtkWin32Header vtkWin32OpenGL2RenderWindow vtkWin32OpenGLDXRenderWindow vtkWin32OpenGLRenderWindow vtkWin32OutputWindow vtkWin32ProcessOutputWindow vtkWin32RenderWindowInteractor vtkWin32VideoSource vtkWindBladeReader vtkWindow vtkWindowLevelLookupTable vtkWindowNode vtkWindowToImageFilter vtkWordCloud vtkWorldPointPicker vtkWrappingHints vtkWriter vtkX3DExporter vtkX3DExporterFIWriter vtkX3DExporterFIWriterHelper vtkX3DExporterWriter vtkX3DExporterXMLWriter vtkXMLCompositeDataReader vtkXMLCompositeDataSetWriterHelper vtkXMLCompositeDataWriter vtkXMLDataElement vtkXMLDataHeader vtkXMLDataHeaderImpl vtkXMLDataObjectWriter vtkXMLDataParser vtkXMLDataReader vtkXMLDataSetWriter vtkXMLDataWriterHelper vtkXMLFileOutputWindow vtkXMLFileReadTester vtkXMLHierarchicalBoxDataFileConverter vtkXMLHierarchicalBoxDataReader vtkXMLHierarchicalBoxDataWriter vtkXMLHierarchicalDataReader vtkXMLHyperTreeGridReader vtkXMLHyperTreeGridWriter vtkXMLMultiBlockDataReader vtkXMLMultiBlockDataWriter vtkXMLMultiGroupDataReader vtkXMLPDataObjectReader vtkXMLPDataObjectWriter vtkXMLPDataReader vtkXMLPDataSetWriter vtkXMLPDataWriter vtkXMLPHierarchicalBoxDataWriter vtkXMLPHyperTreeGridReader vtkXMLPHyperTreeGridWriter vtkXMLPImageDataReader vtkXMLPImageDataWriter vtkXMLPMultiBlockDataWriter vtkXMLPPolyDataReader vtkXMLPPolyDataWriter vtkXMLPRectilinearGridReader vtkXMLPRectilinearGridWriter vtkXMLPStructuredDataReader vtkXMLPStructuredDataWriter vtkXMLPStructuredGridReader vtkXMLPStructuredGridWriter vtkXMLPTableReader vtkXMLPTableWriter vtkXMLPUniformGridAMRWriter vtkXMLPUnstructuredDataReader vtkXMLPUnstructuredDataWriter vtkXMLPUnstructuredGridReader vtkXMLPUnstructuredGridWriter vtkXMLParser vtkXMLPartitionedDataSetCollectionReader vtkXMLPartitionedDataSetCollectionWriter vtkXMLPartitionedDataSetReader vtkXMLPartitionedDataSetWriter vtkXMLReader vtkXMLReaderVersion vtkXMLRectilinearGridWriter vtkXMLStructuredDataReader vtkXMLStructuredDataWriter vtkXMLTableReader vtkXMLTableWriter vtkXMLTreeReader vtkXMLUniformGridAMRReader vtkXMLUniformGridAMRWriter vtkXMLUnstructuredDataReader vtkXMLUnstructuredDataWriter vtkXMLUtilities vtkXMLWriter vtkXMLWriter2 vtkXMLWriterBase vtkXOpenGLRenderWindow vtkXRenderWindowInteractor vtkXWebGPURenderWindow vtkXYPlotActor vtkXYPlotRepresentation vtkXYPlotWidget vtkXYZMolReader vtkXYZMolReader2 vtkXdmf3ArrayKeeper vtkXdmf3ArraySelection vtkXdmf3DataSet vtkXdmf3HeavyDataHandler vtkXdmf3LightDataHandler vtkXdmf3Reader vtkXdmf3SILBuilder vtkXdmf3Writer vtkXdmfArraySelection vtkXdmfDataArray vtkXdmfDocument vtkXdmfDomain vtkXdmfHeavyData vtkXdmfReader vtkXdmfReaderInternal vtkXdmfWriter vtkYieldCriteria vtkYoungsMaterialInterface vtkZLibDataCompressor vtkZSpaceCamera vtkZSpaceCoreCompatibilitySDKManager vtkZSpaceCoreSDKManager vtkZSpaceGenericRenderWindow vtkZSpaceHardwarePicker vtkZSpaceInteractorStyle vtkZSpaceRayActor vtkZSpaceRenderWindowInteractor vtkZSpaceRenderer vtkZSpaceSDKManager vtkZSpaceWin32RenderWindow vtkmAverageToCells vtkmAverageToPoints vtkmCleanGrid vtkmClip vtkmContour vtkmCoordinateSystemTransform vtkmDataArray vtkmDataSet vtkmExternalFaces vtkmExtractVOI vtkmFilterOverrides vtkmGradient vtkmHistogram vtkmImageConnectivity vtkmLevelOfDetail vtkmNDHistogram vtkmPointElevation vtkmPointTransform vtkmPolyDataNormals vtkmProbe vtkmSlice vtkmThreshold vtkmTriangleMeshPointNormals vtkmWarpScalar vtkmWarpVector"},{"location":"CSharp/Coverage/CSharpVTKClassesUsed/","title":"VTK Classes used in the Examples","text":""},{"location":"CSharp/Coverage/CSharpVTKClassesUsed/#csharp","title":"CSharp","text":"

Out of 3113 available VTK classes, 190 are demonstrated here.

"},{"location":"CSharp/Coverage/CSharpVTKClassesUsed/#excluded-classes","title":"Excluded classes","text":"

These classes are excluded since they occur in the majority of the examples:

VTK Class VTK Class VTK Class vtkActor vtkCamera vtkNamedColors vtkPolyDataMapper vtkProperty vtkRenderer vtkRenderWindow vtkRenderWindowInteractor"},{"location":"CSharp/Coverage/CSharpVTKClassesUsed/#classes-used","title":"Classes used","text":"VTK Class Examples vtkActor2D GeometricObjectsDemo ParametricObjectsDemo ReadDICOMSeries Subdivision vtkAppendPolyData ColorDisconnectedRegions FilledContours PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion vtkArrowSource Arrow GeometricObjectsDemo OrientedArrow VectorFieldNonZeroExtraction vtkAxesActor Axes vtkBandedPolyDataContourFilter BandedPolyDataContourFilter vtkBMPReader ReadBMP WriteBMP vtkBMPWriter WriteBMP vtkButterflySubdivisionFilter Subdivision vtkCell CellEdges vtkCellArray BandedPolyDataContourFilter ColoredLines ExtractEdges Hexahedron IterateOverLines LongLine Point Polygon PolyLine Pyramid Quad Tetrahedron Triangle TriangleStrip Vertex WarpVector WriteVTP WriteVTU vtkCleanPolyData FilledContours vtkClipPolyData CapClip FilledContours SelectPolyData SolidClip vtkConeSource Cone GeometricObjectsDemo vtkContourFilter FilledContours ImplicitBoolean ImplicitSphere IsoContours SampleFunction vtkContourWidget PolygonalSurfaceContourLineInterpolator vtkCubeSource Cube GeometricObjectsDemo VectorFieldNonZeroExtraction vtkCurvatures Curvature vtkCutter ContoursFromPolyData vtkCylinderSource Cylinder GeometricObjectsDemo vtkDataObject VectorFieldNonZeroExtraction vtkDataSet HighlightBadCells vtkDataSetAttributes VectorFieldNonZeroExtraction vtkDataSetMapper CapClip Hexahedron HighlightBadCells Pyramid ReadImageData ReadPolyData ReadRectilinearGrid ReadUnknownTypeXMLFile ReadUnstructuredGrid Tetrahedron TriangleStrip WriteVTI WriteVTP WriteVTU vtkDataSetSurfaceFilter FillHoles MatrixMathFilter vtkDecimatePro Decimate vtkDelaunay2D ColoredElevationMap ElevationFilter SimpleElevationFilter vtkDEMReader DEMReader vtkDICOMImageReader ReadDICOMSeries vtkDijkstraGraphGeodesicPath DijkstraGraphGeodesicPath vtkDiskSource BoundaryEdges Disk GeometricObjectsDemo vtkDoubleArray HighlightBadCells WarpVector vtkEarthSource GeometricObjectsDemo vtkElevationFilter ElevationFilter vtkExtractEdges ExtractEdges vtkExtractSelection FillHoles vtkFeatureEdges BoundaryEdges CapClip ClosedSurface vtkFieldData WeightedTransformFilter vtkFillHolesFilter FillHoles vtkFloatArray BandedPolyDataContourFilter ElevationFilter FilledContours NullPoint SimpleElevationFilter WeightedTransformFilter vtkFrustumSource Frustum vtkGlyph3D ReadPDB VectorFieldNonZeroExtraction vtkGraphLayoutView XGMLReader vtkGreedyTerrainDecimation GreedyTerrainDecimation vtkHexahedron Hexahedron vtkIdList CellEdges IterateOverLines vtkIdTypeArray FillHoles vtkImageActor DEMReader ImageReader2Factory MetaImageReader MetaImageWriter vtkImageCanvasSource2D JPEGWriter WriteBMP WritePNG WritePNM WriteTIFF vtkImageCast JPEGWriter MetaImageWriter WritePNG vtkImageData GreedyTerrainDecimation IsoContours VectorFieldNonZeroExtraction WriteVTI vtkImageDataGeometryFilter WriteVTI vtkImageMagnitude VectorFieldNonZeroExtraction vtkImageMandelbrotSource MetaImageWriter vtkImageMapToColors DEMReader vtkImageReader2 ImageReader2Factory vtkImageReader2Factory ImageReader2Factory vtkImageViewer2 JPEGReader JPEGWriter PNGReader ReadBMP ReadDICOMSeries ReadPNM ReadTIFF WriteBMP WritePNG WritePNM WriteTIFF vtkImplicitBoolean ImplicitBoolean vtkIntArray NullPoint vtkInteractorStyleImage ReadDICOMSeries vtkJPEGReader JPEGReader JPEGWriter vtkJPEGWriter JPEGWriter vtkLandmarkTransform AlignFrames vtkLine ColoredLines DistancePointToLine ExtractEdges IterateOverLines LongLine WarpVector vtkLinearSubdivisionFilter Subdivision vtkLineSource GeometricObjectsDemo Line vtkLODActor ReadPDB SelectPolyData vtkLookupTable ColoredElevationMap DEMReader ElevationFilter FilledContours PlatonicSolid SimpleElevationFilter vtkLoopSubdivisionFilter Subdivision vtkMarchingCubes ExtractLargestIsosurface MarchingCubes vtkMarchingSquares MarchingSquares vtkMath AlignFrames ColoredElevationMap ContoursFromPolyData DistanceBetweenPoints GaussianRandomNumber GreedyTerrainDecimation OrientedArrow ParametricObjectsDemo UniformRandomNumber vtkMatrix4x4 AlignFrames OrientedArrow PerspectiveTransform vtkMatrixMathFilter MatrixMathFilter vtkMergePoints MarchingSquares vtkMeshQuality HighlightBadCells vtkMetaImageReader MetaImageReader MetaImageWriter vtkMetaImageWriter MetaImageWriter vtkMinimalStandardRandomSequence RandomSequence vtkMultiBlockDataSet MultiBlockMergeFilter vtkMultiBlockMergeFilter MultiBlockMergeFilter vtkMultiBlockPLOT3DReader ReadPLOT3D vtkOBBDicer OBBDicer vtkObject ReadDICOMSeries vtkOBJReader ReadOBJ vtkOrientedGlyphContourRepresentation PolygonalSurfaceContourLineInterpolator vtkOutlineCornerFilter OBBDicer vtkOutlineFilter IsoContours MarchingSquares SampleFunction vtkParametricBoy ParametricObjectsDemo vtkParametricConicSpiral ParametricObjectsDemo vtkParametricCrossCap ParametricObjectsDemo vtkParametricDini ParametricObjectsDemo vtkParametricEllipsoid ParametricObjectsDemo vtkParametricEnneper ParametricObjectsDemo vtkParametricFigure8Klein ParametricObjectsDemo vtkParametricFunction ParametricObjectsDemo vtkParametricFunctionSource ParametricObjects ParametricObjectsDemo vtkParametricKlein ParametricObjectsDemo vtkParametricMobius ParametricObjectsDemo vtkParametricRandomHills ParametricObjectsDemo vtkParametricRoman ParametricObjectsDemo vtkParametricSpline ParametricObjectsDemo vtkParametricSuperEllipsoid ParametricObjectsDemo vtkParametricSuperToroid ParametricObjectsDemo vtkParametricTorus ParametricObjects ParametricObjectsDemo vtkParticleReader ParticleReader vtkPDBReader ReadPDB vtkPerspectiveTransform PerspectiveTransform vtkPlane CapClip ContoursFromPolyData ProjectPointPlane SolidClip vtkPlanes Frustum Planes vtkPlanesIntersection PlanesIntersection vtkPlaneSource Plane vtkPlatonicSolidSource PlatonicSolid vtkPLYReader ReadPLY vtkPLYWriter ConvertFile vtkPNGReader PNGReader WritePNG vtkPNGWriter WritePNG vtkPNMReader ReadPNM WritePNM vtkPNMWriter WritePNM vtkPoints AlignFrames BandedPolyDataContourFilter ColoredElevationMap ColoredLines ElevationFilter ExtractEdges Hexahedron IterateOverLines LongLine NullPoint ParametricObjectsDemo PlanesIntersection Point Polygon PolygonIntersection PolyLine Pyramid Quad ReadPlainText SelectPolyData SimpleElevationFilter Tetrahedron Triangle TriangleStrip Vertex WarpVector WriteVTP WriteVTU XMLStructuredGridWriter vtkPolyData AlignFrames BandedPolyDataContourFilter CapClip ColoredElevationMap ColoredLines ContoursFromPolyData Decimate ElevationFilter FillHoles FindAllArrayNames Frustum HighlightBadCells IterateOverLines LongLine NullPoint OBBDicer Point PolyDataGetPoint Polygon PolygonalSurfaceContourLineInterpolator PolyLine Quad QuadricClustering QuadricDecimation ReadPlainText ReadUnknownTypeXMLFile SimpleElevationFilter Subdivision Triangle TriangleStrip VectorFieldNonZeroExtraction Vertex WarpVector WeightedTransformFilter WriteVTP vtkPolyDataAlgorithm GeometricObjectsDemo Subdivision vtkPolyDataConnectivityFilter ColorDisconnectedRegions ExtractLargestIsosurface PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion vtkPolygon Polygon PolygonIntersection vtkPolygonalSurfaceContourLineInterpolator PolygonalSurfaceContourLineInterpolator vtkPolygonalSurfacePointPlacer PolygonalSurfaceContourLineInterpolator vtkPolyLine PolyLine vtkPyramid Pyramid vtkQuad Quad vtkQuadricClustering QuadricClustering vtkQuadricDecimation QuadricDecimation vtkRegularPolygonSource GeometricObjectsDemo RegularPolygonSource Triangulate vtkSampleFunction ImplicitBoolean ImplicitSphere SampleFunction vtkSelection FillHoles vtkSelectionNode FillHoles vtkSelectPolyData SelectPolyData vtkShrinkPolyData ShrinkPolyData vtkSimpleElevationFilter SimpleElevationFilter vtkSimplePointsReader SimplePointsReader vtkSphere ImplicitBoolean ImplicitSphere SampleFunction vtkSphereSource Axes CapClip ClosedSurface ColorDisconnectedRegions ContoursFromPolyData Decimate DijkstraGraphGeodesicPath ExtractEdges FillHoles FindAllArrayNames GeometricObjectsDemo HighlightBadCells MarchingCubes MultiBlockMergeFilter OBBDicer OrientedArrow Planes PlanesIntersection PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion PolyDataGetPoint PolygonalSurfaceContourLineInterpolator QuadricClustering QuadricDecimation ReadPDB SelectPolyData ShrinkPolyData Sphere Subdivision WeightedTransformFilter WindowedSincPolyDataFilter vtkSTLReader ReadSTL vtkStripper CapClip vtkStructuredGrid XMLStructuredGridWriter vtkStructuredGridGeometryFilter ReadPLOT3D ReadStructuredGrid XMLStructuredGridWriter vtkStructuredPointsReader ExtractLargestIsosurface vtkSuperquadricSource SolidClip vtkTetra Tetrahedron WriteVTU vtkTextMapper GeometricObjectsDemo ParametricObjectsDemo ReadDICOMSeries Subdivision vtkTextProperty GeometricObjectsDemo ParametricObjectsDemo ReadDICOMSeries Subdivision vtkThreshold HighlightBadCells vtkThresholdPoints VectorFieldNonZeroExtraction vtkTIFFReader ReadTIFF WriteTIFF vtkTIFFWriter WriteTIFF vtkTransform AlignFrames Axes OrientedArrow PerspectiveTransform WeightedTransformFilter vtkTransformFilter AlignFrames WeightedTransformFilter vtkTransformPolyDataFilter OrientedArrow vtkTriangle CellEdges Triangle WriteVTP vtkTriangleFilter HighlightBadCells PolygonalSurfaceContourLineInterpolator Subdivision Triangulate vtkTriangleStrip TriangleStrip vtkTubeFilter ReadPDB vtkUndirectedGraph XGMLReader vtkUnsignedCharArray ColoredElevationMap ColoredLines ElevationFilter SimpleElevationFilter vtkUnstructuredGrid Hexahedron HighlightBadCells Pyramid ReadUnknownTypeXMLFile Tetrahedron WriteVTU vtkUnstructuredGridReader MatrixMathFilter vtkVertex Vertex vtkVertexGlyphFilter AlignFrames ReadPlainText vtkVolume16Reader MarchingSquares vtkVoxelModeller MarchingCubes vtkVRMLImporter VRML vtkWarpVector WarpVector vtkWeightedTransformFilter WeightedTransformFilter vtkWindowedSincPolyDataFilter WindowedSincPolyDataFilter vtkXGMLReader XGMLReader vtkXMLGenericDataObjectReader ReadUnknownTypeXMLFile vtkXMLImageDataReader ReadImageData WriteVTI vtkXMLImageDataWriter IsoContours WriteVTI vtkXMLPolyDataReader CapClip ContoursFromPolyData ConvertFile Curvature FilledContours FillHoles FindAllArrayNames OBBDicer ReadPolyData Subdivision WriteVTP vtkXMLPolyDataWriter AlignFrames Curvature FindAllArrayNames MatrixMathFilter WriteVTP vtkXMLRectilinearGridReader ReadRectilinearGrid vtkXMLStructuredGridReader ReadStructuredGrid XMLStructuredGridWriter vtkXMLStructuredGridWriter XMLStructuredGridWriter vtkXMLUnstructuredGridReader ReadUnstructuredGrid WriteVTU vtkXMLUnstructuredGridWriter WriteVTU"},{"location":"CSharp/Filtering/ContoursFromPolyData/","title":"ContoursFromPolyData","text":"

vtk-examples/CSharp/Filtering/ContoursFromPolyData

"},{"location":"CSharp/Filtering/ContoursFromPolyData/#description","title":"Description","text":"

This example uses [vtkCutter](https://www.vtk.org/doc/nightly/html/classvtkCutter.html#details) to generate contours from a PolyData. A [vtkPlane](https://www.vtk.org/doc/nightly/html/classvtkPlane.html#details) is set at the center of the PolyData and several contours are generated by specifying contour values that are distances to the center plane. The example works with a filename if provided. Otherwise is uses a [vtkSphereSource](https://www.vtk.org/doc/nightly/html/classvtkSphereSource.html#details).

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Filtering/ContoursFromPolyData/#code","title":"Code","text":"

ContoursFromPolyData.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ContoursFromPolyData(null);\n            //ContoursFromPolyData(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\bunny.vtp\");\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n      private void ContoursFromPolyData(string filePath) {\n         vtkPolyData inputPolyData;\n         if(filePath != null) {\n            vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n            reader.SetFileName(filePath);\n            reader.Update();\n            inputPolyData = reader.GetOutput();\n         }\n         else {\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.SetThetaResolution(30);\n            sphereSource.SetPhiResolution(15);\n            sphereSource.Update();\n            inputPolyData = sphereSource.GetOutput();\n         }\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInput(inputPolyData);\n#else\n         inputMapper.SetInputData(inputPolyData);\n#endif\n\n         // Create a plane to cut\n         vtkPlane plane = vtkPlane.New();\n         double[] center = inputPolyData.GetCenter();\n         double[] bounds = inputPolyData.GetBounds();\n         plane.SetOrigin(center[0], center[1], center[2]);\n         plane.SetNormal(1, 1, 1);\n\n\n         float[] centerf = new float[] { (float)center[0], (float)center[1], (float)center[2] };\n         float[] minBoundf = new float[] { (float)bounds[0], (float)bounds[2], (float)bounds[4] };\n         float[] maxBoundf = new float[] { (float)bounds[1], (float)bounds[3], (float)bounds[5] };\n         IntPtr pCenter = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * 3);\n         IntPtr pMinBound = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * 3);\n         IntPtr pMaxBound = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * 3);\n         Marshal.Copy(centerf, 0, pCenter, 3);\n         Marshal.Copy(minBoundf, 0, pMinBound, 3);\n         Marshal.Copy(maxBoundf, 0, pMaxBound, 3);\n\n         // vtkMath.Distance2BetweenPoints accepts floats only\n         double distanceMin = Math.Sqrt(vtkMath.Distance2BetweenPoints(pMinBound, pCenter));\n         double distanceMax = Math.Sqrt(vtkMath.Distance2BetweenPoints(pMaxBound, pCenter));\n\n         Marshal.FreeHGlobal(pCenter);\n         Marshal.FreeHGlobal(pMinBound);\n         Marshal.FreeHGlobal(pMaxBound);\n         // Create cutter\n         vtkCutter cutter = vtkCutter.New();\n         cutter.SetCutFunction(plane);\n#if VTK_MAJOR_VERSION_5\n         cutter.SetInput(inputPolyData);\n#else\n         cutter.SetInputData(inputPolyData);\n#endif\n         cutter.GenerateValues(20, -distanceMin, distanceMax);\n         vtkPolyDataMapper cutterMapper = vtkPolyDataMapper.New();\n         cutterMapper.SetInputConnection(cutter.GetOutputPort());\n         cutterMapper.ScalarVisibilityOff();\n\n         // Create plane actor\n         vtkActor planeActor = vtkActor.New();\n         planeActor.GetProperty().SetColor(1.0, 0.0, 0.0);\n         planeActor.GetProperty().SetLineWidth(3);\n         planeActor.SetMapper(cutterMapper);\n\n         // Create input actor\n         vtkActor inputActor = vtkActor.New();\n         inputActor.GetProperty().SetColor(1.0, 0.8941, 0.7686); // bisque\n         inputActor.SetMapper(inputMapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         renderer.AddActor(inputActor); \n         renderer.AddActor(planeActor); //display the contour lines\n      }\n   }\n}\n
"},{"location":"CSharp/Filters/ImplicitBoolean/","title":"ImplicitBoolean","text":"

vtk-examples/CSharp/Filters/ImplicitBoolean

"},{"location":"CSharp/Filters/ImplicitBoolean/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Note

As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Filters/ImplicitBoolean/#code","title":"Code","text":"

ImplicitBoolean.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ImplicitBoolean();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ImplicitBoolean() {\n         vtkSphere sphere1 = vtkSphere.New();\n         sphere1.SetCenter(.9, 0, 0);\n         vtkSphere sphere2 = vtkSphere.New();\n         sphere2.SetCenter(-.9, 0, 0);\n\n         vtkImplicitBoolean implicitBoolean = vtkImplicitBoolean.New();\n         implicitBoolean.AddFunction(sphere1);\n         implicitBoolean.AddFunction(sphere2);\n         implicitBoolean.SetOperationTypeToUnion();\n         //implicitBoolean.SetOperationTypeToIntersection();\n\n         // Sample the function\n         vtkSampleFunction sample = vtkSampleFunction.New();\n         sample.SetSampleDimensions(50, 50, 50);\n         sample.SetImplicitFunction(implicitBoolean);\n         double value = 3.0;\n         double xmin = -value, xmax = value,\n                ymin = -value, ymax = value,\n                zmin = -value, zmax = value;\n         sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n         // Create the 0 isosurface\n         vtkContourFilter contours = vtkContourFilter.New();\n#if VTK_MAJOR_VERSION_5\n         contours.SetInputConnection(sample.GetOutputPort());\n#else\n         contours.SetInputData(sample);\n#endif\n         contours.GenerateValues(1, 1, 1);\n\n         // Map the contours to graphical primitives\n         vtkPolyDataMapper contourMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         contourMapper.SetInputConnection(contours.GetOutputPort());\n#else\n         contourMapper.SetInputData(contours);\n#endif\n         contourMapper.ScalarVisibilityOff();\n\n         // Create an actor for the contours\n         vtkActor contourActor = vtkActor.New();\n         contourActor.SetMapper(contourMapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         renderer.AddActor(contourActor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Arrow/","title":"Arrow","text":"

vtk-examples/CSharp/GeometricObjects/Arrow

"},{"location":"CSharp/GeometricObjects/Arrow/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Arrow/#code","title":"Code","text":"

Arrow.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Arrow();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Arrow() {\n         // Create two arrows.  \n         vtkArrowSource arrowSource01 = vtkArrowSource.New();\n         vtkArrowSource arrowSource02 = vtkArrowSource.New();\n         arrowSource02.SetShaftResolution(24);   // default = 6\n         arrowSource02.SetTipResolution(36);     // default = 6\n\n         // Visualize\n         vtkPolyDataMapper mapper01 = vtkPolyDataMapper.New();\n         vtkPolyDataMapper mapper02 = vtkPolyDataMapper.New();\n         mapper01.SetInputConnection(arrowSource01.GetOutputPort());\n         mapper02.SetInputConnection(arrowSource02.GetOutputPort());\n         vtkActor actor01= vtkActor.New();\n         vtkActor actor02 = vtkActor.New();\n         actor01.SetMapper(mapper01);\n         actor02.SetMapper(mapper02);\n         actor01.SetPosition(0.0,  0.25, 0.0);\n         actor02.SetPosition(0.0, -0.25, 0.0);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor01);\n         renderer.AddActor(actor02);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Axes/","title":"Axes","text":"

vtk-examples/CSharp/GeometricObjects/Axes

"},{"location":"CSharp/GeometricObjects/Axes/#description","title":"Description","text":"

This example shows how to position an AxesActor in 3D. Notice that position and orientation of the AxesActor is done with a user transform. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Axes/#code","title":"Code","text":"

Axes.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Axes();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Axes() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.SetCenter(0.0, 0.0, 0.0);\n         sphereSource.SetRadius(0.5);\n\n         //create a mapper\n         vtkPolyDataMapper sphereMapper = vtkPolyDataMapper.New();\n         sphereMapper.SetInputConnection(sphereSource.GetOutputPort());\n\n         // create an actor\n         vtkActor sphereActor = vtkActor.New();\n         sphereActor.SetMapper(sphereMapper);\n\n         // a renderer and render window\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n\n         // add the actors to the scene\n         renderer.AddActor(sphereActor);\n\n         vtkAxesActor axes = vtkAxesActor.New();\n         // The axes are positioned with a user transform\n         vtkTransform transform = vtkTransform.New();\n         transform.Translate(0.75, 0.0, 0.0);\n         axes.SetUserTransform(transform);\n         // properties of the axes labels can be set as follows\n         // this sets the x axis label to red\n         // axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetColor(1,0,0);\n\n         // the actual text of the axis label can be changed:\n         // axes.SetXAxisLabelText(\"test\");\n\n         renderer.AddActor(axes);\n         // we need to call Render() for the whole renderWindow, \n         // because vtkAxesActor uses an overlayed renderer for the axes label\n         // in total we have now two renderer\n         renderWindow.Render();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/ColoredLines/","title":"ColoredLines","text":"

vtk-examples/CSharp/GeometricObjects/ColoredLines

"},{"location":"CSharp/GeometricObjects/ColoredLines/#description","title":"Description","text":"

Displays two lines, each with a different color. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/ColoredLines/#code","title":"Code","text":"

ColoredLines.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ColoredLines();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ColoredLines() {\n         // Create three points. Join (Origin and P0) with a red line and\n         // (Origin and P1) with a green line\n         double[] origin = new double[] { 0.0, 0.0, 0.0 };\n         double[] p0 = new double[] { 1.0, 0.0, 0.0 };\n         double[] p1 = new double[] { 0.0, 1.0, 0.0 };\n\n         // Create a vtkPoints object and store the points in it\n         vtkPoints pts = vtkPoints.New();\n         pts.InsertNextPoint(origin[0], origin[1], origin[2]);\n         pts.InsertNextPoint(p0[0], p0[1], p0[2]);\n         pts.InsertNextPoint(p1[0], p1[1], p1[2]);\n\n         // Setup two colors - one for each line\n         byte[] red = new byte[] { 255, 0, 0 };\n         byte[] green = new byte[] { 0, 255, 0 };\n\n         // Setup the colors array\n         vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();\n         colors.SetNumberOfComponents(3);\n         colors.SetName(\"Colors\");\n\n         // Add the colors we created to the colors array\n         colors.InsertNextValue(red[0]);\n         colors.InsertNextValue(red[1]);\n         colors.InsertNextValue(red[2]);\n\n         colors.InsertNextValue(green[0]);\n         colors.InsertNextValue(green[1]);\n         colors.InsertNextValue(green[2]);\n\n         // Create the first line (between Origin and P0)\n         vtkLine line0 = vtkLine.New();\n         line0.GetPointIds().SetId(0, 0); //the second 0 is the index of the Origin in the vtkPoints\n         line0.GetPointIds().SetId(1, 1); //the second 1 is the index of P0 in the vtkPoints\n\n         // Create the second line (between Origin and P1)\n         vtkLine line1 = vtkLine.New();\n         line1.GetPointIds().SetId(0, 0); //the second 0 is the index of the Origin in the vtkPoints\n         line1.GetPointIds().SetId(1, 2); //2 is the index of P1 in the vtkPoints\n\n         // Create a cell array to store the lines in and add the lines to it\n         vtkCellArray lines = vtkCellArray.New();\n         lines.InsertNextCell(line0);\n         lines.InsertNextCell(line1);\n\n         // Create a polydata to store everything in\n         vtkPolyData linesPolyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         linesPolyData.SetPoints(pts);\n\n         // Add the lines to the dataset\n         linesPolyData.SetLines(lines);\n\n         // Color the lines - associate the first component (red) of the\n         // colors array with the first component of the cell array (line 0)\n         // and the second component (green) of the colors array with the\n         // second component of the cell array (line 1)\n         linesPolyData.GetCellData().SetScalars(colors);\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(linesPolyData);\n         // create an actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // a renderer and render window\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n\n         // add the actors to the scene\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Cone/","title":"Cone","text":"

vtk-examples/CSharp/GeometricObjects/Cone

"},{"location":"CSharp/GeometricObjects/Cone/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Cone/#code","title":"Code","text":"

Cone.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Cone();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Cone() {\n         // Create a cone.  \n         vtkConeSource coneSource = vtkConeSource.New();\n         // coneSource.SetCapping(1);\n         // coneSource.SetRadius(0.5);\n         // coneSource.SetResolution(32);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(coneSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.3, 0.2, 0.1);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Cube/","title":"Cube","text":"

vtk-examples/CSharp/GeometricObjects/Cube

"},{"location":"CSharp/GeometricObjects/Cube/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Cube/#code","title":"Code","text":"

Cube.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Cube();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Cube() {\n         // Create a cube.  \n         vtkCubeSource cubeSource = vtkCubeSource.New();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(cubeSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.3, 0.2, 0.1);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Cylinder/","title":"Cylinder","text":"

vtk-examples/CSharp/GeometricObjects/Cylinder

"},{"location":"CSharp/GeometricObjects/Cylinder/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Cylinder/#code","title":"Code","text":"

Cylinder.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Cylinder();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Cylinder() {\n         // Create a cylinder.  \n         vtkCylinderSource cylinderSource = vtkCylinderSource.New();\n         cylinderSource.SetCenter(0.0, 0.0, 0.0);\n         cylinderSource.SetRadius(5.0);\n         cylinderSource.SetHeight(7.0);\n         cylinderSource.SetResolution(36);\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(cylinderSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.1, 0.3, 0.2);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Disk/","title":"Disk","text":"

vtk-examples/CSharp/GeometricObjects/Disk

"},{"location":"CSharp/GeometricObjects/Disk/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Disk/#code","title":"Code","text":"

Disk.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Disk();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Disk() {\n         // Create a disk.  \n         vtkDiskSource diskSource = vtkDiskSource.New();\n         //diskSource.SetCircumferentialResolution(16);\n         //diskSource.SetRadialResolution(16);\n         //diskSource.SetInnerRadius(0.25);\n         //diskSource.SetOuterRadius(1.25);\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(diskSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }   }\n}\n
"},{"location":"CSharp/GeometricObjects/Frustum/","title":"Frustum","text":"

vtk-examples/CSharp/GeometricObjects/Frustum

"},{"location":"CSharp/GeometricObjects/Frustum/#description","title":"Description","text":"

This example gets the frustum from a camera and displays it on the screen. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Frustum/#code","title":"Code","text":"

Frustum.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Frustum();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Frustum() {\n         // Create a frustum.  \n         // in this example we need the renderer first to retrieve the active camera\n         // in order to get camera's frustum planes\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         vtkCamera camera = renderer.GetActiveCamera();\n         double[] aspect = renderer.GetAspect();\n         double aspectRatio = aspect[0] / aspect[1];\n\n         // allocate memory for 24 unmanaged doubles\n         int size = Marshal.SizeOf(typeof(double)) * 24;\n         IntPtr ptr = Marshal.AllocHGlobal(size);\n         camera.GetFrustumPlanes(aspectRatio, ptr);\n         // in case we would need this values directly we could copy \n         // the unmanaged double array to a managed array like so:\n\n         // double[] planesArray = new double[24];\n         // Marshal.Copy(ptr, planesArray, 0, 24);\n\n         // but fortunately we can forward the IntPtr directly to the function \n         // SetFrustumPlanes()\n         vtkPlanes planes = vtkPlanes.New();\n         planes.SetFrustumPlanes(ptr);\n         // free unmanaged memory\n         Marshal.FreeHGlobal(ptr);\n\n         vtkFrustumSource frustumSource = vtkFrustumSource.New();\n         frustumSource.SetPlanes(planes);\n         frustumSource.Update();\n\n         vtkPolyData frustum = frustumSource.GetOutput();\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(frustum);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         renderer.SetBackground(.2, .1, .3); // Background color dark purple\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/GeometricObjectsDemo/","title":"GeometricObjectsDemo","text":"

vtk-examples/CSharp/GeometricObjects/GeometricObjectsDemo

"},{"location":"CSharp/GeometricObjects/GeometricObjectsDemo/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/GeometricObjectsDemo/#code","title":"Code","text":"

GeometricObjectsDemo.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.Runtime.InteropServices;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            GeometricObjectsDemo();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void GeometricObjectsDemo() {\n         // we create a matrix of 3x3 renderer in our renderwindow\n         // each renderer can be interacted with independently from one another\n         int rendererSize = 234; // width per renderer\n         int gridDimensions = 3;\n         this.Size = new System.Drawing.Size(756, 756);\n         Random rnd = new Random(2); // for background color variation\n\n         List<vtkPolyDataAlgorithm>  geometricObjectSources = new List<vtkPolyDataAlgorithm>();\n         geometricObjectSources.Add(vtkArrowSource.New());\n         geometricObjectSources.Add(vtkConeSource.New());\n         geometricObjectSources.Add(vtkCubeSource.New());\n         geometricObjectSources.Add(vtkCylinderSource.New());\n         geometricObjectSources.Add(vtkDiskSource.New());\n         geometricObjectSources.Add(vtkLineSource.New());\n         geometricObjectSources.Add(vtkRegularPolygonSource.New());\n         geometricObjectSources.Add(vtkSphereSource.New());\n         geometricObjectSources.Add(vtkEarthSource.New());\n\n         List<vtkRenderer> renderers = new List<vtkRenderer>();\n         List<vtkPolyDataMapper> mappers = new List<vtkPolyDataMapper>();\n         List<vtkActor> actors = new List<vtkActor>();\n         List<vtkTextMapper> textMappers = new List<vtkTextMapper>();\n         List<vtkActor2D> textActors = new List<vtkActor2D>();\n\n         // Create one text property for all\n         vtkTextProperty textProperty = vtkTextProperty.New();\n         textProperty.SetFontSize(18);\n         textProperty.SetJustificationToCentered();\n\n         // Create a source, renderer, mapper, and actor\n         // for each object \n         for(int i = 0; i < geometricObjectSources.Count; i++) {\n            geometricObjectSources[i].Update();\n            mappers.Add(vtkPolyDataMapper.New());\n            mappers[i].SetInputConnection(geometricObjectSources[i].GetOutputPort());\n\n            actors.Add(vtkActor.New());\n            actors[i].SetMapper(mappers[i]);\n\n            textMappers.Add(vtkTextMapper.New());\n            textMappers[i].SetInput(geometricObjectSources[i].GetClassName());\n            textMappers[i].SetTextProperty(textProperty);\n\n            textActors.Add(vtkActor2D.New());\n            textActors[i].SetMapper(textMappers[i]);\n            textActors[i].SetPosition(rendererSize/2, 16);\n\n            renderers.Add(vtkRenderer.New());\n         }\n\n         // Need a renderer even if there is no actor\n         for(int i = geometricObjectSources.Count; i < gridDimensions * gridDimensions; i++) {\n            renderers.Add(vtkRenderer.New());\n         }\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         renderWindow.SetSize(rendererSize*gridDimensions, rendererSize*gridDimensions);\n\n         for(int row = 0; row < gridDimensions; row++) {\n            for(int col = 0; col < gridDimensions; col++) {\n               int index = row * gridDimensions + col;\n\n               // (xmin, ymin, xmax, ymax)\n               double[] viewport = new double[] {\n                  (col) * rendererSize / (double)(gridDimensions * rendererSize),\n                  (gridDimensions - (row+1)) * rendererSize / (double)(gridDimensions * rendererSize),\n                  (col+1)*rendererSize / (double)(gridDimensions * rendererSize),\n                  (gridDimensions - row) * rendererSize / (double)(gridDimensions * rendererSize)};\n\n               Debug.WriteLine(viewport[0] + \" \" + viewport[1] + \" \" + viewport[2] + \" \" + viewport[3]);\n               renderWindow.AddRenderer(renderers[index]);\n               IntPtr pViewport = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double))*4);\n               Marshal.Copy(viewport, 0, pViewport, 4);\n               renderers[index].SetViewport(pViewport);\n               Marshal.FreeHGlobal(pViewport);\n               if(index > geometricObjectSources.Count - 1)\n                  continue;\n\n               renderers[index].AddActor(actors[index]);\n               renderers[index].AddActor(textActors[index]);\n               renderers[index].SetBackground(.2 + rnd.NextDouble() / 8, .3 + rnd.NextDouble() / 8, .4 + rnd.NextDouble() / 8);\n            }\n         }\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Hexahedron/","title":"Hexahedron","text":"

vtk-examples/CSharp/GeometricObjects/Hexahedron

"},{"location":"CSharp/GeometricObjects/Hexahedron/#description","title":"Description","text":"

This example creates eight points and creates a hexahedron from the points. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Hexahedron/#code","title":"Code","text":"

Hexahedron.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Hexahedron();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Hexahedron() {\n         // Setup the coordinates of eight points \n         // (faces must be in counter clockwise order as viewed from the outside)\n         double[,] p = new double[,] { \n            { 0.0, 0.0, 0.0 }, \n            { 1.0, 0.0, 0.0 },\n            { 1.0, 1.0, 0.0 },\n            { 0.0, 1.0, 0.0 },\n            { 0.0, 0.0, 1.0 },\n            { 1.0, 0.0, 1.0 },\n            { 1.0, 1.0, 1.0 },\n            { 0.0, 1.0, 1.0 }\n         };\n\n         // Create the points\n         vtkPoints points = vtkPoints.New();\n         for(int i = 0; i < 8; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n         // Create a hexahedron from the points\n         vtkHexahedron hex = vtkHexahedron.New();\n         for(int i = 0; i < 8; i++)\n            hex.GetPointIds().SetId(i, i);\n\n         // Add the hexahedron to a cell array\n         vtkCellArray hexs = vtkCellArray.New();\n         hexs.InsertNextCell(hex);\n\n         // Add the points and hexahedron to an unstructured grid\n         vtkUnstructuredGrid uGrid = vtkUnstructuredGrid.New();\n         uGrid.SetPoints(points);\n         uGrid.InsertNextCell(hex.GetCellType(), hex.GetPointIds());\n\n         // Visualize\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInput(uGrid);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetLineWidth(4);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Line/","title":"Line","text":"

vtk-examples/CSharp/GeometricObjects/Line

"},{"location":"CSharp/GeometricObjects/Line/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Line/#code","title":"Code","text":"

Line.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Line();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Line() {\n         // Create a line.  \n         vtkLineSource lineSource = vtkLineSource.New();\n         // Create two points, P0 and P1\n         double[] p0 = new double[] { 1.0, 0.0, 0.0 };\n         double[] p1 = new double[] { 0.0, 1.0, 0.0 };\n\n         lineSource.SetPoint1(p0[0], p0[1], p0[2]);\n         lineSource.SetPoint2(p1[0], p1[1], p1[2]);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(lineSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetLineWidth(4);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/LongLine/","title":"LongLine","text":"

vtk-examples/CSharp/GeometricObjects/LongLine

"},{"location":"CSharp/GeometricObjects/LongLine/#description","title":"Description","text":"

Connect several points with a line. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/LongLine/#code","title":"Code","text":"

LongLine.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            LongLine();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void LongLine() {\n         // Create five points \n         double[,] p = new double[,] { \n            { 0.0, 0.0, 0.0 }, \n            { 1.0, 0.0, 0.0 },\n            { 0.0, 1.0, 0.0 },\n            { 0.0, 1.0, 2.0 },\n            { 1.0, 2.0, 3.0 }\n         };\n\n         // Create a vtkPoints object and store the points in it\n         vtkPoints points = vtkPoints.New();\n         for(int i = 0; i < 5; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n         // Create a cell array to store the lines in and add the lines to it\n         vtkCellArray lines = vtkCellArray.New();\n\n         for(int i = 0; i < 4; i++) {\n            vtkLine line = vtkLine.New();\n            line.GetPointIds().SetId(0, i);\n            line.GetPointIds().SetId(1, i + 1);\n            lines.InsertNextCell(line);\n         }\n\n         // Create a polydata to store everything in\n         vtkPolyData linesPolyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         linesPolyData.SetPoints(points);\n\n         // Add the lines to the dataset\n         linesPolyData.SetLines(lines);\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(linesPolyData);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetLineWidth(4);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/OrientedArrow/","title":"OrientedArrow","text":"

vtk-examples/CSharp/GeometricObjects/OrientedArrow

"},{"location":"CSharp/GeometricObjects/OrientedArrow/#description","title":"Description","text":"

This example illustrates how to create and display an arrow that passes through two points.

It demonstrates two different ways to apply the transform:

"},{"location":"CSharp/GeometricObjects/OrientedArrow/#use-vtktransformpolydatafilterhttpswwwvtkorgdocnightlyhtmlclassvtktransformpolydatafilterhtmldetails-to-create-a-new-transformed-polydata-this-method-is-useful-if-the-transformed-polydata-is-needed-later-in-the-pipeline-eg-vtkglyph3dfilter","title":"Use [vtkTransformPolyDataFilter](https://www.vtk.org/doc/nightly/html/classvtkTransformPolyDataFilter.html#details) to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter.","text":""},{"location":"CSharp/GeometricObjects/OrientedArrow/#apply-the-transform-directly-to-the-actor-using-vtkprop3dhttpswwwvtkorgdocnightlyhtmlclassvtkprop3dhtmldetailss-setusermatrix-no-new-data-is-produced","title":"Apply the transform directly to the actor using [vtkProp3D](https://www.vtk.org/doc/nightly/html/classvtkProp3D.html#details)'s SetUserMatrix. No new data is produced.","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/OrientedArrow/#code","title":"Code","text":"

OrientedArrow.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            OrientedArrow();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void OrientedArrow() {\n         //Create an arrow.\n         vtkArrowSource arrowSource = vtkArrowSource.New();\n\n         // Generate a random start and end point\n         vtkMath.RandomSeed(8775070);\n         double[] startPoint = new double[]{\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10)\n         };\n\n         double[] endPoint = new double[]{\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10)\n         };\n\n         // Compute a basis\n         double[] normalizedX = new double[3];\n         double[] normalizedY = new double[3];\n         double[] normalizedZ = new double[3];\n\n         // The X axis is a vector from start to end\n         myMath.Subtract(endPoint, startPoint, ref normalizedX);\n         double length = myMath.Norm(normalizedX);\n         myMath.Normalize(ref normalizedX);\n\n         // The Z axis is an arbitrary vector cross X\n         double[] arbitrary = new double[]{\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10)\n         };\n         myMath.Cross(normalizedX, arbitrary, ref normalizedZ);\n         myMath.Normalize(ref normalizedZ);\n         // The Y axis is Z cross X\n         myMath.Cross(normalizedZ, normalizedX, ref normalizedY);\n         vtkMatrix4x4 matrix = vtkMatrix4x4.New();\n\n         // Create the direction cosine matrix\n         matrix.Identity();\n         for(int i = 0; i < 3; i++) {\n            matrix.SetElement(i, 0, normalizedX[i]);\n            matrix.SetElement(i, 1, normalizedY[i]);\n            matrix.SetElement(i, 2, normalizedZ[i]);\n         }\n\n         // Apply the transforms\n         vtkTransform transform = vtkTransform.New();\n         transform.Translate(startPoint[0], startPoint[1], startPoint[2]);\n         transform.Concatenate(matrix);\n         transform.Scale(length, length, length);\n\n\n         //Create a mapper and actor for the arrow\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         vtkActor actor = vtkActor.New();\n#if USER_MATRIX\n         mapper.SetInputConnection(arrowSource.GetOutputPort());\n         actor.SetUserMatrix(transform.GetMatrix());\n#else\n         // Transform the polydata\n         vtkTransformPolyDataFilter transformPD = vtkTransformPolyDataFilter.New();\n         transformPD.SetTransform(transform);\n         transformPD.SetInputConnection(arrowSource.GetOutputPort());\n         mapper.SetInputConnection(transformPD.GetOutputPort());\n#endif\n         actor.SetMapper(mapper);\n\n         // Create spheres for start and end point\n         vtkSphereSource sphereStartSource = vtkSphereSource.New();\n         sphereStartSource.SetCenter(startPoint[0], startPoint[1], startPoint[2]);\n         vtkPolyDataMapper sphereStartMapper = vtkPolyDataMapper.New();\n         sphereStartMapper.SetInputConnection(sphereStartSource.GetOutputPort());\n         vtkActor sphereStart = vtkActor.New();\n         sphereStart.SetMapper(sphereStartMapper);\n         sphereStart.GetProperty().SetColor(1.0, 1.0, .3);\n\n         vtkSphereSource sphereEndSource = vtkSphereSource.New();\n         sphereEndSource.SetCenter(endPoint[0], endPoint[1], endPoint[2]);\n         vtkPolyDataMapper sphereEndMapper = vtkPolyDataMapper.New();\n         sphereEndMapper.SetInputConnection(sphereEndSource.GetOutputPort());\n         vtkActor sphereEnd = vtkActor.New();\n         sphereEnd.SetMapper(sphereEndMapper);\n         sphereEnd.GetProperty().SetColor(1.0, .3, .3);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.AddActor(sphereStart);\n         renderer.AddActor(sphereEnd);\n         renderer.ResetCamera();\n      }\n   }\n\n\n   // I'm using my own math class\n   // reason: due to the fact that ActiViz wraps native, unmanaged functions in class vtkMath\n   // many of the arguments like double arrays (for vector definition) has to be passed by an IntPtr.\n   //\n   // But there do exist some managed open source math libraries of professional quality, that it\n   // should be not a problem at all using another math library for vector algebra.\n   //   \n   // vtkmath could be used for vetor algebra, no doubt, but then functions which heavily relies on \n   // vector algebra like dot or cross product, etc. would be full of Marshaling code.\n\n   public class myMath {\n      public static void Subtract(double[] a, double[] b, ref double[] c) {\n         c[0] = a[0] - b[0];\n         c[1] = a[1] - b[1];\n         c[2] = a[2] - b[2];\n      }\n\n\n      public static double Norm(double[] x) {\n         return Math.Sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);\n      }\n\n\n      public static void Normalize(ref double[] x) {\n         double length = Norm(x);\n         x[0] /= length;\n         x[1] /= length;\n         x[2] /= length;\n      }\n\n      public static void Cross(double[] x, double[] y, ref double[] z) {\n         z[0] = ( x[1] * y[2] ) - ( x[2] * y[1] );\n         z[1] = ( x[2] * y[0] ) - ( x[0] * y[2] );\n         z[2] = ( x[0] * y[1] ) - ( x[1] * y[0] );\n      }\n   }\n\n}\n
"},{"location":"CSharp/GeometricObjects/ParametricObjects/","title":"ParametricObjects","text":"

vtk-examples/CSharp/GeometricObjects/ParametricObjects

"},{"location":"CSharp/GeometricObjects/ParametricObjects/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/ParametricObjects/#code","title":"Code","text":"

ParametricObjects.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ParametricObjects();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ParametricObjects() {\n         // Select one of the following (matching the selection above)\n         vtkParametricTorus parametricObject = vtkParametricTorus.New();\n         //vtkParametricBoy parametricObject = vtkParametricBoy.New();\n         //vtkParametricConicSpiral parametricObject = vtkParametricConicSpiral.New();\n         //vtkParametricCrossCap parametricObject = vtkParametricCrossCap.New();\n         //vtkParametricDini parametricObject = vtkParametricDini.New();\n         //vtkParametricEllipsoid parametricObject = vtkParametricEllipsoid.New();\n         //vtkParametricEnneper parametricObject = vtkParametricEnneper.New();\n         //vtkParametricFigure8Klein parametricObject = vtkParametricFigure8Klein.New();\n         //vtkParametricKlein parametricObject = vtkParametricKlein.New();\n         //vtkParametricMobius parametricObject = vtkParametricMobius.New();\n         //vtkParametricRandomHills parametricObject = vtkParametricRandomHills.New();\n         //vtkParametricRoman parametricObject = vtkParametricRoman.New();\n         //vtkParametricSpline parametricObject = vtkParametricSpline.New();\n         //vtkParametricSuperEllipsoid parametricObject = vtkParametricSuperEllipsoid.New();\n         //vtkParametricSuperToroid parametricObject = vtkParametricSuperToroid.New();\n         //vtkParametricTorus parametricObject = vtkParametricTorus.New();\n\n\n         vtkParametricFunctionSource parametricFunctionSource = vtkParametricFunctionSource.New();\n         parametricFunctionSource.SetParametricFunction(parametricObject);\n         parametricFunctionSource.Update();\n\n         // Setup mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(parametricFunctionSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // Visualize\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/ParametricObjectsDemo/","title":"ParametricObjectsDemo","text":"

vtk-examples/CSharp/GeometricObjects/ParametricObjectsDemo

"},{"location":"CSharp/GeometricObjects/ParametricObjectsDemo/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/ParametricObjectsDemo/#code","title":"Code","text":"

ParametricObjectsDemo.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ParametricObjectsDemo();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ParametricObjectsDemo() {\n         // we create a matrix of 4x4 renderer in our renderwindow\n         // each renderer can be interacted with independently from one another\n         int rendererSize = 189; // width per renderer\n         int gridDimensions = 4;\n         this.Size = new System.Drawing.Size(756, 756);\n         Random rnd = new Random(2);\n         List<vtkParametricFunction>  parametricObjects = new List<vtkParametricFunction>();\n         parametricObjects.Add(vtkParametricBoy.New());\n         parametricObjects.Add(vtkParametricConicSpiral.New());\n         parametricObjects.Add(vtkParametricCrossCap.New());\n         parametricObjects.Add(vtkParametricDini.New());\n         vtkParametricEllipsoid ellipsoid = vtkParametricEllipsoid.New();\n         ellipsoid.SetXRadius(0.5);\n         ellipsoid.SetYRadius(2.0);\n         parametricObjects.Add(ellipsoid);\n         parametricObjects.Add(vtkParametricEnneper.New());\n         parametricObjects.Add(vtkParametricFigure8Klein.New());\n         parametricObjects.Add(vtkParametricKlein.New());\n         parametricObjects.Add(vtkParametricMobius.New());\n         vtkParametricRandomHills randomHills = vtkParametricRandomHills.New();\n         randomHills.AllowRandomGenerationOff();\n         parametricObjects.Add(randomHills);\n         parametricObjects.Add(vtkParametricRoman.New());\n         vtkParametricSuperEllipsoid superEllipsoid = vtkParametricSuperEllipsoid.New();\n         superEllipsoid.SetN1(.50);\n         superEllipsoid.SetN2(.1);\n         parametricObjects.Add(superEllipsoid);\n         vtkParametricSuperToroid superToroid = vtkParametricSuperToroid.New();\n         superToroid.SetN1(0.2);\n         superToroid.SetN2(3.0);\n         parametricObjects.Add(superToroid);\n         parametricObjects.Add(vtkParametricTorus.New());\n\n         vtkParametricSpline spline = vtkParametricSpline.New();\n         vtkPoints inputPoints = vtkPoints.New();\n         vtkMath.RandomSeed(8775070);\n         for(int p = 0; p < 10; p++) {\n            double x = vtkMath.Random(0.0, 1.0);\n            double y = vtkMath.Random(0.0, 1.0);\n            double z = vtkMath.Random(0.0, 1.0);\n            inputPoints.InsertNextPoint(x, y, z);\n         }\n         spline.SetPoints(inputPoints);\n\n         parametricObjects.Add(spline);\n\n\n         List<vtkParametricFunctionSource> parametricFunctionSources = new List<vtkParametricFunctionSource>();\n         List<vtkRenderer> renderers = new List<vtkRenderer>();\n         List<vtkPolyDataMapper> mappers = new List<vtkPolyDataMapper>();\n         List<vtkActor> actors = new List<vtkActor>();\n         List<vtkTextMapper> textMappers = new List<vtkTextMapper>();\n         List<vtkActor2D> textActors = new List<vtkActor2D>();\n\n         // Create one text property for all\n         vtkTextProperty textProperty = vtkTextProperty.New();\n         textProperty.SetFontSize(12);\n         textProperty.SetJustificationToCentered();\n\n         // Create a source, renderer, mapper, and actor\n         // for each object \n         for(int i = 0; i < parametricObjects.Count; i++) {\n            parametricFunctionSources.Add(vtkParametricFunctionSource.New());\n            parametricFunctionSources[i].SetParametricFunction(parametricObjects[i]);\n            parametricFunctionSources[i].Update();\n            mappers.Add(vtkPolyDataMapper.New());\n            mappers[i].SetInputConnection(parametricFunctionSources[i].GetOutputPort());\n\n            actors.Add(vtkActor.New());\n            actors[i].SetMapper(mappers[i]);\n\n            textMappers.Add(vtkTextMapper.New());\n            textMappers[i].SetInput(parametricObjects[i].GetClassName());\n            textMappers[i].SetTextProperty(textProperty);\n\n            textActors.Add(vtkActor2D.New());\n            textActors[i].SetMapper(textMappers[i]);\n            textActors[i].SetPosition(rendererSize / 2, 16);\n\n            renderers.Add(vtkRenderer.New());\n         }\n\n         // Need a renderer even if there is no actor\n         for(int i = parametricObjects.Count; i < gridDimensions * gridDimensions; i++) {\n            renderers.Add(vtkRenderer.New());\n         }\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         renderWindow.SetSize(rendererSize * gridDimensions, rendererSize * gridDimensions);\n\n         for(int row = 0; row < gridDimensions; row++) {\n            for(int col = 0; col < gridDimensions; col++) {\n               int index = row * gridDimensions + col;\n\n               // (xmin, ymin, xmax, ymax)\n               double[] viewport = new double[] {\n                  (col) * rendererSize / (double)(gridDimensions * rendererSize),\n                  (gridDimensions - (row+1)) * rendererSize / (double)(gridDimensions * rendererSize),\n                  (col+1)*rendererSize / (double)(gridDimensions * rendererSize),\n                  (gridDimensions - row) * rendererSize / (double)(gridDimensions * rendererSize)};\n\n               //Debug.WriteLine(viewport[0] + \" \" + viewport[1] + \" \" + viewport[2] + \" \" + viewport[3]);\n               renderWindow.AddRenderer(renderers[index]);\n               IntPtr pViewport = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 4);\n               Marshal.Copy(viewport, 0, pViewport, 4);\n               renderers[index].SetViewport(pViewport);\n               Marshal.FreeHGlobal(pViewport);\n               if(index > parametricObjects.Count - 1)\n                  continue;\n\n               renderers[index].AddActor(actors[index]);\n               renderers[index].AddActor(textActors[index]);\n               renderers[index].SetBackground(.2 + rnd.NextDouble() / 8, .3 + rnd.NextDouble() / 8, .4 + rnd.NextDouble() / 8);\n               renderers[index].ResetCamera();\n               renderers[index].GetActiveCamera().Azimuth(30);\n               renderers[index].GetActiveCamera().Elevation(-50);\n               renderers[index].GetActiveCamera().Pitch(-2);\n               renderers[index].ResetCameraClippingRange();\n            }\n         }\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Plane/","title":"Plane","text":"

vtk-examples/CSharp/GeometricObjects/Plane

"},{"location":"CSharp/GeometricObjects/Plane/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Plane/#code","title":"Code","text":"

Plane.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Plane();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Plane() {\n         // Create a plane\n         vtkPlaneSource planeSource = vtkPlaneSource.New();\n         planeSource.SetCenter(1.0, 0.0, 0.0);\n         planeSource.SetNormal(1.0, 0.0, 1.0);\n         planeSource.Update();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(planeSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetLineWidth(4);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Planes/","title":"Planes","text":"

vtk-examples/CSharp/GeometricObjects/Planes

"},{"location":"CSharp/GeometricObjects/Planes/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Planes/#code","title":"Code","text":"

Planes.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Planes();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Planes() {\n         // in this example we need the renderer first to retrieve the active camera\n         // in order to get camera's frustum planes and renderer's aspectratio\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = vtkRenderer.New();\n         renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         vtkCamera camera = renderer.GetActiveCamera();\n         double[] aspect = renderer.GetAspect();\n         double aspectRatio = aspect[0] / aspect[1];\n\n         vtkPlanes planes = vtkPlanes.New();\n         // one way\n         {\n            // allocate memory for 24 unmanaged doubles\n            int size = Marshal.SizeOf(typeof(double)) * 24;\n            IntPtr ptr = Marshal.AllocHGlobal(size);\n            camera.GetFrustumPlanes(aspectRatio, ptr);\n            // in case we would need this values diectly we could copy \n            // the unmanaged double array to a managed array like so:\n\n            // double[] planesArray = new double[24];\n            // Marshal.Copy(ptr, planesArray, 0, 24);\n\n            // but fortunately we can forward the IntPtr directly to the function \n            // SetFrustumPlanes()\n            planes.SetFrustumPlanes(ptr);\n            // free unmanaged memory\n            Marshal.FreeHGlobal(ptr);\n         }\n         // another way\n         {\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.Update();\n            double[] bounds = new double[6];\n            bounds = sphereSource.GetOutput().GetBounds();\n            planes.SetBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);\n         }\n         // nothing to visualize\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/PlanesIntersection/","title":"PlanesIntersection","text":"

vtk-examples/CSharp/GeometricObjects/PlanesIntersection

"},{"location":"CSharp/GeometricObjects/PlanesIntersection/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/PlanesIntersection/#code","title":"Code","text":"

PlanesIntersection.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            PlanesIntersection();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void PlanesIntersection() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         double[] bounds = new double[6];\n         bounds = sphereSource.GetOutput().GetBounds();\n\n         vtkPoints box = vtkPoints.New();\n\n         box.SetNumberOfPoints(8);\n\n         double xMin, xMax, yMin, yMax, zMin, zMax;\n         xMin = bounds[0]; xMax = bounds[1];\n         yMin = bounds[2]; yMax = bounds[3];\n         zMin = bounds[4]; zMax = bounds[5];\n\n         box.SetPoint(0, xMax, yMin, zMax);\n         box.SetPoint(1, xMax, yMin, zMin);\n         box.SetPoint(2, xMax, yMax, zMin);\n         box.SetPoint(3, xMax, yMax, zMax);\n         box.SetPoint(4, xMin, yMin, zMax);\n         box.SetPoint(5, xMin, yMin, zMin);\n         box.SetPoint(6, xMin, yMax, zMin);\n         box.SetPoint(7, xMin, yMax, zMax);\n\n         vtkPlanesIntersection planesIntersection = vtkPlanesIntersection.New();\n         planesIntersection.SetBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);\n         int intersects = planesIntersection.IntersectsRegion(box);\n         Debug.WriteLine(\"Intersects? \" + ( ( intersects == 1 ) ? true : false ).ToString());\n         // nothing to visualize\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/PlatonicSolid/","title":"PlatonicSolid","text":"

vtk-examples/CSharp/GeometricObjects/PlatonicSolid

"},{"location":"CSharp/GeometricObjects/PlatonicSolid/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/PlatonicSolid/#code","title":"Code","text":"

PlatonicSolid.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            PlatonicSolid();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void PlatonicSolid() {\n         vtkPlatonicSolidSource platonicSolidSource = vtkPlatonicSolidSource.New();\n         platonicSolidSource.SetSolidTypeToOctahedron();\n\n         // Each face has a different cell scalar\n         vtkLookupTable lut = vtkLookupTable.New();\n         lut.SetNumberOfTableValues(8);\n         lut.SetTableRange(0.0, 7.0);\n         lut.Build();\n         lut.SetTableValue(0, 0, 0, 0, 1);\n         lut.SetTableValue(1, 0, 0, 1, 1);\n         lut.SetTableValue(2, 0, 1, 0, 1);\n         lut.SetTableValue(3, 0, 1, 1, 1);\n         lut.SetTableValue(4, 1, 0, 0, 1);\n         lut.SetTableValue(5, 1, 0, 1, 1);\n         lut.SetTableValue(6, 1, 1, 0, 1);\n         lut.SetTableValue(7, 1, 1, 1, 1);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(platonicSolidSource.GetOutputPort());\n         mapper.SetLookupTable(lut);\n         mapper.SetScalarRange(0, 7);\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Point/","title":"Point","text":"

vtk-examples/CSharp/GeometricObjects/Point

"},{"location":"CSharp/GeometricObjects/Point/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Point/#code","title":"Code","text":"

Point.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Point();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Point() {\n         // Create the geometry of the points (the coordinate)\n         vtkPoints points = vtkPoints.New();\n         double[,] p = new double[,] {\n            {1.0, 2.0, 3.0}, \n            {3.0, 1.0, 2.0}, \n            {2.0, 3.0, 1.0}\n         };\n\n         // Create topology of the points (a vertex per point)\n         vtkCellArray vertices = vtkCellArray.New();\n         int nPts = 3;\n\n         int[] ids = new int[nPts];\n         for(int i = 0; i < nPts; i++)\n            ids[i] = points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n         int size = Marshal.SizeOf(typeof(int)) * nPts;\n         IntPtr pIds = Marshal.AllocHGlobal(size);\n         Marshal.Copy(ids, 0, pIds, nPts);\n         vertices.InsertNextCell(nPts, pIds);\n         Marshal.FreeHGlobal(pIds);\n\n         // Create a polydata object\n         vtkPolyData pointPoly = vtkPolyData.New();\n\n         // Set the points and vertices we created as the geometry and topology of the polydata\n         pointPoly.SetPoints(points);\n         pointPoly.SetVerts(vertices);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(pointPoly);\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetPointSize(20);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.3, 0.2, 0.1);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/PolyLine/","title":"PolyLine","text":"

vtk-examples/CSharp/GeometricObjects/PolyLine

"},{"location":"CSharp/GeometricObjects/PolyLine/#description","title":"Description","text":"

This example demonstrates how to make a line through several ordered points. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/PolyLine/#code","title":"Code","text":"

PolyLine.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            PolyLine();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void PolyLine() {\n         // Create five points\n         double[,] p = new double[,] { \n            { 0.0, 0.0, 0.0 }, \n            { 1.0, 0.0, 0.0 },\n            { 0.0, 1.0, 0.0 },\n            { 0.0, 1.0, 2.0 },\n            { 0.0, 3.0, 3.0 }\n         };\n\n         // Create the points\n         vtkPoints points = vtkPoints.New();\n         for(int i = 0; i < 5; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n\n         vtkPolyLine polyLine = vtkPolyLine.New();\n         polyLine.GetPointIds().SetNumberOfIds(5);\n         for(int i = 0; i < 5; i++)\n            polyLine.GetPointIds().SetId(i, i);\n\n         // Create a cell array to store the lines in and add the lines to it\n         vtkCellArray cells = vtkCellArray.New();\n         cells.InsertNextCell(polyLine);\n\n         // Create a polydata to store everything in\n         vtkPolyData polyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         polyData.SetPoints(points);\n\n         // Add the lines to the dataset\n         polyData.SetLines(cells);\n         //Create an actor and mapper\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(polyData);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Polygon/","title":"Polygon","text":"

vtk-examples/CSharp/GeometricObjects/Polygon

"},{"location":"CSharp/GeometricObjects/Polygon/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Polygon/#code","title":"Code","text":"

Polygon.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Polygon();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Polygon() {\n         // Setup four points\n         vtkPoints points = vtkPoints.New();\n         double c = Math.Cos(Math.PI / 6); // helper variable\n\n         points.InsertNextPoint(0.0, -1.0, 0.0);\n         points.InsertNextPoint(c, -0.5, 0.0);\n         points.InsertNextPoint(c, 0.5, 0.0);\n         points.InsertNextPoint(0.0, 1.0, 0.0);\n         points.InsertNextPoint(-c, 0.5, 0.0);\n         points.InsertNextPoint(-c, -0.5, 0.0);\n\n         // Create the polygon\n         vtkPolygon polygon = vtkPolygon.New();\n         polygon.GetPointIds().SetNumberOfIds(6); //make a six-sided figure\n         polygon.GetPointIds().SetId(0, 0);\n         polygon.GetPointIds().SetId(1, 1);\n         polygon.GetPointIds().SetId(2, 2);\n         polygon.GetPointIds().SetId(3, 3);\n         polygon.GetPointIds().SetId(4, 4);\n         polygon.GetPointIds().SetId(5, 5);\n\n         // Add the polygon to a list of polygons\n         vtkCellArray polygons = vtkCellArray.New();\n         polygons.InsertNextCell(polygon);\n\n         // Create a PolyData\n         vtkPolyData polygonPolyData = vtkPolyData.New();\n         polygonPolyData.SetPoints(points);\n         polygonPolyData.SetPolys(polygons);\n\n         // Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(polygonPolyData);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/PolygonIntersection/","title":"PolygonIntersection","text":"

vtk-examples/CSharp/GeometricObjects/PolygonIntersection

"},{"location":"CSharp/GeometricObjects/PolygonIntersection/#description","title":"Description","text":"

Calculates the intersection of a polygon and a line. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/PolygonIntersection/#code","title":"Code","text":"

PolygonIntersection.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            PolygonIntersection();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void PolygonIntersection() {\n         // Create a square in the XY plane\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0.0, 0.0, 0.0);\n         points.InsertNextPoint(1.0, 0.0, 0.0);\n         points.InsertNextPoint(1.0, 1.0, 0.0);\n         points.InsertNextPoint(0.0, 1.0, 0.0);\n\n         // Create the polygon\n         vtkPolygon polygon = vtkPolygon.New();\n         polygon.GetPoints().DeepCopy(points);\n         polygon.GetPointIds().SetNumberOfIds(4); // 4 corners of the square\n         polygon.GetPointIds().SetId(0, 0);\n         polygon.GetPointIds().SetId(1, 1);\n         polygon.GetPointIds().SetId(2, 2);\n         polygon.GetPointIds().SetId(3, 3);\n\n         // our line to intersect the polygon with\n         double[] p1 = new double[] { 0.1, 0, -1.0 };\n         double[] p2 = new double[] { 0.1, 0, 1.0 };\n         double tolerance = 0.001;\n         // Outputs\n         // t must be initalized cause it is passed by reference (that's a c# convention)\n         double t = 0.0; // Parametric coordinate of intersection (0 (corresponding to p1) to 1 (corresponding to p2))\n         double[] x = new double[] { 0.0, 0.0, 0.0 };\n         double[] coords = new double[] { 0.0, 0.0, 0.0 };\n         // subId must be initialized cause it is passed by reference (that's a c# convention)\n         int subId = 0;\n\n         IntPtr pP1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n         IntPtr pP2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n         IntPtr pX = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n         IntPtr pCoords = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n         Marshal.Copy(p1, 0, pP1, 3);\n         Marshal.Copy(p2, 0, pP2, 3);\n         // next two lines are not necessarely needed, but I prefer to initialize ref parameter (in those a result is passed back)\n         Marshal.Copy(x, 0, pX, 3);\n         Marshal.Copy(coords, 0, pCoords, 3);\n         // see vtkCell API for a detailed description of this function\n         int iD = polygon.IntersectWithLine(pP1, pP2, tolerance, ref t, pX, pCoords, ref subId);\n         // Copy result back to our managed arrays\n         Marshal.Copy(pX, x, 0, 3);\n         Marshal.Copy(pCoords, coords, 0, 3);\n         Console.WriteLine(\"intersected? \" + iD); ;\n         Console.WriteLine(\"intersection: \" + x[0] + \" \" + x[1] + \" \" + x[2]);\n         Marshal.FreeHGlobal(pP1);\n         Marshal.FreeHGlobal(pP2);\n         Marshal.FreeHGlobal(pX);\n         Marshal.FreeHGlobal(pCoords);\n         // nothing to visualize\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Pyramid/","title":"Pyramid","text":"

vtk-examples/CSharp/GeometricObjects/Pyramid

"},{"location":"CSharp/GeometricObjects/Pyramid/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Pyramid/#code","title":"Code","text":"

Pyramid.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Pyramid();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Pyramid() {\n         vtkPoints points = vtkPoints.New();\n         double[,] p = new double[,] {\n            { 1.0,  1.0, 1.0 },\n            {-1.0,  1.0, 1.0 },\n            {-1.0, -1.0, 1.0 },\n            { 1.0, -1.0, 1.0 },\n            { 0.0,  0.0, 0.0 }};\n\n         for(int i = 0; i < 5; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n         vtkPyramid pyramid = vtkPyramid.New();\n         for(int i = 0; i < 5; i++)\n            pyramid.GetPointIds().SetId(i, i);\n\n         vtkCellArray cells = vtkCellArray.New();\n         cells.InsertNextCell(pyramid);\n\n         vtkUnstructuredGrid ug = vtkUnstructuredGrid.New();\n         ug.SetPoints(points);\n         ug.InsertNextCell(pyramid.GetCellType(), pyramid.GetPointIds());\n\n         //Create an actor and mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInput(ug);\n         vtkActor actor = vtkActor.New();\n         actor.RotateX(105.0);\n         actor.RotateZ(-36.0);\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Quad/","title":"Quad","text":"

vtk-examples/CSharp/GeometricObjects/Quad

"},{"location":"CSharp/GeometricObjects/Quad/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Quad/#code","title":"Code","text":"

Quad.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Quad();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Quad() {\n         double[,] p = new double[,] { \n            { 0.0, 0.0, 0.0 }, \n            { 1.0, 0.0, 0.0 },\n            { 1.0, 1.0, 0.0 },\n            { 0.0, 1.0, 0.0 }\n         };\n\n         // Create the points\n         vtkPoints points = vtkPoints.New();\n         for(int i = 0; i < 4; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n\n         vtkQuad quad = vtkQuad.New();\n         quad.GetPointIds().SetNumberOfIds(4);\n         for(int i = 0; i < 4; i++)\n            quad.GetPointIds().SetId(i, i);\n\n         // Create a cell array to store the quad in and add the quad to it\n         vtkCellArray cells = vtkCellArray.New();\n         cells.InsertNextCell(quad);\n\n         // Create a polydata to store everything in\n         vtkPolyData polyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         polyData.SetPoints(points);\n\n         // Add the quad to the dataset\n         polyData.SetPolys(cells);\n\n         //Create an actor and mapper\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(polyData);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/RegularPolygonSource/","title":"RegularPolygonSource","text":"

vtk-examples/CSharp/GeometricObjects/RegularPolygonSource

"},{"location":"CSharp/GeometricObjects/RegularPolygonSource/#description","title":"Description","text":"

This example creates a pentagon. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/RegularPolygonSource/#code","title":"Code","text":"

RegularPolygonSource.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            RegularPolygon();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void RegularPolygon() {\n         // Create a pentagon\n         vtkRegularPolygonSource polygonSource = vtkRegularPolygonSource.New();\n\n         //polygonSource.GeneratePolygonOff();\n         polygonSource.SetNumberOfSides(5);\n         polygonSource.SetRadius(5);\n         polygonSource.SetCenter(0, 0, 0);\n         //polygonSource.Update(); // not necessary\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(polygonSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.GetProperty().SetLineWidth(4);\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Sphere/","title":"Sphere","text":"

vtk-examples/CSharp/GeometricObjects/Sphere

"},{"location":"CSharp/GeometricObjects/Sphere/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Sphere/#code","title":"Code","text":"

Sphere.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Sphere();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Sphere() {\n         // Create a sphere.  \n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.SetRadius(0.5);\n         // a more smoother sphere\n         //sphereSource.SetPhiResolution(36);\n         //sphereSource.SetThetaResolution(36);\n\n         //not a complete sphere, only a spherical shell\n         //sphereSource.SetEndPhi(120);\n         //sphereSource.SetEndTheta(90);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(sphereSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.3, 0.2, 0.1);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Tetrahedron/","title":"Tetrahedron","text":"

vtk-examples/CSharp/GeometricObjects/Tetrahedron

"},{"location":"CSharp/GeometricObjects/Tetrahedron/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Tetrahedron/#code","title":"Code","text":"

Tetrahedron.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Tetrahedron();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Tetrahedron() {\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0, 0, 0);\n         points.InsertNextPoint(1, 0, 0);\n         points.InsertNextPoint(1, 1, 0);\n         points.InsertNextPoint(0, 1, 1);\n         points.InsertNextPoint(5, 5, 5);\n         points.InsertNextPoint(6, 5, 5);\n         points.InsertNextPoint(6, 6, 5);\n         points.InsertNextPoint(5, 6, 6);\n\n         // Method 1\n         vtkUnstructuredGrid unstructuredGrid1 = vtkUnstructuredGrid.New();\n         unstructuredGrid1.SetPoints(points);\n\n         int[] ptIds = new int[] { 0, 1, 2, 3 };\n         IntPtr ptIdsPointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * 4);\n         Marshal.Copy(ptIds, 0, ptIdsPointer, 4);\n         unstructuredGrid1.InsertNextCell(10, 4, ptIdsPointer);\n         Marshal.FreeHGlobal(ptIdsPointer);\n\n         // Method 2\n         vtkUnstructuredGrid unstructuredGrid2 = vtkUnstructuredGrid.New();\n         unstructuredGrid2.SetPoints(points);\n\n         vtkTetra tetra = vtkTetra.New();\n\n         tetra.GetPointIds().SetId(0, 4);\n         tetra.GetPointIds().SetId(1, 5);\n         tetra.GetPointIds().SetId(2, 6);\n         tetra.GetPointIds().SetId(3, 7);\n\n         vtkCellArray cellArray = vtkCellArray.New();\n         cellArray.InsertNextCell(tetra);\n         unstructuredGrid2.SetCells(10, cellArray);\n\n         // Create a mapper and actor\n         vtkDataSetMapper mapper1 = vtkDataSetMapper.New();\n         mapper1.SetInputConnection(unstructuredGrid1.GetProducerPort());\n\n         vtkActor actor1 = vtkActor.New();\n         actor1.SetMapper(mapper1);\n\n         // Create a mapper and actor\n         vtkDataSetMapper mapper2 = vtkDataSetMapper.New();\n         mapper2.SetInputConnection(unstructuredGrid2.GetProducerPort());\n\n         vtkActor actor2 = vtkActor.New();\n         actor2.SetMapper(mapper2);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // Add the actor to the scene\n         renderer.AddActor(actor1);\n         renderer.AddActor(actor2);\n         renderer.SetBackground(.3, .6, .3); // Background color green\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Triangle/","title":"Triangle","text":"

vtk-examples/CSharp/GeometricObjects/Triangle

"},{"location":"CSharp/GeometricObjects/Triangle/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Triangle/#code","title":"Code","text":"

Triangle.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Triangle();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Triangle() {\n         // Create a triangle\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(1.0, 0.0, 0.0);\n         points.InsertNextPoint(0.0, 0.0, 0.0);\n         points.InsertNextPoint(0.0, 1.0, 0.0);\n\n         vtkTriangle triangle = vtkTriangle.New();\n         triangle.GetPointIds().SetId(0, 0);\n         triangle.GetPointIds().SetId(1, 1);\n         triangle.GetPointIds().SetId(2, 2);\n\n         // Create a cell array to store the triangle in and add the triangle to it\n         vtkCellArray cells = vtkCellArray.New();\n         cells.InsertNextCell(triangle);\n\n         // Create a polydata to store everything in\n         vtkPolyData polyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         polyData.SetPoints(points);\n\n         // Add the quad to the dataset\n         polyData.SetPolys(cells);\n\n         //Create an actor and mapper\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(polyData);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/TriangleStrip/","title":"TriangleStrip","text":"

vtk-examples/CSharp/GeometricObjects/TriangleStrip

"},{"location":"CSharp/GeometricObjects/TriangleStrip/#description","title":"Description","text":"

A triangle strip is a compact representation of a series of triangles. See this wikipedia article for an explanation. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/TriangleStrip/#code","title":"Code","text":"

TriangleStrip.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            TriangleStrip();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void TriangleStrip() {\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0, 0, 0);\n         points.InsertNextPoint(0, 1, 0);\n         points.InsertNextPoint(1, 0, 0);\n         points.InsertNextPoint(1.5, 1, 0);\n\n         vtkTriangleStrip triangleStrip = vtkTriangleStrip.New();\n         triangleStrip.GetPointIds().SetNumberOfIds(4);\n         triangleStrip.GetPointIds().SetId(0, 0);\n         triangleStrip.GetPointIds().SetId(1, 1);\n         triangleStrip.GetPointIds().SetId(2, 2);\n         triangleStrip.GetPointIds().SetId(3, 3);\n\n         vtkCellArray cells = vtkCellArray.New();\n         cells.InsertNextCell(triangleStrip);\n         // Create a polydata to store everything in\n         vtkPolyData polyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         polyData.SetPoints(points);\n         // Add the strip to the dataset\n         polyData.SetStrips(cells);\n\n         //Create an actor and mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInput(polyData);\n         vtkActor actor = vtkActor.New();\n         actor.GetProperty().SetRepresentationToWireframe();\n\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/GeometricObjects/Vertex/","title":"Vertex","text":"

vtk-examples/CSharp/GeometricObjects/Vertex

"},{"location":"CSharp/GeometricObjects/Vertex/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/GeometricObjects/Vertex/#code","title":"Code","text":"

Vertex.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Vertex();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Vertex() {\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0, 0, 0);\n\n         vtkVertex vertex = vtkVertex.New();\n         vertex.GetPointIds().SetId(0, 0);\n\n         vtkCellArray vertices = vtkCellArray.New();\n         vertices.InsertNextCell(vertex);\n\n         vtkPolyData polydata = vtkPolyData.New();\n         polydata.SetPoints(points);\n         polydata.SetVerts(vertices);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(polydata.GetProducerPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetPointSize(10);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // Add the actor to the scene\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ConvertFile/","title":"ConvertFile","text":"

vtk-examples/CSharp/IO/ConvertFile

"},{"location":"CSharp/IO/ConvertFile/#description","title":"Description","text":"

This example demonstrates how to read a file and then write it to a different type of file. In this example, we read a vtp file and write a ply file, but simply by changing the reader/writer classes instantiated, different behavior can be achieved.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ConvertFile/#code","title":"Code","text":"

ConvertFile.cs

using System;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid ConvertFile() {\n   string inputFileName = \"test.vtu\";\n   string outputFileName = \"test.ply\";\n\n   vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n   reader.SetFileName(inputFileName);\n   reader.Update();\n\n   vtkPLYWriter writer = vtkPLYWriter.New();\n   writer.SetFileName(outputFileName);\n   writer.SetInputConnection(reader.GetOutputPort());\n   writer.Update();\n}\n
"},{"location":"CSharp/IO/DEMReader/","title":"DEMReader","text":"

vtk-examples/CSharp/IO/DEMReader

"},{"location":"CSharp/IO/DEMReader/#description","title":"Description","text":"

Read DEM (elevation map) files A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/DEMReader/#code","title":"Code","text":"

DEMReader.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadDEM();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadDEM() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\SainteHelens.dem\");\n\n         vtkDEMReader reader = vtkDEMReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         vtkLookupTable lut = vtkLookupTable.New();\n         lut.SetHueRange(0.6, 0);\n         lut.SetSaturationRange(1.0, 0);\n         lut.SetValueRange(0.5, 1.0);\n         double[] range = reader.GetOutput().GetScalarRange();\n         lut.SetTableRange(range[0], range[1]);\n\n         // Visualize\n         vtkImageMapToColors mapColors = vtkImageMapToColors.New();\n         mapColors.SetLookupTable(lut);\n         mapColors.SetInputConnection(reader.GetOutputPort());\n\n         // Create an actor\n         vtkImageActor actor = vtkImageActor.New();\n         actor.SetInput(mapColors.GetOutput());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/FindAllArrayNames/","title":"FindAllArrayNames","text":"

vtk-examples/CSharp/IO/FindAllArrayNames

"},{"location":"CSharp/IO/FindAllArrayNames/#description","title":"Description","text":"

A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/FindAllArrayNames/#code","title":"Code","text":"

FindAllArrayNames.cs

using System;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         FindAllArrayNames(null);\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n     private static void FindAllArrayNames(string filePath) {\n         vtkPolyData polydata = vtkPolyData.New();\n\n         if(filePath == null) {\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.Update();\n            vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n            writer.SetFileName(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\testFindAllArrayNames.vtp\");\n            writer.SetInputConnection(sphereSource.GetOutputPort());\n            writer.Write();\n            polydata = sphereSource.GetOutput();\n         }\n         else {\n            vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n            reader.SetFileName(filePath);\n            reader.Update();\n            polydata = reader.GetOutput();\n         }\n         FindAllData(ref polydata);\n      }\n\n\n      private static void FindAllData(ref vtkPolyData polydata) {\n         Console.WriteLine(\"Normals: \" + polydata.GetPointData().GetNormals());\n\n         int numberOfPointArrays = polydata.GetPointData().GetNumberOfArrays();\n         Console.WriteLine(\"Number of PointData arrays: \" + numberOfPointArrays);\n\n         int numberOfCellArrays = polydata.GetCellData().GetNumberOfArrays();\n         Console.WriteLine(\"Number of CellData arrays: \" + numberOfCellArrays);\n\n         Console.WriteLine(\n            Environment.NewLine + \n            \"Type table/key: \" + \n            Environment.NewLine + \n            \"-------------------------\");\n         //more values can be found in <VTK_DIR>/Common/vtkSetGet.h\n\n         Console.WriteLine(3 + \" unsigned char\");\n         Console.WriteLine(7 + \" unsigned int\");\n         Console.WriteLine(10 + \" float\");\n         Console.WriteLine(11 + \" double\" + Environment.NewLine);\n\n         for(int i = 0; i < numberOfPointArrays; i++) {\n            // The following two lines are equivalent\n            //arrayNames.push_back(polydata.GetPointData().GetArray(i).GetName());\n            //arrayNames.push_back(polydata.GetPointData().GetArrayName(i));\n            int dataTypeID = polydata.GetPointData().GetArray(i).GetDataType();\n            string dataTypeAsString = polydata.GetPointData().GetArray(i).GetDataTypeAsString();\n            Console.WriteLine(\"Array \" + i + \": \" \n               + polydata.GetPointData().GetArrayName(i)\n               + \" (type: \" + dataTypeID + \")\"\n               + \" (type as string: \" + dataTypeAsString + \")\" + Environment.NewLine);\n         }\n\n         for(int i = 0; i < numberOfCellArrays; i++) {\n            // The following two lines are equivalent\n            //polydata.GetPointData().GetArray(i).GetName();\n            //polydata.GetPointData().GetArrayName(i);\n            int dataTypeID = polydata.GetCellData().GetArray(i).GetDataType();\n            string dataTypeAsString = polydata.GetPointData().GetArray(i).GetDataTypeAsString();\n            Console.WriteLine(\"Array \" + i + \": \"\n               + polydata.GetCellData().GetArrayName(i)\n               + \" (type: \" + dataTypeID + \")\"\n               + \" (type as string: \" + dataTypeAsString + \")\");\n         }\n      }\n    }\n}\n
"},{"location":"CSharp/IO/ImageReader2Factory/","title":"ImageReader2Factory","text":"

vtk-examples/CSharp/IO/ImageReader2Factory

"},{"location":"CSharp/IO/ImageReader2Factory/#description","title":"Description","text":"

This class tries to find an appropriate reader. It is very convenient to use this when you don't know what kind of file to expect. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ImageReader2Factory/#code","title":"Code","text":"

ImageReader2Factory.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ImageReader2Factory();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ImageReader2Factory() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\foot\\foot.mha\");\n\n         vtkImageReader2 reader = vtkImageReader2Factory.CreateImageReader2(filePath);\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n         vtkImageActor actor = vtkImageActor.New();\n         actor.SetInputData(reader.GetOutput());\n\n         // Visualize\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/JPEGReader/","title":"JPEGReader","text":"

vtk-examples/CSharp/IO/JPEGReader

"},{"location":"CSharp/IO/JPEGReader/#description","title":"Description","text":"

This example shows how to read a JPG image file. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/JPEGReader/#code","title":"Code","text":"

JPEGReader.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadJPEG();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadJPEG() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\beach.jpg\");\n         //Read the image\n         vtkJPEGReader reader = vtkJPEGReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/JPEGWriter/","title":"JPEGWriter","text":"

vtk-examples/CSharp/IO/JPEGWriter

"},{"location":"CSharp/IO/JPEGWriter/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/JPEGWriter/#code","title":"Code","text":"

JPEGWriter.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteJPEG();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteJPEG() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_jpeg.jpg\");\n         int[] extent = new int[] { 0, 99, 0, 99, 0, 0 };\n         vtkImageCanvasSource2D imageSource = vtkImageCanvasSource2D.New();\n         imageSource.SetExtent(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5]);\n         imageSource.SetScalarTypeToUnsignedChar();\n         imageSource.SetNumberOfScalarComponents(3);\n         imageSource.SetDrawColor(127, 45, 255);\n         imageSource.FillBox(0, 99, 0, 99);\n         imageSource.SetDrawColor(255, 255, 255);\n         imageSource.FillBox(40, 70, 20, 50);\n         imageSource.Update();\n\n         vtkImageCast castFilter = vtkImageCast.New();\n         castFilter.SetOutputScalarTypeToUnsignedChar();\n         castFilter.SetInputConnection(imageSource.GetOutputPort());\n         castFilter.Update();\n\n         vtkJPEGWriter writer = vtkJPEGWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInputConnection(castFilter.GetOutputPort());\n         writer.Write();\n         // Read and display file for verification that it was written correctly\n         vtkJPEGReader reader = vtkJPEGReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/IO/MetaImageReader/","title":"MetaImageReader","text":"

vtk-examples/CSharp/IO/MetaImageReader

"},{"location":"CSharp/IO/MetaImageReader/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/MetaImageReader/#code","title":"Code","text":"

MetaImageReader.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadMetaImage();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadMetaImage() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\foot\\foot.mha\");\n\n         vtkMetaImageReader reader = vtkMetaImageReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n         vtkImageActor actor = vtkImageActor.New();\n         actor.SetInput(reader.GetOutput());\n\n         // Visualize\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/MetaImageWriter/","title":"MetaImageWriter","text":"

vtk-examples/CSharp/IO/MetaImageWriter

"},{"location":"CSharp/IO/MetaImageWriter/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/MetaImageWriter/#code","title":"Code","text":"

MetaImageWriter.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteMetaImage();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteMetaImage() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_mha.mhd\");\n         string filePathRaw = System.IO.Path.Combine(root, @\"Data\\test_mha.raw\");\n         // Create an image\n         vtkImageMandelbrotSource source = vtkImageMandelbrotSource.New();\n         source.Update();\n\n         vtkImageCast castFilter = vtkImageCast.New();\n         castFilter.SetOutputScalarTypeToUnsignedChar();\n         castFilter.SetInputConnection(source.GetOutputPort());\n         castFilter.Update();\n\n         vtkMetaImageWriter writer = vtkMetaImageWriter.New();\n         writer.SetInputConnection(castFilter.GetOutputPort());\n         writer.SetFileName(filePath);\n         writer.SetRAWFileName(filePathRaw);\n         writer.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkMetaImageReader reader = vtkMetaImageReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n         vtkImageActor actor = vtkImageActor.New();\n         actor.SetInput(reader.GetOutput());\n\n         // Visualize\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/PNGReader/","title":"PNGReader","text":"

vtk-examples/CSharp/IO/PNGReader

"},{"location":"CSharp/IO/PNGReader/#description","title":"Description","text":"

This example demonstrates how to read a PNG image file. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/PNGReader/#code","title":"Code","text":"

PNGReader.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPNG();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPNG() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\camscene.png\");\n         //Read the image\n         vtkPNGReader reader = vtkPNGReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ParticleReader/","title":"ParticleReader","text":"

vtk-examples/CSharp/IO/ParticleReader

"},{"location":"CSharp/IO/ParticleReader/#description","title":"Description","text":"

This example reads ascii files where each line consists of points with its position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file format. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ParticleReader/#code","title":"Code","text":"

ParticleReader.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ParticleReader();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ParticleReader() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\Particles.raw\");\n\n         // Read the file\n         vtkParticleReader reader = vtkParticleReader.New();\n         reader.SetFileName(filePath);\n         reader.SetDataByteOrderToBigEndian();\n         reader.Update();\n         Debug.WriteLine(\"NumberOfPieces: \" + reader.GetOutput().GetNumberOfPieces());\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n         mapper.SetScalarRange(4, 9);\n         mapper.SetPiece(1);\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetPointSize(4);\n         actor.GetProperty().SetColor(1, 0, 0);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadBMP/","title":"ReadBMP","text":"

vtk-examples/CSharp/IO/ReadBMP

"},{"location":"CSharp/IO/ReadBMP/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadBMP/#code","title":"Code","text":"

ReadBMP.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadBMP();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadBMP() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\masonry.bmp\");\n         //Read the image\n         vtkBMPReader reader = vtkBMPReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadDICOMSeries/","title":"ReadDICOMSeries","text":"

vtk-examples/CSharp/IO/ReadDICOMSeries

"},{"location":"CSharp/IO/ReadDICOMSeries/#description","title":"Description","text":"

This example demonstates how to read a series of DICOM images and how to scroll with the mousewheel or the up/down keys through all slices. Sample data are available as a zipped file (977 kB, 40 slices) here

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadDICOMSeries/#code","title":"Code","text":"

ReadDICOMSeries.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n\n      // module wide accessible variables\n      vtkImageViewer2 _ImageViewer;\n      vtkTextMapper _SliceStatusMapper;\n      int _Slice;\n      int _MinSlice;\n      int _MaxSlice;\n\n\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadDICOMSeries();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n       private void ReadDICOMSeries() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         // Read all the DICOM files in the specified directory.\n         // Caution: folder \"DicomTestImages\" don't exists by default in the standard vtk data folder\n         // sample data are available at http://www.vtk.org/Wiki/images/1/12/VTK_Examples_StandardFormats_Input_DicomTestImages.zip\n         string folder = Path.Combine(root, @\"Data\\DicomTestImages\");\n         vtkDICOMImageReader reader = vtkDICOMImageReader.New();\n         reader.SetDirectoryName(folder);\n         reader.Update();\n         // Visualize\n         _ImageViewer = vtkImageViewer2.New();\n         _ImageViewer.SetInputConnection(reader.GetOutputPort());\n         // get range of slices (min is the first index, max is the last index)\n         _ImageViewer.GetSliceRange(ref _MinSlice, ref _MaxSlice);\n         Debug.WriteLine(\"slices range from : \" + _MinSlice.ToString() + \" to \" + _MaxSlice.ToString());\n\n         // slice status message\n         vtkTextProperty sliceTextProp = vtkTextProperty.New();\n         sliceTextProp.SetFontFamilyToCourier();\n         sliceTextProp.SetFontSize(20);\n         sliceTextProp.SetVerticalJustificationToBottom();\n         sliceTextProp.SetJustificationToLeft();\n\n         _SliceStatusMapper = vtkTextMapper.New();\n         _SliceStatusMapper.SetInput(\"Slice No \" + ( _Slice + 1 ).ToString() + \"/\" + ( _MaxSlice + 1 ).ToString());\n         _SliceStatusMapper.SetTextProperty(sliceTextProp);\n\n         vtkActor2D sliceStatusActor = vtkActor2D.New();\n         sliceStatusActor.SetMapper(_SliceStatusMapper);\n         sliceStatusActor.SetPosition(15, 10);\n\n         // usage hint message\n         vtkTextProperty usageTextProp = vtkTextProperty.New();\n         usageTextProp.SetFontFamilyToCourier();\n         usageTextProp.SetFontSize(14);\n         usageTextProp.SetVerticalJustificationToTop();\n         usageTextProp.SetJustificationToLeft();\n\n         vtkTextMapper usageTextMapper = vtkTextMapper.New();\n         usageTextMapper.SetInput(\"Slice with mouse wheel\\nor Up/Down-Key\");\n         usageTextMapper.SetTextProperty(usageTextProp);\n\n         vtkActor2D usageTextActor = vtkActor2D.New();\n         usageTextActor.SetMapper(usageTextMapper);\n         usageTextActor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n         usageTextActor.GetPositionCoordinate().SetValue(0.05, 0.95);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n\n         vtkInteractorStyleImage interactorStyle = vtkInteractorStyleImage.New();\n         interactorStyle.MouseWheelForwardEvt += new vtkObject.vtkObjectEventHandler(interactor_MouseWheelForwardEvt);\n         interactorStyle.MouseWheelBackwardEvt += new vtkObject.vtkObjectEventHandler(interactor_MouseWheelBackwardEvt);\n\n         renderWindow.GetInteractor().SetInteractorStyle(interactorStyle);\n         renderWindow.GetRenderers().InitTraversal();\n         vtkRenderer ren;\n         while(( ren = renderWindow.GetRenderers().GetNextItem() ) != null)\n            ren.SetBackground(0.0, 0.0, 0.0);\n\n         _ImageViewer.SetRenderWindow(renderWindow);\n         _ImageViewer.GetRenderer().AddActor2D(sliceStatusActor);\n         _ImageViewer.GetRenderer().AddActor2D(usageTextActor);\n         _ImageViewer.SetSlice(_MinSlice);\n         _ImageViewer.Render();\n      }\n\n\n      /// <summary>\n      /// move forward to next slice\n      /// </summary>\n      private void MoveForwardSlice() {\n         Debug.WriteLine(_Slice.ToString());\n         if(_Slice < _MaxSlice) {\n            _Slice += 1;\n            _ImageViewer.SetSlice(_Slice);\n            _SliceStatusMapper.SetInput(\"Slice No \" + ( _Slice + 1 ).ToString() + \"/\" + ( _MaxSlice + 1 ).ToString());\n            _ImageViewer.Render();\n         }\n      }\n\n\n      /// <summary>\n      /// move backward to next slice\n      /// </summary>\n      private void MoveBackwardSlice() {\n         Debug.WriteLine(_Slice.ToString());\n         if(_Slice > _MinSlice) {\n            _Slice -= 1;\n            _ImageViewer.SetSlice(_Slice);\n            _SliceStatusMapper.SetInput(\"Slice No \" + ( _Slice + 1 ).ToString() + \"/\" + ( _MaxSlice + 1 ).ToString());\n            _ImageViewer.Render();\n         }\n      }\n\n\n      /// <summary>\n      /// eventhanndler to process keyboard input\n      /// </summary>\n      /// <param name=\"msg\"></param>\n      /// <param name=\"keyData\"></param>\n      /// <returns></returns>\n      protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) {\n         //Debug.WriteLine(DateTime.Now + \":\" + msg.Msg + \", \" + keyData);\n         if(keyData == System.Windows.Forms.Keys.Up) {\n            MoveForwardSlice();\n            return true;\n         }\n         else if(keyData == System.Windows.Forms.Keys.Down) {\n            MoveBackwardSlice();\n            return true;\n         }\n         // don't forward the following keys\n         // add all keys which are not supposed to get forwarded\n         else if(\n               keyData == System.Windows.Forms.Keys.F\n            || keyData == System.Windows.Forms.Keys.L\n         ) {\n            return true;\n         }\n         return false;\n      }\n\n      /// <summary>\n      /// event handler for mousewheel forward event\n      /// </summary>\n      /// <param name=\"sender\"></param>\n      /// <param name=\"e\"></param>\n      void interactor_MouseWheelForwardEvt(vtkObject sender, vtkObjectEventArgs e) {\n         MoveForwardSlice();\n      }\n\n\n      /// <summary>\n      /// event handler for mousewheel backward event\n      /// </summary>\n      /// <param name=\"sender\"></param>\n      /// <param name=\"e\"></param>\n      void interactor_MouseWheelBackwardEvt(vtkObject sender, vtkObjectEventArgs e) {\n         MoveBackwardSlice();\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadImageData/","title":"ReadImageData","text":"

vtk-examples/CSharp/IO/ReadImageData

"},{"location":"CSharp/IO/ReadImageData/#description","title":"Description","text":"

This example reads an image data (.vti) file. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadImageData/#code","title":"Code","text":"

ReadImageData.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadImageData();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n       private void ReadImageData() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\vase_1comp.vti\");\n\n         // reader\n         // Read all the data from the file\n         vtkXMLImageDataReader reader = vtkXMLImageDataReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         // mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetRepresentationToWireframe();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n  }\n}\n
"},{"location":"CSharp/IO/ReadOBJ/","title":"ReadOBJ","text":"

vtk-examples/CSharp/IO/ReadOBJ

"},{"location":"CSharp/IO/ReadOBJ/#description","title":"Description","text":"

This example demonstrates how to read a Wavefront OBJ file. The result is displayed.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadOBJ/#code","title":"Code","text":"

ReadOBJ.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadOBJ();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadOBJ() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         // caution: vtkdata-5.8.0\\Data\\mni-surface-mesh.obj is no valid obj file!\n         //string filePath = System.IO.Path.Combine(root, @\"Data\\mni-surface-mesh.obj\");\n         string filePath = System.IO.Path.Combine(root, @\"Data\\ViewPoint\\cow.obj\");\n\n         vtkOBJReader reader = vtkOBJReader.New();\n         if(!File.Exists(filePath)) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.3, 0.6, 0.3);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n         renderWindow.Render();\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadPDB/","title":"ReadPDB","text":"

vtk-examples/CSharp/IO/ReadPDB

"},{"location":"CSharp/IO/ReadPDB/#description","title":"Description","text":"

This example reads Protein Data Bank files. The example expects a file in .pdb format.

This is a suitable sample file: src/Testing/Data/lys.pdb.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadPDB/#code","title":"Code","text":"

ReadPDB.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPDB();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPDB() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\caffeine.pdb\");\n\n         vtkPDBReader pdb = vtkPDBReader.New();\n         pdb.SetFileName(filePath);\n         pdb.SetHBScale(1.0);\n         pdb.SetBScale(1.0);\n         pdb.Update();\n         Debug.WriteLine(\"# of atoms is: \" + pdb.GetNumberOfAtoms());\n         // if molecule contains a lot of atoms, reduce the resolution of the sphere (represents an atom) for faster rendering\n         int resolution = (int)Math.Floor(Math.Sqrt(300000.0 / pdb.GetNumberOfAtoms())); // 300000.0 is an empriric value\n         if(resolution > 20)\n            resolution = 20;\n         else if(resolution < 4)\n            resolution = 4;\n\n         Debug.WriteLine(\"Resolution is: \" + resolution);\n         vtkSphereSource sphere = vtkSphereSource.New();\n         sphere.SetCenter(0, 0, 0);\n         sphere.SetRadius(1);\n         sphere.SetThetaResolution(resolution);\n         sphere.SetPhiResolution(resolution);\n\n         vtkGlyph3D glyph = vtkGlyph3D.New();\n         glyph.SetInputConnection(pdb.GetOutputPort());\n         glyph.SetOrient(1);\n         glyph.SetColorMode(1);\n         // glyph.ScalingOn();\n         glyph.SetScaleMode(2);\n         glyph.SetScaleFactor(.25);\n         glyph.SetSourceConnection(sphere.GetOutputPort());\n\n         vtkPolyDataMapper atomMapper = vtkPolyDataMapper.New();\n         atomMapper.SetInputConnection(glyph.GetOutputPort());\n         atomMapper.UseLookupTableScalarRangeOff();\n         atomMapper.ScalarVisibilityOn();\n         atomMapper.SetScalarModeToDefault();\n\n         vtkLODActor atom = vtkLODActor.New();\n         atom.SetMapper(atomMapper);\n         atom.GetProperty().SetRepresentationToSurface();\n         atom.GetProperty().SetInterpolationToGouraud();\n         atom.GetProperty().SetAmbient(0.15);\n         atom.GetProperty().SetDiffuse(0.85);\n         atom.GetProperty().SetSpecular(0.1);\n         atom.GetProperty().SetSpecularPower(30);\n         atom.GetProperty().SetSpecularColor(1, 1, 1);\n         atom.SetNumberOfCloudPoints(30000);\n\n\n         vtkTubeFilter tube = vtkTubeFilter.New();\n         tube.SetInputConnection(pdb.GetOutputPort());\n         tube.SetNumberOfSides(resolution);\n         tube.CappingOff();\n         tube.SetRadius(0.2);\n         // turn off variation of tube radius with scalar values\n         tube.SetVaryRadius(0);\n         tube.SetRadiusFactor(10);\n\n         vtkPolyDataMapper bondMapper = vtkPolyDataMapper.New();\n         bondMapper.SetInputConnection(tube.GetOutputPort());\n         bondMapper.UseLookupTableScalarRangeOff();\n         bondMapper.ScalarVisibilityOff();\n         bondMapper.SetScalarModeToDefault();\n\n         vtkLODActor bond = vtkLODActor.New();\n         bond.SetMapper(bondMapper);\n         bond.GetProperty().SetRepresentationToSurface();\n         bond.GetProperty().SetInterpolationToGouraud();\n         bond.GetProperty().SetAmbient(0.15);\n         bond.GetProperty().SetDiffuse(0.85);\n         bond.GetProperty().SetSpecular(0.1);\n         bond.GetProperty().SetSpecularPower(30);\n         bond.GetProperty().SetSpecularColor(1, 1, 1);\n         bond.GetProperty().SetDiffuseColor(1.0000, 0.8941, 0.70981);\n\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(atom);\n         renderer.AddActor(bond);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadPLOT3D/","title":"ReadPLOT3D","text":"

vtk-examples/CSharp/IO/ReadPLOT3D

"},{"location":"CSharp/IO/ReadPLOT3D/#description","title":"Description","text":"

Reads PLOT3D files A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadPLOT3D/#code","title":"Code","text":"

ReadPLOT3D.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPLOT3D();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n     private void ReadPLOT3D() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePathXYZ = System.IO.Path.Combine(root, @\"Data\\bluntfinxyz.bin\");\n         string filePathQ = System.IO.Path.Combine(root, @\"Data\\bluntfinq.bin\");\n         //string filePathXYZ = System.IO.Path.Combine(root, @\"Data\\combxyz.bin\");\n         //string filePathQ = System.IO.Path.Combine(root, @\"Data\\combq.bin\");\n\n         vtkMultiBlockPLOT3DReader reader = vtkMultiBlockPLOT3DReader.New();\n         reader.SetXYZFileName(filePathXYZ);\n         reader.SetQFileName(filePathQ);\n\n         // Specify the scalar function to extract. If ==(-1), then no scalar function is extracted. \n         int scalarFctNo = reader.GetScalarFunctionNumber();\n         int vectorFctNo = reader.GetVectorFunctionNumber();\n         if(scalarFctNo != -1)\n            reader.SetScalarFunctionNumber(scalarFctNo);\n         // Specify the vector function to extract. If ==(-1), then no vector function is extracted. \n         if(vectorFctNo != -1)\n            reader.SetVectorFunctionNumber(vectorFctNo);\n         reader.Update();\n\n         //// geometry filter\n         //// This filter is multi-block aware and will request blocks from the\n         //// input. These blocks will be processed by simple processes as if they\n         //// are the whole dataset\n         //vtkCompositeDataGeometryFilter geom1 = vtkCompositeDataGeometryFilter.New();\n         //geom1.SetInputConnection(0, reader.GetOutputPort(0));\n\n         vtkStructuredGridGeometryFilter geometryFilter = vtkStructuredGridGeometryFilter.New();\n         geometryFilter.SetInput(reader.GetOutput().GetBlock(0));\n         //geometryFilter.SetInputConnection(geom1.GetOutputPort(0));\n         geometryFilter.Update();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(geometryFilter.GetOutputPort());\n         //mapper.SetInputConnection(geom1.GetOutputPort());\n         mapper.ScalarVisibilityOn();\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadPLY/","title":"ReadPLY","text":"

vtk-examples/CSharp/IO/ReadPLY

"},{"location":"CSharp/IO/ReadPLY/#description","title":"Description","text":"

Reads a PLY file A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadPLY/#code","title":"Code","text":"

ReadPLY.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPLY();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPLY() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\bunny.ply\");\n         vtkPLYReader reader = vtkPLYReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadPNM/","title":"ReadPNM","text":"

vtk-examples/CSharp/IO/ReadPNM

"},{"location":"CSharp/IO/ReadPNM/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadPNM/#code","title":"Code","text":"

ReadPNM.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPNM();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPNM() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\earth.ppm\");\n         //Read the image\n         vtkPNMReader reader = vtkPNMReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadPlainText/","title":"ReadPlainText","text":"

vtk-examples/CSharp/IO/ReadPlainText

"},{"location":"CSharp/IO/ReadPlainText/#description","title":"Description","text":"

This example takes a plain text file of coordinates and reads them into a vtkPoints, which is then put into a vtkPolyData and displayed on the screen using a vtkVertexGlyphFilter.

An example file may look like:

 1 2 3\n 4 5 6 \n 7 8 9\n

Sample data are available as a zipped file (16 KB): SampleData.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadPlainText/#code","title":"Code","text":"

ReadPlainText.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPlainText();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPlainText() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\teapot.xyz\");\n\n         FileStream fs = null;\n         StreamReader sr = null;\n         String sLineBuffer;\n         String[] sXYZ;\n         char[] chDelimiter = new char[] { ' ', '\\t', ';' };\n         double[] xyz = new double[3];\n         vtkPoints points = vtkPoints.New();\n         int cnt = 0;\n\n         try {\n            // in case file must be open in another application too use \"FileShare.ReadWrite\"\n            fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);\n            sr = new StreamReader(fs);\n            while(!sr.EndOfStream) {\n               sLineBuffer = sr.ReadLine();\n               cnt++;\n               sXYZ = sLineBuffer.Split(chDelimiter, StringSplitOptions.RemoveEmptyEntries);\n               if(sXYZ == null || sXYZ.Length != 3) {\n                  MessageBox.Show(\"data seems to be in wrong format at line \" + cnt, \"Format Exception\", MessageBoxButtons.OK);\n                  return;\n               }\n               xyz[0] = double.Parse(sXYZ[0], CultureInfo.InvariantCulture);\n               xyz[1] = double.Parse(sXYZ[1], CultureInfo.InvariantCulture);\n               xyz[2] = double.Parse(sXYZ[2], CultureInfo.InvariantCulture);\n               points.InsertNextPoint(xyz[0], xyz[1], xyz[2]);\n            }\n            vtkPolyData polydata = vtkPolyData.New();\n            polydata.SetPoints(points);\n            vtkVertexGlyphFilter glyphFilter = vtkVertexGlyphFilter.New();\n            glyphFilter.SetInputConnection(polydata.GetProducerPort());\n\n            // Visualize\n            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n            mapper.SetInputConnection(glyphFilter.GetOutputPort());\n\n            vtkActor actor = vtkActor.New();\n            actor.SetMapper(mapper);\n            actor.GetProperty().SetPointSize(4);\n            actor.GetProperty().SetColor(1, 0.5, 0);\n            // get a reference to the renderwindow of our renderWindowControl1\n            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n            // renderer\n            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n            // set background color\n            renderer.SetBackground(0.2, 0.3, 0.4);\n            // add our actor to the renderer\n            renderer.AddActor(actor);\n         }\n         catch(IOException ex) {\n            MessageBox.Show(ex.Message, \"IOException\", MessageBoxButtons.OK);\n         }\n         finally {\n            if(sr != null) {\n               sr.Close();\n               sr.Dispose();\n               sr = null;\n            }\n         }\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadPolyData/","title":"ReadPolyData","text":"

vtk-examples/CSharp/IO/ReadPolyData

"},{"location":"CSharp/IO/ReadPolyData/#description","title":"Description","text":"

This example reads a polygonal data (.vtp) file. An example data set can be found at VTKData/Data/SyntheticPolyline.vtp A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadPolyData/#code","title":"Code","text":"

ReadPolyData.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPolyData();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPolyData() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         // string filePath = System.IO.Path.Combine(root, @\"Data\\SyntheticPolyline.vtp\");\n         // string filePath = System.IO.Path.Combine(root, @\"Data\\uniform-001371-5x5x5.vtp\");\n         // string filePath = System.IO.Path.Combine(root, @\"Data\\political.vtp\");\n         // string filePath = System.IO.Path.Combine(root, @\"Data\\filledContours.vtp\");\n         // string filePath = System.IO.Path.Combine(root, @\"Data\\disk_out_ref_surface.vtp\");\n         string filePath = System.IO.Path.Combine(root, @\"Data\\cow.vtp\");\n         // reader\n         // Read all the data from the file\n         vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         // mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadRectilinearGrid/","title":"ReadRectilinearGrid","text":"

vtk-examples/CSharp/IO/ReadRectilinearGrid

"},{"location":"CSharp/IO/ReadRectilinearGrid/#description","title":"Description","text":"

This example reads a rectilinear grid (.vtr) file. An example file can be found at VTKData/Data/cth.vtr A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadRectilinearGrid/#code","title":"Code","text":"

ReadRectilinearGrid.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadRectilinearGrid();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadRectilinearGrid() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\cth.vtr\");\n         // reader\n         vtkXMLRectilinearGridReader reader = vtkXMLRectilinearGridReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         //vtkRectilinearGridGeometryFilter geometryFilter = vtkRectilinearGridGeometryFilter.New();\n         //geometryFilter.SetInputConnection(reader.GetOutputPort());\n         //geometryFilter.Update();\n\n\n         // Visualize\n         // mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         //mapper.SetInputConnection(geometryFilter.GetOutputPort());\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetRepresentationToWireframe();\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadSTL/","title":"ReadSTL","text":"

vtk-examples/CSharp/IO/ReadSTL

"},{"location":"CSharp/IO/ReadSTL/#description","title":"Description","text":"

Reads an stl file A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadSTL/#code","title":"Code","text":"

ReadSTL.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadSTL();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadSTL() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\42400-IDGH.stl\");\n         vtkSTLReader reader = vtkSTLReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadStructuredGrid/","title":"ReadStructuredGrid","text":"

vtk-examples/CSharp/IO/ReadStructuredGrid

"},{"location":"CSharp/IO/ReadStructuredGrid/#description","title":"Description","text":"

This example reads a structured grid (.vts) file. An example file can be found at VTKData/Data/multicomb_0.vts A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadStructuredGrid/#code","title":"Code","text":"

ReadStructuredGrid.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadStructuredGrid();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadStructuredGrid() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\multicomb_0.vts\");\n\n         // reader\n         vtkXMLStructuredGridReader reader = vtkXMLStructuredGridReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         vtkStructuredGridGeometryFilter geometryFilter = vtkStructuredGridGeometryFilter.New();\n         geometryFilter.SetInputConnection(reader.GetOutputPort());\n         geometryFilter.Update();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(geometryFilter.GetOutputPort());\n\n         //// mapper\n         //vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         //mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadTIFF/","title":"ReadTIFF","text":"

vtk-examples/CSharp/IO/ReadTIFF

"},{"location":"CSharp/IO/ReadTIFF/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadTIFF/#code","title":"Code","text":"

ReadTIFF.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadTIFF();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadTIFF() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\beach.tif\");\n         //Read the image\n         vtkTIFFReader reader = vtkTIFFReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadUnknownTypeXMLFile/","title":"ReadUnknownTypeXMLFile","text":"

vtk-examples/CSharp/IO/ReadUnknownTypeXMLFile

"},{"location":"CSharp/IO/ReadUnknownTypeXMLFile/#description","title":"Description","text":"

This examples reads either a vtu (unstructured grid) or vtp (polydata) file and displays it to the screen. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadUnknownTypeXMLFile/#code","title":"Code","text":"

ReadUnknownTypeXMLFile.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadUnknownTypeXMLFile();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadUnknownTypeXMLFile() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\quadraticTetra01.vtu\");\n         //string filePath = System.IO.Path.Combine(root, @\"Data\\SyntheticPolyline.vtp\");\n\n         // reader\n         // Read all the data from the file\n         vtkXMLGenericDataObjectReader reader = vtkXMLGenericDataObjectReader.New();\n         // caution: you cannot use CanReadFile with the generic reader\n         //if(reader.CanReadFile(filePath) == 0) {\n         //   MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n         //   return;\n         //}\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         // All of the standard data types can be checked and obtained like this:\n         if(vtkPolyData.SafeDownCast(reader.GetOutput()) != null) {\n            Debug.WriteLine(\"File is a polydata\");\n         }\n         else if(vtkUnstructuredGrid.SafeDownCast(reader.GetOutput()) != null) {\n            Debug.WriteLine(\"File is an unstructured grid\");\n         }\n\n         // mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         //actor.GetProperty().SetRepresentationToWireframe();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/ReadUnstructuredGrid/","title":"ReadUnstructuredGrid","text":"

vtk-examples/CSharp/IO/ReadUnstructuredGrid

"},{"location":"CSharp/IO/ReadUnstructuredGrid/#description","title":"Description","text":"

This examples demonstrates how to read an unstructured grid (VTU) file.

An example data file (.vtu) for testing can be found in VTKData/Data/quadraticTetra01.vtu.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/ReadUnstructuredGrid/#code","title":"Code","text":"

ReadUnstructuredGrid.cs

using System;\nusing System.ComponentModel;\nusing System.Windows.Forms;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            string filePath = @\"C:\\VTK\\vtkdata-5.8.0\\Data\\quadraticTetra01.vtu\";\n\n            // reader\n            vtkXMLUnstructuredGridReader reader = vtkXMLUnstructuredGridReader.New();\n            if(reader.CanReadFile(filePath) == 0) {\n               MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n               return;\n            }\n            reader.SetFileName(filePath);\n            reader.Update(); // here we read the file actually\n\n            // mapper\n            vtkDataSetMapper gridMapper = vtkDataSetMapper.New();\n            gridMapper.SetInputConnection(reader.GetOutputPort());\n\n            // actor\n            vtkActor gridActor = vtkActor.New();\n            gridActor.SetMapper(gridMapper);\n\n            // get a reference to the renderwindow of our renderWindowControl1\n            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n\n            // renderer\n            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n            // set background color\n            renderer.SetBackground(0.2, 0.3, 0.4);\n\n            // add our actor to the renderer\n            renderer.AddActor(gridActor);\n\n            // reposition the camera, so that actor can be fully seen\n            renderer.ResetCamera();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n   }\n}\n
"},{"location":"CSharp/IO/SimplePointsReader/","title":"SimplePointsReader","text":"

vtk-examples/CSharp/IO/SimplePointsReader

"},{"location":"CSharp/IO/SimplePointsReader/#description","title":"Description","text":"

A file of XYZ coordinates is a very easy format that can be used for simple storage from many applications. This example demonstrates how to read this type of file into a polydata object. An example file of three points would look like this:

0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/SimplePointsReader/#code","title":"Code","text":"

SimplePointsReader.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            SimplePointsReader();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void SimplePointsReader() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\points.txt\");\n\n         vtkSimplePointsReader reader = vtkSimplePointsReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetPointSize(4);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         //renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/IO/VRML/","title":"VRML","text":"

vtk-examples/CSharp/IO/VRML

"},{"location":"CSharp/IO/VRML/#description","title":"Description","text":"

This example loads a wrl file and displays it on the screen. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/VRML/#code","title":"Code","text":"

VRML.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            VRML();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void VRML() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\bot2.wrl\");\n         // reader\n         vtkVRMLImporter importer = vtkVRMLImporter.New();\n         importer.SetFileName(filePath);\n         importer.Update();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         renderWindow.AddRenderer(importer.GetRenderer());\n         renderWindow.Render();\n\n         //vtkActorCollection actors = importer.GetRenderer().GetActors();\n         //actors.InitTraversal();\n         //vtkActor tmp;\n         //while(( tmp = actors.GetNextActor()) != null) {\n         //}\n      }\n   }\n}\n
"},{"location":"CSharp/IO/WriteBMP/","title":"WriteBMP","text":"

vtk-examples/CSharp/IO/WriteBMP

"},{"location":"CSharp/IO/WriteBMP/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/WriteBMP/#code","title":"Code","text":"

WriteBMP.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteBMP();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteBMP() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_bmp.bmp\");\n         int[] extent = new int[] { 1, 10, 1, 10, 1, 10 };\n         vtkImageCanvasSource2D imageSource = vtkImageCanvasSource2D.New();\n         imageSource.SetScalarTypeToUnsignedChar();\n         imageSource.SetExtent(0, 9, 0, 9, 0, 0);\n         imageSource.SetNumberOfScalarComponents(3);\n         imageSource.SetDrawColor(0, 0, 0, 0);\n         imageSource.FillBox(0, 9, 0, 9);\n         imageSource.SetDrawColor(255, 0, 0, 0);\n         imageSource.FillBox(5, 7, 5, 7);\n         imageSource.Update();\n\n         vtkBMPWriter bmpWriter = vtkBMPWriter.New();\n         bmpWriter.SetFileName(filePath);\n         bmpWriter.SetInputConnection(imageSource.GetOutputPort());\n         bmpWriter.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkBMPReader reader = vtkBMPReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/IO/WritePNG/","title":"WritePNG","text":"

vtk-examples/CSharp/IO/WritePNG

"},{"location":"CSharp/IO/WritePNG/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/WritePNG/#code","title":"Code","text":"

WritePNG.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WritePNG();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WritePNG() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_png.png\");\n         int[] extent = new int[] { 0, 99, 0, 99, 0, 0 };\n         vtkImageCanvasSource2D imageSource = vtkImageCanvasSource2D.New();\n         imageSource.SetExtent(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5]);\n         imageSource.SetScalarTypeToUnsignedChar();\n         imageSource.SetNumberOfScalarComponents(3);\n         imageSource.SetDrawColor(127, 45, 255);\n         imageSource.FillBox(0, 99, 0, 99);\n         imageSource.SetDrawColor(255, 255, 255);\n         imageSource.FillBox(40, 70, 20, 50);\n         imageSource.Update();\n\n         vtkImageCast castFilter = vtkImageCast.New();\n         castFilter.SetOutputScalarTypeToUnsignedChar();\n         castFilter.SetInputConnection(imageSource.GetOutputPort());\n         castFilter.Update();\n\n         vtkPNGWriter writer = vtkPNGWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInputConnection(castFilter.GetOutputPort());\n         writer.Write();\n         // Read and display file for verification that it was written correctly\n         vtkPNGReader reader = vtkPNGReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/IO/WritePNM/","title":"WritePNM","text":"

vtk-examples/CSharp/IO/WritePNM

"},{"location":"CSharp/IO/WritePNM/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/WritePNM/#code","title":"Code","text":"

WritePNM.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WritePNM();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WritePNM() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_pnm.ppm\");\n         vtkImageCanvasSource2D imageSource = vtkImageCanvasSource2D.New();\n         imageSource.SetScalarTypeToUnsignedChar();\n         imageSource.SetExtent(0, 9, 0, 9, 0, 0);\n         imageSource.SetNumberOfScalarComponents(3);\n         imageSource.SetDrawColor(0, 0, 0, 0);\n         imageSource.FillBox(0, 9, 0, 9);\n         imageSource.SetDrawColor(255, 0, 0, 0);\n         imageSource.FillBox(5, 7, 5, 7);\n         imageSource.Update();\n\n         vtkPNMWriter pnmWriter = vtkPNMWriter.New();\n         pnmWriter.SetFileName(filePath);\n         pnmWriter.SetInputConnection(imageSource.GetOutputPort());\n         pnmWriter.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkPNMReader reader = vtkPNMReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/IO/WriteTIFF/","title":"WriteTIFF","text":"

vtk-examples/CSharp/IO/WriteTIFF

"},{"location":"CSharp/IO/WriteTIFF/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/WriteTIFF/#code","title":"Code","text":"

WriteTIFF.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteTIFF();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteTIFF() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_tiff.tif\");\n\n         vtkImageCanvasSource2D imageSource = vtkImageCanvasSource2D.New();\n         imageSource.SetScalarTypeToUnsignedChar();\n         imageSource.SetExtent(0, 9, 0, 9, 0, 0);\n         imageSource.SetNumberOfScalarComponents(3);\n         imageSource.SetDrawColor(0, 0, 0, 0);\n         imageSource.FillBox(0, 9, 0, 9);\n         imageSource.SetDrawColor(255, 0, 0, 0);\n         imageSource.FillBox(5, 7, 5, 7);\n         imageSource.Update();\n\n         vtkTIFFWriter tiffWriter = vtkTIFFWriter.New();\n         tiffWriter.SetFileName(filePath);\n         tiffWriter.SetInputConnection(imageSource.GetOutputPort());\n         tiffWriter.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkTIFFReader reader = vtkTIFFReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
"},{"location":"CSharp/IO/WriteVTI/","title":"WriteVTI","text":"

vtk-examples/CSharp/IO/WriteVTI

"},{"location":"CSharp/IO/WriteVTI/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/WriteVTI/#code","title":"Code","text":"

WriteVTI.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteVTI();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteVTI() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_vti.vti\");\n         vtkImageData imageData = vtkImageData.New();\n         imageData.SetDimensions(3, 4, 5);\n         imageData.SetNumberOfScalarComponents(1);\n         imageData.SetScalarTypeToDouble();\n         int[] dims = imageData.GetDimensions();\n\n         // Fill every entry of the image data with \"2.0\"\n         /* we can do this in unsafe mode which looks pretty similar to the c++ version \n           but then you must declare at the very top of your file the \"preprocessor\" directive \n\n          #define UNSAFE\n\n          * or whatever name you choose for the following preprocessor #if statement\n          */\n#if UNSAFE\n         unsafe {\n            for(int z = 0; z < dims[2]; z++) {\n               for(int y = 0; y < dims[1]; y++) {\n                  for(int x = 0; x < dims[0]; x++) {\n                     double* pixel = (double*)imageData.GetScalarPointer(x, y, z).ToPointer();\n                     // c++ version:\n                     // double* pixel = static_cast<double*>(imageData->GetScalarPointer(x,y,z));\n                     pixel[0] = 2.0;\n                  }\n               }\n            }\n         }\n#else\n         /* or we can do it in managed mode */\n         int size = imageData.GetScalarSize();\n         IntPtr ptr = Marshal.AllocHGlobal(size);\n\n         for(int z = 0; z < dims[2]; z++) {\n            for(int y = 0; y < dims[1]; y++) {\n               for(int x = 0; x < dims[0]; x++) {\n                  ptr = imageData.GetScalarPointer(x, y, z);\n                  Marshal.Copy(new double[] { 2.0 }, 0, ptr, 1);\n               }\n            }\n         }\n         Marshal.FreeHGlobal(ptr);\n#endif\n\n         vtkXMLImageDataWriter writer = vtkXMLImageDataWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInputConnection(imageData.GetProducerPort());\n         writer.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkXMLImageDataReader reader = vtkXMLImageDataReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Convert the image to a polydata\n         vtkImageDataGeometryFilter imageDataGeometryFilter = vtkImageDataGeometryFilter.New();\n         imageDataGeometryFilter.SetInputConnection(reader.GetOutputPort());\n         imageDataGeometryFilter.Update();\n\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(imageDataGeometryFilter.GetOutputPort());\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetPointSize(4);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/WriteVTP/","title":"WriteVTP","text":"

vtk-examples/CSharp/IO/WriteVTP

"},{"location":"CSharp/IO/WriteVTP/#description","title":"Description","text":"

In this example, we add 4 points to a polygonal data (polydata) object and write the result to a VTP file. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/WriteVTP/#code","title":"Code","text":"

WriteVTP.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WritePolyData();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WritePolyData() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\poly_test.vtp\");\n         // Create 4 points for a tetrahedron\n         vtkPoints points = vtkPoints.New();\n\n         points.InsertNextPoint(0, 0, 0);\n         points.InsertNextPoint(0, 0, 1);\n         points.InsertNextPoint(1, 0, 0);\n         points.InsertNextPoint(0, 1, 0);\n\n         // Create a polydata object and add the points to it.\n         vtkPolyData polydata = vtkPolyData.New();\n         polydata.SetPoints(points);\n\n         // it's not enough only to define points\n         // we need to define faces too\n         // (must be defined in counter clockwise order as viewed from the outside)\n         vtkTriangle face0 = vtkTriangle.New();\n         face0.GetPointIds().SetId(0, 0);\n         face0.GetPointIds().SetId(1, 2);\n         face0.GetPointIds().SetId(2, 1);\n         vtkTriangle face1 = vtkTriangle.New();\n         face1.GetPointIds().SetId(0, 0);\n         face1.GetPointIds().SetId(1, 3);\n         face1.GetPointIds().SetId(2, 2);\n         vtkTriangle face2 = vtkTriangle.New();\n         face2.GetPointIds().SetId(0, 0);\n         face2.GetPointIds().SetId(1, 1);\n         face2.GetPointIds().SetId(2, 3);\n         vtkTriangle face3 = vtkTriangle.New();\n         face3.GetPointIds().SetId(0, 1);\n         face3.GetPointIds().SetId(1, 2);\n         face3.GetPointIds().SetId(2, 3);\n\n         vtkCellArray faces = vtkCellArray.New();\n         faces.InsertNextCell(face0);\n         faces.InsertNextCell(face1);\n         faces.InsertNextCell(face2);\n         faces.InsertNextCell(face3);\n\n         polydata.SetPolys(faces);\n\n         // Write the file\n         vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInput(polydata);\n\n         // Optional - set the mode. The default is binary.\n         //writer.SetDataModeToBinary();\n         writer.SetDataModeToAscii();\n         writer.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/WriteVTU/","title":"WriteVTU","text":"

vtk-examples/CSharp/IO/WriteVTU

"},{"location":"CSharp/IO/WriteVTU/#description","title":"Description","text":"

This example writes a VTU file. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/WriteVTU/#code","title":"Code","text":"

WriteVTU.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteVTUFile();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteVTUFile() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\tetra_test.vtu\");\n\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0, 0, 0);\n         points.InsertNextPoint(1, 0, 0);\n         points.InsertNextPoint(1, 1, 0);\n         points.InsertNextPoint(0, 1, 1);\n\n         vtkTetra tetra = vtkTetra.New();\n\n         tetra.GetPointIds().SetId(0, 0);\n         tetra.GetPointIds().SetId(1, 1);\n         tetra.GetPointIds().SetId(2, 2);\n         tetra.GetPointIds().SetId(3, 3);\n\n         vtkCellArray cellArray = vtkCellArray.New();\n         cellArray.InsertNextCell(tetra);\n\n         vtkUnstructuredGrid unstructuredGrid = vtkUnstructuredGrid.New();\n         unstructuredGrid.SetPoints(points);\n         const int VTK_TETRA = 10;\n         unstructuredGrid.SetCells(VTK_TETRA, cellArray);\n\n         // Write file\n         vtkXMLUnstructuredGridWriter writer = vtkXMLUnstructuredGridWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInput(unstructuredGrid);\n         writer.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkXMLUnstructuredGridReader reader = vtkXMLUnstructuredGridReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/IO/XMLStructuredGridWriter/","title":"XMLStructuredGridWriter","text":"

vtk-examples/CSharp/IO/XMLStructuredGridWriter

"},{"location":"CSharp/IO/XMLStructuredGridWriter/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/IO/XMLStructuredGridWriter/#code","title":"Code","text":"

XMLStructuredGridWriter.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            XMLStructuredGridWriter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void XMLStructuredGridWriter() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\structuredgrid_test.vts\");\n         // Create a grid\n         vtkStructuredGrid structuredGrid = vtkStructuredGrid.New();\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0, 0, 0);\n         points.InsertNextPoint(1, 0, 0);\n         points.InsertNextPoint(0, 1, 0);\n         points.InsertNextPoint(1, 1, 0);\n         points.InsertNextPoint(0, 2, 0);\n         points.InsertNextPoint(1, 2, 1);\n\n         // Specify the dimensions of the grid\n         structuredGrid.SetDimensions(2, 3, 1);\n         structuredGrid.SetPoints(points);\n\n         // Write file\n         vtkXMLStructuredGridWriter writer = vtkXMLStructuredGridWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInput(structuredGrid);\n         writer.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkXMLStructuredGridReader reader = vtkXMLStructuredGridReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         vtkStructuredGridGeometryFilter geometryFilter = vtkStructuredGridGeometryFilter.New();\n         geometryFilter.SetInputConnection(reader.GetOutputPort());\n         geometryFilter.Update();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(geometryFilter.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/ImplicitFunctions/ImplicitSphere/","title":"ImplicitSphere","text":"

vtk-examples/CSharp/ImplicitFunctions/ImplicitSphere

"},{"location":"CSharp/ImplicitFunctions/ImplicitSphere/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Note

As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/ImplicitFunctions/ImplicitSphere/#code","title":"Code","text":"

ImplicitSphere.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ImplicitSphere();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ImplicitSphere() {\n         vtkSphere sphere = vtkSphere.New();\n\n         // Sample the function\n         vtkSampleFunction sample = vtkSampleFunction.New();\n         sample.SetSampleDimensions(50, 50, 50);\n         sample.SetImplicitFunction(sphere);\n         double value = 2.0;\n         double xmin = -value, xmax = value,\n                ymin = -value, ymax = value,\n                zmin = -value, zmax = value;\n         sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n         // Create the 0 isosurface\n         vtkContourFilter contours = vtkContourFilter.New();\n#if VTK_MAJOR_VERSION_5\n         contours.SetInputConnection(sample.GetOutputPort());\n#else\n         contours.SetInputData(sample);\n#endif\n         contours.GenerateValues(1, 1, 1);\n\n         // Map the contours to graphical primitives\n         vtkPolyDataMapper contourMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         contourMapper.SetInputConnection(contours.GetOutputPort());\n#else\n         contourMapper.SetInputData(contours);\n#endif\n         contourMapper.ScalarVisibilityOff();\n\n         // Create an actor for the contours\n         vtkActor contourActor = vtkActor.New();\n         contourActor.SetMapper(contourMapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(contourActor);\n      }\n   }\n}\n
"},{"location":"CSharp/ImplicitFunctions/IsoContours/","title":"IsoContours","text":"

vtk-examples/CSharp/ImplicitFunctions/IsoContours

"},{"location":"CSharp/ImplicitFunctions/IsoContours/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Note

As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Note

To use this example create a Windows Forms Application, delete Form1.Designer.cs and replace the content of Form1.cs with this:

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/ImplicitFunctions/IsoContours/#code","title":"Code","text":"

IsoContours.cs

using System;\nusing System.ComponentModel;\nusing System.Drawing;\nusing System.Windows.Forms;\nusing System.Runtime.InteropServices;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public class Form1 : Form {\n      private System.ComponentModel.IContainer components = null;\n      private vtkContourFilter _ContourFilter;\n      private vtkRenderWindow _RenderWindow;\n\n\n      public Form1() {\n         InitializeComponent();\n         this.Size = new Size(620, 400);\n      }\n\n\n      private void Form1_Load(object sender, EventArgs e) {\n         try {\n            IsoContours();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void sliderContourValue_Scroll(object sender, EventArgs e) {\n         TrackBar slider = sender as TrackBar;\n         if(slider != null) {\n            _ContourFilter.GenerateValues(1, slider.Value, slider.Value);\n            _RenderWindow.Render();\n         }\n      }\n\n\n      private void IsoContours() {\n         vtkImageData data = vtkImageData.New();\n         CreateData(ref data);\n\n         // Create an isosurface\n         _ContourFilter = vtkContourFilter.New();\n#if VTK_MAJOR_VERSION_5\n         _ContourFilter.SetInput(data);\n#else\n         contourFilter.SetInputData(data);\n#endif\n         _ContourFilter.GenerateValues(1, 10, 10); // (numContours, rangeStart, rangeEnd)\n\n         // Map the contours to graphical primitives\n         vtkPolyDataMapper contourMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         contourMapper.SetInputConnection(_ContourFilter.GetOutputPort());\n#else\n         contourMapper.SetInputData(contourFilter);\n#endif\n         // Create an actor for the contours\n         vtkActor contourActor = vtkActor.New();\n         contourActor.SetMapper(contourMapper);\n\n         // Create the outline\n         vtkOutlineFilter outlineFilter = vtkOutlineFilter.New();\n         vtkPolyDataMapper outlineMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         outlineFilter.SetInput(data);\n         outlineMapper.SetInputConnection(outlineFilter.GetOutputPort());\n#else\n         outlineFilter.SetInputData(data);\n         outlineMapper.SetInputData(outlineFilter);\n#endif\n         vtkActor outlineActor = vtkActor.New();\n         outlineActor.SetMapper(outlineMapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         _RenderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = _RenderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(contourActor);\n         renderer.AddActor(outlineActor);\n      }\n\n\n      void CreateData(ref vtkImageData data) {\n         data.SetExtent(-25, 25, -25, 25, 0, 0);\n#if VTK_MAJOR_VERSION_5\n         data.SetNumberOfScalarComponents(1);\n         data.SetScalarTypeToDouble();\n#else\n         data.AllocateScalars(VTK_DOUBLE,1);\n#endif\n         int[] extent = data.GetExtent();\n\n         for(int y = extent[2]; y <= extent[3]; y++) {\n            for(int x = extent[0]; x <= extent[1]; x++) {\n               IntPtr ptr = data.GetScalarPointer(x, y, 0);\n               double[] pixel = new double[] { Math.Sqrt(Math.Pow(x, 2.0) + Math.Pow(y, 2.0)) };\n               Marshal.Copy(pixel, 0, ptr, 1);\n            }\n         }\n\n         vtkXMLImageDataWriter writer = vtkXMLImageDataWriter.New();\n         writer.SetFileName(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\testIsoContours.vti\");\n#if VTK_MAJOR_VERSION_5\n         writer.SetInputConnection(data.GetProducerPort());\n#else\n         writer.SetInputData(data);\n#endif\n         writer.Write();\n      }\n\n\n\n      /// <summary>\n      /// Clean up any resources being used.\n      /// </summary>\n      /// <param name=\"disposing\">true if managed resources should be disposed; otherwise, false.</param>\n      protected override void Dispose(bool disposing) {\n         if(disposing && ( components != null )) {\n            components.Dispose();\n         }\n         base.Dispose(disposing);\n      }\n\n      #region Windows Form Designer generated code\n\n      /// <summary>\n      /// Required method for Designer support - do not modify\n      /// the contents of this method with the code editor.\n      /// </summary>\n      private void InitializeComponent() {\n         this.splitContainer1 = new System.Windows.Forms.SplitContainer();\n         this.lblSliderMaxValue = new System.Windows.Forms.Label();\n         this.lblSliderMinValue = new System.Windows.Forms.Label();\n         this.lblSliderTitle = new System.Windows.Forms.Label();\n         this.sliderContourValue = new System.Windows.Forms.TrackBar();\n         this.renderWindowControl1 = new Kitware.VTK.RenderWindowControl();\n         this.splitContainer1.Panel1.SuspendLayout();\n         this.splitContainer1.Panel2.SuspendLayout();\n         this.splitContainer1.SuspendLayout();\n         ((System.ComponentModel.ISupportInitialize)(this.sliderContourValue)).BeginInit();\n         this.SuspendLayout();\n         // \n         // splitContainer1\n         // \n         this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;\n         this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;\n         this.splitContainer1.IsSplitterFixed = true;\n         this.splitContainer1.Location = new System.Drawing.Point(0, 0);\n         this.splitContainer1.Name = \"splitContainer1\";\n         // \n         // splitContainer1.Panel1\n         // \n         this.splitContainer1.Panel1.Controls.Add(this.lblSliderMaxValue);\n         this.splitContainer1.Panel1.Controls.Add(this.lblSliderMinValue);\n         this.splitContainer1.Panel1.Controls.Add(this.lblSliderTitle);\n         this.splitContainer1.Panel1.Controls.Add(this.sliderContourValue);\n         // \n         // splitContainer1.Panel2\n         // \n         this.splitContainer1.Panel2.Controls.Add(this.renderWindowControl1);\n         this.splitContainer1.Size = new System.Drawing.Size(604, 362);\n         this.splitContainer1.SplitterDistance = 213;\n         this.splitContainer1.SplitterWidth = 1;\n         this.splitContainer1.TabIndex = 0;\n         // \n         // lblSliderMaxValue\n         // \n         this.lblSliderMaxValue.AutoSize = true;\n         this.lblSliderMaxValue.Location = new System.Drawing.Point(176, 69);\n         this.lblSliderMaxValue.Name = \"lblSliderMaxValue\";\n         this.lblSliderMaxValue.Size = new System.Drawing.Size(19, 13);\n         this.lblSliderMaxValue.TabIndex = 1;\n         this.lblSliderMaxValue.Text = \"30\";\n         // \n         // lblSliderMinValue\n         // \n         this.lblSliderMinValue.AutoSize = true;\n         this.lblSliderMinValue.Location = new System.Drawing.Point(21, 69);\n         this.lblSliderMinValue.Name = \"lblSliderMinValue\";\n         this.lblSliderMinValue.Size = new System.Drawing.Size(13, 13);\n         this.lblSliderMinValue.TabIndex = 1;\n         this.lblSliderMinValue.Text = \"1\";\n         // \n         // lblSliderTitle\n         // \n         this.lblSliderTitle.AutoSize = true;\n         this.lblSliderTitle.Location = new System.Drawing.Point(18, 11);\n         this.lblSliderTitle.Name = \"lblSliderTitle\";\n         this.lblSliderTitle.Size = new System.Drawing.Size(74, 13);\n         this.lblSliderTitle.TabIndex = 1;\n         this.lblSliderTitle.Text = \"Contour Value\";\n         // \n         // sliderContourValue\n         // \n         this.sliderContourValue.Location = new System.Drawing.Point(12, 37);\n         this.sliderContourValue.Maximum = 30;\n         this.sliderContourValue.Minimum = 1;\n         this.sliderContourValue.Name = \"sliderContourValue\";\n         this.sliderContourValue.Size = new System.Drawing.Size(186, 45);\n         this.sliderContourValue.TabIndex = 0;\n         this.sliderContourValue.TickFrequency = 5;\n         this.sliderContourValue.Value = 10;\n         this.sliderContourValue.Scroll += new System.EventHandler(this.sliderContourValue_Scroll);\n         // \n         // renderWindowControl1\n         // \n         this.renderWindowControl1.AddTestActors = false;\n         this.renderWindowControl1.Dock = System.Windows.Forms.DockStyle.Fill;\n         this.renderWindowControl1.Location = new System.Drawing.Point(0, 0);\n         this.renderWindowControl1.Name = \"renderWindowControl1\";\n         this.renderWindowControl1.Size = new System.Drawing.Size(390, 362);\n         this.renderWindowControl1.TabIndex = 0;\n         this.renderWindowControl1.TestText = null;\n         // \n         // Form1\n         // \n         this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\n         this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\n         this.ClientSize = new System.Drawing.Size(604, 362);\n         this.Controls.Add(this.splitContainer1);\n         this.Name = \"Form1\";\n         this.Text = \"IsoContours\";\n         this.Load += new System.EventHandler(this.Form1_Load);\n         this.splitContainer1.Panel1.ResumeLayout(false);\n         this.splitContainer1.Panel1.PerformLayout();\n         this.splitContainer1.Panel2.ResumeLayout(false);\n         this.splitContainer1.ResumeLayout(false);\n         ((System.ComponentModel.ISupportInitialize)(this.sliderContourValue)).EndInit();\n         this.ResumeLayout(false);\n\n      }\n\n      #endregion\n\n      private System.Windows.Forms.SplitContainer splitContainer1;\n      private System.Windows.Forms.Label lblSliderTitle;\n      private System.Windows.Forms.TrackBar sliderContourValue;\n      private Kitware.VTK.RenderWindowControl renderWindowControl1;\n      private System.Windows.Forms.Label lblSliderMaxValue;\n      private System.Windows.Forms.Label lblSliderMinValue;\n   }\n}\n
"},{"location":"CSharp/ImplicitFunctions/SampleFunction/","title":"SampleFunction","text":"

vtk-examples/CSharp/ImplicitFunctions/SampleFunction

"},{"location":"CSharp/ImplicitFunctions/SampleFunction/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/ImplicitFunctions/SampleFunction/#code","title":"Code","text":"

SampleFunction.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            SampleFunction();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void SampleFunction() {\n         vtkSphere sphere = vtkSphere.New();\n\n         // Sample the function\n         vtkSampleFunction sample = vtkSampleFunction.New();\n         sample.SetSampleDimensions(50, 50, 50);\n         sample.SetImplicitFunction(sphere);\n         double value = 2.0;\n         double xmin = -value, xmax = value, ymin = -value, ymax = value, zmin = -value, zmax = value;\n         sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n         // Create the 0 isosurface\n         vtkContourFilter contours = vtkContourFilter.New();\n#if VTK_MAJOR_VERSION_5\n         contours.SetInputConnection(sample.GetOutputPort());\n#else\n         contours.SetInputData(sample);\n#endif\n         contours.GenerateValues(1, 1, 1);\n\n         // Map the contours to graphical primitives\n         vtkPolyDataMapper contourMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         contourMapper.SetInputConnection(contours.GetOutputPort());\n#else\n         contourMapper.SetInputData(contours);\n#endif\n         contourMapper.SetScalarRange(0.0, 1.2);\n\n         // Create an actor for the contours\n         vtkActor contourActor = vtkActor.New();\n         contourActor.SetMapper(contourMapper);\n\n         // -- create a box around the function to indicate the sampling volume --\n\n         // Create outline\n         vtkOutlineFilter outline = vtkOutlineFilter.New();\n#if VTK_MAJOR_VERSION_5\n         outline.SetInputConnection(sample.GetOutputPort());\n#else\n         outline.SetInputData(sample);\n#endif\n\n         // Map it to graphics primitives\n         vtkPolyDataMapper outlineMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         outlineMapper.SetInputConnection(outline.GetOutputPort());\n#else\n         outlineMapper.SetInputData(outline);\n#endif\n\n         // Create an actor for it\n         vtkActor outlineActor = vtkActor.New();\n\n         outlineActor.SetMapper(outlineMapper);\n         outlineActor.GetProperty().SetColor(0, 0, 0);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(1.0, 1.0, 1.0);\n         // add our actor to the renderer\n         renderer.AddActor(contourActor);\n         renderer.AddActor(outlineActor);\n      }\n   }\n}\n
"},{"location":"CSharp/InfoVis/XGMLReader/","title":"XGMLReader","text":"

vtk-examples/CSharp/InfoVis/XGMLReader

"},{"location":"CSharp/InfoVis/XGMLReader/#description","title":"Description","text":"

This example reads and displays the graph from a gml file. You can test this with VTKData/Data/Infovis/fsm.gml. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/InfoVis/XGMLReader/#code","title":"Code","text":"

XGMLReader.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            XGMLReader();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void XGMLReader() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\Infovis\\fsm.gml\");\n\n         vtkXGMLReader reader = vtkXGMLReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         vtkUndirectedGraph g = reader.GetOutput();\n\n         vtkGraphLayoutView graphLayoutView = vtkGraphLayoutView.New();\n         graphLayoutView.SetRenderWindow(renderWindowControl1.RenderWindow);\n         graphLayoutView.AddRepresentationFromInput(g);\n         graphLayoutView.SetLayoutStrategy(\"Simple 2D\");\n         graphLayoutView.ResetCamera();\n         graphLayoutView.Render();\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/BoundaryEdges/","title":"BoundaryEdges","text":"

vtk-examples/CSharp/Meshes/BoundaryEdges

"},{"location":"CSharp/Meshes/BoundaryEdges/#description","title":"Description","text":"

This filter will extract the boundary edges of a mesh. The original mesh is shown with the feature edges shown in red.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/BoundaryEdges/#code","title":"Code","text":"

BoundaryEdges.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            BoundaryEdges();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void BoundaryEdges() {\n         vtkDiskSource diskSource = vtkDiskSource.New();\n         diskSource.Update();\n\n         vtkFeatureEdges featureEdges = vtkFeatureEdges.New();\n#if VTK_MAJOR_VERSION_5\n         featureEdges.SetInputConnection(diskSource.GetOutputPort());\n#else\n         featureEdges.SetInputData(diskSource);\n#endif\n         featureEdges.BoundaryEdgesOn();\n         featureEdges.FeatureEdgesOff();\n         featureEdges.ManifoldEdgesOff();\n         featureEdges.NonManifoldEdgesOff();\n         featureEdges.Update();\n\n         // Visualize\n         vtkPolyDataMapper edgeMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         edgeMapper.SetInputConnection(featureEdges.GetOutputPort());\n#else\n         edgeMapper.SetInputData(featureEdges);\n#endif\n         vtkActor edgeActor = vtkActor.New();\n         edgeActor.GetProperty().SetLineWidth(3);\n         edgeActor.SetMapper(edgeMapper);\n\n         vtkPolyDataMapper diskMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         diskMapper.SetInputConnection(diskSource.GetOutputPort());\n#else\n         diskMapper.SetInputData(diskSource);\n#endif\n         vtkActor diskActor = vtkActor.New();\n         diskActor.SetMapper(diskMapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.3, 0.6, 0.3);\n         // add our actor to the renderer\n         renderer.AddActor(diskActor);\n         renderer.AddActor(edgeActor);\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/CapClip/","title":"CapClip","text":"

vtk-examples/CSharp/Meshes/CapClip

"},{"location":"CSharp/Meshes/CapClip/#description","title":"Description","text":"

This example shows how to generate a \"cap\" on a clipped polydata. It uses a clever trick to convert polylines into polygons. If a polydata file (.vtp) is provided, it will cap it. Otherwise it caps a clipped sphere.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you have to define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/CapClip/#code","title":"Code","text":"

CapClip.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            CapClip(null);\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void CapClip(string filePath) {\n         // PolyData to process\n         vtkPolyData polyData;\n\n         if(filePath != null) {\n            vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n            reader.SetFileName(filePath);\n            reader.Update();\n            polyData = reader.GetOutput();\n         }\n         else {\n            // Create a sphere\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.SetThetaResolution(20);\n            sphereSource.SetPhiResolution(11);\n\n            vtkPlane plane = vtkPlane.New();\n            plane.SetOrigin(0, 0, 0);\n            plane.SetNormal(1.0, -1.0, -1.0);\n\n            vtkClipPolyData clipper = vtkClipPolyData.New();\n            clipper.SetInputConnection(sphereSource.GetOutputPort());\n            clipper.SetClipFunction(plane);\n            clipper.SetValue(0);\n            clipper.Update();\n\n            polyData = clipper.GetOutput();\n         }\n\n         vtkDataSetMapper clipMapper = vtkDataSetMapper.New();\n#if VTK_MAJOR_VERSION_5\n         clipMapper.SetInput(polyData);\n#else\n         clipMapper.SetInputData(polyData);\n#endif\n\n         vtkActor clipActor = vtkActor.New();\n         clipActor.SetMapper(clipMapper);\n         clipActor.GetProperty().SetColor(1.0000, 0.3882, 0.2784);\n         clipActor.GetProperty().SetInterpolationToFlat();\n\n         // Now extract feature edges\n         vtkFeatureEdges boundaryEdges = vtkFeatureEdges.New();\n#if VTK_MAJOR_VERSION_5\n         boundaryEdges.SetInput(polyData);\n#else\n         boundaryEdges.SetInputData(polyData);\n#endif\n         boundaryEdges.BoundaryEdgesOn();\n         boundaryEdges.FeatureEdgesOff();\n         boundaryEdges.NonManifoldEdgesOff();\n         boundaryEdges.ManifoldEdgesOff();\n\n         vtkStripper boundaryStrips = vtkStripper.New();\n         boundaryStrips.SetInputConnection(boundaryEdges.GetOutputPort());\n         boundaryStrips.Update();\n\n         // Change the polylines into polygons\n         vtkPolyData boundaryPoly = vtkPolyData.New();\n         boundaryPoly.SetPoints(boundaryStrips.GetOutput().GetPoints());\n         boundaryPoly.SetPolys(boundaryStrips.GetOutput().GetLines());\n\n         vtkPolyDataMapper boundaryMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         boundaryMapper.SetInput(boundaryPoly);\n#else\n         boundaryMapper.SetInputData(boundaryPoly);\n#endif\n\n         vtkActor boundaryActor = vtkActor.New();\n         boundaryActor.SetMapper(boundaryMapper);\n         boundaryActor.GetProperty().SetColor(0.8900, 0.8100, 0.3400);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(clipActor);\n         renderer.AddActor(boundaryActor);\n         // Generate an interesting view\n         //\n         renderer.ResetCamera();\n         renderer.GetActiveCamera().Azimuth(30);\n         renderer.GetActiveCamera().Elevation(30);\n         renderer.GetActiveCamera().Dolly(1.2);\n         renderer.ResetCameraClippingRange();\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/CellEdges/","title":"CellEdges","text":"

vtk-examples/CSharp/Meshes/CellEdges

"},{"location":"CSharp/Meshes/CellEdges/#description","title":"Description","text":"

A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/CellEdges/#code","title":"Code","text":"

CellEdges.cs

using System;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         CellEdges();\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      private static void CellEdges() {\n         vtkTriangle triangle = vtkTriangle.New();\n         triangle.GetPoints().SetPoint(0, 1.0, 0.0, 0.0);\n         triangle.GetPoints().SetPoint(1, 0.0, 0.0, 0.0);\n         triangle.GetPoints().SetPoint(2, 0.0, 1.0, 0.0);\n         triangle.GetPointIds().SetId(0, 0);\n         triangle.GetPointIds().SetId(1, 1);\n         triangle.GetPointIds().SetId(2, 2);\n\n         Console.WriteLine(\"The cell has \" + triangle.GetNumberOfEdges() + \" edges.\");\n\n         for(int i = 0; i < triangle.GetNumberOfEdges(); i++) {\n            vtkCell edge = triangle.GetEdge(i);\n\n            vtkIdList pointIdList = edge.GetPointIds();\n            Console.WriteLine(\"Edge \" + i + \" has \" + pointIdList.GetNumberOfIds() + \" points.\");\n\n            for(int p = 0; p < pointIdList.GetNumberOfIds(); p++) {\n               Console.WriteLine(\"Edge \" + i + \" uses point \" + pointIdList.GetId(p));\n            }\n         }\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/ColoredElevationMap/","title":"ColoredElevationMap","text":"

vtk-examples/CSharp/Meshes/ColoredElevationMap

"},{"location":"CSharp/Meshes/ColoredElevationMap/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/ColoredElevationMap/#code","title":"Code","text":"

ColoredElevationMap.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ColoredElevationMap();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ColoredElevationMap() {\n         // Create a grid of points (height/terrian map)\n         vtkPoints points = vtkPoints.New();\n\n         uint GridSize = 20;\n         double xx, yy, zz;\n         for(uint x = 0; x < GridSize; x++) {\n            for(uint y = 0; y < GridSize; y++) {\n               xx = x + vtkMath.Random(-.2, .2);\n               yy = y + vtkMath.Random(-.2, .2);\n               zz = vtkMath.Random(-.5, .5);\n               points.InsertNextPoint(xx, yy, zz);\n            }\n         }\n\n         // Add the grid points to a polydata object\n         vtkPolyData inputPolyData = vtkPolyData.New();\n         inputPolyData.SetPoints(points);\n\n         // Triangulate the grid points\n         vtkDelaunay2D delaunay = vtkDelaunay2D.New();\n#if VTK_MAJOR_VERSION_5\n         delaunay.SetInput(inputPolyData);\n#else\n         delaunay.SetInputData(inputPolyData);\n#endif\n         delaunay.Update();\n         vtkPolyData outputPolyData = delaunay.GetOutput();\n\n         double[] bounds = outputPolyData.GetBounds();\n\n         // Find min and max z\n         double minz = bounds[4];\n         double maxz = bounds[5];\n\n         Debug.WriteLine(\"minz: \" + minz);\n         Debug.WriteLine(\"maxz: \" + maxz);\n\n         // Create the color map\n         vtkLookupTable colorLookupTable = vtkLookupTable.New();\n         colorLookupTable.SetTableRange(minz, maxz);\n         colorLookupTable.Build();\n\n         // Generate the colors for each point based on the color map\n         vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();\n         colors.SetNumberOfComponents(3);\n         colors.SetName(\"Colors\");\n\n         Debug.WriteLine(\"There are \" + outputPolyData.GetNumberOfPoints()\n                   + \" points.\");\n\n\n#if UNSAFE // fastest way to fill color array\n         colors.SetNumberOfTuples(outputPolyData.GetNumberOfPoints());\n         unsafe {\n            byte* pColor = (byte*)colors.GetPointer(0).ToPointer();\n\n            for(int i = 0; i < outputPolyData.GetNumberOfPoints(); i++) {\n               double[] p = outputPolyData.GetPoint(i);\n\n               double[] dcolor = colorLookupTable.GetColor(p[2]);\n               Debug.WriteLine(\"dcolor: \"\n                         + dcolor[0] + \" \"\n                         + dcolor[1] + \" \"\n                         + dcolor[2]);\n\n               byte[] color = new byte[3];\n               for(uint j = 0; j < 3; j++) {\n                  color[j] = (byte)( 255 * dcolor[j] );\n               }\n               Debug.WriteLine(\"color: \"\n                         + color[0] + \" \"\n                         + color[1] + \" \"\n                         + color[2]);\n\n               *( pColor + 3 * i ) = color[0];\n               *( pColor + 3 * i + 1 ) = color[1];\n               *( pColor + 3 * i + 2 ) = color[2];\n            }\n         }\n#else\n         for(int i = 0; i < outputPolyData.GetNumberOfPoints(); i++) {\n            double[] p = outputPolyData.GetPoint(i);\n\n            double[] dcolor = colorLookupTable.GetColor(p[2]);\n            Debug.WriteLine(\"dcolor: \"\n                      + dcolor[0] + \" \"\n                      + dcolor[1] + \" \"\n                      + dcolor[2]);\n\n            byte[] color = new byte[3];\n            for(uint j = 0; j < 3; j++) {\n               color[j] = (byte)( 255 * dcolor[j] );\n            }\n            Debug.WriteLine(\"color: \"\n                      + color[0] + \" \"\n                      + color[1] + \" \"\n                      + color[2]);\n            colors.InsertNextTuple3(color[0], color[1], color[2] );\n            //IntPtr pColor = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(byte)) * 3);\n            //Marshal.Copy(color, 0, pColor, 3);\n            //colors.InsertNextTupleValue(pColor);\n            //Marshal.FreeHGlobal(pColor);\n         }\n#endif\n\n         outputPolyData.GetPointData().SetScalars(colors);\n\n         // Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInputConnection(outputPolyData.GetProducerPort());\n#else\n         mapper.SetInputData(outputPolyData);\n#endif\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/Decimate/","title":"Decimate","text":"

vtk-examples/CSharp/Meshes/Decimate

"},{"location":"CSharp/Meshes/Decimate/#description","title":"Description","text":"

This example decimates a mesh. The SetTargetReduction function specifies how many triangles should reduced by specifying the percentage ([of triangles to be removed. For example, if the mesh contains 100 triangles and SetTargetReduction(.90) is called, after the decimation there will be approximately 10 triangles - a 90% reduction.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/Decimate/#code","title":"Code","text":"

Decimate.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Decimate();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Decimation() { \n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkPolyData input = vtkPolyData.New();\n         input.ShallowCopy(sphereSource.GetOutput());\n\n         Debug.WriteLine(\"Before decimation\" + Environment.NewLine + \"------------\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkDecimatePro decimate = vtkDecimatePro.New();\n#if VTK_MAJOR_VERSION_5\n         decimate.SetInputConnection(input.GetProducerPort());\n#else\n         decimate.SetInputData(input);\n#endif\n         //decimate.SetTargetReduction(.99); //99% reduction (if there was 100 triangles, now there will be 1)\n         decimate.SetTargetReduction(.10); //10% reduction (if there was 100 triangles, now there will be 90)\n         decimate.Update();\n\n         vtkPolyData decimated = vtkPolyData.New();\n         decimated.ShallowCopy(decimate.GetOutput());\n\n         Debug.WriteLine(\"After decimation\" + Environment.NewLine + \"------------\" );\n\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInputConnection(input.GetProducerPort());\n#else\n         inputMapper.SetInputData(input);\n#endif\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n\n         vtkPolyDataMapper decimatedMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         decimatedMapper.SetInputConnection(decimated.GetProducerPort());\n#else\n         decimatedMapper.SetInputData(decimated);\n#endif\n         vtkActor decimatedActor = vtkActor.New();\n         decimatedActor.SetMapper(decimatedMapper);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(inputActor);\n         rightRenderer.AddActor(decimatedActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/ElevationFilter/","title":"ElevationFilter","text":"

vtk-examples/CSharp/Meshes/ElevationFilter

"},{"location":"CSharp/Meshes/ElevationFilter/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/ElevationFilter/#code","title":"Code","text":"

ElevationFilter.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ElevationFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ElevationFilter() {\n         // Created a grid of points (heigh/terrian map)\n         vtkPoints points = vtkPoints.New();\n\n         uint GridSize = 10;\n         for(uint x = 0; x < GridSize; x++) {\n            for(uint y = 0; y < GridSize; y++) {\n               points.InsertNextPoint(x, y, ( x + y ) / ( y + 1 ));\n            }\n         }\n         double[] bounds = points.GetBounds();\n\n         // Add the grid points to a polydata object\n         vtkPolyData inputPolyData = vtkPolyData.New();\n         inputPolyData.SetPoints(points);\n\n         // Triangulate the grid points\n         vtkDelaunay2D delaunay = vtkDelaunay2D.New();\n#if VTK_MAJOR_VERSION_5\n         delaunay.SetInput(inputPolyData);\n#else\n         delaunay.SetInputData(inputPolyData);\n#endif\n         delaunay.Update();\n\n         vtkElevationFilter elevationFilter = vtkElevationFilter.New();\n         elevationFilter.SetInputConnection(delaunay.GetOutputPort());\n         elevationFilter.SetLowPoint(0.0, 0.0, bounds[4]);\n         elevationFilter.SetHighPoint(0.0, 0.0, bounds[5]);\n         elevationFilter.Update();\n\n         vtkPolyData output = vtkPolyData.New();\n         output.ShallowCopy(vtkPolyData.SafeDownCast(elevationFilter.GetOutput()));\n\n         vtkFloatArray elevation = \n            vtkFloatArray.SafeDownCast(output.GetPointData().GetArray(\"Elevation\"));\n\n         // Create the color map\n         vtkLookupTable colorLookupTable = vtkLookupTable.New();\n         colorLookupTable.SetTableRange(bounds[4], bounds[5]);\n         colorLookupTable.Build();\n\n         // Generate the colors for each point based on the color map\n         vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();\n         colors.SetNumberOfComponents(3);\n         colors.SetName(\"Colors\");\n\n         for(int i = 0; i < output.GetNumberOfPoints(); i++) {\n            double val = elevation.GetValue(i);\n            Debug.WriteLine(\"val: \" + val);\n\n            double[] dcolor = colorLookupTable.GetColor(val);\n            //Debug.WriteLine(\"dcolor: \"\n            //          + dcolor[0] + \" \"\n            //          + dcolor[1] + \" \"\n            //          + dcolor[2]);\n            byte[] color = new byte[3];\n            for(int j = 0; j < 3; j++) {\n               color[j] = (byte)( 255 * dcolor[j]);\n            }\n            //Debug.WriteLine(\"color: \"\n            //          + color[0] + \" \"\n            //          + color[1] + \" \"\n            //          + color[2]);\n\n            colors.InsertNextTuple3(color[0], color[1], color[2]);\n         }\n\n         output.GetPointData().AddArray(colors);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInputConnection(output.GetProducerPort());\n#else\n         mapper.SetInputData(output);\n#endif\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/ExtractEdges/","title":"ExtractEdges","text":"

vtk-examples/CSharp/Meshes/ExtractEdges

"},{"location":"CSharp/Meshes/ExtractEdges/#description","title":"Description","text":"

This example shows how to extract the edges from a PolyData. In this case, we convert a sphere into a wireframe sphere. We demonstrate how to traverse the resulting edges.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/ExtractEdges/#code","title":"Code","text":"

ExtractEdges.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ExtractEdges();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ExtractEdges() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         Debug.WriteLine(\"Sphere\" + Environment.NewLine + \"----------\");\n         Debug.WriteLine(\"There are \" + sphereSource.GetOutput().GetNumberOfCells() + \" cells.\");\n         Debug.WriteLine(\"There are \" + sphereSource.GetOutput().GetNumberOfPoints() + \" points.\");\n\n         vtkExtractEdges extractEdges = vtkExtractEdges.New();\n#if VTK_MAJOR_VERSION_5\n         extractEdges.SetInputConnection(sphereSource.GetOutputPort());\n#else\n         extractEdges.SetInputData(sphereSource);\n#endif\n         extractEdges.Update();\n\n         vtkCellArray lines = extractEdges.GetOutput().GetLines();\n         vtkPoints points = extractEdges.GetOutput().GetPoints();\n\n         Debug.WriteLine(Environment.NewLine + \"Edges\" + Environment.NewLine + \"----------\" );\n         Debug.WriteLine(\"There are \" + lines.GetNumberOfCells() + \" cells.\" );\n         Debug.WriteLine(\"There are \" + points.GetNumberOfPoints() + \" points.\" );\n\n         // Traverse all of the edges\n         for(int i = 0; i < extractEdges.GetOutput().GetNumberOfCells(); i++) {\n            //Debug.WriteLine(\"Type: \" + extractEdges.GetOutput().GetCell(i).GetClassName() );\n            vtkLine line = vtkLine.SafeDownCast(extractEdges.GetOutput().GetCell(i));\n            Debug.WriteLine(\"Line \" + i + \" : \" + line );\n         }\n\n         // Visualize the edges\n\n         // Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInputConnection(extractEdges.GetOutputPort());\n#else\n         mapper.SetInputData(extractEdges);\n#endif\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(1, 1, 1);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/FillHoles/","title":"FillHoles","text":"

vtk-examples/CSharp/Meshes/FillHoles

"},{"location":"CSharp/Meshes/FillHoles/#description","title":"Description","text":"

This filter finds holes in a mesh and closes them.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/FillHoles/#code","title":"Code","text":"

FillHoles.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            FillHoles(null);\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void FillHoles(string filePath) {\n         vtkPolyData input = vtkPolyData.New();\n         if(filePath == null) {\n            GenerateData(ref input);\n         }\n         else {\n         vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         input.ShallowCopy(reader.GetOutput());\n         }\n\n         vtkFillHolesFilter fillHolesFilter = vtkFillHolesFilter.New();\n#if VTK_MAJOR_VERSION_5\n         fillHolesFilter.SetInputConnection(input.GetProducerPort());\n#else\n         fillHolesFilter.SetInputData(input);\n#endif\n\n         fillHolesFilter.Update();\n\n         // Create a mapper and actor\n         vtkPolyDataMapper originalMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         originalMapper.SetInputConnection(input.GetProducerPort());\n#else\n         originalMapper.SetInputData(input);\n#endif\n\n         vtkActor originalActor = vtkActor.New();\n         originalActor.SetMapper(originalMapper);\n\n         vtkPolyDataMapper filledMapper = vtkPolyDataMapper.New();\n         filledMapper.SetInputConnection(fillHolesFilter.GetOutputPort());\n\n         vtkActor filledActor = vtkActor.New();\n         filledActor.SetMapper(filledMapper);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(originalActor);\n         rightRenderer.AddActor(filledActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n\n\n      void GenerateData(ref vtkPolyData input)\n      {\n        // Create a sphere\n        vtkSphereSource sphereSource = vtkSphereSource.New();\n        sphereSource.Update();\n\n        // Remove some cells\n        vtkIdTypeArray ids = vtkIdTypeArray.New();\n        ids.SetNumberOfComponents(1);\n\n        // Set values\n        ids.InsertNextValue(2);\n        ids.InsertNextValue(10);\n\n        vtkSelectionNode selectionNode = vtkSelectionNode.New();\n\n        selectionNode.SetFieldType((int)vtkSelectionNode.SelectionField.CELL);\n        selectionNode.SetContentType((int)vtkSelectionNode.SelectionContent.INDICES);\n        selectionNode.SetSelectionList(ids);\n        selectionNode.GetProperties().Set(vtkSelectionNode.INVERSE(), 1); //invert the selection\n\n        vtkSelection selection = vtkSelection.New();\n        selection.AddNode(selectionNode);\n\n        vtkExtractSelection extractSelection = vtkExtractSelection.New();\n        extractSelection.SetInputConnection(0, sphereSource.GetOutputPort());\n#if VTK_MAJOR_VERSION_5\n        extractSelection.SetInput(1, selection);\n#else\n        extractSelection.SetInputData(1, selection);\n#endif\n        extractSelection.Update();\n\n        // In selection\n        vtkDataSetSurfaceFilter surfaceFilter = vtkDataSetSurfaceFilter.New();\n        surfaceFilter.SetInputConnection(extractSelection.GetOutputPort());\n        surfaceFilter.Update();\n\n        input.ShallowCopy(surfaceFilter.GetOutput());\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/MatrixMathFilter/","title":"MatrixMathFilter","text":"

vtk-examples/CSharp/Meshes/MatrixMathFilter

"},{"location":"CSharp/Meshes/MatrixMathFilter/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/MatrixMathFilter/#code","title":"Code","text":"

MatrixMathFilter.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            MatrixMathFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void MatrixMathFilter() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\tensors.vtk\");\n         vtkUnstructuredGridReader reader = vtkUnstructuredGridReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         vtkDataSetSurfaceFilter surfaceFilter = vtkDataSetSurfaceFilter.New();\n         surfaceFilter.SetInputConnection(reader.GetOutputPort());\n         surfaceFilter.Update();\n\n         vtkMatrixMathFilter matrixMathFilter = vtkMatrixMathFilter.New();\n         //matrixMathFilter.SetOperationToDeterminant();\n         matrixMathFilter.SetOperationToEigenvalue();\n         matrixMathFilter.SetInputConnection(surfaceFilter.GetOutputPort());\n         matrixMathFilter.Update();\n         matrixMathFilter.GetOutput().GetPointData().SetActiveScalars(\"Eigenvalue\");\n\n         vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n         writer.SetInputConnection(matrixMathFilter.GetOutputPort());\n         writer.SetFileName(System.IO.Path.Combine(root, @\"Data\\output.vtp\"));\n         writer.Write();\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(matrixMathFilter.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/OBBDicer/","title":"OBBDicer","text":"

vtk-examples/CSharp/Meshes/OBBDicer

"},{"location":"CSharp/Meshes/OBBDicer/#description","title":"Description","text":"

The [vtkOBBDicer](https://www.vtk.org/doc/nightly/html/classvtkOBBDicer.html#details) filter breaks up an input mesh into a number of pieces. The resulting mesh contains scalar point data that can be used to extract the individual pieces with a filter like vtkThresholdFilter. This examples displays the output of [vtkOBBDicer](https://www.vtk.org/doc/nightly/html/classvtkOBBDicer.html#details) with a different color for each piece.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/OBBDicer/#code","title":"Code","text":"

OBBDicer.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            OBBDicer(null);\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void OBBDicer(string filePath) {\n         vtkPolyData inputPolyData;\n         if(filePath != null) {\n            vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n            reader.SetFileName(filePath);\n            reader.Update();\n            inputPolyData = reader.GetOutput();\n         }\n         else {\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.SetThetaResolution(30);\n            sphereSource.SetPhiResolution(15);\n            sphereSource.Update();\n            inputPolyData = sphereSource.GetOutput();\n         }\n\n         // Create pipeline\n         vtkOBBDicer dicer = vtkOBBDicer.New();\n#if VTK_MAJOR_VERSION_5\n         dicer.SetInput(inputPolyData);\n#else\n         dicer.SetInputData(inputPolyData);\n#endif\n         dicer.SetNumberOfPieces(4);\n         dicer.SetDiceModeToSpecifiedNumberOfPieces();\n         dicer.Update();\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n         inputMapper.SetInputConnection(dicer.GetOutputPort());\n         inputMapper.SetScalarRange(0, dicer.GetNumberOfActualPieces());\n\n         Debug.WriteLine(\"Asked for: \"\n                   + dicer.GetNumberOfPieces() + \" pieces, got: \"\n                   + dicer.GetNumberOfActualPieces());\n\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n         inputActor.GetProperty().SetInterpolationToFlat();\n\n         vtkOutlineCornerFilter outline = vtkOutlineCornerFilter.New();\n#if VTK_MAJOR_VERSION_5\n         outline.SetInput(inputPolyData);\n#else\n         outline.SetInputData(inputPolyData);\n#endif\n\n         vtkPolyDataMapper outlineMapper = vtkPolyDataMapper.New();\n         outlineMapper.SetInputConnection(outline.GetOutputPort());\n\n         vtkActor outlineActor = vtkActor.New();\n         outlineActor.SetMapper(outlineMapper);\n         outlineActor.GetProperty().SetColor(0, 0, 0);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(inputActor);\n         renderer.AddActor(outlineActor);\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/QuadricClustering/","title":"QuadricClustering","text":"

vtk-examples/CSharp/Meshes/QuadricClustering

"},{"location":"CSharp/Meshes/QuadricClustering/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/QuadricClustering/#code","title":"Code","text":"

QuadricClustering.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            QuadricClustering();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void QuadricClustering() { \n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkPolyData input = vtkPolyData.New();\n         input.ShallowCopy(sphereSource.GetOutput());\n\n         Debug.WriteLine(\"Before decimation\" + Environment.NewLine + \"------------\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkQuadricClustering decimate = vtkQuadricClustering.New();\n#if VTK_MAJOR_VERSION_5\n         decimate.SetInputConnection(input.GetProducerPort());\n#else\n         decimate.SetInputData(input);\n#endif\n         decimate.Update();\n\n         vtkPolyData decimated = vtkPolyData.New();\n         decimated.ShallowCopy(decimate.GetOutput());\n\n         Debug.WriteLine(\"After decimation\" + Environment.NewLine + \"------------\" );\n\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInputConnection(input.GetProducerPort());\n#else\n         inputMapper.SetInputData(input);\n#endif\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n\n         vtkPolyDataMapper decimatedMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         decimatedMapper.SetInputConnection(decimated.GetProducerPort());\n#else\n         decimatedMapper.SetInputData(decimated);\n#endif\n         vtkActor decimatedActor = vtkActor.New();\n         decimatedActor.SetMapper(decimatedMapper);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(inputActor);\n         rightRenderer.AddActor(decimatedActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/QuadricDecimation/","title":"QuadricDecimation","text":"

vtk-examples/CSharp/Meshes/QuadricDecimation

"},{"location":"CSharp/Meshes/QuadricDecimation/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/QuadricDecimation/#code","title":"Code","text":"

QuadricDecimation.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            QuadricDecimation();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void QuadricDecimation() { \n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkPolyData input = vtkPolyData.New();\n         input.ShallowCopy(sphereSource.GetOutput());\n\n         Debug.WriteLine(\"Before decimation\" + Environment.NewLine + \"------------\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkQuadricDecimation decimate = vtkQuadricDecimation.New();\n#if VTK_MAJOR_VERSION_5\n         decimate.SetInputConnection(input.GetProducerPort());\n#else\n         decimate.SetInputData(input);\n#endif\n         decimate.Update();\n\n         vtkPolyData decimated = vtkPolyData.New();\n         decimated.ShallowCopy(decimate.GetOutput());\n\n         Debug.WriteLine(\"After decimation\" + Environment.NewLine + \"------------\" );\n\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInputConnection(input.GetProducerPort());\n#else\n         inputMapper.SetInputData(input);\n#endif\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n\n         vtkPolyDataMapper decimatedMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         decimatedMapper.SetInputConnection(decimated.GetProducerPort());\n#else\n         decimatedMapper.SetInputData(decimated);\n#endif\n         vtkActor decimatedActor = vtkActor.New();\n         decimatedActor.SetMapper(decimatedMapper);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(inputActor);\n         rightRenderer.AddActor(decimatedActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/SimpleElevationFilter/","title":"SimpleElevationFilter","text":"

vtk-examples/CSharp/Meshes/SimpleElevationFilter

"},{"location":"CSharp/Meshes/SimpleElevationFilter/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/SimpleElevationFilter/#code","title":"Code","text":"

SimpleElevationFilter.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            SimpleElevationFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void SimpleElevationFilter() {\n         // Created a grid of points (heigh/terrian map)\n         vtkPoints points = vtkPoints.New();\n\n         uint GridSize = 10;\n         for(uint x = 0; x < GridSize; x++) {\n            for(uint y = 0; y < GridSize; y++) {\n               points.InsertNextPoint(x, y, ( x + y ) / ( y + 1 ));\n            }\n         }\n         double[] bounds = points.GetBounds();\n\n         // Add the grid points to a polydata object\n         vtkPolyData inputPolyData = vtkPolyData.New();\n         inputPolyData.SetPoints(points);\n\n         // Triangulate the grid points\n         vtkDelaunay2D delaunay = vtkDelaunay2D.New();\n#if VTK_MAJOR_VERSION_5\n         delaunay.SetInput(inputPolyData);\n#else\n         delaunay.SetInputData(inputPolyData);\n#endif\n         delaunay.Update();\n\n         vtkSimpleElevationFilter elevationFilter = vtkSimpleElevationFilter.New();\n         elevationFilter.SetInputConnection(delaunay.GetOutputPort());\n         elevationFilter.SetVector(0.0, 0.0, 1.0);\n         elevationFilter.Update();\n\n         vtkPolyData output = vtkPolyData.New();\n         output.ShallowCopy(vtkPolyData.SafeDownCast(elevationFilter.GetOutput()));\n\n         vtkFloatArray elevation = \n            vtkFloatArray.SafeDownCast(output.GetPointData().GetArray(\"Elevation\"));\n\n         // Create the color map\n         vtkLookupTable colorLookupTable = vtkLookupTable.New();\n         colorLookupTable.SetTableRange(bounds[4], bounds[5]);\n         colorLookupTable.Build();\n\n         // Generate the colors for each point based on the color map\n         vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();\n         colors.SetNumberOfComponents(3);\n         colors.SetName(\"Colors\");\n\n         for(int i = 0; i < output.GetNumberOfPoints(); i++) {\n            double val = elevation.GetValue(i);\n            Debug.WriteLine(\"val: \" + val);\n\n            double[] dcolor = colorLookupTable.GetColor(val);\n            //Debug.WriteLine(\"dcolor: \"\n            //          + dcolor[0] + \" \"\n            //          + dcolor[1] + \" \"\n            //          + dcolor[2]);\n            byte[] color = new byte[3];\n            for(int j = 0; j < 3; j++) {\n               color[j] = (byte)( 255 * dcolor[j] );\n            }\n            //Debug.WriteLine(\"color: \"\n            //          + color[0] + \" \"\n            //          + color[1] + \" \"\n            //          + color[2]);\n\n            colors.InsertNextTuple3(color[0], color[1], color[2]);\n         }\n\n         output.GetPointData().AddArray(colors);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInputConnection(output.GetProducerPort());\n#else\n         mapper.SetInputData(output);\n#endif\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/SolidClip/","title":"SolidClip","text":"

vtk-examples/CSharp/Meshes/SolidClip

"},{"location":"CSharp/Meshes/SolidClip/#description","title":"Description","text":"

This example clips a mesh and applies a backface property to that mesh that appears to have a solid interior.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/SolidClip/#code","title":"Code","text":"

SolidClip.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            SolidClip();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void SolidClip() {\n         // Create a superquadric\n         vtkSuperquadricSource superquadricSource = vtkSuperquadricSource.New();\n         superquadricSource.SetPhiRoundness(3.1);\n         superquadricSource.SetThetaRoundness(2.2);\n\n         // Define a clipping plane\n         vtkPlane clipPlane = vtkPlane.New();\n         clipPlane.SetNormal(1.0, -1.0, -1.0);\n         clipPlane.SetOrigin(0.0, 0.0, 0.0);\n\n         // Clip the source with the plane\n         vtkClipPolyData clipper = vtkClipPolyData.New();\n#if VTK_MAJOR_VERSION_5\n         clipper.SetInputConnection(superquadricSource.GetOutputPort());\n#else\n         clipper.SetInputData(superquadricSource);\n#endif\n         clipper.SetClipFunction(clipPlane);\n\n         //Create a mapper and actor\n         vtkPolyDataMapper superquadricMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         superquadricMapper.SetInputConnection(clipper.GetOutputPort());\n#else\n         superquadricMapper.SetInputData(clipper);\n#endif\n         vtkActor superquadricActor = vtkActor.New();\n         superquadricActor.SetMapper(superquadricMapper);\n\n         // Create a property to be used for the back faces. Turn off all\n         // shading by specifying 0 weights for specular and diffuse. Max the\n         // ambient.\n         vtkProperty backFaces = vtkProperty.New();\n         backFaces.SetSpecular(0.0);\n         backFaces.SetDiffuse(0.0);\n         backFaces.SetAmbient(1.0);\n         backFaces.SetAmbientColor(1.0000, 0.3882, 0.2784);\n\n         superquadricActor.SetBackfaceProperty(backFaces);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // add our actor to the renderer\n         renderer.AddActor(superquadricActor);\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/Subdivision/","title":"Subdivision","text":"

vtk-examples/CSharp/Meshes/Subdivision

"},{"location":"CSharp/Meshes/Subdivision/#description","title":"Description","text":"

In this example a mesh is read from a file and then subdivided using linear subdivision. The SetNumberOfSubdivisions(n) function controls how many times the mesh is subdivided. For each n, the number of triangles will increase by approximately a factor of 4. For example, if n=2, the number of triangles in the resulting mesh will be 16x the number of triangles in the original mesh. Different types of subdivisions can be obtained by replacing [vtkLinearSubdivisionFilter](https://www.vtk.org/doc/nightly/html/classvtkLinearSubdivisionFilter.html#details) with either [vtkLoopSubdivisionFilter](https://www.vtk.org/doc/nightly/html/classvtkLoopSubdivisionFilter.html#details) or [vtkButterflySubdivisionFilter](https://www.vtk.org/doc/nightly/html/classvtkButterflySubdivisionFilter.html#details).

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/Subdivision/#code","title":"Code","text":"

Subdivision.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Subdivision(null); // you may provide a full path to a *.vtu file\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Subdivision(string filePath) {\n         vtkPolyData originalMesh;\n         if(filePath != null) {\n            vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n            reader.SetFileName(filePath);\n            // Subdivision filters only work on triangles\n            vtkTriangleFilter triangles = vtkTriangleFilter.New();\n            triangles.SetInputConnection(reader.GetOutputPort());\n            triangles.Update();\n            originalMesh = triangles.GetOutput();\n         }\n         else {\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.Update();\n            originalMesh = sphereSource.GetOutput();\n         }\n         Debug.WriteLine(\"Before subdivision\");\n         Debug.WriteLine(\"    There are \" + originalMesh.GetNumberOfPoints()\n            + \" points.\");\n         Debug.WriteLine(\"    There are \" + originalMesh.GetNumberOfPolys()\n            + \" triangles.\");\n\n         int numberOfViewports = 3;\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(200 * numberOfViewports + 12, 252);\n         this.Text += \" - Subdivision\";\n         Random rnd = new Random(2);\n         int numberOfSubdivisions = 2;\n\n         // Create one text property for all\n         vtkTextProperty textProperty = vtkTextProperty.New();\n         textProperty.SetFontSize(14);\n         textProperty.SetJustificationToCentered();\n\n         for(int i = 0; i < numberOfViewports; i++) {\n            // Note: Here we create a superclass pointer (vtkPolyDataAlgorithm) so that we can easily instantiate different\n            // types of subdivision filters. Typically you would not want to do this, but rather create the pointer to be the type\n            // filter you will actually use, e.g. \n            // <vtkLinearSubdivisionFilter>  subdivisionFilter = <vtkLinearSubdivisionFilter>.New();\n            vtkPolyDataAlgorithm subdivisionFilter;\n            switch(i) {\n               case 0:\n                  subdivisionFilter = vtkLinearSubdivisionFilter.New();\n                  ( (vtkLinearSubdivisionFilter)subdivisionFilter ).SetNumberOfSubdivisions(numberOfSubdivisions);\n                  break;\n               case 1:\n                  subdivisionFilter = vtkLoopSubdivisionFilter.New();\n                  ( (vtkLoopSubdivisionFilter)subdivisionFilter ).SetNumberOfSubdivisions(numberOfSubdivisions);\n                  break;\n               case 2:\n                  subdivisionFilter = vtkButterflySubdivisionFilter.New();\n                  ( (vtkButterflySubdivisionFilter)subdivisionFilter ).SetNumberOfSubdivisions(numberOfSubdivisions);\n                  break;\n               default:\n                  subdivisionFilter = vtkLinearSubdivisionFilter.New();\n                  ( (vtkLinearSubdivisionFilter)subdivisionFilter ).SetNumberOfSubdivisions(numberOfSubdivisions);\n                  break;\n            }\n#if VTK_MAJOR_VERSION_5\n            subdivisionFilter.SetInputConnection(originalMesh.GetProducerPort());\n#else\n            subdivisionFilter.SetInputData(originalMesh);\n#endif\n            subdivisionFilter.Update();\n            vtkRenderer renderer = vtkRenderer.New();\n            renderWindow.AddRenderer(renderer);\n            renderer.SetViewport((float)i / numberOfViewports, 0, (float)( i + 1 ) / numberOfViewports, 1);\n            renderer.SetBackground(.2 + rnd.NextDouble() / 8, .3 + rnd.NextDouble() / 8, .4 + rnd.NextDouble() / 8);\n\n            vtkTextMapper textMapper = vtkTextMapper.New();\n            vtkActor2D textActor = vtkActor2D.New();\n            textMapper.SetInput(subdivisionFilter.GetClassName());\n            textMapper.SetTextProperty(textProperty);\n\n            textActor.SetMapper(textMapper);\n            textActor.SetPosition(100, 16);\n\n            //Create a mapper and actor\n            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n            mapper.SetInputConnection(subdivisionFilter.GetOutputPort());\n            vtkActor actor = vtkActor.New();\n            actor.SetMapper(mapper);\n            renderer.AddActor(actor);\n            renderer.AddActor(textActor);\n            renderer.ResetCamera();\n         }\n         renderWindow.Render();\n      }\n   }\n}\n

"},{"location":"CSharp/Meshes/Triangulate/","title":"Triangulate","text":"

vtk-examples/CSharp/Meshes/Triangulate

"},{"location":"CSharp/Meshes/Triangulate/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/Triangulate/#code","title":"Code","text":"

Triangulate.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Triangulate();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Triangulate() {\n         vtkRegularPolygonSource polygonSource = vtkRegularPolygonSource.New();\n         polygonSource.Update();\n\n         vtkTriangleFilter triangleFilter = vtkTriangleFilter.New();\n#if VTK_MAJOR_VERSION_5\n         triangleFilter.SetInputConnection(polygonSource.GetOutputPort());\n#else\n         triangleFilter.SetInputData(polygonSource);\n#endif\n         triangleFilter.Update();\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInputConnection(polygonSource.GetOutputPort());\n#else\n         inputMapper.SetInputData(polygonSource);\n#endif\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n         inputActor.GetProperty().SetRepresentationToWireframe();\n\n         vtkPolyDataMapper triangleMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         triangleMapper.SetInputConnection(triangleFilter.GetOutputPort());\n#else\n         triangleMapper.SetInputData(triangleFilter);\n#endif\n         vtkActor triangleActor = vtkActor.New();\n         triangleActor.SetMapper(triangleMapper);\n         triangleActor.GetProperty().SetRepresentationToWireframe();\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(inputActor);\n         rightRenderer.AddActor(triangleActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n   }\n}\n
"},{"location":"CSharp/Meshes/WindowedSincPolyDataFilter/","title":"WindowedSincPolyDataFilter","text":"

vtk-examples/CSharp/Meshes/WindowedSincPolyDataFilter

"},{"location":"CSharp/Meshes/WindowedSincPolyDataFilter/#description","title":"Description","text":"

This example demonstrates how to smooth a mesh.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Meshes/WindowedSincPolyDataFilter/#code","title":"Code","text":"

WindowedSincPolyDataFilter.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WindowedSincPolyDataFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WindowedSincPolyDataFilter() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkWindowedSincPolyDataFilter smoother = vtkWindowedSincPolyDataFilter.New();\n         smoother.SetInputConnection(sphereSource.GetOutputPort());\n         smoother.SetNumberOfIterations(15);\n         smoother.BoundarySmoothingOff();\n         smoother.FeatureEdgeSmoothingOff();\n         smoother.SetFeatureAngle(120.0);\n         smoother.SetPassBand(.001);\n         smoother.NonManifoldSmoothingOn();\n         smoother.NormalizeCoordinatesOn();\n         smoother.Update();\n\n         vtkPolyDataMapper smoothedMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         smoothedMapper.SetInputConnection(smoother.GetOutputPort());\n#else\n         smoothedMapper.SetInputData(smoother);\n#endif\n         vtkActor smoothedActor = vtkActor.New();\n         smoothedActor.SetMapper(smoothedMapper);\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInputConnection(sphereSource.GetOutputPort());\n#else\n         inputMapper.SetInputData(sphereSource);\n#endif\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(inputActor);\n         rightRenderer.AddActor(smoothedActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n   }\n}\n
"},{"location":"CSharp/Modelling/ExtractLargestIsosurface/","title":"ExtractLargestIsosurface","text":"

vtk-examples/CSharp/Modelling/ExtractLargestIsosurface

"},{"location":"CSharp/Modelling/ExtractLargestIsosurface/#description","title":"Description","text":"
  • Contributed by: Jinyoung Hwang

This example reads a structured points dataset stored in a .vtk file and constructs a 3D model using vtkMarchingCubes. vtkPolyDataConnectivityFilter is used to extract the largest isosurface.

Data is available at:

  1. test.vtk: http://web.kaist.ac.kr/~hjy/test.vtk

  2. brainweb.img: http://web.kaist.ac.kr/~hjy/brainweb.img

  3. brainweb.hdr: http://web.kaist.ac.kr/~hjy/brainweb.hdr

Second and third datasets can be downloaded from BrainWeb, which is free of charge in use for a research. \"test.vtk\" was converted from \"brainweb.img\" using a program by Erik Vidholm (http://www.cb.uu.se/~erik/vtk/rawToVTK.cpp).

The examples expects 2 or 3 argments:

 ExtractLargestIsosurface InputFilename Threshold ExtractLargest\n  if ExtractLargest is omitted or 1, the largest isosurface is extracted\n  if ExtractLargest is 0, all of the isosurfaces are extracted\n

Try

ExtractLargestIsosurface test.vtk 50 1\n

and compare the results to

 ExtractLargestIsosurface test.vtk 50 0\n

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Modelling/ExtractLargestIsosurface/#code","title":"Code","text":"

ExtractLargestIsosurface.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            // don't forget to adapt the file path\n            ExtractLargestIsoSurface(\"test.vtk\", 50, true);\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ExtractLargestIsoSurface(string filePath, double threshold, bool extractLargest) { \n         // Load data\n         vtkStructuredPointsReader reader = vtkStructuredPointsReader.New();\n         reader.SetFileName(filePath);\n\n         // Create a 3D model using marching cubes\n         vtkMarchingCubes mc = vtkMarchingCubes.New();\n         mc.SetInputConnection(reader.GetOutputPort());\n         mc.ComputeNormalsOn();\n         mc.ComputeGradientsOn();\n         mc.SetValue(0, threshold);  // second value acts as threshold\n\n         // To remain largest region\n         vtkPolyDataConnectivityFilter confilter = vtkPolyDataConnectivityFilter.New();\n         confilter.SetInputConnection(mc.GetOutputPort());\n         confilter.SetExtractionModeToLargestRegion();\n\n         // Create a mapper\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         if(extractLargest) {\n            mapper.SetInputConnection(confilter.GetOutputPort());\n         }\n         else {\n            mapper.SetInputConnection(mc.GetOutputPort());\n         }\n\n         mapper.ScalarVisibilityOff();    // utilize actor's property I set\n\n         // Visualize\n         vtkActor actor = vtkActor.New();\n         actor.GetProperty().SetColor(1, 1, 1);\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/Modelling/MarchingCubes/","title":"MarchingCubes","text":"

vtk-examples/CSharp/Modelling/MarchingCubes

"},{"location":"CSharp/Modelling/MarchingCubes/#description","title":"Description","text":"

Voxelizes a sphere and creates a model with Marching Cubes. '''NOTE:''' [vtkVoxelModeller](https://www.vtk.org/doc/nightly/html/classvtkVoxelModeller.html#details) by default produces a VTK_BIT scalar image. Marching Cubes does not support this type. The scalar output is set to float for this example.

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Modelling/MarchingCubes/#code","title":"Code","text":"

MarchingCubes.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            MarchingCubes();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void MarchingCubes() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.SetPhiResolution(20);\n         sphereSource.SetThetaResolution(20);\n         sphereSource.Update();\n\n         double[] bounds = sphereSource.GetOutput().GetBounds();\n         for(int i = 0; i < 6; i += 2) {\n            double range = bounds[i + 1] - bounds[i];\n            bounds[i] = bounds[i] - .1 * range;\n            bounds[i + 1] = bounds[i + 1] + .1 * range;\n         }\n         vtkVoxelModeller voxelModeller = vtkVoxelModeller.New();\n         voxelModeller.SetSampleDimensions(50, 50, 50);\n         voxelModeller.SetModelBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);\n         voxelModeller.SetScalarTypeToFloat();\n         voxelModeller.SetMaximumDistance(.1);\n\n#if VTK_MAJOR_VERSION_5\n         voxelModeller.SetInputConnection(sphereSource.GetOutputPort());\n#else\n         voxelModeller.SetInputData(sphereSource);\n#endif\n         vtkMarchingCubes surface = vtkMarchingCubes.New();\n\n#if VTK_MAJOR_VERSION_5\n         surface.SetInputConnection(voxelModeller.GetOutputPort());\n#else\n         surface.SetInputData(voxelModeller);\n#endif\n         surface.ComputeNormalsOn();\n         surface.SetValue(0, 0.5);\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInputConnection(surface.GetOutputPort());\n#else\n         mapper.SetInputData(surface);\n#endif\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/Modelling/MarchingSquares/","title":"MarchingSquares","text":"

vtk-examples/CSharp/Modelling/MarchingSquares

"},{"location":"CSharp/Modelling/MarchingSquares/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/Modelling/MarchingSquares/#code","title":"Code","text":"

MarchingSquares.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            MarchingSquares();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void MarchingSquares() { \n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n\n         vtkVolume16Reader v16 = vtkVolume16Reader.New();\n         v16.SetDataDimensions(64, 64); \n\n         v16.GetOutput().SetOrigin(0.0, 0.0, 0.0);\n         v16.SetDataByteOrderToLittleEndian();\n         v16.SetFilePrefix(System.IO.Path.Combine(root, @\"Data\\headsq\\quarter\"));\n         v16.SetImageRange(1, 93);\n         v16.SetDataSpacing(3.2, 3.2, 1.5);\n         v16.Update();\n\n         vtkMergePoints myLocator = vtkMergePoints.New();\n\n         vtkMarchingSquares isoXY = vtkMarchingSquares.New();\n\n#if VTK_MAJOR_VERSION_5\n         isoXY.SetInputConnection(v16.GetOutputPort());\n#else\n         isoXY.SetInputData(v16);\n#endif\n         isoXY.GenerateValues(2, 600, 1200);\n         isoXY.SetImageRange(0, 32, 32, 63, 45, 45);\n         isoXY.SetLocator(myLocator);\n\n         vtkPolyDataMapper isoXYMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         isoXYMapper.SetInputConnection(isoXY.GetOutputPort());\n#else\n         isoXYMapper.SetInputData(isoXY);\n#endif\n         isoXYMapper.SetScalarRange(600, 1200);\n\n         vtkActor isoXYActor = vtkActor.New();\n         isoXYActor.SetMapper(isoXYMapper);\n\n         vtkMarchingSquares isoYZ = vtkMarchingSquares.New();\n#if VTK_MAJOR_VERSION_5\n         isoYZ.SetInputConnection(v16.GetOutputPort());\n#else\n         isoYZ.SetInputData(v16);\n#endif\n         isoYZ.GenerateValues(2, 600, 1200);\n         isoYZ.SetImageRange(32, 32, 32, 63, 46, 92);\n\n         vtkPolyDataMapper isoYZMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         isoYZMapper.SetInputConnection(isoYZ.GetOutputPort());\n#else\n         isoYZMapper.SetInputData(isoYZ);\n#endif\n         isoYZMapper.SetScalarRange(600, 1200);\n\n         vtkActor isoYZActor = vtkActor.New();\n         isoYZActor.SetMapper(isoYZMapper);\n\n         vtkMarchingSquares isoXZ  = vtkMarchingSquares.New();\n#if VTK_MAJOR_VERSION_5\n         isoXZ.SetInputConnection(v16.GetOutputPort());\n#else\n         isoXZ.SetInputData(v16);\n#endif\n         isoXZ.GenerateValues(2, 600, 1200);\n         isoXZ.SetImageRange(0, 32, 32, 32, 0, 46);\n\n         vtkPolyDataMapper isoXZMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         isoXZMapper.SetInputConnection(isoXZ.GetOutputPort());\n#else\n         isoXZMapper.SetInputData(isoXZ);\n#endif\n         isoXZMapper.SetScalarRange(600, 1200);\n\n         vtkActor isoXZActor = vtkActor.New();\n         isoXZActor.SetMapper(isoXZMapper);\n\n         vtkOutlineFilter outline  = vtkOutlineFilter.New();\n#if VTK_MAJOR_VERSION_5\n         outline.SetInputConnection(v16.GetOutputPort());\n#else\n         outline.SetInputData(v16);\n#endif\n         vtkPolyDataMapper outlineMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         outlineMapper.SetInputConnection(outline.GetOutputPort());\n#else\n         outlineMapper.SetInputData(outline);\n#endif\n         vtkActor outlineActor = vtkActor.New();\n         outlineActor.SetMapper(outlineMapper);\n         outlineActor.VisibilityOff();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(1.0, 1.0, 1.0);\n         //Add the actors to the renderer, set the background and size \n         renderer.AddActor(outlineActor);\n         renderer.AddActor(isoXYActor);\n         renderer.AddActor(isoYZActor);\n         renderer.AddActor(isoXZActor);\n         renderer.GetActiveCamera().SetPosition(324.368, 284.266, -19.3293);\n         renderer.GetActiveCamera().SetFocalPoint(73.5683, 120.903, 70.7309);\n         renderer.GetActiveCamera().SetViewAngle(30);\n         renderer.GetActiveCamera().SetViewUp(-0.304692, -0.0563843, -0.950781);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/AlignFrames/","title":"AlignFrames","text":"

vtk-examples/CSharp/PolyData/AlignFrames

"},{"location":"CSharp/PolyData/AlignFrames/#description","title":"Description","text":"

This function takes two frames and finds the matrix M between them.

A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/AlignFrames/#code","title":"Code","text":"

AlignFrames.cs

using System;\nusing System.Runtime.InteropServices;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n\n      struct Frame {\n         private float[] origin;\n         private float[] xDirection;\n         private float[] yDirection;\n         private float[] zDirection;\n\n         internal float[] Origin {\n            get { return origin; }\n         }\n\n         internal float[] XDirection {\n            get { return xDirection; }\n         }\n\n         internal float[] YDirection {\n            get { return yDirection; }\n         }\n\n         internal float[] ZDirection {\n            get { return zDirection; }\n         }\n\n         internal Frame(float[] origin, float[] xDirection, float[] yDirection, float[] zDirection) {\n            this.origin = new float[3];\n            this.xDirection = new float[3];\n            this.yDirection = new float[3];\n            this.zDirection = new float[3];\n            origin.CopyTo(this.origin, 0);\n            xDirection.CopyTo(this.xDirection, 0);\n            yDirection.CopyTo(this.yDirection, 0);\n            zDirection.CopyTo(this.zDirection, 0);\n\n            Normalize(ref xDirection);\n            Normalize(ref yDirection);\n            Normalize(ref zDirection);\n\n            Console.WriteLine(\"Origin: \" + \n               this.origin[0] + \" \" + \n               this.origin[1] + \" \" + \n               this.origin[2]);\n            Console.WriteLine(\"xDirection: \" + \n               this.xDirection[0] + \" \" + \n               this.xDirection[1] + \" \" + \n               this.xDirection[2]);\n            Console.WriteLine(\"yDirection: \" + \n               this.yDirection[0] + \" \" + \n               this.yDirection[1] + \" \" + \n               this.yDirection[2]);\n            Console.WriteLine(\"zDirection: \" + \n               this.zDirection[0] + \" \" + \n               this.zDirection[1] + \" \" + \n               this.zDirection[2]);\n         }\n\n\n         private void Normalize(ref float[] vector) {\n            IntPtr pDirection = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * 3);\n            Marshal.Copy(vector, 0, pDirection, 3);\n            vtkMath.Normalize(pDirection);\n            Marshal.FreeHGlobal(pDirection);\n         }\n\n\n         internal void ApplyTransform(ref vtkTransform transform, string filename) {\n            vtkPolyData polydata = vtkPolyData.New();\n            CreatePolydata(ref polydata);\n\n            vtkTransformFilter transformFilter = vtkTransformFilter.New();\n#if VTK_MAJOR_VERSION_5\n            transformFilter.SetInputConnection(polydata.GetProducerPort());\n#else\n            transformFilter.SetInputData(polydata);\n#endif\n            transformFilter.SetTransform(transform);\n            transformFilter.Update();\n\n            vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n            writer.SetFileName(filename);\n#if VTK_MAJOR_VERSION_5\n            writer.SetInputConnection(transformFilter.GetOutputPort());\n#else\n            writer.SetInputData(transformFilter);\n#endif\n            writer.Write();\n         }\n\n\n         internal void CreatePolydata(ref vtkPolyData polydata) {\n            vtkPoints points = vtkPoints.New();\n\n            points.InsertNextPoint(this.origin[0], this.origin[1], this.origin[2]);\n\n            float[] x = new float[3];\n            float[] y = new float[3];\n            float[] z = new float[3];\n\n            Add(this.origin, this.xDirection, ref x);\n            Add(this.origin, this.yDirection, ref y);\n            Add(this.origin, this.zDirection, ref z);\n\n            points.InsertNextPoint(x[0], x[1], x[2]);\n            points.InsertNextPoint(y[0], y[1], y[2]);\n            points.InsertNextPoint(z[0], z[1], z[2]);\n\n            polydata.SetPoints(points);\n\n            vtkVertexGlyphFilter vertexGlyphFilter = vtkVertexGlyphFilter.New();\n#if VTK_MAJOR_VERSION_5\n            vertexGlyphFilter.AddInput(polydata);\n#else\n            vertexGlyphFilter.AddInputData(polydata);\n#endif\n            vertexGlyphFilter.Update();\n            polydata.ShallowCopy(vertexGlyphFilter.GetOutput());\n         }\n\n\n         internal void Write(string filename) {\n            vtkPolyData polydata = vtkPolyData.New();\n            CreatePolydata(ref polydata);\n\n            vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n            writer.SetFileName(filename);\n#if VTK_MAJOR_VERSION_5\n            writer.SetInputConnection(polydata.GetProducerPort());\n#else\n            writer.SetInputData(polydata);\n#endif\n            writer.Write();\n         }\n      }\n\n\n      static void Main(string[] args) {\n         float[] frame1origin = new float[] { 0, 0, 0 };\n         float[] frame1XDirection = new float[] { 1, 0, 0 };\n         float[] frame1YDirection = new float[] { 0, 1, 0 };\n         Console.WriteLine(frame1YDirection[0] + \" \" + frame1YDirection[1] + \" \" + frame1YDirection[2]);\n         float[] frame1ZDirection = new float[] { 0, 0, 1 };\n         Frame frame1 = new Frame(frame1origin, frame1XDirection, frame1YDirection, frame1ZDirection);\n         Console.WriteLine(\"\\nWriting frame1.vtp...\");\n         // adjust path\n         frame1.Write(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\frame1.vtp\");\n\n         float[] frame2origin = new float[] { 0, 0, 0 };\n         float[] frame2XDirection = new float[] { .707f, .707f, 0 };\n         float[] frame2YDirection = new float[] { -.707f, .707f, 0 };\n         float[] frame2ZDirection = new float[] { 0, 0, 1 };\n         Frame frame2 = new Frame(frame2origin, frame2XDirection, frame2YDirection, frame2ZDirection);\n         Console.WriteLine(\"\\nWriting frame2.vtp...\");\n         // adjust path\n         frame2.Write(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\frame2.vtp\");\n\n         vtkTransform transform = vtkTransform.New();\n         AlignFrames(frame2, frame1, ref transform); // Brings frame2 to frame1\n\n         Console.WriteLine(\"\\nWriting transformed.vtp...\");\n         // adjust path\n         frame2.ApplyTransform(ref transform, @\"c:\\vtk\\vtkdata-5.8.0\\Data\\transformed.vtp\");\n\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      static void AlignFrames(Frame sourceFrame, Frame targetFrame, ref vtkTransform transform) {\n         // This function takes two frames and finds the matrix M between them.\n         vtkLandmarkTransform landmarkTransform = vtkLandmarkTransform.New();\n\n         // Setup source points\n         vtkPoints sourcePoints = vtkPoints.New();\n\n         sourcePoints.InsertNextPoint(\n            sourceFrame.Origin[0], \n            sourceFrame.Origin[1], \n            sourceFrame.Origin[2]);\n\n         float[] sourceX = new float[3];\n         float[] sourceY = new float[3];\n         float[] sourceZ = new float[3];\n\n         Add(sourceFrame.Origin, sourceFrame.XDirection, ref sourceX);\n         Add(sourceFrame.Origin, sourceFrame.YDirection, ref sourceY);\n         Add(sourceFrame.Origin, sourceFrame.ZDirection, ref sourceZ);\n\n         sourcePoints.InsertNextPoint(sourceX[0], sourceX[1], sourceX[2]);\n         sourcePoints.InsertNextPoint(sourceY[0], sourceY[1], sourceY[2]);\n         sourcePoints.InsertNextPoint(sourceZ[0], sourceZ[1], sourceZ[2]);\n\n         // Setup target points\n         vtkPoints targetPoints = vtkPoints.New();\n         targetPoints.InsertNextPoint(targetFrame.Origin[0], targetFrame.Origin[1], targetFrame.Origin[2]);\n\n         float[] targetX = new float[3];\n         float[] targetY = new float[3];\n         float[] targetZ = new float[3];\n\n         Add(targetFrame.Origin, targetFrame.XDirection, ref targetX);\n         Add(targetFrame.Origin, targetFrame.YDirection, ref targetY);\n         Add(targetFrame.Origin, targetFrame.ZDirection, ref targetZ);\n\n         targetPoints.InsertNextPoint(targetX[0], targetX[1], targetX[2]);\n         targetPoints.InsertNextPoint(targetY[0], targetY[1], targetY[2]);\n         targetPoints.InsertNextPoint(targetZ[0], targetZ[1], targetZ[2]);\n\n         landmarkTransform.SetSourceLandmarks(sourcePoints);\n         landmarkTransform.SetTargetLandmarks(targetPoints);\n         landmarkTransform.SetModeToRigidBody();\n         landmarkTransform.Update();\n\n         vtkMatrix4x4 M = landmarkTransform.GetMatrix();\n         transform.SetMatrix(M);\n      }\n\n      // helper function\n      static void Add(float[] vec1, float[] vec2, ref float[] vec) {\n         vec[0] = vec1[0] + vec2[0];\n         vec[1] = vec1[1] + vec2[1];\n         vec[2] = vec1[2] + vec2[2];\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/ClosedSurface/","title":"ClosedSurface","text":"

vtk-examples/CSharp/PolyData/ClosedSurface

"},{"location":"CSharp/PolyData/ClosedSurface/#description","title":"Description","text":"

A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/ClosedSurface/#code","title":"Code","text":"

ClosedSurface.cs

using System;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         ClosedSurface();\n      }\n\n\n      private static void ClosedSurface() {\n         // Create a sphere\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkFeatureEdges featureEdges = vtkFeatureEdges.New();\n         featureEdges.FeatureEdgesOff();\n         featureEdges.BoundaryEdgesOn();\n         featureEdges.NonManifoldEdgesOn();\n         featureEdges.SetInputConnection(sphereSource.GetOutputPort());\n         featureEdges.Update();\n\n         int numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfCells();\n\n         if(numberOfOpenEdges > 0) {\n            Console.WriteLine(\"Surface is not closed\");\n         }\n         else {\n            Console.WriteLine(\"Surface is closed\");\n         }\n         // nothing to show graphically\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/ColorDisconnectedRegions/","title":"ColorDisconnectedRegions","text":"

vtk-examples/CSharp/PolyData/ColorDisconnectedRegions

"},{"location":"CSharp/PolyData/ColorDisconnectedRegions/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/ColorDisconnectedRegions/#code","title":"Code","text":"

ColorDisconnectedRegions.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ColorDisconnectedRegions();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ColorDisconnectedRegions() {\n         // Create some spheres\n         vtkSphereSource sphereSource1 = vtkSphereSource.New();\n         sphereSource1.Update();\n\n         vtkSphereSource sphereSource2 = vtkSphereSource.New();\n         sphereSource2.SetCenter(5, 0, 0);\n         sphereSource2.Update();\n\n         vtkSphereSource sphereSource3 = vtkSphereSource.New();\n         sphereSource3.SetCenter(10, 0, 0);\n         sphereSource3.Update();\n\n         vtkAppendPolyData appendFilter = vtkAppendPolyData.New();\n         appendFilter.AddInputConnection(sphereSource1.GetOutputPort());\n         appendFilter.AddInputConnection(sphereSource2.GetOutputPort());\n         appendFilter.AddInputConnection(sphereSource3.GetOutputPort());\n\n         vtkPolyDataConnectivityFilter connectivityFilter = vtkPolyDataConnectivityFilter.New();\n         connectivityFilter.SetInputConnection(appendFilter.GetOutputPort());\n         connectivityFilter.SetExtractionModeToAllRegions();\n         connectivityFilter.ColorRegionsOn();\n         connectivityFilter.Update();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(connectivityFilter.GetOutputPort());\n         double[] range = connectivityFilter.GetOutput().GetPointData().GetArray(\"RegionId\").GetRange();\n         mapper.SetScalarRange(range[0], range[1] );\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.0, 0.0, 0.0);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/Curvature/","title":"Curvature","text":"

vtk-examples/CSharp/PolyData/Curvature

"},{"location":"CSharp/PolyData/Curvature/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/Curvature/#code","title":"Code","text":"

Curvature.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Curvature();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Curvature() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         // note: one should use a coarse surface mesh to achieve a good visual effect\n         string filePath = System.IO.Path.Combine(root, @\"Data\\bunny.vtp\");\n         // Create a polydata\n         vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n         reader.SetFileName(filePath);\n\n         vtkCurvatures curvaturesFilter = vtkCurvatures.New();\n         curvaturesFilter.SetInputConnection(reader.GetOutputPort());\n         //curvaturesFilter.SetCurvatureTypeToGaussian();\n         //curvaturesFilter.SetCurvatureTypeToMean();\n         //curvaturesFilter.SetCurvatureTypeToMaximum();\n         curvaturesFilter.SetCurvatureTypeToMinimum();\n\n         // To inspect more closely, if required\n         vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n         writer.SetInputConnection(curvaturesFilter.GetOutputPort());\n         writer.SetFileName(System.IO.Path.Combine(root, @\"Data\\gauss.vtp\"));\n         writer.Write();\n\n         // Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(curvaturesFilter.GetOutputPort());\n         double[] range = curvaturesFilter.GetOutput().GetScalarRange();\n         mapper.SetScalarRange(range[0], range[1]);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.0, 0.0, 0.0);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/DijkstraGraphGeodesicPath/","title":"DijkstraGraphGeodesicPath","text":"

vtk-examples/CSharp/PolyData/DijkstraGraphGeodesicPath

"},{"location":"CSharp/PolyData/DijkstraGraphGeodesicPath/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/DijkstraGraphGeodesicPath/#code","title":"Code","text":"

DijkstraGraphGeodesicPath.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            DijkstraGraphGeodesicPath();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void DijkstraGraphGeodesicPath() {\n         // Create a sphere\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkDijkstraGraphGeodesicPath dijkstra = vtkDijkstraGraphGeodesicPath.New();\n         dijkstra.SetInputConnection(sphereSource.GetOutputPort());\n         dijkstra.SetStartVertex(0);\n         dijkstra.SetEndVertex(10);\n         dijkstra.Update();\n\n         // Create a mapper and actor\n         vtkPolyDataMapper pathMapper = vtkPolyDataMapper.New();\n         pathMapper.SetInputConnection(dijkstra.GetOutputPort());\n\n         vtkActor pathActor = vtkActor.New();\n         pathActor.SetMapper(pathMapper);\n         pathActor.GetProperty().SetColor(1, 0, 0); // Red\n         pathActor.GetProperty().SetLineWidth(4);\n\n         // Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.3, 0.6, 0.3);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n         renderer.AddActor(pathActor);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/GreedyTerrainDecimation/","title":"GreedyTerrainDecimation","text":"

vtk-examples/CSharp/PolyData/GreedyTerrainDecimation

"},{"location":"CSharp/PolyData/GreedyTerrainDecimation/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/GreedyTerrainDecimation/#code","title":"Code","text":"

GreedyTerrainDecimation.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            GreedyTerrainDecimation();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void GreedyTerrainDecimation() {\n         // Create an image\n         vtkImageData image = vtkImageData.New();\n         image.SetDimensions(3, 3, 1);\n         image.SetNumberOfScalarComponents(1);\n         image.SetScalarTypeToUnsignedChar();\n         int[] dims = image.GetDimensions();\n         unsafe {\n            for(int i = 0; i < dims[0]; i++) {\n               for(int j = 0; j < dims[1]; j++) {\n                  byte* ptr = (byte*)image.GetScalarPointer(i, j, 0);\n                  *ptr = (byte)vtkMath.Round(vtkMath.Random(0, 1));\n               }\n            }\n         }\n         vtkGreedyTerrainDecimation decimation = vtkGreedyTerrainDecimation.New();\n         decimation.SetInputConnection(image.GetProducerPort());\n         decimation.Update();\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(decimation.GetOutputPort());\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetInterpolationToFlat();\n         actor.GetProperty().EdgeVisibilityOn();\n         actor.GetProperty().SetEdgeColor(1, 0, 0);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/HighlightBadCells/","title":"HighlightBadCells","text":"

vtk-examples/CSharp/PolyData/HighlightBadCells

"},{"location":"CSharp/PolyData/HighlightBadCells/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/HighlightBadCells/#code","title":"Code","text":"

HighlightBadCells.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            HighLightBadCells();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void HighLightBadCells() { \n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkTriangleFilter triangleFilter = vtkTriangleFilter.New();\n         triangleFilter.SetInputConnection(sphereSource.GetOutputPort());\n         triangleFilter.Update();\n\n         //Create a mapper and actor\n         vtkDataSetMapper sphereMapper = vtkDataSetMapper.New();\n         sphereMapper.SetInputConnection(triangleFilter.GetOutputPort());\n         vtkActor sphereActor = vtkActor.New();\n         sphereActor.SetMapper(sphereMapper);\n\n         vtkPolyData mesh = triangleFilter.GetOutput();\n         Debug.WriteLine(\"There are \" + mesh.GetNumberOfCells() + \" cells.\");\n\n         vtkMeshQuality qualityFilter = vtkMeshQuality.New();\n#if VTK_MAJOR_VERSION_5\n         qualityFilter.SetInput(mesh);\n#else\n         qualityFilter.SetInputData(mesh);\n#endif\n         qualityFilter.SetTriangleQualityMeasureToArea();\n         qualityFilter.Update();\n\n         vtkDataSet qualityMesh = qualityFilter.GetOutput();\n         vtkDoubleArray qualityArray = vtkDoubleArray.SafeDownCast(qualityMesh.GetCellData().GetArray(\"Quality\"));\n         Debug.WriteLine(\"There are \" + qualityArray.GetNumberOfTuples() + \" values.\");\n\n         for(int i = 0; i < qualityArray.GetNumberOfTuples(); i++) {\n            double val = qualityArray.GetValue(i);\n            Debug.WriteLine(\"value \" +  i + \": \" + val);\n         }\n\n         vtkThreshold selectCells = vtkThreshold.New();\n         selectCells.ThresholdByLower(.02);\n         selectCells.SetInputArrayToProcess( \n            0, \n            0, \n            0,\n            1, // POINTS = 0, CELLS = 1, NONE = 2, POINTS_THEN_CELLS = 3, VERTICES = 4, EDGES = 5, ROWS = 6\n            0  // SCALARS = 0, VECTORS = 1, NORMALS = 2, TCOORDS = 3, TENSORS = 4, GLOBALIDS = 5, PEDIGREEIDS = 6, EDGEFLAG = 7\n            );\n\n#if VTK_MAJOR_VERSION_5\n         selectCells.SetInput(qualityMesh);\n#else\n         selectCells.SetInputData(qualityMesh);\n#endif\n         selectCells.Update();\n         vtkUnstructuredGrid ug = selectCells.GetOutput();\n\n         // Create a mapper and actor\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInput(ug);\n#else\n         mapper.SetInputData(ug);\n#endif\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetColor(1.0, 0.0, 0.0);\n         actor.GetProperty().SetRepresentationToWireframe();\n         actor.GetProperty().SetLineWidth(5);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(1.0, 1.0, 1.0);\n         // add our actors to the renderer\n         renderer.AddActor(actor);\n         renderer.AddActor(sphereActor);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/IterateOverLines/","title":"IterateOverLines","text":"

vtk-examples/CSharp/PolyData/IterateOverLines

"},{"location":"CSharp/PolyData/IterateOverLines/#description","title":"Description","text":"

A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/IterateOverLines/#code","title":"Code","text":"

IterateOverLines.cs

using System;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         IterateOverLines();\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      private static void IterateOverLines() {\n         double[] origin = new double[] { 0.0, 0.0, 0.0 };\n         double[,] p = new double[,] {\n            {1.0, 0.0, 0.0},\n            {0.0, 1.0, 0.0},\n            {0.0, 1.0, 2.0},\n            {1.0, 2.0, 3.0}};\n\n         // Create a vtkPoints object and store the points in it\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(origin[0], origin[1], origin[2]);\n         for(int i = 0; i < 4; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n         // Create a cell array to store the lines in and add the lines to it\n         vtkCellArray lines = vtkCellArray.New();\n\n         // Create four lines\n         for(int i = 0; i < 4; i++) {\n            vtkLine line = vtkLine.New();\n            line.GetPointIds().SetId(0, i);\n            line.GetPointIds().SetId(1, i + 1);\n            lines.InsertNextCell(line);\n         }\n\n         // Create a polydata to store everything in\n         vtkPolyData linesPolyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         linesPolyData.SetPoints(points);\n\n         // Add the lines to the dataset\n         linesPolyData.SetLines(lines);\n\n         Console.WriteLine(\"There are \" + linesPolyData.GetNumberOfLines() + \" lines.\");\n         linesPolyData.GetLines().InitTraversal();\n         vtkIdList idList = vtkIdList.New();\n         while(linesPolyData.GetLines().GetNextCell(idList) != 0) {\n            Console.WriteLine(\"Line has \" + idList.GetNumberOfIds() + \" points.\");\n\n            for(int pointId = 0; pointId < idList.GetNumberOfIds(); pointId++) {\n               Console.Write(idList.GetId(pointId) + \" \");\n            }\n            Console.Write(Environment.NewLine);\n         }\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/MultiBlockMergeFilter/","title":"MultiBlockMergeFilter","text":"

vtk-examples/CSharp/PolyData/MultiBlockMergeFilter

"},{"location":"CSharp/PolyData/MultiBlockMergeFilter/#description","title":"Description","text":"

A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/MultiBlockMergeFilter/#code","title":"Code","text":"

MultiBlockMergeFilter.cs

using System;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         MultiBlockMergeFilter();\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      private static void MultiBlockMergeFilter() {\n         vtkSphereSource sphereSource1 = vtkSphereSource.New();\n         sphereSource1.Update();\n\n         vtkSphereSource sphereSource2 = vtkSphereSource.New();\n         sphereSource2.SetCenter(10, 10, 10);\n         sphereSource2.Update();\n\n         vtkMultiBlockDataSet multiBlockDataSet1 = vtkMultiBlockDataSet.New();\n         multiBlockDataSet1.SetNumberOfBlocks(1);\n         multiBlockDataSet1.SetBlock(0, sphereSource1.GetOutput());\n#if VTK_MAJOR_VERSION_5\n         multiBlockDataSet1.Update();\n#endif\n\n         vtkMultiBlockDataSet multiBlockDataSet2 = vtkMultiBlockDataSet.New();\n         multiBlockDataSet2.SetNumberOfBlocks(1);\n         multiBlockDataSet2.SetBlock(0, sphereSource2.GetOutput());\n#if VTK_MAJOR_VERSION_5\n         multiBlockDataSet2.Update();\n#endif\n\n         vtkMultiBlockMergeFilter multiBlockMergeFilter = vtkMultiBlockMergeFilter.New();\n#if VTK_MAJOR_VERSION_5\n         multiBlockMergeFilter.AddInput(multiBlockDataSet1);\n         multiBlockMergeFilter.AddInput(multiBlockDataSet2);\n#else\n         multiBlockMergeFilter.AddInputData(multiBlockDataSet1);\n         multiBlockMergeFilter.AddInputData(multiBlockDataSet2);\n#endif\n         multiBlockMergeFilter.Update();\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/NullPoint/","title":"NullPoint","text":"

vtk-examples/CSharp/PolyData/NullPoint

"},{"location":"CSharp/PolyData/NullPoint/#description","title":"Description","text":"

Set value of all associated arrays to zero all at once

A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/NullPoint/#code","title":"Code","text":"

NullPoint.cs

using System;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         NullPoint();\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      private static void NullPoint() {\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(1, 1, 1);\n         points.InsertNextPoint(2, 2, 2);\n         points.InsertNextPoint(3, 3, 3);\n\n         vtkPolyData polydata = vtkPolyData.New();\n         polydata.SetPoints(points);\n\n         vtkFloatArray floatArray = vtkFloatArray.New();\n         floatArray.SetNumberOfValues(3);\n         floatArray.SetNumberOfComponents(1);\n         floatArray.SetName(\"FloatArray\");\n         for(int i = 0; i < 3; i++) {\n            floatArray.SetValue(i, 2);\n         }\n         polydata.GetPointData().AddArray(floatArray);\n\n         vtkIntArray intArray = vtkIntArray.New();\n         intArray.SetNumberOfValues(3);\n         intArray.SetNumberOfComponents(1);\n         intArray.SetName(\"IntArray\");\n         for(int i = 0; i < 3; i++) {\n            intArray.SetValue(i, 2);\n         }\n\n         polydata.GetPointData().AddArray(intArray);\n\n         Console.WriteLine(\"PointIdx   x y z \" + \"floatArray\" + \" \" + \"intArray\");\n         Console.WriteLine(\"----------------------------------------\");\n         for(int i = 0; i < 3; i++) {\n            double[] p = polydata.GetPoint(i);\n            vtkFloatArray pointsFloatArray = vtkFloatArray.SafeDownCast(polydata.GetPointData().GetArray(\"FloatArray\"));\n            vtkIntArray pointsIntArray = vtkIntArray.SafeDownCast(polydata.GetPointData().GetArray(\"IntArray\"));\n            Console.WriteLine(\"   \" + i + \"       \" + p[0] + \" \" + p[1] + \" \" + p[2] + \"    \"\n                      + pointsFloatArray.GetValue(i) + \"          \" + pointsIntArray.GetValue(i));\n         }\n\n         polydata.GetPointData().NullPoint(1);\n         polydata.Modified();\n         Console.WriteLine(\"\");\n\n         for(int i = 0; i < 3; i++) {\n            double[] p = polydata.GetPoint(i);\n            vtkFloatArray pointsFloatArray = vtkFloatArray.SafeDownCast(polydata.GetPointData().GetArray(\"FloatArray\"));\n            vtkIntArray pointsIntArray = vtkIntArray.SafeDownCast(polydata.GetPointData().GetArray(\"IntArray\"));\n            Console.WriteLine(\"   \" + i + \"       \" + p[0] + \" \" + p[1] + \" \" + p[2] + \"    \"\n                      + pointsFloatArray.GetValue(i) + \"          \" + pointsIntArray.GetValue(i));\n\n         }\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion/","title":"PolyDataConnectivityFilter LargestRegion","text":"

vtk-examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion

"},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion/#description","title":"Description","text":"

This example extracts the largest connected region of a mesh. Note that this is based on the number of points, not the actual area of the region.

  • Contributed by: Jinyoung Hwang

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion/#code","title":"Code","text":"

PolyDataConnectivityFilter_LargestRegion.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            vtkPolyDataConnectivityFilter_LargestRegion();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void vtkPolyDataConnectivityFilter_LargestRegion() {\n         // Small sphere\n         vtkSphereSource sphereSource1 = vtkSphereSource.New();\n         sphereSource1.Update();\n\n         // Large sphere\n         vtkSphereSource sphereSource2 = vtkSphereSource.New();\n         sphereSource2.SetRadius(10);\n         sphereSource2.SetCenter(25, 0, 0);\n         sphereSource2.SetThetaResolution(10);\n         sphereSource2.SetPhiResolution(10);\n         sphereSource2.Update();\n\n         vtkAppendPolyData appendFilter = vtkAppendPolyData.New();\n         appendFilter.AddInputConnection(sphereSource1.GetOutputPort());\n         appendFilter.AddInputConnection(sphereSource2.GetOutputPort());\n         appendFilter.Update();\n\n         vtkPolyDataConnectivityFilter connectivityFilter = vtkPolyDataConnectivityFilter.New();\n         connectivityFilter.SetInputConnection(appendFilter.GetOutputPort());\n         connectivityFilter.SetExtractionModeToLargestRegion();\n         connectivityFilter.Update();\n\n         // Create a mapper and actor for original data\n         vtkPolyDataMapper originalMapper = vtkPolyDataMapper.New();\n         originalMapper.SetInputConnection(appendFilter.GetOutputPort());\n         originalMapper.Update();\n\n         vtkActor originalActor = vtkActor.New();\n         originalActor.SetMapper(originalMapper);\n\n         // Create a mapper and actor for extracted data\n         vtkPolyDataMapper extractedMapper = vtkPolyDataMapper.New();\n         extractedMapper.SetInputConnection(connectivityFilter.GetOutputPort());\n         extractedMapper.Update();\n\n         vtkActor extractedActor = vtkActor.New();\n         extractedActor.GetProperty().SetColor(1, 0, 0);\n         extractedActor.SetMapper(extractedMapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(originalActor);\n         renderer.AddActor(extractedActor);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/","title":"PolyDataConnectivityFilter SpecifiedRegion","text":"

vtk-examples/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion

"},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#description","title":"Description","text":"

This example creates two spheres and combines them together into one polydata. The vtkPolyDataConnectivityFilter is used to find the two spheres as they are separate regions (disconnected). If region 0 is selected, the small sphere is extracted. If region 1 is selected, the large sphere is extracted. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#code","title":"Code","text":"

PolyDataConnectivityFilter_SpecifiedRegion.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            vtkPolyDataConnectivityFilter_SpecifiedRegion();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void vtkPolyDataConnectivityFilter_SpecifiedRegion() {\n         // Small sphere (first region)\n         vtkSphereSource sphereSource1 = vtkSphereSource.New();\n         sphereSource1.Update();\n\n         // Large sphere (second region)\n         vtkSphereSource sphereSource2 = vtkSphereSource.New();\n         sphereSource2.SetRadius(10);\n         sphereSource2.SetCenter(25, 0, 0);\n         sphereSource2.Update();\n\n         vtkAppendPolyData appendFilter = vtkAppendPolyData.New();\n         appendFilter.AddInputConnection(sphereSource1.GetOutputPort());\n         appendFilter.AddInputConnection(sphereSource2.GetOutputPort());\n         appendFilter.Update();\n\n         vtkPolyDataConnectivityFilter connectivityFilter = vtkPolyDataConnectivityFilter.New();\n         connectivityFilter.SetInputConnection(appendFilter.GetOutputPort());\n         connectivityFilter.SetExtractionModeToSpecifiedRegions();\n         connectivityFilter.AddSpecifiedRegion(1); //select the region to extract here\n         connectivityFilter.Update();\n\n         // Create a mapper and actor for original data\n         vtkPolyDataMapper originalMapper = vtkPolyDataMapper.New();\n         originalMapper.SetInputConnection(appendFilter.GetOutputPort());\n         originalMapper.Update();\n\n         vtkActor originalActor = vtkActor.New();\n         originalActor.SetMapper(originalMapper);\n\n         // Create a mapper and actor for extracted data\n         vtkPolyDataMapper extractedMapper = vtkPolyDataMapper.New();\n         extractedMapper.SetInputConnection(connectivityFilter.GetOutputPort());\n         extractedMapper.Update();\n\n         vtkActor extractedActor = vtkActor.New();\n         extractedActor.GetProperty().SetColor(1, 0, 0);\n         extractedActor.SetMapper(extractedMapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(originalActor);\n         renderer.AddActor(extractedActor);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/PolyDataGetPoint/","title":"PolyDataGetPoint","text":"

vtk-examples/CSharp/PolyData/PolyDataGetPoint

"},{"location":"CSharp/PolyData/PolyDataGetPoint/#description","title":"Description","text":"

This example demonstrates how to obtain the coordinates of a point in a [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details) object. * Suggested by Sara Rolfe

A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/PolyDataGetPoint/#code","title":"Code","text":"

PolyDataGetPoint.cs

using System;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         PolyDataGetPoint();\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      private void PolyDataGetPoint() {\n         // Create a sphere\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n         vtkPolyData polydata = sphereSource.GetOutput();\n\n         // Write all of the coordinates of the points in the vtkPolyData to the console.\n         for(int i = 0; i < polydata.GetNumberOfPoints(); i++) {\n            double[] p = polydata.GetPoint(i);\n            // This is identical to:\n            // double[] p = polydata.GetPoints().GetPoint(i);\n            Console.WriteLine(\"Point \" + i + \" : (\" + p[0] + \" \" + p[1] + \" \" + p[2] + \")\");\n         }\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/PolygonalSurfaceContourLineInterpolator/","title":"PolygonalSurfaceContourLineInterpolator","text":"

vtk-examples/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator

"},{"location":"CSharp/PolyData/PolygonalSurfaceContourLineInterpolator/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/PolygonalSurfaceContourLineInterpolator/#code","title":"Code","text":"

PolygonalSurfaceContourLineInterpolator.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            PolygonalSurfaceContourLineInterpolator();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void PolygonalSurfaceContourLineInterpolator() { \n         vtkPolyData polyData;\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.SetThetaResolution(40);\n         sphereSource.SetPhiResolution(20);\n         sphereSource.Update();\n\n         polyData = sphereSource.GetOutput();\n         // The Dijkstra interpolator will not accept cells that aren't triangles\n         vtkTriangleFilter triangleFilter = vtkTriangleFilter.New();\n#if VTK_MAJOR_VERSION_5\n         triangleFilter.SetInput( polyData );\n#else\n         triangleFilter.SetInputData( polyData );\n#endif\n         triangleFilter.Update();\n\n         vtkPolyData pd = triangleFilter.GetOutput();\n\n         //Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(triangleFilter.GetOutputPort());\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetInterpolationToFlat();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.3, 0.4, 0.5);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n\n         // Here comes the contour widget stuff.....\n         vtkContourWidget contourWidget = vtkContourWidget.New();\n         contourWidget.SetInteractor(renderWindow.GetInteractor());\n         vtkOrientedGlyphContourRepresentation rep = \n            vtkOrientedGlyphContourRepresentation.SafeDownCast(\n               contourWidget.GetRepresentation());\n         rep.GetLinesProperty().SetColor(1, 0.2, 0);\n         rep.GetLinesProperty().SetLineWidth(3.0f);\n\n         vtkPolygonalSurfacePointPlacer pointPlacer = \n            vtkPolygonalSurfacePointPlacer.New();\n         pointPlacer.AddProp(actor);\n         pointPlacer.GetPolys().AddItem(pd);\n         rep.SetPointPlacer(pointPlacer);\n\n         vtkPolygonalSurfaceContourLineInterpolator interpolator = \n            vtkPolygonalSurfaceContourLineInterpolator.New();\n         interpolator.GetPolys().AddItem(pd);\n         rep.SetLineInterpolator(interpolator);\n\n         renderWindow.Render();\n         contourWidget.EnabledOn();\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/SelectPolyData/","title":"SelectPolyData","text":"

vtk-examples/CSharp/PolyData/SelectPolyData

"},{"location":"CSharp/PolyData/SelectPolyData/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/SelectPolyData/#code","title":"Code","text":"

SelectPolyData.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            SelectPolyData();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void SelectPolyData() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkPoints selectionPoints = vtkPoints.New();\n\n         selectionPoints.InsertPoint(0, -0.16553, 0.135971, 0.451972);\n         selectionPoints.InsertPoint(1, -0.0880123, -0.134952, 0.4747);\n         selectionPoints.InsertPoint(2, 0.00292618, -0.134604, 0.482459);\n         selectionPoints.InsertPoint(3, 0.0641941, 0.067112, 0.490947);\n         selectionPoints.InsertPoint(4, 0.15577, 0.0734765, 0.469245);\n         selectionPoints.InsertPoint(5, 0.166667, -0.129217, 0.454622);\n         selectionPoints.InsertPoint(6, 0.241259, -0.123363, 0.420581);\n         selectionPoints.InsertPoint(7, 0.240334, 0.0727106, 0.432555);\n         selectionPoints.InsertPoint(8, 0.308529, 0.0844311, 0.384357);\n         selectionPoints.InsertPoint(9, 0.32672, -0.121674, 0.359187);\n         selectionPoints.InsertPoint(10, 0.380721, -0.117342, 0.302527);\n         selectionPoints.InsertPoint(11, 0.387804, 0.0455074, 0.312375);\n         selectionPoints.InsertPoint(12, 0.43943, -0.111673, 0.211707);\n         selectionPoints.InsertPoint(13, 0.470984, -0.0801913, 0.147919);\n         selectionPoints.InsertPoint(14, 0.436777, 0.0688872, 0.233021);\n         selectionPoints.InsertPoint(15, 0.44874, 0.188852, 0.109882);\n         selectionPoints.InsertPoint(16, 0.391352, 0.254285, 0.176943);\n         selectionPoints.InsertPoint(17, 0.373274, 0.154162, 0.294296);\n         selectionPoints.InsertPoint(18, 0.274659, 0.311654, 0.276609);\n         selectionPoints.InsertPoint(19, 0.206068, 0.31396, 0.329702);\n         selectionPoints.InsertPoint(20, 0.263789, 0.174982, 0.387308);\n         selectionPoints.InsertPoint(21, 0.213034, 0.175485, 0.417142);\n         selectionPoints.InsertPoint(22, 0.169113, 0.261974, 0.390286);\n         selectionPoints.InsertPoint(23, 0.102552, 0.25997, 0.414814);\n         selectionPoints.InsertPoint(24, 0.131512, 0.161254, 0.454705);\n         selectionPoints.InsertPoint(25, 0.000192443, 0.156264, 0.475307);\n         selectionPoints.InsertPoint(26, -0.0392091, 0.000251724, 0.499943);\n         selectionPoints.InsertPoint(27, -0.096161, 0.159646, 0.46438);\n\n         vtkSelectPolyData loop = vtkSelectPolyData.New();\n         loop.SetInputConnection(sphereSource.GetOutputPort());\n         loop.SetLoop(selectionPoints);\n         loop.GenerateSelectionScalarsOn();\n         loop.SetSelectionModeToSmallestRegion(); //negative scalars inside\n\n         vtkClipPolyData clip = //clips out positive region\n         vtkClipPolyData.New();\n         clip.SetInputConnection(loop.GetOutputPort());\n\n         vtkPolyDataMapper clipMapper = vtkPolyDataMapper.New();\n         clipMapper.SetInputConnection(clip.GetOutputPort());\n\n         vtkLODActor clipActor = vtkLODActor.New();\n         clipActor.SetMapper(clipMapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.1, .2, .4);\n         renderWindow.SetSize(500, 250);\n         // add our actor to the renderer\n         renderer.AddActor(clipActor);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/ShrinkPolyData/","title":"ShrinkPolyData","text":"

vtk-examples/CSharp/PolyData/ShrinkPolyData

"},{"location":"CSharp/PolyData/ShrinkPolyData/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/ShrinkPolyData/#code","title":"Code","text":"

ShrinkPolyData.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ShrinkPolyData();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ShrinkPolyData() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.SetRadius(10);\n         sphereSource.SetPhiResolution(12);\n         sphereSource.SetThetaResolution(12);\n         sphereSource.Update();\n\n         vtkShrinkPolyData shrinkFilter = vtkShrinkPolyData.New();\n         shrinkFilter.SetInputConnection(sphereSource.GetOutputPort());\n         shrinkFilter.Update();\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(shrinkFilter.GetOutputPort());\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         //Add the actors to the renderer, set the background and size \n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/VectorFieldNonZeroExtraction/","title":"VectorFieldNonZeroExtraction","text":"

vtk-examples/CSharp/PolyData/VectorFieldNonZeroExtraction

"},{"location":"CSharp/PolyData/VectorFieldNonZeroExtraction/#description","title":"Description","text":"

This example shows how to create an imagedata object, associate scalar data with some points and visualize only nonzero scalar values

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/VectorFieldNonZeroExtraction/#code","title":"Code","text":"

VectorFieldNonZeroExtraction.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            VectorFieldNonZeroExtraction();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void VectorFieldNonZeroExtraction() { \n         // Create an image\n         vtkImageData image = vtkImageData.New();\n         CreateVectorField(ref image);\n\n         // This filter produces a vtkImageData with an array named \"Magnitude\"\n         vtkImageMagnitude magnitudeFilter = vtkImageMagnitude.New();\n         magnitudeFilter.SetInputConnection(image.GetProducerPort());\n         magnitudeFilter.Update(); \n\n         image.GetPointData().AddArray(magnitudeFilter.GetOutput().GetPointData().GetScalars());\n         image.GetPointData().SetActiveScalars(\"Magnitude\");\n\n         vtkThresholdPoints thresholdVector = vtkThresholdPoints.New();\n         thresholdVector.SetInput(image);\n         thresholdVector.SetInputArrayToProcess(\n            0, \n            0, \n            (int)vtkDataObject.FieldAssociations.FIELD_ASSOCIATION_POINTS, \n            (int)vtkDataSetAttributes.AttributeTypes.SCALARS,\n            \"Magnitude\");\n         thresholdVector.ThresholdByUpper(0.00001);\n         thresholdVector.Update();\n\n         // in case you want to save imageData\n         //vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n         //writer.SetFileName(\"output.vtp\");\n         //writer.SetInputConnection(thresholdPoints.GetOutputPort());\n         //writer.Write();\n\n         // repesents the pixels\n         vtkCubeSource cubeSource = vtkCubeSource.New();\n         cubeSource.SetXLength(2.0);\n         cubeSource.SetYLength(2.0);\n         cubeSource.SetZLength(2.0);\n         vtkGlyph3D glyph = vtkGlyph3D.New();\n         glyph.SetInput(image);\n         glyph.SetSourceConnection(cubeSource.GetOutputPort());\n         // don't scale glyphs according to any scalar data\n         glyph.SetScaleModeToDataScalingOff();\n\n         vtkPolyDataMapper glyphMapper = vtkPolyDataMapper.New();\n         glyphMapper.SetInputConnection(glyph.GetOutputPort());\n         // don't color glyphs according to scalar data\n         glyphMapper.ScalarVisibilityOff();\n         glyphMapper.SetScalarModeToDefault();\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(glyphMapper);\n\n         // represent vector field\n         vtkGlyph3D vectorGlyph = vtkGlyph3D.New();\n         vtkArrowSource arrowSource = vtkArrowSource.New();\n         vtkPolyDataMapper vectorGlyphMapper = vtkPolyDataMapper.New();\n\n         int n = image.GetPointData().GetNumberOfArrays();\n         for(int i = 0; i < n; i++) {\n            Debug.WriteLine(\"name of array[\"+ i + \"]: \" + image.GetPointData().GetArrayName(i));\n         }\n\n         vtkPolyData tmp = thresholdVector.GetOutput();\n         Debug.WriteLine(\"number of thresholded points: \" + tmp.GetNumberOfPoints());\n         vectorGlyph.SetInputConnection(thresholdVector.GetOutputPort());\n\n         // in case you want the point glyphs to be oriented according to \n         // scalar values in array \"ImageScalars\" uncomment the following line\n         image.GetPointData().SetActiveVectors(\"ImageScalars\");\n\n         vectorGlyph.SetSourceConnection(arrowSource.GetOutputPort());\n         vectorGlyph.SetScaleModeToScaleByVector();\n         vectorGlyph.SetVectorModeToUseVector();\n         vectorGlyph.ScalingOn();\n         vectorGlyph.OrientOn();\n         vectorGlyph.SetInputArrayToProcess(\n            1,\n            0,\n            (int)vtkDataObject.FieldAssociations.FIELD_ASSOCIATION_POINTS,\n            (int)vtkDataSetAttributes.AttributeTypes.SCALARS,\n            \"ImageScalars\");\n\n         vectorGlyph.Update();\n\n         vectorGlyphMapper.SetInputConnection(vectorGlyph.GetOutputPort());\n         vectorGlyphMapper.Update();\n\n         vtkActor vectorActor = vtkActor.New();\n         vectorActor.SetMapper(vectorGlyphMapper);\n\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .6, .3);\n         //Add the actors to the renderer, set the background and size \n         renderer.AddActor(actor);\n         renderer.AddActor(vectorActor);\n      }\n\n\n      void CreateVectorField(ref vtkImageData image) {\n         // Specify the size of the image data\n         image.SetDimensions(3, 3, 3);\n         image.SetNumberOfScalarComponents(3);\n         image.SetScalarTypeToFloat();\n         image.AllocateScalars();\n         image.SetSpacing(10.0, 10.0, 10.0);\n         int[]  dims = image.GetDimensions();\n\n         float[] pixel = new float[] {0.0f, 0.0f, 0.0f};\n         IntPtr pPixel;\n\n         // Zero the vectors\n         for(int z = 0; z < dims[2]; z++) {\n            for(int y = 0; y < dims[1]; y++) {\n               for(int x = 0; x < dims[0]; x++) {\n                  pPixel = image.GetScalarPointer(x, y, 0);\n                  Marshal.Copy(pixel, 0, pPixel, 3);\n               }\n            }\n         }\n\n         // Set two of the pixels to non zero values\n         pixel[0] = 8.0f;\n         pixel[1] = 8.0f;\n         pixel[2] = -8.0f;\n         pPixel = image.GetScalarPointer(0, 2, 0);\n         Marshal.Copy(pixel, 0, pPixel, 3);\n\n         pixel[0] = 8.0f;\n         pixel[1] = -8.0f;\n         pixel[2] = 8.0f;\n         pPixel = image.GetScalarPointer(2, 0, 2);\n         Marshal.Copy(pixel, 0, pPixel, 3);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/WarpVector/","title":"WarpVector","text":"

vtk-examples/CSharp/PolyData/WarpVector

"},{"location":"CSharp/PolyData/WarpVector/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/WarpVector/#code","title":"Code","text":"

WarpVector.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WarpVector();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WarpVector() {\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0.0, 0.0, 0.0);\n         points.InsertNextPoint(1.0, 0.0, 0.0);\n         points.InsertNextPoint(2.0, 0.0, 0.0);\n         points.InsertNextPoint(3.0, 0.0, 0.0);\n         points.InsertNextPoint(4.0, 0.0, 0.0);\n\n         vtkCellArray lines = vtkCellArray.New();\n         vtkLine line = vtkLine.New();\n         line.GetPointIds().SetId(0, 0);\n         line.GetPointIds().SetId(1, 1);\n         lines.InsertNextCell(line);\n         line.GetPointIds().SetId(0, 1);\n         line.GetPointIds().SetId(1, 2);\n         lines.InsertNextCell(line);\n         line.GetPointIds().SetId(0, 2);\n         line.GetPointIds().SetId(1, 3);\n         lines.InsertNextCell(line);\n         line.GetPointIds().SetId(0, 3);\n         line.GetPointIds().SetId(1, 4);\n         lines.InsertNextCell(line);\n\n         vtkDoubleArray warpData = vtkDoubleArray.New();\n         warpData.SetNumberOfComponents(3);\n         warpData.SetName(\"warpData\");\n         double[] warp = new double[] { 0.0, 0.0, 0.0 };\n         warp[1] = 0.0;\n         warpData.InsertNextTuple3(warp[0], warp[1], warp[2]);\n         warp[1] = 0.1;\n         warpData.InsertNextTuple3(warp[0], warp[1], warp[2]);\n         warp[1] = 0.3;\n         warpData.InsertNextTuple3(warp[0], warp[1], warp[2]);\n         warp[1] = 0.0;\n         warpData.InsertNextTuple3(warp[0], warp[1], warp[2]);\n         warp[1] = 0.1;\n         warpData.InsertNextTuple3(warp[0], warp[1], warp[2]);\n\n         vtkPolyData polydata = vtkPolyData.New();\n         polydata.SetPoints(points);\n         polydata.SetLines(lines);\n         polydata.GetPointData().AddArray(warpData);\n         polydata.GetPointData().SetActiveVectors(warpData.GetName());\n\n         //WarpVector will use the array marked as active vector in polydata\n         //it has to be a 3 component array\n         //with the same number of tuples as points in polydata\n         vtkWarpVector warpVector = vtkWarpVector.New();\n#if VTK_MAJOR_VERSION_5\n         warpVector.SetInput(polydata);\n#else\n         warpVector.SetInputData(polydata);\n#endif\n         warpVector.Update();\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInput(warpVector.GetPolyDataOutput());\n#else\n         mapper.SetInputData(warpVector.GetPolyDataOutput());\n#endif\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .6, .3);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/PolyData/WeightedTransformFilter/","title":"WeightedTransformFilter","text":"

vtk-examples/CSharp/PolyData/WeightedTransformFilter

"},{"location":"CSharp/PolyData/WeightedTransformFilter/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/PolyData/WeightedTransformFilter/#code","title":"Code","text":"

WeightedTransformFilter.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WeightedTransformFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WeightedTransformFilter() { \n         // Use a sphere as a basis of the shape\n         vtkSphereSource sphere = vtkSphereSource.New();\n         sphere.SetPhiResolution(40);\n         sphere.SetThetaResolution(40);\n         sphere.Update();\n\n         vtkPolyData sphereData = sphere.GetOutput();\n\n         // Create a data array to hold the weighting coefficients\n         vtkFloatArray tfarray = vtkFloatArray.New();\n         int npoints = sphereData.GetNumberOfPoints();\n         tfarray.SetNumberOfComponents(2);\n         tfarray.SetNumberOfTuples(npoints);\n\n         // Parameterize the sphere along the z axis, and fill the weights\n         // with (1.0-a, a) to linearly interpolate across the shape\n         IntPtr pPoint = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n         double[] point = new double[3];\n         for(int i = 0; i < npoints; i++) {\n            sphereData.GetPoint(i, pPoint);\n            Marshal.Copy(pPoint, point, 0, 3);\n            double x = point[0];\n            double y = point[1];\n            double z = point[2];\n\n            double zn = z + 0.5;\n            double zn1 = 1.0 - zn;\n            if(zn > 1.0)\n               zn = 1.0;\n            if(zn1 < 0.0)\n               zn1 = 0.0;\n\n            tfarray.SetComponent(i, 0, zn1);\n            tfarray.SetComponent(i, 1, zn);\n         }\n         Marshal.FreeHGlobal(pPoint);\n\n         // Create field data to hold the array, and bind it to the sphere\n         vtkFieldData fd = vtkFieldData.New();\n         tfarray.SetName(\"weights\");\n         sphereData.GetPointData().AddArray(tfarray);\n\n         // Use an ordinary transform to stretch the shape\n         vtkTransform stretch = vtkTransform.New();\n         stretch.Scale(1, 1, 3.2);\n\n         vtkTransformFilter stretchFilter = vtkTransformFilter.New();\n         stretchFilter.SetInputConnection(sphereData.GetProducerPort());\n         stretchFilter.SetTransform(stretch);\n\n         // Now, for the weighted transform stuff\n         vtkWeightedTransformFilter weightedTrans = vtkWeightedTransformFilter.New();\n\n         // Create two transforms to interpolate between\n         vtkTransform identity = vtkTransform.New();\n         identity.Identity();\n\n         vtkTransform rotated = vtkTransform.New();\n         double rotatedAngle = 45;\n         rotated.RotateX(rotatedAngle);\n\n         weightedTrans.SetNumberOfTransforms(2);\n         weightedTrans.SetTransform(identity, 0);\n         weightedTrans.SetTransform(rotated, 1);\n         // which data array should the filter use ?\n         weightedTrans.SetWeightArray(\"weights\");\n\n         weightedTrans.SetInputConnection(stretchFilter.GetOutputPort());\n\n         vtkPolyDataMapper weightedTransMapper = vtkPolyDataMapper.New();\n         weightedTransMapper.SetInputConnection(weightedTrans.GetOutputPort());\n         vtkActor weightedTransActor = vtkActor.New();\n         weightedTransActor.SetMapper(weightedTransMapper);\n         weightedTransActor.GetProperty().SetDiffuseColor(0.8, 0.8, 0.1);\n         weightedTransActor.GetProperty().SetRepresentationToSurface();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(weightedTransActor);\n\n         renderer.ResetCamera();\n         renderer.GetActiveCamera().Azimuth(90);\n         renderer.GetActiveCamera().Dolly(1);\n      }\n   }\n}\n
"},{"location":"CSharp/SimpleOperations/DistanceBetweenPoints/","title":"DistanceBetweenPoints","text":"

vtk-examples/CSharp/SimpleOperations/DistanceBetweenPoints

"},{"location":"CSharp/SimpleOperations/DistanceBetweenPoints/#description","title":"Description","text":"

This example finds the squared distance and the Euclidean distance between two 3D points.

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/SimpleOperations/DistanceBetweenPoints/#code","title":"Code","text":"

DistanceBetweenPoints.cs

using System;\nusing System.Runtime.InteropServices;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid DistanceBetweenPoints() {\n   // Create two points.\n   double[] p0 = new double[] { 0.0, 0.0, 0.0 };\n   double[] p1 = new double[] { 1.0, 1.0, 1.0 };\n\n   IntPtr pP0 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   IntPtr pP1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   Marshal.Copy(p0, 0, pP0, 3);\n   Marshal.Copy(p1, 0, pP1, 3);\n\n   // Find the squared distance between the points.\n   double squaredDistance = vtkMath.Distance2BetweenPoints(pP0, pP1);\n\n   // Take the square root to get the Euclidean distance between the points.\n   double distance = Math.Sqrt(squaredDistance);\n\n   // Output the results.\n   Console.WriteLine(\"SquaredDistance = \" + squaredDistance);\n   Console.WriteLine(\"Distance = \" + distance);\n   Marshal.FreeHGlobal(pP0);\n   Marshal.FreeHGlobal(pP1);\n}\n
"},{"location":"CSharp/SimpleOperations/DistancePointToLine/","title":"DistancePointToLine","text":"

vtk-examples/CSharp/SimpleOperations/DistancePointToLine

"},{"location":"CSharp/SimpleOperations/DistancePointToLine/#description","title":"Description","text":"

This example computes the distance from a point to a line.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/SimpleOperations/DistancePointToLine/#code","title":"Code","text":"

DistancePointToLine.cs

using System;\nusing System.Runtime.InteropServices;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid DistancePointToLine() {\n   double[] lineP0 = new double[] { 0.0, 0.0, 0.0 };\n   double[] lineP1 = new double[] { 2.0, 0.0, 0.0 };\n\n   double[] p0 = new double[] { 1.0, 0, 0 };\n   double[] p1 = new double[] { 1.0, 2.0, 0 };\n\n   // Don't worry, fortunately only a few functions in ActiViz.NET need \n   // Marshaling between Managed and Unmanaged Code\n   IntPtr pP0 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   IntPtr pP1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   IntPtr pLineP0 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   IntPtr pLineP1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   Marshal.Copy(p0, 0, pP0, 3);\n   Marshal.Copy(p1, 0, pP1, 3);\n   Marshal.Copy(lineP0, 0, pLineP0, 3);\n   Marshal.Copy(lineP1, 0, pLineP1, 3);\n\n   double dist0 = vtkLine.DistanceToLine(pP0, pLineP0, pLineP1);\n   Console.WriteLine(\"Dist0: \" + dist0);\n\n   double dist1 = vtkLine.DistanceToLine(pP1, pLineP0, pLineP1);\n   Console.WriteLine(\"Dist1: \" + dist1);\n\n   double parametricCoord = 0.0; // must be initialized because this var is passed by reference\n   double[] closest = new double[3];\n   IntPtr pClosest = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   Marshal.Copy(closest, 0, pClosest, 3);\n\n   dist0 = vtkLine.DistanceToLine(pP0, pLineP0, pLineP1, ref parametricCoord, pClosest);\n   Marshal.Copy(pClosest, closest, 0, 3);\n   Console.WriteLine(\n      \"Dist0: \" + dist0 \n      + \" closest point: \" + closest[0] + \" \" + closest[1] + \" \" + closest[2] \n      + \" parametricCoord: \" + parametricCoord);\n\n   dist1 = vtkLine.DistanceToLine(pP1, pLineP0, pLineP1, ref parametricCoord, pClosest);\n   Marshal.Copy(pClosest, closest, 0, 3);\n   Console.WriteLine(\n      \"Dist1: \" + dist1 \n      + \" closest point: \" + closest[0] + \" \" + closest[1] + \" \" + closest[2]\n      + \" parametricCoord: \" + parametricCoord);\n\n   Marshal.FreeHGlobal(pP0);\n   Marshal.FreeHGlobal(pP1);\n   Marshal.FreeHGlobal(pLineP0);\n   Marshal.FreeHGlobal(pLineP1);\n   Marshal.FreeHGlobal(pClosest);\n}\n
"},{"location":"CSharp/SimpleOperations/GaussianRandomNumber/","title":"GaussianRandomNumber","text":"

vtk-examples/CSharp/SimpleOperations/GaussianRandomNumber

"},{"location":"CSharp/SimpleOperations/GaussianRandomNumber/#description","title":"Description","text":"

This example generates 3 random numbers from a Gaussian distribution with mean 0.0 and standard deviation 2.0.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/SimpleOperations/GaussianRandomNumber/#code","title":"Code","text":"

GaussianRandomNumber.cs

using System;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid GaussianRandomNumber() {\n   // Set the number of random numbers we wish to produce to 3.\n   uint numRand = 3;\n   // Without this line, the random numbers will be the same every iteration.\n   vtkMath.RandomSeed((int)( DateTime.Now.Ticks & 0x0000FFFF ));\n\n   // Generate numRand random numbers from a Gaussian distribution with mean 0.0 and standard deviation 2.0\n   for(uint i = 0; i < numRand; i++) {\n      double a = vtkMath.Gaussian(0.0, 2.0);\n      Console.WriteLine(a);\n   }\n}\n
"},{"location":"CSharp/SimpleOperations/PerspectiveTransform/","title":"PerspectiveTransform","text":"

vtk-examples/CSharp/SimpleOperations/PerspectiveTransform

"},{"location":"CSharp/SimpleOperations/PerspectiveTransform/#description","title":"Description","text":"

The perspective transform automatically appends the \"homogeneous 1\" to the point before it is multiplied by the matrix. It then divides the first 3 coordinates of the result by the 4th coordinate of the result. For comparison, the standard projection (vtkTransform) is also performed with the same matrix and the same point. Note that the results are much different.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/SimpleOperations/PerspectiveTransform/#code","title":"Code","text":"

PerspectiveTransform.cs

using System;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid PerspectiveTransform() {\n   vtkMatrix4x4 m = vtkMatrix4x4.New();\n   m.SetElement(0, 0, 1);\n   m.SetElement(0, 1, 2);\n   m.SetElement(0, 2, 3);\n   m.SetElement(0, 3, 4);\n   m.SetElement(1, 0, 2);\n   m.SetElement(1, 1, 2);\n   m.SetElement(1, 2, 3);\n   m.SetElement(1, 3, 4);\n   m.SetElement(2, 0, 3);\n   m.SetElement(2, 1, 2);\n   m.SetElement(2, 2, 3);\n   m.SetElement(2, 3, 4);\n   m.SetElement(3, 0, 4);\n   m.SetElement(3, 1, 2);\n   m.SetElement(3, 2, 3);\n   m.SetElement(3, 3, 4);\n\n   vtkPerspectiveTransform perspectiveTransform = vtkPerspectiveTransform.New();\n   perspectiveTransform.SetMatrix(m);\n\n   vtkTransform transform = vtkTransform.New();\n   transform.SetMatrix(m);\n\n   double[] p = new double[]{1.0, 2.0, 3.0};\n\n   double[] normalProjection = transform.TransformPoint(p[0], p[1], p[2]);\n\n   Console.WriteLine(\"Standard projection: \"\n      + normalProjection[0] + \" \"\n      + normalProjection[1] + \" \"\n      + normalProjection[2]);\n\n   double[] perspectiveProjection = perspectiveTransform.TransformPoint(p[0], p[1], p[2]);\n\n   Console.WriteLine(\"Perspective  projection: \"\n      + perspectiveProjection[0] + \" \"\n      + perspectiveProjection[1] + \" \"\n      + perspectiveProjection[2]);\n}\n
"},{"location":"CSharp/SimpleOperations/ProjectPointPlane/","title":"ProjectPointPlane","text":"

vtk-examples/CSharp/SimpleOperations/ProjectPointPlane

"},{"location":"CSharp/SimpleOperations/ProjectPointPlane/#description","title":"Description","text":"

This example projects a point onto a plane

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/SimpleOperations/ProjectPointPlane/#code","title":"Code","text":"

ProjectPointPlane.cs

using System;\nusing System.Runtime.InteropServices;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid ProjectPointPlane() {\n   vtkPlane plane = vtkPlane.New();\n   plane.SetOrigin(0.0, 0.0, 0.0);\n   plane.SetNormal(0.0, 0.0, 1.0);\n\n   double[] p = new double[] { 23.1, 54.6, 9.2 };\n   double[] projected = new double[3];\n\n   IntPtr pP = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   IntPtr pProjected = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   Marshal.Copy(p, 0, pP, 3);\n   Marshal.Copy(projected, 0, pProjected, 3);\n\n   // NOTE: normal assumed to have magnitude 1\n   plane.ProjectPoint(pP, pProjected);\n   Marshal.Copy(pProjected, projected, 0, 3);\n   Marshal.FreeHGlobal(pP);\n   Marshal.FreeHGlobal(pProjected);\n\n   Console.WriteLine(\"Projected: \"\n      + projected[0] + \" \"\n      + projected[1] + \" \"\n      + projected[2]);\n}\n
"},{"location":"CSharp/SimpleOperations/RandomSequence/","title":"RandomSequence","text":"

vtk-examples/CSharp/SimpleOperations/RandomSequence

"},{"location":"CSharp/SimpleOperations/RandomSequence/#description","title":"Description","text":"

This is the \"new\" (December, 2009) VTK way to produce random numbers. It is actually a random sequence generator.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/SimpleOperations/RandomSequence/#code","title":"Code","text":"

RandomSequence.cs

using System;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid RandomSequence() {\n   //Create a random sequence generator.\n   vtkMinimalStandardRandomSequence sequence = \n      vtkMinimalStandardRandomSequence.New();\n\n   // initialize the sequence\n   sequence.SetSeed((int)(DateTime.Now.Ticks & 0x0000FFFF));\n   //Get 3 random numbers.\n   double x = sequence.GetValue();\n   sequence.Next();\n   double y = sequence.GetValue();\n   sequence.Next();\n   double z = sequence.GetValue();\n\n   // You can also use sequence.GetRangeValue(-1.0, 1.0); \n   // to set a range on the random values.\n\n   // Output the resulting random numbers\n   Console.WriteLine(\"x: \" + x + \" y: \" + y + \" z: \" + z);\n}\n
"},{"location":"CSharp/SimpleOperations/UniformRandomNumber/","title":"UniformRandomNumber","text":"

vtk-examples/CSharp/SimpleOperations/UniformRandomNumber

"},{"location":"CSharp/SimpleOperations/UniformRandomNumber/#description","title":"Description","text":"

This example generates 3 random numbers between 0 and 2 from a uniform distribution.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/SimpleOperations/UniformRandomNumber/#code","title":"Code","text":"

UniformRandomNumber.cs

using System;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid UniformRandomNumber() {\n   // Set the number of random numbers we wish to produce to 3.\n   uint numRand = 3;\n   // Without this line, the random numbers will be the same every iteration.\n   vtkMath.RandomSeed((int)( DateTime.Now.Ticks & 0x0000FFFF ));\n\n   // Generate numRand random numbers from a uniform distribution between 0.0 and 2.0\n   for(uint i = 0; i < numRand; i++) {\n      double a = vtkMath.Random(0.0, 2.0);\n      Console.WriteLine(a);\n   }\n}\n
"},{"location":"CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter/","title":"BandedPolyDataContourFilter","text":"

vtk-examples/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter

"},{"location":"CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter/#description","title":"Description","text":"

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter/#code","title":"Code","text":"

BandedPolyDataContourFilter.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            BandedPolyDataContourFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void BandedPolyDataContourFilter() {\n         vtkPoints pts = vtkPoints.New();\n         pts.InsertPoint(0, 0, 0, 0);\n         pts.InsertPoint(1, 0, 1, 0);\n         pts.InsertPoint(2, 0, 2, 0);\n         pts.InsertPoint(3, 1, 0, 0);\n         pts.InsertPoint(4, 1, 1, 0);\n         pts.InsertPoint(5, 1, 2, 0);\n         pts.InsertPoint(6, 2, 0, 0);\n         pts.InsertPoint(7, 2, 2, 0);\n         pts.InsertPoint(8, 3, 0, 0);\n         pts.InsertPoint(9, 3, 1, 0);\n         pts.InsertPoint(10, 3, 2, 0);\n         pts.InsertPoint(11, 4, 0, 0);\n         pts.InsertPoint(12, 6, 0, 0);\n         pts.InsertPoint(13, 5, 2, 0);\n         pts.InsertPoint(14, 7, 0, 0);\n         pts.InsertPoint(15, 9, 0, 0);\n         pts.InsertPoint(16, 7, 2, 0);\n         pts.InsertPoint(17, 9, 2, 0);\n         pts.InsertPoint(18, 10, 0, 0);\n         pts.InsertPoint(19, 12, 0, 0);\n         pts.InsertPoint(20, 10, 1, 0);\n         pts.InsertPoint(21, 12, 1, 0);\n         pts.InsertPoint(22, 10, 2, 0);\n         pts.InsertPoint(23, 12, 2, 0);\n         pts.InsertPoint(24, 10, 3, 0);\n         pts.InsertPoint(25, 12, 3, 0);\n\n         vtkCellArray polys = vtkCellArray.New();\n         polys.InsertNextCell(4);\n         polys.InsertCellPoint(14);\n         polys.InsertCellPoint(15);\n         polys.InsertCellPoint(17);\n         polys.InsertCellPoint(16);\n         polys.InsertNextCell(3);\n         polys.InsertCellPoint(11);\n         polys.InsertCellPoint(12);\n         polys.InsertCellPoint(13);\n\n         vtkFloatArray scalars = vtkFloatArray.New();\n         scalars.SetNumberOfTuples(26);\n         scalars.SetTuple1(0, 0);\n         scalars.SetTuple1(1, 50);\n         scalars.SetTuple1(2, 100);\n         scalars.SetTuple1(3, 0);\n         scalars.SetTuple1(4, 50);\n         scalars.SetTuple1(5, 100);\n         scalars.SetTuple1(6, 10);\n         scalars.SetTuple1(7, 90);\n         scalars.SetTuple1(8, 10);\n         scalars.SetTuple1(9, 50);\n         scalars.SetTuple1(10, 90);\n         scalars.SetTuple1(11, 10);\n         scalars.SetTuple1(12, 40);\n         scalars.SetTuple1(13, 100);\n         scalars.SetTuple1(14, 0);\n         scalars.SetTuple1(15, 60);\n         scalars.SetTuple1(16, 40);\n         scalars.SetTuple1(17, 100);\n         scalars.SetTuple1(18, 0);\n         scalars.SetTuple1(19, 25);\n         scalars.SetTuple1(20, 25);\n         scalars.SetTuple1(21, 50);\n         scalars.SetTuple1(22, 50);\n         scalars.SetTuple1(23, 75);\n         scalars.SetTuple1(24, 75);\n         scalars.SetTuple1(25, 100);\n\n         vtkPolyData polyData = vtkPolyData.New();\n         polyData.SetPoints(pts);\n         polyData.SetPolys(polys);\n         polyData.GetPointData().SetScalars(scalars);\n\n         vtkBandedPolyDataContourFilter bf = vtkBandedPolyDataContourFilter.New();\n#if VTK_MAJOR_VERSION_5\n         bf.SetInput(polyData);\n#else\n         bf.SetInputData (polyData);\n#endif\n         bf.GenerateValues(3, 25, 75);\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(bf.GetOutputPort());\n         mapper.SetScalarModeToUseCellData();\n         mapper.SetScalarRange(0, 4);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
"},{"location":"CSharp/VisualizationAlgorithms/FilledContours/","title":"FilledContours","text":"

vtk-examples/CSharp/VisualizationAlgorithms/FilledContours

"},{"location":"CSharp/VisualizationAlgorithms/FilledContours/#description","title":"Description","text":"

This example produces filled contours using the [vtkClipPolyData](https://www.vtk.org/doc/nightly/html/classvtkClipPolyData.html#details) filter. There is a sample data file [here](http://public.kitware.com/cgi-bin/viewcvs.cgi/Data/filledContours.vtp?root=VTKData&view=log)

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"CSharp/VisualizationAlgorithms/FilledContours/#code","title":"Code","text":"

FilledContours.cs

using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            FilledContours(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\filledContours.vtp\", 10);\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void FilledContours(string filePath, int numberOfContours) {\n         // Read the file\n         vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n\n         reader.SetFileName(filePath);\n         reader.Update(); // Update so that we can get the scalar range\n\n         double[] scalarRange = reader.GetOutput().GetPointData().GetScalars().GetRange();\n\n         vtkAppendPolyData appendFilledContours = vtkAppendPolyData.New();\n\n         double delta = ( scalarRange[1] - scalarRange[0] ) / ( numberOfContours - 1 );\n\n         // Keep the clippers alive\n         List<vtkClipPolyData>  clippersLo = new List<vtkClipPolyData>();\n         List<vtkClipPolyData>  clippersHi = new List<vtkClipPolyData>();\n\n         for(int i = 0; i < numberOfContours; i++) {\n            double valueLo = scalarRange[0] + i * delta;\n            double valueHi = scalarRange[0] + ( i + 1 ) * delta;\n\n            clippersLo.Add(vtkClipPolyData.New());\n            clippersLo[i].SetValue(valueLo);\n            if(i == 0) {\n               clippersLo[i].SetInputConnection(reader.GetOutputPort());\n            }\n            else {\n               clippersLo[i].SetInputConnection(clippersHi[i - 1].GetOutputPort(1));\n            }\n            clippersLo[i].InsideOutOff();\n            clippersLo[i].Update();\n\n            clippersHi.Add(vtkClipPolyData.New());\n            clippersHi[i].SetValue(valueHi);\n            clippersHi[i].SetInputConnection(clippersLo[i].GetOutputPort());\n            clippersHi[i].GenerateClippedOutputOn();\n            clippersHi[i].InsideOutOn();\n            clippersHi[i].Update();\n            if(clippersHi[i].GetOutput().GetNumberOfCells() == 0) {\n               continue;\n            }\n\n            vtkFloatArray cd = vtkFloatArray.New();\n            cd.SetNumberOfComponents(1);\n            cd.SetNumberOfTuples(clippersHi[i].GetOutput().GetNumberOfCells());\n            cd.FillComponent(0, valueLo);\n\n            clippersHi[i].GetOutput().GetCellData().SetScalars(cd);\n            appendFilledContours.AddInputConnection(clippersHi[i].GetOutputPort());\n         }\n\n         vtkCleanPolyData filledContours = vtkCleanPolyData.New();\n         filledContours.SetInputConnection(appendFilledContours.GetOutputPort());\n\n         vtkLookupTable lut = vtkLookupTable.New();\n         lut.SetNumberOfTableValues(numberOfContours + 1);\n         lut.Build();\n         vtkPolyDataMapper contourMapper = vtkPolyDataMapper.New();\n         contourMapper.SetInputConnection(filledContours.GetOutputPort());\n         contourMapper.SetScalarRange(scalarRange[0], scalarRange[1]);\n         contourMapper.SetScalarModeToUseCellData();\n         contourMapper.SetLookupTable(lut);\n\n         vtkActor contourActor = vtkActor.New();\n         contourActor.SetMapper(contourMapper);\n         contourActor.GetProperty().SetInterpolationToFlat();\n\n         vtkContourFilter contours = vtkContourFilter.New();\n         contours.SetInputConnection(filledContours.GetOutputPort());\n         contours.GenerateValues(numberOfContours, scalarRange[0], scalarRange[1]);\n\n         vtkPolyDataMapper contourLineMapperer = vtkPolyDataMapper.New();\n         contourLineMapperer.SetInputConnection(contours.GetOutputPort());\n         contourLineMapperer.SetScalarRange(scalarRange[0], scalarRange[1]);\n         contourLineMapperer.ScalarVisibilityOff();\n\n         vtkActor contourLineActor = vtkActor.New();\n         contourLineActor.SetMapper(contourLineMapperer);\n         contourLineActor.GetProperty().SetLineWidth(2);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(contourActor);\n         renderer.AddActor(contourLineActor);\n      }\n   }\n}\n
"},{"location":"Cxx/Snippets/","title":"Snippets","text":""},{"location":"Cxx/Snippets/#description","title":"Description","text":"

Snippets are chunks of code that can be cut (snipped) and pasted into examples. We want each example to be stand-alone, so we do not keep the snippet code in a library.

"},{"location":"Cxx/Snippets/#available-snippets","title":"Available snippets","text":""},{"location":"Cxx/Snippets/#cameraposition","title":"CameraPosition","text":"

Output the camera position while moving the image.

"},{"location":"Cxx/Snippets/#checkvtkversion","title":"CheckVTKVersion","text":"

Check the VTK version returning true if the requested VTK version is >= the current version.

"},{"location":"Cxx/Snippets/#pointtoglyph","title":"PointToGlyph","text":"

Represent points as glyphs.

"},{"location":"Cxx/Snippets/#readpolydata","title":"ReadPolyData","text":"

Uses the appropriate vtkPolyData reader to read any vtkPolyData file.

"},{"location":"Cxx/Snippets/#savescenetofielddata","title":"SaveSceneToFieldData","text":"

Stores the current vtkCamera location in a vtkDataSet's vtkFieldData.

"},{"location":"Cxx/Snippets/#restorescenefromfielddata","title":"RestoreSceneFromFieldData","text":"

Restores the saved vtkCamera view from a vtkDataSet's vtkFieldData.

"},{"location":"Cxx/Snippets/#savescenetofile","title":"SaveSceneToFile","text":"

Stores the current vtkCamera location in a file.

"},{"location":"Cxx/Snippets/#restorescenefromfile","title":"RestoreSceneFromFile","text":"

Restores the saved vtkCamera view from a file.

"},{"location":"Cxx/Snippets/#choosecontrastingcolor","title":"ChooseContrastingColor","text":"

Given a color, find a contrasting color. If the given color is \"light\", use the lightColor otherwise use the darkColor

"},{"location":"Cxx/Snippets/#viewportborders","title":"ViewportBorders","text":"

Draw the borders of a vtkRenderer's viewports.

"},{"location":"Cxx/Snippets/#writeimage","title":"WriteImage","text":"

Take a screen shot and save it to a file.

"},{"location":"Cxx/Animation/AnimateActors/","title":"AnimateActors","text":"

vtk-examples/Cxx/Animation/AnimateActors

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Animation/AnimateActors/#code","title":"Code","text":"

AnimateActors.cxx

#include \"AnimateActors.h\"\n\n#include <vtkAnimationCue.h>\n#include <vtkAnimationScene.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkLogger.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int argc, char* argv[])\n{\n  vtkLogger::Init(argc, argv);\n\n  // Colors\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d coneColor = colors->GetColor3d(\"Tomato\");\n  vtkColor3d sphereColor = colors->GetColor3d(\"Banana\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Peacock\");\n\n  // Create the graphics structure. The renderer renders into the\n  // render window.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(backgroundColor.GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  iren->SetRenderWindow(renWin);\n  renWin->AddRenderer(ren1);\n\n  // Generate a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphere;\n  sphere->SetMapper(sphereMapper);\n  sphere->GetProperty()->SetDiffuseColor(sphereColor.GetData());\n  sphere->GetProperty()->SetDiffuse(.7);\n  sphere->GetProperty()->SetSpecular(.3);\n  sphere->GetProperty()->SetSpecularPower(30.0);\n\n  ren1->AddActor(sphere);\n\n  // Generate a cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetResolution(31);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n  // auto cone = vtkSmartPointer<vtkActor>::New();\n  vtkNew<vtkActor> cone;\n  cone->SetMapper(coneMapper);\n  cone->GetProperty()->SetDiffuseColor(coneColor.GetData());\n\n  ren1->AddActor(cone);\n\n  // Create an Animation Scene\n  vtkNew<vtkAnimationScene> scene;\n  if (argc >= 2 && strcmp(argv[1], \"-real\") == 0)\n  {\n    vtkLogF(INFO, \"real-time mode\");\n    scene->SetModeToRealTime();\n  }\n  else\n  {\n    vtkLogF(INFO, \"sequence mode\");\n    scene->SetModeToSequence();\n  }\n  scene->SetLoop(0);\n  scene->SetFrameRate(5);\n  scene->SetStartTime(0);\n  scene->SetEndTime(20);\n  scene->AddObserver(vtkCommand::AnimationCueTickEvent, renWin.GetPointer(),\n                     &vtkWindow::Render);\n\n  // Create an Animation Cue for each actor\n  vtkNew<vtkAnimationCue> cue1;\n  cue1->SetStartTime(5);\n  cue1->SetEndTime(23);\n  scene->AddCue(cue1);\n\n  vtkNew<vtkAnimationCue> cue2;\n  cue2->SetStartTime(1);\n  cue2->SetEndTime(10);\n  scene->AddCue(cue2);\n\n  // Create an ActorAnimator for each actor;\n  ActorAnimator animateSphere;\n  animateSphere.SetActor(sphere);\n  animateSphere.AddObserversToCue(cue1);\n\n  ActorAnimator animateCone;\n  animateCone.SetEndPosition(vtkVector3d(-1, -1, -1));\n  animateCone.SetActor(cone);\n  animateCone.AddObserversToCue(cue2);\n\n  renWin->SetWindowName(\"AnimateActors\");\n\n  renWin->Render();\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(.5);\n  ren1->ResetCameraClippingRange();\n\n  // Create Cue observer.\n  scene->Play();\n  scene->Stop();\n\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n

AnimateActors.h

#ifndef __AnimateActors_h\n#define __AnimateActors_h\n\n#include <vtkActor.h>\n#include <vtkAnimationCue.h>\n#include <vtkCommand.h>\n#include <vtkVectorOperators.h>\n\nclass ActorAnimator\n{\npublic:\n  ActorAnimator(vtkActor* Actor, const vtkVector3d& StartPosition,\n                const vtkVector3d& EndPosition)\n    : Actor(Actor), StartPosition(StartPosition), EndPosition(EndPosition)\n  {\n  }\n\n  ActorAnimator()\n    : Actor(nullptr), StartPosition(0, 0, 0), EndPosition(0.5, 0.5, 0.5)\n  {\n  }\n\n  ~ActorAnimator() = default;\n\n  void SetActor(vtkActor* actor)\n  {\n    this->Actor = actor;\n  }\n\n  void SetStartPosition(const vtkVector3d& position)\n  {\n    this->StartPosition = position;\n  }\n  void SetEndPosition(const vtkVector3d& position)\n  {\n    this->EndPosition = position;\n  }\n\n  void AddObserversToCue(vtkAnimationCue* cue)\n  {\n    cue->AddObserver(vtkCommand::StartAnimationCueEvent, this,\n                     &ActorAnimator::Start);\n    cue->AddObserver(vtkCommand::EndAnimationCueEvent, this,\n                     &ActorAnimator::End);\n    cue->AddObserver(vtkCommand::AnimationCueTickEvent, this,\n                     &ActorAnimator::Tick);\n  }\n\nprivate:\n  //@{\n  /**\n   * These are callbacks that called when corresponding events are fired by the\n   * cue (see AddObserversToCue)\n   */\n  void Start()\n  {\n    this->Actor->SetPosition(this->StartPosition.GetData());\n  }\n\n  void Tick(vtkObject* vtkNotUsed(caller), unsigned long vtkNotUsed(event),\n            void* calldata)\n  {\n    vtkAnimationCue::AnimationCueInfo* info =\n        reinterpret_cast<vtkAnimationCue::AnimationCueInfo*>(calldata);\n    const double t = (info->AnimationTime - info->StartTime) /\n        (info->EndTime - info->StartTime);\n    vtkVector3d position =\n        this->StartPosition + (this->EndPosition - this->StartPosition) * t;\n    this->Actor->SetPosition(position.GetData());\n  }\n\n  void End()\n  {\n    this->Actor->SetPosition(this->EndPosition.GetData());\n  }\n  //@}\n\n  vtkActor* Actor;\n  vtkVector3d StartPosition;\n  vtkVector3d EndPosition;\n};\n\n#endif // __AnimateActors_h\n
"},{"location":"Cxx/Animation/AnimateActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AnimateActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AnimateActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AnimateActors MACOSX_BUNDLE AnimateActors.cxx )\n  target_link_libraries(AnimateActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AnimateActors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Animation/AnimateActors/#download-and-build-animateactors","title":"Download and Build AnimateActors","text":"

Click here to download AnimateActors and its CMakeLists.txt file. Once the tarball AnimateActors.tar has been downloaded and extracted,

cd AnimateActors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AnimateActors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Animation/RotatingSphere/","title":"RotatingSphere","text":"

vtk-examples/Cxx/Animation/RotatingSphere

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Animation/RotatingSphere/#description","title":"Description","text":"

This example demonstrates how to create a rotating sphere. A timer is used to rotate a sphere along z-axis.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Animation/RotatingSphere/#code","title":"Code","text":"

RotatingSphere.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nclass vtkTimerCallback2 : public vtkCommand\n{\npublic:\n  vtkTimerCallback2() = default;\n  ~vtkTimerCallback2() = default;\n\n  int timerId = 0;\n  static vtkTimerCallback2* New()\n  {\n    vtkTimerCallback2* cb = new vtkTimerCallback2;\n    cb->TimerCount = 0;\n    return cb;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long eventId,\n                       void* vtkNotUsed(callData))\n  {\n    vtkRenderWindowInteractor* iren =\n        dynamic_cast<vtkRenderWindowInteractor*>(caller);\n    if (vtkCommand::TimerEvent == eventId)\n    {\n      ++this->TimerCount;\n    }\n    if (TimerCount < 36)\n    {\n      actor->RotateZ(5);\n      iren->GetRenderWindow()->Render();\n    }\n    else\n    {\n      iren->DestroyTimer();\n    }\n  }\n\nprivate:\n  int TimerCount = 0;\n\npublic:\n  vtkActor* actor;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n  sphereSource->SetThetaResolution(15);\n  sphereSource->SetPhiResolution(15);\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->RotateX(90);\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n\n  renderer->SetBackground(colors->GetColor3d(\"Seashell\").GetData());\n  // Render and interact\n  renderWindow->SetWindowName(\"RotatingSphere\");\n  renderWindow->Render();\n\n  // Initialize must be called prior to creating timer events.\n  renderWindowInteractor->Initialize();\n\n  // Sign up to receive TimerEvent\n  vtkNew<vtkTimerCallback2> cb;\n  cb->actor = actor;\n\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, cb);\n  int timerId = renderWindowInteractor->CreateRepeatingTimer(100);\n  cb->timerId = timerId;\n\n  // Start the interaction and timer\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Animation/RotatingSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotatingSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotatingSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotatingSphere MACOSX_BUNDLE RotatingSphere.cxx )\n  target_link_libraries(RotatingSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotatingSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Animation/RotatingSphere/#download-and-build-rotatingsphere","title":"Download and Build RotatingSphere","text":"

Click here to download RotatingSphere and its CMakeLists.txt file. Once the tarball RotatingSphere.tar has been downloaded and extracted,

cd RotatingSphere/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RotatingSphere\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Annotation/MultiLineText/","title":"MultiLineText","text":"

vtk-examples/Cxx/Annotation/MultiLineText

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Annotation/MultiLineText/#description","title":"Description","text":"

This example demonstrates the use of multiline 2D text using vtkTextMapper. It shows several justifications as well as single-line and multiple-line text inputs.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Annotation/MultiLineText/#code","title":"Code","text":"

MultiLineText.cxx

// This example demonstrates the use of multiline 2D text using\n// vtkTextMappers.  It shows several justifications as well as\n// single-line and multiple-line text inputs.\n\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkCoordinate.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  int font_size = 24;\n\n  // Create the text mappers and the associated Actor2Ds.\n\n  // The font and text properties (except justification) are the same for\n  // each single line mapper. Let's create a common text property object\n  vtkNew<vtkTextProperty> singleLineTextProp;\n\n  singleLineTextProp->SetFontSize(font_size);\n  singleLineTextProp->SetFontFamilyToArial();\n  singleLineTextProp->BoldOff();\n  singleLineTextProp->ItalicOff();\n  singleLineTextProp->ShadowOff();\n\n  // The font and text properties (except justification) are the same for\n  // each multi line mapper. Let's create a common text property object\n  vtkNew<vtkTextProperty> multiLineTextProp;\n\n  multiLineTextProp->ShallowCopy(singleLineTextProp);\n  multiLineTextProp->BoldOn();\n  multiLineTextProp->ItalicOn();\n  multiLineTextProp->ShadowOn();\n  multiLineTextProp->SetLineSpacing(0.8);\n\n  vtkNew<vtkNamedColors> colors;\n\n  // The text is on a single line and bottom-justified.\n  vtkNew<vtkTextMapper> singleLineTextB;\n  singleLineTextB->SetInput(\"Single line (bottom)\");\n  auto tprop = singleLineTextB->GetTextProperty();\n  tprop->ShallowCopy(singleLineTextProp);\n\n  tprop->SetVerticalJustificationToBottom();\n  tprop->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor2D> singleLineTextActorB;\n  singleLineTextActorB->SetMapper(singleLineTextB);\n  singleLineTextActorB->GetPositionCoordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  singleLineTextActorB->GetPositionCoordinate()->SetValue(0.05, 0.85);\n\n  // The text is on a single line and center-justified (vertical\n  // justification).\n  vtkNew<vtkTextMapper> singleLineTextC;\n  singleLineTextC->SetInput(\"Single line (centered)\");\n  tprop = singleLineTextC->GetTextProperty();\n  tprop->ShallowCopy(singleLineTextProp);\n  tprop->SetVerticalJustificationToCentered();\n  tprop->SetColor(colors->GetColor3d(\"DarkGreen\").GetData());\n  vtkNew<vtkActor2D> singleLineTextActorC;\n\n  singleLineTextActorC->SetMapper(singleLineTextC);\n  singleLineTextActorC->GetPositionCoordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  singleLineTextActorC->GetPositionCoordinate()->SetValue(0.05, 0.75);\n\n  // The text is on a single line and top-justified.\n  vtkNew<vtkTextMapper> singleLineTextT;\n  singleLineTextT->SetInput(\"Single line (top)\");\n  tprop = singleLineTextT->GetTextProperty();\n  tprop->ShallowCopy(singleLineTextProp);\n  tprop->SetVerticalJustificationToTop();\n  tprop->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkActor2D> singleLineTextActorT;\n  singleLineTextActorT->SetMapper(singleLineTextT);\n  singleLineTextActorT->GetPositionCoordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  singleLineTextActorT->GetPositionCoordinate()->SetValue(0.05, 0.65);\n\n  // The text is on multiple lines and left- and top-justified.\n  vtkNew<vtkTextMapper> textMapperL;\n  textMapperL->SetInput(\"This is\\nmulti-line\\ntext output\\n(left-top)\");\n  tprop = textMapperL->GetTextProperty();\n  tprop->ShallowCopy(multiLineTextProp);\n  tprop->SetJustificationToLeft();\n  tprop->SetVerticalJustificationToTop();\n  tprop->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor2D> textActorL;\n  textActorL->SetMapper(textMapperL);\n  textActorL->GetPositionCoordinate()->SetCoordinateSystemToNormalizedDisplay();\n  textActorL->GetPositionCoordinate()->SetValue(0.05, 0.5);\n\n  // The text is on multiple lines and center-justified (both horizontal and\n  // vertical).\n  vtkNew<vtkTextMapper> textMapperC;\n  textMapperC->SetInput(\"This is\\nmulti-line\\ntext output\\n(centered)\");\n  tprop = textMapperC->GetTextProperty();\n  tprop->ShallowCopy(multiLineTextProp);\n  tprop->SetJustificationToCentered();\n  tprop->SetVerticalJustificationToCentered();\n  tprop->SetColor(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  vtkNew<vtkActor2D> textActorC;\n  textActorC->SetMapper(textMapperC);\n  textActorC->GetPositionCoordinate()->SetCoordinateSystemToNormalizedDisplay();\n  textActorC->GetPositionCoordinate()->SetValue(0.5, 0.5);\n\n  // The text is on multiple lines and right- and bottom-justified.\n  vtkNew<vtkTextMapper> textMapperR;\n  textMapperR->SetInput(\"This is\\nmulti-line\\ntext output\\n(right-bottom)\");\n  tprop = textMapperR->GetTextProperty();\n  tprop->ShallowCopy(multiLineTextProp);\n  tprop->SetJustificationToRight();\n  tprop->SetVerticalJustificationToBottom();\n  tprop->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkActor2D> textActorR;\n  textActorR->SetMapper(textMapperR);\n  textActorR->GetPositionCoordinate()->SetCoordinateSystemToNormalizedDisplay();\n  textActorR->GetPositionCoordinate()->SetValue(0.95, 0.5);\n\n  // Draw the grid to demonstrate the placement of the text.\n\n  // Set up the necessary points.\n  vtkNew<vtkPoints> Pts;\n  Pts->InsertNextPoint(0.05, 0.0, 0.0);\n  Pts->InsertNextPoint(0.05, 1.0, 0.0);\n  Pts->InsertNextPoint(0.5, 0.0, 0.0);\n  Pts->InsertNextPoint(0.5, 1.0, 0.0);\n  Pts->InsertNextPoint(0.95, 0.0, 0.0);\n  Pts->InsertNextPoint(0.95, 1.0, 0.0);\n  Pts->InsertNextPoint(0.0, 0.5, 0.0);\n  Pts->InsertNextPoint(1.0, 0.5, 0.0);\n  Pts->InsertNextPoint(0.00, 0.85, 0.0);\n  Pts->InsertNextPoint(0.50, 0.85, 0.0);\n  Pts->InsertNextPoint(0.00, 0.75, 0.0);\n  Pts->InsertNextPoint(0.50, 0.75, 0.0);\n  Pts->InsertNextPoint(0.00, 0.65, 0.0);\n  Pts->InsertNextPoint(0.50, 0.65, 0.0);\n\n  // Set up the lines that use these points.\n  vtkNew<vtkCellArray> Lines;\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(0);\n  Lines->InsertCellPoint(1);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(2);\n  Lines->InsertCellPoint(3);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(4);\n  Lines->InsertCellPoint(5);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(6);\n  Lines->InsertCellPoint(7);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(8);\n  Lines->InsertCellPoint(9);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(10);\n  Lines->InsertCellPoint(11);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(12);\n  Lines->InsertCellPoint(13);\n\n  // Create a grid that uses these points and lines.\n  vtkNew<vtkPolyData> Grid;\n  Grid->SetPoints(Pts);\n  Grid->SetLines(Lines);\n  // Set up the coordinate system.\n  vtkNew<vtkCoordinate> normCoords;\n  normCoords->SetCoordinateSystemToNormalizedViewport();\n\n  // Set up the mapper and actor (2D) for the grid.\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(Grid);\n  mapper->SetTransformCoordinate(normCoords);\n  vtkNew<vtkActor2D> gridActor;\n  gridActor->SetMapper(mapper);\n  gridActor->GetProperty()->SetColor(colors->GetColor3d(\"DimGray\").GetData());\n\n  // Create the Renderer, RenderWindow, and RenderWindowInteractor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer; set the background and size; zoom in\n  // closer to the image; render\n  renderer->AddActor2D(textActorL);\n  renderer->AddActor2D(textActorC);\n  renderer->AddActor2D(textActorR);\n  renderer->AddActor2D(singleLineTextActorB);\n  renderer->AddActor2D(singleLineTextActorC);\n  renderer->AddActor2D(singleLineTextActorT);\n  renderer->AddActor2D(gridActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderer->GetActiveCamera()->Zoom(1.5);\n\n  interactor->Initialize();\n  renderWindow->SetWindowName(\"MultiLineText\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Annotation/MultiLineText/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultiLineText)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultiLineText: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultiLineText MACOSX_BUNDLE MultiLineText.cxx )\n  target_link_libraries(MultiLineText PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultiLineText\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Annotation/MultiLineText/#download-and-build-multilinetext","title":"Download and Build MultiLineText","text":"

Click here to download MultiLineText and its CMakeLists.txt file. Once the tarball MultiLineText.tar has been downloaded and extracted,

cd MultiLineText/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MultiLineText\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Annotation/TextOrigin/","title":"TextOrigin","text":"

vtk-examples/Cxx/Annotation/TextOrigin

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Annotation/TextOrigin/#description","title":"Description","text":"

This example demonstrates the use of vtkVectorText and vtkFollower. vtkVectorText is used to create 3D annotation. vtkFollower is used to position the 3D text and to ensure that the text always faces the renderer's active camera (i.e., the text is always readable).

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Annotation/TextOrigin/#code","title":"Code","text":"

TextOrigin.cxx

// This example demonstrates the use of vtkVectorText and vtkFollower.\n// vtkVectorText is used to create 3D annotation.  vtkFollower is used to\n// position the 3D text and to ensure that the text always faces the\n// renderer's active camera (i.e., the text is always readable).\n\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkFollower.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorText.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the axes and the associated mapper and actor.\n  vtkNew<vtkAxes> axes;\n  axes->SetOrigin(0, 0, 0);\n  vtkNew<vtkPolyDataMapper> axesMapper;\n  axesMapper->SetInputConnection(axes->GetOutputPort());\n  vtkNew<vtkActor> axesActor;\n  axesActor->SetMapper(axesMapper);\n\n  // Create the 3D text and the associated mapper and follower (a type of\n  // actor).  Position the text so it is displayed over the origin of the\n  // axes.\n  vtkNew<vtkVectorText> atext;\n  atext->SetText(\"Origin\");\n  vtkNew<vtkPolyDataMapper> textMapper;\n  textMapper->SetInputConnection(atext->GetOutputPort());\n  vtkNew<vtkFollower> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetScale(0.2, 0.2, 0.2);\n  textActor->AddPosition(0, -0.1, 0);\n  textActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create the Renderer, RenderWindow, and RenderWindowInteractor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  // Add the actors to the renderer.\n  renderer->AddActor(axesActor);\n  renderer->AddActor(textActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  // Zoom in closer.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.6);\n\n  // Reset the clipping range of the camera; set the camera of the\n  // follower; render.\n  renderer->ResetCameraClippingRange();\n  textActor->SetCamera(renderer->GetActiveCamera());\n\n  interactor->Initialize();\n  renderWindow->SetWindowName(\"TextOrigin\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Annotation/TextOrigin/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextOrigin)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextOrigin: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextOrigin MACOSX_BUNDLE TextOrigin.cxx )\n  target_link_libraries(TextOrigin PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextOrigin\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Annotation/TextOrigin/#download-and-build-textorigin","title":"Download and Build TextOrigin","text":"

Click here to download TextOrigin and its CMakeLists.txt file. Once the tarball TextOrigin.tar has been downloaded and extracted,

cd TextOrigin/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TextOrigin\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Annotation/XYPlot/","title":"XYPlot","text":"

vtk-examples/Cxx/Annotation/XYPlot

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Annotation/XYPlot/#description","title":"Description","text":"

This example demonstrates the use of vtkXYPlotActor to display three probe lines using three different techniques. In this example, we are loading data using the vtkPLOT3DReader. We are using the vtkProbeFilter to extract the underlying point data along three probe lines.

Note

The image was generated with this volume data: src/Testing/Data/combxyz.bin and src/Testing/Data/combq.bin?raw=true.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Annotation/XYPlot/#code","title":"Code","text":"

XYPlot.cxx

// This example demonstrates the use of vtkXYPlotActor to display three\n// probe lines using three different techniques.  In this example, we\n// are loading data using the vtkPLOT3DReader.  We are using the\n// vtkProbeFilter to extract the underlying point data along three\n// probe lines.\n\n#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkLineSource.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkXYPlotActor.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create a PLOT3D reader and load the data.\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  auto pl3d_output =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // Create three line sources to use for the probe lines.\n  vtkNew<vtkLineSource> line;\n  line->SetResolution(30);\n\n  // Move the line into place and create the probe filter. For\n  // vtkProbeFilter, the probe line is the input, and the underlying data\n  // set is the source.\n  vtkNew<vtkTransform> transL1;\n  transL1->Translate(3.7, 0.0, 28.37);\n  transL1->Scale(5, 5, 5);\n  transL1->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> tf;\n  tf->SetInputConnection(line->GetOutputPort());\n  tf->SetTransform(transL1);\n\n  vtkNew<vtkProbeFilter> probe;\n  probe->SetInputConnection(tf->GetOutputPort());\n  probe->SetSourceData(pl3d_output);\n\n  // Move the line again and create another probe filter.\n  vtkNew<vtkTransform> transL2;\n  transL2->Translate(9.2, 0.0, 31.20);\n  transL2->Scale(5, 5, 5);\n  transL2->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> tf2;\n  tf2->SetInputConnection(line->GetOutputPort());\n  tf2->SetTransform(transL2);\n  vtkNew<vtkProbeFilter> probe2;\n  probe2->SetInputConnection(tf2->GetOutputPort());\n  probe2->SetSourceData(pl3d_output);\n\n  // Move the line again and create a third probe filter.\n  vtkNew<vtkTransform> transL3;\n  transL3->Translate(13.27, 0.0, 33.40);\n  transL3->Scale(4.5, 4.5, 4.5);\n  transL3->RotateY(90);\n  vtkNew<vtkTransformPolyDataFilter> tf3;\n  tf3->SetInputConnection(line->GetOutputPort());\n  tf3->SetTransform(transL3);\n  vtkNew<vtkProbeFilter> probe3;\n  probe3->SetInputConnection(tf3->GetOutputPort());\n  probe3->SetSourceData(pl3d_output);\n\n  // Create a vtkAppendPolyData to merge the output of the three probe\n  // filters into one data set.\n  vtkNew<vtkAppendPolyData> appendF;\n  appendF->AddInputConnection(probe->GetOutputPort());\n  appendF->AddInputConnection(probe2->GetOutputPort());\n  appendF->AddInputConnection(probe3->GetOutputPort());\n\n  // Create a tube filter to represent the lines as tubes.  Set up the\n  // associated mapper and actor.\n  vtkNew<vtkTubeFilter> tuber;\n  tuber->SetInputConnection(appendF->GetOutputPort());\n  tuber->SetRadius(0.1);\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(tuber->GetOutputPort());\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n\n  // Create an xy-plot using the output of the 3 probe filters as input.\n  // The x-values we are plotting are arc length.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXYPlotActor> xyplot;\n  xyplot->AddDataSetInputConnection(probe->GetOutputPort());\n  xyplot->AddDataSetInputConnection(probe2->GetOutputPort());\n  xyplot->AddDataSetInputConnection(probe3->GetOutputPort());\n  xyplot->GetPositionCoordinate()->SetValue(0.0, 0.67, 0);\n  xyplot->GetPosition2Coordinate()->SetValue(1.0, 0.33,\n                                             0); // relative to Position;\n  xyplot->SetXValuesToArcLength();\n  xyplot->SetNumberOfXLabels(6);\n  xyplot->SetTitle(\"Pressure vs. Arc Length (Zoomed View)\");\n  xyplot->SetXTitle(\"\");\n  xyplot->SetYTitle(\"P\");\n  xyplot->SetXRange(.1, .35);\n  xyplot->SetYRange(.2, .4);\n  xyplot->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  xyplot->GetProperty()->SetLineWidth(2);\n  // Set text prop color\n  // Assign same object to all text props\n  vtkTextProperty* tprop = xyplot->GetTitleTextProperty();\n  tprop->SetColor(xyplot->GetProperty()->GetColor());\n  xyplot->SetAxisTitleTextProperty(tprop);\n  xyplot->SetAxisLabelTextProperty(tprop);\n\n  // Create an xy-plot using the output of the 3 probe filters as input.\n  // The x-values we are plotting are normalized arc length.\n  vtkNew<vtkXYPlotActor> xyplot2;\n  xyplot2->AddDataSetInputConnection(probe->GetOutputPort());\n  xyplot2->AddDataSetInputConnection(probe2->GetOutputPort());\n  xyplot2->AddDataSetInputConnection(probe3->GetOutputPort());\n  xyplot2->GetPositionCoordinate()->SetValue(0.00, 0.33, 0);\n  xyplot2->GetPosition2Coordinate()->SetValue(1.0, 0.33,\n                                              0); // relative to Position;\n  xyplot2->SetXValuesToNormalizedArcLength();\n  xyplot2->SetNumberOfXLabels(6);\n  xyplot2->SetTitle(\"Pressure vs. Normalized Arc Length\");\n  xyplot2->SetXTitle(\"\");\n  xyplot2->SetYTitle(\"P\");\n  xyplot2->PlotPointsOn();\n  xyplot2->PlotLinesOff();\n  xyplot2->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  xyplot2->GetProperty()->SetPointSize(5);\n  // Set text prop color\n  // Assign same object to all text props\n  tprop = xyplot2->GetTitleTextProperty();\n  tprop->SetColor(xyplot2->GetProperty()->GetColor());\n  xyplot2->SetAxisTitleTextProperty(tprop);\n  xyplot2->SetAxisLabelTextProperty(tprop);\n\n  // Create an xy-plot using the output of the 3 probe filters as input.\n  // The x-values we are plotting are the underlying point data values.\n  vtkNew<vtkXYPlotActor> xyplot3;\n  xyplot3->AddDataSetInputConnection(probe->GetOutputPort());\n  xyplot3->AddDataSetInputConnection(probe2->GetOutputPort());\n  xyplot3->AddDataSetInputConnection(probe3->GetOutputPort());\n  xyplot3->GetPositionCoordinate()->SetValue(0.0, 0.0, 0);\n  xyplot3->GetPosition2Coordinate()->SetValue(1.0, 0.33,\n                                              0); // relative to Position;\n  xyplot3->SetXValuesToIndex();\n  xyplot3->SetNumberOfXLabels(6);\n  xyplot3->SetTitle(\"Pressure vs. Point Id\");\n  xyplot3->SetXTitle(\"Probe Length\");\n  xyplot3->SetYTitle(\"P\");\n  xyplot3->PlotPointsOn();\n  xyplot3->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  xyplot3->GetProperty()->SetPointSize(3);\n  // Set text prop color\n  // Assign same object to all text props\n  tprop = xyplot3->GetTitleTextProperty();\n  tprop->SetColor(xyplot3->GetProperty()->GetColor());\n  xyplot3->SetAxisTitleTextProperty(tprop);\n  xyplot3->SetAxisLabelTextProperty(tprop);\n\n  // Draw an outline of the PLOT3D data set.\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3d_output);\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the Renderers, RenderWindow, and RenderWindowInteractor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderer> renderer2;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->AddRenderer(renderer2);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Set the background, viewport (necessary because we want to have the\n  // renderers draw to different parts of the render window) of the first\n  // renderer.  Add the outline and line actors to the renderer.\n  renderer->SetBackground(colors->GetColor3d(\"blue_light\").GetData());\n  renderer->SetViewport(0, 0, .5, 1);\n  renderer->AddActor(outlineActor);\n  renderer->AddActor(lineActor);\n\n  // Set the background and viewport of the second renderer.  Add the\n  // xy-plot actors to the renderer.  Set the size of the render window.\n  renderer2->SetBackground(colors->GetColor3d(\"silver\").GetData());\n  renderer2->SetViewport(0.5, 0.0, 1.0, 1.0);\n  renderer2->AddActor2D(xyplot);\n  renderer2->AddActor2D(xyplot2);\n  renderer2->AddActor2D(xyplot3);\n  renderWindow->SetSize(800, 600);\n\n  // Set up the camera parameters.\n  vtkCamera* cam1 = renderer->GetActiveCamera();\n  cam1->SetClippingRange(3.95297, 100);\n  cam1->SetFocalPoint(8.88908, 0.595038, 29.3342);\n  cam1->SetPosition(-12.3332, 31.7479, 41.2387);\n  cam1->SetViewUp(0.060772, -0.319905, 0.945498);\n\n  interactor->Initialize();\n  renderWindow->SetWindowName(\"XYPlot\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Annotation/XYPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(XYPlot)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"XYPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(XYPlot MACOSX_BUNDLE XYPlot.cxx )\n  target_link_libraries(XYPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS XYPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Annotation/XYPlot/#download-and-build-xyplot","title":"Download and Build XYPlot","text":"

Click here to download XYPlot and its CMakeLists.txt file. Once the tarball XYPlot.tar has been downloaded and extracted,

cd XYPlot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./XYPlot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/CMakeTechniques/CheckForModule/","title":"CheckForModule","text":"

vtk-examples/Cxx/CMakeTechniques/CheckForModule

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/CMakeTechniques/CheckForModule/#code","title":"Code","text":"

CheckForModule.cxx

#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n\n  return EXIT_SUCCESS;\n}\n
cmake_minimum_required(VERSION 2.6)\n\nproject(CheckForModule)\n\nfind_package(VTK REQUIRED)\ninclude(${VTK_USE_FILE})\n\nfind_package(VTK REQUIRED)\nif(NOT vtkIOParallel_LOADED)\n  message(FATAL_ERROR \"vtkIOParallel is required but not available.\")\nendif()\n\nadd_executable(CheckForModule CheckForModule.cxx)\ntarget_link_libraries(CheckForModule ${VTK_LIBRARIES})\n
"},{"location":"Cxx/CompositeData/CompositePolyDataMapper/","title":"CompositePolyDataMapper","text":"

vtk-examples/Cxx/CompositeData/CompositePolyDataMapper

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/CompositeData/CompositePolyDataMapper/#code","title":"Code","text":"

CompositePolyDataMapper.cxx

#include <vtkActor.h>\n#include <vtkCompositeDataDisplayAttributes.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n\n#ifdef VTK_VERSION_NUMBER\n#if VTK_VERSION_NUMBER >= 90020230516ULL\n#define VTK_USE_CPD 1\n#include <vtkCompositePolyDataMapper.h>\n#else\n#include <vtkCompositePolyDataMapper2.h>\n#endif\n#endif\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphere1;\n  sphere1->SetRadius(3);\n  sphere1->SetCenter(0, 0, 0);\n  sphere1->Update();\n  vtkNew<vtkSphereSource> sphere2;\n  sphere2->SetRadius(2);\n  sphere2->SetCenter(2, 0, 0);\n  sphere2->Update();\n\n  vtkNew<vtkMultiBlockDataSet> mbds;\n  mbds->SetNumberOfBlocks(3);\n  mbds->SetBlock(0, sphere1->GetOutput());\n  // Leave block 1 NULL.  NULL blocks are valid and should be handled by\n  // algorithms that process multiblock datasets.  Especially when\n  // running in parallel where the blocks owned by other processes are\n  // NULL in this process.\n  mbds->SetBlock(2, sphere2->GetOutput());\n\n#ifdef VTK_USE_CPD\n  vtkNew<vtkCompositePolyDataMapper> mapper;\n#else\n  vtkNew<vtkCompositePolyDataMapper2> mapper;\n#endif\n  mapper->SetInputDataObject(mbds.GetPointer());\n  vtkNew<vtkCompositeDataDisplayAttributes> cdsa;\n  mapper->SetCompositeDataDisplayAttributes(cdsa.Get());\n\n  // You can use the vtkCompositeDataDisplayAttributes to set the color,\n  // opacity and visibiliy of individual blocks of the multiblock dataset.\n  // Attributes are mapped by block pointers (vtkDataObject*), so these can\n  // be queried by their flat index through a convenience function in the\n  // attribute class (vtkCompositeDataDisplayAttributes::DataObjectFromIndex).\n  // Alternatively, one can set attributes directly through the mapper using\n  // flat indices.\n  //\n  // This sets the block at flat index 2 red\n  // Note that the index is the flat index in the tree, so the whole multiblock\n  // is index 0 and the blocks are flat indexes 1, 2 and 3.  This affects\n  // the block returned by mbds->GetBlock(2).\n  mapper->SetBlockColor(2, colors->GetColor3d(\"Red\").GetData());\n  // Color the spheres.\n  mapper->SetBlockColor(1, colors->GetColor3d(\"LavenderBlush\").GetData());\n  mapper->SetBlockColor(3, colors->GetColor3d(\"Lavender\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper.Get());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer.Get());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow.Get());\n\n  renderer->AddActor(actor.Get());\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->SetWindowName(\"CompositePolyDataMapper\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/CompositeData/CompositePolyDataMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CompositePolyDataMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CompositePolyDataMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CompositePolyDataMapper MACOSX_BUNDLE CompositePolyDataMapper.cxx )\n  target_link_libraries(CompositePolyDataMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CompositePolyDataMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/CompositeData/CompositePolyDataMapper/#download-and-build-compositepolydatamapper","title":"Download and Build CompositePolyDataMapper","text":"

Click here to download CompositePolyDataMapper and its CMakeLists.txt file. Once the tarball CompositePolyDataMapper.tar has been downloaded and extracted,

cd CompositePolyDataMapper/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CompositePolyDataMapper\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/CompositeData/Generate2DAMRDataSetWithPulse/","title":"Generate2DAMRDataSetWithPulse","text":"

vtk-examples/Cxx/CompositeData/Generate2DAMRDataSetWithPulse

"},{"location":"Cxx/CompositeData/Generate2DAMRDataSetWithPulse/#description","title":"Description","text":"

This utility code generates a simple 2D AMR dataset with a Gaussian pulse at the center. The resulting AMR dataset is written using the vtkXMLHierarchicalBoxDataSetWriter.

Note

This original source code for this example is here.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/CompositeData/Generate2DAMRDataSetWithPulse/#code","title":"Code","text":"

Generate2DAMRDataSetWithPulse.cxx

// .NAME Generate2DAMRDataSetWithPulse.cxx -- Generates sample 2-D AMR dataset\n//\n// .SECTION Description\n//  This utility code generates a simple 2D AMR dataset with a gaussian\n//  pulse at the center. The resulting AMR dataset is written using the\n//  vtkXMLHierarchicalBoxDataSetWriter.\n\n#include <cmath>\n#include <iostream>\n#include <sstream>\n\n#include <vtkAMRBox.h>\n#include <vtkAMRUtilities.h>\n#include <vtkCell.h>\n#include <vtkCellData.h>\n#include <vtkCompositeDataWriter.h>\n#include <vtkDoubleArray.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNew.h>\n#include <vtkOverlappingAMR.h>\n#include <vtkSmartPointer.h>\n#include <vtkUniformGrid.h>\n#include <vtkXMLImageDataWriter.h>\n#include <vtkXMLMultiBlockDataWriter.h>\n\nnamespace AMRCommon {\nvoid WriteUniformGrid(vtkUniformGrid* g, const std::string& prefix);\nvoid WriteAMRData(vtkOverlappingAMR* amrData, const std::string& prefix);\nvoid WriteMultiBlockData(vtkMultiBlockDataSet* mbds, const std::string& prefix);\nvtkSmartPointer<vtkUniformGrid> GetGrid(double* origin, double* h, int* ndim);\nvoid ComputeCellCenter(vtkUniformGrid* grid, const int cellIdx, double c[3]);\n} // namespace AMRCommon\n\nnamespace {\nstruct PulseAttributes\n{\n  double origin[3]; // xyz for the center of the pulse\n  double width[3];  // the width of the pulse\n  double amplitude; // the amplitude of the pulse\n} Pulse;\n//\n// Function prototype declarations\n//\n\n// Description:\n// Sets the pulse attributes\nvoid SetPulse();\n\n// Description:\n// Constructs the vtkOverlappingAMR.\nvtkSmartPointer<vtkOverlappingAMR> GetAMRDataSet();\n\n// Description:\n// Attaches the pulse to the given grid.\nvoid AttachPulseToGrid(vtkUniformGrid* grid);\n} // namespace\n\n//\n// Program main\n//\nint main(int, char*[])\n{\n  // STEP 0: Initialize gaussian pulse parameters\n  SetPulse();\n\n  // STEP 1: Get the AMR dataset\n  auto amrDataSet = GetAMRDataSet();\n  AMRCommon::WriteAMRData(amrDataSet, \"Gaussian2D\");\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n//=============================================================================\n//                    Function Prototype Implementation\n//=============================================================================\n\nvoid SetPulse()\n{\n  Pulse.origin[0] = Pulse.origin[1] = Pulse.origin[2] = -1.0;\n  Pulse.width[0] = Pulse.width[1] = Pulse.width[2] = 6.0;\n  Pulse.amplitude = 0.0001;\n}\n\n//------------------------------------------------------------------------------\nvoid AttachPulseToGrid(vtkUniformGrid* grid)\n{\n  vtkNew<vtkDoubleArray> xyz;\n  xyz->SetName(\"GaussianPulse\");\n  xyz->SetNumberOfComponents(1);\n  xyz->SetNumberOfTuples(grid->GetNumberOfCells());\n\n  for (int cellIdx = 0; cellIdx < grid->GetNumberOfCells(); ++cellIdx)\n  {\n    double center[3];\n    AMRCommon::ComputeCellCenter(grid, cellIdx, center);\n\n    auto r = 0.0;\n    for (auto i = 0; i < 2; ++i)\n    {\n      auto dx = center[i] - Pulse.origin[i];\n      r += (dx * dx) / (Pulse.width[i] * Pulse.width[i]);\n    }\n    auto f = Pulse.amplitude * std::exp(-r);\n\n    xyz->SetTuple1(cellIdx, f);\n  } // END for all cells\n\n  grid->GetCellData()->AddArray(xyz);\n}\n\n//------------------------------------------------------------------------------\nvtkSmartPointer<vtkOverlappingAMR> GetAMRDataSet()\n{\n  int NumLevels = 2;\n  int BlocksPerLevel[2] = {1, 2};\n  double origin[3] = {-2.0, -2.0, 0.0};\n\n  vtkNew<vtkOverlappingAMR> data;\n  data->Initialize(NumLevels, BlocksPerLevel);\n  data->SetOrigin(origin);\n  data->SetGridDescription(VTK_XY_PLANE);\n\n  double h[3] = {1.0, 1.0, 1.0};\n  int ndim[3] = {6, 5, 1};\n\n  // Root Block -- Block 0,0\n  auto blockId = 0;\n  auto level = 0;\n  auto root = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box(origin, ndim, h, data->GetOrigin(), data->GetGridDescription());\n  AttachPulseToGrid(root);\n\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box);\n  data->SetDataSet(level, blockId, root);\n\n  // Block 1,0\n  ndim[0] = ndim[1] = 9;\n  ndim[2] = 1;\n  h[0] = h[1] = h[2] = 0.25;\n  origin[0] = origin[1] = -2.0;\n  origin[2] = 0.0;\n  blockId = 0;\n  level = 1;\n  auto grid1 = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box1(origin, ndim, h, data->GetOrigin(),\n                 data->GetGridDescription());\n  AttachPulseToGrid(grid1);\n\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box1);\n  data->SetDataSet(level, blockId, grid1);\n\n  // Block 1,1\n  ndim[0] = ndim[1] = 9;\n  ndim[2] = 1;\n  h[0] = h[1] = h[2] = 0.25;\n  origin[0] = 1.0;\n  origin[1] = origin[2] = 0.0;\n  blockId = 1;\n  level = 1;\n  auto grid3 = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box3(origin, ndim, h, data->GetOrigin(),\n                 data->GetGridDescription());\n\n  AttachPulseToGrid(grid3);\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box3);\n  data->SetDataSet(level, blockId, grid3);\n\n  vtkAMRUtilities::BlankCells(data);\n  data->Audit();\n  return (data);\n}\n} // namespace\n\nnamespace AMRCommon {\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes a uniform grid as a structure grid\nvoid WriteUniformGrid(vtkUniformGrid* g, const std::string& prefix)\n{\n  vtkNew<vtkXMLImageDataWriter> imgWriter;\n\n  std::ostringstream oss;\n  oss << prefix << \".\" << imgWriter->GetDefaultFileExtension();\n  imgWriter->SetFileName(oss.str().c_str());\n  imgWriter->SetInputData(g);\n  imgWriter->Write();\n}\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes the given AMR dataset to a *.vth file with the given prefix.\nvoid WriteAMRData(vtkOverlappingAMR* amrData, const std::string& prefix)\n{\n  vtkNew<vtkCompositeDataWriter> writer;\n\n  std::ostringstream oss;\n  oss << prefix << \".vthb\";\n  writer->SetFileName(oss.str().c_str());\n  writer->SetInputData(amrData);\n  writer->Write();\n}\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes the given multi-block data to an XML file with the prescribed prefix\nvoid WriteMultiBlockData(vtkMultiBlockDataSet* mbds, const std::string& prefix)\n{\n  // Sanity check\n  vtkNew<vtkXMLMultiBlockDataWriter> writer;\n\n  std::ostringstream oss;\n  oss.str(\"\");\n  oss.clear();\n  oss << prefix << \".\" << writer->GetDefaultFileExtension();\n  writer->SetFileName(oss.str().c_str());\n  writer->SetInputData(mbds);\n  writer->Write();\n}\n\n//------------------------------------------------------------------------------\n// Constructs a uniform grid instance given the prescribed\n// origin, grid spacing and dimensions.\nvtkSmartPointer<vtkUniformGrid> GetGrid(double* origin, double* h, int* ndim)\n{\n  vtkNew<vtkUniformGrid> grd;\n  grd->Initialize();\n  grd->SetOrigin(origin);\n  grd->SetSpacing(h);\n  grd->SetDimensions(ndim);\n  return grd;\n}\n\n//------------------------------------------------------------------------------\n// Computes the cell center for the cell corresponding to cellIdx w.r.t.\n// the given grid. The cell center is stored in the supplied buffer c.\nvoid ComputeCellCenter(vtkUniformGrid* grid, const int cellIdx, double c[3])\n{\n  vtkCell* myCell = grid->GetCell(cellIdx);\n\n  double pCenter[3];\n  double* weights = new double[myCell->GetNumberOfPoints()];\n  int subId = myCell->GetParametricCenter(pCenter);\n  myCell->EvaluateLocation(subId, pCenter, c, weights);\n  delete[] weights;\n}\n\n} // namespace AMRCommon\n
"},{"location":"Cxx/CompositeData/Generate2DAMRDataSetWithPulse/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Generate2DAMRDataSetWithPulse)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOLegacy\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Generate2DAMRDataSetWithPulse: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Generate2DAMRDataSetWithPulse MACOSX_BUNDLE Generate2DAMRDataSetWithPulse.cxx )\n  target_link_libraries(Generate2DAMRDataSetWithPulse PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Generate2DAMRDataSetWithPulse\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/CompositeData/Generate2DAMRDataSetWithPulse/#download-and-build-generate2damrdatasetwithpulse","title":"Download and Build Generate2DAMRDataSetWithPulse","text":"

Click here to download Generate2DAMRDataSetWithPulse and its CMakeLists.txt file. Once the tarball Generate2DAMRDataSetWithPulse.tar has been downloaded and extracted,

cd Generate2DAMRDataSetWithPulse/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Generate2DAMRDataSetWithPulse\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/CompositeData/Generate3DAMRDataSetWithPulse/","title":"Generate3DAMRDataSetWithPulse","text":"

vtk-examples/Cxx/CompositeData/Generate3DAMRDataSetWithPulse

"},{"location":"Cxx/CompositeData/Generate3DAMRDataSetWithPulse/#description","title":"Description","text":"

This utility code generates a simple 3D AMR dataset with a Gaussian pulse at the center. The resulting AMR dataset is written using the vtkXMLHierarchicalBoxDataSetWriter.

Note

The original source code for this example is here.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/CompositeData/Generate3DAMRDataSetWithPulse/#code","title":"Code","text":"

Generate3DAMRDataSetWithPulse.cxx

// .NAME Generate3DAMRDataSetWithPulse.cxx -- Generated sample 3D AMR dataset\n//\n// .SECTION Description\n//  This utility code generates a simple 3D AMR dataset with a gaussian\n//  pulse at the center. The resulting AMR dataset is written using the\n//  vtkXMLHierarchicalBoxDataSetWriter.\n\n#include <cmath>\n#include <iostream>\n#include <sstream>\n\n#include <vtkAMRBox.h>\n#include <vtkAMRUtilities.h>\n#include <vtkCell.h>\n#include <vtkCellData.h>\n#include <vtkCompositeDataWriter.h>\n#include <vtkDoubleArray.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNew.h>\n#include <vtkOverlappingAMR.h>\n#include <vtkUniformGrid.h>\n#include <vtkXMLImageDataWriter.h>\n#include <vtkXMLMultiBlockDataWriter.h>\n#include <vtkXMLUniformGridAMRReader.h>\n\nnamespace {\nnamespace AMRCommon {\nvoid WriteUniformGrid(vtkUniformGrid* g, const std::string& prefix);\nvoid WriteAMRData(vtkOverlappingAMR* amrData, const std::string& prefix);\nvtkSmartPointer<vtkOverlappingAMR> ReadAMRData(const std::string& file);\nvoid WriteMultiBlockData(vtkMultiBlockDataSet* mbds, const std::string& prefix);\nvtkSmartPointer<vtkUniformGrid> GetGrid(double* origin, double* h, int* ndim);\nvoid ComputeCellCenter(vtkUniformGrid* grid, const int cellIdx, double c[3]);\n} // namespace AMRCommon\n} // namespace\n\nnamespace {\nstatic struct PulseAttributes\n{\n  double origin[3]; // xyz for the center of the pulse\n  double width[3];  // the width of the pulse\n  double amplitude; // the amplitude of the pulse\n} Pulse;\n\n//\n// Function prototype declarations\n//\n\n// Description:\n// Sets the pulse attributes\nvoid SetPulse();\n\n// Description:\n// Constructs the vtkOverlappingAMR.\nvtkSmartPointer<vtkOverlappingAMR> GetAMRDataSet();\n\n// Description:\n// Attaches the pulse to the given grid.\nvoid AttachPulseToGrid(vtkUniformGrid* grid);\n} // namespace\n\n//\n// Program main\n//\nint main(int, char*[])\n{\n  // STEP 0: Initialize gaussian pulse parameters\n  SetPulse();\n\n  // STEP 1: Get the AMR dataset\n  auto amrDataSet = GetAMRDataSet();\n  AMRCommon::WriteAMRData(amrDataSet, \"Gaussian3D\");\n  return EXIT_SUCCESS;\n}\nnamespace {\n//=============================================================================\n//                    Function Prototype Implementation\n//=============================================================================\n\nvoid SetPulse()\n{\n  Pulse.origin[0] = Pulse.origin[1] = Pulse.origin[2] = -1.0;\n  Pulse.width[0] = Pulse.width[1] = Pulse.width[2] = 6.0;\n  Pulse.amplitude = 0.0001;\n}\n\n//------------------------------------------------------------------------------\nvoid AttachPulseToGrid(vtkUniformGrid* grid)\n{\n  vtkNew<vtkDoubleArray> xyz;\n  xyz->SetName(\"GaussianPulse\");\n  xyz->SetNumberOfComponents(1);\n  xyz->SetNumberOfTuples(grid->GetNumberOfCells());\n\n  for (int cellIdx = 0; cellIdx < grid->GetNumberOfCells(); ++cellIdx)\n  {\n    double center[3];\n    AMRCommon::ComputeCellCenter(grid, cellIdx, center);\n\n    auto r = 0.0;\n    for (auto i = 0; i < 3; ++i)\n    {\n      auto dx = center[i] - Pulse.origin[i];\n      r += (dx * dx) / (Pulse.width[i] * Pulse.width[i]);\n    }\n    auto f = Pulse.amplitude * std::exp(-r);\n\n    xyz->SetTuple1(cellIdx, f);\n  } // END for all cells\n\n  grid->GetCellData()->AddArray(xyz);\n}\n//------------------------------------------------------------------------------\nvtkSmartPointer<vtkOverlappingAMR> GetAMRDataSet()\n{\n  vtkNew<vtkOverlappingAMR> data;\n  int blocksPerLevel[2] = {1, 3};\n  double globalOrigin[3] = {-2.0, -2.0, -2.0};\n  data->Initialize(2, blocksPerLevel);\n  data->SetOrigin(globalOrigin);\n  data->SetGridDescription(VTK_XYZ_GRID);\n\n  // Root Block -- Block 0\n  double origin[3] = {-2.0, -2.0, -2.0};\n  double h[3] = {1.0, 1.0, 1.0};\n  int ndim[3] = {6, 5, 5};\n\n  auto blockId{0};\n  auto level{0};\n  auto root = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box(origin, ndim, h, data->GetOrigin(), data->GetGridDescription());\n  AttachPulseToGrid(root);\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box);\n  data->SetDataSet(level, blockId, root);\n\n  // Block 1\n  ndim[0] = 3;\n  ndim[1] = ndim[2] = 5;\n  h[0] = h[1] = h[2] = 0.5;\n  origin[0] = origin[1] = origin[2] = -2.0;\n  blockId = 0;\n  level = 1;\n  auto grid1 = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box1(origin, ndim, h, data->GetOrigin(),\n                 data->GetGridDescription());\n  AttachPulseToGrid(grid1);\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box1);\n  data->SetDataSet(level, blockId, grid1);\n\n  // Block 2\n  ndim[0] = 3;\n  ndim[1] = ndim[2] = 5;\n  h[0] = h[1] = h[2] = 0.5;\n  origin[0] = 0.0;\n  origin[1] = origin[2] = -1.0;\n  blockId = 1;\n  level = 1;\n  auto grid2 = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box2(origin, ndim, h, data->GetOrigin(),\n                 data->GetGridDescription());\n  AttachPulseToGrid(grid2);\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box2);\n  data->SetDataSet(level, blockId, grid2);\n\n  // Block 3\n  ndim[0] = 3;\n  ndim[1] = ndim[2] = 7;\n  h[0] = h[1] = h[2] = 0.5;\n  origin[0] = 2.0;\n  origin[1] = origin[2] = -1.0;\n  blockId = 2;\n  level = 1;\n  auto grid3 = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box3(origin, ndim, h, data->GetOrigin(),\n                 data->GetGridDescription());\n  AttachPulseToGrid(grid3);\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box3);\n  data->SetDataSet(level, blockId, grid3);\n\n  vtkAMRUtilities::BlankCells(data);\n  return (data);\n}\n} // namespace\nnamespace {\nnamespace AMRCommon {\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes a uniform grid as a structure grid\nvoid WriteUniformGrid(vtkUniformGrid* g, const std::string& prefix)\n{\n  vtkNew<vtkXMLImageDataWriter> imgWriter;\n  std::ostringstream oss;\n  oss << prefix << \".\" << imgWriter->GetDefaultFileExtension();\n  imgWriter->SetFileName(oss.str().c_str());\n  imgWriter->SetInputData(g);\n  imgWriter->Write();\n}\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes the given AMR dataset to a *.vth file with the given prefix.\nvoid WriteAMRData(vtkOverlappingAMR* amrData, const std::string& prefix)\n{\n  vtkNew<vtkCompositeDataWriter> writer;\n  std::ostringstream oss;\n  oss << prefix << \".vthb\";\n  writer->SetFileName(oss.str().c_str());\n  writer->SetInputData(amrData);\n  writer->Write();\n}\n\n//------------------------------------------------------------------------------\n// Description:\n// Reads AMR data to the given data-structure from the prescribed file.\nvtkSmartPointer<vtkOverlappingAMR> ReadAMRData(const std::string& file)\n{\n  vtkNew<vtkXMLUniformGridAMRReader> myAMRReader;\n\n  std::ostringstream oss;\n  oss << file << \".vthb\";\n\n  std::cout << \"Reading AMR Data from: \" << oss.str() << std::endl;\n\n  myAMRReader->SetFileName(oss.str().c_str());\n  myAMRReader->Update();\n  return vtkOverlappingAMR::SafeDownCast(myAMRReader->GetOutput());\n}\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes the given multi-block data to an XML file with the prescribed prefix\nvoid WriteMultiBlockData(vtkMultiBlockDataSet* mbds, const std::string& prefix)\n{\n  // Sanity check\n  vtkNew<vtkXMLMultiBlockDataWriter> writer;\n  std::ostringstream oss;\n  oss << prefix << \".\" << writer->GetDefaultFileExtension();\n  writer->SetFileName(oss.str().c_str());\n  writer->SetInputData(mbds);\n  writer->Write();\n}\n\n//------------------------------------------------------------------------------\n// Constructs a uniform grid instance given the prescribed\n// origin, grid spacing and dimensions.\nvtkSmartPointer<vtkUniformGrid> GetGrid(double* origin, double* h, int* ndim)\n{\n  vtkNew<vtkUniformGrid> grd;\n  grd->Initialize();\n  grd->SetOrigin(origin);\n  grd->SetSpacing(h);\n  grd->SetDimensions(ndim);\n  return grd;\n}\n\n//------------------------------------------------------------------------------\n// Computes the cell center for the cell corresponding to cellIdx w.r.t.\n// the given grid. The cell center is stored in the supplied buffer c.\nvoid ComputeCellCenter(vtkUniformGrid* grid, const int cellIdx, double c[3])\n{\n  vtkCell* myCell = grid->GetCell(cellIdx);\n\n  double pCenter[3];\n  double* weights = new double[myCell->GetNumberOfPoints()];\n  int subId = myCell->GetParametricCenter(pCenter);\n  myCell->EvaluateLocation(subId, pCenter, c, weights);\n  delete[] weights;\n}\n} // namespace AMRCommon\n} // namespace\n
"},{"location":"Cxx/CompositeData/Generate3DAMRDataSetWithPulse/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Generate3DAMRDataSetWithPulse)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOLegacy\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Generate3DAMRDataSetWithPulse: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Generate3DAMRDataSetWithPulse MACOSX_BUNDLE Generate3DAMRDataSetWithPulse.cxx )\n  target_link_libraries(Generate3DAMRDataSetWithPulse PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Generate3DAMRDataSetWithPulse\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/CompositeData/Generate3DAMRDataSetWithPulse/#download-and-build-generate3damrdatasetwithpulse","title":"Download and Build Generate3DAMRDataSetWithPulse","text":"

Click here to download Generate3DAMRDataSetWithPulse and its CMakeLists.txt file. Once the tarball Generate3DAMRDataSetWithPulse.tar has been downloaded and extracted,

cd Generate3DAMRDataSetWithPulse/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Generate3DAMRDataSetWithPulse\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/CompositeData/MultiBlockDataSet/","title":"MultiBlockDataSet","text":"

vtk-examples/Cxx/CompositeData/MultiBlockDataSet

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/CompositeData/MultiBlockDataSet/#code","title":"Code","text":"

MultiBlockDataSet.cxx

// Demonstrates how to make and use VTK's MultiBlock type data\n\n#include <vtkActor.h>\n#include <vtkCompositeDataGeometryFilter.h>\n#include <vtkExtractEdges.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkVector.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nnamespace {\nvtkSmartPointer<vtkDataSet> CreateSphereDataSet(const vtkVector3d& center,\n                                                double radius = 0.5);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // PART 1 Make some Data.\n  // Make a tree.\n  vtkNew<vtkMultiBlockDataSet> root;\n\n  vtkNew<vtkMultiBlockDataSet> branch;\n  root->SetBlock(0, branch);\n\n  // Make some leaves.\n  branch->SetBlock(0, CreateSphereDataSet({0, 0, 0}));\n  branch->SetBlock(1, CreateSphereDataSet({1.75, 2.5, 0.0}, 1.5));\n  root->SetBlock(1, CreateSphereDataSet({4, 0, 0}, 2.0));\n\n  // Uncomment to inspect.\n  // std::cerr << root->GetClassName() << std::endl;\n  // root->PrintSelf(std::cerr, vtkIndent(0));\n\n  // PART 2 Do something with the data\n  // a non composite aware filter, the pipeline will iterate\n  vtkNew<vtkExtractEdges> edges;\n  edges->SetInputData(root);\n\n  // Uncomment to inspect.\n  // edges->Update();\n  // cerr << edges->GetOutputDataObject(0)->GetClassName() << endl;\n  // edges->GetOutputDataObject(0)->PrintSelf(std::cerr, vtkIndent(0));\n\n  // PART 3 Show the data.\n  // also demonstrate a composite aware filter\n  // this filter aggregates all blocks into one polydata\n  // this is handy for display, although fairly limited.\n  vtkNew<vtkCompositeDataGeometryFilter> polydata;\n  polydata->SetInputConnection(edges->GetOutputPort());\n\n  // Uncomment to inspect.\n  // polydata->Update();\n  // std::cerr << polydata->GetOutput()->GetClassName() << std::endl;\n  // polydata->GetOutput()->PrintSelf(std::cerr, vtkIndent(0));\n\n  // Display the data.\n  vtkNew<vtkRenderer> aren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(0, polydata->GetOutputPort(0));\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  actor->GetProperty()->SetLineWidth(2);\n\n  aren->AddActor(actor);\n  aren->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  renWin->SetWindowName(\"MultiBLockDataSet\");\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkDataSet> CreateSphereDataSet(const vtkVector3d& center,\n                                                double radius)\n{\n  vtkNew<vtkSphereSource> leaf;\n  leaf->SetCenter(center.GetData());\n  leaf->SetRadius(radius);\n  leaf->Update();\n  return leaf->GetOutput();\n}\n\n} // namespace\n
"},{"location":"Cxx/CompositeData/MultiBlockDataSet/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultiBlockDataSet)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultiBlockDataSet: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultiBlockDataSet MACOSX_BUNDLE MultiBlockDataSet.cxx )\n  target_link_libraries(MultiBlockDataSet PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultiBlockDataSet\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/CompositeData/MultiBlockDataSet/#download-and-build-multiblockdataset","title":"Download and Build MultiBlockDataSet","text":"

Click here to download MultiBlockDataSet and its CMakeLists.txt file. Once the tarball MultiBlockDataSet.tar has been downloaded and extracted,

cd MultiBlockDataSet/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MultiBlockDataSet\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/CompositeData/OverlappingAMR/","title":"OverlappingAMR","text":"

vtk-examples/Cxx/CompositeData/OverlappingAMR

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/CompositeData/OverlappingAMR/#code","title":"Code","text":"

OverlappingAMR.cxx

// Demonstrates how to create and populate a VTK's Overlapping AMR Grid\n// type Data\n\n#include <vtkAMRBox.h>\n#include <vtkAMRUtilities.h>\n#include <vtkCompositeDataGeometryFilter.h>\n#include <vtkContourFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkOverlappingAMR.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphere.h>\n#include <vtkUniformGrid.h>\n\nnamespace {\nvoid MakeScalars(int dims[3], double origin[3], double spacing[3],\n                 vtkFloatArray* scalars);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create and populate the AMR dataset.\n  // The dataset should look like\n  // Level 0\n  //   uniform grid, dimensions 11, 11, 11, AMR box (0, 0, 0) - (9, 9, 9)\n  // Level 1 - refinement ratio : 2\n  //   uniform grid, dimensions 11, 11, 11, AMR box (0, 0, 0) - (9, 9, 9)\n  //   uniform grid, dimensions 11, 11, 11, AMR box (10, 10, 10) - (19, 19, 19)\n  // Use MakeScalars() above to fill the scalar arrays.\n\n  vtkNew<vtkOverlappingAMR> amr;\n  int blocksPerLevel[] = {1, 2};\n  amr->Initialize(2, blocksPerLevel);\n\n  double origin[3] = {0.0, 0.0, 0.0};\n  double spacing[3] = {1.0, 1.0, 1.0};\n  int dims[3] = {11, 11, 11};\n\n  vtkNew<vtkUniformGrid> ug1;\n  // Geometry\n  ug1->SetOrigin(origin);\n  ug1->SetSpacing(spacing);\n  ug1->SetDimensions(dims);\n\n  // Data\n  vtkNew<vtkFloatArray> scalars;\n  ug1->GetPointData()->SetScalars(scalars);\n  MakeScalars(dims, origin, spacing, scalars);\n\n  int lo[3] = {0, 0, 0};\n  int hi[3] = {9, 9, 9};\n  vtkAMRBox box1(lo, hi);\n  amr->SetAMRBox(0, 0, box1);\n  amr->SetDataSet(0, 0, ug1);\n\n  double spacing2[3] = {0.5, 0.5, 0.5};\n\n  vtkNew<vtkUniformGrid> ug2;\n  // Geometry\n  ug2->SetOrigin(origin);\n  ug2->SetSpacing(spacing2);\n  ug2->SetDimensions(dims);\n\n  // Data\n  vtkNew<vtkFloatArray> scalars2;\n  ug2->GetPointData()->SetScalars(scalars2);\n  MakeScalars(dims, origin, spacing2, scalars2);\n\n  int lo2[3] = {0, 0, 0};\n  int hi2[3] = {9, 9, 9};\n  vtkAMRBox box2(lo2, hi2);\n  amr->SetAMRBox(1, 0, box2);\n  amr->SetDataSet(1, 0, ug2);\n\n  double origin3[3] = {5, 5, 5};\n\n  vtkNew<vtkUniformGrid> ug3;\n  // Geometry\n  ug3->SetOrigin(origin3);\n  ug3->SetSpacing(spacing2);\n  ug3->SetDimensions(dims);\n\n  // Data\n  vtkNew<vtkFloatArray> scalars3;\n  ug3->GetPointData()->SetScalars(scalars3);\n  MakeScalars(dims, origin3, spacing2, scalars3);\n\n  int lo3[3] = {10, 10, 10};\n  int hi3[3] = {19, 19, 19};\n  vtkAMRBox box3(lo3, hi3);\n  amr->SetAMRBox(1, 1, box3);\n  amr->SetDataSet(1, 1, ug3);\n\n  amr->SetRefinementRatio(0, 2);\n\n  vtkAMRUtilities::BlankCells(amr);\n\n  vtkNew<vtkOutlineFilter> of;\n  of->SetInputData(amr);\n\n  vtkNew<vtkCompositeDataGeometryFilter> geomFilter;\n  geomFilter->SetInputConnection(of->GetOutputPort());\n\n  // Create an iso-surface - at 10.\n  vtkNew<vtkContourFilter> cf;\n  cf->SetInputData(amr);\n  cf->SetNumberOfContours(1);\n  cf->SetValue(0, 10.0);\n\n  vtkNew<vtkCompositeDataGeometryFilter> geomFilter2;\n  geomFilter2->SetInputConnection(cf->GetOutputPort());\n\n  // Create the render window, renderer, and interactor.\n  vtkNew<vtkRenderer> aren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Associate the geometry with a mapper and the mapper to an actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(of->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  actor1->SetMapper(mapper);\n\n  // Vssociate the geometry with a mapper and the mapper to an actor.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(geomFilter2->GetOutputPort());\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n\n  // Add the actor to the renderer and start handling events.\n  aren->AddActor(actor1);\n  aren->AddActor(actor2);\n\n  aren->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  renWin->SetWindowName(\"OverlappingAMR\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeScalars(int dims[3], double origin[3], double spacing[3],\n                 vtkFloatArray* scalars)\n{\n  // Implicit function used to compute scalars.\n  vtkNew<vtkSphere> sphere;\n  sphere->SetRadius(3);\n  sphere->SetCenter(5, 5, 5);\n\n  scalars->SetNumberOfTuples(dims[0] * dims[1] * dims[2]);\n  for (int k = 0; k < dims[2]; k++)\n  {\n    auto z = origin[2] + spacing[2] * k;\n    for (int j = 0; j < dims[1]; j++)\n    {\n      auto y = origin[1] + spacing[1] * j;\n      for (int i = 0; i < dims[0]; i++)\n      {\n        auto x = origin[0] + spacing[0] * i;\n        scalars->SetValue(k * dims[0] * dims[1] + j * dims[0] + i,\n                          sphere->EvaluateFunction(x, y, z));\n      }\n    }\n  }\n}\n} // namespace\n
"},{"location":"Cxx/CompositeData/OverlappingAMR/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OverlappingAMR)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OverlappingAMR: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OverlappingAMR MACOSX_BUNDLE OverlappingAMR.cxx )\n  target_link_libraries(OverlappingAMR PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OverlappingAMR\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/CompositeData/OverlappingAMR/#download-and-build-overlappingamr","title":"Download and Build OverlappingAMR","text":"

Click here to download OverlappingAMR and its CMakeLists.txt file. Once the tarball OverlappingAMR.tar has been downloaded and extracted,

cd OverlappingAMR/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OverlappingAMR\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Coverage/CxxVTKClassesNotUsed/","title":"VTK Classes not used in the Examples","text":""},{"location":"Cxx/Coverage/CxxVTKClassesNotUsed/#cxx","title":"Cxx","text":"

Out of 3113 available VTK classes, 2260 have not been used.

VTK Class VTK Class VTK Class VTK Class VTK Class vtk2DHistogramItem vtk3DCursorRepresentation vtk3DCursorWidget vtk3DLinearGridCrinkleExtractor vtk3DLinearGridInternal vtk3DLinearGridPlaneCutter vtk3DWidget vtkABI vtkADIOS2CoreImageReader vtkADIOS2VTXReader vtkAMRBaseParticlesReader vtkAMRBaseReader vtkAMRCutPlane vtkAMRDataInternals vtkAMRDataSetCache vtkAMREnzoParticlesReader vtkAMREnzoReader vtkAMREnzoReaderInternal vtkAMRFlashParticlesReader vtkAMRFlashReader vtkAMRFlashReaderInternal vtkAMRGaussianPulseSource vtkAMRInformation vtkAMRInterpolatedVelocityField vtkAMRResampleFilter vtkAMRSliceFilter vtkAMRToMultiBlockFilter vtkAMRVelodyneReader vtkAMRVelodyneReaderInternal vtkAMRVolumeMapper vtkAMReXGridHeader vtkAMReXGridLevelHeader vtkAMReXGridReader vtkAMReXGridReaderInternal vtkAMReXParticlesReader vtkAOSDataArrayTemplate vtkASCIITextCodec vtkAVIWriter vtkAVSucdReader vtkAbstractArray vtkAbstractCellArray vtkAbstractCellLinks vtkAbstractCellLocator vtkAbstractContextBufferId vtkAbstractContextItem vtkAbstractElectronicData vtkAbstractGridConnectivity vtkAbstractHyperTreeGridMapper vtkAbstractImageInterpolator vtkAbstractInteractionDevice vtkAbstractInterpolatedVelocityField vtkAbstractMapper vtkAbstractMapper3D vtkAbstractParticleWriter vtkAbstractPointLocator vtkAbstractPolyDataReader vtkAbstractPolygonalHandleRepresentation3D vtkAbstractPropPicker vtkAbstractRenderDevice vtkAbstractSplineRepresentation vtkAbstractTransform vtkAbstractVolumeMapper vtkActor2DCollection vtkActorNode vtkAdaptiveDataSetSurfaceFilter vtkAdaptiveResampleToImage vtkAdaptiveSubdivisionFilter vtkAdaptiveTemporalInterpolator vtkAddMembershipArray vtkAffineRepresentation vtkAggregateDataSetFilter vtkAggregateToPartitionedDataSetCollection vtkAlembicExporter vtkAlignImageDataSetFilter vtkAmoebaMinimizer vtkAnariActorNode vtkAnariCameraNode vtkAnariCompositePolyDataMapperNode vtkAnariFollowerNode vtkAnariLightNode vtkAnariPass vtkAnariPolyDataMapperNode vtkAnariProfiling vtkAnariRendererNode vtkAnariTestInteractor vtkAnariViewNodeFactory vtkAnariVolumeInterface vtkAnariVolumeMapper vtkAnariVolumeMapperNode vtkAnariVolumeNode vtkAnariWindowNode vtkAndroidOutputWindow vtkAndroidRenderWindowInteractor vtkAngleRepresentation vtkAngleRepresentation3D vtkAngularPeriodicDataArray vtkAngularPeriodicFilter vtkAnimateModes vtkAnnotation vtkAnnotationLayers vtkAnnotationLayersAlgorithm vtkAppendArcLength vtkAppendCompositeDataLeaves vtkAppendDataSets vtkAppendLocationAttributes vtkAppendPartitionedDataSetCollection vtkAppendPoints vtkAppendSelection vtkApplyColors vtkApplyIcons vtkApproximatingSubdivisionFilter vtkArcGridActorPrivate vtkArcParallelEdgeStrategy vtkArcPlotter vtkArcSource vtkArchiver vtkAreaContourSpectrumFilter vtkAreaLayout vtkAreaLayoutStrategy vtkArray vtkArrayCoordinates vtkArrayDataAlgorithm vtkArrayDataReader vtkArrayDataWriter vtkArrayExtents vtkArrayExtentsList vtkArrayInterpolate vtkArrayIterator vtkArrayIteratorIncludes vtkArrayIteratorTemplate vtkArrayListTemplate vtkArrayNorm vtkArrayRange vtkArrayReader vtkArrayRename vtkArrayRenderer vtkArraySort vtkArrayWeights vtkAssemblyPaths vtkAssignCoordinates vtkAssignCoordinatesLayoutStrategy vtkAtom vtkAtomicMutex vtkAttributeClustering2DLayoutStrategy vtkAttributeDataToFieldDataFilter vtkAttributeDataToTableFilter vtkAttributeSmoothingFilter vtkAttributesErrorMetric vtkAutoCorrelativeStatistics vtkAvatar vtkAxesTransformRepresentation vtkAxesTransformWidget vtkAxisActor2D vtkAxisActor2DMock vtkAxisExtended vtkAxisFollower vtkAxisGridActorPrivate vtkBSPCuts vtkBSPIntersections vtkBSplineTransform vtkBTSReader vtkBYUWriter vtkBackgroundColorMonitor vtkBase64InputStream vtkBase64OutputStream vtkBase64Utilities vtkBatchedSurfaceLICMapper vtkBatches vtkBezierContourLineInterpolator vtkBezierCurve vtkBezierHexahedron vtkBezierInterpolation vtkBezierQuadrilateral vtkBezierTetra vtkBezierTriangle vtkBezierWedge vtkBiDimensionalRepresentation vtkBilinearQuadIntersection vtkBinCellDataFilter vtkBinnedDecimation vtkBiomTableReader vtkBitArray vtkBitArrayIterator vtkBivariateLinearTableThreshold vtkBlankStructuredGrid vtkBlankStructuredGridWithImage vtkBlockDistribution vtkBlockIdScalars vtkBlockItem vtkBlockSelector vtkBlueObeliskData vtkBlueObeliskDataParser vtkBond vtkBoostBetweennessClustering vtkBoostBiconnectedComponents vtkBoostBrandesCentrality vtkBoostDividedEdgeBundling vtkBoostExtractLargestComponent vtkBoostKruskalMinimumSpanningTree vtkBoostLogWeighting vtkBoostRandomSparseArraySource vtkBoostSplitTableField vtkBoundaryMeshQuality vtkBoundedPlanePointPlacer vtkBoxLayoutStrategy vtkBreakPoint vtkBrokenLineWidget vtkBuffer vtkBufferedArchiver vtkButtonRepresentation vtkButtonSource vtkByteSwap vtkCGMWriter vtkCGNSCache vtkCGNSFileSeriesReader vtkCGNSReader vtkCGNSReaderInternal vtkCONVERGECFDCGNSReader vtkCONVERGECFDReader vtkCPExodusIIElementBlock vtkCPExodusIIElementBlockCellIterator vtkCPExodusIIElementBlockImpl vtkCPExodusIIInSituReader vtkCPExodusIINodalCoordinatesTemplate vtkCPExodusIIResultsArrayTemplate vtkCachedStreamingDemandDrivenPipeline vtkCamera3DRepresentation vtkCamera3DWidget vtkCameraHandleSource vtkCameraNode vtkCameraOrientationRepresentation vtkCameraPathRepresentation vtkCameraPathWidget vtkCameraRepresentation vtkCameraWidget vtkCapsuleSource vtkCastToConcrete vtkCell3D vtkCellAttribute vtkCellAttributeCalculator vtkCellAttributeInformation vtkCellCenterDepthSort vtkCellCentersPointPlacer vtkCellDataToPointData vtkCellDerivatives vtkCellDistanceSelector vtkCellGraphicsPrimitiveMap vtkCellGrid vtkCellGridAlgorithm vtkCellGridBoundsQuery vtkCellGridComputeSurface vtkCellGridElevation vtkCellGridElevationQuery vtkCellGridEvaluator vtkCellGridIOQuery vtkCellGridMapper vtkCellGridPointProbe vtkCellGridQuery vtkCellGridRangeQuery vtkCellGridReader vtkCellGridRenderRequest vtkCellGridResponder vtkCellGridResponderBase vtkCellGridResponders vtkCellGridSidesQuery vtkCellGridWriter vtkCellLinks vtkCellLocatorStrategy vtkCellMetadata vtkCellQuality vtkCellSizeFilter vtkCellValidator vtkCenteredSliderRepresentation vtkCenteredSliderWidget vtkCesium3DTilesReader vtkCesium3DTilesWriter vtkCesiumB3DMReader vtkCesiumPointCloudWriter vtkChacoGraphReader vtkChacoReader vtkChart2DHistogram vtkCheckerboardSplatter vtkCirclePackFrontChainLayoutStrategy vtkCirclePackLayout vtkCirclePackLayoutStrategy vtkCirclePackToPolyData vtkCityGMLReader vtkCleanUnstructuredGrid vtkCleanUnstructuredGridCells vtkClearRGBPass vtkClearZPass vtkClientServerCompositePass vtkClientServerSynchronizedRenderers vtkClientSocket vtkClipConvexPolyData vtkClosedSurfacePointPlacer vtkClosestNPointsStrategy vtkClosestPointStrategy vtkClustering2DLayoutStrategy vtkCocoaMacOSXSDKCompatibility vtkCocoaRenderWindow vtkCocoaRenderWindowInteractor vtkCocoaTkUtilities vtkCoincidentPoints vtkCollapseGraph vtkCollapseVerticesByArray vtkCollectGraph vtkCollectPolyData vtkCollectTable vtkCollection vtkCollectionElement vtkCollectionIterator vtkColor3 vtkColor3f vtkColor4 vtkColor4d vtkColor4f vtkColorTransferControlPointsItem vtkColorTransferFunctionItem vtkCommonInformationKeyManager vtkCommunicator vtkCommunity2DLayoutStrategy vtkCompositeCellGridMapper vtkCompositeCellGridReader vtkCompositeControlPointsItem vtkCompositeCutter vtkCompositeDataDisplayAttributesLegacy vtkCompositeDataIterator vtkCompositeDataPipeline vtkCompositeDataProbeFilter vtkCompositeDataReader vtkCompositeDataSetAlgorithm vtkCompositeImplicitBackend vtkCompositeInterpolatedVelocityField vtkCompositeMapperHelper2 vtkCompositeMapperHelperData vtkCompositePolyDataMapperDelegator vtkCompositeRGBAPass vtkCompositeRenderManager vtkCompositeSurfaceLICMapper vtkCompositeSurfaceLICMapperDelegator vtkCompositeTransferFunctionItem vtkCompositeZPass vtkCompositedSynchronizedRenderers vtkCompositer vtkCompressCompositer vtkComputeHistogram2DOutliers vtkComputeQuantiles vtkConduitArrayUtilities vtkConduitSource vtkConduitToDataObject vtkConeLayoutStrategy vtkConnectedPointsFilter vtkConstrained2DLayoutStrategy vtkConstrainedPointHandleRepresentation vtkConstrainedSmoothingFilter vtkConsumerDataFilter vtkContextArea vtkContextClip vtkContextDevice2D vtkContextDevice3D vtkContextInteractorStyle vtkContextKeyEvent vtkContextMapper2D vtkContextPolygon vtkContextScenePrivate vtkContingencyStatistics vtkContinuousScatterplot vtkContinuousValueWidget vtkContinuousValueWidgetRepresentation vtkContour3DLinearGrid vtkContourGrid vtkContourHelper vtkContourLineInterpolator vtkContourLoopExtraction vtkContourRepresentationInternals vtkContourRepresentationNode vtkContourRepresentationPoint vtkControlPointsItem vtkConvertSelection vtkConvertSelectionDomain vtkConvertToMultiBlockDataSet vtkConvertToPartitionedDataSetCollection vtkConvertToPointCloud vtkConvertToPolyhedra vtkConvexHull2D vtkCookieCutter vtkCoordinateFrame vtkCoordinateFrameRepresentation vtkCoordinateFrameWidget vtkCorrelativeStatistics vtkCosmicTreeLayoutStrategy vtkCountFaces vtkCountVertices vtkCuller vtkCurveRepresentation vtkCutMaterial vtkCylindricalTransform vtkDGAttributeInformation vtkDGBoundsResponder vtkDGCell vtkDGEdge vtkDGElevationResponder vtkDGEvaluator vtkDGHex vtkDGIOResponder vtkDGInterpolateCalculator vtkDGPyr vtkDGQuad vtkDGRangeResponder vtkDGRenderResponder vtkDGSidesResponder vtkDGTet vtkDGTranscribeUnstructuredCells vtkDGTri vtkDGVert vtkDGWdg vtkDIMACSGraphReader vtkDIMACSGraphWriter vtkDIYAggregateDataSetFilter vtkDIYDataExchanger vtkDIYExplicitAssigner vtkDIYGhostUtilities vtkDIYKdTreeUtilities vtkDIYUtilities vtkDIYUtilitiesCleanup vtkDSPFilterDefinition vtkDSPFilterGroup vtkDataArrayCollection vtkDataArrayCollectionIterator vtkDataArraySelection vtkDataAssembly vtkDataAssemblyUtilities vtkDataAssemblyVisitor vtkDataCompressor vtkDataEncoder vtkDataObjectAlgorithm vtkDataObjectCollection vtkDataObjectGenerator vtkDataObjectMeshCache vtkDataObjectToConduit vtkDataObjectToTable vtkDataObjectTreeIndex vtkDataObjectTreeInternals vtkDataObjectTypes vtkDataObjectWriter vtkDataReader vtkDataRepresentation vtkDataSetAlgorithm vtkDataSetAttributesFieldList vtkDataSetCellIterator vtkDataSetEdgeSubdivisionCriterion vtkDataSetGradient vtkDataSetGradientPrecompute vtkDataSetRegionSurfaceFilter vtkDataSetToDataObjectFilter vtkDataTransferHelper vtkDataWriter vtkDatabaseToTableReader vtkDateToNumeric vtkDeRhamCell vtkDebugLeaks vtkDebugLeaksManager vtkDebugLeaksObserver vtkDefaultPass vtkDeflectNormals vtkDendrogramItem vtkDensifyPolyData vtkDependentDimensionInfo vtkDepthImageProcessingPass vtkDepthImageToPointCloud vtkDepthOfFieldPass vtkDepthPeelingPass vtkDescriptiveStatistics vtkDeserializer vtkDiagonalMatrixSource vtkDicer vtkDijkstraGraphInternals vtkDijkstraImageContourLineInterpolator vtkDijkstraImageGeodesicPath vtkDimensionInfo vtkDirectedAcyclicGraph vtkDirectedGraphAlgorithm vtkDirectionEncoder vtkDiscreteFlyingEdges2D vtkDiscreteFlyingEdgesClipper2D vtkDisplaySizedImplicitPlaneRepresentation vtkDisplaySizedImplicitPlaneWidget vtkDistanceRepresentation2D vtkDistanceRepresentation3D vtkDistributedDataFilter vtkDistributedGraphHelper vtkDistributedPointCloudFilter vtkDotProductSimilarity vtkDrawTexturedElements vtkDualDepthPeelingPass vtkDummyCommunicator vtkDummyController vtkDummyGPUInfoList vtkDuplicatePolyData vtkDynamic2DLabelMapper vtkDynamicLoader vtkEDLShading vtkEGLRenderWindow vtkERFReader vtkEdgeCenters vtkEdgeLayout vtkEdgeLayoutStrategy vtkEdgeSubdivisionCriterion vtkEdgeTable vtkEllipseArcSource vtkEllipsoidTensorProbeRepresentation vtkEllipsoidalGaussianKernel vtkEmptyCell vtkEmptyRepresentation vtkEnSight6BinaryReader vtkEnSight6Reader vtkEnSightGoldBinaryReader vtkEnSightGoldReader vtkEnSightMasterServerReader vtkEnSightReader vtkEnSightWriter vtkEncodedGradientEstimator vtkEncodedGradientShader vtkEndFor vtkEnsembleSource vtkEnzoReaderBlock vtkEnzoReaderInternal vtkEqualizerContextItem vtkEqualizerFilter vtkEquirectangularToCubeMapTexture vtkErrorCode vtkEvenlySpacedStreamlines2D vtkEvent vtkEventData vtkEventDataDevice3D vtkEventDataForDevice vtkEventForwarderCommand vtkExecutableRunner vtkExecutionAggregator vtkExecutionRange vtkExecutionTimer vtkExodusIICache vtkExodusIICacheEntry vtkExodusIICacheKey vtkExodusIIReaderIntPointCheck vtkExodusIIReaderParser vtkExodusIIReaderPrivate vtkExodusIIReaderScalarCheck vtkExodusIIReaderTensorCheck vtkExodusIIReaderVariableCheck vtkExodusIIReaderVectorCheck vtkExpandMarkedElements vtkExpandSelectedGraph vtkExplicitStructuredGridAlgorithm vtkExplicitStructuredGridCrop vtkExplicitStructuredGridSurfaceFilter vtkExporter vtkExprTkFunctionParser vtkExtentRCBPartitioner vtkExtentSplitter vtkExtentTranslator vtkExternalLight vtkExternalOpenGLCamera vtkExternalOpenGLRenderWindow vtkExternalOpenGLRenderer vtkExtractArray vtkExtractBlock vtkExtractBlockUsingDataAssembly vtkExtractCTHPart vtkExtractCellsAlongPolyLine vtkExtractCellsByType vtkExtractDataArraysOverTime vtkExtractDataOverTime vtkExtractDataSets vtkExtractExodusGlobalTemporalVariables vtkExtractFunctionalBagPlot vtkExtractGhostCells vtkExtractHierarchicalBins vtkExtractHistogram vtkExtractHistogram2D vtkExtractLevel vtkExtractParticlesOverTime vtkExtractPiece vtkExtractPointCloudPiece vtkExtractPolyDataPiece vtkExtractRectilinearGrid vtkExtractSelectedArraysOverTime vtkExtractSelectedFrustum vtkExtractSelectedGraph vtkExtractSelectedRows vtkExtractSelectedTree vtkExtractSelectionBase vtkExtractStructuredGridHelper vtkExtractSubsetWithSeed vtkExtractTensorComponents vtkExtractTimeSteps vtkExtractUnstructuredGrid vtkExtractUnstructuredGridPiece vtkExtractUserDefinedPiece vtkExtractVectorComponents vtkFDSReader vtkFFMPEGVideoSource vtkFFT vtkFLUENTCFFReader vtkFLUENTReader vtkFXAAOptions vtkFacetReader vtkFacetWriter vtkFast2DLayoutStrategy vtkFiberSurface vtkFidesReader vtkFieldDataSerializer vtkFieldDataToDataSetAttribute vtkFileResourceStream vtkFileSeriesHelper vtkFilteringInformationKeyManager vtkFiltersCellGrid vtkFindCellStrategy vtkFiniteDifferenceGradientEstimator vtkFiniteElementFieldDistributor vtkFinitePlaneRepresentation vtkFinitePlaneWidget vtkFixedPointRayCastImage vtkFixedPointVolumeRayCastCompositeGOHelper vtkFixedPointVolumeRayCastCompositeGOShadeHelper vtkFixedPointVolumeRayCastCompositeHelper vtkFixedPointVolumeRayCastCompositeShadeHelper vtkFixedPointVolumeRayCastHelper vtkFixedPointVolumeRayCastMIPHelper vtkFixedSizeHandleRepresentation vtkFixedSizeHandleRepresentation3D vtkFixedWidthTextReader vtkFlagpoleLabel vtkFlashReaderInternal vtkFlyingEdgesPlaneCutter vtkFocalPlaneContourRepresentation vtkFocalPlanePointPlacer vtkFontConfigFreeTypeTools vtkForEach vtkForceStaticMesh vtkForceTime vtkFrameBufferObjectBase vtkFramebufferPass vtkFreeTypeLabelRenderStrategy vtkFreeTypeStringToImage vtkFreeTypeToolsCleanup vtkFrustumCoverageCuller vtkFrustumSelector vtkFunctionSet vtkGAMBITReader vtkGDAL vtkGDALRasterConverter vtkGDALRasterReader vtkGDALRasterReprojection vtkGDALVectorReader vtkGESignaReader vtkGL2PSExporter vtkGLSLModCamera vtkGLSLModCoincidentTopology vtkGLSLModLight vtkGLSLModPixelDebugger vtkGLSLModifierBase vtkGLSLModifierFactory vtkGLTFDocumentLoader vtkGLTFDocumentLoaderInternals vtkGLTFReader vtkGLTFTexture vtkGLTFWriter vtkGLTFWriterUtils vtkGPUInfo vtkGPUInfoList vtkGPUInfoListArray vtkGPUVolumeRayCastMapper vtkGarbageCollector vtkGarbageCollectorManager vtkGaussianBlurPass vtkGaussianCubeReader vtkGaussianCubeReader2 vtkGaussianRandomSequence vtkGeneralTransform vtkGeneralizedKernel vtkGenerateGlobalIds vtkGenerateIndexArray vtkGenerateProcessIds vtkGenerateTimeSteps vtkGenericAdaptorCell vtkGenericAttribute vtkGenericAttributeCollection vtkGenericCellIterator vtkGenericCellTessellator vtkGenericContourFilter vtkGenericCutter vtkGenericDataArrayLookupHelper vtkGenericDataObjectWriter vtkGenericDataSet vtkGenericDataSetTessellator vtkGenericEdgeTable vtkGenericEnSightReader vtkGenericGeometryFilter vtkGenericGlyph3DFilter vtkGenericImageInterpolator vtkGenericInterpolatedVelocityField vtkGenericMovieWriter vtkGenericOpenGLResourceFreeCallback vtkGenericPointIterator vtkGenericProbeFilter vtkGenericRenderWindowInteractor vtkGenericStreamTracer vtkGenericSubdivisionErrorMetric vtkGenericVertexAttributeMapping vtkGeoEdgeStrategy vtkGeoJSONFeature vtkGeoJSONReader vtkGeoJSONWriter vtkGeoMath vtkGeoProjection vtkGeoTransform vtkGeodesicPath vtkGeometricErrorMetric vtkGhostCellsGenerator vtkGlobFileNames vtkGraphAnnotationLayersFilter vtkGraphEdge vtkGraphGeodesicPath vtkGraphHierarchicalBundleEdges vtkGraphInternals vtkGraphItem vtkGraphLayoutFilter vtkGraphMapper vtkGraphReader vtkGraphToPoints vtkGraphWeightEuclideanDistanceFilter vtkGraphWeightFilter vtkGraphWriter vtkGridSynchronizedTemplates3D vtkGridTransform vtkGroupDataSetsFilter vtkGroupLeafVertices vtkGroupTimeStepsFilter vtkH5PartReader vtkH5RageReader vtkHDF5Helper vtkHDFReaderImplementation vtkHDFVersion vtkHDFWriter vtkHDFWriterImplementation vtkHandleRepresentation vtkHandleSource vtkHandleWidget vtkHardwarePicker vtkHardwareWindow vtkHeap vtkHeatmapItem vtkHiddenLineRemovalPass vtkHierarchicalBinningFilter vtkHierarchicalBoxDataSet vtkHierarchicalBoxDataSetAlgorithm vtkHierarchicalDataExtractDataSets vtkHierarchicalDataExtractLevel vtkHierarchicalDataLevelFilter vtkHierarchicalDataSetGeometryFilter vtkHierarchicalGraphPipeline vtkHierarchicalGraphView vtkHierarchicalPolyDataMapper vtkHigherOrderCurve vtkHigherOrderHexahedron vtkHigherOrderInterpolation vtkHigherOrderQuadrilateral vtkHigherOrderTetra vtkHigherOrderTriangle vtkHigherOrderWedge vtkHighestDensityRegionsStatistics vtkHomogeneousTransform vtkHoudiniPolyDataWriter vtkHyperTree vtkHyperTreeGrid vtkHyperTreeGridAlgorithm vtkHyperTreeGridAxisClip vtkHyperTreeGridAxisCut vtkHyperTreeGridAxisReflection vtkHyperTreeGridCellCenters vtkHyperTreeGridContour vtkHyperTreeGridDepthLimiter vtkHyperTreeGridEntry vtkHyperTreeGridEvaluateCoarse vtkHyperTreeGridExtractGhostCells vtkHyperTreeGridFeatureEdges vtkHyperTreeGridGeometricLocator vtkHyperTreeGridGeometry vtkHyperTreeGridGeometry1DImpl vtkHyperTreeGridGeometry2DImpl vtkHyperTreeGridGeometry3DImpl vtkHyperTreeGridGeometryEntry vtkHyperTreeGridGeometryImpl vtkHyperTreeGridGeometryLevelEntry vtkHyperTreeGridGeometrySmallDimensionsImpl vtkHyperTreeGridGeometryUnlimitedEntry vtkHyperTreeGridGeometryUnlimitedLevelEntry vtkHyperTreeGridGhostCellsGenerator vtkHyperTreeGridGhostCellsGeneratorInternals vtkHyperTreeGridGradient vtkHyperTreeGridIterator vtkHyperTreeGridLevelEntry vtkHyperTreeGridLocator vtkHyperTreeGridMapper vtkHyperTreeGridNonOrientedCursor vtkHyperTreeGridNonOrientedGeometryCursor vtkHyperTreeGridNonOrientedMooreSuperCursor vtkHyperTreeGridNonOrientedMooreSuperCursorLight vtkHyperTreeGridNonOrientedSuperCursor vtkHyperTreeGridNonOrientedSuperCursorLight vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor vtkHyperTreeGridNonOrientedUnlimitedSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight vtkHyperTreeGridOrientedCursor vtkHyperTreeGridOrientedGeometryCursor vtkHyperTreeGridOutlineFilter vtkHyperTreeGridPlaneCutter vtkHyperTreeGridPreConfiguredSource vtkHyperTreeGridProbeFilter vtkHyperTreeGridScales vtkHyperTreeGridThreshold vtkHyperTreeGridToDualGrid vtkHyperTreeGridVisibleLeavesSize vtkIOCellGrid vtkIOSRenderWindow vtkIOSRenderWindowInteractor vtkIOSSFilesScanner vtkIOSSModel vtkIOSSReader vtkIOSSReaderInternal vtkIOSSWriter vtkIOStream vtkIOStreamFwd vtkISIReader vtkIVExporter vtkIVWriter vtkIcicleView vtkIconGlyphFilter vtkIdListCollection vtkIdentityTransform vtkImageActorPointPlacer vtkImageAnisotropicDiffusion3D vtkImageAppend vtkImageBSplineCoefficients vtkImageBSplineInternals vtkImageBSplineInterpolator vtkImageButterworthLowPass vtkImageCacheFilter vtkImageConnectivityFilter vtkImageConnector vtkImageConnectorSeed vtkImageCroppingRegionsWidget vtkImageCursor3D vtkImageDataLIC2D vtkImageDataOutlineFilter vtkImageDataStreamer vtkImageDataToExplicitStructuredGrid vtkImageDataToHyperTreeGrid vtkImageDataToUniformGrid vtkImageDecomposeFilter vtkImageEuclideanDistance vtkImageFourierFilter vtkImageGaussianSource vtkImageHSIToRGB vtkImageHistogramStatistics vtkImageIdealLowPass vtkImageImportExecutive vtkImageInPlaceFilter vtkImageInterpolator vtkImageItem vtkImageIterateFilter vtkImageLogic vtkImageMapToRGBA vtkImageMaskBits vtkImageOrthoPlanes vtkImagePadFilter vtkImagePointDataIterator vtkImagePointIterator vtkImageProbeFilter vtkImageProcessingPass vtkImageProgressIterator vtkImageRGBToXYZ vtkImageReader2Collection vtkImageRenderManager vtkImageResliceToColors vtkImageSSIM vtkImageSkeleton2D vtkImageSlab vtkImageSlabReslice vtkImageSliceCollection vtkImageSobel3D vtkImageSpatialAlgorithm vtkImageStencilAlgorithm vtkImageStencilData vtkImageStencilIterator vtkImageStencilRaster vtkImageStencilSource vtkImageThresholdConnectivity vtkImageToAMR vtkImageToPoints vtkImageToStructuredGrid vtkImageTransform vtkImageXYZToLAB vtkImageYIQToRGB vtkImplicitArray vtkImplicitCylinderRepresentation vtkImplicitCylinderWidget vtkImplicitFunctionCollection vtkImplicitFunctionToImageStencil vtkImplicitHalo vtkImplicitImageRepresentation vtkImplicitPlaneWidget vtkImplicitProjectOnPlaneDistance vtkImplicitSum vtkImplicitVolume vtkImplicitWindowFunction vtkImporter vtkImprintFilter vtkIncrementalForceLayout vtkIncrementalOctreeNode vtkIncrementalPointLocator vtkIndexedImplicitBackend vtkInformationDataObjectKey vtkInformationDataObjectMetaDataKey vtkInformationDoubleKey vtkInformationExecutivePortKey vtkInformationExecutivePortVectorKey vtkInformationIdTypeKey vtkInformationInformationKey vtkInformationInformationVectorKey vtkInformationIntegerKey vtkInformationIntegerPointerKey vtkInformationIntegerRequestKey vtkInformationIntegerVectorKey vtkInformationInternals vtkInformationIterator vtkInformationKey vtkInformationKeyLookup vtkInformationKeyVectorKey vtkInformationObjectBaseKey vtkInformationObjectBaseVectorKey vtkInformationQuadratureSchemeDefinitionVectorKey vtkInformationRequestKey vtkInformationStringKey vtkInformationStringVectorKey vtkInformationUnsignedLongKey vtkInformationVariantKey vtkInformationVariantVectorKey vtkInitialValueProblemSolver vtkInputStream vtkIntegrateAttributes vtkInteractiveArea vtkInteractorEventRecorder vtkInteractorStyle3D vtkInteractorStyleAreaSelectHover vtkInteractorStyleDrawPolygon vtkInteractorStyleFlight vtkInteractorStyleJoystickActor vtkInteractorStyleJoystickCamera vtkInteractorStyleMultiTouchCamera vtkInteractorStyleSwitchBase vtkInteractorStyleTreeMapHover vtkInteractorStyleUnicam vtkInterpolateCalculator vtkInterpolatingSubdivisionFilter vtkInterpolationKernel vtkInterpolatorInternals vtkIntersectionCounter vtkJSONDataSetWriter vtkJSONImageWriter vtkJSONRenderWindowExporter vtkJSONSceneExporter vtkJavaScriptDataWriter vtkJoinTables vtkKCoreDecomposition vtkKCoreLayout vtkKMeansAssessFunctor vtkKMeansDistanceFunctor vtkKMeansDistanceFunctorCalculator vtkKdNode vtkKdTreeSelector vtkLASRasterReader vtkLASReader vtkLICNoiseHelper vtkLICRandomNoise2D vtkLICRandomNumberGeneratorInterface vtkLSDynaPart vtkLSDynaPartCollection vtkLSDynaReader vtkLSDynaSummaryParser vtkLZ4DataCompressor vtkLZMADataCompressor vtkLabelHierarchy vtkLabelHierarchyAlgorithm vtkLabelHierarchyCompositeIterator vtkLabelHierarchyIterator vtkLabelPlacer vtkLabelRenderStrategy vtkLabelSizeCalculator vtkLabeledContourMapper vtkLabeledContourPolyDataItem vtkLabeledTreeMapDataMapper vtkLagrangeCurve vtkLagrangeHexahedron vtkLagrangeInterpolation vtkLagrangeQuadrilateral vtkLagrangeTetra vtkLagrangeTriangle vtkLagrangeWedge vtkLagrangianBasicIntegrationModel vtkLagrangianMatidaIntegrationModel vtkLagrangianParticle vtkLagrangianParticleTracker vtkLargeInteger vtkLassoStencilSource vtkLeaderActor2D vtkLegacyReaderVersion vtkLengthDistribution vtkLevelIdScalars vtkLightKit vtkLightNode vtkLightRepresentation vtkLightWidget vtkLightingMapPass vtkLineIntegralConvolution2D vtkLinearCellExtrusionFilter vtkLinearContourLineInterpolator vtkLinearKernel vtkLinearSelector vtkLinearToQuadraticCellsFilter vtkLinearTransformCellLocator vtkLocationSelector vtkLongArray vtkLongLongArray vtkLookupTableItem vtkLookupTableWithEnabling vtkMCubesWriter vtkMFCWindow vtkMFIXReader vtkMINCImageAttributes vtkMINCImageReader vtkMINCImageWriter vtkMNIObjectReader vtkMNIObjectWriter vtkMNITagPointReader vtkMNITagPointWriter vtkMNITransformReader vtkMNITransformWriter vtkMP4Writer vtkMPASReader vtkMPI4PyCommunicator vtkMPICommunicator vtkMPIController vtkMPIEventLog vtkMPIImageReader vtkMPIMultiBlockPLOT3DReader vtkMPIPixelTT vtkMPIPixelView vtkMRCReader vtkMagnifierRepresentation vtkMagnifierWidget vtkMapArrayValues vtkMapMaskTextureId vtkMappedDataArray vtkMappedUnstructuredGrid vtkMappedUnstructuredGridCellIterator vtkMapper2D vtkMapperCollection vtkMapperNode vtkMarkBoundaryFilter vtkMarkerUtilities vtkMarshalContext vtkMathPrivate vtkMathTextFreeTypeTextRenderer vtkMathTextUtilities vtkMathTextUtilitiesCleanup vtkMathUtilities vtkMatplotlibMathTextUtilities vtkMatricizeArray vtkMatrixToHomogeneousTransform vtkMatrixToLinearTransform vtkMeanValueCoordinatesInterpolator vtkMeasurementCubeHandleRepresentation3D vtkMedicalImageProperties vtkMedicalImageReader2 vtkMemkindRAII vtkMemoryLimitImageDataStreamer vtkMemoryResourceStream vtkMergeArrays vtkMergeCells vtkMergeColumns vtkMergeDataObjectFilter vtkMergeFields vtkMergeGraphs vtkMergeTables vtkMergeTimeFilter vtkMergeVectorComponents vtkMersenneTwister vtkModelMetadata vtkMolecule vtkMoleculeAlgorithm vtkMoleculeAppend vtkMoleculeReaderBase vtkMoleculeToAtomBallFilter vtkMoleculeToBondStickFilter vtkMoleculeToLinesFilter vtkMoleculeToPolyDataFilter vtkMotionFXCFGReader vtkMultiBlockDataSetAlgorithm vtkMultiBlockPLOT3DReaderRecord vtkMultiBlockUnstructuredGridVolumeMapper vtkMultiBlockVolumeMapper vtkMultiCorrelativeAssessFunctor vtkMultiCorrelativeStatistics vtkMultiNewickTreeReader vtkMultiObjectMassProperties vtkMultiPieceDataSet vtkMultiProcessController vtkMultiProcessStream vtkMultiThreader vtkMultiTimeStepAlgorithm vtkMultiVolume vtkMySQLDatabase vtkMySQLDatabasePrivate vtkMySQLQuery vtkMySQLToTableReader vtkNIFTIImageHeader vtkNIFTIImageReader vtkNIFTIImageWriter vtkNativePartitioningStrategy vtkNeighborCells vtkNek5000Reader vtkNetCDFCAMReader vtkNetCDFCFReader vtkNetCDFCFWriter vtkNetCDFPOPReader vtkNetCDFReader vtkNetCDFUGRIDReader vtkNetCDFUGRIDeader vtkNetworkHierarchy vtkNewickTreeReader vtkNewickTreeWriter vtkNonLinearCell vtkNonMergingPointLocator vtkNonOverlappingAMR vtkNonOverlappingAMRAlgorithm vtkNonOverlappingAMRLevelIdScalars vtkNormalizeMatrixVectors vtkNrrdReader vtkNumberToString vtkOBBNode vtkOBJPolyDataProcessor vtkOBJWriter vtkOCCTReader vtkODBCDatabase vtkODBCInternals vtkODBCQuery vtkOMETIFFReader vtkOMFReader vtkOOGLExporter vtkOSOpenGLRenderWindow vtkOSPRayAMRVolumeMapperNode vtkOSPRayActorNode vtkOSPRayCache vtkOSPRayCacheItemObject vtkOSPRayCameraNode vtkOSPRayCompositePolyDataMapper2Node vtkOSPRayCompositePolyDataMapperNode vtkOSPRayLightNode vtkOSPRayMaterialHelpers vtkOSPRayMaterialLibrary vtkOSPRayMoleculeMapperNode vtkOSPRayPass vtkOSPRayPointGaussianMapperNode vtkOSPRayPolyDataMapperNode vtkOSPRayRendererNode vtkOSPRayTestInteractor vtkOSPRayUnstructuredVolumeMapperNode vtkOSPRayViewNodeFactory vtkOSPRayVolumeInterface vtkOSPRayVolumeMapper vtkOSPRayVolumeMapperNode vtkOSPRayVolumeNode vtkOSPRayWindowNode vtkOStrStreamWrapper vtkOStreamWrapper vtkOTDensityMap vtkOTFilter vtkOTKernelSmoothing vtkOTScatterPlotMatrix vtkOTUtilities vtkObjectFactoryCollection vtkObjectFactoryRegistryCleanup vtkObjectIdMap vtkObserverMediator vtkOctreeImageToPointSetFilter vtkOctreePointLocatorNode vtkOldStyleCallbackCommand vtkOpenFOAMReader vtkOpenGL2ContextDevice2DCellArrayHelper vtkOpenGL2ContextDevice2DPrivate vtkOpenGLActor vtkOpenGLArrayTextureBufferAdapter vtkOpenGLAvatar vtkOpenGLBatchedPolyDataMapper vtkOpenGLBillboardTextActor3D vtkOpenGLBufferObject vtkOpenGLCamera vtkOpenGLCellGridMapper vtkOpenGLCellToVTKCellMap vtkOpenGLCompositePolyDataMapperDelegator vtkOpenGLContextActor vtkOpenGLContextBufferId vtkOpenGLContextDevice2D vtkOpenGLContextDevice3D vtkOpenGLContextDeviceBufferObjectBuilder vtkOpenGLES30PolyDataMapper2D vtkOpenGLFXAAFilter vtkOpenGLFXAAPass vtkOpenGLFluidMapper vtkOpenGLFramebufferObject vtkOpenGLGL2PSExporter vtkOpenGLGL2PSHelper vtkOpenGLGL2PSHelperImpl vtkOpenGLGlyph3DHelper vtkOpenGLGlyph3DMapper vtkOpenGLHardwareSelector vtkOpenGLHelper vtkOpenGLHyperTreeGridMapper vtkOpenGLImageAlgorithmCallback vtkOpenGLImageAlgorithmHelper vtkOpenGLImageGradient vtkOpenGLImageMapper vtkOpenGLImageSliceMapper vtkOpenGLIndexBufferObject vtkOpenGLInstanceCulling vtkOpenGLLabeledContourMapper vtkOpenGLLight vtkOpenGLLowMemoryBatchedPolyDataMapper vtkOpenGLLowMemoryCellTypeAgent vtkOpenGLLowMemoryLinesAgent vtkOpenGLLowMemoryPolyDataMapper vtkOpenGLLowMemoryPolygonsAgent vtkOpenGLLowMemoryStripsAgent vtkOpenGLLowMemoryVerticesAgent vtkOpenGLMoleculeMapper vtkOpenGLMovieSphere vtkOpenGLPointGaussianMapper vtkOpenGLPointGaussianMapperHelper vtkOpenGLPolyDataMapper2D vtkOpenGLProjectedTetrahedraMapper vtkOpenGLPropItem vtkOpenGLProperty vtkOpenGLQuadHelper vtkOpenGLRayCastImageDisplayHelper vtkOpenGLRenderPass vtkOpenGLRenderTimer vtkOpenGLRenderTimerLog vtkOpenGLRenderUtilities vtkOpenGLResourceFreeCallback vtkOpenGLShaderCache vtkOpenGLShaderDeclaration vtkOpenGLShaderProperty vtkOpenGLSkybox vtkOpenGLSphereMapper vtkOpenGLState vtkOpenGLStickMapper vtkOpenGLTextActor vtkOpenGLTextActor3D vtkOpenGLTextMapper vtkOpenGLUniforms vtkOpenGLVertexArrayObject vtkOpenGLVertexBufferObject vtkOpenGLVertexBufferObjectCache vtkOpenGLVertexBufferObjectGroup vtkOpenGLVolumeGradientOpacityTable vtkOpenGLVolumeLookupTable vtkOpenGLVolumeLookupTables vtkOpenGLVolumeMaskGradientOpacityTransferFunction2D vtkOpenGLVolumeMaskTransferFunction2D vtkOpenGLVolumeOpacityTable vtkOpenGLVolumeRGBTable vtkOpenGLVolumeTransferFunction2D vtkOpenQubeElectronicData vtkOpenQubeMoleculeSource vtkOpenSlideReader vtkOpenVDBReader vtkOpenVDBWriter vtkOpenVRCamera vtkOpenVRCameraPose vtkOpenVRControlsHelper vtkOpenVRDefaultOverlay vtkOpenVRInteractorStyle vtkOpenVRModel vtkOpenVROverlay vtkOpenVROverlaySpot vtkOpenXRCamera vtkOpenXRControlsHelper vtkOpenXRInteractorStyle vtkOpenXRManager vtkOpenXRManagerConnection vtkOpenXRManagerD3DGraphics vtkOpenXRManagerGraphics vtkOpenXRManagerOpenGLGraphics vtkOpenXRManagerRemoteConnection vtkOpenXRModel vtkOpenXRRemotingRenderWindow vtkOpenXRRenderWindow vtkOpenXRRenderWindowInteractor vtkOpenXRRenderer vtkOpenXRUtilities vtkOrderIndependentTranslucentPass vtkOrderStatistics vtkOrderedTriangulator vtkOrientPolyData vtkOrientationRepresentation vtkOrientationWidget vtkOrientedGlyphFocalPlaneContourRepresentation vtkOrientedPolygonalHandleRepresentation3D vtkOutlineCornerSource vtkOutlineSource vtkOutputStream vtkOutputWindowCleanup vtkOverlappingAMRAlgorithm vtkOverlappingAMRLevelIdScalars vtkOverlappingCellsDetector vtkOverrideInformation vtkOverrideInformationCollection vtkPAutoCorrelativeStatistics vtkPBRLUTTexture vtkPBRPrefilterTexture vtkPBivariateLinearTableThreshold vtkPCAAnalysisFilter vtkPCACurvatureEstimation vtkPCellDataToPointData vtkPCellSizeFilter vtkPChacoReader vtkPComputeHistogram2DOutliers vtkPComputeQuantiles vtkPComputeQuartiles vtkPConnectivityFilter vtkPContingencyStatistics vtkPConvertToMultiBlockDataSet vtkPCorrelativeStatistics vtkPDALReader vtkPDFContextDevice2D vtkPDFExporter vtkPDataSetReader vtkPDataSetWriter vtkPDescriptiveStatistics vtkPDirectory vtkPDistributedDataFilter vtkPExodusIIReader vtkPExodusIIWriter vtkPExtractDataArraysOverTime vtkPExtractExodusGlobalTemporalVariables vtkPExtractGrid vtkPExtractHistogram2D vtkPExtractRectilinearGrid vtkPExtractSelectedArraysOverTime vtkPExtractVOI vtkPHardwareSelector vtkPHyperTreeGridProbeFilter vtkPIOReader vtkPImageWriter vtkPKMeansStatisitcs vtkPKdTree vtkPLSDynaReader vtkPLagrangianParticleTracker vtkPLineIntegralConvolution2D vtkPLinearExtrusionFilter vtkPMaskPoints vtkPMergeArrays vtkPMultiCorrelativeStatistics vtkPNetCDFPOPReader vtkPNrrdReader vtkPOVExporter vtkPOpenFOAMReader vtkPOrderStatistics vtkPOutlineCornerFilter vtkPOutlineFilter vtkPOutlineFilterInternals vtkPPCAStatistics vtkPPainterCommunicator vtkPPairwiseExtractHistogram2D vtkPParticlePathFilter vtkPParticleTracer vtkPParticleTracerBase vtkPPixelTransfer vtkPPolyDataNormals vtkPProbeFilter vtkPProjectSphereFilter vtkPReflectionFilter vtkPResampleFilter vtkPResampleToImage vtkPResampleWithDataSet vtkPSLACReader vtkPSimpleBondPerceiver vtkPSphereSource vtkPStreaklineFilter vtkPStreamTracer vtkPStructuredGridConnectivity vtkPSurfaceLICComposite vtkPSurfaceLICInterface vtkPSystemTools vtkPTSReader vtkPTextureMapToSphere vtkPVWebGLExporter vtkPWindBladeReader vtkPXdmf3Writer vtkPYoungsMaterialInterface vtkPackLabels vtkPainterCommunicator vtkPairwiseExtractHistogram2D vtkPanoramicProjectionPass vtkParallelAMRUtilities vtkParallelCoordinatesActor vtkParallelCoordinatesHistogramRepresentation vtkParallelCoordinatesInteractorStyle vtkParallelReader vtkParallelRenderManager vtkParallelTimer vtkParallelVectors vtkParallelopipedRepresentation vtkParallelopipedWidget vtkParticlePathFilter vtkParticleTracer vtkParticleTracerBase vtkPartitionBalancer vtkPartitionedArchiver vtkPartitionedDataSet vtkPartitionedDataSetAlgorithm vtkPartitionedDataSetCollection vtkPartitionedDataSetCollectionAlgorithm vtkPartitionedDataSetCollectionSource vtkPartitionedDataSetSource vtkPartitioningStrategy vtkPassArrays vtkPassInputTypeAlgorithm vtkPassSelectedArrays vtkPassThroughEdgeStrategy vtkPassThroughLayoutStrategy vtkPeriodicDataArray vtkPeriodicFilter vtkPeriodicTable vtkPerturbCoincidentVertices vtkPhyloXMLTreeReader vtkPhyloXMLTreeWriter vtkPicker vtkPickingManager vtkPieceRequestFilter vtkPieceScalars vtkPiecewiseControlPointsItem vtkPiecewiseFunctionAlgorithm vtkPiecewiseFunctionItem vtkPiecewiseFunctionShiftScale vtkPiecewisePointHandleItem vtkPipelineGraphSource vtkPipelineSize vtkPixelBufferObject vtkPixelExtent vtkPixelExtentIO vtkPixelTransfer vtkPlaneCutter vtkPlaybackRepresentation vtkPlaybackWidget vtkPlot3D vtkPlot3DMetaReader vtkPlotBag vtkPlotBarRangeHandlesItem vtkPlotGrid vtkPlotHistogram2D vtkPlotLine vtkPlotParallelCoordinates vtkPlotPoints3D vtkPlotRangeHandlesItem vtkPointCloudFilter vtkPointCloudRepresentation vtkPointCloudWidget vtkPointConnectivityFilter vtkPointDataToCellData vtkPointDensityFilter vtkPointFillPass vtkPointHandleRepresentation3D vtkPointHandleSource vtkPointInterpolator2D vtkPointPlacer vtkPointSetAlgorithm vtkPointSetCellIterator vtkPointSetStreamer vtkPointSetToMoleculeFilter vtkPointSetToOctreeImageFilter vtkPointSmoothingFilter vtkPoints2D vtkPoissonDiskSampler vtkPolarAxesActor vtkPolarAxesActor2D vtkPolyDataContourLineInterpolator vtkPolyDataEdgeConnectivityFilter vtkPolyDataInternals vtkPolyDataItem vtkPolyDataMapperNode vtkPolyDataPlaneClipper vtkPolyDataPlaneCutter vtkPolyDataPointPlacer vtkPolyDataSourceWidget vtkPolyDataStreamer vtkPolyDataToReebGraphFilter vtkPolyDataToUnstructuredGrid vtkPolyDataWriter vtkPolyLineRepresentation vtkPolyLineSource vtkPolyLineWidget vtkPolyPlane vtkPolyPointSource vtkPolygonBuilder vtkPolygonalHandleRepresentation3D vtkPolyhedronUtilities vtkPolynomialSolversUnivariate vtkPostgreSQLDatabase vtkPostgreSQLDatabasePrivate vtkPostgreSQLQuery vtkPostgreSQLToTableReader vtkPriorityQueue vtkProStarReader vtkProbabilisticVoronoiKernel vtkProbeLineFilter vtkProbePolyhedron vtkProbeSelectedLocations vtkProcess vtkProcessGroup vtkProcessIdScalars vtkProgrammableAttributeDataFilter vtkProgrammableDataObjectSource vtkProgrammableElectronicData vtkProgressBarRepresentation vtkProgressBarWidget vtkProgressObserver vtkProjectPointsToPlane vtkProjectedTerrainPath vtkProjectedTetrahedraMapper vtkProp3DAxisFollower vtkProp3DFollower vtkPropItem vtkPruneTreeFilter vtkPythonAlgorithm vtkPythonArchiver vtkPythonItem vtkQWidgetRepresentation vtkQWidgetTexture vtkQWidgetWidget vtkQtAbstractModelAdapter vtkQtAnnotationLayersModelAdapter vtkQtAnnotationView vtkQtConnection vtkQtDebugLeaksModel vtkQtDebugLeaksView vtkQtInitialization vtkQtLabelRenderStrategy vtkQtListView vtkQtRecordView vtkQtSQLDatabase vtkQtSQLQuery vtkQtStringToImage vtkQtTableModelAdapter vtkQtTableRepresentation vtkQtTableView vtkQtTimePointUtility vtkQtTreeModelAdapter vtkQtTreeRingLabelMapper vtkQtTreeView vtkQtView vtkQuadRotationalExtrusionFilter vtkQuadraturePointInterpolator vtkQuadraturePointsGenerator vtkQuadratureSchemeDefinition vtkQuadratureSchemeDictionaryGenerator vtkQuaternion vtkQuaternionInterpolator vtkQuaterniond vtkQuaternionf vtkRIBLight vtkRISReader vtkROIStencilSource vtkRTXMLPolyDataReader vtkRadialGridActor2D vtkRandomAttributeGenerator vtkRandomHyperTreeGridSource vtkRandomLayoutStrategy vtkRandomPool vtkRandomSequence vtkRangeHandlesItem vtkRasterReprojectionFilter vtkRayCastImageDisplayHelper vtkRayCastStructures vtkReaderAlgorithm vtkRearrangeFields vtkRecoverGeometryWireframe vtkRect vtkRectangularButtonSource vtkRectd vtkRecti vtkRectilinearGridAlgorithm vtkRectilinearGridClip vtkRectilinearGridOutlineFilter vtkRectilinearGridPartitioner vtkRectilinearGridReader vtkRectilinearGridToPointSet vtkRectilinearGridWriter vtkRectilinearSynchronizedTemplates vtkRecursiveDividingCubes vtkRecursiveSphereDirectionEncoder vtkRedistributeDataSetFilter vtkReduceTable vtkReebGraph vtkReebGraphSimplificationFilter vtkReebGraphSimplificationMetric vtkReebGraphSurfaceSkeletonFilter vtkReebGraphToJoinSplitTreeFilter vtkReebGraphVolumeSkeletonFilter vtkReferenceCount vtkRemoteInteractionAdapter vtkRemoveDuplicatePolys vtkRemoveGhosts vtkRemoveHiddenData vtkRemovePolyData vtkRemoveUnusedPoints vtkRenderPass vtkRenderState vtkRenderTimerLog vtkRenderViewBase vtkRenderWindowCollection vtkRenderWindowInteractor3D vtkRenderbuffer vtkRenderedAreaPicker vtkRenderedHierarchyRepresentation vtkRenderedRepresentation vtkRenderedSurfaceRepresentation vtkRenderedTreeAreaRepresentation vtkRendererDelegate vtkRendererNode vtkRendererSource vtkRenderingCellGrid vtkResampleToImage vtkResampleWithDataSet vtkReservoirSampler vtkReservoirSamplerBase vtkResizingWindowToImageFilter vtkResliceCursor vtkResliceCursorActor vtkResliceCursorLineRepresentation vtkResliceCursorPicker vtkResliceCursorPolyDataAlgorithm vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation vtkResliceCursorWidget vtkResliceImageViewer vtkResliceImageViewerMeasurements vtkResourceFileLocator vtkResourceParser vtkResourceStream vtkRotationFilter vtkRowQuery vtkRowQueryToTable vtkRungeKutta2 vtkRungeKutta45 vtkSDL2OpenGL2RenderWindow vtkSDL2OpenGLRenderWindow vtkSDL2RenderWindowInteractor vtkSDL2WebGPURenderWindow vtkSEPReader vtkSILBuilder vtkSLACParticleReader vtkSLACReader vtkSMPContourGrid vtkSMPMergePoints vtkSMPMergePolyDataHelper vtkSMPProgressObserver vtkSMPThreadLocal vtkSMPThreadLocalAPI vtkSMPThreadLocalImpl vtkSMPThreadLocalImplAbstract vtkSMPThreadLocalObject vtkSMPThreadPool vtkSMPTools vtkSMPToolsAPI vtkSMPToolsAPIInitialize vtkSMPToolsImpl vtkSOADataArrayTemplate vtkSPHCubicKernel vtkSPHInterpolator vtkSPHKernel vtkSPHQuarticKernel vtkSPHQuinticKernel vtkSQLDatabase vtkSQLDatabaseGraphSource vtkSQLDatabaseSchema vtkSQLDatabaseTableSource vtkSQLGraphReader vtkSQLQuery vtkSQLiteDatabase vtkSQLiteDatabaseInternals vtkSQLiteQuery vtkSQLiteToTableReader vtkSSAAPass vtkSSAOPass vtkSVGContextDevice2D vtkSVGExporter vtkScalarBarActorInternal vtkScalarBarRepresentation vtkScalarTree vtkScalarsToColorsItem vtkScalarsToTextureFilter vtkScaledSOADataArrayTemplate vtkScaledTextActor vtkScatterPlotMatrix vtkScenePicker vtkSectorSource vtkSegYBinaryHeaderBytesPositions vtkSegYIOUtils vtkSegYReader vtkSegYReaderInternal vtkSegYTrace vtkSegYTraceHeaderBytesPositions vtkSegYTraceReader vtkSelectionAlgorithm vtkSelector vtkSerializer vtkServerSocket vtkSharedFuture vtkSharedFutureBase vtkShepardKernel vtkSignedCharArray vtkSimple3DCirclesStrategy vtkSimpleBondPerceiver vtkSimpleCellTessellator vtkSimpleImageToImageFilter vtkSimpleReader vtkSimpleScalarTree vtkSingleVTPExporter vtkSliceAndDiceLayoutStrategy vtkSliceCubes vtkSmartPointerBase vtkSmartVector vtkSmoothErrorMetric vtkSobelGradientMagnitudePass vtkSocket vtkSocketCollection vtkSocketCommunicator vtkSocketController vtkSortFieldData vtkSortFileNames vtkSpanSpace vtkSpanTreeLayoutStrategy vtkSparseArrayToTable vtkSpatialRepresentationFilter vtkSpatioTemporalHarmonicsAttribute vtkSpatioTemporalHarmonicsSource vtkSphereHandleRepresentation vtkSpherePuzzle vtkSpherePuzzleArrows vtkSphereTree vtkSphereTreeFilter vtkSpheres vtkSphericalDirectionEncoder vtkSphericalHarmonics vtkSphericalPointIterator vtkSphericalTransform vtkSpline vtkSplineGraphEdges vtkSplineRepresentation vtkSplineWidget vtkSplitByCellScalarFilter vtkSplitColumnComponents vtkSplitField vtkSplitSharpEdgesPolyData vtkSquarifyLayoutStrategy vtkStackedTreeLayoutStrategy vtkStateStorage vtkStaticCellLinks vtkStaticCellLinksTemplate vtkStaticCellLocator vtkStaticCleanPolyData vtkStaticCleanUnstructuredGrid vtkStaticCompositeSource vtkStaticDataSource vtkStaticEdgeLocatorTemplate vtkStaticFaceHashLinksTemplate vtkStaticPointLocator2D vtkStatisticalOutlierRemoval vtkStatisticsAlgorithmPrivate vtkStereoCompositor vtkStitchImageDataWithGhosts vtkStrahlerMetric vtkStreaklineFilter vtkStreamGraph vtkStreamSurface vtkStreamerBase vtkStreamingStatistics vtkStreamingTessellator vtkStringOutputWindow vtkStringToCategory vtkStringToImage vtkStringToNumeric vtkStringToken vtkStructuredAMRGridConnectivity vtkStructuredAMRNeighbor vtkStructuredCellArray vtkStructuredDataPlaneCutter vtkStructuredExtent vtkStructuredGridAlgorithm vtkStructuredGridAppend vtkStructuredGridClip vtkStructuredGridConnectivity vtkStructuredGridLIC2D vtkStructuredGridPartitioner vtkStructuredGridWriter vtkStructuredImplicitConnectivity vtkStructuredNeighbor vtkStructuredPointArray vtkStructuredPointBackend vtkStructuredPointsCollection vtkStructuredPointsGeometryFilter vtkStructuredPointsWriter vtkStructuredTPointBackend vtkSubCommunicator vtkSubGroup vtkSubdivideTetra vtkSubdivisionFilter vtkSurfaceLICComposite vtkSurfaceLICHelper vtkSurfaceLICInterface vtkSurfaceLICMapper vtkSurfaceNets2D vtkSurfaceNets3D vtkSynchronizeTimeFilter vtkSynchronizedRenderWindows vtkSynchronizedRenderers vtkSynchronizedTemplates2D vtkSynchronizedTemplates3D vtkSynchronizedTemplatesCutter3D vtkSystemIncludes vtkTDxInteractorStyle vtkTDxInteractorStyleCamera vtkTDxInteractorStyleSettings vtkTDxMotionEventInfo vtkTDxQtUnixDevices vtkTGAReader vtkTIFFReaderInternal vtkTRUCHASReader vtkTableAlgorithm vtkTableBasedClipCases vtkTableFFT vtkTableReader vtkTableToArray vtkTableToDatabaseWriter vtkTableToGraph vtkTableToMySQLWriter vtkTableToPostgreSQLWriter vtkTableToSQLiteWriter vtkTableToSparseArray vtkTableToStructuredGrid vtkTableToTreeFilter vtkTableWriter vtkTanglegramItem vtkTclCommand vtkTecplotReader vtkTecplotTableReader vtkTemplateAliasMacro vtkTemporalAlgorithm vtkTemporalArrayOperatorFilter vtkTemporalDataSetCache vtkTemporalDelimitedTextReader vtkTemporalFractal vtkTemporalInterpolatedVelocityField vtkTemporalInterpolator vtkTemporalPathLineFilter vtkTemporalShiftScale vtkTemporalSnapToTimeStep vtkTemporalStatistics vtkTensorPrincipalInvariants vtkTensorProbeRepresentation vtkTensorProbeWidget vtkTensorRepresentation vtkTensorWidget vtkTerrainContourLineInterpolator vtkTerrainDataPointPlacer vtkTestDataArray vtkTestNewVar vtkTextActor3D vtkTextCodec vtkTextCodecFactory vtkTextPropertyCollection vtkTextRenderer vtkTextRendererCleanup vtkTextRendererStringToImage vtkTextureIO vtkTextureImageCache vtkTextureMapToCylinder vtkTextureObject vtkTextureUnitManager vtkTexturedActor2D vtkTexturedButtonRepresentation vtkThreadedCallbackQueue vtkThreadedCompositeDataPipeline vtkThreadedImageAlgorithm vtkThreadedImageWriter vtkThreadedTaskQueue vtkThresholdGraph vtkThresholdTable vtkTimeInformation vtkTimePointUtility vtkTimeRange vtkTimeSource vtkTimerLogCleanup vtkTimerLogScope vtkToAffineArrayStrategy vtkToConstantArrayStrategy vtkToImplicitArrayFilter vtkToImplicitRamerDouglasPeuckerStrategy vtkToImplicitStrategy vtkToImplicitTypeErasureStrategy vtkTooltipItem vtkTransferAttributes vtkTransform2D vtkTransformCollection vtkTransformConcatenation vtkTransformConcatenationStack vtkTransformCoordinateSystems vtkTransformFeedback vtkTransformInterpolator vtkTransformPair vtkTransformToGrid vtkTranslucentPass vtkTransmitImageDataPiece vtkTransmitPolyDataPiece vtkTransmitRectilinearGridPiece vtkTransmitStructuredDataPiece vtkTransmitStructuredGridPiece vtkTransmitUnstructuredGridPiece vtkTransposeMatrix vtkTransposeTable vtkTreeAlgorithm vtkTreeAreaView vtkTreeCompositer vtkTreeDifferenceFilter vtkTreeFieldAggregator vtkTreeHeatmapItem vtkTreeIterator vtkTreeLayoutStrategy vtkTreeLevelsFilter vtkTreeMapLayout vtkTreeMapLayoutStrategy vtkTreeMapToPolyData vtkTreeOrbitLayoutStrategy vtkTreeReader vtkTreeRingToPolyData vtkTreeRingView vtkTreeWriter vtkTriQuadraticPyramid vtkTriangularTCoords vtkTriangularTexture vtkTrimmedExtrusionFilter vtkTrivialConsumer vtkTrivialProducer vtkTryDowncastHelper1 vtkTryDowncastHelper2 vtkTryDowncastHelper3 vtkTubeBender vtkTulipReader vtkTuple vtkTypeList vtkTypedArray vtkTypedDataArray vtkTypedDataArrayIterator vtkURI vtkURIComponent vtkURILoader vtkUTF16TextCodec vtkUTF8TextCodec vtkUncertaintyTubeFilter vtkUndirectedGraphAlgorithm vtkUniformGridAMR vtkUniformGridAMRAlgorithm vtkUniformGridAMRDataIterator vtkUniformGridPartitioner vtkUniformHyperTreeGrid vtkUniformHyperTreeGridSource vtkUniforms vtkUnsignedIntArray vtkUnsignedLongArray vtkUnsignedLongLongArray vtkUnsignedShortArray vtkUnstructuredGridAlgorithm vtkUnstructuredGridBase vtkUnstructuredGridBaseAlgorithm vtkUnstructuredGridBunykRayCastFunction vtkUnstructuredGridCellIterator vtkUnstructuredGridGeometryFilter vtkUnstructuredGridHomogeneousRayIntegrator vtkUnstructuredGridLinearRayIntegrator vtkUnstructuredGridPartialPreIntegration vtkUnstructuredGridPreIntegration vtkUnstructuredGridQuadricDecimation vtkUnstructuredGridToCellGrid vtkUnstructuredGridToReebGraphFilter vtkUnstructuredGridVolumeMapper vtkUnstructuredGridVolumeRayCastFunction vtkUnstructuredGridVolumeRayCastIterator vtkUnstructuredGridVolumeRayIntegrator vtkUnstructuredGridVolumeZSweepMapper vtkUpdateCellsV8toV9 vtkVASPAnimationReader vtkVASPTessellationReader vtkVPICReader vtkVRCamera vtkVRCollaborationClient vtkVRControlsHelper vtkVRFollower vtkVRHMDCamera vtkVRHardwarePicker vtkVRInteractorStyle vtkVRMLUseStruct vtkVRMLYaccData vtkVRMenuRepresentation vtkVRMenuWidget vtkVRModel vtkVRPanelRepresentation vtkVRPanelWidget vtkVRRay vtkVRRenderWindow vtkVRRenderWindowInteractor vtkVRRenderer vtkValueSelector vtkVariantBoostSerialization vtkVariantCast vtkVariantCreate vtkVariantExtract vtkVector2 vtkVector3 vtkVector3f vtkVector3i vtkVector4 vtkVector4d vtkVector4i vtkVectorFieldTopology vtkVeraOutReader vtkVertexAdjacencyList vtkVertexDegree vtkVertexListIterator vtkVideoSource vtkView vtkViewDependentErrorMetric vtkViewNode vtkViewNodeFactory vtkViewUpdater vtkVisibilitySort vtkVoidArray vtkVolume16Reader vtkVolumeCollection vtkVolumeContourSpectrumFilter vtkVolumeInputHelper vtkVolumeMapper vtkVolumeMapperNode vtkVolumeMask vtkVolumeNode vtkVolumeOfRevolutionFilter vtkVolumeOutlineSource vtkVolumePicker vtkVolumeRayCastSpaceLeapingImageFilter vtkVolumeReader vtkVolumeStateRAII vtkVolumeTexture vtkVolumetricPass vtkVoronoi2D vtkVoronoiKernel vtkVortexCore vtkVoxelGrid vtkVtkJSSceneGraphSerializer vtkVtkJSViewNodeFactory vtkWGPUContext vtkWarpLens vtkWarpTransform vtkWasmSceneManager vtkWeakPointer vtkWeakPointerBase vtkWeakReference vtkWebApplication vtkWebAssemblyRenderWindowInteractor vtkWebGLDataSet vtkWebGLExporter vtkWebGLObject vtkWebGLPolyData vtkWebGLWidget vtkWebGPUActor vtkWebGPUCamera vtkWebGPUClearPass vtkWebGPUHardwareSelector vtkWebGPUInternalsBindGroup vtkWebGPUInternalsBindGroupLayout vtkWebGPUInternalsBuffer vtkWebGPUInternalsPipelineLayout vtkWebGPUInternalsRenderPassCreateInfo vtkWebGPUInternalsRenderPassDescriptor vtkWebGPUInternalsRenderPipelineDescriptor vtkWebGPUInternalsShaderModule vtkWebGPULight vtkWebGPUPolyDataMapper vtkWebGPUProperty vtkWebGPURenderPass vtkWebGPURenderWindow vtkWebGPURenderer vtkWebInteractionEvent vtkWebUtilities vtkWendlandQuinticKernel vtkWidgetEventTranslator vtkWidgetRepresentation vtkWidgetSet vtkWin32HardwareWindow vtkWin32Header vtkWin32OpenGL2RenderWindow vtkWin32OpenGLDXRenderWindow vtkWin32OpenGLRenderWindow vtkWin32OutputWindow vtkWin32ProcessOutputWindow vtkWin32RenderWindowInteractor vtkWin32VideoSource vtkWindBladeReader vtkWindowNode vtkWrappingHints vtkWriter vtkX3DExporterFIWriter vtkX3DExporterFIWriterHelper vtkX3DExporterWriter vtkX3DExporterXMLWriter vtkXMLCompositeDataSetWriterHelper vtkXMLCompositeDataWriter vtkXMLDataElement vtkXMLDataHeader vtkXMLDataHeaderImpl vtkXMLDataObjectWriter vtkXMLDataParser vtkXMLDataReader vtkXMLDataWriterHelper vtkXMLFileOutputWindow vtkXMLFileReadTester vtkXMLHierarchicalBoxDataFileConverter vtkXMLHierarchicalBoxDataReader vtkXMLHierarchicalBoxDataWriter vtkXMLHierarchicalDataReader vtkXMLHyperTreeGridReader vtkXMLHyperTreeGridWriter vtkXMLMultiGroupDataReader vtkXMLPDataObjectReader vtkXMLPDataObjectWriter vtkXMLPDataReader vtkXMLPDataSetWriter vtkXMLPDataWriter vtkXMLPHierarchicalBoxDataWriter vtkXMLPHyperTreeGridReader vtkXMLPHyperTreeGridWriter vtkXMLPImageDataReader vtkXMLPMultiBlockDataWriter vtkXMLPPolyDataReader vtkXMLPPolyDataWriter vtkXMLPRectilinearGridReader vtkXMLPRectilinearGridWriter vtkXMLPStructuredDataReader vtkXMLPStructuredDataWriter vtkXMLPStructuredGridReader vtkXMLPStructuredGridWriter vtkXMLPTableReader vtkXMLPTableWriter vtkXMLPUniformGridAMRWriter vtkXMLPUnstructuredDataReader vtkXMLPUnstructuredDataWriter vtkXMLPUnstructuredGridReader vtkXMLParser vtkXMLPartitionedDataSetCollectionReader vtkXMLPartitionedDataSetCollectionWriter vtkXMLPartitionedDataSetReader vtkXMLPartitionedDataSetWriter vtkXMLReaderVersion vtkXMLStructuredDataReader vtkXMLStructuredDataWriter vtkXMLTableReader vtkXMLTableWriter vtkXMLUniformGridAMRWriter vtkXMLUnstructuredDataReader vtkXMLUnstructuredDataWriter vtkXMLUtilities vtkXMLWriter vtkXMLWriter2 vtkXMLWriterBase vtkXOpenGLRenderWindow vtkXRenderWindowInteractor vtkXWebGPURenderWindow vtkXYPlotRepresentation vtkXYPlotWidget vtkXYZMolReader vtkXYZMolReader2 vtkXdmf3ArrayKeeper vtkXdmf3ArraySelection vtkXdmf3DataSet vtkXdmf3HeavyDataHandler vtkXdmf3LightDataHandler vtkXdmf3Reader vtkXdmf3SILBuilder vtkXdmf3Writer vtkXdmfArraySelection vtkXdmfDataArray vtkXdmfDocument vtkXdmfDomain vtkXdmfHeavyData vtkXdmfReader vtkXdmfReaderInternal vtkXdmfWriter vtkYieldCriteria vtkYoungsMaterialInterface vtkZLibDataCompressor vtkZSpaceCamera vtkZSpaceCoreCompatibilitySDKManager vtkZSpaceCoreSDKManager vtkZSpaceGenericRenderWindow vtkZSpaceHardwarePicker vtkZSpaceInteractorStyle vtkZSpaceRayActor vtkZSpaceRenderWindowInteractor vtkZSpaceRenderer vtkZSpaceSDKManager vtkZSpaceWin32RenderWindow vtkmAverageToCells vtkmAverageToPoints vtkmCleanGrid vtkmClip vtkmContour vtkmCoordinateSystemTransform vtkmDataArray vtkmDataSet vtkmExternalFaces vtkmExtractVOI vtkmFilterOverrides vtkmGradient vtkmHistogram vtkmImageConnectivity vtkmLevelOfDetail vtkmNDHistogram vtkmPointElevation vtkmPointTransform vtkmPolyDataNormals vtkmProbe vtkmSlice vtkmThreshold vtkmTriangleMeshPointNormals vtkmWarpScalar vtkmWarpVector"},{"location":"Cxx/Coverage/CxxVTKClassesUsed/","title":"VTK Classes used in the Examples","text":""},{"location":"Cxx/Coverage/CxxVTKClassesUsed/#cxx","title":"Cxx","text":"

Out of 3113 available VTK classes, 853 are demonstrated here.

"},{"location":"Cxx/Coverage/CxxVTKClassesUsed/#excluded-classes","title":"Excluded classes","text":"

These classes are excluded since they occur in the majority of the examples:

VTK Class VTK Class VTK Class vtkActor vtkCamera vtkNamedColors vtkNew vtkPolyDataMapper vtkProperty vtkRenderer vtkRenderWindow vtkRenderWindowInteractor vtkSmartPointer"},{"location":"Cxx/Coverage/CxxVTKClassesUsed/#classes-used","title":"Classes used","text":"VTK Class Examples vtk3DSImporter 3DSImporter CombineImportedActors ImportToExport vtkAbstractPicker CaptionActor2D MarkKeypoints vtkAbstractWidget BorderWidget BorderWidgetQt vtkActor2D Actor2D BozoShaderDemo CaptionActor2D Cell3DDemonstration CellTypeSource ChooseTextColorDemo CompareExtractSurface CompareRandomGeneratorsCxx CurvaturesAdjustEdges CurvaturesDemo Delaunay3D Delaunay3DDemo FontFile GeometricObjectsDemo GradientBackground ImageMapper IsoparametricCellsDemo KochanekSplineDemo LabelContours LabeledDataMapper LabeledMesh LabelPlacementMapper LinearCellDemo MarkKeypoints MultiLineText ParametricKuenDemo ParametricObjectsDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo Planes PlatonicSolids PointDataSubdivision QuadraticHexahedronDemo QuadraticTetraDemo ReadAllPolyDataTypesDemo ReadDICOMSeries ReadLegacyUnstructuredGrid RescaleReverseLUT ResizeImageDemo SourceObjectsDemo ThinPlateSplineTransform ViewportBorders Visualize2DPoints vtkActorCollection CombineImportedActors DetermineActorType TransformActorCollection vtkAdjacencyMatrixToEdgeTable AdjacencyMatrixToEdgeTable vtkAdjacentVertexIterator AdjacentVertexIterator vtkAffineRepresentation2D AffineWidget vtkAffineWidget AffineWidget vtkAlgorithm EllipticalButton FixedPointVolumeRayCastMapperCT OpenVRTessellatedBoxSource ReverseAccess TessellatedBoxSource vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestProgressReportFilter vtkAlgorithmOutput ReverseAccess vtkAMRBox Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse OverlappingAMR vtkAMRUtilities Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse OverlappingAMR vtkAngleRepresentation2D AngleWidget2D vtkAngleWidget AngleWidget AngleWidget2D vtkAnimationCue AnimateActors AnimationScene vtkAnimationScene AnimateActors AnimationScene vtkAnnotatedCubeActor AnatomicalOrientation AnnotatedCubeActor ColoredAnnotatedCube CompassWidget FroggieSurface FroggieView OrientationMarkerWidget vtkAnnotationLink SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver vtkAppendFilter AppendFilter CameraModel1 ConnectivityFilter PolyDataToUnstructuredGrid QuadricVisualization ReadAllUnstructuredGridTypes vtkAppendPolyData AffineWidget BlobbyLogo CameraModel2 ColorDisconnectedRegions CombineImportedActors CombinePolyData ContoursToSurface CorrectlyRenderTranslucentGeometry DepthSortPolyData ExtractClusters ExtractOutsideSurface ExtrudePolyDataAlongLine FilledContours PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion ProbeCombustor RemoveOutsideSurface ResampleAppendedPolyData VelocityProfile WarpCombustor XYPlot vtkAreaPicker AreaPicking HighlightSelectedPoints HighlightSelection vtkArrayCalculator ArrayCalculator ExtractArrayComponent vtkArrayData AdjacencyMatrixToEdgeTable ArrayToTable ArrayWriter vtkArrayDispatch ForLoop vtkArrayPrint AdjacencyMatrixToEdgeTable vtkArrayToTable ArrayToTable vtkArrayWriter ArrayWriter vtkArrowSource Arrow BrownianPoints CurvatureBandsWithGlyphs DistanceToCamera DotProduct ElevationBandsWithGlyphs EllipticalCylinderDemo ExtractSurfaceDemo GeometricObjectsDemo GLTFExporter Gradient GradientFilter ImageSobel2D NormalEstimation OpenVROrientedArrow OrientedArrow OrientedGlyphs OutlineGlowPass ParametricObjectsDemo PlaneSourceDemo PointDataSubdivision RotationAroundLine TransformFilter VectorField vtkAssembly Assembly MovableAxes vtkAssemblyNode ImageRegion vtkAssemblyPath ImageRegion MovableAxes PickPixel PickPixel2 vtkAssignAttribute GradientFilter vtkAxes Finance FinanceFieldData Rotations RotationsA RotationsB RotationsC RotationsD TensorAxes TextOrigin WalkCow WalkCowA WalkCowB vtkAxesActor AlignTwoPolyDatas AnatomicalOrientation Axes CallBack CheckVTKVersion ColoredAnnotatedCube DisplayCoordinateAxes FroggieSurface FroggieView IndividualVRML LayeredActors MovableAxes PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision TransformOrderDemo vtkAxis AreaPlot BarChart BarChartQt BoxChart ChartMatrix Histogram2D KDTreeTimingDemo ModifiedBSPTreeTimingDemo MultiplePlots OBBTreeTimingDemo OctreeTimingDemo StackedBar StackedPlot vtkAxisActor AxisActor vtkBalloonRepresentation BalloonWidget vtkBalloonWidget BalloonWidget vtkBandedPolyDataContourFilter BandedPolyDataContourFilter ColoredAnnotatedCube CurvatureBandsWithGlyphs ElevationBandsWithGlyphs NamedColors PolyDataIsoLines vtkBarChartActor CompareRandomGeneratorsCxx HistogramBarChart ImageAccumulateGreyscale vtkBiDimensionalRepresentation2D BiDimensionalWidget vtkBiDimensionalWidget BiDimensionalWidget vtkBillboardTextActor3D BillboardTextActor3D vtkBiQuadraticQuad IsoparametricCellsDemo vtkBiQuadraticQuadraticHexahedron IsoparametricCellsDemo vtkBiQuadraticQuadraticWedge IsoparametricCellsDemo vtkBiQuadraticTriangle IsoparametricCellsDemo vtkBMPReader ImageWarp ReadBMP ThinPlateSplineTransform WriteBMP vtkBMPWriter ImageWriter WriteBMP ZBuffer vtkBooleanOperationPolyDataFilter BooleanOperationPolyDataFilter vtkBooleanTexture TextureCutQuadric vtkBoostBreadthFirstSearch BreadthFirstDistance DepthFirstSearchIterator vtkBoostBreadthFirstSearchTree BoostBreadthFirstSearchTree vtkBoostConnectedComponents ConnectedComponents vtkBoostPrimMinimumSpanningTree DepthFirstSearchIterator MinimumSpanningTree vtkBorderRepresentation BorderWidget BorderWidgetQt CenterAnImage ImageClip ImageRegion vtkBorderWidget BorderWidget BorderWidgetQt CenterAnImage ImageClip ImageRegion vtkBoundedPointSource ExtractPointsDemo FitImplicitFunction MaskPointsFilter vtkBoundingBox BoundingBox BoundingBoxIntersection vtkBox BooleanOperationImplicitFunctions Box ImplicitBooleanDemo ImplicitDataSetClipping IntersectLine ModifiedBSPTreeTimingDemo OBBTreeTimingDemo vtkBoxClipDataSet BoxClipStructuredPoints BoxClipUnstructuredGrid vtkBoxMuellerRandomSequence GaussianRandomNumber PCADemo vtkBoxRepresentation BoxWidget2 vtkBoxWidget BoxWidget Tutorial_Step6 vtkBoxWidget2 BoxWidget2 vtkBrownianPoints BrownianPoints vtkBrush AreaPlot Diagram Histogram2D MultiplePlots ReadLegacyUnstructuredGrid vtkButterflySubdivisionFilter PointDataSubdivision Subdivision SubdivisionDemo vtkButtonWidget EllipticalButton TexturedButtonWidget vtkBYUReader AlignTwoPolyDatas BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CapClip CellCentersDemo CellsInsideObject ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CompareExtractSurface ConnectivityFilterDemo Delaunay3DDemo DensifyPoints ExportPolyDataScene ExtractEnclosedPoints ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FillHoles GradientBackground HiddenLineRemoval HighlightSelection ImplicitModeller InterpolateCamera KDTreeFindPointsWithinRadiusDemo LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties Motor NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientedBoundingCylinder PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface ProjectedTexture RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation SignedDistance SpatterShader SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Subdivision SubdivisionDemo UnsignedDistance VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree WalkCow WalkCowA WalkCowB vtkCallbackCommand AffineWidget Animation Arbitrary3DCursor AreaPicking CallBack CallData CameraModifiedEvent CellLocatorVisualization ClientData CloseWindow DataAnimation FilterProgress FilterSelfProgress FireFlowDemo FrameRate FroggieView Hanoi HanoiInitial HanoiIntermediate HDRReader ImageTracerWidget ImageTracerWidgetInsideContour InteractorStyleUser KeypressObserver LayeredActors LODProp3D MouseEventsObserver MovableAxes MultipleRenderWindows ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointLocatorVisualization PolygonalSurfacePointPlacer ProgressReport RubberBand2DObserver SeedWidgetImage SelectedVerticesAndEdgesObserver SelectWindowRegion Slider Slider2D SphereWidget SphereWidgetEvents StreamlinesWithLineWidget Timer TransientHDFReader TransparentBackground UserEvent vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter WalkCow WalkCowA WalkCowB WindowModifiedEvent vtkCameraActor CameraActor vtkCameraInterpolator InterpolateCamera vtkCameraOrientationWidget AlignTwoPolyDatas CameraOrientationWidget CheckVTKVersion CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges ElevationBandsWithGlyphs FroggieSurface FroggieView PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkCameraPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing RenderScalarToFloatBuffer Shadows ShadowsLightsDemo vtkCaptionActor2D AnatomicalOrientation Axes CaptionActor2D CaptionWidget ColoredAnnotatedCube FroggieSurface FroggieView PointDataSubdivision vtkCaptionRepresentation CaptionWidget vtkCaptionWidget CaptionWidget vtkCardinalSpline 1DTupleInterpolation CardinalSpline ResamplePolyLine vtkCategoryLegend ReadLegacyUnstructuredGrid vtkCell CellEdges Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse GetCellCenter PickPixel PickPixel2 TriangleArea vtkCellArray AddCell AreaPicking BandedPolyDataContourFilter Bottle CameraModel1 CameraModel2 CappedSphere Cell3DDemonstration ChooseTextColorDemo ColoredLines ColoredPoints CompareExtractSurface ConstrainedDelaunay2D ContoursToSurface ContourWidget CreateESGrid Cube CurvedReformation DataSetSurface DecimatePolyline DeformPointSet DeleteCells EllipticalCylinder EllipticalCylinderDemo ExtractEdges ExtractPolyLinesFromPolyData FitSplineToCutterOutput Glyph3DImage GradientBackground Hexahedron IterateOverLines IterativeClosestPointsTransform KochSnowflake LabelContours LabeledMesh LandmarkTransform LinearCellDemo LongLine MiscCellData MultiLineText NOVCAGraph PineRootConnectivity PineRootDecimation Point PointsProjectedHull PolyDataCellNormals PolyDataIsoLines PolyDataPointNormals Polygon PolyLine PolyLine1 Pyramid Quad ReadAllPolyDataTypesDemo ReadPlainTextTriangles RemoveVertices ResamplePolyLine RibbonFilter RuledSurfaceFilter ShepardMethod SingleSplat Spring Tetrahedron TextureMapQuad ThresholdCells Triangle TriangleArea TriangleColoredPoints TriangleSolidColor TriangleStrip TubesWithVaryingRadiusAndColors Vertex ViewportBorders Visualize2DPoints WarpVector WriteVTP WriteVTU vtkCellArrayIterator ExtractPolyLinesFromPolyData FitSplineToCutterOutput LabelContours PineRootConnectivity PineRootDecimation vtkCellCenters CellCenters CellCentersDemo LabeledMesh vtkCellData AssignCellColorsFromLUT CellTypeSource ColorCells ColorCellsWithRGB ColoredAnnotatedCube ColoredLines CombineImportedActors CreateColorSeriesDemo Delaunay3D Delaunay3DDemo DumpXMLFile FilledContours FindAllArrayNames FindCellIntersections Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse GenerateCubesFromLabels GenericClip GetMiscCellData HighlightBadCells IdentifyHoles ImplicitDataSetClipping IntersectLine IterativeClosestPointsTransform KochSnowflake LandmarkTransform LoadESGrid MeshQuality MiscCellData PointCellIds PolyDataCellNormals PolyDataExtractNormals ReadLegacyUnstructuredGrid RemoveOutsideSurface StructuredGrid TableBasedClipDataSetWithPolyData2 ThresholdCells TriangleSolidColor vtkCellIterator Delaunay3D Delaunay3DDemo ExtractFaces IdentifyHoles QuadraticHexahedronDemo QuadraticTetraDemo ReadLegacyUnstructuredGrid RemoveOutsideSurface StructuredGrid vtkCellLocator CellLocator CellLocatorVisualization ExtractOutsideSurface FindCellIntersections InterpolateTerrain RemoveOutsideSurface ResampleAppendedPolyData vtkCellPicker CellPicking MoveAGlyph vtkCellTreeLocator CellTreeLocator vtkCellType UGrid vtkCellTypes CellTypeSource ClipDataSetWithPolyData ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 DumpXMLFile ExtractFaces ReadLegacyUnstructuredGrid TableBasedClipDataSetWithPolyData vtkCellTypeSource CellTypeSource vtkCenterOfMass CenterOfMass vtkCharArray AreaPlot vtkChart AreaPlot BarChart BarChartQt ChartMatrix ChartsOn3DScene KDTreeTimingDemo LinePlot ModifiedBSPTreeTimingDemo MultiplePlots OBBTreeTimingDemo OctreeTimingDemo ScatterPlot StackedBar StackedPlot vtkChartBox BoxChart vtkChartHistogram2D Histogram2D vtkChartLegend FunctionalBagPlot StackedBar vtkChartMatrix ChartMatrix vtkChartParallelCoordinates ParallelCoordinates vtkChartPie PieChart vtkChartXY AreaPlot BarChart BarChartQt ChartMatrix ChartsOn3DScene FunctionalBagPlot KDTreeTimingDemo LinePlot ModifiedBSPTreeTimingDemo MultiplePlots OBBTreeTimingDemo OctreeTimingDemo ScatterPlot StackedBar StackedPlot vtkChartXYZ PlotLine3D SurfacePlot vtkCheckerboardRepresentation CheckerboardWidget vtkCheckerboardWidget CheckerboardWidget vtkCircularLayoutStrategy LabelVerticesAndEdges vtkCleanPolyData BooleanOperationPolyDataFilter CleanPolyData CombinePolyData CurvatureBandsWithGlyphs CurvaturesDemo Delaunay3D Delaunay3DDemo DistancePolyDataFilter DownsamplePointCloud ElevationBandsWithGlyphs ExtrudePolyDataAlongLine FilledContours LoopBooleanPolyDataFilter NormalsDemo OrientedBoundingCylinder PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision Silhouette SpatterShader WarpSurface vtkClipClosedSurface ClipClosedSurface vtkClipDataSet ClipDataSetWithPolyData ClipUnstructuredGridWithPlane2 TissueLens vtkClipPolyData CapClip ClipArt ClipFrustum ClipSphereCylinder CreateBFont FilledContours ImplicitDataSetClipping ImplicitPlaneWidget2 ImplicitSelectionLoop PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing SelectPolyData SolidClip vtkClipVolume ClipVolume vtkCMLMoleculeReader ReadCML vtkCollisionDetectionFilter CollisionDetection vtkColor GradientBackground vtkColor3d AnimateActors AreaPlot BarChart BarChartQt BooleanOperationImplicitFunctions BoxClipStructuredPoints BoxClipUnstructuredGrid CellCentersDemo CellsInsideObject ChartsOn3DScene ClipVolume ConeDemo CubeAxesActor ExtractPolyLinesFromPolyData FireFlow FireFlowDemo FunctionalBagPlot GLTFExporter GLTFImporter Histogram2D ImplicitQuadric ImplicitSphere1 NormalsDemo OrientedBoundingCylinder PlaneSourceDemo ReadOBJ ShadowsLightsDemo SubdivisionDemo VoxelsOnBoundary vtkColor3ub ColorSeriesPatches CreateColorSeriesDemo Curvatures FunctionalBagPlot NamedColorPatches PieChartActor PointDataSubdivision ShareCamera SplitPolyData WordCloud vtkColor4ub Histogram2D vtkColorLegend Histogram2D vtkColorSeries BarChart CellTypeSource ColoredAnnotatedCube ColorSeriesPatches CreateColorSeriesDemo CurvatureBandsWithGlyphs Curvatures Diagram ElevationBandsWithGlyphs FunctionalBagPlot Hawaii ImplicitBooleanDemo LUTUtilities MergeSelections MeshQuality OpenVRVolume PieChart PieChartActor PointDataSubdivision ScalarBarActorColorSeries ShareCamera SplitPolyData StackedBar StackedPlot TensorEllipsoids WordCloud vtkColorTransferFunction AssignCellColorsFromLUT BackgroundTexture ColorTransferFunction CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo DisplacementPlot ElevationBandsWithGlyphs FixedPointVolumeRayCastMapperCT Histogram2D IntermixedUnstructuredGrid MedicalDemo4 MinIntensityRendering OpenVRVolume PointDataSubdivision RayCastIsosurface ShepardMethod SimpleRayCast vtkCommand AffineWidget AnimateActors Animation AnimationScene Arbitrary3DCursor AreaPicking BiDimensionalWidget BorderWidget BorderWidgetQt BoxWidget BoxWidget2 BozoShader BozoShaderDemo CallBack CallData CameraModifiedEvent CellLocatorVisualization CenterAnImage ClientData CloseWindow CommandSubclass CompassWidget DataAnimation DataAnimationSubclass Delaunay3DDemo DepthFirstSearchAnimation EllipticalButton EventQtSlotConnect FilterProgress FilterSelfProgress FireFlowDemo FrameRate FroggieView Hanoi HDRReader HoverWidget ImageClip ImageRegion ImageTracerWidget ImageTracerWidgetInsideContour ImplicitPlaneWidget2 InteractorStyleUser IsoContours KeypressObserver KochanekSplineDemo LayeredActors LineWidget2 LODProp3D MarbleShader MarbleShaderDemo MouseEventsObserver MovableAxes ObserveError ObserverMemberFunction OctreeVisualize ParametricKuenDemo ParametricObjectsDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel PickPixel2 PointLocatorVisualization PolygonalSurfacePointPlacer ProgressReport QuadraticHexahedronDemo QuadraticTetraDemo RotatingSphere RubberBand2DObserver SeedWidgetImage SeedWidgetWithCustomCallback SelectWindowRegion ShareCameraQt Slider Slider2D SpatterShader SphereWidget SphereWidget2 SphereWidgetEvents StreamlinesWithLineWidget Timer TransientHDFReader TransparentBackground Tutorial_Step2 Tutorial_Step6 VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter WindowModifiedEvent vtkCompassRepresentation CompassWidget vtkCompassWidget CompassWidget vtkCompositeDataDisplayAttributes CompositePolyDataMapper vtkCompositeDataGeometryFilter InterpolateFieldDataDemo MultiBlockDataSet OverlappingAMR ReadExodusData vtkCompositeDataSet ImportPolyDataScene vtkCompositeDataWriter Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse vtkCompositePolyDataMapper CompositePolyDataMapper vtkCompositePolyDataMapper2 CompositePolyDataMapper vtkComputeQuartiles BoxChart vtkCone ExtractPointsDemo IceCream MaskPointsFilter RandomProbe vtkConeSource AnimateActors Arbitrary3DCursor BoxWidget BoxWidget2 CallBack CameraBlur CameraModel1 CameraModel2 CarotidFlowGlyphs ClipDataSetWithPolyData ColoredAnnotatedCube ColorMapToLUT CombinePolyData Cone Cone3 Cone4 ConeDemo GeometricObjectsDemo GradientBackground HyperStreamline Mace Model MovableAxes MultipleRenderWindows MultipleViewports NamedColors OpenVRCone Outline PickableOff PointDataSubdivision ProgrammableGlyphFilter Reflection ReportRenderWindowCapabilities ResetCameraOrientation RotateActor ShadowsLightsDemo ShareCamera ShareCameraQt SingleSplat SourceObjectsDemo SpikeFran TableBasedClipDataSetWithPolyData TensorAxes TensorEllipsoids TrackballActor TrackballCamera TransformActor TransformActorCollection TransparentBackground Tutorial_Step1 Tutorial_Step2 Tutorial_Step3 Tutorial_Step4 Tutorial_Step5 Tutorial_Step6 vtkConnectivityFilter Blow ConnectivityFilter IdentifyHoles PineRootDecimation RemoveOutsideSurface vtkContext2D Diagram vtkContext3D PlotLine3D vtkContextActor ChartsOn3DScene Diagram MultiplePlots vtkContextItem Diagram vtkContextMouseEvent SurfacePlot vtkContextScene ChartsOn3DScene Diagram MultiplePlots PlotLine3D ReadLegacyUnstructuredGrid SurfacePlot vtkContextTransform ReadLegacyUnstructuredGrid vtkContextView AreaPlot BarChart BarChartQt BoxChart ChartMatrix FunctionalBagPlot Histogram2D KDTreeTimingDemo LinePlot ModifiedBSPTreeTimingDemo OBBTreeTimingDemo OctreeTimingDemo ParallelCoordinates PieChart PlotLine3D ReadLegacyUnstructuredGrid ScatterPlot StackedBar StackedPlot SurfacePlot vtkContourFilter BackgroundTexture BlobbyLogo Blow BooleanOperationImplicitFunctions CameraModel1 CameraModel2 CarotidFlow CarotidFlowGlyphs ColorIsosurface CombustorIsosurface ContourQuadric CutWithScalars DisplayQuadricSurfaces EmbedPointsIntoVolume ExternalContour FilledContours Finance FireFlow FireFlowDemo FlatVersusGouraud FlyingHeadSlice GaussianSplat GenericClip HeadSlice Hello IceCream ImplicitBoolean ImplicitBooleanDemo ImplicitModeller ImplicitQuadric ImplicitSphere ImplicitSphere1 IntermixedUnstructuredGrid IronIsoSurface IsoContours LabelContours Lorenz MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD Morph3D OverlappingAMR PerlinNoise ProbeCombustor PseudoVolumeRendering QuadraticSurface QuadricVisualization ReadSLC SampleFunction ShepardInterpolation ShepardMethod SingleSplat SplatFace SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc Vol vtkContourRepresentation PolygonalSurfacePointPlacer vtkContourTriangulator ContourTriangulator vtkContourValues RayCastIsosurface vtkContourWidget ContourWidget PolygonalSurfaceContourLineInterpolator PolygonalSurfacePointPlacer vtkConvexPointSet ConvexPointSet vtkCoordinate CenterAnImage ChooseTextColorDemo CompareExtractSurface Coordinate GradientBackground ImageRegion MarkKeypoints MultiLineText ReadAllPolyDataTypesDemo TexturedButtonWidget ViewportBorders vtkCornerAnnotation CornerAnnotation PickPixel PickPixel2 vtkCubeAxesActor CubeAxesActor DetermineActorType vtkCubeAxesActor2D CubeAxesActor2D vtkCubeSource Assembly CameraModel1 CameraModel2 ChartsOn3DScene CleanPolyData CloseWindow ColoredAnnotatedCube ColorGlyphs Cube1 CurvaturesAdjustEdges Cutter Follower Game GeometricObjectsDemo Glyph3D Glyph3DMapper ImplicitDataSetClipping LayeredActors Legend MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD Model MultipleRenderWindows MultipleViewports Opacity OpenVRCube OrientationMarkerWidget PBR_Clear_Coat PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointInsideObject ProgrammableGlyphFilter ScaleGlyphs SceneBounds SelectAnActor Shadows ShadowsLightsDemo ShareCamera ShareCameraQt ShrinkCube SideBySideRenderWindowsQt SideBySideViewports SourceObjectsDemo TensorGlyph TransformActorCollection TransparentBackground vtkCubicLine IsoparametricCellsDemo vtkCullerCollection LoopShrink vtkCursor2D Cursor2D vtkCursor3D Cursor3D vtkCurvatures CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo vtkCutter ContoursFromPolyData CutStructuredGrid Cutter CutWithCutFunction DataSetSurface ExtractPolyLinesFromPolyData FitSplineToCutterOutput PolyDataContourToImageData PseudoVolumeRendering vtkCylinder ClipSphereCylinder ExtractPointsDemo IsosurfaceSampling vtkCylinderSource Cylinder CylinderExample FlatVersusGouraud GeometricObjectsDemo Hanoi HanoiInitial HanoiIntermediate MultipleRenderWindows MultipleViewports OpenVRCylinder OpenVROrientedCylinder OrientedCylinder RescaleReverseLUT ShareCamera SourceObjectsDemo TransformPipeline vtkDataArray ConnectedComponents EnhanceEdges ForLoop Game HybridMedianComparison ImageCorrelation InterpolateTerrain LabelContours MedianComparison MorphologyComparison PickPixel PointInsideObject PolyDataExtractNormals vtkDataObject CellsInsideObject CompareRandomGeneratorsCxx DistanceToCamera ExtractVisibleCells GenerateCubesFromLabels GenerateModelsFromLabels HighlightBadCells HistogramBarChart ImageAccumulateGreyscale ImportPolyDataScene IntersectLine OfficeTube PieChartActor SpiderPlot ThinPlateSplineTransform ThresholdCells ThresholdPoints VoxelsOnBoundary vtkImageAlgorithmFilter vtkTest vtkTest1 vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader Warnings WarpSurface vtkDataObjectReader FinanceFieldData vtkDataObjectToDataSetFilter FinanceFieldData vtkDataObjectTree ImportPolyDataScene vtkDataObjectTreeIterator ImportPolyDataScene vtkDataSet DumpXMLFile Finance HighlightBadCells ImplicitDataSetClipping MergeSelections MultiBlockDataSet ProcrustesAlignmentFilter SaveSceneToFieldData SelectionSource vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkDataSetAttributes AdjacentVertexIterator BoostBreadthFirstSearchTree BreadthFirstDistance ColorEdges ColorVertexLabels ColorVerticesLookupTable ConnectedComponents CreateTree DepthFirstSearchAnimation DepthFirstSearchIterator EdgeWeights GenerateCubesFromLabels GenerateModelsFromLabels GradientFilter HighlightBadCells LabelVerticesAndEdges MinimumSpanningTree ScaleVertices SideBySideGraphs VertexSize WarpSurface vtkDataSetCollection KdTree KDTreeAccessPoints vtkDataSetMapper AlignTwoPolyDatas AppendFilter BlankPoint Blow BoxClipStructuredPoints BoxClipUnstructuredGrid CameraModel1 CameraModel2 CapClip Cell3DDemonstration CellCenters CellEdgeNeighbors CellPicking CellPointNeighbors CellsInsideObject CellTypeSource ClipClosedSurface ClipDataSetWithPolyData ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ClipVolume Colored2DImageFusion ColoredSphere ConnectivityFilter ConnectivityFilterDemo ContourTriangulator ConvexHull ConvexHullShrinkWrap ConvexPointSet CreateESGrid CurvedReformation CutStructuredGrid DataSetSurface Delaunay3D Delaunay3DDemo DisplacementPlot ExponentialCosine ExtractCellsUsingPoints ExtractData ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId ExtractVisibleCells GenericClip Hawaii Hexahedron HighlightBadCells HighlightSelectedPoints HighlightSelection HyperTreeGridSource IdentifyHoles ImageContinuousDilate3D ImageContinuousErode3D ImageToStructuredPoints ImageWarp InterpolateFieldDataDemo InterpolateMeshOnGrid IntersectLine IsoparametricCellsDemo LinearCellDemo LinearExtrusion LoadESGrid LoopShrink MarchingSquares MergeSelections MinimalQtVTKApp ModifiedBSPTreeExtractCells Motor OBBTreeExtractCells OpenVRTessellatedBoxSource OrientationMarkerWidget1 PineRootConnectivity PineRootDecimation PlateVibration PointDataSubdivision PointOccupancy Polyhedron ProcrustesAlignmentFilter Pyramid QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo QuadricVisualization RandomProbe ReadAllUnstructuredGridTypes ReadImageData ReadLegacyUnstructuredGrid ReadRectilinearGrid ReadUnknownTypeXMLFile ReadUnstructuredGrid RectilinearGrid Reflection ScalarBarWidget ShrinkCube SplitPolyData StructuredDataTypes StructuredGrid TableBasedClipDataSetWithPolyData TableBasedClipDataSetWithPolyData2 TessellatedBoxSource Tetrahedron TextureCutQuadric TextureCutSphere TextureThreshold TissueLens TransformSphere TriangleStrip UGrid VertexConnectivity VisualizeImageData VisualizeRectilinearGrid VisualizeStructuredGridCells VoxelsOnBoundary WarpTo Wireframe WriteVTU vtkDataSetReader Blow DumpXMLFile RenderScalarToFloatBuffer vtkDataSetSurfaceFilter DataSetSurface DataSetSurfaceFilter FillHoles FindCellIntersections HighlightSelectedPoints HighlightSelection MatrixMathFilter RenderScalarToFloatBuffer vtkDataSetTriangleFilter IntermixedUnstructuredGrid vtkDataSetWriter ImplicitDataSetClipping vtkDecimatePolylineFilter DecimatePolyline vtkDecimatePro ClipArt DecimateFran DecimateHawaii Decimation FroggieSurface PineRootDecimation StripFran vtkDeformPointSet DeformPointSet vtkDelaunay2D ColoredElevationMap ConstrainedDelaunay2D CurvatureBandsWithGlyphs CurvaturesAdjustEdges Delaunay2D DelaunayMesh ElevationBandsWithGlyphs ElevationFilter InterpolateMeshOnGrid InterpolateTerrain SimpleElevationFilter SmoothPolyDataFilter TriangulateTerrainMap vtkDelaunay3D ConnectivityFilter Delaunay3D Delaunay3DDemo PointInsideObject2 XMLPUnstructuredGridWriter vtkDelimitedTextReader DelimitedTextReader ParallelCoordinatesView PointInterpolator vtkDelimitedTextWriter DelimitedTextWriter vtkDemandDrivenPipeline vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkDEMReader DEMReader FitToHeightMap vtkDenseArray 2DArray 3DArray AdjacencyMatrixToEdgeTable ArrayToTable ArrayWriter CustomDenseArray DenseArrayRange vtkDensifyPointCloudFilter DensifyPoints vtkDepthSortPolyData CorrectlyRenderTranslucentGeometry DepthSortPolyData vtkDICOMImageReader FixedPointVolumeRayCastMapperCT MarchingCubes ReadDICOM ReadDICOMSeries vtkDijkstraGraphGeodesicPath DijkstraGraphGeodesicPath ShortestPath vtkDirectedGraph DirectedGraphToMutableDirectedGraph MutableDirectedGraphToDirectedGraph vtkDirectory FilenameFunctions vtkDiscreteFlyingEdges3D DiscreteMarchingCubes GenerateModelsFromLabels vtkDiscreteMarchingCubes DiscreteMarchingCubes GenerateModelsFromLabels SmoothDiscreteMarchingCubes vtkDiscretizableColorTransferFunction ColorMapToLUT DiscretizableColorTransferFunction RescaleReverseLUT TransientHDFReader vtkDiskSource BoundaryEdges Disk ExtrudePolyDataAlongLine GeometricObjectsDemo SourceObjectsDemo vtkDistancePolyDataFilter DistancePolyDataFilter vtkDistanceRepresentation DistanceWidget vtkDistanceToCamera DistanceToCamera vtkDistanceWidget DistanceWidget vtkDoubleArray ArrayCalculator AttachAttributes BoostBreadthFirstSearchTree BreadthFirstDistance Casting ClipVolume CopyAllArrays CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo CutWithScalars DelimitedTextReader DepthFirstSearchIterator EdgeWeights ElevationBandsWithGlyphs ExponentialCosine ExportPolyDataScene ExtractArrayComponent FieldData FunctionalBagPlot Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse GetMiscPointData Gradient HighlightBadCells ImageValueRange InterpolateTerrain KDTreeFindPointsWithinRadiusDemo KMeansClustering LabelContours LabelVerticesAndEdges MeshQuality MinimalQtVTKApp MinimumSpanningTree MiscCellData OctreeFindPointsWithinRadiusDemo ParallelCoordinatesView PCADemo PCAStatistics PKMeansClustering PointLocatorFindPointsWithinRadiusDemo PolyDataCellNormals PolyDataExtractNormals PolyDataPointNormals RectilinearGrid RectilinearGridToTetrahedra RGrid SGrid SingleSplat SortDataArray StackedBar StackedPlot StaticLocatorFindPointsWithinRadiusDemo StippledLine StructuredDataTypes StructuredGrid TableBasedClipDataSetWithPolyData2 TensorGlyph TextureCutSphere TubesFromSplines TubesWithVaryingRadiusAndColors VisualizeRectilinearGrid Vol WarpScalar WarpVector vtkEarthSource EarthSource vtkEdgeListIterator EdgeListIterator vtkEdgePoints EdgePoints vtkElevationFilter ColoredAnnotatedCube ColoredSphere ColorMapToLUT CurvatureBandsWithGlyphs DeformPointSet ElevationBandsWithGlyphs ElevationFilter Hawaii LoopShrink NamedColors PointDataSubdivision ProjectSphere RescaleReverseLUT SideBySideRenderWindowsQt TransformSphere vtkEllipticalButtonSource EllipticalButton vtkEuclideanClusterExtraction ExtractClusters vtkEventQtSlotConnect EventQtSlotConnect vtkExecutive ClipVolume TableBasedClipDataSetWithPolyData2 vtkExodusIIReader InterpolateFieldDataDemo ReadExodusData vtkExodusIIWriter ExodusIIWriter vtkExplicitStructuredGrid CreateESGrid LoadESGrid vtkExplicitStructuredGridToUnstructuredGrid CreateESGrid vtkExtractCells ModifiedBSPTreeExtractCells OBBTreeExtractCells vtkExtractEdges DelaunayMesh ExtractEdges GradientFilter MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MultiBlockDataSet ReadLegacyUnstructuredGrid VertexConnectivity vtkExtractEnclosedPoints ExtractEnclosedPoints OrientedBoundingCylinder vtkExtractGeometry ExtractData HighlightSelectedPoints vtkExtractGrid PseudoVolumeRendering vtkExtractPoints ExtractPointsDemo vtkExtractPolyDataGeometry HighlightSelection vtkExtractSelection CellEdgeNeighbors CellPicking CellPointNeighbors ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId ExtractVisibleCells FillHoles MergeSelections SelectionSource VertexConnectivity vtkExtractSurface CompareExtractSurface ExtractSurface ExtractSurfaceDemo vtkExtractVOI ExtractVOI FlyingHeadSlice HeadSlice QuadricVisualization ReadSLC vtkFastSplatter FastSplatter vtkFeatureEdges BoundaryEdges CapClip ClosedSurface CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo ExtrudePolyDataAlongLine vtkFFMPEGWriter FFMPEG vtkFieldData AlignTwoPolyDatas CompareRandomGeneratorsCxx DumpXMLFile ExportPolyDataScene HistogramBarChart ImageAccumulateGreyscale ImportPolyDataScene PieChartActor SaveSceneToFieldData SpiderPlot vtkFieldDataToAttributeDataFilter FinanceFieldData Gradient vtkFileOutputWindow FileOutputWindow vtkFillHolesFilter FillHoles IdentifyHoles MassProperties vtkFitImplicitFunction FitImplicitFunction vtkFitToHeightMapFilter FitToHeightMap vtkFixedPointVolumeRayCastMapper FixedPointVolumeRayCastMapperCT MedicalDemo4 MinIntensityRendering SimpleRayCast vtkFloatArray AreaPlot ArrayLookup ArrayRange BackgroundTexture BandedPolyDataContourFilter CardinalSpline ChartMatrix ChartsOn3DScene ClipDataSetWithPolyData ColorCells CopyAllArrays CreateColorSeriesDemo Cube CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs ElevationFilter FilledContours Finance GetMiscCellData Glyph3DMapper HedgeHog ImageSeparableConvolution ImplicitPolyDataDistance InterpolateMeshOnGrid KDTreeTimingDemo KnownLengthArray LinePlot MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MiscPointData ModifiedBSPTreeTimingDemo Motor MultiplePlots NullPoint OBBTreeTimingDemo OctreeTimingDemo OverlappingAMR ParallelCoordinates ParallelCoordinatesView PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PieChartActor PlotLine3D PolyDataExtractNormals RenderScalarToFloatBuffer ReverseSense ScalarBarActor ScalarBarActorColorSeries ScaleGlyphs ScaleVertices ScatterPlot ShepardMethod SimpleElevationFilter SpiderPlot SurfacePlot TableBasedClipDataSetWithPolyData TextureMapQuad UnknownLengthArray VectorArrayKnownLength VectorArrayUnknownLength VectorDot VectorNorm WeightedTransformFilter vtkFloatingPointExceptions FloatingPointExceptions vtkFlyingEdges2D FlyingHeadSlice vtkFlyingEdges3D ExtractLargestIsosurface FrogBrain FroggieSurface HeadBone IsosurfaceSampling MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 TissueLens vtkFollower FinanceFieldData Follower MovableAxes Stocks TextOrigin vtkForceDirectedLayoutStrategy ConstructGraph EdgeWeights RandomGraphSource ScaleVertices SideBySideGraphs vtkFreeTypeTools ImageText StringToImageDemo WordCloud vtkFrustumSource ClipFrustum Frustum OpenVRFrustum ProjectedTexture vtkFunctionParser FunctionParser vtkGaussianKernel InterpolateFieldDataDemo PointInterpolator vtkGaussianSplatter EmbedPointsIntoVolume Finance FinanceFieldData GaussianSplat SingleSplat SplatFace vtkGenericCell CellTreeLocator ExtractFaces IdentifyHoles QuadraticHexahedronDemo QuadraticTetraDemo ReadLegacyUnstructuredGrid RemoveOutsideSurface vtkGenericClip GenericClip vtkGenericDataArray AdjacentVertexIterator BackgroundTexture ColoredElevationMap ColoredLines ColoredPoints ColorGlyphs ElevationFilter IterativeClosestPointsTransform LandmarkTransform ShepardMethod SimpleElevationFilter TriangleColoredPoints TriangleSolidColor VectorDot VectorNorm vtkGenericDataObjectReader GenericDataObjectReader vtkGenericOpenGLRenderWindow BarChartQt BorderWidgetQt EventQtSlotConnect MinimalQtVTKApp RenderWindowNoUiFile RenderWindowUISingleInheritance ShareCameraQt SideBySideRenderWindowsQt vtkGenericOutlineFilter FireFlow FireFlowDemo vtkGeometryFilter Blow CannyEdgeDetector GenerateCubesFromLabels GenerateModelsFromLabels GeometryFilter SplitPolyData vtkGLTFExporter GLTFExporter ImportToExport vtkGLTFImporter CombineImportedActors GLTFImporter ImportToExport vtkGlyph2D Glyph2D VectorField vtkGlyph3D AnimateVectors Arbitrary3DCursor BrownianPoints CameraBlur CarotidFlowGlyphs ColorGlyphs ConvexHullShrinkWrap CurvatureBandsWithGlyphs DelaunayMesh DistanceToCamera ElevationBandsWithGlyphs ExtractClusters ExtractSurfaceDemo FitImplicitFunction Glyph3D Gradient GradientFilter Mace MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MaskPointsFilter MoveAGlyph MoveAVertexUnstructuredGrid NormalEstimation OrientedGlyphs ParametricObjectsDemo PointDataSubdivision PolyDataPointSampler QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo RadiusOutlierRemoval RandomProbe ReadPDB ResamplePolyLine ScaleGlyphs SpikeFran VisualizeDirectedGraph vtkGlyph3DMapper AppendFilter CellCentersDemo ConvexPointSet DensifyPoints DotProduct ExtractEnclosedPoints ExtractPointsDemo Glyph3DImage Glyph3DMapper ImageSobel2D IsoparametricCellsDemo IterativeClosestPointsTransform KochanekSpline KochanekSplineDemo LabeledDataMapper LabelPlacementMapper LandmarkTransform LinearCellDemo ParametricSpline PCADemo PointsProjectedHull QuantizePolyDataPoints ReadLegacyUnstructuredGrid VisualizeStructuredGrid vtkGlyphSource2D VisualizeDirectedGraph vtkGradientFilter GradientFilter vtkGraph ConnectedComponents GraphAlgorithmFilter GraphAlgorithmSource vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkGraphAlgorithm vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkGraphicsFactory OffScreenRendering vtkGraphLayout VisualizeDirectedGraph vtkGraphLayoutStrategy XGMLReader vtkGraphLayoutView AdjacentVertexIterator BoostBreadthFirstSearchTree ColorEdges ColorVertexLabels ColorVerticesLookupTable ConstructGraph ConstructTree CreateTree DepthFirstSearchAnimation EdgeWeights GraphPoints LabelVerticesAndEdges MutableGraphHelper RandomGraphSource ScaleVertices SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver ShortestPath SideBySideGraphs VertexSize VisualizeDirectedGraph VisualizeGraph XGMLReader vtkGraphToGlyphs ScaleVertices VertexSize vtkGraphToPolyData GraphToPolyData ShortestPath SideBySideGraphs VisualizeDirectedGraph vtkGreedyTerrainDecimation GreedyTerrainDecimation vtkHardwareSelector ExtractVisibleCells vtkHausdorffDistancePointSetFilter AlignTwoPolyDatas vtkHDFReader TransientHDFReader vtkHDRReader HDRReader PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkHedgeHog ComplexV HedgeHog SGrid vtkHexagonalPrism Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkHexahedron Cell3DDemonstration DataSetSurface Hexahedron LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkHoverWidget HoverWidget vtkHull ConvexHull Planes vtkHyperStreamline HyperStreamline vtkHyperTreeGridSource HyperTreeGridSource vtkHyperTreeGridToUnstructuredGrid HyperTreeGridSource vtkIdFilter CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo GenericClip HighlightSelectedPoints HighlightSelection ImplicitDataSetClipping LabeledMesh PointCellIds vtkIdList ArrayLookup BuildLocatorFromKClosestPoints Cell3DDemonstration CellEdgeNeighbors CellEdges CellPointNeighbors ClosestNPoints CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo ExtractPolyLinesFromPolyData FindCellIntersections FitSplineToCutterOutput IntersectLine IterateOverLines KDTreeFindPointsWithinRadius KDTreeFindPointsWithinRadiusDemo LabelContours MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD ModifiedBSPTreeExtractCells OBBTreeExtractCells OctreeFindPointsWithinRadius OctreeFindPointsWithinRadiusDemo OctreeKClosestPoints PointLocatorFindPointsWithinRadiusDemo PointLocatorRadius Polyhedron StaticLocatorFindPointsWithinRadiusDemo StructuredGrid VertexConnectivity vtkIdTypeArray CellEdgeNeighbors CellPicking CellPointNeighbors ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId FillHoles GenericClip HighlightSelectedPoints ImplicitDataSetClipping MergeSelections MoveAGlyph PointCellIds RemoveOutsideSurface SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver VertexConnectivity vtkImageAccumulate GenerateModelsFromLabels HistogramBarChart ImageAccumulate ImageAccumulateGreyscale ImageTracerWidgetInsideContour vtkImageActor Attenuation BackgroundImage CannyEdgeDetector CaptionActor2D Cast CenterAnImage CheckerboardWidget CombiningRGBChannels DEMReader DotProduct EnhanceEdges ExtractComponents ExtractVOI Flip GaussianSmooth Gradient HybridMedianComparison IdealHighPass ImageAnisotropicDiffusion2D ImageCityBlockDistance ImageClip ImageConvolve ImageCorrelation ImageDifference ImageDilateErode3D ImageDivergence ImageEllipsoidSource ImageFFT ImageGaussianSmooth ImageGradientMagnitude ImageGridSource ImageHybridMedian2D ImageImport ImageIslandRemoval2D ImageIteratorDemo ImageLaplacian ImageLuminance ImageMagnify ImageMagnitude ImageMandelbrotSource ImageMapToColors ImageMask ImageMathematics ImageMedian3D ImageMirrorPad ImageNoiseSource ImageNonMaximumSuppression ImageNormalize ImageOpenClose3D ImageOrder ImageOrientation ImagePermute ImageRange3D ImageReader2Factory ImageRegion ImageRFFT ImageSeparableConvolution ImageShrink3D ImageSobel2D ImageStencil ImageText ImageThreshold ImageTracerWidget ImageTracerWidgetInsideContour ImageTransparency ImageVariance3D ImageWeightedSum InteractWithImage MarkKeypoints MedianComparison MedicalDemo3 MetaImageReader MetaImageWriter MorphologyComparison Pad PickPixel PickPixel2 RectilinearWipeWidget RenderScalarToFloatBuffer ResizeImage ResizeImageDemo RGBToHSI RGBToHSV RGBToYIQ RTAnalyticSource SeedWidgetImage SelectWindowRegion SignedDistance TransformOrderDemo Transparency UnsignedDistance VTKSpectrum WriteBMP WritePNM WriteTIFF vtkImageAlgorithm vtkImageAlgorithmFilter vtkImageAnisotropicDiffusion2D ImageAnisotropicDiffusion2D vtkImageAppendComponents CombiningRGBChannels WordCloud vtkImageBlend Colored2DImageFusion CombineImages DrawOnAnImage ImageText StringToImageDemo ThinPlateSplineTransform WordCloud vtkImageButterworthHighPass IdealHighPass vtkImageCanvasSource2D BackgroundImage CaptionActor2D CombiningRGBChannels DrawOnAnImage DrawShapes FFMPEG Gradient ImageContinuousDilate3D ImageContinuousErode3D ImageCorrelation ImageDataGeometryFilter ImageDifference ImageIslandRemoval2D ImageLuminance ImageMagnitude ImageMask ImageMathematics ImageMedian3D ImageMirrorPad ImageSobel2D ImageText ImageToStructuredPoints ImageTracerWidget ImageTracerWidgetInsideContour JPEGWriter LogoWidget MarkKeypoints MPEG2 OggTheora PNGWriter ResizeImage ResizeImageDemo SeedWidgetImage StringToImageDemo TextureMapImageData WordCloud WriteBMP WritePNM WriteTIFF XMLPImageDataWriter vtkImageCast Attenuation CannyEdgeDetector Cast DotProduct EnhanceEdges ExtractVOI FillWindow Flip GaussianSmooth HybridMedianComparison ImageCityBlockDistance ImageConvolve ImageCorrelation ImageDivergence ImageEllipsoidSource ImageFFT ImageGradient ImageGradientMagnitude ImageGridSource ImageIdealHighPass ImageIslandRemoval2D ImageLaplacian ImageMandelbrotSource ImageNoiseSource ImageNonMaximumSuppression ImageNormalize ImageRange3D ImageRFFT ImageSeparableConvolution ImageVariance3D ImageWeightedSum MedianComparison MetaImageWriter PickPixel2 PNGWriter TransformOrderDemo vtkImageChangeInformation CenterAnImage ImageMagnify vtkImageCheckerboard CheckerboardWidget ImageCheckerboard vtkImageCityBlockDistance ImageCityBlockDistance vtkImageClip ImageClip MinIntensityRendering vtkImageConstantPad CannyEdgeDetector FrogSlice ImageGradient Pad vtkImageContinuousDilate3D ImageContinuousDilate3D vtkImageContinuousErode3D ImageContinuousErode3D vtkImageConvolve ImageConvolve vtkImageCorrelation ImageCorrelation vtkImageData BackgroundImage BorderPixelSize BoxClipStructuredPoints Cast CellCenters CellIdFromGridCoordinates CenterAnImage ClipVolume CombineImages CurvedReformation DEMReader DiscreteMarchingCubes DotProduct DrawOnAnImage DumpXMLFile EllipticalButton EnhanceEdges ExtractVOI FastSplatter FillWindow Finance FinanceFieldData FitToHeightMap FixedPointVolumeRayCastMapperCT GaussianSmooth GenerateCubesFromLabels GenerateModelsFromLabels GetCellCenter Gradient GreedyTerrainDecimation HDRReader Histogram2D HistogramBarChart HybridMedianComparison HyperStreamline ImageAccumulate ImageAccumulateGreyscale ImageAlgorithmFilter ImageClip ImageContinuousDilate3D ImageContinuousErode3D ImageCorrelation ImageDataGeometryFilter ImageDataToPointSet ImageDataToQImage ImageDifference ImageExport ImageHistogram ImageIdealHighPass ImageImport ImageIslandRemoval2D ImageIterator ImageIteratorDemo ImageMapper ImageMapToColors ImageOrder ImageReslice ImageRotate ImageShiftScale ImageSlice ImageSliceMapper ImageSobel2D ImageStack ImageStencil ImageText ImageTracerWidgetInsideContour ImageTranslateExtent ImageTransparency ImageValueRange ImplicitDataSet InterpolateTerrain Interpolation IntersectLine IsoContours IterateImageData MarchingCubes MaskPointsFilter MedianComparison MorphologyComparison NegativeIndices ObserveError OpenVRVolume PickPixel PickPixel2 PolyDataContourToImageData PolyDataToImageData ProjectedTexture RenderScalarToFloatBuffer RescaleAnImage ResizeImage ResizeImageDemo ShepardInterpolation SignedDistance SmoothDiscreteMarchingCubes StippledLine StringToImageDemo StructuredDataTypes TableBasedClipDataSetWithPolyData2 TexturedButtonWidget TextureMapPlane TextureMapQuad Transparency UnsignedDistance VectorField VectorFieldNonZeroExtraction VisualizeImageData vtkImageAlgorithmFilter VTKSpectrum Wireframe WordCloud WriteVTI vtkImageDataGeometryFilter ClipArt CreateBFont FitToHeightMap HyperStreamline ImageDataGeometryFilter ImageWarp StructuredPointsReader TensorAxes TensorEllipsoids WriteVTI vtkImageDataToPointSet ImageDataToPointSet VoxelsOnBoundary vtkImageDifference ImageDifference vtkImageDilateErode3D ImageDilateErode3D MorphologyComparison vtkImageDivergence ImageDivergence vtkImageDotProduct DotProduct vtkImageEllipsoidSource ImageEllipsoidSource ImageFFT ImageGaussianSmooth ImageGradientMagnitude ImageIdealHighPass ImageIslandRemoval2D ImageOrientation ImagePermute ImageRFFT ImageShrink3D ImageVariance3D vtkImageEuclideanToPolar ImageGradient vtkImageExport ImageExport vtkImageExtractComponents ClipArt ExtractComponents Gradient HistogramBarChart IdealHighPass ImageGradient ImageIdealHighPass ImageRFFT ImageSobel2D RGBToHSI RGBToHSV RGBToYIQ WordCloud vtkImageFFT IdealHighPass ImageFFT ImageIdealHighPass ImageRFFT VTKSpectrum vtkImageFlip CubeMap Flip PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkImageFourierCenter VTKSpectrum vtkImageGaussianSmooth Attenuation CannyEdgeDetector ClipArt CreateBFont FrogBrain FroggieSurface GaussianSmooth ImageGaussianSmooth ImageGradient IsoSubsample MedianComparison vtkImageGradient CannyEdgeDetector Gradient ImageDivergence ImageGradient ImageNonMaximumSuppression vtkImageGradientMagnitude ImageGradientMagnitude ImageNonMaximumSuppression vtkImageGridSource ImageGridSource ThinPlateSplineTransform vtkImageHistogram ImageHistogram vtkImageHSVToRGB ImageGradient vtkImageHybridMedian2D HybridMedianComparison ImageHybridMedian2D vtkImageIdealHighPass IdealHighPass ImageIdealHighPass vtkImageImport ImageImport vtkImageIslandRemoval2D FroggieSurface ImageIslandRemoval2D vtkImageIterator ImageIterator ImageIteratorDemo StringToImageDemo WordCloud vtkImageLaplacian EnhanceEdges ImageLaplacian vtkImageLogarithmicScale VTKSpectrum vtkImageLuminance CannyEdgeDetector ImageLuminance ImageWarp vtkImageMagnify ImageGradient ImageMagnify vtkImageMagnitude CannyEdgeDetector ImageAccumulateGreyscale ImageMagnitude VectorFieldNonZeroExtraction VTKSpectrum vtkImageMandelbrotSource Cast ExtractVOI FillWindow Flip ImageConvolve ImageDivergence ImageIdealHighPass ImageLaplacian ImageMandelbrotSource ImageThreshold ImageWeightedSum MetaImageWriter TransformOrderDemo vtkImageMapper ImageMapper ImageSlice ImageSliceMapper ThinPlateSplineTransform vtkImageMapper3D Attenuation CaptionActor2D Cast CenterAnImage CheckerboardWidget CombiningRGBChannels DEMReader DotProduct EnhanceEdges ExtractComponents ExtractVOI FillWindow Flip GaussianSmooth Gradient HybridMedianComparison IdealHighPass ImageAnisotropicDiffusion2D ImageCityBlockDistance ImageClip ImageConvolve ImageCorrelation ImageDifference ImageDilateErode3D ImageDivergence ImageEllipsoidSource ImageFFT ImageGaussianSmooth ImageGradientMagnitude ImageGridSource ImageHybridMedian2D ImageIslandRemoval2D ImageLaplacian ImageLuminance ImageMagnify ImageMagnitude ImageMandelbrotSource ImageMapToColors ImageMask ImageMathematics ImageMedian3D ImageMirrorPad ImageNoiseSource ImageNonMaximumSuppression ImageNormalize ImageOpenClose3D ImageOrientation ImagePermute ImageRange3D ImageReader2Factory ImageRegion ImageRFFT ImageSeparableConvolution ImageShrink3D ImageSobel2D ImageStencil ImageText ImageThreshold ImageTracerWidget ImageTracerWidgetInsideContour ImageTransparency ImageVariance3D ImageWeightedSum InteractWithImage MarkKeypoints MedianComparison MedicalDemo3 MetaImageReader MetaImageWriter MorphologyComparison Pad RectilinearWipeWidget ResizeImage ResizeImageDemo RGBToHSI RGBToHSV RGBToYIQ RTAnalyticSource SelectWindowRegion SignedDistance TransformOrderDemo Transparency UnsignedDistance VTKSpectrum WriteBMP WritePNM WriteTIFF vtkImageMapToColors ClipVolume Colored2DImageFusion DEMReader ImageMapToColors MedicalDemo3 RenderScalarToFloatBuffer SignedDistance TableBasedClipDataSetWithPolyData2 ThinPlateSplineTransform Transparency UnsignedDistance VTKSpectrum vtkImageMapToWindowLevelColors EnhanceEdges IdealHighPass Pad vtkImageMarchingCubes IsoSubsample vtkImageMask ImageMask vtkImageMathematics Attenuation DiscreteMarchingCubes DotProduct EnhanceEdges Gradient HybridMedianComparison ImageMathematics ImageSobel2D MedianComparison SmoothDiscreteMarchingCubes vtkImageMedian3D HybridMedianComparison ImageMedian3D MedianComparison vtkImageMirrorPad ImageMirrorPad Pad vtkImageNoiseSource HybridMedianComparison ImageNoiseSource MedianComparison PickPixel2 vtkImageNonMaximumSuppression CannyEdgeDetector ImageNonMaximumSuppression vtkImageNormalize ImageNormalize vtkImageOpenClose3D ImageOpenClose3D vtkImagePermute ImageOrientation ImagePermute vtkImagePlaneWidget ImagePlaneWidget vtkImageProperty Attenuation BorderPixelSize EnhanceEdges HybridMedianComparison IdealHighPass ImageHistogram ImageMapToColors ImageShiftScale ImageStack Interpolation MedianComparison MorphologyComparison Pad VTKSpectrum vtkImageQuantizeRGBToIndex ImageToPolyDataFilter vtkImageRange3D ImageRange3D vtkImageReader TexturedSphere vtkImageReader2 Attenuation BackgroundImage CenterAnImage Colored2DImageFusion CombineImages CurvedReformation DrawOnAnImage EllipticalButton EnhanceEdges ExtractComponents GaussianSmooth Glyph3DImage Gradient HistogramBarChart HybridMedianComparison IdealHighPass ImageAccumulateGreyscale ImageAnisotropicDiffusion2D ImageCheckerboard ImageCityBlockDistance ImageHistogram ImageRange3D ImageReader2Factory ImageRotate InteractWithImage IsoSubsample MedianComparison MorphologyComparison Pad PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel ProjectedTexture RectilinearWipeWidget ResizeImage ResizeImageDemo RGBToHSI RGBToHSV RGBToYIQ StaticImage TexturedSphere TexturePlane Transparency VTKSpectrum WordCloud vtkImageReader2Factory Attenuation BackgroundImage CenterAnImage Colored2DImageFusion CombineImages CurvedReformation DrawOnAnImage EllipticalButton EnhanceEdges ExtractComponents GaussianSmooth Glyph3DImage Gradient HistogramBarChart HybridMedianComparison IdealHighPass ImageAccumulateGreyscale ImageAnisotropicDiffusion2D ImageCheckerboard ImageCityBlockDistance ImageHistogram ImageRange3D ImageReader2Factory ImageRotate InteractWithImage IsoSubsample MedianComparison MorphologyComparison Pad PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel ProjectedTexture RectilinearWipeWidget ResizeImage ResizeImageDemo RGBToHSI RGBToHSV RGBToYIQ StaticImage TexturedSphere TexturePlane Transparency VTKSpectrum WordCloud vtkImageRectilinearWipe RectilinearWipeWidget vtkImageResample FixedPointVolumeRayCastMapperCT vtkImageResize ResizeImage ResizeImageDemo WordCloud vtkImageReslice ImageReslice ImageRotate ThinPlateSplineTransform vtkImageResliceMapper ImageSlice Interpolation vtkImageRFFT IdealHighPass ImageIdealHighPass ImageRFFT vtkImageRGBToHSI RGBToHSI vtkImageRGBToHSV ClipArt Gradient RGBToHSV vtkImageRGBToYIQ RGBToYIQ vtkImageSeedConnectivity ClipArt MorphologyComparison vtkImageSeparableConvolution ImageSeparableConvolution vtkImageShiftScale Attenuation FastSplatter Gradient ImageCorrelation ImageIdealHighPass ImageShiftScale ImageSobel2D RescaleAnImage ZBuffer vtkImageShrink3D ClipArt FroggieSurface ImageShrink3D IsoSubsample VoxelsOnBoundary vtkImageSincInterpolator ResizeImage ResizeImageDemo vtkImageSinusoidSource ImageNonMaximumSuppression ImageNormalize ImageSinusoidSource ImageWeightedSum vtkImageSlice BorderPixelSize FillWindow ImageHistogram ImageIdealHighPass ImageShiftScale ImageSlice ImageSliceMapper ImageStack ImageTranslateExtent Interpolation VectorField vtkImageSliceMapper BorderPixelSize FillWindow ImageHistogram ImageIdealHighPass ImageShiftScale ImageSliceMapper ImageStack ImageTranslateExtent RenderScalarToFloatBuffer VectorField vtkImageSobel2D ImageSobel2D vtkImageStack ImageStack vtkImageStencil ImageStencil PolyDataContourToImageData PolyDataToImageData vtkImageStencilToImage ImageTracerWidgetInsideContour vtkImageThreshold ClipArt DiscreteMarchingCubes FrogBrain FroggieSurface HybridMedianComparison ImageThreshold MaskPointsFilter MedianComparison SmoothDiscreteMarchingCubes vtkImageToImageStencil ImageStencil vtkImageToPolyDataFilter ImageToPolyDataFilter vtkImageToStructuredPoints CannyEdgeDetector ImageToStructuredPoints vtkImageTracerWidget ImageTracerWidget ImageTracerWidgetInsideContour ImageTracerWidgetNonPlanar vtkImageTranslateExtent ImageTranslateExtent vtkImageVariance3D ImageVariance3D vtkImageViewer HDRReader ImageGradient vtkImageViewer2 CombineImages DrawOnAnImage DrawShapes FastSplatter ImageCheckerboard ImageIteratorDemo ImageRotate ImageSinusoidSource JPEGReader PickPixel PickPixel2 PNGReader ReadBMP ReadDICOM ReadDICOMSeries ReadPNM ReadTIFF StaticImage StringToImageDemo WordCloud WordCloudDemo vtkImageWeightedSum ImageWeightedSum vtkImageWrapPad GenerateCubesFromLabels vtkImageWriter ImageWriter PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkImplicitBoolean BooleanOperationImplicitFunctions ClipSphereCylinder ExtractData IceCream ImplicitBoolean ImplicitBooleanDemo vtkImplicitDataSet ImplicitDataSet vtkImplicitFunction ExtractPointsDemo vtkImplicitModeller BlobbyLogo CameraModel1 CameraModel2 Hello ImplicitModeller Morph3D vtkImplicitPlaneRepresentation ImplicitPlaneWidget2 vtkImplicitPlaneWidget2 ImplicitPlaneWidget2 vtkImplicitPolyDataDistance ClipDataSetWithPolyData ImplicitPolyDataDistance TableBasedClipDataSetWithPolyData vtkImplicitSelectionLoop ImplicitSelectionLoop vtkImplicitTextureCoords Motor TextureCutQuadric TextureCutSphere vtkIncrementalOctreePointLocator IncrementalOctreePointLocator vtkIndent vtkTest vtkTest1 vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestGraphAlgorithmSource vtkTestPolyDataFilter vtkTestReader vtkInEdgeIterator InEdgeIterator vtkInformation AttachAttributes CallData ClipArt ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells FillHoles ImageClip vtkImageAlgorithmFilter vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader vtkInformationDoubleVectorKey AttachAttributes vtkInformationVector CallData vtkImageAlgorithmFilter vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader vtkIntArray ArrayRange BarChart BarChartQt BoostBreadthFirstSearchTree BoxChart BreadthFirstDistance Casting CellTypeSource ColorEdges ColorVertexLabels ColorVerticesLookupTable CompareRandomGeneratorsCxx ConnectedComponents CopyAllArrays DepthFirstSearchAnimation ExportPolyDataScene FieldData HistogramBarChart ImageAccumulateGreyscale IntersectLine IterateImageData KMeansClustering KochSnowflake LabelPlacementMapper LabelVerticesAndEdges NullPoint ParallelCoordinatesView PieChart PKMeansClustering ScaleVertices SortDataArray StackedBar StackedPlot ThresholdCells ThresholdPoints vtkInteractorObserver FixedPointVolumeRayCastMapperCT LayeredActors TransparentBackground vtkInteractorStyle Follower ImageHistogram PickPixel PickPixel2 vtkInteractorStyleImage Attenuation BorderPixelSize CaptionActor2D Cast CenterAnImage CheckerboardWidget CombiningRGBChannels DEMReader EnhanceEdges ExtractComponents ExtractVOI FillWindow Flip GaussianSmooth Glyph2D HybridMedianComparison IdealHighPass ImageAnisotropicDiffusion2D ImageCityBlockDistance ImageClip ImageConvolve ImageCorrelation ImageDilateErode3D ImageDivergence ImageEllipsoidSource ImageFFT ImageGaussianSmooth ImageGradientMagnitude ImageGridSource ImageHistogram ImageHybridMedian2D ImageIdealHighPass ImageImport ImageIslandRemoval2D ImageIteratorDemo ImageLaplacian ImageLuminance ImageMagnify ImageMagnitude ImageMandelbrotSource ImageMapper ImageMapToColors ImageMask ImageMathematics ImageMedian3D ImageNoiseSource ImageNonMaximumSuppression ImageNormalize ImageOpenClose3D ImageOrder ImageOrientation ImagePermute ImageRange3D ImageReader2Factory ImageRegion ImageRFFT ImageSeparableConvolution ImageShiftScale ImageShrink3D ImageSlice ImageSliceMapper ImageSobel2D ImageStack ImageStencil ImageText ImageTracerWidget ImageTracerWidgetInsideContour ImageTranslateExtent ImageTransparency ImageVariance3D ImageWeightedSum InteractWithImage Interpolation MarkKeypoints MedianComparison MetaImageReader MorphologyComparison Pad PickPixel PickPixel2 ReadDICOMSeries RectilinearWipeWidget ResizeImage ResizeImageDemo RGBToHSI RGBToHSV RGBToYIQ RTAnalyticSource SeedWidgetImage Transparency VTKSpectrum WriteBMP WritePNM WriteTIFF vtkInteractorStyleRubberBand2D RubberBand2D RubberBand2DObserver SelectedVerticesAndEdges SelectWindowRegion vtkInteractorStyleRubberBand3D RubberBand3D vtkInteractorStyleRubberBandPick AreaPicking CreateESGrid HighlightSelectedPoints HighlightSelection LoadESGrid RubberBandPick vtkInteractorStyleRubberBandZoom RubberBandZoom vtkInteractorStyleSwitch AffineWidget ClipVolume HideActor HideAllActors ProteinRibbons StyleSwitch TableBasedClipDataSetWithPolyData2 vtkInteractorStyleTerrain InteractorStyleTerrain ThinPlateSplineTransform vtkInteractorStyleTrackball AreaPicking vtkInteractorStyleTrackballActor Game MovableAxes MoveActor MoveAGlyph MoveAVertexUnstructuredGrid PickableOff RotateActor SelectAnActor SelectAVertex ShiftAndControl TrackballActor vtkInteractorStyleTrackballCamera BoxWidget BoxWidget2 CellPicking ColorDisconnectedRegionsDemo ColorMapToLUT ConeDemo ContourWidget CubeMap CurvatureBandsWithGlyphs CurvaturesAdjustEdges DataStructureComparison DistanceToCamera DoubleClick ElevationBandsWithGlyphs EllipticalCylinder EllipticalCylinderDemo ExternalContour ExtractVisibleCells FireFlowDemo FroggieSurface FroggieView GLTFExporter GLTFImporter GradientBackground HighlightPickedActor HighlightWithSilhouette ImagePlaneWidget ImageTracerWidgetNonPlanar InterpolateMeshOnGrid KeypressEvents KMeansClustering LayeredActors MarbleShaderDemo MouseEvents MoveCamera MultipleActors MultipleRenderWindows ObserverMemberFunction PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Picking PKMeansClustering PointLocator PointPicker RayCastIsosurface ResampleAppendedPolyData RescaleReverseLUT ResetCameraOrientation SelectVisiblePoints SphereMap StreamLines TextOrigin TrackballCamera TransientHDFReader TubesWithVaryingRadiusAndColors Tutorial_Step5 Tutorial_Step6 VectorOfActors VisualizeModifiedBSPTree VisualizeOBBTree WorldPointPicker vtkInteractorStyleUser InteractorStyleUser IsoContours vtkInterpolateDataSetAttributes InterpolateFieldDataDemo Morph3D vtkIntersectionPolyDataFilter IntersectionPolyDataFilter vtkIterativeClosestPointTransform AlignTwoPolyDatas IterativeClosestPointsTransform vtkJPEGReader CheckerboardWidget ClipArt CubeMap ImageClip ImageRegion JPEGReader SelectWindowRegion SphereMap TextureMapPlane TextureMapQuad vtkJPEGWriter ImageWriter JPEGWriter PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkKdTree BuildLocatorFromKClosestPoints KdTree KDTreeAccessPoints VisualizeKDTree vtkKdTreePointLocator ClosestNPoints DataStructureComparison KDTreeFindPointsWithinRadius KDTreeFindPointsWithinRadiusDemo KdTreePointLocatorClosestPoint KDTreeTimingDemo vtkKMeansStatistics KMeansClustering vtkKochanekSpline 1DTupleInterpolation FitSplineToCutterOutput KochanekSpline KochanekSplineDemo vtkLabeledDataMapper IsoparametricCellsDemo LabelContours LabeledDataMapper LabeledMesh LinearCellDemo ReadLegacyUnstructuredGrid vtkLabelPlacementMapper LabelPlacementMapper vtkLandmarkTransform AlignFrames AlignTwoPolyDatas IterativeClosestPointsTransform LandmarkTransform ProcrustesAlignmentFilter vtkLegendBoxActor HistogramBarChart ImageAccumulateGreyscale Legend PieChartActor PlaneSourceDemo SpiderPlot SubdivisionDemo vtkLegendScaleActor LegendScaleActor vtkLight AmbientSpheres DiffuseSpheres GLTFImporter Light LightActor PBR_Clear_Coat PBR_Mapping Shadows ShadowsLightsDemo SpecularSpheres SphereMap SpotLights vtkLightActor Light LightActor ShadowsLightsDemo vtkLightCollection Light ShadowsLightsDemo vtkLightsPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkLine CappedSphere ColoredLines DeleteCells DistancePointToLine ExtractEdges IterateOverLines IterativeClosestPointsTransform LandmarkTransform LinearCellDemo LongLine PCADemo RuledSurfaceFilter WarpVector WriteLegacyLinearCells WriteXMLLinearCells vtkLinearExtrusionFilter AlphaFrequency ClipArt EllipticalCylinder EllipticalCylinderDemo LinearExtrusion PolyDataContourToImageData Stocks vtkLinearSubdivisionFilter CurvaturesAdjustEdges PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision Subdivision SubdivisionDemo vtkLinearTransform ExportPolyDataScene vtkLineRepresentation LineWidget2 vtkLineSource AnimateVectors BluntStreamlines ExtrudePolyDataAlongLine FindCellIntersections GeometricObjectsDemo Kitchen Line LineWidth ModifiedBSPTreeExtractCells OBBTreeExtractCells OrientedBoundingCylinder PCADemo SourceObjectsDemo StippledLine TubeFilter WarpTo XYPlot vtkLineWidget StreamlinesWithLineWidget vtkLineWidget2 LineWidget2 vtkLinkEdgels CannyEdgeDetector vtkLocator DataStructureComparison vtkLODActor CameraModel1 CameraModel2 ColorIsosurface CubeAxesActor2D ImplicitSelectionLoop ReadPDB SelectPolyData vtkLODProp3D LODProp3D vtkLogger AnimateActors vtkLogLookupTable HyperStreamline vtkLogoRepresentation LogoWidget vtkLogoWidget LogoWidget vtkLookupTable AdjacentVertexIterator AssignCellColorsFromLUT Blow BorderWidget BorderWidgetQt BoxChart BoxClipStructuredPoints BoxClipUnstructuredGrid CarotidFlow CarotidFlowGlyphs CellTypeSource ClipVolume ColorCells ColorDisconnectedRegionsDemo Colored2DImageFusion ColoredAnnotatedCube ColoredElevationMap ColorEdges ColorLookupTable ColorVerticesLookupTable ComplexV ConnectivityFilterDemo CreateColorSeriesDemo CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo DEMReader DepthFirstSearchAnimation DiscreteMarchingCubes DisplacementPlot Dodecahedron ElevationBandsWithGlyphs ElevationFilter EventQtSlotConnect ExportPolyDataScene ExtractClusters FilledContours FitToHeightMap FrogBrain FroggieSurface FroggieView FrogSlice FunctionalBagPlot Hawaii ImageMapToColors ImageToPolyDataFilter KDTreeFindPointsWithinRadiusDemo KochSnowflake LabelContours LOx LOxGrid LOxSeeds LUTUtilities MedicalDemo3 MeshQuality NamedColors OBBDicer OctreeFindPointsWithinRadiusDemo PlatonicSolids PointLocatorFindPointsWithinRadiusDemo PseudoVolumeRendering Rainbow ReadLegacyUnstructuredGrid RenderScalarToFloatBuffer RenderWindowNoUiFile RenderWindowUISingleInheritance ScalarBarActor ScalarBarActorColorSeries ScalarBarWidget ScaleVertices SignedDistance SimpleElevationFilter SmoothDiscreteMarchingCubes StaticLocatorFindPointsWithinRadiusDemo StructuredGrid TableBasedClipDataSetWithPolyData2 TensorAxes TensorEllipsoids ThinPlateSplineTransform TissueLens TransformSphere TransientHDFReader Transparency UnsignedDistance VRMLImporterDemo vtkLoopBooleanPolyDataFilter LoopBooleanPolyDataFilter vtkLoopSubdivisionFilter Subdivision SubdivisionDemo vtkMapper CameraActor ClipVolume MinimalQtVTKApp OpenVRFrustum TableBasedClipDataSetWithPolyData2 vtkMarchingContourFilter FinanceFieldData vtkMarchingCubes ExtractLargestIsosurface FrogBrain FroggieSurface HeadBone IsosurfaceSampling MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 TissueLens vtkMarchingSquares ContourTriangulator MarchingSquares vtkMaskFields GenerateModelsFromLabels vtkMaskPoints CarotidFlowGlyphs CurvatureBandsWithGlyphs ElevationBandsWithGlyphs ExtractSurfaceDemo Gradient MaskPoints ParametricObjectsDemo PointDataSubdivision SpikeFran SplatFace vtkMaskPointsFilter MaskPointsFilter vtkMaskPolyData StripFran vtkMassProperties MassProperties vtkMath AlignFrames BrownianPoints CellLocatorVisualization ChooseTextColor ChooseTextColorDemo CompassWidget ContoursFromPolyData ContoursToSurface ContourWidget DecimatePolyline DistanceBetweenPoints EigenSymmetric EllipticalCylinder EllipticalCylinderDemo ExtrudePolyDataAlongLine FunctionalBagPlot GLTFExporter GreedyTerrainDecimation HanoiInitial HanoiIntermediate HedgeHog Histogram2D HomogeneousLeastSquares ImageClip ImageCorrelation IncrementalOctreePointLocator InterpolateCamera IntersectLine KochanekSplineDemo KochSnowflake LeastSquares LUFactorization ModifiedBSPTreeTimingDemo NormalizeVector OBBTreeTimingDemo OctreeVisualize OpenVROrientedArrow OpenVROrientedCylinder OrientedArrow OrientedBoundingCylinder OrientedCylinder ParametricKuenDemo ParametricObjectsDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PCADemo PerpendicularVector PickPixel2 PlaneSourceDemo PointLocatorVisualization PoissonExtractSurface PolyLine1 PowercrustExtractSurface ReverseAccess RibbonFilter SGrid SphereWidget2 TubesWithVaryingRadiusAndColors Visualize2DPoints VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkMatrix3x3 MatrixInverse MatrixTranspose vtkMatrix4x4 AlignFrames CollisionDetection EllipticalCylinderDemo ExtrudePolyDataAlongLine FroggieSurface FroggieView GLTFExporter IterativeClosestPointsTransform LandmarkTransform OpenVROrientedArrow OpenVROrientedCylinder OrientedArrow OrientedCylinder PerspectiveTransform PlaneSourceDemo RotateActor vtkMatrixMathFilter MatrixMathFilter vtkMCubesReader PineRootConnectivity PineRootDecimation vtkMergeFilter ImageWarp vtkMergePoints HeadBone MergePoints vtkMeshQuality HighlightBadCells MeshQuality vtkMetaImageReader BoxClipStructuredPoints EdgePoints FixedPointVolumeRayCastMapperCT FlyingHeadSlice FrogBrain FroggieSurface FrogSlice GenerateCubesFromLabels GenerateModelsFromLabels HeadBone HeadSlice ImageGradient MaskPointsFilter MedicalDemo1 MedicalDemo2 MedicalDemo3 MedicalDemo4 MetaImageReader MetaImageWriter RayCastIsosurface TissueLens VoxelsOnBoundary vtkMetaImageWriter MetaImageWriter PolyDataContourToImageData PolyDataToImageData vtkMinimalStandardRandomSequence BillboardTextActor3D BorderPixelSize CellTypeSource ChooseTextColorDemo ColorCells ColorCellsWithRGB ColorDisconnectedRegionsDemo ColoredElevationMap ConstrainedDelaunay2D DelaunayMesh DensifyPoints DiscreteMarchingCubes EllipticalCylinderDemo ExtractClusters ExtractSurface ExtractSurfaceDemo GLTFExporter GreedyTerrainDecimation Hanoi HanoiInitial HanoiIntermediate HighlightPickedActor HighlightWithSilhouette InterpolateCamera InterpolateMeshOnGrid InterpolateTerrain KDTreeTimingDemo LabelContours Lorenz MergePoints MiscPointData ModifiedBSPTreeTimingDemo OBBTreeTimingDemo OctreeTimingDemo OpenVROrientedArrow OpenVROrientedCylinder OrientedArrow OrientedCylinder ParametricObjectsDemo PlaneSourceDemo PointOccupancy QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo RadiusOutlierRemoval RandomSequence RemoveOutsideSurface ResampleAppendedPolyData ResamplePolyLine RescaleAnImage SignedDistance SmoothDiscreteMarchingCubes SmoothPolyDataFilter SpiderPlot StringToImageDemo TriangulateTerrainMap UniformRandomNumber UnsignedDistance WarpScalar vtkModifiedBSPTree DataStructureComparison ModifiedBSPTreeExtractCells ModifiedBSPTreeIntersectWithLine ModifiedBSPTreeTimingDemo VisualizeModifiedBSPTree vtkMoleculeMapper ReadCML vtkMultiBlockDataGroupFilter ProcrustesAlignmentFilter vtkMultiBlockDataSet BluntStreamlines CellsInsideObject ColorIsosurface CombustorIsosurface CompositePolyDataMapper CutStructuredGrid ExportPolyDataScene Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse ImportPolyDataScene InterpolateFieldDataDemo KMeansClustering LOx LOxGrid LOxSeeds MultiBlockDataSet MultiBlockMergeFilter PKMeansClustering ProbeCombustor ProcrustesAlignmentFilter PseudoVolumeRendering Rainbow ReadPLOT3D StreamLines StreamlinesWithLineWidget TextureThreshold VelocityProfile VoxelsOnBoundary WarpCombustor XYPlot vtkMultiBlockMergeFilter MultiBlockMergeFilter vtkMultiBlockPLOT3DReader BluntStreamlines ColorIsosurface CombustorIsosurface CutStructuredGrid LOx LOxGrid LOxSeeds ProbeCombustor PseudoVolumeRendering Rainbow ReadPLOT3D StreamLines StreamlinesWithLineWidget TextureThreshold VelocityProfile WarpCombustor XYPlot vtkMultiThreshold CellsInsideObject VoxelsOnBoundary vtkMutableDirectedGraph AdjacentVertexIterator ColorEdges ColorVertexLabels ColorVerticesLookupTable ConstructTree CreateTree DepthFirstSearchAnimation DirectedGraphToMutableDirectedGraph GraphAlgorithmFilter InEdgeIterator MutableDirectedGraphToDirectedGraph MutableGraphHelper OutEdgeIterator ShortestPath TreeBFSIterator TreeToMutableDirectedGraph VisualizeDirectedGraph vtkTestGraphAlgorithmFilter vtkMutableGraphHelper MutableGraphHelper vtkTestGraphAlgorithmFilter vtkMutableUndirectedGraph AdjacentVertexIterator BoostBreadthFirstSearchTree BreadthFirstDistance ConnectedComponents ConstructGraph DepthFirstSearchIterator EdgeListIterator EdgeWeights GraphAlgorithmFilter GraphAlgorithmSource GraphPoints GraphToPolyData InEdgeIterator LabelVerticesAndEdges MinimumSpanningTree MutableGraphHelper OutEdgeIterator RemoveIsolatedVertices ScaleVertices SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver SideBySideGraphs VertexSize VisualizeGraph vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkOBBDicer OBBDicer SplitPolyData vtkOBBTree AlignTwoPolyDatas DataStructureComparison OBBTreeExtractCells OBBTreeIntersectWithLine OBBTreeTimingDemo OrientedBoundingCylinder VisualizeOBBTree vtkObject AffineWidget AnimateActors Animation AnimationScene Arbitrary3DCursor AreaPicking BiDimensionalWidget BillboardTextActor3D BoxWidget BoxWidget2 BozoShader BozoShaderDemo CallBack CallData CameraModifiedEvent CellLocatorVisualization CenterAnImage ClientData CloseWindow CommandSubclass CompassWidget DataAnimation DataAnimationSubclass Delaunay3DDemo DepthFirstSearchAnimation EllipticalButton EventQtSlotConnect FilterProgress FilterSelfProgress FireFlowDemo FrameRate FroggieView Hanoi HDRReader HoverWidget ImageClip ImageRegion ImageTracerWidget ImageTracerWidgetInsideContour ImplicitPlaneWidget2 IndividualVRML InteractorStyleUser IsoContours KeypressObserver KochanekSplineDemo LayeredActors LineWidget2 LODProp3D MarbleShader MarbleShaderDemo MouseEventsObserver MovableAxes ObserveError ObserverMemberFunction OctreeVisualize ParametricKuenDemo ParametricObjectsDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel PickPixel2 PointLocatorVisualization PolygonalSurfacePointPlacer ProgressReport QuadraticHexahedronDemo QuadraticTetraDemo RotatingSphere RubberBand2DObserver SeedWidgetImage SeedWidgetWithCustomCallback SelectedVerticesAndEdgesObserver SelectWindowRegion Slider Slider2D SpatterShader SphereWidget SphereWidget2 SphereWidgetEvents StreamlinesWithLineWidget Timer TransientHDFReader TransparentBackground Tutorial_Step2 Tutorial_Step6 UserEvent VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter WindowModifiedEvent vtkObjectBase TransientHDFReader vtkObjectFactory CaptionActor2D Diagram ExtractVisibleCells MultipleRenderWindows ReadDICOMSeries RectilinearWipeWidget vtkImageAlgorithmFilter vtkTest vtkTest1 vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader Warnings vtkOBJExporter ImportToExport vtkOBJImporter CombineImportedActors ImportToExport OBJImporter vtkOBJReader AlignTwoPolyDatas BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CapClip CellCentersDemo CellsInsideObject ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CompareExtractSurface ConnectivityFilterDemo Delaunay3DDemo DensifyPoints ExportPolyDataScene ExtractEnclosedPoints ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FillHoles FlatVersusGouraud GradientBackground HiddenLineRemoval HighlightSelection ImplicitModeller InterpolateCamera KDTreeFindPointsWithinRadiusDemo LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientedBoundingCylinder PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface ProjectedTexture RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadOBJ Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation SignedDistance SpatterShader SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Subdivision SubdivisionDemo UnsignedDistance VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkOctreePointLocator BuildOctree DataStructureComparison OctreeClosestPoint OctreeFindPointsWithinRadius OctreeFindPointsWithinRadiusDemo OctreeKClosestPoints OctreeTimingDemo OctreeVisualize vtkOggTheoraWriter OggTheora vtkOpaquePass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ShadowsLightsDemo vtkOpenGLGPUVolumeRayCastMapper RayCastIsosurface vtkOpenGLPolyDataMapper BozoShader BozoShaderDemo ColorByNormal CubeMap MarbleShader MarbleShaderDemo SpatterShader SphereMap vtkOpenGLRenderer MotionBlur OutlineGlowPass PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Shadows ShadowsLightsDemo vtkOpenGLRenderWindow PBR_Skybox vtkOpenGLTexture PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat vtkOpenVRRenderer OpenVRCone OpenVRCube OpenVRCylinder OpenVRFrustum OpenVROrientedArrow OpenVROrientedCylinder OpenVRSphere OpenVRTessellatedBoxSource OpenVRVolume vtkOpenVRRenderWindow OpenVRCone OpenVRCube OpenVRCylinder OpenVRFrustum OpenVROrientedArrow OpenVROrientedCylinder OpenVRSphere OpenVRTessellatedBoxSource OpenVRVolume vtkOpenVRRenderWindowInteractor OpenVRCone OpenVRCube OpenVRCylinder OpenVRFrustum OpenVROrientedArrow OpenVROrientedCylinder OpenVRSphere OpenVRTessellatedBoxSource OpenVRVolume vtkOrientationMarkerWidget AlignTwoPolyDatas AnatomicalOrientation CallBack ColoredAnnotatedCube DisplayCoordinateAxes FroggieSurface FroggieView OrientationMarkerWidget OrientationMarkerWidget1 PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkOrientedGlyphContourRepresentation ContourWidget PolygonalSurfaceContourLineInterpolator PolygonalSurfacePointPlacer vtkOutEdgeIterator OutEdgeIterator vtkOutlineCornerFilter OBBDicer vtkOutlineFilter AnimateVectors CallBack CarotidFlow CarotidFlowGlyphs ComplexV ContourQuadric CubeAxesActor2D DisplayQuadricSurfaces EdgePoints ExtractData FlyingHeadSlice HeadBone HeadSlice HyperStreamline IronIsoSurface IsoContours MedicalDemo1 MedicalDemo2 MedicalDemo3 Outline OverlappingAMR PineRootConnectivity PineRootDecimation PlateVibration ProbeCombustor QuadricVisualization ReadSLC SampleFunction SingleSplat TensorAxes TensorEllipsoids vtkOutlineGlowPass OutlineGlowPass vtkOutputWindow FileOutputWindow vtkOverlappingAMR Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse OverlappingAMR vtkOverlayPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkParallelCoordinatesRepresentation ParallelCoordinatesView vtkParallelCoordinatesView ParallelCoordinatesView vtkParametricBohemianDome ParametricObjectsDemo vtkParametricBour CurvaturesAdjustEdges ParametricObjectsDemo vtkParametricBoy ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricCatalanMinimal ParametricObjectsDemo vtkParametricConicSpiral ParametricObjectsDemo vtkParametricCrossCap ParametricObjectsDemo vtkParametricDini ParametricObjectsDemo vtkParametricEllipsoid ParametricObjectsDemo PointDataSubdivision vtkParametricEnneper CurvaturesAdjustEdges LegendScaleActor ParametricObjectsDemo vtkParametricFigure8Klein ParametricObjectsDemo vtkParametricFunction ParametricObjectsDemo vtkParametricFunctionSource CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs ExtrudePolyDataAlongLine KochanekSpline KochanekSplineDemo LegendScaleActor ParametricKuenDemo ParametricObjectsDemo ParametricSpline ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision ProjectSphere SCurveSpline TubesFromSplines vtkParametricHenneberg ParametricObjectsDemo vtkParametricKlein ParametricObjectsDemo vtkParametricKuen ParametricKuenDemo ParametricObjectsDemo vtkParametricMobius CurvaturesAdjustEdges ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricPluckerConoid ParametricObjectsDemo vtkParametricPseudosphere ParametricObjectsDemo vtkParametricRandomHills CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricRoman ParametricObjectsDemo vtkParametricSpline ExtrudePolyDataAlongLine KochanekSpline KochanekSplineDemo ParametricObjectsDemo ParametricSpline SCurveSpline TubesFromSplines vtkParametricSuperEllipsoid ParametricObjectsDemo ParametricSuperEllipsoidDemo ProjectSphere vtkParametricSuperToroid ParametricObjectsDemo ParametricSuperToroidDemo vtkParametricTorus CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParticleReader ParticleReader vtkPassThrough PassThrough vtkPath FroggieView vtkPBRIrradianceTexture PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkPCANormalEstimation CompareExtractSurface ExtractSurface ExtractSurfaceDemo NormalEstimation PoissonExtractSurface SignedDistance vtkPCAStatistics PCADemo PCAStatistics vtkPDBReader ProteinRibbons ReadPDB vtkPen Diagram FunctionalBagPlot PlotLine3D SurfacePlot vtkPentagonalPrism Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPerlinNoise PerlinNoise vtkPerspectiveTransform PerspectiveTransform vtkPiecewiseFunction FixedPointVolumeRayCastMapperCT IntermixedUnstructuredGrid MedicalDemo4 MinIntensityRendering OpenVRVolume PiecewiseFunction RayCastIsosurface SimpleRayCast vtkPieChartActor PieChartActor vtkPixel LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPKMeansStatistics PKMeansClustering vtkPlane CapClip ClipClosedSurface ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ContoursFromPolyData CutStructuredGrid Cutter CutWithCutFunction CutWithScalars DataSetSurface ExtractPolyLinesFromPolyData FitSplineToCutterOutput GenericClip IceCream ImplicitPlaneWidget2 PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PolyDataContourToImageData ProjectPointPlane PseudoVolumeRendering SolidClip VoxelsOnBoundary vtkPlaneCollection ClipClosedSurface vtkPlanes CameraActor ClipFrustum ClipVolume Frustum HighlightSelectedPoints HighlightSelection Motor OpenVRFrustum Planes ProjectedTexture TableBasedClipDataSetWithPolyData2 TextureCutSphere vtkPlanesIntersection PlanesIntersection vtkPlaneSource AffineWidget AnatomicalOrientation AssignCellColorsFromLUT CellPicking ClipSphereCylinder ColorCells ColorCellsWithRGB CreateColorSeriesDemo CurvatureBandsWithGlyphs ElevationBandsWithGlyphs ExponentialCosine FitToHeightMap FrogSlice Hanoi HanoiInitial HanoiIntermediate LabelContours Light Picking Plane PlaneSourceDemo ProbeCombustor ResampleAppendedPolyData ShadowsLightsDemo SourceObjectsDemo SpotLights StreamLines TextureMapImageData TextureMapPlane TexturePlane vtkPlaneWidget PlaneWidget vtkPlatonicSolidSource BorderWidget BorderWidgetQt CubeAxesActor2D EventQtSlotConnect PlatonicSolids RenderWindowNoUiFile RenderWindowUISingleInheritance ResampleAppendedPolyData vtkPlot BarChart BarChartQt ChartMatrix ChartsOn3DScene KDTreeTimingDemo LinePlot ModifiedBSPTreeTimingDemo OBBTreeTimingDemo OctreeTimingDemo ParallelCoordinates ScatterPlot vtkPlotArea AreaPlot vtkPlotBar StackedBar vtkPlotBox BoxChart vtkPlotFunctionalBag FunctionalBagPlot vtkPlotLine3D PlotLine3D vtkPlotPie PieChart vtkPlotPoints ChartMatrix ChartsOn3DScene MultiplePlots ScatterPlot vtkPlotStacked StackedPlot vtkPlotSurface SurfacePlot vtkPLYReader AlignTwoPolyDatas BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CapClip CellCentersDemo CellsInsideObject ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CompareExtractSurface ConnectivityFilterDemo CubeMap Delaunay3DDemo DensifyPoints ExportPolyDataScene ExtractEnclosedPoints ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FillHoles GradientBackground HiddenLineRemoval HighlightSelection ImplicitModeller InterpolateCamera KDTreeFindPointsWithinRadiusDemo LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties MotionBlur NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientedBoundingCylinder PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface ProjectedTexture RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadPLY Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation SignedDistance SpatterShader SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Subdivision SubdivisionDemo UnsignedDistance VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree WritePLY vtkPLYWriter ConvertFile WritePLY vtkPNGReader CannyEdgeDetector ContourTriangulator DecimateFran ImageContinuousDilate3D ImageContinuousErode3D ImageDilateErode3D ImageHybridMedian2D ImageMagnify ImageOpenClose3D ImageSeparableConvolution ImageToPolyDataFilter MarchingSquares PBR_Clear_Coat PBR_Mapping PNGReader vtkPNGWriter EarthSource Hanoi HanoiInitial HanoiIntermediate ImageWriter OffScreenRendering ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PNGWriter PointDataSubdivision RenderLargeImage Screenshot WalkCow WalkCowA WalkCowB vtkPNMReader CreateBFont ReadPNM WritePNM vtkPNMWriter ImageWriter WritePNM vtkPointData ArrayCalculator BackgroundTexture BandedPolyDataContourFilter BluntStreamlines CarotidFlow CarotidFlowGlyphs Casting ClipDataSetWithPolyData ClipVolume ColorDisconnectedRegions ColorDisconnectedRegionsDemo ColoredElevationMap ColoredPoints ColorGlyphs CompareExtractSurface CopyAllArrays CreateBFont Cube CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo CutStructuredGrid CutWithCutFunction CutWithScalars DelimitedTextReader DetermineArrayDataTypes DistancePolyDataFilter DotProduct DumpXMLFile ElevationBandsWithGlyphs ElevationFilter EnhanceEdges ExponentialCosine ExtractArrayComponent ExtractSelectionOriginalId ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FieldData FilledContours Finance FindAllArrayNames Game GenerateCubesFromLabels GenerateModelsFromLabels GetMiscPointData Glyph3DMapper Gradient HedgeHog HighlightSelectedPoints HybridMedianComparison IdentifyHoles ImageCorrelation ImageSobel2D ImageStencil ImageText ImageValueRange ImplicitPolyDataDistance InterpolateFieldDataDemo InterpolateMeshOnGrid InterpolateTerrain IsosurfaceSampling IterateImageData KDTreeFindPointsWithinRadiusDemo Kitchen KMeansClustering LabelContours LabelPlacementMapper Lorenz MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MatrixMathFilter MedianComparison MinimalQtVTKApp MiscPointData MorphologyComparison MoveAGlyph NullPoint OctreeFindPointsWithinRadiusDemo Office OfficeA OfficeTube OverlappingAMR ParallelCoordinatesView PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel PickPixel2 PineRootConnectivityA PKMeansClustering PointCellIds PointDataSubdivision PointInsideObject PointInterpolator PointLocatorFindPointsWithinRadiusDemo PoissonExtractSurface PolyDataCellNormals PolyDataContourToImageData PolyDataExtractNormals PolyDataIsoLines PolyDataPointNormals PolyDataToImageData ProjectedTexture ProjectSphere RandomProbe RenderScalarToFloatBuffer ResampleAppendedPolyData ReverseSense ScalarBarActor ScalarBarActorColorSeries ScaleGlyphs SGrid ShadowsLightsDemo ShepardMethod SimpleElevationFilter SingleSplat StaticLocatorFindPointsWithinRadiusDemo StippledLine StructuredGrid TableBasedClipDataSetWithPolyData TableBasedClipDataSetWithPolyData2 TensorGlyph TextureMapQuad ThresholdPoints TransientHDFReader Transparency TriangleColoredPoints TubesFromSplines TubesWithVaryingRadiusAndColors VectorDot VectorField VectorFieldNonZeroExtraction VectorNorm Vol VRMLImporterDemo WarpScalar WarpVector WeightedTransformFilter vtkPointGaussianMapper PointInterpolator vtkPointHandleRepresentation2D SeedWidget SeedWidgetImage SeedWidgetWithCustomCallback vtkPointInterpolator InterpolateFieldDataDemo PointInterpolator vtkPointLoad HyperStreamline TensorAxes TensorEllipsoids vtkPointLocator PointLocator PointLocatorFindPointsWithinRadiusDemo PointLocatorRadius PointLocatorVisualization vtkPointOccupancyFilter PointOccupancy vtkPointPicker MoveAVertexUnstructuredGrid PointPicker SelectAVertex vtkPoints Actor2D AddCell AlignFrames AlignTwoPolyDatas AppendFilter AreaPicking ArrayCalculator BackgroundTexture BandedPolyDataContourFilter BlankPoint Bottle BuildLocatorFromKClosestPoints BuildOctree CameraModel1 CameraModel2 CappedSphere Casting Cell3DDemonstration CellEdges CellPicking CellTypeSource CenterOfMass ChooseTextColorDemo ClipVolume ColoredElevationMap ColoredLines ColoredPoints ColorGlyphs ColorVerticesLookupTable CompareExtractSurface ConstrainedDelaunay2D ContoursToSurface ContourWidget ConvexPointSet CreateESGrid Cube CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvedReformation CutWithScalars DataAnimation DataAnimationSubclass DataSetSurface DecimatePolyline DeformPointSet Delaunay2D DelaunayMesh DeleteCells DeletePoint DelimitedTextReader DirectedGraphToMutableDirectedGraph Dodecahedron ElevationBandsWithGlyphs ElevationFilter EllipticalCylinder EllipticalCylinderDemo ExponentialCosine ExtractArrayComponent ExtractEdges ExtractEnclosedPoints ExtractPolyLinesFromPolyData ExtrudePolyDataAlongLine FastSplatter FilterProgress FilterSelfProgress Finance FitSplineToCutterOutput GetClassName Glyph2D Glyph3D Glyph3DImage Glyph3DMapper GradientBackground GraphPoints GraphToPolyData HedgeHog Hexahedron ImageDataToPointSet ImplicitPolyDataDistance ImplicitSelectionLoop IncrementalOctreePointLocator InterpolateCamera InterpolateMeshOnGrid InterpolateTerrain IterateOverLines IterativeClosestPointsTransform KdTree KDTreeAccessPoints KdTreePointLocatorClosestPoint KMeansClustering KochanekSpline KochanekSplineDemo KochSnowflake LabelContours LabeledDataMapper LabeledMesh LabelPlacementMapper LandmarkTransform LinearCellDemo LongLine MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MiscCellData MiscPointData ModifiedBSPTreeExtractCells Motor MoveAGlyph MoveAVertexUnstructuredGrid MultiLineText MutableDirectedGraphToDirectedGraph NOVCAGraph NullPoint OBBTreeExtractCells OBBTreeIntersectWithLine OctreeClosestPoint OrientedBoundingCylinder ParametricObjectsDemo ParametricSpline PCADemo PieChartActor PKMeansClustering PlanesIntersection Point PointInPolygon PointInsideObject PointInsideObject2 PointsProjectedHull PolyDataCellNormals PolyDataFilter PolyDataPointNormals Polygon PolygonIntersection Polyhedron PolyLine PolyLine1 ProgrammableFilter ProgrammableGlyphFilter ProgrammableSource ProgressReport Pyramid Quad QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo QuantizePolyDataPoints ReadAllPolyDataTypesDemo ReadPlainTextTriangles ReadTextFile ResampleAppendedPolyData ResamplePolyLine RibbonFilter RuledSurfaceFilter ScaleGlyphs SCurveSpline SelectAVertex SelectPolyData SGrid ShepardMethod ShortestPath SideBySideGraphs SimpleElevationFilter SingleSplat SmoothPolyDataFilter SourceObjectsDemo SpiderPlot Spring StructuredDataTypes StructuredGrid StructuredGridOutline StructuredPointsToUnstructuredGrid SurfaceFromUnorganizedPointsWithPostProc TableBasedClipDataSetWithPolyData2 TensorGlyph Tetrahedron TextureCutSphere TextureMapQuad ThinPlateSplineTransform ThresholdCells ThresholdPoints TreeToMutableDirectedGraph Triangle TriangleArea TriangleColoredPoints TriangleSolidColor TriangleStrip TriangulateTerrainMap TubesFromSplines TubesWithVaryingRadiusAndColors UGrid VectorDot VectorNorm Vertex VertexGlyphFilter VertexSize ViewportBorders VisualizeStructuredGrid VisualizeStructuredGridCells vtkTestReader WarpVector WriteLegacyLinearCells WriteVTP WriteVTU WriteXMLLinearCells XMLStructuredGridWriter vtkPointSet AlignTwoPolyDatas ExtractFaces ProcrustesAlignmentFilter vtkPointSetToLabelHierarchy LabelPlacementMapper vtkPointSource AppendFilter CarotidFlow ClosestNPoints ConvexHullShrinkWrap DataStructureComparison DensifyPoints DistanceToCamera DownsamplePointCloud ExtractClusters ExtractSelection ExtractSelectionOriginalId ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FireFlow FireFlowDemo HighlightSelectedPoints KDTreeFindPointsWithinRadius KochanekSpline LabeledDataMapper LabelPlacementMapper LOx LOxGrid LOxSeeds MaskPoints MergePoints MergeSelections NormalEstimation OctreeFindPointsWithinRadius OctreeKClosestPoints Office OfficeA PineRootConnectivityA PointInsideObject2 PointLocator PointLocatorRadius PointLocatorVisualization PointOccupancy PointSize PointSource PointsProjectedHull PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface QuantizePolyDataPoints RadiusOutlierRemoval RandomProbe ScalarVisibility SCurveSpline SelectionSource SelectVisiblePoints SignedDistance SourceObjectsDemo UnsignedDistance vtkPointsProjectedHull PointsProjectedHull vtkPointWidget Arbitrary3DCursor vtkPolyData Actor2D AddCell AlignFrames AlignTwoPolyDatas AppendFilter Arbitrary3DCursor AreaPicking ArrayCalculator BackgroundTexture BandedPolyDataContourFilter BooleanOperationPolyDataFilter Bottle BozoShader BozoShaderDemo BuildOctree CameraModel1 CameraModel2 CapClip CappedSphere Casting CellCentersDemo CellLocatorVisualization CellPicking CellsInsideObject CenterOfMass ChooseTextColorDemo ClipClosedSurface ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo ColoredElevationMap ColoredLines ColoredPoints ColorGlyphs CombineImportedActors CombinePolyData CompareExtractSurface ConnectivityFilterDemo ConstrainedDelaunay2D ContoursFromPolyData ContoursToSurface ContourWidget ConvexPointSet CopyAllArrays Cube CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo CurvedReformation CutWithScalars DataBounds DataSetSurfaceFilter DataStructureComparison DecimatePolyline Decimation DeepCopy DeformPointSet Delaunay2D Delaunay3DDemo DelaunayMesh DeleteCells DelimitedTextReader DensifyPoints DetermineArrayDataTypes DisplayCoordinateAxes DistancePolyDataFilter DumpXMLFile ElevationBandsWithGlyphs ElevationFilter EllipticalCylinder EllipticalCylinderDemo EmbedPointsIntoVolume ExodusIIWriter ExponentialCosine ExportPolyDataScene ExternalContour ExtractArrayComponent ExtractEnclosedPoints ExtractOutsideSurface ExtractSurface ExtractSurfaceDemo ExtractVisibleCells ExtrudePolyDataAlongLine FastSplatter FieldData FillHoles FilterProgress FilterSelfProgress FindAllArrayNames FitSplineToCutterOutput Frustum Game GaussianSplat GenericDataObjectReader GeometryFilter GetMiscCellData GetMiscPointData Glyph2D Glyph3D Glyph3DImage Glyph3DMapper GradientBackground Hawaii HiddenLineRemoval HighlightBadCells HighlightSelectedPoints HighlightSelection IdentifyHoles ImageTracerWidget ImageTracerWidgetInsideContour ImplicitBooleanDemo ImplicitDataSetClipping ImplicitModeller ImplicitPolyDataDistance ImportPolyDataScene IncrementalOctreePointLocator InterpolateCamera InterpolateMeshOnGrid InterpolateTerrain IterateOverLines IterativeClosestPointsTransform KDTreeAccessPoints KDTreeFindPointsWithinRadiusDemo KdTreePointLocatorClosestPoint KDTreeTimingDemo KMeansClustering KochanekSpline KochanekSplineDemo KochSnowflake LabelContours LabeledDataMapper LabeledMesh LabelPlacementMapper LandmarkTransform Legend LineWidget2 LongLine LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties MergePoints MeshQuality MinimalQtVTKApp MiscCellData MiscPointData ModifiedBSPTreeIntersectWithLine ModifiedBSPTreeTimingDemo MoveAGlyph MoveAVertexUnstructuredGrid MultiLineText MultipleRenderWindows NormalEstimation NormalsDemo NullPoint OBBDicer OBBTreeTimingDemo OBJImporter OctreeClosestPoint OctreeFindPointsWithinRadiusDemo OctreeTimingDemo OctreeVisualize OpenVRCone OpenVRCube OpenVRCylinder OpenVRFrustum OpenVROrientedArrow OpenVROrientedCylinder OpenVRSphere OrientedBoundingCylinder OrientedGlyphs ParallelCoordinatesView ParametricSpline PassThrough PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PCADemo Picking PineRootConnectivity PineRootDecimation PKMeansClustering Plane Planes PlaneSourceDemo Point PointDataSubdivision PointInsideObject PointInsideObject2 PointInterpolator PointLocator PointLocatorFindPointsWithinRadiusDemo PointLocatorVisualization PointOccupancy PointsProjectedHull PoissonExtractSurface PolyDataAlgorithmReader PolyDataCellNormals PolyDataContourToImageData PolyDataExtractNormals PolyDataFilter PolyDataGetPoint PolyDataPointNormals PolyDataPointSampler Polygon PolygonalSurfaceContourLineInterpolator PolyLine PolyLine1 PowercrustExtractSurface ProcrustesAlignmentFilter ProgrammableFilter ProgrammableGlyphFilter ProgrammableSource ProgressReport ProjectedTexture ProjectSphere Quad QuadricClustering QuadricDecimation QuantizePolyDataPoints RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadPlainTextTriangles ReadTextFile ReadUnknownTypeXMLFile RegularPolygonSource RemoveOutsideSurface RemoveVertices ResampleAppendedPolyData ResamplePolyLine RibbonFilter Rotations RotationsA RotationsB RotationsC RotationsD RuledSurfaceFilter SaveSceneToFieldData SaveSceneToFile ScalarBarActor ScalarBarActorColorSeries ScaleGlyphs SelectAVertex Shadows ShallowCopy ShepardInterpolation ShepardMethod ShrinkPolyData SignedDistance Silhouette SimpleElevationFilter SingleSplat SmoothPolyDataFilter SpatterShader Sphere SplitPolyData Spring StaticLocatorFindPointsWithinRadiusDemo StippledLine StreamlinesWithLineWidget Subdivision SubdivisionDemo SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc TensorGlyph TextureMapPlane TextureMapQuad ThresholdCells ThresholdPoints TransformActor TransientHDFReader Triangle TriangleArea TriangleColoredPoints TriangleSolidColor TriangleStrip TriangulateTerrainMap TubesWithVaryingRadiusAndColors UnsignedDistance VectorDot VectorFieldNonZeroExtraction VectorNorm Vertex VertexConnectivity VertexGlyphFilter ViewportBorders Visualize2DPoints VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree VisualizeStructuredGrid VRMLImporterDemo vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader WarpSurface WarpVector WeightedTransformFilter WindowModifiedEvent WriteVTP vtkPolyDataAlgorithm CallData CompareExtractSurface GeometricObjectsDemo MultipleRenderWindows MultipleViewports ShareCamera SourceObjectsDemo Subdivision SubdivisionDemo vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader vtkPolyDataCollection PolygonalSurfaceContourLineInterpolator PolygonalSurfacePointPlacer vtkPolyDataConnectivityFilter ColorDisconnectedRegions ColorDisconnectedRegionsDemo ConnectivityFilterDemo ExtractLargestIsosurface ExtractOutsideSurface ExtrudePolyDataAlongLine PineRootConnectivity PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion vtkPolyDataMapper2D Actor2D ChooseTextColorDemo CompareExtractSurface GradientBackground LabeledMesh MarkKeypoints MultiLineText ReadAllPolyDataTypesDemo ViewportBorders Visualize2DPoints vtkPolyDataNormals BlobbyLogo Blow ColorIsosurface CombustorIsosurface CubeAxesActor2D CubeMap CurvatureBandsWithGlyphs CurvaturesAdjustEdges DecimateFran DecimateHawaii DisplacementPlot ElevationBandsWithGlyphs ExtrudePolyDataAlongLine FillHoles FrogBrain FroggieSurface FroggieView FrogSlice IdentifyHoles MassProperties Motor NormalsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PlateVibration PointDataSubdivision PolyDataExtractNormals PolyDataRIB PseudoVolumeRendering ShadowsLightsDemo SmoothPolyDataFilter SpatterShader SphereMap SpikeFran SplatFace Spring StripFran TensorEllipsoids VelocityProfile VRMLImporterDemo WarpCombustor WarpSurface vtkPolyDataPointSampler PolyDataPointSampler vtkPolyDataReader AlignTwoPolyDatas BlobbyLogo BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CapClip CellCentersDemo CellsInsideObject ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CompareExtractSurface ConnectivityFilterDemo CurvedReformation DecimateFran DecimateHawaii Delaunay3DDemo DensifyPoints DisplacementPlot DistancePolyDataFilter ExportPolyDataScene ExtractEnclosedPoints ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FillHoles FroggieView GradientBackground Hawaii Hello HiddenLineRemoval HighlightSelection ImplicitModeller InterpolateCamera KDTreeFindPointsWithinRadiusDemo LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientedBoundingCylinder PlateVibration PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface ProjectedTexture RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation SignedDistance SpatterShader SpikeFran SplatFace SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Stocks StripFran Subdivision SubdivisionDemo UnsignedDistance ViewportBorders VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkPolyDataSilhouette HighlightWithSilhouette Silhouette vtkPolyDataTangents CurvaturesAdjustEdges PBR_Anisotropy PBR_Clear_Coat PBR_HDR_Environment PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkPolyDataToImageStencil ImageTracerWidgetInsideContour PolyDataContourToImageData PolyDataToImageData vtkPolygon ConstrainedDelaunay2D ImageTracerWidgetInsideContour LinearCellDemo PointInPolygon Polygon PolygonIntersection TextureMapQuad WriteLegacyLinearCells WriteXMLLinearCells vtkPolygonalSurfaceContourLineInterpolator PolygonalSurfaceContourLineInterpolator vtkPolygonalSurfacePointPlacer PolygonalSurfaceContourLineInterpolator PolygonalSurfacePointPlacer vtkPolyhedron Dodecahedron vtkPolyLine ChooseTextColorDemo CompareExtractSurface EllipticalCylinder EllipticalCylinderDemo GradientBackground KochSnowflake LinearCellDemo NOVCAGraph PointsProjectedHull PolyLine ReadAllPolyDataTypesDemo ViewportBorders WriteLegacyLinearCells WriteXMLLinearCells vtkPolyVertex LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPostScriptWriter ImageWriter vtkProbeFilter Arbitrary3DCursor CurvedReformation FitToHeightMap InterpolateMeshOnGrid InterpolateTerrain IsosurfaceSampling ProbeCombustor RandomProbe ShepardInterpolation TissueLens XYPlot vtkProcrustesAlignmentFilter ProcrustesAlignmentFilter vtkProgrammableFilter DataAnimation DataAnimationSubclass ProgrammableFilter vtkProgrammableGlyphFilter ProgrammableGlyphFilter vtkProgrammableSource ProgrammableSource vtkProjectedTexture ProjectedTexture vtkProjectSphereFilter ProjectSphere vtkProp ImageRegion vtkProp3D AreaPicking FroggieSurface FroggieView MovableAxes vtkProp3DButtonRepresentation EllipticalButton vtkProp3DCollection AreaPicking vtkPropAssembly AnatomicalOrientation ColoredAnnotatedCube FroggieSurface FroggieView vtkPropCollection Assembly Game HideActor MovableAxes vtkProperty2D Actor2D CellLocatorVisualization CenterAnImage ChooseTextColorDemo CompareExtractSurface CompareRandomGeneratorsCxx FireFlowDemo FroggieView GradientBackground HistogramBarChart ImageAccumulateGreyscale ImageClip ImageRegion KochanekSplineDemo LabeledMesh LabelPlacementMapper LinearCellDemo LogoWidget MarkKeypoints MultiLineText OctreeVisualize PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PieChartActor PointDataSubdivision PointLocatorVisualization ReadAllPolyDataTypesDemo RectilinearWipeWidget SeedWidget SeedWidgetImage SeedWidgetWithCustomCallback Slider2D SpiderPlot ViewportBorders Visualize2DPoints VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree XYPlot vtkPropPicker HighlightPickedActor HighlightWithSilhouette ImageRegion Picking PickPixel PickPixel2 vtkProteinRibbonFilter ProteinRibbons vtkPyramid Cell3DDemonstration LinearCellDemo Pyramid WriteLegacyLinearCells WriteXMLLinearCells vtkQImageToImageSource QImageToImageSource vtkQuad LinearCellDemo OrientedBoundingCylinder Quad WriteLegacyLinearCells WriteXMLLinearCells vtkQuadraticEdge IsoparametricCellsDemo vtkQuadraticHexahedron IsoparametricCellsDemo QuadraticHexahedron QuadraticHexahedronDemo vtkQuadraticLinearQuad IsoparametricCellsDemo vtkQuadraticLinearWedge IsoparametricCellsDemo vtkQuadraticPolygon IsoparametricCellsDemo vtkQuadraticPyramid IsoparametricCellsDemo vtkQuadraticQuad IsoparametricCellsDemo vtkQuadraticTetra IsoparametricCellsDemo QuadraticTetra QuadraticTetraDemo vtkQuadraticTriangle IsoparametricCellsDemo vtkQuadraticWedge IsoparametricCellsDemo vtkQuadric ContourQuadric DisplayQuadricSurfaces ExtractData FlatVersusGouraud ImplicitQuadric QuadraticSurface QuadricVisualization TextureCutQuadric vtkQuadricClustering QuadricClustering vtkQuadricDecimation QuadricDecimation vtkQuadricLODActor QuadricLODActor vtkQuantizePolyDataPoints QuantizePolyDataPoints vtkRadiusOutlierRemoval RadiusOutlierRemoval vtkRandomGraphSource RandomGraphSource vtkRectf ChartsOn3DScene PlotLine3D SurfacePlot vtkRectilinearGrid ClipDataSetWithPolyData DumpXMLFile RectilinearGrid RectilinearGridToTetrahedra RGrid StructuredDataTypes TableBasedClipDataSetWithPolyData TableBasedClipDataSetWithPolyData2 VisualizeRectilinearGrid vtkRectilinearGridGeometryFilter ClipDataSetWithPolyData RGrid TableBasedClipDataSetWithPolyData vtkRectilinearGridToTetrahedra RectilinearGridToTetrahedra vtkRectilinearWipeRepresentation RectilinearWipeWidget vtkRectilinearWipeWidget RectilinearWipeWidget vtkReflectionFilter Reflection vtkRegularPolygonSource BalloonWidget Circle GeometricObjectsDemo Glyph2D RegularPolygonSource Triangulate vtkRemoveIsolatedVertices RemoveIsolatedVertices vtkRenderedGraphRepresentation ColorVertexLabels LabelVerticesAndEdges ScaleVertices SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver VertexSize vtkRendererCollection CellPicking ExtractVisibleCells Game Hanoi HanoiInitial HanoiIntermediate HighlightSelectedPoints HighlightSelection LayeredActors MoveAVertexUnstructuredGrid Picking PointPicker SelectAVertex TransparentBackground WorldPointPicker vtkRenderLargeImage PointDataSubdivision RenderLargeImage vtkRenderPassCollection PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing RenderScalarToFloatBuffer Shadows ShadowsLightsDemo vtkRenderStepsPass MotionBlur OutlineGlowPass Shadows vtkRenderView RenderView vtkRenderWidget MinimalQtVTKApp vtkReverseSense CurvatureBandsWithGlyphs ElevationBandsWithGlyphs ReverseSense SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc vtkRibbonFilter RibbonFilter Stocks StreamlinesWithLineWidget vtkRIBExporter PolyDataRIB vtkRIBProperty PolyDataRIB vtkRotationalExtrusionFilter Bottle CameraModel1 CameraModel2 CappedSphere Spring vtkRTAnalyticSource ImplicitDataSet RTAnalyticSource vtkRuledSurfaceFilter ExtrudePolyDataAlongLine RuledSurfaceFilter vtkRungeKutta4 OfficeTube StreamlinesWithLineWidget vtkSampleFunction Attenuation BooleanOperationImplicitFunctions ContourQuadric DiscreteMarchingCubes DisplayQuadricSurfaces ExtractData FlatVersusGouraud GenericClip IceCream ImplicitBoolean ImplicitBooleanDemo ImplicitQuadric ImplicitSphere ImplicitSphere1 IsosurfaceSampling PerlinNoise QuadraticSurface QuadricVisualization RandomProbe SampleFunction SmoothDiscreteMarchingCubes vtkSampleImplicitFunctionFilter MaskPointsFilter vtkScalarBarActor CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo DistancePolyDataFilter ElevationBandsWithGlyphs RescaleReverseLUT ScalarBarActor ScalarBarActorColorSeries ScalarBarWidget SignedDistance UnsignedDistance vtkScalarBarWidget ScalarBarWidget vtkScalarsToColors ExportPolyDataScene vtkSCurveSpline SCurveSpline vtkSeedRepresentation SeedWidget SeedWidgetImage SeedWidgetWithCustomCallback vtkSeedWidget SeedWidget SeedWidgetImage SeedWidgetWithCustomCallback vtkSelectEnclosedPoints CellsInsideObject Game PointInsideObject vtkSelection CellEdgeNeighbors CellPicking CellPointNeighbors ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId ExtractVisibleCells FillHoles MergeSelections SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver VertexConnectivity vtkSelectionNode CellEdgeNeighbors CellPicking CellPointNeighbors ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId FillHoles MergeSelections SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver SelectionSource VertexConnectivity vtkSelectionSource SelectionSource vtkSelectPolyData SelectPolyData vtkSelectVisiblePoints LabeledMesh SelectVisiblePoints vtkSequencePass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing RenderScalarToFloatBuffer Shadows ShadowsLightsDemo vtkShader BozoShader BozoShaderDemo ColorByNormal CubeMap MarbleShader MarbleShaderDemo SpatterShader SphereMap vtkShaderProgram BozoShader BozoShaderDemo MarbleShader MarbleShaderDemo SpatterShader vtkShaderProperty BozoShader BozoShaderDemo ColorByNormal CubeMap MarbleShader MarbleShaderDemo SpatterShader SphereMap vtkShadowMapBakerPass Shadows ShadowsLightsDemo vtkShadowMapPass Shadows ShadowsLightsDemo vtkShepardMethod BackgroundTexture ShepardInterpolation ShepardMethod vtkShortArray Lorenz vtkShrinkFilter CellTypeSource ExtractData FindCellIntersections HyperTreeGridSource IntersectLine LoopShrink OpenVRTessellatedBoxSource ReadLegacyUnstructuredGrid ShrinkCube TessellatedBoxSource VisualizeRectilinearGrid VisualizeStructuredGridCells vtkShrinkPolyData Frustum MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD OpenVRFrustum RegularPolygonSource ShrinkPolyData vtkSignedDistance CompareExtractSurface ExtractSurface ExtractSurfaceDemo SignedDistance vtkSimple2DLayoutStrategy VisualizeDirectedGraph VisualizeGraph XGMLReader vtkSimpleElevationFilter SimpleElevationFilter vtkSimpleMotionBlurPass MotionBlur vtkSimplePointsReader SimplePointsReader vtkSimplePointsWriter SimplePointsWriter vtkSkybox PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing SphereMap vtkSLCReader IntermixedUnstructuredGrid ReadSLC vtkSliderRepresentation CellLocatorVisualization IsoContours OctreeVisualize PointLocatorVisualization Slider Slider2D VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkSliderRepresentation2D CellLocatorVisualization Delaunay3DDemo FireFlowDemo FroggieView KochanekSplineDemo MarbleShaderDemo OctreeVisualize ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointLocatorVisualization QuadraticHexahedronDemo QuadraticTetraDemo Slider2D VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkSliderRepresentation3D IsoContours Slider vtkSliderWidget CellLocatorVisualization Delaunay3DDemo FireFlowDemo FroggieView IsoContours KochanekSplineDemo MarbleShaderDemo OctreeVisualize ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointLocatorVisualization QuadraticHexahedronDemo QuadraticTetraDemo Slider Slider2D VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkSmartVolumeMapper OpenVRVolume vtkSmoothPolyDataFilter ConvexHullShrinkWrap PointInsideObject2 SmoothPolyDataFilter vtkSortDataArray SortDataArray vtkSparseArray SparseArray vtkSphere Attenuation BooleanOperationImplicitFunctions ClipSphereCylinder DiscreteMarchingCubes ExtractData ExtractPointsDemo FitImplicitFunction IceCream ImplicitBoolean ImplicitBooleanDemo ImplicitSphere ImplicitSphere1 IsosurfaceSampling OverlappingAMR SmoothDiscreteMarchingCubes SphereWidget2 TissueLens vtkSphereRepresentation SphereWidget2 vtkSphereSource AffineWidget AlignTwoPolyDatas AmbientSpheres AnimateActors Animation AnimationScene AppendFilter Arbitrary3DCursor Assembly Axes AxisActor BackfaceCulling BackgroundColor BackgroundGradient BalloonWidget BiDimensionalWidget BillboardTextActor3D BooleanOperationPolyDataFilter BozoShader BozoShaderDemo BrownianPoints CallData Camera CameraActor CameraBlur CameraModel1 CameraModel2 CameraModifiedEvent CapClip CaptionWidget CellCentersDemo CellEdgeNeighbors CellLocator CellLocatorVisualization CellPointNeighbors CellsInsideObject CellTreeLocator ClientData ClipClosedSurface ClipFrustum ClosedSurface CollisionDetection ColorActorEdges ColorAnActor ColorByNormal ColorDisconnectedRegions ColorDisconnectedRegionsDemo ColoredSphere CombinePolyData CommandSubclass CompareExtractSurface CompositePolyDataMapper ConnectivityFilter ConnectivityFilterDemo ContoursFromPolyData ConvexHullShrinkWrap ConvexPointSet CopyAllArrays CornerAnnotation CorrectlyRenderTranslucentGeometry Cursor2D Cursor3D CursorShape CurvatureBandsWithGlyphs DataAnimation DataAnimationSubclass DataBounds Decimation DeformPointSet Delaunay3DDemo DelaunayMesh DensifyPoints DepthSortPolyData DetermineActorType DiffuseSpheres DijkstraGraphGeodesicPath DisplayCoordinateAxes DistancePolyDataFilter DistanceToCamera DoubleClick DrawText EarthSource ElevationBandsWithGlyphs EmbedPointsIntoVolume ExportPolyDataScene ExternalContour ExtractCellsUsingPoints ExtractClusters ExtractEdges ExtractEnclosedPoints ExtractOutsideSurface ExtractPointsDemo ExtractPolyLinesFromPolyData ExtractSelection ExtractSelectionCells ExtractVisibleCells FieldData FillHoles FilterProgress FilterSelfProgress FindAllArrayNames FireFlow FireFlowDemo FitImplicitFunction FitSplineToCutterOutput FlatShading FlatVersusGouraud FrameRate FullScreen Game GaussianSplat GenericClip GeometricObjectsDemo GLTFExporter GradientBackground HiddenLineRemoval HideActor HideAllActors HighlightBadCells HighlightPickedActor HighlightSelection HighlightWithSilhouette HoverWidget ImageDataGeometryFilter ImagePlaneWidget ImageTracerWidgetNonPlanar ImageTranslateExtent ImageWriter ImplicitDataSetClipping ImplicitModeller ImplicitPlaneWidget2 ImplicitPolyDataDistance ImplicitSelectionLoop InteractorStyleTerrain InteractorStyleUser InterpolateCamera IntersectionPolyDataFilter IsoparametricCellsDemo IterativeClosestPointsTransform KDTreeFindPointsWithinRadiusDemo KDTreeTimingDemo KeypressEvents KeypressObserver KochanekSpline KochanekSplineDemo LabeledDataMapper LabeledMesh LabelPlacementMapper LandmarkTransform Legend Light LinearCellDemo LineWidget2 LODProp3D LogoWidget LoopBooleanPolyDataFilter LoopShrink Mace MarbleShader MarbleShaderDemo MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MarchingCubes MaskPointsFilter MassProperties MeshQuality MinimalQtVTKApp Model ModifiedBSPTreeExtractCells ModifiedBSPTreeIntersectWithLine ModifiedBSPTreeTimingDemo MouseEvents MouseEventsObserver MoveActor MoveAGlyph MoveCamera MultiBlockDataSet MultiBlockMergeFilter MultipleActors MultipleInputPorts MultipleRenderWindows MultipleViewports NormalEstimation NormalsDemo NoShading OBBDicer OBBTreeExtractCells OBBTreeIntersectWithLine OBBTreeTimingDemo ObserverMemberFunction OctreeFindPointsWithinRadiusDemo OctreeTimingDemo OctreeVisualize OffScreenRendering Opacity OpenVROrientedArrow OpenVROrientedCylinder OpenVRSphere OrientedArrow OrientedBoundingCylinder OrientedCylinder OrientedGlyphs ParametricSpline PassThrough PBR_Anisotropy PBR_Edge_Tint PBR_HDR_Environment PBR_Materials PBR_Materials_Coat PCADemo Picking Planes PlanesIntersection PlaneSourceDemo PointCellIds PointDataSubdivision PointInsideObject2 PointLocatorFindPointsWithinRadiusDemo PointLocatorVisualization PointPicker PointsProjectedHull PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion PolyDataContourToImageData PolyDataExtractNormals PolyDataGetPoint PolyDataPointSampler PolyDataToImageData PolyDataToUnstructuredGrid PolygonalSurfaceContourLineInterpolator PolygonalSurfacePointPlacer ProcrustesAlignmentFilter ProgrammableFilter ProgrammableGlyphFilter ProgressReport ProjectedTexture QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo QuadricClustering QuadricDecimation QuadricLODActor QuantizePolyDataPoints RadiusOutlierRemoval RandomProbe ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadAllUnstructuredGridTypes ReadLegacyUnstructuredGrid ReadPDB RemoveOutsideSurface RenderView ResamplePolyLine ReverseAccess ReverseSense RotatingSphere Rotations RotationsA RotationsB RotationsC RotationsD RubberBand2D RubberBand2DObserver RubberBand3D RubberBandPick RubberBandZoom SaveSceneToFieldData SaveSceneToFile ScalarBarActor ScalarBarActorColorSeries SceneBounds Screenshot SeedWidget SeedWidgetWithCustomCallback SelectAnActor SelectPolyData SelectVisiblePoints Shadows ShadowsLightsDemo ShareCamera ShepardInterpolation ShiftAndControl ShrinkPolyData SideBySideRenderWindowsQt SideBySideViewports Silhouette SimplePointsWriter Slider Slider2D SourceObjectsDemo SpatterShader SpecularSpheres Sphere SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Stripper StyleSwitch Subdivision SubdivisionDemo SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc TensorEllipsoids TextureCutQuadric TextureCutSphere TexturedButtonWidget TextWidget TissueLens TrackballActor TrackballCamera TransformActorCollection TransformPolyData TransformSphere UserEvent VectorOfActors VertexConnectivity Visualize2DPoints VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree VisualizeStructuredGrid WarpScalar WarpSurface WeightedTransformFilter WindowedSincPolyDataFilter WindowModifiedEvent WindowSize WindowTitle WorldPointPicker WritePLY WriteSTL XMLPUnstructuredGridWriter vtkSphereWidget SphereWidget SphereWidgetEvents vtkSphereWidget2 SphereWidget2 vtkSpiderPlotActor SpiderPlot vtkSplineFilter CurvedReformation FitSplineToCutterOutput ResamplePolyLine vtkSplineWidget2 SplineWidget vtkStaticPointLocator InterpolateFieldDataDemo StaticLocatorFindPointsWithinRadiusDemo vtkStatisticsAlgorithm BoxChart KMeansClustering PCADemo PCAStatistics PKMeansClustering vtkStdString ArrayWriter HistogramBarChart ImageText StringToImageDemo vtkSTLReader AlignTwoPolyDatas BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CapClip CellCentersDemo CellsInsideObject ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CompareExtractSurface ConnectivityFilterDemo Delaunay3DDemo DensifyPoints ExportPolyDataScene ExtractEnclosedPoints ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FillHoles GradientBackground HiddenLineRemoval HighlightSelection ImplicitModeller InterpolateCamera KDTreeFindPointsWithinRadiusDemo LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientedBoundingCylinder PointInterpolator PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface ProjectedTexture RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadSTL Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation SignedDistance SpatterShader SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Subdivision SubdivisionDemo UnsignedDistance VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree WriteSTL vtkSTLWriter WriteSTL vtkStreamingDemandDrivenPipeline ClipArt ImageClip vtkImageAlgorithmFilter vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader vtkStreamTracer BluntStreamlines CarotidFlow FireFlow FireFlowDemo Kitchen LOx LOxGrid LOxSeeds Office OfficeA OfficeTube PineRootConnectivityA StreamLines StreamlinesWithLineWidget vtkStringArray AxisActor BoxChart CreateTree ExportPolyDataScene LabelPlacementMapper ParallelCoordinatesView PieChart SaveSceneToFieldData StackedBar StackedPlot vtkStripper Bottle CannyEdgeDetector CapClip ExtractPolyLinesFromPolyData ExtrudePolyDataAlongLine FitSplineToCutterOutput FrogBrain FroggieSurface LabelContours MedicalDemo2 MedicalDemo3 PolyDataContourToImageData PseudoVolumeRendering StripFran Stripper vtkStructuredData CellIdFromGridCoordinates GetLinearPointId IntersectLine vtkStructuredGrid BlankPoint BluntStreamlines CutStructuredGrid DumpXMLFile GenericDataObjectReader GetLinearPointId HedgeHog Kitchen LOx LOxGrid LOxSeeds Office OfficeA OfficeTube PineRootConnectivityA ProbeCombustor PseudoVolumeRendering Rainbow SGrid StreamlinesWithLineWidget StructuredDataTypes StructuredGrid StructuredGridOutline TextureThreshold VelocityProfile VisualizeStructuredGrid VisualizeStructuredGridCells WarpCombustor XMLStructuredGridWriter XYPlot vtkStructuredGridGeometryFilter BlankPoint BluntStreamlines CutStructuredGrid Kitchen LOx LOxGrid LOxSeeds Office OfficeA OfficeTube PineRootConnectivityA Rainbow ReadPLOT3D ReadStructuredGrid StructuredGridReader TextureThreshold VelocityProfile VisualizeStructuredGrid WarpCombustor vtkStructuredGridOutlineFilter BluntStreamlines ColorIsosurface CombustorIsosurface CutStructuredGrid Kitchen LOx LOxGrid Office OfficeA OfficeTube PineRootConnectivityA ProbeCombustor PseudoVolumeRendering Rainbow StreamLines StreamlinesWithLineWidget StructuredGridOutline TextureThreshold VelocityProfile WarpCombustor XYPlot vtkStructuredGridReader Kitchen Office OfficeA OfficeTube PineRootConnectivityA StructuredGridReader vtkStructuredPoints CarotidFlowGlyphs Lorenz StructuredPointsToUnstructuredGrid Vol vtkStructuredPointsReader AnimateVectors CarotidFlow CarotidFlowGlyphs ComplexV ExtractLargestIsosurface IntermixedUnstructuredGrid IronIsoSurface MinIntensityRendering Motor SimpleRayCast StructuredPointsReader TextureCutSphere TextureThreshold vtkSubPixelPositionEdgels CannyEdgeDetector vtkSuperquadric ExtractPointsDemo SampleFunction vtkSuperquadricSource BackgroundImage CubeAxesActor CurvatureBandsWithGlyphs CurvaturesDemo ElevationBandsWithGlyphs EllipticalButton OrientationMarkerWidget1 PointDataSubdivision SolidClip vtkSurfaceReconstructionFilter SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc vtkTable AdjacencyMatrixToEdgeTable AreaPlot ArrayToTable BarChart BarChartQt BoxChart ChartMatrix ChartsOn3DScene ConstructTable DelimitedTextReader DelimitedTextWriter FunctionalBagPlot KDTreeTimingDemo KMeansClustering LinePlot ModifiedBSPTreeTimingDemo MultiplePlots OBBTreeTimingDemo OctreeTimingDemo ParallelCoordinates ParallelCoordinatesView PCADemo PCAStatistics PieChart PKMeansClustering PlotLine3D ScatterPlot StackedBar StackedPlot SurfacePlot vtkTableBasedClipDataSet ClipUnstructuredGridWithPlane TableBasedClipDataSetWithPolyData TableBasedClipDataSetWithPolyData2 vtkTableToPolyData PointInterpolator vtkTensorGlyph TensorAxes TensorEllipsoids TensorGlyph vtkTessellatedBoxSource OpenVRTessellatedBoxSource TessellatedBoxSource vtkTessellatorFilter CellTypeSource QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo vtkTetra Cell3DDemonstration CellTypeSource LinearCellDemo Tetrahedron WriteLegacyLinearCells WriteVTU WriteXMLLinearCells vtkTextActor Arbitrary3DCursor CameraModel1 CameraModel2 CaptionWidget ChooseTextColor ChooseTextColorDemo CollisionDetection DrawText MovableAxes PlatonicSolids PointDataSubdivision TextActor TextWidget vtkTextMapper BozoShaderDemo Cell3DDemonstration CellTypeSource CompareExtractSurface CompareRandomGeneratorsCxx CurvaturesAdjustEdges CurvaturesDemo Delaunay3D Delaunay3DDemo FontFile GeometricObjectsDemo GradientBackground IsoparametricCellsDemo KochanekSplineDemo LinearCellDemo MultiLineText ParametricObjectsDemo Planes PlatonicSolids PointDataSubdivision QuadraticHexahedronDemo QuadraticTetraDemo ReadAllPolyDataTypesDemo ReadDICOMSeries RescaleReverseLUT ResizeImageDemo SourceObjectsDemo vtkTextProperty AnatomicalOrientation Arbitrary3DCursor AreaPlot Axes AxisActor BarChart BarChartQt BillboardTextActor3D BoxChart BozoShaderDemo CameraModel1 CameraModel2 CaptionActor2D CaptionWidget Cell3DDemonstration CellLocatorVisualization CellTypeSource ChooseTextColor ChooseTextColorDemo CollisionDetection ColoredAnnotatedCube ColorVertexLabels CompareExtractSurface CompareRandomGeneratorsCxx CornerAnnotation CubeAxesActor CubeAxesActor2D CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo Delaunay3D Delaunay3DDemo Diagram DrawText ElevationBandsWithGlyphs FontFile FroggieSurface FroggieView GeometricObjectsDemo GradientBackground Histogram2D ImageText IsoparametricCellsDemo KochanekSplineDemo LabelContours LabeledDataMapper LabeledMesh LabelPlacementMapper LabelVerticesAndEdges LinearCellDemo MultiLineText OctreeVisualize ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel PickPixel2 PieChartActor Planes PlatonicSolids PointDataSubdivision PointLocatorVisualization QuadraticHexahedronDemo QuadraticTetraDemo ReadAllPolyDataTypesDemo ReadDICOMSeries RescaleReverseLUT ResizeImageDemo Slider2D SourceObjectsDemo SpiderPlot StackedBar StringToImageDemo TextActor TextWidget VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree WordCloud XYPlot vtkTextRepresentation TextWidget vtkTextSource SourceObjectsDemo TextSource vtkTexture AnimateVectors ClipArt CubeMap DecimateFran EllipticalButton FrogSlice Motor OBJImporter PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ProjectedTexture SphereMap StippledLine TextureCutQuadric TextureCutSphere TexturedSphere TextureMapImageData TextureMapPlane TextureMapQuad TexturePlane TextureThreshold vtkTexturedButtonRepresentation2D TexturedButtonWidget vtkTexturedSphereSource CurvaturesAdjustEdges PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing TexturedSphere vtkTextureMapToPlane ClipArt TextureMapPlane vtkTextureMapToSphere PBR_Anisotropy TexturedSphere vtkTextWidget TextWidget vtkThinPlateSplineTransform ThinPlateSplineTransform vtkThreshold CannyEdgeDetector GenerateCubesFromLabels GenerateModelsFromLabels HighlightBadCells IntermixedUnstructuredGrid IntersectLine PointOccupancy RandomProbe SplitPolyData ThresholdCells vtkThresholdPoints AnimateVectors CarotidFlow CarotidFlowGlyphs MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD RandomProbe ThresholdPoints VectorFieldNonZeroExtraction vtkThresholdTextureCoords TextureThreshold vtkTIFFReader PickPixel2 ReadTIFF WriteTIFF vtkTIFFWriter ImageWriter WriteTIFF vtkTimerLog CompareExtractSurface CorrectlyRenderTranslucentGeometry KDTreeTimingDemo ModifiedBSPTreeTimingDemo OBBTreeTimingDemo OctreeTimingDemo SaveSceneToFile TimerLog vtkTimeSourceExample ExodusIIWriter vtkTimeStamp TimeStamp vtkToneMappingPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkTransform AffineWidget AlignFrames AlignTwoPolyDatas AnatomicalOrientation Assembly Axes BlobbyLogo BoxWidget BoxWidget2 BozoShader BozoShaderDemo CameraModel1 CameraModel2 CellsInsideObject ClipSphereCylinder ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 CollisionDetection ColoredAnnotatedCube CombineImportedActors ContoursToSurface CorrectlyRenderTranslucentGeometry CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs EllipticalCylinderDemo ExponentialCosine ExportPolyDataScene ExternalContour ExtractData ExtrudePolyDataAlongLine FroggieSurface FroggieView FrogSlice Game GenerateCubesFromLabels GLTFExporter ImageRotate IndividualVRML IterativeClosestPointsTransform LayeredActors MarbleShader MarbleShaderDemo MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MarkKeypoints OpenVROrientedArrow OpenVROrientedCylinder OrientedArrow OrientedCylinder PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PCADemo PerspectiveTransform PlaneSourceDemo ProbeCombustor ProcrustesAlignmentFilter ResampleAppendedPolyData RotationAroundLine SpatterShader SpikeFran Stocks StructuredDataTypes SurfaceFromUnorganizedPointsWithPostProc TransformActor TransformActorCollection TransformFilter TransformOrderDemo TransformPipeline TransformPolyData TransformSphere Tutorial_Step6 WalkCow WalkCowA WalkCowB WeightedTransformFilter XYPlot vtkTransformFilter AlignFrames CameraModel1 CameraModel2 CurvaturesDemo GenerateCubesFromLabels TransformFilter TransformSphere WeightedTransformFilter vtkTransformPolyDataFilter AlignTwoPolyDatas AnatomicalOrientation BlobbyLogo BozoShader BozoShaderDemo CameraModel1 CameraModel2 CellsInsideObject ColoredAnnotatedCube CombineImportedActors ContoursToSurface CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs EllipticalCylinderDemo ExponentialCosine ExternalContour ExtrudePolyDataAlongLine FroggieSurface FroggieView FrogSlice Game GLTFExporter IterativeClosestPointsTransform LandmarkTransform MarbleShader MarbleShaderDemo MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MarkKeypoints OpenVROrientedArrow OpenVROrientedCylinder OrientedArrow OrientedCylinder PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PCADemo PlaneSourceDemo ProbeCombustor ProcrustesAlignmentFilter ResampleAppendedPolyData RotationAroundLine SpatterShader SpikeFran Stocks SurfaceFromUnorganizedPointsWithPostProc TransformPolyData XYPlot vtkTransformTextureCoords TexturedSphere vtkTree BoostBreadthFirstSearchTree BreadthFirstDistance ConstructTree CreateTree DepthFirstSearchAnimation DepthFirstSearchIterator MinimumSpanningTree TreeBFSIterator TreeToMutableDirectedGraph vtkTreeBFSIterator TreeBFSIterator vtkTreeDFSIterator DepthFirstSearchAnimation DepthFirstSearchIterator vtkTreeMapView TreeMapView vtkTriangle AddCell CellEdges KochSnowflake LinearCellDemo MiscCellData ThresholdCells Triangle TriangleArea TriangleColoredPoints TriangleSolidColor WriteLegacyLinearCells WriteXMLLinearCells vtkTriangleFilter BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CellEdgeNeighbors CellPicking CellPointNeighbors ClipArt CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo Decimation ElevationBandsWithGlyphs HighlightBadCells ImageToPolyDataFilter LinearExtrusion LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties MeshQuality PBR_Clear_Coat PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision PolygonalSurfaceContourLineInterpolator QuadricDecimation SpatterShader Subdivision SubdivisionDemo Triangulate VertexConnectivity vtkTriangleMeshPointNormals BozoShader BozoShaderDemo ColorByNormal MarbleShader MarbleShaderDemo vtkTriangleStrip LinearCellDemo TriangleStrip WriteLegacyLinearCells WriteXMLLinearCells vtkTriQuadraticHexahedron IsoparametricCellsDemo vtkTubeFilter Bottle CarotidFlow DelaunayMesh EllipticalCylinderDemo Finance FinanceFieldData FireFlow FireFlowDemo FitSplineToCutterOutput GradientFilter LOx LOxGrid LOxSeeds MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD OfficeTube OrientedBoundingCylinder PointsProjectedHull PseudoVolumeRendering ReadLegacyUnstructuredGrid ReadPDB Stocks TensorAxes TubeFilter TubesFromSplines TubesWithVaryingRadiusAndColors WarpTo XYPlot vtkTupleInterpolator 1DTupleInterpolation TubesFromSplines vtkUndirectedGraph vtkTestGraphAlgorithmSource XGMLReader vtkUniformGrid Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse OverlappingAMR vtkUnsignedCharArray AdjacentVertexIterator AssignCellColorsFromLUT BackgroundTexture ColorCellsWithRGB ColoredAnnotatedCube ColoredElevationMap ColoredLines ColoredPoints ColorGlyphs CombineImportedActors Delaunay3D Delaunay3DDemo DepthFirstSearchAnimation ElevationFilter ExportPolyDataScene FindCellIntersections Glyph3DMapper IterativeClosestPointsTransform LandmarkTransform ShepardMethod SimpleElevationFilter TriangleColoredPoints TriangleSolidColor TubesWithVaryingRadiusAndColors VRMLImporterDemo vtkUnsignedDistance UnsignedDistance vtkUnstructuredGrid AppendFilter Blow BoxClipUnstructuredGrid Cell3DDemonstration CellPicking CellsInsideObject CellTypeSource ClipDataSetWithPolyData ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ConvexPointSet CreateESGrid DataSetSurface DataSetSurfaceFilter Delaunay3D Delaunay3DDemo DumpXMLFile ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId Finance FindCellIntersections FireFlow FireFlowDemo GenericClip GenericDataObjectReader GeometryFilter Hexahedron HighlightBadCells InterpolateFieldDataDemo IntersectLine IsoparametricCellsDemo LinearCellDemo MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MoveAVertexUnstructuredGrid NOVCAGraph PointInsideObject2 PolyDataToUnstructuredGrid Polyhedron Pyramid QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo ReadAllUnstructuredGridTypes ReadLegacyUnstructuredGrid ReadUnknownTypeXMLFile RectilinearGridToTetrahedra ScalarBarWidget SelectAVertex StructuredPointsToUnstructuredGrid TableBasedClipDataSetWithPolyData Tetrahedron ThresholdCells TissueLens UGrid VisualizeStructuredGridCells VoxelsOnBoundary WriteLegacyLinearCells WriteVTU WriteXMLLinearCells vtkUnstructuredGridReader BoxClipUnstructuredGrid ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 DataSetSurfaceFilter GeometryFilter GradientFilter MatrixMathFilter ReadAllUnstructuredGridTypes ReadLegacyUnstructuredGrid ScalarBarWidget vtkUnstructuredGridToExplicitStructuredGrid CreateESGrid LoadESGrid vtkUnstructuredGridVolumeRayCastMapper IntermixedUnstructuredGrid vtkUnstructuredGridWriter WriteLegacyLinearCells vtkValuePass RenderScalarToFloatBuffer vtkVariant ConstructTable CurvatureBandsWithGlyphs CustomDenseArray DelimitedTextWriter ElevationBandsWithGlyphs KMeansClustering LUTUtilities PickPixel PickPixel2 PKMeansClustering ReadLegacyUnstructuredGrid Variant vtkVariantArray ConstructTable CurvatureBandsWithGlyphs DelimitedTextWriter ElevationBandsWithGlyphs LUTUtilities ReadLegacyUnstructuredGrid vtkVector MultiBlockDataSet Vector vtkVector2d SurfacePlot vtkVector2f ChartMatrix vtkVector2i ChartMatrix SurfacePlot vtkVector3d AnimateActors MultiBlockDataSet Vector vtkVectorDot DisplacementPlot PlateVibration VectorDot vtkVectorNorm VectorNorm vtkVectorText AlphaFrequency AnatomicalOrientation FinanceFieldData Follower LinearExtrusion MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MarkKeypoints Morph3D MovableAxes Stocks TextOrigin VectorText vtkVersion AlignTwoPolyDatas AreaPlot BarChart BarChartQt BorderWidgetQt BozoShader BozoShaderDemo ChartMatrix ChartsOn3DScene CheckVTKVersion ColorByNormal CompositePolyDataMapper CubeMap CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo DiscreteMarchingCubes ElevationBandsWithGlyphs EventQtSlotConnect ExternalContour ExtractLargestIsosurface FrogBrain FunctionalBagPlot GenerateModelsFromLabels Hanoi HeadBone HighlightSelectedPoints HighlightSelection HyperTreeGridSource ImplicitDataSetClipping ImportPolyDataScene IsosurfaceSampling MarbleShader MarbleShaderDemo MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 MultiplePlots NullPoint OutlineGlowPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PlotLine3D PointCellIds RenderScalarToFloatBuffer RenderWindowNoUiFile RenderWindowUISingleInheritance Screenshot ShareCameraQt SideBySideRenderWindowsQt SpatterShader SphereMap SurfacePlot TissueLens ZBuffer vtkVertex DataSetSurfaceFilter GeometryFilter LinearCellDemo Vertex WriteLegacyLinearCells WriteXMLLinearCells vtkVertexGlyphFilter Actor2D AlignFrames BackgroundTexture ColoredPoints Delaunay2D DelimitedTextReader HighlightSelectedPoints ImplicitPolyDataDistance IterativeClosestPointsTransform KDTreeAccessPoints KMeansClustering LandmarkTransform MaskPoints MoveAVertexUnstructuredGrid PCADemo PKMeansClustering PointInsideObject PointInsideObject2 ProgrammableSource ReadTextFile SelectAVertex ShepardMethod SideBySideViewports TriangulateTerrainMap VertexConnectivity VertexGlyphFilter vtkViewport GradientBackground vtkViewTheme AdjacentVertexIterator ColorEdges ColorVerticesLookupTable CreateTree DepthFirstSearchAnimation ScaleVertices TreeMapView XGMLReader vtkVolume FixedPointVolumeRayCastMapperCT IntermixedUnstructuredGrid MedicalDemo4 MinIntensityRendering OpenVRVolume RayCastIsosurface SimpleRayCast vtkVolumeProperty FixedPointVolumeRayCastMapperCT IntermixedUnstructuredGrid MedicalDemo4 MinIntensityRendering OpenVRVolume RayCastIsosurface SimpleRayCast vtkVoxel Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkVoxelContoursToSurfaceFilter ContoursToSurface vtkVoxelModeller MarchingCubes vtkVRMLExporter ImportToExport vtkVRMLImporter CombineImportedActors FireFlow FireFlowDemo ImportToExport IndividualVRML VRMLImporter VRMLImporterDemo vtkWarpScalar ExponentialCosine FitToHeightMap ImageWarp InterpolateMeshOnGrid WarpCombustor WarpScalar vtkWarpTo CameraModel1 CameraModel2 WarpTo vtkWarpVector Blow DisplacementPlot PlateVibration VelocityProfile WarpSurface WarpVector vtkWedge Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkWeightedTransformFilter WeightedTransformFilter vtkWidgetCallbackMapper BorderWidget BorderWidgetQt vtkWidgetEvent BorderWidget BorderWidgetQt vtkWindow AnimateActors vtkWindowedSincPolyDataFilter FrogBrain FroggieSurface GenerateModelsFromLabels SmoothDiscreteMarchingCubes WindowedSincPolyDataFilter vtkWindowLevelLookupTable CurvedReformation FrogSlice VTKSpectrum vtkWindowToImageFilter EarthSource ExternalContour Hanoi HanoiInitial HanoiIntermediate ImageWriter OffScreenRendering ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing RenderScalarToFloatBuffer Screenshot WalkCow WalkCowA WalkCowB ZBuffer vtkWordCloud WordCloudDemo vtkWorldPointPicker WorldPointPicker vtkX3DExporter ImportToExport vtkXGMLReader XGMLReader vtkXMLCompositeDataReader DumpXMLFile vtkXMLDataSetWriter WriteXMLLinearCells vtkXMLGenericDataObjectReader ExtractFaces ReadUnknownTypeXMLFile vtkXMLImageDataReader DumpXMLFile FixedPointVolumeRayCastMapperCT ReadImageData WriteVTI vtkXMLImageDataWriter Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse ImageImport IsoContours RenderScalarToFloatBuffer StructuredDataTypes VectorFieldNonZeroExtraction WriteVTI vtkXMLMultiBlockDataReader ImportPolyDataScene vtkXMLMultiBlockDataWriter ExportPolyDataScene Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse vtkXMLPImageDataWriter XMLPImageDataWriter vtkXMLPolyDataReader AlignTwoPolyDatas AnatomicalOrientation Arbitrary3DCursor AssignCellColorsFromLUT BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CameraOrientationWidget CapClip CellCentersDemo CellsInsideObject ClipClosedSurface ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CombinePolyData CompareExtractSurface ConnectivityFilterDemo ContoursFromPolyData ConvertFile ConvexHull Curvatures CutWithCutFunction CutWithScalars DataBounds DataStructureComparison Decimation DeformPointSet Delaunay3D Delaunay3DDemo DensifyPoints DetermineArrayDataTypes DumpXMLFile EmbedPointsIntoVolume ExportPolyDataScene ExternalContour ExtractEnclosedPoints ExtractOutsideSurface ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FileOutputWindow FilledContours FillHoles FindAllArrayNames FitSplineToCutterOutput GetMiscCellData GetMiscPointData GradientBackground HiddenLineRemoval HighlightSelection IdentifyHoles ImplicitModeller ImplicitPlaneWidget2 InterpolateCamera IterativeClosestPointsTransform KDTreeFindPointsWithinRadiusDemo LabelContours LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties MiscPointData NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientationMarkerWidget1 OrientedBoundingCylinder PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataExtractNormals PolyDataIsoLines PolyDataPointSampler PolyDataRIB PolygonalSurfaceContourLineInterpolator PowercrustExtractSurface ProjectedTexture QuadricClustering QuadricDecimation RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadPolyData RemoveOutsideSurface RemoveVertices RenderLargeImage ResamplePolyLine Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation ShrinkPolyData SideBySideViewports SignedDistance Silhouette SpatterShader SphereMap SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Subdivision SubdivisionDemo SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc UnsignedDistance Visualize2DPoints VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree VisualizeVTP WarpSurface ZBuffer vtkXMLPolyDataWriter AlignFrames AssignCellColorsFromLUT ElevationFilter FindAllArrayNames GenerateModelsFromLabels ImplicitDataSetClipping InterpolateMeshOnGrid InterpolateTerrain KMeansClustering MatrixMathFilter MiscCellData PKMeansClustering PolyDataContourToImageData PolyDataIsoLines ReadPlainTextTriangles RemoveVertices SplitPolyData VectorFieldNonZeroExtraction WriteVTP vtkXMLPUnstructuredGridWriter XMLPUnstructuredGridWriter vtkXMLReader DumpXMLFile vtkXMLRectilinearGridReader DumpXMLFile ReadRectilinearGrid vtkXMLRectilinearGridWriter StructuredDataTypes vtkXMLStructuredGridReader DumpXMLFile ReadStructuredGrid vtkXMLStructuredGridWriter ImageDataToPointSet StructuredDataTypes XMLStructuredGridWriter vtkXMLTreeReader TreeMapView vtkXMLUniformGridAMRReader Generate3DAMRDataSetWithPulse vtkXMLUnstructuredGridReader DumpXMLFile FindCellIntersections FireFlow FireFlowDemo LoadESGrid ReadAllUnstructuredGridTypes ReadUnstructuredGrid WriteVTU vtkXMLUnstructuredGridWriter NOVCAGraph PolyDataToUnstructuredGrid Polyhedron RectilinearGridToTetrahedra StructuredPointsToUnstructuredGrid WriteVTU vtkXYPlotActor XYPlot"},{"location":"Cxx/DataStructures/BuildLocatorFromKClosestPoints/","title":"BuildLocatorFromKClosestPoints","text":"

vtk-examples/Cxx/DataStructures/BuildLocatorFromKClosestPoints

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/BuildLocatorFromKClosestPoints/#code","title":"Code","text":"

BuildLocatorFromKClosestPoints.cxx

#include <vtkIdList.h>\n#include <vtkKdTree.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n\nint main(int, char*[])\n{\n  // Create some points\n  double origin[3] = {0.0, 0.0, 0.0};\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(origin);\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  // Create the tree\n  vtkNew<vtkKdTree> pointTree;\n  pointTree->BuildLocatorFromPoints(points);\n\n  // Find the 2 closest points to (0.5,0,0)\n  vtkIdType k = 2;\n  double testPoint[3] = {0.5, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n\n  pointTree->FindClosestNPoints(k, testPoint, result);\n\n  for (vtkIdType i = 0; i < k; i++)\n  {\n    vtkIdType point_ind = result->GetId(i);\n    double p[3];\n    points->GetPoint(point_ind, p);\n    std::cout << \"Closest point \" << i << \": Point \" << point_ind << \": (\"\n              << p[0] << \", \" << p[1] << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/BuildLocatorFromKClosestPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BuildLocatorFromKClosestPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BuildLocatorFromKClosestPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BuildLocatorFromKClosestPoints MACOSX_BUNDLE BuildLocatorFromKClosestPoints.cxx )\n  target_link_libraries(BuildLocatorFromKClosestPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BuildLocatorFromKClosestPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/BuildLocatorFromKClosestPoints/#download-and-build-buildlocatorfromkclosestpoints","title":"Download and Build BuildLocatorFromKClosestPoints","text":"

Click here to download BuildLocatorFromKClosestPoints and its CMakeLists.txt file. Once the tarball BuildLocatorFromKClosestPoints.tar has been downloaded and extracted,

cd BuildLocatorFromKClosestPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BuildLocatorFromKClosestPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/BuildOctree/","title":"BuildOctree","text":"

vtk-examples/Cxx/DataStructures/BuildOctree

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/BuildOctree/#code","title":"Code","text":"

BuildOctree.cxx

#include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  // Setup point coordinates\n  double x[3]{1.0, 0.0, 0.0};\n  double y[3]{0.0, 1.0, 0.0};\n  double z[3]{0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n\n  for (unsigned int i = 0; i < 3; ++i)\n  {\n    points->InsertNextPoint(x[i], y[i], z[i]);\n  }\n\n  std::cout << \"There are \" << points->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetDataSet(polydata);\n  octree->BuildLocator();\n\n  std::cout << \"Number of points in tree: \"\n            << octree->GetDataSet()->GetNumberOfPoints() << std::endl;\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    octree->GetDataSet()->GetPoint(i, p);\n    std::cout << \"Point Id: \" << i << \": Point: (\" << p[0] << \", \" << p[1]\n              << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/BuildOctree/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BuildOctree)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BuildOctree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BuildOctree MACOSX_BUNDLE BuildOctree.cxx )\n  target_link_libraries(BuildOctree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BuildOctree\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/BuildOctree/#download-and-build-buildoctree","title":"Download and Build BuildOctree","text":"

Click here to download BuildOctree and its CMakeLists.txt file. Once the tarball BuildOctree.tar has been downloaded and extracted,

cd BuildOctree/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BuildOctree\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/ClosestNPoints/","title":"ClosestNPoints","text":"

vtk-examples/Cxx/DataStructures/ClosestNPoints

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/ClosestNPoints/#code","title":"Code","text":"

ClosestNPoints.cxx

#include <vtkIdList.h>\n#include <vtkKdTreePointLocator.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n\nint main(int, char*[])\n{\n  // Create some random points\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(10);\n  pointSource->Update();\n\n  // Create the tree\n  vtkNew<vtkKdTreePointLocator> pointTree;\n  pointTree->SetDataSet(pointSource->GetOutput());\n  pointTree->BuildLocator();\n\n  // Find the k closest points to (0,0,0)\n  unsigned int k = 1;\n  double testPoint[3] = {0.0, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n\n  pointTree->FindClosestNPoints(k, testPoint, result);\n\n  for (vtkIdType i = 0; i < k; i++)\n  {\n    vtkIdType point_ind = result->GetId(i);\n    double p[3];\n    pointSource->GetOutput()->GetPoint(point_ind, p);\n    std::cout << \"Closest point \" << i << \": Point \" << point_ind << \": (\"\n              << p[0] << \", \" << p[1] << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  // Should return:\n  // Closest point 0: Point 2: (-0.136162, -0.0276359, 0.0369441)\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/ClosestNPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClosestNPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClosestNPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClosestNPoints MACOSX_BUNDLE ClosestNPoints.cxx )\n  target_link_libraries(ClosestNPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClosestNPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/ClosestNPoints/#download-and-build-closestnpoints","title":"Download and Build ClosestNPoints","text":"

Click here to download ClosestNPoints and its CMakeLists.txt file. Once the tarball ClosestNPoints.tar has been downloaded and extracted,

cd ClosestNPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClosestNPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/DataStructureComparison/","title":"DataStructureComparison","text":"

vtk-examples/Cxx/DataStructures/DataStructureComparison

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/DataStructureComparison/#description","title":"Description","text":"

Prior to August 20, 2010, the vtkModifiedBSPTree.cxx did not produce a proper data representation. To operate properly, update your vtk source tree.

Use the 'n' key (for 'N'ext) and the 'p' key (for 'P'revious) to navigate the levels of the trees.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/DataStructureComparison/#code","title":"Code","text":"

DataStructureComparison.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkKdTreePointLocator.h>\n#include <vtkModifiedBSPTree.h>\n#include <vtkOBBTree.h>\n#include <vtkOctreePointLocator.h>\n\n#include <vector>\n\nnamespace {\nclass KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static KeyPressInteractorStyle* New();\n  vtkSmartPointer<vtkPolyData> data;\n  std::vector<vtkRenderer*> renderers;\n  std::vector<vtkSmartPointer<vtkLocator>> trees;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n\n  vtkSmartPointer<vtkPolyDataMapper> meshMapper;\n  vtkSmartPointer<vtkActor> meshActor;\n\n  void Initialize()\n  {\n    this->meshMapper->SetInputData(this->data);\n    for (unsigned int i = 0; i < 4; i++)\n    {\n      vtkSmartPointer<vtkPolyDataMapper> mapper =\n          vtkSmartPointer<vtkPolyDataMapper>::New();\n      this->mappers.push_back(mapper);\n      vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();\n      actor->SetMapper(mapper);\n      actor->GetProperty()->SetRepresentationToWireframe();\n      this->actors.push_back(actor);\n      this->renderers[i]->AddActor(actor);\n\n      this->renderers[i]->AddActor(meshActor);\n    }\n    this->Level = 1;\n    std::cout << \"Level = \" << this->Level << std::endl;\n    this->ReDraw();\n  }\n\n  KeyPressInteractorStyle()\n  {\n    this->Level = 1;\n\n    vtkSmartPointer<vtkLocator> tree0 =\n        vtkSmartPointer<vtkKdTreePointLocator>::New();\n    this->trees.push_back(tree0);\n    vtkSmartPointer<vtkLocator> tree1 = vtkSmartPointer<vtkOBBTree>::New();\n    this->trees.push_back(tree1);\n    vtkSmartPointer<vtkLocator> tree2 =\n        vtkSmartPointer<vtkOctreePointLocator>::New();\n    this->trees.push_back(tree2);\n    vtkSmartPointer<vtkLocator> tree3 =\n        vtkSmartPointer<vtkModifiedBSPTree>::New();\n    this->trees.push_back(tree3);\n\n    this->meshMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n    this->meshActor = vtkSmartPointer<vtkActor>::New();\n    this->meshActor->SetMapper(this->meshMapper);\n  }\n\n  virtual void OnChar()\n  {\n    char ch = this->Interactor->GetKeyCode();\n\n    switch (ch)\n    {\n    case 'n':\n      this->Level++;\n      break;\n    case 'p':\n      if (this->Level > 1)\n      {\n        this->Level--;\n      }\n      break;\n    default:\n      std::cout << \"An unhandled key was pressed.\" << std::endl;\n      break;\n    }\n\n    this->ReDraw();\n\n    // Forward events.\n    if (ch != 'p') // Don't forward the \"pick\" command.\n    {\n      vtkInteractorStyleTrackballCamera::OnChar();\n    }\n  }\n\n  void ReDraw()\n  {\n\n    std::cout << \"Level \" << this->Level << std::endl;\n    for (unsigned i = 0; i < 4; i++)\n    {\n\n      vtkSmartPointer<vtkLocator> tree = this->trees[i];\n      // vtkRenderer* renderer = this->renderers[i];\n\n      tree->SetDataSet(data);\n      tree->BuildLocator();\n\n      vtkSmartPointer<vtkPolyData> polydata =\n          vtkSmartPointer<vtkPolyData>::New();\n      std::cout << \"Tree \" << i << \" has \" << tree->GetLevel() << \" levels.\"\n                << std::endl;\n\n      if (this->Level > tree->GetLevel())\n      {\n        tree->GenerateRepresentation(tree->GetLevel(), polydata);\n      }\n      else\n      {\n        tree->GenerateRepresentation(this->Level, polydata);\n      }\n\n      this->mappers[i]->SetInputData(polydata);\n    }\n\n    this->Interactor->GetRenderWindow()->Render();\n  }\n\nprivate:\n  int Level;\n};\n\nvtkStandardNewMacro(KeyPressInteractorStyle);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkPolyData> originalMesh;\n\n  if (argc > 1) // If a file name is specified, open and use the file.\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    originalMesh->ShallowCopy(reader->GetOutput());\n  }\n  else // If a file name is not specified, create a random cloud of points.\n  {\n    vtkNew<vtkPointSource> sphereSource;\n    sphereSource->SetNumberOfPoints(1000);\n\n    sphereSource->Update();\n    originalMesh->ShallowCopy(sphereSource->GetOutput());\n  }\n\n  double numberOfViewports = 4.;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(200 * numberOfViewports, 200); //(width, height)\n  renderWindow->SetWindowName(\"DataStructureComparison\");\n\n  vtkNew<KeyPressInteractorStyle> style;\n  style->data = originalMesh;\n\n  vtkNew<vtkCamera> camera;\n\n  for (unsigned int i = 0; i < 4; i++)\n  {\n    vtkNew<vtkRenderer> renderer;\n    renderWindow->AddRenderer(renderer);\n    style->renderers.push_back(renderer);\n    renderer->SetViewport(static_cast<double>(i) / numberOfViewports, 0,\n                          static_cast<double>(i + 1) / numberOfViewports, 1);\n    renderer->SetBackground(0.2, 0.3, 0.4);\n    renderer->SetActiveCamera(camera);\n  }\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->Initialize();\n  style->renderers[0]->ResetCamera();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/DataStructureComparison/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataStructureComparison)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersFlowPaths\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataStructureComparison: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataStructureComparison MACOSX_BUNDLE DataStructureComparison.cxx )\n  target_link_libraries(DataStructureComparison PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataStructureComparison\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/DataStructureComparison/#download-and-build-datastructurecomparison","title":"Download and Build DataStructureComparison","text":"

Click here to download DataStructureComparison and its CMakeLists.txt file. Once the tarball DataStructureComparison.tar has been downloaded and extracted,

cd DataStructureComparison/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DataStructureComparison\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/IncrementalOctreePointLocator/","title":"IncrementalOctreePointLocator","text":"

vtk-examples/Cxx/DataStructures/IncrementalOctreePointLocator

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/IncrementalOctreePointLocator/#code","title":"Code","text":"

IncrementalOctreePointLocator.cxx

#include <vtkIncrementalOctreePointLocator.h>\n#include <vtkMath.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\n#include <cmath>\n\nint main(int, char*[])\n{\n  // Setup point coordinates.\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create the tree\n  vtkNew<vtkIncrementalOctreePointLocator> octree;\n  octree->SetDataSet(polydata);\n  octree->BuildLocator();\n\n  auto pointCoordinates = [](double* pt) {\n    std::cout << \"Coordinates: \" << pt[0] << \" \" << pt[1] << \" \" << pt[2]\n              << std::endl;\n  };\n  double testPoint[3] = {2.0, 0.0, 0.0};\n  std::cout << \"Test Point \";\n  pointCoordinates(testPoint);\n\n  auto closestPoint = [&octree, pointCoordinates](double* testPoint) {\n    // Find the closest points to TestPoint.\n    vtkIdType id = octree->FindClosestPoint(testPoint);\n    std::cout << \"The closest point is point \" << id << std::endl;\n\n    // Get the coordinates of the closest point.\n    double pt[3];\n    octree->GetDataSet()->GetPoint(id, pt);\n    pointCoordinates(pt);\n    std::cout << \"Distance: \"\n              << std::sqrt(vtkMath::Distance2BetweenPoints(testPoint, pt))\n              << std::endl;\n  };\n\n  closestPoint(testPoint);\n\n  // Insert another point.\n  double pnew[3] = {2.1, 0, 0};\n  octree->InsertNextPoint(pnew);\n\n  closestPoint(testPoint);\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/IncrementalOctreePointLocator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IncrementalOctreePointLocator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IncrementalOctreePointLocator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IncrementalOctreePointLocator MACOSX_BUNDLE IncrementalOctreePointLocator.cxx )\n  target_link_libraries(IncrementalOctreePointLocator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IncrementalOctreePointLocator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/IncrementalOctreePointLocator/#download-and-build-incrementaloctreepointlocator","title":"Download and Build IncrementalOctreePointLocator","text":"

Click here to download IncrementalOctreePointLocator and its CMakeLists.txt file. Once the tarball IncrementalOctreePointLocator.tar has been downloaded and extracted,

cd IncrementalOctreePointLocator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IncrementalOctreePointLocator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/KDTreeAccessPoints/","title":"KDTreeAccessPoints","text":"

vtk-examples/Cxx/DataStructures/KDTreeAccessPoints

"},{"location":"Cxx/DataStructures/KDTreeAccessPoints/#description","title":"Description","text":"

This example demonstrates how to build a KDTree, get its number of points, and get a point by ID.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/KDTreeAccessPoints/#code","title":"Code","text":"

KDTreeAccessPoints.cxx

#include <vtkDataSetCollection.h>\n#include <vtkKdTree.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  // Setup point coordinates.\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // The tree needs cells, so add vertices to each point.\n  vtkNew<vtkVertexGlyphFilter> vertexFilter;\n  vertexFilter->SetInputData(polydata);\n  vertexFilter->Update();\n\n  // Create the tree.\n  vtkNew<vtkKdTree> kDTree;\n  kDTree->AddDataSet(vertexFilter->GetOutput());\n  kDTree->BuildLocator();\n\n  // Get the number of points in the tree like this:\n  kDTree->GetDataSets()->InitTraversal();\n  std::cout << \"Number of points in tree: \"\n            << kDTree->GetDataSets()->GetNextDataSet()->GetNumberOfPoints()\n            << std::endl;\n\n  // Or you can get the number of points in the tree like this:\n  std::cout << \"Number of points in tree: \"\n            << kDTree->GetDataSet(0)->GetNumberOfPoints() << std::endl;\n\n  // Get the 0th point in the tree.\n  double p[3];\n  kDTree->GetDataSet(0)->GetPoint(0, p);\n  std::cout << \"p: \" << p[0] << \" \" << p[1] << \" \" << p[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/KDTreeAccessPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KDTreeAccessPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KDTreeAccessPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KDTreeAccessPoints MACOSX_BUNDLE KDTreeAccessPoints.cxx )\n  target_link_libraries(KDTreeAccessPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KDTreeAccessPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/KDTreeAccessPoints/#download-and-build-kdtreeaccesspoints","title":"Download and Build KDTreeAccessPoints","text":"

Click here to download KDTreeAccessPoints and its CMakeLists.txt file. Once the tarball KDTreeAccessPoints.tar has been downloaded and extracted,

cd KDTreeAccessPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KDTreeAccessPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadius/","title":"KDTreeFindPointsWithinRadius","text":"

vtk-examples/Cxx/DataStructures/KDTreeFindPointsWithinRadius

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadius/#code","title":"Code","text":"

KDTreeFindPointsWithinRadius.cxx

#include <vtkKdTreePointLocator.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n\nint main(int, char*[])\n{\n  // Create some random points.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(10);\n  pointSource->Update();\n\n  // Create the tree.\n  vtkNew<vtkKdTreePointLocator> pointTree;\n  pointTree->SetDataSet(pointSource->GetOutput());\n  pointTree->BuildLocator();\n\n  // Find the k closest points to (0,0,0).\n  vtkIdType k = 1;\n  double testPoint[3] = {0.0, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n\n  pointTree->FindPointsWithinRadius(1.0, testPoint, result);\n\n  for (vtkIdType i = 0; i < k; i++)\n  {\n    vtkIdType point_ind = result->GetId(i);\n    double p[3];\n    pointSource->GetOutput()->GetPoint(point_ind, p);\n    std::cout << \"Closest point \" << i << \": Point \" << point_ind << \": (\"\n              << p[0] << \", \" << p[1] << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadius/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KDTreeFindPointsWithinRadius)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KDTreeFindPointsWithinRadius: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KDTreeFindPointsWithinRadius MACOSX_BUNDLE KDTreeFindPointsWithinRadius.cxx )\n  target_link_libraries(KDTreeFindPointsWithinRadius PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KDTreeFindPointsWithinRadius\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadius/#download-and-build-kdtreefindpointswithinradius","title":"Download and Build KDTreeFindPointsWithinRadius","text":"

Click here to download KDTreeFindPointsWithinRadius and its CMakeLists.txt file. Once the tarball KDTreeFindPointsWithinRadius.tar has been downloaded and extracted,

cd KDTreeFindPointsWithinRadius/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KDTreeFindPointsWithinRadius\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/","title":"KDTreeFindPointsWithinRadiusDemo","text":"

vtk-examples/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/#description","title":"Description","text":"

This example uses vtkKdTreePointLocator to find all points within a given radius. The example generates \"n\" spheres and finds all the points within the radius of the spheres. The input vtkPolyData's vtkPointData is set the the radius value of each sphere.

The example takes one or two arguments. The first argument specifies the input file that contains vtkPolyData. The second optional argument specifies the number of radii use. If the number is < 6, the vtkSphereSource will be displayed as concentric translucent spheres.

The image was produced with this command:

KDTreeFindPointsWithinRadius dragon.ply 10\n

To see the translucent spheres run:

KDTreeFindPointsWithinRadius dragon.ply\n

Info

See other locator demos: OctreeFindPointsWithinRadiusDemo, StaticLocatorFindPointsWithinRadiusDemo, PointLocatorFindPointsWithinRadiusDemo

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/#code","title":"Code","text":"

KDTreeFindPointsWithinRadiusDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDoubleArray.h>\n#include <vtkIdList.h>\n#include <vtkKdTreePointLocator.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <algorithm> // For transform()\n#include <array>\n#include <cctype> // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\n// Templated join which can be used on any combination\n//  of streams, and a container of base types.\ntemplate <typename TStream, typename TContainer, typename TSeparator>\nTStream& join(TStream& stream, TContainer const& cont,\n              TSeparator const& separator)\n{\n  auto sep = false;\n  for (auto const& p : cont)\n  {\n    if (sep)\n      stream << separator;\n    else\n    {\n      sep = true;\n    }\n    stream << p;\n  }\n  // As a convenience, return a reference to the passed stream.\n  return stream;\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" dragon.ply [number of radii] \"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int numberOfRadii = 5;\n  if (argc > 2)\n  {\n    numberOfRadii = std::atoi(argv[2]);\n  }\n  // Read the polydata\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Compute bounds and range\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n  std::cout << \"Bounds: \";\n  join(std::cout, bounds, \", \") << std::endl;\n  std::array<double, 3> range;\n  range[0] = bounds[1] - bounds[0];\n  range[1] = bounds[3] - bounds[2];\n  range[2] = bounds[5] - bounds[4];\n  std::cout << \"Range: \";\n  join(std::cout, range, \", \") << std::endl;\n\n  // double maxRange = std::max({range[0], range[1], range[2]});\n  double minRange = std::min({range[0], range[1], range[2]});\n\n  // Define a sphere at one edge of bounding box\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(range[0] / 2.0 + bounds[0],\n                          range[1] / 2.0 + bounds[2], bounds[5]);\n  sphereSource->SetRadius(minRange);\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n  sphereSource->SetStartPhi(90.0);\n  sphereSource->Update();\n\n  // Initialize the locator\n  vtkNew<vtkKdTreePointLocator> pointTree;\n  pointTree->SetDataSet(polyData);\n  pointTree->BuildLocator();\n\n  // Compute the radius for each call to FindPointsWithinRadius\n  std::vector<double> radii;\n  double radiiStart = .25 * sphereSource->GetRadius();\n  double radiiEnd = 1.0 * sphereSource->GetRadius();\n  double radiiDelta = (radiiEnd - radiiStart) / (numberOfRadii - 1);\n\n  for (int r = 0; r < numberOfRadii; ++r)\n  {\n    radii.push_back(radiiStart + radiiDelta * r);\n  }\n\n  // Create an array to hold the scalar point data\n  vtkNew<vtkDoubleArray> scalars;\n  scalars->SetNumberOfComponents(1);\n  scalars->SetNumberOfTuples(polyData->GetNumberOfPoints());\n  scalars->FillComponent(0, 0.0);\n\n  // Process each radii from largest to smallest\n  for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n       rIter != radii.rend(); ++rIter)\n  {\n    vtkNew<vtkIdList> result;\n    pointTree->FindPointsWithinRadius(*rIter, sphereSource->GetCenter(),\n                                      result);\n    vtkIdType k = result->GetNumberOfIds();\n    std::cout << k << \" points within \" << *rIter << \" of \"\n              << sphereSource->GetCenter()[0] << \", \"\n              << sphereSource->GetCenter()[1] << \", \"\n              << sphereSource->GetCenter()[2] << std::endl;\n    // Store the distance in the points withnin the current radius\n    for (vtkIdType i = 0; i < k; i++)\n    {\n      vtkIdType point_ind = result->GetId(i);\n      scalars->SetTuple1(point_ind, *rIter);\n    }\n  }\n  polyData->GetPointData()->SetScalars(scalars);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(.667, 0.0);\n  lut->SetNumberOfTableValues(radii.size() + 1);\n  lut->SetRange(*radii.begin(), *radii.rbegin());\n  lut->Build();\n\n  // Create a transluscent sphere for each radii\n  if (radii.size() < 6)\n  {\n    for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n         rIter != radii.rend(); ++rIter)\n    {\n      vtkNew<vtkSphereSource> radiiSource;\n      radiiSource->SetPhiResolution(31);\n      radiiSource->SetThetaResolution(31);\n      radiiSource->SetStartPhi(90.0);\n      radiiSource->SetRadius(*rIter);\n      radiiSource->SetCenter(range[0] / 2.0 + bounds[0],\n                             range[1] / 2.0 + bounds[2], bounds[5]);\n\n      vtkNew<vtkPolyDataMapper> radiiMapper;\n      radiiMapper->SetInputConnection(radiiSource->GetOutputPort());\n\n      vtkNew<vtkProperty> backProp;\n      backProp->SetDiffuseColor(colors->GetColor3d(\"LightGrey\").GetData());\n\n      vtkNew<vtkActor> radiiActor;\n      radiiActor->SetMapper(radiiMapper);\n      radiiActor->GetProperty()->SetDiffuseColor(\n          colors->GetColor3d(\"White\").GetData());\n      radiiActor->GetProperty()->SetOpacity(.1);\n      radiiActor->SetBackfaceProperty(backProp);\n\n      renderer->AddActor(radiiActor);\n    }\n  }\n\n  // Display the original poly data\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(*radii.begin(), *radii.rbegin());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  renderWindow->SetWindowName(\"KDTreeFindPointsWithinRadiusDemo\");\n  renderWindow->Render();\n\n  // Pick a good view\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KDTreeFindPointsWithinRadiusDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KDTreeFindPointsWithinRadiusDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KDTreeFindPointsWithinRadiusDemo MACOSX_BUNDLE KDTreeFindPointsWithinRadiusDemo.cxx )\n  target_link_libraries(KDTreeFindPointsWithinRadiusDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KDTreeFindPointsWithinRadiusDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/#download-and-build-kdtreefindpointswithinradiusdemo","title":"Download and Build KDTreeFindPointsWithinRadiusDemo","text":"

Click here to download KDTreeFindPointsWithinRadiusDemo and its CMakeLists.txt file. Once the tarball KDTreeFindPointsWithinRadiusDemo.tar has been downloaded and extracted,

cd KDTreeFindPointsWithinRadiusDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KDTreeFindPointsWithinRadiusDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/KDTreeTimingDemo/","title":"KDTreeTimingDemo","text":"

vtk-examples/Cxx/DataStructures/KDTreeTimingDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/KDTreeTimingDemo/#description","title":"Description","text":"

Your timing graph will be different when compared to the above illustration.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/KDTreeTimingDemo/#code","title":"Code","text":"

KDTreeTimingDemo.cxx

#include <vtkAxis.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkKdTreePointLocator.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTable.h>\n#include <vtkTimerLog.h>\n\n#include <time.h>\n#include <vector>\n\nnamespace {\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng);\n\ndouble TimeKDTree(vtkPolyData* polydata, int maxPoints, int numberOfTrials,\n                  vtkMinimalStandardRandomSequence* rng);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> reader;\n  reader->SetThetaResolution(30);\n  reader->SetPhiResolution(30);\n  reader->Update();\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  std::cout << \"Timing KD tree...\" << std::endl;\n  std::vector<std::pair<int, double>> results;\n  int numberOfTrials = 1000;\n  for (int i = 1; i < 20; i++)\n  {\n    double t = TimeKDTree(reader->GetOutput(), i, numberOfTrials, rng);\n    std::pair<int, double> result(i, t);\n    results.push_back(result);\n  }\n\n  // Create a table with some points in it\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> maxPointsPerRegion;\n  maxPointsPerRegion->SetName(\"MaxPointsPerRegion\");\n  table->AddColumn(maxPointsPerRegion);\n\n  vtkNew<vtkFloatArray> runtime;\n  runtime->SetName(\"Run time\");\n  table->AddColumn(runtime);\n\n  // Fill in the table with some example values\n  size_t numPoints = results.size();\n  table->SetNumberOfRows(static_cast<vtkIdType>(numPoints));\n  for (size_t i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(static_cast<vtkIdType>(i), 0, results[i].first);\n    table->SetValue(static_cast<vtkIdType>(i), 1, results[i].second);\n    std::cout << \"Put \" << results[i].first << \" \" << results[i].second\n              << \" in the table.\" << std::endl;\n  }\n\n  // Set up the view\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"White\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"KDTreeTimingDemo\");\n\n  // Add multiple line plots, setting the colors etc\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  vtkPlot* line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 1);\n  auto lineColor = colors->HTMLColorToRGBA(\"Lime\").GetData();\n  line->SetColor(lineColor[0], lineColor[1], lineColor[2], lineColor[3]);\n  line->SetWidth(3.0);\n  line->GetXAxis()->SetTitle(\"Max Points Per Region\");\n  line->GetYAxis()->SetTitle(\"Run time\");\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n\n  // Start interactor\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  for (auto i = 0; i < 3; ++i)\n  {\n    p[i] = bounds[i * 2] +\n        (bounds[i * 2 + 1] - bounds[i * 2]) * rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n}\n\ndouble TimeKDTree(vtkPolyData* polydata, int maxLevel, int numberOfTrials,\n                  vtkMinimalStandardRandomSequence* rng)\n{\n  vtkNew<vtkTimerLog> timer;\n  timer->StartTimer();\n\n  // Create the tree\n  vtkNew<vtkKdTreePointLocator> kdtree;\n  kdtree->SetDataSet(polydata);\n  kdtree->AutomaticOff();\n  kdtree->SetMaxLevel(maxLevel);\n  kdtree->BuildLocator();\n\n  for (int i = 0; i < numberOfTrials; i++)\n  {\n    double p[3];\n    RandomPointInBounds(polydata, p, rng);\n    kdtree->FindClosestPoint(p);\n  }\n\n  timer->StopTimer();\n\n  std::cout << \"KDTree took \" << timer->GetElapsedTime() << std::endl;\n\n  return timer->GetElapsedTime();\n}\n} // namespace\n
"},{"location":"Cxx/DataStructures/KDTreeTimingDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KDTreeTimingDemo)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonSystem\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KDTreeTimingDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KDTreeTimingDemo MACOSX_BUNDLE KDTreeTimingDemo.cxx )\n  target_link_libraries(KDTreeTimingDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KDTreeTimingDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/KDTreeTimingDemo/#download-and-build-kdtreetimingdemo","title":"Download and Build KDTreeTimingDemo","text":"

Click here to download KDTreeTimingDemo and its CMakeLists.txt file. Once the tarball KDTreeTimingDemo.tar has been downloaded and extracted,

cd KDTreeTimingDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KDTreeTimingDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/KdTree/","title":"KdTree","text":"

vtk-examples/Cxx/DataStructures/KdTree

"},{"location":"Cxx/DataStructures/KdTree/#description","title":"Description","text":"

This example demonstrates how to use vtkKdTree to build a tree from a vtkPoints object. Note that since AddDataSet or SetDataSet were not called, you cannot use GetDataSet.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/KdTree/#code","title":"Code","text":"

KdTree.cxx

#include <vtkDataSetCollection.h>\n#include <vtkKdTree.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n\nint main(int, char*[])\n{\n  // Setup point coordinates.\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  // Create the tree\n  vtkNew<vtkKdTree> kDTree;\n  kDTree->BuildLocatorFromPoints(points);\n\n  double testPoint[3] = {2.0, 0.0, 0.0};\n\n  auto pointCoordinates = [](double* pt) {\n    std::cout << \"Coordinates: \" << pt[0] << \" \" << pt[1] << \" \" << pt[2]\n              << std::endl;\n  };\n\n  // Find the closest point to TestPoint.\n  double closestPointDist;\n  vtkIdType id = kDTree->FindClosestPoint(\n      testPoint, closestPointDist); // vtkKdTree::FindClosestPoint: must build\n                                    // locator first\n  std::cout << \"Test Point \";\n  pointCoordinates(testPoint);\n  std::cout << \"The closest point is point \" << id << std::endl;\n  // Get the closest point in the KD Tree from the point data.\n  std::cout << \"Closest point \";\n  pointCoordinates(points->GetPoint(id));\n  std::cout << \"Distance: \" << closestPointDist << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/KdTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KdTree)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KdTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KdTree MACOSX_BUNDLE KdTree.cxx )\n  target_link_libraries(KdTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KdTree\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/KdTree/#download-and-build-kdtree","title":"Download and Build KdTree","text":"

Click here to download KdTree and its CMakeLists.txt file. Once the tarball KdTree.tar has been downloaded and extracted,

cd KdTree/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KdTree\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/KdTreePointLocatorClosestPoint/","title":"KdTreePointLocatorClosestPoint","text":"

vtk-examples/Cxx/DataStructures/KdTreePointLocatorClosestPoint

"},{"location":"Cxx/DataStructures/KdTreePointLocatorClosestPoint/#description","title":"Description","text":"

This example creates a set of three points, builds a KDTree from them, then demonstrates how to find the closest point to a query point.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/KdTreePointLocatorClosestPoint/#code","title":"Code","text":"

KdTreePointLocatorClosestPoint.cxx

#include <vtkKdTreePointLocator.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  // Setup point coordinates\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create the tree\n  vtkNew<vtkKdTreePointLocator> kDTree;\n  kDTree->SetDataSet(polydata);\n  kDTree->BuildLocator();\n\n  double testPoint[3] = {2.0, 0.0, 0.0};\n\n  // Find the closest points to TestPoint\n  vtkIdType iD = kDTree->FindClosestPoint(testPoint);\n  std::cout << \"The closest point is point \" << iD << std::endl;\n\n  // Get the coordinates of the closest point\n  double closestPoint[3];\n  kDTree->GetDataSet()->GetPoint(iD, closestPoint);\n  std::cout << \"Coordinates: \" << closestPoint[0] << \" \" << closestPoint[1]\n            << \" \" << closestPoint[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/KdTreePointLocatorClosestPoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KdTreePointLocatorClosestPoint)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KdTreePointLocatorClosestPoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KdTreePointLocatorClosestPoint MACOSX_BUNDLE KdTreePointLocatorClosestPoint.cxx )\n  target_link_libraries(KdTreePointLocatorClosestPoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KdTreePointLocatorClosestPoint\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/KdTreePointLocatorClosestPoint/#download-and-build-kdtreepointlocatorclosestpoint","title":"Download and Build KdTreePointLocatorClosestPoint","text":"

Click here to download KdTreePointLocatorClosestPoint and its CMakeLists.txt file. Once the tarball KdTreePointLocatorClosestPoint.tar has been downloaded and extracted,

cd KdTreePointLocatorClosestPoint/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KdTreePointLocatorClosestPoint\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/ModifiedBSPTreeExtractCells/","title":"ModifiedBSPTreeExtractCells","text":"

vtk-examples/Cxx/DataStructures/ModifiedBSPTreeExtractCells

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/ModifiedBSPTreeExtractCells/#code","title":"Code","text":"

ModifiedBSPTreeExtractCells.cxx

#include <vtkExtractCells.h>\n#include <vtkIdList.h>\n#include <vtkLineSource.h>\n#include <vtkModifiedBSPTree.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkSphereSource.h>\n\n#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(7);\n  sphereSource->SetThetaResolution(15);\n  sphereSource->Update();\n\n  // Create the locator\n  vtkNew<vtkModifiedBSPTree> tree;\n  tree->SetDataSet(sphereSource->GetOutput());\n\n  // Intersect the locator with the line\n  double lineP0[3] = {-0.6, -0.6, -0.6};\n  double lineP1[3] = {0.6, 0.6, 0.6};\n  vtkNew<vtkPoints> intersectPoints;\n\n  vtkNew<vtkIdList> intersectCells;\n\n  double tol = 1.0e-8;\n  tree->IntersectWithLine(lineP0, lineP1, tol, intersectPoints, intersectCells);\n\n  std::cout << \"NumPoints: \" << intersectPoints->GetNumberOfPoints()\n            << std::endl;\n\n  // Display list of intersections\n  double intersection[3];\n  for (int i = 0; i < intersectPoints->GetNumberOfPoints(); i++)\n  {\n    intersectPoints->GetPoint(i, intersection);\n    std::cout << \"\\tPoint Intersection \" << i << \": \" << intersection[0] << \", \"\n              << intersection[1] << \", \" << intersection[2] << std::endl;\n  }\n\n  std::cout << \"NumCells: \" << intersectCells->GetNumberOfIds() << std::endl;\n\n  vtkIdType cellId;\n  for (int i = 0; i < intersectCells->GetNumberOfIds(); i++)\n  {\n    cellId = intersectCells->GetId(i);\n    std::cout << \"\\tCellId \" << i << \": \" << cellId << std::endl;\n  }\n\n  // Render the line, sphere and intersected cells\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(lineP0);\n  lineSource->SetPoint2(lineP1);\n\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(lineSource->GetOutputPort());\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetRepresentationToWireframe();\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkExtractCells> cellSource;\n  cellSource->SetInputConnection(sphereSource->GetOutputPort());\n  cellSource->SetCellList(intersectCells);\n\n  vtkNew<vtkDataSetMapper> cellMapper;\n  cellMapper->SetInputConnection(cellSource->GetOutputPort());\n  vtkNew<vtkActor> cellActor;\n  cellActor->SetMapper(cellMapper);\n  cellActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(lineActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(cellActor);\n  renderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  renderWindow->SetWindowName(\"ModifiedBSPTreeExtractCells\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/ModifiedBSPTreeExtractCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ModifiedBSPTreeExtractCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersFlowPaths\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ModifiedBSPTreeExtractCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ModifiedBSPTreeExtractCells MACOSX_BUNDLE ModifiedBSPTreeExtractCells.cxx )\n  target_link_libraries(ModifiedBSPTreeExtractCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ModifiedBSPTreeExtractCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/ModifiedBSPTreeExtractCells/#download-and-build-modifiedbsptreeextractcells","title":"Download and Build ModifiedBSPTreeExtractCells","text":"

Click here to download ModifiedBSPTreeExtractCells and its CMakeLists.txt file. Once the tarball ModifiedBSPTreeExtractCells.tar has been downloaded and extracted,

cd ModifiedBSPTreeExtractCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ModifiedBSPTreeExtractCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine/","title":"ModifiedBSPTreeIntersectWithLine","text":"

vtk-examples/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine/#code","title":"Code","text":"

ModifiedBSPTreeIntersectWithLine.cxx

#include <vtkModifiedBSPTree.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create the tree\n  vtkNew<vtkModifiedBSPTree> bspTree;\n  bspTree->SetDataSet(sphereSource->GetOutput());\n  bspTree->BuildLocator();\n\n  // Inputs\n  double p1[3] = {-2, 0, 0};\n  double p2[3] = {2, 0, 0};\n  double tolerance = .001;\n\n  // Outputs\n  double t; // Parametric coordinate of intersection (0 (corresponding to p1) to\n            // 1 (corresponding to p2)).\n  double x[3]; // The coordinate of the intersection.\n  double pcoords[3];\n  int subId;\n\n  // Note: For a typical use case (ray-triangle intersection), pcoords and subId\n  // will not be used.\n  vtkIdType iD =\n      bspTree->IntersectWithLine(p1, p2, tolerance, t, x, pcoords, subId);\n\n  std::cout << \"iD: \" << iD << std::endl;\n  std::cout << \"t: \" << t << std::endl;\n  std::cout << \"x: \" << x[0] << \" \" << x[1] << \" \" << x[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ModifiedBSPTreeIntersectWithLine)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersFlowPaths\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ModifiedBSPTreeIntersectWithLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ModifiedBSPTreeIntersectWithLine MACOSX_BUNDLE ModifiedBSPTreeIntersectWithLine.cxx )\n  target_link_libraries(ModifiedBSPTreeIntersectWithLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ModifiedBSPTreeIntersectWithLine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine/#download-and-build-modifiedbsptreeintersectwithline","title":"Download and Build ModifiedBSPTreeIntersectWithLine","text":"

Click here to download ModifiedBSPTreeIntersectWithLine and its CMakeLists.txt file. Once the tarball ModifiedBSPTreeIntersectWithLine.tar has been downloaded and extracted,

cd ModifiedBSPTreeIntersectWithLine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ModifiedBSPTreeIntersectWithLine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/ModifiedBSPTreeTimingDemo/","title":"ModifiedBSPTreeTimingDemo","text":"

vtk-examples/Cxx/DataStructures/ModifiedBSPTreeTimingDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/ModifiedBSPTreeTimingDemo/#description","title":"Description","text":"

Your timing graph will be different when compared to the above illustration.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/ModifiedBSPTreeTimingDemo/#code","title":"Code","text":"

ModifiedBSPTreeTimingDemo.cxx

#include <vtkAxis.h>\n#include <vtkBox.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkModifiedBSPTree.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTable.h>\n#include <vtkTimerLog.h>\n\n#include <time.h>\n#include <vector>\n\nnamespace {\n\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng);\nvoid RandomDirection(double v[3], vtkMinimalStandardRandomSequence* rng);\nvoid RandomLineThroughVolume(vtkPolyData* polydata, double p1[3], double p2[3],\n                             vtkMinimalStandardRandomSequence* rng);\n\ndouble TimeModifiedBSPTree(vtkPolyData* polydata, int maxPoints,\n                           int numberOfTrials,\n                           vtkMinimalStandardRandomSequence* rng);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> reader;\n  reader->SetThetaResolution(30);\n  reader->SetPhiResolution(30);\n  reader->Update();\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  std::cout << \"Timing ModifiedBSPTree...\" << std::endl;\n  std::vector<std::pair<int, double>> results;\n  int numberOfTrials = 1000;\n  for (int i = 1; i < 20; i++)\n  {\n    double t = TimeModifiedBSPTree(reader->GetOutput(), i, numberOfTrials, rng);\n    std::pair<int, double> result(i, t);\n    results.push_back(result);\n  }\n\n  // Create a table with some points in it.\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> maxPointsPerRegion;\n  maxPointsPerRegion->SetName(\"MaxPointsPerRegion\");\n  table->AddColumn(maxPointsPerRegion);\n\n  vtkNew<vtkFloatArray> runtime;\n  runtime->SetName(\"Run time\");\n  table->AddColumn(runtime);\n\n  // Fill in the table with some example values.\n  size_t numPoints = results.size();\n  table->SetNumberOfRows(static_cast<vtkIdType>(numPoints));\n  for (size_t i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(static_cast<vtkIdType>(i), 0, results[i].first);\n    table->SetValue(static_cast<vtkIdType>(i), 1, results[i].second);\n    std::cout << \"Put \" << results[i].first << \" \" << results[i].second\n              << \" in the table.\" << std::endl;\n  }\n\n  // Set up the view\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"White\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"ModifiedBSPTreeTimingDemo\");\n\n  // Add multiple line plots, setting the colors etc.\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  vtkPlot* line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 1);\n  auto lineColor = colors->HTMLColorToRGBA(\"Lime\").GetData();\n  line->SetColor(lineColor[0], lineColor[1], lineColor[2], lineColor[3]);\n  line->SetWidth(3.0);\n  line->GetXAxis()->SetTitle(\"Max Points Per Region\");\n  line->GetYAxis()->SetTitle(\"Run time\");\n  // line->GetYAxis()->AutoScale();\n  // line->GetYAxis()->SetRange(0,0.02);\n\n  // Start interactor\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  for (auto i = 0; i < 3; ++i)\n  {\n    p[i] = bounds[i * 2] +\n        (bounds[i * 2 + 1] - bounds[i * 2]) * rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n}\n\ndouble TimeModifiedBSPTree(vtkPolyData* polydata, int maxLevel,\n                           int numberOfTrials,\n                           vtkMinimalStandardRandomSequence* rng)\n{\n  vtkNew<vtkTimerLog> timer;\n  timer->StartTimer();\n\n  // Create the tree\n  vtkNew<vtkModifiedBSPTree> modifiedBSPTree;\n  modifiedBSPTree->SetDataSet(polydata);\n  modifiedBSPTree->AutomaticOff();\n  modifiedBSPTree->SetMaxLevel(maxLevel);\n  // modifiedBSPTree->SetNumberOfCellsPerNode(cellsPerNode);\n  modifiedBSPTree->BuildLocator();\n\n  for (int i = 0; i < numberOfTrials; i++)\n  {\n    double p1[3];\n    double p2[3];\n    RandomLineThroughVolume(polydata, p1, p2, rng);\n\n    double t;\n    double x[3];\n    double pcoords[3];\n    int subId;\n    modifiedBSPTree->IntersectWithLine(p1, p2, 0.001, t, x, pcoords, subId);\n  }\n\n  timer->StopTimer();\n\n  std::cout << \"ModifiedBSPTree took \" << timer->GetElapsedTime() << std::endl;\n\n  return timer->GetElapsedTime();\n}\n\nvoid RandomLineThroughVolume(vtkPolyData* polydata, double p1[3], double p2[3],\n                             vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  double p[3];\n  RandomPointInBounds(polydata, p, rng);\n\n  double v[3];\n  RandomDirection(v, rng);\n\n  double lineP1[3];\n  double lineP2[3];\n\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    p1[i] = p[i] + 1000 * v[i];\n    p2[i] = p[i] - 1000 * v[i];\n  }\n\n  double t1, t2;\n  int plane1, plane2;\n  vtkBox::IntersectWithLine(bounds, lineP1, lineP2, t1, t2, p1, p2, plane1,\n                            plane2);\n}\n\nvoid RandomDirection(double v[3], vtkMinimalStandardRandomSequence* rng)\n{\n  for (auto i = 0; i < 3; ++i)\n  {\n    v[i] = rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n  vtkMath::Normalize(v);\n}\n} // namespace\n
"},{"location":"Cxx/DataStructures/ModifiedBSPTreeTimingDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ModifiedBSPTreeTimingDemo)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonSystem\n  FiltersFlowPaths\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ModifiedBSPTreeTimingDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ModifiedBSPTreeTimingDemo MACOSX_BUNDLE ModifiedBSPTreeTimingDemo.cxx )\n  target_link_libraries(ModifiedBSPTreeTimingDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ModifiedBSPTreeTimingDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/ModifiedBSPTreeTimingDemo/#download-and-build-modifiedbsptreetimingdemo","title":"Download and Build ModifiedBSPTreeTimingDemo","text":"

Click here to download ModifiedBSPTreeTimingDemo and its CMakeLists.txt file. Once the tarball ModifiedBSPTreeTimingDemo.tar has been downloaded and extracted,

cd ModifiedBSPTreeTimingDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ModifiedBSPTreeTimingDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/OBBTreeExtractCells/","title":"OBBTreeExtractCells","text":"

vtk-examples/Cxx/DataStructures/OBBTreeExtractCells

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/OBBTreeExtractCells/#code","title":"Code","text":"

OBBTreeExtractCells.cxx

#include <vtkExtractCells.h>\n#include <vtkIdList.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkPoints.h>\n#include <vtkSphereSource.h>\n\n#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(7);\n  sphereSource->SetThetaResolution(15);\n  sphereSource->Update();\n\n  // Create the locator\n  vtkNew<vtkOBBTree> tree;\n  tree->SetDataSet(sphereSource->GetOutput());\n  tree->BuildLocator();\n\n  // Intersect the locator with the line\n  double lineP0[3] = {-0.6, -0.6, -0.6};\n  double lineP1[3] = {.6, .6, .6};\n  vtkNew<vtkPoints> intersectPoints;\n\n  vtkNew<vtkIdList> intersectCells;\n\n  double tol = 1.e-8;\n  tree->SetTolerance(tol);\n  tree->IntersectWithLine(lineP0, lineP1, intersectPoints, intersectCells);\n\n  std::cout << \"NumPoints: \" << intersectPoints->GetNumberOfPoints()\n            << std::endl;\n\n  // Display list of intersections.\n  double intersection[3];\n  for (int i = 0; i < intersectPoints->GetNumberOfPoints(); i++)\n  {\n    intersectPoints->GetPoint(i, intersection);\n    std::cout << \"\\tPoint Intersection \" << i << \": \" << intersection[0] << \", \"\n              << intersection[1] << \", \" << intersection[2] << std::endl;\n  }\n\n  std::cout << \"NumCells: \" << intersectCells->GetNumberOfIds() << std::endl;\n\n  vtkIdType cellId;\n  for (int i = 0; i < intersectCells->GetNumberOfIds(); i++)\n  {\n    cellId = intersectCells->GetId(i);\n    std::cout << \"\\tCellId \" << i << \": \" << cellId << std::endl;\n  }\n\n  // Render the line, sphere and intersected cells.\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(lineP0);\n  lineSource->SetPoint2(lineP1);\n\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(lineSource->GetOutputPort());\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetRepresentationToWireframe();\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkExtractCells> cellSource;\n  cellSource->SetInputConnection(sphereSource->GetOutputPort());\n  cellSource->SetCellList(intersectCells);\n\n  vtkNew<vtkDataSetMapper> cellMapper;\n  cellMapper->SetInputConnection(cellSource->GetOutputPort());\n  vtkNew<vtkActor> cellActor;\n  cellActor->SetMapper(cellMapper);\n  cellActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(lineActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(cellActor);\n  renderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  renderWindow->SetWindowName(\"OBBTreeExtractCells\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/OBBTreeExtractCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OBBTreeExtractCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OBBTreeExtractCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OBBTreeExtractCells MACOSX_BUNDLE OBBTreeExtractCells.cxx )\n  target_link_libraries(OBBTreeExtractCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OBBTreeExtractCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/OBBTreeExtractCells/#download-and-build-obbtreeextractcells","title":"Download and Build OBBTreeExtractCells","text":"

Click here to download OBBTreeExtractCells and its CMakeLists.txt file. Once the tarball OBBTreeExtractCells.tar has been downloaded and extracted,

cd OBBTreeExtractCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OBBTreeExtractCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/OBBTreeIntersectWithLine/","title":"OBBTreeIntersectWithLine","text":"

vtk-examples/Cxx/DataStructures/OBBTreeIntersectWithLine

"},{"location":"Cxx/DataStructures/OBBTreeIntersectWithLine/#description","title":"Description","text":"

vtkOBBTree returns ALL intersections with a line and the dataset. If you want the closest intersection, you must manually find it. In this example, we create a sphere and intersect a single line with it.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/OBBTreeIntersectWithLine/#code","title":"Code","text":"

OBBTreeIntersectWithLine.cxx

#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkPoints.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create the locator\n  vtkNew<vtkOBBTree> tree;\n  tree->SetDataSet(sphereSource->GetOutput());\n  tree->BuildLocator();\n\n  // Intersect the locator with the line\n  double lineP0[3] = {0.0, 0.0, 0.0};\n  double lineP1[3] = {0.0, 0.0, 2.0};\n  vtkNew<vtkPoints> intersectPoints;\n\n  tree->IntersectWithLine(lineP0, lineP1, intersectPoints, NULL);\n\n  std::cout << \"NumPoints: \" << intersectPoints->GetNumberOfPoints()\n            << std::endl;\n\n  // Display list of intersections.\n  double intersection[3];\n  for (int i = 0; i < intersectPoints->GetNumberOfPoints(); i++)\n  {\n    intersectPoints->GetPoint(i, intersection);\n    std::cout << \"Intersection \" << i << \": \" << intersection[0] << \", \"\n              << intersection[1] << \", \" << intersection[2] << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/OBBTreeIntersectWithLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OBBTreeIntersectWithLine)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersGeneral\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OBBTreeIntersectWithLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OBBTreeIntersectWithLine MACOSX_BUNDLE OBBTreeIntersectWithLine.cxx )\n  target_link_libraries(OBBTreeIntersectWithLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OBBTreeIntersectWithLine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/OBBTreeIntersectWithLine/#download-and-build-obbtreeintersectwithline","title":"Download and Build OBBTreeIntersectWithLine","text":"

Click here to download OBBTreeIntersectWithLine and its CMakeLists.txt file. Once the tarball OBBTreeIntersectWithLine.tar has been downloaded and extracted,

cd OBBTreeIntersectWithLine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OBBTreeIntersectWithLine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/OBBTreeTimingDemo/","title":"OBBTreeTimingDemo","text":"

vtk-examples/Cxx/DataStructures/OBBTreeTimingDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/OBBTreeTimingDemo/#description","title":"Description","text":"

Your timing graph will be different when compared to the above illustration.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/OBBTreeTimingDemo/#code","title":"Code","text":"

OBBTreeTimingDemo.cxx

#include <vtkAxis.h>\n#include <vtkBox.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkPlot.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTable.h>\n#include <vtkTimerLog.h>\n\n#include <time.h>\n#include <vector>\n\nnamespace {\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng);\nvoid RandomDirection(double v[3], vtkMinimalStandardRandomSequence* rng);\nvoid RandomLineThroughVolume(vtkPolyData* polydata, double p1[3], double p2[3],\n                             vtkMinimalStandardRandomSequence* rng);\n\ndouble TimeOBBTree(vtkPolyData* polydata, int maxPoints, int numberOfTrials,\n                   vtkMinimalStandardRandomSequence* rng);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> reader;\n  reader->SetThetaResolution(30);\n  reader->SetPhiResolution(30);\n  reader->Update();\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  std::cout << \"Timing OBBTree...\" << std::endl;\n  std::vector<std::pair<int, double>> results;\n  int numberOfTrials = 100;\n  for (int i = 1; i < 20; i++)\n  {\n    double t = TimeOBBTree(reader->GetOutput(), i, numberOfTrials, rng);\n    std::pair<int, double> result(i, t);\n    results.push_back(result);\n  }\n\n  // Create a table with some points in it.\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> maxPointsPerRegion;\n  maxPointsPerRegion->SetName(\"MaxPointsPerRegion\");\n  table->AddColumn(maxPointsPerRegion);\n\n  vtkNew<vtkFloatArray> runtime;\n  runtime->SetName(\"Run time\");\n  table->AddColumn(runtime);\n\n  // Fill in the table with some example values.\n  size_t numPoints = results.size();\n  table->SetNumberOfRows(static_cast<vtkIdType>(numPoints));\n  for (size_t i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(static_cast<vtkIdType>(i), 0, results[i].first);\n    table->SetValue(static_cast<vtkIdType>(i), 1, results[i].second);\n    std::cout << \"Put \" << results[i].first << \" \" << results[i].second\n              << \" in the table.\" << std::endl;\n  }\n\n  // Set up the view\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"White\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"OBBTreeTimingDemo\");\n\n  // Add multiple line plots, setting the colors etc.\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  vtkPlot* line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 1);\n  auto lineColor = colors->HTMLColorToRGBA(\"Lime\").GetData();\n  line->SetColor(lineColor[0], lineColor[1], lineColor[2], lineColor[3]);\n  line->SetWidth(3.0);\n  line->GetXAxis()->SetTitle(\"Max Points Per Region\");\n  line->GetYAxis()->SetTitle(\"Run time\");\n  // line->GetYAxis()->AutoScale();\n  // line->GetYAxis()->SetRange(0,0.02);\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n\n  // Start interactor\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  for (auto i = 0; i < 3; ++i)\n  {\n    p[i] = bounds[i * 2] +\n        (bounds[i * 2 + 1] - bounds[i * 2]) * rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n}\n\ndouble TimeOBBTree(vtkPolyData* polydata, int maxLevel, int numberOfTrials,\n                   vtkMinimalStandardRandomSequence* rng)\n{\n  vtkNew<vtkTimerLog> timer;\n  timer->StartTimer();\n\n  // Create the tree\n  vtkNew<vtkOBBTree> obbTree;\n  obbTree->SetDataSet(polydata);\n  obbTree->AutomaticOff();\n  obbTree->SetMaxLevel(maxLevel);\n  obbTree->BuildLocator();\n\n  for (int i = 0; i < numberOfTrials; i++)\n  {\n    double p1[3];\n    double p2[3];\n    RandomLineThroughVolume(polydata, p1, p2, rng);\n\n    double t;\n    double x[3];\n    double pcoords[3];\n    int subId;\n    obbTree->IntersectWithLine(p1, p2, .001, t, x, pcoords, subId);\n  }\n\n  timer->StopTimer();\n\n  std::cout << \"OBBTree took \" << timer->GetElapsedTime() << std::endl;\n\n  return timer->GetElapsedTime();\n}\n\nvoid RandomLineThroughVolume(vtkPolyData* polydata, double p1[3], double p2[3],\n                             vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  double p[3];\n  RandomPointInBounds(polydata, p, rng);\n\n  double v[3];\n  RandomDirection(v, rng);\n\n  double lineP1[3];\n  double lineP2[3];\n\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    p1[i] = p[i] + 1000 * v[i];\n    p2[i] = p[i] - 1000 * v[i];\n  }\n\n  double t1, t2;\n  int plane1, plane2;\n  vtkBox::IntersectWithLine(bounds, lineP1, lineP2, t1, t2, p1, p2, plane1,\n                            plane2);\n}\n\nvoid RandomDirection(double v[3], vtkMinimalStandardRandomSequence* rng)\n{\n  for (auto i = 0; i < 3; ++i)\n  {\n    v[i] = rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n  vtkMath::Normalize(v);\n}\n\n} // namespace\n
"},{"location":"Cxx/DataStructures/OBBTreeTimingDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OBBTreeTimingDemo)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonSystem\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OBBTreeTimingDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OBBTreeTimingDemo MACOSX_BUNDLE OBBTreeTimingDemo.cxx )\n  target_link_libraries(OBBTreeTimingDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OBBTreeTimingDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/OBBTreeTimingDemo/#download-and-build-obbtreetimingdemo","title":"Download and Build OBBTreeTimingDemo","text":"

Click here to download OBBTreeTimingDemo and its CMakeLists.txt file. Once the tarball OBBTreeTimingDemo.tar has been downloaded and extracted,

cd OBBTreeTimingDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OBBTreeTimingDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/OctreeClosestPoint/","title":"OctreeClosestPoint","text":"

vtk-examples/Cxx/DataStructures/OctreeClosestPoint

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/OctreeClosestPoint/#code","title":"Code","text":"

OctreeClosestPoint.cxx

#include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  // Setup point coordinates.\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetDataSet(polydata);\n  octree->BuildLocator();\n\n  double testPoint[3] = {2.0, 0.0, 0.0};\n\n  // Find the closest points to TestPoint.\n  vtkIdType iD = octree->FindClosestPoint(testPoint);\n  std::cout << \"The closest point is point \" << iD << std::endl;\n\n  // Get the coordinates of the closest point.\n  double closestPoint[3];\n  octree->GetDataSet()->GetPoint(iD, closestPoint);\n  std::cout << \"Coordinates: \" << closestPoint[0] << \" \" << closestPoint[1]\n            << \" \" << closestPoint[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/OctreeClosestPoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeClosestPoint)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeClosestPoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeClosestPoint MACOSX_BUNDLE OctreeClosestPoint.cxx )\n  target_link_libraries(OctreeClosestPoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeClosestPoint\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/OctreeClosestPoint/#download-and-build-octreeclosestpoint","title":"Download and Build OctreeClosestPoint","text":"

Click here to download OctreeClosestPoint and its CMakeLists.txt file. Once the tarball OctreeClosestPoint.tar has been downloaded and extracted,

cd OctreeClosestPoint/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OctreeClosestPoint\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadius/","title":"OctreeFindPointsWithinRadius","text":"

vtk-examples/Cxx/DataStructures/OctreeFindPointsWithinRadius

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadius/#code","title":"Code","text":"

OctreeFindPointsWithinRadius.cxx

#include <vtkIdList.h>\n#include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPointSource.h>\n\nint main(int, char*[])\n{\n  // Create some random points.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(10);\n  pointSource->Update();\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetDataSet(pointSource->GetOutput());\n  octree->BuildLocator();\n\n  // Find the k closest points to (0,0,0).\n  vtkIdType k = 1;\n  double testPoint[3] = {0.0, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n\n  octree->FindPointsWithinRadius(1.0, testPoint, result);\n\n  for (vtkIdType i = 0; i < k; i++)\n  {\n    vtkIdType point_ind = result->GetId(i);\n    double p[3];\n    pointSource->GetOutput()->GetPoint(point_ind, p);\n    std::cout << \"Closest point \" << i << \": Point \" << point_ind << \": (\"\n              << p[0] << \", \" << p[1] << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadius/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeFindPointsWithinRadius)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeFindPointsWithinRadius: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeFindPointsWithinRadius MACOSX_BUNDLE OctreeFindPointsWithinRadius.cxx )\n  target_link_libraries(OctreeFindPointsWithinRadius PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeFindPointsWithinRadius\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadius/#download-and-build-octreefindpointswithinradius","title":"Download and Build OctreeFindPointsWithinRadius","text":"

Click here to download OctreeFindPointsWithinRadius and its CMakeLists.txt file. Once the tarball OctreeFindPointsWithinRadius.tar has been downloaded and extracted,

cd OctreeFindPointsWithinRadius/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OctreeFindPointsWithinRadius\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/","title":"OctreeFindPointsWithinRadiusDemo","text":"

vtk-examples/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/#description","title":"Description","text":"

This example uses vtkOctreePointLocator to find all points within a given radius. The example generates \"n\" spheres and finds all the points within the radius of the spheres. The input vtkPolyData's vtkPointData is set the the radius value of each sphere.

The example takes one or two arguments. The first argument specifies the input file that contains vtkPolyData. The second optional argument specifies the number of radii use. If the number is < 6, the vtkSphereSource will be displayed as concentric translucent spheres.

The image was produced with this command:

OctreeFindPointsWithinRadius dragon.ply 10\n

To see the translucent spheres run:

OctreeFindPointsWithinRadius dragon.ply\n

Info

See other locator demos: KDTreeFindPointsWithinRadiusDemo, StaticLocatorFindPointsWithinRadiusDemo, PointLocatorFindPointsWithinRadiusDemo

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/#code","title":"Code","text":"

OctreeFindPointsWithinRadiusDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkDoubleArray.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <array>\n#include <cctype> // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\n// Templated join which can be used on any combination\n//  of streams, and a container of base types.\ntemplate <typename TStream, typename TContainer, typename TSeparator>\nTStream& join(TStream& stream, TContainer const& cont,\n              TSeparator const& separator)\n{\n  auto sep = false;\n  for (auto const& p : cont)\n  {\n    if (sep)\n      stream << separator;\n    else\n    {\n      sep = true;\n    }\n    stream << p;\n  }\n  // As a convenience, return a reference to the passed stream.\n  return stream;\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" dragon.ply [number of radii] \"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int numberOfRadii = 5;\n  if (argc > 2)\n  {\n    numberOfRadii = std::atoi(argv[2]);\n  }\n  // Read the polydata\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Compute bounds and range\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n  polyData->GetBounds(bounds.data());\n  std::cout << \"Bounds: \";\n  join(std::cout, bounds, \", \") << std::endl;\n  std::array<double, 3> range;\n  range[0] = bounds[1] - bounds[0];\n  range[1] = bounds[3] - bounds[2];\n  range[2] = bounds[5] - bounds[4];\n  std::cout << \"Range: \";\n  join(std::cout, range, \", \") << std::endl;\n\n  // double maxRange = std::max({range[0], range[1], range[2]});\n  double minRange = std::min({range[0], range[1], range[2]});\n\n  // Define a sphere at one edge of bounding box\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(range[0] / 2.0 + bounds[0],\n                          range[1] / 2.0 + bounds[2], bounds[5]);\n  sphereSource->SetRadius(minRange);\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n  sphereSource->SetStartPhi(90.0);\n  sphereSource->Update();\n\n  // Initialize the locator\n  vtkNew<vtkOctreePointLocator> pointTree;\n  pointTree->SetDataSet(polyData);\n  pointTree->BuildLocator();\n\n  // Compute the radius for each call to FindPointsWithinRadius\n  std::vector<double> radii;\n  double radiiStart = .25 * sphereSource->GetRadius();\n  double radiiEnd = 1.0 * sphereSource->GetRadius();\n  double radiiDelta = (radiiEnd - radiiStart) / (numberOfRadii - 1);\n\n  for (int r = 0; r < numberOfRadii; ++r)\n  {\n    radii.push_back(radiiStart + radiiDelta * r);\n  }\n\n  // Create an array to hold the scalar point data\n  vtkNew<vtkDoubleArray> scalars;\n  scalars->SetNumberOfComponents(1);\n  scalars->SetNumberOfTuples(polyData->GetNumberOfPoints());\n  scalars->FillComponent(0, 0.0);\n\n  // Process each radii from largest to smallest\n  for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n       rIter != radii.rend(); ++rIter)\n  {\n    vtkNew<vtkIdList> result;\n    pointTree->FindPointsWithinRadius(*rIter, sphereSource->GetCenter(),\n                                      result);\n    vtkIdType k = result->GetNumberOfIds();\n    std::cout << k << \" points within \" << *rIter << \" of \"\n              << sphereSource->GetCenter()[0] << \", \"\n              << sphereSource->GetCenter()[1] << \", \"\n              << sphereSource->GetCenter()[2] << std::endl;\n    // Store the distance in the points withnin the current radius\n    for (vtkIdType i = 0; i < k; i++)\n    {\n      vtkIdType point_ind = result->GetId(i);\n      scalars->SetTuple1(point_ind, *rIter);\n    }\n  }\n  polyData->GetPointData()->SetScalars(scalars);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(.667, 0.0);\n  lut->SetNumberOfTableValues(radii.size() + 1);\n  lut->SetRange(*radii.begin(), *radii.rbegin());\n  lut->Build();\n\n  // Create a transluscent sphere for each radii\n  if (radii.size() < 6)\n  {\n    for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n         rIter != radii.rend(); ++rIter)\n    {\n      vtkNew<vtkSphereSource> radiiSource;\n      radiiSource->SetPhiResolution(31);\n      radiiSource->SetThetaResolution(31);\n      radiiSource->SetStartPhi(90.0);\n      radiiSource->SetRadius(*rIter);\n      radiiSource->SetCenter(range[0] / 2.0 + bounds[0],\n                             range[1] / 2.0 + bounds[2], bounds[5]);\n\n      vtkNew<vtkPolyDataMapper> radiiMapper;\n      radiiMapper->SetInputConnection(radiiSource->GetOutputPort());\n\n      vtkNew<vtkProperty> backProp;\n      backProp->SetDiffuseColor(colors->GetColor3d(\"LightGrey\").GetData());\n\n      vtkNew<vtkActor> radiiActor;\n      radiiActor->SetMapper(radiiMapper);\n      radiiActor->GetProperty()->SetDiffuseColor(\n          colors->GetColor3d(\"White\").GetData());\n      radiiActor->GetProperty()->SetOpacity(.1);\n      radiiActor->SetBackfaceProperty(backProp);\n\n      renderer->AddActor(radiiActor);\n    }\n  }\n\n  // Display the original poly data\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(*radii.begin(), *radii.rbegin());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n  renderWindow->SetWindowName(\"OctreeFindPointsWithinRadiusDemo\");\n\n  renderWindow->Render();\n\n  // Pick a good view\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeFindPointsWithinRadiusDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeFindPointsWithinRadiusDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeFindPointsWithinRadiusDemo MACOSX_BUNDLE OctreeFindPointsWithinRadiusDemo.cxx )\n  target_link_libraries(OctreeFindPointsWithinRadiusDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeFindPointsWithinRadiusDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/#download-and-build-octreefindpointswithinradiusdemo","title":"Download and Build OctreeFindPointsWithinRadiusDemo","text":"

Click here to download OctreeFindPointsWithinRadiusDemo and its CMakeLists.txt file. Once the tarball OctreeFindPointsWithinRadiusDemo.tar has been downloaded and extracted,

cd OctreeFindPointsWithinRadiusDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OctreeFindPointsWithinRadiusDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/OctreeKClosestPoints/","title":"OctreeKClosestPoints","text":"

vtk-examples/Cxx/DataStructures/OctreeKClosestPoints

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/OctreeKClosestPoints/#code","title":"Code","text":"

OctreeKClosestPoints.cxx

#include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPointSource.h>\n\nint main(int, char*[])\n{\n  // Create some random points\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(10);\n  pointSource->Update();\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetDataSet(pointSource->GetOutput());\n  octree->BuildLocator();\n\n  // Find the k closest points to (0,0,0)\n  vtkIdType k = 1;\n  double testPoint[3] = {0.0, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n\n  octree->FindClosestNPoints(k, testPoint, result);\n\n  for (vtkIdType i = 0; i < k; i++)\n  {\n    vtkIdType point_ind = result->GetId(i);\n    double p[3];\n    pointSource->GetOutput()->GetPoint(point_ind, p);\n    std::cout << \"Closest point \" << i << \": Point \" << point_ind << \": (\"\n              << p[0] << \", \" << p[1] << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/OctreeKClosestPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeKClosestPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeKClosestPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeKClosestPoints MACOSX_BUNDLE OctreeKClosestPoints.cxx )\n  target_link_libraries(OctreeKClosestPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeKClosestPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/OctreeKClosestPoints/#download-and-build-octreekclosestpoints","title":"Download and Build OctreeKClosestPoints","text":"

Click here to download OctreeKClosestPoints and its CMakeLists.txt file. Once the tarball OctreeKClosestPoints.tar has been downloaded and extracted,

cd OctreeKClosestPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OctreeKClosestPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/OctreeTimingDemo/","title":"OctreeTimingDemo","text":"

vtk-examples/Cxx/DataStructures/OctreeTimingDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/OctreeTimingDemo/#description","title":"Description","text":"

This example runs several closest point queries on octrees with varying MaxPointsPerRegion and plots the result.

Your timing graph will be different when compared to the above illustration.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/OctreeTimingDemo/#code","title":"Code","text":"

OctreeTimingDemo.cxx

#include <vtkAxis.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPlot.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTable.h>\n#include <vtkTimerLog.h>\n\n#include <time.h>\n#include <vector>\n\nnamespace {\n// void RandomPointInBounds(vtkPolyData* polydata, double p[3]);\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng);\n\ndouble TimeOctree(vtkPolyData* polydata, int maxPoints, int numberOfTrials,\n                  vtkMinimalStandardRandomSequence* rng);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> reader;\n  reader->SetThetaResolution(30);\n  reader->SetPhiResolution(30);\n  reader->Update();\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  std::cout << \"Timing octree...\" << std::endl;\n  std::vector<std::pair<int, double>> results;\n  int numberOfTrials = 1000;\n  for (int i = 1; i < 100; i++)\n  {\n    double t = TimeOctree(reader->GetOutput(), i, numberOfTrials, rng);\n    std::pair<int, double> result(i, t);\n    results.push_back(result);\n  }\n\n  // Create a table with some points in it\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> maxPointsPerRegion;\n  maxPointsPerRegion->SetName(\"MaxPointsPerRegion\");\n  table->AddColumn(maxPointsPerRegion);\n\n  vtkNew<vtkFloatArray> runtime;\n  runtime->SetName(\"Run time\");\n  table->AddColumn(runtime);\n\n  // Fill in the table with some example values\n  size_t numPoints = results.size();\n  table->SetNumberOfRows(static_cast<vtkIdType>(numPoints));\n  for (size_t i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(static_cast<vtkIdType>(i), 0, results[i].first);\n    table->SetValue(static_cast<vtkIdType>(i), 1, results[i].second);\n    std::cout << \"Put \" << results[i].first << \" \" << results[i].second\n              << \" in the table.\" << std::endl;\n  }\n\n  // Set up the view\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"White\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"OctreeTimingDemo\");\n\n  // Add multiple line plots, setting the colors etc\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  vtkPlot* line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 1);\n  auto lineColor = colors->HTMLColorToRGBA(\"Lime\").GetData();\n  line->SetColor(lineColor[0], lineColor[1], lineColor[2], lineColor[3]);\n  line->SetWidth(3.0);\n  line->GetXAxis()->SetTitle(\"Max Points Per Region\");\n  line->GetYAxis()->SetTitle(\"Run time\");\n\n  // Set up an interactor and start\n  view->Render();\n  view->GetInteractor()->SetRenderWindow(view->GetRenderWindow());\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  for (auto i = 0; i < 3; ++i)\n  {\n    p[i] = bounds[i * 2] +\n        (bounds[i * 2 + 1] - bounds[i * 2]) * rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n}\n\ndouble TimeOctree(vtkPolyData* polydata, int maxPoints, int numberOfTrials,\n                  vtkMinimalStandardRandomSequence* rng)\n{\n  vtkNew<vtkTimerLog> timer;\n  timer->StartTimer();\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetDataSet(polydata);\n  octree->SetMaximumPointsPerRegion(maxPoints);\n  octree->BuildLocator();\n\n  std::cout << \"With maxPoints = \" << maxPoints << \" there are \"\n            << octree->GetNumberOfLeafNodes() << \" leaf nodes.\" << std::endl;\n\n  for (int i = 0; i < numberOfTrials; i++)\n  {\n    double p[3];\n    RandomPointInBounds(polydata, p, rng);\n    // vtkIdType iD = octree->FindClosestPoint(p);\n    octree->FindClosestPoint(p);\n  }\n\n  timer->StopTimer();\n\n  std::cout << \"Octree took \" << timer->GetElapsedTime() << std::endl;\n\n  return timer->GetElapsedTime();\n}\n\n} // namespace\n
"},{"location":"Cxx/DataStructures/OctreeTimingDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeTimingDemo)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonSystem\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeTimingDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeTimingDemo MACOSX_BUNDLE OctreeTimingDemo.cxx )\n  target_link_libraries(OctreeTimingDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeTimingDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/OctreeTimingDemo/#download-and-build-octreetimingdemo","title":"Download and Build OctreeTimingDemo","text":"

Click here to download OctreeTimingDemo and its CMakeLists.txt file. Once the tarball OctreeTimingDemo.tar has been downloaded and extracted,

cd OctreeTimingDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OctreeTimingDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/OctreeVisualize/","title":"OctreeVisualize","text":"

vtk-examples/Cxx/DataStructures/OctreeVisualize

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/OctreeVisualize/#code","title":"Code","text":"

OctreeVisualize.cxx

#include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\n#include <cmath>\n\nnamespace {\nclass vtkSliderCallback : public vtkCommand\n{\npublic:\n  static vtkSliderCallback* New()\n\n  {\n    return new vtkSliderCallback;\n  }\n  vtkSliderCallback() : Octree(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n\n    this->Octree->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkOctreePointLocator* Octree;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a point cloud\n  vtkNew<vtkSphereSource> pointSource;\n  pointSource->SetPhiResolution(50);\n  pointSource->SetThetaResolution(50);\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(pointSource->GetOutputPort());\n  pointSource->Update();\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetRepresentationToPoints();\n  pointsActor->GetProperty()->SetColor(colors->GetColor4d(\"Yellow\").GetData());\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetMaximumPointsPerRegion(5);\n  octree->SetDataSet(pointSource->GetOutput());\n  octree->BuildLocator();\n\n  vtkNew<vtkPolyData> polydata;\n  octree->GenerateRepresentation(0, polydata);\n\n  vtkNew<vtkPolyDataMapper> octreeMapper;\n  octreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> octreeActor;\n  octreeActor->SetMapper(octreeMapper);\n  octreeActor->GetProperty()->SetInterpolationToFlat();\n  octreeActor->GetProperty()->SetRepresentationToWireframe();\n  octreeActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"SpringGreen\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(octreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->SetWindowName(\"OctreeVisualize\");\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(octree->GetLevel());\n  sliderRep->SetValue(0);\n  sliderRep->SetTitleText(\"Level\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(.2, .2);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(.8, .2);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  sliderRep->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"Beige\").GetData());\n  sliderRep->GetCapProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  sliderRep->GetSliderProperty()->SetColor(\n      colors->GetColor3d(\"LightBlue\").GetData());\n  sliderRep->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"Violet\").GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->Octree = octree;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/DataStructures/OctreeVisualize/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeVisualize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeVisualize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeVisualize MACOSX_BUNDLE OctreeVisualize.cxx )\n  target_link_libraries(OctreeVisualize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeVisualize\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/OctreeVisualize/#download-and-build-octreevisualize","title":"Download and Build OctreeVisualize","text":"

Click here to download OctreeVisualize and its CMakeLists.txt file. Once the tarball OctreeVisualize.tar has been downloaded and extracted,

cd OctreeVisualize/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OctreeVisualize\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/","title":"PointLocatorFindPointsWithinRadiusDemo","text":"

vtk-examples/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/#description","title":"Description","text":"

This example uses vtkPointLocator to find all points within a given radius. The example generates \"n\" spheres and finds all the points within the radius of the spheres. The input vtkPolyData's vtkPointData is set the the radius value of each sphere.

The example takes one or two arguments. The first argument specifies the input file that contains vtkPolyData. The second optional argument specifies the number of radii use. If the number is < 6, the vtkSphereSource will be displayed as concentric translucent spheres.

The image was produced with this command:

PointLocatorFindPointsWithinRadius dragon.ply 10\n

To see the translucent spheres run:

PointLocatoFindPointsWithinRadius dragon.ply\n

Info

See other locator demos: KDTreeFindPointsWithinRadiusDemo, OctreeFindPointsWithinRadiusDemo, StaticLocatorFindPointsWithinRadiusDemo

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/#code","title":"Code","text":"

PointLocatorFindPointsWithinRadiusDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <vtkDoubleArray.h>\n#include <vtkIdList.h>\n#include <vtkPointData.h>\n#include <vtkPointLocator.h>\n#include <vtkPolyData.h>\n\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtksys/SystemTools.hxx>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <array>\n#include <cctype> // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\n// Templated join which can be used on any combination\n//  of streams, and a container of base types.\ntemplate <typename TStream, typename TContainer, typename TSeparator>\nTStream& join(TStream& stream, TContainer const& cont,\n              TSeparator const& separator)\n{\n  auto sep = false;\n  for (auto const& p : cont)\n  {\n    if (sep)\n      stream << separator;\n    else\n    {\n      sep = true;\n    }\n    stream << p;\n  }\n  // As a convenience, return a reference to the passed stream.\n  return stream;\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" dragon.ply [number of radii] \"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int numberOfRadii = 5;\n  if (argc > 2)\n  {\n    numberOfRadii = std::atoi(argv[2]);\n  }\n  // Read the polydata\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Compute bounds and range\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n  std::cout << \"Bounds: \";\n  join(std::cout, bounds, \", \") << std::endl;\n  std::array<double, 3> range;\n  range[0] = bounds[1] - bounds[0];\n  range[1] = bounds[3] - bounds[2];\n  range[2] = bounds[5] - bounds[4];\n  std::cout << \"Range: \";\n  join(std::cout, range, \", \") << std::endl;\n\n  // double maxRange = std::max({range[0], range[1], range[2]});\n  double minRange = std::min({range[0], range[1], range[2]});\n\n  // Define a sphere at one edge of bounding box\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(range[0] / 2.0 + bounds[0],\n                          range[1] / 2.0 + bounds[2], bounds[5]);\n  sphereSource->SetRadius(minRange);\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n  sphereSource->SetStartPhi(90.0);\n  sphereSource->Update();\n\n  // Initialize the locator\n  vtkNew<vtkPointLocator> pointTree;\n  pointTree->SetDataSet(polyData);\n  pointTree->BuildLocator();\n\n  // Compute the radius for each call to FindPointsWithinRadius\n  std::vector<double> radii;\n  double radiiStart = .25 * sphereSource->GetRadius();\n  double radiiEnd = 1.0 * sphereSource->GetRadius();\n  double radiiDelta = (radiiEnd - radiiStart) / (numberOfRadii - 1);\n\n  for (int r = 0; r < numberOfRadii; ++r)\n  {\n    radii.push_back(radiiStart + radiiDelta * r);\n  }\n\n  // Create an array to hold the scalar point data\n  vtkNew<vtkDoubleArray> scalars;\n  scalars->SetNumberOfComponents(1);\n  scalars->SetNumberOfTuples(polyData->GetNumberOfPoints());\n  scalars->FillComponent(0, 0.0);\n\n  // Process each radii from largest to smallest\n  for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n       rIter != radii.rend(); ++rIter)\n  {\n    vtkNew<vtkIdList> result;\n    pointTree->FindPointsWithinRadius(*rIter, sphereSource->GetCenter(),\n                                      result);\n    vtkIdType k = result->GetNumberOfIds();\n    std::cout << k << \" points within \" << *rIter << \" of \"\n              << sphereSource->GetCenter()[0] << \", \"\n              << sphereSource->GetCenter()[1] << \", \"\n              << sphereSource->GetCenter()[2] << std::endl;\n    // Store the distance in the points withnin the current radius\n    for (vtkIdType i = 0; i < k; i++)\n    {\n      vtkIdType point_ind = result->GetId(i);\n      scalars->SetTuple1(point_ind, *rIter);\n    }\n  }\n  polyData->GetPointData()->SetScalars(scalars);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(.667, 0.0);\n  lut->SetNumberOfTableValues(radii.size() + 1);\n  lut->SetRange(*radii.begin(), *radii.rbegin());\n  lut->Build();\n\n  // Create a transluscent sphere for each radii\n  if (radii.size() < 6)\n  {\n    for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n         rIter != radii.rend(); ++rIter)\n    {\n      vtkNew<vtkSphereSource> radiiSource;\n      radiiSource->SetPhiResolution(31);\n      radiiSource->SetThetaResolution(31);\n      radiiSource->SetStartPhi(90.0);\n      radiiSource->SetRadius(*rIter);\n      radiiSource->SetCenter(range[0] / 2.0 + bounds[0],\n                             range[1] / 2.0 + bounds[2], bounds[5]);\n\n      vtkNew<vtkPolyDataMapper> radiiMapper;\n      radiiMapper->SetInputConnection(radiiSource->GetOutputPort());\n\n      vtkNew<vtkProperty> backProp;\n      backProp->SetDiffuseColor(colors->GetColor3d(\"LightGrey\").GetData());\n\n      vtkNew<vtkActor> radiiActor;\n      radiiActor->SetMapper(radiiMapper);\n      radiiActor->GetProperty()->SetDiffuseColor(\n          colors->GetColor3d(\"White\").GetData());\n      radiiActor->GetProperty()->SetOpacity(.1);\n      radiiActor->SetBackfaceProperty(backProp);\n\n      renderer->AddActor(radiiActor);\n    }\n  }\n\n  // Display the original poly data\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(*radii.begin(), *radii.rbegin());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n  renderWindow->SetWindowName(\"PointLocatorFindPointsWithinRadiusDemo\");\n\n  renderWindow->Render();\n\n  // Pick a good view\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointLocatorFindPointsWithinRadiusDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointLocatorFindPointsWithinRadiusDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointLocatorFindPointsWithinRadiusDemo MACOSX_BUNDLE PointLocatorFindPointsWithinRadiusDemo.cxx )\n  target_link_libraries(PointLocatorFindPointsWithinRadiusDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointLocatorFindPointsWithinRadiusDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/#download-and-build-pointlocatorfindpointswithinradiusdemo","title":"Download and Build PointLocatorFindPointsWithinRadiusDemo","text":"

Click here to download PointLocatorFindPointsWithinRadiusDemo and its CMakeLists.txt file. Once the tarball PointLocatorFindPointsWithinRadiusDemo.tar has been downloaded and extracted,

cd PointLocatorFindPointsWithinRadiusDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointLocatorFindPointsWithinRadiusDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/","title":"StaticLocatorFindPointsWithinRadiusDemo","text":"

vtk-examples/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/#description","title":"Description","text":"

This example uses vtkStaticPointLocator to find all points within a given radius. The example generates \"n\" spheres and finds all the points within the radius of the spheres. The input vtkPolyData's vtkPointData is set the the radius value of each sphere.

The example takes one or two arguments. The first argument specifies the input file that contains vtkPolyData. The second optional argument specifies the number of radii use. If the number is < 6, the vtkSphereSource will be displayed as concentric translucent spheres.

The image was produced with this command:

StaticLocatorFindPointsWithinRadius dragon.ply 10\n

To see the translucent spheres run:

StaticLocatoFindPointsWithinRadius dragon.ply\n

Info

See other locator demos: KDTreeFindPointsWithinRadiusDemo, OctreeFindPointsWithinRadiusDemo, PointLocatorFindPointsWithinRadiusDemo

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/#code","title":"Code","text":"

StaticLocatorFindPointsWithinRadiusDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkDoubleArray.h>\n#include <vtkIdList.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkStaticPointLocator.h>\n\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <array>\n#include <cctype> // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\n// Templated join which can be used on any combination\n//  of streams, and a container of base types.\ntemplate <typename TStream, typename TContainer, typename TSeparator>\nTStream& join(TStream& stream, TContainer const& cont,\n              TSeparator const& separator)\n{\n  auto sep = false;\n  for (auto const& p : cont)\n  {\n    if (sep)\n      stream << separator;\n    else\n    {\n      sep = true;\n    }\n    stream << p;\n  }\n  // As a convenience, return a reference to the passed stream.\n  return stream;\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" shark.ply [number of radii] \"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int numberOfRadii = 5;\n  if (argc > 2)\n  {\n    numberOfRadii = std::atoi(argv[2]);\n  }\n  // Read the polydata\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Compute bounds and range\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n  std::cout << \"Bounds: \";\n  join(std::cout, bounds, \", \") << std::endl;\n  std::array<double, 3> range;\n  range[0] = bounds[1] - bounds[0];\n  range[1] = bounds[3] - bounds[2];\n  range[2] = bounds[5] - bounds[4];\n  std::cout << \"Range: \";\n  join(std::cout, range, \", \") << std::endl;\n\n  // double maxRange = std::max({range[0], range[1], range[2]});\n  double minRange = std::min({range[0], range[1], range[2]});\n\n  // Define a sphere at one edge of bounding box\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(range[0] / 2.0 + bounds[0],\n                          range[1] / 2.0 + bounds[2], bounds[5]);\n  sphereSource->SetRadius(minRange);\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n  sphereSource->SetStartPhi(90.0);\n  sphereSource->Update();\n\n  // Initialize the locator\n  vtkNew<vtkStaticPointLocator> pointTree;\n  pointTree->SetDataSet(polyData);\n  pointTree->BuildLocator();\n\n  // Compute the radius for each call to FindPointsWithinRadius\n  std::vector<double> radii;\n  double radiiStart = .25 * sphereSource->GetRadius();\n  double radiiEnd = 1.0 * sphereSource->GetRadius();\n  double radiiDelta = (radiiEnd - radiiStart) / (numberOfRadii - 1);\n\n  for (int r = 0; r < numberOfRadii; ++r)\n  {\n    radii.push_back(radiiStart + radiiDelta * r);\n  }\n\n  // Create an array to hold the scalar point data\n  vtkNew<vtkDoubleArray> scalars;\n  scalars->SetNumberOfComponents(1);\n  scalars->SetNumberOfTuples(polyData->GetNumberOfPoints());\n  scalars->FillComponent(0, 0.0);\n\n  // Process each radii from largest to smallest\n  for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n       rIter != radii.rend(); ++rIter)\n  {\n    vtkNew<vtkIdList> result;\n    pointTree->FindPointsWithinRadius(*rIter, sphereSource->GetCenter(),\n                                      result);\n    vtkIdType k = result->GetNumberOfIds();\n    std::cout << k << \" points within \" << *rIter << \" of \"\n              << sphereSource->GetCenter()[0] << \", \"\n              << sphereSource->GetCenter()[1] << \", \"\n              << sphereSource->GetCenter()[2] << std::endl;\n    // Store the distance in the points withnin the current radius\n    for (vtkIdType i = 0; i < k; i++)\n    {\n      vtkIdType point_ind = result->GetId(i);\n      scalars->SetTuple1(point_ind, *rIter);\n    }\n  }\n  polyData->GetPointData()->SetScalars(scalars);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(.667, 0.0);\n  lut->SetNumberOfTableValues(radii.size() + 1);\n  lut->SetRange(*radii.begin(), *radii.rbegin());\n  lut->Build();\n\n  // Create a transluscent sphere for each radii\n  if (radii.size() < 6)\n  {\n    for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n         rIter != radii.rend(); ++rIter)\n    {\n      vtkNew<vtkSphereSource> radiiSource;\n      radiiSource->SetPhiResolution(31);\n      radiiSource->SetThetaResolution(31);\n      radiiSource->SetStartPhi(90.0);\n      radiiSource->SetRadius(*rIter);\n      radiiSource->SetCenter(range[0] / 2.0 + bounds[0],\n                             range[1] / 2.0 + bounds[2], bounds[5]);\n\n      vtkNew<vtkPolyDataMapper> radiiMapper;\n      radiiMapper->SetInputConnection(radiiSource->GetOutputPort());\n\n      vtkNew<vtkProperty> backProp;\n      backProp->SetDiffuseColor(colors->GetColor3d(\"LightGrey\").GetData());\n\n      vtkNew<vtkActor> radiiActor;\n      radiiActor->SetMapper(radiiMapper);\n      radiiActor->GetProperty()->SetDiffuseColor(\n          colors->GetColor3d(\"White\").GetData());\n      radiiActor->GetProperty()->SetOpacity(.1);\n      radiiActor->SetBackfaceProperty(backProp);\n\n      renderer->AddActor(radiiActor);\n    }\n  }\n\n  // Display the original poly data\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(*radii.begin(), *radii.rbegin());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n  renderWindow->SetWindowName(\"StaticLocatorFindPointsWithinRadiusDemo\");\n\n  renderWindow->Render();\n\n  // Pick a good view\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StaticLocatorFindPointsWithinRadiusDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StaticLocatorFindPointsWithinRadiusDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StaticLocatorFindPointsWithinRadiusDemo MACOSX_BUNDLE StaticLocatorFindPointsWithinRadiusDemo.cxx )\n  target_link_libraries(StaticLocatorFindPointsWithinRadiusDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StaticLocatorFindPointsWithinRadiusDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/#download-and-build-staticlocatorfindpointswithinradiusdemo","title":"Download and Build StaticLocatorFindPointsWithinRadiusDemo","text":"

Click here to download StaticLocatorFindPointsWithinRadiusDemo and its CMakeLists.txt file. Once the tarball StaticLocatorFindPointsWithinRadiusDemo.tar has been downloaded and extracted,

cd StaticLocatorFindPointsWithinRadiusDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StaticLocatorFindPointsWithinRadiusDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/VisualizeKDTree/","title":"VisualizeKDTree","text":"

vtk-examples/Cxx/DataStructures/VisualizeKDTree

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/VisualizeKDTree/#description","title":"Description","text":"

This demo displays the level of a vtkKdTree using a slider. A KdTree is an k-d tree. It is used in fast intersection tests, collision detection and point location.

Here's the embedded video:

a

Seealso

VisualizeOBBTree and VisualizeModifiedBSPTree.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/VisualizeKDTree/#code","title":"Code","text":"

VisualizeKDTree.cxx

#include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkKdTree.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\nclass vtkSliderCallback : public vtkCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  vtkSliderCallback() : KdTree(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->KdTree->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkKdTree* KdTree;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputData(polyData);\n  pointsMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetColor(colors->GetColor4d(\"Yellow\").GetData());\n\n  int maxLevel = 5;\n  // Create the tree.\n  vtkNew<vtkKdTree> kdTree;\n  kdTree->SetDataSet(polyData);\n  kdTree->SetMaxLevel(maxLevel);\n  kdTree->BuildLocator();\n\n  // Initialize the representation.\n  vtkNew<vtkPolyData> polydata;\n  kdTree->GenerateRepresentation(maxLevel / 2, polydata);\n\n  vtkNew<vtkPolyDataMapper> kdtreeMapper;\n  kdtreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> octreeActor;\n  octreeActor->SetMapper(kdtreeMapper);\n  octreeActor->GetProperty()->SetInterpolationToFlat();\n  octreeActor->GetProperty()->SetOpacity(.6);\n  octreeActor->GetProperty()->EdgeVisibilityOn();\n  octreeActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"SpringGreen\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(octreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->SetUseDepthPeeling(1);\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->SetWindowName(\"VisualizeKDTree\");\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(kdTree->GetLevel());\n  sliderRep->SetValue(kdTree->GetLevel() / 2);\n  sliderRep->SetTitleText(\"Level\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(.2, .2);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(.8, .2);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  sliderRep->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"Beige\").GetData());\n  sliderRep->GetCapProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  sliderRep->GetSliderProperty()->SetColor(\n      colors->GetColor3d(\"LightBlue\").GetData());\n  sliderRep->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"Violet\").GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->KdTree = kdTree;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n  callback->Execute(sliderWidget, 0, 0);\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  // Ensure the current level is set.\n  callback->Execute(sliderWidget, 0, 0);\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/DataStructures/VisualizeKDTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeKDTree)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeKDTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeKDTree MACOSX_BUNDLE VisualizeKDTree.cxx )\n  target_link_libraries(VisualizeKDTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeKDTree\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/VisualizeKDTree/#download-and-build-visualizekdtree","title":"Download and Build VisualizeKDTree","text":"

Click here to download VisualizeKDTree and its CMakeLists.txt file. Once the tarball VisualizeKDTree.tar has been downloaded and extracted,

cd VisualizeKDTree/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VisualizeKDTree\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/VisualizeModifiedBSPTree/","title":"VisualizeModifiedBSPTree","text":"

vtk-examples/Cxx/DataStructures/VisualizeModifiedBSPTree

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/VisualizeModifiedBSPTree/#description","title":"Description","text":"

This demo displays level of a vtkModifiedBSPTree using a slider. A Modified BSP Tree is a BSP Tree. It is used for rendering, collision detection, and point location.

Here is the embedded video:

Seealso

VisualizeKDTree and VisualizeOBBTree.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/VisualizeModifiedBSPTree/#code","title":"Code","text":"

VisualizeModifiedBSPTree.cxx

#include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkModifiedBSPTree.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <cmath>\n\nnamespace {\nclass vtkSliderCallback : public vtkCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  vtkSliderCallback() : BSPTree(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->BSPTree->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkModifiedBSPTree* BSPTree;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n} // namespace\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputData(polyData);\n  pointsMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetOpacity(.3);\n  pointsActor->GetProperty()->SetColor(colors->GetColor4d(\"Yellow\").GetData());\n\n  // Create the tree\n  vtkNew<vtkModifiedBSPTree> bspTree;\n  bspTree->SetDataSet(polyData);\n  bspTree->BuildLocator();\n\n  int maxLevel = 5;\n  // Initialize the representation\n  vtkNew<vtkPolyData> polydata;\n  bspTree->SetMaxLevel(maxLevel);\n  bspTree->GenerateRepresentation(0, polydata);\n\n  vtkNew<vtkPolyDataMapper> bspTreeMapper;\n  bspTreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> bspTreeActor;\n  bspTreeActor->SetMapper(bspTreeMapper);\n  bspTreeActor->GetProperty()->SetInterpolationToFlat();\n  bspTreeActor->GetProperty()->SetOpacity(.5);\n  bspTreeActor->GetProperty()->EdgeVisibilityOn();\n  bspTreeActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"SpringGreen\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actors to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(bspTreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->SetWindowName(\"VisualizeModifiedBSPTree\");\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(bspTree->GetLevel());\n  sliderRep->SetValue(bspTree->GetLevel() / 2);\n  sliderRep->SetTitleText(\"Level\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(.2, .2);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(.8, .2);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  sliderRep->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"Beige\").GetData());\n  sliderRep->GetCapProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  sliderRep->GetSliderProperty()->SetColor(\n      colors->GetColor3d(\"LightBlue\").GetData());\n  sliderRep->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"Violet\").GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->BSPTree = bspTree;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n\n  callback->Execute(sliderWidget, 0, 0);\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkSmartPointer<vtkSphereSource> source =\n        vtkSmartPointer<vtkSphereSource>::New();\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/DataStructures/VisualizeModifiedBSPTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeModifiedBSPTree)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersFlowPaths\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeModifiedBSPTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeModifiedBSPTree MACOSX_BUNDLE VisualizeModifiedBSPTree.cxx )\n  target_link_libraries(VisualizeModifiedBSPTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeModifiedBSPTree\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/VisualizeModifiedBSPTree/#download-and-build-visualizemodifiedbsptree","title":"Download and Build VisualizeModifiedBSPTree","text":"

Click here to download VisualizeModifiedBSPTree and its CMakeLists.txt file. Once the tarball VisualizeModifiedBSPTree.tar has been downloaded and extracted,

cd VisualizeModifiedBSPTree/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VisualizeModifiedBSPTree\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/DataStructures/VisualizeOBBTree/","title":"VisualizeOBBTree","text":"

vtk-examples/Cxx/DataStructures/VisualizeOBBTree

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/DataStructures/VisualizeOBBTree/#description","title":"Description","text":"

This demo displays level of a vtkOBBTree using a slider. An OBBTree is an Oriented Bounding Box Tree. It is used in fast intersection tests, collision detection.

Here's he embeded video:

Seealso

VisualizeKDTree and VisualizeModifiedBSPTree.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/DataStructures/VisualizeOBBTree/#code","title":"Code","text":"

VisualizeOBBTree.cxx

#include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nnamespace {\nclass vtkSliderCallback : public vtkCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n\n  vtkSliderCallback() : OBBTree(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->OBBTree->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkOBBTree* OBBTree;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n} // namespace\n\nint main(int argc, char* argv[])\n{\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputData(polyData);\n  pointsMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetColor(colors->GetColor4d(\"Yellow\").GetData());\n  pointsActor->GetProperty()->SetOpacity(.3);\n\n  int maxLevel = 5;\n  // Create the tree\n  vtkNew<vtkOBBTree> obbTree;\n  obbTree->SetDataSet(polyData);\n  obbTree->SetMaxLevel(maxLevel);\n  obbTree->BuildLocator();\n\n  double corner[3] = {0.0, 0.0, 0.0};\n  double max[3] = {0.0, 0.0, 0.0};\n  double mid[3] = {0.0, 0.0, 0.0};\n  double min[3] = {0.0, 0.0, 0.0};\n  double size[3] = {0.0, 0.0, 0.0};\n\n  obbTree->ComputeOBB(polyData, corner, max, mid, min, size);\n\n  std::cout << \"Corner:\\t\" << corner[0] << \", \" << corner[1] << \", \"\n            << corner[2] << std::endl\n            << \"Max:\\t\" << max[0] << \", \" << max[1] << \", \" << max[2]\n            << std::endl\n            << \"Mid:\\t\" << mid[0] << \", \" << mid[1] << \", \" << mid[2]\n            << std::endl\n            << \"Min:\\t\" << min[0] << \", \" << min[1] << \", \" << min[2]\n            << std::endl\n            << \"Size:\\t\" << size[0] << \", \" << size[1] << \", \" << size[2]\n            << std::endl;\n\n  // Initialize the representation\n  vtkNew<vtkPolyData> polydata;\n  obbTree->GenerateRepresentation(0, polydata);\n\n  vtkNew<vtkPolyDataMapper> obbtreeMapper;\n  obbtreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> obbtreeActor;\n  obbtreeActor->SetMapper(obbtreeMapper);\n  obbtreeActor->GetProperty()->SetInterpolationToFlat();\n  obbtreeActor->GetProperty()->SetOpacity(.5);\n  obbtreeActor->GetProperty()->EdgeVisibilityOn();\n  obbtreeActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"SpringGreen\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actors to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(obbtreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->SetWindowName(\"VisualizeOBBTree\");\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(obbTree->GetLevel());\n  sliderRep->SetValue(obbTree->GetLevel() / 2);\n  sliderRep->SetTitleText(\"Level\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(.2, .2);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(.8, .2);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  sliderRep->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"Beige\").GetData());\n  sliderRep->GetCapProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  sliderRep->GetSliderProperty()->SetColor(\n      colors->GetColor3d(\"LightBlue\").GetData());\n  sliderRep->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"Violet\").GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->OBBTree = obbTree;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n  callback->Execute(sliderWidget, 0, 0);\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/DataStructures/VisualizeOBBTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeOBBTree)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeOBBTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeOBBTree MACOSX_BUNDLE VisualizeOBBTree.cxx )\n  target_link_libraries(VisualizeOBBTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeOBBTree\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/DataStructures/VisualizeOBBTree/#download-and-build-visualizeobbtree","title":"Download and Build VisualizeOBBTree","text":"

Click here to download VisualizeOBBTree and its CMakeLists.txt file. Once the tarball VisualizeOBBTree.tar has been downloaded and extracted,

cd VisualizeOBBTree/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VisualizeOBBTree\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/AlgorithmFilter/","title":"AlgorithmFilter","text":"

vtk-examples/Cxx/Developers/AlgorithmFilter

"},{"location":"Cxx/Developers/AlgorithmFilter/#description","title":"Description","text":"

This example demonstrates how to create a filter that accepts a custom class and returns a custom class. To test that it is working, the class vtkTest simply stores a double named 'Value' that is instantiated to the value of 4.5. Example.cxx instantiates a vtkTest and sets its value to 5.6. The filter adds 1.0 to this value, so the vtkTest that is the output of the vtkTestAlgorithmFilter should contain the value 6.6.

You will need the following in your CMakeLists.txt file:

find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/AlgorithmFilter/#code","title":"Code","text":"

AlgorithmFilter.cxx

#include <vtkNew.h>\n\n#include \"vtkTest.h\"\n#include \"vtkTestAlgorithmFilter.h\"\n\nint main(int, char*[])\n{\n  vtkNew<vtkTest> inputTest;\n  inputTest->SetValue(5.6);\n  std::cout << \"Input value: \" << inputTest->GetValue() << std::endl;\n\n  vtkNew<vtkTestAlgorithmFilter> filter;\n  filter->SetInput(inputTest);\n  filter->Update();\n\n  vtkTest* outputTest = filter->GetOutput();\n  std::cout << \"Output value: \" << outputTest->GetValue() << std::endl;\n  std::cout << \"Input value is still: \" << inputTest->GetValue() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n

vtkTest.h

#ifndef __vtkTest_h\n#define __vtkTest_h\n\n#include <vtkDataObject.h>\n\nclass vtkTest : public vtkDataObject\n{\npublic:\n  static vtkTest* New();\n  vtkTypeMacro(vtkTest, vtkDataObject);\n  void PrintSelf(ostream& os, vtkIndent indent) override;\n  void ShallowCopy(vtkDataObject* t) override;\n\n  vtkGetMacro(Value, double);\n  vtkSetMacro(Value, double);\n\nprotected:\n  vtkTest();\n  ~vtkTest();\n\nprivate:\n  vtkTest(const vtkTest&);        // Not implemented.\n  void operator=(const vtkTest&); // Not implemented.\n\n  double Value;\n};\n\n#endif\n

vtkTestAlgorithmFilter.cxx

#include \"vtkTestAlgorithmFilter.h\"\n#include \"vtkTest.h\"\n\n#include <vtkCommand.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestAlgorithmFilter);\n\n//----------------------------------------------------------------------------\nvtkTestAlgorithmFilter::vtkTestAlgorithmFilter()\n{\n  this->SetNumberOfInputPorts(1);\n  this->SetNumberOfOutputPorts(1);\n}\n\n//----------------------------------------------------------------------------\nvtkTestAlgorithmFilter::~vtkTestAlgorithmFilter()\n{\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n\n//----------------------------------------------------------------------------\nvtkTest* vtkTestAlgorithmFilter::GetOutput()\n{\n  return this->GetOutput(0);\n}\n\n//----------------------------------------------------------------------------\nvtkTest* vtkTestAlgorithmFilter::GetOutput(int port)\n{\n  return dynamic_cast<vtkTest*>(this->GetOutputDataObject(port));\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::SetOutput(vtkDataObject* d)\n{\n  this->GetExecutive()->SetOutputData(0, d);\n}\n\n//----------------------------------------------------------------------------\nvtkDataObject* vtkTestAlgorithmFilter::GetInput()\n{\n  return this->GetInput(0);\n}\n\n//----------------------------------------------------------------------------\nvtkDataObject* vtkTestAlgorithmFilter::GetInput(int port)\n{\n  return this->GetExecutive()->GetInputData(port, 0);\n}\n\n//----------------------------------------------------------------------------\nvtkTest* vtkTestAlgorithmFilter::GetLabelHierarchyInput(int port)\n{\n  return dynamic_cast<vtkTest*>(this->GetInput(port));\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmFilter::ProcessRequest(vtkInformation* request,\n                                           vtkInformationVector** inputVector,\n                                           vtkInformationVector* outputVector)\n{\n  // Create an output object of the correct type.\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA_OBJECT()))\n  {\n    return this->RequestDataObject(request, inputVector, outputVector);\n  }\n  // generate the data\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))\n  {\n    return this->RequestData(request, inputVector, outputVector);\n  }\n\n  if (request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT()))\n  {\n    return this->RequestUpdateExtent(request, inputVector, outputVector);\n  }\n\n  // execute information\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))\n  {\n    return this->RequestInformation(request, inputVector, outputVector);\n  }\n\n  return this->Superclass::ProcessRequest(request, inputVector, outputVector);\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmFilter::FillOutputPortInformation(int vtkNotUsed(port),\n                                                      vtkInformation* info)\n{\n  // now add our info\n  info->Set(vtkDataObject::DATA_TYPE_NAME(), \"vtkTest\");\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmFilter::FillInputPortInformation(int vtkNotUsed(port),\n                                                     vtkInformation* info)\n{\n  info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), \"vtkTest\");\n  return 1;\n}\n\nint vtkTestAlgorithmFilter::RequestDataObject(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* outputVector)\n{\n  // RequestDataObject (RDO) is an earlier pipeline pass.\n  // During RDO, each filter is supposed to produce an empty data object of the\n  // proper type\n\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n  vtkTest* output =\n      dynamic_cast<vtkTest*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  if (!output)\n  {\n    output = vtkTest::New();\n    outInfo->Set(vtkDataObject::DATA_OBJECT(), output);\n    output->FastDelete();\n\n    this->GetOutputPortInformation(0)->Set(vtkDataObject::DATA_EXTENT_TYPE(),\n                                           output->GetExtentType());\n  }\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmFilter::RequestInformation(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* vtkNotUsed(outputVector))\n{\n  // do nothing let subclasses handle it\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmFilter::RequestUpdateExtent(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* vtkNotUsed(outputVector))\n{\n  int numInputPorts = this->GetNumberOfInputPorts();\n  for (int i = 0; i < numInputPorts; i++)\n  {\n    int numInputConnections = this->GetNumberOfInputConnections(i);\n    for (int j = 0; j < numInputConnections; j++)\n    {\n      vtkInformation* inputInfo = inputVector[i]->GetInformationObject(j);\n      inputInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1);\n    }\n  }\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n// This is the superclasses style of Execute method.  Convert it into\n// an imaging style Execute method.\nint vtkTestAlgorithmFilter::RequestData(vtkInformation* vtkNotUsed(request),\n                                        vtkInformationVector** inputVector,\n                                        vtkInformationVector* outputVector)\n{\n  // Later on RequestData (RD) happens.\n  // During RD each filter examines any inputs it has, then fills in that empty\n  // data object with real data.\n\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n  vtkTest* output =\n      dynamic_cast<vtkTest*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkTest* input =\n      dynamic_cast<vtkTest*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n  output->ShallowCopy(input);\n  output->SetValue(output->GetValue() + 1.0);\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::SetInput(vtkDataObject* input)\n{\n  this->SetInput(0, input);\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::SetInput(int index, vtkDataObject* input)\n{\n  if (input)\n  {\n    this->SetInputDataObject(index, input);\n  }\n  else\n  {\n    // Setting a NULL input removes the connection.\n    this->SetInputDataObject(index, 0);\n  }\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::AddInput(vtkDataObject* input)\n{\n  this->AddInput(0, input);\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::AddInput(int index, vtkDataObject* input)\n{\n  if (input)\n  {\n    this->AddInputDataObject(index, input);\n  }\n}\n

vtkTest.cxx

#include \"vtkTest.h\"\n\n#include <vtkObjectFactory.h>\n\nvtkStandardNewMacro(vtkTest);\n\nvtkTest::vtkTest()\n{\n  this->Value = 0.0;\n}\n\nvtkTest::~vtkTest()\n{\n}\n\nvoid vtkTest::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n\nvoid vtkTest::ShallowCopy(vtkDataObject* t)\n{\n  vtkTest* m = dynamic_cast<vtkTest*>(t);\n  this->Value = m->GetValue();\n}\n

vtkTestAlgorithmFilter.h

#ifndef __vtkTestAlgorithmFilter_h\n#define __vtkTestAlgorithmFilter_h\n\n#include <vtkAlgorithm.h>\n\nclass vtkDataSet;\nclass vtkTest;\n\nclass vtkTestAlgorithmFilter : public vtkAlgorithm\n{\npublic:\n  static vtkTestAlgorithmFilter* New();\n  vtkTypeMacro(vtkTestAlgorithmFilter, vtkAlgorithm);\n  void PrintSelf(ostream& os, vtkIndent indent) override;\n\n  // Description:\n  // Get the output data object for a port on this algorithm.\n  vtkTest* GetOutput();\n  vtkTest* GetOutput(int);\n  virtual void SetOutput(vtkDataObject* d);\n\n  // Description:\n  // see vtkAlgorithm for details\n  virtual int ProcessRequest(vtkInformation*, vtkInformationVector**,\n                             vtkInformationVector*) override;\n\n  // this method is not recommended for use, but lots of old style filters use\n  // it\n  vtkDataObject* GetInput();\n  vtkDataObject* GetInput(int port);\n  vtkTest* GetLabelHierarchyInput(int port);\n\n  // Description:\n  // Set an input of this algorithm. You should not override these\n  // methods because they are not the only way to connect a pipeline.\n  // Note that these methods support old-style pipeline connections.\n  // When writing new code you should use the more general\n  // vtkAlgorithm::SetInputConnection().  These methods transform the\n  // input index to the input port index, not an index of a connection\n  // within a single port.\n  void SetInput(vtkDataObject*);\n  void SetInput(int, vtkDataObject*);\n\n  // Description:\n  // Add an input of this algorithm.  Note that these methods support\n  // old-style pipeline connections.  When writing new code you should\n  // use the more general vtkAlgorithm::AddInputConnection().  See\n  // SetInput() for details.\n  void AddInput(vtkDataObject*);\n  void AddInput(int, vtkDataObject*);\n\nprotected:\n  vtkTestAlgorithmFilter();\n  ~vtkTestAlgorithmFilter();\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestDataObject(vtkInformation* request,\n                                vtkInformationVector** inputVector,\n                                vtkInformationVector* outputVector);\n\n  // convenience method\n  virtual int RequestInformation(vtkInformation* request,\n                                 vtkInformationVector** inputVector,\n                                 vtkInformationVector* outputVector);\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestData(vtkInformation* request,\n                          vtkInformationVector** inputVector,\n                          vtkInformationVector* outputVector);\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestUpdateExtent(vtkInformation*, vtkInformationVector**,\n                                  vtkInformationVector*);\n\n  virtual int FillOutputPortInformation(int port,\n                                        vtkInformation* info) override;\n  virtual int FillInputPortInformation(int port, vtkInformation* info) override;\n\nprivate:\n  vtkTestAlgorithmFilter(const vtkTestAlgorithmFilter&); // Not implemented.\n  void operator=(const vtkTestAlgorithmFilter&);         // Not implemented.\n};\n\n#endif\n
"},{"location":"Cxx/Developers/AlgorithmFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AlgorithmFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AlgorithmFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AlgorithmFilter MACOSX_BUNDLE AlgorithmFilter.cxx )\n  target_link_libraries(AlgorithmFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AlgorithmFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/AlgorithmFilter/#download-and-build-algorithmfilter","title":"Download and Build AlgorithmFilter","text":"

Click here to download AlgorithmFilter and its CMakeLists.txt file. Once the tarball AlgorithmFilter.tar has been downloaded and extracted,

cd AlgorithmFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AlgorithmFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/AlgorithmSource/","title":"AlgorithmSource","text":"

vtk-examples/Cxx/Developers/AlgorithmSource

"},{"location":"Cxx/Developers/AlgorithmSource/#description","title":"Description","text":"

This example demonstrates how to create a source that returns a custom class. To test that it is working, the class vtkTest1 simply stores a double named 'Value' that is instantiated to the value of 4.5. Example.cxx instantiates a vtkTestSource which produces a vtkTest1.

You will need the following in your CMakeLists.txt file:

find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/AlgorithmSource/#code","title":"Code","text":"

AlgorithmSource.cxx

#include \"vtkTest1.h\"\n#include \"vtkTestAlgorithmSource.h\"\n\nint main(int, char*[])\n{\n  vtkTestAlgorithmSource* source = vtkTestAlgorithmSource::New();\n  source->Update();\n\n  vtkTest1* test = source->GetOutput();\n  std::cout << test->GetValue() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n

vtkTestAlgorithmSource.cxx

#include \"vtkTestAlgorithmSource.h\"\n#include \"vtkTest1.h\"\n\n#include <vtkCommand.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestAlgorithmSource);\n\n//----------------------------------------------------------------------------\nvtkTestAlgorithmSource::vtkTestAlgorithmSource()\n{\n  this->SetNumberOfInputPorts(0);\n  this->SetNumberOfOutputPorts(1);\n}\n\n//----------------------------------------------------------------------------\nvtkTestAlgorithmSource::~vtkTestAlgorithmSource()\n{\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmSource::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n\n//----------------------------------------------------------------------------\nvtkTest1* vtkTestAlgorithmSource::GetOutput()\n{\n  return this->GetOutput(0);\n}\n\n//----------------------------------------------------------------------------\nvtkTest1* vtkTestAlgorithmSource::GetOutput(int port)\n{\n  return dynamic_cast<vtkTest1*>(this->GetOutputDataObject(port));\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmSource::SetOutput(vtkDataObject* d)\n{\n  this->GetExecutive()->SetOutputData(0, d);\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmSource::ProcessRequest(vtkInformation* request,\n                                           vtkInformationVector** inputVector,\n                                           vtkInformationVector* outputVector)\n{\n  // Create an output object of the correct type.\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA_OBJECT()))\n  {\n    return this->RequestDataObject(request, inputVector, outputVector);\n  }\n  // generate the data\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))\n  {\n    return this->RequestData(request, inputVector, outputVector);\n  }\n\n  if (request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT()))\n  {\n    return this->RequestUpdateExtent(request, inputVector, outputVector);\n  }\n\n  // execute information\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))\n  {\n    return this->RequestInformation(request, inputVector, outputVector);\n  }\n\n  return this->Superclass::ProcessRequest(request, inputVector, outputVector);\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmSource::FillOutputPortInformation(int vtkNotUsed(port),\n                                                      vtkInformation* info)\n{\n  // now add our info\n  info->Set(vtkDataObject::DATA_TYPE_NAME(), \"vtkTest1\");\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmSource::RequestDataObject(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* outputVector)\n{\n  for (int i = 0; i < this->GetNumberOfOutputPorts(); ++i)\n  {\n    vtkInformation* outInfo = outputVector->GetInformationObject(i);\n    vtkTest1* output =\n        dynamic_cast<vtkTest1*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n    if (!output)\n    {\n      output = vtkTest1::New();\n      outInfo->Set(vtkDataObject::DATA_OBJECT(), output);\n      output->FastDelete();\n      this->GetOutputPortInformation(i)->Set(vtkDataObject::DATA_EXTENT_TYPE(),\n                                             output->GetExtentType());\n    }\n  }\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmSource::RequestInformation(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* vtkNotUsed(outputVector))\n{\n  // do nothing let subclasses handle it\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmSource::RequestUpdateExtent(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* vtkNotUsed(outputVector))\n{\n  int numInputPorts = this->GetNumberOfInputPorts();\n  for (int i = 0; i < numInputPorts; i++)\n  {\n    int numInputConnections = this->GetNumberOfInputConnections(i);\n    for (int j = 0; j < numInputConnections; j++)\n    {\n      vtkInformation* inputInfo = inputVector[i]->GetInformationObject(j);\n      inputInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1);\n    }\n  }\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n// This is the superclasses style of Execute method.  Convert it into\n// an imaging style Execute method.\nint vtkTestAlgorithmSource::RequestData(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* vtkNotUsed(outputVector))\n{\n  // do nothing let subclasses handle it\n  return 1;\n}\n

vtkTestAlgorithmSource.h

#ifndef __vtkTestAlgorithmSource_h\n#define __vtkTestAlgorithmSource_h\n\n#include <vtkAlgorithm.h>\n\nclass vtkDataSet;\nclass vtkTest1;\n\nclass vtkTestAlgorithmSource : public vtkAlgorithm\n{\npublic:\n  static vtkTestAlgorithmSource* New();\n  vtkTypeMacro(vtkTestAlgorithmSource, vtkAlgorithm);\n  void PrintSelf(ostream& os, vtkIndent indent) override;\n\n  // Description:\n  // Get the output data object for a port on this algorithm.\n  vtkTest1* GetOutput();\n  vtkTest1* GetOutput(int);\n  virtual void SetOutput(vtkDataObject* d);\n\n  // Description:\n  // see vtkAlgorithm for details\n  virtual int ProcessRequest(vtkInformation*, vtkInformationVector**,\n                             vtkInformationVector*) override;\n\nprotected:\n  vtkTestAlgorithmSource();\n  ~vtkTestAlgorithmSource();\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestDataObject(vtkInformation* request,\n                                vtkInformationVector** inputVector,\n                                vtkInformationVector* outputVector);\n\n  // convenience method\n  virtual int RequestInformation(vtkInformation* request,\n                                 vtkInformationVector** inputVector,\n                                 vtkInformationVector* outputVector);\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestData(vtkInformation* request,\n                          vtkInformationVector** inputVector,\n                          vtkInformationVector* outputVector);\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestUpdateExtent(vtkInformation*, vtkInformationVector**,\n                                  vtkInformationVector*);\n\n  virtual int FillOutputPortInformation(int port,\n                                        vtkInformation* info) override;\n\nprivate:\n  vtkTestAlgorithmSource(const vtkTestAlgorithmSource&); // Not implemented.\n  void operator=(const vtkTestAlgorithmSource&);         // Not implemented.\n};\n\n#endif\n

vtkTest1.cxx

#include \"vtkTest1.h\"\n\n#include <vtkObjectFactory.h>\n\nvtkStandardNewMacro(vtkTest1);\n\nvtkTest1::vtkTest1()\n{\n  this->Value = 4.5;\n}\n\nvtkTest1::~vtkTest1()\n{\n}\n\nvoid vtkTest1::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n

vtkTest1.h

#ifndef __vtkTest1_h\n#define __vtkTest1_h\n\n#include <vtkDataObject.h>\n\nclass vtkTest1 : public vtkDataObject\n{\npublic:\n  static vtkTest1* New();\n  vtkTypeMacro(vtkTest1, vtkDataObject);\n  void PrintSelf(ostream& os, vtkIndent indent) override;\n\n  vtkGetMacro(Value, double);\n\nprotected:\n  vtkTest1();\n  ~vtkTest1();\n\nprivate:\n  vtkTest1(const vtkTest1&);       // Not implemented.\n  void operator=(const vtkTest1&); // Not implemented.\n\n  double Value;\n};\n\n#endif\n
"},{"location":"Cxx/Developers/AlgorithmSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AlgorithmSource)\n\nfind_package(VTK COMPONENTS \n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AlgorithmSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AlgorithmSource MACOSX_BUNDLE AlgorithmSource.cxx )\n  target_link_libraries(AlgorithmSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AlgorithmSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/AlgorithmSource/#download-and-build-algorithmsource","title":"Download and Build AlgorithmSource","text":"

Click here to download AlgorithmSource and its CMakeLists.txt file. Once the tarball AlgorithmSource.tar has been downloaded and extracted,

cd AlgorithmSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AlgorithmSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/FilterProgress/","title":"FilterProgress","text":"

vtk-examples/Cxx/Developers/FilterProgress

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/FilterProgress/#code","title":"Code","text":"

FilterProgress.cxx

#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkTestFilterProgressFilter.h>\n\nvoid ProgressFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\nint main(int, char*[])\n{\n  vtkSmartPointer<vtkSphereSource> sphereSource =\n      vtkSmartPointer<vtkSphereSource>::New();\n  sphereSource->Update();\n\n  vtkSmartPointer<vtkTestFilterProgressFilter> testFilter =\n      vtkSmartPointer<vtkTestFilterProgressFilter>::New();\n  testFilter->SetInputConnection(sphereSource->GetOutputPort());\n  testFilter->Update();\n\n  return EXIT_SUCCESS;\n}\n

vtkTestFilterProgressFilter.cxx

#include <vtkSmartPointer.h>\n\n#include <vtkCallbackCommand.h>\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\n#include \"vtkTestFilterProgressFilter.h\"\n\nvtkStandardNewMacro(vtkTestFilterProgressFilter);\n\nvtkTestFilterProgressFilter::vtkTestFilterProgressFilter()\n{\n  vtkSmartPointer<vtkCallbackCommand> progressCallback =\n      vtkSmartPointer<vtkCallbackCommand>::New();\n  progressCallback->SetCallback(this->ProgressFunction);\n\n  this->AddObserver(vtkCommand::ProgressEvent, progressCallback);\n}\n\nvoid vtkTestFilterProgressFilter::ProgressFunction(vtkObject* caller,\n                                                   long unsigned int eventId,\n                                                   void* clientData,\n                                                   void* callData)\n{\n  vtkTestFilterProgressFilterr* testFilter =\n      static_cast<vtkTestFilterProgressFilter*>(caller);\n  cout << \"Progress: \" << testFilter->GetProgress() << endl;\n}\n\nint vtkTestFilterProgressFilter::RequestData(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* outputVector)\n{\n\n  // get the info objects\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // get the input and ouptut\n  vtkPolyData* input =\n      dynamic_cast<vtkPolyData*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkPolyData* output =\n      dynamic_cast<vtkPolyData*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  for (vtkIdType i = 0; i < input->GetNumberOfPoints(); i++)\n  {\n    this->UpdateProgress(static_cast<double>(i) / input->GetNumberOfPoints());\n  }\n\n  output->ShallowCopy(input);\n\n  return 1;\n}\n

vtkTestFilterProgressFilter.h

#ifndef __vtkTestFilterProgressFilter_h\n#define __vtkTestFilterProgressFilter_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestFilterProgressFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  static vtkTestFilterProgressFilter* New();\n  vtkTypeMacro(vtkTestFilterProgressFilter, vtkAlgorithm);\n\nprotected:\n  vtkTestFilterProgressFilter();\n  ~vtkTestFilterProgressFilter() override;\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\n  static void ProgressFunction(vtkObject* caller, long unsigned int eventId,\n                               void* clientData, void* callData);\n\nprivate:\n  vtkTestFilterProgressFilter(const vtkTestFilterProgressFilter&) = delete;\n  void operator=(const vtkTestFilterProgressFilterr&) = delete;\n};\n\n#endif\n
"},{"location":"Cxx/Developers/FilterProgress/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FilterProgress)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FilterProgress: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FilterProgress MACOSX_BUNDLE FilterProgress.cxx )\n  target_link_libraries(FilterProgress PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FilterProgress\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/FilterProgress/#download-and-build-filterprogress","title":"Download and Build FilterProgress","text":"

Click here to download FilterProgress and its CMakeLists.txt file. Once the tarball FilterProgress.tar has been downloaded and extracted,

cd FilterProgress/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FilterProgress\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/FilterSelfProgress/","title":"FilterSelfProgress","text":"

vtk-examples/Cxx/Developers/FilterSelfProgress

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/FilterSelfProgress/#code","title":"Code","text":"

FilterSelfProgress.cxx

#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include \"vtkTestFilterSelfProgressFilter.h\"\n\nvoid ProgressFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\nint main(int /* argc */, char** /* argv */)\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTestFilterSelfProgressFilter> testFilter;\n  testFilter->SetInputConnection(sphereSource->GetOutputPort());\n  testFilter->Update();\n\n  return EXIT_SUCCESS;\n}\n

vtkTestFilterSelfProgressFilter.h

#ifndef __vtkTestFilterSelfProgressFilter_h\n#define __vtkTestFilterSelfProgressFilter_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestFilterSelfProgressFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkTestFilterSelfProgressFilter, vtkAlgorithm);\n\n  static vtkTestFilterSelfProgressFilter* New();\n\nprotected:\n  vtkTestFilterSelfProgressFilter();\n  ~vtkTestFilterSelfProgressFilter()\n  {\n  }\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\n  static void ProgressFunction(vtkObject* caller, long unsigned int eventId,\n                               void* clientData, void* callData);\n\nprivate:\n  vtkTestFilterSelfProgressFilter(const vtkTestFilterSelfProgressFilter&) =\n      delete;\n  void operator=(const vtkTestFilterSelfProgressFilter&) = delete;\n};\n\n#endif\n

vtkTestFilterSelfProgressFilter.cxx

#include <vtkCallbackCommand.h>\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\n#include \"vtkTestFilterSelfProgressFilter.h\"\n\nvtkStandardNewMacro(vtkTestFilterSelfProgressFilter);\n\nvtkTestFilterSelfProgressFilter::vtkTestFilterSelfProgressFilter()\n{\n  vtkNew<vtkCallbackCommand> progressCallback;\n  progressCallback->SetCallback(this->ProgressFunction);\n\n  this->AddObserver(vtkCommand::ProgressEvent, progressCallback);\n}\n\nvoid vtkTestFilterSelfProgressFilter::ProgressFunction(\n    vtkObject* caller, long unsigned int /* eventId */, void* /* clientData */,\n    void* /* callData */)\n{\n  vtkTestFilterSelfProgressFilter* testFilter =\n      static_cast<vtkTestFilterSelfProgressFilter*>(caller);\n  cout << \"Progress: \" << testFilter->GetProgress() << endl;\n}\n\nint vtkTestFilterSelfProgressFilter::RequestData(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* outputVector)\n{\n\n  // get the info objects\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // get the input and ouptut\n  vtkPolyData* input =\n      dynamic_cast<vtkPolyData*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkPolyData* output =\n      dynamic_cast<vtkPolyData*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  for (vtkIdType i = 0; i < input->GetNumberOfPoints(); i++)\n  {\n    this->UpdateProgress(static_cast<double>(i) / input->GetNumberOfPoints());\n  }\n\n  output->ShallowCopy(input);\n\n  return 1;\n}\n
"},{"location":"Cxx/Developers/FilterSelfProgress/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FilterSelfProgress)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FilterSelfProgress: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FilterSelfProgress MACOSX_BUNDLE FilterSelfProgress.cxx )\n  target_link_libraries(FilterSelfProgress PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FilterSelfProgress\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/FilterSelfProgress/#download-and-build-filterselfprogress","title":"Download and Build FilterSelfProgress","text":"

Click here to download FilterSelfProgress and its CMakeLists.txt file. Once the tarball FilterSelfProgress.tar has been downloaded and extracted,

cd FilterSelfProgress/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FilterSelfProgress\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/GraphAlgorithmFilter/","title":"GraphAlgorithmFilter","text":"

vtk-examples/Cxx/Developers/GraphAlgorithmFilter

"},{"location":"Cxx/Developers/GraphAlgorithmFilter/#description","title":"Description","text":"

This example demonstrates how to create a filter that takes a vtkGraph as input and produces a vtkGraph as output.

You will need the following in your CMakeLists.txt file:

find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/GraphAlgorithmFilter/#code","title":"Code","text":"

GraphAlgorithmFilter.cxx

#include <vtkGraph.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n\n#include \"vtkTestGraphAlgorithmFilter.h\"\n\nvoid TestDirected();\nvoid TestUndirected();\n\nint main(int, char*[])\n{\n  TestDirected();\n  TestUndirected();\n\n  return EXIT_SUCCESS;\n}\n\nvoid TestDirected()\n{\n\n  vtkNew<vtkMutableDirectedGraph> g;\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  std::cout << \"Input type: \" << g->GetClassName() << std::endl;\n\n  vtkNew<vtkTestGraphAlgorithmFilter> filter;\n  filter->SetInputData(g);\n  filter->Update();\n\n  std::cout << \"Output type: \" << filter->GetOutput()->GetClassName()\n            << std::endl;\n  std::cout << \"Output has \" << filter->GetOutput()->GetNumberOfVertices()\n            << \" vertices.\" << std::endl;\n  std::cout << std::endl;\n}\n\nvoid TestUndirected()\n{\n  std::cout << \"TestUndirected\" << std::endl;\n  vtkNew<vtkMutableUndirectedGraph> g;\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  std::cout << \"Input type: \" << g->GetClassName() << std::endl;\n\n  vtkNew<vtkTestGraphAlgorithmFilter> filter;\n  filter->SetInputData(g);\n  filter->Update();\n\n  std::cout << \"Output type: \" << filter->GetOutput()->GetClassName()\n            << std::endl;\n  std::cout << \"Output has \" << filter->GetOutput()->GetNumberOfVertices()\n            << \" vertices.\" << std::endl;\n}\n

vtkTestGraphAlgorithmFilter.h

#ifndef __vtkTestGraphAlgorithmFilter_h\n#define __vtkTestGraphAlgorithmFilter_h\n\n#include <vtkGraphAlgorithm.h>\n\nclass vtkTestGraphAlgorithmFilter : public vtkGraphAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkTestGraphAlgorithmFilter, vtkGraphAlgorithm);\n  static vtkTestGraphAlgorithmFilter* New();\n\nprotected:\n  vtkTestGraphAlgorithmFilter()\n  {\n  }\n  ~vtkTestGraphAlgorithmFilter()\n  {\n  }\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\nprivate:\n  vtkTestGraphAlgorithmFilter(\n      const vtkTestGraphAlgorithmFilter&);            // Not implemented.\n  void operator=(const vtkTestGraphAlgorithmFilter&); // Not implemented.\n};\n\n#endif\n

vtkTestGraphAlgorithmFilter.cxx

#include \"vtkTestGraphAlgorithmFilter.h\"\n\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableGraphHelper.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestGraphAlgorithmFilter);\n\nint vtkTestGraphAlgorithmFilter::RequestData(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* outputVector)\n{\n\n  // get the info objects\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // get the input and ouptut\n  vtkGraph* input =\n      dynamic_cast<vtkGraph*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkGraph* output =\n      dynamic_cast<vtkGraph*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkNew<vtkMutableDirectedGraph> mdg;\n\n  vtkNew<vtkMutableUndirectedGraph> mug;\n\n  if (input->IsA(\"vtkMutableUndirectedGraph\"))\n  {\n    vtkNew<vtkMutableUndirectedGraph> ug;\n    ug->AddVertex();\n    output->ShallowCopy(ug);\n  }\n  else if (input->IsA(\"vtkMutableDirectedGraph\"))\n  {\n    vtkNew<vtkMutableDirectedGraph> dg;\n    dg->AddVertex();\n    output->ShallowCopy(dg);\n  }\n\n  std::cout << \"Output is type: \" << output->GetClassName() << std::endl;\n\n  return 1;\n}\n
"},{"location":"Cxx/Developers/GraphAlgorithmFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GraphAlgorithmFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GraphAlgorithmFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GraphAlgorithmFilter MACOSX_BUNDLE GraphAlgorithmFilter.cxx )\n  target_link_libraries(GraphAlgorithmFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GraphAlgorithmFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/GraphAlgorithmFilter/#download-and-build-graphalgorithmfilter","title":"Download and Build GraphAlgorithmFilter","text":"

Click here to download GraphAlgorithmFilter and its CMakeLists.txt file. Once the tarball GraphAlgorithmFilter.tar has been downloaded and extracted,

cd GraphAlgorithmFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GraphAlgorithmFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/GraphAlgorithmSource/","title":"GraphAlgorithmSource","text":"

vtk-examples/Cxx/Developers/GraphAlgorithmSource

"},{"location":"Cxx/Developers/GraphAlgorithmSource/#description","title":"Description","text":"

This example produces a vtkGraph as output.

You will need the following in your CMakeLists.txt file:

find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/GraphAlgorithmSource/#code","title":"Code","text":"

GraphAlgorithmSource.cxx

#include <vtkGraph.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n\n#include \"vtkTestGraphAlgorithmSource.h\"\n\nint main(int, char*[])\n{\n  vtkNew<vtkTestGraphAlgorithmSource> source;\n  source->Update();\n\n  vtkGraph* outputGraph = source->GetOutput();\n\n  std::cout << \"Output number of vertices: \"\n            << outputGraph->GetNumberOfVertices() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n

vtkTestGraphAlgorithmSource.cxx

#include \"vtkTestGraphAlgorithmSource.h\"\n\n#include <vtkDataObject.h>\n#include <vtkGraph.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n#include <vtkUndirectedGraph.h>\n\nvtkStandardNewMacro(vtkTestGraphAlgorithmSource);\n\nvtkTestGraphAlgorithmSource::vtkTestGraphAlgorithmSource()\n{\n  this->SetNumberOfInputPorts(0);\n  this->SetNumberOfOutputPorts(1);\n}\n\nvtkTestGraphAlgorithmSource::~vtkTestGraphAlgorithmSource()\n{\n}\n\nint vtkTestGraphAlgorithmSource::RequestData(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* outputVector)\n{\n\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  vtkGraph* output =\n      dynamic_cast<vtkGraph*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkNew<vtkMutableUndirectedGraph> NewGraph;\n\n  // add 3 vertices\n  NewGraph->AddVertex();\n  NewGraph->AddVertex();\n  NewGraph->AddVertex();\n\n  output->ShallowCopy(NewGraph);\n\n  return 1;\n}\n\nint vtkTestGraphAlgorithmSource::RequestDataObject(vtkInformation*,\n                                                   vtkInformationVector**,\n                                                   vtkInformationVector*)\n{\n\n  vtkNew<vtkUndirectedGraph> output;\n  this->GetExecutive()->SetOutputData(0, output);\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestGraphAlgorithmSource::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n

vtkTestGraphAlgorithmSource.h

#ifndef __vtkTestGraphAlgorithmSource_h\n#define __vtkTestGraphAlgorithmSource_h\n\n#include <vtkGraphAlgorithm.h>\n\nclass vtkTestGraphAlgorithmSource : public vtkGraphAlgorithm\n{\npublic:\n  static vtkTestGraphAlgorithmSource* New();\n  vtkTypeMacro(vtkTestGraphAlgorithmSource, vtkGraphAlgorithm);\n  void PrintSelf(ostream& os, vtkIndent indent) override;\n\nprotected:\n  vtkTestGraphAlgorithmSource();\n  ~vtkTestGraphAlgorithmSource();\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\n  int RequestDataObject(vtkInformation*, vtkInformationVector**,\n                        vtkInformationVector*) override;\n\nprivate:\n  vtkTestGraphAlgorithmSource(\n      const vtkTestGraphAlgorithmSource&);            // Not implemented.\n  void operator=(const vtkTestGraphAlgorithmSource&); // Not implemented.\n};\n\n#endif\n
"},{"location":"Cxx/Developers/GraphAlgorithmSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GraphAlgorithmSource)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GraphAlgorithmSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GraphAlgorithmSource MACOSX_BUNDLE GraphAlgorithmSource.cxx )\n  target_link_libraries(GraphAlgorithmSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GraphAlgorithmSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/GraphAlgorithmSource/#download-and-build-graphalgorithmsource","title":"Download and Build GraphAlgorithmSource","text":"

Click here to download GraphAlgorithmSource and its CMakeLists.txt file. Once the tarball GraphAlgorithmSource.tar has been downloaded and extracted,

cd GraphAlgorithmSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GraphAlgorithmSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/ImageAlgorithmFilter/","title":"ImageAlgorithmFilter","text":"

vtk-examples/Cxx/Developers/ImageAlgorithmFilter

"},{"location":"Cxx/Developers/ImageAlgorithmFilter/#description","title":"Description","text":"

This example demonstrates how to setup the pipeline for a {{class|vtkImageAlgorithm}} filter that takes a {{class|vtkImageData}} as input and produces another vtkImageData as output. This particular example creates a 2x2 image and fills it with \"2\"s. The filter changes the (0,0) element to a 5.

You will need the following in your CMakeLists.txt file:

find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/ImageAlgorithmFilter/#code","title":"Code","text":"

ImageAlgorithmFilter.cxx

#include <vtkImageData.h>\n#include <vtkNew.h>\n\n#include \"vtkImageAlgorithmFilter.h\"\n\nvoid PrintImage(vtkImageData* image);\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkImageData> input;\n  // Setup the image\n  input->SetDimensions(2, 2, 1);\n  input->AllocateScalars(VTK_DOUBLE, 1);\n\n  // Fill every entry of the image data with \"2.0\"\n  int* dims = input->GetDimensions();\n\n  for (int y = 0; y < dims[1]; y++)\n  {\n    for (int x = 0; x < dims[0]; x++)\n    {\n      input->SetScalarComponentFromDouble(x, y, 0, 0, 2.0);\n    }\n  }\n\n  std::cout << \"Input image: \" << std::endl;\n  PrintImage(input);\n\n  vtkNew<vtkImageAlgorithmFilter> filter;\n  filter->SetInputData(input);\n  filter->Update();\n\n  vtkImageData* output = filter->GetOutput();\n\n  std::cout << \"Output image: \" << std::endl;\n  PrintImage(output);\n\n  return 0;\n}\n\nvoid PrintImage(vtkImageData* image)\n{\n  int* dims = image->GetDimensions();\n\n  for (int y = 0; y < dims[1]; y++)\n  {\n    for (int x = 0; x < dims[0]; x++)\n    {\n      double v = image->GetScalarComponentAsDouble(x, y, 0, 0);\n      std::cout << v << \" \";\n    }\n    std::cout << std::endl;\n  }\n}\n

vtkImageAlgorithmFilter.cxx

#include \"vtkImageAlgorithmFilter.h\"\n\n#include <vtkDataObject.h>\n#include <vtkImageData.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkImageAlgorithmFilter);\n\nint vtkImageAlgorithmFilter::RequestData(vtkInformation* vtkNotUsed(request),\n                                         vtkInformationVector** inputVector,\n                                         vtkInformationVector* outputVector)\n{\n  // Get the info objects\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // Get the input and ouptut\n  vtkImageData* input =\n      dynamic_cast<vtkImageData*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkImageData* output =\n      dynamic_cast<vtkImageData*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkNew<vtkImageData> image;\n  image->ShallowCopy(input);\n\n  image->SetScalarComponentFromDouble(0, 0, 0, 0, 5.0);\n\n  output->ShallowCopy(image);\n\n  // Without these lines, the output will appear real but will not work as the\n  // input to any other filters\n  int extent[6];\n  input->GetExtent(extent);\n  output->SetExtent(extent);\n  outInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), extent, 6);\n  outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), extent, 6);\n  return 1;\n}\n

vtkImageAlgorithmFilter.h

#ifndef __vtkImageAlgorithmFilter_h\n#define __vtkImageAlgorithmFilter_h\n\n#include <vtkImageAlgorithm.h>\n\nclass vtkImageAlgorithmFilter : public vtkImageAlgorithm\n{\npublic:\n  static vtkImageAlgorithmFilter* New();\n  vtkTypeMacro(vtkImageAlgorithmFilter, vtkImageAlgorithm);\n\n  vtkImageAlgorithmFilter()\n  {\n  }\n\nprotected:\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\nprivate:\n  vtkImageAlgorithmFilter(const vtkImageAlgorithmFilter&); // Not implemented.\n  void operator=(const vtkImageAlgorithmFilter&);          // Not implemented.\n};\n\n#endif\n
"},{"location":"Cxx/Developers/ImageAlgorithmFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageAlgorithmFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageAlgorithmFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageAlgorithmFilter MACOSX_BUNDLE ImageAlgorithmFilter.cxx )\n  target_link_libraries(ImageAlgorithmFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageAlgorithmFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/ImageAlgorithmFilter/#download-and-build-imagealgorithmfilter","title":"Download and Build ImageAlgorithmFilter","text":"

Click here to download ImageAlgorithmFilter and its CMakeLists.txt file. Once the tarball ImageAlgorithmFilter.tar has been downloaded and extracted,

cd ImageAlgorithmFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageAlgorithmFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/MultipleInputPorts/","title":"MultipleInputPorts","text":"

vtk-examples/Cxx/Developers/MultipleInputPorts

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/MultipleInputPorts/#code","title":"Code","text":"

MultipleInputPorts.cxx

#include <vtkNew.h>\n#include <vtkSphereSource.h>\n\n#include \"vtkTestMultipleInputPortsFilter.h\"\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetThetaResolution(5);\n  sphereSource1->Update();\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetThetaResolution(10);\n  sphereSource2->Update();\n\n  vtkNew<vtkTestMultipleInputPortsFilter> filter;\n  filter->SetInputConnection(0, sphereSource1->GetOutputPort());\n  filter->SetInputConnection(1, sphereSource2->GetOutputPort());\n  filter->Update();\n\n  return EXIT_SUCCESS;\n}\n

vtkTestMultipleInputPortsFilter.cxx

#include \"vtkTestMultipleInputPortsFilter.h\"\n\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkSmartPointer.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestMultipleInputPortsFilter);\n\nvtkTestMultipleInputPortsFilter::vtkTestMultipleInputPortsFilter()\n{\n  this->SetNumberOfInputPorts(2);\n}\n\nint vtkTestMultipleInputPortsFilter::FillInputPortInformation(\n    int port, vtkInformation* info)\n{\n  if (port == 0)\n  {\n    info->Set(vtkDataObject::DATA_TYPE_NAME(), \"vtkPolyData\");\n    return 1;\n  }\n  else if (port == 1)\n  {\n    info->Set(vtkDataObject::DATA_TYPE_NAME(), \"vtkPolyData\");\n    return 1;\n  }\n\n  return 0;\n}\n\nint vtkTestMultipleInputPortsFilter::RequestData(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* outputVector)\n{\n\n  // get the info objects\n  vtkInformation* inInfo0 = inputVector[0]->GetInformationObject(0);\n  vtkInformation* inInfo1 = inputVector[1]->GetInformationObject(0);\n\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // get the input and ouptut\n  vtkPolyData* input0 =\n      dynamic_cast<vtkPolyData*>(inInfo0->Get(vtkDataObject::DATA_OBJECT()));\n\n  std::cout << \"input0 has \" << input0->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  vtkPolyData* input1 =\n      dynamic_cast<vtkPolyData*>(inInfo1->Get(vtkDataObject::DATA_OBJECT()));\n\n  std::cout << \"input1 has \" << input1->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  vtkPolyData* output =\n      dynamic_cast<vtkPolyData*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  output->ShallowCopy(input0);\n\n  return 1;\n}\n

vtkTestMultipleInputPortsFilter.h

// .NAME vtkTestMultipleInputPortsFilter\n// .SECTION Description\n// vtkTestMultipleInputPortsFilter\n\n#ifndef __vtkTestMultipleInputPortsFilter_h\n#define __vtkTestMultipleInputPortsFilter_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestMultipleInputPortsFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  static vtkTestMultipleInputPortsFilter* New();\n  vtkTypeMacro(vtkTestMultipleInputPortsFilter, vtkPolyDataAlgorithm);\n\nprotected:\n  vtkTestMultipleInputPortsFilter();\n  ~vtkTestMultipleInputPortsFilter()\n  {\n  }\n\n  int FillInputPortInformation(int port, vtkInformation* info) override;\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\nprivate:\n  vtkTestMultipleInputPortsFilter(const vtkTestMultipleInputPortsFilter&) =\n      delete;\n  void operator=(const vtkTestMultipleInputPortsFilter&) = delete;\n};\n\n#endif\n
"},{"location":"Cxx/Developers/MultipleInputPorts/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultipleInputPorts)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultipleInputPorts: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultipleInputPorts MACOSX_BUNDLE MultipleInputPorts.cxx )\n  target_link_libraries(MultipleInputPorts PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultipleInputPorts\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/MultipleInputPorts/#download-and-build-multipleinputports","title":"Download and Build MultipleInputPorts","text":"

Click here to download MultipleInputPorts and its CMakeLists.txt file. Once the tarball MultipleInputPorts.tar has been downloaded and extracted,

cd MultipleInputPorts/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MultipleInputPorts\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/PolyDataAlgorithmReader/","title":"PolyDataAlgorithmReader","text":"

vtk-examples/Cxx/Developers/PolyDataAlgorithmReader

"},{"location":"Cxx/Developers/PolyDataAlgorithmReader/#description","title":"Description","text":"

This example demonstrates a reader that takes nothing as input and produces a vtkPolyData as output.

You will need the following in your CMakeLists.txt file:

find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/PolyDataAlgorithmReader/#code","title":"Code","text":"

PolyDataAlgorithmReader.cxx

#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkTestReader.h>\n\nint main(int, char*[])\n{\n  vtkSmartPointer<vtkTestReader> reader = vtkSmartPointer<vtkTestReader>::New();\n  reader->Update();\n\n  vtkPolyData* polydata = reader->GetOutput();\n  polydata->Print(std::cout);\n\n  return EXIT_SUCCESS;\n}\n

vtkTestReader.cxx

#include <vtkTestReader.h>\n\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestReader);\n\nvtkTestReader::vtkTestReader()\n{\n  this->FileName = NULL;\n  this->SetNumberOfInputPorts(0);\n  this->SetNumberOfOutputPorts(1);\n}\n\nvtkTestReader::~vtkTestReader()\n{\n}\n\n// This override is not needed as the FillOutputPortInformation on\n// vtkPolyDataAlgorithm does this.  Override this if you need something\n// different from one output that is a vtkPolyData\nint vtkTestReader::FillOutputPortInformation(int port, vtkInformation* info)\n{\n  if (port == 0)\n  {\n    info->Set(vtkDataObject::DATA_TYPE_NAME(), \"vtkPolyData\");\n\n    return 1;\n  }\n\n  return 0;\n}\n\nint vtkTestReader::RequestData(vtkInformation* vtkNotUsed(request),\n                               vtkInformationVector** vtkNotUsed(inputVector),\n                               vtkInformationVector* outputVector)\n{\n\n  // Get the output\n  vtkPolyData* output = vtkPolyData::GetData(outputVector, 0)\n\n      vtkNew<vtkPolyData>\n          polydata;\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  polydata->SetPoints(points.GetPointer());\n\n  // output = polydata.GetPointer(); //doesn't work\n  output->ShallowCopy(polydata.GetPointer());\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestReader::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n\n  os << indent << \"File Name: \" << (this->FileName ? this->FileName : \"(none)\")\n     << \"\\n\";\n}\n

vtkTestReader.h

#ifndef __vtkTestReader_h\n#define __vtkTestReader_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestReader : public vtkPolyDataAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkTestReader, vtkPolyDataAlgorithm);\n  void PrintSelf(ostream& os, vtkIndent indent);\n\n  static vtkTestReader* New();\n\nprotected:\n  vtkTestReader();\n  ~vtkTestReader();\n\n  int FillOutputPortInformation(int port, vtkInformation* info);\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*);\n\nprivate:\n  vtkTestReader(const vtkTestReader&);  // Not implemented.\n  void operator=(const vtkTestReader&); // Not implemented.\n\n  char* FileName;\n};\n\n#endif\n
"},{"location":"Cxx/Developers/PolyDataAlgorithmReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataAlgorithmReader)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataAlgorithmReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataAlgorithmReader MACOSX_BUNDLE PolyDataAlgorithmReader.cxx )\n  target_link_libraries(PolyDataAlgorithmReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataAlgorithmReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/PolyDataAlgorithmReader/#download-and-build-polydataalgorithmreader","title":"Download and Build PolyDataAlgorithmReader","text":"

Click here to download PolyDataAlgorithmReader and its CMakeLists.txt file. Once the tarball PolyDataAlgorithmReader.tar has been downloaded and extracted,

cd PolyDataAlgorithmReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataAlgorithmReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/PolyDataFilter/","title":"PolyDataFilter","text":"

vtk-examples/Cxx/Developers/PolyDataFilter

"},{"location":"Cxx/Developers/PolyDataFilter/#description","title":"Description","text":"

This example demonstrates a filter named vtkTestPolyDataFilter that takes a vtkPolyData as input and produces a vtkPolyData as output.

You will need the following in your CMakeLists.txt file:

find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/PolyDataFilter/#code","title":"Code","text":"

PolyDataFilter.cxx

#include <vtkSmartPointer.h>\n\n#include <vtkTestPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n\n  vtkSmartPointer<vtkPolyData> inputPolydata =\n      vtkSmartPointer<vtkPolyData>::New();\n  inputPolydata->SetPoints(points);\n\n  std::cout << \"Input points: \" << inputPolydata->GetNumberOfPoints()\n            << std::endl;\n\n  vtkSmartPointer<vtkTestPolyDataFilter> filter =\n      vtkSmartPointer<vtkTestPolyDataFilter>::New();\n  filter->SetInputData(inputPolydata);\n  filter->Update();\n\n  vtkPolyData* outputPolydata = filter->GetOutput();\n\n  std::cout << \"Output points: \" << outputPolydata->GetNumberOfPoints()\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n

vtkTestPolyDataFilter.h

#ifndef __vtkTestPolyDataFilter_h\n#define __vtkTestPolyDataFilter_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestPolyDataFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkTestPolyDataFilter, vtkPolyDataAlgorithm);\n  void PrintSelf(ostream& os, vtkIndent indent);\n\n  static vtkTestPolyDataFilter* New();\n\nprotected:\n  vtkTestPolyDataFilter();\n  ~vtkTestPolyDataFilter();\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*);\n\nprivate:\n  vtkTestPolyDataFilter(const vtkTestPolyDataFilter&); // Not implemented.\n  void operator=(const vtkTestPolyDataFilter&);        // Not implemented.\n};\n\n#endif\n

vtkTestPolyDataFilter.cxx

#include <vtkTestPolyDataFilter.h>\n\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkSmartPointer.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestPolyDataFilter);\n\nvtkTestPolyDataFilter::vtkTestPolyDataFilter()\n{\n  this->SetNumberOfInputPorts(1);\n  this->SetNumberOfOutputPorts(1);\n}\n\nvtkTestPolyDataFilter::~vtkTestPolyDataFilter()\n{\n}\n\nint vtkTestPolyDataFilter::RequestData(vtkInformation* vtkNotUsed(request),\n                                       vtkInformationVector** inputVector,\n                                       vtkInformationVector* outputVector)\n{\n\n  // get the input and output\n  vtkPolyData* input = vtkPolyData::GetData(inputVector[0], 0);\n  vtkPolyData* output = vtkPolyData::GetData(outputVector, 0);\n\n  input->GetPoints()->InsertNextPoint(1.0, 1.0, 1.0);\n\n  output->ShallowCopy(input);\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestPolyDataFilter::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n
"},{"location":"Cxx/Developers/PolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataFilter MACOSX_BUNDLE PolyDataFilter.cxx )\n  target_link_libraries(PolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/PolyDataFilter/#download-and-build-polydatafilter","title":"Download and Build PolyDataFilter","text":"

Click here to download PolyDataFilter and its CMakeLists.txt file. Once the tarball PolyDataFilter.tar has been downloaded and extracted,

cd PolyDataFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/ProgressReport/","title":"ProgressReport","text":"

vtk-examples/Cxx/Developers/ProgressReport

"},{"location":"Cxx/Developers/ProgressReport/#description","title":"Description","text":"

This example demonstrates how to get the progress of a filter. This requires that the filter is updating its progress in a sensible way. A sample filter is provided which loops through the input points and updates its progress along the way.

You will need the following in your CMakeLists.txt file:

find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/ProgressReport/#code","title":"Code","text":"

ProgressReport.cxx

#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include \"vtkTestProgressReportFilter.h\"\n\nvoid ProgressFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkCallbackCommand> progressCallback;\n  progressCallback->SetCallback(ProgressFunction);\n\n  vtkNew<vtkTestProgressReportFilter> testFilter;\n  testFilter->SetInputConnection(sphereSource->GetOutputPort());\n  testFilter->AddObserver(vtkCommand::ProgressEvent, progressCallback);\n  testFilter->Update();\n\n  return EXIT_SUCCESS;\n}\n\nvoid ProgressFunction(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                      void* vtkNotUsed(clientData), void* vtkNotUsed(callData))\n{\n  vtkTestProgressReportFilter* testFilter =\n      static_cast<vtkTestProgressReportFilter*>(caller);\n  std::cout << \"Progress: \" << testFilter->GetProgress() << std::endl;\n}\n

vtkTestProgressReportFilter.cxx

#include \"vtkTestProgressReportFilter.h\"\n\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkSmartPointer.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestProgressReportFilter);\n\nint vtkTestProgressReportFilter::RequestData(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* outputVector)\n{\n\n  // Get the info objects\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // Get the input and ouptut\n  vtkPolyData* input =\n      dynamic_cast<vtkPolyData*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkPolyData* output =\n      dynamic_cast<vtkPolyData*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  for (vtkIdType i = 0; i < input->GetNumberOfPoints(); i++)\n  {\n    this->UpdateProgress(static_cast<double>(i) / input->GetNumberOfPoints());\n  }\n\n  output->ShallowCopy(input);\n\n  return 1;\n}\n

vtkTestProgressReportFilter.h

#ifndef __vtkTestProgressReportFilter_h\n#define __vtkTestProgressReportFilter_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestProgressReportFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  static vtkTestProgressReportFilter* New();\n  vtkTypeMacro(vtkTestProgressReportFilter, vtkAlgorithm);\n\nprotected:\n  vtkTestProgressReportFilter()\n  {\n  }\n  ~vtkTestProgressReportFilter()\n  {\n  }\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\nprivate:\n  vtkTestProgressReportFilter(const vtkTestProgressReportFilter&) = delete;\n  void operator=(const vtkTestProgressReportFilter&) = delete;\n};\n\n#endif\n
"},{"location":"Cxx/Developers/ProgressReport/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProgressReport)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProgressReport: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProgressReport MACOSX_BUNDLE ProgressReport.cxx )\n  target_link_libraries(ProgressReport PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProgressReport\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/ProgressReport/#download-and-build-progressreport","title":"Download and Build ProgressReport","text":"

Click here to download ProgressReport and its CMakeLists.txt file. Once the tarball ProgressReport.tar has been downloaded and extracted,

cd ProgressReport/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ProgressReport\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Developers/Warnings/","title":"Warnings","text":"

vtk-examples/Cxx/Developers/Warnings

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Developers/Warnings/#code","title":"Code","text":"

Warnings.cxx

#include <vtkDataObject.h>\n#include <vtkObjectFactory.h>\n#include <vtkSmartPointer.h>\n\nclass TestClass : public vtkDataObject\n{\npublic:\n  static TestClass* New();\n  vtkTypeRevisionMacro(TestClass, vtkDataObject);\n  TestClass()\n  {\n    vtkWarningMacro(\"Test warning.\");\n  }\n};\n\nvtkStandardNewMacro(TestClass);\n\nint main(int, char*[])\n{\n\n  vtkSmartPointer<TestClass> test = vtkSmartPointer<TestClass>::New();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Developers/Warnings/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Warnings)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Warnings: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Warnings MACOSX_BUNDLE Warnings.cxx )\n  target_link_libraries(Warnings PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Warnings\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Developers/Warnings/#download-and-build-warnings","title":"Download and Build Warnings","text":"

Click here to download Warnings and its CMakeLists.txt file. Once the tarball Warnings.tar has been downloaded and extracted,

cd Warnings/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Warnings\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ExplicitStructuredGrid/CreateESGrid/","title":"CreateESGrid","text":"

vtk-examples/Cxx/ExplicitStructuredGrid/CreateESGrid

"},{"location":"Cxx/ExplicitStructuredGrid/CreateESGrid/#description","title":"Description","text":"

This example demonstrates how (1) to create an explicit structured grid and (2) to convert an explicit structured grid into an unstructured grid or vice versa.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ExplicitStructuredGrid/CreateESGrid/#code","title":"Code","text":"

CreateESGrid.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExplicitStructuredGrid.h>\n#include <vtkExplicitStructuredGridToUnstructuredGrid.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridToExplicitStructuredGrid.h>\n\n#include <array>\n#include <vector>\n\nnamespace {\n\nvtkNew<vtkExplicitStructuredGrid>\nCreateExplicitStructuredGrid(std::array<int, 3> const& dimensions,\n                             std::array<int, 3> const& spacing);\n\nvtkNew<vtkUnstructuredGrid>\nConvertToUnstructuredGrid(vtkExplicitStructuredGrid* grid);\n\nvtkNew<vtkExplicitStructuredGrid>\nConvertToExplicitStructuredGrid(vtkUnstructuredGrid* grid);\n} // namespace\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<int, 3> dimensions{0, 0, 0};\n  std::array<int, 3> spacing{1, 1, 1};\n  dimensions = {5, 6, 7};\n  spacing = {20, 10, 1};\n  auto grid = CreateExplicitStructuredGrid(dimensions, spacing);\n  auto ug = ConvertToUnstructuredGrid(grid);\n  auto esg = ConvertToExplicitStructuredGrid(ug);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(grid);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->LightingOff();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Seashell\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetWindowName(\"CreateESGrid\");\n  window->SetSize(1024, 768);\n  window->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(8.383354, -72.468670, 94.262605);\n  camera->SetFocalPoint(42.295234, 21.111537, -0.863606);\n  camera->SetViewUp(0.152863, 0.676710, 0.720206);\n  camera->SetDistance(137.681759);\n  camera->SetClippingRange(78.173985, 211.583658);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n  vtkNew<vtkInteractorStyleRubberBandPick> style;\n  interactor->SetInteractorStyle(style);\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkNew<vtkExplicitStructuredGrid>\nCreateExplicitStructuredGrid(std::array<int, 3> const& dimensions,\n                             std::array<int, 3> const& spacing)\n{\n  auto ni = dimensions[0];\n  auto nj = dimensions[1];\n  auto nk = dimensions[2];\n  auto si = spacing[0];\n  auto sj = spacing[1];\n  auto sk = spacing[2];\n  vtkNew<vtkPoints> points;\n  for (auto z = 0; z < nk * sk; z += sk)\n  {\n    for (auto y = 0; y < nj * sj; y += sj)\n    {\n      for (auto x = 0; x < ni * si; x += si)\n      {\n        points->InsertNextPoint(x, y, z);\n      }\n    }\n  }\n  // std::vector < std::vector<int> > cells;\n  vtkNew<vtkCellArray> cells;\n  for (vtkIdType k = 0; k < nk - 1; ++k)\n  {\n    for (vtkIdType j = 0; j < nj - 1; ++j)\n    {\n      for (vtkIdType i = 0; i < ni - 1; ++i)\n      {\n        // std::cout << \"(\" << i << \", \" << j << \", \" << k << \")\" << std::endl;\n        std::vector<std::array<vtkIdType, 8>> multiIndex;\n        multiIndex.push_back({i, i + 1, i + 1, i, i, i + 1, i + 1, i});\n        multiIndex.push_back({j, j, j + 1, j + 1, j, j, j + 1, j + 1});\n        multiIndex.push_back({k, k, k, k, k + 1, k + 1, k + 1, k + 1});\n        // Now let's emulate:\n        // pts = np.ravel_multi_index(multi_index, dimensions, order='F')\n        cells->InsertNextCell(8);\n        std::vector<vtkIdType> cell;\n        for (auto idx = 0; idx < 8; ++idx)\n        {\n          vtkIdType ii = multiIndex[0][idx];\n          vtkIdType jj = multiIndex[1][idx];\n          vtkIdType kk = multiIndex[2][idx];\n          cells->InsertCellPoint(ii + jj * ni + kk * nj * ni);\n        }\n      }\n    }\n  }\n\n  vtkNew<vtkExplicitStructuredGrid> grid;\n  grid->SetDimensions(ni, nj, nk);\n  grid->SetPoints(points);\n  grid->SetCells(cells);\n\n  return grid;\n}\n\nvtkNew<vtkUnstructuredGrid>\nConvertToUnstructuredGrid(vtkExplicitStructuredGrid* grid)\n{\n  vtkNew<vtkExplicitStructuredGridToUnstructuredGrid> converter;\n  converter->SetInputData(grid);\n  converter->Update();\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->DeepCopy(converter->GetOutput());\n  return ug;\n}\n\nvtkNew<vtkExplicitStructuredGrid>\nConvertToExplicitStructuredGrid(vtkUnstructuredGrid* grid)\n{\n  vtkNew<vtkUnstructuredGridToExplicitStructuredGrid> converter;\n  converter->SetInputData(grid);\n  // An explicit structured grid.\n  // The \"BLOCK_I\", \"BLOCK_J\" and\"BLOCK_K\" cell arrays are required.\n  converter->SetInputArrayToProcess(0, 0, 0, 1, \"BLOCK_I\");\n  converter->SetInputArrayToProcess(1, 0, 0, 1, \"BLOCK_J\");\n  converter->SetInputArrayToProcess(2, 0, 0, 1, \"BLOCK_K\");\n  converter->Update();\n  vtkNew<vtkExplicitStructuredGrid> esg;\n  esg->DeepCopy(converter->GetOutput());\n  return esg;\n}\n\n} // namespace\n
"},{"location":"Cxx/ExplicitStructuredGrid/CreateESGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CreateESGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CreateESGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CreateESGrid MACOSX_BUNDLE CreateESGrid.cxx )\n  target_link_libraries(CreateESGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CreateESGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ExplicitStructuredGrid/CreateESGrid/#download-and-build-createesgrid","title":"Download and Build CreateESGrid","text":"

Click here to download CreateESGrid and its CMakeLists.txt file. Once the tarball CreateESGrid.tar has been downloaded and extracted,

cd CreateESGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CreateESGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ExplicitStructuredGrid/LoadESGrid/","title":"LoadESGrid","text":"

vtk-examples/Cxx/ExplicitStructuredGrid/LoadESGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ExplicitStructuredGrid/LoadESGrid/#description","title":"Description","text":"

This example displays the UNISIM-II-D reservoir model using the vtkExplicitStructuredGrid class.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ExplicitStructuredGrid/LoadESGrid/#code","title":"Code","text":"

LoadESGrid.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExplicitStructuredGrid.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGridToExplicitStructuredGrid.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" filename.vtu e.g. The explicit structured grid file name: \"\n                 \"UNISIM-II-D.vtu.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLUnstructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkUnstructuredGridToExplicitStructuredGrid> converter;\n  converter->GlobalWarningDisplayOff(); // hide VTK errors\n  converter->SetInputConnection(reader->GetOutputPort());\n  converter->SetInputArrayToProcess(0, 0, 0, 1, \"BLOCK_I\");\n  converter->SetInputArrayToProcess(1, 0, 0, 1, \"BLOCK_J\");\n  converter->SetInputArrayToProcess(2, 0, 0, 1, \"BLOCK_K\");\n  converter->Update();\n\n  auto grid = converter->GetOutput();\n  grid->ComputeFacesConnectivityFlagsArray();\n  grid->GetCellData()->SetActiveScalars(\"ConnectivityFlags\");\n\n  auto scalars = grid->GetCellData()->GetArray(\"ConnectivityFlags\");\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(grid);\n  mapper->SetColorModeToMapScalars();\n  mapper->SetScalarRange(scalars->GetRange());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetWindowName(\"LoadESGrid\");\n  window->SetSize(1024, 768);\n  window->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(312452.407650, 7474760.406373, 3507.364723);\n  camera->SetFocalPoint(314388.388434, 7481520.509575, -2287.477388);\n  camera->SetViewUp(0.089920, 0.633216, 0.768734);\n  camera->SetDistance(9111.926908);\n  camera->SetClippingRange(595.217338, 19595.429475);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n  vtkNew<vtkInteractorStyleRubberBandPick> style;\n\n  interactor->SetInteractorStyle(style);\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ExplicitStructuredGrid/LoadESGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LoadESGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LoadESGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LoadESGrid MACOSX_BUNDLE LoadESGrid.cxx )\n  target_link_libraries(LoadESGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LoadESGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ExplicitStructuredGrid/LoadESGrid/#download-and-build-loadesgrid","title":"Download and Build LoadESGrid","text":"

Click here to download LoadESGrid and its CMakeLists.txt file. Once the tarball LoadESGrid.tar has been downloaded and extracted,

cd LoadESGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LoadESGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/AppendFilter/","title":"AppendFilter","text":"

vtk-examples/Cxx/Filtering/AppendFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/AppendFilter/#description","title":"Description","text":"

This example loads points into a polydata and an unstructured grid then combines them.

The example should be extended to show cells being combined as well.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/AppendFilter/#code","title":"Code","text":"

AppendFilter.cxx

#include <vtkActor.h>\n#include <vtkAppendFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\nnamespace {\n\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\n\nint main(int, char*[])\n{\n  // Create 5 points (vtkPolyData)\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(5);\n  pointSource->Update();\n\n  auto polydata = pointSource->GetOutput();\n\n  std::cout << \"There are \" << polydata->GetNumberOfPoints()\n            << \" points in the polydata.\" << std::endl;\n\n  // Create 2 points in a vtkUnstructuredGrid\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0, 0, 1);\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n\n  std::cout << \"There are \" << ug->GetNumberOfPoints()\n            << \" points in the unstructured grid.\" << std::endl;\n\n  // Combine the two data sets\n  vtkNew<vtkAppendFilter> appendFilter;\n  appendFilter->AddInputData(polydata);\n  appendFilter->AddInputData(ug);\n  appendFilter->Update();\n\n  auto combined = appendFilter->GetOutput();\n  std::cout << \"There are \" << combined->GetNumberOfPoints()\n            << \" points combined.\" << std::endl;\n\n  // Create a mapper and actor\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(appendFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Map the points to spheres\n  auto sphereActor = PointToGlyph(appendFilter->GetOutput()->GetPoints(), 0.05);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"AppendFilter\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
"},{"location":"Cxx/Filtering/AppendFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AppendFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AppendFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AppendFilter MACOSX_BUNDLE AppendFilter.cxx )\n  target_link_libraries(AppendFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AppendFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/AppendFilter/#download-and-build-appendfilter","title":"Download and Build AppendFilter","text":"

Click here to download AppendFilter and its CMakeLists.txt file. Once the tarball AppendFilter.tar has been downloaded and extracted,

cd AppendFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AppendFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/CombinePolyData/","title":"CombinePolyData","text":"

vtk-examples/Cxx/Filtering/CombinePolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/CombinePolyData/#description","title":"Description","text":"

This example reads two .vtp files (or produces them if not specified as command line arguments), combines them, and displays the result to the screen.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/CombinePolyData/#code","title":"Code","text":"

CombinePolyData.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyData> input1;\n  vtkNew<vtkPolyData> input2;\n\n  if (argc == 1) // command line arguments not specified\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetCenter(5, 0, 0);\n    sphereSource->Update();\n\n    input1->ShallowCopy(sphereSource->GetOutput());\n\n    vtkNew<vtkConeSource> coneSource;\n    coneSource->Update();\n\n    input2->ShallowCopy(coneSource->GetOutput());\n  }\n  else\n  {\n    if (argc != 3)\n    {\n      std::cout << \"argc = \" << argc << std::endl;\n      std::cout << \"Required arguments: File1 File2\" << std::endl;\n      return EXIT_FAILURE;\n    }\n    std::string inputFilename1 = argv[1];\n    std::string inputFilename2 = argv[2];\n    vtkNew<vtkXMLPolyDataReader> reader1;\n    reader1->SetFileName(inputFilename1.c_str());\n    reader1->Update();\n    input1->ShallowCopy(reader1->GetOutput());\n\n    vtkNew<vtkXMLPolyDataReader> reader2;\n    reader2->SetFileName(inputFilename2.c_str());\n    reader2->Update();\n    input2->ShallowCopy(reader2->GetOutput());\n  }\n\n  // Append the two meshes\n  vtkNew<vtkAppendPolyData> appendFilter;\n  appendFilter->AddInputData(input1);\n  appendFilter->AddInputData(input2);\n\n  // Remove any duplicate points.\n  vtkNew<vtkCleanPolyData> cleanFilter;\n  cleanFilter->SetInputConnection(appendFilter->GetOutputPort());\n  cleanFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cleanFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n\n  // Render and interact\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  renderer->SetBackground(colors->GetColor3d(\"deep_ochre\").GetData());\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderWindow->SetWindowName(\"CombinePolyData\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/CombinePolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CombinePolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CombinePolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CombinePolyData MACOSX_BUNDLE CombinePolyData.cxx )\n  target_link_libraries(CombinePolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CombinePolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/CombinePolyData/#download-and-build-combinepolydata","title":"Download and Build CombinePolyData","text":"

Click here to download CombinePolyData and its CMakeLists.txt file. Once the tarball CombinePolyData.tar has been downloaded and extracted,

cd CombinePolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CombinePolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/ConnectivityFilter/","title":"ConnectivityFilter","text":"

vtk-examples/Cxx/Filtering/ConnectivityFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/ConnectivityFilter/#code","title":"Code","text":"

ConnectivityFilter.cxx

#include <vtkActor.h>\n#include <vtkAppendFilter.h>\n#include <vtkCamera.h>\n#include <vtkConnectivityFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDelaunay3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->Update();\n\n  vtkNew<vtkDelaunay3D> delaunay1;\n  delaunay1->SetInputConnection(sphereSource1->GetOutputPort());\n  delaunay1->Update();\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(5, 0, 0);\n  sphereSource2->Update();\n\n  vtkNew<vtkDelaunay3D> delaunay2;\n  delaunay2->SetInputConnection(sphereSource2->GetOutputPort());\n  delaunay2->Update();\n\n  vtkNew<vtkAppendFilter> appendFilter;\n  appendFilter->AddInputConnection(delaunay1->GetOutputPort());\n  appendFilter->AddInputConnection(delaunay2->GetOutputPort());\n  appendFilter->Update();\n\n  vtkNew<vtkConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputConnection(appendFilter->GetOutputPort());\n  connectivityFilter->SetExtractionModeToAllRegions();\n  connectivityFilter->ColorRegionsOn();\n  connectivityFilter->Update();\n\n  // Visualize\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(connectivityFilter->GetOutputPort());\n  mapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(renderer);\n  renwin->Render();\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n\n  iren->Initialize();\n  renwin->Render();\n  renderer->SetBackground(colors->GetColor3d(\"deep_ochre\").GetData());\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renwin->SetWindowName(\"ConnectivityFilter\");\n  renwin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/ConnectivityFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConnectivityFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConnectivityFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConnectivityFilter MACOSX_BUNDLE ConnectivityFilter.cxx )\n  target_link_libraries(ConnectivityFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConnectivityFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/ConnectivityFilter/#download-and-build-connectivityfilter","title":"Download and Build ConnectivityFilter","text":"

Click here to download ConnectivityFilter and its CMakeLists.txt file. Once the tarball ConnectivityFilter.tar has been downloaded and extracted,

cd ConnectivityFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConnectivityFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/ConnectivityFilterDemo/","title":"ConnectivityFilterDemo","text":"

vtk-examples/Cxx/Filtering/ConnectivityFilterDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/ConnectivityFilterDemo/#description","title":"Description","text":"

This example uses vtkPolyDataConnectivity to separate an input vtkPolyData into disconnected regions. Each region is assigned a unique color. A number of vtkNamedColors are used to fill part of the vtkLookupTable. If the number of extracted regions is more that the number of specified colors, the remaining colors are generated with a random number generator.

The default representation is surface. If the user types a \"w\" in the render window, the view will be rendered as a wireframe. The renderer will use hidden line removal.

The example supports any vtkPolyData reader.

Info

ConnectivityFilter illustrates vtkConnectivityFilter on a simple 2 region dataset.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/ConnectivityFilterDemo/#code","title":"Code","text":"

ConnectivityFilterDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\n#include <random>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputData(polyData);\n  connectivityFilter->SetExtractionModeToAllRegions();\n  connectivityFilter->ColorRegionsOn();\n  connectivityFilter->Update();\n\n  // Visualize\n  int numberOfRegions = connectivityFilter->GetNumberOfExtractedRegions();\n  if (argc > 1)\n  {\n    std::cout << argv[1] << \" contains \" << numberOfRegions << \" regions\"\n              << std::endl;\n  }\n  else\n  {\n    std::cout << \"Generated data\"\n              << \" contains \" << numberOfRegions << \" regions\" << std::endl;\n  }\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(std::max(numberOfRegions, 10));\n  lut->Build();\n\n  // Fill in a few known colors, the rest will be generated if needed.\n  vtkNew<vtkNamedColors> colors;\n  lut->SetTableValue(0, colors->GetColor4d(\"Gold\").GetData());\n  lut->SetTableValue(1, colors->GetColor4d(\"Banana\").GetData());\n  lut->SetTableValue(2, colors->GetColor4d(\"Tomato\").GetData());\n  lut->SetTableValue(3, colors->GetColor4d(\"Wheat\").GetData());\n  lut->SetTableValue(4, colors->GetColor4d(\"Lavender\").GetData());\n  lut->SetTableValue(5, colors->GetColor4d(\"Flesh\").GetData());\n  lut->SetTableValue(6, colors->GetColor4d(\"Raspberry\").GetData());\n  lut->SetTableValue(7, colors->GetColor4d(\"Salmon\").GetData());\n  lut->SetTableValue(8, colors->GetColor4d(\"Mint\").GetData());\n  lut->SetTableValue(9, colors->GetColor4d(\"Peacock\").GetData());\n\n  // If the number of regions os larger than the number of specified colors,\n  // generate some random colors.\n  if (numberOfRegions > 9)\n  {\n    std::mt19937 mt(4355412); // Standard mersenne_twister_engine.\n    std::uniform_real_distribution<double> distribution(.4, 1.0);\n    for (auto i = 10; i < numberOfRegions; ++i)\n    {\n      lut->SetTableValue(i, distribution(mt), distribution(mt),\n                         distribution(mt), 1.0);\n    }\n  }\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(connectivityFilter->GetOutputPort());\n  mapper->SetScalarRange(0,\n                         connectivityFilter->GetNumberOfExtractedRegions() - 1);\n  mapper->SetLookupTable(lut);\n  mapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->UseHiddenLineRemovalOn();\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  // Pick a good view\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  renderer->GetActiveCamera()->SetPosition(0.0, 1.0, 0.0);\n  renderer->GetActiveCamera()->SetViewUp(0.0, 0.0, 1.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Elevation(45.0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetWindowName(\"ConnectivityFilterDemo\");\n  renderWindow->Render();\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Filtering/ConnectivityFilterDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConnectivityFilterDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConnectivityFilterDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConnectivityFilterDemo MACOSX_BUNDLE ConnectivityFilterDemo.cxx )\n  target_link_libraries(ConnectivityFilterDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConnectivityFilterDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/ConnectivityFilterDemo/#download-and-build-connectivityfilterdemo","title":"Download and Build ConnectivityFilterDemo","text":"

Click here to download ConnectivityFilterDemo and its CMakeLists.txt file. Once the tarball ConnectivityFilterDemo.tar has been downloaded and extracted,

cd ConnectivityFilterDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConnectivityFilterDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/ConstrainedDelaunay2D/","title":"ConstrainedDelaunay2D","text":"

vtk-examples/Cxx/Filtering/ConstrainedDelaunay2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/ConstrainedDelaunay2D/#description","title":"Description","text":"

Perform a 2D Delaunay triangulation respecting a specified boundary. This examples constructs a 10x10 grid of points. It then defines a polygon that uses the points in the grid. We want to triangulate all of the points except the region inside the boundary of the polygon. We expect a rectangular hole of size 4x3 in the resulting triangulated plane.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/ConstrainedDelaunay2D/#code","title":"Code","text":"

ConstrainedDelaunay2D.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkDelaunay2D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolygon.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Generate a 10 x 10 grid of points\n  vtkNew<vtkPoints> points;\n  unsigned int gridSize = 10;\n  unsigned int seed = 0;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->Initialize(seed);\n  for (unsigned int x = 0; x < gridSize; x++)\n  {\n    for (unsigned int y = 0; y < gridSize; y++)\n    {\n      auto d1 = randomSequence->GetValue() / 2.0 - 0.25;\n      randomSequence->Next();\n      auto d2 = randomSequence->GetValue() / 2.0 - 0.25;\n      randomSequence->Next();\n      points->InsertNextPoint(x + d1, y + d2, 0);\n    }\n  }\n\n  vtkNew<vtkPolyData> aPolyData;\n  aPolyData->SetPoints(points);\n\n  // Create a cell array to store the polygon in\n  vtkNew<vtkCellArray> aCellArray;\n\n  // Define a polygonal hole with a clockwise polygon\n  vtkNew<vtkPolygon> aPolygon;\n\n  aPolygon->GetPointIds()->InsertNextId(22);\n  aPolygon->GetPointIds()->InsertNextId(23);\n  aPolygon->GetPointIds()->InsertNextId(24);\n  aPolygon->GetPointIds()->InsertNextId(25);\n  aPolygon->GetPointIds()->InsertNextId(35);\n  aPolygon->GetPointIds()->InsertNextId(45);\n  aPolygon->GetPointIds()->InsertNextId(44);\n  aPolygon->GetPointIds()->InsertNextId(43);\n  aPolygon->GetPointIds()->InsertNextId(42);\n  aPolygon->GetPointIds()->InsertNextId(32);\n\n  aCellArray->InsertNextCell(aPolygon);\n\n  // Create a polydata to store the boundary. The points must be the\n  // same as the points we will triangulate.\n  vtkNew<vtkPolyData> boundary;\n  boundary->SetPoints(aPolyData->GetPoints());\n  boundary->SetPolys(aCellArray);\n\n  // Triangulate the grid points\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(aPolyData);\n  delaunay->SetSourceData(boundary);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> meshMapper;\n  meshMapper->SetInputConnection(delaunay->GetOutputPort());\n\n  vtkNew<vtkActor> meshActor;\n  meshActor->SetMapper(meshMapper);\n  meshActor->GetProperty()->EdgeVisibilityOn();\n  meshActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n  meshActor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkPolyDataMapper> boundaryMapper;\n  boundaryMapper->SetInputData(boundary);\n\n  vtkNew<vtkActor> boundaryActor;\n  boundaryActor->SetMapper(boundaryMapper);\n  boundaryActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Raspberry\").GetData());\n  boundaryActor->GetProperty()->SetLineWidth(3);\n  boundaryActor->GetProperty()->EdgeVisibilityOn();\n  boundaryActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"Red\").GetData());\n  boundaryActor->GetProperty()->SetRepresentationToWireframe();\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(meshActor);\n  renderer->AddActor(boundaryActor);\n  renderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  // Render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ConstrainedDelaunay2D\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/ConstrainedDelaunay2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConstrainedDelaunay2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConstrainedDelaunay2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConstrainedDelaunay2D MACOSX_BUNDLE ConstrainedDelaunay2D.cxx )\n  target_link_libraries(ConstrainedDelaunay2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConstrainedDelaunay2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/ConstrainedDelaunay2D/#download-and-build-constraineddelaunay2d","title":"Download and Build ConstrainedDelaunay2D","text":"

Click here to download ConstrainedDelaunay2D and its CMakeLists.txt file. Once the tarball ConstrainedDelaunay2D.tar has been downloaded and extracted,

cd ConstrainedDelaunay2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConstrainedDelaunay2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/ContoursFromPolyData/","title":"ContoursFromPolyData","text":"

vtk-examples/Cxx/Filtering/ContoursFromPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/ContoursFromPolyData/#description","title":"Description","text":"

This example uses vtkCutter to generate contours from a PolyData. A vtkPlane is set at the center of the PolyData and several contours are generated by specifying contour values that are distances to the center plane. The example works with a filename if provided. Otherwise is uses a vtkSphereSource.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/ContoursFromPolyData/#code","title":"Code","text":"

ContoursFromPolyData.cxx

#include <vtkActor.h>\n#include <vtkCutter.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    inputPolyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(30);\n    sphereSource->SetPhiResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputData(inputPolyData);\n\n  // Create a plane to cut\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(inputPolyData->GetCenter());\n  plane->SetNormal(1, 1, 1);\n\n  double minBound[3];\n  minBound[0] = inputPolyData->GetBounds()[0];\n  minBound[1] = inputPolyData->GetBounds()[2];\n  minBound[2] = inputPolyData->GetBounds()[4];\n\n  double maxBound[3];\n  maxBound[0] = inputPolyData->GetBounds()[1];\n  maxBound[1] = inputPolyData->GetBounds()[3];\n  maxBound[2] = inputPolyData->GetBounds()[5];\n\n  double center[3];\n  center[0] = inputPolyData->GetCenter()[0];\n  center[1] = inputPolyData->GetCenter()[1];\n  center[2] = inputPolyData->GetCenter()[2];\n\n  double distanceMin = sqrt(vtkMath::Distance2BetweenPoints(minBound, center));\n  double distanceMax = sqrt(vtkMath::Distance2BetweenPoints(maxBound, center));\n\n  // Create cutter.\n  vtkNew<vtkCutter> cutter;\n  cutter->SetCutFunction(plane);\n  cutter->SetInputData(inputPolyData);\n\n  cutter->GenerateValues(20, -distanceMin, distanceMax);\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n  cutterMapper->ScalarVisibilityOff();\n\n  // Create plane actor.\n  vtkNew<vtkActor> planeActor;\n  planeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Deep_pink\").GetData());\n  planeActor->GetProperty()->SetLineWidth(5);\n  planeActor->SetMapper(cutterMapper);\n\n  // Create input actor.\n  vtkNew<vtkActor> inputActor;\n  inputActor->GetProperty()->SetColor(colors->GetColor3d(\"Bisque\").GetData());\n  inputActor->SetMapper(inputMapper);\n\n  // Create renderers and add actors of plane and cube.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(planeActor); // Display the rectangle resulting from the\n                                  // cut.\n  renderer->AddActor(inputActor); // Display the cube.\n\n  // Add renderer to renderwindow and render\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ContoursFromPolyData\");\n  renderWindow->SetSize(600, 600);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderer->SetBackground(colors->GetColor3d(\"Slate_grey\").GetData());\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/ContoursFromPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ContoursFromPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ContoursFromPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ContoursFromPolyData MACOSX_BUNDLE ContoursFromPolyData.cxx )\n  target_link_libraries(ContoursFromPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ContoursFromPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/ContoursFromPolyData/#download-and-build-contoursfrompolydata","title":"Download and Build ContoursFromPolyData","text":"

Click here to download ContoursFromPolyData and its CMakeLists.txt file. Once the tarball ContoursFromPolyData.tar has been downloaded and extracted,

cd ContoursFromPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ContoursFromPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/Delaunay2D/","title":"Delaunay2D","text":"

vtk-examples/Cxx/Filtering/Delaunay2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/Delaunay2D/#description","title":"Description","text":"

This example generates a set of points aligned with an XY grid with random heights (z values). The Delaunay2D filter \"magically\" knows how to triangulate this type of point set because it projects the points by default onto the XY axis and then performs a 2D Delaunay triangulation. The result is a mesh on the input points.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/Delaunay2D/#code","title":"Code","text":"

Delaunay2D.cxx

#include <vtkActor.h>\n#include <vtkDelaunay2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a set of heights on a grid.\n  // This is often called a \"terrain map\".\n  vtkNew<vtkPoints> points;\n\n  unsigned int gridSize = 10;\n  for (unsigned int x = 0; x < gridSize; x++)\n  {\n    for (unsigned int y = 0; y < gridSize; y++)\n    {\n      points->InsertNextPoint(x, y, (x + y) / (y + 1));\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Triangulate the grid points\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(polydata);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> meshMapper;\n  meshMapper->SetInputConnection(delaunay->GetOutputPort());\n\n  vtkNew<vtkActor> meshActor;\n  meshActor->SetMapper(meshMapper);\n  meshActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  meshActor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n\n  vtkNew<vtkPolyDataMapper> pointMapper;\n  pointMapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  pointActor->GetProperty()->SetPointSize(5);\n  pointActor->SetMapper(pointMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(meshActor);\n  renderer->AddActor(pointActor);\n  renderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  renderWindow->SetWindowName(\"Delaunay2D\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/Delaunay2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Delaunay2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Delaunay2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Delaunay2D MACOSX_BUNDLE Delaunay2D.cxx )\n  target_link_libraries(Delaunay2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Delaunay2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/Delaunay2D/#download-and-build-delaunay2d","title":"Download and Build Delaunay2D","text":"

Click here to download Delaunay2D and its CMakeLists.txt file. Once the tarball Delaunay2D.tar has been downloaded and extracted,

cd Delaunay2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Delaunay2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/ExtractVisibleCells/","title":"ExtractVisibleCells","text":"

vtk-examples/Cxx/Filtering/ExtractVisibleCells

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/ExtractVisibleCells/#code","title":"Code","text":"

ExtractVisibleCells.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkHardwareSelector.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSelection.h>\n#include <vtkSphereSource.h>\n\n// Define interaction style\nclass KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  vtkNew<vtkNamedColors> colors;\n  static KeyPressInteractorStyle* New();\n  vtkTypeMacro(KeyPressInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnKeyPress() override\n  {\n    // Get the keypress\n    std::string key = this->Interactor->GetKeySym();\n\n    // \"s\" for \"s\"elect\n    if (key.compare(\"s\") == 0)\n    {\n      vtkNew<vtkHardwareSelector> selector;\n      selector->SetRenderer(this->Interactor->GetRenderWindow()\n                                ->GetRenderers()\n                                ->GetFirstRenderer());\n      int* temp = this->Interactor->GetRenderWindow()->GetSize();\n      unsigned int windowSize[4];\n      windowSize[0] = temp[2];\n      windowSize[1] = temp[3];\n      windowSize[2] = temp[0];\n      windowSize[3] = temp[1];\n      /*\n        for(unsigned int i = 0; i < 4; i++)\n          {\n          windowSize[i] = temp[i];\n          }\n        */\n      selector->SetArea(windowSize);\n      selector->SetFieldAssociation(vtkDataObject::FIELD_ASSOCIATION_CELLS);\n      vtkSelection* selection = selector->Select();\n      std::cout << \"Selection has \" << selection->GetNumberOfNodes()\n                << \" nodes.\" << std::endl;\n\n      vtkNew<vtkExtractSelection> extractSelection;\n      extractSelection->SetInputData(0, this->Data);\n      extractSelection->SetInputData(1, selection);\n      extractSelection->Update();\n\n      vtkNew<vtkDataSetMapper> mapper;\n      mapper->SetInputConnection(extractSelection->GetOutputPort());\n\n      vtkNew<vtkActor> actor;\n      actor->SetMapper(mapper);\n      actor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n      this->Renderer->AddActor(actor);\n    }\n\n    // Forward events\n    vtkInteractorStyleTrackballCamera::OnKeyPress();\n  }\n\n  vtkPolyData* Data;\n  vtkRenderer* Renderer;\n};\nvtkStandardNewMacro(KeyPressInteractorStyle);\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetMultiSamples(0); // Turn off anti-aliasing\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<KeyPressInteractorStyle> style;\n  style->Renderer = renderer;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->SetCurrentRenderer(renderer);\n  style->Data = sphereSource->GetOutput();\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"ExtractVisibleCells\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/ExtractVisibleCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractVisibleCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractVisibleCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractVisibleCells MACOSX_BUNDLE ExtractVisibleCells.cxx )\n  target_link_libraries(ExtractVisibleCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractVisibleCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/ExtractVisibleCells/#download-and-build-extractvisiblecells","title":"Download and Build ExtractVisibleCells","text":"

Click here to download ExtractVisibleCells and its CMakeLists.txt file. Once the tarball ExtractVisibleCells.tar has been downloaded and extracted,

cd ExtractVisibleCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractVisibleCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/GaussianSplat/","title":"GaussianSplat","text":"

vtk-examples/Cxx/Filtering/GaussianSplat

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/GaussianSplat/#code","title":"Code","text":"

GaussianSplat.cxx

#include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create points on a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(sphereSource->GetOutput()->GetPoints());\n\n  vtkNew<vtkGaussianSplatter> splatter;\n  splatter->SetInputData(polydata);\n  splatter->SetSampleDimensions(50, 50, 50);\n  splatter->SetRadius(0.5);\n  splatter->ScalarWarpingOff();\n\n  vtkNew<vtkContourFilter> surface;\n  surface->SetInputConnection(splatter->GetOutputPort());\n  surface->SetValue(0, 0.01);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->SetWindowName(\"GaussianSplat\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/GaussianSplat/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GaussianSplat)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GaussianSplat: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GaussianSplat MACOSX_BUNDLE GaussianSplat.cxx )\n  target_link_libraries(GaussianSplat PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GaussianSplat\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/GaussianSplat/#download-and-build-gaussiansplat","title":"Download and Build GaussianSplat","text":"

Click here to download GaussianSplat and its CMakeLists.txt file. Once the tarball GaussianSplat.tar has been downloaded and extracted,

cd GaussianSplat/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GaussianSplat\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/GenericClip/","title":"GenericClip","text":"

vtk-examples/Cxx/Filtering/GenericClip

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/GenericClip/#description","title":"Description","text":"

Warning

This example requires vtk 6.0 or greater.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/GenericClip/#code","title":"Code","text":"

GenericClip.cxx

#include <vtkActor.h>\n#include <vtkBridgeDataSet.h> // Must build VTK with BUILD_TESTING=ON\n#include <vtkCellData.h>\n#include <vtkContourFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGenericClip.h>\n#include <vtkIdFilter.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // If we try to use a PointSource with vtkBridgeDataSet, an error is produced:\n  //    vtkBridgeCell.cxx:141: virtual int vtkBridgeCell::GetType(): Assertion\n  //    `\"check: impossible case\" && 0' failed.\n  // There does not seem to be a case to handle VTK_VERTEX (which is what is\n  // produced by PointSource) in vtkBridgeDataSet.\n  //  vtkNew<vtkPointSource> pointSource;\n  //  pointSource->SetNumberOfPoints(100);\n  //  pointSource->SetRadius(1.0);\n  //  pointSource->Update();\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(5);\n  sphereSource->SetThetaResolution(10);\n  sphereSource->SetPhiResolution(10);\n  sphereSource->Update();\n\n  // Add ids to the points and cells of the sphere\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputConnection(sphereSource->GetOutputPort());\n  idFilter->Update();\n\n  // Create a plane to clip with\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(0, 0, 0);\n  plane->SetNormal(1, 1, 1);\n\n  // Convert the DataSet to a GenericDataSet\n  vtkNew<vtkBridgeDataSet> bridgeDataSet;\n  bridgeDataSet->SetDataSet(idFilter->GetOutput());\n\n  vtkNew<vtkGenericClip> clipper;\n  clipper->SetClipFunction(plane);\n  clipper->SetInputData(bridgeDataSet);\n  clipper->Update();\n\n  // Get the clipped cell ids\n  vtkUnstructuredGrid* clipped = clipper->GetOutput();\n  vtkIdTypeArray* originalIds = dynamic_cast<vtkIdTypeArray*>(\n      clipped->GetCellData()->GetArray(\"vtkIdFilter_Ids\"));\n  for (vtkIdType i = 0; i < originalIds->GetNumberOfTuples(); ++i)\n  {\n    std::cout << \"new id \" << i << \", original id \" << originalIds->GetValue(i)\n              << std::endl;\n  }\n\n  // Create a mapper and actor for clipped points\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(clipper->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a mapper and actor for clipping function\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(20, 20, 20);\n  sample->SetImplicitFunction(plane);\n  double value = 10.0;\n  double xmin = -value, xmax = value, ymin = -value, ymax = value,\n         zmin = -value, zmax = value;\n  sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n  // Create the 0 isosurface\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(1, 1, 1);\n\n  // Map the contours to graphical primitives\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contours->GetOutputPort());\n  contourMapper->SetScalarRange(0.0, 1.2);\n\n  // Create an actor for the sphere\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(contourMapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"Burlywood\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n  // Render and interact\n  renderWindow->SetWindowName(\"GenericClip\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/GenericClip/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GenericClip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneric\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  TestingGenericBridge\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GenericClip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GenericClip MACOSX_BUNDLE GenericClip.cxx )\n  target_link_libraries(GenericClip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GenericClip\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/GenericClip/#download-and-build-genericclip","title":"Download and Build GenericClip","text":"

Click here to download GenericClip and its CMakeLists.txt file. Once the tarball GenericClip.tar has been downloaded and extracted,

cd GenericClip/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GenericClip\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/Glyph2D/","title":"Glyph2D","text":"

vtk-examples/Cxx/Filtering/Glyph2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/Glyph2D/#description","title":"Description","text":"

Copy a polydata to every point in the input set. We use a hexagon for the demo.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/Glyph2D/#code","title":"Code","text":"

Glyph2D.cxx

#include <vtkActor.h>\n#include <vtkGlyph2D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRegularPolygonSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(2, 2, 0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create anything you want here, we will use a polygon for the demo.\n  vtkNew<vtkRegularPolygonSource> polygonSource; // default is 6 sides\n\n  vtkNew<vtkGlyph2D> glyph2D;\n  glyph2D->SetSourceConnection(polygonSource->GetOutputPort());\n  glyph2D->SetInputData(polydata);\n  glyph2D->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph2D->GetOutputPort());\n  mapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Salmon\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkInteractorStyleImage> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindow->SetWindowName(\"Glyph2D\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/Glyph2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Glyph2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Glyph2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Glyph2D MACOSX_BUNDLE Glyph2D.cxx )\n  target_link_libraries(Glyph2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Glyph2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/Glyph2D/#download-and-build-glyph2d","title":"Download and Build Glyph2D","text":"

Click here to download Glyph2D and its CMakeLists.txt file. Once the tarball Glyph2D.tar has been downloaded and extracted,

cd Glyph2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Glyph2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/Glyph3D/","title":"Glyph3D","text":"

vtk-examples/Cxx/Filtering/Glyph3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/Glyph3D/#description","title":"Description","text":"

This example applies an object at every point. We use a cube for the demo.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/Glyph3D/#code","title":"Code","text":"

Glyph3D.cxx

#include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(2, 2, 0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create anything you want here, we will use a cube for the demo.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetSourceConnection(cubeSource->GetOutputPort());\n  glyph3D->SetInputData(polydata);\n  glyph3D->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Salmon\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetWindowName(\"Glyph3D\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/Glyph3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Glyph3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Glyph3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Glyph3D MACOSX_BUNDLE Glyph3D.cxx )\n  target_link_libraries(Glyph3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Glyph3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/Glyph3D/#download-and-build-glyph3d","title":"Download and Build Glyph3D","text":"

Click here to download Glyph3D and its CMakeLists.txt file. Once the tarball Glyph3D.tar has been downloaded and extracted,

cd Glyph3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Glyph3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/ImplicitBoolean/","title":"ImplicitBoolean","text":"

vtk-examples/Cxx/Filtering/ImplicitBoolean

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/ImplicitBoolean/#code","title":"Code","text":"

ImplicitBoolean.cxx

#include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\nint main(int, char*[])\n{\n  // Define colors\n  vtkNew<vtkNamedColors> colors;\n  //  vtkColor3d background = colors->GetColor3d(\"SlateGray\");\n  //  vtkColor3d actorColor = colors->GetColor3d(\"hot_pink\");\n\n  vtkNew<vtkSphere> sphere1;\n  sphere1->SetCenter(0.9, 0, 0);\n  vtkNew<vtkSphere> sphere2;\n  sphere2->SetCenter(-0.9, 0, 0);\n\n  vtkNew<vtkImplicitBoolean> implicitBoolean;\n  implicitBoolean->AddFunction(sphere1);\n  implicitBoolean->AddFunction(sphere2);\n  implicitBoolean->SetOperationTypeToUnion();\n\n  //  implicitBoolean->SetOperationTypeToIntersection();\n  //  implicitBoolean->SetOperationTypeToDifference();\n\n  // Sample the function\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(implicitBoolean);\n  double value = 3.0;\n  double xmin = -value, xmax = value, ymin = -value, ymax = value,\n         zmin = -value, zmax = value;\n  sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n  // Create the 0 isosurface\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(1, 1, 1);\n\n  // Map the contours to graphical primitives\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contours->GetOutputPort());\n  contourMapper->ScalarVisibilityOff();\n\n  // Create an actor for the contours\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n  contourActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"hot_pink\").GetData());\n  contourActor->GetProperty()->SetDiffuse(.8);\n  contourActor->GetProperty()->SetSpecular(.2);\n  contourActor->GetProperty()->SetSpecularPower(60.0);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ImplicitBoolean\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(contourActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/ImplicitBoolean/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitBoolean)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitBoolean: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitBoolean MACOSX_BUNDLE ImplicitBoolean.cxx )\n  target_link_libraries(ImplicitBoolean PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitBoolean\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/ImplicitBoolean/#download-and-build-implicitboolean","title":"Download and Build ImplicitBoolean","text":"

Click here to download ImplicitBoolean and its CMakeLists.txt file. Once the tarball ImplicitBoolean.tar has been downloaded and extracted,

cd ImplicitBoolean/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitBoolean\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/ImplicitBooleanDemo/","title":"ImplicitBooleanDemo","text":"

vtk-examples/Cxx/Filtering/ImplicitBooleanDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/ImplicitBooleanDemo/#code","title":"Code","text":"

ImplicitBooleanDemo.cxx

#include <vtkActor.h>\n#include <vtkBox.h>\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\nint main(int /* argc */, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // create a sphere\n  vtkNew<vtkSphere> sphere;\n  sphere->SetRadius(1);\n  sphere->SetCenter(1, 0, 0);\n\n  // create a box\n  vtkNew<vtkBox> box;\n  box->SetBounds(-1, 1, -1, 1, -1, 1);\n\n  // combine the two implicit functions\n  vtkNew<vtkImplicitBoolean> boolean;\n  boolean->AddFunction(box);\n  boolean->AddFunction(sphere);\n\n  std::vector<vtkNew<vtkRenderer>> ren;\n  ren.push_back(vtkNew<vtkRenderer>());\n  ren.push_back(vtkNew<vtkRenderer>());\n  ren.push_back(vtkNew<vtkRenderer>());\n  ren[0]->SetViewport(0, 0, 1.0 / 3.0, 1);         // Difference\n  ren[1]->SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1); // Union\n  ren[2]->SetViewport(2.0 / 3.0, 0, 1, 1);         // Intersection\n\n  // Shared camera\n  vtkNew<vtkCamera> camera;\n  camera->Azimuth(30.0);\n  camera->Elevation(30.0);\n\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_DIVERGING_SPECTRAL_3);\n\n  for (int i = 0; i < 3; ++i)\n  {\n    if (i == 0)\n    {\n      boolean->SetOperationTypeToDifference();\n    }\n    else if (i == 1)\n    {\n      boolean->SetOperationTypeToUnion();\n    }\n    else\n    {\n      boolean->SetOperationTypeToIntersection();\n    }\n\n    // The sample function generates a distance function from the implicit\n    // function. This is then contoured to get a polygonal surface.\n    vtkNew<vtkSampleFunction> sample;\n    sample->SetImplicitFunction(boolean);\n    sample->SetModelBounds(-1, 2, -1, 1, -1, 1);\n    sample->SetSampleDimensions(100, 100, 100);\n    sample->ComputeNormalsOff();\n\n    // contour\n    vtkNew<vtkContourFilter> surface;\n    surface->SetInputConnection(sample->GetOutputPort());\n    surface->SetValue(0, 0.0);\n    surface->Update();\n\n    vtkNew<vtkPolyData> polyData;\n    polyData->DeepCopy(surface->GetOutput());\n\n    // mapper\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(polyData);\n    mapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    //    actor->GetProperty()->EdgeVisibilityOn();\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"peacock\").GetData());\n\n    // add the actor\n    ren[i]->SetBackground(colorSeries->GetColor(i).GetRed() / 255.0,\n                          colorSeries->GetColor(i).GetGreen() / 255.0,\n                          colorSeries->GetColor(i).GetBlue() / 255.0);\n    ren[i]->SetActiveCamera(camera);\n    ren[i]->AddActor(actor);\n  }\n\n  // render window\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(ren[0]);\n  renwin->AddRenderer(ren[1]);\n  renwin->AddRenderer(ren[2]);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renwin);\n\n  renwin->SetSize(900, 300);\n  renwin->SetWindowName(\"ImplicitBooleanDemo\");\n  renwin->Render();\n  ren[1]->ResetCamera();\n  renwin->Render();\n\n  // Start\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/ImplicitBooleanDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitBooleanDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitBooleanDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitBooleanDemo MACOSX_BUNDLE ImplicitBooleanDemo.cxx )\n  target_link_libraries(ImplicitBooleanDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitBooleanDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/ImplicitBooleanDemo/#download-and-build-implicitbooleandemo","title":"Download and Build ImplicitBooleanDemo","text":"

Click here to download ImplicitBooleanDemo and its CMakeLists.txt file. Once the tarball ImplicitBooleanDemo.tar has been downloaded and extracted,

cd ImplicitBooleanDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitBooleanDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/IterativeClosestPointsTransform/","title":"IterativeClosestPointsTransform","text":"

vtk-examples/Cxx/Filtering/IterativeClosestPointsTransform

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/IterativeClosestPointsTransform/#description","title":"Description","text":"

This demo produces target points (green) which are at the origin and unit length along each axis. It then perturbs the points and shifts each of them 0.3 in +y direction - the resulting points are the \"source\" points (red). It then attempts to move the source points as close as possible to the target points. The resulting points are shown in blue. The noise is added to make the example more realistic. Also, the noise ensures nothing was done wrong (i.e. accidentally using the target points as the result and claiming it worked perfectly when in fact nothing happened!)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/IterativeClosestPointsTransform/#code","title":"Code","text":"

IterativeClosestPointsTransform.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkIterativeClosestPointTransform.h>\n#include <vtkLandmarkTransform.h>\n#include <vtkLine.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVertexGlyphFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nnamespace {\nvoid CreatePolyData(vtkSmartPointer<vtkPolyData> polydata);\nvoid PerturbPolyData(vtkSmartPointer<vtkPolyData> polydata);\nvoid TranslatePolyData(vtkSmartPointer<vtkPolyData> polydata);\nvoid AxesLines(vtkSmartPointer<vtkPolyData> linesPolyData);\n\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph.\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05.\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyData> source;\n  vtkNew<vtkPolyData> target;\n  // An aid to orient the view of the created data.\n  vtkNew<vtkPolyData> linesPolyData;\n  auto createdData = false;\n\n  if (argc == 3)\n  {\n    std::cout << \"Reading data...\" << std::endl;\n    std::string strSource = argv[1];\n    std::string strTarget = argv[2];\n    vtkNew<vtkXMLPolyDataReader> sourceReader;\n    sourceReader->SetFileName(strSource.c_str());\n    sourceReader->Update();\n    source->ShallowCopy(sourceReader->GetOutput());\n\n    vtkNew<vtkXMLPolyDataReader> targetReader;\n    targetReader->SetFileName(strTarget.c_str());\n    targetReader->Update();\n    target->ShallowCopy(targetReader->GetOutput());\n  }\n  else\n  {\n    std::cout << \"Creating data...\" << std::endl;\n    CreatePolyData(source);\n    target->ShallowCopy(source);\n    TranslatePolyData(target);\n    PerturbPolyData(target);\n    AxesLines(linesPolyData);\n    createdData = true;\n  }\n\n  // Setup ICP transform\n  vtkNew<vtkIterativeClosestPointTransform> icp;\n  icp->SetSource(source);\n  icp->SetTarget(target);\n  icp->GetLandmarkTransform()->SetModeToRigidBody();\n  icp->SetMaximumNumberOfIterations(20);\n  // icp->StartByMatchingCentroidsOn();\n  icp->Modified();\n  icp->Update();\n\n  // Get the resulting transformation matrix (this matrix takes the source\n  // points to the target points)\n  vtkSmartPointer<vtkMatrix4x4> m = icp->GetMatrix();\n  std::cout << \"The resulting matrix is: \" << *m << std::endl;\n\n  // Transform the source points by the ICP solution\n  vtkNew<vtkTransformPolyDataFilter> icpTransformFilter;\n  icpTransformFilter->SetInputData(source);\n  icpTransformFilter->SetTransform(icp);\n  icpTransformFilter->Update();\n\n  /*\n  // If you need to take the target points to the source points, the matrix is:\n  icp->Inverse();\n  vtkSmartPointer<vtkMatrix4x4> minv = icp->GetMatrix();\n  std::cout << \"The resulting inverse matrix is: \" << *minv << std::cout;\n  */\n\n  // Visualize\n  // Map the points to spheres\n  auto sourceActor = PointToGlyph(source->GetPoints(), 0.03);\n  sourceActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  auto targetActor = PointToGlyph(target->GetPoints(), 0.03);\n  targetActor->GetProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n\n  auto solutionActor =\n      PointToGlyph(icpTransformFilter->GetOutput()->GetPoints(), 0.03);\n  solutionActor->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n\n  vtkNew<vtkPolyDataMapper> axesMapper;\n  vtkNew<vtkActor> axesActor;\n  if (createdData)\n  {\n    axesMapper->SetInputData(linesPolyData);\n\n    axesActor->SetMapper(axesMapper);\n    axesActor->GetProperty()->SetLineWidth(1);\n  }\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"IterativeClosestPointsTransform\");\n\n  // Add the actor to the scene\n  renderer->AddActor(sourceActor);\n  renderer->AddActor(targetActor);\n  renderer->AddActor(solutionActor);\n  if (createdData)\n  {\n    renderer->AddActor(axesActor);\n  }\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace // anonymous\n{\n\nvoid CreatePolyData(vtkSmartPointer<vtkPolyData> polydata)\n{\n  // This function creates a set of 4 points (the origin and a point unit\n  // distance along each axis)\n\n  vtkNew<vtkPoints> points;\n\n  // Create points\n  double origin[3] = {0.0, 0.0, 0.0};\n  points->InsertNextPoint(origin);\n  double p1[3] = {1.0, 0.0, 0.0};\n  points->InsertNextPoint(p1);\n  double p2[3] = {0.0, 1.0, 0.0};\n  points->InsertNextPoint(p2);\n  double p3[3] = {0.0, 0.0, 1.0};\n  points->InsertNextPoint(p3);\n\n  vtkNew<vtkPolyData> temp;\n  temp->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> vertexFilter;\n  vertexFilter->SetInputData(temp);\n  vertexFilter->Update();\n\n  polydata->ShallowCopy(vertexFilter->GetOutput());\n}\n\nvoid PerturbPolyData(vtkSmartPointer<vtkPolyData> polydata)\n{\n  vtkNew<vtkPoints> points;\n  points->ShallowCopy(polydata->GetPoints());\n\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    points->GetPoint(i, p);\n    double perturb[3];\n    if (i % 3 == 0)\n    {\n      perturb[0] = .1;\n      perturb[1] = 0;\n      perturb[2] = 0;\n    }\n    else if (i % 3 == 1)\n    {\n      perturb[0] = 0;\n      perturb[1] = .1;\n      perturb[2] = 0;\n    }\n    else\n    {\n      perturb[0] = 0;\n      perturb[1] = 0;\n      perturb[2] = .1;\n    }\n\n    for (unsigned int j = 0; j < 3; j++)\n    {\n      p[j] += perturb[j];\n    }\n    points->SetPoint(i, p);\n  }\n\n  polydata->SetPoints(points);\n}\n\nvoid TranslatePolyData(vtkSmartPointer<vtkPolyData> polydata)\n{\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0, .3, 0);\n\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputData(polydata);\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  polydata->ShallowCopy(transformFilter->GetOutput());\n}\n\nvoid AxesLines(vtkSmartPointer<vtkPolyData> linesPolyData)\n{\n  // Create four points\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.5, 0.0, 0.0};\n  double p1[3] = {0.0, 1.5, 0.0};\n  double p2[3] = {0.0, 0.0, 1.5};\n\n  // Create a vtkPoints container and store the points in it\n  vtkNew<vtkPoints> pts;\n  pts->InsertNextPoint(origin);\n  pts->InsertNextPoint(p0);\n  pts->InsertNextPoint(p1);\n  pts->InsertNextPoint(p2);\n\n  // Add the points to the polydata container\n  linesPolyData->SetPoints(pts);\n\n  // Create the lines (between Origin and p0, ,p1, p2)\n  vtkNew<vtkLine> line0;\n  line0->GetPointIds()->SetId(0, 0);\n  line0->GetPointIds()->SetId(1, 1);\n  vtkNew<vtkLine> line1;\n  line1->GetPointIds()->SetId(0, 0);\n  line1->GetPointIds()->SetId(1, 2);\n  vtkNew<vtkLine> line2;\n  line2->GetPointIds()->SetId(0, 0);\n  line2->GetPointIds()->SetId(1, 3);\n\n  // Create a vtkCellArray container and store the lines in it\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line0);\n  lines->InsertNextCell(line1);\n  lines->InsertNextCell(line2);\n\n  // Add the lines to the polydata container\n  linesPolyData->SetLines(lines);\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a vtkUnsignedCharArray container and store the colors in it\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"DarkRed\").GetData());\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"DarkGreen\").GetData());\n  colors->InsertNextTupleValue(\n      namedColors->GetColor3ub(\"MidnightBlue\").GetData());\n\n  // Color the lines.\n  linesPolyData->GetCellData()->SetScalars(colors);\n}\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // end anonymous namespace\n
"},{"location":"Cxx/Filtering/IterativeClosestPointsTransform/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IterativeClosestPointsTransform)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonMath\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IterativeClosestPointsTransform: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IterativeClosestPointsTransform MACOSX_BUNDLE IterativeClosestPointsTransform.cxx )\n  target_link_libraries(IterativeClosestPointsTransform PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IterativeClosestPointsTransform\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/IterativeClosestPointsTransform/#download-and-build-iterativeclosestpointstransform","title":"Download and Build IterativeClosestPointsTransform","text":"

Click here to download IterativeClosestPointsTransform and its CMakeLists.txt file. Once the tarball IterativeClosestPointsTransform.tar has been downloaded and extracted,

cd IterativeClosestPointsTransform/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IterativeClosestPointsTransform\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/LandmarkTransform/","title":"LandmarkTransform","text":"

vtk-examples/Cxx/Filtering/LandmarkTransform

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/LandmarkTransform/#description","title":"Description","text":"

This example creates two point sets which it assumes are known, ordered correspondences. It then transforms Source to Target and displays the matrix used in the transformation.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/LandmarkTransform/#code","title":"Code","text":"

LandmarkTransform.cxx

#include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLandmarkTransform.h>\n#include <vtkLine.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVertexGlyphFilter.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nnamespace {\nvoid AxesLines(vtkSmartPointer<vtkPolyData> linesPolyData);\n\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\n\nint main(int, char*[])\n{\n  /*\n  This demo creates a coordinate frame (+x, +y, +z) of vectors and a rotated,\n  peturbed frame (+z, +y, -x) and aligns the rotated frame to the original as\n  best as possible.\n  */\n\n  vtkNew<vtkNamedColors> colors;\n\n  // An aid to orient the view of the created data.\n  vtkNew<vtkPolyData> linesPolyData;\n  AxesLines(linesPolyData);\n\n  vtkNew<vtkPoints> sourcePoints;\n  double sourcePoint1[3] = {1.0, 0.0, 0.0};\n  sourcePoints->InsertNextPoint(sourcePoint1);\n  double sourcePoint2[3] = {0.0, 1.0, 0.0};\n  sourcePoints->InsertNextPoint(sourcePoint2);\n  double sourcePoint3[3] = {0.0, 0.0, 1.0};\n  sourcePoints->InsertNextPoint(sourcePoint3);\n\n  vtkNew<vtkPoints> targetPoints;\n  double targetPoint1[3] = {0.0, 0.0, 1.1};\n  targetPoints->InsertNextPoint(targetPoint1);\n  double targetPoint2[3] = {0.0, 1.02, 0.0};\n  targetPoints->InsertNextPoint(targetPoint2);\n  double targetPoint3[3] = {-1.11, 0.0, 0.0};\n  targetPoints->InsertNextPoint(targetPoint3);\n\n  // Setup the transform\n  vtkNew<vtkLandmarkTransform> landmarkTransform;\n  landmarkTransform->SetSourceLandmarks(sourcePoints);\n  landmarkTransform->SetTargetLandmarks(targetPoints);\n  landmarkTransform->SetModeToRigidBody();\n  landmarkTransform->Update(); // should this be here?\n\n  vtkNew<vtkPolyData> source;\n  source->SetPoints(sourcePoints);\n\n  vtkNew<vtkPolyData> target;\n  target->SetPoints(targetPoints);\n\n  vtkNew<vtkVertexGlyphFilter> sourceGlyphFilter;\n  sourceGlyphFilter->SetInputData(source);\n  sourceGlyphFilter->Update();\n\n  vtkNew<vtkVertexGlyphFilter> targetGlyphFilter;\n  targetGlyphFilter->SetInputData(target);\n  targetGlyphFilter->Update();\n\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(sourceGlyphFilter->GetOutputPort());\n  transformFilter->SetTransform(landmarkTransform);\n  transformFilter->Update();\n\n  // Display the transformation matrix that was computed\n  vtkMatrix4x4* mat = landmarkTransform->GetMatrix();\n  std::cout << \"Matrix: \" << *mat << std::endl;\n\n  // Visualize\n  // Map the points to spheres\n  auto sourceActor =\n      PointToGlyph(sourceGlyphFilter->GetOutput()->GetPoints(), 0.03);\n  sourceActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  auto targetActor =\n      PointToGlyph(targetGlyphFilter->GetOutput()->GetPoints(), 0.03);\n  targetActor->GetProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n\n  auto solutionActor =\n      PointToGlyph(transformFilter->GetOutput()->GetPoints(), 0.03);\n  solutionActor->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n\n  vtkNew<vtkPolyDataMapper> axesMapper;\n  axesMapper->SetInputData(linesPolyData);\n\n  vtkNew<vtkActor> axesActor;\n  axesActor->SetMapper(axesMapper);\n  axesActor->GetProperty()->SetLineWidth(1);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"LandmarkTransform\");\n\n  // Add the actor to the scene\n  renderer->AddActor(sourceActor);\n  renderer->AddActor(targetActor);\n  renderer->AddActor(solutionActor);\n  renderer->AddActor(axesActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid AxesLines(vtkSmartPointer<vtkPolyData> linesPolyData)\n{\n  // Create four points\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.2, 0.0, 0.0};\n  double p1[3] = {0.0, 1.2, 0.0};\n  double p2[3] = {0.0, 0.0, 1.2};\n\n  // Create a vtkPoints container and store the points in it\n  vtkNew<vtkPoints> pts;\n  pts->InsertNextPoint(origin);\n  pts->InsertNextPoint(p0);\n  pts->InsertNextPoint(p1);\n  pts->InsertNextPoint(p2);\n\n  // Add the points to the polydata container\n  linesPolyData->SetPoints(pts);\n\n  // Create the lines (between Origin and p0, ,p1, p2)\n  vtkNew<vtkLine> line0;\n  line0->GetPointIds()->SetId(0, 0);\n  line0->GetPointIds()->SetId(1, 1);\n  vtkNew<vtkLine> line1;\n  line1->GetPointIds()->SetId(0, 0);\n  line1->GetPointIds()->SetId(1, 2);\n  vtkNew<vtkLine> line2;\n  line2->GetPointIds()->SetId(0, 0);\n  line2->GetPointIds()->SetId(1, 3);\n\n  // Create a vtkCellArray container and store the lines in it\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line0);\n  lines->InsertNextCell(line1);\n  lines->InsertNextCell(line2);\n\n  // Add the lines to the polydata container\n  linesPolyData->SetLines(lines);\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a vtkUnsignedCharArray container and store the colors in it\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"DarkRed\").GetData());\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"DarkGreen\").GetData());\n  colors->InsertNextTupleValue(\n      namedColors->GetColor3ub(\"MidnightBlue\").GetData());\n\n  // Color the lines.\n  linesPolyData->GetCellData()->SetScalars(colors);\n}\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
"},{"location":"Cxx/Filtering/LandmarkTransform/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LandmarkTransform)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonMath\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LandmarkTransform: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LandmarkTransform MACOSX_BUNDLE LandmarkTransform.cxx )\n  target_link_libraries(LandmarkTransform PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LandmarkTransform\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/LandmarkTransform/#download-and-build-landmarktransform","title":"Download and Build LandmarkTransform","text":"

Click here to download LandmarkTransform and its CMakeLists.txt file. Once the tarball LandmarkTransform.tar has been downloaded and extracted,

cd LandmarkTransform/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LandmarkTransform\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/PerlinNoise/","title":"PerlinNoise","text":"

vtk-examples/Cxx/Filtering/PerlinNoise

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/PerlinNoise/#code","title":"Code","text":"

PerlinNoise.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPerlinNoise.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPerlinNoise> perlinNoise;\n  perlinNoise->SetFrequency(2, 1.25, 1.5);\n  perlinNoise->SetPhase(0, 0, 0);\n\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetImplicitFunction(perlinNoise);\n  sample->SetSampleDimensions(65, 65, 20);\n  sample->ComputeNormalsOff();\n\n  vtkNew<vtkContourFilter> surface;\n  surface->SetInputConnection(sample->GetOutputPort());\n  surface->SetValue(0, 0.0);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetWindowName(\"PerlinNoise\");\n  renderWindow->SetSize(300, 300);\n  renderer->ResetCamera();\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/PerlinNoise/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PerlinNoise)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PerlinNoise: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PerlinNoise MACOSX_BUNDLE PerlinNoise.cxx )\n  target_link_libraries(PerlinNoise PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PerlinNoise\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/PerlinNoise/#download-and-build-perlinnoise","title":"Download and Build PerlinNoise","text":"

Click here to download PerlinNoise and its CMakeLists.txt file. Once the tarball PerlinNoise.tar has been downloaded and extracted,

cd PerlinNoise/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PerlinNoise\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/ProgrammableFilter/","title":"ProgrammableFilter","text":"

vtk-examples/Cxx/Filtering/ProgrammableFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/ProgrammableFilter/#code","title":"Code","text":"

ProgrammableFilter.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProgrammableFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nstruct params\n{\n  vtkPolyData* data;\n  vtkProgrammableFilter* filter;\n};\n\nvoid AdjustPoints(void* arguments);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkProgrammableFilter> programmableFilter;\n  programmableFilter->SetInputConnection(sphereSource->GetOutputPort());\n\n  params myParams;\n  myParams.data = sphereSource->GetOutput();\n  myParams.filter = programmableFilter;\n\n  programmableFilter->SetExecuteMethod(AdjustPoints, &myParams);\n  programmableFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(programmableFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBLue\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"ProgrammableFilter\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid AdjustPoints(void* arguments)\n{\n  params* input = static_cast<params*>(arguments);\n\n  vtkPoints* inPts = input->data->GetPoints();\n  vtkIdType numPts = inPts->GetNumberOfPoints();\n  vtkNew<vtkPoints> newPts;\n  newPts->SetNumberOfPoints(numPts);\n\n  for (vtkIdType i = 0; i < numPts / 2; i++)\n  {\n    double p[3];\n    inPts->GetPoint(i, p);\n    p[0] = p[0] + .5;\n    p[1] = p[1] + .5;\n    p[2] = p[2] + .5;\n    newPts->SetPoint(i, p);\n  }\n\n  for (vtkIdType i = numPts / 2; i < numPts; i++)\n  {\n    double p[3];\n    inPts->GetPoint(i, p);\n    p[0] = p[0] - .5;\n    p[1] = p[1] - .5;\n    p[2] = p[2] - .5;\n    newPts->SetPoint(i, p);\n  }\n\n  input->filter->GetPolyDataOutput()->CopyStructure(input->data);\n  input->filter->GetPolyDataOutput()->SetPoints(newPts);\n}\n\n} // namespace\n
"},{"location":"Cxx/Filtering/ProgrammableFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProgrammableFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersProgrammable\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProgrammableFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProgrammableFilter MACOSX_BUNDLE ProgrammableFilter.cxx )\n  target_link_libraries(ProgrammableFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProgrammableFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/ProgrammableFilter/#download-and-build-programmablefilter","title":"Download and Build ProgrammableFilter","text":"

Click here to download ProgrammableFilter and its CMakeLists.txt file. Once the tarball ProgrammableFilter.tar has been downloaded and extracted,

cd ProgrammableFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ProgrammableFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/ProgrammableSource/","title":"ProgrammableSource","text":"

vtk-examples/Cxx/Filtering/ProgrammableSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/ProgrammableSource/#description","title":"Description","text":"

Use a programmable source to generate the points for the Lorenz System

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/ProgrammableSource/#code","title":"Code","text":"

ProgrammableSource.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProgrammableSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\n// https://en.wikipedia.org/wiki/Lorenz_system\nstatic void Lorenz(void* arg)\n{\n  double sigma = 10.0; /* The Lorenz paramaters */\n  double beta = 8.0 / 3.0;\n  double rho = 28.0;\n  double h = .001; /* Integration step size */\n\n  double x, y, z;\n  double xx, yy, zz;\n  x = 0.1;\n  y = 0.1;\n  z = 0.1;\n  vtkNew<vtkPoints> points;\n  // Get to a stable starting point\n  for (int i = 0; i < 1000; ++i)\n  {\n    xx = x + h * sigma * (y - x);\n    yy = y + h * (x * (rho - z) - y);\n    zz = z + h * (x * y - (beta * z));\n    x = xx;\n    y = yy;\n    z = zz;\n  }\n  for (int i = 0; i < 500000; ++i)\n  {\n    xx = x + h * sigma * (y - x);\n    yy = y + h * (x * (rho - z) - y);\n    zz = z + h * (x * y - (beta * z));\n    points->InsertNextPoint(xx, yy, zz);\n    x = xx;\n    y = yy;\n    z = zz;\n  }\n  vtkNew<vtkPolyData> pointsPolydata;\n  pointsPolydata->SetPoints(points);\n  vtkNew<vtkVertexGlyphFilter> vertexFilter;\n  vertexFilter->SetInputData(pointsPolydata);\n  vertexFilter->Update();\n  vtkProgrammableSource* ps = static_cast<vtkProgrammableSource*>(arg);\n  vtkPolyData* output = ps->GetPolyDataOutput();\n  output->DeepCopy(vertexFilter->GetOutput());\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkProgrammableSource> source;\n  source->SetExecuteMethod(Lorenz, source);\n  source->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(source->GetPolyDataOutput());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"RosyBrown\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->SetWindowName(\"ProgrammableSource\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/ProgrammableSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProgrammableSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProgrammableSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProgrammableSource MACOSX_BUNDLE ProgrammableSource.cxx )\n  target_link_libraries(ProgrammableSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProgrammableSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/ProgrammableSource/#download-and-build-programmablesource","title":"Download and Build ProgrammableSource","text":"

Click here to download ProgrammableSource and its CMakeLists.txt file. Once the tarball ProgrammableSource.tar has been downloaded and extracted,

cd ProgrammableSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ProgrammableSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/SelectionSource/","title":"SelectionSource","text":"

vtk-examples/Cxx/Filtering/SelectionSource

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/SelectionSource/#code","title":"Code","text":"

SelectionSource.cxx

#include <vtkExtractSelection.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkSelectionNode.h> // for POINT and INDICES enum values\n#include <vtkSelectionSource.h>\n\nint main(int, char*[])\n{\n  // Note - this generates 50 points and a single poly-vertex cell.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(50);\n  pointSource->Update();\n\n  std::cout << \"There are \" << pointSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n\n  vtkNew<vtkSelectionSource> selectionSource;\n  selectionSource->SetFieldType(vtkSelectionNode::POINT);\n  selectionSource->SetContentType(vtkSelectionNode::INDICES);\n\n  // Without this line, all points are passed through because the 11 points\n  // we will select below are some of the points of the poly-vertex created\n  // by the PointSource, so the cell (by default) gets passed through since\n  // it contains some selected points, so therefore all of the points\n  // (the 50 belonging to the poly-vertex) also get passed through, which\n  // is not what we are trying to demonstrate.\n  selectionSource->SetContainingCells(false);\n\n  for (vtkIdType i = 10; i <= 20; i++)\n  {\n    selectionSource->AddID(0, i);\n  }\n\n  selectionSource->Update();\n\n  vtkNew<vtkExtractSelection> extractSelection;\n  extractSelection->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelection->SetInputConnection(1, selectionSource->GetOutputPort());\n  extractSelection->Update();\n\n  vtkDataSet* ds = dynamic_cast<vtkDataSet*>(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << ds->GetNumberOfPoints() << \" output points.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/SelectionSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectionSource)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectionSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectionSource MACOSX_BUNDLE SelectionSource.cxx )\n  target_link_libraries(SelectionSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectionSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/SelectionSource/#download-and-build-selectionsource","title":"Download and Build SelectionSource","text":"

Click here to download SelectionSource and its CMakeLists.txt file. Once the tarball SelectionSource.tar has been downloaded and extracted,

cd SelectionSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SelectionSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPoints/","title":"SurfaceFromUnorganizedPoints","text":"

vtk-examples/Cxx/Filtering/SurfaceFromUnorganizedPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPoints/#description","title":"Description","text":"

This example creates points on a sphere and then finds the surface through the points. If an optional polydata file is provided, the example operates on the points in that polydata.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPoints/#code","title":"Code","text":"

SurfaceFromUnorganizedPoints.cxx

#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkReverseSense.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSurfaceReconstructionFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  auto input = vtkSmartPointer<vtkPolyData>::New();\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    input = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n    input = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(input->GetPoints());\n\n  // Construct the surface and create isosurface.\n  vtkNew<vtkSurfaceReconstructionFilter> surf;\n  surf->SetInputData(polydata);\n\n  vtkNew<vtkContourFilter> cf;\n  cf->SetInputConnection(surf->GetOutputPort());\n  cf->SetValue(0, 0.0);\n\n  // Sometimes the contouring algorithm can create a volume whose gradient\n  // vector and ordering of polygon (using the right hand rule) are\n  // inconsistent. vtkReverseSense cures this problem.\n  vtkNew<vtkReverseSense> reverse;\n  reverse->SetInputConnection(cf->GetOutputPort());\n  reverse->ReverseCellsOn();\n  reverse->ReverseNormalsOn();\n\n  vtkNew<vtkPolyDataMapper> map;\n  map->SetInputConnection(reverse->GetOutputPort());\n  map->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(map);\n  surfaceActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  surfaceActor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"Seashell\").GetData());\n  surfaceActor->GetProperty()->SetSpecular(.4);\n  surfaceActor->GetProperty()->SetSpecularPower(50);\n\n  // Create the RenderWindow, Renderer and both Actors\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size.\n  renderer->AddActor(surfaceActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  renderWindow->SetWindowName(\"SurfaceFromUnorganizedPoints\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SurfaceFromUnorganizedPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SurfaceFromUnorganizedPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SurfaceFromUnorganizedPoints MACOSX_BUNDLE SurfaceFromUnorganizedPoints.cxx )\n  target_link_libraries(SurfaceFromUnorganizedPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SurfaceFromUnorganizedPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPoints/#download-and-build-surfacefromunorganizedpoints","title":"Download and Build SurfaceFromUnorganizedPoints","text":"

Click here to download SurfaceFromUnorganizedPoints and its CMakeLists.txt file. Once the tarball SurfaceFromUnorganizedPoints.tar has been downloaded and extracted,

cd SurfaceFromUnorganizedPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SurfaceFromUnorganizedPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/","title":"SurfaceFromUnorganizedPointsWithPostProc","text":"

vtk-examples/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/#description","title":"Description","text":"

This example is an extension to the example previously posted at: Create a surface from Unorganized Points

The objective is again to use vtkSurfaceReconstructionFilter to construct a surface from a set of points. However, the direct output of the vtkSurfaceReconstructionFilter does not match with the spatial position of the original point set. Instead, there is a scale change and translation in between. To cure this, in this example we added a post transformation to move the reconstructed surface back to the position of the original points, which in some cases might be more favorable.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/#code","title":"Code","text":"

SurfaceFromUnorganizedPointsWithPostProc.cxx

#include <cmath>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkReverseSense.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSurfaceReconstructionFilter.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\nstatic vtkSmartPointer<vtkPolyData>\ntransform_back(vtkSmartPointer<vtkPoints> pt, vtkSmartPointer<vtkPolyData> pd);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  auto input = vtkSmartPointer<vtkPolyData>::New();\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    input = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n    input = sphereSource->GetOutput();\n  }\n  // Read some points\n  // vtkNew<vtkPoints points;\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(input->GetPoints());\n\n  // Construct the surface and create isosurface.\n  vtkNew<vtkSurfaceReconstructionFilter> surf;\n  surf->SetInputData(polydata);\n\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetInputConnection(surf->GetOutputPort());\n  contourFilter->SetValue(0, 0.0);\n\n  // Sometimes the contouring algorithm can create a volume whose gradient\n  // vector and ordering of polygon (using the right hand rule) are\n  // inconsistent. vtkReverseSense cures this problem.\n  vtkNew<vtkReverseSense> reverse;\n  reverse->SetInputConnection(contourFilter->GetOutputPort());\n  reverse->ReverseCellsOn();\n  reverse->ReverseNormalsOn();\n  reverse->Update();\n\n  // auto newSurf = transform_back(points, reverse->GetOutput());\n\n  vtkNew<vtkPolyDataMapper> map;\n  map->SetInputConnection(reverse->GetOutputPort());\n  map->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(map);\n  surfaceActor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  surfaceActor->GetProperty()->SetSpecularColor(\n      namedColors->GetColor3d(\"Seashell\").GetData());\n  surfaceActor->GetProperty()->SetSpecular(.4);\n  surfaceActor->GetProperty()->SetSpecularPower(50);\n\n  // Create the RenderWindow, Renderer and both Actors\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(surfaceActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"Burlywood\").GetData());\n  renderWindow->SetSize(640, 480);\n\n  interactor->Initialize();\n  renderWindow->SetWindowName(\"SurfaceFromUnorganizedPointsWithPostProc\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> transform_back(vtkSmartPointer<vtkPoints> pt,\n                                            vtkSmartPointer<vtkPolyData> pd)\n{\n  // The reconstructed surface is transformed back to where the\n  // original points are. (Hopefully) it is only a similarity\n  // transformation.\n\n  // 1. Get bounding box of pt, get its minimum corner (left, bottom, least-z),\n  // at c0, pt_bounds\n\n  // 2. Get bounding box of surface pd, get its minimum corner (left, bottom,\n  // least-z), at c1, pd_bounds\n\n  // 3. compute scale as:\n  //       scale = (pt_bounds[1] - pt_bounds[0])/(pd_bounds[1] - pd_bounds[0]);\n\n  // 4. transform the surface by T := T(pt_bounds[0], [2],\n  // [4]).S(scale).T(-pd_bounds[0], -[2], -[4])\n\n  // 1.\n  double pt_bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax)\n  pt->GetBounds(pt_bounds);\n\n  // 2.\n  double pd_bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax)\n  pd->GetBounds(pd_bounds);\n\n  //   // test, make sure it is isotropic\n  //   std::cout<<(pt_bounds[1] - pt_bounds[0])/(pd_bounds[1] -\n  //   pd_bounds[0])<<std::endl; std::cout<<(pt_bounds[3] -\n  //   pt_bounds[2])/(pd_bounds[3] - pd_bounds[2])<<std::endl;\n  //   std::cout<<(pt_bounds[5] - pt_bounds[4])/(pd_bounds[5] -\n  //   pd_bounds[4])<<std::endl;\n  //   // TEST\n\n  // 3\n  double scale = (pt_bounds[1] - pt_bounds[0]) / (pd_bounds[1] - pd_bounds[0]);\n\n  // 4.\n  vtkSmartPointer<vtkTransform> transp;\n  transp->Translate(pt_bounds[0], pt_bounds[2], pt_bounds[4]);\n  transp->Scale(scale, scale, scale);\n  transp->Translate(-pd_bounds[0], -pd_bounds[2], -pd_bounds[4]);\n\n  auto tpd = vtkSmartPointer<vtkTransformPolyDataFilter>::New();\n\n  tpd->SetInputData(pd);\n  tpd->SetTransform(transp);\n  tpd->Update();\n\n  return tpd->GetOutput();\n}\n} // namespace\n
"},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SurfaceFromUnorganizedPointsWithPostProc)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SurfaceFromUnorganizedPointsWithPostProc: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SurfaceFromUnorganizedPointsWithPostProc MACOSX_BUNDLE SurfaceFromUnorganizedPointsWithPostProc.cxx )\n  target_link_libraries(SurfaceFromUnorganizedPointsWithPostProc PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SurfaceFromUnorganizedPointsWithPostProc\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/#download-and-build-surfacefromunorganizedpointswithpostproc","title":"Download and Build SurfaceFromUnorganizedPointsWithPostProc","text":"

Click here to download SurfaceFromUnorganizedPointsWithPostProc and its CMakeLists.txt file. Once the tarball SurfaceFromUnorganizedPointsWithPostProc.tar has been downloaded and extracted,

cd SurfaceFromUnorganizedPointsWithPostProc/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SurfaceFromUnorganizedPointsWithPostProc\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/TransformPolyData/","title":"TransformPolyData","text":"

vtk-examples/Cxx/Filtering/TransformPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/TransformPolyData/#description","title":"Description","text":"

This example demonstrates how to apply a transform to a data set. It uses vtkTransformPolyDataFilter, but it can be replaced with vtkTransformFilter for different types of data sets, including vtkUnstructuredGrid and vtkStructuredGrid. vtkTransformFilter will work with vtkPolyData, too).

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/TransformPolyData/#code","title":"Code","text":"

TransformPolyData.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the polydata geometry\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Set up the actor to display the untransformed polydata\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n\n  // Set up the transform filter\n\n  vtkNew<vtkTransform> translation;\n  translation->Translate(1.0, 2.0, 3.0);\n\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(sphereSource->GetOutputPort());\n  transformFilter->SetTransform(translation);\n  transformFilter->Update();\n\n  // Set up the actor to display the transformed polydata\n\n  vtkNew<vtkPolyDataMapper> transformedMapper;\n  transformedMapper->SetInputConnection(transformFilter->GetOutputPort());\n\n  vtkNew<vtkActor> transformedActor;\n  transformedActor->SetMapper(transformedMapper);\n  transformedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Red\").GetData());\n\n  // Set up the rest of the visualization pipeline\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(originalActor);\n  renderer->AddActor(transformedActor);\n  renderer->SetBackground(colors->GetColor3d(\"Green\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetWindowName(\"TransformPolyData\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/TransformPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformPolyData MACOSX_BUNDLE TransformPolyData.cxx )\n  target_link_libraries(TransformPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/TransformPolyData/#download-and-build-transformpolydata","title":"Download and Build TransformPolyData","text":"

Click here to download TransformPolyData and its CMakeLists.txt file. Once the tarball TransformPolyData.tar has been downloaded and extracted,

cd TransformPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TransformPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/TriangulateTerrainMap/","title":"TriangulateTerrainMap","text":"

vtk-examples/Cxx/Filtering/TriangulateTerrainMap

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/TriangulateTerrainMap/#description","title":"Description","text":"

This example generates heights (z-values) on a 10x10 grid (a terrain map) and triangulates the points.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/TriangulateTerrainMap/#code","title":"Code","text":"

TriangulateTerrainMap.cxx

#include <vtkActor.h>\n#include <vtkDelaunay2D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create points on an XY grid with random Z coordinate.\n  vtkNew<vtkPoints> points;\n\n  unsigned int gridSize = 10;\n  unsigned int seed = 0;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->Initialize(seed);\n  for (unsigned int x = 0; x < gridSize; x++)\n  {\n    for (unsigned int y = 0; y < gridSize; y++)\n    {\n      auto d = randomSequence->GetValue();\n      randomSequence->Next();\n      points->InsertNextPoint(x, y, d * 3.0);\n    }\n  }\n\n  // Add the grid points to a polydata object\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n  glyphFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetPointSize(3);\n  pointsActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  // Triangulate the grid points\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(polydata);\n  delaunay->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> triangulatedMapper;\n  triangulatedMapper->SetInputConnection(delaunay->GetOutputPort());\n\n  vtkNew<vtkActor> triangulatedActor;\n  triangulatedActor->SetMapper(triangulatedMapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(triangulatedActor);\n  renderer->SetBackground(colors->GetColor3d(\"Green\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"TriangulateTerrainMap\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/TriangulateTerrainMap/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TriangulateTerrainMap)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TriangulateTerrainMap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TriangulateTerrainMap MACOSX_BUNDLE TriangulateTerrainMap.cxx )\n  target_link_libraries(TriangulateTerrainMap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TriangulateTerrainMap\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/TriangulateTerrainMap/#download-and-build-triangulateterrainmap","title":"Download and Build TriangulateTerrainMap","text":"

Click here to download TriangulateTerrainMap and its CMakeLists.txt file. Once the tarball TriangulateTerrainMap.tar has been downloaded and extracted,

cd TriangulateTerrainMap/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TriangulateTerrainMap\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/VectorFieldNonZeroExtraction/","title":"VectorFieldNonZeroExtraction","text":"

vtk-examples/Cxx/Filtering/VectorFieldNonZeroExtraction

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/VectorFieldNonZeroExtraction/#code","title":"Code","text":"

VectorFieldNonZeroExtraction.cxx

// #include <vtkDataArray.h>\n// #include <vtkFloatArray.h>\n#include <vtkImageData.h>\n#include <vtkImageMagnitude.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkThresholdPoints.h>\n#include <vtkXMLImageDataWriter.h>\n#include <vtkXMLPolyDataWriter.h>\n\nnamespace {\nvoid CreateVectorField(vtkImageData* image);\nvoid WriteImage(vtkImageData* image, const std::string& fileName);\nvoid WriteVectorField(vtkPolyData* vectorField, const std::string& fileName);\n} // namespace\n\nint main(int, char*[])\n{\n  // Create an image\n  vtkNew<vtkImageData> image;\n  CreateVectorField(image);\n\n  vtkNew<vtkImageMagnitude> magnitudeFilter;\n  magnitudeFilter->SetInputData(image);\n  magnitudeFilter->Update(); // This filter produces a vtkImageData with an\n                             // array named \"Magnitude\".\n\n  image->GetPointData()->AddArray(\n      magnitudeFilter->GetOutput()->GetPointData()->GetScalars());\n  image->GetPointData()->SetActiveScalars(\"Magnitude\");\n\n  vtkNew<vtkThresholdPoints> thresholdPoints;\n  // thresholdPoints->SetInputConnection(magnitudeFilter->GetOutputPort());\n  thresholdPoints->SetInputData(image);\n  thresholdPoints->ThresholdByUpper(.05);\n  thresholdPoints->Update();\n\n  WriteImage(image, \"input.vti\");\n  WriteVectorField(thresholdPoints->GetOutput(), \"output.vtp\");\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateVectorField(vtkImageData* image)\n{\n  // Specify the size of the image data\n  image->SetDimensions(50, 50, 1);\n  image->AllocateScalars(VTK_FLOAT, 3);\n\n  int* dims = image->GetDimensions();\n\n  // Zero the image\n  for (auto y = 0; y < dims[1]; y++)\n  {\n    for (auto x = 0; x < dims[0]; x++)\n    {\n      float* pixel = static_cast<float*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = 0.0;\n      pixel[1] = 0.0;\n      pixel[2] = 0.0;\n    }\n  }\n\n  // Set two of the pixels to non zero values\n  float* pixel = static_cast<float*>(image->GetScalarPointer(20, 20, 0));\n  pixel[0] = -10.0;\n  pixel[1] = 5.0;\n  pixel[2] = 0.0;\n\n  pixel = static_cast<float*>(image->GetScalarPointer(30, 30, 0));\n  pixel[0] = 10.0;\n  pixel[1] = 10.0;\n  pixel[2] = 0.0;\n\n  image->GetPointData()->SetActiveVectors(\"ImageScalars\");\n\n  image->Modified();\n}\n\nvoid WriteVectorField(vtkPolyData* vectorField, const std::string& fileName)\n{\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(fileName.c_str());\n  writer->SetInputData(vectorField);\n  writer->Write();\n}\n\nvoid WriteImage(vtkImageData* image, const std::string& fileName)\n{\n  vtkNew<vtkXMLImageDataWriter> writer;\n  writer->SetFileName(fileName.c_str());\n  writer->SetInputData(image);\n  writer->Write();\n}\n\n} // namespace\n
"},{"location":"Cxx/Filtering/VectorFieldNonZeroExtraction/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorFieldNonZeroExtraction)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  ImagingMath\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorFieldNonZeroExtraction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorFieldNonZeroExtraction MACOSX_BUNDLE VectorFieldNonZeroExtraction.cxx )\n  target_link_libraries(VectorFieldNonZeroExtraction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorFieldNonZeroExtraction\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/VectorFieldNonZeroExtraction/#download-and-build-vectorfieldnonzeroextraction","title":"Download and Build VectorFieldNonZeroExtraction","text":"

Click here to download VectorFieldNonZeroExtraction and its CMakeLists.txt file. Once the tarball VectorFieldNonZeroExtraction.tar has been downloaded and extracted,

cd VectorFieldNonZeroExtraction/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VectorFieldNonZeroExtraction\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/VertexGlyphFilter/","title":"VertexGlyphFilter","text":"

vtk-examples/Cxx/Filtering/VertexGlyphFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Filtering/VertexGlyphFilter/#description","title":"Description","text":"

This example creates a set of points and adds a vertex at each point using vtkVertexGlyphFilter.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/VertexGlyphFilter/#code","title":"Code","text":"

VertexGlyphFilter.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n  namedColors->SetColor(\"Bkg\", 0.3, 0.6, 0.3);\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(2, 2, 2);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->AddInputData(polydata);\n  vertexGlyphFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(10);\n  actor->GetProperty()->SetColor(namedColors->GetColor3d(\"Yellow\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"Green\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"VertexGlyphFilter\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/VertexGlyphFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VertexGlyphFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VertexGlyphFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VertexGlyphFilter MACOSX_BUNDLE VertexGlyphFilter.cxx )\n  target_link_libraries(VertexGlyphFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VertexGlyphFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/VertexGlyphFilter/#download-and-build-vertexglyphfilter","title":"Download and Build VertexGlyphFilter","text":"

Click here to download VertexGlyphFilter and its CMakeLists.txt file. Once the tarball VertexGlyphFilter.tar has been downloaded and extracted,

cd VertexGlyphFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VertexGlyphFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Filtering/WarpTo/","title":"WarpTo","text":"

vtk-examples/Cxx/Filtering/WarpTo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Filtering/WarpTo/#code","title":"Code","text":"

WarpTo.cxx

#include <vtkDataSetMapper.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n#include <vtkWarpTo.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create the RenderWindow, Renderer and both Actors.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create a line\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(0.0, 0.0, 0.0);\n  lineSource->SetPoint2(0.0, 1.0, 0.0);\n  lineSource->SetResolution(20);\n  lineSource->Update();\n\n  // Create a tube (cylinder) around the line.\n  vtkNew<vtkTubeFilter> tubeFilter;\n  tubeFilter->SetInputConnection(lineSource->GetOutputPort());\n  tubeFilter->SetRadius(.01); // default is .5\n  tubeFilter->SetNumberOfSides(50);\n  tubeFilter->Update();\n\n  vtkNew<vtkWarpTo> warpTo;\n  warpTo->SetInputConnection(tubeFilter->GetOutputPort());\n  warpTo->SetPosition(10, 1, 0);\n  warpTo->SetScaleFactor(5);\n  warpTo->AbsoluteOn();\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(warpTo->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(namedColors->GetColor3d(\"Gold\").GetData());\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"Green\").GetData());\n\n  renderWindow->SetWindowName(\"WarpTo\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Filtering/WarpTo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WarpTo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WarpTo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WarpTo MACOSX_BUNDLE WarpTo.cxx )\n  target_link_libraries(WarpTo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WarpTo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Filtering/WarpTo/#download-and-build-warpto","title":"Download and Build WarpTo","text":"

Click here to download WarpTo and its CMakeLists.txt file. Once the tarball WarpTo.tar has been downloaded and extracted,

cd WarpTo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WarpTo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Arrow/","title":"Arrow","text":"

vtk-examples/Cxx/GeometricObjects/Arrow

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Arrow/#description","title":"Description","text":"

vtkArrowSource object appends a cylinder to a cone to form an arrow.

The shaft base is always at (0,0,0). The arrow tip is always at (1,0,0). If \"Invert\" is true, then the ends are flipped i.e. tip is at (0,0,0) while base is at (1, 0, 0).

The resolution of the cone and shaft can be set and default to 6.

The radius of the cone and shaft can be set and default to 0.03 and 0.1. The length of the tip can also be set, and defaults to 0.35.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Arrow/#code","title":"Code","text":"

Arrow.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n  // arrowSource->SetShaftRadius(1.0);\n  // arrowSource->SetTipLength(1.0);\n  arrowSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(arrowSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Arrow\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindow->SetWindowName(\"Arrow\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Arrow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Arrow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Arrow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Arrow MACOSX_BUNDLE Arrow.cxx )\n  target_link_libraries(Arrow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Arrow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Arrow/#download-and-build-arrow","title":"Download and Build Arrow","text":"

Click here to download Arrow and its CMakeLists.txt file. Once the tarball Arrow.tar has been downloaded and extracted,

cd Arrow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Arrow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Axes/","title":"Axes","text":"

vtk-examples/Cxx/GeometricObjects/Axes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Axes/#description","title":"Description","text":"

This example shows how to position an vtkAxesActor in 3D. Notice that position and orientation of the vtkAxesActor is done with a user transform.

Seealso

DisplayCoordinateAxes.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Axes/#code","title":"Code","text":"

Axes.cxx

#include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(0.5);\n\n  // create a mapper\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // create an actor\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n\n  // a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Axes\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(300, 300);\n\n  // an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // add the actors to the scene\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(1.0, 0.0, 0.0);\n\n  vtkNew<vtkAxesActor> axes;\n\n  // The axes are positioned with a user transform\n  axes->SetUserTransform(transform);\n\n  // properties of the axes labels can be set as follows\n  // this sets the x axis label to red\n  // axes->GetXAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(\n  //  colors->GetColor3d(\"Red\").GetData());\n\n  // the actual text of the axis label can be changed:\n  // axes->SetXAxisLabelText(\"test\");\n\n  renderer->AddActor(axes);\n\n  renderer->GetActiveCamera()->Azimuth(50);\n  renderer->GetActiveCamera()->Elevation(-30);\n\n  renderer->ResetCamera();\n  renderWindow->SetWindowName(\"Axes\");\n  renderWindow->Render();\n\n  // begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Axes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Axes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Axes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Axes MACOSX_BUNDLE Axes.cxx )\n  target_link_libraries(Axes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Axes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Axes/#download-and-build-axes","title":"Download and Build Axes","text":"

Click here to download Axes and its CMakeLists.txt file. Once the tarball Axes.tar has been downloaded and extracted,

cd Axes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Axes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Cell3DDemonstration/","title":"Cell3DDemonstration","text":"

vtk-examples/Cxx/GeometricObjects/Cell3DDemonstration

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Cell3DDemonstration/#description","title":"Description","text":"

This is a demonstration of how to construct and display geometric objects using the classes derived from vtkCell3D. For each object we specify the points and cell Ids.

From this we create an unstructured grid. In some cases a vtkCellArray is used and the result is added to the unstructured grid, see: MakePolyhedron() and MakeTetrahedron().

Also demonstrated is the use of vectors to hold the unstructured grids, mappers, actors and renderers.

The resultant objects are then displayed in a grid.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Cell3DDemonstration/#code","title":"Code","text":"

Cell3DDemonstration.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkHexagonalPrism.h>\n#include <vtkHexahedron.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPentagonalPrism.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkPyramid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTetra.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVoxel.h>\n#include <vtkWedge.h>\n\n#include <array>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\nnamespace {\n// These functions return a vtkUnstructured grid corresponding to the object.\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexagonalPrism();\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexahedron();\nvtkSmartPointer<vtkUnstructuredGrid> MakePentagonalPrism();\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyhedron();\nvtkSmartPointer<vtkUnstructuredGrid> MakePyramid();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTetrahedron();\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeVoxel();\nvtkSmartPointer<vtkUnstructuredGrid> MakeWedge();\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  std::vector<std::string> titles;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n\n  std::vector<vtkSmartPointer<vtkUnstructuredGrid>> uGrids;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  uGrids.push_back(MakeHexagonalPrism());\n  titles.push_back(\"Hexagonal Prism\");\n  uGrids.push_back(MakeHexahedron());\n  titles.push_back(\"Hexahedron\");\n  uGrids.push_back(MakePentagonalPrism());\n  titles.push_back(\"Pentagonal Prism\");\n\n  uGrids.push_back(MakePolyhedron());\n  titles.push_back(\"Polyhedron\");\n  uGrids.push_back(MakePyramid());\n  titles.push_back(\"Pyramid\");\n  uGrids.push_back(MakeTetrahedron());\n  titles.push_back(\"Tetrahedron\");\n\n  uGrids.push_back(MakeVoxel());\n  titles.push_back(\"Voxel\");\n  uGrids.push_back(MakeWedge());\n  titles.push_back(\"Wedge\");\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"Cell3D Demonstration\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // Create and link the mappers actors and renderers together.\n  for (unsigned int i = 0; i < uGrids.size(); ++i)\n  {\n    textMappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textActors.push_back(vtkSmartPointer<vtkActor2D>::New());\n\n    mappers.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    mappers[i]->SetInputData(uGrids[i]);\n\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(\n        colors->GetColor3d(\"PeachPuff\").GetData());\n\n    renderers[i]->AddViewProp(actors[i]);\n\n    textMappers[i]->SetInput(titles[i].c_str());\n    textMappers[i]->SetTextProperty(textProperty);\n\n    textActors[i]->SetMapper(textMappers[i]);\n    textActors[i]->SetPosition(120, 16);\n    renderers[i]->AddViewProp(textActors[i]);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  int gridDimensions = 3;\n  int rendererSize = 300;\n\n  renWin->SetSize(rendererSize * gridDimensions, rendererSize * gridDimensions);\n\n  for (int row = 0; row < gridDimensions; row++)\n  {\n    for (int col = 0; col < gridDimensions; col++)\n    {\n      int index = row * gridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (gridDimensions * rendererSize),\n                            static_cast<double>(gridDimensions - (row + 1)) *\n                                rendererSize / (gridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (gridDimensions * rendererSize),\n                            static_cast<double>(gridDimensions - row) *\n                                rendererSize / (gridDimensions * rendererSize)};\n\n      if (index > int(actors.size()) - 1)\n      {\n        // Add a renderer even if there is no actor.\n        // This makes the render window background all the same color.\n        vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();\n        ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n        ren->SetViewport(viewport);\n        renWin->AddRenderer(ren);\n        continue;\n      }\n\n      renderers[index]->SetViewport(viewport);\n      renderers[index]->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(-30);\n      renderers[index]->GetActiveCamera()->Zoom(0.85);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  iRen->Initialize();\n\n  renWin->SetWindowName(\"Cell3DDemonstration\");\n  renWin->Render();\n\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexagonalPrism()\n{\n  // 3D: hexagonal prism: a wedge with an hexagonal base.\n  // Be careful, the base face ordering is different from wedge.\n\n  int numberOfVertices = 12;\n\n  vtkNew<vtkPoints> points;\n\n  points->InsertNextPoint(0.0, 0.0, 1.0);\n  points->InsertNextPoint(1.0, 0.0, 1.0);\n  points->InsertNextPoint(1.5, 0.5, 1.0);\n  points->InsertNextPoint(1.0, 1.0, 1.0);\n  points->InsertNextPoint(0.0, 1.0, 1.0);\n  points->InsertNextPoint(-0.5, 0.5, 1.0);\n\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.5, 0.5, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(-0.5, 0.5, 0.0);\n\n  vtkNew<vtkHexagonalPrism> hexagonalPrism;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    hexagonalPrism->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->InsertNextCell(hexagonalPrism->GetCellType(),\n                     hexagonalPrism->GetPointIds());\n  ug->SetPoints(points);\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexahedron()\n{\n  // A regular hexagon (cube) with all faces square and three squares around\n  // each vertex is created below.\n\n  // Setup the coordinates of eight points\n  // (the two faces must be in counter clockwise\n  // order as viewed from the outside).\n\n  // As an exercise you can modify the coordinates of the points to create\n  // seven topologically distinct convex hexahedras.\n\n  int numberOfVertices = 8;\n\n  // Create the points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 1.0);\n  points->InsertNextPoint(1.0, 0.0, 1.0);\n  points->InsertNextPoint(1.0, 1.0, 1.0);\n  points->InsertNextPoint(0.0, 1.0, 1.0);\n\n  // Create a hexahedron from the points\n  vtkNew<vtkHexahedron> hex;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    hex->GetPointIds()->SetId(i, i);\n  }\n\n  // Add the points and hexahedron to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(hex->GetCellType(), hex->GetPointIds());\n\n  return uGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePentagonalPrism()\n{\n\n  int numberOfVertices = 10;\n\n  // Create the points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(11, 10, 10);\n  points->InsertNextPoint(13, 10, 10);\n  points->InsertNextPoint(14, 12, 10);\n  points->InsertNextPoint(12, 14, 10);\n  points->InsertNextPoint(10, 12, 10);\n  points->InsertNextPoint(11, 10, 14);\n  points->InsertNextPoint(13, 10, 14);\n  points->InsertNextPoint(14, 12, 14);\n  points->InsertNextPoint(12, 14, 14);\n  points->InsertNextPoint(10, 12, 14);\n\n  // Pentagonal Prism\n  vtkNew<vtkPentagonalPrism> pentagonalPrism;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    pentagonalPrism->GetPointIds()->SetId(i, i);\n  }\n\n  // Add the points and hexahedron to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(pentagonalPrism->GetCellType(),\n                        pentagonalPrism->GetPointIds());\n\n  return uGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyhedron()\n{\n\n  // Make a regular dodecahedron. It consists of twelve regular pentagonal\n  // faces with three faces meeting at each vertex.\n  int numberOfVertices = 20;\n  int numberOfFaces = 12;\n  int numberOfFaceVertices = 5;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.21412, 0, 1.58931);\n  points->InsertNextPoint(0.375185, 1.1547, 1.58931);\n  points->InsertNextPoint(-0.982247, 0.713644, 1.58931);\n  points->InsertNextPoint(-0.982247, -0.713644, 1.58931);\n  points->InsertNextPoint(0.375185, -1.1547, 1.58931);\n  points->InsertNextPoint(1.96449, 0, 0.375185);\n  points->InsertNextPoint(0.607062, 1.86835, 0.375185);\n  points->InsertNextPoint(-1.58931, 1.1547, 0.375185);\n  points->InsertNextPoint(-1.58931, -1.1547, 0.375185);\n  points->InsertNextPoint(0.607062, -1.86835, 0.375185);\n  points->InsertNextPoint(1.58931, 1.1547, -0.375185);\n  points->InsertNextPoint(-0.607062, 1.86835, -0.375185);\n  points->InsertNextPoint(-1.96449, 0, -0.375185);\n  points->InsertNextPoint(-0.607062, -1.86835, -0.375185);\n  points->InsertNextPoint(1.58931, -1.1547, -0.375185);\n  points->InsertNextPoint(0.982247, 0.713644, -1.58931);\n  points->InsertNextPoint(-0.375185, 1.1547, -1.58931);\n  points->InsertNextPoint(-1.21412, 0, -1.58931);\n  points->InsertNextPoint(-0.375185, -1.1547, -1.58931);\n  points->InsertNextPoint(0.982247, -0.713644, -1.58931);\n\n  vtkIdType dodechedronPointsIds[20] = {0,  1,  2,  3,  4,  5,  6,  7,  8,  9,\n                                        10, 11, 12, 13, 14, 15, 16, 17, 18, 19};\n\n  vtkIdType dodechedronFace[12][5] = {\n      {0, 1, 2, 3, 4},     {0, 5, 10, 6, 1},    {1, 6, 11, 7, 2},\n      {2, 7, 12, 8, 3},    {3, 8, 13, 9, 4},    {4, 9, 14, 5, 0},\n      {15, 10, 5, 14, 19}, {16, 11, 6, 10, 15}, {17, 12, 7, 11, 16},\n      {18, 13, 8, 12, 17}, {19, 14, 9, 13, 18}, {19, 18, 17, 16, 15}};\n\n  vtkNew<vtkIdList> dodechedronFaces;\n  for (int i = 0; i < numberOfFaces; i++)\n  {\n    dodechedronFaces->InsertNextId(numberOfFaceVertices);\n    for (int j = 0; j < numberOfFaceVertices; ++j)\n    {\n      dodechedronFaces->InsertNextId(dodechedronFace[i][j]);\n    }\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->InsertNextCell(VTK_POLYHEDRON, numberOfVertices, dodechedronPointsIds,\n                        numberOfFaces, dodechedronFaces->GetPointer(0));\n  uGrid->SetPoints(points);\n\n  return uGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePyramid()\n{\n  // Make a regular square pyramid.\n  int numberOfVertices = 5;\n\n  vtkNew<vtkPoints> points;\n  float p0[3] = {1.0, 1.0, 0.0};\n  float p1[3] = {-1.0, 1.0, 0.0};\n  float p2[3] = {-1.0, -1.0, 0.0};\n  float p3[3] = {1.0, -1.0, 0.0};\n  float p4[3] = {0.0, 0.0, 1.0};\n\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n  points->InsertNextPoint(p4);\n\n  vtkNew<vtkPyramid> pyramid;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    pyramid->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(pyramid->GetCellType(), pyramid->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTetrahedron()\n{\n  // Make a tetrahedron.\n  int numberOfVertices = 4;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 1);\n\n  vtkSmartPointer<vtkTetra> tetra = vtkSmartPointer<vtkTetra>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    tetra->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkCellArray> cellArray;\n  cellArray->InsertNextCell(tetra);\n\n  vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  unstructuredGrid->SetPoints(points);\n  unstructuredGrid->SetCells(VTK_TETRA, cellArray);\n\n  return unstructuredGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeVoxel()\n{\n  // A voxel is a representation of a regular grid in 3-D space.\n  int numberOfVertices = 8;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, 1);\n  points->InsertNextPoint(0, 1, 1);\n  points->InsertNextPoint(1, 1, 1);\n\n  vtkNew<vtkVoxel> voxel;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    voxel->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(voxel->GetCellType(), voxel->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeWedge()\n{\n\n  // A wedge consists of two triangular ends and three rectangular faces.\n\n  int numberOfVertices = 6;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0, .5, .5);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(1, 0.0, 0.0);\n  points->InsertNextPoint(1, .5, .5);\n\n  vtkNew<vtkWedge> wedge;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    wedge->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(wedge->GetCellType(), wedge->GetPointIds());\n\n  return ug;\n}\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/Cell3DDemonstration/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cell3DDemonstration)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cell3DDemonstration: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cell3DDemonstration MACOSX_BUNDLE Cell3DDemonstration.cxx )\n  target_link_libraries(Cell3DDemonstration PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cell3DDemonstration\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Cell3DDemonstration/#download-and-build-cell3ddemonstration","title":"Download and Build Cell3DDemonstration","text":"

Click here to download Cell3DDemonstration and its CMakeLists.txt file. Once the tarball Cell3DDemonstration.tar has been downloaded and extracted,

cd Cell3DDemonstration/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cell3DDemonstration\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/CellTypeSource/","title":"CellTypeSource","text":"

vtk-examples/Cxx/GeometricObjects/CellTypeSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/CellTypeSource/#description","title":"Description","text":"

This example uses [vtkCell](https://www.vtk.org/doc/nightly/html/classvtkCell.html#details)TypeSource to generate a vtkUnstructuredGrid. If a cell does not fill a rectangular area or volume, then multiple cells will be generated. For example, a vtkTetra requires 12 cells to fill a cube. A vtkTriangle requires two cells to fill a square. [vtkCell](https://www.vtk.org/doc/nightly/html/classvtkCell.html#details)TypeSource generates a uniform set of coordinates. The example perturbs those coordinates to illustrate the results of the vtkTessellatorFilter. Also, each cell is passed through vtkShrinkFilter to help identify the cells. Each generated cell also has a unique color.

The example takes an optional argument, a vtkCell name.

For example, to generate vtkTriangles, run

CellTypeSource [vtkTriangle](https://www.vtk.org/doc/nightly/html/classvtkTriangle.html#details)\n

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/CellTypeSource/#code","title":"Code","text":"

CellTypeSource.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellTypeSource.h>\n#include <vtkCellTypes.h>\n#include <vtkColorSeries.h>\n#include <vtkDataSetMapper.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkTessellatorFilter.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <map>\n\nint main(int argc, char* argv[])\n{\n  std::string cellName = \"vtkTetra\";\n  if (argc > 1)\n  {\n    cellName = std::string(argv[1]);\n  }\n\n  // Store cell class names in a map\n  std::map<std::string, int> cellMap;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_LINE)] = VTK_LINE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_EDGE)] =\n      VTK_QUADRATIC_EDGE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_CUBIC_LINE)] =\n      VTK_CUBIC_LINE;\n\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_TRIANGLE)] = VTK_TRIANGLE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_TRIANGLE)] =\n      VTK_QUADRATIC_TRIANGLE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUAD)] = VTK_QUAD;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_QUAD)] =\n      VTK_QUADRATIC_QUAD;\n\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_TETRA)] = VTK_TETRA;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_HEXAHEDRON)] =\n      VTK_HEXAHEDRON;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_WEDGE)] = VTK_WEDGE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_PYRAMID)] = VTK_PYRAMID;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_WEDGE)] =\n      VTK_QUADRATIC_WEDGE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_PYRAMID)] =\n      VTK_QUADRATIC_PYRAMID;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_HEXAHEDRON)] =\n      VTK_QUADRATIC_HEXAHEDRON;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_TETRA)] =\n      VTK_QUADRATIC_TETRA;\n\n  if (cellMap.find(std::string(cellName)) == cellMap.end())\n  {\n    std::cout << \"Cell type \" << cellName << \" is not supported.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkCellTypeSource> source;\n  source->SetCellType(cellMap[cellName]);\n  source->Update();\n  std::cout << \"Cell: \" << cellName << std::endl;\n\n  vtkPoints* originalPoints = source->GetOutput()->GetPoints();\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(source->GetOutput()->GetNumberOfPoints());\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(5070); // for testing\n  for (auto i = 0; i < points->GetNumberOfPoints(); ++i)\n  {\n    double perturbation[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rng->Next();\n      perturbation[j] = rng->GetRangeValue(-0.1, 0.1);\n    }\n    double currentPoint[3];\n    originalPoints->GetPoint(i, currentPoint);\n    points->SetPoint(i, currentPoint[0] + perturbation[0],\n                     currentPoint[1] + perturbation[1],\n                     currentPoint[2] + perturbation[2]);\n  }\n  source->GetOutput()->SetPoints(points);\n\n  int numCells = source->GetOutput()->GetNumberOfCells();\n  std::cout << \"Number of cells: \" << numCells << std::endl;\n  vtkNew<vtkIntArray> idArray;\n  idArray->SetNumberOfTuples(numCells);\n  for (auto i = 0; i < numCells; ++i)\n  {\n    idArray->InsertTuple1(i, i + 1);\n  }\n  idArray->SetName(\"Ids\");\n  source->GetOutput()->GetCellData()->AddArray(idArray);\n  source->GetOutput()->GetCellData()->SetActiveScalars(\"Ids\");\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(source->GetOutputPort());\n  shrink->SetShrinkFactor(.8);\n\n  vtkNew<vtkTessellatorFilter> tessellate;\n  tessellate->SetInputConnection(shrink->GetOutputPort());\n  tessellate->SetMaximumNumberOfSubdivisions(3);\n\n  // Create a lookup table to map cell data to colors\n  vtkNew<vtkLookupTable> lut;\n\n  vtkNew<vtkColorSeries> colorSeries;\n  int seriesEnum = colorSeries->BREWER_QUALITATIVE_SET3;\n  ;\n  colorSeries->SetColorScheme(seriesEnum);\n  colorSeries->BuildLookupTable(lut, colorSeries->ORDINAL);\n\n  // Fill in a few known colors, the rest will be generated if needed\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetInputConnection(shrink->GetOutputPort());\n  mapper->SetScalarRange(0, numCells + 1);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarModeToUseCellData();\n  mapper->SetResolveCoincidentTopologyToPolygonOffset();\n  if (source->GetCellType() == VTK_QUADRATIC_PYRAMID ||\n      source->GetCellType() == VTK_QUADRATIC_WEDGE)\n  {\n    mapper->SetInputConnection(shrink->GetOutputPort());\n  }\n  else\n  {\n    mapper->SetInputConnection(tessellate->GetOutputPort());\n  }\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  //  actor->GetProperty()->SetLineWidth(3);\n\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(20);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"Lamp_Black\").GetData());\n\n  vtkNew<vtkTextMapper> textMapper;\n  textMapper->SetInput(cellName.c_str());\n  textMapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetPosition(320, 20);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"CellTypeSource\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddViewProp(textActor);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/CellTypeSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellTypeSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellTypeSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellTypeSource MACOSX_BUNDLE CellTypeSource.cxx )\n  target_link_libraries(CellTypeSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellTypeSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/CellTypeSource/#download-and-build-celltypesource","title":"Download and Build CellTypeSource","text":"

Click here to download CellTypeSource and its CMakeLists.txt file. Once the tarball CellTypeSource.tar has been downloaded and extracted,

cd CellTypeSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellTypeSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Circle/","title":"Circle","text":"

vtk-examples/Cxx/GeometricObjects/Circle

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Circle/#description","title":"Description","text":"

A circle is simply the limiting case of a regular polygon. We use vtkRegularPolygonSource with a large number of Sides to approximate a circle.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Circle/#code","title":"Code","text":"

Circle.cxx

// Classes specific to this example.\n#include <vtkPolyDataMapper.h>\n#include <vtkRegularPolygonSource.h>\n// Generic VTK pipeline elements.\n#include <vtkActor.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n// Auxiliary classes.\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a circle\n  vtkNew<vtkRegularPolygonSource> polygonSource;\n  // Comment this line to generate a disk instead of a circle.\n  polygonSource->GeneratePolygonOff();\n  polygonSource->SetNumberOfSides(50);\n  polygonSource->SetRadius(5);\n  polygonSource->SetCenter(0, 0, 0);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(polygonSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetWindowName(\"Circle\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Circle/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Circle)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Circle: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Circle MACOSX_BUNDLE Circle.cxx )\n  target_link_libraries(Circle PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Circle\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Circle/#download-and-build-circle","title":"Download and Build Circle","text":"

Click here to download Circle and its CMakeLists.txt file. Once the tarball Circle.tar has been downloaded and extracted,

cd Circle/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Circle\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/ColoredLines/","title":"ColoredLines","text":"

vtk-examples/Cxx/GeometricObjects/ColoredLines

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/ColoredLines/#description","title":"Description","text":"

Displays two lines, each with a different color.

Seealso

LongLine.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/ColoredLines/#code","title":"Code","text":"

ColoredLines.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  // Create the polydata where we will store all the geometric data\n  vtkNew<vtkPolyData> linesPolyData;\n\n  // Create three points\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n\n  // Create a vtkPoints container and store the points in it.\n  vtkNew<vtkPoints> pts;\n  pts->InsertNextPoint(origin);\n  pts->InsertNextPoint(p0);\n  pts->InsertNextPoint(p1);\n\n  // Add the points to the polydata container.\n  linesPolyData->SetPoints(pts);\n\n  // Create the first line (between Origin and P0).\n  vtkNew<vtkLine> line0;\n  line0->GetPointIds()->SetId(\n      0,\n      0); // the second 0 is the index of the Origin in linesPolyData's points.\n  line0->GetPointIds()->SetId(\n      1, 1); // the second 1 is the index of P0 in linesPolyData's points.\n\n  // Create the second line (between Origin and P1).\n  vtkNew<vtkLine> line1;\n  line1->GetPointIds()->SetId(\n      0,\n      0); // the second 0 is the index of the Origin in linesPolyData's points.\n  line1->GetPointIds()->SetId(\n      1, 2); // 2 is the index of P1 in linesPolyData's points.\n\n  // Create a vtkCellArray container and store the lines in it.\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line0);\n  lines->InsertNextCell(line1);\n\n  // Add the lines to the polydata container.\n  linesPolyData->SetLines(lines);\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a vtkUnsignedCharArray container and store the colors in it.\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"Tomato\").GetData());\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"Mint\").GetData());\n\n  // Color the lines.\n  // SetScalars() automatically associates the values in the data array passed\n  // as parameter to the elements in the same indices of the cell data array on\n  // which it is called. This means the first component (red) of the colors\n  // array is matched with the first component of the cell array (line 0) and\n  // the second component (green) of the colors array is matched with the second\n  // component of the cell array (line 1).\n  linesPolyData->GetCellData()->SetScalars(colors);\n\n  // Setup the visualization pipeline.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(linesPolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetLineWidth(4);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->SetWindowName(\"Colored Lines\");\n  window->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n\n  // Visualize\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/ColoredLines/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColoredLines)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColoredLines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColoredLines MACOSX_BUNDLE ColoredLines.cxx )\n  target_link_libraries(ColoredLines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColoredLines\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/ColoredLines/#download-and-build-coloredlines","title":"Download and Build ColoredLines","text":"

Click here to download ColoredLines and its CMakeLists.txt file. Once the tarball ColoredLines.tar has been downloaded and extracted,

cd ColoredLines/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColoredLines\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Cone/","title":"Cone","text":"

vtk-examples/Cxx/GeometricObjects/Cone

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Cone/#description","title":"Description","text":"

vtkConeSource object creates a cone centered at a specified point and pointing in a specified direction. (By default, the center is the origin and the direction is the x-axis.)

Depending upon the resolution of this object, different representations are created. If resolution=0 a line is created; if resolution=1, a single triangle is created; if resolution=2, two crossed triangles are created.

For resolution > 2, a 3D cone (with resolution number of sides) is created.

It also is possible to control whether the bottom of the cone is capped with a (resolution-sided) polygon, and to specify the height and radius of the cone.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Cone/#code","title":"Code","text":"

Cone.cxx

#include <vtkConeSource.h>\n#include <vtkNew.h>\n\n#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"bisque\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n\n  // Render and interact.\n  renderWindow->SetWindowName(\"Cone\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Cone/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cone)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cone: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cone MACOSX_BUNDLE Cone.cxx )\n  target_link_libraries(Cone PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cone\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Cone/#download-and-build-cone","title":"Download and Build Cone","text":"

Click here to download Cone and its CMakeLists.txt file. Once the tarball Cone.tar has been downloaded and extracted,

cd Cone/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cone\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/ConeDemo/","title":"ConeDemo","text":"

vtk-examples/Cxx/GeometricObjects/ConeDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/ConeDemo/#description","title":"Description","text":"

vtkConeSource object creates a cone centered at a specified point and pointing in a specified direction. (By default, the center is the origin and the direction is the x-axis.)

Depending upon the resolution of this object, different representations are created. If resolution=0 a line is created; if resolution=1, a single triangle is created; if resolution=2, two crossed triangles are created.

For resolution > 2, a 3D cone (with resolution number of sides) is created.

It also is possible to control whether the bottom of the cone is capped with a (resolution-sided) polygon, and to specify the height and radius of the cone.

The example shows cones with resolutions 0, 1, 2, and 3.

Style

This example collects all of the color definition in the beginning of the example. This makes it easier to make changes to the colors without having to search the code.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/ConeDemo/#code","title":"Code","text":"

ConeDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Define all of the colors used in the example.\n  vtkColor3d backgroundColor = colors->GetColor3d(\"tan\");\n  vtkColor3d actorColor = colors->GetColor3d(\"orchid\");\n  vtkColor3d actorBackfaceColor = colors->GetColor3d(\"PowderBlue\");\n  vtkColor3d coneLineColor = colors->GetColor3d(\"Black\");\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ConeDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Shared camera.\n  vtkNew<vtkCamera> camera;\n\n  // Define viewport ranges.\n  double xmins[4] = {0, .5, 0, .5};\n  double xmaxs[4] = {0.5, 1, 0.5, 1};\n  double ymins[4] = {0, 0, .5, .5};\n  double ymaxs[4] = {0.5, 0.5, 1, 1};\n\n  // Each viewport will contain a cone with an increasing resolution.\n  for (unsigned i = 0; i < 4; i++)\n  {\n    vtkNew<vtkRenderer> renderer;\n    renderer->SetBackground(backgroundColor.GetData());\n\n    renderWindow->AddRenderer(renderer);\n    renderer->SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i]);\n\n    // Create a cone with different resolutions.\n    vtkNew<vtkConeSource> coneSource;\n    coneSource->SetResolution(i);\n    coneSource->SetDirection(0, 1, 0);\n    if (i == 3)\n    {\n      coneSource->SetResolution(20);\n    }\n\n    // Create a mapper and actor\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(coneSource->GetOutputPort());\n\n    vtkNew<vtkProperty> backfaceProp;\n    backfaceProp->SetDiffuseColor(actorBackfaceColor.GetData());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    if (i > 0)\n    {\n      actor->GetProperty()->SetDiffuseColor(actorColor.GetData());\n    }\n    else\n    {\n      actor->GetProperty()->SetDiffuseColor(coneLineColor.GetData());\n    }\n    actor->GetProperty()->SetLineWidth(2);\n    actor->GetProperty()->EdgeVisibilityOn();\n    actor->SetBackfaceProperty(backfaceProp);\n    renderer->AddActor(actor);\n    renderer->SetActiveCamera(camera);\n    if (i == 3)\n    {\n      renderer->ResetCamera();\n    }\n  }\n  camera->Azimuth(120);\n  camera->Elevation(45);\n  camera->Dolly(1.1);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/ConeDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConeDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConeDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConeDemo MACOSX_BUNDLE ConeDemo.cxx )\n  target_link_libraries(ConeDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConeDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/ConeDemo/#download-and-build-conedemo","title":"Download and Build ConeDemo","text":"

Click here to download ConeDemo and its CMakeLists.txt file. Once the tarball ConeDemo.tar has been downloaded and extracted,

cd ConeDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConeDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/ConvexPointSet/","title":"ConvexPointSet","text":"

vtk-examples/Cxx/GeometricObjects/ConvexPointSet

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/ConvexPointSet/#description","title":"Description","text":"

vtkConvexPointSet object represents a 3D cell defined by a convex set of points. An example of such a cell is an octant (from an octree).

vtkConvexPointSet uses the ordered triangulations approach (vtkOrderedTriangulator) to create triangulations guaranteed to be compatible across shared faces.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/ConvexPointSet/#code","title":"Code","text":"

ConvexPointSet.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConvexPointSet.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkConvexPointSet> cps;\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, 1);\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(0, 1, 1);\n  points->InsertNextPoint(0.5, 0, 0);\n  points->InsertNextPoint(1, 0.5, 0);\n  points->InsertNextPoint(0.5, 1, 0);\n  points->InsertNextPoint(0, 0.5, 0);\n  points->InsertNextPoint(0.5, 0.5, 0);\n\n  for (int i = 0; i < 13; ++i)\n  {\n    cps->GetPointIds()->InsertId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->Allocate(1, 1);\n  ug->InsertNextCell(cps->GetCellType(), cps->GetPointIds());\n  ug->SetPoints(points);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(ug);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetLineWidth(3);\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  // Glyph the points\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.03);\n\n  // Create a polydata to store everything in\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputData(polyData);\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ConvexPointSet\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(pointActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(210);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/ConvexPointSet/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConvexPointSet)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConvexPointSet: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConvexPointSet MACOSX_BUNDLE ConvexPointSet.cxx )\n  target_link_libraries(ConvexPointSet PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConvexPointSet\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/ConvexPointSet/#download-and-build-convexpointset","title":"Download and Build ConvexPointSet","text":"

Click here to download ConvexPointSet and its CMakeLists.txt file. Once the tarball ConvexPointSet.tar has been downloaded and extracted,

cd ConvexPointSet/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConvexPointSet\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Cube/","title":"Cube","text":"

vtk-examples/Cxx/GeometricObjects/Cube

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Cube/#description","title":"Description","text":"

This is based on the C++ example Examples/DataManipulation/Cxx/Cube.cxx in the VTK source distribution.

It illustrates the manual use of vtkPolyData to construct a cube and differs from the Wiki examples Cube1.cxx and Cube1.py, which use vtkCubeSource.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Cube/#code","title":"Code","text":"

Cube.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<std::array<double, 3>, 8> pts = {{{{0, 0, 0}},\n                                               {{1, 0, 0}},\n                                               {{1, 1, 0}},\n                                               {{0, 1, 0}},\n                                               {{0, 0, 1}},\n                                               {{1, 0, 1}},\n                                               {{1, 1, 1}},\n                                               {{0, 1, 1}}}};\n  // The ordering of the corner points on each face.\n  std::array<std::array<vtkIdType, 4>, 6> ordering = {{{{0, 3, 2, 1}},\n                                                       {{4, 5, 6, 7}},\n                                                       {{0, 1, 5, 4}},\n                                                       {{1, 2, 6, 5}},\n                                                       {{2, 3, 7, 6}},\n                                                       {{3, 0, 4, 7}}}};\n\n  // We'll create the building blocks of polydata including data attributes.\n  vtkNew<vtkPolyData> cube;\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> polys;\n  vtkNew<vtkFloatArray> scalars;\n\n  // Load the point, cell, and data attributes.\n  for (auto i = 0ul; i < pts.size(); ++i)\n  {\n    points->InsertPoint(i, pts[i].data());\n    scalars->InsertTuple1(i, i);\n  }\n  for (auto&& i : ordering)\n  {\n    polys->InsertNextCell(vtkIdType(i.size()), i.data());\n  }\n\n  // We now assign the pieces to the vtkPolyData.\n  cube->SetPoints(points);\n  cube->SetPolys(polys);\n  cube->GetPointData()->SetScalars(scalars);\n\n  // Now we'll look at it.\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputData(cube);\n  cubeMapper->SetScalarRange(cube->GetScalarRange());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n\n  // The usual rendering stuff.\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(1, 1, 1);\n  camera->SetFocalPoint(0, 0, 0);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"Cube\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(cubeActor);\n  renderer->SetActiveCamera(camera);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  renWin->SetSize(600, 600);\n\n  // interact with data\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Cube/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cube)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cube: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cube MACOSX_BUNDLE Cube.cxx )\n  target_link_libraries(Cube PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cube\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Cube/#download-and-build-cube","title":"Download and Build Cube","text":"

Click here to download Cube and its CMakeLists.txt file. Once the tarball Cube.tar has been downloaded and extracted,

cd Cube/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cube\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Cube1/","title":"Cube1","text":"

vtk-examples/Cxx/GeometricObjects/Cube1

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Cube1/#description","title":"Description","text":"

Display a cube.

A nice simple example that demonstrates the operation of the VTK pipeline.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Cube1/#code","title":"Code","text":"

Cube1.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a rendering window and renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"Cube\");\n  renWin->AddRenderer(ren);\n  // Create a renderwindow interactor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create a cube.\n  vtkNew<vtkCubeSource> cube;\n  cube->Update();\n\n  // Mapper.\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputData(cube->GetOutput());\n\n  // Actor.\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // Assign actor to the renderer.\n  ren->AddActor(cubeActor);\n\n  ren->ResetCamera();\n  ren->GetActiveCamera()->Azimuth(30);\n  ren->GetActiveCamera()->Elevation(30);\n  ren->ResetCameraClippingRange();\n  ren->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Cube1\");\n\n  // Enable user interface interaction.\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Cube1/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cube1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cube1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cube1 MACOSX_BUNDLE Cube1.cxx )\n  target_link_libraries(Cube1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cube1\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Cube1/#download-and-build-cube1","title":"Download and Build Cube1","text":"

Click here to download Cube1 and its CMakeLists.txt file. Once the tarball Cube1.tar has been downloaded and extracted,

cd Cube1/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cube1\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Cylinder/","title":"Cylinder","text":"

vtk-examples/Cxx/GeometricObjects/Cylinder

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Cylinder/#description","title":"Description","text":"

vtkCylinderSource object creates a polygonal cylinder centered at Center.

The axis of the cylinder is aligned along the global y-axis. The height and radius of the cylinder can be specified, as well as the number of sides.

It is also possible to control whether the cylinder is open-ended or capped. If you have the end points of the cylinder, you should use a vtkLineSource followed by a vtkTubeFilter instead of the vtkCylinderSource.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Cylinder/#code","title":"Code","text":"

Cylinder.cxx

#include <vtkActor.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cylinder.\n  vtkNew<vtkCylinderSource> cylinderSource;\n  cylinderSource->SetCenter(0.0, 0.0, 0.0);\n  cylinderSource->SetRadius(5.0);\n  cylinderSource->SetHeight(7.0);\n  cylinderSource->SetResolution(100);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cylinderSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Cylinder\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Cylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cylinder MACOSX_BUNDLE Cylinder.cxx )\n  target_link_libraries(Cylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Cylinder/#download-and-build-cylinder","title":"Download and Build Cylinder","text":"

Click here to download Cylinder and its CMakeLists.txt file. Once the tarball Cylinder.tar has been downloaded and extracted,

cd Cylinder/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cylinder\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/CylinderExample/","title":"CylinderExample","text":"

vtk-examples/Cxx/GeometricObjects/CylinderExample

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/CylinderExample/#description","title":"Description","text":"

This example creates a minimal visualization program, demonstrating VTK's basic rendering and pipeline creation.

Note

This original C++ source code for this example is here.

Other languages

See (Python), (PythonicAPI), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/CylinderExample/#code","title":"Code","text":"

CylinderExample.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // This creates a polygonal cylinder model with eight circumferential facets\n  // (i.e, in practice an octagonal prism).\n  vtkNew<vtkCylinderSource> cylinder;\n  cylinder->SetResolution(8);\n\n  // The mapper is responsible for pushing the geometry into the graphics\n  // library. It may also do color mapping, if scalars or other attributes are\n  // defined.\n  vtkNew<vtkPolyDataMapper> cylinderMapper;\n  cylinderMapper->SetInputConnection(cylinder->GetOutputPort());\n\n  // The actor is a grouping mechanism: besides the geometry (mapper), it\n  // also has a property, transformation matrix, and/or texture map.\n  // Here we set its color and rotate it around the X and Y axes.\n  vtkNew<vtkActor> cylinderActor;\n  cylinderActor->SetMapper(cylinderMapper);\n  cylinderActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"Tomato\").GetData());\n  cylinderActor->RotateX(30.0);\n  cylinderActor->RotateY(-45.0);\n\n  // The renderer generates the image\n  // which is then displayed on the render window.\n  // It can be thought of as a scene to which the actor is added\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(cylinderActor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  // Zoom in a little by accessing the camera and invoking its \"Zoom\" method.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.5);\n\n  // The render window is the actual GUI window\n  // that appears on the computer screen\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Cylinder\");\n\n  // The render window interactor captures mouse events\n  // and will perform appropriate camera or actor manipulation\n  // depending on the nature of the events.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // This starts the event loop and as a side effect causes an initial render.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/CylinderExample/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CylinderExample)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CylinderExample: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CylinderExample MACOSX_BUNDLE CylinderExample.cxx )\n  target_link_libraries(CylinderExample PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CylinderExample\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/CylinderExample/#download-and-build-cylinderexample","title":"Download and Build CylinderExample","text":"

Click here to download CylinderExample and its CMakeLists.txt file. Once the tarball CylinderExample.tar has been downloaded and extracted,

cd CylinderExample/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CylinderExample\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Disk/","title":"Disk","text":"

vtk-examples/Cxx/GeometricObjects/Disk

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Disk/#description","title":"Description","text":"

vtkDiskSource objects creates a polygonal disk with a hole in the center.

The disk has zero height. The user can specify the inner and outer radius of the disk, and the radial and circumferential resolution of the polygonal representation.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Disk/#code","title":"Code","text":"

Disk.cxx

#include <vtkActor.h>\n#include <vtkDiskSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDiskSource> diskSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(diskSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Disk\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Disk/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Disk)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Disk: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Disk MACOSX_BUNDLE Disk.cxx )\n  target_link_libraries(Disk PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Disk\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Disk/#download-and-build-disk","title":"Download and Build Disk","text":"

Click here to download Disk and its CMakeLists.txt file. Once the tarball Disk.tar has been downloaded and extracted,

cd Disk/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Disk\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Dodecahedron/","title":"Dodecahedron","text":"

vtk-examples/Cxx/GeometricObjects/Dodecahedron

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Dodecahedron/#code","title":"Code","text":"

Dodecahedron.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyhedron.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nnamespace {\nvtkSmartPointer<vtkPolyhedron> MakeDodecahedron();\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto dodecahedron = MakeDodecahedron();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(dodecahedron->GetPolyData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PapayaWhip\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Dodecahedron\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkPolyhedron> MakeDodecahedron()\n{\n  vtkSmartPointer<vtkPolyhedron> aDodecahedron =\n      vtkSmartPointer<vtkPolyhedron>::New();\n\n  for (int i = 0; i < 20; ++i)\n  {\n    aDodecahedron->GetPointIds()->InsertNextId(i);\n  }\n\n  aDodecahedron->GetPoints()->InsertNextPoint(1.21412, 0, 1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.375185, 1.1547, 1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.982247, 0.713644, 1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.982247, -0.713644, 1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.375185, -1.1547, 1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(1.96449, 0, 0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.607062, 1.86835, 0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(-1.58931, 1.1547, 0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(-1.58931, -1.1547, 0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.607062, -1.86835, 0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(1.58931, 1.1547, -0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.607062, 1.86835, -0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(-1.96449, 0, -0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.607062, -1.86835, -0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(1.58931, -1.1547, -0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.982247, 0.713644, -1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.375185, 1.1547, -1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(-1.21412, 0, -1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.375185, -1.1547, -1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.982247, -0.713644, -1.58931);\n\n  vtkIdType faces[73] = {12,                    // number of faces\n                         5,  0,  1,  2,  3,  4, // number of ids on face, ids\n                         5,  0,  5,  10, 6,  1,  5,  1,  6,  11, 7,  2,  5,  2,\n                         7,  12, 8,  3,  5,  3,  8,  13, 9,  4,  5,  4,  9,  14,\n                         5,  0,  5,  15, 10, 5,  14, 19, 5,  16, 11, 6,  10, 15,\n                         5,  17, 12, 7,  11, 16, 5,  18, 13, 8,  12, 17, 5,  19,\n                         14, 9,  13, 18, 5,  19, 18, 17, 16, 15};\n\n  aDodecahedron->SetFaces(faces);\n  aDodecahedron->Initialize();\n\n  return aDodecahedron;\n}\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/Dodecahedron/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Dodecahedron)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Dodecahedron: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Dodecahedron MACOSX_BUNDLE Dodecahedron.cxx )\n  target_link_libraries(Dodecahedron PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Dodecahedron\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Dodecahedron/#download-and-build-dodecahedron","title":"Download and Build Dodecahedron","text":"

Click here to download Dodecahedron and its CMakeLists.txt file. Once the tarball Dodecahedron.tar has been downloaded and extracted,

cd Dodecahedron/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Dodecahedron\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/EarthSource/","title":"EarthSource","text":"

vtk-examples/Cxx/GeometricObjects/EarthSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/EarthSource/#code","title":"Code","text":"

EarthSource.cxx

#include <vtkActor.h>\n#include <vtkEarthSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkWindowToImageFilter.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Earth source\n  vtkNew<vtkEarthSource> earthSource;\n  earthSource->OutlineOn();\n  earthSource->Update();\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(100);\n  sphere->SetRadius(earthSource->GetRadius());\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(earthSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"EarthSource\");\n\n  // Render and interact\n  renderWindow->Render();\n\n  /*\n  // screenshot code:\n  vtkNew<vtkWindowToImageFilter> w2if ;\n  w2if->SetInput(renderWindow);\n  w2if->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(\"TestEarthSource->png\");\n  writer->SetInputConnection(w2if->GetOutputPort());\n  writer->Write();\n  */\n\n  // begin interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/EarthSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EarthSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersHybrid\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EarthSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EarthSource MACOSX_BUNDLE EarthSource.cxx )\n  target_link_libraries(EarthSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EarthSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/EarthSource/#download-and-build-earthsource","title":"Download and Build EarthSource","text":"

Click here to download EarthSource and its CMakeLists.txt file. Once the tarball EarthSource.tar has been downloaded and extracted,

cd EarthSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./EarthSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/EllipticalCylinder/","title":"EllipticalCylinder","text":"

vtk-examples/Cxx/GeometricObjects/EllipticalCylinder

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/EllipticalCylinder/#description","title":"Description","text":"

The example creates an elliptical cross-section and stores it in a vtkPolyData. Then, the vtkLinearExtrusionFilter creates an elliptical cylinder by extruding the vtkPolyLine along a vector. The example sets the backface property of the vtkActor to show the front and back face of the cylinder.

See also

EllipticalCylinderDemo to see the vtkPolyLine and the vector represented as an oriented arrow.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/EllipticalCylinder/#code","title":"Code","text":"

EllipticalCylinder.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n\n  double angle = 0;\n  double r1, r2;\n  double centerX, centerY;\n  r1 = 50;\n  r2 = 30;\n  centerX = 10.0;\n  centerY = 5.0;\n\n  vtkNew<vtkPoints> points;\n  int id = 0;\n  while (angle <= 2.0 * vtkMath::Pi() + (vtkMath::Pi() / 60.0))\n  {\n    points->InsertNextPoint(r1 * cos(angle) + centerX,\n                            r2 * sin(angle) + centerY, 0.0);\n    angle = angle + (vtkMath::Pi() / 60.0);\n    ++id;\n  }\n\n  vtkNew<vtkPolyLine> line;\n  line->GetPointIds()->SetNumberOfIds(id);\n  for (unsigned int i = 0; i < static_cast<unsigned int>(id); ++i)\n  {\n    line->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line);\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n  polyData->SetLines(lines);\n\n  vtkNew<vtkLinearExtrusionFilter> extrude;\n  extrude->SetInputData(polyData);\n  extrude->SetExtrusionTypeToNormalExtrusion();\n  extrude->SetVector(0, 0, 100.0);\n  extrude->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(extrude->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  vtkNew<vtkRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren->AddActor(actor);\n  ren->AddActor(lineActor);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"EllipticalCylinder\");\n  renWin->AddRenderer(ren);\n  renWin->SetSize(600, 600);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, 1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Azimuth(30);\n  camera->Elevation(30);\n\n  ren->SetActiveCamera(camera);\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/EllipticalCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EllipticalCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EllipticalCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EllipticalCylinder MACOSX_BUNDLE EllipticalCylinder.cxx )\n  target_link_libraries(EllipticalCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EllipticalCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/EllipticalCylinder/#download-and-build-ellipticalcylinder","title":"Download and Build EllipticalCylinder","text":"

Click here to download EllipticalCylinder and its CMakeLists.txt file. Once the tarball EllipticalCylinder.tar has been downloaded and extracted,

cd EllipticalCylinder/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./EllipticalCylinder\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/EllipticalCylinderDemo/","title":"EllipticalCylinderDemo","text":"

vtk-examples/Cxx/GeometricObjects/EllipticalCylinderDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/EllipticalCylinderDemo/#description","title":"Description","text":"

The example shows the vtkPolyLine that forms the base of the elliptical cylinder and an oriented arrow that represents the vector that vtkLinearExtrusionFilter uses to create the cylinder. The example takes an optional triple that defines the vector for the filter. The length of the vector is the height of the cylinder.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/EllipticalCylinderDemo/#code","title":"Code","text":"

EllipticalCylinderDemo.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n\nint main(int argc, char* argv[])\n{\n  double nx = 0.0;\n  double ny = 0.0;\n  double nz = 100.0;\n\n  if (argc > 3)\n  {\n    nx = atof(argv[1]);\n    ny = atof(argv[2]);\n    nz = atof(argv[3]);\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  double angle = 0;\n  double r1, r2;\n  double centerX, centerY;\n  r1 = 50;\n  r2 = 30;\n  centerX = 10.0;\n  centerY = 5.0;\n\n  vtkNew<vtkPoints> points;\n  int id = 0;\n  while (angle <= 2.0 * vtkMath::Pi() + (vtkMath::Pi() / 60.0))\n  {\n    points->InsertNextPoint(r1 * cos(angle) + centerX,\n                            r2 * sin(angle) + centerY, 0.0);\n    angle = angle + (vtkMath::Pi() / 60.0);\n    ++id;\n  }\n\n  vtkNew<vtkPolyLine> line;\n  line->GetPointIds()->SetNumberOfIds(id);\n  for (unsigned int i = 0; i < static_cast<unsigned int>(id); ++i)\n  {\n    line->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line);\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n  polyData->SetLines(lines);\n\n  vtkNew<vtkLinearExtrusionFilter> extrude;\n  extrude->SetInputData(polyData);\n  extrude->SetExtrusionTypeToNormalExtrusion();\n  extrude->SetVector(nx, ny, nz);\n  extrude->Update();\n\n  // Create an oriented arrow\n  double startPoint[3], endPoint[3];\n  startPoint[0] = centerX;\n  startPoint[1] = centerY;\n  startPoint[2] = 0.0;\n  for (auto i = 0; i < 3; ++i)\n  {\n    endPoint[i] = startPoint[i] + extrude->GetVector()[i];\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  auto max_r = 10.0;\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    arbitrary[i] = rng->GetRangeValue(-max_r, max_r);\n    rng->Next();\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);\n  transform->Concatenate(matrix);\n  transform->Scale(length, length, length);\n\n  vtkNew<vtkArrowSource> arrowSource;\n  arrowSource->SetTipResolution(31);\n  arrowSource->SetShaftResolution(21);\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(arrowSource->GetOutputPort());\n\n  // Create a mapper and actor for the arrow\n  vtkNew<vtkPolyDataMapper> arrowMapper;\n  arrowMapper->SetInputConnection(transformPD->GetOutputPort());\n\n  vtkNew<vtkActor> arrowActor;\n  arrowActor->SetMapper(arrowMapper);\n  arrowActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputData(polyData);\n  tubes->SetRadius(2.0);\n  tubes->SetNumberOfSides(21);\n\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(tubes->GetOutputPort());\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(extrude->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->GetProperty()->SetOpacity(.7);\n\n  vtkNew<vtkRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren->AddActor(actor);\n  ren->AddActor(lineActor);\n  ren->AddActor(arrowActor);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"EllipticalCylinderDemo\");\n  renWin->AddRenderer(ren);\n  renWin->SetSize(600, 600);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, 1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Azimuth(30);\n  camera->Elevation(30);\n\n  ren->SetActiveCamera(camera);\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/EllipticalCylinderDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EllipticalCylinderDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EllipticalCylinderDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EllipticalCylinderDemo MACOSX_BUNDLE EllipticalCylinderDemo.cxx )\n  target_link_libraries(EllipticalCylinderDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EllipticalCylinderDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/EllipticalCylinderDemo/#download-and-build-ellipticalcylinderdemo","title":"Download and Build EllipticalCylinderDemo","text":"

Click here to download EllipticalCylinderDemo and its CMakeLists.txt file. Once the tarball EllipticalCylinderDemo.tar has been downloaded and extracted,

cd EllipticalCylinderDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./EllipticalCylinderDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Frustum/","title":"Frustum","text":"

vtk-examples/Cxx/GeometricObjects/Frustum

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Frustum/#description","title":"Description","text":"

This example gets the frustum from a camera and displays it on the screen.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Frustum/#code","title":"Code","text":"

Frustum.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFrustumSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCamera> camera;\n  camera->SetClippingRange(.1, .4);\n  double planesArray[24];\n\n  camera->GetFrustumPlanes(1.0, planesArray);\n\n  vtkNew<vtkPlanes> planes;\n  planes->SetFrustumPlanes(planesArray);\n\n  vtkNew<vtkFrustumSource> frustumSource;\n  frustumSource->ShowLinesOff();\n  frustumSource->SetPlanes(planes);\n\n  vtkNew<vtkShrinkPolyData> shrink;\n  shrink->SetInputConnection(frustumSource->GetOutputPort());\n  shrink->SetShrinkFactor(.9);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  // a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Frustum\");\n  renderWindow->AddRenderer(renderer);\n\n  // an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  // Position the camera so that we can see the frustum\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  // render an image (lights and cameras are created automatically)\n  renderWindow->Render();\n\n  // begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Frustum/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Frustum)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Frustum: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Frustum MACOSX_BUNDLE Frustum.cxx )\n  target_link_libraries(Frustum PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Frustum\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Frustum/#download-and-build-frustum","title":"Download and Build Frustum","text":"

Click here to download Frustum and its CMakeLists.txt file. Once the tarball Frustum.tar has been downloaded and extracted,

cd Frustum/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Frustum\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/GeometricObjectsDemo/","title":"GeometricObjectsDemo","text":"

vtk-examples/Cxx/GeometricObjects/GeometricObjectsDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/GeometricObjectsDemo/#code","title":"Code","text":"

GeometricObjectsDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkArrowSource.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkCylinderSource.h>\n#include <vtkDiskSource.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRegularPolygonSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <array>\n#include <vector>\n#include <vtkCamera.h>\n\nint main(int, char*[])\n{\n  vtkSmartPointer<vtkNamedColors> colors =\n      vtkSmartPointer<vtkNamedColors>::New();\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create container to hold the 3D object generators (sources)\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> geometricObjectSources;\n\n  // Populate the container with the various object sources to be demonstrated\n  geometricObjectSources.push_back(vtkSmartPointer<vtkArrowSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkConeSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkCubeSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkCylinderSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkDiskSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkLineSource>::New());\n  geometricObjectSources.push_back(\n      vtkSmartPointer<vtkRegularPolygonSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkSphereSource>::New());\n\n  // Create containers for the remaining nodes of each pipeline\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textmappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textactors;\n\n  // Create a common text property.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // Create a mapper and actor for each object and the corresponding text label\n  for (unsigned int i = 0; i < geometricObjectSources.size(); i++)\n  {\n    geometricObjectSources[i]->Update();\n\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputConnection(geometricObjectSources[i]->GetOutputPort());\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(\n        colors->GetColor3d(\"PeachPuff\").GetData());\n\n    textmappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textmappers[i]->SetInput(\n        geometricObjectSources[i]->GetClassName()); // set text label to the\n                                                    // name of the object source\n    textmappers[i]->SetTextProperty(textProperty);\n\n    textactors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    textactors[i]->SetMapper(textmappers[i]);\n    textactors[i]->SetPosition(120, 16); // Note: the position of an Actor2D is\n                                         // specified in display coordinates\n  }\n\n  // Define size of the grid that will hold the objects\n  auto gridCols = 3;\n  auto gridRows = 3;\n  // Define side length (in pixels) of each renderer square\n  int rendererSize = 300;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"GeometricObjectsDemo\");\n  renderWindow->SetSize(rendererSize * gridCols, rendererSize * gridRows);\n\n  // Set up a grid of viewports for each renderer\n  for (auto row = 0; row < gridRows; row++)\n  {\n    for (auto col = 0; col < gridCols; col++)\n    {\n      auto index = row * gridCols + col;\n\n      // Create a renderer for this grid cell\n      vtkSmartPointer<vtkRenderer> renderer =\n          vtkSmartPointer<vtkRenderer>::New();\n      renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n      // Set the renderer's viewport dimensions (xmin, ymin, xmax, ymax) within\n      // the render window. Note that for the Y values, we need to subtract the\n      // row index from gridRows because the viewport Y axis points upwards, but\n      // we want to draw the grid from top to down\n      double viewport[4] = {static_cast<double>(col) / gridCols,\n                            static_cast<double>(gridRows - row - 1) / gridRows,\n                            static_cast<double>(col + 1) / gridCols,\n                            static_cast<double>(gridRows - row) / gridRows};\n      renderer->SetViewport(viewport);\n\n      // Add the corresponding actor and label for this grid cell, if they exist\n      if (index < geometricObjectSources.size())\n      {\n        renderer->AddActor(actors[index]);\n        renderer->AddActor(textactors[index]);\n        renderer->ResetCameraClippingRange();\n      }\n\n      renderWindow->AddRenderer(renderer);\n    }\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/GeometricObjectsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GeometricObjectsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GeometricObjectsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GeometricObjectsDemo MACOSX_BUNDLE GeometricObjectsDemo.cxx )\n  target_link_libraries(GeometricObjectsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GeometricObjectsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/GeometricObjectsDemo/#download-and-build-geometricobjectsdemo","title":"Download and Build GeometricObjectsDemo","text":"

Click here to download GeometricObjectsDemo and its CMakeLists.txt file. Once the tarball GeometricObjectsDemo.tar has been downloaded and extracted,

cd GeometricObjectsDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GeometricObjectsDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Hexahedron/","title":"Hexahedron","text":"

vtk-examples/Cxx/GeometricObjects/Hexahedron

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Hexahedron/#description","title":"Description","text":"

The hexahedron is a primary three-dimensional cell consisting of six quadrilateral faces, twelve edges, and eight vertices. The hexahedron is defined by an ordered list of eight points. The faces and edges must not intersect any other faces and edges, and the hexahedron must be convex.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Hexahedron/#code","title":"Code","text":"

Hexahedron.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkHexahedron.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <array>\n#include <vector>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // For the hexahedron; setup the coordinates of eight points.\n  // The two faces must be in counter clockwise order as viewed from the\n  // outside.\n  std::vector<std::array<double, 3>> pointCoordinates;\n  pointCoordinates.push_back({{0.0, 0.0, 0.0}}); // Face 1\n  pointCoordinates.push_back({{1.0, 0.0, 0.0}});\n  pointCoordinates.push_back({{1.0, 1.0, 0.0}});\n  pointCoordinates.push_back({{0.0, 1.0, 0.0}});\n  pointCoordinates.push_back({{0.0, 0.0, 1.0}}); // Face 2\n  pointCoordinates.push_back({{1.0, 0.0, 1.0}});\n  pointCoordinates.push_back({{1.0, 1.0, 1.0}});\n  pointCoordinates.push_back({{0.0, 1.0, 1.0}});\n\n  // Create the points.\n  vtkNew<vtkPoints> points;\n\n  // Create a hexahedron from the points.\n  vtkNew<vtkHexahedron> hex;\n\n  for (auto i = 0; i < pointCoordinates.size(); ++i)\n  {\n    points->InsertNextPoint(pointCoordinates[i].data());\n    hex->GetPointIds()->SetId(i, i);\n  }\n\n  // Add the hexahedron to a cell array.\n  vtkNew<vtkCellArray> hexs;\n  hexs->InsertNextCell(hex);\n\n  // Add the points and hexahedron to an unstructured grid.\n  vtkNew<vtkUnstructuredGrid> uGrid;\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(hex->GetCellType(), hex->GetPointIds());\n\n  // Visualize.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(uGrid);\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Hexahedron\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Hexahedron/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Hexahedron)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Hexahedron: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Hexahedron MACOSX_BUNDLE Hexahedron.cxx )\n  target_link_libraries(Hexahedron PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Hexahedron\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Hexahedron/#download-and-build-hexahedron","title":"Download and Build Hexahedron","text":"

Click here to download Hexahedron and its CMakeLists.txt file. Once the tarball Hexahedron.tar has been downloaded and extracted,

cd Hexahedron/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Hexahedron\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/IsoparametricCellsDemo/","title":"IsoparametricCellsDemo","text":"

vtk-examples/Cxx/GeometricObjects/IsoparametricCellsDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/IsoparametricCellsDemo/#description","title":"Description","text":"

This example shows the isoparametric cells supported by the VTK. These cells are nonlinear and contain one or more mid-side vertices. Isoparametric elements are typically used in finite element analysis. The term isoparametric is derived from the use of the same shape functions (or interpolation functions) to define the element's geometric shape as are used to define the displacements within the element.

This example illustrates each cell's representation using its parametric coordinates (pcoords) as the vertices of the cell. In practice, the vertices will correspond to physical points in a finite element model. Use vtkTessellatorFilter to better see the shape of the cell. See for example, QuadraticHexahedronDemo and QuadraticTetraDemo.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/IsoparametricCellsDemo/#code","title":"Code","text":"

IsoparametricCellsDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <vtkBiQuadraticQuad.h>\n#include <vtkBiQuadraticQuadraticHexahedron.h>\n#include <vtkBiQuadraticQuadraticWedge.h>\n#include <vtkBiQuadraticTriangle.h>\n#include <vtkCubicLine.h>\n#include <vtkQuadraticEdge.h>\n#include <vtkQuadraticHexahedron.h>\n#include <vtkQuadraticLinearQuad.h>\n#include <vtkQuadraticLinearWedge.h>\n#include <vtkQuadraticPolygon.h>\n#include <vtkQuadraticPyramid.h>\n#include <vtkQuadraticQuad.h>\n#include <vtkQuadraticTetra.h>\n#include <vtkQuadraticTriangle.h>\n#include <vtkQuadraticWedge.h>\n#include <vtkTriQuadraticHexahedron.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n// These functions return a vtkUnstructured grid corresponding to the object.\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid> MakeUnstructuredGrid(vtkSmartPointer<T>);\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticPolygon();\n} // namespace\n\nint main(int, char*[])\n{\n  std::vector<std::string> titles;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n\n  std::vector<vtkSmartPointer<vtkUnstructuredGrid>> uGrids;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticEdge>::New()));\n  titles.push_back(\"VTK_QUADRATIC_EDGE (= 21)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticTriangle>::New()));\n  titles.push_back(\"VTK_QUADRATIC_TRIANGLE (= 22)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticQuad>::New()));\n  titles.push_back(\"VTK_QUADRATIC_QUAD (= 23)\");\n\n  uGrids.push_back(MakeQuadraticPolygon());\n  titles.push_back(\"VTK_QUADRATIC_POLYGON (= 36)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticTetra>::New()));\n  titles.push_back(\"VTK_QUADRATIC_TETRA (= 24)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticHexahedron>::New()));\n  titles.push_back(\"VTK_QUADRATIC_HEXAHEDRON (= 25)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticWedge>::New()));\n  titles.push_back(\"VTK_QUADRATIC_WEDGE (= 26)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticPyramid>::New()));\n  titles.push_back(\"VTK_QUADRATIC_PYRAMID (= 27)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkBiQuadraticQuad>::New()));\n  titles.push_back(\"VTK_BIQUADRATIC_QUAD (= 28)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkTriQuadraticHexahedron>::New()));\n  titles.push_back(\"VTK_TRIQUADRATIC_HEXAHEDRON (= 29)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticLinearQuad>::New()));\n  titles.push_back(\"VTK_QUADRATIC_LINEAR_QUAD (= 30)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticLinearWedge>::New()));\n  titles.push_back(\"VTK_QUADRATIC_LINEAR_WEDGE (= 31)\");\n\n  uGrids.push_back(MakeUnstructuredGrid(\n      vtkSmartPointer<vtkBiQuadraticQuadraticWedge>::New()));\n  titles.push_back(\"VTK_BIQUADRATIC_QUADRATIC_WEDGE (= 32)\");\n\n  uGrids.push_back(MakeUnstructuredGrid(\n      vtkSmartPointer<vtkBiQuadraticQuadraticHexahedron>::New()));\n  titles.push_back(\"VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON (= 33)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkBiQuadraticTriangle>::New()));\n  titles.push_back(\"VTK_BIQUADRATIC_TRIANGLE (= 34)\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkCubicLine>::New()));\n  titles.push_back(\"VTK_CUBIC_LINE (= 35)\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"Isoparametric Cell\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Create one sphere for all\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.08);\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(10);\n  textProperty->SetJustificationToCentered();\n\n  // Create and link the mappers actors and renderers together.\n  for (unsigned int i = 0; i < uGrids.size(); ++i)\n  {\n    std::cout << \"Creating: \" << titles[i] << std::endl;\n    textMappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textActors.push_back(vtkSmartPointer<vtkActor2D>::New());\n\n    textMappers[i]->GetTextProperty()->SetFontSize(10);\n    textMappers[i]->GetTextProperty()->ShadowOn();\n    mappers.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    mappers[i]->SetInputData(uGrids[i]);\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n    actors[i]->GetProperty()->EdgeVisibilityOn();\n    actors[i]->GetProperty()->SetLineWidth(3);\n    actors[i]->GetProperty()->SetOpacity(.5);\n    renderers[i]->AddViewProp(actors[i]);\n\n    textMappers[i]->SetInput(titles[i].c_str());\n    textActors[i]->SetMapper(textMappers[i]);\n    textActors[i]->SetPosition(50, 10);\n    renderers[i]->AddViewProp(textActors[i]);\n\n    // Label the points\n    vtkSmartPointer<vtkLabeledDataMapper> labelMapper =\n        vtkSmartPointer<vtkLabeledDataMapper>::New();\n    labelMapper->SetInputData(uGrids[i]);\n    vtkSmartPointer<vtkActor2D> labelActor = vtkSmartPointer<vtkActor2D>::New();\n    labelActor->SetMapper(labelMapper);\n    renderers[i]->AddViewProp(labelActor);\n\n    // Glyph the points\n    vtkSmartPointer<vtkGlyph3DMapper> pointMapper =\n        vtkSmartPointer<vtkGlyph3DMapper>::New();\n    pointMapper->SetInputData(uGrids[i]);\n    pointMapper->SetSourceConnection(sphere->GetOutputPort());\n    pointMapper->ScalingOff();\n    pointMapper->ScalarVisibilityOff();\n\n    vtkSmartPointer<vtkActor> pointActor = vtkSmartPointer<vtkActor>::New();\n    pointActor->SetMapper(pointMapper);\n    pointActor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"Banana\").GetData());\n    pointActor->GetProperty()->SetSpecular(.6);\n    pointActor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n    pointActor->GetProperty()->SetSpecularPower(100);\n    renderers[i]->AddViewProp(pointActor);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  // Setup the viewports\n  int xGridDimensions = 4;\n  int yGridDimensions = 4;\n  int rendererSize = 240;\n\n  renWin->SetSize(rendererSize * xGridDimensions,\n                  rendererSize * yGridDimensions);\n\n  for (int row = 0; row < yGridDimensions; row++)\n  {\n    for (int col = 0; col < xGridDimensions; col++)\n    {\n      int index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n\n      if (index > int(actors.size()) - 1)\n      {\n        // Add a renderer even if there is no actor.\n        // This makes the render window background all the same color.\n        vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();\n        ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n        ren->SetViewport(viewport);\n        renWin->AddRenderer(ren);\n        continue;\n      }\n\n      renderers[index]->SetViewport(viewport);\n      renderers[index]->SetBackground(\n          colors->GetColor3d(\"SlateGray\").GetData());\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(-30);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  iRen->Initialize();\n\n  renWin->Render();\n\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid>\nMakeUnstructuredGrid(vtkSmartPointer<T> aCell)\n{\n  double* pcoords = aCell->GetParametricCoords();\n  for (int i = 0; i < aCell->GetNumberOfPoints(); ++i)\n  {\n    aCell->GetPointIds()->SetId(i, i);\n    aCell->GetPoints()->SetPoint(i, *(pcoords + 3 * i), *(pcoords + 3 * i + 1),\n                                 *(pcoords + 3 * i + 2));\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(aCell->GetPoints());\n  ug->InsertNextCell(aCell->GetCellType(), aCell->GetPointIds());\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticPolygon()\n{\n  vtkNew<vtkQuadraticPolygon> quadraticPolygon;\n\n  quadraticPolygon->GetPointIds()->SetNumberOfIds(8);\n  quadraticPolygon->GetPointIds()->SetId(0, 0);\n  quadraticPolygon->GetPointIds()->SetId(1, 1);\n  quadraticPolygon->GetPointIds()->SetId(2, 2);\n  quadraticPolygon->GetPointIds()->SetId(3, 3);\n  quadraticPolygon->GetPointIds()->SetId(4, 4);\n  quadraticPolygon->GetPointIds()->SetId(5, 5);\n  quadraticPolygon->GetPointIds()->SetId(6, 6);\n  quadraticPolygon->GetPointIds()->SetId(7, 7);\n\n  quadraticPolygon->GetPoints()->SetNumberOfPoints(8);\n  quadraticPolygon->GetPoints()->SetPoint(0, 0.0, 0.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(1, 2.0, 0.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(2, 2.0, 2.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(3, 0.0, 2.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(4, 1.0, 0.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(5, 2.0, 1.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(6, 1.0, 2.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(7, 0.0, 1.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(5, 3.0, 1.0, 0.0);\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(quadraticPolygon->GetPoints());\n  ug->InsertNextCell(quadraticPolygon->GetCellType(),\n                     quadraticPolygon->GetPointIds());\n  return ug;\n}\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/IsoparametricCellsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IsoparametricCellsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IsoparametricCellsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IsoparametricCellsDemo MACOSX_BUNDLE IsoparametricCellsDemo.cxx )\n  target_link_libraries(IsoparametricCellsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IsoparametricCellsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/IsoparametricCellsDemo/#download-and-build-isoparametriccellsdemo","title":"Download and Build IsoparametricCellsDemo","text":"

Click here to download IsoparametricCellsDemo and its CMakeLists.txt file. Once the tarball IsoparametricCellsDemo.tar has been downloaded and extracted,

cd IsoparametricCellsDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IsoparametricCellsDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Line/","title":"Line","text":"

vtk-examples/Cxx/GeometricObjects/Line

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Line/#description","title":"Description","text":"

The line is a primary one-dimensional cell. It is defined by two points. The direction along the line is from the first point to the second point.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Line/#code","title":"Code","text":"

Line.cxx

#include <vtkActor.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  // Create two points, P0 and P1\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(p0);\n  lineSource->SetPoint2(p1);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(lineSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetLineWidth(4);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Line\");\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->AddActor(actor);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Line/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Line)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Line: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Line MACOSX_BUNDLE Line.cxx )\n  target_link_libraries(Line PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Line\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Line/#download-and-build-line","title":"Download and Build Line","text":"

Click here to download Line and its CMakeLists.txt file. Once the tarball Line.tar has been downloaded and extracted,

cd Line/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Line\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/LinearCellDemo/","title":"LinearCellDemo","text":"

vtk-examples/Cxx/GeometricObjects/LinearCellDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/LinearCellDemo/#description","title":"Description","text":"

Linear cell types found in VTK. Numbers define ordering of the defining points.

Options are provided to show a wireframe (-w) or to colour the back face differently from the front face (-b).

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/LinearCellDemo/#code","title":"Code","text":"

LinearCellDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <vtkHexagonalPrism.h>\n#include <vtkHexahedron.h>\n#include <vtkLine.h>\n#include <vtkPentagonalPrism.h>\n#include <vtkPixel.h>\n#include <vtkPolyLine.h>\n#include <vtkPolyVertex.h>\n#include <vtkPolygon.h>\n#include <vtkPyramid.h>\n#include <vtkQuad.h>\n#include <vtkTetra.h>\n#include <vtkTriangle.h>\n#include <vtkTriangleStrip.h>\n#include <vtkVertex.h>\n#include <vtkVoxel.h>\n#include <vtkWedge.h>\n\n#include <vtk_cli11.h>\n\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n// These functions return a vtkUnstructured grid corresponding to the object.\nnamespace {\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeVertex();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex();\nvtkSmartPointer<vtkUnstructuredGrid> MakeLine();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangle();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon();\nvtkSmartPointer<vtkUnstructuredGrid> MakePixel();\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuad();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTetra();\nvtkSmartPointer<vtkUnstructuredGrid> MakeVoxel();\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexahedron();\nvtkSmartPointer<vtkUnstructuredGrid> MakeWedge();\nvtkSmartPointer<vtkUnstructuredGrid> MakePyramid();\nvtkSmartPointer<vtkUnstructuredGrid> MakePentagonalPrism();\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexagonalPrism();\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Demonstrate the linear cell types found in VTK. Numbers define \"\n               \"ordering of the defining points.\"};\n\n  // Define options\n  std::string fileName;\n  auto wireframeOn{false};\n  app.add_flag(\"-w, --wireframe\", wireframeOn, \"Render a wireframe.\");\n  auto backfaceOn{false};\n  app.add_flag(\"-b, --backface\", backfaceOn,\n               \"Display the back face in a different colour.\");\n  CLI11_PARSE(app, argc, argv);\n  if (wireframeOn && backfaceOn)\n  {\n    std::cerr << \"error: argument -b/--backface: not allowed with argument \"\n                 \"-w/--wireframe\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::vector<std::string> titles;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n\n  std::vector<vtkSmartPointer<vtkUnstructuredGrid>> uGrids;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  uGrids.push_back(MakeVertex());\n  titles.push_back(\"VTK_VERTEX (=1)\");\n  uGrids.push_back(MakePolyVertex());\n  titles.push_back(\"VTK_POLY_VERTEX (=2)\");\n  uGrids.push_back(MakeLine());\n  titles.push_back(\"VTK_LINE (=3)\");\n  uGrids.push_back(MakePolyLine());\n  titles.push_back(\"VTK_POLY_LINE (=4)\");\n  uGrids.push_back(MakeTriangle());\n  titles.push_back(\"VTK_TRIANGLE (=5)\");\n  uGrids.push_back(MakeTriangleStrip());\n  titles.push_back(\"VTK_TRIANGLE_STRIP (=6)\");\n  uGrids.push_back(MakePolygon());\n  titles.push_back(\"VTK_POLYGON (=7)\");\n  uGrids.push_back(MakePixel());\n  titles.push_back(\"VTK_PIXEL (=8)\");\n  uGrids.push_back(MakeQuad());\n  titles.push_back(\"VTK_QUAD (=9)\");\n  uGrids.push_back(MakeTetra());\n  titles.push_back(\"VTK_TETRA (=10)\");\n  uGrids.push_back(MakeVoxel());\n  titles.push_back(\"VTK_VOXEL (=11)\");\n  uGrids.push_back(MakeHexahedron());\n  titles.push_back(\"VTK_HEXAHEDRON (=12)\");\n  uGrids.push_back(MakeWedge());\n  titles.push_back(\"VTK_WEDGE (=13)\");\n  uGrids.push_back(MakePyramid());\n  titles.push_back(\"VTK_PYRAMID (=14)\");\n  uGrids.push_back(MakePentagonalPrism());\n  titles.push_back(\"VTK_PENTAGONAL_PRISM (=15)\");\n  uGrids.push_back(MakeHexagonalPrism());\n  titles.push_back(\"VTK_HEXAGONAL_PRISM (=16)\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"LinearCellDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Create one sphere for all\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.08);\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(10);\n  textProperty->SetJustificationToCentered();\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"MediumSeaGreen\").GetData());\n\n  // Create and link the mappers actors and renderers together.\n  for (unsigned int i = 0; i < uGrids.size(); ++i)\n  {\n    std::cout << \"Creatng: \" << titles[i] << std::endl;\n    textMappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textActors.push_back(vtkSmartPointer<vtkActor2D>::New());\n\n    mappers.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    mappers[i]->SetInputData(uGrids[i]);\n    actors[i]->SetMapper(mappers[i]);\n    if (wireframeOn)\n    {\n      actors[i]->GetProperty()->SetRepresentationToWireframe();\n      actors[i]->GetProperty()->SetLineWidth(2);\n      actors[i]->GetProperty()->SetOpacity(1);\n      actors[i]->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n    }\n    else\n    {\n      actors[i]->GetProperty()->EdgeVisibilityOn();\n      actors[i]->GetProperty()->SetLineWidth(3);\n      actors[i]->GetProperty()->SetColor(\n          colors->GetColor3d(\"Tomato\").GetData());\n      if (backfaceOn)\n      {\n        actors[i]->SetBackfaceProperty(backProperty);\n        actors[i]->GetProperty()->SetOpacity(1);\n      }\n      else\n      {\n        actors[i]->GetProperty()->SetOpacity(0.5);\n      }\n    }\n    renderers[i]->AddViewProp(actors[i]);\n\n    textMappers[i]->SetInput(titles[i].c_str());\n    textActors[i]->SetMapper(textMappers[i]);\n    textActors[i]->SetPosition(50, 10);\n    if (wireframeOn)\n    {\n      textActors[i]->GetProperty()->SetColor(\n          colors->GetColor3d(\"Black\").GetData());\n    }\n\n    renderers[i]->AddViewProp(textActors[i]);\n\n    // Label the points\n    vtkSmartPointer<vtkLabeledDataMapper> labelMapper =\n        vtkSmartPointer<vtkLabeledDataMapper>::New();\n    labelMapper->SetInputData(uGrids[i]);\n    vtkSmartPointer<vtkActor2D> labelActor = vtkSmartPointer<vtkActor2D>::New();\n    labelActor->SetMapper(labelMapper);\n    if (wireframeOn)\n    {\n      textActors[i]->GetProperty()->SetColor(\n          colors->GetColor3d(\"Snow\").GetData());\n    }\n    renderers[i]->AddViewProp(labelActor);\n\n    // Glyph the points\n    vtkSmartPointer<vtkGlyph3DMapper> pointMapper =\n        vtkSmartPointer<vtkGlyph3DMapper>::New();\n    pointMapper->SetInputData(uGrids[i]);\n    pointMapper->SetSourceConnection(sphere->GetOutputPort());\n    pointMapper->ScalingOff();\n    pointMapper->ScalarVisibilityOff();\n\n    vtkSmartPointer<vtkActor> pointActor = vtkSmartPointer<vtkActor>::New();\n    pointActor->SetMapper(pointMapper);\n    if (wireframeOn)\n    {\n      pointActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"Banana\").GetData());\n    }\n    else\n    {\n      pointActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"Banana\").GetData());\n    }\n    pointActor->GetProperty()->SetSpecular(.6);\n    pointActor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n    pointActor->GetProperty()->SetSpecularPower(100);\n    renderers[i]->AddViewProp(pointActor);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  // Set up the viewports\n  int xGridDimensions = 4;\n  int yGridDimensions = 4;\n  int rendererSize = 300;\n\n  renWin->SetSize(rendererSize * xGridDimensions,\n                  rendererSize * yGridDimensions);\n\n  for (int row = 0; row < yGridDimensions; row++)\n  {\n    for (int col = 0; col < xGridDimensions; col++)\n    {\n      int index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      if (index > int(actors.size()) - 1)\n      {\n        // Add a renderer even if there is no actor.\n        // This makes the render window background all the same color.\n        vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();\n        if (wireframeOn)\n        {\n          ren->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n        }\n        else\n        {\n          ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n        }\n        ren->SetViewport(viewport);\n        renWin->AddRenderer(ren);\n        continue;\n      }\n\n      if (wireframeOn)\n      {\n        renderers[index]->SetBackground(\n            colors->GetColor3d(\"LightSlateGray\").GetData());\n      }\n      else\n      {\n        renderers[index]->SetBackground(\n            colors->GetColor3d(\"SlateGray\").GetData());\n      }\n      renderers[index]->SetViewport(viewport);\n      renderers[index]->ResetCamera();\n      switch (index)\n      {\n      case 0:\n        renderers[index]->GetActiveCamera()->Dolly(0.1);\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 1:\n        renderers[index]->GetActiveCamera()->Dolly(0.8);\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 2:\n        renderers[index]->GetActiveCamera()->Dolly(0.4);\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 4:\n        renderers[index]->GetActiveCamera()->Dolly(0.7);\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 5:\n        renderers[index]->GetActiveCamera()->Dolly(1.1);\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 6:\n        renderers[index]->GetActiveCamera()->Azimuth(0);\n        renderers[index]->GetActiveCamera()->Elevation(-45);\n        break;\n      case 7:\n        renderers[index]->GetActiveCamera()->Azimuth(0);\n        renderers[index]->GetActiveCamera()->Elevation(-45);\n        break;\n      case 8:\n        renderers[index]->GetActiveCamera()->Azimuth(0);\n        renderers[index]->GetActiveCamera()->Elevation(-45);\n        break;\n      case 9:\n        renderers[index]->GetActiveCamera()->Azimuth(0);\n        renderers[index]->GetActiveCamera()->Elevation(-22.5);\n        break;\n      case 10:\n        renderers[index]->GetActiveCamera()->Azimuth(-22.5);\n        renderers[index]->GetActiveCamera()->Elevation(15);\n        break;\n      case 11:\n        renderers[index]->GetActiveCamera()->Azimuth(-22.5);\n        renderers[index]->GetActiveCamera()->Elevation(15);\n        break;\n      case 12:\n        renderers[index]->GetActiveCamera()->Azimuth(-45);\n        renderers[index]->GetActiveCamera()->Elevation(15);\n        break;\n      case 13:\n        renderers[index]->GetActiveCamera()->Azimuth(0);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 14:\n        renderers[index]->GetActiveCamera()->Azimuth(-22.5);\n        renderers[index]->GetActiveCamera()->Elevation(10);\n        break;\n      case 15:\n        renderers[index]->GetActiveCamera()->Azimuth(-30);\n        renderers[index]->GetActiveCamera()->Elevation(15);\n        break;\n      default:\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      }\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  iRen->Initialize();\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeVertex()\n{\n  // A vertex is a cell that represents a 3D point\n  int numberOfVertices = 1;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n\n  vtkSmartPointer<vtkVertex> vertex = vtkSmartPointer<vtkVertex>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    vertex->GetPointIds()->SetId(i, i);\n  }\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(vertex->GetCellType(), vertex->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex()\n{\n  // A polyvertex is a cell represents a set of 0D vertices\n  int numberOfVertices = 6;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, 0.4);\n  points->InsertNextPoint(0, 1, 0.6);\n\n  vtkSmartPointer<vtkPolyVertex> polyVertex =\n      vtkSmartPointer<vtkPolyVertex>::New();\n  polyVertex->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyVertex->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyVertex->GetCellType(), polyVertex->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeLine()\n{\n  // A line is a cell that represents a 1D point\n  int numberOfVertices = 2;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0.5, 0.5, 0);\n\n  vtkSmartPointer<vtkLine> line = vtkSmartPointer<vtkLine>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    line->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(line->GetCellType(), line->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine()\n{\n  // A polyline is a cell that represents a set of 1D lines\n  int numberOfVertices = 5;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0.5, 0);\n  points->InsertNextPoint(0.5, 0, 0);\n  points->InsertNextPoint(1, 0.3, 0);\n  points->InsertNextPoint(1.5, 0.4, 0);\n  points->InsertNextPoint(2.0, 0.4, 0);\n\n  vtkSmartPointer<vtkPolyLine> polyline = vtkSmartPointer<vtkPolyLine>::New();\n  polyline->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyline->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyline->GetCellType(), polyline->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangle()\n{\n  // A triangle is a cell that represents a 1D point\n  int numberOfVertices = 3;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0.5, 0.5, 0);\n  points->InsertNextPoint(0.2, 1, 0);\n\n  vtkSmartPointer<vtkTriangle> triangle = vtkSmartPointer<vtkTriangle>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    triangle->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(triangle->GetCellType(), triangle->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip()\n{\n  // A triangle is a cell that represents a triangle strip\n  int numberOfVertices = 10;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, -0.1, 0);\n  points->InsertNextPoint(0.5, 1, 0);\n  points->InsertNextPoint(2.0, -0.1, 0);\n  points->InsertNextPoint(1.5, 0.8, 0);\n  points->InsertNextPoint(3.0, 0, 0);\n  points->InsertNextPoint(2.5, 0.9, 0);\n  points->InsertNextPoint(4.0, -0.2, 0);\n  points->InsertNextPoint(3.5, 0.8, 0);\n  points->InsertNextPoint(4.5, 1.1, 0);\n\n  vtkSmartPointer<vtkTriangleStrip> trianglestrip =\n      vtkSmartPointer<vtkTriangleStrip>::New();\n  trianglestrip->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    trianglestrip->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(trianglestrip->GetCellType(),\n                     trianglestrip->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon()\n{\n  // A polygon is a cell that represents a polygon\n  int numberOfVertices = 6;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, -0.1, 0);\n  points->InsertNextPoint(0.8, 0.5, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0.6, 1.2, 0);\n  points->InsertNextPoint(0, 0.8, 0);\n\n  vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New();\n  polygon->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polygon->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(polygon->GetCellType(), polygon->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePixel()\n\n{\n  // A pixel is a cell that represents a pixel\n  vtkSmartPointer<vtkPixel> pixel = vtkSmartPointer<vtkPixel>::New();\n  pixel->GetPoints()->SetPoint(0, 0, 0, 0);\n  pixel->GetPoints()->SetPoint(1, 1, 0, 0);\n  pixel->GetPoints()->SetPoint(2, 0, 1, 0);\n  pixel->GetPoints()->SetPoint(3, 1, 1, 0);\n\n  pixel->GetPointIds()->SetId(0, 0);\n  pixel->GetPointIds()->SetId(1, 1);\n  pixel->GetPointIds()->SetId(2, 2);\n  pixel->GetPointIds()->SetId(3, 3);\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(pixel->GetPoints());\n  ug->InsertNextCell(pixel->GetCellType(), pixel->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuad()\n\n{\n  // A quad is a cell that represents a quad\n  vtkSmartPointer<vtkQuad> quad = vtkSmartPointer<vtkQuad>::New();\n  quad->GetPoints()->SetPoint(0, 0, 0, 0);\n  quad->GetPoints()->SetPoint(1, 1, 0, 0);\n  quad->GetPoints()->SetPoint(2, 1, 1, 0);\n  quad->GetPoints()->SetPoint(3, 0, 1, 0);\n\n  quad->GetPointIds()->SetId(0, 0);\n  quad->GetPointIds()->SetId(1, 1);\n  quad->GetPointIds()->SetId(2, 2);\n  quad->GetPointIds()->SetId(3, 3);\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(quad->GetPoints());\n  ug->InsertNextCell(quad->GetCellType(), quad->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTetra()\n{\n  // Make a tetrahedron.\n  int numberOfVertices = 4;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 1);\n\n  vtkSmartPointer<vtkTetra> tetra = vtkSmartPointer<vtkTetra>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    tetra->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkCellArray> cellArray =\n      vtkSmartPointer<vtkCellArray>::New();\n  cellArray->InsertNextCell(tetra);\n\n  vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  unstructuredGrid->SetPoints(points);\n  unstructuredGrid->SetCells(VTK_TETRA, cellArray);\n\n  return unstructuredGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeVoxel()\n{\n  // A voxel is a representation of a regular grid in 3-D space.\n  int numberOfVertices = 8;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, 1);\n  points->InsertNextPoint(0, 1, 1);\n  points->InsertNextPoint(1, 1, 1);\n\n  vtkSmartPointer<vtkVoxel> voxel = vtkSmartPointer<vtkVoxel>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    voxel->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(voxel->GetCellType(), voxel->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexahedron()\n{\n  // A regular hexagon (cube) with all faces square and three squares around\n  // each vertex is created below.\n\n  // Set up the coordinates of eight points\n  // (the two faces must be in counter-clockwise\n  // order as viewed from the outside).\n\n  int numberOfVertices = 8;\n\n  // Create the points\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 1.0);\n  points->InsertNextPoint(1.0, 0.0, 1.0);\n  points->InsertNextPoint(1.0, 1.0, 1.0);\n  points->InsertNextPoint(0.0, 1.0, 1.0);\n\n  // Create a hexahedron from the points\n  vtkSmartPointer<vtkHexahedron> hex = vtkSmartPointer<vtkHexahedron>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    hex->GetPointIds()->SetId(i, i);\n  }\n\n  // Add the points and hexahedron to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(hex->GetCellType(), hex->GetPointIds());\n\n  return uGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeWedge()\n{\n\n  // A wedge consists of two triangular ends and three rectangular faces.\n\n  int numberOfVertices = 6;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0, 0.5, 0.5);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(1, 0.0, 0.0);\n  points->InsertNextPoint(1, 0.5, 0.5);\n\n  vtkSmartPointer<vtkWedge> wedge = vtkSmartPointer<vtkWedge>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    wedge->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(wedge->GetCellType(), wedge->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePyramid()\n{\n  // Make a regular square pyramid.\n  int numberOfVertices = 5;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n\n  float p0[3] = {1.0, 1.0, 0.0};\n  float p1[3] = {-1.0, 1.0, 0.0};\n  float p2[3] = {-1.0, -1.0, 0.0};\n  float p3[3] = {1.0, -1.0, 0.0};\n  float p4[3] = {0.0, 0.0, 1.0};\n\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n  points->InsertNextPoint(p4);\n\n  vtkSmartPointer<vtkPyramid> pyramid = vtkSmartPointer<vtkPyramid>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    pyramid->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(pyramid->GetCellType(), pyramid->GetPointIds());\n\n  return ug;\n}\nvtkSmartPointer<vtkUnstructuredGrid> MakePentagonalPrism()\n{\n  vtkSmartPointer<vtkPentagonalPrism> pentagonalPrism =\n      vtkSmartPointer<vtkPentagonalPrism>::New();\n\n  pentagonalPrism->GetPointIds()->SetId(0, 0);\n  pentagonalPrism->GetPointIds()->SetId(1, 1);\n  pentagonalPrism->GetPointIds()->SetId(2, 2);\n  pentagonalPrism->GetPointIds()->SetId(3, 3);\n  pentagonalPrism->GetPointIds()->SetId(4, 4);\n  pentagonalPrism->GetPointIds()->SetId(5, 5);\n  pentagonalPrism->GetPointIds()->SetId(6, 6);\n  pentagonalPrism->GetPointIds()->SetId(7, 7);\n  pentagonalPrism->GetPointIds()->SetId(8, 8);\n  pentagonalPrism->GetPointIds()->SetId(9, 9);\n\n  double scale = 2.0;\n  pentagonalPrism->GetPoints()->SetPoint(0, 11 / scale, 10 / scale, 10 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(1, 13 / scale, 10 / scale, 10 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(2, 14 / scale, 12 / scale, 10 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(3, 12 / scale, 14 / scale, 10 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(4, 10 / scale, 12 / scale, 10 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(5, 11 / scale, 10 / scale, 14 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(6, 13 / scale, 10 / scale, 14 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(7, 14 / scale, 12 / scale, 14 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(8, 12 / scale, 14 / scale, 14 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(9, 10 / scale, 12 / scale, 14 / scale);\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(pentagonalPrism->GetPoints());\n  ug->InsertNextCell(pentagonalPrism->GetCellType(),\n                     pentagonalPrism->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexagonalPrism()\n{\n  vtkSmartPointer<vtkHexagonalPrism> hexagonalPrism =\n      vtkSmartPointer<vtkHexagonalPrism>::New();\n  hexagonalPrism->GetPointIds()->SetId(0, 0);\n  hexagonalPrism->GetPointIds()->SetId(1, 1);\n  hexagonalPrism->GetPointIds()->SetId(2, 2);\n  hexagonalPrism->GetPointIds()->SetId(3, 3);\n  hexagonalPrism->GetPointIds()->SetId(4, 4);\n  hexagonalPrism->GetPointIds()->SetId(5, 5);\n  hexagonalPrism->GetPointIds()->SetId(6, 6);\n  hexagonalPrism->GetPointIds()->SetId(7, 7);\n  hexagonalPrism->GetPointIds()->SetId(8, 8);\n  hexagonalPrism->GetPointIds()->SetId(9, 9);\n  hexagonalPrism->GetPointIds()->SetId(10, 10);\n  hexagonalPrism->GetPointIds()->SetId(11, 11);\n\n  double scale = 2.0;\n  hexagonalPrism->GetPoints()->SetPoint(0, 11 / scale, 10 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(1, 13 / scale, 10 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(2, 14 / scale, 12 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(3, 13 / scale, 14 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(4, 11 / scale, 14 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(5, 10 / scale, 12 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(6, 11 / scale, 10 / scale, 14 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(7, 13 / scale, 10 / scale, 14 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(8, 14 / scale, 12 / scale, 14 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(9, 13 / scale, 14 / scale, 14 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(10, 11 / scale, 14 / scale, 14 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(11, 10 / scale, 12 / scale, 14 / scale);\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(hexagonalPrism->GetPoints());\n  ug->InsertNextCell(hexagonalPrism->GetCellType(),\n                     hexagonalPrism->GetPointIds());\n\n  return ug;\n}\n\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/LinearCellDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LinearCellDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n  cli11\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LinearCellDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LinearCellDemo MACOSX_BUNDLE LinearCellDemo.cxx )\n  target_link_libraries(LinearCellDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LinearCellDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/LinearCellDemo/#download-and-build-linearcelldemo","title":"Download and Build LinearCellDemo","text":"

Click here to download LinearCellDemo and its CMakeLists.txt file. Once the tarball LinearCellDemo.tar has been downloaded and extracted,

cd LinearCellDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LinearCellDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/LongLine/","title":"LongLine","text":"

vtk-examples/Cxx/GeometricObjects/LongLine

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/LongLine/#description","title":"Description","text":"

Connect several points with a line.

Seealso

ColoredLines.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/LongLine/#code","title":"Code","text":"

LongLine.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  // Create five points.\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n  double p2[3] = {0.0, 1.0, 2.0};\n  double p3[3] = {1.0, 2.0, 3.0};\n\n  // Create a vtkPoints object and store the points in it\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(origin);\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n\n  // Create a cell array to store the lines in and add the lines to it\n  vtkNew<vtkCellArray> lines;\n\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    vtkNew<vtkLine> line;\n    line->GetPointIds()->SetId(0, i);\n    line->GetPointIds()->SetId(1, i + 1);\n    lines->InsertNextCell(line);\n  }\n\n  // Create a polydata to store everything in\n  vtkNew<vtkPolyData> linesPolyData;\n\n  // Add the points to the dataset\n  linesPolyData->SetPoints(points);\n\n  // Add the lines to the dataset\n  linesPolyData->SetLines(lines);\n\n  // Setup actor and mapper\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(linesPolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetLineWidth(4);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"LongLine\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/LongLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LongLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LongLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LongLine MACOSX_BUNDLE LongLine.cxx )\n  target_link_libraries(LongLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LongLine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/LongLine/#download-and-build-longline","title":"Download and Build LongLine","text":"

Click here to download LongLine and its CMakeLists.txt file. Once the tarball LongLine.tar has been downloaded and extracted,

cd LongLine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LongLine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/OpenVRCone/","title":"OpenVRCone","text":"

vtk-examples/Cxx/GeometricObjects/OpenVRCone

"},{"location":"Cxx/GeometricObjects/OpenVRCone/#description","title":"Description","text":"

This example demonstrates rendering of a Cone in OpenVR.

Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/OpenVRCone/#code","title":"Code","text":"

OpenVRCone.cxx

#include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n// Chethana B\n// Organisation: Virtual Environments Lab, Chung-Ang Univeristy, Seoul.\nint main(int, char*[])\n{\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/OpenVRCone/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRCone)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRCone: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRCone MACOSX_BUNDLE OpenVRCone.cxx )\n  target_link_libraries(OpenVRCone PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRCone\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/OpenVRCone/#download-and-build-openvrcone","title":"Download and Build OpenVRCone","text":"

Click here to download OpenVRCone and its CMakeLists.txt file. Once the tarball OpenVRCone.tar has been downloaded and extracted,

cd OpenVRCone/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OpenVRCone\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/OpenVRCube/","title":"OpenVRCube","text":"

vtk-examples/Cxx/GeometricObjects/OpenVRCube

"},{"location":"Cxx/GeometricObjects/OpenVRCube/#description","title":"Description","text":"

This example demonstrates rendering of a Cube in OpenVR.

Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/OpenVRCube/#code","title":"Code","text":"

OpenVRCube.cxx

#include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n\nint main(int, char*[])\n{\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVRCube\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/OpenVRCube/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRCube)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRCube: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRCube MACOSX_BUNDLE OpenVRCube.cxx )\n  target_link_libraries(OpenVRCube PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRCube\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/OpenVRCube/#download-and-build-openvrcube","title":"Download and Build OpenVRCube","text":"

Click here to download OpenVRCube and its CMakeLists.txt file. Once the tarball OpenVRCube.tar has been downloaded and extracted,

cd OpenVRCube/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OpenVRCube\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/OpenVRCylinder/","title":"OpenVRCylinder","text":"

vtk-examples/Cxx/GeometricObjects/OpenVRCylinder

"},{"location":"Cxx/GeometricObjects/OpenVRCylinder/#description","title":"Description","text":"

This example demonstrates rendering of a Cylinder in OpenVR.

Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/OpenVRCylinder/#code","title":"Code","text":"

OpenVRCylinder.cxx

#include <vtkActor.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n\nint main(int, char* argv[])\n{\n  // Create a sphere\n  vtkNew<vtkCylinderSource> cylinderSource;\n  cylinderSource->SetCenter(0.0, 0.0, 0.0);\n  cylinderSource->SetRadius(5.0);\n  cylinderSource->SetHeight(7.0);\n  cylinderSource->SetResolution(100);\n\n  // Create a mapper and actor\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cylinderSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVRCylinder\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/OpenVRCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRCylinder MACOSX_BUNDLE OpenVRCylinder.cxx )\n  target_link_libraries(OpenVRCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/OpenVRCylinder/#download-and-build-openvrcylinder","title":"Download and Build OpenVRCylinder","text":"

Click here to download OpenVRCylinder and its CMakeLists.txt file. Once the tarball OpenVRCylinder.tar has been downloaded and extracted,

cd OpenVRCylinder/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OpenVRCylinder\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/OpenVRFrustum/","title":"OpenVRFrustum","text":"

vtk-examples/Cxx/GeometricObjects/OpenVRFrustum

"},{"location":"Cxx/GeometricObjects/OpenVRFrustum/#description","title":"Description","text":"

VTK + OpenVR Frustrum Example

Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/OpenVRFrustum/#code","title":"Code","text":"

OpenVRFrustum.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFrustumSource.h>\n#include <vtkMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPlanes.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkShrinkPolyData.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCamera> camera;\n  camera->SetClippingRange(.1, .4);\n  double planesArray[24];\n\n  camera->GetFrustumPlanes(1.0, planesArray);\n\n  vtkNew<vtkPlanes> planes;\n  planes->SetFrustumPlanes(planesArray);\n\n  vtkNew<vtkFrustumSource> frustumSource;\n  frustumSource->ShowLinesOff();\n  frustumSource->SetPlanes(planes);\n\n  vtkNew<vtkShrinkPolyData> shrink;\n  shrink->SetInputConnection(frustumSource->GetOutputPort());\n  shrink->SetShrinkFactor(.9);\n\n  // Create a mapper and actor\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVRFrustum\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  // Position the camera so that we can see the frustum\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/OpenVRFrustum/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRFrustum)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRFrustum: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRFrustum MACOSX_BUNDLE OpenVRFrustum.cxx )\n  target_link_libraries(OpenVRFrustum PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRFrustum\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/OpenVRFrustum/#download-and-build-openvrfrustum","title":"Download and Build OpenVRFrustum","text":"

Click here to download OpenVRFrustum and its CMakeLists.txt file. Once the tarball OpenVRFrustum.tar has been downloaded and extracted,

cd OpenVRFrustum/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OpenVRFrustum\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/OpenVROrientedArrow/","title":"OpenVROrientedArrow","text":"

vtk-examples/Cxx/GeometricObjects/OpenVROrientedArrow

"},{"location":"Cxx/GeometricObjects/OpenVROrientedArrow/#description","title":"Description","text":"

VTK + OpenVR OrientedArrow example.

Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/OpenVROrientedArrow/#code","title":"Code","text":"

OpenVROrientedArrow.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\n#define USER_MATRIX\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 77, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n\n  // Generate a random start and end point\n  double startPoint[3];\n  double endPoint[3];\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    startPoint[i] = rng->GetRangeValue(-10, 10);\n    rng->Next();\n    endPoint[i] = rng->GetRangeValue(-10, 10);\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (auto i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);\n  transform->Concatenate(matrix);\n  transform->Scale(length, length, length);\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(arrowSource->GetOutputPort());\n\n  // Create a mapper and actor for the arrow\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n#ifdef USER_MATRIX\n  mapper->SetInputConnection(arrowSource->GetOutputPort());\n  actor->SetUserMatrix(transform->GetMatrix());\n#else\n  mapper->SetInputConnection(transformPD->GetOutputPort());\n#endif\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create spheres for start and end point\n  vtkNew<vtkSphereSource> sphereStartSource;\n  sphereStartSource->SetCenter(startPoint);\n  sphereStartSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereStartMapper;\n  sphereStartMapper->SetInputConnection(sphereStartSource->GetOutputPort());\n  vtkNew<vtkActor> sphereStart;\n  sphereStart->SetMapper(sphereStartMapper);\n  sphereStart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  vtkNew<vtkSphereSource> sphereEndSource;\n  sphereEndSource->SetCenter(endPoint);\n  sphereEndSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereEndMapper;\n  sphereEndMapper->SetInputConnection(sphereEndSource->GetOutputPort());\n  vtkNew<vtkActor> sphereEnd;\n  sphereEnd->SetMapper(sphereEndMapper);\n  sphereEnd->GetProperty()->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVROrientedArrow\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereStart);\n  renderer->AddActor(sphereEnd);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/OpenVROrientedArrow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVROrientedArrow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVROrientedArrow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVROrientedArrow MACOSX_BUNDLE OpenVROrientedArrow.cxx )\n  target_link_libraries(OpenVROrientedArrow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVROrientedArrow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/OpenVROrientedArrow/#download-and-build-openvrorientedarrow","title":"Download and Build OpenVROrientedArrow","text":"

Click here to download OpenVROrientedArrow and its CMakeLists.txt file. Once the tarball OpenVROrientedArrow.tar has been downloaded and extracted,

cd OpenVROrientedArrow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OpenVROrientedArrow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/OpenVROrientedCylinder/","title":"OpenVROrientedCylinder","text":"

vtk-examples/Cxx/GeometricObjects/OpenVROrientedCylinder

"},{"location":"Cxx/GeometricObjects/OpenVROrientedCylinder/#description","title":"Description","text":"

VTK + OpenVR OrientedCylinder example.

Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/OpenVROrientedCylinder/#code","title":"Code","text":"

OpenVROrientedCylinder.cxx

#include <vtkActor.h>\n#include <vtkCylinderSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\n#define USER_MATRIX\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 77, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create a cylinder.\n  // Cylinder height vector is (0,1,0).\n  // Cylinder center is in the middle of the cylinder\n  vtkNew<vtkCylinderSource> cylinderSource;\n  cylinderSource->SetResolution(15);\n\n  // Generate a random start and end point\n  double startPoint[3];\n  double endPoint[3];\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    startPoint[i] = rng->GetRangeValue(-10, 10);\n    rng->Next();\n    endPoint[i] = rng->GetRangeValue(-10, 10);\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);   // translate to starting point\n  transform->Concatenate(matrix);     // apply direction cosines\n  transform->RotateZ(-90.0);          // align cylinder to x axis\n  transform->Scale(1.0, length, 1.0); // scale along the height vector\n  transform->Translate(0, .5, 0);     // translate to start of cylinder\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(cylinderSource->GetOutputPort());\n\n  // Create a mapper and actor for the cylinder\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n#ifdef USER_MATRIX\n  mapper->SetInputConnection(cylinderSource->GetOutputPort());\n  actor->SetUserMatrix(transform->GetMatrix());\n#else\n  mapper->SetInputConnection(transformPD->GetOutputPort());\n#endif\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create spheres for start and end point\n  vtkNew<vtkSphereSource> sphereStartSource;\n  sphereStartSource->SetCenter(startPoint);\n  sphereStartSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereStartMapper;\n  sphereStartMapper->SetInputConnection(sphereStartSource->GetOutputPort());\n  vtkNew<vtkActor> sphereStart;\n  sphereStart->SetMapper(sphereStartMapper);\n  sphereStart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  vtkNew<vtkSphereSource> sphereEndSource;\n  sphereEndSource->SetCenter(endPoint);\n  sphereEndSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereEndMapper;\n  sphereEndMapper->SetInputConnection(sphereEndSource->GetOutputPort());\n  vtkNew<vtkActor> sphereEnd;\n  sphereEnd->SetMapper(sphereEndMapper);\n  sphereEnd->GetProperty()->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVROrientedCylinder\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereStart);\n  renderer->AddActor(sphereEnd);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/OpenVROrientedCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVROrientedCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVROrientedCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVROrientedCylinder MACOSX_BUNDLE OpenVROrientedCylinder.cxx )\n  target_link_libraries(OpenVROrientedCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVROrientedCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/OpenVROrientedCylinder/#download-and-build-openvrorientedcylinder","title":"Download and Build OpenVROrientedCylinder","text":"

Click here to download OpenVROrientedCylinder and its CMakeLists.txt file. Once the tarball OpenVROrientedCylinder.tar has been downloaded and extracted,

cd OpenVROrientedCylinder/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OpenVROrientedCylinder\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/OpenVRSphere/","title":"OpenVRSphere","text":"

vtk-examples/Cxx/GeometricObjects/OpenVRSphere

"},{"location":"Cxx/GeometricObjects/OpenVRSphere/#description","title":"Description","text":"

This example demonstrates rendering of a Sphere in OpenVR.

Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/OpenVRSphere/#code","title":"Code","text":"

OpenVRSphere.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  // Create a Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n\n  // Create a Mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an Actor\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a Renderer, RenderWindow, RenderWindowInteractor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVRSphere\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/OpenVRSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRSphere MACOSX_BUNDLE OpenVRSphere.cxx )\n  target_link_libraries(OpenVRSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/OpenVRSphere/#download-and-build-openvrsphere","title":"Download and Build OpenVRSphere","text":"

Click here to download OpenVRSphere and its CMakeLists.txt file. Once the tarball OpenVRSphere.tar has been downloaded and extracted,

cd OpenVRSphere/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OpenVRSphere\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/OpenVRTessellatedBoxSource/","title":"OpenVRTessellatedBoxSource","text":"

vtk-examples/Cxx/GeometricObjects/OpenVRTessellatedBoxSource

"},{"location":"Cxx/GeometricObjects/OpenVRTessellatedBoxSource/#description","title":"Description","text":"

VTK + OpenVR TessellatedBoxSource example.

Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/OpenVRTessellatedBoxSource/#code","title":"Code","text":"

OpenVRTessellatedBoxSource.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkProperty.h>\n#include <vtkShrinkFilter.h>\n#include <vtkTessellatedBoxSource.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n  double bounds[6];\n  bounds[0] = -10.0;\n  bounds[1] = 10.0;\n  bounds[2] = 10.0;\n  bounds[3] = 20.0;\n  bounds[4] = -5.0;\n  bounds[5] = 5.0;\n\n  vtkNew<vtkTessellatedBoxSource> boxSource;\n  boxSource->SetLevel(3);\n  boxSource->QuadsOn();\n  boxSource->SetBounds(bounds);\n  boxSource->SetOutputPointsPrecision(vtkAlgorithm::SINGLE_PRECISION);\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(boxSource->GetOutputPort());\n  shrink->SetShrinkFactor(.8);\n\n  // Create a mapper and actor\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVRTessellatedBoxSource\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/OpenVRTessellatedBoxSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRTessellatedBoxSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRTessellatedBoxSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRTessellatedBoxSource MACOSX_BUNDLE OpenVRTessellatedBoxSource.cxx )\n  target_link_libraries(OpenVRTessellatedBoxSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRTessellatedBoxSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/OpenVRTessellatedBoxSource/#download-and-build-openvrtessellatedboxsource","title":"Download and Build OpenVRTessellatedBoxSource","text":"

Click here to download OpenVRTessellatedBoxSource and its CMakeLists.txt file. Once the tarball OpenVRTessellatedBoxSource.tar has been downloaded and extracted,

cd OpenVRTessellatedBoxSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OpenVRTessellatedBoxSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/OrientedArrow/","title":"OrientedArrow","text":"

vtk-examples/Cxx/GeometricObjects/OrientedArrow

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/OrientedArrow/#description","title":"Description","text":"

This example illustrates how to create and display an arrow that passes through two points.

It demonstrates two different ways to apply the transform:

  1. Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter.

  2. Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

Switch between the two methods by #defining USER_MATRIX or leaving out the #define.

See also

Compare this example with OrientedCylinder. The transform is different because the cylinder height direction is along the y-axis and the arrow height is along the x axis.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/OrientedArrow/#code","title":"Code","text":"

OrientedArrow.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\n#define USER_MATRIX\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 77, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n\n  // Generate a random start and end point\n  double startPoint[3];\n  double endPoint[3];\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    startPoint[i] = rng->GetRangeValue(-10, 10);\n    rng->Next();\n    endPoint[i] = rng->GetRangeValue(-10, 10);\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (auto i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);\n  transform->Concatenate(matrix);\n  transform->Scale(length, length, length);\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(arrowSource->GetOutputPort());\n\n  // Create a mapper and actor for the arrow\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n#ifdef USER_MATRIX\n  mapper->SetInputConnection(arrowSource->GetOutputPort());\n  actor->SetUserMatrix(transform->GetMatrix());\n#else\n  mapper->SetInputConnection(transformPD->GetOutputPort());\n#endif\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create spheres for start and end point\n  vtkNew<vtkSphereSource> sphereStartSource;\n  sphereStartSource->SetCenter(startPoint);\n  sphereStartSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereStartMapper;\n  sphereStartMapper->SetInputConnection(sphereStartSource->GetOutputPort());\n  vtkNew<vtkActor> sphereStart;\n  sphereStart->SetMapper(sphereStartMapper);\n  sphereStart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  vtkNew<vtkSphereSource> sphereEndSource;\n  sphereEndSource->SetCenter(endPoint);\n  sphereEndSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereEndMapper;\n  sphereEndMapper->SetInputConnection(sphereEndSource->GetOutputPort());\n  vtkNew<vtkActor> sphereEnd;\n  sphereEnd->SetMapper(sphereEndMapper);\n  sphereEnd->GetProperty()->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OrientedArrow\");\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereStart);\n  renderer->AddActor(sphereEnd);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/OrientedArrow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientedArrow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientedArrow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientedArrow MACOSX_BUNDLE OrientedArrow.cxx )\n  target_link_libraries(OrientedArrow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientedArrow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/OrientedArrow/#download-and-build-orientedarrow","title":"Download and Build OrientedArrow","text":"

Click here to download OrientedArrow and its CMakeLists.txt file. Once the tarball OrientedArrow.tar has been downloaded and extracted,

cd OrientedArrow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OrientedArrow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/OrientedCylinder/","title":"OrientedCylinder","text":"

vtk-examples/Cxx/GeometricObjects/OrientedCylinder

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/OrientedCylinder/#description","title":"Description","text":"

This example illustrates how to create and display a cylinder that passes through two points.

It demonstrates two different ways to apply the transform:

  1. Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter.

  2. Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

Switch between the two methods by #defining USER_MATRIX or leaving out the #define.

See also

Compare this example with OrientedArrow. The transform is different because the cylinder height direction is along the y-axis and the arrow height is along the x axis.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/OrientedCylinder/#code","title":"Code","text":"

OrientedCylinder.cxx

#include <vtkActor.h>\n#include <vtkCylinderSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\n#define USER_MATRIX\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 77, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create a cylinder.\n  // Cylinder height vector is (0,1,0).\n  // Cylinder center is in the middle of the cylinder\n  vtkNew<vtkCylinderSource> cylinderSource;\n  cylinderSource->SetResolution(15);\n\n  // Generate a random start and end point\n  double startPoint[3];\n  double endPoint[3];\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    startPoint[i] = rng->GetRangeValue(-10, 10);\n    rng->Next();\n    endPoint[i] = rng->GetRangeValue(-10, 10);\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);   // translate to starting point\n  transform->Concatenate(matrix);     // apply direction cosines\n  transform->RotateZ(-90.0);          // align cylinder to x axis\n  transform->Scale(1.0, length, 1.0); // scale along the height vector\n  transform->Translate(0, .5, 0);     // translate to start of cylinder\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(cylinderSource->GetOutputPort());\n\n  // Create a mapper and actor for the cylinder\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n#ifdef USER_MATRIX\n  mapper->SetInputConnection(cylinderSource->GetOutputPort());\n  actor->SetUserMatrix(transform->GetMatrix());\n#else\n  mapper->SetInputConnection(transformPD->GetOutputPort());\n#endif\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create spheres for start and end point\n  vtkNew<vtkSphereSource> sphereStartSource;\n  sphereStartSource->SetCenter(startPoint);\n  sphereStartSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereStartMapper;\n  sphereStartMapper->SetInputConnection(sphereStartSource->GetOutputPort());\n  vtkNew<vtkActor> sphereStart;\n  sphereStart->SetMapper(sphereStartMapper);\n  sphereStart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  vtkNew<vtkSphereSource> sphereEndSource;\n  sphereEndSource->SetCenter(endPoint);\n  sphereEndSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereEndMapper;\n  sphereEndMapper->SetInputConnection(sphereEndSource->GetOutputPort());\n  vtkNew<vtkActor> sphereEnd;\n  sphereEnd->SetMapper(sphereEndMapper);\n  sphereEnd->GetProperty()->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OrientedCylinder\");\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereStart);\n  renderer->AddActor(sphereEnd);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/OrientedCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientedCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientedCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientedCylinder MACOSX_BUNDLE OrientedCylinder.cxx )\n  target_link_libraries(OrientedCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientedCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/OrientedCylinder/#download-and-build-orientedcylinder","title":"Download and Build OrientedCylinder","text":"

Click here to download OrientedCylinder and its CMakeLists.txt file. Once the tarball OrientedCylinder.tar has been downloaded and extracted,

cd OrientedCylinder/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OrientedCylinder\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/ParametricKuenDemo/","title":"ParametricKuenDemo","text":"

vtk-examples/Cxx/GeometricObjects/ParametricKuenDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/ParametricKuenDemo/#description","title":"Description","text":"

The example shows interaction with the vtkParametricKuen vtkParametricFunctionSource. The Kuen Surface This surface of constant Gaussian curvature K = -1 was discovered early. It is very popular because of its beauty.

Here's the embedded video:

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/ParametricKuenDemo/#code","title":"Code","text":"

ParametricKuenDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricKuen.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n\n#include <array>\n\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackMinimumU : public vtkCommand\n{\npublic:\n  static SliderCallbackMinimumU* New()\n  {\n    return new SliderCallbackMinimumU;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    if (value > .9 * this->Kuen->GetMaximumU())\n    {\n      value = .99 * this->Kuen->GetMaximumU();\n      static_cast<vtkSliderRepresentation2D*>(sliderWidget->GetRepresentation())\n          ->SetValue(value);\n    }\n    this->Kuen->SetMinimumU(value);\n  }\n  SliderCallbackMinimumU() : Kuen(0)\n  {\n  }\n  vtkParametricKuen* Kuen;\n};\n\nclass SliderCallbackMaximumU : public vtkCommand\n{\npublic:\n  static SliderCallbackMaximumU* New()\n  {\n    return new SliderCallbackMaximumU;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    if (value < this->Kuen->GetMinimumU() + .01)\n    {\n      value = this->Kuen->GetMinimumU() + .01;\n      static_cast<vtkSliderRepresentation2D*>(sliderWidget->GetRepresentation())\n          ->SetValue(value);\n    }\n    this->Kuen->SetMaximumU(static_cast<vtkSliderRepresentation2D*>(\n                                sliderWidget->GetRepresentation())\n                                ->GetValue());\n  }\n  SliderCallbackMaximumU() : Kuen(0)\n  {\n  }\n  vtkParametricKuen* Kuen;\n};\n\nclass SliderCallbackMinimumV : public vtkCommand\n{\npublic:\n  static SliderCallbackMinimumV* New()\n  {\n    return new SliderCallbackMinimumV;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    if (value > .9 * this->Kuen->GetMaximumV())\n    {\n      value = .9 * this->Kuen->GetMaximumV();\n      static_cast<vtkSliderRepresentation2D*>(sliderWidget->GetRepresentation())\n          ->SetValue(value);\n    }\n    this->Kuen->SetMinimumV(value);\n  }\n  SliderCallbackMinimumV() : Kuen(0)\n  {\n  }\n  vtkParametricKuen* Kuen;\n};\n\nclass SliderCallbackMaximumV : public vtkCommand\n{\npublic:\n  static SliderCallbackMaximumV* New()\n  {\n    return new SliderCallbackMaximumV;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    if (value < this->Kuen->GetMinimumV() + .01)\n    {\n      value = this->Kuen->GetMinimumV() + .01;\n      static_cast<vtkSliderRepresentation2D*>(sliderWidget->GetRepresentation())\n          ->SetValue(value);\n    }\n    this->Kuen->SetMaximumV(static_cast<vtkSliderRepresentation2D*>(\n                                sliderWidget->GetRepresentation())\n                                ->GetValue());\n  }\n  SliderCallbackMaximumV() : Kuen(0)\n  {\n  }\n  vtkParametricKuen* Kuen;\n};\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkParametricKuen> surface;\n  vtkNew<vtkParametricFunctionSource> source;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a parametric function source, renderer, mapper, and actor\n  source->SetParametricFunction(surface);\n\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProperty);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ParametricKuenDemo\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(.008);\n  double sliderLength(.008);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMinimumU;\n\n  sliderRepMinimumU->SetMinimumValue(-4.5);\n  sliderRepMinimumU->SetMaximumValue(4.5);\n  sliderRepMinimumU->SetValue(-4.5);\n  sliderRepMinimumU->SetTitleText(\"U min\");\n\n  sliderRepMinimumU->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumU->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepMinimumU->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumU->GetPoint2Coordinate()->SetValue(.9, .1);\n\n  sliderRepMinimumU->SetTubeWidth(tubeWidth);\n  sliderRepMinimumU->SetSliderLength(sliderLength);\n  sliderRepMinimumU->SetTitleHeight(titleHeight);\n  sliderRepMinimumU->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetMinimumU;\n  sliderWidgetMinimumU->SetInteractor(interactor);\n  sliderWidgetMinimumU->SetRepresentation(sliderRepMinimumU);\n  sliderWidgetMinimumU->SetAnimationModeToAnimate();\n  sliderWidgetMinimumU->EnabledOn();\n\n  vtkNew<SliderCallbackMinimumU> callbackMinimumU;\n  callbackMinimumU->Kuen = surface;\n\n  sliderWidgetMinimumU->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackMinimumU);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMaximumU;\n\n  sliderRepMaximumU->SetMinimumValue(-4.5);\n  sliderRepMaximumU->SetMaximumValue(4.5);\n  sliderRepMaximumU->SetValue(4.5);\n  sliderRepMaximumU->SetTitleText(\"U max\");\n\n  sliderRepMaximumU->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMaximumU->GetPoint1Coordinate()->SetValue(.1, .9);\n  sliderRepMaximumU->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMaximumU->GetPoint2Coordinate()->SetValue(.9, .9);\n\n  sliderRepMaximumU->SetTubeWidth(tubeWidth);\n  sliderRepMaximumU->SetSliderLength(sliderLength);\n  sliderRepMaximumU->SetTitleHeight(titleHeight);\n  sliderRepMaximumU->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetMaximumU;\n  sliderWidgetMaximumU->SetInteractor(interactor);\n  sliderWidgetMaximumU->SetRepresentation(sliderRepMaximumU);\n  sliderWidgetMaximumU->SetAnimationModeToAnimate();\n  sliderWidgetMaximumU->EnabledOn();\n\n  vtkNew<SliderCallbackMaximumU> callbackMaximumU;\n  callbackMaximumU->Kuen = surface;\n\n  sliderWidgetMaximumU->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackMaximumU);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMinimumV;\n\n  sliderRepMinimumV->SetMinimumValue(0.05);\n  sliderRepMinimumV->SetMaximumValue(vtkMath::Pi());\n  sliderRepMinimumV->SetValue(0.0);\n  sliderRepMinimumV->SetTitleText(\"V min\");\n\n  sliderRepMinimumV->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepMinimumV->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint2Coordinate()->SetValue(.1, .9);\n\n  sliderRepMinimumV->SetTubeWidth(tubeWidth);\n  sliderRepMinimumV->SetSliderLength(sliderLength);\n  sliderRepMinimumV->SetTitleHeight(titleHeight);\n  sliderRepMinimumV->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetMinimumV;\n  sliderWidgetMinimumV->SetInteractor(interactor);\n  sliderWidgetMinimumV->SetRepresentation(sliderRepMinimumV);\n  sliderWidgetMinimumV->SetAnimationModeToAnimate();\n  sliderWidgetMinimumV->EnabledOn();\n\n  vtkNew<SliderCallbackMinimumV> callbackMinimumV;\n  callbackMinimumV->Kuen = surface;\n\n  sliderWidgetMinimumV->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackMinimumV);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMaximumV;\n\n  sliderRepMaximumV->SetMinimumValue(0.05);\n  sliderRepMaximumV->SetMaximumValue(vtkMath::Pi() - .05);\n  sliderRepMaximumV->SetValue(vtkMath::Pi());\n  sliderRepMaximumV->SetTitleText(\"V max\");\n\n  sliderRepMaximumV->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMaximumV->GetPoint1Coordinate()->SetValue(.9, .1);\n  sliderRepMaximumV->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMaximumV->GetPoint2Coordinate()->SetValue(.9, .9);\n  sliderRepMaximumV->SetTubeWidth(tubeWidth);\n  sliderRepMaximumV->SetSliderLength(sliderLength);\n  sliderRepMaximumV->SetTitleHeight(titleHeight);\n  sliderRepMaximumV->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetMaximumV;\n  sliderWidgetMaximumV->SetInteractor(interactor);\n  sliderWidgetMaximumV->SetRepresentation(sliderRepMaximumV);\n  sliderWidgetMaximumV->SetAnimationModeToAnimate();\n  sliderWidgetMaximumV->EnabledOn();\n\n  vtkNew<SliderCallbackMaximumV> callbackMaximumV;\n  callbackMaximumV->Kuen = surface;\n\n  sliderWidgetMaximumV->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackMaximumV);\n\n  surface->SetMinimumU(-4.5);\n  surface->SetMaximumU(4.5);\n  surface->SetMinimumV(0.05);\n  surface->SetMaximumV(vtkMath::Pi() - .05);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  interactor->Initialize();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/ParametricKuenDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParametricKuenDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParametricKuenDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParametricKuenDemo MACOSX_BUNDLE ParametricKuenDemo.cxx )\n  target_link_libraries(ParametricKuenDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParametricKuenDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/ParametricKuenDemo/#download-and-build-parametrickuendemo","title":"Download and Build ParametricKuenDemo","text":"

Click here to download ParametricKuenDemo and its CMakeLists.txt file. Once the tarball ParametricKuenDemo.tar has been downloaded and extracted,

cd ParametricKuenDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ParametricKuenDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/ParametricObjectsDemo/","title":"ParametricObjectsDemo","text":"

vtk-examples/Cxx/GeometricObjects/ParametricObjectsDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/ParametricObjectsDemo/#description","title":"Description","text":"

Demonstrates the Parametric classes added by Andrew Maclean and additional classes added by Tim Meehan. The parametric spline is also included.

Options are provided to:

  • Specify a single surface (-s SURFACE_NAME)
  • Color the back-face (-b)
  • Add normals (-n)
  • Display the geometric bounds of the object (-l)

You can save a screenshot by pressing \"k\".

With respect to your VTK build you may need to specify one or more of:

-DVTK_MODULE_ENABLE_VTK_cli11=WANT\n-DVTK_MODULE_ENABLE_VTK_fmt=WANT\n

If -DVTK_BUILD_TESTING=ON is specified when building VTK then VTK:cli11 and VTK::fmt will be automatically enabled.

Note

To really appreciate the complexity of some of these surfaces, select a single surface, and use the options -b -n. Also try specifying wireframe (toggle \"w\" on the keyboard) and zooming in and out.

Tip

If you color the back face, the three-dimensional orientable surfaces will only show backface coloring inside the surface e.g ConicSpiral or Torus. For three dimensional non-orientable surfaces; backface coloring is visible because of the twisting used to generate these surfaces e.g Boy or Figure8Klein.

Cite

See: Parametric Equations for Surfaces, for more information. This paper provides a description of fifteen surfaces, including their parametric equations and derivatives. Also provided is an example of how to create your own surface, namely the Figure-8 Torus.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/ParametricObjectsDemo/#code","title":"Code","text":"

ParametricObjectsDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtk_cli11.h>\n#include <vtk_fmt.h>\n// clang-format off\n#include VTK_FMT(fmt/format.h)\n// clang-format on\n\n#include <vtkParametricBoy.h>\n#include <vtkParametricConicSpiral.h>\n#include <vtkParametricCrossCap.h>\n#include <vtkParametricDini.h>\n#include <vtkParametricEllipsoid.h>\n#include <vtkParametricEnneper.h>\n#include <vtkParametricFigure8Klein.h>\n#include <vtkParametricKlein.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricRoman.h>\n#include <vtkParametricSpline.h>\n#include <vtkParametricSuperEllipsoid.h>\n#include <vtkParametricSuperToroid.h>\n#include <vtkParametricTorus.h>\n// Extra parametric surfaces.\n#include <vtkParametricBohemianDome.h>\n#include <vtkParametricBour.h>\n#include <vtkParametricCatalanMinimal.h>\n#include <vtkParametricHenneberg.h>\n#include <vtkParametricKuen.h>\n#include <vtkParametricPluckerConoid.h>\n#include <vtkParametricPseudosphere.h>\n\n// For glyphing\n#include <vtkArrowSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkMaskPoints.h>\n\n// For writing out the image.\n#include <vtkPNGWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <locale>\n#include <map>\n#include <set>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n\n/**\n * Create a map of the parametric functions and set some parameters.\n *\n * @return The map of functions.\n */\nstd::map<std::string, vtkSmartPointer<vtkParametricFunction>>\nGetParametricFunctions();\n\n/**\n * Get the centre of the object from the bounding box.\n */\nstd::vector<double> GetCentre(const std::vector<double>& bounds);\n\n/**\n * Calculate the maximum length of side of the bounding box.\n */\ndouble GetMaximumLength(const std::vector<double>& bounds);\n\n/**\n * Display the dimensions of the bounding box, maximum diagonal length\n *    and coordinates of the centre.\n *\n * @param name: The name of the object.\n * @param bounds: The bounding box of the object.\n *\n */\nvoid DisplayBoundingBoxAndCenter(std::string const& name,\n                                 std::vector<double> const& bounds);\n\nclass PrintCallback : public vtkCallbackCommand\n{\npublic:\n  PrintCallback() : fn_{\"\"}, imageQuality_(1), rgba_(true)\n  {\n  }\n\n  static PrintCallback* New()\n  {\n    return new PrintCallback;\n  }\n\n  /*\n   * Create a vtkCallbackCommand and reimplement it.\n   *\n   */\n  void Execute(vtkObject* caller, unsigned long /*evId*/, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto rwi = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n\n    // Get the keypress\n    std::string key = rwi->GetKeySym();\n    if (key == \"k\" && !fn_.empty())\n    {\n      auto w2If = vtkSmartPointer<vtkWindowToImageFilter>::New();\n      w2If->SetInput(rwi->GetRenderWindow());\n      w2If->SetScale(this->imageQuality_, this->imageQuality_);\n      if (rgba_)\n      {\n        w2If->SetInputBufferTypeToRGBA();\n      }\n      else\n      {\n        w2If->SetInputBufferTypeToRGB();\n      }\n      // Read from the front buffer.\n      w2If->ReadFrontBufferOn();\n      w2If->Update();\n      auto writer = vtkSmartPointer<vtkPNGWriter>::New();\n      writer->SetFileName(fn_.c_str());\n      writer->SetInputConnection(w2If->GetOutputPort());\n      writer->Write();\n      std::cout << \"Screenshot saved to: \" << writer->GetFileName()\n                << std::endl;\n    }\n  }\n\n  /**\n   * Set the parameters for writing the\n   * the render window view to an image file.\n   *\n   * @param fileName The png image file name.\n   * @param imageQuality The image quality.\n   * @param rgba The buffer type, (if true, there is no background in the\n   * screenshot).\n   *\n   */\n  void SetParameters(const std::string& fileName, int imageQuality = 1,\n                     bool rgba = true)\n  {\n    if (!fileName.empty())\n    {\n      this->fn_ = fileName;\n      std::string ext{\".png\"};\n      auto found = this->fn_.find_last_of(\".\");\n      if (found == std::string::npos)\n      {\n        this->fn_ += ext;\n      }\n      else\n      {\n        this->fn_ = fileName.substr(0, fileName.find_last_of(\".\")) += ext;\n      }\n    }\n    this->imageQuality_ = imageQuality;\n    this->rgba_ = rgba;\n  }\n\nprivate:\n  PrintCallback(const PrintCallback&) = delete;\n  void operator=(const PrintCallback&) = delete;\n\n  std::string fn_;\n  int imageQuality_;\n  bool rgba_;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Display the parametric surfaces.\"};\n\n  // Define options\n  std::string surfaceName;\n  app.add_option(\"-s, --surface_name\", surfaceName, \"The name of the surface.\");\n  auto backFace{false};\n  app.add_flag(\"-b, --back_face\", backFace, \"Color the back face.\");\n  auto normals{false};\n  app.add_flag(\"-n, --normals\", normals, \"Display normals.\");\n  auto limits{false};\n  app.add_flag(\"-l, --limits\", limits,\n               \"Display the geometric bounds of the object.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  // Get the parametric functions.\n  auto pfn = GetParametricFunctions();\n\n  // Check for a single surface.\n  std::pair<std::string, bool> singleSurface{\"\", false};\n  if (!surfaceName.empty())\n  {\n    std::string sn = surfaceName;\n    std::transform(sn.begin(), sn.end(), sn.begin(),\n                   [](unsigned char c) { return std::tolower(c); });\n    // Is the surface name in the map?\n    for (auto const& t : pfn)\n    {\n      std::string k = t.first;\n      std::transform(k.begin(), k.end(), k.begin(),\n                     [](unsigned char c) { return std::tolower(c); });\n      if (sn == k)\n      {\n        singleSurface.first = t.first;\n        singleSurface.second = true;\n      }\n    }\n  }\n  if (!surfaceName.empty() && !singleSurface.second)\n  {\n    std::cout << \"Nonexistent surface: \" << surfaceName << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto rendererSize = 200;\n  auto gridColumnDimensions = 5;\n  auto gridRowDimensions = 5;\n\n  if (singleSurface.second)\n  {\n    rendererSize = 1000;\n    gridColumnDimensions = 1;\n    gridRowDimensions = 1;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create one text property for all.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetJustificationToCentered();\n  textProperty->SetFontSize(rendererSize / 12);\n  textProperty->SetColor(colors->GetColor3d(\"LavenderBlush\").GetData());\n\n  // Create a parametric function source, renderer, mapper, and actor\n  // for each object.\n  std::vector<vtkSmartPointer<vtkParametricFunctionSource>> pfnSrcs;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textmappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textactors;\n\n  // Glyph the normals.\n  std::vector<vtkSmartPointer<vtkMaskPoints>> maskPts;\n  std::vector<vtkSmartPointer<vtkArrowSource>> arrow;\n  std::vector<vtkSmartPointer<vtkGlyph3D>> glyph;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> glyphMapper;\n  std::vector<vtkSmartPointer<vtkActor>> glyphActor;\n\n  auto backProperty = vtkSmartPointer<vtkProperty>::New();\n  if (backFace)\n  {\n    backProperty->SetColor(colors->GetColor3d(\"Peru\").GetData());\n  }\n\n  // Now decide on the surfaces to build.\n  std::map<std::string, vtkSmartPointer<vtkParametricFunction>> surfaces;\n  if (singleSurface.second)\n  {\n    surfaces[singleSurface.first] = pfn[singleSurface.first];\n  }\n  else\n  {\n    surfaces = pfn;\n  }\n\n  // The bounding boxes for each object.\n  std::map<std::string, std::vector<double>> boundingBoxes;\n  std::map<int, std::string> indexedNames;\n  //  The index of each parametric object.\n  auto objIdx = -1;\n  for (auto const& obj : surfaces)\n  {\n    objIdx++;\n    indexedNames[objIdx] = obj.first;\n    pfnSrcs.push_back(vtkSmartPointer<vtkParametricFunctionSource>::New());\n    pfnSrcs[objIdx]->SetParametricFunction(obj.second);\n    pfnSrcs[objIdx]->SetUResolution(51);\n    pfnSrcs[objIdx]->SetVResolution(51);\n    pfnSrcs[objIdx]->SetWResolution(51);\n    pfnSrcs[objIdx]->Update();\n\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[objIdx]->SetInputConnection(pfnSrcs[objIdx]->GetOutputPort());\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[objIdx]->SetMapper(mappers[objIdx]);\n    actors[objIdx]->GetProperty()->SetColor(\n        colors->GetColor3d(\"NavajoWhite\").GetData());\n    if (backFace)\n    {\n      actors[objIdx]->SetBackfaceProperty(backProperty);\n    }\n\n    textmappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textmappers[objIdx]->SetInput(obj.first.c_str());\n    textmappers[objIdx]->SetTextProperty(textProperty);\n\n    textactors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    textactors[objIdx]->SetMapper(textmappers[objIdx]);\n    textactors[objIdx]->SetPosition(rendererSize / 2.0, 8);\n\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    renderers[objIdx]->SetBackground(\n        colors->GetColor3d(\"MidnightBlue\").GetData());\n\n    double bounds[6];\n    pfnSrcs[objIdx]->GetOutput()->GetBounds(bounds);\n    std::vector<double> v(std::begin(bounds), std::end(bounds));\n    boundingBoxes[obj.first] = v;\n\n    if (normals)\n    {\n      // Glyphing\n      maskPts.push_back(vtkSmartPointer<vtkMaskPoints>::New());\n      maskPts[objIdx]->RandomModeOn();\n      maskPts[objIdx]->SetMaximumNumberOfPoints(150);\n      maskPts[objIdx]->SetInputConnection(pfnSrcs[objIdx]->GetOutputPort());\n\n      arrow.push_back(vtkSmartPointer<vtkArrowSource>::New());\n      arrow[objIdx]->SetTipResolution(16);\n      arrow[objIdx]->SetTipLength(0.3);\n      arrow[objIdx]->SetTipRadius(0.1);\n\n      auto glyphScale = GetMaximumLength(boundingBoxes[obj.first]);\n\n      glyph.push_back(vtkSmartPointer<vtkGlyph3D>::New());\n      glyph[objIdx]->SetSourceConnection(arrow[objIdx]->GetOutputPort());\n      glyph[objIdx]->SetInputConnection(maskPts[objIdx]->GetOutputPort());\n      glyph[objIdx]->SetVectorModeToUseNormal();\n      glyph[objIdx]->SetScaleFactor(glyphScale / 10.0);\n      glyph[objIdx]->OrientOn();\n      glyph[objIdx]->Update();\n\n      glyphMapper.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n      glyphMapper[objIdx]->SetInputConnection(glyph[objIdx]->GetOutputPort());\n\n      glyphActor.push_back(vtkSmartPointer<vtkActor>::New());\n      glyphActor[objIdx]->SetMapper(glyphMapper[objIdx]);\n      glyphActor[objIdx]->GetProperty()->SetColor(\n          colors->GetColor3d(\"GreenYellow\").GetData());\n    }\n  }\n\n  // Need a renderer even if there is no actor.\n  for (auto i = objIdx; i < gridColumnDimensions * gridRowDimensions; i++)\n  {\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    static_cast<vtkRenderer*>(renderers.back().GetPointer())\n        ->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n    indexedNames[i] = \"\";\n  }\n\n  auto renWin = vtkSmartPointer<vtkRenderWindow>::New();\n  renWin->SetSize(rendererSize * gridColumnDimensions,\n                  rendererSize * gridRowDimensions);\n\n  for (auto row = 0; row < gridRowDimensions; row++)\n  {\n    for (auto col = 0; col < gridColumnDimensions; col++)\n    {\n      auto index = row * gridColumnDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) * rendererSize /\n              (gridColumnDimensions * rendererSize),\n          static_cast<double>(gridRowDimensions - (row + 1)) * rendererSize /\n              (gridRowDimensions * rendererSize),\n          static_cast<double>(col + 1) * rendererSize /\n              (gridColumnDimensions * rendererSize),\n          static_cast<double>(gridRowDimensions - row) * rendererSize /\n              (gridRowDimensions * rendererSize)};\n      renWin->AddRenderer(renderers[index]);\n      renderers[index]->SetViewport(viewport);\n      if (index > objIdx)\n      {\n        continue;\n      }\n      renderers[index]->AddActor(actors[index]);\n      // Normals can only be computed for polygons and triangle strips.\n      // The Spline is a line.\n      if (normals && indexedNames[index] != \"Spline\")\n      {\n        renderers[index]->AddActor(glyphActor[index]);\n      }\n      renderers[index]->AddActor(textactors[index]);\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(-30);\n      renderers[index]->GetActiveCamera()->Zoom(0.9);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  if (limits)\n  {\n    for (auto const& obj : boundingBoxes)\n    {\n      DisplayBoundingBoxAndCenter(obj.first, obj.second);\n    }\n  }\n\n  std::string fn = \"ParametricObjectsDemo\";\n  if (!surfaceName.empty())\n  {\n    fn = singleSurface.first;\n  }\n  renWin->SetWindowName(fn.c_str());\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<PrintCallback> printCallback;\n  printCallback->SetParameters(fn, 1, false);\n\n  iRen->SetRenderWindow(renWin);\n  iRen->AddObserver(vtkCommand::KeyPressEvent, printCallback);\n\n  iRen->Initialize();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::map<std::string, vtkSmartPointer<vtkParametricFunction>>\nGetParametricFunctions()\n{\n  std::map<std::string, vtkSmartPointer<vtkParametricFunction>> pfn;\n  pfn[\"Boy\"] = vtkSmartPointer<vtkParametricBoy>::New();\n  pfn[\"ConicSpiral\"] = vtkSmartPointer<vtkParametricConicSpiral>::New();\n  pfn[\"CrossCap\"] = vtkSmartPointer<vtkParametricCrossCap>::New();\n  pfn[\"Dini\"] = vtkSmartPointer<vtkParametricDini>::New();\n  pfn[\"Ellipsoid\"] = vtkSmartPointer<vtkParametricEllipsoid>::New();\n  pfn[\"Enneper\"] = vtkSmartPointer<vtkParametricEnneper>::New();\n  pfn[\"Figure8Klein\"] = vtkSmartPointer<vtkParametricFigure8Klein>::New();\n  pfn[\"Klein\"] = vtkSmartPointer<vtkParametricKlein>::New();\n  pfn[\"Mobius\"] = vtkSmartPointer<vtkParametricMobius>::New();\n  pfn[\"RandomHills\"] = vtkSmartPointer<vtkParametricRandomHills>::New();\n  pfn[\"Roman\"] = vtkSmartPointer<vtkParametricRoman>::New();\n  pfn[\"SuperEllipsoid\"] = vtkSmartPointer<vtkParametricSuperEllipsoid>::New();\n  pfn[\"SuperToroid\"] = vtkSmartPointer<vtkParametricSuperToroid>::New();\n  pfn[\"Torus\"] = vtkSmartPointer<vtkParametricTorus>::New();\n  pfn[\"Spline\"] = vtkSmartPointer<vtkParametricSpline>::New();\n  // Extra parametric surfaces.\n  pfn[\"BohemianDome\"] = vtkSmartPointer<vtkParametricBohemianDome>::New();\n  pfn[\"Bour\"] = vtkSmartPointer<vtkParametricBour>::New();\n  pfn[\"CatalanMinimal\"] = vtkSmartPointer<vtkParametricCatalanMinimal>::New();\n  pfn[\"Henneberg\"] = vtkSmartPointer<vtkParametricHenneberg>::New();\n  pfn[\"Kuen\"] = vtkSmartPointer<vtkParametricKuen>::New();\n  pfn[\"PluckerConoid\"] = vtkSmartPointer<vtkParametricPluckerConoid>::New();\n  pfn[\"Pseudosphere\"] = vtkSmartPointer<vtkParametricPseudosphere>::New();\n\n  // Now set some parameters.\n  static_cast<vtkParametricEllipsoid*>(pfn[\"Ellipsoid\"].GetPointer())\n      ->SetXRadius(0.5);\n  static_cast<vtkParametricEllipsoid*>(pfn[\"Ellipsoid\"].GetPointer())\n      ->SetYRadius(2.0);\n  static_cast<vtkParametricMobius*>(pfn[\"Mobius\"].GetPointer())->SetRadius(2.0);\n  static_cast<vtkParametricMobius*>(pfn[\"Mobius\"].GetPointer())\n      ->SetMinimumV(-0.5);\n  static_cast<vtkParametricMobius*>(pfn[\"Mobius\"].GetPointer())\n      ->SetMaximumV(0.5);\n  static_cast<vtkParametricRandomHills*>(pfn[\"RandomHills\"].GetPointer())\n      ->AllowRandomGenerationOn();\n  static_cast<vtkParametricRandomHills*>(pfn[\"RandomHills\"].GetPointer())\n      ->SetRandomSeed(1);\n  static_cast<vtkParametricRandomHills*>(pfn[\"RandomHills\"].GetPointer())\n      ->SetNumberOfHills(30);\n  static_cast<vtkParametricSuperEllipsoid*>(pfn[\"SuperEllipsoid\"].GetPointer())\n      ->SetN1(0.5);\n  static_cast<vtkParametricSuperEllipsoid*>(pfn[\"SuperEllipsoid\"].GetPointer())\n      ->SetN2(0.4);\n  static_cast<vtkParametricSuperToroid*>(pfn[\"SuperToroid\"].GetPointer())\n      ->SetN1(0.5);\n  static_cast<vtkParametricSuperToroid*>(pfn[\"SuperToroid\"].GetPointer())\n      ->SetN2(3.0);\n  // The spline needs points\n  vtkNew<vtkPoints> inputPoints;\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  for (auto p = 0; p < 10; p++)\n  {\n    std::array<double, 3> xyz{0, 0, 0};\n    for (auto& idx : xyz)\n    {\n      idx = rng->GetRangeValue(-1.0, 1.0);\n      rng->Next();\n    }\n    inputPoints->InsertNextPoint(xyz.data());\n  }\n  static_cast<vtkParametricSpline*>(pfn[\"Spline\"].GetPointer())\n      ->SetPoints(inputPoints);\n  // Extra parametric surfaces.\n  static_cast<vtkParametricBohemianDome*>(pfn[\"BohemianDome\"].GetPointer())\n      ->SetA(5.0);\n  static_cast<vtkParametricBohemianDome*>(pfn[\"BohemianDome\"].GetPointer())\n      ->SetB(1.0);\n  static_cast<vtkParametricBohemianDome*>(pfn[\"BohemianDome\"].GetPointer())\n      ->SetC(2.0);\n  static_cast<vtkParametricKuen*>(pfn[\"Kuen\"].GetPointer())->SetDeltaV0(0.001);\n  return pfn;\n}\n\nstd::vector<double> GetCentre(const std::vector<double>& bounds)\n{\n  std::vector<double> centre;\n  if (bounds.size() != 6)\n  {\n    return centre;\n  }\n  for (size_t i = 1; i < bounds.size(); i += 2)\n  {\n    centre.push_back(bounds[i] - (bounds[i] - bounds[i - 1]) / 2.0);\n  }\n  return centre;\n}\n\ndouble GetMaximumLength(const std::vector<double>& bounds)\n{\n  auto maxLen = -1.0;\n  if (bounds.size() != 6)\n  {\n    return maxLen;\n  }\n  for (size_t i = 0; i < bounds.size(); i += 2)\n  {\n    maxLen = std::max(maxLen, std::abs(bounds[i + 1] - bounds[i]));\n  }\n  return maxLen;\n}\n\nvoid DisplayBoundingBoxAndCenter(std::string const& name,\n                                 std::vector<double> const& bounds)\n{\n  if (bounds.size() != 6)\n  {\n    return;\n  }\n  auto maxLength = GetMaximumLength(bounds);\n  auto centre = GetCentre(bounds);\n\n  auto s = fmt::format(\"{:<21s}\\n\", name);\n  s += fmt::format(\"{:21s}: \", \"  Bounds (min, max)\");\n  s += fmt::format(\"{:s}:({:6.2f}, {:6.2f}) \", \"x\", bounds[0], bounds[1]);\n  s += fmt::format(\"{:s}:({:6.2f}, {:6.2f}) \", \"y\", bounds[2], bounds[3]);\n  s += fmt::format(\"{:s}:({:6.2f}, {:6.2f})\\n\", \"z\", bounds[4], bounds[5]);\n  s += fmt::format(\"{:21s}: {:6.2f}\\n\", \"  Maximum side length\", maxLength);\n  s += fmt::format(\"{:21s}: ({:6.2f}, {:6.2f}, {:6.2f})\\n\",\n                   \"  Centre (x, y, z)\", centre[0], centre[1], centre[2]);\n  std::cout << s << std::endl;\n}\n\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/ParametricObjectsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParametricObjectsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  fmt\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParametricObjectsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParametricObjectsDemo MACOSX_BUNDLE ParametricObjectsDemo.cxx )\n  target_link_libraries(ParametricObjectsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParametricObjectsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/ParametricObjectsDemo/#download-and-build-parametricobjectsdemo","title":"Download and Build ParametricObjectsDemo","text":"

Click here to download ParametricObjectsDemo and its CMakeLists.txt file. Once the tarball ParametricObjectsDemo.tar has been downloaded and extracted,

cd ParametricObjectsDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ParametricObjectsDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/ParametricSuperEllipsoidDemo/","title":"ParametricSuperEllipsoidDemo","text":"

vtk-examples/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/ParametricSuperEllipsoidDemo/#code","title":"Code","text":"

ParametricSuperEllipsoidDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSuperEllipsoid.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n\n#include <array>\n\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackN1 : public vtkCommand\n{\npublic:\n  static SliderCallbackN1* New()\n  {\n    return new SliderCallbackN1;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->SuperEllipsoid->SetN1(value);\n  }\n  SliderCallbackN1() : SuperEllipsoid(0)\n  {\n  }\n  vtkParametricSuperEllipsoid* SuperEllipsoid;\n};\n\nclass SliderCallbackN2 : public vtkCommand\n{\npublic:\n  static SliderCallbackN2* New()\n  {\n    return new SliderCallbackN2;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->SuperEllipsoid->SetN2(value);\n  }\n  SliderCallbackN2() : SuperEllipsoid(0)\n  {\n  }\n  vtkParametricSuperEllipsoid* SuperEllipsoid;\n};\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkParametricSuperEllipsoid> surface;\n  vtkNew<vtkParametricFunctionSource> source;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a parametric function source, renderer, mapper, and actor\n  source->SetParametricFunction(surface);\n\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProperty);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ParametricSuperEllipsoidDemo\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(.008);\n  double sliderLength(.008);\n  double titleHeight(.04);\n  double labelHeight(.04);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepN1;\n\n  sliderRepN1->SetMinimumValue(0.0);\n  sliderRepN1->SetMaximumValue(4.0);\n  sliderRepN1->SetValue(1.0);\n  sliderRepN1->SetTitleText(\"Z squareness\");\n\n  sliderRepN1->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN1->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepN1->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN1->GetPoint2Coordinate()->SetValue(.9, .1);\n\n  sliderRepN1->SetTubeWidth(tubeWidth);\n  sliderRepN1->SetSliderLength(sliderLength);\n  sliderRepN1->SetTitleHeight(titleHeight);\n  sliderRepN1->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetN1;\n  sliderWidgetN1->SetInteractor(interactor);\n  sliderWidgetN1->SetRepresentation(sliderRepN1);\n  sliderWidgetN1->SetAnimationModeToAnimate();\n  sliderWidgetN1->EnabledOn();\n\n  vtkNew<SliderCallbackN1> callbackN1;\n  callbackN1->SuperEllipsoid = surface;\n\n  sliderWidgetN1->AddObserver(vtkCommand::InteractionEvent, callbackN1);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepN2;\n\n  sliderRepN2->SetMinimumValue(0.0001);\n  sliderRepN2->SetMaximumValue(4.0);\n  sliderRepN2->SetValue(1.0);\n  sliderRepN2->SetTitleText(\"XY squareness\");\n\n  sliderRepN2->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN2->GetPoint1Coordinate()->SetValue(.1, .9);\n  sliderRepN2->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN2->GetPoint2Coordinate()->SetValue(.9, .9);\n\n  sliderRepN2->SetTubeWidth(tubeWidth);\n  sliderRepN2->SetSliderLength(sliderLength);\n  sliderRepN2->SetTitleHeight(titleHeight);\n  sliderRepN2->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetN2;\n  sliderWidgetN2->SetInteractor(interactor);\n  sliderWidgetN2->SetRepresentation(sliderRepN2);\n  sliderWidgetN2->SetAnimationModeToAnimate();\n  sliderWidgetN2->EnabledOn();\n\n  vtkNew<SliderCallbackN2> callbackN2;\n  callbackN2->SuperEllipsoid = surface;\n\n  sliderWidgetN2->AddObserver(vtkCommand::InteractionEvent, callbackN2);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMinimumV;\n\n  sliderRepN1->SetMinimumValue(.0001);\n  sliderRepMinimumV->SetMaximumValue(.9999 * vtkMath::Pi());\n  sliderRepMinimumV->SetValue(.0001);\n  sliderRepMinimumV->SetTitleText(\"V min\");\n\n  sliderRepMinimumV->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepMinimumV->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint2Coordinate()->SetValue(.1, .9);\n\n  sliderRepMinimumV->SetTubeWidth(tubeWidth);\n  sliderRepMinimumV->SetSliderLength(sliderLength);\n  sliderRepMinimumV->SetTitleHeight(titleHeight);\n  sliderRepMinimumV->SetLabelHeight(labelHeight);\n\n  surface->SetN1(1.0);\n  surface->SetN2(1.0);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  interactor->Initialize();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/ParametricSuperEllipsoidDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParametricSuperEllipsoidDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParametricSuperEllipsoidDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParametricSuperEllipsoidDemo MACOSX_BUNDLE ParametricSuperEllipsoidDemo.cxx )\n  target_link_libraries(ParametricSuperEllipsoidDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParametricSuperEllipsoidDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/ParametricSuperEllipsoidDemo/#download-and-build-parametricsuperellipsoiddemo","title":"Download and Build ParametricSuperEllipsoidDemo","text":"

Click here to download ParametricSuperEllipsoidDemo and its CMakeLists.txt file. Once the tarball ParametricSuperEllipsoidDemo.tar has been downloaded and extracted,

cd ParametricSuperEllipsoidDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ParametricSuperEllipsoidDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/ParametricSuperToroidDemo/","title":"ParametricSuperToroidDemo","text":"

vtk-examples/Cxx/GeometricObjects/ParametricSuperToroidDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/ParametricSuperToroidDemo/#code","title":"Code","text":"

ParametricSuperToroidDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSuperToroid.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n\n#include <array>\n\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackN1 : public vtkCommand\n{\npublic:\n  static SliderCallbackN1* New()\n  {\n    return new SliderCallbackN1;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->SuperToroid->SetN1(value);\n  }\n  SliderCallbackN1() : SuperToroid(0)\n  {\n  }\n  vtkParametricSuperToroid* SuperToroid;\n};\n\nclass SliderCallbackN2 : public vtkCommand\n{\npublic:\n  static SliderCallbackN2* New()\n  {\n    return new SliderCallbackN2;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->SuperToroid->SetN2(value);\n  }\n  SliderCallbackN2() : SuperToroid(0)\n  {\n  }\n  vtkParametricSuperToroid* SuperToroid;\n};\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkParametricSuperToroid> surface;\n  vtkNew<vtkParametricFunctionSource> source;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a parametric function source, renderer, mapper, and actor\n  source->SetParametricFunction(surface);\n\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProperty);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ParametricSuperToroidDemo\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(.008);\n  double sliderLength(.008);\n  double titleHeight(.04);\n  double labelHeight(.04);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepN1;\n\n  sliderRepN1->SetMinimumValue(0.0);\n  sliderRepN1->SetMaximumValue(4.0);\n  sliderRepN1->SetValue(1.0);\n  sliderRepN1->SetTitleText(\"Z squareness\");\n\n  sliderRepN1->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN1->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepN1->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN1->GetPoint2Coordinate()->SetValue(.9, .1);\n\n  sliderRepN1->SetTubeWidth(tubeWidth);\n  sliderRepN1->SetSliderLength(sliderLength);\n  sliderRepN1->SetTitleHeight(titleHeight);\n  sliderRepN1->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetN1;\n  sliderWidgetN1->SetInteractor(interactor);\n  sliderWidgetN1->SetRepresentation(sliderRepN1);\n  sliderWidgetN1->SetAnimationModeToAnimate();\n  sliderWidgetN1->EnabledOn();\n\n  vtkNew<SliderCallbackN1> callbackN1;\n  callbackN1->SuperToroid = surface;\n\n  sliderWidgetN1->AddObserver(vtkCommand::InteractionEvent, callbackN1);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepN2;\n\n  sliderRepN2->SetMinimumValue(0.0001);\n  sliderRepN2->SetMaximumValue(4.0);\n  sliderRepN2->SetValue(1.0);\n  sliderRepN2->SetTitleText(\"XY squareness\");\n\n  sliderRepN2->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN2->GetPoint1Coordinate()->SetValue(.1, .9);\n  sliderRepN2->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN2->GetPoint2Coordinate()->SetValue(.9, .9);\n\n  sliderRepN2->SetTubeWidth(tubeWidth);\n  sliderRepN2->SetSliderLength(sliderLength);\n  sliderRepN2->SetTitleHeight(titleHeight);\n  sliderRepN2->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetN2;\n  sliderWidgetN2->SetInteractor(interactor);\n  sliderWidgetN2->SetRepresentation(sliderRepN2);\n  sliderWidgetN2->SetAnimationModeToAnimate();\n  sliderWidgetN2->EnabledOn();\n\n  vtkNew<SliderCallbackN2> callbackN2;\n  callbackN2->SuperToroid = surface;\n\n  sliderWidgetN2->AddObserver(vtkCommand::InteractionEvent, callbackN2);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMinimumV;\n\n  sliderRepN1->SetMinimumValue(.0001);\n  sliderRepMinimumV->SetMaximumValue(.9999 * vtkMath::Pi());\n  sliderRepMinimumV->SetValue(.0001);\n  sliderRepMinimumV->SetTitleText(\"V min\");\n\n  sliderRepMinimumV->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepMinimumV->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint2Coordinate()->SetValue(.1, .9);\n\n  sliderRepMinimumV->SetTubeWidth(tubeWidth);\n  sliderRepMinimumV->SetSliderLength(sliderLength);\n  sliderRepMinimumV->SetTitleHeight(titleHeight);\n  sliderRepMinimumV->SetLabelHeight(labelHeight);\n\n  surface->SetN1(1.0);\n  surface->SetN2(1.0);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  interactor->Initialize();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/ParametricSuperToroidDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParametricSuperToroidDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParametricSuperToroidDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParametricSuperToroidDemo MACOSX_BUNDLE ParametricSuperToroidDemo.cxx )\n  target_link_libraries(ParametricSuperToroidDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParametricSuperToroidDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/ParametricSuperToroidDemo/#download-and-build-parametricsupertoroiddemo","title":"Download and Build ParametricSuperToroidDemo","text":"

Click here to download ParametricSuperToroidDemo and its CMakeLists.txt file. Once the tarball ParametricSuperToroidDemo.tar has been downloaded and extracted,

cd ParametricSuperToroidDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ParametricSuperToroidDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Plane/","title":"Plane","text":"

vtk-examples/Cxx/GeometricObjects/Plane

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Plane/#description","title":"Description","text":"

vtkPlaneSource object creates an m x n array of quadrilaterals arranged as a regular tiling in a plane.

The plane is defined by specifying an origin point, and then two other points that, together with the origin, define two axes for the plane. These axes do not have to be orthogonal - so you can create a parallelogram. (The axes must not be parallel.) The resolution of the plane (i.e., number of subdivisions) is controlled by the ivars XResolution and YResolution.

By default, the plane is centered at the origin and perpendicular to the z-axis, with width and height of length 1 and resolutions set to 1.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Plane/#code","title":"Code","text":"

Plane.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 77, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create a plane\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->SetCenter(1.0, 0.0, 0.0);\n  planeSource->SetNormal(1.0, 0.0, 1.0);\n  planeSource->Update();\n\n  vtkPolyData* plane = planeSource->GetOutput();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(plane);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // Create a renderer, render window and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Plane\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Plane/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Plane)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Plane: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Plane MACOSX_BUNDLE Plane.cxx )\n  target_link_libraries(Plane PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Plane\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Plane/#download-and-build-plane","title":"Download and Build Plane","text":"

Click here to download Plane and its CMakeLists.txt file. Once the tarball Plane.tar has been downloaded and extracted,

cd Plane/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Plane\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/PlaneSourceDemo/","title":"PlaneSourceDemo","text":"

vtk-examples/Cxx/GeometricObjects/PlaneSourceDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/PlaneSourceDemo/#description","title":"Description","text":"

The example displays the various instance variables that define a vtkPlaneSource.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/PlaneSourceDemo/#code","title":"Code","text":"

PlaneSourceDemo.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> CreateArrow(double& length,\n                                         std::array<double, 3>& startPoint,\n                                         std::array<double, 3>& endPoint);\n}\n\nint main(int, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"DarkSlateGray\");\n  vtkColor3d legendBackgroundColor = colors->GetColor3d(\"SlateGray\");\n  vtkColor3d originColor = colors->GetColor3d(\"OrangeRed\");\n  vtkColor3d centerColor = colors->GetColor3d(\"Gold\");\n  vtkColor3d point1Color = colors->GetColor3d(\"MediumSpringGreen\");\n  vtkColor3d point2Color = colors->GetColor3d(\"Brown\");\n  vtkColor3d xAxisColor = colors->GetColor3d(\"lime\");\n  vtkColor3d yAxisColor = colors->GetColor3d(\"orange\");\n  vtkColor3d normalColor = colors->GetColor3d(\"Raspberry\");\n\n  // Create actors\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->SetOrigin(0.0, 0.0, 0.0);\n  planeSource->SetPoint1(1, 0, 0);\n  planeSource->SetPoint2(0, 1.0, 0);\n  planeSource->Update();\n\n  std::array<double, 6> bounds;\n  planeSource->GetOutput()->GetBounds(bounds.data());\n  double length = std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]);\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(planeSource->GetOutputPort());\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(length * .04);\n  vtkNew<vtkPolyDataMapper> originMapper;\n  originMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> originActor;\n  originActor->SetPosition(planeSource->GetOrigin());\n  originActor->SetMapper(originMapper);\n  originActor->GetProperty()->SetDiffuseColor(originColor.GetData());\n\n  vtkNew<vtkPolyDataMapper> centerMapper;\n  centerMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> centerActor;\n  centerActor->SetPosition(planeSource->GetCenter());\n  centerActor->SetMapper(centerMapper);\n  centerActor->GetProperty()->SetDiffuseColor(centerColor.GetData());\n\n  vtkNew<vtkPolyDataMapper> point1Mapper;\n  point1Mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> point1Actor;\n  point1Actor->SetPosition(planeSource->GetPoint1());\n  point1Actor->SetMapper(point1Mapper);\n  point1Actor->GetProperty()->SetDiffuseColor(point1Color.GetData());\n\n  vtkNew<vtkPolyDataMapper> point2Mapper;\n  point2Mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> point2Actor;\n  point2Actor->SetPosition(planeSource->GetPoint2());\n  point2Actor->SetMapper(point2Mapper);\n  point2Actor->GetProperty()->SetDiffuseColor(point2Color.GetData());\n\n  std::array<double, 3> center;\n  std::array<double, 3> origin;\n  std::array<double, 3> normal;\n  std::array<double, 3> point1;\n  std::array<double, 3> point2;\n  for (auto i = 0; i < 3; ++i)\n  {\n    point1[i] = planeSource->GetPoint1()[i];\n    point2[i] = planeSource->GetPoint2()[i];\n    origin[i] = planeSource->GetOrigin()[i];\n    center[i] = planeSource->GetCenter()[i];\n    normal[i] = planeSource->GetNormal()[i] * length;\n  }\n  auto xAxisPolyData = CreateArrow(length, origin, point1);\n  vtkNew<vtkPolyDataMapper> xAxisMapper;\n  xAxisMapper->SetInputData(xAxisPolyData);\n  vtkNew<vtkActor> xAxisActor;\n  xAxisActor->SetMapper(xAxisMapper);\n  xAxisActor->GetProperty()->SetDiffuseColor(xAxisColor.GetData());\n\n  auto yAxisPolyData = CreateArrow(length, origin, point2);\n  vtkNew<vtkPolyDataMapper> yAxisMapper;\n  yAxisMapper->SetInputData(yAxisPolyData);\n  vtkNew<vtkActor> yAxisActor;\n  yAxisActor->SetMapper(yAxisMapper);\n  yAxisActor->GetProperty()->SetDiffuseColor(yAxisColor.GetData());\n\n  auto normalPolyData = CreateArrow(length, origin, normal);\n  vtkNew<vtkPolyDataMapper> normalMapper;\n  normalMapper->SetInputData(normalPolyData);\n  vtkNew<vtkActor> normalActor;\n  normalActor->SetMapper(normalMapper);\n  normalActor->GetProperty()->SetDiffuseColor(normalColor.GetData());\n\n  // Create the RenderWindow, Renderer\n  //\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkLegendBoxActor> legend;\n  legend->SetNumberOfEntries(7);\n  legend->UseBackgroundOn();\n  legend->SetBackgroundColor(legendBackgroundColor.GetData());\n  legend->GetPositionCoordinate()->SetValue(.7, .7);\n  legend->GetPosition2Coordinate()->SetValue(.3, .3);\n  int entry = 0;\n  legend->SetEntry(entry++, sphereSource->GetOutput(), \"center\",\n                   centerColor.GetData());\n  legend->SetEntry(entry++, sphereSource->GetOutput(), \"origin\",\n                   originColor.GetData());\n  legend->SetEntry(entry++, sphereSource->GetOutput(), \"point1\",\n                   point1Color.GetData());\n  legend->SetEntry(entry++, sphereSource->GetOutput(), \"point2\",\n                   point2Color.GetData());\n  legend->SetEntry(entry++, xAxisPolyData, \"xAxis\", xAxisColor.GetData());\n  legend->SetEntry(entry++, xAxisPolyData, \"yAxis\", yAxisColor.GetData());\n  legend->SetEntry(entry++, xAxisPolyData, \"normal\", normalColor.GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PlaneSourceDemo\");\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->AddActor(planeActor);\n  renderer->AddActor(originActor);\n  renderer->AddActor(centerActor);\n  renderer->AddActor(point1Actor);\n  renderer->AddActor(point2Actor);\n  renderer->AddActor(xAxisActor);\n  renderer->AddActor(yAxisActor);\n  renderer->AddActor(normalActor);\n  renderer->AddActor(legend);\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> CreateArrow(double& pdLength,\n                                         std::array<double, 3>& startPoint,\n                                         std::array<double, 3>& endPoint)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n  arrowSource->SetShaftRadius(pdLength * .01);\n  arrowSource->SetShaftResolution(20);\n  arrowSource->SetTipLength(pdLength * .1);\n  arrowSource->SetTipRadius(pdLength * .05);\n  arrowSource->SetTipResolution(20);\n\n  // Compute a basis\n  std::array<double, 3> normalizedX;\n  std::array<double, 3> normalizedY;\n  std::array<double, 3> normalizedZ;\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint.data(), startPoint.data(), normalizedX.data());\n  double length = vtkMath::Norm(normalizedX.data());\n  vtkMath::Normalize(normalizedX.data());\n\n  // The Z axis is an arbitrary vector cross X\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n\n  std::array<double, 3> arbitrary;\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX.data(), arbitrary.data(), normalizedZ.data());\n  vtkMath::Normalize(normalizedZ.data());\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ.data(), normalizedX.data(), normalizedY.data());\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (auto i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint.data());\n  transform->Concatenate(matrix);\n  transform->Scale(length, length, length);\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(arrowSource->GetOutputPort());\n  transformPD->Update();\n  polyData = transformPD->GetOutput();\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/PlaneSourceDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlaneSourceDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlaneSourceDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlaneSourceDemo MACOSX_BUNDLE PlaneSourceDemo.cxx )\n  target_link_libraries(PlaneSourceDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlaneSourceDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/PlaneSourceDemo/#download-and-build-planesourcedemo","title":"Download and Build PlaneSourceDemo","text":"

Click here to download PlaneSourceDemo and its CMakeLists.txt file. Once the tarball PlaneSourceDemo.tar has been downloaded and extracted,

cd PlaneSourceDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PlaneSourceDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Planes/","title":"Planes","text":"

vtk-examples/Cxx/GeometricObjects/Planes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Planes/#code","title":"Code","text":"

Planes.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkHull.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <string>\n#include <vector>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // These are the two methods we will use.\n  std::vector<std::string> titles{\"Using frustum planes\", \"Using bounds\"};\n  std::vector<vtkSmartPointer<vtkPlanes>> planes;\n  for (auto i = 0; i < titles.size(); ++i)\n  {\n    planes.push_back(vtkSmartPointer<vtkPlanes>::New());\n  }\n\n  // Using frustum planes.\n  vtkNew<vtkCamera> camera;\n  double planesArray[24];\n  camera->GetFrustumPlanes(1, planesArray);\n  planes[0]->SetFrustumPlanes(planesArray);\n\n  // Using bounds.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n  double bounds[6];\n  sphereSource->GetOutput()->GetBounds(bounds);\n  planes[1]->SetBounds(bounds);\n\n  // At this point we have the planes created by both of the methods above.\n  // You can do whatever you want with them.\n\n  // For visualisation we will produce an n-sided convex hull\n  // and visualise it.\n\n  // Create a common text property.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetJustificationToCentered();\n\n  // Create the render window and interactor.\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"Planes\");\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  std::vector<vtkSmartPointer<vtkHull>> hulls;\n  std::vector<vtkSmartPointer<vtkPolyData>> pds;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  for (auto i = 0; i < titles.size(); ++i)\n  {\n    hulls.push_back(vtkSmartPointer<vtkHull>::New());\n    hulls[i]->SetPlanes(planes[i]);\n\n    pds.push_back(vtkSmartPointer<vtkPolyData>::New());\n\n    // To generate the convex hull we supply a vtkPolyData object and a bounding\n    // box.\n    // We define the bounding box to be where we expect the resulting polyhedron\n    // to lie.\n    // Make it a generous fit as it is only used to create the initial\n    // polygons that are eventually clipped.\n    hulls[i]->GenerateHull(pds[i], -200, 200, -200, 200, -200, 200);\n\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputData(pds[i]);\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(\n        colors->GetColor3d(\"Moccasin\").GetData());\n    actors[i]->GetProperty()->SetSpecular(0.8);\n    actors[i]->GetProperty()->SetSpecularPower(30);\n\n    textMappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textMappers[i]->SetInput(titles[i].c_str());\n    textMappers[i]->SetTextProperty(textProperty);\n\n    textActors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    textActors[i]->SetMapper(textMappers[i]);\n    textActors[i]->SetPosition(120, 16);\n\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    renderers[i]->AddActor(actors[i]);\n    renderers[i]->AddViewProp(textActors[i]);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  // Setup the viewports\n  auto xGridDimensions = 2;\n  auto yGridDimensions = 1;\n  auto rendererSize = 300;\n  renWin->SetSize(rendererSize * xGridDimensions,\n                  rendererSize * yGridDimensions);\n  for (auto row = 0; row < yGridDimensions; ++row)\n  {\n    for (auto col = 0; col < xGridDimensions; ++col)\n    {\n      auto index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      if (index > (actors.size() - 1))\n      {\n        // Add a renderer even if there is no actor.\n        // This makes the render window background all the same color.\n        vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();\n        ren->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n        ren->SetViewport(viewport);\n        renWin->AddRenderer(ren);\n        continue;\n      }\n\n      renderers[index]->SetViewport(viewport);\n      renderers[index]->SetBackground(\n          colors->GetColor3d(\"DarkSlateGray\").GetData());\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(-30);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  iRen->Initialize();\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Planes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Planes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Planes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Planes MACOSX_BUNDLE Planes.cxx )\n  target_link_libraries(Planes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Planes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Planes/#download-and-build-planes","title":"Download and Build Planes","text":"

Click here to download Planes and its CMakeLists.txt file. Once the tarball Planes.tar has been downloaded and extracted,

cd Planes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Planes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/PlanesIntersection/","title":"PlanesIntersection","text":"

vtk-examples/Cxx/GeometricObjects/PlanesIntersection

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/PlanesIntersection/#code","title":"Code","text":"

PlanesIntersection.cxx

#include <vtkNew.h>\n#include <vtkPlanesIntersection.h>\n#include <vtkPoints.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  double bounds[6];\n  sphereSource->GetOutput()->GetBounds(bounds);\n\n  vtkNew<vtkPoints> box;\n\n  box->SetNumberOfPoints(8);\n\n  double xMin, xMax, yMin, yMax, zMin, zMax;\n  xMin = bounds[0];\n  xMax = bounds[1];\n  yMin = bounds[2];\n  yMax = bounds[3];\n  zMin = bounds[4];\n  zMax = bounds[5];\n\n  box->SetPoint(0, xMax, yMin, zMax);\n  box->SetPoint(1, xMax, yMin, zMin);\n  box->SetPoint(2, xMax, yMax, zMin);\n  box->SetPoint(3, xMax, yMax, zMax);\n  box->SetPoint(4, xMin, yMin, zMax);\n  box->SetPoint(5, xMin, yMin, zMin);\n  box->SetPoint(6, xMin, yMax, zMin);\n  box->SetPoint(7, xMin, yMax, zMax);\n\n  vtkNew<vtkPlanesIntersection> planesIntersection;\n  planesIntersection->SetBounds(bounds);\n\n  int intersects = planesIntersection->IntersectsRegion(box);\n  auto res = (intersects == 1) ? \"Yes\" : \"No\";\n\n  std::cout << \"Intersects? \" << res << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/PlanesIntersection/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlanesIntersection)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlanesIntersection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlanesIntersection MACOSX_BUNDLE PlanesIntersection.cxx )\n  target_link_libraries(PlanesIntersection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlanesIntersection\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/PlanesIntersection/#download-and-build-planesintersection","title":"Download and Build PlanesIntersection","text":"

Click here to download PlanesIntersection and its CMakeLists.txt file. Once the tarball PlanesIntersection.tar has been downloaded and extracted,

cd PlanesIntersection/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PlanesIntersection\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/PlatonicSolids/","title":"PlatonicSolids","text":"

vtk-examples/Cxx/GeometricObjects/PlatonicSolids

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/PlatonicSolids/#description","title":"Description","text":"

Display all five Platonic solids in a grid.

Platonic solids are regular, convex polyhedrons. They are constructed by congruent (identical in shape and size) regular (all angles equal and all sides equal) polygonal faces with the same number of faces meeting at each vertex.

Five solids satisfy the above criteria:

Figure Tetrahedron Cube Octahedron Icosahedron Dodecahedron Vertices 4 8 6 (2 \u00d7 3) 12 (4 \u00d7 3) 20 (8 + 4 \u00d7 3) Edges 6 12 12 30 30 Faces 4 6 8 20 12

The relationship between vertices, edges and faces is given by Euler's formula:

V - E + F = 2\n

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/PlatonicSolids/#code","title":"Code","text":"

PlatonicSolids.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextActor.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <functional>\n#include <string>\n#include <tuple>\n#include <vector>\n\nnamespace {\n\n/** Get the platonic solid names and initial orientations.\n *\n * @return The solids and their initial orientations.\n */\nstd::vector<std::tuple<std::string, double, double, double>>\nGetNameOrientation();\n\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  // Create a common text property.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetJustificationToCentered();\n\n  // Create the render window and interactor.\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"PlatonicSolids\");\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Platonic solids and orientation for display.\n  auto nameOrientation = GetNameOrientation();\n  auto lut = GetPlatonicLUT();\n  std::vector<vtkSmartPointer<vtkPlatonicSolidSource>> PlatonicSolids;\n\n  for (auto i = 0; i < nameOrientation.size(); ++i)\n  {\n    PlatonicSolids.push_back(vtkSmartPointer<vtkPlatonicSolidSource>::New());\n    PlatonicSolids[i]->SetSolidType(i);\n\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputConnection(PlatonicSolids[i]->GetOutputPort());\n    mappers[i]->SetLookupTable(lut);\n    mappers[i]->SetScalarRange(0, 19);\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n\n    textMappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textMappers[i]->SetInput(std::get<0>(nameOrientation[i]).c_str());\n    textMappers[i]->SetTextProperty(textProperty);\n\n    textActors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    textActors[i]->SetMapper(textMappers[i]);\n    textActors[i]->SetPosition(120, 16);\n\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    renderers[i]->AddActor(actors[i]);\n    renderers[i]->AddViewProp(textActors[i]);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  // Set up the viewports\n  auto gridDimensionsX = 3;\n  auto gridDimensionsY = 2;\n  auto rendererSize = 300;\n  renWin->SetSize(rendererSize * gridDimensionsX,\n                  rendererSize * gridDimensionsY);\n  for (auto row = 0; row < gridDimensionsY; ++row)\n  {\n    for (auto col = 0; col < gridDimensionsX; ++col)\n    {\n      auto index = row * gridDimensionsX + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / gridDimensionsX,\n          static_cast<double>(gridDimensionsY - (row + 1)) / gridDimensionsY,\n          static_cast<double>(col + 1) / gridDimensionsX,\n          static_cast<double>(gridDimensionsY - row) / gridDimensionsY};\n      if (index > (actors.size() - 1))\n      {\n        // Add a renderer even if there is no actor.\n        // This makes the render window background all the same color.\n        vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();\n        ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n        ren->SetViewport(viewport);\n        renWin->AddRenderer(ren);\n        continue;\n      }\n\n      renderers[index]->SetViewport(viewport);\n      renderers[index]->SetBackground(\n          colors->GetColor3d(\"SlateGray\").GetData());\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(\n          std::get<1>(nameOrientation[index]));\n      renderers[index]->GetActiveCamera()->Elevation(\n          std::get<2>(nameOrientation[index]));\n      renderers[index]->GetActiveCamera()->Zoom(\n          std::get<3>(nameOrientation[index]));\n    }\n  }\n\n  iRen->Initialize();\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::vector<std::tuple<std::string, double, double, double>>\nGetNameOrientation()\n{\n  auto getTuple = [](std::string const& name, double const& azimuth,\n                     double const& elevation, double const& zoom) {\n    return std::make_tuple(name, azimuth, elevation, zoom);\n  };\n\n  std::vector<std::tuple<std::string, double, double, double>> res;\n  res.push_back(getTuple(\"Tetrahedron\", 45.0, 30.0, 1.0));\n  res.push_back(getTuple(\"Cube\", -60.0, 45.0, 0.8));\n  res.push_back(getTuple(\"Octahedron\", -15.0, 10.0, 1.0));\n  res.push_back(getTuple(\"Icosahedron\", 4.5, 18.0, 1.0));\n  res.push_back(getTuple(\"Dodecahedron\", 171.0, 22.0, 1.0));\n\n  return res;\n}\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/PlatonicSolids/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlatonicSolids)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlatonicSolids: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlatonicSolids MACOSX_BUNDLE PlatonicSolids.cxx )\n  target_link_libraries(PlatonicSolids PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlatonicSolids\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/PlatonicSolids/#download-and-build-platonicsolids","title":"Download and Build PlatonicSolids","text":"

Click here to download PlatonicSolids and its CMakeLists.txt file. Once the tarball PlatonicSolids.tar has been downloaded and extracted,

cd PlatonicSolids/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PlatonicSolids\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Point/","title":"Point","text":"

vtk-examples/Cxx/GeometricObjects/Point

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Point/#description","title":"Description","text":"

vtkPoints object represents 3D points. The data model for vtkPoints is an array of vx-vy-vz triplets accessible by (point or cell) id.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Point/#code","title":"Code","text":"

Point.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the geometry of a point (the coordinate)\n  vtkNew<vtkPoints> points;\n  const float p[3] = {1.0, 2.0, 3.0};\n\n  // Create the topology of the point (a vertex)\n  vtkNew<vtkCellArray> vertices;\n  // We need an an array of point id's for InsertNextCell.\n  vtkIdType pid[1];\n  pid[0] = points->InsertNextPoint(p);\n  vertices->InsertNextCell(1, pid);\n\n  // Create a polydata object\n  vtkNew<vtkPolyData> point;\n\n  // Set the points and vertices we created as the geometry and topology of the\n  // polydata\n  point->SetPoints(points);\n  point->SetVerts(vertices);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(point);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetPointSize(20);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Point\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Point/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Point)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Point: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Point MACOSX_BUNDLE Point.cxx )\n  target_link_libraries(Point PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Point\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Point/#download-and-build-point","title":"Download and Build Point","text":"

Click here to download Point and its CMakeLists.txt file. Once the tarball Point.tar has been downloaded and extracted,

cd Point/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Point\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/PolyLine/","title":"PolyLine","text":"

vtk-examples/Cxx/GeometricObjects/PolyLine

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/PolyLine/#description","title":"Description","text":"

The polyline is a composite one-dimensional cell consisting of one or more connected lines. The polyline is defined by an ordered list of n+1 points, where n is the number of lines in the polyline. Each pair of points (i, i+1) defines a line.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/PolyLine/#code","title":"Code","text":"

PolyLine.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create five points.\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n  double p2[3] = {0.0, 1.0, 2.0};\n  double p3[3] = {1.0, 2.0, 3.0};\n\n  // Create a vtkPoints object and store the points in it.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(origin);\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n\n  vtkNew<vtkPolyLine> polyLine;\n  polyLine->GetPointIds()->SetNumberOfIds(5);\n  for (unsigned int i = 0; i < 5; i++)\n  {\n    polyLine->GetPointIds()->SetId(i, i);\n  }\n\n  // Create a cell array to store the lines in and add the lines to it.\n  vtkNew<vtkCellArray> cells;\n  cells->InsertNextCell(polyLine);\n\n  // Create a polydata to store everything in.\n  vtkNew<vtkPolyData> polyData;\n\n  // Add the points to the dataset.\n  polyData->SetPoints(points);\n\n  // Add the lines to the dataset.\n  polyData->SetLines(cells);\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"PolyLine\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkOliveGreen\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/PolyLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyLine MACOSX_BUNDLE PolyLine.cxx )\n  target_link_libraries(PolyLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyLine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/PolyLine/#download-and-build-polyline","title":"Download and Build PolyLine","text":"

Click here to download PolyLine and its CMakeLists.txt file. Once the tarball PolyLine.tar has been downloaded and extracted,

cd PolyLine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyLine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/PolyLine1/","title":"PolyLine1","text":"

vtk-examples/Cxx/GeometricObjects/PolyLine1

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/PolyLine1/#code","title":"Code","text":"

PolyLine1.cxx

#include <algorithm>\n#include <array>\n#include <cmath>\n#include <vector>\n#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // vtkPoints represents 3D points. The data model for vtkPoints is an array of\n  // vx-vy-vz triplets accessible by (point or cell) id.\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(6);\n  double c = std::cos(vtkMath::Pi() / 6); // helper variable\n  points->SetPoint(0, 0.0, -1.0, 0.0);\n  points->SetPoint(1, c, -0.5, 0.0);\n  points->SetPoint(2, c, 0.5, 0.0);\n  points->SetPoint(3, 0.0, 1.0, 0.0);\n  points->SetPoint(4, -c, 0.5, 0.0);\n  points->SetPoint(5, -c, -0.5, 0.0);\n\n  // vtkCellArray is a supporting object that explicitly represents cell\n  // connectivity.\n  // The cell array structure is a raw integer list of the form:\n  // (n,id1,id2,...,idn, n,id1,id2,...,idn, ...) where n is the number of points\n  // in\n  // the cell, and id is a zero-offset index into an associated point list.\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(7);\n  lines->InsertCellPoint(0);\n  lines->InsertCellPoint(1);\n  lines->InsertCellPoint(2);\n  lines->InsertCellPoint(3);\n  lines->InsertCellPoint(4);\n  lines->InsertCellPoint(5);\n  lines->InsertCellPoint(0);\n\n  // vtkPolyData is a data object that is a concrete implementation of\n  // vtkDataSet.\n  // vtkPolyData represents a geometric structure consisting of vertices, lines,\n  // polygons, and/or triangle strips\n  vtkNew<vtkPolyData> polygon;\n  polygon->SetPoints(points);\n  polygon->SetLines(lines);\n\n  // vtkPolyDataMapper is a class that maps polygonal data (i.e., vtkPolyData)\n  // to graphics primitives\n  vtkNew<vtkPolyDataMapper> polygonMapper;\n  polygonMapper->SetInputData(polygon);\n  polygonMapper->Update();\n\n  // Create an actor to represent the polygon. The actor orchestrates rendering\n  // of\n  // the mapper's graphics primitives. An actor also refers to properties via a\n  // vtkProperty instance, and includes an internal transformation matrix. We\n  // set this actor's mapper to be polygonMapper which we created above.\n  vtkNew<vtkActor> polygonActor;\n  polygonActor->SetMapper(polygonMapper);\n  polygonActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the\n  // background color here.\n  vtkNew<vtkRenderer> ren;\n  ren->AddActor(polygonActor);\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Automatically set up the camera based on the visible actors.\n  // The camera will reposition itself to view the center point of the actors,\n  // and move along its initial view plane normal\n  // (i.e., vector defined from camera position to focal point) so that all of\n  // the\n  // actors can be seen.\n  ren->ResetCamera();\n\n  // Finally we create the render window which will show up on the screen\n  // We put our renderer into the render window using AddRenderer. We\n  // also set the size to be 300 pixels by 300.\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"OrderedPolyLine\");\n  renWin->AddRenderer(ren);\n  renWin->SetSize(300, 300);\n\n  // The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n  // mouse) in the vtkRenderWindow. These events are translated into\n  // event invocations that VTK understands (see VTK/Common/vtkCommand.h\n  // for all events that VTK processes). Then observers of these VTK\n  // events can process them as appropriate.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/PolyLine1/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyLine1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyLine1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyLine1 MACOSX_BUNDLE PolyLine1.cxx )\n  target_link_libraries(PolyLine1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyLine1\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/PolyLine1/#download-and-build-polyline1","title":"Download and Build PolyLine1","text":"

Click here to download PolyLine1 and its CMakeLists.txt file. Once the tarball PolyLine1.tar has been downloaded and extracted,

cd PolyLine1/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyLine1\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Polygon/","title":"Polygon","text":"

vtk-examples/Cxx/GeometricObjects/Polygon

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Polygon/#description","title":"Description","text":"

The polygon is a primary two-dimensional cell. The polygon is defined by an ordered list of three or more points lying in a plane. The polygon normal is implicitly defined by a counterclockwise ordering of its points using the right-hand rule.

The polygon may be nonconvex, but may not have internal loops, and it cannot self-intersect. The polygon has n edges, where n is the number of points in the polygon.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Polygon/#code","title":"Code","text":"

Polygon.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolygon.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup four points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Create the polygon\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPointIds()->SetNumberOfIds(4); // make a quad\n  polygon->GetPointIds()->SetId(0, 0);\n  polygon->GetPointIds()->SetId(1, 1);\n  polygon->GetPointIds()->SetId(2, 2);\n  polygon->GetPointIds()->SetId(3, 3);\n\n  // Add the polygon to a list of polygons\n  vtkNew<vtkCellArray> polygons;\n  polygons->InsertNextCell(polygon);\n\n  // Create a PolyData\n  vtkNew<vtkPolyData> polygonPolyData;\n  polygonPolyData->SetPoints(points);\n  polygonPolyData->SetPolys(polygons);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polygonPolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Polygon\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Polygon/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Polygon)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Polygon: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Polygon MACOSX_BUNDLE Polygon.cxx )\n  target_link_libraries(Polygon PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Polygon\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Polygon/#download-and-build-polygon","title":"Download and Build Polygon","text":"

Click here to download Polygon and its CMakeLists.txt file. Once the tarball Polygon.tar has been downloaded and extracted,

cd Polygon/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Polygon\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/PolygonIntersection/","title":"PolygonIntersection","text":"

vtk-examples/Cxx/GeometricObjects/PolygonIntersection

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/PolygonIntersection/#code","title":"Code","text":"

PolygonIntersection.cxx

#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolygon.h>\n\nint main(int, char*[])\n{\n  // Create a square in the XY plane\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Create the polygon\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPoints()->DeepCopy(points);\n  polygon->GetPointIds()->SetNumberOfIds(4); // 4 corners of the square\n  polygon->GetPointIds()->SetId(0, 0);\n  polygon->GetPointIds()->SetId(1, 1);\n  polygon->GetPointIds()->SetId(2, 2);\n  polygon->GetPointIds()->SetId(3, 3);\n\n  // Inputs\n  double p1[3] = {0.1, 0, -1.0};\n  double p2[3] = {0.1, 0, 1.0};\n  double tolerance = 0.001;\n  // Outputs\n  double t; // Parametric coordinate of intersection (0 (corresponding to p1) to\n            // 1 (corresponding to p2))\n  double x[3]; // The coordinate of the intersection\n  double pcoords[3];\n  int subId;\n\n  vtkIdType iD =\n      polygon->IntersectWithLine(p1, p2, tolerance, t, x, pcoords, subId);\n\n  auto res = (iD == 1) ? \"Yes\" : \"No\";\n  std::cout << \"intersected? \" << res << std::endl;\n  std::cout << \"intersection: \" << x[0] << \" \" << x[1] << \" \" << x[2]\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/PolygonIntersection/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolygonIntersection)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolygonIntersection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolygonIntersection MACOSX_BUNDLE PolygonIntersection.cxx )\n  target_link_libraries(PolygonIntersection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolygonIntersection\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/PolygonIntersection/#download-and-build-polygonintersection","title":"Download and Build PolygonIntersection","text":"

Click here to download PolygonIntersection and its CMakeLists.txt file. Once the tarball PolygonIntersection.tar has been downloaded and extracted,

cd PolygonIntersection/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolygonIntersection\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Polyhedron/","title":"Polyhedron","text":"

vtk-examples/Cxx/GeometricObjects/Polyhedron

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Polyhedron/#code","title":"Code","text":"

Polyhedron.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the polyhedron, a cube.\n  vtkIdType pointIds[8] = {0, 1, 2, 3, 4, 5, 6, 7};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(-1.0, -1.0, -1.0);\n  points->InsertNextPoint(1.0, -1.0, -1.0);\n  points->InsertNextPoint(1.0, 1.0, -1.0);\n  points->InsertNextPoint(-1.0, 1.0, -1.0);\n  points->InsertNextPoint(-1.0, -1.0, 1.0);\n  points->InsertNextPoint(1.0, -1.0, 1.0);\n  points->InsertNextPoint(1.0, 1.0, 1.0);\n  points->InsertNextPoint(-1.0, 1.0, 1.0);\n\n  vtkNew<vtkIdList> faces;\n  vtkIdType face0[4] = {0, 3, 2, 1};\n  vtkIdType face1[4] = {0, 4, 7, 3};\n  vtkIdType face2[4] = {4, 5, 6, 7};\n  vtkIdType face3[4] = {5, 1, 2, 6};\n  vtkIdType face4[4] = {0, 1, 5, 4};\n  vtkIdType face5[4] = {2, 3, 7, 6};\n\n  auto addFace = [&](const vtkIdType face[4]) {\n    faces->InsertNextId(4);\n    for (int i = 0; i < 4; ++i)\n    {\n      faces->InsertNextId(face[i]);\n    }\n  };\n\n  addFace(face0);\n  addFace(face1);\n  addFace(face2);\n  addFace(face3);\n  addFace(face4);\n  addFace(face5);\n\n  vtkNew<vtkUnstructuredGrid> ugrid;\n  ugrid->SetPoints(points);\n  ugrid->InsertNextCell(VTK_POLYHEDRON, 8, pointIds, 6, faces->GetPointer(0));\n\n  // Here we write out the cube.\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetInputData(ugrid);\n  writer->SetFileName(\"polyhedron.vtu\");\n  writer->SetDataModeToAscii();\n  writer->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(ugrid);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  // Visualize.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Polyhedron\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Polyhedron/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Polyhedron)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Polyhedron: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Polyhedron MACOSX_BUNDLE Polyhedron.cxx )\n  target_link_libraries(Polyhedron PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Polyhedron\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Polyhedron/#download-and-build-polyhedron","title":"Download and Build Polyhedron","text":"

Click here to download Polyhedron and its CMakeLists.txt file. Once the tarball Polyhedron.tar has been downloaded and extracted,

cd Polyhedron/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Polyhedron\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Pyramid/","title":"Pyramid","text":"

vtk-examples/Cxx/GeometricObjects/Pyramid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Pyramid/#code","title":"Code","text":"

Pyramid.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkPyramid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n\n  float p0[3] = {1.0, 1.0, 1.0};\n  float p1[3] = {-1.0, 1.0, 1.0};\n  float p2[3] = {-1.0, -1.0, 1.0};\n  float p3[3] = {1.0, -1.0, 1.0};\n  float p4[3] = {0.0, 0.0, 0.0};\n\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n  points->InsertNextPoint(p4);\n\n  vtkNew<vtkPyramid> pyramid;\n  pyramid->GetPointIds()->SetId(0, 0);\n  pyramid->GetPointIds()->SetId(1, 1);\n  pyramid->GetPointIds()->SetId(2, 2);\n  pyramid->GetPointIds()->SetId(3, 3);\n  pyramid->GetPointIds()->SetId(4, 4);\n\n  vtkNew<vtkCellArray> cells;\n  cells->InsertNextCell(pyramid);\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(pyramid->GetCellType(), pyramid->GetPointIds());\n\n  // Create an actor and mapper\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(ug);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Pyramid\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n\n  // Create a nice view\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(180);\n  renderer->GetActiveCamera()->Elevation(-20);\n  renderer->ResetCameraClippingRange();\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Pyramid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Pyramid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Pyramid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Pyramid MACOSX_BUNDLE Pyramid.cxx )\n  target_link_libraries(Pyramid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Pyramid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Pyramid/#download-and-build-pyramid","title":"Download and Build Pyramid","text":"

Click here to download Pyramid and its CMakeLists.txt file. Once the tarball Pyramid.tar has been downloaded and extracted,

cd Pyramid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Pyramid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Quad/","title":"Quad","text":"

vtk-examples/Cxx/GeometricObjects/Quad

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Quad/#code","title":"Code","text":"

Quad.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuad.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create four points (must be in counter clockwise order)\n  double p0[3] = {0.0, 0.0, 0.0};\n  double p1[3] = {1.0, 0.0, 0.0};\n  double p2[3] = {1.0, 1.0, 0.0};\n  double p3[3] = {0.0, 1.0, 0.0};\n\n  // Add the points to a vtkPoints object\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n\n  // Create a quad on the four points\n  vtkNew<vtkQuad> quad;\n  quad->GetPointIds()->SetId(0, 0);\n  quad->GetPointIds()->SetId(1, 1);\n  quad->GetPointIds()->SetId(2, 2);\n  quad->GetPointIds()->SetId(3, 3);\n\n  // Create a cell array to store the quad in\n  vtkNew<vtkCellArray> quads;\n  quads->InsertNextCell(quad);\n\n  // Create a polydata to store everything in\n  vtkNew<vtkPolyData> polydata;\n\n  // Add the points and quads to the dataset\n  polydata->SetPoints(points);\n  polydata->SetPolys(quads);\n\n  // Setup actor and mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Quad\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Quad/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Quad)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Quad: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Quad MACOSX_BUNDLE Quad.cxx )\n  target_link_libraries(Quad PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Quad\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Quad/#download-and-build-quad","title":"Download and Build Quad","text":"

Click here to download Quad and its CMakeLists.txt file. Once the tarball Quad.tar has been downloaded and extracted,

cd Quad/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Quad\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/QuadraticHexahedron/","title":"QuadraticHexahedron","text":"

vtk-examples/Cxx/GeometricObjects/QuadraticHexahedron

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/QuadraticHexahedron/#code","title":"Code","text":"

QuadraticHexahedron.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkQuadraticHexahedron.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTessellatorFilter.h>\n#include <vtkUnstructuredGrid.h>\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticHexahedron();\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  auto uGrid = MakeQuadraticHexahedron();\n\n  vtkNew<vtkTessellatorFilter> tessellate;\n  tessellate->SetInputData(uGrid);\n  tessellate->SetMaximumNumberOfSubdivisions(2);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(tessellate->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the grid\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(0.02);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputData(uGrid);\n  glyph3D->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  vtkNew<vtkDataSetMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n  glyph3DMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"QuadraticHexahedron\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyph3DActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticHexahedron()\n{\n  vtkNew<vtkQuadraticHexahedron> aHexahedron;\n  vtkNew<vtkPoints> points;\n\n  double* pcoords = aHexahedron->GetParametricCoords();\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  points->SetNumberOfPoints(aHexahedron->GetNumberOfPoints());\n  rng->SetSeed(5070); // for testing\n  for (auto i = 0; i < aHexahedron->GetNumberOfPoints(); ++i)\n  {\n    double perturbation[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rng->Next();\n      perturbation[j] = rng->GetRangeValue(-0.1, 0.1);\n    }\n    aHexahedron->GetPointIds()->SetId(i, i);\n    points->SetPoint(i, *(pcoords + 3 * i) + perturbation[0],\n                     *(pcoords + 3 * i + 1) + perturbation[1],\n                     *(pcoords + 3 * i + 2) + perturbation[2]);\n  }\n\n  // Add the points and hexahedron to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(aHexahedron->GetCellType(), aHexahedron->GetPointIds());\n\n  return uGrid;\n}\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/QuadraticHexahedron/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadraticHexahedron)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadraticHexahedron: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadraticHexahedron MACOSX_BUNDLE QuadraticHexahedron.cxx )\n  target_link_libraries(QuadraticHexahedron PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadraticHexahedron\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/QuadraticHexahedron/#download-and-build-quadratichexahedron","title":"Download and Build QuadraticHexahedron","text":"

Click here to download QuadraticHexahedron and its CMakeLists.txt file. Once the tarball QuadraticHexahedron.tar has been downloaded and extracted,

cd QuadraticHexahedron/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QuadraticHexahedron\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/QuadraticHexahedronDemo/","title":"QuadraticHexahedronDemo","text":"

vtk-examples/Cxx/GeometricObjects/QuadraticHexahedronDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/QuadraticHexahedronDemo/#description","title":"Description","text":"

This example shows the effect of changing the chord length error for a vtkQuadraticHexahedron.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/QuadraticHexahedronDemo/#code","title":"Code","text":"

QuadraticHexahedronDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCellIterator.h>\n#include <vtkCommand.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGenericCell.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkQuadraticHexahedron.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTessellatorFilter.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <map>\n#include <sstream>\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticHexahedron();\n\nvoid MakeWidget(vtkSmartPointer<vtkSliderWidget>& widget,\n                vtkSmartPointer<vtkTessellatorFilter>& tessellate,\n                vtkSmartPointer<vtkTextMapper>& textMapper,\n                vtkSmartPointer<vtkRenderWindowInteractor>& interactor);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n  auto uGrid = MakeQuadraticHexahedron();\n\n  vtkSmartPointer<vtkTessellatorFilter> tessellate =\n      vtkSmartPointer<vtkTessellatorFilter>::New();\n  tessellate->SetInputData(uGrid);\n  tessellate->SetChordError(0.035);\n  tessellate->Update();\n\n  typedef std::map<const char*, int> CellContainer;\n  CellContainer cellMap;\n\n  int numTets = 0;\n  vtkNew<vtkGenericCell> cell;\n  auto it = tessellate->GetOutput()->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    it->GetCell(cell);\n    cellMap[cell->GetRepresentativeCell()->GetClassName()]++;\n    ++numTets;\n  }\n  it->Delete();\n\n  vtkSmartPointer<vtkDataSetMapper> mapper =\n      vtkSmartPointer<vtkDataSetMapper>::New();\n  mapper->SetInputConnection(tessellate->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the grid\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(0.02);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputData(uGrid);\n  glyph3D->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  vtkNew<vtkDataSetMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n  glyph3DMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(24);\n\n  std::stringstream ss;\n  ss << \"# of Tetras: \" << numTets << std::endl;\n  vtkSmartPointer<vtkTextMapper> textMapper =\n      vtkSmartPointer<vtkTextMapper>::New();\n  textMapper->SetInput(ss.str().c_str());\n  textMapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetPosition(10, 400);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"QuadraticHexahedronDemo\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 512);\n  vtkSmartPointer<vtkRenderWindowInteractor> interactor =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkSmartPointer<vtkSliderWidget> widget =\n      vtkSmartPointer<vtkSliderWidget>::New();\n  MakeWidget(widget, tessellate, textMapper, interactor);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyph3DActor);\n  renderer->AddViewProp(textActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackChordError : public vtkCommand\n{\npublic:\n  static SliderCallbackChordError* New()\n  {\n    return new SliderCallbackChordError;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->Tessellator->SetChordError(value);\n    this->Tessellator->SetMaximumNumberOfSubdivisions(4);\n    this->Tessellator->Update();\n\n    typedef std::map<const char*, int> CellContainer;\n    CellContainer cellMap;\n\n    int numTets = 0;\n    vtkNew<vtkGenericCell> cell;\n    auto it = this->Tessellator->GetOutput()->NewCellIterator();\n    for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n    {\n      it->GetCell(cell);\n      cellMap[cell->GetRepresentativeCell()->GetClassName()]++;\n      ++numTets;\n    }\n    std::stringstream ss;\n    ss << \"# of Tetras: \" << numTets << std::endl;\n    TextMapper->SetInput(ss.str().c_str());\n  }\n  SliderCallbackChordError() : Tessellator(0), TextMapper(0)\n  {\n  }\n  vtkTessellatorFilter* Tessellator;\n  vtkTextMapper* TextMapper;\n};\n\nvoid MakeWidget(vtkSmartPointer<vtkSliderWidget>& widget,\n                vtkSmartPointer<vtkTessellatorFilter>& tessellate,\n                vtkSmartPointer<vtkTextMapper>& textMapper,\n                vtkSmartPointer<vtkRenderWindowInteractor>& interactor)\n{\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(0.008);\n  double sliderLength(0.008);\n  double titleHeight(0.04);\n  double labelHeight(0.04);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepChordError;\n\n  sliderRepChordError->SetMinimumValue(0.0);\n  sliderRepChordError->SetMaximumValue(0.07);\n  sliderRepChordError->SetValue(tessellate->GetChordError());\n  sliderRepChordError->SetTitleText(\"Chord error\");\n\n  sliderRepChordError->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepChordError->GetPoint1Coordinate()->SetValue(0.1, 0.1);\n  sliderRepChordError->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepChordError->GetPoint2Coordinate()->SetValue(0.9, 0.1);\n\n  sliderRepChordError->SetTubeWidth(tubeWidth);\n  sliderRepChordError->SetSliderLength(sliderLength);\n  sliderRepChordError->SetTitleHeight(titleHeight);\n  sliderRepChordError->SetLabelHeight(labelHeight);\n\n  widget->SetInteractor(interactor);\n  widget->SetRepresentation(sliderRepChordError);\n  widget->SetAnimationModeToAnimate();\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackChordError> callbackChordError;\n  callbackChordError->Tessellator = tessellate;\n  callbackChordError->TextMapper = textMapper;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackChordError);\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticHexahedron()\n{\n  vtkNew<vtkQuadraticHexahedron> aHexahedron;\n  vtkNew<vtkPoints> points;\n\n  double* pcoords = aHexahedron->GetParametricCoords();\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  points->SetNumberOfPoints(aHexahedron->GetNumberOfPoints());\n  rng->SetSeed(5070); // for testing\n  for (auto i = 0; i < aHexahedron->GetNumberOfPoints(); ++i)\n  {\n    double perturbation[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rng->Next();\n      perturbation[j] = rng->GetRangeValue(-0.1, 0.1);\n    }\n    aHexahedron->GetPointIds()->SetId(i, i);\n    points->SetPoint(i, *(pcoords + 3 * i) + perturbation[0],\n                     *(pcoords + 3 * i + 1) + perturbation[1],\n                     *(pcoords + 3 * i + 2) + perturbation[2]);\n  }\n\n  // Add the points and hexahedron to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(aHexahedron->GetCellType(), aHexahedron->GetPointIds());\n\n  return uGrid;\n}\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/QuadraticHexahedronDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadraticHexahedronDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadraticHexahedronDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadraticHexahedronDemo MACOSX_BUNDLE QuadraticHexahedronDemo.cxx )\n  target_link_libraries(QuadraticHexahedronDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadraticHexahedronDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/QuadraticHexahedronDemo/#download-and-build-quadratichexahedrondemo","title":"Download and Build QuadraticHexahedronDemo","text":"

Click here to download QuadraticHexahedronDemo and its CMakeLists.txt file. Once the tarball QuadraticHexahedronDemo.tar has been downloaded and extracted,

cd QuadraticHexahedronDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QuadraticHexahedronDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/QuadraticTetra/","title":"QuadraticTetra","text":"

vtk-examples/Cxx/GeometricObjects/QuadraticTetra

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/QuadraticTetra/#description","title":"Description","text":"

The quadratic tetrahedron is a primary three-dimensional cell. It is defined by ten points. The first four points are located at the vertices of the tetrahedron; the next six are located in the middle of each of the six edges.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/QuadraticTetra/#code","title":"Code","text":"

QuadraticTetra.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkQuadraticTetra.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTessellatorFilter.h>\n#include <vtkUnstructuredGrid.h>\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticTetra();\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  auto uGrid = MakeQuadraticTetra();\n\n  vtkNew<vtkTessellatorFilter> tessellate;\n  tessellate->SetInputData(uGrid);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(tessellate->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the grid\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(0.02);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputData(uGrid);\n  glyph3D->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  vtkNew<vtkDataSetMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n  glyph3DMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"QuadraticTetra\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyph3DActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticTetra()\n{\n  vtkNew<vtkQuadraticTetra> aTetra;\n  vtkNew<vtkPoints> points;\n\n  double* pcoords = aTetra->GetParametricCoords();\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  points->SetNumberOfPoints(aTetra->GetNumberOfPoints());\n  rng->SetSeed(5070); // for testing\n  for (auto i = 0; i < aTetra->GetNumberOfPoints(); ++i)\n  {\n    double perturbation[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rng->Next();\n      perturbation[j] = rng->GetRangeValue(-0.1, 0.1);\n    }\n    aTetra->GetPointIds()->SetId(i, i);\n    points->SetPoint(i, *(pcoords + 3 * i) + perturbation[0],\n                     *(pcoords + 3 * i + 1) + perturbation[1],\n                     *(pcoords + 3 * i + 2) + perturbation[2]);\n  }\n\n  // Add the points and tetra to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(aTetra->GetCellType(), aTetra->GetPointIds());\n\n  return uGrid;\n}\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/QuadraticTetra/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadraticTetra)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadraticTetra: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadraticTetra MACOSX_BUNDLE QuadraticTetra.cxx )\n  target_link_libraries(QuadraticTetra PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadraticTetra\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/QuadraticTetra/#download-and-build-quadratictetra","title":"Download and Build QuadraticTetra","text":"

Click here to download QuadraticTetra and its CMakeLists.txt file. Once the tarball QuadraticTetra.tar has been downloaded and extracted,

cd QuadraticTetra/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QuadraticTetra\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/QuadraticTetraDemo/","title":"QuadraticTetraDemo","text":"

vtk-examples/Cxx/GeometricObjects/QuadraticTetraDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/QuadraticTetraDemo/#description","title":"Description","text":"

This example shows the effect of changing the chord length error for a vtkQuadraticTetra.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/QuadraticTetraDemo/#code","title":"Code","text":"

QuadraticTetraDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCellIterator.h>\n#include <vtkCommand.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGenericCell.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkQuadraticTetra.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTessellatorFilter.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <map>\n#include <sstream>\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticTetra();\n\nvoid MakeWidget(vtkSmartPointer<vtkSliderWidget>& widget,\n                vtkSmartPointer<vtkTessellatorFilter>& tessellate,\n                vtkSmartPointer<vtkTextMapper>& textMapper,\n                vtkSmartPointer<vtkRenderWindowInteractor>& interactor);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  auto uGrid = MakeQuadraticTetra();\n\n  vtkSmartPointer<vtkTessellatorFilter> tessellate =\n      vtkSmartPointer<vtkTessellatorFilter>::New();\n  tessellate->SetInputData(uGrid);\n  tessellate->SetChordError(.035);\n  tessellate->Update();\n\n  typedef std::map<const char*, int> CellContainer;\n  CellContainer cellMap;\n\n  int numTets = 0;\n  vtkNew<vtkGenericCell> cell;\n  auto it = tessellate->GetOutput()->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    it->GetCell(cell);\n    cellMap[cell->GetRepresentativeCell()->GetClassName()]++;\n    ++numTets;\n  }\n  it->Delete();\n\n  vtkSmartPointer<vtkDataSetMapper> mapper =\n      vtkSmartPointer<vtkDataSetMapper>::New();\n  mapper->SetInputConnection(tessellate->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the grid\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(0.02);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputData(uGrid);\n  glyph3D->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  vtkNew<vtkDataSetMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n  glyph3DMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(24);\n\n  std::stringstream ss;\n  ss << \"# of Tetras: \" << numTets << std::endl;\n  vtkSmartPointer<vtkTextMapper> textMapper =\n      vtkSmartPointer<vtkTextMapper>::New();\n  textMapper->SetInput(ss.str().c_str());\n  textMapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetPosition(10, 400);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"QuadraticTetraDemo\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 512);\n  vtkSmartPointer<vtkRenderWindowInteractor> interactor =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkSmartPointer<vtkSliderWidget> widget =\n      vtkSmartPointer<vtkSliderWidget>::New();\n  MakeWidget(widget, tessellate, textMapper, interactor);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyph3DActor);\n  renderer->AddViewProp(textActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackChordError : public vtkCommand\n{\npublic:\n  static SliderCallbackChordError* New()\n  {\n    return new SliderCallbackChordError;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->Tessellator->SetChordError(value);\n    this->Tessellator->SetMaximumNumberOfSubdivisions(5);\n    this->Tessellator->Update();\n\n    typedef std::map<const char*, int> CellContainer;\n    CellContainer cellMap;\n\n    int numTets = 0;\n    vtkNew<vtkGenericCell> cell;\n    auto it = this->Tessellator->GetOutput()->NewCellIterator();\n    for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n    {\n      it->GetCell(cell);\n      cellMap[cell->GetRepresentativeCell()->GetClassName()]++;\n      ++numTets;\n    }\n    std::stringstream ss;\n    ss << \"# of Tetras: \" << numTets << std::endl;\n    TextMapper->SetInput(ss.str().c_str());\n  }\n  SliderCallbackChordError() : Tessellator(0), TextMapper(0)\n  {\n  }\n  vtkTessellatorFilter* Tessellator;\n  vtkTextMapper* TextMapper;\n};\n\nvoid MakeWidget(vtkSmartPointer<vtkSliderWidget>& widget,\n                vtkSmartPointer<vtkTessellatorFilter>& tessellate,\n                vtkSmartPointer<vtkTextMapper>& textMapper,\n                vtkSmartPointer<vtkRenderWindowInteractor>& interactor)\n{\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(0.008);\n  double sliderLength(0.008);\n  double titleHeight(0.04);\n  double labelHeight(0.04);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepChordError;\n\n  sliderRepChordError->SetMinimumValue(0.0);\n  sliderRepChordError->SetMaximumValue(0.07);\n  sliderRepChordError->SetValue(tessellate->GetChordError());\n  sliderRepChordError->SetTitleText(\"Chord error\");\n\n  sliderRepChordError->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepChordError->GetPoint1Coordinate()->SetValue(0.1, 0.1);\n  sliderRepChordError->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepChordError->GetPoint2Coordinate()->SetValue(0.9, 0.1);\n\n  sliderRepChordError->SetTubeWidth(tubeWidth);\n  sliderRepChordError->SetSliderLength(sliderLength);\n  sliderRepChordError->SetTitleHeight(titleHeight);\n  sliderRepChordError->SetLabelHeight(labelHeight);\n\n  widget->SetInteractor(interactor);\n  widget->SetRepresentation(sliderRepChordError);\n  widget->SetAnimationModeToAnimate();\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackChordError> callbackChordError;\n  callbackChordError->Tessellator = tessellate;\n  callbackChordError->TextMapper = textMapper;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackChordError);\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticTetra()\n{\n  vtkNew<vtkQuadraticTetra> aTetra;\n  vtkNew<vtkPoints> points;\n\n  double* pcoords = aTetra->GetParametricCoords();\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  points->SetNumberOfPoints(aTetra->GetNumberOfPoints());\n  rng->SetSeed(5070); // for testing\n  for (auto i = 0; i < aTetra->GetNumberOfPoints(); ++i)\n  {\n    double perturbation[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rng->Next();\n      perturbation[j] = rng->GetRangeValue(-0.2, 0.2);\n    }\n    aTetra->GetPointIds()->SetId(i, i);\n    points->SetPoint(i, *(pcoords + 3 * i) + perturbation[0],\n                     *(pcoords + 3 * i + 1) + perturbation[1],\n                     *(pcoords + 3 * i + 2) + perturbation[2]);\n  }\n\n  // Add the points and tetra to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(aTetra->GetCellType(), aTetra->GetPointIds());\n\n  return uGrid;\n}\n} // namespace\n
"},{"location":"Cxx/GeometricObjects/QuadraticTetraDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadraticTetraDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadraticTetraDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadraticTetraDemo MACOSX_BUNDLE QuadraticTetraDemo.cxx )\n  target_link_libraries(QuadraticTetraDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadraticTetraDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/QuadraticTetraDemo/#download-and-build-quadratictetrademo","title":"Download and Build QuadraticTetraDemo","text":"

Click here to download QuadraticTetraDemo and its CMakeLists.txt file. Once the tarball QuadraticTetraDemo.tar has been downloaded and extracted,

cd QuadraticTetraDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QuadraticTetraDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/RegularPolygonSource/","title":"RegularPolygonSource","text":"

vtk-examples/Cxx/GeometricObjects/RegularPolygonSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/RegularPolygonSource/#description","title":"Description","text":"

This example creates a pentagon.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/RegularPolygonSource/#code","title":"Code","text":"

RegularPolygonSource.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRegularPolygonSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a pentagon\n  vtkNew<vtkRegularPolygonSource> polygonSource;\n  polygonSource->SetNumberOfSides(5);\n  polygonSource->SetRadius(5);\n  polygonSource->SetCenter(0, 0, 0);\n\n  vtkNew<vtkShrinkPolyData> shrink;\n  shrink->SetInputConnection(polygonSource->GetOutputPort());\n  shrink->SetShrinkFactor(0.9);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetLineWidth(5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"RegularPolygonSource\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/RegularPolygonSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RegularPolygonSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RegularPolygonSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RegularPolygonSource MACOSX_BUNDLE RegularPolygonSource.cxx )\n  target_link_libraries(RegularPolygonSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RegularPolygonSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/RegularPolygonSource/#download-and-build-regularpolygonsource","title":"Download and Build RegularPolygonSource","text":"

Click here to download RegularPolygonSource and its CMakeLists.txt file. Once the tarball RegularPolygonSource.tar has been downloaded and extracted,

cd RegularPolygonSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RegularPolygonSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/ShrinkCube/","title":"ShrinkCube","text":"

vtk-examples/Cxx/GeometricObjects/ShrinkCube

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/ShrinkCube/#description","title":"Description","text":"

Generates a cube using vtkCubeSource, then a shrink filter is applied.

vtkShrinkFilter object shrinks cells composing an arbitrary data set towards their centroid. The centroid of a cell is computed as the average position of the cell points. Shrinking results in disconnecting the cells from one another.

Seealso

TessellatedBoxSource generates multiple quads or triangles per side.

Info

See Figure 5-17 in Chapter 5 the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/ShrinkCube/#code","title":"Code","text":"

ShrinkCube.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n\nint main(int, char*[])\n{\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(cubeSource->GetOutputPort());\n  shrink->SetShrinkFactor(.9);\n\n  // Create a mapper and actor.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->SetWindowName(\"ShrinkCube\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/ShrinkCube/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShrinkCube)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShrinkCube: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShrinkCube MACOSX_BUNDLE ShrinkCube.cxx )\n  target_link_libraries(ShrinkCube PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShrinkCube\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/ShrinkCube/#download-and-build-shrinkcube","title":"Download and Build ShrinkCube","text":"

Click here to download ShrinkCube and its CMakeLists.txt file. Once the tarball ShrinkCube.tar has been downloaded and extracted,

cd ShrinkCube/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ShrinkCube\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/SourceObjectsDemo/","title":"SourceObjectsDemo","text":"

vtk-examples/Cxx/GeometricObjects/SourceObjectsDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/SourceObjectsDemo/#description","title":"Description","text":"

Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source.

Info

See Figure 3-26 in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/SourceObjectsDemo/#code","title":"Code","text":"

SourceObjectsDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkCylinderSource.h>\n#include <vtkDiskSource.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataAlgorithm.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTextSource.h>\n\n#include <array>\n#include <vector>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> sourceObjects;\n  sourceObjects.push_back(vtkSmartPointer<vtkSphereSource>::New());\n  static_cast<vtkSphereSource*>(sourceObjects.back().GetPointer())\n      ->SetPhiResolution(21);\n  static_cast<vtkSphereSource*>(sourceObjects.back().GetPointer())\n      ->SetThetaResolution(21);\n\n  sourceObjects.push_back(vtkSmartPointer<vtkConeSource>::New());\n  static_cast<vtkConeSource*>(sourceObjects.back().GetPointer())\n      ->SetResolution(51);\n\n  sourceObjects.push_back(vtkSmartPointer<vtkCylinderSource>::New());\n  static_cast<vtkCylinderSource*>(sourceObjects.back().GetPointer())\n      ->SetResolution(51);\n\n  sourceObjects.push_back(vtkSmartPointer<vtkCubeSource>::New());\n  sourceObjects.push_back(vtkSmartPointer<vtkPlaneSource>::New());\n  sourceObjects.push_back(vtkSmartPointer<vtkTextSource>::New());\n  static_cast<vtkTextSource*>(sourceObjects.back().GetPointer())\n      ->SetText(\"Hello\");\n  static_cast<vtkTextSource*>(sourceObjects.back().GetPointer())->BackingOff();\n\n  sourceObjects.push_back(vtkSmartPointer<vtkPointSource>::New());\n  static_cast<vtkPointSource*>(sourceObjects.back().GetPointer())\n      ->SetNumberOfPoints(500);\n\n  sourceObjects.push_back(vtkSmartPointer<vtkDiskSource>::New());\n  static_cast<vtkDiskSource*>(sourceObjects.back().GetPointer())\n      ->SetCircumferentialResolution(51);\n\n  sourceObjects.push_back(vtkSmartPointer<vtkLineSource>::New());\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textmappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textactors;\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a source, renderer, mapper, and actor\n  // for each object\n  for (unsigned int i = 0; i < sourceObjects.size(); i++)\n  {\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputConnection(sourceObjects[i]->GetOutputPort());\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(\n        colors->GetColor3d(\"PeachPuff\").GetData());\n    actors[i]->SetBackfaceProperty(backProperty);\n\n    textmappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textmappers[i]->SetInput(sourceObjects[i]->GetClassName());\n    textmappers[i]->SetTextProperty(textProperty);\n\n    textactors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    textactors[i]->SetMapper(textmappers[i]);\n    textactors[i]->SetPosition(120, 16);\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n  }\n\n  auto gridDimensions = 3;\n\n  // Need a renderer even if there is no actor\n  for (auto i = static_cast<int>(sourceObjects.size());\n       i < gridDimensions * gridDimensions; ++i)\n  {\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n  }\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"SourceObjectsDemo\");\n\n  int rendererSize = 300;\n  renderWindow->SetSize(rendererSize * gridDimensions,\n                        rendererSize * gridDimensions);\n\n  for (auto row = 0; row < gridDimensions; row++)\n  {\n    for (auto col = 0; col < gridDimensions; col++)\n    {\n      auto index = row * gridDimensions + col;\n      auto x0 = double(col) / gridDimensions;\n      auto y0 = double(gridDimensions - row - 1) / gridDimensions;\n      auto x1 = double(col + 1) / gridDimensions;\n      auto y1 = double(gridDimensions - row) / gridDimensions;\n      renderWindow->AddRenderer(renderers[index]);\n      renderers[index]->SetViewport(x0, y0, x1, y1);\n\n      if (index > static_cast<int>(sourceObjects.size() - 1))\n      {\n        continue;\n      }\n\n      renderers[index]->AddActor(actors[index]);\n      renderers[index]->AddActor(textactors[index]);\n      renderers[index]->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(30);\n      renderers[index]->GetActiveCamera()->Zoom(0.8);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/SourceObjectsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SourceObjectsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonExecutionModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SourceObjectsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SourceObjectsDemo MACOSX_BUNDLE SourceObjectsDemo.cxx )\n  target_link_libraries(SourceObjectsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SourceObjectsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/SourceObjectsDemo/#download-and-build-sourceobjectsdemo","title":"Download and Build SourceObjectsDemo","text":"

Click here to download SourceObjectsDemo and its CMakeLists.txt file. Once the tarball SourceObjectsDemo.tar has been downloaded and extracted,

cd SourceObjectsDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SourceObjectsDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Sphere/","title":"Sphere","text":"

vtk-examples/Cxx/GeometricObjects/Sphere

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Sphere/#description","title":"Description","text":"

vtkSphereSource object creates a sphere (represented by polygons) of specified radius centered at the origin.

The resolution (polygonal discretization) in both the latitude (phi) and longitude (theta) directions can be specified.

It also is possible to create partial spheres by specifying maximum phi and theta angles. By default, the surface tessellation of the sphere uses triangles; however you can set LatLongTessellation to produce a tessellation using quadrilaterals.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Sphere/#code","title":"Code","text":"

Sphere.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  // Make the surface smooth.\n  sphereSource->SetPhiResolution(100);\n  sphereSource->SetThetaResolution(100);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Sphere\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Sphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Sphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Sphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Sphere MACOSX_BUNDLE Sphere.cxx )\n  target_link_libraries(Sphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Sphere\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Sphere/#download-and-build-sphere","title":"Download and Build Sphere","text":"

Click here to download Sphere and its CMakeLists.txt file. Once the tarball Sphere.tar has been downloaded and extracted,

cd Sphere/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Sphere\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/TessellatedBoxSource/","title":"TessellatedBoxSource","text":"

vtk-examples/Cxx/GeometricObjects/TessellatedBoxSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/TessellatedBoxSource/#description","title":"Description","text":"

Generates a box(cube) using vtkTessellatedBoxSource with 6 sides. The faces of the box can be subdivided into multiple triangles or quads.

Seealso

Cube generates multiple quads or triangles per side.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/TessellatedBoxSource/#code","title":"Code","text":"

TessellatedBoxSource.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkTessellatedBoxSource.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n  double bounds[6];\n  bounds[0] = -10.0;\n  bounds[1] = 10.0;\n  bounds[2] = 10.0;\n  bounds[3] = 20.0;\n  bounds[4] = -5.0;\n  bounds[5] = 5.0;\n\n  vtkNew<vtkTessellatedBoxSource> boxSource;\n  boxSource->SetLevel(3);\n  boxSource->QuadsOn();\n  boxSource->SetBounds(bounds);\n  boxSource->SetOutputPointsPrecision(vtkAlgorithm::SINGLE_PRECISION);\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(boxSource->GetOutputPort());\n  shrink->SetShrinkFactor(.8);\n\n  // Create a mapper and actor\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"TessellatedBoxSource\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/TessellatedBoxSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TessellatedBoxSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TessellatedBoxSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TessellatedBoxSource MACOSX_BUNDLE TessellatedBoxSource.cxx )\n  target_link_libraries(TessellatedBoxSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TessellatedBoxSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/TessellatedBoxSource/#download-and-build-tessellatedboxsource","title":"Download and Build TessellatedBoxSource","text":"

Click here to download TessellatedBoxSource and its CMakeLists.txt file. Once the tarball TessellatedBoxSource.tar has been downloaded and extracted,

cd TessellatedBoxSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TessellatedBoxSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Tetrahedron/","title":"Tetrahedron","text":"

vtk-examples/Cxx/GeometricObjects/Tetrahedron

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Tetrahedron/#description","title":"Description","text":"

Tetrahedron. The tetrahedron is a primary three-dimensional cell. The tetrahedron is defined by a list of four nonplanar points. The tetrahedron has six edges and four triangular faces.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Tetrahedron/#code","title":"Code","text":"

Tetrahedron.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTetra.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 1);\n\n  points->InsertNextPoint(2, 2, 2);\n  points->InsertNextPoint(3, 2, 2);\n  points->InsertNextPoint(3, 3, 2);\n  points->InsertNextPoint(2, 3, 3);\n\n  // Method 1\n  vtkNew<vtkUnstructuredGrid> unstructuredGrid1;\n  unstructuredGrid1->SetPoints(points);\n\n  vtkIdType ptIds[] = {0, 1, 2, 3};\n  unstructuredGrid1->InsertNextCell(VTK_TETRA, 4, ptIds);\n\n  // Method 2\n  vtkNew<vtkUnstructuredGrid> unstructuredGrid2;\n  unstructuredGrid2->SetPoints(points);\n\n  vtkNew<vtkTetra> tetra;\n\n  tetra->GetPointIds()->SetId(0, 4);\n  tetra->GetPointIds()->SetId(1, 5);\n  tetra->GetPointIds()->SetId(2, 6);\n  tetra->GetPointIds()->SetId(3, 7);\n\n  vtkNew<vtkCellArray> cellArray;\n  cellArray->InsertNextCell(tetra);\n  unstructuredGrid2->SetCells(VTK_TETRA, cellArray);\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper1;\n  mapper1->SetInputData(unstructuredGrid1);\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper2;\n  mapper2->SetInputData(unstructuredGrid2);\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Tetrahedron\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(-10);\n  renderer->GetActiveCamera()->Elevation(-20);\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Tetrahedron/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tetrahedron)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tetrahedron: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tetrahedron MACOSX_BUNDLE Tetrahedron.cxx )\n  target_link_libraries(Tetrahedron PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tetrahedron\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Tetrahedron/#download-and-build-tetrahedron","title":"Download and Build Tetrahedron","text":"

Click here to download Tetrahedron and its CMakeLists.txt file. Once the tarball Tetrahedron.tar has been downloaded and extracted,

cd Tetrahedron/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Tetrahedron\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/TextActor/","title":"TextActor","text":"

vtk-examples/Cxx/GeometricObjects/TextActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/TextActor/#code","title":"Code","text":"

TextActor.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a rendering window and renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"TextActor\");\n  renWin->AddRenderer(ren);\n\n  // Create a render window interactor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create a text actor.\n  vtkNew<vtkTextActor> txt;\n  txt->SetInput(\"Hello World!\");\n  vtkTextProperty* txtprop = txt->GetTextProperty();\n  txtprop->SetFontFamilyToArial();\n  txtprop->BoldOn();\n  txtprop->SetFontSize(36);\n  txtprop->ShadowOn();\n  txtprop->SetShadowOffset(4, 4);\n  txtprop->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n  txt->SetDisplayPosition(20, 30);\n\n  // Assign actor to the renderer.\n  ren->AddActor(txt);\n  ren->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Enable user interface interactor.\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/TextActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextActor MACOSX_BUNDLE TextActor.cxx )\n  target_link_libraries(TextActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/TextActor/#download-and-build-textactor","title":"Download and Build TextActor","text":"

Click here to download TextActor and its CMakeLists.txt file. Once the tarball TextActor.tar has been downloaded and extracted,

cd TextActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TextActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Triangle/","title":"Triangle","text":"

vtk-examples/Cxx/GeometricObjects/Triangle

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Triangle/#description","title":"Description","text":"

The triangle is a primary two-dimensional cell. The triangle is defined by a counterclockwise ordered list of three points. The order of the points specifies the direction of the surface normal using the right-hand rule.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Triangle/#code","title":"Code","text":"

Triangle.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangle.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a triangle.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n\n  vtkNew<vtkCellArray> triangles;\n  triangles->InsertNextCell(triangle);\n\n  // Create a polydata object\n  vtkNew<vtkPolyData> trianglePolyData;\n\n  // Add the geometry and topology to the polydata.\n  trianglePolyData->SetPoints(points);\n  trianglePolyData->SetPolys(triangles);\n\n  // Create mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(trianglePolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and an interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Triangle\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Triangle/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Triangle)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Triangle: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Triangle MACOSX_BUNDLE Triangle.cxx )\n  target_link_libraries(Triangle PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Triangle\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Triangle/#download-and-build-triangle","title":"Download and Build Triangle","text":"

Click here to download Triangle and its CMakeLists.txt file. Once the tarball Triangle.tar has been downloaded and extracted,

cd Triangle/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Triangle\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/TriangleStrip/","title":"TriangleStrip","text":"

vtk-examples/Cxx/GeometricObjects/TriangleStrip

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/TriangleStrip/#description","title":"Description","text":"

The triangle strip is a composite two-dimensional cell consisting of one or more triangles. The points defining the triangle strip need not lie in a plane. The triangle strip is defined by an ordered list of n+2 points, where n is the number of triangles. The ordering of the points is such that each set of three points defines a triangle.

Info

See this wikipedia article for an explanation.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/TriangleStrip/#code","title":"Code","text":"

TriangleStrip.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangleStrip.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1.5, 1, 0);\n\n  vtkNew<vtkTriangleStrip> triangleStrip;\n  triangleStrip->GetPointIds()->SetNumberOfIds(4);\n  triangleStrip->GetPointIds()->SetId(0, 0);\n  triangleStrip->GetPointIds()->SetId(1, 1);\n  triangleStrip->GetPointIds()->SetId(2, 2);\n  triangleStrip->GetPointIds()->SetId(3, 3);\n\n  vtkNew<vtkCellArray> cells;\n  cells->InsertNextCell(triangleStrip);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetStrips(cells);\n\n  // Create an actor and mapper\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"TriangleStrip\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/TriangleStrip/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TriangleStrip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TriangleStrip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TriangleStrip MACOSX_BUNDLE TriangleStrip.cxx )\n  target_link_libraries(TriangleStrip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TriangleStrip\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/TriangleStrip/#download-and-build-trianglestrip","title":"Download and Build TriangleStrip","text":"

Click here to download TriangleStrip and its CMakeLists.txt file. Once the tarball TriangleStrip.tar has been downloaded and extracted,

cd TriangleStrip/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TriangleStrip\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/GeometricObjects/Vertex/","title":"Vertex","text":"

vtk-examples/Cxx/GeometricObjects/Vertex

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/GeometricObjects/Vertex/#description","title":"Description","text":"

The vertex is a primary zero-dimensional cell. It is defined by a single point.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/GeometricObjects/Vertex/#code","title":"Code","text":"

Vertex.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertex.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n\n  vtkNew<vtkVertex> vertex;\n  vertex->GetPointIds()->SetId(0, 0);\n\n  vtkNew<vtkCellArray> vertices;\n  vertices->InsertNextCell(vertex);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetVerts(vertices);\n\n  // Setup actor and mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(30);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Vertex\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/GeometricObjects/Vertex/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Vertex)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Vertex: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Vertex MACOSX_BUNDLE Vertex.cxx )\n  target_link_libraries(Vertex PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Vertex\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/GeometricObjects/Vertex/#download-and-build-vertex","title":"Download and Build Vertex","text":"

Click here to download Vertex and its CMakeLists.txt file. Once the tarball Vertex.tar has been downloaded and extracted,

cd Vertex/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Vertex\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/AdjacencyMatrixToEdgeTable/","title":"AdjacencyMatrixToEdgeTable","text":"

vtk-examples/Cxx/Graphs/AdjacencyMatrixToEdgeTable

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/AdjacencyMatrixToEdgeTable/#code","title":"Code","text":"

AdjacencyMatrixToEdgeTable.cxx

/* The output is:\n\n10 20 30\n40 50 60\n70 80 90\n\n+-----------------+------------------+\n|                 | value            |\n+-----------------+------------------+\n| 2               | 30               |\n| 1               | 20               |\n| 0               | 10               |\n| 2               | 60               |\n| 1               | 50               |\n| 0               | 40               |\n| 2               | 90               |\n| 1               | 80               |\n| 0               | 70               |\n+-----------------+------------------+\n\nThe first column is the column index of the item in the 'value' column.\nThe row index is given by the number of times we've previously seen the column\nindex. For some reason, zeros in the matrix are not reported in the table.\n\nFor example, the first row says that the value '30' is in column 2 of the matrix\n(0-based indexing). Since we have not previously seen an item in column 2, it is\nin row 0 of the matrix.\n\nThe fourth row says that the value '60' is also in column 2. We infer that '60'\nis row 1 of the matrix because we have already seen one item (the '30') in\ncolumn 2.\n*/\n\n#include <vtkAdjacencyMatrixToEdgeTable.h>\n#include <vtkArrayData.h>\n#include <vtkArrayPrint.h>\n#include <vtkDenseArray.h>\n#include <vtkNew.h>\n#include <vtkTable.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDenseArray<double>> array;\n\n  array->Resize(3, 3);\n\n  unsigned int counter{1};\n  unsigned int scale{10};\n  for (vtkIdType i = 0; i < array->GetExtents()[0].GetEnd(); i++)\n  {\n    for (vtkIdType j = 0; j < array->GetExtents()[1].GetEnd(); j++)\n    {\n      array->SetValue(i, j, counter * scale);\n      counter++;\n    }\n  }\n\n  vtkPrintMatrixFormat(std::cout, array.GetPointer());\n\n  vtkNew<vtkArrayData> arrayData;\n  arrayData->AddArray(array);\n\n  vtkNew<vtkAdjacencyMatrixToEdgeTable> adjacencyMatrixToEdgeTable;\n  adjacencyMatrixToEdgeTable->SetInputData(arrayData);\n  adjacencyMatrixToEdgeTable->Update();\n\n  adjacencyMatrixToEdgeTable->GetOutput()->Dump();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/AdjacencyMatrixToEdgeTable/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AdjacencyMatrixToEdgeTable)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AdjacencyMatrixToEdgeTable: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AdjacencyMatrixToEdgeTable MACOSX_BUNDLE AdjacencyMatrixToEdgeTable.cxx )\n  target_link_libraries(AdjacencyMatrixToEdgeTable PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AdjacencyMatrixToEdgeTable\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/AdjacencyMatrixToEdgeTable/#download-and-build-adjacencymatrixtoedgetable","title":"Download and Build AdjacencyMatrixToEdgeTable","text":"

Click here to download AdjacencyMatrixToEdgeTable and its CMakeLists.txt file. Once the tarball AdjacencyMatrixToEdgeTable.tar has been downloaded and extracted,

cd AdjacencyMatrixToEdgeTable/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AdjacencyMatrixToEdgeTable\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/AdjacentVertexIterator/","title":"AdjacentVertexIterator","text":"

vtk-examples/Cxx/Graphs/AdjacentVertexIterator

"},{"location":"Cxx/Graphs/AdjacentVertexIterator/#description","title":"Description","text":"

The visualization in this example is currently broken. vtkGraphLayoutView does not currently allow coloring with a vtkUnsignedCharArray.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/AdjacentVertexIterator/#code","title":"Code","text":"

AdjacentVertexIterator.cxx

#include <vtkAdjacentVertexIterator.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkLookupTable.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkViewTheme.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // create 3 vertices\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  // add edges\n  g->AddEdge(v0, v1);\n  g->AddEdge(v0, v2);\n  g->AddEdge(v2, v3);\n\n  // Create the color array\n  vtkNew<vtkUnsignedCharArray> vertexColors;\n  vertexColors->SetNumberOfComponents(3);\n  vertexColors->SetName(\"color\");\n\n  // setup colors\n  vertexColors->InsertNextTypedTuple(\n      colors->GetColor3ub(\"Blue\").GetData()); // unconnected vertices\n\n  vertexColors->InsertNextTypedTuple(\n      colors->GetColor3ub(\"Red\").GetData()); // origin\n\n  vtkNew<vtkAdjacentVertexIterator> iterator;\n  g->GetAdjacentVertices(0, iterator);\n\n  while (iterator->HasNext())\n  {\n    vtkIdType nextVertex = iterator->Next();\n    std::cout << \"Next vertex: \" << nextVertex << std::endl;\n    vertexColors->InsertNextTypedTuple(\n        colors->GetColor3ub(\"Green\").GetData()); // connected vertices\n  }\n\n  // Add the color array to the graph\n  g->GetVertexData()->AddArray(vertexColors);\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  graphLayoutView->SetLayoutStrategyToTree();\n\n  graphLayoutView->SetVertexColorArrayName(\"color\");\n  graphLayoutView->ColorVerticesOn();\n\n  vtkNew<vtkViewTheme> theme;\n  // theme->SetPointLookupTable(lookupTable);\n  theme->ScalePointLookupTableOff();\n  graphLayoutView->ApplyViewTheme(theme);\n\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetInteractor()->Initialize();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/AdjacentVertexIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AdjacentVertexIterator)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AdjacentVertexIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AdjacentVertexIterator MACOSX_BUNDLE AdjacentVertexIterator.cxx )\n  target_link_libraries(AdjacentVertexIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AdjacentVertexIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/AdjacentVertexIterator/#download-and-build-adjacentvertexiterator","title":"Download and Build AdjacentVertexIterator","text":"

Click here to download AdjacentVertexIterator and its CMakeLists.txt file. Once the tarball AdjacentVertexIterator.tar has been downloaded and extracted,

cd AdjacentVertexIterator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AdjacentVertexIterator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/BoostBreadthFirstSearchTree/","title":"BoostBreadthFirstSearchTree","text":"

vtk-examples/Cxx/Graphs/BoostBreadthFirstSearchTree

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/BoostBreadthFirstSearchTree/#code","title":"Code","text":"

BoostBreadthFirstSearchTree.cxx

#include <vtkBoostBreadthFirstSearchTree.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkTree.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 5 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  vtkIdType v4 = g->AddVertex();\n  vtkIdType v5 = g->AddVertex();\n\n  // Create a graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v3);\n  g->AddEdge(v2, v4);\n  g->AddEdge(v4, v5);\n\n  vtkNew<vtkBoostBreadthFirstSearchTree> bfsTree;\n  bfsTree->SetOriginVertex(v5);\n  bfsTree->SetInput(g);\n  bfsTree->Update();\n\n  {\n    // Original graph\n    vtkNew<vtkGraphLayoutView> graphLayoutView;\n    graphLayoutView->AddRepresentationFromInput(g);\n    graphLayoutView->SetLayoutStrategyToTree();\n    graphLayoutView->ResetCamera();\n    graphLayoutView->Render();\n    graphLayoutView->GetInteractor()->Start();\n  }\n\n  {\n    // BFS tree\n    vtkNew<vtkGraphLayoutView> graphLayoutView;\n    graphLayoutView->SetLayoutStrategyToTree();\n    graphLayoutView->AddRepresentationFromInput(bfsTree->GetOutput());\n    graphLayoutView->ResetCamera();\n    graphLayoutView->Render();\n    graphLayoutView->GetInteractor()->Start();\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/BoostBreadthFirstSearchTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoostBreadthFirstSearchTree)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisBoostGraphAlgorithms\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoostBreadthFirstSearchTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoostBreadthFirstSearchTree MACOSX_BUNDLE BoostBreadthFirstSearchTree.cxx )\n  target_link_libraries(BoostBreadthFirstSearchTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoostBreadthFirstSearchTree\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/BoostBreadthFirstSearchTree/#download-and-build-boostbreadthfirstsearchtree","title":"Download and Build BoostBreadthFirstSearchTree","text":"

Click here to download BoostBreadthFirstSearchTree and its CMakeLists.txt file. Once the tarball BoostBreadthFirstSearchTree.tar has been downloaded and extracted,

cd BoostBreadthFirstSearchTree/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BoostBreadthFirstSearchTree\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/BreadthFirstDistance/","title":"BreadthFirstDistance","text":"

vtk-examples/Cxx/Graphs/BreadthFirstDistance

"},{"location":"Cxx/Graphs/BreadthFirstDistance/#description","title":"Description","text":"

This example shows how to get the distance from a vertex to the root vertex.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/BreadthFirstDistance/#code","title":"Code","text":"

BreadthFirstDistance.cxx

#include <vtkBoostBreadthFirstSearch.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkTree.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  vtkIdType v4 = g->AddVertex();\n\n  // Create a graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v3);\n  g->AddEdge(v2, v4);\n\n  vtkNew<vtkBoostBreadthFirstSearch> BFS;\n  BFS->SetOriginVertex(v1);\n  BFS->SetInput(g);\n  BFS->Update();\n\n  vtkIntArray* level = dynamic_cast<vtkIntArray*>(\n      BFS->GetOutput()->GetVertexData()->GetArray(\"BFS\"));\n  for (vtkIdType i = 0; i < level->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"id \" << i << \" : \" << level->GetValue(i) << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/BreadthFirstDistance/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BreadthFirstDistance)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisBoostGraphAlgorithms\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BreadthFirstDistance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BreadthFirstDistance MACOSX_BUNDLE BreadthFirstDistance.cxx )\n  target_link_libraries(BreadthFirstDistance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BreadthFirstDistance\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/BreadthFirstDistance/#download-and-build-breadthfirstdistance","title":"Download and Build BreadthFirstDistance","text":"

Click here to download BreadthFirstDistance and its CMakeLists.txt file. Once the tarball BreadthFirstDistance.tar has been downloaded and extracted,

cd BreadthFirstDistance/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BreadthFirstDistance\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/ColorEdges/","title":"ColorEdges","text":"

vtk-examples/Cxx/Graphs/ColorEdges

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/ColorEdges/#code","title":"Code","text":"

ColorEdges.cxx

#include <vtkCamera.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkViewTheme.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableDirectedGraph> graph;\n\n  // Create a graph.\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddVertex();\n  vtkIdType v3 = graph->AddVertex();\n  graph->AddEdge(v1, v2);\n  graph->AddEdge(v2, v3);\n\n  // Create the color array.\n  vtkNew<vtkIntArray> edgeColors;\n  edgeColors->SetNumberOfComponents(1);\n  edgeColors->SetName(\"Color\");\n\n  vtkNew<vtkLookupTable> lookupTable;\n  lookupTable->SetNumberOfTableValues(2);\n  lookupTable->SetTableValue(0, colors->GetColor4d(\"Red\").GetData());\n  lookupTable->SetTableValue(1, colors->GetColor4d(\"Lime\").GetData());\n  lookupTable->Build();\n\n  edgeColors->InsertNextValue(0);\n  edgeColors->InsertNextValue(1);\n\n  // Add the color array to the graph.\n  graph->GetEdgeData()->AddArray(edgeColors);\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(graph);\n  // Needs VTK::InfovisBoostGraphAlgorithms.\n  // graphLayoutView->SetLayoutStrategyToTree();\n  graphLayoutView->SetLayoutStrategy(\"Simple 2D\");\n\n  graphLayoutView->SetEdgeColorArrayName(\"Color\");\n  graphLayoutView->ColorEdgesOn();\n\n  vtkNew<vtkViewTheme> theme;\n  theme->SetCellLookupTable(lookupTable);\n\n  graphLayoutView->ApplyViewTheme(theme);\n  graphLayoutView->ResetCamera();\n  // graphLayoutView->GetRenderer()->SetBackground(\n  //    colors->GetColor3d(\"Navy\").GetData());\n  // graphLayoutView->GetRenderer()->SetBackground2(\n  //    colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderer()->GetActiveCamera()->Zoom(0.8);\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"ColorEdges\");\n  graphLayoutView->GetInteractor()->Initialize();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/ColorEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorEdges MACOSX_BUNDLE ColorEdges.cxx )\n  target_link_libraries(ColorEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/ColorEdges/#download-and-build-coloredges","title":"Download and Build ColorEdges","text":"

Click here to download ColorEdges and its CMakeLists.txt file. Once the tarball ColorEdges.tar has been downloaded and extracted,

cd ColorEdges/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorEdges\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/ColorVertexLabels/","title":"ColorVertexLabels","text":"

vtk-examples/Cxx/Graphs/ColorVertexLabels

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/ColorVertexLabels/#code","title":"Code","text":"

ColorVertexLabels.cxx

#include <vtkCamera.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a graph.\n  vtkNew<vtkMutableDirectedGraph> graph;\n\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddVertex();\n  graph->AddEdge(v1, v2);\n\n  // Create an array for the vertex labels.\n  vtkNew<vtkIntArray> vertexIDs;\n  vertexIDs->SetNumberOfComponents(1);\n  vertexIDs->SetName(\"VertexIDs\");\n\n  // Set the vertex labels\n  vertexIDs->InsertNextValue(0);\n  vertexIDs->InsertNextValue(1);\n\n  // Add the array to the graph.\n  graph->GetVertexData()->AddArray(vertexIDs);\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(graph);\n  graphLayoutView->SetVertexLabelVisibility(true);\n  dynamic_cast<vtkRenderedGraphRepresentation*>(\n      graphLayoutView->GetRepresentation())\n      ->GetVertexLabelTextProperty()\n      ->SetColor(colors->GetColor3d(\"Red\").GetData());\n  graphLayoutView->SetLayoutStrategyToSimple2D();\n  graphLayoutView->SetVertexLabelArrayName(\"VertexIDs\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetRenderer()->GetActiveCamera()->Zoom(0.8);\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"ColorVertexLabels\");\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/ColorVertexLabels/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorVertexLabels)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorVertexLabels: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorVertexLabels MACOSX_BUNDLE ColorVertexLabels.cxx )\n  target_link_libraries(ColorVertexLabels PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorVertexLabels\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/ColorVertexLabels/#download-and-build-colorvertexlabels","title":"Download and Build ColorVertexLabels","text":"

Click here to download ColorVertexLabels and its CMakeLists.txt file. Once the tarball ColorVertexLabels.tar has been downloaded and extracted,

cd ColorVertexLabels/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorVertexLabels\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/ColorVerticesLookupTable/","title":"ColorVerticesLookupTable","text":"

vtk-examples/Cxx/Graphs/ColorVerticesLookupTable

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/ColorVerticesLookupTable/#code","title":"Code","text":"

ColorVerticesLookupTable.cxx

#include <vtkCamera.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkViewTheme.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a graph\n  vtkNew<vtkMutableDirectedGraph> graph;\n\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddVertex();\n  vtkIdType v3 = graph->AddVertex();\n  graph->AddEdge(v1, v2);\n  graph->AddEdge(v2, v3);\n\n  // Manually set the position of the vertices\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(2, 0, 0);\n\n  graph->SetPoints(points);\n\n  // Create the color array\n  vtkNew<vtkIntArray> vertexColors;\n  vertexColors->SetNumberOfComponents(1);\n  vertexColors->SetName(\"Color\");\n\n  vtkNew<vtkLookupTable> lookupTable;\n  lookupTable->SetNumberOfTableValues(3);\n  lookupTable->SetTableValue(0, colors->GetColor4d(\"Red\").GetData());\n  lookupTable->SetTableValue(1, colors->GetColor4d(\"White\").GetData());\n  lookupTable->SetTableValue(2, colors->GetColor4d(\"Lime\").GetData());\n  lookupTable->Build();\n\n  vertexColors->InsertNextValue(0);\n  vertexColors->InsertNextValue(1);\n  vertexColors->InsertNextValue(2);\n\n  // Add the color array to the graph\n  graph->GetVertexData()->AddArray(vertexColors);\n\n  // Visualize\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(graph);\n  graphLayoutView->SetLayoutStrategyToPassThrough();\n  graphLayoutView->SetVertexColorArrayName(\"Color\");\n  graphLayoutView->ColorVerticesOn();\n\n  vtkNew<vtkViewTheme> theme;\n  theme->SetPointLookupTable(lookupTable);\n\n  graphLayoutView->ApplyViewTheme(theme);\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"ColorVerticesLookupTable\");\n  graphLayoutView->GetInteractor()->Initialize();\n  graphLayoutView->GetRenderer()->GetActiveCamera()->Zoom(0.8);\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/ColorVerticesLookupTable/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorVerticesLookupTable)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorVerticesLookupTable: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorVerticesLookupTable MACOSX_BUNDLE ColorVerticesLookupTable.cxx )\n  target_link_libraries(ColorVerticesLookupTable PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorVerticesLookupTable\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/ColorVerticesLookupTable/#download-and-build-colorverticeslookuptable","title":"Download and Build ColorVerticesLookupTable","text":"

Click here to download ColorVerticesLookupTable and its CMakeLists.txt file. Once the tarball ColorVerticesLookupTable.tar has been downloaded and extracted,

cd ColorVerticesLookupTable/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorVerticesLookupTable\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/ConnectedComponents/","title":"ConnectedComponents","text":"

vtk-examples/Cxx/Graphs/ConnectedComponents

"},{"location":"Cxx/Graphs/ConnectedComponents/#description","title":"Description","text":"

This example constructs a graph with 4 vertices and 2 edges. V1 and V2 are not connected to V3 or V4. We wish to obtain all of the connected components of the graph. The output of the example is a list of component IDs. All vertices with the same ID can be reached from any vertex with the same ID.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/ConnectedComponents/#code","title":"Code","text":"

ConnectedComponents.cxx

#include <vtkBoostConnectedComponents.h>\n#include <vtkDataArray.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraph.h>\n#include <vtkIntArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  vtkIdType v4 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v3, v4);\n\n  vtkNew<vtkBoostConnectedComponents> connectedComponents;\n  connectedComponents->SetInput(g);\n  connectedComponents->Update();\n\n  vtkGraph* outputGraph = connectedComponents->GetOutput();\n\n  vtkIntArray* components = dynamic_cast<vtkIntArray*>(\n      outputGraph->GetVertexData()->GetArray(\"component\"));\n\n  for (vtkIdType i = 0; i < components->GetNumberOfTuples(); i++)\n  {\n    int val = components->GetValue(i);\n    std::cout << val << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/ConnectedComponents/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConnectedComponents)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisBoostGraphAlgorithms\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConnectedComponents: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConnectedComponents MACOSX_BUNDLE ConnectedComponents.cxx )\n  target_link_libraries(ConnectedComponents PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConnectedComponents\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/ConnectedComponents/#download-and-build-connectedcomponents","title":"Download and Build ConnectedComponents","text":"

Click here to download ConnectedComponents and its CMakeLists.txt file. Once the tarball ConnectedComponents.tar has been downloaded and extracted,

cd ConnectedComponents/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConnectedComponents\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/ConstructGraph/","title":"ConstructGraph","text":"

vtk-examples/Cxx/Graphs/ConstructGraph

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Graphs/ConstructGraph/#description","title":"Description","text":"

This example shows how to construct a simple graph.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/ConstructGraph/#code","title":"Code","text":"

ConstructGraph.cxx

#include <vtkForceDirectedLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n\n  std::cout << \"Number of vertices: \" << g->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << g->GetNumberOfEdges() << std::endl;\n\n  g->AddEdge(v1, v2);\n\n  std::cout << \"Number of vertices: \" << g->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << g->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkForceDirectedLayoutStrategy> forceDirected;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  // If we create a layout object directly, just set the pointer through this\n  // method.\n  // graphLayoutView->SetLayoutStrategy(forceDirected);\n  graphLayoutView->SetLayoutStrategyToForceDirected();\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"ConstructGraph\");\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/ConstructGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConstructGraph)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConstructGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConstructGraph MACOSX_BUNDLE ConstructGraph.cxx )\n  target_link_libraries(ConstructGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConstructGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/ConstructGraph/#download-and-build-constructgraph","title":"Download and Build ConstructGraph","text":"

Click here to download ConstructGraph and its CMakeLists.txt file. Once the tarball ConstructGraph.tar has been downloaded and extracted,

cd ConstructGraph/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConstructGraph\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/ConstructTree/","title":"ConstructTree","text":"

vtk-examples/Cxx/Graphs/ConstructTree

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/ConstructTree/#code","title":"Code","text":"

ConstructTree.cxx

#include <vtkGraphLayoutView.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTree.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableDirectedGraph> graph;\n\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddChild(v1);\n  graph->AddChild(v1);\n  graph->AddChild(v2);\n\n  /*\n  //equivalent to:\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  vtkIdType v4 = g->AddVertex();\n\n  g->AddEdge ( v1, v2 );\n  g->AddEdge ( v1, v3 );\n  g->AddEdge ( v2, v4 );\n  */\n\n  vtkNew<vtkTree> tree;\n  bool success = tree->CheckedShallowCopy(graph);\n  std::cout << \"Success? \" << success << std::endl;\n\n  vtkNew<vtkGraphLayoutView> treeLayoutView;\n  treeLayoutView->AddRepresentationFromInput(tree);\n  treeLayoutView->SetLayoutStrategyToTree();\n  treeLayoutView->ResetCamera();\n  treeLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  treeLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  treeLayoutView->GetRenderWindow()->SetWindowName(\"ConstructTree\");\n  treeLayoutView->Render();\n  treeLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/ConstructTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConstructTree)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConstructTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConstructTree MACOSX_BUNDLE ConstructTree.cxx )\n  target_link_libraries(ConstructTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConstructTree\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/ConstructTree/#download-and-build-constructtree","title":"Download and Build ConstructTree","text":"

Click here to download ConstructTree and its CMakeLists.txt file. Once the tarball ConstructTree.tar has been downloaded and extracted,

cd ConstructTree/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConstructTree\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/CreateTree/","title":"CreateTree","text":"

vtk-examples/Cxx/Graphs/CreateTree

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Graphs/CreateTree/#description","title":"Description","text":"

We create the tree, and label the vertices and edges.

Info

This is an update of the original example found in vtk/Examples/Infovis/Cxx/CreateTree.cxx.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/CreateTree/#code","title":"Code","text":"

CreateTree.cxx

/*=========================================================================\n\n  Program:   Visualization Toolkit\n  Module:    CreateTree.cxx\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n//\n// This example creates a tree and labels the vertices and edges.\n//\n\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStringArray.h>\n#include <vtkTree.h>\n#include <vtkViewTheme.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableDirectedGraph> graph;\n  vtkIdType a = graph->AddVertex();\n  vtkIdType b = graph->AddChild(a);\n  vtkIdType c = graph->AddChild(a);\n  vtkIdType d = graph->AddChild(b);\n  vtkIdType e = graph->AddChild(c);\n  vtkIdType f = graph->AddChild(c);\n\n  vtkNew<vtkStringArray> vertexLabels;\n  vertexLabels->SetName(\"VertexLabel\");\n  vertexLabels->InsertValue(a, \"a\");\n  vertexLabels->InsertValue(b, \"b\");\n  vertexLabels->InsertValue(c, \"c\");\n  vertexLabels->InsertValue(d, \"d\");\n  vertexLabels->InsertValue(e, \"e\");\n  vertexLabels->InsertValue(f, \"f\");\n  graph->GetVertexData()->AddArray(vertexLabels);\n  vtkNew<vtkStringArray> edgeLabels;\n  edgeLabels->SetName(\"EdgeLabel\");\n  edgeLabels->InsertValue(graph->GetEdgeId(a, b), \"a -> b\");\n  edgeLabels->InsertValue(graph->GetEdgeId(a, c), \"a -> c\");\n  edgeLabels->InsertValue(graph->GetEdgeId(b, d), \"b -> d\");\n  edgeLabels->InsertValue(graph->GetEdgeId(c, e), \"c -> e\");\n  edgeLabels->InsertValue(graph->GetEdgeId(c, f), \"c -> f\");\n  graph->GetEdgeData()->AddArray(edgeLabels);\n\n  vtkNew<vtkTree> tree;\n  bool validTree = tree->CheckedShallowCopy(graph);\n  if (!validTree)\n  {\n    std::cout << \"Invalid tree\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkGraphLayoutView> view;\n  view->SetRepresentationFromInput(tree);\n  // Apply a theme to the views\n  vtkNew<vtkViewTheme> theme;\n  view->ApplyViewTheme(theme->CreateMellowTheme());\n  view->SetVertexColorArrayName(\"VertexDegree\");\n  view->SetColorVertices(true);\n  view->SetVertexLabelArrayName(\"VertexLabel\");\n  view->SetVertexLabelVisibility(true);\n  view->SetEdgeLabelArrayName(\"EdgeLabel\");\n  view->SetEdgeLabelVisibility(true);\n  view->SetLayoutStrategyToTree();\n\n  view->ResetCamera();\n  view->GetRenderWindow()->SetSize(600, 600);\n  view->GetRenderWindow()->SetWindowName(\"CreateTree\");\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/CreateTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CreateTree)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CreateTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CreateTree MACOSX_BUNDLE CreateTree.cxx )\n  target_link_libraries(CreateTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CreateTree\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/CreateTree/#download-and-build-createtree","title":"Download and Build CreateTree","text":"

Click here to download CreateTree and its CMakeLists.txt file. Once the tarball CreateTree.tar has been downloaded and extracted,

cd CreateTree/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CreateTree\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/DepthFirstSearchAnimation/","title":"DepthFirstSearchAnimation","text":"

vtk-examples/Cxx/Graphs/DepthFirstSearchAnimation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/DepthFirstSearchAnimation/#code","title":"Code","text":"

DepthFirstSearchAnimation.cxx

#include <vtkCommand.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkTree.h>\n#include <vtkTreeDFSIterator.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkViewTheme.h>\n\nclass vtkTimerCallback : public vtkCommand\n{\npublic:\n  static vtkTimerCallback* New()\n  {\n    vtkTimerCallback* cb = new vtkTimerCallback;\n    return cb;\n  }\n  virtual void Execute(vtkObject* vtkNotUsed(caller), unsigned long eventId,\n                       void* vtkNotUsed(callData))\n  {\n    if (eventId != vtkCommand::TimerEvent)\n    {\n      return;\n    }\n\n    if (this->dfs->HasNext())\n    {\n      vtkIdType nextVertex = this->dfs->Next();\n      std::cout << \"Next vertex: \" << nextVertex << std::endl;\n      dynamic_cast<vtkIntArray*>(this->Tree->GetVertexData()->GetArray(\"color\"))\n          ->SetValue(nextVertex, 10);\n      this->Tree->Modified();\n      this->GraphLayoutView->AddRepresentationFromInput(this->Tree);\n      this->GraphLayoutView->Render();\n    }\n  }\n\n  void SetDFS(vtkTreeDFSIterator* dfs)\n  {\n    this->dfs = dfs;\n  }\n  void SetTree(vtkTree* tree)\n  {\n    this->Tree = tree;\n  }\n  void SetGraphLayoutView(vtkGraphLayoutView* view)\n  {\n    this->GraphLayoutView = view;\n  }\n\nprivate:\n  vtkTreeDFSIterator* dfs = nullptr;\n  vtkTree* Tree = nullptr;\n  vtkGraphLayoutView* GraphLayoutView = nullptr;\n};\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableDirectedGraph> graph;\n\n  // Create a tree\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddChild(v1);\n  graph->AddChild(v1);\n  graph->AddChild(v2);\n\n  vtkNew<vtkTree> tree;\n  tree->CheckedShallowCopy(graph);\n\n  // Create the color array\n  vtkNew<vtkIntArray> vertexColors;\n  vertexColors->SetNumberOfComponents(1);\n  vertexColors->SetName(\"color\");\n\n  vtkNew<vtkLookupTable> lookupTable;\n\n  lookupTable->SetTableRange(0.0, 10.0);\n  lookupTable->Build();\n\n  for (vtkIdType i = 0; i < tree->GetNumberOfVertices(); i++)\n  {\n    vertexColors->InsertNextValue(0);\n  }\n\n  // Add the color array to the tree\n  tree->GetVertexData()->AddArray(vertexColors);\n\n  // Create a depth first search iterator\n  vtkNew<vtkTreeDFSIterator> dfs;\n  vtkIdType root = tree->GetRoot();\n  dfs->SetStartVertex(root);\n  dfs->SetTree(tree);\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(tree);\n  graphLayoutView->SetLayoutStrategyToTree();\n\n  graphLayoutView->SetVertexColorArrayName(\"color\");\n  graphLayoutView->ColorVerticesOn();\n\n  vtkNew<vtkViewTheme> theme;\n  theme->SetPointLookupTable(lookupTable);\n  theme->ScalePointLookupTableOff();\n\n  graphLayoutView->ApplyViewTheme(theme);\n  graphLayoutView->ResetCamera();\n  graphLayoutView->Render();\n\n  // Sign up to receive TimerEvent\n  vtkNew<vtkTimerCallback> cb;\n  cb->SetDFS(dfs);\n  cb->SetTree(tree);\n  cb->SetGraphLayoutView(graphLayoutView);\n\n  graphLayoutView->GetInteractor()->CreateRepeatingTimer(1000);\n  graphLayoutView->GetInteractor()->AddObserver(vtkCommand::TimerEvent, cb);\n\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/DepthFirstSearchAnimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DepthFirstSearchAnimation)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DepthFirstSearchAnimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DepthFirstSearchAnimation MACOSX_BUNDLE DepthFirstSearchAnimation.cxx )\n  target_link_libraries(DepthFirstSearchAnimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DepthFirstSearchAnimation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/DepthFirstSearchAnimation/#download-and-build-depthfirstsearchanimation","title":"Download and Build DepthFirstSearchAnimation","text":"

Click here to download DepthFirstSearchAnimation and its CMakeLists.txt file. Once the tarball DepthFirstSearchAnimation.tar has been downloaded and extracted,

cd DepthFirstSearchAnimation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DepthFirstSearchAnimation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/DepthFirstSearchIterator/","title":"DepthFirstSearchIterator","text":"

vtk-examples/Cxx/Graphs/DepthFirstSearchIterator

"},{"location":"Cxx/Graphs/DepthFirstSearchIterator/#description","title":"Description","text":"

This example traverses a tree in a depth first fashion.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/DepthFirstSearchIterator/#code","title":"Code","text":"

DepthFirstSearchIterator.cxx

#include <vtkBoostBreadthFirstSearch.h>\n#include <vtkBoostPrimMinimumSpanningTree.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkTree.h>\n#include <vtkTreeDFSIterator.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  // Create a fully connected graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v2, v3);\n  g->AddEdge(v1, v3);\n\n  // Create the edge weight array\n  vtkNew<vtkDoubleArray> weights;\n  weights->SetNumberOfComponents(1);\n  weights->SetName(\"Weights\");\n\n  // Set the edge weights\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(2.0);\n\n  // Add the edge weight array to the graph\n  g->GetEdgeData()->AddArray(weights);\n\n  // Output original graph info\n  std::cout << \"Original Graph\" << std::endl << \"----------\" << std::endl;\n  std::cout << \"Number of vertices: \" << g->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << g->GetNumberOfEdges() << std::endl;\n\n  // Setup the minimum spanning tree filter\n  vtkNew<vtkBoostPrimMinimumSpanningTree> minimumSpanningTreeFilter;\n  minimumSpanningTreeFilter->SetOriginVertex(v1);\n  minimumSpanningTreeFilter->SetInput(g);\n  minimumSpanningTreeFilter->SetEdgeWeightArrayName(\"Weights\");\n\n  // Compute the minimum spanning tree\n  minimumSpanningTreeFilter->Update();\n\n  // Get the output tree\n  vtkNew<vtkTree> minimumSpanningTree;\n  minimumSpanningTree->ShallowCopy(minimumSpanningTreeFilter->GetOutput());\n\n  // Output information about the minimum spanning tree\n  std::cout << std::endl;\n  std::cout << \"Minimum spanning tree\" << std::endl\n            << \"----------\" << std::endl;\n  std::cout << \"Number of vertices: \"\n            << minimumSpanningTree->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << minimumSpanningTree->GetNumberOfEdges()\n            << std::endl;\n\n  vtkIdType root = minimumSpanningTree->GetRoot();\n  std::cout << \"Root: \" << root << std::endl;\n\n  vtkNew<vtkTreeDFSIterator> dFS;\n  dFS->SetStartVertex(root);\n  dFS->SetTree(minimumSpanningTree);\n\n  // Traverse the tree in a depth first fashion\n  while (dFS->HasNext())\n  {\n    vtkIdType NextVertex = dFS->Next();\n    std::cout << \"Next vertex: \" << NextVertex\n              << \" level: \" << minimumSpanningTree->GetLevel(NextVertex)\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/DepthFirstSearchIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DepthFirstSearchIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisBoostGraphAlgorithms\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DepthFirstSearchIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DepthFirstSearchIterator MACOSX_BUNDLE DepthFirstSearchIterator.cxx )\n  target_link_libraries(DepthFirstSearchIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DepthFirstSearchIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/DepthFirstSearchIterator/#download-and-build-depthfirstsearchiterator","title":"Download and Build DepthFirstSearchIterator","text":"

Click here to download DepthFirstSearchIterator and its CMakeLists.txt file. Once the tarball DepthFirstSearchIterator.tar has been downloaded and extracted,

cd DepthFirstSearchIterator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DepthFirstSearchIterator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/DirectedGraphToMutableDirectedGraph/","title":"DirectedGraphToMutableDirectedGraph","text":"

vtk-examples/Cxx/Graphs/DirectedGraphToMutableDirectedGraph

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/DirectedGraphToMutableDirectedGraph/#code","title":"Code","text":"

DirectedGraphToMutableDirectedGraph.cxx

#include <vtkDirectedGraph.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n\nint main(int, char*[])\n{\n\n  // create a graph\n  vtkNew<vtkMutableDirectedGraph> mdg;\n\n  // add 4 vertices to the graph\n  vtkIdType v1 = mdg->AddVertex();\n  vtkIdType v2 = mdg->AddVertex();\n  vtkIdType v3 = mdg->AddVertex();\n  vtkIdType v4 = mdg->AddVertex();\n\n  // add 3 edges to the graph\n  mdg->AddEdge(v1, v2);\n  mdg->AddEdge(v1, v3);\n  mdg->AddEdge(v1, v4);\n\n  // create 4 points - one for each vertex\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 2.0);\n\n  // add the coordinates of the points to the graph\n  mdg->SetPoints(points);\n\n  std::cout << \"MDG: \" << std::endl;\n  std::cout << \"Type: \" << mdg->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << mdg->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << mdg->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkDirectedGraph> dg;\n  if (!dg->CheckedShallowCopy(mdg))\n  {\n    std::cerr << \"Could not convert graph to tree!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::cout << \"DG: \" << std::endl;\n  std::cout << \"Type: \" << dg->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << dg->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << dg->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkMutableDirectedGraph> mdg2;\n\n  if (!mdg2->CheckedShallowCopy(dg))\n  {\n    std::cerr << \"Could not convert graph to tree!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::cout << \"MDG2: \" << std::endl;\n  std::cout << \"Type: \" << mdg2->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << mdg2->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << mdg2->GetNumberOfEdges() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/DirectedGraphToMutableDirectedGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DirectedGraphToMutableDirectedGraph)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DirectedGraphToMutableDirectedGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DirectedGraphToMutableDirectedGraph MACOSX_BUNDLE DirectedGraphToMutableDirectedGraph.cxx )\n  target_link_libraries(DirectedGraphToMutableDirectedGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DirectedGraphToMutableDirectedGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/DirectedGraphToMutableDirectedGraph/#download-and-build-directedgraphtomutabledirectedgraph","title":"Download and Build DirectedGraphToMutableDirectedGraph","text":"

Click here to download DirectedGraphToMutableDirectedGraph and its CMakeLists.txt file. Once the tarball DirectedGraphToMutableDirectedGraph.tar has been downloaded and extracted,

cd DirectedGraphToMutableDirectedGraph/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DirectedGraphToMutableDirectedGraph\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/EdgeListIterator/","title":"EdgeListIterator","text":"

vtk-examples/Cxx/Graphs/EdgeListIterator

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/EdgeListIterator/#code","title":"Code","text":"

EdgeListIterator.cxx

#include <vtkEdgeListIterator.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create a graph\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v0, v1);\n  g->AddEdge(v1, v2);\n  g->AddEdge(v0, v2);\n\n  vtkNew<vtkEdgeListIterator> edgeListIterator;\n  g->GetEdges(edgeListIterator);\n\n  while (edgeListIterator->HasNext())\n  {\n    vtkEdgeType edge = edgeListIterator->Next();\n    std::cout << \"Edge: \" << edge.Id << \" is from \"\n              << \"Source: \" << edge.Source << \" to Target: \" << edge.Target\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/EdgeListIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EdgeListIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EdgeListIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EdgeListIterator MACOSX_BUNDLE EdgeListIterator.cxx )\n  target_link_libraries(EdgeListIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EdgeListIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/EdgeListIterator/#download-and-build-edgelistiterator","title":"Download and Build EdgeListIterator","text":"

Click here to download EdgeListIterator and its CMakeLists.txt file. Once the tarball EdgeListIterator.tar has been downloaded and extracted,

cd EdgeListIterator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./EdgeListIterator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/EdgeWeights/","title":"EdgeWeights","text":"

vtk-examples/Cxx/Graphs/EdgeWeights

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/EdgeWeights/#code","title":"Code","text":"

EdgeWeights.cxx

#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkForceDirectedLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  // Create a fully connected graph.\n  g->AddEdge(v1, v2);\n  g->AddEdge(v2, v3);\n  g->AddEdge(v1, v3);\n\n  // Create the edge weight array.\n  vtkNew<vtkDoubleArray> weights;\n  weights->SetNumberOfComponents(1);\n  weights->SetName(\"Weights\");\n\n  // Set the edge weights\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(2.0);\n\n  // Add the edge weight array to the graph.\n  g->GetEdgeData()->AddArray(weights);\n\n  std::cout << \"Number of Weights: \"\n            << dynamic_cast<vtkDoubleArray*>(\n                   g->GetEdgeData()->GetArray(\"Weights\"))\n                   ->GetNumberOfTuples()\n            << std::endl;\n\n  for (vtkIdType i = 0; i < weights->GetNumberOfTuples(); i++)\n  {\n    double w = weights->GetValue(i);\n    std::cout << \"Weight \" << i << \" : \" << w << std::endl;\n  }\n\n  vtkNew<vtkForceDirectedLayoutStrategy> forceDirected;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView->SetLayoutStrategy(forceDirected);\n  graphLayoutView->SetLayoutStrategyToForceDirected();\n  graphLayoutView->AddRepresentationFromInput(g);\n  graphLayoutView->SetEdgeLabelVisibility(true);\n  graphLayoutView->SetEdgeLabelArrayName(\"Weights\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"EdgeWeights\");\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/EdgeWeights/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EdgeWeights)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EdgeWeights: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EdgeWeights MACOSX_BUNDLE EdgeWeights.cxx )\n  target_link_libraries(EdgeWeights PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EdgeWeights\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/EdgeWeights/#download-and-build-edgeweights","title":"Download and Build EdgeWeights","text":"

Click here to download EdgeWeights and its CMakeLists.txt file. Once the tarball EdgeWeights.tar has been downloaded and extracted,

cd EdgeWeights/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./EdgeWeights\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/GraphToPolyData/","title":"GraphToPolyData","text":"

vtk-examples/Cxx/Graphs/GraphToPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Graphs/GraphToPolyData/#description","title":"Description","text":"

This example creates a simple graph and then converts it to a polydata for visualization using Paraview.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/GraphToPolyData/#code","title":"Code","text":"

GraphToPolyData.cxx

#include <vtkActor.h>\n#include <vtkGraphToPolyData.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a graph\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Add 4 vertices to the graph\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  vtkIdType v4 = g->AddVertex();\n\n  // Add 3 edges to the graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v3);\n  g->AddEdge(v1, v4);\n\n  // Create 4 points - one for each vertex\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 1.0);\n\n  // Add the coordinates of the points to the graph\n  g->SetPoints(points);\n\n  // Convert the graph to a polydata\n  vtkNew<vtkGraphToPolyData> graphToPolyData;\n  graphToPolyData->SetInputData(g);\n  graphToPolyData->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(graphToPolyData->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Green\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"GraphToPolyData\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/GraphToPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GraphToPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GraphToPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GraphToPolyData MACOSX_BUNDLE GraphToPolyData.cxx )\n  target_link_libraries(GraphToPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GraphToPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/GraphToPolyData/#download-and-build-graphtopolydata","title":"Download and Build GraphToPolyData","text":"

Click here to download GraphToPolyData and its CMakeLists.txt file. Once the tarball GraphToPolyData.tar has been downloaded and extracted,

cd GraphToPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GraphToPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/InEdgeIterator/","title":"InEdgeIterator","text":"

vtk-examples/Cxx/Graphs/InEdgeIterator

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/InEdgeIterator/#code","title":"Code","text":"

InEdgeIterator.cxx

#include <vtkInEdgeIterator.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n\nnamespace {\n\nvoid Undirected();\n\nvoid Directed();\n\n} // namespace\n\nint main(int, char*[])\n{\n  Undirected();\n  Directed();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid Undirected()\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create a graph\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v0, v1);\n  g->AddEdge(v1, v2);\n  g->AddEdge(v0, v2);\n\n  // Find all incoming edges connected to a vertex\n  vtkNew<vtkInEdgeIterator> it;\n  g->GetInEdges(0, it);\n\n  while (it->HasNext())\n  {\n    vtkInEdgeType edge = it->Next();\n    std::cout << \"Edge id: \" << edge.Id << \" Source: \" << edge.Source\n              << std::endl;\n  }\n}\n\nvoid Directed()\n{\n  vtkNew<vtkMutableDirectedGraph> g;\n\n  // Create a graph\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v0, v1);\n  g->AddEdge(v0, v2);\n\n  {\n    std::cout << \"Finding edges connected to vertex 0\" << std::endl;\n    vtkNew<vtkInEdgeIterator> it;\n    g->GetInEdges(0, it);\n\n    while (it->HasNext())\n    {\n      vtkInEdgeType edge = it->Next();\n      std::cout << \"Edge id: \" << edge.Id << \" \"\n                << \"Source: \" << edge.Source << std::endl;\n    }\n\n    std::cout << \"Nothing should be output, vertex 0 has no incoming edges!\"\n              << std::endl;\n  }\n\n  {\n    std::cout << \"Finding edges connected to vertex 1\" << std::endl;\n    vtkNew<vtkInEdgeIterator> it;\n    g->GetInEdges(1, it);\n\n    while (it->HasNext())\n    {\n      vtkInEdgeType edge = it->Next();\n      std::cout << \"Edge id: \" << edge.Id << \" \"\n                << \"Source: \" << edge.Source << std::endl;\n    }\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/Graphs/InEdgeIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InEdgeIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InEdgeIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InEdgeIterator MACOSX_BUNDLE InEdgeIterator.cxx )\n  target_link_libraries(InEdgeIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InEdgeIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/InEdgeIterator/#download-and-build-inedgeiterator","title":"Download and Build InEdgeIterator","text":"

Click here to download InEdgeIterator and its CMakeLists.txt file. Once the tarball InEdgeIterator.tar has been downloaded and extracted,

cd InEdgeIterator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./InEdgeIterator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/LabelVerticesAndEdges/","title":"LabelVerticesAndEdges","text":"

vtk-examples/Cxx/Graphs/LabelVerticesAndEdges

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Graphs/LabelVerticesAndEdges/#description","title":"Description","text":"

This example sets and displays labels of vertices and edges of a graph.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/LabelVerticesAndEdges/#code","title":"Code","text":"

LabelVerticesAndEdges.cxx

#include <vtkCircularLayoutStrategy.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  // Create a fully connected graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v2, v3);\n  g->AddEdge(v1, v3);\n\n  // Create the edge weight array\n  vtkNew<vtkDoubleArray> weights;\n  weights->SetNumberOfComponents(1);\n  weights->SetName(\"Weights\");\n\n  // Set the edge weights\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(2.0);\n\n  // Create an array for the vertex labels\n  vtkNew<vtkIntArray> vertexIDs;\n  vertexIDs->SetNumberOfComponents(1);\n  vertexIDs->SetName(\"VertexIDs\");\n\n  // Set the vertex labels\n  vertexIDs->InsertNextValue(0);\n  vertexIDs->InsertNextValue(1);\n  vertexIDs->InsertNextValue(2);\n\n  // Add the edge weight array to the graph\n  g->GetEdgeData()->AddArray(weights);\n  g->GetVertexData()->AddArray(vertexIDs);\n\n  vtkNew<vtkCircularLayoutStrategy> circularLayoutStrategy;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n\n  graphLayoutView->SetLayoutStrategy(circularLayoutStrategy);\n  graphLayoutView->SetVertexLabelVisibility(true);\n  graphLayoutView->SetEdgeLabelVisibility(true);\n  graphLayoutView->SetEdgeLabelArrayName(\"Weights\");     // default is \"labels\"\n  graphLayoutView->SetVertexLabelArrayName(\"VertexIDs\"); // default is \"labels\"\n  dynamic_cast<vtkRenderedGraphRepresentation*>(\n      graphLayoutView->GetRepresentation())\n      ->GetVertexLabelTextProperty()\n      ->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  dynamic_cast<vtkRenderedGraphRepresentation*>(\n      graphLayoutView->GetRepresentation())\n      ->GetEdgeLabelTextProperty()\n      ->SetColor(colors->GetColor3d(\"Lime\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"LabelVerticesAndEdges\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/LabelVerticesAndEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LabelVerticesAndEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LabelVerticesAndEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LabelVerticesAndEdges MACOSX_BUNDLE LabelVerticesAndEdges.cxx )\n  target_link_libraries(LabelVerticesAndEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LabelVerticesAndEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/LabelVerticesAndEdges/#download-and-build-labelverticesandedges","title":"Download and Build LabelVerticesAndEdges","text":"

Click here to download LabelVerticesAndEdges and its CMakeLists.txt file. Once the tarball LabelVerticesAndEdges.tar has been downloaded and extracted,

cd LabelVerticesAndEdges/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LabelVerticesAndEdges\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/MinimumSpanningTree/","title":"MinimumSpanningTree","text":"

vtk-examples/Cxx/Graphs/MinimumSpanningTree

"},{"location":"Cxx/Graphs/MinimumSpanningTree/#description","title":"Description","text":"

This example shows how to find the minimum spanning tree. The input graph is:

and the minimum spanning tree computed is :

You must have compiled VTK with VTK_USE_BOOST=ON to use this functionality. You must also link to vtkInfovis.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/MinimumSpanningTree/#code","title":"Code","text":"

MinimumSpanningTree.cxx

#include <vtkBoostPrimMinimumSpanningTree.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkTree.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  // Create a fully connected graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v2, v3);\n  g->AddEdge(v1, v3);\n\n  // Create the edge weight array\n  vtkNew<vtkDoubleArray> weights;\n  weights->SetNumberOfComponents(1);\n  weights->SetName(\"Weights\");\n\n  // Set the edge weights\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(2.0);\n\n  // Add the edge weight array to the graph\n  g->GetEdgeData()->AddArray(weights);\n\n  // Output original graph info\n  std::cout << \"Number of vertices: \" << g->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << g->GetNumberOfEdges() << std::endl;\n  g->Dump();\n\n  // Setup the minimum spanning tree filter\n  vtkNew<vtkBoostPrimMinimumSpanningTree> minimumSpanningTreeFilter;\n  minimumSpanningTreeFilter->SetOriginVertex(v1);\n  minimumSpanningTreeFilter->SetInput(g);\n  minimumSpanningTreeFilter->SetEdgeWeightArrayName(\"Weights\");\n\n  // Compute the minimum spanning tree\n  minimumSpanningTreeFilter->Update();\n\n  // Get the output tree\n  vtkSmartPointer<vtkTree> minimumSpanningTree;\n  minimumSpanningTree->ShallowCopy(minimumSpanningTreeFilter->GetOutput());\n\n  // Output information about the minimum spanning tree\n  std::cout << \"Number of vertices: \"\n            << minimumSpanningTree->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << minimumSpanningTree->GetNumberOfEdges()\n            << std::endl;\n  minimumSpanningTree->Dump();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/MinimumSpanningTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MinimumSpanningTree)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisBoostGraphAlgorithms\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MinimumSpanningTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MinimumSpanningTree MACOSX_BUNDLE MinimumSpanningTree.cxx )\n  target_link_libraries(MinimumSpanningTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MinimumSpanningTree\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/MinimumSpanningTree/#download-and-build-minimumspanningtree","title":"Download and Build MinimumSpanningTree","text":"

Click here to download MinimumSpanningTree and its CMakeLists.txt file. Once the tarball MinimumSpanningTree.tar has been downloaded and extracted,

cd MinimumSpanningTree/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MinimumSpanningTree\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/MutableDirectedGraphToDirectedGraph/","title":"MutableDirectedGraphToDirectedGraph","text":"

vtk-examples/Cxx/Graphs/MutableDirectedGraphToDirectedGraph

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/MutableDirectedGraphToDirectedGraph/#code","title":"Code","text":"

MutableDirectedGraphToDirectedGraph.cxx

#include <vtkDirectedGraph.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n\nint main(int, char*[])\n{\n\n  // create a graph\n  vtkNew<vtkMutableDirectedGraph> mdg;\n\n  // add 4 vertices to the graph\n  vtkIdType v1 = mdg->AddVertex();\n  vtkIdType v2 = mdg->AddVertex();\n  vtkIdType v3 = mdg->AddVertex();\n  vtkIdType v4 = mdg->AddVertex();\n\n  // add 3 edges to the graph\n  mdg->AddEdge(v1, v2);\n  mdg->AddEdge(v1, v3);\n  mdg->AddEdge(v1, v4);\n\n  // create 4 points - one for each vertex\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 2.0);\n\n  // add the coordinates of the points to the graph\n  mdg->SetPoints(points);\n\n  std::cout << \"MDG: \" << std::endl;\n  std::cout << \"Type: \" << mdg->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << mdg->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << mdg->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkDirectedGraph> dg;\n  if (!dg->CheckedShallowCopy(mdg))\n  {\n    std::cerr << \"Could not convert graph to tree!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::cout << \"DG: \" << std::endl;\n  std::cout << \"Type: \" << dg->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << dg->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << dg->GetNumberOfEdges() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/MutableDirectedGraphToDirectedGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MutableDirectedGraphToDirectedGraph)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MutableDirectedGraphToDirectedGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MutableDirectedGraphToDirectedGraph MACOSX_BUNDLE MutableDirectedGraphToDirectedGraph.cxx )\n  target_link_libraries(MutableDirectedGraphToDirectedGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MutableDirectedGraphToDirectedGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/MutableDirectedGraphToDirectedGraph/#download-and-build-mutabledirectedgraphtodirectedgraph","title":"Download and Build MutableDirectedGraphToDirectedGraph","text":"

Click here to download MutableDirectedGraphToDirectedGraph and its CMakeLists.txt file. Once the tarball MutableDirectedGraphToDirectedGraph.tar has been downloaded and extracted,

cd MutableDirectedGraphToDirectedGraph/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MutableDirectedGraphToDirectedGraph\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/NOVCAGraph/","title":"NOVCAGraph","text":"

vtk-examples/Cxx/Graphs/NOVCAGraph

"},{"location":"Cxx/Graphs/NOVCAGraph/#description","title":"Description","text":"
  • This example shows how to construct a graph to visualize it in ParaView/VisIt using the VTK output file testVertex.vtu.

  • Contributed by Sanjaya Gajurel, Case Western Reserve University

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/NOVCAGraph/#code","title":"Code","text":"

NOVCAGraph.cxx

#include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyLine.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  // Create 8 Vertices.\n  vtkNew<vtkPoints> points;\n\n  for (unsigned int i = 0; i < 2; ++i)\n    for (unsigned int j = 0; j < 4; ++j) points->InsertNextPoint(i, j, 0);\n\n  // Create Edges\n  vtkNew<vtkPolyLine> line;\n  line->GetPointIds()->SetNumberOfIds(8);\n  for (unsigned int i = 0; i < 8; ++i) line->GetPointIds()->SetId(i, i);\n\n  vtkNew<vtkCellArray> cellArray;\n  cellArray->InsertNextCell(line);\n\n  // Create a Graph with Vertices and Edges.\n  vtkNew<vtkUnstructuredGrid> grid;\n  grid->SetPoints(points);\n  grid->SetCells(VTK_POLY_LINE, cellArray);\n\n  // Write the file\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetFileName(\"vertex.vtu\");\n  writer->SetInputData(grid);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/NOVCAGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NOVCAGraph)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NOVCAGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NOVCAGraph MACOSX_BUNDLE NOVCAGraph.cxx )\n  target_link_libraries(NOVCAGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NOVCAGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/NOVCAGraph/#download-and-build-novcagraph","title":"Download and Build NOVCAGraph","text":"

Click here to download NOVCAGraph and its CMakeLists.txt file. Once the tarball NOVCAGraph.tar has been downloaded and extracted,

cd NOVCAGraph/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./NOVCAGraph\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/OutEdgeIterator/","title":"OutEdgeIterator","text":"

vtk-examples/Cxx/Graphs/OutEdgeIterator

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/OutEdgeIterator/#code","title":"Code","text":"

OutEdgeIterator.cxx

#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkOutEdgeIterator.h>\n\nnamespace {\n\nvoid Undirected();\n\nvoid Directed();\n\n} // namespace\n\nint main(int, char*[])\n{\n  Undirected();\n  Directed();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid Undirected()\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create a graph\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v0, v1);\n  g->AddEdge(v1, v2);\n  g->AddEdge(v0, v2);\n\n  // Find all outgoing edges connected to a vertex\n  vtkNew<vtkOutEdgeIterator> it;\n  g->GetOutEdges(0, it); // Get the edges connected to vertex 0\n\n  while (it->HasNext())\n  {\n    vtkOutEdgeType edge = it->Next();\n    std::cout << \"Edge id: \" << edge.Id << \" Target: \" << edge.Target\n              << std::endl;\n  }\n}\n\nvoid Directed()\n{\n  vtkNew<vtkMutableDirectedGraph> g;\n\n  // Create a graph\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v0);\n  g->AddEdge(v2, v0);\n\n  {\n    std::cout << \"Finding edges connected to vertex 0\" << std::endl;\n    vtkNew<vtkOutEdgeIterator> it;\n    g->GetOutEdges(0, it);\n\n    while (it->HasNext())\n    {\n      vtkOutEdgeType edge = it->Next();\n      std::cout << \"Edge id: \" << edge.Id << \" Target: \" << edge.Target\n                << std::endl;\n    }\n\n    std::cout << \"Nothing should be output, vertex 0 has no outgoing edges!\"\n              << std::endl;\n  }\n\n  {\n    std::cout << \"Finding edges connected to vertex 1\" << std::endl;\n    vtkNew<vtkOutEdgeIterator> it;\n    g->GetOutEdges(1, it);\n\n    while (it->HasNext())\n    {\n      vtkOutEdgeType edge = it->Next();\n      std::cout << \"Edge id: \" << edge.Id << \" Target: \" << edge.Target\n                << std::endl;\n    }\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/Graphs/OutEdgeIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OutEdgeIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OutEdgeIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OutEdgeIterator MACOSX_BUNDLE OutEdgeIterator.cxx )\n  target_link_libraries(OutEdgeIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OutEdgeIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/OutEdgeIterator/#download-and-build-outedgeiterator","title":"Download and Build OutEdgeIterator","text":"

Click here to download OutEdgeIterator and its CMakeLists.txt file. Once the tarball OutEdgeIterator.tar has been downloaded and extracted,

cd OutEdgeIterator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OutEdgeIterator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/RandomGraphSource/","title":"RandomGraphSource","text":"

vtk-examples/Cxx/Graphs/RandomGraphSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/RandomGraphSource/#code","title":"Code","text":"

RandomGraphSource.cxx

#include <vtkForceDirectedLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRandomGraphSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRandomGraphSource> randomGraphSource;\n  randomGraphSource->SetNumberOfVertices(5);\n  randomGraphSource->SetNumberOfEdges(4);\n  // This ensures repeatable results for testing. Turn this off for real use.\n  randomGraphSource->SetSeed(123);\n  randomGraphSource->Update();\n\n  vtkNew<vtkForceDirectedLayoutStrategy> forceDirected;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(randomGraphSource->GetOutput());\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView->SetLayoutStrategy(forceDirected);\n  graphLayoutView->SetLayoutStrategyToForceDirected();\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"RandomGraphSource\");\n  graphLayoutView->Render();\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/RandomGraphSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RandomGraphSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InfovisCore\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RandomGraphSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RandomGraphSource MACOSX_BUNDLE RandomGraphSource.cxx )\n  target_link_libraries(RandomGraphSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RandomGraphSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/RandomGraphSource/#download-and-build-randomgraphsource","title":"Download and Build RandomGraphSource","text":"

Click here to download RandomGraphSource and its CMakeLists.txt file. Once the tarball RandomGraphSource.tar has been downloaded and extracted,

cd RandomGraphSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RandomGraphSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/RemoveIsolatedVertices/","title":"RemoveIsolatedVertices","text":"

vtk-examples/Cxx/Graphs/RemoveIsolatedVertices

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/RemoveIsolatedVertices/#code","title":"Code","text":"

RemoveIsolatedVertices.cxx

#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkRemoveIsolatedVertices.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  g->AddVertex();\n\n  g->AddEdge(v1, v2);\n\n  std::cout << \"Graph has \" << g->GetNumberOfVertices() << \" vertices and \"\n            << g->GetNumberOfEdges() << \" edge before.\" << std::endl;\n\n  vtkNew<vtkRemoveIsolatedVertices> filter;\n  filter->SetInputData(g);\n  filter->Update();\n\n  std::cout << \"Graph has \" << filter->GetOutput()->GetNumberOfVertices()\n            << \" vertices and \" << filter->GetOutput()->GetNumberOfEdges()\n            << \" edge after.\" << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/RemoveIsolatedVertices/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RemoveIsolatedVertices)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RemoveIsolatedVertices: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RemoveIsolatedVertices MACOSX_BUNDLE RemoveIsolatedVertices.cxx )\n  target_link_libraries(RemoveIsolatedVertices PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RemoveIsolatedVertices\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/RemoveIsolatedVertices/#download-and-build-removeisolatedvertices","title":"Download and Build RemoveIsolatedVertices","text":"

Click here to download RemoveIsolatedVertices and its CMakeLists.txt file. Once the tarball RemoveIsolatedVertices.tar has been downloaded and extracted,

cd RemoveIsolatedVertices/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RemoveIsolatedVertices\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/ScaleVertices/","title":"ScaleVertices","text":"

vtk-examples/Cxx/Graphs/ScaleVertices

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Graphs/ScaleVertices/#description","title":"Description","text":"

Scale the vertices based on a data array.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/ScaleVertices/#code","title":"Code","text":"

ScaleVertices.cxx

#include <vtkDataSetAttributes.h>\n#include <vtkFloatArray.h>\n#include <vtkForceDirectedLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkGraphToGlyphs.h>\n#include <vtkLookupTable.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n#include <vtkViewTheme.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v2);\n\n  vtkNew<vtkFloatArray> scales;\n  scales->SetNumberOfComponents(1);\n  scales->SetName(\"Scales\");\n  scales->InsertNextValue(2.0);\n  scales->InsertNextValue(5.0);\n\n  // Add the scale array to the graph\n  g->GetVertexData()->AddArray(scales);\n\n  // Create the color array\n  vtkNew<vtkIntArray> vertexColors;\n  vertexColors->SetNumberOfComponents(1);\n  vertexColors->SetName(\"Color\");\n\n  vtkNew<vtkLookupTable> lookupTable;\n  lookupTable->SetNumberOfTableValues(2);\n  lookupTable->SetTableValue(0, colors->GetColor4d(\"Yellow\").GetData());\n  lookupTable->SetTableValue(1, colors->GetColor4d(\"Lime\").GetData());\n  lookupTable->Build();\n\n  vertexColors->InsertNextValue(0);\n  vertexColors->InsertNextValue(1);\n\n  // Add the color array to the graph\n  g->GetVertexData()->AddArray(vertexColors);\n\n  // Visualize\n\n  vtkNew<vtkViewTheme> theme;\n  theme->SetPointLookupTable(lookupTable);\n\n  vtkNew<vtkForceDirectedLayoutStrategy> forceDirected;\n\n  vtkNew<vtkGraphLayoutView> layoutView;\n  layoutView->AddRepresentationFromInput(g);\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView->SetLayoutStrategy(forceDirected);\n  layoutView->SetLayoutStrategyToForceDirected();\n  layoutView->ApplyViewTheme(theme);\n  layoutView->ScaledGlyphsOn();\n  layoutView->SetScalingArrayName(\"Scales\");\n  layoutView->SetVertexColorArrayName(\"Color\");\n  layoutView->ColorVerticesOn();\n  dynamic_cast<vtkRenderedGraphRepresentation*>(layoutView->GetRepresentation())\n      ->SetGlyphType(vtkGraphToGlyphs::CIRCLE);\n  layoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  layoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  layoutView->GetRenderWindow()->SetWindowName(\"ScaleVertices\");\n  layoutView->Render();\n  layoutView->ResetCamera();\n  layoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/ScaleVertices/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScaleVertices)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScaleVertices: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScaleVertices MACOSX_BUNDLE ScaleVertices.cxx )\n  target_link_libraries(ScaleVertices PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScaleVertices\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/ScaleVertices/#download-and-build-scalevertices","title":"Download and Build ScaleVertices","text":"

Click here to download ScaleVertices and its CMakeLists.txt file. Once the tarball ScaleVertices.tar has been downloaded and extracted,

cd ScaleVertices/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ScaleVertices\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/SelectedVerticesAndEdges/","title":"SelectedVerticesAndEdges","text":"

vtk-examples/Cxx/Graphs/SelectedVerticesAndEdges

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Graphs/SelectedVerticesAndEdges/#description","title":"Description","text":"
  • Thanks to Eric Monson

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/SelectedVerticesAndEdges/#code","title":"Code","text":"

SelectedVerticesAndEdges.cxx

#include <vtkAnnotationLink.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInteractorStyleRubberBand2D.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n\nnamespace {\nclass RubberBandStyle : public vtkInteractorStyleRubberBand2D\n{\npublic:\n  static RubberBandStyle* New();\n  vtkTypeMacro(RubberBandStyle, vtkInteractorStyleRubberBand2D);\n\n  virtual void OnLeftButtonUp() override\n  {\n    // Forward events\n    vtkInteractorStyleRubberBand2D::OnLeftButtonUp();\n\n    vtkSelection* selection = this->View->GetRepresentation()\n                                  ->GetAnnotationLink()\n                                  ->GetCurrentSelection();\n    vtkSelectionNode* vertices;\n    vtkSelectionNode* edges;\n    if (selection->GetNode(0)->GetFieldType() == vtkSelectionNode::VERTEX)\n    {\n      vertices = selection->GetNode(0);\n    }\n    else if (selection->GetNode(0)->GetFieldType() == vtkSelectionNode::EDGE)\n    {\n      edges = selection->GetNode(0);\n    }\n\n    if (selection->GetNode(1)->GetFieldType() == vtkSelectionNode::VERTEX)\n    {\n      vertices = selection->GetNode(1);\n    }\n    else if (selection->GetNode(1)->GetFieldType() == vtkSelectionNode::EDGE)\n    {\n      edges = selection->GetNode(1);\n    }\n\n    vtkIdTypeArray* vertexList =\n        dynamic_cast<vtkIdTypeArray*>(vertices->GetSelectionList());\n    std::cout << \"There are \" << vertexList->GetNumberOfTuples()\n              << \" vertices selected.\" << std::endl;\n\n    if (vertexList->GetNumberOfTuples() > 0)\n    {\n      std::cout << \"Vertex Ids: \";\n    }\n    for (vtkIdType i = 0; i < vertexList->GetNumberOfTuples(); i++)\n    {\n      std::cout << vertexList->GetValue(i) << \" \";\n    }\n\n    std::cout << std::endl;\n    vtkIdTypeArray* edgeList =\n        dynamic_cast<vtkIdTypeArray*>(edges->GetSelectionList());\n    std::cout << \"There are \" << edgeList->GetNumberOfTuples()\n              << \" edges selected.\" << std::endl;\n    if (edgeList->GetNumberOfTuples() > 0)\n    {\n      std::cout << \"Edge Ids: \";\n    }\n\n    for (vtkIdType i = 0; i < edgeList->GetNumberOfTuples(); i++)\n    {\n      std::cout << edgeList->GetValue(i) << \" \";\n    }\n    std::cout << std::endl;\n  }\n\n  vtkGraphLayoutView* View;\n};\nvtkStandardNewMacro(RubberBandStyle);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v2);\n\n  vtkNew<vtkGraphLayoutView> view;\n  view->AddRepresentationFromInput(g);\n  view->SetLayoutStrategy(\"Simple 2D\");\n\n  vtkNew<RubberBandStyle> style;\n  style->View = view;\n  view->SetInteractorStyle(style);\n\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Navy\").GetData());\n  view->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"SelectedVerticesAndEdges\");\n  view->ResetCamera();\n  view->Render();\n\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/SelectedVerticesAndEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectedVerticesAndEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectedVerticesAndEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectedVerticesAndEdges MACOSX_BUNDLE SelectedVerticesAndEdges.cxx )\n  target_link_libraries(SelectedVerticesAndEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectedVerticesAndEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/SelectedVerticesAndEdges/#download-and-build-selectedverticesandedges","title":"Download and Build SelectedVerticesAndEdges","text":"

Click here to download SelectedVerticesAndEdges and its CMakeLists.txt file. Once the tarball SelectedVerticesAndEdges.tar has been downloaded and extracted,

cd SelectedVerticesAndEdges/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SelectedVerticesAndEdges\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/SelectedVerticesAndEdgesObserver/","title":"SelectedVerticesAndEdgesObserver","text":"

vtk-examples/Cxx/Graphs/SelectedVerticesAndEdgesObserver

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Graphs/SelectedVerticesAndEdgesObserver/#description","title":"Description","text":"
  • Thanks to Eric Monson

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/SelectedVerticesAndEdgesObserver/#code","title":"Code","text":"

SelectedVerticesAndEdgesObserver.cxx

#include <vtkAnnotationLink.h>\n#include <vtkCallbackCommand.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIdTypeArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n\nnamespace {\n\nvoid SelectionCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                               void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v2);\n\n  vtkNew<vtkCallbackCommand> selectionCallback;\n  selectionCallback->SetCallback(SelectionCallbackFunction);\n\n  vtkNew<vtkGraphLayoutView> view;\n  view->AddRepresentationFromInput(g);\n  view->SetLayoutStrategy(\"Simple 2D\");\n  view->GetRepresentation()->GetAnnotationLink()->AddObserver(\n      \"AnnotationChangedEvent\", selectionCallback);\n\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Navy\").GetData());\n  view->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"SelectedVerticesAndEdges\");\n  view->ResetCamera();\n  view->Render();\n\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid SelectionCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                               void* clientData, void* callData)\n{\n\n  vtkAnnotationLink* annotationLink = static_cast<vtkAnnotationLink*>(caller);\n\n  vtkSelection* selection = annotationLink->GetCurrentSelection();\n  vtkSelectionNode* vertices;\n  vtkSelectionNode* edges;\n  if (selection->GetNode(0)->GetFieldType() == vtkSelectionNode::VERTEX)\n  {\n    vertices = selection->GetNode(0);\n  }\n  else if (selection->GetNode(0)->GetFieldType() == vtkSelectionNode::EDGE)\n  {\n    edges = selection->GetNode(0);\n  }\n\n  if (selection->GetNode(1)->GetFieldType() == vtkSelectionNode::VERTEX)\n  {\n    vertices = selection->GetNode(1);\n  }\n  else if (selection->GetNode(1)->GetFieldType() == vtkSelectionNode::EDGE)\n  {\n    edges = selection->GetNode(1);\n  }\n\n  vtkIdTypeArray* vertexList =\n      dynamic_cast<vtkIdTypeArray*>(vertices->GetSelectionList());\n  std::cout << \"There are \" << vertexList->GetNumberOfTuples()\n            << \" vertices selected.\" << std::endl;\n\n  if (vertexList->GetNumberOfTuples() > 0)\n  {\n    std::cout << \"Vertex Ids: \";\n  }\n  for (vtkIdType i = 0; i < vertexList->GetNumberOfTuples(); i++)\n  {\n    std::cout << vertexList->GetValue(i) << \" \";\n  }\n\n  std::cout << std::endl;\n  vtkIdTypeArray* edgeList =\n      dynamic_cast<vtkIdTypeArray*>(edges->GetSelectionList());\n  std::cout << \"There are \" << edgeList->GetNumberOfTuples()\n            << \" edges selected.\" << std::endl;\n  if (edgeList->GetNumberOfTuples() > 0)\n  {\n    std::cout << \"Edge Ids: \";\n  }\n\n  for (vtkIdType i = 0; i < edgeList->GetNumberOfTuples(); i++)\n  {\n    std::cout << edgeList->GetValue(i) << \" \";\n  }\n  std::cout << std::endl;\n}\n\n} // namespace\n
"},{"location":"Cxx/Graphs/SelectedVerticesAndEdgesObserver/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectedVerticesAndEdgesObserver)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectedVerticesAndEdgesObserver: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectedVerticesAndEdgesObserver MACOSX_BUNDLE SelectedVerticesAndEdgesObserver.cxx )\n  target_link_libraries(SelectedVerticesAndEdgesObserver PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectedVerticesAndEdgesObserver\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/SelectedVerticesAndEdgesObserver/#download-and-build-selectedverticesandedgesobserver","title":"Download and Build SelectedVerticesAndEdgesObserver","text":"

Click here to download SelectedVerticesAndEdgesObserver and its CMakeLists.txt file. Once the tarball SelectedVerticesAndEdgesObserver.tar has been downloaded and extracted,

cd SelectedVerticesAndEdgesObserver/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SelectedVerticesAndEdgesObserver\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/ShortestPath/","title":"ShortestPath","text":"

vtk-examples/Cxx/Graphs/ShortestPath

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Graphs/ShortestPath/#description","title":"Description","text":"

Currently, the only way to find the shortest path on a graph is to convert the graph to a mesh (using vtkGraphToPolyData) and then use the shortest path on a mesh functionality of vtkDijkstraGraphGeodesicPath.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/ShortestPath/#code","title":"Code","text":"

ShortestPath.cxx

#include <vtkActor.h>\n#include <vtkDijkstraGraphGeodesicPath.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkGraphToPolyData.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n/*\n   O v0\n  /|\\\n / |5\\\nv1-v2-v3\n  1  1\n\n  Shortest path between v0 and v2 should be 5\n*/\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableDirectedGraph> graph;\n  vtkIdType v0 = graph->AddVertex();\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddVertex();\n  vtkIdType v3 = graph->AddVertex();\n\n  graph->AddEdge(v0, v1);\n  graph->AddEdge(v0, v2);\n  graph->AddEdge(v0, v3);\n  graph->AddEdge(v1, v2);\n  graph->AddEdge(v2, v3);\n\n  // Associate physical locations with the vertices\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(-1.0, -5.0, 0.0);\n  points->InsertNextPoint(0.0, -5.0, 0.0);\n  points->InsertNextPoint(1.0, -5.0, 0.0);\n\n  graph->SetPoints(points);\n\n  // Convert the graph to a polydata\n  vtkNew<vtkGraphToPolyData> graphToPolyData;\n  graphToPolyData->SetInputData(graph);\n  graphToPolyData->Update();\n\n  vtkNew<vtkDijkstraGraphGeodesicPath> dijkstra;\n  dijkstra->SetInputConnection(graphToPolyData->GetOutputPort());\n  dijkstra->SetStartVertex(0);\n  dijkstra->SetEndVertex(2);\n  dijkstra->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> pathMapper;\n  pathMapper->SetInputConnection(dijkstra->GetOutputPort());\n\n  vtkNew<vtkActor> pathActor;\n  pathActor->SetMapper(pathMapper);\n  pathActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  pathActor->GetProperty()->SetLineWidth(4);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(graphToPolyData->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  pathActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(pathActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"ForestGreen\").GetData());\n  renderer->GradientBackgroundOn();\n  renderWindow->SetWindowName(\"ShortestPath\");\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/ShortestPath/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShortestPath)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShortestPath: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShortestPath MACOSX_BUNDLE ShortestPath.cxx )\n  target_link_libraries(ShortestPath PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShortestPath\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/ShortestPath/#download-and-build-shortestpath","title":"Download and Build ShortestPath","text":"

Click here to download ShortestPath and its CMakeLists.txt file. Once the tarball ShortestPath.tar has been downloaded and extracted,

cd ShortestPath/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ShortestPath\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/SideBySideGraphs/","title":"SideBySideGraphs","text":"

vtk-examples/Cxx/Graphs/SideBySideGraphs

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/SideBySideGraphs/#code","title":"Code","text":"

SideBySideGraphs.cxx

#include <vtkDataSetAttributes.h>\n#include <vtkForceDirectedLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkGraphToPolyData.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the first graph\n  vtkNew<vtkMutableUndirectedGraph> g0;\n  {\n    vtkIdType v1 = g0->AddVertex();\n    vtkIdType v2 = g0->AddVertex();\n    vtkIdType v3 = g0->AddVertex();\n\n    g0->AddEdge(v1, v2);\n    g0->AddEdge(v2, v3);\n    g0->AddEdge(v1, v3);\n\n    // Create points\n    vtkNew<vtkPoints> points;\n    points->InsertNextPoint(0.0, 0.0, 0.0);\n    points->InsertNextPoint(1.0, 0.0, 0.0);\n    points->InsertNextPoint(0.0, 1.0, 0.0);\n\n    // Add the coordinates of the points to the graph\n    g0->SetPoints(points);\n  }\n\n  // Create the second graph\n  vtkNew<vtkMutableUndirectedGraph> g1;\n\n  vtkIdType v1 = g1->AddVertex();\n  vtkIdType v2 = g1->AddVertex();\n\n  g1->AddEdge(v1, v2);\n\n  // Create points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n\n  // Add the coordinates of the points to the graph\n  g1->SetPoints(points);\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"SideBySideGraphs\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkForceDirectedLayoutStrategy> forceDirected;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView0;\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView0->SetLayoutStrategy(forceDirected);\n  graphLayoutView0->SetLayoutStrategyToForceDirected();\n  graphLayoutView0->SetRenderWindow(renderWindow);\n  graphLayoutView0->SetInteractor(renderWindowInteractor);\n  graphLayoutView0->GetRenderer()->SetViewport(leftViewport);\n  graphLayoutView0->AddRepresentationFromInput(g0);\n  graphLayoutView0->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView0->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView0->Render();\n  graphLayoutView0->ResetCamera();\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView1;\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView1->SetLayoutStrategy(forceDirected);\n  graphLayoutView1->SetLayoutStrategyToForceDirected();\n  graphLayoutView1->SetRenderWindow(renderWindow);\n  graphLayoutView1->SetInteractor(renderWindowInteractor);\n  graphLayoutView1->GetRenderer()->SetViewport(rightViewport);\n  graphLayoutView1->AddRepresentationFromInput(g1);\n  graphLayoutView1->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkGreen\").GetData());\n  graphLayoutView1->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"ForestGreen\").GetData());\n  graphLayoutView1->Render();\n  graphLayoutView1->ResetCamera();\n\n  // graphLayoutView0->GetInteractor()->Start();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/SideBySideGraphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SideBySideGraphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SideBySideGraphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SideBySideGraphs MACOSX_BUNDLE SideBySideGraphs.cxx )\n  target_link_libraries(SideBySideGraphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SideBySideGraphs\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/SideBySideGraphs/#download-and-build-sidebysidegraphs","title":"Download and Build SideBySideGraphs","text":"

Click here to download SideBySideGraphs and its CMakeLists.txt file. Once the tarball SideBySideGraphs.tar has been downloaded and extracted,

cd SideBySideGraphs/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SideBySideGraphs\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/TreeBFSIterator/","title":"TreeBFSIterator","text":"

vtk-examples/Cxx/Graphs/TreeBFSIterator

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/TreeBFSIterator/#code","title":"Code","text":"

TreeBFSIterator.cxx

#include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkTree.h>\n#include <vtkTreeBFSIterator.h>\n\nint main(int argc, char* argv[])\n{\n  // create a tree\n  vtkNew<vtkMutableDirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v3);\n\n  vtkNew<vtkTree> tree;\n  tree->CheckedShallowCopy(g);\n\n  // setup the iterator\n  vtkIdType root = 0;\n\n  vtkNew<vtkTreeBFSIterator> bfsIterator;\n  bfsIterator->SetStartVertex(root);\n  bfsIterator->SetTree(tree);\n\n  // traverse the tree in a breadth first fashion\n  while (bfsIterator->HasNext())\n  {\n    vtkIdType nextVertex = bfsIterator->Next();\n    std::cout << \"Next vertex: \" << nextVertex << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/TreeBFSIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TreeBFSIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TreeBFSIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TreeBFSIterator MACOSX_BUNDLE TreeBFSIterator.cxx )\n  target_link_libraries(TreeBFSIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TreeBFSIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/TreeBFSIterator/#download-and-build-treebfsiterator","title":"Download and Build TreeBFSIterator","text":"

Click here to download TreeBFSIterator and its CMakeLists.txt file. Once the tarball TreeBFSIterator.tar has been downloaded and extracted,

cd TreeBFSIterator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TreeBFSIterator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/TreeToMutableDirectedGraph/","title":"TreeToMutableDirectedGraph","text":"

vtk-examples/Cxx/Graphs/TreeToMutableDirectedGraph

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/TreeToMutableDirectedGraph/#code","title":"Code","text":"

TreeToMutableDirectedGraph.cxx

#include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkTree.h>\n\nint main(int, char*[])\n{\n\n  // create a graph\n  vtkNew<vtkMutableDirectedGraph> mdg;\n\n  // add 4 vertices to the graph\n  vtkIdType v1 = mdg->AddVertex();\n  vtkIdType v2 = mdg->AddVertex();\n  vtkIdType v3 = mdg->AddVertex();\n  vtkIdType v4 = mdg->AddVertex();\n\n  // add 3 edges to the graph\n  mdg->AddEdge(v1, v2);\n  mdg->AddEdge(v1, v3);\n  mdg->AddEdge(v1, v4);\n\n  // create 4 points - one for each vertex\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 2.0);\n\n  // add the coordinates of the points to the graph\n  mdg->SetPoints(points);\n\n  std::cout << \"MDG: \" << std::endl;\n  std::cout << \"Type: \" << mdg->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << mdg->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << mdg->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkTree> tree;\n  tree->CheckedShallowCopy(mdg);\n\n  std::cout << \"Tree: \" << std::endl;\n  std::cout << \"Type: \" << tree->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << tree->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << tree->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkMutableDirectedGraph> mdg2;\n  if (!mdg2->CheckedShallowCopy(tree))\n  {\n    std::cerr << \"Could not convert!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::cout << \"MDG2: \" << std::endl;\n  std::cout << \"Type: \" << mdg2->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << mdg2->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << mdg2->GetNumberOfEdges() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/TreeToMutableDirectedGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TreeToMutableDirectedGraph)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TreeToMutableDirectedGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TreeToMutableDirectedGraph MACOSX_BUNDLE TreeToMutableDirectedGraph.cxx )\n  target_link_libraries(TreeToMutableDirectedGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TreeToMutableDirectedGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/TreeToMutableDirectedGraph/#download-and-build-treetomutabledirectedgraph","title":"Download and Build TreeToMutableDirectedGraph","text":"

Click here to download TreeToMutableDirectedGraph and its CMakeLists.txt file. Once the tarball TreeToMutableDirectedGraph.tar has been downloaded and extracted,

cd TreeToMutableDirectedGraph/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TreeToMutableDirectedGraph\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/VertexSize/","title":"VertexSize","text":"

vtk-examples/Cxx/Graphs/VertexSize

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Graphs/VertexSize/#description","title":"Description","text":"

Change the size of all vertices.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/VertexSize/#code","title":"Code","text":"

VertexSize.cxx

#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkGraphToGlyphs.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nclass CustomRepresentation : public vtkRenderedGraphRepresentation\n{\npublic:\n  static CustomRepresentation* New();\n  vtkTypeMacro(CustomRepresentation, vtkRenderedGraphRepresentation);\n\n  void SetVertexSize(int vertexSize)\n  {\n    this->VertexGlyph->SetScreenSize(vertexSize);\n    this->VertexGlyph->Modified();\n  }\n};\nvtkStandardNewMacro(CustomRepresentation);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v2);\n\n  // Specify coordinates so the graph is always the same for testing\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  g->SetPoints(points);\n\n  vtkNew<CustomRepresentation> representation;\n  representation->SetInputData(g);\n  representation->SetVertexSize(100);\n  representation->SetGlyphType(vtkGraphToGlyphs::CIRCLE);\n\n  vtkNew<vtkGraphLayoutView> layoutView;\n  layoutView->AddRepresentation(representation);\n  layoutView->SetLayoutStrategy(\"Pass Through\");\n  layoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SaddleBrown\").GetData());\n  layoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"Wheat\").GetData());\n  layoutView->GetRenderWindow()->SetWindowName(\"VertexSize\");\n  layoutView->ResetCamera();\n  layoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/VertexSize/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VertexSize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VertexSize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VertexSize MACOSX_BUNDLE VertexSize.cxx )\n  target_link_libraries(VertexSize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VertexSize\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/VertexSize/#download-and-build-vertexsize","title":"Download and Build VertexSize","text":"

Click here to download VertexSize and its CMakeLists.txt file. Once the tarball VertexSize.tar has been downloaded and extracted,

cd VertexSize/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VertexSize\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/VisualizeDirectedGraph/","title":"VisualizeDirectedGraph","text":"

vtk-examples/Cxx/Graphs/VisualizeDirectedGraph

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/VisualizeDirectedGraph/#code","title":"Code","text":"

VisualizeDirectedGraph.cxx

#include <vtkActor.h>\n#include <vtkGlyph3D.h>\n#include <vtkGlyphSource2D.h>\n#include <vtkGraphLayout.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkGraphToPolyData.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimple2DLayoutStrategy.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableDirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v2, v3);\n  g->AddEdge(v3, v1);\n\n  // Do layout manually before handing graph to the view.\n  // This allows us to know the positions of edge arrows.\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n\n  vtkNew<vtkGraphLayout> layout;\n  vtkNew<vtkSimple2DLayoutStrategy> strategy;\n  layout->SetInputData(g);\n  layout->SetLayoutStrategy(strategy);\n\n  // Tell the view to use the vertex layout we provide\n  graphLayoutView->SetLayoutStrategyToPassThrough();\n  // The arrows will be positioned on a straight line between two\n  // vertices so tell the view not to draw arcs for parallel edges\n  graphLayoutView->SetEdgeLayoutStrategyToPassThrough();\n\n  // Add the graph to the view. This will render vertices and edges,\n  // but not edge arrows.\n  graphLayoutView->AddRepresentationFromInputConnection(\n      layout->GetOutputPort());\n\n  // Manually create an actor containing the glyphed arrows.\n  vtkNew<vtkGraphToPolyData> graphToPoly;\n  graphToPoly->SetInputConnection(layout->GetOutputPort());\n  graphToPoly->EdgeGlyphOutputOn();\n\n  // Set the position (0: edge start, 1: edge end) where\n  // the edge arrows should go.\n  graphToPoly->SetEdgeGlyphPosition(0.98);\n\n  // Make a simple edge arrow for glyphing.\n  vtkNew<vtkGlyphSource2D> arrowSource;\n  arrowSource->SetGlyphTypeToEdgeArrow();\n  arrowSource->SetScale(0.1);\n  arrowSource->Update();\n\n  // Use Glyph3D to repeat the glyph on all edges.\n  vtkNew<vtkGlyph3D> arrowGlyph;\n  arrowGlyph->SetInputConnection(0, graphToPoly->GetOutputPort(1));\n  arrowGlyph->SetInputConnection(1, arrowSource->GetOutputPort());\n\n  // Add the edge arrow actor to the view.\n  vtkNew<vtkPolyDataMapper> arrowMapper;\n  arrowMapper->SetInputConnection(arrowGlyph->GetOutputPort());\n  vtkNew<vtkActor> arrowActor;\n  arrowActor->SetMapper(arrowMapper);\n  graphLayoutView->GetRenderer()->AddActor(arrowActor);\n\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SaddleBrown\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"Wheat\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"VisualizeDirectedGraph\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/VisualizeDirectedGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeDirectedGraph)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeDirectedGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeDirectedGraph MACOSX_BUNDLE VisualizeDirectedGraph.cxx )\n  target_link_libraries(VisualizeDirectedGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeDirectedGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/VisualizeDirectedGraph/#download-and-build-visualizedirectedgraph","title":"Download and Build VisualizeDirectedGraph","text":"

Click here to download VisualizeDirectedGraph and its CMakeLists.txt file. Once the tarball VisualizeDirectedGraph.tar has been downloaded and extracted,

cd VisualizeDirectedGraph/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VisualizeDirectedGraph\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Graphs/VisualizeGraph/","title":"VisualizeGraph","text":"

vtk-examples/Cxx/Graphs/VisualizeGraph

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Graphs/VisualizeGraph/#description","title":"Description","text":"

This example shows how to construct a graph and visualize it. You can select edges and vertices with the mouse.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Graphs/VisualizeGraph/#code","title":"Code","text":"

VisualizeGraph.cxx

#include <vtkGraphLayoutView.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimple2DLayoutStrategy.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v2);\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  graphLayoutView->SetLayoutStrategy(\"Simple 2D\");\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SaddleBrown\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"Wheat\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"VisualizeGraph\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->Render();\n\n  dynamic_cast<vtkSimple2DLayoutStrategy*>(graphLayoutView->GetLayoutStrategy())\n      ->SetRandomSeed(0);\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Graphs/VisualizeGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeGraph)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonDataModel\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeGraph MACOSX_BUNDLE VisualizeGraph.cxx )\n  target_link_libraries(VisualizeGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Graphs/VisualizeGraph/#download-and-build-visualizegraph","title":"Download and Build VisualizeGraph","text":"

Click here to download VisualizeGraph and its CMakeLists.txt file. Once the tarball VisualizeGraph.tar has been downloaded and extracted,

cd VisualizeGraph/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VisualizeGraph\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/HyperTreeGrid/HyperTreeGridSource/","title":"HyperTreeGridSource","text":"

vtk-examples/Cxx/HyperTreeGrid/HyperTreeGridSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/HyperTreeGrid/HyperTreeGridSource/#code","title":"Code","text":"

HyperTreeGridSource.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkHyperTreeGridSource.h>\n#include <vtkHyperTreeGridToUnstructuredGrid.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkVersion.h>\n\n#include <cstdlib>\n\nint main(int, char*[])\n{\n  // Create hyper tree grid source\n  vtkNew<vtkHyperTreeGridSource> source;\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n  source->SetMaxDepth(6);\n#else\n  source->SetMaximumLevel(6);\n#endif\n  source->SetDimensions(4, 4, 3); // GridCell 3, 3, 2\n  source->SetGridScale(1.5, 1.0, 0.7);\n  source->SetBranchFactor(4);\n  source->SetDescriptor(\n      \"RRR .R. .RR ..R ..R .R.|R.......................... \"\n      \"........................... ........................... \"\n      \".............R............. ....RR.RR........R......... \"\n      \".....RRRR.....R.RR......... ........................... \"\n      \"........................... \"\n      \"...........................|........................... \"\n      \"........................... ........................... \"\n      \"...RR.RR.......RR.......... ........................... \"\n      \"RR......................... ........................... \"\n      \"........................... ........................... \"\n      \"........................... ........................... \"\n      \"........................... ........................... \"\n      \"............RRR............|........................... \"\n      \"........................... .......RR.................. \"\n      \"........................... ........................... \"\n      \"........................... ........................... \"\n      \"........................... ........................... \"\n      \"........................... \"\n      \"...........................|........................... \"\n      \"...........................\");\n  source->Update();\n\n  // Hyper tree grid to unstructured grid filter\n  vtkNew<vtkHyperTreeGridToUnstructuredGrid> htg2ug;\n  htg2ug->SetInputConnection(source->GetOutputPort());\n  htg2ug->Update();\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(htg2ug->GetOutputPort());\n  shrink->SetShrinkFactor(0.8);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Burlywood\").GetData());\n\n  // Create the RenderWindow, Renderer and Interactor\n  //\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(150);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"HyperTreeGridSource\");\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/HyperTreeGrid/HyperTreeGridSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HyperTreeGridSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersHyperTree\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HyperTreeGridSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HyperTreeGridSource MACOSX_BUNDLE HyperTreeGridSource.cxx )\n  target_link_libraries(HyperTreeGridSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HyperTreeGridSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/HyperTreeGrid/HyperTreeGridSource/#download-and-build-hypertreegridsource","title":"Download and Build HyperTreeGridSource","text":"

Click here to download HyperTreeGridSource and its CMakeLists.txt file. Once the tarball HyperTreeGridSource.tar has been downloaded and extracted,

cd HyperTreeGridSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HyperTreeGridSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/3DSImporter/","title":"3DSImporter","text":"

vtk-examples/Cxx/IO/3DSImporter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/3DSImporter/#description","title":"Description","text":"

This example illustrates Importing files in VTK. An importer creates a vtkRenderWindow that describes the scene.

Info

See Figure 4-13 in Chapter 4 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/3DSImporter/#code","title":"Code","text":"

3DSImporter.cxx

#include <vtk3DSImporter.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.3ds e.g. iflamingo.3ds\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtk3DSImporter> importer;\n  importer->SetFileName(argv[1]);\n  importer->ComputeNormalsOn();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  renWin->AddRenderer(renderer);\n  renderer->SetBackground2(colors->GetColor3d(\"Gold\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->GradientBackgroundOn();\n\n  iren->SetRenderWindow(renWin);\n  importer->SetRenderWindow(renWin);\n  importer->Update();\n\n  auto actors = renderer->GetActors();\n  std::cout << \"There are \" << actors->GetNumberOfItems() << \" actors.\"\n            << std::endl;\n\n  renWin->SetWindowName(\"3DSImporter\");\n\n  renWin->Render();\n\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, -1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Azimuth(150);\n  camera->Elevation(30);\n\n  renderer->SetActiveCamera(camera);\n  renderer->ResetCamera();\n  renderer->ResetCameraClippingRange();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/3DSImporter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(3DSImporter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"3DSImporter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(3DSImporter MACOSX_BUNDLE 3DSImporter.cxx )\n  target_link_libraries(3DSImporter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS 3DSImporter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/3DSImporter/#download-and-build-3dsimporter","title":"Download and Build 3DSImporter","text":"

Click here to download 3DSImporter and its CMakeLists.txt file. Once the tarball 3DSImporter.tar has been downloaded and extracted,

cd 3DSImporter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./3DSImporter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ConvertFile/","title":"ConvertFile","text":"

vtk-examples/Cxx/IO/ConvertFile

"},{"location":"Cxx/IO/ConvertFile/#description","title":"Description","text":"

This example demonstrates how to read a file and then write it to a different type of file. In this example, we read a vtp file and write a ply file, but simply by changing the reader/writer classes instantiated, different behavior can be achieved.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ConvertFile/#code","title":"Code","text":"

ConvertFile.cxx

#include <vtkNew.h>\n#include <vtkPLYWriter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Required arguments: input.vtp output.ply e.g. Bunny.vtp \"\n                 \"ConvertFile.ply\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFileName = argv[1];\n  std::string outputFileName = argv[2];\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(inputFileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkPLYWriter> writer;\n  writer->SetFileName(outputFileName.c_str());\n  writer->SetInputConnection(reader->GetOutputPort());\n  writer->Update();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ConvertFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConvertFile)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOPLY\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConvertFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConvertFile MACOSX_BUNDLE ConvertFile.cxx )\n  target_link_libraries(ConvertFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConvertFile\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ConvertFile/#download-and-build-convertfile","title":"Download and Build ConvertFile","text":"

Click here to download ConvertFile and its CMakeLists.txt file. Once the tarball ConvertFile.tar has been downloaded and extracted,

cd ConvertFile/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConvertFile\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/DEMReader/","title":"DEMReader","text":"

vtk-examples/Cxx/IO/DEMReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/DEMReader/#code","title":"Code","text":"

DEMReader.cxx

#include <vtkDEMReader.h>\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify arguments.\n  if (argc < 2)\n  {\n    std::cerr << \"Required: filename.dem e.g. SainteHelens.dem\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the file\n  vtkNew<vtkDEMReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.6, 0);\n  lut->SetSaturationRange(1.0, 0);\n  lut->SetValueRange(0.5, 1.0);\n  lut->SetTableRange(reader->GetOutput()->GetScalarRange());\n\n  // Visualize\n  vtkNew<vtkImageMapToColors> mapColors;\n  mapColors->SetLookupTable(lut);\n  mapColors->SetInputConnection(reader->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(mapColors->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DEMReader\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/DEMReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DEMReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DEMReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DEMReader MACOSX_BUNDLE DEMReader.cxx )\n  target_link_libraries(DEMReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DEMReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/DEMReader/#download-and-build-demreader","title":"Download and Build DEMReader","text":"

Click here to download DEMReader and its CMakeLists.txt file. Once the tarball DEMReader.tar has been downloaded and extracted,

cd DEMReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DEMReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/DumpXMLFile/","title":"DumpXMLFile","text":"

vtk-examples/Cxx/IO/DumpXMLFile

"},{"location":"Cxx/IO/DumpXMLFile/#description","title":"Description","text":"

This example reports the cell, cell data and point data contained within a VTK XML or legacy file.

Note

This original source code for this example is here.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/DumpXMLFile/#code","title":"Code","text":"

DumpXMLFile.cxx

//\n// DumpXMLFile - report on the contents of an XML or legacy vtk file\n//  Usage: DumpXMLFile XMLFile1 XMLFile2 ...\n//         where\n//         XMLFile is a vtk XML file of type .vtu, .vtp, .vts, .vtr,\n//         .vti, .vto\n//\n#include <vtkCellData.h>\n#include <vtkCellTypes.h>\n#include <vtkDataSet.h>\n#include <vtkDataSetReader.h>\n#include <vtkFieldData.h>\n#include <vtkImageData.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkSmartPointer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLCompositeDataReader.h>\n#include <vtkXMLImageDataReader.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtkXMLReader.h>\n#include <vtkXMLRectilinearGridReader.h>\n#include <vtkXMLStructuredGridReader.h>\n#include <vtkXMLUnstructuredGridReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <map>\n\nnamespace {\n\ntemplate <class TReader> vtkDataSet* ReadAnXMLFile(const char* fileName)\n{\n  vtkNew<TReader> reader;\n  reader->SetFileName(fileName);\n  reader->Update();\n  reader->GetOutput()->Register(reader);\n  return dynamic_cast<vtkDataSet*>(reader->GetOutput());\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" XMLFile1 XMLFile2 ...\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Process each file on the command line.\n  int f = 1;\n  while (f < argc)\n  {\n    vtkSmartPointer<vtkDataSet> dataSet;\n    std::string extension =\n        vtksys::SystemTools::GetFilenameLastExtension(argv[f]);\n    // Dispatch based on the file extension.\n    if (extension == \".vtu\")\n    {\n      dataSet = ReadAnXMLFile<vtkXMLUnstructuredGridReader>(argv[f]);\n    }\n    else if (extension == \".vtp\")\n    {\n      dataSet = ReadAnXMLFile<vtkXMLPolyDataReader>(argv[f]);\n    }\n    else if (extension == \".vts\")\n    {\n      dataSet = ReadAnXMLFile<vtkXMLStructuredGridReader>(argv[f]);\n    }\n    else if (extension == \".vtr\")\n    {\n      dataSet = ReadAnXMLFile<vtkXMLRectilinearGridReader>(argv[f]);\n    }\n    else if (extension == \".vti\")\n    {\n      dataSet = ReadAnXMLFile<vtkXMLImageDataReader>(argv[f]);\n    }\n    else if (extension == \".vtk\")\n    {\n      dataSet = ReadAnXMLFile<vtkDataSetReader>(argv[f]);\n    }\n    else\n    {\n      std::cerr << argv[0] << \" Unknown extension: \" << extension << std::endl;\n      return EXIT_FAILURE;\n    }\n\n    int numberOfCells = dataSet->GetNumberOfCells();\n    int numberOfPoints = dataSet->GetNumberOfPoints();\n\n    // Generate a report.\n    std::cout << \"------------------------\" << std::endl;\n    std::cout << argv[f] << std::endl\n              << \" contains a \" << std::endl\n              << dataSet->GetClassName() << \" that has \" << numberOfCells\n              << \" cells\"\n              << \" and \" << numberOfPoints << \" points.\" << std::endl;\n    typedef std::map<int, int> CellContainer;\n    CellContainer cellMap;\n    for (int i = 0; i < numberOfCells; i++)\n    {\n      cellMap[dataSet->GetCellType(i)]++;\n    }\n\n    CellContainer::const_iterator it = cellMap.begin();\n    while (it != cellMap.end())\n    {\n      std::cout << \"\\tCell type \"\n                << vtkCellTypes::GetClassNameFromTypeId(it->first) << \" occurs \"\n                << it->second << \" times.\" << std::endl;\n      ++it;\n    }\n\n    // Now check for point data.\n    vtkPointData* pd = dataSet->GetPointData();\n    if (pd)\n    {\n      std::cout << \" contains point data with \" << pd->GetNumberOfArrays()\n                << \" arrays.\" << std::endl;\n      for (int i = 0; i < pd->GetNumberOfArrays(); i++)\n      {\n        std::cout << \"\\tArray \" << i << \" is named \"\n                  << (pd->GetArrayName(i) ? pd->GetArrayName(i) : \"NULL\")\n                  << \" has \" << pd->GetArray(i)->GetNumberOfTuples()\n                  << \" tuples\"\n                  << \" with \" << pd->GetArray(i)->GetNumberOfComponents()\n                  << \" components\"\n                  << \" of type \" << pd->GetArray(i)->GetClassName()\n                  << std::endl;\n      }\n    }\n\n    // Now check for cell data.\n    vtkCellData* cd = dataSet->GetCellData();\n    if (cd)\n    {\n      std::cout << \" contains cell data with \" << cd->GetNumberOfArrays()\n                << \" arrays.\" << std::endl;\n      for (int i = 0; i < cd->GetNumberOfArrays(); i++)\n      {\n        std::cout << \"\\tArray \" << i << \" is named \"\n                  << (cd->GetArrayName(i) ? cd->GetArrayName(i) : \"NULL\")\n                  << std::endl;\n      }\n    }\n\n    // Now check for field data.\n    if (dataSet->GetFieldData())\n    {\n      std::cout << \" contains field data with \"\n                << dataSet->GetFieldData()->GetNumberOfArrays() << \" arrays.\"\n                << std::endl;\n      for (int i = 0; i < dataSet->GetFieldData()->GetNumberOfArrays(); i++)\n      {\n        std::cout\n            << \"\\tArray \" << i << \" is named \"\n            << dataSet->GetFieldData()->GetArray(i)->GetName() << \" has \"\n            << dataSet->GetFieldData()->GetArray(i)->GetNumberOfTuples()\n            << \" tuples\"\n            << \" with \"\n            << dataSet->GetFieldData()->GetArray(i)->GetNumberOfComponents()\n            << \" components\"\n            << \" of type \"\n            << dataSet->GetFieldData()->GetArray(i)->GetClassName()\n            << std::endl;\n      }\n    }\n    f++;\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/DumpXMLFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DumpXMLFile)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOLegacy\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DumpXMLFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DumpXMLFile MACOSX_BUNDLE DumpXMLFile.cxx )\n  target_link_libraries(DumpXMLFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DumpXMLFile\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/DumpXMLFile/#download-and-build-dumpxmlfile","title":"Download and Build DumpXMLFile","text":"

Click here to download DumpXMLFile and its CMakeLists.txt file. Once the tarball DumpXMLFile.tar has been downloaded and extracted,

cd DumpXMLFile/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DumpXMLFile\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ExportPolyDataScene/","title":"ExportPolyDataScene","text":"

vtk-examples/Cxx/IO/ExportPolyDataScene

"},{"location":"Cxx/IO/ExportPolyDataScene/#description","title":"Description","text":"

Danger

This example is a work in progress.

The example exports the vtkPolyData used by vtkActor's. The example stores the vtkMapper, vtkCamera, vtkActor and vtkProperty parameters as vtkFieldData in the vtkActor's vtkPolyData.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ExportPolyDataScene/#code","title":"Code","text":"

ExportPolyDataScene.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDoubleArray.h>\n#include <vtkFieldData.h>\n#include <vtkLinearTransform.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarsToColors.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkXMLMultiBlockDataWriter.h>\n#include <vtksys/SystemTools.hxx>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\nvoid ExportMultiBlockScene(vtkRenderer* renderer, std::string fileName,\n                           bool binary = false);\nvoid SaveCameraAsFieldData(std::string const&, vtkCamera*, vtkPolyData*);\nvoid SavePropertyAsFieldData(std::string const&, vtkProperty*, vtkPolyData*);\nvoid SaveMapperAsFieldData(std::string const&, vtkPolyDataMapper*,\n                           vtkPolyData*);\nvoid SaveActorAsFieldData(std::string const&, vtkActor*, vtkPolyData*);\nvoid SaveLookupTableAsFieldData(std::string const&, vtkScalarsToColors*,\n                                vtkPolyData*);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double delta[3];\n  delta[0] = bounds[1] - bounds[0];\n  delta[1] = bounds[3] - bounds[2];\n  delta[2] = bounds[5] - bounds[4];\n  for (int c = 0; c < 4; ++c)\n  {\n    for (int b = 0; b < 4; ++b)\n    {\n      for (int a = 0; a < 4; ++a)\n      {\n        vtkNew<vtkPolyDataMapper> mapper;\n        mapper->SetInputData(polyData);\n\n        vtkNew<vtkProperty> backProperty;\n        backProperty->SetColor(colors->GetColor3d(\"peacock\").GetData());\n\n        vtkNew<vtkActor> actor;\n        actor->SetMapper(mapper);\n        actor->SetBackfaceProperty(backProperty);\n        if (b == 1)\n        {\n          actor->GetProperty()->SetDiffuseColor(\n              colors->GetColor3d(\"Orchid\").GetData());\n        }\n        else if (b == 2)\n        {\n          actor->GetProperty()->SetDiffuseColor(\n              colors->GetColor3d(\"Salmon\").GetData());\n        }\n        else if (b == 3)\n        {\n          actor->GetProperty()->SetDiffuseColor(\n              colors->GetColor3d(\"SandyBrown\").GetData());\n        }\n        else\n        {\n          actor->GetProperty()->SetDiffuseColor(\n              colors->GetColor3d(\"Crimson\").GetData());\n        }\n        actor->GetProperty()->SetSpecular(.5);\n        actor->GetProperty()->SetDiffuse(.5);\n        actor->GetProperty()->SetSpecularPower(a * b * c);\n        if ((a % 3) == 0)\n        {\n          actor->GetProperty()->EdgeVisibilityOn();\n          actor->GetProperty()->SetEdgeColor(\n              colors->GetColor3d(\"SlateGray\").GetData());\n          actor->GetProperty()->SetLineWidth(1.0);\n        }\n        else\n        {\n          actor->GetProperty()->EdgeVisibilityOff();\n        }\n        if ((a % 4) == 0)\n        {\n          actor->GetProperty()->FrontfaceCullingOn();\n        }\n        if ((a % 3) == 0 && (c & 3) == 0)\n        {\n          actor->GetProperty()->SetRepresentationToWireframe();\n        }\n        else\n        {\n          actor->GetProperty()->SetRepresentationToSurface();\n        }\n        if (c == 3)\n        {\n          vtkNew<vtkTransform> rotateTransform;\n          rotateTransform->RotateZ(30.0);\n          actor->GetProperty()->SetInterpolationToGouraud();\n          actor->SetUserTransform(rotateTransform);\n        }\n        else\n        {\n          actor->GetProperty()->SetInterpolationToFlat();\n        }\n        actor->AddPosition(1.5 * a * delta[0], 1.5 * b * delta[1],\n                           1.5 * c * delta[2]);\n        actor->SetScale((a + 1) * .5, (b + 1) * .5, (c + 1) * .5);\n\n        renderer->AddActor(actor);\n      }\n    }\n  }\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Yaw(10);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ExportPolyDataScene\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  std::string prefix;\n  if (argc < 2)\n  {\n    prefix = \"Sphere\";\n  }\n  else\n  {\n    prefix = \"Export\" +\n        vtksys::SystemTools::GetFilenameWithoutExtension(argv[1]) + \".vtp\";\n  }\n  std::cout << \"Scene is exported to \"\n            << vtksys::SystemTools::GetCurrentWorkingDirectory() + \"/\" + prefix\n            << std::endl;\n  ExportMultiBlockScene(renderer.GetPointer(), prefix, false);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid ExportMultiBlockScene(vtkRenderer* renderer, std::string fileName,\n                           bool binary)\n{\n  // Iterate over all actors in the renderer.\n  auto actors = renderer->GetActors();\n  std::cout << \"There are \" << actors->GetNumberOfItems() << \" actors\"\n            << std::endl;\n  actors->InitTraversal();\n  // Initialize dataset to write\n  vtkNew<vtkMultiBlockDataSet> multiBlockDataset;\n  multiBlockDataset->SetNumberOfBlocks(actors->GetNumberOfItems());\n\n  for (vtkIdType a = 0; a < actors->GetNumberOfItems(); ++a)\n  {\n    vtkActor* actor = actors->GetNextActor();\n\n    // Deep copy the polydata because it may be shared with other actors.\n    vtkNew<vtkPolyData> pd;\n    pd->DeepCopy(dynamic_cast<vtkPolyData*>(actor->GetMapper()->GetInput()));\n\n    // Set metadata for block.\n    multiBlockDataset->SetBlock(a, pd);\n\n    // Save Camera.\n    SaveCameraAsFieldData(\"Camera\", renderer->GetActiveCamera(), pd);\n\n    // Save Property.\n    SavePropertyAsFieldData(\"Property\", actor->GetProperty(), pd);\n    SavePropertyAsFieldData(\"BackfaceProperty\", actor->GetBackfaceProperty(),\n                            pd);\n    // Save Mapper.\n    SaveMapperAsFieldData(\"PolyDataMapper\",\n                          dynamic_cast<vtkPolyDataMapper*>(actor->GetMapper()),\n                          pd);\n    // Save Actor.\n    SaveActorAsFieldData(\"Actor\", actor, pd);\n  }\n\n  // Write multiblock dataset to disk.\n  vtkNew<vtkXMLMultiBlockDataWriter> writer;\n  if (binary)\n  {\n    writer->SetDataModeToBinary();\n    writer->SetCompressorTypeToZLib();\n  }\n  else\n  {\n    writer->SetDataModeToAscii();\n  }\n  writer->SetInputData(multiBlockDataset);\n  writer->SetFileName(fileName.c_str());\n  writer->Update();\n  return;\n}\n\n#define SAVE_SCALAR(arrayPrefix, instance, pd, name, T)                        \\\n  vtkSmartPointer<T> name = vtkSmartPointer<T>::New();                         \\\n  name->SetNumberOfComponents(1);                                              \\\n  name->SetNumberOfTuples(1);                                                  \\\n  name->SetValue(0, instance->Get##name());                                    \\\n  name->SetName(std::string(arrayPrefix + \":\" + \"#name\").c_str());             \\\n  pd->GetFieldData()->AddArray(name)\n\n#define SAVE_VECTOR(arrayPrefix, instance, pd, name, T, components, tuples)    \\\n  vtkSmartPointer<T> name = vtkSmartPointer<T>::New();                         \\\n  name->SetNumberOfComponents(components);                                     \\\n  name->SetNumberOfTuples(tuples);                                             \\\n  name->SetTuple(0, instance->Get##name());                                    \\\n  name->SetName(std::string(arrayPrefix + \":\" + \"#name\").c_str());             \\\n  pd->GetFieldData()->AddArray(name)\n\nvoid SaveCameraAsFieldData(std::string const& arrayPrefix, vtkCamera* camera,\n                           vtkPolyData* pd)\n{\n  SAVE_VECTOR(arrayPrefix, camera, pd, ViewUp, vtkDoubleArray, 3, 1);\n  SAVE_VECTOR(arrayPrefix, camera, pd, Position, vtkDoubleArray, 3, 1);\n  SAVE_VECTOR(arrayPrefix, camera, pd, FocalPoint, vtkDoubleArray, 3, 1);\n  SAVE_VECTOR(arrayPrefix, camera, pd, ClippingRange, vtkDoubleArray, 2, 1);\n  SAVE_SCALAR(arrayPrefix, camera, pd, ViewAngle, vtkDoubleArray);\n}\nvoid SavePropertyAsFieldData(std::string const& arrayPrefix,\n                             vtkProperty* property, vtkPolyData* pd)\n{\n  if (property)\n  {\n    SAVE_SCALAR(arrayPrefix, property, pd, Ambient, vtkDoubleArray);\n    SAVE_VECTOR(arrayPrefix, property, pd, AmbientColor, vtkDoubleArray, 3, 1);\n    SAVE_SCALAR(arrayPrefix, property, pd, Diffuse, vtkDoubleArray);\n    SAVE_VECTOR(arrayPrefix, property, pd, DiffuseColor, vtkDoubleArray, 3, 1);\n    SAVE_SCALAR(arrayPrefix, property, pd, Specular, vtkDoubleArray);\n    SAVE_VECTOR(arrayPrefix, property, pd, SpecularColor, vtkDoubleArray, 3, 1);\n    SAVE_SCALAR(arrayPrefix, property, pd, SpecularPower, vtkDoubleArray);\n    SAVE_VECTOR(arrayPrefix, property, pd, EdgeColor, vtkDoubleArray, 3, 1);\n    SAVE_SCALAR(arrayPrefix, property, pd, EdgeVisibility, vtkIntArray);\n    SAVE_VECTOR(arrayPrefix, property, pd, VertexColor, vtkDoubleArray, 3, 1);\n    SAVE_SCALAR(arrayPrefix, property, pd, Interpolation, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, Opacity, vtkDoubleArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, Representation, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, BackfaceCulling, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, FrontfaceCulling, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, PointSize, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, LineWidth, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, LineStipplePattern, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, LineStippleRepeatFactor,\n                vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, Lighting, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, RenderPointsAsSpheres, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, Shading, vtkIntArray);\n\n    if (property->GetMaterialName())\n    {\n      SAVE_SCALAR(arrayPrefix, property, pd, MaterialName, vtkStringArray);\n    }\n  }\n}\nvoid SaveMapperAsFieldData(std::string const& arrayPrefix,\n                           vtkPolyDataMapper* mapper, vtkPolyData* pd)\n{\n  if (mapper->GetLookupTable())\n  {\n    std::string prefix = arrayPrefix + \"LookupTable:\";\n    vtkScalarsToColors* scalarsToColors = mapper->GetLookupTable();\n\n    SAVE_SCALAR(prefix, scalarsToColors, pd, Alpha, vtkDoubleArray);\n    SAVE_SCALAR(prefix, scalarsToColors, pd, VectorMode, vtkIntArray);\n    SAVE_SCALAR(prefix, scalarsToColors, pd, VectorComponent, vtkIntArray);\n    SAVE_SCALAR(prefix, scalarsToColors, pd, VectorSize, vtkIntArray);\n    SAVE_SCALAR(prefix, scalarsToColors, pd, IndexedLookup, vtkIntArray);\n\n    vtkLookupTable* lut =\n        dynamic_cast<vtkLookupTable*>(mapper->GetLookupTable());\n    SAVE_VECTOR(prefix, lut, pd, TableRange, vtkDoubleArray, 2, 1);\n    SAVE_SCALAR(prefix, lut, pd, Scale, vtkIntArray);\n    SAVE_VECTOR(prefix, lut, pd, HueRange, vtkDoubleArray, 2, 1);\n    SAVE_VECTOR(prefix, lut, pd, SaturationRange, vtkDoubleArray, 2, 1);\n    SAVE_VECTOR(prefix, lut, pd, ValueRange, vtkDoubleArray, 2, 1);\n    SAVE_VECTOR(prefix, lut, pd, AlphaRange, vtkDoubleArray, 2, 1);\n    SAVE_VECTOR(prefix, lut, pd, NanColor, vtkDoubleArray, 4, 1);\n    SAVE_VECTOR(prefix, lut, pd, BelowRangeColor, vtkDoubleArray, 4, 1);\n    SAVE_SCALAR(prefix, lut, pd, UseBelowRangeColor, vtkIntArray);\n    SAVE_VECTOR(prefix, lut, pd, AboveRangeColor, vtkDoubleArray, 4, 1);\n    SAVE_SCALAR(prefix, lut, pd, UseAboveRangeColor, vtkIntArray);\n    SAVE_SCALAR(prefix, lut, pd, NumberOfTableValues, vtkIntArray);\n    SAVE_SCALAR(prefix, lut, pd, Ramp, vtkIntArray);\n    SAVE_SCALAR(prefix, lut, pd, NumberOfColors, vtkIntArray);\n\n    auto Table = vtkSmartPointer<vtkUnsignedCharArray>::New();\n    //    Table->SetNumberOfComponents(4);\n    //    Table->SetNumberOfTuples(dynamic_cast<vtkLookupTable*>(lut)->GetTable()->GetNumberOfTuples());\n    Table->DeepCopy(dynamic_cast<vtkLookupTable*>(lut)->GetTable());\n    Table->SetName(\n        std::string(arrayPrefix + \":LookupTable:\" + \"Table\").c_str());\n    pd->GetFieldData()->AddArray(Table);\n\n    SAVE_SCALAR(arrayPrefix, mapper, pd, ScalarVisibility, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, Static, vtkIntArray);\n    SAVE_VECTOR(arrayPrefix, mapper, pd, ScalarRange, vtkDoubleArray, 2, 1);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, UseLookupTableScalarRange,\n                vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, ColorMode, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, InterpolateScalarsBeforeMapping,\n                vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, ScalarMode, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, ResolveCoincidentTopology,\n                vtkIntArray);\n  }\n}\n\nvoid SaveActorAsFieldData(std::string const& arrayPrefix, vtkActor* actor,\n                          vtkPolyData* pd)\n{\n  SAVE_SCALAR(arrayPrefix, actor, pd, Dragable, vtkIntArray);\n  SAVE_SCALAR(arrayPrefix, actor, pd, Pickable, vtkIntArray);\n  SAVE_SCALAR(arrayPrefix, actor, pd, Visibility, vtkIntArray);\n  SAVE_VECTOR(arrayPrefix, actor, pd, Orientation, vtkDoubleArray, 3, 1);\n  SAVE_VECTOR(arrayPrefix, actor, pd, Origin, vtkDoubleArray, 3, 1);\n  SAVE_VECTOR(arrayPrefix, actor, pd, Scale, vtkDoubleArray, 3, 1);\n  SAVE_SCALAR(arrayPrefix, actor, pd, ForceOpaque, vtkIntArray);\n  SAVE_SCALAR(arrayPrefix, actor, pd, ForceTranslucent, vtkIntArray);\n\n  if (actor->GetUserTransform())\n  {\n    vtkLinearTransform* userTransform = actor->GetUserTransform();\n    userTransform->Print(std::cout);\n  }\n\n#if 0\nUserTransform\nUserMatrix\nTexture\n#endif\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/IO/ExportPolyDataScene/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExportPolyDataScene)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExportPolyDataScene: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExportPolyDataScene MACOSX_BUNDLE ExportPolyDataScene.cxx )\n  target_link_libraries(ExportPolyDataScene PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExportPolyDataScene\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ExportPolyDataScene/#download-and-build-exportpolydatascene","title":"Download and Build ExportPolyDataScene","text":"

Click here to download ExportPolyDataScene and its CMakeLists.txt file. Once the tarball ExportPolyDataScene.tar has been downloaded and extracted,

cd ExportPolyDataScene/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExportPolyDataScene\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/FindAllArrayNames/","title":"FindAllArrayNames","text":"

vtk-examples/Cxx/IO/FindAllArrayNames

"},{"location":"Cxx/IO/FindAllArrayNames/#description","title":"Description","text":"

This example shows how to find out the names of all of the data arrays stored in a vtkPolyData.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/FindAllArrayNames/#code","title":"Code","text":"

FindAllArrayNames.cxx

#include <vtkCellData.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <string>\n#include <vector>\n\nnamespace {\nvoid FindAllData(vtkPolyData* polydata);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polydata;\n  if (argc < 2)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n    vtkNew<vtkXMLPolyDataWriter> writer;\n    writer->SetFileName(\"test.vtp\");\n    writer->SetInputConnection(sphereSource->GetOutputPort());\n    writer->Write();\n\n    polydata = sphereSource->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polydata = reader->GetOutput();\n  }\n\n  FindAllData(polydata);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid FindAllData(vtkPolyData* polydata)\n{\n  std::cout << \"Normals: \" << polydata->GetPointData()->GetNormals()\n            << std::endl;\n\n  vtkIdType numberOfPointArrays = polydata->GetPointData()->GetNumberOfArrays();\n  std::cout << \"Number of PointData arrays: \" << numberOfPointArrays\n            << std::endl;\n\n  vtkIdType numberOfCellArrays = polydata->GetCellData()->GetNumberOfArrays();\n  std::cout << \"Number of CellData arrays: \" << numberOfCellArrays << std::endl;\n\n  std::cout << \"Type table/key: \" << std::endl;\n  ;\n  // More values can be found in <VTK_DIR>/Common/Core/vtkSetGet.h\n  std::cout << VTK_UNSIGNED_CHAR << \" unsigned char\" << std::endl;\n  std::cout << VTK_UNSIGNED_INT << \" unsigned int\" << std::endl;\n  std::cout << VTK_FLOAT << \" float\" << std::endl;\n  std::cout << VTK_DOUBLE << \" double\" << std::endl;\n\n  for (vtkIdType i = 0; i < numberOfPointArrays; i++)\n  {\n    // The following two lines are equivalent.\n    // arrayNames.push_back(polydata->GetPointData()->GetArray(i)->GetName());\n    // arrayNames.push_back(polydata->GetPointData()->GetArrayName(i));\n    int dataTypeID = polydata->GetPointData()->GetArray(i)->GetDataType();\n    std::cout << \"Array \" << i << \": \"\n              << polydata->GetPointData()->GetArrayName(i)\n              << \" (type: \" << dataTypeID << \")\" << std::endl;\n  }\n\n  for (vtkIdType i = 0; i < numberOfCellArrays; i++)\n  {\n    // The following two lines are equivalent.\n    // polydata->GetPointData()->GetArray(i)->GetName();\n    // polydata->GetPointData()->GetArrayName(i);\n    int dataTypeID = polydata->GetCellData()->GetArray(i)->GetDataType();\n    std::cout << \"Array \" << i << \": \"\n              << polydata->GetCellData()->GetArrayName(i)\n              << \" (type: \" << dataTypeID << \")\" << std::endl;\n  }\n}\n} // namespace\n
"},{"location":"Cxx/IO/FindAllArrayNames/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FindAllArrayNames)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FindAllArrayNames: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FindAllArrayNames MACOSX_BUNDLE FindAllArrayNames.cxx )\n  target_link_libraries(FindAllArrayNames PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FindAllArrayNames\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/FindAllArrayNames/#download-and-build-findallarraynames","title":"Download and Build FindAllArrayNames","text":"

Click here to download FindAllArrayNames and its CMakeLists.txt file. Once the tarball FindAllArrayNames.tar has been downloaded and extracted,

cd FindAllArrayNames/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FindAllArrayNames\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/GLTFExporter/","title":"GLTFExporter","text":"

vtk-examples/Cxx/IO/GLTFExporter

"},{"location":"Cxx/IO/GLTFExporter/#description","title":"Description","text":"

The examples uses vtkGLTFExporter to save the current scene in a .gltf file. The saved file called GLTFExporter.gltf is saved in the directory where the example is run. That file can be imported using vtkGLTFImporter.

Warning

Currently the camera is not writeen properly so the exported scene will not match the imported scene.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/GLTFExporter/#code","title":"Code","text":"

GLTFExporter.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkGLTFExporter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: GLTFExporter file.gltf e.g. GLTFExporter.gltf\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SlateGray\");\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n\n  // Generate a random start and end point\n  double startPoint[3];\n  double endPoint[3];\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    startPoint[i] = rng->GetRangeValue(-10, 10);\n    rng->Next();\n    endPoint[i] = rng->GetRangeValue(-10, 10);\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (auto i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms.\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);\n  transform->Concatenate(matrix);\n  transform->Scale(length, length, length);\n\n  // Transform the polydata.\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(arrowSource->GetOutputPort());\n\n  // Create a mapper and actor for the arrow.\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n#ifdef USER_MATRIX\n  mapper->SetInputConnection(arrowSource->GetOutputPort());\n  actor->SetUserMatrix(transform->GetMatrix());\n#else\n  mapper->SetInputConnection(transformPD->GetOutputPort());\n#endif\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create spheres for start and end point.\n  vtkNew<vtkSphereSource> sphereStartSource;\n  sphereStartSource->SetCenter(startPoint);\n  sphereStartSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereStartMapper;\n  sphereStartMapper->SetInputConnection(sphereStartSource->GetOutputPort());\n  vtkNew<vtkActor> sphereStart;\n  sphereStart->SetMapper(sphereStartMapper);\n  sphereStart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  vtkNew<vtkSphereSource> sphereEndSource;\n  sphereEndSource->SetCenter(endPoint);\n  sphereEndSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereEndMapper;\n  sphereEndMapper->SetInputConnection(sphereEndSource->GetOutputPort());\n  vtkNew<vtkActor> sphereEnd;\n  sphereEnd->SetMapper(sphereEndMapper);\n  sphereEnd->GetProperty()->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"GLTFExporter\");\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereStart);\n  renderer->AddActor(sphereEnd);\n  renderer->SetBackground(backgroundColor.GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  renderWindowInteractor->Start();\n\n  vtkNew<vtkGLTFExporter> writer;\n  writer->SetFileName(argv[1]);\n  writer->InlineDataOn();\n  writer->SetRenderWindow(renderWindow);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/GLTFExporter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GLTFExporter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  IOExport\n  IOExportOpenGL2\n  IOExportPDF\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GLTFExporter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GLTFExporter MACOSX_BUNDLE GLTFExporter.cxx )\n  target_link_libraries(GLTFExporter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GLTFExporter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/GLTFExporter/#download-and-build-gltfexporter","title":"Download and Build GLTFExporter","text":"

Click here to download GLTFExporter and its CMakeLists.txt file. Once the tarball GLTFExporter.tar has been downloaded and extracted,

cd GLTFExporter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GLTFExporter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/GLTFImporter/","title":"GLTFImporter","text":"

vtk-examples/Cxx/IO/GLTFImporter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/GLTFImporter/#description","title":"Description","text":"

The example uses vtkGLTFImporter to import a scene from a gltf file. glTF (derivative short form of GL Transmission Format) is a file format for 3D scenes and models using the JSON standard. It is an API-neutral runtime asset delivery format developed by the Khronos Group 3D Formats Working Group. It was announced at HTML5DevConf 2016.

There are many sources of glTF file including:

  • SketchLab. To download you will need to signup. There are also non-free models offered here.
  • Khronos Group

usage

GLTFImporter FlightHelmet.gltf

Warning

When you run the example, be sure to specify the full pathname of the .glTF file. There is currently a bug in the vtkGLTFImporter. For example, if your home directry is /home/janedoe the the full pathname of the FlightHelmet data is /home/janedoe/VTKExamples/src/Testing/Data/gltf/FlightHelmet/FlightHelmet.gltf.

Info

The original data can be found here: FlightHelmet Data). Be sure to download all of the files.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/GLTFImporter/#code","title":"Code","text":"

GLTFImporter.cxx

#include <vtkCamera.h>\n#include <vtkGLTFImporter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc <= 1)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" <gltf file> e.g. FlightHelmet.gltf\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SlateGray\");\n\n  vtkNew<vtkGLTFImporter> importer;\n  importer->SetFileName(argv[1]);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 512);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"GLTFImporter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  importer->SetRenderWindow(renderWindow);\n  importer->Update();\n\n  vtkNew<vtkLight> headLight;\n  headLight->SetLightTypeToHeadlight();\n  headLight->SwitchOn();\n  renderer->AddLight(headLight);\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(20);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/GLTFImporter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GLTFImporter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GLTFImporter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GLTFImporter MACOSX_BUNDLE GLTFImporter.cxx )\n  target_link_libraries(GLTFImporter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GLTFImporter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/GLTFImporter/#download-and-build-gltfimporter","title":"Download and Build GLTFImporter","text":"

Click here to download GLTFImporter and its CMakeLists.txt file. Once the tarball GLTFImporter.tar has been downloaded and extracted,

cd GLTFImporter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GLTFImporter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/GenericDataObjectReader/","title":"GenericDataObjectReader","text":"

vtk-examples/Cxx/IO/GenericDataObjectReader

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/GenericDataObjectReader/#code","title":"Code","text":"

GenericDataObjectReader.cxx

#include <vtkGenericDataObjectReader.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkStructuredGrid.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Ensure a filename was specified.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" InputFilename e.g. blow.vtk\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  // Get the filename from the command line.\n  std::string inputFilename = argv[1];\n\n  // Get all data from the file.\n  vtkNew<vtkGenericDataObjectReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // All of the standard data types can be checked and obtained like this:\n  if (reader->IsFilePolyData())\n  {\n    std::cout << \"output is polydata,\" << std::endl;\n    auto output = reader->GetPolyDataOutput();\n    std::cout << \"   output has \" << output->GetNumberOfPoints() << \" points.\"\n              << std::endl;\n  }\n\n  if (reader->IsFileUnstructuredGrid())\n  {\n    std::cout << \"output is unstructured grid,\" << std::endl;\n    auto output = reader->GetUnstructuredGridOutput();\n    std::cout << \"   output has \" << output->GetNumberOfPoints() << \" points.\"\n              << std::endl;\n  }\n\n  if (reader->IsFileStructuredGrid())\n  {\n    std::cout << \"output is structured grid,\" << std::endl;\n    auto output = reader->GetStructuredGridOutput();\n    std::cout << \"   output has \" << output->GetNumberOfPoints() << \" points.\"\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/GenericDataObjectReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GenericDataObjectReader)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOLegacy\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GenericDataObjectReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GenericDataObjectReader MACOSX_BUNDLE GenericDataObjectReader.cxx )\n  target_link_libraries(GenericDataObjectReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GenericDataObjectReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/GenericDataObjectReader/#download-and-build-genericdataobjectreader","title":"Download and Build GenericDataObjectReader","text":"

Click here to download GenericDataObjectReader and its CMakeLists.txt file. Once the tarball GenericDataObjectReader.tar has been downloaded and extracted,

cd GenericDataObjectReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GenericDataObjectReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/HDRReader/","title":"HDRReader","text":"

vtk-examples/Cxx/IO/HDRReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/HDRReader/#description","title":"Description","text":"

Demonstrates how to read high-dynamic-range imaging files.

A callback is used to print out the color window (move the mouse horizontally over the image) and color level (move the mouse vertically over the image).

This is based on IO/Image/Testing/Cxx/TestHDRReader.cxx in the VTK source files.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/HDRReader/#code","title":"Code","text":"

HDRReader.cxx

#include \"vtkHDRReader.h\"\n#include \"vtkImageData.h\"\n#include \"vtkImageViewer.h\"\n#include \"vtkNew.h\"\n#include \"vtkRenderWindowInteractor.h\"\n#include \"vtkRenderer.h\"\n#include <vtkCallbackCommand.h>\n\nnamespace {\nclass ColorCallback : public vtkCallbackCommand\n{\npublic:\n  static ColorCallback* New()\n  {\n    return new ColorCallback;\n  }\n  // Here we Create a vtkCallbackCommand and reimplement it.\n  void Execute(vtkObject* caller, unsigned long evId, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    // Just do this to demonstrate who called callback and the event that\n    // triggered it.\n    // std::cout << interactor->GetClassName() << \"  Event Id: \" << evId\n    //          << std::endl;\n\n    std::cout << \"Color window: \" << imageViewer->GetColorWindow();\n    std::cout << \" level: \" << imageViewer->GetColorLevel() << std::endl;\n  }\n  ColorCallback() : imageViewer(nullptr)\n  {\n  }\n  // Set pointers to any clientData or callData here.\n  vtkImageViewer* imageViewer;\n\nprivate:\n  ColorCallback(const ColorCallback&) = delete;\n  void operator=(const ColorCallback&) = delete;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc <= 1)\n  {\n    cout << \"Usage: \" << argv[0] << \" <hdr file>\" << endl;\n    cout << \"For example: Skyboxes/spiaggia_di_mondello_1k.hdr\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkHDRReader> reader;\n\n  // Check the image can be read\n  if (!reader->CanReadFile(filename.c_str()))\n  {\n    cerr << \"CanReadFile failed for \" << filename.c_str() << \"\\n\";\n    return EXIT_FAILURE;\n  }\n\n  reader->SetFileName(filename.c_str());\n  reader->UpdateInformation();\n\n  // Whole extent\n  const int* we = reader->GetDataExtent();\n  const int extents[6] = {we[0], we[1], we[2], we[3], 0, 0};\n  reader->UpdateExtent(extents);\n  // Visualize\n  vtkNew<vtkImageViewer> imageViewer;\n  imageViewer->SetInputData(reader->GetOutput());\n\n  imageViewer->SetColorWindow(1);\n  imageViewer->SetColorLevel(1);\n  imageViewer->SetPosition(0, 100);\n\n  vtkNew<ColorCallback> getColorWindow;\n  getColorWindow->imageViewer = imageViewer;\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  imageViewer->SetupInteractor(iren);\n  imageViewer->GetRenderWindow()->SetWindowName(\"HDRReader\");\n  imageViewer->Render();\n\n  iren->AddObserver(vtkCommand::EndInteractionEvent, getColorWindow);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/HDRReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HDRReader)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HDRReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HDRReader MACOSX_BUNDLE HDRReader.cxx )\n  target_link_libraries(HDRReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HDRReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/HDRReader/#download-and-build-hdrreader","title":"Download and Build HDRReader","text":"

Click here to download HDRReader and its CMakeLists.txt file. Once the tarball HDRReader.tar has been downloaded and extracted,

cd HDRReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HDRReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ImageReader2Factory/","title":"ImageReader2Factory","text":"

vtk-examples/Cxx/IO/ImageReader2Factory

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ImageReader2Factory/#description","title":"Description","text":"

Use vtkImageReader2Factory to read any of the supported vtk image formats.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ImageReader2Factory/#code","title":"Code","text":"

ImageReader2Factory.cxx

#include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  // Verify command line arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputFilename e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Parse command line arguments.\n  std::string inputFilename = argv[1];\n\n  // Read file.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imageReader;\n  imageReader.TakeReference(\n      readerFactory->CreateImageReader2(inputFilename.c_str()));\n  imageReader->SetFileName(inputFilename.c_str());\n  imageReader->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(imageReader->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Slate_grey\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageReader2Factory\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ImageReader2Factory/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageReader2Factory)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageReader2Factory: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageReader2Factory MACOSX_BUNDLE ImageReader2Factory.cxx )\n  target_link_libraries(ImageReader2Factory PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageReader2Factory\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ImageReader2Factory/#download-and-build-imagereader2factory","title":"Download and Build ImageReader2Factory","text":"

Click here to download ImageReader2Factory and its CMakeLists.txt file. Once the tarball ImageReader2Factory.tar has been downloaded and extracted,

cd ImageReader2Factory/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageReader2Factory\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ImageWriter/","title":"ImageWriter","text":"

vtk-examples/Cxx/IO/ImageWriter

"},{"location":"Cxx/IO/ImageWriter/#description","title":"Description","text":"

A generic function WriteImage() is provided that selects what image writer to use based on the file extenstion and then writes the render window to the file. The following formats are supported: BMP, JPEG, PNM, PNG, PostScript, TIFF.

If no file extension is specified, PNG is assumed.

The function WriteImage() is also available in the Snippets.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ImageWriter/#code","title":"Code","text":"

ImageWriter.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBMPWriter.h>\n#include <vtkImageWriter.h>\n#include <vtkJPEGWriter.h>\n#include <vtkPNGWriter.h>\n#include <vtkPNMWriter.h>\n#include <vtkPostScriptWriter.h>\n#include <vtkTIFFWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <array>\n#include <locale>\n#include <string>\n\nnamespace {\n\n/**\n *  Write the render window view to an image file.\n *\n *  Image types supported are:\n *    BMP, JPEG, PNM, PNG, PostScript, TIFF.\n *  The default parameters are used for all writers, change as needed.\n *\n *  @param fileName The file name, if no extension then PNG is assumed.\n *  @param renWin The render window.\n *  @param rgba Used to set the buffer type.\n *\n */\nvoid WriteImage(std::string const& fileName, vtkRenderWindow* renWin,\n                bool rgba = true);\n} // namespace\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the rendering window, renderer, and interactive renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the source.\n  vtkNew<vtkSphereSource> source;\n  source->SetCenter(0, 0, 0);\n  source->SetRadius(5.0);\n\n  // mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  // actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // color the actor\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // assign actor to the renderer\n  ren->AddActor(actor);\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  renWin->SetWindowName(\"ImageWriter\");\n  renWin->Render();\n\n  std::vector<std::string> ext = {{\"\"},      {\".png\"}, {\".jpg\"}, {\".ps\"},\n                                  {\".tiff\"}, {\".bmp\"}, {\".pnm\"}};\n  std::vector<std::string> filenames;\n  std::transform(ext.begin(), ext.end(), std::back_inserter(filenames),\n                 [](const std::string& e) { return \"ImageWriter\" + e; });\n  filenames[0] = filenames[0] + '1';\n  for (auto const& f : filenames)\n  {\n    WriteImage(f, renWin, false);\n  }\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid WriteImage(std::string const& fileName, vtkRenderWindow* renWin, bool rgba)\n{\n  if (!fileName.empty())\n  {\n    std::string fn = fileName;\n    std::string ext;\n    auto found = fn.find_last_of(\".\");\n    if (found == std::string::npos)\n    {\n      ext = \".png\";\n      fn += ext;\n    }\n    else\n    {\n      ext = fileName.substr(found, fileName.size());\n    }\n    std::locale loc;\n    std::transform(ext.begin(), ext.end(), ext.begin(),\n                   [=](char const& c) { return std::tolower(c, loc); });\n    auto writer = vtkSmartPointer<vtkImageWriter>::New();\n    if (ext == \".bmp\")\n    {\n      writer = vtkSmartPointer<vtkBMPWriter>::New();\n    }\n    else if (ext == \".jpg\")\n    {\n      writer = vtkSmartPointer<vtkJPEGWriter>::New();\n    }\n    else if (ext == \".pnm\")\n    {\n      writer = vtkSmartPointer<vtkPNMWriter>::New();\n    }\n    else if (ext == \".ps\")\n    {\n      if (rgba)\n      {\n        rgba = false;\n      }\n      writer = vtkSmartPointer<vtkPostScriptWriter>::New();\n    }\n    else if (ext == \".tiff\")\n    {\n      writer = vtkSmartPointer<vtkTIFFWriter>::New();\n    }\n    else\n    {\n      writer = vtkSmartPointer<vtkPNGWriter>::New();\n    }\n    vtkNew<vtkWindowToImageFilter> window_to_image_filter;\n    window_to_image_filter->SetInput(renWin);\n    window_to_image_filter->SetScale(1); // image quality\n    if (rgba)\n    {\n      window_to_image_filter->SetInputBufferTypeToRGBA();\n    }\n    else\n    {\n      window_to_image_filter->SetInputBufferTypeToRGB();\n    }\n    // Read from the front buffer.\n    window_to_image_filter->ReadFrontBufferOff();\n    window_to_image_filter->Update();\n\n    writer->SetFileName(fn.c_str());\n    writer->SetInputConnection(window_to_image_filter->GetOutputPort());\n    writer->Write();\n  }\n  else\n  {\n    std::cerr << \"No filename provided.\" << std::endl;\n  }\n\n  return;\n}\n\n} // namespace\n
"},{"location":"Cxx/IO/ImageWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageWriter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageWriter MACOSX_BUNDLE ImageWriter.cxx )\n  target_link_libraries(ImageWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ImageWriter/#download-and-build-imagewriter","title":"Download and Build ImageWriter","text":"

Click here to download ImageWriter and its CMakeLists.txt file. Once the tarball ImageWriter.tar has been downloaded and extracted,

cd ImageWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ImportPolyDataScene/","title":"ImportPolyDataScene","text":"

vtk-examples/Cxx/IO/ImportPolyDataScene

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ImportPolyDataScene/#code","title":"Code","text":"

ImportPolyDataScene.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCompositeDataSet.h>\n#include <vtkDataObjectTreeIterator.h>\n#include <vtkFieldData.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n#include <vtkXMLMultiBlockDataReader.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#include <vtkDataObjectTreeRange.h>\n#endif\n\nnamespace {\nvoid ImportMultiBlockScene(vtkRenderer* renderer, std::string fileName);\nvoid RestoreCameraFromFieldData(std::string const&, vtkCamera*, vtkPolyData*);\nvoid RestorePropertyFromFieldData(std::string const&, vtkProperty*,\n                                  vtkPolyData*);\nvoid RestoreActorFromFieldData(std::string const&, vtkActor*, vtkPolyData*);\n// These functions need to be written.\n// void RestoreMapperFromFieldData(std::string const&, vtkPolyDataMapper*,\n//                                vtkPolyData*);\n// void RestoreLookupTableFromFieldData(std::string const&, vtkScalarsToColors*,\n//                                     vtkPolyData*);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.vtp e.g. ExportBunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Visualization\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImportPolyDataScene\");\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  ImportMultiBlockScene(renderer.GetPointer(), std::string(argv[1]));\n  renderWindow->Render();\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid ImportMultiBlockScene(vtkRenderer* renderer, std::string fileName)\n{\n  vtkCamera* camera = renderer->GetActiveCamera();\n\n  // Read the multiblock data\n  // auto reader = vtkSmartPointer<vtkXMLMultiBlockDataReader>::New();\n  vtkNew<vtkXMLMultiBlockDataReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->Update();\n  std::cout << \"Importing \"\n            << dynamic_cast<vtkMultiBlockDataSet*>(reader->GetOutput())\n                   ->GetNumberOfBlocks()\n            << \" actors\" << std::endl;\n\n#if VTK890\n  vtkDataObjectTree* input =\n      dynamic_cast<vtkDataObjectTree*>(reader->GetOutput());\n\n  using Opts = vtk::DataObjectTreeOptions;\n  for (vtkDataObject* dso :\n       vtk::Range(input, Opts::SkipEmptyNodes | Opts::VisitOnlyLeaves))\n  {\n    vtkPolyData* pd = dynamic_cast<vtkPolyData*>(dso);\n    RestoreCameraFromFieldData(\"Camera\", camera, pd);\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(pd);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    RestorePropertyFromFieldData(\"Property\", actor->GetProperty(), pd);\n    vtkNew<vtkProperty> backProperty;\n    actor->SetBackfaceProperty(backProperty);\n    RestorePropertyFromFieldData(\"BackfaceProperty\",\n                                 actor->GetBackfaceProperty(), pd);\n    RestoreActorFromFieldData(\"Actor\", actor, pd);\n    renderer->AddActor(actor);\n  }\n#else\n  vtkCompositeDataSet* input =\n      dynamic_cast<vtkCompositeDataSet*>(reader->GetOutput());\n\n  vtkNew<vtkDataObjectTreeIterator> iter;\n  iter->SetDataSet(input);\n  iter->SkipEmptyNodesOn();\n  iter->VisitOnlyLeavesOn();\n  for (iter->InitTraversal(); !iter->IsDoneWithTraversal();\n       iter->GoToNextItem())\n  {\n    vtkDataObject* dso = iter->GetCurrentDataObject();\n    vtkPolyData* pd = dynamic_cast<vtkPolyData*>(dso);\n    RestoreCameraFromFieldData(\"Camera\", camera, pd);\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(pd);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    RestorePropertyFromFieldData(\"Property\", actor->GetProperty(), pd);\n    vtkNew<vtkProperty> backProperty;\n    actor->SetBackfaceProperty(backProperty);\n    RestorePropertyFromFieldData(\"BackfaceProperty\",\n                                 actor->GetBackfaceProperty(), pd);\n    RestoreActorFromFieldData(\"Actor\", actor, pd);\n    renderer->AddActor(actor);\n  }\n#endif\n}\nvoid RestoreCameraFromFieldData(std::string const& arrayPrefix,\n                                vtkCamera* camera, vtkPolyData* pd)\n{\n  vtkFieldData* fd = pd->GetFieldData();\n  camera->SetFocalPoint(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"FocalPoint\").c_str())\n          ->GetTuple(0));\n  camera->SetPosition(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Position\").c_str())\n          ->GetTuple(0));\n  camera->SetViewUp(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"ViewUp\").c_str())\n          ->GetTuple(0));\n  camera->SetClippingRange(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"ClippingRange\").c_str())\n          ->GetTuple(0));\n  camera->SetViewAngle(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"ViewAngle\").c_str())\n          ->GetTuple1(0));\n}\nvoid RestorePropertyFromFieldData(std::string const& arrayPrefix,\n                                  vtkProperty* property, vtkPolyData* pd)\n{\n  if (property)\n  {\n    vtkFieldData* fd = pd->GetFieldData();\n\n    property->SetAmbient(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Ambient\").c_str())\n            ->GetTuple1(0));\n    property->SetAmbientColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"AmbientColor\").c_str())\n            ->GetTuple(0));\n    property->SetAmbientColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"AmbientColor\").c_str())\n            ->GetTuple(0));\n    property->SetDiffuse(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Diffuse\").c_str())\n            ->GetTuple1(0));\n    property->SetDiffuseColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"DiffuseColor\").c_str())\n            ->GetTuple(0));\n    property->SetSpecular(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Specular\").c_str())\n            ->GetTuple1(0));\n    property->SetSpecularColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"SpecularColor\").c_str())\n            ->GetTuple(0));\n    property->SetSpecularPower(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"SpecularPower\").c_str())\n            ->GetTuple1(0));\n    property->SetEdgeColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"EdgeColor\").c_str())\n            ->GetTuple(0));\n    property->SetEdgeVisibility(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"EdgeVisibility\").c_str())\n            ->GetTuple1(0));\n    property->SetVertexColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"VertexColor\").c_str())\n            ->GetTuple(0));\n    property->SetVertexVisibility(\n        fd->GetArray(\n              std::string(arrayPrefix + \":\" + \"VertexVisibility\").c_str())\n            ->GetTuple1(0));\n    property->SetInterpolation(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Interpolation\").c_str())\n            ->GetTuple1(0));\n    property->SetOpacity(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Opacity\").c_str())\n            ->GetTuple1(0));\n    property->SetRepresentation(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Representation\").c_str())\n            ->GetTuple1(0));\n    property->SetBackfaceCulling(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"BackfaceCulling\").c_str())\n            ->GetTuple1(0));\n    property->SetFrontfaceCulling(\n        fd->GetArray(\n              std::string(arrayPrefix + \":\" + \"FrontfaceCulling\").c_str())\n            ->GetTuple1(0));\n    property->SetPointSize(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"PointSize\").c_str())\n            ->GetTuple1(0));\n    property->SetLineWidth(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"LineWidth\").c_str())\n            ->GetTuple1(0));\n    property->SetLineStipplePattern(\n        fd->GetArray(\n              std::string(arrayPrefix + \":\" + \"LineStipplePattern\").c_str())\n            ->GetTuple1(0));\n    property->SetLineStippleRepeatFactor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"LineStippleRepeatFactor\")\n                         .c_str())\n            ->GetTuple1(0));\n    property->SetLighting(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Lighting\").c_str())\n                    ->GetTuple1(0) == 1.0\n            ? true\n            : false);\n    property->SetRenderPointsAsSpheres(\n        fd->GetArray(\n              std::string(arrayPrefix + \":\" + \"RenderPointsAsSpheres\").c_str())\n                    ->GetTuple1(0) == 1.0\n            ? true\n            : false);\n    property->SetRenderLinesAsTubes(\n        fd->GetArray(\n              std::string(arrayPrefix + \":\" + \"RenderLinesAsTubes\").c_str())\n                    ->GetTuple1(0) == 1.0\n            ? true\n            : false);\n    property->SetShading(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Shading\").c_str())\n                    ->GetTuple1(0) == 1.0\n            ? true\n            : false);\n  }\n}\nvoid RestoreActorFromFieldData(std::string const& arrayPrefix, vtkActor* actor,\n                               vtkPolyData* pd)\n{\n  vtkFieldData* fd = pd->GetFieldData();\n\n  actor->SetDragable(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Dragable\").c_str())\n                  ->GetTuple1(0) == 1.0\n          ? true\n          : false);\n  actor->SetPickable(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Pickable\").c_str())\n                  ->GetTuple1(0) == 1.0\n          ? true\n          : false);\n  actor->SetVisibility(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Visibility\").c_str())\n          ->GetTuple1(0));\n  actor->SetPosition(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Position\").c_str())\n          ->GetTuple(0));\n  actor->SetOrientation(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Orientation\").c_str())\n          ->GetTuple(0));\n  actor->SetOrigin(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Origin\").c_str())\n          ->GetTuple(0));\n  actor->SetScale(fd->GetArray(std::string(arrayPrefix + \":\" + \"Scale\").c_str())\n                      ->GetTuple(0));\n  actor->SetForceOpaque(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"ForceOpaque\").c_str())\n                  ->GetTuple1(0) == 1.0\n          ? true\n          : false);\n  actor->SetForceTranslucent(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"ForceTranslucent\").c_str())\n                  ->GetTuple1(0) == 1.0\n          ? true\n          : false);\n}\n} // namespace\n
"},{"location":"Cxx/IO/ImportPolyDataScene/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImportPolyDataScene)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImportPolyDataScene: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImportPolyDataScene MACOSX_BUNDLE ImportPolyDataScene.cxx )\n  target_link_libraries(ImportPolyDataScene PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImportPolyDataScene\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ImportPolyDataScene/#download-and-build-importpolydatascene","title":"Download and Build ImportPolyDataScene","text":"

Click here to download ImportPolyDataScene and its CMakeLists.txt file. Once the tarball ImportPolyDataScene.tar has been downloaded and extracted,

cd ImportPolyDataScene/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImportPolyDataScene\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ImportToExport/","title":"ImportToExport","text":"

vtk-examples/Cxx/IO/ImportToExport

"},{"location":"Cxx/IO/ImportToExport/#description","title":"Description","text":"

This example imports one of vtk3DSImporter, vtkGLTFImporter, vtkOBJImporter or vtkVRMLImporter and exports the scene using one of vtkOBJExporter

The parameters are the input file(s) and an export file name with extension.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ImportToExport/#code","title":"Code","text":"

ImportToExport.cxx

#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Importers\n#include <vtk3DSImporter.h>\n#include <vtkGLTFImporter.h>\n#include <vtkOBJImporter.h>\n#include <vtkVRMLImporter.h>\n\n// Exporters\n#include <vtkGLTFExporter.h>\n// #include <vtkIVExporter.h>\n#include <vtkOBJExporter.h>\n// #include <vtkOOGLExporter.h>\n// #include <vtkRIBExporter.h>\n// #include <vtkSVGExporter.h>\n#include <vtkVRMLExporter.h>\n#include <vtkX3DExporter.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <iterator>  // For prev\n#include <set>       // For valid extensions\n#include <sstream>   // For stringstream\n#include <string>    // For find_last_of()\n\nint main(int argc, char* argv[])\n{\n  auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();\n  auto renderer = vtkSmartPointer<vtkRenderer>::New();\n\n  if (argc < 3)\n  {\n    std::cerr << \"Expects input file name(s) and an output filename e.g. \"\n                 \"iflamingo.3ds iflamingo.obj\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n  std::string extension = \"\";\n  int outputFileArgOffset = 0; // depends on importer\n\n  std::set<std::string> inputExtensions{{\n      \"3ds\",\n      \"glb\",\n      \"gltf\",\n      \"obj\",\n      \"wrl\",\n  }};\n  std::set<std::string> outputExtensions{{\n      \"glb\",\n      \"gltf\",\n      \"obj\",\n      \"wrl\",\n      \"x3d\",\n  }};\n\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\") + 1);\n  }\n  if (inputExtensions.find(extension) == inputExtensions.end())\n  {\n    std::cout << \"Invalid input extension.\\nValid extensions are: \"\n              << std::endl;\n    for (auto it = inputExtensions.begin(); it != inputExtensions.end(); ++it)\n    {\n      if (it != std::prev(inputExtensions.end()))\n      {\n        std::cout << *it << \", \";\n      }\n      else\n      {\n        std::cout << *it << std::endl;\n      }\n    }\n    return EXIT_FAILURE;\n  }\n\n  if (extension == \"wrl\")\n  {\n    vtkNew<vtkVRMLImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(renderWindow);\n    renderWindow = importer->GetRenderWindow();\n    renderer = importer->GetRenderer();\n    importer->Read();\n    outputFileArgOffset = 2;\n  }\n  else if (extension == \"3ds\")\n  {\n    vtkNew<vtk3DSImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(renderWindow);\n    importer->ComputeNormalsOn();\n    renderWindow = importer->GetRenderWindow();\n    renderer = importer->GetRenderer();\n    importer->Read();\n    outputFileArgOffset = 2;\n  }\n  else if (extension == \"gltf\" || extension == \"glb\")\n  {\n    vtkNew<vtkGLTFImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(renderWindow);\n    renderWindow = importer->GetRenderWindow();\n    renderer = importer->GetRenderer();\n    importer->Read();\n    outputFileArgOffset = 2;\n  }\n  else if (extension == \"obj\")\n  {\n    vtkNew<vtkOBJImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetFileNameMTL(argv[2]);\n    importer->SetTexturePath(argv[3]);\n    importer->SetRenderWindow(renderWindow);\n    renderWindow = importer->GetRenderWindow();\n    renderer = importer->GetRenderer();\n    importer->Read();\n    outputFileArgOffset = 4;\n  }\n\n  std::string outputFileName = argv[outputFileArgOffset];\n  std::string outputExtension{\"\"};\n  // Split the file path and extension\n  if (outputFileName.find_last_of(\".\") != std::string::npos)\n  {\n    outputExtension =\n        outputFileName.substr(outputFileName.find_last_of(\".\") + 1);\n    auto pos = outputFileName.rfind(\".\", outputFileName.length());\n    if (pos != std::string::npos)\n    {\n      outputFileName = outputFileName.substr(0, pos);\n    }\n  }\n  std::transform(outputExtension.begin(), outputExtension.end(),\n                 outputExtension.begin(), ::tolower);\n\n  if (outputExtensions.find(outputExtension) == outputExtensions.end())\n  {\n    std::cout << \"Invalid output extension.\\nValid extensions are: \"\n              << std::endl;\n    for (auto it = outputExtensions.begin(); it != outputExtensions.end(); ++it)\n    {\n      if (it != std::prev(outputExtensions.end()))\n      {\n        std::cout << *it << \", \";\n      }\n      else\n      {\n        std::cout << *it << std::endl;\n      }\n    }\n    return EXIT_FAILURE;\n  }\n\n  if (outputExtension == \"obj\")\n  {\n    std::string exportFileName;\n    exportFileName = outputFileName + \".\" + outputExtension;\n    vtkNew<vtkOBJExporter> exporter;\n    std::stringstream comment;\n    comment << \"Converted by ImportExport from \" << fileName;\n    exporter->SetOBJFileComment(comment.str().c_str());\n    exporter->SetMTLFileComment(comment.str().c_str());\n    exporter->SetActiveRenderer(renderer);\n    exporter->SetRenderWindow(renderWindow);\n    exporter->SetFilePrefix(outputFileName.c_str());\n    std::cout << \"Writing \" << exportFileName << std::endl;\n    exporter->Write();\n  }\n  else if (outputExtension == \"wrl\")\n  {\n    std::string exportFileName;\n    exportFileName = outputFileName + \".\" + outputExtension;\n    vtkNew<vtkVRMLExporter> exporter;\n    exporter->SetFileName(exportFileName.c_str());\n    exporter->SetActiveRenderer(renderer);\n    exporter->SetRenderWindow(renderWindow);\n    std::cout << \"Writing \" << exportFileName << std::endl;\n    exporter->Write();\n  }\n  else if (outputExtension == \"gltf\" || outputExtension == \"glb\")\n  {\n    std::string exportFileName;\n    exportFileName = outputFileName + \".\" + \"gltf\";\n    vtkNew<vtkGLTFExporter> exporter;\n    exporter->SetFileName(exportFileName.c_str());\n    exporter->SetActiveRenderer(renderer);\n    exporter->SetRenderWindow(renderWindow);\n    std::cout << \"Writing \" << exportFileName << std::endl;\n    exporter->Write();\n  }\n  else if (outputExtension == \"x3d\")\n  {\n    std::string exportFileName;\n    exportFileName = outputFileName + \".\" + outputExtension;\n    vtkNew<vtkX3DExporter> exporter;\n    exporter->SetFileName(exportFileName.c_str());\n    exporter->SetActiveRenderer(renderer);\n    exporter->SetRenderWindow(renderWindow);\n    std::cout << \"Writing \" << exportFileName << std::endl;\n    exporter->Write();\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ImportToExport/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImportToExport)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOExport\n  IOExportOpenGL2\n  IOExportPDF\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImportToExport: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImportToExport MACOSX_BUNDLE ImportToExport.cxx )\n  target_link_libraries(ImportToExport PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImportToExport\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ImportToExport/#download-and-build-importtoexport","title":"Download and Build ImportToExport","text":"

Click here to download ImportToExport and its CMakeLists.txt file. Once the tarball ImportToExport.tar has been downloaded and extracted,

cd ImportToExport/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImportToExport\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/IndividualVRML/","title":"IndividualVRML","text":"

vtk-examples/Cxx/IO/IndividualVRML

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/IndividualVRML/#description","title":"Description","text":"

This example shows how to obtain each object of a scene and get it's initial transformation. The selected actor is represented in wireframe. To run this example:

IndividualVRML filename actorname\n

The .wrl file must contain a Shape with a DEF name.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/IndividualVRML/#code","title":"Code","text":"

IndividualVRML.cxx

#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkVRMLImporter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 3)\n  {\n    std::cout << \"Required arguments: Filename Actorname e.g. teapot.wrl teapot\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n  std::cout << \"Showing \" << argv[2] << \" from \" << filename << std::endl;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"IndividualVRML\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // VRML Import.\n  vtkNew<vtkVRMLImporter> importer;\n  importer->SetFileName(filename.c_str());\n  importer->Read();\n  importer->SetRenderWindow(renderWindow);\n  importer->Update();\n\n  // ----------------------------------------------------------\n  vtkObject* defActor = importer->GetVRMLDEFObject(argv[2]);\n  if (defActor == NULL)\n  {\n    std::cout << \"Cannot locate actor \" << argv[2] << \" in \" << filename\n              << std::endl;\n    importer->Print(std::cout);\n    return EXIT_FAILURE;\n  }\n\n  vtkActor* actor = static_cast<vtkActor*>(defActor);\n  double color[3] = {0.89, 0.81, 0.34};\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkTransform> transform;\n\n  transform->Translate(actor->GetCenter()[0], actor->GetCenter()[1],\n                       actor->GetCenter()[2]);\n  // axes\n  vtkNew<vtkAxesActor> axes;\n\n  double l[3];\n  l[0] = (actor->GetBounds()[1] - actor->GetBounds()[0]) * 1.5;\n  l[1] = (actor->GetBounds()[3] - actor->GetBounds()[2]) * 1.5;\n  l[2] = (actor->GetBounds()[5] - actor->GetBounds()[4]) * 1.5;\n\n  axes->SetTotalLength(l);\n  axes->SetUserTransform(transform);\n  renderer->AddActor(axes);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->SetPosition(-14.8296, 18.1304, 12.3352);\n  renderer->GetActiveCamera()->SetFocalPoint(2.09905, 0.0832915, 2.47961);\n  renderer->GetActiveCamera()->SetViewUp(0.262918, -0.260671, 0.928937);\n  renderer->GetActiveCamera()->SetDistance(26.6348);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/IndividualVRML/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IndividualVRML)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  IOImport\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IndividualVRML: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IndividualVRML MACOSX_BUNDLE IndividualVRML.cxx )\n  target_link_libraries(IndividualVRML PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IndividualVRML\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/IndividualVRML/#download-and-build-individualvrml","title":"Download and Build IndividualVRML","text":"

Click here to download IndividualVRML and its CMakeLists.txt file. Once the tarball IndividualVRML.tar has been downloaded and extracted,

cd IndividualVRML/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IndividualVRML\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/JPEGReader/","title":"JPEGReader","text":"

vtk-examples/Cxx/IO/JPEGReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/JPEGReader/#description","title":"Description","text":"

This example shows how to read a JPG image file.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/JPEGReader/#code","title":"Code","text":"

JPEGReader.cxx

#include <vtkImageViewer2.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" Filename(.jpeg/jpg) e.g. Pileated.jpg \" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkJPEGReader> jpegReader;\n  jpegReader->SetFileName(argv[1]);\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(jpegReader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"JPEGReader\");\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/JPEGReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(JPEGReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"JPEGReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(JPEGReader MACOSX_BUNDLE JPEGReader.cxx )\n  target_link_libraries(JPEGReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS JPEGReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/JPEGReader/#download-and-build-jpegreader","title":"Download and Build JPEGReader","text":"

Click here to download JPEGReader and its CMakeLists.txt file. Once the tarball JPEGReader.tar has been downloaded and extracted,

cd JPEGReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./JPEGReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/JPEGWriter/","title":"JPEGWriter","text":"

vtk-examples/Cxx/IO/JPEGWriter

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/JPEGWriter/#code","title":"Code","text":"

JPEGWriter.cxx

#include <vtkImageCanvasSource2D.h>\n#include <vtkJPEGWriter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n\n#include <array>\n\nint main(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])\n{\n  std::string outputFilename = \"output.jpg\";\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"DeepSkyBlue\").GetData();\n  auto color2 = colors->GetColor3ub(\"PaleGoldenrod\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create a 100x100 image to save into the jpeg file\n  int extent[6] = {0, 99, 0, 99, 0, 0};\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetExtent(extent);\n  imageSource->SetScalarTypeToUnsignedChar(); // vtkJPEGWriter only accepts\n                                              // unsigned char input\n  imageSource->SetNumberOfScalarComponents(\n      3); // 3 color channels: Red, Green and Blue\n\n  // Fill the whole image with a bluish background\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(extent[0], extent[1], extent[2], extent[3]);\n\n  // Paint a 30x30 yellowish square into the image\n  imageSource->SetDrawColor(drawColor2.data());\n  imageSource->FillBox(40, 70, 20, 50);\n\n  vtkNew<vtkJPEGWriter> writer;\n  writer->SetFileName(outputFilename.c_str());\n  writer->SetInputConnection(imageSource->GetOutputPort());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/JPEGWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(JPEGWriter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"JPEGWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(JPEGWriter MACOSX_BUNDLE JPEGWriter.cxx )\n  target_link_libraries(JPEGWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS JPEGWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/JPEGWriter/#download-and-build-jpegwriter","title":"Download and Build JPEGWriter","text":"

Click here to download JPEGWriter and its CMakeLists.txt file. Once the tarball JPEGWriter.tar has been downloaded and extracted,

cd JPEGWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./JPEGWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/MetaImageReader/","title":"MetaImageReader","text":"

vtk-examples/Cxx/IO/MetaImageReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/MetaImageReader/#code","title":"Code","text":"

MetaImageReader.cxx

#include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFilename;\n\n  if (argc < 2)\n  {\n    std::cerr << \"Required arguments: image.mha e.g. Gourds.mha\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  inputFilename = argv[1];\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MetaImageReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/MetaImageReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MetaImageReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MetaImageReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MetaImageReader MACOSX_BUNDLE MetaImageReader.cxx )\n  target_link_libraries(MetaImageReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MetaImageReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/MetaImageReader/#download-and-build-metaimagereader","title":"Download and Build MetaImageReader","text":"

Click here to download MetaImageReader and its CMakeLists.txt file. Once the tarball MetaImageReader.tar has been downloaded and extracted,

cd MetaImageReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MetaImageReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/MetaImageWriter/","title":"MetaImageWriter","text":"

vtk-examples/Cxx/IO/MetaImageWriter

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/MetaImageWriter/#code","title":"Code","text":"

MetaImageWriter.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkMetaImageReader.h>\n#include <vtkMetaImageWriter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // adapt path !\n  std::string filePath = \"julia_mha.mhd\";\n  std::string filePathRaw = \"julia_mha.raw\";\n  // Create an image\n  vtkNew<vtkImageMandelbrotSource> source;\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->Update();\n\n  vtkNew<vtkMetaImageWriter> writer;\n  writer->SetInputConnection(castFilter->GetOutputPort());\n  writer->SetFileName(filePath.c_str());\n  writer->SetRAWFileName(filePathRaw.c_str());\n  writer->Write();\n\n  // Read and display file for verification that it was written correctly\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(filePath.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->SetWindowName(\"MetaImageWriter\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/MetaImageWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MetaImageWriter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MetaImageWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MetaImageWriter MACOSX_BUNDLE MetaImageWriter.cxx )\n  target_link_libraries(MetaImageWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MetaImageWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/MetaImageWriter/#download-and-build-metaimagewriter","title":"Download and Build MetaImageWriter","text":"

Click here to download MetaImageWriter and its CMakeLists.txt file. Once the tarball MetaImageWriter.tar has been downloaded and extracted,

cd MetaImageWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MetaImageWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/OBJImporter/","title":"OBJImporter","text":"

vtk-examples/Cxx/IO/OBJImporter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/OBJImporter/#code","title":"Code","text":"

OBJImporter.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJImporter.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 4)\n  {\n    std::cout\n        << \"Usage: \" << argv[0]\n        << \" objfile mtlfile texturepath e.g. doorman.obj doorman.mtl doorman\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkOBJImporter> importer;\n  importer->SetFileName(argv[1]);\n  importer->SetFileNameMTL(argv[2]);\n  importer->SetTexturePath(argv[3]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  renderer->SetBackground2(colors->GetColor3d(\"Silver\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"Gold\").GetData());\n  renderer->GradientBackgroundOn();\n  renWin->AddRenderer(renderer);\n  renderer->UseHiddenLineRemovalOn();\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"OBJImporter\");\n\n  iren->SetRenderWindow(renWin);\n  importer->SetRenderWindow(renWin);\n  importer->Update();\n\n  auto actors = renderer->GetActors();\n  actors->InitTraversal();\n  std::cout << \"There are \" << actors->GetNumberOfItems() << \" actors\"\n            << std::endl;\n\n  for (vtkIdType a = 0; a < actors->GetNumberOfItems(); ++a)\n  {\n    std::cout << importer->GetOutputDescription(a) << std::endl;\n\n    vtkActor* actor = actors->GetNextActor();\n\n    // OBJImporter turns texture interpolation off\n    if (actor->GetTexture())\n    {\n      std::cout << \"Has texture\\n\";\n      actor->GetTexture()->InterpolateOn();\n    }\n\n    vtkPolyData* pd =\n        dynamic_cast<vtkPolyData*>(actor->GetMapper()->GetInput());\n\n    vtkPolyDataMapper* mapper =\n        dynamic_cast<vtkPolyDataMapper*>(actor->GetMapper());\n    mapper->SetInputData(pd);\n  }\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/OBJImporter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OBJImporter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OBJImporter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OBJImporter MACOSX_BUNDLE OBJImporter.cxx )\n  target_link_libraries(OBJImporter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OBJImporter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/OBJImporter/#download-and-build-objimporter","title":"Download and Build OBJImporter","text":"

Click here to download OBJImporter and its CMakeLists.txt file. Once the tarball OBJImporter.tar has been downloaded and extracted,

cd OBJImporter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OBJImporter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/PNGReader/","title":"PNGReader","text":"

vtk-examples/Cxx/IO/PNGReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/PNGReader/#description","title":"Description","text":"

This example demonstrates how to read a PNG image file.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/PNGReader/#code","title":"Code","text":"

PNGReader.cxx

#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.png) e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"PNGReader\");\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/PNGReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PNGReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PNGReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PNGReader MACOSX_BUNDLE PNGReader.cxx )\n  target_link_libraries(PNGReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PNGReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/PNGReader/#download-and-build-pngreader","title":"Download and Build PNGReader","text":"

Click here to download PNGReader and its CMakeLists.txt file. Once the tarball PNGReader.tar has been downloaded and extracted,

cd PNGReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PNGReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/PNGWriter/","title":"PNGWriter","text":"

vtk-examples/Cxx/IO/PNGWriter

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/PNGWriter/#code","title":"Code","text":"

PNGWriter.cxx

#include <vtkImageCanvasSource2D.h>\n#include <vtkImageCast.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  std::string outputFilename;\n  if (argc > 1)\n  {\n    outputFilename = argv[1];\n  }\n  else\n  {\n    outputFilename = \"output.png\";\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"MediumOrchid\").GetData();\n  auto color2 = colors->GetColor3ub(\"DarkGreen\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  int extent[6] = {0, 99, 0, 99, 0, 0};\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetExtent(extent);\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(0, 99, 0, 99);\n  imageSource->SetDrawColor(drawColor2.data());\n  imageSource->FillBox(40, 70, 20, 50);\n  imageSource->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->SetInputConnection(imageSource->GetOutputPort());\n  castFilter->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(outputFilename.c_str());\n  writer->SetInputConnection(castFilter->GetOutputPort());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/PNGWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PNGWriter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PNGWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PNGWriter MACOSX_BUNDLE PNGWriter.cxx )\n  target_link_libraries(PNGWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PNGWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/PNGWriter/#download-and-build-pngwriter","title":"Download and Build PNGWriter","text":"

Click here to download PNGWriter and its CMakeLists.txt file. Once the tarball PNGWriter.tar has been downloaded and extracted,

cd PNGWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PNGWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ParticleReader/","title":"ParticleReader","text":"

vtk-examples/Cxx/IO/ParticleReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ParticleReader/#description","title":"Description","text":"

This example reads ascii files where each line consists of points with its position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file format.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ParticleReader/#code","title":"Code","text":"

ParticleReader.cxx

//\n// This example reads ascii files where each line consists of points with its\n// position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file\n// format.\n//\n// some standard vtk headers\n#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParticleReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n// needed to easily convert int to std::string\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.raw) e.g. Particles.raw\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filePath = argv[1];\n  // Particles.raw supplied by VTK is big endian encoded\n  // std::string filePath = \"C:\\\\VTK\\\\vtkdata-5.8.0\\\\Data\\\\Particles.raw\";\n  // Read the file\n  vtkNew<vtkParticleReader> reader;\n\n  reader->SetFileName(filePath.c_str());\n  // if nothing gets displayed or totally wrong, swap the endianness\n  reader->SetDataByteOrderToBigEndian();\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n  std::cout << \"number of pieces: \" << mapper->GetNumberOfPieces() << std::endl;\n  mapper->SetScalarRange(4, 9);\n\n  vtkNew<vtkActor> actor;\n\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(4);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ParticleReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ParticleReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParticleReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParticleReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParticleReader MACOSX_BUNDLE ParticleReader.cxx )\n  target_link_libraries(ParticleReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParticleReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ParticleReader/#download-and-build-particlereader","title":"Download and Build ParticleReader","text":"

Click here to download ParticleReader and its CMakeLists.txt file. Once the tarball ParticleReader.tar has been downloaded and extracted,

cd ParticleReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ParticleReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadAllPolyDataTypes/","title":"ReadAllPolyDataTypes","text":"

vtk-examples/Cxx/IO/ReadAllPolyDataTypes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadAllPolyDataTypes/#description","title":"Description","text":"

This example selects the vtkPolyData reader by inspecting the extension of the file. The example processes every file passed as an argument. This assumes all of the files are modeled in the same coordinate system.

Info

The procedure ReadPolyData is a reusable procedure. Copy and paste it into other examples that can benefit from reading any vtkPolyData.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadAllPolyDataTypes/#code","title":"Code","text":"

ReadAllPolyDataTypes.cxx

#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <algorithm>\n#include <array>\n#include <random>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Vis Pipeline\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  // Note: If a Python version is written, it is probably best to use\n  //       vtkMinimalStandardRandomSequence in it and here, to ensure\n  //       that the random number generation is the same.\n  std::mt19937 mt(4355412); // Standard mersenne_twister_engine\n  std::uniform_real_distribution<double> distribution(0.6, 1.0);\n\n  // PolyData file pipeline\n  for (int i = 1; i < argc; ++i)\n  {\n    std::cout << \"Loading: \" << argv[i] << std::endl;\n    auto polyData = ReadPolyData(argv[i]);\n\n    // Visualize\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(polyData);\n\n    std::array<double, 3> randomColor;\n    randomColor[0] = distribution(mt);\n    randomColor[1] = distribution(mt);\n    randomColor[2] = distribution(mt);\n    vtkNew<vtkProperty> backProp;\n    backProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n    backProp->SetSpecular(0.6);\n    backProp->SetSpecularPower(30);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->SetBackfaceProperty(backProp);\n    actor->GetProperty()->SetDiffuseColor(randomColor.data());\n    actor->GetProperty()->SetSpecular(0.3);\n    actor->GetProperty()->SetSpecularPower(30);\n    renderer->AddActor(actor);\n  }\n\n  renderWindow->SetWindowName(\"ReadAllPolyDataTypes\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n\n  // Drop the case of the extension\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/IO/ReadAllPolyDataTypes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadAllPolyDataTypes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadAllPolyDataTypes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadAllPolyDataTypes MACOSX_BUNDLE ReadAllPolyDataTypes.cxx )\n  target_link_libraries(ReadAllPolyDataTypes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadAllPolyDataTypes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadAllPolyDataTypes/#download-and-build-readallpolydatatypes","title":"Download and Build ReadAllPolyDataTypes","text":"

Click here to download ReadAllPolyDataTypes and its CMakeLists.txt file. Once the tarball ReadAllPolyDataTypes.tar has been downloaded and extracted,

cd ReadAllPolyDataTypes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadAllPolyDataTypes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadAllPolyDataTypesDemo/","title":"ReadAllPolyDataTypesDemo","text":"

vtk-examples/Cxx/IO/ReadAllPolyDataTypesDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadAllPolyDataTypesDemo/#description","title":"Description","text":"

This example displays a model from each of the supported vtkPolyData readers.

Info

The example reuses two procedures: ReadPolyData introduced in ReadAllPolyDataTypes and ViewportBorder introduced in ViewportBorders.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadAllPolyDataTypesDemo/#code","title":"Code","text":"

ReadAllPolyDataTypesDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkCoordinate.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkPolyDataReader.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <algorithm>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n\nvoid ViewportBorder(vtkSmartPointer<vtkRenderer>& renderer, double* color,\n                    bool last = false);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetColor(0.3, 0.3, 0.3);\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  for (auto i = 1; i < argc; ++i)\n  {\n    std::cout << argv[i] << std::endl;\n    auto polyData = ReadPolyData(argv[i]);\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(polyData);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"Light_salmon\").GetData());\n    actor->GetProperty()->SetSpecular(0.6);\n    actor->GetProperty()->SetSpecularPower(30);\n\n    // Create textActors\n    vtkNew<vtkTextMapper> textMapper;\n    textMapper->SetTextProperty(textProperty);\n    textMapper->SetInput(vtksys::SystemTools::GetFilenameName(argv[i]).c_str());\n\n    vtkNew<vtkActor2D> textActor;\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(20, 20);\n\n    // Setup renderer\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(actor);\n    renderer->AddActor(textActor);\n    renderer->SetBackground(colors->GetColor3d(\"mint\").GetData());\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n  }\n\n  // Setup viewports for the renderers\n  auto rendererSize = 400;\n  auto xGridDimensions = 3;\n  auto yGridDimensions = 2;\n  yGridDimensions = argc / xGridDimensions;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  auto blank = argc - 1 + ((argc - 1) % xGridDimensions);\n  for (auto i = argc; i < blank; ++i)\n  {\n    vtkNew<vtkRenderer> renderer;\n    renderer->SetBackground(colors->GetColor3d(\"White\").GetData());\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n  }\n\n  for (auto row = 0; row < yGridDimensions; row++)\n  {\n    for (auto col = 0; col < xGridDimensions; col++)\n    {\n      auto index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      renderers[index]->SetViewport(viewport);\n      ViewportBorder(renderers[index],\n                     colors->GetColor3d(\"SlateGray\").GetData(),\n                     col == static_cast<int>(xGridDimensions));\n    }\n  }\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetWindowName(\"ReadAllPolyDataTypesDemo\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n\n  // Drop the case of the extension\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\n// draw the borders of a renderer's viewport\nvoid ViewportBorder(vtkSmartPointer<vtkRenderer>& renderer, double* color,\n                    bool last)\n{\n  // points start at upper right and proceed anti-clockwise\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  // create cells, and lines\n  vtkNew<vtkCellArray> cells;\n  cells->Initialize();\n\n  vtkNew<vtkPolyLine> lines;\n\n  // only draw last line if this is the last viewport\n  // this prevents double vertical lines at right border\n  // if different colors are used for each border, then do\n  // not specify last\n  if (last)\n  {\n    lines->GetPointIds()->SetNumberOfIds(5);\n  }\n  else\n  {\n    lines->GetPointIds()->SetNumberOfIds(4);\n  }\n  for (unsigned int i = 0; i < 4; ++i)\n  {\n    lines->GetPointIds()->SetId(i, i);\n  }\n  if (last)\n  {\n    lines->GetPointIds()->SetId(4, 0);\n  }\n  cells->InsertNextCell(lines);\n\n  // now make the polydata and display it\n  vtkNew<vtkPolyData> poly;\n  poly->Initialize();\n  poly->SetPoints(points);\n  poly->SetLines(cells);\n\n  // use normalized viewport coordinates since\n  // they are independent of window size\n  vtkNew<vtkCoordinate> coordinate;\n  coordinate->SetCoordinateSystemToNormalizedViewport();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(poly);\n  mapper->SetTransformCoordinate(coordinate);\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(color);\n\n  // line width should be at least 2 to be visible at extremes\n  actor->GetProperty()->SetLineWidth(4.0); // Line Width\n\n  renderer->AddViewProp(actor);\n}\n\n} // namespace\n
"},{"location":"Cxx/IO/ReadAllPolyDataTypesDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadAllPolyDataTypesDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadAllPolyDataTypesDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadAllPolyDataTypesDemo MACOSX_BUNDLE ReadAllPolyDataTypesDemo.cxx )\n  target_link_libraries(ReadAllPolyDataTypesDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadAllPolyDataTypesDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadAllPolyDataTypesDemo/#download-and-build-readallpolydatatypesdemo","title":"Download and Build ReadAllPolyDataTypesDemo","text":"

Click here to download ReadAllPolyDataTypesDemo and its CMakeLists.txt file. Once the tarball ReadAllPolyDataTypesDemo.tar has been downloaded and extracted,

cd ReadAllPolyDataTypesDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadAllPolyDataTypesDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadAllUnstructuredGridTypes/","title":"ReadAllUnstructuredGridTypes","text":"

vtk-examples/Cxx/IO/ReadAllUnstructuredGridTypes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadAllUnstructuredGridTypes/#description","title":"Description","text":"

The example reads a vtkUnstructuredGrid with vtkXMLUnstructuredGridReader if the extension is .vtu or the legacy vtkUnstructuredGridReader if the extension is .vtk. If a file is not present, the example creates a vtkUnstructuredGrid by passing a vtkSphere through vtkAppendFilter.

For a description of the VTK File Formats see VTKFileFormats.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadAllUnstructuredGridTypes/#code","title":"Code","text":"

ReadAllUnstructuredGridTypes.cxx

#include <vtkAppendFilter.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <algorithm>\n#include <array>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid>\nReadUnstructuredGrid(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Vis Pipeline\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  std::cout << \"Loading: \" << argv[1] << std::endl;\n  auto unstructuredGrid = ReadUnstructuredGrid(std::string(argv[1]));\n\n  // Visualize\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(unstructuredGrid);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  backProp->SetSpecular(.6);\n  backProp->SetSpecularPower(30);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProp);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetSpecular(.3);\n  actor->GetProperty()->SetSpecularPower(30);\n  actor->GetProperty()->EdgeVisibilityOn();\n  renderer->AddActor(actor);\n  renderer->GetActiveCamera()->Azimuth(45);\n  renderer->GetActiveCamera()->Elevation(45);\n  renderer->ResetCamera();\n  renderWindow->SetWindowName(\"ReadAllUnstructuredGridTypes\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid>\nReadUnstructuredGrid(std::string const& fileName)\n{\n  vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n\n  // Drop the case of the extension\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n\n  if (extension == \".vtu\")\n  {\n    vtkNew<vtkXMLUnstructuredGridReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    unstructuredGrid = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkUnstructuredGridReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    unstructuredGrid = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    vtkNew<vtkAppendFilter> appendFilter;\n    appendFilter->AddInputData(source->GetOutput());\n    appendFilter->Update();\n    unstructuredGrid = appendFilter->GetOutput();\n  }\n\n  return unstructuredGrid;\n}\n\n} // namespace\n
"},{"location":"Cxx/IO/ReadAllUnstructuredGridTypes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadAllUnstructuredGridTypes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOLegacy\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadAllUnstructuredGridTypes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadAllUnstructuredGridTypes MACOSX_BUNDLE ReadAllUnstructuredGridTypes.cxx )\n  target_link_libraries(ReadAllUnstructuredGridTypes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadAllUnstructuredGridTypes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadAllUnstructuredGridTypes/#download-and-build-readallunstructuredgridtypes","title":"Download and Build ReadAllUnstructuredGridTypes","text":"

Click here to download ReadAllUnstructuredGridTypes and its CMakeLists.txt file. Once the tarball ReadAllUnstructuredGridTypes.tar has been downloaded and extracted,

cd ReadAllUnstructuredGridTypes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadAllUnstructuredGridTypes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadBMP/","title":"ReadBMP","text":"

vtk-examples/Cxx/IO/ReadBMP

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadBMP/#code","title":"Code","text":"

ReadBMP.cxx

#include <vtkBMPReader.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.bmp) e.g. masonry.bmp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkBMPReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ReadBMP\");\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadBMP/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadBMP)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadBMP: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadBMP MACOSX_BUNDLE ReadBMP.cxx )\n  target_link_libraries(ReadBMP PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadBMP\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadBMP/#download-and-build-readbmp","title":"Download and Build ReadBMP","text":"

Click here to download ReadBMP and its CMakeLists.txt file. Once the tarball ReadBMP.tar has been downloaded and extracted,

cd ReadBMP/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadBMP\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadCML/","title":"ReadCML","text":"

vtk-examples/Cxx/IO/ReadCML

"},{"location":"Cxx/IO/ReadCML/#description","title":"Description","text":"

This example uses vtkCMLMoleculeReader to read a Chemistry Markup Language file. CML has been developed by Peter Murray-Rust and Henry Rzepa since 1995. It is the de facto XML for chemistry, accepted by publishers and with more than 1 million lines of Open Source code supporting it.

Info

This example uses the file porphyrin.cml. A description of the molecule Porphyrin is described here.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadCML/#code","title":"Code","text":"

ReadCML.cxx

#include <vtkActor.h>\n#include <vtkCMLMoleculeReader.h>\n#include <vtkCamera.h>\n#include <vtkMoleculeMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.cml) e.g. porphyrin.cml\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string fname(argv[1]);\n  vtkNew<vtkCMLMoleculeReader> cmlSource;\n\n  cmlSource->SetFileName(fname.c_str());\n\n  vtkNew<vtkMoleculeMapper> molmapper;\n  molmapper->SetInputConnection(cmlSource->GetOutputPort());\n\n  molmapper->UseBallAndStickSettings();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(molmapper);\n  actor->GetProperty()->SetDiffuse(0.7);\n  actor->GetProperty()->SetSpecular(0.5);\n  actor->GetProperty()->SetSpecularPower(20.0);\n\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(ren);\n  renderWindow->SetWindowName(\"ReadCML\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  ren->AddActor(actor);\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  ren->GetActiveCamera()->Zoom(2.0);\n  ren->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  // Finally render the scene\n  renderWindow->SetMultiSamples(0);\n  renderWindow->GetInteractor()->Initialize();\n  renderWindow->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadCML/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadCML)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  DomainsChemistry\n  DomainsChemistryOpenGL2\n  IOChemistry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadCML: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadCML MACOSX_BUNDLE ReadCML.cxx )\n  target_link_libraries(ReadCML PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadCML\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadCML/#download-and-build-readcml","title":"Download and Build ReadCML","text":"

Click here to download ReadCML and its CMakeLists.txt file. Once the tarball ReadCML.tar has been downloaded and extracted,

cd ReadCML/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadCML\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadDICOM/","title":"ReadDICOM","text":"

vtk-examples/Cxx/IO/ReadDICOM

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadDICOM/#description","title":"Description","text":"

This example reads a DICOM file and displays it on the screen. DICOM_Prostate is an example data set.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadDICOM/#code","title":"Code","text":"

ReadDICOM.cxx

#include <vtkDICOMImageReader.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.img) e.g. prostate.img\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  // Read all the DICOM files in the specified directory.\n  vtkNew<vtkDICOMImageReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ReadDICOM\");\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadDICOM/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadDICOM)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadDICOM: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadDICOM MACOSX_BUNDLE ReadDICOM.cxx )\n  target_link_libraries(ReadDICOM PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadDICOM\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadDICOM/#download-and-build-readdicom","title":"Download and Build ReadDICOM","text":"

Click here to download ReadDICOM and its CMakeLists.txt file. Once the tarball ReadDICOM.tar has been downloaded and extracted,

cd ReadDICOM/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadDICOM\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadDICOMSeries/","title":"ReadDICOMSeries","text":"

vtk-examples/Cxx/IO/ReadDICOMSeries

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadDICOMSeries/#description","title":"Description","text":"

This example demonstates how to read a series of DICOM images and how to scroll with the mousewheel or the up/down keys through all slices. Sample data are available as a zipped file (977 kB, 40 slices): DicomTestImages

Seealso

ReadDICOM.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadDICOMSeries/#code","title":"Code","text":"

ReadDICOMSeries.cxx

//\n// This example demonstrates how to read a series of dicom images\n// and how to scroll with the mousewheel or the up/down keys\n// through all slices\n//\n// Some standard vtk headers.\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n// Headers needed for this example.\n#include <vtkActor2D.h>\n#include <vtkDICOMImageReader.h>\n#include <vtkImageViewer2.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n// Needed to easily convert int to std::string.\n#include <sstream>\n\nnamespace {\n\n// Helper class to format slice status message.\nclass StatusMessage\n{\npublic:\n  static std::string Format(int slice, int maxSlice)\n  {\n    std::stringstream tmp;\n    tmp << \"Slice Number  \" << slice + 1 << \"/\" << maxSlice + 1;\n    return tmp.str();\n  }\n};\n\n// Define own interaction style.\nclass myVtkInteractorStyleImage : public vtkInteractorStyleImage\n{\npublic:\n  static myVtkInteractorStyleImage* New();\n  vtkTypeMacro(myVtkInteractorStyleImage, vtkInteractorStyleImage);\n\nprotected:\n  vtkImageViewer2* _ImageViewer;\n  vtkTextMapper* _StatusMapper;\n  int _Slice;\n  int _MinSlice;\n  int _MaxSlice;\n\npublic:\n  void SetImageViewer(vtkImageViewer2* imageViewer)\n  {\n    _ImageViewer = imageViewer;\n    _MinSlice = imageViewer->GetSliceMin();\n    _MaxSlice = imageViewer->GetSliceMax();\n    _Slice = _MinSlice;\n    cout << \"Slicer: Min = \" << _MinSlice << \", Max = \" << _MaxSlice\n         << std::endl;\n  }\n\n  void SetStatusMapper(vtkTextMapper* statusMapper)\n  {\n    _StatusMapper = statusMapper;\n  }\n\nprotected:\n  void MoveSliceForward()\n  {\n    if (_Slice < _MaxSlice)\n    {\n      _Slice += 1;\n      cout << \"MoveSliceForward::Slice = \" << _Slice << std::endl;\n      _ImageViewer->SetSlice(_Slice);\n      std::string msg = StatusMessage::Format(_Slice, _MaxSlice);\n      _StatusMapper->SetInput(msg.c_str());\n      _ImageViewer->Render();\n    }\n  }\n\n  void MoveSliceBackward()\n  {\n    if (_Slice > _MinSlice)\n    {\n      _Slice -= 1;\n      cout << \"MoveSliceBackward::Slice = \" << _Slice << std::endl;\n      _ImageViewer->SetSlice(_Slice);\n      std::string msg = StatusMessage::Format(_Slice, _MaxSlice);\n      _StatusMapper->SetInput(msg.c_str());\n      _ImageViewer->Render();\n    }\n  }\n\n  virtual void OnKeyDown()\n  {\n    std::string key = this->GetInteractor()->GetKeySym();\n    if (key.compare(\"Up\") == 0)\n    {\n      // cout << \"Up arrow key was pressed.\" << endl;\n      MoveSliceForward();\n    }\n    else if (key.compare(\"Down\") == 0)\n    {\n      // cout << \"Down arrow key was pressed.\" << endl;\n      MoveSliceBackward();\n    }\n    // forward event\n    vtkInteractorStyleImage::OnKeyDown();\n  }\n\n  virtual void OnMouseWheelForward()\n  {\n    // std::cout << \"Scrolled mouse wheel forward.\" << std::endl;\n    MoveSliceForward();\n    // don't forward events, otherwise the image will be zoomed\n    // in case another interactorstyle is used (e.g. trackballstyle, ...)\n    // vtkInteractorStyleImage::OnMouseWheelForward();\n  }\n\n  virtual void OnMouseWheelBackward()\n  {\n    // std::cout << \"Scrolled mouse wheel backward.\" << std::endl;\n    if (_Slice > _MinSlice)\n    {\n      MoveSliceBackward();\n    }\n    // don't forward events, otherwise the image will be zoomed\n    // in case another interactorstyle is used (e.g. trackballstyle, ...)\n    // vtkInteractorStyleImage::OnMouseWheelBackward();\n  }\n};\n\nvtkStandardNewMacro(myVtkInteractorStyleImage);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" FolderName\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string folder = argv[1];\n  // std::string folder = \"C:\\\\VTK\\\\vtkdata-5.8.0\\\\Data\\\\DicomTestImages\";\n\n  // Read all the DICOM files in the specified directory.\n  vtkNew<vtkDICOMImageReader> reader;\n  reader->SetDirectoryName(folder.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n\n  // Slice status message.\n  vtkNew<vtkTextProperty> sliceTextProp;\n  sliceTextProp->SetFontFamilyToCourier();\n  sliceTextProp->SetFontSize(20);\n  sliceTextProp->SetVerticalJustificationToBottom();\n  sliceTextProp->SetJustificationToLeft();\n\n  vtkNew<vtkTextMapper> sliceTextMapper;\n  std::string msg = StatusMessage::Format(imageViewer->GetSliceMin(),\n                                          imageViewer->GetSliceMax());\n  sliceTextMapper->SetInput(msg.c_str());\n  sliceTextMapper->SetTextProperty(sliceTextProp);\n\n  vtkNew<vtkActor2D> sliceTextActor;\n  sliceTextActor->SetMapper(sliceTextMapper);\n  sliceTextActor->SetPosition(15, 10);\n\n  // Usage hint message.\n  vtkNew<vtkTextProperty> usageTextProp;\n  usageTextProp->SetFontFamilyToCourier();\n  usageTextProp->SetFontSize(14);\n  usageTextProp->SetVerticalJustificationToTop();\n  usageTextProp->SetJustificationToLeft();\n\n  vtkNew<vtkTextMapper> usageTextMapper;\n  usageTextMapper->SetInput(\n      \"- Slice with mouse wheel\\n  or Up/Down-Key\\n- Zoom with pressed right\\n \"\n      \" mouse button while dragging\");\n  usageTextMapper->SetTextProperty(usageTextProp);\n\n  vtkNew<vtkActor2D> usageTextActor;\n  usageTextActor->SetMapper(usageTextMapper);\n  usageTextActor->GetPositionCoordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  usageTextActor->GetPositionCoordinate()->SetValue(0.05, 0.95);\n\n  // Create an interactor with our own style (inherit from\n  // vtkInteractorStyleImage) in order to catch mousewheel and key events.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<myVtkInteractorStyleImage> myInteractorStyle;\n\n  // Make imageviewer2 and sliceTextMapper visible to our interactorstyle\n  // to enable slice status message updates when scrolling through the slices.\n  myInteractorStyle->SetImageViewer(imageViewer);\n  myInteractorStyle->SetStatusMapper(sliceTextMapper);\n\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  // Make the interactor use our own interactorstyle\n  // cause SetupInteractor() is defining it's own default interatorstyle\n  // this must be called after SetupInteractor().\n  renderWindowInteractor->SetInteractorStyle(myInteractorStyle);\n  // Sdd slice status message and usage hint message to the renderer.\n  imageViewer->GetRenderer()->AddActor2D(sliceTextActor);\n  imageViewer->GetRenderer()->AddActor2D(usageTextActor);\n\n  // Initialize rendering and interaction.\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetSize(800, 800);\n  imageViewer->GetRenderWindow()->SetWindowName(\"ReadDICOMSeries\");\n  imageViewer->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadDICOMSeries/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadDICOMSeries)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadDICOMSeries: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadDICOMSeries MACOSX_BUNDLE ReadDICOMSeries.cxx )\n  target_link_libraries(ReadDICOMSeries PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadDICOMSeries\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadDICOMSeries/#download-and-build-readdicomseries","title":"Download and Build ReadDICOMSeries","text":"

Click here to download ReadDICOMSeries and its CMakeLists.txt file. Once the tarball ReadDICOMSeries.tar has been downloaded and extracted,

cd ReadDICOMSeries/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadDICOMSeries\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadExodusData/","title":"ReadExodusData","text":"

vtk-examples/Cxx/IO/ReadExodusData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadExodusData/#description","title":"Description","text":"

The example uses vtkExodusIIReader to read an ExodusII file. The nodal variable to read is the second argument. The nodal variable is displayed with a color map.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadExodusData/#code","title":"Code","text":"

ReadExodusData.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCompositeDataGeometryFilter.h>\n#include <vtkExodusIIReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" exodus_file.e nodal_variable e.g mug.e convected\";\n    return EXIT_FAILURE;\n  }\n\n  // Read Exodus Data\n  vtkNew<vtkExodusIIReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->UpdateInformation();\n  reader->SetTimeStep(10);\n  reader->SetAllArrayStatus(vtkExodusIIReader::NODAL,\n                            1); // enables all NODAL variables\n\n  // Create Geometry\n  vtkNew<vtkCompositeDataGeometryFilter> geometry;\n  geometry->SetInputConnection(0, reader->GetOutputPort(0));\n\n  // Mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometry->GetOutputPort());\n  mapper->SelectColorArray(argv[2]);\n  mapper->SetScalarModeToUsePointFieldData();\n  mapper->InterpolateScalarsBeforeMappingOn();\n\n  // Actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  renderer->GetActiveCamera()->SetPosition(9.0, 9.0, 7.0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0.2, -0.7, 0.7);\n  renderer->GetActiveCamera()->SetDistance(14.5);\n\n  // Window and Interactor\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetSize(600, 600);\n  window->SetWindowName(\"ReadExodusData\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n  interactor->Initialize();\n\n  // Show the result\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadExodusData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadExodusData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeometry\n  IOExodus\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadExodusData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadExodusData MACOSX_BUNDLE ReadExodusData.cxx )\n  target_link_libraries(ReadExodusData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadExodusData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadExodusData/#download-and-build-readexodusdata","title":"Download and Build ReadExodusData","text":"

Click here to download ReadExodusData and its CMakeLists.txt file. Once the tarball ReadExodusData.tar has been downloaded and extracted,

cd ReadExodusData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadExodusData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadImageData/","title":"ReadImageData","text":"

vtk-examples/Cxx/IO/ReadImageData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadImageData/#description","title":"Description","text":"

This example reads an image data (.vti) file.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadImageData/#code","title":"Code","text":"

ReadImageData.cxx

#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLImageDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename.vti e.g. vase.vti\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the file.\n  vtkNew<vtkXMLImageDataReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadImageData\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadImageData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadImageData MACOSX_BUNDLE ReadImageData.cxx )\n  target_link_libraries(ReadImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadImageData/#download-and-build-readimagedata","title":"Download and Build ReadImageData","text":"

Click here to download ReadImageData and its CMakeLists.txt file. Once the tarball ReadImageData.tar has been downloaded and extracted,

cd ReadImageData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadImageData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadLegacyUnstructuredGrid/","title":"ReadLegacyUnstructuredGrid","text":"

vtk-examples/Cxx/IO/ReadLegacyUnstructuredGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadLegacyUnstructuredGrid/#description","title":"Description","text":"

This example displays a vtkUnstructuredGrid that contains eleven linear cells. We use a number of techniques to visualize the cells.

  1. vtkUnstructuredGridReader reads the file src/Testing/Data/VTKCellTypes.vtk.
  2. vtkExtractEdges extracts the edges of the 2 and 3 dimensional cells. vtkTubeFilter wraps each edge with tubes.
  3. vtkGlyph3DMapper displays each point as a vtkSphere.
  4. vtkShrinkFilter highlights the cell faces by pulling them in towards their centroid.
  5. vtkLabeledDataMapper shows the point ids.
  6. vtkProperty::EdgeVisibilityOn() shows the edges of the cells after shrinking.
  7. vtkCellData colors each cell with a different color.

The example also shows how to add a vtkCategoryLegend to a visualization. The vtkCategoryLegend has a vtkLookupTable that must be Indexed for categorical data. Since the vtkDataSetMapper for the geometry uses the lookup table to color each cell, we use vtkLookupTable::DeepCopy to copy the input vtkLookupTable and apply vtkLookupTable::IndexedLookupOn().

The sample file is taken from the VTKFileFormats document.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadLegacyUnstructuredGrid/#code","title":"Code","text":"

ReadLegacyUnstructuredGrid.cxx

#include <vtkBrush.h>\n#include <vtkCategoryLegend.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkCellTypes.h>\n#include <vtkContextScene.h>\n#include <vtkContextTransform.h>\n#include <vtkContextView.h>\n#include <vtkExtractEdges.h>\n#include <vtkGenericCell.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkShrinkFilter.h>\n#include <vtkSphereSource.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n#include <vtkVariantArray.h>\n\n#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the reader for the data.\n  std::string filename = argv[1];\n  std::cout << \"Loading \" << filename.c_str() << std::endl;\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkExtractEdges> extractEdges;\n  extractEdges->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkVariantArray> legendValues;\n  auto it = reader->GetOutput()->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    vtkNew<vtkGenericCell> cell;\n    it->GetCell(cell);\n    std::string cellName =\n        vtkCellTypes::GetClassNameFromTypeId(cell->GetCellType());\n#if 0\n    std::cout << cellName\n              << \" NumberOfPoints: \" << cell->GetNumberOfPoints()\n              << \" CellDimension: \" << cell->GetCellDimension()\n              << std::endl;\n#endif\n    legendValues->InsertNextValue(vtkVariant(cellName));\n  }\n  it->Delete();\n\n  // Tube the edges\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(extractEdges->GetOutputPort());\n  tubes->SetRadius(.05);\n  tubes->SetNumberOfSides(21);\n\n  vtkNew<vtkPolyDataMapper> edgeMapper;\n  edgeMapper->SetInputConnection(tubes->GetOutputPort());\n  edgeMapper->SetScalarRange(0, 26);\n\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(edgeMapper);\n  edgeActor->GetProperty()->SetSpecular(0.6);\n  edgeActor->GetProperty()->SetSpecularPower(30);\n  ;\n\n  // Glyph the points.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(0.08);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputConnection(reader->GetOutputPort());\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n  pointMapper->ScalingOff();\n  pointMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  pointActor->GetProperty()->SetSpecular(0.6);\n  pointActor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n  pointActor->GetProperty()->SetSpecularPower(100);\n  ;\n\n  // Label the points.\n  vtkNew<vtkLabeledDataMapper> labelMapper;\n  labelMapper->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkActor2D> labelActor;\n  labelActor->SetMapper(labelMapper);\n\n  // The geometry.\n  vtkNew<vtkShrinkFilter> geometryShrink;\n  geometryShrink->SetInputConnection(reader->GetOutputPort());\n  geometryShrink->SetShrinkFactor(.8);\n\n  // NOTE: We must copy the originalLut because the CategorialLegend\n  // needs an indexed lookup table, but the geometryMapper uses a\n  // non-index lookup table.\n  vtkNew<vtkLookupTable> categoricalLut;\n  vtkSmartPointer<vtkLookupTable> originalLut =\n      reader->GetOutput()->GetCellData()->GetScalars()->GetLookupTable();\n\n  categoricalLut->DeepCopy(originalLut);\n  categoricalLut->IndexedLookupOn();\n\n  vtkNew<vtkDataSetMapper> geometryMapper;\n  geometryMapper->SetInputConnection(geometryShrink->GetOutputPort());\n  geometryMapper->SetScalarModeToUseCellData();\n  geometryMapper->SetScalarRange(0, 11);\n\n  vtkNew<vtkActor> geometryActor;\n  geometryActor->SetMapper(geometryMapper);\n  geometryActor->GetProperty()->SetLineWidth(3);\n  geometryActor->GetProperty()->EdgeVisibilityOn();\n  geometryActor->GetProperty()->SetEdgeColor(0, 0, 0);\n\n  // Legend\n  for (int v = 0; v < legendValues->GetNumberOfTuples(); ++v)\n  {\n    categoricalLut->SetAnnotation(legendValues->GetValue(v),\n                                  legendValues->GetValue(v).ToString());\n  }\n  vtkNew<vtkCategoryLegend> legend;\n  legend->SetScalarsToColors(categoricalLut);\n  legend->SetValues(legendValues);\n  legend->SetTitle(\"Cell Type\");\n  legend->GetBrush()->SetColor(colors->GetColor4ub(\"Silver\").GetData());\n\n  vtkNew<vtkContextTransform> placeLegend;\n  placeLegend->AddItem(legend);\n  placeLegend->Translate(640 - 20, 480 - 12 * 16);\n\n  vtkNew<vtkContextView> contextView;\n  contextView->GetScene()->AddItem(placeLegend);\n\n  vtkSmartPointer<vtkRenderer> renderer = contextView->GetRenderer();\n\n  vtkSmartPointer<vtkRenderWindow> renderWindow =\n      contextView->GetRenderWindow();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(geometryActor);\n  renderer->AddActor(labelActor);\n  renderer->AddActor(edgeActor);\n  renderer->AddActor(pointActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkCamera> aCamera;\n  aCamera->Azimuth(-40.0);\n  aCamera->Elevation(50.0);\n\n  renderer->SetActiveCamera(aCamera);\n  renderer->ResetCamera();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ReadLegacyUnstructuredGrid\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadLegacyUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadLegacyUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadLegacyUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadLegacyUnstructuredGrid MACOSX_BUNDLE ReadLegacyUnstructuredGrid.cxx )\n  target_link_libraries(ReadLegacyUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadLegacyUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadLegacyUnstructuredGrid/#download-and-build-readlegacyunstructuredgrid","title":"Download and Build ReadLegacyUnstructuredGrid","text":"

Click here to download ReadLegacyUnstructuredGrid and its CMakeLists.txt file. Once the tarball ReadLegacyUnstructuredGrid.tar has been downloaded and extracted,

cd ReadLegacyUnstructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadLegacyUnstructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadOBJ/","title":"ReadOBJ","text":"

vtk-examples/Cxx/IO/ReadOBJ

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadOBJ/#description","title":"Description","text":"

This example demonstrates how to read a Wavefront OBJ file. The result is displayed.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadOBJ/#code","title":"Code","text":"

ReadOBJ.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \"Filename(.obj) e.g trumpet.obj\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n  vtkNew<vtkOBJReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SpringGreen\");\n  vtkColor3d actorColor = colors->GetColor3d(\"HoneyDew\");\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(actorColor.GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadOBJ\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadOBJ/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadOBJ)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadOBJ: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadOBJ MACOSX_BUNDLE ReadOBJ.cxx )\n  target_link_libraries(ReadOBJ PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadOBJ\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadOBJ/#download-and-build-readobj","title":"Download and Build ReadOBJ","text":"

Click here to download ReadOBJ and its CMakeLists.txt file. Once the tarball ReadOBJ.tar has been downloaded and extracted,

cd ReadOBJ/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadOBJ\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadPDB/","title":"ReadPDB","text":"

vtk-examples/Cxx/IO/ReadPDB

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadPDB/#description","title":"Description","text":"

This example reads Protein Data Bank files. The example expects a file in .pdb format for example src/Testing/Data/lys.pdb.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadPDB/#code","title":"Code","text":"

ReadPDB.cxx

#include <vtkGlyph3D.h>\n#include <vtkLODActor.h>\n#include <vtkNamedColors.h>\n#include <vtkPDBReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTubeFilter.h>\n\n#include <cmath>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.pdb) e.g. caffeine.pdb\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPDBReader> pdb;\n  pdb->SetFileName(argv[1]);\n  pdb->SetHBScale(1.0);\n  pdb->SetBScale(1.0);\n  pdb->Update();\n  std::cout << \"# of atoms is: \" << pdb->GetNumberOfAtoms() << std::endl;\n\n  double resolution = std::sqrt(300000.0 / pdb->GetNumberOfAtoms());\n  if (resolution > 20)\n  {\n    resolution = 20;\n  }\n  if (resolution < 4)\n  {\n    resolution = 4;\n  }\n  std::cout << \"Resolution is: \" << resolution << std::endl;\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetCenter(0, 0, 0);\n  sphere->SetRadius(1);\n  sphere->SetThetaResolution(static_cast<int>(resolution));\n  sphere->SetPhiResolution(static_cast<int>(resolution));\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(pdb->GetOutputPort());\n  glyph->SetOrient(1);\n  glyph->SetColorMode(1);\n  // glyph->ScalingOn();\n  glyph->SetScaleMode(2);\n  glyph->SetScaleFactor(0.25);\n  glyph->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> atomMapper;\n  atomMapper->SetInputConnection(glyph->GetOutputPort());\n  atomMapper->UseLookupTableScalarRangeOff();\n  atomMapper->ScalarVisibilityOn();\n  atomMapper->SetScalarModeToDefault();\n\n  vtkNew<vtkLODActor> atom;\n  atom->SetMapper(atomMapper);\n  atom->GetProperty()->SetRepresentationToSurface();\n  atom->GetProperty()->SetInterpolationToGouraud();\n  atom->GetProperty()->SetAmbient(0.1);\n  atom->GetProperty()->SetDiffuse(0.7);\n  atom->GetProperty()->SetSpecular(0.5);\n  atom->GetProperty()->SetSpecularPower(80);\n  atom->GetProperty()->SetSpecularColor(colors->GetColor3d(\"White\").GetData());\n  atom->SetNumberOfCloudPoints(30000);\n\n  renderer->AddActor(atom);\n\n  vtkNew<vtkTubeFilter> tube;\n  tube->SetInputConnection(pdb->GetOutputPort());\n  tube->SetNumberOfSides(static_cast<int>(resolution));\n  tube->CappingOff();\n  tube->SetRadius(0.2);\n  tube->SetVaryRadius(0);\n  tube->SetRadiusFactor(10);\n\n  vtkNew<vtkPolyDataMapper> bondMapper;\n  bondMapper->SetInputConnection(tube->GetOutputPort());\n  bondMapper->UseLookupTableScalarRangeOff();\n  bondMapper->ScalarVisibilityOff();\n  bondMapper->SetScalarModeToDefault();\n\n  vtkNew<vtkLODActor> bond;\n  bond->SetMapper(bondMapper);\n  bond->GetProperty()->SetRepresentationToSurface();\n  bond->GetProperty()->SetInterpolationToGouraud();\n  bond->GetProperty()->SetAmbient(0.1);\n  bond->GetProperty()->SetDiffuse(0.7);\n  bond->GetProperty()->SetSpecular(0.5);\n  bond->GetProperty()->SetSpecularPower(80);\n  bond->GetProperty()->SetSpecularColor(colors->GetColor3d(\"White\").GetData());\n\n  renderer->AddActor(bond);\n\n  renderWindow->SetWindowName(\"ReadPDB\");\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadPDB/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPDB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  FiltersCore\n  FiltersSources\n  IOChemistry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPDB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPDB MACOSX_BUNDLE ReadPDB.cxx )\n  target_link_libraries(ReadPDB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPDB\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadPDB/#download-and-build-readpdb","title":"Download and Build ReadPDB","text":"

Click here to download ReadPDB and its CMakeLists.txt file. Once the tarball ReadPDB.tar has been downloaded and extracted,

cd ReadPDB/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadPDB\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadPLOT3D/","title":"ReadPLOT3D","text":"

vtk-examples/Cxx/IO/ReadPLOT3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadPLOT3D/#code","title":"Code","text":"

ReadPLOT3D.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGridGeometryFilter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 3)\n  {\n    std::cout << \"Required parameters: XYZFilename.bin QFileName.bin e.g \"\n                 \"combxyz.bin combq.bin\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string xyzFilename(argv[1]);\n  std::string qFilename(argv[2]);\n\n  vtkNew<vtkMultiBlockPLOT3DReader> reader;\n  reader->SetXYZFileName(xyzFilename.c_str());\n  reader->SetQFileName(qFilename.c_str());\n  reader->SetScalarFunctionNumber(100);\n  reader->SetVectorFunctionNumber(202);\n  reader->Update();\n\n  vtkNew<vtkStructuredGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputData(reader->GetOutput()->GetBlock(0));\n  geometryFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometryFilter->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->SetClippingRange(3.95297, 50);\n  renderer->GetActiveCamera()->SetFocalPoint(8.88908, 0.595038, 29.3342);\n  renderer->GetActiveCamera()->SetPosition(-12.3332, 31.7479, 41.2387);\n  renderer->GetActiveCamera()->SetViewUp(0.060772, -0.319905, 0.945498);\n\n  renderWindow->SetWindowName(\"ReadPLOT3D\");\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadPLOT3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPLOT3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPLOT3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPLOT3D MACOSX_BUNDLE ReadPLOT3D.cxx )\n  target_link_libraries(ReadPLOT3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPLOT3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadPLOT3D/#download-and-build-readplot3d","title":"Download and Build ReadPLOT3D","text":"

Click here to download ReadPLOT3D and its CMakeLists.txt file. Once the tarball ReadPLOT3D.tar has been downloaded and extracted,

cd ReadPLOT3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadPLOT3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadPLY/","title":"ReadPLY","text":"

vtk-examples/Cxx/IO/ReadPLY

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadPLY/#code","title":"Code","text":"

ReadPLY.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \"  Filename(.ply) e.g. shark.ply\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkPLYReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DarkGray\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SeaGreen\").GetData());\n\n  renderWindow->SetWindowName(\"ReadPLY\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadPLY/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPLY)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOPLY\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPLY: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPLY MACOSX_BUNDLE ReadPLY.cxx )\n  target_link_libraries(ReadPLY PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPLY\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadPLY/#download-and-build-readply","title":"Download and Build ReadPLY","text":"

Click here to download ReadPLY and its CMakeLists.txt file. Once the tarball ReadPLY.tar has been downloaded and extracted,

cd ReadPLY/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadPLY\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadPNM/","title":"ReadPNM","text":"

vtk-examples/Cxx/IO/ReadPNM

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadPNM/#code","title":"Code","text":"

ReadPNM.cxx

#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNMReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.pnm) e.g Gourds.pnm\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkPNMReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ReadPNM\");\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadPNM/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPNM)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPNM: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPNM MACOSX_BUNDLE ReadPNM.cxx )\n  target_link_libraries(ReadPNM PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPNM\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadPNM/#download-and-build-readpnm","title":"Download and Build ReadPNM","text":"

Click here to download ReadPNM and its CMakeLists.txt file. Once the tarball ReadPNM.tar has been downloaded and extracted,

cd ReadPNM/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadPNM\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadPlainTextTriangles/","title":"ReadPlainTextTriangles","text":"

vtk-examples/Cxx/IO/ReadPlainTextTriangles

"},{"location":"Cxx/IO/ReadPlainTextTriangles/#description","title":"Description","text":"

Here is an example of a custom file-format reader that produces a VTK XML PolyData file from a plain-text input format.

"},{"location":"Cxx/IO/ReadPlainTextTriangles/#input-format","title":"Input Format","text":"
number_of_points\nnumber_of_triangles\npoint[point[0]Y point[0](0]X)Z\npoint[point[1]Y point[1](1]X)Z\n...\npoint[point[N]Y point[N](N]X)Z\ntriangle[triangle[0]B triangle[0](0]A)C\ntriangle[triangle[1]B triangle[1](1]A)C\n...\ntriangle[triangle[M]B triangle[M](M]A)C\n
"},{"location":"Cxx/IO/ReadPlainTextTriangles/#example-input","title":"Example Input","text":"
3\n1\n0.0 0.0 0.0\n0.0 0.0 1.0\n0.0 1.0 0.0\n0 1 2\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadPlainTextTriangles/#code","title":"Code","text":"

ReadPlainTextTriangles.cxx

#include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <iostream>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> custom_reader(std::ifstream& infile);\n}\n\nint main(int argc, char* argv[])\n{\n  // Verify command line arguments\n  if (argc != 2)\n  {\n    std::cerr << \"Required arguments: triangleFile.txt\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  std::ifstream fin(inputFilename.c_str());\n\n  auto polydata = custom_reader(fin);\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetInputData(polydata);\n  writer->SetFileName(\"x.vtp\");\n  writer->Write();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> custom_reader(std::ifstream& infile)\n{\n  vtkIdType number_of_points, number_of_triangles;\n  infile >> number_of_points >> number_of_triangles;\n\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(number_of_points);\n  for (vtkIdType i = 0; i < number_of_points; i++)\n  {\n    double x, y, z;\n    infile >> x >> y >> z;\n    points->SetPoint(i, x, y, z);\n  }\n\n  vtkNew<vtkCellArray> polys;\n  for (vtkIdType i = 0; i < number_of_triangles; i++)\n  {\n    vtkIdType a, b, c;\n    infile >> a >> b >> c;\n    polys->InsertNextCell(3);\n    polys->InsertCellPoint(a);\n    polys->InsertCellPoint(b);\n    polys->InsertCellPoint(c);\n  }\n  auto polydata = vtkSmartPointer<vtkPolyData>::New();\n  polydata->SetPoints(points);\n  polydata->SetPolys(polys);\n  return polydata;\n}\n} // namespace\n
"},{"location":"Cxx/IO/ReadPlainTextTriangles/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPlainTextTriangles)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPlainTextTriangles: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPlainTextTriangles MACOSX_BUNDLE ReadPlainTextTriangles.cxx )\n  target_link_libraries(ReadPlainTextTriangles PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPlainTextTriangles\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadPlainTextTriangles/#download-and-build-readplaintexttriangles","title":"Download and Build ReadPlainTextTriangles","text":"

Click here to download ReadPlainTextTriangles and its CMakeLists.txt file. Once the tarball ReadPlainTextTriangles.tar has been downloaded and extracted,

cd ReadPlainTextTriangles/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadPlainTextTriangles\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadPolyData/","title":"ReadPolyData","text":"

vtk-examples/Cxx/IO/ReadPolyData

"},{"location":"Cxx/IO/ReadPolyData/#description","title":"Description","text":"

This example reads a polygonal data (.vtp) file, for example src/Testing/Data/Torso.vtp.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadPolyData/#code","title":"Code","text":"

ReadPolyData.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtp) e.g. Torso.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read all the data from the file.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkOliveGreen\").GetData());\n  renderer->GetActiveCamera()->Pitch(90);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->ResetCamera();\n\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ReadPolyData\");\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPolyData MACOSX_BUNDLE ReadPolyData.cxx )\n  target_link_libraries(ReadPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadPolyData/#download-and-build-readpolydata","title":"Download and Build ReadPolyData","text":"

Click here to download ReadPolyData and its CMakeLists.txt file. Once the tarball ReadPolyData.tar has been downloaded and extracted,

cd ReadPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadRectilinearGrid/","title":"ReadRectilinearGrid","text":"

vtk-examples/Cxx/IO/ReadRectilinearGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadRectilinearGrid/#description","title":"Description","text":"

This example reads a rectilinear grid (.vtr) file. An example file can be found at VTKData/Data/cth.vtr.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadRectilinearGrid/#code","title":"Code","text":"

ReadRectilinearGrid.cxx

#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n// #include <vtkRectilinearGridGeometryFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLRectilinearGridReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" Filename.vtr e.g. RectilinearGrid.vtr\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Parse arguments\n  std::string inputFilename = argv[1];\n\n  // Read the file\n  vtkNew<vtkXMLRectilinearGridReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // vtkNew<vtkRectilinearGridGeometryFilter> geometryFilter;\n  // geometryFilter->SetInputConnection(reader->GetOutputPort());\n  // geometryFilter->Update();\n\n  // Visualize\n  vtkNew<vtkDataSetMapper> mapper;\n  // mapper->SetInputConnection(geometryFilter->GetOutputPort());\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadRectilinearGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadRectilinearGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadRectilinearGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeometry\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadRectilinearGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadRectilinearGrid MACOSX_BUNDLE ReadRectilinearGrid.cxx )\n  target_link_libraries(ReadRectilinearGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadRectilinearGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadRectilinearGrid/#download-and-build-readrectilineargrid","title":"Download and Build ReadRectilinearGrid","text":"

Click here to download ReadRectilinearGrid and its CMakeLists.txt file. Once the tarball ReadRectilinearGrid.tar has been downloaded and extracted,

cd ReadRectilinearGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadRectilinearGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadSLC/","title":"ReadSLC","text":"

vtk-examples/Cxx/IO/ReadSLC

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadSLC/#description","title":"Description","text":"

In this example you will familiarize yourself with the stages required to read a .slc file and create a visualization pipeline in VTK. Following is the three step procedure:

  1. Read the data from .slc file using vtkSLCReader

  2. Implement Marching cubes Algorithm using vtkContourFilter

  3. Create Visualization pipeline to visualize data using an actor, mapper and rendering window

Cite

This example was provided by Bharatesh Chakravarthi from Virtual Environment Lab, Chung-Ang University, Seoul, South Korea

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadSLC/#code","title":"Code","text":"

ReadSLC.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkExtractVOI.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSLCReader.h>\n\n// Author: Bharatesh Chakravarthi\n// Affiliation: Virtual Environment Lab, Chung-Ang University, Seoul, South\n// Korea\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    // Pass the filename (<filename>.slc) as parameter to read .slc file\n    std::cout << \"Required parameters: Filename(.slc) e.g vw_knee.slc\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  double isoValue = 72.0;\n  if (argc < 3)\n  {\n    isoValue = 72.0;\n  }\n  else\n  {\n    isoValue = std::atof(argv[2]);\n  }\n  std::string inputFilename = argv[1];\n\n  // Using vtkSLCReader to read Volumetric file format(<filename.slc>)\n  vtkNew<vtkSLCReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // Implementing Marching Cubes Algorithm to create the surface using\n  // vtkContourFilter object\n  vtkNew<vtkContourFilter> cFilter;\n  cFilter->SetInputConnection(reader->GetOutputPort());\n\n  // Change the range(2nd and 3rd Paramater) based on your\n  // requirement. recomended value for 1st parameter is above 1\n  // cFilter->GenerateValues(5, 80.0, 100.0);\n  cFilter->SetValue(0, isoValue);\n  cFilter->Update();\n\n  // Adding the outliner using vtkOutlineFilter object\n  vtkNew<vtkOutlineFilter> outliner;\n  outliner->SetInputConnection(reader->GetOutputPort());\n  outliner->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cFilter->GetOutputPort());\n  mapper->SetScalarVisibility(0);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuse(0.8);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Ivory\").GetData());\n  actor->GetProperty()->SetSpecular(0.8);\n  actor->GetProperty()->SetSpecularPower(120.0);\n\n  // extractVOI is used to fix the problem of subsampling of data and reduce\n  // slow interaction and increase loading speed\n  vtkNew<vtkExtractVOI> extractVOI;\n  extractVOI->SetInputConnection(reader->GetOutputPort());\n  extractVOI->SetSampleRate(2, 2, 2);\n  extractVOI->Update();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 512);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n\n  // Pick a good view\n  vtkCamera* cam1 = renderer->GetActiveCamera();\n  cam1->SetFocalPoint(0.0, 0.0, 0.0);\n  cam1->SetPosition(0.0, -1.0, 0.0);\n  cam1->SetViewUp(0.0, 0.0, -1.0);\n  cam1->Azimuth(-90.0);\n  renderer->ResetCamera();\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetWindowName(\"ReadSLC\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadSLC/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadSLC)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadSLC: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadSLC MACOSX_BUNDLE ReadSLC.cxx )\n  target_link_libraries(ReadSLC PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadSLC\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadSLC/#download-and-build-readslc","title":"Download and Build ReadSLC","text":"

Click here to download ReadSLC and its CMakeLists.txt file. Once the tarball ReadSLC.tar has been downloaded and extracted,

cd ReadSLC/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadSLC\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadSTL/","title":"ReadSTL","text":"

vtk-examples/Cxx/IO/ReadSTL

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadSTL/#code","title":"Code","text":"

ReadSTL.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    cout << \"Required parameters: Filename(.stl) e.g 42400-IDGH.stl\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkSTLReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuse(0.8);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"LightSteelBlue\").GetData());\n  actor->GetProperty()->SetSpecular(0.3);\n  actor->GetProperty()->SetSpecularPower(60.0);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadSTL\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkOliveGreen\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadSTL/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadSTL)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadSTL: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadSTL MACOSX_BUNDLE ReadSTL.cxx )\n  target_link_libraries(ReadSTL PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadSTL\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadSTL/#download-and-build-readstl","title":"Download and Build ReadSTL","text":"

Click here to download ReadSTL and its CMakeLists.txt file. Once the tarball ReadSTL.tar has been downloaded and extracted,

cd ReadSTL/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadSTL\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadStructuredGrid/","title":"ReadStructuredGrid","text":"

vtk-examples/Cxx/IO/ReadStructuredGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadStructuredGrid/#description","title":"Description","text":"

This example reads a structured grid (.vts) file. An example file can be found at VTKData/Data/multicomb_0.vts.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadStructuredGrid/#code","title":"Code","text":"

ReadStructuredGrid.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkXMLStructuredGridReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename.vts e.g. StructuredGrid.vts\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  // Read the file.\n  vtkNew<vtkXMLStructuredGridReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  vtkNew<vtkStructuredGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputConnection(reader->GetOutputPort());\n  geometryFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometryFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadStructuredGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadStructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadStructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeometry\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadStructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadStructuredGrid MACOSX_BUNDLE ReadStructuredGrid.cxx )\n  target_link_libraries(ReadStructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadStructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadStructuredGrid/#download-and-build-readstructuredgrid","title":"Download and Build ReadStructuredGrid","text":"

Click here to download ReadStructuredGrid and its CMakeLists.txt file. Once the tarball ReadStructuredGrid.tar has been downloaded and extracted,

cd ReadStructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadStructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadTIFF/","title":"ReadTIFF","text":"

vtk-examples/Cxx/IO/ReadTIFF

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadTIFF/#code","title":"Code","text":"

ReadTIFF.cxx

#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTIFFReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.tif) e.g. ColorCells.tif\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkTIFFReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderWindow()->SetWindowName(\"ReadTIFF\");\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadTIFF/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadTIFF)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadTIFF: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadTIFF MACOSX_BUNDLE ReadTIFF.cxx )\n  target_link_libraries(ReadTIFF PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadTIFF\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadTIFF/#download-and-build-readtiff","title":"Download and Build ReadTIFF","text":"

Click here to download ReadTIFF and its CMakeLists.txt file. Once the tarball ReadTIFF.tar has been downloaded and extracted,

cd ReadTIFF/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadTIFF\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadTextFile/","title":"ReadTextFile","text":"

vtk-examples/Cxx/IO/ReadTextFile

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadTextFile/#description","title":"Description","text":"

This example takes a plain text file of coordinates and reads them into a vtkPoints, which is then put into a vtkPolyData and displayed on the screen using a vtkVertexGlyphFilter.

An example file may look like: 1 2 3 4 5 6 7 8 9

Note

for a simpler way to read such a file, see SimplePointsReader.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadTextFile/#code","title":"Code","text":"

ReadTextFile.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <sstream>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.txt) e.g. TeapotPoints.txt\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Get all data from the file\n  std::string filename = argv[1];\n  std::ifstream filestream(filename.c_str());\n\n  std::string line;\n  vtkNew<vtkPoints> points;\n\n  while (std::getline(filestream, line))\n  {\n    double x, y, z;\n    std::stringstream linestream;\n    linestream << line;\n    linestream >> x >> y >> z;\n\n    points->InsertNextPoint(x, y, z);\n  }\n\n  filestream.close();\n\n  vtkNew<vtkPolyData> polyData;\n\n  polyData->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polyData);\n  glyphFilter->Update();\n\n  // Visualize\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Gainsboro\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadTextFile\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadTextFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadTextFile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadTextFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadTextFile MACOSX_BUNDLE ReadTextFile.cxx )\n  target_link_libraries(ReadTextFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadTextFile\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadTextFile/#download-and-build-readtextfile","title":"Download and Build ReadTextFile","text":"

Click here to download ReadTextFile and its CMakeLists.txt file. Once the tarball ReadTextFile.tar has been downloaded and extracted,

cd ReadTextFile/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadTextFile\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadUnknownTypeXMLFile/","title":"ReadUnknownTypeXMLFile","text":"

vtk-examples/Cxx/IO/ReadUnknownTypeXMLFile

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadUnknownTypeXMLFile/#description","title":"Description","text":"

This examples reads either a vtu (unstructured grid) or vtp (polydata) file and displays it to the screen.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadUnknownTypeXMLFile/#code","title":"Code","text":"

ReadUnknownTypeXMLFile.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLGenericDataObjectReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Ensure a filename was specified\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputFilename\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Get all data from the file\n  vtkNew<vtkXMLGenericDataObjectReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // All of the standard data types can be checked and obtained like this:\n  if (dynamic_cast<vtkPolyData*>(reader->GetOutput()))\n  {\n    std::cout << \"File is a polydata\" << std::endl;\n  }\n  else if (dynamic_cast<vtkUnstructuredGrid*>(reader->GetOutput()))\n  {\n    std::cout << \"File is an unstructured grid\" << std::endl;\n  }\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Moccasin\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadUnknownTypeXMLFile\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadUnknownTypeXMLFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadUnknownTypeXMLFile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadUnknownTypeXMLFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadUnknownTypeXMLFile MACOSX_BUNDLE ReadUnknownTypeXMLFile.cxx )\n  target_link_libraries(ReadUnknownTypeXMLFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadUnknownTypeXMLFile\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadUnknownTypeXMLFile/#download-and-build-readunknowntypexmlfile","title":"Download and Build ReadUnknownTypeXMLFile","text":"

Click here to download ReadUnknownTypeXMLFile and its CMakeLists.txt file. Once the tarball ReadUnknownTypeXMLFile.tar has been downloaded and extracted,

cd ReadUnknownTypeXMLFile/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadUnknownTypeXMLFile\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/ReadUnstructuredGrid/","title":"ReadUnstructuredGrid","text":"

vtk-examples/Cxx/IO/ReadUnstructuredGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/ReadUnstructuredGrid/#description","title":"Description","text":"

This example demonstrates how to read an unstructured grid (VTU) file. The front facing faces are colored Misty Rose, while the back facing faces are colored Tomato.

An example file to use is src/Testing/Data/tetra.vtu.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/ReadUnstructuredGrid/#code","title":"Code","text":"

ReadUnstructuredGrid.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtu) e.g. tetra.vtu\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  // Read all the data from the file.\n  vtkNew<vtkXMLUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetLineWidth(2.0);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkProperty> backFace;\n  backFace->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->SetBackfaceProperty(backFace);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  // Render and interact.\n  renderWindow->SetSize(640, 480);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/ReadUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadUnstructuredGrid MACOSX_BUNDLE ReadUnstructuredGrid.cxx )\n  target_link_libraries(ReadUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/ReadUnstructuredGrid/#download-and-build-readunstructuredgrid","title":"Download and Build ReadUnstructuredGrid","text":"

Click here to download ReadUnstructuredGrid and its CMakeLists.txt file. Once the tarball ReadUnstructuredGrid.tar has been downloaded and extracted,

cd ReadUnstructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReadUnstructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/SimplePointsReader/","title":"SimplePointsReader","text":"

vtk-examples/Cxx/IO/SimplePointsReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/SimplePointsReader/#description","title":"Description","text":"

A file of XYZ coordinates is a very easy format that can be used for simple storage from many applications. This example demonstrates how to read this type of file into a polydata object. An example file of three points would look like this:

 0.0 0.0 0.0\n 1.0 0.0 0.0\n 0.0 1.0 0.0\n

As a demo, save the above three lines to a file called simple.xyz and call the executable resulting from the code below with

 ./SimplePointsReader simple.xyz\n

from the build directory.

Seealso

For the reverse operation, writing a points file, see the SimplePointsWriter example.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/SimplePointsReader/#code","title":"Code","text":"

SimplePointsReader.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimplePointsReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.xyz) e.g coords.txt\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the file\n  vtkNew<vtkSimplePointsReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(6);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SimplePointsReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/SimplePointsReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SimplePointsReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SimplePointsReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SimplePointsReader MACOSX_BUNDLE SimplePointsReader.cxx )\n  target_link_libraries(SimplePointsReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SimplePointsReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/SimplePointsReader/#download-and-build-simplepointsreader","title":"Download and Build SimplePointsReader","text":"

Click here to download SimplePointsReader and its CMakeLists.txt file. Once the tarball SimplePointsReader.tar has been downloaded and extracted,

cd SimplePointsReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SimplePointsReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/SimplePointsWriter/","title":"SimplePointsWriter","text":"

vtk-examples/Cxx/IO/SimplePointsWriter

"},{"location":"Cxx/IO/SimplePointsWriter/#description","title":"Description","text":"

Seealso

For the opposite operation (reading a points file) see the

SimplePointsReader example.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/SimplePointsWriter/#code","title":"Code","text":"

SimplePointsWriter.cxx

#include <vtkNew.h>\n#include <vtkSimplePointsWriter.h>\n#include <vtkSphereSource.h>\n\nint main(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkSimplePointsWriter> writer;\n  writer->SetFileName(\"test.xyz\");\n  writer->SetInputConnection(sphereSource->GetOutputPort());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/SimplePointsWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SimplePointsWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersSources\n  IOLegacy\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SimplePointsWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SimplePointsWriter MACOSX_BUNDLE SimplePointsWriter.cxx )\n  target_link_libraries(SimplePointsWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SimplePointsWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/SimplePointsWriter/#download-and-build-simplepointswriter","title":"Download and Build SimplePointsWriter","text":"

Click here to download SimplePointsWriter and its CMakeLists.txt file. Once the tarball SimplePointsWriter.tar has been downloaded and extracted,

cd SimplePointsWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SimplePointsWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/StructuredGridReader/","title":"StructuredGridReader","text":"

vtk-examples/Cxx/IO/StructuredGridReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/StructuredGridReader/#code","title":"Code","text":"

StructuredGridReader.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" Filename(.vtk) e.g. SampleStructGrid.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  // Read the file\n  vtkNew<vtkStructuredGridReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  vtkNew<vtkStructuredGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputConnection(reader->GetOutputPort());\n  geometryFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometryFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"StructuredGridReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/StructuredGridReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredGridReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeometry\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredGridReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredGridReader MACOSX_BUNDLE StructuredGridReader.cxx )\n  target_link_libraries(StructuredGridReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredGridReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/StructuredGridReader/#download-and-build-structuredgridreader","title":"Download and Build StructuredGridReader","text":"

Click here to download StructuredGridReader and its CMakeLists.txt file. Once the tarball StructuredGridReader.tar has been downloaded and extracted,

cd StructuredGridReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StructuredGridReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/StructuredPointsReader/","title":"StructuredPointsReader","text":"

vtk-examples/Cxx/IO/StructuredPointsReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/StructuredPointsReader/#description","title":"Description","text":"

An example input file can be found at /Data/ironProt.vtk.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/StructuredPointsReader/#code","title":"Code","text":"

StructuredPointsReader.cxx

#include <vtkImageDataGeometryFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" Filename(.vtk) e.g. StructuredPoints.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  // Read the file\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageDataGeometryFilter> geometryFilter;\n  geometryFilter->SetInputConnection(reader->GetOutputPort());\n  geometryFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometryFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"StructuredPointsReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/StructuredPointsReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredPointsReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeometry\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredPointsReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredPointsReader MACOSX_BUNDLE StructuredPointsReader.cxx )\n  target_link_libraries(StructuredPointsReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredPointsReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/StructuredPointsReader/#download-and-build-structuredpointsreader","title":"Download and Build StructuredPointsReader","text":"

Click here to download StructuredPointsReader and its CMakeLists.txt file. Once the tarball StructuredPointsReader.tar has been downloaded and extracted,

cd StructuredPointsReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StructuredPointsReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/TransientHDFReader/","title":"TransientHDFReader","text":"

vtk-examples/Cxx/IO/TransientHDFReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/TransientHDFReader/#description","title":"Description","text":"

That example uses a feature of vtk_hdf5 that is only available in VTK 9.3. See this blog post for more information.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/TransientHDFReader/#code","title":"Code","text":"

TransientHDFReader.cxx

#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkDiscretizableColorTransferFunction.h>\n#include <vtkHDFReader.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObject.h>\n#include <vtkObjectBase.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <cstdlib>\n\nnamespace {\nvtkNew<vtkDiscretizableColorTransferFunction> GetCTF();\n\nvoid Animate(vtkObject* caller, unsigned long /*eid*/, void* clientdata,\n             void* /*calldata*/);\n\n} // namespace\n\nint main(int ac, char* av[])\n{\n  if (ac != 2)\n  {\n    std::cout << \"Usage: \" << av[0]\n              << \" filename.vtkhdf eg. warping_spheres.vtkhdf\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the dataset.\n  vtkNew<vtkHDFReader> reader;\n  reader->SetFileName(av[1]);\n  reader->Update();\n  std::cout << \"Number of steps: \" << reader->GetNumberOfSteps() << endl;\n  auto polydata = vtkPolyData::SafeDownCast(reader->GetOutput());\n\n  // Render the dataset.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n  mapper->SetLookupTable(GetCTF());\n  mapper->SetScalarModeToUsePointFieldData();\n  mapper->SelectColorArray(\"SpatioTemporalHarmonics\");\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"TransientHDFReader\");\n  renWin->SetSize(1024, 512);\n  renWin->Render();\n\n  // Add the interactor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the animation callback.\n  vtkNew<vtkCallbackCommand> command;\n  command->SetCallback(Animate);\n  command->SetClientData(reader);\n\n  // You must initialize the vtkRenderWindowInteractor\n  // before adding the observer and setting the repeating timer.\n  iren->Initialize();\n  iren->AddObserver(vtkCommand::TimerEvent, command);\n  iren->CreateRepeatingTimer(50);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> istyle;\n  iren->SetInteractorStyle(istyle);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkNew<vtkDiscretizableColorTransferFunction> GetCTF()\n{\n  vtkNew<vtkDiscretizableColorTransferFunction> ctf;\n  ctf->SetColorSpaceToLab();\n  ctf->SetScaleToLinear();\n\n  ctf->AddRGBPoint(-30.3399130649763, 0.0862745098039216, 0.00392156862745098,\n                   0.298039215686275);\n  ctf->AddRGBPoint(-29.3502559661865, 0.113725, 0.0235294, 0.45098);\n  ctf->AddRGBPoint(-28.5283393859863, 0.105882, 0.0509804, 0.509804);\n  ctf->AddRGBPoint(-27.958028793335, 0.0392157, 0.0392157, 0.560784);\n  ctf->AddRGBPoint(-27.4044914245605, 0.0313725, 0.0980392, 0.6);\n  ctf->AddRGBPoint(-26.8677291870117, 0.0431373, 0.164706, 0.639216);\n  ctf->AddRGBPoint(-26.096134185791, 0.054902, 0.243137, 0.678431);\n  ctf->AddRGBPoint(-25.0729293823242, 0.054902, 0.317647, 0.709804);\n  ctf->AddRGBPoint(-23.8148933330084, 0.0509804, 0.396078, 0.741176);\n  ctf->AddRGBPoint(-22.9992658665124, 0.0392157, 0.466667, 0.768627);\n  ctf->AddRGBPoint(-22.1836384000164, 0.0313725, 0.537255, 0.788235);\n  ctf->AddRGBPoint(-21.3323650360107, 0.0313725, 0.615686, 0.811765);\n  ctf->AddRGBPoint(-20.4601268768311, 0.0235294, 0.709804, 0.831373);\n  ctf->AddRGBPoint(-19.5878868103027, 0.0509804, 0.8, 0.85098);\n  ctf->AddRGBPoint(-18.8666133880615, 0.0705882, 0.854902, 0.870588);\n  ctf->AddRGBPoint(-18.1956596374512, 0.262745, 0.901961, 0.862745);\n  ctf->AddRGBPoint(-17.6085758209229, 0.423529, 0.941176, 0.87451);\n  ctf->AddRGBPoint(-16.7027893066406, 0.572549, 0.964706, 0.835294);\n  ctf->AddRGBPoint(-16.0989303588867, 0.658824, 0.980392, 0.843137);\n  ctf->AddRGBPoint(-15.6628112792969, 0.764706, 0.980392, 0.866667);\n  ctf->AddRGBPoint(-15.1931447982788, 0.827451, 0.980392, 0.886275);\n  ctf->AddRGBPoint(-14.2705841064453, 0.913725, 0.988235, 0.937255);\n  ctf->AddRGBPoint(-13.9854288101196, 1, 1, 0.972549019607843);\n  ctf->AddRGBPoint(-13.7002735137939, 0.988235, 0.980392, 0.870588);\n  ctf->AddRGBPoint(-13.2809276580811, 0.992156862745098, 0.972549019607843,\n                   0.803921568627451);\n  ctf->AddRGBPoint(-12.9622249603271, 0.992157, 0.964706, 0.713725);\n  ctf->AddRGBPoint(-12.4254627227783, 0.988235, 0.956863, 0.643137);\n  ctf->AddRGBPoint(-11.5699977874756, 0.980392, 0.917647, 0.509804);\n  ctf->AddRGBPoint(-10.8487224578857, 0.968627, 0.87451, 0.407843);\n  ctf->AddRGBPoint(-10.1106739044189, 0.94902, 0.823529, 0.321569);\n  ctf->AddRGBPoint(-9.57391166687012, 0.929412, 0.776471, 0.278431);\n  ctf->AddRGBPoint(-8.78554153442383, 0.909804, 0.717647, 0.235294);\n  ctf->AddRGBPoint(-8.08104133605957, 0.890196, 0.658824, 0.196078);\n  ctf->AddRGBPoint(-7.50234400308847, 0.878431, 0.619608, 0.168627);\n  ctf->AddRGBPoint(-6.68671653659248, 0.870588, 0.54902, 0.156863);\n  ctf->AddRGBPoint(-5.87108907009648, 0.85098, 0.47451, 0.145098);\n  ctf->AddRGBPoint(-5.05546160360049, 0.831373, 0.411765, 0.133333);\n  ctf->AddRGBPoint(-4.23983413710449, 0.811765, 0.345098, 0.113725);\n  ctf->AddRGBPoint(-3.4242066706085, 0.788235, 0.266667, 0.0941176);\n  ctf->AddRGBPoint(-2.6085792041125, 0.741176, 0.184314, 0.0745098);\n  ctf->AddRGBPoint(-1.79295173761651, 0.690196, 0.12549, 0.0627451);\n  ctf->AddRGBPoint(-0.977324271120517, 0.619608, 0.0627451, 0.0431373);\n  ctf->AddRGBPoint(-0.214114964008331, 0.54902, 0.027451, 0.0705882);\n  ctf->AddRGBPoint(0.456838220357895, 0.470588, 0.0156863, 0.0901961);\n  ctf->AddRGBPoint(1.21166050434113, 0.4, 0.00392157, 0.101961);\n  ctf->AddRGBPoint(2.28518559486346, 0.188235294117647, 0, 0.0705882352941176);\n\n  ctf->SetNumberOfValues(46);\n  ctf->DiscretizeOff();\n  return ctf;\n}\n\nvoid Animate(vtkObject* caller, unsigned long /*eid*/, void* clientdata,\n             void* /*calldata*/)\n{\n  vtkRenderWindowInteractor* interactor =\n      vtkRenderWindowInteractor::SafeDownCast(caller);\n  vtkHDFReader* reader =\n      vtkHDFReader::SafeDownCast(static_cast<vtkObjectBase*>(clientdata));\n  reader->SetStep((reader->GetStep() == reader->GetNumberOfSteps() - 1)\n                      ? 0\n                      : reader->GetStep() + 1);\n  std::cout << \"Current step: \" << reader->GetStep() << std::endl;\n  reader->Update();\n  interactor->Render();\n}\n} // namespace\n
"},{"location":"Cxx/IO/TransientHDFReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransientHDFReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOHDF\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransientHDFReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransientHDFReader MACOSX_BUNDLE TransientHDFReader.cxx )\n  target_link_libraries(TransientHDFReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransientHDFReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/TransientHDFReader/#download-and-build-transienthdfreader","title":"Download and Build TransientHDFReader","text":"

Click here to download TransientHDFReader and its CMakeLists.txt file. Once the tarball TransientHDFReader.tar has been downloaded and extracted,

cd TransientHDFReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TransientHDFReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/VRMLImporter/","title":"VRMLImporter","text":"

vtk-examples/Cxx/IO/VRMLImporter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/VRMLImporter/#description","title":"Description","text":"

This example loads a wrl file and displays it on the screen. An example file to use is src/Testing/Data/sextant.wrl.

Seealso

VRMLImporterDemo shows how to add additional pipeline elements to imported polydata.

Warning

The vtkVRMLImporter only imports VRML 2.0 files.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/VRMLImporter/#code","title":"Code","text":"

VRMLImporter.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVRMLImporter.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: Filename e.g. sextant.wrl\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n  std::cout << \"Reading \" << filename << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VRMLImporter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // VRML Import\n  vtkNew<vtkVRMLImporter> importer;\n  importer->SetFileName(filename.c_str());\n  importer->SetRenderWindow(renderWindow);\n  importer->Update();\n\n  auto actors = renderer->GetActors();\n  std::cout << \"There are \" << actors->GetNumberOfItems() << \" actors\"\n            << std::endl;\n\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderWindow->SetSize(512, 512);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/VRMLImporter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VRMLImporter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VRMLImporter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VRMLImporter MACOSX_BUNDLE VRMLImporter.cxx )\n  target_link_libraries(VRMLImporter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VRMLImporter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/VRMLImporter/#download-and-build-vrmlimporter","title":"Download and Build VRMLImporter","text":"

Click here to download VRMLImporter and its CMakeLists.txt file. Once the tarball VRMLImporter.tar has been downloaded and extracted,

cd VRMLImporter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VRMLImporter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/VRMLImporterDemo/","title":"VRMLImporterDemo","text":"

vtk-examples/Cxx/IO/VRMLImporterDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/IO/VRMLImporterDemo/#description","title":"Description","text":"

vtkVRMLImporter imports multiple vtkActor models. Sometimes the vtkPolyData require modifications. For example the data in this example does not have normals. The example uses vtkActorCollection to walk each model's vtkPolyData and inserts a vtkPolyDataNormals if the normals do not exist.

Bug

vtkVRMLImporter files use a shininess between 0 and 1, while vtk's vtkProperty has a specular power between 0 and 128. The example corrects this if the specular power is <= 1.0.

Bug

vtkVRMLImporter incorrectly creates a vtkLookupTable for colorPerVertex. This example converts the vtkLookupTable to vtkPointData.

Tip

The Virtual Insect website has lots of cool wrl models of insects.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/VRMLImporterDemo/#code","title":"Code","text":"

VRMLImporterDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVRMLImporter.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: Filename e.g. grasshop.wrl\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n  std::cout << \"Reading \" << filename << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VRMLImporterDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // VRML Import\n  vtkNew<vtkVRMLImporter> importer;\n  importer->SetFileName(filename.c_str());\n  importer->SetRenderWindow(renderWindow);\n  importer->Update();\n\n  auto actors = renderer->GetActors();\n  std::cout << \"There are \" << actors->GetNumberOfItems() << \" actors\"\n            << std::endl;\n  actors->InitTraversal();\n  for (vtkIdType a = 0; a < actors->GetNumberOfItems(); ++a)\n  {\n    vtkActor* actor = actors->GetNextActor();\n\n    // The importer shininess parameter is between 0 and 1. VTK specular power\n    // is usually 10-100. Also, the default for the specular factor for VRML is\n    // 1, while VTK's is 0\n    double specularPower = actor->GetProperty()->GetSpecularPower();\n    if (specularPower <= 1.0)\n    {\n      actor->GetProperty()->SetSpecularPower(specularPower * 128.0);\n    }\n    double specular = actor->GetProperty()->GetSpecular();\n    if (specular == 0.0)\n    {\n      actor->GetProperty()->SetSpecular(1.0);\n    }\n#if 0\n    // The VRML default ambient intensity is .2\n    double ambientIntensity = actor->GetProperty()->GetAmbient();\n    if (ambientIntensity == 0.0)\n    {\n      actor->GetProperty()->SetAmbient(.2);\n    }\n#endif\n    vtkPolyDataMapper* mapper =\n        dynamic_cast<vtkPolyDataMapper*>(actor->GetMapper());\n    if (mapper)\n    {\n      vtkPolyData* dataSet = dynamic_cast<vtkPolyData*>(mapper->GetInput());\n      if (!dataSet->GetPointData()->GetNormals())\n      {\n        vtkNew<vtkPolyDataNormals> normals;\n        normals->SetInputData(dataSet);\n        normals->SplittingOff();\n        normals->Update();\n        mapper->SetInputData(normals->GetOutput());\n      }\n\n      // If there is a lookup table, convert it to point data\n      vtkLookupTable* lut =\n          dynamic_cast<vtkLookupTable*>(mapper->GetLookupTable());\n      if (lut && mapper->GetScalarVisibility())\n      {\n        vtkNew<vtkUnsignedCharArray> pc;\n        pc->SetNumberOfComponents(4);\n        pc->SetNumberOfTuples(lut->GetNumberOfColors());\n        for (int t = 0; t < lut->GetNumberOfColors(); ++t)\n        {\n          double* lutc = lut->GetTableValue(t);\n          unsigned char lutuc[4];\n          lut->GetColorAsUnsignedChars(lutc, lutuc);\n          pc->SetTypedTuple(t, lutuc);\n        }\n        mapper->SetLookupTable(NULL);\n        mapper->GetInput()->GetPointData()->SetScalars(pc);\n      }\n    }\n  }\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n\n  renderer->SetBackground(colors->GetColor3d(\"SpringGreen\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/VRMLImporterDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VRMLImporterDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VRMLImporterDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VRMLImporterDemo MACOSX_BUNDLE VRMLImporterDemo.cxx )\n  target_link_libraries(VRMLImporterDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VRMLImporterDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/VRMLImporterDemo/#download-and-build-vrmlimporterdemo","title":"Download and Build VRMLImporterDemo","text":"

Click here to download VRMLImporterDemo and its CMakeLists.txt file. Once the tarball VRMLImporterDemo.tar has been downloaded and extracted,

cd VRMLImporterDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VRMLImporterDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/WriteBMP/","title":"WriteBMP","text":"

vtk-examples/Cxx/IO/WriteBMP

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/WriteBMP/#code","title":"Code","text":"

WriteBMP.cxx

#include <vtkBMPReader.h>\n#include <vtkBMPWriter.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: OutputFilename.bmp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  // Convert our unsigned char colors to doubles.\n  // Set draw color needs doubles.\n  auto color1 = colors->GetColor4ub(\"SteelBlue\").GetData();\n  auto color2 = colors->GetColor4ub(\"PaleGoldenrod\").GetData();\n  std::array<double, 4> sourceColor1{0, 0, 0, 0};\n  std::array<double, 4> sourceColor2{0, 0, 0, 0};\n  // Leave alpha at zero.\n  for (auto i = 0; i < 3; ++i)\n  {\n    sourceColor1[i] = color1[i];\n    sourceColor2[i] = color2[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 9, 0, 9, 0, 0);\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetDrawColor(sourceColor1.data());\n  imageSource->FillBox(0, 9, 0, 9);\n  imageSource->SetDrawColor(sourceColor2.data());\n  imageSource->FillBox(5, 7, 5, 7);\n  imageSource->Update();\n\n  vtkNew<vtkBMPWriter> bmpWriter;\n  bmpWriter->SetFileName(filename.c_str());\n  bmpWriter->SetInputConnection(imageSource->GetOutputPort());\n  bmpWriter->Write();\n\n  // Read and display for verification.\n  vtkNew<vtkBMPReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WriteBMP\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/WriteBMP/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteBMP)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteBMP: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteBMP MACOSX_BUNDLE WriteBMP.cxx )\n  target_link_libraries(WriteBMP PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteBMP\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/WriteBMP/#download-and-build-writebmp","title":"Download and Build WriteBMP","text":"

Click here to download WriteBMP and its CMakeLists.txt file. Once the tarball WriteBMP.tar has been downloaded and extracted,

cd WriteBMP/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WriteBMP\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/WriteLegacyLinearCells/","title":"WriteLegacyLinearCells","text":"

vtk-examples/Cxx/IO/WriteLegacyLinearCells

"},{"location":"Cxx/IO/WriteLegacyLinearCells/#description","title":"Description","text":"

This example uses vtkUnstructuredGridWriter to write each linear cell into a .vtk file. The files are written into the current directory.

Seealso

WriteXMLLinearCells writes the same files using the VTK XML format.

Cite

The VTK File Formats document discusses the XML file format.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/WriteLegacyLinearCells/#code","title":"Code","text":"

WriteLegacyLinearCells.cxx

#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridWriter.h>\n\n#include <vtkHexagonalPrism.h>\n#include <vtkHexahedron.h>\n#include <vtkLine.h>\n#include <vtkPentagonalPrism.h>\n#include <vtkPixel.h>\n#include <vtkPolyLine.h>\n#include <vtkPolyVertex.h>\n#include <vtkPolygon.h>\n#include <vtkPyramid.h>\n#include <vtkQuad.h>\n#include <vtkTetra.h>\n#include <vtkTriangle.h>\n#include <vtkTriangleStrip.h>\n#include <vtkVertex.h>\n#include <vtkVoxel.h>\n#include <vtkWedge.h>\n\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n// These functions return a vtkUnstructured grid corresponding to the object.\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid> MakeUnstructuredGrid(vtkSmartPointer<T>);\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon();\n} // namespace\n\nint main(int, char*[])\n{\n  std::vector<std::string> filenames;\n  std::vector<vtkSmartPointer<vtkUnstructuredGrid>> uGrids;\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkVertex>::New()));\n  filenames.push_back(\"Vertex.vtk\");\n\n  uGrids.push_back(MakePolyVertex());\n  filenames.push_back(\"PolyVertex.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkLine>::New()));\n  filenames.push_back(\"Line.vtk\");\n\n  uGrids.push_back(MakePolyLine());\n  filenames.push_back(\"PolyLine.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkTriangle>::New()));\n  filenames.push_back(\"Triangle.vtk\");\n\n  uGrids.push_back(MakeTriangleStrip());\n  filenames.push_back(\"TriangleStrip.vtk\");\n\n  uGrids.push_back(MakePolygon());\n  filenames.push_back(\"Polygon.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkPixel>::New()));\n  filenames.push_back(\"Pixel.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkQuad>::New()));\n  filenames.push_back(\"Quad.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkTetra>::New()));\n  filenames.push_back(\"Tetra.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkVoxel>::New()));\n  filenames.push_back(\"Voxel.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkHexahedron>::New()));\n  filenames.push_back(\"Hexahedron.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkWedge>::New()));\n  filenames.push_back(\"Wedge.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkPyramid>::New()));\n  filenames.push_back(\"Pyramid.vtk\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkPentagonalPrism>::New()));\n  filenames.push_back(\"PentagonalPrism.vtk\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkHexagonalPrism>::New()));\n  filenames.push_back(\"HexagonalPrism.vtk\");\n\n  // Write each grid into a file.\n  for (unsigned int i = 0; i < uGrids.size(); ++i)\n  {\n    std::cout << \"Writing: \" << filenames[i] << std::endl;\n    vtkNew<vtkUnstructuredGridWriter> writer;\n    writer->SetFileName(filenames[i].c_str());\n    writer->SetInputData(uGrids[i]);\n    writer->Write();\n  }\n\n  return EXIT_SUCCESS;\n}\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid>\nMakeUnstructuredGrid(vtkSmartPointer<T> aCell)\n{\n  double* pcoords = aCell->GetParametricCoords();\n  for (int i = 0; i < aCell->GetNumberOfPoints(); ++i)\n  {\n    aCell->GetPointIds()->SetId(i, i);\n    aCell->GetPoints()->SetPoint(i, *(pcoords + 3 * i), *(pcoords + 3 * i + 1),\n                                 *(pcoords + 3 * i + 2));\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(aCell->GetPoints());\n  ug->InsertNextCell(aCell->GetCellType(), aCell->GetPointIds());\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex()\n{\n  // A polyvertex is a cell represents a set of 0D vertices.\n  int numberOfVertices = 6;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, .4);\n  points->InsertNextPoint(0, 1, .6);\n\n  vtkNew<vtkPolyVertex> polyVertex;\n  polyVertex->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyVertex->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyVertex->GetCellType(), polyVertex->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine()\n{\n  // A polyline is a cell that represents a set of 1D lines.\n  int numberOfVertices = 5;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, .5, 0);\n  points->InsertNextPoint(.5, 0, 0);\n  points->InsertNextPoint(1, .3, 0);\n  points->InsertNextPoint(1.5, .4, 0);\n  points->InsertNextPoint(2.0, .4, 0);\n\n  vtkNew<vtkPolyLine> polyline;\n  polyline->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyline->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyline->GetCellType(), polyline->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip()\n{\n  // A triangle is a cell that represents a triangle strip.\n  int numberOfVertices = 10;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(.5, 1, 0);\n  points->InsertNextPoint(1, -.1, 0);\n  points->InsertNextPoint(1.5, .8, 0);\n  points->InsertNextPoint(2.0, -.1, 0);\n  points->InsertNextPoint(2.5, .9, 0);\n  points->InsertNextPoint(3.0, 0, 0);\n  points->InsertNextPoint(3.5, .8, 0);\n  points->InsertNextPoint(4.0, -.2, 0);\n  points->InsertNextPoint(4.5, 1.1, 0);\n\n  vtkNew<vtkTriangleStrip> trianglestrip;\n  trianglestrip->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    trianglestrip->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(trianglestrip->GetCellType(),\n                     trianglestrip->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon()\n{\n  // A polygon is a cell that represents a polygon.\n  int numberOfVertices = 6;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, -.1, 0);\n  points->InsertNextPoint(.8, .5, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(.6, 1.2, 0);\n  points->InsertNextPoint(0, .8, 0);\n\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polygon->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polygon->GetCellType(), polygon->GetPointIds());\n\n  return ug;\n}\n} // namespace\n
"},{"location":"Cxx/IO/WriteLegacyLinearCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteLegacyLinearCells)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOLegacy\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteLegacyLinearCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteLegacyLinearCells MACOSX_BUNDLE WriteLegacyLinearCells.cxx )\n  target_link_libraries(WriteLegacyLinearCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteLegacyLinearCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/WriteLegacyLinearCells/#download-and-build-writelegacylinearcells","title":"Download and Build WriteLegacyLinearCells","text":"

Click here to download WriteLegacyLinearCells and its CMakeLists.txt file. Once the tarball WriteLegacyLinearCells.tar has been downloaded and extracted,

cd WriteLegacyLinearCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WriteLegacyLinearCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/WritePLY/","title":"WritePLY","text":"

vtk-examples/Cxx/IO/WritePLY

"},{"location":"Cxx/IO/WritePLY/#description","title":"Description","text":"

Note

Unlike vtkPolyDataXMLWriter and most other VTK writers, to write colors to the .ply file you must specify to the vtkPLYWriter:

plyWriter->SetArrayName(\"Colors\");

where your color array was created/named like this:

vtkNew<vtkUnsignedCharArray> colors; colors->SetNumberOfComponents(3); colors->SetName(\"Colors\");

(This was found in response to a user question on StackOverflow: http://stackoverflow.com/questions/17783612/save-mesh-with-rgb-in-vtk/19525938)

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/WritePLY/#code","title":"Code","text":"

WritePLY.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPLYReader.h>\n#include <vtkPLYWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: filename.ply\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPLYWriter> plyWriter;\n  plyWriter->SetFileName(filename.c_str());\n  plyWriter->SetInputConnection(sphereSource->GetOutputPort());\n  plyWriter->Write();\n\n  // Read and display for verification\n  vtkNew<vtkPLYReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WritePLY\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"cobalt_green\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/WritePLY/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WritePLY)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOPLY\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WritePLY: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WritePLY MACOSX_BUNDLE WritePLY.cxx )\n  target_link_libraries(WritePLY PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WritePLY\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/WritePLY/#download-and-build-writeply","title":"Download and Build WritePLY","text":"

Click here to download WritePLY and its CMakeLists.txt file. Once the tarball WritePLY.tar has been downloaded and extracted,

cd WritePLY/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WritePLY\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/WritePNM/","title":"WritePNM","text":"

vtk-examples/Cxx/IO/WritePNM

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/WritePNM/#code","title":"Code","text":"

WritePNM.cxx

#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNMReader.h>\n#include <vtkPNMWriter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: OutputFilename.pnm\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  // Convert our unsigned char colors to doubles.\n  // Set draw color needs doubles.\n  auto color1 = colors->GetColor4ub(\"SteelBlue\").GetData();\n  auto color2 = colors->GetColor4ub(\"PaleGoldenrod\").GetData();\n  std::array<double, 4> sourceColor1{0, 0, 0, 0};\n  std::array<double, 4> sourceColor2{0, 0, 0, 0};\n  // Leave alpha at zero.\n  for (auto i = 0; i < 3; ++i)\n  {\n    sourceColor1[i] = color1[i];\n    sourceColor2[i] = color2[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 9, 0, 9, 0, 0);\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetDrawColor(sourceColor1.data());\n  imageSource->FillBox(0, 9, 0, 9);\n  imageSource->SetDrawColor(sourceColor2.data());\n  imageSource->FillBox(5, 7, 5, 7);\n  imageSource->Update();\n\n  vtkNew<vtkPNMWriter> pnmWriter;\n  pnmWriter->SetFileName(filename.c_str());\n  pnmWriter->SetInputConnection(imageSource->GetOutputPort());\n  pnmWriter->Write();\n\n  // Read and display for verification.\n  vtkNew<vtkPNMReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WritePNM\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/WritePNM/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WritePNM)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WritePNM: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WritePNM MACOSX_BUNDLE WritePNM.cxx )\n  target_link_libraries(WritePNM PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WritePNM\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/WritePNM/#download-and-build-writepnm","title":"Download and Build WritePNM","text":"

Click here to download WritePNM and its CMakeLists.txt file. Once the tarball WritePNM.tar has been downloaded and extracted,

cd WritePNM/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WritePNM\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/WriteSTL/","title":"WriteSTL","text":"

vtk-examples/Cxx/IO/WriteSTL

"},{"location":"Cxx/IO/WriteSTL/#description","title":"Description","text":"

An STL file describes a triangulated three-dimensional surface by the unit normal and vertices (ordered by the right-hand rule) of the triangles. This example saves 3D geometric data stored in a vtkPolyData object to an STL file using vtkSTLWriter.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/WriteSTL/#code","title":"Code","text":"

WriteSTL.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSTLWriter.h>\n#include <vtkSphereSource.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: filename.stl\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkSTLWriter> stlWriter;\n  stlWriter->SetFileName(filename.c_str());\n  stlWriter->SetInputConnection(sphereSource->GetOutputPort());\n  stlWriter->Write();\n\n  // Read and display for verification.\n  vtkNew<vtkSTLReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WriteSTL\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"cobalt_green\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/WriteSTL/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteSTL)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteSTL: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteSTL MACOSX_BUNDLE WriteSTL.cxx )\n  target_link_libraries(WriteSTL PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteSTL\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/WriteSTL/#download-and-build-writestl","title":"Download and Build WriteSTL","text":"

Click here to download WriteSTL and its CMakeLists.txt file. Once the tarball WriteSTL.tar has been downloaded and extracted,

cd WriteSTL/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WriteSTL\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/WriteTIFF/","title":"WriteTIFF","text":"

vtk-examples/Cxx/IO/WriteTIFF

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/WriteTIFF/#code","title":"Code","text":"

WriteTIFF.cxx

#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTIFFReader.h>\n#include <vtkTIFFWriter.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: OutputFilename.tif\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  // Convert our unsigned char colors to doubles.\n  // Set draw color needs doubles.\n  auto color1 = colors->GetColor4ub(\"SteelBlue\").GetData();\n  auto color2 = colors->GetColor4ub(\"PaleGoldenrod\").GetData();\n  std::array<double, 4> sourceColor1{0, 0, 0, 0};\n  std::array<double, 4> sourceColor2{0, 0, 0, 0};\n  // Leave alpha at zero.\n  for (auto i = 0; i < 3; ++i)\n  {\n    sourceColor1[i] = color1[i];\n    sourceColor2[i] = color2[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 9, 0, 9, 0, 0);\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetDrawColor(sourceColor1.data());\n  imageSource->FillBox(0, 9, 0, 9);\n  imageSource->SetDrawColor(sourceColor2.data());\n  imageSource->FillBox(5, 7, 5, 7);\n  imageSource->Update();\n\n  vtkNew<vtkTIFFWriter> tiffWriter;\n  tiffWriter->SetFileName(filename.c_str());\n  tiffWriter->SetInputConnection(imageSource->GetOutputPort());\n  tiffWriter->Write();\n\n  // Read and display for verification.\n  vtkNew<vtkTIFFReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  // Setup renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WriteTIFF\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/WriteTIFF/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteTIFF)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteTIFF: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteTIFF MACOSX_BUNDLE WriteTIFF.cxx )\n  target_link_libraries(WriteTIFF PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteTIFF\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/WriteTIFF/#download-and-build-writetiff","title":"Download and Build WriteTIFF","text":"

Click here to download WriteTIFF and its CMakeLists.txt file. Once the tarball WriteTIFF.tar has been downloaded and extracted,

cd WriteTIFF/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WriteTIFF\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/WriteVTI/","title":"WriteVTI","text":"

vtk-examples/Cxx/IO/WriteVTI

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/WriteVTI/#code","title":"Code","text":"

WriteVTI.cxx

#include <vtkActor.h>\n#include <vtkImageData.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLImageDataReader.h>\n#include <vtkXMLImageDataWriter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse command line arguments\n  if (argc != 2)\n  {\n    std::cout << \"Required arguments: filename.vti\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkImageData> imageData;\n  imageData->SetDimensions(3, 4, 5);\n  imageData->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = imageData->GetDimensions();\n\n  // Fill every entry of the image data with \"2.0\"\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel =\n            static_cast<double*>(imageData->GetScalarPointer(x, y, z));\n        pixel[0] = 2.0;\n      }\n    }\n  }\n\n  vtkNew<vtkXMLImageDataWriter> writer;\n  writer->SetFileName(filename.c_str());\n  writer->SetInputData(imageData);\n  writer->Write();\n\n  // Read the file (to test that it was written correctly)\n  vtkNew<vtkXMLImageDataReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Convert the image to a polydata\n  vtkNew<vtkImageDataGeometryFilter> imageDataGeometryFilter;\n  imageDataGeometryFilter->SetInputConnection(reader->GetOutputPort());\n  imageDataGeometryFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(imageDataGeometryFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(3);\n\n  // Setup rendering\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WriteVTI\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/WriteVTI/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteVTI)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteVTI: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteVTI MACOSX_BUNDLE WriteVTI.cxx )\n  target_link_libraries(WriteVTI PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteVTI\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/WriteVTI/#download-and-build-writevti","title":"Download and Build WriteVTI","text":"

Click here to download WriteVTI and its CMakeLists.txt file. Once the tarball WriteVTI.tar has been downloaded and extracted,

cd WriteVTI/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WriteVTI\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/WriteVTP/","title":"WriteVTP","text":"

vtk-examples/Cxx/IO/WriteVTP

"},{"location":"Cxx/IO/WriteVTP/#description","title":"Description","text":"

In this example, we add 10 points to a polygonal data (polydata) object and write the result to a VTP file.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/WriteVTP/#code","title":"Code","text":"

WriteVTP.cxx

#include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataWriter.h>\n\nint main(int, char*[])\n{\n  // Create 10 points.\n  vtkNew<vtkPoints> points;\n\n  for (unsigned int i = 0; i < 10; ++i)\n  {\n    points->InsertNextPoint(i, i, i);\n  }\n\n  // Create a polydata object and add the points to it.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Write the file\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(\"test.vtp\");\n  writer->SetInputData(polydata);\n\n  // Optional - set the mode. The default is binary.\n  // writer->SetDataModeToBinary();\n  // writer->SetDataModeToAscii();\n\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/WriteVTP/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteVTP)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteVTP: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteVTP MACOSX_BUNDLE WriteVTP.cxx )\n  target_link_libraries(WriteVTP PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteVTP\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/WriteVTP/#download-and-build-writevtp","title":"Download and Build WriteVTP","text":"

Click here to download WriteVTP and its CMakeLists.txt file. Once the tarball WriteVTP.tar has been downloaded and extracted,

cd WriteVTP/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WriteVTP\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/WriteVTU/","title":"WriteVTU","text":"

vtk-examples/Cxx/IO/WriteVTU

"},{"location":"Cxx/IO/WriteVTU/#description","title":"Description","text":"

This example writes a VTU file.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/WriteVTU/#code","title":"Code","text":"

WriteVTU.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTetra.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridReader.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required arguments: OutputFilename.vtu\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 1);\n\n  vtkNew<vtkTetra> tetra;\n\n  tetra->GetPointIds()->SetId(0, 0);\n  tetra->GetPointIds()->SetId(1, 1);\n  tetra->GetPointIds()->SetId(2, 2);\n  tetra->GetPointIds()->SetId(3, 3);\n\n  vtkNew<vtkCellArray> cellArray;\n  cellArray->InsertNextCell(tetra);\n\n  vtkNew<vtkUnstructuredGrid> unstructuredGrid;\n  unstructuredGrid->SetPoints(points);\n  unstructuredGrid->SetCells(VTK_TETRA, cellArray);\n\n  // Write file.\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetFileName(filename.c_str());\n  writer->SetInputData(unstructuredGrid);\n  writer->Write();\n\n  // Read and display file for verification that it was written correclty.\n  vtkNew<vtkXMLUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WriteVTU\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"cobalt_green\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/WriteVTU/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteVTU)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteVTU: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteVTU MACOSX_BUNDLE WriteVTU.cxx )\n  target_link_libraries(WriteVTU PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteVTU\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/WriteVTU/#download-and-build-writevtu","title":"Download and Build WriteVTU","text":"

Click here to download WriteVTU and its CMakeLists.txt file. Once the tarball WriteVTU.tar has been downloaded and extracted,

cd WriteVTU/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WriteVTU\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/WriteXMLLinearCells/","title":"WriteXMLLinearCells","text":"

vtk-examples/Cxx/IO/WriteXMLLinearCells

"},{"location":"Cxx/IO/WriteXMLLinearCells/#description","title":"Description","text":"

This example uses vtkXMLDataSetWriter to write each linear cell into a .vtu file. The files are written into the current directory.

Seealso

WriteLegacyLinearCells writes the same files using the VTK legacy format.

Cite

The VTK File Formats document discusses the XML file format.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/WriteXMLLinearCells/#code","title":"Code","text":"

WriteXMLLinearCells.cxx

#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLDataSetWriter.h>\n\n#include <vtkHexagonalPrism.h>\n#include <vtkHexahedron.h>\n#include <vtkLine.h>\n#include <vtkPentagonalPrism.h>\n#include <vtkPixel.h>\n#include <vtkPolyLine.h>\n#include <vtkPolyVertex.h>\n#include <vtkPolygon.h>\n#include <vtkPyramid.h>\n#include <vtkQuad.h>\n#include <vtkTetra.h>\n#include <vtkTriangle.h>\n#include <vtkTriangleStrip.h>\n#include <vtkVertex.h>\n#include <vtkVoxel.h>\n#include <vtkWedge.h>\n\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n// These functions return a vtkUnstructured grid corresponding to the object.\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid> MakeUnstructuredGrid(vtkSmartPointer<T>);\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon();\n} // namespace\n\nint main(int, char*[])\n{\n  std::vector<std::string> filenames;\n  std::vector<vtkSmartPointer<vtkUnstructuredGrid>> uGrids;\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkVertex>::New()));\n  filenames.push_back(\"Vertex.vtu\");\n\n  uGrids.push_back(MakePolyVertex());\n  filenames.push_back(\"PolyVertex.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkLine>::New()));\n  filenames.push_back(\"Line.vtu\");\n\n  uGrids.push_back(MakePolyLine());\n  filenames.push_back(\"PolyLine.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkTriangle>::New()));\n  filenames.push_back(\"Triangle.vtu\");\n\n  uGrids.push_back(MakeTriangleStrip());\n  filenames.push_back(\"TriangleStrip.vtu\");\n\n  uGrids.push_back(MakePolygon());\n  filenames.push_back(\"Polygon.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkPixel>::New()));\n  filenames.push_back(\"Pixel.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkQuad>::New()));\n  filenames.push_back(\"Quad.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkTetra>::New()));\n  filenames.push_back(\"Tetra.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkVoxel>::New()));\n  filenames.push_back(\"Voxel.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkHexahedron>::New()));\n  filenames.push_back(\"Hexahedron.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkWedge>::New()));\n  filenames.push_back(\"Wedge.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkPyramid>::New()));\n  filenames.push_back(\"Pyramid.vtu\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkPentagonalPrism>::New()));\n  filenames.push_back(\"PentagonalPrism.vtu\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkHexagonalPrism>::New()));\n  filenames.push_back(\"HexagonalPrism.vtu\");\n\n  // Write each grid into  a file\n  for (unsigned int i = 0; i < uGrids.size(); ++i)\n  {\n    std::cout << \"Writing: \" << filenames[i] << std::endl;\n    vtkNew<vtkXMLDataSetWriter> writer;\n    writer->SetFileName(filenames[i].c_str());\n    writer->SetInputData(uGrids[i]);\n    writer->Write();\n  }\n\n  return EXIT_SUCCESS;\n}\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid>\nMakeUnstructuredGrid(vtkSmartPointer<T> aCell)\n{\n  double* pcoords = aCell->GetParametricCoords();\n  for (int i = 0; i < aCell->GetNumberOfPoints(); ++i)\n  {\n    aCell->GetPointIds()->SetId(i, i);\n    aCell->GetPoints()->SetPoint(i, *(pcoords + 3 * i), *(pcoords + 3 * i + 1),\n                                 *(pcoords + 3 * i + 2));\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(aCell->GetPoints());\n  ug->InsertNextCell(aCell->GetCellType(), aCell->GetPointIds());\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex()\n{\n  // A polyvertex is a cell represents a set of 0D vertices\n  int numberOfVertices = 6;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, .4);\n  points->InsertNextPoint(0, 1, .6);\n\n  vtkNew<vtkPolyVertex> polyVertex;\n  polyVertex->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyVertex->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyVertex->GetCellType(), polyVertex->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine()\n{\n  // A polyline is a cell that represents a set of 1D lines\n  int numberOfVertices = 5;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, .5, 0);\n  points->InsertNextPoint(.5, 0, 0);\n  points->InsertNextPoint(1, .3, 0);\n  points->InsertNextPoint(1.5, .4, 0);\n  points->InsertNextPoint(2.0, .4, 0);\n\n  vtkNew<vtkPolyLine> polyline;\n  polyline->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyline->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyline->GetCellType(), polyline->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip()\n{\n  // A triangle is a cell that represents a triangle strip\n  int numberOfVertices = 10;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(.5, 1, 0);\n  points->InsertNextPoint(1, -.1, 0);\n  points->InsertNextPoint(1.5, .8, 0);\n  points->InsertNextPoint(2.0, -.1, 0);\n  points->InsertNextPoint(2.5, .9, 0);\n  points->InsertNextPoint(3.0, 0, 0);\n  points->InsertNextPoint(3.5, .8, 0);\n  points->InsertNextPoint(4.0, -.2, 0);\n  points->InsertNextPoint(4.5, 1.1, 0);\n\n  vtkNew<vtkTriangleStrip> trianglestrip;\n  trianglestrip->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    trianglestrip->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(trianglestrip->GetCellType(),\n                     trianglestrip->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon()\n{\n  // A polygon is a cell that represents a polygon\n  int numberOfVertices = 6;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, -.1, 0);\n  points->InsertNextPoint(.8, .5, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(.6, 1.2, 0);\n  points->InsertNextPoint(0, .8, 0);\n\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polygon->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polygon->GetCellType(), polygon->GetPointIds());\n\n  return ug;\n}\n} // namespace\n
"},{"location":"Cxx/IO/WriteXMLLinearCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteXMLLinearCells)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteXMLLinearCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteXMLLinearCells MACOSX_BUNDLE WriteXMLLinearCells.cxx )\n  target_link_libraries(WriteXMLLinearCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteXMLLinearCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/WriteXMLLinearCells/#download-and-build-writexmllinearcells","title":"Download and Build WriteXMLLinearCells","text":"

Click here to download WriteXMLLinearCells and its CMakeLists.txt file. Once the tarball WriteXMLLinearCells.tar has been downloaded and extracted,

cd WriteXMLLinearCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WriteXMLLinearCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/XMLPImageDataWriter/","title":"XMLPImageDataWriter","text":"

vtk-examples/Cxx/IO/XMLPImageDataWriter

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/XMLPImageDataWriter/#code","title":"Code","text":"

XMLPImageDataWriter.cxx

#include <vtkImageCanvasSource2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkXMLPImageDataWriter.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Convert our unsigned char colors to doubles\n  // Set draw color needs doubles.\n  auto color1 = colors->GetColor3ub(\"SteelBlue\").GetData();\n  auto color2 = colors->GetColor3ub(\"PaleGoldenrod\").GetData();\n  std::array<double, 3> sourceColor1{0, 0, 0};\n  std::array<double, 3> sourceColor2{0, 0, 0};\n  for (auto i = 0; i < 3; ++i)\n  {\n    sourceColor1[i] = color1[i];\n    sourceColor2[i] = color2[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetExtent(0, 20, 0, 50, 0, 1);\n  drawing->SetDrawColor(sourceColor1.data());\n  drawing->FillBox(0, 9, 0, 9);\n  drawing->SetDrawColor(sourceColor2.data());\n  drawing->DrawCircle(5, 5, 3);\n\n  int numberOfPieces = 4;\n\n  vtkNew<vtkXMLPImageDataWriter> writer;\n  writer->SetInputConnection(drawing->GetOutputPort());\n  writer->SetFileName(\"Test.pvti\");\n  writer->SetNumberOfPieces(numberOfPieces);\n  writer->SetEndPiece(numberOfPieces - 1);\n  writer->SetStartPiece(0);\n  writer->Update();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/XMLPImageDataWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(XMLPImageDataWriter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOParallelXML\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"XMLPImageDataWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(XMLPImageDataWriter MACOSX_BUNDLE XMLPImageDataWriter.cxx )\n  target_link_libraries(XMLPImageDataWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS XMLPImageDataWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/XMLPImageDataWriter/#download-and-build-xmlpimagedatawriter","title":"Download and Build XMLPImageDataWriter","text":"

Click here to download XMLPImageDataWriter and its CMakeLists.txt file. Once the tarball XMLPImageDataWriter.tar has been downloaded and extracted,

cd XMLPImageDataWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./XMLPImageDataWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/XMLPUnstructuredGridWriter/","title":"XMLPUnstructuredGridWriter","text":"

vtk-examples/Cxx/IO/XMLPUnstructuredGridWriter

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/XMLPUnstructuredGridWriter/#code","title":"Code","text":"

XMLPUnstructuredGridWriter.cxx

#include <vtkDelaunay3D.h>\n#include <vtkNew.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPUnstructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkDelaunay3D> delaunay;\n  delaunay->SetInputConnection(sphereSource->GetOutputPort());\n  delaunay->Update();\n\n  vtkNew<vtkXMLPUnstructuredGridWriter> writer;\n  writer->SetInputConnection(delaunay->GetOutputPort());\n  writer->SetFileName(\"Test.pvtu\");\n  writer->SetNumberOfPieces(4);\n  writer->SetStartPiece(0);\n  writer->SetEndPiece(3);\n  writer->Update();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/XMLPUnstructuredGridWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(XMLPUnstructuredGridWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOParallelXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"XMLPUnstructuredGridWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(XMLPUnstructuredGridWriter MACOSX_BUNDLE XMLPUnstructuredGridWriter.cxx )\n  target_link_libraries(XMLPUnstructuredGridWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS XMLPUnstructuredGridWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/XMLPUnstructuredGridWriter/#download-and-build-xmlpunstructuredgridwriter","title":"Download and Build XMLPUnstructuredGridWriter","text":"

Click here to download XMLPUnstructuredGridWriter and its CMakeLists.txt file. Once the tarball XMLPUnstructuredGridWriter.tar has been downloaded and extracted,

cd XMLPUnstructuredGridWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./XMLPUnstructuredGridWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/IO/XMLStructuredGridWriter/","title":"XMLStructuredGridWriter","text":"

vtk-examples/Cxx/IO/XMLStructuredGridWriter

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/IO/XMLStructuredGridWriter/#code","title":"Code","text":"

XMLStructuredGridWriter.cxx

#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkStructuredGrid.h>\n#include <vtkXMLStructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  // Create a grid.\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  vtkNew<vtkPoints> points;\n\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 2, 0);\n  points->InsertNextPoint(1, 2, 1);\n\n  // Specify the dimensions of the grid.\n  structuredGrid->SetDimensions(2, 3, 1);\n  structuredGrid->SetPoints(points);\n\n  // Write file.\n  vtkNew<vtkXMLStructuredGridWriter> writer;\n  writer->SetFileName(\"output.vts\");\n  writer->SetInputData(structuredGrid);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/IO/XMLStructuredGridWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(XMLStructuredGridWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"XMLStructuredGridWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(XMLStructuredGridWriter MACOSX_BUNDLE XMLStructuredGridWriter.cxx )\n  target_link_libraries(XMLStructuredGridWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS XMLStructuredGridWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/IO/XMLStructuredGridWriter/#download-and-build-xmlstructuredgridwriter","title":"Download and Build XMLStructuredGridWriter","text":"

Click here to download XMLStructuredGridWriter and its CMakeLists.txt file. Once the tarball XMLStructuredGridWriter.tar has been downloaded and extracted,

cd XMLStructuredGridWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./XMLStructuredGridWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/CellIdFromGridCoordinates/","title":"CellIdFromGridCoordinates","text":"

vtk-examples/Cxx/ImageData/CellIdFromGridCoordinates

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/CellIdFromGridCoordinates/#code","title":"Code","text":"

CellIdFromGridCoordinates.cxx

#include <vtkImageData.h>\n#include <vtkNew.h>\n#include <vtkStructuredData.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkImageData> grid;\n  grid->SetOrigin(0, 0, 0);\n\n  unsigned int numVoxelsPerDimension =\n      2; // the number of voxels in each dimension\n  grid->SetSpacing(1, 1, 1);\n\n  int extent[6];\n  extent[0] = 0;\n  extent[1] = numVoxelsPerDimension;\n  extent[2] = 0;\n  extent[3] = numVoxelsPerDimension;\n  extent[4] = 0;\n  extent[5] = numVoxelsPerDimension;\n  grid->SetExtent(extent);\n  grid->AllocateScalars(VTK_INT, 1);\n\n  for (unsigned int i = 0; i < numVoxelsPerDimension; ++i)\n  {\n    for (unsigned int j = 0; j < numVoxelsPerDimension; ++j)\n    {\n      for (unsigned int k = 0; k < numVoxelsPerDimension; ++k)\n      {\n        int pos[3];\n        pos[0] = i;\n        pos[1] = j;\n        pos[2] = k;\n\n        vtkIdType id = vtkStructuredData::ComputeCellIdForExtent(extent, pos);\n        std::cout << \"Cell \" << i << \" \" << j << \" \" << k << \" has id : \" << id\n                  << std::endl;\n      }\n    }\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageData/CellIdFromGridCoordinates/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellIdFromGridCoordinates)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellIdFromGridCoordinates: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellIdFromGridCoordinates MACOSX_BUNDLE CellIdFromGridCoordinates.cxx )\n  target_link_libraries(CellIdFromGridCoordinates PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellIdFromGridCoordinates\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/CellIdFromGridCoordinates/#download-and-build-cellidfromgridcoordinates","title":"Download and Build CellIdFromGridCoordinates","text":"

Click here to download CellIdFromGridCoordinates and its CMakeLists.txt file. Once the tarball CellIdFromGridCoordinates.tar has been downloaded and extracted,

cd CellIdFromGridCoordinates/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellIdFromGridCoordinates\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/ClipVolume/","title":"ClipVolume","text":"

vtk-examples/Cxx/ImageData/ClipVolume

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageData/ClipVolume/#description","title":"Description","text":"

This example shows how to use vtkClipVolume and subclasses of vtkImplicitFunction, producing a vtkUnstructuredGrid. The output consists of vtkTetra or other 3D cell types.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/ClipVolume/#code","title":"Code","text":"

ClipVolume.cxx

// This program draws a checkerboard and clips it with two planes.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipVolume.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkExecutive.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkLookupTable.h>\n#include <vtkMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nconstexpr auto IMAGESIZE{64};  // number of checkerboard squares on a side\nconstexpr auto CUBESIZE{20.0}; // physical linear dimension of entire system\n\n// Color for the checkerboard image\nconstexpr auto DIM{0.5}; // amount to dim the dark squares by\n\n// Offsets for clipping planes with normals in the X and Y directions\nconstexpr auto XOFFSET{8};\nconstexpr auto YOFFSET{8};\n\n///////////////////\n\n// Make the image data. A checkerboard pattern is used for\n// simplicity.\nvtkSmartPointer<vtkImageData> makeImage(int n, vtkColor3d fillColor,\n                                        vtkColor3d checkerColor);\n} // namespace\n\nint main(int, char*[])\n{\n\n  vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();\n\n  // Define colors\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Wheat\");\n  vtkColor3d checkerColor = colors->GetColor3d(\"Tomato\");\n  vtkColor3d fillColor = colors->GetColor3d(\"Banana\");\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(backgroundColor.GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  vtkNew<vtkInteractorStyleSwitch> style;\n  interactor->SetInteractorStyle(style);\n  interactor->SetRenderWindow(renderWindow);\n\n  auto image = makeImage(IMAGESIZE, fillColor, checkerColor);\n\n  // Clipping planes in the X and Y direction.\n  vtkNew<vtkDoubleArray> normals;\n  vtkNew<vtkPoints> clipPts;\n  normals->SetNumberOfComponents(3);\n  double xnorm[3] = {-1., 0., 0.};\n  double ynorm[3] = {0., -1., 0.};\n  double xpt[3] = {XOFFSET, 0., 0.};\n  double ypt[3] = {0., YOFFSET, 0.};\n  normals->InsertNextTuple(xnorm);\n  normals->InsertNextTuple(ynorm);\n  clipPts->InsertNextPoint(xpt);\n  clipPts->InsertNextPoint(ypt);\n  vtkNew<vtkPlanes> clipPlanes;\n  clipPlanes->SetNormals(normals);\n  clipPlanes->SetPoints(clipPts);\n\n  vtkNew<vtkClipVolume> clipper;\n  clipper->SetClipFunction(clipPlanes);\n  clipper->SetInputData(image);\n\n  vtkNew<vtkDataSetMapper> imageMapper;\n  vtkNew<vtkActor> imageActor;\n  imageActor->SetMapper(imageMapper);\n  renderer->AddViewProp(imageActor);\n  imageMapper->SetInputConnection(clipper->GetOutputPort());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n  renderWindow->SetWindowName(\"ClipVolume\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n  ;\n}\n\nnamespace {\n// Make the image data. A checkerboard pattern is used for\n// simplicity.\nvtkSmartPointer<vtkImageData> makeImage(int n, vtkColor3d fillColor,\n                                        vtkColor3d checkerColor)\n{\n  vtkNew<vtkImageData> image0;\n  image0->SetDimensions(n, n, n);\n  image0->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n  image0->SetSpacing(CUBESIZE / n, CUBESIZE / n, CUBESIZE / n);\n  int checkerSize = n / 8;\n  for (int z = 0; z < n; z++)\n  {\n    for (int y = 0; y < n; y++)\n    {\n      for (int x = 0; x < n; x++)\n      {\n        unsigned char* ptr = (unsigned char*)image0->GetScalarPointer(x, y, z);\n        *ptr = (x / checkerSize + y / checkerSize + z / checkerSize) %\n            2; // checkerboard\n      }\n    }\n  }\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(2);\n  lut->SetTableRange(0, 1);\n  lut->SetTableValue(0, fillColor.GetRed(), fillColor.GetGreen(),\n                     fillColor.GetBlue(), 1.0);\n  lut->SetTableValue(1, checkerColor.GetRed(), checkerColor.GetGreen(),\n                     checkerColor.GetBlue(), 1.0);\n\n  auto map = vtkSmartPointer<vtkImageMapToColors>::New();\n  map->SetLookupTable(lut);\n  map->SetOutputFormatToRGBA();\n  map->SetInputData(image0);\n  map->GetExecutive()->Update();\n\n  return map->GetOutput();\n}\n\n} // namespace\n
"},{"location":"Cxx/ImageData/ClipVolume/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipVolume)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonExecutionModel\n  FiltersGeneral\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipVolume: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipVolume MACOSX_BUNDLE ClipVolume.cxx )\n  target_link_libraries(ClipVolume PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipVolume\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/ClipVolume/#download-and-build-clipvolume","title":"Download and Build ClipVolume","text":"

Click here to download ClipVolume and its CMakeLists.txt file. Once the tarball ClipVolume.tar has been downloaded and extracted,

cd ClipVolume/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClipVolume\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/ExtractVOI/","title":"ExtractVOI","text":"

vtk-examples/Cxx/ImageData/ExtractVOI

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/ExtractVOI/#code","title":"Code","text":"

ExtractVOI.cxx

#include <vtkExtractVOI.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  int* inputDims = source->GetOutput()->GetDimensions();\n  std::cout << \"Dims: \"\n            << \" x: \" << inputDims[0] << \" y: \" << inputDims[1]\n            << \" z: \" << inputDims[2] << std::endl;\n  std::cout << \"Number of points: \" << source->GetOutput()->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Number of cells: \" << source->GetOutput()->GetNumberOfCells()\n            << std::endl;\n\n  vtkNew<vtkExtractVOI> extractVOI;\n  extractVOI->SetInputConnection(source->GetOutputPort());\n  extractVOI->SetVOI(inputDims[0] / 4., 3. * inputDims[0] / 4.,\n                     inputDims[1] / 4., 3. * inputDims[1] / 4., 0, 0);\n  extractVOI->Update();\n\n  vtkImageData* extracted = extractVOI->GetOutput();\n\n  int* extractedDims = extracted->GetDimensions();\n  std::cout << \"Dims: \"\n            << \" x: \" << extractedDims[0] << \" y: \" << extractedDims[1]\n            << \" z: \" << extractedDims[2] << std::endl;\n  std::cout << \"Number of points: \" << extracted->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Number of cells: \" << extracted->GetNumberOfCells()\n            << std::endl;\n\n  vtkNew<vtkImageCast> inputCastFilter;\n  inputCastFilter->SetInputConnection(source->GetOutputPort());\n  inputCastFilter->SetOutputScalarTypeToUnsignedChar();\n  inputCastFilter->Update();\n\n  vtkNew<vtkImageCast> extractedCastFilter;\n  extractedCastFilter->SetInputData(extracted);\n  extractedCastFilter->SetOutputScalarTypeToUnsignedChar();\n  extractedCastFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(inputCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> extractedActor;\n  extractedActor->GetMapper()->SetInputConnection(\n      extractedCastFilter->GetOutputPort());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"DarkTurquoise\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(extractedActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->ResetCamera();\n  renderWindow->SetWindowName(\"ExtractVOI\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageData/ExtractVOI/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractVOI)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractVOI: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractVOI MACOSX_BUNDLE ExtractVOI.cxx )\n  target_link_libraries(ExtractVOI PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractVOI\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/ExtractVOI/#download-and-build-extractvoi","title":"Download and Build ExtractVOI","text":"

Click here to download ExtractVOI and its CMakeLists.txt file. Once the tarball ExtractVOI.tar has been downloaded and extracted,

cd ExtractVOI/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractVOI\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/GetCellCenter/","title":"GetCellCenter","text":"

vtk-examples/Cxx/ImageData/GetCellCenter

"},{"location":"Cxx/ImageData/GetCellCenter/#description","title":"Description","text":"

Unfortunately this function is not built in directly, but rather quite convoluted to call. This is an easy to use wrapper.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/GetCellCenter/#code","title":"Code","text":"

GetCellCenter.cxx

#include <vtkCell.h>\n#include <vtkImageData.h>\n#include <vtkNew.h>\n\nnamespace {\n\nvoid GetCellCenter(vtkImageData* imageData, const unsigned int cellId,\n                   double center[3]);\n\n}\n\nint main(int, char*[])\n{\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(3, 3, 2); // This will cause 18 points and 4 cells\n  imageData->SetSpacing(1.0, 1.0, 1.0);\n  imageData->SetOrigin(0.0, 0.0, 0.0);\n\n  std::cout << \"Number of points: \" << imageData->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Number of cells: \" << imageData->GetNumberOfCells()\n            << std::endl;\n\n  double center[3] = {0, 0, 0};\n  for (vtkIdType cellId = 0; cellId < imageData->GetNumberOfCells(); ++cellId)\n  {\n    GetCellCenter(imageData, cellId, center);\n\n    std::cout << \"Cell \" << cellId << \" center: \" << center[0] << \" \"\n              << center[1] << \" \" << center[2] << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetCellCenter(vtkImageData* imageData, const unsigned int cellId,\n                   double center[3])\n{\n  double pcoords[3] = {0, 0, 0};\n  double* weights = new double[imageData->GetMaxCellSize()];\n  vtkCell* cell = imageData->GetCell(cellId);\n  int subId = cell->GetParametricCenter(pcoords);\n  cell->EvaluateLocation(subId, pcoords, center, weights);\n}\n\n} // namespace\n
"},{"location":"Cxx/ImageData/GetCellCenter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetCellCenter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetCellCenter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetCellCenter MACOSX_BUNDLE GetCellCenter.cxx )\n  target_link_libraries(GetCellCenter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetCellCenter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/GetCellCenter/#download-and-build-getcellcenter","title":"Download and Build GetCellCenter","text":"

Click here to download GetCellCenter and its CMakeLists.txt file. Once the tarball GetCellCenter.tar has been downloaded and extracted,

cd GetCellCenter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GetCellCenter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/ImageDataGeometryFilter/","title":"ImageDataGeometryFilter","text":"

vtk-examples/Cxx/ImageData/ImageDataGeometryFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageData/ImageDataGeometryFilter/#description","title":"Description","text":"

Convert a vtkImageData to a vtkPolyData.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/ImageDataGeometryFilter/#code","title":"Code","text":"

ImageDataGeometryFilter.cxx

#include <vtkActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Convert our unsigned char colors to doubles\n  // Set draw color needs doubles.\n  auto color1 = colors->GetColor4ub(\"SteelBlue\").GetData();\n  auto color2 = colors->GetColor4ub(\"PaleGoldenrod\").GetData();\n  std::array<double, 4> sourceColor1{0, 0, 0, 0};\n  std::array<double, 4> sourceColor2{0, 0, 0, 0};\n  for (auto i = 0; i < 4; ++i)\n  {\n    sourceColor1[i] = color1[i];\n    sourceColor2[i] = color2[i];\n  }\n\n  // Create an image\n  vtkNew<vtkImageCanvasSource2D> source1;\n  source1->SetScalarTypeToUnsignedChar();\n  source1->SetNumberOfScalarComponents(3);\n  source1->SetExtent(0, 100, 0, 100, 0, 0);\n  source1->SetDrawColor(sourceColor1.data());\n  source1->FillBox(0, 100, 0, 100);\n  source1->SetDrawColor(sourceColor2.data());\n  source1->FillBox(10, 20, 10, 20);\n  source1->FillBox(40, 50, 20, 30);\n  source1->Update();\n\n  // Convert the image to a polydata\n  vtkNew<vtkImageDataGeometryFilter> imageDataGeometryFilter;\n  imageDataGeometryFilter->SetInputConnection(source1->GetOutputPort());\n  imageDataGeometryFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(imageDataGeometryFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Visualization\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"RosyBrown\").GetData());\n\n  renderWindow->SetWindowName(\"ImageDataGeometryFilter\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageData/ImageDataGeometryFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDataGeometryFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  FiltersSources\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDataGeometryFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDataGeometryFilter MACOSX_BUNDLE ImageDataGeometryFilter.cxx )\n  target_link_libraries(ImageDataGeometryFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDataGeometryFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/ImageDataGeometryFilter/#download-and-build-imagedatageometryfilter","title":"Download and Build ImageDataGeometryFilter","text":"

Click here to download ImageDataGeometryFilter and its CMakeLists.txt file. Once the tarball ImageDataGeometryFilter.tar has been downloaded and extracted,

cd ImageDataGeometryFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageDataGeometryFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/ImageDataToPointSet/","title":"ImageDataToPointSet","text":"

vtk-examples/Cxx/ImageData/ImageDataToPointSet

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/ImageDataToPointSet/#code","title":"Code","text":"

ImageDataToPointSet.cxx

#include <vtkImageData.h>\n#include <vtkImageDataToPointSet.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkXMLStructuredGridWriter.h>\n\nnamespace {\n\nvoid CreateImage(vtkImageData* image);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkImageData> image;\n  CreateImage(image);\n\n  vtkNew<vtkImageDataToPointSet> imageDataToPointSet;\n  imageDataToPointSet->SetInputData(image);\n  imageDataToPointSet->Update();\n\n  vtkNew<vtkXMLStructuredGridWriter> writer;\n  writer->SetInputConnection(imageDataToPointSet->GetOutputPort());\n  writer->SetFileName(\"Test.vts\");\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateImage(vtkImageData* image)\n{\n  // Create an image\n  image->SetDimensions(3, 3, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  int dims[3];\n  image->GetDimensions(dims);\n  for (int i = 0; i < dims[0]; i++)\n  {\n    for (int j = 0; j < dims[1]; j++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(i, j, 0));\n      pixel[0] = 1;\n    }\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/ImageData/ImageDataToPointSet/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDataToPointSet)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDataToPointSet: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDataToPointSet MACOSX_BUNDLE ImageDataToPointSet.cxx )\n  target_link_libraries(ImageDataToPointSet PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDataToPointSet\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/ImageDataToPointSet/#download-and-build-imagedatatopointset","title":"Download and Build ImageDataToPointSet","text":"

Click here to download ImageDataToPointSet and its CMakeLists.txt file. Once the tarball ImageDataToPointSet.tar has been downloaded and extracted,

cd ImageDataToPointSet/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageDataToPointSet\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/ImageIterator/","title":"ImageIterator","text":"

vtk-examples/Cxx/ImageData/ImageIterator

"},{"location":"Cxx/ImageData/ImageIterator/#description","title":"Description","text":"

Extracts an extent from an image using an image iterator.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/ImageIterator/#code","title":"Code","text":"

ImageIterator.cxx

#include <vtkImageData.h>\n#include <vtkImageIterator.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(10, 20, 30);\n  imageData->AllocateScalars(VTK_DOUBLE, 3);\n\n  // Fill every entry of the image data with x,y,z\n  int* dims = imageData->GetDimensions();\n  double* ptr = static_cast<double*>(imageData->GetScalarPointer(0, 0, 0));\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        *ptr++ = z;\n        *ptr++ = y;\n        *ptr++ = x;\n      }\n    }\n  }\n\n  // Define the extent to be extracted\n  int extent[6];\n  extent[0] = 2;\n  extent[1] = 5;\n  extent[2] = 2;\n  extent[3] = 5;\n  extent[4] = 15;\n  extent[5] = 15;\n\n  // Retrieve the entries from the image data and print them to the screen\n  vtkImageIterator<double> it(imageData, extent);\n  while (!it.IsAtEnd())\n  {\n    double* valIt = it.BeginSpan();\n    double* valEnd = it.EndSpan();\n    while (valIt != valEnd)\n    {\n      // Increment for each component\n      double x = *valIt++;\n      double y = *valIt++;\n      double z = *valIt++;\n      std::cout << \"(\" << x << \",\" << y << \",\" << z << \") \";\n    }\n    std::cout << std::endl;\n    it.NextSpan();\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageData/ImageIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageIterator MACOSX_BUNDLE ImageIterator.cxx )\n  target_link_libraries(ImageIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/ImageIterator/#download-and-build-imageiterator","title":"Download and Build ImageIterator","text":"

Click here to download ImageIterator and its CMakeLists.txt file. Once the tarball ImageIterator.tar has been downloaded and extracted,

cd ImageIterator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageIterator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/ImageIteratorDemo/","title":"ImageIteratorDemo","text":"

vtk-examples/Cxx/ImageData/ImageIteratorDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageData/ImageIteratorDemo/#description","title":"Description","text":"

vtkImageIterator is an efficient way to access the regions of a vtkImageData. A span in the vrkImageData is a continuous segment of pixels. The NextSpan() method increments the iterator to the next continuous segment.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/ImageIteratorDemo/#code","title":"Code","text":"

ImageIteratorDemo.cxx

#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageIterator.h>\n#include <vtkImageViewer2.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(100, 200, 30);\n  imageData->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  // Fill every entry of the image data with a color\n  int* dims = imageData->GetDimensions();\n\n  unsigned char* ptr =\n      static_cast<unsigned char*>(imageData->GetScalarPointer(0, 0, 0));\n  unsigned char r, g, b, a;\n  colors->GetColor(\"Banana\", r, g, b, a);\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        *ptr++ = r;\n        *ptr++ = g;\n        *ptr++ = b;\n      }\n    }\n  }\n\n  // Define the extent to be modified\n  int extent[6];\n  extent[0] = 20;\n  extent[1] = 50;\n  extent[2] = 30;\n  extent[3] = 60;\n  extent[4] = 10;\n  extent[5] = 20;\n\n  // Set the entries in the region to another color\n  colors->GetColor(\"Tomato\", r, g, b, a);\n  vtkImageIterator<unsigned char> it(imageData, extent);\n  unsigned int counter = 0;\n  while (!it.IsAtEnd())\n  {\n    unsigned char* valIt = it.BeginSpan();\n    unsigned char* valEnd = it.EndSpan();\n    while (valIt != valEnd)\n    {\n      // Increment for each component\n      *valIt++ = r;\n      *valIt++ = g;\n      *valIt++ = b;\n    }\n    it.NextSpan();\n    ++counter;\n  }\n  std::cout << \"# of spans: \" << counter << std::endl;\n\n  std::cout << \"Increments: \" << imageData->GetIncrements()[0] << \", \"\n            << imageData->GetIncrements()[1] << \", \"\n            << imageData->GetIncrements()[2] << std::endl;\n  vtkIdType incX, incY, incZ;\n  imageData->GetContinuousIncrements(extent, incX, incY, incZ);\n  std::cout << \"ContinuousIncrements: \" << incX << \", \" << incY << \", \" << incZ\n            << std::endl;\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputData(imageData);\n\n  vtkNew<vtkInteractorStyleImage> style;\n  style->SetInteractionModeToImageSlicing();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetInteractorStyle(style);\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->SetSlice((extent[5] - extent[4]) / 2 + extent[4]);\n\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Slate_grey\").GetData());\n  imageViewer->GetImageActor()->InterpolateOff();\n\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderWindow()->SetWindowName(\"ImageIteratorDemo\");\n\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageData/ImageIteratorDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageIteratorDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageIteratorDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageIteratorDemo MACOSX_BUNDLE ImageIteratorDemo.cxx )\n  target_link_libraries(ImageIteratorDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageIteratorDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/ImageIteratorDemo/#download-and-build-imageiteratordemo","title":"Download and Build ImageIteratorDemo","text":"

Click here to download ImageIteratorDemo and its CMakeLists.txt file. Once the tarball ImageIteratorDemo.tar has been downloaded and extracted,

cd ImageIteratorDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageIteratorDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/ImageNormalize/","title":"ImageNormalize","text":"

vtk-examples/Cxx/ImageData/ImageNormalize

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/ImageNormalize/#code","title":"Code","text":"

ImageNormalize.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageNormalize.h>\n#include <vtkImageSinusoidSource.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageSinusoidSource> source;\n  source->Update();\n\n  vtkNew<vtkImageNormalize> normalizeFilter;\n\n  normalizeFilter->SetInputConnection(source->GetOutputPort());\n  normalizeFilter->Update();\n\n  vtkNew<vtkImageCast> inputCastFilter;\n  inputCastFilter->SetInputConnection(source->GetOutputPort());\n  inputCastFilter->SetOutputScalarTypeToUnsignedChar();\n  inputCastFilter->Update();\n\n  vtkNew<vtkImageCast> normalizeCastFilter;\n  normalizeCastFilter->SetInputConnection(normalizeFilter->GetOutputPort());\n  normalizeCastFilter->SetOutputScalarTypeToUnsignedChar();\n  normalizeCastFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(inputCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> normalizedActor;\n  normalizedActor->GetMapper()->SetInputConnection(\n      normalizeCastFilter->GetOutputPort());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(normalizedActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->ResetCamera();\n\n  renderWindow->SetWindowName(\"ImageNormalize\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageData/ImageNormalize/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageNormalize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageNormalize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageNormalize MACOSX_BUNDLE ImageNormalize.cxx )\n  target_link_libraries(ImageNormalize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageNormalize\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/ImageNormalize/#download-and-build-imagenormalize","title":"Download and Build ImageNormalize","text":"

Click here to download ImageNormalize and its CMakeLists.txt file. Once the tarball ImageNormalize.tar has been downloaded and extracted,

cd ImageNormalize/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageNormalize\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/ImageReslice/","title":"ImageReslice","text":"

vtk-examples/Cxx/ImageData/ImageReslice

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/ImageReslice/#code","title":"Code","text":"

ImageReslice.cxx

#include <vtkImageData.h>\n#include <vtkImageReslice.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkImageData> image;\n  image->SetExtent(0, 9, 0, 9, 0, 0);\n  image->AllocateScalars(VTK_INT, 1);\n\n  int* pixel = static_cast<int*>(image->GetScalarPointer(0, 9, 0));\n  std::cout << \"pixel: \" << *pixel << std::endl;\n\n  vtkNew<vtkImageReslice> reslice;\n  reslice->SetOutputExtent(0, 9, 0, 100, 0, 0);\n  reslice->SetInputData(image);\n  reslice->Update();\n\n  int* pixel2 =\n      static_cast<int*>(reslice->GetOutput()->GetScalarPointer(0, 11, 0));\n  std::cout << \"pixel2: \" << *pixel2 << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageData/ImageReslice/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageReslice)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageReslice: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageReslice MACOSX_BUNDLE ImageReslice.cxx )\n  target_link_libraries(ImageReslice PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageReslice\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/ImageReslice/#download-and-build-imagereslice","title":"Download and Build ImageReslice","text":"

Click here to download ImageReslice and its CMakeLists.txt file. Once the tarball ImageReslice.tar has been downloaded and extracted,

cd ImageReslice/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageReslice\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/ImageTranslateExtent/","title":"ImageTranslateExtent","text":"

vtk-examples/Cxx/ImageData/ImageTranslateExtent

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageData/ImageTranslateExtent/#description","title":"Description","text":"

If you are looking to change the extent to change the \"origin\" of the image from the corner to the center, see vtkImageChangeInformation in CenterAnImage.

Currently this method changes the extent (shown by the terminal output in the example), but does not change where the corner of the image is displayed relative to the sphere at (0,0,0).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/ImageTranslateExtent/#code","title":"Code","text":"

ImageTranslateExtent.cxx

#include <vtkActor.h>\n#include <vtkImageData.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkImageTranslateExtent.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid CreateColorImage(vtkImageData* const);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> colorImage;\n  CreateColorImage(\n      colorImage); // This image has (0,0) at the bottom left corner\n\n  int extent[6];\n  colorImage->GetExtent(extent);\n  std::cout << \"Old extent: \" << extent[0] << \" \" << extent[1] << \" \"\n            << extent[2] << \" \" << extent[3] << \" \" << extent[4] << \" \"\n            << extent[5] << std::endl;\n\n  // This moves the (0,0) position in the image to the center of the image\n  // colorImage->SetExtent(extent[0] - (extent[1] - extent[0]) / 2,\n  //                      extent[0] + (extent[1] - extent[0]) / 2,\n  //                      extent[2] - (extent[3] - extent[2]) / 2,\n  //                      extent[2] + (extent[3] - extent[2]) / 2,\n  //                      extent[4] - (extent[5] - extent[4]) / 2,\n  //                      extent[4] + (extent[5] - extent[4]) / 2);\n\n  int dimensions[3];\n  colorImage->GetDimensions(dimensions);\n\n  vtkNew<vtkImageTranslateExtent> translateExtent;\n  translateExtent->SetTranslation(-dimensions[0] / 2, -dimensions[1] / 2, 0);\n  translateExtent->SetInputData(colorImage);\n  translateExtent->Update();\n  colorImage->DeepCopy(translateExtent->GetOutput());\n\n  colorImage->GetExtent(extent);\n  std::cout << \"New extent: \" << extent[0] << \" \" << extent[1] << \" \"\n            << extent[2] << \" \" << extent[3] << \" \" << extent[4] << \" \"\n            << extent[5] << std::endl;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"PeachPuff\").GetData());\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper;\n  imageSliceMapper->SetInputData(colorImage);\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageSliceMapper);\n  imageSlice->SetPosition(0, 0, 0);\n\n  // Setup renderers\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->AddViewProp(sphereActor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(renderer);\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindow->SetWindowName(\"ImageTranslateExtent\");\n\n  renderWindow->Render();\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData* const image)\n{\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  vtkNew<vtkNamedColors> colors;\n  unsigned char r, g, b, a;\n  colors->GetColor(\"Thistle\", r, g, b, a);\n\n  for (unsigned int x = 0; x < 10; x++)\n  {\n    for (unsigned int y = 0; y < 10; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = r;\n      pixel[1] = g;\n      pixel[2] = b;\n    }\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/ImageData/ImageTranslateExtent/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageTranslateExtent)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageTranslateExtent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageTranslateExtent MACOSX_BUNDLE ImageTranslateExtent.cxx )\n  target_link_libraries(ImageTranslateExtent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageTranslateExtent\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/ImageTranslateExtent/#download-and-build-imagetranslateextent","title":"Download and Build ImageTranslateExtent","text":"

Click here to download ImageTranslateExtent and its CMakeLists.txt file. Once the tarball ImageTranslateExtent.tar has been downloaded and extracted,

cd ImageTranslateExtent/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageTranslateExtent\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/ImageWeightedSum/","title":"ImageWeightedSum","text":"

vtk-examples/Cxx/ImageData/ImageWeightedSum

"},{"location":"Cxx/ImageData/ImageWeightedSum/#description","title":"Description","text":"

Sum multiple images. Images must be of the same size and type.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/ImageWeightedSum/#code","title":"Code","text":"

ImageWeightedSum.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageSinusoidSource.h>\n#include <vtkImageWeightedSum.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // create an image\n  vtkNew<vtkImageMandelbrotSource> source1;\n  source1->SetWholeExtent(0, 255, 0, 255, 0, 0);\n  source1->Update();\n\n  vtkNew<vtkImageCast> source1Double;\n  source1Double->SetInputConnection(0, source1->GetOutputPort());\n  source1Double->SetOutputScalarTypeToDouble();\n\n  vtkNew<vtkImageSinusoidSource> source2;\n  source2->SetWholeExtent(0, 255, 0, 255, 0, 0);\n  source2->Update();\n\n  vtkNew<vtkImageWeightedSum> sumFilter;\n  sumFilter->SetWeight(0, .8);\n  sumFilter->SetWeight(1, .2);\n  sumFilter->AddInputConnection(source1Double->GetOutputPort());\n  sumFilter->AddInputConnection(source2->GetOutputPort());\n\n  sumFilter->Update();\n\n  vtkNew<vtkImageCast> source1CastFilter;\n  source1CastFilter->SetInputConnection(source1->GetOutputPort());\n  source1CastFilter->SetOutputScalarTypeToUnsignedChar();\n  source1CastFilter->Update();\n\n  vtkNew<vtkImageCast> source2CastFilter;\n  source2CastFilter->SetInputConnection(source2->GetOutputPort());\n  source2CastFilter->SetOutputScalarTypeToUnsignedChar();\n  source2CastFilter->Update();\n\n  vtkNew<vtkImageCast> summedCastFilter;\n  summedCastFilter->SetInputConnection(sumFilter->GetOutputPort());\n  summedCastFilter->SetOutputScalarTypeToUnsignedChar();\n  summedCastFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> source1Actor;\n  source1Actor->GetMapper()->SetInputConnection(\n      source1CastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> source2Actor;\n  source2Actor->GetMapper()->SetInputConnection(\n      source2CastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> summedActor;\n  summedActor->GetMapper()->SetInputConnection(\n      summedCastFilter->GetOutputPort());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, .66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"DarkTurquoise\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  leftRenderer->AddActor(source1Actor);\n  centerRenderer->AddActor(source2Actor);\n  rightRenderer->AddActor(summedActor);\n\n  leftRenderer->ResetCamera();\n  centerRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  renderWindow->SetWindowName(\"ImageWeightedSum\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageData/ImageWeightedSum/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageWeightedSum)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageWeightedSum: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageWeightedSum MACOSX_BUNDLE ImageWeightedSum.cxx )\n  target_link_libraries(ImageWeightedSum PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageWeightedSum\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/ImageWeightedSum/#download-and-build-imageweightedsum","title":"Download and Build ImageWeightedSum","text":"

Click here to download ImageWeightedSum and its CMakeLists.txt file. Once the tarball ImageWeightedSum.tar has been downloaded and extracted,

cd ImageWeightedSum/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageWeightedSum\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/IntersectLine/","title":"IntersectLine","text":"

vtk-examples/Cxx/ImageData/IntersectLine

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageData/IntersectLine/#description","title":"Description","text":"

This example demonstrates a (rather manual) way of finding which cells of a vtkImageData a finite line intersects. Note that this is not exact - a cell-centric approach is used. That is, a discrete line (DDA-like http://en.wikipedia.org/wiki/Digital_differential_analyzer_%28graphics_algorithm%29) is followed on the cell grid between the cells that contain the intersection points of the line with the bounding box of the image. These are all not necessarily the exact same cells as the line actually intersects, but it gives a reasonable \"path\" of cells through the image which might be suitable for some applications.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/IntersectLine/#code","title":"Code","text":"

IntersectLine.cxx

#include <vtkActor.h>\n#include <vtkBox.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkDataSetMapper.h>\n#include <vtkIdList.h>\n#include <vtkImageData.h>\n#include <vtkIntArray.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkThreshold.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <algorithm>\n#include <cmath>\n\nnamespace {\nvtkIdType FindCell(vtkImageData* grid, double point[3]);\n\nstd::vector<vtkIdType> IntersectImage(vtkImageData* image, double p0[3],\n                                      double p1[3]);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a 3x4x5 grid of points (60), which will define a 2x3x4\n  // (24) grid of cubes\n  vtkNew<vtkImageData> grid;\n\n  // Create the grid data structure\n  grid->SetDimensions(3, 4, 5);\n\n  std::cout << \"There are \" << grid->GetNumberOfPoints()\n            << \" points before shrinking.\" << std::endl;\n  std::cout << \"There are \" << grid->GetNumberOfCells()\n            << \" cells before shrinking.\" << std::endl;\n\n  // Define a ray\n  double rayOrigin[3] = {-5.0, 0, 0};\n  double rayDirection[3] = {1.0, 0, 0};\n  double rayEndPoint[3];\n  for (size_t i = 0; i < 3; ++i)\n  {\n    rayEndPoint[i] = rayOrigin[i] +\n        rayDirection[i] *\n            1000; // 1000 is an arbitrary constant that should be much larger\n                  // than the size of the scene (to create an \"infinite\" ray)\n  }\n  std::vector<vtkIdType> intersectedCells =\n      IntersectImage(grid, rayOrigin, rayEndPoint);\n\n  vtkNew<vtkShrinkFilter> shrinkFilter;\n  shrinkFilter->SetInputData(grid);\n  shrinkFilter->SetShrinkFactor(.8);\n  shrinkFilter->Update();\n\n  // Setup visibility array. Cells with visibility > 1 will be\n  // visible, and < 1 will be invisible.\n  vtkNew<vtkIntArray> visibilityArray;\n  visibilityArray->SetNumberOfComponents(1);\n  visibilityArray->SetName(\"Visibility\");\n\n  // Initially, set all cells to visible\n  for (vtkIdType cellId = 0;\n       cellId < shrinkFilter->GetOutput()->GetNumberOfCells(); ++cellId)\n  {\n    visibilityArray->InsertNextValue(10);\n  }\n\n  // Set the intersected cells to invisible\n  for (size_t i = 0; i < intersectedCells.size(); ++i)\n  {\n    visibilityArray->SetTuple1(intersectedCells[i], 0);\n  }\n\n  shrinkFilter->GetOutput()->GetCellData()->AddArray(visibilityArray);\n\n  // Threshold\n  vtkNew<vtkThreshold> threshold;\n  threshold->SetInputData(shrinkFilter->GetOutput());\n  // Criterion is cells whose scalars are greater or equal to threshold.\n  threshold->SetUpperThreshold(1);\n  threshold->SetThresholdFunction(vtkThreshold::THRESHOLD_UPPER);\n\n  threshold->SetInputArrayToProcess(\n      0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, \"Visibility\");\n  threshold->Update();\n\n  vtkUnstructuredGrid* thresholdedPolydata = threshold->GetOutput();\n  std::cout << \"There are \" << thresholdedPolydata->GetNumberOfCells()\n            << \" cells after thresholding.\" << std::endl;\n\n  /////////// Standard visualization setup //////////////\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(threshold->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetMultiSamples(0);\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderer->GetActiveCamera()->SetPosition(-6, 7, 6);\n  renderer->GetActiveCamera()->SetFocalPoint(1, 1.5, 2);\n  renderer->GetActiveCamera()->SetViewUp(0.4, 8, -0.4);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"IntersectLine\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkIdType FindCell(vtkImageData* grid, double point[3])\n{\n  double pcoords[3];\n  double weights[8];\n\n  int subId;\n\n  // The third parameter is an \"initial guess\" of the cellId\n  vtkIdType cellId =\n      grid->FindCell(point, NULL, 0, .1, subId, pcoords, weights);\n  return cellId;\n}\n\n// Intersect a finite line (with end points p0 and p1) with all of the\n// cells of a vtkImageData\nstd::vector<vtkIdType> IntersectImage(vtkImageData* image, double p0[3],\n                                      double p1[3])\n{\n  // Intersect a ray with the bounding box of the grid. There should\n  // be two points (an entrance and an exit)\n\n  // Define a box\n  double bounds[6];\n  image->GetBounds(bounds);\n\n  // The two points of intersection of the bounding box with the line\n  // will be stored here\n  double entrancePoint[3];\n  double exitPoint[3];\n\n  // We do not need the results stored in these variables, but they\n  // are required for the function call.\n  int entryPlane[6]{0, 0, 0, 0, 0, 0};\n  int exitPlane[6]{0, 0, 0, 0, 0, 0};\n\n  double t0,\n      t1; // the [0,1] normalized distances to the intersections along the ray\n\n  int hit = vtkBox::IntersectWithLine(bounds, p0, p1, t0, t1, entrancePoint,\n                                      exitPoint, *entryPlane, *exitPlane);\n\n  std::vector<vtkIdType> intersectedCells;\n\n  if (!hit)\n  {\n    std::cout << \"Not hit!\" << std::endl;\n    return intersectedCells;\n  }\n  else\n  {\n    std::cout << \"Entry point: \" << entrancePoint[0] << \" \" << entrancePoint[1]\n              << \" \" << entrancePoint[2] << std::endl;\n    std::cout << \"Exit point: \" << exitPoint[0] << \" \" << exitPoint[1] << \" \"\n              << exitPoint[2] << std::endl;\n  }\n\n  // This simple algorithm was adapted from\n  // http://www.cb.uu.se/~cris/blog/index.php/archives/400\n\n  int dim[3];\n  image->GetDimensions(dim);\n\n  // Make sure to include the first cell that the line hits\n  vtkIdType startCellId = FindCell(image, entrancePoint);\n  intersectedCells.push_back(startCellId);\n\n  double p[3];\n  p[0] = entrancePoint[0];\n  p[1] = entrancePoint[1];\n  p[2] = entrancePoint[2];\n\n  double d[3];\n  d[0] = exitPoint[0] - entrancePoint[0];\n  d[1] = exitPoint[1] - entrancePoint[1];\n  d[2] = exitPoint[2] - entrancePoint[2];\n\n  double N = std::max(std::max(std::abs(d[0]), std::abs(d[1])), std::abs(d[2]));\n\n  double s[3];\n  s[0] = d[0] / N;\n  s[1] = d[1] / N;\n  s[2] = d[2] / N;\n\n  for (size_t i = 0; i < N; ++i)\n  {\n    int ijk[3];\n    ijk[0] = vtkMath::Round(p[0]);\n    ijk[1] = vtkMath::Round(p[1]);\n    ijk[2] = vtkMath::Round(p[2]);\n\n    for (unsigned int index = 0; index < 3; ++index)\n    {\n      if (ijk[index] > dim[index] - 2)\n      {\n        ijk[index] = dim[index] - 2;\n      }\n    }\n\n    vtkIdType cellId = vtkStructuredData::ComputeCellId(dim, ijk);\n    intersectedCells.push_back(cellId);\n    p[0] += s[0];\n    p[1] += s[1];\n    p[2] += s[2];\n  }\n\n  // Make sure to include the last cell that the line hits\n  vtkIdType endCellId = FindCell(image, exitPoint);\n  intersectedCells.push_back(endCellId);\n\n  return intersectedCells;\n}\n\n} // namespace\n
"},{"location":"Cxx/ImageData/IntersectLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IntersectLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IntersectLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IntersectLine MACOSX_BUNDLE IntersectLine.cxx )\n  target_link_libraries(IntersectLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IntersectLine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/IntersectLine/#download-and-build-intersectline","title":"Download and Build IntersectLine","text":"

Click here to download IntersectLine and its CMakeLists.txt file. Once the tarball IntersectLine.tar has been downloaded and extracted,

cd IntersectLine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IntersectLine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/IterateImageData/","title":"IterateImageData","text":"

vtk-examples/Cxx/ImageData/IterateImageData

"},{"location":"Cxx/ImageData/IterateImageData/#description","title":"Description","text":"

This example demonstrates how to set and access locations in a 3D image.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/IterateImageData/#code","title":"Code","text":"

IterateImageData.cxx

#include <vtkImageData.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n\nint main(int, char*[])\n{\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(2, 3, 1);\n  imageData->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = imageData->GetDimensions();\n  // int dims[3]; // can't do this\n\n  std::cout << \"Dims: \"\n            << \" x: \" << dims[0] << \" y: \" << dims[1] << \" z: \" << dims[2]\n            << std::endl;\n\n  std::cout << \"Number of points: \" << imageData->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Number of cells: \" << imageData->GetNumberOfCells()\n            << std::endl;\n\n  // Fill every entry of the image data with \"2.0\"\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel =\n            static_cast<double*>(imageData->GetScalarPointer(x, y, z));\n        pixel[0] = 2.0;\n      }\n    }\n  }\n\n  // Retrieve the entries from the image data and print them to the screen\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel =\n            static_cast<double*>(imageData->GetScalarPointer(x, y, z));\n        // do something with v\n        std::cout << pixel[0] << \" \";\n      }\n      std::cout << std::endl;\n    }\n    std::cout << std::endl;\n  }\n\n  // Access the data linearly\n\n  vtkNew<vtkImageData> image;\n  image->SetExtent(0, 1, 0, 1, 0, 0);\n  image->AllocateScalars(VTK_INT, 1);\n\n  int* pixel;\n\n  pixel = static_cast<int*>(image->GetScalarPointer(0, 0, 0));\n  pixel[0] = 1;\n\n  pixel = static_cast<int*>(image->GetScalarPointer(1, 0, 0));\n  pixel[0] = 2;\n\n  pixel = static_cast<int*>(image->GetScalarPointer(0, 1, 0));\n  pixel[0] = 3;\n\n  pixel = static_cast<int*>(image->GetScalarPointer(1, 1, 0));\n  pixel[0] = 4;\n\n  vtkIntArray* scalars = dynamic_cast<vtkIntArray*>(\n      image->GetPointData()->GetArray(\"ImageScalars\"));\n  std::cout << \"Scalars has \" << scalars->GetNumberOfComponents()\n            << \"components \" << std::endl;\n  std::cout << \" Scalars has \" << scalars->GetNumberOfTuples() << \" tuples\"\n            << std::endl;\n\n  for (vtkIdType i = 0; i < scalars->GetNumberOfTuples(); i++)\n  {\n    std::cout << scalars->GetValue(i) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageData/IterateImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IterateImageData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IterateImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IterateImageData MACOSX_BUNDLE IterateImageData.cxx )\n  target_link_libraries(IterateImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IterateImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/IterateImageData/#download-and-build-iterateimagedata","title":"Download and Build IterateImageData","text":"

Click here to download IterateImageData and its CMakeLists.txt file. Once the tarball IterateImageData.tar has been downloaded and extracted,

cd IterateImageData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IterateImageData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageData/VoxelsOnBoundary/","title":"VoxelsOnBoundary","text":"

vtk-examples/Cxx/ImageData/VoxelsOnBoundary

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageData/VoxelsOnBoundary/#description","title":"Description","text":"

This example uses vtkMultiThreshold to extract voxels that are inside an isosurface and on the boundary of the isosurface. The result is a vtkUnstructuredGrid for each set of voxels. Before processing, vtkImageShrink3D reduces the resolution by a factor of 4.

Compare these results with

usage

VoxelsOnBoundary FullHead.mhd

Info

Compare these results with MedicalDemo1 that extracts the surface using vtkMarchingCubes to extract an interpolated isosurface.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageData/VoxelsOnBoundary/#code","title":"Code","text":"

VoxelsOnBoundary.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageDataToPointSet.h>\n#include <vtkImageShrink3D.h>\n#include <vtkMetaImageReader.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiThreshold.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <iostream>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageShrink3D> shrink;\n  shrink->SetShrinkFactors(4, 4, 4);\n  shrink->SetInputConnection(reader->GetOutputPort());\n  shrink->Update();\n\n  // Create a PointSet from the ImageData\n  vtkNew<vtkImageDataToPointSet> imageDataToPointSet;\n  imageDataToPointSet->SetInputConnection(reader->GetOutputPort());\n  imageDataToPointSet->SetInputConnection(shrink->GetOutputPort());\n  imageDataToPointSet->Update();\n\n  // Extract voxels on the border between the inside and outside.\n  vtkNew<vtkMultiThreshold> threshold;\n  // Inside points have one or more points above the isosurface\n  int insideId = threshold->AddIntervalSet(\n      501, 20000, vtkMultiThreshold::CLOSED, vtkMultiThreshold::CLOSED,\n      vtkDataObject::FIELD_ASSOCIATION_POINTS, \"ImageScalars\", 0, 0);\n  // Border points have points that straddle the boundary\n  int borderId = threshold->AddIntervalSet(\n      499.9999, 501.0000, vtkMultiThreshold::OPEN, vtkMultiThreshold::OPEN,\n      vtkDataObject::FIELD_ASSOCIATION_POINTS, \"ImageScalars\", 0, 0);\n\n  threshold->SetInputData(imageDataToPointSet->GetOutput());\n\n  // Select the intervals to be output\n  threshold->OutputSet(insideId);\n  threshold->OutputSet(borderId);\n  threshold->Update();\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n  // vtkColor3d outsideColor    = colors->GetColor3d(\"Crimson\");\n  vtkColor3d insideColor = colors->GetColor3d(\"Banana\");\n  vtkColor3d borderColor = colors->GetColor3d(\"Mint\");\n  // vtkColor3d surfaceColor    = colors->GetColor3d(\"Peacock\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Silver\");\n\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(dynamic_cast<vtkUnstructuredGrid*>(\n                       vtkMultiBlockDataSet::SafeDownCast(\n                           threshold->GetOutput()->GetBlock(insideId))\n                           ->GetBlock(0))\n                       ->GetCenter());\n  plane->SetNormal(1.0, -1.0, -1.0);\n\n  // Inside\n  vtkNew<vtkDataSetMapper> insideMapper;\n  insideMapper->SetInputData(dynamic_cast<vtkUnstructuredGrid*>(\n      vtkMultiBlockDataSet::SafeDownCast(\n          threshold->GetOutput()->GetBlock(insideId))\n          ->GetBlock(0)));\n  insideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> insideActor;\n  insideActor->SetMapper(insideMapper);\n  insideActor->GetProperty()->SetDiffuseColor(insideColor.GetData());\n  insideActor->GetProperty()->SetSpecular(.6);\n  insideActor->GetProperty()->SetSpecularPower(30);\n  insideActor->GetProperty()->EdgeVisibilityOn();\n\n  // Border\n  vtkNew<vtkDataSetMapper> borderMapper;\n  borderMapper->SetInputData(dynamic_cast<vtkUnstructuredGrid*>(\n      vtkMultiBlockDataSet::SafeDownCast(\n          threshold->GetOutput()->GetBlock(borderId))\n          ->GetBlock(0)));\n  borderMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> borderActor;\n  borderActor->SetMapper(borderMapper);\n  borderActor->GetProperty()->SetDiffuseColor(borderColor.GetData());\n  borderActor->GetProperty()->SetSpecular(.6);\n  borderActor->GetProperty()->SetSpecularPower(30);\n  borderActor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  renderer->AddActor(insideActor);\n  renderer->AddActor(borderActor);\n\n  renderWindow->SetWindowName(\"CellsOnBoundary\");\n  renderWindow->Render();\n\n  // Setup a good view\n  renderer->GetActiveCamera()->SetViewUp(0, 0, -1);\n  renderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Elevation(30.0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.5);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageData/VoxelsOnBoundary/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VoxelsOnBoundary)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VoxelsOnBoundary: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VoxelsOnBoundary MACOSX_BUNDLE VoxelsOnBoundary.cxx )\n  target_link_libraries(VoxelsOnBoundary PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VoxelsOnBoundary\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageData/VoxelsOnBoundary/#download-and-build-voxelsonboundary","title":"Download and Build VoxelsOnBoundary","text":"

Click here to download VoxelsOnBoundary and its CMakeLists.txt file. Once the tarball VoxelsOnBoundary.tar has been downloaded and extracted,

cd VoxelsOnBoundary/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VoxelsOnBoundary\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/Attenuation/","title":"Attenuation","text":"

vtk-examples/Cxx/ImageProcessing/Attenuation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageProcessing/Attenuation/#description","title":"Description","text":"

This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. This histograms shows how the artifact hides information in the form of scalar value clusters.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/Attenuation/#code","title":"Code","text":"

Attenuation.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageShiftScale.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\nint main(int argc, char* argv[])\n{\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" Filename e.g. AttenuationArtifact.pgm\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToDouble();\n\n  // Get rid of discrete scalars.\n  vtkNew<vtkImageGaussianSmooth> smooth;\n  smooth->SetInputConnection(cast->GetOutputPort());\n  smooth->SetStandardDeviations(0.8, 0.8, 0);\n\n  vtkNew<vtkSphere> m1;\n  m1->SetCenter(310, 130, 0);\n  m1->SetRadius(0);\n\n  vtkNew<vtkSampleFunction> m2;\n  m2->SetImplicitFunction(m1);\n  m2->SetModelBounds(0, 264, 0, 264, 0, 1);\n  m2->SetSampleDimensions(264, 264, 1);\n\n  vtkNew<vtkImageShiftScale> m3;\n  m3->SetInputConnection(m2->GetOutputPort());\n  m3->SetScale(0.000095);\n\n  vtkNew<vtkImageMathematics> div;\n  div->SetInputConnection(0, smooth->GetOutputPort());\n  div->SetInputConnection(1, m3->GetOutputPort());\n  div->SetOperationToMultiply();\n\n  // Create actors.\n  vtkNew<vtkNamedColors> colors;\n\n  double colorWindow = 256.0;\n  double colorLevel = 127.5;\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(cast->GetOutputPort());\n  originalActor->GetProperty()->SetColorWindow(colorWindow);\n  originalActor->GetProperty()->SetColorLevel(colorLevel);\n\n  vtkNew<vtkImageActor> filteredActor;\n  filteredActor->GetMapper()->SetInputConnection(div->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double filteredViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderer> filteredRenderer;\n  filteredRenderer->SetViewport(filteredViewport);\n  filteredRenderer->AddActor(filteredActor);\n  filteredRenderer->ResetCamera();\n  filteredRenderer->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(filteredRenderer);\n  renderWindow->SetWindowName(\"Attenuation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageProcessing/Attenuation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Attenuation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  ImagingHybrid\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Attenuation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Attenuation MACOSX_BUNDLE Attenuation.cxx )\n  target_link_libraries(Attenuation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Attenuation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/Attenuation/#download-and-build-attenuation","title":"Download and Build Attenuation","text":"

Click here to download Attenuation and its CMakeLists.txt file. Once the tarball Attenuation.tar has been downloaded and extracted,

cd Attenuation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Attenuation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/EnhanceEdges/","title":"EnhanceEdges","text":"

vtk-examples/Cxx/ImageProcessing/EnhanceEdges

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageProcessing/EnhanceEdges/#description","title":"Description","text":"

High-pass filters can also be used to compress the range of an image. Since low frequencies account for much of the dynamic range of an image but carry little information, a high-pass filter can significantly decrease an image\u2019s scalar range and emphasize hidden details. The Laplacian filter, which is a second derivative operation, is one implementation of a high-pass filter. It eliminates constant and low frequencies leaving only high-frequency edges. The output of the Laplacian can be subtracted from the original image to produce edge enhancement or sharpening of an image.

This example subtracts the Laplacian (middle) from the original image (left) resulting in edge enhancement or a sharpening operation (right).

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/EnhanceEdges/#code","title":"Code","text":"

EnhanceEdges.cxx

#include <vtkCamera.h>\n#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageLaplacian.h>\n#include <vtkImageMapToWindowLevelColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. FullHead.mhd\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  int scalarRange[2];\n  scalarRange[0] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[0];\n  scalarRange[1] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[1];\n  std::cout << \"Range: \" << scalarRange[0] << \", \" << scalarRange[1]\n            << std::endl;\n  // int middleSlice = (reader->GetOutput()->GetExtent()[5] -\n  //                   reader->GetOutput()->GetExtent()[4]) /\n  //    2;\n\n  // Better to use this value.\n  auto middleSlice = 22;\n\n  // Work with triple images\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToDouble();\n  cast->Update();\n\n  vtkNew<vtkImageLaplacian> laplacian;\n  laplacian->SetInputConnection(cast->GetOutputPort());\n  laplacian->SetDimensionality(3);\n\n  vtkNew<vtkImageMathematics> enhance;\n  enhance->SetInputConnection(0, cast->GetOutputPort());\n  enhance->SetInputConnection(1, laplacian->GetOutputPort());\n  enhance->SetOperationToSubtract();\n\n  int colorWindow = (scalarRange[1] - scalarRange[0]);\n  int colorLevel = colorWindow / 2;\n\n  // Map the image through the lookup table.\n  vtkNew<vtkImageMapToWindowLevelColors> originalColor;\n  originalColor->SetWindow(colorWindow);\n  originalColor->SetLevel(colorLevel);\n  originalColor->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(\n      originalColor->GetOutputPort());\n  originalActor->GetProperty()->SetInterpolationTypeToNearest();\n  originalActor->SetDisplayExtent(\n      reader->GetDataExtent()[0], reader->GetDataExtent()[1],\n      reader->GetDataExtent()[2], reader->GetDataExtent()[3], middleSlice,\n      middleSlice);\n\n  vtkNew<vtkImageMapToWindowLevelColors> laplacianColor;\n  laplacianColor->SetWindow(1000);\n  laplacianColor->SetLevel(0);\n  laplacianColor->SetInputConnection(laplacian->GetOutputPort());\n\n  vtkNew<vtkImageActor> laplacianActor;\n  laplacianActor->GetMapper()->SetInputConnection(\n      laplacianColor->GetOutputPort());\n  laplacianActor->GetProperty()->SetInterpolationTypeToNearest();\n  laplacianActor->SetDisplayExtent(originalActor->GetDisplayExtent());\n\n  vtkNew<vtkImageMapToWindowLevelColors> enhancedColor;\n  enhancedColor->SetWindow(colorWindow);\n  enhancedColor->SetLevel(colorLevel);\n  enhancedColor->SetInputConnection(enhance->GetOutputPort());\n\n  vtkNew<vtkImageActor> enhancedActor;\n  enhancedActor->GetMapper()->SetInputConnection(\n      enhancedColor->GetOutputPort());\n  enhancedActor->GetProperty()->SetInterpolationTypeToNearest();\n  enhancedActor->SetDisplayExtent(originalActor->GetDisplayExtent());\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->AddActor(originalActor);\n  vtkNew<vtkRenderer> laplacianRenderer;\n  laplacianRenderer->AddActor(laplacianActor);\n  vtkNew<vtkRenderer> enhancedRenderer;\n  enhancedRenderer->AddActor(enhancedActor);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  renderers.push_back(originalRenderer);\n  renderers.push_back(laplacianRenderer);\n  renderers.push_back(enhancedRenderer);\n\n  // Setup viewports for the renderers.\n  int rendererSize = 400;\n  unsigned int xGridDimensions = 3;\n  unsigned int yGridDimensions = 1;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n      renderWindow->AddRenderer(renderers[index]);\n    }\n  }\n  renderWindow->SetWindowName(\"EnhanceEdges\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Renderers share one camera.\n  renderWindow->Render();\n  renderers[0]->GetActiveCamera()->Dolly(1.5);\n  renderers[0]->ResetCameraClippingRange();\n\n  for (size_t r = 1; r < renderers.size(); ++r)\n  {\n    renderers[r]->SetActiveCamera(renderers[0]->GetActiveCamera());\n  }\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageProcessing/EnhanceEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EnhanceEdges)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EnhanceEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EnhanceEdges MACOSX_BUNDLE EnhanceEdges.cxx )\n  target_link_libraries(EnhanceEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EnhanceEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/EnhanceEdges/#download-and-build-enhanceedges","title":"Download and Build EnhanceEdges","text":"

Click here to download EnhanceEdges and its CMakeLists.txt file. Once the tarball EnhanceEdges.tar has been downloaded and extracted,

cd EnhanceEdges/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./EnhanceEdges\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/GaussianSmooth/","title":"GaussianSmooth","text":"

vtk-examples/Cxx/ImageProcessing/GaussianSmooth

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageProcessing/GaussianSmooth/#description","title":"Description","text":"

Low-pass filters can be implemented as convolution with a Gaussian kernel. The Gaussian kernel displayed on top has been magnified for this figure.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/GaussianSmooth/#code","title":"Code","text":"

GaussianSmooth.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Process the\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToFloat();\n\n  vtkNew<vtkImageGaussianSmooth> filter;\n  filter->SetDimensionality(2);\n  filter->SetInputConnection(cast->GetOutputPort());\n  filter->SetStandardDeviations(4.0, 4.0);\n  filter->SetRadiusFactors(2.0, 2.0);\n\n  // Create actors\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> filteredActor;\n  filteredActor->GetMapper()->SetInputConnection(filter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double filteredViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderer> filteredRenderer;\n  filteredRenderer->SetViewport(filteredViewport);\n  filteredRenderer->AddActor(filteredActor);\n  filteredRenderer->ResetCamera();\n  filteredRenderer->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"GaussianSmooth\");\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(filteredRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageProcessing/GaussianSmooth/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GaussianSmooth)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GaussianSmooth: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GaussianSmooth MACOSX_BUNDLE GaussianSmooth.cxx )\n  target_link_libraries(GaussianSmooth PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GaussianSmooth\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/GaussianSmooth/#download-and-build-gaussiansmooth","title":"Download and Build GaussianSmooth","text":"

Click here to download GaussianSmooth and its CMakeLists.txt file. Once the tarball GaussianSmooth.tar has been downloaded and extracted,

cd GaussianSmooth/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GaussianSmooth\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/HybridMedianComparison/","title":"HybridMedianComparison","text":"

vtk-examples/Cxx/ImageProcessing/HybridMedianComparison

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageProcessing/HybridMedianComparison/#description","title":"Description","text":"

Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. The lower patterns represent the three neighborhoods used to compute the hybrid median.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/HybridMedianComparison/#code","title":"Code","text":"

HybridMedianComparison.cxx

#include <vtkCamera.h>\n#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageHybridMedian2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageMedian3D.h>\n#include <vtkImageNoiseSource.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageThreshold.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vector>\n\nnamespace {\nvoid AddShotNoise(vtkImageData* inputImage, vtkImageData* outputImage,\n                  double noiseAmplitude, double noiseFraction, int extent[6]);\n}\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. TestPattern.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  int scalarRange[2];\n  scalarRange[0] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[0];\n  scalarRange[1] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[1];\n  std::cout << \"Range: \" << scalarRange[0] << \", \" << scalarRange[1]\n            << std::endl;\n  int middleSlice = (reader->GetOutput()->GetExtent()[5] -\n                     reader->GetOutput()->GetExtent()[4]) /\n      2;\n\n  // Work with double images\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToDouble();\n  cast->Update();\n\n  vtkNew<vtkImageData> originalData;\n  originalData->DeepCopy(cast->GetOutput());\n\n  vtkNew<vtkImageData> noisyData;\n\n  AddShotNoise(originalData, noisyData, 2000.0, .1,\n               reader->GetOutput()->GetExtent());\n  vtkNew<vtkImageMedian3D> median;\n  median->SetInputData(noisyData);\n  median->SetKernelSize(5, 5, 1);\n\n  vtkNew<vtkImageHybridMedian2D> hybridMedian1;\n  hybridMedian1->SetInputData(noisyData);\n  vtkNew<vtkImageHybridMedian2D> hybridMedian;\n  hybridMedian->SetInputConnection(hybridMedian1->GetOutputPort());\n\n  int colorWindow = (scalarRange[1] - scalarRange[0]);\n  int colorLevel = colorWindow / 2;\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputData(originalData);\n  originalActor->GetProperty()->SetColorWindow(colorWindow);\n  originalActor->GetProperty()->SetColorLevel(colorLevel);\n  originalActor->GetProperty()->SetInterpolationTypeToNearest();\n  originalActor->SetDisplayExtent(\n      reader->GetDataExtent()[0], reader->GetDataExtent()[1],\n      reader->GetDataExtent()[2], reader->GetDataExtent()[3], middleSlice,\n      middleSlice);\n\n  vtkNew<vtkImageActor> noisyActor;\n  noisyActor->GetMapper()->SetInputData(noisyData);\n  noisyActor->GetProperty()->SetColorWindow(colorWindow);\n  noisyActor->GetProperty()->SetColorLevel(colorLevel);\n  noisyActor->GetProperty()->SetInterpolationTypeToNearest();\n  noisyActor->SetDisplayExtent(originalActor->GetDisplayExtent());\n\n  vtkNew<vtkImageActor> hybridMedianActor;\n  hybridMedianActor->GetMapper()->SetInputConnection(\n      hybridMedian->GetOutputPort());\n  hybridMedianActor->GetProperty()->SetColorWindow(colorWindow);\n  hybridMedianActor->GetProperty()->SetColorLevel(colorLevel);\n  hybridMedianActor->GetProperty()->SetInterpolationTypeToNearest();\n  hybridMedianActor->SetDisplayExtent(originalActor->GetDisplayExtent());\n\n  vtkNew<vtkImageActor> medianActor;\n  medianActor->GetMapper()->SetInputConnection(median->GetOutputPort());\n  medianActor->GetProperty()->SetColorWindow(colorWindow);\n  medianActor->GetProperty()->SetColorLevel(colorLevel);\n  medianActor->GetProperty()->SetInterpolationTypeToNearest();\n  medianActor->SetDisplayExtent(originalActor->GetDisplayExtent());\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->AddActor(originalActor);\n  vtkNew<vtkRenderer> noisyRenderer;\n  noisyRenderer->AddActor(noisyActor);\n  vtkNew<vtkRenderer> hybridRenderer;\n  hybridRenderer->AddActor(hybridMedianActor);\n  vtkNew<vtkRenderer> medianRenderer;\n  medianRenderer->AddActor(medianActor);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  renderers.push_back(originalRenderer);\n  renderers.push_back(noisyRenderer);\n  renderers.push_back(hybridRenderer);\n  renderers.push_back(medianRenderer);\n\n  // Setup viewports for the renderers.\n  int rendererSize = 400;\n  unsigned int xGridDimensions = 2;\n  unsigned int yGridDimensions = 2;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n      renderWindow->AddRenderer(renderers[index]);\n    }\n  }\n  renderWindow->SetWindowName(\"HybridMedianComparison\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Renderers share one camera.\n  renderWindow->Render();\n  renderers[0]->GetActiveCamera()->Dolly(1.5);\n  renderers[0]->ResetCameraClippingRange();\n\n  for (size_t r = 1; r < renderers.size(); ++r)\n  {\n    renderers[r]->SetActiveCamera(renderers[0]->GetActiveCamera());\n  }\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvoid AddShotNoise(vtkImageData* inputImage, vtkImageData* outputImage,\n                  double noiseAmplitude, double noiseFraction, int extent[6])\n{\n  vtkNew<vtkImageNoiseSource> shotNoiseSource;\n  shotNoiseSource->SetWholeExtent(extent);\n  shotNoiseSource->SetMinimum(0.0);\n  shotNoiseSource->SetMaximum(1.0);\n\n  vtkNew<vtkImageThreshold> shotNoiseThresh1;\n  shotNoiseThresh1->SetInputConnection(shotNoiseSource->GetOutputPort());\n  shotNoiseThresh1->ThresholdByLower(1.0 - noiseFraction);\n  shotNoiseThresh1->SetInValue(0);\n  shotNoiseThresh1->SetOutValue(noiseAmplitude);\n\n  vtkNew<vtkImageThreshold> shotNoiseThresh2;\n  shotNoiseThresh2->SetInputConnection(shotNoiseSource->GetOutputPort());\n  shotNoiseThresh2->ThresholdByLower(noiseFraction);\n  shotNoiseThresh2->SetInValue(1.0 - noiseAmplitude);\n  shotNoiseThresh2->SetOutValue(0.0);\n\n  vtkNew<vtkImageMathematics> shotNoise;\n  shotNoise->SetInputConnection(0, shotNoiseThresh1->GetOutputPort());\n  shotNoise->SetInputConnection(1, shotNoiseThresh2->GetOutputPort());\n  shotNoise->SetOperationToAdd();\n\n  vtkNew<vtkImageMathematics> add;\n  add->SetInputData(0, inputImage);\n  add->SetInputConnection(1, shotNoise->GetOutputPort());\n  add->SetOperationToAdd();\n  add->Update();\n  outputImage->DeepCopy(add->GetOutput());\n}\n} // namespace\n
"},{"location":"Cxx/ImageProcessing/HybridMedianComparison/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HybridMedianComparison)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HybridMedianComparison: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HybridMedianComparison MACOSX_BUNDLE HybridMedianComparison.cxx )\n  target_link_libraries(HybridMedianComparison PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HybridMedianComparison\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/HybridMedianComparison/#download-and-build-hybridmediancomparison","title":"Download and Build HybridMedianComparison","text":"

Click here to download HybridMedianComparison and its CMakeLists.txt file. Once the tarball HybridMedianComparison.tar has been downloaded and extracted,

cd HybridMedianComparison/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HybridMedianComparison\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/IdealHighPass/","title":"IdealHighPass","text":"

vtk-examples/Cxx/ImageProcessing/IdealHighPass

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageProcessing/IdealHighPass/#description","title":"Description","text":"

Low-pass and high-pass filtering become trivial in the frequency domain. A portion of the pixels are simply masked or attenuated. This example shows a high pass Butterworth filter that attenuates the frequency domain image with the function out(i, j) = 1 / (1 + pow(CutOff/Freq(i,j), 2*Order)).

The gradual attenuation of the filter is important. The ideal high-pass filter, shown in the same exaample, simply masks a set of pixels in the frequency domain. The abrupt transition causes a ringing effect in the spatial domain.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/IdealHighPass/#code","title":"Code","text":"

IdealHighPass.cxx

#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageButterworthHighPass.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageFFT.h>\n#include <vtkImageIdealHighPass.h>\n#include <vtkImageMapToWindowLevelColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageProperty.h>\n#include <vtkImageRFFT.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. fullhead15.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageFFT> fft;\n  fft->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageIdealHighPass> idealHighPass;\n  idealHighPass->SetInputConnection(fft->GetOutputPort());\n  idealHighPass->SetXCutOff(0.1);\n  idealHighPass->SetYCutOff(0.1);\n\n  vtkNew<vtkImageRFFT> idealRfft;\n  idealRfft->SetInputConnection(idealHighPass->GetOutputPort());\n\n  vtkNew<vtkImageExtractComponents> idealReal;\n  idealReal->SetInputConnection(idealRfft->GetOutputPort());\n  idealReal->SetComponents(0);\n\n  vtkNew<vtkImageButterworthHighPass> butterworthHighPass;\n  butterworthHighPass->SetInputConnection(fft->GetOutputPort());\n  butterworthHighPass->SetXCutOff(0.1);\n  butterworthHighPass->SetYCutOff(0.1);\n\n  vtkNew<vtkImageRFFT> butterworthRfft;\n  butterworthRfft->SetInputConnection(butterworthHighPass->GetOutputPort());\n\n  vtkNew<vtkImageExtractComponents> butterworthReal;\n  butterworthReal->SetInputConnection(butterworthRfft->GetOutputPort());\n  butterworthReal->SetComponents(0);\n\n  // Create actors\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageMapToWindowLevelColors> idealColor;\n  idealColor->SetWindow(500);\n  idealColor->SetLevel(0);\n  idealColor->SetInputConnection(idealReal->GetOutputPort());\n\n  vtkNew<vtkImageActor> idealActor;\n  idealActor->GetMapper()->SetInputConnection(idealColor->GetOutputPort());\n  idealActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageMapToWindowLevelColors> butterworthColor;\n  butterworthColor->SetWindow(500);\n  butterworthColor->SetLevel(0);\n  butterworthColor->SetInputConnection(butterworthReal->GetOutputPort());\n\n  vtkNew<vtkImageActor> butterworthActor;\n  butterworthActor->GetMapper()->SetInputConnection(\n      butterworthColor->GetOutputPort());\n  butterworthActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> idealRenderer;\n  idealRenderer->SetViewport(0.0, 0.0, 0.5, 1.0);\n  idealRenderer->AddActor(idealActor);\n  idealRenderer->ResetCamera();\n  idealRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderer> butterworthRenderer;\n  butterworthRenderer->SetViewport(0.5, 0.0, 1.0, 1.0);\n  butterworthRenderer->AddActor(butterworthActor);\n  butterworthRenderer->SetActiveCamera(idealRenderer->GetActiveCamera());\n  butterworthRenderer->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"IdealHighPass\");\n  renderWindow->AddRenderer(idealRenderer);\n  renderWindow->AddRenderer(butterworthRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  idealRenderer->GetActiveCamera()->Dolly(1.4);\n  idealRenderer->ResetCameraClippingRange();\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageProcessing/IdealHighPass/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IdealHighPass)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingFourier\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IdealHighPass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IdealHighPass MACOSX_BUNDLE IdealHighPass.cxx )\n  target_link_libraries(IdealHighPass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IdealHighPass\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/IdealHighPass/#download-and-build-idealhighpass","title":"Download and Build IdealHighPass","text":"

Click here to download IdealHighPass and its CMakeLists.txt file. Once the tarball IdealHighPass.tar has been downloaded and extracted,

cd IdealHighPass/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IdealHighPass\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/IsoSubsample/","title":"IsoSubsample","text":"

vtk-examples/Cxx/ImageProcessing/IsoSubsample

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageProcessing/IsoSubsample/#description","title":"Description","text":"

An artifact called aliasing occurs when sub-sampling and is often associated with stair-stepping edges. Sampling theory proves that discrete sampled signals with spacing S, completely describe continuous functions composed of frequencies less than S/2. When a signal is sub-sampled, its capacity to hold high frequency information is reduced. However, the high frequency energy does not disappear. It wraps around the frequency spectrum appearing as a low frequency alias artifact. The solution, which eliminates this artifact, is to low-pass filter before sub-sampling.

Low-pass smoothing reduces the high frequency range of an image that would cause aliasing. The same aliasing phenomena occurs when acquiring data. If a signal from an analog source contains high frequencies, saving the analog data in a discrete form requires sub-sampling that will introduce alias artifacts. For this reason, it is common practice to acquire data at high resolutions,then smooth and subsample to reduce the image to a manageable size.

This example demonstrates aliasing that occurs when a high-frequency signal is sub-sampled. High frequencies appear as low frequency artifacts. The left image is an isosurface of a skull after sub-sampling. The right image used a low-pass filter before sub-sampling to reduce aliasing.

Info

See this figure in Chapter 10 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/IsoSubsample/#code","title":"Code","text":"

IsoSubsample.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageMarchingCubes.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageShrink3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g FullHead.mhd\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Smoothed pipeline\n  vtkNew<vtkImageGaussianSmooth> smooth;\n  smooth->SetDimensionality(3);\n  smooth->SetInputConnection(reader->GetOutputPort());\n  smooth->SetStandardDeviations(1.75, 1.75, 0.0);\n  smooth->SetRadiusFactor(2);\n\n  vtkNew<vtkImageShrink3D> subsampleSmoothed;\n  subsampleSmoothed->SetInputConnection(smooth->GetOutputPort());\n  subsampleSmoothed->SetShrinkFactors(4, 4, 1);\n\n  vtkNew<vtkImageMarchingCubes> isoSmoothed;\n  isoSmoothed->SetInputConnection(smooth->GetOutputPort());\n  isoSmoothed->SetValue(0, 1150);\n\n  vtkNew<vtkPolyDataMapper> isoSmoothedMapper;\n  isoSmoothedMapper->SetInputConnection(isoSmoothed->GetOutputPort());\n  isoSmoothedMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoSmoothedActor;\n  isoSmoothedActor->SetMapper(isoSmoothedMapper);\n  isoSmoothedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Ivory\").GetData());\n\n  // Unsmoothed pipeline\n  // Sub sample the data\n  vtkNew<vtkImageShrink3D> subsample;\n  subsample->SetInputConnection(reader->GetOutputPort());\n  subsample->SetShrinkFactors(4, 4, 1);\n\n  vtkNew<vtkImageMarchingCubes> iso;\n  iso->SetInputConnection(subsample->GetOutputPort());\n  iso->SetValue(0, 1150);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Ivory\").GetData());\n\n  // Rendering Pipeline\n  // Setup render window, renderer, and interactor\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkRenderer> rendererLeft;\n  rendererLeft->SetViewport(leftViewport);\n\n  vtkNew<vtkRenderer> rendererRight;\n  rendererRight->SetViewport(rightViewport);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(rendererLeft);\n  renderWindow->AddRenderer(rendererRight);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  rendererLeft->AddActor(isoActor);\n  rendererRight->AddActor(isoSmoothedActor);\n\n  rendererLeft->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  rendererLeft->GetActiveCamera()->SetPosition(0.0, -1.0, 0.0);\n  rendererLeft->GetActiveCamera()->SetViewUp(0.0, 0.0, -1.0);\n  rendererLeft->ResetCamera();\n  rendererLeft->GetActiveCamera()->Azimuth(-20.0);\n  rendererLeft->GetActiveCamera()->Elevation(20.0);\n  rendererLeft->ResetCameraClippingRange();\n\n  rendererLeft->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  rendererRight->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n  rendererRight->SetActiveCamera(rendererLeft->GetActiveCamera());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"IsoSubsample\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageProcessing/IsoSubsample/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IsoSubsample)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IsoSubsample: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IsoSubsample MACOSX_BUNDLE IsoSubsample.cxx )\n  target_link_libraries(IsoSubsample PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IsoSubsample\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/IsoSubsample/#download-and-build-isosubsample","title":"Download and Build IsoSubsample","text":"

Click here to download IsoSubsample and its CMakeLists.txt file. Once the tarball IsoSubsample.tar has been downloaded and extracted,

cd IsoSubsample/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IsoSubsample\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/MedianComparison/","title":"MedianComparison","text":"

vtk-examples/Cxx/ImageProcessing/MedianComparison

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageProcessing/MedianComparison/#description","title":"Description","text":"

Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/MedianComparison/#code","title":"Code","text":"

MedianComparison.cxx

#include <vtkCamera.h>\n#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageMedian3D.h>\n#include <vtkImageNoiseSource.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageThreshold.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vector>\n\nnamespace {\nvoid AddShotNoise(vtkImageData* inputImage, vtkImageData* outputImage,\n                  double noiseAmplitude, double noiseFraction, int extent[6]);\n}\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. FullHead.mhd\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  int scalarRange[2];\n  scalarRange[0] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[0];\n  scalarRange[1] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[1];\n  std::cout << \"Range: \" << scalarRange[0] << \", \" << scalarRange[1]\n            << std::endl;\n  int middleSlice = (reader->GetOutput()->GetExtent()[5] -\n                     reader->GetOutput()->GetExtent()[4]) /\n      2;\n\n  // Work with double images.\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToDouble();\n  cast->Update();\n\n  vtkNew<vtkImageData> originalData;\n  originalData->DeepCopy(cast->GetOutput());\n\n  vtkNew<vtkImageData> noisyData;\n\n  AddShotNoise(originalData, noisyData, 2000.0, .1,\n               reader->GetOutput()->GetExtent());\n  vtkNew<vtkImageMedian3D> median;\n  median->SetInputData(noisyData);\n  median->SetKernelSize(5, 5, 1);\n\n  vtkNew<vtkImageGaussianSmooth> gaussian;\n  gaussian->SetDimensionality(2);\n  gaussian->SetInputData(noisyData);\n  gaussian->SetStandardDeviations(2.0, 2.0);\n  gaussian->SetRadiusFactors(2.0, 2.0);\n\n  int colorWindow = (scalarRange[1] - scalarRange[0]) * .8;\n  int colorLevel = colorWindow / 2;\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputData(originalData);\n  originalActor->GetProperty()->SetColorWindow(colorWindow);\n  originalActor->GetProperty()->SetColorLevel(colorLevel);\n  originalActor->GetProperty()->SetInterpolationTypeToNearest();\n  originalActor->SetZSlice(middleSlice);\n\n  vtkNew<vtkImageActor> noisyActor;\n  noisyActor->GetMapper()->SetInputData(noisyData);\n  noisyActor->GetProperty()->SetColorWindow(colorWindow);\n  noisyActor->GetProperty()->SetColorLevel(colorLevel);\n  noisyActor->GetProperty()->SetInterpolationTypeToNearest();\n  noisyActor->SetZSlice(middleSlice);\n\n  vtkNew<vtkImageActor> gaussianActor;\n  gaussianActor->GetMapper()->SetInputConnection(gaussian->GetOutputPort());\n  gaussianActor->GetProperty()->SetColorWindow(colorWindow);\n  gaussianActor->GetProperty()->SetColorLevel(colorLevel);\n  gaussianActor->GetProperty()->SetInterpolationTypeToNearest();\n  gaussianActor->SetZSlice(middleSlice);\n\n  vtkNew<vtkImageActor> medianActor;\n  medianActor->GetMapper()->SetInputConnection(median->GetOutputPort());\n  medianActor->GetProperty()->SetColorWindow(colorWindow);\n  medianActor->GetProperty()->SetColorLevel(colorLevel);\n  medianActor->GetProperty()->SetInterpolationTypeToNearest();\n  medianActor->SetZSlice(middleSlice);\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->AddActor(originalActor);\n  vtkNew<vtkRenderer> noisyRenderer;\n  noisyRenderer->AddActor(noisyActor);\n  vtkNew<vtkRenderer> gaussRenderer;\n  gaussRenderer->AddActor(gaussianActor);\n  vtkNew<vtkRenderer> medianRenderer;\n  medianRenderer->AddActor(medianActor);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  renderers.push_back(originalRenderer);\n  renderers.push_back(noisyRenderer);\n  renderers.push_back(gaussRenderer);\n  renderers.push_back(medianRenderer);\n\n  // Setup viewports for the renderers.\n  int rendererSize = 400;\n  unsigned int xGridDimensions = 2;\n  unsigned int yGridDimensions = 2;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n      renderWindow->AddRenderer(renderers[index]);\n    }\n  }\n  renderWindow->SetWindowName(\"MedianComparison\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Renderers share one camera.\n  renderWindow->Render();\n  renderers[0]->GetActiveCamera()->Dolly(1.5);\n  renderers[0]->ResetCameraClippingRange();\n  for (size_t r = 1; r < renderers.size(); ++r)\n  {\n    renderers[r]->SetActiveCamera(renderers[0]->GetActiveCamera());\n  }\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvoid AddShotNoise(vtkImageData* inputImage, vtkImageData* outputImage,\n                  double noiseAmplitude, double noiseFraction, int extent[6])\n{\n  vtkNew<vtkImageNoiseSource> shotNoiseSource;\n  shotNoiseSource->SetWholeExtent(extent);\n  shotNoiseSource->SetMinimum(0.0);\n  shotNoiseSource->SetMaximum(1.0);\n\n  vtkNew<vtkImageThreshold> shotNoiseThresh1;\n  shotNoiseThresh1->SetInputConnection(shotNoiseSource->GetOutputPort());\n  shotNoiseThresh1->ThresholdByLower(1.0 - noiseFraction);\n  shotNoiseThresh1->SetInValue(0);\n  shotNoiseThresh1->SetOutValue(noiseAmplitude);\n\n  vtkNew<vtkImageThreshold> shotNoiseThresh2;\n  shotNoiseThresh2->SetInputConnection(shotNoiseSource->GetOutputPort());\n  shotNoiseThresh2->ThresholdByLower(noiseFraction);\n  shotNoiseThresh2->SetInValue(1.0 - noiseAmplitude);\n  shotNoiseThresh2->SetOutValue(0.0);\n\n  vtkNew<vtkImageMathematics> shotNoise;\n  shotNoise->SetInputConnection(0, shotNoiseThresh1->GetOutputPort());\n  shotNoise->SetInputConnection(1, shotNoiseThresh2->GetOutputPort());\n  shotNoise->SetOperationToAdd();\n\n  vtkNew<vtkImageMathematics> add;\n  add->SetInputData(0, inputImage);\n  add->SetInputConnection(1, shotNoise->GetOutputPort());\n  add->SetOperationToAdd();\n  add->Update();\n  outputImage->DeepCopy(add->GetOutput());\n}\n} // namespace\n
"},{"location":"Cxx/ImageProcessing/MedianComparison/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MedianComparison)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MedianComparison: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MedianComparison MACOSX_BUNDLE MedianComparison.cxx )\n  target_link_libraries(MedianComparison PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MedianComparison\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/MedianComparison/#download-and-build-mediancomparison","title":"Download and Build MedianComparison","text":"

Click here to download MedianComparison and its CMakeLists.txt file. Once the tarball MedianComparison.tar has been downloaded and extracted,

cd MedianComparison/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MedianComparison\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/MorphologyComparison/","title":"MorphologyComparison","text":"

vtk-examples/Cxx/ImageProcessing/MorphologyComparison

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageProcessing/MorphologyComparison/#description","title":"Description","text":"

Although preprocessing can do a lot to improve segmentation results, postprocessing can also be useful. Morphological filters, which operate on binary or discrete images, can be useful for manipulating the shape of the segmented regions. In this brief discussion we will only consider operations that use circular footprints, even though these morphological filters can be defined much more generally.

Erosion is implemented by removing pixels within a specified distance of a border. For each pixel not in the segmented region, all the neighbors in a circular region around the pixels are turned off. This erosion filter shrinks the segmented region and small isolated regions disappear.

The opposite of erosion is dilation. This filter grows the area of segmented regions. Small holes in the segmented region are completely closed. Any pixel not in the segmented region but near the region is turned on.

Dilation and erosion are dual filters with nearly identical implementations. Dilating the \u201con\u201d pixels is equivalent to eroding \u201coff\u201d pixels in a binary image. Holes in the map disappear. However, dilation alone also grows the boundaries of the segmented regions. When dilation is followed by erosion in a closing operation, small holes are removed; however, the boundary of the segmented regions remain in the same general location.

Opening is the dual of closing. Opening removes small islands of pixels. It is implemented with an initial erosion, followed by a dilation.

Connectivity filters can also remove small regions without affecting the remaining boundaries of segmented regions. This set of filters separate the segmented pixels into equivalence classes based on a neighbor relation. Two pixels belong to the same class if they are touching. There are two common neighbor relations in two-dimensional images: four connectivity considers pixels neighbors if they are edge neighbors, and eight connectivity considers pixels neighbors if pixels share any vertex.

This example demonstrates various binary filters that can alter the shape of segmented regions. From left to right, top to bottom: original image, connectivity, erosion, dilation, opening, closing.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/MorphologyComparison/#code","title":"Code","text":"

MorphologyComparison.cxx

#include <vtkCamera.h>\n#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageDilateErode3D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageSeedConnectivity.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. binary.pgm\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  // Dilate\n  vtkNew<vtkImageDilateErode3D> dilate;\n  dilate->SetInputConnection(reader->GetOutputPort());\n  dilate->SetDilateValue(0);\n  dilate->SetErodeValue(255);\n  dilate->SetKernelSize(31, 31, 1);\n\n  // Erode\n  vtkNew<vtkImageDilateErode3D> erode;\n  erode->SetInputConnection(reader->GetOutputPort());\n  erode->SetDilateValue(255);\n  erode->SetErodeValue(0);\n  erode->SetKernelSize(31, 31, 1);\n\n  // Opening - dilate then erode\n  vtkNew<vtkImageDilateErode3D> dilate1;\n  dilate1->SetInputConnection(reader->GetOutputPort());\n  dilate1->SetDilateValue(0);\n  dilate1->SetErodeValue(255);\n  dilate1->SetKernelSize(31, 31, 1);\n\n  vtkNew<vtkImageDilateErode3D> erode1;\n  erode1->SetInputConnection(dilate1->GetOutputPort());\n  erode1->SetDilateValue(255);\n  erode1->SetErodeValue(0);\n  erode1->SetKernelSize(31, 31, 1);\n\n  // Closing - erode then dilate\n  vtkNew<vtkImageDilateErode3D> erode2;\n  erode2->SetInputConnection(reader->GetOutputPort());\n  erode2->SetDilateValue(255);\n  erode2->SetErodeValue(0);\n  erode2->SetKernelSize(31, 31, 1);\n\n  vtkNew<vtkImageDilateErode3D> dilate2;\n  dilate2->SetInputConnection(erode2->GetOutputPort());\n  dilate2->SetDilateValue(0);\n  dilate2->SetErodeValue(255);\n  dilate2->SetKernelSize(31, 31, 1);\n\n  // Connectivity\n  vtkNew<vtkImageSeedConnectivity> con;\n  con->SetInputConnection(reader->GetOutputPort());\n  con->AddSeed(300, 200);\n  con->SetInputConnectValue(0);\n  con->SetOutputConnectedValue(0);\n  con->SetOutputUnconnectedValue(255);\n\n  // Actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n  originalActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> connectedActor;\n  connectedActor->GetMapper()->SetInputConnection(con->GetOutputPort());\n  connectedActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> erodeActor;\n  erodeActor->GetMapper()->SetInputConnection(erode->GetOutputPort());\n  erodeActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> dilateActor;\n  dilateActor->GetMapper()->SetInputConnection(dilate->GetOutputPort());\n  dilateActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> openingActor;\n  openingActor->GetMapper()->SetInputConnection(dilate2->GetOutputPort());\n  openingActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> closingActor;\n  closingActor->GetMapper()->SetInputConnection(erode1->GetOutputPort());\n  closingActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->AddActor(originalActor);\n  vtkNew<vtkRenderer> connectedRenderer;\n  connectedRenderer->AddActor(connectedActor);\n  vtkNew<vtkRenderer> dilateRenderer;\n  dilateRenderer->AddActor(dilateActor);\n  vtkNew<vtkRenderer> erodeRenderer;\n  erodeRenderer->AddActor(erodeActor);\n  vtkNew<vtkRenderer> closingRenderer;\n  closingRenderer->AddActor(closingActor);\n  vtkNew<vtkRenderer> openingRenderer;\n  openingRenderer->AddActor(openingActor);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  renderers.push_back(originalRenderer);\n  renderers.push_back(connectedRenderer);\n  renderers.push_back(erodeRenderer);\n  renderers.push_back(dilateRenderer);\n  renderers.push_back(openingRenderer);\n  renderers.push_back(closingRenderer);\n\n  // Setup viewports for the renderers.\n  int rendererSize = 300;\n  unsigned int xGridDimensions = 2;\n  unsigned int yGridDimensions = 3;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n      renderWindow->AddRenderer(renderers[index]);\n    }\n  }\n  renderWindow->SetWindowName(\"MorphologyComparison\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Renderers share one camera.\n  renderWindow->Render();\n  renderers[0]->GetActiveCamera()->Dolly(1.5);\n  renderers[0]->ResetCameraClippingRange();\n\n  for (size_t r = 1; r < renderers.size(); ++r)\n  {\n    renderers[r]->SetActiveCamera(renderers[0]->GetActiveCamera());\n  }\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageProcessing/MorphologyComparison/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MorphologyComparison)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingMorphological\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MorphologyComparison: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MorphologyComparison MACOSX_BUNDLE MorphologyComparison.cxx )\n  target_link_libraries(MorphologyComparison PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MorphologyComparison\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/MorphologyComparison/#download-and-build-morphologycomparison","title":"Download and Build MorphologyComparison","text":"

Click here to download MorphologyComparison and its CMakeLists.txt file. Once the tarball MorphologyComparison.tar has been downloaded and extracted,

cd MorphologyComparison/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MorphologyComparison\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/Pad/","title":"Pad","text":"

vtk-examples/Cxx/ImageProcessing/Pad

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageProcessing/Pad/#description","title":"Description","text":"

An important point about the discrete Fourier transform is that it treats the image as a periodic function. This means the pixels on the right border are adjacent to pixels on the left border. Since there is usually no physical relationship between these pixels, the artificial horizontal and vertical edges can distort the frequency spectrum and subsequent processing. To reduce these artifacts, the original image can be multiplied by a window function that becomes zero at the borders.

Another approach removes these artificial edges by smoothing only along the borders.

In both of these approaches, a portion of the original image is lost, so only the central portion of an image can be processed. If this is unacceptable, another solution is to double the dimensions of the original image with a mirror-padding filter. The intermediate image is periodic and continuous.

The lower-left image has been padded with a constant (800). On the right, mirror padding has been used to remove artificial edges introduced by borders.

Info

See Figure 10-12 in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/Pad/#code","title":"Code","text":"

Pad.cxx

#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageConstantPad.h>\n#include <vtkImageMapToWindowLevelColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMirrorPad.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. FullHead.mhd\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Pipelines.\n  vtkNew<vtkImageConstantPad> constantPad;\n  constantPad->SetInputConnection(reader->GetOutputPort());\n  constantPad->SetConstant(800);\n  constantPad->SetOutputWholeExtent(-127, 383, -127, 383, 22, 22);\n\n  vtkNew<vtkImageMirrorPad> mirrorPad;\n  mirrorPad->SetInputConnection(reader->GetOutputPort());\n  mirrorPad->SetOutputWholeExtent(constantPad->GetOutputWholeExtent());\n\n  // Create actors.\n\n  vtkNew<vtkImageMapToWindowLevelColors> constantPadColor;\n  constantPadColor->SetWindow(2000);\n  constantPadColor->SetLevel(1000);\n  constantPadColor->SetInputConnection(constantPad->GetOutputPort());\n\n  vtkNew<vtkImageActor> constantPadActor;\n  constantPadActor->GetMapper()->SetInputConnection(\n      constantPadColor->GetOutputPort());\n  constantPadActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageMapToWindowLevelColors> mirrorPadColor;\n  mirrorPadColor->SetWindow(2000);\n  mirrorPadColor->SetLevel(1000);\n  mirrorPadColor->SetInputConnection(mirrorPad->GetOutputPort());\n\n  vtkNew<vtkImageActor> mirrorPadActor;\n  mirrorPadActor->GetMapper()->SetInputConnection(\n      mirrorPadColor->GetOutputPort());\n  mirrorPadActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> constantPadRenderer;\n  constantPadRenderer->SetViewport(0.0, 0.0, 0.5, 1.0);\n  constantPadRenderer->AddActor(constantPadActor);\n  constantPadRenderer->ResetCamera();\n  constantPadRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderer> mirrorPadRenderer;\n  mirrorPadRenderer->SetViewport(0.5, 0.0, 1.0, 1.0);\n  mirrorPadRenderer->AddActor(mirrorPadActor);\n  mirrorPadRenderer->SetActiveCamera(constantPadRenderer->GetActiveCamera());\n  mirrorPadRenderer->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"Pad\");\n  renderWindow->AddRenderer(constantPadRenderer);\n  renderWindow->AddRenderer(mirrorPadRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  constantPadRenderer->GetActiveCamera()->Dolly(1.2);\n  constantPadRenderer->ResetCameraClippingRange();\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImageProcessing/Pad/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Pad)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Pad: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Pad MACOSX_BUNDLE Pad.cxx )\n  target_link_libraries(Pad PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Pad\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/Pad/#download-and-build-pad","title":"Download and Build Pad","text":"

Click here to download Pad and its CMakeLists.txt file. Once the tarball Pad.tar has been downloaded and extracted,

cd Pad/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Pad\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/RescaleAnImage/","title":"RescaleAnImage","text":"

vtk-examples/Cxx/ImageProcessing/RescaleAnImage

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/RescaleAnImage/#code","title":"Code","text":"

RescaleAnImage.cxx

#include <vtkImageData.h>\n#include <vtkImageShiftScale.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n\nnamespace {\nvoid CreateImage(vtkImageData* const image,\n                 vtkMinimalStandardRandomSequence* rng);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  vtkNew<vtkImageData> image;\n  CreateImage(image, rng);\n\n  vtkNew<vtkImageShiftScale> shiftScaleFilter;\n  shiftScaleFilter->SetOutputScalarTypeToUnsignedChar();\n  shiftScaleFilter->SetInputData(image);\n  shiftScaleFilter->SetShift(\n      -1.0 * image->GetScalarRange()[0]); // brings the lower bound to 0\n  double oldRange = image->GetScalarRange()[1] - image->GetScalarRange()[0];\n  std::cout << \"Old range: [\" << image->GetScalarRange()[0] << \", \"\n            << image->GetScalarRange()[1] << \"]\" << std::endl;\n  std::cout << \"Old range magnitude: \" << oldRange << std::endl;\n  double newRange = 255; // We want the output [0,255]\n  shiftScaleFilter->SetScale(newRange / oldRange);\n  shiftScaleFilter->Update();\n\n  std::cout << \"New range: [\"\n            << shiftScaleFilter->GetOutput()->GetScalarRange()[0] << \", \"\n            << shiftScaleFilter->GetOutput()->GetScalarRange()[1] << \"]\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateImage(vtkImageData* const image,\n                 vtkMinimalStandardRandomSequence* rng)\n{\n  // Specify the size of the image data\n  image->SetDimensions(2, 3, 1);\n  image->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = image->GetDimensions();\n\n  std::cout << \"Dims: \"\n            << \" x: \" << dims[0] << \" y: \" << dims[1] << \" z: \" << dims[2]\n            << std::endl;\n\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel = static_cast<double*>(image->GetScalarPointer(x, y, z));\n        pixel[0] = rng->GetRangeValue(0.0, 2000.0);\n        rng->Next();\n      }\n    }\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/ImageProcessing/RescaleAnImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RescaleAnImage)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  ImagingCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RescaleAnImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RescaleAnImage MACOSX_BUNDLE RescaleAnImage.cxx )\n  target_link_libraries(RescaleAnImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RescaleAnImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/RescaleAnImage/#download-and-build-rescaleanimage","title":"Download and Build RescaleAnImage","text":"

Click here to download RescaleAnImage and its CMakeLists.txt file. Once the tarball RescaleAnImage.tar has been downloaded and extracted,

cd RescaleAnImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RescaleAnImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImageProcessing/VTKSpectrum/","title":"VTKSpectrum","text":"

vtk-examples/Cxx/ImageProcessing/VTKSpectrum

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImageProcessing/VTKSpectrum/#description","title":"Description","text":"

The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This example shows an image and its power spectrum displayed using a logarithmic transfer function.

Info

See Figure 10-10 in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImageProcessing/VTKSpectrum/#code","title":"Code","text":"

VTKSpectrum.cxx

#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageFFT.h>\n#include <vtkImageFourierCenter.h>\n#include <vtkImageLogarithmicScale.h>\n#include <vtkImageMagnitude.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkWindowLevelLookupTable.h>\n\nnamespace {\n\nvoid CreateImageActor(vtkImageActor* actor, double colorWindow,\n                      double colorLevel);\n}\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. vtks.pgm\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageFFT> fft;\n  //  fft->SetFilteredAxes $VTK_IMAGE_X_AXIS $VTK_IMAGE_Y_AXIS\n  fft->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageMagnitude> mag;\n  mag->SetInputConnection(fft->GetOutputPort());\n\n  vtkNew<vtkImageFourierCenter> center;\n  center->SetInputConnection(mag->GetOutputPort());\n\n  vtkNew<vtkImageLogarithmicScale> compress;\n  compress->SetInputConnection(center->GetOutputPort());\n  compress->SetConstant(15);\n  compress->Update();\n\n  // Create actors\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n  originalActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> compressedActor;\n  compressedActor->GetMapper()->SetInputConnection(compress->GetOutputPort());\n  compressedActor->GetProperty()->SetInterpolationTypeToNearest();\n  CreateImageActor(compressedActor, 160, 120);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double compressedViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderer> compressedRenderer;\n  compressedRenderer->SetViewport(compressedViewport);\n  compressedRenderer->AddActor(compressedActor);\n  compressedRenderer->ResetCamera();\n  compressedRenderer->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"VTKSpectrum\");\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(compressedRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateImageActor(vtkImageActor* actor, double colorWindow,\n                      double colorLevel)\n{\n  vtkNew<vtkWindowLevelLookupTable> wlut;\n  wlut->SetWindow(colorWindow);\n  wlut->SetLevel(colorLevel);\n  wlut->Build();\n\n  // Map the image through the lookup table\n  vtkNew<vtkImageMapToColors> color;\n  color->SetLookupTable(wlut);\n  color->SetInputData(actor->GetMapper()->GetInput());\n\n  actor->GetMapper()->SetInputConnection(color->GetOutputPort());\n  return;\n}\n\n} // namespace\n
"},{"location":"Cxx/ImageProcessing/VTKSpectrum/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VTKSpectrum)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingFourier\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VTKSpectrum: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VTKSpectrum MACOSX_BUNDLE VTKSpectrum.cxx )\n  target_link_libraries(VTKSpectrum PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VTKSpectrum\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImageProcessing/VTKSpectrum/#download-and-build-vtkspectrum","title":"Download and Build VTKSpectrum","text":"

Click here to download VTKSpectrum and its CMakeLists.txt file. Once the tarball VTKSpectrum.tar has been downloaded and extracted,

cd VTKSpectrum/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VTKSpectrum\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/Actor2D/","title":"Actor2D","text":"

vtk-examples/Cxx/Images/Actor2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/Actor2D/#code","title":"Code","text":"

Actor2D.cxx

#include <vtkActor2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(10, 10, 0);\n  points->InsertNextPoint(100, 100, 0);\n  points->InsertNextPoint(200, 200, 0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n  glyphFilter->Update();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n  mapper->Update();\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  actor->GetProperty()->SetPointSize(8);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->SetSize(300, 300);\n  renderWindow->SetWindowName(\"Actor2D\");\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/Actor2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Actor2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Actor2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Actor2D MACOSX_BUNDLE Actor2D.cxx )\n  target_link_libraries(Actor2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Actor2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/Actor2D/#download-and-build-actor2d","title":"Download and Build Actor2D","text":"

Click here to download Actor2D and its CMakeLists.txt file. Once the tarball Actor2D.tar has been downloaded and extracted,

cd Actor2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Actor2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/BackgroundImage/","title":"BackgroundImage","text":"

vtk-examples/Cxx/Images/BackgroundImage

"},{"location":"Cxx/Images/BackgroundImage/#description","title":"Description","text":"

This example displays an image as the \"background\" of a scene, and renders a superquadric in front of it.

The example accepts a jpeg file on the command line to use as a background image. If there is no file, it generates a simple background.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/BackgroundImage/#code","title":"Code","text":"

BackgroundImage.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSuperquadricSource.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkImageData> imageData;\n\n  // Verify input arguments.\n  if (argc > 1)\n  {\n    // Read the image\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imageReader;\n    imageReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n    imageReader->SetFileName(argv[1]);\n    imageReader->Update();\n    imageData = imageReader->GetOutput();\n  }\n  else\n  {\n\n    std::array<double, 3> drawColor1{0, 0, 0};\n    std::array<double, 3> drawColor2{0, 0, 0};\n    std::array<double, 3> drawColor3{0, 0, 0};\n    auto color1 = colors->GetColor3ub(\"warm_grey\").GetData();\n    auto color2 = colors->GetColor3ub(\"DarkCyan\").GetData();\n    auto color3 = colors->GetColor3ub(\"LightCoral\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n      drawColor3[i] = color3[i];\n    }\n\n    vtkNew<vtkImageCanvasSource2D> canvasSource;\n    canvasSource->SetExtent(0, 100, 0, 100, 0, 0);\n    canvasSource->SetScalarTypeToUnsignedChar();\n    canvasSource->SetNumberOfScalarComponents(3);\n    canvasSource->SetDrawColor(drawColor1.data());\n    canvasSource->FillBox(0, 100, 0, 100);\n    canvasSource->SetDrawColor(drawColor2.data());\n    canvasSource->FillTriangle(10, 10, 25, 10, 25, 25);\n    canvasSource->SetDrawColor(drawColor3.data());\n    canvasSource->FillTube(75, 75, 0, 75, 5.0);\n    canvasSource->Update();\n    imageData = canvasSource->GetOutput();\n  }\n  // Create an image actor to display the image.\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->SetInputData(imageData);\n\n  // Create a renderer to display the image in the background.\n  vtkNew<vtkRenderer> backgroundRenderer;\n\n  // Create a superquadric.\n  vtkNew<vtkSuperquadricSource> superquadricSource;\n  superquadricSource->SetPhiRoundness(1.1);\n  superquadricSource->SetThetaRoundness(.2);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> superquadricMapper;\n  superquadricMapper->SetInputConnection(superquadricSource->GetOutputPort());\n\n  vtkNew<vtkActor> superquadricActor;\n  superquadricActor->SetMapper(superquadricMapper);\n  superquadricActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  vtkNew<vtkRenderer> sceneRenderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  // Set up the render window and renderers such that there is\n  // a background layer and a foreground layer.\n  backgroundRenderer->SetLayer(0);\n  backgroundRenderer->InteractiveOff();\n  sceneRenderer->SetLayer(1);\n  renderWindow->SetNumberOfLayers(2);\n  renderWindow->AddRenderer(backgroundRenderer);\n  renderWindow->AddRenderer(sceneRenderer);\n  renderWindow->SetWindowName(\"BackgroundImage\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add actors to the renderers\n  sceneRenderer->AddActor(superquadricActor);\n  backgroundRenderer->AddActor(imageActor);\n\n  // Render once to figure out where the background camera will be.\n  renderWindow->Render();\n\n  // Set up the background camera to fill the renderer with the image.\n  double origin[3];\n  double spacing[3];\n  int extent[6];\n  imageData->GetOrigin(origin);\n  imageData->GetSpacing(spacing);\n  imageData->GetExtent(extent);\n\n  vtkCamera* camera = backgroundRenderer->GetActiveCamera();\n  camera->ParallelProjectionOn();\n\n  double xc = origin[0] + 0.5 * (extent[0] + extent[1]) * spacing[0];\n  double yc = origin[1] + 0.5 * (extent[2] + extent[3]) * spacing[1];\n  // double xd = (extent[1] - extent[0] + 1)*spacing[0];\n  double yd = (extent[3] - extent[2] + 1) * spacing[1];\n  double d = camera->GetDistance();\n  camera->SetParallelScale(0.5 * yd);\n  camera->SetFocalPoint(xc, yc, 0.0);\n  camera->SetPosition(xc, yc, d);\n\n  // Render again to set the correct view.\n  renderWindow->Render();\n\n  // Interact with the window.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/BackgroundImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BackgroundImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOImage\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BackgroundImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BackgroundImage MACOSX_BUNDLE BackgroundImage.cxx )\n  target_link_libraries(BackgroundImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BackgroundImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/BackgroundImage/#download-and-build-backgroundimage","title":"Download and Build BackgroundImage","text":"

Click here to download BackgroundImage and its CMakeLists.txt file. Once the tarball BackgroundImage.tar has been downloaded and extracted,

cd BackgroundImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BackgroundImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/BorderPixelSize/","title":"BorderPixelSize","text":"

vtk-examples/Cxx/Images/BorderPixelSize

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/BorderPixelSize/#code","title":"Code","text":"

BorderPixelSize.cxx

#include <vtkImageData.h>\n#include <vtkImageProperty.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nvoid CreateRandomImage(vtkImageData* image, const unsigned int dimension);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Big image.\n  vtkNew<vtkImageData> image;\n  CreateRandomImage(image, 50);\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper;\n  imageSliceMapper->SetInputData(image);\n  imageSliceMapper->BorderOn(); // This line tells the mapper to draw the full\n                                // border pixels.\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageSliceMapper);\n  imageSlice->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BorderPixelSize\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateRandomImage(vtkImageData* image, const unsigned int dimension)\n{\n  image->SetDimensions(dimension, dimension, 1);\n  image->SetOrigin(.5, .5, 0);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  unsigned int seed = 0;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->Initialize(seed);\n\n  for (unsigned int x = 0; x < dimension; x++)\n  {\n    for (unsigned int y = 0; y < dimension; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = static_cast<unsigned char>(randomSequence->GetValue() * 255);\n      randomSequence->Next();\n      pixel[1] = static_cast<unsigned char>(randomSequence->GetValue() * 255);\n      randomSequence->Next();\n      pixel[2] = static_cast<unsigned char>(randomSequence->GetValue() * 255);\n      randomSequence->Next();\n    }\n  }\n  image->Modified();\n}\n\n} // namespace\n
"},{"location":"Cxx/Images/BorderPixelSize/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BorderPixelSize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BorderPixelSize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BorderPixelSize MACOSX_BUNDLE BorderPixelSize.cxx )\n  target_link_libraries(BorderPixelSize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BorderPixelSize\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/BorderPixelSize/#download-and-build-borderpixelsize","title":"Download and Build BorderPixelSize","text":"

Click here to download BorderPixelSize and its CMakeLists.txt file. Once the tarball BorderPixelSize.tar has been downloaded and extracted,

cd BorderPixelSize/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BorderPixelSize\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/CannyEdgeDetector/","title":"CannyEdgeDetector","text":"

vtk-examples/Cxx/Images/CannyEdgeDetector

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/CannyEdgeDetector/#code","title":"Code","text":"

CannyEdgeDetector.cxx

#include <vtkCamera.h>\n#include <vtkGeometryFilter.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageConstantPad.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageGradient.h>\n#include <vtkImageLuminance.h>\n#include <vtkImageMagnitude.h>\n#include <vtkImageNonMaximumSuppression.h>\n#include <vtkImageToStructuredPoints.h>\n#include <vtkLinkEdgels.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n#include <vtkSubPixelPositionEdgels.h>\n#include <vtkThreshold.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cerr << \"Required args: filename.png e.g. Gourds.png\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double edgeViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  vtkNew<vtkRenderer> edgeRenderer;\n  edgeRenderer->SetViewport(edgeViewport);\n  edgeRenderer->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetMultiSamples(0);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(edgeRenderer);\n  renderWindow->SetWindowName(\"CannyEdgeDetector\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPNGReader> imageIn;\n  imageIn->SetFileName(filename.c_str());\n  imageIn->Update();\n\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->SetInputData(imageIn->GetOutput());\n\n  originalRenderer->AddActor(imageActor);\n\n  vtkNew<vtkImageLuminance> il;\n  il->SetInputConnection(imageIn->GetOutputPort());\n\n  vtkNew<vtkImageCast> ic;\n  ic->SetOutputScalarTypeToFloat();\n  ic->SetInputConnection(il->GetOutputPort());\n\n  // Smooth the image.\n  vtkNew<vtkImageGaussianSmooth> gs;\n  gs->SetInputConnection(ic->GetOutputPort());\n  gs->SetDimensionality(2);\n  gs->SetRadiusFactors(1, 1, 0);\n\n  // Gradient the image.\n  vtkNew<vtkImageGradient> imgGradient;\n  imgGradient->SetInputConnection(gs->GetOutputPort());\n  imgGradient->SetDimensionality(2);\n\n  vtkNew<vtkImageMagnitude> imgMagnitude;\n  imgMagnitude->SetInputConnection(imgGradient->GetOutputPort());\n\n  // Non maximum suppression.\n  vtkNew<vtkImageNonMaximumSuppression> nonMax;\n  imgMagnitude->Update();\n  nonMax->SetMagnitudeInputData(imgMagnitude->GetOutput());\n  imgGradient->Update();\n  nonMax->SetVectorInputData(imgGradient->GetOutput());\n  nonMax->SetDimensionality(2);\n\n  vtkNew<vtkImageConstantPad> pad;\n  pad->SetInputConnection(imgGradient->GetOutputPort());\n  pad->SetOutputNumberOfScalarComponents(3);\n  pad->SetConstant(0);\n\n  vtkNew<vtkImageToStructuredPoints> i2sp1;\n  i2sp1->SetInputConnection(nonMax->GetOutputPort());\n  pad->Update();\n  i2sp1->SetVectorInputData(pad->GetOutput());\n\n  // Link edgles.\n  vtkNew<vtkLinkEdgels> imgLink;\n  imgLink->SetInputConnection(i2sp1->GetOutputPort());\n  imgLink->SetGradientThreshold(2);\n\n  // Threshold links.\n  vtkNew<vtkThreshold> thresholdEdges;\n  thresholdEdges->SetInputConnection(imgLink->GetOutputPort());\n  thresholdEdges->SetUpperThreshold(10);\n  thresholdEdges->SetThresholdFunction(vtkThreshold::THRESHOLD_UPPER);\n  thresholdEdges->AllScalarsOff();\n\n  vtkNew<vtkGeometryFilter> gf;\n  gf->SetInputConnection(thresholdEdges->GetOutputPort());\n\n  vtkNew<vtkImageToStructuredPoints> i2sp;\n  i2sp->SetInputConnection(imgMagnitude->GetOutputPort());\n  pad->Update();\n  i2sp->SetVectorInputData(pad->GetOutput());\n\n  // Subpixel them.\n  vtkNew<vtkSubPixelPositionEdgels> spe;\n  spe->SetInputConnection(gf->GetOutputPort());\n  i2sp->Update();\n  spe->SetGradMapsData(i2sp->GetStructuredPointsOutput());\n\n  vtkNew<vtkStripper> strip;\n  strip->SetInputConnection(spe->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> dsm;\n  dsm->SetInputConnection(strip->GetOutputPort());\n  dsm->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(dsm);\n  planeActor->GetProperty()->SetAmbient(1.0);\n  planeActor->GetProperty()->SetDiffuse(0.0);\n  planeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"GhostWhite\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  edgeRenderer->AddActor(planeActor);\n\n  // Render the image.\n  interactor->Initialize();\n  renderWindow->Render();\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/CannyEdgeDetector/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CannyEdgeDetector)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonExecutionModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingMorphological\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CannyEdgeDetector: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CannyEdgeDetector MACOSX_BUNDLE CannyEdgeDetector.cxx )\n  target_link_libraries(CannyEdgeDetector PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CannyEdgeDetector\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/CannyEdgeDetector/#download-and-build-cannyedgedetector","title":"Download and Build CannyEdgeDetector","text":"

Click here to download CannyEdgeDetector and its CMakeLists.txt file. Once the tarball CannyEdgeDetector.tar has been downloaded and extracted,

cd CannyEdgeDetector/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CannyEdgeDetector\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/Cast/","title":"Cast","text":"

vtk-examples/Cxx/Images/Cast

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/Cast/#description","title":"Description","text":"

Cast an image to a different type.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/Cast/#code","title":"Code","text":"

Cast.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a float image.\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  std::cout << source->GetOutput()->GetScalarTypeAsString() << std::endl;\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Cast\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/Cast/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cast)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cast: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cast MACOSX_BUNDLE Cast.cxx )\n  target_link_libraries(Cast PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cast\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/Cast/#download-and-build-cast","title":"Download and Build Cast","text":"

Click here to download Cast and its CMakeLists.txt file. Once the tarball Cast.tar has been downloaded and extracted,

cd Cast/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cast\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/CenterAnImage/","title":"CenterAnImage","text":"

vtk-examples/Cxx/Images/CenterAnImage

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/CenterAnImage/#description","title":"Description","text":"

This moves (0,0) from the bottom left corner of the image to the center of the image.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/CenterAnImage/#code","title":"Code","text":"

CenterAnImage.cxx

#include <vtkBorderRepresentation.h>\n#include <vtkBorderWidget.h>\n#include <vtkCommand.h>\n#include <vtkImageActor.h>\n#include <vtkImageChangeInformation.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n\nnamespace {\n\nclass vtkBorderCallback : public vtkCommand\n{\npublic:\n  vtkBorderCallback()\n  {\n  }\n\n  static vtkBorderCallback* New()\n  {\n    return new vtkBorderCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*);\n\n  void SetRenderer(vtkSmartPointer<vtkRenderer> renderer)\n  {\n    this->Renderer = renderer;\n  }\n  void SetImageActor(vtkSmartPointer<vtkImageActor> actor)\n  {\n    this->ImageActor = actor;\n  }\n\nprivate:\n  vtkSmartPointer<vtkRenderer> Renderer;\n  vtkSmartPointer<vtkImageActor> ImageActor;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Required parameters: Filename e.g. Ox.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imageReader;\n  imageReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  imageReader->SetFileName(argv[1]);\n  imageReader->Update();\n\n  // Shift the image center to (0,0).\n  int dims[3];\n  imageReader->GetOutput()->GetDimensions(dims);\n\n  vtkNew<vtkImageChangeInformation> changeInformation;\n  changeInformation->SetInputConnection(imageReader->GetOutputPort());\n  changeInformation->CenterImageOn();\n  changeInformation->Update();\n\n  vtkSmartPointer<vtkImageData> image = changeInformation->GetOutput();\n\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputData(image);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  vtkNew<vtkBorderWidget> borderWidget;\n  borderWidget->SetInteractor(interactor);\n  static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n      ->GetBorderProperty()\n      ->SetColor(colors->GetColor3d(\"Chartreuse\").GetData());\n  borderWidget->SelectableOff();\n\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n  renderWindow->AddRenderer(renderer);\n\n  renderer->AddActor(imageActor);\n\n  renderer->ResetCamera();\n\n  vtkNew<vtkBorderCallback> borderCallback;\n  borderCallback->SetRenderer(renderer);\n  borderCallback->SetImageActor(imageActor);\n\n  borderWidget->AddObserver(vtkCommand::InteractionEvent, borderCallback);\n  borderWidget->On();\n  renderWindow->SetWindowName(\"CenterAnImage\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid vtkBorderCallback::Execute(vtkObject* caller, unsigned long, void*)\n{\n  // Use this to format the output.\n  auto fmt = [](const double& x) {\n    std::ostringstream os;\n    os << std::fixed << std::setprecision(2) << std::setw(8) << x;\n    return os.str();\n  };\n\n  vtkBorderWidget* borderWidget = reinterpret_cast<vtkBorderWidget*>(caller);\n\n  // Get the world coordinates of the two corners of the box.\n  vtkCoordinate* lowerLeftCoordinate =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPositionCoordinate();\n  double* lowerLeft =\n      lowerLeftCoordinate->GetComputedWorldValue(this->Renderer);\n  std::cout << \"Lower left coordinate:  \" << fmt(lowerLeft[0]) << \",\"\n            << fmt(lowerLeft[1]) << \",\" << fmt(lowerLeft[2]) << std::endl;\n\n  vtkCoordinate* upperRightCoordinate =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPosition2Coordinate();\n  double* upperRight =\n      upperRightCoordinate->GetComputedWorldValue(this->Renderer);\n  std::cout << \"Upper right coordinate: \" << fmt(upperRight[0]) << \",\"\n            << fmt(upperRight[1]) << \",\" << fmt(upperRight[2]) << std::endl;\n\n  double* bounds = this->ImageActor->GetBounds();\n  double xmin = bounds[0];\n  double xmax = bounds[1];\n  double ymin = bounds[2];\n  double ymax = bounds[3];\n\n  if ((lowerLeft[0] > xmin) && (upperRight[0] < xmax) &&\n      (lowerLeft[1] > ymin) && (upperRight[1] < ymax))\n  {\n    // std::cout << \"box is inside image\" << std::endl;\n    // std::cout << \"xmin: \" << xmin << \" xmax: \" << xmax << \" ymin: \" << ymin\n    // << \" ymax: \" << ymax << std::endl;\n  }\n  else\n  {\n    std::cout << \"box is NOT inside image\" << std::endl;\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/Images/CenterAnImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CenterAnImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CenterAnImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CenterAnImage MACOSX_BUNDLE CenterAnImage.cxx )\n  target_link_libraries(CenterAnImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CenterAnImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/CenterAnImage/#download-and-build-centeranimage","title":"Download and Build CenterAnImage","text":"

Click here to download CenterAnImage and its CMakeLists.txt file. Once the tarball CenterAnImage.tar has been downloaded and extracted,

cd CenterAnImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CenterAnImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/Colored2DImageFusion/","title":"Colored2DImageFusion","text":"

vtk-examples/Cxx/Images/Colored2DImageFusion

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/Colored2DImageFusion/#description","title":"Description","text":"

This example use the vtkImageBlend class for a simple fusion of two 2D images with different color maps for each of the images.

  • Contributed by: Tim Hutz

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/Colored2DImageFusion/#code","title":"Code","text":"

Colored2DImageFusion.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageBlend.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse input arguments.\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input1Filename Input2Filename e.g. Ox.jpg Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkLookupTable> imgFirstColorMap;\n  imgFirstColorMap->SetRange(0.0, 255.0);\n  imgFirstColorMap->SetHueRange(0.0, 0.1);\n  imgFirstColorMap->SetValueRange(0.4, 0.8);\n  imgFirstColorMap->Build();\n\n  vtkNew<vtkLookupTable> imgSecondColorMap;\n  imgSecondColorMap->SetRange(0.0, 255.0);\n  imgSecondColorMap->SetHueRange(0.67, 0.68);\n  imgSecondColorMap->SetValueRange(0.4, 0.8);\n  imgSecondColorMap->Build();\n\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imgReader;\n  imgReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  imgReader->SetFileName(argv[1]);\n\n  vtkSmartPointer<vtkImageReader2> imgReaderMoving;\n  imgReaderMoving.TakeReference(readerFactory->CreateImageReader2(argv[2]));\n  imgReaderMoving->SetFileName(argv[2]);\n\n  vtkNew<vtkImageMapToColors> firstColorMapper;\n  firstColorMapper->SetInputConnection(imgReader->GetOutputPort());\n  firstColorMapper->SetLookupTable(imgFirstColorMap);\n\n  vtkNew<vtkImageMapToColors> secondColorMapper;\n  secondColorMapper->SetInputConnection(imgReaderMoving->GetOutputPort());\n  secondColorMapper->SetLookupTable(imgSecondColorMap);\n\n  vtkNew<vtkImageBlend> imgBlender;\n  imgBlender->SetOpacity(0, 0.5);\n  imgBlender->SetOpacity(1, 0.5);\n  imgBlender->AddInputConnection(firstColorMapper->GetOutputPort());\n  imgBlender->AddInputConnection(secondColorMapper->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> imgDataSetMapper;\n  imgDataSetMapper->SetInputConnection(imgBlender->GetOutputPort());\n\n  vtkNew<vtkActor> imgActor;\n  imgActor->SetMapper(imgDataSetMapper);\n\n  vtkNew<vtkRenderer> imgRenderer;\n  imgRenderer->AddActor(imgActor);\n  imgRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderWindow> imgRenderWindow;\n  imgRenderWindow->AddRenderer(imgRenderer);\n  imgRenderWindow->SetWindowName(\"Colored2DImageFusion\");\n\n  vtkNew<vtkRenderWindowInteractor> imgInteractor;\n  imgInteractor->SetRenderWindow(imgRenderWindow);\n  imgRenderWindow->Render();\n  imgInteractor->Initialize();\n  imgInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/Colored2DImageFusion/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Colored2DImageFusion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Colored2DImageFusion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Colored2DImageFusion MACOSX_BUNDLE Colored2DImageFusion.cxx )\n  target_link_libraries(Colored2DImageFusion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Colored2DImageFusion\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/Colored2DImageFusion/#download-and-build-colored2dimagefusion","title":"Download and Build Colored2DImageFusion","text":"

Click here to download Colored2DImageFusion and its CMakeLists.txt file. Once the tarball Colored2DImageFusion.tar has been downloaded and extracted,

cd Colored2DImageFusion/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Colored2DImageFusion\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/CombineImages/","title":"CombineImages","text":"

vtk-examples/Cxx/Images/CombineImages

"},{"location":"Cxx/Images/CombineImages/#description","title":"Description","text":"

This example takes two images and superimposes them. The opacity of each image can be set to control how they are combined.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/CombineImages/#code","title":"Code","text":"

CombineImages.cxx

#include <vtkImageBlend.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse input arguments.\n  if (argc != 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input1Filename Input2Filename  e.g. Ox.jpg Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the images.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imgReader1;\n  imgReader1.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  imgReader1->SetFileName(argv[1]);\n\n  vtkSmartPointer<vtkImageReader2> imgReader2;\n  imgReader2.TakeReference(readerFactory->CreateImageReader2(argv[2]));\n  imgReader2->SetFileName(argv[2]);\n\n  // Combine the images (blend takes multiple connections on the 0th input\n  // port).\n  vtkNew<vtkImageBlend> blend;\n  blend->AddInputConnection(imgReader1->GetOutputPort());\n  blend->AddInputConnection(imgReader2->GetOutputPort());\n  blend->SetOpacity(0, 0.5);\n  blend->SetOpacity(1, 0.5);\n\n  // Display the result.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(blend->GetOutputPort());\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Peru\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"CombineImages\");\n\n  imageViewer->GetRenderer()->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/CombineImages/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CombineImages)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CombineImages: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CombineImages MACOSX_BUNDLE CombineImages.cxx )\n  target_link_libraries(CombineImages PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CombineImages\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/CombineImages/#download-and-build-combineimages","title":"Download and Build CombineImages","text":"

Click here to download CombineImages and its CMakeLists.txt file. Once the tarball CombineImages.tar has been downloaded and extracted,

cd CombineImages/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CombineImages\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/CombiningRGBChannels/","title":"CombiningRGBChannels","text":"

vtk-examples/Cxx/Images/CombiningRGBChannels

"},{"location":"Cxx/Images/CombiningRGBChannels/#description","title":"Description","text":"

This example creates three images of a square. Each square slightly overlaps the previous square. These three layers are then interpreted as the R, G, and B channel of an RGB image, by the use of vtkImageAppendComponents.

Note

You MUST add 3 inputs or no output will be produced.

Seealso

For the reverse operation, see ExtractComponents.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/CombiningRGBChannels/#code","title":"Code","text":"

CombiningRGBChannels.cxx

#include <vtkImageActor.h>\n#include <vtkImageAppendComponents.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 4> drawColor1{0, 0, 0, 0};\n  std::array<double, 4> drawColor2{0, 0, 0, 0};\n  auto color1 = colors->GetColor4ub(\"Black\").GetData();\n  auto color2 = colors->GetColor4ub(\"Red\").GetData();\n  for (auto i = 0; i < 4; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n  // Set the alpha to 0\n  drawColor1[3] = 0;\n  drawColor2[3] = 0;\n\n  // Create an image (will be used as the R channel)\n  vtkNew<vtkImageCanvasSource2D> red;\n  red->SetScalarTypeToUnsignedChar();\n  red->SetNumberOfScalarComponents(1);\n  red->SetExtent(0, 100, 0, 100, 0, 0);\n  red->SetDrawColor(drawColor1.data());\n  red->FillBox(0, 100, 0, 100);\n  red->SetDrawColor(drawColor2.data());\n  red->FillBox(20, 40, 20, 40);\n  red->Update();\n\n  // Create an image (will be used as the G channel)\n  vtkNew<vtkImageCanvasSource2D> green;\n  green->SetScalarTypeToUnsignedChar();\n  green->SetNumberOfScalarComponents(1);\n  green->SetExtent(0, 100, 0, 100, 0, 0);\n  green->SetDrawColor(drawColor1.data());\n  green->FillBox(0, 100, 0, 100);\n  green->SetDrawColor(drawColor2.data());\n  green->FillBox(30, 50, 30, 50);\n  green->Update();\n\n  // Create an image (will be used as the B channel)\n  vtkNew<vtkImageCanvasSource2D> blue;\n  blue->SetScalarTypeToUnsignedChar();\n  blue->SetNumberOfScalarComponents(1);\n  blue->SetExtent(0, 100, 0, 100, 0, 0);\n  blue->SetDrawColor(drawColor1.data());\n  blue->FillBox(0, 100, 0, 100);\n  blue->SetDrawColor(drawColor2.data());\n  blue->FillBox(40, 60, 40, 60);\n  blue->Update();\n\n  vtkNew<vtkImageAppendComponents> appendFilter;\n  appendFilter->SetInputConnection(0, red->GetOutputPort());\n  appendFilter->AddInputConnection(0, green->GetOutputPort());\n  appendFilter->AddInputConnection(0, blue->GetOutputPort());\n  appendFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> redActor;\n  redActor->GetMapper()->SetInputConnection(red->GetOutputPort());\n\n  vtkNew<vtkImageActor> greenActor;\n  greenActor->GetMapper()->SetInputConnection(green->GetOutputPort());\n\n  vtkNew<vtkImageActor> blueActor;\n  blueActor->GetMapper()->SetInputConnection(blue->GetOutputPort());\n\n  vtkNew<vtkImageActor> combinedActor;\n  combinedActor->GetMapper()->SetInputConnection(appendFilter->GetOutputPort());\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double redViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double greenViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double blueViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double combinedViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> redRenderer;\n  redRenderer->SetViewport(redViewport);\n  redRenderer->AddActor(redActor);\n  redRenderer->ResetCamera();\n  redRenderer->SetBackground(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> greenRenderer;\n  greenRenderer->SetViewport(greenViewport);\n  greenRenderer->AddActor(greenActor);\n  greenRenderer->ResetCamera();\n  greenRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> blueRenderer;\n  blueRenderer->SetViewport(blueViewport);\n  blueRenderer->AddActor(blueActor);\n  blueRenderer->ResetCamera();\n  blueRenderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkRenderer> combinedRenderer;\n  combinedRenderer->SetViewport(combinedViewport);\n  combinedRenderer->AddActor(combinedActor);\n  combinedRenderer->ResetCamera();\n  combinedRenderer->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(redRenderer);\n  renderWindow->AddRenderer(greenRenderer);\n  renderWindow->AddRenderer(blueRenderer);\n  renderWindow->AddRenderer(combinedRenderer);\n  renderWindow->SetWindowName(\"CombiningRGBChannels\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/CombiningRGBChannels/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CombiningRGBChannels)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CombiningRGBChannels: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CombiningRGBChannels MACOSX_BUNDLE CombiningRGBChannels.cxx )\n  target_link_libraries(CombiningRGBChannels PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CombiningRGBChannels\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/CombiningRGBChannels/#download-and-build-combiningrgbchannels","title":"Download and Build CombiningRGBChannels","text":"

Click here to download CombiningRGBChannels and its CMakeLists.txt file. Once the tarball CombiningRGBChannels.tar has been downloaded and extracted,

cd CombiningRGBChannels/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CombiningRGBChannels\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/DotProduct/","title":"DotProduct","text":"

vtk-examples/Cxx/Images/DotProduct

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/DotProduct/#description","title":"Description","text":"

This example demonstrates how to take the pixel-wise dot product of two vector images. The output is a scalar image.

Two images, each 2x2x1, are created and filled with 3-vectors. The dot product of each pair of corresponding pixels is produced by the vtkImageDotProduct filter and output to the screen.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/DotProduct/#code","title":"Code","text":"

DotProduct.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageDotProduct.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageData> image1;\n  image1->SetExtent(0, 1, 0, 1, 0, 0);\n  image1->AllocateScalars(VTK_FLOAT, 3);\n\n  int coord[3];\n  float* pixel;\n\n  // Fill the image with vectors\n  coord[0] = 0;\n  coord[1] = 0;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image1->GetScalarPointer(coord));\n  pixel[0] = 1.0;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 0;\n  coord[1] = 1;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image1->GetScalarPointer(coord));\n  pixel[0] = 0.0;\n  pixel[1] = 1.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 1;\n  coord[1] = 0;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image1->GetScalarPointer(coord));\n  pixel[0] = 1.0;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 1;\n  coord[1] = 1;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image1->GetScalarPointer(coord));\n  pixel[0] = 0.0;\n  pixel[1] = 1.0;\n  pixel[2] = 0.0;\n\n  // Create another image.\n  vtkNew<vtkImageData> image2;\n  image2->SetExtent(0, 1, 0, 1, 0, 0);\n  image2->AllocateScalars(VTK_FLOAT, 3);\n\n  // Fill the image with vectors.\n  coord[0] = 0;\n  coord[1] = 0;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image2->GetScalarPointer(coord));\n  pixel[0] = 1.0;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 0;\n  coord[1] = 1;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image2->GetScalarPointer(coord));\n  pixel[0] = 1.0;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 1;\n  coord[1] = 0;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image2->GetScalarPointer(coord));\n  pixel[0] = 0.5;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 1;\n  coord[1] = 1;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image2->GetScalarPointer(coord));\n  pixel[0] = 0.5;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  // Compute the dot product of the images pixel wise.\n  vtkNew<vtkImageDotProduct> dotProductFilter;\n  dotProductFilter->SetInput1Data(image1);\n  dotProductFilter->SetInput2Data(image2);\n  dotProductFilter->Update();\n  std::cout << \"Output is of type: \"\n            << dotProductFilter->GetOutput()->GetScalarTypeAsString()\n            << std::endl;\n\n  vtkNew<vtkImageMathematics> imageMath;\n  imageMath->SetOperationToMultiplyByK();\n  imageMath->SetConstantK(255.0);\n  imageMath->SetInputConnection(dotProductFilter->GetOutputPort());\n  imageMath->Update();\n\n  vtkNew<vtkImageCast> imageCast;\n  imageCast->SetOutputScalarTypeToUnsignedChar();\n  imageCast->SetInputConnection(imageMath->GetOutputPort());\n  imageCast->Update();\n\n  vtkNew<vtkImageActor> dotProductActor;\n  dotProductActor->GetMapper()->SetInputConnection(imageCast->GetOutputPort());\n\n  // Display output to the terminal.\n  for (vtkIdType i = 0; i < 2; i++)\n  {\n    for (vtkIdType j = 0; j < 2; j++)\n    {\n      coord[0] = i;\n      coord[1] = j;\n      coord[2] = 0;\n      pixel = static_cast<float*>(\n          dotProductFilter->GetOutput()->GetScalarPointer(coord));\n      std::cout << \"Pixel (\" << i << \", \" << j << \") : \" << pixel[0]\n                << std::endl;\n    }\n  }\n\n  image1->GetPointData()->SetActiveVectors(\"ImageScalars\");\n  image2->GetPointData()->SetActiveVectors(\"ImageScalars\");\n\n  vtkNew<vtkArrowSource> arrowSource;\n\n  vtkNew<vtkGlyph3DMapper> glyph3Dmapper1;\n  glyph3Dmapper1->SetSourceConnection(arrowSource->GetOutputPort());\n  glyph3Dmapper1->SetInputData(image1);\n  glyph3Dmapper1->Update();\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(glyph3Dmapper1);\n\n  vtkNew<vtkGlyph3DMapper> glyph3Dmapper2;\n  glyph3Dmapper2->SetSourceConnection(arrowSource->GetOutputPort());\n  glyph3Dmapper2->SetInputData(image2);\n  glyph3Dmapper2->Update();\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(glyph3Dmapper2);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  vtkNew<vtkRenderer> centerRenderer;\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(leftRenderer);\n  renderWindow->AddRenderer(centerRenderer);\n  renderWindow->AddRenderer(rightRenderer);\n  renderWindow->SetWindowName(\"DotProduct\");\n  renderWindow->SetSize(600, 200);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  leftRenderer->AddActor(actor1);\n  centerRenderer->AddActor(actor2);\n  rightRenderer->AddActor(dotProductActor);\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/DotProduct/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DotProduct)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  ImagingCore\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DotProduct: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DotProduct MACOSX_BUNDLE DotProduct.cxx )\n  target_link_libraries(DotProduct PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DotProduct\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/DotProduct/#download-and-build-dotproduct","title":"Download and Build DotProduct","text":"

Click here to download DotProduct and its CMakeLists.txt file. Once the tarball DotProduct.tar has been downloaded and extracted,

cd DotProduct/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DotProduct\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/DrawOnAnImage/","title":"DrawOnAnImage","text":"

vtk-examples/Cxx/Images/DrawOnAnImage

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/DrawOnAnImage/#description","title":"Description","text":"

This example draws a circle in the center of the input image using vtkImageCanvasSource2D's DrawCircle method.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/DrawOnAnImage/#code","title":"Code","text":"

DrawOnAnImage.cxx

#include <vtkImageBlend.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputImageFilename e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imgReader;\n  imgReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  imgReader->SetFileName(argv[1]);\n  imgReader->Update();\n\n  vtkImageData* image = imgReader->GetOutput();\n\n  // Find center of image.\n  int center[2];\n  center[0] = (image->GetExtent()[1] + image->GetExtent()[0]) / 2;\n  center[1] = (image->GetExtent()[3] + image->GetExtent()[2]) / 2;\n\n  // Pick a radius for the circle.\n  int radius;\n  radius = (image->GetExtent()[1] < image->GetExtent()[3])\n      ? image->GetExtent()[1] * 2 / 5\n      : image->GetExtent()[3] * 2 / 5;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Black\").GetData();\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color2 = colors->GetColor3ub(\"Seashell\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Draw a circle in the center of the image.\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetExtent(image->GetExtent());\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(image->GetExtent()[0], image->GetExtent()[1],\n                   image->GetExtent()[2], image->GetExtent()[3]);\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(center[0], center[1], radius);\n\n  // Combine the images (blend takes multiple connections on the 0th\n  // input port).\n  vtkNew<vtkImageBlend> blend;\n  blend->AddInputConnection(imgReader->GetOutputPort());\n  blend->AddInputConnection(drawing->GetOutputPort());\n  blend->SetOpacity(0, .6);\n  blend->SetOpacity(1, .4);\n\n  // Display the result.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(blend->GetOutputPort());\n  imageViewer->SetSize(640, 512);\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  imageViewer->GetRenderWindow()->SetWindowName(\"DrawOnAnImage\");\n  imageViewer->GetRenderWindow()->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/DrawOnAnImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DrawOnAnImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DrawOnAnImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DrawOnAnImage MACOSX_BUNDLE DrawOnAnImage.cxx )\n  target_link_libraries(DrawOnAnImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DrawOnAnImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/DrawOnAnImage/#download-and-build-drawonanimage","title":"Download and Build DrawOnAnImage","text":"

Click here to download DrawOnAnImage and its CMakeLists.txt file. Once the tarball DrawOnAnImage.tar has been downloaded and extracted,

cd DrawOnAnImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DrawOnAnImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/DrawShapes/","title":"DrawShapes","text":"

vtk-examples/Cxx/Images/DrawShapes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/DrawShapes/#code","title":"Code","text":"

DrawShapes.cxx

#include <vtkImageCanvasSource2D.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"DimGray\").GetData();\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color2 = colors->GetColor3ub(\"HotPink\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create a blank, colored image.\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 20, 0, 50, 0, 0);\n  // Comment out or set color1 to \"Black\" if you want a black image.\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(0, 20, 0, 50);\n\n  // Draw a red circle of radius 5 centered at (9,10).\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(9, 10, 5);\n  drawing->Update();\n\n  // View the result\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(drawing->GetOutputPort());\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->GetRenderer()->GradientBackgroundOn();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SkyBlue\").GetData());\n  imageViewer->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderWindow()->SetWindowName(\"DrawShapes\");\n  imageViewer->GetRenderWindow()->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/DrawShapes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DrawShapes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DrawShapes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DrawShapes MACOSX_BUNDLE DrawShapes.cxx )\n  target_link_libraries(DrawShapes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DrawShapes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/DrawShapes/#download-and-build-drawshapes","title":"Download and Build DrawShapes","text":"

Click here to download DrawShapes and its CMakeLists.txt file. Once the tarball DrawShapes.tar has been downloaded and extracted,

cd DrawShapes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DrawShapes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ExtractComponents/","title":"ExtractComponents","text":"

vtk-examples/Cxx/Images/ExtractComponents

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ExtractComponents/#description","title":"Description","text":"

This example separates an image into the red channel, the green channel, and the blue channel using vtkImageExtractComponents.

Seealso

For the reverse operation, see CombiningRGBChannels.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ExtractComponents/#code","title":"Code","text":"

ExtractComponents.cxx

#include <vtkImageActor.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputFilename e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageExtractComponents> extractRedFilter;\n  extractRedFilter->SetInputConnection(reader->GetOutputPort());\n  extractRedFilter->SetComponents(0);\n  extractRedFilter->Update();\n\n  vtkNew<vtkImageExtractComponents> extractGreenFilter;\n  extractGreenFilter->SetInputConnection(reader->GetOutputPort());\n  extractGreenFilter->SetComponents(1);\n  extractGreenFilter->Update();\n\n  vtkNew<vtkImageExtractComponents> extractBlueFilter;\n  extractBlueFilter->SetInputConnection(reader->GetOutputPort());\n  extractBlueFilter->SetComponents(2);\n  extractBlueFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> redActor;\n  redActor->GetMapper()->SetInputConnection(extractRedFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> greenActor;\n  greenActor->GetMapper()->SetInputConnection(\n      extractGreenFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> blueActor;\n  blueActor->GetMapper()->SetInputConnection(\n      extractBlueFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double redViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double greenViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double blueViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->ResetCamera();\n  inputRenderer->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n\n  vtkNew<vtkRenderer> redRenderer;\n  redRenderer->SetViewport(redViewport);\n  redRenderer->AddActor(redActor);\n  redRenderer->ResetCamera();\n  redRenderer->SetBackground(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> greenRenderer;\n  greenRenderer->SetViewport(greenViewport);\n  greenRenderer->AddActor(greenActor);\n  greenRenderer->ResetCamera();\n  greenRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> blueRenderer;\n  blueRenderer->SetViewport(blueViewport);\n  blueRenderer->AddActor(blueActor);\n  blueRenderer->ResetCamera();\n  blueRenderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(redRenderer);\n  renderWindow->AddRenderer(greenRenderer);\n  renderWindow->AddRenderer(blueRenderer);\n  renderWindow->SetWindowName(\"ExtractComponents\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ExtractComponents/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractComponents)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractComponents: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractComponents MACOSX_BUNDLE ExtractComponents.cxx )\n  target_link_libraries(ExtractComponents PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractComponents\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ExtractComponents/#download-and-build-extractcomponents","title":"Download and Build ExtractComponents","text":"

Click here to download ExtractComponents and its CMakeLists.txt file. Once the tarball ExtractComponents.tar has been downloaded and extracted,

cd ExtractComponents/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractComponents\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/FillWindow/","title":"FillWindow","text":"

vtk-examples/Cxx/Images/FillWindow

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/FillWindow/#code","title":"Code","text":"

FillWindow.cxx

#include <vtkCamera.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> mandelbrotSource;\n  mandelbrotSource->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(mandelbrotSource->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper;\n  imageSliceMapper->SetInputConnection(castFilter->GetOutputPort());\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageSliceMapper);\n\n  int extent[6];\n  castFilter->GetOutput()->GetExtent(extent);\n\n  double origin[3];\n  castFilter->GetOutput()->GetOrigin(origin);\n\n  double spacing[3];\n  castFilter->GetOutput()->GetSpacing(spacing);\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageSlice);\n  renderer->ResetCamera();\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"FillWindow\");\n\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->ParallelProjectionOn();\n  renderer->SetBackground(colors->GetColor3d(\"Red\").GetData());\n\n  float xc = origin[0] + 0.5 * (extent[0] + extent[1]) * spacing[0];\n  float yc = origin[1] + 0.5 * (extent[2] + extent[3]) * spacing[1];\n  //  float xd = (extent[1] - extent[0] + 1)*spacing[0]; // not used\n  float yd = (extent[3] - extent[2] + 1) * spacing[1];\n\n  float d = camera->GetDistance();\n  camera->SetParallelScale(0.5f * static_cast<float>(yd));\n  camera->SetFocalPoint(xc, yc, 0.0);\n  camera->SetPosition(xc, yc, +d);\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/FillWindow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FillWindow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FillWindow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FillWindow MACOSX_BUNDLE FillWindow.cxx )\n  target_link_libraries(FillWindow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FillWindow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/FillWindow/#download-and-build-fillwindow","title":"Download and Build FillWindow","text":"

Click here to download FillWindow and its CMakeLists.txt file. Once the tarball FillWindow.tar has been downloaded and extracted,

cd FillWindow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FillWindow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/Flip/","title":"Flip","text":"

vtk-examples/Cxx/Images/Flip

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/Flip/#description","title":"Description","text":"

This example demonstrates how to flip an image over an axis.

Need a better source image (non-symmetrical!).

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/Flip/#code","title":"Code","text":"

Flip.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageFlip.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> castSource;\n  castSource->SetOutputScalarTypeToUnsignedChar();\n  castSource->SetInputConnection(source->GetOutputPort());\n  castSource->Update();\n\n  vtkNew<vtkImageFlip> flipXFilter;\n  flipXFilter->SetFilteredAxis(0); // flip x axis\n  flipXFilter->SetInputConnection(source->GetOutputPort());\n  flipXFilter->Update();\n\n  vtkNew<vtkImageCast> castXFilter;\n  castXFilter->SetOutputScalarTypeToUnsignedChar();\n  castXFilter->SetInputConnection(flipXFilter->GetOutputPort());\n  castXFilter->Update();\n\n  vtkNew<vtkImageFlip> flipYFilter;\n  flipYFilter->SetFilteredAxis(1); // flip y axis\n  flipYFilter->SetInputConnection(source->GetOutputPort());\n  flipYFilter->Update();\n\n  vtkNew<vtkImageCast> castYFilter;\n  castYFilter->SetOutputScalarTypeToUnsignedChar();\n  castYFilter->SetInputConnection(flipYFilter->GetOutputPort());\n  castYFilter->Update();\n\n  vtkNew<vtkImageFlip> flipZFilter;\n  flipZFilter->SetFilteredAxis(2); // flip z axis\n  flipZFilter->SetInputConnection(source->GetOutputPort());\n  flipZFilter->Update();\n\n  vtkNew<vtkImageCast> castZFilter;\n  castZFilter->SetOutputScalarTypeToUnsignedChar();\n  castZFilter->SetInputConnection(flipZFilter->GetOutputPort());\n  castZFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(castSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> xActor;\n  xActor->GetMapper()->SetInputConnection(castXFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> yActor;\n  yActor->GetMapper()->SetInputConnection(castYFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> zActor;\n  zActor->GetMapper()->SetInputConnection(castZFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double xViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double yViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double zViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->ResetCamera();\n  inputRenderer->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n\n  vtkNew<vtkRenderer> xRenderer;\n  xRenderer->SetViewport(xViewport);\n  xRenderer->AddActor(xActor);\n  xRenderer->ResetCamera();\n  xRenderer->SetBackground(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> yRenderer;\n  yRenderer->SetViewport(yViewport);\n  yRenderer->AddActor(yActor);\n  yRenderer->ResetCamera();\n  yRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> zRenderer;\n  zRenderer->SetViewport(zViewport);\n  zRenderer->AddActor(zActor);\n  zRenderer->ResetCamera();\n  zRenderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(xRenderer);\n  renderWindow->AddRenderer(yRenderer);\n  renderWindow->AddRenderer(zRenderer);\n  renderWindow->SetWindowName(\"Flip\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/Flip/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Flip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Flip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Flip MACOSX_BUNDLE Flip.cxx )\n  target_link_libraries(Flip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Flip\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/Flip/#download-and-build-flip","title":"Download and Build Flip","text":"

Click here to download Flip and its CMakeLists.txt file. Once the tarball Flip.tar has been downloaded and extracted,

cd Flip/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Flip\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/Gradient/","title":"Gradient","text":"

vtk-examples/Cxx/Images/Gradient

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/Gradient/#description","title":"Description","text":"

Find the gradient vector of an image at every pixel. Display the original image, the x component of the gradient, the y component of the gradient, and the gradient itself.

The example takes an optional .jpeg image file.

  • Thanks to Eric Monson.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/Gradient/#code","title":"Code","text":"

Gradient.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkDoubleArray.h>\n#include <vtkFieldDataToAttributeDataFilter.h>\n#include <vtkGlyph3D.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageGradient.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageRGBToHSV.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageShiftScale.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n  namedColors->SetColor(\"Bkg\", 0.2, 0.3, 0.6);\n\n  vtkSmartPointer<vtkImageData> originalImage;\n  vtkSmartPointer<vtkImageData> image;\n\n  int onRatio = 1;\n  double scaleFactor = 1.0;\n  if (argc < 2)\n  {\n    std::array<double, 3> drawColor1{0, 0, 0};\n    auto color1 = namedColors->GetColor3ub(\"Gray\").GetData();\n    std::array<double, 3> drawColor2{0, 0, 0};\n    auto color2 = namedColors->GetColor3ub(\"Snow\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n    }\n\n    // Create an image.\n    vtkNew<vtkImageCanvasSource2D> imageSource;\n    imageSource->SetScalarTypeToDouble();\n    imageSource->SetNumberOfScalarComponents(1);\n    imageSource->SetExtent(0, 6, 0, 6, 0, 0);\n    imageSource->SetDrawColor(drawColor1.data());\n    imageSource->FillBox(0, 6, 0, 6);\n    imageSource->SetDrawColor(drawColor2.data());\n    imageSource->FillBox(2, 4, 2, 4);\n    imageSource->Update();\n\n    originalImage = imageSource->GetOutput();\n    image = imageSource->GetOutput();\n\n    // Use all of the points.\n    onRatio = 1;\n    scaleFactor = .01;\n  }\n  else\n  {\n    // Read an image.\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> reader;\n    reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n    reader->SetFileName(argv[1]);\n\n    // Convert to HSV and extract the Value.\n    vtkNew<vtkImageRGBToHSV> hsvFilter;\n    hsvFilter->SetInputConnection(reader->GetOutputPort());\n\n    vtkNew<vtkImageExtractComponents> extractValue;\n    extractValue->SetInputConnection(hsvFilter->GetOutputPort());\n    extractValue->SetComponents(2);\n    extractValue->Update();\n\n    image = extractValue->GetOutput();\n    originalImage = reader->GetOutput();\n\n    // Use 1% of the points.\n    onRatio = image->GetPointData()->GetScalars()->GetNumberOfTuples() /\n        (image->GetPointData()->GetScalars()->GetNumberOfTuples() * .01);\n    scaleFactor = 1.0;\n  }\n\n  // Compute the gradient of the Value.\n  vtkNew<vtkImageGradient> gradientFilter;\n  gradientFilter->SetInputData(image);\n  gradientFilter->SetDimensionality(2);\n  gradientFilter->Update();\n\n  // Extract the x component of the gradient.\n  vtkNew<vtkImageExtractComponents> extractXFilter;\n  extractXFilter->SetComponents(0);\n  extractXFilter->SetInputConnection(gradientFilter->GetOutputPort());\n\n  double xRange[2];\n\n  extractXFilter->Update();\n  extractXFilter->GetOutput()->GetPointData()->GetScalars()->GetRange(xRange);\n\n  // Gradient could be negative, so take the absolute value.\n  vtkNew<vtkImageMathematics> imageAbsX;\n  imageAbsX->SetOperationToAbsoluteValue();\n  imageAbsX->SetInputConnection(extractXFilter->GetOutputPort());\n\n  // Scale the output (0,255).\n  vtkNew<vtkImageShiftScale> shiftScaleX;\n  shiftScaleX->SetOutputScalarTypeToUnsignedChar();\n  shiftScaleX->SetScale(255 / xRange[1]);\n  shiftScaleX->SetInputConnection(imageAbsX->GetOutputPort());\n\n  // Extract the y component of the gradient.\n  vtkNew<vtkImageExtractComponents> extractYFilter;\n  extractYFilter->SetComponents(1);\n  extractYFilter->SetInputConnection(gradientFilter->GetOutputPort());\n\n  double yRange[2];\n  extractYFilter->Update();\n  extractYFilter->GetOutput()->GetPointData()->GetScalars()->GetRange(yRange);\n\n  // Gradient could be negative, so take the absolute value.\n  vtkNew<vtkImageMathematics> imageAbsY;\n  imageAbsY->SetOperationToAbsoluteValue();\n  imageAbsY->SetInputConnection(extractYFilter->GetOutputPort());\n\n  // Scale the output (0,255)\n  vtkNew<vtkImageShiftScale> shiftScaleY;\n  shiftScaleY->SetOutputScalarTypeToUnsignedChar();\n  shiftScaleY->SetScale(255 / yRange[1]);\n  shiftScaleY->SetInputConnection(imageAbsY->GetOutputPort());\n\n  // Create the Glyphs for the gradient.\n  vtkNew<vtkArrowSource> arrowSource;\n\n  // The gradient is 2D but Glyph3D needs 3D vectors. Add a 0 z-component\n  // Also, ImageGradient generates a 2-component scalar for the\n  // gradient, but Glyph3D needs normals or vectors.\n  vtkNew<vtkDoubleArray> zeroes;\n  zeroes->SetNumberOfComponents(1);\n  zeroes->SetName(\"Zero\");\n  zeroes->SetNumberOfTuples(gradientFilter->GetOutput()\n                                ->GetPointData()\n                                ->GetScalars()\n                                ->GetNumberOfTuples());\n  zeroes->FillComponent(0, 0.0);\n  gradientFilter->GetOutput()->GetPointData()->AddArray(zeroes);\n\n  std::string scalarName =\n      gradientFilter->GetOutput()->GetPointData()->GetScalars()->GetName();\n\n  vtkNew<vtkFieldDataToAttributeDataFilter> scalarsToVectors;\n  scalarsToVectors->SetInputConnection(gradientFilter->GetOutputPort());\n  scalarsToVectors->SetInputFieldToPointDataField();\n  scalarsToVectors->SetOutputAttributeDataToPointData();\n  scalarsToVectors->SetVectorComponent(0, scalarName.c_str(), 0);\n  scalarsToVectors->SetVectorComponent(1, scalarName.c_str(), 1);\n  scalarsToVectors->SetVectorComponent(2, \"Zero\", 0);\n\n  // Select a small percentage of the gradients.\n  vtkNew<vtkMaskPoints> maskPoints;\n  maskPoints->SetInputConnection(scalarsToVectors->GetOutputPort());\n  maskPoints->RandomModeOff();\n  maskPoints->SetOnRatio(onRatio);\n\n  vtkNew<vtkGlyph3D> vectorGradientGlyph;\n  vectorGradientGlyph->SetSourceConnection(arrowSource->GetOutputPort());\n  vectorGradientGlyph->SetInputConnection(maskPoints->GetOutputPort());\n  vectorGradientGlyph->SetScaleModeToScaleByVector();\n  vectorGradientGlyph->SetVectorModeToUseVector();\n  vectorGradientGlyph->SetScaleFactor(scaleFactor);\n\n  // Visualize.\n\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double xGradientViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double yGradientViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double vectorGradientViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkPolyDataMapper> vectorGradientMapper;\n  vectorGradientMapper->SetInputConnection(\n      vectorGradientGlyph->GetOutputPort());\n  vectorGradientMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> vectorGradientActor;\n  vectorGradientActor->SetMapper(vectorGradientMapper);\n  vectorGradientActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  // vtkNew<vtkCamera> sharedCamera;\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->SetBackground(namedColors->GetColor3d(\"Bkg\").GetData());\n\n  vtkNew<vtkRenderer> xGradientRenderer;\n  xGradientRenderer->SetViewport(xGradientViewport);\n  xGradientRenderer->SetBackground(namedColors->GetColor3d(\"Bkg\").GetData());\n\n  vtkNew<vtkRenderer> yGradientRenderer;\n  yGradientRenderer->SetViewport(yGradientViewport);\n  yGradientRenderer->SetBackground(namedColors->GetColor3d(\"Bkg\").GetData());\n\n  vtkNew<vtkRenderer> vectorGradientRenderer;\n  vectorGradientRenderer->SetViewport(vectorGradientViewport);\n  vectorGradientRenderer->SetBackground(\n      namedColors->GetColor3d(\"Bkg\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(xGradientRenderer);\n  renderWindow->AddRenderer(yGradientRenderer);\n  renderWindow->AddRenderer(vectorGradientRenderer);\n  renderWindow->SetWindowName(\"Gradient\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputData(originalImage);\n  originalActor->InterpolateOff();\n\n  vtkNew<vtkImageActor> xGradientActor;\n  xGradientActor->InterpolateOff();\n\n  xGradientActor->GetMapper()->SetInputConnection(shiftScaleX->GetOutputPort());\n\n  vtkNew<vtkImageActor> yGradientActor;\n\n  yGradientActor->GetMapper()->SetInputConnection(shiftScaleY->GetOutputPort());\n  yGradientActor->InterpolateOff();\n\n  // Add the actors to the scenes.\n  originalRenderer->AddActor(originalActor);\n  xGradientRenderer->AddActor(xGradientActor);\n  yGradientRenderer->AddActor(yGradientActor);\n  vectorGradientRenderer->AddActor(vectorGradientActor);\n  vectorGradientRenderer->AddActor(originalActor);\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/Gradient/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Gradient)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Gradient: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Gradient MACOSX_BUNDLE Gradient.cxx )\n  target_link_libraries(Gradient PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Gradient\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/Gradient/#download-and-build-gradient","title":"Download and Build Gradient","text":"

Click here to download Gradient and its CMakeLists.txt file. Once the tarball Gradient.tar has been downloaded and extracted,

cd Gradient/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Gradient\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageAccumulate/","title":"ImageAccumulate","text":"

vtk-examples/Cxx/Images/ImageAccumulate

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageAccumulate/#code","title":"Code","text":"

ImageAccumulate.cxx

/*\n * In this example, the resulting histogram has 6 pixels (all of them) in the\n * 3rd bin (value = 2) and zero in the rest of the bins\n */\n#include <vtkImageAccumulate.h>\n#include <vtkImageData.h>\n#include <vtkNew.h>\n#include <vtkSmartPointer.h>\n\nnamespace {\n\nvoid CreateImage(vtkSmartPointer<vtkImageData> image);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkImageData> image;\n  CreateImage(image);\n\n  vtkNew<vtkImageAccumulate> imageAccumulate;\n  imageAccumulate->SetInputData(image);\n  imageAccumulate->SetComponentExtent(0, 255, 0, 0, 0, 0);\n  imageAccumulate->SetComponentOrigin(0, 0, 0);\n  imageAccumulate->SetComponentSpacing(\n      1, 0, 0); // This will count exactly the number of pixels of each color.\n                // Use (10,0,0) to make bins of width 10 instead.\n  imageAccumulate->Update();\n\n  int dims[3];\n  imageAccumulate->GetOutput()->GetDimensions(dims);\n  for (vtkIdType bin = 0; bin < dims[0]; ++bin)\n  {\n    std::cout << *(static_cast<int*>(\n                     imageAccumulate->GetOutput()->GetScalarPointer(bin, 0, 0)))\n              << \" \";\n  }\n\n  std::cout << std::endl;\n\n  double mean[3];\n  imageAccumulate->GetMean(mean);\n  std::cout << \"Mean: \" << mean[0] << \" \" << mean[1] << \" \" << mean[2]\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateImage(vtkSmartPointer<vtkImageData> image)\n{\n  // Specify the size of the image data\n  image->SetDimensions(2, 3, 1);\n  // image->SetExtent(0,2,0,3,0,1);\n  image->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = image->GetDimensions();\n  // int dims[3]; // can't do this\n\n  std::cout << \"Dims: \"\n            << \" x: \" << dims[0] << \" y: \" << dims[1] << \" z: \" << dims[2]\n            << std::endl;\n\n  // Fill every entry of the image data with \"2.0\"\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel = static_cast<double*>(image->GetScalarPointer(x, y, z));\n        pixel[0] = 2.0;\n      }\n    }\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/Images/ImageAccumulate/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageAccumulate)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  ImagingStatistics\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageAccumulate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageAccumulate MACOSX_BUNDLE ImageAccumulate.cxx )\n  target_link_libraries(ImageAccumulate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageAccumulate\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageAccumulate/#download-and-build-imageaccumulate","title":"Download and Build ImageAccumulate","text":"

Click here to download ImageAccumulate and its CMakeLists.txt file. Once the tarball ImageAccumulate.tar has been downloaded and extracted,

cd ImageAccumulate/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageAccumulate\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageAccumulateGreyscale/","title":"ImageAccumulateGreyscale","text":"

vtk-examples/Cxx/Images/ImageAccumulateGreyscale

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageAccumulateGreyscale/#code","title":"Code","text":"

ImageAccumulateGreyscale.cxx

#include <vtkBarChartActor.h>\n#include <vtkFieldData.h>\n#include <vtkImageAccumulate.h>\n#include <vtkImageData.h>\n#include <vtkImageMagnitude.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkIntArray.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  // Handle the arguments\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename e.g. Ox.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageMagnitude> magnitude;\n  magnitude->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkIntArray> frequencies;\n\n  vtkNew<vtkImageAccumulate> histogram;\n  histogram->SetInputConnection(magnitude->GetOutputPort());\n  histogram->SetComponentExtent(0, 255, 0, 0, 0, 0);\n  histogram->SetComponentOrigin(0, 0, 0);\n  histogram->SetComponentSpacing(1, 0, 0);\n  histogram->IgnoreZeroOn();\n  histogram->Update();\n\n  int numberOfTuples = 64;\n  frequencies->SetNumberOfComponents(1);\n  frequencies->SetNumberOfTuples(numberOfTuples);\n  vtkIdType* output =\n      static_cast<vtkIdType*>(histogram->GetOutput()->GetScalarPointer());\n\n  for (int j = 0; j < numberOfTuples; ++j)\n  {\n    frequencies->SetTuple1(j, *output++);\n  }\n\n  vtkNew<vtkDataObject> dataObject;\n\n  dataObject->GetFieldData()->AddArray(frequencies);\n\n  // Create a vtkBarChartActor.\n  vtkNew<vtkBarChartActor> barChart;\n\n  barChart->SetInput(dataObject);\n  barChart->SetTitle(\"Histogram\");\n  barChart->GetPositionCoordinate()->SetValue(0.1, 0.05, 0.0);\n  barChart->GetPosition2Coordinate()->SetValue(0.95, 0.85, 0.0);\n  barChart->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  barChart->GetLegendActor()->SetNumberOfEntries(\n      dataObject->GetFieldData()->GetArray(0)->GetNumberOfTuples());\n  barChart->LegendVisibilityOff();\n  barChart->LabelVisibilityOff();\n\n  int count = 0;\n  for (int i = 0; i < numberOfTuples; ++i)\n  {\n    barChart->SetBarColor(count++, colors->GetColor3d(\"Tomato\").GetData());\n  }\n\n  // Visualize the histogram.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(barChart);\n  renderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ImageAccumulateGreyscale\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Initialize the event loop and then start it\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageAccumulateGreyscale/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageAccumulateGreyscale)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingMath\n  ImagingStatistics\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageAccumulateGreyscale: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageAccumulateGreyscale MACOSX_BUNDLE ImageAccumulateGreyscale.cxx )\n  target_link_libraries(ImageAccumulateGreyscale PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageAccumulateGreyscale\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageAccumulateGreyscale/#download-and-build-imageaccumulategreyscale","title":"Download and Build ImageAccumulateGreyscale","text":"

Click here to download ImageAccumulateGreyscale and its CMakeLists.txt file. Once the tarball ImageAccumulateGreyscale.tar has been downloaded and extracted,

cd ImageAccumulateGreyscale/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageAccumulateGreyscale\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageAnisotropicDiffusion2D/","title":"ImageAnisotropicDiffusion2D","text":"

vtk-examples/Cxx/Images/ImageAnisotropicDiffusion2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageAnisotropicDiffusion2D/#code","title":"Code","text":"

ImageAnisotropicDiffusion2D.cxx

#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageAnisotropicDiffusion2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout\n        << \"Usage: \" << argv[0]\n        << \" ImagFilename e.g cake_easy.jpg [iterations(10)] [threshold(20)]\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n  int iterations = 10;\n  if (argc >= 3)\n  {\n    iterations = atoi(argv[2]);\n  }\n  float threshold = 20;\n  if (argc >= 4)\n  {\n    threshold = atoi(argv[3]);\n  }\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageAnisotropicDiffusion2D> diffusion;\n  diffusion->SetInputConnection(reader->GetOutputPort());\n  diffusion->SetNumberOfIterations(iterations);\n  diffusion->SetDiffusionThreshold(threshold);\n  diffusion->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkImageActor> diffusionActor;\n  diffusionActor->GetMapper()->SetInputConnection(diffusion->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkCamera> camera;\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->AddActor(originalActor);\n  leftRenderer->SetActiveCamera(camera);\n  leftRenderer->ResetCamera();\n  leftRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->AddActor(diffusionActor);\n  rightRenderer->SetActiveCamera(camera);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(leftRenderer);\n  renderWindow->AddRenderer(rightRenderer);\n  renderWindow->SetWindowName(\"ImageAnisotropicDiffusion2D\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageAnisotropicDiffusion2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageAnisotropicDiffusion2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageAnisotropicDiffusion2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageAnisotropicDiffusion2D MACOSX_BUNDLE ImageAnisotropicDiffusion2D.cxx )\n  target_link_libraries(ImageAnisotropicDiffusion2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageAnisotropicDiffusion2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageAnisotropicDiffusion2D/#download-and-build-imageanisotropicdiffusion2d","title":"Download and Build ImageAnisotropicDiffusion2D","text":"

Click here to download ImageAnisotropicDiffusion2D and its CMakeLists.txt file. Once the tarball ImageAnisotropicDiffusion2D.tar has been downloaded and extracted,

cd ImageAnisotropicDiffusion2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageAnisotropicDiffusion2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageCheckerboard/","title":"ImageCheckerboard","text":"

vtk-examples/Cxx/Images/ImageCheckerboard

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageCheckerboard/#description","title":"Description","text":"

This example compares two images using a checkerboard pattern.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageCheckerboard/#code","title":"Code","text":"

ImageCheckerboard.cxx

#include <vtkImageCheckerboard.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input1Filename Input2Filename e.g. Ox.jpg Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the images.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader1;\n  reader1.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader1->SetFileName(argv[1]);\n\n  vtkSmartPointer<vtkImageReader2> reader2;\n  reader2.TakeReference(readerFactory->CreateImageReader2(argv[2]));\n  reader2->SetFileName(argv[2]);\n\n  vtkNew<vtkImageCheckerboard> checkerboardFilter;\n  checkerboardFilter->SetInputConnection(0, reader1->GetOutputPort());\n  checkerboardFilter->SetInputConnection(1, reader2->GetOutputPort());\n  checkerboardFilter->SetNumberOfDivisions(3, 3, 1);\n\n  // Visualize.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(checkerboardFilter->GetOutputPort());\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Wheat\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ImageCheckerboard\");\n  imageViewer->GetRenderWindow()->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageCheckerboard/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageCheckerboard)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingGeneral\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageCheckerboard: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageCheckerboard MACOSX_BUNDLE ImageCheckerboard.cxx )\n  target_link_libraries(ImageCheckerboard PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageCheckerboard\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageCheckerboard/#download-and-build-imagecheckerboard","title":"Download and Build ImageCheckerboard","text":"

Click here to download ImageCheckerboard and its CMakeLists.txt file. Once the tarball ImageCheckerboard.tar has been downloaded and extracted,

cd ImageCheckerboard/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageCheckerboard\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageCityBlockDistance/","title":"ImageCityBlockDistance","text":"

vtk-examples/Cxx/Images/ImageCityBlockDistance

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageCityBlockDistance/#description","title":"Description","text":"

Compute the Manhattan distance from every point to every black point in a binary image.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageCityBlockDistance/#code","title":"Code","text":"

ImageCityBlockDistance.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageCityBlockDistance.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" BinaryImage e.g. Yinyang.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read file.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetOutputScalarTypeToShort();\n  castFilter->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageCityBlockDistance> cityBlockDistanceFilter;\n  cityBlockDistanceFilter->SetInputConnection(castFilter->GetOutputPort());\n  cityBlockDistanceFilter->SetDimensionality(2);\n  cityBlockDistanceFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageCast> inputCastFilter;\n  inputCastFilter->SetOutputScalarTypeToUnsignedChar();\n  inputCastFilter->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(inputCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageCast> distanceCastFilter;\n  distanceCastFilter->SetOutputScalarTypeToUnsignedChar();\n  distanceCastFilter->SetInputConnection(\n      cityBlockDistanceFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> distanceActor;\n  distanceActor->GetMapper()->SetInputConnection(\n      distanceCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double distanceViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->ResetCamera();\n  inputRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> distanceRenderer;\n  distanceRenderer->SetViewport(distanceViewport);\n  distanceRenderer->AddActor(distanceActor);\n  distanceRenderer->ResetCamera();\n  distanceRenderer->SetBackground(colors->GetColor3d(\"LightSkyBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(distanceRenderer);\n  renderWindow->SetWindowName(\"ImageCityBlockDistance\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageCityBlockDistance/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageCityBlockDistance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageCityBlockDistance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageCityBlockDistance MACOSX_BUNDLE ImageCityBlockDistance.cxx )\n  target_link_libraries(ImageCityBlockDistance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageCityBlockDistance\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageCityBlockDistance/#download-and-build-imagecityblockdistance","title":"Download and Build ImageCityBlockDistance","text":"

Click here to download ImageCityBlockDistance and its CMakeLists.txt file. Once the tarball ImageCityBlockDistance.tar has been downloaded and extracted,

cd ImageCityBlockDistance/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageCityBlockDistance\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageContinuousDilate3D/","title":"ImageContinuousDilate3D","text":"

vtk-examples/Cxx/Images/ImageContinuousDilate3D

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageContinuousDilate3D/#code","title":"Code","text":"

ImageContinuousDilate3D.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageContinuousDilate3D.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> image;\n\n  if (argc < 2)\n  {\n    std::array<double, 3> drawColor1{0, 0, 0};\n    std::array<double, 3> drawColor2{0, 0, 0};\n    auto color1 = colors->GetColor3ub(\"Black\").GetData();\n    auto color2 = colors->GetColor3ub(\"Red\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n    }\n\n    // Create an image\n    vtkNew<vtkImageCanvasSource2D> source;\n    source->SetScalarTypeToUnsignedChar();\n    source->SetExtent(0, 200, 0, 200, 0, 0);\n    source->SetDrawColor(drawColor1.data());\n    source->FillBox(0, 200, 0, 200);\n    source->SetDrawColor(drawColor2.data());\n    source->FillBox(100, 150, 100, 150);\n    source->Update();\n    image->ShallowCopy(source->GetOutput());\n  }\n  else\n  {\n    vtkNew<vtkPNGReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    image->ShallowCopy(reader->GetOutput());\n  }\n\n  vtkNew<vtkImageContinuousDilate3D> dilateFilter;\n  dilateFilter->SetInputData(image);\n  dilateFilter->SetKernelSize(10, 10, 1);\n  dilateFilter->Update();\n\n  vtkNew<vtkDataSetMapper> originalMapper;\n  originalMapper->SetInputData(image);\n  originalMapper->Update();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n\n  vtkNew<vtkDataSetMapper> dilatedMapper;\n  dilatedMapper->SetInputConnection(dilateFilter->GetOutputPort());\n  dilatedMapper->Update();\n\n  vtkNew<vtkActor> dilatedActor;\n  dilatedActor->SetMapper(dilatedMapper);\n\n  // Visualize\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"ImageContinuousDilate3D\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  leftRenderer->AddActor(originalActor);\n  rightRenderer->AddActor(dilatedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageContinuousDilate3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageContinuousDilate3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingMorphological\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageContinuousDilate3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageContinuousDilate3D MACOSX_BUNDLE ImageContinuousDilate3D.cxx )\n  target_link_libraries(ImageContinuousDilate3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageContinuousDilate3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageContinuousDilate3D/#download-and-build-imagecontinuousdilate3d","title":"Download and Build ImageContinuousDilate3D","text":"

Click here to download ImageContinuousDilate3D and its CMakeLists.txt file. Once the tarball ImageContinuousDilate3D.tar has been downloaded and extracted,

cd ImageContinuousDilate3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageContinuousDilate3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageContinuousErode3D/","title":"ImageContinuousErode3D","text":"

vtk-examples/Cxx/Images/ImageContinuousErode3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageContinuousErode3D/#code","title":"Code","text":"

ImageContinuousErode3D.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageContinuousErode3D.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> image;\n\n  if (argc < 2)\n  {\n    std::array<double, 3> drawColor1{0, 0, 0};\n    std::array<double, 3> drawColor2{0, 0, 0};\n    auto color1 = colors->GetColor3ub(\"Black\").GetData();\n    auto color2 = colors->GetColor3ub(\"Red\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n    }\n\n    // Create an image\n    vtkNew<vtkImageCanvasSource2D> source;\n    source->SetScalarTypeToUnsignedChar();\n    source->SetExtent(0, 200, 0, 200, 0, 0);\n    source->SetDrawColor(drawColor1.data());\n    source->FillBox(0, 200, 0, 200);\n    source->SetDrawColor(drawColor2.data());\n    source->FillBox(100, 150, 100, 150);\n    source->Update();\n    image->ShallowCopy(source->GetOutput());\n  }\n  else\n  {\n    vtkNew<vtkPNGReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    image->ShallowCopy(reader->GetOutput());\n  }\n\n  vtkNew<vtkImageContinuousErode3D> erodeFilter;\n  erodeFilter->SetInputData(image);\n  erodeFilter->SetKernelSize(10, 10, 1);\n  erodeFilter->Update();\n\n  vtkNew<vtkDataSetMapper> originalMapper;\n  originalMapper->SetInputData(image);\n  originalMapper->Update();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n\n  vtkNew<vtkDataSetMapper> erodedMapper;\n  erodedMapper->SetInputConnection(erodeFilter->GetOutputPort());\n  erodedMapper->Update();\n\n  vtkNew<vtkActor> erodedActor;\n  erodedActor->SetMapper(erodedMapper);\n\n  // Visualize\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"ImageContinuousErode3D\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  leftRenderer->AddActor(originalActor);\n  rightRenderer->AddActor(erodedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageContinuousErode3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageContinuousErode3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingMorphological\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageContinuousErode3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageContinuousErode3D MACOSX_BUNDLE ImageContinuousErode3D.cxx )\n  target_link_libraries(ImageContinuousErode3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageContinuousErode3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageContinuousErode3D/#download-and-build-imagecontinuouserode3d","title":"Download and Build ImageContinuousErode3D","text":"

Click here to download ImageContinuousErode3D and its CMakeLists.txt file. Once the tarball ImageContinuousErode3D.tar has been downloaded and extracted,

cd ImageContinuousErode3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageContinuousErode3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageConvolve/","title":"ImageConvolve","text":"

vtk-examples/Cxx/Images/ImageConvolve

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageConvolve/#code","title":"Code","text":"

ImageConvolve.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageConvolve.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> originalCastFilter;\n  originalCastFilter->SetInputConnection(source->GetOutputPort());\n  originalCastFilter->SetOutputScalarTypeToUnsignedChar();\n  originalCastFilter->Update();\n\n  vtkNew<vtkImageConvolve> convolveFilter;\n  convolveFilter->SetInputConnection(source->GetOutputPort());\n  double kernel[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1};\n  convolveFilter->SetKernel3x3(kernel);\n  convolveFilter->Update();\n\n  vtkNew<vtkImageCast> convolvedCastFilter;\n  convolvedCastFilter->SetInputConnection(convolveFilter->GetOutputPort());\n  convolvedCastFilter->SetOutputScalarTypeToUnsignedChar();\n  convolvedCastFilter->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(\n      originalCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> convolvedActor;\n  convolvedActor->GetMapper()->SetInputConnection(\n      convolvedCastFilter->GetOutputPort());\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderer\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(leftViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n  originalRenderer->ResetCamera();\n\n  vtkNew<vtkRenderer> convolvedRenderer;\n  convolvedRenderer->SetViewport(rightViewport);\n  convolvedRenderer->AddActor(convolvedActor);\n  convolvedRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n  convolvedRenderer->ResetCamera();\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(convolvedRenderer);\n  renderWindow->SetWindowName(\"ImageConvolve\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageConvolve/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageConvolve)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageConvolve: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageConvolve MACOSX_BUNDLE ImageConvolve.cxx )\n  target_link_libraries(ImageConvolve PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageConvolve\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageConvolve/#download-and-build-imageconvolve","title":"Download and Build ImageConvolve","text":"

Click here to download ImageConvolve and its CMakeLists.txt file. Once the tarball ImageConvolve.tar has been downloaded and extracted,

cd ImageConvolve/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageConvolve\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageCorrelation/","title":"ImageCorrelation","text":"

vtk-examples/Cxx/Images/ImageCorrelation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageCorrelation/#code","title":"Code","text":"

ImageCorrelation.cxx

#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageCast.h>\n#include <vtkImageCorrelation.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageShiftScale.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Black\").GetData();\n  auto color2 = colors->GetColor3ub(\"Wheat\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create an image\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 300, 0, 300, 0, 0);\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(0, 300, 0, 300);\n  imageSource->SetDrawColor(drawColor2.data());\n  imageSource->FillTriangle(10, 100, 190, 150, 40, 250);\n  imageSource->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  // Create a kernel\n  vtkNew<vtkImageCanvasSource2D> kernelSource;\n  kernelSource->SetNumberOfScalarComponents(3);\n  kernelSource->SetScalarTypeToUnsignedChar();\n  kernelSource->SetExtent(0, 30, 0, 30, 0, 0);\n  kernelSource->SetDrawColor(drawColor1.data());\n  kernelSource->FillBox(0, 30, 0, 30);\n  kernelSource->SetDrawColor(drawColor2.data());\n  kernelSource->FillTriangle(10, 1, 25, 10, 1, 5);\n  kernelSource->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> kernelActor;\n  kernelActor->GetMapper()->SetInputConnection(kernelSource->GetOutputPort());\n\n  // Compute the correlation\n  vtkNew<vtkImageCorrelation> correlationFilter;\n  correlationFilter->SetInputConnection(0, imageSource->GetOutputPort());\n  correlationFilter->SetInputConnection(1, kernelSource->GetOutputPort());\n  correlationFilter->Update();\n\n  // At this point, corr pixels are doubles\n  // So, get the scalar range\n  vtkImageData* corr = correlationFilter->GetOutput();\n  double corrRange[2];\n  corr->GetPointData()->GetScalars()->GetRange(corrRange);\n\n  // Rescale the correlation filter output. note that it implies\n  // that minimum correlation is always zero.\n  vtkNew<vtkImageShiftScale> imageScale;\n  imageScale->SetInputConnection(correlationFilter->GetOutputPort());\n  imageScale->SetScale(255 / corrRange[1]);\n  imageScale->SetOutputScalarTypeToUnsignedChar();\n  imageScale->Update();\n\n  vtkNew<vtkImageCast> correlationCastFilter;\n  correlationCastFilter->SetInputConnection(imageScale->GetOutputPort());\n  correlationCastFilter->SetOutputScalarTypeToUnsignedChar();\n  correlationCastFilter->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> correlationActor;\n  correlationActor->GetMapper()->SetInputConnection(\n      correlationCastFilter->GetOutputPort());\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double kernelViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double correlationViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> kernelRenderer;\n  kernelRenderer->SetViewport(kernelViewport);\n  kernelRenderer->AddActor(kernelActor);\n  kernelRenderer->ResetCamera();\n  kernelRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> correlationRenderer;\n  correlationRenderer->SetViewport(correlationViewport);\n  correlationRenderer->AddActor(correlationActor);\n  correlationRenderer->ResetCamera();\n  correlationRenderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(kernelRenderer);\n  renderWindow->AddRenderer(correlationRenderer);\n  renderWindow->SetWindowName(\"ImageCorrelation\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageCorrelation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageCorrelation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageCorrelation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageCorrelation MACOSX_BUNDLE ImageCorrelation.cxx )\n  target_link_libraries(ImageCorrelation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageCorrelation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageCorrelation/#download-and-build-imagecorrelation","title":"Download and Build ImageCorrelation","text":"

Click here to download ImageCorrelation and its CMakeLists.txt file. Once the tarball ImageCorrelation.tar has been downloaded and extracted,

cd ImageCorrelation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageCorrelation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageDifference/","title":"ImageDifference","text":"

vtk-examples/Cxx/Images/ImageDifference

"},{"location":"Cxx/Images/ImageDifference/#description","title":"Description","text":"

This example makes a large square and a smaller square and subtracts them, leaving the outline of a square.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageDifference/#code","title":"Code","text":"

ImageDifference.cxx

#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageDifference.h>\n#include <vtkImageMapper3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Black\").GetData();\n  auto color2 = colors->GetColor3ub(\"Wheat\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create an image\n  vtkNew<vtkImageCanvasSource2D> source1;\n  source1->SetScalarTypeToUnsignedChar();\n  source1->SetNumberOfScalarComponents(3);\n  source1->SetExtent(0, 100, 0, 100, 0, 0);\n  source1->SetDrawColor(drawColor1.data());\n  source1->FillBox(0, 100, 0, 100);\n  source1->SetDrawColor(drawColor2.data());\n  source1->FillBox(10, 90, 10, 90);\n  source1->Update();\n\n  // Create another image\n  vtkNew<vtkImageCanvasSource2D> source2;\n  source2->SetScalarTypeToUnsignedChar();\n  source2->SetNumberOfScalarComponents(3);\n  source2->SetExtent(0, 100, 0, 100, 0, 0);\n  source2->SetDrawColor(drawColor1.data());\n  source2->FillBox(0, 100, 0, 100);\n  source2->SetDrawColor(drawColor2.data());\n  source2->FillBox(20, 80, 20, 80);\n  source2->Update();\n\n  vtkNew<vtkImageDifference> differenceFilter;\n\n  differenceFilter->SetInputConnection(source1->GetOutputPort());\n  differenceFilter->SetImageConnection(source2->GetOutputPort());\n  differenceFilter->Update();\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  // Setup renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  vtkNew<vtkImageActor> leftActor;\n  leftActor->GetMapper()->SetInputConnection(source1->GetOutputPort());\n\n  leftRenderer->AddActor(leftActor);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  vtkNew<vtkImageActor> centerActor;\n  centerActor->GetMapper()->SetInputConnection(source2->GetOutputPort());\n\n  centerRenderer->AddActor(centerActor);\n  centerRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n  vtkNew<vtkImageActor> rightActor;\n  rightActor->GetMapper()->SetInputConnection(\n      differenceFilter->GetOutputPort());\n  rightRenderer->AddActor(rightActor);\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetSize(300, 100);\n  renderWindow->SetWindowName(\"ImageDifference\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageDifference/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDifference)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDifference: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDifference MACOSX_BUNDLE ImageDifference.cxx )\n  target_link_libraries(ImageDifference PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDifference\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageDifference/#download-and-build-imagedifference","title":"Download and Build ImageDifference","text":"

Click here to download ImageDifference and its CMakeLists.txt file. Once the tarball ImageDifference.tar has been downloaded and extracted,

cd ImageDifference/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageDifference\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageDilateErode3D/","title":"ImageDilateErode3D","text":"

vtk-examples/Cxx/Images/ImageDilateErode3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageDilateErode3D/#description","title":"Description","text":"

This example reads in a binary image and dilates one value and erodes another (morphological operations).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageDilateErode3D/#code","title":"Code","text":"

ImageDilateErode3D.cxx

#include <vtkImageActor.h>\n#include <vtkImageDilateErode3D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename.png e.g. Yinyang.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageDilateErode3D> dilateErode;\n  dilateErode->SetInputConnection(reader->GetOutputPort());\n  dilateErode->SetDilateValue(0);\n  dilateErode->SetErodeValue(255);\n  dilateErode->SetKernelSize(5, 5, 3);\n  dilateErode->ReleaseDataFlagOff();\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> openCloseActor;\n  openCloseActor->GetMapper()->SetInputConnection(dilateErode->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double openCloseViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> dilateErodeRenderer;\n  dilateErodeRenderer->SetViewport(openCloseViewport);\n  dilateErodeRenderer->AddActor(openCloseActor);\n  dilateErodeRenderer->ResetCamera();\n  dilateErodeRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(dilateErodeRenderer);\n  renderWindow->SetWindowName(\"ImageDilateErode3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageDilateErode3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDilateErode3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingMorphological\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDilateErode3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDilateErode3D MACOSX_BUNDLE ImageDilateErode3D.cxx )\n  target_link_libraries(ImageDilateErode3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDilateErode3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageDilateErode3D/#download-and-build-imagedilateerode3d","title":"Download and Build ImageDilateErode3D","text":"

Click here to download ImageDilateErode3D and its CMakeLists.txt file. Once the tarball ImageDilateErode3D.tar has been downloaded and extracted,

cd ImageDilateErode3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageDilateErode3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageDivergence/","title":"ImageDivergence","text":"

vtk-examples/Cxx/Images/ImageDivergence

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageDivergence/#code","title":"Code","text":"

ImageDivergence.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageDivergence.h>\n#include <vtkImageGradient.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> originalCastFilter;\n  originalCastFilter->SetInputConnection(source->GetOutputPort());\n  originalCastFilter->SetOutputScalarTypeToFloat();\n  originalCastFilter->Update();\n\n  // Compute the gradient (to produce a vector field).\n  vtkNew<vtkImageGradient> gradientFilter;\n  gradientFilter->SetInputConnection(source->GetOutputPort());\n  gradientFilter->Update();\n\n  vtkNew<vtkImageDivergence> divergenceFilter;\n  divergenceFilter->SetInputConnection(gradientFilter->GetOutputPort());\n  divergenceFilter->Update();\n\n  vtkNew<vtkImageCast> divergenceCastFilter;\n  divergenceCastFilter->SetInputConnection(divergenceFilter->GetOutputPort());\n  divergenceCastFilter->SetOutputScalarTypeToFloat();\n  divergenceCastFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(\n      originalCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> divergenceActor;\n  divergenceActor->GetMapper()->SetInputConnection(\n      divergenceCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(leftViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> divergenceRenderer;\n  divergenceRenderer->SetViewport(rightViewport);\n  divergenceRenderer->AddActor(divergenceActor);\n  divergenceRenderer->ResetCamera();\n  divergenceRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(divergenceRenderer);\n  renderWindow->SetWindowName(\"ImageDivergence\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageDivergence/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDivergence)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDivergence: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDivergence MACOSX_BUNDLE ImageDivergence.cxx )\n  target_link_libraries(ImageDivergence PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDivergence\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageDivergence/#download-and-build-imagedivergence","title":"Download and Build ImageDivergence","text":"

Click here to download ImageDivergence and its CMakeLists.txt file. Once the tarball ImageDivergence.tar has been downloaded and extracted,

cd ImageDivergence/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageDivergence\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageEllipsoidSource/","title":"ImageEllipsoidSource","text":"

vtk-examples/Cxx/Images/ImageEllipsoidSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageEllipsoidSource/#code","title":"Code","text":"

ImageEllipsoidSource.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 5);\n  source->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageEllipsoidSource\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageEllipsoidSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageEllipsoidSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageEllipsoidSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageEllipsoidSource MACOSX_BUNDLE ImageEllipsoidSource.cxx )\n  target_link_libraries(ImageEllipsoidSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageEllipsoidSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageEllipsoidSource/#download-and-build-imageellipsoidsource","title":"Download and Build ImageEllipsoidSource","text":"

Click here to download ImageEllipsoidSource and its CMakeLists.txt file. Once the tarball ImageEllipsoidSource.tar has been downloaded and extracted,

cd ImageEllipsoidSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageEllipsoidSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageExport/","title":"ImageExport","text":"

vtk-examples/Cxx/Images/ImageExport

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageExport/#code","title":"Code","text":"

ImageExport.cxx

#include <vtkImageData.h>\n#include <vtkImageExport.h>\n#include <vtkNew.h>\n\n#include <memory>\n\nint main(int, char*[])\n{\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  constexpr int dims[3] = {2, 3, 1};\n\n  imageData->SetDimensions(dims[0], dims[1], dims[2]);\n  imageData->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  unsigned char value = 0;\n  for (int row = 0; row < dims[0]; ++row)\n  {\n    for (int col = 0; col < dims[1]; ++col)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(imageData->GetScalarPointer(row, col, 0));\n      pixel[0] = value;\n      value += 10;\n    }\n  }\n\n  // Create the c-style image to convert the VTK image to\n  std::unique_ptr<unsigned char> cImage(\n      new unsigned char[dims[0] * dims[1] * dims[2]]);\n\n  vtkNew<vtkImageExport> exporter;\n  exporter->SetInputData(imageData);\n  exporter->ImageLowerLeftOn();\n  exporter->Export(cImage.get());\n  exporter->Update();\n\n  // Output the raw c-style image\n  for (int row = 0; row < dims[0]; ++row)\n  {\n    for (int col = 0; col < dims[1]; ++col)\n    {\n      std::cout << static_cast<int>(cImage.get()[col * dims[0] + row]) << \" \";\n    }\n    std::cout << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageExport/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageExport)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageExport: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageExport MACOSX_BUNDLE ImageExport.cxx )\n  target_link_libraries(ImageExport PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageExport\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageExport/#download-and-build-imageexport","title":"Download and Build ImageExport","text":"

Click here to download ImageExport and its CMakeLists.txt file. Once the tarball ImageExport.tar has been downloaded and extracted,

cd ImageExport/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageExport\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageFFT/","title":"ImageFFT","text":"

vtk-examples/Cxx/Images/ImageFFT

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageFFT/#code","title":"Code","text":"

ImageFFT.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageFFT.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageFFT> fftFilter;\n  fftFilter->SetInputConnection(source->GetOutputPort());\n  fftFilter->Update();\n\n  vtkNew<vtkImageCast> fftCastFilter;\n  fftCastFilter->SetInputConnection(fftFilter->GetOutputPort());\n  fftCastFilter->SetOutputScalarTypeToUnsignedChar();\n  fftCastFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> fftActor;\n  fftActor->GetMapper()->SetInputConnection(fftCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double fftViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(.4, .5, .6);\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> fftRenderer;\n  fftRenderer->SetViewport(fftViewport);\n  fftRenderer->AddActor(fftActor);\n  fftRenderer->ResetCamera();\n  fftRenderer->SetBackground(.4, .5, .7);\n  fftRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(fftRenderer);\n  renderWindow->SetWindowName(\"ImageFFT\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageFFT/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageFFT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingFourier\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageFFT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageFFT MACOSX_BUNDLE ImageFFT.cxx )\n  target_link_libraries(ImageFFT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageFFT\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageFFT/#download-and-build-imagefft","title":"Download and Build ImageFFT","text":"

Click here to download ImageFFT and its CMakeLists.txt file. Once the tarball ImageFFT.tar has been downloaded and extracted,

cd ImageFFT/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageFFT\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageGaussianSmooth/","title":"ImageGaussianSmooth","text":"

vtk-examples/Cxx/Images/ImageGaussianSmooth

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageGaussianSmooth/#code","title":"Code","text":"

ImageGaussianSmooth.cxx

#include <vtkImageActor.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageGaussianSmooth> gaussianSmoothFilter;\n  gaussianSmoothFilter->SetInputConnection(source->GetOutputPort());\n  gaussianSmoothFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> smoothedActor;\n  smoothedActor->GetMapper()->SetInputConnection(\n      gaussianSmoothFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double smoothedViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> gradientMagnitudeRenderer;\n  gradientMagnitudeRenderer->SetViewport(smoothedViewport);\n  gradientMagnitudeRenderer->AddActor(smoothedActor);\n  gradientMagnitudeRenderer->ResetCamera();\n  gradientMagnitudeRenderer->SetBackground(\n      colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(gradientMagnitudeRenderer);\n  renderWindow->SetWindowName(\"ImageGaussianSmooth\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageGaussianSmooth/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageGaussianSmooth)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageGaussianSmooth: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageGaussianSmooth MACOSX_BUNDLE ImageGaussianSmooth.cxx )\n  target_link_libraries(ImageGaussianSmooth PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageGaussianSmooth\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageGaussianSmooth/#download-and-build-imagegaussiansmooth","title":"Download and Build ImageGaussianSmooth","text":"

Click here to download ImageGaussianSmooth and its CMakeLists.txt file. Once the tarball ImageGaussianSmooth.tar has been downloaded and extracted,

cd ImageGaussianSmooth/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageGaussianSmooth\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageGradientMagnitude/","title":"ImageGradientMagnitude","text":"

vtk-examples/Cxx/Images/ImageGradientMagnitude

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageGradientMagnitude/#code","title":"Code","text":"

ImageGradientMagnitude.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageGradientMagnitude.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageGradientMagnitude> gradientMagnitudeFilter;\n  gradientMagnitudeFilter->SetInputConnection(source->GetOutputPort());\n  gradientMagnitudeFilter->Update();\n\n  vtkNew<vtkImageCast> gradientMagnitudeCastFilter;\n  gradientMagnitudeCastFilter->SetInputConnection(\n      gradientMagnitudeFilter->GetOutputPort());\n  gradientMagnitudeCastFilter->SetOutputScalarTypeToUnsignedChar();\n  gradientMagnitudeCastFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> gradientMagnitudeActor;\n  gradientMagnitudeActor->GetMapper()->SetInputConnection(\n      gradientMagnitudeCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double gradientMagnitudeViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> gradientMagnitudeRenderer;\n  gradientMagnitudeRenderer->SetViewport(gradientMagnitudeViewport);\n  gradientMagnitudeRenderer->AddActor(gradientMagnitudeActor);\n  gradientMagnitudeRenderer->ResetCamera();\n  gradientMagnitudeRenderer->SetBackground(\n      colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(gradientMagnitudeRenderer);\n  renderWindow->SetWindowName(\"ImageGradientMagnitude\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageGradientMagnitude/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageGradientMagnitude)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageGradientMagnitude: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageGradientMagnitude MACOSX_BUNDLE ImageGradientMagnitude.cxx )\n  target_link_libraries(ImageGradientMagnitude PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageGradientMagnitude\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageGradientMagnitude/#download-and-build-imagegradientmagnitude","title":"Download and Build ImageGradientMagnitude","text":"

Click here to download ImageGradientMagnitude and its CMakeLists.txt file. Once the tarball ImageGradientMagnitude.tar has been downloaded and extracted,

cd ImageGradientMagnitude/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageGradientMagnitude\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageGridSource/","title":"ImageGridSource","text":"

vtk-examples/Cxx/Images/ImageGridSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageGridSource/#code","title":"Code","text":"

ImageGridSource.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageGridSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageGridSource> source;\n  source->SetFillValue(122);\n  source->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageGridSource\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageGridSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageGridSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageGridSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageGridSource MACOSX_BUNDLE ImageGridSource.cxx )\n  target_link_libraries(ImageGridSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageGridSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageGridSource/#download-and-build-imagegridsource","title":"Download and Build ImageGridSource","text":"

Click here to download ImageGridSource and its CMakeLists.txt file. Once the tarball ImageGridSource.tar has been downloaded and extracted,

cd ImageGridSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageGridSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageHistogram/","title":"ImageHistogram","text":"

vtk-examples/Cxx/Images/ImageHistogram

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageHistogram/#code","title":"Code","text":"

ImageHistogram.cxx

#include <vtkCamera.h>\n#include <vtkImageData.h>\n#include <vtkImageHistogram.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename e.g. Pileated.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkInteractorStyle> style;\n  vtkNew<vtkRenderWindow> renWin;\n  iren->SetRenderWindow(renWin);\n  iren->SetInteractorStyle(style);\n\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageHistogram> histogram;\n  histogram->SetInputConnection(reader->GetOutputPort());\n  histogram->GenerateHistogramImageOn();\n  histogram->SetHistogramImageSize(256, 256);\n  histogram->SetHistogramImageScaleToSqrt();\n  histogram->AutomaticBinningOn();\n  histogram->Update();\n\n  vtkIdType nbins = histogram->GetNumberOfBins();\n  double range[2];\n  range[0] = histogram->GetBinOrigin();\n  range[1] = range[0] + (nbins - 1) * histogram->GetBinSpacing();\n\n  for (int i = 0; i < 2; i++)\n  {\n    vtkNew<vtkRenderer> renderer;\n    vtkCamera* camera = renderer->GetActiveCamera();\n    renderer->SetViewport(0.5 * (i & 1), 0.0, 0.5 + 0.5 * (i & 1), 1.0);\n    renWin->AddRenderer(renderer);\n\n    vtkNew<vtkImageSliceMapper> imageMapper;\n    // compute y range\n    double yd;\n    if ((i & 1) == 0)\n    {\n      imageMapper->SetInputConnection(reader->GetOutputPort());\n      int extent[6];\n      reader->GetOutput()->GetExtent(extent);\n      yd = (extent[3] - extent[2] + 1);\n    }\n    else\n    {\n      imageMapper->SetInputConnection(histogram->GetOutputPort());\n      imageMapper->BorderOn();\n      int extent[6];\n      histogram->GetOutput()->GetExtent(extent);\n      yd = (extent[3] - extent[2] + 1);\n    }\n\n    const double* bounds = imageMapper->GetBounds();\n    double point[3];\n    point[0] = 0.5 * (bounds[0] + bounds[1]);\n    point[1] = 0.5 * (bounds[2] + bounds[3]);\n    point[2] = 0.5 * (bounds[4] + bounds[5]);\n\n    camera->SetFocalPoint(point);\n    point[imageMapper->GetOrientation()] += 1000;\n    camera->SetPosition(point);\n    camera->SetViewUp(0.0, 1.0, 0.0);\n    camera->ParallelProjectionOn();\n    // Set scale so that vertical dimension fills the window\n    camera->SetParallelScale(0.5 * yd);\n\n    vtkNew<vtkImageSlice> image;\n    image->SetMapper(imageMapper);\n\n    renderer->AddViewProp(image);\n\n    if ((i & 1) == 0)\n    {\n      image->GetProperty()->SetColorWindow(range[1] - range[0]);\n      image->GetProperty()->SetColorLevel(0.5 * (range[0] + range[1]));\n    }\n    else\n    {\n      image->GetProperty()->SetInterpolationTypeToNearest();\n      image->GetProperty()->SetColorWindow(255.0);\n      image->GetProperty()->SetColorLevel(127.5);\n    }\n  }\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ImageHistogram\");\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageHistogram/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageHistogram)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingStatistics\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageHistogram: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageHistogram MACOSX_BUNDLE ImageHistogram.cxx )\n  target_link_libraries(ImageHistogram PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageHistogram\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageHistogram/#download-and-build-imagehistogram","title":"Download and Build ImageHistogram","text":"

Click here to download ImageHistogram and its CMakeLists.txt file. Once the tarball ImageHistogram.tar has been downloaded and extracted,

cd ImageHistogram/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageHistogram\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageHybridMedian2D/","title":"ImageHybridMedian2D","text":"

vtk-examples/Cxx/Images/ImageHybridMedian2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageHybridMedian2D/#description","title":"Description","text":"

This example reads in an image and performs median filtering on it. The input and output are displayed.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageHybridMedian2D/#code","title":"Code","text":"

ImageHybridMedian2D.cxx

#include <vtkImageActor.h>\n#include <vtkImageHybridMedian2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename.png e.g Gourds.png\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageHybridMedian2D> hybridMedian;\n  hybridMedian->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> hybridMedianActor;\n  hybridMedianActor->GetMapper()->SetInputConnection(\n      hybridMedian->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double hybridMedianViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> hybridMedianRenderer;\n  hybridMedianRenderer->SetViewport(hybridMedianViewport);\n  hybridMedianRenderer->AddActor(hybridMedianActor);\n  hybridMedianRenderer->ResetCamera();\n  hybridMedianRenderer->SetBackground(\n      colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(hybridMedianRenderer);\n  renderWindow->SetWindowName(\"ImageHybridMedian2D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageHybridMedian2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageHybridMedian2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageHybridMedian2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageHybridMedian2D MACOSX_BUNDLE ImageHybridMedian2D.cxx )\n  target_link_libraries(ImageHybridMedian2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageHybridMedian2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageHybridMedian2D/#download-and-build-imagehybridmedian2d","title":"Download and Build ImageHybridMedian2D","text":"

Click here to download ImageHybridMedian2D and its CMakeLists.txt file. Once the tarball ImageHybridMedian2D.tar has been downloaded and extracted,

cd ImageHybridMedian2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageHybridMedian2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageIdealHighPass/","title":"ImageIdealHighPass","text":"

vtk-examples/Cxx/Images/ImageIdealHighPass

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageIdealHighPass/#code","title":"Code","text":"

ImageIdealHighPass.cxx

#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageFFT.h>\n#include <vtkImageIdealHighPass.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageRFFT.h>\n#include <vtkImageShiftScale.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageMandelbrotSource> mandelbrotSource;\n  mandelbrotSource->Update();\n\n  // Display the original image\n  vtkNew<vtkImageCast> originalCastFilter;\n  originalCastFilter->SetInputConnection(mandelbrotSource->GetOutputPort());\n  originalCastFilter->SetOutputScalarTypeToUnsignedChar();\n  originalCastFilter->Update();\n\n  vtkNew<vtkImageSliceMapper> originalSliceMapper;\n  originalSliceMapper->SetInputConnection(originalCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageSlice> originalSlice;\n  originalSlice->SetMapper(originalSliceMapper);\n\n  // Compute the FFT of the image\n  vtkNew<vtkImageFFT> fftFilter;\n  fftFilter->SetInputConnection(originalCastFilter->GetOutputPort());\n  fftFilter->Update();\n\n  // High pass filter the FFT\n  vtkNew<vtkImageIdealHighPass> highPassFilter;\n  highPassFilter->SetInputConnection(fftFilter->GetOutputPort());\n  highPassFilter->SetXCutOff(.1);\n  highPassFilter->SetYCutOff(.1);\n  highPassFilter->Update();\n\n  // Compute the IFFT of the high pass filtered image\n  vtkNew<vtkImageRFFT> rfftFilter;\n  rfftFilter->SetInputConnection(highPassFilter->GetOutputPort());\n  rfftFilter->Update();\n\n  vtkNew<vtkImageExtractComponents> extractRealFilter;\n  extractRealFilter->SetInputConnection(rfftFilter->GetOutputPort());\n  extractRealFilter->SetComponents(0);\n  extractRealFilter->Update();\n\n  vtkNew<vtkImageShiftScale> shiftScaleFilter;\n  shiftScaleFilter->SetOutputScalarTypeToUnsignedChar();\n  shiftScaleFilter->SetInputConnection(extractRealFilter->GetOutputPort());\n  shiftScaleFilter->SetShift(\n      -1.0f *\n      extractRealFilter->GetOutput()\n          ->GetScalarRange()[0]); // brings the lower bound to 0\n  float oldRange = extractRealFilter->GetOutput()->GetScalarRange()[1] -\n      extractRealFilter->GetOutput()->GetScalarRange()[0];\n  float newRange =\n      100; // We want the output [0,100] (the same as the original image)\n  shiftScaleFilter->SetScale(newRange / oldRange);\n  shiftScaleFilter->Update();\n\n  // Cast the output back to unsigned char\n  vtkNew<vtkImageCast> outputCastFilter;\n  outputCastFilter->SetInputConnection(shiftScaleFilter->GetOutputPort());\n  outputCastFilter->SetOutputScalarTypeToUnsignedChar();\n  outputCastFilter->Update();\n\n  // Display the high pass filtered image\n  vtkNew<vtkImageSliceMapper> highPassSliceMapper;\n  highPassSliceMapper->SetInputConnection(outputCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageSlice> highPassSlice;\n  highPassSlice->SetMapper(highPassSliceMapper);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double highPassViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddViewProp(originalSlice);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(.4, .5, .6);\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> highPassRenderer;\n  highPassRenderer->SetViewport(highPassViewport);\n  highPassRenderer->AddViewProp(highPassSlice);\n  highPassRenderer->ResetCamera();\n  highPassRenderer->SetBackground(.4, .5, .7);\n  highPassRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(highPassRenderer);\n  renderWindow->SetWindowName(\"ImageIdealHighPass\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageIdealHighPass/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageIdealHighPass)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingFourier\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageIdealHighPass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageIdealHighPass MACOSX_BUNDLE ImageIdealHighPass.cxx )\n  target_link_libraries(ImageIdealHighPass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageIdealHighPass\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageIdealHighPass/#download-and-build-imageidealhighpass","title":"Download and Build ImageIdealHighPass","text":"

Click here to download ImageIdealHighPass and its CMakeLists.txt file. Once the tarball ImageIdealHighPass.tar has been downloaded and extracted,

cd ImageIdealHighPass/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageIdealHighPass\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageImport/","title":"ImageImport","text":"

vtk-examples/Cxx/Images/ImageImport

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageImport/#code","title":"Code","text":"

ImageImport.cxx

#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageImport.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLImageDataWriter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a c-style image\n  constexpr int width = 4;\n  constexpr int height = 4;\n\n  unsigned char cImage[width * height];\n  unsigned char value = 0;\n  for (unsigned int row = 0; row < height; ++row)\n  {\n    for (unsigned int col = 0; col < width; ++col)\n    {\n      cImage[row * width + col] = value;\n      value += 10;\n    }\n  }\n\n  // Convert the c-style image to a vtkImageData\n  vtkNew<vtkImageImport> imageImport;\n  imageImport->SetDataSpacing(1, 1, 1);\n  imageImport->SetDataOrigin(0, 0, 0);\n  imageImport->SetWholeExtent(0, width - 1, 0, height - 1, 0, 0);\n  imageImport->SetDataExtentToWholeExtent();\n  imageImport->SetDataScalarTypeToUnsignedChar();\n  imageImport->SetNumberOfScalarComponents(1);\n  imageImport->SetImportVoidPointer(cImage);\n  imageImport->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> actor;\n  actor->SetInputData(imageImport->GetOutput());\n\n  // Setup renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SaddleBrown\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageImport\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageImport/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageImport)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageImport: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageImport MACOSX_BUNDLE ImageImport.cxx )\n  target_link_libraries(ImageImport PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageImport\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageImport/#download-and-build-imageimport","title":"Download and Build ImageImport","text":"

Click here to download ImageImport and its CMakeLists.txt file. Once the tarball ImageImport.tar has been downloaded and extracted,

cd ImageImport/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageImport\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageIslandRemoval2D/","title":"ImageIslandRemoval2D","text":"

vtk-examples/Cxx/Images/ImageIslandRemoval2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageIslandRemoval2D/#description","title":"Description","text":"

This example creates a small white square and a big white square. We want the ImageIslandRemoval2D to turn the small white square black and leave the big white square alone.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageIslandRemoval2D/#code","title":"Code","text":"

ImageIslandRemoval2D.cxx

#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageIslandRemoval2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetNumberOfScalarComponents(1);\n  imageSource->SetExtent(0, 200, 0, 200, 0, 0);\n\n  // Blank the image\n  imageSource->SetDrawColor(0.0);\n  imageSource->FillBox(0, 200, 0, 200);\n\n  // Draw a small box\n  imageSource->SetDrawColor(255.0);\n  imageSource->FillBox(100, 105, 100, 105);\n\n  // Draw a large box\n  imageSource->SetDrawColor(255.0);\n  imageSource->FillBox(150, 170, 150, 170);\n\n  imageSource->Update();\n\n  vtkNew<vtkImageIslandRemoval2D> islandRemovalFilter;\n  islandRemovalFilter->SetAreaThreshold(50);\n  islandRemovalFilter->SetIslandValue(255.0);\n  islandRemovalFilter->SetReplaceValue(0.0);\n  islandRemovalFilter->SetInputConnection(imageSource->GetOutputPort());\n  islandRemovalFilter->Update();\n\n  // Visualize\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> islandRemovalActor;\n  islandRemovalActor->GetMapper()->SetInputConnection(\n      islandRemovalFilter->GetOutputPort());\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double islandRemovalViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> islandRemovalRenderer;\n  islandRemovalRenderer->SetViewport(islandRemovalViewport);\n  islandRemovalRenderer->AddActor(islandRemovalActor);\n  islandRemovalRenderer->ResetCamera();\n  islandRemovalRenderer->SetBackground(\n      colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(islandRemovalRenderer);\n  renderWindow->SetWindowName(\"ImageIslandRemoval2D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageIslandRemoval2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageIslandRemoval2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingMorphological\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageIslandRemoval2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageIslandRemoval2D MACOSX_BUNDLE ImageIslandRemoval2D.cxx )\n  target_link_libraries(ImageIslandRemoval2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageIslandRemoval2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageIslandRemoval2D/#download-and-build-imageislandremoval2d","title":"Download and Build ImageIslandRemoval2D","text":"

Click here to download ImageIslandRemoval2D and its CMakeLists.txt file. Once the tarball ImageIslandRemoval2D.tar has been downloaded and extracted,

cd ImageIslandRemoval2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageIslandRemoval2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageLaplacian/","title":"ImageLaplacian","text":"

vtk-examples/Cxx/Images/ImageLaplacian

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageLaplacian/#code","title":"Code","text":"

ImageLaplacian.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageLaplacian.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> castOriginal;\n  castOriginal->SetInputConnection(source->GetOutputPort());\n  castOriginal->SetOutputScalarTypeToFloat();\n  castOriginal->Update();\n\n  vtkNew<vtkImageLaplacian> laplacianFilter;\n  laplacianFilter->SetInputConnection(source->GetOutputPort());\n  laplacianFilter->Update();\n\n  vtkNew<vtkImageCast> castLaplacian;\n  castLaplacian->SetInputConnection(laplacianFilter->GetOutputPort());\n  castLaplacian->SetOutputScalarTypeToFloat();\n  castLaplacian->Update();\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(castOriginal->GetOutputPort());\n\n  vtkNew<vtkImageActor> laplacianActor;\n  laplacianActor->GetMapper()->SetInputConnection(\n      castLaplacian->GetOutputPort());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"ImageLaplacian\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(leftViewport);\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> laplacianRenderer;\n  laplacianRenderer->SetViewport(rightViewport);\n  laplacianRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(laplacianRenderer);\n\n  originalRenderer->AddActor(originalActor);\n  laplacianRenderer->AddActor(laplacianActor);\n\n  originalRenderer->ResetCamera();\n  laplacianRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageLaplacian/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageLaplacian)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageLaplacian: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageLaplacian MACOSX_BUNDLE ImageLaplacian.cxx )\n  target_link_libraries(ImageLaplacian PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageLaplacian\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageLaplacian/#download-and-build-imagelaplacian","title":"Download and Build ImageLaplacian","text":"

Click here to download ImageLaplacian and its CMakeLists.txt file. Once the tarball ImageLaplacian.tar has been downloaded and extracted,

cd ImageLaplacian/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageLaplacian\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageLuminance/","title":"ImageLuminance","text":"

vtk-examples/Cxx/Images/ImageLuminance

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageLuminance/#description","title":"Description","text":"

There are two ways to convert images to greyscale:

  • vtkImageLuminance uses the luminance equation for properly weighting the R, G, and B components;

  • vtkImageMagnitude does a simple sum-of-squares computation of the components (i.e. the Euclidean norm -- not the quadratic mean!), and is meant for vector data.

For an example of usage of the vtkImageMagnitude filter, see ImageMagnitude.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageLuminance/#code","title":"Code","text":"

ImageLuminance.cxx

#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageLuminance.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image of a rectangle.\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 200, 0, 200, 0, 0);\n\n  // Clear the image.\n  source->SetDrawColor(0, 0, 0);\n  source->FillBox(0, 200, 0, 200);\n\n  // Draw a red box.\n  source->SetDrawColor(255, 0, 0);\n  source->FillBox(100, 120, 100, 120);\n  source->Update();\n\n  vtkNew<vtkImageLuminance> luminanceFilter;\n  luminanceFilter->SetInputConnection(source->GetOutputPort());\n  luminanceFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> luminanceActor;\n  luminanceActor->GetMapper()->SetInputConnection(\n      luminanceFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double luminanceViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> luminanceRenderer;\n  luminanceRenderer->SetViewport(luminanceViewport);\n  luminanceRenderer->AddActor(luminanceActor);\n  luminanceRenderer->ResetCamera();\n  luminanceRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(luminanceRenderer);\n  renderWindow->SetWindowName(\"ImageLuminance\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageLuminance/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageLuminance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingColor\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageLuminance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageLuminance MACOSX_BUNDLE ImageLuminance.cxx )\n  target_link_libraries(ImageLuminance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageLuminance\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageLuminance/#download-and-build-imageluminance","title":"Download and Build ImageLuminance","text":"

Click here to download ImageLuminance and its CMakeLists.txt file. Once the tarball ImageLuminance.tar has been downloaded and extracted,

cd ImageLuminance/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageLuminance\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageMagnify/","title":"ImageMagnify","text":"

vtk-examples/Cxx/Images/ImageMagnify

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageMagnify/#description","title":"Description","text":"

vtkImageMagnify increases the dimensions of an image by integral magnification factors. It also adjusts the spacing of the pixels so that the magnified image covers the same region as the original image. To stretch the image, the pixel spacing needs to be adjusted. This example uses vtkImageChangeInformation to modify the magnified image's spacing. The result is an image that has increased numbers of pixels and is stretched in the magnified directions.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageMagnify/#code","title":"Code","text":"

ImageMagnify.cxx

#include <vtkImageActor.h>\n#include <vtkImageChangeInformation.h>\n#include <vtkImageMagnify.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename.png e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Increase the dimensions of the image.\n  vtkNew<vtkImageMagnify> magnifyFilter;\n  magnifyFilter->SetInputConnection(reader->GetOutputPort());\n  magnifyFilter->SetMagnificationFactors(2, 1, 1);\n  magnifyFilter->Update();\n\n  // Adjust the spacing of the magnified image. This will stretch the\n  // image.\n  vtkNew<vtkImageChangeInformation> changeFilter;\n  changeFilter->SetInputConnection(magnifyFilter->GetOutputPort());\n  changeFilter->SetSpacingScale(magnifyFilter->GetMagnificationFactors()[0],\n                                magnifyFilter->GetMagnificationFactors()[1],\n                                magnifyFilter->GetMagnificationFactors()[2]);\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> magnifiedActor;\n  magnifiedActor->GetMapper()->SetInputConnection(\n      changeFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double magnifiedViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> magnifiedRenderer;\n  magnifiedRenderer->SetViewport(magnifiedViewport);\n  magnifiedRenderer->AddActor(magnifiedActor);\n  magnifiedRenderer->ResetCamera();\n  magnifiedRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(magnifiedRenderer);\n  renderWindow->SetWindowName(\"ImageMagnify\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageMagnify/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMagnify)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMagnify: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMagnify MACOSX_BUNDLE ImageMagnify.cxx )\n  target_link_libraries(ImageMagnify PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMagnify\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageMagnify/#download-and-build-imagemagnify","title":"Download and Build ImageMagnify","text":"

Click here to download ImageMagnify and its CMakeLists.txt file. Once the tarball ImageMagnify.tar has been downloaded and extracted,

cd ImageMagnify/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageMagnify\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageMagnitude/","title":"ImageMagnitude","text":"

vtk-examples/Cxx/Images/ImageMagnitude

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageMagnitude/#description","title":"Description","text":"

There are two ways to convert images to greyscale: * vtkImageLuminance uses the [luminance equation](http://www.wikipedia.org/wiki/Luma_(video) for properly weighting the R, G, and B components; * vtkImageMagnitude does a simple sum-of-squares computation of the components (i.e. the Euclidean norm -- not the quadratic mean, and is meant for vector data.

For an example of usage of the vtkImageLuminance filter, see ImageLuminance.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageMagnitude/#code","title":"Code","text":"

ImageMagnitude.cxx

#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMagnitude.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image of a rectangle.\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 200, 0, 200, 0, 0);\n\n  // Clear the image.\n  source->SetDrawColor(0, 0, 0);\n  source->FillBox(0, 200, 0, 200);\n\n  // Draw a red box.\n  source->SetDrawColor(255, 0, 0);\n  source->FillBox(100, 120, 100, 120);\n  source->Update();\n\n  vtkNew<vtkImageMagnitude> magnitudeFilter;\n  magnitudeFilter->SetInputConnection(source->GetOutputPort());\n  magnitudeFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> magnitudeActor;\n  magnitudeActor->GetMapper()->SetInputConnection(\n      magnitudeFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double magnitudeViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> magnitudeRenderer;\n  magnitudeRenderer->SetViewport(magnitudeViewport);\n  magnitudeRenderer->AddActor(magnitudeActor);\n  magnitudeRenderer->ResetCamera();\n  magnitudeRenderer->SetBackground(.4, .5, .7);\n  magnitudeRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(magnitudeRenderer);\n  renderWindow->SetWindowName(\"ImageMagnitude\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageMagnitude/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMagnitude)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMagnitude: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMagnitude MACOSX_BUNDLE ImageMagnitude.cxx )\n  target_link_libraries(ImageMagnitude PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMagnitude\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageMagnitude/#download-and-build-imagemagnitude","title":"Download and Build ImageMagnitude","text":"

Click here to download ImageMagnitude and its CMakeLists.txt file. Once the tarball ImageMagnitude.tar has been downloaded and extracted,

cd ImageMagnitude/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageMagnitude\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageMandelbrotSource/","title":"ImageMandelbrotSource","text":"

vtk-examples/Cxx/Images/ImageMandelbrotSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageMandelbrotSource/#code","title":"Code","text":"

ImageMandelbrotSource.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SaddleBrown\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageMagnitude\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageMandelbrotSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMandelbrotSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMandelbrotSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMandelbrotSource MACOSX_BUNDLE ImageMandelbrotSource.cxx )\n  target_link_libraries(ImageMandelbrotSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMandelbrotSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageMandelbrotSource/#download-and-build-imagemandelbrotsource","title":"Download and Build ImageMandelbrotSource","text":"

Click here to download ImageMandelbrotSource and its CMakeLists.txt file. Once the tarball ImageMandelbrotSource.tar has been downloaded and extracted,

cd ImageMandelbrotSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageMandelbrotSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageMapToColors/","title":"ImageMapToColors","text":"

vtk-examples/Cxx/Images/ImageMapToColors

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageMapToColors/#code","title":"Code","text":"

ImageMapToColors.cxx

//\n// Displays a \"grayscale\" image as a full color image via the\n// vtkImageMapToColors filter, which uses a lookup table to\n// map scalar values to colors\n//\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageProperty.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a \"grayscale\" 16x16 image, 1-component pixels of type \"double\".\n  vtkNew<vtkImageData> image;\n  int imageExtent[6] = {0, 15, 0, 15, 0, 0};\n  image->SetExtent(imageExtent);\n  image->AllocateScalars(VTK_DOUBLE, 1);\n\n  double scalarvalue = 0.0;\n\n  for (int y = imageExtent[2]; y <= imageExtent[3]; y++)\n  {\n    for (int x = imageExtent[0]; x <= imageExtent[1]; x++)\n    {\n      double* pixel = static_cast<double*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = scalarvalue;\n      scalarvalue += 1.0;\n    }\n  }\n\n  // Map the scalar values in the image to colors with a lookup table:\n  vtkNew<vtkLookupTable> lookupTable;\n  lookupTable->SetNumberOfTableValues(256);\n  lookupTable->SetRange(0.0, 255.0);\n  lookupTable->Build();\n\n  // Pass the original image and the lookup table to a filter to create\n  // a color image:\n  vtkNew<vtkImageMapToColors> scalarValuesToColors;\n  scalarValuesToColors->SetLookupTable(lookupTable);\n  scalarValuesToColors->PassAlphaToOutputOn();\n  scalarValuesToColors->SetInputData(image);\n\n  // Create an image actor.\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputConnection(\n      scalarValuesToColors->GetOutputPort());\n  imageActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Visualize.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageActor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageMapToColors\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageMapToColors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMapToColors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMapToColors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMapToColors MACOSX_BUNDLE ImageMapToColors.cxx )\n  target_link_libraries(ImageMapToColors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMapToColors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageMapToColors/#download-and-build-imagemaptocolors","title":"Download and Build ImageMapToColors","text":"

Click here to download ImageMapToColors and its CMakeLists.txt file. Once the tarball ImageMapToColors.tar has been downloaded and extracted,

cd ImageMapToColors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageMapToColors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageMapper/","title":"ImageMapper","text":"

vtk-examples/Cxx/Images/ImageMapper

"},{"location":"Cxx/Images/ImageMapper/#description","title":"Description","text":"

This example demonstrates how to display an image in 2D. The size and position are in screen coordinates.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageMapper/#code","title":"Code","text":"

ImageMapper.cxx

#include <vtkActor2D.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nnamespace {\nvoid CreateColorImage(vtkImageData*);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> colorImage;\n  CreateColorImage(colorImage);\n\n  vtkNew<vtkImageMapper> imageMapper;\n  imageMapper->SetInputData(colorImage);\n  imageMapper->SetColorWindow(255);\n  imageMapper->SetColorLevel(127.5);\n\n  vtkNew<vtkActor2D> imageActor;\n  imageActor->SetMapper(imageMapper);\n  imageActor->SetPosition(20, 20);\n\n  // Setup renderers\n  vtkNew<vtkRenderer> renderer;\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageMapper\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // renderer->AddViewProp(imageActor);\n  renderer->AddActor2D(imageActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 3> drawColor1{0, 0, 0};\n  std::array<unsigned char, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"HotPink\").GetData();\n  auto color2 = colors->GetColor3ub(\"Chartreuse\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  unsigned int dim = 20;\n\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  for (unsigned int x = 0; x < dim; x++)\n  {\n    for (unsigned int y = 0; y < dim; y++)\n    {\n      auto pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      if (x < dim / 2)\n      {\n        for (auto i = 0; i < 3; ++i)\n        {\n          pixel[i] = drawColor1[i];\n        }\n      }\n      else\n      {\n        for (auto i = 0; i < 3; ++i)\n        {\n          pixel[i] = drawColor2[i];\n        }\n      }\n    }\n  }\n\n  image->Modified();\n}\n} // namespace\n
"},{"location":"Cxx/Images/ImageMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMapper MACOSX_BUNDLE ImageMapper.cxx )\n  target_link_libraries(ImageMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageMapper/#download-and-build-imagemapper","title":"Download and Build ImageMapper","text":"

Click here to download ImageMapper and its CMakeLists.txt file. Once the tarball ImageMapper.tar has been downloaded and extracted,

cd ImageMapper/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageMapper\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageMask/","title":"ImageMask","text":"

vtk-examples/Cxx/Images/ImageMask

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageMask/#description","title":"Description","text":"

This example creates an all red image. Then it creates a mask of a small rectangle. The red pixels in this rectangle are copied to the output image, while the rest of the output image is black. The black region could be set to a different color using SetMaskedOutputValue.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageMask/#code","title":"Code","text":"

ImageMask.cxx

#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMask.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image of a rectangle.\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 200, 0, 200, 0, 0);\n\n  // Create a red image.\n  source->SetDrawColor(255, 0, 0);\n  source->FillBox(0, 200, 0, 200);\n\n  source->Update();\n\n  // Create a rectanglular mask.\n  vtkNew<vtkImageCanvasSource2D> maskSource;\n  maskSource->SetScalarTypeToUnsignedChar();\n  maskSource->SetNumberOfScalarComponents(1);\n  maskSource->SetExtent(0, 200, 0, 200, 0, 0);\n\n  // Initialize the mask to black.\n  maskSource->SetDrawColor(0, 0, 0);\n  maskSource->FillBox(0, 200, 0, 200);\n\n  // Create a square.\n  maskSource->SetDrawColor(\n      255, 255,\n      255); // Anything non-zero means \"make the output\n            // pixel equal the input pixel\". If the mask is\n            // zero, the output pixel is set to MaskedValue.\n  maskSource->FillBox(100, 120, 100, 120);\n  maskSource->Update();\n\n  vtkNew<vtkImageMask> maskFilter;\n  maskFilter->SetInputConnection(0, source->GetOutputPort());\n  maskFilter->SetInputConnection(1, maskSource->GetOutputPort());\n  maskFilter->SetMaskedOutputValue(0, 1, 0);\n  maskFilter->Update();\n\n  vtkNew<vtkImageMask> inverseMaskFilter;\n  inverseMaskFilter->SetInputConnection(0, source->GetOutputPort());\n  inverseMaskFilter->SetInputConnection(1, maskSource->GetOutputPort());\n  inverseMaskFilter->SetMaskedOutputValue(0, 1, 0);\n  inverseMaskFilter->NotMaskOn();\n  inverseMaskFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> maskActor;\n  maskActor->GetMapper()->SetInputConnection(maskSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> maskedActor;\n  maskedActor->GetMapper()->SetInputConnection(maskFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> inverseMaskedActor;\n  inverseMaskedActor->GetMapper()->SetInputConnection(\n      inverseMaskFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double maskViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double maskedViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double inverseMaskedViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"SandyBrown\").GetData());\n\n  vtkNew<vtkRenderer> maskRenderer;\n  maskRenderer->SetViewport(maskViewport);\n  maskRenderer->AddActor(maskActor);\n  maskRenderer->ResetCamera();\n  maskRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> maskedRenderer;\n  maskedRenderer->SetViewport(maskedViewport);\n  maskedRenderer->AddActor(maskedActor);\n  maskedRenderer->ResetCamera();\n  maskedRenderer->SetBackground(colors->GetColor3d(\"SandyBrown\").GetData());\n\n  vtkNew<vtkRenderer> inverseMaskedRenderer;\n  inverseMaskedRenderer->SetViewport(inverseMaskedViewport);\n  inverseMaskedRenderer->AddActor(inverseMaskedActor);\n  inverseMaskedRenderer->ResetCamera();\n  inverseMaskedRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(maskRenderer);\n  renderWindow->AddRenderer(maskedRenderer);\n  renderWindow->AddRenderer(inverseMaskedRenderer);\n  renderWindow->SetWindowName(\"ImageMask\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageMask/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMask)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMask: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMask MACOSX_BUNDLE ImageMask.cxx )\n  target_link_libraries(ImageMask PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMask\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageMask/#download-and-build-imagemask","title":"Download and Build ImageMask","text":"

Click here to download ImageMask and its CMakeLists.txt file. Once the tarball ImageMask.tar has been downloaded and extracted,

cd ImageMask/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageMask\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageMathematics/","title":"ImageMathematics","text":"

vtk-examples/Cxx/Images/ImageMathematics

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageMathematics/#code","title":"Code","text":"

ImageMathematics.cxx

#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 4, 0, 4, 0, 0);\n  imageSource->SetDrawColor(100.0, 0, 0);\n  imageSource->FillBox(0, 4, 0, 4);\n  imageSource->Update();\n\n  vtkNew<vtkImageMathematics> imageMath;\n  imageMath->SetOperationToMultiplyByK();\n  imageMath->SetConstantK(2.0);\n  imageMath->SetInputConnection(imageSource->GetOutputPort());\n  imageMath->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> mathActor;\n  mathActor->GetMapper()->SetInputConnection(imageMath->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(leftViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> mathRenderer;\n  mathRenderer->SetViewport(rightViewport);\n  mathRenderer->AddActor(mathActor);\n  mathRenderer->ResetCamera();\n  mathRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(mathRenderer);\n  renderWindow->SetWindowName(\"ImageMathematics\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleImage> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageMathematics/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMathematics)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMathematics: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMathematics MACOSX_BUNDLE ImageMathematics.cxx )\n  target_link_libraries(ImageMathematics PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMathematics\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageMathematics/#download-and-build-imagemathematics","title":"Download and Build ImageMathematics","text":"

Click here to download ImageMathematics and its CMakeLists.txt file. Once the tarball ImageMathematics.tar has been downloaded and extracted,

cd ImageMathematics/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageMathematics\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageMedian3D/","title":"ImageMedian3D","text":"

vtk-examples/Cxx/Images/ImageMedian3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageMedian3D/#code","title":"Code","text":"

ImageMedian3D.cxx

#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMedian3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetNumberOfScalarComponents(1);\n  imageSource->SetScalarTypeToUnsignedChar();\n  unsigned int xmin = 0;\n  unsigned int xmax = 20;\n  unsigned int ymin = 0;\n  unsigned int ymax = 20;\n  imageSource->SetExtent(xmin, xmax, ymin, ymax, 0, 0);\n\n  // Make the image all black.\n  imageSource->SetDrawColor(0.0);\n  imageSource->FillBox(xmin, xmax, ymin, ymax);\n\n  // Draw a big white square.\n  imageSource->SetDrawColor(255.0);\n  imageSource->FillBox(5, 15, 5, 15);\n\n  // Add some single white pixels.\n  imageSource->SetDrawColor(255.0);\n  imageSource->FillBox(1, 1, 1, 1);\n  imageSource->FillBox(17, 17, 17, 17);\n\n  imageSource->Update();\n\n  vtkNew<vtkImageMedian3D> medianFilter;\n  medianFilter->SetInputConnection(imageSource->GetOutputPort());\n  medianFilter->SetKernelSize(3, 3, 1);\n  medianFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> medianActor;\n  medianActor->GetMapper()->SetInputConnection(medianFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(leftViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> gradientMagnitudeRenderer;\n  gradientMagnitudeRenderer->SetViewport(rightViewport);\n  gradientMagnitudeRenderer->AddActor(medianActor);\n  gradientMagnitudeRenderer->ResetCamera();\n  gradientMagnitudeRenderer->SetBackground(\n      colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(gradientMagnitudeRenderer);\n  renderWindow->SetWindowName(\"ImageMedian3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageMedian3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMedian3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMedian3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMedian3D MACOSX_BUNDLE ImageMedian3D.cxx )\n  target_link_libraries(ImageMedian3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMedian3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageMedian3D/#download-and-build-imagemedian3d","title":"Download and Build ImageMedian3D","text":"

Click here to download ImageMedian3D and its CMakeLists.txt file. Once the tarball ImageMedian3D.tar has been downloaded and extracted,

cd ImageMedian3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageMedian3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageMirrorPad/","title":"ImageMirrorPad","text":"

vtk-examples/Cxx/Images/ImageMirrorPad

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageMirrorPad/#description","title":"Description","text":"

This example shows how to enlarge an image and fill in the padded edges by mirroring the original pixels.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageMirrorPad/#code","title":"Code","text":"

ImageMirrorPad.cxx

#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMirrorPad.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkType.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetExtent(0, 20, 0, 20, 0, 0);\n  source->SetScalarTypeToUnsignedChar();\n  source->SetDrawColor(0.0, 0.0, 0.0, 1.0);\n  source->FillBox(-VTK_INT_MAX, VTK_INT_MAX, -VTK_INT_MAX, VTK_INT_MAX);\n  source->SetDrawColor(255.0, 0.0, 0.0, 0.5);\n  source->DrawCircle(10, 10, 5);\n  source->Update();\n\n  vtkNew<vtkImageMirrorPad> mirrorPadFilter;\n  mirrorPadFilter->SetInputConnection(source->GetOutputPort());\n  mirrorPadFilter->SetOutputWholeExtent(-10, 30, -10, 30, 0, 0);\n  mirrorPadFilter->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(mirrorPadFilter->GetOutputPort());\n\n  // Visualize.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageMirrorPad\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageMirrorPad/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMirrorPad)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMirrorPad: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMirrorPad MACOSX_BUNDLE ImageMirrorPad.cxx )\n  target_link_libraries(ImageMirrorPad PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMirrorPad\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageMirrorPad/#download-and-build-imagemirrorpad","title":"Download and Build ImageMirrorPad","text":"

Click here to download ImageMirrorPad and its CMakeLists.txt file. Once the tarball ImageMirrorPad.tar has been downloaded and extracted,

cd ImageMirrorPad/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageMirrorPad\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageNoiseSource/","title":"ImageNoiseSource","text":"

vtk-examples/Cxx/Images/ImageNoiseSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageNoiseSource/#code","title":"Code","text":"

ImageNoiseSource.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageNoiseSource.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image of noise.\n  vtkNew<vtkImageNoiseSource> noiseSource;\n  noiseSource->SetWholeExtent(0, 200, 0, 200, 0, 0);\n  noiseSource->SetMinimum(0.0);\n  noiseSource->SetMaximum(255.0);\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(noiseSource->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ImageNoiseSource\");\n\n  renderWindow->AddRenderer(renderer);\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageNoiseSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageNoiseSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageNoiseSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageNoiseSource MACOSX_BUNDLE ImageNoiseSource.cxx )\n  target_link_libraries(ImageNoiseSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageNoiseSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageNoiseSource/#download-and-build-imagenoisesource","title":"Download and Build ImageNoiseSource","text":"

Click here to download ImageNoiseSource and its CMakeLists.txt file. Once the tarball ImageNoiseSource.tar has been downloaded and extracted,

cd ImageNoiseSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageNoiseSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageNonMaximumSuppression/","title":"ImageNonMaximumSuppression","text":"

vtk-examples/Cxx/Images/ImageNonMaximumSuppression

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageNonMaximumSuppression/#code","title":"Code","text":"

ImageNonMaximumSuppression.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageGradient.h>\n#include <vtkImageGradientMagnitude.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageNonMaximumSuppression.h>\n#include <vtkImageSinusoidSource.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageSinusoidSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> sourceCastFilter;\n  sourceCastFilter->SetOutputScalarTypeToUnsignedChar();\n  sourceCastFilter->SetInputConnection(source->GetOutputPort());\n  sourceCastFilter->Update();\n\n  vtkNew<vtkImageGradient> gradientFilter;\n  gradientFilter->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageGradientMagnitude> gradientMagnitudeFilter;\n  gradientMagnitudeFilter->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageCast> gradientMagnitudeCastFilter;\n  gradientMagnitudeCastFilter->SetOutputScalarTypeToUnsignedChar();\n  gradientMagnitudeCastFilter->SetInputConnection(\n      gradientMagnitudeFilter->GetOutputPort());\n  gradientMagnitudeCastFilter->Update();\n\n  vtkNew<vtkImageNonMaximumSuppression> suppressionFilter;\n  suppressionFilter->SetInputConnection(\n      0, gradientMagnitudeFilter->GetOutputPort());\n  suppressionFilter->SetInputConnection(1, gradientFilter->GetOutputPort());\n  suppressionFilter->SetDimensionality(2);\n  suppressionFilter->Update();\n\n  vtkNew<vtkImageCast> suppressionCastFilter;\n  suppressionCastFilter->SetOutputScalarTypeToUnsignedChar();\n  suppressionCastFilter->SetInputConnection(suppressionFilter->GetOutputPort());\n  suppressionCastFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(\n      sourceCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> gradientMagnitudeActor;\n  gradientMagnitudeActor->GetMapper()->SetInputConnection(\n      gradientMagnitudeCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> suppressionActor;\n  suppressionActor->GetMapper()->SetInputConnection(\n      suppressionCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double gradientMagnitudeViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double suppressionViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> gradientMagnitudeRenderer;\n  gradientMagnitudeRenderer->SetViewport(gradientMagnitudeViewport);\n  gradientMagnitudeRenderer->AddActor(gradientMagnitudeActor);\n  gradientMagnitudeRenderer->ResetCamera();\n  gradientMagnitudeRenderer->SetBackground(\n      colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkRenderer> suppressionRenderer;\n  suppressionRenderer->SetViewport(suppressionViewport);\n  suppressionRenderer->AddActor(suppressionActor);\n  suppressionRenderer->ResetCamera();\n  suppressionRenderer->SetBackground(\n      colors->GetColor3d(\"BlanchedAlmond\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(gradientMagnitudeRenderer);\n  renderWindow->AddRenderer(suppressionRenderer);\n  renderWindow->SetWindowName(\"ImageNonMaximumSuppression\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageNonMaximumSuppression/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageNonMaximumSuppression)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingMorphological\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageNonMaximumSuppression: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageNonMaximumSuppression MACOSX_BUNDLE ImageNonMaximumSuppression.cxx )\n  target_link_libraries(ImageNonMaximumSuppression PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageNonMaximumSuppression\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageNonMaximumSuppression/#download-and-build-imagenonmaximumsuppression","title":"Download and Build ImageNonMaximumSuppression","text":"

Click here to download ImageNonMaximumSuppression and its CMakeLists.txt file. Once the tarball ImageNonMaximumSuppression.tar has been downloaded and extracted,

cd ImageNonMaximumSuppression/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageNonMaximumSuppression\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageOpenClose3D/","title":"ImageOpenClose3D","text":"

vtk-examples/Cxx/Images/ImageOpenClose3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageOpenClose3D/#description","title":"Description","text":"

This example reads a binary image and performs opening on one value and closing on another (morphological operations).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageOpenClose3D/#code","title":"Code","text":"

ImageOpenClose3D.cxx

#include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageOpenClose3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename.png e.g. Yinyang.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageOpenClose3D> openClose;\n  openClose->SetInputConnection(reader->GetOutputPort());\n  openClose->SetOpenValue(0);\n  openClose->SetCloseValue(255);\n  openClose->SetKernelSize(5, 5, 3);\n  openClose->ReleaseDataFlagOff();\n  openClose->GetOutput();\n  openClose->GetCloseValue();\n  openClose->GetOpenValue();\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> openCloseActor;\n  openCloseActor->GetMapper()->SetInputConnection(openClose->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double openCloseViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> openCloseRenderer;\n  openCloseRenderer->SetViewport(openCloseViewport);\n  openCloseRenderer->AddActor(openCloseActor);\n  openCloseRenderer->ResetCamera();\n  openCloseRenderer->SetBackground(.4, .5, .7);\n  openCloseRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(openCloseRenderer);\n  renderWindow->SetWindowName(\"ImageOpenClose3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageOpenClose3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageOpenClose3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingMorphological\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageOpenClose3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageOpenClose3D MACOSX_BUNDLE ImageOpenClose3D.cxx )\n  target_link_libraries(ImageOpenClose3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageOpenClose3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageOpenClose3D/#download-and-build-imageopenclose3d","title":"Download and Build ImageOpenClose3D","text":"

Click here to download ImageOpenClose3D and its CMakeLists.txt file. Once the tarball ImageOpenClose3D.tar has been downloaded and extracted,

cd ImageOpenClose3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageOpenClose3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageOrder/","title":"ImageOrder","text":"

vtk-examples/Cxx/Images/ImageOrder

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageOrder/#code","title":"Code","text":"

ImageOrder.cxx

#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\n#define DISPLAY_FIRST_IMAGE\n// Comment this out to display the first image.\n#undef DISPLAY_FIRST_IMAGE\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image, std::string const& colorName);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Image 1\n  vtkNew<vtkImageData> firstImage;\n  CreateColorImage(firstImage, \"DarkOliveGreen\");\n\n  vtkNew<vtkImageActor> firstImageActor;\n  firstImageActor->SetInputData(firstImage);\n\n  // Image 2\n  vtkNew<vtkImageData> secondImage;\n  CreateColorImage(secondImage, \"DarkSalmon\");\n\n  vtkNew<vtkImageActor> secondImageActor;\n  secondImageActor->SetInputData(secondImage);\n\n  // Visualize.\n  vtkNew<vtkRenderer> renderer;\n\n#ifdef DISPLAY_FIRST_IMAGE\n  // The first image is displayed\n  renderer->AddActor(secondImageActor);\n  renderer->AddActor(firstImageActor);\n#else\n  // The second image is displayed.\n  renderer->AddActor(firstImageActor);\n  renderer->AddActor(secondImageActor);\n#endif\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageOrder\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image, std::string const& colorName)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 3> drawColor{0, 0, 0};\n  auto color = colors->GetColor3ub(colorName).GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor[i] = color[i];\n  }\n\n  unsigned int dim = 10;\n\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  for (unsigned int x = 0; x < dim; x++)\n  {\n    for (unsigned int y = 0; y < dim; y++)\n    {\n      auto pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (auto i = 0; i < 3; ++i)\n      {\n        pixel[i] = drawColor[i];\n      }\n    }\n  }\n\n  image->Modified();\n}\n} // namespace\n
"},{"location":"Cxx/Images/ImageOrder/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageOrder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageOrder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageOrder MACOSX_BUNDLE ImageOrder.cxx )\n  target_link_libraries(ImageOrder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageOrder\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageOrder/#download-and-build-imageorder","title":"Download and Build ImageOrder","text":"

Click here to download ImageOrder and its CMakeLists.txt file. Once the tarball ImageOrder.tar has been downloaded and extracted,

cd ImageOrder/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageOrder\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageOrientation/","title":"ImageOrientation","text":"

vtk-examples/Cxx/Images/ImageOrientation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageOrientation/#code","title":"Code","text":"

ImageOrientation.cxx

#include <vtkImageActor.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImagePermute.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(2, 5, 0);\n  source->SetOutputScalarTypeToUnsignedChar();\n  source->Update();\n\n  vtkNew<vtkImagePermute> permuteFilter;\n  permuteFilter->SetInputConnection(source->GetOutputPort());\n  permuteFilter->SetFilteredAxes(1, 0, 2);\n  permuteFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> permutedActor;\n  permutedActor->GetMapper()->SetInputConnection(\n      permuteFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double permutedViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> permutedRenderer;\n  permutedRenderer->SetViewport(permutedViewport);\n  permutedRenderer->AddActor(permutedActor);\n  permutedRenderer->ResetCamera();\n  permutedRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(permutedRenderer);\n  renderWindow->SetWindowName(\"ImageOrientation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageOrientation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageOrientation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageOrientation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageOrientation MACOSX_BUNDLE ImageOrientation.cxx )\n  target_link_libraries(ImageOrientation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageOrientation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageOrientation/#download-and-build-imageorientation","title":"Download and Build ImageOrientation","text":"

Click here to download ImageOrientation and its CMakeLists.txt file. Once the tarball ImageOrientation.tar has been downloaded and extracted,

cd ImageOrientation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageOrientation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImagePermute/","title":"ImagePermute","text":"

vtk-examples/Cxx/Images/ImagePermute

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImagePermute/#code","title":"Code","text":"

ImagePermute.cxx

#include <vtkImageActor.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImagePermute.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(2, 5, 0);\n  source->Update();\n\n  vtkNew<vtkImagePermute> permuteFilter;\n  permuteFilter->SetInputConnection(source->GetOutputPort());\n  permuteFilter->SetFilteredAxes(1, 0, 2);\n  permuteFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> permutedActor;\n  permutedActor->GetMapper()->SetInputConnection(\n      permuteFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double permutedViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> permutedRenderer;\n  permutedRenderer->SetViewport(permutedViewport);\n  permutedRenderer->AddActor(permutedActor);\n  permutedRenderer->ResetCamera();\n  permutedRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(permutedRenderer);\n  renderWindow->SetWindowName(\"ImagePermute\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImagePermute/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImagePermute)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImagePermute: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImagePermute MACOSX_BUNDLE ImagePermute.cxx )\n  target_link_libraries(ImagePermute PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImagePermute\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImagePermute/#download-and-build-imagepermute","title":"Download and Build ImagePermute","text":"

Click here to download ImagePermute and its CMakeLists.txt file. Once the tarball ImagePermute.tar has been downloaded and extracted,

cd ImagePermute/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImagePermute\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageRFFT/","title":"ImageRFFT","text":"

vtk-examples/Cxx/Images/ImageRFFT

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageRFFT/#code","title":"Code","text":"

ImageRFFT.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageFFT.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageRFFT.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageFFT> fftFilter;\n  fftFilter->SetInputConnection(source->GetOutputPort());\n  fftFilter->Update();\n\n  vtkNew<vtkImageCast> fftCastFilter;\n  fftCastFilter->SetInputConnection(fftFilter->GetOutputPort());\n  fftCastFilter->SetOutputScalarTypeToUnsignedChar();\n  fftCastFilter->Update();\n\n  vtkNew<vtkImageRFFT> rfftFilter;\n  rfftFilter->SetInputConnection(fftFilter->GetOutputPort());\n  rfftFilter->Update();\n\n  vtkNew<vtkImageExtractComponents> extractRealFilter;\n  extractRealFilter->SetInputConnection(rfftFilter->GetOutputPort());\n  extractRealFilter->SetComponents(0);\n  extractRealFilter->Update();\n\n  vtkNew<vtkImageCast> rfftCastFilter;\n  rfftCastFilter->SetInputConnection(extractRealFilter->GetOutputPort());\n  rfftCastFilter->SetOutputScalarTypeToUnsignedChar();\n  rfftCastFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> fftActor;\n  fftActor->GetMapper()->SetInputConnection(fftCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> rfftActor;\n  rfftActor->GetMapper()->SetInputConnection(rfftCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double fftViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rfftViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  vtkNew<vtkRenderer> fftRenderer;\n  fftRenderer->SetViewport(fftViewport);\n  fftRenderer->AddActor(fftActor);\n  fftRenderer->ResetCamera();\n  fftRenderer->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  vtkNew<vtkRenderer> rfftRenderer;\n  rfftRenderer->SetViewport(rfftViewport);\n  rfftRenderer->AddActor(rfftActor);\n  rfftRenderer->ResetCamera();\n  rfftRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(fftRenderer);\n  renderWindow->AddRenderer(rfftRenderer);\n  renderWindow->SetWindowName(\"ImageRFFT\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageRFFT/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageRFFT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingFourier\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageRFFT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageRFFT MACOSX_BUNDLE ImageRFFT.cxx )\n  target_link_libraries(ImageRFFT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageRFFT\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageRFFT/#download-and-build-imagerfft","title":"Download and Build ImageRFFT","text":"

Click here to download ImageRFFT and its CMakeLists.txt file. Once the tarball ImageRFFT.tar has been downloaded and extracted,

cd ImageRFFT/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageRFFT\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageRange3D/","title":"ImageRange3D","text":"

vtk-examples/Cxx/Images/ImageRange3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageRange3D/#code","title":"Code","text":"

ImageRange3D.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageRange3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: Filename.jpg e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageRange3D> rangeFilter;\n  rangeFilter->SetInputConnection(reader->GetOutputPort());\n  rangeFilter->SetKernelSize(5, 5, 5);\n  rangeFilter->Update();\n\n  vtkNew<vtkImageCast> rangeCastFilter;\n  rangeCastFilter->SetInputConnection(rangeFilter->GetOutputPort());\n  rangeCastFilter->SetOutputScalarTypeToUnsignedChar();\n  rangeCastFilter->Update();\n\n  vtkNew<vtkImageActor> rangeActor;\n  rangeActor->GetMapper()->SetInputConnection(rangeCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rangeViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> rangeRenderer;\n  rangeRenderer->SetViewport(rangeViewport);\n  rangeRenderer->AddActor(rangeActor);\n  rangeRenderer->ResetCamera();\n  rangeRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(rangeRenderer);\n  renderWindow->SetWindowName(\"ImageRange3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageRange3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageRange3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageRange3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageRange3D MACOSX_BUNDLE ImageRange3D.cxx )\n  target_link_libraries(ImageRange3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageRange3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageRange3D/#download-and-build-imagerange3d","title":"Download and Build ImageRange3D","text":"

Click here to download ImageRange3D and its CMakeLists.txt file. Once the tarball ImageRange3D.tar has been downloaded and extracted,

cd ImageRange3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageRange3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageRotate/","title":"ImageRotate","text":"

vtk-examples/Cxx/Images/ImageRotate

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageRotate/#code","title":"Code","text":"

ImageRotate.cxx

#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageReslice.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputFilename e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  double angle = 45;\n  if (argc > 2)\n  {\n    angle = atof(argv[2]);\n  }\n\n  // Read file\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n\n  // Rotate about the center of the image.\n  vtkNew<vtkTransform> transform;\n\n  // Compute the center of the image.\n  double center[3];\n  center[0] = (bounds[1] + bounds[0]) / 2.0;\n  center[1] = (bounds[3] + bounds[2]) / 2.0;\n  center[2] = (bounds[5] + bounds[4]) / 2.0;\n\n  // Rotate about the center\n  transform->Translate(center[0], center[1], center[2]);\n  transform->RotateWXYZ(angle, 0, 0, 1);\n  transform->Translate(-center[0], -center[1], -center[2]);\n\n  // Reslice does all of the work.\n  vtkNew<vtkImageReslice> reslice;\n  reslice->SetInputConnection(reader->GetOutputPort());\n  reslice->SetResliceTransform(transform);\n  reslice->SetInterpolationModeToCubic();\n  reslice->SetOutputSpacing(reader->GetOutput()->GetSpacing()[0],\n                            reader->GetOutput()->GetSpacing()[1],\n                            reader->GetOutput()->GetSpacing()[2]);\n  reslice->SetOutputOrigin(reader->GetOutput()->GetOrigin()[0],\n                           reader->GetOutput()->GetOrigin()[1],\n                           reader->GetOutput()->GetOrigin()[2]);\n  reslice->SetOutputExtent(\n      reader->GetOutput()\n          ->GetExtent()); // Use a larger extent than the\n                          // original image's to prevent clipping.\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reslice->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"RoyalBlue\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ImageRotate\");\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageRotate/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageRotate)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  IOImage\n  ImagingCore\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageRotate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageRotate MACOSX_BUNDLE ImageRotate.cxx )\n  target_link_libraries(ImageRotate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageRotate\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageRotate/#download-and-build-imagerotate","title":"Download and Build ImageRotate","text":"

Click here to download ImageRotate and its CMakeLists.txt file. Once the tarball ImageRotate.tar has been downloaded and extracted,

cd ImageRotate/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageRotate\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageSeparableConvolution/","title":"ImageSeparableConvolution","text":"

vtk-examples/Cxx/Images/ImageSeparableConvolution

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageSeparableConvolution/#description","title":"Description","text":"

Read in a binary image and convolve it with a separable kernel. The input and output are displayed.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageSeparableConvolution/#code","title":"Code","text":"

ImageSeparableConvolution.cxx

#include <vtkFloatArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageSeparableConvolution.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: BinaryImage.png e.g. Yinyang.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkFloatArray> xKernel;\n  xKernel->SetNumberOfTuples(5);\n  xKernel->SetNumberOfComponents(1);\n  xKernel->SetValue(0, 1);\n  xKernel->SetValue(1, 1);\n  xKernel->SetValue(2, 1);\n  xKernel->SetValue(3, 1);\n  xKernel->SetValue(4, 1);\n\n  vtkNew<vtkImageSeparableConvolution> convolutionFilter;\n  convolutionFilter->SetInputConnection(reader->GetOutputPort());\n  convolutionFilter->SetXKernel(xKernel);\n  convolutionFilter->Update();\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageCast> convolutionCastFilter;\n  convolutionCastFilter->SetInputConnection(convolutionFilter->GetOutputPort());\n  convolutionCastFilter->SetOutputScalarTypeToUnsignedChar();\n  convolutionCastFilter->Update();\n\n  vtkNew<vtkImageActor> convolutionActor;\n  convolutionActor->GetMapper()->SetInputConnection(\n      convolutionCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double convolutionViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> convolutionRenderer;\n  convolutionRenderer->SetViewport(convolutionViewport);\n  convolutionRenderer->AddActor(convolutionActor);\n  convolutionRenderer->ResetCamera();\n  convolutionRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(convolutionRenderer);\n  renderWindow->SetWindowName(\"ImageSeparableConvolution\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageSeparableConvolution/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageSeparableConvolution)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageSeparableConvolution: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageSeparableConvolution MACOSX_BUNDLE ImageSeparableConvolution.cxx )\n  target_link_libraries(ImageSeparableConvolution PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageSeparableConvolution\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageSeparableConvolution/#download-and-build-imageseparableconvolution","title":"Download and Build ImageSeparableConvolution","text":"

Click here to download ImageSeparableConvolution and its CMakeLists.txt file. Once the tarball ImageSeparableConvolution.tar has been downloaded and extracted,

cd ImageSeparableConvolution/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageSeparableConvolution\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageShiftScale/","title":"ImageShiftScale","text":"

vtk-examples/Cxx/Images/ImageShiftScale

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageShiftScale/#code","title":"Code","text":"

ImageShiftScale.cxx

#include <vtkImageData.h>\n#include <vtkImageProperty.h>\n#include <vtkImageShiftScale.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nvoid CreateImage(vtkImageData*);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageData> image;\n  CreateImage(image);\n\n  vtkNew<vtkImageShiftScale> shiftScaleFilter;\n  shiftScaleFilter->SetOutputScalarTypeToUnsignedChar();\n  shiftScaleFilter->SetInputData(image);\n  shiftScaleFilter->SetShift(100);\n  shiftScaleFilter->SetScale(1);\n  shiftScaleFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageSliceMapper> originalSliceMapper;\n  originalSliceMapper->SetInputData(image);\n\n  vtkNew<vtkImageSlice> originalSlice;\n  originalSlice->SetMapper(originalSliceMapper);\n  originalSlice->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageSliceMapper> shiftScaleMapper;\n  shiftScaleMapper->SetInputConnection(shiftScaleFilter->GetOutputPort());\n\n  vtkNew<vtkImageSlice> shiftScaleSlice;\n  shiftScaleSlice->SetMapper(shiftScaleMapper);\n  shiftScaleSlice->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double shiftScaleViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddViewProp(originalSlice);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> shiftScaleRenderer;\n  shiftScaleRenderer->SetViewport(shiftScaleViewport);\n  shiftScaleRenderer->AddViewProp(shiftScaleSlice);\n  shiftScaleRenderer->ResetCamera();\n  shiftScaleRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(shiftScaleRenderer);\n  renderWindow->SetWindowName(\"ImageShiftScale\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateImage(vtkImageData* image)\n{\n  unsigned int dim = 20;\n\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  for (unsigned int x = 0; x < dim; x++)\n  {\n    for (unsigned int y = 0; y < dim; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      if (x < dim / 2)\n      {\n        pixel[0] = 50;\n      }\n      else\n      {\n        pixel[0] = 150;\n      }\n    }\n  }\n\n  image->Modified();\n}\n\n} // namespace\n
"},{"location":"Cxx/Images/ImageShiftScale/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageShiftScale)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageShiftScale: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageShiftScale MACOSX_BUNDLE ImageShiftScale.cxx )\n  target_link_libraries(ImageShiftScale PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageShiftScale\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageShiftScale/#download-and-build-imageshiftscale","title":"Download and Build ImageShiftScale","text":"

Click here to download ImageShiftScale and its CMakeLists.txt file. Once the tarball ImageShiftScale.tar has been downloaded and extracted,

cd ImageShiftScale/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageShiftScale\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageShrink3D/","title":"ImageShrink3D","text":"

vtk-examples/Cxx/Images/ImageShrink3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageShrink3D/#code","title":"Code","text":"

ImageShrink3D.cxx

#include <vtkImageActor.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageShrink3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageShrink3D> shrinkFilter;\n  shrinkFilter->SetInputConnection(source->GetOutputPort());\n  shrinkFilter->SetShrinkFactors(2, 1, 1);\n  shrinkFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> shrunkActor;\n  shrunkActor->GetMapper()->SetInputConnection(shrinkFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double shrunkViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> shrunkRenderer;\n  shrunkRenderer->SetViewport(shrunkViewport);\n  shrunkRenderer->AddActor(shrunkActor);\n  shrunkRenderer->ResetCamera();\n  shrunkRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(shrunkRenderer);\n  renderWindow->SetWindowName(\"ImageShrink3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageShrink3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageShrink3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageShrink3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageShrink3D MACOSX_BUNDLE ImageShrink3D.cxx )\n  target_link_libraries(ImageShrink3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageShrink3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageShrink3D/#download-and-build-imageshrink3d","title":"Download and Build ImageShrink3D","text":"

Click here to download ImageShrink3D and its CMakeLists.txt file. Once the tarball ImageShrink3D.tar has been downloaded and extracted,

cd ImageShrink3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageShrink3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageSinusoidSource/","title":"ImageSinusoidSource","text":"

vtk-examples/Cxx/Images/ImageSinusoidSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageSinusoidSource/#code","title":"Code","text":"

ImageSinusoidSource.cxx

#include <vtkImageSinusoidSource.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageSinusoidSource> sinusoidSource;\n  sinusoidSource->Update();\n\n  // Visualize.\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(sinusoidSource->GetOutputPort());\n  imageViewer->GetRenderWindow()->SetSize(500, 500);\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DimGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ImageSinusoidSource\");\n\n  // Set up an interactor that does not respond to mouse events.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->GetRenderWindow()->SetInteractor(renderWindowInteractor);\n  renderWindowInteractor->SetInteractorStyle(0);\n  imageViewer->Render();\n\n  // Start the event loop.\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageSinusoidSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageSinusoidSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageSinusoidSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageSinusoidSource MACOSX_BUNDLE ImageSinusoidSource.cxx )\n  target_link_libraries(ImageSinusoidSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageSinusoidSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageSinusoidSource/#download-and-build-imagesinusoidsource","title":"Download and Build ImageSinusoidSource","text":"

Click here to download ImageSinusoidSource and its CMakeLists.txt file. Once the tarball ImageSinusoidSource.tar has been downloaded and extracted,

cd ImageSinusoidSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageSinusoidSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageSlice/","title":"ImageSlice","text":"

vtk-examples/Cxx/Images/ImageSlice

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageSlice/#code","title":"Code","text":"

ImageSlice.cxx

#include <vtkImageData.h>\n#include <vtkImageMapper.h>\n#include <vtkImageResliceMapper.h>\n#include <vtkImageSlice.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData*);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> colorImage;\n  CreateColorImage(colorImage);\n\n  vtkNew<vtkImageResliceMapper> imageResliceMapper;\n  imageResliceMapper->SetInputData(colorImage);\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageResliceMapper);\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageSlice\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData* image)\n{\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  vtkNew<vtkNamedColors> colors;\n  auto pixelColor = colors->GetColor3ub(\"Turquoise\").GetData();\n\n  for (unsigned int x = 0; x < 10; x++)\n  {\n    for (unsigned int y = 0; y < 10; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (auto j = 0; j < 3; ++j)\n      {\n        pixel[j] = pixelColor[j];\n      }\n    }\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/Images/ImageSlice/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageSlice)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingImage\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageSlice: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageSlice MACOSX_BUNDLE ImageSlice.cxx )\n  target_link_libraries(ImageSlice PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageSlice\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageSlice/#download-and-build-imageslice","title":"Download and Build ImageSlice","text":"

Click here to download ImageSlice and its CMakeLists.txt file. Once the tarball ImageSlice.tar has been downloaded and extracted,

cd ImageSlice/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageSlice\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageSliceMapper/","title":"ImageSliceMapper","text":"

vtk-examples/Cxx/Images/ImageSliceMapper

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageSliceMapper/#code","title":"Code","text":"

ImageSliceMapper.cxx

#include <vtkImageData.h>\n#include <vtkImageMapper.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData*);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> colorImage;\n  CreateColorImage(colorImage);\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper;\n  imageSliceMapper->SetInputData(colorImage);\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageSliceMapper);\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageSliceMapper\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData* image)\n{\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  vtkNew<vtkNamedColors> colors;\n  auto pixelColor = colors->GetColor3ub(\"Turquoise\").GetData();\n\n  for (unsigned int x = 0; x < 10; x++)\n  {\n    for (unsigned int y = 0; y < 10; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (auto j = 0; j < 3; ++j)\n      {\n        pixel[j] = pixelColor[j];\n      }\n    }\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/Images/ImageSliceMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageSliceMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageSliceMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageSliceMapper MACOSX_BUNDLE ImageSliceMapper.cxx )\n  target_link_libraries(ImageSliceMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageSliceMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageSliceMapper/#download-and-build-imageslicemapper","title":"Download and Build ImageSliceMapper","text":"

Click here to download ImageSliceMapper and its CMakeLists.txt file. Once the tarball ImageSliceMapper.tar has been downloaded and extracted,

cd ImageSliceMapper/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageSliceMapper\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageSobel2D/","title":"ImageSobel2D","text":"

vtk-examples/Cxx/Images/ImageSobel2D

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageSobel2D/#code","title":"Code","text":"

ImageSobel2D.cxx

#include <vtkArrowSource.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageShiftScale.h>\n#include <vtkImageSobel2D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Black\").GetData();\n  auto color2 = colors->GetColor3ub(\"Red\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n  // Create an image of a rectangle\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetExtent(0, 200, 0, 200, 0, 0);\n  source->SetDrawColor(drawColor1.data());\n  source->FillBox(0, 200, 0, 200);\n  source->SetDrawColor(drawColor2.data());\n  source->FillBox(100, 120, 100, 120);\n  source->Update();\n\n  // Find the x and y gradients using a sobel filter\n  vtkNew<vtkImageSobel2D> sobelFilter;\n  sobelFilter->SetInputConnection(source->GetOutputPort());\n  sobelFilter->Update();\n\n  // Extract the x component of the gradient\n  vtkNew<vtkImageExtractComponents> extractXFilter;\n  extractXFilter->SetComponents(0);\n  extractXFilter->SetInputConnection(sobelFilter->GetOutputPort());\n  extractXFilter->Update();\n\n  double xRange[2];\n  extractXFilter->GetOutput()->GetPointData()->GetScalars()->GetRange(xRange);\n\n  vtkNew<vtkImageMathematics> xImageAbs;\n  xImageAbs->SetOperationToAbsoluteValue();\n  xImageAbs->SetInputConnection(extractXFilter->GetOutputPort());\n  xImageAbs->Update();\n\n  vtkNew<vtkImageShiftScale> xShiftScale;\n  xShiftScale->SetOutputScalarTypeToUnsignedChar();\n  xShiftScale->SetScale(255 / xRange[1]);\n  xShiftScale->SetInputConnection(xImageAbs->GetOutputPort());\n  xShiftScale->Update();\n\n  // Extract the y component of the gradient\n  vtkNew<vtkImageExtractComponents> extractYFilter;\n  extractYFilter->SetComponents(1);\n  extractYFilter->SetInputConnection(sobelFilter->GetOutputPort());\n  extractYFilter->Update();\n\n  double yRange[2];\n  extractYFilter->GetOutput()->GetPointData()->GetScalars()->GetRange(yRange);\n\n  vtkNew<vtkImageMathematics> yImageAbs;\n  yImageAbs->SetOperationToAbsoluteValue();\n  yImageAbs->SetInputConnection(extractYFilter->GetOutputPort());\n  yImageAbs->Update();\n\n  vtkNew<vtkImageShiftScale> yShiftScale;\n  yShiftScale->SetOutputScalarTypeToUnsignedChar();\n  yShiftScale->SetScale(255 / yRange[1]);\n  yShiftScale->SetInputConnection(yImageAbs->GetOutputPort());\n  yShiftScale->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> xActor;\n  xActor->GetMapper()->SetInputConnection(xShiftScale->GetOutputPort());\n\n  vtkNew<vtkImageActor> yActor;\n  yActor->GetMapper()->SetInputConnection(yShiftScale->GetOutputPort());\n\n  vtkNew<vtkArrowSource> arrowSource;\n  sobelFilter->GetOutput()->GetPointData()->SetActiveVectors(\n      \"ImageScalarsGradient\");\n\n  vtkNew<vtkGlyph3DMapper> sobelMapper;\n  sobelMapper->ScalingOn();\n  sobelMapper->SetScaleFactor(.05);\n  sobelMapper->SetSourceConnection(arrowSource->GetOutputPort());\n  sobelMapper->SetInputConnection(sobelFilter->GetOutputPort());\n  sobelMapper->Update();\n\n  vtkNew<vtkActor> sobelActor;\n  sobelActor->SetMapper(sobelMapper);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double xViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double yViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double sobelViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  vtkNew<vtkRenderer> xRenderer;\n  xRenderer->SetViewport(xViewport);\n  xRenderer->AddActor(xActor);\n  xRenderer->ResetCamera();\n  xRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> yRenderer;\n  yRenderer->SetViewport(yViewport);\n  yRenderer->AddActor(yActor);\n  yRenderer->ResetCamera();\n  yRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> sobelRenderer;\n  sobelRenderer->SetViewport(sobelViewport);\n  sobelRenderer->AddActor(sobelActor);\n  sobelRenderer->ResetCamera();\n  sobelRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(xRenderer);\n  renderWindow->AddRenderer(yRenderer);\n  renderWindow->AddRenderer(sobelRenderer);\n  renderWindow->SetWindowName(\"ImageSobel2D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageSobel2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageSobel2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageSobel2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageSobel2D MACOSX_BUNDLE ImageSobel2D.cxx )\n  target_link_libraries(ImageSobel2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageSobel2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageSobel2D/#download-and-build-imagesobel2d","title":"Download and Build ImageSobel2D","text":"

Click here to download ImageSobel2D and its CMakeLists.txt file. Once the tarball ImageSobel2D.tar has been downloaded and extracted,

cd ImageSobel2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageSobel2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageStack/","title":"ImageStack","text":"

vtk-examples/Cxx/Images/ImageStack

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageStack/#code","title":"Code","text":"

ImageStack.cxx

#include <vtkImageData.h>\n#include <vtkImageProperty.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkImageStack.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nstatic void CreateColorImage(vtkImageData*, const int corner,\n                             const unsigned int channel);\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Image 1\n  vtkNew<vtkImageData> image1;\n  CreateColorImage(image1, 1, 0);\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper1;\n  imageSliceMapper1->SetInputData(image1);\n\n  vtkNew<vtkImageSlice> imageSlice1;\n  imageSlice1->SetMapper(imageSliceMapper1);\n  imageSlice1->GetProperty()->SetOpacity(.5);\n\n  // Image 2\n  vtkNew<vtkImageData> image2;\n  CreateColorImage(image2, 4, 1);\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper2;\n  imageSliceMapper2->SetInputData(image2);\n\n  vtkNew<vtkImageSlice> imageSlice2;\n  imageSlice2->SetMapper(imageSliceMapper2);\n  imageSlice2->GetProperty()->SetOpacity(.5);\n\n  // Stack.\n  vtkNew<vtkImageStack> imageStack;\n  imageStack->AddImage(imageSlice1);\n  imageStack->AddImage(imageSlice2);\n  // imageStack->SetActiveLayer(1);\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageStack);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageStack\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nvoid CreateColorImage(vtkImageData* image, const int corner,\n                      const unsigned int channel)\n{\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  for (unsigned int x = 0; x < 10; x++)\n  {\n    for (unsigned int y = 0; y < 10; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = 0;\n      pixel[1] = 0;\n      pixel[2] = 0;\n    }\n  }\n\n  for (int x = corner; x < corner + 3; x++)\n  {\n    for (int y = corner; y < corner + 3; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[channel] = 255;\n    }\n  }\n}\n
"},{"location":"Cxx/Images/ImageStack/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageStack)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingImage\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageStack: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageStack MACOSX_BUNDLE ImageStack.cxx )\n  target_link_libraries(ImageStack PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageStack\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageStack/#download-and-build-imagestack","title":"Download and Build ImageStack","text":"

Click here to download ImageStack and its CMakeLists.txt file. Once the tarball ImageStack.tar has been downloaded and extracted,

cd ImageStack/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageStack\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageStencil/","title":"ImageStencil","text":"

vtk-examples/Cxx/Images/ImageStencil

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageStencil/#description","title":"Description","text":"

This example creates a red image and a green image. It creates a mask that is half on and half off. It then combines the images according to the mask using an ImageStencil.

Seealso

ImageTransparency and Transparency

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageStencil/#code","title":"Code","text":"

ImageStencil.cxx

#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageStencil.h>\n// #include <vtkImageStencilData.h>\n#include <vtkImageToImageStencil.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\nvoid CreateColorImage(vtkImageData*, unsigned int channel);\nvoid CreateMask(vtkImageData*);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> image1;\n  CreateColorImage(image1, 0); // Create a red image.\n\n  vtkNew<vtkImageData> image2;\n  CreateColorImage(image2, 1); // Create a green image.\n\n  vtkNew<vtkImageData> mask;\n  CreateMask(mask);\n\n  // vtkNew<vtkImageStencilData> stencilData;\n  vtkNew<vtkImageToImageStencil> imageToImageStencil;\n  imageToImageStencil->SetInputData(mask);\n  imageToImageStencil->ThresholdByUpper(122);\n\n  vtkNew<vtkImageStencil> stencil;\n  stencil->SetInputConnection(2, imageToImageStencil->GetOutputPort());\n  stencil->ReverseStencilOn();\n  stencil->SetBackgroundInputData(image2);\n  stencil->SetInputData(image1);\n  stencil->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(stencil->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageStencil\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  ;\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image, const unsigned int channel)\n{\n  unsigned int dim = 20;\n\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  for (unsigned int x = 0; x < dim; x++)\n  {\n    for (unsigned int y = 0; y < dim; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = 0;\n      pixel[1] = 0;\n      pixel[2] = 0;\n\n      pixel[channel] = 255;\n    }\n  }\n\n  image->Modified();\n}\n\nvoid CreateMask(vtkImageData* image)\n{\n  unsigned int dim = 20;\n\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  for (unsigned int x = 0; x < dim; x++)\n  {\n    for (unsigned int y = 0; y < dim; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      if (x < dim / 2)\n      {\n        pixel[0] = 0;\n      }\n      else\n      {\n        pixel[0] = 255;\n      }\n    }\n  }\n\n  image->Modified();\n}\n} // namespace\n
"},{"location":"Cxx/Images/ImageStencil/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageStencil)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingStencil\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageStencil: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageStencil MACOSX_BUNDLE ImageStencil.cxx )\n  target_link_libraries(ImageStencil PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageStencil\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageStencil/#download-and-build-imagestencil","title":"Download and Build ImageStencil","text":"

Click here to download ImageStencil and its CMakeLists.txt file. Once the tarball ImageStencil.tar has been downloaded and extracted,

cd ImageStencil/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageStencil\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageText/","title":"ImageText","text":"

vtk-examples/Cxx/Images/ImageText

"},{"location":"Cxx/Images/ImageText/#description","title":"Description","text":"

This example demonstrates how to draw text onto an image vtkImageData. It uses vtkImageBlend to blend the text and the image. For another example using vtkImageBlend, see CombineImages.

Seealso

DrawText for an example of drawing text, also in 2D, but into the render window rather than into a vtkImageData object.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageText/#code","title":"Code","text":"

ImageText.cxx

#include <vtkFreeTypeTools.h>\n#include <vtkImageActor.h>\n#include <vtkImageBlend.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStdString.h>\n#include <vtkTextProperty.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Blue\").GetData();\n  auto color2 = colors->GetColor3ub(\"Red\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n  // Create a blue image with a red circle of radius 50 centered at (60, 60).\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar(); // PNGWriter requires unsigned char\n                                          // (or unsigned short).\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 150, 0, 120, 0,\n                     0); // xmin, xmax, ymin, ymax, zmin, zmax\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(0, 150, 0, 120);\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(60, 60, 50); // parameters: x, y, radius\n  // Create an image of text.\n  vtkFreeTypeTools* freeType = vtkFreeTypeTools::GetInstance();\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  textProperty->SetJustificationToLeft();\n  textProperty->SetFontSize(24);\n  textProperty->SetOrientation(25);\n  vtkStdString text(\"   Test String\");\n  vtkNew<vtkImageData> textImage;\n  freeType->RenderString(textProperty, text, 70, textImage.GetPointer());\n\n  // Combine the images.\n  vtkNew<vtkImageBlend> blend;\n  blend->AddInputConnection(drawing->GetOutputPort());\n  blend->AddInputData(textImage);\n  blend->SetOpacity(0, 1.0); // background image: 50% opaque\n  blend->SetOpacity(1, 1.0); // text: 100% opaque\n  blend->Update();\n\n  vtkNew<vtkImageActor> blendActor;\n  blendActor->GetMapper()->SetInputConnection(blend->GetOutputPort());\n\n  vtkNew<vtkRenderer> blendRenderer;\n  blendRenderer->AddActor(blendActor);\n  blendRenderer->ResetCamera();\n  blendRenderer->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(blendRenderer);\n  renderWindow->SetWindowName(\"ImageText\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageText/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageText)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageText: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageText MACOSX_BUNDLE ImageText.cxx )\n  target_link_libraries(ImageText PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageText\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageText/#download-and-build-imagetext","title":"Download and Build ImageText","text":"

Click here to download ImageText and its CMakeLists.txt file. Once the tarball ImageText.tar has been downloaded and extracted,

cd ImageText/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageText\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageThreshold/","title":"ImageThreshold","text":"

vtk-examples/Cxx/Images/ImageThreshold

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageThreshold/#description","title":"Description","text":"

The image on the left is the input image and the image on the right is the thresholded version.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageThreshold/#code","title":"Code","text":"

ImageThreshold.cxx

#include <vtkImageActor.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageThreshold.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> imageSource;\n  imageSource->Update();\n\n  vtkNew<vtkImageThreshold> imageThreshold;\n  imageThreshold->SetInputConnection(imageSource->GetOutputPort());\n  unsigned char lower = 100;\n  unsigned char upper = 200;\n\n  imageThreshold->ThresholdBetween(lower, upper);\n  imageThreshold->ReplaceInOn();\n  imageThreshold->SetInValue(255);\n  imageThreshold->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> thresholdedActor;\n  thresholdedActor->GetMapper()->SetInputConnection(\n      imageThreshold->GetOutputPort());\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"ImageThreshold\");\n\n  // And one interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(.6, .5, .4);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(.4, .5, .6);\n  rightRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(thresholdedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageThreshold/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageThreshold)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageThreshold: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageThreshold MACOSX_BUNDLE ImageThreshold.cxx )\n  target_link_libraries(ImageThreshold PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageThreshold\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageThreshold/#download-and-build-imagethreshold","title":"Download and Build ImageThreshold","text":"

Click here to download ImageThreshold and its CMakeLists.txt file. Once the tarball ImageThreshold.tar has been downloaded and extracted,

cd ImageThreshold/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageThreshold\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageToPolyDataFilter/","title":"ImageToPolyDataFilter","text":"

vtk-examples/Cxx/Images/ImageToPolyDataFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageToPolyDataFilter/#code","title":"Code","text":"

ImageToPolyDataFilter.cxx

#include <vtkActor.h>\n#include <vtkImageQuantizeRGBToIndex.h>\n#include <vtkImageToPolyDataFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangleFilter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cerr << \"Required arguments: filename.png e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageQuantizeRGBToIndex> quant;\n  quant->SetInputConnection(reader->GetOutputPort());\n  quant->SetNumberOfColors(16);\n\n  vtkNew<vtkImageToPolyDataFilter> i2pd;\n  i2pd->SetInputConnection(quant->GetOutputPort());\n  i2pd->SetLookupTable(quant->GetLookupTable());\n  i2pd->SetColorModeToLUT();\n  i2pd->SetOutputStyleToPolygonalize();\n  i2pd->SetError(0);\n  i2pd->DecimationOn();\n  i2pd->SetDecimationError(0.0);\n  i2pd->SetSubImageSize(25);\n\n  // Need a triangle filter because the polygons are complex and concave\n  vtkNew<vtkTriangleFilter> tf;\n  tf->SetInputConnection(i2pd->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(tf->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->SetSize(300, 250);\n  renderWindow->SetWindowName(\"ImageToPolyDataFilter\");\n\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageToPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageToPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersHybrid\n  IOImage\n  ImagingColor\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageToPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageToPolyDataFilter MACOSX_BUNDLE ImageToPolyDataFilter.cxx )\n  target_link_libraries(ImageToPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageToPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageToPolyDataFilter/#download-and-build-imagetopolydatafilter","title":"Download and Build ImageToPolyDataFilter","text":"

Click here to download ImageToPolyDataFilter and its CMakeLists.txt file. Once the tarball ImageToPolyDataFilter.tar has been downloaded and extracted,

cd ImageToPolyDataFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageToPolyDataFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageToStructuredPoints/","title":"ImageToStructuredPoints","text":"

vtk-examples/Cxx/Images/ImageToStructuredPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageToStructuredPoints/#code","title":"Code","text":"

ImageToStructuredPoints.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageCanvasSource2D.h>\n// #include <vtkImageData.h>\n#include <vtkImageToStructuredPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Gray\").GetData();\n  auto color2 = colors->GetColor3ub(\"Gray\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n  drawColor2[0] = 255;\n\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetExtent(0, 20, 0, 20, 0, 0);\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetDrawColor(drawColor1.data());\n  source->FillBox(0, 20, 0, 20);\n  source->SetDrawColor(drawColor2.data());\n  source->FillBox(0, 15, 0, 20);\n  source->Update();\n\n  vtkNew<vtkImageToStructuredPoints> convertFilter;\n  convertFilter->SetInputConnection(source->GetOutputPort());\n  convertFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(convertFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"LimeGreen\").GetData());\n\n  renderWindow->SetWindowName(\"ImageToStructuredPoints\");\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageToStructuredPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageToStructuredPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonExecutionModel\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageToStructuredPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageToStructuredPoints MACOSX_BUNDLE ImageToStructuredPoints.cxx )\n  target_link_libraries(ImageToStructuredPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageToStructuredPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageToStructuredPoints/#download-and-build-imagetostructuredpoints","title":"Download and Build ImageToStructuredPoints","text":"

Click here to download ImageToStructuredPoints and its CMakeLists.txt file. Once the tarball ImageToStructuredPoints.tar has been downloaded and extracted,

cd ImageToStructuredPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageToStructuredPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageTransparency/","title":"ImageTransparency","text":"

vtk-examples/Cxx/Images/ImageTransparency

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageTransparency/#description","title":"Description","text":"

Seealso

ImageStencil and Transparency

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageTransparency/#code","title":"Code","text":"

ImageTransparency.cxx

#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image, std::string const& colorNameunsigned,\n                      unsigned char const alpha);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> image;\n  // Use this to control the transparency [0 .. 255]\n  unsigned char alpha = 50;\n  CreateColorImage(image, \"Gold\", alpha);\n\n  // Create actor.\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputData(image);\n\n  // Visualize.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageTransparency\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image, std::string const& colorName,\n                      unsigned char const alpha)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> drawColor{0, 0, 0};\n  auto color = colors->GetColor4ub(colorName).GetData();\n  for (auto i = 0; i < 4; ++i)\n  {\n    drawColor[i] = color[i];\n  }\n\n  unsigned int dim = 10;\n\n  // Specify the size of the image data.\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 4);\n\n  int* dims = image->GetDimensions();\n\n  std::cout << \"Dims: \"\n            << \" x: \" << dims[0] << \" y: \" << dims[1] << \" z: \" << dims[2]\n            << std::endl;\n\n  for (unsigned char y = 0; y < dims[1]; y++)\n  {\n    for (unsigned char x = 0; x < dims[0]; x++)\n    {\n      auto pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (auto i = 0; i < 4; ++i)\n      {\n        pixel[i] = drawColor[i];\n      }\n      if (x < 5)\n      {\n        pixel[3] = alpha;\n      }\n      else\n      {\n        pixel[3] = 255;\n      }\n    }\n  }\n\n  image->Modified();\n}\n} // namespace\n
"},{"location":"Cxx/Images/ImageTransparency/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageTransparency)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageTransparency: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageTransparency MACOSX_BUNDLE ImageTransparency.cxx )\n  target_link_libraries(ImageTransparency PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageTransparency\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageTransparency/#download-and-build-imagetransparency","title":"Download and Build ImageTransparency","text":"

Click here to download ImageTransparency and its CMakeLists.txt file. Once the tarball ImageTransparency.tar has been downloaded and extracted,

cd ImageTransparency/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageTransparency\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageValueRange/","title":"ImageValueRange","text":"

vtk-examples/Cxx/Images/ImageValueRange

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageValueRange/#code","title":"Code","text":"

ImageValueRange.cxx

#include <vtkDoubleArray.h>\n#include <vtkImageData.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n\nint main(int, char*[])\n{\n  // Create the image data.\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data.\n  imageData->SetDimensions(5, 1, 1);\n  imageData->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = imageData->GetDimensions();\n\n  for (int x = 0; x < dims[0]; x++)\n  {\n    double* pixel = static_cast<double*>(imageData->GetScalarPointer(x, 0, 0));\n    pixel[0] = x * 10;\n  }\n\n  double valuesRange[2];\n  dynamic_cast<vtkDoubleArray*>(\n      imageData->GetPointData()->GetArray(\"ImageScalars\"))\n      ->GetValueRange(valuesRange);\n  std::cout << \"valuesRange = \" << valuesRange[0] << \" \" << valuesRange[1]\n            << std::endl;\n\n  // Alternatively.\n  auto min = imageData->GetScalarRange()[0];\n  auto max = imageData->GetScalarRange()[1];\n  std::cout << \"alternatively:\\nvaluesRange = \" << min << \" \" << max\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageValueRange/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageValueRange)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageValueRange: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageValueRange MACOSX_BUNDLE ImageValueRange.cxx )\n  target_link_libraries(ImageValueRange PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageValueRange\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageValueRange/#download-and-build-imagevaluerange","title":"Download and Build ImageValueRange","text":"

Click here to download ImageValueRange and its CMakeLists.txt file. Once the tarball ImageValueRange.tar has been downloaded and extracted,

cd ImageValueRange/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageValueRange\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageVariance3D/","title":"ImageVariance3D","text":"

vtk-examples/Cxx/Images/ImageVariance3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageVariance3D/#code","title":"Code","text":"

ImageVariance3D.cxx

#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageVariance3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageVariance3D> varianceFilter;\n  varianceFilter->SetInputConnection(source->GetOutputPort());\n  varianceFilter->SetKernelSize(5, 4, 3);\n  varianceFilter->Update();\n\n  vtkNew<vtkImageCast> varianceCastFilter;\n  varianceCastFilter->SetOutputScalarTypeToFloat();\n  varianceCastFilter->SetInputConnection(varianceFilter->GetOutputPort());\n  varianceCastFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> varianceActor;\n  varianceActor->GetMapper()->SetInputConnection(\n      varianceCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double varianceViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(.4, .5, .6);\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> varianceRenderer;\n  varianceRenderer->SetViewport(varianceViewport);\n  varianceRenderer->AddActor(varianceActor);\n  varianceRenderer->ResetCamera();\n  varianceRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(varianceRenderer);\n  renderWindow->SetWindowName(\"ImageVariance3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageVariance3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageVariance3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageVariance3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageVariance3D MACOSX_BUNDLE ImageVariance3D.cxx )\n  target_link_libraries(ImageVariance3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageVariance3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageVariance3D/#download-and-build-imagevariance3d","title":"Download and Build ImageVariance3D","text":"

Click here to download ImageVariance3D and its CMakeLists.txt file. Once the tarball ImageVariance3D.tar has been downloaded and extracted,

cd ImageVariance3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageVariance3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ImageWarp/","title":"ImageWarp","text":"

vtk-examples/Cxx/Images/ImageWarp

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/ImageWarp/#description","title":"Description","text":"

Combining the imaging and visualization pipelines to deform an image in the z-direction. The vtkMergeFilter is used to combine the warped surface with the original color data.

Info

See Figure 10-17 in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ImageWarp/#code","title":"Code","text":"

ImageWarp.cxx

/*\n * This example shows how to combine data from both the imaging\n *  and graphics pipelines. The vtkMergeData filter is used to\n *  merge the data from each together.\n */\n#include <vtkActor.h>\n#include <vtkBMPReader.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkImageLuminance.h>\n#include <vtkMergeFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkWarpScalar.h>\n\n#include <array>\n#include <iomanip>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fileName\" << std::endl;\n    std::cout << \"where: fileName is the masonry.bmp file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{60, 93, 144, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Read in an image and compute a luminance value-> The image is extracted\n  // as a set of polygons (vtkImageDataGeometryFilter). We then will\n  // warp the plane using the scalar (luminance) values.\n  //\n  vtkNew<vtkBMPReader> reader;\n  reader->SetFileName(fileName.c_str());\n  // Convert the image to a grey scale.\n  vtkNew<vtkImageLuminance> luminance;\n  luminance->SetInputConnection(reader->GetOutputPort());\n  // Pass the data to the pipeline as polygons.\n  vtkNew<vtkImageDataGeometryFilter> geometry;\n  geometry->SetInputConnection(luminance->GetOutputPort());\n  // Warp the data in a direction perpendicular to the image plane.\n  vtkNew<vtkWarpScalar> warp;\n  warp->SetInputConnection(geometry->GetOutputPort());\n  warp->SetScaleFactor(-0.1);\n\n  // Use vtkMergeFilter to combine the original image with the warped geometry.\n  vtkNew<vtkMergeFilter> merge;\n  merge->SetGeometryConnection(warp->GetOutputPort());\n  merge->SetScalarsConnection(reader->GetOutputPort());\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(merge->GetOutputPort());\n  mapper->SetScalarRange(0, 255);\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create the rendering window, renderer, and interactive renderer.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(actor);\n  ren->ResetCamera();\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  // ren->GetActiveCamera()->Azimuth(20);\n  // ren->GetActiveCamera()->Elevation(30);\n  // ren->ResetCameraClippingRange();\n  // ren->GetActiveCamera()->Zoom(1.3);\n  ren->GetActiveCamera()->SetPosition(-100, -130, 325);\n  ren->GetActiveCamera()->SetFocalPoint(105, 114, -29);\n  ren->GetActiveCamera()->SetViewUp(0.51, 0.54, 0.67);\n  ren->ResetCameraClippingRange();\n\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"ImageWarp\");\n\n  // Render the image.\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ImageWarp/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageWarp)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOImage\n  ImagingColor\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageWarp: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageWarp MACOSX_BUNDLE ImageWarp.cxx )\n  target_link_libraries(ImageWarp PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageWarp\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ImageWarp/#download-and-build-imagewarp","title":"Download and Build ImageWarp","text":"

Click here to download ImageWarp and its CMakeLists.txt file. Once the tarball ImageWarp.tar has been downloaded and extracted,

cd ImageWarp/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageWarp\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/InteractWithImage/","title":"InteractWithImage","text":"

vtk-examples/Cxx/Images/InteractWithImage

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/InteractWithImage/#description","title":"Description","text":"

This example shows how to display an image and zoom/pan/adjust brightness interactively.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/InteractWithImage/#code","title":"Code","text":"

InteractWithImage.cxx

#include <vtkImageActor.h> // Note: this is a 3D actor (c.f. vtkImageMapper which is 2D)\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: Filename e.g. Ox.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetWindowName(\"InteractWithImage\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n\n  // Setup interactor style (this is what implements the zooming, panning and\n  // brightness adjustment functionality).\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/InteractWithImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InteractWithImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InteractWithImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InteractWithImage MACOSX_BUNDLE InteractWithImage.cxx )\n  target_link_libraries(InteractWithImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InteractWithImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/InteractWithImage/#download-and-build-interactwithimage","title":"Download and Build InteractWithImage","text":"

Click here to download InteractWithImage and its CMakeLists.txt file. Once the tarball InteractWithImage.tar has been downloaded and extracted,

cd InteractWithImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./InteractWithImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/Interpolation/","title":"Interpolation","text":"

vtk-examples/Cxx/Images/Interpolation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/Interpolation/#code","title":"Code","text":"

Interpolation.cxx

#include <vtkImageData.h>\n#include <vtkImageProperty.h>\n#include <vtkImageResliceMapper.h>\n#include <vtkImageSlice.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData*);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> colorImage;\n  CreateColorImage(colorImage);\n\n  vtkNew<vtkImageResliceMapper> imageResliceMapper;\n  imageResliceMapper->SetInputData(colorImage);\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageResliceMapper);\n  imageSlice->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Interpolation\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData* image)\n{\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  vtkNew<vtkNamedColors> colors;\n  auto pixelColor = colors->GetColor3ub(\"Turquoise\").GetData();\n\n  for (unsigned int x = 0; x < 10; x++)\n  {\n    for (unsigned int y = 0; y < 10; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (auto j = 0; j < 3; ++j)\n      {\n        pixel[j] = pixelColor[j];\n      }\n    }\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/Images/Interpolation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Interpolation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingImage\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Interpolation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Interpolation MACOSX_BUNDLE Interpolation.cxx )\n  target_link_libraries(Interpolation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Interpolation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/Interpolation/#download-and-build-interpolation","title":"Download and Build Interpolation","text":"

Click here to download Interpolation and its CMakeLists.txt file. Once the tarball Interpolation.tar has been downloaded and extracted,

cd Interpolation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Interpolation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/MarkKeypoints/","title":"MarkKeypoints","text":"

vtk-examples/Cxx/Images/MarkKeypoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/MarkKeypoints/#description","title":"Description","text":"
  • Thanks to Dean Inglis.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/MarkKeypoints/#code","title":"Code","text":"

MarkKeypoints.cxx

#include <sstream>\n#include <vtkAbstractPicker.h>\n#include <vtkActor2D.h>\n#include <vtkCoordinate.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVectorText.h>\n\n#include <array>\n\nnamespace {\n\nclass MyStyle : public vtkInteractorStyleImage\n{\npublic:\n  static MyStyle* New();\n  vtkTypeMacro(MyStyle, vtkInteractorStyleImage);\n\n  std::vector<vtkActor2D*> Numbers;\n\n  void OnLeftButtonDown() override\n  {\n    this->Interactor->GetPicker()->Pick(this->Interactor->GetEventPosition()[0],\n                                        this->Interactor->GetEventPosition()[1],\n                                        0, // always zero.\n                                        this->CurrentRenderer);\n    double picked[3];\n    this->Interactor->GetPicker()->GetPickPosition(picked);\n    this->AddNumber(picked);\n\n    // Forward events\n    vtkInteractorStyleImage::OnLeftButtonDown();\n\n    // this->Interactor->GetRenderWindow()->Render();\n    this->Interactor->Render();\n  }\n\n  void AddNumber(double p[3])\n  {\n    vtkNew<vtkNamedColors> colors;\n\n    std::cout << \"Adding marker at \" << p[0] << \" \" << p[1]; //<< std::endl;\n\n    // normally, with an image you would do\n    // double* s = image->GetSpacing();\n    // double* o = image->GetOrigin();\n    // p[0] = static_cast<int>( (p[0] - o[0]) / s[0] + 0.5 );\n    p[0] = static_cast<int>(p[0] + 0.5);\n    p[1] = static_cast<int>(p[1] + 0.5);\n\n    std::cout << \" -> \" << p[0] << \" \" << p[1] << std::endl;\n\n    // Convert the current number to a string\n    std::stringstream ss;\n    ss << Numbers.size();\n\n    // Create an actor for the text\n    vtkNew<vtkVectorText> textSource;\n    textSource->SetText(ss.str().c_str());\n\n    // get the bounds of the text\n    textSource->Update();\n    double* bounds = textSource->GetOutput()->GetBounds();\n    // transform the polydata to be centered over the pick position\n    double center[3] = {0.5 * (bounds[1] + bounds[0]),\n                        0.5 * (bounds[3] + bounds[2]), 0.0};\n\n    vtkNew<vtkTransform> trans;\n    trans->Translate(-center[0], -center[1], 0);\n    trans->Translate(p[0], p[1], 0);\n\n    vtkNew<vtkTransformPolyDataFilter> tpd;\n    tpd->SetTransform(trans);\n    tpd->SetInputConnection(textSource->GetOutputPort());\n\n    // Create a mapper\n    vtkNew<vtkPolyDataMapper2D> mapper;\n    vtkNew<vtkCoordinate> coordinate;\n    coordinate->SetCoordinateSystemToWorld();\n    mapper->SetTransformCoordinate(coordinate);\n    mapper->SetInputConnection(tpd->GetOutputPort());\n\n    vtkNew<vtkActor2D> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n    this->CurrentRenderer->AddViewProp(actor);\n    this->Numbers.push_back(actor);\n  }\n};\n\nvtkStandardNewMacro(MyStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"DimGray\").GetData();\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color2 = colors->GetColor3ub(\"HotPink\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create a blank, black image\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 20, 0, 50, 0, 0);\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(0, 20, 0, 50);\n\n  // Draw a circle of radius 5 centered at (9,10)\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(9, 10, 5);\n  drawing->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(drawing->GetOutputPort());\n  actor->InterpolateOff();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MarkKeypoints\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SkyBlue\").GetData());\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<MyStyle> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->SetDefaultRenderer(renderer);\n  style->SetCurrentRenderer(renderer);\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/MarkKeypoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarkKeypoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarkKeypoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarkKeypoints MACOSX_BUNDLE MarkKeypoints.cxx )\n  target_link_libraries(MarkKeypoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarkKeypoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/MarkKeypoints/#download-and-build-markkeypoints","title":"Download and Build MarkKeypoints","text":"

Click here to download MarkKeypoints and its CMakeLists.txt file. Once the tarball MarkKeypoints.tar has been downloaded and extracted,

cd MarkKeypoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MarkKeypoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/NegativeIndices/","title":"NegativeIndices","text":"

vtk-examples/Cxx/Images/NegativeIndices

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/NegativeIndices/#code","title":"Code","text":"

NegativeIndices.cxx

#include <vtkImageData.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // Create the image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetExtent(-5, 5, -5, 5, -5, 5);\n\n  // Fill every entry of the image data with \"2.0\"\n  int* extent = imageData->GetExtent();\n\n  imageData->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  std::cout << \"Extent: \"\n            << \" xmin: \" << extent[0] << \" xmax: \" << extent[1]\n            << \" ymin: \" << extent[2] << \" ymax: \" << extent[3]\n            << \" zmin: \" << extent[4] << \" zmax: \" << extent[5] << std::endl;\n\n  for (int z = extent[4]; z < extent[5]; z++)\n  {\n    for (int y = extent[2]; y < extent[3]; y++)\n    {\n      for (int x = extent[0]; x < extent[1]; x++)\n      {\n        imageData->SetScalarComponentFromDouble(x, y, z, 0, 2.0);\n      }\n    }\n  }\n\n  // Retrieve the entries from the image data and print them to the screen\n  for (int z = extent[4]; z < extent[5]; z++)\n  {\n    for (int y = extent[2]; y < extent[3]; y++)\n    {\n      for (int x = extent[0]; x < extent[1]; x++)\n      {\n        // Zero is the component, add another loop if you have more\n        // than one component\n        double v = imageData->GetScalarComponentAsDouble(x, y, z, 0);\n        // Eo something with v\n        std::cout << v << \" \";\n      }\n      std::cout << std::endl;\n    }\n    std::cout << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/NegativeIndices/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NegativeIndices)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NegativeIndices: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NegativeIndices MACOSX_BUNDLE NegativeIndices.cxx )\n  target_link_libraries(NegativeIndices PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NegativeIndices\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/NegativeIndices/#download-and-build-negativeindices","title":"Download and Build NegativeIndices","text":"

Click here to download NegativeIndices and its CMakeLists.txt file. Once the tarball NegativeIndices.tar has been downloaded and extracted,

cd NegativeIndices/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./NegativeIndices\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/PickPixel/","title":"PickPixel","text":"

vtk-examples/Cxx/Images/PickPixel

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/PickPixel/#description","title":"Description","text":"

This example demonstrates how to continuously retrieve pixel values using the mouse.

  • Contributed by: Dean Inglis

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/PickPixel/#code","title":"Code","text":"

PickPixel.cxx

#include <vtkAssemblyPath.h>\n#include <vtkCell.h>\n#include <vtkCommand.h>\n#include <vtkCornerAnnotation.h>\n#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageViewer2.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPropPicker.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n\n// The mouse motion callback, to pick the image and recover pixel values.\nclass vtkImageInteractionCallback1 : public vtkCommand\n{\npublic:\n  static vtkImageInteractionCallback1* New()\n  {\n    return new vtkImageInteractionCallback1;\n  }\n\n  vtkImageInteractionCallback1()\n  {\n    this->Viewer = 0;\n    this->Picker = 0;\n    this->Annotation = 0;\n    this->PointData = vtkPointData::New();\n  }\n\n  ~vtkImageInteractionCallback1()\n  {\n    this->Viewer = 0;\n    this->Picker = 0;\n    this->Annotation = 0;\n    this->PointData->Delete();\n  }\n\n  void SetPicker(vtkPropPicker* picker)\n  {\n    this->Picker = picker;\n  }\n\n  void SetAnnotation(vtkCornerAnnotation* annotation)\n  {\n    this->Annotation = annotation;\n  }\n\n  void SetViewer(vtkImageViewer2* viewer)\n  {\n    this->Viewer = viewer;\n  }\n\n  virtual void Execute(vtkObject*, unsigned long vtkNotUsed(event), void*)\n  {\n    // this->Viewer;\n    vtkRenderWindowInteractor* interactor =\n        this->Viewer->GetRenderWindow()->GetInteractor();\n    vtkRenderer* renderer = this->Viewer->GetRenderer();\n    vtkImageActor* actor = this->Viewer->GetImageActor();\n    vtkImageData* image = this->Viewer->GetInput();\n    vtkInteractorStyle* style =\n        dynamic_cast<vtkInteractorStyle*>(interactor->GetInteractorStyle());\n\n    // Pick at the mouse location provided by the interactor.\n    this->Picker->Pick(interactor->GetEventPosition()[0],\n                       interactor->GetEventPosition()[1], 0.0, renderer);\n\n    // There could be other props assigned to this picker, so\n    // make sure we picked the image actor.\n    vtkAssemblyPath* path = this->Picker->GetPath();\n    bool validPick = false;\n\n    if (path)\n    {\n      vtkCollectionSimpleIterator sit;\n      path->InitTraversal(sit);\n      // vtkAssemblyNode *node;\n      for (int i = 0; i < path->GetNumberOfItems() && !validPick; ++i)\n      {\n        auto node = path->GetNextNode(sit);\n        if (actor == dynamic_cast<vtkImageActor*>(node->GetViewProp()))\n        {\n          validPick = true;\n        }\n      }\n    }\n\n    if (!validPick)\n    {\n      this->Annotation->SetText(0, \"Off Image\");\n      interactor->Render();\n      // Pass the event further on.\n      style->OnMouseMove();\n      return;\n    }\n\n    // Get the world coordinates of the pick.\n    double pos[3];\n    this->Picker->GetPickPosition(pos);\n    // Fixes some numerical problems with the picking.\n    double* bounds = actor->GetDisplayBounds();\n    int axis = this->Viewer->GetSliceOrientation();\n    pos[axis] = bounds[2 * axis];\n\n    vtkPointData* pd = image->GetPointData();\n    if (!pd)\n    {\n      return;\n    }\n\n    this->PointData->InterpolateAllocate(pd, 1, 1);\n\n    // Use tolerance as a function of size of source data.\n    double tol2 = image->GetLength();\n    tol2 = tol2 ? tol2 * tol2 / 1000.0 : 0.001;\n\n    // Find the cell that contains pos.\n    int subId;\n    double pcoords[3], weights[8];\n    vtkCell* cell =\n        image->FindAndGetCell(pos, NULL, -1, tol2, subId, pcoords, weights);\n    if (cell)\n    {\n      // Interpolate the point data.\n      this->PointData->InterpolatePoint(pd, 0, cell->PointIds, weights);\n      int components = this->PointData->GetScalars()->GetNumberOfComponents();\n      double* tuple = this->PointData->GetScalars()->GetTuple(0);\n\n      std::string message = \"Location: ( \";\n      message += vtkVariant(pos[0]).ToString();\n      message += \", \";\n      message += vtkVariant(pos[1]).ToString();\n      message += \", \";\n      message += vtkVariant(pos[2]).ToString();\n      message += \" )\\nValue: ( \";\n\n      for (int c = 0; c < components; ++c)\n      {\n        message += vtkVariant(tuple[c]).ToString();\n        if (c != components - 1)\n        {\n          message += \", \";\n        }\n      }\n      message += \" )\";\n      this->Annotation->SetText(0, message.c_str());\n      interactor->Render();\n      style->OnMouseMove();\n    }\n  }\n\nprivate:\n  // Pointer to the viewer.\n  vtkImageViewer2* Viewer;\n\n  // Pointer to the picke.r\n  vtkPropPicker* Picker;\n\n  // Pointer to the annotation.\n  vtkCornerAnnotation* Annotation;\n\n  // Interpolator.\n  vtkPointData* PointData;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  // Picker to pick pixels.\n  vtkNew<vtkPropPicker> propPicker;\n  propPicker->PickFromListOn();\n\n  // Give the picker a prop to pick.\n  vtkNew<vtkImageViewer2> imageViewer;\n  propPicker->AddPickList(imageViewer->GetImageActor());\n\n  // Visualize.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->SetSize(600, 600);\n  imageViewer->GetRenderWindow()->SetWindowName(\"PickPixel\");\n\n  vtkRenderer* renderer = imageViewer->GetRenderer();\n  renderer->ResetCamera();\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Annotate the image with window/level and mouse over pixel information.\n  vtkNew<vtkCornerAnnotation> cornerAnnotation;\n  cornerAnnotation->SetLinearFontScaleFactor(2);\n  cornerAnnotation->SetNonlinearFontScaleFactor(1);\n  cornerAnnotation->SetMaximumFontSize(20);\n  cornerAnnotation->SetText(0, \"Off Image\");\n  cornerAnnotation->SetText(3, \"<window>\\n<level>\");\n  cornerAnnotation->GetTextProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  imageViewer->GetRenderer()->AddViewProp(cornerAnnotation);\n\n  // Callback listens to MouseMoveEvents invoked by the interactor's style.\n  vtkNew<vtkImageInteractionCallback1> callback;\n  callback->SetViewer(imageViewer);\n  callback->SetAnnotation(cornerAnnotation);\n  callback->SetPicker(propPicker);\n\n  // InteractorStyleImage allows for the following controls:\n  // 1) middle mouse + move = camera pan\n  // 2) left mouse + move = window/level\n  // 3) right mouse + move = camera zoom\n  // 4) middle mouse wheel scroll = zoom\n  // 5) 'r' = reset window/level\n  // 6) shift + 'r' = reset camera\n  vtkInteractorStyleImage* imageStyle = imageViewer->GetInteractorStyle();\n  imageStyle->AddObserver(vtkCommand::MouseMoveEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/PickPixel/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PickPixel)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PickPixel: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PickPixel MACOSX_BUNDLE PickPixel.cxx )\n  target_link_libraries(PickPixel PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PickPixel\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/PickPixel/#download-and-build-pickpixel","title":"Download and Build PickPixel","text":"

Click here to download PickPixel and its CMakeLists.txt file. Once the tarball PickPixel.tar has been downloaded and extracted,

cd PickPixel/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PickPixel\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/PickPixel2/","title":"PickPixel2","text":"

vtk-examples/Cxx/Images/PickPixel2

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/PickPixel2/#description","title":"Description","text":"

This example demonstrates how to continuously retrieve pixel values using the mouse.

This example is a slight modification of the existing example PickPixel. The main difference is the display of the exact pixel coordinates and values instead of interpolated values.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/PickPixel2/#code","title":"Code","text":"

PickPixel2.cxx

#include <vtkAssemblyPath.h>\n#include <vtkCell.h>\n#include <vtkCommand.h>\n#include <vtkCornerAnnotation.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageNoiseSource.h>\n#include <vtkImageViewer2.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPropPicker.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTIFFReader.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n\n// Template for image value reading.\ntemplate <typename T>\nvoid vtkValueMessageTemplate(vtkImageData* image, int* position,\n                             std::string& message)\n{\n  T* tuple = ((T*)image->GetScalarPointer(position));\n  int components = image->GetNumberOfScalarComponents();\n  for (int c = 0; c < components; ++c)\n  {\n    message += vtkVariant(tuple[c]).ToString();\n    if (c != (components - 1))\n    {\n      message += \", \";\n    }\n  }\n  message += \" )\";\n}\n\n// The mouse motion callback, to pick the image and recover pixel values.\nclass vtkImageInteractionCallback : public vtkCommand\n{\npublic:\n  static vtkImageInteractionCallback* New()\n  {\n    return new vtkImageInteractionCallback;\n  }\n\n  vtkImageInteractionCallback()\n  {\n    this->Viewer = NULL;\n    this->Picker = NULL;\n    this->Annotation = NULL;\n  }\n\n  ~vtkImageInteractionCallback()\n  {\n    this->Viewer = NULL;\n    this->Picker = NULL;\n    this->Annotation = NULL;\n  }\n\n  void SetPicker(vtkPropPicker* picker)\n  {\n    this->Picker = picker;\n  }\n\n  void SetAnnotation(vtkCornerAnnotation* annotation)\n  {\n    this->Annotation = annotation;\n  }\n\n  void SetViewer(vtkImageViewer2* viewer)\n  {\n    this->Viewer = viewer;\n  }\n\n  virtual void Execute(vtkObject*, unsigned long vtkNotUsed(event), void*)\n  {\n    vtkRenderWindowInteractor* interactor =\n        this->Viewer->GetRenderWindow()->GetInteractor();\n    vtkRenderer* renderer = this->Viewer->GetRenderer();\n    vtkImageActor* actor = this->Viewer->GetImageActor();\n    vtkImageData* image = this->Viewer->GetInput();\n    vtkInteractorStyle* style =\n        dynamic_cast<vtkInteractorStyle*>(interactor->GetInteractorStyle());\n\n    // Pick at the mouse location provided by the interactor.\n    this->Picker->Pick(interactor->GetEventPosition()[0],\n                       interactor->GetEventPosition()[1], 0.0, renderer);\n\n    // There could be other props assigned to this picker, so\n    // make sure we picked the image actor.\n    vtkAssemblyPath* path = this->Picker->GetPath();\n    bool validPick = false;\n\n    if (path)\n    {\n      vtkCollectionSimpleIterator sit;\n      path->InitTraversal(sit);\n      for (int i = 0; i < path->GetNumberOfItems() && !validPick; ++i)\n      {\n        auto node = path->GetNextNode(sit);\n        if (actor == dynamic_cast<vtkImageActor*>(node->GetViewProp()))\n        {\n          validPick = true;\n        }\n      }\n    }\n\n    if (!validPick)\n    {\n      this->Annotation->SetText(0, \"Off Image\");\n      interactor->Render();\n      // Pass the event further on.\n      style->OnMouseMove();\n      return;\n    }\n\n    // Get the world coordinates of the pick.\n    double pos[3];\n    this->Picker->GetPickPosition(pos);\n\n    int image_coordinate[3];\n\n    int axis = this->Viewer->GetSliceOrientation();\n    switch (axis)\n    {\n    case vtkImageViewer2::SLICE_ORIENTATION_XZ:\n      image_coordinate[0] = vtkMath::Round(pos[0]);\n      image_coordinate[1] = this->Viewer->GetSlice();\n      image_coordinate[2] = vtkMath::Round(pos[2]);\n      break;\n    case vtkImageViewer2::SLICE_ORIENTATION_YZ:\n      image_coordinate[0] = this->Viewer->GetSlice();\n      image_coordinate[1] = vtkMath::Round(pos[0]);\n      image_coordinate[2] = vtkMath::Round(pos[1]);\n      break;\n    default: // vtkImageViewer2::SLICE_ORIENTATION_XY\n      image_coordinate[0] = vtkMath::Round(pos[0]);\n      image_coordinate[1] = vtkMath::Round(pos[1]);\n      image_coordinate[2] = this->Viewer->GetSlice();\n      break;\n    }\n\n    std::string message = \"Location: ( \";\n    message += vtkVariant(image_coordinate[0]).ToString();\n    message += \", \";\n    message += vtkVariant(image_coordinate[1]).ToString();\n    message += \", \";\n    message += vtkVariant(image_coordinate[2]).ToString();\n    message += \" )\\nValue: ( \";\n\n    switch (image->GetScalarType())\n    {\n      vtkTemplateMacro(\n          (vtkValueMessageTemplate<VTK_TT>(image, image_coordinate, message)));\n\n    default:\n      return;\n    }\n\n    this->Annotation->SetText(0, message.c_str());\n    interactor->Render();\n    style->OnMouseMove();\n  }\n\nprivate:\n  vtkImageViewer2* Viewer;         // Pointer to the viewer\n  vtkPropPicker* Picker;           // Pointer to the picker\n  vtkCornerAnnotation* Annotation; // Pointer to the annotation\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << argv[0]\n              << \" Required parameters: (tif) Filename e.g. ColorCells.tif\"\n              << std::endl\n              << \"missing...\" << std::endl;\n    std::cout << \"A noise image will be created!\" << std::endl;\n\n    // Create a noise image.\n    vtkNew<vtkImageNoiseSource> noiseSource;\n    noiseSource->SetWholeExtent(0, 512, 0, 512, 0, 0);\n    noiseSource->SetMinimum(0.0);\n    noiseSource->SetMaximum(255.0);\n\n    // Cast noise image to unsigned char.\n    vtkNew<vtkImageCast> imageCast;\n    imageCast->SetInputConnection(noiseSource->GetOutputPort());\n    imageCast->SetOutputScalarTypeToUnsignedChar();\n    imageCast->Update();\n\n    // Connect to image viewer pipeline.\n    imageViewer->SetInputConnection(imageCast->GetOutputPort());\n  }\n  else\n  {\n    // Parse input argument.\n    std::string inputFilename = argv[1];\n\n    // Read the image.\n    vtkNew<vtkTIFFReader> tiffReader;\n    if (!tiffReader->CanReadFile(inputFilename.c_str()))\n    {\n      std::cout << argv[0] << \": Error reading file \" << inputFilename\n                << std::endl;\n      return EXIT_FAILURE;\n    }\n    tiffReader->SetFileName(inputFilename.c_str());\n\n    // Connect to image viewer pipeline.\n    imageViewer->SetInputConnection(tiffReader->GetOutputPort());\n  }\n\n  // Picker to pick pixels.\n  vtkNew<vtkPropPicker> propPicker;\n  propPicker->PickFromListOn();\n\n  // Give the picker a prop to pick.\n  vtkImageActor* imageActor = imageViewer->GetImageActor();\n  propPicker->AddPickList(imageActor);\n\n  // Disable interpolation, so we can see each pixel.\n  imageActor->InterpolateOff();\n\n  // Visualize.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->SetSize(600, 600);\n  imageViewer->GetRenderWindow()->SetWindowName(\"PickPixel2\");\n\n  vtkRenderer* renderer = imageViewer->GetRenderer();\n  renderer->ResetCamera();\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Annotate the image with window/level and mouse over pixel\n  // information\n  vtkNew<vtkCornerAnnotation> cornerAnnotation;\n  cornerAnnotation->SetLinearFontScaleFactor(2);\n  cornerAnnotation->SetNonlinearFontScaleFactor(1);\n  cornerAnnotation->SetMaximumFontSize(20);\n  cornerAnnotation->SetText(0, \"Off Image\");\n  cornerAnnotation->SetText(3, \"<window>\\n<level>\");\n  cornerAnnotation->GetTextProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  imageViewer->GetRenderer()->AddViewProp(cornerAnnotation);\n\n  // Callback listens to MouseMoveEvents invoked by the interactor's style\n  vtkNew<vtkImageInteractionCallback> callback;\n  callback->SetViewer(imageViewer);\n  callback->SetAnnotation(cornerAnnotation);\n  callback->SetPicker(propPicker);\n\n  // InteractorStyleImage allows for the following controls:\n  // 1) middle mouse + move = camera pan\n  // 2) left mouse + move = window/level\n  // 3) right mouse + move = camera zoom\n  // 4) middle mouse wheel scroll = zoom\n  // 5) 'r' = reset window/level\n  // 6) shift + 'r' = reset camera\n  vtkInteractorStyleImage* imageStyle = imageViewer->GetInteractorStyle();\n  imageStyle->AddObserver(vtkCommand::MouseMoveEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/PickPixel2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PickPixel2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PickPixel2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PickPixel2 MACOSX_BUNDLE PickPixel2.cxx )\n  target_link_libraries(PickPixel2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PickPixel2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/PickPixel2/#download-and-build-pickpixel2","title":"Download and Build PickPixel2","text":"

Click here to download PickPixel2 and its CMakeLists.txt file. Once the tarball PickPixel2.tar has been downloaded and extracted,

cd PickPixel2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PickPixel2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/RGBToHSI/","title":"RGBToHSI","text":"

vtk-examples/Cxx/Images/RGBToHSI

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/RGBToHSI/#description","title":"Description","text":"

Convert RGB channels to HSI channels. See this article for a description of the HSI colormodel.

Seealso

RGBToYIQ and RGBToHSV

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/RGBToHSI/#code","title":"Code","text":"

RGBToHSI.cxx

#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageRGBToHSI.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \"image e.g. Gourds2.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageRGBToHSI> hsiFilter;\n  hsiFilter->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageExtractComponents> extractHFilter;\n  extractHFilter->SetInputConnection(hsiFilter->GetOutputPort());\n  extractHFilter->SetComponents(0);\n\n  vtkNew<vtkImageExtractComponents> extractSFilter;\n  extractSFilter->SetInputConnection(hsiFilter->GetOutputPort());\n  extractSFilter->SetComponents(1);\n\n  vtkNew<vtkImageExtractComponents> extractIFilter;\n  extractIFilter->SetInputConnection(hsiFilter->GetOutputPort());\n  extractIFilter->SetComponents(2);\n\n  // Create actors.\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> hActor;\n  hActor->GetMapper()->SetInputConnection(extractHFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> sActor;\n  sActor->GetMapper()->SetInputConnection(extractSFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> iActor;\n  iActor->GetMapper()->SetInputConnection(extractIFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double hViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double sViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double iViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Shared camera.\n  vtkNew<vtkCamera> sharedCamera;\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->SetActiveCamera(sharedCamera);\n  inputRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> hRenderer;\n  hRenderer->SetViewport(hViewport);\n  hRenderer->AddActor(hActor);\n  hRenderer->SetActiveCamera(sharedCamera);\n  hRenderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> sRenderer;\n  sRenderer->SetViewport(sViewport);\n  sRenderer->AddActor(sActor);\n  sRenderer->SetActiveCamera(sharedCamera);\n  sRenderer->SetBackground(colors->GetColor3d(\"LavenderBlush\").GetData());\n\n  vtkNew<vtkRenderer> iRenderer;\n  iRenderer->SetViewport(iViewport);\n  iRenderer->AddActor(iActor);\n  iRenderer->SetActiveCamera(sharedCamera);\n  iRenderer->SetBackground(colors->GetColor3d(\"Lavender\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->SetWindowName(\"RGBToHSI\");\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(hRenderer);\n  renderWindow->AddRenderer(sRenderer);\n  renderWindow->AddRenderer(iRenderer);\n  inputRenderer->ResetCamera();\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/RGBToHSI/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RGBToHSI)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RGBToHSI: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RGBToHSI MACOSX_BUNDLE RGBToHSI.cxx )\n  target_link_libraries(RGBToHSI PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RGBToHSI\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/RGBToHSI/#download-and-build-rgbtohsi","title":"Download and Build RGBToHSI","text":"

Click here to download RGBToHSI and its CMakeLists.txt file. Once the tarball RGBToHSI.tar has been downloaded and extracted,

cd RGBToHSI/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RGBToHSI\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/RGBToHSV/","title":"RGBToHSV","text":"

vtk-examples/Cxx/Images/RGBToHSV

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/RGBToHSV/#description","title":"Description","text":"

Convert RGB channels to HSV channels. See this article for a description of the RGB colormodel.

Seealso

RGBToYIQ and RGBToHSI

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/RGBToHSV/#code","title":"Code","text":"

RGBToHSV.cxx

#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageRGBToHSV.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \"image e.g. Gourds2.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageRGBToHSV> hsvFilter;\n  hsvFilter->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageExtractComponents> extractHueFilter;\n  extractHueFilter->SetInputConnection(hsvFilter->GetOutputPort());\n  extractHueFilter->SetComponents(0);\n\n  vtkNew<vtkImageExtractComponents> extractSaturationFilter;\n  extractSaturationFilter->SetInputConnection(hsvFilter->GetOutputPort());\n  extractSaturationFilter->SetComponents(1);\n\n  vtkNew<vtkImageExtractComponents> extractValueFilter;\n  extractValueFilter->SetInputConnection(hsvFilter->GetOutputPort());\n  extractValueFilter->SetComponents(2);\n\n  // Create actors.\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> hActor;\n  hActor->GetMapper()->SetInputConnection(extractHueFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> sActor;\n  sActor->GetMapper()->SetInputConnection(\n      extractSaturationFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> vActor;\n  vActor->GetMapper()->SetInputConnection(extractValueFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double hViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double sViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double vViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Shared camera.\n  vtkNew<vtkCamera> sharedCamera;\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->SetActiveCamera(sharedCamera);\n  inputRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> hRenderer;\n  hRenderer->SetViewport(hViewport);\n  hRenderer->AddActor(hActor);\n  hRenderer->SetActiveCamera(sharedCamera);\n  hRenderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> sRenderer;\n  sRenderer->SetViewport(sViewport);\n  sRenderer->AddActor(sActor);\n  sRenderer->SetActiveCamera(sharedCamera);\n  sRenderer->SetBackground(colors->GetColor3d(\"LavenderBlush\").GetData());\n\n  vtkNew<vtkRenderer> vRenderer;\n  vRenderer->SetViewport(vViewport);\n  vRenderer->AddActor(vActor);\n  vRenderer->SetActiveCamera(sharedCamera);\n  vRenderer->SetBackground(colors->GetColor3d(\"Lavender\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->SetWindowName(\"RGBToHSV\");\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(hRenderer);\n  renderWindow->AddRenderer(sRenderer);\n  renderWindow->AddRenderer(vRenderer);\n  inputRenderer->ResetCamera();\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/RGBToHSV/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RGBToHSV)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RGBToHSV: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RGBToHSV MACOSX_BUNDLE RGBToHSV.cxx )\n  target_link_libraries(RGBToHSV PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RGBToHSV\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/RGBToHSV/#download-and-build-rgbtohsv","title":"Download and Build RGBToHSV","text":"

Click here to download RGBToHSV and its CMakeLists.txt file. Once the tarball RGBToHSV.tar has been downloaded and extracted,

cd RGBToHSV/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RGBToHSV\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/RGBToYIQ/","title":"RGBToYIQ","text":"

vtk-examples/Cxx/Images/RGBToYIQ

"},{"location":"Cxx/Images/RGBToYIQ/#description","title":"Description","text":"

Convert RGB channels to YIQ channels. See this article for a description of the YIQ colormodel.

Seealso

RGBToHSV and RGBToHSI

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/RGBToYIQ/#code","title":"Code","text":"

RGBToYIQ.cxx

#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageRGBToYIQ.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \"image e.g. Gourds2.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageRGBToYIQ> yiqFilter;\n  yiqFilter->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageExtractComponents> extractYFilter;\n  extractYFilter->SetInputConnection(yiqFilter->GetOutputPort());\n  extractYFilter->SetComponents(0);\n\n  vtkNew<vtkImageExtractComponents> extractIFilter;\n  extractIFilter->SetInputConnection(yiqFilter->GetOutputPort());\n  extractIFilter->SetComponents(1);\n\n  vtkNew<vtkImageExtractComponents> extractQFilter;\n  extractQFilter->SetInputConnection(yiqFilter->GetOutputPort());\n  extractQFilter->SetComponents(2);\n\n  // Create actors.\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> yActor;\n  yActor->GetMapper()->SetInputConnection(extractYFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> iActor;\n  iActor->GetMapper()->SetInputConnection(extractIFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> qActor;\n  qActor->GetMapper()->SetInputConnection(extractQFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double yViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double iViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double qViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Shared camera.\n  vtkNew<vtkCamera> sharedCamera;\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->SetActiveCamera(sharedCamera);\n  inputRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> yRenderer;\n  yRenderer->SetViewport(yViewport);\n  yRenderer->AddActor(yActor);\n  yRenderer->SetActiveCamera(sharedCamera);\n  yRenderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> iRenderer;\n  iRenderer->SetViewport(iViewport);\n  iRenderer->AddActor(iActor);\n  iRenderer->SetActiveCamera(sharedCamera);\n  iRenderer->SetBackground(colors->GetColor3d(\"LavenderBlush\").GetData());\n\n  vtkNew<vtkRenderer> qRenderer;\n  qRenderer->SetViewport(qViewport);\n  qRenderer->AddActor(qActor);\n  qRenderer->SetActiveCamera(sharedCamera);\n  qRenderer->SetBackground(colors->GetColor3d(\"Lavender\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->SetWindowName(\"RGBToYIQ\");\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(yRenderer);\n  renderWindow->AddRenderer(iRenderer);\n  renderWindow->AddRenderer(qRenderer);\n  inputRenderer->ResetCamera();\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/RGBToYIQ/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RGBToYIQ)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RGBToYIQ: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RGBToYIQ MACOSX_BUNDLE RGBToYIQ.cxx )\n  target_link_libraries(RGBToYIQ PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RGBToYIQ\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/RGBToYIQ/#download-and-build-rgbtoyiq","title":"Download and Build RGBToYIQ","text":"

Click here to download RGBToYIQ and its CMakeLists.txt file. Once the tarball RGBToYIQ.tar has been downloaded and extracted,

cd RGBToYIQ/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RGBToYIQ\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/RTAnalyticSource/","title":"RTAnalyticSource","text":"

vtk-examples/Cxx/Images/RTAnalyticSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/RTAnalyticSource/#code","title":"Code","text":"

RTAnalyticSource.cxx

#include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRTAnalyticSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRTAnalyticSource> analyticSource;\n  analyticSource->SetWholeExtent(-10, 10, -10, 10, 0, 0);\n\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputConnection(analyticSource->GetOutputPort());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"RTAnalyticSource\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderWindow->AddRenderer(renderer);\n\n  renderer->AddActor(imageActor);\n\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/RTAnalyticSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RTAnalyticSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RTAnalyticSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RTAnalyticSource MACOSX_BUNDLE RTAnalyticSource.cxx )\n  target_link_libraries(RTAnalyticSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RTAnalyticSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/RTAnalyticSource/#download-and-build-rtanalyticsource","title":"Download and Build RTAnalyticSource","text":"

Click here to download RTAnalyticSource and its CMakeLists.txt file. Once the tarball RTAnalyticSource.tar has been downloaded and extracted,

cd RTAnalyticSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RTAnalyticSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ResizeImage/","title":"ResizeImage","text":"

vtk-examples/Cxx/Images/ResizeImage

"},{"location":"Cxx/Images/ResizeImage/#description","title":"Description","text":"

Resize an image using a sinc interpolator. Without command line arguments, the example resizes a synthetic image. An image file can be passed on the command lines. The new dimensions can also be passed as well as an integer specifying the window for sinc interpolator. See vtkImageSincInterpolator for details. A -1 turns off interpolation.

Several window functions are provided. See this article for a description og window functions.

vtkImageResize maintains the physical size of the image.

Note

This example was inspired by a question asked by Qiang Wang.

Seealso

The paper \"Some windows with very good sidelobe behavior\" describes the windows implemented in vtkImageSincInterpolator.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ResizeImage/#code","title":"Code","text":"

ResizeImage.cxx

#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageResize.h>\n#include <vtkImageSincInterpolator.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkImageData> imageData;\n\n  int newSize[2] = {200, 10};\n  int windowFunction = 0;\n\n  // Verify input arguments\n  // e.g. Gourds2.jpg 1280 1024 5\n  if (argc > 1)\n  {\n    // Read the image\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> reader;\n    reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    imageData = reader->GetOutput();\n\n    if (argc > 3)\n    {\n      newSize[0] = atoi(argv[2]);\n      newSize[1] = atoi(argv[3]);\n    }\n    if (argc > 4)\n    {\n      windowFunction = atoi(argv[4]);\n    }\n  }\n  else\n  {\n    std::array<double, 3> drawColor1{0, 0, 0};\n    auto color1 = colors->GetColor3ub(\"Gray\").GetData();\n    std::array<double, 3> drawColor2{0, 0, 0};\n    auto color2 = colors->GetColor3ub(\"Aquamarine\").GetData();\n    std::array<double, 3> drawColor3{0, 0, 0};\n    auto color3 = colors->GetColor3ub(\"Violet\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n      drawColor3[i] = color3[i];\n    }\n\n    vtkNew<vtkImageCanvasSource2D> canvasSource;\n    canvasSource->SetExtent(0, 100, 0, 100, 0, 0);\n    canvasSource->SetScalarTypeToUnsignedChar();\n    canvasSource->SetNumberOfScalarComponents(3);\n    canvasSource->SetDrawColor(drawColor1.data());\n    canvasSource->FillBox(0, 100, 0, 100);\n    canvasSource->SetDrawColor(drawColor2.data());\n    canvasSource->FillTriangle(10, 10, 25, 10, 25, 25);\n    canvasSource->SetDrawColor(drawColor3.data());\n    canvasSource->FillTube(75, 75, 0, 75, 5.0);\n    canvasSource->Update();\n    imageData = canvasSource->GetOutput();\n  }\n\n  vtkNew<vtkImageSincInterpolator> interpolator;\n  interpolator->UseWindowParameterOn();\n  if (windowFunction >= 0 && windowFunction <= 10)\n  {\n    interpolator->SetWindowFunction(windowFunction);\n  }\n\n  vtkNew<vtkImageResize> resize;\n  resize->SetInputData(imageData);\n  resize->SetInterpolator(interpolator);\n  resize->SetOutputDimensions(newSize[0], newSize[1], 1);\n  resize->InterpolateOn();\n\n  if (windowFunction < 0)\n  {\n    resize->InterpolateOff();\n    std::cout << \"Using nearest neighbor interpolation\" << std::endl;\n    ;\n  }\n  else\n  {\n    std::cout << \"Using window function : \"\n              << interpolator->GetWindowFunctionAsString() << std::endl;\n    ;\n  }\n\n  // Create an image actor to display the image\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputConnection(resize->GetOutputPort());\n  imageActor->InterpolateOff();\n\n  // Setup renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(5.0);\n  renderer->ResetCameraClippingRange();\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(1280, 1024);\n  renderWindow->SetWindowName(\"ResizeImage\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ResizeImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ResizeImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ResizeImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ResizeImage MACOSX_BUNDLE ResizeImage.cxx )\n  target_link_libraries(ResizeImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ResizeImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ResizeImage/#download-and-build-resizeimage","title":"Download and Build ResizeImage","text":"

Click here to download ResizeImage and its CMakeLists.txt file. Once the tarball ResizeImage.tar has been downloaded and extracted,

cd ResizeImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ResizeImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/ResizeImageDemo/","title":"ResizeImageDemo","text":"

vtk-examples/Cxx/Images/ResizeImageDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/ResizeImageDemo/#code","title":"Code","text":"

ResizeImageDemo.cxx

#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageResize.h>\n#include <vtkImageSincInterpolator.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <array>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkImageData> imageData;\n\n  double factor = .5;\n  int newSize[2];\n\n  // Verify input arguments\n  if (argc > 1)\n  {\n    // Read the image\n    // e.g. Pileated.jpg 3\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> reader;\n    reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    imageData = reader->GetOutput();\n    if (argc > 2)\n    {\n      factor = atof(argv[2]);\n    }\n  }\n  else\n  {\n    std::array<double, 3> drawColor1{0, 0, 0};\n    auto color1 = colors->GetColor3ub(\"Gray\").GetData();\n    std::array<double, 3> drawColor2{0, 0, 0};\n    auto color2 = colors->GetColor3ub(\"Aquamarine\").GetData();\n    std::array<double, 3> drawColor3{0, 0, 0};\n    auto color3 = colors->GetColor3ub(\"Violet\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n      drawColor3[i] = color3[i];\n    }\n\n    vtkNew<vtkImageCanvasSource2D> canvasSource;\n    canvasSource->SetExtent(0, 100, 0, 100, 0, 0);\n    canvasSource->SetScalarTypeToUnsignedChar();\n    canvasSource->SetNumberOfScalarComponents(3);\n    canvasSource->SetDrawColor(drawColor1.data());\n    canvasSource->FillBox(0, 100, 0, 100);\n    canvasSource->SetDrawColor(drawColor2.data());\n    canvasSource->FillTriangle(10, 10, 25, 10, 25, 25);\n    canvasSource->SetDrawColor(drawColor3.data());\n    canvasSource->FillTube(75, 75, 0, 75, 5.0);\n    canvasSource->Update();\n    imageData = canvasSource->GetOutput();\n  }\n\n  std::cout << \"Original dimensions: \" << imageData->GetDimensions()[0] << \", \"\n            << imageData->GetDimensions()[1] << std::endl;\n  newSize[0] = imageData->GetDimensions()[0] * factor;\n  newSize[1] = imageData->GetDimensions()[1] * factor;\n  std::cout << \"New dimensions: \" << newSize[0] << \", \" << newSize[1]\n            << std::endl;\n\n  // One camera for all\n  vtkNew<vtkCamera> camera;\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(20);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ResizeImageDemo\");\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  for (int i = -1; i <= 10; ++i)\n  {\n    vtkNew<vtkImageSincInterpolator> interpolator;\n    auto windowFunction = i;\n    interpolator->UseWindowParameterOn();\n\n    vtkNew<vtkImageResize> resize;\n    resize->SetInputData(imageData);\n    resize->SetInterpolator(interpolator);\n    resize->SetOutputDimensions(newSize[0], newSize[1], 1);\n    resize->InterpolateOn();\n\n    // Create an image actor to display the image\n    vtkNew<vtkImageActor> imageActor;\n    imageActor->GetMapper()->SetInputConnection(resize->GetOutputPort());\n    imageActor->InterpolateOff();\n\n    // Create textActors\n    vtkNew<vtkTextMapper> textMapper;\n    textMapper->SetTextProperty(textProperty);\n    if (windowFunction < 0)\n    {\n      resize->InterpolateOff();\n      textMapper->SetInput(\"Nearest neighbor\");\n    }\n    else\n    {\n      resize->InterpolateOn();\n      interpolator->SetWindowFunction(windowFunction);\n      textMapper->SetInput(interpolator->GetWindowFunctionAsString());\n    }\n\n    vtkNew<vtkActor2D> textActor;\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(100, 16);\n    // Setup renderer\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(imageActor);\n    renderer->AddActor(textActor);\n    ;\n    renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n    renderer->SetActiveCamera(camera);\n    renderer->ResetCamera();\n    renderer->GetActiveCamera()->Dolly(5);\n    renderer->ResetCameraClippingRange();\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n  }\n  // Setup viewports for the renderers\n  int rendererSize = 200;\n  unsigned int xGridDimensions = 4;\n  unsigned int yGridDimensions = 3;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/ResizeImageDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ResizeImageDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ResizeImageDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ResizeImageDemo MACOSX_BUNDLE ResizeImageDemo.cxx )\n  target_link_libraries(ResizeImageDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ResizeImageDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/ResizeImageDemo/#download-and-build-resizeimagedemo","title":"Download and Build ResizeImageDemo","text":"

Click here to download ResizeImageDemo and its CMakeLists.txt file. Once the tarball ResizeImageDemo.tar has been downloaded and extracted,

cd ResizeImageDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ResizeImageDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/StaticImage/","title":"StaticImage","text":"

vtk-examples/Cxx/Images/StaticImage

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/StaticImage/#description","title":"Description","text":"

This example displays an image in a non-interactable window.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/StaticImage/#code","title":"Code","text":"

StaticImage.cxx

#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. Ox.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Visualize.\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  imageViewer->GetRenderWindow()->SetSize(500, 500);\n  imageViewer->GetRenderWindow()->SetWindowName(\"StaticImage\");\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Peru\").GetData());\n  imageViewer->GetRenderer()->ResetCamera();\n\n  // Set up an interactor that does not respond to mouse events.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->GetRenderWindow()->SetInteractor(renderWindowInteractor);\n  renderWindowInteractor->SetInteractorStyle(0);\n  imageViewer->Render();\n\n  // Start the event loop.\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/StaticImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StaticImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StaticImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StaticImage MACOSX_BUNDLE StaticImage.cxx )\n  target_link_libraries(StaticImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StaticImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/StaticImage/#download-and-build-staticimage","title":"Download and Build StaticImage","text":"

Click here to download StaticImage and its CMakeLists.txt file. Once the tarball StaticImage.tar has been downloaded and extracted,

cd StaticImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StaticImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Images/Transparency/","title":"Transparency","text":"

vtk-examples/Cxx/Images/Transparency

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Images/Transparency/#description","title":"Description","text":"

This example creates a half transparent, half green mask and overlays it on top of an input image.

Seealso

ImageTransparency and ImageStencil.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Images/Transparency/#code","title":"Code","text":"

Transparency.cxx

#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.jpg) e.g Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkImageData* image = reader->GetOutput();\n\n  // Create a mask - half of the image should be transparent and the other half\n  // opaque\n  vtkNew<vtkImageData> maskImage;\n  int extent[6];\n  image->GetExtent(extent);\n  maskImage->SetExtent(extent);\n  maskImage->AllocateScalars(VTK_DOUBLE, 1);\n\n  for (int y = extent[2]; y < extent[3]; y++)\n  {\n    for (int x = extent[0]; x < extent[1]; x++)\n    {\n      double* pixel =\n          static_cast<double*>(maskImage->GetScalarPointer(x, y, 0));\n      if (y > (extent[3] - extent[2]) / 2.0)\n      {\n        pixel[0] = 0.0;\n      }\n      else\n      {\n        pixel[0] = 1.0;\n      }\n    }\n  }\n\n  vtkNew<vtkLookupTable> lookupTable;\n  lookupTable->SetNumberOfTableValues(2);\n  lookupTable->SetRange(0.0, 1.0);\n  lookupTable->SetTableValue(0, 0.0, 0.0, 0.0, 0.0); // label 0 is transparent\n  lookupTable->SetTableValue(\n      1,\n      colors->GetColor4d(\"Khaki\").GetData()); // label 1 is opaque and colored\n  lookupTable->Build();\n\n  vtkNew<vtkImageMapToColors> mapTransparency;\n  mapTransparency->SetLookupTable(lookupTable);\n  mapTransparency->PassAlphaToOutputOn();\n  mapTransparency->SetInputData(maskImage);\n\n  // Create actors\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputData(image);\n\n  vtkNew<vtkImageActor> maskActor;\n  maskActor->GetMapper()->SetInputConnection(mapTransparency->GetOutputPort());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageActor);\n  renderer->AddActor(maskActor);\n  renderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Transparency\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Images/Transparency/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Transparency)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Transparency: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Transparency MACOSX_BUNDLE Transparency.cxx )\n  target_link_libraries(Transparency PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Transparency\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Images/Transparency/#download-and-build-transparency","title":"Download and Build Transparency","text":"

Click here to download Transparency and its CMakeLists.txt file. Once the tarball Transparency.tar has been downloaded and extracted,

cd Transparency/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Transparency\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/","title":"BooleanOperationImplicitFunctions","text":"

vtk-examples/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/#description","title":"Description","text":"

Demonstration on how to perform boolean operations with implicit functions.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/#code","title":"Code","text":"

BooleanOperationImplicitFunctions.cxx

#include <vtkActor.h>\n#include <vtkBox.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\nint main(int argc, char* argv[])\n{\n  // Define colors.\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d actorColor = colors->GetColor3d(\"AliceBlue\");\n  vtkColor3d EdgeColour = colors->GetColor3d(\"SteelBlue\");\n  vtkColor3d BackgroundColour = colors->GetColor3d(\"Silver\");\n\n  // Create a sphere.\n  vtkNew<vtkSphere> sphere;\n  sphere->SetCenter(1.0, 0.0, 0.0);\n  sphere->SetRadius(1);\n\n  // Create a box.\n  vtkNew<vtkBox> box;\n  box->SetBounds(-1, 1, -1, 1, -1, 1);\n\n  // Combine the two implicit functions.\n  vtkNew<vtkImplicitBoolean> boolean;\n  boolean->SetOperationTypeToDifference();\n  // boolean->SetOperationTypeToUnion()\n  // boolean->SetOperationTypeToIntersection()\n  boolean->AddFunction(box);\n  boolean->AddFunction(sphere);\n  // The sample function generates a distance function from the implicit\n  // function.This is then contoured to get a polygonal surface.\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetImplicitFunction(boolean);\n  sample->SetModelBounds(-1, 2, -1, 1, -1, 1);\n  sample->SetSampleDimensions(40, 40, 40);\n  sample->ComputeNormalsOff();\n\n  // Contour\n  vtkNew<vtkContourFilter> surface;\n  surface->SetInputConnection(sample->GetOutputPort());\n  surface->SetValue(0, 0.0);\n\n  // Create a mapper and an actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(actorColor.GetData());\n  actor->GetProperty()->SetEdgeColor(EdgeColour.GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(BackgroundColour.GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BooleanOperationImplicitFunctions\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor.\n  renderer->AddActor(actor);\n\n  // Start\n  renderer->GetActiveCamera()->SetPosition(5.0, -4.0, 1.6);\n  renderer->GetActiveCamera()->SetViewUp(0.1, 0.5, 0.9);\n  renderer->GetActiveCamera()->SetDistance(6.7);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BooleanOperationImplicitFunctions)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BooleanOperationImplicitFunctions: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BooleanOperationImplicitFunctions MACOSX_BUNDLE BooleanOperationImplicitFunctions.cxx )\n  target_link_libraries(BooleanOperationImplicitFunctions PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BooleanOperationImplicitFunctions\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/#download-and-build-booleanoperationimplicitfunctions","title":"Download and Build BooleanOperationImplicitFunctions","text":"

Click here to download BooleanOperationImplicitFunctions and its CMakeLists.txt file. Once the tarball BooleanOperationImplicitFunctions.tar has been downloaded and extracted,

cd BooleanOperationImplicitFunctions/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BooleanOperationImplicitFunctions\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImplicitFunctions/ImplicitDataSet/","title":"ImplicitDataSet","text":"

vtk-examples/Cxx/ImplicitFunctions/ImplicitDataSet

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImplicitFunctions/ImplicitDataSet/#code","title":"Code","text":"

ImplicitDataSet.cxx

#include <vtkImageData.h>\n#include <vtkImplicitDataSet.h>\n#include <vtkNew.h>\n#include <vtkRTAnalyticSource.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkRTAnalyticSource> waveletSource;\n  waveletSource->Update();\n\n  vtkNew<vtkImplicitDataSet> implicitWavelet;\n  implicitWavelet->SetDataSet(waveletSource->GetOutput());\n\n  double x[3] = {0.5, 0, 0};\n  // Value should roughly be 258.658.\n  cout << \"x: \" << implicitWavelet->EvaluateFunction(x) << endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImplicitFunctions/ImplicitDataSet/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitDataSet)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  ImagingCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitDataSet: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitDataSet MACOSX_BUNDLE ImplicitDataSet.cxx )\n  target_link_libraries(ImplicitDataSet PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitDataSet\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImplicitFunctions/ImplicitDataSet/#download-and-build-implicitdataset","title":"Download and Build ImplicitDataSet","text":"

Click here to download ImplicitDataSet and its CMakeLists.txt file. Once the tarball ImplicitDataSet.tar has been downloaded and extracted,

cd ImplicitDataSet/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitDataSet\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImplicitFunctions/ImplicitQuadric/","title":"ImplicitQuadric","text":"

vtk-examples/Cxx/ImplicitFunctions/ImplicitQuadric

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImplicitFunctions/ImplicitQuadric/#description","title":"Description","text":"

Create an ellipsoid by using the implicit quadric.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImplicitFunctions/ImplicitQuadric/#code","title":"Code","text":"

ImplicitQuadric.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\n#include <cstdlib>\n\nint main(int argc, char* argv[])\n{\n  // Define colors.\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d actorColor = colors->GetColor3d(\"AliceBlue\");\n  vtkColor3d EdgeColour = colors->GetColor3d(\"SteelBlue\");\n  vtkColor3d BackgroundColour = colors->GetColor3d(\"Silver\");\n\n  // Create a Quadric.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0);\n\n  /*The sample function generates a distance function from the implicit\n        function.This is then contoured to get a polygonal surface.*/\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetImplicitFunction(quadric);\n  sample->SetModelBounds(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5);\n  sample->SetSampleDimensions(40, 40, 40);\n  sample->ComputeNormalsOff();\n\n  // Contour.\n  vtkNew<vtkContourFilter> surface;\n  surface->SetInputConnection(sample->GetOutputPort());\n  surface->SetValue(0, 0.0);\n\n  // Create a mapper and an actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(actorColor.GetData());\n  actor->GetProperty()->SetEdgeColor(EdgeColour.GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(BackgroundColour.GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitQuadric\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  // Add the actor.\n  renderer->AddActor(actor);\n  // Start\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImplicitFunctions/ImplicitQuadric/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitQuadric)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitQuadric: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitQuadric MACOSX_BUNDLE ImplicitQuadric.cxx )\n  target_link_libraries(ImplicitQuadric PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitQuadric\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImplicitFunctions/ImplicitQuadric/#download-and-build-implicitquadric","title":"Download and Build ImplicitQuadric","text":"

Click here to download ImplicitQuadric and its CMakeLists.txt file. Once the tarball ImplicitQuadric.tar has been downloaded and extracted,

cd ImplicitQuadric/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitQuadric\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImplicitFunctions/ImplicitSphere/","title":"ImplicitSphere","text":"

vtk-examples/Cxx/ImplicitFunctions/ImplicitSphere

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImplicitFunctions/ImplicitSphere/#description","title":"Description","text":"

This example creates an isosurface of sampled sphere.

Info

See Figure 6-23b in Chapter 6 the VTK Textbook.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImplicitFunctions/ImplicitSphere/#code","title":"Code","text":"

ImplicitSphere.cxx

#include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\n#include <algorithm>\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkSphere> sphere;\n\n  // Sample the function.\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(sphere);\n  double value = 2.0;\n  double xmin = -value, xmax = value, ymin = -value, ymax = value,\n         zmin = -value, zmax = value;\n  sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n  // Create the 0 isosurface.\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(1, 1, 1);\n\n  // Map the contours to graphical primitives.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contours->GetOutputPort());\n  contourMapper->ScalarVisibilityOff();\n\n  // Create an actor for the contours.\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitSphere\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(contourActor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImplicitFunctions/ImplicitSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitSphere MACOSX_BUNDLE ImplicitSphere.cxx )\n  target_link_libraries(ImplicitSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImplicitFunctions/ImplicitSphere/#download-and-build-implicitsphere","title":"Download and Build ImplicitSphere","text":"

Click here to download ImplicitSphere and its CMakeLists.txt file. Once the tarball ImplicitSphere.tar has been downloaded and extracted,

cd ImplicitSphere/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitSphere\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImplicitFunctions/ImplicitSphere1/","title":"ImplicitSphere1","text":"

vtk-examples/Cxx/ImplicitFunctions/ImplicitSphere1

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/ImplicitFunctions/ImplicitSphere1/#description","title":"Description","text":"

Shows how to create a surface representing a sphere by creating an implicit sphere, sampling the implicit function, and finally contouring the sampled data to produce the surface.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImplicitFunctions/ImplicitSphere1/#code","title":"Code","text":"

ImplicitSphere1.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\n#include <cstdlib>\n\nint main(int argc, char* argv[])\n{\n  // Define colors.\n  auto colors = vtkSmartPointer<vtkNamedColors>::New();\n  vtkColor3d actorColor = colors->GetColor3d(\"AliceBlue\");\n  vtkColor3d EdgeColour = colors->GetColor3d(\"SteelBlue\");\n  vtkColor3d BackgroundColour = colors->GetColor3d(\"Silver\");\n\n  // Create a sphere.\n  auto sphere = vtkSmartPointer<vtkSphere>::New();\n  sphere->SetCenter(0.0, 0.0, 0.0);\n  sphere->SetRadius(0.5);\n\n  /* The sample function generates a distance function from the implicit\n         function.This is then contoured to get a polygonal surface.*/\n  auto sample = vtkSmartPointer<vtkSampleFunction>::New();\n  sample->SetImplicitFunction(sphere);\n  sample->SetModelBounds(-.5, .5, -.5, .5, -.5, .5);\n  sample->SetSampleDimensions(20, 20, 20);\n  sample->ComputeNormalsOff();\n\n  // Contour\n  auto surface = vtkSmartPointer<vtkContourFilter>::New();\n  surface->SetInputConnection(sample->GetOutputPort());\n  surface->SetValue(0, 0.0);\n\n  // Create a mapper and an actor.\n  auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  auto actor = vtkSmartPointer<vtkActor>::New();\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(actorColor.GetData());\n  actor->GetProperty()->SetEdgeColor(EdgeColour.GetData());\n\n  // A renderer and render window.\n  auto renderer = vtkSmartPointer<vtkRenderer>::New();\n  renderer->SetBackground(BackgroundColour.GetData());\n  auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitSphere1\");\n\n  auto renderWindowInteractor =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  // Add the actor.\n  renderer->AddActor(actor);\n  // Start\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImplicitFunctions/ImplicitSphere1/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitSphere1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitSphere1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitSphere1 MACOSX_BUNDLE ImplicitSphere1.cxx )\n  target_link_libraries(ImplicitSphere1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitSphere1\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImplicitFunctions/ImplicitSphere1/#download-and-build-implicitsphere1","title":"Download and Build ImplicitSphere1","text":"

Click here to download ImplicitSphere1 and its CMakeLists.txt file. Once the tarball ImplicitSphere1.tar has been downloaded and extracted,

cd ImplicitSphere1/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitSphere1\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImplicitFunctions/IsoContours/","title":"IsoContours","text":"

vtk-examples/Cxx/ImplicitFunctions/IsoContours

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImplicitFunctions/IsoContours/#code","title":"Code","text":"

IsoContours.cxx

#include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkContourFilter.h>\n#include <vtkImageData.h>\n#include <vtkInteractorStyleUser.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation.h>\n#include <vtkSliderRepresentation3D.h>\n#include <vtkSliderWidget.h>\n#include <vtkXMLImageDataWriter.h>\n\nnamespace {\nvoid CreateData(vtkImageData* data);\n\nclass vtkSliderCallback : public vtkCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value =\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue();\n    this->ContourFilter->GenerateValues(1, value, value);\n  }\n  vtkSliderCallback() : ContourFilter(NULL)\n  {\n  }\n  vtkContourFilter* ContourFilter;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> data;\n  CreateData(data);\n\n  // Create an isosurface.\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetInputData(data);\n  contourFilter->GenerateValues(1, 10,\n                                10); // (numContours, rangeStart, rangeEnd)\n\n  // Map the contours to graphical primitives.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contourFilter->GetOutputPort());\n\n  // Create an actor for the contours.\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n  contourActor->GetProperty()->SetLineWidth(5);\n\n  // Create the outline.\n  vtkNew<vtkOutlineFilter> outlineFilter;\n  outlineFilter->SetInputData(data);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outlineFilter->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Gray\").GetData());\n  outlineActor->GetProperty()->SetLineWidth(3);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"IsoContours\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(contourActor);\n  renderer->AddActor(outlineActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  vtkNew<vtkSliderRepresentation3D> sliderRep;\n  sliderRep->SetMinimumValue(0.0);\n  sliderRep->SetMaximumValue(30.0);\n  sliderRep->SetValue(10.0);\n  sliderRep->SetTitleText(\"Contour value\");\n  sliderRep->SetPoint1InWorldCoordinates(-20, -40, 0);\n  sliderRep->SetPoint2InWorldCoordinates(0, -40, 0);\n  sliderRep->SetSliderWidth(.2);\n  sliderRep->SetLabelHeight(.1);\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(interactor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->ContourFilter = contourFilter;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  vtkNew<vtkInteractorStyleUser> style;\n  interactor->SetInteractorStyle(style);\n\n  renderWindow->SetSize(500, 500);\n  renderWindow->Render();\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateData(vtkImageData* data)\n{\n  data->SetExtent(-25, 25, -25, 25, 0, 0);\n  data->AllocateScalars(VTK_DOUBLE, 1);\n  int* extent = data->GetExtent();\n\n  for (int y = extent[2]; y <= extent[3]; y++)\n  {\n    for (int x = extent[0]; x <= extent[1]; x++)\n    {\n      double* pixel = static_cast<double*>(data->GetScalarPointer(x, y, 0));\n      pixel[0] = sqrt(pow(x, 2.0) + pow(y, 2.0));\n    }\n  }\n\n  vtkNew<vtkXMLImageDataWriter> writer;\n  writer->SetFileName(\"data.vti\");\n  writer->SetInputData(data);\n  writer->Write();\n}\n} // namespace\n
"},{"location":"Cxx/ImplicitFunctions/IsoContours/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IsoContours)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IsoContours: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IsoContours MACOSX_BUNDLE IsoContours.cxx )\n  target_link_libraries(IsoContours PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IsoContours\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImplicitFunctions/IsoContours/#download-and-build-isocontours","title":"Download and Build IsoContours","text":"

Click here to download IsoContours and its CMakeLists.txt file. Once the tarball IsoContours.tar has been downloaded and extracted,

cd IsoContours/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IsoContours\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/ImplicitFunctions/SampleFunction/","title":"SampleFunction","text":"

vtk-examples/Cxx/ImplicitFunctions/SampleFunction

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/ImplicitFunctions/SampleFunction/#code","title":"Code","text":"

SampleFunction.cxx

#include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSuperquadric.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSuperquadric> implicitFunction;\n  implicitFunction->SetPhiRoundness(2.5);\n  implicitFunction->SetThetaRoundness(0.5);\n\n  // Sample the function.\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(implicitFunction);\n  double value = 2.0;\n  double xmin = -value, xmax = value, ymin = -value, ymax = value,\n         zmin = -value, zmax = value;\n  sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n  // Create the 0 isosurface.\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(1, 2.0, 2.0);\n\n  // Map the contours to graphical primitives.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contours->GetOutputPort());\n  contourMapper->SetScalarRange(0.0, 1.2);\n\n  // Create an actor for the contours.\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n\n  // -- create a box around the function to indicate the sampling volume --\n\n  // Create outline.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(sample->GetOutputPort());\n\n  // Map it to graphics primitives.\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  // Create an actor for it.\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Samplefunction\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(contourActor);\n  renderer->AddActor(outlineActor);\n  renderer->SetBackground(colors->GetColor3d(\"Tan\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/ImplicitFunctions/SampleFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SampleFunction)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SampleFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SampleFunction MACOSX_BUNDLE SampleFunction.cxx )\n  target_link_libraries(SampleFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SampleFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/ImplicitFunctions/SampleFunction/#download-and-build-samplefunction","title":"Download and Build SampleFunction","text":"

Click here to download SampleFunction and its CMakeLists.txt file. Once the tarball SampleFunction.tar has been downloaded and extracted,

cd SampleFunction/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SampleFunction\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/ArrayToTable/","title":"ArrayToTable","text":"

vtk-examples/Cxx/InfoVis/ArrayToTable

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/ArrayToTable/#code","title":"Code","text":"

ArrayToTable.cxx

#include <vtkArrayData.h>\n#include <vtkArrayToTable.h>\n#include <vtkDenseArray.h>\n#include <vtkNew.h>\n#include <vtkTable.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDenseArray<int>> array;\n  array->Resize(2, 4);\n\n  // set values\n  std::cout << \"There are \" << array->GetExtents()[0].GetEnd() << std::endl;\n  std::cout << \"There are \" << array->GetExtents()[1].GetEnd() << std::endl;\n\n  for (vtkIdType i = 0; i < array->GetExtents()[0].GetEnd(); i++)\n  {\n    for (vtkIdType j = 0; j < array->GetExtents()[1].GetEnd(); j++)\n    {\n      array->SetValue(i, j, i + j);\n    }\n  }\n\n  vtkNew<vtkArrayData> arrayData;\n  arrayData->AddArray(array);\n\n  vtkNew<vtkArrayToTable> arrayToTable;\n  arrayToTable->SetInputData(arrayData);\n  arrayToTable->Update();\n\n  auto table = arrayToTable->GetOutput();\n  table->Dump();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/ArrayToTable/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ArrayToTable)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ArrayToTable: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ArrayToTable MACOSX_BUNDLE ArrayToTable.cxx )\n  target_link_libraries(ArrayToTable PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ArrayToTable\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/ArrayToTable/#download-and-build-arraytotable","title":"Download and Build ArrayToTable","text":"

Click here to download ArrayToTable and its CMakeLists.txt file. Once the tarball ArrayToTable.tar has been downloaded and extracted,

cd ArrayToTable/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ArrayToTable\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/DelimitedTextReader/","title":"DelimitedTextReader","text":"

vtk-examples/Cxx/InfoVis/DelimitedTextReader

"},{"location":"Cxx/InfoVis/DelimitedTextReader/#description","title":"Description","text":"

This example takes a plain text file of coordinates and normals (x y z nx ny nz) and reads them into a vtkPolyData and displays them on the screen. This can be easily changed to reading a file with any delimiter by changing the argument of Reader->SetFieldDelimiterCharacters(\" \");

Here is an example file:

 0.0 0.0 0.0 1.0 2.0 3.0\n 1.0 0.0 0.0 4.0 5.0 6.1\n 0.0 1.0 0.0 7.2 8.3 9.4\n ```\n!!! question\n    If you have a question about this example, please use the [VTK Discourse Forum](https://discourse.vtk.org/)\n\n###Code\n**DelimitedTextReader.cxx**\n``` c++ hl_lines=\"1 2 3 4 5 6 7 8 9 10 11 12 14 18 30 36 38 39 70 74 79 82 87 88 92\"\n\n#include <vtkActor.h>\n#include <vtkDelimitedTextReader.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersionMacros.h> // For version macros\n#include <vtkVertexGlyphFilter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g DelimitedData.txt\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkDelimitedTextReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->DetectNumericColumnsOn();\n  reader->SetFieldDelimiterCharacters(\" \");\n  reader->Update();\n\n  vtkTable* table = reader->GetOutput();\n\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkDoubleArray> normals;\n\n  normals->SetNumberOfComponents(3); // 3d normals (ie x,y,z)\n\n  std::cout << \"Table has \" << table->GetNumberOfRows() << \" rows.\"\n            << std::endl;\n  std::cout << \"Table has \" << table->GetNumberOfColumns() << \" columns.\"\n            << std::endl;\n\n  for (vtkIdType i = 0; i < table->GetNumberOfRows(); i++)\n  {\n    std::cout << \"x: \" << (table->GetValue(i, 0)).ToDouble()\n              << \" y: \" << (table->GetValue(i, 1)).ToDouble()\n              << \" z: \" << (table->GetValue(i, 2)).ToDouble();\n\n    points->InsertNextPoint((table->GetValue(i, 0)).ToDouble(),\n                            (table->GetValue(i, 1)).ToDouble(),\n                            (table->GetValue(i, 2)).ToDouble());\n\n    double n[3];\n    n[0] = (table->GetValue(i, 3)).ToDouble();\n    n[1] = (table->GetValue(i, 4)).ToDouble();\n    n[2] = (table->GetValue(i, 5)).ToDouble();\n\n    std::cout << \" n: \" << n[0] << \" \" << n[1] << \" \" << n[2] << std::endl;\n    normals->InsertNextTuple(n);\n  }\n\n  std::cout << \"There are \" << points->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->SetNormals(normals);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n  glyphFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(30);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DelimitedTextReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/DelimitedTextReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DelimitedTextReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOInfovis\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DelimitedTextReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DelimitedTextReader MACOSX_BUNDLE DelimitedTextReader.cxx )\n  target_link_libraries(DelimitedTextReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DelimitedTextReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/DelimitedTextReader/#download-and-build-delimitedtextreader","title":"Download and Build DelimitedTextReader","text":"

Click here to download DelimitedTextReader and its CMakeLists.txt file. Once the tarball DelimitedTextReader.tar has been downloaded and extracted,

cd DelimitedTextReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DelimitedTextReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/DelimitedTextWriter/","title":"DelimitedTextWriter","text":"

vtk-examples/Cxx/InfoVis/DelimitedTextWriter

"},{"location":"Cxx/InfoVis/DelimitedTextWriter/#description","title":"Description","text":"

Is the output of

\"\",\"\",\"\"\n0,1,2\n3,4,5\n6,7,8\n

expected? What is the first line indicating? Simply that there are 3 string fields?

With my prior edit, the first line is now \"column-0\",\"column-1\",\"column-2\" -- the first line is the names of the column arrays in the table. I added them to the example because the example was crashing on Windows builds, where streaming a NULL char* is no bueno. (David Cole)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/DelimitedTextWriter/#code","title":"Code","text":"

DelimitedTextWriter.cxx

#include <vtkDelimitedTextWriter.h>\n#include <vtkNew.h>\n#include <vtkTable.h>\n#include <vtkVariantArray.h>\n\n#include <sstream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  std::string outputFilename = \"output.txt\";\n\n  // Use the specified filename if it is provided.\n  if (argc == 2)\n  {\n    outputFilename = argv[1];\n  }\n\n  // Construct an empty table\n  vtkNew<vtkTable> table;\n\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    vtkNew<vtkVariantArray> col;\n\n    std::ostringstream oss;\n    oss << \"column-\" << i;\n    std::string colName = oss.str();\n    col->SetName(colName.c_str());\n\n    col->InsertNextValue(vtkVariant(0.0));\n    col->InsertNextValue(vtkVariant(0.0));\n    col->InsertNextValue(vtkVariant(0.0));\n    table->AddColumn(col);\n  }\n\n  // Fill the table with values\n  unsigned int counter = 0;\n  for (vtkIdType r = 0; r < table->GetNumberOfRows(); r++)\n  {\n    for (vtkIdType c = 0; c < table->GetNumberOfColumns(); c++)\n    {\n      table->SetValue(r, c, vtkVariant(counter));\n      counter++;\n    }\n  }\n\n  vtkNew<vtkDelimitedTextWriter> writer;\n  writer->SetFileName(outputFilename.c_str());\n  writer->SetInputData(table);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/DelimitedTextWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DelimitedTextWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DelimitedTextWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DelimitedTextWriter MACOSX_BUNDLE DelimitedTextWriter.cxx )\n  target_link_libraries(DelimitedTextWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DelimitedTextWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/DelimitedTextWriter/#download-and-build-delimitedtextwriter","title":"Download and Build DelimitedTextWriter","text":"

Click here to download DelimitedTextWriter and its CMakeLists.txt file. Once the tarball DelimitedTextWriter.tar has been downloaded and extracted,

cd DelimitedTextWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DelimitedTextWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/GraphPoints/","title":"GraphPoints","text":"

vtk-examples/Cxx/InfoVis/GraphPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/GraphPoints/#code","title":"Code","text":"

GraphPoints.cxx

#include <vtkGraphLayoutView.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v3);\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  g->SetPoints(points);\n\n  std::cout << \"Number of output points: \"\n            << g->GetPoints()->GetNumberOfPoints() << std::endl;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  graphLayoutView->SetLayoutStrategy(\"Pass Through\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetRenderer()->GradientBackgroundOn();\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"RoyalBlue\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"GraphPoints\");\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/GraphPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GraphPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GraphPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GraphPoints MACOSX_BUNDLE GraphPoints.cxx )\n  target_link_libraries(GraphPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GraphPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/GraphPoints/#download-and-build-graphpoints","title":"Download and Build GraphPoints","text":"

Click here to download GraphPoints and its CMakeLists.txt file. Once the tarball GraphPoints.tar has been downloaded and extracted,

cd GraphPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GraphPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/KMeansClustering/","title":"KMeansClustering","text":"

vtk-examples/Cxx/InfoVis/KMeansClustering

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/InfoVis/KMeansClustering/#description","title":"Description","text":"

This example clusters 3D points using the KMeans algorithm. The points are assigned to a cluster by creating an array with each point's cluster id.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/KMeansClustering/#code","title":"Code","text":"

KMeansClustering.cxx

#include <vtkActor.h>\n#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkKMeansStatistics.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVertexGlyphFilter.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <sstream>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create 2 clusters, one near (0,0,0) and the other near (3,3,3).\n  vtkNew<vtkPoints> points;\n\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(3.0, 3.0, 3.0);\n  points->InsertNextPoint(0.1, 0.1, 0.1);\n  points->InsertNextPoint(3.1, 3.1, 3.1);\n  points->InsertNextPoint(0.2, 0.2, 0.2);\n  points->InsertNextPoint(3.2, 3.2, 3.2);\n\n  // Get the points into the format needed for KMeans.\n  vtkNew<vtkTable> inputData;\n\n  for (int c = 0; c < 3; ++c)\n  {\n    std::stringstream colName;\n    colName << \"coord \" << c;\n    vtkNew<vtkDoubleArray> doubleArray;\n    doubleArray->SetNumberOfComponents(1);\n    doubleArray->SetName(colName.str().c_str());\n    doubleArray->SetNumberOfTuples(points->GetNumberOfPoints());\n\n    for (int r = 0; r < points->GetNumberOfPoints(); ++r)\n    {\n      double p[3];\n      points->GetPoint(r, p);\n\n      doubleArray->SetValue(r, p[c]);\n    }\n\n    inputData->AddColumn(doubleArray);\n  }\n\n  vtkNew<vtkKMeansStatistics> kMeansStatistics;\n  kMeansStatistics->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA, inputData);\n  kMeansStatistics->SetColumnStatus(inputData->GetColumnName(0), 1);\n  kMeansStatistics->SetColumnStatus(inputData->GetColumnName(1), 1);\n  kMeansStatistics->SetColumnStatus(inputData->GetColumnName(2), 1);\n  // kMeansStatistics->SetColumnStatus( \"Testing\", 1 );\n  kMeansStatistics->RequestSelectedColumns();\n  kMeansStatistics->SetAssessOption(true);\n  kMeansStatistics->SetDefaultNumberOfClusters(2);\n  kMeansStatistics->Update();\n\n  // Display the results.\n  kMeansStatistics->GetOutput()->Dump();\n\n  vtkNew<vtkIntArray> clusterArray;\n  clusterArray->SetNumberOfComponents(1);\n  clusterArray->SetName(\"ClusterId\");\n\n  for (int r = 0; r < kMeansStatistics->GetOutput()->GetNumberOfRows(); r++)\n  {\n    vtkVariant v = kMeansStatistics->GetOutput()->GetValue(\n        r, kMeansStatistics->GetOutput()->GetNumberOfColumns() - 1);\n    std::cout << \"Point \" << r << \" is in cluster \" << v.ToInt() << std::endl;\n    clusterArray->InsertNextValue(v.ToInt());\n  }\n\n  // Output the cluster centers.\n  auto outputMetaDS =\n      dynamic_cast<vtkMultiBlockDataSet*>(kMeansStatistics->GetOutputDataObject(\n          vtkStatisticsAlgorithm::OUTPUT_MODEL));\n  auto outputMeta = dynamic_cast<vtkTable*>(outputMetaDS->GetBlock(0));\n  auto coord0 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 0\"));\n  auto coord1 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 1\"));\n  auto coord2 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 2\"));\n  std::cout << \"CLuster centers:\" << std::endl;\n  for (unsigned int i = 0; i < coord0->GetNumberOfTuples(); ++i)\n  {\n    std::cout << coord0->GetValue(i) << \" \" << coord1->GetValue(i) << \" \"\n              << coord2->GetValue(i) << std::endl;\n  }\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  // polydata->GetPointData()->AddArray(clusterArray);\n  polydata->GetPointData()->SetScalars(clusterArray);\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(\"output.vtp\");\n  writer->SetInputData(polydata);\n  writer->Write();\n\n  // Display\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n  glyphFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(4);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"KMeansClustering\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"OliveDrab\").GetData());\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/KMeansClustering/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KMeansClustering)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersStatistics\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KMeansClustering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KMeansClustering MACOSX_BUNDLE KMeansClustering.cxx )\n  target_link_libraries(KMeansClustering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KMeansClustering\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/KMeansClustering/#download-and-build-kmeansclustering","title":"Download and Build KMeansClustering","text":"

Click here to download KMeansClustering and its CMakeLists.txt file. Once the tarball KMeansClustering.tar has been downloaded and extracted,

cd KMeansClustering/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KMeansClustering\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/MutableGraphHelper/","title":"MutableGraphHelper","text":"

vtk-examples/Cxx/InfoVis/MutableGraphHelper

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/MutableGraphHelper/#code","title":"Code","text":"

MutableGraphHelper.cxx

#include <vtkGraphLayoutView.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableGraphHelper.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkRenderWindowInteractor.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkNew<vtkMutableGraphHelper> graphHelper;\n  graphHelper->SetGraph(g);\n  vtkIdType v0 = graphHelper->AddVertex();\n  vtkIdType v1 = graphHelper->AddVertex();\n\n  graphHelper->AddEdge(v0, v1);\n\n  // Can also do this:\n  graphHelper->RemoveEdge(0);\n\n  vtkNew<vtkGraphLayoutView> treeLayoutView;\n  treeLayoutView->AddRepresentationFromInput(graphHelper->GetGraph());\n  treeLayoutView->SetLayoutStrategyToTree();\n  treeLayoutView->ResetCamera();\n  treeLayoutView->Render();\n  treeLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/MutableGraphHelper/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MutableGraphHelper)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MutableGraphHelper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MutableGraphHelper MACOSX_BUNDLE MutableGraphHelper.cxx )\n  target_link_libraries(MutableGraphHelper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MutableGraphHelper\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/MutableGraphHelper/#download-and-build-mutablegraphhelper","title":"Download and Build MutableGraphHelper","text":"

Click here to download MutableGraphHelper and its CMakeLists.txt file. Once the tarball MutableGraphHelper.tar has been downloaded and extracted,

cd MutableGraphHelper/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MutableGraphHelper\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/PKMeansClustering/","title":"PKMeansClustering","text":"

vtk-examples/Cxx/InfoVis/PKMeansClustering

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/PKMeansClustering/#code","title":"Code","text":"

PKMeansClustering.cxx

#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNew.h>\n#include <vtkPKMeansStatistics.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkTable.h>\n#include <vtkXMLPolyDataWriter.h>\n\n// display\n#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <sstream>\n\nint main(int, char*[])\n{\n  // create 2 clusters, one near (0,0,0) and the other near (3,3,3)\n  vtkNew<vtkPoints> points;\n\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(3.0, 3.0, 3.0);\n  points->InsertNextPoint(0.1, 0.1, 0.1);\n  points->InsertNextPoint(3.1, 3.1, 3.1);\n  points->InsertNextPoint(0.2, 0.2, 0.2);\n  points->InsertNextPoint(3.2, 3.2, 3.2);\n\n  // Get the points into the format needed for KMeans\n  vtkNew<vtkTable> inputData;\n\n  for (int c = 0; c < 3; ++c)\n  {\n    std::stringstream colName;\n    colName << \"coord \" << c;\n    vtkNew<vtkDoubleArray> doubleArray;\n    doubleArray->SetNumberOfComponents(1);\n    doubleArray->SetName(colName.str().c_str());\n    doubleArray->SetNumberOfTuples(points->GetNumberOfPoints());\n\n    for (int r = 0; r < points->GetNumberOfPoints(); ++r)\n    {\n      double p[3];\n      points->GetPoint(r, p);\n\n      doubleArray->SetValue(r, p[c]);\n    }\n\n    inputData->AddColumn(doubleArray);\n  }\n\n  vtkNew<vtkPKMeansStatistics> pKMeansStatistics;\n  // vtkNew<vtkKMeansStatistics> pKMeansStatistics;\n  // pks->SetMaxNumIterations( 10 );\n  pKMeansStatistics->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA,\n                                  inputData);\n  pKMeansStatistics->SetColumnStatus(inputData->GetColumnName(0), 1);\n  pKMeansStatistics->SetColumnStatus(inputData->GetColumnName(1), 1);\n  pKMeansStatistics->SetColumnStatus(inputData->GetColumnName(2), 1);\n  pKMeansStatistics->RequestSelectedColumns();\n  pKMeansStatistics->SetAssessOption(true);\n  pKMeansStatistics->SetDefaultNumberOfClusters(2);\n  pKMeansStatistics->Update();\n\n  // Display the results\n  pKMeansStatistics->GetOutput()->Dump();\n\n  vtkNew<vtkIntArray> clusterArray;\n  clusterArray->SetNumberOfComponents(1);\n  clusterArray->SetName(\"ClusterId\");\n\n  for (unsigned int r = 0;\n       r < pKMeansStatistics->GetOutput()->GetNumberOfRows(); r++)\n  {\n    vtkVariant v = pKMeansStatistics->GetOutput()->GetValue(\n        r, pKMeansStatistics->GetOutput()->GetNumberOfColumns() - 1);\n    std::cout << \"Point \" << r << \" is in cluster \" << v.ToInt() << std::endl;\n    clusterArray->InsertNextValue(v.ToInt());\n  }\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->SetScalars(clusterArray);\n\n  // Output the cluster centers\n\n  auto outputMetaDS = dynamic_cast<vtkMultiBlockDataSet*>(\n      pKMeansStatistics->GetOutputDataObject(\n          vtkStatisticsAlgorithm::OUTPUT_MODEL));\n  auto outputMeta = dynamic_cast<vtkTable*>(outputMetaDS->GetBlock(0));\n  // auto outputMeta = dynamic_cast<vtkTable*>( outputMetaDS->GetBlock( 1 ) );\n  auto coord0 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 0\"));\n  auto coord1 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 1\"));\n  auto coord2 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 2\"));\n\n  for (unsigned int i = 0; i < coord0->GetNumberOfTuples(); ++i)\n  {\n    std::cout << coord0->GetValue(i) << \" \" << coord1->GetValue(i) << \" \"\n              << coord2->GetValue(i) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/PKMeansClustering/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PKMeansClustering)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersParallelStatistics\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PKMeansClustering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PKMeansClustering MACOSX_BUNDLE PKMeansClustering.cxx )\n  target_link_libraries(PKMeansClustering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PKMeansClustering\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/PKMeansClustering/#download-and-build-pkmeansclustering","title":"Download and Build PKMeansClustering","text":"

Click here to download PKMeansClustering and its CMakeLists.txt file. Once the tarball PKMeansClustering.tar has been downloaded and extracted,

cd PKMeansClustering/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PKMeansClustering\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/ParallelCoordinatesView/","title":"ParallelCoordinatesView","text":"

vtk-examples/Cxx/InfoVis/ParallelCoordinatesView

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/ParallelCoordinatesView/#code","title":"Code","text":"

ParallelCoordinatesView.cxx

#include <vtkDelimitedTextReader.h>\n#include <vtkDoubleArray.h>\n#include <vtkFloatArray.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParallelCoordinatesRepresentation.h>\n#include <vtkParallelCoordinatesView.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStringArray.h>\n#include <vtkTable.h>\n\n#include <vtksys/SystemTools.hxx>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkTable> table = vtkSmartPointer<vtkTable>::New();\n  std::string title;\n\n  if (argc > 1)\n  {\n    std::string inputFilename;\n    inputFilename = argv[1];\n    vtkNew<vtkDelimitedTextReader> reader;\n    reader->SetFileName(inputFilename.c_str());\n    reader->SetHaveHeaders(1);\n    reader->DetectNumericColumnsOn();\n    reader->SetFieldDelimiterCharacters(\",\");\n    reader->Update();\n    table = reader->GetOutput();\n    title = vtksys::SystemTools::GetFilenameWithoutExtension(\n        vtksys::SystemTools::GetFilenameName(inputFilename));\n  }\n  else\n  {\n    title = \"Generated Data\";\n    vtkNew<vtkIntArray> array1;\n    array1->SetName(\"Array1\");\n    array1->SetNumberOfComponents(1);\n    array1->InsertNextValue(0);\n    array1->InsertNextValue(1);\n    array1->InsertNextValue(2);\n    array1->InsertNextValue(3);\n    array1->InsertNextValue(4);\n\n    vtkNew<vtkFloatArray> array2;\n    array2->SetName(\"Array2\");\n    array2->SetNumberOfComponents(1);\n    array2->InsertNextValue(-0);\n    array2->InsertNextValue(-1);\n    array2->InsertNextValue(-2);\n    array2->InsertNextValue(-3);\n    array2->InsertNextValue(-4);\n\n    vtkNew<vtkDoubleArray> array3;\n    array3->SetName(\"Array3\");\n    array3->SetNumberOfComponents(1);\n    array3->InsertNextValue(0);\n    array3->InsertNextValue(1);\n    array3->InsertNextValue(4);\n    array3->InsertNextValue(9);\n    array3->InsertNextValue(16);\n\n    table->AddColumn(array1);\n    table->AddColumn(array2);\n    table->AddColumn(array3);\n  }\n\n  vtkNew<vtkPolyData> polydata;\n\n  for (vtkIdType i = 0; i < table->GetNumberOfColumns(); ++i)\n  {\n    if (dynamic_cast<vtkStringArray*>(table->GetColumn(i)))\n    {\n      std::cout << i << \" is \"\n                << \"StringArray named \";\n    }\n    else if (dynamic_cast<vtkDoubleArray*>(table->GetColumn(i)))\n    {\n      std::cout << i << \" is \"\n                << \"DoubleArray named \";\n    }\n    else if (dynamic_cast<vtkFloatArray*>(table->GetColumn(i)))\n    {\n      std::cout << i << \" is \"\n                << \"DoubleArray named \";\n    }\n    else if (dynamic_cast<vtkIntArray*>(table->GetColumn(i)))\n    {\n      std::cout << i << \" is \"\n                << \"IntArray named \";\n    }\n    else\n    {\n      std::cout << i << \" is \"\n                << \"Unknown type named \";\n    }\n    std::cout << \"\\\"\" << table->GetColumn(i)->GetName() << \"\\\"\" << std::endl;\n\n    polydata->GetPointData()->AddArray(table->GetColumn(i));\n  }\n\n  vtkNew<vtkParallelCoordinatesRepresentation> rep;\n  rep->SetInputData(polydata);\n\n  // List all of the attribute arrays you want plotted in parallel coordinates\n  // Set up the parallel coordinates Representation to be used in the View\n  for (vtkIdType i = 0; i < table->GetNumberOfColumns(); ++i)\n  {\n    if (dynamic_cast<vtkStringArray*>(table->GetColumn(i)))\n    {\n      continue;\n    }\n    else\n    {\n      rep->SetInputArrayToProcess(i, 0, 0, 0, table->GetColumn(i)->GetName());\n    }\n  }\n  rep->UseCurvesOn();\n  rep->SetFontSize(.5);\n  rep->SetPlotTitle(title.c_str());\n  rep->SetLineOpacity(0.5);\n  rep->SetLineColor(colors->GetColor3d(\"Gold\").GetData());\n  rep->SetAxisColor(colors->GetColor3d(\"OrangeRed\").GetData());\n  rep->SetAxisLabelColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // Set up the Parallel Coordinates View and hook in the Representation\n  vtkNew<vtkParallelCoordinatesView> view;\n  view->SetRepresentation(rep);\n  view->SetInspectMode(1);\n  view->SetDisplayHoverText(1);\n\n  // Brush Mode determines the type of interaction you perform to select data\n  view->SetBrushModeToLasso();\n  view->SetBrushOperatorToReplace();\n\n  // Set up render window\n  view->GetRenderWindow()->SetSize(600, 300);\n  view->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Indigo\").GetData());\n\n  view->GetRenderWindow()->SetWindowName(\"ParallelCoordinatesView\");\n  view->ResetCamera();\n  view->Render();\n\n  // Start interaction event loop\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/ParallelCoordinatesView/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParallelCoordinatesView)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOInfovis\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParallelCoordinatesView: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParallelCoordinatesView MACOSX_BUNDLE ParallelCoordinatesView.cxx )\n  target_link_libraries(ParallelCoordinatesView PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParallelCoordinatesView\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/ParallelCoordinatesView/#download-and-build-parallelcoordinatesview","title":"Download and Build ParallelCoordinatesView","text":"

Click here to download ParallelCoordinatesView and its CMakeLists.txt file. Once the tarball ParallelCoordinatesView.tar has been downloaded and extracted,

cd ParallelCoordinatesView/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ParallelCoordinatesView\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/PassThrough/","title":"PassThrough","text":"

vtk-examples/Cxx/InfoVis/PassThrough

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/PassThrough/#code","title":"Code","text":"

PassThrough.cxx

#include <vtkNew.h>\n#include <vtkPassThrough.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"Points before: \"\n            << sphereSource->GetOutput()->GetNumberOfPoints() << std::endl;\n\n  vtkNew<vtkPassThrough> passThrough;\n  passThrough->SetInputConnection(sphereSource->GetOutputPort());\n  passThrough->Update();\n\n  auto output = dynamic_cast<vtkPolyData*>(passThrough->GetOutput());\n\n  std::cout << \"Points after: \" << output->GetNumberOfPoints() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/PassThrough/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PassThrough)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PassThrough: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PassThrough MACOSX_BUNDLE PassThrough.cxx )\n  target_link_libraries(PassThrough PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PassThrough\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/PassThrough/#download-and-build-passthrough","title":"Download and Build PassThrough","text":"

Click here to download PassThrough and its CMakeLists.txt file. Once the tarball PassThrough.tar has been downloaded and extracted,

cd PassThrough/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PassThrough\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/SCurveSpline/","title":"SCurveSpline","text":"

vtk-examples/Cxx/InfoVis/SCurveSpline

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/SCurveSpline/#code","title":"Code","text":"

SCurveSpline.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSCurveSpline.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(5);\n  pointSource->Update();\n\n  vtkPoints* points = pointSource->GetOutput()->GetPoints();\n\n  vtkNew<vtkSCurveSpline> xSpline;\n  vtkNew<vtkSCurveSpline> ySpline;\n  vtkNew<vtkSCurveSpline> zSpline;\n\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetXSpline(xSpline);\n  spline->SetYSpline(ySpline);\n  spline->SetZSpline(zSpline);\n  spline->SetPoints(points);\n\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->Update();\n\n  // Setup actor and mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(functionSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SCurveSpline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/SCurveSpline/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SCurveSpline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SCurveSpline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SCurveSpline MACOSX_BUNDLE SCurveSpline.cxx )\n  target_link_libraries(SCurveSpline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SCurveSpline\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/SCurveSpline/#download-and-build-scurvespline","title":"Download and Build SCurveSpline","text":"

Click here to download SCurveSpline and its CMakeLists.txt file. Once the tarball SCurveSpline.tar has been downloaded and extracted,

cd SCurveSpline/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SCurveSpline\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/TreeMapView/","title":"TreeMapView","text":"

vtk-examples/Cxx/InfoVis/TreeMapView

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/InfoVis/TreeMapView/#description","title":"Description","text":"

Fix: use a much simpler tree and generate the tree in the code instead of reading files.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/TreeMapView/#code","title":"Code","text":"

TreeMapView.cxx

#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTreeMapView.h>\n#include <vtkViewTheme.h>\n#include <vtkXMLTreeReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    cout << \"Usage: \" << argv[0] << \" treeFileName graphFileName\" << std::endl;\n    cout << \"where: treeFileName is Infovis-XML-vtkclasses.xml and \"\n            \"graphFileName is Infovis-XML-vtklibrary.xml\"\n         << endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string treeFileName(argv[1]);\n  std::string graphFileName(argv[2]);\n\n  // We need to put the graph and tree edges in different domains.\n  vtkNew<vtkXMLTreeReader> reader1;\n  reader1->SetFileName(treeFileName.c_str());\n  reader1->SetEdgePedigreeIdArrayName(\"tree edge\");\n  reader1->GenerateVertexPedigreeIdsOff();\n  reader1->SetVertexPedigreeIdArrayName(\"id\");\n\n  vtkNew<vtkXMLTreeReader> reader2;\n  reader2->SetFileName(graphFileName.c_str());\n  reader2->SetEdgePedigreeIdArrayName(\"graph edge\");\n  reader2->GenerateVertexPedigreeIdsOff();\n  reader2->SetVertexPedigreeIdArrayName(\"id\");\n\n  reader1->Update();\n  reader2->Update();\n\n  vtkNew<vtkTreeMapView> view;\n  view->DisplayHoverTextOff();\n  view->SetGraphFromInputConnection(reader1->GetOutputPort());\n  view->SetTreeFromInputConnection(reader2->GetOutputPort());\n\n  view->SetAreaColorArrayName(\"level\");\n  view->SetEdgeColorToSplineFraction();\n  view->SetColorEdges(true);\n  view->SetAreaLabelArrayName(\"id\");\n  view->SetAreaHoverArrayName(\"id\");\n  view->SetAreaLabelVisibility(true);\n  view->SetAreaSizeArrayName(\"VertexDegree\");\n\n  // Apply a theme to the views\n  // vtkViewTheme* const theme = vtkViewTheme::CreateMellowTheme();\n  // view->ApplyViewTheme(theme);\n  // theme->Delete();\n  vtkNew<vtkViewTheme> theme;\n  view->ApplyViewTheme(theme->CreateMellowTheme());\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->SetAlphaBitPlanes(1);\n  view->Update();\n  view->ResetCamera();\n\n  view->GetRenderWindow()->SetSize(600, 600);\n  view->GetRenderWindow()->SetWindowName(\"TreeMapView\");\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/TreeMapView/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TreeMapView)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOInfovis\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TreeMapView: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TreeMapView MACOSX_BUNDLE TreeMapView.cxx )\n  target_link_libraries(TreeMapView PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TreeMapView\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/TreeMapView/#download-and-build-treemapview","title":"Download and Build TreeMapView","text":"

Click here to download TreeMapView and its CMakeLists.txt file. Once the tarball TreeMapView.tar has been downloaded and extracted,

cd TreeMapView/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TreeMapView\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/WordCloud/","title":"WordCloud","text":"

vtk-examples/Cxx/InfoVis/WordCloud

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/InfoVis/WordCloud/#description","title":"Description","text":"

A word cloud is a visualization of word frequency in a given text as a weighted list. It is a variation of a tag cloud.

This example creates a word cloud using vtkFreeTypeTools to render words into images. vtkImageBlend adds these images onto a final image. A vtkImageIterator compares pixels in the text image with those in the final image. If a non-background pixel exists in the final image, that word is not kept.

The example illustrates a number of std:: concepts including random numbers, regular expressions and multi_set.

Also, the kwsys CommandLineArguments used to process command line arguments.

Many parameters are exposed on the command line:

Usage: WordCloud textFileName \n  --backgroundColorName opt  Name of the color for the background(MignightBlue)\n  --bwMask  Mask image has a single channel(false).\n  --colorDistribution opt o  Distribution of random colors(.6 1.0). If\n                             wordColorName is not empty, random colors are\n                             generated with this distribution\n  --colorScheme opt  Color scheme(constant)\n  --dpi opt  Dots per inch(200)\n  --fontFile opt  Font file name(\"\"). If fontFileName is empty, the\n                             built-in Arial font is used.\n  --fontMultiplier opt  Font multiplier(6). This final FontSize is this\n                             value * the word frequency.\n  --gap opt  Space gap of words (2). The gap is the number of\n                             spaces added to the beginning and end of each word\n  --help  Show help(false)\n  --maskColorName opt  Name of the color for the mask (black). This is\n                             the name of the color that defines the foreground\n                             of the mask. Usually black or white\n  --maskFile opt  Mask file name(\"\"). If the mask file is specified,\n                             if will be used as the mask, otherwise a black\n                             square is used as the mask.\n  --maxFontSize opt  Maximum font size(48)\n  --minFontSize opt  Minimum font size(8)\n  --offsetDistribution opt   Range of random offsets(-size[0]/100.0\n                             -size{1]/100.0)(-20 20).\n  --orientationDistribution  Ranges of random orientations(-20 20)\n  --size opt opt ...  Size of image(640 480)\n  --wordColorName opt  Name of the color for the words(). If the name is\n                             empty, the colorDistribution will generate random\n                             colors.\n

The example image was produced with these arguments:

WordCloud ${DATA}/Gettysburg.txt --dpi 150 --fontFile ${DATA}/Canterbury.ttf\n

and these parameters:

Cloud Parameters\n  BackgroundColorName: MidnightBlue\n  BWMask: false\n  ColorDistribution: 0.6 1\n  ColorSchemeName:\n  DPI: 150\n  FontFile: /Canterbury.ttf\n  FontMultiplier: 6\n  Gap: 2\n  MaskColorName: black\n  MaskFile:\n  MinFontSize: 12\n  MaxFontSize: 48\n  OffsetDistribution: -6 4\n  OrientationDistribution: -20 20\n  Orientations:\n  ReplacementPairs:\n  Sizes: 640 480\n  StopWords:\n  Title:\n  WordColorName:\n

and produced this output:

Kept 94 words\nStopped 178 words\nSkipped 5 words\n

Info

We may add a word cloud class to VTK is there is enough interest.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/WordCloud/#code","title":"Code","text":"

WordCloud.cxx

#include <vtkNew.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkFreeTypeTools.h>\n#include <vtkImageBlend.h>\n#include <vtkImageData.h>\n#include <vtkImageIterator.h>\n\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\n#include <vtkImageAppendComponents.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageResize.h>\n\n#include <vtksys/CommandLineArguments.hxx>\n\n// stl\n#include <algorithm>\n#include <fstream>\n#include <functional>\n#include <iostream>\n#include <iterator>\n#include <map>\n#include <random>\n#include <regex>\n#include <set>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n// Cloud Parameters\nstruct CloudParameters\n{\n  CloudParameters()\n    : FontFile(\"\"),\n      MaskFile(\"\"),\n      DPI(200),\n      MaxFontSize(48),\n      MinFontSize(12),\n      MinFrequency(1),\n      FontMultiplier(6),\n      ColorSchemeName(\"\"),\n      BackgroundColorName(\"MidnightBlue\"),\n      MaskColorName(\"black\"),\n      BWMask(false),\n      WordColorName(\"\"),\n      Gap(2),\n      KeptCount(0){};\n  void Print(ostream& os)\n  {\n    os << \"Cloud Parameters\" << std::endl;\n    os << \"  BackgroundColorName: \" << BackgroundColorName << std::endl;\n    os << \"  BWMask: \" << (BWMask ? \"true\" : \"false\") << std::endl;\n    os << \"  ColorDistribution: \" << ColorDistribution[0] << \" \"\n       << ColorDistribution[1] << std::endl;\n    os << \"  ColorSchemeName: \" << ColorSchemeName << std::endl;\n    os << \"  DPI: \" << DPI << std::endl;\n    os << \"  FontFile: \" << FontFile << std::endl;\n    os << \"  FontMultiplier: \" << FontMultiplier << std::endl;\n    os << \"  Gap: \" << Gap << std::endl;\n    os << \"  MaskColorName: \" << MaskColorName << std::endl;\n    os << \"  MaskFile: \" << MaskFile << std::endl;\n    os << \"  MinFontSize: \" << MinFontSize << std::endl;\n    os << \"  MaxFontSize: \" << MaxFontSize << std::endl;\n    os << \"  MinFrequency: \" << MinFrequency << std::endl;\n    os << \"  OffsetDistribution: \" << OffsetDistribution[0] << \" \"\n       << OffsetDistribution[1] << std::endl;\n    os << \"  OrientationDistribution: \" << OrientationDistribution[0] << \" \"\n       << OrientationDistribution[1] << std::endl;\n    os << \"  Orientations: \";\n    for (auto o : Orientations)\n    {\n      os << o << \" \";\n    }\n    os << std::endl;\n    os << \"  ReplacementPairs: \";\n    for (auto p = 0; p < ReplacementPairs.size(); p += 2)\n    {\n      os << ReplacementPairs[p] << \"->\" << ReplacementPairs[p + 1] << \" \";\n    }\n    os << std::endl;\n    os << \"  Sizes: \" << Sizes[0] << \" \" << Sizes[1] << std::endl;\n    os << \"  StopWords: \";\n    for (auto const& s : StopWords)\n    {\n      os << s << \" \";\n    }\n    os << std::endl;\n    os << \"  Title: \" << Title << std::endl;\n    os << \"  WordColorName: \" << WordColorName << std::endl;\n  }\n  std::vector<int> AdjustedSizes;\n  std::string BackgroundColorName;\n  bool BWMask;\n  std::string ColorSchemeName;\n  int DPI;\n  std::string FontFile;\n  int Gap;\n  int KeptCount;\n  std::string MaskColorName;\n  std::string MaskFile;\n  int MaxFontSize;\n  int MinFontSize;\n  int MinFrequency;\n  int FontMultiplier;\n  std::vector<double> ColorDistribution;\n  std::vector<int> OffsetDistribution;\n  std::vector<double> OrientationDistribution;\n  std::vector<double> Orientations;\n  std::vector<std::string> ReplacementPairs;\n  std::vector<int> Sizes;\n  std::vector<std::string> StopWords;\n  std::string Title;\n  std::string WordColorName;\n};\nbool ProcessCommandLine(vtksys::CommandLineArguments& arg,\n                        CloudParameters& cloudParameters);\n\n// Declaring the type of Predicate that accepts 2 pairs and return a bool\ntypedef std::function<bool(std::pair<std::string, int>,\n                           std::pair<std::string, int>)>\n    Comparator;\n\nstd::multiset<std::pair<std::string, int>, Comparator>\nFindWordsSortedByFrequency(std::string&, CloudParameters& cloudParameters);\nstruct ExtentOffset\n{\n  ExtentOffset(int _x = 0.0, int _y = 0.0) : x(_x), y(_y)\n  {\n  }\n  int x, y;\n};\nstruct ArchimedesValue\n{\n  ArchimedesValue(double _x = 0.0, double _y = 0.0) : x(_x), y(_y)\n  {\n  }\n  double x, y;\n};\nbool AddWordToFinal(const std::string, const int, CloudParameters&,\n                    std::mt19937&, double orientation,\n                    std::vector<ExtentOffset>&, vtkImageBlend*,\n                    std::array<int, 6>&);\n\nvoid ArchimedesSpiral(std::vector<ExtentOffset>&, std::vector<int>&);\nvoid ReplaceMaskColorWithBackgroundColor(vtkImageData*, CloudParameters&);\nvoid CreateStopList(std::vector<std::string>& StopList);\nvoid ShowColorSeriesNames(ostream& os);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Process command line argumemts.\n  CloudParameters cloudParameters;\n  vtksys::CommandLineArguments arg;\n  arg.Initialize(argc, argv);\n  if (!ProcessCommandLine(arg, cloudParameters))\n  {\n    return EXIT_FAILURE;\n  }\n\n  // Get the file that contains the text to be converted to a word cloud.\n  char** newArgv = nullptr;\n  int newArgc = 0;\n  arg.GetUnusedArguments(&newArgc, &newArgv);\n  if (newArgc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" textFileName \" << arg.GetHelp()\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Open the text file\n  std::ifstream t(newArgv[1]);\n  std::stringstream buffer;\n  buffer << t.rdbuf();\n  std::string s = buffer.str();\n  t.close();\n\n  // Generate a path for placement of words.\n  std::vector<ExtentOffset> offset;\n  ArchimedesSpiral(offset, cloudParameters.Sizes);\n\n  // Sort the word by frequency.\n  std::multiset<std::pair<std::string, int>, Comparator> sortedWords =\n      FindWordsSortedByFrequency(s, cloudParameters);\n\n  // Create a mask image.\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3ub maskColor =\n      colors->GetColor3ub(cloudParameters.MaskColorName.c_str());\n  vtkSmartPointer<vtkImageData> maskImage;\n  // If a mask file is not defined, create a square mask.\n  if (cloudParameters.MaskFile == \"\")\n  {\n    vtkNew<vtkImageCanvasSource2D> defaultMask;\n    defaultMask->SetScalarTypeToUnsignedChar();\n    defaultMask->SetNumberOfScalarComponents(3);\n    defaultMask->SetExtent(0, cloudParameters.Sizes[0] - 1, 0,\n                           cloudParameters.Sizes[1] - 1, 0, 0);\n    defaultMask->SetDrawColor(maskColor.GetData()[0], maskColor.GetData()[1],\n                              maskColor.GetData()[2]);\n    defaultMask->FillBox(0, cloudParameters.Sizes[0] - 1, 0,\n                         cloudParameters.Sizes[1] - 1);\n    defaultMask->Update();\n    maskImage = defaultMask->GetOutput();\n    cloudParameters.AdjustedSizes.push_back(cloudParameters.Sizes[0]);\n    cloudParameters.AdjustedSizes.push_back(cloudParameters.Sizes[1]);\n  }\n  else\n  {\n    // Read the mask file.\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> reader;\n    reader.TakeReference(\n        readerFactory->CreateImageReader2(cloudParameters.MaskFile.c_str()));\n    reader->SetFileName(cloudParameters.MaskFile.c_str());\n    reader->Update();\n    int dimensions[3];\n    reader->GetOutput()->GetDimensions(dimensions);\n    vtkNew<vtkImageResize> resize;\n    resize->SetInputData(reader->GetOutput());\n    resize->InterpolateOff();\n    double aspect = static_cast<double>(dimensions[1]) /\n        static_cast<double>(dimensions[0]) *\n        static_cast<double>(cloudParameters.Sizes[0]) /\n        static_cast<double>(cloudParameters.Sizes[1]);\n    cloudParameters.AdjustedSizes.push_back(cloudParameters.Sizes[0]);\n    cloudParameters.AdjustedSizes.push_back(aspect * cloudParameters.Sizes[1]);\n    resize->SetOutputDimensions(cloudParameters.AdjustedSizes[0],\n                                cloudParameters.AdjustedSizes[1], 1);\n    if (cloudParameters.BWMask)\n    {\n      vtkNew<vtkImageAppendComponents> appendFilter;\n      appendFilter->SetInputConnection(0, resize->GetOutputPort());\n      appendFilter->AddInputConnection(0, resize->GetOutputPort());\n      appendFilter->AddInputConnection(0, resize->GetOutputPort());\n      appendFilter->Update();\n      maskImage = appendFilter->GetOutput();\n    }\n    else\n    {\n      vtkNew<vtkImageExtractComponents> rgbImage;\n      rgbImage->SetInputConnection(resize->GetOutputPort());\n      rgbImage->SetComponents(0, 1, 2);\n      rgbImage->Update();\n      maskImage = rgbImage->GetOutput();\n    }\n  }\n\n  // Create an image that will hold the final image.\n  vtkNew<vtkImageBlend> final;\n  final->AddInputData(maskImage);\n  final->SetOpacity(0, .5);\n  final->Update();\n\n  // Try to add each word.\n  int numberSkipped = 0;\n  int keep = 0;\n  std::array<int, 6> extent;\n  bool added;\n  // Create a vector of orientations to try..\n  std::mt19937 mt(4355412); // Standard mersenne twister engine.\n  for (auto const& element : sortedWords)\n  {\n    std::vector<double> orientations;\n    if (cloudParameters.Orientations.size() != 0)\n    {\n      orientations = cloudParameters.Orientations;\n    }\n    else\n    {\n      std::uniform_real_distribution<> orientationDist(\n          cloudParameters.OrientationDistribution[0],\n          cloudParameters.OrientationDistribution[1]);\n      orientations.push_back(orientationDist(mt));\n    }\n    std::shuffle(std::begin(orientations), std::end(orientations), mt);\n    for (auto o : orientations)\n    {\n      added = AddWordToFinal(element.first, element.second, cloudParameters, mt,\n                             o, offset, final, extent);\n      if (added)\n      {\n        //      std::cout << element.first << \": \" << element.second <<\n        //      std::endl;\n        keep++;\n        break;\n      }\n      else\n      {\n        numberSkipped++;\n        //      std::cout << \"skipped: \" << element.first << \": \" <<\n        //      element.second << std::endl;\n      }\n    }\n  }\n  std::cout << \"Kept \" << keep << \" words\" << std::endl;\n  std::cout << \"Skipped \" << numberSkipped << \" words\" << std::endl;\n\n  // If a maskFile is specified, replace the maskColor with the background\n  // color.\n  ReplaceMaskColorWithBackgroundColor(final->GetOutput(), cloudParameters);\n\n  // Display the final image.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputData(final->GetOutput());\n  imageViewer->SetupInteractor(interactor);\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Wheat\").GetData());\n  imageViewer->SetSize(cloudParameters.Sizes[0], cloudParameters.Sizes[1]);\n  imageViewer->GetRenderer()->ResetCamera();\n\n  // Zoom in a bit.\n  vtkCamera* camera = imageViewer->GetRenderer()->GetActiveCamera();\n  camera->ParallelProjectionOn();\n  camera->SetParallelScale(cloudParameters.AdjustedSizes[0] * .4);\n  imageViewer->GetRenderWindow()->SetWindowName(\"WordCloud\");\n  imageViewer->GetRenderWindow()->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nstd::multiset<std::pair<std::string, int>, Comparator>\nFindWordsSortedByFrequency(std::string& s, CloudParameters& cloudParameters)\n{\n  // Make replacements.\n  // Create a stop list.\n  std::vector<std::string> stopList;\n  CreateStopList(stopList);\n\n  // Add user stop words.\n  for (auto const& stop : cloudParameters.StopWords)\n  {\n    stopList.push_back(stop);\n  }\n\n  // Drop the case of all words.\n  std::transform(s.begin(), s.end(), s.begin(), ::tolower);\n\n  // Extract words\n  std::regex wordRegex(\"(\\\\w+)\");\n  auto wordsBegin = std::sregex_iterator(s.begin(), s.end(), wordRegex);\n  auto wordsEnd = std::sregex_iterator();\n\n  // Store the words in a map that will contain frequencies.\n  std::map<std::string, int> wordContainer;\n\n  // If a title is present add it with a high frequency.\n  if (cloudParameters.Title.length() > 0)\n  {\n    wordContainer[cloudParameters.Title] = 1000;\n  }\n  const int N = 1;\n  int stop = 0;\n  for (std::sregex_iterator i = wordsBegin; i != wordsEnd; ++i)\n  {\n    std::string matchStr = (*i).str();\n\n    // Replace words with another.\n    for (auto p = 0; p < cloudParameters.ReplacementPairs.size(); p += 2)\n    {\n      std::string from = cloudParameters.ReplacementPairs[p];\n      std::string to = cloudParameters.ReplacementPairs[p + 1];\n      size_t pos = 0;\n      pos = matchStr.find(from, pos);\n      if (matchStr.length() == from.length() && pos == 0)\n      {\n        matchStr.replace(pos, to.length(), to);\n        stopList.push_back(from);\n      }\n    }\n\n    // Skip the word if it is in the stop list or contains a digit.\n    auto it = std::find(stopList.begin(), stopList.end() - 1, matchStr);\n    const auto digit = (*i).str().find_first_of(\"0123456789\");\n    if (*it != *(stopList.end() - 1) || digit != std::string::npos)\n    {\n      stop++;\n      continue;\n    }\n\n    // Only include words that have more than N characters.\n    if (matchStr.size() > N)\n    {\n      // Raise the case of he first letter in the word\n      std::transform(matchStr.begin(), matchStr.begin() + 1, matchStr.begin(),\n                     ::toupper);\n      wordContainer[matchStr]++;\n    }\n  }\n  std::cout << \"Stopped \" << stop << \" words\" << std::endl;\n\n  // Defining a lambda function to compare two pairs. It will compare\n  // two pairs using second field.\n  Comparator compFunctor = [](std::pair<std::string, int> elem1,\n                              std::pair<std::string, int> elem2) {\n    if (elem1.second == elem2.second)\n    {\n      return elem1.first.length() > elem2.first.length();\n    }\n    return elem1.second > elem2.second;\n  };\n\n  // Declaring a multiset that will store the pairs using above comparision\n  // logic.\n  std::multiset<std::pair<std::string, int>, Comparator> setOfWords(\n      wordContainer.begin(), wordContainer.end(), compFunctor);\n\n  return setOfWords;\n}\nbool AddWordToFinal(const std::string word, const int frequency,\n                    CloudParameters& cloudParameters, std::mt19937& mt,\n                    double orientation, std::vector<ExtentOffset>& offset,\n                    vtkImageBlend* final, std::array<int, 6>& extent)\n{\n  // Skip single character words.\n  if (frequency < cloudParameters.MinFrequency)\n  {\n    return false;\n  }\n\n  // Create an image of the string.\n  vtkFreeTypeTools* freeType = vtkFreeTypeTools::GetInstance();\n  freeType->ScaleToPowerTwoOff();\n\n  // Create random distributions.\n  std::uniform_real_distribution<> colorDist(\n      cloudParameters.ColorDistribution[0],\n      cloudParameters.ColorDistribution[1]);\n  // bool discreteOrientations = cloudParameters.Orientations.size() != 0;\n\n  // Setup a property for the strings containing fixed parameters.\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkTextProperty> textProperty;\n  if (cloudParameters.WordColorName.length() > 0)\n  {\n    textProperty->SetColor(\n        colors->GetColor3d(cloudParameters.WordColorName).GetData());\n  }\n  else if (cloudParameters.ColorSchemeName.length() > 0)\n  {\n    vtkNew<vtkColorSeries> colorScheme;\n    //    int index =\n    //        colorScheme->SetColorSchemeByName(cloudParameters.ColorSchemeName);\n    vtkColor3ub color =\n        colorScheme->GetColorRepeating(cloudParameters.KeptCount);\n    if (color.Compare(colors->GetColor3ub(\"black\"), 1) &&\n        cloudParameters.KeptCount == 0)\n    {\n      std::cout << \"The color scheme \" << cloudParameters.ColorSchemeName\n                << \" does not exist.\" << std::endl;\n      ShowColorSeriesNames(std::cout);\n    }\n    textProperty->SetColor(color.GetRed() * 255.0, color.GetGreen() * 255.0,\n                           color.GetBlue() * 255.0);\n  }\n  else\n  {\n    textProperty->SetColor(colorDist(mt), colorDist(mt), colorDist(mt));\n  }\n  textProperty->SetVerticalJustificationToCentered();\n  textProperty->SetJustificationToCentered();\n  textProperty->SetLineOffset(4);\n\n  // Check if a font file is present.\n  if (cloudParameters.FontFile.length() > 0)\n  {\n    textProperty->SetFontFile(cloudParameters.FontFile.c_str());\n    textProperty->SetFontFamily(VTK_FONT_FILE);\n  }\n  else\n  {\n    textProperty->SetFontFamilyToArial();\n  }\n\n  // Set the font size\n  int fontSize = cloudParameters.FontMultiplier * frequency;\n  if (fontSize > cloudParameters.MaxFontSize)\n  {\n    fontSize = cloudParameters.MaxFontSize;\n  }\n  if (fontSize < cloudParameters.MinFontSize)\n  {\n    fontSize = cloudParameters.MinFontSize;\n  }\n  if (frequency == 1000)\n  {\n    fontSize *= 1.2;\n    ;\n  }\n  textProperty->SetFontSize(fontSize);\n  textProperty->SetOrientation(orientation);\n\n  // Add gap\n  std::string spaces;\n  for (int p = 0; p < cloudParameters.Gap; ++p)\n  {\n    spaces.push_back(' ');\n  }\n\n  // For each string, create an image and see if it overlaps with other images,\n  // if so, skip it.\n  int accepted = 0;\n  vtkNew<vtkImageData> textImage;\n  freeType->RenderString(textProperty, spaces + word + spaces,\n                         cloudParameters.DPI, textImage.GetPointer());\n\n  // Set the extent of the text image\n  std::array<int, 4> bb;\n  freeType->GetBoundingBox(textProperty, spaces + word + spaces,\n                           cloudParameters.DPI, bb.data());\n  vtkColor3ub maskColor =\n      colors->GetColor3ub(cloudParameters.MaskColorName.c_str());\n  unsigned char maskR = maskColor.GetData()[0];\n  unsigned char maskG = maskColor.GetData()[1];\n  unsigned char maskB = maskColor.GetData()[2];\n\n  std::uniform_real_distribution<> offsetDist(\n      cloudParameters.OffsetDistribution[0],\n      cloudParameters.OffsetDistribution[1]);\n\n  for (auto it = offset.begin(); it < offset.end(); ++it)\n  {\n    int offsetX = (*it).x + offsetDist(mt); // Add some noise to the offset.\n    int offsetY = (*it).y + offsetDist(mt);\n    // Make sure the text image will fit on the final image\n    if (offsetX + bb[1] - bb[0] < cloudParameters.AdjustedSizes[0] - 1 &&\n        offsetY + bb[3] - bb[2] < cloudParameters.AdjustedSizes[1] - 1 &&\n        offsetX >= 0 && offsetY >= 0)\n    {\n      textImage->SetExtent(offsetX, offsetX + bb[1] - bb[0], offsetY,\n                           offsetY + bb[3] - bb[2], 0, 0);\n      vtkNew<vtkImageData> image;\n      final->Update();\n\n      // Does the text image overlap with images on the final image.\n      vtkImageIterator<unsigned char> finalIt(final->GetOutput(),\n                                              textImage->GetExtent());\n      textImage->GetExtent(extent.data());\n      bool good = true;\n      while (!finalIt.IsAtEnd())\n      {\n        auto finalSpan = finalIt.BeginSpan();\n        while (finalSpan != finalIt.EndSpan())\n        {\n          unsigned char R, G, B;\n          R = *finalSpan++;\n          G = *finalSpan++;\n          B = *finalSpan++;\n          // If the pixel does not contain the background color, the word will\n          // not fit.\n          if (R != maskR && G != maskG && B != maskB)\n          {\n            good = false;\n            break;\n          }\n        }\n        if (!good)\n        {\n          break;\n        }\n        finalIt.NextSpan();\n      }\n      if (good)\n      {\n        accepted++;\n        (cloudParameters.KeptCount)++;\n        image->DeepCopy(textImage);\n        final->AddInputData(image);\n        final->Update();\n        return true;\n      }\n    }\n  }\n  return false;\n}\n\nvoid ArchimedesSpiral(std::vector<ExtentOffset>& offset,\n                      std::vector<int>& sizes)\n{\n  const int centerX = sizes[0] / 2.0;\n  const int centerY = sizes[1] / 2.0;\n\n  const std::size_t N = 10000;\n  constexpr auto pi = 3.141592653589793238462643383279502884L; /* pi */\n  const double deltaAngle = pi * 20 / N;\n  double maxX = -1000.0;\n  double minX = 1000.0;\n  double maxY = -1000.0;\n  double minY = 1000.0;\n  double range = -1000;\n  double e = sizes[0] / sizes[1];\n  std::vector<ArchimedesValue> archimedes;\n  for (std::size_t i = 0; i < N; i += 10)\n  {\n    double x, y;\n    double angle = deltaAngle * i;\n    x = e * angle * std::cos(angle);\n    y = e * angle * std::sin(angle);\n    archimedes.push_back(ArchimedesValue(x, y));\n    maxX = std::max(maxX, x);\n    minX = std::min(minX, x);\n    maxY = std::max(maxY, y);\n    minY = std::min(minY, y);\n    range = std::max(maxX - minX, maxY - minY);\n  }\n  double scaleX = 1.0 / range * sizes[0];\n  //  double scaleY = 1.0 / range * sizes[1];\n  int j = 0;\n  for (auto it = archimedes.begin(); it < archimedes.end(); ++it)\n  {\n\n    if ((*it).y * scaleX + centerY < 0 || (*it).x * scaleX + centerX - 50 < 0)\n      continue;\n    offset.push_back(ExtentOffset((*it).x * scaleX + centerX - 50,\n                                  (*it).y * scaleX + centerY));\n  }\n}\nbool ProcessCommandLine(vtksys::CommandLineArguments& arg,\n                        CloudParameters& cloudParameters)\n{\n  typedef vtksys::CommandLineArguments argT;\n\n  // Need this to get arguments without --'s\n  arg.StoreUnusedArguments(true);\n\n  arg.AddArgument(\"--backgroundColorName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.BackgroundColorName,\n                  \"Name of the color for the background(MignightBlue)\");\n  arg.AddArgument(\n      \"--colorDistribution\", argT::MULTI_ARGUMENT,\n      &cloudParameters.ColorDistribution,\n      \"Distribution of random colors(.6 1.0). If wordColorName is not empty, \"\n      \"random colors are generated with this distribution\");\n  arg.AddArgument(\"--colorSchemeName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.ColorSchemeName, \"Color scheme name()\");\n  arg.AddArgument(\"--dpi\", argT::SPACE_ARGUMENT, &cloudParameters.DPI,\n                  \"Dots per inch(200)\");\n  arg.AddArgument(\"--fontFile\", argT::SPACE_ARGUMENT, &cloudParameters.FontFile,\n                  \"Font file name(\\\"\\\"). If fontFileName is empty, the \"\n                  \"built-in Arial font is used.\");\n  arg.AddArgument(\"--fontMultiplier\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.FontMultiplier,\n                  \"Font multiplier(6). This final FontSize is this value * the \"\n                  \"word frequency.\");\n  arg.AddArgument(\"--gap\", argT::SPACE_ARGUMENT, &cloudParameters.Gap,\n                  \"Space gap of words (2). The gap is the number of spaces \"\n                  \"added to the beginning and end of each word\");\n  arg.AddArgument(\n      \"--maskColorName\", argT::SPACE_ARGUMENT, &cloudParameters.MaskColorName,\n      \"Name of the color for the mask (black). This is the name of the color \"\n      \"that defines the foreground of the mask. Usually black or white\");\n  arg.AddArgument(\n      \"--maskFile\", argT::SPACE_ARGUMENT, &cloudParameters.MaskFile,\n      \"Mask file name(\\\"\\\"). If the mask file is specified, if will be used as \"\n      \"the mask, otherwise a black square is used as the mask.\");\n  arg.AddArgument(\"--minFontSize\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MinFontSize, \"Minimum font size(8)\");\n  arg.AddArgument(\"--minFrequency\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MinFrequency,\n                  \"Minimum word frequency accepted(2)\");\n  arg.AddArgument(\"--maxFontSize\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MaxFontSize, \"Maximum font size(48)\");\n  arg.AddArgument(\n      \"--offsetDistribution\", argT::MULTI_ARGUMENT,\n      &cloudParameters.OffsetDistribution,\n      \"Range of random offsets(-size[0]/100.0 -size{1]/100.0)(-20 20).\");\n  arg.AddArgument(\"--orientationDistribution\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.OrientationDistribution,\n                  \"Ranges of random orientations(-20 20)\");\n  arg.AddArgument(\"--orientations\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.Orientations,\n                  \"List of discrete orientations (). If non-empty, these will \"\n                  \"be used instead of the orientations distribution\");\n  arg.AddArgument(\"--stopWords\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.StopWords,\n                  \"User provided stop words(). These will ba added to the \"\n                  \"built-in stop list.\");\n  arg.AddArgument(\"--bwMask\", argT::NO_ARGUMENT, &cloudParameters.BWMask,\n                  \"Mask image has a single channel(false). Mask images \"\n                  \"normally have three channels (r,g,b).\");\n  arg.AddArgument(\"--size\", argT::MULTI_ARGUMENT, &cloudParameters.Sizes,\n                  \"Size of image(640 480)\");\n  arg.AddArgument(\"--wordColorName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.WordColorName,\n                  \"Name of the color for the words(). If the name is empty, \"\n                  \"the colorDistribution will generate random colors.\");\n  arg.AddArgument(\"--replacementPairs\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.ReplacementPairs,\n                  \"Replace word with another word ().\");\n  arg.AddArgument(\"--title\", argT::SPACE_ARGUMENT, &cloudParameters.Title,\n                  \"Use this word and set a high frequency().\");\n  bool help = false;\n  arg.AddArgument(\"--help\", argT::NO_ARGUMENT, &help, \"Show help(false)\");\n  arg.Parse();\n  if (help)\n  {\n    std::cout << \"Usage: \"\n              << \"WordCloud\"\n              << \" textFileName \" << arg.GetHelp() << std::endl;\n    return false;\n  }\n\n  // Set defaults for vector arguments\n  if (cloudParameters.ColorDistribution.size() == 0)\n  {\n    cloudParameters.ColorDistribution.push_back(.6);\n    cloudParameters.ColorDistribution.push_back(1.0);\n  }\n  if (cloudParameters.OrientationDistribution.size() == 0)\n  {\n    cloudParameters.OrientationDistribution.push_back(-20);\n    cloudParameters.OrientationDistribution.push_back(20);\n  }\n  if (cloudParameters.Sizes.size() == 0)\n  {\n    cloudParameters.Sizes.push_back(640);\n    cloudParameters.Sizes.push_back(480);\n  }\n  if (cloudParameters.OffsetDistribution.size() == 0)\n  {\n    cloudParameters.OffsetDistribution.push_back(-cloudParameters.Sizes[0] /\n                                                 100.0);\n    cloudParameters.OffsetDistribution.push_back(cloudParameters.Sizes[1] /\n                                                 100.0);\n  }\n\n  cloudParameters.Print(std::cout);\n  return true;\n}\nvoid ReplaceMaskColorWithBackgroundColor(vtkImageData* finalImage,\n                                         CloudParameters& cloudParameters)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkColor3ub maskColor =\n      colors->GetColor3ub(cloudParameters.MaskColorName.c_str());\n  unsigned char maskR = maskColor.GetData()[0];\n  unsigned char maskG = maskColor.GetData()[1];\n  unsigned char maskB = maskColor.GetData()[2];\n\n  vtkColor3ub backgroundColor =\n      colors->GetColor3ub(cloudParameters.BackgroundColorName.c_str());\n  unsigned char bkgR = backgroundColor.GetData()[0];\n  unsigned char bkgG = backgroundColor.GetData()[1];\n  unsigned char bkgB = backgroundColor.GetData()[2];\n\n  vtkImageIterator<unsigned char> finalIt(finalImage, finalImage->GetExtent());\n  while (!finalIt.IsAtEnd())\n  {\n    auto finalSpan = finalIt.BeginSpan();\n    while (finalSpan != finalIt.EndSpan())\n    {\n      unsigned char R, G, B;\n      R = *finalSpan;\n      G = *(finalSpan + 1);\n      B = *(finalSpan + 2);\n      // If the pixel does not contain the background color, the word will not\n      // fit\n      if (R != maskR && G != maskG && B != maskB)\n      {\n        finalSpan += 3;\n        continue;\n      }\n      else\n      {\n        *finalSpan = bkgR;\n        *(finalSpan + 1) = bkgG;\n        *(finalSpan + 2) = bkgB;\n      }\n      finalSpan += 3;\n    }\n    finalIt.NextSpan();\n  }\n}\n\nvoid ShowColorSeriesNames(ostream& os)\n{\n  vtkNew<vtkColorSeries> colorSeries;\n  os << \"Valid schemes\" << std::endl;\n  for (auto i = 0; i < colorSeries->GetNumberOfColorSchemes(); ++i)\n  {\n    colorSeries->SetColorScheme(i);\n    os << \"  \" << colorSeries->GetColorSchemeName() << std::endl;\n  }\n}\n\nvoid CreateStopList(std::vector<std::string>& stopList)\n{\n  stopList.push_back(\"a\");\n  stopList.push_back(\"able\");\n  stopList.push_back(\"about\");\n  stopList.push_back(\"above\");\n  stopList.push_back(\"abst\");\n  stopList.push_back(\"accordance\");\n  stopList.push_back(\"according\");\n  stopList.push_back(\"accordingly\");\n  stopList.push_back(\"across\");\n  stopList.push_back(\"act\");\n  stopList.push_back(\"actually\");\n  stopList.push_back(\"added\");\n  stopList.push_back(\"adj\");\n  stopList.push_back(\"affected\");\n  stopList.push_back(\"affecting\");\n  stopList.push_back(\"affects\");\n  stopList.push_back(\"after\");\n  stopList.push_back(\"afterwards\");\n  stopList.push_back(\"again\");\n  stopList.push_back(\"against\");\n  stopList.push_back(\"ah\");\n  stopList.push_back(\"all\");\n  stopList.push_back(\"almost\");\n  stopList.push_back(\"alone\");\n  stopList.push_back(\"along\");\n  stopList.push_back(\"already\");\n  stopList.push_back(\"also\");\n  stopList.push_back(\"although\");\n  stopList.push_back(\"always\");\n  stopList.push_back(\"am\");\n  stopList.push_back(\"among\");\n  stopList.push_back(\"amongst\");\n  stopList.push_back(\"an\");\n  stopList.push_back(\"and\");\n  stopList.push_back(\"announce\");\n  stopList.push_back(\"another\");\n  stopList.push_back(\"any\");\n  stopList.push_back(\"anybody\");\n  stopList.push_back(\"anyhow\");\n  stopList.push_back(\"anymore\");\n  stopList.push_back(\"anyone\");\n  stopList.push_back(\"anything\");\n  stopList.push_back(\"anyway\");\n  stopList.push_back(\"anyways\");\n  stopList.push_back(\"anywhere\");\n  stopList.push_back(\"apparently\");\n  stopList.push_back(\"approximately\");\n  stopList.push_back(\"are\");\n  stopList.push_back(\"aren\");\n  stopList.push_back(\"arent\");\n  stopList.push_back(\"arise\");\n  stopList.push_back(\"around\");\n  stopList.push_back(\"as\");\n  stopList.push_back(\"aside\");\n  stopList.push_back(\"ask\");\n  stopList.push_back(\"asking\");\n  stopList.push_back(\"at\");\n  stopList.push_back(\"auth\");\n  stopList.push_back(\"available\");\n  stopList.push_back(\"away\");\n  stopList.push_back(\"awfully\");\n  stopList.push_back(\"b\");\n  stopList.push_back(\"back\");\n  stopList.push_back(\"be\");\n  stopList.push_back(\"became\");\n  stopList.push_back(\"because\");\n  stopList.push_back(\"become\");\n  stopList.push_back(\"becomes\");\n  stopList.push_back(\"becoming\");\n  stopList.push_back(\"been\");\n  stopList.push_back(\"before\");\n  stopList.push_back(\"beforehand\");\n  stopList.push_back(\"begin\");\n  stopList.push_back(\"beginning\");\n  stopList.push_back(\"beginnings\");\n  stopList.push_back(\"begins\");\n  stopList.push_back(\"behind\");\n  stopList.push_back(\"being\");\n  stopList.push_back(\"believe\");\n  stopList.push_back(\"below\");\n  stopList.push_back(\"beside\");\n  stopList.push_back(\"besides\");\n  stopList.push_back(\"between\");\n  stopList.push_back(\"beyond\");\n  stopList.push_back(\"biol\");\n  stopList.push_back(\"both\");\n  stopList.push_back(\"brief\");\n  stopList.push_back(\"briefly\");\n  stopList.push_back(\"but\");\n  stopList.push_back(\"by\");\n  stopList.push_back(\"c\");\n  stopList.push_back(\"ca\");\n  stopList.push_back(\"came\");\n  stopList.push_back(\"can\");\n  stopList.push_back(\"cannot\");\n  stopList.push_back(\"can't\");\n  stopList.push_back(\"cause\");\n  stopList.push_back(\"causes\");\n  stopList.push_back(\"certain\");\n  stopList.push_back(\"certainly\");\n  stopList.push_back(\"co\");\n  stopList.push_back(\"com\");\n  stopList.push_back(\"come\");\n  stopList.push_back(\"comes\");\n  stopList.push_back(\"contain\");\n  stopList.push_back(\"containing\");\n  stopList.push_back(\"contains\");\n  stopList.push_back(\"could\");\n  stopList.push_back(\"couldnt\");\n  stopList.push_back(\"cum\");\n  stopList.push_back(\"d\");\n  stopList.push_back(\"date\");\n  stopList.push_back(\"did\");\n  stopList.push_back(\"didn't\");\n  stopList.push_back(\"different\");\n  stopList.push_back(\"do\");\n  stopList.push_back(\"does\");\n  stopList.push_back(\"doesn't\");\n  stopList.push_back(\"doing\");\n  stopList.push_back(\"done\");\n  stopList.push_back(\"don't\");\n  stopList.push_back(\"down\");\n  stopList.push_back(\"downwards\");\n  stopList.push_back(\"due\");\n  stopList.push_back(\"dr\");\n  stopList.push_back(\"during\");\n  stopList.push_back(\"e\");\n  stopList.push_back(\"each\");\n  stopList.push_back(\"ed\");\n  stopList.push_back(\"edu\");\n  stopList.push_back(\"effect\");\n  stopList.push_back(\"eg\");\n  stopList.push_back(\"eight\");\n  stopList.push_back(\"eighty\");\n  stopList.push_back(\"either\");\n  stopList.push_back(\"else\");\n  stopList.push_back(\"elsewhere\");\n  stopList.push_back(\"end\");\n  stopList.push_back(\"ending\");\n  stopList.push_back(\"enough\");\n  stopList.push_back(\"especially\");\n  stopList.push_back(\"et\");\n  stopList.push_back(\"et-al\");\n  stopList.push_back(\"etc\");\n  stopList.push_back(\"even\");\n  stopList.push_back(\"ever\");\n  stopList.push_back(\"every\");\n  stopList.push_back(\"everybody\");\n  stopList.push_back(\"everyone\");\n  stopList.push_back(\"everything\");\n  stopList.push_back(\"everywhere\");\n  stopList.push_back(\"ex\");\n  stopList.push_back(\"except\");\n  stopList.push_back(\"f\");\n  stopList.push_back(\"far\");\n  stopList.push_back(\"few\");\n  stopList.push_back(\"ff\");\n  stopList.push_back(\"fifth\");\n  stopList.push_back(\"first\");\n  stopList.push_back(\"five\");\n  stopList.push_back(\"fix\");\n  stopList.push_back(\"followed\");\n  stopList.push_back(\"following\");\n  stopList.push_back(\"follows\");\n  stopList.push_back(\"for\");\n  stopList.push_back(\"former\");\n  stopList.push_back(\"formerly\");\n  stopList.push_back(\"forth\");\n  stopList.push_back(\"found\");\n  stopList.push_back(\"four\");\n  stopList.push_back(\"from\");\n  stopList.push_back(\"further\");\n  stopList.push_back(\"furthermore\");\n  stopList.push_back(\"g\");\n  stopList.push_back(\"gave\");\n  stopList.push_back(\"get\");\n  stopList.push_back(\"gets\");\n  stopList.push_back(\"getting\");\n  stopList.push_back(\"give\");\n  stopList.push_back(\"given\");\n  stopList.push_back(\"gives\");\n  stopList.push_back(\"giving\");\n  stopList.push_back(\"go\");\n  stopList.push_back(\"goes\");\n  stopList.push_back(\"gone\");\n  stopList.push_back(\"got\");\n  stopList.push_back(\"gotten\");\n  stopList.push_back(\"h\");\n  stopList.push_back(\"had\");\n  stopList.push_back(\"happens\");\n  stopList.push_back(\"hardly\");\n  stopList.push_back(\"has\");\n  stopList.push_back(\"hasn\");\n  stopList.push_back(\"have\");\n  stopList.push_back(\"haven\");\n  stopList.push_back(\"having\");\n  stopList.push_back(\"he\");\n  stopList.push_back(\"hed\");\n  stopList.push_back(\"hence\");\n  stopList.push_back(\"her\");\n  stopList.push_back(\"here\");\n  stopList.push_back(\"hereafter\");\n  stopList.push_back(\"hereby\");\n  stopList.push_back(\"herein\");\n  stopList.push_back(\"heres\");\n  stopList.push_back(\"hereupon\");\n  stopList.push_back(\"hers\");\n  stopList.push_back(\"herself\");\n  stopList.push_back(\"hes\");\n  stopList.push_back(\"hi\");\n  stopList.push_back(\"hid\");\n  stopList.push_back(\"him\");\n  stopList.push_back(\"himself\");\n  stopList.push_back(\"his\");\n  stopList.push_back(\"hither\");\n  stopList.push_back(\"home\");\n  stopList.push_back(\"how\");\n  stopList.push_back(\"howbeit\");\n  stopList.push_back(\"however\");\n  stopList.push_back(\"hundred\");\n  stopList.push_back(\"i\");\n  stopList.push_back(\"id\");\n  stopList.push_back(\"ie\");\n  stopList.push_back(\"if\");\n  stopList.push_back(\"im\");\n  stopList.push_back(\"immediate\");\n  stopList.push_back(\"immediately\");\n  stopList.push_back(\"importance\");\n  stopList.push_back(\"important\");\n  stopList.push_back(\"in\");\n  stopList.push_back(\"inc\");\n  stopList.push_back(\"indeed\");\n  stopList.push_back(\"index\");\n  stopList.push_back(\"information\");\n  stopList.push_back(\"instead\");\n  stopList.push_back(\"into\");\n  stopList.push_back(\"invention\");\n  stopList.push_back(\"inward\");\n  stopList.push_back(\"is\");\n  stopList.push_back(\"isn\");\n  stopList.push_back(\"it\");\n  stopList.push_back(\"itd\");\n  stopList.push_back(\"it\");\n  stopList.push_back(\"its\");\n  stopList.push_back(\"itself\");\n  stopList.push_back(\"j\");\n  stopList.push_back(\"jr\");\n  stopList.push_back(\"just\");\n  stopList.push_back(\"k\");\n  stopList.push_back(\"keep\");\n  stopList.push_back(\"keeps\");\n  stopList.push_back(\"kept\");\n  stopList.push_back(\"kg\");\n  stopList.push_back(\"km\");\n  stopList.push_back(\"know\");\n  stopList.push_back(\"known\");\n  stopList.push_back(\"knows\");\n  stopList.push_back(\"l\");\n  stopList.push_back(\"largely\");\n  stopList.push_back(\"last\");\n  stopList.push_back(\"lately\");\n  stopList.push_back(\"later\");\n  stopList.push_back(\"latter\");\n  stopList.push_back(\"latterly\");\n  stopList.push_back(\"laude\");\n  stopList.push_back(\"least\");\n  stopList.push_back(\"less\");\n  stopList.push_back(\"lest\");\n  stopList.push_back(\"let\");\n  stopList.push_back(\"lets\");\n  stopList.push_back(\"like\");\n  stopList.push_back(\"liked\");\n  stopList.push_back(\"likely\");\n  stopList.push_back(\"line\");\n  stopList.push_back(\"little\");\n  stopList.push_back(\"ll\");\n  stopList.push_back(\"look\");\n  stopList.push_back(\"looking\");\n  stopList.push_back(\"looks\");\n  stopList.push_back(\"ltd\");\n  stopList.push_back(\"m\");\n  stopList.push_back(\"made\");\n  stopList.push_back(\"mainly\");\n  stopList.push_back(\"make\");\n  stopList.push_back(\"makes\");\n  stopList.push_back(\"many\");\n  stopList.push_back(\"may\");\n  stopList.push_back(\"maybe\");\n  stopList.push_back(\"me\");\n  stopList.push_back(\"mean\");\n  stopList.push_back(\"means\");\n  stopList.push_back(\"meantime\");\n  stopList.push_back(\"meanwhile\");\n  stopList.push_back(\"merely\");\n  stopList.push_back(\"met\");\n  stopList.push_back(\"mg\");\n  stopList.push_back(\"mic\");\n  stopList.push_back(\"might\");\n  stopList.push_back(\"million\");\n  stopList.push_back(\"miss\");\n  stopList.push_back(\"ml\");\n  stopList.push_back(\"more\");\n  stopList.push_back(\"moreover\");\n  stopList.push_back(\"most\");\n  stopList.push_back(\"mostly\");\n  stopList.push_back(\"mr\");\n  stopList.push_back(\"mrs\");\n  stopList.push_back(\"much\");\n  stopList.push_back(\"mug\");\n  stopList.push_back(\"must\");\n  stopList.push_back(\"my\");\n  stopList.push_back(\"myself\");\n  stopList.push_back(\"n\");\n  stopList.push_back(\"na\");\n  stopList.push_back(\"name\");\n  stopList.push_back(\"namely\");\n  stopList.push_back(\"nay\");\n  stopList.push_back(\"nd\");\n  stopList.push_back(\"near\");\n  stopList.push_back(\"nearly\");\n  stopList.push_back(\"necessarily\");\n  stopList.push_back(\"necessary\");\n  stopList.push_back(\"need\");\n  stopList.push_back(\"needs\");\n  stopList.push_back(\"neither\");\n  stopList.push_back(\"never\");\n  stopList.push_back(\"nevertheless\");\n  stopList.push_back(\"new\");\n  stopList.push_back(\"next\");\n  stopList.push_back(\"nine\");\n  stopList.push_back(\"ninety\");\n  stopList.push_back(\"no\");\n  stopList.push_back(\"nobody\");\n  stopList.push_back(\"non\");\n  stopList.push_back(\"none\");\n  stopList.push_back(\"nonetheless\");\n  stopList.push_back(\"noone\");\n  stopList.push_back(\"nor\");\n  stopList.push_back(\"normally\");\n  stopList.push_back(\"nos\");\n  stopList.push_back(\"not\");\n  stopList.push_back(\"noted\");\n  stopList.push_back(\"nothing\");\n  stopList.push_back(\"now\");\n  stopList.push_back(\"nowhere\");\n  stopList.push_back(\"o\");\n  stopList.push_back(\"obtain\");\n  stopList.push_back(\"obtained\");\n  stopList.push_back(\"obviously\");\n  stopList.push_back(\"of\");\n  stopList.push_back(\"off\");\n  stopList.push_back(\"often\");\n  stopList.push_back(\"oh\");\n  stopList.push_back(\"ok\");\n  stopList.push_back(\"okay\");\n  stopList.push_back(\"old\");\n  stopList.push_back(\"omitted\");\n  stopList.push_back(\"on\");\n  stopList.push_back(\"once\");\n  stopList.push_back(\"one\");\n  stopList.push_back(\"ones\");\n  stopList.push_back(\"only\");\n  stopList.push_back(\"onto\");\n  stopList.push_back(\"or\");\n  stopList.push_back(\"ord\");\n  stopList.push_back(\"org\");\n  stopList.push_back(\"other\");\n  stopList.push_back(\"others\");\n  stopList.push_back(\"otherwise\");\n  stopList.push_back(\"ought\");\n  stopList.push_back(\"our\");\n  stopList.push_back(\"ours\");\n  stopList.push_back(\"ourselves\");\n  stopList.push_back(\"out\");\n  stopList.push_back(\"outside\");\n  stopList.push_back(\"over\");\n  stopList.push_back(\"overall\");\n  stopList.push_back(\"owing\");\n  stopList.push_back(\"own\");\n  stopList.push_back(\"p\");\n  stopList.push_back(\"page\");\n  stopList.push_back(\"pages\");\n  stopList.push_back(\"part\");\n  stopList.push_back(\"particular\");\n  stopList.push_back(\"particularly\");\n  stopList.push_back(\"past\");\n  stopList.push_back(\"per\");\n  stopList.push_back(\"perhaps\");\n  stopList.push_back(\"ph\");\n  stopList.push_back(\"placed\");\n  stopList.push_back(\"please\");\n  stopList.push_back(\"plus\");\n  stopList.push_back(\"poorly\");\n  stopList.push_back(\"possible\");\n  stopList.push_back(\"possibly\");\n  stopList.push_back(\"potentially\");\n  stopList.push_back(\"pp\");\n  stopList.push_back(\"predominantly\");\n  stopList.push_back(\"present\");\n  stopList.push_back(\"previously\");\n  stopList.push_back(\"primarily\");\n  stopList.push_back(\"probably\");\n  stopList.push_back(\"promptly\");\n  stopList.push_back(\"proud\");\n  stopList.push_back(\"provides\");\n  stopList.push_back(\"put\");\n  stopList.push_back(\"q\");\n  stopList.push_back(\"que\");\n  stopList.push_back(\"quickly\");\n  stopList.push_back(\"quite\");\n  stopList.push_back(\"qv\");\n  stopList.push_back(\"r\");\n  stopList.push_back(\"ran\");\n  stopList.push_back(\"rather\");\n  stopList.push_back(\"rd\");\n  stopList.push_back(\"re\");\n  stopList.push_back(\"readily\");\n  stopList.push_back(\"really\");\n  stopList.push_back(\"recent\");\n  stopList.push_back(\"recently\");\n  stopList.push_back(\"ref\");\n  stopList.push_back(\"refs\");\n  stopList.push_back(\"regarding\");\n  stopList.push_back(\"regardless\");\n  stopList.push_back(\"regards\");\n  stopList.push_back(\"related\");\n  stopList.push_back(\"relatively\");\n  stopList.push_back(\"research\");\n  stopList.push_back(\"respectively\");\n  stopList.push_back(\"resulted\");\n  stopList.push_back(\"resulting\");\n  stopList.push_back(\"results\");\n  stopList.push_back(\"right\");\n  stopList.push_back(\"run\");\n  stopList.push_back(\"s\");\n  stopList.push_back(\"said\");\n  stopList.push_back(\"same\");\n  stopList.push_back(\"saw\");\n  stopList.push_back(\"sat\");\n  stopList.push_back(\"say\");\n  stopList.push_back(\"saying\");\n  stopList.push_back(\"says\");\n  stopList.push_back(\"sec\");\n  stopList.push_back(\"section\");\n  stopList.push_back(\"see\");\n  stopList.push_back(\"seeing\");\n  stopList.push_back(\"seem\");\n  stopList.push_back(\"seemed\");\n  stopList.push_back(\"seeming\");\n  stopList.push_back(\"seems\");\n  stopList.push_back(\"seen\");\n  stopList.push_back(\"self\");\n  stopList.push_back(\"selves\");\n  stopList.push_back(\"sent\");\n  stopList.push_back(\"seven\");\n  stopList.push_back(\"several\");\n  stopList.push_back(\"shall\");\n  stopList.push_back(\"she\");\n  stopList.push_back(\"shed\");\n  stopList.push_back(\"shes\");\n  stopList.push_back(\"should\");\n  stopList.push_back(\"shouldn\");\n  stopList.push_back(\"show\");\n  stopList.push_back(\"showed\");\n  stopList.push_back(\"shown\");\n  stopList.push_back(\"showns\");\n  stopList.push_back(\"shows\");\n  stopList.push_back(\"significant\");\n  stopList.push_back(\"significantly\");\n  stopList.push_back(\"similar\");\n  stopList.push_back(\"similarly\");\n  stopList.push_back(\"since\");\n  stopList.push_back(\"six\");\n  stopList.push_back(\"slightly\");\n  stopList.push_back(\"so\");\n  stopList.push_back(\"some\");\n  stopList.push_back(\"somebody\");\n  stopList.push_back(\"somehow\");\n  stopList.push_back(\"someone\");\n  stopList.push_back(\"somethan\");\n  stopList.push_back(\"something\");\n  stopList.push_back(\"sometime\");\n  stopList.push_back(\"sometimes\");\n  stopList.push_back(\"somewhat\");\n  stopList.push_back(\"somewhere\");\n  stopList.push_back(\"soon\");\n  stopList.push_back(\"sorry\");\n  stopList.push_back(\"specifically\");\n  stopList.push_back(\"specified\");\n  stopList.push_back(\"specify\");\n  stopList.push_back(\"specifying\");\n  stopList.push_back(\"still\");\n  stopList.push_back(\"stop\");\n  stopList.push_back(\"strongly\");\n  stopList.push_back(\"sub\");\n  stopList.push_back(\"substantially\");\n  stopList.push_back(\"successfully\");\n  stopList.push_back(\"such\");\n  stopList.push_back(\"sufficiently\");\n  stopList.push_back(\"suggest\");\n  stopList.push_back(\"sup\");\n  stopList.push_back(\"sure\");\n  stopList.push_back(\"t\");\n  stopList.push_back(\"take\");\n  stopList.push_back(\"taken\");\n  stopList.push_back(\"taking\");\n  stopList.push_back(\"tell\");\n  stopList.push_back(\"tends\");\n  stopList.push_back(\"th\");\n  stopList.push_back(\"than\");\n  stopList.push_back(\"thank\");\n  stopList.push_back(\"thanks\");\n  stopList.push_back(\"thanx\");\n  stopList.push_back(\"that\");\n  stopList.push_back(\"thats\");\n  stopList.push_back(\"the\");\n  stopList.push_back(\"their\");\n  stopList.push_back(\"theirs\");\n  stopList.push_back(\"them\");\n  stopList.push_back(\"themselves\");\n  stopList.push_back(\"then\");\n  stopList.push_back(\"thence\");\n  stopList.push_back(\"there\");\n  stopList.push_back(\"thereafter\");\n  stopList.push_back(\"thereby\");\n  stopList.push_back(\"thered\");\n  stopList.push_back(\"therefore\");\n  stopList.push_back(\"therein\");\n  stopList.push_back(\"thereof\");\n  stopList.push_back(\"therere\");\n  stopList.push_back(\"theres\");\n  stopList.push_back(\"thereto\");\n  stopList.push_back(\"thereupon\");\n  stopList.push_back(\"these\");\n  stopList.push_back(\"they\");\n  stopList.push_back(\"theyd\");\n  stopList.push_back(\"theyre\");\n  stopList.push_back(\"think\");\n  stopList.push_back(\"this\");\n  stopList.push_back(\"those\");\n  stopList.push_back(\"thou\");\n  stopList.push_back(\"though\");\n  stopList.push_back(\"thoughh\");\n  stopList.push_back(\"thousand\");\n  stopList.push_back(\"throug\");\n  stopList.push_back(\"through\");\n  stopList.push_back(\"throughout\");\n  stopList.push_back(\"thru\");\n  stopList.push_back(\"thus\");\n  stopList.push_back(\"til\");\n  stopList.push_back(\"tip\");\n  stopList.push_back(\"to\");\n  stopList.push_back(\"together\");\n  stopList.push_back(\"too\");\n  stopList.push_back(\"took\");\n  stopList.push_back(\"toward\");\n  stopList.push_back(\"towards\");\n  stopList.push_back(\"tried\");\n  stopList.push_back(\"tries\");\n  stopList.push_back(\"truly\");\n  stopList.push_back(\"try\");\n  stopList.push_back(\"trying\");\n  stopList.push_back(\"ts\");\n  stopList.push_back(\"twice\");\n  stopList.push_back(\"two\");\n  stopList.push_back(\"u\");\n  stopList.push_back(\"un\");\n  stopList.push_back(\"under\");\n  stopList.push_back(\"unfortunately\");\n  stopList.push_back(\"unless\");\n  stopList.push_back(\"unlike\");\n  stopList.push_back(\"unlikely\");\n  stopList.push_back(\"until\");\n  stopList.push_back(\"unto\");\n  stopList.push_back(\"up\");\n  stopList.push_back(\"upon\");\n  stopList.push_back(\"ups\");\n  stopList.push_back(\"us\");\n  stopList.push_back(\"use\");\n  stopList.push_back(\"used\");\n  stopList.push_back(\"useful\");\n  stopList.push_back(\"usefully\");\n  stopList.push_back(\"usefulness\");\n  stopList.push_back(\"uses\");\n  stopList.push_back(\"using\");\n  stopList.push_back(\"usually\");\n  stopList.push_back(\"v\");\n  stopList.push_back(\"value\");\n  stopList.push_back(\"various\");\n  stopList.push_back(\"ve\");\n  stopList.push_back(\"very\");\n  stopList.push_back(\"via\");\n  stopList.push_back(\"viz\");\n  stopList.push_back(\"vol\");\n  stopList.push_back(\"vols\");\n  stopList.push_back(\"vs\");\n  stopList.push_back(\"w\");\n  stopList.push_back(\"want\");\n  stopList.push_back(\"wants\");\n  stopList.push_back(\"was\");\n  stopList.push_back(\"wasnt\");\n  stopList.push_back(\"wasnt\");\n  stopList.push_back(\"way\");\n  stopList.push_back(\"we\");\n  stopList.push_back(\"wed\");\n  stopList.push_back(\"welcome\");\n  stopList.push_back(\"went\");\n  stopList.push_back(\"were\");\n  stopList.push_back(\"werent\");\n  stopList.push_back(\"what\");\n  stopList.push_back(\"whatever\");\n  stopList.push_back(\"whats\");\n  stopList.push_back(\"when\");\n  stopList.push_back(\"whence\");\n  stopList.push_back(\"whenever\");\n  stopList.push_back(\"where\");\n  stopList.push_back(\"whereafter\");\n  stopList.push_back(\"whereas\");\n  stopList.push_back(\"whereby\");\n  stopList.push_back(\"wherein\");\n  stopList.push_back(\"wheres\");\n  stopList.push_back(\"whereupon\");\n  stopList.push_back(\"wherever\");\n  stopList.push_back(\"whether\");\n  stopList.push_back(\"which\");\n  stopList.push_back(\"while\");\n  stopList.push_back(\"whim\");\n  stopList.push_back(\"whither\");\n  stopList.push_back(\"who\");\n  stopList.push_back(\"whod\");\n  stopList.push_back(\"whoever\");\n  stopList.push_back(\"whole\");\n  stopList.push_back(\"whom\");\n  stopList.push_back(\"whomever\");\n  stopList.push_back(\"whos\");\n  stopList.push_back(\"whose\");\n  stopList.push_back(\"why\");\n  stopList.push_back(\"widely\");\n  stopList.push_back(\"will\");\n  stopList.push_back(\"willing\");\n  stopList.push_back(\"wish\");\n  stopList.push_back(\"with\");\n  stopList.push_back(\"within\");\n  stopList.push_back(\"without\");\n  stopList.push_back(\"wont\");\n  stopList.push_back(\"words\");\n  stopList.push_back(\"world\");\n  stopList.push_back(\"would\");\n  stopList.push_back(\"wouldnt\");\n  stopList.push_back(\"www\");\n  stopList.push_back(\"x\");\n  stopList.push_back(\"y\");\n  stopList.push_back(\"yes\");\n  stopList.push_back(\"yet\");\n  stopList.push_back(\"you\");\n  stopList.push_back(\"youd\");\n  stopList.push_back(\"your\");\n  stopList.push_back(\"youre\");\n  stopList.push_back(\"yours\");\n  stopList.push_back(\"yourself\");\n  stopList.push_back(\"yourselves\");\n  stopList.push_back(\"z\");\n  stopList.push_back(\"zero\");\n}\n} // namespace\n
"},{"location":"Cxx/InfoVis/WordCloud/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WordCloud)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WordCloud: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WordCloud MACOSX_BUNDLE WordCloud.cxx )\n  target_link_libraries(WordCloud PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WordCloud\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/WordCloud/#download-and-build-wordcloud","title":"Download and Build WordCloud","text":"

Click here to download WordCloud and its CMakeLists.txt file. Once the tarball WordCloud.tar has been downloaded and extracted,

cd WordCloud/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WordCloud\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/WordCloudDemo/","title":"WordCloudDemo","text":"

vtk-examples/Cxx/InfoVis/WordCloudDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/WordCloudDemo/#code","title":"Code","text":"

WordCloudDemo.cxx

#include <vtkNew.h>\n#include <vtkSmartPointer.h>\n#include <vtkWordCloud.h>\n\n#include <vtkCamera.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <vtksys/CommandLineArguments.hxx>\n\nnamespace {\n// Cloud Parameters.\nclass CloudParameters\n{\npublic:\n  CloudParameters()\n    : BackgroundColorName(\"MidnightBlue\"),\n      BWMask(false),\n      ColorSchemeName(\"\"),\n      DPI(200),\n      FileName(\"\"),\n      FontFileName(\"\"),\n      FontMultiplier(6),\n      Gap(2),\n      MaskColorName(\"black\"),\n      MaskFileName(\"\"),\n      MaxFontSize(48),\n      MinFontSize(12),\n      MinFrequency(1),\n      StopListFileName(\"\"),\n      Title(\"\"),\n      WordColorName(\"\"){};\n  void Print(ostream& os)\n  {\n    os << \"Cloud Parameters\" << std::endl;\n    os << \"  BackgroundColorName: \" << BackgroundColorName << std::endl;\n    os << \"  BWMask: \" << (BWMask ? \"true\" : \"false\") << std::endl;\n    os << \"  ColorDistribution: \" << ColorDistribution[0] << \" \"\n       << ColorDistribution[1] << std::endl;\n    os << \"  ColorSchemeName: \" << ColorSchemeName << std::endl;\n    os << \"  DPI: \" << DPI << std::endl;\n    os << \"  FontFileName: \" << FontFileName << std::endl;\n    os << \"  FontMultiplier: \" << FontMultiplier << std::endl;\n    os << \"  Gap: \" << Gap << std::endl;\n    os << \"  MaskColorName: \" << MaskColorName << std::endl;\n    os << \"  MaskFileName: \" << MaskFileName << std::endl;\n    os << \"  MinFontSize: \" << MinFontSize << std::endl;\n    os << \"  MaxFontSize: \" << MaxFontSize << std::endl;\n    os << \"  MinFrequency: \" << MinFrequency << std::endl;\n    os << \"  OffsetDistribution: \" << OffsetDistribution[0] << \" \"\n       << OffsetDistribution[1] << std::endl;\n    os << \"  OrientationDistribution: \" << OrientationDistribution[0] << \" \"\n       << OrientationDistribution[1] << std::endl;\n    os << \"  Orientations: \";\n    for (auto o : Orientations)\n    {\n      os << o << \" \";\n    }\n    os << std::endl;\n    os << \"  ReplacementPairs: \";\n    for (auto p = 0; p < ReplacementPairs.size(); p += 2)\n    {\n      os << ReplacementPairs[p] << \"->\" << ReplacementPairs[p + 1] << \" \";\n    }\n    os << std::endl;\n    os << \"  Sizes: \" << Sizes[0] << \" \" << Sizes[1] << std::endl;\n    os << \"  StopWords: \";\n    for (auto const& s : StopWords)\n    {\n      os << s << \" \";\n    }\n    os << std::endl;\n    os << \"  Title: \" << Title << std::endl;\n    os << \"  WordColorName: \" << WordColorName << std::endl;\n  }\n  std::string BackgroundColorName;\n  bool BWMask;\n  std::string ColorSchemeName;\n  std::vector<double> ColorDistribution;\n  int DPI;\n  std::string FileName;\n  std::string FontFileName;\n  int FontMultiplier;\n  int Gap;\n  std::string MaskColorName;\n  std::string MaskFileName;\n  int MaxFontSize;\n  int MinFontSize;\n  int MinFrequency;\n  std::vector<int> OffsetDistribution;\n  std::vector<double> OrientationDistribution;\n  std::vector<double> Orientations;\n  std::vector<std::string> ReplacementPairs;\n  std::vector<int> Sizes;\n  std::vector<std::string> StopWords;\n  std::string StopListFileName;\n  std::string Title;\n  std::string WordColorName;\n};\n\nbool ProcessCommandLine(vtksys::CommandLineArguments& arg,\n                        CloudParameters& cloudParameters);\n\nvoid CloudParametersToWordCloud(CloudParameters& cloudParameters,\n                                vtkSmartPointer<vtkWordCloud>& wordCloud);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Process command line argumemts.\n  CloudParameters cloudParameters;\n  vtksys::CommandLineArguments arg;\n  arg.Initialize(argc, argv);\n  if (!ProcessCommandLine(arg, cloudParameters))\n  {\n    return EXIT_FAILURE;\n  }\n\n  // Transfer parameters to word cloud member data.\n  auto wordCloud = vtkSmartPointer<vtkWordCloud>::New();\n  CloudParametersToWordCloud(cloudParameters, wordCloud);\n\n  // Get the file that contains the text to be converted to a word cloud.\n  char** newArgv = nullptr;\n  int newArgc = 0;\n  arg.GetUnusedArguments(&newArgc, &newArgv);\n  if (newArgc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" textFileName \" << arg.GetHelp()\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  wordCloud->SetFileName(newArgv[1]);\n  wordCloud->Update();\n  wordCloud->Print(std::cout);\n  std::cout << \"Kept Words: \" << wordCloud->GetKeptWords().size() << std::endl;\n  std::cout << \"Stopped Words: \" << wordCloud->GetStoppedWords().size()\n            << std::endl;\n  std::cout << \"Skipped Words: \" << wordCloud->GetSkippedWords().size()\n            << std::endl;\n\n  // Display the final image.\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputData(wordCloud->GetOutput());\n  imageViewer->SetupInteractor(interactor);\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(wordCloud->GetBackgroundColorName()).GetData());\n  imageViewer->SetSize(wordCloud->GetSizes()[0], wordCloud->GetSizes()[1]);\n  imageViewer->GetRenderer()->ResetCamera();\n\n  // Zoom in a bit\n  vtkCamera* camera = imageViewer->GetRenderer()->GetActiveCamera();\n  camera->ParallelProjectionOn();\n  camera->SetParallelScale(wordCloud->GetAdjustedSizes()[0] * .4);\n\n  imageViewer->GetRenderWindow()->SetWindowName(\"WordCloudDemo\");\n  imageViewer->GetRenderWindow()->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nbool ProcessCommandLine(vtksys::CommandLineArguments& arg,\n                        CloudParameters& cloudParameters)\n{\n  typedef vtksys::CommandLineArguments argT;\n\n  // Need this to get arguments without --'s.\n  arg.StoreUnusedArguments(true);\n\n  arg.AddArgument(\"--backgroundColorName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.BackgroundColorName,\n                  \"Name of the color for the background(MignightBlue)\");\n  arg.AddArgument(\n      \"--colorDistribution\", argT::MULTI_ARGUMENT,\n      &cloudParameters.ColorDistribution,\n      \"Distribution of random colors(.6 1.0). If wordColorName is not empty, \"\n      \"random colors are generated with this distribution\");\n  arg.AddArgument(\"--colorSchemeName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.ColorSchemeName, \"Color scheme name()\");\n  arg.AddArgument(\"--dpi\", argT::SPACE_ARGUMENT, &cloudParameters.DPI,\n                  \"Dots per inch(200)\");\n  arg.AddArgument(\"--fontFileName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.FontFileName,\n                  \"Font file name(\\\"\\\"). If fontFileName is empty, the \"\n                  \"built-in Arial font is used.\");\n  arg.AddArgument(\"--fontMultiplier\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.FontMultiplier,\n                  \"Font multiplier(6). This final FontSize is this value * the \"\n                  \"word frequency.\");\n  arg.AddArgument(\"--gap\", argT::SPACE_ARGUMENT, &cloudParameters.Gap,\n                  \"Space gap of words (2). The gap is the number of spaces \"\n                  \"added to the beginning and end of each word\");\n  arg.AddArgument(\n      \"--maskColorName\", argT::SPACE_ARGUMENT, &cloudParameters.MaskColorName,\n      \"Name of the color for the mask (black). This is the name of the color \"\n      \"that defines the foreground of the mask. Usually black or white\");\n  arg.AddArgument(\n      \"--maskFileName\", argT::SPACE_ARGUMENT, &cloudParameters.MaskFileName,\n      \"Mask file name(\\\"\\\"). If the mask file is specified, if will be used as \"\n      \"the mask, otherwise a black square is used as the mask.\");\n  arg.AddArgument(\"--minFontSize\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MinFontSize, \"Minimum font size(8)\");\n  arg.AddArgument(\"--minFrequency\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MinFrequency,\n                  \"Minimum word frequency accepted(2)\");\n  arg.AddArgument(\"--maxFontSize\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MaxFontSize, \"Maximum font size(48)\");\n  arg.AddArgument(\n      \"--offsetDistribution\", argT::MULTI_ARGUMENT,\n      &cloudParameters.OffsetDistribution,\n      \"Range of random offsets(-size[0]/100.0 -size{1]/100.0)(-20 20).\");\n  arg.AddArgument(\"--orientationDistribution\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.OrientationDistribution,\n                  \"Ranges of random orientations(-20 20)\");\n  arg.AddArgument(\"--orientations\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.Orientations,\n                  \"List of discrete orientations (). If non-empty, these will \"\n                  \"be used instead of the orientations distribution\");\n  arg.AddArgument(\n      \"--stopListFileName\", argT::SPACE_ARGUMENT,\n      &cloudParameters.StopListFileName,\n      \"User provided stop list file. Replaces built-in stop list().\");\n  arg.AddArgument(\"--stopWords\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.StopWords,\n                  \"User provided stop words(). These will ba added to the \"\n                  \"built-in stop list.\");\n  arg.AddArgument(\"--bwMask\", argT::NO_ARGUMENT, &cloudParameters.BWMask,\n                  \"Mask image has a single channel(false). Mask images \"\n                  \"normally have three channels (r,g,b).\");\n  arg.AddArgument(\"--size\", argT::MULTI_ARGUMENT, &cloudParameters.Sizes,\n                  \"Size of image(640 480)\");\n  arg.AddArgument(\"--wordColorName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.WordColorName,\n                  \"Name of the color for the words(). If the name is empty, \"\n                  \"the colorDistribution will generate random colors.\");\n  arg.AddArgument(\"--replacementPairs\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.ReplacementPairs,\n                  \"Replace word with another word ().\");\n  arg.AddArgument(\"--title\", argT::SPACE_ARGUMENT, &cloudParameters.Title,\n                  \"Use this word and set a high frequency().\");\n  bool help = false;\n  arg.AddArgument(\"--help\", argT::NO_ARGUMENT, &help, \"Show help(false)\");\n  arg.Parse();\n  if (help)\n  {\n    std::cout << \"Usage: \"\n              << \"WordCloud\"\n              << \" textFileName \" << arg.GetHelp() << std::endl;\n    return false;\n  }\n\n  // Set defaults for vector arguments.\n  if (cloudParameters.ColorDistribution.size() == 0)\n  {\n    cloudParameters.ColorDistribution.push_back(.6);\n    cloudParameters.ColorDistribution.push_back(1.0);\n  }\n\n  if (cloudParameters.OrientationDistribution.size() == 0)\n  {\n    cloudParameters.OrientationDistribution.push_back(-20);\n    cloudParameters.OrientationDistribution.push_back(20);\n  }\n  if (cloudParameters.Sizes.size() == 0)\n  {\n    cloudParameters.Sizes.push_back(640);\n    cloudParameters.Sizes.push_back(480);\n  }\n  if (cloudParameters.OffsetDistribution.size() == 0)\n  {\n    cloudParameters.OffsetDistribution.push_back(-cloudParameters.Sizes[0] /\n                                                 100.0);\n    cloudParameters.OffsetDistribution.push_back(cloudParameters.Sizes[1] /\n                                                 100.0);\n  }\n  return true;\n}\nvoid CloudParametersToWordCloud(CloudParameters& cloudParameters,\n                                vtkSmartPointer<vtkWordCloud>& wordCloud)\n{\n  wordCloud->SetBackgroundColorName(cloudParameters.BackgroundColorName);\n  wordCloud->SetBWMask(cloudParameters.BWMask);\n  wordCloud->SetColorSchemeName(cloudParameters.ColorSchemeName);\n  wordCloud->SetFontFileName(cloudParameters.FontFileName);\n\n  std::array<double, 2> colorDistribution;\n  colorDistribution[0] = cloudParameters.ColorDistribution[0];\n  colorDistribution[1] = cloudParameters.ColorDistribution[1];\n  wordCloud->SetColorDistribution(colorDistribution);\n  wordCloud->SetDPI(cloudParameters.DPI);\n  wordCloud->SetFileName(cloudParameters.FileName);\n  wordCloud->SetFontFileName(cloudParameters.FontFileName);\n  wordCloud->SetFontMultiplier(cloudParameters.FontMultiplier);\n  wordCloud->SetGap(cloudParameters.Gap);\n  wordCloud->SetMaskColorName(cloudParameters.MaskColorName);\n  wordCloud->SetMaskFileName(cloudParameters.MaskFileName);\n  wordCloud->SetMaxFontSize(cloudParameters.MaxFontSize);\n  wordCloud->SetMinFontSize(cloudParameters.MinFontSize);\n  wordCloud->SetMinFrequency(cloudParameters.MinFrequency);\n\n  std::array<int, 2> offsetDistribution;\n  offsetDistribution[0] = cloudParameters.OffsetDistribution[0];\n  offsetDistribution[1] = cloudParameters.OffsetDistribution[1];\n  wordCloud->SetOffsetDistribution(offsetDistribution);\n\n  std::array<double, 2> orientationDistribution;\n  orientationDistribution[0] = cloudParameters.OrientationDistribution[0];\n  orientationDistribution[1] = cloudParameters.OrientationDistribution[1];\n  wordCloud->SetOrientationDistribution(orientationDistribution);\n  wordCloud->SetOrientations(cloudParameters.Orientations);\n\n  std::vector<std::tuple<std::string, std::string>> replacementPairs;\n  std::tuple<std::string, std::string> replacementPair;\n  for (auto p = 0; p < cloudParameters.ReplacementPairs.size(); p += 2)\n  {\n    std::string from = cloudParameters.ReplacementPairs[p];\n    std::string to = cloudParameters.ReplacementPairs[p + 1];\n    replacementPair = std::make_tuple(from, to);\n    replacementPairs.push_back(replacementPair);\n  }\n  wordCloud->SetReplacementPairs(replacementPairs);\n\n  std::array<int, 2> sizes;\n  sizes[0] = cloudParameters.Sizes[0];\n  sizes[1] = cloudParameters.Sizes[1];\n  wordCloud->SetSizes(sizes);\n\n  std::set<std::string> stopWords;\n  for (auto const& s : cloudParameters.StopWords)\n  {\n    stopWords.insert(s);\n  }\n  wordCloud->SetStopWords(stopWords);\n  wordCloud->SetStopListFileName(cloudParameters.StopListFileName);\n  wordCloud->SetWordColorName(cloudParameters.WordColorName);\n  std::string title(cloudParameters.Title);\n  wordCloud->SetTitle(title);\n}\n} // namespace\n
"},{"location":"Cxx/InfoVis/WordCloudDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WordCloudDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InfovisCore\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WordCloudDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WordCloudDemo MACOSX_BUNDLE WordCloudDemo.cxx )\n  target_link_libraries(WordCloudDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WordCloudDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/WordCloudDemo/#download-and-build-wordclouddemo","title":"Download and Build WordCloudDemo","text":"

Click here to download WordCloudDemo and its CMakeLists.txt file. Once the tarball WordCloudDemo.tar has been downloaded and extracted,

cd WordCloudDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WordCloudDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/InfoVis/XGMLReader/","title":"XGMLReader","text":"

vtk-examples/Cxx/InfoVis/XGMLReader

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/InfoVis/XGMLReader/#description","title":"Description","text":"

This example reads and displays the graph from a gml file.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/InfoVis/XGMLReader/#code","title":"Code","text":"

XGMLReader.cxx

#include <vtkGraphLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimple2DLayoutStrategy.h>\n#include <vtkUndirectedGraph.h>\n#include <vtkViewTheme.h>\n#include <vtkXGMLReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: Filename e.g. fsm.gml\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkXGMLReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  vtkUndirectedGraph* g = reader->GetOutput();\n\n  vtkNew<vtkViewTheme> theme;\n  theme->SetLineWidth(1);\n  theme->SetPointSize(5);\n  theme->SetCellOpacity(0.99);\n  theme->SetOutlineColor(colors->GetColor3d(\"Gray\").GetData());\n  // Vertices\n  theme->SetPointColor(colors->GetColor3d(\"Chartreuse\").GetData());\n  theme->SetSelectedPointColor(colors->GetColor3d(\"Magenta\").GetData());\n  theme->SetPointHueRange(1.0, 1.0);\n  theme->SetPointSaturationRange(1.0, 1.0);\n  theme->SetPointValueRange(0.0, 1.0);\n  // theme->SetPointAlphaRange(0.2, 0.8);\n  // Edges\n  theme->SetCellColor(colors->GetColor3d(\"Honeydew\").GetData());\n  theme->SetSelectedCellColor(colors->GetColor3d(\"Cyan\").GetData());\n  theme->SetCellHueRange(0.1, 0.1);\n  theme->SetCellSaturationRange(0.2, 1.0);\n  theme->SetCellValueRange(0.5, 1.0);\n  // theme->SetCellAlphaRange(0.2, 0.8);\n\n  vtkNew<vtkSimple2DLayoutStrategy> simple2D;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  graphLayoutView->ApplyViewTheme(theme);\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView->SetLayoutStrategy(simple2D);\n  graphLayoutView->SetLayoutStrategyToSimple2D();\n\n  graphLayoutView->ResetCamera();\n\n  graphLayoutView->GetRenderer()->GradientBackgroundOn();\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Black\").GetData());\n\n  graphLayoutView->GetRenderWindow()->SetSize(600, 600);\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"XGMLReader\");\n\n  graphLayoutView->Render();\n\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/InfoVis/XGMLReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(XGMLReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOInfovis\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"XGMLReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(XGMLReader MACOSX_BUNDLE XGMLReader.cxx )\n  target_link_libraries(XGMLReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS XGMLReader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/InfoVis/XGMLReader/#download-and-build-xgmlreader","title":"Download and Build XGMLReader","text":"

Click here to download XGMLReader and its CMakeLists.txt file. Once the tarball XGMLReader.tar has been downloaded and extracted,

cd XGMLReader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./XGMLReader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/Assembly/","title":"Assembly","text":"

vtk-examples/Cxx/Interaction/Assembly

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/Assembly/#code","title":"Code","text":"

Assembly.cxx

#include <vtkActor.h>\n#include <vtkAssembly.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetCenter(5.0, 0.0, 0.0);\n  cubeSource->Update();\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  // Combine the sphere and cube into an assembly.\n  vtkNew<vtkAssembly> assembly;\n  assembly->AddPart(sphereActor);\n  assembly->AddPart(cubeActor);\n\n  // Apply a transform to the whole assembly.\n  vtkNew<vtkTransform> transform;\n  transform->PostMultiply(); // This is the key line.\n  transform->Translate(5.0, 0, 0);\n\n  assembly->SetUserTransform(transform);\n\n  // Extract each actor from the assembly and change its opacity.\n  vtkNew<vtkPropCollection> collection;\n\n  assembly->GetActors(collection);\n  collection->InitTraversal();\n  for (vtkIdType i = 0; i < collection->GetNumberOfItems(); i++)\n  {\n    dynamic_cast<vtkActor*>(collection->GetNextProp())\n        ->GetProperty()\n        ->SetOpacity(0.5);\n  }\n\n  // Visualization\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(assembly);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderer->ResetCamera();\n  renderWindow->SetWindowName(\"Assembly\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/Assembly/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Assembly)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Assembly: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Assembly MACOSX_BUNDLE Assembly.cxx )\n  target_link_libraries(Assembly PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Assembly\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/Assembly/#download-and-build-assembly","title":"Download and Build Assembly","text":"

Click here to download Assembly and its CMakeLists.txt file. Once the tarball Assembly.tar has been downloaded and extracted,

cd Assembly/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Assembly\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/CallBack/","title":"CallBack","text":"

vtk-examples/Cxx/Interaction/CallBack

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/CallBack/#description","title":"Description","text":""},{"location":"Cxx/Interaction/CallBack/#demonstrate-how-to-set-up-a-callback-with-client-data","title":"Demonstrate how to set up a callback with client data","text":"

Getting the camera orientation after interacting with the image is used as an example.

We define a callback passing the active camera as client data and linking the callback to the EndInteractionEvent of the vtkRenderWindowInteractor class. This allows us to get the camera orientation after we manipulate the image. We can then copy/paste this data as needed into our camera to set up a nice initial orientation as shown in the example.

To help orient the cone, we use a vtkOrientationMarkerWidget and a vtkOutlineFilter.

"},{"location":"Cxx/Interaction/CallBack/#c","title":"C++","text":"

There are two methodologies in C++.

  1. Create a class that inherits from vtkCallbackCommand reimplementing Execute( vtkObject *caller, unsigned long evId, void*) and setting pointers to a client and/or call data as needed. When the class is implemented, it becomes the callback function.
  2. Create a function with this signature: void f( vtkObject * caller, long unsigned int evId, void* clientData, void* callData) and, where needed, create a vtkCallbackCommand setting its callback to the function we have created.

The example demonstrates both approaches.

In the function PrintCameraOrientation note how we convert an array to a vector and get a comma-separated list.

"},{"location":"Cxx/Interaction/CallBack/#python","title":"Python","text":"

In Python the approach is even simpler. We simply define a function to use as the callback with this signature: def MyCallback(obj, ev):. Then, to pass client data to it, we simply do: MyCallback.myClientData = myClientData. This relies on the fact that Python functions are in fact objects and we are simply adding new attributes such as myClientData in this case.

An alternative method is to define a class passsing the needed variables in the __init__ function and then implement a _call__ function that does the work.

Both approaches are demonstrated in the example.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/CallBack/#code","title":"Code","text":"

CallBack.cxx

/*\nDemonstrate the use of a callback.\n\nWe also add call data.\n\n*/\n\n#include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iterator>\n#include <sstream>\n#include <vector>\n\n#define USE_CALLBACKCOMMAND_CLASS\n// Uncomment this if you want to use the function instead.\n// #undef USE_CALLBACKCOMMAND_CLASS\n\nnamespace {\nvoid PrintCameraOrientation(vtkCamera* cam);\nvoid MakeAxesActor(vtkAxesActor* axesActor);\n\n#if defined(USE_CALLBACKCOMMAND_CLASS)\n/**\nHere we inherit from vtkCallbackCommand and set pointers to any\nclient and/or call data as needed.\nWhen the class is implemented, it becomes the callback function.\n*/\nclass CameraModifiedCallback : public vtkCallbackCommand\n{\npublic:\n  static CameraModifiedCallback* New()\n  {\n    return new CameraModifiedCallback;\n  }\n  // Here we Create a vtkCallbackCommand and reimplement it.\n  void Execute(vtkObject* caller, unsigned long evId, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto interactor = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n    // Just do this to demonstrate who called callback and the event that\n    // triggered it.\n    std::cout << interactor->GetClassName() << \"  Event Id: \" << evId\n              << std::endl;\n\n    // Now print the camera orientation.\n    PrintCameraOrientation(this->cam);\n  }\n  CameraModifiedCallback() : cam(nullptr)\n  {\n  }\n  // Set pointers to any clientData or callData here.\n  vtkCamera* cam;\n\nprivate:\n  CameraModifiedCallback(const CameraModifiedCallback&) = delete;\n  void operator=(const CameraModifiedCallback&) = delete;\n};\n\n#else\n/**\nAn alternative method is to create a function with this signature:\nvoid f(vtkObject* caller, long unsigned int evId, void* clientData, void*\ncallData)\nand, where needed, create a vtkCallbackCommand setting its callback to the\nfunction we have created.\n*/\nvoid vtkCallbackFunc(vtkObject* caller, long unsigned int evId,\n                     void* clientData, void* /*callData*/)\n{\n  // Note the use of reinterpret_cast to cast the caller and callData to the\n  // expected types.\n  auto interactor = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n  std::cout << interactor->GetClassName() << \"  Event Id: \" << evId\n            << std::endl;\n  auto cam = reinterpret_cast<vtkCamera*>(clientData);\n\n  // Now print the camera orientation.\n  PrintCameraOrientation(cam);\n};\n#endif\n} // namespace\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the Renderer, RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Use a cone as a source.\n  vtkNew<vtkConeSource> source;\n  source->SetCenter(0, 0, 0);\n  source->SetRadius(1);\n  // Use the golden ratio for the height. Because we can!\n  source->SetHeight(1.6180339887498948482);\n  source->SetResolution(128);\n  source->Update();\n\n  // Pipeline\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"peacock\").GetData());\n  // Lighting\n  actor->GetProperty()->SetAmbient(0.3);\n  actor->GetProperty()->SetDiffuse(0.0);\n  actor->GetProperty()->SetSpecular(1.0);\n  actor->GetProperty()->SetSpecularPower(20.0);\n\n  // Get an outline of the data set for context.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputData(source->GetOutput());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(actor);\n\n  ren->AddActor(outlineActor);\n  ren->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n  renWin->SetSize(512, 512);\n\n  // Set up a nice camera position.\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(4.6, -2.0, 3.8);\n  camera->SetFocalPoint(0.0, 0.0, 0.0);\n  camera->SetClippingRange(3.2, 10.2);\n  camera->SetViewUp(0.3, 1.0, 0.13);\n  ren->SetActiveCamera(camera);\n\n  renWin->Render();\n  renWin->SetWindowName(\"CallBack\");\n\n  vtkNew<vtkAxesActor> axes;\n  MakeAxesActor(axes);\n  vtkNew<vtkOrientationMarkerWidget> om;\n  om->SetOrientationMarker(axes);\n  // Position lower left in the viewport.\n  om->SetViewport(0, 0, 0.2, 0.2);\n  om->SetInteractor(iren);\n  om->EnabledOn();\n  om->InteractiveOn();\n\n#if defined(USE_CALLBACKCOMMAND_CLASS)\n  // When we implement the class, it automatically becomes the callback\n  // function.\n  vtkNew<CameraModifiedCallback> getOrientation;\n  // Set the camera to use.\n  getOrientation->cam = ren->GetActiveCamera();\n#else\n  // Create the vtkCallbackCommand.\n  vtkNew<vtkCallbackCommand> getOrientation;\n  // Set the callback to the function we created.\n  getOrientation->SetCallback(vtkCallbackFunc);\n  // Set the client data.\n  getOrientation->SetClientData(ren->GetActiveCamera());\n#endif\n  iren->AddObserver(vtkCommand::EndInteractionEvent, getOrientation);\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeAxesActor(vtkAxesActor* axes)\n{\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(\"X\");\n  axes->SetYAxisLabelText(\"Y\");\n  axes->SetZAxisLabelText(\"Z\");\n  axes->SetTotalLength(1.0, 1.0, 1.0);\n  axes->SetCylinderRadius(0.5 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.025 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.5 * axes->GetSphereRadius());\n}\n\n/**\nGet a comma separated list.\n*/\ntemplate <typename T> std::string CommaSeparatedList(std::vector<T> v)\n{\n  std::ostringstream os;\n  std::copy(v.begin(), v.end() - 1, std::ostream_iterator<T>(os, \", \"));\n  os << v.back();\n  return os.str();\n}\n\n/**\nPrint the camera orientation.\n*/\nvoid PrintCameraOrientation(vtkCamera* cam)\n{\n  auto width = 16;\n  double pos[3];\n  cam->GetPosition(pos);\n  double fp[3];\n  cam->GetFocalPoint(fp);\n  double vu[3];\n  cam->GetViewUp(vu);\n  double cr[2];\n  cam->GetClippingRange(cr);\n  std::cout << setw(width) << \"Position: \"\n            << CommaSeparatedList(std::vector<double>(pos, pos + 3))\n            << std::endl;\n  std::cout << setw(width) << \"Focal point: \"\n            << CommaSeparatedList(std::vector<double>(fp, fp + 3)) << std::endl;\n  std::cout << setw(width) << \"Clipping range: \"\n            << CommaSeparatedList(std::vector<double>(cr, cr + 2)) << std::endl;\n  std::cout << setw(width) << \"View up: \"\n            << CommaSeparatedList(std::vector<double>(vu, vu + 3)) << std::endl;\n  std::cout << setw(width) << \"Distance: \" << cam->GetDistance() << std::endl;\n};\n} // namespace\n
"},{"location":"Cxx/Interaction/CallBack/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CallBack)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CallBack: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CallBack MACOSX_BUNDLE CallBack.cxx )\n  target_link_libraries(CallBack PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CallBack\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/CallBack/#download-and-build-callback","title":"Download and Build CallBack","text":"

Click here to download CallBack and its CMakeLists.txt file. Once the tarball CallBack.tar has been downloaded and extracted,

cd CallBack/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CallBack\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/CallData/","title":"CallData","text":"

vtk-examples/Cxx/Interaction/CallData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/CallData/#description","title":"Description","text":"

This example demonstrates the use of 'calldata' in a vtkCallbackCommand. Here, we create a custom VTK filter to invoke an event to which we attach a value (the 'calldata'). We use a timer to modify and update the filter so that the event is triggered repeatedly, demonstrating the pass-via-calldata.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/CallData/#code","title":"Code","text":"

CallData.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkInformationVector.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass vtkMyTestFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkMyTestFilter, vtkPolyDataAlgorithm);\n  static vtkMyTestFilter* New();\n\n  int RefreshEvent;\n\n  unsigned int Counter;\n\nprotected:\n  vtkMyTestFilter()\n  {\n    this->SetNumberOfInputPorts(0);\n\n    this->RefreshEvent = vtkCommand::UserEvent + 1;\n\n    this->Counter = 0;\n  }\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*)\n  {\n    this->InvokeEvent(this->RefreshEvent, &this->Counter);\n    this->Counter++;\n    return 1;\n  }\n\nprivate:\n  vtkMyTestFilter(const vtkMyTestFilter&) = delete;\n  void operator=(const vtkMyTestFilter&) = delete;\n};\n\nvtkStandardNewMacro(vtkMyTestFilter);\n\nvoid CallbackFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\nclass vtkTimerCallback : public vtkCommand\n{\npublic:\n  static vtkTimerCallback* New()\n  {\n    vtkTimerCallback* cb = new vtkTimerCallback;\n\n    return cb;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long vtkNotUsed(eventId),\n                       void* vtkNotUsed(callData))\n  {\n    TestFilter->Modified();\n    TestFilter->Update();\n    auto iren = vtkRenderWindowInteractor::SafeDownCast(caller);\n    if (TestFilter->Counter > 10)\n    {\n      std::cout << \"Timer Destroyed: \" << iren->DestroyTimer(this->timerId)\n                << endl;\n    }\n  }\n\n  int timerId;\n\n  vtkMyTestFilter* TestFilter;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Add an object to make the scene interesting\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Goldenrod\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkMyTestFilter> testFilter;\n\n  vtkNew<vtkCallbackCommand> callback;\n  callback->SetCallback(CallbackFunction);\n  testFilter->AddObserver(testFilter->RefreshEvent, callback);\n  testFilter->Update();\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetWindowName(\"CallData\");\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  // Sign up to receive TimerEvent.\n  vtkNew<vtkTimerCallback> timerCallback;\n  timerCallback->TestFilter = testFilter;\n\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, timerCallback);\n  timerCallback->timerId = renderWindowInteractor->CreateRepeatingTimer(100);\n  std::cout << \"timerId: \" << timerCallback->timerId << std::endl;\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CallbackFunction(vtkObject* vtkNotUsed(caller),\n                      long unsigned int vtkNotUsed(eventId),\n                      void* vtkNotUsed(clientData), void* callData)\n{\n  unsigned int* callDataCasted = reinterpret_cast<unsigned int*>(callData);\n  std::cout << *callDataCasted << std::endl;\n}\n} // namespace\n
"},{"location":"Cxx/Interaction/CallData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CallData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CallData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CallData MACOSX_BUNDLE CallData.cxx )\n  target_link_libraries(CallData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CallData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/CallData/#download-and-build-calldata","title":"Download and Build CallData","text":"

Click here to download CallData and its CMakeLists.txt file. Once the tarball CallData.tar has been downloaded and extracted,

cd CallData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CallData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/ClientData/","title":"ClientData","text":"

vtk-examples/Cxx/Interaction/ClientData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/ClientData/#code","title":"Code","text":"

ClientData.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                              void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Goldenrod\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCallbackCommand> keypressCallback;\n\n  // Allow the observer to access the sphereSource\n  keypressCallback->SetClientData(sphereSource);\n  keypressCallback->SetCallback(KeypressCallbackFunction);\n  renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent,\n                                      keypressCallback);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetWindowName(\"ClientData\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject*, long unsigned int vtkNotUsed(eventId),\n                              void* clientData, void* vtkNotUsed(callData))\n{\n  // Prove that we can access the sphere source\n  auto sphereSource = static_cast<vtkSphereSource*>(clientData);\n  std::cout << \"Radius is \" << sphereSource->GetRadius() << std::endl;\n}\n} // namespace\n
"},{"location":"Cxx/Interaction/ClientData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClientData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClientData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClientData MACOSX_BUNDLE ClientData.cxx )\n  target_link_libraries(ClientData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClientData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/ClientData/#download-and-build-clientdata","title":"Download and Build ClientData","text":"

Click here to download ClientData and its CMakeLists.txt file. Once the tarball ClientData.tar has been downloaded and extracted,

cd ClientData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClientData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/DoubleClick/","title":"DoubleClick","text":"

vtk-examples/Cxx/Interaction/DoubleClick

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/DoubleClick/#code","title":"Code","text":"

DoubleClick.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// Define interaction style\nclass MouseInteractorStyleDoubleClick : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorStyleDoubleClick* New();\n  vtkTypeMacro(MouseInteractorStyleDoubleClick,\n               vtkInteractorStyleTrackballCamera);\n\n  MouseInteractorStyleDoubleClick() : NumberOfClicks(0), ResetPixelDistance(5)\n  {\n    this->PreviousPosition[0] = 0;\n    this->PreviousPosition[1] = 0;\n  }\n\n  virtual void OnLeftButtonDown() override\n  {\n    this->NumberOfClicks++;\n    int pickPosition[2];\n    this->GetInteractor()->GetEventPosition(pickPosition);\n\n    int xdist = pickPosition[0] - this->PreviousPosition[0];\n    int ydist = pickPosition[1] - this->PreviousPosition[1];\n\n    this->PreviousPosition[0] = pickPosition[0];\n    this->PreviousPosition[1] = pickPosition[1];\n\n    int moveDistance = (int)sqrt((double)(xdist * xdist + ydist * ydist));\n\n    // Reset numClicks - If mouse moved further than resetPixelDistance.\n    if (moveDistance > this->ResetPixelDistance)\n    {\n      this->NumberOfClicks = 1;\n    }\n\n    if (this->NumberOfClicks == 2)\n    {\n      std::cout << \"Double clicked.\" << std::endl;\n      this->NumberOfClicks = 0;\n    }\n\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n\nprivate:\n  unsigned int NumberOfClicks;\n  int PreviousPosition[2];\n  int ResetPixelDistance;\n};\nvtkStandardNewMacro(MouseInteractorStyleDoubleClick);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<MouseInteractorStyleDoubleClick> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindow->SetWindowName(\"DoubleClick\");\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/DoubleClick/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DoubleClick)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DoubleClick: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DoubleClick MACOSX_BUNDLE DoubleClick.cxx )\n  target_link_libraries(DoubleClick PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DoubleClick\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/DoubleClick/#download-and-build-doubleclick","title":"Download and Build DoubleClick","text":"

Click here to download DoubleClick and its CMakeLists.txt file. Once the tarball DoubleClick.tar has been downloaded and extracted,

cd DoubleClick/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DoubleClick\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/EllipticalButton/","title":"EllipticalButton","text":"

vtk-examples/Cxx/Interaction/EllipticalButton

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/EllipticalButton/#description","title":"Description","text":"

This example creates a 3D button using vtkEllipsoidalButton. Interaction is done by assigning the button to a vtkProp3DButtonRepresentation. Then a callback for a vtkButtonWidget controls the color of the button and the displayed geometry. Click on the button to see the color of both the button and geometry change.

Warning

There is a bug in vtkEllipticalButtonSource. If CircumferentialResolution is odd, improper geometry is created.

Warning

Values close to 1.0 for RadialRatio can cause shading artifacts at the corners of the button.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/EllipticalButton/#code","title":"Code","text":"

EllipticalButton.cxx

#include <vtkActor.h>\n#include <vtkButtonWidget.h>\n#include <vtkCommand.h>\n#include <vtkEllipticalButtonSource.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProp3DButtonRepresentation.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTexture.h>\n\n// Callback for the interaction.\nnamespace {\n\nclass vtkButtonCallback : public vtkCommand\n{\npublic:\n  static vtkButtonCallback* New()\n  {\n    return new vtkButtonCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    auto buttonWidget = reinterpret_cast<vtkButtonWidget*>(caller);\n    auto rep = reinterpret_cast<vtkProp3DButtonRepresentation*>(\n        buttonWidget->GetRepresentation());\n    int state = rep->GetState();\n    this->Actor->GetProperty()->SetColor(\n        reinterpret_cast<vtkActor*>(rep->GetButtonProp(state))\n            ->GetProperty()\n            ->GetColor());\n    std::cout << \"State: \" << state << \"\\n\";\n  }\n\n  vtkButtonCallback() : Actor(0)\n  {\n  }\n\n  vtkActor* Actor;\n};\n\nvtkSmartPointer<vtkActor> CreateButtonActor(const char* textureFile);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" imageFilename e.g. YinYang.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkSuperquadricSource> source;\n  source->SetPhiResolution(64);\n  source->SetThetaResolution(64);\n  source->SetThetaRoundness(1.5);\n  source->SetThickness(1.5);\n  source->SetSize(2);\n  source->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(color->GetColor3d(\"Burlywood\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(200, 200);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"EllipticalButton\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create the widget and its representation\n  vtkSmartPointer<vtkActor> buttonActor1 = CreateButtonActor(argv[1]);\n  buttonActor1->GetProperty()->SetColor(color->GetColor3d(\"Tomato\").GetData());\n  vtkSmartPointer<vtkActor> buttonActor2 = CreateButtonActor(argv[1]);\n  buttonActor2->GetProperty()->SetColor(color->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkProp3DButtonRepresentation> buttonRepresentation;\n  buttonRepresentation->SetNumberOfStates(2);\n  buttonRepresentation->SetButtonProp(0, buttonActor1);\n  buttonRepresentation->SetButtonProp(1, buttonActor2);\n  buttonRepresentation->FollowCameraOn();\n\n  vtkNew<vtkButtonCallback> callback;\n  callback->Actor = actor;\n  actor->GetProperty()->SetColor(\n      reinterpret_cast<vtkActor*>(buttonRepresentation->GetButtonProp(0))\n          ->GetProperty()\n          ->GetColor());\n\n  renderWindowInteractor->Initialize();\n\n  vtkNew<vtkButtonWidget> buttonWidget;\n  buttonWidget->SetInteractor(renderWindowInteractor);\n  buttonWidget->SetRepresentation(buttonRepresentation);\n  buttonWidget->AddObserver(vtkCommand::StateChangedEvent, callback);\n  buttonWidget->SetEnabled(1);\n\n  renderer->ResetCamera();\n  renderer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> CreateButtonActor(const char* textureFile)\n{\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imageReader;\n  imageReader.TakeReference(readerFactory->CreateImageReader2(textureFile));\n  imageReader->SetFileName(textureFile);\n  imageReader->Update();\n\n  // Aspect ratio of image\n  int dims[3];\n  imageReader->GetOutput()->GetDimensions(dims);\n  double aspect = static_cast<double>(dims[0]) / static_cast<double>(dims[1]);\n\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(imageReader->GetOutputPort());\n\n  vtkNew<vtkEllipticalButtonSource> ellipticalButtonSource;\n  ellipticalButtonSource->SetCircumferentialResolution(50);\n  ellipticalButtonSource->SetShoulderResolution(10);\n  ellipticalButtonSource->SetTextureResolution(10);\n  ellipticalButtonSource->SetRadialRatio(1.05);\n  ellipticalButtonSource->SetShoulderTextureCoordinate(0.0, 0.0);\n  ellipticalButtonSource->SetTextureDimensions(dims[0], dims[1]);\n  ellipticalButtonSource->SetTextureStyleToProportional();\n  ellipticalButtonSource->TwoSidedOn();\n  ellipticalButtonSource->SetWidth(aspect);\n  ellipticalButtonSource->SetHeight(1.0);\n  ellipticalButtonSource->SetDepth(.15);\n  ellipticalButtonSource->SetCenter(2, 2, 0);\n\n  ellipticalButtonSource->SetOutputPointsPrecision(\n      vtkAlgorithm::SINGLE_PRECISION);\n\n  vtkNew<vtkPolyDataMapper> buttonMapper;\n  buttonMapper->SetInputConnection(ellipticalButtonSource->GetOutputPort());\n\n  vtkNew<vtkActor> buttonActor;\n  buttonActor->SetMapper(buttonMapper);\n  buttonActor->SetTexture(texture);\n\n  return buttonActor;\n}\n\n} // namespace\n
"},{"location":"Cxx/Interaction/EllipticalButton/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EllipticalButton)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOImage\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EllipticalButton: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EllipticalButton MACOSX_BUNDLE EllipticalButton.cxx )\n  target_link_libraries(EllipticalButton PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EllipticalButton\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/EllipticalButton/#download-and-build-ellipticalbutton","title":"Download and Build EllipticalButton","text":"

Click here to download EllipticalButton and its CMakeLists.txt file. Once the tarball EllipticalButton.tar has been downloaded and extracted,

cd EllipticalButton/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./EllipticalButton\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/Game/","title":"Game","text":"

vtk-examples/Cxx/Interaction/Game

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/Game/#code","title":"Code","text":"

Game.cxx

// Demonstrate moving pieces and \"snapping\".\n\n#include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSelectEnclosedPoints.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\nnamespace {\n\n// Define interaction style.\nclass MouseInteractorStyle6 : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static MouseInteractorStyle6* New();\n  vtkTypeMacro(MouseInteractorStyle6, vtkInteractorStyleTrackballActor);\n\n  virtual void OnLeftButtonDown() override\n  {\n    std::cout << \"Pressed left mouse button.\" << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnLeftButtonDown();\n  }\n\n  virtual void OnMiddleButtonUp() override\n  {\n    // std::cout << \"Pressed middle mouse button.\" << std::endl;\n\n    int x = this->Interactor->GetEventPosition()[0];\n    int y = this->Interactor->GetEventPosition()[1];\n    this->FindPokedRenderer(x, y);\n    this->FindPickedActor(x, y);\n\n    if (this->CurrentRenderer == NULL || this->InteractionProp == NULL)\n    {\n      std::cout << \"Nothing selected.\" << std::endl;\n      return;\n    }\n\n    vtkNew<vtkPropCollection> actors;\n\n    this->InteractionProp->GetActors(actors);\n    actors->InitTraversal();\n    vtkActor* actor = dynamic_cast<vtkActor*>(actors->GetNextProp());\n\n    vtkPolyData* polydata =\n        dynamic_cast<vtkPolyData*>(actor->GetMapper()->GetInputAsDataSet());\n\n    vtkNew<vtkTransform> transform;\n    transform->SetMatrix(actor->GetMatrix());\n\n    vtkNew<vtkTransformPolyDataFilter> transformPolyData;\n    transformPolyData->SetInputData(polydata);\n    transformPolyData->SetTransform(transform);\n    transformPolyData->Update();\n\n    vtkNew<vtkSelectEnclosedPoints> selectEnclosedPoints;\n    selectEnclosedPoints->SetInputConnection(\n        transformPolyData->GetOutputPort());\n    selectEnclosedPoints->SetSurfaceData(this->Sphere);\n    selectEnclosedPoints->Update();\n\n    vtkDataArray* insideArray = dynamic_cast<vtkDataArray*>(\n        selectEnclosedPoints->GetOutput()->GetPointData()->GetArray(\n            \"SelectedPoints\"));\n\n    bool inside = false;\n    for (vtkIdType i = 0; i < insideArray->GetNumberOfTuples(); i++)\n    {\n      if (insideArray->GetComponent(i, 0) == 1)\n      {\n        inside = true;\n        break;\n      }\n    }\n\n    if (inside)\n    {\n      std::cout << \"A point of the cube is inside the sphere!\" << std::endl;\n      // Reset the cube to its original position.\n      // this->CubeActor->GetMatrix()->Identity();\n      // this->CubeActor->SetOrigin(0,0,0);\n      this->CubeActor->SetPosition(0, 0, 0);\n      this->CubeActor->SetOrientation(0, 0, 0);\n\n      this->Interactor->GetRenderWindow()\n          ->GetRenderers()\n          ->GetFirstRenderer()\n          ->Render();\n      this->Interactor->GetRenderWindow()->Render();\n    }\n\n    // Release interaction\n    this->StopState();\n  }\n\n  virtual void OnRightButtonDown() override\n  {\n    std::cout << \"Pressed right mouse button.\" << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnRightButtonDown();\n  }\n\n  vtkPolyData* Sphere = nullptr;\n  vtkActor* CubeActor = nullptr;\n};\nvtkStandardNewMacro(MouseInteractorStyle6);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(2);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(color->GetColor3d(\"Tomato\").GetData());\n\n  // Cube\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetCenter(5.0, 0.0, 0.0);\n  cubeSource->Update();\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(color->GetColor3d(\"DodgerBlue\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Game\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(cubeActor);\n  renderer->SetBackground(color->GetColor3d(\"Burlywood\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<MouseInteractorStyle6> style;\n  style->Sphere = sphereSource->GetOutput();\n  style->CubeActor = cubeActor;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/Game/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Game)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Game: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Game MACOSX_BUNDLE Game.cxx )\n  target_link_libraries(Game PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Game\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/Game/#download-and-build-game","title":"Download and Build Game","text":"

Click here to download Game and its CMakeLists.txt file. Once the tarball Game.tar has been downloaded and extracted,

cd Game/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Game\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/ImageClip/","title":"ImageClip","text":"

vtk-examples/Cxx/Interaction/ImageClip

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/ImageClip/#description","title":"Description","text":"

This example loads an image into the left half of the window. When you move the border widget (the green square in the bottom left corner) over the image, the region that is selected is displayed in the right half of the window.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/ImageClip/#code","title":"Code","text":"

ImageClip.cxx

#include <vtkBorderRepresentation.h>\n#include <vtkBorderWidget.h>\n#include <vtkCommand.h>\n#include <vtkImageActor.h>\n#include <vtkImageClip.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInformation.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkJPEGReader.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\n#include <string>\n\nnamespace {\n\nclass vtkBorderCallback2 : public vtkCommand\n{\npublic:\n  vtkBorderCallback2()\n  {\n  }\n\n  static vtkBorderCallback2* New()\n  {\n    return new vtkBorderCallback2;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n\n    vtkBorderWidget* borderWidget = reinterpret_cast<vtkBorderWidget*>(caller);\n\n    // Get the world coordinates of the two corners of the box.\n    auto lowerLeftCoordinate =\n        static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n            ->GetPositionCoordinate();\n    auto lowerLeft =\n        lowerLeftCoordinate->GetComputedWorldValue(this->LeftRenderer);\n    std::cout << \"Lower left coordinate: \" << lowerLeft[0] << \", \"\n              << lowerLeft[1] << \", \" << lowerLeft[2] << std::endl;\n\n    auto upperRightCoordinate =\n        static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n            ->GetPosition2Coordinate();\n    auto upperRight =\n        upperRightCoordinate->GetComputedWorldValue(this->LeftRenderer);\n    std::cout << \"Upper right coordinate: \" << upperRight[0] << \", \"\n              << upperRight[1] << \", \" << upperRight[2] << std::endl;\n\n    double* bounds = this->ImageActor->GetBounds();\n    double xmin = bounds[0];\n    double xmax = bounds[1];\n    double ymin = bounds[2];\n    double ymax = bounds[3];\n\n    if ((lowerLeft[0] > xmin) && (upperRight[0] < xmax) &&\n        (lowerLeft[1] > ymin) && (upperRight[1] < ymax))\n    {\n      this->ClipFilter->SetOutputWholeExtent(\n          vtkMath::Round(lowerLeft[0]), vtkMath::Round(upperRight[0]),\n          vtkMath::Round(lowerLeft[1]), vtkMath::Round(upperRight[1]), 0, 1);\n    }\n    else\n    {\n      std::cout << \"box is NOT inside image\" << std::endl;\n    }\n  }\n\n  void SetLeftRenderer(vtkSmartPointer<vtkRenderer> renderer)\n  {\n    this->LeftRenderer = renderer;\n  }\n  void SetImageActor(vtkSmartPointer<vtkImageActor> actor)\n  {\n    this->ImageActor = actor;\n  }\n  void SetClipFilter(vtkSmartPointer<vtkImageClip> clip)\n  {\n    this->ClipFilter = clip;\n  }\n\nprivate:\n  vtkSmartPointer<vtkRenderer> LeftRenderer;\n  vtkSmartPointer<vtkImageActor> ImageActor;\n  vtkSmartPointer<vtkImageClip> ClipFilter;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  // Parse input arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.jpg) e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  // Read the image.\n  vtkNew<vtkJPEGReader> jPEGReader;\n\n  if (!jPEGReader->CanReadFile(inputFilename.c_str()))\n  {\n    std::cout << \"Error: cannot read \" << inputFilename << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  jPEGReader->SetFileName(inputFilename.c_str());\n  jPEGReader->Update();\n\n  int extent[6];\n  jPEGReader->GetOutput()->GetExtent(extent);\n  // xmin, xmax, ymin, ymax\n  // std::cout << \"extent: \" << extent[0] << \" \" << extent[1] << \" \" <<\n  // extent[2] << \" \" <<  extent[3] << \" \" <<  extent[4] << \" \" <<\n  // extent[5] << std::endl;\n\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputConnection(jPEGReader->GetOutputPort());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  vtkNew<vtkBorderWidget> borderWidget;\n  borderWidget->SetInteractor(interactor);\n  static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n      ->GetBorderProperty()\n      ->SetColor(color->GetColor3d(\"Lime\").GetData());\n  borderWidget->SelectableOff();\n\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges in normalized coordinates.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(color->GetColor3d(\"DarkSlateGray\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(color->GetColor3d(\"DimGray\").GetData());\n\n  leftRenderer->AddActor(imageActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  vtkNew<vtkImageClip> imageClip;\n  imageClip->SetInputConnection(jPEGReader->GetOutputPort());\n  jPEGReader->UpdateInformation();\n  imageClip->SetOutputWholeExtent(jPEGReader->GetOutputInformation(0)->Get(\n      vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));\n  imageClip->ClipDataOn();\n\n  vtkNew<vtkImageActor> clipActor;\n  clipActor->GetMapper()->SetInputConnection(imageClip->GetOutputPort());\n\n  rightRenderer->AddActor(clipActor);\n\n  vtkNew<vtkBorderCallback2> borderCallback;\n  borderCallback->SetLeftRenderer(leftRenderer);\n  borderCallback->SetImageActor(imageActor);\n  borderCallback->SetClipFilter(imageClip);\n\n  borderWidget->AddObserver(vtkCommand::InteractionEvent, borderCallback);\n\n  renderWindow->SetWindowName(\"ImageClip\");\n  renderWindow->Render();\n  borderWidget->On();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/ImageClip/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageClip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonExecutionModel\n  IOImage\n  ImagingCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageClip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageClip MACOSX_BUNDLE ImageClip.cxx )\n  target_link_libraries(ImageClip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageClip\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/ImageClip/#download-and-build-imageclip","title":"Download and Build ImageClip","text":"

Click here to download ImageClip and its CMakeLists.txt file. Once the tarball ImageClip.tar has been downloaded and extracted,

cd ImageClip/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageClip\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/ImageRegion/","title":"ImageRegion","text":"

vtk-examples/Cxx/Interaction/ImageRegion

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/ImageRegion/#description","title":"Description","text":"

This example shows how to get the image coordinates of the corners of a BorderWidget.

It currently says the pick for the lower left corner of the border widget is valid even when it is off the image.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/ImageRegion/#code","title":"Code","text":"

ImageRegion.cxx

#include <vtkAssemblyNode.h>\n#include <vtkAssemblyPath.h>\n#include <vtkBorderRepresentation.h>\n#include <vtkBorderWidget.h>\n#include <vtkCommand.h>\n#include <vtkCoordinate.h>\n#include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPropPicker.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nclass vtkBorderCallback : public vtkCommand\n{\npublic:\n  vtkBorderCallback()\n  {\n  }\n\n  static vtkBorderCallback* New()\n  {\n    return new vtkBorderCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkBorderWidget* borderWidget = reinterpret_cast<vtkBorderWidget*>(caller);\n\n    // Get the display coordinates of the two corners of the box\n    vtkCoordinate* lowerLeftCoordinate =\n        static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n            ->GetPositionCoordinate();\n    double* lowerLeft;\n    lowerLeft = lowerLeftCoordinate->GetComputedWorldValue(this->Renderer);\n    std::cout << \"Lower left coordinate: \" << lowerLeft[0] << \", \"\n              << lowerLeft[1] << std::endl;\n    lowerLeft[2] = 0;\n\n    vtkCoordinate* upperRightCoordinate =\n        static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n            ->GetPosition2Coordinate();\n    double* upperRight;\n    upperRight = upperRightCoordinate->GetComputedWorldValue(this->Renderer);\n    std::cout << \"Upper right coordinate: \" << upperRight[0] << \", \"\n              << upperRight[1] << std::endl;\n    upperRight[2] = 0;\n\n    // Pick at the two corners of the box.\n    vtkSmartPointer<vtkPropPicker> picker =\n        vtkSmartPointer<vtkPropPicker>::New();\n\n    //    int valid1 = picker->Pick( lowerLeft[0],\n    picker->Pick(lowerLeft[0], lowerLeft[1], 0.0, this->Renderer);\n\n    vtkAssemblyPath* path = picker->GetPath();\n\n    vtkProp* pickedProp = NULL;\n\n    bool validPick = false;\n    if (path)\n    {\n      std::cout << \"There are \" << path->GetNumberOfItems()\n                << \" items in the path.\" << std::endl;\n      vtkCollectionSimpleIterator sit;\n      path->InitTraversal(sit);\n      vtkAssemblyNode* node;\n      for (int i = 0; i < path->GetNumberOfItems(); ++i)\n      {\n        node = path->GetNextNode(sit);\n        pickedProp = node->GetViewProp();\n        if (this->ImageActor == dynamic_cast<vtkImageActor*>(pickedProp))\n        {\n          std::cout << \"Correct actor picked.\" << std::endl;\n          validPick = true;\n          break;\n        }\n      }\n    }\n\n    if (!validPick)\n    {\n      std::cout << \"Off Image\" << std::endl;\n    }\n    else\n    {\n      double pos1[3];\n      picker->GetPickPosition(pos1);\n      std::cout << \"Lower Left Pick: \" << pos1[0] << \" \" << pos1[1]\n                << std::endl;\n    }\n    /*\n      if(valid1 != 0)\n        {\n        std::cout << \"Valid1: \" << valid1 << std::endl;\n        double pos1[3];\n        picker->GetPickPosition( pos1 );\n        std::cout << \"Lower Left Pick: \" << pos1[0] << \" \" << pos1[1] <<\n      std::endl;\n        }\n      else\n        {\n        std::cout << \"Left - nothing was picked\" << std::endl;\n        }\n      */\n\n    /*\n    int valid2 = picker->Pick( upperRight[0],\n                  upperRight[1], 0.0, this->Renderer );\n    if(valid2 != 0)\n      {\n      std::cout << \"Valid2: \" << valid2 << std::endl;\n      double pos2[3];\n      picker->GetPickPosition( pos2 );\n      std::cout << \"Upper right Pick: \" << pos2[0] << \" \" << pos2[1] <<\n    std::endl;\n      }\n    else\n      {\n      std::cout << \"Right - nothing was picked\" << std::endl;\n      }\n    */\n    std::cout << std::endl;\n  }\n\n  void SetRenderer(vtkSmartPointer<vtkRenderer> ren)\n  {\n    this->Renderer = ren;\n  }\n  void SetImageActor(vtkSmartPointer<vtkImageActor> im)\n  {\n    this->ImageActor = im;\n  }\n\nprivate:\n  vtkSmartPointer<vtkRenderer> Renderer;\n  vtkSmartPointer<vtkImageActor> ImageActor;\n};\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  // Parse input arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.jpg) e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string InputFilename = argv[1];\n\n  // Read the image\n  vtkNew<vtkJPEGReader> jPEGReader;\n  jPEGReader->SetFileName(InputFilename.c_str());\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(jPEGReader->GetOutputPort());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkBorderWidget> borderWidget;\n  borderWidget->SetInteractor(renderWindowInteractor);\n  static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n      ->GetBorderProperty()\n      ->SetColor(color->GetColor3d(\"Lime\").GetData());\n  borderWidget->SelectableOff();\n\n  vtkNew<vtkBorderCallback> borderCallback;\n  borderCallback->SetRenderer(renderer);\n  borderCallback->SetImageActor(actor);\n\n  borderWidget->AddObserver(vtkCommand::InteractionEvent, borderCallback);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(color->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->SetWindowName(\"ImageRegion\");\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  borderWidget->On();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/ImageRegion/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageRegion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageRegion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageRegion MACOSX_BUNDLE ImageRegion.cxx )\n  target_link_libraries(ImageRegion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageRegion\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/ImageRegion/#download-and-build-imageregion","title":"Download and Build ImageRegion","text":"

Click here to download ImageRegion and its CMakeLists.txt file. Once the tarball ImageRegion.tar has been downloaded and extracted,

cd ImageRegion/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageRegion\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/InteractorStyleTerrain/","title":"InteractorStyleTerrain","text":"

vtk-examples/Cxx/Interaction/InteractorStyleTerrain

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/InteractorStyleTerrain/#code","title":"Code","text":"

InteractorStyleTerrain.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTerrain.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"InteractorStyleTerrain\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTerrain> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/InteractorStyleTerrain/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InteractorStyleTerrain)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InteractorStyleTerrain: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InteractorStyleTerrain MACOSX_BUNDLE InteractorStyleTerrain.cxx )\n  target_link_libraries(InteractorStyleTerrain PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InteractorStyleTerrain\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/InteractorStyleTerrain/#download-and-build-interactorstyleterrain","title":"Download and Build InteractorStyleTerrain","text":"

Click here to download InteractorStyleTerrain and its CMakeLists.txt file. Once the tarball InteractorStyleTerrain.tar has been downloaded and extracted,

cd InteractorStyleTerrain/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./InteractorStyleTerrain\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/InteractorStyleUser/","title":"InteractorStyleUser","text":"

vtk-examples/Cxx/Interaction/InteractorStyleUser

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/InteractorStyleUser/#description","title":"Description","text":"

This style is designed to NOT provide any default functionality. You must specify how to handle every event that you want handled.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/InteractorStyleUser/#code","title":"Code","text":"

InteractorStyleUser.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkInteractorStyleUser.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid ClickCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                           void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"InteractorStyleUser\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<vtkCallbackCommand> clickCallback;\n  clickCallback->SetCallback(ClickCallbackFunction);\n\n  renderWindowInteractor->AddObserver(vtkCommand::LeftButtonPressEvent,\n                                      clickCallback);\n\n  vtkNew<vtkInteractorStyleUser> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid ClickCallbackFunction(vtkObject*, long unsigned int, void*, void*)\n{\n  std::cout << \"Click callback\" << std::endl;\n\n  // We can get the calling object like this:\n  // vtkRenderWindowInteractor *iren =\n  //  static_cast<vtkRenderWindowInteractor*>(caller);\n}\n\n} // namespace\n
"},{"location":"Cxx/Interaction/InteractorStyleUser/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InteractorStyleUser)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InteractorStyleUser: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InteractorStyleUser MACOSX_BUNDLE InteractorStyleUser.cxx )\n  target_link_libraries(InteractorStyleUser PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InteractorStyleUser\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/InteractorStyleUser/#download-and-build-interactorstyleuser","title":"Download and Build InteractorStyleUser","text":"

Click here to download InteractorStyleUser and its CMakeLists.txt file. Once the tarball InteractorStyleUser.tar has been downloaded and extracted,

cd InteractorStyleUser/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./InteractorStyleUser\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/KeypressEvents/","title":"KeypressEvents","text":"

vtk-examples/Cxx/Interaction/KeypressEvents

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/KeypressEvents/#description","title":"Description","text":"

This example shows how to catch keypress events. For example, do something if the user presses the 's' key.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/KeypressEvents/#code","title":"Code","text":"

KeypressEvents.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Define interaction style.\nclass KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static KeyPressInteractorStyle* New();\n  vtkTypeMacro(KeyPressInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnKeyPress() override\n  {\n    // Get the keypress.\n    vtkRenderWindowInteractor* rwi = this->Interactor;\n    std::string key = rwi->GetKeySym();\n\n    // Output the key that was pressed.\n    std::cout << \"Pressed \" << key << std::endl;\n\n    // Handle an arrow key.\n    if (key == \"Up\")\n    {\n      std::cout << \"The up arrow was pressed.\" << std::endl;\n    }\n\n    // Handle a \"normal\" key.\n    if (key == \"a\")\n    {\n      std::cout << \"The a key was pressed.\" << std::endl;\n    }\n\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnKeyPress();\n  }\n};\nvtkStandardNewMacro(KeyPressInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"KeypressEvents\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<KeyPressInteractorStyle> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->SetCurrentRenderer(renderer);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/KeypressEvents/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KeypressEvents)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KeypressEvents: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KeypressEvents MACOSX_BUNDLE KeypressEvents.cxx )\n  target_link_libraries(KeypressEvents PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KeypressEvents\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/KeypressEvents/#download-and-build-keypressevents","title":"Download and Build KeypressEvents","text":"

Click here to download KeypressEvents and its CMakeLists.txt file. Once the tarball KeypressEvents.tar has been downloaded and extracted,

cd KeypressEvents/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KeypressEvents\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/KeypressObserver/","title":"KeypressObserver","text":"

vtk-examples/Cxx/Interaction/KeypressObserver

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/KeypressObserver/#code","title":"Code","text":"

KeypressObserver.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nvoid KeypressCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                              void* clientData, void* callData);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"KeypressObserver\");\n\n  vtkNew<vtkCallbackCommand> keypressCallback;\n  keypressCallback->SetCallback(KeypressCallbackFunction);\n  renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent,\n                                      keypressCallback);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid KeypressCallbackFunction(vtkObject* caller,\n                              long unsigned int vtkNotUsed(eventId),\n                              void* vtkNotUsed(clientData),\n                              void* vtkNotUsed(callData))\n{\n  std::cout << \"Keypress callback\" << std::endl;\n\n  vtkRenderWindowInteractor* iren =\n      static_cast<vtkRenderWindowInteractor*>(caller);\n\n  std::cout << \"Pressed: \" << iren->GetKeySym() << std::endl;\n}\n\n} // namespace\n
"},{"location":"Cxx/Interaction/KeypressObserver/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KeypressObserver)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KeypressObserver: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KeypressObserver MACOSX_BUNDLE KeypressObserver.cxx )\n  target_link_libraries(KeypressObserver PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KeypressObserver\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/KeypressObserver/#download-and-build-keypressobserver","title":"Download and Build KeypressObserver","text":"

Click here to download KeypressObserver and its CMakeLists.txt file. Once the tarball KeypressObserver.tar has been downloaded and extracted,

cd KeypressObserver/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KeypressObserver\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/MouseEvents/","title":"MouseEvents","text":"

vtk-examples/Cxx/Interaction/MouseEvents

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/MouseEvents/#description","title":"Description","text":"

This example shows how to subclass an interactor style to implement custom behaviors.

See MouseEventsObserver for a different approach that uses an existing interactor style class and adds an event observer to it.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/MouseEvents/#code","title":"Code","text":"

MouseEvents.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Define interaction style.\nclass customMouseInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static customMouseInteractorStyle* New();\n  vtkTypeMacro(customMouseInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnLeftButtonDown() override\n  {\n    std::cout << \"Pressed left mouse button.\" << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n\n  virtual void OnMiddleButtonDown() override\n  {\n    std::cout << \"Pressed middle mouse button.\" << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();\n  }\n\n  virtual void OnRightButtonDown() override\n  {\n    std::cout << \"Pressed right mouse button.\" << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnRightButtonDown();\n  }\n};\n\nvtkStandardNewMacro(customMouseInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MouseEvents\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<customMouseInteractorStyle> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/MouseEvents/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MouseEvents)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MouseEvents: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MouseEvents MACOSX_BUNDLE MouseEvents.cxx )\n  target_link_libraries(MouseEvents PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MouseEvents\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/MouseEvents/#download-and-build-mouseevents","title":"Download and Build MouseEvents","text":"

Click here to download MouseEvents and its CMakeLists.txt file. Once the tarball MouseEvents.tar has been downloaded and extracted,

cd MouseEvents/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MouseEvents\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/MouseEventsObserver/","title":"MouseEventsObserver","text":"

vtk-examples/Cxx/Interaction/MouseEventsObserver

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/MouseEventsObserver/#description","title":"Description","text":"

This example shows how to add an event observer to an existing style class.

See MouseEvents for a different approach that subclasses an existin interactor style to implement custom behaviors.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/MouseEventsObserver/#code","title":"Code","text":"

MouseEventsObserver.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nvoid ClickCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                           void* clientData, void* callData);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MouseEventsObserver\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCallbackCommand> clickCallback;\n  clickCallback->SetCallback(ClickCallbackFunction);\n\n  renderWindowInteractor->AddObserver(vtkCommand::LeftButtonPressEvent,\n                                      clickCallback);\n  renderWindowInteractor->AddObserver(vtkCommand::RightButtonPressEvent,\n                                      clickCallback);\n  renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent, clickCallback);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid ClickCallbackFunction(vtkObject* vtkNotUsed(caller),\n                           long unsigned int eventId,\n                           void* vtkNotUsed(clientData),\n                           void* vtkNotUsed(callData))\n{\n  std::cout << \"Click callback\" << std::endl;\n  std::cout << \"Event: \" << vtkCommand::GetStringFromEventId(eventId)\n            << std::endl;\n\n  // Get the interactor like this:\n  // auto* iren = static_cast<vtkRenderWindowInteractor*>(caller);\n}\n\n} // namespace\n
"},{"location":"Cxx/Interaction/MouseEventsObserver/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MouseEventsObserver)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MouseEventsObserver: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MouseEventsObserver MACOSX_BUNDLE MouseEventsObserver.cxx )\n  target_link_libraries(MouseEventsObserver PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MouseEventsObserver\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/MouseEventsObserver/#download-and-build-mouseeventsobserver","title":"Download and Build MouseEventsObserver","text":"

Click here to download MouseEventsObserver and its CMakeLists.txt file. Once the tarball MouseEventsObserver.tar has been downloaded and extracted,

cd MouseEventsObserver/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MouseEventsObserver\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/MoveAGlyph/","title":"MoveAGlyph","text":"

vtk-examples/Cxx/Interaction/MoveAGlyph

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/MoveAGlyph/#description","title":"Description","text":"

This example allows the user to reposition a glyph. It does this by faking the interactor into thinking that a new actor (MoveActor) is the object to be interacted with. We use the array generated by glyph3D->GeneratePointIdsOn() to determine the point associated with the glyph that the user selected. A \"ghost\" actor of the selected glyph is generated (because all of the glyphs are part of the same actor, so they would all move together). This actor is moved, and its final position is used to update the point in the original data set.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/MoveAGlyph/#code","title":"Code","text":"

MoveAGlyph.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellPicker.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Define interaction style.\nclass InteractorStyleMoveGlyph : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static InteractorStyleMoveGlyph* New();\n  vtkTypeMacro(InteractorStyleMoveGlyph, vtkInteractorStyleTrackballActor);\n\n  InteractorStyleMoveGlyph()\n  {\n    this->MoveSphereSource = vtkSmartPointer<vtkSphereSource>::New();\n    this->MoveSphereSource->SetRadius(.1);\n    this->MoveSphereSource->Update();\n\n    this->MoveMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n    this->MoveMapper->SetInputConnection(\n        this->MoveSphereSource->GetOutputPort());\n\n    this->MoveActor = vtkSmartPointer<vtkActor>::New();\n    this->MoveActor->SetMapper(this->MoveMapper);\n    this->MoveActor->GetProperty()->SetColor(\n        this->color->GetColor3d(\"Pink\").GetData());\n    // this->MoveActor->VisibilityOff();\n\n    this->Move = false;\n  }\n\n  void OnMouseMove() override\n  {\n    if (!this->Move)\n    {\n      return;\n    }\n\n    vtkInteractorStyleTrackballActor::OnMouseMove();\n  }\n\n  void OnMiddleButtonUp() override\n  {\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnMiddleButtonUp();\n    this->Move = false;\n    this->MoveActor->VisibilityOff();\n\n    this->Data->GetPoints()->SetPoint(this->SelectedPoint,\n                                      this->MoveActor->GetPosition());\n    this->Data->Modified();\n    this->GetCurrentRenderer()->Render();\n    this->GetCurrentRenderer()->GetRenderWindow()->Render();\n  }\n  void OnMiddleButtonDown() override\n  {\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnMiddleButtonDown();\n    this->MoveActor->VisibilityOn();\n    if (static_cast<vtkCellPicker*>(this->InteractionPicker)->GetPointId() >= 0)\n    {\n      vtkIdType id =\n          dynamic_cast<vtkIdTypeArray*>(\n              this->GlyphData->GetPointData()->GetArray(\"InputPointIds\"))\n              ->GetValue(static_cast<vtkCellPicker*>(this->InteractionPicker)\n                             ->GetPointId());\n      std::cout << \"Id: \" << id << std::endl;\n      this->Move = true;\n      this->SelectedPoint = id;\n\n      double p[3];\n      this->Data->GetPoint(id, p);\n      std::cout << \"p: \" << p[0] << \" \" << p[1] << \" \" << p[2] << std::endl;\n      this->MoveActor->SetPosition(p);\n    }\n\n    this->GetCurrentRenderer()->AddActor(this->MoveActor);\n    this->InteractionProp = this->MoveActor;\n  }\n  vtkNew<vtkNamedColors> color;\n\n  vtkPolyData* Data;\n  vtkPolyData* GlyphData;\n\n  vtkSmartPointer<vtkPolyDataMapper> MoveMapper;\n  vtkSmartPointer<vtkActor> MoveActor;\n  vtkSmartPointer<vtkSphereSource> MoveSphereSource;\n\n  bool Move;\n  vtkIdType SelectedPoint;\n};\nvtkStandardNewMacro(InteractorStyleMoveGlyph);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(2, 0, 0);\n\n  vtkNew<vtkPolyData> input;\n  input->SetPoints(points);\n\n  vtkNew<vtkSphereSource> glyphSource;\n  glyphSource->SetRadius(0.1);\n  glyphSource->Update();\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->GeneratePointIdsOn();\n  glyph3D->SetSourceConnection(glyphSource->GetOutputPort());\n  glyph3D->SetInputData(input);\n  glyph3D->SetScaleModeToDataScalingOff();\n  glyph3D->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(color->GetColor3d(\"Tomato\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MoveAGlyph\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(color->GetColor3d(\"Burlywood\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<InteractorStyleMoveGlyph> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->Data = input;\n  style->GlyphData = glyph3D->GetOutput();\n\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/MoveAGlyph/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MoveAGlyph)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MoveAGlyph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MoveAGlyph MACOSX_BUNDLE MoveAGlyph.cxx )\n  target_link_libraries(MoveAGlyph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MoveAGlyph\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/MoveAGlyph/#download-and-build-moveaglyph","title":"Download and Build MoveAGlyph","text":"

Click here to download MoveAGlyph and its CMakeLists.txt file. Once the tarball MoveAGlyph.tar has been downloaded and extracted,

cd MoveAGlyph/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MoveAGlyph\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/MoveAVertexUnstructuredGrid/","title":"MoveAVertexUnstructuredGrid","text":"

vtk-examples/Cxx/Interaction/MoveAVertexUnstructuredGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/MoveAVertexUnstructuredGrid/#code","title":"Code","text":"

MoveAVertexUnstructuredGrid.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointPicker.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVertexGlyphFilter.h>\n\nnamespace {\n// Define interaction style.\nclass InteractorStyleMoveVertex : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static InteractorStyleMoveVertex* New();\n  vtkTypeMacro(InteractorStyleMoveVertex, vtkInteractorStyleTrackballActor);\n\n  InteractorStyleMoveVertex()\n  {\n\n    this->Move = false;\n    this->PointPicker = vtkSmartPointer<vtkPointPicker>::New();\n\n    // Setup ghost glyph.\n    vtkNew<vtkPoints> points;\n    points->InsertNextPoint(0, 0, 0);\n    this->MovePolyData = vtkSmartPointer<vtkPolyData>::New();\n    this->MovePolyData->SetPoints(points);\n    this->MoveGlyphFilter = vtkSmartPointer<vtkVertexGlyphFilter>::New();\n    this->MoveGlyphFilter->SetInputData(this->MovePolyData);\n    this->MoveGlyphFilter->Update();\n\n    this->MoveMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n    this->MoveMapper->SetInputConnection(\n        this->MoveGlyphFilter->GetOutputPort());\n\n    this->MoveActor = vtkSmartPointer<vtkActor>::New();\n    this->MoveActor->SetMapper(this->MoveMapper);\n    this->MoveActor->VisibilityOff();\n    this->MoveActor->GetProperty()->SetPointSize(10);\n    this->MoveActor->GetProperty()->SetColor(\n        this->color->GetColor3d(\"Pink\").GetData());\n  }\n\n  void OnMouseMove() override\n  {\n    if (!this->Move)\n    {\n      return;\n    }\n\n    vtkInteractorStyleTrackballActor::OnMouseMove();\n  }\n\n  void OnMiddleButtonUp() override\n  {\n    this->EndPan();\n\n    this->Move = false;\n    this->MoveActor->VisibilityOff();\n\n    this->Data->GetPoints()->SetPoint(this->SelectedPoint,\n                                      this->MoveActor->GetPosition());\n    this->Data->Modified();\n    this->GetCurrentRenderer()->Render();\n    this->GetCurrentRenderer()->GetRenderWindow()->Render();\n  }\n  void OnMiddleButtonDown() override\n  {\n    // Get the selected point.\n    int x = this->Interactor->GetEventPosition()[0];\n    int y = this->Interactor->GetEventPosition()[1];\n    this->FindPokedRenderer(x, y);\n    this->PointPicker->Pick(this->Interactor->GetEventPosition()[0],\n                            this->Interactor->GetEventPosition()[1],\n                            0, // always zero.\n                            this->Interactor->GetRenderWindow()\n                                ->GetRenderers()\n                                ->GetFirstRenderer());\n\n    if (this->PointPicker->GetPointId() >= 0)\n    {\n      this->StartPan();\n      this->MoveActor->VisibilityOn();\n      this->Move = true;\n      this->SelectedPoint = this->PointPicker->GetPointId();\n\n      std::cout << \"Dragging point \" << this->SelectedPoint << std::endl;\n\n      double p[3];\n      this->Data->GetPoint(this->SelectedPoint, p);\n      std::cout << \"p: \" << p[0] << \" \" << p[1] << \" \" << p[2] << std::endl;\n      this->MoveActor->SetPosition(p);\n\n      this->GetCurrentRenderer()->AddActor(this->MoveActor);\n      this->InteractionProp = this->MoveActor;\n    }\n  }\n\n  vtkNew<vtkNamedColors> color;\n\n  vtkUnstructuredGrid* Data;\n  vtkPolyData* GlyphData;\n\n  vtkSmartPointer<vtkPolyDataMapper> MoveMapper;\n  vtkSmartPointer<vtkActor> MoveActor;\n  vtkSmartPointer<vtkPolyData> MovePolyData;\n  vtkSmartPointer<vtkVertexGlyphFilter> MoveGlyphFilter;\n\n  vtkSmartPointer<vtkPointPicker> PointPicker;\n\n  bool Move;\n  vtkIdType SelectedPoint;\n};\nvtkStandardNewMacro(InteractorStyleMoveVertex);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(2, 0, 0);\n\n  vtkNew<vtkUnstructuredGrid> input;\n  input->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(input);\n  glyphFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(10);\n  actor->GetProperty()->SetColor(color->GetColor3d(\"Tomato\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MoveAVertexUnstructuredGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(color->GetColor3d(\"Gray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<InteractorStyleMoveVertex> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->Data = input;\n  style->GlyphData = glyphFilter->GetOutput();\n\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/MoveAVertexUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MoveAVertexUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MoveAVertexUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MoveAVertexUnstructuredGrid MACOSX_BUNDLE MoveAVertexUnstructuredGrid.cxx )\n  target_link_libraries(MoveAVertexUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MoveAVertexUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/MoveAVertexUnstructuredGrid/#download-and-build-moveavertexunstructuredgrid","title":"Download and Build MoveAVertexUnstructuredGrid","text":"

Click here to download MoveAVertexUnstructuredGrid and its CMakeLists.txt file. Once the tarball MoveAVertexUnstructuredGrid.tar has been downloaded and extracted,

cd MoveAVertexUnstructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MoveAVertexUnstructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/ObserverMemberFunction/","title":"ObserverMemberFunction","text":"

vtk-examples/Cxx/Interaction/ObserverMemberFunction

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/ObserverMemberFunction/#code","title":"Code","text":"

ObserverMemberFunction.cxx

#include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// A class not derived from vtkObjectBase.\nclass MyClass\n{\npublic:\n  void KeypressCallbackFunction(vtkObject*,\n                                long unsigned int vtkNotUsed(eventId),\n                                void* vtkNotUsed(callData))\n  {\n    std::cout << \"Caught event in MyClass\" << std::endl;\n  }\n};\n\n// A class that is derived from vtkObjectBase.\nclass MyInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MyInteractorStyle* New();\n  vtkTypeMacro(MyInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  void KeypressCallbackFunction(vtkObject*,\n                                long unsigned int vtkNotUsed(eventId),\n                                void* vtkNotUsed(callData))\n  {\n    std::cout << \"Caught event in MyInteractorStyle\" << std::endl;\n  }\n};\nvtkStandardNewMacro(MyInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ObserverMemberFunction\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  MyClass myClass;\n  renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent, &myClass,\n                                      &MyClass::KeypressCallbackFunction);\n\n  vtkSmartPointer<MyInteractorStyle> style =\n      vtkSmartPointer<MyInteractorStyle>::New();\n  renderWindowInteractor->AddObserver(\n      vtkCommand::KeyPressEvent, style,\n      &MyInteractorStyle::KeypressCallbackFunction);\n\n  // vtkSmartPointer<MyInteractorStyle> style2 =\n  //    vtkSmartPointer<MyInteractorStyle>::New();\n  // renderWindowInteractor->AddObserver(\n  //    vtkCommand::KeyPressEvent, style2,\n  //    &MyInteractorStyle::KeypressCallbackFunction);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/ObserverMemberFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ObserverMemberFunction)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ObserverMemberFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ObserverMemberFunction MACOSX_BUNDLE ObserverMemberFunction.cxx )\n  target_link_libraries(ObserverMemberFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ObserverMemberFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/ObserverMemberFunction/#download-and-build-observermemberfunction","title":"Download and Build ObserverMemberFunction","text":"

Click here to download ObserverMemberFunction and its CMakeLists.txt file. Once the tarball ObserverMemberFunction.tar has been downloaded and extracted,

cd ObserverMemberFunction/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ObserverMemberFunction\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/PickableOff/","title":"PickableOff","text":"

vtk-examples/Cxx/Interaction/PickableOff

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/PickableOff/#code","title":"Code","text":"

PickableOff.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> coneSource0;\n  coneSource0->Update();\n\n  vtkNew<vtkConeSource> coneSource1;\n  coneSource1->SetCenter(2, 0, 0);\n  coneSource1->Update();\n\n  // Create mappers and actors\n  vtkNew<vtkPolyDataMapper> coneMapper0;\n  coneMapper0->SetInputConnection(coneSource0->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> coneMapper1;\n  coneMapper1->SetInputConnection(coneSource1->GetOutputPort());\n\n  // Create actors\n  vtkNew<vtkActor> coneActor0;\n  coneActor0->SetMapper(coneMapper0);\n  coneActor0->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkActor> coneActor1;\n  coneActor1->SetMapper(coneMapper1);\n  coneActor1->PickableOff();\n  coneActor1->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PickableOff\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(coneActor0);\n  renderer->AddActor(coneActor1);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballActor> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/PickableOff/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PickableOff)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PickableOff: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PickableOff MACOSX_BUNDLE PickableOff.cxx )\n  target_link_libraries(PickableOff PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PickableOff\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/PickableOff/#download-and-build-pickableoff","title":"Download and Build PickableOff","text":"

Click here to download PickableOff and its CMakeLists.txt file. Once the tarball PickableOff.tar has been downloaded and extracted,

cd PickableOff/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PickableOff\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/Picking/","title":"Picking","text":"

vtk-examples/Cxx/Interaction/Picking

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/Picking/#code","title":"Code","text":"

Picking.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPropPicker.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Handle mouse events.\nclass MouseInteractorStyle2 : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorStyle2* New();\n  vtkTypeMacro(MouseInteractorStyle2, vtkInteractorStyleTrackballCamera);\n  vtkNew<vtkNamedColors> colors;\n\n  virtual void OnLeftButtonDown() override\n  {\n    int* clickPos = this->GetInteractor()->GetEventPosition();\n\n    // Pick from this location.\n    vtkNew<vtkPropPicker> picker;\n    picker->Pick(clickPos[0], clickPos[1], 0, this->GetDefaultRenderer());\n\n    double* pos = picker->GetPickPosition();\n    std::cout << \"Pick position (world coordinates) is: \" << pos[0] << \" \"\n              << pos[1] << \" \" << pos[2] << std::endl;\n\n    auto pickedActor = picker->GetActor();\n    if (pickedActor == nullptr)\n    {\n      std::cout << \"No actor picked.\" << std::endl;\n    }\n    else\n    {\n      std::cout << \"Picked actor: \" << picker->GetActor() << std::endl;\n      // Create a sphere.\n      vtkNew<vtkSphereSource> sphereSource;\n      sphereSource->SetCenter(pos[0], pos[1], pos[2]);\n      sphereSource->SetRadius(0.1);\n\n      // Create a mapper and actor.\n      vtkNew<vtkPolyDataMapper> mapper;\n      mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n      vtkNew<vtkActor> actor;\n      actor->SetMapper(mapper);\n      actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n      this->GetDefaultRenderer()->AddActor(actor);\n      // Forward events.\n      vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n    }\n  }\n\nprivate:\n};\n\nvtkStandardNewMacro(MouseInteractorStyle2);\n\n} // namespace\n\n// Execute application.\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->Update();\n\n  // Create a polydata object.\n  vtkPolyData* polydata = planeSource->GetOutput();\n\n  // Create a mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  std::cout << \"Actor address: \" << actor << std::endl;\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Picking\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Set the custom stype to use for interaction.\n  vtkNew<MouseInteractorStyle2> style;\n  style->SetDefaultRenderer(renderer);\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/Picking/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Picking)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Picking: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Picking MACOSX_BUNDLE Picking.cxx )\n  target_link_libraries(Picking PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Picking\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/Picking/#download-and-build-picking","title":"Download and Build Picking","text":"

Click here to download Picking and its CMakeLists.txt file. Once the tarball Picking.tar has been downloaded and extracted,

cd Picking/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Picking\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/PointPicker/","title":"PointPicker","text":"

vtk-examples/Cxx/Interaction/PointPicker

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/PointPicker/#description","title":"Description","text":"

This example demonstrates how to get the closest point in the data set to the mouse click.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/PointPicker/#code","title":"Code","text":"

PointPicker.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointPicker.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Define interaction style.\nclass MouseInteractorStylePP : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorStylePP* New();\n  vtkTypeMacro(MouseInteractorStylePP, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnLeftButtonDown() override\n  {\n    std::cout << \"Picking pixel: \" << this->Interactor->GetEventPosition()[0]\n              << \" \" << this->Interactor->GetEventPosition()[1] << std::endl;\n    this->Interactor->GetPicker()->Pick(this->Interactor->GetEventPosition()[0],\n                                        this->Interactor->GetEventPosition()[1],\n                                        0, // always zero.\n                                        this->Interactor->GetRenderWindow()\n                                            ->GetRenderers()\n                                            ->GetFirstRenderer());\n    double picked[3];\n    this->Interactor->GetPicker()->GetPickPosition(picked);\n    std::cout << \"Picked value: \" << picked[0] << \" \" << picked[1] << \" \"\n              << picked[2] << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n};\n\nvtkStandardNewMacro(MouseInteractorStylePP);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPointPicker> pointPicker;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointPicker\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetPicker(pointPicker);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<MouseInteractorStylePP> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/PointPicker/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointPicker)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointPicker: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointPicker MACOSX_BUNDLE PointPicker.cxx )\n  target_link_libraries(PointPicker PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointPicker\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/PointPicker/#download-and-build-pointpicker","title":"Download and Build PointPicker","text":"

Click here to download PointPicker and its CMakeLists.txt file. Once the tarball PointPicker.tar has been downloaded and extracted,

cd PointPicker/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointPicker\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/RubberBand2D/","title":"RubberBand2D","text":"

vtk-examples/Cxx/Interaction/RubberBand2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/RubberBand2D/#description","title":"Description","text":"

This example shows how to get the coordinates of the corners of the rubber band (the box that is drawn).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/RubberBand2D/#code","title":"Code","text":"

RubberBand2D.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleRubberBand2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nclass MyRubberBand : public vtkInteractorStyleRubberBand2D\n{\npublic:\n  static MyRubberBand* New();\n  vtkTypeMacro(MyRubberBand, vtkInteractorStyleRubberBand2D);\n\n  virtual void OnLeftButtonUp() override\n  {\n    // Forward events.\n    vtkInteractorStyleRubberBand2D::OnLeftButtonUp();\n\n    std::cout << \"Start position: \" << this->StartPosition[0] << \" \"\n              << this->StartPosition[1] << std::endl;\n    std::cout << \"End position: \" << this->EndPosition[0] << \" \"\n              << this->EndPosition[1] << std::endl;\n  }\n};\n\nvtkStandardNewMacro(MyRubberBand);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RubberBand2D\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<MyRubberBand> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/RubberBand2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RubberBand2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RubberBand2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RubberBand2D MACOSX_BUNDLE RubberBand2D.cxx )\n  target_link_libraries(RubberBand2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RubberBand2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/RubberBand2D/#download-and-build-rubberband2d","title":"Download and Build RubberBand2D","text":"

Click here to download RubberBand2D and its CMakeLists.txt file. Once the tarball RubberBand2D.tar has been downloaded and extracted,

cd RubberBand2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RubberBand2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/RubberBand2DObserver/","title":"RubberBand2DObserver","text":"

vtk-examples/Cxx/Interaction/RubberBand2DObserver

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/RubberBand2DObserver/#code","title":"Code","text":"

RubberBand2DObserver.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkInteractorStyleRubberBand2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nvoid SelectionChangedCallbackFunction(vtkObject* caller,\n                                      long unsigned int eventId,\n                                      void* clientData, void* callData);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RubberBand2DObserver\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n\n  vtkNew<vtkCallbackCommand> selectionChangedCallback;\n  selectionChangedCallback->SetCallback(SelectionChangedCallbackFunction);\n\n  vtkNew<vtkInteractorStyleRubberBand2D> style;\n  style->AddObserver(vtkCommand::SelectionChangedEvent,\n                     selectionChangedCallback);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid SelectionChangedCallbackFunction(vtkObject* vtkNotUsed(caller),\n                                      long unsigned int vtkNotUsed(eventId),\n                                      void* vtkNotUsed(clientData),\n                                      void* callData)\n{\n  std::cout << \"SelectionChanged callback\" << std::endl;\n\n  unsigned int* rect = reinterpret_cast<unsigned int*>(callData);\n  unsigned int pos1X = rect[0];\n  unsigned int pos1Y = rect[1];\n  unsigned int pos2X = rect[2];\n  unsigned int pos2Y = rect[3];\n\n  std::cout << \"Start x: \" << pos1X << \" Start y: \" << pos1Y\n            << \" End x: \" << pos2X << \" End y: \" << pos2Y << std::endl;\n}\n\n} // namespace\n
"},{"location":"Cxx/Interaction/RubberBand2DObserver/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RubberBand2DObserver)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RubberBand2DObserver: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RubberBand2DObserver MACOSX_BUNDLE RubberBand2DObserver.cxx )\n  target_link_libraries(RubberBand2DObserver PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RubberBand2DObserver\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/RubberBand2DObserver/#download-and-build-rubberband2dobserver","title":"Download and Build RubberBand2DObserver","text":"

Click here to download RubberBand2DObserver and its CMakeLists.txt file. Once the tarball RubberBand2DObserver.tar has been downloaded and extracted,

cd RubberBand2DObserver/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RubberBand2DObserver\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/RubberBand3D/","title":"RubberBand3D","text":"

vtk-examples/Cxx/Interaction/RubberBand3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/RubberBand3D/#code","title":"Code","text":"

RubberBand3D.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleRubberBand3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nclass MyRubberBand3D : public vtkInteractorStyleRubberBand3D\n{\npublic:\n  static MyRubberBand3D* New();\n  vtkTypeMacro(MyRubberBand3D, vtkInteractorStyleRubberBand3D);\n\n  virtual void OnLeftButtonUp() override\n  {\n    // Forward events.\n    vtkInteractorStyleRubberBand3D::OnLeftButtonUp();\n\n    std::cout << \"Start position: \" << this->StartPosition[0] << \" \"\n              << this->StartPosition[1] << std::endl;\n    std::cout << \"End position: \" << this->EndPosition[0] << \" \"\n              << this->EndPosition[1] << std::endl;\n  }\n};\nvtkStandardNewMacro(MyRubberBand3D);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RubberBand3D\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<MyRubberBand3D> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/RubberBand3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RubberBand3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RubberBand3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RubberBand3D MACOSX_BUNDLE RubberBand3D.cxx )\n  target_link_libraries(RubberBand3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RubberBand3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/RubberBand3D/#download-and-build-rubberband3d","title":"Download and Build RubberBand3D","text":"

Click here to download RubberBand3D and its CMakeLists.txt file. Once the tarball RubberBand3D.tar has been downloaded and extracted,

cd RubberBand3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RubberBand3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/RubberBandPick/","title":"RubberBandPick","text":"

vtk-examples/Cxx/Interaction/RubberBandPick

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/RubberBandPick/#description","title":"Description","text":"

Press 'r', then make a selection with the left mouse button.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/RubberBandPick/#code","title":"Code","text":"

RubberBandPick.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RubberBandPick\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleRubberBandPick> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/RubberBandPick/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RubberBandPick)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RubberBandPick: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RubberBandPick MACOSX_BUNDLE RubberBandPick.cxx )\n  target_link_libraries(RubberBandPick PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RubberBandPick\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/RubberBandPick/#download-and-build-rubberbandpick","title":"Download and Build RubberBandPick","text":"

Click here to download RubberBandPick and its CMakeLists.txt file. Once the tarball RubberBandPick.tar has been downloaded and extracted,

cd RubberBandPick/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RubberBandPick\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/RubberBandZoom/","title":"RubberBandZoom","text":"

vtk-examples/Cxx/Interaction/RubberBandZoom

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/RubberBandZoom/#description","title":"Description","text":"

This example demonstrates how to select a region of the window to zoom in.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/RubberBandZoom/#code","title":"Code","text":"

RubberBandZoom.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleRubberBandZoom.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RubberBandZoom\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderWindow->SetWindowName(\"RubberBandZoom\");\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleRubberBandZoom> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderer->GetActiveCamera()->Zoom(0.5);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/RubberBandZoom/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RubberBandZoom)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RubberBandZoom: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RubberBandZoom MACOSX_BUNDLE RubberBandZoom.cxx )\n  target_link_libraries(RubberBandZoom PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RubberBandZoom\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/RubberBandZoom/#download-and-build-rubberbandzoom","title":"Download and Build RubberBandZoom","text":"

Click here to download RubberBandZoom and its CMakeLists.txt file. Once the tarball RubberBandZoom.tar has been downloaded and extracted,

cd RubberBandZoom/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RubberBandZoom\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/SelectAVertex/","title":"SelectAVertex","text":"

vtk-examples/Cxx/Interaction/SelectAVertex

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/SelectAVertex/#description","title":"Description","text":"

Click and drag a vertex by \"ghosting\" a glyph over the selected vertex and using it for the interaction.

Use middle mouse button to interact with the vertex.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/SelectAVertex/#code","title":"Code","text":"

SelectAVertex.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointPicker.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVertexGlyphFilter.h>\n\nnamespace {\n\n// Define interaction style.\nclass InteractorStyle2 : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static InteractorStyle2* New();\n  vtkTypeMacro(InteractorStyle2, vtkInteractorStyleTrackballActor);\n  vtkNew<vtkNamedColors> color;\n\n  InteractorStyle2()\n  {\n    this->Move = false;\n    this->PointPicker = vtkSmartPointer<vtkPointPicker>::New();\n\n    // Setup ghost glyph.\n    vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n    points->InsertNextPoint(0, 0, 0);\n    this->MovePolyData = vtkSmartPointer<vtkPolyData>::New();\n    this->MovePolyData->SetPoints(points);\n    this->MoveGlyphFilter = vtkSmartPointer<vtkVertexGlyphFilter>::New();\n    this->MoveGlyphFilter->SetInputData(this->MovePolyData);\n    this->MoveGlyphFilter->Update();\n\n    this->MoveMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n    this->MoveMapper->SetInputConnection(\n        this->MoveGlyphFilter->GetOutputPort());\n\n    this->MoveActor = vtkSmartPointer<vtkActor>::New();\n    this->MoveActor->SetMapper(this->MoveMapper);\n    this->MoveActor->VisibilityOff();\n    this->MoveActor->GetProperty()->SetPointSize(10);\n    this->MoveActor->GetProperty()->SetColor(\n        this->color->GetColor3d(\"Pink\").GetData());\n  }\n\n  void OnMouseMove() override\n  {\n    if (!this->Move)\n    {\n      return;\n    }\n\n    vtkInteractorStyleTrackballActor::OnMouseMove();\n  }\n\n  void OnMiddleButtonUp() override\n  {\n    this->EndPan();\n\n    this->Move = false;\n    this->MoveActor->VisibilityOff();\n\n    this->Data->GetPoints()->SetPoint(this->SelectedPoint,\n                                      this->MoveActor->GetPosition());\n    this->Data->Modified();\n    this->GetCurrentRenderer()->Render();\n    this->GetCurrentRenderer()->GetRenderWindow()->Render();\n  }\n  void OnMiddleButtonDown() override\n  {\n    // Get the selected point.\n    int x = this->Interactor->GetEventPosition()[0];\n    int y = this->Interactor->GetEventPosition()[1];\n    this->FindPokedRenderer(x, y);\n\n    this->PointPicker->Pick(this->Interactor->GetEventPosition()[0],\n                            this->Interactor->GetEventPosition()[1],\n                            0, // always zero.\n                            this->Interactor->GetRenderWindow()\n                                ->GetRenderers()\n                                ->GetFirstRenderer());\n\n    if (this->PointPicker->GetPointId() >= 0)\n    {\n      this->StartPan();\n      this->MoveActor->VisibilityOn();\n      this->Move = true;\n      this->SelectedPoint = this->PointPicker->GetPointId();\n\n      std::cout << \"Dragging point \" << this->SelectedPoint << std::endl;\n\n      double p[3];\n      this->Data->GetPoint(this->SelectedPoint, p);\n      std::cout << \"p: \" << p[0] << \" \" << p[1] << \" \" << p[2] << std::endl;\n      this->MoveActor->SetPosition(p);\n\n      this->GetCurrentRenderer()->AddActor(this->MoveActor);\n      this->InteractionProp = this->MoveActor;\n    }\n  }\n\n  vtkPolyData* Data;\n  vtkPolyData* GlyphData;\n\n  vtkSmartPointer<vtkPolyDataMapper> MoveMapper;\n  vtkSmartPointer<vtkActor> MoveActor;\n  vtkSmartPointer<vtkPolyData> MovePolyData;\n  vtkSmartPointer<vtkVertexGlyphFilter> MoveGlyphFilter;\n\n  vtkSmartPointer<vtkPointPicker> PointPicker;\n\n  bool Move;\n  vtkIdType SelectedPoint;\n};\nvtkStandardNewMacro(InteractorStyle2);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(2, 0, 0);\n\n  vtkNew<vtkPolyData> input;\n  input->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(input);\n  glyphFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(10);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SelectAVertex\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Gray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<InteractorStyle2> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->Data = input;\n\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/SelectAVertex/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectAVertex)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectAVertex: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectAVertex MACOSX_BUNDLE SelectAVertex.cxx )\n  target_link_libraries(SelectAVertex PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectAVertex\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/SelectAVertex/#download-and-build-selectavertex","title":"Download and Build SelectAVertex","text":"

Click here to download SelectAVertex and its CMakeLists.txt file. Once the tarball SelectAVertex.tar has been downloaded and extracted,

cd SelectAVertex/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SelectAVertex\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/SelectAnActor/","title":"SelectAnActor","text":"

vtk-examples/Cxx/Interaction/SelectAnActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/SelectAnActor/#code","title":"Code","text":"

SelectAnActor.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Handle mouse events.\nclass MouseInteractorStyle5 : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static MouseInteractorStyle5* New();\n  vtkTypeMacro(MouseInteractorStyle5, vtkInteractorStyleTrackballActor);\n\n  virtual void OnLeftButtonDown() override\n  {\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnLeftButtonDown();\n\n    if (this->InteractionProp == this->Cube)\n    {\n      std::cout << \"Picked cube.\" << std::endl;\n    }\n    else if (this->InteractionProp == this->Sphere)\n    {\n      std::cout << \"Picked sphere.\" << std::endl;\n    }\n  }\n\n  vtkActor* Cube;\n  vtkActor* Sphere;\n};\n\nvtkStandardNewMacro(MouseInteractorStyle5);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(2, 0, 0);\n  sphereSource->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SelectAnActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Set the custom stype to use for interaction.\n  vtkNew<MouseInteractorStyle5> style;\n  style->SetDefaultRenderer(renderer);\n  style->Cube = cubeActor;\n  style->Sphere = sphereActor;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderer->AddActor(cubeActor);\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/SelectAnActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectAnActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectAnActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectAnActor MACOSX_BUNDLE SelectAnActor.cxx )\n  target_link_libraries(SelectAnActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectAnActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/SelectAnActor/#download-and-build-selectanactor","title":"Download and Build SelectAnActor","text":"

Click here to download SelectAnActor and its CMakeLists.txt file. Once the tarball SelectAnActor.tar has been downloaded and extracted,

cd SelectAnActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SelectAnActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/ShiftAndControl/","title":"ShiftAndControl","text":"

vtk-examples/Cxx/Interaction/ShiftAndControl

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/ShiftAndControl/#description","title":"Description","text":"

This example demonstrates how to \"alt+click\", \"control+click\" and \"shift+click\" an actor.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/ShiftAndControl/#code","title":"Code","text":"

ShiftAndControl.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nclass MouseInteractorStyleShiftAndControl\n  : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static MouseInteractorStyleShiftAndControl* New();\n\n  virtual void OnLeftButtonDown()\n  {\n    if (this->Interactor->GetShiftKey())\n    {\n      std::cout << \"Shift held. \";\n    }\n\n    if (this->Interactor->GetControlKey())\n    {\n      std::cout << \"Control held. \";\n    }\n\n    if (this->Interactor->GetAltKey())\n    {\n      std::cout << \"Alt held. \";\n    }\n\n    std::cout << \"Pressed left mouse button.\" << std::endl;\n\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnLeftButtonDown();\n  }\n};\n\nvtkStandardNewMacro(MouseInteractorStyleShiftAndControl);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ShiftAndControl\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<MouseInteractorStyleShiftAndControl> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/ShiftAndControl/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShiftAndControl)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShiftAndControl: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShiftAndControl MACOSX_BUNDLE ShiftAndControl.cxx )\n  target_link_libraries(ShiftAndControl PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShiftAndControl\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/ShiftAndControl/#download-and-build-shiftandcontrol","title":"Download and Build ShiftAndControl","text":"

Click here to download ShiftAndControl and its CMakeLists.txt file. Once the tarball ShiftAndControl.tar has been downloaded and extracted,

cd ShiftAndControl/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ShiftAndControl\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/StyleSwitch/","title":"StyleSwitch","text":"

vtk-examples/Cxx/Interaction/StyleSwitch

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/StyleSwitch/#description","title":"Description","text":"

The class vtkInteractorStyleSwitch allows handles interactively switching between four interactor styles -- joystick actor, joystick camera, trackball actor, and trackball camera. Type 'j' or 't' to select joystick or trackball, and type 'c' or 'a' to select camera or actor. The default interactor style is joystick camera.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/StyleSwitch/#code","title":"Code","text":"

StyleSwitch.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"StyleSwitch\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleSwitch> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/StyleSwitch/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StyleSwitch)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StyleSwitch: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StyleSwitch MACOSX_BUNDLE StyleSwitch.cxx )\n  target_link_libraries(StyleSwitch PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StyleSwitch\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/StyleSwitch/#download-and-build-styleswitch","title":"Download and Build StyleSwitch","text":"

Click here to download StyleSwitch and its CMakeLists.txt file. Once the tarball StyleSwitch.tar has been downloaded and extracted,

cd StyleSwitch/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StyleSwitch\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/TrackballActor/","title":"TrackballActor","text":"

vtk-examples/Cxx/Interaction/TrackballActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/TrackballActor/#description","title":"Description","text":"

This example shows how to visualize data in \"trackball\" mode. That is, click and drag actors is the way to interact.

Contrast this with TrackballCamera.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/TrackballActor/#code","title":"Code","text":"

TrackballActor.cxx

#include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(1.0, 0.0, 0.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TrackballActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(coneActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballActor> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/TrackballActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TrackballActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TrackballActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TrackballActor MACOSX_BUNDLE TrackballActor.cxx )\n  target_link_libraries(TrackballActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TrackballActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/TrackballActor/#download-and-build-trackballactor","title":"Download and Build TrackballActor","text":"

Click here to download TrackballActor and its CMakeLists.txt file. Once the tarball TrackballActor.tar has been downloaded and extracted,

cd TrackballActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TrackballActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/TrackballCamera/","title":"TrackballCamera","text":"

vtk-examples/Cxx/Interaction/TrackballCamera

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/TrackballCamera/#description","title":"Description","text":"

This example demonstrates the trackball camera mode. When the mouse is clicked and dragged from anywhere in the window, the camera is modified.

Contrast this with TrackballActor.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/TrackballCamera/#code","title":"Code","text":"

TrackballCamera.cxx

#include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(1.0, 0.0, 0.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a cone.\n  vtkNew<vtkConeSource> coneSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TrackballCamera\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(coneActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/TrackballCamera/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TrackballCamera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TrackballCamera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TrackballCamera MACOSX_BUNDLE TrackballCamera.cxx )\n  target_link_libraries(TrackballCamera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TrackballCamera\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/TrackballCamera/#download-and-build-trackballcamera","title":"Download and Build TrackballCamera","text":"

Click here to download TrackballCamera and its CMakeLists.txt file. Once the tarball TrackballCamera.tar has been downloaded and extracted,

cd TrackballCamera/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TrackballCamera\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/UserEvent/","title":"UserEvent","text":"

vtk-examples/Cxx/Interaction/UserEvent

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/UserEvent/#code","title":"Code","text":"

UserEvent.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include \"vtkTestFilter.h\"\n\nnamespace {\n\nvoid CallbackFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"UserEvent\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkTestFilter> filter;\n\n  vtkNew<vtkCallbackCommand> callback;\n  callback->SetCallback(CallbackFunction);\n  filter->AddObserver(filter->RefreshEvent, callback);\n\n  filter->Update();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CallbackFunction(vtkObject* /* caller */, long unsigned int /* eventId */,\n                      void* /* clientData */, void* /* callData */)\n{\n  std::cout << \"CallbackFunction called.\" << std::endl;\n}\n\n} // namespace\n

vtkTestFilter.h

#ifndef __vtkTestFilter_h\n#define __vtkTestFilter_h\n\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkTestFilter, vtkPolyDataAlgorithm);\n  static vtkTestFilter* New();\n\n  int RefreshEvent;\n\nprotected:\n  vtkTestFilter();\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\nprivate:\n  vtkTestFilter(const vtkTestFilter&);  // Not implemented.\n  void operator=(const vtkTestFilter&); // Not implemented.\n};\n\nvtkStandardNewMacro(vtkTestFilter);\n\nvtkTestFilter::vtkTestFilter()\n{\n  this->SetNumberOfInputPorts(0);\n\n  this->RefreshEvent = vtkCommand::UserEvent + 1;\n}\n\nint vtkTestFilter::RequestData(vtkInformation* vtkNotUsed(request),\n                               vtkInformationVector**, vtkInformationVector*)\n{\n  // Get the info object\n  //  auto outInfo = outputVector->GetInformationObject(0);\n\n  //  auto output = vtkPolyData::SafeDownCast(\n  //      outInfo->Get(vtkDataObject::DATA_OBJECT()));\n  this->InvokeEvent(this->RefreshEvent, nullptr);\n\n  return 1;\n}\n\n#endif // __vtkTestFilter_h\n
"},{"location":"Cxx/Interaction/UserEvent/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(UserEvent)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"UserEvent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(UserEvent MACOSX_BUNDLE UserEvent.cxx )\n  target_link_libraries(UserEvent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS UserEvent\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/UserEvent/#download-and-build-userevent","title":"Download and Build UserEvent","text":"

Click here to download UserEvent and its CMakeLists.txt file. Once the tarball UserEvent.tar has been downloaded and extracted,

cd UserEvent/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./UserEvent\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Interaction/WorldPointPicker/","title":"WorldPointPicker","text":"

vtk-examples/Cxx/Interaction/WorldPointPicker

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Interaction/WorldPointPicker/#description","title":"Description","text":"

This example demonstrates how to get the position of the point in 3D that is exactly behind the mouse click. This point is not likely a point that exists in the data set - i.e. it can be a point on the interior of a cell.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Interaction/WorldPointPicker/#code","title":"Code","text":"

WorldPointPicker.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSphereSource.h>\n#include <vtkWorldPointPicker.h>\n\nnamespace {\n\n// Define interaction style.\nclass MouseInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorStyle* New();\n  vtkTypeMacro(MouseInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnLeftButtonDown() override\n  {\n    std::cout << \"Picking pixel: \" << this->Interactor->GetEventPosition()[0]\n              << \" \" << this->Interactor->GetEventPosition()[1] << std::endl;\n    this->Interactor->GetPicker()->Pick(this->Interactor->GetEventPosition()[0],\n                                        this->Interactor->GetEventPosition()[1],\n                                        0, // always zero.\n                                        this->Interactor->GetRenderWindow()\n                                            ->GetRenderers()\n                                            ->GetFirstRenderer());\n    double picked[3];\n    this->Interactor->GetPicker()->GetPickPosition(picked);\n    std::cout << \"Picked value: \" << picked[0] << \" \" << picked[1] << \" \"\n              << picked[2] << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n};\nvtkStandardNewMacro(MouseInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkWorldPointPicker> worldPointPicker;\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WorldPointPicker\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetPicker(worldPointPicker);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<MouseInteractorStyle> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Interaction/WorldPointPicker/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WorldPointPicker)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WorldPointPicker: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WorldPointPicker MACOSX_BUNDLE WorldPointPicker.cxx )\n  target_link_libraries(WorldPointPicker PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WorldPointPicker\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Interaction/WorldPointPicker/#download-and-build-worldpointpicker","title":"Download and Build WorldPointPicker","text":"

Click here to download WorldPointPicker and its CMakeLists.txt file. Once the tarball WorldPointPicker.tar has been downloaded and extracted,

cd WorldPointPicker/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WorldPointPicker\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Lighting/Light/","title":"Light","text":"

vtk-examples/Cxx/Lighting/Light

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Lighting/Light/#code","title":"Code","text":"

Light.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkLightActor.h>\n#include <vtkLightCollection.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <cstdlib>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  double lightPosition[3] = {0, 0, 1};\n\n  // Create a light\n  double lightFocalPoint[3] = {0, 0, 0};\n\n  vtkNew<vtkLight> light;\n  light->SetLightTypeToSceneLight();\n  light->SetPosition(lightPosition[0], lightPosition[1], lightPosition[2]);\n  light->SetPositional(true); // required for vtkLightActor below\n  light->SetConeAngle(10);\n  light->SetFocalPoint(lightFocalPoint[0], lightFocalPoint[1],\n                       lightFocalPoint[2]);\n  light->SetDiffuseColor(colors->GetColor3d(\"Red\").GetData());\n  light->SetAmbientColor(colors->GetColor3d(\"Green\").GetData());\n  light->SetSpecularColor(colors->GetColor3d(\"Blue\").GetData());\n\n  vtkLightCollection* originalLights = renderer->GetLights();\n  std::cout << \"Originally there are \" << originalLights->GetNumberOfItems()\n            << \" lights.\" << std::endl;\n\n  //  renderer->AddLight(light); // can't do this here - must do this after the\n  //  renderWindow->Render() below\n\n  // Display where the light is\n  vtkNew<vtkLightActor> lightActor;\n  lightActor->SetLight(light);\n  renderer->AddViewProp(lightActor);\n\n  // Display where the light is focused\n  vtkNew<vtkSphereSource> lightFocalPointSphere;\n  lightFocalPointSphere->SetCenter(lightFocalPoint);\n  lightFocalPointSphere->SetRadius(0.1);\n  lightFocalPointSphere->Update();\n\n  vtkNew<vtkPolyDataMapper> lightFocalPointMapper;\n  lightFocalPointMapper->SetInputConnection(\n      lightFocalPointSphere->GetOutputPort());\n\n  vtkNew<vtkActor> lightFocalPointActor;\n  lightFocalPointActor->SetMapper(lightFocalPointMapper);\n  lightFocalPointActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Yellow\").GetData());\n  renderer->AddViewProp(lightFocalPointActor);\n\n  // Create a plane for the light to shine on\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->SetResolution(100, 100);\n  planeSource->Update();\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputData(planeSource->GetOutput());\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n  renderer->AddActor(planeActor);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Light\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  std::cout << \"Now there are \" << originalLights->GetNumberOfItems()\n            << \" lights.\" << std::endl;\n\n  renderer->AddLight(light); // must do this after renderWindow->Render();\n  std::cout << \"Now there are \" << originalLights->GetNumberOfItems()\n            << \" lights.\" << std::endl;\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-2.17199, -2.50774, 2.18);\n  camera->SetFocalPoint(-0.144661, -0.146372, 0.180482);\n  camera->SetViewUp(0.0157883, 0.638203, 0.769706);\n  camera->SetDistance(3.69921);\n  camera->SetClippingRange(1.76133, 6.14753);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Lighting/Light/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Light)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Light: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Light MACOSX_BUNDLE Light.cxx )\n  target_link_libraries(Light PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Light\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Lighting/Light/#download-and-build-light","title":"Download and Build Light","text":"

Click here to download Light and its CMakeLists.txt file. Once the tarball Light.tar has been downloaded and extracted,

cd Light/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Light\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Lighting/LightActor/","title":"LightActor","text":"

vtk-examples/Cxx/Lighting/LightActor

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Lighting/LightActor/#code","title":"Code","text":"

LightActor.cxx

#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkLightActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <cstdlib>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  // Display where the light is\n  vtkNew<vtkLight> light;\n  light->SetPositional(true); // without this line, the program crashes\n  vtkNew<vtkLightActor> lightActor;\n  lightActor->SetLight(light);\n  renderer->AddViewProp(lightActor);\n  lightActor->GetFrustumProperty()->SetColor(\n      colors->GetColor3d(\"LavenderBlush\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LightActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->ResetCamera();\n  renderer->ResetCameraClippingRange();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-2.17199, -2.50774, 2.18);\n  camera->SetFocalPoint(-0.144661, -0.146372, 0.180482);\n  camera->SetViewUp(0.0157883, 0.638203, 0.769706);\n  camera->SetDistance(3.69921);\n  camera->SetClippingRange(1.76133, 6.14753);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Lighting/LightActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LightActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LightActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LightActor MACOSX_BUNDLE LightActor.cxx )\n  target_link_libraries(LightActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LightActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Lighting/LightActor/#download-and-build-lightactor","title":"Download and Build LightActor","text":"

Click here to download LightActor and its CMakeLists.txt file. Once the tarball LightActor.tar has been downloaded and extracted,

cd LightActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LightActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Lighting/SpotLights/","title":"SpotLights","text":"

vtk-examples/Cxx/Lighting/SpotLights

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Lighting/SpotLights/#description","title":"Description","text":"

This example places two vtkLight's with PositionalOn().

Cite

This example was inspired by Oliver Natt's question (and python script) on the VTK Users mailing list.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Lighting/SpotLights/#code","title":"Code","text":"

SpotLights.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  // create a rendering window and renderer\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SpotLights\");\n\n  // create a renderwindowinteractor\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  // create a plane and add it to the renderer\n  vtkNew<vtkPlaneSource> source;\n  source->SetOrigin(-5.0, 0.0, 5.0);\n  source->SetPoint1(5.0, 0.0, 5.0);\n  source->SetPoint2(-5.0, 0.0, -5.0);\n  source->SetResolution(100, 100);\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  renderer->AddActor(actor);\n\n  // set camera view\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(40.0);\n  renderer->GetActiveCamera()->Elevation(30.0);\n\n  // create a green light\n  vtkNew<vtkLight> greenLight;\n  greenLight->PositionalOn();\n  greenLight->SetPosition(-4.0, 4.0, -1.0);\n  greenLight->SetColor(colors->GetColor3d(\"Lawn_green\").GetData());\n  greenLight->SetIntensity(0.5);\n\n  // create a pink light\n  vtkNew<vtkLight> pinkLight;\n  pinkLight->PositionalOn();\n  pinkLight->SetPosition(4.0, 5.0, 1.0);\n  pinkLight->SetColor(colors->GetColor3d(\"DeepPink\").GetData());\n  pinkLight->SetIntensity(0.6);\n\n  // add lights to the renderer\n  renderer->AddLight(pinkLight);\n  renderer->AddLight(greenLight);\n\n  // define a background for better visibility\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"SkyBlue\").GetData());\n  renderer->GradientBackgroundOn();\n\n  // enable interactor\n  iren->Initialize();\n  renderWindow->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Lighting/SpotLights/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SpotLights)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SpotLights: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SpotLights MACOSX_BUNDLE SpotLights.cxx )\n  target_link_libraries(SpotLights PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SpotLights\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Lighting/SpotLights/#download-and-build-spotlights","title":"Download and Build SpotLights","text":"

Click here to download SpotLights and its CMakeLists.txt file. Once the tarball SpotLights.tar has been downloaded and extracted,

cd SpotLights/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SpotLights\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/1DTupleInterpolation/","title":"1DTupleInterpolation","text":"

vtk-examples/Cxx/Math/1DTupleInterpolation

"},{"location":"Cxx/Math/1DTupleInterpolation/#description","title":"Description","text":"

Contributed by: Lars Friedrich

A simple example that shows how to use vtkTupleInterpolator for the purpose of interpolating 1D functions. Internally the program investigates two functions: sine and Runge function with sparsely distributed supporting points. The application uses different interpolation modes: linear, cardinal spline and Kochanek spline. Moreover, the example offers the \"--csv-output\" (or \"-co\") option which causes the program to generate CSV-sheets reflecting the interpolated data. In order to demonstrate the spline interpolation behavior at the edge regions, we use the open and closed interval spline options as well. For example, a Kochanek-interpolation of the Runge function:

"},{"location":"Cxx/Math/1DTupleInterpolation/#program-usage","title":"Program Usage","text":"
./1DTupleInterpolation [](options)\n\n  -h or --help ... print this short help\n  -nv or --no-verbose ... no verbose messages to std::cout\n  -co or --csv-output ... CSV (comma separated values) file outputs\n

Note

optional arguments are case-sensitive!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/1DTupleInterpolation/#code","title":"Code","text":"

1DTupleInterpolation.cxx

//\n#include <cmath>\n#include <cstdlib>\n#include <fstream>\n#include <iostream>\n#include <string>\n#ifndef M_PI\n#define M_PI 3.14159265358979323846\n#endif\n#include <vtkCardinalSpline.h>\n#include <vtkKochanekSpline.h>\n#include <vtkNew.h>\n#include <vtkTupleInterpolator.h>\n\n#include <ctime>\n#include <vector>\n\n#define VERBOSE(x)                                                             \\\n  {                                                                            \\\n    if (Verbose)                                                               \\\n    {                                                                          \\\n      std::cout x;                                                             \\\n      std::cout.flush();                                                       \\\n    }                                                                          \\\n  }\n\n// verbose flag\nbool Verbose = true;\n// CSV output flag\nbool CSVOutput = false;\n\nnamespace {\n/**\n * Print example usage information.\n **/\nvoid PrintUsage(char* binname);\n\n/** Runge function. **/\ndouble FRunge(double x)\n{\n  return 1.0 / (1.0 + x * x);\n}\n\n/** Sine function. **/\ndouble FSin(double x)\n{\n  return sin(x);\n}\n\n/** Execute a specific tuple interpolation method with pre-initialized tuple\n * interpolator. **/\nbool TestInterpolation(vtkTupleInterpolator* tupInt, double tolerance,\n                       const char* csvFileName, double (*mathFunc)(double),\n                       std::vector<double>& x, const std::vector<double>& y,\n                       double N, double symmetricIntervalWidth);\n\n} // namespace\n\n/** \\brief Demonstrate base functionality of VTK-based tuple interpolation (1D).\n * Demonstrate base functionality of VTK-based tuple interpolation (1D).\n *\n * Application result is 0 if SUCCESSFUL.\n *\n * Arguments: <br>\n * -h or --help ... print short help <br>\n * -nv or --no-verbose ... message output (verbose) <br>\n * -co or --csv-output ... CSV (comma separated values) file outputs <br>\n *\n * @author ---\n * @version 1.2\n */\nint main(int argc, char* argv[])\n{\n  // arguments check\n  for (int i = 1; i < argc; i++)\n  {\n    if (std::string(argv[i]) == \"-nv\" || std::string(argv[i]) == \"--no-verbose\")\n      Verbose = false;\n    if (std::string(argv[i]) == \"-h\" || std::string(argv[i]) == \"--help\")\n    {\n      if (argc > 0)\n        PrintUsage(argv[0]);\n      else\n        PrintUsage(nullptr);\n      return EXIT_FAILURE;\n    }\n    if (std::string(argv[i]) == \"-co\" || std::string(argv[i]) == \"--csv-output\")\n      CSVOutput = true;\n  }\n\n  VERBOSE(<< \"\\nDemonstrating VTK-based 1-tuple interpolation capabilities.\\n\")\n  bool ok = true;\n\n  VERBOSE(<< \"  * Generate supporting points ... \")\n  bool lok = true; // local OK\n  // - SINE -\n  constexpr int N1 = 13;\n  std::vector<double> xs(N1, 0);\n  std::vector<double> ys(N1, 0);\n  std::ofstream csv;\n  if (CSVOutput)\n  {\n    csv.open(\"sine.csv\", std::ios::out);\n    if (csv.is_open())\n      csv << \"x;y\\n\";\n    else\n      lok = false;\n  }\n  // prepare the supporting points (sine):\n  for (int i = 0; i < N1; i++)\n  {\n    xs[i] = -M_PI + (double)i / (double)(N1 - 1) * (2. * M_PI);\n    ys[i] = FSin(xs[i]);\n\n    if (CSVOutput && csv.is_open())\n      csv << xs[i] << \";\" << ys[i] << \"\\n\";\n  }\n  if (CSVOutput && csv.is_open())\n    csv.close();\n  // - RUNGE -\n  const int N2 = 10;\n  std::vector<double> xr(N2, 0);\n  std::vector<double> yr(N2, 0);\n  if (CSVOutput)\n  {\n    csv.open(\"runge.csv\", std::ios::out);\n    if (csv.is_open())\n      csv << \"x;y\\n\";\n    else\n      lok = false;\n  }\n  // prepare the supporting points (sine):\n  for (int i = 0; i < N2; i++)\n  {\n    xr[i] = -5.0 + (double)i / (double)(N2 - 1) * (2. * 5.0);\n    yr[i] = FRunge(xr[i]);\n\n    if (CSVOutput && csv.is_open())\n      csv << xr[i] << \";\" << yr[i] << \"\\n\";\n  }\n  if (CSVOutput && csv.is_open())\n    csv.close();\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of sine using linear method ... \")\n  // initialize the tuple interpolator (1D):\n  vtkNew<vtkTupleInterpolator> tupInt;\n  tupInt->SetInterpolationTypeToLinear(); // linear\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.04, \"sin_linear_int.csv\", FSin, xs, ys, N1,\n                          M_PI);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of sine using cardinal spline method (open \"\n             \"interval) ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->SetInterpolationTypeToSpline(); // spline (implicit reset!)\n  vtkNew<vtkCardinalSpline> cardSpline;\n  cardSpline->SetClosed(false);\n  tupInt->SetInterpolatingSpline(cardSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.1, \"sin_card_spline_open_int.csv\", FSin, xs,\n                          ys, N1, M_PI);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of sine using cardinal spline method (closed \"\n             \"interval) ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->Initialize();                   // reset\n  tupInt->SetInterpolationTypeToSpline(); // spline\n  cardSpline->SetClosed(true);\n  tupInt->SetInterpolatingSpline(cardSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.05, \"sin_card_spline_closed_int.csv\", FSin,\n                          xs, ys, N1, M_PI);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of sine using Kochanek spline (default setup) \"\n             \"method (open interval) ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->Initialize();                   // reset\n  tupInt->SetInterpolationTypeToSpline(); // spline\n  vtkNew<vtkKochanekSpline> kochSpline;\n  kochSpline->SetClosed(false);\n  tupInt->SetInterpolatingSpline(kochSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.1, \"sin_koch_spline_open_int.csv\", FSin, xs,\n                          ys, N1, M_PI);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of sine using Kochanek spline (default setup) \"\n             \"method (closed interval) ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->Initialize();                   // reset\n  tupInt->SetInterpolationTypeToSpline(); // spline\n  kochSpline->SetClosed(true);\n  tupInt->SetInterpolatingSpline(kochSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.06, \"sin_koch_spline_closed_int.csv\", FSin,\n                          xs, ys, N1, M_PI);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of Runge using linear method ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->Initialize();\n  tupInt->SetInterpolationTypeToLinear(); // linear\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.25 /* around 0! */, \"runge_linear_int.csv\",\n                          FRunge, xr, yr, N2, 5.0);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of Runge using cardinal spline method ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->SetInterpolationTypeToSpline(); // spline (implicit reset!)\n  cardSpline->SetClosed(false);\n  tupInt->SetInterpolatingSpline(cardSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.15 /* around 0! */,\n                          \"runge_card_spline_int.csv\", FRunge, xr, yr, N2, 5.0);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of Runge using Kochanek spline method ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->Initialize();                   // reset\n  tupInt->SetInterpolationTypeToSpline(); // spline (implicit reset!)\n  kochSpline->SetClosed(false);\n  tupInt->SetInterpolatingSpline(kochSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.18 /* around 0! */,\n                          \"runge_koch_spline_int.csv\", FRunge, xr, yr, N2, 5.0);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"Application result: \")\n  if (ok)\n  {\n    VERBOSE(<< \"OK\\n\\n\")\n    return EXIT_SUCCESS;\n  }\n  else\n  {\n    VERBOSE(<< \"FAILURE\\n\\n\")\n    return EXIT_FAILURE;\n  }\n}\n\nnamespace {\n/**\n * Print example usage information.\n **/\nvoid PrintUsage(char* binname)\n{\n  std::string progname = \"<binary-name>\";\n  if (binname)\n    progname = std::string(binname);\n  std::cout << \"\\n\";\n  std::cout << \"   *** E X A M P L E   U S A G E ***\\n\";\n  std::cout << \"\\n\";\n  std::cout << progname << \" [options]\\n\";\n  std::cout << \"\\n\";\n  std::cout << \"  -h or --help ... print this short help\\n\";\n  std::cout << \"  -nv or --no-verbose ... no verbose messages to std::cout\\n\";\n  std::cout << \"  -co or --csv-output ... CSV (comma separated values) file \"\n               \"outputs\\n\";\n  std::cout << \"\\n\";\n  std::cout << \"  NOTE: optional arguments are case-sensitive!\\n\";\n  std::cout << \"\\n\";\n  std::cout << \"  Author: ---\\n\";\n  std::cout << \"  Affiliation: ---\\n\";\n  std::cout << \"\\n\";\n}\n\n/** Execute a specific tuple interpolation method with pre-initialized tuple\n * interpolator. **/\nbool TestInterpolation(vtkTupleInterpolator* tupInt, double tolerance,\n                       const char* csvFileName, double (*mathFunc)(double),\n                       std::vector<double>& x, const std::vector<double>& y,\n                       double N, double symmetricIntervalWidth)\n{\n  bool ok = true;\n  std::ofstream csvint;\n  if (CSVOutput)\n  {\n    csvint.open(csvFileName, std::ios::out);\n    if (csvint.is_open())\n      csvint << \"x;y;e\\n\";\n    else\n      ok = false;\n  }\n  double yt[1];\n  for (int i = 0; i < N; i++) // re-define supporting points\n  {\n    yt[0] = y[i];\n    tupInt->AddTuple(x[i], yt);\n  }\n  // draw random samples from interval and test against mathFunc:\n  for (int i = 0; i < 1000; i++)\n  {\n    double f = (double)(rand() % 100001) / 100000.;\n    double xi = (f * 2.0 - 1.0) * symmetricIntervalWidth;\n    double yi[1];\n    tupInt->InterpolateTuple(xi, yi);\n    double ei = std::abs(yi[0] - mathFunc(xi));\n    // we have a tolerance within [-PI;+PI] - empirical!\n    if (xi >= -symmetricIntervalWidth && xi <= symmetricIntervalWidth &&\n        ei > tolerance)\n      ok = false;\n    if (CSVOutput && csvint.is_open())\n      csvint << xi << \";\" << yi[0] << \";\" << ei << \"\\n\";\n  }\n  if (CSVOutput && csvint.is_open())\n    csvint.close();\n  return ok;\n}\n\n} // namespace\n
"},{"location":"Cxx/Math/1DTupleInterpolation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(1DTupleInterpolation)\n\nfind_package(VTK COMPONENTS \n  CommonComputationalGeometry\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"1DTupleInterpolation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(1DTupleInterpolation MACOSX_BUNDLE 1DTupleInterpolation.cxx )\n  target_link_libraries(1DTupleInterpolation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS 1DTupleInterpolation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/1DTupleInterpolation/#download-and-build-1dtupleinterpolation","title":"Download and Build 1DTupleInterpolation","text":"

Click here to download 1DTupleInterpolation and its CMakeLists.txt file. Once the tarball 1DTupleInterpolation.tar has been downloaded and extracted,

cd 1DTupleInterpolation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./1DTupleInterpolation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/EigenSymmetric/","title":"EigenSymmetric","text":"

vtk-examples/Cxx/Math/EigenSymmetric

"},{"location":"Cxx/Math/EigenSymmetric/#description","title":"Description","text":"

At the moment, this is a pretty messy process, so here are some helper functions that will hopefully eventually be wrapped into a class/interface.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/EigenSymmetric/#code","title":"Code","text":"

EigenSymmetric.cxx

#include <vtkMath.h>\n\nnamespace {\n/* allocate memory for an nrow x ncol matrix */\ntemplate <class TReal> TReal** create_matrix(long nrow, long ncol)\n{\n  typedef TReal* TRealPointer;\n  TReal** m = new TRealPointer[nrow];\n\n  TReal* block = (TReal*)calloc(nrow * ncol, sizeof(TReal));\n  m[0] = block;\n  for (int row = 1; row < nrow; ++row)\n  {\n    m[row] = &block[row * ncol];\n  }\n  return m;\n}\n\n/* free a TReal matrix allocated with matrix() */\ntemplate <class TReal> void free_matrix(TReal** m)\n{\n  free(m[0]);\n  delete[] m;\n}\n\n} // namespace\n\nint main(int, char*[])\n{\n  // Create this matrix\n  // 1 2 3\n  // 2 5 9\n  // 3 9 8\n\n  double** a = create_matrix<double>(3, 3);\n  a[0][0] = 1;\n  a[0][1] = 2;\n  a[0][2] = 3;\n  a[1][0] = 2;\n  a[1][1] = 5;\n  a[1][2] = 9;\n  a[2][0] = 3;\n  a[2][1] = 9;\n  a[2][2] = 8;\n\n  // create a matrix for the eigenvectors to be stored in\n  double** w = create_matrix<double>(3, 3);\n\n  // create a vector for the eigenvalues to be stored in\n  double v[3];\n\n  // compute the eigenvalues/vectors\n  vtkMath::Jacobi(a, v, w);\n\n  // output eigen values\n  std::cout << \"Eigen values (decreasing order): \" << std::endl;\n  for (int i = 0; i < 3; i++)\n  {\n    std::cout << v[i] << \" \";\n  }\n\n  // output eigenvectors\n  std::cout << \"Eigen vectors (same order as eigen values): \" << std::endl;\n  for (int i = 0; i < 3; i++)\n  {\n    // the columns of w are the eigenvectors\n    std::cout << \"Eigen vector \" << i << \" : \" << w[0][i] << \" \" << w[1][i]\n              << \" \" << w[2][i] << std::endl;\n  }\n\n  // clean up\n  free_matrix(w);\n  free_matrix(a);\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Math/EigenSymmetric/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EigenSymmetric)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EigenSymmetric: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EigenSymmetric MACOSX_BUNDLE EigenSymmetric.cxx )\n  target_link_libraries(EigenSymmetric PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EigenSymmetric\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/EigenSymmetric/#download-and-build-eigensymmetric","title":"Download and Build EigenSymmetric","text":"

Click here to download EigenSymmetric and its CMakeLists.txt file. Once the tarball EigenSymmetric.tar has been downloaded and extracted,

cd EigenSymmetric/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./EigenSymmetric\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/HomogeneousLeastSquares/","title":"HomogeneousLeastSquares","text":"

vtk-examples/Cxx/Math/HomogeneousLeastSquares

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/HomogeneousLeastSquares/#code","title":"Code","text":"

HomogeneousLeastSquares.cxx

#include <vtkMath.h>\n\nnamespace {\n/* allocate memory for an nrow x ncol matrix */\ntemplate <class TReal> TReal** create_matrix(long nrow, long ncol)\n{\n  typedef TReal* TRealPointer;\n  TReal** m = new TRealPointer[nrow];\n\n  TReal* block = (TReal*)calloc(nrow * ncol, sizeof(TReal));\n  m[0] = block;\n  for (int row = 1; row < nrow; ++row)\n  {\n    m[row] = &block[row * ncol];\n  }\n  return m;\n}\n\n/* free a TReal matrix allocated with matrix() */\ntemplate <class TReal> void free_matrix(TReal** m)\n{\n  free(m[0]);\n  delete[] m;\n}\n\n} // namespace\n\nint main(int, char*[])\n{\n\n  // Solve XM = Y;\n\n  int numberOfSamples = 3;\n  int numberOfVariables = 2;\n  double** x = create_matrix<double>(numberOfSamples, numberOfVariables);\n  x[0][0] = 1;\n  x[0][1] = 2;\n  x[1][0] = 2;\n  x[1][1] = 4;\n  x[2][0] = 3;\n  x[2][1] = 6;\n\n  double** m = create_matrix<double>(numberOfVariables, 1);\n\n  vtkMath::SolveHomogeneousLeastSquares(numberOfSamples, x, numberOfVariables,\n                                        m);\n\n  std::cout << \"Solution is: \" << m[0][0] << \" \" << m[1][0] << std::endl;\n\n  free_matrix(x);\n  free_matrix(m);\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Math/HomogeneousLeastSquares/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HomogeneousLeastSquares)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HomogeneousLeastSquares: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HomogeneousLeastSquares MACOSX_BUNDLE HomogeneousLeastSquares.cxx )\n  target_link_libraries(HomogeneousLeastSquares PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HomogeneousLeastSquares\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/HomogeneousLeastSquares/#download-and-build-homogeneousleastsquares","title":"Download and Build HomogeneousLeastSquares","text":"

Click here to download HomogeneousLeastSquares and its CMakeLists.txt file. Once the tarball HomogeneousLeastSquares.tar has been downloaded and extracted,

cd HomogeneousLeastSquares/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HomogeneousLeastSquares\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/LUFactorization/","title":"LUFactorization","text":"

vtk-examples/Cxx/Math/LUFactorization

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/LUFactorization/#code","title":"Code","text":"

LUFactorization.cxx

#include <vtkMath.h>\n\nnamespace {\ntemplate <class TReal> TReal** create_matrix(long nrow, long ncol)\n{\n  typedef TReal* TRealPointer;\n  TReal** m = new TRealPointer[nrow];\n\n  TReal* block = (TReal*)calloc(nrow * ncol, sizeof(TReal));\n  m[0] = block;\n  for (int row = 1; row < nrow; ++row)\n  {\n    m[row] = &block[row * ncol];\n  }\n  return m;\n}\n\n/* free a TReal matrix allocated with matrix() */\ntemplate <class TReal> void free_matrix(TReal** m)\n{\n  free(m[0]);\n  delete[] m;\n}\n\nvoid OutputMatrix(double** a)\n{\n  std::cout << \"[ \" << a[0][0] << \" \" << a[0][1] << std::endl;\n  std::cout << \"  \" << a[1][0] << \" \" << a[1][1] << \" ]\" << std::endl;\n}\n} // namespace\n\nint main(int, char*[])\n{\n  // Create and populate matrix\n  int n = 2;\n  double** a = create_matrix<double>(n, n);\n  a[0][0] = 4;\n  a[0][1] = 3;\n  a[1][0] = 6;\n  a[1][1] = 3;\n\n  //[4 3; 6 3] should decompose to [1 0; 1.5 1] * [4 3; 0 -1.5]\n\n  std::cout << \"a\" << std::endl;\n  OutputMatrix(a);\n\n  // These values do not seem to change the result?\n  int pivotIndices[2] = {0, 0};\n\n  // Decompose matrix A into LU form\n  vtkMath::LUFactorLinearSystem(a, pivotIndices, n);\n\n  std::cout << \"A decomposed into (unit lower triangular) L and U:\"\n            << std::endl;\n  OutputMatrix(a);\n\n  /* The resulting matrix,\n   [6       3]\n   [.66667  1]\n   is a superposition of L and U, with L being a unit lower triangular matrix.\n   That is, ones on the diagonal, zeros in the upper right triangle, and values\n  in the lower left triangle.\n\n  The diagonal of the resulting A is the diagonal of U. The upper right triangle\n  of A is the upper right triangle of U. The lower left triangle of A is the\n  lower left triangle of L (and remember, the diagonal of L is all 1's).\n  */\n\n  /*\n  To show that the resulting interpretation of the output matrix A is correct,\n  we form the matrices following the description above and show that they\n  multiply to the original A matrix. octave:9> [1 0; .666667 1] * [6 3; 0 1] ans\n  =\n\n   6.0000   3.0000\n   4.0000   3.0000\n  */\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Math/LUFactorization/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LUFactorization)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LUFactorization: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LUFactorization MACOSX_BUNDLE LUFactorization.cxx )\n  target_link_libraries(LUFactorization PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LUFactorization\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/LUFactorization/#download-and-build-lufactorization","title":"Download and Build LUFactorization","text":"

Click here to download LUFactorization and its CMakeLists.txt file. Once the tarball LUFactorization.tar has been downloaded and extracted,

cd LUFactorization/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LUFactorization\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/LeastSquares/","title":"LeastSquares","text":"

vtk-examples/Cxx/Math/LeastSquares

"},{"location":"Cxx/Math/LeastSquares/#description","title":"Description","text":"

This example solves XM = Y (an interesting way to write Ax = b).

In particular, we are trying to solve

[4]     [-2](1)\n\n[2] M = [6](1)\n\n[3]     [1](2)\n

It currently does not work.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/LeastSquares/#code","title":"Code","text":"

LeastSquares.cxx

#include <vtkMath.h>\n\nnamespace {\n/* allocate memory for an nrow x ncol matrix */\ntemplate <class TReal> TReal** create_matrix(long nrow, long ncol)\n{\n  typedef TReal* TRealPointer;\n  TReal** m = new TRealPointer[nrow];\n\n  TReal* block = (TReal*)calloc(nrow * ncol, sizeof(TReal));\n  m[0] = block;\n  for (int row = 1; row < nrow; ++row)\n  {\n    m[row] = &block[row * ncol];\n  }\n  return m;\n}\n\n/* free a TReal matrix allocated with matrix() */\ntemplate <class TReal> void free_matrix(TReal** m)\n{\n  free(m[0]);\n  delete[] m;\n}\n} // namespace\n\nint main(int, char*[])\n{\n\n  // Solve XM = Y;\n\n  int numberOfSamples = 3;\n  int numberOfVariables = 2;\n  double** x = create_matrix<double>(numberOfSamples, numberOfVariables);\n  x[0][0] = 1;\n  x[0][1] = 4;\n  x[1][0] = 1;\n  x[1][1] = 2;\n  x[2][0] = 2;\n  x[2][1] = 3;\n\n  double** m = create_matrix<double>(numberOfVariables, 1);\n\n  double** y = create_matrix<double>(numberOfSamples, 1);\n  y[0][0] = -2;\n  y[1][0] = 6;\n  y[2][0] = 1;\n\n  vtkMath::SolveLeastSquares(numberOfSamples, x, numberOfVariables, y, 1, m);\n\n  std::cout << \"Solution is: \" << m[0][0] << \" \" << m[1][0] << std::endl;\n\n  // Solution should be [3; -1];\n  free_matrix(x);\n  free_matrix(m);\n  free_matrix(y);\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Math/LeastSquares/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LeastSquares)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LeastSquares: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LeastSquares MACOSX_BUNDLE LeastSquares.cxx )\n  target_link_libraries(LeastSquares PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LeastSquares\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/LeastSquares/#download-and-build-leastsquares","title":"Download and Build LeastSquares","text":"

Click here to download LeastSquares and its CMakeLists.txt file. Once the tarball LeastSquares.tar has been downloaded and extracted,

cd LeastSquares/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LeastSquares\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/MatrixInverse/","title":"MatrixInverse","text":"

vtk-examples/Cxx/Math/MatrixInverse

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/MatrixInverse/#code","title":"Code","text":"

MatrixInverse.cxx

#include <vtkMatrix3x3.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMatrix3x3> m;\n\n  m->SetElement(2, 1, 2.0); // Set element (0,0) to 1.0\n\n  std::cout << *m << std::endl;\n\n  m->Invert();\n\n  std::cout << *m << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Math/MatrixInverse/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MatrixInverse)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonMath\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MatrixInverse: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MatrixInverse MACOSX_BUNDLE MatrixInverse.cxx )\n  target_link_libraries(MatrixInverse PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MatrixInverse\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/MatrixInverse/#download-and-build-matrixinverse","title":"Download and Build MatrixInverse","text":"

Click here to download MatrixInverse and its CMakeLists.txt file. Once the tarball MatrixInverse.tar has been downloaded and extracted,

cd MatrixInverse/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MatrixInverse\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/MatrixTranspose/","title":"MatrixTranspose","text":"

vtk-examples/Cxx/Math/MatrixTranspose

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/MatrixTranspose/#code","title":"Code","text":"

MatrixTranspose.cxx

#include <vtkMatrix3x3.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMatrix3x3> m;\n\n  m->SetElement(2, 1, 2.0); // Set element (2,1) to 2.0\n\n  std::cout << *m << std::endl;\n\n  m->Transpose();\n\n  std::cout << *m << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Math/MatrixTranspose/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MatrixTranspose)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonMath\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MatrixTranspose: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MatrixTranspose MACOSX_BUNDLE MatrixTranspose.cxx )\n  target_link_libraries(MatrixTranspose PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MatrixTranspose\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/MatrixTranspose/#download-and-build-matrixtranspose","title":"Download and Build MatrixTranspose","text":"

Click here to download MatrixTranspose and its CMakeLists.txt file. Once the tarball MatrixTranspose.tar has been downloaded and extracted,

cd MatrixTranspose/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MatrixTranspose\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/NormalizeVector/","title":"NormalizeVector","text":"

vtk-examples/Cxx/Math/NormalizeVector

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/NormalizeVector/#code","title":"Code","text":"

NormalizeVector.cxx

#include <vtkMath.h>\n\nint main(int, char*[])\n{\n  double a[3] = {100.0, 2.0, 1.0};\n  std::cout << a[0] << \" \" << a[1] << \" \" << a[2] << std::endl;\n  vtkMath::Normalize(a);\n  std::cout << a[0] << \" \" << a[1] << \" \" << a[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Math/NormalizeVector/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NormalizeVector)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NormalizeVector: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NormalizeVector MACOSX_BUNDLE NormalizeVector.cxx )\n  target_link_libraries(NormalizeVector PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NormalizeVector\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/NormalizeVector/#download-and-build-normalizevector","title":"Download and Build NormalizeVector","text":"

Click here to download NormalizeVector and its CMakeLists.txt file. Once the tarball NormalizeVector.tar has been downloaded and extracted,

cd NormalizeVector/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./NormalizeVector\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/PerpendicularVector/","title":"PerpendicularVector","text":"

vtk-examples/Cxx/Math/PerpendicularVector

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/PerpendicularVector/#code","title":"Code","text":"

PerpendicularVector.cxx

#include <vtkMath.h>\n\nint main(int, char*[])\n{\n  double x[3] = {1, 0, 0};\n  double y[3];\n  vtkMath::Perpendiculars(x, y, nullptr, 0);\n\n  std::cout << \"y: \" << y[0] << \" \" << y[1] << \" \" << y[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Math/PerpendicularVector/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PerpendicularVector)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PerpendicularVector: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PerpendicularVector MACOSX_BUNDLE PerpendicularVector.cxx )\n  target_link_libraries(PerpendicularVector PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PerpendicularVector\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/PerpendicularVector/#download-and-build-perpendicularvector","title":"Download and Build PerpendicularVector","text":"

Click here to download PerpendicularVector and its CMakeLists.txt file. Once the tarball PerpendicularVector.tar has been downloaded and extracted,

cd PerpendicularVector/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PerpendicularVector\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/VectorDot/","title":"VectorDot","text":"

vtk-examples/Cxx/Math/VectorDot

"},{"location":"Cxx/Math/VectorDot/#description","title":"Description","text":"

Note that the filter maps the values to a scalar range. In the example, the values of the dot products are:

 1, .707, 0\n

The filter outputs

 1, .414, -1\n

because the default scalar range that the filter maps the values to is (-1,1).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/VectorDot/#code","title":"Code","text":"

VectorDot.cxx

#include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkVectorDot.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  // Generate data\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(2, 0, 0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Add normals\n  vtkNew<vtkFloatArray> normals;\n  normals->SetNumberOfComponents(3);\n  normals->SetName(\"Normals\");\n\n  float n0[3] = {1, 0, 0};\n  float n1[3] = {1, 0, 0};\n  float n2[3] = {1, 0, 0};\n  normals->InsertNextTupleValue(n0);\n  normals->InsertNextTupleValue(n1);\n  normals->InsertNextTupleValue(n2);\n\n  polydata->GetPointData()->SetNormals(normals);\n\n  // Add vectors.\n  vtkNew<vtkFloatArray> vectors;\n  vectors->SetNumberOfComponents(3);\n  vectors->SetName(\"Vectors\");\n\n  float v0[3] = {1, 0, 0};\n  float v1[3] = {.707f, .707f, 0};\n  float v2[3] = {0, 1, 0};\n  vectors->InsertNextTupleValue(v0);\n  vectors->InsertNextTupleValue(v1);\n  vectors->InsertNextTupleValue(v2);\n\n  polydata->GetPointData()->SetVectors(vectors);\n\n  // Compute the dot products between normals and vectors.\n  vtkNew<vtkVectorDot> vectorDot;\n  vectorDot->SetInputData(polydata);\n  vectorDot->Update();\n\n  // Get the results.\n  auto scalars = dynamic_cast<vtkFloatArray*>(\n      vectorDot->GetOutput()->GetPointData()->GetScalars());\n\n  // Output the results.\n  for (vtkIdType i = 0; i < scalars->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Value \" << i << \" : \" << scalars->GetValue(i) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Math/VectorDot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorDot)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorDot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorDot MACOSX_BUNDLE VectorDot.cxx )\n  target_link_libraries(VectorDot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorDot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/VectorDot/#download-and-build-vectordot","title":"Download and Build VectorDot","text":"

Click here to download VectorDot and its CMakeLists.txt file. Once the tarball VectorDot.tar has been downloaded and extracted,

cd VectorDot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VectorDot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Math/VectorNorm/","title":"VectorNorm","text":"

vtk-examples/Cxx/Math/VectorNorm

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Math/VectorNorm/#code","title":"Code","text":"

VectorNorm.cxx

#include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkVectorNorm.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1, 2, 3);\n  points->InsertNextPoint(4, 5, 6);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkFloatArray> distances;\n  distances->SetNumberOfComponents(3);\n  distances->SetName(\"Distances\");\n\n  float v1[3] = {1, 2, 3};\n  float v2[3] = {4, 5, 6};\n  distances->InsertNextTupleValue(v1);\n  distances->InsertNextTupleValue(v2);\n\n  polydata->GetPointData()->SetVectors(distances);\n\n  vtkNew<vtkVectorNorm> vectorNorm;\n  vectorNorm->SetInputData(polydata);\n  vectorNorm->Update();\n\n  vtkFloatArray* scalars = dynamic_cast<vtkFloatArray*>(\n      vectorNorm->GetOutput()->GetPointData()->GetScalars());\n\n  for (vtkIdType i = 0; i < scalars->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Value \" << i << \" : \" << scalars->GetValue(i) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Math/VectorNorm/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorNorm)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorNorm: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorNorm MACOSX_BUNDLE VectorNorm.cxx )\n  target_link_libraries(VectorNorm PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorNorm\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Math/VectorNorm/#download-and-build-vectornorm","title":"Download and Build VectorNorm","text":"

Click here to download VectorNorm and its CMakeLists.txt file. Once the tarball VectorNorm.tar has been downloaded and extracted,

cd VectorNorm/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VectorNorm\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Matlab/MatlabEngineFilter/","title":"MatlabEngineFilter","text":"

vtk-examples/Cxx/Matlab/MatlabEngineFilter

"},{"location":"Cxx/Matlab/MatlabEngineFilter/#description","title":"Description","text":"

This example currently does nothing.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Matlab/MatlabEngineFilter/#code","title":"Code","text":"

MatlabEngineFilter.cxx

// need to set VTK_USE_MATLAB_MEX ON\n\n#include <vtkMatlabEngineFilter.h>\n#include <vtkNew.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkMatlabEngineFilter> matlabFilter;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Matlab/MatlabEngineFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MatlabEngineFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MatlabEngineFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MatlabEngineFilter MACOSX_BUNDLE MatlabEngineFilter.cxx )\n  target_link_libraries(MatlabEngineFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MatlabEngineFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Matlab/MatlabEngineFilter/#download-and-build-matlabenginefilter","title":"Download and Build MatlabEngineFilter","text":"

Click here to download MatlabEngineFilter and its CMakeLists.txt file. Once the tarball MatlabEngineFilter.tar has been downloaded and extracted,

cd MatlabEngineFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MatlabEngineFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Medical/GenerateCubesFromLabels/","title":"GenerateCubesFromLabels","text":"

vtk-examples/Cxx/Medical/GenerateCubesFromLabels

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Medical/GenerateCubesFromLabels/#description","title":"Description","text":"

Sometimes it is helpful to view the results of a segmentation without any post processing. This example converts the point data from a labeled volume into cell data. The surfaces are displayed as vtkPolydata. If you want to created smoothed polydata models from your segmented volumes, see the example GenerateModelsFromLabels. The input volume must be in MetaIO format.

 Usage: GenerateCubesFromLabels InputVolume.mhd StartLabel EndLabel\n      where\n        InputVolume is a meta file containing a 3 volume of discrete labels.\n        StartLabel is the first label to be processed\n        EndLabel is the last label to be processed\n        NOTE: There can be gaps in the labeling. If a label does not exist in the volume, it will be skipped.\n

Note

This original source code for this example is here.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Medical/GenerateCubesFromLabels/#code","title":"Code","text":"

GenerateCubesFromLabels.cxx

//\n// GenerateCubesFromLabels\n//   Usage: GenerateCubesFromLabels InputVolume Startlabel Endlabel\n//          where\n//          InputVolume is a meta file containing a 3 volume of\n//            discrete labels.\n//          StartLabel is the first label to be processed\n//          EndLabel is the last label to be processed\n//          NOTE: There can be gaps in the labeling. If a label does\n//          not exist in the volume, it will be skipped.\n//\n//\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkGeometryFilter.h>\n#include <vtkImageData.h>\n#include <vtkImageWrapPad.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkThreshold.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n\n#include <iostream>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 4)\n  {\n    std::cout\n        << \"Usage: \" << argv[0]\n        << \" InputVolume StartLabel EndLabel e.g. Frog/frogtissue.mhd 1 29\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Define all of the variables\n  unsigned int startLabel = atoi(argv[2]);\n  unsigned int endLabel = atoi(argv[3]);\n\n  // Generate cubes from labels.\n  // 1) Read the meta file\n  // 2) Convert point data to cell data\n  // 3) Convert to geometry and display\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Pad the volume so that we can change the point data into cell.\n  // data.\n  int* extent = reader->GetOutput()->GetExtent();\n  vtkNew<vtkImageWrapPad> pad;\n  pad->SetInputConnection(reader->GetOutputPort());\n  pad->SetOutputWholeExtent(extent[0], extent[1] + 1, extent[2], extent[3] + 1,\n                            extent[4], extent[5] + 1);\n  pad->Update();\n\n  // Copy the scalar point data of the volume into the scalar cell data.\n  pad->GetOutput()->GetCellData()->SetScalars(\n      reader->GetOutput()->GetPointData()->GetScalars());\n\n  vtkNew<vtkThreshold> selector;\n  selector->SetInputArrayToProcess(0, 0, 0,\n                                   vtkDataObject::FIELD_ASSOCIATION_CELLS,\n                                   vtkDataSetAttributes::SCALARS);\n  selector->SetInputConnection(pad->GetOutputPort());\n  selector->SetLowerThreshold(startLabel);\n  selector->SetUpperThreshold(endLabel);\n  selector->Update();\n\n  // Shift the geometry by 1/2.\n  vtkNew<vtkTransform> transform;\n  transform->Translate(-0.5, -0.5, -0.5);\n\n  vtkNew<vtkTransformFilter> transformModel;\n  transformModel->SetTransform(transform);\n  transformModel->SetInputConnection(selector->GetOutputPort());\n\n  vtkNew<vtkGeometryFilter> geometry;\n  geometry->SetInputConnection(transformModel->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometry->GetOutputPort());\n  mapper->SetScalarRange(startLabel, endLabel);\n  mapper->SetScalarModeToUseCellData();\n  mapper->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"GenerateCubesFromLabels\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateBlue\").GetData());\n  renderWindow->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(42.301174, 939.893457, -124.005030);\n  camera->SetFocalPoint(224.697134, 221.301653, 146.823706);\n  camera->SetViewUp(0.262286, -0.281321, -0.923073);\n  camera->SetDistance(789.297581);\n  camera->SetClippingRange(168.744328, 1509.660206);\n\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Medical/GenerateCubesFromLabels/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GenerateCubesFromLabels)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GenerateCubesFromLabels: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GenerateCubesFromLabels MACOSX_BUNDLE GenerateCubesFromLabels.cxx )\n  target_link_libraries(GenerateCubesFromLabels PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GenerateCubesFromLabels\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Medical/GenerateCubesFromLabels/#download-and-build-generatecubesfromlabels","title":"Download and Build GenerateCubesFromLabels","text":"

Click here to download GenerateCubesFromLabels and its CMakeLists.txt file. Once the tarball GenerateCubesFromLabels.tar has been downloaded and extracted,

cd GenerateCubesFromLabels/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GenerateCubesFromLabels\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Medical/GenerateModelsFromLabels/","title":"GenerateModelsFromLabels","text":"

vtk-examples/Cxx/Medical/GenerateModelsFromLabels

"},{"location":"Cxx/Medical/GenerateModelsFromLabels/#description","title":"Description","text":"

This example uses vtkDiscreteFlyingEdges3D or vtkDiscreteMarchingCubes to create vtkPolyData models from a 3D volume that contains discrete labels. These volumes are normally the output of a segmentation algorithm. The polydata for each label will be output into a separate file.

You can load these files into ParaView, where they will appear as a series of time steps. You can then single step through displaying the polydate from each file making up the series.

If you want to see the segmentation results as cube models, see the example GenerateCubesFromLabels

The input volume must be in MetaIO format.

Once you generate the models, you can view them with Paraview

Note

This original source code for this example is here.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Medical/GenerateModelsFromLabels/#code","title":"Code","text":"

GenerateModelsFromLabels.cxx

//\n// GenerateModelsFromLabels\n//   Usage: GenerateModelsFromLabels InputVolume Startlabel Endlabel\n//          where\n//          InputVolume is a meta file containing a 3 volume of\n//            discrete labels.\n//          StartLabel is the first label to be processed\n//          EndLabel is the last label to be processed\n//          NOTE: There can be gaps in the labeling. If a label does\n//          not exist in the volume, it will be skipped.\n//\n//\n#include <vtkGeometryFilter.h>\n#include <vtkImageAccumulate.h>\n#include <vtkImageData.h>\n#include <vtkMaskFields.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkThreshold.h>\n#include <vtkVersion.h>\n#include <vtkWindowedSincPolyDataFilter.h>\n#include <vtkXMLPolyDataWriter.h>\n\n// vtkDiscreteFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n// #undef USE_FLYING_EDGES\n\n#ifdef USE_FLYING_EDGES\n#include <vtkDiscreteFlyingEdges3D.h>\n#else\n#include <vtkDiscreteMarchingCubes.h>\n#endif\n\n#include <sstream>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 4)\n  {\n    std::cout\n        << \"Usage: \" << argv[0]\n        << \" InputVolume StartLabel EndLabel  e.g. Frog/frogtissue.mhd 1 29\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create all of the classes we will need.\n  vtkNew<vtkMetaImageReader> reader;\n  vtkNew<vtkImageAccumulate> histogram;\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkDiscreteFlyingEdges3D> discreteCubes;\n#else\n  vtkNew<vtkDiscreteMarchingCubes> discreteCubes;\n#endif\n  vtkNew<vtkWindowedSincPolyDataFilter> smoother;\n  vtkNew<vtkThreshold> selector;\n  vtkNew<vtkMaskFields> scalarsOff;\n  vtkNew<vtkGeometryFilter> geometry;\n  vtkNew<vtkXMLPolyDataWriter> writer;\n\n  // Define all of the variables\n  unsigned int startLabel = atoi(argv[2]);\n  unsigned int endLabel = atoi(argv[3]);\n  std::string filePrefix = \"Label\";\n  unsigned int smoothingIterations = 15;\n  double passBand = 0.001;\n  double featureAngle = 120.0;\n\n  // Generate models from labels.\n  // 1) Read the meta file\n  // 2) Generate a histogram of the labels\n  // 3) Generate models from the labeled volume\n  // 4) Smooth the models\n  // 5) Output each model into a separate file\n\n  reader->SetFileName(argv[1]);\n\n  histogram->SetInputConnection(reader->GetOutputPort());\n  histogram->SetComponentExtent(0, endLabel, 0, 0, 0, 0);\n  histogram->SetComponentOrigin(0, 0, 0);\n  histogram->SetComponentSpacing(1, 1, 1);\n  histogram->Update();\n\n  discreteCubes->SetInputConnection(reader->GetOutputPort());\n  discreteCubes->GenerateValues(endLabel - startLabel + 1, startLabel,\n                                endLabel);\n\n  smoother->SetInputConnection(discreteCubes->GetOutputPort());\n  smoother->SetNumberOfIterations(smoothingIterations);\n  smoother->BoundarySmoothingOff();\n  smoother->FeatureEdgeSmoothingOff();\n  smoother->SetFeatureAngle(featureAngle);\n  smoother->SetPassBand(passBand);\n  smoother->NonManifoldSmoothingOn();\n  smoother->NormalizeCoordinatesOn();\n  smoother->Update();\n\n  selector->SetInputConnection(smoother->GetOutputPort());\n#ifdef USE_FLYING_EDGES\n  selector->SetInputArrayToProcess(0, 0, 0,\n                                   vtkDataObject::FIELD_ASSOCIATION_POINTS,\n                                   vtkDataSetAttributes::SCALARS);\n#else\n  selector->SetInputArrayToProcess(0, 0, 0,\n                                   vtkDataObject::FIELD_ASSOCIATION_CELLS,\n                                   vtkDataSetAttributes::SCALARS);\n#endif\n\n  // Strip the scalars from the output\n  scalarsOff->SetInputConnection(selector->GetOutputPort());\n  scalarsOff->CopyAttributeOff(vtkMaskFields::POINT_DATA,\n                               vtkDataSetAttributes::SCALARS);\n  scalarsOff->CopyAttributeOff(vtkMaskFields::CELL_DATA,\n                               vtkDataSetAttributes::SCALARS);\n\n  geometry->SetInputConnection(scalarsOff->GetOutputPort());\n\n  writer->SetInputConnection(geometry->GetOutputPort());\n\n  for (unsigned int i = startLabel; i <= endLabel; i++)\n  {\n    // see if the label exists, if not skip it\n    double frequency =\n        histogram->GetOutput()->GetPointData()->GetScalars()->GetTuple1(i);\n    if (frequency == 0.0)\n    {\n      continue;\n    }\n\n    // select the cells for a given label\n    selector->SetLowerThreshold(i);\n    selector->SetUpperThreshold(i);\n\n    // output the polydata\n    std::stringstream ss;\n    ss << filePrefix << i << \".vtp\";\n    std::cout << argv[0] << \" writing \" << ss.str() << std::endl;\n\n    writer->SetFileName(ss.str().c_str());\n    writer->Write();\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Medical/GenerateModelsFromLabels/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GenerateModelsFromLabels)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOImage\n  IOXML\n  ImagingStatistics\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GenerateModelsFromLabels: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GenerateModelsFromLabels MACOSX_BUNDLE GenerateModelsFromLabels.cxx )\n  target_link_libraries(GenerateModelsFromLabels PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GenerateModelsFromLabels\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Medical/GenerateModelsFromLabels/#download-and-build-generatemodelsfromlabels","title":"Download and Build GenerateModelsFromLabels","text":"

Click here to download GenerateModelsFromLabels and its CMakeLists.txt file. Once the tarball GenerateModelsFromLabels.tar has been downloaded and extracted,

cd GenerateModelsFromLabels/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GenerateModelsFromLabels\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Medical/MedicalDemo1/","title":"MedicalDemo1","text":"

vtk-examples/Cxx/Medical/MedicalDemo1

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Medical/MedicalDemo1/#description","title":"Description","text":"

The skin extracted from a CT dataset of the head.

usage

MedicalDemo1 FullHead.mhd

Note

The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

Note

This original source code for this example is here.

Info

See Figure 12-2 in Chapter 12 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Medical/MedicalDemo1/#code","title":"Code","text":"

MedicalDemo1.cxx

// Derived from VTK/Examples/Cxx/Medical1.cxx\n// This example reads a volume dataset, extracts an isosurface that\n// represents the skin and displays it.\n//\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> skinColor{{240, 184, 160, 255}};\n  colors->SetColor(\"SkinColor\", skinColor.data());\n  std::array<unsigned char, 4> backColor{{255, 229, 200, 255}};\n  colors->SetColor(\"BackfaceColor\", backColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the renderer, the render window, and the interactor. The renderer\n  // draws into the render window, the interactor enables mouse- and\n  // keyboard-based interaction with the data within the render window.\n  //\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // An isosurface, or contour value of 500 is known to correspond to the\n  // skin of the patient.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> skinExtractor;\n#else\n  vtkNew<vtkMarchingCubes> skinExtractor;\n#endif\n\n  skinExtractor->SetInputConnection(reader->GetOutputPort());\n  skinExtractor->SetValue(0, 500);\n\n  vtkNew<vtkPolyDataMapper> skinMapper;\n  skinMapper->SetInputConnection(skinExtractor->GetOutputPort());\n  skinMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> skin;\n  skin->SetMapper(skinMapper);\n  skin->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"SkinColor\").GetData());\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"BackfaceColor\").GetData());\n  skin->SetBackfaceProperty(backProp);\n\n  // An outline provides context around the data.\n  //\n  vtkNew<vtkOutlineFilter> outlineData;\n  outlineData->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outlineData->GetOutputPort());\n\n  vtkNew<vtkActor> outline;\n  outline->SetMapper(mapOutline);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // It is convenient to create an initial view of the data. The FocalPoint\n  // and Position form a vector direction. Later on (ResetCamera() method)\n  // this vector is used to position the camera to look at the data in\n  // this direction.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n\n  // Actors are added to the renderer. An initial camera view is created.\n  // The Dolly() method moves the camera towards the FocalPoint,\n  // thereby enlarging the image.\n  aRenderer->AddActor(outline);\n  aRenderer->AddActor(skin);\n  aRenderer->SetActiveCamera(aCamera);\n  aRenderer->ResetCamera();\n  aCamera->Dolly(1.5);\n\n  // Set a background color for the renderer and set the size of the\n  // render window (expressed in pixels).\n  aRenderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"MedicalDemo1\");\n\n  // Note that when camera movement occurs (as it does in the Dolly()\n  // method), the clipping planes often need adjusting. Clipping planes\n  // consist of two planes: near and far along the view direction. The\n  // near plane clips out objects in front of the plane; the far plane\n  // clips out objects behind the plane. This way only what is drawn\n  // between the planes is actually rendered.\n  aRenderer->ResetCameraClippingRange();\n\n  // Initialize the event loop and then start it.\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Medical/MedicalDemo1/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MedicalDemo1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MedicalDemo1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MedicalDemo1 MACOSX_BUNDLE MedicalDemo1.cxx )\n  target_link_libraries(MedicalDemo1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MedicalDemo1\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Medical/MedicalDemo1/#download-and-build-medicaldemo1","title":"Download and Build MedicalDemo1","text":"

Click here to download MedicalDemo1 and its CMakeLists.txt file. Once the tarball MedicalDemo1.tar has been downloaded and extracted,

cd MedicalDemo1/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MedicalDemo1\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Medical/MedicalDemo2/","title":"MedicalDemo2","text":"

vtk-examples/Cxx/Medical/MedicalDemo2

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Medical/MedicalDemo2/#description","title":"Description","text":"

Skin and bone isosurfaces.

Usage

MedicalDemo2 FullHead.mhd

Note

The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

Note

This original source code for this example is here.

Info

See Figure 12-3 in Chapter 12 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Medical/MedicalDemo2/#code","title":"Code","text":"

MedicalDemo2.cxx

// Derived from VTK/Examples/Cxx/Medical2.cxx\n// This example reads a volume dataset, extracts two isosurfaces that\n// represent the skin and bone, and then displays them.\n//\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the colors.\n  std::array<unsigned char, 4> skinColor{{240, 184, 160, 255}};\n  colors->SetColor(\"SkinColor\", skinColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the renderer, the render window, and the interactor. The renderer\n  // draws into the render window, the interactor enables mouse- and\n  // keyboard-based interaction with the data within the render window.\n  //\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // The following reader is used to read a series of 2D slices (images)\n  // that compose the volume. The slice dimensions are set, and the\n  // pixel spacing. The data Endianness must also be specified. The reader\n  // uses the FilePrefix in combination with the slice number to construct\n  // filenames using the format FilePrefix.%d. (In this case the FilePrefix\n  // is the root name of the file: quarter.)\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // An isosurface, or contour value of 500 is known to correspond to the\n  // skin of the patient.\n  // The triangle stripper is used to create triangle strips from the\n  // isosurface; these render much faster on many systems.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> skinExtractor;\n#else\n  vtkNew<vtkMarchingCubes> skinExtractor;\n#endif\n  skinExtractor->SetInputConnection(reader->GetOutputPort());\n  skinExtractor->SetValue(0, 500);\n\n  vtkNew<vtkStripper> skinStripper;\n  skinStripper->SetInputConnection(skinExtractor->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> skinMapper;\n  skinMapper->SetInputConnection(skinStripper->GetOutputPort());\n  skinMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> skin;\n  skin->SetMapper(skinMapper);\n  skin->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"SkinColor\").GetData());\n  skin->GetProperty()->SetSpecular(0.3);\n  skin->GetProperty()->SetSpecularPower(20);\n  skin->GetProperty()->SetOpacity(0.5);\n\n  // An isosurface, or contour value of 1150 is known to correspond to the\n  // bone of the patient.\n  // The triangle stripper is used to create triangle strips from the\n  // isosurface; these render much faster on may systems.\n  vtkNew<vtkFlyingEdges3D> boneExtractor;\n  boneExtractor->SetInputConnection(reader->GetOutputPort());\n  boneExtractor->SetValue(0, 1150);\n\n  vtkNew<vtkStripper> boneStripper;\n  boneStripper->SetInputConnection(boneExtractor->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> boneMapper;\n  boneMapper->SetInputConnection(boneStripper->GetOutputPort());\n  boneMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> bone;\n  bone->SetMapper(boneMapper);\n  bone->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Ivory\").GetData());\n\n  // An outline provides context around the data.\n  //\n  vtkNew<vtkOutlineFilter> outlineData;\n  outlineData->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outlineData->GetOutputPort());\n\n  vtkNew<vtkActor> outline;\n  outline->SetMapper(mapOutline);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // It is convenient to create an initial view of the data. The FocalPoint\n  // and Position form a vector direction. Later on (ResetCamera() method)\n  // this vector is used to position the camera to look at the data in\n  // this direction.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n\n  // Actors are added to the renderer. An initial camera view is created.\n  // The Dolly() method moves the camera towards the FocalPoint,\n  // thereby enlarging the image.\n  aRenderer->AddActor(outline);\n  aRenderer->AddActor(skin);\n  aRenderer->AddActor(bone);\n  aRenderer->SetActiveCamera(aCamera);\n  aRenderer->ResetCamera();\n  aCamera->Dolly(1.5);\n\n  // Set a background color for the renderer and set the size of the\n  // render window (expressed in pixels).\n  aRenderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"MedicalDemo2\");\n\n  // Note that when camera movement occurs (as it does in the Dolly()\n  // method), the clipping planes often need adjusting. Clipping planes\n  // consist of two planes: near and far along the view direction. The\n  // near plane clips out objects in front of the plane; the far plane\n  // clips out objects behind the plane. This way only what is drawn\n  // between the planes is actually rendered.\n  aRenderer->ResetCameraClippingRange();\n\n  // Initialize the event loop and then start it.\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Medical/MedicalDemo2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MedicalDemo2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MedicalDemo2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MedicalDemo2 MACOSX_BUNDLE MedicalDemo2.cxx )\n  target_link_libraries(MedicalDemo2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MedicalDemo2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Medical/MedicalDemo2/#download-and-build-medicaldemo2","title":"Download and Build MedicalDemo2","text":"

Click here to download MedicalDemo2 and its CMakeLists.txt file. Once the tarball MedicalDemo2.tar has been downloaded and extracted,

cd MedicalDemo2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MedicalDemo2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Medical/MedicalDemo3/","title":"MedicalDemo3","text":"

vtk-examples/Cxx/Medical/MedicalDemo3

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Medical/MedicalDemo3/#description","title":"Description","text":"

Composite image of three planes and translucent skin

Usage

MedicalDemo3 FullHead.mhd

Note

The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

Note

This original source code for this example is here.

Info

See Figure 12-4 in Chapter 12 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Medical/MedicalDemo3/#code","title":"Code","text":"

MedicalDemo3.cxx

// Derived from VTK/Examples/Cxx/Medical3.cxx\n// This example reads a volume dataset, extracts two isosurfaces that\n// represent the skin and bone, creates three orthogonal planes\n// (sagittal, axial, coronal), and displays them.\n//\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkLookupTable.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd  e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> skinColor{{240, 184, 160, 255}};\n  colors->SetColor(\"SkinColor\", skinColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the renderer, the render window, and the interactor. The\n  // renderer draws into the render window, the interactor enables\n  // mouse- and keyboard-based interaction with the data within the\n  // render window.\n  //\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aRenderer);\n  renWin->SetWindowName(\"MedicalDemo3\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Set a background color for the renderer and set the size of the\n  // render window (expressed in pixels).\n  aRenderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renWin->SetSize(640, 480);\n\n  // The following reader is used to read a series of 2D slices (images)\n  // that compose the volume. The slice dimensions are set, and the\n  // pixel spacing. The data Endianness must also be specified. The\n  // reader uses the FilePrefix in combination with the slice number to\n  // construct filenames using the format FilePrefix.%d. (In this case\n  // the FilePrefix is the root name of the file: quarter.)\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // An isosurface, or contour value of 500 is known to correspond to\n  // the skin of the patient.\n  // The triangle stripper is used to create triangle\n  // strips from the isosurface; these render much faster on may\n  // systems.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> skinExtractor;\n#else\n  vtkNew<vtkMarchingCubes> skinExtractor;\n#endif\n  skinExtractor->SetInputConnection(reader->GetOutputPort());\n  skinExtractor->SetValue(0, 500);\n  skinExtractor->Update();\n\n  vtkNew<vtkStripper> skinStripper;\n  skinStripper->SetInputConnection(skinExtractor->GetOutputPort());\n  skinStripper->Update();\n\n  vtkNew<vtkPolyDataMapper> skinMapper;\n  skinMapper->SetInputConnection(skinStripper->GetOutputPort());\n  skinMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> skin;\n  skin->SetMapper(skinMapper);\n  skin->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"SkinColor\").GetData());\n  skin->GetProperty()->SetSpecular(0.3);\n  skin->GetProperty()->SetSpecularPower(20);\n\n  // An isosurface, or contour value of 1150 is known to correspond to\n  // the bone of the patient.\n  // The triangle stripper is used to create triangle\n  // strips from the isosurface; these render much faster on may\n  // systems.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> boneExtractor;\n#else\n  vtkNew<vtkMarchingCubes> boneExtractor;\n#endif\n  boneExtractor->SetInputConnection(reader->GetOutputPort());\n  boneExtractor->SetValue(0, 1150);\n\n  vtkNew<vtkStripper> boneStripper;\n  boneStripper->SetInputConnection(boneExtractor->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> boneMapper;\n  boneMapper->SetInputConnection(boneStripper->GetOutputPort());\n  boneMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> bone;\n  bone->SetMapper(boneMapper);\n  bone->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Ivory\").GetData());\n\n  // An outline provides context around the data.\n  //\n  vtkNew<vtkOutlineFilter> outlineData;\n  outlineData->SetInputConnection(reader->GetOutputPort());\n  outlineData->Update();\n\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outlineData->GetOutputPort());\n\n  vtkNew<vtkActor> outline;\n  outline->SetMapper(mapOutline);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Now we are creating three orthogonal planes passing through the\n  // volume. Each plane uses a different texture map and therefore has\n  // different coloration.\n\n  // Start by creating a black/white lookup table.\n  vtkNew<vtkLookupTable> bwLut;\n  bwLut->SetTableRange(0, 2000);\n  bwLut->SetSaturationRange(0, 0);\n  bwLut->SetHueRange(0, 0);\n  bwLut->SetValueRange(0, 1);\n  bwLut->Build(); // effective built\n\n  // Now create a lookup table that consists of the full hue circle\n  // (from HSV).\n  vtkNew<vtkLookupTable> hueLut;\n  hueLut->SetTableRange(0, 2000);\n  hueLut->SetHueRange(0, 1);\n  hueLut->SetSaturationRange(1, 1);\n  hueLut->SetValueRange(1, 1);\n  hueLut->Build(); // effective built\n\n  // Finally, create a lookup table with a single hue but having a range\n  // in the saturation of the hue.\n  vtkNew<vtkLookupTable> satLut;\n  satLut->SetTableRange(0, 2000);\n  satLut->SetHueRange(0.6, 0.6);\n  satLut->SetSaturationRange(0, 1);\n  satLut->SetValueRange(1, 1);\n  satLut->Build(); // effective built\n\n  // Create the first of the three planes. The filter vtkImageMapToColors\n  // maps the data through the corresponding lookup table created above. The\n  // vtkImageActor is a type of vtkProp and conveniently displays an image on\n  // a single quadrilateral plane. It does this using texture mapping and as\n  // a result is quite fast. (Note: the input image has to be unsigned char\n  // values, which the vtkImageMapToColors produces.) Note also that by\n  // specifying the DisplayExtent, the pipeline requests data of this extent\n  // and the vtkImageMapToColors only processes a slice of data.\n  vtkNew<vtkImageMapToColors> sagittalColors;\n  sagittalColors->SetInputConnection(reader->GetOutputPort());\n  sagittalColors->SetLookupTable(bwLut);\n  sagittalColors->Update();\n\n  vtkNew<vtkImageActor> sagittal;\n  sagittal->GetMapper()->SetInputConnection(sagittalColors->GetOutputPort());\n  sagittal->SetDisplayExtent(128, 128, 0, 255, 0, 92);\n  sagittal->ForceOpaqueOn();\n\n  // Create the second (axial) plane of the three planes. We use the\n  // same approach as before except that the extent differs.\n  vtkNew<vtkImageMapToColors> axialColors;\n  axialColors->SetInputConnection(reader->GetOutputPort());\n  axialColors->SetLookupTable(hueLut);\n  axialColors->Update();\n\n  vtkNew<vtkImageActor> axial;\n  axial->GetMapper()->SetInputConnection(axialColors->GetOutputPort());\n  axial->SetDisplayExtent(0, 255, 0, 255, 46, 46);\n  axial->ForceOpaqueOn();\n\n  // Create the third (coronal) plane of the three planes. We use\n  // the same approach as before except that the extent differs.\n  vtkNew<vtkImageMapToColors> coronalColors;\n  coronalColors->SetInputConnection(reader->GetOutputPort());\n  coronalColors->SetLookupTable(satLut);\n  coronalColors->Update();\n\n  vtkNew<vtkImageActor> coronal;\n  coronal->GetMapper()->SetInputConnection(coronalColors->GetOutputPort());\n  coronal->SetDisplayExtent(0, 255, 128, 128, 0, 92);\n  coronal->ForceOpaqueOn();\n\n  // It is convenient to create an initial view of the data. The\n  // FocalPoint and Position form a vector direction. Later on\n  // (ResetCamera() method) this vector is used to position the camera\n  // to look at the data in this direction.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n\n  // Actors are added to the renderer.\n  aRenderer->AddActor(outline);\n  aRenderer->AddActor(sagittal);\n  aRenderer->AddActor(axial);\n  aRenderer->AddActor(coronal);\n  aRenderer->AddActor(skin);\n  aRenderer->AddActor(bone);\n\n  // Turn off bone for this example.\n  bone->VisibilityOff();\n\n  // Set skin to semi-transparent.\n  skin->GetProperty()->SetOpacity(0.5);\n\n  // An initial camera view is created. The Dolly() method moves\n  // the camera towards the FocalPoint, thereby enlarging the image.\n  aRenderer->SetActiveCamera(aCamera);\n\n  // Calling Render() directly on a vtkRenderer is strictly forbidden.\n  // Only calling Render() on the vtkRenderWindow is a valid call.\n  renWin->Render();\n\n  aRenderer->ResetCamera();\n  aCamera->Dolly(1.5);\n\n  // Note that when camera movement occurs (as it does in the Dolly()\n  // method), the clipping planes often need adjusting. Clipping planes\n  // consist of two planes: near and far along the view direction. The\n  // near plane clips out objects in front of the plane; the far plane\n  // clips out objects behind the plane. This way only what is drawn\n  // between the planes is actually rendered.\n  aRenderer->ResetCameraClippingRange();\n\n  // interact with data\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Medical/MedicalDemo3/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MedicalDemo3)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MedicalDemo3: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MedicalDemo3 MACOSX_BUNDLE MedicalDemo3.cxx )\n  target_link_libraries(MedicalDemo3 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MedicalDemo3\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Medical/MedicalDemo3/#download-and-build-medicaldemo3","title":"Download and Build MedicalDemo3","text":"

Click here to download MedicalDemo3 and its CMakeLists.txt file. Once the tarball MedicalDemo3.tar has been downloaded and extracted,

cd MedicalDemo3/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MedicalDemo3\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Medical/MedicalDemo4/","title":"MedicalDemo4","text":"

vtk-examples/Cxx/Medical/MedicalDemo4

"},{"location":"Cxx/Medical/MedicalDemo4/#description","title":"Description","text":"

Volume rendering of the dataset.

Usage

MedicalDemo4 FullHead.mhd

Note

This original source code for this example is here.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Medical/MedicalDemo4/#code","title":"Code","text":"

MedicalDemo4.cxx

// Derived from VTK/Examples/Cxx/Medical4.cxx\n// This example reads a volume dataset and displays it via volume rendering.\n//\n\n#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkFixedPointVolumeRayCastMapper.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVolume.h>\n#include <vtkVolumeProperty.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \"file.mhd e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the renderer, the render window, and the interactor. The renderer\n  // draws into the render window, the interactor enables mouse- and\n  // keyboard-based interaction with the scene.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // The following reader is used to read a series of 2D slices (images)\n  // that compose the volume. The slice dimensions are set, and the\n  // pixel spacing. The data Endianness must also be specified. The reader\n  // uses the FilePrefix in combination with the slice number to construct\n  // filenames using the format FilePrefix.%d. (In this case the FilePrefix\n  // is the root name of the file: quarter.)\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // The volume will be displayed by ray-cast alpha compositing.\n  // A ray-cast mapper is needed to do the ray-casting.\n  vtkNew<vtkFixedPointVolumeRayCastMapper> volumeMapper;\n  volumeMapper->SetInputConnection(reader->GetOutputPort());\n\n  // The color transfer function maps voxel intensities to colors.\n  // It is modality-specific, and often anatomy-specific as well.\n  // The goal is to one color for flesh (between 500 and 1000)\n  // and another color for bone (1150 and over).\n  vtkNew<vtkColorTransferFunction> volumeColor;\n  volumeColor->AddRGBPoint(0, 0.0, 0.0, 0.0);\n  volumeColor->AddRGBPoint(500, 240.0 / 255.0, 184.0 / 255.0, 160.0 / 255.0);\n  volumeColor->AddRGBPoint(1000, 240.0 / 255.0, 184.0 / 255.0, 160.0 / 255.0);\n  volumeColor->AddRGBPoint(1150, 1.0, 1.0, 240.0 / 255.0); // Ivory\n\n  // The opacity transfer function is used to control the opacity\n  // of different tissue types.\n  vtkNew<vtkPiecewiseFunction> volumeScalarOpacity;\n  volumeScalarOpacity->AddPoint(0, 0.00);\n  volumeScalarOpacity->AddPoint(500, 0.15);\n  volumeScalarOpacity->AddPoint(1000, 0.15);\n  volumeScalarOpacity->AddPoint(1150, 0.85);\n\n  // The gradient opacity function is used to decrease the opacity\n  // in the \"flat\" regions of the volume while maintaining the opacity\n  // at the boundaries between tissue types. The gradient is measured\n  // as the amount by which the intensity changes over unit distance.\n  // For most medical data, the unit distance is 1mm.\n  vtkNew<vtkPiecewiseFunction> volumeGradientOpacity;\n  volumeGradientOpacity->AddPoint(0, 0.0);\n  volumeGradientOpacity->AddPoint(90, 0.5);\n  volumeGradientOpacity->AddPoint(100, 1.0);\n\n  // The VolumeProperty attaches the color and opacity functions to the\n  // volume, and sets other volume properties. The interpolation should\n  // be set to linear to do a high-quality rendering. The ShadeOn option\n  // turns on directional lighting, which will usually enhance the\n  // appearance of the volume and make it look more \"3D\". However,\n  // the quality of the shading depends on how accurately the gradient\n  // of the volume can be calculated, and for noisy data the gradient\n  // estimation will be very poor. The impact of the shading can be\n  // decreased by increasing the Ambient coefficient while decreasing\n  // the Diffuse and Specular coefficient. To increase the impact\n  // of shading, decrease the Ambient and increase the Diffuse and Specular.\n  vtkNew<vtkVolumeProperty> volumeProperty;\n  volumeProperty->SetColor(volumeColor);\n  volumeProperty->SetScalarOpacity(volumeScalarOpacity);\n  volumeProperty->SetGradientOpacity(volumeGradientOpacity);\n  volumeProperty->SetInterpolationTypeToLinear();\n  volumeProperty->ShadeOn();\n  volumeProperty->SetAmbient(0.4);\n  volumeProperty->SetDiffuse(0.6);\n  volumeProperty->SetSpecular(0.2);\n\n  // The vtkVolume is a vtkProp3D (like a vtkActor) and controls the position\n  // and orientation of the volume in world coordinates.\n  vtkNew<vtkVolume> volume;\n  volume->SetMapper(volumeMapper);\n  volume->SetProperty(volumeProperty);\n\n  // Finally, add the volume to the renderer\n  ren->AddViewProp(volume);\n\n  // Set up an initial view of the volume. The focal point will be the\n  // center of the volume, and the camera position will be 400mm to the\n  // patient's left (which is our right).\n  vtkCamera* camera = ren->GetActiveCamera();\n  double* c = volume->GetCenter();\n  camera->SetViewUp(0, 0, -1);\n  camera->SetPosition(c[0], c[1] - 400, c[2]);\n  camera->SetFocalPoint(c[0], c[1], c[2]);\n  camera->Azimuth(30.0);\n  camera->Elevation(30.0);\n\n  // Set a background color for the renderer\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Increase the size of the render window\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"MedicalDemo4\");\n\n  // Interact with the data.\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Medical/MedicalDemo4/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MedicalDemo4)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolume\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MedicalDemo4: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MedicalDemo4 MACOSX_BUNDLE MedicalDemo4.cxx )\n  target_link_libraries(MedicalDemo4 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MedicalDemo4\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Medical/MedicalDemo4/#download-and-build-medicaldemo4","title":"Download and Build MedicalDemo4","text":"

Click here to download MedicalDemo4 and its CMakeLists.txt file. Once the tarball MedicalDemo4.tar has been downloaded and extracted,

cd MedicalDemo4/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MedicalDemo4\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Medical/TissueLens/","title":"TissueLens","text":"

vtk-examples/Cxx/Medical/TissueLens

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Medical/TissueLens/#description","title":"Description","text":"

This example uses two vtkClipDataSet filters to achieve a \"tissue lens\" effect. First, a vtkSphere implicit function is used to clip a spherical hole in the isosurface extracted with vtkFlyingEdges3D or vtkMarchingCubes. Then a geometric [vtkSphere](https://www.vtk.org/doc/nightly/html/classvtkSphere.html#details)Source samples the original volume data using a vtkProbeFilter. vtkClipDataSet uses the resulting scalar point data to clip the sphere surface with the isosurface value.

Usage

TissueLens FullHead.mhd

Note

The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Medical/TissueLens/#code","title":"Code","text":"

TissueLens.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipDataSet.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphere.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> skinColor{{240, 184, 160, 255}};\n  colors->SetColor(\"SkinColor\", skinColor.data());\n  std::array<unsigned char, 4> backColor{{255, 229, 200, 255}};\n  colors->SetColor(\"BackfaceColor\", backColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the volume data.\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // An isosurface, or contour value of 500 is known to correspond to the\n  // skin of the patient.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> skinExtractor;\n#else\n  vtkNew<vtkMarchingCubes> skinExtractor;\n#endif\n  skinExtractor->SetInputConnection(reader->GetOutputPort());\n  skinExtractor->SetValue(0, 500);\n\n  // Define a spherical clip function to clip the isosurface.\n  vtkNew<vtkSphere> clipFunction;\n  clipFunction->SetRadius(50);\n  clipFunction->SetCenter(73, 52, 15);\n\n  // Clip the isosurface with a sphere.\n  vtkNew<vtkClipDataSet> skinClip;\n  skinClip->SetInputConnection(skinExtractor->GetOutputPort());\n  skinClip->SetClipFunction(clipFunction);\n  skinClip->SetValue(0);\n  skinClip->GenerateClipScalarsOn();\n  skinClip->Update();\n\n  vtkNew<vtkDataSetMapper> skinMapper;\n  skinMapper->SetInputConnection(skinClip->GetOutputPort());\n  skinMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> skin;\n  skin->SetMapper(skinMapper);\n  skin->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"SkinColor\").GetData());\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"BackfaceColor\").GetData());\n  skin->SetBackfaceProperty(backProp);\n\n  // Define a model for the \"lens\". Its geometry matches the implicit\n  // sphere used to clip the isosurface.\n  vtkNew<vtkSphereSource> lensModel;\n  lensModel->SetRadius(50);\n  lensModel->SetCenter(73, 52, 15);\n  lensModel->SetPhiResolution(201);\n  lensModel->SetThetaResolution(101);\n\n  // Sample the input volume with the lens model geometry.\n  vtkNew<vtkProbeFilter> lensProbe;\n  lensProbe->SetInputConnection(lensModel->GetOutputPort());\n  lensProbe->SetSourceConnection(reader->GetOutputPort());\n\n  // Clip the lens data with the isosurface value.\n  vtkNew<vtkClipDataSet> lensClip;\n  lensClip->SetInputConnection(lensProbe->GetOutputPort());\n  lensClip->SetValue(500);\n  lensClip->GenerateClipScalarsOff();\n  lensClip->Update();\n\n  // Define a suitable grayscale lut.\n  vtkNew<vtkLookupTable> bwLut;\n  bwLut->SetTableRange(0, 2048);\n  bwLut->SetSaturationRange(0, 0);\n  bwLut->SetHueRange(0, 0);\n  bwLut->SetValueRange(0.2, 1);\n  bwLut->Build();\n\n  vtkNew<vtkDataSetMapper> lensMapper;\n  lensMapper->SetInputConnection(lensClip->GetOutputPort());\n  lensMapper->SetScalarRange(lensClip->GetOutput()->GetScalarRange());\n  lensMapper->SetLookupTable(bwLut);\n\n  vtkNew<vtkActor> lens;\n  lens->SetMapper(lensMapper);\n\n  // It is convenient to create an initial view of the data. The FocalPoint\n  // and Position form a vector direction. Later on (ResetCamera() method)\n  // this vector is used to position the camera to look at the data in\n  // this direction.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n\n  // Create the renderer, the render window, and the interactor. The renderer\n  // draws into the render window, the interactor enables mouse- and\n  // keyboard-based interaction with the data within the render window.\n  //\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Actors are added to the renderer. An initial camera view is created.\n  // The Dolly() method moves the camera towards the FocalPoint,\n  // thereby enlarging the image.\n  aRenderer->AddActor(lens);\n  aRenderer->AddActor(skin);\n  aRenderer->SetActiveCamera(aCamera);\n  aRenderer->ResetCamera();\n  aCamera->Dolly(1.5);\n\n  // Set a background color for the renderer and set the size of the\n  // render window (expressed in pixels).\n  aRenderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"TissueLens\");\n\n  // Note that when camera movement occurs (as it does in the Dolly()\n  // method), the clipping planes often need adjusting. Clipping planes\n  // consist of two planes: near and far along the view direction. The\n  // near plane clips out objects in front of the plane; the far plane\n  // clips out objects behind the plane. This way only what is drawn\n  // between the planes is actually rendered.\n  aRenderer->ResetCameraClippingRange();\n\n  // Initialize the event loop and then start it.\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Medical/TissueLens/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TissueLens)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TissueLens: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TissueLens MACOSX_BUNDLE TissueLens.cxx )\n  target_link_libraries(TissueLens PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TissueLens\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Medical/TissueLens/#download-and-build-tissuelens","title":"Download and Build TissueLens","text":"

Click here to download TissueLens and its CMakeLists.txt file. Once the tarball TissueLens.tar has been downloaded and extracted,

cd TissueLens/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TissueLens\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/AddCell/","title":"AddCell","text":"

vtk-examples/Cxx/Meshes/AddCell

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/AddCell/#code","title":"Code","text":"

AddCell.cxx

#include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkTriangle.h>\n\nint main(int, char*[])\n{\n  // Create a triangle\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n\n  vtkNew<vtkCellArray> triangles;\n  triangles->InsertNextCell(triangle);\n\n  // Create a polydata object\n  vtkNew<vtkPolyData> polyData;\n\n  // Add the geometry and topology to the polydata\n  polyData->SetPoints(points);\n  polyData->SetPolys(triangles);\n\n  std::cout << \"There are \" << polyData->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n\n  polyData->GetPolys()->InsertNextCell(triangle);\n\n  std::cout << \"There are \" << polyData->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/AddCell/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AddCell)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AddCell: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AddCell MACOSX_BUNDLE AddCell.cxx )\n  target_link_libraries(AddCell PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AddCell\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/AddCell/#download-and-build-addcell","title":"Download and Build AddCell","text":"

Click here to download AddCell and its CMakeLists.txt file. Once the tarball AddCell.tar has been downloaded and extracted,

cd AddCell/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AddCell\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/BoundaryEdges/","title":"BoundaryEdges","text":"

vtk-examples/Cxx/Meshes/BoundaryEdges

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/BoundaryEdges/#description","title":"Description","text":"

This filter will extract the boundary edges of a mesh. The original mesh is shown with the feature edges shown in red.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/BoundaryEdges/#code","title":"Code","text":"

BoundaryEdges.cxx

#include <vtkActor.h>\n#include <vtkDiskSource.h>\n#include <vtkFeatureEdges.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDiskSource> diskSource;\n  diskSource->Update();\n\n  vtkNew<vtkFeatureEdges> featureEdges;\n  featureEdges->SetInputConnection(diskSource->GetOutputPort());\n  featureEdges->BoundaryEdgesOn();\n  featureEdges->FeatureEdgesOff();\n  featureEdges->ManifoldEdgesOff();\n  featureEdges->NonManifoldEdgesOff();\n  featureEdges->ColoringOn();\n  featureEdges->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> edgeMapper;\n  edgeMapper->SetInputConnection(featureEdges->GetOutputPort());\n  edgeMapper->SetScalarModeToUseCellData();\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(edgeMapper);\n\n  vtkNew<vtkPolyDataMapper> diskMapper;\n  diskMapper->SetInputConnection(diskSource->GetOutputPort());\n  vtkNew<vtkActor> diskActor;\n  diskActor->SetMapper(diskMapper);\n  diskActor->GetProperty()->SetColor(colors->GetColor3d(\"Gray\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BoundaryEdges\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(edgeActor);\n  renderer->AddActor(diskActor);\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/BoundaryEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoundaryEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoundaryEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoundaryEdges MACOSX_BUNDLE BoundaryEdges.cxx )\n  target_link_libraries(BoundaryEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoundaryEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/BoundaryEdges/#download-and-build-boundaryedges","title":"Download and Build BoundaryEdges","text":"

Click here to download BoundaryEdges and its CMakeLists.txt file. Once the tarball BoundaryEdges.tar has been downloaded and extracted,

cd BoundaryEdges/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BoundaryEdges\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/CapClip/","title":"CapClip","text":"

vtk-examples/Cxx/Meshes/CapClip

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/CapClip/#description","title":"Description","text":"

This example shows how to generate a \"cap\" on a clipped vtkPolyData. After clipping with vtkClipPolyData, it uses a clever ''trick'' to convert polylines into polygons. If a polydata file is provided, it will cap it. Otherwise it caps a clipped sphere.

Warning

The clipping is done with a scalar field provided by vtkPlane and results may depend on the resolution of the input vtkPolyData.

Style

This example collects all of the color definition in the beginning of the example. This makes it easier to make changes to the colors without having to search the code.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/CapClip/#code","title":"Code","text":"

CapClip.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFeatureEdges.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkStripper.h>\n#include <vtkXMLPolyDataReader.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\n//\n// Demonstrate the use of clipping and capping on polyhedral data\n//\n\nint main(int argc, char* argv[])\n{\n  // Define colors\n  vtkNew<vtkNamedColors> colors;\n  auto backgroundColor = colors->GetColor3d(\"steel_blue\");\n  auto boundaryColor = colors->GetColor3d(\"banana\");\n  auto clipColor = colors->GetColor3d(\"tomato\");\n  // PolyData to process\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(polyData->GetCenter());\n  plane->SetNormal(1.0, -1.0, -1.0);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputData(polyData);\n  clipper->SetClipFunction(plane);\n  clipper->SetValue(0);\n  clipper->Update();\n\n  polyData = clipper->GetOutput();\n\n  vtkNew<vtkDataSetMapper> clipMapper;\n  clipMapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> clipActor;\n  clipActor->SetMapper(clipMapper);\n  clipActor->GetProperty()->SetDiffuseColor(clipColor.GetData());\n  clipActor->GetProperty()->SetInterpolationToFlat();\n  clipActor->GetProperty()->EdgeVisibilityOn();\n\n  // Now extract feature edges\n  vtkNew<vtkFeatureEdges> boundaryEdges;\n  boundaryEdges->SetInputData(polyData);\n  boundaryEdges->BoundaryEdgesOn();\n  boundaryEdges->FeatureEdgesOff();\n  boundaryEdges->NonManifoldEdgesOff();\n  boundaryEdges->ManifoldEdgesOff();\n\n  vtkNew<vtkStripper> boundaryStrips;\n  boundaryStrips->SetInputConnection(boundaryEdges->GetOutputPort());\n  boundaryStrips->Update();\n\n  // Change the polylines into polygons\n  vtkNew<vtkPolyData> boundaryPoly;\n  boundaryPoly->SetPoints(boundaryStrips->GetOutput()->GetPoints());\n  boundaryPoly->SetPolys(boundaryStrips->GetOutput()->GetLines());\n\n  vtkNew<vtkPolyDataMapper> boundaryMapper;\n  boundaryMapper->SetInputData(boundaryPoly);\n\n  vtkNew<vtkActor> boundaryActor;\n  boundaryActor->SetMapper(boundaryMapper);\n  boundaryActor->GetProperty()->SetDiffuseColor(boundaryColor.GetData());\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer->AddActor(clipActor);\n  renderer->AddActor(boundaryActor);\n\n  // Generate an interesting view\n  //\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.2);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"CapClip\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Meshes/CapClip/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CapClip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CapClip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CapClip MACOSX_BUNDLE CapClip.cxx )\n  target_link_libraries(CapClip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CapClip\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/CapClip/#download-and-build-capclip","title":"Download and Build CapClip","text":"

Click here to download CapClip and its CMakeLists.txt file. Once the tarball CapClip.tar has been downloaded and extracted,

cd CapClip/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CapClip\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/CellEdges/","title":"CellEdges","text":"

vtk-examples/Cxx/Meshes/CellEdges

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/CellEdges/#code","title":"Code","text":"

CellEdges.cxx

#include <vtkIdList.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkTriangle.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPoints()->SetPoint(0, 1.0, 0.0, 0.0);\n  triangle->GetPoints()->SetPoint(1, 0.0, 0.0, 0.0);\n  triangle->GetPoints()->SetPoint(2, 0.0, 1.0, 0.0);\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n\n  std::cout << \"The cell has \" << triangle->GetNumberOfEdges() << \" edges.\"\n            << std::endl;\n\n  for (vtkIdType i = 0; i < triangle->GetNumberOfEdges(); i++)\n  {\n    vtkCell* edge = triangle->GetEdge(i);\n\n    vtkIdList* pointIdList = edge->GetPointIds();\n    std::cout << \"Edge \" << i << \" has \" << pointIdList->GetNumberOfIds()\n              << \" points.\" << std::endl;\n\n    for (vtkIdType p = 0; p < pointIdList->GetNumberOfIds(); p++)\n    {\n      std::cout << \"Edge \" << i << \" uses point \" << pointIdList->GetId(p)\n                << std::endl;\n    }\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/CellEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellEdges)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellEdges MACOSX_BUNDLE CellEdges.cxx )\n  target_link_libraries(CellEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/CellEdges/#download-and-build-celledges","title":"Download and Build CellEdges","text":"

Click here to download CellEdges and its CMakeLists.txt file. Once the tarball CellEdges.tar has been downloaded and extracted,

cd CellEdges/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellEdges\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/ClipClosedSurface/","title":"ClipClosedSurface","text":"

vtk-examples/Cxx/Meshes/ClipClosedSurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/ClipClosedSurface/#code","title":"Code","text":"

ClipClosedSurface.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipClosedSurface.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPlaneCollection.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n//\n// Demonstrate the use of clipping of polygonal data\n//\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // PolyData to process\n  vtkSmartPointer<vtkPolyData> polyData;\n\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Create a sphere\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(20);\n    sphereSource->SetPhiResolution(11);\n    sphereSource->Update();\n\n    polyData = sphereSource->GetOutput();\n  }\n\n  auto center = polyData->GetCenter();\n  vtkNew<vtkPlane> plane1;\n  plane1->SetOrigin(center[0], center[1], center[2]);\n  plane1->SetNormal(0.0, -1.0, 0.0);\n  vtkNew<vtkPlane> plane2;\n  plane2->SetOrigin(center[0], center[1], center[2]);\n  plane2->SetNormal(0.0, 0.0, 1.0);\n  vtkNew<vtkPlane> plane3;\n  plane3->SetOrigin(center[0], center[1], center[2]);\n  plane3->SetNormal(-1.0, 0.0, 0.0);\n\n  vtkNew<vtkPlaneCollection> planes;\n  planes->AddItem(plane1);\n  planes->AddItem(plane2);\n  planes->AddItem(plane3);\n\n  vtkNew<vtkClipClosedSurface> clipper;\n  clipper->SetInputData(polyData);\n  clipper->SetClippingPlanes(planes);\n  clipper->SetActivePlaneId(2);\n  clipper->SetScalarModeToColors();\n  clipper->SetClipColor(colors->GetColor3d(\"Banana\").GetData());\n  clipper->SetBaseColor(colors->GetColor3d(\"Tomato\").GetData());\n  clipper->SetActivePlaneColor(colors->GetColor3d(\"SandyBrown\").GetData());\n\n  vtkNew<vtkDataSetMapper> clipMapper;\n  clipMapper->SetInputConnection(clipper->GetOutputPort());\n\n  vtkNew<vtkActor> clipActor;\n  clipActor->SetMapper(clipMapper);\n  clipActor->GetProperty()->SetColor(1.0000, 0.3882, 0.2784);\n  clipActor->GetProperty()->SetInterpolationToFlat();\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"ClipClosedSurface\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(clipActor);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/ClipClosedSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipClosedSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipClosedSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipClosedSurface MACOSX_BUNDLE ClipClosedSurface.cxx )\n  target_link_libraries(ClipClosedSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipClosedSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/ClipClosedSurface/#download-and-build-clipclosedsurface","title":"Download and Build ClipClosedSurface","text":"

Click here to download ClipClosedSurface and its CMakeLists.txt file. Once the tarball ClipClosedSurface.tar has been downloaded and extracted,

cd ClipClosedSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClipClosedSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/ClipDataSetWithPolyData/","title":"ClipDataSetWithPolyData","text":"

vtk-examples/Cxx/Meshes/ClipDataSetWithPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/ClipDataSetWithPolyData/#description","title":"Description","text":"

The example that shows how to use the vtkClipDataSet to clip a vtkRectilinearGrid with an arbitrary polydata. vtkImplicitPolyDataDistance is used to turn the polydata into an implicit function. Every point of the grid is evaluated before sending to vtkClipDataSet. This example uses a vtkConeSource to generate polydata to use, however any polydata could be used, including stl files.

The left part of the image shows the inside clip and the distance field on a center slice. The right side shows the outside clip. When the program exits using the \"e: key, the example will report the cell type for both the inside and outside clips.

Note

This example was translated to C++ from the Python example ClipDataSetWithPolyData1.

Note

vtkClipDataSet tetrahedralizes the volume before clipping. Contrast this with the vtkTableBasedClipDataSet example: TableBasedClipDataSetWithPolyData.

Here is the summary reported when the example exits:

The clipped dataset(inside) contains a vtkUnstructuredGrid that has 49514 cells Cell type vtkTetra occurs 41034 times. Cell type vtkWedge occurs 8480 times.

The clipped dataset(outside) contains a vtkUnstructuredGrid that has 714434 cells Cell type vtkTetra occurs 705090 times. Cell type vtkWedge occurs 9344 times.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/ClipDataSetWithPolyData/#code","title":"Code","text":"

ClipDataSetWithPolyData.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellTypes.h>\n#include <vtkClipDataSet.h>\n#include <vtkConeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFloatArray.h>\n#include <vtkImplicitPolyDataDistance.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRectilinearGridGeometryFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <map>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create polydata to slice the grid with. In this case, use a cone. This\n  // could be any polydata including an stl file.\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(50);\n  cone->SetDirection(0, 0, -1);\n  cone->SetHeight(3.0);\n  cone->CappingOn();\n  cone->Update();\n\n  // Implicit function that will be used to slice the mesh.\n  vtkNew<vtkImplicitPolyDataDistance> implicitPolyDataDistance;\n  implicitPolyDataDistance->SetInput(cone->GetOutput());\n\n  // Create a grid\n  unsigned int dimension = 51;\n  vtkNew<vtkFloatArray> xCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    xCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  vtkNew<vtkFloatArray> yCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    yCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  vtkNew<vtkFloatArray> zCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    zCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  // The coordinates are assigned to the rectilinear grid. Make sure that\n  // the number of values in each of the XCoordinates, YCoordinates,\n  // and ZCoordinates is equal to what is defined in SetDimensions().\n  vtkNew<vtkRectilinearGrid> rgrid;\n  rgrid->SetDimensions(xCoords->GetNumberOfTuples(),\n                       yCoords->GetNumberOfTuples(),\n                       zCoords->GetNumberOfTuples());\n  rgrid->SetXCoordinates(xCoords);\n  rgrid->SetYCoordinates(yCoords);\n  rgrid->SetZCoordinates(zCoords);\n\n  // Create an array to hold distance information.\n  vtkNew<vtkFloatArray> signedDistances;\n  signedDistances->SetNumberOfComponents(1);\n  signedDistances->SetName(\"SignedDistances\");\n\n  // Evaluate the signed distance function at all of the grid points.\n  for (vtkIdType pointId = 0; pointId < rgrid->GetNumberOfPoints(); ++pointId)\n  {\n    double p[3];\n    rgrid->GetPoint(pointId, p);\n    double signedDistance = implicitPolyDataDistance->EvaluateFunction(p);\n    signedDistances->InsertNextValue(signedDistance);\n  }\n\n  // Add the SignedDistances to the grid.\n  rgrid->GetPointData()->SetScalars(signedDistances);\n\n  // Use vtkClipDataSet to slice the grid with the polydata.\n  vtkNew<vtkClipDataSet> clipper;\n  clipper->SetInputData(rgrid);\n  clipper->InsideOutOn();\n  clipper->SetValue(0.0);\n  clipper->GenerateClippedOutputOff();\n  clipper->Update();\n\n  // For some reason we cannot use:\n  /*\n   vtkNew<vtkClipDataSet> clipper;\n   clipper->SetInputData(rgrid);\n   clipper->InsideOutOn();\n   clipper->SetValue(0.0);\n   clipper->GenerateClippedOutputOn();\n   clipper->Update();\n  */\n\n  // So we define a new clipper for the outside clip.\n  vtkNew<vtkClipDataSet> clipper1;\n  clipper1->SetInputData(rgrid);\n  clipper1->InsideOutOff();\n  clipper1->SetValue(0.0);\n  clipper1->GenerateClippedOutputOff();\n  clipper1->Update();\n\n  // --- mappers, actors, render, etc. ---\n  // Mapper and actor to view the cone.\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n\n  // Geometry filter to view the background grid.\n  vtkNew<vtkRectilinearGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputData(rgrid);\n  geometryFilter->SetExtent(0, dimension, 0, dimension, dimension / 2,\n                            dimension / 2);\n  geometryFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> rgridMapper;\n  rgridMapper->SetInputConnection(geometryFilter->GetOutputPort());\n  rgridMapper->SetScalarRange(\n      rgrid->GetPointData()->GetArray(\"SignedDistances\")->GetRange());\n\n  vtkNew<vtkActor> wireActor;\n  wireActor->SetMapper(rgridMapper);\n  wireActor->GetProperty()->SetRepresentationToWireframe();\n\n  // Mapper and actor to view the clipped mesh.\n  vtkNew<vtkDataSetMapper> clipperMapper;\n  clipperMapper->SetInputConnection(clipper->GetOutputPort());\n  clipperMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkDataSetMapper> clipperOutsideMapper;\n  // clipperOutsideMapper->SetInputConnection(clipper->GetOutputPort(1));\n  clipperOutsideMapper->SetInputConnection(clipper1->GetOutputPort());\n  clipperOutsideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clipperActor;\n  clipperActor->SetMapper(clipperMapper);\n  clipperActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> clipperOutsideActor;\n  clipperOutsideActor->SetMapper(clipperOutsideMapper);\n  clipperOutsideActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  // A renderer and render window.\n  // Create a renderer, render window, and interactor.\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  // Add the actors.\n  leftRenderer->AddActor(wireActor);\n  leftRenderer->AddActor(clipperActor);\n  rightRenderer->AddActor(clipperOutsideActor);\n\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->SetSize(640, 480);\n  renwin->AddRenderer(leftRenderer);\n  renwin->AddRenderer(rightRenderer);\n  renwin->SetWindowName(\"ClipDataSetWithPolyData\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renwin);\n\n  // Share the camera.\n\n  leftRenderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  leftRenderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  leftRenderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  leftRenderer->GetActiveCamera()->Azimuth(30);\n  leftRenderer->GetActiveCamera()->Elevation(30);\n  leftRenderer->ResetCamera();\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  renwin->Render();\n  interactor->Start();\n\n  // Generate a report.\n  vtkIdType numberOfCells = clipper->GetOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset(inside) contains a \" << std::endl\n            << clipper->GetOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> CellContainer;\n  CellContainer cellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    cellMap[clipper->GetOutput()->GetCellType(i)]++;\n  }\n\n  CellContainer::const_iterator it = cellMap.begin();\n  while (it != cellMap.end())\n  {\n    std::cout << \"\\tCell type \"\n              << vtkCellTypes::GetClassNameFromTypeId(it->first) << \" occurs \"\n              << it->second << \" times.\" << std::endl;\n    ++it;\n  }\n\n  numberOfCells = clipper1->GetOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset(outside) contains a \" << std::endl\n            << clipper1->GetOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> OutsideCellContainer;\n  CellContainer outsideCellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    outsideCellMap[clipper1->GetOutput()->GetCellType(i)]++;\n  }\n\n  it = outsideCellMap.begin();\n  while (it != outsideCellMap.end())\n  {\n    std::cout << \"\\tCell type \"\n              << vtkCellTypes::GetClassNameFromTypeId(it->first) << \" occurs \"\n              << it->second << \" times.\" << std::endl;\n    ++it;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/ClipDataSetWithPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipDataSetWithPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipDataSetWithPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipDataSetWithPolyData MACOSX_BUNDLE ClipDataSetWithPolyData.cxx )\n  target_link_libraries(ClipDataSetWithPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipDataSetWithPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/ClipDataSetWithPolyData/#download-and-build-clipdatasetwithpolydata","title":"Download and Build ClipDataSetWithPolyData","text":"

Click here to download ClipDataSetWithPolyData and its CMakeLists.txt file. Once the tarball ClipDataSetWithPolyData.tar has been downloaded and extracted,

cd ClipDataSetWithPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClipDataSetWithPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/ClipFrustum/","title":"ClipFrustum","text":"

vtk-examples/Cxx/Meshes/ClipFrustum

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/ClipFrustum/#description","title":"Description","text":"

The example uses vtkClipPolyData to clip a model with a vtkCamera's view frustum. The frustum is displayed using vtkFrustumSource.

The example proceeds as follow:

  1. Read a vtkPolyData. The example can read any of the supported polydata readers.
  2. Generates a view of the model.
  3. Recovers the view frustum of the current vtkCamera.
  4. Creates an implicit function using vtkPlanes::SetFrustumPlanes.
  5. Passes the vtkPlanes to vtkFrustumSource.
  6. Passes the vtkPlanes to vtkClipPolyData as the ClipFunction.
  7. Tells vtkClipPolyData to generate vtkPolyData for inside and outside.
  8. Presents the frustum, and clipped models. The inside model is red and the outside model is gold.

Bug

The first attempt to write the example used vtkClipConvexPolyData, but that filter has bugs and only works with one plane.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/ClipFrustum/#code","title":"Code","text":"

ClipFrustum.cxx

#include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkFrustumSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPlanes.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  renderer->AddActor(actor);\n\n  vtkNew<vtkPolyDataMapper> outMapper;\n  outMapper->SetInputData(polyData);\n  outMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> outActor;\n  outActor->SetMapper(outMapper);\n  outActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Gold\").GetData());\n  outActor->GetProperty()->SetSpecular(.6);\n  outActor->GetProperty()->SetSpecularPower(30);\n\n  // Position the camera so that we can see the frustum.\n  double viewUp[3] = {0.0, 1.0, 0.0};\n  double position[3] = {1.0, 0.0, 0.0};\n  PositionCamera(renderer, viewUp, position);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->SetViewAngle(10.0);\n\n  double planesArray[24];\n  renderer->GetActiveCamera()->GetFrustumPlanes(1.0, planesArray);\n\n  vtkNew<vtkPlanes> planes;\n  planes->SetFrustumPlanes(planesArray);\n\n  vtkNew<vtkFrustumSource> frustumSource;\n  frustumSource->ShowLinesOff();\n  frustumSource->SetPlanes(planes);\n  frustumSource->Update();\n\n  vtkNew<vtkPolyDataMapper> frustumMapper;\n  frustumMapper->SetInputConnection(frustumSource->GetOutputPort());\n\n  vtkNew<vtkActor> frustumActor;\n  frustumActor->SetMapper(frustumMapper);\n  frustumActor->GetProperty()->EdgeVisibilityOn();\n  frustumActor->GetProperty()->SetOpacity(.5);\n  frustumActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkClipPolyData> clip;\n  clip->SetInputData(polyData);\n  clip->SetClipFunction(planes);\n  clip->InsideOutOn();\n  clip->GenerateClippedOutputOn();\n  clip->Update();\n\n  mapper->SetInputConnection(clip->GetOutputPort());\n  outMapper->SetInputData(clip->GetClippedOutput());\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->AddActor(frustumActor);\n  renderer->AddActor(outActor);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ClipFrustum\");\n\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position)\n{\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  renderer->GetActiveCamera()->SetViewUp(viewUp);\n  renderer->GetActiveCamera()->SetPosition(position);\n  renderer->ResetCamera();\n  return;\n}\n} // namespace\n
"},{"location":"Cxx/Meshes/ClipFrustum/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipFrustum)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipFrustum: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipFrustum MACOSX_BUNDLE ClipFrustum.cxx )\n  target_link_libraries(ClipFrustum PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipFrustum\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/ClipFrustum/#download-and-build-clipfrustum","title":"Download and Build ClipFrustum","text":"

Click here to download ClipFrustum and its CMakeLists.txt file. Once the tarball ClipFrustum.tar has been downloaded and extracted,

cd ClipFrustum/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClipFrustum\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/ColoredElevationMap/","title":"ColoredElevationMap","text":"

vtk-examples/Cxx/Meshes/ColoredElevationMap

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/ColoredElevationMap/#code","title":"Code","text":"

ColoredElevationMap.cxx

#include <vtkActor.h>\n#include <vtkDelaunay2D.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iomanip>\n#include <iostream>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a grid of points (height/terrian map).\n  vtkNew<vtkPoints> points;\n\n  unsigned int GridSize = 20;\n  double xx, yy, zz;\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775586); // For testing\n  for (unsigned int x = 0; x < GridSize; x++)\n  {\n    for (unsigned int y = 0; y < GridSize; y++)\n    {\n      rng->Next();\n      xx = x + rng->GetRangeValue(-0.2, 0.2);\n      rng->Next();\n      yy = y + rng->GetRangeValue(-0.2, 0.2);\n      rng->Next();\n      zz = rng->GetRangeValue(-0.5, 0.5);\n      points->InsertNextPoint(xx, yy, zz);\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> inputPolyData;\n  inputPolyData->SetPoints(points);\n\n  // Triangulate the grid points.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(inputPolyData);\n  delaunay->Update();\n  vtkPolyData* outputPolyData = delaunay->GetOutput();\n\n  double bounds[6];\n  outputPolyData->GetBounds(bounds);\n\n  // Find min and max z.\n  double minz = bounds[4];\n  double maxz = bounds[5];\n\n  std::cout.precision(3);\n  std::cout << \"minz: \" << std::right << std::setw(6) << minz << std::endl;\n  std::cout << \"maxz: \" << std::right << std::setw(6) << maxz << std::endl;\n  std::cout.precision(0);\n\n  // Create the color map.\n  vtkNew<vtkLookupTable> colorLookupTable;\n  colorLookupTable->SetTableRange(minz, maxz);\n  colorLookupTable->Build();\n\n  // Generate the colors for each point based on the color map.\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n\n  std::cout << \"There are \" << outputPolyData->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout.precision(6);\n  std::cout << std::fixed;\n  for (int i = 0; i < outputPolyData->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    outputPolyData->GetPoint(i, p);\n\n    double dcolor[3];\n    colorLookupTable->GetColor(p[2], dcolor);\n    // std::cout << \"dcolor: \" << std::right << std::setw(8) << dcolor[0] << \" \"\n    //          << std::right << std::setw(8)<< dcolor[1] << \" \"\n    //          << std::right << std::setw(8) << dcolor[2]\n    //          << std::endl;\n    unsigned char color[3];\n    for (unsigned int j = 0; j < 3; j++)\n    {\n      color[j] = static_cast<unsigned char>(255.0 * dcolor[j]);\n    }\n    // std::cout << \"color:  \" << std::right << std::setw(8) << (int)color[0]\n    //          << \" \" << std::right << std::setw(8) << (int)color[1] << \" \"\n    //          << std::right << std::setw(8)\n    //          << (int)color[2] << std::endl;\n\n    colors->InsertNextTupleValue(color);\n  }\n  std::cout.precision(0);\n\n  outputPolyData->GetPointData()->SetScalars(colors);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(outputPolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"ColoredElevationMap\");\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/ColoredElevationMap/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColoredElevationMap)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColoredElevationMap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColoredElevationMap MACOSX_BUNDLE ColoredElevationMap.cxx )\n  target_link_libraries(ColoredElevationMap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColoredElevationMap\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/ColoredElevationMap/#download-and-build-coloredelevationmap","title":"Download and Build ColoredElevationMap","text":"

Click here to download ColoredElevationMap and its CMakeLists.txt file. Once the tarball ColoredElevationMap.tar has been downloaded and extracted,

cd ColoredElevationMap/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColoredElevationMap\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/Decimation/","title":"Decimation","text":"

vtk-examples/Cxx/Meshes/Decimation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/Decimation/#description","title":"Description","text":"

This example decimates a mesh using progressive decimation. The SetTargetReduction function specifies how many triangles should reduced by specifying the percentage (0,1) of triangles to be removed. For example, if the mesh contains 100 triangles and SetTargetReduction(.90) is called, after the decimation there will be approximately 10 triangles - a 90% reduction.

The implementation of vtkDecimatePro is similar to the algorithm originally described in \"Decimation of Triangle Meshes\", Proc Siggraph `92, with three major differences. First, this algorithm does not necessarily preserve the topology of the mesh. Second, it is guaranteed to give the a mesh reduction factor specified by the user (as long as certain constraints are not set - see Caveats). Third, it is set up generate progressive meshes, that is a stream of operations that can be easily transmitted and incrementally updated (see Hugues Hoppe's Siggraph '96 paper on progressive meshes).

Seealso

QuadricClustering and QuadricDecimation.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/Decimation/#code","title":"Code","text":"

Decimation.cxx

#include <vtkCamera.h>\n#include <vtkDecimatePro.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    vtkNew<vtkTriangleFilter> triangles;\n    triangles->SetInputConnection(reader->GetOutputPort());\n    triangles->Update();\n    inputPolyData = triangles->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(30);\n    sphereSource->SetPhiResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  float reduction = 0.9; // 90% reduction\n  if (argc > 2)\n  {\n    reduction = atof(argv[2]);\n  }\n  vtkNew<vtkNamedColors> colors;\n  std::cout << \"Before decimation\" << std::endl << \"------------\" << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n\n  vtkNew<vtkDecimatePro> decimate;\n  decimate->SetInputData(inputPolyData);\n  decimate->SetTargetReduction(reduction);\n  decimate->PreserveTopologyOn();\n  decimate->Update();\n\n  vtkNew<vtkPolyData> decimated;\n  decimated->ShallowCopy(decimate->GetOutput());\n\n  std::cout << \"After decimation\" << std::endl << \"------------\" << std::endl;\n\n  std::cout << \"There are \" << decimated->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << decimated->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n  std::cout << \"Reduction: \"\n            << static_cast<double>((inputPolyData->GetNumberOfPolys() -\n                                    decimated->GetNumberOfPolys())) /\n          static_cast<double>(inputPolyData->GetNumberOfPolys())\n            << std::endl;\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputData(inputPolyData);\n\n  vtkNew<vtkProperty> backFace;\n  backFace->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetInterpolationToFlat();\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  inputActor->SetBackfaceProperty(backFace);\n\n  vtkNew<vtkPolyDataMapper> decimatedMapper;\n  decimatedMapper->SetInputData(decimated);\n\n  vtkNew<vtkActor> decimatedActor;\n  decimatedActor->SetMapper(decimatedMapper);\n  decimatedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  decimatedActor->GetProperty()->SetInterpolationToFlat();\n  decimatedActor->SetBackfaceProperty(backFace);\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"Decimation\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Add the sphere to the left and the cube to the right\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(decimatedActor);\n\n  // Shared camera\n  // Shared camera looking down the -y axis\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, -1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Elevation(30);\n  camera->Azimuth(30);\n\n  leftRenderer->SetActiveCamera(camera);\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->ResetCamera();\n  leftRenderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/Decimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Decimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Decimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Decimation MACOSX_BUNDLE Decimation.cxx )\n  target_link_libraries(Decimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Decimation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/Decimation/#download-and-build-decimation","title":"Download and Build Decimation","text":"

Click here to download Decimation and its CMakeLists.txt file. Once the tarball Decimation.tar has been downloaded and extracted,

cd Decimation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Decimation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/DeformPointSet/","title":"DeformPointSet","text":"

vtk-examples/Cxx/Meshes/DeformPointSet

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/DeformPointSet/#description","title":"Description","text":"

Deform a point set with a polyhedra. Supply a .vtp file and see it deformed.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/DeformPointSet/#code","title":"Code","text":"

DeformPointSet.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDeformPointSet.h>\n#include <vtkElevationFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyData> input;\n  double bounds[6];\n\n  if (argc == 1)\n  {\n    // Create a sphere to warp\n    vtkNew<vtkSphereSource> sphere;\n    sphere->SetThetaResolution(51);\n    sphere->SetPhiResolution(17);\n    sphere->Update();\n    sphere->GetOutput()->GetBounds(bounds);\n\n    // Generate some scalars on the polydata\n    vtkNew<vtkElevationFilter> ele;\n    ele->SetInputConnection(sphere->GetOutputPort());\n    ele->SetLowPoint(0, 0, -0.5);\n    ele->SetHighPoint(0, 0, 0.5);\n    ele->SetLowPoint((bounds[1] + bounds[0]) / 2.0,\n                     (bounds[3] + bounds[2]) / 2.0, -bounds[5]);\n    ele->SetHighPoint((bounds[1] + bounds[0]) / 2.0,\n                      (bounds[3] + bounds[2]) / 2.0, bounds[5]);\n    ele->Update();\n    input->ShallowCopy(ele->GetOutput());\n  }\n  else\n  {\n    std::string inputFilename = argv[1];\n\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(inputFilename.c_str());\n    reader->Update();\n\n    input->ShallowCopy(reader->GetOutput());\n    input->GetBounds(bounds);\n  }\n\n  // Now create a control mesh, in this case a octagon that encloses\n  // the point set\n  vtkNew<vtkPoints> pts;\n  pts->SetNumberOfPoints(6);\n  pts->SetPoint(0, bounds[0] - .1 * (bounds[1] - bounds[0]),\n                (bounds[3] + bounds[2]) / 2.0, (bounds[5] + bounds[4]) / 2.0);\n  pts->SetPoint(1, bounds[1] + .1 * (bounds[1] - bounds[0]),\n                (bounds[3] + bounds[2]) / 2.0, (bounds[5] + bounds[4]) / 2.0);\n  pts->SetPoint(2, (bounds[1] + bounds[0]) / 2.0,\n                bounds[2] - .1 * (bounds[3] - bounds[2]),\n                (bounds[5] + bounds[4]) / 2.0);\n  pts->SetPoint(3, (bounds[1] + bounds[0]) / 2.0,\n                bounds[3] + .1 * (bounds[3] - bounds[2]),\n                (bounds[5] + bounds[4]) / 2.0);\n  pts->SetPoint(4, (bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0,\n                bounds[4] - .1 * (bounds[5] - bounds[4]));\n  pts->SetPoint(5, (bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0,\n                bounds[5] + .1 * (bounds[5] - bounds[4]));\n\n  vtkNew<vtkCellArray> tris;\n  // clang-format off\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(2); tris->InsertCellPoint(0);  tris->InsertCellPoint(4);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(1); tris->InsertCellPoint(2);  tris->InsertCellPoint(4);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(3);  tris->InsertCellPoint(1);  tris->InsertCellPoint(4);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(0);  tris->InsertCellPoint(3);  tris->InsertCellPoint(4);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(0);  tris->InsertCellPoint(2);  tris->InsertCellPoint(5);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(2);  tris->InsertCellPoint(1);  tris->InsertCellPoint(5);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(1); tris->InsertCellPoint(3);  tris->InsertCellPoint(5);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(3);  tris->InsertCellPoint(0);  tris->InsertCellPoint(5);\n  // clang-format on\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(pts);\n  pd->SetPolys(tris);\n\n  // Display the control mesh\n  vtkNew<vtkPolyDataMapper> meshMapper;\n  meshMapper->SetInputData(pd);\n  vtkNew<vtkActor> meshActor;\n  meshActor->SetMapper(meshMapper);\n  meshActor->GetProperty()->SetRepresentationToWireframe();\n  meshActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Do the intitial weight generation\n  vtkNew<vtkDeformPointSet> deform;\n  deform->SetInputData(input);\n  deform->SetControlMeshData(pd);\n  deform->Update(); // this creates the initial weights\n\n  // Now move one point and deform\n  double controlPoint[3];\n  pts->GetPoint(5, controlPoint);\n  pts->SetPoint(5, controlPoint[0], controlPoint[1],\n                bounds[5] + .8 * (bounds[5] - bounds[4]));\n  pts->Modified();\n\n  // Display the warped polydata\n  vtkNew<vtkPolyDataMapper> polyMapper;\n  polyMapper->SetInputConnection(deform->GetOutputPort());\n  vtkNew<vtkActor> polyActor;\n  polyActor->SetMapper(polyMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(polyActor);\n  renderer->AddActor(meshActor);\n\n  renderer->GetActiveCamera()->SetPosition(1, 1, 1);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"DeformPointSet\");\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/DeformPointSet/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DeformPointSet)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DeformPointSet: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DeformPointSet MACOSX_BUNDLE DeformPointSet.cxx )\n  target_link_libraries(DeformPointSet PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DeformPointSet\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/DeformPointSet/#download-and-build-deformpointset","title":"Download and Build DeformPointSet","text":"

Click here to download DeformPointSet and its CMakeLists.txt file. Once the tarball DeformPointSet.tar has been downloaded and extracted,

cd DeformPointSet/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DeformPointSet\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/ElevationFilter/","title":"ElevationFilter","text":"

vtk-examples/Cxx/Meshes/ElevationFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/ElevationFilter/#code","title":"Code","text":"

ElevationFilter.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDelaunay2D.h>\n#include <vtkElevationFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataWriter.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a grid of points (height/terrain map)\n  vtkNew<vtkPoints> points;\n\n  unsigned int gridSize = 10;\n  for (unsigned int x = 0; x < gridSize; x++)\n  {\n    for (unsigned int y = 0; y < gridSize; y++)\n    {\n      points->InsertNextPoint(x, y, (x + y) / (y + 1));\n    }\n  }\n\n  double bounds[6];\n  points->GetBounds(bounds);\n\n  // Add the grid points to a polydata object\n  vtkNew<vtkPolyData> inputPolyData;\n  inputPolyData->SetPoints(points);\n\n  // Triangulate the grid points\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(inputPolyData);\n  delaunay->Update();\n\n  vtkNew<vtkElevationFilter> elevationFilter;\n  elevationFilter->SetInputConnection(delaunay->GetOutputPort());\n  elevationFilter->SetLowPoint(0.0, 0.0, bounds[4]);\n  elevationFilter->SetHighPoint(0.0, 0.0, bounds[5]);\n  elevationFilter->Update();\n\n  vtkNew<vtkPolyData> output;\n  output->ShallowCopy(dynamic_cast<vtkPolyData*>(elevationFilter->GetOutput()));\n\n  vtkFloatArray* elevation = dynamic_cast<vtkFloatArray*>(\n      output->GetPointData()->GetArray(\"Elevation\"));\n\n  // Create the color map\n  vtkNew<vtkLookupTable> colorLookupTable;\n  colorLookupTable->SetTableRange(bounds[4], bounds[5]);\n  colorLookupTable->Build();\n\n  // Generate the colors for each point based on the color map\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n\n  for (vtkIdType i = 0; i < output->GetNumberOfPoints(); i++)\n  {\n    double val = elevation->GetValue(i);\n    // std::cout << \"val: \" << val << std::endl;\n\n    double dcolor[3];\n    colorLookupTable->GetColor(val, dcolor);\n    // std::cout << \"dcolor: \" << dcolor[0] << \" \" << dcolor[1] << \" \" <<\n    // dcolor[2] << std::endl;\n    unsigned char color[3];\n    for (unsigned int j = 0; j < 3; j++)\n    {\n      color[j] = 255 * dcolor[j] / 1.0;\n    }\n    // std::cout << \"color: \" << (int)color[0] << \" \" << (int)color[1] << \" \" <<\n    // (int)color[2] << std::endl;\n\n    colors->InsertNextTupleValue(color);\n  }\n\n  output->GetPointData()->AddArray(colors);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(output);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ElevationFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"ForestGreen\").GetData());\n\n  // z-axis points upwards and y-axis is lower right edge.\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-13.3586, 20.7305, 22.5147);\n  camera->SetFocalPoint(4.5, 4.5, 4.5);\n  camera->SetViewUp(0.506199, -0.328212, 0.797521);\n  camera->SetDistance(30.1146);\n  camera->SetClippingRange(14.3196, 50.0698);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/ElevationFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ElevationFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ElevationFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ElevationFilter MACOSX_BUNDLE ElevationFilter.cxx )\n  target_link_libraries(ElevationFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ElevationFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/ElevationFilter/#download-and-build-elevationfilter","title":"Download and Build ElevationFilter","text":"

Click here to download ElevationFilter and its CMakeLists.txt file. Once the tarball ElevationFilter.tar has been downloaded and extracted,

cd ElevationFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ElevationFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/ExtractEdges/","title":"ExtractEdges","text":"

vtk-examples/Cxx/Meshes/ExtractEdges

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/ExtractEdges/#description","title":"Description","text":"

This example shows how to extract the edges from a PolyData. In this case, we convert a sphere into a wireframe sphere. We demonstrate how to traverse the resulting edges.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/ExtractEdges/#code","title":"Code","text":"

ExtractEdges.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkExtractEdges.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"Sphere\" << endl << \"----------\" << endl;\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfCells()\n            << \" cells.\" << std::endl;\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfPoints()\n            << \" points.\" << std::endl;\n\n  vtkNew<vtkExtractEdges> extractEdges;\n  extractEdges->SetInputConnection(sphereSource->GetOutputPort());\n  extractEdges->Update();\n\n  vtkCellArray* lines = extractEdges->GetOutput()->GetLines();\n  vtkPoints* points = extractEdges->GetOutput()->GetPoints();\n\n  std::cout << std::endl << \"Edges\" << endl << \"----------\" << std::endl;\n  std::cout << \"There are \" << lines->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n  std::cout << \"There are \" << points->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  // Traverse all of the edges.\n  for (vtkIdType i = 0; i < extractEdges->GetOutput()->GetNumberOfCells(); i++)\n  {\n    // std::cout << \"Type: \" <<\n    // extractEdges->GetOutput()->GetCell(i)->GetClassName() << std::endl;\n    auto line = dynamic_cast<vtkLine*>(extractEdges->GetOutput()->GetCell(i));\n    std::cout << \"Line \" << i << \" : \" << *line << std::endl;\n  }\n\n  // Visualize the edges.\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(extractEdges->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ExtractEdges\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/ExtractEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractEdges MACOSX_BUNDLE ExtractEdges.cxx )\n  target_link_libraries(ExtractEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/ExtractEdges/#download-and-build-extractedges","title":"Download and Build ExtractEdges","text":"

Click here to download ExtractEdges and its CMakeLists.txt file. Once the tarball ExtractEdges.tar has been downloaded and extracted,

cd ExtractEdges/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractEdges\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/FillHoles/","title":"FillHoles","text":"

vtk-examples/Cxx/Meshes/FillHoles

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/FillHoles/#description","title":"Description","text":"

This filter finds holes in a mesh and closes them.

Seealso

IdentifyHoles fills the holes and then identifies each hole.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/FillHoles/#code","title":"Code","text":"

FillHoles.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkExtractSelection.h>\n#include <vtkFillHolesFilter.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInformation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto input = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkFillHolesFilter> fillHolesFilter;\n  fillHolesFilter->SetInputData(input);\n  fillHolesFilter->SetHoleSize(100000.0);\n  fillHolesFilter->Update();\n\n  // Make the triangle winding order consistent\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(fillHolesFilter->GetOutput());\n  normals->ConsistencyOn();\n  normals->SplittingOff();\n  normals->Update();\n\n#if 0\n  // Restore the original normals\n  normals->GetOutput()->GetPointData()->\n    SetNormals(input->GetPointData()->GetNormals());\n#endif\n  // Visualize\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputData(input);\n\n  vtkNew<vtkProperty> backfaceProp;\n  backfaceProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->SetBackfaceProperty(backfaceProp);\n  originalActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  vtkNew<vtkPolyDataMapper> filledMapper;\n  filledMapper->SetInputData(fillHolesFilter->GetOutput());\n\n  vtkNew<vtkActor> filledActor;\n  filledActor->SetMapper(filledMapper);\n  filledActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  filledActor->SetBackfaceProperty(backfaceProp);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"FillHoles\");\n\n  renderWindow->AddRenderer(leftRenderer);\n  renderWindow->AddRenderer(rightRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  leftRenderer->AddActor(originalActor);\n  rightRenderer->AddActor(filledActor);\n  leftRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  leftRenderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  leftRenderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  leftRenderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  leftRenderer->GetActiveCamera()->Azimuth(30);\n  leftRenderer->GetActiveCamera()->Elevation(30);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Share the camera.\n\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n  // Render and interact.\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nvoid GenerateData(vtkPolyData* input)\n{\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Remove some cells.\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  // Set values.\n  ids->InsertNextValue(2);\n  ids->InsertNextValue(10);\n\n  vtkNew<vtkSelectionNode> selectionNode;\n  selectionNode->SetFieldType(vtkSelectionNode::CELL);\n  selectionNode->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode->SetSelectionList(ids);\n  selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(),\n                                      1); // invert the selection\n\n  vtkNew<vtkSelection> selection;\n  selection->AddNode(selectionNode);\n\n  vtkNew<vtkExtractSelection> extractSelection;\n  extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n  extractSelection->SetInputData(1, selection);\n  extractSelection->Update();\n\n  // In selection\n  vtkNew<vtkDataSetSurfaceFilter> surfaceFilter;\n  surfaceFilter->SetInputConnection(extractSelection->GetOutputPort());\n  surfaceFilter->Update();\n\n  input->ShallowCopy(surfaceFilter->GetOutput());\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Meshes/FillHoles/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FillHoles)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersGeometry\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FillHoles: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FillHoles MACOSX_BUNDLE FillHoles.cxx )\n  target_link_libraries(FillHoles PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FillHoles\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/FillHoles/#download-and-build-fillholes","title":"Download and Build FillHoles","text":"

Click here to download FillHoles and its CMakeLists.txt file. Once the tarball FillHoles.tar has been downloaded and extracted,

cd FillHoles/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FillHoles\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/FitToHeightMap/","title":"FitToHeightMap","text":"

vtk-examples/Cxx/Meshes/FitToHeightMap

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/FitToHeightMap/#description","title":"Description","text":"

This example uses vtkFitToHeightMapFilter to cover a height map with vtkPolyData generated by a vtkPlaneSource. The plane's origin, point1 and point2 are calculated from the DEM's bounding box. The z coordinate of each parameter is set to the height of the DEM. With this plane, the example uses vtkProbeFilter to apply the scalar elevation data from the DEM.

vtkWarpScalar is used to \"elevate\" the DEM mesh. Once the planes are draped over the warped DEM mesh, they are displayed side-by-side using the same vtkLookupTable.

The displayed meshes are original (left), point fit (middle) and cell fit (right).

Note

DEM files for the United States are available here.

Info

This example requires vtk version 8.2 or newer.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/FitToHeightMap/#code","title":"Code","text":"

FitToHeightMap.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDEMReader.h>\n#include <vtkFitToHeightMapFilter.h>\n#include <vtkImageData.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkWarpScalar.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.dem e.g. SainteHelens.dem\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Create the RenderWindow, Renderer\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren0;\n  ren0->SetViewport(0, 0, 1.0 / 3.0, 1);\n  ren0->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1);\n  ren1->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> ren2;\n  ren2->SetViewport(2.0 / 3.0, 0, 1, 1);\n  ren2->SetBackground(colors->GetColor3d(\"Tan\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1200, 400);\n  renderWindow->AddRenderer(ren0);\n  renderWindow->AddRenderer(ren1);\n  renderWindow->AddRenderer(ren2);\n  renderWindow->SetWindowName(\"FitToHeightMap\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Create pipeline. Load terrain data.\n  //\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.6, 0);\n  lut->SetSaturationRange(1.0, 0);\n  lut->SetValueRange(0.5, 1.0);\n\n  // Read the data: a height field results\n  vtkNew<vtkDEMReader> demReader;\n  demReader->SetFileName(argv[1]);\n  demReader->Update(); // Update so we can get bounds\n\n  vtkNew<vtkImageDataGeometryFilter> surface;\n  surface->SetInputConnection(demReader->GetOutputPort());\n\n  // Warp the surface in the vertical direction\n  vtkNew<vtkWarpScalar> warp;\n  warp->SetInputConnection(surface->GetOutputPort());\n  warp->SetScaleFactor(1);\n  warp->UseNormalOn();\n  warp->SetNormal(0, 0, 1);\n  warp->Update();\n\n  // Show the terrain\n  double lo = demReader->GetOutput()->GetScalarRange()[0];\n  double hi = demReader->GetOutput()->GetScalarRange()[1];\n\n  vtkNew<vtkPolyDataMapper> demMapper;\n  demMapper->SetInputConnection(warp->GetOutputPort());\n  demMapper->ScalarVisibilityOn();\n  demMapper->SetScalarRange(lo, hi);\n  demMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> demActor;\n  demActor->SetMapper(demMapper);\n\n  // Create polygon(s) to fit. z-values should be height of DEM\n  // to accomodate ProbeFilter\n  double zLevel = demReader->GetOutput()->GetBounds()[5];\n  double* demBounds;\n  demBounds = demReader->GetOutput()->GetBounds();\n\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetOrigin(demBounds[0], demBounds[2], zLevel);\n  plane->SetPoint1(demBounds[1], demBounds[2], zLevel);\n  plane->SetPoint2(demBounds[0], demBounds[3], zLevel);\n  plane->SetResolution(128, 128);\n  plane->Update();\n\n  // Get the scalrs from the DEM\n  vtkNew<vtkProbeFilter> probeDem;\n  probeDem->SetSourceData(demReader->GetOutput());\n  probeDem->SetInputConnection(plane->GetOutputPort());\n  probeDem->Update();\n\n  // Fit polygons to surface using two strategies\n  // Both will share the same lookup tables\n  vtkNew<vtkFitToHeightMapFilter> pointFit;\n  pointFit->SetInputConnection(probeDem->GetOutputPort());\n  pointFit->SetHeightMapConnection(demReader->GetOutputPort());\n  pointFit->SetFittingStrategyToPointProjection();\n  pointFit->UseHeightMapOffsetOn();\n\n  vtkNew<vtkPolyDataMapper> pointMapper;\n  pointMapper->SetInputConnection(pointFit->GetOutputPort());\n  pointMapper->ScalarVisibilityOn();\n  pointMapper->SetScalarRange(lo, hi);\n  pointMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n\n  // Fit polygons to surface (cell strategy)\n  vtkNew<vtkFitToHeightMapFilter> cellFit;\n  cellFit->SetInputConnection(probeDem->GetOutputPort());\n  cellFit->SetHeightMapConnection(demReader->GetOutputPort());\n  cellFit->SetFittingStrategyToCellAverageHeight();\n  cellFit->UseHeightMapOffsetOn();\n\n  vtkNew<vtkPolyDataMapper> cellMapper;\n  cellMapper->SetInputConnection(cellFit->GetOutputPort());\n  cellMapper->ScalarVisibilityOn();\n  cellMapper->SetScalarRange(lo, hi);\n  cellMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> cellActor;\n  cellActor->SetMapper(cellMapper);\n\n  // Render the three representations\n  ren0->AddActor(demActor);\n  ren1->AddActor(pointActor);\n  ren2->AddActor(cellActor);\n\n  // Look down the x axis\n  ren0->GetActiveCamera()->SetPosition(1, 0, 0);\n  ren0->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  ren0->GetActiveCamera()->SetViewUp(0, 0, 1);\n  ren0->ResetCamera();\n\n  // Rotate to an oblique view\n  ren0->GetActiveCamera()->Azimuth(30.0);\n  ren0->GetActiveCamera()->Elevation(60.0);\n\n  // Share the cameras\n  ren1->SetActiveCamera(ren0->GetActiveCamera());\n  ren2->SetActiveCamera(ren0->GetActiveCamera());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/FitToHeightMap/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FitToHeightMap)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  FiltersModeling\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FitToHeightMap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FitToHeightMap MACOSX_BUNDLE FitToHeightMap.cxx )\n  target_link_libraries(FitToHeightMap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FitToHeightMap\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/FitToHeightMap/#download-and-build-fittoheightmap","title":"Download and Build FitToHeightMap","text":"

Click here to download FitToHeightMap and its CMakeLists.txt file. Once the tarball FitToHeightMap.tar has been downloaded and extracted,

cd FitToHeightMap/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FitToHeightMap\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/IdentifyHoles/","title":"IdentifyHoles","text":"

vtk-examples/Cxx/Meshes/IdentifyHoles

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/IdentifyHoles/#description","title":"Description","text":"

This example fills the holes in a mesh and then extracts the filled holes as seprate regions.

The example proceeds as follow:

  1. Read the polydata.
  2. Fill the holes with vtkFillHolesFilter.
  3. Create a new polydata that contains the filled holes. To do this we rely on the fact that the fill holes filter stores the original cells first and then adds the new cells that fill the holes. Using vtkCellIterator, we skip the original cells and then continue iterating to obtain the new cells.
  4. Use vtkConnectivityFilter on the filled polydata to identify the individual holes.

Note

We have to use vtkConnectivtyFilter and not vtkPolyDataConnectivityFilter since the later does not create RegionIds cell data.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/IdentifyHoles/#code","title":"Code","text":"

IdentifyHoles.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkConnectivityFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFillHolesFilter.h>\n#include <vtkGenericCell.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cout << \"Usgae: \" << argv[0] << \" file.vtp e.g. Torso.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Fill the holes\n  vtkNew<vtkFillHolesFilter> fillHoles;\n  fillHoles->SetInputConnection(reader->GetOutputPort());\n  fillHoles->SetHoleSize(1000.0);\n\n  // Make the triangle winding order consistent\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(fillHoles->GetOutputPort());\n  normals->ConsistencyOn();\n  normals->SplittingOff();\n  normals->Update();\n  normals->GetOutput()->GetPointData()->SetNormals(\n      reader->GetOutput()->GetPointData()->GetNormals());\n\n  // How many added cells\n  vtkIdType numOriginalCells = reader->GetOutput()->GetNumberOfCells();\n  vtkIdType numNewCells = normals->GetOutput()->GetNumberOfCells();\n\n  // Iterate over the original cells\n  auto it = normals->GetOutput()->NewCellIterator();\n  vtkIdType numCells = 0;\n  for (it->InitTraversal();\n       !it->IsDoneWithTraversal() && numCells < numOriginalCells;\n       it->GoToNextCell(), ++numCells)\n  {\n  }\n  std::cout << \"Num original: \" << numOriginalCells\n            << \", Num new: \" << numNewCells\n            << \", Num added: \" << numNewCells - numOriginalCells << std::endl;\n  vtkNew<vtkPolyData> holePolyData;\n  holePolyData->Allocate(normals->GetOutput(), numNewCells - numOriginalCells);\n  holePolyData->SetPoints(normals->GetOutput()->GetPoints());\n\n  vtkNew<vtkGenericCell> cell;\n\n  // The remaining cells are the new ones from the hole filler\n  for (; !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    it->GetCell(cell);\n    holePolyData->InsertNextCell(it->GetCellType(), cell->GetPointIds());\n  }\n  it->Delete();\n\n  // We have to use ConnectivtyFilter and not\n  // PolyDataConnectivityFilter since the later does not create\n  // RegionIds cell data.\n  vtkNew<vtkConnectivityFilter> connectivity;\n  connectivity->SetInputData(holePolyData);\n  connectivity->SetExtractionModeToAllRegions();\n  connectivity->ColorRegionsOn();\n  connectivity->Update();\n  std::cout << \"Found \" << connectivity->GetNumberOfExtractedRegions()\n            << \" holes\" << std::endl;\n\n  // Visualize\n\n  // Create a mapper and actor for the fill polydata\n  vtkNew<vtkDataSetMapper> filledMapper;\n  filledMapper->SetInputConnection(connectivity->GetOutputPort());\n  filledMapper->SetScalarModeToUseCellData();\n  filledMapper->SetScalarRange(connectivity->GetOutput()\n                                   ->GetCellData()\n                                   ->GetArray(\"RegionId\")\n                                   ->GetRange());\n  vtkNew<vtkActor> filledActor;\n  filledActor->SetMapper(filledMapper);\n  filledActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a mapper and actor for the original polydata\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkProperty> backfaceProp;\n  backfaceProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->SetBackfaceProperty(backfaceProp);\n  originalActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Flesh\").GetData());\n  originalActor->GetProperty()->SetRepresentationToWireframe();\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(512, 512);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"IdentifyHoles\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(originalActor);\n  renderer->AddActor(filledActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  renderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->GetActiveCamera()->Azimuth(60);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n  // Render and interact\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/IdentifyHoles/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IdentifyHoles)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IdentifyHoles: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IdentifyHoles MACOSX_BUNDLE IdentifyHoles.cxx )\n  target_link_libraries(IdentifyHoles PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IdentifyHoles\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/IdentifyHoles/#download-and-build-identifyholes","title":"Download and Build IdentifyHoles","text":"

Click here to download IdentifyHoles and its CMakeLists.txt file. Once the tarball IdentifyHoles.tar has been downloaded and extracted,

cd IdentifyHoles/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IdentifyHoles\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/InterpolateFieldDataDemo/","title":"InterpolateFieldDataDemo","text":"

vtk-examples/Cxx/Meshes/InterpolateFieldDataDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/InterpolateFieldDataDemo/#description","title":"Description","text":"

This example uses vtkPointInterpolator probe a high resolution dataset with a lower resolution dataset. Then, using vtkInterpolateDataSetAttributes, interpolate between the original low resolution data and the probed, low resolution data.

Warning

For the vtkPointInterpolator, point arrays will not be interpolated unless PassPointArrays is off. vtkPointInterpolator does not interpolate vtkFieldData. To interpolate vtkFieldData it must be added as the active scalar.

Warning

vtkInterpolateDataSetAttibutes does not interpolate vtkFieldData. To interpolate vtkFieldData it must be added as the active scalar.

Thanks

This example was inspired by Andrew E. Slaughter, Idaho National Laboratory.

Note

In Windows, testing using coarseGrid.e will fail. It seems that this file has UTF-8 characters in it.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/InterpolateFieldDataDemo/#code","title":"Code","text":"

InterpolateFieldDataDemo.cxx

// This example was derived a python script created by Andrew E. Slaughter\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCompositeDataGeometryFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExodusIIReader.h>\n#include <vtkGaussianKernel.h>\n#include <vtkInterpolateDataSetAttributes.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPointInterpolator.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStaticPointLocator.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int argc, char* argv[])\n{\n  std::string variable = \"u\";\n  double range[2] = {0, 10};\n\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" coarseMesh fineMesh e.g. coarseGrid.e fineGrid.e-s002\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string file0 = argv[1];\n  std::string file1 = argv[2];\n\n  ///////////////////////////////////////////////////////////////////////////\n  // FILE 0: COARSE MESH WITH SOLUTION 0\n  vtkNew<vtkExodusIIReader> coarseReader;\n  coarseReader->SetFileName(file0.c_str());\n  coarseReader->UpdateInformation();\n  coarseReader->SetTimeStep(0);\n  coarseReader->SetAllArrayStatus(vtkExodusIIReader::NODAL, 1);\n  coarseReader->Update();\n\n  vtkNew<vtkCompositeDataGeometryFilter> coarseGeometry;\n  coarseGeometry->SetInputConnection(0, coarseReader->GetOutputPort(0));\n  coarseGeometry->Update();\n\n  vtkNew<vtkPolyDataMapper> coarseMapper;\n  coarseMapper->SetInputConnection(coarseGeometry->GetOutputPort());\n  coarseMapper->SelectColorArray(variable.c_str());\n  coarseMapper->SetScalarModeToUsePointFieldData();\n  coarseMapper->InterpolateScalarsBeforeMappingOn();\n  coarseMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> coarseActor;\n  coarseActor->SetMapper(coarseMapper);\n  coarseActor->GetProperty()->SetEdgeVisibility(true);\n\n  vtkNew<vtkRenderer> coarseRenderer;\n  coarseRenderer->AddViewProp(coarseActor);\n\n  /////////////////////////////////////////////////////////////////////\n  // FILE 1: FINE MESH WITH SOLUTION 1\n\n  vtkNew<vtkExodusIIReader> fineReader;\n  fineReader->SetFileName(file1.c_str());\n  fineReader->UpdateInformation();\n  fineReader->SetTimeStep(0);\n  fineReader->SetAllArrayStatus(vtkExodusIIReader::NODAL, 1);\n  fineReader->Update();\n\n  vtkNew<vtkCompositeDataGeometryFilter> fineGeometry;\n  fineGeometry->SetInputConnection(0, fineReader->GetOutputPort(0));\n  fineGeometry->Update();\n  fineGeometry->GetOutput()->GetPointData()->SetActiveScalars(variable.c_str());\n\n  vtkNew<vtkPolyDataMapper> fineGeometryMapper;\n  fineGeometryMapper->SetInputConnection(fineGeometry->GetOutputPort());\n  fineGeometryMapper->SelectColorArray(variable.c_str());\n  fineGeometryMapper->SetScalarModeToUsePointFieldData();\n  fineGeometryMapper->InterpolateScalarsBeforeMappingOn();\n  fineGeometryMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> fineGeometryActor;\n  fineGeometryActor->SetMapper(fineGeometryMapper);\n  fineGeometryActor->GetProperty()->SetEdgeVisibility(true);\n\n  vtkNew<vtkRenderer> fineGeometryRenderer;\n  fineGeometryRenderer->AddViewProp(fineGeometryActor);\n\n  //////////////////////////////////////////////////////////////////////\n  // PROJECT SOLUTION FROM FILE 0 to GRID FROM FILE 1\n\n  // Build the structure to interpolate onto\n  vtkSmartPointer<vtkUnstructuredGrid>\n      coarseInterpolatedGrid = // output to be interpolated on to\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n\n  vtkMultiBlockDataSet* coarseMultiBlock = dynamic_cast<vtkMultiBlockDataSet*>(\n      coarseReader->GetOutput()->GetBlock(0));\n  coarseInterpolatedGrid->DeepCopy(\n      dynamic_cast<vtkUnstructuredGrid*>(coarseMultiBlock->GetBlock(0)));\n\n  vtkNew<vtkStaticPointLocator> locator;\n  locator->SetDataSet(fineGeometry->GetOutput());\n  locator->BuildLocator();\n\n  vtkNew<vtkGaussianKernel> kernel;\n  kernel->SetSharpness(4);\n  kernel->SetKernelFootprintToNClosest();\n  kernel->SetNumberOfPoints(10);\n  kernel->SetSharpness(4.0);\n\n  // Probe the fine geometry with the course geometry.\n  // NOTE: The point arrays will not be interpolated unless PassPointArrays is\n  // off.\n  vtkNew<vtkPointInterpolator> coarseInterpolator;\n  coarseInterpolator->SetSourceData(\n      fineGeometry->GetOutput()); // Pc data set to be probed by input points P\n  coarseInterpolator->SetInputData(coarseGeometry->GetOutput());\n  coarseInterpolator->SetKernel(kernel);\n  coarseInterpolator->SetLocator(locator);\n  coarseInterpolator->SetNullPointsStrategyToClosestPoint();\n  coarseInterpolator->PassPointArraysOff();\n  coarseInterpolator->Update();\n\n  vtkNew<vtkDataSetMapper> coarseInterpolatorMapper;\n  coarseInterpolatorMapper->SetInputConnection(\n      coarseInterpolator->GetOutputPort());\n  coarseInterpolatorMapper->SelectColorArray(variable.c_str());\n  coarseInterpolatorMapper->SetScalarModeToUsePointFieldData();\n  coarseInterpolatorMapper->InterpolateScalarsBeforeMappingOn();\n  coarseInterpolatorMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> coarseInterpolatorActor;\n  coarseInterpolatorActor->SetMapper(coarseInterpolatorMapper);\n  coarseInterpolatorActor->GetProperty()->SetEdgeVisibility(true);\n\n  vtkNew<vtkRenderer> coarseInterpolatorRenderer;\n  coarseInterpolatorRenderer->AddActor(coarseInterpolatorActor);\n\n  // Set the active scalar for the two inputs.\n  // NOTE: InterpolateDataSetAttibutes does not interpolate field data.\n  // To interpolate field data it must be added as the active scalar\n  coarseInterpolatedGrid->GetPointData()->SetActiveScalars(variable.c_str());\n  coarseInterpolator->GetOutput()->GetPointData()->SetActiveScalars(\n      variable.c_str());\n\n  vtkNew<vtkInterpolateDataSetAttributes> coarseInterpolateAttributes;\n  coarseInterpolateAttributes->AddInputData(0, coarseInterpolatedGrid);\n  coarseInterpolateAttributes->AddInputData(0, coarseInterpolator->GetOutput());\n  coarseInterpolateAttributes->SetT(0.5);\n  coarseInterpolateAttributes->Update();\n\n  vtkNew<vtkDataSetMapper> coarseInterpolateAttibutesMapper;\n  coarseInterpolateAttibutesMapper->SetInputConnection(\n      coarseInterpolateAttributes->GetOutputPort());\n  coarseInterpolateAttibutesMapper->SelectColorArray(variable.c_str());\n  coarseInterpolateAttibutesMapper->SetScalarModeToUsePointFieldData();\n  coarseInterpolateAttibutesMapper->InterpolateScalarsBeforeMappingOn();\n  coarseInterpolateAttibutesMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> coarseInterpolateAttributesActor;\n  coarseInterpolateAttributesActor->SetMapper(coarseInterpolateAttibutesMapper);\n  coarseInterpolateAttributesActor->GetProperty()->SetEdgeVisibility(true);\n\n  vtkNew<vtkRenderer> coarseInterpolateAttributesRenderer;\n  coarseInterpolateAttributesRenderer->AddActor(\n      coarseInterpolateAttributesActor);\n\n  /////////////////////////\n  //  Window and Interactor\n\n  vtkNew<vtkRenderWindow> window;\n\n  // Use the same camera for each renderer\n  fineGeometryRenderer->SetActiveCamera(coarseRenderer->GetActiveCamera());\n  coarseInterpolatorRenderer->SetActiveCamera(\n      coarseRenderer->GetActiveCamera());\n  coarseInterpolateAttributesRenderer->SetActiveCamera(\n      coarseRenderer->GetActiveCamera());\n\n  // Set each renderer color\n  vtkNew<vtkNamedColors> colors;\n  coarseRenderer->SetBackground(colors->GetColor3d(\"Gainsboro\").GetData());\n  coarseInterpolatorRenderer->SetBackground(\n      colors->GetColor3d(\"LightGrey\").GetData());\n  coarseInterpolateAttributesRenderer->SetBackground(\n      colors->GetColor3d(\"Silver\").GetData());\n  fineGeometryRenderer->SetBackground(colors->GetColor3d(\"DarkGray\").GetData());\n\n  // Set the viewport for each renderer\n  coarseRenderer->SetViewport(0, 0, 0.25, 1);\n  coarseInterpolatorRenderer->SetViewport(0.25, 0, 0.5, 1);\n  coarseInterpolateAttributesRenderer->SetViewport(0.5, 0, 0.75, 1);\n  fineGeometryRenderer->SetViewport(0.75, 0, 1, 1);\n\n  // Add the renderers\n  window->AddRenderer(coarseRenderer);             // low res\n  window->AddRenderer(coarseInterpolatorRenderer); // interpolated geometry\n  window->AddRenderer(\n      coarseInterpolateAttributesRenderer);  // interpolated attributes\n  window->AddRenderer(fineGeometryRenderer); // hi res with point data\n\n  // The size the window to hold 4 viewports of width 320\n  window->SetSize(1280, 320);\n  window->SetWindowName(\"InterpolateFieldDataDemo\");\n\n  // Create the interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n  window->Render();\n  interactor->Initialize();\n\n  // Reset the camera to a default view, shared by all\n  coarseRenderer->ResetCamera();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/InterpolateFieldDataDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InterpolateFieldDataDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersGeometry\n  FiltersPoints\n  IOExodus\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InterpolateFieldDataDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InterpolateFieldDataDemo MACOSX_BUNDLE InterpolateFieldDataDemo.cxx )\n  target_link_libraries(InterpolateFieldDataDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InterpolateFieldDataDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/InterpolateFieldDataDemo/#download-and-build-interpolatefielddatademo","title":"Download and Build InterpolateFieldDataDemo","text":"

Click here to download InterpolateFieldDataDemo and its CMakeLists.txt file. Once the tarball InterpolateFieldDataDemo.tar has been downloaded and extracted,

cd InterpolateFieldDataDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./InterpolateFieldDataDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/MatrixMathFilter/","title":"MatrixMathFilter","text":"

vtk-examples/Cxx/Meshes/MatrixMathFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/MatrixMathFilter/#code","title":"Code","text":"

MatrixMathFilter.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkMatrixMathFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGridReader.h>\n#include <vtkXMLPolyDataWriter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cerr << \"Required arguments: vtkFile e.g. tensors.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  std::cout << \"filename: \" << filename << std::endl;\n\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkDataSetSurfaceFilter> surfaceFilter;\n  surfaceFilter->SetInputConnection(reader->GetOutputPort());\n  surfaceFilter->Update();\n\n  vtkNew<vtkMatrixMathFilter> matrixMathFilter;\n  // matrixMathFilter->SetOperationToDeterminant();\n  matrixMathFilter->SetOperationToEigenvalue();\n  matrixMathFilter->SetInputConnection(surfaceFilter->GetOutputPort());\n  matrixMathFilter->Update();\n  matrixMathFilter->GetOutput()->GetPointData()->SetActiveScalars(\"Eigenvalue\");\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetInputConnection(matrixMathFilter->GetOutputPort());\n  writer->SetFileName(\"output.vtp\");\n  writer->Write();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(matrixMathFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MatrixMathFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n  renderer->GetActiveCamera()->Azimuth(45);\n  renderer->GetActiveCamera()->Pitch(-22.5);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(0.95);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/MatrixMathFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MatrixMathFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  FiltersVerdict\n  IOLegacy\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MatrixMathFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MatrixMathFilter MACOSX_BUNDLE MatrixMathFilter.cxx )\n  target_link_libraries(MatrixMathFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MatrixMathFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/MatrixMathFilter/#download-and-build-matrixmathfilter","title":"Download and Build MatrixMathFilter","text":"

Click here to download MatrixMathFilter and its CMakeLists.txt file. Once the tarball MatrixMathFilter.tar has been downloaded and extracted,

cd MatrixMathFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MatrixMathFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/OBBDicer/","title":"OBBDicer","text":"

vtk-examples/Cxx/Meshes/OBBDicer

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/OBBDicer/#description","title":"Description","text":"

The vtkOBBDicer filter breaks up an input mesh into a number of pieces. The resulting mesh contains scalar point data that can be used to extract the individual pieces with a filter like vtkThresholdFilter. This examples displays the output of vtkOBBDicer with a different color for each piece.

The first argument is a filename for a vtkPolyData reader. If not specified, then a vtkSphereSource generates the vtkPolyData. The second argument is the number of pieces and is optional. The default is 4.

The example was run with these arguments:

   OBBDicer Armadill0 20\n

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/OBBDicer/#code","title":"Code","text":"

OBBDicer.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBDicer.h>\n#include <vtkOutlineCornerFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <random>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  int pieces = 4;\n  if (argc > 2)\n  {\n    pieces = std::atoi(argv[2]);\n  }\n\n  auto inputPolyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  // Create pipeline\n  vtkNew<vtkOBBDicer> dicer;\n  dicer->SetInputData(inputPolyData);\n  dicer->SetNumberOfPieces(pieces);\n  dicer->SetDiceModeToSpecifiedNumberOfPieces();\n  dicer->Update();\n\n  int numberOfRegions = dicer->GetNumberOfActualPieces();\n\n  // Fill in a few known colors, the rest will be generated if needed\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(std::max(numberOfRegions, 10));\n  lut->Build();\n  lut->SetTableValue(0, colors->GetColor4d(\"Gold\").GetData());\n  lut->SetTableValue(1, colors->GetColor4d(\"Banana\").GetData());\n  lut->SetTableValue(2, colors->GetColor4d(\"Tomato\").GetData());\n  lut->SetTableValue(3, colors->GetColor4d(\"Wheat\").GetData());\n  lut->SetTableValue(4, colors->GetColor4d(\"Lavender\").GetData());\n  lut->SetTableValue(5, colors->GetColor4d(\"Flesh\").GetData());\n  lut->SetTableValue(6, colors->GetColor4d(\"Raspberry\").GetData());\n  lut->SetTableValue(7, colors->GetColor4d(\"Salmon\").GetData());\n  lut->SetTableValue(8, colors->GetColor4d(\"Mint\").GetData());\n  lut->SetTableValue(9, colors->GetColor4d(\"Peacock\").GetData());\n\n  // If the number of regions is larger than the number of specified colors,\n  // generate some random colors.\n  // Note: If a Python version is written, it is probably best to use\n  //       vtkMinimalStandardRandomSequence in it and here, to ensure\n  //       that the random number generation is the same.\n  if (numberOfRegions > 9)\n  {\n    std::mt19937 mt(4355412); // Standard mersenne_twister_engine\n    std::uniform_real_distribution<double> distribution(.6, 1.0);\n    for (auto i = 10; i < numberOfRegions; ++i)\n    {\n      lut->SetTableValue(i, distribution(mt), distribution(mt),\n                         distribution(mt), 1.0);\n    }\n  }\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(dicer->GetOutputPort());\n  inputMapper->SetScalarRange(0, dicer->GetNumberOfActualPieces());\n  inputMapper->SetLookupTable(lut);\n\n  std::cout << \"Asked for: \" << dicer->GetNumberOfPieces()\n            << \" pieces, got: \" << dicer->GetNumberOfActualPieces()\n            << std::endl;\n\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkOutlineCornerFilter> outline;\n  outline->SetInputData(inputPolyData);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OBBDicer\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(outlineActor);\n  renderer->AddActor(inputActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->GetActiveCamera()->Azimuth(150);\n  renderer->GetActiveCamera()->Elevation(15);\n  renderer->ResetCamera();\n\n  // Render the image\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Meshes/OBBDicer/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OBBDicer)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OBBDicer: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OBBDicer MACOSX_BUNDLE OBBDicer.cxx )\n  target_link_libraries(OBBDicer PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OBBDicer\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/OBBDicer/#download-and-build-obbdicer","title":"Download and Build OBBDicer","text":"

Click here to download OBBDicer and its CMakeLists.txt file. Once the tarball OBBDicer.tar has been downloaded and extracted,

cd OBBDicer/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OBBDicer\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/PointInterpolator/","title":"PointInterpolator","text":"

vtk-examples/Cxx/Meshes/PointInterpolator

"},{"location":"Cxx/Meshes/PointInterpolator/#description","title":"Description","text":"

This example uses vtkPointInterpolator with a Gaussian Kernel (or other kernel) to interpolate and extrapolate more smoothly the fields inside and outside the probed area.

Info

This C++ code is translated from the python code that Kenichiro Yoshimi wrote to respond to Hosam. See the discourse discussion.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/PointInterpolator/#code","title":"Code","text":"

PointInterpolator.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDelimitedTextReader.h>\n#include <vtkGaussianKernel.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPointGaussianMapper.h>\n#include <vtkPointInterpolator.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkTableToPolyData.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" sparsePoints.txt InterpolatingOnSTL_final.stl\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string pointsFile = argv[1];\n  std::string probeSurfaceFile = argv[2];\n\n  // Read a points data\n  vtkNew<vtkDelimitedTextReader> pointsReader;\n  pointsReader->SetFileName(pointsFile.c_str());\n  pointsReader->DetectNumericColumnsOn();\n  pointsReader->SetFieldDelimiterCharacters(\"\\t\");\n  pointsReader->SetHaveHeaders(true);\n\n  vtkNew<vtkTableToPolyData> tablePoints;\n  tablePoints->SetInputConnection(pointsReader->GetOutputPort());\n  tablePoints->SetXColumn(\"x\");\n  tablePoints->SetYColumn(\"y\");\n  tablePoints->SetZColumn(\"z\");\n  tablePoints->Update();\n\n  vtkPolyData* points = tablePoints->GetOutput();\n  points->GetPointData()->SetActiveScalars(\"val\");\n  double* range = points->GetPointData()->GetScalars()->GetRange();\n\n  // Read a probe surface\n  vtkNew<vtkSTLReader> stlReader;\n  stlReader->SetFileName(probeSurfaceFile.c_str());\n  stlReader->Update();\n\n  vtkPolyData* surface = stlReader->GetOutput();\n  // double* bounds = surface->GetBounds();\n\n  // Gaussian kernel.\n  vtkNew<vtkGaussianKernel> gaussianKernel;\n  gaussianKernel->SetSharpness(2.0);\n  gaussianKernel->SetRadius(12.0);\n\n  vtkNew<vtkPointInterpolator> interpolator;\n  interpolator->SetInputData(surface);\n  interpolator->SetSourceData(points);\n  interpolator->SetKernel(gaussianKernel);\n\n  // Visualize.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(interpolator->GetOutputPort());\n  mapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkPointGaussianMapper> pointsMapper;\n  pointsMapper->SetInputData(points);\n  pointsMapper->SetScalarRange(range);\n  pointsMapper->SetScaleFactor(0.6);\n  pointsMapper->EmissiveOff();\n  // clang-format off\n  pointsMapper->SetSplatShaderCode(\n      \"//VTK::Color::Impl\\n\"\n      \"float dist = dot(offsetVCVSOutput.xy,offsetVCVSOutput.xy);\\n\"\n      \"if (dist > 1.0) {\\n\"\n      \"  discard;\\n\"\n      \"} else {\\n\"\n      \"  float scale = (1.0 - dist);\\n\"\n      \"  ambientColor *= scale;\\n\"\n      \"  diffuseColor *= scale;\\n\"\n      \"};\\n\");\n  // clang-format on\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"PointInterpolator\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(pointsActor);\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(-45);\n\n  renderWindow->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/PointInterpolator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointInterpolator)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersPoints\n  IOGeometry\n  IOInfovis\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointInterpolator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointInterpolator MACOSX_BUNDLE PointInterpolator.cxx )\n  target_link_libraries(PointInterpolator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointInterpolator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/PointInterpolator/#download-and-build-pointinterpolator","title":"Download and Build PointInterpolator","text":"

Click here to download PointInterpolator and its CMakeLists.txt file. Once the tarball PointInterpolator.tar has been downloaded and extracted,

cd PointInterpolator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointInterpolator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/QuadricClustering/","title":"QuadricClustering","text":"

vtk-examples/Cxx/Meshes/QuadricClustering

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/QuadricClustering/#description","title":"Description","text":"

The algorithm used is the one described by Peter Lindstrom in his Siggraph 2000 paper, \"Out-of-Core Simplification of Large Polygonal Models.\" The general approach of the algorithm is to cluster vertices in a uniform binning of space, accumulating the quadric of each triangle (pushed out to the triangles vertices) within each bin, and then determining an optimal position for a single vertex in a bin by using the accumulated quadric.

Seealso

QuadricDecimation and Decimation.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/QuadricClustering/#code","title":"Code","text":"

QuadricClustering.cxx

#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadricClustering.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    inputPolyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(30);\n    sphereSource->SetPhiResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::cout << \"Before decimation\" << std::endl << \"------------\" << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n\n  vtkNew<vtkQuadricClustering> decimate;\n  decimate->SetInputData(inputPolyData);\n  decimate->UseFeatureEdgesOn();\n  decimate->Update();\n\n  vtkNew<vtkPolyData> decimated;\n  decimated->ShallowCopy(decimate->GetOutput());\n\n  std::cout << \"After decimation\" << std::endl << \"------------\" << std::endl;\n  std::cout << \"There are \" << decimated->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << decimated->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n  std::cout << \"Reduction: \"\n            << static_cast<double>((inputPolyData->GetNumberOfPolys() -\n                                    decimated->GetNumberOfPolys())) /\n          static_cast<double>(inputPolyData->GetNumberOfPolys())\n            << std::endl;\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputData(inputPolyData);\n\n  vtkNew<vtkProperty> backFace;\n  backFace->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetInterpolationToFlat();\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  inputActor->SetBackfaceProperty(backFace);\n\n  vtkNew<vtkPolyDataMapper> decimatedMapper;\n  decimatedMapper->SetInputData(decimated);\n\n  vtkNew<vtkActor> decimatedActor;\n  decimatedActor->SetMapper(decimatedMapper);\n  decimatedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  decimatedActor->GetProperty()->SetInterpolationToFlat();\n  decimatedActor->SetBackfaceProperty(backFace);\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"QuadricClustering\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Add the sphere to the left and the cube to the right\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(decimatedActor);\n\n  // Shared camera looking down the -y axis\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, -1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Elevation(30);\n  camera->Azimuth(30);\n\n  leftRenderer->SetActiveCamera(camera);\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->ResetCamera();\n  leftRenderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/QuadricClustering/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadricClustering)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadricClustering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadricClustering MACOSX_BUNDLE QuadricClustering.cxx )\n  target_link_libraries(QuadricClustering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadricClustering\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/QuadricClustering/#download-and-build-quadricclustering","title":"Download and Build QuadricClustering","text":"

Click here to download QuadricClustering and its CMakeLists.txt file. Once the tarball QuadricClustering.tar has been downloaded and extracted,

cd QuadricClustering/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QuadricClustering\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/QuadricDecimation/","title":"QuadricDecimation","text":"

vtk-examples/Cxx/Meshes/QuadricDecimation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/QuadricDecimation/#description","title":"Description","text":"

This example uses Quadric Clustering, based on the work of Garland and Heckbert who first presented the quadric error measure at Siggraph '97 \"Surface Simplification Using Quadric Error Metrics\". For details of the algorithm Michael Garland's Ph.D. thesis is also recommended. Hughues Hoppe's Vis '99 paper, \"New Quadric Metric for Simplifying Meshes with Appearance Attributes\" is also a good take on the subject especially as it pertains to the error metric applied to attributes.

Seealso

QuadricClustering and Decimation.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/QuadricDecimation/#code","title":"Code","text":"

QuadricDecimation.cxx

#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadricDecimation.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    vtkNew<vtkTriangleFilter> triangles;\n    triangles->SetInputConnection(reader->GetOutputPort());\n    triangles->Update();\n    inputPolyData = triangles->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(30);\n    sphereSource->SetPhiResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  std::cout << \"Before decimation\" << std::endl << \"------------\" << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n\n  vtkNew<vtkQuadricDecimation> decimate;\n  decimate->SetInputData(inputPolyData);\n  decimate->AttributeErrorMetricOn();\n  decimate->SetTargetReduction(.9);\n  decimate->VolumePreservationOn();\n\n  decimate->Update();\n\n  vtkNew<vtkPolyData> decimated;\n  decimated->ShallowCopy(decimate->GetOutput());\n\n  std::cout << \"After decimation\" << std::endl << \"------------\" << std::endl;\n  std::cout << \"There are \" << decimated->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << decimated->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n  std::cout << \"Reduction: \"\n            << static_cast<double>((inputPolyData->GetNumberOfPolys() -\n                                    decimated->GetNumberOfPolys())) /\n          static_cast<double>(inputPolyData->GetNumberOfPolys())\n            << std::endl;\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputData(inputPolyData);\n\n  vtkNew<vtkProperty> backFace;\n  backFace->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetInterpolationToFlat();\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  inputActor->SetBackfaceProperty(backFace);\n\n  vtkNew<vtkPolyDataMapper> decimatedMapper;\n  decimatedMapper->SetInputData(decimated);\n\n  vtkNew<vtkActor> decimatedActor;\n  decimatedActor->SetMapper(decimatedMapper);\n  decimatedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  decimatedActor->GetProperty()->SetInterpolationToFlat();\n  decimatedActor->SetBackfaceProperty(backFace);\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"QuadricDecimation\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Add the sphere to the left and the cube to the right\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(decimatedActor);\n\n  // Shared camera looking down the -y axis\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, -1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Elevation(30);\n  camera->Azimuth(30);\n\n  leftRenderer->SetActiveCamera(camera);\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->ResetCamera();\n  leftRenderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/QuadricDecimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadricDecimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadricDecimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadricDecimation MACOSX_BUNDLE QuadricDecimation.cxx )\n  target_link_libraries(QuadricDecimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadricDecimation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/QuadricDecimation/#download-and-build-quadricdecimation","title":"Download and Build QuadricDecimation","text":"

Click here to download QuadricDecimation and its CMakeLists.txt file. Once the tarball QuadricDecimation.tar has been downloaded and extracted,

cd QuadricDecimation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QuadricDecimation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/SimpleElevationFilter/","title":"SimpleElevationFilter","text":"

vtk-examples/Cxx/Meshes/SimpleElevationFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/SimpleElevationFilter/#code","title":"Code","text":"

SimpleElevationFilter.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDelaunay2D.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimpleElevationFilter.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Created a grid of points (heigh/terrian map).\n  vtkNew<vtkPoints> points;\n\n  unsigned int GridSize = 10;\n  for (unsigned int x = 0; x < GridSize; x++)\n  {\n    for (unsigned int y = 0; y < GridSize; y++)\n    {\n      points->InsertNextPoint(x, y, (x + y) / (y + 1));\n      std::cout << x << \" \" << y << \" \" << (x + y) / (y + 1) << std::endl;\n    }\n  }\n\n  double bounds[6];\n  points->GetBounds(bounds);\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> inputPolyData;\n  inputPolyData->SetPoints(points);\n\n  // Triangulate the grid points.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(inputPolyData);\n  delaunay->Update();\n\n  vtkNew<vtkSimpleElevationFilter> elevationFilter;\n  elevationFilter->SetInputConnection(delaunay->GetOutputPort());\n  elevationFilter->SetVector(0.0, 0.0, 1);\n  elevationFilter->Update();\n\n  vtkNew<vtkPolyData> output;\n  output->ShallowCopy(dynamic_cast<vtkPolyData*>(elevationFilter->GetOutput()));\n\n  vtkFloatArray* elevation = dynamic_cast<vtkFloatArray*>(\n      output->GetPointData()->GetArray(\"Elevation\"));\n\n  // Create the color map.\n  vtkNew<vtkLookupTable> colorLookupTable;\n  colorLookupTable->SetTableRange(bounds[4], bounds[5]);\n  colorLookupTable->Build();\n\n  // Generate the colors for each point based on the color map.\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n\n  for (vtkIdType i = 0; i < output->GetNumberOfPoints(); i++)\n  {\n    double val = elevation->GetValue(i);\n    // std::cout << \"val: \" << val << std::endl;\n\n    double dcolor[3];\n    colorLookupTable->GetColor(val, dcolor);\n    // std::cout << \"dcolor: \" << dcolor[0] << \" \" << dcolor[1] << \" \" <<\n    // dcolor[2]\n    //          << std::endl;\n    unsigned char color[3];\n    for (unsigned int j = 0; j < 3; j++)\n    {\n      color[j] = 255 * dcolor[j] / 1.0;\n    }\n    // std::cout << \"color: \" << (int)color[0] << \" \" << (int)color[1] << \" \"\n    //          << (int)color[2] << std::endl;\n\n    colors->InsertNextTupleValue(color);\n  }\n\n  output->GetPointData()->AddArray(colors);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(output);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SimpleElevationFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"ForestGreen\").GetData());\n\n  // z-axis points upwards and y-axis is lower right edge.\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-13.3586, 20.7305, 22.5147);\n  camera->SetFocalPoint(4.5, 4.5, 4.5);\n  camera->SetViewUp(0.506199, -0.328212, 0.797521);\n  camera->SetDistance(30.1146);\n  camera->SetClippingRange(14.3196, 50.0698);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/SimpleElevationFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SimpleElevationFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SimpleElevationFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SimpleElevationFilter MACOSX_BUNDLE SimpleElevationFilter.cxx )\n  target_link_libraries(SimpleElevationFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SimpleElevationFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/SimpleElevationFilter/#download-and-build-simpleelevationfilter","title":"Download and Build SimpleElevationFilter","text":"

Click here to download SimpleElevationFilter and its CMakeLists.txt file. Once the tarball SimpleElevationFilter.tar has been downloaded and extracted,

cd SimpleElevationFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SimpleElevationFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/SolidClip/","title":"SolidClip","text":"

vtk-examples/Cxx/Meshes/SolidClip

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/SolidClip/#description","title":"Description","text":"

This example clips a mesh and applies a backface property to that mesh so that it appears to have a solid interior.

The \"ghost\" of the part clipped away is also shown.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/SolidClip/#code","title":"Code","text":"

SolidClip.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSuperquadricSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a superquadric.\n  vtkNew<vtkSuperquadricSource> superquadricSource;\n  superquadricSource->SetPhiRoundness(3.1);\n  superquadricSource->SetThetaRoundness(2.2);\n\n  // Define a clipping plane.\n  vtkNew<vtkPlane> clipPlane;\n  clipPlane->SetNormal(1.0, -1.0, -1.0);\n  clipPlane->SetOrigin(0.0, 0.0, 0.0);\n\n  // Clip the source with the plane.\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(superquadricSource->GetOutputPort());\n  clipper->SetClipFunction(clipPlane);\n  // This will give us the polygonal data that is clipped away.\n  clipper->GenerateClippedOutputOn();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> superquadricMapper;\n  superquadricMapper->SetInputConnection(clipper->GetOutputPort());\n\n  vtkNew<vtkActor> superquadricActor;\n  superquadricActor->SetMapper(superquadricMapper);\n\n  // Create a property to be used for the back faces. Turn off all\n  // shading by specifying 0 weights for specular and diffuse. Max the\n  // ambient.\n  vtkNew<vtkProperty> backFaces;\n  backFaces->SetSpecular(0.0);\n  backFaces->SetDiffuse(0.0);\n  backFaces->SetAmbient(1.0);\n  backFaces->SetAmbientColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  superquadricActor->SetBackfaceProperty(backFaces);\n\n  // Here we get the the polygonal data that is clipped away.\n  vtkNew<vtkPolyDataMapper> clippedAwayMapper;\n  clippedAwayMapper->SetInputData(clipper->GetClippedOutput());\n  clippedAwayMapper->ScalarVisibilityOff();\n\n  // Let us display it as a faint object\n  vtkNew<vtkActor> clippedAwayActor;\n  clippedAwayActor->SetMapper(clippedAwayMapper);\n  clippedAwayActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Silver\").GetData());\n  clippedAwayActor->GetProperty()->SetOpacity(0.1);\n\n  // Create a renderer.\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"SolidClip\");\n\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add actors to the renderers.\n  renderer->AddActor(superquadricActor);\n  renderer->AddActor(clippedAwayActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->SetSize(600, 600);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  // Interact with the window.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/SolidClip/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SolidClip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SolidClip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SolidClip MACOSX_BUNDLE SolidClip.cxx )\n  target_link_libraries(SolidClip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SolidClip\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/SolidClip/#download-and-build-solidclip","title":"Download and Build SolidClip","text":"

Click here to download SolidClip and its CMakeLists.txt file. Once the tarball SolidClip.tar has been downloaded and extracted,

cd SolidClip/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SolidClip\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/SplitPolyData/","title":"SplitPolyData","text":"

vtk-examples/Cxx/Meshes/SplitPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/SplitPolyData/#description","title":"Description","text":"

The vtkOBBDicer filter breaks up an input mesh into a number of pieces. The resulting mesh contains scalar point data that can be used to extract the individual pieces with a filter like vtkThreshold. This example stores each piece into a .vtp file.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/SplitPolyData/#code","title":"Code","text":"

SplitPolyData.cxx

#include <vtkActor.h>\n#include <vtkColorSeries.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGeometryFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBDicer.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkThreshold.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <sstream>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  std::string filename;\n  std::string extension;\n\n  vtkSmartPointer<vtkPolyData> inputPolyData =\n      ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n  if (argc > 1)\n  {\n    filename =\n        vtksys::SystemTools::GetFilenameWithoutExtension(std::string(argv[1]));\n    extension = vtksys::SystemTools::GetFilenameExtension(std::string(argv[1]));\n  }\n  else\n  {\n    filename = \"sphere\";\n    extension = \".vtp\";\n  }\n\n  // Create pipeline\n  vtkNew<vtkOBBDicer> dicer;\n  dicer->SetInputData(inputPolyData);\n  dicer->SetNumberOfPieces(4);\n  dicer->SetDiceModeToSpecifiedNumberOfPieces();\n  dicer->Update();\n\n  vtkNew<vtkThreshold> selector;\n  selector->SetInputArrayToProcess(0, 0, 0, 0, \"vtkOBBDicer_GroupIds\");\n  selector->SetInputConnection(dicer->GetOutputPort());\n  selector->AllScalarsOff();\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(namedColors->GetColor3d(\"NavajoWhite\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"SplitPolyData\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Use a color series to create a transfer function\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_DIVERGING_SPECTRAL_11);\n\n  // Create an actor for each piece\n  for (int i = 0; i < dicer->GetNumberOfActualPieces(); ++i)\n  {\n    selector->SetLowerThreshold(i);\n    selector->SetUpperThreshold(i);\n    vtkNew<vtkGeometryFilter> geometry;\n    geometry->SetInputConnection(selector->GetOutputPort());\n    geometry->Update();\n\n    vtkNew<vtkDataSetMapper> mapper;\n    mapper->SetInputData(geometry->GetOutput());\n    mapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n\n    vtkColor3ub color = colorSeries->GetColor(i);\n    double dColor[3];\n    dColor[0] = static_cast<double>(color[0]) / 255.0;\n    dColor[1] = static_cast<double>(color[1]) / 255.0;\n    dColor[2] = static_cast<double>(color[2]) / 255.0;\n    actor->GetProperty()->SetColor(dColor);\n    renderer->AddActor(actor);\n  }\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  vtkNew<vtkGeometryFilter> geometry;\n  geometry->SetInputConnection(selector->GetOutputPort());\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetInputConnection(geometry->GetOutputPort());\n  for (int i = 0; i < dicer->GetNumberOfActualPieces(); ++i)\n  {\n    std::stringstream pieceName;\n    pieceName << filename << \"_\" << i + 1 << extension;\n    selector->SetLowerThreshold(i);\n    selector->SetUpperThreshold(i);\n    writer->SetFileName(pieceName.str().c_str());\n    writer->Write();\n  }\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Meshes/SplitPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SplitPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SplitPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SplitPolyData MACOSX_BUNDLE SplitPolyData.cxx )\n  target_link_libraries(SplitPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SplitPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/SplitPolyData/#download-and-build-splitpolydata","title":"Download and Build SplitPolyData","text":"

Click here to download SplitPolyData and its CMakeLists.txt file. Once the tarball SplitPolyData.tar has been downloaded and extracted,

cd SplitPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SplitPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/Subdivision/","title":"Subdivision","text":"

vtk-examples/Cxx/Meshes/Subdivision

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/Subdivision/#description","title":"Description","text":"

In this example a mesh is read from a file and then subdivided using linear subdivision. The SetNumberOfSubdivisions(n) function controls how many times the mesh is subdivided. For each n, the number of triangles will increase by approximately a factor of 4. For example, if n=2, the number of triangles in the resulting mesh will be 16x the number of triangles in the original mesh.

Different types of subdivisions can be obtained by replacing vtkLinearSubdivisionFilter with either vtkLoopSubdivisionFilter or vtkButterflySubdivisionFilter.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/Subdivision/#code","title":"Code","text":"

Subdivision.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkButterflySubdivisionFilter.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkLoopSubdivisionFilter.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <map>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Test with these parameters: footbones.ply 2.\n  vtkNew<vtkNamedColors> colors;\n\n  std::map<int, std::string> actorColors;\n  actorColors[0] = \"BurlyWood\";\n  actorColors[1] = \"BurlyWood\";\n  actorColors[2] = \"BurlyWood\";\n\n  std::map<int, std::string> rendererColors;\n  rendererColors[0] = \"Gainsboro\";\n  rendererColors[1] = \"LightGrey\";\n  rendererColors[2] = \"Silver\";\n\n  vtkSmartPointer<vtkPolyData> originalMesh;\n\n  if (argc > 1) // If a file name is specified, open and use the file.\n  {\n    auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n    // Subdivision filters only work on triangles.\n    vtkNew<vtkTriangleFilter> triangles;\n    triangles->SetInputData(polyData);\n    triangles->Update();\n    originalMesh = triangles->GetOutput();\n  }\n  else // If a file name is not specified, create a sphere.\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n    originalMesh = sphereSource->GetOutput();\n  }\n\n  std::cout << \"Before subdivision\" << std::endl;\n  std::cout << \"    There are \" << originalMesh->GetNumberOfPoints()\n            << \" points.\" << std::endl;\n  std::cout << \"    There are \" << originalMesh->GetNumberOfPolys()\n            << \" triangles.\" << std::endl;\n\n  double numberOfViewports = 3.0;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(200 * numberOfViewports, 200); //(width, height)\n  renderWindow->SetWindowName(\"Subdivision\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  int numberOfSubdivisions = 2;\n  for (unsigned i = 0; i < numberOfViewports; i++)\n  {\n    // Note: Here we create a superclass pointer (vtkPolyDataAlgorithm) so that\n    // we can easily instantiate different types of subdivision filters.\n    // Typically you would not want to do this, but rather create the pointer to\n    // be the type filter you will actually use, e.g.\n    // vtkNew<vtkLinearSubdivisionFilter>  subdivisionFilter;\n    vtkSmartPointer<vtkPolyDataAlgorithm> subdivisionFilter;\n    switch (i)\n    {\n    case 0:\n      subdivisionFilter = vtkSmartPointer<vtkLinearSubdivisionFilter>::New();\n      dynamic_cast<vtkLinearSubdivisionFilter*>(subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      break;\n    case 1:\n      subdivisionFilter = vtkSmartPointer<vtkLoopSubdivisionFilter>::New();\n      dynamic_cast<vtkLoopSubdivisionFilter*>(subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      break;\n    case 2:\n      subdivisionFilter = vtkSmartPointer<vtkButterflySubdivisionFilter>::New();\n      dynamic_cast<vtkButterflySubdivisionFilter*>(\n          subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      break;\n    default:\n      break;\n    }\n    subdivisionFilter->SetInputData(originalMesh);\n    subdivisionFilter->Update();\n\n    vtkNew<vtkRenderer> renderer;\n\n    renderWindow->AddRenderer(renderer);\n    renderer->SetViewport(static_cast<double>(i) / numberOfViewports, 0,\n                          static_cast<double>(i + 1) / numberOfViewports, 1);\n\n    // Create a mapper and actor.\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(subdivisionFilter->GetOutputPort());\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(\n        colors->GetColor3d(actorColors[i]).GetData());\n\n    renderer->AddActor(actor);\n    renderer->SetBackground(colors->GetColor3d(rendererColors[i]).GetData());\n    renderer->ResetCamera();\n\n    renderWindow->Render();\n  }\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Meshes/Subdivision/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Subdivision)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Subdivision: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Subdivision MACOSX_BUNDLE Subdivision.cxx )\n  target_link_libraries(Subdivision PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Subdivision\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/Subdivision/#download-and-build-subdivision","title":"Download and Build Subdivision","text":"

Click here to download Subdivision and its CMakeLists.txt file. Once the tarball Subdivision.tar has been downloaded and extracted,

cd Subdivision/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Subdivision\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/SubdivisionDemo/","title":"SubdivisionDemo","text":"

vtk-examples/Cxx/Meshes/SubdivisionDemo

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/SubdivisionDemo/#code","title":"Code","text":"

SubdivisionDemo.cxx

#include <vtkActor.h>\n#include <vtkButterflySubdivisionFilter.h>\n#include <vtkCamera.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkLoopSubdivisionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Test with these parameters: footbones.ply 2\n  int numberOfSubdivisions = 2;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  vtkSmartPointer<vtkPolyData> originalMesh; /* =\n      vtkSmartPointer<vtkPolyData>::New();*/\n  if (argc > 1) // If a file name is specified, open and use the file.\n  {\n    // Subdivision filters only work on triangles.\n    vtkNew<vtkTriangleFilter> triangles;\n    triangles->SetInputData(polyData);\n    triangles->Update();\n    originalMesh = triangles->GetOutput();\n  }\n  else\n  {\n    originalMesh = polyData;\n  }\n  if (argc > 2)\n  {\n    numberOfSubdivisions = std::stod(argv[2]);\n  }\n  std::cout << \"Before subdivision\" << std::endl;\n  std::cout << \"    There are \" << originalMesh->GetNumberOfPoints()\n            << \" points.\" << std::endl;\n  std::cout << \"    There are \" << originalMesh->GetNumberOfPolys()\n            << \" triangles.\" << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d background = colors->GetColor3d(\"Gray\");\n  vtkColor3d originalColor = colors->GetColor3d(\"Tomato\");\n  vtkColor3d loopColor = colors->GetColor3d(\"Banana\");\n  vtkColor3d butterflyColor = colors->GetColor3d(\"DodgerBlue\");\n\n  double numberOfViewports = 3.0;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(400 * numberOfViewports, 512); //(width, height)\n  renderWindow->SetWindowName(\"SubdivisionDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCamera> camera;\n\n  vtkNew<vtkLegendBoxActor> legend;\n  legend->SetNumberOfEntries(3);\n  vtkNew<vtkRenderer> legendRen;\n\n  for (unsigned i = 0; i < numberOfViewports; i++)\n  {\n    // Note: Here we create a superclass pointer (vtkPolyDataAlgorithm) so\n    // that we can easily instantiate different types of subdivision filters.\n    // Typically you would not want to do this, but rather create the pointer\n    // to be the type filter you will actually use, e.g.\n    // vtkNew<vtkLinearSubdivisionFilter>  subdivisionFilter;\n    vtkSmartPointer<vtkPolyDataAlgorithm> subdivisionFilter;\n    vtkNew<vtkRenderer> renderer;\n    vtkNew<vtkActor> actor;\n    switch (i)\n    {\n    case 0:\n      subdivisionFilter = vtkSmartPointer<vtkLinearSubdivisionFilter>::New();\n      dynamic_cast<vtkLinearSubdivisionFilter*>(subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      actor->GetProperty()->SetDiffuseColor(originalColor.GetData());\n      legend->SetEntry(i, subdivisionFilter->GetOutput(), \"Linear\",\n                       originalColor.GetData());\n      break;\n    case 1:\n      subdivisionFilter = vtkSmartPointer<vtkLoopSubdivisionFilter>::New();\n      dynamic_cast<vtkLoopSubdivisionFilter*>(subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      actor->GetProperty()->SetDiffuseColor(loopColor.GetData());\n      legend->SetEntry(i, subdivisionFilter->GetOutput(), \"Loop\",\n                       loopColor.GetData());\n      break;\n    case 2:\n      subdivisionFilter = vtkSmartPointer<vtkButterflySubdivisionFilter>::New();\n      dynamic_cast<vtkButterflySubdivisionFilter*>(\n          subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      actor->GetProperty()->SetDiffuseColor(butterflyColor.GetData());\n      legend->SetEntry(i, subdivisionFilter->GetOutput(), \"Butterfly\",\n                       butterflyColor.GetData());\n      break;\n    default:\n      break;\n    }\n    subdivisionFilter->SetInputData(originalMesh);\n    subdivisionFilter->Update();\n\n    renderWindow->AddRenderer(renderer);\n    // We reserve the lower part of the viewport for the legend.\n    renderer->SetViewport(static_cast<double>(i) / numberOfViewports, 0.2,\n                          static_cast<double>(i + 1) / numberOfViewports, 1);\n    renderer->SetBackground(background.GetData());\n    renderer->SetActiveCamera(camera);\n    renderer->UseHiddenLineRemovalOn();\n    // Create a mapper and actor\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(subdivisionFilter->GetOutputPort());\n    actor->SetMapper(mapper);\n    renderer->AddActor(actor);\n    renderer->ResetCamera();\n  }\n\n  // Position the legend below the three viewports defined above.\n  legend->GetPositionCoordinate()->SetCoordinateSystemToView();\n  legend->GetPositionCoordinate()->SetValue(-0.3, -0.9);\n  legend->GetPosition2Coordinate()->SetCoordinateSystemToView();\n  legend->GetPosition2Coordinate()->SetValue(0.3, 0.9);\n  legend->BorderOff();\n  legendRen->AddActor(legend);\n  legendRen->SetBackground(background.GetData());\n  legendRen->SetViewport(0.0, 0.0, 1.0, 0.2);\n  renderWindow->AddRenderer(legendRen);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase.\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Meshes/SubdivisionDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SubdivisionDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SubdivisionDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SubdivisionDemo MACOSX_BUNDLE SubdivisionDemo.cxx )\n  target_link_libraries(SubdivisionDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SubdivisionDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/SubdivisionDemo/#download-and-build-subdivisiondemo","title":"Download and Build SubdivisionDemo","text":"

Click here to download SubdivisionDemo and its CMakeLists.txt file. Once the tarball SubdivisionDemo.tar has been downloaded and extracted,

cd SubdivisionDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SubdivisionDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData/","title":"TableBasedClipDataSetWithPolyData","text":"

vtk-examples/Cxx/Meshes/TableBasedClipDataSetWithPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData/#description","title":"Description","text":"

The example that shows how to use the vtkTableBasedClipDataSet to clip a vtkRectilinearGrid with an arbitrary polydata. vtkImplicitPolyDataDistance is used to turn the polydata into an implicit function. Every point of the grid is evaluated before sending to vtkTableBasedClipDataSet. This example uses a vtkConeSource to generate polydata to use, however any polydata could be used, including stl files.

The left part of the image shows the inside clip and the distance field on a center slice. The right side shows the outside clip. When the program exits using the \"e: key, the example will report the cell type for both the inside and outside clips.

Note

Contrast this with the vtkClipDataSet example: ClipDataSetWithPolyData.

Here is the summary reported when the example exits:

\nThe clipped dataset(inside) contains a \n[vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 14176 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3084 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 6820 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 1196 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 3076 times.\n------------------------\nThe clipped dataset(outside) contains a \n[vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 125600 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3276 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 117732 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 1260 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 3332 times.\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData/#code","title":"Code","text":"

TableBasedClipDataSetWithPolyData.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellTypes.h>\n#include <vtkConeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFloatArray.h>\n#include <vtkImplicitPolyDataDistance.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRectilinearGridGeometryFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTableBasedClipDataSet.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <map>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create polydata to slice the grid with. In this case, use a cone. This\n  // could be any polydata including a stl file.\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(50);\n  cone->SetDirection(0, 0, -1);\n  cone->SetHeight(3.0);\n  cone->CappingOn();\n  cone->Update();\n\n  // Implicit function that will be used to slice the mesh\n  vtkNew<vtkImplicitPolyDataDistance> implicitPolyDataDistance;\n  implicitPolyDataDistance->SetInput(cone->GetOutput());\n\n  // create a grid.\n  unsigned int dimension = 51;\n  vtkNew<vtkFloatArray> xCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    xCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  vtkNew<vtkFloatArray> yCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    yCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  vtkNew<vtkFloatArray> zCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    zCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  // The coordinates are assigned to the rectilinear grid. Make sure that\n  // the number of values in each of the XCoordinates, YCoordinates,\n  // and ZCoordinates is equal to what is defined in SetDimensions().\n  vtkNew<vtkRectilinearGrid> rgrid;\n  rgrid->SetDimensions(xCoords->GetNumberOfTuples(),\n                       yCoords->GetNumberOfTuples(),\n                       zCoords->GetNumberOfTuples());\n  rgrid->SetXCoordinates(xCoords);\n  rgrid->SetYCoordinates(yCoords);\n  rgrid->SetZCoordinates(zCoords);\n\n  // Create an array to hold distance information.\n  vtkNew<vtkFloatArray> signedDistances;\n  signedDistances->SetNumberOfComponents(1);\n  signedDistances->SetName(\"SignedDistances\");\n\n  // Evaluate the signed distance function at all of the grid points\n  for (vtkIdType pointId = 0; pointId < rgrid->GetNumberOfPoints(); ++pointId)\n  {\n    double p[3];\n    rgrid->GetPoint(pointId, p);\n    double signedDistance = implicitPolyDataDistance->EvaluateFunction(p);\n    signedDistances->InsertNextValue(signedDistance);\n  }\n\n  // Add the SignedDistances to the grid.\n  rgrid->GetPointData()->SetScalars(signedDistances);\n\n  // Use vtkTableBasedClipDataSet to slice the grid with the polydata.\n  vtkNew<vtkTableBasedClipDataSet> clipper;\n  clipper->SetInputData(rgrid);\n  clipper->InsideOutOn();\n  clipper->SetValue(0.0);\n  clipper->GenerateClippedOutputOn();\n  clipper->Update();\n\n  // --- mappers, actors, render, etc. ---\n  // Mapper and actor to view the cone.\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n\n  // Geometry filter to view the background grid.\n  vtkNew<vtkRectilinearGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputData(rgrid);\n  geometryFilter->SetExtent(0, dimension, 0, dimension, dimension / 2,\n                            dimension / 2);\n  geometryFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> rgridMapper;\n  rgridMapper->SetInputConnection(geometryFilter->GetOutputPort());\n  rgridMapper->SetScalarRange(\n      rgrid->GetPointData()->GetArray(\"SignedDistances\")->GetRange());\n\n  vtkNew<vtkActor> wireActor;\n  wireActor->SetMapper(rgridMapper);\n  wireActor->GetProperty()->SetRepresentationToWireframe();\n\n  // Mapper and actor to view the clipped mesh.\n  vtkNew<vtkDataSetMapper> clipperMapper;\n  clipperMapper->SetInputConnection(clipper->GetOutputPort());\n  clipperMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkDataSetMapper> clipperOutsideMapper;\n  clipperOutsideMapper->SetInputConnection(clipper->GetOutputPort(1));\n  clipperOutsideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clipperActor;\n  clipperActor->SetMapper(clipperMapper);\n  clipperActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> clipperOutsideActor;\n  clipperOutsideActor->SetMapper(clipperOutsideMapper);\n  clipperOutsideActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  // A renderer and render window\n  // Create a renderer, render window, and interactor.\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n  leftRenderer->UseHiddenLineRemovalOn();\n\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n  rightRenderer->UseHiddenLineRemovalOn();\n\n  // Add the actors.\n  leftRenderer->AddActor(wireActor);\n  leftRenderer->AddActor(clipperActor);\n  rightRenderer->AddActor(clipperOutsideActor);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(leftRenderer);\n  renderWindow->AddRenderer(rightRenderer);\n  renderWindow->SetWindowName(\"TableBasedClipDataSetWithPolyData\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Share the camera.\n\n  leftRenderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  leftRenderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  leftRenderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  leftRenderer->GetActiveCamera()->Azimuth(30);\n  leftRenderer->GetActiveCamera()->Elevation(30);\n  leftRenderer->ResetCamera();\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  // Generate a report.\n  vtkIdType numberOfCells = clipper->GetOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset(inside) contains a \" << std::endl\n            << clipper->GetOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> CellContainer;\n  CellContainer cellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    cellMap[clipper->GetOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : cellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n\n  numberOfCells = clipper->GetClippedOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset(outside) contains a \" << std::endl\n            << clipper->GetClippedOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> OutsideCellContainer;\n  CellContainer outsideCellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    outsideCellMap[clipper->GetClippedOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : outsideCellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TableBasedClipDataSetWithPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TableBasedClipDataSetWithPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TableBasedClipDataSetWithPolyData MACOSX_BUNDLE TableBasedClipDataSetWithPolyData.cxx )\n  target_link_libraries(TableBasedClipDataSetWithPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TableBasedClipDataSetWithPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData/#download-and-build-tablebasedclipdatasetwithpolydata","title":"Download and Build TableBasedClipDataSetWithPolyData","text":"

Click here to download TableBasedClipDataSetWithPolyData and its CMakeLists.txt file. Once the tarball TableBasedClipDataSetWithPolyData.tar has been downloaded and extracted,

cd TableBasedClipDataSetWithPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TableBasedClipDataSetWithPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData2/","title":"TableBasedClipDataSetWithPolyData2","text":"

vtk-examples/Cxx/Meshes/TableBasedClipDataSetWithPolyData2

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData2/#description","title":"Description","text":"

The example that shows how to use the vtkTableBasedClipDataSet to clip a vtkRectilinearGrid that contains a checkerboard pattern.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData2/#code","title":"Code","text":"

TableBasedClipDataSetWithPolyData2.cxx

// This program draws a checkerboard ala an OOF3D image display and\n// clips it with two planes.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkExecutive.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkLookupTable.h>\n#include <vtkMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTableBasedClipDataSet.h>\n\n///////////////////\nnamespace {\n// Make a rectilinear grid that shows image-like data, by creating a\n// cubic cell at each point. A checkerboard pattern is used for\n// simplicity.\n\nvtkSmartPointer<vtkRectilinearGrid> makeImage(int n);\n\n} // namespace\n\nint main(int, char*[])\n{\n  constexpr int imageSize = 64; // number of checkerboard squares on a side.\n\n  // Offsets for clipping planes with normals in the X and Y directions.\n  constexpr int xOffset = 8;\n  constexpr int yOffset = 8;\n\n  vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"TableBasedClipDataSetWithPolyData2\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  vtkNew<vtkInteractorStyleSwitch> style;\n  interactor->SetInteractorStyle(style);\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkSmartPointer<vtkRectilinearGrid> image = makeImage(imageSize);\n\n  // Clipping planes in the X and Y direction.\n  auto normals = vtkSmartPointer<vtkDoubleArray>::New();\n  vtkNew<vtkPoints> clipPts;\n  normals->SetNumberOfComponents(3);\n  double xnorm[3] = {-1., 0., 0.};\n  double ynorm[3] = {0., -1., 0.};\n  double xpt[3] = {xOffset, 0., 0.};\n  double ypt[3] = {0., yOffset, 0.};\n  normals->InsertNextTuple(xnorm);\n  normals->InsertNextTuple(ynorm);\n  clipPts->InsertNextPoint(xpt);\n  clipPts->InsertNextPoint(ypt);\n\n  vtkNew<vtkPlanes> clipPlanes;\n  clipPlanes->SetNormals(normals);\n  clipPlanes->SetPoints(clipPts);\n\n  vtkNew<vtkTableBasedClipDataSet> clipper;\n  clipper->SetClipFunction(clipPlanes);\n  clipper->SetInputData(image);\n\n  vtkNew<vtkDataSetMapper> imageMapper;\n  vtkNew<vtkActor> imageActor;\n  imageActor->SetMapper(imageMapper);\n  renderer->AddViewProp(imageActor);\n  imageMapper->SetInputConnection(clipper->GetOutputPort());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  interactor->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkRectilinearGrid> makeImage(int n)\n{\n  constexpr double cubeSize =\n      20.0; // physical linear dimension of entire system.\n\n  // This is a simplification of a program that uses actual image data\n  // as a source for the rectilinear grid.  In order to recreate the\n  // same vtk calls, create a dummy image here.\n  vtkNew<vtkImageData> image0;\n  image0->SetDimensions(n, n, n);\n  image0->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n  image0->SetSpacing(cubeSize / n, cubeSize / n, cubeSize / n);\n  int checkerSize = n / 8;\n  for (int z = 0; z < n; z++)\n  {\n    for (int y = 0; y < n; y++)\n    {\n      for (int x = 0; x < n; x++)\n      {\n        unsigned char* ptr = (unsigned char*)image0->GetScalarPointer(x, y, z);\n        *ptr = (x / checkerSize + y / checkerSize + z / checkerSize) %\n            2; // checkerboard\n      }\n    }\n  }\n\n  // Color for the checkerboard image\n  // double r = 0.7;\n  // double g = 0.7;\n  // double b = 0.7;\n  // double a = 1.0;\n  // double dim = 0.5; // amount to dim the dark squares by\n\n  vtkNew<vtkNamedColors> colors;\n  // colors->GetColor(\"LightCoral\", r, g, b, a);\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(2);\n  lut->SetTableRange(0, 1);\n  // lut->SetTableValue(0, r, g, b, a);\n  // lut->SetTableValue(1, dim * r, dim * g, dim * b, a);\n  // Or we can have fun ...\n  lut->SetTableValue(0, colors->GetColor4d(\"Thistle\").GetData());\n  lut->SetTableValue(1, colors->GetColor4d(\"DarkSlateBlue\").GetData());\n\n  vtkNew<vtkImageMapToColors> map;\n  map->SetLookupTable(lut);\n  map->SetOutputFormatToRGBA();\n  map->SetInputData(image0);\n  map->GetExecutive()->Update();\n  vtkImageData* image = map->GetOutput();\n\n  // Convert the image to a rectilinear grid.  Each point in the image\n  // becomes a cubic cell in the grid.\n\n  vtkNew<vtkRectilinearGrid> rectgrid;\n\n  int extent[6];\n  image->GetExtent(extent);\n  extent[1] += 1;\n  extent[3] += 1;\n  extent[5] += 1;\n  rectgrid->SetExtent(extent);\n\n  vtkNew<vtkDoubleArray> xcoords;\n  vtkNew<vtkDoubleArray> ycoords;\n  vtkNew<vtkDoubleArray> zcoords;\n  xcoords->SetNumberOfValues(n + 1);\n  ycoords->SetNumberOfValues(n + 1);\n  zcoords->SetNumberOfValues(n + 1);\n  double spacing[3];\n  image->GetSpacing(spacing);\n  for (vtkIdType i = 0; i <= n; i++)\n  {\n    xcoords->InsertValue(i, i * spacing[0]);\n    ycoords->InsertValue(i, i * spacing[1]);\n    zcoords->InsertValue(i, i * spacing[2]);\n  }\n  rectgrid->SetXCoordinates(xcoords);\n  rectgrid->SetYCoordinates(ycoords);\n  rectgrid->SetZCoordinates(zcoords);\n\n  vtkPointData* pointData = image->GetPointData();\n  vtkCellData* cellData = rectgrid->GetCellData();\n  cellData->ShallowCopy(pointData);\n  return rectgrid;\n}\n\n} // namespace\n
"},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TableBasedClipDataSetWithPolyData2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonExecutionModel\n  FiltersGeneral\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TableBasedClipDataSetWithPolyData2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TableBasedClipDataSetWithPolyData2 MACOSX_BUNDLE TableBasedClipDataSetWithPolyData2.cxx )\n  target_link_libraries(TableBasedClipDataSetWithPolyData2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TableBasedClipDataSetWithPolyData2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData2/#download-and-build-tablebasedclipdatasetwithpolydata2","title":"Download and Build TableBasedClipDataSetWithPolyData2","text":"

Click here to download TableBasedClipDataSetWithPolyData2 and its CMakeLists.txt file. Once the tarball TableBasedClipDataSetWithPolyData2.tar has been downloaded and extracted,

cd TableBasedClipDataSetWithPolyData2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TableBasedClipDataSetWithPolyData2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/Triangulate/","title":"Triangulate","text":"

vtk-examples/Cxx/Meshes/Triangulate

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/Triangulate/#code","title":"Code","text":"

Triangulate.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRegularPolygonSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangleFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRegularPolygonSource> polygonSource;\n  polygonSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(polygonSource->GetOutputPort());\n  triangleFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(polygonSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetRepresentationToWireframe();\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkPolyDataMapper> triangleMapper;\n  triangleMapper->SetInputConnection(triangleFilter->GetOutputPort());\n  vtkNew<vtkActor> triangleActor;\n  triangleActor->SetMapper(triangleMapper);\n  triangleActor->GetProperty()->SetRepresentationToWireframe();\n  triangleActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"Triangulate\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"SaddleBrown\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(triangleActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/Triangulate/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Triangulate)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Triangulate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Triangulate MACOSX_BUNDLE Triangulate.cxx )\n  target_link_libraries(Triangulate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Triangulate\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/Triangulate/#download-and-build-triangulate","title":"Download and Build Triangulate","text":"

Click here to download Triangulate and its CMakeLists.txt file. Once the tarball Triangulate.tar has been downloaded and extracted,

cd Triangulate/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Triangulate\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Meshes/WindowedSincPolyDataFilter/","title":"WindowedSincPolyDataFilter","text":"

vtk-examples/Cxx/Meshes/WindowedSincPolyDataFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Meshes/WindowedSincPolyDataFilter/#description","title":"Description","text":"

This example demonstrates how to smooth a mesh.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Meshes/WindowedSincPolyDataFilter/#code","title":"Code","text":"

WindowedSincPolyDataFilter.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkWindowedSincPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkWindowedSincPolyDataFilter> smoother;\n  smoother->SetInputConnection(sphereSource->GetOutputPort());\n  smoother->SetNumberOfIterations(15);\n  smoother->BoundarySmoothingOff();\n  smoother->FeatureEdgeSmoothingOff();\n  smoother->SetFeatureAngle(120.0);\n  smoother->SetPassBand(.001);\n  smoother->NonManifoldSmoothingOn();\n  smoother->NormalizeCoordinatesOn();\n  smoother->Update();\n\n  vtkNew<vtkPolyDataMapper> smoothedMapper;\n  smoothedMapper->SetInputConnection(smoother->GetOutputPort());\n  vtkNew<vtkActor> smoothedActor;\n  smoothedActor->SetMapper(smoothedMapper);\n  smoothedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightCoral\").GetData());\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightCoral\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"WindowedSincPolyDataFilter\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  // Add the sphere to the left and the smoothed sphere to the right.\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(smoothedActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Meshes/WindowedSincPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WindowedSincPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WindowedSincPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WindowedSincPolyDataFilter MACOSX_BUNDLE WindowedSincPolyDataFilter.cxx )\n  target_link_libraries(WindowedSincPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WindowedSincPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Meshes/WindowedSincPolyDataFilter/#download-and-build-windowedsincpolydatafilter","title":"Download and Build WindowedSincPolyDataFilter","text":"

Click here to download WindowedSincPolyDataFilter and its CMakeLists.txt file. Once the tarball WindowedSincPolyDataFilter.tar has been downloaded and extracted,

cd WindowedSincPolyDataFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WindowedSincPolyDataFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/Bottle/","title":"Bottle","text":"

vtk-examples/Cxx/Modelling/Bottle

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/Bottle/#code","title":"Code","text":"

Bottle.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRotationalExtrusionFilter.h>\n#include <vtkStripper.h>\n#include <vtkTubeFilter.h>\n\nint main(int, char*[])\n{\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // create bottle profile\n  //\n  vtkNew<vtkPoints> points;\n  points->InsertPoint(0, 0.01, 0.0, 0.0);\n  points->InsertPoint(1, 1.5, 0.0, 0.0);\n  points->InsertPoint(2, 1.5, 0.0, 3.5);\n  points->InsertPoint(3, 1.25, 0.0, 3.75);\n  points->InsertPoint(4, 0.75, 0.0, 4.00);\n  points->InsertPoint(5, 0.6, 0.0, 4.35);\n  points->InsertPoint(6, 0.7, 0.0, 4.65);\n  points->InsertPoint(7, 1.0, 0.0, 4.75);\n  points->InsertPoint(8, 1.0, 0.0, 5.0);\n  points->InsertPoint(9, 0.2, 0.0, 5.0);\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(10); // number of points\n  lines->InsertCellPoint(0);\n  lines->InsertCellPoint(1);\n  lines->InsertCellPoint(2);\n  lines->InsertCellPoint(3);\n  lines->InsertCellPoint(4);\n  lines->InsertCellPoint(5);\n  lines->InsertCellPoint(6);\n  lines->InsertCellPoint(7);\n  lines->InsertCellPoint(8);\n  lines->InsertCellPoint(9);\n\n  vtkNew<vtkPolyData> profile;\n  profile->SetPoints(points);\n  profile->SetLines(lines);\n\n  // extrude profile to make bottle\n  //\n  vtkNew<vtkRotationalExtrusionFilter> extrude;\n  extrude->SetInputData(profile);\n  extrude->SetResolution(60);\n\n  vtkNew<vtkPolyDataMapper> map;\n  map->SetInputConnection(extrude->GetOutputPort());\n\n  vtkNew<vtkActor> bottle;\n  bottle->SetMapper(map);\n  bottle->GetProperty()->SetColor(colors->GetColor3d(\"Mint\").GetData());\n\n  // display the profile\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputData(profile);\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(stripper->GetOutputPort());\n  tubes->SetNumberOfSides(11);\n  tubes->SetRadius(0.05);\n\n  vtkNew<vtkPolyDataMapper> profileMapper;\n  profileMapper->SetInputConnection(tubes->GetOutputPort());\n\n  vtkNew<vtkActor> profileActor;\n  profileActor->SetMapper(profileMapper);\n  profileActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer->AddActor(bottle);\n  renderer->AddActor(profileActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"Bottle\");\n  renWin->Render();\n\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  // render the image\n  //\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Modelling/Bottle/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Bottle)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Bottle: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Bottle MACOSX_BUNDLE Bottle.cxx )\n  target_link_libraries(Bottle PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Bottle\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/Bottle/#download-and-build-bottle","title":"Download and Build Bottle","text":"

Click here to download Bottle and its CMakeLists.txt file. Once the tarball Bottle.tar has been downloaded and extracted,

cd Bottle/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Bottle\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/CappedSphere/","title":"CappedSphere","text":"

vtk-examples/Cxx/Modelling/CappedSphere

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Modelling/CappedSphere/#description","title":"Description","text":"

Demonstrates how to create a capped sphere.

Firstly a line is created in the x-z plane corresponding to an arc from +z to -z in the +x direction in the x-z plane, the length of the arc is specified in degrees.

Then the line is extended by dropping a perpendicular to the x-axis.

The points generated are then converted to a line and passed through to the vtkRotationalExtrusionFilter to generate the resultant 3D surface.

The parameters are:

  • angle - the arc length in degrees default 90\u00b0 (a hemisphere)
  • step -the step size of the arc in degrees, default 1\u00b0
  • radius - the radius of the arc default 1

Options are provided to:

  • Uncap the sphere (-u, --uncapped)
  • Display the line that was rotationally extruded (-s, --show_line)

Note

The coordinate system for specifying the arc is left-handed with 0\u00b0 aligned with the positive z-axis, 90\u00b0 aligned with the positive x-axis.

Note

You can substitute different parametric equations for x and z in the line generating function to get other shapes.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/CappedSphere/#code","title":"Code","text":"

CappedSphere.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRotationalExtrusionFilter.h>\n\n#include <array>\n#include <cmath>\n#include <iomanip>\n#include <iostream>\n#include <regex>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n/**\n * Get the points for a line.\n *\n * @param angle: Length of the arc in degrees.\n * @param step: Step size in degrees.\n * @param radius: Radius of the arc.\n * @param uncapped: True if uncapped.\n * @param start: Starting angle.\n * @return: A vector of points.\n */\nstd::vector<std::array<double, 3>>\nGetLine(double const& angle, double const& step, double const& radius,\n        bool const& noCap, double const& start);\n\n/**\n * Show the command line parameters.\n *\n * @param fn: The program name.\n */\nstd::string ShowUsage(std::string fn);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Our degree/radian conversions\n  constexpr auto pi = 3.141592653589793238462643383279502884L; /* pi */\n  auto d_r = [pi](long double d) { return pi * d / 180.0; };\n  // auto r_d = [pi](long double r) { return 180 * r / pi; };\n  auto isNumber = [](std::string const& token) {\n    return std::regex_match(\n        token, std::regex((\"((\\\\+|-)?[[:digit:]]+)(\\\\.(([[:digit:]]+)?))?\")));\n  };\n\n  auto angle = 90.0;\n  auto step = 1.0;\n  auto radius = 1.0;\n  auto uncapped = false;\n  auto showLine = false;\n\n  // The command line arguments\n  std::vector<std::string> cmdVec;\n  for (auto i = 1; i < argc; ++i)\n  {\n    cmdVec.push_back(argv[i]);\n  }\n  if (!cmdVec.empty())\n  {\n    // Look for parameters\n    auto posCnt = 0;\n    for (auto const& token : cmdVec)\n    {\n      if (token == \"-h\" || token == \"--help\")\n      {\n        std::cout << ShowUsage(argv[0]) << std::endl;\n        return EXIT_SUCCESS;\n      }\n      if (token == \"-u\" || token == \"--uncapped\")\n      {\n        uncapped = true;\n      }\n      if (token == \"-s\" || token == \"--show_line\")\n      {\n        showLine = true;\n      }\n      if (isNumber(token) && posCnt < 3)\n      {\n        switch (posCnt)\n        {\n        case 0:\n          angle = std::stod(token);\n          break;\n        case 1:\n          step = std::stod(token);\n          break;\n        case 2:\n          radius = std::stod(token);\n          break;\n        default:\n          break;\n        }\n        posCnt++;\n      }\n    }\n  }\n  angle = d_r(std::abs(angle));\n  step = d_r(std::abs(step));\n  radius = std::abs(radius);\n  // With default settings set this to 45 and you get a bowl with a flat bottom.\n  auto start = d_r(90);\n\n  auto pts = GetLine(angle, step, radius, uncapped, start);\n\n  // Setup points and lines\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> lines;\n  for (auto pt : pts)\n  {\n    unsigned long pt_id = points->InsertNextPoint(pt.data());\n    if (pt_id < pts.size() - 1)\n    {\n      vtkNew<vtkLine> line;\n      line->GetPointIds()->SetId(0, pt_id);\n      line->GetPointIds()->SetId(1, pt_id + 1);\n      lines->InsertNextCell(line);\n    }\n  }\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetLines(lines);\n\n  // Extrude the profile to make the capped sphere\n  vtkNew<vtkRotationalExtrusionFilter> extrude;\n  extrude->SetInputData(polydata);\n  extrude->SetResolution(60);\n\n  //  Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  // To see the line\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetLineWidth(4);\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  // To see the surface\n  vtkNew<vtkPolyDataMapper> surfaceMapper;\n  surfaceMapper->SetInputConnection(extrude->GetOutputPort());\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetColor(colors->GetColor3d(\"Khaki\").GetData());\n\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren->AddActor(surfaceActor);\n  if (showLine)\n  {\n    ren->AddActor(lineActor);\n  }\n  ren->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  ren->ResetCamera();\n  ren->GetActiveCamera()->Azimuth(0);\n  ren->GetActiveCamera()->Elevation(60);\n  ren->ResetCameraClippingRange();\n\n  renWin->SetSize(600, 600);\n  renWin->Render();\n  renWin->SetWindowName(\"CappedSphere\");\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::vector<std::array<double, 3>>\nGetLine(double const& angle, double const& step, double const& radius,\n        bool const& uncapped, double const& start)\n{\n  auto constexpr precision = 1.0e-06;\n  std::vector<std::array<double, 3>> pts;\n  // Do the curved line\n  auto theta = 0.0;\n  while (theta <= angle)\n  {\n    std::array<double, 3> p{{0.0, 0.0, 0.0}};\n    p[0] = radius * std::cos(start - theta);\n    p[2] = radius * std::sin(theta - start);\n    if (p[0] < 0)\n    {\n      p[0] = 0;\n      pts.push_back(p);\n      break;\n    }\n    if (std::abs(p[0]) < precision)\n    {\n      p[0] = 0;\n    }\n    if (std::abs(p[2]) < precision)\n    {\n      p[2] = 0;\n    }\n    pts.push_back(p);\n    theta += step;\n  }\n  if (!uncapped)\n  {\n    // Drop a perpendicular from the last point to the x-axis\n    if (pts.size() > 1)\n    {\n      std::array<double, 3> lastPoint = pts.back();\n      if (lastPoint[0] > 0)\n      {\n        auto numPts = 10;\n        auto interval = double(numPts) / radius;\n        auto i = 1;\n        while (i < numPts)\n        {\n          std::array<double, 3> p{{0.0, 0.0, lastPoint[2]}};\n          p[0] = lastPoint[0] - i / interval;\n          if (p[0] < 0)\n          {\n            p[0] = 0;\n            pts.push_back(p);\n            break;\n          }\n          if (std::abs(p[0]) < precision)\n          {\n            p[0] = 0;\n          }\n          if (std::abs(p[2]) < precision)\n          {\n            p[2] = 0;\n          }\n          pts.push_back(p);\n          ++i;\n        }\n      }\n      lastPoint = pts.back();\n      if (lastPoint[0] > precision)\n      {\n        std::array<double, 3> p{{0.0, 0.0, lastPoint[2]}};\n        pts.push_back(p);\n      }\n    }\n  }\n  return pts;\n}\n\nstd::string ShowUsage(std::string fn)\n{\n  // Remove the folder (if present) then emove the extension in this order\n  // since the folder name may contain perionds.\n  auto last_slash_idx = fn.find_last_of(\"\\\\/\");\n  if (std::string::npos != last_slash_idx)\n  {\n    fn.erase(0, last_slash_idx + 1);\n  }\n  // auto period_idx = fn.rfind('.');\n  // if (std::string::npos != period_idx)\n  //{\n  //  fn.erase(period_idx);\n  //}\n  std::ostringstream os;\n  os << \"\\nusage: \" << fn << \" [-h] [-u] [-s] [angle] [step] [radius]\\n\";\n  os << \"\\n\";\n  os << \"Display a capped sphere.\\n\";\n  os << \"\\n\";\n  os << \"positional arguments:\\n\";\n  os << \"  angle            The length of the arc in degrees from +z to -z in \"\n        \"the +x\\n\";\n  os << \"                   direction in the x-z plane.\\n\";\n  os << \"  step             Step size in degrees.\\n\";\n  os << \"  radius           Radius of the arc.\\n\";\n  os << \"\\n\";\n  os << \"optional arguments:\\n\";\n  os << \"  -h, --help       show this help message and exit\\n\";\n  os << \"  -u, --uncapped   Uncap the sphere.\\n\";\n  os << \"  -s, --show_line  Show the line that is rotationally extruded to \"\n        \"make the\\n\";\n  os << \"                   surface.\";\n  os << std::endl;\n  return os.str();\n}\n\n} // namespace\n
"},{"location":"Cxx/Modelling/CappedSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CappedSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CappedSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CappedSphere MACOSX_BUNDLE CappedSphere.cxx )\n  target_link_libraries(CappedSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CappedSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/CappedSphere/#download-and-build-cappedsphere","title":"Download and Build CappedSphere","text":"

Click here to download CappedSphere and its CMakeLists.txt file. Once the tarball CappedSphere.tar has been downloaded and extracted,

cd CappedSphere/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CappedSphere\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/ContourTriangulator/","title":"ContourTriangulator","text":"

vtk-examples/Cxx/Modelling/ContourTriangulator

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/ContourTriangulator/#code","title":"Code","text":"

ContourTriangulator.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourTriangulator.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMarchingSquares.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  std::string inputFileName;\n  if (argc > 1)\n  {\n    inputFileName = argv[1];\n  }\n  else\n  {\n    cout << \"Usage: \" << argv[0]\n         << \" png_file [iso value] e.g. fullhead15.png 500\" << endl;\n    return EXIT_FAILURE;\n  }\n  int isoValue = 500;\n  if (argc > 2)\n  {\n    isoValue = atoi(argv[2]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPNGReader> reader;\n  if (!reader->CanReadFile(inputFileName.c_str()))\n  {\n    std::cerr << \"Error: Could not read \" << inputFileName << \".\\n\";\n    return EXIT_FAILURE;\n  }\n  reader->SetFileName(inputFileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkMarchingSquares> iso;\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->SetValue(0, isoValue);\n\n  vtkNew<vtkDataSetMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MediumOrchid\").GetData());\n\n  vtkNew<vtkContourTriangulator> poly;\n  poly->SetInputConnection(iso->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> polyMapper;\n  polyMapper->SetInputConnection(poly->GetOutputPort());\n  polyMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> polyActor;\n  polyActor->SetMapper(polyMapper);\n  polyActor->GetProperty()->SetColor(colors->GetColor3d(\"Gray\").GetData());\n\n  // Standard rendering classes\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetMultiSamples(0);\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"ContourTriangulator\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(polyActor);\n  renderer->AddActor(isoActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renWin->SetSize(300, 300);\n\n  vtkCamera* camera = renderer->GetActiveCamera();\n  renderer->ResetCamera();\n  camera->Azimuth(180);\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Modelling/ContourTriangulator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ContourTriangulator)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ContourTriangulator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ContourTriangulator MACOSX_BUNDLE ContourTriangulator.cxx )\n  target_link_libraries(ContourTriangulator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ContourTriangulator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/ContourTriangulator/#download-and-build-contourtriangulator","title":"Download and Build ContourTriangulator","text":"

Click here to download ContourTriangulator and its CMakeLists.txt file. Once the tarball ContourTriangulator.tar has been downloaded and extracted,

cd ContourTriangulator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ContourTriangulator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/Delaunay3D/","title":"Delaunay3D","text":"

vtk-examples/Cxx/Modelling/Delaunay3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Modelling/Delaunay3D/#description","title":"Description","text":"

This example creates a tetrahedral mesh from unorganized points. The example uses the vtkDelaunay3D filter. The resulting mesh will be a solid convex hull of the original points. The example takes the points from a XML PolyData file (.vtp) produces the 3D Delaunay tetrahedralization (both with alpha = 0 and a non-zero alpha), and displays the result on the screen.

For alpha != 0 (right window), the tetra are yellow, the lines are blue and the triangles are red.

The example requires a .vtp file and an optional alpha.

Seealso

See Delaunay3DDemo to interactively adjust Alpha.

Note

This original source code for this example is here.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/Delaunay3D/#code","title":"Code","text":"

Delaunay3D.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkCleanPolyData.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDelaunay3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <sstream>\n\nint main(int argc, char* argv[])\n{\n  float alpha = 0.5;\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtp [alpha] e.g. Bunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  if (argc > 2)\n  {\n    alpha = atof(argv[2]);\n  }\n  // Read the file.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkNamedColors> color;\n\n  vtkNew<vtkDataSetMapper> originalMapper;\n  originalMapper->SetInputConnection(reader->GetOutputPort());\n  originalMapper->ScalarVisibilityOff();\n  originalMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(color->GetColor3d(\"tomato\").GetData());\n  originalActor->GetProperty()->SetInterpolationToFlat();\n\n  // Clean the polydata. This will remove duplicate points that may be\n  // present in the input data.\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(reader->GetOutputPort());\n\n  // Generate a tetrahedral mesh from the input points. By\n  // default, the generated volume is the convex hull of the points.\n  vtkNew<vtkDelaunay3D> delaunay3D;\n  delaunay3D->SetInputConnection(cleaner->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> delaunayMapper;\n  delaunayMapper->SetInputConnection(delaunay3D->GetOutputPort());\n  delaunayMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> delaunayActor;\n  delaunayActor->SetMapper(delaunayMapper);\n  delaunayActor->GetProperty()->SetColor(color->GetColor3d(\"banana\").GetData());\n  delaunayActor->GetProperty()->SetInterpolationToFlat();\n\n  // Generate a mesh from the input points. If Alpha is non-zero, then\n  // tetrahedra, triangles, edges and vertices that lie within the\n  // alpha radius are output.\n  vtkNew<vtkDelaunay3D> delaunay3DAlpha;\n  delaunay3DAlpha->SetInputConnection(cleaner->GetOutputPort());\n  delaunay3DAlpha->SetAlpha(alpha);\n  delaunay3DAlpha->Update();\n  std::cout << \"Alpha: \" << alpha << std::endl;\n\n  vtkNew<vtkUnsignedCharArray> cellData;\n  cellData->SetNumberOfComponents(3);\n\n  int numTetras = 0;\n  int numLines = 0;\n  int numTris = 0;\n  int numVerts = 0;\n\n  auto it = delaunay3DAlpha->GetOutput()->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    if (it->GetCellType() == VTK_TETRA)\n    {\n      numTetras++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Banana\").GetData());\n    }\n    else if (it->GetCellType() == VTK_LINE)\n    {\n      numLines++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Peacock\").GetData());\n    }\n    else if (it->GetCellType() == VTK_TRIANGLE)\n    {\n      numTris++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Tomato\").GetData());\n    }\n    else if (it->GetCellType() == VTK_VERTEX)\n    {\n      numVerts++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Lime\").GetData());\n    }\n  }\n  it->Delete();\n\n  std::stringstream ss;\n  ss << \"numTetras: \" << numTetras << std::endl;\n  ss << \"numLines: \" << numLines << std::endl;\n  ss << \"numTris: \" << numTris << std::endl;\n  ss << \"numVerts: \" << numVerts;\n\n  // Set the cell color depending on cell type.\n  delaunay3DAlpha->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  vtkNew<vtkDataSetMapper> delaunayAlphaMapper;\n  delaunayAlphaMapper->SetInputConnection(delaunay3DAlpha->GetOutputPort());\n  delaunayAlphaMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> delaunayAlphaActor;\n  delaunayAlphaActor->SetMapper(delaunayAlphaMapper);\n  delaunayAlphaActor->GetProperty()->SetPointSize(5.0);\n  delaunayAlphaActor->GetProperty()->SetInterpolationToFlat();\n\n  // Visualize\n\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetColor(color->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkTextMapper> textMapper;\n  textMapper->SetInput(ss.str().c_str());\n  textMapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetPosition(10, 10);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Shared camera\n  vtkNew<vtkCamera> sharedCamera;\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetActiveCamera(sharedCamera);\n\n  vtkNew<vtkRenderer> delaunayRenderer;\n  delaunayRenderer->SetActiveCamera(sharedCamera);\n\n  vtkNew<vtkRenderer> delaunayAlphaRenderer;\n  delaunayAlphaRenderer->SetActiveCamera(sharedCamera);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->SetWindowName(\"Delaunay3D\");\n\n  renderWindow->AddRenderer(originalRenderer);\n  originalRenderer->SetViewport(leftViewport);\n  renderWindow->AddRenderer(delaunayRenderer);\n  delaunayRenderer->SetViewport(centerViewport);\n  renderWindow->AddRenderer(delaunayAlphaRenderer);\n  delaunayAlphaRenderer->SetViewport(rightViewport);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  originalRenderer->AddActor(originalActor);\n  delaunayRenderer->AddActor(delaunayActor);\n  delaunayAlphaRenderer->AddActor(delaunayAlphaActor);\n  delaunayAlphaRenderer->AddViewProp(textActor);\n\n  originalRenderer->SetBackground(color->GetColor3d(\"Slate_Grey\").GetData());\n  delaunayRenderer->SetBackground(color->GetColor3d(\"Light_Grey\").GetData());\n  delaunayAlphaRenderer->SetBackground(color->GetColor3d(\"Grey\").GetData());\n\n  originalRenderer->ResetCamera();\n  renderWindow->Render();\n\n  // Render and interact.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Modelling/Delaunay3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Delaunay3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Delaunay3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Delaunay3D MACOSX_BUNDLE Delaunay3D.cxx )\n  target_link_libraries(Delaunay3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Delaunay3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/Delaunay3D/#download-and-build-delaunay3d","title":"Download and Build Delaunay3D","text":"

Click here to download Delaunay3D and its CMakeLists.txt file. Once the tarball Delaunay3D.tar has been downloaded and extracted,

cd Delaunay3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Delaunay3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/Delaunay3DDemo/","title":"Delaunay3DDemo","text":"

vtk-examples/Cxx/Modelling/Delaunay3DDemo

"},{"location":"Cxx/Modelling/Delaunay3DDemo/#description","title":"Description","text":"

This example creates a tetrahedral mesh from unorganized points. The example uses the vtkDelaunay3D filter. The resulting mesh will be a solid convex hull of the original points. The example takes the points from a XML PolyData file (.vtp) produces the 3D Delaunay tetrahedralization (both with alpha = 0 and a non-zero alpha), and displays the result on the screen.

For alpha != 0 (right window), the tetra are yellow, the lines are blue and the triangles are red.

Alpha can be changed interactively to see its affect on the resulting surface.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/Delaunay3DDemo/#code","title":"Code","text":"

Delaunay3DDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkCleanPolyData.h>\n#include <vtkCommand.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDelaunay3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <sstream>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n\nvoid MakeWidget(vtkSliderWidget*, vtkDelaunay3D*, vtkTextMapper*, vtkRenderer*,\n                vtkRenderWindowInteractor*);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtp [alpha] e.g. Bunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> color;\n\n  vtkNew<vtkDataSetMapper> originalMapper;\n  originalMapper->SetInputData(polyData);\n  originalMapper->ScalarVisibilityOff();\n  originalMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(color->GetColor3d(\"tomato\").GetData());\n  originalActor->GetProperty()->SetInterpolationToFlat();\n\n  // Clean the polydata. This will remove duplicate points that may be\n  // present in the input data.\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputData(polyData);\n\n  // Generate a tetrahedral mesh from the input points. By\n  // default, the generated volume is the convex hull of the points.\n  vtkNew<vtkDelaunay3D> delaunay3D;\n  delaunay3D->SetInputConnection(cleaner->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> delaunayMapper;\n  delaunayMapper->SetInputConnection(delaunay3D->GetOutputPort());\n  delaunayMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> delaunayActor;\n  delaunayActor->SetMapper(delaunayMapper);\n  delaunayActor->GetProperty()->SetColor(color->GetColor3d(\"banana\").GetData());\n  delaunayActor->GetProperty()->SetInterpolationToFlat();\n\n  // Generate a mesh from the input points. If Alpha is non-zero, then\n  // tetrahedra, triangles, edges and vertices that lie within the\n  // alpha radius are output.\n  vtkNew<vtkDelaunay3D> delaunay3DAlpha;\n  delaunay3DAlpha->SetInputConnection(cleaner->GetOutputPort());\n  delaunay3DAlpha->SetAlpha(0.0105);\n  delaunay3DAlpha->Update();\n\n  vtkNew<vtkUnsignedCharArray> cellData;\n  cellData->SetNumberOfComponents(3);\n\n  int numTetras = 0;\n  int numLines = 0;\n  int numTris = 0;\n  int numVerts = 0;\n\n  auto it = delaunay3DAlpha->GetOutput()->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    if (it->GetCellType() == VTK_TETRA)\n    {\n      numTetras++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Banana\").GetData());\n    }\n    else if (it->GetCellType() == VTK_LINE)\n    {\n      numLines++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Peacock\").GetData());\n    }\n    else if (it->GetCellType() == VTK_TRIANGLE)\n    {\n      numTris++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Tomato\").GetData());\n    }\n    else if (it->GetCellType() == VTK_VERTEX)\n    {\n      numVerts++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Lime\").GetData());\n    }\n  }\n  it->Delete();\n\n  std::stringstream ss;\n  ss << \"numTetras: \" << numTetras << std::endl;\n  ss << \"numLines: \" << numLines << std::endl;\n  ss << \"numTris: \" << numTris << std::endl;\n  ss << \"numVerts: \" << numVerts;\n\n  // Set the cell color depending on cell type.\n  delaunay3DAlpha->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  vtkNew<vtkDataSetMapper> delaunayAlphaMapper;\n  delaunayAlphaMapper->SetInputConnection(delaunay3DAlpha->GetOutputPort());\n  delaunayAlphaMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> delaunayAlphaActor;\n  delaunayAlphaActor->SetMapper(delaunayAlphaMapper);\n  delaunayAlphaActor->GetProperty()->SetPointSize(5.0);\n  delaunayAlphaActor->GetProperty()->SetInterpolationToFlat();\n\n  // Visualize\n\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetColor(color->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkTextMapper> textMapper;\n  textMapper->SetInput(ss.str().c_str());\n  textMapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetPosition(10, 10);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Shared camera\n  vtkNew<vtkCamera> sharedCamera;\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetActiveCamera(sharedCamera);\n  originalRenderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderer> delaunayRenderer;\n  delaunayRenderer->SetActiveCamera(sharedCamera);\n  delaunayRenderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderer> delaunayAlphaRenderer;\n  delaunayAlphaRenderer->SetActiveCamera(sharedCamera);\n  delaunayAlphaRenderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->SetWindowName(\"Delaunay3DDemo\");\n\n  renderWindow->AddRenderer(originalRenderer);\n  originalRenderer->SetViewport(leftViewport);\n\n  renderWindow->AddRenderer(delaunayRenderer);\n  delaunayRenderer->SetViewport(centerViewport);\n\n  renderWindow->AddRenderer(delaunayAlphaRenderer);\n  delaunayAlphaRenderer->SetViewport(rightViewport);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkSliderWidget> widget;\n  MakeWidget(widget, delaunay3DAlpha, textMapper, delaunayAlphaRenderer,\n             renderWindowInteractor);\n\n  originalRenderer->AddActor(originalActor);\n  delaunayRenderer->AddActor(delaunayActor);\n  delaunayAlphaRenderer->AddActor(delaunayAlphaActor);\n  delaunayAlphaRenderer->AddViewProp(textActor);\n\n  originalRenderer->SetBackground(color->GetColor3d(\"Slate_Grey\").GetData());\n  delaunayRenderer->SetBackground(color->GetColor3d(\"Light_Grey\").GetData());\n  delaunayAlphaRenderer->SetBackground(color->GetColor3d(\"Grey\").GetData());\n\n  originalRenderer->ResetCamera();\n  renderWindow->Render();\n\n  // Render and interact.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackAlpha : public vtkCommand\n{\npublic:\n  static SliderCallbackAlpha* New()\n  {\n    return new SliderCallbackAlpha;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->Delaunay3D->SetAlpha(value);\n    this->Delaunay3D->Update();\n\n    vtkNew<vtkUnsignedCharArray> cellData;\n    cellData->SetNumberOfComponents(3);\n\n    // Set the cell color depending on cell type.\n    vtkNew<vtkNamedColors> color;\n    int numTetras = 0;\n    int numLines = 0;\n    int numTris = 0;\n    int numVerts = 0;\n\n    auto it = this->Delaunay3D->GetOutput()->NewCellIterator();\n    for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n    {\n      if (it->GetCellType() == VTK_TETRA)\n      {\n        numTetras++;\n        cellData->InsertNextTypedTuple(color->GetColor3ub(\"Banana\").GetData());\n      }\n      else if (it->GetCellType() == VTK_LINE)\n      {\n        numLines++;\n        cellData->InsertNextTypedTuple(color->GetColor3ub(\"Peacock\").GetData());\n      }\n      else if (it->GetCellType() == VTK_TRIANGLE)\n      {\n        numTris++;\n        cellData->InsertNextTypedTuple(color->GetColor3ub(\"Tomato\").GetData());\n      }\n      else if (it->GetCellType() == VTK_VERTEX)\n      {\n        numVerts++;\n        cellData->InsertNextTypedTuple(color->GetColor3ub(\"Lime\").GetData());\n      }\n    }\n    it->Delete();\n\n    this->Delaunay3D->GetOutput()->GetCellData()->SetScalars(cellData);\n    std::stringstream ss;\n    ss << \"numTetras: \" << numTetras << std::endl;\n    ss << \"numLines: \" << numLines << std::endl;\n    ss << \"numTris: \" << numTris << std::endl;\n    ss << \"numVerts: \" << numVerts;\n    this->TextMapper->SetInput(ss.str().c_str());\n  }\n  SliderCallbackAlpha() : Delaunay3D(0), TextMapper(0)\n  {\n  }\n  vtkDelaunay3D* Delaunay3D;\n  vtkTextMapper* TextMapper;\n};\n\nvoid MakeWidget(vtkSliderWidget* widget, vtkDelaunay3D* delaunay3D,\n                vtkTextMapper* textMapper, vtkRenderer* renderer,\n                vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(.02);\n  double sliderLength(.04);\n  double titleHeight(.04);\n  double labelHeight(.04);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepAlpha;\n\n  sliderRepAlpha->SetRenderer(renderer);\n\n  sliderRepAlpha->SetMinimumValue(0.0001);\n  sliderRepAlpha->SetMaximumValue(1.0);\n  sliderRepAlpha->SetValue(delaunay3D->GetAlpha());\n  sliderRepAlpha->SetTitleText(\"Alpha\");\n  sliderRepAlpha->SetRenderer(renderer);\n  sliderRepAlpha->GetPoint1Coordinate()->SetValue(0.1, .1);\n  sliderRepAlpha->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n  sliderRepAlpha->GetPoint2Coordinate()->SetValue(.9, .1);\n  sliderRepAlpha->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepAlpha->SetTubeWidth(tubeWidth);\n  sliderRepAlpha->SetSliderLength(sliderLength);\n  sliderRepAlpha->SetTitleHeight(titleHeight);\n  sliderRepAlpha->SetLabelHeight(labelHeight);\n  sliderRepAlpha->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepAlpha->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepAlpha->BuildRepresentation();\n\n  widget->SetRepresentation(sliderRepAlpha);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(2);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackAlpha> callbackAlpha;\n  callbackAlpha->Delaunay3D = delaunay3D;\n  callbackAlpha->TextMapper = textMapper;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackAlpha);\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Modelling/Delaunay3DDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Delaunay3DDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Delaunay3DDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Delaunay3DDemo MACOSX_BUNDLE Delaunay3DDemo.cxx )\n  target_link_libraries(Delaunay3DDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Delaunay3DDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/Delaunay3DDemo/#download-and-build-delaunay3ddemo","title":"Download and Build Delaunay3DDemo","text":"

Click here to download Delaunay3DDemo and its CMakeLists.txt file. Once the tarball Delaunay3DDemo.tar has been downloaded and extracted,

cd Delaunay3DDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Delaunay3DDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/DelaunayMesh/","title":"DelaunayMesh","text":"

vtk-examples/Cxx/Modelling/DelaunayMesh

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Modelling/DelaunayMesh/#description","title":"Description","text":"

This is two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with spheres and tubes.

Info

See Figure 9-54 in Chapter 9 The VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/DelaunayMesh/#code","title":"Code","text":"

DelaunayMesh.cxx

/*\nThis code is based on the VTK file: Examples/Modelling/Tcl/DelMesh.py.\n\nThis example demonstrates how to use 2D Delaunay triangulation.\nWe create a fancy image of a 2D Delaunay triangulation. Points are\n randomly generated.\n*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDelaunay2D.h>\n#include <vtkExtractEdges.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTubeFilter.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Generate some \"random\" points.\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(1);\n  for (auto i = 0; i < 50; ++i)\n  {\n    double p1;\n    double p2;\n    p1 = randomSequence->GetValue();\n    randomSequence->Next();\n    p2 = randomSequence->GetValue();\n    randomSequence->Next();\n    points->InsertPoint(i, p1, p2, 0.0);\n  }\n  // Create a polydata with the points we just created.\n  vtkNew<vtkPolyData> profile;\n  profile->SetPoints(points);\n\n  // Perform a 2D Delaunay triangulation on them.\n  vtkNew<vtkDelaunay2D> delny;\n  delny->SetInputData(profile);\n  delny->SetTolerance(0.001);\n  vtkNew<vtkPolyDataMapper> mapMesh;\n  mapMesh->SetInputConnection(delny->GetOutputPort());\n  vtkNew<vtkActor> meshActor;\n  meshActor->SetMapper(mapMesh);\n  meshActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // We will now create a nice looking mesh by wrapping the edges in tubes,\n  // and putting fat spheres at the points.\n  vtkNew<vtkExtractEdges> extract;\n  extract->SetInputConnection(delny->GetOutputPort());\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(extract->GetOutputPort());\n  tubes->SetRadius(0.01);\n  tubes->SetNumberOfSides(6);\n  vtkNew<vtkPolyDataMapper> mapEdges;\n  mapEdges->SetInputConnection(tubes->GetOutputPort());\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(mapEdges);\n  edgeActor->GetProperty()->SetColor(colors->GetColor3d(\"peacock\").GetData());\n  edgeActor->GetProperty()->SetSpecularColor(1, 1, 1);\n  edgeActor->GetProperty()->SetSpecular(0.3);\n  edgeActor->GetProperty()->SetSpecularPower(20);\n  edgeActor->GetProperty()->SetAmbient(0.2);\n  edgeActor->GetProperty()->SetDiffuse(0.8);\n\n  vtkNew<vtkSphereSource> ball;\n  ball->SetRadius(0.025);\n  ball->SetThetaResolution(12);\n  ball->SetPhiResolution(12);\n  vtkNew<vtkGlyph3D> balls;\n  balls->SetInputConnection(delny->GetOutputPort());\n  balls->SetSourceConnection(ball->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> mapBalls;\n  mapBalls->SetInputConnection(balls->GetOutputPort());\n  vtkNew<vtkActor> ballActor;\n  ballActor->SetMapper(mapBalls);\n  ballActor->GetProperty()->SetColor(colors->GetColor3d(\"hot_pink\").GetData());\n  ballActor->GetProperty()->SetSpecularColor(1, 1, 1);\n  ballActor->GetProperty()->SetSpecular(0.3);\n  ballActor->GetProperty()->SetSpecularPower(20);\n  ballActor->GetProperty()->SetAmbient(0.2);\n  ballActor->GetProperty()->SetDiffuse(0.8);\n\n  // Create the rendering window, renderer, and interactive renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(ballActor);\n  ren->AddActor(edgeActor);\n  ren->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"DelaunayMesh\");\n\n  ren->ResetCamera();\n  ren->GetActiveCamera()->Zoom(1.3);\n\n  // Interact with the data.\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Modelling/DelaunayMesh/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DelaunayMesh)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DelaunayMesh: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DelaunayMesh MACOSX_BUNDLE DelaunayMesh.cxx )\n  target_link_libraries(DelaunayMesh PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DelaunayMesh\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/DelaunayMesh/#download-and-build-delaunaymesh","title":"Download and Build DelaunayMesh","text":"

Click here to download DelaunayMesh and its CMakeLists.txt file. Once the tarball DelaunayMesh.tar has been downloaded and extracted,

cd DelaunayMesh/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DelaunayMesh\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/DiscreteMarchingCubes/","title":"DiscreteMarchingCubes","text":"

vtk-examples/Cxx/Modelling/DiscreteMarchingCubes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Modelling/DiscreteMarchingCubes/#description","title":"Description","text":"

Creates surfaces from labeled data. Volume data does not always contain samples of continuous data. A volume may contain discrete integer values, often the result of segmentation. vtkDiscreteFlyingEdges3D or vtkDiscreteMarchingCubes create surfaces from these segmented volumes using a modified flying edges or marching cubes algorithm. The algorithm generates one or more models representing the boundaries between the specified label and the adjacent structures. One or more label values must be specified to generate the models. The boundary positions are always defined to be half-way between adjacent voxels.

Seealso

SmoothDiscreteMarchingCubes produces smooth models.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/DiscreteMarchingCubes/#code","title":"Code","text":"

DiscreteMarchingCubes.cxx

#include <vtkActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageThreshold.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphere.h>\n#include <vtkVersion.h>\n\n// vtkDiscreteFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n\n#endif\n#undef USE_FLYING_EDGES\n#ifdef USE_FLYING_EDGES\n#include <vtkDiscreteFlyingEdges3D.h>\n#else\n#include <vtkDiscreteMarchingCubes.h>\n#endif\n\nnamespace {\nvtkSmartPointer<vtkLookupTable> MakeColors(unsigned int n);\n\nvtkSmartPointer<vtkImageData> MakeBlob(int n, double radius);\n} // namespace\n\nint main(int /*argc*/, char* /* argv */[])\n{\n  int n = 20;\n  double radius = 8;\n\n  vtkSmartPointer<vtkImageData> blob = MakeBlob(n, radius);\n\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkDiscreteFlyingEdges3D> discrete;\n#else\n  vtkNew<vtkDiscreteMarchingCubes> discrete;\n#endif\n  discrete->SetInputData(blob);\n  discrete->GenerateValues(n, 1, n);\n\n  vtkSmartPointer<vtkLookupTable> lut = MakeColors(n);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(discrete->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, lut->GetNumberOfColors());\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"DiscreteMarchingCubes\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  ren1->AddActor(actor);\n\n  vtkNew<vtkNamedColors> colors;\n  ren1->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkImageData> MakeBlob(int n, double radius)\n{\n  vtkNew<vtkImageData> blobImage;\n\n  double maxR = 50 - 2.0 * radius;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(5071);\n  for (int i = 0; i < n; ++i)\n  {\n    vtkNew<vtkSphere> sphere;\n    sphere->SetRadius(radius);\n    auto x = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n    auto y = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n    auto z = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n\n    sphere->SetCenter(int(x), int(y), int(z));\n\n    vtkNew<vtkSampleFunction> sampler;\n    sampler->SetImplicitFunction(sphere);\n    sampler->SetOutputScalarTypeToFloat();\n    sampler->SetSampleDimensions(100, 100, 100);\n    sampler->SetModelBounds(-50, 50, -50, 50, -50, 50);\n\n    vtkNew<vtkImageThreshold> thres;\n    thres->SetInputConnection(sampler->GetOutputPort());\n    thres->ThresholdByLower(radius * radius);\n    thres->ReplaceInOn();\n    thres->ReplaceOutOn();\n    thres->SetInValue(i + 1);\n    thres->SetOutValue(0);\n    thres->Update();\n    if (i == 0)\n    {\n      blobImage->DeepCopy(thres->GetOutput());\n    }\n\n    vtkNew<vtkImageMathematics> maxValue;\n    maxValue->SetInputData(0, blobImage);\n    maxValue->SetInputData(1, thres->GetOutput());\n    maxValue->SetOperationToMax();\n    maxValue->Modified();\n    maxValue->Update();\n\n    blobImage->DeepCopy(maxValue->GetOutput());\n  }\n  return blobImage;\n}\n\n// Generate some random colors.\nvtkSmartPointer<vtkLookupTable> MakeColors(unsigned int n)\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(n);\n  lut->SetTableRange(0, n - 1);\n  lut->SetScaleToLinear();\n  lut->Build();\n  lut->SetTableValue(0, 0, 0, 0, 1);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(5071);\n  for (int i = 1; i < static_cast<int>(n); ++i)\n  {\n    auto r = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    auto g = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    auto b = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    lut->SetTableValue(i, r, g, b, 1.0);\n  }\n  return lut;\n}\n} // namespace\n
"},{"location":"Cxx/Modelling/DiscreteMarchingCubes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DiscreteMarchingCubes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  ImagingCore\n  ImagingHybrid\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DiscreteMarchingCubes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DiscreteMarchingCubes MACOSX_BUNDLE DiscreteMarchingCubes.cxx )\n  target_link_libraries(DiscreteMarchingCubes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DiscreteMarchingCubes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/DiscreteMarchingCubes/#download-and-build-discretemarchingcubes","title":"Download and Build DiscreteMarchingCubes","text":"

Click here to download DiscreteMarchingCubes and its CMakeLists.txt file. Once the tarball DiscreteMarchingCubes.tar has been downloaded and extracted,

cd DiscreteMarchingCubes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DiscreteMarchingCubes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/ExtractLargestIsosurface/","title":"ExtractLargestIsosurface","text":"

vtk-examples/Cxx/Modelling/ExtractLargestIsosurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Modelling/ExtractLargestIsosurface/#description","title":"Description","text":"
  • Contributed by: Jinyoung Hwang

This example reads a structured points dataset stored in a .vtk file and constructs a 3D model using vtkFlyingEdges3D or vtkMarchingCubes, vtkPolyDataConnectivityFilter is used to extract the largest isosurface.

Data is available at:

  1. test.vtk: http://web.kaist.ac.kr/~hjy/test.vtk

  2. brainweb.img: http://web.kaist.ac.kr/~hjy/brainweb.img

  3. brainweb.hdr: http://web.kaist.ac.kr/~hjy/brainweb.hdr

Second and third datasets can be downloaded from BrainWeb, which is free of charge in use for a research. \"test.vtk\" was converted from \"brainweb.img\" using a program by Erik Vidholm (http://www.cb.uu.se/~erik/vtk/rawToVTK.cpp).

The examples expects 2 or 3 argments:

 ExtractLargestIsosurface InputFilename Threshold (ExtractLargest)\n

if ExtractLargest is omitted or 1, the largest isosurface is extracted

if ExtractLargest is 0 (or -a in Python), all of the isosurfaces are extracted

Try

ExtractLargestIsosurface test.vtk 50

and compare the results to

ExtractLargestIsosurface test.vtk 50 0

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/ExtractLargestIsosurface/#code","title":"Code","text":"

ExtractLargestIsosurface.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMarchingCubes.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" InputFile(.vtk) Threshold e.g. brain.vtk 50 1\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  const char* fileName = argv[1];\n  float threshold = atof(argv[2]);\n  auto extractLargest = true;\n  if (argc == 4)\n  {\n    extractLargest = atoi(argv[3]) == 1;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> skinColor{{240, 184, 160, 255}};\n  colors->SetColor(\"SkinColor\", skinColor.data());\n  std::array<unsigned char, 4> backColor{{255, 229, 200, 255}};\n  colors->SetColor(\"BackfaceColor\", backColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n\n  // Load data\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(fileName);\n\n  // Create a 3D model using flying edges or marching cubes.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> mc;\n#else\n  vtkNew<vtkMarchingCubes> mc;\n#endif\n\n  mc->SetInputConnection(reader->GetOutputPort());\n  mc->ComputeNormalsOn();\n  mc->ComputeGradientsOn();\n  mc->SetValue(0, threshold); // Second value acts as threshold.\n\n  // To remain largest region.\n  vtkNew<vtkPolyDataConnectivityFilter> confilter;\n  confilter->SetInputConnection(mc->GetOutputPort());\n  confilter->SetExtractionModeToLargestRegion();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  if (extractLargest)\n  {\n    mapper->SetInputConnection(confilter->GetOutputPort());\n  }\n  else\n  {\n    mapper->SetInputConnection(mc->GetOutputPort());\n  }\n  mapper->ScalarVisibilityOff();\n\n  // Visualize\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"SkinColor\").GetData());\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"BackfaceColor\").GetData());\n  actor->SetBackfaceProperty(backProp);\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->GetActiveCamera()->SetViewUp(0.0, 0.0, 1.0);\n  renderer->GetActiveCamera()->SetPosition(0.0, 1.0, 0.0);\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Elevation(30.0);\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(renderer);\n  renwin->SetSize(640, 480);\n  renwin->SetWindowName(\"ExtractLargestIsosurface\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n  renwin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Modelling/ExtractLargestIsosurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractLargestIsosurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractLargestIsosurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractLargestIsosurface MACOSX_BUNDLE ExtractLargestIsosurface.cxx )\n  target_link_libraries(ExtractLargestIsosurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractLargestIsosurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/ExtractLargestIsosurface/#download-and-build-extractlargestisosurface","title":"Download and Build ExtractLargestIsosurface","text":"

Click here to download ExtractLargestIsosurface and its CMakeLists.txt file. Once the tarball ExtractLargestIsosurface.tar has been downloaded and extracted,

cd ExtractLargestIsosurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractLargestIsosurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/Finance/","title":"Finance","text":"

vtk-examples/Cxx/Modelling/Finance

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Modelling/Finance/#description","title":"Description","text":"

The first step is to choose dependent and independent variables. This choice is essentially a mapping from multidimensional data into an unstructured point dataset. This example chooses MONTHLY_PAYMENT, INTEREST_RATE, and LOAN_AMOUNT as (x, y, z) point coordinates, and TIME_LATE as a scalar value. This maps four of six variables. For now we will ignore the other two variables.

The example uses vtkGaussianSplatter to perform the splatting operation (i.e., conversion from unstructured points to volume dataset). This is followed by an isosurface extraction. We splat the data two times. The first time we splat the entire population. This is to show context and appears as gray/ wireframe in the figure. The second time we splat the data and scale it by the value of TIME_LATE . As a result, only payments that are late contribute to the second isosurface. The results of this visualization are interesting. First, we see that there is a strong correlation between the two independent variables MONTHLY_PAYMENT and LOAN_AMOUNT . (This is more evident when viewing the data interactively.) We see that the data falls roughly on a plane at a 45 degree angle between these two axes. With a little reflection this is evident: the monthly payment is strongly a function of loan amount (as well as interest rate and payment period). Second, we see that there is a clustering of delinquent accounts within the total population. The cluster tends to grow with larger interest rates and shrink with smaller monthly payments and loan amounts. Although the relationship with interest rate is expected, the clustering towards smaller monthly payments is not. Thus our visualization has provided a clue into the data. Further exploration may reveal the reason(s), or we may perform additional data analysis and acquisition to understand the phenomena.

One important note about multidimensional visualization. Because we tend to combine variables in odd ways (e.g., the use of MONTHLY_PAYMENT , INTEREST_RATE , and LOAN_AMOUNT as (x, y, z) coordinates), normalization of the data is usually required. To normalize data we simply adjust data values to lie between (0,1). Otherwise our data can be badly skewed and result in poor visualizations.

Info

See Figure 9-50 in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/Finance/#code","title":"Code","text":"

Finance.cxx

#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkDataSet.h>\n#include <vtkFloatArray.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <algorithm>\n#include <array>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkDataSet> ReadFinancialData(const char* fname, const char* x,\n                                              const char* y, const char* z,\n                                              const char* s);\n\nint ParseFile(FILE* file, const char* tag, float* data);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  double bounds[6];\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" financial_file e.g. financial.txt\"\n              << endl;\n    return EXIT_FAILURE;\n  }\n  char* fname = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the color for the population.\n  std::array<unsigned char, 4> popColor{{230, 230, 230, 255}};\n  colors->SetColor(\"PopColor\", popColor.data());\n\n  // Read the data.\n  auto dataSet = ReadFinancialData(fname, \"MONTHLY_PAYMENT\", \"INTEREST_RATE\",\n                                   \"LOAN_AMOUNT\", \"TIME_LATE\");\n  // Construct the pipeline for the original population.\n  vtkNew<vtkGaussianSplatter> popSplatter;\n  popSplatter->SetInputData(dataSet);\n  popSplatter->SetSampleDimensions(100, 100, 100);\n  popSplatter->SetRadius(0.05);\n  popSplatter->ScalarWarpingOff();\n\n  vtkNew<vtkContourFilter> popSurface;\n  popSurface->SetInputConnection(popSplatter->GetOutputPort());\n  popSurface->SetValue(0, 0.01);\n\n  vtkNew<vtkPolyDataMapper> popMapper;\n  popMapper->SetInputConnection(popSurface->GetOutputPort());\n  popMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> popActor;\n  popActor->SetMapper(popMapper);\n  popActor->GetProperty()->SetOpacity(0.3);\n  popActor->GetProperty()->SetColor(colors->GetColor3d(\"popColor\").GetData());\n\n  // Construct the pipeline for the delinquent population.\n  vtkNew<vtkGaussianSplatter> lateSplatter;\n  lateSplatter->SetInputData(dataSet);\n  lateSplatter->SetSampleDimensions(50, 50, 50);\n  lateSplatter->SetRadius(0.05);\n  lateSplatter->SetScaleFactor(0.005);\n\n  vtkNew<vtkContourFilter> lateSurface;\n  lateSurface->SetInputConnection(lateSplatter->GetOutputPort());\n  lateSurface->SetValue(0, 0.01);\n\n  vtkNew<vtkPolyDataMapper> lateMapper;\n  lateMapper->SetInputConnection(lateSurface->GetOutputPort());\n  lateMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> lateActor;\n  lateActor->SetMapper(lateMapper);\n  lateActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  // Create axes.\n  popSplatter->Update();\n  popSplatter->GetOutput()->GetBounds(bounds);\n\n  vtkNew<vtkAxes> axes;\n  axes->SetOrigin(bounds[0], bounds[2], bounds[4]);\n  axes->SetScaleFactor(popSplatter->GetOutput()->GetLength() / 5);\n\n  vtkNew<vtkTubeFilter> axesTubes;\n  axesTubes->SetInputConnection(axes->GetOutputPort());\n  axesTubes->SetRadius(axes->GetScaleFactor() / 25.0);\n  axesTubes->SetNumberOfSides(6);\n\n  vtkNew<vtkPolyDataMapper> axesMapper;\n  axesMapper->SetInputConnection(axesTubes->GetOutputPort());\n\n  vtkNew<vtkActor> axesActor;\n  axesActor->SetMapper(axesMapper);\n\n  // Graphics stuff.\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"Financial\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renWin);\n\n  // Set up the renderer.\n  renderer->AddActor(lateActor);\n  renderer->AddActor(axesActor);\n  renderer->AddActor(popActor);\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(640, 480);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.3);\n  renderer->ResetCameraClippingRange();\n\n  // Interact with the data.\n  renWin->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkDataSet> ReadFinancialData(const char* filename,\n                                              const char* x, const char* y,\n                                              const char* z, const char* s)\n{\n  float xyz[3];\n  FILE* file;\n  int i, npts;\n  char tag[80];\n\n  if ((file = fopen(filename, \"r\")) == 0)\n  {\n    std::cerr << \"ERROR: Can't open file: \" << filename << std::endl;\n    return nullptr;\n  }\n\n  int n = fscanf(file, \"%79s %d\", tag, &npts); // read number of points\n  if (n != 2)\n  {\n    std::cerr << \"ERROR: Can't read file: \" << filename << std::endl;\n    fclose(file);\n    return NULL;\n  }\n  // Check for a reasonable npts.\n  if (npts <= 0)\n  {\n    std::cerr << \"ERROR: Number of points must be greater that 0\" << std::endl;\n    fclose(file);\n    return NULL;\n  }\n  // We arbitrarily pick a large upper limit on npts.\n  if (npts > VTK_INT_MAX / 10)\n  {\n    std::cerr << \"ERROR: npts (\" << npts << \") is unreasonably large\"\n              << std::endl;\n    fclose(file);\n    return NULL;\n  }\n  vtkNew<vtkUnstructuredGrid> dataSet;\n  float* xV = new float[npts];\n  float* yV = new float[npts];\n  float* zV = new float[npts];\n  float* sV = new float[npts];\n\n  if (!ParseFile(file, x, xV) || !ParseFile(file, y, yV) ||\n      !ParseFile(file, z, zV) || !ParseFile(file, s, sV))\n  {\n    std::cerr << \"ERROR: Couldn't read data!\" << std::endl;\n    delete[] xV;\n    delete[] yV;\n    delete[] zV;\n    delete[] sV;\n    fclose(file);\n    return NULL;\n  }\n\n  vtkNew<vtkPoints> newPts;\n  vtkNew<vtkFloatArray> newScalars;\n\n  for (i = 0; i < npts; i++)\n  {\n    xyz[0] = xV[i];\n    xyz[1] = yV[i];\n    xyz[2] = zV[i];\n    //     std::cout << xV[i] << \" \" << yV[i] << \" \" << zV[i] << std::endl;\n    newPts->InsertPoint(i, xyz);\n    newScalars->InsertValue(i, sV[i]);\n  }\n\n  dataSet->SetPoints(newPts);\n  dataSet->GetPointData()->SetScalars(newScalars);\n\n  // cleanup\n  delete[] xV;\n  delete[] yV;\n  delete[] zV;\n  delete[] sV;\n  fclose(file);\n\n  return dataSet;\n}\n\nint ParseFile(FILE* file, const char* label, float* data)\n{\n  char tag[80];\n  int i, npts, readData = 0;\n  float min = VTK_FLOAT_MAX;\n  float max = (-VTK_FLOAT_MAX);\n\n  if (file == NULL || label == NULL)\n    return 0;\n\n  rewind(file);\n\n  if (fscanf(file, \"%79s %d\", tag, &npts) != 2)\n  {\n    std::cerr << \"ERROR: IO Error \" << __FILE__ << \":\" << __LINE__ << std::endl;\n    return 0;\n  }\n  while (!readData && fscanf(file, \"%79s\", tag) == 1)\n  {\n    if (!strcmp(tag, label))\n    {\n      readData = 1;\n      for (i = 0; i < npts; i++)\n      {\n        if (fscanf(file, \"%f\", data + i) != 1)\n        {\n          std::cerr << \"ERROR: IO Error \" << __FILE__ << \":\" << __LINE__\n                    << std::endl;\n          return 0;\n        }\n        if (data[i] < min)\n          min = data[i];\n        if (data[i] > min)\n          max = data[i];\n      }\n      // normalize data\n      for (i = 0; i < npts; i++) data[i] = min + data[i] / (max - min);\n    }\n    else\n    {\n      for (i = 0; i < npts; i++)\n      {\n        if (fscanf(file, \"%*f\") != 0)\n        {\n          std::cerr << \"ERROR: IO Error \" << __FILE__ << \":\" << __LINE__\n                    << std::endl;\n          return 0;\n        }\n      }\n    }\n  }\n\n  if (!readData)\n    return 0;\n  else\n    return 1;\n}\n} // namespace\n
"},{"location":"Cxx/Modelling/Finance/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Finance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Finance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Finance MACOSX_BUNDLE Finance.cxx )\n  target_link_libraries(Finance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Finance\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/Finance/#download-and-build-finance","title":"Download and Build Finance","text":"

Click here to download Finance and its CMakeLists.txt file. Once the tarball Finance.tar has been downloaded and extracted,

cd Finance/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Finance\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/FinanceFieldData/","title":"FinanceFieldData","text":"

vtk-examples/Cxx/Modelling/FinanceFieldData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Modelling/FinanceFieldData/#description","title":"Description","text":"

This example is similar to Finance, but here we read a .vtk file with vtkDataObjectReader. The file is: src/Testing/Data/financial.vtk.

The generated image is Figure 5 in VTKFileFormats.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/FinanceFieldData/#code","title":"Code","text":"

FinanceFieldData.cxx

#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkDataObjectReader.h>\n#include <vtkDataObjectToDataSetFilter.h>\n#include <vtkFieldDataToAttributeDataFilter.h>\n#include <vtkFollower.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkImageData.h>\n#include <vtkMarchingContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n#include <vtkVectorText.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" financial.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataObjectReader> reader;\n  reader->SetFileName(argv[1]);\n\n  int size = 3187; // maximum number possible\n\n  std::string xAxis = \"INTEREST_RATE\";\n  std::string yAxis = \"MONTHLY_PAYMENT\";\n  std::string zAxis = \"MONTHLY_INCOME\";\n  std::string scalar = \"TIME_LATE\";\n\n  // Extract the data from field as a polydata (just points),\n  // then extract scalars.\n  vtkNew<vtkDataObjectToDataSetFilter> do2ds;\n  do2ds->SetInputConnection(reader->GetOutputPort());\n  do2ds->SetDataSetTypeToPolyData();\n  // format: component//, arrayname, arraycomp, minArrayId, maxArrayId,\n  // Normalize\n  do2ds->DefaultNormalizeOn();\n  do2ds->SetPointComponent(0, const_cast<char*>(xAxis.c_str()), 0);\n  do2ds->SetPointComponent(1, const_cast<char*>(yAxis.c_str()), 0, 0, size, 1);\n  do2ds->SetPointComponent(2, const_cast<char*>(zAxis.c_str()), 0);\n  do2ds->Update();\n  vtkNew<vtkFieldDataToAttributeDataFilter> fd2ad;\n  fd2ad->SetInputConnection(do2ds->GetOutputPort());\n  fd2ad->SetInputFieldToDataObjectField();\n  fd2ad->SetOutputAttributeDataToPointData();\n  fd2ad->DefaultNormalizeOn();\n  fd2ad->SetScalarComponent(0, scalar.c_str(), 0);\n\n  // Construct pipeline for the original population.\n  vtkNew<vtkGaussianSplatter> popSplatter;\n  popSplatter->SetInputConnection(fd2ad->GetOutputPort());\n  popSplatter->SetSampleDimensions(150, 150, 150);\n  popSplatter->SetRadius(0.05);\n  popSplatter->ScalarWarpingOff();\n\n  vtkNew<vtkMarchingContourFilter> popSurface;\n  popSurface->SetInputConnection(popSplatter->GetOutputPort());\n  popSurface->SetValue(0, 0.01);\n  vtkNew<vtkPolyDataMapper> popMapper;\n  popMapper->SetInputConnection(popSurface->GetOutputPort());\n  popMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> popActor;\n  popActor->SetMapper(popMapper);\n  popActor->GetProperty()->SetOpacity(0.3);\n  popActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Construct the pipeline for the delinquent population.\n  vtkNew<vtkGaussianSplatter> lateSplatter;\n  lateSplatter->SetInputConnection(fd2ad->GetOutputPort());\n  lateSplatter->SetSampleDimensions(150, 150, 150);\n  lateSplatter->SetRadius(0.05);\n  lateSplatter->SetScaleFactor(0.05);\n\n  vtkNew<vtkMarchingContourFilter> lateSurface;\n  lateSurface->SetInputConnection(lateSplatter->GetOutputPort());\n  lateSurface->SetValue(0, 0.01);\n  vtkNew<vtkPolyDataMapper> lateMapper;\n  lateMapper->SetInputConnection(lateSurface->GetOutputPort());\n  lateMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> lateActor;\n  lateActor->SetMapper(lateMapper);\n  lateActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create axes.\n  popSplatter->Update();\n  double* bounds;\n  bounds = popSplatter->GetOutput()->GetBounds();\n  vtkNew<vtkAxes> axes;\n  axes->SetOrigin(bounds[0], bounds[2], bounds[4]);\n  axes->SetScaleFactor(popSplatter->GetOutput()->GetLength() / 5.0);\n  vtkNew<vtkTubeFilter> axesTubes;\n  axesTubes->SetInputConnection(axes->GetOutputPort());\n  axesTubes->SetRadius(axes->GetScaleFactor() / 25.0);\n  axesTubes->SetNumberOfSides(6);\n  vtkNew<vtkPolyDataMapper> axesMapper;\n  axesMapper->SetInputConnection(axesTubes->GetOutputPort());\n  vtkNew<vtkActor> axesActor;\n  axesActor->SetMapper(axesMapper);\n\n  // Label the axes.\n  vtkNew<vtkVectorText> XText;\n  XText->SetText(const_cast<char*>(xAxis.c_str()));\n  vtkNew<vtkPolyDataMapper> XTextMapper;\n  XTextMapper->SetInputConnection(XText->GetOutputPort());\n\n  vtkNew<vtkFollower> XActor;\n  XActor->SetMapper(XTextMapper);\n  XActor->SetScale(0.02, .02, .02);\n  XActor->SetPosition(0.35, -0.05, -0.05);\n  XActor->GetProperty()->SetColor(0, 0, 0);\n\n  vtkNew<vtkVectorText> YText;\n  YText->SetText(const_cast<char*>(yAxis.c_str()));\n\n  vtkNew<vtkPolyDataMapper> YTextMapper;\n  YTextMapper->SetInputConnection(YText->GetOutputPort());\n  vtkNew<vtkFollower> YActor;\n  YActor->SetMapper(YTextMapper);\n  YActor->SetScale(0.02, .02, .02);\n  YActor->SetPosition(-0.05, 0.35, -0.05);\n  YActor->GetProperty()->SetColor(0, 0, 0);\n\n  vtkNew<vtkVectorText> ZText;\n  ZText->SetText(const_cast<char*>(zAxis.c_str()));\n  vtkNew<vtkPolyDataMapper> ZTextMapper;\n  ZTextMapper->SetInputConnection(ZText->GetOutputPort());\n  vtkNew<vtkFollower> ZActor;\n  ZActor->SetMapper(ZTextMapper);\n  ZActor->SetScale(0.02, .02, .02);\n  ZActor->SetPosition(-0.05, -0.05, 0.35);\n  ZActor->GetProperty()->SetColor(0, 0, 0);\n\n  // Graphics stuff.\n  //\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"FinanceFieldData\");\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  renderer->AddActor(axesActor);\n  renderer->AddActor(lateActor);\n  renderer->AddActor(XActor);\n  renderer->AddActor(YActor);\n  renderer->AddActor(ZActor);\n  renderer->AddActor(popActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->SetSize(650, 480);\n\n  vtkNew<vtkCamera> camera;\n  camera->SetClippingRange(.274, 13.72);\n  camera->SetFocalPoint(0.433816, 0.333131, 0.449);\n  camera->SetPosition(-1.96987, 1.15145, 1.49053);\n  camera->SetViewUp(0.378927, 0.911821, 0.158107);\n  renderer->SetActiveCamera(camera);\n  XActor->SetCamera(camera);\n  YActor->SetCamera(camera);\n  ZActor->SetCamera(camera);\n\n  // Render and interact with the data.\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Modelling/FinanceFieldData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FinanceFieldData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  IOLegacy\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FinanceFieldData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FinanceFieldData MACOSX_BUNDLE FinanceFieldData.cxx )\n  target_link_libraries(FinanceFieldData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FinanceFieldData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/FinanceFieldData/#download-and-build-financefielddata","title":"Download and Build FinanceFieldData","text":"

Click here to download FinanceFieldData and its CMakeLists.txt file. Once the tarball FinanceFieldData.tar has been downloaded and extracted,

cd FinanceFieldData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FinanceFieldData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/MarchingCubes/","title":"MarchingCubes","text":"

vtk-examples/Cxx/Modelling/MarchingCubes

"},{"location":"Cxx/Modelling/MarchingCubes/#description","title":"Description","text":"

Creates a surface from a volume using Flying Edges or Marching Cubes.

Without arguments, the examples generates a voxelized sphere with vtkVoxelModeller.

Note

vtkVoxelModeller by default produces a VTK_BIT scalar image. Marching Cubes does not support this type. The scalar output is set to float for this example.

To generate a surface from a DICOM series, provide a folder containing the series and specify an isovalue for the surface.

This Midas Repository contains a number of DICOM datasets.

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/MarchingCubes/#code","title":"Code","text":"

MarchingCubes.cxx

#include <vtkActor.h>\n#include <vtkDICOMImageReader.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n#include <vtkVoxelModeller.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> volume;\n  double isoValue;\n  if (argc < 3)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetPhiResolution(20);\n    sphereSource->SetThetaResolution(20);\n    sphereSource->Update();\n\n    double bounds[6];\n    sphereSource->GetOutput()->GetBounds(bounds);\n    for (unsigned int i = 0; i < 6; i += 2)\n    {\n      double range = bounds[i + 1] - bounds[i];\n      bounds[i] = bounds[i] - 0.1 * range;\n      bounds[i + 1] = bounds[i + 1] + 0.1 * range;\n    }\n    vtkNew<vtkVoxelModeller> voxelModeller;\n    voxelModeller->SetSampleDimensions(50, 50, 50);\n    voxelModeller->SetModelBounds(bounds);\n    voxelModeller->SetScalarTypeToFloat();\n    voxelModeller->SetMaximumDistance(0.1);\n\n    voxelModeller->SetInputConnection(sphereSource->GetOutputPort());\n    voxelModeller->Update();\n    isoValue = 0.5;\n    volume->DeepCopy(voxelModeller->GetOutput());\n  }\n  else\n  {\n    vtkNew<vtkDICOMImageReader> reader;\n    reader->SetDirectoryName(argv[1]);\n    reader->Update();\n    volume->DeepCopy(reader->GetOutput());\n    isoValue = atof(argv[2]);\n  }\n\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> surface;\n#else\n  vtkNew<vtkMarchingCubes> surface;\n#endif\n  surface->SetInputData(volume);\n  surface->ComputeNormalsOn();\n  surface->SetValue(0, isoValue);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MarchingCubes\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  renderer->AddActor(actor);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Modelling/MarchingCubes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCubes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOImage\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCubes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCubes MACOSX_BUNDLE MarchingCubes.cxx )\n  target_link_libraries(MarchingCubes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCubes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/MarchingCubes/#download-and-build-marchingcubes","title":"Download and Build MarchingCubes","text":"

Click here to download MarchingCubes and its CMakeLists.txt file. Once the tarball MarchingCubes.tar has been downloaded and extracted,

cd MarchingCubes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MarchingCubes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/MarchingSquares/","title":"MarchingSquares","text":"

vtk-examples/Cxx/Modelling/MarchingSquares

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/MarchingSquares/#code","title":"Code","text":"

MarchingSquares.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMarchingSquares.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFileName;\n  if (argc > 1)\n  {\n    inputFileName = argv[1];\n  }\n  int isoValue = 500;\n  if (argc > 2)\n  {\n    isoValue = atoi(argv[2]);\n  }\n\n  vtkNew<vtkPNGReader> reader;\n  if (!reader->CanReadFile(inputFileName.c_str()))\n  {\n    std::cerr << \"Error: Could not read \" << inputFileName << \".\\n\";\n    return EXIT_FAILURE;\n  }\n  reader->SetFileName(inputFileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkMarchingSquares> iso;\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->SetValue(0, isoValue);\n\n  vtkNew<vtkDataSetMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // Standard rendering classes\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetMultiSamples(0);\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"MarchingSquares\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(isoActor);\n\n  // Standard testing code.\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renWin->SetSize(300, 300);\n\n  vtkCamera* camera = renderer->GetActiveCamera();\n  renderer->ResetCamera();\n  camera->Azimuth(180);\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Modelling/MarchingSquares/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingSquares)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingSquares: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingSquares MACOSX_BUNDLE MarchingSquares.cxx )\n  target_link_libraries(MarchingSquares PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingSquares\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/MarchingSquares/#download-and-build-marchingsquares","title":"Download and Build MarchingSquares","text":"

Click here to download MarchingSquares and its CMakeLists.txt file. Once the tarball MarchingSquares.tar has been downloaded and extracted,

cd MarchingSquares/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MarchingSquares\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/SmoothDiscreteMarchingCubes/","title":"SmoothDiscreteMarchingCubes","text":"

vtk-examples/Cxx/Modelling/SmoothDiscreteMarchingCubes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Modelling/SmoothDiscreteMarchingCubes/#description","title":"Description","text":"

Creates surfaces from labeled data. Volume data does not always contain samples of continuous data. A volume may contain discrete integer values, often the result of segmentation. This example smooths the discrete models generated by vtkDiscreteMarchingCubes with vtkWindowedSincPolyDataFilter.

Seealso

DiscreteMarchingCubes produces rough models.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/SmoothDiscreteMarchingCubes/#code","title":"Code","text":"

SmoothDiscreteMarchingCubes.cxx

#include <vtkActor.h>\n#include <vtkDiscreteMarchingCubes.h>\n#include <vtkImageData.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageThreshold.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphere.h>\n#include <vtkWindowedSincPolyDataFilter.h>\n\nnamespace {\nvtkSmartPointer<vtkLookupTable> MakeColors(unsigned int n);\n\nvtkSmartPointer<vtkImageData> MakeBlob(int n, double radius);\n} // namespace\n\nint main(int /* argc */, char* /* argv */[])\n{\n  int n = 20;\n  double radius = 8;\n\n  vtkSmartPointer<vtkImageData> blob = MakeBlob(n, radius);\n\n  vtkNew<vtkDiscreteMarchingCubes> discrete;\n  discrete->SetInputData(blob);\n  discrete->GenerateValues(n, 1, n);\n\n  unsigned int smoothingIterations = 15;\n  double passBand = 0.001;\n  double featureAngle = 120.0;\n\n  vtkNew<vtkWindowedSincPolyDataFilter> smoother;\n  smoother->SetInputConnection(discrete->GetOutputPort());\n  smoother->SetNumberOfIterations(smoothingIterations);\n  smoother->BoundarySmoothingOff();\n  smoother->FeatureEdgeSmoothingOff();\n  smoother->SetFeatureAngle(featureAngle);\n  smoother->SetPassBand(passBand);\n  smoother->NonManifoldSmoothingOn();\n  smoother->NormalizeCoordinatesOn();\n  smoother->Update();\n\n  vtkSmartPointer<vtkLookupTable> lut = MakeColors(n);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(smoother->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, lut->GetNumberOfColors());\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"SmoothDiscreteMarchingCubes\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  ren1->AddActor(actor);\n\n  vtkNew<vtkNamedColors> colors;\n  ren1->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkImageData> MakeBlob(int n, double radius)\n{\n  vtkNew<vtkImageData> blobImage;\n\n  double maxR = 50 - 2.0 * radius;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(5071);\n  for (int i = 0; i < n; ++i)\n  {\n    vtkNew<vtkSphere> sphere;\n    sphere->SetRadius(radius);\n    auto x = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n    auto y = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n    auto z = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n\n    sphere->SetCenter(int(x), int(y), int(z));\n\n    vtkNew<vtkSampleFunction> sampler;\n    sampler->SetImplicitFunction(sphere);\n    sampler->SetOutputScalarTypeToFloat();\n    sampler->SetSampleDimensions(100, 100, 100);\n    sampler->SetModelBounds(-50, 50, -50, 50, -50, 50);\n\n    vtkNew<vtkImageThreshold> thres;\n    thres->SetInputConnection(sampler->GetOutputPort());\n    thres->ThresholdByLower(radius * radius);\n    thres->ReplaceInOn();\n    thres->ReplaceOutOn();\n    thres->SetInValue(i + 1);\n    thres->SetOutValue(0);\n    thres->Update();\n    if (i == 0)\n    {\n      blobImage->DeepCopy(thres->GetOutput());\n    }\n\n    vtkNew<vtkImageMathematics> maxValue;\n    maxValue->SetInputData(0, blobImage);\n    maxValue->SetInputData(1, thres->GetOutput());\n    maxValue->SetOperationToMax();\n    maxValue->Modified();\n    maxValue->Update();\n\n    blobImage->DeepCopy(maxValue->GetOutput());\n  }\n  return blobImage;\n}\n\n// Generate some random colors\nvtkSmartPointer<vtkLookupTable> MakeColors(unsigned int n)\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(n);\n  lut->SetTableRange(0, n - 1);\n  lut->SetScaleToLinear();\n  lut->Build();\n  lut->SetTableValue(0, 0, 0, 0, 1);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(5071);\n  for (int i = 1; i < static_cast<int>(n); ++i)\n  {\n    auto r = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    auto g = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    auto b = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    lut->SetTableValue(i, r, g, b, 1.0);\n  }\n  return lut;\n}\n} // namespace\n
"},{"location":"Cxx/Modelling/SmoothDiscreteMarchingCubes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SmoothDiscreteMarchingCubes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  ImagingCore\n  ImagingHybrid\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SmoothDiscreteMarchingCubes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SmoothDiscreteMarchingCubes MACOSX_BUNDLE SmoothDiscreteMarchingCubes.cxx )\n  target_link_libraries(SmoothDiscreteMarchingCubes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SmoothDiscreteMarchingCubes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/SmoothDiscreteMarchingCubes/#download-and-build-smoothdiscretemarchingcubes","title":"Download and Build SmoothDiscreteMarchingCubes","text":"

Click here to download SmoothDiscreteMarchingCubes and its CMakeLists.txt file. Once the tarball SmoothDiscreteMarchingCubes.tar has been downloaded and extracted,

cd SmoothDiscreteMarchingCubes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SmoothDiscreteMarchingCubes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Modelling/Spring/","title":"Spring","text":"

vtk-examples/Cxx/Modelling/Spring

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Modelling/Spring/#code","title":"Code","text":"

Spring.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRotationalExtrusionFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // create spring profile (a circle)\n  //\n  vtkNew<vtkPoints> points;\n  points->InsertPoint(0, 1.0, 0.0, 0.0);\n  points->InsertPoint(1, 1.0732, 0.0, -0.1768);\n  points->InsertPoint(2, 1.25, 0.0, -0.25);\n  points->InsertPoint(3, 1.4268, 0.0, -0.1768);\n  points->InsertPoint(4, 1.5, 0.0, 0.00);\n  points->InsertPoint(5, 1.4268, 0.0, 0.1768);\n  points->InsertPoint(6, 1.25, 0.0, 0.25);\n  points->InsertPoint(7, 1.0732, 0.0, 0.1768);\n\n  vtkNew<vtkCellArray> poly;\n  poly->InsertNextCell(8); // number of points\n  poly->InsertCellPoint(0);\n  poly->InsertCellPoint(1);\n  poly->InsertCellPoint(2);\n  poly->InsertCellPoint(3);\n  poly->InsertCellPoint(4);\n  poly->InsertCellPoint(5);\n  poly->InsertCellPoint(6);\n  poly->InsertCellPoint(7);\n\n  vtkNew<vtkPolyData> profile;\n  profile->SetPoints(points);\n  profile->SetPolys(poly);\n\n  // extrude profile to make spring\n  //\n  vtkNew<vtkRotationalExtrusionFilter> extrude;\n  extrude->SetInputData(profile);\n  extrude->SetResolution(360);\n  extrude->SetTranslation(6);\n  extrude->SetDeltaRadius(1.0);\n  extrude->SetAngle(2160.0); // six revolutions\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(extrude->GetOutputPort());\n  normals->SetFeatureAngle(60);\n\n  vtkNew<vtkPolyDataMapper> map;\n  map->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkActor> spring;\n  spring->SetMapper(map);\n  spring->GetProperty()->SetColor(colors->GetColor3d(\"PowderBlue\").GetData());\n  spring->GetProperty()->SetDiffuse(0.7);\n  spring->GetProperty()->SetSpecular(0.4);\n  spring->GetProperty()->SetSpecularPower(20);\n  spring->GetProperty()->BackfaceCullingOn();\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer->AddActor(spring);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderWindow->SetSize(640, 512);\n  renderWindow->SetWindowName(\"Spring\");\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(90);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Modelling/Spring/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Spring)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Spring: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Spring MACOSX_BUNDLE Spring.cxx )\n  target_link_libraries(Spring PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Spring\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Modelling/Spring/#download-and-build-spring","title":"Download and Build Spring","text":"

Click here to download Spring and its CMakeLists.txt file. Once the tarball Spring.tar has been downloaded and extracted,

cd Spring/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Spring\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Parallel/ExodusIIWriter/","title":"ExodusIIWriter","text":"

vtk-examples/Cxx/Parallel/ExodusIIWriter

"},{"location":"Cxx/Parallel/ExodusIIWriter/#description","title":"Description","text":"

Requires VTK to be built with VTK_USE_PARALLEL.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Parallel/ExodusIIWriter/#code","title":"Code","text":"

ExodusIIWriter.cxx

#include <vtkExodusIIWriter.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkTimeSourceExample.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkTimeSourceExample> timeSource;\n\n  vtkNew<vtkExodusIIWriter> exodusWriter;\n  exodusWriter->SetFileName(\"output.exii\");\n  exodusWriter->SetInputConnection(timeSource->GetOutputPort());\n  exodusWriter->WriteAllTimeStepsOn();\n  exodusWriter->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Parallel/ExodusIIWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExodusIIWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOExodus\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExodusIIWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExodusIIWriter MACOSX_BUNDLE ExodusIIWriter.cxx )\n  target_link_libraries(ExodusIIWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExodusIIWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Parallel/ExodusIIWriter/#download-and-build-exodusiiwriter","title":"Download and Build ExodusIIWriter","text":"

Click here to download ExodusIIWriter and its CMakeLists.txt file. Once the tarball ExodusIIWriter.tar has been downloaded and extracted,

cd ExodusIIWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExodusIIWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Picking/AreaPicking/","title":"AreaPicking","text":"

vtk-examples/Cxx/Picking/AreaPicking

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Picking/AreaPicking/#description","title":"Description","text":"

This example creates 3 points+vertices. Currently, the address of the picked prop is 0 (this is not correct). A red bounding box is drawn around every picked prop.

  • For [vtkInteractorStyleTrackballCamera](https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleTrackballCamera.html#details) - use 'p' to pick at the current mouse position

  • For [vtkInteractorStyleRubberBandPick](https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleRubberBandPick.html#details) - use 'r' and left-mouse to draw a selection box used to pick

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Picking/AreaPicking/#code","title":"Code","text":"

AreaPicking.cxx

#include <vtkActor.h>\n#include <vtkAreaPicker.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCellArray.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkInteractorStyleTrackball.h>\n// #include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProp3DCollection.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\nvoid PickCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                          void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  // Create a set of points.\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> vertices;\n  vtkIdType pid[1];\n  pid[0] = points->InsertNextPoint(1.0, 0.0, 0.0);\n  vertices->InsertNextCell(1, pid);\n  pid[0] = points->InsertNextPoint(0.0, 0.0, 0.0);\n  vertices->InsertNextCell(1, pid);\n  pid[0] = points->InsertNextPoint(0.0, 1.0, 0.0);\n  vertices->InsertNextCell(1, pid);\n\n  // Create a polydata\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetVerts(vertices);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(8);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"AreaPicking\");\n\n  vtkNew<vtkAreaPicker> areaPicker;\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->SetPicker(areaPicker);\n\n  renderer->AddActor(actor);\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n\n  // For vtkInteractorStyleRubberBandPick - use 'r' and left-mouse to draw a\n  // selection box used to pick.\n  vtkNew<vtkInteractorStyleRubberBandPick> style;\n\n  // For vtkInteractorStyleTrackballCamera - use 'p' to pick at the current\n  // mouse position.\n  //  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  //    paraview\n  style->SetCurrentRenderer(renderer);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkCallbackCommand> pickCallback;\n  pickCallback->SetCallback(PickCallbackFunction);\n\n  areaPicker->AddObserver(vtkCommand::EndPickEvent, pickCallback);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid PickCallbackFunction(vtkObject* caller,\n                          long unsigned int vtkNotUsed(eventId),\n                          void* vtkNotUsed(clientData),\n                          void* vtkNotUsed(callData))\n{\n  std::cout << \"Pick.\" << std::endl;\n  vtkAreaPicker* areaPicker = static_cast<vtkAreaPicker*>(caller);\n  vtkProp3DCollection* props = areaPicker->GetProp3Ds();\n  props->InitTraversal();\n\n  for (vtkIdType i = 0; i < props->GetNumberOfItems(); i++)\n  {\n    vtkProp3D* prop = props->GetNextProp3D();\n    std::cout << \"Picked prop: \" << prop << std::endl;\n  }\n}\n} // namespace\n
"},{"location":"Cxx/Picking/AreaPicking/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AreaPicking)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AreaPicking: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AreaPicking MACOSX_BUNDLE AreaPicking.cxx )\n  target_link_libraries(AreaPicking PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AreaPicking\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Picking/AreaPicking/#download-and-build-areapicking","title":"Download and Build AreaPicking","text":"

Click here to download AreaPicking and its CMakeLists.txt file. Once the tarball AreaPicking.tar has been downloaded and extracted,

cd AreaPicking/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AreaPicking\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Picking/CellPicking/","title":"CellPicking","text":"

vtk-examples/Cxx/Picking/CellPicking

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Picking/CellPicking/#description","title":"Description","text":"

This example demonstrates how to get the coordinates of the point on an actor that is clicked with the left mouse button. It also indicates which cell the selected point belongs to by highlighting the edges of that cell.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Picking/CellPicking/#code","title":"Code","text":"

CellPicking.cxx

#include <vtkActor.h>\n#include <vtkCellPicker.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangleFilter.h>\n#include <vtkUnstructuredGrid.h>\n\nnamespace {\n\n// Catch mouse events.\nclass MouseInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorStyle* New();\n\n  MouseInteractorStyle()\n  {\n    selectedMapper = vtkSmartPointer<vtkDataSetMapper>::New();\n    selectedActor = vtkSmartPointer<vtkActor>::New();\n  }\n\n  virtual void OnLeftButtonDown() override\n  {\n    vtkNew<vtkNamedColors> colors;\n\n    // Get the location of the click (in window coordinates).\n    int* pos = this->GetInteractor()->GetEventPosition();\n\n    vtkNew<vtkCellPicker> picker;\n    picker->SetTolerance(0.0005);\n\n    // Pick from this location.\n    picker->Pick(pos[0], pos[1], 0, this->GetDefaultRenderer());\n\n    double* worldPosition = picker->GetPickPosition();\n    std::cout << \"Cell id is: \" << picker->GetCellId() << std::endl;\n\n    if (picker->GetCellId() != -1)\n    {\n\n      std::cout << \"Pick position is: (\" << worldPosition[0] << \", \"\n                << worldPosition[1] << \", \" << worldPosition[2] << \")\" << endl;\n\n      vtkNew<vtkIdTypeArray> ids;\n      ids->SetNumberOfComponents(1);\n      ids->InsertNextValue(picker->GetCellId());\n\n      vtkNew<vtkSelectionNode> selectionNode;\n      selectionNode->SetFieldType(vtkSelectionNode::CELL);\n      selectionNode->SetContentType(vtkSelectionNode::INDICES);\n      selectionNode->SetSelectionList(ids);\n\n      vtkNew<vtkSelection> selection;\n      selection->AddNode(selectionNode);\n\n      vtkNew<vtkExtractSelection> extractSelection;\n      extractSelection->SetInputData(0, this->Data);\n      extractSelection->SetInputData(1, selection);\n      extractSelection->Update();\n\n      // In selection\n      vtkNew<vtkUnstructuredGrid> selected;\n      selected->ShallowCopy(extractSelection->GetOutput());\n\n      std::cout << \"Number of points in the selection: \"\n                << selected->GetNumberOfPoints() << std::endl;\n      std::cout << \"Number of cells in the selection : \"\n                << selected->GetNumberOfCells() << std::endl;\n      selectedMapper->SetInputData(selected);\n      selectedActor->SetMapper(selectedMapper);\n      selectedActor->GetProperty()->EdgeVisibilityOn();\n      selectedActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"Tomato\").GetData());\n\n      selectedActor->GetProperty()->SetLineWidth(3);\n\n      this->Interactor->GetRenderWindow()\n          ->GetRenderers()\n          ->GetFirstRenderer()\n          ->AddActor(selectedActor);\n    }\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n\n  vtkSmartPointer<vtkPolyData> Data;\n  vtkSmartPointer<vtkDataSetMapper> selectedMapper;\n  vtkSmartPointer<vtkActor> selectedActor;\n};\n\nvtkStandardNewMacro(MouseInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(planeSource->GetOutputPort());\n  triangleFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(triangleFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"SeaGreen\").GetData());\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CellPicking\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->Initialize();\n\n  // Set the custom stype to use for interaction.\n  vtkNew<MouseInteractorStyle> style;\n  style->SetDefaultRenderer(renderer);\n  style->Data = triangleFilter->GetOutput();\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n\n  renderer->SetBackground(colors->GetColor3d(\"PaleTurquoise\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Picking/CellPicking/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellPicking)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellPicking: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellPicking MACOSX_BUNDLE CellPicking.cxx )\n  target_link_libraries(CellPicking PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellPicking\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Picking/CellPicking/#download-and-build-cellpicking","title":"Download and Build CellPicking","text":"

Click here to download CellPicking and its CMakeLists.txt file. Once the tarball CellPicking.tar has been downloaded and extracted,

cd CellPicking/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellPicking\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Picking/HighlightPickedActor/","title":"HighlightPickedActor","text":"

vtk-examples/Cxx/Picking/HighlightPickedActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Picking/HighlightPickedActor/#description","title":"Description","text":"

Click on a sphere to highlight it. The picked sphere color changes to red, and its EdgeVisibity is On. The example subclasses vtkInteractorStyleTrackballCamera with a local class called MouseInteractorHighLightActor. The new interactor overrides the OnLeftButtonDown of vtkInteractorStyleTrackballCamera.

Seealso

HighlightWithSilhouette generates a silhouette of the picked actor.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Picking/HighlightPickedActor/#code","title":"Code","text":"

HighlightPickedActor.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPropPicker.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// Handle mouse events\nclass MouseInteractorHighLightActor : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorHighLightActor* New();\n  vtkTypeMacro(MouseInteractorHighLightActor,\n               vtkInteractorStyleTrackballCamera);\n\n  MouseInteractorHighLightActor()\n  {\n    LastPickedActor = NULL;\n    LastPickedProperty = vtkProperty::New();\n  }\n  virtual ~MouseInteractorHighLightActor()\n  {\n    LastPickedProperty->Delete();\n  }\n  virtual void OnLeftButtonDown() override\n  {\n    vtkNew<vtkNamedColors> colors;\n\n    int* clickPos = this->GetInteractor()->GetEventPosition();\n\n    // Pick from this location.\n    vtkNew<vtkPropPicker> picker;\n    picker->Pick(clickPos[0], clickPos[1], 0, this->GetDefaultRenderer());\n\n    // If we picked something before, reset its property.\n    if (this->LastPickedActor)\n    {\n      this->LastPickedActor->GetProperty()->DeepCopy(this->LastPickedProperty);\n    }\n    this->LastPickedActor = picker->GetActor();\n    if (this->LastPickedActor)\n    {\n      // Save the property of the picked actor so that we can\n      // restore it next time.\n      this->LastPickedProperty->DeepCopy(this->LastPickedActor->GetProperty());\n      // Highlight the picked actor by changing its properties.\n      this->LastPickedActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"Red\").GetData());\n      this->LastPickedActor->GetProperty()->SetDiffuse(1.0);\n      this->LastPickedActor->GetProperty()->SetSpecular(0.0);\n      this->LastPickedActor->GetProperty()->EdgeVisibilityOn();\n    }\n\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n\nprivate:\n  vtkActor* LastPickedActor;\n  vtkProperty* LastPickedProperty;\n};\n\nvtkStandardNewMacro(MouseInteractorHighLightActor);\n} // namespace\n\n// Execute application.\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int numberOfSpheres = 10;\n  if (argc > 1)\n  {\n    numberOfSpheres = atoi(argv[1]);\n  }\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HighlightPickedActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Set the custom type to use for interaction.\n  vtkNew<MouseInteractorHighLightActor> style;\n  style->SetDefaultRenderer(renderer);\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  for (int i = 0; i < numberOfSpheres; ++i)\n  {\n    vtkNew<vtkSphereSource> source;\n    double x, y, z, radius;\n    // random position and radius\n    x = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    radius = randomSequence->GetRangeValue(0.5, 1.0);\n    randomSequence->Next();\n    source->SetRadius(radius);\n    source->SetCenter(x, y, z);\n    source->SetPhiResolution(11);\n    source->SetThetaResolution(21);\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(source->GetOutputPort());\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    double r, g, b;\n    r = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    g = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    b = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    actor->GetProperty()->SetDiffuseColor(r, g, b);\n    actor->GetProperty()->SetDiffuse(0.8);\n    actor->GetProperty()->SetSpecular(0.5);\n    actor->GetProperty()->SetSpecularColor(\n        colors->GetColor3d(\"White\").GetData());\n    actor->GetProperty()->SetSpecularPower(30.0);\n    renderer->AddActor(actor);\n  }\n\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Picking/HighlightPickedActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HighlightPickedActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HighlightPickedActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HighlightPickedActor MACOSX_BUNDLE HighlightPickedActor.cxx )\n  target_link_libraries(HighlightPickedActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HighlightPickedActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Picking/HighlightPickedActor/#download-and-build-highlightpickedactor","title":"Download and Build HighlightPickedActor","text":"

Click here to download HighlightPickedActor and its CMakeLists.txt file. Once the tarball HighlightPickedActor.tar has been downloaded and extracted,

cd HighlightPickedActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HighlightPickedActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Picking/HighlightSelectedPoints/","title":"HighlightSelectedPoints","text":"

vtk-examples/Cxx/Picking/HighlightSelectedPoints

"},{"location":"Cxx/Picking/HighlightSelectedPoints/#description","title":"Description","text":"

This example demonstrates how to select and highlight points using a rubber band. Press 'r' to enter selection mode. Selected points are shown in red. The ids of the selected points are output.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Picking/HighlightSelectedPoints/#code","title":"Code","text":"

HighlightSelectedPoints.cxx

#include <vtkActor.h>\n#include <vtkAreaPicker.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkExtractGeometry.h>\n#include <vtkIdFilter.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkVersion.h>\n#include <vtkVertexGlyphFilter.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\nnamespace {\n// Define interaction style\nclass InteractorStyle : public vtkInteractorStyleRubberBandPick\n{\npublic:\n  static InteractorStyle* New();\n  vtkTypeMacro(InteractorStyle, vtkInteractorStyleRubberBandPick);\n\n  InteractorStyle()\n  {\n    this->SelectedMapper = vtkSmartPointer<vtkDataSetMapper>::New();\n    this->SelectedActor = vtkSmartPointer<vtkActor>::New();\n    this->SelectedActor->SetMapper(SelectedMapper);\n  }\n\n  virtual void OnLeftButtonUp() override\n  {\n    vtkNew<vtkNamedColors> colors;\n\n    // Forward events\n    vtkInteractorStyleRubberBandPick::OnLeftButtonUp();\n\n    vtkPlanes* frustum =\n        static_cast<vtkAreaPicker*>(this->GetInteractor()->GetPicker())\n            ->GetFrustum();\n\n    vtkNew<vtkExtractGeometry> extractGeometry;\n    extractGeometry->SetImplicitFunction(frustum);\n    extractGeometry->SetInputData(this->Points);\n    extractGeometry->Update();\n\n    vtkNew<vtkVertexGlyphFilter> glyphFilter;\n    glyphFilter->SetInputConnection(extractGeometry->GetOutputPort());\n    glyphFilter->Update();\n\n    vtkPolyData* selected = glyphFilter->GetOutput();\n    std::cout << \"Selected \" << selected->GetNumberOfPoints() << \" points.\"\n              << std::endl;\n    std::cout << \"Selected \" << selected->GetNumberOfCells() << \" cells.\"\n              << std::endl;\n    this->SelectedMapper->SetInputData(selected);\n    this->SelectedMapper->ScalarVisibilityOff();\n\n    vtkIdTypeArray* ids = dynamic_cast<vtkIdTypeArray*>(\n        selected->GetPointData()->GetArray(\"OriginalIds\"));\n    for (vtkIdType i = 0; i < ids->GetNumberOfTuples(); i++)\n    {\n      std::cout << \"Id \" << i << \" : \" << ids->GetValue(i) << std::endl;\n    }\n\n    this->SelectedActor->GetProperty()->SetColor(\n        colors->GetColor3d(\"Red\").GetData());\n    this->SelectedActor->GetProperty()->SetPointSize(5);\n\n    this->CurrentRenderer->AddActor(SelectedActor);\n    this->GetInteractor()->GetRenderWindow()->Render();\n    this->HighlightProp(NULL);\n  }\n\n  void SetPoints(vtkSmartPointer<vtkPolyData> points)\n  {\n    this->Points = points;\n  }\n\nprivate:\n  vtkSmartPointer<vtkPolyData> Points;\n  vtkSmartPointer<vtkActor> SelectedActor;\n  vtkSmartPointer<vtkDataSetMapper> SelectedMapper;\n};\n\nvtkStandardNewMacro(InteractorStyle);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(20);\n  pointSource->Update();\n\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputConnection(pointSource->GetOutputPort());\n#if VTK890\n  idFilter->SetCellIdsArrayName(\"OriginalIds\");\n  idFilter->SetPointIdsArrayName(\"OriginalIds\");\n#else\n  idFilter->SetIdsArrayName(\"OriginalIds\");\n#endif\n  idFilter->Update();\n\n  vtkNew<vtkDataSetSurfaceFilter> surfaceFilter;\n  surfaceFilter->SetInputConnection(idFilter->GetOutputPort());\n  surfaceFilter->Update();\n\n  vtkPolyData* input = surfaceFilter->GetOutput();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(input);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(3);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HighlightSelectedPoints\");\n\n  vtkNew<vtkAreaPicker> areaPicker;\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetPicker(areaPicker);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<InteractorStyle> style;\n  style->SetPoints(input);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Picking/HighlightSelectedPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HighlightSelectedPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersGeneral\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HighlightSelectedPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HighlightSelectedPoints MACOSX_BUNDLE HighlightSelectedPoints.cxx )\n  target_link_libraries(HighlightSelectedPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HighlightSelectedPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Picking/HighlightSelectedPoints/#download-and-build-highlightselectedpoints","title":"Download and Build HighlightSelectedPoints","text":"

Click here to download HighlightSelectedPoints and its CMakeLists.txt file. Once the tarball HighlightSelectedPoints.tar has been downloaded and extracted,

cd HighlightSelectedPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HighlightSelectedPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Picking/HighlightSelection/","title":"HighlightSelection","text":"

vtk-examples/Cxx/Picking/HighlightSelection

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Picking/HighlightSelection/#description","title":"Description","text":"

This example demonstrates how to select and highlight cells using vtkInteractorStyleRubberBandPick. Press 'r' to enter selection mode.

vtkExtractPolyDataGeometry selects all cells within the selected area. The cells include those on the visible surface as well as those that exist within the view frustum returned by the interactor.

The example accepts a geometry file as the first argument. Without an argument a vtkSphereSource will be used as the vtkPolyData.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Picking/HighlightSelection/#code","title":"Code","text":"

HighlightSelection.cxx

#include <vtkActor.h>\n#include <vtkAreaPicker.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkExtractPolyDataGeometry.h>\n#include <vtkIdFilter.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#define VTKISRBP_ORIENT 0\n#define VTKISRBP_SELECT 1\n\nnamespace {\n// Define interaction style\nclass HighlightInteractorStyle : public vtkInteractorStyleRubberBandPick\n{\npublic:\n  static HighlightInteractorStyle* New();\n  vtkTypeMacro(HighlightInteractorStyle, vtkInteractorStyleRubberBandPick);\n\n  HighlightInteractorStyle() : vtkInteractorStyleRubberBandPick()\n  {\n    this->SelectedMapper = vtkSmartPointer<vtkDataSetMapper>::New();\n    this->SelectedActor = vtkSmartPointer<vtkActor>::New();\n    this->SelectedActor->SetMapper(SelectedMapper);\n  }\n\n  virtual void OnLeftButtonUp() override\n  {\n    // Forward events\n    vtkInteractorStyleRubberBandPick::OnLeftButtonUp();\n\n    if (this->CurrentMode == VTKISRBP_SELECT)\n    {\n      vtkNew<vtkNamedColors> colors;\n\n      vtkPlanes* frustum =\n          static_cast<vtkAreaPicker*>(this->GetInteractor()->GetPicker())\n              ->GetFrustum();\n\n      vtkNew<vtkExtractPolyDataGeometry> extractPolyDataGeometry;\n      extractPolyDataGeometry->SetInputData(this->PolyData);\n      extractPolyDataGeometry->SetImplicitFunction(frustum);\n      extractPolyDataGeometry->Update();\n\n      std::cout << \"Extracted \"\n                << extractPolyDataGeometry->GetOutput()->GetNumberOfCells()\n                << \" cells.\" << std::endl;\n      this->SelectedMapper->SetInputData(extractPolyDataGeometry->GetOutput());\n      this->SelectedMapper->ScalarVisibilityOff();\n\n      // vtkIdTypeArray* ids =\n      // dynamic_cast<vtkIdTypeArray*>(selected->GetPointData()->GetArray(\"OriginalIds\"));\n\n      this->SelectedActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"Tomato\").GetData());\n      this->SelectedActor->GetProperty()->SetPointSize(5);\n      this->SelectedActor->GetProperty()->SetRepresentationToWireframe();\n\n      this->GetInteractor()\n          ->GetRenderWindow()\n          ->GetRenderers()\n          ->GetFirstRenderer()\n          ->AddActor(SelectedActor);\n      this->GetInteractor()->GetRenderWindow()->Render();\n      this->HighlightProp(NULL);\n    }\n  }\n\n  void SetPolyData(vtkSmartPointer<vtkPolyData> polyData)\n  {\n    this->PolyData = polyData;\n  }\n\nprivate:\n  vtkSmartPointer<vtkPolyData> PolyData;\n  vtkSmartPointer<vtkActor> SelectedActor;\n  vtkSmartPointer<vtkDataSetMapper> SelectedMapper;\n};\nvtkStandardNewMacro(HighlightInteractorStyle);\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputData(polyData);\n#if VTK890\n  idFilter->SetCellIdsArrayName(\"OriginalIds\");\n  idFilter->SetPointIdsArrayName(\"OriginalIds\");\n#else\n  idFilter->SetIdsArrayName(\"OriginalIds\");\n#endif\n  idFilter->Update();\n\n  // This is needed to convert the ouput of vtkIdFilter (vtkDataSet) back to\n  // vtkPolyData.\n  vtkNew<vtkDataSetSurfaceFilter> surfaceFilter;\n  surfaceFilter->SetInputConnection(idFilter->GetOutputPort());\n  surfaceFilter->Update();\n\n  vtkPolyData* input = surfaceFilter->GetOutput();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(5);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"HighlightSelection\");\n\n  vtkNew<vtkAreaPicker> areaPicker;\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetPicker(areaPicker);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Tan\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<HighlightInteractorStyle> style;\n  style->SetPolyData(input);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(21);\n    source->SetThetaResolution(40);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Picking/HighlightSelection/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HighlightSelection)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersGeometry\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HighlightSelection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HighlightSelection MACOSX_BUNDLE HighlightSelection.cxx )\n  target_link_libraries(HighlightSelection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HighlightSelection\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Picking/HighlightSelection/#download-and-build-highlightselection","title":"Download and Build HighlightSelection","text":"

Click here to download HighlightSelection and its CMakeLists.txt file. Once the tarball HighlightSelection.tar has been downloaded and extracted,

cd HighlightSelection/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HighlightSelection\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Picking/HighlightWithSilhouette/","title":"HighlightWithSilhouette","text":"

vtk-examples/Cxx/Picking/HighlightWithSilhouette

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Picking/HighlightWithSilhouette/#description","title":"Description","text":"

Click on a sphere to highlight it. vtkPolyDataSilhoutte creates a silhouette of the picked vtkActor. The example subclasses vtkInteractorStyleTrackballCamera with a local class called MouseInteractorHighLightActor. The new interactor overrides the OnLeftButtonDown of vtkInteractorStyleTrackballCamera.

Watch this video showing the picking of several spheres.

Seealso

HighlightPickedActor C++ or Python where the color and edge visibility of the picked actor is changed.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Picking/HighlightWithSilhouette/#code","title":"Code","text":"

HighlightWithSilhouette.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataSilhouette.h>\n#include <vtkPropPicker.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// Handle mouse events\nclass MouseInteractorHighLightActor : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorHighLightActor* New();\n  vtkTypeMacro(MouseInteractorHighLightActor,\n               vtkInteractorStyleTrackballCamera);\n\n  MouseInteractorHighLightActor()\n  {\n    LastPickedActor = nullptr;\n    SilhouetteActor = nullptr;\n    Silhouette = nullptr;\n  }\n  virtual ~MouseInteractorHighLightActor()\n  {\n  }\n  virtual void OnLeftButtonDown() override\n  {\n    int* clickPos = this->GetInteractor()->GetEventPosition();\n\n    // Pick from this location.\n    vtkNew<vtkPropPicker> picker;\n    picker->Pick(clickPos[0], clickPos[1], 0, this->GetDefaultRenderer());\n    this->LastPickedActor = picker->GetActor();\n\n    // If we picked something before, remove the silhouette actor and\n    // generate a new one\n    if (this->LastPickedActor)\n    {\n      this->GetDefaultRenderer()->RemoveActor(this->SilhouetteActor);\n\n      // Highlight the picked actor by generating a silouhette\n      this->Silhouette->SetInputData(\n          dynamic_cast<vtkPolyDataMapper*>(this->LastPickedActor->GetMapper())\n              ->GetInput());\n      this->GetDefaultRenderer()->AddActor(this->SilhouetteActor);\n    }\n\n    // Forward events\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n  void SetSilhouette(vtkPolyDataSilhouette* silhouette)\n  {\n    this->Silhouette = silhouette;\n  }\n  void SetSilhouetteActor(vtkActor* silhouetteActor)\n  {\n    this->SilhouetteActor = silhouetteActor;\n  }\n\nprivate:\n  vtkActor* LastPickedActor;\n  vtkActor* SilhouetteActor;\n  vtkPolyDataSilhouette* Silhouette;\n};\n\nvtkStandardNewMacro(MouseInteractorHighLightActor);\n} // namespace\n\n// Execute application.\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Bkg\", 0.3, 0.4, 0.5);\n\n  int numberOfSpheres = 10;\n  if (argc > 1)\n  {\n    numberOfSpheres = atoi(argv[1]);\n  }\n  // Create a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HighlightWithSilhouette\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  for (int i = 0; i < numberOfSpheres; ++i)\n  {\n    vtkNew<vtkSphereSource> source;\n    double x, y, z, radius;\n    // random position and radius\n    x = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    radius = randomSequence->GetRangeValue(0.5, 1.0);\n    randomSequence->Next();\n    source->SetRadius(radius);\n    source->SetCenter(x, y, z);\n    source->SetPhiResolution(11);\n    source->SetThetaResolution(21);\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(source->GetOutputPort());\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    double r, g, b;\n    r = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    g = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    b = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    actor->GetProperty()->SetDiffuseColor(r, g, b);\n    actor->GetProperty()->SetDiffuse(0.8);\n    actor->GetProperty()->SetSpecular(0.5);\n    actor->GetProperty()->SetSpecularColor(\n        colors->GetColor3d(\"White\").GetData());\n    actor->GetProperty()->SetSpecularPower(30.0);\n    renderer->AddActor(actor);\n  }\n\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n\n  // Create the silhouette pipeline, the input data will be set in the\n  // interactor\n  vtkNew<vtkPolyDataSilhouette> silhouette;\n  silhouette->SetCamera(renderer->GetActiveCamera());\n\n  // Create mapper and actor for silhouette\n  vtkNew<vtkPolyDataMapper> silhouetteMapper;\n  silhouetteMapper->SetInputConnection(silhouette->GetOutputPort());\n\n  vtkNew<vtkActor> silhouetteActor;\n  silhouetteActor->SetMapper(silhouetteMapper);\n  silhouetteActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  silhouetteActor->GetProperty()->SetLineWidth(5);\n\n  // Set the custom type to use for interaction.\n  vtkNew<MouseInteractorHighLightActor> style;\n  style->SetDefaultRenderer(renderer);\n  style->SetSilhouetteActor(silhouetteActor);\n  style->SetSilhouette(silhouette);\n\n  interactor->SetInteractorStyle(style);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Picking/HighlightWithSilhouette/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HighlightWithSilhouette)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersHybrid\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HighlightWithSilhouette: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HighlightWithSilhouette MACOSX_BUNDLE HighlightWithSilhouette.cxx )\n  target_link_libraries(HighlightWithSilhouette PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HighlightWithSilhouette\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Picking/HighlightWithSilhouette/#download-and-build-highlightwithsilhouette","title":"Download and Build HighlightWithSilhouette","text":"

Click here to download HighlightWithSilhouette and its CMakeLists.txt file. Once the tarball HighlightWithSilhouette.tar has been downloaded and extracted,

cd HighlightWithSilhouette/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HighlightWithSilhouette\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/AreaPlot/","title":"AreaPlot","text":"

vtk-examples/Cxx/Plotting/AreaPlot

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/AreaPlot/#description","title":"Description","text":"

This example illustrates vtkPlotArea, which draws a filled region between two curves. The example uses a valid mask to select the values to define the region to be plotted.

The example also shows how to control the size and colors of the plot's components.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/AreaPlot/#code","title":"Code","text":"

AreaPlot.cxx

#include <vtkAxis.h>\n#include <vtkBrush.h>\n#include <vtkCharArray.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotArea.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkTextProperty.h>\n#include <vtkVersion.h>\n\n#include <algorithm>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetRenderWindow()->SetWindowName(\"AreaPlot\");\n\n  vtkNew<vtkChartXY> chart;\n  chart->SetTitle(\"Area Plot\");\n  chart->GetTitleProperties()->SetFontSize(36);\n  chart->GetTitleProperties()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  chart->GetAxis(0)->GetTitleProperties()->SetFontSize(24);\n  chart->GetAxis(0)->GetTitleProperties()->SetColor(\n      colors->GetColor3d(\"orange\").GetData());\n  chart->GetAxis(0)->GetLabelProperties()->SetColor(\n      colors->GetColor3d(\"beige\").GetData());\n  chart->GetAxis(0)->GetLabelProperties()->SetFontSize(18);\n\n  chart->GetAxis(1)->GetTitleProperties()->SetFontSize(24);\n  chart->GetAxis(1)->GetTitleProperties()->SetColor(\n      colors->GetColor3d(\"orange\").GetData());\n  chart->GetAxis(1)->GetLabelProperties()->SetColor(\n      colors->GetColor3d(\"beige\").GetData());\n  chart->GetAxis(1)->GetLabelProperties()->SetFontSize(18);\n\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  vtkNew<vtkFloatArray> arrS2;\n  arrS2->SetName(\"Sine2\");\n  table->AddColumn(arrS2);\n\n  vtkNew<vtkFloatArray> arrS3;\n  arrS3->SetName(\"Sine3\");\n  table->AddColumn(arrS3);\n\n  vtkNew<vtkFloatArray> arr1;\n  arr1->SetName(\"One\");\n  table->AddColumn(arr1);\n\n  vtkNew<vtkCharArray> validMask;\n  validMask->SetName(\"ValidMask\");\n  table->AddColumn(validMask);\n\n  // Test charting with a few more points...\n  int numPoints = 69;\n  float inc = 7.5 / (numPoints - 1);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc + 0.01);\n    table->SetValue(i, 1, cos(i * inc) + 0.01);\n    table->SetValue(i, 2, sin(i * inc) + 0.01);\n    table->SetValue(i, 3, sin(i * inc) + 0.5);\n    table->SetValue(i, 4, sin(i * inc) * sin(i * inc) + 0.01);\n    table->SetValue(i, 5, 1.0);\n\n    validMask->SetValue(i, (i > 30 && i < 40) ? 0 : 1);\n  }\n\n  // Add multiple line plots, setting the colors etc.\n  vtkColor3d color3d = colors->GetColor3d(\"tomato\");\n  vtkPlotArea* area =\n      dynamic_cast<vtkPlotArea*>(chart->AddPlot(vtkChart::AREA));\n  area->SetInputData(table);\n  area->SetInputArray(0, \"X Axis\");\n  area->SetInputArray(1, \"Sine\");\n  area->SetInputArray(2, \"Sine2\");\n  area->SetValidPointMaskName(\"ValidMask\");\n#if VTK_HAS_SETCOLORF\n  area->GetBrush()->SetColorF(color3d.GetRed(), color3d.GetGreen(),\n                              color3d.GetBlue(), 0.6);\n#else\n  area->GetBrush()->SetColor(color3d.GetRed(), color3d.GetGreen(),\n                             color3d.GetBlue(), 0.6);\n#endif\n\n  chart->GetAxis(vtkAxis::LEFT)->SetLogScale(true);\n\n  // Render the scene and compare the image to a reference image.\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/AreaPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AreaPlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AreaPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AreaPlot MACOSX_BUNDLE AreaPlot.cxx )\n  target_link_libraries(AreaPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AreaPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/AreaPlot/#download-and-build-areaplot","title":"Download and Build AreaPlot","text":"

Click here to download AreaPlot and its CMakeLists.txt file. Once the tarball AreaPlot.tar has been downloaded and extracted,

cd AreaPlot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AreaPlot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/BarChart/","title":"BarChart","text":"

vtk-examples/Cxx/Plotting/BarChart

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/BarChart/#description","title":"Description","text":"

This example shows how to create a Bar Chart.

Also see the BarChartQt example.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/BarChart/#code","title":"Code","text":"

BarChart.cxx

#include <vtkAxis.h>\n#include <vtkChartXY.h>\n#include <vtkColorSeries.h>\n#include <vtkContextView.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkTextProperty.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n// Monthly circulation data\nstatic int data_2008[] = {10822, 10941, 9979,  10370, 9460, 11228,\n                          15093, 12231, 10160, 9816,  9384, 7892};\nstatic int data_2009[] = {9058,  9474,  9979,  9408, 8900, 11569,\n                          14688, 12231, 10294, 9585, 8957, 8590};\nstatic int data_2010[] = {9058,  10941, 9979,  10270, 8900, 11228,\n                          14688, 12231, 10160, 9585,  9384, 8590};\n\nint main(int, char*[])\n{\n  // Colors\n  vtkNew<vtkColorSeries> colorSeries;\n  // colorSeries->SetColorScheme(\n  //    vtkColorSeries::BREWER_SEQUENTIAL_YELLOW_ORANGE_BROWN_3);\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_DIVERGING_SPECTRAL_3);\n  // colorSeries->SetColorScheme(vtkColorSeries::BREWER_DIVERGING_PURPLE_ORANGE_3);\n  // colorSeries->SetColorScheme(\n  //    vtkColorSeries::BREWER_DIVERGING_BROWN_BLUE_GREEN_3);\n  // colorSeries->SetColorScheme(vtkColorSeries::BREWER_SEQUENTIAL_BLUE_GREEN_3);\n  // colorSeries->SetColorScheme(vtkColorSeries::BREWER_SEQUENTIAL_BLUE_PURPLE_3);\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Seashell\");\n  vtkColor3d axisColor = colors->GetColor3d(\"Black\");\n  vtkColor3d titleColor = colors->GetColor3d(\"MidnightBlue\");\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(backgroundColor.GetData());\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetRenderWindow()->SetWindowName(\"BarChart\");\n\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Set various properties.\n  vtkAxis* xAxis = chart->GetAxis(vtkAxis::BOTTOM);\n  xAxis->SetTitle(\"Monthly\");\n  xAxis->GetTitleProperties()->SetColor(axisColor.GetData());\n  xAxis->GetTitleProperties()->SetFontSize(16);\n  xAxis->GetTitleProperties()->ItalicOn();\n  xAxis->GetLabelProperties()->SetColor(axisColor.GetData());\n  xAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"Black\"));\n\n  vtkAxis* yAxis = chart->GetAxis(vtkAxis::LEFT);\n  yAxis->SetTitle(\"Circulation\");\n  yAxis->GetTitleProperties()->SetColor(axisColor.GetData());\n  yAxis->GetTitleProperties()->SetFontSize(16);\n  yAxis->GetTitleProperties()->ItalicOn();\n  yAxis->GetLabelProperties()->SetColor(axisColor.GetData());\n  yAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"Black\"));\n\n  chart->SetTitle(\"Circulation 2008, 2009, 2010\");\n  chart->GetTitleProperties()->SetFontSize(24);\n  chart->GetTitleProperties()->SetColor(titleColor.GetData());\n  chart->GetTitleProperties()->BoldOn();\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkIntArray> arrMonth;\n  arrMonth->SetName(\"Month\");\n  table->AddColumn(arrMonth);\n\n  vtkNew<vtkIntArray> arr2008;\n  arr2008->SetName(\"2008\");\n  table->AddColumn(arr2008);\n\n  vtkNew<vtkIntArray> arr2009;\n  arr2009->SetName(\"2009\");\n  table->AddColumn(arr2009);\n\n  vtkNew<vtkIntArray> arr2010;\n  arr2010->SetName(\"2010\");\n  table->AddColumn(arr2010);\n\n  table->SetNumberOfRows(12);\n  for (int i = 0; i < 12; i++)\n  {\n    table->SetValue(i, 0, i + 1);\n    table->SetValue(i, 1, data_2008[i]);\n    table->SetValue(i, 2, data_2009[i]);\n    table->SetValue(i, 3, data_2010[i]);\n  }\n\n  // Add multiple line plots, setting the colors etc.\n#if VTK_HAS_SETCOLORF\n  vtkPlot* line = 0;\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColorF(colorSeries->GetColor(0).GetRed() / 255.0,\n                  colorSeries->GetColor(0).GetGreen() / 255.0,\n                  colorSeries->GetColor(0).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 1);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColorF(colorSeries->GetColor(1).GetRed() / 255.0,\n                  colorSeries->GetColor(1).GetGreen() / 255.0,\n                  colorSeries->GetColor(1).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 2);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColorF(colorSeries->GetColor(2).GetRed() / 255.0,\n                  colorSeries->GetColor(2).GetGreen() / 255.0,\n                  colorSeries->GetColor(2).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 3);\n#else\n  vtkPlot* line = 0;\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColor(colorSeries->GetColor(0).GetRed() / 255.0,\n                 colorSeries->GetColor(0).GetGreen() / 255.0,\n                 colorSeries->GetColor(0).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 1);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColor(colorSeries->GetColor(1).GetRed() / 255.0,\n                 colorSeries->GetColor(1).GetGreen() / 255.0,\n                 colorSeries->GetColor(1).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 2);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColor(colorSeries->GetColor(2).GetRed() / 255.0,\n                 colorSeries->GetColor(2).GetGreen() / 255.0,\n                 colorSeries->GetColor(2).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 3);\n#endif\n\n  // Finally render the scene and compare the image to a reference image.\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/BarChart/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BarChart)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BarChart: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BarChart MACOSX_BUNDLE BarChart.cxx )\n  target_link_libraries(BarChart PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BarChart\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/BarChart/#download-and-build-barchart","title":"Download and Build BarChart","text":"

Click here to download BarChart and its CMakeLists.txt file. Once the tarball BarChart.tar has been downloaded and extracted,

cd BarChart/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BarChart\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/BoxChart/","title":"BoxChart","text":"

vtk-examples/Cxx/Plotting/BoxChart

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/BoxChart/#description","title":"Description","text":"

This example demonstrates how to generate a box plot.

The example uses data from the Michelson Morley experiment. Compare the wiki example output with the Wikipedia results

Warning

The ChartBox expects an input table with exactly 5 rows per column. The 5 rows are minimum, 1st quartile, median, 3rd quartile and maximum. vtkComputeQuartiles is used to create a valid input table from the original data.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/BoxChart/#code","title":"Code","text":"

BoxChart.cxx

#include <vtkAxis.h>\n#include <vtkChartBox.h>\n#include <vtkComputeQuartiles.h>\n#include <vtkContextView.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNew.h>\n#include <vtkPlotBox.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStatisticsAlgorithm.h>\n#include <vtkStringArray.h>\n#include <vtkTable.h>\n#include <vtkTextProperty.h>\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(400, 400);\n  view->GetRenderWindow()->SetMultiSamples(0);\n\n  vtkNew<vtkChartBox> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Creates a vtkPlotBox input table.\n  int numParam = 5;\n  vtkNew<vtkTable> inputBoxPlotTable;\n\n  for (int i = 0; i < numParam; i++)\n  {\n    char num[10];\n    sprintf(num, \"Run %d\", i + 1);\n    vtkNew<vtkIntArray> arrIndex;\n    arrIndex->SetName(num);\n    inputBoxPlotTable->AddColumn(arrIndex);\n  }\n\n  inputBoxPlotTable->SetNumberOfRows(20);\n  double values[20][5] = {\n      {850, 960, 880, 890, 890},  {740, 940, 880, 810, 840},\n      {900, 960, 880, 810, 780},  {1070, 940, 860, 820, 810},\n      {930, 880, 720, 800, 760},  {850, 800, 720, 770, 810},\n      {950, 850, 620, 760, 790},  {980, 880, 860, 740, 810},\n      {980, 900, 970, 750, 820},  {880, 840, 950, 760, 850},\n      {1000, 830, 880, 910, 870}, {980, 790, 910, 920, 870},\n      {930, 810, 850, 890, 810},  {650, 880, 870, 860, 740},\n      {760, 880, 840, 880, 810},  {810, 830, 840, 720, 940},\n      {1000, 800, 850, 840, 950}, {1000, 790, 840, 850, 800},\n      {960, 760, 840, 850, 810},  {960, 800, 840, 780, 870}};\n  for (int j = 0; j < 20; ++j)\n  {\n    for (int i = 0; i < 5; ++i)\n    {\n      inputBoxPlotTable->SetValue(j, i, values[j][i]);\n    }\n  }\n  vtkNew<vtkComputeQuartiles> quartiles;\n  quartiles->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA,\n                          inputBoxPlotTable);\n  quartiles->Update();\n\n  vtkTable* outTable = quartiles->GetOutput();\n  vtkNew<vtkLookupTable> lookup;\n  lookup->SetNumberOfColors(5);\n  lookup->SetRange(0, 4);\n  lookup->Build();\n\n  chart->GetPlot(0)->SetInputData(outTable);\n  chart->SetShowLegend(true);\n  chart->SetColumnVisibilityAll(true);\n  chart->SetTitle(\"Michelson-Morley experiment\");\n  chart->GetTitleProperties()->SetFontSize(16);\n  chart->GetYAxis()->SetTitle(\"Speed of Light (km/s - 299000)\");\n\n  // Set the labels.\n  vtkNew<vtkStringArray> labels;\n  labels->SetNumberOfValues(5);\n  labels->SetValue(0, \"Run 1\");\n  labels->SetValue(1, \"Run 2\");\n  labels->SetValue(2, \"Run 3\");\n  labels->SetValue(3, \"Run 4\");\n  labels->SetValue(4, \"Run 5\");\n  chart->GetPlot(0)->SetLabels(labels);\n\n  // Render the scene.\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderer()->SetBackground(.8, .8, .8);\n  view->GetInteractor()->Initialize();\n  view->Render();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/BoxChart/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoxChart)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonCore\n  CommonDataModel\n  FiltersStatistics\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoxChart: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoxChart MACOSX_BUNDLE BoxChart.cxx )\n  target_link_libraries(BoxChart PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoxChart\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/BoxChart/#download-and-build-boxchart","title":"Download and Build BoxChart","text":"

Click here to download BoxChart and its CMakeLists.txt file. Once the tarball BoxChart.tar has been downloaded and extracted,

cd BoxChart/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BoxChart\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/ChartMatrix/","title":"ChartMatrix","text":"

vtk-examples/Cxx/Plotting/ChartMatrix

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/ChartMatrix/#description","title":"Description","text":"

This example illustrates the use vtkChartMatrix, a container that holds a matrix of charts. The example creates a 2 x 2 matrix of plots. The matrix elements are:

  • (0,0): a vtkPlotPoints
  • (0,1): a vtkPlotPoints
  • (1,0): a vtkPlotLine
  • (1,1): a vtkPlotBar and a vtkPlotPoints

The example also illustrates how to use vtkNamedColors to set the colors for the plots.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/ChartMatrix/#code","title":"Code","text":"

ChartMatrix.cxx

#include <vtkAxis.h>\n#include <vtkChartMatrix.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkPlotPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(1280, 1024);\n  view->GetRenderWindow()->SetWindowName(\"ChartMatrix\");\n\n  vtkNew<vtkChartMatrix> matrix;\n  view->GetScene()->AddItem(matrix);\n  matrix->SetSize(vtkVector2i(2, 2));\n  matrix->SetGutter(vtkVector2f(30.0, 30.0));\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n  vtkNew<vtkFloatArray> arrX;\n\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  vtkNew<vtkFloatArray> arrS2;\n  arrS2->SetName(\"Sine2\");\n  table->AddColumn(arrS2);\n\n  vtkNew<vtkFloatArray> tangent;\n  tangent->SetName(\"Tangent\");\n  table->AddColumn(tangent);\n\n  int numPoints = 42;\n  float inc = 7.5 / (numPoints - 1);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc);\n    table->SetValue(i, 1, cos(i * inc));\n    table->SetValue(i, 2, sin(i * inc));\n    table->SetValue(i, 3, sin(i * inc) + 0.5);\n    table->SetValue(i, 4, tan(i * inc));\n  }\n\n  // Add multiple line plots, setting the colors etc\n  // lower left plot, a point chart\n  vtkChart* chart = matrix->GetChart(vtkVector2i(0, 0));\n  vtkPlot* plot = chart->AddPlot(vtkChart::POINTS);\n  plot->SetInputData(table, 0, 1);\n  dynamic_cast<vtkPlotPoints*>(plot)->SetMarkerStyle(vtkPlotPoints::DIAMOND);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"sea_green\").GetRed(),\n                 colors->GetColor3ub(\"sea_green\").GetGreen(),\n                 colors->GetColor3ub(\"sea_green\").GetBlue(), 255);\n\n  // upper left plot, a point chart\n  chart = matrix->GetChart(vtkVector2i(0, 1));\n  plot = chart->AddPlot(vtkChart::POINTS);\n  plot->SetInputData(table, 0, 2);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"rose_madder\").GetRed(),\n                 colors->GetColor3ub(\"rose_madder\").GetGreen(),\n                 colors->GetColor3ub(\"rose_madder\").GetBlue(), 255);\n\n  //\n  chart = matrix->GetChart(vtkVector2i(1, 0));\n  plot = chart->AddPlot(vtkChart::LINE);\n  plot->SetInputData(table, 0, 3);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"dark_orange\").GetRed(),\n                 colors->GetColor3ub(\"dark_orange\").GetGreen(),\n                 colors->GetColor3ub(\"dark_orange\").GetBlue(), 255);\n\n  // upper right plot, a bar and point chart\n  chart = matrix->GetChart(vtkVector2i(1, 1));\n  plot = chart->AddPlot(vtkChart::BAR);\n  plot->SetInputData(table, 0, 4);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"burnt_sienna\").GetRed(),\n                 colors->GetColor3ub(\"burnt_sienna\").GetGreen(),\n                 colors->GetColor3ub(\"burnt_sienna\").GetBlue(), 255);\n\n  plot = chart->AddPlot(vtkChart::POINTS);\n  plot->SetInputData(table, 0, 1);\n  dynamic_cast<vtkPlotPoints*>(plot)->SetMarkerStyle(vtkPlotPoints::CROSS);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"rose_madder\").GetRed(),\n                 colors->GetColor3ub(\"rose_madder\").GetGreen(),\n                 colors->GetColor3ub(\"rose_madder\").GetBlue(), 255);\n\n  // Lower right plot, a line chart\n\n  chart = matrix->GetChart(vtkVector2i(1, 0));\n  plot = chart->AddPlot(vtkChart::LINE);\n  plot->SetInputData(table, 0, 3);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"dark_orange\").GetRed(),\n                 colors->GetColor3ub(\"dark_orange\").GetGreen(),\n                 colors->GetColor3ub(\"dark_orange\").GetBlue(), 255);\n\n  plot = chart->AddPlot(vtkChart::LINE);\n  plot->SetInputData(table, 0, 3);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"royal_blue\").GetRed(),\n                 colors->GetColor3ub(\"royal_blue\").GetGreen(),\n                 colors->GetColor3ub(\"royal_blue\").GetBlue(), 255);\n\n  // Finally render the scene and compare the image to a reference image\n  view->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"navajo_white\").GetData());\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/ChartMatrix/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ChartMatrix)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ChartMatrix: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ChartMatrix MACOSX_BUNDLE ChartMatrix.cxx )\n  target_link_libraries(ChartMatrix PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ChartMatrix\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/ChartMatrix/#download-and-build-chartmatrix","title":"Download and Build ChartMatrix","text":"

Click here to download ChartMatrix and its CMakeLists.txt file. Once the tarball ChartMatrix.tar has been downloaded and extracted,

cd ChartMatrix/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ChartMatrix\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/ChartsOn3DScene/","title":"ChartsOn3DScene","text":"

vtk-examples/Cxx/Plotting/ChartsOn3DScene

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/ChartsOn3DScene/#description","title":"Description","text":"

This example illustrates how to combine a 3D scene with a vtkChartXY.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/ChartsOn3DScene/#code","title":"Code","text":"

ChartsOn3DScene.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkChartXY.h>\n#include <vtkContextActor.h>\n#include <vtkContextScene.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->SetMultiSamples(4);\n  renwin->SetSize(640, 480);\n  renwin->SetWindowName(\"ChartsOn3DScene\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor4d(\"seagreen\").GetData());\n  renwin->AddRenderer(renderer);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->SetPosition(1.0, 1.0, -4.0);\n  renderer->GetActiveCamera()->Azimuth(40);\n\n  // Cube Source 1\n  vtkNew<vtkCubeSource> cube;\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cube->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor4d(\"peacock\").GetData());\n  renderer->AddActor(cubeActor);\n  cubeActor->GetProperty()->SetRepresentationToSurface();\n\n  // Now the chart,\n  vtkNew<vtkChartXY> chart;\n  vtkNew<vtkContextScene> chartScene;\n  vtkNew<vtkContextActor> chartActor;\n\n  chart->SetAutoSize(false);\n  chart->SetSize(vtkRectf(0.0, 0.0, 320, 220));\n\n  chartScene->AddItem(chart);\n  chartActor->SetScene(chartScene);\n\n  // Both needed.\n  renderer->AddActor(chartActor);\n  chartScene->SetRenderer(renderer);\n\n  // Create a table with some points in it.\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  vtkNew<vtkFloatArray> arrT;\n  arrT->SetName(\"Tan\");\n  table->AddColumn(arrT);\n\n  // Test charting with a few more points...\n  int numPoints = 69;\n  float inc = 7.5 / (numPoints - 1.0);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc);\n    table->SetValue(i, 1, cos(i * inc) + 0.0);\n    table->SetValue(i, 2, sin(i * inc) + 0.0);\n    table->SetValue(i, 3, tan(i * inc) + 0.5);\n  }\n\n  // Add multiple line plots, setting the colors etc.\n  vtkColor3d color3d = colors->GetColor3d(\"banana\");\n\n  vtkPlot* points = chart->AddPlot(vtkChart::POINTS);\n#if VTK_HAS_SETCOLORF\n  points->SetInputData(table, 0, 1);\n  points->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::CROSS);\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 2);\n  points->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::PLUS);\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 3);\n  points->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n#else\n  points->SetInputData(table, 0, 1);\n  points->SetColor(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::CROSS);\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 2);\n  points->SetColor(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::PLUS);\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 3);\n  points->SetColor(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n#endif\n  renwin->SetMultiSamples(0);\n  renwin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/ChartsOn3DScene/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ChartsOn3DScene)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ChartsOn3DScene: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ChartsOn3DScene MACOSX_BUNDLE ChartsOn3DScene.cxx )\n  target_link_libraries(ChartsOn3DScene PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ChartsOn3DScene\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/ChartsOn3DScene/#download-and-build-chartson3dscene","title":"Download and Build ChartsOn3DScene","text":"

Click here to download ChartsOn3DScene and its CMakeLists.txt file. Once the tarball ChartsOn3DScene.tar has been downloaded and extracted,

cd ChartsOn3DScene/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ChartsOn3DScene\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/CompareRandomGeneratorsCxx/","title":"CompareRandomGeneratorsCxx","text":"

vtk-examples/Cxx/Plotting/CompareRandomGeneratorsCxx

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/CompareRandomGeneratorsCxx/#description","title":"Description","text":"

This example demonstrates 6 random number generators offered by c++11. These are now part of the C++ standard. They offer a different API and more generators than presented the vtk generators vtkMinimalStandardRandomSequence, vtkBoxMuellerRandomSequence, vtkGaussianRandomSequence and vtkMersenneTwister.

The vtkRandomSequence generators are used internally by vtk classes, but application developers may prefer to use the C++ standard generators.

The c++ standard random number collections is described here.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/CompareRandomGeneratorsCxx/#code","title":"Code","text":"

CompareRandomGeneratorsCxx.cxx

#include <vtkActor2D.h>\n#include <vtkBarChartActor.h>\n#include <vtkDataObject.h>\n#include <vtkFieldData.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <algorithm>\n#include <map>\n#include <random>\n#include <vector>\n\nnamespace {\nvtkSmartPointer<vtkIntArray> CreateUniformDistribution(int, double, double);\nvtkSmartPointer<vtkIntArray> CreateNormalDistribution(int, double, double);\nvtkSmartPointer<vtkIntArray> CreateWeibullDistribution(int, double, double);\nvtkSmartPointer<vtkIntArray> CreateGammaDistribution(int, double, double);\nvtkSmartPointer<vtkIntArray> CreateCauchyDistribution(int, double, double);\nvtkSmartPointer<vtkIntArray> CreateExtremeValueDistribution(int, double,\n                                                            double);\n} // namespace\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  int count = 100000;\n  std::map<std::string, vtkSmartPointer<vtkIntArray>> frequencies;\n  frequencies[\"Uniform Distribution\"] =\n      CreateUniformDistribution(count, -200.0, 200.0);\n  frequencies[\"Normal Distribution\"] =\n      CreateNormalDistribution(count, 0.0, 6.0);\n  frequencies[\"Weibull Distribution\"] =\n      CreateWeibullDistribution(count, 1.5, 1.0);\n  frequencies[\"Gamma Distribution\"] = CreateGammaDistribution(count, 2.0, 2.0);\n  frequencies[\"Cauchy Distribution\"] =\n      CreateCauchyDistribution(count, -1.0, 2.0);\n  frequencies[\"Extreme Value Distribution\"] =\n      CreateExtremeValueDistribution(count, .5, 1.0);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  for (auto fit = frequencies.begin(); fit != frequencies.end(); fit++)\n  {\n    vtkNew<vtkBarChartActor> chart;\n\n    vtkNew<vtkDataObject> dataObject;\n    dataObject->GetFieldData()->AddArray(fit->second);\n\n    chart->SetInput(dataObject);\n    chart->SetTitle(fit->first.c_str());\n    chart->GetPositionCoordinate()->SetValue(0.05, 0.05, 0.0);\n    chart->GetPosition2Coordinate()->SetValue(0.95, 0.85, 0.0);\n    chart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n    chart->LegendVisibilityOff();\n    chart->LabelVisibilityOff();\n    chart->TitleVisibilityOff();\n    for (int c = 0; c < count; ++c)\n    {\n      chart->SetBarColor(c, colors->GetColor3d(\"MidnightBlue\").GetData());\n    }\n    // Create a title.\n    vtkNew<vtkTextProperty> titleProperty;\n    titleProperty->SetFontSize(16);\n    titleProperty->SetJustificationToCentered();\n\n    vtkNew<vtkTextMapper> titleMapper;\n    titleMapper->SetInput(fit->first.c_str());\n    titleMapper->SetTextProperty(titleProperty);\n\n    vtkNew<vtkActor2D> titleActor;\n    titleActor->SetMapper(titleMapper);\n    titleActor->GetPositionCoordinate()\n        ->SetCoordinateSystemToNormalizedViewport();\n    titleActor->GetPositionCoordinate()->SetValue(.5, .85, 0.0);\n    titleActor->GetProperty()->SetColor(\n        colors->GetColor3d(\"MidnightBlue\").GetData());\n\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(chart);\n    renderer->AddActor(titleActor);\n    renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n  }\n\n  // Setup a grid of renderers.\n  int gridCols = 3;\n  int gridRows = 2;\n\n  // Define side length (in pixels) of each renderer square.\n  int rendererSize = 300;\n\n  renderWindow->SetWindowName(\"CompareRandomGeneratorsCxx\");\n  renderWindow->SetSize(rendererSize * gridCols, rendererSize * gridRows);\n\n  // Set up a grid of viewports for each renderer.\n  int r = 0;\n  for (auto row = 0; row < gridRows; row++)\n  {\n    for (auto col = 0; col < gridCols; col++)\n    {\n      // auto index = row * gridCols + col;\n\n      // Set the renderer's viewport dimensions (xmin, ymin, xmax, ymax) within\n      // the render window. Note that for the Y values, we need to subtract the\n      // row index from gridRows because the viewport Y axis points upwards, but\n      // we want to draw the grid from top to down.\n      double viewport[4] = {static_cast<double>(col) / gridCols,\n                            static_cast<double>(gridRows - row - 1) / gridRows,\n                            static_cast<double>(col + 1) / gridCols,\n                            static_cast<double>(gridRows - row) / gridRows};\n      renderers[r]->SetViewport(viewport);\n      ++r;\n    }\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  // Initialize the event loop and then start it.\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkIntArray> CreateUniformDistribution(int count, double a,\n                                                       double b)\n{\n  std::mt19937 generator(8775070);\n  double rmin, rmax;\n  rmax = b;\n  rmin = a;\n  std::uniform_real_distribution<double> distribution(a, b);\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[numberOfBins - 1] = 0;\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\n\nvtkSmartPointer<vtkIntArray> CreateNormalDistribution(int count, double a,\n                                                      double b)\n{\n  double rmin, rmax;\n  std::mt19937 generator(8775070);\n  std::normal_distribution<double> distribution(a, b);\n  rmax = 6.0 * b;\n  rmin = -6.0 * b;\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[numberOfBins - 1] = 0;\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\nvtkSmartPointer<vtkIntArray> CreateWeibullDistribution(int count, double a,\n                                                       double b)\n{\n  double rmin, rmax;\n  std::mt19937 generator(8775070);\n  std::weibull_distribution<double> distribution(a, b);\n  rmax = 3.0;\n  rmin = 0.0;\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[numberOfBins - 1] = 0;\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\nvtkSmartPointer<vtkIntArray> CreateGammaDistribution(int count, double a,\n                                                     double b)\n{\n  double rmin, rmax;\n  std::mt19937 generator(8775070);\n  std::gamma_distribution<double> distribution(a, b);\n  rmax = 20.0;\n  rmin = 0.0;\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[numberOfBins - 1] = 0;\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\n\nvtkSmartPointer<vtkIntArray> CreateCauchyDistribution(int count, double a,\n                                                      double b)\n{\n  double rmin, rmax;\n  std::mt19937 generator(8775070);\n  std::cauchy_distribution<double> distribution(a, b);\n\n  rmin = -10;\n  rmax = 15.0;\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[0] = frequencies[1];\n  frequencies[numberOfBins - 1] = frequencies[numberOfBins - 2];\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\nvtkSmartPointer<vtkIntArray> CreateExtremeValueDistribution(int count, double a,\n                                                            double b)\n{\n  double rmin, rmax;\n  std::mt19937 generator(8775070);\n\n  std::extreme_value_distribution<double> distribution(a, b);\n  rmax = 5.0;\n  rmin = -2.0;\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[numberOfBins - 1] = 0;\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\n} // namespace\n
"},{"location":"Cxx/Plotting/CompareRandomGeneratorsCxx/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CompareRandomGeneratorsCxx)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CompareRandomGeneratorsCxx: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CompareRandomGeneratorsCxx MACOSX_BUNDLE CompareRandomGeneratorsCxx.cxx )\n  target_link_libraries(CompareRandomGeneratorsCxx PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CompareRandomGeneratorsCxx\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/CompareRandomGeneratorsCxx/#download-and-build-comparerandomgeneratorscxx","title":"Download and Build CompareRandomGeneratorsCxx","text":"

Click here to download CompareRandomGeneratorsCxx and its CMakeLists.txt file. Once the tarball CompareRandomGeneratorsCxx.tar has been downloaded and extracted,

cd CompareRandomGeneratorsCxx/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CompareRandomGeneratorsCxx\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/Diagram/","title":"Diagram","text":"

vtk-examples/Cxx/Plotting/Diagram

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/Diagram/#description","title":"Description","text":"

This example show how to create a custom vtkChartXY by providing a subclass of vtkContextItem.

Also, the example uses vtkColorSeries to specify the colors of the diagram's boxes. The vtkColorSeries scheme can be specified on the command line. If an unknown scheme is used, a list of valid schemes is provided.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/Diagram/#code","title":"Code","text":"

Diagram.cxx

#include <vtkBrush.h>\n#include <vtkColorSeries.h>\n#include <vtkContext2D.h>\n#include <vtkContextActor.h>\n#include <vtkContextItem.h>\n#include <vtkContextScene.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkPen.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n//----------------------------------------------------------------------------\nclass APIDiagram : public vtkContextItem\n{\npublic:\n  static APIDiagram* New();\n  vtkTypeMacro(APIDiagram, vtkContextItem);\n  APIDiagram()\n  {\n    this->ColorSeries = vtkSmartPointer<vtkColorSeries>::New();\n    this->ColorSchemeName = \"Brewer Diverging Spectral (7)\";\n    this->ColorSeries->SetColorSchemeByName(this->ColorSchemeName);\n  }\n  // Paint event for the chart, called whenever the chart needs to be drawn.\n  virtual bool Paint(vtkContext2D* painter);\n  void SetColorSchemeName(std::string seriesName)\n  {\n    this->ColorSeries->SetColorSchemeByName(seriesName);\n    if (this->ColorSeries->GetColorScheme() >\n        vtkColorSeries::BREWER_QUALITATIVE_SET3)\n    {\n      this->PrintColorSchemes();\n    }\n  }\n  void PrintColorSchemes(ostream& os = std::cout)\n  {\n    int saveId = this->ColorSeries->GetColorScheme();\n    for (unsigned int i = 0; i < vtkColorSeries::BREWER_QUALITATIVE_SET3; ++i)\n    {\n      this->ColorSeries->SetColorScheme(i);\n      os << this->ColorSeries->GetColorSchemeName() << std::endl;\n    }\n    this->ColorSeries->SetColorScheme(saveId);\n  }\n\nprotected:\n  vtkSmartPointer<vtkColorSeries> ColorSeries;\n  std::string ColorSchemeName;\n};\n} // namespace\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  std::string colorSchemeName = \"Brewer Diverging Brown-Blue-Green (7)\";\n  if (argc > 1)\n  {\n    colorSchemeName = std::string(argv[1]);\n  }\n\n  // Set up a 2D chart actor, APIDiagram object andn add them to the renderer.\n  vtkNew<APIDiagram> diagram;\n  diagram->SetColorSchemeName(colorSchemeName);\n\n  vtkNew<vtkContextActor> actor;\n  actor->GetScene()->AddItem(diagram);\n\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Tan\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(800, 600);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Diagram\");\n\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->SetMultiSamples(0);\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\n// Make our new derived class to draw a diagram.\nvtkStandardNewMacro(APIDiagram);\n// This function draws our API diagram\nbool APIDiagram::Paint(vtkContext2D* painter)\n{\n  // Drawing a hard wired diagram 800x600 as a demonstration of the 2D API.\n  painter->GetTextProp()->SetVerticalJustificationToCentered();\n  painter->GetTextProp()->SetJustificationToCentered();\n  painter->GetTextProp()->SetColor(0.0, 0.0, 0.0);\n  painter->GetTextProp()->SetFontSize(24);\n  painter->GetPen()->SetColor(0, 0, 0);\n\n  unsigned int c = 0;\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n\n  painter->DrawRect(100, 50, 200, 100);\n  painter->DrawString(200, 100, \"OpenGL\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n  painter->DrawRect(300, 50, 200, 100);\n  painter->DrawString(400, 100, \"Others?\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n  painter->DrawRect(500, 50, 200, 100);\n  painter->DrawString(600, 100, \"Others?\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n  painter->DrawRect(100, 150, 600, 100);\n  painter->DrawString(400, 200, \"2D API\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n  painter->DrawRect(100, 250, 600, 200);\n  painter->DrawString(400, 400, \"Canvas API\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n  painter->DrawRect(100, 250, 300, 100);\n  painter->DrawString(250, 300, \"Point Mark\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  painter->DrawRect(100, 450, 600, 100);\n  painter->DrawString(400, 500, \"Canvas View\");\n\n  return true;\n}\n
"},{"location":"Cxx/Plotting/Diagram/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Diagram)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Diagram: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Diagram MACOSX_BUNDLE Diagram.cxx )\n  target_link_libraries(Diagram PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Diagram\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/Diagram/#download-and-build-diagram","title":"Download and Build Diagram","text":"

Click here to download Diagram and its CMakeLists.txt file. Once the tarball Diagram.tar has been downloaded and extracted,

cd Diagram/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Diagram\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/FunctionalBagPlot/","title":"FunctionalBagPlot","text":"

vtk-examples/Cxx/Plotting/FunctionalBagPlot

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/FunctionalBagPlot/#description","title":"Description","text":"

This example illustrates how to use the vtkPlotFunctionalBag. This class, depending on the number of components in a column, will either draw a line plot (1 component) or, for two component columns, a filled polygonal band (the bag) going from the first to second component.

The example uses a qualitative color map selected from vtkColorSeries.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/FunctionalBagPlot/#code","title":"Code","text":"

FunctionalBagPlot.cxx

#include <vtkChartLegend.h>\n#include <vtkChartXY.h>\n#include <vtkColorSeries.h>\n#include <vtkContextView.h>\n#include <vtkDoubleArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPen.h>\n#include <vtkPlotFunctionalBag.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#include <sstream>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Creates an input table\n  const int numCols = 7;\n  const int numVals = 100;\n\n  vtkNew<vtkTable> inputTable;\n\n  vtkNew<vtkDoubleArray> arr[numCols];\n  for (int i = 0; i < numCols; i++)\n  {\n    std::stringstream ss;\n    ss << \"Y\" << i;\n    arr[i]->SetName(ss.str().c_str());\n    arr[i]->SetNumberOfValues(numVals);\n    for (int j = 0; j < numVals; j++)\n    {\n      arr[i]->SetValue(j,\n                       (i + 1) *\n                               fabs(sin((j * 2.f * vtkMath::Pi()) /\n                                        static_cast<float>(numVals))) *\n                               j +\n                           i * 20);\n    }\n    inputTable->AddColumn(arr[i]);\n  }\n\n  // Create a X-axis column\n  vtkNew<vtkDoubleArray> xArr;\n  xArr->SetName(\"X\");\n  xArr->SetNumberOfValues(numVals);\n  for (int j = 0; j < numVals; j++)\n  {\n    xArr->SetValue(j, j * 2.0);\n  }\n  inputTable->AddColumn(xArr);\n\n  // Create the bag columns\n  vtkNew<vtkDoubleArray> q3Arr;\n  q3Arr->SetName(\"Q3\");\n  q3Arr->SetNumberOfComponents(2);\n  q3Arr->SetNumberOfTuples(numVals);\n  vtkNew<vtkDoubleArray> q2Arr;\n  q2Arr->SetName(\"Q2\");\n  q2Arr->SetNumberOfComponents(2);\n  q2Arr->SetNumberOfTuples(numVals);\n\n  for (int i = 0; i < numVals; i++)\n  {\n    double v0, v1;\n    v0 = arr[1]->GetVariantValue(i).ToFloat();\n    v1 = arr[5]->GetVariantValue(i).ToFloat();\n    q3Arr->SetTuple2(i, v0, v1);\n\n    v0 = arr[2]->GetVariantValue(i).ToFloat();\n    v1 = arr[4]->GetVariantValue(i).ToFloat();\n    q2Arr->SetTuple2(i, v0, v1);\n  }\n\n  inputTable->AddColumn(q3Arr);\n  inputTable->AddColumn(q2Arr);\n\n  // Set up a 2D scene and add an XY chart to it\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->SetWindowName(\"FunctionalBagPlot\");\n\n  vtkNew<vtkChartXY> chart;\n  chart->SetShowLegend(true);\n  chart->GetLegend()->SetHorizontalAlignment(vtkChartLegend::LEFT);\n  chart->GetLegend()->SetVerticalAlignment(vtkChartLegend::TOP);\n\n  view->GetScene()->AddItem(chart);\n\n  // Create the functional bag plots\n  vtkColor3d color3d = colors->GetColor3d(\"Tomato\");\n  vtkNew<vtkPlotFunctionalBag> q3Plot;\n#if VTK_HAS_SETCOLORF\n  q3Plot->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n#else\n  q3Plot->SetColor(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n#endif\n  q3Plot->SetInputData(inputTable, \"X\", \"Q3\");\n  chart->AddPlot(q3Plot);\n\n  color3d = colors->GetColor3d(\"Banana\");\n  vtkNew<vtkPlotFunctionalBag> q2Plot;\n#if VTK_HAS_SETCOLORF\n  q2Plot->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n#else\n  q2Plot->SetColor(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n#endif\n  q2Plot->SetInputData(inputTable, \"X\", \"Q2\");\n  chart->AddPlot(q2Plot);\n\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_QUALITATIVE_SET3);\n  ;\n\n  vtkNew<vtkLookupTable> lookup;\n  lookup->SetNumberOfColors(numCols);\n  lookup->SetRange(0, numCols - 1);\n  for (int j = 0; j < numCols; j++)\n  {\n    vtkNew<vtkPlotFunctionalBag> plot;\n    vtkColor3ub color = colorSeries->GetColorRepeating(j);\n    lookup->SetTableValue(j, color.GetRed() / 255., color.GetGreen() / 255.,\n                          color.GetBlue() / 255., 1.);\n    double rgb[3];\n    lookup->GetColor(j, rgb);\n#if VTK_HAS_SETCOLORF\n    plot->SetColorF(rgb[0], rgb[1], rgb[2]);\n#else\n    plot->SetColor(rgb[0], rgb[1], rgb[2]);\n#endif\n    plot->SetInputData(inputTable, \"X\", inputTable->GetColumn(j)->GetName());\n    plot->GetPen()->SetWidth(3.0);\n    chart->AddPlot(plot);\n  }\n\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render the scene\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/FunctionalBagPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FunctionalBagPlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FunctionalBagPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FunctionalBagPlot MACOSX_BUNDLE FunctionalBagPlot.cxx )\n  target_link_libraries(FunctionalBagPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FunctionalBagPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/FunctionalBagPlot/#download-and-build-functionalbagplot","title":"Download and Build FunctionalBagPlot","text":"

Click here to download FunctionalBagPlot and its CMakeLists.txt file. Once the tarball FunctionalBagPlot.tar has been downloaded and extracted,

cd FunctionalBagPlot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FunctionalBagPlot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/Histogram2D/","title":"Histogram2D","text":"

vtk-examples/Cxx/Plotting/Histogram2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/Histogram2D/#description","title":"Description","text":"

This examples uses a vtkChartHistogram to draw a 2D histogram represented as an image.

The example shows how to set various properties.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/Histogram2D/#code","title":"Code","text":"

Histogram2D.cxx

#include <vtkAxis.h>\n#include <vtkBrush.h>\n#include <vtkChartHistogram2D.h>\n#include <vtkColorLegend.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkContextView.h>\n#include <vtkImageData.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  // Define colors.\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SlateGray\");\n  vtkColor3d titleColor = colors->GetColor3d(\"Orange\");\n  vtkColor3d axisTitleColor = colors->GetColor3d(\"Orange\");\n  vtkColor3d axisLabelColor = colors->GetColor3d(\"Beige\");\n  vtkColor4ub legendBackgroundColor = colors->GetColor4ub(\"Tomato\");\n\n  // Set up a 2D scene, add an XY chart to it.\n  int size = 400;\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(512, 512);\n  view->GetRenderWindow()->SetWindowName(\"Histogram2D\");\n\n  view->GetRenderer()->SetBackground(backgroundColor.GetData());\n\n  // Define a chart\n  vtkNew<vtkChartHistogram2D> chart;\n\n  // Chart Title.\n  chart->SetTitle(\"2D Histogram\");\n  chart->GetTitleProperties()->SetFontSize(36);\n  chart->GetTitleProperties()->SetColor(titleColor.GetData());\n\n  // Chart Axes.\n  chart->GetAxis(0)->GetTitleProperties()->SetFontSize(24);\n  chart->GetAxis(0)->GetTitleProperties()->SetColor(axisTitleColor.GetData());\n  chart->GetAxis(0)->GetLabelProperties()->SetColor(axisLabelColor.GetData());\n  chart->GetAxis(0)->GetLabelProperties()->SetFontSize(18);\n\n  chart->GetAxis(1)->GetTitleProperties()->SetFontSize(24);\n  chart->GetAxis(1)->GetTitleProperties()->SetColor(\n      colors->GetColor3d(\"orange\").GetData());\n  chart->GetAxis(1)->GetLabelProperties()->SetColor(\n      colors->GetColor3d(\"beige\").GetData());\n  chart->GetAxis(1)->GetLabelProperties()->SetFontSize(18);\n\n  // Chart Legend.\n  dynamic_cast<vtkColorLegend*>(chart->GetLegend())->DrawBorderOn();\n  chart->GetLegend()->GetBrush()->SetColor(legendBackgroundColor);\n\n  // Add the chart to the view.\n  view->GetScene()->AddItem(chart);\n\n  vtkNew<vtkImageData> data;\n  data->SetExtent(0, size - 1, 0, size - 1, 0, 0);\n  data->AllocateScalars(VTK_DOUBLE, 1);\n\n  data->SetOrigin(100.0, -100.0, 0.0);\n  data->SetSpacing(2.0, 1.0, 1.0);\n\n  double* dPtr = static_cast<double*>(data->GetScalarPointer(0, 0, 0));\n  for (int i = 0; i < size; ++i)\n  {\n    for (int j = 0; j < size; ++j)\n    {\n      dPtr[i * size + j] =\n          std::sin(vtkMath::RadiansFromDegrees(double(2 * i))) *\n          std::cos(vtkMath::RadiansFromDegrees(double(j)));\n    }\n  }\n  chart->SetInputData(data);\n\n  vtkNew<vtkColorTransferFunction> transferFunction;\n  transferFunction->AddHSVSegment(0.0, 0.0, 1.0, 1.0, 0.3333, 0.3333, 1.0, 1.0);\n  transferFunction->AddHSVSegment(0.3333, 0.3333, 1.0, 1.0, 0.6666, 0.6666, 1.0,\n                                  1.0);\n  transferFunction->AddHSVSegment(0.6666, 0.6666, 1.0, 1.0, 1.0, 0.2, 1.0, 0.3);\n  transferFunction->Build();\n  chart->SetTransferFunction(transferFunction);\n\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/Histogram2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Histogram2D)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Histogram2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Histogram2D MACOSX_BUNDLE Histogram2D.cxx )\n  target_link_libraries(Histogram2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Histogram2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/Histogram2D/#download-and-build-histogram2d","title":"Download and Build Histogram2D","text":"

Click here to download Histogram2D and its CMakeLists.txt file. Once the tarball Histogram2D.tar has been downloaded and extracted,

cd Histogram2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Histogram2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/HistogramBarChart/","title":"HistogramBarChart","text":"

vtk-examples/Cxx/Plotting/HistogramBarChart

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/HistogramBarChart/#code","title":"Code","text":"

HistogramBarChart.cxx

#include <vtkActor.h>\n#include <vtkBarChartActor.h>\n#include <vtkFieldData.h>\n#include <vtkImageAccumulate.h>\n#include <vtkImageData.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkIntArray.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStdString.h>\n\nint main(int argc, char* argv[])\n{\n  // Handle the arguments\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename [optional ignore zero:] <y/n> \"\n                 \"e.g. Pileated.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  int ignoreZero = 0;\n  if (argc == 3)\n  {\n    vtkStdString ignore = argv[2];\n    std::cout << ignore << std::endl;\n    if (ignore == \"y\" || ignore == \"Y\")\n    {\n      ignoreZero = 1;\n    }\n  }\n\n  // Read an image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  int numComponents = reader->GetOutput()->GetNumberOfScalarComponents();\n  std::cout << \"Number of components: \" << numComponents << std::endl;\n  if (numComponents > 3)\n  {\n    std::cout << \"Error: cannot process an image with \" << numComponents\n              << \" components!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  double colors[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};\n\n  // const char* labels[3] = {\n  //  \"Red\", \"Green\", \"Blue\" };\n\n  vtkNew<vtkIntArray> redFrequencies;\n  vtkNew<vtkIntArray> greenFrequencies;\n  vtkNew<vtkIntArray> blueFrequencies;\n\n  // Process the image, extracting and barChartting a histogram for each\n  // component.\n  for (int i = 0; i < numComponents; ++i)\n  {\n    vtkNew<vtkImageExtractComponents> extract;\n    extract->SetInputConnection(reader->GetOutputPort());\n    extract->SetComponents(i);\n    extract->Update();\n\n    vtkNew<vtkImageAccumulate> histogram;\n    histogram->SetInputConnection(extract->GetOutputPort());\n    histogram->SetComponentExtent(1, 55, 0, 0, 0, 0);\n    histogram->SetComponentOrigin(0, 0, 0);\n    histogram->SetComponentSpacing(1, 0, 0);\n    histogram->SetIgnoreZero(ignoreZero);\n    histogram->Update();\n\n    vtkIntArray* currentArray = 0;\n    if (i == 0)\n    {\n      currentArray = redFrequencies;\n    }\n    else if (i == 1)\n    {\n      currentArray = greenFrequencies;\n    }\n    else\n    {\n      currentArray = blueFrequencies;\n    }\n\n    currentArray->SetNumberOfComponents(1);\n    currentArray->SetNumberOfTuples(54);\n\n    vtkIdType* output =\n        static_cast<vtkIdType*>(histogram->GetOutput()->GetScalarPointer());\n\n    for (int j = 0; j < 54; ++j)\n    {\n      currentArray->SetTuple1(j, *output++);\n    }\n  }\n\n  vtkNew<vtkDataObject> dataObject;\n\n  if (numComponents == 1)\n  {\n    dataObject->GetFieldData()->AddArray(redFrequencies);\n  }\n  else\n  {\n    vtkIntArray* rgb[3] = {0, 0, 0};\n    vtkNew<vtkIntArray> allFrequencies;\n    allFrequencies->SetNumberOfComponents(1);\n    if (numComponents == 2)\n    {\n      rgb[0] = redFrequencies;\n      rgb[1] = greenFrequencies;\n    }\n    else\n    {\n      rgb[0] = redFrequencies;\n      rgb[1] = greenFrequencies;\n      rgb[2] = blueFrequencies;\n    }\n    for (int i = 0; i < 54; ++i)\n    {\n      for (int j = 0; j < numComponents; ++j)\n      {\n        allFrequencies->InsertNextTuple1(rgb[j]->GetTuple1(i));\n      }\n    }\n\n    dataObject->GetFieldData()->AddArray(allFrequencies);\n  }\n\n  // Create a vtkBarChartActor.\n  vtkNew<vtkBarChartActor> barChart;\n\n  // BUG 1: If input is not set first, the x-axis of the bar chart will be too\n  // long.\n  //\n  barChart->SetInput(dataObject);\n  barChart->SetTitle(\"Histogram\");\n  barChart->GetPositionCoordinate()->SetValue(0.05, 0.05, 0.0);\n  barChart->GetPosition2Coordinate()->SetValue(0.95, 0.85, 0.0);\n  barChart->GetProperty()->SetColor(1, 1, 1);\n\n  // BUG 2: If the number of entries is not set to the number of data array\n  // tuples, the bar chart actor will crash. The crash occurs whether the legend\n  // and or labels are visible or not.\n\n  barChart->GetLegendActor()->SetNumberOfEntries(\n      dataObject->GetFieldData()->GetArray(0)->GetNumberOfTuples());\n  barChart->LegendVisibilityOff();\n  barChart->LabelVisibilityOff();\n\n  // BUG 3: the y-axis labels do not accurately reflect the range of data.\n\n  int count = 0;\n  for (int i = 0; i < 54; ++i)\n  {\n    for (int j = 0; j < numComponents; ++j)\n    {\n      barChart->SetBarColor(count++, colors[j]);\n    }\n  }\n\n  // Visualize the histogram(s)\n  vtkNew<vtkNamedColors> namedColors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(barChart);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"HistogramBarChart\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  // Initialize the event loop and then start it.\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/HistogramBarChart/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HistogramBarChart)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingStatistics\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HistogramBarChart: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HistogramBarChart MACOSX_BUNDLE HistogramBarChart.cxx )\n  target_link_libraries(HistogramBarChart PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HistogramBarChart\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/HistogramBarChart/#download-and-build-histogrambarchart","title":"Download and Build HistogramBarChart","text":"

Click here to download HistogramBarChart and its CMakeLists.txt file. Once the tarball HistogramBarChart.tar has been downloaded and extracted,

cd HistogramBarChart/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HistogramBarChart\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/LinePlot/","title":"LinePlot","text":"

vtk-examples/Cxx/Plotting/LinePlot

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/LinePlot/#description","title":"Description","text":"

This example demonstrates how to plot XY data.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/LinePlot/#code","title":"Code","text":"

LinePlot.cxx

#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a table with some points in it.\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  // Fill in the table with some example values.\n  int numPoints = 69;\n  float inc = 7.5 / (numPoints - 1);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc);\n    table->SetValue(i, 1, cos(i * inc));\n    table->SetValue(i, 2, sin(i * inc));\n  }\n\n  // Set up the view\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetWindowName(\"LinePlot\");\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Add multiple line plots, setting the colors etc.\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  vtkPlot* line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 1);\n  line->SetColor(0, 255, 0, 255);\n  line->SetWidth(1.0);\n  line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 2);\n  line->SetColor(255, 0, 0, 255);\n  line->SetWidth(5.0);\n\n  // For dotted line, the line type can be from 2 to 5 for different dash/dot\n  // patterns (see enum in vtkPen containing DASH_LINE, value 2):\n  // #ifndef WIN32\n  //   line->GetPen()->SetLineType(vtkPen::DASH_LINE);\n  // #endif\n  // (ifdef-ed out on Windows because DASH_LINE does not work on Windows\n  //  machines with built-in Intel HD graphics card...)\n\n  // view->GetRenderWindow()->SetMultiSamples(0);\n\n  // Start interactor\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/LinePlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LinePlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LinePlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LinePlot MACOSX_BUNDLE LinePlot.cxx )\n  target_link_libraries(LinePlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LinePlot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/LinePlot/#download-and-build-lineplot","title":"Download and Build LinePlot","text":"

Click here to download LinePlot and its CMakeLists.txt file. Once the tarball LinePlot.tar has been downloaded and extracted,

cd LinePlot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LinePlot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/MultiplePlots/","title":"MultiplePlots","text":"

vtk-examples/Cxx/Plotting/MultiplePlots

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/MultiplePlots/#description","title":"Description","text":"

Display multiple plots by using viewports in a single render window.

In this case, we display two graphs side-by-side.

The difference between setting a background in the renderer and setting the chart background is shown.

Note

This example was prompted by this discussion vtk chart background shifted towards origin.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/MultiplePlots/#code","title":"Code","text":"

MultiplePlots.cxx

#include <vtkAxis.h>\n#include <vtkBrush.h>\n#include <vtkChartXY.h>\n#include <vtkContextActor.h>\n#include <vtkContextScene.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#include <array>\n#include <cmath>\n#include <vector>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"MultiplePlots\");\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Setup the viewports\n  auto gridDimensionsX = 2;\n  auto gridDimensionsY = 1;\n  auto rendererSizeX = 320;\n  auto rendererSizeY = 240;\n  renWin->SetSize(rendererSizeX * gridDimensionsX,\n                  rendererSizeY * gridDimensionsY);\n  std::cout << rendererSizeX * gridDimensionsX << \" \"\n            << gridDimensionsY * gridDimensionsY << std::endl;\n  std::vector<std::array<double, 4>> viewPorts;\n  for (auto row = 0; row < gridDimensionsY; ++row)\n  {\n    for (auto col = 0; col < gridDimensionsX; ++col)\n    {\n      // index = row * gridDimensionsX + col\n\n      // (xmin, ymin, xmax, ymax)\n      viewPorts.push_back(std::array<double, 4>{\n          static_cast<double>(col) / gridDimensionsX,\n          static_cast<double>(gridDimensionsY - (row + 1.0)) / gridDimensionsY,\n          static_cast<double>(col + 1.0) / gridDimensionsX,\n          static_cast<double>(gridDimensionsY - static_cast<double>(row)) /\n              gridDimensionsY});\n    }\n  }\n\n  // Link the renderers to the viewports.\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n  leftRenderer->SetViewport(viewPorts[0].data());\n  renWin->AddRenderer(leftRenderer);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetBackground(colors->GetColor3d(\"Lavender\").GetData());\n  rightRenderer->SetViewport(viewPorts[1].data());\n  renWin->AddRenderer(rightRenderer);\n\n  // Create the charts.\n  vtkNew<vtkChartXY> leftChart;\n  vtkNew<vtkContextScene> leftChartScene;\n  vtkNew<vtkContextActor> leftChartActor;\n\n  leftChartScene->AddItem(leftChart);\n  leftChartActor->SetScene(leftChartScene);\n\n  leftRenderer->AddActor(leftChartActor);\n  leftChartScene->SetRenderer(leftRenderer);\n\n  auto xAxis = leftChart->GetAxis(vtkAxis::BOTTOM);\n  xAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"LightGrey\"));\n  xAxis->SetTitle(\"x\");\n  auto yAxis = leftChart->GetAxis(vtkAxis::LEFT);\n  yAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"LightGrey\"));\n  yAxis->SetTitle(\"cos(x)\");\n#if VTK_HAS_SETCOLORF\n  leftChart->GetBackgroundBrush()->SetColorF(\n      colors->GetColor4d(\"MistyRose\").GetData());\n#else\n  leftChart->GetBackgroundBrush()->SetColor(\n      colors->GetColor4d(\"MistyRose\").GetData());\n#endif\n  leftChart->GetBackgroundBrush()->SetOpacityF(0.4);\n  leftChart->SetTitle(\"Cosine\");\n\n  vtkNew<vtkChartXY> rightChart;\n  vtkNew<vtkContextScene> rightChartScene;\n  vtkNew<vtkContextActor> rightChartActor;\n\n  rightChartScene->AddItem(rightChart);\n  rightChartActor->SetScene(rightChartScene);\n\n  rightRenderer->AddActor(rightChartActor);\n  rightChartScene->SetRenderer(rightRenderer);\n\n  xAxis = rightChart->GetAxis(vtkAxis::BOTTOM);\n  xAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"LightCyan\"));\n  xAxis->SetTitle(\"x\");\n  yAxis = rightChart->GetAxis(vtkAxis::LEFT);\n  yAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"LightCyan\"));\n  yAxis->SetTitle(\"sin(x)\");\n#if VTK_HAS_SETCOLORF\n  rightChart->GetBackgroundBrush()->SetColorF(\n      colors->GetColor4d(\"Thistle\").GetData());\n#else\n  rightChart->GetBackgroundBrush()->SetColor(\n      colors->GetColor4d(\"Thistle\").GetData());\n#endif\n  rightChart->GetBackgroundBrush()->SetOpacityF(0.4);\n  rightChart->SetTitle(\"Sine\");\n\n  // Create a table with some points in it.\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  // Fill in the table with some example values.\n  auto numPoints = 40;\n  auto inc = 7.5 / (numPoints - 1.0);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc);\n    table->SetValue(i, 1, cos(i * inc));\n    table->SetValue(i, 2, sin(i * inc));\n  }\n\n  auto ptColor = colors->GetColor4ub(\"Black\");\n\n  auto points = leftChart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 1);\n  points->SetColor(ptColor.GetRed(), ptColor.GetGreen(), ptColor.GetBlue(),\n                   ptColor.GetAlpha());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::CROSS);\n\n  points = rightChart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 2);\n  points->SetColor(ptColor.GetRed(), ptColor.GetGreen(), ptColor.GetBlue(),\n                   ptColor.GetAlpha());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::PLUS);\n\n  renWin->Render();\n  iRen->Initialize();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/MultiplePlots/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultiplePlots)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultiplePlots: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultiplePlots MACOSX_BUNDLE MultiplePlots.cxx )\n  target_link_libraries(MultiplePlots PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultiplePlots\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/MultiplePlots/#download-and-build-multipleplots","title":"Download and Build MultiplePlots","text":"

Click here to download MultiplePlots and its CMakeLists.txt file. Once the tarball MultiplePlots.tar has been downloaded and extracted,

cd MultiplePlots/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MultiplePlots\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/ParallelCoordinates/","title":"ParallelCoordinates","text":"

vtk-examples/Cxx/Plotting/ParallelCoordinates

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/ParallelCoordinates/#code","title":"Code","text":"

ParallelCoordinates.cxx

#include <vtkChartParallelCoordinates.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  view->GetRenderWindow()->SetSize(800, 600);\n  view->GetRenderWindow()->SetWindowName(\"ParallelCoordinates\");\n\n  vtkNew<vtkChartParallelCoordinates> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"Field 1\");\n  table->AddColumn(arrX);\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Field 2\");\n  table->AddColumn(arrC);\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Field 3\");\n  table->AddColumn(arrS);\n  vtkNew<vtkFloatArray> arrS2;\n  arrS2->SetName(\"Field 4\");\n  table->AddColumn(arrS2);\n  // Test charting with a few more points...\n\n  table->SetNumberOfRows(10);\n  for (int i = 0; i < 10; ++i)\n  {\n    table->SetValue(i, 0, 0 * i);\n    table->SetValue(i, 1, 1 * i);\n    table->SetValue(i, 2, 2 * i);\n    table->SetValue(i, 3, 3 * i);\n  }\n\n  chart->GetPlot(0)->SetInputData(table);\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/ParallelCoordinates/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParallelCoordinates)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParallelCoordinates: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParallelCoordinates MACOSX_BUNDLE ParallelCoordinates.cxx )\n  target_link_libraries(ParallelCoordinates PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParallelCoordinates\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/ParallelCoordinates/#download-and-build-parallelcoordinates","title":"Download and Build ParallelCoordinates","text":"

Click here to download ParallelCoordinates and its CMakeLists.txt file. Once the tarball ParallelCoordinates.tar has been downloaded and extracted,

cd ParallelCoordinates/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ParallelCoordinates\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/PieChart/","title":"PieChart","text":"

vtk-examples/Cxx/Plotting/PieChart

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/PieChart/#code","title":"Code","text":"

PieChart.cxx

#include <vtkChartPie.h>\n#include <vtkColorSeries.h>\n#include <vtkContextView.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotPie.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStringArray.h>\n#include <vtkTable.h>\n\nnamespace {\nconstexpr int NUM_ITEMS = 5;\nconstexpr int data[] = {77938, 9109, 2070, 12806, 19514};\n// constexpr int data[] = {200,200,200,200,200};\nstd::string labels[] = {\"Books\", \"New and Popular\", \"Periodical\", \"Audiobook\",\n                        \"Video\"};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  view->GetRenderWindow()->SetSize(600, 350);\n  view->GetRenderWindow()->SetWindowName(\"PieChart\");\n\n  vtkNew<vtkChartPie> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkIntArray> arrData;\n  vtkNew<vtkStringArray> labelArray;\n\n  arrData->SetName(\"2008 Circulation\");\n  for (int i = 0; i < NUM_ITEMS; i++)\n  {\n    arrData->InsertNextValue(data[i]);\n    labelArray->InsertNextValue(labels[i]);\n  }\n\n  table->AddColumn(arrData);\n\n  // Create a color series to use with our stacks.\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::WARM);\n\n  // Add multiple line plots, setting the colors etc\n  vtkPlotPie* pie = dynamic_cast<vtkPlotPie*>(chart->AddPlot(0));\n  pie->SetColorSeries(colorSeries);\n  pie->SetInputData(table);\n  pie->SetInputArray(0, \"2008 Circulation\");\n  pie->SetLabels(labelArray);\n\n  chart->SetShowLegend(true);\n\n  chart->SetTitle(\"Circulation 2008\");\n\n  // Finally render the scene and compare the image to a reference image\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/PieChart/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PieChart)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PieChart: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PieChart MACOSX_BUNDLE PieChart.cxx )\n  target_link_libraries(PieChart PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PieChart\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/PieChart/#download-and-build-piechart","title":"Download and Build PieChart","text":"

Click here to download PieChart and its CMakeLists.txt file. Once the tarball PieChart.tar has been downloaded and extracted,

cd PieChart/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PieChart\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/PieChartActor/","title":"PieChartActor","text":"

vtk-examples/Cxx/Plotting/PieChartActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/PieChartActor/#code","title":"Code","text":"

PieChartActor.cxx

#include <vtkColorSeries.h>\n#include <vtkDataObject.h>\n#include <vtkFieldData.h>\n#include <vtkFloatArray.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPieChartActor.h>\n#include <vtkPoints.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\n#include <map>\n\nint main(int /*argc*/, char* /*argv*/[])\n{\n  typedef std::map<std::string, int> DataContainer;\n  DataContainer movies;\n\n  movies[\"Comedy\"] = 27;\n  movies[\"Action\"] = 18;\n  movies[\"Romance\"] = 14;\n  movies[\"Drama\"] = 14;\n  movies[\"Horror\"] = 11;\n  movies[\"Foreign\"] = 8;\n  movies[\"Scifi\"] = 8;\n\n  int numTuples = static_cast<int>(movies.size());\n\n  vtkNew<vtkFloatArray> bitter;\n  bitter->SetNumberOfTuples(numTuples);\n\n  DataContainer::iterator m;\n  int i = 0;\n  for (m = movies.begin(); m != movies.end(); ++m)\n  {\n    bitter->SetTuple1(i++, m->second);\n  }\n\n  vtkNew<vtkDataObject> dobj;\n  dobj->GetFieldData()->AddArray(bitter);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPieChartActor> actor;\n  actor->SetInputData(dobj);\n  actor->SetTitle(\"Movie Watching\");\n  actor->GetPositionCoordinate()->SetValue(0.05, 0.1, 0.0);\n  actor->GetPosition2Coordinate()->SetValue(0.95, 0.85, 0.0);\n  actor->GetProperty()->SetColor(0, 0, 0);\n  actor->GetProperty()->SetLineWidth(2);\n  actor->GetLabelTextProperty()->SetFontSize(18);\n  actor->GetLegendActor()->SetNumberOfEntries(numTuples);\n\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_QUALITATIVE_PASTEL2);\n  i = 0;\n  for (m = movies.begin(); m != movies.end(); ++m)\n  {\n    vtkColor3ub rgb = colorSeries->GetColorRepeating(i);\n    actor->SetPieceColor(i, static_cast<double>(rgb.GetRed()) / 255.0,\n                         static_cast<double>(rgb.GetGreen()) / 255.0,\n                         static_cast<double>(rgb.GetBlue()) / 255.0);\n    actor->SetPieceLabel(i++, m->first.c_str());\n  }\n  actor->LegendVisibilityOn();\n  // Set text colors (same as actor for backward compat with test).\n  actor->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  actor->GetTitleTextProperty()->SetFontSize(40);\n  actor->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"Bisque\").GetData());\n  actor->GetLabelTextProperty()->SetFontSize(24);\n\n  // Create the RenderWindow, Renderer and both Actors.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren1->AddActor(actor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(1024, 512);\n  renWin->SetWindowName(\"PieChartActor\");\n\n  // Render the image.\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/PieChartActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PieChartActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PieChartActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PieChartActor MACOSX_BUNDLE PieChartActor.cxx )\n  target_link_libraries(PieChartActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PieChartActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/PieChartActor/#download-and-build-piechartactor","title":"Download and Build PieChartActor","text":"

Click here to download PieChartActor and its CMakeLists.txt file. Once the tarball PieChartActor.tar has been downloaded and extracted,

cd PieChartActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PieChartActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/PlotLine3D/","title":"PlotLine3D","text":"

vtk-examples/Cxx/Plotting/PlotLine3D

"},{"location":"Cxx/Plotting/PlotLine3D/#description","title":"Description","text":"

This example illustrates plotting 3D points using vtkPlotLine3D. It plots the solution to the Lorenz Attractor.

Warning

The current vtkPlotLine3D produces the warning, \"vtkOpenGLContextDevice3D (): a line width has been requested that is larger than your system supports\" which appears to have no effect on the results.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/PlotLine3D/#code","title":"Code","text":"

PlotLine3D.cxx

#include <vtkCamera.h>\n#include <vtkChartXYZ.h>\n#include <vtkContext3D.h>\n#include <vtkContextScene.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPen.h>\n#include <vtkPlotLine3D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n// Plot the solution to the Lorenz attractor.\n// http://en.wikipedia.org/wiki/Lorenz_system\nnamespace {\nvoid lorenz(const float* varX, float* varXDerivative)\n{\n  const float sigma = 10.f;\n  const float rho = 28.f;\n  const float beta = 2.66666666666f;\n\n  varXDerivative[0] = sigma * (varX[1] - varX[0]);\n  varXDerivative[1] = varX[0] * (rho - varX[2]) - varX[1];\n  varXDerivative[2] = varX[0] * varX[1] - beta * varX[2];\n}\n} // namespace\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the data.\n  vtkNew<vtkTable> varXSolution;\n\n  vtkNew<vtkFloatArray> arrX0;\n  arrX0->SetName(\"X\");\n  varXSolution->AddColumn(arrX0);\n\n  vtkNew<vtkFloatArray> arrX1;\n  arrX1->SetName(\"Y\");\n  varXSolution->AddColumn(arrX1);\n\n  vtkNew<vtkFloatArray> arrX2;\n  arrX2->SetName(\"Z\");\n  varXSolution->AddColumn(arrX2);\n\n  const unsigned int numberOfTimePoints = 1000;\n  varXSolution->SetNumberOfRows(numberOfTimePoints);\n  float varX[3];\n  varX[0] = 0.0f;\n  varX[1] = 1.0f;\n  varX[2] = 1.05f;\n\n  float varXDerivative[3];\n  const float deltaT = 0.01f;\n  for (unsigned int ii = 0; ii < numberOfTimePoints; ++ii)\n  {\n    varXSolution->SetValue(ii, 0, varX[0]);\n    varXSolution->SetValue(ii, 1, varX[1]);\n    varXSolution->SetValue(ii, 2, varX[2]);\n    lorenz(varX, varXDerivative);\n    varX[0] += varXDerivative[0] * deltaT;\n    varX[1] += varXDerivative[1] * deltaT;\n    varX[2] += varXDerivative[2] * deltaT;\n  }\n\n  // Set up a 3D scene and add an XYZ chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetRenderWindow()->SetWindowName(\"PlotLine3D\");\n\n  vtkNew<vtkChartXYZ> chart;\n  chart->SetGeometry(vtkRectf(5.0, 5.0, 635.0, 475.0));\n  view->GetScene()->AddItem(chart);\n\n  // Add a line plot.\n  vtkNew<vtkPlotLine3D> plot;\n  plot->SetInputData(varXSolution);\n#if VTK_HAS_SETCOLORF\n  plot->GetPen()->SetColorF(colors->GetColor3d(\"LightCoral\").GetData());\n#else\n  plot->GetPen()->SetColor(colors->GetColor3d(\"LightCoral\").GetData());\n#endif\n  view->GetRenderWindow()->SetMultiSamples(0);\n  plot->GetPen()->SetWidth(2.0);\n  chart->AddPlot(plot);\n\n  // Finally render the scene.\n  view->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkOliveGreen\").GetData());\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/PlotLine3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlotLine3D)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlotLine3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlotLine3D MACOSX_BUNDLE PlotLine3D.cxx )\n  target_link_libraries(PlotLine3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlotLine3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/PlotLine3D/#download-and-build-plotline3d","title":"Download and Build PlotLine3D","text":"

Click here to download PlotLine3D and its CMakeLists.txt file. Once the tarball PlotLine3D.tar has been downloaded and extracted,

cd PlotLine3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PlotLine3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/ScatterPlot/","title":"ScatterPlot","text":"

vtk-examples/Cxx/Plotting/ScatterPlot

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/ScatterPlot/#code","title":"Code","text":"

ScatterPlot.cxx

#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(400, 300);\n  view->GetRenderWindow()->SetWindowName(\"ScatterPlot\");\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  chart->SetShowLegend(true);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  vtkNew<vtkFloatArray> arrT;\n  arrT->SetName(\"Sine - Cosine\");\n  table->AddColumn(arrT);\n\n  // Test charting with a few more points...\n  int numPoints = 40;\n  float inc = 7.5 / (numPoints - 1);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc);\n    table->SetValue(i, 1, cos(i * inc) + 0.0);\n    table->SetValue(i, 2, sin(i * inc) + 0.0);\n    table->SetValue(i, 3, sin(i * inc) - cos(i * inc));\n  }\n\n  // Add multiple scatter plots, setting the colors etc.\n  vtkPlot* points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 1);\n  points->SetColor(0, 0, 0, 255);\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::CROSS);\n\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 2);\n  points->SetColor(0, 0, 0, 255);\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::PLUS);\n\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 3);\n  points->SetColor(0, 0, 255, 255);\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::CIRCLE);\n\n  // Finally render the scene.\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/ScatterPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScatterPlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScatterPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScatterPlot MACOSX_BUNDLE ScatterPlot.cxx )\n  target_link_libraries(ScatterPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScatterPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/ScatterPlot/#download-and-build-scatterplot","title":"Download and Build ScatterPlot","text":"

Click here to download ScatterPlot and its CMakeLists.txt file. Once the tarball ScatterPlot.tar has been downloaded and extracted,

cd ScatterPlot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ScatterPlot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/SpiderPlot/","title":"SpiderPlot","text":"

vtk-examples/Cxx/Plotting/SpiderPlot

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/SpiderPlot/#description","title":"Description","text":"

A spider plot is used to display multivariate data. See this wikipedia article for more information.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/SpiderPlot/#code","title":"Code","text":"

SpiderPlot.cxx

#include <vtkDataObject.h>\n#include <vtkFieldData.h>\n#include <vtkFloatArray.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSpiderPlotActor.h>\n#include <vtkTextProperty.h>\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int numTuples = 12;\n\n  vtkNew<vtkFloatArray> bitter;\n  bitter->SetNumberOfTuples(numTuples);\n\n  vtkNew<vtkFloatArray> crispy;\n  crispy->SetNumberOfTuples(numTuples);\n\n  vtkNew<vtkFloatArray> crunchy;\n  crunchy->SetNumberOfTuples(numTuples);\n\n  vtkNew<vtkFloatArray> salty;\n  salty->SetNumberOfTuples(numTuples);\n\n  vtkNew<vtkFloatArray> oily;\n  oily->SetNumberOfTuples(numTuples);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  for (int i = 0; i < numTuples; i++)\n  {\n    bitter->SetTuple1(i, randomSequence->GetRangeValue(1, 10));\n    randomSequence->Next();\n    crispy->SetTuple1(i, randomSequence->GetRangeValue(-1, 1));\n    randomSequence->Next();\n    crunchy->SetTuple1(i, randomSequence->GetRangeValue(1, 100));\n    randomSequence->Next();\n    salty->SetTuple1(i, randomSequence->GetRangeValue(0, 10));\n    randomSequence->Next();\n    oily->SetTuple1(i, randomSequence->GetRangeValue(5, 25));\n    randomSequence->Next();\n  }\n\n  vtkNew<vtkDataObject> dobj;\n  dobj->GetFieldData()->AddArray(bitter);\n  dobj->GetFieldData()->AddArray(crispy);\n  dobj->GetFieldData()->AddArray(crunchy);\n  dobj->GetFieldData()->AddArray(salty);\n  dobj->GetFieldData()->AddArray(oily);\n\n  vtkNew<vtkSpiderPlotActor> actor;\n  actor->SetInputData(dobj);\n  actor->SetTitle(\"Spider Plot\");\n  actor->SetIndependentVariablesToColumns();\n  actor->GetPositionCoordinate()->SetValue(0.05, 0.1, 0.0);\n  actor->GetPosition2Coordinate()->SetValue(0.95, 0.85, 0.0);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  actor->SetAxisLabel(0, \"Bitter\");\n  actor->SetAxisRange(0, 1, 10);\n  actor->SetAxisLabel(1, \"Crispy\");\n  actor->SetAxisRange(1, -1, 1);\n  actor->SetAxisLabel(2, \"Crunchy\");\n  actor->SetAxisRange(2, 1, 100);\n  actor->SetAxisLabel(3, \"Salty\");\n  actor->SetAxisRange(3, 0, 10);\n  actor->SetAxisLabel(4, \"Oily\");\n  actor->SetAxisRange(4, 5, 25);\n  actor->GetLegendActor()->SetNumberOfEntries(numTuples);\n  for (int i = 0; i < numTuples; i++)\n  {\n    double r, g, b;\n    r = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    g = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    b = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    actor->SetPlotColor(i, r, g, b);\n  }\n  actor->LegendVisibilityOn();\n\n  // Set text colors\n  actor->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  actor->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren1->AddActor(actor);\n  ren1->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renWin->SetSize(600, 500);\n  renWin->SetWindowName(\"SpiderPlot\");\n\n  // render the image\n  iren->Initialize();\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/SpiderPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SpiderPlot)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SpiderPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SpiderPlot MACOSX_BUNDLE SpiderPlot.cxx )\n  target_link_libraries(SpiderPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SpiderPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/SpiderPlot/#download-and-build-spiderplot","title":"Download and Build SpiderPlot","text":"

Click here to download SpiderPlot and its CMakeLists.txt file. Once the tarball SpiderPlot.tar has been downloaded and extracted,

cd SpiderPlot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SpiderPlot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/StackedBar/","title":"StackedBar","text":"

vtk-examples/Cxx/Plotting/StackedBar

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/StackedBar/#code","title":"Code","text":"

StackedBar.cxx

#include <vtkAxis.h>\n#include <vtkChartLegend.h>\n#include <vtkChartXY.h>\n#include <vtkColorSeries.h>\n#include <vtkContextView.h>\n#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotBar.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStringArray.h>\n#include <vtkTable.h>\n#include <vtkTextProperty.h>\n\nnamespace {\nconstexpr int num_months = 12;\n\nconstexpr int month[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};\n\nconstexpr int book_2008[] = {5675, 5902, 6388, 5990, 5575, 7393,\n                             9878, 8082, 6417, 5946, 5526, 5166};\nconstexpr int new_popular_2008[] = {701, 687, 736, 696, 750, 814,\n                                    923, 860, 786, 735, 680, 741};\nconstexpr int periodical_2008[] = {184, 176, 166, 131, 171, 191,\n                                   231, 166, 197, 162, 152, 143};\nconstexpr int audiobook_2008[] = {903,  1038, 987,  1073, 1144, 1203,\n                                  1173, 1196, 1213, 1076, 926,  874};\nconstexpr int video_2008[] = {1524, 1565, 1627, 1445, 1179, 1816,\n                              2293, 1811, 1588, 1561, 1542, 1563};\n\nconstexpr int book_2009[] = {6388, 5990, 5575, 9878, 8082, 5675,\n                             7393, 5902, 5526, 5166, 5946, 6417};\nconstexpr int new_popular_2009[] = {696, 735, 786, 814, 736, 860,\n                                    750, 687, 923, 680, 741, 701};\nconstexpr int periodical_2009[] = {197, 166, 176, 231, 171, 152,\n                                   166, 131, 184, 191, 143, 162};\nconstexpr int audiobook_2009[] = {1213, 1076, 926,  987,  903, 1196,\n                                  1073, 1144, 1203, 1038, 874, 1173};\nconstexpr int video_2009[] = {2293, 1561, 1542, 1627, 1588, 1179,\n                              1563, 1445, 1811, 1565, 1524, 1816};\n\nvoid build_array(const char* name, vtkIntArray* array, const int c_array[])\n{\n  array->SetName(name);\n  for (int i = 0; i < num_months; ++i)\n  {\n    array->InsertNextValue(c_array[i]);\n  }\n}\n\n} // namespace\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(500, 350);\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkIntArray> arrMonth;\n  build_array(\"Month\", arrMonth, month);\n  table->AddColumn(arrMonth);\n\n  vtkNew<vtkIntArray> arrBooks2008;\n  build_array(\"Books 2008\", arrBooks2008, book_2008);\n  table->AddColumn(arrBooks2008);\n  vtkNew<vtkIntArray> arrNewPopular2008;\n  build_array(\"New / Popular 2008\", arrNewPopular2008, new_popular_2008);\n  table->AddColumn(arrNewPopular2008);\n  vtkNew<vtkIntArray> arrPeriodical2008;\n  build_array(\"Periodical 2008\", arrPeriodical2008, periodical_2008);\n  table->AddColumn(arrPeriodical2008);\n  vtkNew<vtkIntArray> arrAudiobook2008;\n  build_array(\"Audiobook 2008\", arrAudiobook2008, audiobook_2008);\n  table->AddColumn(arrAudiobook2008);\n  vtkNew<vtkIntArray> arrVideo2008;\n  build_array(\"Video 2008\", arrVideo2008, video_2008);\n  table->AddColumn(arrVideo2008);\n\n  vtkNew<vtkIntArray> arrBooks2009;\n  build_array(\"Books 2009\", arrBooks2009, book_2009);\n  table->AddColumn(arrBooks2009);\n  vtkNew<vtkIntArray> arrNewPopular2009;\n  build_array(\"New / Popular 2009\", arrNewPopular2009, new_popular_2009);\n  table->AddColumn(arrNewPopular2009);\n  vtkNew<vtkIntArray> arrPeriodical2009;\n  build_array(\"Periodical 2009\", arrPeriodical2009, periodical_2009);\n  table->AddColumn(arrPeriodical2009);\n  vtkNew<vtkIntArray> arrAudiobook2009;\n  build_array(\"Audiobook 2009\", arrAudiobook2009, audiobook_2009);\n  table->AddColumn(arrAudiobook2009);\n  vtkNew<vtkIntArray> arrVideo2009;\n  build_array(\"Video 2009\", arrVideo2009, video_2009);\n  table->AddColumn(arrVideo2009);\n\n  // Create a color series to use with our stacks.\n  vtkNew<vtkColorSeries> colorSeries1;\n  colorSeries1->SetColorScheme(vtkColorSeries::WILD_FLOWER);\n\n  // Add multiple line plots, setting the colors etc.\n  vtkPlotBar* bar = 0;\n\n  bar = dynamic_cast<vtkPlotBar*>(chart->AddPlot(vtkChart::BAR));\n  bar->SetColorSeries(colorSeries1);\n  bar->SetInputData(table, \"Month\", \"Books 2008\");\n  bar->SetInputArray(2, \"New / Popular 2008\");\n  bar->SetInputArray(3, \"Periodical 2008\");\n  bar->SetInputArray(4, \"Audiobook 2008\");\n  bar->SetInputArray(5, \"Video 2008\");\n\n  vtkNew<vtkColorSeries> colorSeries2;\n  colorSeries2->SetColorScheme(vtkColorSeries::WILD_FLOWER);\n\n  bar = dynamic_cast<vtkPlotBar*>(chart->AddPlot(vtkChart::BAR));\n  bar->SetColorSeries(colorSeries2);\n  bar->SetInputData(table, \"Month\", \"Books 2009\");\n  bar->SetInputArray(2, \"New / Popular 2009\");\n  bar->SetInputArray(3, \"Periodical 2009\");\n  bar->SetInputArray(4, \"Audiobook 2009\");\n  bar->SetInputArray(5, \"Video 2009\");\n\n  chart->SetShowLegend(true);\n  vtkAxis* axis = chart->GetAxis(vtkAxis::BOTTOM);\n  axis->SetBehavior(1);\n  axis->SetMaximum(13.0);\n  axis->SetTitle(\"Month\");\n  chart->GetAxis(vtkAxis::LEFT)->SetTitle(\"\");\n  chart->SetTitle(\"Circulation 2008, 2009\");\n\n  // Set up the legend to be off to the top right of the viewport.\n  chart->GetLegend()->SetInline(false);\n  chart->GetLegend()->SetHorizontalAlignment(vtkChartLegend::RIGHT);\n  chart->GetLegend()->SetVerticalAlignment(vtkChartLegend::TOP);\n\n  // Set up some custom labels for months.\n  vtkNew<vtkDoubleArray> dates;\n  vtkNew<vtkStringArray> strings;\n  dates->InsertNextValue(1);\n  strings->InsertNextValue(\"January\");\n  dates->InsertNextValue(2);\n  strings->InsertNextValue(\"February\");\n  dates->InsertNextValue(3);\n  strings->InsertNextValue(\"March\");\n  dates->InsertNextValue(4);\n  strings->InsertNextValue(\"April\");\n  dates->InsertNextValue(5);\n  strings->InsertNextValue(\"May\");\n  dates->InsertNextValue(6);\n  strings->InsertNextValue(\"June\");\n  dates->InsertNextValue(7);\n  strings->InsertNextValue(\"July\");\n  dates->InsertNextValue(8);\n  strings->InsertNextValue(\"August\");\n  dates->InsertNextValue(9);\n  strings->InsertNextValue(\"September\");\n  dates->InsertNextValue(10);\n  strings->InsertNextValue(\"October\");\n  dates->InsertNextValue(11);\n  strings->InsertNextValue(\"November\");\n  dates->InsertNextValue(12);\n  strings->InsertNextValue(\"December\");\n  axis->SetCustomTickPositions(dates, strings);\n  axis->GetLabelProperties()->SetOrientation(90);\n  axis->GetLabelProperties()->SetVerticalJustification(VTK_TEXT_CENTERED);\n  axis->GetLabelProperties()->SetJustification(VTK_TEXT_RIGHT);\n\n  // Finally render the scene and compare the image to a reference image.\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Cornsilk\").GetData());\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n  view->GetRenderWindow()->SetSize(600, 400);\n  view->GetRenderWindow()->SetWindowName(\"StackedBar\");\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/StackedBar/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StackedBar)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StackedBar: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StackedBar MACOSX_BUNDLE StackedBar.cxx )\n  target_link_libraries(StackedBar PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StackedBar\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/StackedBar/#download-and-build-stackedbar","title":"Download and Build StackedBar","text":"

Click here to download StackedBar and its CMakeLists.txt file. Once the tarball StackedBar.tar has been downloaded and extracted,

cd StackedBar/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StackedBar\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/StackedPlot/","title":"StackedPlot","text":"

vtk-examples/Cxx/Plotting/StackedPlot

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/StackedPlot/#code","title":"Code","text":"

StackedPlot.cxx

#include <vtkAxis.h>\n#include <vtkChartXY.h>\n#include <vtkColorSeries.h>\n#include <vtkContextView.h>\n#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotStacked.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStringArray.h>\n#include <vtkTable.h>\n\nnamespace {\n// Monthly checkout data.\nstd::string month_labels[] = {\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\n                              \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"};\nconstexpr int book[] = {5675, 5902, 6388, 5990, 5575, 7393,\n                        9878, 8082, 6417, 5946, 5526, 5166};\nconstexpr int new_popular[] = {701, 687, 736, 696, 750, 814,\n                               923, 860, 786, 735, 680, 741};\nconstexpr int periodical[] = {184, 176, 166, 131, 171, 191,\n                              231, 166, 197, 162, 152, 143};\nconstexpr int audiobook[] = {903,  1038, 987,  1073, 1144, 1203,\n                             1173, 1196, 1213, 1076, 926,  874};\nconstexpr int video[] = {1524, 1565, 1627, 1445, 1179, 1816,\n                         2293, 1811, 1588, 1561, 1542, 1563};\n} // namespace\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(1.0, 1.0, 1.0);\n  view->GetRenderWindow()->SetSize(400, 300);\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkStringArray> arrMonthLabel;\n  arrMonthLabel->SetNumberOfValues(12);\n\n  vtkNew<vtkDoubleArray> arrXTickPositions;\n  arrXTickPositions->SetNumberOfValues(12);\n\n  vtkNew<vtkIntArray> arrMonth;\n  arrMonth->SetName(\"Month\");\n  table->AddColumn(arrMonth);\n\n  vtkNew<vtkIntArray> arrBook;\n  arrBook->SetName(\"Books\");\n  table->AddColumn(arrBook);\n\n  vtkNew<vtkIntArray> arrNewPopularBook;\n  arrNewPopularBook->SetName(\"New / Popular\");\n  table->AddColumn(arrNewPopularBook);\n\n  vtkNew<vtkIntArray> arrPeriodical;\n  arrPeriodical->SetName(\"Periodical\");\n  table->AddColumn(arrPeriodical);\n\n  vtkNew<vtkIntArray> arrAudiobook;\n  arrAudiobook->SetName(\"Audiobook\");\n  table->AddColumn(arrAudiobook);\n\n  vtkNew<vtkIntArray> arrVideo;\n  arrVideo->SetName(\"Video\");\n  table->AddColumn(arrVideo);\n\n  table->SetNumberOfRows(12);\n  for (int i = 0; i < 12; i++)\n  {\n    arrMonthLabel->SetValue(i, month_labels[i]);\n    arrXTickPositions->SetValue(i, i);\n\n    arrBook->SetValue(i, book[i]);\n    arrNewPopularBook->SetValue(i, new_popular[i]);\n    arrPeriodical->SetValue(i, periodical[i]);\n    arrAudiobook->SetValue(i, audiobook[i]);\n    arrVideo->SetValue(i, video[i]);\n  }\n\n  // Set the Month Labels\n  chart->GetAxis(1)->SetCustomTickPositions(arrXTickPositions, arrMonthLabel);\n  chart->GetAxis(1)->SetMaximum(11);\n\n  chart->GetAxis(1)->SetRange(0, 11);\n  chart->GetAxis(1)->SetBehavior(vtkAxis::FIXED);\n  chart->GetAxis(1)->SetTitle(\"Month\");\n\n  chart->SetShowLegend(true);\n\n  chart->GetAxis(0)->SetTitle(\"Checkouts\");\n\n  // Add multiple line plots, setting the colors etc.\n  vtkPlotStacked* stack = 0;\n\n  // Books\n  stack = dynamic_cast<vtkPlotStacked*>(chart->AddPlot(vtkChart::STACKED));\n  stack->SetUseIndexForXSeries(true);\n  stack->SetInputData(table);\n  stack->SetInputArray(1, \"Books\");\n  stack->SetInputArray(2, \"New / Popular\");\n  stack->SetInputArray(3, \"Periodical\");\n  stack->SetInputArray(4, \"Audiobook\");\n  stack->SetInputArray(5, \"Video\");\n\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::WILD_FLOWER);\n  stack->SetColorSeries(colorSeries);\n\n  // Finally render the scene and compare the image to a reference image.\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Cornsilk\").GetData());\n  view->GetRenderWindow()->SetSize(600, 400);\n  view->GetRenderWindow()->SetWindowName(\"StackedPlot\");\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/StackedPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StackedPlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StackedPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StackedPlot MACOSX_BUNDLE StackedPlot.cxx )\n  target_link_libraries(StackedPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StackedPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/StackedPlot/#download-and-build-stackedplot","title":"Download and Build StackedPlot","text":"

Click here to download StackedPlot and its CMakeLists.txt file. Once the tarball StackedPlot.tar has been downloaded and extracted,

cd StackedPlot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StackedPlot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Plotting/SurfacePlot/","title":"SurfacePlot","text":"

vtk-examples/Cxx/Plotting/SurfacePlot

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Plotting/SurfacePlot/#description","title":"Description","text":"

This examples creates a vtkChartXYZ that contains a vtkPlotSurface.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Plotting/SurfacePlot/#code","title":"Code","text":"

SurfacePlot.cxx

#include <vtkChartXYZ.h>\n#include <vtkContextMouseEvent.h>\n#include <vtkContextScene.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPen.h>\n#include <vtkPlotSurface.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkChartXYZ> chart;\n  chart->SetGeometry(vtkRectf(10.0, 10.0, 630, 470));\n\n  vtkNew<vtkPlotSurface> plot;\n\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetScene()->AddItem(chart);\n\n  // Create a surface.\n  vtkNew<vtkTable> table;\n  vtkIdType numPoints = 70;\n  float inc = 9.424778 / (numPoints - 1);\n  for (vtkIdType i = 0; i < numPoints; ++i)\n  {\n    vtkNew<vtkFloatArray> arr;\n    table->AddColumn(arr);\n  }\n\n  table->SetNumberOfRows(static_cast<vtkIdType>(numPoints));\n  for (vtkIdType i = 0; i < numPoints; ++i)\n  {\n    float x = i * inc;\n    for (vtkIdType j = 0; j < numPoints; ++j)\n    {\n      float y = j * inc;\n      table->SetValue(i, j, sin(sqrt(x * x + y * y)));\n    }\n  }\n\n  // Set up the surface plot we wish to visualize and add it to the chart.\n  plot->SetXRange(0, 10.0);\n  plot->SetYRange(0, 10.0);\n  plot->SetInputData(table);\n#if VTK_HAS_SETCOLORF\n  plot->GetPen()->SetColorF(colors->GetColor3d(\"Tomato\").GetData());\n#else\n  plot->GetPen()->SetColorF(colors->GetColor3d(\"Tomato\").GetData());\n#endif\n  chart->AddPlot(plot);\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetInteractor()->Initialize();\n  view->GetRenderWindow()->SetWindowName(\"SurfacePlot\");\n  view->GetRenderWindow()->Render();\n\n  // rotate\n  vtkContextMouseEvent mouseEvent;\n  mouseEvent.SetInteractor(view->GetInteractor());\n\n  vtkVector2i pos;\n\n  vtkVector2i lastPos;\n  mouseEvent.SetButton(vtkContextMouseEvent::LEFT_BUTTON);\n  lastPos.Set(100, 50);\n  mouseEvent.SetLastScreenPos(lastPos);\n  pos.Set(150, 100);\n  mouseEvent.SetScreenPos(pos);\n\n  vtkVector2d sP(pos.Cast<double>().GetData());\n  vtkVector2d lSP(lastPos.Cast<double>().GetData());\n  vtkVector2d screenPos(mouseEvent.GetScreenPos().Cast<double>().GetData());\n  vtkVector2d lastScreenPos(\n      mouseEvent.GetLastScreenPos().Cast<double>().GetData());\n\n  chart->MouseMoveEvent(mouseEvent);\n\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Plotting/SurfacePlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SurfacePlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SurfacePlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SurfacePlot MACOSX_BUNDLE SurfacePlot.cxx )\n  target_link_libraries(SurfacePlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SurfacePlot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Plotting/SurfacePlot/#download-and-build-surfaceplot","title":"Download and Build SurfacePlot","text":"

Click here to download SurfacePlot and its CMakeLists.txt file. Once the tarball SurfacePlot.tar has been downloaded and extracted,

cd SurfacePlot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SurfacePlot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/CompareExtractSurface/","title":"CompareExtractSurface","text":"

vtk-examples/Cxx/Points/CompareExtractSurface

"},{"location":"Cxx/Points/CompareExtractSurface/#description","title":"Description","text":"

This example compares three surface reconstruction algorithms:

  1. ExtractSurface
  2. PoissonReconstruction
  3. Powercrust

We usually try to keep examples short, but this example teaches several concepts.

  1. Compare multiple algorithms
  2. Time multiple algorithms
  3. Reuse code from other examples
  4. Use multiple remote modules
  5. Generate figures for papers

Warning

This example runs longer than most. Be patient.

Info

See PoissonReconstruction Remote Module to configure.

Info

See Powercrust Remote Module to configure.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/CompareExtractSurface/#code","title":"Code","text":"

CompareExtractSurface.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCoordinate.h>\n#include <vtkExtractSurface.h>\n#include <vtkNamedColors.h>\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointData.h>\n#include <vtkPoissonReconstruction.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkPolyLine.h>\n#include <vtkPowerCrustSurfaceReconstruction.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSignedDistance.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTimerLog.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\nvtkSmartPointer<vtkPolyDataAlgorithm> MakeExtractSurface(vtkPolyData*);\nvtkSmartPointer<vtkPolyDataAlgorithm> MakePoissonExtractSurface(vtkPolyData*);\nvtkSmartPointer<vtkPolyDataAlgorithm>\nMakePowercrustExtractSurface(vtkPolyData*);\nvoid MakeViewportGrid(std::vector<vtkSmartPointer<vtkRenderer>>& renderers,\n                      unsigned int renderersize, unsigned int xGridDimensions,\n                      unsigned int yGridDimensions);\nvoid ViewportBorder(vtkSmartPointer<vtkRenderer>& renderer, double* color,\n                    bool last = false);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  std::cout << \"# of points: \" << polyData->GetNumberOfPoints() << std::endl;\n\n  auto colors = vtkSmartPointer<vtkNamedColors>::New();\n\n  auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();\n\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> surfaceObjects;\n  surfaceObjects.push_back(MakeExtractSurface(polyData.GetPointer()));\n  surfaceObjects.push_back(MakePoissonExtractSurface(polyData.GetPointer()));\n  surfaceObjects.push_back(MakePowercrustExtractSurface(polyData.GetPointer()));\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  // One camera for all\n  auto camera = vtkSmartPointer<vtkCamera>::New();\n  for (size_t i = 0; i < surfaceObjects.size(); ++i)\n  {\n    auto timer = vtkSmartPointer<vtkTimerLog>::New();\n    timer->StartTimer();\n    surfaceObjects[i]->Update();\n    timer->StopTimer();\n\n    auto surfaceMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n    surfaceMapper->SetInputConnection(surfaceObjects[i]->GetOutputPort());\n\n    auto back = vtkSmartPointer<vtkProperty>::New();\n    back->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n    back->SetSpecular(.6);\n    back->SetSpecularPower(50.0);\n\n    auto surfaceActor = vtkSmartPointer<vtkActor>::New();\n    surfaceActor->SetMapper(surfaceMapper);\n    surfaceActor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"Tomato\").GetData());\n    surfaceActor->GetProperty()->SetSpecular(.6);\n    surfaceActor->GetProperty()->SetSpecularPower(50.0);\n    surfaceActor->SetBackfaceProperty(back);\n    // Setup renderer\n    auto renderer = vtkSmartPointer<vtkRenderer>::New();\n    renderer->AddActor(surfaceActor);\n    renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    renderer->SetActiveCamera(camera);\n    renderer->GetActiveCamera()->SetPosition(-1, 0, 0);\n    renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n    renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n    renderer->GetActiveCamera()->Dolly(5);\n    renderer->ResetCamera();\n    renderer->ResetCameraClippingRange();\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n\n    auto textProperty = vtkSmartPointer<vtkTextProperty>::New();\n    textProperty->SetFontSize(15);\n    textProperty->SetJustificationToCentered();\n\n    std::stringstream ss;\n    ss << surfaceObjects[i]->GetClassName() << std::endl;\n    ss << \"# of Polys: \" << surfaceObjects[i]->GetOutput()->GetNumberOfPolys()\n       << std::endl;\n    ss << \"Time: \" << timer->GetElapsedTime() << std::endl;\n\n    auto textMapper = vtkSmartPointer<vtkTextMapper>::New();\n    textMapper->SetInput(ss.str().c_str());\n    textMapper->SetTextProperty(textProperty);\n\n    auto textActor = vtkSmartPointer<vtkActor2D>::New();\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(200, 0);\n    textActor->GetProperty()->SetLineWidth(4.0); // Line Width\n\n    renderer->AddViewProp(textActor);\n  }\n\n  unsigned int rendererSize = 400;\n  unsigned int xGridDimensions = 3;\n  unsigned int yGridDimensions = 1;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n\n  MakeViewportGrid(renderers, rendererSize, xGridDimensions, yGridDimensions);\n  for (size_t i = 0; i < renderers.size(); ++i)\n  {\n    ViewportBorder(renderers[i], colors->GetColor3d(\"Gold\").GetData(),\n                   i == renderers.size() - 1);\n  }\n  auto iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvtkSmartPointer<vtkPolyDataAlgorithm> MakeExtractSurface(vtkPolyData* polyData)\n{\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = polyData->GetNumberOfPoints() * .00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 50;\n  }\n\n  // Do we need to estimate normals?\n  auto distance = vtkSmartPointer<vtkSignedDistance>::New();\n  if (polyData->GetPointData()->GetNormals())\n  {\n    std::cout << \"ExtractSurface: Using normals from input file\" << std::endl;\n    distance->SetInputData(polyData);\n  }\n  else\n  {\n    std::cout << \" ExtractSurface: Estimating normals using PCANormalEstimation\"\n              << std::endl;\n    auto normals = vtkSmartPointer<vtkPCANormalEstimation>::New();\n    normals->SetInputData(polyData);\n    normals->SetSampleSize(sampleSize);\n    normals->SetNormalOrientationToGraphTraversal();\n    normals->FlipNormalsOn();\n    distance->SetInputConnection(normals->GetOutputPort());\n  }\n  int dimension = 256;\n  double radius;\n  radius = std::max(std::max(range[0], range[1]), range[2]) /\n      static_cast<double>(dimension) * 4; // ~4 voxels\n\n  distance->SetRadius(radius);\n  distance->SetDimensions(dimension, dimension, dimension);\n  distance->SetBounds(bounds[0] - range[0] * .1, bounds[1] + range[0] * .1,\n                      bounds[2] - range[1] * .1, bounds[3] + range[1] * .1,\n                      bounds[4] - range[2] * .1, bounds[5] + range[2] * .1);\n\n  auto surface = vtkSmartPointer<vtkExtractSurface>::New();\n  surface->SetInputConnection(distance->GetOutputPort());\n  surface->SetRadius(radius * .99);\n  return surface;\n}\nvtkSmartPointer<vtkPolyDataAlgorithm>\nMakePoissonExtractSurface(vtkPolyData* polyData)\n{\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = polyData->GetNumberOfPoints() * .00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 10;\n  }\n\n  auto surface = vtkSmartPointer<vtkPoissonReconstruction>::New();\n  surface->SetDepth(12);\n  if (polyData->GetPointData()->GetNormals())\n  {\n    std::cout << \"PoissonReconstruction: Using normals from input file\"\n              << std::endl;\n    surface->SetInputData(polyData);\n  }\n  else\n  {\n    std::cout << \"ExtractSurface: Estimating normals using PCANormalEstimation\"\n              << std::endl;\n    auto normals = vtkSmartPointer<vtkPCANormalEstimation>::New();\n    normals->SetInputData(polyData);\n    normals->SetSampleSize(sampleSize);\n    normals->SetNormalOrientationToGraphTraversal();\n    normals->FlipNormalsOff();\n    surface->SetInputConnection(normals->GetOutputPort());\n  }\n  return surface;\n}\nvtkSmartPointer<vtkPolyDataAlgorithm>\nMakePowercrustExtractSurface(vtkPolyData* polyData)\n{\n  auto surface = vtkSmartPointer<vtkPowerCrustSurfaceReconstruction>::New();\n  surface->SetInputData(polyData);\n  return surface;\n}\n\nvoid MakeViewportGrid(std::vector<vtkSmartPointer<vtkRenderer>>& renderers,\n                      unsigned int rendererSize, unsigned int xGridDimensions,\n                      unsigned int yGridDimensions)\n{\n  //\n  // Setup viewports for the renderers\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      auto index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n}\n// draw the borders of a renderer's viewport\nvoid ViewportBorder(vtkSmartPointer<vtkRenderer>& renderer, double* color,\n                    bool last)\n{\n  // points start at upper right and proceed anti-clockwise\n  auto points = vtkSmartPointer<vtkPoints>::New();\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  // create cells, and lines\n  auto cells = vtkSmartPointer<vtkCellArray>::New();\n  cells->Initialize();\n\n  auto lines = vtkSmartPointer<vtkPolyLine>::New();\n\n  // only draw last line if this is the last viewport\n  // this prevents double vertical lines at right border\n  // if different colors are used for each border, then do\n  // not specify last\n  if (last)\n  {\n    lines->GetPointIds()->SetNumberOfIds(5);\n  }\n  else\n  {\n    lines->GetPointIds()->SetNumberOfIds(4);\n  }\n  for (unsigned int i = 0; i < 4; ++i)\n  {\n    lines->GetPointIds()->SetId(i, i);\n  }\n  if (last)\n  {\n    lines->GetPointIds()->SetId(4, 0);\n  }\n  cells->InsertNextCell(lines);\n\n  // now make the polydata and display it\n  auto poly = vtkSmartPointer<vtkPolyData>::New();\n  poly->Initialize();\n  poly->SetPoints(points);\n  poly->SetLines(cells);\n\n  // use normalized viewport coordinates since\n  // they are independent of window size\n  auto coordinate = vtkSmartPointer<vtkCoordinate>::New();\n  coordinate->SetCoordinateSystemToNormalizedViewport();\n\n  auto mapper = vtkSmartPointer<vtkPolyDataMapper2D>::New();\n  mapper->SetInputData(poly);\n  mapper->SetTransformCoordinate(coordinate);\n\n  auto actor = vtkSmartPointer<vtkActor2D>::New();\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(color);\n  // line width should be at least 2 to be visible at extremes\n\n  actor->GetProperty()->SetLineWidth(4.0); // Line Width\n\n  renderer->AddViewProp(actor);\n}\n\n} // namespace\n
"},{"location":"Cxx/Points/CompareExtractSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CompareExtractSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonSystem\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CompareExtractSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CompareExtractSurface MACOSX_BUNDLE CompareExtractSurface.cxx )\n  target_link_libraries(CompareExtractSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CompareExtractSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/CompareExtractSurface/#download-and-build-compareextractsurface","title":"Download and Build CompareExtractSurface","text":"

Click here to download CompareExtractSurface and its CMakeLists.txt file. Once the tarball CompareExtractSurface.tar has been downloaded and extracted,

cd CompareExtractSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CompareExtractSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/DensifyPoints/","title":"DensifyPoints","text":"

vtk-examples/Cxx/Points/DensifyPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Points/DensifyPoints/#description","title":"Description","text":"

In this example, the original points are yellow and the added points are red.

The image was produced using src/Testing/Data/Torso.vtp.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/DensifyPoints/#code","title":"Code","text":"

DensifyPoints.cxx

#include <vtkCamera.h>\n#include <vtkDensifyPointCloudFilter.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n\n  double maxRange = std::max(std::max(range[0], range[1]), range[2]);\n\n  std::cout << \"# of original points: \" << polyData->GetNumberOfPoints()\n            << std::endl;\n  vtkNew<vtkDensifyPointCloudFilter> densify;\n  densify->SetInputData(polyData);\n  densify->SetMaximumNumberOfIterations(5);\n  densify->SetTargetDistance(maxRange * .03);\n  densify->SetNumberOfClosestPoints(10);\n  densify->Update();\n  std::cout << \"# of densified points: \"\n            << densify->GetOutput()->GetNumberOfPoints() << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  ///\n  double radius = maxRange * .01;\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetRadius(radius);\n\n  vtkNew<vtkGlyph3DMapper> glyph3D1;\n  glyph3D1->SetInputData(polyData);\n  glyph3D1->SetSourceConnection(sphereSource1->GetOutputPort());\n  glyph3D1->ScalarVisibilityOff();\n  glyph3D1->ScalingOff();\n\n  vtkNew<vtkActor> glyph3DActor1;\n  glyph3DActor1->SetMapper(glyph3D1);\n  glyph3DActor1->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetRadius(radius * .75);\n\n  vtkNew<vtkGlyph3DMapper> glyph3D2;\n  glyph3D2->SetInputConnection(densify->GetOutputPort());\n  glyph3D2->SetSourceConnection(sphereSource2->GetOutputPort());\n  glyph3D2->ScalarVisibilityOff();\n  glyph3D2->ScalingOff();\n\n  vtkNew<vtkActor> glyph3DActor2;\n  glyph3DActor2->SetMapper(glyph3D2);\n  glyph3DActor2->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create graphics stuff.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"DensifyPoints\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(glyph3DActor1);\n  ren1->AddActor(glyph3DActor2);\n\n  // Generate an interesting view\n  //\n  ren1->GetActiveCamera()->SetPosition(1, 0, 0);\n  ren1->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  ren1->GetActiveCamera()->SetViewUp(0, 0, 1);\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Points/DensifyPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DensifyPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DensifyPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DensifyPoints MACOSX_BUNDLE DensifyPoints.cxx )\n  target_link_libraries(DensifyPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DensifyPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/DensifyPoints/#download-and-build-densifypoints","title":"Download and Build DensifyPoints","text":"

Click here to download DensifyPoints and its CMakeLists.txt file. Once the tarball DensifyPoints.tar has been downloaded and extracted,

cd DensifyPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DensifyPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/ExtractClusters/","title":"ExtractClusters","text":"

vtk-examples/Cxx/Points/ExtractClusters

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Points/ExtractClusters/#description","title":"Description","text":"

This example extracts clusters of points. The points lie on spheres that are randomly placed. Each cluster has a different color. The number of extracted clusters may be less that the number of random spheres, if the points on one sphere are within the specified distance of points on another sphere.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/ExtractClusters/#code","title":"Code","text":"

ExtractClusters.cxx

#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkEuclideanClusterExtraction.h>\n#include <vtkGlyph3D.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  // randomSequence->SetSeed(8775070);\n  randomSequence->SetSeed(4355412);\n\n  double limits = 10;\n  double radius = 0.5;\n\n  vtkNew<vtkAppendPolyData> append;\n  for (unsigned i = 0; i < 30; ++i)\n  {\n    vtkNew<vtkPointSource> points;\n\n    points->SetNumberOfPoints(800);\n    points->SetRadius(2.5 * radius);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-limits, limits);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-limits, limits);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-limits, limits);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n\n    append->AddInputConnection(points->GetOutputPort());\n  }\n\n  vtkNew<vtkEuclideanClusterExtraction> cluster;\n  cluster->SetInputConnection(append->GetOutputPort());\n  cluster->SetExtractionModeToAllClusters();\n  cluster->SetRadius(radius);\n  cluster->ColorClustersOn();\n  cluster->Update();\n\n  std::cout << \"Found \" << cluster->GetNumberOfExtractedClusters()\n            << \" clusters within radius \" << radius << std::endl;\n\n  // Create a lookup table to map point data to colors\n  vtkNew<vtkLookupTable> lut;\n  int tableSize = cluster->GetNumberOfExtractedClusters();\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n\n  // Fill in the lookup table\n  for (unsigned int i = 0; static_cast<int>(i) < tableSize; ++i)\n  {\n    double r, g, b;\n    r = randomSequence->GetRangeValue(0.25, 1.0);\n    randomSequence->Next();\n    g = randomSequence->GetRangeValue(0.25, 1.0);\n    randomSequence->Next();\n    b = randomSequence->GetRangeValue(0.25, 1.0);\n    randomSequence->Next();\n    lut->SetTableValue(i, r, g, b, 1.0);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetRadius(radius / 2.0);\n\n  vtkNew<vtkGlyph3D> glyphs;\n  glyphs->SetInputConnection(cluster->GetOutputPort());\n  glyphs->SetSourceConnection(sphere->GetOutputPort());\n  glyphs->ScalingOff();\n  glyphs->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphs->GetOutputPort());\n  mapper->SetScalarRange(0, tableSize - 1);\n  mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(640, 512);\n  renWin->SetWindowName(\"ExtractClusters\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer\n  //\n  ren1->AddActor(actor);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Points/ExtractClusters/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractClusters)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractClusters: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractClusters MACOSX_BUNDLE ExtractClusters.cxx )\n  target_link_libraries(ExtractClusters PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractClusters\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/ExtractClusters/#download-and-build-extractclusters","title":"Download and Build ExtractClusters","text":"

Click here to download ExtractClusters and its CMakeLists.txt file. Once the tarball ExtractClusters.tar has been downloaded and extracted,

cd ExtractClusters/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractClusters\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/ExtractEnclosedPoints/","title":"ExtractEnclosedPoints","text":"

vtk-examples/Cxx/Points/ExtractEnclosedPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Points/ExtractEnclosedPoints/#description","title":"Description","text":"

This example uses vtkExtractEnclosedPoints to select points that exist within a closed vtkPolyData surface. After reading a vtk polydata file, the example generates 10000 random points within the bounding box of the vtkPolyData.

If the polydata is not closed or is non-manifold, the filter does not create an output.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/ExtractEnclosedPoints/#code","title":"Code","text":"

ExtractEnclosedPoints.cxx

#include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkExtractEnclosedPoints.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <random>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  std::mt19937 mt(4355412); // Standard mersenne_twister_engine\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \" \" << bounds[2]\n            << \", \" << bounds[3] << \" \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n  // Generate random points within the bounding box of the polydata\n  std::uniform_real_distribution<double> distributionX(bounds[0], bounds[1]);\n  std::uniform_real_distribution<double> distributionY(bounds[2], bounds[3]);\n  std::uniform_real_distribution<double> distributionZ(bounds[4], bounds[5]);\n  vtkNew<vtkPolyData> pointsPolyData;\n  vtkNew<vtkPoints> points;\n  pointsPolyData->SetPoints(points);\n\n  points->SetNumberOfPoints(10000);\n  for (auto i = 0; i < 10000; ++i)\n  {\n    double point[3];\n    point[0] = distributionX(mt);\n    point[1] = distributionY(mt);\n    point[2] = distributionZ(mt);\n    points->SetPoint(i, point);\n  }\n\n  vtkNew<vtkExtractEnclosedPoints> extract;\n  extract->SetSurfaceData(polyData);\n  extract->SetInputData(pointsPolyData);\n  extract->SetTolerance(.0001);\n  extract->CheckSurfaceOn();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> source;\n  source->SetRadius((bounds[1] - bounds[0]) * .005);\n\n  vtkNew<vtkGlyph3DMapper> glyph3Dmapper;\n  glyph3Dmapper->SetSourceConnection(source->GetOutputPort());\n  glyph3Dmapper->SetInputConnection(extract->GetOutputPort());\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyph3Dmapper);\n  glyphActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  glyphActor->GetProperty()->SetSpecular(0.6);\n  glyphActor->GetProperty()->SetSpecularPower(30);\n  ;\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  backProp->SetSpecular(0.6);\n  backProp->SetSpecularPower(30);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProp);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(0.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  actor->GetProperty()->SetOpacity(0.3);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyphActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  renderWindow->SetSize(640, 512);\n  renderWindow->SetWindowName(\"ExtractEnclosedPoints\");\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Points/ExtractEnclosedPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractEnclosedPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractEnclosedPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractEnclosedPoints MACOSX_BUNDLE ExtractEnclosedPoints.cxx )\n  target_link_libraries(ExtractEnclosedPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractEnclosedPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/ExtractEnclosedPoints/#download-and-build-extractenclosedpoints","title":"Download and Build ExtractEnclosedPoints","text":"

Click here to download ExtractEnclosedPoints and its CMakeLists.txt file. Once the tarball ExtractEnclosedPoints.tar has been downloaded and extracted,

cd ExtractEnclosedPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractEnclosedPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/ExtractPointsDemo/","title":"ExtractPointsDemo","text":"

vtk-examples/Cxx/Points/ExtractPointsDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Points/ExtractPointsDemo/#description","title":"Description","text":"

Demonstrates point extraction from four implicit functions: sphere, cone, cylinder and superquadric.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/ExtractPointsDemo/#code","title":"Code","text":"

ExtractPointsDemo.cxx

#include <vtkBoundedPointSource.h>\n#include <vtkCamera.h>\n#include <vtkCone.h>\n#include <vtkCylinder.h>\n#include <vtkExtractPoints.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphere.h>\n#include <vtkSphereSource.h>\n#include <vtkSuperquadric.h>\n\n#include <vector>\n\nint main(int /*argc*/, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create implicit functions\n  vtkNew<vtkCone> cone;\n  cone->SetAngle(30.0);\n  vtkNew<vtkSphere> sphere;\n  vtkNew<vtkCylinder> cylinder;\n  vtkNew<vtkSuperquadric> superquadric;\n  superquadric->SetPhiRoundness(2.5);\n  superquadric->SetThetaRoundness(0.5);\n\n  // Store the functions\n  std::vector<vtkSmartPointer<vtkImplicitFunction>> functions;\n  functions.push_back(sphere);\n  functions.push_back(cone);\n  functions.push_back(cylinder);\n  functions.push_back(superquadric);\n\n  vtkNew<vtkBoundedPointSource> pointSource;\n  pointSource->SetNumberOfPoints(100000);\n\n  // Rows and columns\n  unsigned int gridXDimensions = 2;\n  unsigned int gridYDimensions = 2;\n\n  // Need a renderer even if there is no actor\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  double background[6] = {0.4, 0.5, 0.6, 0.6, 0.5, 0.4};\n  for (size_t i = 0; i < gridXDimensions * gridYDimensions; i++)\n  {\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    renderers[i]->SetBackground(background);\n    // auto fwdIt = std::rotate(background, background + 1, background + 6);\n  }\n\n  // Glyphs\n  double radius = 0.02;\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(radius);\n\n  // One render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  int rendererSize = 256;\n  renderWindow->SetSize(rendererSize * gridXDimensions,\n                        rendererSize * gridYDimensions);\n  renderWindow->SetWindowName(\"ExtractPointsDemo\");\n\n  // Create a pipeline for each function\n  for (int row = 0; row < static_cast<int>(gridYDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(gridXDimensions); col++)\n    {\n      int index = row * gridXDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (gridXDimensions * rendererSize),\n                            static_cast<double>(gridYDimensions - (row + 1)) *\n                                rendererSize / (gridYDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (gridXDimensions * rendererSize),\n                            static_cast<double>(gridYDimensions - row) *\n                                rendererSize /\n                                (gridYDimensions * rendererSize)};\n      renderWindow->AddRenderer(renderers[index]);\n      renderers[index]->SetViewport(viewport);\n      if (index > static_cast<int>(functions.size() - 1))\n      {\n        continue;\n      }\n      // Define the pipeline\n      vtkNew<vtkExtractPoints> extract;\n      extract->SetInputConnection(pointSource->GetOutputPort());\n      extract->SetImplicitFunction(functions[index]);\n\n      vtkNew<vtkGlyph3DMapper> glyph;\n      glyph->SetInputConnection(extract->GetOutputPort());\n      glyph->SetSourceConnection(sphereSource->GetOutputPort());\n      glyph->ScalingOff();\n\n      vtkNew<vtkActor> glyphActor;\n      glyphActor->SetMapper(glyph);\n      glyphActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"MistyRose\").GetData());\n\n      renderers[index]->AddActor(glyphActor);\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(-30);\n      renderers[index]->GetActiveCamera()->Dolly(1.1);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Points/ExtractPointsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractPointsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersPoints\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractPointsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractPointsDemo MACOSX_BUNDLE ExtractPointsDemo.cxx )\n  target_link_libraries(ExtractPointsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractPointsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/ExtractPointsDemo/#download-and-build-extractpointsdemo","title":"Download and Build ExtractPointsDemo","text":"

Click here to download ExtractPointsDemo and its CMakeLists.txt file. Once the tarball ExtractPointsDemo.tar has been downloaded and extracted,

cd ExtractPointsDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractPointsDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/ExtractSurface/","title":"ExtractSurface","text":"

vtk-examples/Cxx/Points/ExtractSurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Points/ExtractSurface/#description","title":"Description","text":"

This example loosely follows the most excellent paper by Curless and Levoy: \"A Volumetric Method for Building Complex Models from Range Images.\" First it estimates normals from the points, then creates a signed distance field, followed by surface extraction of the zero-level set of the distance field.

If the example is run without an argument, the example uses random points on a spherical shell. With a filename, the example uses the points on the vtkPolyData.

The image was created using the Armadillo dataset, src/Testing/Data/Armadillo.ply.

Info

CompareExtractSurface compares three surface extraction algorithms.

Seealso

PowercrustExtractSurface reconstructs surfaces and is implemented as a VTK remote module. PoissonExtractSurface reconstructs surfaces and is implemented as a VTK remote module.

Warning

If you experience extraneous lines in the reconstruction, update your VTK. A patch was made on September 5, 2017 to correct the issue.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/ExtractSurface/#code","title":"Code","text":"

ExtractSurface.cxx

#include <vtkCamera.h>\n#include <vtkExtractSurface.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSignedDistance.h>\n#include <vtkSmartPointer.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  std::cout << \"# of points: \" << polyData->GetNumberOfPoints() << std::endl;\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = polyData->GetNumberOfPoints() * 0.00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 10;\n  }\n  std::cout << \"Sample size is: \" << sampleSize << std::endl;\n  // Do we need to estimate normals?\n  vtkNew<vtkSignedDistance> distance;\n  if (polyData->GetPointData()->GetNormals())\n  {\n    std::cout << \"Using normals from input file\" << std::endl;\n    distance->SetInputData(polyData);\n  }\n  else\n  {\n    std::cout << \"Estimating normals using PCANormalEstimation\" << std::endl;\n    vtkNew<vtkPCANormalEstimation> normals;\n    normals->SetInputData(polyData);\n    normals->SetSampleSize(sampleSize);\n    normals->SetNormalOrientationToGraphTraversal();\n    normals->FlipNormalsOn();\n    distance->SetInputConnection(normals->GetOutputPort());\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  int dimension = 256;\n  double radius;\n  radius = std::max(std::max(range[0], range[1]), range[2]) /\n      static_cast<double>(dimension) * 4; // ~4 voxels\n  std::cout << \"Radius: \" << radius << std::endl;\n\n  distance->SetRadius(radius);\n  distance->SetDimensions(dimension, dimension, dimension);\n  distance->SetBounds(bounds[0] - range[0] * .1, bounds[1] + range[0] * .1,\n                      bounds[2] - range[1] * .1, bounds[3] + range[1] * .1,\n                      bounds[4] - range[2] * .1, bounds[5] + range[2] * .1);\n\n  vtkNew<vtkExtractSurface> surface;\n  surface->SetInputConnection(distance->GetOutputPort());\n  surface->SetRadius(radius * .99);\n  surface->Update();\n\n  vtkNew<vtkPolyDataMapper> surfaceMapper;\n  surfaceMapper->SetInputConnection(surface->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  surfaceActor->SetBackfaceProperty(back);\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"ExtractSurface\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer,set the background and size.\n  ren1->AddActor(surfaceActor);\n\n  // Generate an interesting view.\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(1000);\n    points->SetRadius(1.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-1.0, 1.0);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-1.0, 1.0);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-1.0, 1.0);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Points/ExtractSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractSurface MACOSX_BUNDLE ExtractSurface.cxx )\n  target_link_libraries(ExtractSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/ExtractSurface/#download-and-build-extractsurface","title":"Download and Build ExtractSurface","text":"

Click here to download ExtractSurface and its CMakeLists.txt file. Once the tarball ExtractSurface.tar has been downloaded and extracted,

cd ExtractSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/ExtractSurfaceDemo/","title":"ExtractSurfaceDemo","text":"

vtk-examples/Cxx/Points/ExtractSurfaceDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Points/ExtractSurfaceDemo/#description","title":"Description","text":"

This example loosely follows the most excellent paper by Curless and Levoy: \"A Volumetric Method for Building Complex Models from Range Images.\" First it estimates normals from the points, then creates a signed distance field, followed by surface extraction of the zero-level set of the distance field.

This is a demo version of ExtractSurface. It displays some a sampling of the normals with arrows. It also uses a different color for the front and back surfaces.

The image was created using the Armadillo dataset, src/Testing/Data/Armadillo.ply.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/ExtractSurfaceDemo/#code","title":"Code","text":"

ExtractSurfaceDemo.cxx

#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkExtractSurface.h>\n#include <vtkGlyph3D.h>\n#include <vtkMaskPoints.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSignedDistance.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvoid MakeGlyphs(vtkPolyData* src, double size, vtkGlyph3D* glyph);\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = 15;\n\n  std::cout << \"Sample size is: \" << sampleSize << std::endl;\n  // Do we need to estimate normals?\n  vtkNew<vtkSignedDistance> distance;\n  vtkNew<vtkPCANormalEstimation> normals;\n  if (polyData->GetPointData()->GetNormals())\n  {\n    std::cout << \"Using normals from input file\" << std::endl;\n    distance->SetInputData(polyData);\n  }\n  else\n  {\n    std::cout << \"Estimating normals using PCANormalEstimation\" << std::endl;\n    normals->SetInputData(polyData);\n    normals->SetSampleSize(sampleSize);\n    normals->SetNormalOrientationToGraphTraversal();\n    normals->FlipNormalsOn();\n    distance->SetInputConnection(normals->GetOutputPort());\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  int dimension = 512;\n  double radius;\n  radius = range[0] / static_cast<double>(dimension) * 3; // ~3 voxels\n  std::cout << \"Radius: \" << radius << std::endl;\n\n  distance->SetRadius(radius);\n  distance->SetDimensions(dimension, dimension, dimension);\n  distance->SetBounds(bounds[0] - range[0] * .1, bounds[1] + range[0] * .1,\n                      bounds[2] - range[1] * .1, bounds[3] + range[1] * .1,\n                      bounds[4] - range[2] * .1, bounds[5] + range[2] * .1);\n\n  vtkNew<vtkExtractSurface> surface;\n  surface->SetInputConnection(distance->GetOutputPort());\n  surface->SetRadius(radius * .99);\n  surface->HoleFillingOn();\n  surface->Update();\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  if (polyData->GetPointData()->GetNormals())\n  {\n    MakeGlyphs(polyData, radius * 2.0, glyph3D.GetPointer());\n  }\n  else\n  {\n    MakeGlyphs(normals->GetOutput(), radius * 2.0, glyph3D.GetPointer());\n  }\n  vtkNew<vtkPolyDataMapper> surfaceMapper;\n  surfaceMapper->SetInputConnection(surface->GetOutputPort());\n  surfaceMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetColor(colors->GetColor3d(\"Coral\").GetData());\n  surfaceActor->SetBackfaceProperty(backProp);\n\n  vtkNew<vtkPolyDataMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"ExtractSurfaceDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(surfaceActor);\n  ren1->AddActor(glyph3DActor);\n\n  // Generate an interesting view.\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\n//-----------------------------------------------------------------------------\nvoid MakeGlyphs(vtkPolyData* src, double size, vtkGlyph3D* glyph)\n{\n  vtkNew<vtkMaskPoints> maskPts;\n  maskPts->SetOnRatio(20);\n  maskPts->RandomModeOn();\n  maskPts->SetInputData(src);\n  // Source for the glyph filter.\n  vtkNew<vtkArrowSource> arrow;\n  arrow->SetTipResolution(16);\n  arrow->SetTipLength(0.3);\n  arrow->SetTipRadius(0.1);\n\n  glyph->SetSourceConnection(arrow->GetOutputPort());\n  glyph->SetInputConnection(maskPts->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  //  glyph->SetColorModeToColorByVector();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->SetScaleFactor(size);\n  glyph->OrientOn();\n  glyph->Update();\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // A random position.\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Points/ExtractSurfaceDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractSurfaceDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractSurfaceDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractSurfaceDemo MACOSX_BUNDLE ExtractSurfaceDemo.cxx )\n  target_link_libraries(ExtractSurfaceDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractSurfaceDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/ExtractSurfaceDemo/#download-and-build-extractsurfacedemo","title":"Download and Build ExtractSurfaceDemo","text":"

Click here to download ExtractSurfaceDemo and its CMakeLists.txt file. Once the tarball ExtractSurfaceDemo.tar has been downloaded and extracted,

cd ExtractSurfaceDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractSurfaceDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/FitImplicitFunction/","title":"FitImplicitFunction","text":"

vtk-examples/Cxx/Points/FitImplicitFunction

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/FitImplicitFunction/#code","title":"Code","text":"

FitImplicitFunction.cxx

#include <vtkBoundedPointSource.h>\n#include <vtkCamera.h>\n#include <vtkFitImplicitFunction.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphere.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  double radius = 1.0;\n  vtkNew<vtkBoundedPointSource> points;\n  points->SetNumberOfPoints(1000000);\n  points->SetBounds(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0);\n\n  vtkNew<vtkSphere> sphere;\n  sphere->SetRadius(radius);\n\n  vtkNew<vtkFitImplicitFunction> fit;\n  fit->SetInputConnection(points->GetOutputPort());\n  fit->SetImplicitFunction(sphere);\n  fit->SetThreshold(0.01);\n  fit->Update();\n  std::cout << fit->GetOutput()->GetNumberOfPoints() << \" out of \"\n            << points->GetNumberOfPoints() << \" points are within \"\n            << fit->GetThreshold() << \" of the implicit function\" << std::endl;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(radius * 0.05);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputConnection(fit->GetOutputPort());\n  glyph3D->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  vtkNew<vtkPolyDataMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"FitImplicitFunction\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(glyph3DActor);\n\n  // Generate an interesting view.\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Points/FitImplicitFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FitImplicitFunction)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FitImplicitFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FitImplicitFunction MACOSX_BUNDLE FitImplicitFunction.cxx )\n  target_link_libraries(FitImplicitFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FitImplicitFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/FitImplicitFunction/#download-and-build-fitimplicitfunction","title":"Download and Build FitImplicitFunction","text":"

Click here to download FitImplicitFunction and its CMakeLists.txt file. Once the tarball FitImplicitFunction.tar has been downloaded and extracted,

cd FitImplicitFunction/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FitImplicitFunction\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/MaskPointsFilter/","title":"MaskPointsFilter","text":"

vtk-examples/Cxx/Points/MaskPointsFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/MaskPointsFilter/#code","title":"Code","text":"

MaskPointsFilter.cxx

#include <vtkBoundedPointSource.h>\n#include <vtkCamera.h>\n#include <vtkCone.h>\n#include <vtkGlyph3D.h>\n#include <vtkImageData.h>\n#include <vtkImageThreshold.h>\n#include <vtkMaskPointsFilter.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleImplicitFunctionFilter.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvtkSmartPointer<vtkImageData> CreatePoints();\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkImageData> imageMask;\n  if (argc < 2)\n  {\n    imageMask = CreatePoints();\n  }\n  else\n  {\n    int upper = 1100;\n    if (argc > 2)\n    {\n      upper = atoi(argv[2]);\n    }\n    // Read the volume data e.g. FullHead.mhd\n    vtkNew<vtkMetaImageReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    vtkNew<vtkImageThreshold> threshold;\n    threshold->SetInputConnection(reader->GetOutputPort());\n    threshold->ThresholdByUpper(upper);\n    threshold->SetOutputScalarTypeToUnsignedChar();\n    threshold->ReplaceInOn();\n    threshold->SetInValue(255);\n    threshold->SetOutValue(0);\n    threshold->ReplaceOutOn();\n    threshold->Update();\n    imageMask = dynamic_cast<vtkImageData*>(threshold->GetOutput());\n  }\n  vtkNew<vtkBoundedPointSource> pointSource;\n  pointSource->SetNumberOfPoints(100000);\n  pointSource->SetBounds(imageMask->GetBounds());\n\n  vtkNew<vtkMaskPointsFilter> maskPoints;\n  maskPoints->SetInputConnection(pointSource->GetOutputPort());\n  maskPoints->SetMaskData(imageMask);\n\n  double radius = imageMask->GetSpacing()[0] * 4.0;\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(radius);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(maskPoints->GetOutputPort());\n  glyph->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph->ScalingOff();\n  glyph->Update();\n\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyph->GetOutputPort());\n  glyphMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyphMapper);\n  glyphActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"MaskPointsFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(glyphActor);\n\n  // Generate an interesting view\n  //\n  ren1->GetActiveCamera()->SetPosition(1, 0, 0);\n  ren1->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  ren1->GetActiveCamera()->SetViewUp(0, 0, -1);\n  ren1->GetActiveCamera()->Azimuth(30);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkImageData> CreatePoints()\n{\n  vtkSmartPointer<vtkImageData> imageMask;\n\n  vtkNew<vtkImageData> image;\n  image->SetDimensions(256, 256, 256);\n  image->AllocateScalars(VTK_DOUBLE, 1);\n  image->SetSpacing(5.0 / 255.0, 5.0 / 255.0, 5.0 / 255.0);\n  image->SetOrigin(-2.5, -2.5, -2.5);\n  vtkNew<vtkCone> implicitFunction;\n  vtkNew<vtkSampleImplicitFunctionFilter> sample;\n  sample->SetImplicitFunction(implicitFunction);\n  sample->SetInputData(image);\n\n  vtkNew<vtkImageThreshold> threshold;\n  threshold->SetInputConnection(sample->GetOutputPort());\n  threshold->ThresholdByLower(.5);\n  threshold->SetOutputScalarTypeToUnsignedChar();\n  threshold->ReplaceInOn();\n  threshold->SetInValue(255);\n  threshold->SetOutValue(0);\n  threshold->ReplaceOutOn();\n  threshold->Update();\n  imageMask = dynamic_cast<vtkImageData*>(threshold->GetOutput());\n  return imageMask;\n}\n} // namespace\n
"},{"location":"Cxx/Points/MaskPointsFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MaskPointsFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersPoints\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MaskPointsFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MaskPointsFilter MACOSX_BUNDLE MaskPointsFilter.cxx )\n  target_link_libraries(MaskPointsFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MaskPointsFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/MaskPointsFilter/#download-and-build-maskpointsfilter","title":"Download and Build MaskPointsFilter","text":"

Click here to download MaskPointsFilter and its CMakeLists.txt file. Once the tarball MaskPointsFilter.tar has been downloaded and extracted,

cd MaskPointsFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MaskPointsFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/NormalEstimation/","title":"NormalEstimation","text":"

vtk-examples/Cxx/Points/NormalEstimation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/NormalEstimation/#code","title":"Code","text":"

NormalEstimation.cxx

#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid MakeGlyphs(vtkPolyData* src, double size, vtkGlyph3D* glyph);\n}\n\nint main(int, char*[])\n{\n  double radius = 1.0;\n  vtkNew<vtkPointSource> points;\n  points->SetNumberOfPoints(1000);\n  points->SetRadius(radius);\n  points->SetCenter(0.0, 0.0, 0.0);\n  points->SetDistributionToShell();\n\n  int sampleSize = 10;\n  vtkNew<vtkPCANormalEstimation> normals;\n  normals->SetInputConnection(points->GetOutputPort());\n  normals->SetSampleSize(sampleSize);\n  normals->SetNormalOrientationToGraphTraversal();\n  normals->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  MakeGlyphs(normals->GetOutput(), radius * 0.2, glyph3D.GetPointer());\n\n  vtkNew<vtkPolyDataMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetRadius(1.0);\n  sphere->SetThetaResolution(41);\n  sphere->SetPhiResolution(21);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"NormalEstimation\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer->AddActor(glyph3DActor);\n  renderer->AddActor(sphereActor);\n\n  // Generate an interesting view\n  //\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvoid MakeGlyphs(vtkPolyData* src, double size, vtkGlyph3D* glyph)\n{\n  // Source for the glyph filter\n  vtkNew<vtkArrowSource> arrow;\n  arrow->SetTipResolution(16);\n  arrow->SetTipLength(0.3);\n  arrow->SetTipRadius(0.1);\n\n  glyph->SetSourceConnection(arrow->GetOutputPort());\n  glyph->SetInputData(src);\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->SetScaleFactor(size);\n  glyph->OrientOn();\n  glyph->Update();\n}\n} // namespace\n
"},{"location":"Cxx/Points/NormalEstimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NormalEstimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NormalEstimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NormalEstimation MACOSX_BUNDLE NormalEstimation.cxx )\n  target_link_libraries(NormalEstimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NormalEstimation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/NormalEstimation/#download-and-build-normalestimation","title":"Download and Build NormalEstimation","text":"

Click here to download NormalEstimation and its CMakeLists.txt file. Once the tarball NormalEstimation.tar has been downloaded and extracted,

cd NormalEstimation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./NormalEstimation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/PointOccupancy/","title":"PointOccupancy","text":"

vtk-examples/Cxx/Points/PointOccupancy

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/PointOccupancy/#code","title":"Code","text":"

PointOccupancy.cxx

#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointOccupancyFilter.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkThreshold.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  int dimension = 128;\n  vtkNew<vtkPointOccupancyFilter> occupancy;\n  occupancy->SetInputData(polyData);\n  occupancy->SetSampleDimensions(dimension, dimension, dimension);\n  occupancy->SetOccupiedValue(255);\n  occupancy->Update();\n\n  vtkNew<vtkThreshold> threshold;\n  threshold->SetInputConnection(occupancy->GetOutputPort());\n  threshold->SetUpperThreshold(255);\n  threshold->SetThresholdFunction(vtkThreshold::THRESHOLD_UPPER);\n  threshold->AllScalarsOff();\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(threshold->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Colors\n  vtkNew<vtkNamedColors> nc;\n  double flesh[3];\n  nc->GetColorRGB(\"moccasin\", flesh);\n  actor->GetProperty()->SetColor(flesh);\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(actor);\n  ren1->SetBackground(nc->GetColor3d(\"CornflowerBLue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"PointOccupancy\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Generate an interesting view.\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.25);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Points/PointOccupancy/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointOccupancy)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointOccupancy: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointOccupancy MACOSX_BUNDLE PointOccupancy.cxx )\n  target_link_libraries(PointOccupancy PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointOccupancy\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/PointOccupancy/#download-and-build-pointoccupancy","title":"Download and Build PointOccupancy","text":"

Click here to download PointOccupancy and its CMakeLists.txt file. Once the tarball PointOccupancy.tar has been downloaded and extracted,

cd PointOccupancy/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointOccupancy\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/PoissonExtractSurface/","title":"PoissonExtractSurface","text":"

vtk-examples/Cxx/Points/PoissonExtractSurface

"},{"location":"Cxx/Points/PoissonExtractSurface/#description","title":"Description","text":"

This example uses the PoissonReconstruction remote module to reconstruct surfaces from unorganized points. This code was, with permission, adapted directly from the original implementation by Kazhdan, Bolitho, and Hugues. The original implementation can be found here.

PoissonReconstruction requires that the vtkPolyData input have vtkNormals. If normals are not included in the vtkPointData, the example uses vtkPCANormalEstimation to create normals.

If the example is run without an argument, the example uses random points on a spherical shell. With a filename, the example uses the points on the vtkPolyData.

Cite

The VTK Journal paper Poisson Surface Reconstruction for VTK describes the VTK implementaion.

Info

CompareExtractSurface compares three surface extraction algorithms.

Seealso

ExtractSurface reconstructs surfaces and is included with the VTK distribution. PowercrustExtractSurface reconstructs surfaces and is implemented as a VTK remote module.

Info

PoissonReconstruction is implemented as a VTK Remote Module.

To use PoissonReconstruction in VTK:

  1. Download PoissonReconstruction.remote.cmake and place it in your VTK/Remote directory.
  2. Reconfigure your VTK build with cmake
  3. Enable the remote module by setting Module_PoissonReconstruction:BOOL=ON.
  4. make

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/PoissonExtractSurface/#code","title":"Code","text":"

PoissonExtractSurface.cxx

#include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointSource.h>\n#include <vtkPoissonReconstruction.h>\n\n#include <vtkCamera.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <vtkNamedColors.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n  std::cout << \"# of points: \" << polyData->GetNumberOfPoints() << std::endl;\n\n  vtkSmartPointer<vtkPoissonReconstruction> surface =\n      vtkSmartPointer<vtkPoissonReconstruction>::New();\n  surface->SetDepth(12);\n\n  int sampleSize = polyData->GetNumberOfPoints() * .00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 10;\n  }\n  if (polyData->GetPointData()->GetNormals())\n  {\n    std::cout << \"Using normals from input file\" << std::endl;\n    surface->SetInputData(polyData);\n  }\n  else\n  {\n    std::cout << \"Estimating normals using PCANormalEstimation\" << std::endl;\n    vtkSmartPointer<vtkPCANormalEstimation> normals =\n        vtkSmartPointer<vtkPCANormalEstimation>::New();\n    normals->SetInputData(polyData);\n    normals->SetSampleSize(sampleSize);\n    normals->SetNormalOrientationToGraphTraversal();\n    normals->FlipNormalsOff();\n    surface->SetInputConnection(normals->GetOutputPort());\n  }\n\n  vtkSmartPointer<vtkPolyDataMapper> surfaceMapper =\n      vtkSmartPointer<vtkPolyDataMapper>::New();\n  surfaceMapper->SetInputConnection(surface->GetOutputPort());\n\n  vtkSmartPointer<vtkNamedColors> colors =\n      vtkSmartPointer<vtkNamedColors>::New();\n\n  vtkSmartPointer<vtkProperty> back = vtkSmartPointer<vtkProperty>::New();\n  back->SetColor(colors->GetColor3d(\"banana\").GetData());\n\n  vtkSmartPointer<vtkActor> surfaceActor = vtkSmartPointer<vtkActor>::New();\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  surfaceActor->SetBackfaceProperty(back);\n\n  // Create graphics stuff\n  //\n  vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkSmartPointer<vtkRenderWindow> renWin =\n      vtkSmartPointer<vtkRenderWindow>::New();\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n\n  vtkSmartPointer<vtkRenderWindowInteractor> iren =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(surfaceActor);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkSmartPointer<vtkPLYReader> reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkSmartPointer<vtkXMLPolyDataReader> reader =\n        vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkSmartPointer<vtkPolyDataReader> reader =\n        vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkSmartPointer<vtkOBJReader> reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkSmartPointer<vtkBYUReader> reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkSmartPointer<vtkPointSource> points =\n        vtkSmartPointer<vtkPointSource>::New();\n    points->SetNumberOfPoints(1000);\n    points->SetRadius(1.0);\n    points->SetCenter(vtkMath::Random(-1, 1), vtkMath::Random(-1, 1),\n                      vtkMath::Random(-1, 1));\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Points/PoissonExtractSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PoissonExtractSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PoissonExtractSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PoissonExtractSurface MACOSX_BUNDLE PoissonExtractSurface.cxx )\n  target_link_libraries(PoissonExtractSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PoissonExtractSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/PoissonExtractSurface/#download-and-build-poissonextractsurface","title":"Download and Build PoissonExtractSurface","text":"

Click here to download PoissonExtractSurface and its CMakeLists.txt file. Once the tarball PoissonExtractSurface.tar has been downloaded and extracted,

cd PoissonExtractSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PoissonExtractSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/PowercrustExtractSurface/","title":"PowercrustExtractSurface","text":"

vtk-examples/Cxx/Points/PowercrustExtractSurface

"},{"location":"Cxx/Points/PowercrustExtractSurface/#description","title":"Description","text":"

The Powercrust, or Crust algorithm, reconstructs surfaces from unorganized points.

If the example is run without an argument, the example uses random points on a spherical shell. With a filename, the example uses the points on the vtkPolyData.

Cite

See The Power Crust for technical details.

Info

CompareExtractSurface compares three surface extraction algorithms.

Seealso

ExtractSurface reconstructs surfaces and is included with the VTK distribution. PoissonExtractSurface reconstructs surfaces and is implemented as a VTK remote module.

Danger

The code is covered by the GPL License and may restrict commercial use..

Info

The Power Crust is implemented as a VTK Remote Module.

To use the Power Crust in VTK:

  1. Download Powercrust.remote.cmake and place it in your VTK/Remote directory.
  2. Reconfigure your VTK build with cmake
  3. Enable the remote module by setting Module_Powercrust:BOOL=ON.
  4. make

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/PowercrustExtractSurface/#code","title":"Code","text":"

PowercrustExtractSurface.cxx

#include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPowerCrustSurfaceReconstruction.h>\n\n#include <vtkCamera.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <vtkNamedColors.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n  std::cout << \"# of points: \" << polyData->GetNumberOfPoints() << std::endl;\n\n  vtkSmartPointer<vtkPowerCrustSurfaceReconstruction> surface =\n      vtkSmartPointer<vtkPowerCrustSurfaceReconstruction>::New();\n  surface->SetInputData(polyData);\n\n  vtkSmartPointer<vtkPolyDataMapper> surfaceMapper =\n      vtkSmartPointer<vtkPolyDataMapper>::New();\n  surfaceMapper->SetInputConnection(surface->GetOutputPort());\n\n  vtkSmartPointer<vtkNamedColors> colors =\n      vtkSmartPointer<vtkNamedColors>::New();\n\n  vtkSmartPointer<vtkProperty> back = vtkSmartPointer<vtkProperty>::New();\n  back->SetColor(colors->GetColor3d(\"banana\").GetData());\n\n  vtkSmartPointer<vtkActor> surfaceActor = vtkSmartPointer<vtkActor>::New();\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  surfaceActor->SetBackfaceProperty(back);\n\n  // Create graphics stuff\n  //\n  vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkSmartPointer<vtkRenderWindow> renWin =\n      vtkSmartPointer<vtkRenderWindow>::New();\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n\n  vtkSmartPointer<vtkRenderWindowInteractor> iren =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(surfaceActor);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkSmartPointer<vtkPLYReader> reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkSmartPointer<vtkXMLPolyDataReader> reader =\n        vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkSmartPointer<vtkPolyDataReader> reader =\n        vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkSmartPointer<vtkOBJReader> reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkSmartPointer<vtkBYUReader> reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkSmartPointer<vtkPointSource> points =\n        vtkSmartPointer<vtkPointSource>::New();\n    points->SetNumberOfPoints(1000);\n    points->SetRadius(1.0);\n    points->SetCenter(vtkMath::Random(-1, 1), vtkMath::Random(-1, 1),\n                      vtkMath::Random(-1, 1));\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Points/PowercrustExtractSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PowercrustExtractSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PowercrustExtractSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PowercrustExtractSurface MACOSX_BUNDLE PowercrustExtractSurface.cxx )\n  target_link_libraries(PowercrustExtractSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PowercrustExtractSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/PowercrustExtractSurface/#download-and-build-powercrustextractsurface","title":"Download and Build PowercrustExtractSurface","text":"

Click here to download PowercrustExtractSurface and its CMakeLists.txt file. Once the tarball PowercrustExtractSurface.tar has been downloaded and extracted,

cd PowercrustExtractSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PowercrustExtractSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/RadiusOutlierRemoval/","title":"RadiusOutlierRemoval","text":"

vtk-examples/Cxx/Points/RadiusOutlierRemoval

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Points/RadiusOutlierRemoval/#description","title":"Description","text":"

In this example, outliers are red. Yellow points satisfy the radius and neighbor restrictions.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/RadiusOutlierRemoval/#code","title":"Code","text":"

RadiusOutlierRemoval.cxx

#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRadiusOutlierRemoval.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  std::cout << \"# of original points: \" << polyData->GetNumberOfPoints()\n            << std::endl;\n  vtkNew<vtkRadiusOutlierRemoval> removal;\n  removal->SetInputData(polyData);\n  removal->SetRadius(range[0] / 50.0);\n  removal->SetNumberOfNeighbors(6);\n  removal->GenerateOutliersOn();\n  removal->Update();\n  std::cout << \"# of removed points: \" << removal->GetNumberOfPointsRemoved()\n            << std::endl;\n\n  ///\n  double radius = range[0] * .01;\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetRadius(radius);\n\n  vtkNew<vtkGlyph3D> glyph3D1;\n  glyph3D1->SetInputConnection(removal->GetOutputPort());\n  glyph3D1->SetSourceConnection(sphereSource1->GetOutputPort());\n  glyph3D1->ScalingOff();\n  glyph3D1->Update();\n  vtkNew<vtkPolyDataMapper> glyph3DMapper1;\n  glyph3DMapper1->SetInputConnection(glyph3D1->GetOutputPort());\n  glyph3DMapper1->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor1;\n  glyph3DActor1->SetMapper(glyph3DMapper1);\n  glyph3DActor1->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  ////\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetRadius(radius * 0.75);\n\n  vtkNew<vtkGlyph3D> glyph3D2;\n  glyph3D2->SetInputConnection(removal->GetOutputPort(1));\n  glyph3D2->SetSourceConnection(sphereSource2->GetOutputPort());\n  glyph3D2->ScalingOff();\n  glyph3D2->Update();\n\n  vtkNew<vtkPolyDataMapper> glyph3DMapper2;\n  glyph3DMapper2->SetInputConnection(glyph3D2->GetOutputPort());\n  glyph3DMapper2->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor2;\n  glyph3DActor2->SetMapper(glyph3DMapper2);\n  glyph3DActor2->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"RadiusOutlierRemoval\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(glyph3DActor1);\n  ren1->AddActor(glyph3DActor2);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Points/RadiusOutlierRemoval/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RadiusOutlierRemoval)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RadiusOutlierRemoval: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RadiusOutlierRemoval MACOSX_BUNDLE RadiusOutlierRemoval.cxx )\n  target_link_libraries(RadiusOutlierRemoval PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RadiusOutlierRemoval\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/RadiusOutlierRemoval/#download-and-build-radiusoutlierremoval","title":"Download and Build RadiusOutlierRemoval","text":"

Click here to download RadiusOutlierRemoval and its CMakeLists.txt file. Once the tarball RadiusOutlierRemoval.tar has been downloaded and extracted,

cd RadiusOutlierRemoval/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RadiusOutlierRemoval\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/SignedDistance/","title":"SignedDistance","text":"

vtk-examples/Cxx/Points/SignedDistance

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Points/SignedDistance/#description","title":"Description","text":"

Contrast this with the UnsignedDistance example.

The image was created using the Armadillo dataset, src/Testing/Data/Armadillo.ply.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/SignedDistance/#code","title":"Code","text":"

SignedDistance.cxx

#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSignedDistance.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = polyData->GetNumberOfPoints() * .00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 10;\n  }\n  std::cout << \"Sample size is: \" << sampleSize << std::endl;\n  vtkNew<vtkPCANormalEstimation> normals;\n  normals->SetInputData(polyData);\n  normals->SetSampleSize(sampleSize);\n  normals->SetNormalOrientationToGraphTraversal();\n  normals->FlipNormalsOn();\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  int dimension = 256;\n  dimension = 128;\n  // auto radius = range[0] * 0.02;\n  auto radius = range[0] / static_cast<double>(dimension) * 5; // ~5 voxels\n  std::cout << \"Radius: \" << radius << std::endl;\n  vtkNew<vtkSignedDistance> distance;\n  distance->SetInputConnection(normals->GetOutputPort());\n  distance->SetRadius(radius);\n  distance->SetDimensions(dimension, dimension, dimension);\n  distance->SetBounds(bounds[0] - range[0] * 0.1, bounds[1] + range[0] * 0.1,\n                      bounds[2] - range[1] * 0.1, bounds[3] + range[1] * 0.1,\n                      bounds[4] - range[2] * 0.1, bounds[5] + range[2] * 0.1);\n\n  // Create a lookup table that consists of the full hue circle\n  // (from HSV).\n  auto belowRangeColor = colors->GetColor4d(\"Black\").GetData();\n  belowRangeColor[3] = 0.2;\n  auto aboveRangeColor = colors->GetColor4d(\"White\").GetData();\n  aboveRangeColor[3] = 0.2;\n  vtkNew<vtkLookupTable> hueLut;\n  hueLut->SetTableRange(-0.99 * radius, 0.99 * radius);\n  hueLut->SetHueRange(0.667, 0);\n  hueLut->SetSaturationRange(1, 1);\n  hueLut->SetValueRange(1, 1);\n  hueLut->UseBelowRangeColorOn();\n  hueLut->SetBelowRangeColor(belowRangeColor);\n  hueLut->UseAboveRangeColorOn();\n  hueLut->SetAboveRangeColor(aboveRangeColor);\n  hueLut->SetNumberOfColors(5);\n  hueLut->Build();\n  double* last = hueLut->GetTableValue(4);\n  hueLut->SetAboveRangeColor(last[0], last[1], last[2], 0);\n\n  vtkNew<vtkImageMapToColors> sagittalColors;\n  sagittalColors->SetInputConnection(distance->GetOutputPort());\n  sagittalColors->SetLookupTable(hueLut);\n  sagittalColors->Update();\n\n  vtkNew<vtkImageActor> sagittal;\n  sagittal->GetMapper()->SetInputConnection(sagittalColors->GetOutputPort());\n  sagittal->SetDisplayExtent(dimension / 2, dimension / 2, 0, dimension - 1, 0,\n                             dimension - 1);\n  sagittal->ForceOpaqueOn();\n\n  vtkNew<vtkImageMapToColors> axialColors;\n  axialColors->SetInputConnection(distance->GetOutputPort());\n  axialColors->SetLookupTable(hueLut);\n  axialColors->Update();\n\n  vtkNew<vtkImageActor> axial;\n  axial->GetMapper()->SetInputConnection(axialColors->GetOutputPort());\n  axial->SetDisplayExtent(0, dimension - 1, 0, dimension - 1, dimension / 2,\n                          dimension / 2);\n  axial->ForceOpaqueOn();\n\n  vtkNew<vtkImageMapToColors> coronalColors;\n  coronalColors->SetInputConnection(distance->GetOutputPort());\n  coronalColors->SetLookupTable(hueLut);\n  coronalColors->Update();\n\n  vtkNew<vtkImageActor> coronal;\n  coronal->GetMapper()->SetInputConnection(coronalColors->GetOutputPort());\n  coronal->SetDisplayExtent(0, dimension - 1, dimension / 2, dimension / 2, 0,\n                            dimension - 1);\n  coronal->ForceOpaqueOn();\n\n  // Create a scalar bar.\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(hueLut);\n  scalarBar->SetTitle(\"Distance\");\n  scalarBar->SetNumberOfLabels(5);\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(600, 400);\n  renWin->SetWindowName(\"SignedDistance\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(sagittal);\n  ren1->AddActor(axial);\n  ren1->AddActor(coronal);\n  ren1->AddActor2D(scalarBar);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n  std::cout << distance->GetOutput()->GetScalarRange()[0] << \", \"\n            << distance->GetOutput()->GetScalarRange()[1] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase.\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Points/SignedDistance/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SignedDistance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  ImagingCore\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SignedDistance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SignedDistance MACOSX_BUNDLE SignedDistance.cxx )\n  target_link_libraries(SignedDistance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SignedDistance\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/SignedDistance/#download-and-build-signeddistance","title":"Download and Build SignedDistance","text":"

Click here to download SignedDistance and its CMakeLists.txt file. Once the tarball SignedDistance.tar has been downloaded and extracted,

cd SignedDistance/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SignedDistance\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Points/UnsignedDistance/","title":"UnsignedDistance","text":"

vtk-examples/Cxx/Points/UnsignedDistance

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Points/UnsignedDistance/#description","title":"Description","text":"

Contrast this with the SignedDistance example.

The image was created using the Armadillo dataset, src/Testing/Data/Armadillo.ply.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Points/UnsignedDistance/#code","title":"Code","text":"

UnsignedDistance.cxx

#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnsignedDistance.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = polyData->GetNumberOfPoints() * .00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 10;\n  }\n  std::cout << \"Sample size is: \" << sampleSize << std::endl;\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  int dimension = 256;\n  dimension = 128;\n  // auto radius = range[0] * .02;\n  auto radius = range[0] / static_cast<double>(dimension) * 5;\n  ; // ~5 voxels\n  std::cout << \"Radius: \" << radius << std::endl;\n  vtkNew<vtkUnsignedDistance> distance;\n  distance->SetInputData(polyData);\n  distance->SetRadius(radius);\n  distance->SetDimensions(dimension, dimension, dimension);\n  distance->SetBounds(bounds[0] - range[0] * .1, bounds[1] + range[0] * .1,\n                      bounds[2] - range[1] * .1, bounds[3] + range[1] * .1,\n                      bounds[4] - range[2] * .1, bounds[5] + range[2] * .1);\n\n  // Create a lookup table that consists of the full hue circle\n  // (from HSV).\n  auto aboveRangeColor = colors->GetColor4d(\"White\").GetData();\n  aboveRangeColor[3] = 0.2;\n  vtkNew<vtkLookupTable> hueLut;\n  hueLut->SetTableRange(-.99 * radius, .99 * radius);\n  hueLut->SetHueRange(.667, 0);\n  hueLut->SetSaturationRange(1, 1);\n  hueLut->SetValueRange(1, 1);\n  hueLut->UseAboveRangeColorOn();\n  hueLut->SetAboveRangeColor(aboveRangeColor);\n  hueLut->SetNumberOfColors(5);\n  hueLut->Build();\n  double* last = hueLut->GetTableValue(4);\n  hueLut->SetAboveRangeColor(last[0], last[1], last[2], 0);\n\n  vtkNew<vtkImageMapToColors> sagittalColors;\n  sagittalColors->SetInputConnection(distance->GetOutputPort());\n  sagittalColors->SetLookupTable(hueLut);\n  sagittalColors->Update();\n\n  vtkNew<vtkImageActor> sagittal;\n  sagittal->GetMapper()->SetInputConnection(sagittalColors->GetOutputPort());\n  sagittal->SetDisplayExtent(dimension / 2, dimension / 2, 0, dimension - 1, 0,\n                             dimension - 1);\n  sagittal->ForceOpaqueOn();\n\n  vtkNew<vtkImageMapToColors> axialColors;\n  axialColors->SetInputConnection(distance->GetOutputPort());\n  axialColors->SetLookupTable(hueLut);\n  axialColors->Update();\n\n  vtkNew<vtkImageActor> axial;\n  axial->GetMapper()->SetInputConnection(axialColors->GetOutputPort());\n  axial->SetDisplayExtent(0, dimension - 1, 0, dimension - 1, dimension / 2,\n                          dimension / 2);\n  axial->ForceOpaqueOn();\n\n  vtkNew<vtkImageMapToColors> coronalColors;\n  coronalColors->SetInputConnection(distance->GetOutputPort());\n  coronalColors->SetLookupTable(hueLut);\n  coronalColors->Update();\n\n  vtkNew<vtkImageActor> coronal;\n  coronal->GetMapper()->SetInputConnection(coronalColors->GetOutputPort());\n  coronal->SetDisplayExtent(0, dimension - 1, dimension / 2, dimension / 2, 0,\n                            dimension - 1);\n  coronal->ForceOpaqueOn();\n\n  // Create a scalar bar.\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(hueLut);\n  scalarBar->SetTitle(\"Distance\");\n  scalarBar->SetNumberOfLabels(5);\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(.3, .4, .6);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(600, 400);\n  renWin->SetWindowName(\"UnsignedDistance\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(sagittal);\n  ren1->AddActor(axial);\n  ren1->AddActor(coronal);\n  ren1->AddActor2D(scalarBar);\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Generate an interesting view.\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n  std::cout << distance->GetOutput()->GetScalarRange()[0] << \", \"\n            << distance->GetOutput()->GetScalarRange()[1] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase.\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n\n} // namespace\n
"},{"location":"Cxx/Points/UnsignedDistance/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(UnsignedDistance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  ImagingCore\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"UnsignedDistance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(UnsignedDistance MACOSX_BUNDLE UnsignedDistance.cxx )\n  target_link_libraries(UnsignedDistance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS UnsignedDistance\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Points/UnsignedDistance/#download-and-build-unsigneddistance","title":"Download and Build UnsignedDistance","text":"

Click here to download UnsignedDistance and its CMakeLists.txt file. Once the tarball UnsignedDistance.tar has been downloaded and extracted,

cd UnsignedDistance/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./UnsignedDistance\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/AlignFrames/","title":"AlignFrames","text":"

vtk-examples/Cxx/PolyData/AlignFrames

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/AlignFrames/#code","title":"Code","text":"

AlignFrames.cxx

#include <vtkLandmarkTransform.h>\n#include <vtkMath.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n#include <vtkVertexGlyphFilter.h>\n#include <vtkXMLPolyDataWriter.h>\n\nnamespace {\nstruct Frame\n{\n  Frame(float o[3], float x[3], float y[3], float z[3])\n  {\n    this->SetOrigin(o);\n    this->SetXDirection(x);\n    this->SetYDirection(y);\n    this->SetZDirection(z);\n\n    std::cout << \"Origin: \" << this->origin[0] << \" \" << this->origin[1] << \" \"\n              << this->origin[2] << std::endl;\n    std::cout << \"xDirection: \" << this->xDirection[0] << \" \"\n              << this->xDirection[1] << \" \" << this->xDirection[2] << std::endl;\n    std::cout << \"yDirection: \" << this->yDirection[0] << \" \"\n              << this->yDirection[1] << \" \" << this->yDirection[2] << std::endl;\n    std::cout << \"zDirection: \" << this->zDirection[0] << \" \"\n              << this->zDirection[1] << \" \" << this->zDirection[2] << std::endl;\n  }\n\n  void ApplyTransform(vtkTransform* transform, std::string filename)\n  {\n    vtkNew<vtkPolyData> polydata;\n    CreatePolydata(polydata);\n\n    vtkNew<vtkTransformFilter> transformFilter;\n    transformFilter->SetInputData(polydata);\n    transformFilter->SetTransform(transform);\n    transformFilter->Update();\n\n    vtkNew<vtkXMLPolyDataWriter> writer;\n    writer->SetFileName(filename.c_str());\n    writer->SetInputConnection(transformFilter->GetOutputPort());\n    writer->Write();\n  }\n\n  void CreatePolydata(vtkPolyData* polydata)\n  {\n    vtkNew<vtkPoints> points;\n\n    points->InsertNextPoint(this->origin);\n    float x[3];\n    vtkMath::Add(this->origin, this->xDirection, x);\n    points->InsertNextPoint(x);\n    float y[3];\n    vtkMath::Add(this->origin, this->yDirection, y);\n    points->InsertNextPoint(y);\n    float z[3];\n    vtkMath::Add(this->origin, this->zDirection, z);\n    points->InsertNextPoint(z);\n\n    polydata->SetPoints(points);\n\n    vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n    vertexGlyphFilter->AddInputData(polydata);\n    vertexGlyphFilter->Update();\n\n    polydata->ShallowCopy(vertexGlyphFilter->GetOutput());\n  }\n\n  void Write(std::string filename)\n  {\n    vtkNew<vtkPolyData> polydata;\n    CreatePolydata(polydata);\n\n    vtkNew<vtkXMLPolyDataWriter> writer;\n    writer->SetFileName(filename.c_str());\n    writer->SetInputData(polydata);\n    writer->Write();\n  }\n\n  float origin[3];\n  float xDirection[3];\n  float yDirection[3];\n  float zDirection[3];\n\n  void SetOrigin(float o[3])\n  {\n    this->origin[0] = o[0];\n    this->origin[1] = o[1];\n    this->origin[2] = o[2];\n  }\n\n  void SetXDirection(float direction[3])\n  {\n    vtkMath::Normalize(direction);\n    this->xDirection[0] = direction[0];\n    this->xDirection[1] = direction[1];\n    this->xDirection[2] = direction[2];\n  }\n\n  void SetYDirection(float direction[3])\n  {\n    vtkMath::Normalize(direction);\n    this->yDirection[0] = direction[0];\n    this->yDirection[1] = direction[1];\n    this->yDirection[2] = direction[2];\n  }\n\n  void SetZDirection(float direction[3])\n  {\n    vtkMath::Normalize(direction);\n    this->zDirection[0] = direction[0];\n    this->zDirection[1] = direction[1];\n    this->zDirection[2] = direction[2];\n  }\n};\n\nvoid AlignFrames(Frame sourceFrame, Frame destinationFrame,\n                 vtkTransform* transform);\n} // namespace\n\nint main(int, char*[])\n{\n  float frame1origin[3] = {0, 0, 0};\n  float frame1XDirection[3] = {1, 0, 0};\n  float frame1YDirection[3] = {0, 1, 0};\n  std::cout << frame1YDirection[0] << \" \" << frame1YDirection[1] << \" \"\n            << frame1YDirection[2] << std::endl;\n  float frame1ZDirection[3] = {0, 0, 1};\n  Frame frame1(frame1origin, frame1XDirection, frame1YDirection,\n               frame1ZDirection);\n  frame1.Write(\"frame1.vtp\");\n\n  float frame2origin[3] = {0, 0, 0};\n  float frame2XDirection[3] = {.707f, .707f, 0};\n  float frame2YDirection[3] = {-.707f, .707f, 0};\n  float frame2ZDirection[3] = {0, 0, 1};\n  Frame frame2(frame2origin, frame2XDirection, frame2YDirection,\n               frame2ZDirection);\n  frame2.Write(\"frame2.vtp\");\n\n  vtkNew<vtkTransform> transform;\n  AlignFrames(frame2, frame1, transform); // Brings frame2 to frame1\n\n  // std::cout << *transform << std::endl;\n\n  frame2.ApplyTransform(transform, \"transformed.vtp\");\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid AlignFrames(Frame sourceFrame, Frame targetFrame, vtkTransform* transform)\n{\n  // This function takes two frames and finds the matrix M between them.\n\n  vtkNew<vtkLandmarkTransform> landmarkTransform;\n\n  // Setup source points\n  vtkNew<vtkPoints> sourcePoints;\n\n  sourcePoints->InsertNextPoint(sourceFrame.origin);\n  float sourceX[3];\n  vtkMath::Add(sourceFrame.origin, sourceFrame.xDirection, sourceX);\n  sourcePoints->InsertNextPoint(sourceX);\n  float sourceY[3];\n  vtkMath::Add(sourceFrame.origin, sourceFrame.yDirection, sourceY);\n  sourcePoints->InsertNextPoint(sourceY);\n  float sourceZ[3];\n  vtkMath::Add(sourceFrame.origin, sourceFrame.zDirection, sourceZ);\n  sourcePoints->InsertNextPoint(sourceZ);\n\n  // Setup target points\n  vtkNew<vtkPoints> targetPoints;\n\n  targetPoints->InsertNextPoint(targetFrame.origin);\n  float targetX[3];\n  vtkMath::Add(targetFrame.origin, targetFrame.xDirection, targetX);\n  targetPoints->InsertNextPoint(targetX);\n  float targetY[3];\n  vtkMath::Add(targetFrame.origin, targetFrame.yDirection, targetY);\n  targetPoints->InsertNextPoint(targetY);\n  float targetZ[3];\n  vtkMath::Add(targetFrame.origin, targetFrame.zDirection, targetZ);\n  targetPoints->InsertNextPoint(targetZ);\n\n  landmarkTransform->SetSourceLandmarks(sourcePoints);\n  landmarkTransform->SetTargetLandmarks(targetPoints);\n  landmarkTransform->SetModeToRigidBody();\n  landmarkTransform->Update();\n\n  vtkMatrix4x4* M = landmarkTransform->GetMatrix();\n\n  transform->SetMatrix(M);\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/AlignFrames/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AlignFrames)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AlignFrames: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AlignFrames MACOSX_BUNDLE AlignFrames.cxx )\n  target_link_libraries(AlignFrames PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AlignFrames\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/AlignFrames/#download-and-build-alignframes","title":"Download and Build AlignFrames","text":"

Click here to download AlignFrames and its CMakeLists.txt file. Once the tarball AlignFrames.tar has been downloaded and extracted,

cd AlignFrames/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AlignFrames\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/AlignTwoPolyDatas/","title":"AlignTwoPolyDatas","text":"

vtk-examples/Cxx/PolyData/AlignTwoPolyDatas

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/AlignTwoPolyDatas/#description","title":"Description","text":"

This example shows how to align two vtkPolyData's. Typically, the two datasets are related. For example, aligning a CT head isosurface with an MRI head isosurface of the same patient. Or two steps in a time series of an evolving surface. These cases usually reside in the same coordinate system, and the initial alignment is \"close\" to the desired results.

Another case is when the two datasets are from the \"same\" family of objects - for example, running the example with two types of sharks that exist in different coordinate systems.

The algorithm proceeds as follows:

  1. Read the two vtkPolyData's that exist in the example's command line. The first file contains the source vtkPolyData to be aligned with the second file's vtkPolyData called the target. Another naming convention is moving and fixed.

  2. Compute a measure of fit of the two original files. We use the recently added vtkHausdorffDistancePointSetFilter to compute the measure. See Hausdorff Distance.

  3. Align the bounding boxes of the two datasets. Here we use a vtkOBBTree locator to create oriented bounding boxes. See Oriented Bounding Boxes. Use the bounding box corner coordinates to create source and target vtkLandmarkTransform's. vtkTransformPolyData uses this transform to create a new source vtkPolyData. Since the orientations of the bounding boxes may differ, the AlignBoundingBoxes function tries ten different rotations. For each rotation, it computes the Hausdorff distance between the target's OBB corners and the transformed source's OBB corners. Finally, transform the original source using the smallest distance.

  4. Improve the alignment with vtkIterativeClosestPointTransform with a RigidBody transform. Compute the distance metric again.

  5. Display the source and target vtkPolyData's with the transform that has the best distance metric.

Info

The example is run with src/Testing/Data/thingiverse/Grey_Nurse_Shark.stl and src/Testing/Data/greatWhite.stl, in this case, we reorient the target using a rotation. vtkTransformPolyDataFilter is used to get a better fit in this case.

Info

If example is run with src/Testing/Data/thingiverse/Grey_Nurse_Shark.stl and src/Testing/Data/shark.ply the fit is really poor and the Iterative Closest Point algotithm fails. So we fallback and use oriented bounding boxes.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/AlignTwoPolyDatas/#code","title":"Code","text":"

AlignTwoPolyDatas.cxx

#include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFieldData.h>\n#include <vtkHausdorffDistancePointSetFilter.h>\n#include <vtkIterativeClosestPointTransform.h>\n#include <vtkLandmarkTransform.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVersion.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <cmath>     // for std::isnan and std::isinf\n#include <string>    // For find_last_of()\n\n#include <array>\n#include <random>\n#include <sstream>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define VTK_HAS_COW 1\n#endif\n\n#if VTK_HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\nnamespace {\n/**\n * Show the command lime parameters.\n *\n * @param fn: The program name.\n */\nstd::string ShowUsage(std::string fn);\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\nvoid AlignBoundingBoxes(vtkPolyData*, vtkPolyData*);\nvoid BestBoundingBox(std::string const& axis, vtkPolyData* target,\n                     vtkPolyData* source, vtkPolyData* targetLandmarks,\n                     vtkPolyData* sourceLandmarks, double& distance,\n                     vtkPoints* bestPoints);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc != 3)\n  {\n    std::cout << ShowUsage(argv[0]) << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Vis Pipeline\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"sea_green_light\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  std::cout << \"Loading source: \" << argv[1] << std::endl;\n  auto sourcePolyData = ReadPolyData(argv[1]);\n\n  // Save the source polydata in case the align does not improve\n  // segmentation.\n  vtkNew<vtkPolyData> originalSourcePolyData;\n  originalSourcePolyData->DeepCopy(sourcePolyData);\n\n  std::cout << \"Loading target: \" << argv[2] << std::endl;\n  auto targetPolyData = ReadPolyData(argv[2]);\n\n  // If the target orientation is markedly different, you may need to apply a\n  // transform to orient the target with the source.\n  // For example, when using Grey_Nurse_Shark.stl as the\n  //  source and thingiverse/greatWhite.stl as the target,\n  // you need to transform the target.\n  auto sourceFound =\n      std::string(argv[1]).find(\"Grey_Nurse_Shark.stl\") != std::string::npos;\n  auto targetFound =\n      std::string(argv[2]).find(\"greatWhite.stl\") != std::string::npos;\n  vtkNew<vtkTransform> trnf;\n  if (sourceFound && targetFound)\n  {\n    trnf->RotateY(90);\n  }\n  vtkNew<vtkTransformPolyDataFilter> tpd;\n  tpd->SetTransform(trnf);\n  tpd->SetInputData(targetPolyData);\n  tpd->Update();\n\n  vtkNew<vtkHausdorffDistancePointSetFilter> distance;\n  distance->SetInputData(0, tpd->GetOutput());\n  distance->SetInputData(1, sourcePolyData);\n  distance->Update();\n\n  double distanceBeforeAlign = static_cast<vtkPointSet*>(distance->GetOutput(0))\n                                   ->GetFieldData()\n                                   ->GetArray(\"HausdorffDistance\")\n                                   ->GetComponent(0, 0);\n\n  // Get initial alignment using oriented bounding boxes.\n  AlignBoundingBoxes(sourcePolyData, tpd->GetOutput());\n\n  distance->SetInputData(0, tpd->GetOutput());\n  distance->SetInputData(1, sourcePolyData);\n  distance->Modified();\n  distance->Update();\n  double distanceAfterAlign = static_cast<vtkPointSet*>(distance->GetOutput(0))\n                                  ->GetFieldData()\n                                  ->GetArray(\"HausdorffDistance\")\n                                  ->GetComponent(0, 0);\n\n  double bestDistance = std::min(distanceBeforeAlign, distanceAfterAlign);\n\n  if (distanceAfterAlign > distanceBeforeAlign)\n  {\n    sourcePolyData->DeepCopy(originalSourcePolyData);\n  }\n\n  // Refine the alignment using IterativeClosestPoint.\n  vtkNew<vtkIterativeClosestPointTransform> icp;\n  icp->SetSource(sourcePolyData);\n  icp->SetTarget(tpd->GetOutput());\n  icp->GetLandmarkTransform()->SetModeToRigidBody();\n  icp->SetMaximumNumberOfLandmarks(100);\n  icp->SetMaximumMeanDistance(.00001);\n  icp->SetMaximumNumberOfIterations(500);\n  icp->CheckMeanDistanceOn();\n  icp->StartByMatchingCentroidsOn();\n  icp->Update();\n  auto icpMeanDistance = icp->GetMeanDistance();\n\n  //  icp->Print(std::cout);\n\n  auto lmTransform = icp->GetLandmarkTransform();\n  vtkNew<vtkTransformPolyDataFilter> transform;\n  transform->SetInputData(sourcePolyData);\n  transform->SetTransform(lmTransform);\n  transform->SetTransform(icp);\n  transform->Update();\n\n  distance->SetInputData(0, tpd->GetOutput());\n  distance->SetInputData(1, transform->GetOutput());\n  distance->Update();\n\n  // Note: If there is an error extracting eigenfunctions, then this will be\n  // zero.\n  double distanceAfterICP = static_cast<vtkPointSet*>(distance->GetOutput(0))\n                                ->GetFieldData()\n                                ->GetArray(\"HausdorffDistance\")\n                                ->GetComponent(0, 0);\n  if (!(std::isnan(icpMeanDistance) || std::isinf(icpMeanDistance)))\n  {\n    if (distanceAfterICP < bestDistance)\n    {\n      bestDistance = distanceAfterICP;\n    }\n  }\n\n  std::cout << \"Distances:\" << std::endl;\n  std::cout << \"  Before aligning:                        \"\n            << distanceBeforeAlign << std::endl;\n  std::cout << \"  Aligning using oriented bounding boxes: \"\n            << distanceAfterAlign << std::endl;\n  std::cout << \"  Aligning using IterativeClosestPoint:   \" << distanceAfterICP\n            << std::endl;\n  std::cout << \"  Best distance:                          \" << bestDistance\n            << std::endl;\n\n  // Select the source to use.\n  vtkNew<vtkDataSetMapper> sourceMapper;\n  if (bestDistance == distanceBeforeAlign)\n  {\n    sourceMapper->SetInputData(originalSourcePolyData);\n    std::cout << \"Using original alignment\" << std::endl;\n  }\n  else if (bestDistance == distanceAfterAlign)\n  {\n    sourceMapper->SetInputData(sourcePolyData);\n    std::cout << \"Using alignment by OBB\" << std::endl;\n  }\n  else\n  {\n    sourceMapper->SetInputConnection(transform->GetOutputPort());\n    std::cout << \"Using alignment by ICP\" << std::endl;\n  }\n  sourceMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> sourceActor;\n  sourceActor->SetMapper(sourceMapper);\n  sourceActor->GetProperty()->SetOpacity(0.6);\n  sourceActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"White\").GetData());\n  renderer->AddActor(sourceActor);\n\n  vtkNew<vtkDataSetMapper> targetMapper;\n  targetMapper->SetInputData(tpd->GetOutput());\n  targetMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> targetActor;\n  targetActor->SetMapper(targetMapper);\n  targetActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  renderer->AddActor(targetActor);\n\n  renderWindow->AddRenderer(renderer);\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"AlignTwoPolyDatas\");\n\n#if VTK_HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(renderer);\n  // Enable the widget.\n  camOrientManipulator->On();\n#else\n  vtkNew<vtkAxesActor> axes;\n\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  double rgba[4]{0.0, 0.0, 0.0, 0.0};\n  colors->GetColor(\"Carrot\", rgba);\n  widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n  widget->SetOrientationMarker(axes);\n  widget->SetInteractor(interactor);\n  widget->SetViewport(0.0, 0.0, 0.2, 0.2);\n  widget->EnabledOn();\n  widget->InteractiveOn();\n#endif\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\n\nstd::string ShowUsage(std::string fn)\n{\n  // Remove the folder (if present) then remove the extension in this order\n  // since the folder name may contain periods.\n  auto last_slash_idx = fn.find_last_of(\"\\\\/\");\n  if (std::string::npos != last_slash_idx)\n  {\n    fn.erase(0, last_slash_idx + 1);\n  }\n  auto period_idx = fn.rfind('.');\n  if (std::string::npos != period_idx)\n  {\n    fn.erase(period_idx);\n  }\n  std::ostringstream os;\n  os << \"\\nusage: \" << fn << \" src_fn tgt_fn\\n\\n\"\n     << \"How to align two vtkPolyData's.\\n\\n\"\n     << \"positional arguments:\\n\"\n     << \"  src_fn      The polydata source file name,e.g. \"\n        \"Grey_Nurse_Shark.stl.\\n\"\n     << \"  tgt_fn      The polydata target file name, e.g. shark.ply.\\n\"\n     << \"\\n\"\n     << std::endl;\n  return os.str();\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid AlignBoundingBoxes(vtkPolyData* source, vtkPolyData* target)\n{\n  // Use OBBTree to create an oriented bounding box for target and source\n  vtkNew<vtkOBBTree> sourceOBBTree;\n  sourceOBBTree->SetDataSet(source);\n  sourceOBBTree->SetMaxLevel(1);\n  sourceOBBTree->BuildLocator();\n\n  vtkNew<vtkOBBTree> targetOBBTree;\n  targetOBBTree->SetDataSet(target);\n  targetOBBTree->SetMaxLevel(1);\n  targetOBBTree->BuildLocator();\n\n  vtkNew<vtkPolyData> sourceLandmarks;\n  sourceOBBTree->GenerateRepresentation(0, sourceLandmarks);\n\n  vtkNew<vtkPolyData> targetLandmarks;\n  targetOBBTree->GenerateRepresentation(0, targetLandmarks);\n\n  vtkNew<vtkLandmarkTransform> lmTransform;\n  lmTransform->SetModeToSimilarity();\n  lmTransform->SetTargetLandmarks(targetLandmarks->GetPoints());\n  // vtkNew<vtkTransformPolyDataFilter> lmTransformPD;\n  double bestDistance = VTK_DOUBLE_MAX;\n  vtkNew<vtkPoints> bestPoints;\n  BestBoundingBox(\"X\", target, source, targetLandmarks, sourceLandmarks,\n                  bestDistance, bestPoints);\n  BestBoundingBox(\"Y\", target, source, targetLandmarks, sourceLandmarks,\n                  bestDistance, bestPoints);\n  BestBoundingBox(\"Z\", target, source, targetLandmarks, sourceLandmarks,\n                  bestDistance, bestPoints);\n\n  lmTransform->SetSourceLandmarks(bestPoints);\n  lmTransform->Modified();\n\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetInputData(source);\n  transformPD->SetTransform(lmTransform);\n  transformPD->Update();\n\n  source->DeepCopy(transformPD->GetOutput());\n}\nvoid BestBoundingBox(std::string const& axis, vtkPolyData* target,\n                     vtkPolyData* source, vtkPolyData* targetLandmarks,\n                     vtkPolyData* sourceLandmarks, double& bestDistance,\n                     vtkPoints* bestPoints)\n{\n  vtkNew<vtkHausdorffDistancePointSetFilter> distance;\n  vtkNew<vtkTransform> testTransform;\n  vtkNew<vtkTransformPolyDataFilter> testTransformPD;\n  vtkNew<vtkLandmarkTransform> lmTransform;\n  vtkNew<vtkTransformPolyDataFilter> lmTransformPD;\n\n  lmTransform->SetModeToSimilarity();\n  lmTransform->SetTargetLandmarks(targetLandmarks->GetPoints());\n\n  double sourceCenter[3];\n  sourceLandmarks->GetCenter(sourceCenter);\n\n  auto delta = 90.0;\n  for (auto i = 0; i < 4; ++i)\n  {\n    auto angle = delta * i;\n    // Rotate about center\n    testTransform->Identity();\n    testTransform->Translate(sourceCenter[0], sourceCenter[1], sourceCenter[2]);\n    if (axis == \"X\")\n    {\n      testTransform->RotateX(angle);\n    }\n    else if (axis == \"Y\")\n    {\n      testTransform->RotateY(angle);\n    }\n    else\n    {\n      testTransform->RotateZ(angle);\n    }\n    testTransform->Translate(-sourceCenter[0], -sourceCenter[1],\n                             -sourceCenter[2]);\n\n    testTransformPD->SetTransform(testTransform);\n    testTransformPD->SetInputData(sourceLandmarks);\n    testTransformPD->Update();\n\n    lmTransform->SetSourceLandmarks(testTransformPD->GetOutput()->GetPoints());\n    lmTransform->Modified();\n\n    lmTransformPD->SetInputData(source);\n    lmTransformPD->SetTransform(lmTransform);\n    lmTransformPD->Update();\n\n    distance->SetInputData(0, target);\n    distance->SetInputData(1, lmTransformPD->GetOutput());\n    distance->Update();\n\n    double testDistance = static_cast<vtkPointSet*>(distance->GetOutput(0))\n                              ->GetFieldData()\n                              ->GetArray(\"HausdorffDistance\")\n                              ->GetComponent(0, 0);\n    if (testDistance < bestDistance)\n    {\n      bestDistance = testDistance;\n      bestPoints->DeepCopy(testTransformPD->GetOutput()->GetPoints());\n    }\n  }\n  return;\n}\n\n} // namespace\n
"},{"location":"Cxx/PolyData/AlignTwoPolyDatas/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AlignTwoPolyDatas)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AlignTwoPolyDatas: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AlignTwoPolyDatas MACOSX_BUNDLE AlignTwoPolyDatas.cxx )\n  target_link_libraries(AlignTwoPolyDatas PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AlignTwoPolyDatas\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/AlignTwoPolyDatas/#download-and-build-aligntwopolydatas","title":"Download and Build AlignTwoPolyDatas","text":"

Click here to download AlignTwoPolyDatas and its CMakeLists.txt file. Once the tarball AlignTwoPolyDatas.tar has been downloaded and extracted,

cd AlignTwoPolyDatas/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AlignTwoPolyDatas\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/AttachAttributes/","title":"AttachAttributes","text":"

vtk-examples/Cxx/PolyData/AttachAttributes

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/AttachAttributes/#code","title":"Code","text":"

AttachAttributes.cxx

// vtk includes\n#include <vtkDoubleArray.h>\n#include <vtkInformation.h>\n#include <vtkInformationDoubleVectorKey.h>\n#include <vtkNew.h>\n\n// std includes\n#include <iostream>\n\nint main(int, char*[])\n{\n\n  // create a 2-element array\n  vtkNew<vtkDoubleArray> array;\n  array->SetName(\"array\");\n  array->SetNumberOfComponents(1);\n  array->SetNumberOfTuples(2);\n  array->SetValue(0, 1.);\n  array->SetValue(1, 2.);\n\n  // access the info (presently none stored)\n  vtkInformation* info = array->GetInformation();\n\n  // add one attribute, a double vector\n  const char* name = \"myKey\";\n  const char* location = \"MyClass\"; //\n  const int length = 3;\n  vtkInformationDoubleVectorKey* key =\n      new vtkInformationDoubleVectorKey(name, location, length);\n  double values[] = {0.1, 0.2, 0.3};\n  info->Set(key, values[0], values[1], values[2]);\n\n  // extract the key\n  double* vals = info->Get(key);\n  std::cout << \"extracted values are: \" << vals[0] << \", \" << vals[1] << \", \"\n            << vals[2] << '\\n';\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/AttachAttributes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AttachAttributes)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AttachAttributes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AttachAttributes MACOSX_BUNDLE AttachAttributes.cxx )\n  target_link_libraries(AttachAttributes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AttachAttributes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/AttachAttributes/#download-and-build-attachattributes","title":"Download and Build AttachAttributes","text":"

Click here to download AttachAttributes and its CMakeLists.txt file. Once the tarball AttachAttributes.tar has been downloaded and extracted,

cd AttachAttributes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AttachAttributes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/BooleanOperationPolyDataFilter/","title":"BooleanOperationPolyDataFilter","text":"

vtk-examples/Cxx/PolyData/BooleanOperationPolyDataFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/BooleanOperationPolyDataFilter/#description","title":"Description","text":"

The vtkBooleanOperationPolyDataFilter works best with \"clean\" data, so this examples first runs vtkTriangleFilter and then vtkCleanPolyData.

This example can be run in three ways:

  1. BooleanOperationPolyDataFilter - Computes the intersection of two spheres

  2. BooleanOperationPolyDataFilter intersection|difference|union - Computes the intersection(difference or union) of two spheres

  3. BooleanOperationPolyDataFilter input1.vtk intersection|difference|union input2.vtk - Computes the intersection(difference or union) of two vtkPolyData's

Cite

See Boolean Operations on Surfaces in VTK Without External Libraries for details on the algorithm.

Seealso

LoopBooleanPolyDataFilter, it uses an alternative algorithm to do the boolean operations.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/BooleanOperationPolyDataFilter/#code","title":"Code","text":"

BooleanOperationPolyDataFilter.cxx

#include <vtkActor.h>\n#include <vtkBooleanOperationPolyDataFilter.h>\n#include <vtkCleanPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangleFilter.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkSphereSource.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkCamera.h>\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> input1;\n  vtkSmartPointer<vtkPolyData> input2;\n\n  std::string operation(\"intersection\");\n\n  if (argc == 4)\n  {\n    auto poly1 = ReadPolyData(argv[1]);\n    vtkNew<vtkTriangleFilter> tri1;\n    tri1->SetInputData(poly1);\n    vtkNew<vtkCleanPolyData> clean1;\n    clean1->SetInputConnection(tri1->GetOutputPort());\n    clean1->Update();\n    input1 = clean1->GetOutput();\n\n    auto poly2 = ReadPolyData(argv[3]);\n    vtkNew<vtkTriangleFilter> tri2;\n    tri2->SetInputData(poly2);\n    tri2->Update();\n    vtkNew<vtkCleanPolyData> clean2;\n    clean2->SetInputConnection(tri2->GetOutputPort());\n    clean2->Update();\n    input2 = clean2->GetOutput();\n    operation = argv[2];\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource1;\n    sphereSource1->SetCenter(0.25, 0, 0);\n    sphereSource1->SetPhiResolution(21);\n    sphereSource1->SetThetaResolution(21);\n    sphereSource1->Update();\n    input1 = sphereSource1->GetOutput();\n\n    vtkNew<vtkSphereSource> sphereSource2;\n    sphereSource2->Update();\n    input2 = sphereSource2->GetOutput();\n\n    if (argc == 2)\n    {\n      operation = argv[1];\n    }\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> input1Mapper;\n  input1Mapper->SetInputData(input1);\n  input1Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> input1Actor;\n  input1Actor->SetMapper(input1Mapper);\n  input1Actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  input1Actor->GetProperty()->SetSpecular(0.6);\n  input1Actor->GetProperty()->SetSpecularPower(20);\n  input1Actor->SetPosition(input1->GetBounds()[1] - input1->GetBounds()[0], 0,\n                           0);\n  vtkNew<vtkPolyDataMapper> input2Mapper;\n  input2Mapper->SetInputData(input2);\n  input2Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> input2Actor;\n  input2Actor->SetMapper(input2Mapper);\n  input2Actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  input2Actor->GetProperty()->SetSpecular(0.6);\n  input2Actor->GetProperty()->SetSpecularPower(20);\n  input2Actor->SetPosition(-(input1->GetBounds()[1] - input1->GetBounds()[0]),\n                           0, 0);\n  vtkNew<vtkBooleanOperationPolyDataFilter> booleanOperation;\n  if (operation == \"union\")\n  {\n    booleanOperation->SetOperationToUnion();\n  }\n  else if (operation == \"intersection\")\n  {\n    booleanOperation->SetOperationToIntersection();\n  }\n  else if (operation == \"difference\")\n  {\n    booleanOperation->SetOperationToDifference();\n  }\n  else\n  {\n    std::cout << \"Unknown operation: \" << operation << std::endl;\n    return EXIT_FAILURE;\n  }\n  booleanOperation->SetInputData(0, input1);\n  booleanOperation->SetInputData(1, input2);\n\n  vtkNew<vtkPolyDataMapper> booleanOperationMapper;\n  booleanOperationMapper->SetInputConnection(booleanOperation->GetOutputPort());\n  booleanOperationMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> booleanOperationActor;\n  booleanOperationActor->SetMapper(booleanOperationMapper);\n  booleanOperationActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  booleanOperationActor->GetProperty()->SetSpecular(.6);\n  booleanOperationActor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(input1Actor);\n  renderer->AddViewProp(input2Actor);\n  renderer->AddViewProp(booleanOperationActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"BooleanOperationPolyDataFilter\");\n\n  double viewUp[3] = {0.0, 0.0, 1.0};\n  double position[3] = {0.0, -1.0, 0.0};\n  PositionCamera(renderer, viewUp, position);\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position)\n{\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  renderer->GetActiveCamera()->SetViewUp(viewUp);\n  renderer->GetActiveCamera()->SetPosition(position);\n  renderer->ResetCamera();\n  return;\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/BooleanOperationPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BooleanOperationPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BooleanOperationPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BooleanOperationPolyDataFilter MACOSX_BUNDLE BooleanOperationPolyDataFilter.cxx )\n  target_link_libraries(BooleanOperationPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BooleanOperationPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/BooleanOperationPolyDataFilter/#download-and-build-booleanoperationpolydatafilter","title":"Download and Build BooleanOperationPolyDataFilter","text":"

Click here to download BooleanOperationPolyDataFilter and its CMakeLists.txt file. Once the tarball BooleanOperationPolyDataFilter.tar has been downloaded and extracted,

cd BooleanOperationPolyDataFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BooleanOperationPolyDataFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/Casting/","title":"Casting","text":"

vtk-examples/Cxx/PolyData/Casting

"},{"location":"Cxx/PolyData/Casting/#description","title":"Description","text":"

This example creates a polydata object with 3 points and attaches a distance value to each point. To retrieve the array from the polydata, we have to use a SafeDownCast to the type that we want. This is necessary because to keep things as general as possible the polydata will return an abstract array class.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/Casting/#code","title":"Code","text":"

Casting.cxx

#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  // Create points.\n  vtkNew<vtkPoints> points;\n\n  unsigned int numberOfPoints = 3;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Add the points to a polydata\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Add distances to each point\n  vtkNew<vtkDoubleArray> distances;\n  distances->SetNumberOfComponents(1);\n  distances->SetName(\"Distances\");\n\n  distances->InsertNextValue(1.1);\n  distances->InsertNextValue(2.2);\n  distances->InsertNextValue(3.3);\n\n  polydata->GetPointData()->AddArray(distances);\n\n  // Get the distances from the polydata.\n  vtkDoubleArray* array = dynamic_cast<vtkDoubleArray*>(\n      polydata->GetPointData()->GetArray(\"Distances\"));\n\n  if (array)\n  {\n    for (unsigned int i = 0; i < numberOfPoints; i++)\n    {\n      double dist;\n      dist = array->GetValue(i);\n      std::cout << \"Distance: \" << dist << std::endl;\n    }\n  }\n\n  // Cast the double distances to ints.\n  vtkDoubleArray* doubleDistances = dynamic_cast<vtkDoubleArray*>(\n      polydata->GetPointData()->GetArray(\"Distances\"));\n  vtkIntArray* intDistances = dynamic_cast<vtkIntArray*>(doubleDistances);\n\n  if (intDistances)\n  {\n    for (unsigned int i = 0; i < numberOfPoints; i++)\n    {\n      int dist;\n      dist = intDistances->GetValue(i);\n      std::cout << \"Distance: \" << dist << std::endl;\n    }\n  }\n  else\n  {\n    std::cout << \"invalid cast.\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/Casting/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Casting)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Casting: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Casting MACOSX_BUNDLE Casting.cxx )\n  target_link_libraries(Casting PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Casting\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/Casting/#download-and-build-casting","title":"Download and Build Casting","text":"

Click here to download Casting and its CMakeLists.txt file. Once the tarball Casting.tar has been downloaded and extracted,

cd Casting/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Casting\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CellCenters/","title":"CellCenters","text":"

vtk-examples/Cxx/PolyData/CellCenters

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CellCenters/#code","title":"Code","text":"

CellCenters.cxx

#include <vtkActor.h>\n#include <vtkCellCenters.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(3, 3, 2);\n  imageData->SetSpacing(1.0, 1.0, 1.0);\n  imageData->SetOrigin(0.0, 0.0, 0.0);\n\n  vtkNew<vtkCellCenters> cellCentersFilter;\n  cellCentersFilter->SetInputData(imageData);\n  cellCentersFilter->VertexCellsOn();\n  cellCentersFilter->Update();\n\n  // Access the cell centers\n  for (vtkIdType i = 0; i < cellCentersFilter->GetOutput()->GetNumberOfPoints();\n       i++)\n  {\n    double p[3];\n    cellCentersFilter->GetOutput()->GetPoint(i, p);\n    cout << \"Point \" << i << \" : \" << p[0] << \" , \" << p[1] << \" , \" << p[2]\n         << endl;\n  }\n\n  // Display the cell centers\n  vtkNew<vtkDataSetMapper> centerMapper;\n  centerMapper->SetInputConnection(cellCentersFilter->GetOutputPort());\n  vtkNew<vtkActor> centerActor;\n  centerActor->SetMapper(centerMapper);\n  centerActor->GetProperty()->SetPointSize(5);\n  centerActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(imageData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderer> renderer;\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CellCenters\");\n\n  renderer->AddActor(actor);\n  renderer->AddActor(centerActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/CellCenters/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellCenters)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellCenters: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellCenters MACOSX_BUNDLE CellCenters.cxx )\n  target_link_libraries(CellCenters PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellCenters\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CellCenters/#download-and-build-cellcenters","title":"Download and Build CellCenters","text":"

Click here to download CellCenters and its CMakeLists.txt file. Once the tarball CellCenters.tar has been downloaded and extracted,

cd CellCenters/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellCenters\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CellCentersDemo/","title":"CellCentersDemo","text":"

vtk-examples/Cxx/PolyData/CellCentersDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CellCentersDemo/#code","title":"Code","text":"

CellCentersDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellCenters.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <algorithm>\n#include <vector>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Define the colors used in the example\n  vtkNew<vtkNamedColors> colors;\n\n  vtkColor3d actorColor = colors->GetColor3d(\"Banana\");\n  vtkColor3d pointActorColor = colors->GetColor3d(\"Peacock\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Silver\");\n\n  // Read the polydata\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  std::vector<double> bounds(6);\n  polyData->GetBounds(&bounds[0]);\n  std::vector<double> range(3);\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n\n  vtkNew<vtkCellCenters> centers;\n  centers->SetInputData(polyData);\n\n  auto maxRange = std::max_element(range.begin(), range.end());\n  double radius = 0;\n  if (argc > 1)\n  {\n    radius = *maxRange * 0.0025;\n  }\n  else\n  {\n    radius = *maxRange * 0.01;\n  }\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(11);\n  sphere->SetThetaResolution(11);\n  sphere->SetRadius(radius);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputConnection(centers->GetOutputPort());\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(pointActorColor.GetData());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(actorColor.GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->AddActor(pointActor);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n  renderer->SetBackground(backgroundColor.GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"CellCentersDemo\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/CellCentersDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellCentersDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellCentersDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellCentersDemo MACOSX_BUNDLE CellCentersDemo.cxx )\n  target_link_libraries(CellCentersDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellCentersDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CellCentersDemo/#download-and-build-cellcentersdemo","title":"Download and Build CellCentersDemo","text":"

Click here to download CellCentersDemo and its CMakeLists.txt file. Once the tarball CellCentersDemo.tar has been downloaded and extracted,

cd CellCentersDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellCentersDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CellEdgeNeighbors/","title":"CellEdgeNeighbors","text":"

vtk-examples/Cxx/PolyData/CellEdgeNeighbors

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/CellEdgeNeighbors/#description","title":"Description","text":"

Determine which cells share an edge with a specified cell.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CellEdgeNeighbors/#code","title":"Code","text":"

CellEdgeNeighbors.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdList.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n\n#include <list>\n\nint main(int, char*[])\n{\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(sphereSource->GetOutputPort());\n  triangleFilter->Update();\n\n  vtkIdType cellId = 0;\n\n  vtkNew<vtkIdList> cellPointIds;\n  triangleFilter->GetOutput()->GetCellPoints(cellId, cellPointIds);\n\n  std::list<vtkIdType> neighbors;\n\n  for (vtkIdType i = 0; i < cellPointIds->GetNumberOfIds(); i++)\n  {\n    vtkNew<vtkIdList> idList;\n\n    // Add one of the edge points.\n    idList->InsertNextId(cellPointIds->GetId(i));\n\n    // Add the other edge point\n    if (i + 1 == cellPointIds->GetNumberOfIds())\n    {\n      idList->InsertNextId(cellPointIds->GetId(0));\n    }\n    else\n    {\n      idList->InsertNextId(cellPointIds->GetId(i + 1));\n    }\n\n    // Get the neighbors of the cell.\n    vtkNew<vtkIdList> neighborCellIds;\n\n    triangleFilter->GetOutput()->GetCellNeighbors(cellId, idList,\n                                                  neighborCellIds);\n\n    for (vtkIdType j = 0; j < neighborCellIds->GetNumberOfIds(); j++)\n    {\n      neighbors.push_back(neighborCellIds->GetId(j));\n    }\n  }\n\n  std::cout << \"Edge neighbor ids are: \" << std::endl;\n\n  for (auto it1 = neighbors.begin(); it1 != neighbors.end(); ++it1)\n  {\n    std::cout << \" \" << *it1;\n  }\n  std::cout << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  sphereMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"Lamp_Black\").GetData());\n  sphereActor->GetProperty()->EdgeVisibilityOn();\n  sphereActor->GetProperty()->SetLineWidth(5);\n\n  vtkNew<vtkDataSetMapper> mainCellMapper;\n\n  vtkNew<vtkDataSetMapper> neighborCellsMapper;\n\n  // Create a dataset with the cell of interest.\n  {\n    vtkNew<vtkIdTypeArray> ids;\n    ids->SetNumberOfComponents(1);\n    ids->InsertNextValue(cellId);\n\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::CELL);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n    extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    mainCellMapper->SetInputConnection(extractSelection->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> mainCellActor;\n  mainCellActor->SetMapper(mainCellMapper);\n  mainCellActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a dataset with the neighbor cells.\n  {\n    vtkNew<vtkIdTypeArray> ids;\n    ids->SetNumberOfComponents(1);\n    for (auto it1 = neighbors.begin(); it1 != neighbors.end(); ++it1)\n    {\n      ids->InsertNextValue(*it1);\n    }\n\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::CELL);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n    extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    neighborCellsMapper->SetInputConnection(extractSelection->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> neighborCellsActor;\n  neighborCellsActor->SetMapper(neighborCellsMapper);\n  neighborCellsActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(mainCellActor);\n  renderer->AddActor(neighborCellsActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"CellEdgeNeighbors\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/CellEdgeNeighbors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellEdgeNeighbors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellEdgeNeighbors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellEdgeNeighbors MACOSX_BUNDLE CellEdgeNeighbors.cxx )\n  target_link_libraries(CellEdgeNeighbors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellEdgeNeighbors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CellEdgeNeighbors/#download-and-build-celledgeneighbors","title":"Download and Build CellEdgeNeighbors","text":"

Click here to download CellEdgeNeighbors and its CMakeLists.txt file. Once the tarball CellEdgeNeighbors.tar has been downloaded and extracted,

cd CellEdgeNeighbors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellEdgeNeighbors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CellLocator/","title":"CellLocator","text":"

vtk-examples/Cxx/PolyData/CellLocator

"},{"location":"Cxx/PolyData/CellLocator/#description","title":"Description","text":"

This example creates a sphere and then finds the closest point on the sphere to a test point.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CellLocator/#code","title":"Code","text":"

CellLocator.cxx

#include <vtkCellLocator.h>\n#include <vtkNew.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create the tree\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(sphereSource->GetOutput());\n  cellLocator->BuildLocator();\n\n  double testPoint[3] = {2.0, 0.0, 0.0};\n\n  // Find the closest points to TestPoint\n  double closestPoint[3];   // the coordinates of the closest point will be\n                            // returned here\n  double closestPointDist2; // the squared distance to the closest point will be\n                            // returned here\n  vtkIdType cellId; // the cell id of the cell containing the closest point will\n                    // be returned here\n  int subId;        // this is rarely used (in triangle strips only, I believe)\n  cellLocator->FindClosestPoint(testPoint, closestPoint, cellId, subId,\n                                closestPointDist2);\n\n  std::cout << \"Coordinates of closest point: \" << closestPoint[0] << \" \"\n            << closestPoint[1] << \" \" << closestPoint[2] << std::endl;\n  std::cout << \"Squared distance to closest point: \" << closestPointDist2\n            << std::endl;\n  std::cout << \"CellId: \" << cellId << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/CellLocator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellLocator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellLocator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellLocator MACOSX_BUNDLE CellLocator.cxx )\n  target_link_libraries(CellLocator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellLocator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CellLocator/#download-and-build-celllocator","title":"Download and Build CellLocator","text":"

Click here to download CellLocator and its CMakeLists.txt file. Once the tarball CellLocator.tar has been downloaded and extracted,

cd CellLocator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellLocator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CellLocatorVisualization/","title":"CellLocatorVisualization","text":"

vtk-examples/Cxx/PolyData/CellLocatorVisualization

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/CellLocatorVisualization/#description","title":"Description","text":"

The idea of this example is to navigate levels of a uniform spatial tree, vtkCellLocator, using a slider.

Note

It is not desirable to have CellsPerBucket set \"too small\". This is because at some point, refining a bucket will result in each cell in that bucket to also be in the bucket's children. This only wastes memory and computation. The value that is \"too small\" is dependent on the grid but in general a value between 10 and 100 should work well (the default value is 25).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CellLocatorVisualization/#code","title":"Code","text":"

CellLocatorVisualization.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCellLocator.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n\nclass vtkSliderCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  vtkSliderCallback() : CellLocator(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->CellLocator->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkCellLocator* CellLocator;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n\nvoid SetSliderColors(vtkSliderRepresentation2D* slider);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> inputSource;\n  inputSource->SetPhiResolution(10);\n  inputSource->SetThetaResolution(10);\n  inputSource->Update();\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(inputSource->GetOutputPort());\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the tree.\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(inputSource->GetOutput());\n  cellLocator->BuildLocator();\n\n  // Initialize the representation.\n  vtkNew<vtkPolyData> polydata;\n  cellLocator->GenerateRepresentation(0, polydata);\n\n  vtkNew<vtkPolyDataMapper> locatorTreeMapper;\n  locatorTreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> locatorTreeActor;\n  locatorTreeActor->SetMapper(locatorTreeMapper);\n  locatorTreeActor->GetProperty()->SetInterpolationToFlat();\n  locatorTreeActor->GetProperty()->SetRepresentationToWireframe();\n  locatorTreeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Gold\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CellLocatorVisualization\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(locatorTreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(cellLocator->GetLevel());\n  sliderRep->SetValue(0);\n  sliderRep->SetTitleText(\"MaxPointsPerRegion\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(.2, .1);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(.8, .1);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  SetSliderColors(sliderRep);\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->CellLocator = cellLocator;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid SetSliderColors(vtkSliderRepresentation2D* slider)\n{\n  vtkNew<vtkNamedColors> colors;\n  // Set color properties:\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(colors->GetColor3d(\"Peru\").GetData());\n  // Change the color of the text indicating what the slider controls.\n  slider->GetTitleProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"DeepPink\").GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(colors->GetColor3d(\"Teal\").GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(colors->GetColor3d(\"Teal\").GetData());\n}\n\n} // namespace\n
"},{"location":"Cxx/PolyData/CellLocatorVisualization/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellLocatorVisualization)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellLocatorVisualization: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellLocatorVisualization MACOSX_BUNDLE CellLocatorVisualization.cxx )\n  target_link_libraries(CellLocatorVisualization PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellLocatorVisualization\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CellLocatorVisualization/#download-and-build-celllocatorvisualization","title":"Download and Build CellLocatorVisualization","text":"

Click here to download CellLocatorVisualization and its CMakeLists.txt file. Once the tarball CellLocatorVisualization.tar has been downloaded and extracted,

cd CellLocatorVisualization/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellLocatorVisualization\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CellPointNeighbors/","title":"CellPointNeighbors","text":"

vtk-examples/Cxx/PolyData/CellPointNeighbors

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/CellPointNeighbors/#description","title":"Description","text":"

Determine which cells share at least a single point with a specified cell.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CellPointNeighbors/#code","title":"Code","text":"

CellPointNeighbors.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdList.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n\n#include <list>\n\nint main(int, char*[])\n{\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(sphereSource->GetOutputPort());\n  triangleFilter->Update();\n\n  // Find all cells connected to point 0.\n  vtkIdType cellId = 0;\n\n  vtkNew<vtkIdList> cellPointIds;\n  triangleFilter->GetOutput()->GetCellPoints(cellId, cellPointIds);\n\n  // Neighbor cells may be listed multiple times.\n  // Use std::set instead of std::list if you want a unique list of neighbors.\n  std::list<vtkIdType> neighbors;\n\n  /* For each vertex of the cell, we calculate which cells use that point.\n   So if we do this for each vertex, we have all the neighbors.\n   In the case of using \"cellPointIds\" as a parameter of \"GetCellNeighbors\",\n   we will obtain an empty set. This is because the only cell that is using that\n   set of points is the current one. That is why we have to make each vertice at\n   time.*/\n\n  for (vtkIdType i = 0; i < cellPointIds->GetNumberOfIds(); i++)\n  {\n    vtkNew<vtkIdList> idList;\n    idList->InsertNextId(cellPointIds->GetId(i));\n\n    // Get the neighbors of the cell.\n    vtkNew<vtkIdList> neighborCellIds;\n\n    triangleFilter->GetOutput()->GetCellNeighbors(cellId, idList,\n                                                  neighborCellIds);\n\n    for (vtkIdType j = 0; j < neighborCellIds->GetNumberOfIds(); j++)\n    {\n      neighbors.push_back(neighborCellIds->GetId(j));\n    }\n  }\n\n  std::cout << \"Point neighbor ids are: \" << std::endl;\n\n  for (auto it1 = neighbors.begin(); it1 != neighbors.end(); ++it1)\n  {\n    std::cout << \" \" << *it1;\n  }\n  std::cout << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  sphereMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"Lamp_Black\").GetData());\n  sphereActor->GetProperty()->EdgeVisibilityOn();\n  sphereActor->GetProperty()->SetLineWidth(3);\n\n  vtkNew<vtkDataSetMapper> mainCellMapper;\n\n  vtkNew<vtkDataSetMapper> neighborCellsMapper;\n\n  // Create a dataset with the cell of interest.\n  {\n    vtkNew<vtkIdTypeArray> ids;\n    ids->SetNumberOfComponents(1);\n    ids->InsertNextValue(cellId);\n\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::CELL);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n    extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    mainCellMapper->SetInputConnection(extractSelection->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> mainCellActor;\n  mainCellActor->SetMapper(mainCellMapper);\n  mainCellActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a dataset with the neighbor cells.\n  {\n    vtkNew<vtkIdTypeArray> ids;\n    ids->SetNumberOfComponents(1);\n    for (auto it1 = neighbors.begin(); it1 != neighbors.end(); ++it1)\n    {\n      ids->InsertNextValue(*it1);\n    }\n\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::CELL);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n    extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    neighborCellsMapper->SetInputConnection(extractSelection->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> neighborCellsActor;\n  neighborCellsActor->SetMapper(neighborCellsMapper);\n  neighborCellsActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CellPointNeighbors\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(mainCellActor);\n  renderer->AddActor(neighborCellsActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/CellPointNeighbors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellPointNeighbors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellPointNeighbors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellPointNeighbors MACOSX_BUNDLE CellPointNeighbors.cxx )\n  target_link_libraries(CellPointNeighbors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellPointNeighbors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CellPointNeighbors/#download-and-build-cellpointneighbors","title":"Download and Build CellPointNeighbors","text":"

Click here to download CellPointNeighbors and its CMakeLists.txt file. Once the tarball CellPointNeighbors.tar has been downloaded and extracted,

cd CellPointNeighbors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellPointNeighbors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CellTreeLocator/","title":"CellTreeLocator","text":"

vtk-examples/Cxx/PolyData/CellTreeLocator

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CellTreeLocator/#code","title":"Code","text":"

CellTreeLocator.cxx

#include <vtkCellTreeLocator.h>\n#include <vtkGenericCell.h>\n#include <vtkNew.h>\n#include <vtkSphereSource.h>\n\n// Note that:\n// vtkCellTreeLocator moved from vtkFiltersGeneral to vtkCommonDataModel in\n// VTK commit 4a29e6f7dd9acb460644fe487d2e80aac65f7be9\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n  sphereSource->Update();\n\n  // Create the tree.\n  vtkNew<vtkCellTreeLocator> cellTree;\n  cellTree->SetDataSet(sphereSource->GetOutput());\n  cellTree->BuildLocator();\n\n  double testInside[3] = {0.5, 0.0, 0.0};\n  double testOutside[3] = {10.0, 0.0, 0.0};\n\n  double pcoords[3], weights[3];\n\n  vtkIdType cellId;\n\n  vtkNew<vtkGenericCell> cell;\n\n  int returnValue = EXIT_SUCCESS;\n\n  // Should be inside.\n  cellId = cellTree->FindCell(testInside, 0, cell, pcoords, weights);\n  if (cellId >= 0)\n  {\n    std::cout << \"First point: in cell \" << cellId << std::endl;\n  }\n  else\n  {\n    std::cout << \"ERROR: Cell was not found but should have been.\" << std::endl;\n    returnValue = EXIT_FAILURE;\n  }\n\n  // Should be outside.\n  cellId = cellTree->FindCell(testOutside, 0, cell, pcoords, weights);\n  if (cellId >= 0)\n  {\n    std::cout << \"ERROR: Found point in cell \" << cellId\n              << \" but it should be outside the domain.\" << std::endl;\n    returnValue = EXIT_FAILURE;\n  }\n  else\n  {\n    std::cout << \"Second point: outside\" << std::endl;\n  }\n\n  return returnValue;\n}\n
"},{"location":"Cxx/PolyData/CellTreeLocator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellTreeLocator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellTreeLocator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellTreeLocator MACOSX_BUNDLE CellTreeLocator.cxx )\n  target_link_libraries(CellTreeLocator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellTreeLocator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CellTreeLocator/#download-and-build-celltreelocator","title":"Download and Build CellTreeLocator","text":"

Click here to download CellTreeLocator and its CMakeLists.txt file. Once the tarball CellTreeLocator.tar has been downloaded and extracted,

cd CellTreeLocator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellTreeLocator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CellsInsideObject/","title":"CellsInsideObject","text":"

vtk-examples/Cxx/PolyData/CellsInsideObject

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/CellsInsideObject/#description","title":"Description","text":"

This example illustrates how to extract the cells that exist inside a closed surface. It uses vtkSelectEnclosedPoints to mark points that are inside and outside the surface. vtkMultiThreshold is used to extract the three meshes into three vtkMultiBlockDataSet's. The cells completely outside are shown in crimson, completely inside are yellow and border cells are green. A translucent copy of the closed surface helps illustrate the selection process.

If two polydata datasets are provided, the example uses the second as the closed surface. If only one dataset is provided, the closed surface is generated by rotating the first dataset by 90 degrees around its Y axis.

Info

The example is run with src/Testing/Data/cow.g.

Warning

The surface that contains cells must be closed and manifold. The example does not check for this. Run ClosedSurface (C++) or (Python) to check your surface.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CellsInsideObject/#code","title":"Code","text":"

CellsInsideObject.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiThreshold.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelectEnclosedPoints.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkUnstructuredGrid.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n#include <vector>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Read the polyData's\n  auto polyData1 = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n  auto polyData = ReadPolyData(argc > 2 ? argv[2] : \"\");\n  ;\n\n  vtkSmartPointer<vtkPolyData> polyData2;\n  vtkNew<vtkTransform> transform;\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  // If only one polydata is present, generate a second polydata by\n  // rotating the orginal about its center.\n  if (argc < 3)\n  {\n    std::cout << \"Generating modified polyData1\" << std::endl;\n    double center[3];\n    polyData1->GetCenter(center);\n    transform->Translate(center[0], center[1], center[2]);\n    transform->RotateY(90.0);\n    transform->Translate(-center[0], -center[1], -center[2]);\n    transformPD->SetTransform(transform);\n    transformPD->SetInputData(polyData1);\n    transformPD->Update();\n    polyData2 = transformPD->GetOutput();\n  }\n  else\n  {\n    polyData2 = polyData;\n  }\n  // Mark points inside with 1 and outside with a 0\n  vtkNew<vtkSelectEnclosedPoints> select;\n  select->SetInputData(polyData1);\n  select->SetSurfaceData(polyData2);\n\n  // Extract three meshes, one completely inside, one completely\n  // outside and on the border between the inside and outside.\n\n  vtkNew<vtkMultiThreshold> threshold;\n  // Outside points have a 0 value in ALL points of a cell\n  int outsideId = threshold->AddBandpassIntervalSet(\n      0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, \"SelectedPoints\", 0, 1);\n  // Inside points have a 1 value in ALL points of a cell\n  int insideId = threshold->AddBandpassIntervalSet(\n      1, 1, vtkDataObject::FIELD_ASSOCIATION_POINTS, \"SelectedPoints\", 0, 1);\n  // Border points have a 0 or a 1 in at least one point of a cell\n  int borderId = threshold->AddIntervalSet(\n      0, 1, vtkMultiThreshold::OPEN, vtkMultiThreshold::OPEN,\n      vtkDataObject::FIELD_ASSOCIATION_POINTS, \"SelectedPoints\", 0, 0);\n\n  threshold->SetInputConnection(select->GetOutputPort());\n\n  // Select the intervals to be output\n  threshold->OutputSet(outsideId);\n  threshold->OutputSet(insideId);\n  threshold->OutputSet(borderId);\n  threshold->Update();\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d outsideColor = colors->GetColor3d(\"Crimson\");\n  vtkColor3d insideColor = colors->GetColor3d(\"Banana\");\n  vtkColor3d borderColor = colors->GetColor3d(\"Mint\");\n  vtkColor3d surfaceColor = colors->GetColor3d(\"Peacock\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Silver\");\n\n  // Outside\n  vtkNew<vtkDataSetMapper> outsideMapper;\n  outsideMapper->SetInputData(dynamic_cast<vtkUnstructuredGrid*>(\n      vtkMultiBlockDataSet::SafeDownCast(\n          threshold->GetOutput()->GetBlock(outsideId))\n          ->GetBlock(0)));\n  outsideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> outsideActor;\n  outsideActor->SetMapper(outsideMapper);\n  outsideActor->GetProperty()->SetDiffuseColor(outsideColor.GetData());\n  outsideActor->GetProperty()->SetSpecular(.6);\n  outsideActor->GetProperty()->SetSpecularPower(30);\n\n  // Inside\n  vtkNew<vtkDataSetMapper> insideMapper;\n  insideMapper->SetInputData(dynamic_cast<vtkUnstructuredGrid*>(\n      vtkMultiBlockDataSet::SafeDownCast(\n          threshold->GetOutput()->GetBlock(insideId))\n          ->GetBlock(0)));\n  insideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> insideActor;\n  insideActor->SetMapper(insideMapper);\n  insideActor->GetProperty()->SetDiffuseColor(insideColor.GetData());\n  insideActor->GetProperty()->SetSpecular(.6);\n  insideActor->GetProperty()->SetSpecularPower(30);\n  insideActor->GetProperty()->EdgeVisibilityOn();\n\n  // Border\n  vtkNew<vtkDataSetMapper> borderMapper;\n  borderMapper->SetInputData(dynamic_cast<vtkUnstructuredGrid*>(\n      vtkMultiBlockDataSet::SafeDownCast(\n          threshold->GetOutput()->GetBlock(borderId))\n          ->GetBlock(0)));\n  borderMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> borderActor;\n  borderActor->SetMapper(borderMapper);\n  borderActor->GetProperty()->SetDiffuseColor(borderColor.GetData());\n  borderActor->GetProperty()->SetSpecular(.6);\n  borderActor->GetProperty()->SetSpecularPower(30);\n  borderActor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkDataSetMapper> surfaceMapper;\n  surfaceMapper->SetInputData(polyData2);\n  surfaceMapper->ScalarVisibilityOff();\n\n  // Surface of object containing cell\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetDiffuseColor(surfaceColor.GetData());\n  surfaceActor->GetProperty()->SetOpacity(.1);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  renderer->AddActor(surfaceActor);\n  renderer->AddActor(outsideActor);\n  renderer->AddActor(insideActor);\n  renderer->AddActor(borderActor);\n\n  renderWindow->SetWindowName(\"CellsInsideObject\");\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/CellsInsideObject/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellsInsideObject)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellsInsideObject: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellsInsideObject MACOSX_BUNDLE CellsInsideObject.cxx )\n  target_link_libraries(CellsInsideObject PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellsInsideObject\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CellsInsideObject/#download-and-build-cellsinsideobject","title":"Download and Build CellsInsideObject","text":"

Click here to download CellsInsideObject and its CMakeLists.txt file. Once the tarball CellsInsideObject.tar has been downloaded and extracted,

cd CellsInsideObject/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CellsInsideObject\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CenterOfMass/","title":"CenterOfMass","text":"

vtk-examples/Cxx/PolyData/CenterOfMass

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CenterOfMass/#code","title":"Code","text":"

CenterOfMass.cxx

#include <vtkCenterOfMass.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\n#include <cmath>\n#include <limits>\n\nint main(int, char*[])\n{\n  // Create a point set of a square.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(1, 1, 0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Compute the center of mass.\n  vtkNew<vtkCenterOfMass> centerOfMassFilter;\n  centerOfMassFilter->SetInputData(polydata);\n  centerOfMassFilter->SetUseScalarsAsWeights(false);\n  centerOfMassFilter->Update();\n\n  double center[3];\n  centerOfMassFilter->GetCenter(center);\n\n  std::cout << \"Center of mass is \" << center[0] << \" \" << center[1] << \" \"\n            << center[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/CenterOfMass/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CenterOfMass)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CenterOfMass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CenterOfMass MACOSX_BUNDLE CenterOfMass.cxx )\n  target_link_libraries(CenterOfMass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CenterOfMass\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CenterOfMass/#download-and-build-centerofmass","title":"Download and Build CenterOfMass","text":"

Click here to download CenterOfMass and its CMakeLists.txt file. Once the tarball CenterOfMass.tar has been downloaded and extracted,

cd CenterOfMass/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CenterOfMass\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CleanPolyData/","title":"CleanPolyData","text":"

vtk-examples/Cxx/PolyData/CleanPolyData

"},{"location":"Cxx/PolyData/CleanPolyData/#description","title":"Description","text":"

When a cube is created, it has 24 vertices (4 for each face). This is done because the normal at each face is very different. Often we would want a cube to only have 8 vertices. The vtkCleanPolyData filter removes coincident points, resulting in the cube we would expect.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CleanPolyData/#code","title":"Code","text":"

CleanPolyData.cxx

#include <vtkCleanPolyData.h>\n#include <vtkCubeSource.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  std::cout << \"Input cube has \" << cubeSource->GetOutput()->GetNumberOfPoints()\n            << \" vertices.\" << std::endl;\n\n  vtkNew<vtkCleanPolyData> cleanPolyData;\n  cleanPolyData->SetInputConnection(cubeSource->GetOutputPort());\n  cleanPolyData->Update();\n\n  std::cout << \"Cleaned cube has \"\n            << cleanPolyData->GetOutput()->GetNumberOfPoints() << \" vertices.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/CleanPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CleanPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CleanPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CleanPolyData MACOSX_BUNDLE CleanPolyData.cxx )\n  target_link_libraries(CleanPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CleanPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CleanPolyData/#download-and-build-cleanpolydata","title":"Download and Build CleanPolyData","text":"

Click here to download CleanPolyData and its CMakeLists.txt file. Once the tarball CleanPolyData.tar has been downloaded and extracted,

cd CleanPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CleanPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ClosedSurface/","title":"ClosedSurface","text":"

vtk-examples/Cxx/PolyData/ClosedSurface

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ClosedSurface/#code","title":"Code","text":"

ClosedSurface.cxx

#include <vtkFeatureEdges.h>\n#include <vtkNew.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  std::string fileName = \"vtkSphereSource\";\n  if (argc > 1)\n  {\n    fileName = argv[1];\n  }\n\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(fileName.c_str());\n\n  vtkNew<vtkFeatureEdges> featureEdges;\n  featureEdges->FeatureEdgesOff();\n  featureEdges->BoundaryEdgesOn();\n  featureEdges->NonManifoldEdgesOn();\n  featureEdges->ManifoldEdgesOff();\n  featureEdges->SetInputData(polyData);\n  featureEdges->Update();\n\n  int numberOfOpenEdges = featureEdges->GetOutput()->GetNumberOfCells();\n\n  if (numberOfOpenEdges > 0)\n  {\n    std::cout << fileName << \": Surface is not closed\" << std::endl;\n  }\n  else\n  {\n    std::cout << fileName << \": Surface is closed\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/ClosedSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClosedSurface)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClosedSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClosedSurface MACOSX_BUNDLE ClosedSurface.cxx )\n  target_link_libraries(ClosedSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClosedSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ClosedSurface/#download-and-build-closedsurface","title":"Download and Build ClosedSurface","text":"

Click here to download ClosedSurface and its CMakeLists.txt file. Once the tarball ClosedSurface.tar has been downloaded and extracted,

cd ClosedSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClosedSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ColorCells/","title":"ColorCells","text":"

vtk-examples/Cxx/PolyData/ColorCells

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ColorCells/#description","title":"Description","text":"

This example shows how to assign specific colors to individual cells of a vtkPolyData using a vtkLookupTable. The vtkCellData has a vtkFloatArray that contains a scalar values.

Seealso

The example ColorCellsWithRGB creates a vtkCellData with a vtkUnsignedCharArray that contains rgb values.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ColorCells/#code","title":"Code","text":"

ColorCells.cxx

#include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <algorithm>\n\nnamespace {\nvoid RandomColors(vtkLookupTable* lut, int numberOfColors);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Provide some geometry.\n  int resolution = 3;\n  vtkNew<vtkPlaneSource> aPlane;\n  aPlane->SetXResolution(resolution);\n  aPlane->SetYResolution(resolution);\n\n  // Create cell data.\n  vtkNew<vtkFloatArray> cellData;\n  for (int i = 0; i < resolution * resolution; i++)\n  {\n    cellData->InsertNextValue(i + 1);\n  }\n\n  // Create a lookup table to map cell data to colors.\n  vtkNew<vtkLookupTable> lut;\n  int tableSize = std::max(resolution * resolution + 1, 10);\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n  RandomColors(lut, tableSize);\n\n  aPlane->Update(); // Force an update so we can set cell data.\n  aPlane->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(aPlane->GetOutputPort());\n  mapper->SetScalarRange(0, tableSize - 1);\n  mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColorCells\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid RandomColors(vtkLookupTable* lut, int numberOfColors)\n{\n  // Fill in a few known colors, the rest will be generated if needed\n  vtkNew<vtkNamedColors> colors;\n  lut->SetTableValue(0, colors->GetColor4d(\"Black\").GetData());\n  lut->SetTableValue(1, colors->GetColor4d(\"Banana\").GetData());\n  lut->SetTableValue(2, colors->GetColor4d(\"Tomato\").GetData());\n  lut->SetTableValue(3, colors->GetColor4d(\"Wheat\").GetData());\n  lut->SetTableValue(4, colors->GetColor4d(\"Lavender\").GetData());\n  lut->SetTableValue(5, colors->GetColor4d(\"Flesh\").GetData());\n  lut->SetTableValue(6, colors->GetColor4d(\"Raspberry\").GetData());\n  lut->SetTableValue(7, colors->GetColor4d(\"Salmon\").GetData());\n  lut->SetTableValue(8, colors->GetColor4d(\"Mint\").GetData());\n  lut->SetTableValue(9, colors->GetColor4d(\"Peacock\").GetData());\n\n  // If the number of colors is larger than the number of specified colors,\n  // generate some random colors.\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(4355412);\n  if (numberOfColors > 9)\n  {\n    for (auto i = 10; i < numberOfColors; ++i)\n    {\n      double r, g, b;\n      r = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      g = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      b = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      lut->SetTableValue(i, r, g, b, 1.0);\n    }\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/PolyData/ColorCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorCells MACOSX_BUNDLE ColorCells.cxx )\n  target_link_libraries(ColorCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ColorCells/#download-and-build-colorcells","title":"Download and Build ColorCells","text":"

Click here to download ColorCells and its CMakeLists.txt file. Once the tarball ColorCells.tar has been downloaded and extracted,

cd ColorCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ColorCellsWithRGB/","title":"ColorCellsWithRGB","text":"

vtk-examples/Cxx/PolyData/ColorCellsWithRGB

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ColorCellsWithRGB/#description","title":"Description","text":"

This example shows how to assign specific colors to individual cells of a vtkPolyData. This example stores the vtkCellData as rgb triples in a vtkUnsignedCharArray.

Seealso

The example ColorCells creates a vtkCellData with a vtkFloatArray that contains index values for a vtkLookupTable.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ColorCellsWithRGB/#code","title":"Code","text":"

ColorCellsWithRGB.cxx

#include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n\nint main(int, char*[])\n{\n  // Provide some geometry.\n  int resolutionX = 5;\n  int resolutionY = 3;\n\n  vtkNew<vtkPlaneSource> aPlane;\n  aPlane->SetXResolution(resolutionX);\n  aPlane->SetYResolution(resolutionY);\n  aPlane->Update();\n\n  // Create cell data.\n  vtkNew<vtkUnsignedCharArray> cellData;\n  cellData->SetNumberOfComponents(3);\n  cellData->SetNumberOfTuples(aPlane->GetOutput()->GetNumberOfCells());\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  auto min_r = 64.0;\n  auto max_r = 255.0;\n  for (int i = 0; i < aPlane->GetOutput()->GetNumberOfCells(); i++)\n  {\n    double rgb[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rgb[j] = randomSequence->GetRangeValue(min_r, max_r);\n      randomSequence->Next();\n    }\n    cellData->InsertTuple(i, rgb);\n  }\n\n  aPlane->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  // Setup actor and mapper.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(aPlane->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColorCellsWithRGB\");\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ColorCellsWithRGB/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorCellsWithRGB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorCellsWithRGB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorCellsWithRGB MACOSX_BUNDLE ColorCellsWithRGB.cxx )\n  target_link_libraries(ColorCellsWithRGB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorCellsWithRGB\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ColorCellsWithRGB/#download-and-build-colorcellswithrgb","title":"Download and Build ColorCellsWithRGB","text":"

Click here to download ColorCellsWithRGB and its CMakeLists.txt file. Once the tarball ColorCellsWithRGB.tar has been downloaded and extracted,

cd ColorCellsWithRGB/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorCellsWithRGB\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ColorDisconnectedRegions/","title":"ColorDisconnectedRegions","text":"

vtk-examples/Cxx/PolyData/ColorDisconnectedRegions

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ColorDisconnectedRegions/#code","title":"Code","text":"

ColorDisconnectedRegions.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create some spheres.\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->Update();\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(5, 0, 0);\n  sphereSource2->Update();\n\n  vtkNew<vtkSphereSource> sphereSource3;\n  sphereSource3->SetCenter(10, 0, 0);\n  sphereSource3->Update();\n\n  vtkNew<vtkAppendPolyData> appendFilter;\n  appendFilter->AddInputConnection(sphereSource1->GetOutputPort());\n  appendFilter->AddInputConnection(sphereSource2->GetOutputPort());\n  appendFilter->AddInputConnection(sphereSource3->GetOutputPort());\n  appendFilter->Update();\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputConnection(appendFilter->GetOutputPort());\n  connectivityFilter->SetExtractionModeToAllRegions();\n  connectivityFilter->ColorRegionsOn();\n  connectivityFilter->Update();\n\n  // Visualize.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(connectivityFilter->GetOutputPort());\n  mapper->SetScalarRange(connectivityFilter->GetOutput()\n                             ->GetPointData()\n                             ->GetArray(\"RegionId\")\n                             ->GetRange());\n  mapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ColorDisconnectedRegions\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ColorDisconnectedRegions/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorDisconnectedRegions)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorDisconnectedRegions: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorDisconnectedRegions MACOSX_BUNDLE ColorDisconnectedRegions.cxx )\n  target_link_libraries(ColorDisconnectedRegions PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorDisconnectedRegions\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ColorDisconnectedRegions/#download-and-build-colordisconnectedregions","title":"Download and Build ColorDisconnectedRegions","text":"

Click here to download ColorDisconnectedRegions and its CMakeLists.txt file. Once the tarball ColorDisconnectedRegions.tar has been downloaded and extracted,

cd ColorDisconnectedRegions/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorDisconnectedRegions\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ColorDisconnectedRegionsDemo/","title":"ColorDisconnectedRegionsDemo","text":"

vtk-examples/Cxx/PolyData/ColorDisconnectedRegionsDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ColorDisconnectedRegionsDemo/#code","title":"Code","text":"

ColorDisconnectedRegionsDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n// #include <random>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\nvoid RandomColors(vtkLookupTable* lut, int numberOfColors);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputData(polyData);\n  connectivityFilter->SetExtractionModeToAllRegions();\n  connectivityFilter->ColorRegionsOn();\n  connectivityFilter->Update();\n\n  // Visualize.\n  auto numberOfRegions = connectivityFilter->GetNumberOfExtractedRegions();\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(std::max(numberOfRegions, 10));\n  lut->Build();\n  RandomColors(lut, numberOfRegions);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(connectivityFilter->GetOutputPort());\n  mapper->SetScalarRange(connectivityFilter->GetOutput()\n                             ->GetPointData()\n                             ->GetArray(\"RegionId\")\n                             ->GetRange());\n  mapper->SetLookupTable(lut);\n  mapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  // Create a useful view.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.2);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ColorDisconnectedRegions\");\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetInteractorStyle(style);\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid RandomColors(vtkLookupTable* lut, int numberOfColors)\n{\n  // Fill in a few known colors, the rest will be generated if needed.\n  vtkNew<vtkNamedColors> colors;\n  lut->SetTableValue(0, colors->GetColor4d(\"Gold\").GetData());\n  lut->SetTableValue(1, colors->GetColor4d(\"Banana\").GetData());\n  lut->SetTableValue(2, colors->GetColor4d(\"Tomato\").GetData());\n  lut->SetTableValue(3, colors->GetColor4d(\"Wheat\").GetData());\n  lut->SetTableValue(4, colors->GetColor4d(\"Lavender\").GetData());\n  lut->SetTableValue(5, colors->GetColor4d(\"Flesh\").GetData());\n  lut->SetTableValue(6, colors->GetColor4d(\"Raspberry\").GetData());\n  lut->SetTableValue(7, colors->GetColor4d(\"Salmon\").GetData());\n  lut->SetTableValue(8, colors->GetColor4d(\"Mint\").GetData());\n  lut->SetTableValue(9, colors->GetColor4d(\"Peacock\").GetData());\n\n  // If the number of colors is larger than the number of specified colors,\n  // generate some random colors.\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(4355412);\n  if (numberOfColors > 9)\n  {\n    for (auto i = 10; i < numberOfColors; ++i)\n    {\n      double r, g, b;\n      r = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      g = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      b = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      lut->SetTableValue(i, r, g, b, 1.0);\n    }\n  }\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/ColorDisconnectedRegionsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorDisconnectedRegionsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorDisconnectedRegionsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorDisconnectedRegionsDemo MACOSX_BUNDLE ColorDisconnectedRegionsDemo.cxx )\n  target_link_libraries(ColorDisconnectedRegionsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorDisconnectedRegionsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ColorDisconnectedRegionsDemo/#download-and-build-colordisconnectedregionsdemo","title":"Download and Build ColorDisconnectedRegionsDemo","text":"

Click here to download ColorDisconnectedRegionsDemo and its CMakeLists.txt file. Once the tarball ColorDisconnectedRegionsDemo.tar has been downloaded and extracted,

cd ColorDisconnectedRegionsDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorDisconnectedRegionsDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ColoredPoints/","title":"ColoredPoints","text":"

vtk-examples/Cxx/PolyData/ColoredPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ColoredPoints/#code","title":"Code","text":"

ColoredPoints.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <vtkNamedColors.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  vtkNew<vtkPolyData> pointsPolydata;\n\n  pointsPolydata->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> vertexFilter;\n  vertexFilter->SetInputData(pointsPolydata);\n  vertexFilter->Update();\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->ShallowCopy(vertexFilter->GetOutput());\n\n  // Setup colors\n  vtkNew<vtkNamedColors> namedColors;\n\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"Tomato\").GetData());\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"Mint\").GetData());\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"Peacock\").GetData());\n\n  polydata->GetPointData()->SetScalars(colors);\n\n  // Visualization\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(10);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColoredPoints\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"Burlywood\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ColoredPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColoredPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColoredPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColoredPoints MACOSX_BUNDLE ColoredPoints.cxx )\n  target_link_libraries(ColoredPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColoredPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ColoredPoints/#download-and-build-coloredpoints","title":"Download and Build ColoredPoints","text":"

Click here to download ColoredPoints and its CMakeLists.txt file. Once the tarball ColoredPoints.tar has been downloaded and extracted,

cd ColoredPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColoredPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CombineImportedActors/","title":"CombineImportedActors","text":"

vtk-examples/Cxx/PolyData/CombineImportedActors

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CombineImportedActors/#code","title":"Code","text":"

CombineImportedActors.cxx

// Importers\n#include <vtk3DSImporter.h>\n#include <vtkGLTFImporter.h>\n#include <vtkOBJImporter.h>\n#include <vtkVRMLImporter.h>\n\n// Rendering\n#include <vtkActorCollection.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Pipeline\n#include <vtkAppendPolyData.h>\n#include <vtkCellData.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkUnsignedCharArray.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkRenderWindow> importRenderWindow;\n  vtkSmartPointer<vtkRenderer> importRenderer;\n\n  if (argc < 2)\n  {\n    std::cerr << \"Need a file e.g. iflamingo.3ds\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n  std::string extension = \"\";\n  int filePrefixArgOffset = 0; // Depends on importer.\n\n  // Make the extension lowercase.\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\") + 1);\n  }\n  if (extension == \"wrl\")\n  {\n    vtkNew<vtkVRMLImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(importRenderWindow);\n    importRenderWindow = importer->GetRenderWindow();\n    importer->Read();\n    importRenderer = importer->GetRenderer();\n    // filePrefixArgOffset = 2;\n  }\n  else if (extension == \"3ds\")\n  {\n    vtkNew<vtk3DSImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(importRenderWindow);\n    importRenderWindow = importer->GetRenderWindow();\n    importer->Read();\n    importRenderer = importer->GetRenderer();\n    // filePrefixArgOffset = 2;\n  }\n  else if (extension == \"gltf\" || extension == \"glb\")\n  {\n    vtkNew<vtkGLTFImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(importRenderWindow);\n    importRenderWindow = importer->GetRenderWindow();\n    importer->Read();\n    importRenderer = importer->GetRenderer();\n    // filePrefixArgOffset = 2;\n  }\n  else if (extension == \"obj\")\n  {\n    vtkNew<vtkOBJImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetFileNameMTL(argv[2]);\n    importer->SetTexturePath(argv[3]);\n    importer->SetRenderWindow(importRenderWindow);\n    importRenderWindow = importer->GetRenderWindow();\n    importer->Read();\n    importRenderer = importer->GetRenderer();\n    // filePrefixArgOffset = 4;\n  }\n  vtkNew<vtkAppendPolyData> append;\n  vtkActorCollection* allActors = importRenderer->GetActors();\n  vtkCollectionSimpleIterator actorsIt;\n  vtkActor* anActor = nullptr;\n  ;\n  allActors->InitTraversal(actorsIt);\n  while ((anActor = allActors->GetNextActor(actorsIt)))\n  {\n    vtkNew<vtkPolyData> appendPD;\n    vtkPolyData* pd;\n    anActor->GetMapper()->Update();\n    if (anActor->GetUserMatrix() != nullptr)\n    {\n      vtkNew<vtkTransform> transform;\n      transform->SetMatrix(anActor->GetUserMatrix());\n      vtkNew<vtkTransformPolyDataFilter> transformPD;\n      transformPD->SetTransform(transform);\n      transformPD->SetInputData(\n          dynamic_cast<vtkPolyData*>(anActor->GetMapper()->GetInput()));\n      transformPD->Update();\n      appendPD->DeepCopy(transformPD->GetOutput());\n    }\n    else\n    {\n      pd = dynamic_cast<vtkPolyData*>(anActor->GetMapper()->GetInput());\n      appendPD->DeepCopy(pd);\n    }\n    vtkNew<vtkUnsignedCharArray> cellData;\n    cellData->SetNumberOfComponents(3);\n    cellData->SetNumberOfTuples(appendPD->GetNumberOfCells());\n    for (int i = 0; i < appendPD->GetNumberOfCells(); i++)\n    {\n      double rgb[4];\n      anActor->GetProperty()->GetDiffuseColor(rgb);\n      for (int j = 0; j < 4; ++j)\n      {\n        rgb[j] *= 255.0;\n      }\n      cellData->InsertTuple(i, rgb);\n    }\n    appendPD->GetCellData()->SetScalars(cellData);\n\n    append->AddInputData(appendPD);\n  }\n  append->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(append->GetOutput());\n  mapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"CombineImportedActors\");\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  // renderer->SetActiveCamera(importRenderer->GetActiveCamera());\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-7, 34, 2);\n  camera->SetViewUp(0, 0, 1);\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/CombineImportedActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CombineImportedActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CombineImportedActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CombineImportedActors MACOSX_BUNDLE CombineImportedActors.cxx )\n  target_link_libraries(CombineImportedActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CombineImportedActors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CombineImportedActors/#download-and-build-combineimportedactors","title":"Download and Build CombineImportedActors","text":"

Click here to download CombineImportedActors and its CMakeLists.txt file. Once the tarball CombineImportedActors.tar has been downloaded and extracted,

cd CombineImportedActors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CombineImportedActors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ContoursToSurface/","title":"ContoursToSurface","text":"

vtk-examples/Cxx/PolyData/ContoursToSurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ContoursToSurface/#description","title":"Description","text":"

This example creates a stack of 21 circles and creates a closed surface from them.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ContoursToSurface/#code","title":"Code","text":"

ContoursToSurface.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCellArray.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVoxelContoursToSurfaceFilter.h>\n\nnamespace {\nvoid CreateCircle(const double& z, const double& radius, const int& resolution,\n                  vtkPolyData* polyData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the data: a series of discs representing the intersections of x-y\n  // planes through a unit sphere centered at 0, 0, 0\n  //\n  int numDivisions = 20;\n  int resolution = 100;\n  double lastz = 0.0;\n  double z = 0.0;\n  // double radius = 0.0;\n  double sphereRadius = 1.0;\n  double zmin = -0.9 * sphereRadius;\n  double zmax = 0.9 * sphereRadius;\n\n  // Append all the discs into one polydata\n  //\n  vtkNew<vtkAppendPolyData> appendFilter;\n\n  for (int i = 0; i <= numDivisions; ++i)\n  {\n    lastz = z;\n    double u = i / double(numDivisions);\n    z = (1. - u) * zmin + u * zmax;\n    auto radius = sqrt(sphereRadius * sphereRadius - z * z);\n    vtkNew<vtkPolyData> circle;\n    CreateCircle(z, radius, resolution, circle);\n    appendFilter->AddInputData(circle);\n  }\n\n  double deltaz = z - lastz;\n\n  if (!appendFilter->GetNumberOfInputConnections(0))\n  {\n    cerr << \"error, no contours!\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  appendFilter->Update();\n\n  // Convert to ijk coordinates for the contour to surface filter\n  //\n  double bounds[6];\n  vtkPolyData* contours = appendFilter->GetOutput();\n  contours->GetBounds(bounds);\n  double origin[3] = {bounds[0], bounds[2], bounds[4]};\n  double spacing[3] = {(bounds[1] - bounds[0]) / 40,\n                       (bounds[3] - bounds[2]) / 40, deltaz};\n\n  vtkNew<vtkPolyData> poly;\n  vtkNew<vtkPoints> points;\n  vtkPoints* contourPoints = contours->GetPoints();\n  int numPoints = contourPoints->GetNumberOfPoints();\n  points->SetNumberOfPoints(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    double pt[3];\n    contourPoints->GetPoint(i, pt);\n    pt[0] = static_cast<int>((pt[0] - origin[0]) / spacing[0] + 0.5);\n    pt[1] = static_cast<int>((pt[1] - origin[1]) / spacing[1] + 0.5);\n    pt[2] = static_cast<int>((pt[2] - origin[2]) / spacing[2] + 0.5);\n    points->SetPoint(i, pt);\n  }\n  poly->SetPolys(contours->GetPolys());\n  poly->SetPoints(points);\n\n  // Create the contour to surface filter\n  //\n  vtkNew<vtkVoxelContoursToSurfaceFilter> contoursToSurface;\n  contoursToSurface->SetInputData(poly);\n  contoursToSurface->SetSpacing(spacing[0], spacing[1], spacing[2]);\n  contoursToSurface->Update();\n\n  // Rescale the output back into world coordinates and center it\n  //\n  double scaleCenter[3];\n  contoursToSurface->GetOutput()->GetCenter(scaleCenter);\n  double scaleBounds[6];\n  contoursToSurface->GetOutput()->GetBounds(scaleBounds);\n  double center[3];\n  contours->GetCenter(center);\n\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(contoursToSurface->GetOutputPort());\n  vtkNew<vtkTransform> transform;\n  transformFilter->SetTransform(transform);\n  transform->Translate(-scaleCenter[0], -scaleCenter[1], -scaleCenter[2]);\n  transform->Scale((bounds[1] - bounds[0]) / (scaleBounds[1] - scaleBounds[0]),\n                   (bounds[3] - bounds[2]) / (scaleBounds[3] - scaleBounds[2]),\n                   (bounds[5] - bounds[4]) / (scaleBounds[5] - scaleBounds[4]));\n  transform->Translate(center[0], center[1], center[2]);\n\n  // Visualize the contours\n  //\n  vtkNew<vtkPolyDataMapper> contoursMapper;\n  contoursMapper->SetInputData(contours);\n  contoursMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> contoursActor;\n  contoursActor->SetMapper(contoursMapper);\n  contoursActor->GetProperty()->SetRepresentationToWireframe();\n  contoursActor->GetProperty()->ShadingOff();\n  contoursActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize the surface\n  //\n  vtkNew<vtkPolyDataMapper> surfaceMapper;\n  surfaceMapper->SetInputConnection(transformFilter->GetOutputPort());\n  surfaceMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetRepresentationToWireframe();\n  surfaceActor->GetProperty()->ShadingOff();\n  surfaceActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create two renderers side by side to show the contours and the surface\n  // separately\n  //\n  std::cout << \"Press 't' for trackball interaction\" << std::endl;\n  std::cout << \"Press 'r' to reset the camera\" << std::endl;\n  std::cout << \"Press 'w' for wireframe representation\" << std::endl;\n  std::cout << \"Press 's' for surface representation\" << std::endl;\n\n  vtkNew<vtkRenderer> renderer1;\n  renderer1->SetViewport(0., 0., 0.5, 1.);\n  renderer1->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  vtkNew<vtkRenderer> renderer2;\n  renderer2->SetViewport(0.5, 0., 1., 1.);\n  renderer2->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(800, 400);\n  renderWindow->SetWindowName(\"ContoursToSurface\");\n\n  renderWindow->AddRenderer(renderer1);\n  renderWindow->AddRenderer(renderer2);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer1->AddViewProp(surfaceActor);\n  renderer2->AddViewProp(contoursActor);\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateCircle(const double& z, const double& radius, const int& resolution,\n                  vtkPolyData* polyData)\n{\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> cells;\n\n  points->SetNumberOfPoints(resolution);\n  cells->Allocate(1, resolution);\n  cells->InsertNextCell(resolution);\n\n  for (int i = 0; i < resolution; ++i)\n  {\n    double theta = vtkMath::RadiansFromDegrees(360. * i / double(resolution));\n    double x = radius * cos(theta);\n    double y = radius * sin(theta);\n    points->SetPoint(i, x, y, z);\n    cells->InsertCellPoint(i);\n  }\n\n  polyData->Initialize();\n  polyData->SetPolys(cells);\n  polyData->SetPoints(points);\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/ContoursToSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ContoursToSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ContoursToSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ContoursToSurface MACOSX_BUNDLE ContoursToSurface.cxx )\n  target_link_libraries(ContoursToSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ContoursToSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ContoursToSurface/#download-and-build-contourstosurface","title":"Download and Build ContoursToSurface","text":"

Click here to download ContoursToSurface and its CMakeLists.txt file. Once the tarball ContoursToSurface.tar has been downloaded and extracted,

cd ContoursToSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ContoursToSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ConvexHull/","title":"ConvexHull","text":"

vtk-examples/Cxx/PolyData/ConvexHull

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ConvexHull/#code","title":"Code","text":"

ConvexHull.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkHull.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required arguments: Filename e.g. cowHead.vtp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkHull> hullFilter;\n  hullFilter->SetInputConnection(reader->GetOutputPort());\n  hullFilter->AddCubeFacePlanes();\n  hullFilter->AddRecursiveSpherePlanes(5);\n\n  vtkNew<vtkDataSetMapper> originalMapper;\n  originalMapper->SetInputConnection(reader->GetOutputPort());\n  originalMapper->ScalarVisibilityOff();\n\n  // Create an actor for the surface.\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(hullFilter->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the surface.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->SetOpacity(0.5);\n  actor->GetProperty()->EdgeVisibilityOff();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ConvexHull\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(originalActor);\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ConvexHull/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConvexHull)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConvexHull: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConvexHull MACOSX_BUNDLE ConvexHull.cxx )\n  target_link_libraries(ConvexHull PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConvexHull\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ConvexHull/#download-and-build-convexhull","title":"Download and Build ConvexHull","text":"

Click here to download ConvexHull and its CMakeLists.txt file. Once the tarball ConvexHull.tar has been downloaded and extracted,

cd ConvexHull/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConvexHull\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ConvexHullShrinkWrap/","title":"ConvexHullShrinkWrap","text":"

vtk-examples/Cxx/PolyData/ConvexHullShrinkWrap

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ConvexHullShrinkWrap/#description","title":"Description","text":"

This example creates a point cloud, and a sphere larger than the point cloud which fully contains the cloud. It then \"shrink wraps\" the sphere onto the points. This produces an approximation of a convex hull.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ConvexHullShrinkWrap/#code","title":"Code","text":"

ConvexHullShrinkWrap.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmoothPolyDataFilter.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(10);\n  sphereSource->SetPhiResolution(50);\n  sphereSource->SetThetaResolution(50);\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(60);\n  pointSource->SetRadius(2);\n\n  vtkNew<vtkSmoothPolyDataFilter> smoothFilter;\n  smoothFilter->SetInputConnection(0, sphereSource->GetOutputPort());\n  smoothFilter->SetInputConnection(1, pointSource->GetOutputPort());\n\n  vtkNew<vtkSphereSource> glyphSource;\n  glyphSource->SetRadius(.04);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputConnection(pointSource->GetOutputPort());\n  glyph3D->SetSourceConnection(glyphSource->GetOutputPort());\n  glyph3D->ScalingOff();\n\n  vtkNew<vtkDataSetMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n  glyph3DMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(smoothFilter->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the surface.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->SetOpacity(1.0);\n  actor->GetProperty()->EdgeVisibilityOff();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ConvexHullShrinkWrap\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyph3DActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ConvexHullShrinkWrap/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConvexHullShrinkWrap)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConvexHullShrinkWrap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConvexHullShrinkWrap MACOSX_BUNDLE ConvexHullShrinkWrap.cxx )\n  target_link_libraries(ConvexHullShrinkWrap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConvexHullShrinkWrap\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ConvexHullShrinkWrap/#download-and-build-convexhullshrinkwrap","title":"Download and Build ConvexHullShrinkWrap","text":"

Click here to download ConvexHullShrinkWrap and its CMakeLists.txt file. Once the tarball ConvexHullShrinkWrap.tar has been downloaded and extracted,

cd ConvexHullShrinkWrap/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConvexHullShrinkWrap\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CopyAllArrays/","title":"CopyAllArrays","text":"

vtk-examples/Cxx/PolyData/CopyAllArrays

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CopyAllArrays/#code","title":"Code","text":"

CopyAllArrays.cxx

#include <vtkDoubleArray.h>\n#include <vtkFloatArray.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid ManualMethod(vtkPolyData* input);\nvoid AutomaticMethod(vtkPolyData* input);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkPolyData* polydata = sphereSource->GetOutput();\n\n  vtkNew<vtkDoubleArray> doubles;\n  doubles->SetName(\"Doubles\");\n  doubles->SetNumberOfTuples(polydata->GetNumberOfPoints());\n\n  polydata->GetPointData()->AddArray(doubles);\n\n  vtkNew<vtkIntArray> ints;\n  ints->SetName(\"Ints\");\n  ints->SetNumberOfTuples(polydata->GetNumberOfPoints());\n\n  polydata->GetPointData()->AddArray(ints);\n\n  ManualMethod(polydata);\n  AutomaticMethod(polydata);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid ManualMethod(vtkPolyData* input)\n{\n  unsigned int numberOfArrays = input->GetPointData()->GetNumberOfArrays();\n  std::cout << \"There are \" << numberOfArrays << \" arrays.\" << std::endl;\n\n  vtkNew<vtkPolyData> newPolyData;\n\n  for (unsigned int i = 0; i < numberOfArrays; i++)\n  {\n    std::cout << \"array \" << i << \":\" << std::endl;\n    std::cout << \"name: \" << input->GetPointData()->GetArrayName(i)\n              << std::endl;\n    std::cout << \"type: \" << input->GetPointData()->GetArray(i)->GetDataType()\n              << std::endl;\n    std::cout << std::endl;\n\n    newPolyData->GetPointData()->AddArray(input->GetPointData()->GetArray(i));\n  }\n\n  std::cout << \"new polydata: \" << std::endl;\n\n  for (unsigned int i = 0; i < numberOfArrays; i++)\n  {\n    std::cout << \"array \" << i << \":\" << std::endl;\n    std::cout << \"name: \" << newPolyData->GetPointData()->GetArrayName(i)\n              << std::endl;\n    std::cout << \"type: \"\n              << newPolyData->GetPointData()->GetArray(i)->GetDataType()\n              << std::endl;\n    std::cout << std::endl;\n  }\n}\n\nvoid AutomaticMethod(vtkPolyData* input)\n{\n  unsigned int numberOfArrays = input->GetPointData()->GetNumberOfArrays();\n  std::cout << \"There are \" << numberOfArrays << \" arrays.\" << std::endl;\n\n  vtkNew<vtkPolyData> newPolyData;\n\n  newPolyData->GetPointData()->PassData(input->GetPointData());\n\n  for (unsigned int i = 0; i < numberOfArrays; i++)\n  {\n    std::cout << \"array \" << i << \":\" << std::endl;\n    std::cout << \"name: \" << input->GetPointData()->GetArrayName(i)\n              << std::endl;\n    std::cout << \"type: \" << input->GetPointData()->GetArray(i)->GetDataType()\n              << std::endl;\n    std::cout << std::endl;\n  }\n\n  std::cout << \"new polydata: \" << std::endl;\n\n  for (unsigned int i = 0; i < numberOfArrays; i++)\n  {\n    std::cout << \"array \" << i << \":\" << std::endl;\n    std::cout << \"name: \" << newPolyData->GetPointData()->GetArrayName(i)\n              << std::endl;\n    std::cout << \"type: \"\n              << newPolyData->GetPointData()->GetArray(i)->GetDataType()\n              << std::endl;\n    std::cout << std::endl;\n  }\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/CopyAllArrays/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CopyAllArrays)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CopyAllArrays: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CopyAllArrays MACOSX_BUNDLE CopyAllArrays.cxx )\n  target_link_libraries(CopyAllArrays PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CopyAllArrays\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CopyAllArrays/#download-and-build-copyallarrays","title":"Download and Build CopyAllArrays","text":"

Click here to download CopyAllArrays and its CMakeLists.txt file. Once the tarball CopyAllArrays.tar has been downloaded and extracted,

cd CopyAllArrays/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CopyAllArrays\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/Curvatures/","title":"Curvatures","text":"

vtk-examples/Cxx/PolyData/Curvatures

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/Curvatures/#code","title":"Code","text":"

Curvatures.cxx

#include <vtkActor.h>\n#include <vtkCameraOrientationWidget.h>\n#include <vtkColorSeries.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkCurvatures.h>\n#include <vtkFeatureEdges.h>\n#include <vtkIdFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkVersion.h>\n#include <vtkXMLPolyDataReader.h>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\n#include <array>\n#include <numeric>\n#include <set>\n\nnamespace {\n\n//! Adjust curvatures along the edges of the surface.\n/*!\n * This function adjusts curvatures along the edges of the surface by replacing\n *  the value with the average value of the curvatures of points in the\n *  neighborhood.\n *\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param epsilon: Curvature values less than this will be set to zero.\n * @return\n */\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon = 1.0e-08);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse command line arguments\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtp) e.g. cowHead.vtp m 16\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Defaults\n  auto scheme = 16;\n  std::string curvature{\"Mean_Curvature\"};\n  if (argc > 2)\n  {\n    std::string tmp = argv[2];\n    if (tmp[0] == 'g' || tmp[0] == 'G')\n    {\n      curvature = \"Gauss_Curvature\";\n    }\n    else\n    {\n      if (tmp[0] == 'm' || tmp[0] == 'm')\n      {\n        curvature = \"Mean_Curvature\";\n      }\n      else\n      {\n        std::cerr << \"Curvature must be either gaussian or mean.\" << std::endl;\n        return EXIT_FAILURE;\n      }\n    }\n  }\n\n  if (argc > 3)\n  {\n    scheme = atoi(argv[3]);\n  }\n\n  // Create a polydata.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  auto source = reader->GetOutput();\n\n  vtkNew<vtkCurvatures> cc;\n  cc->SetInputData(source);\n  if (curvature == \"Gauss_Curvature\")\n  {\n    cc->SetCurvatureTypeToGaussian();\n    cc->Update();\n  }\n  else\n  {\n    if (curvature == \"Mean_Curvature\")\n    {\n      cc->SetCurvatureTypeToMean();\n      cc->Update();\n    }\n    else\n    {\n      std::cerr << \"Unknown curvature\" << std::endl;\n      return EXIT_FAILURE;\n    }\n  }\n  AdjustEdgeCurvatures(cc->GetOutput(), curvature);\n  source->GetPointData()->AddArray(\n      cc->GetOutput()->GetPointData()->GetAbstractArray(curvature.c_str()));\n\n  auto scalarRange =\n      source->GetPointData()->GetScalars(curvature.c_str())->GetRange();\n\n  auto curvatureTitle = curvature;\n  std::replace(curvatureTitle.begin(), curvatureTitle.end(), '_', '\\n');\n\n  // Build a lookup table.\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(scheme);\n  std::cout << \"Using color scheme #: \" << colorSeries->GetColorScheme() << \", \"\n            << colorSeries->GetColorSchemeName() << std::endl;\n\n  vtkNew<vtkColorTransferFunction> lut;\n  lut->SetColorSpaceToHSV();\n\n  // Use a color series to create a transfer function.\n  auto numColors = colorSeries->GetNumberOfColors();\n  for (int i = 0; i < numColors; i++)\n  {\n    vtkColor3ub color = colorSeries->GetColor(i);\n    double dColor[3];\n    dColor[0] = static_cast<double>(color[0]) / 255.0;\n    dColor[1] = static_cast<double>(color[1]) / 255.0;\n    dColor[2] = static_cast<double>(color[2]) / 255.0;\n    double t = scalarRange[0] +\n        (scalarRange[1] - scalarRange[0]) /\n            (static_cast<double>(numColors) - 1) * i;\n    lut->AddRGBPoint(t, dColor[0], dColor[1], dColor[2]);\n  }\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(source);\n  mapper->SetScalarModeToUsePointFieldData();\n  mapper->SelectColorArray(curvature.c_str());\n  mapper->SetScalarRange(scalarRange);\n  mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  auto windowWidth = 800;\n  auto windowHeight = 800;\n\n  // Create a scalar bar.\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(mapper->GetLookupTable());\n  scalarBar->SetTitle(curvatureTitle.c_str());\n  scalarBar->UnconstrainedFontSizeOn();\n  scalarBar->SetNumberOfLabels(5);\n  scalarBar->SetMaximumWidthInPixels(windowWidth / 8);\n  scalarBar->SetMaximumHeightInPixels(windowHeight / 3);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(windowWidth, windowHeight);\n  renWin->SetWindowName(\"Curvatures\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n  // Important: The interactor must be set prior to enabling the widget.\n  iRen->SetRenderWindow(renWin);\n\n#ifdef HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(renderer);\n  // Enable the widget.\n  camOrientManipulator->On();\n#endif\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor2D(scalarBar);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact.\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon)\n{\n  auto PointNeighbourhood =\n      [&source](vtkIdType const& pId) -> std::set<vtkIdType> {\n    // Extract the topological neighbors for point pId. In two steps:\n    //  1) source->GetPointCells(pId, cellIds)\n    //  2) source->GetCellPoints(cellId, cellPointIds) for all cellId in cellIds\n    vtkNew<vtkIdList> cellIds;\n    source->GetPointCells(pId, cellIds);\n    std::set<vtkIdType> neighbours;\n    for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); ++i)\n    {\n      auto cellId = cellIds->GetId(i);\n      vtkNew<vtkIdList> cellPointIds;\n      source->GetCellPoints(cellId, cellPointIds);\n      for (vtkIdType j = 0; j < cellPointIds->GetNumberOfIds(); ++j)\n      {\n        neighbours.insert(cellPointIds->GetId(j));\n      }\n    }\n    return neighbours;\n  };\n\n  auto ComputeDistance = [&source](vtkIdType const& ptIdA,\n                                   vtkIdType const& ptIdB) {\n    std::array<double, 3> ptA{0.0, 0.0, 0.0};\n    std::array<double, 3> ptB{0.0, 0.0, 0.0};\n    std::array<double, 3> ptC{0.0, 0.0, 0.0};\n    source->GetPoint(ptIdA, ptA.data());\n    source->GetPoint(ptIdB, ptB.data());\n    std::transform(std::begin(ptA), std::end(ptA), std::begin(ptB),\n                   std::begin(ptC), std::minus<double>());\n    // Calculate the norm.\n    auto result = std::sqrt(std::inner_product(std::begin(ptC), std::end(ptC),\n                                               std::begin(ptC), 0.0));\n    return result;\n  };\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n\n  // Get the boundary point IDs.\n  std::string name = \"Ids\";\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputData(source);\n  idFilter->SetPointIds(true);\n  idFilter->SetCellIds(false);\n  idFilter->SetPointIdsArrayName(name.c_str());\n  idFilter->SetCellIdsArrayName(name.c_str());\n  idFilter->Update();\n\n  vtkNew<vtkFeatureEdges> edges;\n\n  edges->SetInputConnection(idFilter->GetOutputPort());\n  edges->BoundaryEdgesOn();\n  edges->ManifoldEdgesOff();\n  edges->NonManifoldEdgesOff();\n  edges->FeatureEdgesOff();\n  edges->Update();\n\n  auto edgeAarray =\n      edges->GetOutput()->GetPointData()->GetAbstractArray(name.c_str());\n  std::vector<vtkIdType> boundaryIds;\n  for (vtkIdType i = 0; i < edges->GetOutput()->GetNumberOfPoints(); ++i)\n  {\n    boundaryIds.push_back(edgeAarray->GetVariantValue(i).ToInt());\n  }\n  // Remove duplicate Ids.\n  std::set<vtkIdType> pIdsSet(boundaryIds.begin(), boundaryIds.end());\n  for (auto const pId : boundaryIds)\n  {\n    auto pIdsNeighbors = PointNeighbourhood(pId);\n    std::set<vtkIdType> pIdsNeighborsInterior;\n    std::set_difference(\n        pIdsNeighbors.begin(), pIdsNeighbors.end(), pIdsSet.begin(),\n        pIdsSet.end(),\n        std::inserter(pIdsNeighborsInterior, pIdsNeighborsInterior.begin()));\n    // Compute distances and extract curvature values.\n    std::vector<double> curvs;\n    std::vector<double> dists;\n    for (auto const pIdN : pIdsNeighborsInterior)\n    {\n      curvs.push_back(curvatures[pIdN]);\n      dists.push_back(ComputeDistance(pIdN, pId));\n    }\n    std::vector<vtkIdType> nonZeroDistIds;\n    for (size_t i = 0; i < dists.size(); ++i)\n    {\n      if (dists[i] > 0)\n      {\n        nonZeroDistIds.push_back(i);\n      }\n    }\n    std::vector<double> curvsNonZero;\n    std::vector<double> distsNonZero;\n    for (auto const i : nonZeroDistIds)\n    {\n      curvsNonZero.push_back(curvs[i]);\n      distsNonZero.push_back(dists[i]);\n    }\n    // Iterate over the edge points and compute the curvature as the weighted\n    // average of the neighbours.\n    auto countInvalid = 0;\n    auto newCurv = 0.0;\n    if (curvsNonZero.size() > 0)\n    {\n      std::vector<double> weights;\n      double sum = 0.0;\n      for (auto const d : distsNonZero)\n      {\n        sum += 1.0 / d;\n        weights.push_back(1.0 / d);\n      }\n      for (size_t i = 0; i < weights.size(); ++i)\n      {\n        weights[i] = weights[i] / sum;\n      }\n      newCurv = std::inner_product(curvsNonZero.begin(), curvsNonZero.end(),\n                                   weights.begin(), 0.0);\n    }\n    else\n    {\n      // Corner case.\n      // countInvalid += 1;\n      // Assuming the curvature of the point is planar.\n      newCurv = 0.0;\n    }\n    // Set the new curvature value.\n    curvatures[pId] = newCurv;\n  }\n\n  // Set small values to zero.\n  if (epsilon != 0.0)\n  {\n    auto eps = std::abs(epsilon);\n    for (size_t i = 0; i < curvatures.size(); ++i)\n    {\n      if (std::abs(curvatures[i]) < eps)\n      {\n        curvatures[i] = 0.0;\n      }\n    }\n  }\n\n  if (static_cast<size_t>(source->GetNumberOfPoints()) != curvatures.size())\n  {\n    std::string s = curvatureName;\n    s += \":\\nCannot add the adjusted curvatures to the source.\\n\";\n    s += \" The number of points in source does not equal the\\n\";\n    s += \" number of point ids in the adjusted curvature array.\";\n    std::cerr << s << std::endl;\n    return;\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\n} // namespace\n
"},{"location":"Cxx/PolyData/Curvatures/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Curvatures)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Curvatures: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Curvatures MACOSX_BUNDLE Curvatures.cxx )\n  target_link_libraries(Curvatures PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Curvatures\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/Curvatures/#download-and-build-curvatures","title":"Download and Build Curvatures","text":"

Click here to download Curvatures and its CMakeLists.txt file. Once the tarball Curvatures.tar has been downloaded and extracted,

cd Curvatures/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Curvatures\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CurvaturesAdjustEdges/","title":"CurvaturesAdjustEdges","text":"

vtk-examples/Cxx/PolyData/CurvaturesAdjustEdges

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/CurvaturesAdjustEdges/#description","title":"Description","text":"

This example demonstrates how to calculate Gaussian and Mean curvatures for a vtkPolyData source. Since edges can produce large discrepancies to curvatures, edge adjustment can be applied. If we know the geometry of the surface we can also modify the curvatures.

Functions are provided to achieve these aims.

A histogram of the frequencies is also output to the console. This is useful if you want to get an idea of the distribution of the scalars in each band.

This example was inspired by these discussions:

  • vtkCurvatures yields unreasonably large values along borders
  • How to extract the ids of the boundary points of a surface?

Thanks to everyone involved in these discussions.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CurvaturesAdjustEdges/#code","title":"Code","text":"

CurvaturesAdjustEdges.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkCubeSource.h>\n#include <vtkCurvatures.h>\n#include <vtkDelaunay2D.h>\n#include <vtkDoubleArray.h>\n#include <vtkFeatureEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkIdFilter.h>\n#include <vtkIdList.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricBour.h>\n#include <vtkParametricEnneper.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTexturedSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\n#include <algorithm>\n#include <array>\n#include <cctype>\n#include <cmath>\n#include <cstdlib>\n#include <functional>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <map>\n#include <numeric>\n#include <set>\n#include <sstream>\n\nnamespace {\n\n//! Adjust curvatures along the edges of the surface.\n/*!\n * This function adjusts curvatures along the edges of the surface by replacing\n *  the value with the average value of the curvatures of points in the\n *  neighborhood.\n *\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param epsilon: Curvature values less than this will be set to zero.\n * @return\n */\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon = 1.0e-08);\n\n//! Constrain curvatures to the range [lower_bound ... upper_bound].\n/*!\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param lowerBound: The lower bound.\n * @param upperBound: The upper bound.\n * @return\n */\nvoid ConstrainCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                         double const& lowerBound = 0.0,\n                         double const& upperBound = 0.0);\n\n// Some sample surfaces to try.\nvtkSmartPointer<vtkPolyData> GetBour();\nvtkSmartPointer<vtkPolyData> GetCube();\nvtkSmartPointer<vtkPolyData> GetEnneper();\nvtkSmartPointer<vtkPolyData> GetHills();\nvtkSmartPointer<vtkPolyData> GetMobius();\nvtkSmartPointer<vtkPolyData> GetRandomHills();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetTorus();\n\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& soource);\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLut();\nvtkSmartPointer<vtkLookupTable> GetDivergingLut1();\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision = 2,\n                                            bool const& nearestInteger = false);\n//! Count the number of scalars in each band.\n/*\n * The scalars used are the active scalars in the polydata.\n *\n * @param bands - the bands.\n * @param src - the vtkPolyData source.\n * @return The frequencies of the scalars in each band.\n */\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src);\n//!\n/*\n * The bands and frequencies are adjusted so that the first and last\n *  frequencies in the range are non-zero.\n * @param bands: The bands.\n * @param freq: The frequencies.\n */\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq);\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision = 2);\n\n} // namespace\n\nint main(int, char*[])\n{\n\n  std::string desiredSurface = \"RandomHills\";\n  // desiredSurface = \"Bour\";\n  // desiredSurface = \"Cube\";\n  // desiredSurface = \"Hills\";\n  // desiredSurface = \"Enneper\";\n  // desiredSurface = \"Mobius\";\n  // desiredSurface = \"RandomHills\";\n  // desiredSurface = \"Sphere\";\n  // desiredSurface = \"Torus\";\n\n  auto source = GetSource(desiredSurface);\n\n  vtkNew<vtkCurvatures> gc;\n  gc->SetInputData(source);\n  gc->SetCurvatureTypeToGaussian();\n  gc->Update();\n  std::vector<std::string> adjSurfaces{\"Bour\", \"Enneper\", \"Hills\",\n                                       \"RandomHills\", \"Torus\"};\n  if (std::find(adjSurfaces.begin(), adjSurfaces.end(), desiredSurface) !=\n      adjSurfaces.end())\n  {\n    AdjustEdgeCurvatures(gc->GetOutput(), \"Gauss_Curvature\");\n  }\n  if (desiredSurface == \"Bour\")\n  {\n    // Gaussian curvature is -1/(r(r+1)^4))\n    ConstrainCurvatures(gc->GetOutput(), \"Gauss_Curvature\", -0.0625, -0.0625);\n  }\n  if (desiredSurface == \"Enneper\")\n  {\n    // Gaussian curvature is -4/(1 + r^2)^4\n    ConstrainCurvatures(gc->GetOutput(), \"Gauss_Curvature\", -0.25, -0.25);\n  }\n  if (desiredSurface == \"Cube\")\n  {\n    ConstrainCurvatures(gc->GetOutput(), \"Gauss_Curvature\", 0.0, 0.0);\n  }\n  if (desiredSurface == \"Mobius\")\n  {\n    ConstrainCurvatures(gc->GetOutput(), \"Gauss_Curvature\", 0.0, 0.0);\n  }\n  if (desiredSurface == \"Sphere\")\n  {\n    // Gaussian curvature is 1/r^2\n    ConstrainCurvatures(gc->GetOutput(), \"Gauss_Curvature\", 4.0, 4.0);\n  }\n  source->GetPointData()->AddArray(\n      gc->GetOutput()->GetPointData()->GetAbstractArray(\"Gauss_Curvature\"));\n\n  vtkNew<vtkCurvatures> mc;\n  mc->SetInputData(source);\n  mc->SetCurvatureTypeToMean();\n  mc->Update();\n  if (std::find(adjSurfaces.begin(), adjSurfaces.end(), desiredSurface) !=\n      adjSurfaces.end())\n  {\n    AdjustEdgeCurvatures(mc->GetOutput(), \"Mean_Curvature\");\n  }\n  if (desiredSurface == \"Bour\")\n  {\n    // Mean curvature is 0\n    ConstrainCurvatures(mc->GetOutput(), \"Mean_Curvature\", 0.0, 0.0);\n  }\n  if (desiredSurface == \"Enneper\")\n  {\n    // Mean curvature is 0\n    ConstrainCurvatures(mc->GetOutput(), \"Mean_Curvature\", 0.0, 0.0);\n  }\n  if (desiredSurface == \"Sphere\")\n  {\n    // Mean curvature is 1/r\n    ConstrainCurvatures(mc->GetOutput(), \"Mean_Curvature\", 2.0, 2.0);\n  }\n  source->GetPointData()->AddArray(\n      mc->GetOutput()->GetPointData()->GetAbstractArray(\"Mean_Curvature\"));\n\n  // Uncomment the following lines if you want to write out the polydata.\n  // vtkNew<vtkXMLPolyDataWriter> writer;\n  // writer->SetFileName(\"Source.vtp\");\n  // writer->SetInputData(source);\n  // writer->SetDataModeToAscii();\n  // writer->Write();\n\n  // Let's visualise what we have done.\n\n  vtkNew<vtkNamedColors> colors;\n\n  colors->SetColor(\"ParaViewBkg\",\n                   std::array<unsigned char, 4>{82, 87, 110, 255}.data());\n\n  auto windowWidth = 1024;\n  auto windowHeight = 512;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(windowWidth, windowHeight);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  // Create a common text property.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(24);\n  textProperty->SetJustificationToCentered();\n\n  auto lut = GetDivergingLut();\n  // auto lut = GetDivergingLut1();\n\n  // Define viewport ranges\n  std::array<double, 2> xmins{0, 0.5};\n  std::array<double, 2> xmaxs{0.5, 1};\n  std::array<double, 2> ymins{0, 0};\n  std::array<double, 2> ymaxs{1.0, 1.0};\n\n  vtkCamera* camera = nullptr;\n\n#ifdef HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n#endif\n\n  std::array<std::string, 2> curvatureTypes{\"Gauss_Curvature\",\n                                            \"Mean_Curvature\"};\n  for (size_t idx = 0; idx < curvatureTypes.size(); ++idx)\n  {\n    auto curvatureTitle = curvatureTypes[idx];\n    std::replace(curvatureTitle.begin(), curvatureTitle.end(), '_', '\\n');\n\n    source->GetPointData()->SetActiveScalars(curvatureTypes[idx].c_str());\n    auto scalarRange = source->GetPointData()\n                           ->GetScalars(curvatureTypes[idx].c_str())\n                           ->GetRange();\n\n    auto bands = GetBands(scalarRange, 10);\n    auto freq = GetFrequencies(bands, source);\n    AdjustFrequencyRanges(bands, freq);\n    std::cout << curvatureTypes[idx] << std::endl;\n    PrintBandsFrequencies(bands, freq);\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(source);\n    mapper->SetScalarModeToUsePointFieldData();\n    mapper->SelectColorArray(curvatureTypes[idx].c_str());\n    mapper->SetScalarRange(scalarRange);\n    mapper->SetLookupTable(lut);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n\n    // Create a scalar bar\n    vtkNew<vtkScalarBarActor> scalarBar;\n    scalarBar->SetLookupTable(mapper->GetLookupTable());\n    scalarBar->SetTitle(curvatureTitle.c_str());\n    scalarBar->UnconstrainedFontSizeOn();\n    scalarBar->SetNumberOfLabels(\n        std::min<int>(5, static_cast<int>(freq.size())));\n    scalarBar->SetMaximumWidthInPixels(windowWidth / 8);\n    scalarBar->SetMaximumHeightInPixels(windowHeight / 3);\n    scalarBar->SetBarRatio(scalarBar->GetBarRatio() * 0.5);\n    scalarBar->SetPosition(0.85, 0.1);\n\n    vtkNew<vtkTextMapper> textMapper;\n    textMapper->SetInput(curvatureTitle.c_str());\n    textMapper->SetTextProperty(textProperty);\n\n    vtkNew<vtkActor2D> textActor;\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(250, 16);\n\n    vtkNew<vtkRenderer> renderer;\n    renderer->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n\n    renderer->AddActor(actor);\n    renderer->AddActor(textActor);\n    renderer->AddActor(scalarBar);\n\n    renWin->AddRenderer(renderer);\n\n    if (idx == 0)\n    {\n#ifdef HAS_COW\n      camOrientManipulator->SetParentRenderer(renderer);\n#endif\n      camera = renderer->GetActiveCamera();\n      camera->Elevation(60);\n    }\n    else\n    {\n      renderer->SetActiveCamera(camera);\n    }\n    renderer->SetViewport(xmins[idx], ymins[idx], xmaxs[idx], ymaxs[idx]);\n    renderer->ResetCamera();\n  }\n#ifdef HAS_COW\n  // Enable the widget.\n  camOrientManipulator->On();\n#endif\n\n  renWin->Render();\n  renWin->SetWindowName(\"CurvaturesAdjustEdges\");\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon)\n{\n  auto PointNeighbourhood =\n      [&source](vtkIdType const& pId) -> std::set<vtkIdType> {\n    // Extract the topological neighbors for point pId. In two steps:\n    //  1) source->GetPointCells(pId, cellIds)\n    //  2) source->GetCellPoints(cellId, cellPointIds) for all cellId in cellIds\n    vtkNew<vtkIdList> cellIds;\n    source->GetPointCells(pId, cellIds);\n    std::set<vtkIdType> neighbours;\n    for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); ++i)\n    {\n      auto cellId = cellIds->GetId(i);\n      vtkNew<vtkIdList> cellPointIds;\n      source->GetCellPoints(cellId, cellPointIds);\n      for (vtkIdType j = 0; j < cellPointIds->GetNumberOfIds(); ++j)\n      {\n        neighbours.insert(cellPointIds->GetId(j));\n      }\n    }\n    return neighbours;\n  };\n\n  auto ComputeDistance = [&source](vtkIdType const& ptIdA,\n                                   vtkIdType const& ptIdB) {\n    std::array<double, 3> ptA{0.0, 0.0, 0.0};\n    std::array<double, 3> ptB{0.0, 0.0, 0.0};\n    std::array<double, 3> ptC{0.0, 0.0, 0.0};\n    source->GetPoint(ptIdA, ptA.data());\n    source->GetPoint(ptIdB, ptB.data());\n    std::transform(std::begin(ptA), std::end(ptA), std::begin(ptB),\n                   std::begin(ptC), std::minus<double>());\n    // Calculate the norm.\n    auto result = std::sqrt(std::inner_product(std::begin(ptC), std::end(ptC),\n                                               std::begin(ptC), 0.0));\n    return result;\n  };\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n\n  // Get the boundary point IDs.\n  std::string name = \"Ids\";\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputData(source);\n  idFilter->SetPointIds(true);\n  idFilter->SetCellIds(false);\n  idFilter->SetPointIdsArrayName(name.c_str());\n  idFilter->SetCellIdsArrayName(name.c_str());\n  idFilter->Update();\n\n  vtkNew<vtkFeatureEdges> edges;\n\n  edges->SetInputConnection(idFilter->GetOutputPort());\n  edges->BoundaryEdgesOn();\n  edges->ManifoldEdgesOff();\n  edges->NonManifoldEdgesOff();\n  edges->FeatureEdgesOff();\n  edges->Update();\n\n  auto edgeAarray =\n      edges->GetOutput()->GetPointData()->GetAbstractArray(name.c_str());\n  std::vector<vtkIdType> boundaryIds;\n  for (vtkIdType i = 0; i < edges->GetOutput()->GetNumberOfPoints(); ++i)\n  {\n    boundaryIds.push_back(edgeAarray->GetVariantValue(i).ToInt());\n  }\n  // Remove duplicate Ids.\n  std::set<vtkIdType> pIdsSet(boundaryIds.begin(), boundaryIds.end());\n  for (auto const pId : boundaryIds)\n  {\n    auto pIdsNeighbors = PointNeighbourhood(pId);\n    std::set<vtkIdType> pIdsNeighborsInterior;\n    std::set_difference(\n        pIdsNeighbors.begin(), pIdsNeighbors.end(), pIdsSet.begin(),\n        pIdsSet.end(),\n        std::inserter(pIdsNeighborsInterior, pIdsNeighborsInterior.begin()));\n    // Compute distances and extract curvature values.\n    std::vector<double> curvs;\n    std::vector<double> dists;\n    for (auto const pIdN : pIdsNeighborsInterior)\n    {\n      curvs.push_back(curvatures[pIdN]);\n      dists.push_back(ComputeDistance(pIdN, pId));\n    }\n    std::vector<vtkIdType> nonZeroDistIds;\n    for (size_t i = 0; i < dists.size(); ++i)\n    {\n      if (dists[i] > 0)\n      {\n        nonZeroDistIds.push_back(i);\n      }\n    }\n    std::vector<double> curvsNonZero;\n    std::vector<double> distsNonZero;\n    for (auto const i : nonZeroDistIds)\n    {\n      curvsNonZero.push_back(curvs[i]);\n      distsNonZero.push_back(dists[i]);\n    }\n    // Iterate over the edge points and compute the curvature as the weighted\n    // average of the neighbours.\n    auto countInvalid = 0;\n    auto newCurv = 0.0;\n    if (curvsNonZero.size() > 0)\n    {\n      std::vector<double> weights;\n      double sum = 0.0;\n      for (auto const d : distsNonZero)\n      {\n        sum += 1.0 / d;\n        weights.push_back(1.0 / d);\n      }\n      for (size_t i = 0; i < weights.size(); ++i)\n      {\n        weights[i] = weights[i] / sum;\n      }\n      newCurv = std::inner_product(curvsNonZero.begin(), curvsNonZero.end(),\n                                   weights.begin(), 0.0);\n    }\n    else\n    {\n      // Corner case.\n      // countInvalid += 1;\n      // Assuming the curvature of the point is planar.\n      newCurv = 0.0;\n    }\n    // Set the new curvature value.\n    curvatures[pId] = newCurv;\n  }\n\n  // Set small values to zero.\n  if (epsilon != 0.0)\n  {\n    auto eps = std::abs(epsilon);\n    for (size_t i = 0; i < curvatures.size(); ++i)\n    {\n      if (std::abs(curvatures[i]) < eps)\n      {\n        curvatures[i] = 0.0;\n      }\n    }\n  }\n\n  if (static_cast<size_t>(source->GetNumberOfPoints()) != curvatures.size())\n  {\n    std::string s = curvatureName;\n    s += \":\\nCannot add the adjusted curvatures to the source.\\n\";\n    s += \" The number of points in source does not equal the\\n\";\n    s += \" number of point ids in the adjusted curvature array.\";\n    std::cerr << s << std::endl;\n    return;\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\nvoid ConstrainCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                         double const& lowerBound, double const& upperBound)\n{\n  std::array<double, 2> bounds{0.0, 0.0};\n  if (lowerBound < upperBound)\n  {\n    bounds[0] = lowerBound;\n    bounds[1] = upperBound;\n  }\n  else\n  {\n    bounds[0] = upperBound;\n    bounds[1] = lowerBound;\n  }\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n  //  Set upper and lower bounds.\n  for (size_t i = 0; i < curvatures.size(); ++i)\n  {\n    if (curvatures[i] < bounds[0])\n    {\n      curvatures[i] = bounds[0];\n    }\n    else\n    {\n      if (curvatures[i] > bounds[1])\n      {\n        curvatures[i] = bounds[1];\n      }\n    }\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  source->GetPointData()->RemoveArray(curvatureName.c_str());\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\n// clang-format off\n/**\n * See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n *\n *                   start point         midPoint            end point\n * cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n * purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n * green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n * blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n * green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n *\n */\n// clang-format on\nvtkSmartPointer<vtkLookupTable> GetDivergingLut()\n{\n\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, 0.230, 0.299, 0.754);\n  ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n  ctf->AddRGBPoint(1.0, 0.706, 0.016, 0.150);\n\n  auto tableSize = 256;\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(static_cast<double>(i) / lut->GetNumberOfColors(),\n                  rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(static_cast<vtkIdType>(i), rgba.data());\n  }\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLut1()\n{\n  vtkNew<vtkNamedColors> colors;\n  // Colour transfer function.\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, colors->GetColor3d(\"MidnightBlue\").GetRed(),\n                   colors->GetColor3d(\"MidnightBlue\").GetGreen(),\n                   colors->GetColor3d(\"MidnightBlue\").GetBlue());\n  ctf->AddRGBPoint(0.5, colors->GetColor3d(\"Gainsboro\").GetRed(),\n                   colors->GetColor3d(\"Gainsboro\").GetGreen(),\n                   colors->GetColor3d(\"Gainsboro\").GetBlue());\n  ctf->AddRGBPoint(1.0, colors->GetColor3d(\"DarkOrange\").GetRed(),\n                   colors->GetColor3d(\"DarkOrange\").GetGreen(),\n                   colors->GetColor3d(\"DarkOrange\").GetBlue());\n\n  // Lookup table.\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(256);\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(double(i) / lut->GetNumberOfColors(), rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(i, rgba.data());\n  }\n\n  return lut;\n}\n\nvtkSmartPointer<vtkPolyData> GetBour()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricBour> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(3);\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(subdivide->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetEnneper()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricEnneper> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetHills()\n{\n  // Create four hills on a plane.\n  // This will have regions of negative, zero and positive Gsaussian\n  // curvatures.\n\n  auto xRes = 50;\n  auto yRes = 50;\n  auto xMin = -5.0;\n  auto xMax = 5.0;\n  auto dx = (xMax - xMin) / (xRes - 1.0);\n  auto yMin = -5.0;\n  auto yMax = 5.0;\n  auto dy = (yMax - yMin) / (xRes - 1.0);\n\n  // Make a grid.\n  vtkNew<vtkPoints> points;\n  for (auto i = 0; i < xRes; ++i)\n  {\n    auto x = xMin + i * dx;\n    for (auto j = 0; j < yRes; ++j)\n    {\n      auto y = yMin + j * dy;\n      points->InsertNextPoint(x, y, 0);\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> plane;\n  plane->SetPoints(points);\n\n  // Triangulate the grid.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(plane);\n  delaunay->Update();\n\n  auto polydata = delaunay->GetOutput();\n\n  vtkNew<vtkDoubleArray> elevation;\n  elevation->SetNumberOfTuples(points->GetNumberOfPoints());\n\n  //  We define the parameters for the hills here.\n  // [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n  std::vector<std::array<double, 5>> hd{{-2.5, -2.5, 2.5, 6.5, 3.5},\n                                        {2.5, 2.5, 2.5, 2.5, 2},\n                                        {5.0, -2.5, 1.5, 1.5, 2.5},\n                                        {-5.0, 5, 2.5, 3.0, 3}};\n  std::array<double, 2> xx{0.0, 0.0};\n  for (auto i = 0; i < points->GetNumberOfPoints(); ++i)\n  {\n    auto x = polydata->GetPoint(i);\n    for (size_t j = 0; j < hd.size(); ++j)\n    {\n      xx[0] = std::pow(x[0] - hd[j][0] / hd[j][2], 2.0);\n      xx[1] = std::pow(x[1] - hd[j][1] / hd[j][3], 2.0);\n      x[2] += hd[j][4] * std::exp(-(xx[0] + xx[1]) / 2.0);\n    }\n    polydata->GetPoints()->SetPoint(i, x);\n    elevation->SetValue(i, x[2]);\n  }\n\n  vtkNew<vtkFloatArray> textures;\n  textures->SetNumberOfComponents(2);\n  textures->SetNumberOfTuples(2 * polydata->GetNumberOfPoints());\n  textures->SetName(\"Textures\");\n\n  for (auto i = 0; i < xRes; ++i)\n  {\n    float tc[2];\n    tc[0] = i / (xRes - 1.0);\n    for (auto j = 0; j < yRes; ++j)\n    {\n      // tc[1] = 1.0 - j / (yRes - 1.0);\n      tc[1] = j / (yRes - 1.0);\n      textures->SetTuple(static_cast<vtkIdType>(i) * yRes + j, tc);\n    }\n  }\n\n  polydata->GetPointData()->SetScalars(elevation);\n  polydata->GetPointData()->GetScalars()->SetName(\"Elevation\");\n  polydata->GetPointData()->SetTCoords(textures);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(polydata);\n  normals->SetInputData(polydata);\n  normals->SetFeatureAngle(30);\n  normals->SplittingOff();\n\n  vtkNew<vtkTransform> tr1;\n  tr1->RotateX(-90);\n\n  vtkNew<vtkTransformPolyDataFilter> tf1;\n  tf1->SetInputConnection(normals->GetOutputPort());\n  tf1->SetTransform(tr1);\n  tf1->Update();\n\n  return tf1->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetMobius()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricMobius> surface;\n  surface->SetMinimumV(-0.25);\n  surface->SetMaximumV(0.25);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetRandomHills()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricRandomHills> surface;\n  surface->SetRandomSeed(1);\n  surface->SetNumberOfHills(30);\n  // If you want a plane\n  // surface->SetHillAmplitude(0);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(surface->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricTorus> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& source)\n{\n  std::string surface = source;\n  std::transform(surface.begin(), surface.end(), surface.begin(),\n                 [](unsigned char c) { return std::tolower(c); });\n  std::map<std::string, int> available_surfaces = {\n      {\"bour\", 0},   {\"cube\", 1},        {\"enneper\", 2}, {\"hills\", 3},\n      {\"mobius\", 4}, {\"randomhills\", 5}, {\"sphere\", 6},  {\"torus\", 7}};\n  if (available_surfaces.find(surface) == available_surfaces.end())\n  {\n    std::cout << \"The surface is not available.\" << std::endl;\n    std::cout << \"Using RandomHills instead.\" << std::endl;\n    surface = \"randomhills\";\n  }\n  switch (available_surfaces[surface])\n  {\n  case 0:\n    return GetBour();\n    break;\n  case 1:\n    return GetCube();\n    break;\n  case 2:\n    return GetEnneper();\n    break;\n  case 3:\n    return GetHills();\n    break;\n  case 4:\n    return GetMobius();\n    break;\n  case 5:\n    return GetRandomHills();\n    break;\n  case 6:\n    return GetSphere();\n    break;\n  case 7:\n    return GetTorus();\n    break;\n  }\n  return GetRandomHills();\n}\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision,\n                                            bool const& nearestInteger)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  auto RoundOff = [&prec](const double& x) {\n    auto pow_10 = std::pow(10.0, prec);\n    return std::round(x * pow_10) / pow_10;\n  };\n\n  std::map<int, std::vector<double>> bands;\n  if ((dR[1] < dR[0]) || (numberOfBands <= 0))\n  {\n    return bands;\n  }\n  double x[2];\n  for (int i = 0; i < 2; ++i)\n  {\n    x[i] = dR[i];\n  }\n  if (nearestInteger)\n  {\n    x[0] = std::floor(x[0]);\n    x[1] = std::ceil(x[1]);\n  }\n  double dx = (x[1] - x[0]) / static_cast<double>(numberOfBands);\n  std::vector<double> b;\n  b.push_back(x[0]);\n  b.push_back(x[0] + dx / 2.0);\n  b.push_back(x[0] + dx);\n  for (int i = 0; i < numberOfBands; ++i)\n  {\n    if (i == 0)\n    {\n      for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n      {\n        *p = RoundOff(*p);\n      }\n      b[0] = x[0];\n    }\n    bands[i] = b;\n    for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n    {\n      *p = RoundOff(*p + dx);\n    }\n  }\n  return bands;\n}\n\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src)\n{\n  std::map<int, int> freq;\n  for (auto i = 0; i < static_cast<int>(bands.size()); ++i)\n  {\n    freq[i] = 0;\n  }\n  vtkIdType tuples = src->GetPointData()->GetScalars()->GetNumberOfTuples();\n  for (int i = 0; i < tuples; ++i)\n  {\n    double* x = src->GetPointData()->GetScalars()->GetTuple(i);\n    for (auto j = 0; j < static_cast<int>(bands.size()); ++j)\n    {\n      if (*x <= bands[j][2])\n      {\n        freq[j] = freq[j] + 1;\n        break;\n      }\n    }\n  }\n  return freq;\n}\n\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq)\n{\n  // Get the indices of the first and last non-zero elements.\n  auto first = 0;\n  for (auto i = 0; i < static_cast<int>(freq.size()); ++i)\n  {\n    if (freq[i] != 0)\n    {\n      first = i;\n      break;\n    }\n  }\n  std::vector<int> keys;\n  for (std::map<int, int>::iterator it = freq.begin(); it != freq.end(); ++it)\n  {\n    keys.push_back(it->first);\n  }\n  std::reverse(keys.begin(), keys.end());\n  auto last = keys[0];\n  for (size_t i = 0; i < keys.size(); ++i)\n  {\n    if (freq[keys[i]] != 0)\n    {\n      last = keys[i];\n      break;\n    }\n  }\n  // Now adjust the ranges.\n  std::map<int, int>::iterator freqItr;\n  freqItr = freq.find(first);\n  freq.erase(freq.begin(), freqItr);\n  freqItr = ++freq.find(last);\n  freq.erase(freqItr, freq.end());\n  std::map<int, std::vector<double>>::iterator bandItr;\n  bandItr = bands.find(first);\n  bands.erase(bands.begin(), bandItr);\n  bandItr = ++bands.find(last);\n  bands.erase(bandItr, bands.end());\n  // Reindex freq and bands.\n  std::map<int, int> adjFreq;\n  int idx = 0;\n  for (auto p : freq)\n  {\n    adjFreq[idx] = p.second;\n    ++idx;\n  }\n  std::map<int, std::vector<double>> adjBands;\n  idx = 0;\n  for (auto const& p : bands)\n  {\n    adjBands[idx] = p.second;\n    ++idx;\n  }\n  bands = adjBands;\n  freq = adjFreq;\n}\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  if (bands.size() != freq.size())\n  {\n    std::cout << \"Bands and frequencies must be the same size.\" << std::endl;\n    return;\n  }\n  std::ostringstream os;\n  os << \"Bands & Frequencies:\\n\";\n  size_t idx = 0;\n  auto total = 0;\n  auto width = prec + 6;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    total += freq[p->first];\n    for (std::vector<double>::const_iterator q = p->second.begin();\n         q != p->second.end(); ++q)\n    {\n      if (q == p->second.begin())\n      {\n        os << std::setw(4) << idx << \" [\";\n      }\n      if (q == std::prev(p->second.end()))\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \"]: \" << std::setw(8) << freq[p->first] << \"\\n\";\n      }\n      else\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \", \";\n      }\n    }\n    ++idx;\n  }\n  width = 3 * width + 13;\n  os << std::left << std::setw(width) << \"Total\" << std::right << std::setw(8)\n     << total << std::endl;\n  std::cout << os.str() << endl;\n}\n\n} // namespace\n
"},{"location":"Cxx/PolyData/CurvaturesAdjustEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CurvaturesAdjustEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CurvaturesAdjustEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CurvaturesAdjustEdges MACOSX_BUNDLE CurvaturesAdjustEdges.cxx )\n  target_link_libraries(CurvaturesAdjustEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CurvaturesAdjustEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CurvaturesAdjustEdges/#download-and-build-curvaturesadjustedges","title":"Download and Build CurvaturesAdjustEdges","text":"

Click here to download CurvaturesAdjustEdges and its CMakeLists.txt file. Once the tarball CurvaturesAdjustEdges.tar has been downloaded and extracted,

cd CurvaturesAdjustEdges/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CurvaturesAdjustEdges\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/CurvaturesDemo/","title":"CurvaturesDemo","text":"

vtk-examples/Cxx/PolyData/CurvaturesDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/CurvaturesDemo/#description","title":"Description","text":"

How to get the Gaussian and Mean curvatures of a surface.

Two different surfaces are used in this demonstration with each surface coloured according to its Gaussian and Mean curvatures.

  • The first surface is a superquadric surface, this demonstrates the use of extra filters that are needed to get a nice smooth surface.

  • The second surface is a parametric surface, in this case the surface has already been triangulated so no extra processing is necessary.

In order to get a nice coloured image, a vtkColorTransferFunction has been used to generate a set of colours for the vtkLookupTable tables. We have used a diverging colour space. Because of the symmetry of the ranges selected for the lookup tables, the white colouration represents a midpoint value whilst the blue represents values less than the midpoint value and orange represents colours greater than the midpoint value.

In the case of the Random Hills Gaussian curvature surface, this colouration shows the nature of the surface quite nicely. The blue areas are saddle points (negative Gaussian curvature) and the orange areas have a positive Gaussian curvature.

In the case of the mean curvature the blue colouration represents negative curvature perpendicular to one of the principal axes.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/CurvaturesDemo/#code","title":"Code","text":"

CurvaturesDemo.cxx

/*\nThe purpose of this is to demonstrate how to get the Gaussian and Mean\ncurvatures of a surface.\n\nTwo different surfaces are used in this demonstration with each\nsurface coloured according to its Gaussian and Mean curvatures.\n\nThe first surface is a superquadric surface, this demonstrates the use\nof extra filters that are needed to get a nice smooth surface.\n\nThe second surface is a parametric surface, in this case the surface\nhas already been triangulated so no extra processing is necessary.\n\nIn order to get a nice coloured image, a vtkColorTransferFunction has\nbeen used to generate a set of colours for the vtkLookUp tables. We\nhave used a diverging colour space.  Because of the symmetry of the\nranges selected for the lookup tables, the white colouration\nrepresents a midpoint value whilst the blue represents values less\nthan the midopoint value and orange represents colours greater than the\nmidpoint value.\n\nIn the case of the Random Hills Gaussian Curvature surface, this\ncolouration shows the nature of the surface quite nicely. The blue\nareas are saddle points (negative Gaussian curvature) and the orange\nareas have a positive Gaussian curvature.\nIn the case of the mean curvature the blue colouration is representing\nnegative curvature perpendicular to one of the principal axes.\n\nThis example also demonstrates the use of std::vector and the linking\nof the elements of the vector together to form a pipeline.\n*/\n\n#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCleanPolyData.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkCurvatures.h>\n#include <vtkFeatureEdges.h>\n#include <vtkIdFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n\n#include <algorithm>\n#include <array>\n#include <iterator>\n#include <map>\n#include <numeric>\n#include <set>\n#include <string>\n#include <vector>\n\nnamespace {\n//! Adjust curvatures along the edges of the surface.\n/*!\n * This function adjusts curvatures along the edges of the surface by replacing\n *  the value with the average value of the curvatures of points in the\n *  neighborhood.\n *\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param epsilon: Curvature values less than this will be set to zero.\n * @return\n */\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon = 1.0e-08);\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLut();\nvtkSmartPointer<vtkLookupTable> GetDivergingLut1();\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n  // We are going to handle two different sources.\n  // The first source is a superquadric source.\n  vtkNew<vtkSuperquadricSource> torus;\n  torus->SetCenter(0.0, 0.0, 0.0);\n  torus->SetScale(1.0, 1.0, 1.0);\n  torus->SetPhiResolution(64);\n  torus->SetThetaResolution(64);\n  torus->SetThetaRoundness(1);\n  torus->SetThickness(0.5);\n  torus->SetSize(0.5);\n  torus->SetToroidal(1);\n\n  // Rotate the torus towards the observer (around the x-axis).\n  vtkNew<vtkTransform> torusT;\n  torusT->RotateX(55);\n\n  vtkNew<vtkTransformFilter> torusTF;\n  torusTF->SetInputConnection(torus->GetOutputPort());\n  torusTF->SetTransform(torusT);\n\n  // The quadric is made of strips, so pass it through a triangle filter as\n  // the curvature filter only operates on polys.\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(torusTF->GetOutputPort());\n\n  // The quadric has nasty discontinuities from the way the edges are generated\n  // so let's pass it though a CleanPolyDataFilter and merge any points which\n  // are coincident, or very close.\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  // The next source will be a parametric function.\n  vtkNew<vtkParametricRandomHills> rh;\n  vtkNew<vtkParametricFunctionSource> rhFnSrc;\n  rhFnSrc->SetParametricFunction(rh);\n  rhFnSrc->Update();\n\n  std::map<int, vtkSmartPointer<vtkPolyData>> sources;\n  for (auto i = 0; i < 4; ++i)\n  {\n    std::string curvatureName;\n    if (i < 2)\n    {\n      vtkNew<vtkCurvatures> cc;\n      cc->SetInputConnection(cleaner->GetOutputPort());\n      if (i % 2 == 0)\n      {\n        cc->SetCurvatureTypeToGaussian();\n        curvatureName = \"Gauss_Curvature\";\n      }\n      else\n      {\n        cc->SetCurvatureTypeToMean();\n        curvatureName = \"Mean_Curvature\";\n      }\n      cc->Update();\n      AdjustEdgeCurvatures(cc->GetOutput(), curvatureName.c_str());\n      sources[i] = cc->GetOutput();\n    }\n    else\n    {\n      vtkNew<vtkCurvatures> cc;\n      cc->SetInputConnection(rhFnSrc->GetOutputPort());\n      if (i % 2 == 0)\n      {\n        cc->SetCurvatureTypeToGaussian();\n        curvatureName = \"Gauss_Curvature\";\n      }\n      else\n      {\n        cc->SetCurvatureTypeToMean();\n        curvatureName = \"Mean_Curvature\";\n      }\n      cc->Update();\n      AdjustEdgeCurvatures(cc->GetOutput(), curvatureName.c_str());\n      sources[i] = cc->GetOutput();\n    }\n  }\n\n  std::map<int, std::string> curvatures{\n      {0, {\"Gauss_Curvature\"}},\n      {1, {\"Mean_Curvature\"}},\n      {2, {\"Gauss_Curvature\"}},\n      {3, {\"Mean_Curvature\"}},\n  };\n\n  // auto lut = GetDivergingLut();\n  auto lut = GetDivergingLut1();\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textmappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textactors;\n  std::vector<vtkSmartPointer<vtkScalarBarActor>> scalarBars;\n  for (size_t idx = 0; idx < sources.size(); ++idx)\n  {\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    textmappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textactors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    scalarBars.push_back(vtkSmartPointer<vtkScalarBarActor>::New());\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n  }\n\n  // Create a common text property.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(24);\n  textProperty->SetJustificationToCentered();\n\n  // RenderWindow Dimensions\n  //\n  auto rendererSize = 512;\n  auto gridDimensions = 2;\n  auto windowWidth = rendererSize * gridDimensions;\n  auto windowHeight = rendererSize * gridDimensions;\n\n  for (auto idx = 0; idx < static_cast<int>(sources.size()); ++idx)\n  {\n    std::string curvatureName = curvatures[idx];\n    std::replace(curvatureName.begin(), curvatureName.end(), '_', '\\n');\n\n    sources[idx]->GetPointData()->SetActiveScalars(curvatures[idx].c_str());\n    auto scalarRange = sources[idx]\n                           ->GetPointData()\n                           ->GetScalars(curvatures[idx].c_str())\n                           ->GetRange();\n\n    mappers[idx]->SetInputData(sources[idx]);\n    mappers[idx]->SetScalarModeToUsePointFieldData();\n    mappers[idx]->SelectColorArray(curvatures[idx].c_str());\n    mappers[idx]->SetScalarRange(scalarRange);\n    mappers[idx]->SetLookupTable(lut);\n\n    actors[idx]->SetMapper(mappers[idx]);\n\n    textmappers[idx]->SetInput(curvatureName.c_str());\n    textmappers[idx]->SetTextProperty(textProperty);\n\n    textactors[idx]->SetMapper(textmappers[idx]);\n    textactors[idx]->SetPosition(250, 16);\n\n    // Create a scalar bar\n    scalarBars[idx]->SetLookupTable(mappers[idx]->GetLookupTable());\n    scalarBars[idx]->SetTitle(curvatureName.c_str());\n    scalarBars[idx]->UnconstrainedFontSizeOn();\n    scalarBars[idx]->SetNumberOfLabels(5);\n    scalarBars[idx]->SetMaximumWidthInPixels(windowWidth / 8);\n    scalarBars[idx]->SetMaximumHeightInPixels(windowHeight / 3);\n    scalarBars[idx]->SetBarRatio(scalarBars[idx]->GetBarRatio() * 0.5);\n    scalarBars[idx]->SetPosition(0.85, 0.1);\n  }\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(rendererSize * gridDimensions,\n                        rendererSize * gridDimensions);\n  renderWindow->SetWindowName(\"CurvaturesDemo\");\n\n  // Add and position the renders to the render window.\n  for (auto row = 0; row < gridDimensions; ++row)\n  {\n    for (auto col = 0; col < gridDimensions; ++col)\n    {\n      auto idx = row * gridDimensions + col;\n      renderers[idx]->SetViewport(\n          static_cast<double>(col) / gridDimensions,\n          (static_cast<double>(gridDimensions) - (row + 1.0)) / gridDimensions,\n          (static_cast<double>(col) + 1) / gridDimensions,\n          (static_cast<double>(gridDimensions) - row) / gridDimensions);\n      renderWindow->AddRenderer(renderers[idx]);\n\n      renderers[idx]->AddActor(actors[idx]);\n      renderers[idx]->AddActor(textactors[idx]);\n      renderers[idx]->AddActor(scalarBars[idx]);\n      renderers[idx]->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    }\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon)\n{\n  auto PointNeighbourhood =\n      [&source](vtkIdType const& pId) -> std::set<vtkIdType> {\n    // Extract the topological neighbors for point pId. In two steps:\n    //  1) source->GetPointCells(pId, cellIds)\n    //  2) source->GetCellPoints(cellId, cellPointIds) for all cellId in cellIds\n    vtkNew<vtkIdList> cellIds;\n    source->GetPointCells(pId, cellIds);\n    std::set<vtkIdType> neighbours;\n    for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); ++i)\n    {\n      auto cellId = cellIds->GetId(i);\n      vtkNew<vtkIdList> cellPointIds;\n      source->GetCellPoints(cellId, cellPointIds);\n      for (vtkIdType j = 0; j < cellPointIds->GetNumberOfIds(); ++j)\n      {\n        neighbours.insert(cellPointIds->GetId(j));\n      }\n    }\n    return neighbours;\n  };\n\n  auto ComputeDistance = [&source](vtkIdType const& ptIdA,\n                                   vtkIdType const& ptIdB) {\n    std::array<double, 3> ptA{0.0, 0.0, 0.0};\n    std::array<double, 3> ptB{0.0, 0.0, 0.0};\n    std::array<double, 3> ptC{0.0, 0.0, 0.0};\n    source->GetPoint(ptIdA, ptA.data());\n    source->GetPoint(ptIdB, ptB.data());\n    std::transform(std::begin(ptA), std::end(ptA), std::begin(ptB),\n                   std::begin(ptC), std::minus<double>());\n    // Calculate the norm.\n    auto result = std::sqrt(std::inner_product(std::begin(ptC), std::end(ptC),\n                                               std::begin(ptC), 0.0));\n    return result;\n  };\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n\n  // Get the boundary point IDs.\n  std::string name = \"Ids\";\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputData(source);\n  idFilter->SetPointIds(true);\n  idFilter->SetCellIds(false);\n  idFilter->SetPointIdsArrayName(name.c_str());\n  idFilter->SetCellIdsArrayName(name.c_str());\n  idFilter->Update();\n\n  vtkNew<vtkFeatureEdges> edges;\n\n  edges->SetInputConnection(idFilter->GetOutputPort());\n  edges->BoundaryEdgesOn();\n  edges->ManifoldEdgesOff();\n  edges->NonManifoldEdgesOff();\n  edges->FeatureEdgesOff();\n  edges->Update();\n\n  auto edgeAarray =\n      edges->GetOutput()->GetPointData()->GetAbstractArray(name.c_str());\n  std::vector<vtkIdType> boundaryIds;\n  for (vtkIdType i = 0; i < edges->GetOutput()->GetNumberOfPoints(); ++i)\n  {\n    boundaryIds.push_back(edgeAarray->GetVariantValue(i).ToInt());\n  }\n  // Remove duplicate Ids.\n  std::set<vtkIdType> pIdsSet(boundaryIds.begin(), boundaryIds.end());\n  for (auto const pId : boundaryIds)\n  {\n    auto pIdsNeighbors = PointNeighbourhood(pId);\n    std::set<vtkIdType> pIdsNeighborsInterior;\n    std::set_difference(\n        pIdsNeighbors.begin(), pIdsNeighbors.end(), pIdsSet.begin(),\n        pIdsSet.end(),\n        std::inserter(pIdsNeighborsInterior, pIdsNeighborsInterior.begin()));\n    // Compute distances and extract curvature values.\n    std::vector<double> curvs;\n    std::vector<double> dists;\n    for (auto const pIdN : pIdsNeighborsInterior)\n    {\n      curvs.push_back(curvatures[pIdN]);\n      dists.push_back(ComputeDistance(pIdN, pId));\n    }\n    std::vector<vtkIdType> nonZeroDistIds;\n    for (size_t i = 0; i < dists.size(); ++i)\n    {\n      if (dists[i] > 0)\n      {\n        nonZeroDistIds.push_back(i);\n      }\n    }\n    std::vector<double> curvsNonZero;\n    std::vector<double> distsNonZero;\n    for (auto const i : nonZeroDistIds)\n    {\n      curvsNonZero.push_back(curvs[i]);\n      distsNonZero.push_back(dists[i]);\n    }\n    // Iterate over the edge points and compute the curvature as the weighted\n    // average of the neighbours.\n    auto countInvalid = 0;\n    auto newCurv = 0.0;\n    if (curvsNonZero.size() > 0)\n    {\n      std::vector<double> weights;\n      double sum = 0.0;\n      for (auto const d : distsNonZero)\n      {\n        sum += 1.0 / d;\n        weights.push_back(1.0 / d);\n      }\n      for (size_t i = 0; i < weights.size(); ++i)\n      {\n        weights[i] = weights[i] / sum;\n      }\n      newCurv = std::inner_product(curvsNonZero.begin(), curvsNonZero.end(),\n                                   weights.begin(), 0.0);\n    }\n    else\n    {\n      // Corner case.\n      // countInvalid += 1;\n      // Assuming the curvature of the point is planar.\n      newCurv = 0.0;\n    }\n    // Set the new curvature value.\n    curvatures[pId] = newCurv;\n  }\n\n  // Set small values to zero.\n  if (epsilon != 0.0)\n  {\n    auto eps = std::abs(epsilon);\n    for (size_t i = 0; i < curvatures.size(); ++i)\n    {\n      if (std::abs(curvatures[i]) < eps)\n      {\n        curvatures[i] = 0.0;\n      }\n    }\n  }\n\n  if (static_cast<size_t>(source->GetNumberOfPoints()) != curvatures.size())\n  {\n    std::string s = curvatureName;\n    s += \":\\nCannot add the adjusted curvatures to the source.\\n\";\n    s += \" The number of points in source does not equal the\\n\";\n    s += \" number of point ids in the adjusted curvature array.\";\n    std::cerr << s << std::endl;\n    return;\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\n// clang-format off\n/**\n * See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n *\n *                   start point         midPoint            end point\n * cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n * purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n * green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n * blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n * green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n *\n */\n// clang-format on\nvtkSmartPointer<vtkLookupTable> GetDivergingLut()\n{\n\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, 0.230, 0.299, 0.754);\n  ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n  ctf->AddRGBPoint(1.0, 0.706, 0.016, 0.150);\n\n  auto tableSize = 256;\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(static_cast<double>(i) / lut->GetNumberOfColors(),\n                  rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(static_cast<vtkIdType>(i), rgba.data());\n  }\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLut1()\n{\n  vtkNew<vtkNamedColors> colors;\n  // Colour transfer function.\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, colors->GetColor3d(\"MidnightBlue\").GetRed(),\n                   colors->GetColor3d(\"MidnightBlue\").GetGreen(),\n                   colors->GetColor3d(\"MidnightBlue\").GetBlue());\n  ctf->AddRGBPoint(0.5, colors->GetColor3d(\"Gainsboro\").GetRed(),\n                   colors->GetColor3d(\"Gainsboro\").GetGreen(),\n                   colors->GetColor3d(\"Gainsboro\").GetBlue());\n  ctf->AddRGBPoint(1.0, colors->GetColor3d(\"DarkOrange\").GetRed(),\n                   colors->GetColor3d(\"DarkOrange\").GetGreen(),\n                   colors->GetColor3d(\"DarkOrange\").GetBlue());\n\n  // Lookup table.\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(256);\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(double(i) / lut->GetNumberOfColors(), rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(i, rgba.data());\n  }\n\n  return lut;\n}\n\n} // namespace\n
"},{"location":"Cxx/PolyData/CurvaturesDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CurvaturesDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CurvaturesDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CurvaturesDemo MACOSX_BUNDLE CurvaturesDemo.cxx )\n  target_link_libraries(CurvaturesDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CurvaturesDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/CurvaturesDemo/#download-and-build-curvaturesdemo","title":"Download and Build CurvaturesDemo","text":"

Click here to download CurvaturesDemo and its CMakeLists.txt file. Once the tarball CurvaturesDemo.tar has been downloaded and extracted,

cd CurvaturesDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CurvaturesDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/DataBounds/","title":"DataBounds","text":"

vtk-examples/Cxx/PolyData/DataBounds

"},{"location":"Cxx/PolyData/DataBounds/#description","title":"Description","text":"

This examples gets the bounds of a dataset. Note that Update() must be applied to create the output of the filter.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/DataBounds/#code","title":"Code","text":"

DataBounds.cxx

#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> modelSource;\n    modelSource->Update();\n    polyData = modelSource->GetOutput();\n  }\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n\n  std::cout << \"xmin: \" << bounds[0] << \" \"\n            << \"xmax: \" << bounds[1] << std::endl\n            << \"ymin: \" << bounds[2] << \" \"\n            << \"ymax: \" << bounds[3] << std::endl\n            << \"zmin: \" << bounds[4] << \" \"\n            << \"zmax: \" << bounds[5] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/DataBounds/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataBounds)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataBounds: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataBounds MACOSX_BUNDLE DataBounds.cxx )\n  target_link_libraries(DataBounds PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataBounds\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/DataBounds/#download-and-build-databounds","title":"Download and Build DataBounds","text":"

Click here to download DataBounds and its CMakeLists.txt file. Once the tarball DataBounds.tar has been downloaded and extracted,

cd DataBounds/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DataBounds\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/DataSetSurfaceFilter/","title":"DataSetSurfaceFilter","text":"

vtk-examples/Cxx/PolyData/DataSetSurfaceFilter

"},{"location":"Cxx/PolyData/DataSetSurfaceFilter/#description","title":"Description","text":"

This example demonstrates how to convert an unstructured grid to a polydata. Currently nothing is done with the resulting polydata.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/DataSetSurfaceFilter/#code","title":"Code","text":"

DataSetSurfaceFilter.cxx

#include <vtkDataSetSurfaceFilter.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n#include <vtkVertex.h>\n\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid> MakeUnstructuredGrid(vtkSmartPointer<T>);\n}\n\nint main(int argc, char* argv[])\n{\n  auto surfaceFilter = vtkSmartPointer<vtkDataSetSurfaceFilter>::New();\n  if (argc < 2)\n  {\n    // std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtk) e.g. uGridEx.vtk \"\n    //          << std::endl;\n    auto unstructuredGrid =\n        MakeUnstructuredGrid(vtkSmartPointer<vtkVertex>::New());\n    surfaceFilter->SetInputData(unstructuredGrid);\n  }\n  else\n  {\n    // Create the reader for the data.\n    // This is the data that will be rendered.\n    std::string filename = argv[1];\n    std::cout << \"Loading \" << filename.c_str() << std::endl;\n    vtkNew<vtkUnstructuredGridReader> reader;\n    reader->SetFileName(filename.c_str());\n    surfaceFilter->SetInputConnection(reader->GetOutputPort());\n  }\n\n  surfaceFilter->Update();\n\n  vtkPolyData* polydata = surfaceFilter->GetOutput();\n\n  std::cout << \"Output has \" << polydata->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid>\nMakeUnstructuredGrid(vtkSmartPointer<T> aCell)\n{\n  double* pcoords = aCell->GetParametricCoords();\n  for (int i = 0; i < aCell->GetNumberOfPoints(); ++i)\n  {\n    aCell->GetPointIds()->SetId(i, i);\n    aCell->GetPoints()->SetPoint(i, *(pcoords + 3 * i), *(pcoords + 3 * i + 1),\n                                 *(pcoords + 3 * i + 2));\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(aCell->GetPoints());\n  ug->InsertNextCell(aCell->GetCellType(), aCell->GetPointIds());\n  return ug;\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/DataSetSurfaceFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataSetSurfaceFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  IOLegacy\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataSetSurfaceFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataSetSurfaceFilter MACOSX_BUNDLE DataSetSurfaceFilter.cxx )\n  target_link_libraries(DataSetSurfaceFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataSetSurfaceFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/DataSetSurfaceFilter/#download-and-build-datasetsurfacefilter","title":"Download and Build DataSetSurfaceFilter","text":"

Click here to download DataSetSurfaceFilter and its CMakeLists.txt file. Once the tarball DataSetSurfaceFilter.tar has been downloaded and extracted,

cd DataSetSurfaceFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DataSetSurfaceFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/DecimatePolyline/","title":"DecimatePolyline","text":"

vtk-examples/Cxx/PolyData/DecimatePolyline

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/DecimatePolyline/#description","title":"Description","text":"

This example shows how to decimate a polyline.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/DecimatePolyline/#code","title":"Code","text":"

DecimatePolyline.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkDecimatePolylineFilter.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  const unsigned int numberofpoints = 100;\n\n  vtkNew<vtkPolyData> circle;\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> lines;\n  vtkIdType* lineIndices = new vtkIdType[numberofpoints + 1];\n\n  for (unsigned int i = 0; i < numberofpoints; i++)\n  {\n    const double angle = 2.0 * vtkMath::Pi() * static_cast<double>(i) /\n        static_cast<double>(numberofpoints);\n    points->InsertPoint(static_cast<vtkIdType>(i), cos(angle), sin(angle), 0.);\n    lineIndices[i] = static_cast<vtkIdType>(i);\n  }\n  lineIndices[numberofpoints] = 0;\n  lines->InsertNextCell(numberofpoints + 1, lineIndices);\n  delete[] lineIndices;\n\n  circle->SetPoints(points);\n  circle->SetLines(lines);\n\n  vtkNew<vtkPolyDataMapper> c_mapper;\n  c_mapper->SetInputData(circle);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> c_actor;\n  c_actor->SetMapper(c_mapper);\n  c_actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  c_actor->GetProperty()->SetLineWidth(3);\n\n  vtkNew<vtkDecimatePolylineFilter> decimate;\n  decimate->SetInputData(circle);\n  decimate->SetTargetReduction(0.95);\n  decimate->Update();\n\n  vtkNew<vtkPolyDataMapper> d_mapper;\n  d_mapper->SetInputConnection(decimate->GetOutputPort());\n\n  vtkNew<vtkActor> d_actor;\n  d_actor->SetMapper(d_mapper);\n  d_actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  d_actor->GetProperty()->SetLineWidth(3);\n\n  vtkNew<vtkRenderer> ren;\n  ren->AddActor(c_actor);\n  ren->AddActor(d_actor);\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(ren);\n  renwin->SetSize(640, 480);\n  renwin->SetWindowName(\"DecimatePolyline\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n\n  renwin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/DecimatePolyline/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DecimatePolyline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DecimatePolyline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DecimatePolyline MACOSX_BUNDLE DecimatePolyline.cxx )\n  target_link_libraries(DecimatePolyline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DecimatePolyline\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/DecimatePolyline/#download-and-build-decimatepolyline","title":"Download and Build DecimatePolyline","text":"

Click here to download DecimatePolyline and its CMakeLists.txt file. Once the tarball DecimatePolyline.tar has been downloaded and extracted,

cd DecimatePolyline/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DecimatePolyline\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/DeleteCells/","title":"DeleteCells","text":"

vtk-examples/Cxx/PolyData/DeleteCells

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/DeleteCells/#description","title":"Description","text":"

This example demonstrates how to delete a cell from a vtkPolyData. This is a three-step process: first, build upward-links from points to cells; second, mark cells for deletion; third, delete the marked cells. The first step is necessary to create a data structure suitable for efficient delete operations. Creating this data structure is computationally expensive, so it is only carried out before operations that need it, e.g. those that require changes to the topology.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/DeleteCells/#code","title":"Code","text":"

DeleteCells.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 0);\n\n  vtkNew<vtkLine> line0;\n  line0->GetPointIds()->SetId(0, 0);\n  line0->GetPointIds()->SetId(1, 1);\n\n  vtkNew<vtkLine> line1;\n  line1->GetPointIds()->SetId(0, 1);\n  line1->GetPointIds()->SetId(1, 2);\n\n  vtkNew<vtkLine> line2;\n  line2->GetPointIds()->SetId(0, 2);\n  line2->GetPointIds()->SetId(1, 3);\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line0);\n  lines->InsertNextCell(line1);\n  lines->InsertNextCell(line2);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetLines(lines);\n\n  // Tell the polydata to build 'upward' links from points to cells.\n  polydata->BuildLinks();\n  // Mark a cell as deleted.\n  polydata->DeleteCell(1);\n  // Remove the marked cell.\n  polydata->RemoveDeletedCells();\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputDataObject(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  actor->GetProperty()->SetLineWidth(4);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DeleteCells\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/DeleteCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DeleteCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DeleteCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DeleteCells MACOSX_BUNDLE DeleteCells.cxx )\n  target_link_libraries(DeleteCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DeleteCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/DeleteCells/#download-and-build-deletecells","title":"Download and Build DeleteCells","text":"

Click here to download DeleteCells and its CMakeLists.txt file. Once the tarball DeleteCells.tar has been downloaded and extracted,

cd DeleteCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DeleteCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/DeletePoint/","title":"DeletePoint","text":"

vtk-examples/Cxx/PolyData/DeletePoint

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/DeletePoint/#code","title":"Code","text":"

DeletePoint.cxx

#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkSmartPointer.h>\n\nnamespace {\nvoid OutputPoints(vtkSmartPointer<vtkPoints> points);\nvoid ReallyDeletePoint(vtkSmartPointer<vtkPoints> points, vtkIdType id);\n} // namespace\n\nint main(int, char*[])\n{\n  // Create a set of points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 1.0);\n\n  std::cout << \"Number of points: \" << points->GetNumberOfPoints() << std::endl;\n  OutputPoints(points);\n\n  ReallyDeletePoint(points, 1);\n\n  std::cout << \"Number of points: \" << points->GetNumberOfPoints() << std::endl;\n  OutputPoints(points);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid OutputPoints(vtkSmartPointer<vtkPoints> points)\n{\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    points->GetPoint(i, p);\n    cout << p[0] << \" \" << p[1] << \" \" << p[2] << endl;\n  }\n}\n\nvoid ReallyDeletePoint(vtkSmartPointer<vtkPoints> points, vtkIdType id)\n{\n  vtkNew<vtkPoints> newPoints;\n\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    if (i != id)\n    {\n      double p[3];\n      points->GetPoint(i, p);\n      newPoints->InsertNextPoint(p);\n    }\n  }\n\n  points->ShallowCopy(newPoints);\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/DeletePoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DeletePoint)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DeletePoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DeletePoint MACOSX_BUNDLE DeletePoint.cxx )\n  target_link_libraries(DeletePoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DeletePoint\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/DeletePoint/#download-and-build-deletepoint","title":"Download and Build DeletePoint","text":"

Click here to download DeletePoint and its CMakeLists.txt file. Once the tarball DeletePoint.tar has been downloaded and extracted,

cd DeletePoint/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DeletePoint\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/DetermineArrayDataTypes/","title":"DetermineArrayDataTypes","text":"

vtk-examples/Cxx/PolyData/DetermineArrayDataTypes

"},{"location":"Cxx/PolyData/DetermineArrayDataTypes/#description","title":"Description","text":"

This example shows how to determine the type of data stored in a named array in a vtp file.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/DetermineArrayDataTypes/#code","title":"Code","text":"

DetermineArrayDataTypes.cxx

#include <string>\n#include <vector>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\nvoid FindAllData(const std::string& inputFilename);\n}\n\nint main(int argc, char* argv[])\n{\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" InputFilename e.g. filledContours.vtp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n  FindAllData(inputFilename);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid FindAllData(const std::string& InputFilename)\n{\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(InputFilename.c_str());\n  reader->Update();\n  vtkPolyData* polydata = reader->GetOutput();\n\n  unsigned int numberOfArrays = polydata->GetPointData()->GetNumberOfArrays();\n  std::cout << \"NumArrays: \" << numberOfArrays << std::endl;\n\n  std::cout << \"key: \" << std::endl;\n  ;\n  // More values can be found in <VTK_DIR>/Common/Core/vtkSetGet.h\n  std::cout << VTK_UNSIGNED_CHAR << \" unsigned char\" << std::endl;\n  std::cout << VTK_UNSIGNED_INT << \" unsigned int\" << std::endl;\n  std::cout << VTK_FLOAT << \" float\" << std::endl;\n  std::cout << VTK_DOUBLE << \" double\" << std::endl;\n\n  std::vector<std::string> arrayNames;\n  for (unsigned int i = 0; i < numberOfArrays; i++)\n  {\n    // The following two lines are equivalent:\n    // arrayNames.push_back(polydata->GetPointData()->GetArray(i)->GetName());\n    arrayNames.push_back(polydata->GetPointData()->GetArrayName(i));\n    int dataTypeID = polydata->GetPointData()->GetArray(i)->GetDataType();\n    std::cout << \"Array \" << i << \": \" << arrayNames[i]\n              << \" (type: \" << dataTypeID << \")\" << std::endl;\n  }\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/DetermineArrayDataTypes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DetermineArrayDataTypes)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DetermineArrayDataTypes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DetermineArrayDataTypes MACOSX_BUNDLE DetermineArrayDataTypes.cxx )\n  target_link_libraries(DetermineArrayDataTypes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DetermineArrayDataTypes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/DetermineArrayDataTypes/#download-and-build-determinearraydatatypes","title":"Download and Build DetermineArrayDataTypes","text":"

Click here to download DetermineArrayDataTypes and its CMakeLists.txt file. Once the tarball DetermineArrayDataTypes.tar has been downloaded and extracted,

cd DetermineArrayDataTypes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DetermineArrayDataTypes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/DijkstraGraphGeodesicPath/","title":"DijkstraGraphGeodesicPath","text":"

vtk-examples/Cxx/PolyData/DijkstraGraphGeodesicPath

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/DijkstraGraphGeodesicPath/#code","title":"Code","text":"

DijkstraGraphGeodesicPath.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDijkstraGraphGeodesicPath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkDijkstraGraphGeodesicPath> dijkstra;\n  dijkstra->SetInputConnection(sphereSource->GetOutputPort());\n  dijkstra->SetStartVertex(0);\n  // dijkstra->SetEndVertex(10);\n  dijkstra->SetEndVertex(7);\n  dijkstra->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> pathMapper;\n  pathMapper->SetInputConnection(dijkstra->GetOutputPort());\n\n  vtkNew<vtkActor> pathActor;\n  pathActor->SetMapper(pathMapper);\n  pathActor->GetProperty()->SetColor(colors->GetColor3d(\"HotPink\").GetData());\n  pathActor->GetProperty()->SetLineWidth(4);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DijkstraGraphGeodesicPath\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor(pathActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(2.9, -1.6, 0.3);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->SetDistance(3);\n  camera->Zoom(1.5);\n\n  // Render and interact.\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/DijkstraGraphGeodesicPath/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DijkstraGraphGeodesicPath)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DijkstraGraphGeodesicPath: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DijkstraGraphGeodesicPath MACOSX_BUNDLE DijkstraGraphGeodesicPath.cxx )\n  target_link_libraries(DijkstraGraphGeodesicPath PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DijkstraGraphGeodesicPath\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/DijkstraGraphGeodesicPath/#download-and-build-dijkstragraphgeodesicpath","title":"Download and Build DijkstraGraphGeodesicPath","text":"

Click here to download DijkstraGraphGeodesicPath and its CMakeLists.txt file. Once the tarball DijkstraGraphGeodesicPath.tar has been downloaded and extracted,

cd DijkstraGraphGeodesicPath/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DijkstraGraphGeodesicPath\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/DistancePolyDataFilter/","title":"DistancePolyDataFilter","text":"

vtk-examples/Cxx/PolyData/DistancePolyDataFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/DistancePolyDataFilter/#code","title":"Code","text":"

DistancePolyDataFilter.cxx

#include <vtkActor.h>\n#include <vtkCleanPolyData.h>\n#include <vtkDistancePolyDataFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> input1;\n  vtkSmartPointer<vtkPolyData> input2;\n  if (argc == 3)\n  {\n    //     std::cerr << \"Usage: \" << argv[0]\n    //               << \" filename1.vtk\"\n    //               << \" filename2.vtk\" << std::endl;\n    vtkNew<vtkPolyDataReader> reader1;\n    reader1->SetFileName(argv[1]);\n    reader1->Update();\n    input1 = reader1->GetOutput();\n\n    vtkNew<vtkPolyDataReader> reader2;\n    reader2->SetFileName(argv[2]);\n    reader2->Update();\n    input2 = reader2->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource1;\n    sphereSource1->SetCenter(1, 0, 0);\n    sphereSource1->SetPhiResolution(21);\n    sphereSource1->SetThetaResolution(21);\n    sphereSource1->Update();\n    input1 = sphereSource1->GetOutput();\n\n    vtkNew<vtkSphereSource> sphereSource2;\n    sphereSource2->SetPhiResolution(21);\n    sphereSource2->SetThetaResolution(21);\n    sphereSource2->Update();\n    input2 = sphereSource2->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCleanPolyData> clean1;\n  clean1->SetInputData(input1);\n\n  vtkNew<vtkCleanPolyData> clean2;\n  clean2->SetInputData(input2);\n\n  vtkNew<vtkDistancePolyDataFilter> distanceFilter;\n\n  distanceFilter->SetInputConnection(0, clean1->GetOutputPort());\n  distanceFilter->SetInputConnection(1, clean2->GetOutputPort());\n  distanceFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(distanceFilter->GetOutputPort());\n  mapper->SetScalarRange(\n      distanceFilter->GetOutput()->GetPointData()->GetScalars()->GetRange()[0],\n      distanceFilter->GetOutput()->GetPointData()->GetScalars()->GetRange()[1]);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(mapper->GetLookupTable());\n  scalarBar->SetTitle(\"Distance\");\n  scalarBar->SetNumberOfLabels(4);\n  scalarBar->UnconstrainedFontSizeOn();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Gold\").GetData());\n  renderer->GradientBackgroundOn();\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(600, 500);\n  renWin->SetWindowName(\"DistancePolyDataFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renWin);\n\n  renderer->AddActor(actor);\n  renderer->AddActor2D(scalarBar);\n\n  renWin->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/DistancePolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DistancePolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DistancePolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DistancePolyDataFilter MACOSX_BUNDLE DistancePolyDataFilter.cxx )\n  target_link_libraries(DistancePolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DistancePolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/DistancePolyDataFilter/#download-and-build-distancepolydatafilter","title":"Download and Build DistancePolyDataFilter","text":"

Click here to download DistancePolyDataFilter and its CMakeLists.txt file. Once the tarball DistancePolyDataFilter.tar has been downloaded and extracted,

cd DistancePolyDataFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DistancePolyDataFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/DownsamplePointCloud/","title":"DownsamplePointCloud","text":"

vtk-examples/Cxx/PolyData/DownsamplePointCloud

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/DownsamplePointCloud/#description","title":"Description","text":"

This example downsamples a point cloud by specifying the minimum distance two points can be from each other. The filter will delete points so that this criterion is met.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/DownsamplePointCloud/#code","title":"Code","text":"

DownsamplePointCloud.cxx

#include <vtkActor.h>\n#include <vtkCleanPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(1000);\n  pointSource->SetRadius(1.0);\n  pointSource->Update();\n  auto pts = pointSource->GetNumberOfPoints();\n\n  vtkNew<vtkCleanPolyData> cleanPolyData;\n  cleanPolyData->SetInputConnection(pointSource->GetOutputPort());\n  cleanPolyData->SetTolerance(0.1);\n  cleanPolyData->Update();\n  auto cleanPts = cleanPolyData->GetOutput()->GetNumberOfPoints();\n\n  std::cout << \"Original points\" << pts << std::endl;\n  std::cout << \"Cleaned points \" << cleanPts << std::endl;\n  std::cout << \"Reduction      \"\n            << (1.0 - static_cast<double>(cleanPts) / pts) * 100.0 << \"%\"\n            << std::endl;\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(pointSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n  inputActor->GetProperty()->SetPointSize(3);\n\n  vtkNew<vtkPolyDataMapper> cleanedMapper;\n  cleanedMapper->SetInputConnection(cleanPolyData->GetOutputPort());\n  vtkNew<vtkActor> cleanedActor;\n  cleanedActor->SetMapper(cleanedMapper);\n  cleanedActor->GetProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n  cleanedActor->GetProperty()->SetPointSize(3);\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"DownsamplePointCloud\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"van_dyke_brown\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"ultramarine\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(cleanedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/DownsamplePointCloud/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DownsamplePointCloud)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DownsamplePointCloud: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DownsamplePointCloud MACOSX_BUNDLE DownsamplePointCloud.cxx )\n  target_link_libraries(DownsamplePointCloud PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DownsamplePointCloud\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/DownsamplePointCloud/#download-and-build-downsamplepointcloud","title":"Download and Build DownsamplePointCloud","text":"

Click here to download DownsamplePointCloud and its CMakeLists.txt file. Once the tarball DownsamplePointCloud.tar has been downloaded and extracted,

cd DownsamplePointCloud/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DownsamplePointCloud\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/EmbedPointsIntoVolume/","title":"EmbedPointsIntoVolume","text":"

vtk-examples/Cxx/PolyData/EmbedPointsIntoVolume

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/EmbedPointsIntoVolume/#code","title":"Code","text":"

EmbedPointsIntoVolume.cxx

#include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyData> input;\n\n  if (argc == 1) // Generate the data.\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetRadius(.01);\n    sphereSource->Update();\n    input->ShallowCopy(sphereSource->GetOutput());\n  }\n  else // Read the data from a file.\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    input->ShallowCopy(reader->GetOutput());\n  }\n\n  vtkNew<vtkGaussianSplatter> splatter;\n  splatter->SetInputData(input);\n\n  unsigned int n = 200;\n  splatter->SetSampleDimensions(n, n, n);\n  splatter->SetRadius(.02);\n  splatter->SetExponentFactor(-10);\n  splatter->SetEccentricity(2);\n  splatter->Update();\n\n  vtkNew<vtkContourFilter> isoSurface;\n  isoSurface->SetInputConnection(splatter->GetOutputPort());\n  isoSurface->SetValue(0, .95 * splatter->GetRadius());\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(isoSurface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"EmbedPointsIntoVolume\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/EmbedPointsIntoVolume/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EmbedPointsIntoVolume)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EmbedPointsIntoVolume: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EmbedPointsIntoVolume MACOSX_BUNDLE EmbedPointsIntoVolume.cxx )\n  target_link_libraries(EmbedPointsIntoVolume PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EmbedPointsIntoVolume\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/EmbedPointsIntoVolume/#download-and-build-embedpointsintovolume","title":"Download and Build EmbedPointsIntoVolume","text":"

Click here to download EmbedPointsIntoVolume and its CMakeLists.txt file. Once the tarball EmbedPointsIntoVolume.tar has been downloaded and extracted,

cd EmbedPointsIntoVolume/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./EmbedPointsIntoVolume\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ExternalContour/","title":"ExternalContour","text":"

vtk-examples/Cxx/PolyData/ExternalContour

"},{"location":"Cxx/PolyData/ExternalContour/#description","title":"Description","text":"

Compute the external contour of a polydata.

At first, it creates a black and white image of a scene containing the polydata and then extracts the contour of the black shape from the image.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ExternalContour/#code","title":"Code","text":"

ExternalContour.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVersion.h>\n#include <vtkWindowToImageFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkPolyData> data3d;\n\n  if (argc > 1)\n  {\n    // E.g. Bunny.vtp\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    data3d = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetCenter(0.0, 0.0, 5.0);\n    source->SetRadius(2.0);\n    source->SetPhiResolution(20.);\n    source->SetThetaResolution(20.);\n    source->Update();\n\n    data3d = source->GetOutput();\n  }\n\n  double bounds_data[6], center_data[3];\n  data3d->GetBounds(bounds_data);\n  data3d->GetCenter(center_data);\n\n  // Black and white scene with the data in order to print the view.\n  vtkNew<vtkPolyDataMapper> mapper_data;\n  mapper_data->SetInputData(data3d);\n\n  vtkNew<vtkActor> actor_data;\n  actor_data->SetMapper(mapper_data);\n  actor_data->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderer> tmp_rend;\n  tmp_rend->SetBackground(colors->GetColor3d(\"White\").GetData());\n\n  tmp_rend->AddActor(actor_data);\n  tmp_rend->ResetCamera();\n  tmp_rend->GetActiveCamera()->SetParallelProjection(1);\n\n  vtkNew<vtkRenderWindow> tmp_rW;\n  tmp_rW->SetOffScreenRendering(1);\n  tmp_rW->AddRenderer(tmp_rend);\n\n  tmp_rW->Render();\n\n  // Get a print of the window\n  vtkNew<vtkWindowToImageFilter> windowToImageFilter;\n  windowToImageFilter->SetInput(tmp_rW);\n#if VTK_MAJOR_VERSION >= 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90\n  windowToImageFilter->SetScale(2); // image quality\n#else\n  windowToImageFilter->SetMagnification(2); // image quality\n#endif\n  windowToImageFilter->Update();\n\n  // Extract the silhouette corresponding to the black limit of the image.\n  vtkNew<vtkContourFilter> ContFilter;\n  ContFilter->SetInputConnection(windowToImageFilter->GetOutputPort());\n  ContFilter->SetValue(0, 255);\n  ContFilter->Update();\n\n  // Make the contour coincide with the data.\n  vtkSmartPointer<vtkPolyData> contour = ContFilter->GetOutput();\n\n  double bounds_contour[6], center_contour[3];\n  double trans_x = 0.0, trans_y = 0.0, trans_z = 0.0, ratio_x = 0.0,\n         ratio_y = 0.0;\n  contour->GetBounds(bounds_contour);\n\n  ratio_x = (bounds_data[1] - bounds_data[0]) /\n      (bounds_contour[1] - bounds_contour[0]);\n  ratio_y = (bounds_data[3] - bounds_data[2]) /\n      (bounds_contour[3] - bounds_contour[2]);\n\n  // Rescale the contour so that it shares the same bounds as the\n  // input data.\n  vtkNew<vtkTransform> transform1;\n  transform1->Scale(ratio_x, ratio_y, 1.0);\n\n  vtkNew<vtkTransformPolyDataFilter> tfilter1;\n  tfilter1->SetInputData(contour);\n  tfilter1->SetTransform(transform1);\n  tfilter1->Update();\n\n  contour = tfilter1->GetOutput();\n\n  // Translate the contour so that it shares the same center as the\n  // input data.\n  contour->GetCenter(center_contour);\n  trans_x = center_data[0] - center_contour[0];\n  trans_y = center_data[1] - center_contour[1];\n  trans_z = center_data[2] - center_contour[2];\n\n  vtkNew<vtkTransform> transform2;\n  transform2->Translate(trans_x, trans_y, trans_z);\n\n  vtkNew<vtkTransformPolyDataFilter> tfilter2;\n  tfilter2->SetInputData(contour);\n  tfilter2->SetTransform(transform2);\n  tfilter2->Update();\n\n  contour = tfilter2->GetOutput();\n\n  // Render the result : Input data + resulting silhouette\n\n  // Updating the color of the data.\n  actor_data->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a mapper and actor of the silhouette.\n  vtkNew<vtkPolyDataMapper> mapper_contour;\n  mapper_contour->SetInputData(contour);\n\n  vtkNew<vtkActor> actor_contour;\n  actor_contour->SetMapper(mapper_contour);\n  actor_contour->GetProperty()->SetLineWidth(2.0);\n\n  // 2 renderers and a render window.\n  vtkNew<vtkRenderer> renderer1;\n  renderer1->AddActor(actor_data);\n\n  vtkNew<vtkRenderer> renderer2;\n  renderer2->AddActor(actor_contour);\n\n  vtkNew<vtkRenderWindow> renderwindow;\n  renderwindow->SetSize(400, 400);\n  renderwindow->SetWindowName(\"ExternalContour\");\n  renderwindow->AddRenderer(renderer1);\n\n  renderer1->SetViewport(0.0, 0.0, 0.5, 1.0);\n  renderer1->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderwindow->AddRenderer(renderer2);\n  renderer2->SetViewport(0.5, 0.0, 1.0, 1.0);\n  renderer2->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  iren->SetRenderWindow(renderwindow);\n  iren->SetInteractorStyle(style);\n\n  renderwindow->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ExternalContour/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExternalContour)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExternalContour: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExternalContour MACOSX_BUNDLE ExternalContour.cxx )\n  target_link_libraries(ExternalContour PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExternalContour\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ExternalContour/#download-and-build-externalcontour","title":"Download and Build ExternalContour","text":"

Click here to download ExternalContour and its CMakeLists.txt file. Once the tarball ExternalContour.tar has been downloaded and extracted,

cd ExternalContour/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExternalContour\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ExtractCellsUsingPoints/","title":"ExtractCellsUsingPoints","text":"

vtk-examples/Cxx/PolyData/ExtractCellsUsingPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ExtractCellsUsingPoints/#code","title":"Code","text":"

ExtractCellsUsingPoints.cxx

#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInformation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfCells()\n            << \" input cells.\" << std::endl;\n\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  // Set values\n\n  for (vtkIdType i = 0; i < sphereSource->GetOutput()->GetNumberOfPoints() - 15;\n       i++)\n  {\n    ids->InsertNextValue(i);\n  }\n\n  vtkNew<vtkSelectionNode> selectionNode;\n  selectionNode->SetFieldType(vtkSelectionNode::POINT);\n  selectionNode->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode->SetSelectionList(ids);\n  selectionNode->GetProperties()->Set(vtkSelectionNode::CONTAINING_CELLS(), 1);\n\n  vtkNew<vtkSelection> selection;\n  selection->AddNode(selectionNode);\n\n  vtkNew<vtkExtractSelection> extractSelection;\n\n  extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n  extractSelection->SetInputData(1, selection);\n  extractSelection->Update();\n\n  // In selection\n  vtkNew<vtkUnstructuredGrid> selected;\n  selected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << selected->GetNumberOfPoints()\n            << \" points in the selection.\" << std::endl;\n  std::cout << \"There are \" << selected->GetNumberOfCells()\n            << \" cells in the selection.\" << std::endl;\n\n  // Get points that are NOT in the selection.\n  selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(),\n                                      1); // invert the selection\n  extractSelection->Update();\n\n  vtkNew<vtkUnstructuredGrid> notSelected;\n  notSelected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << notSelected->GetNumberOfPoints()\n            << \" points NOT in the selection.\" << std::endl;\n  std::cout << \"There are \" << notSelected->GetNumberOfCells()\n            << \" cells NOT in the selection.\" << std::endl;\n\n  vtkNew<vtkProperty> backfaces;\n  backfaces->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkDataSetMapper> inputMapper;\n  inputMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkDataSetMapper> selectedMapper;\n  selectedMapper->SetInputData(selected);\n\n  vtkNew<vtkActor> selectedActor;\n  selectedActor->SetMapper(selectedMapper);\n  selectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  vtkNew<vtkProperty> backProperty;\n  selectedActor->SetBackfaceProperty(backProperty);\n  selectedActor->SetBackfaceProperty(backfaces);\n\n  vtkNew<vtkDataSetMapper> notSelectedMapper;\n  notSelectedMapper->SetInputData(notSelected);\n\n  vtkNew<vtkActor> notSelectedActor;\n  notSelectedActor->SetMapper(notSelectedMapper);\n  notSelectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  notSelectedActor->SetBackfaceProperty(backfaces);\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->SetWindowName(\"ExtractCellsUsingPoints\");\n\n  // And one interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, .66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Create a camera for all renderers.\n  vtkNew<vtkCamera> camera;\n\n  // Setup the renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  leftRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"orchid_dark\").GetData());\n  centerRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->AddActor(inputActor);\n  centerRenderer->AddActor(selectedActor);\n  rightRenderer->AddActor(notSelectedActor);\n\n  leftRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ExtractCellsUsingPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractCellsUsingPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractCellsUsingPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractCellsUsingPoints MACOSX_BUNDLE ExtractCellsUsingPoints.cxx )\n  target_link_libraries(ExtractCellsUsingPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractCellsUsingPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ExtractCellsUsingPoints/#download-and-build-extractcellsusingpoints","title":"Download and Build ExtractCellsUsingPoints","text":"

Click here to download ExtractCellsUsingPoints and its CMakeLists.txt file. Once the tarball ExtractCellsUsingPoints.tar has been downloaded and extracted,

cd ExtractCellsUsingPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractCellsUsingPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ExtractOutsideSurface/","title":"ExtractOutsideSurface","text":"

vtk-examples/Cxx/PolyData/ExtractOutsideSurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ExtractOutsideSurface/#description","title":"Description","text":"

This example extracts the outer surface of a multiple surface vtkPolyData model. The example assumes the outside surface is closed and there is only one outside surface. It also assumes that the center of the model lies inside the outer surface.

The example casts a ray from outside the bounds of the model into the center of the model. It uses a vtkCellLocator to intersect the ray with the model. The intersected cell is used as a seed to the [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ConnectivityFilter which is run with the extraction mode set to CellSeededRegions.

If run without arguments, the example generates a small (in area) sphere inside a large (in area) sphere. The inner sphere has more cells than the outer sphere, but should not be extracted.

The gold model is the original vtkPolyData and the blue model is the outer surface.

You can try your own surface by specifying a XML PolyData file (.vtp) on the command line.

Seealso

RemoveOutsideSurface removes the outside surface.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ExtractOutsideSurface/#code","title":"Code","text":"

ExtractOutsideSurface.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCellLocator.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // PolyData to process\n  vtkSmartPointer<vtkPolyData> polyData;\n\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Small sphere with most polgons.\n    vtkNew<vtkSphereSource> sphereSource1;\n    sphereSource1->SetThetaResolution(10);\n    sphereSource1->SetPhiResolution(10);\n    sphereSource1->SetCenter(5, 5, 5);\n    sphereSource1->SetRadius(1.5);\n\n    // Large sphere with least polygons.\n    vtkNew<vtkSphereSource> sphereSource2;\n    sphereSource2->SetRadius(10);\n    sphereSource2->SetCenter(10, 1, 10);\n\n    vtkNew<vtkAppendPolyData> appendFilter;\n    appendFilter->AddInputConnection(sphereSource1->GetOutputPort());\n    appendFilter->AddInputConnection(sphereSource2->GetOutputPort());\n    appendFilter->Update();\n    polyData = appendFilter->GetOutput();\n  }\n\n  double center[3], bounds[6];\n  polyData->GetCenter(center);\n  std::cout << \"Center of data is: \" << center[0] << \", \" << center[1] << \", \"\n            << center[2] << std::endl;\n  polyData->GetPoints()->GetBounds(bounds);\n  std::cout << \"Bounds of data is: \" << bounds[0] << \", \" << bounds[1] << \", \"\n            << bounds[2] << \", \" << bounds[3] << \", \" << bounds[4] << \", \"\n            << bounds[5] << std::endl;\n\n  // Build a cell locator.\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(polyData);\n  cellLocator->BuildLocator();\n\n  // Now fire a ray from outside the bounds to the center and find a\n  // cell. This cell should be on the outside surface.\n  double rayStart[3];\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    rayStart[i] = bounds[2 * i + 1] * 1.1;\n  }\n\n  vtkIdType cellId = -1;\n  double xyz[3], t, pcoords[3];\n  int subId;\n\n  cellLocator->IntersectWithLine(rayStart, center, 0.0001, t, xyz, pcoords,\n                                 subId, cellId);\n  std::cout << \"Id of cell on outside surface: \" << cellId << std::endl;\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputData(polyData);\n  connectivityFilter->SetExtractionModeToCellSeededRegions();\n  connectivityFilter->InitializeSeedList();\n  connectivityFilter->AddSeed(cellId);\n\n  // Create a mapper and actor for original data.\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputData(polyData);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->BackfaceCullingOn();\n  originalActor->GetProperty()->SetOpacity(0.6);\n  originalActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a mapper and actor for extracted data.\n  vtkNew<vtkPolyDataMapper> extractedMapper;\n  extractedMapper->SetInputConnection(connectivityFilter->GetOutputPort());\n\n  vtkNew<vtkActor> extractedActor;\n  extractedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n  extractedActor->SetMapper(extractedMapper);\n  extractedActor->GetProperty()->SetOpacity(0.6);\n  extractedActor->GetProperty()->BackfaceCullingOn();\n\n  // Create a renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(originalActor);\n  renderer->AddActor(extractedActor);\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"Beige\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  extractedActor->SetPosition((bounds[1] - bounds[0]) / 1.9, 0, 0);\n  originalActor->SetPosition(-(bounds[1] - bounds[0]) / 1.9, 0, 0);\n\n  // Create a render window.\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(renderer);\n  renwin->SetSize(512, 512);\n  renwin->SetWindowName(\"ExtractOutsideSurface\");\n\n  // Create an interactor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n  renwin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ExtractOutsideSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractOutsideSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractOutsideSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractOutsideSurface MACOSX_BUNDLE ExtractOutsideSurface.cxx )\n  target_link_libraries(ExtractOutsideSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractOutsideSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ExtractOutsideSurface/#download-and-build-extractoutsidesurface","title":"Download and Build ExtractOutsideSurface","text":"

Click here to download ExtractOutsideSurface and its CMakeLists.txt file. Once the tarball ExtractOutsideSurface.tar has been downloaded and extracted,

cd ExtractOutsideSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractOutsideSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ExtractPolyLinesFromPolyData/","title":"ExtractPolyLinesFromPolyData","text":"

vtk-examples/Cxx/PolyData/ExtractPolyLinesFromPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ExtractPolyLinesFromPolyData/#description","title":"Description","text":"

This example uses vtkCutter to create contour lines. It processes these lines with vtkStripper to create continuous poly lines. After exiting the example with the \"e\" key, the lines are printed.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ExtractPolyLinesFromPolyData/#code","title":"Code","text":"

ExtractPolyLinesFromPolyData.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkCutter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkStripper.h>\n\n#ifdef VTK_CELL_ARRAY_V2\n#include <vtkCellArrayIterator.h>\n#endif // VTK_CELL_ARRAY_V2\n\nint main(int, char*[])\n{\n  // Define colors for example.\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d lineColor = colors->GetColor3d(\"peacock\");\n  vtkColor3d modelColor = colors->GetColor3d(\"silver\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"wheat\");\n\n  vtkNew<vtkSphereSource> modelSource;\n\n  vtkNew<vtkPlane> plane;\n\n  vtkNew<vtkCutter> cutter;\n  cutter->SetInputConnection(modelSource->GetOutputPort());\n  cutter->SetCutFunction(plane);\n  cutter->GenerateValues(10, -0.5, 0.5);\n\n  vtkNew<vtkPolyDataMapper> modelMapper;\n  modelMapper->SetInputConnection(modelSource->GetOutputPort());\n\n  vtkNew<vtkActor> model;\n  model->SetMapper(modelMapper);\n  model->GetProperty()->SetDiffuseColor(modelColor.GetData());\n  model->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(cutter->GetOutputPort());\n  stripper->JoinContiguousSegmentsOn();\n\n  vtkNew<vtkPolyDataMapper> linesMapper;\n  linesMapper->SetInputConnection(stripper->GetOutputPort());\n\n  vtkNew<vtkActor> lines;\n  lines->SetMapper(linesMapper);\n  lines->GetProperty()->SetDiffuseColor(lineColor.GetData());\n  lines->GetProperty()->SetLineWidth(3.0);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ExtractPolyLinesFromPolyData\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer.\n  renderer->AddActor(model);\n  renderer->AddActor(lines);\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->GetActiveCamera()->Azimuth(-45);\n  renderer->GetActiveCamera()->Elevation(-22.5);\n  renderer->ResetCamera();\n\n  // This starts the event loop and as a side effect causes an initial\n  // render.\n  renderWindow->Render();\n\n  interactor->Start();\n\n  // Extract the lines from the polydata.\n  vtkIdType numberOfLines = cutter->GetOutput()->GetNumberOfLines();\n\n  std::cout << \"-----------Lines without using vtkStripper\" << std::endl;\n  std::cout << \"There are \" << numberOfLines << \" lines in the polydata\"\n            << std::endl;\n\n  numberOfLines = stripper->GetOutput()->GetNumberOfLines();\n  vtkPoints* points = stripper->GetOutput()->GetPoints();\n  vtkCellArray* cells = stripper->GetOutput()->GetLines();\n\n  std::cout << \"-----------Lines using vtkStripper\" << std::endl;\n  std::cout << \"There are \" << numberOfLines << \" lines in the polydata\"\n            << std::endl;\n\n#ifdef VTK_CELL_ARRAY_V2\n\n  // Newer versions of vtkCellArray prefer local iterators:\n  auto cellIter = vtk::TakeSmartPointer(cells->NewIterator());\n  for (cellIter->GoToFirstCell(); !cellIter->IsDoneWithTraversal();\n       cellIter->GoToNextCell())\n  {\n    std::cout << \"Line \" << cellIter->GetCurrentCellId() << \":\\n\";\n\n    vtkIdList* cell = cellIter->GetCurrentCell();\n    for (vtkIdType i = 0; i < cell->GetNumberOfIds(); ++i)\n    {\n      double point[3];\n      points->GetPoint(cell->GetId(i), point);\n      std::cout << \"\\t(\" << point[0] << \", \" << point[1] << \", \" << point[2]\n                << \")\" << std::endl;\n    }\n  }\n\n#else // VTK_CELL_ARRAY_V2\n\n  // Older implementations of vtkCellArray use internal iterator APIs (not\n  // thread safe):\n  vtkIdType* indices;\n  vtkIdType numberOfPoints;\n  unsigned int lineCount = 0;\n  for (cells->InitTraversal(); cells->GetNextCell(numberOfPoints, indices);\n       lineCount++)\n  {\n    std::cout << \"Line \" << lineCount << \": \" << std::endl;\n    for (vtkIdType i = 0; i < numberOfPoints; i++)\n    {\n      double point[3];\n      points->GetPoint(indices[i], point);\n      std::cout << \"\\t(\" << point[0] << \", \" << point[1] << \", \" << point[2]\n                << \")\" << std::endl;\n    }\n  }\n\n#endif // VTK_CELL_ARRAY_V2\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ExtractPolyLinesFromPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractPolyLinesFromPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractPolyLinesFromPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractPolyLinesFromPolyData MACOSX_BUNDLE ExtractPolyLinesFromPolyData.cxx )\n  target_link_libraries(ExtractPolyLinesFromPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractPolyLinesFromPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ExtractPolyLinesFromPolyData/#download-and-build-extractpolylinesfrompolydata","title":"Download and Build ExtractPolyLinesFromPolyData","text":"

Click here to download ExtractPolyLinesFromPolyData and its CMakeLists.txt file. Once the tarball ExtractPolyLinesFromPolyData.tar has been downloaded and extracted,

cd ExtractPolyLinesFromPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractPolyLinesFromPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ExtractSelection/","title":"ExtractSelection","text":"

vtk-examples/Cxx/PolyData/ExtractSelection

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ExtractSelection/#description","title":"Description","text":"

This example creates 50 random points and extracts 10 of them (the points with ids 10-19).

Also demonstrated is how to invert the selection.

The three actors in the render window display from left to right:

  • all the points
  • the selected points
  • the points not selected.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ExtractSelection/#code","title":"Code","text":"

ExtractSelection.cxx

#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInformation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\n// #include <array>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // std::array<double, 4> bkgL = {{0.6, 0.5, 0.4, 1.0}};\n  // std::array<double, 4> bkgC = {{0.3, 0.1, 0.4, 1.0}};\n  // std::array<double, 4> bkgR = {{0.4, 0.5, 0.6, 1.0}};\n  // colors->SetColor(\"leftBkg\", bkgL.data());\n  // colors->SetColor(\"centreBkg\", bkgC.data());\n  // colors->SetColor(\"rightBkg\", bkgR.data());\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(50);\n  pointSource->Update();\n\n  std::cout << \"There are \" << pointSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  // Set values.\n  for (unsigned int i = 10; i < 20; i++)\n  {\n    ids->InsertNextValue(i);\n  }\n\n  vtkNew<vtkSelectionNode> selectionNode;\n  selectionNode->SetFieldType(vtkSelectionNode::POINT);\n  selectionNode->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode->SetSelectionList(ids);\n\n  vtkNew<vtkSelection> selection;\n  selection->AddNode(selectionNode);\n\n  vtkNew<vtkExtractSelection> extractSelection;\n  extractSelection->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelection->SetInputData(1, selection);\n  extractSelection->Update();\n\n  // In selection.\n  vtkNew<vtkUnstructuredGrid> selected;\n  selected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << selected->GetNumberOfPoints() << \" points and \";\n  std::cout << selected->GetNumberOfCells() << \" cells in the selection.\"\n            << std::endl;\n\n  // Get points that are NOT in the selection.\n  selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(),\n                                      1); // invert the selection\n  extractSelection->Update();\n\n  vtkNew<vtkUnstructuredGrid> notSelected;\n  notSelected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << notSelected->GetNumberOfPoints()\n            << \" points and \";\n  std::cout << notSelected->GetNumberOfCells() << \" cells NOT in the selection.\"\n            << std::endl;\n\n  vtkNew<vtkDataSetMapper> inputMapper;\n  inputMapper->SetInputConnection(pointSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  inputActor->GetProperty()->SetPointSize(5);\n\n  vtkNew<vtkDataSetMapper> selectedMapper;\n  selectedMapper->SetInputData(selected);\n\n  vtkNew<vtkActor> selectedActor;\n  selectedActor->SetMapper(selectedMapper);\n  selectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  selectedActor->GetProperty()->SetPointSize(5);\n\n  vtkNew<vtkDataSetMapper> notSelectedMapper;\n  notSelectedMapper->SetInputData(notSelected);\n\n  vtkNew<vtkActor> notSelectedActor;\n  notSelectedActor->SetMapper(notSelectedMapper);\n  notSelectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  notSelectedActor->GetProperty()->SetPointSize(5);\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->SetWindowName(\"ExtractSelection\");\n\n  // And one interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges (xmin, ymin, xmax, ymax).\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, .66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Create a camera for all renderers.\n  vtkNew<vtkCamera> camera;\n\n  // Setup the renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  leftRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"orchid_dark\").GetData());\n  centerRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->AddActor(inputActor);\n  centerRenderer->AddActor(selectedActor);\n  rightRenderer->AddActor(notSelectedActor);\n\n  leftRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ExtractSelection/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractSelection)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractSelection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractSelection MACOSX_BUNDLE ExtractSelection.cxx )\n  target_link_libraries(ExtractSelection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractSelection\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ExtractSelection/#download-and-build-extractselection","title":"Download and Build ExtractSelection","text":"

Click here to download ExtractSelection and its CMakeLists.txt file. Once the tarball ExtractSelection.tar has been downloaded and extracted,

cd ExtractSelection/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractSelection\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ExtractSelectionCells/","title":"ExtractSelectionCells","text":"

vtk-examples/Cxx/PolyData/ExtractSelectionCells

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ExtractSelectionCells/#code","title":"Code","text":"

ExtractSelectionCells.cxx

#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInformation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\n// #include <array>\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // std::array<double, 4> bkgL = {{0.6, 0.5, 0.4, 1.0}};\n  // std::array<double, 4> bkgC = {{0.3, 0.1, 0.4, 1.0}};\n  // std::array<double, 4> bkgR = {{0.4, 0.5, 0.6, 1.0}};\n  // colors->SetColor(\"leftBkg\", bkgL.data());\n  // colors->SetColor(\"centreBkg\", bkgC.data());\n  // colors->SetColor(\"rightBkg\", bkgR.data());\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfCells()\n            << \" input cells.\" << std::endl;\n\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  // Specify that we want to extract cells 10 through 19.\n  for (unsigned int i = 10; i < 20; i++)\n  {\n    ids->InsertNextValue(i);\n  }\n\n  vtkNew<vtkSelectionNode> selectionNode;\n  selectionNode->SetFieldType(vtkSelectionNode::CELL);\n  selectionNode->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode->SetSelectionList(ids);\n\n  vtkNew<vtkSelection> selection;\n  selection->AddNode(selectionNode);\n\n  vtkNew<vtkExtractSelection> extractSelection;\n  extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n  extractSelection->SetInputData(1, selection);\n  extractSelection->Update();\n\n  // In selection.\n  vtkNew<vtkUnstructuredGrid> selected;\n  selected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << selected->GetNumberOfPoints()\n            << \" points in the selection.\" << std::endl;\n  std::cout << \"There are \" << selected->GetNumberOfCells()\n            << \" cells in the selection.\" << std::endl;\n\n  // Get points that are NOT in the selection.\n  selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(),\n                                      1); // invert the selection\n  extractSelection->Update();\n\n  vtkNew<vtkUnstructuredGrid> notSelected;\n  notSelected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << notSelected->GetNumberOfPoints()\n            << \" points NOT in the selection.\" << std::endl;\n  std::cout << \"There are \" << notSelected->GetNumberOfCells()\n            << \" cells NOT in the selection.\" << std::endl;\n\n  vtkNew<vtkProperty> backfaces;\n  backfaces->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkDataSetMapper> inputMapper;\n  inputMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  inputActor->SetBackfaceProperty(backfaces);\n\n  vtkNew<vtkDataSetMapper> selectedMapper;\n  selectedMapper->SetInputData(selected);\n\n  vtkNew<vtkActor> selectedActor;\n  selectedActor->SetMapper(selectedMapper);\n  selectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  selectedActor->SetBackfaceProperty(backfaces);\n\n  vtkNew<vtkDataSetMapper> notSelectedMapper;\n  notSelectedMapper->SetInputData(notSelected);\n\n  vtkNew<vtkActor> notSelectedActor;\n  notSelectedActor->SetMapper(notSelectedMapper);\n  notSelectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  notSelectedActor->SetBackfaceProperty(backfaces);\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->SetWindowName(\"ExtractSelectionCells\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, .66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Create a camera for all renderers.\n  vtkNew<vtkCamera> camera;\n\n  // Setup the renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  leftRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"orchid_dark\").GetData());\n  centerRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->AddActor(inputActor);\n  centerRenderer->AddActor(selectedActor);\n  rightRenderer->AddActor(notSelectedActor);\n\n  leftRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ExtractSelectionCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractSelectionCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractSelectionCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractSelectionCells MACOSX_BUNDLE ExtractSelectionCells.cxx )\n  target_link_libraries(ExtractSelectionCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractSelectionCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ExtractSelectionCells/#download-and-build-extractselectioncells","title":"Download and Build ExtractSelectionCells","text":"

Click here to download ExtractSelectionCells and its CMakeLists.txt file. Once the tarball ExtractSelectionCells.tar has been downloaded and extracted,

cd ExtractSelectionCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractSelectionCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ExtractSelectionOriginalId/","title":"ExtractSelectionOriginalId","text":"

vtk-examples/Cxx/PolyData/ExtractSelectionOriginalId

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ExtractSelectionOriginalId/#code","title":"Code","text":"

ExtractSelectionOriginalId.cxx

#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(50);\n  pointSource->Update();\n\n  std::cout << \"There are \" << pointSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  // set values\n  for (unsigned int i = 10; i < 20; i++)\n  {\n    ids->InsertNextValue(i);\n  }\n\n  vtkNew<vtkSelectionNode> selectionNode;\n  selectionNode->SetFieldType(vtkSelectionNode::POINT);\n  selectionNode->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode->SetSelectionList(ids);\n\n  vtkNew<vtkSelection> selection;\n  selection->AddNode(selectionNode);\n\n  vtkNew<vtkExtractSelection> extractSelection;\n\n  extractSelection->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelection->SetInputData(1, selection);\n  extractSelection->Update();\n\n  // in selection\n  vtkNew<vtkUnstructuredGrid> selected;\n  selected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << selected->GetNumberOfPoints()\n            << \" points in the selection.\" << std::endl;\n\n  selected->Print(std::cout);\n\n  vtkIdTypeArray* originalIds = dynamic_cast<vtkIdTypeArray*>(\n      selected->GetPointData()->GetArray(\"vtkOriginalPointIds\"));\n\n  for (vtkIdType i = 0; i < originalIds->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Point \" << i << \" was originally point \"\n              << originalIds->GetValue(i) << std::endl;\n  }\n\n  for (vtkIdType i = 0; i < originalIds->GetNumberOfTuples(); i++)\n  {\n    vtkIdType query = originalIds->GetValue(i);\n    for (vtkIdType j = 0; j < originalIds->GetNumberOfTuples(); j++)\n    {\n      if (originalIds->GetValue(j) == query)\n      {\n        std::cout << \"Original point \" << query << \" is now \" << j << std::endl;\n      }\n    }\n  }\n\n  vtkNew<vtkDataSetMapper> inputMapper;\n  inputMapper->SetInputConnection(pointSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  inputActor->GetProperty()->SetPointSize(5);\n\n  vtkNew<vtkDataSetMapper> selectedMapper;\n  selectedMapper->SetInputData(selected);\n\n  vtkNew<vtkActor> selectedActor;\n  selectedActor->SetMapper(selectedMapper);\n  selectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  selectedActor->GetProperty()->SetPointSize(5);\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"ExtractSelectionOriginalId\");\n\n  // And one interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Create a camera for all renderers.\n  vtkNew<vtkCamera> camera;\n\n  // Setup the renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  leftRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(selectedActor);\n\n  leftRenderer->ResetCamera();\n  // rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ExtractSelectionOriginalId/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractSelectionOriginalId)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractSelectionOriginalId: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractSelectionOriginalId MACOSX_BUNDLE ExtractSelectionOriginalId.cxx )\n  target_link_libraries(ExtractSelectionOriginalId PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractSelectionOriginalId\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ExtractSelectionOriginalId/#download-and-build-extractselectionoriginalid","title":"Download and Build ExtractSelectionOriginalId","text":"

Click here to download ExtractSelectionOriginalId and its CMakeLists.txt file. Once the tarball ExtractSelectionOriginalId.tar has been downloaded and extracted,

cd ExtractSelectionOriginalId/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractSelectionOriginalId\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/FieldData/","title":"FieldData","text":"

vtk-examples/Cxx/PolyData/FieldData

"},{"location":"Cxx/PolyData/FieldData/#description","title":"Description","text":"

Three types of data can be stored in a vtkPolyData object - PointData, CellData, and FieldData. For PointData, there must be a piece of data associated with each point (e.g. a temperature data array with the temperature at each point). For CellData, there must be a piece of data associated with each cell (e.g. the area of each triangle). For data that does not align with either points or cells, FieldData should be used. This is typically data that describes the dataset as a whole. An example could be the name of the dataset, or the center of mass of the points, etc.

This demo adds general data to a polydata (not at each point or cell). In this example, the center of mass of the data is stored.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/FieldData/#code","title":"Code","text":"

FieldData.cxx

#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> source;\n  source->Update();\n\n  // Extract the polydata.\n  vtkNew<vtkPolyData> polydata;\n  polydata->ShallowCopy(source->GetOutput());\n\n  vtkNew<vtkDoubleArray> location;\n\n  // Create the data to store (here we just use (0,0,0)).\n  double locationValue[3] = {0, 0, 0};\n\n  location->SetNumberOfComponents(3);\n  location->SetName(\"MyDoubleArray\");\n  location->InsertNextTuple(locationValue);\n  // The data is added to FIELD data (rather than POINT data as usual).\n  polydata->GetFieldData()->AddArray(location);\n\n  vtkNew<vtkIntArray> intValue;\n  intValue->SetNumberOfComponents(1);\n  intValue->SetName(\"MyIntValue\");\n  intValue->InsertNextValue(5);\n\n  polydata->GetFieldData()->AddArray(intValue);\n\n  // Get the data back out\n  auto retrievedArray = dynamic_cast<vtkIntArray*>(\n      polydata->GetFieldData()->GetAbstractArray(\"MyIntValue\"));\n\n  std::cout << retrievedArray->GetValue(0) << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/FieldData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FieldData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FieldData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FieldData MACOSX_BUNDLE FieldData.cxx )\n  target_link_libraries(FieldData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FieldData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/FieldData/#download-and-build-fielddata","title":"Download and Build FieldData","text":"

Click here to download FieldData and its CMakeLists.txt file. Once the tarball FieldData.tar has been downloaded and extracted,

cd FieldData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FieldData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/FitSplineToCutterOutput/","title":"FitSplineToCutterOutput","text":"

vtk-examples/Cxx/PolyData/FitSplineToCutterOutput

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/FitSplineToCutterOutput/#description","title":"Description","text":"

This examples cuts a vtkPolydata and fits a vtkKochanekSpline to the resulting polylines. The cut lines are passed through vtkStripper to make them into connected polylines. Then, the lines are passed through vtkTubeFilter to improve the visualization.

The examples takes an optional argument that specifies a vtk polydata file (.vtp). If run without an argument, it processes a sphere.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/FitSplineToCutterOutput/#code","title":"Code","text":"

FitSplineToCutterOutput.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkCutter.h>\n#include <vtkKochanekSpline.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSplineFilter.h>\n#include <vtkStripper.h>\n#include <vtkTubeFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\n#ifdef VTK_CELL_ARRAY_V2\n#include <vtkCellArrayIterator.h>\n#endif // VTK_CELL_ARRAY_V2\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> modelSource;\n    modelSource->Update();\n    polyData = modelSource->GetOutput();\n  }\n\n  double length = polyData->GetLength();\n\n  vtkNew<vtkPlane> plane;\n  plane->SetNormal(0, 1, 1);\n  plane->SetOrigin(polyData->GetCenter());\n\n  vtkNew<vtkCutter> cutter;\n  cutter->SetInputData(polyData);\n  cutter->SetCutFunction(plane);\n  cutter->GenerateValues(1, 0.0, 0.0);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> modelMapper;\n  modelMapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> model;\n  model->SetMapper(modelMapper);\n  model->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  model->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(cutter->GetOutputPort());\n\n  vtkNew<vtkKochanekSpline> spline;\n  spline->SetDefaultTension(.5);\n\n  vtkNew<vtkSplineFilter> sf;\n  sf->SetInputConnection(stripper->GetOutputPort());\n  sf->SetSubdivideToSpecified();\n  sf->SetNumberOfSubdivisions(50);\n  sf->SetSpline(spline);\n  sf->GetSpline()->ClosedOn();\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(sf->GetOutputPort());\n  tubes->SetNumberOfSides(8);\n  tubes->SetRadius(length / 100.0);\n\n  vtkNew<vtkPolyDataMapper> linesMapper;\n  linesMapper->SetInputConnection(tubes->GetOutputPort());\n  linesMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> lines;\n  lines->SetMapper(linesMapper);\n  lines->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer.\n  renderer->AddActor(model);\n  renderer->AddActor(lines);\n\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->GetActiveCamera()->Azimuth(300);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"FitSplineToCutterOutput\");\n\n  // This starts the event loop and as a side effect causes an initial\n  // render.\n  renderWindow->Render();\n  interactor->Start();\n\n  // Extract the lines from the polydata.\n  vtkIdType numberOfLines = cutter->GetOutput()->GetNumberOfLines();\n\n  std::cout << \"-----------Lines without using vtkStripper\" << std::endl;\n  if (numberOfLines == 1)\n  {\n    std::cout << \"There is \" << numberOfLines << \" line in the polydata\"\n              << std::endl;\n  }\n  else\n  {\n    std::cout << \"There are \" << numberOfLines << \" lines in the polydata\"\n              << std::endl;\n  }\n  numberOfLines = stripper->GetOutput()->GetNumberOfLines();\n  vtkPoints* points = stripper->GetOutput()->GetPoints();\n  vtkCellArray* cells = stripper->GetOutput()->GetLines();\n\n  std::cout << \"-----------Lines using vtkStripper\" << std::endl;\n  if (numberOfLines == 1)\n  {\n    std::cout << \"There is \" << numberOfLines << \" line in the polydata\"\n              << std::endl;\n  }\n  else\n  {\n\n    std::cout << \"There are \" << numberOfLines << \" lines in the polydata\"\n              << std::endl;\n  }\n\n#ifdef VTK_CELL_ARRAY_V2\n\n  // Newer versions of vtkCellArray prefer local iterators:\n  auto cellIter = vtk::TakeSmartPointer(cells->NewIterator());\n  for (cellIter->GoToFirstCell(); !cellIter->IsDoneWithTraversal();\n       cellIter->GoToNextCell())\n  {\n    std::cout << \"Line \" << cellIter->GetCurrentCellId() << \":\\n\";\n\n    vtkIdList* cell = cellIter->GetCurrentCell();\n    for (vtkIdType i = 0; i < cell->GetNumberOfIds(); ++i)\n    {\n      double point[3];\n      points->GetPoint(cell->GetId(i), point);\n      std::cout << \"\\t(\" << point[0] << \", \" << point[1] << \", \" << point[2]\n                << \")\" << std::endl;\n    }\n  }\n\n#else // VTK_CELL_ARRAY_V2\n\n  // Older implementations of vtkCellArray use internal iterator APIs (not\n  // thread safe):\n  vtkIdType* indices;\n  vtkIdType numberOfPoints;\n  unsigned int lineCount = 0;\n  for (cells->InitTraversal(); cells->GetNextCell(numberOfPoints, indices);\n       lineCount++)\n  {\n    std::cout << \"Line \" << lineCount << \": \" << std::endl;\n    for (vtkIdType i = 0; i < numberOfPoints; i++)\n    {\n      double point[3];\n      points->GetPoint(indices[i], point);\n      std::cout << \"\\t(\" << point[0] << \", \" << point[1] << \", \" << point[2]\n                << \")\" << std::endl;\n    }\n  }\n\n#endif // VTK_CELL_ARRAY_V2\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/FitSplineToCutterOutput/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FitSplineToCutterOutput)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FitSplineToCutterOutput: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FitSplineToCutterOutput MACOSX_BUNDLE FitSplineToCutterOutput.cxx )\n  target_link_libraries(FitSplineToCutterOutput PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FitSplineToCutterOutput\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/FitSplineToCutterOutput/#download-and-build-fitsplinetocutteroutput","title":"Download and Build FitSplineToCutterOutput","text":"

Click here to download FitSplineToCutterOutput and its CMakeLists.txt file. Once the tarball FitSplineToCutterOutput.tar has been downloaded and extracted,

cd FitSplineToCutterOutput/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FitSplineToCutterOutput\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/GeometryFilter/","title":"GeometryFilter","text":"

vtk-examples/Cxx/PolyData/GeometryFilter

"},{"location":"Cxx/PolyData/GeometryFilter/#description","title":"Description","text":"

This example demonstrates how to convert an unstructured grid to a polydata. Currently nothing is done with the resulting polydata.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/GeometryFilter/#code","title":"Code","text":"

GeometryFilter.cxx

#include <vtkGeometryFilter.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n#include <vtkVertex.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid> MakeUnstructuredGrid(vtkSmartPointer<T>);\n}\n\nint main(int argc, char* argv[])\n{\n  auto geometryFilter = vtkSmartPointer<vtkGeometryFilter>::New();\n  if (argc < 2)\n  {\n    // std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtk) e.g. uGridEx.vtk \"\n    //          << std::endl;\n    auto unstructuredGrid =\n        MakeUnstructuredGrid(vtkSmartPointer<vtkVertex>::New());\n    geometryFilter->SetInputData(unstructuredGrid);\n  }\n  else\n  {\n    // Create the reader for the data.\n    // This is the data that will be rendered.\n    std::string filename = argv[1];\n    std::cout << \"Loading \" << filename.c_str() << std::endl;\n    vtkNew<vtkUnstructuredGridReader> reader;\n    reader->SetFileName(filename.c_str());\n    geometryFilter->SetInputConnection(reader->GetOutputPort());\n  }\n\n  geometryFilter->Update();\n\n  vtkPolyData* polydata = geometryFilter->GetOutput();\n\n  std::cout << \"Output has \" << polydata->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid>\nMakeUnstructuredGrid(vtkSmartPointer<T> aCell)\n{\n  double* pcoords = aCell->GetParametricCoords();\n  for (int i = 0; i < aCell->GetNumberOfPoints(); ++i)\n  {\n    aCell->GetPointIds()->SetId(i, i);\n    aCell->GetPoints()->SetPoint(i, *(pcoords + 3 * i), *(pcoords + 3 * i + 1),\n                                 *(pcoords + 3 * i + 2));\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(aCell->GetPoints());\n  ug->InsertNextCell(aCell->GetCellType(), aCell->GetPointIds());\n  return ug;\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/GeometryFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GeometryFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  IOLegacy\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GeometryFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GeometryFilter MACOSX_BUNDLE GeometryFilter.cxx )\n  target_link_libraries(GeometryFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GeometryFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/GeometryFilter/#download-and-build-geometryfilter","title":"Download and Build GeometryFilter","text":"

Click here to download GeometryFilter and its CMakeLists.txt file. Once the tarball GeometryFilter.tar has been downloaded and extracted,

cd GeometryFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GeometryFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/GetMiscCellData/","title":"GetMiscCellData","text":"

vtk-examples/Cxx/PolyData/GetMiscCellData

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/GetMiscCellData/#code","title":"Code","text":"

GetMiscCellData.cxx

#include <vtkCellData.h>\n#include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 3)\n  {\n    std::cout << \"Required arguments: Filename ArrayName e.g. SuperQuadric.vtp \"\n                 \"Normals\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Get filename from command line.\n  std::string filename = argv[1]; // First command line argument.\n\n  // Get array name\n  std::string arrayName = argv[2]; // Second command line argument.\n\n  // Read the file.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  auto polydata = reader->GetOutput();\n\n  // Get the number of cells in the polydata.\n  vtkIdType idNumCellsInFile = polydata->GetNumberOfCells();\n\n  auto array = dynamic_cast<vtkFloatArray*>(\n      polydata->GetCellData()->GetArray(arrayName.c_str()));\n\n  if (array)\n  {\n    std::cout << \"Got array \" << arrayName << \" with \" << idNumCellsInFile\n              << \" values\" << std::endl;\n    for (int i = 0; i < idNumCellsInFile; i++)\n    {\n      // Since there could be a lot of cells just print the first 10\n      if (i < 10 || i == idNumCellsInFile - 1)\n      {\n        double value;\n        value = array->GetValue(i);\n        std::cout << i << \": \" << value << std::endl;\n      }\n      else\n      {\n        if (i == 10)\n          std::cout << \"...\" << std::endl;\n      }\n    }\n  }\n  else\n  {\n    std::cout << \"The file \" << filename\n              << \" does not have a CellData array named \" << arrayName\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/GetMiscCellData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetMiscCellData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetMiscCellData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetMiscCellData MACOSX_BUNDLE GetMiscCellData.cxx )\n  target_link_libraries(GetMiscCellData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetMiscCellData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/GetMiscCellData/#download-and-build-getmisccelldata","title":"Download and Build GetMiscCellData","text":"

Click here to download GetMiscCellData and its CMakeLists.txt file. Once the tarball GetMiscCellData.tar has been downloaded and extracted,

cd GetMiscCellData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GetMiscCellData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/GetMiscPointData/","title":"GetMiscPointData","text":"

vtk-examples/Cxx/PolyData/GetMiscPointData

"},{"location":"Cxx/PolyData/GetMiscPointData/#description","title":"Description","text":"

This example demonstrates how to get data stored at each point in a polydata.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/GetMiscPointData/#code","title":"Code","text":"

GetMiscPointData.cxx

#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 3)\n  {\n    std::cout << \"Required arguments: Filename ArrayName e.g. cowHead.vtp \"\n                 \"Gauss_Curvature\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Get filename from command line.\n  std::string filename = argv[1]; // First command line argument.\n\n  // Get array name.\n  std::string arrayName = argv[2]; // Second command line argument.\n\n  // Read the file.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  std::cout << \"Reading \" << filename << std::endl;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Extract the polydata.\n  auto polydata = reader->GetOutput();\n\n  // Get the number of points in the polydata.\n  vtkIdType idNumPointsInFile = polydata->GetNumberOfPoints();\n\n  auto array = dynamic_cast<vtkDoubleArray*>(\n      polydata->GetPointData()->GetArray(arrayName.c_str()));\n\n  if (array)\n  {\n    std::cout << \"Got array \" << arrayName << \" with \" << idNumPointsInFile\n              << \" values\" << std::endl;\n    for (int i = 0; i < idNumPointsInFile; i++)\n    {\n      // Since there could be a lot of points just print the first 10\n      if (i < 10 || i == idNumPointsInFile - 1)\n      {\n        double value;\n        value = array->GetValue(i);\n        std::cout << i << \": \" << value << std::endl;\n      }\n      else\n      {\n        if (i == 10)\n          std::cout << \"...\" << std::endl;\n      }\n    }\n  }\n  else\n  {\n    std::cout << \"The file \" << filename\n              << \" does not have a PointData array named \" << arrayName\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/GetMiscPointData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetMiscPointData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetMiscPointData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetMiscPointData MACOSX_BUNDLE GetMiscPointData.cxx )\n  target_link_libraries(GetMiscPointData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetMiscPointData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/GetMiscPointData/#download-and-build-getmiscpointdata","title":"Download and Build GetMiscPointData","text":"

Click here to download GetMiscPointData and its CMakeLists.txt file. Once the tarball GetMiscPointData.tar has been downloaded and extracted,

cd GetMiscPointData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GetMiscPointData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/GradientFilter/","title":"GradientFilter","text":"

vtk-examples/Cxx/PolyData/GradientFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/GradientFilter/#description","title":"Description","text":"

Computes the gradient of a scalar field defined on the points of a data set.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/GradientFilter/#code","title":"Code","text":"

GradientFilter.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkAssignAttribute.h>\n#include <vtkCamera.h>\n#include <vtkExtractEdges.h>\n#include <vtkGlyph3D.h>\n#include <vtkGradientFilter.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGridReader.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtk) e.g. uGridEx.vtk \"\n              << std::endl;\n  }\n  // Create the reader for the data.\n  // This is the data that will be rendered.\n  std::string filename = argv[1];\n  std::cout << \"Loading \" << filename.c_str() << std::endl;\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n\n  vtkNew<vtkExtractEdges> edges;\n  edges->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(edges->GetOutputPort());\n  tubes->SetRadius(0.0625);\n  tubes->SetVaryRadiusToVaryRadiusOff();\n  tubes->SetNumberOfSides(32);\n\n  vtkNew<vtkPolyDataMapper> tubesMapper;\n  tubesMapper->SetInputConnection(tubes->GetOutputPort());\n  tubesMapper->SetScalarRange(0.0, 26.0);\n\n  vtkNew<vtkActor> tubesActor;\n  tubesActor->SetMapper(tubesMapper);\n\n  vtkNew<vtkGradientFilter> gradients;\n  gradients->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkAssignAttribute> vectors;\n  vectors->SetInputConnection(gradients->GetOutputPort());\n  vectors->Assign(\"Gradients\", vtkDataSetAttributes::VECTORS,\n                  vtkAssignAttribute::POINT_DATA);\n\n  vtkNew<vtkArrowSource> arrow;\n\n  vtkNew<vtkGlyph3D> glyphs;\n  glyphs->SetInputConnection(0, vectors->GetOutputPort());\n  glyphs->SetInputConnection(1, arrow->GetOutputPort());\n  glyphs->ScalingOn();\n  glyphs->SetScaleModeToScaleByVector();\n  glyphs->SetScaleFactor(0.25);\n  glyphs->OrientOn();\n  glyphs->ClampingOff();\n  glyphs->SetVectorModeToUseVector();\n  glyphs->SetIndexModeToOff();\n\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyphs->GetOutputPort());\n  glyphMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyphMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(tubesActor);\n  renderer->AddActor(glyphActor);\n  renderer->SetBackground(0.328125, 0.347656, 0.425781);\n\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(renderer);\n  renwin->SetSize(350, 500);\n  renwin->SetWindowName(\"GradientFilter\");\n\n  renderer->ResetCamera();\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->Elevation(-80.0);\n  camera->OrthogonalizeViewUp();\n  camera->Azimuth(135.0);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n  renwin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/GradientFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GradientFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GradientFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GradientFilter MACOSX_BUNDLE GradientFilter.cxx )\n  target_link_libraries(GradientFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GradientFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/GradientFilter/#download-and-build-gradientfilter","title":"Download and Build GradientFilter","text":"

Click here to download GradientFilter and its CMakeLists.txt file. Once the tarball GradientFilter.tar has been downloaded and extracted,

cd GradientFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GradientFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/GreedyTerrainDecimation/","title":"GreedyTerrainDecimation","text":"

vtk-examples/Cxx/PolyData/GreedyTerrainDecimation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/GreedyTerrainDecimation/#code","title":"Code","text":"

GreedyTerrainDecimation.cxx

#include <vtkActor.h>\n#include <vtkGreedyTerrainDecimation.h>\n#include <vtkImageData.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageData> image;\n  image->SetDimensions(3, 3, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n\n  int dims[3];\n  image->GetDimensions(dims);\n  for (int i = 0; i < dims[0]; i++)\n  {\n    for (int j = 0; j < dims[1]; j++)\n    {\n      auto pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(i, j, 0));\n      // pixel[0] = vtkMath::Round(vtkMath::Random(0, 255));\n      pixel[0] = vtkMath::Round(randomSequence->GetRangeValue(0.0, 5.0));\n      randomSequence->Next();\n    }\n  }\n\n  vtkNew<vtkGreedyTerrainDecimation> decimation;\n  decimation->SetInputData(image);\n  decimation->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(decimation->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Red\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"GreedyTerrainDecimation\");\n\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/GreedyTerrainDecimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GreedyTerrainDecimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GreedyTerrainDecimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GreedyTerrainDecimation MACOSX_BUNDLE GreedyTerrainDecimation.cxx )\n  target_link_libraries(GreedyTerrainDecimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GreedyTerrainDecimation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/GreedyTerrainDecimation/#download-and-build-greedyterraindecimation","title":"Download and Build GreedyTerrainDecimation","text":"

Click here to download GreedyTerrainDecimation and its CMakeLists.txt file. Once the tarball GreedyTerrainDecimation.tar has been downloaded and extracted,

cd GreedyTerrainDecimation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GreedyTerrainDecimation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/HighlightBadCells/","title":"HighlightBadCells","text":"

vtk-examples/Cxx/PolyData/HighlightBadCells

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/HighlightBadCells/#code","title":"Code","text":"

HighlightBadCells.cxx

#include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkDataSet.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkMeshQuality.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkThreshold.h>\n#include <vtkTriangleFilter.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(sphereSource->GetOutputPort());\n  triangleFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> sphereMapper;\n  sphereMapper->SetInputConnection(triangleFilter->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkPolyData* mesh = triangleFilter->GetOutput();\n  cout << \"There are \" << mesh->GetNumberOfCells() << \" cells.\" << endl;\n\n  vtkNew<vtkMeshQuality> qualityFilter;\n  qualityFilter->SetInputData(mesh);\n  qualityFilter->SetTriangleQualityMeasureToArea();\n  qualityFilter->Update();\n\n  vtkDataSet* qualityMesh = qualityFilter->GetOutput();\n  auto qualityArray = dynamic_cast<vtkDoubleArray*>(\n      qualityMesh->GetCellData()->GetArray(\"Quality\"));\n\n  cout << \"There are \" << qualityArray->GetNumberOfTuples() << \" values.\"\n       << endl;\n\n  for (vtkIdType i = 0; i < qualityArray->GetNumberOfTuples(); i++)\n  {\n    double val = qualityArray->GetValue(i);\n    cout << \"value \" << i << \" : \" << val << endl;\n  }\n\n  vtkNew<vtkThreshold> selectCells;\n  // selectCells->ThresholdByLower(.02);\n  selectCells->SetLowerThreshold(0.02);\n  selectCells->SetThresholdFunction(vtkThreshold::THRESHOLD_LOWER);\n  selectCells->SetInputArrayToProcess(0, 0, 0,\n                                      vtkDataObject::FIELD_ASSOCIATION_CELLS,\n                                      vtkDataSetAttributes::SCALARS);\n  selectCells->SetInputData(qualityMesh);\n  selectCells->Update();\n\n  vtkUnstructuredGrid* ug = selectCells->GetOutput();\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(ug);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n  actor->GetProperty()->SetLineWidth(5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HighlightBadCells\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/HighlightBadCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HighlightBadCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  FiltersVerdict\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HighlightBadCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HighlightBadCells MACOSX_BUNDLE HighlightBadCells.cxx )\n  target_link_libraries(HighlightBadCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HighlightBadCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/HighlightBadCells/#download-and-build-highlightbadcells","title":"Download and Build HighlightBadCells","text":"

Click here to download HighlightBadCells and its CMakeLists.txt file. Once the tarball HighlightBadCells.tar has been downloaded and extracted,

cd HighlightBadCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HighlightBadCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ImplicitDataSetClipping/","title":"ImplicitDataSetClipping","text":"

vtk-examples/Cxx/PolyData/ImplicitDataSetClipping

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ImplicitDataSetClipping/#description","title":"Description","text":"

This example demonstrates how to clip one object with another.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ImplicitDataSetClipping/#code","title":"Code","text":"

ImplicitDataSetClipping.cxx

#include <vtkActor.h>\n#include <vtkBox.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkClipPolyData.h>\n#include <vtkCubeSource.h>\n#include <vtkDataSetWriter.h>\n#include <vtkIdFilter.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid WritePolyData(vtkPolyData* const polyData, const std::string& filename);\n\nvoid WriteDataSet(vtkDataSet* const dataSet, const std::string& filename);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // colors->SetColor(\"Bkg\", 0.2, 0.3, 0.4);\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(.75, 0, 0);\n\n  unsigned int res = 10;\n  sphereSource->SetThetaResolution(res);\n  sphereSource->SetPhiResolution(res);\n  sphereSource->Update();\n\n  std::cout << \"The sphere has \"\n            << sphereSource->GetOutput()->GetNumberOfPoints() << \" points.\"\n            << \" and \" << sphereSource->GetOutput()->GetNumberOfCells()\n            << \" cells. \" << std::endl;\n\n  // Add ids to the points and cells of the sphere.\n  vtkNew<vtkIdFilter> cellIdFilter;\n  cellIdFilter->SetInputConnection(sphereSource->GetOutputPort());\n  cellIdFilter->SetCellIds(true);\n  cellIdFilter->SetPointIds(false);\n#if VTK890\n  cellIdFilter->SetCellIdsArrayName(\"CellIds\");\n#else\n  cellIdFilter->SetIdsArrayName(\"CellIds\");\n#endif\n  cellIdFilter->Update();\n\n  WriteDataSet(cellIdFilter->GetOutput(), \"CellIdFilter.vtp\");\n\n  vtkNew<vtkIdFilter> pointIdFilter;\n  pointIdFilter->SetInputConnection(cellIdFilter->GetOutputPort());\n  pointIdFilter->SetCellIds(false);\n  pointIdFilter->SetPointIds(true);\n#if VTK890\n  pointIdFilter->SetPointIdsArrayName(\"PointIds\");\n#else\n  pointIdFilter->SetIdsArrayName(\"PointIds\");\n#endif\n  pointIdFilter->Update();\n\n  vtkDataSet* sphereWithIds = pointIdFilter->GetOutput();\n\n  WriteDataSet(sphereWithIds, \"BothIdFilter.vtp\");\n\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  vtkNew<vtkBox> implicitCube;\n  implicitCube->SetBounds(cubeSource->GetOutput()->GetBounds());\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetClipFunction(implicitCube);\n  clipper->SetInputData(sphereWithIds);\n  clipper->InsideOutOn();\n  clipper->Update();\n\n  WriteDataSet(clipper->GetOutput(), \"clipper.vtp\");\n\n  // Get the clipped cell ids.\n  vtkPolyData* clipped = clipper->GetOutput();\n\n  std::cout << \"There are \" << clipped->GetNumberOfPoints()\n            << \" clipped points.\" << std::endl;\n  std::cout << \"There are \" << clipped->GetNumberOfCells() << \" clipped cells.\"\n            << std::endl;\n\n  vtkIdTypeArray* clippedCellIds = dynamic_cast<vtkIdTypeArray*>(\n      clipped->GetCellData()->GetArray(\"CellIds\"));\n\n  for (vtkIdType i = 0; i < clippedCellIds->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Clipped cell id \" << i << \" : \" << clippedCellIds->GetValue(i)\n              << std::endl;\n  }\n\n  // Create a mapper and actor for clipped sphere.\n  vtkNew<vtkPolyDataMapper> clippedMapper;\n  clippedMapper->SetInputConnection(clipper->GetOutputPort());\n  clippedMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clippedActor;\n  clippedActor->SetMapper(clippedMapper);\n  clippedActor->GetProperty()->SetRepresentationToWireframe();\n  clippedActor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // Create a mapper and actor for cube.\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetRepresentationToWireframe();\n  cubeActor->GetProperty()->SetOpacity(0.5);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitDataSetClipping\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(clippedActor);\n  renderer->AddActor(cubeActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Generate an interesting view.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid WritePolyData(vtkPolyData* const polyData, const std::string& filename)\n{\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetInputData(polyData);\n  writer->SetFileName(filename.c_str());\n  writer->Write();\n}\n\nvoid WriteDataSet(vtkDataSet* const dataSet, const std::string& filename)\n{\n  vtkNew<vtkDataSetWriter> writer;\n  writer->SetInputData(dataSet);\n  writer->SetFileName(filename.c_str());\n  writer->Write();\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/ImplicitDataSetClipping/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitDataSetClipping)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOLegacy\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitDataSetClipping: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitDataSetClipping MACOSX_BUNDLE ImplicitDataSetClipping.cxx )\n  target_link_libraries(ImplicitDataSetClipping PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitDataSetClipping\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ImplicitDataSetClipping/#download-and-build-implicitdatasetclipping","title":"Download and Build ImplicitDataSetClipping","text":"

Click here to download ImplicitDataSetClipping and its CMakeLists.txt file. Once the tarball ImplicitDataSetClipping.tar has been downloaded and extracted,

cd ImplicitDataSetClipping/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitDataSetClipping\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ImplicitModeller/","title":"ImplicitModeller","text":"

vtk-examples/Cxx/PolyData/ImplicitModeller

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ImplicitModeller/#code","title":"Code","text":"

ImplicitModeller.cxx

#include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitModeller.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImplicitModeller> implicitModeller;\n  implicitModeller->SetSampleDimensions(50, 50, 50);\n  implicitModeller->SetInputData(polyData);\n  implicitModeller->AdjustBoundsOn();\n  implicitModeller->SetAdjustDistance(.1); // Adjust by 10%\n  implicitModeller->SetMaximumDistance(.1);\n\n  // Compute the range to select a reasonable contour value\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double xrange = bounds[1] - bounds[0];\n\n  // Create the 0 isosurface\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetInputConnection(implicitModeller->GetOutputPort());\n  contourFilter->SetValue(0, xrange / 30.0); // 30% of xrange\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(contourFilter->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Sienna\").GetData());\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ImplicitModeller\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphere;\n    sphere->Update();\n    polyData = sphere->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/ImplicitModeller/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitModeller)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersHybrid\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitModeller: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitModeller MACOSX_BUNDLE ImplicitModeller.cxx )\n  target_link_libraries(ImplicitModeller PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitModeller\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ImplicitModeller/#download-and-build-implicitmodeller","title":"Download and Build ImplicitModeller","text":"

Click here to download ImplicitModeller and its CMakeLists.txt file. Once the tarball ImplicitModeller.tar has been downloaded and extracted,

cd ImplicitModeller/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitModeller\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ImplicitPolyDataDistance/","title":"ImplicitPolyDataDistance","text":"

vtk-examples/Cxx/PolyData/ImplicitPolyDataDistance

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ImplicitPolyDataDistance/#code","title":"Code","text":"

ImplicitPolyDataDistance.cxx

#include <vtkActor.h>\n#include <vtkFloatArray.h>\n#include <vtkImplicitPolyDataDistance.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n  sphereSource->Update();\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  sphereMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetOpacity(0.3);\n  sphereActor->GetProperty()->SetColor(1, 0, 0);\n\n  vtkNew<vtkImplicitPolyDataDistance> implicitPolyDataDistance;\n  implicitPolyDataDistance->SetInput(sphereSource->GetOutput());\n\n  // Setup a grid\n  vtkNew<vtkPoints> points;\n  float step = 0.1;\n  for (float x = -2.0; x <= 2.0; x += step)\n  {\n    for (float y = -2.0; y <= 2.0; y += step)\n    {\n      for (float z = -2.0; z <= 2.0; z += step)\n      {\n        points->InsertNextPoint(x, y, z);\n      }\n    }\n  }\n\n  // Add distances to each point\n  vtkNew<vtkFloatArray> signedDistances;\n  signedDistances->SetNumberOfComponents(1);\n  signedDistances->SetName(\"SignedDistances\");\n\n  // Evaluate the signed distance function at all of the grid points\n  for (vtkIdType pointId = 0; pointId < points->GetNumberOfPoints(); ++pointId)\n  {\n    double p[3];\n    points->GetPoint(pointId, p);\n    float signedDistance = implicitPolyDataDistance->EvaluateFunction(p);\n    signedDistances->InsertNextValue(signedDistance);\n  }\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n  polyData->GetPointData()->SetScalars(signedDistances);\n\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->SetInputData(polyData);\n  vertexGlyphFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> signedDistanceMapper;\n  signedDistanceMapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n  signedDistanceMapper->ScalarVisibilityOn();\n\n  vtkNew<vtkActor> signedDistanceActor;\n  signedDistanceActor->SetMapper(signedDistanceMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(sphereActor);\n  renderer->AddViewProp(signedDistanceActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitPolyDataDistance\");\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ImplicitPolyDataDistance/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitPolyDataDistance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitPolyDataDistance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitPolyDataDistance MACOSX_BUNDLE ImplicitPolyDataDistance.cxx )\n  target_link_libraries(ImplicitPolyDataDistance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitPolyDataDistance\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ImplicitPolyDataDistance/#download-and-build-implicitpolydatadistance","title":"Download and Build ImplicitPolyDataDistance","text":"

Click here to download ImplicitPolyDataDistance and its CMakeLists.txt file. Once the tarball ImplicitPolyDataDistance.tar has been downloaded and extracted,

cd ImplicitPolyDataDistance/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitPolyDataDistance\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ImplicitSelectionLoop/","title":"ImplicitSelectionLoop","text":"

vtk-examples/Cxx/PolyData/ImplicitSelectionLoop

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ImplicitSelectionLoop/#code","title":"Code","text":"

ImplicitSelectionLoop.cxx

#include <vtkClipPolyData.h>\n#include <vtkImplicitSelectionLoop.h>\n#include <vtkLODActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(100);\n  sphereSource->SetThetaResolution(100);\n  sphereSource->Update();\n\n  vtkNew<vtkPoints> selectionPoints;\n\n  selectionPoints->InsertPoint(0, -0.16553, 0.135971, 0.451972);\n  selectionPoints->InsertPoint(1, -0.0880123, -0.134952, 0.4747);\n  selectionPoints->InsertPoint(2, 0.00292618, -0.134604, 0.482459);\n  selectionPoints->InsertPoint(3, 0.0641941, 0.067112, 0.490947);\n  selectionPoints->InsertPoint(4, 0.15577, 0.0734765, 0.469245);\n  selectionPoints->InsertPoint(5, 0.166667, -0.129217, 0.454622);\n  selectionPoints->InsertPoint(6, 0.241259, -0.123363, 0.420581);\n  selectionPoints->InsertPoint(7, 0.240334, 0.0727106, 0.432555);\n  selectionPoints->InsertPoint(8, 0.308529, 0.0844311, 0.384357);\n  selectionPoints->InsertPoint(9, 0.32672, -0.121674, 0.359187);\n  selectionPoints->InsertPoint(10, 0.380721, -0.117342, 0.302527);\n  selectionPoints->InsertPoint(11, 0.387804, 0.0455074, 0.312375);\n  selectionPoints->InsertPoint(12, 0.43943, -0.111673, 0.211707);\n  selectionPoints->InsertPoint(13, 0.470984, -0.0801913, 0.147919);\n  selectionPoints->InsertPoint(14, 0.436777, 0.0688872, 0.233021);\n  selectionPoints->InsertPoint(15, 0.44874, 0.188852, 0.109882);\n  selectionPoints->InsertPoint(16, 0.391352, 0.254285, 0.176943);\n  selectionPoints->InsertPoint(17, 0.373274, 0.154162, 0.294296);\n  selectionPoints->InsertPoint(18, 0.274659, 0.311654, 0.276609);\n  selectionPoints->InsertPoint(19, 0.206068, 0.31396, 0.329702);\n  selectionPoints->InsertPoint(20, 0.263789, 0.174982, 0.387308);\n  selectionPoints->InsertPoint(21, 0.213034, 0.175485, 0.417142);\n  selectionPoints->InsertPoint(22, 0.169113, 0.261974, 0.390286);\n  selectionPoints->InsertPoint(23, 0.102552, 0.25997, 0.414814);\n  selectionPoints->InsertPoint(24, 0.131512, 0.161254, 0.454705);\n  selectionPoints->InsertPoint(25, 0.000192443, 0.156264, 0.475307);\n  selectionPoints->InsertPoint(26, -0.0392091, 0.000251724, 0.499943);\n  selectionPoints->InsertPoint(27, -0.096161, 0.159646, 0.46438);\n\n  vtkNew<vtkImplicitSelectionLoop> loop;\n  loop->SetLoop(selectionPoints);\n\n  vtkNew<vtkClipPolyData> clip;\n  clip->SetInputConnection(sphereSource->GetOutputPort());\n  clip->SetClipFunction(loop);\n  clip->SetValue(0.0);\n\n  vtkNew<vtkPolyDataMapper> clipMapper;\n  clipMapper->SetInputConnection(clip->GetOutputPort());\n  clipMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkLODActor> clipActor;\n  clipActor->SetMapper(clipMapper);\n  clipActor->SetBackfaceProperty(backProp);\n  clipActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(clipActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetSize(500, 500);\n  renderWindow->SetWindowName(\"ImplicitSelectionLoop\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ImplicitSelectionLoop/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitSelectionLoop)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitSelectionLoop: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitSelectionLoop MACOSX_BUNDLE ImplicitSelectionLoop.cxx )\n  target_link_libraries(ImplicitSelectionLoop PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitSelectionLoop\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ImplicitSelectionLoop/#download-and-build-implicitselectionloop","title":"Download and Build ImplicitSelectionLoop","text":"

Click here to download ImplicitSelectionLoop and its CMakeLists.txt file. Once the tarball ImplicitSelectionLoop.tar has been downloaded and extracted,

cd ImplicitSelectionLoop/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitSelectionLoop\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/InterpolateMeshOnGrid/","title":"InterpolateMeshOnGrid","text":"

vtk-examples/Cxx/PolyData/InterpolateMeshOnGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/InterpolateMeshOnGrid/#description","title":"Description","text":"

This example resamples a mesh on a grid of points.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/InterpolateMeshOnGrid/#code","title":"Code","text":"

InterpolateMeshOnGrid.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDelaunay2D.h>\n#include <vtkFloatArray.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkWarpScalar.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <iostream>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a random set of 100 points in the xy-plane in (0,10)x(0,10).\n  // If you had instead started with a set of (x,y,z) points, you must copy\n  // the zvalues into a FloatArray and set it as the data set's scalars,\n  // and then set the z-coordinates to zero\n  vtkNew<vtkPoints> randomPoints;\n\n  vtkNew<vtkFloatArray> zvalues;\n  zvalues->SetName(\"ZValues\");\n\n  unsigned int gridSize = 10;\n  float maxHeight = 1;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  for (unsigned int i = 0; i < 100; ++i)\n  {\n    double x, y, z;\n    // random position and radius.\n    x = randomSequence->GetRangeValue(0, gridSize);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(0, gridSize);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(0, maxHeight);\n    randomSequence->Next();\n\n    // randomPoints->InsertNextPoint ( x, y, z);\n    randomPoints->InsertNextPoint(x, y, 0);\n    zvalues->InsertNextValue(z);\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> randomPolyData;\n  randomPolyData->SetPoints(randomPoints);\n  randomPolyData->GetPointData()->SetScalars(zvalues);\n\n  // Triangulate the grid points. If you do not have a mesh (points\n  // only), the output will not be interpolated!\n  vtkNew<vtkDelaunay2D> randomDelaunay;\n  randomDelaunay->SetInputData(randomPolyData);\n  randomDelaunay->Update();\n\n  // Create a grid of points to interpolate over.\n  vtkNew<vtkPoints> gridPoints;\n  for (unsigned int x = 0; x < gridSize; x++)\n  {\n    for (unsigned int y = 0; y < gridSize; y++)\n    {\n      gridPoints->InsertNextPoint(x, y, 0);\n    }\n  }\n\n  // Create a dataset from the grid points.\n  vtkNew<vtkPolyData> gridPolyData;\n  gridPolyData->SetPoints(gridPoints);\n\n  // Perform the interpolation.\n  vtkNew<vtkProbeFilter> probeFilter;\n  probeFilter->SetSourceConnection(randomDelaunay->GetOutputPort());\n  probeFilter->SetInputData(\n      gridPolyData); //\n                     // Interpolate 'Source' at these points.\n  probeFilter->Update();\n\n  // Map the output zvalues to the z-coordinates of the data so that\n  // we get a surface, rather than a flat grid with interpolated\n  // scalars.\n  vtkNew<vtkWarpScalar> gridWarpScalar;\n  gridWarpScalar->SetInputConnection(probeFilter->GetOutputPort());\n  gridWarpScalar->Update();\n\n  //////// Setup outputs ////////\n  // Output random points.\n  // Map the output zvalues to the z-coordinates of the data.\n  vtkNew<vtkWarpScalar> randomWarpScalar;\n  randomWarpScalar->SetInputConnection(randomDelaunay->GetOutputPort());\n  randomWarpScalar->Update();\n\n  vtkNew<vtkXMLPolyDataWriter> randomWriter;\n  randomWriter->SetFileName(\"randomSurface.vtp\");\n  randomWriter->SetInputConnection(randomWarpScalar->GetOutputPort());\n  randomWriter->Write();\n\n  // Mesh the output grid points\n  vtkNew<vtkDelaunay2D> gridDelaunay;\n  gridDelaunay->SetInputConnection(gridWarpScalar->GetOutputPort());\n\n  vtkNew<vtkXMLPolyDataWriter> gridWriter;\n  gridWriter->SetFileName(\"gridSurface.vtp\");\n  gridWriter->SetInputConnection(gridDelaunay->GetOutputPort());\n  gridWriter->Write();\n\n  ////////// Setup visualization ////////\n  vtkNew<vtkDataSetMapper> randomMapper;\n  randomMapper->SetInputConnection(randomWarpScalar->GetOutputPort());\n  randomMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> randomActor;\n  randomActor->SetMapper(randomMapper);\n  randomActor->GetProperty()->SetColor(colors->GetColor3d(\"Salmon\").GetData());\n  randomActor->GetProperty()->SetPointSize(3);\n\n  vtkNew<vtkDataSetMapper> gridMapper;\n  gridMapper->SetInputConnection(gridDelaunay->GetOutputPort());\n  gridMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> gridActor;\n  gridActor->SetMapper(gridMapper);\n  gridActor->GetProperty()->SetColor(colors->GetColor3d(\"SteelBlue\").GetData());\n  gridActor->GetProperty()->SetPointSize(3);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"InterpolateMeshOnGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderer->AddActor(randomActor);\n  renderer->AddActor(gridActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(5.87551, -15.9539, 17.5858);\n  camera->SetFocalPoint(4.94546, 4.90463, 0.498443);\n  camera->SetViewUp(-0.00568191, 0.633548, 0.773683);\n  camera->SetDistance(26.98);\n  camera->SetClippingRange(18.197, 38.1011);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/InterpolateMeshOnGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InterpolateMeshOnGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InterpolateMeshOnGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InterpolateMeshOnGrid MACOSX_BUNDLE InterpolateMeshOnGrid.cxx )\n  target_link_libraries(InterpolateMeshOnGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InterpolateMeshOnGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/InterpolateMeshOnGrid/#download-and-build-interpolatemeshongrid","title":"Download and Build InterpolateMeshOnGrid","text":"

Click here to download InterpolateMeshOnGrid and its CMakeLists.txt file. Once the tarball InterpolateMeshOnGrid.tar has been downloaded and extracted,

cd InterpolateMeshOnGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./InterpolateMeshOnGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/InterpolateTerrain/","title":"InterpolateTerrain","text":"

vtk-examples/Cxx/PolyData/InterpolateTerrain

"},{"location":"Cxx/PolyData/InterpolateTerrain/#description","title":"Description","text":"

This example samples a \"terrain map\" using two approaches.

  • Creates an image from the x,y points of the terrain and then uses vtkProbeFilter to interpolate the heights.
  • Uses vtkCellLocator to directly interpolate the terrain polydata.

Note that the results differ when the point is not one of the original terrain points. This is because the image has quadrilateral elements and the polydata has triangles. As the resolution of the grid increases, the two results converge.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/InterpolateTerrain/#code","title":"Code","text":"

InterpolateTerrain.cxx

#include <vtkCellLocator.h>\n#include <vtkDelaunay2D.h>\n#include <vtkDoubleArray.h>\n#include <vtkImageData.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProbeFilter.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkImageData> image;\n  image->SetExtent(0, 9, 0, 9, 0, 0);\n  image->AllocateScalars(VTK_DOUBLE, 1);\n\n  // Create a random set of heights on a grid. This is often called a\n  //\"terrain map\".\n  vtkNew<vtkPoints> points;\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  unsigned int GridSize = 10;\n  for (unsigned int x = 0; x < GridSize; x++)\n  {\n    for (unsigned int y = 0; y < GridSize; y++)\n    {\n      double val = randomSequence->GetRangeValue(-1, 1);\n      randomSequence->Next();\n      points->InsertNextPoint(x, y, val);\n      image->SetScalarComponentFromDouble(x, y, 0, 0, val);\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Triangulate the grid points.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(polydata);\n  delaunay->Update();\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(\"surface.vtp\");\n  writer->SetInputConnection(delaunay->GetOutputPort());\n  writer->Write();\n\n  // Add some points to interpolate.\n  vtkNew<vtkPoints> probePoints;\n  probePoints->InsertNextPoint(5.2, 3.2, 0);\n  probePoints->InsertNextPoint(5.0, 3.0, 0);\n  probePoints->InsertNextPoint(0.0, 0.0, 0);\n\n  vtkNew<vtkPolyData> probePolyData;\n  probePolyData->SetPoints(probePoints);\n\n  vtkNew<vtkProbeFilter> probe;\n  probe->SetSourceData(image);\n  probe->SetInputData(probePolyData);\n  probe->Update();\n\n  vtkDataArray* data = probe->GetOutput()->GetPointData()->GetScalars();\n  vtkDoubleArray* doubleData = dynamic_cast<vtkDoubleArray*>(data);\n\n  for (int i = 0; i < doubleData->GetNumberOfTuples(); i++)\n  {\n    double val = doubleData->GetValue(i);\n    cout << \"Interpolation using ProbeFilter \";\n    cout << \"doubleData->GetValue(\" << i << \"): \" << val << endl;\n  }\n\n  // Now find the elevation with a CellLocator.\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(delaunay->GetOutput());\n  cellLocator->BuildLocator();\n\n  for (int i = 0; i < doubleData->GetNumberOfTuples(); i++)\n  {\n    int subId;\n    double t, xyz[3], pcoords[3];\n    double rayStart[3], rayEnd[3];\n    probePoints->GetPoint(i, rayStart);\n    rayStart[2] += 1000.0;\n    probePoints->GetPoint(i, rayEnd);\n    rayEnd[2] -= 1000.0;\n\n    if (cellLocator->IntersectWithLine(rayStart, rayEnd, 0.0001, t, xyz,\n                                       pcoords, subId))\n    {\n      cout << \"Interpolation using CellLocator \";\n      cout << \"Elevation at \" << rayStart[0] << \", \" << rayStart[1] << \" is \"\n           << xyz[2] << endl;\n    }\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/InterpolateTerrain/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InterpolateTerrain)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InterpolateTerrain: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InterpolateTerrain MACOSX_BUNDLE InterpolateTerrain.cxx )\n  target_link_libraries(InterpolateTerrain PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InterpolateTerrain\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/InterpolateTerrain/#download-and-build-interpolateterrain","title":"Download and Build InterpolateTerrain","text":"

Click here to download InterpolateTerrain and its CMakeLists.txt file. Once the tarball InterpolateTerrain.tar has been downloaded and extracted,

cd InterpolateTerrain/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./InterpolateTerrain\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/IntersectionPolyDataFilter/","title":"IntersectionPolyDataFilter","text":"

vtk-examples/Cxx/PolyData/IntersectionPolyDataFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/IntersectionPolyDataFilter/#code","title":"Code","text":"

IntersectionPolyDataFilter.cxx

#include <vtkActor.h>\n#include <vtkIntersectionPolyDataFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(2.0);\n  sphereSource1->Update();\n  vtkNew<vtkPolyDataMapper> sphere1Mapper;\n  sphere1Mapper->SetInputConnection(sphereSource1->GetOutputPort());\n  sphere1Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> sphere1Actor;\n  sphere1Actor->SetMapper(sphere1Mapper);\n  sphere1Actor->GetProperty()->SetOpacity(.3);\n  sphere1Actor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(1.0, 0.0, 0.0);\n  sphereSource2->SetRadius(2.0);\n  vtkNew<vtkPolyDataMapper> sphere2Mapper;\n  sphere2Mapper->SetInputConnection(sphereSource2->GetOutputPort());\n  sphere2Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> sphere2Actor;\n  sphere2Actor->SetMapper(sphere2Mapper);\n  sphere2Actor->GetProperty()->SetOpacity(.3);\n  sphere2Actor->GetProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n\n  vtkNew<vtkIntersectionPolyDataFilter> intersectionPolyDataFilter;\n  intersectionPolyDataFilter->SetInputConnection(\n      0, sphereSource1->GetOutputPort());\n  intersectionPolyDataFilter->SetInputConnection(\n      1, sphereSource2->GetOutputPort());\n  intersectionPolyDataFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> intersectionMapper;\n  intersectionMapper->SetInputConnection(\n      intersectionPolyDataFilter->GetOutputPort());\n  intersectionMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> intersectionActor;\n  intersectionActor->SetMapper(intersectionMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(sphere1Actor);\n  renderer->AddViewProp(sphere2Actor);\n  renderer->AddViewProp(intersectionActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"IntersectionPolyDataFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/IntersectionPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IntersectionPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IntersectionPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IntersectionPolyDataFilter MACOSX_BUNDLE IntersectionPolyDataFilter.cxx )\n  target_link_libraries(IntersectionPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IntersectionPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/IntersectionPolyDataFilter/#download-and-build-intersectionpolydatafilter","title":"Download and Build IntersectionPolyDataFilter","text":"

Click here to download IntersectionPolyDataFilter and its CMakeLists.txt file. Once the tarball IntersectionPolyDataFilter.tar has been downloaded and extracted,

cd IntersectionPolyDataFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IntersectionPolyDataFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/IterateOverLines/","title":"IterateOverLines","text":"

vtk-examples/Cxx/PolyData/IterateOverLines

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/IterateOverLines/#code","title":"Code","text":"

IterateOverLines.cxx

#include <vtkCellArray.h>\n#include <vtkLine.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n  double p2[3] = {0.0, 1.0, 2.0};\n  double p3[3] = {1.0, 2.0, 3.0};\n\n  // Create a vtkPoints object and store the points in it\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(origin);\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n\n  // Create a cell array to store the lines in and add the lines to it\n  vtkNew<vtkCellArray> lines;\n\n  // Create four lines\n  for (unsigned int i = 0; i < 4; i++)\n  {\n    vtkNew<vtkLine> line;\n    line->GetPointIds()->SetId(0, i);\n    line->GetPointIds()->SetId(1, i + 1);\n    lines->InsertNextCell(line);\n  }\n\n  // Create a polydata to store everything in\n  vtkNew<vtkPolyData> linesPolyData;\n\n  // Add the points to the dataset\n  linesPolyData->SetPoints(points);\n\n  // Add the lines to the dataset\n  linesPolyData->SetLines(lines);\n\n  std::cout << \"There are \" << linesPolyData->GetNumberOfLines() << \" lines.\"\n            << std::endl;\n\n  linesPolyData->GetLines()->InitTraversal();\n  vtkNew<vtkIdList> idList;\n  while (linesPolyData->GetLines()->GetNextCell(idList))\n  {\n    std::cout << \"Line has \" << idList->GetNumberOfIds() << \" points.\"\n              << std::endl;\n\n    for (vtkIdType pointId = 0; pointId < idList->GetNumberOfIds(); pointId++)\n    {\n      std::cout << idList->GetId(pointId) << \" \";\n    }\n    std::cout << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/IterateOverLines/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IterateOverLines)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IterateOverLines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IterateOverLines MACOSX_BUNDLE IterateOverLines.cxx )\n  target_link_libraries(IterateOverLines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IterateOverLines\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/IterateOverLines/#download-and-build-iterateoverlines","title":"Download and Build IterateOverLines","text":"

Click here to download IterateOverLines and its CMakeLists.txt file. Once the tarball IterateOverLines.tar has been downloaded and extracted,

cd IterateOverLines/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IterateOverLines\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/KochanekSpline/","title":"KochanekSpline","text":"

vtk-examples/Cxx/PolyData/KochanekSpline

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/KochanekSpline/#description","title":"Description","text":"

The vtkKochanekSpline provides three parameters to control the shape of the spline:

  1. tension - Changes the length of the tangent vector
  2. bias - Primarily changes the direction of the tangent vector
  3. continuity - Changes the sharpness in change between tangents

Seealso

KochanekSplineDemo provides sliders to change the three parameters.

Seealso

This wikipedia article describes the controlsin detail.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/KochanekSpline/#code","title":"Code","text":"

KochanekSpline.cxx

#include <vtkActor.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkKochanekSpline.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int numberOfPoints = 10;\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(numberOfPoints);\n  pointSource->Update();\n\n  vtkPoints* points = pointSource->GetOutput()->GetPoints();\n\n  vtkNew<vtkKochanekSpline> xSpline;\n  vtkNew<vtkKochanekSpline> ySpline;\n  vtkNew<vtkKochanekSpline> zSpline;\n\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetXSpline(xSpline);\n  spline->SetYSpline(ySpline);\n  spline->SetZSpline(zSpline);\n  spline->SetPoints(points);\n\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->SetUResolution(50 * numberOfPoints);\n  functionSource->SetVResolution(50 * numberOfPoints);\n  functionSource->SetWResolution(50 * numberOfPoints);\n  functionSource->Update();\n\n  // Setup actor and mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(functionSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DarkSlateGrey\").GetData());\n  actor->GetProperty()->SetLineWidth(3.0);\n\n  // Glyph the points\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.02);\n\n  // Create a polydata to store everything in\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputData(polyData);\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"KochanekSpline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(pointActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/KochanekSpline/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KochanekSpline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KochanekSpline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KochanekSpline MACOSX_BUNDLE KochanekSpline.cxx )\n  target_link_libraries(KochanekSpline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KochanekSpline\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/KochanekSpline/#download-and-build-kochanekspline","title":"Download and Build KochanekSpline","text":"

Click here to download KochanekSpline and its CMakeLists.txt file. Once the tarball KochanekSpline.tar has been downloaded and extracted,

cd KochanekSpline/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KochanekSpline\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/KochanekSplineDemo/","title":"KochanekSplineDemo","text":"

vtk-examples/Cxx/PolyData/KochanekSplineDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/KochanekSplineDemo/#description","title":"Description","text":"

The example provides vtkSliderWidget s to change tension, continuity and bias of the vtkKochanekSpline.

  1. tension - Changes the length of the tangent vector
  2. bias - Primarily changes the direction of the tangent vector
  3. continuity - Changes the sharpness in change between tangents

Seealso

This wikipedia article describes the controlsin detail.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/KochanekSplineDemo/#code","title":"Code","text":"

KochanekSplineDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCommand.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkKochanekSpline.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\nnamespace {\nvoid MakeTensionWidget(vtkSliderWidget*, vtkParametricFunctionSource*,\n                       vtkParametricSpline*, vtkRenderer*,\n                       vtkRenderWindowInteractor*);\nvoid MakeContinuityWidget(vtkSliderWidget*, vtkParametricFunctionSource*,\n                          vtkParametricSpline*, vtkRenderer*,\n                          vtkRenderWindowInteractor*);\nvoid MakeBiasWidget(vtkSliderWidget*, vtkParametricFunctionSource*,\n                    vtkParametricSpline*, vtkRenderer*,\n                    vtkRenderWindowInteractor*);\nvoid SetSliderColors(vtkSliderRepresentation2D* slider);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int numberOfPoints = 7;\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(numberOfPoints);\n  double radius = 1.0;\n  double delta = 2.0 * vtkMath::Pi() / double(numberOfPoints);\n  for (int n = 0; n < numberOfPoints; ++n)\n  {\n    double theta = delta * n;\n    double x = radius * std::cos(theta);\n    double y = radius * std::sin(theta);\n    double z = n * (vtkMath::Pi() / numberOfPoints);\n    points->SetPoint(n, x, y, z);\n  }\n\n  vtkNew<vtkKochanekSpline> xSpline;\n  vtkNew<vtkKochanekSpline> ySpline;\n  vtkNew<vtkKochanekSpline> zSpline;\n\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetXSpline(xSpline);\n  spline->SetYSpline(ySpline);\n  spline->SetZSpline(zSpline);\n  spline->SetPoints(points);\n\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->SetUResolution(50 * numberOfPoints);\n  functionSource->SetVResolution(50 * numberOfPoints);\n  functionSource->SetWResolution(50 * numberOfPoints);\n  functionSource->Update();\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(functionSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DarkSlateGrey\").GetData());\n  actor->GetProperty()->SetLineWidth(3.0);\n\n  // Glyph the points.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.1);\n\n  // Create a polydata to store everything in.\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputData(polyData);\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  pointActor->GetProperty()->SetOpacity(.5);\n  ;\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"KochanekSpline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(pointActor);\n  ;\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->Render();\n\n  vtkNew<vtkSliderWidget> tensionWidget;\n  MakeTensionWidget(tensionWidget, functionSource, spline, renderer,\n                    renderWindowInteractor);\n  vtkNew<vtkSliderWidget> continuityWidget;\n  MakeContinuityWidget(continuityWidget, functionSource, spline, renderer,\n                       renderWindowInteractor);\n  vtkNew<vtkSliderWidget> biasWidget;\n  MakeBiasWidget(biasWidget, functionSource, spline, renderer,\n                 renderWindowInteractor);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackTension : public vtkCommand\n{\npublic:\n  static SliderCallbackTension* New()\n  {\n    return new SliderCallbackTension;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetXSpline())\n        ->SetDefaultTension(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetYSpline())\n        ->SetDefaultTension(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetZSpline())\n        ->SetDefaultTension(value);\n    ParametricSource->Modified();\n    ParametricSource->Update();\n  }\n  SliderCallbackTension() : ParametricSource(0), ParametricSpline(0)\n  {\n  }\n  vtkParametricSpline* ParametricSpline;\n  vtkParametricFunctionSource* ParametricSource;\n};\n\nvoid MakeTensionWidget(vtkSliderWidget* widget,\n                       vtkParametricFunctionSource* parametricSource,\n                       vtkParametricSpline* parametricSpline,\n                       vtkRenderer* renderer,\n                       vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepTension;\n\n  sliderRepTension->SetRenderer(renderer);\n\n  sliderRepTension->SetMinimumValue(-1.0);\n  sliderRepTension->SetMaximumValue(1.0);\n  sliderRepTension->SetValue(\n      dynamic_cast<vtkKochanekSpline*>(parametricSpline->GetXSpline())\n          ->GetDefaultTension());\n  sliderRepTension->SetTitleText(\"Tension\");\n  sliderRepTension->SetRenderer(renderer);\n  sliderRepTension->GetPoint1Coordinate()->SetValue(0.1, 0.1);\n  sliderRepTension->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n  sliderRepTension->GetPoint2Coordinate()->SetValue(0.3, 0.1);\n  sliderRepTension->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepTension->SetTubeWidth(tubeWidth);\n  sliderRepTension->SetSliderLength(sliderLength);\n  sliderRepTension->SetTitleHeight(titleHeight);\n  sliderRepTension->SetLabelHeight(labelHeight);\n  sliderRepTension->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepTension->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepTension->BuildRepresentation();\n  SetSliderColors(sliderRepTension);\n\n  widget->SetRepresentation(sliderRepTension);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackTension> callbackTension;\n  callbackTension->ParametricSpline = parametricSpline;\n  callbackTension->ParametricSource = parametricSource;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackTension);\n}\n\nclass SliderCallbackContinuity : public vtkCommand\n{\npublic:\n  static SliderCallbackContinuity* New()\n  {\n    return new SliderCallbackContinuity;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetXSpline())\n        ->SetDefaultContinuity(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetYSpline())\n        ->SetDefaultContinuity(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetZSpline())\n        ->SetDefaultContinuity(value);\n    ParametricSource->Modified();\n    ParametricSource->Update();\n  }\n  SliderCallbackContinuity() : ParametricSource(0), ParametricSpline(0)\n  {\n  }\n  vtkParametricSpline* ParametricSpline;\n  vtkParametricFunctionSource* ParametricSource;\n};\n\nvoid MakeContinuityWidget(vtkSliderWidget* widget,\n                          vtkParametricFunctionSource* parametricSource,\n                          vtkParametricSpline* parametricSpline,\n                          vtkRenderer* renderer,\n                          vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepContinuity;\n\n  sliderRepContinuity->SetRenderer(renderer);\n\n  sliderRepContinuity->SetMinimumValue(-1.0);\n  sliderRepContinuity->SetMaximumValue(1.0);\n  sliderRepContinuity->SetValue(\n      dynamic_cast<vtkKochanekSpline*>(parametricSpline->GetXSpline())\n          ->GetDefaultContinuity());\n  sliderRepContinuity->SetTitleText(\"Continuity\");\n  sliderRepContinuity->SetRenderer(renderer);\n  sliderRepContinuity->GetPoint1Coordinate()->SetValue(0.4, 0.1);\n  sliderRepContinuity->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n  sliderRepContinuity->GetPoint2Coordinate()->SetValue(0.6, 0.1);\n  sliderRepContinuity->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepContinuity->SetTubeWidth(tubeWidth);\n  sliderRepContinuity->SetSliderLength(sliderLength);\n  sliderRepContinuity->SetTitleHeight(titleHeight);\n  sliderRepContinuity->SetLabelHeight(labelHeight);\n  sliderRepContinuity->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepContinuity->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepContinuity->BuildRepresentation();\n  SetSliderColors(sliderRepContinuity);\n\n  widget->SetRepresentation(sliderRepContinuity);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackContinuity> callbackContinuity;\n  callbackContinuity->ParametricSpline = parametricSpline;\n  callbackContinuity->ParametricSource = parametricSource;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackContinuity);\n}\n\nclass SliderCallbackBias : public vtkCommand\n{\npublic:\n  static SliderCallbackBias* New()\n  {\n    return new SliderCallbackBias;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetXSpline())\n        ->SetDefaultBias(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetYSpline())\n        ->SetDefaultBias(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetZSpline())\n        ->SetDefaultBias(value);\n    ParametricSource->Modified();\n    ParametricSource->Update();\n  }\n  SliderCallbackBias() : ParametricSource(0), ParametricSpline(0)\n  {\n  }\n  vtkParametricSpline* ParametricSpline;\n  vtkParametricFunctionSource* ParametricSource;\n};\n\nvoid MakeBiasWidget(vtkSliderWidget* widget,\n                    vtkParametricFunctionSource* parametricSource,\n                    vtkParametricSpline* parametricSpline,\n                    vtkRenderer* renderer,\n                    vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepBias;\n\n  sliderRepBias->SetRenderer(renderer);\n\n  sliderRepBias->SetMinimumValue(-1.0);\n  sliderRepBias->SetMaximumValue(1.0);\n  sliderRepBias->SetValue(\n      dynamic_cast<vtkKochanekSpline*>(parametricSpline->GetXSpline())\n          ->GetDefaultBias());\n  sliderRepBias->SetTitleText(\"Bias\");\n  sliderRepBias->SetRenderer(renderer);\n  sliderRepBias->GetPoint1Coordinate()->SetValue(0.7, 0.1);\n  sliderRepBias->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n  sliderRepBias->GetPoint2Coordinate()->SetValue(0.9, 0.1);\n  sliderRepBias->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepBias->SetTubeWidth(tubeWidth);\n  sliderRepBias->SetSliderLength(sliderLength);\n  sliderRepBias->SetTitleHeight(titleHeight);\n  sliderRepBias->SetLabelHeight(labelHeight);\n  sliderRepBias->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepBias->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepBias->BuildRepresentation();\n  SetSliderColors(sliderRepBias);\n\n  widget->SetRepresentation(sliderRepBias);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackBias> callbackBias;\n  callbackBias->ParametricSpline = parametricSpline;\n  callbackBias->ParametricSource = parametricSource;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackBias);\n}\n\nvoid SetSliderColors(vtkSliderRepresentation2D* slider)\n{\n  vtkNew<vtkNamedColors> colors;\n  // Set color properties:\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(colors->GetColor3d(\"Peru\").GetData());\n  // Change the color of the text indicating what the slider controls.\n  slider->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"OrangeRed\").GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(\"OrangeRed\").GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"DeepPink\").GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n}\n\n} // namespace\n
"},{"location":"Cxx/PolyData/KochanekSplineDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KochanekSplineDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KochanekSplineDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KochanekSplineDemo MACOSX_BUNDLE KochanekSplineDemo.cxx )\n  target_link_libraries(KochanekSplineDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KochanekSplineDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/KochanekSplineDemo/#download-and-build-kochaneksplinedemo","title":"Download and Build KochanekSplineDemo","text":"

Click here to download KochanekSplineDemo and its CMakeLists.txt file. Once the tarball KochanekSplineDemo.tar has been downloaded and extracted,

cd KochanekSplineDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KochanekSplineDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/LinearExtrusion/","title":"LinearExtrusion","text":"

vtk-examples/Cxx/PolyData/LinearExtrusion

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/LinearExtrusion/#description","title":"Description","text":"

This example creates some text, extrudes it to make it 3D.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/LinearExtrusion/#code","title":"Code","text":"

LinearExtrusion.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVectorText.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create vector text\n  vtkNew<vtkVectorText> vecText;\n  vecText->SetText(\"Text!\");\n\n  // Apply linear extrusion\n  vtkNew<vtkLinearExtrusionFilter> extrude;\n  extrude->SetInputConnection(vecText->GetOutputPort());\n  extrude->SetExtrusionTypeToNormalExtrusion();\n  extrude->SetVector(0, 0, 1);\n  extrude->SetScaleFactor(0.5);\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(extrude->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(triangleFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PaleGoldenrod\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LinearExtrusion\");\n\n  renderer->AddActor(actor);\n\n  renderer->ResetCamera();\n  // Generate an interesting view\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/LinearExtrusion/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LinearExtrusion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LinearExtrusion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LinearExtrusion MACOSX_BUNDLE LinearExtrusion.cxx )\n  target_link_libraries(LinearExtrusion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LinearExtrusion\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/LinearExtrusion/#download-and-build-linearextrusion","title":"Download and Build LinearExtrusion","text":"

Click here to download LinearExtrusion and its CMakeLists.txt file. Once the tarball LinearExtrusion.tar has been downloaded and extracted,

cd LinearExtrusion/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LinearExtrusion\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/LoopBooleanPolyDataFilter/","title":"LoopBooleanPolyDataFilter","text":"

vtk-examples/Cxx/PolyData/LoopBooleanPolyDataFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/LoopBooleanPolyDataFilter/#description","title":"Description","text":"

The vtkLoopBooleanPolyDataFilter works best with \"clean\" data, so this examples first runs vtkTriangleFilter and then vtkCleanPolyData.

This example can be run in three ways:

  1. LoopBooleanPolyDataFilter - Computes the intersection of two spheres

  2. LoopBooleanPolyDataFilter intersection|difference|union - Computes the intersection(difference or union) of two spheres

  3. LoopBooleanPolyDataFilter input1.vtk intersection|difference|union input2.vtk - Computes the intersection(difference or union) of two vtkPolyData's

Seealso

BooleanOperationPolyDataFilter uses an alternative algorithm to do the boolean operations.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/LoopBooleanPolyDataFilter/#code","title":"Code","text":"

LoopBooleanPolyDataFilter.cxx

#include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCleanPolyData.h>\n#include <vtkLoopBooleanPolyDataFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkCamera.h>\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> input1;\n  vtkSmartPointer<vtkPolyData> input2;\n\n  std::string operation(\"intersection\");\n\n  if (argc == 4)\n  {\n    auto poly1 = ReadPolyData(argv[1]);\n    vtkNew<vtkTriangleFilter> tri1;\n    tri1->SetInputData(poly1);\n    vtkNew<vtkCleanPolyData> clean1;\n    clean1->SetInputConnection(tri1->GetOutputPort());\n    clean1->Update();\n    input1 = clean1->GetOutput();\n\n    auto poly2 = ReadPolyData(argv[3]);\n    vtkNew<vtkTriangleFilter> tri2;\n    tri2->SetInputData(poly2);\n    tri2->Update();\n    vtkNew<vtkCleanPolyData> clean2;\n    clean2->SetInputConnection(tri2->GetOutputPort());\n    clean2->Update();\n    input2 = clean2->GetOutput();\n    operation = argv[2];\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource1;\n    sphereSource1->SetCenter(.25, 0, 0);\n    sphereSource1->SetPhiResolution(21);\n    sphereSource1->SetThetaResolution(21);\n    sphereSource1->Update();\n    input1 = sphereSource1->GetOutput();\n\n    vtkNew<vtkSphereSource> sphereSource2;\n    sphereSource2->Update();\n    input2 = sphereSource2->GetOutput();\n\n    if (argc == 2)\n    {\n      operation = argv[1];\n    }\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> input1Mapper;\n  input1Mapper->SetInputData(input1);\n  input1Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> input1Actor;\n  input1Actor->SetMapper(input1Mapper);\n  input1Actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  input1Actor->GetProperty()->SetSpecular(.6);\n  input1Actor->GetProperty()->SetSpecularPower(20);\n  input1Actor->SetPosition(input1->GetBounds()[1] - input1->GetBounds()[0], 0,\n                           0);\n  vtkNew<vtkPolyDataMapper> input2Mapper;\n  input2Mapper->SetInputData(input2);\n  input2Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> input2Actor;\n  input2Actor->SetMapper(input2Mapper);\n  input2Actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  input2Actor->GetProperty()->SetSpecular(.6);\n  input2Actor->GetProperty()->SetSpecularPower(20);\n  input2Actor->SetPosition(-(input1->GetBounds()[1] - input1->GetBounds()[0]),\n                           0, 0);\n  vtkNew<vtkLoopBooleanPolyDataFilter> booleanOperation;\n  if (operation == \"union\")\n  {\n    booleanOperation->SetOperationToUnion();\n  }\n  else if (operation == \"intersection\")\n  {\n    booleanOperation->SetOperationToIntersection();\n  }\n  else if (operation == \"difference\")\n  {\n    booleanOperation->SetOperationToDifference();\n  }\n  else\n  {\n    std::cout << \"Unknown operation: \" << operation << std::endl;\n    return EXIT_FAILURE;\n  }\n  booleanOperation->SetInputData(0, input1);\n  booleanOperation->SetInputData(1, input2);\n\n  vtkNew<vtkPolyDataMapper> booleanOperationMapper;\n  booleanOperationMapper->SetInputConnection(booleanOperation->GetOutputPort());\n  booleanOperationMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> booleanOperationActor;\n  booleanOperationActor->SetMapper(booleanOperationMapper);\n  booleanOperationActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  booleanOperationActor->GetProperty()->SetSpecular(.6);\n  booleanOperationActor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(input1Actor);\n  renderer->AddViewProp(input2Actor);\n  renderer->AddViewProp(booleanOperationActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"LoopBooleanPolyDataFilter\");\n\n  double viewUp[3] = {0.0, 0.0, 1.0};\n  double position[3] = {0.0, -1.0, 0.0};\n  PositionCamera(renderer, viewUp, position);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position)\n{\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  renderer->GetActiveCamera()->SetViewUp(viewUp);\n  renderer->GetActiveCamera()->SetPosition(position);\n  renderer->ResetCamera();\n  return;\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/LoopBooleanPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LoopBooleanPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LoopBooleanPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LoopBooleanPolyDataFilter MACOSX_BUNDLE LoopBooleanPolyDataFilter.cxx )\n  target_link_libraries(LoopBooleanPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LoopBooleanPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/LoopBooleanPolyDataFilter/#download-and-build-loopbooleanpolydatafilter","title":"Download and Build LoopBooleanPolyDataFilter","text":"

Click here to download LoopBooleanPolyDataFilter and its CMakeLists.txt file. Once the tarball LoopBooleanPolyDataFilter.tar has been downloaded and extracted,

cd LoopBooleanPolyDataFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LoopBooleanPolyDataFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/MaskPoints/","title":"MaskPoints","text":"

vtk-examples/Cxx/PolyData/MaskPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/MaskPoints/#code","title":"Code","text":"

MaskPoints.cxx

#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a set of points\n  vtkNew<vtkPointSource> pointsSource;\n  pointsSource->SetNumberOfPoints(40);\n  pointsSource->Update();\n\n  std::cout << \"There are \" << pointsSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n\n  // Create a point set\n  vtkNew<vtkMaskPoints> maskPoints;\n  maskPoints->SetOnRatio(2); // keep every 2nd point (half the number of points)\n  maskPoints->SetInputConnection(pointsSource->GetOutputPort());\n  maskPoints->Update();\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputConnection(maskPoints->GetOutputPort());\n  glyphFilter->Update();\n\n  std::cout << \"There are \" << maskPoints->GetOutput()->GetNumberOfPoints()\n            << \" masked points.\" << std::endl;\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(pointsSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetPointSize(5);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkPolyDataMapper> maskedMapper;\n  maskedMapper->SetInputConnection(glyphFilter->GetOutputPort());\n  vtkNew<vtkActor> maskedActor;\n  maskedActor->SetMapper(maskedMapper);\n  maskedActor->GetProperty()->SetPointSize(5);\n  maskedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"MaskPoints\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Chocolate\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(maskedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/MaskPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MaskPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MaskPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MaskPoints MACOSX_BUNDLE MaskPoints.cxx )\n  target_link_libraries(MaskPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MaskPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/MaskPoints/#download-and-build-maskpoints","title":"Download and Build MaskPoints","text":"

Click here to download MaskPoints and its CMakeLists.txt file. Once the tarball MaskPoints.tar has been downloaded and extracted,

cd MaskPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MaskPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/MergePoints/","title":"MergePoints","text":"

vtk-examples/Cxx/PolyData/MergePoints

"},{"location":"Cxx/PolyData/MergePoints/#description","title":"Description","text":"

Add new points if they are unique. You must add the original points first. After that, the locator will only add unique points.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/MergePoints/#code","title":"Code","text":"

MergePoints.cxx

#include <vtkMergePoints.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  // Create a set of points.\n  vtkNew<vtkPointSource> pointsSource;\n  pointsSource->SetNumberOfPoints(100);\n  pointsSource->Update();\n\n  vtkPolyData* points = pointsSource->GetOutput();\n\n  // Get a point point in the set.\n  double inSet[3];\n  points->GetPoint(25, inSet);\n\n  std::cout << \"There are \" << points->GetNumberOfPoints() << \" input points.\"\n            << std::endl;\n\n  vtkIdType id;\n\n  // Insert all of the points.\n  vtkNew<vtkMergePoints> mergePoints;\n  mergePoints->SetDataSet(points);\n  mergePoints->SetDivisions(10, 10, 10);\n  mergePoints->InitPointInsertion(points->GetPoints(), points->GetBounds());\n\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    mergePoints->InsertUniquePoint(points->GetPoint(i), id);\n  }\n\n  // Insert a few of the original points.\n  std::cout << \"Insert some of the original points\" << std::endl;\n  int inserted;\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i += 10)\n  {\n    points->GetPoint(i, inSet);\n    inserted = mergePoints->InsertUniquePoint(inSet, id);\n    std::cout << \"\\tPoint: \" << inSet[0] << \", \" << inSet[1] << \", \" << inSet[2]\n              << \" \";\n\n    std::cout << \"Inserted? \" << ((inserted == 0) ? \"No, \" : \"Yes, \");\n    std::cout << \"Id:: \" << id << std::endl;\n  }\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  // These points are probably outside the original set of points.\n  std::cout << \"Insert some new points\" << std::endl;\n  double outsideSet[3];\n  auto radius = pointsSource->GetRadius();\n  for (unsigned int i = 0; i < 10; i++)\n  {\n    for (auto j = 0; j < 3; ++j)\n    {\n      outsideSet[j] = rng->GetRangeValue(-radius, radius);\n      rng->Next();\n    }\n\n    inserted = mergePoints->InsertUniquePoint(outsideSet, id);\n    std::cout << \"\\tPoint: \" << outsideSet[0] << \", \" << outsideSet[1] << \", \"\n              << outsideSet[2] << \" \";\n\n    std::cout << \"Inserted? \" << ((inserted == 0) ? \"No, \" : \"Yes, \");\n    std::cout << \"Id:: \" << id << std::endl;\n  }\n\n  std::cout << \"There are now \" << points->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/MergePoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MergePoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MergePoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MergePoints MACOSX_BUNDLE MergePoints.cxx )\n  target_link_libraries(MergePoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MergePoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/MergePoints/#download-and-build-mergepoints","title":"Download and Build MergePoints","text":"

Click here to download MergePoints and its CMakeLists.txt file. Once the tarball MergePoints.tar has been downloaded and extracted,

cd MergePoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MergePoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/MergeSelections/","title":"MergeSelections","text":"

vtk-examples/Cxx/PolyData/MergeSelections

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/MergeSelections/#code","title":"Code","text":"

MergeSelections.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n// #include <vtkInformation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A nifty way of setting backgrounds in multiple renderers.\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorSchemeByName(\"Brewer Qualitative Pastel2\");\n  colors->SetColor(\"ren0\", colorSeries->GetColor(0));\n  colors->SetColor(\"ren1\", colorSeries->GetColor(1));\n  colors->SetColor(\"ren2\", colorSeries->GetColor(2));\n  colors->SetColor(\"ren3\", colorSeries->GetColor(3));\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(50);\n  pointSource->Update();\n\n  std::cout << \"There are \" << pointSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n\n  vtkNew<vtkIdTypeArray> ids1;\n  ids1->SetNumberOfComponents(1);\n\n  // Set values\n  for (unsigned int i = 10; i < 20; i++)\n  {\n    ids1->InsertNextValue(i);\n  }\n\n  vtkNew<vtkIdTypeArray> ids2;\n  ids2->SetNumberOfComponents(1);\n\n  for (unsigned int i = 15; i < 30; i++)\n  {\n    ids2->InsertNextValue(i);\n  }\n\n  vtkNew<vtkSelectionNode> selectionNode1;\n  selectionNode1->SetFieldType(vtkSelectionNode::POINT);\n  selectionNode1->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode1->SetSelectionList(ids1);\n\n  vtkNew<vtkSelectionNode> selectionNode2;\n  selectionNode2->SetFieldType(vtkSelectionNode::POINT);\n  selectionNode2->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode2->SetSelectionList(ids2);\n\n  vtkNew<vtkSelection> selection1;\n  selection1->AddNode(selectionNode1);\n\n  vtkNew<vtkSelection> selection2;\n  selection2->AddNode(selectionNode2);\n\n  vtkNew<vtkSelection> selectionCombined;\n  selectionCombined->AddNode(selectionNode1);\n  selectionCombined->Union(selectionNode2);\n\n  std::cout << \"There are \" << selectionCombined->GetNumberOfNodes()\n            << \" nodes.\" << std::endl;\n\n  vtkNew<vtkExtractSelection> extractSelection1;\n  extractSelection1->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelection1->SetInputData(1, selection1);\n  extractSelection1->Update();\n\n  vtkNew<vtkExtractSelection> extractSelection2;\n  extractSelection2->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelection2->SetInputData(1, selection2);\n  extractSelection2->Update();\n\n  vtkNew<vtkExtractSelection> extractSelectionCombined;\n  extractSelectionCombined->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelectionCombined->SetInputData(1, selectionCombined);\n  extractSelectionCombined->Update();\n\n  // In selection\n  vtkDataSet* ds =\n      dynamic_cast<vtkDataSet*>(extractSelectionCombined->GetOutput());\n  std::cout << \"There are \" << ds->GetNumberOfPoints()\n            << \" points in the selection.\" << std::endl;\n  std::cout << \"There are \" << ds->GetNumberOfCells()\n            << \" cells in the selection.\" << std::endl;\n\n  /*\n  // Not in selection.\n  // Here we nvert the selections.\n  selectionNode1->GetProperties()->Set(vtkSelectionNode::INVERSE(), 1);\n  selectionNode2->GetProperties()->Set(vtkSelectionNode::INVERSE(), 1);\n  extractSelectionCombined->Update();\n  std::cout << \"There are \"\n            << dynamic_cast<vtkDataSet*>(extractSelectionCombined->GetOutput())\n                   ->GetNumberOfPoints()\n            << \" points not in the selection.\" << std::endl;\n  std::cout << \"There are \"\n            << dynamic_cast<vtkDataSet*>(extractSelectionCombined->GetOutput())\n                   ->GetNumberOfCells()\n            << \" cells not in the selection.\" << std::endl;\n  */\n\n  // Visualize\n  vtkNew<vtkDataSetMapper> mapperOriginal;\n  mapperOriginal->SetInputConnection(pointSource->GetOutputPort());\n  mapperOriginal->ScalarVisibilityOff();\n\n  vtkNew<vtkDataSetMapper> mapper1;\n  mapper1->SetInputConnection(extractSelection1->GetOutputPort());\n  mapper1->ScalarVisibilityOff();\n\n  vtkNew<vtkDataSetMapper> mapper2;\n  mapper2->SetInputConnection(extractSelection2->GetOutputPort());\n  mapper2->ScalarVisibilityOff();\n\n  vtkNew<vtkDataSetMapper> mapperCombined;\n  mapperCombined->SetInputConnection(extractSelectionCombined->GetOutputPort());\n  mapperCombined->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(mapperOriginal);\n  originalActor->GetProperty()->SetPointSize(5);\n  originalActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetPointSize(5);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetPointSize(5);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkActor> actorCombined;\n  actorCombined->SetMapper(mapperCombined);\n  actorCombined->GetProperty()->SetPointSize(5);\n  actorCombined->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->SetWindowName(\"MergeSelections\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  double originalViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double selection1Viewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double selection2Viewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double selectionCombinedViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Create a camera for all renderers\n  vtkNew<vtkCamera> camera;\n\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->SetBackground(colors->GetColor3d(\"Ren0\").GetData());\n  originalRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> selection1Renderer;\n  selection1Renderer->SetViewport(selection1Viewport);\n  selection1Renderer->SetBackground(colors->GetColor3d(\"Ren1\").GetData());\n  selection1Renderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> selection2Renderer;\n  selection2Renderer->SetViewport(selection2Viewport);\n  selection2Renderer->SetBackground(colors->GetColor3d(\"Ren2\").GetData());\n  selection2Renderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> selectionCombinedRenderer;\n  selectionCombinedRenderer->SetViewport(selectionCombinedViewport);\n  selectionCombinedRenderer->SetBackground(\n      colors->GetColor3d(\"Ren3\").GetData());\n  selectionCombinedRenderer->SetActiveCamera(camera);\n\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(selection1Renderer);\n  renderWindow->AddRenderer(selection2Renderer);\n  renderWindow->AddRenderer(selectionCombinedRenderer);\n\n  originalRenderer->AddActor(originalActor);\n  selection1Renderer->AddActor(actor1);\n  selection2Renderer->AddActor(actor2);\n  selectionCombinedRenderer->AddActor(actorCombined);\n\n  originalRenderer->ResetCamera();\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/MergeSelections/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MergeSelections)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MergeSelections: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MergeSelections MACOSX_BUNDLE MergeSelections.cxx )\n  target_link_libraries(MergeSelections PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MergeSelections\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/MergeSelections/#download-and-build-mergeselections","title":"Download and Build MergeSelections","text":"

Click here to download MergeSelections and its CMakeLists.txt file. Once the tarball MergeSelections.tar has been downloaded and extracted,

cd MergeSelections/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MergeSelections\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/MeshQuality/","title":"MeshQuality","text":"

vtk-examples/Cxx/PolyData/MeshQuality

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/MeshQuality/#description","title":"Description","text":"

This example uses one of many selectable methods to determine the quality of a mesh. In this case, we have selected to use the area of the triangles. We show how to retrieve the quality metric computed on each triangle after the process is completed.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/MeshQuality/#code","title":"Code","text":"

MeshQuality.cxx

#include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkColorSeries.h>\n#include <vtkDoubleArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMeshQuality.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n\n#include <iostream>\n#include <string>\n\nvoid MakeLUT(vtkLookupTable* lut)\n{\n  // Make the lookup table.\n  vtkNew<vtkColorSeries> colorSeries;\n  // Select a color scheme.\n  int colorSeriesEnum;\n  colorSeriesEnum = colorSeries->BREWER_DIVERGING_BROWN_BLUE_GREEN_9;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_10;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_3;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_PURPLE_ORANGE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_PURPLE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_GREEN_9;\n  // colorSeriesEnum = colorSeries->BREWER_QUALITATIVE_SET3;\n  // colorSeriesEnum = colorSeries->CITRUS;\n  colorSeries->SetColorScheme(colorSeriesEnum);\n\n  colorSeries->BuildLookupTable(lut);\n  lut->SetNanColor(1, 0, 0, 1);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(sphereSource->GetOutputPort());\n  triangleFilter->Update();\n\n  vtkPolyData* mesh = triangleFilter->GetOutput();\n  std::cout << \"There are \" << mesh->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n\n  vtkNew<vtkMeshQuality> qualityFilter;\n  qualityFilter->SetInputData(mesh);\n  qualityFilter->SetTriangleQualityMeasureToArea();\n  qualityFilter->Update();\n\n  auto qualityArray = dynamic_cast<vtkDoubleArray*>(\n      qualityFilter->GetOutput()->GetCellData()->GetArray(\"Quality\"));\n\n  std::cout << \"There are \" << qualityArray->GetNumberOfTuples() << \" values.\"\n            << std::endl;\n\n  for (vtkIdType i = 0; i < qualityArray->GetNumberOfTuples(); i++)\n  {\n    double val = qualityArray->GetValue(i);\n    std::cout << \"value \" << i << \" : \" << val << std::endl;\n  }\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->ShallowCopy(qualityFilter->GetOutput());\n\n  // Visualize\n\n  vtkNew<vtkLookupTable> lut;\n  MakeLUT(lut);\n  lut->SetTableRange(polydata->GetScalarRange());\n  lut->IndexedLookupOff();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n  mapper->SetScalarRange(polydata->GetScalarRange());\n  mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MeshQuality\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/MeshQuality/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MeshQuality)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  FiltersVerdict\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MeshQuality: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MeshQuality MACOSX_BUNDLE MeshQuality.cxx )\n  target_link_libraries(MeshQuality PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MeshQuality\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/MeshQuality/#download-and-build-meshquality","title":"Download and Build MeshQuality","text":"

Click here to download MeshQuality and its CMakeLists.txt file. Once the tarball MeshQuality.tar has been downloaded and extracted,

cd MeshQuality/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MeshQuality\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/MiscCellData/","title":"MiscCellData","text":"

vtk-examples/Cxx/PolyData/MiscCellData

"},{"location":"Cxx/PolyData/MiscCellData/#description","title":"Description","text":"

This demo attaches a double to a cell (triangle) in a polydata.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/MiscCellData/#code","title":"Code","text":"

MiscCellData.cxx

#include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkTriangle.h>\n#include <vtkXMLPolyDataWriter.h>\n\nint main(int, char*[])\n{\n  // We will write the resulting file to output.vtp so it can be inspected in\n  // Paraview.\n  std::string outputFilename = \"output.vtp\";\n\n  // Setup 3 points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Create a triangle\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n\n  // Add the triangle to a cell array\n  vtkNew<vtkCellArray> triangles;\n  triangles->InsertNextCell(triangle);\n\n  // Setup data for the triangle. Attach a value of 1.45.\n  // This can be anything you wish to store with it.\n  vtkNew<vtkDoubleArray> triangleData;\n  triangleData->SetNumberOfComponents(\n      1); // We will have only 1 value associated with the triangle.\n  triangleData->SetName(\"TriangleData\"); // Set the name of the value.\n  triangleData->InsertNextValue(1.45);   // Set the actual value.\n\n  // Create a polydata that contains the points,\n  // the triangle on those points, and the data\n  // array (value) we created for the triangle.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetPolys(triangles);\n  polydata->GetCellData()->AddArray(triangleData);\n\n  // Write the file.\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetInputData(polydata);\n  writer->SetFileName(outputFilename.c_str());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/MiscCellData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MiscCellData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MiscCellData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MiscCellData MACOSX_BUNDLE MiscCellData.cxx )\n  target_link_libraries(MiscCellData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MiscCellData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/MiscCellData/#download-and-build-misccelldata","title":"Download and Build MiscCellData","text":"

Click here to download MiscCellData and its CMakeLists.txt file. Once the tarball MiscCellData.tar has been downloaded and extracted,

cd MiscCellData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MiscCellData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/MiscPointData/","title":"MiscPointData","text":"

vtk-examples/Cxx/PolyData/MiscPointData

"},{"location":"Cxx/PolyData/MiscPointData/#description","title":"Description","text":"

This demo attaches a vector (in this case a float vector of length 1) to each point in a polydata.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/MiscPointData/#code","title":"Code","text":"

MiscPointData.cxx

#include <vtkFloatArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required arguments: Filename e.g. cowHead.vtp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Get filename from command line.\n  std::string filename = argv[1]; // First command line argument.\n\n  // Read the file\n  vtkNew<vtkXMLPolyDataReader> reader;\n  std::cout << \"Reading \" << filename << std::endl;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Extract the polydata.\n  auto polydata = reader->GetOutput();\n\n  // Get the number of points in the polydata.\n  vtkIdType idNumPointsInFile = polydata->GetNumberOfPoints();\n\n  // Add distances to each point\n  vtkNew<vtkFloatArray> distances;\n  distances->SetNumberOfComponents(1);\n  distances->SetName(\"Distances\");\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  for (vtkIdType i = 0; i < idNumPointsInFile; i++)\n  {\n    distances->InsertNextValue(rng->GetRangeValue(0.0, 1.0));\n    rng->Next();\n  }\n\n  polydata->GetPointData()->AddArray(distances);\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/MiscPointData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MiscPointData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MiscPointData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MiscPointData MACOSX_BUNDLE MiscPointData.cxx )\n  target_link_libraries(MiscPointData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MiscPointData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/MiscPointData/#download-and-build-miscpointdata","title":"Download and Build MiscPointData","text":"

Click here to download MiscPointData and its CMakeLists.txt file. Once the tarball MiscPointData.tar has been downloaded and extracted,

cd MiscPointData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MiscPointData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/MultiBlockMergeFilter/","title":"MultiBlockMergeFilter","text":"

vtk-examples/Cxx/PolyData/MultiBlockMergeFilter

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/MultiBlockMergeFilter/#code","title":"Code","text":"

MultiBlockMergeFilter.cxx

#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockMergeFilter.h>\n#include <vtkNew.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->Update();\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10, 10, 10);\n  sphereSource2->Update();\n\n  vtkNew<vtkMultiBlockDataSet> multiBlockDataSet1;\n  multiBlockDataSet1->SetNumberOfBlocks(1);\n  multiBlockDataSet1->SetBlock(0, sphereSource1->GetOutput());\n\n  vtkNew<vtkMultiBlockDataSet> multiBlockDataSet2;\n  multiBlockDataSet2->SetNumberOfBlocks(1);\n  multiBlockDataSet2->SetBlock(0, sphereSource2->GetOutput());\n\n  vtkNew<vtkMultiBlockMergeFilter> multiBlockMergeFilter;\n  multiBlockMergeFilter->AddInputData(multiBlockDataSet1);\n  multiBlockMergeFilter->AddInputData(multiBlockDataSet2);\n  multiBlockMergeFilter->Update();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/MultiBlockMergeFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultiBlockMergeFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultiBlockMergeFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultiBlockMergeFilter MACOSX_BUNDLE MultiBlockMergeFilter.cxx )\n  target_link_libraries(MultiBlockMergeFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultiBlockMergeFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/MultiBlockMergeFilter/#download-and-build-multiblockmergefilter","title":"Download and Build MultiBlockMergeFilter","text":"

Click here to download MultiBlockMergeFilter and its CMakeLists.txt file. Once the tarball MultiBlockMergeFilter.tar has been downloaded and extracted,

cd MultiBlockMergeFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MultiBlockMergeFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/NullPoint/","title":"NullPoint","text":"

vtk-examples/Cxx/PolyData/NullPoint

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/NullPoint/#code","title":"Code","text":"

NullPoint.cxx

#include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90000000000ULL\n#define VTK_VER_GE_90 1\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(2, 2, 2);\n  points->InsertNextPoint(3, 3, 3);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkFloatArray> floatArray;\n  floatArray->SetNumberOfValues(3);\n  floatArray->SetNumberOfComponents(1);\n  floatArray->SetName(\"FloatArray\");\n  for (vtkIdType i = 0; i < 3; i++)\n  {\n    floatArray->SetValue(i, 2);\n  }\n  polydata->GetPointData()->AddArray(floatArray);\n\n  vtkNew<vtkIntArray> intArray;\n  intArray->SetNumberOfValues(3);\n  intArray->SetNumberOfComponents(1);\n  intArray->SetName(\"IntArray\");\n  for (vtkIdType i = 0; i < 3; i++)\n  {\n    intArray->SetValue(i, 2);\n  }\n\n  polydata->GetPointData()->AddArray(intArray);\n\n  for (vtkIdType i = 0; i < 3; i++)\n  {\n    double p[3];\n    polydata->GetPoint(i, p);\n    vtkFloatArray* pointsFloatArray = dynamic_cast<vtkFloatArray*>(\n        polydata->GetPointData()->GetArray(\"FloatArray\"));\n    vtkIntArray* pointsIntArray = dynamic_cast<vtkIntArray*>(\n        polydata->GetPointData()->GetArray(\"IntArray\"));\n    std::cout << \"Point \" << i << \" : \" << p[0] << \" \" << p[1] << \" \" << p[2]\n              << \" \" << pointsFloatArray->GetValue(i) << \" \"\n              << pointsIntArray->GetValue(i) << std::endl;\n  }\n\n#if VTK_VER_GE_90\n  polydata->GetPointData()->NullData(1);\n#else\n  polydata->GetPointData()->NullPoint(1);\n#endif\n  polydata->Modified();\n\n  for (vtkIdType i = 0; i < 3; i++)\n  {\n    double p[3];\n    polydata->GetPoint(i, p);\n    vtkFloatArray* pointsFloatArray = dynamic_cast<vtkFloatArray*>(\n        polydata->GetPointData()->GetArray(\"FloatArray\"));\n    vtkIntArray* pointsIntArray = dynamic_cast<vtkIntArray*>(\n        polydata->GetPointData()->GetArray(\"IntArray\"));\n    std::cout << \"Point \" << i << \" : \" << p[0] << \" \" << p[1] << \" \" << p[2]\n              << \" \" << pointsFloatArray->GetValue(i) << \" \"\n              << pointsIntArray->GetValue(i) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/NullPoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NullPoint)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NullPoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NullPoint MACOSX_BUNDLE NullPoint.cxx )\n  target_link_libraries(NullPoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NullPoint\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/NullPoint/#download-and-build-nullpoint","title":"Download and Build NullPoint","text":"

Click here to download NullPoint and its CMakeLists.txt file. Once the tarball NullPoint.tar has been downloaded and extracted,

cd NullPoint/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./NullPoint\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/OrientedBoundingCylinder/","title":"OrientedBoundingCylinder","text":"

vtk-examples/Cxx/PolyData/OrientedBoundingCylinder

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/OrientedBoundingCylinder/#description","title":"Description","text":"

This example creates an oriented cylinder that encloses a vtkPolyData. The axis of the cylinder is aligned with the longest axis of the vtkPolyData.

The example proceeds as follow:

  1. A vtkOBBTree creates an oriented bounding box. The z dimension of the box is aligned with the longest axis.
  2. A vtkQuad finds the center of each face of the bounding box.
  3. A vtkLineSource creates a line from the centers of the long axis faces.
  4. vtkTubeFilter creates a \"cylinder\" from the lines with a radius equal to the an inner circle of bounding box.
  5. vtkExtractEnclosedPoints determines if there are points outside the initial guess.
  6. If there are points outside, the example does a linear search from the initial radius to the outer circle.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/OrientedBoundingCylinder/#code","title":"Code","text":"

OrientedBoundingCylinder.cxx

#include <vtkActor.h>\n#include <vtkCleanPolyData.h>\n#include <vtkExtractEnclosedPoints.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuad.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTubeFilter.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n#include <cctype> // For to_lower\n#include <cstdlib>\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\ndouble MakeAQuad(std::vector<std::array<double, 3>>&, std::array<double, 3>&);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  // Get bounds of polydata.\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n\n  // Create the tree.\n  vtkNew<vtkOBBTree> obbTree;\n  obbTree->SetDataSet(polyData);\n  obbTree->SetMaxLevel(1);\n  obbTree->BuildLocator();\n\n  // Get the PolyData for the OBB.\n  vtkNew<vtkPolyData> obbPolydata;\n  obbTree->GenerateRepresentation(0, obbPolydata);\n\n  // Get the points of the OBB.\n  vtkNew<vtkPoints> obbPoints;\n  obbPoints->DeepCopy(obbPolydata->GetPoints());\n\n  // Use a quad to find centers of OBB faces.\n  vtkNew<vtkQuad> aQuad;\n\n  std::vector<std::array<double, 3>> facePoints(4);\n  std::vector<std::array<double, 3>> centers(3);\n  std::vector<std::array<double, 3>> endPoints(3);\n\n  std::array<double, 3> center;\n  std::array<double, 3> endPoint;\n  std::array<double, 3> point0, point1, point2, point3, point4, point5, point6,\n      point7;\n  std::array<double, 3> radii;\n  std::array<double, 3> lengths;\n\n  // Transfer the points to std::array's.\n  obbPoints->GetPoint(0, point0.data());\n  obbPoints->GetPoint(1, point1.data());\n  obbPoints->GetPoint(2, point2.data());\n  obbPoints->GetPoint(3, point3.data());\n  obbPoints->GetPoint(4, point4.data());\n  obbPoints->GetPoint(5, point5.data());\n  obbPoints->GetPoint(6, point6.data());\n  obbPoints->GetPoint(7, point7.data());\n\n  // x face.\n  // ids[0] = 2; ids[1] = 3; ids[2] = 7; ids[3] = 6;\n  facePoints[0] = point2;\n  facePoints[1] = point3;\n  facePoints[2] = point7;\n  facePoints[3] = point6;\n  radii[0] = MakeAQuad(facePoints, centers[0]);\n  MakeAQuad(facePoints, centers[0]);\n  // ids[0] = 0; ids[1] = 4; ids[2] = 5; ids[3] = 1;\n  facePoints[0] = point0;\n  facePoints[1] = point4;\n  facePoints[2] = point5;\n  facePoints[3] = point1;\n  MakeAQuad(facePoints, endPoints[0]);\n  lengths[0] = std::sqrt(vtkMath::Distance2BetweenPoints(centers[0].data(),\n                                                         endPoints[0].data())) /\n      2.0;\n\n  // y face.\n  // ids[0] = 0; ids[1] = 1; ids[2] = 2; ids[3] = 3;\n  facePoints[0] = point0;\n  facePoints[1] = point1;\n  facePoints[2] = point2;\n  facePoints[3] = point3;\n  radii[1] = MakeAQuad(facePoints, centers[1]);\n  // ids[0] = 4; ids[1] = 6; ids[2] = 7; ids[3] = 5;\n  facePoints[0] = point4;\n  facePoints[1] = point6;\n  facePoints[2] = point7;\n  facePoints[3] = point5;\n  MakeAQuad(facePoints, endPoints[1]);\n  lengths[1] = std::sqrt(vtkMath::Distance2BetweenPoints(centers[1].data(),\n                                                         endPoints[1].data())) /\n      2.0;\n\n  // z face.\n  // ids[0] = 0; ids[1] = 2; ids[2] = 6; ids[3] = 4;\n  facePoints[0] = point0;\n  facePoints[1] = point2;\n  facePoints[2] = point6;\n  facePoints[3] = point4;\n  MakeAQuad(facePoints, centers[2]);\n  radii[2] =\n      std::sqrt(vtkMath::Distance2BetweenPoints(point0.data(), point2.data())) /\n      2.0;\n  double outerRadius =\n      std::sqrt(vtkMath::Distance2BetweenPoints(point0.data(), point6.data())) /\n      2.0;\n\n  // ids[0] = 1; ids[1] = 3; ids[2] = 7; ids[3] = 5;\n  facePoints[0] = point1;\n  facePoints[1] = point5;\n  facePoints[2] = point7;\n  facePoints[3] = point3;\n  MakeAQuad(facePoints, endPoints[2]);\n  lengths[2] = std::sqrt(vtkMath::Distance2BetweenPoints(centers[2].data(),\n                                                         endPoints[2].data())) /\n      2.0;\n\n  // Find long axis.\n  int longAxis = -1;\n  double length = VTK_DOUBLE_MIN;\n  for (auto i = 0; i < 3; ++i)\n  {\n    std::cout << \"length: \" << lengths[i] << std::endl;\n    if (lengths[i] > length)\n    {\n      length = lengths[i];\n      longAxis = i;\n    }\n  }\n  std::cout << \"longAxis: \" << longAxis << std::endl;\n  std::cout << \"radii: \";\n  double radius = radii[longAxis];\n  for (auto& a : radii)\n  {\n    std::cout << a << \", \";\n  }\n  std::cout << std::endl;\n  std::cout << \"radius: \" << radius << std::endl;\n  std::cout << \"outerRadius: \" << outerRadius << std::endl;\n  center = centers[longAxis];\n  endPoint = endPoints[longAxis];\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(center.data());\n  lineSource->SetPoint2(endPoint.data());\n\n  vtkNew<vtkTubeFilter> tube;\n  tube->SetInputConnection(lineSource->GetOutputPort());\n  tube->SetRadius(radius);\n  tube->SetNumberOfSides(51);\n  tube->CappingOn();\n  tube->Update();\n\n  // See if all points lie inside cylinder.\n  vtkNew<vtkCleanPolyData> clean;\n  clean->SetInputData(tube->GetOutput());\n  clean->Update();\n\n  vtkNew<vtkExtractEnclosedPoints> enclosedPoints;\n  enclosedPoints->SetSurfaceData(clean->GetOutput());\n  enclosedPoints->SetInputData(polyData);\n  enclosedPoints->SetTolerance(.0001);\n  enclosedPoints->GenerateOutliersOn();\n  enclosedPoints->CheckSurfaceOn();\n  enclosedPoints->Update();\n\n  std::cout << \"polyData points: \" << polyData->GetPoints()->GetNumberOfPoints()\n            << \" excluded points: \"\n            << enclosedPoints->GetOutput(1)->GetPoints()->GetNumberOfPoints()\n            << std::endl;\n\n  vtkNew<vtkPolyDataMapper> repMapper;\n  repMapper->SetInputData(obbPolydata);\n  vtkNew<vtkActor> repActor;\n  repActor->SetMapper(repMapper);\n  repActor->GetProperty()->SetColor(colors->GetColor3d(\"peacock\").GetData());\n  repActor->GetProperty()->SetOpacity(.6);\n\n  // Create a mapper and actor for the cylinder.\n  vtkNew<vtkPolyDataMapper> cylinderMapper;\n  cylinderMapper->SetInputConnection(tube->GetOutputPort());\n\n  vtkNew<vtkActor> cylinderActor;\n\n  cylinderActor->SetMapper(cylinderMapper);\n  cylinderActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"banana\").GetData());\n  cylinderActor->GetProperty()->SetOpacity(.5);\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputData(polyData);\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"tomato\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  // Display all centers and endpoints.\n  std::vector<vtkColor3d> cs;\n  cs.push_back(colors->GetColor3d(\"red\"));\n  cs.push_back(colors->GetColor3d(\"green\"));\n  cs.push_back(colors->GetColor3d(\"blue\"));\n  for (auto i = 0; i < 3; ++i)\n  {\n    vtkNew<vtkSphereSource> ps1;\n    ps1->SetCenter(centers[i].data());\n    ps1->SetRadius(length * .04);\n    ps1->SetPhiResolution(21);\n    ps1->SetThetaResolution(41);\n    vtkNew<vtkPolyDataMapper> pm1;\n    pm1->SetInputConnection(ps1->GetOutputPort());\n    vtkNew<vtkActor> pa1;\n    pa1->GetProperty()->SetColor(cs[i].GetData());\n    pa1->GetProperty()->SetSpecularPower(50);\n    pa1->GetProperty()->SetSpecular(.4);\n    pa1->GetProperty()->SetDiffuse(.6);\n    pa1->SetMapper(pm1);\n    renderer->AddActor(pa1);\n\n    vtkNew<vtkSphereSource> ps2;\n    ps2->SetCenter(endPoints[i].data());\n    ps2->SetRadius(length * .04);\n    ps2->SetPhiResolution(21);\n    ps2->SetThetaResolution(41);\n    vtkNew<vtkPolyDataMapper> pm2;\n    pm2->SetInputConnection(ps2->GetOutputPort());\n    vtkNew<vtkActor> pa2;\n    pa2->GetProperty()->SetColor(cs[i].GetData());\n    pa2->SetMapper(pm2);\n    renderer->AddActor(pa2);\n  }\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OrientedBoundingCylinder\");\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  // Add the actors to the scene.\n  renderer->AddActor(originalActor);\n  renderer->AddActor(cylinderActor);\n  //  renderer->AddActor(repActor);\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"SkyBlue\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"LightSeaGreen\").GetData());\n\n  // double adjustedRadius = radius;\n  double adjustedIncr = (outerRadius - radius) / 20.0;\n  if (enclosedPoints->GetOutput(1)->GetPoints()->GetNumberOfPoints() > 4)\n  {\n    std::cout << \"improving...\" << std::endl;\n    for (double r = radius;\n         enclosedPoints->GetOutput(1)->GetPoints()->GetNumberOfPoints() > 4;\n         r += adjustedIncr)\n    {\n      tube->SetRadius(r);\n      tube->Update();\n      clean->Update();\n      enclosedPoints->Update();\n      if (enclosedPoints->GetOutput(1)->GetPoints() != nullptr)\n      {\n        std::cout << \"r: \" << r << std::endl;\n        std::cout\n            << \" excluded points: \"\n            << enclosedPoints->GetOutput(1)->GetPoints()->GetNumberOfPoints()\n            << std::endl;\n        renderWindow->Render();\n      }\n      else\n      {\n        break;\n      }\n    }\n  }\n\n  // Render and interact.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase.\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\ndouble MakeAQuad(std::vector<std::array<double, 3>>& points,\n                 std::array<double, 3>& center)\n{\n  vtkNew<vtkQuad> aQuad;\n  aQuad->GetPoints()->SetPoint(0, points[0].data());\n  aQuad->GetPoints()->SetPoint(1, points[1].data());\n  aQuad->GetPoints()->SetPoint(2, points[2].data());\n  aQuad->GetPoints()->SetPoint(3, points[3].data());\n  aQuad->GetPointIds()->SetId(0, 0);\n  aQuad->GetPointIds()->SetId(1, 1);\n  aQuad->GetPointIds()->SetId(2, 2);\n  aQuad->GetPointIds()->SetId(3, 3);\n\n  std::array<double, 3> pcenter;\n  pcenter[0] = pcenter[1] = pcenter[2] = -12345.0;\n  aQuad->GetParametricCenter(pcenter.data());\n  std::vector<double> cweights(aQuad->GetNumberOfPoints());\n  int pSubId = 0;\n  aQuad->EvaluateLocation(pSubId, pcenter.data(), center.data(),\n                          &(*cweights.begin()));\n\n  std::cout << \"center: \";\n  for (auto& a : center)\n  {\n    std::cout << a << \", \";\n  }\n  std::cout << std::endl;\n\n  return std::sqrt(aQuad->GetLength2()) / 2.0;\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/OrientedBoundingCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientedBoundingCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientedBoundingCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientedBoundingCylinder MACOSX_BUNDLE OrientedBoundingCylinder.cxx )\n  target_link_libraries(OrientedBoundingCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientedBoundingCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/OrientedBoundingCylinder/#download-and-build-orientedboundingcylinder","title":"Download and Build OrientedBoundingCylinder","text":"

Click here to download OrientedBoundingCylinder and its CMakeLists.txt file. Once the tarball OrientedBoundingCylinder.tar has been downloaded and extracted,

cd OrientedBoundingCylinder/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OrientedBoundingCylinder\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/Outline/","title":"Outline","text":"

vtk-examples/Cxx/PolyData/Outline

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/Outline/#description","title":"Description","text":"

This example shows how to draw the outline of the dataset.

Seealso

BoundingBox and CubeAxesActor2D.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/Outline/#code","title":"Code","text":"

Outline.cxx

#include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cone.\n  vtkNew<vtkConeSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetResolution(100);\n  source->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the outline.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Setup the window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Outline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor(outlineActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/Outline/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Outline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Outline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Outline MACOSX_BUNDLE Outline.cxx )\n  target_link_libraries(Outline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Outline\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/Outline/#download-and-build-outline","title":"Download and Build Outline","text":"

Click here to download Outline and its CMakeLists.txt file. Once the tarball Outline.tar has been downloaded and extracted,

cd Outline/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Outline\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ParametricSpline/","title":"ParametricSpline","text":"

vtk-examples/Cxx/PolyData/ParametricSpline

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ParametricSpline/#code","title":"Code","text":"

ParametricSpline.cxx

#include <vtkActor.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create three points. We will join (Origin and P0) with a red line and\n  // (Origin and P1) with a green line.\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n  double p2[3] = {0.0, 1.0, 2.0};\n  double p3[3] = {1.0, 2.0, 3.0};\n\n  // Create a vtkPoints object and store the points in it.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(origin);\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetPoints(points);\n\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->Update();\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(0.1);\n\n  // Setup actor and mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(functionSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DarkSlateGrey\").GetData());\n  actor->GetProperty()->SetLineWidth(3.0);\n\n  // Create a polydata to store everything in.\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputData(polyData);\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ParametricSpline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->AddActor(pointActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ParametricSpline/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParametricSpline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParametricSpline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParametricSpline MACOSX_BUNDLE ParametricSpline.cxx )\n  target_link_libraries(ParametricSpline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParametricSpline\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ParametricSpline/#download-and-build-parametricspline","title":"Download and Build ParametricSpline","text":"

Click here to download ParametricSpline and its CMakeLists.txt file. Once the tarball ParametricSpline.tar has been downloaded and extracted,

cd ParametricSpline/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ParametricSpline\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PointCellIds/","title":"PointCellIds","text":"

vtk-examples/Cxx/PolyData/PointCellIds

"},{"location":"Cxx/PolyData/PointCellIds/#description","title":"Description","text":"

This example demonstrates how to get the number of Ids in points and cells.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PointCellIds/#code","title":"Code","text":"

PointCellIds.cxx

#include <vtkCellData.h>\n#include <vtkIdFilter.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfPoints()\n            << \" points.\" << std::endl;\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfCells()\n            << \" cells.\" << std::endl;\n\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputConnection(sphereSource->GetOutputPort());\n#if VTK890\n  idFilter->SetPointIdsArrayName(\"ids\");\n  idFilter->SetCellIdsArrayName(\"ids\");\n#else\n  idFilter->SetIdsArrayName(\"ids\");\n#endif\n  idFilter->Update();\n\n  std::cout << \"point arrays: \" << std::endl;\n  for (vtkIdType i = 0;\n       i < idFilter->GetOutput()->GetPointData()->GetNumberOfArrays(); i++)\n  {\n    std::cout << idFilter->GetOutput()->GetPointData()->GetArrayName(i)\n              << std::endl;\n  }\n\n  std::cout << \"cell arrays: \" << std::endl;\n  for (vtkIdType i = 0;\n       i < idFilter->GetOutput()->GetCellData()->GetNumberOfArrays(); i++)\n  {\n    std::cout << idFilter->GetOutput()->GetCellData()->GetArrayName(i)\n              << std::endl;\n  }\n\n  vtkIdTypeArray* pointIds = dynamic_cast<vtkIdTypeArray*>(\n      idFilter->GetOutput()->GetPointData()->GetArray(\"ids\"));\n  std::cout << \"There are \" << pointIds->GetNumberOfTuples() << \" point ids\"\n            << std::endl;\n\n  vtkIdTypeArray* cellIds = dynamic_cast<vtkIdTypeArray*>(\n      idFilter->GetOutput()->GetCellData()->GetArray(\"ids\"));\n  std::cout << \"There are \" << cellIds->GetNumberOfTuples() << \" cell ids\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PointCellIds/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointCellIds)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointCellIds: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointCellIds MACOSX_BUNDLE PointCellIds.cxx )\n  target_link_libraries(PointCellIds PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointCellIds\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PointCellIds/#download-and-build-pointcellids","title":"Download and Build PointCellIds","text":"

Click here to download PointCellIds and its CMakeLists.txt file. Once the tarball PointCellIds.tar has been downloaded and extracted,

cd PointCellIds/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointCellIds\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PointInsideObject/","title":"PointInsideObject","text":"

vtk-examples/Cxx/PolyData/PointInsideObject

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/PointInsideObject/#description","title":"Description","text":"

This example creates a cube at the origin with side 1. Then it checks if the points are inside the cube. There is one point inside, one in the border and one outside. The answer for the first one should be yes, and for the other two, no.

Then render the cube and the points to see the result.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PointInsideObject/#code","title":"Code","text":"

PointInsideObject.cxx

#include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkDataArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelectEnclosedPoints.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A cube centered on the origin, 1cm sides.\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  vtkPolyData* cube = cubeSource->GetOutput();\n\n  double testInside[3] = {0.0, 0.0, 0.0};\n  double testOutside[3] = {0.7, 0.0, 0.0};\n  double testBorderOutside[3] = {0.5, 0.0, 0.0};\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(testInside);\n  points->InsertNextPoint(testOutside);\n  points->InsertNextPoint(testBorderOutside);\n\n  vtkNew<vtkPolyData> pointsPolydata;\n  pointsPolydata->SetPoints(points);\n\n  // Points inside test.\n  vtkNew<vtkSelectEnclosedPoints> selectEnclosedPoints;\n  selectEnclosedPoints->SetInputData(pointsPolydata);\n  selectEnclosedPoints->SetSurfaceData(cube);\n  selectEnclosedPoints->Update();\n\n  for (unsigned int i = 0; i < 3; ++i)\n  {\n    std::cout << \"Point \" << i << \": \";\n    if (selectEnclosedPoints->IsInside(i) == 1)\n    {\n      std::cout << \"inside\" << std::endl;\n    }\n    else\n    {\n      std::cout << \"outside\" << std::endl;\n    }\n  }\n\n  auto insideArray = dynamic_cast<vtkDataArray*>(\n      selectEnclosedPoints->GetOutput()->GetPointData()->GetArray(\n          \"SelectedPoints\"));\n\n  for (vtkIdType i = 0; i < insideArray->GetNumberOfTuples(); ++i)\n  {\n    std::cout << \"Tuple \" << i << \": \";\n    if (insideArray->GetComponent(i, 0) == 1)\n    {\n      std::cout << \"inside\" << std::endl;\n    }\n    else\n    {\n      std::cout << \"outside\" << std::endl;\n    }\n  }\n\n  // RENDERING PART\n\n  // Cube mapper, actor.\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetOpacity(0.5);\n  cubeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"SandyBrown\").GetData());\n\n  // Points mapper, actor.\n  // First, apply vtkVertexGlyphFilter to make cells around points, vtk only\n  // render cells.\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->AddInputData(pointsPolydata);\n  vertexGlyphFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetPointSize(5);\n  pointsActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"GreenYellow\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointCellIds\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(cubeActor);\n  renderer->AddActor(pointsActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PointInsideObject/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointInsideObject)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointInsideObject: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointInsideObject MACOSX_BUNDLE PointInsideObject.cxx )\n  target_link_libraries(PointInsideObject PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointInsideObject\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PointInsideObject/#download-and-build-pointinsideobject","title":"Download and Build PointInsideObject","text":"

Click here to download PointInsideObject and its CMakeLists.txt file. Once the tarball PointInsideObject.tar has been downloaded and extracted,

cd PointInsideObject/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointInsideObject\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PointInsideObject2/","title":"PointInsideObject2","text":"

vtk-examples/Cxx/PolyData/PointInsideObject2

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/PointInsideObject2/#description","title":"Description","text":"

This example creates a volume (convex hull-ish) out of a mesh object. It then uses FindCell (which determines if a point is inside of a cell) to determine if a point is inside of any of the 3D cells created by Delaunay3D or not. This could potentially lead to false positives - that is, points that are outside the mesh but inside the convex hull.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PointInsideObject2/#code","title":"Code","text":"

PointInsideObject2.cxx

#include <vtkActor.h>\n#include <vtkDelaunay3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmoothPolyDataFilter.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> bigSphereSource;\n  bigSphereSource->SetCenter(0.0, 0.0, 0.0);\n  bigSphereSource->SetRadius(4);\n  bigSphereSource->SetThetaResolution(20);\n  bigSphereSource->SetPhiResolution(20);\n  bigSphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> bigSphereMapper;\n  bigSphereMapper->SetInputConnection(bigSphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> bigSphereActor;\n  bigSphereActor->SetMapper(bigSphereMapper);\n  bigSphereActor->GetProperty()->SetOpacity(0.5);\n  bigSphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkSphereSource> smallSphereSource;\n  smallSphereSource->SetCenter(1, 2, 1);\n  smallSphereSource->SetRadius(2);\n  smallSphereSource->SetThetaResolution(20);\n  smallSphereSource->SetPhiResolution(20);\n  smallSphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> smallSphereMapper;\n  smallSphereMapper->SetInputConnection(smallSphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> smallSphereActor;\n  smallSphereActor->SetMapper(smallSphereMapper);\n  smallSphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Cornsilk\").GetData());\n\n  vtkNew<vtkPoints> pointsInside;\n  vtkNew<vtkPolyData> polyDataInside;\n  double point[3];\n\n  // We generate points inside a spherical area defined by bigSphereSource.\n  // Then we apply delaunay3D to it instead on  bigSphereSource.\n  // This will avoid the \"Unable to factor linear system\" warnings cuused by\n  //  degenerate points on the sphere.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(400);\n  // Slightly larger than the radius of the big sphere\n  pointSource->SetRadius(4.2);\n\n  vtkNew<vtkSmoothPolyDataFilter> smoothFilter;\n  smoothFilter->SetInputConnection(0, bigSphereSource->GetOutputPort());\n  smoothFilter->SetInputConnection(1, pointSource->GetOutputPort());\n\n  vtkNew<vtkDelaunay3D> delaunay3D;\n  // delaunay3D->SetInputConnection(bigSphereSource->GetOutputPort());\n  delaunay3D->SetInputConnection(smoothFilter->GetOutputPort());\n  delaunay3D->Update();\n\n  for (vtkIdType i = 0; i < smallSphereSource->GetOutput()->GetNumberOfPoints();\n       i++)\n  {\n    smallSphereSource->GetOutput()->GetPoint(i, point);\n\n    double pcoords[3];\n    // The number of weights >= max number of nodes in each cell.\n    double weights[4];\n    int subId;\n    vtkIdType cellId = delaunay3D->GetOutput()->FindCell(\n        point, nullptr, 0, 0.1, subId, pcoords, weights);\n\n    if (cellId >= 0)\n    {\n      std::cout << \"In cell \" << cellId << std::endl;\n      std::cout << \"inside\" << std::endl;\n      pointsInside->InsertNextPoint(point);\n    }\n    else\n    {\n      std::cout << \"outside\" << std::endl;\n    }\n  }\n\n  polyDataInside->SetPoints(pointsInside);\n\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->SetInputData(polyDataInside);\n  vertexGlyphFilter->Update();\n\n  // Mapper and actor for points inside.\n  vtkNew<vtkPolyDataMapper> pointsInsideMapper;\n  pointsInsideMapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n  vtkNew<vtkActor> pointsInsideActor;\n  pointsInsideActor->SetMapper(pointsInsideMapper);\n  pointsInsideActor->GetProperty()->SetPointSize(6);\n  pointsInsideActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Magenta\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointInsideObject2\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(smallSphereActor);\n  renderer->AddActor(bigSphereActor);\n  renderer->AddActor(pointsInsideActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PointInsideObject2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointInsideObject2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointInsideObject2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointInsideObject2 MACOSX_BUNDLE PointInsideObject2.cxx )\n  target_link_libraries(PointInsideObject2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointInsideObject2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PointInsideObject2/#download-and-build-pointinsideobject2","title":"Download and Build PointInsideObject2","text":"

Click here to download PointInsideObject2 and its CMakeLists.txt file. Once the tarball PointInsideObject2.tar has been downloaded and extracted,

cd PointInsideObject2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointInsideObject2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PointLocator/","title":"PointLocator","text":"

vtk-examples/Cxx/PolyData/PointLocator

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/PointLocator/#description","title":"Description","text":"

Create a point locator for a set of points. The 'n' (next) and 'p' (previous) keys change the resolution of the cells.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PointLocator/#code","title":"Code","text":"

PointLocator.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointLocator.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nclass KeyPressInteractorStyle3 : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static KeyPressInteractorStyle3* New();\n\n  KeyPressInteractorStyle3() : PointsPerBucket(1)\n  {\n    pointLocator = nullptr;\n    renderWindow = nullptr;\n    polydata = nullptr;\n  }\n\n  virtual void OnChar()\n  {\n    vtkRenderWindowInteractor* rwi = this->Interactor;\n    char ch = rwi->GetKeyCode();\n\n    switch (ch)\n    {\n    case 'n':\n      cout << \"Next.\" << endl;\n      this->PointsPerBucket++;\n      break;\n    case 'p':\n      cout << \"Previous.\" << endl;\n      if (this->PointsPerBucket > 1)\n      {\n        this->PointsPerBucket--;\n      }\n      break;\n    default:\n      std::cout << \"An unhandled key was pressed.\" << std::endl;\n      break;\n    }\n\n    std::cout << \"PointsPerBucket = \" << this->PointsPerBucket << std::endl;\n\n    // Create the tree.\n    pointLocator->SetNumberOfPointsPerBucket(this->PointsPerBucket);\n    pointLocator->BuildLocator();\n    pointLocator->GenerateRepresentation(1, polydata);\n\n    renderWindow->Render();\n\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnChar();\n  }\n\n  vtkPointLocator* pointLocator;\n  vtkRenderWindow* renderWindow;\n  vtkPolyData* polydata;\n\nprivate:\n  unsigned int PointsPerBucket;\n};\n\nvtkStandardNewMacro(KeyPressInteractorStyle3);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(4000);\n  pointSource->Update();\n\n  // Create the tree\n  vtkNew<vtkPointLocator> pointLocator;\n  pointLocator->SetDataSet(pointSource->GetOutput());\n  pointLocator->AutomaticOn();\n  pointLocator->SetNumberOfPointsPerBucket(2);\n  pointLocator->BuildLocator();\n\n  std::cout << \"There are \" << pointLocator->GetLevel() << \" levels.\"\n            << std::endl;\n  std::cout << \"There are \" << pointLocator->GetNumberOfPointsPerBucket()\n            << \" points per bucket.\" << endl;\n\n  vtkNew<vtkPolyData> polydata;\n  pointLocator->GenerateRepresentation(pointLocator->GetLevel(), polydata);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointLocator\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<KeyPressInteractorStyle3> style;\n  style->pointLocator = pointLocator;\n  style->renderWindow = renderWindow;\n  style->polydata = polydata;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Beige\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderWindow->SetWindowName(\"PointLocator\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PointLocator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointLocator)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointLocator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointLocator MACOSX_BUNDLE PointLocator.cxx )\n  target_link_libraries(PointLocator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointLocator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PointLocator/#download-and-build-pointlocator","title":"Download and Build PointLocator","text":"

Click here to download PointLocator and its CMakeLists.txt file. Once the tarball PointLocator.tar has been downloaded and extracted,

cd PointLocator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointLocator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PointLocatorRadius/","title":"PointLocatorRadius","text":"

vtk-examples/Cxx/PolyData/PointLocatorRadius

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PointLocatorRadius/#code","title":"Code","text":"

PointLocatorRadius.cxx

#include <vtkIdList.h>\n#include <vtkNew.h>\n#include <vtkPointLocator.h>\n#include <vtkPointSource.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(400);\n  pointSource->Update();\n\n  // Create the tree.\n  vtkNew<vtkPointLocator> pointLocator;\n  pointLocator->SetDataSet(pointSource->GetOutput());\n  pointLocator->AutomaticOn();\n  pointLocator->SetNumberOfPointsPerBucket(2);\n  pointLocator->BuildLocator();\n\n  double radius = 0.1;\n  double center[3] = {0.0, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n  pointLocator->FindPointsWithinRadius(radius, center, result);\n\n  for (vtkIdType i = 0; i < result->GetNumberOfIds(); i++)\n  {\n    unsigned int id = result->GetId(i);\n    std::cout << \"id of point \" << i << \" : \" << id << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PointLocatorRadius/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointLocatorRadius)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointLocatorRadius: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointLocatorRadius MACOSX_BUNDLE PointLocatorRadius.cxx )\n  target_link_libraries(PointLocatorRadius PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointLocatorRadius\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PointLocatorRadius/#download-and-build-pointlocatorradius","title":"Download and Build PointLocatorRadius","text":"

Click here to download PointLocatorRadius and its CMakeLists.txt file. Once the tarball PointLocatorRadius.tar has been downloaded and extracted,

cd PointLocatorRadius/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointLocatorRadius\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PointLocatorVisualization/","title":"PointLocatorVisualization","text":"

vtk-examples/Cxx/PolyData/PointLocatorVisualization

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/PointLocatorVisualization/#description","title":"Description","text":"

The idea of this example is to navigate levels of a uniform spatial tree (vtkPointLocator) using a slider.

Note

It is not desirable to have PointsPerBucket set \"too small\". This is because at some point, refining a bucket will result in each cell in that bucket to also be in the bucket's children. This only wastes memory and computation. The value that is \"too small\" is dependent on the grid but in general a value between 10 and 100 should work well (the default value is 25).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PointLocatorVisualization/#code","title":"Code","text":"

PointLocatorVisualization.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointLocator.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n\nclass vtkSliderCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  vtkSliderCallback() : PointLocator(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->PointLocator->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkPointLocator* PointLocator;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n\nvoid SetSliderColors(vtkSliderRepresentation2D* slider);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> inputSource;\n  inputSource->SetPhiResolution(10);\n  inputSource->SetThetaResolution(10);\n  inputSource->Update();\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(inputSource->GetOutputPort());\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Seashell\").GetData());\n\n  // Create the tree.\n  vtkNew<vtkPointLocator> pointLocator;\n  pointLocator->SetDataSet(inputSource->GetOutput());\n  pointLocator->BuildLocator();\n\n  // Initialize the representation.\n  vtkNew<vtkPolyData> polydata;\n  pointLocator->GenerateRepresentation(0, polydata);\n\n  vtkNew<vtkPolyDataMapper> locatorTreeMapper;\n  locatorTreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> locatorTreeActor;\n  locatorTreeActor->SetMapper(locatorTreeMapper);\n  locatorTreeActor->GetProperty()->SetInterpolationToFlat();\n  locatorTreeActor->GetProperty()->SetRepresentationToWireframe();\n  locatorTreeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointLocatorVisualization\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(locatorTreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(pointLocator->GetLevel());\n  sliderRep->SetValue(0);\n  sliderRep->SetTitleText(\"MaxPointsPerRegion\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(0.2, 0.1);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(0.8, 0.1);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  SetSliderColors(sliderRep);\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->PointLocator = pointLocator;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid SetSliderColors(vtkSliderRepresentation2D* slider)\n{\n  vtkNew<vtkNamedColors> colors;\n  // Set color properties:\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(colors->GetColor3d(\"Peru\").GetData());\n  // Change the color of the text indicating what the slider controls.\n  slider->GetTitleProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"DeepPink\").GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(colors->GetColor3d(\"Teal\").GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(colors->GetColor3d(\"Teal\").GetData());\n}\n\n} // namespace\n
"},{"location":"Cxx/PolyData/PointLocatorVisualization/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointLocatorVisualization)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointLocatorVisualization: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointLocatorVisualization MACOSX_BUNDLE PointLocatorVisualization.cxx )\n  target_link_libraries(PointLocatorVisualization PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointLocatorVisualization\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PointLocatorVisualization/#download-and-build-pointlocatorvisualization","title":"Download and Build PointLocatorVisualization","text":"

Click here to download PointLocatorVisualization and its CMakeLists.txt file. Once the tarball PointLocatorVisualization.tar has been downloaded and extracted,

cd PointLocatorVisualization/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointLocatorVisualization\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PointSource/","title":"PointSource","text":"

vtk-examples/Cxx/PolyData/PointSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PointSource/#code","title":"Code","text":"

PointSource.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a point cloud.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetCenter(0.0, 0.0, 0.0);\n  pointSource->SetNumberOfPoints(50);\n  pointSource->SetRadius(5.0);\n  pointSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(pointSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetPointSize(4);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointSource\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PointSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointSource MACOSX_BUNDLE PointSource.cxx )\n  target_link_libraries(PointSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PointSource/#download-and-build-pointsource","title":"Download and Build PointSource","text":"

Click here to download PointSource and its CMakeLists.txt file. Once the tarball PointSource.tar has been downloaded and extracted,

cd PointSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PointsProjectedHull/","title":"PointsProjectedHull","text":"

vtk-examples/Cxx/PolyData/PointsProjectedHull

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/PointsProjectedHull/#description","title":"Description","text":"

This example demonstrates how to find the 2D convex hull of a point set projected onto any of the coordinate planes (in this case, we choose the YZ plane (projection along the x axis) ).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PointsProjectedHull/#code","title":"Code","text":"

PointsProjectedHull.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPointsProjectedHull.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <memory>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.01);\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(40);\n  pointSource->Update();\n\n  // Setup actor and mapper.\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputConnection(pointSource->GetOutputPort());\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkPointsProjectedHull> points;\n  points->DeepCopy(pointSource->GetOutput()->GetPoints());\n\n  int xSize = points->GetSizeCCWHullX();\n  std::cout << \"xSize: \" << xSize << std::endl;\n\n  std::unique_ptr<double[]> pts{new double[xSize * 2]};\n\n  points->GetCCWHullX(pts.get(), xSize);\n\n  vtkNew<vtkPoints> xHullPoints;\n  for (int i = 0; i < xSize; i++)\n  {\n    double yval = pts[2 * i];\n    double zval = pts[2 * i + 1];\n    std::cout << \"(y,z) value of point \" << i << \" : (\" << yval << \" , \" << zval\n              << \")\" << std::endl;\n    xHullPoints->InsertNextPoint(0.0, yval, zval);\n  }\n  // Insert the first point again to close the loop.\n  xHullPoints->InsertNextPoint(0.0, pts[0], pts[1]);\n\n  // Display the x hull.\n  vtkNew<vtkPolyLine> xPolyLine;\n  xPolyLine->GetPointIds()->SetNumberOfIds(xHullPoints->GetNumberOfPoints());\n\n  for (vtkIdType i = 0; i < xHullPoints->GetNumberOfPoints(); i++)\n  {\n    xPolyLine->GetPointIds()->SetId(i, i);\n  }\n\n  // Create a cell array to store the lines in and add the lines to it.\n  vtkNew<vtkCellArray> cells;\n  cells->InsertNextCell(xPolyLine);\n\n  // Create a polydata to store everything in.\n  vtkNew<vtkPolyData> polyData;\n\n  // Add the points to the dataset.\n  polyData->SetPoints(xHullPoints);\n\n  // Add the lines to the dataset.\n  polyData->SetLines(cells);\n\n  // Create tubes around the lines.\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputData(polyData);\n  tubes->SetRadius(0.005);\n  tubes->SetNumberOfSides(21);\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> xHullMapper;\n  xHullMapper->SetInputConnection(tubes->GetOutputPort());\n\n  vtkNew<vtkActor> xHullActor;\n  xHullActor->SetMapper(xHullMapper);\n  xHullActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointsProjectedHull\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->AddActor(xHullActor);\n  renderer->AddActor(pointActor);\n\n  // Rotate camera.\n  renderer->GetActiveCamera()->Azimuth(90);\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PointsProjectedHull/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointsProjectedHull)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointsProjectedHull: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointsProjectedHull MACOSX_BUNDLE PointsProjectedHull.cxx )\n  target_link_libraries(PointsProjectedHull PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointsProjectedHull\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PointsProjectedHull/#download-and-build-pointsprojectedhull","title":"Download and Build PointsProjectedHull","text":"

Click here to download PointsProjectedHull and its CMakeLists.txt file. Once the tarball PointsProjectedHull.tar has been downloaded and extracted,

cd PointsProjectedHull/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointsProjectedHull\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataCellNormals/","title":"PolyDataCellNormals","text":"

vtk-examples/Cxx/PolyData/PolyDataCellNormals

"},{"location":"Cxx/PolyData/PolyDataCellNormals/#description","title":"Description","text":"

This example shows how to add normals to vertices. This is identical to adding normals to any type of cells. The only difference from [Normals to/from a Polydata]]([Add/Get) is

polydata->GetPointData()->SetNormals(PointNormalsArray);

vtkSmartPointer<vtkDoubleArray> PointNormalsRetrieved = vtkDoubleArray::SafeDownCast(polydata->GetPointData()->GetNormals());

are changed to

polydata->GetCellData()->SetNormals(CellNormalsArray);

and

vtkSmartPointer<vtkDoubleArray> CellNormalsRetrieved = vtkDoubleArray::SafeDownCast(polydata->GetCellData()->GetNormals());

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataCellNormals/#code","title":"Code","text":"

PolyDataCellNormals.cxx

#include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n\n  ///////// Set Point Normals ///////////\n\n  // Setup point coordinates\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 0.0, 1.0};\n  double z[3] = {0.0, 0.0, 0.0};\n\n  // create 3 points and add a vertex at each point\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> vertices;\n\n  for (unsigned int i = 0; i < 3; ++i)\n  {\n    // Declare a variable to store the index of the point that gets added. This\n    // behaves just like an unsigned int.\n    vtkIdType pid[1];\n\n    // Add a point to the polydata and save its index, which we will use to\n    // create the vertex on that point.\n    pid[0] = points->InsertNextPoint(x[i], y[i], z[i]);\n\n    // create a vertex cell on the point that was just added.\n    vertices->InsertNextCell(1, pid);\n  }\n\n  // add the points and vertices to a polydata\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetVerts(vertices);\n\n  // set vertex (cell) normals\n  vtkNew<vtkDoubleArray> normalsArray;\n  normalsArray->SetNumberOfComponents(3); // 3d normals (ie x,y,z)\n  normalsArray->SetNumberOfTuples(polydata->GetNumberOfPoints());\n\n  // construct the normal vectors\n  double cN1[3] = {1.0, 0.0, 0.0};\n  double cN2[3] = {0.0, 1.0, 0.0};\n  double cN3[3] = {0.0, 0.0, 1.0};\n\n  // add the data to the normals array\n  normalsArray->SetTuple(0, cN1);\n  normalsArray->SetTuple(1, cN2);\n  normalsArray->SetTuple(2, cN3);\n\n  // add the normals to the cells in the polydata\n  polydata->GetCellData()->SetNormals(normalsArray);\n\n  ///////// Get cell normals ///////////\n  // vtkSmartPointer<vtkDoubleArray> cellNormalsRetrieved =\n  //    dynamic_cast<vtkDoubleArray*>(polydata->GetCellData()->GetNormals());\n  auto cellNormalsRetrieved =\n      dynamic_cast<vtkDoubleArray*>(polydata->GetCellData()->GetNormals());\n  if (cellNormalsRetrieved)\n  {\n    cout << \"There are \" << cellNormalsRetrieved->GetNumberOfTuples()\n         << \" cell normals.\" << endl;\n\n    for (vtkIdType i = 0; i < cellNormalsRetrieved->GetNumberOfTuples(); i++)\n    {\n      double cN[3];\n      cellNormalsRetrieved->GetTuple(i, cN);\n      cout << \"Cell normal \" << i << \": \" << cN[0] << \" \" << cN[1] << \" \"\n           << cN[2] << endl;\n    }\n  }\n  else\n  {\n    cout << \"No cell normals.\" << endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolyDataCellNormals/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataCellNormals)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataCellNormals: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataCellNormals MACOSX_BUNDLE PolyDataCellNormals.cxx )\n  target_link_libraries(PolyDataCellNormals PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataCellNormals\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataCellNormals/#download-and-build-polydatacellnormals","title":"Download and Build PolyDataCellNormals","text":"

Click here to download PolyDataCellNormals and its CMakeLists.txt file. Once the tarball PolyDataCellNormals.tar has been downloaded and extracted,

cd PolyDataCellNormals/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataCellNormals\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/","title":"PolyDataConnectivityFilter LargestRegion","text":"

vtk-examples/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/#description","title":"Description","text":"

This example uses [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ConnectivityFilter to keep the largest connected region of a mesh. Note that this is based on the number of points, not the actual area of the region.

The original vtkPolyData is red, on top. The extracted region is yellow, on the bottom.

Note

Contrast this with PolyDataConnectivityFilter_SpecifiedRegion.

Note

Contributed by: Jinyoung Hwang

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/#code","title":"Code","text":"

PolyDataConnectivityFilter_LargestRegion.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Small sphere\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetRadius(5);\n\n  // Large sphere\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetRadius(10);\n  sphereSource2->SetCenter(25, 0, 0);\n  sphereSource2->SetThetaResolution(10);\n  sphereSource2->SetPhiResolution(10);\n\n  vtkNew<vtkAppendPolyData> appendFilter;\n  appendFilter->AddInputConnection(sphereSource1->GetOutputPort());\n  appendFilter->AddInputConnection(sphereSource2->GetOutputPort());\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputConnection(appendFilter->GetOutputPort());\n  connectivityFilter->SetExtractionModeToLargestRegion();\n\n  // Create a mapper and actor for original data\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(appendFilter->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a mapper and actor for extracted data\n  vtkNew<vtkPolyDataMapper> extractedMapper;\n  extractedMapper->SetInputConnection(connectivityFilter->GetOutputPort());\n  extractedMapper->Update();\n\n  vtkNew<vtkActor> extractedActor;\n  extractedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  extractedActor->SetMapper(extractedMapper);\n  extractedActor->SetPosition(0, -20, 0);\n\n  // Visualization\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(originalActor);\n  renderer->AddActor(extractedActor);\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"Gold\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolyDataConnectivityFilter_LargestRegion\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataConnectivityFilter_LargestRegion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataConnectivityFilter_LargestRegion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataConnectivityFilter_LargestRegion MACOSX_BUNDLE PolyDataConnectivityFilter_LargestRegion.cxx )\n  target_link_libraries(PolyDataConnectivityFilter_LargestRegion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataConnectivityFilter_LargestRegion\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/#download-and-build-polydataconnectivityfilter_largestregion","title":"Download and Build PolyDataConnectivityFilter_LargestRegion","text":"

Click here to download PolyDataConnectivityFilter_LargestRegion and its CMakeLists.txt file. Once the tarball PolyDataConnectivityFilter_LargestRegion.tar has been downloaded and extracted,

cd PolyDataConnectivityFilter_LargestRegion/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataConnectivityFilter_LargestRegion\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/","title":"PolyDataConnectivityFilter SpecifiedRegion","text":"

vtk-examples/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#description","title":"Description","text":"

This example creates two spheres and combines them together into one polydata. The [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ConnectivityFilter is used to find the two spheres as they are separate regions (disconnected). If region 0 is selected, the small sphere is extracted. If region 1 is selected, the large sphere is extracted.

The original vtkPolyData is red, on top. The extracted region is yellow, on the bottom.

Note

Contrast this with PolyDataConnectivityFilter_LargestRegion.

Note

Contributed by: Jinyoung Hwang

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#code","title":"Code","text":"

PolyDataConnectivityFilter_SpecifiedRegion.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkNamedColors.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetRadius(5);\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetRadius(10);\n  sphereSource2->SetCenter(25, 0, 0);\n\n  vtkNew<vtkAppendPolyData> appendFilter;\n  appendFilter->AddInputConnection(sphereSource1->GetOutputPort());\n  appendFilter->AddInputConnection(sphereSource2->GetOutputPort());\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputConnection(appendFilter->GetOutputPort());\n  connectivityFilter->SetExtractionModeToSpecifiedRegions();\n  connectivityFilter->AddSpecifiedRegion(0); // select the region to extract\n                                             // here\n  connectivityFilter->Update();\n\n  // Create a mapper and actor for original data\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(appendFilter->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // create a mapper and actor for extracted data\n  vtkNew<vtkPolyDataMapper> extractedMapper;\n  extractedMapper->SetInputConnection(connectivityFilter->GetOutputPort());\n\n  vtkNew<vtkActor> extractedActor;\n  extractedActor->SetMapper(extractedMapper);\n  extractedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  extractedActor->SetPosition(0, -20, 0);\n\n  // create a renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(originalActor);\n  renderer->AddActor(extractedActor);\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"Gold\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Silver\").GetData());\n\n  // create a render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolyDataConnectivityFilter_SpecifiedRegion\");\n\n  // create an interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataConnectivityFilter_SpecifiedRegion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataConnectivityFilter_SpecifiedRegion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataConnectivityFilter_SpecifiedRegion MACOSX_BUNDLE PolyDataConnectivityFilter_SpecifiedRegion.cxx )\n  target_link_libraries(PolyDataConnectivityFilter_SpecifiedRegion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataConnectivityFilter_SpecifiedRegion\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#download-and-build-polydataconnectivityfilter_specifiedregion","title":"Download and Build PolyDataConnectivityFilter_SpecifiedRegion","text":"

Click here to download PolyDataConnectivityFilter_SpecifiedRegion and its CMakeLists.txt file. Once the tarball PolyDataConnectivityFilter_SpecifiedRegion.tar has been downloaded and extracted,

cd PolyDataConnectivityFilter_SpecifiedRegion/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataConnectivityFilter_SpecifiedRegion\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataContourToImageData/","title":"PolyDataContourToImageData","text":"

vtk-examples/Cxx/PolyData/PolyDataContourToImageData

"},{"location":"Cxx/PolyData/PolyDataContourToImageData/#description","title":"Description","text":"
  • Contributed by: Lars Friedrich

This example generates a sphere, cuts it with a plane and, therefore, generates a circlular contour (vtkPolyData). Subsequently a binary image representation (vtkImageData) is extracted from it. Internally [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ToImageStencil and vtkLinearExtrusionFilter are utilized. Both the circular poly data (circle.vtp) and the resultant image (labelImage.mhd) are saved to disk.

Note

Similar to example PolyDataToImageData, I am not really sure whether or not the image origin needs to be adjusted as the sphere-image-overlay shows some offset in paraview visualization (at least I think ...). Maybe someone could verify that. Thanks!

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataContourToImageData/#code","title":"Code","text":"

PolyDataContourToImageData.cxx

#include <vtkCutter.h>\n#include <vtkImageData.h>\n#include <vtkImageStencil.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkMetaImageWriter.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataToImageStencil.h>\n#include <vtkSphereSource.h>\n#include <vtkStripper.h>\n#include <vtkXMLPolyDataWriter.h>\n\n// This example generates a sphere, cuts it with a plane and, therefore,\n// generates a circlular contour (vtkPolyData). Subsequently a binary\n// image representation (vtkImageData) is extracted from it. Internally\n// vtkPolyDataToImageStencil and vtkLinearExtrusionFilter are\n// utilized. Both the circular poly data (circle.vtp) and the resultant\n// image (labelImage.mhd) are saved to disk.\n\nint main(int, char*[])\n{\n  // 3D source sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n  sphereSource->SetCenter(40, 40, 0);\n  sphereSource->SetRadius(20);\n\n  // generate circle by cutting the sphere with an implicit plane\n  // (through its center, axis-aligned)\n  vtkNew<vtkCutter> circleCutter;\n  circleCutter->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkPlane> cutPlane;\n  cutPlane->SetOrigin(sphereSource->GetCenter());\n  cutPlane->SetNormal(0, 0, 1);\n  circleCutter->SetCutFunction(cutPlane);\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(circleCutter->GetOutputPort()); // valid circle\n  stripper->Update();\n\n  // that's our circle\n  auto circle = stripper->GetOutput();\n\n  // write circle out\n  vtkNew<vtkXMLPolyDataWriter> polyDataWriter;\n  polyDataWriter->SetInputData(circle);\n  polyDataWriter->SetFileName(\"circle.vtp\");\n  polyDataWriter->SetCompressorTypeToNone();\n  polyDataWriter->SetDataModeToAscii();\n  polyDataWriter->Write();\n\n  // prepare the binary image's voxel grid\n  vtkNew<vtkImageData> whiteImage;\n  double bounds[6];\n  circle->GetBounds(bounds);\n  double spacing[3]; // desired volume spacing\n  spacing[0] = 0.5;\n  spacing[1] = 0.5;\n  spacing[2] = 0.5;\n  whiteImage->SetSpacing(spacing);\n\n  // compute dimensions\n  int dim[3];\n  for (int i = 0; i < 3; i++)\n  {\n    dim[i] = static_cast<int>(\n                 ceil((bounds[i * 2 + 1] - bounds[i * 2]) / spacing[i])) +\n        1;\n    if (dim[i] < 1)\n      dim[i] = 1;\n  }\n  whiteImage->SetDimensions(dim);\n  whiteImage->SetExtent(0, dim[0] - 1, 0, dim[1] - 1, 0, dim[2] - 1);\n  double origin[3];\n\n  // NOTE: I am not sure whether or not we had to add some offset!\n  origin[0] = bounds[0]; // + spacing[0] / 2;\n  origin[1] = bounds[2]; // + spacing[1] / 2;\n  origin[2] = bounds[4]; // + spacing[2] / 2;\n  whiteImage->SetOrigin(origin);\n  whiteImage->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  // fill the image with foreground voxels:\n  unsigned char inval = 255;\n  unsigned char outval = 0;\n  vtkIdType count = whiteImage->GetNumberOfPoints();\n  for (vtkIdType i = 0; i < count; ++i)\n  {\n    whiteImage->GetPointData()->GetScalars()->SetTuple1(i, inval);\n  }\n\n  // sweep polygonal data (this is the important thing with contours!)\n  vtkNew<vtkLinearExtrusionFilter> extruder;\n  extruder->SetInputData(circle);\n  extruder->SetScaleFactor(1.);\n  extruder->SetExtrusionTypeToVectorExtrusion();\n  extruder->SetVector(0, 0, 1);\n  extruder->Update();\n\n  // polygonal data --> image stencil:\n  vtkNew<vtkPolyDataToImageStencil> pol2stenc;\n  pol2stenc->SetTolerance(0); // important if extruder->SetVector(0, 0, 1) !!!\n  pol2stenc->SetInputConnection(extruder->GetOutputPort());\n  pol2stenc->SetOutputOrigin(origin);\n  pol2stenc->SetOutputSpacing(spacing);\n  pol2stenc->SetOutputWholeExtent(whiteImage->GetExtent());\n  pol2stenc->Update();\n\n  // cut the corresponding white image and set the background:\n  vtkNew<vtkImageStencil> imgstenc;\n  imgstenc->SetInputData(whiteImage);\n  imgstenc->SetStencilConnection(pol2stenc->GetOutputPort());\n  imgstenc->ReverseStencilOff();\n  imgstenc->SetBackgroundValue(outval);\n  imgstenc->Update();\n  imgstenc->GetOutput()->Print(std::cout);\n\n  vtkNew<vtkMetaImageWriter> imageWriter;\n  imageWriter->SetFileName(\"labelImage.mhd\");\n  imageWriter->SetInputConnection(imgstenc->GetOutputPort());\n  imageWriter->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolyDataContourToImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataContourToImageData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOImage\n  IOXML\n  ImagingStencil\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataContourToImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataContourToImageData MACOSX_BUNDLE PolyDataContourToImageData.cxx )\n  target_link_libraries(PolyDataContourToImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataContourToImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataContourToImageData/#download-and-build-polydatacontourtoimagedata","title":"Download and Build PolyDataContourToImageData","text":"

Click here to download PolyDataContourToImageData and its CMakeLists.txt file. Once the tarball PolyDataContourToImageData.tar has been downloaded and extracted,

cd PolyDataContourToImageData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataContourToImageData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataExtractNormals/","title":"PolyDataExtractNormals","text":"

vtk-examples/Cxx/PolyData/PolyDataExtractNormals

"},{"location":"Cxx/PolyData/PolyDataExtractNormals/#description","title":"Description","text":"

This demo looks for multiple types of normals in a polydata and generates them if they do not exist.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataExtractNormals/#code","title":"Code","text":"

PolyDataExtractNormals.cxx

#include <vtkCellData.h>\n#include <vtkDoubleArray.h>\n#include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nvoid TestPointNormals(vtkPolyData* polydata);\nvoid TestCellNormals(vtkPolyData* polydata);\n\nbool GetPointNormals(vtkPolyData* polydata);\nbool GetCellNormals(vtkPolyData* polydata);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkPolyData> polydata;\n\n  // If a file is provided, read it. Else, create a sphere.\n  if (argc == 2)\n  {\n\n    // Read File\n    std::string filename = argv[1]; // first command line argument\n    std::cout << \"Reading file \" << filename << \"...\" << std::endl;\n\n    vtkNew<vtkXMLPolyDataReader> reader;\n    std::cout << \"Reading \" << filename << std::endl;\n    reader->SetFileName(filename.c_str());\n    reader->Update();\n    polydata->DeepCopy(reader->GetOutput());\n  }\n  else\n  {\n    std::cout << \"Creating a sphere...\" << std::endl;\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n    std::cout << \"In main: \" << sphereSource->GetOutput()->GetNumberOfPoints()\n              << std::endl;\n    polydata->DeepCopy(sphereSource->GetOutput());\n  }\n\n  std::cout << \"PolyData address: \" << polydata << std::endl;\n\n  TestPointNormals(polydata);\n\n  TestCellNormals(polydata);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid TestPointNormals(vtkPolyData* polydata)\n{\n  std::cout << \"In TestPointNormals: \" << polydata->GetNumberOfPoints()\n            << std::endl;\n  // Try to read normals directly\n  bool hasPointNormals = GetPointNormals(polydata);\n\n  if (!hasPointNormals)\n  {\n    std::cout << \"No point normals were found. Computing normals...\"\n              << std::endl;\n\n    // Generate normals\n    vtkNew<vtkPolyDataNormals> normalGenerator;\n    normalGenerator->SetInputData(polydata);\n    normalGenerator->ComputePointNormalsOn();\n    normalGenerator->ComputeCellNormalsOff();\n    normalGenerator->Update();\n    /*\n    // Optional settings\n    normalGenerator->SetFeatureAngle(0.1);\n    normalGenerator->SetSplitting(1);\n    normalGenerator->SetConsistency(0);\n    normalGenerator->SetAutoOrientNormals(0);\n    normalGenerator->SetComputePointNormals(1);\n    normalGenerator->SetComputeCellNormals(0);\n    normalGenerator->SetFlipNormals(0);\n    normalGenerator->SetNonManifoldTraversal(1);\n    */\n\n    polydata = normalGenerator->GetOutput();\n\n    // Try to read normals again\n    hasPointNormals = GetPointNormals(polydata);\n\n    std::cout << \"On the second try, has point normals? \" << hasPointNormals\n              << std::endl;\n  }\n  else\n  {\n    std::cout << \"Point normals were found!\" << std::endl;\n  }\n}\n\nvoid TestCellNormals(vtkPolyData* polydata)\n{\n  // Try to read normals directly\n  bool hasCellNormals = GetCellNormals(polydata);\n\n  if (!hasCellNormals)\n  {\n    std::cout << \"No cell normals were found. Computing normals...\"\n              << std::endl;\n\n    // Generate normals\n    vtkNew<vtkPolyDataNormals> normalGenerator;\n    normalGenerator->SetInputData(polydata);\n    normalGenerator->ComputePointNormalsOff();\n    normalGenerator->ComputeCellNormalsOn();\n    normalGenerator->Update();\n    /*\n    // Optional settings\n    normalGenerator->SetFeatureAngle(0.1);\n    normalGenerator->SetSplitting(1);\n    normalGenerator->SetConsistency(0);\n    normalGenerator->SetAutoOrientNormals(0);\n    normalGenerator->SetComputePointNormals(1);\n    normalGenerator->SetComputeCellNormals(0);\n    normalGenerator->SetFlipNormals(0);\n    normalGenerator->SetNonManifoldTraversal(1);\n    */\n\n    polydata = normalGenerator->GetOutput();\n\n    // Try to read normals again\n    hasCellNormals = GetCellNormals(polydata);\n\n    std::cout << \"On the second try, has cell normals? \" << hasCellNormals\n              << std::endl;\n  }\n  else\n  {\n    std::cout << \"Cell normals were found!\" << std::endl;\n  }\n}\n\nbool GetPointNormals(vtkPolyData* polydata)\n{\n  std::cout << \"In GetPointNormals: \" << polydata->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Looking for point normals...\" << std::endl;\n\n  // Count points\n  vtkIdType numPoints = polydata->GetNumberOfPoints();\n  std::cout << \"There are \" << numPoints << \" points.\" << std::endl;\n\n  // Count triangles\n  vtkIdType numPolys = polydata->GetNumberOfPolys();\n  std::cout << \"There are \" << numPolys << \" polys.\" << std::endl;\n\n  ////////////////////////////////////////////////////////////////\n  // Double normals in an array\n  vtkDoubleArray* normalDataDouble = dynamic_cast<vtkDoubleArray*>(\n      polydata->GetPointData()->GetArray(\"Normals\"));\n\n  if (normalDataDouble)\n  {\n    int nc = normalDataDouble->GetNumberOfTuples();\n    std::cout << \"There are \" << nc << \" components in normalDataDouble\"\n              << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Double normals in an array\n  vtkFloatArray* normalDataFloat = dynamic_cast<vtkFloatArray*>(\n      polydata->GetPointData()->GetArray(\"Normals\"));\n\n  if (normalDataFloat)\n  {\n    int nc = normalDataFloat->GetNumberOfTuples();\n    std::cout << \"There are \" << nc << \" components in normalDataFloat\"\n              << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Point normals\n  vtkDoubleArray* normalsDouble =\n      dynamic_cast<vtkDoubleArray*>(polydata->GetPointData()->GetNormals());\n\n  if (normalsDouble)\n  {\n    std::cout << \"There are \" << normalsDouble->GetNumberOfComponents()\n              << \" components in normalsDouble\" << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Point normals\n  vtkFloatArray* normalsFloat =\n      dynamic_cast<vtkFloatArray*>(polydata->GetPointData()->GetNormals());\n\n  if (normalsFloat)\n  {\n    std::cout << \"There are \" << normalsFloat->GetNumberOfComponents()\n              << \" components in normalsFloat\" << std::endl;\n    return true;\n  }\n\n  /////////////////////////////////////////////////////////////////////\n  // Generic type point normals\n  vtkDataArray* normalsGeneric =\n      polydata->GetPointData()->GetNormals(); // works\n  if (normalsGeneric)\n  {\n    std::cout << \"There are \" << normalsGeneric->GetNumberOfTuples()\n              << \" normals in normalsGeneric\" << std::endl;\n\n    double testDouble[3];\n    normalsGeneric->GetTuple(0, testDouble);\n\n    std::cout << \"Double: \" << testDouble[0] << \" \" << testDouble[1] << \" \"\n              << testDouble[2] << std::endl;\n\n    // Can't do this:\n    /*\n    float testFloat[3];\n    normalsGeneric->GetTuple(0, testFloat);\n\n    std::cout << \"Float: \" << testFloat[0] << \" \"\n              << testFloat[1] << \" \" << testFloat[2] << std::endl;\n    */\n    return true;\n  }\n\n  // If the function has not yet quit, there were none of these types of normals\n  std::cout << \"Normals not found!\" << std::endl;\n  return false;\n}\n\nbool GetCellNormals(vtkPolyData* polydata)\n{\n  std::cout << \"Looking for cell normals...\" << std::endl;\n\n  // Count points\n  vtkIdType numCells = polydata->GetNumberOfCells();\n  std::cout << \"There are \" << numCells << \" cells.\" << std::endl;\n\n  // Count triangles\n  vtkIdType numPolys = polydata->GetNumberOfPolys();\n  std::cout << \"There are \" << numPolys << \" polys.\" << std::endl;\n\n  ////////////////////////////////////////////////////////////////\n  // Double normals in an array\n  vtkDoubleArray* normalDataDouble = dynamic_cast<vtkDoubleArray*>(\n      polydata->GetCellData()->GetArray(\"Normals\"));\n\n  if (normalDataDouble)\n  {\n    int nc = normalDataDouble->GetNumberOfTuples();\n    std::cout << \"There are \" << nc << \" components in normalDataDouble\"\n              << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Double normals in an array\n  vtkFloatArray* normalDataFloat = dynamic_cast<vtkFloatArray*>(\n      polydata->GetCellData()->GetArray(\"Normals\"));\n\n  if (normalDataFloat)\n  {\n    int nc = normalDataFloat->GetNumberOfTuples();\n    std::cout << \"There are \" << nc << \" components in normalDataFloat\"\n              << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Point normals\n  vtkDoubleArray* normalsDouble =\n      dynamic_cast<vtkDoubleArray*>(polydata->GetCellData()->GetNormals());\n\n  if (normalsDouble)\n  {\n    std::cout << \"There are \" << normalsDouble->GetNumberOfComponents()\n              << \" components in normalsDouble\" << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Point normals\n  vtkFloatArray* normalsFloat =\n      dynamic_cast<vtkFloatArray*>(polydata->GetCellData()->GetNormals());\n\n  if (normalsFloat)\n  {\n    std::cout << \"There are \" << normalsFloat->GetNumberOfComponents()\n              << \" components in normalsFloat\" << std::endl;\n    return true;\n  }\n\n  /////////////////////////////////////////////////////////////////////\n  // Generic type point normals\n  vtkDataArray* normalsGeneric = polydata->GetCellData()->GetNormals(); // works\n  if (normalsGeneric)\n  {\n    std::cout << \"There are \" << normalsGeneric->GetNumberOfTuples()\n              << \" normals in normalsGeneric\" << std::endl;\n\n    double testDouble[3];\n    normalsGeneric->GetTuple(0, testDouble);\n\n    std::cout << \"Double: \" << testDouble[0] << \" \" << testDouble[1] << \" \"\n              << testDouble[2] << std::endl;\n\n    // Can't do this:\n    /*\n    float testFloat[3];\n    normalsGeneric->GetTuple(0, testFloat);\n\n    std::cout << \"Float: \" << testFloat[0] << \" \"\n              << testFloat[1] << \" \" << testFloat[2] << std::endl;\n    */\n    return true;\n  }\n\n  // If the function has not yet quit, there were none of these types of normals\n  std::cout << \"Normals not found!\" << std::endl;\n  return false;\n}\n\n} // namespace\n
"},{"location":"Cxx/PolyData/PolyDataExtractNormals/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataExtractNormals)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataExtractNormals: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataExtractNormals MACOSX_BUNDLE PolyDataExtractNormals.cxx )\n  target_link_libraries(PolyDataExtractNormals PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataExtractNormals\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataExtractNormals/#download-and-build-polydataextractnormals","title":"Download and Build PolyDataExtractNormals","text":"

Click here to download PolyDataExtractNormals and its CMakeLists.txt file. Once the tarball PolyDataExtractNormals.tar has been downloaded and extracted,

cd PolyDataExtractNormals/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataExtractNormals\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataGetPoint/","title":"PolyDataGetPoint","text":"

vtk-examples/Cxx/PolyData/PolyDataGetPoint

"},{"location":"Cxx/PolyData/PolyDataGetPoint/#description","title":"Description","text":"

This example demonstrates how to obtain the coordinates of a point in a vtkPolyData object.

  • Suggested by Sara Rolfe

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataGetPoint/#code","title":"Code","text":"

PolyDataGetPoint.cxx

#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkPolyData* polydata = sphereSource->GetOutput();\n\n  // Write all of the coordinates of the points in the vtkPolyData to the\n  // console.\n  for (vtkIdType i = 0; i < polydata->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    polydata->GetPoint(i, p);\n    // This is identical to:\n    // polydata->GetPoints()->GetPoint(i,p);\n    std::cout << \"Point \" << i << \" : (\" << p[0] << \" \" << p[1] << \" \" << p[2]\n              << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolyDataGetPoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataGetPoint)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataGetPoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataGetPoint MACOSX_BUNDLE PolyDataGetPoint.cxx )\n  target_link_libraries(PolyDataGetPoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataGetPoint\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataGetPoint/#download-and-build-polydatagetpoint","title":"Download and Build PolyDataGetPoint","text":"

Click here to download PolyDataGetPoint and its CMakeLists.txt file. Once the tarball PolyDataGetPoint.tar has been downloaded and extracted,

cd PolyDataGetPoint/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataGetPoint\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataIsoLines/","title":"PolyDataIsoLines","text":"

vtk-examples/Cxx/PolyData/PolyDataIsoLines

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataIsoLines/#code","title":"Code","text":"

PolyDataIsoLines.cxx

#include <vtkActor.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtkXMLPolyDataWriter.h>\n\n// #include <algorithm>\n// #include <iostream>\n// #include <string>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required arguments: Filename e.g. cowHead.vtp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // float range[2];\n  double range[2];\n  reader->GetOutput()->GetPointData()->GetScalars()->GetRange(range);\n  // std::cout << \"Range: \" << range[0] << \" , \" << range[1] << std::endl;\n\n  vtkNew<vtkBandedPolyDataContourFilter> bf;\n  bf->SetInputConnection(reader->GetOutputPort());\n  int numContours = 30;\n  bf->GenerateValues(numContours, range);\n  bf->GenerateContourEdgesOn();\n  bf->Update();\n\n  // Color the contours.\n  bf->GetOutput(1)->GetPointData()->SetScalars(\n      bf->GetOutput()->GetPointData()->GetScalars());\n\n  // Make sure the mapper uses the new colors.\n  bf->GetOutput(0)->GetPointData()->SetActiveScalars(\"Scalars\");\n\n  {\n    vtkNew<vtkXMLPolyDataWriter> writer;\n    writer->SetInputConnection(bf->GetOutputPort());\n    writer->SetFileName(\"output.vtp\");\n    writer->Update();\n  }\n\n  {\n    vtkNew<vtkXMLPolyDataWriter> writer;\n    writer->SetInputConnection(bf->GetOutputPort(1));\n    writer->SetFileName(\"ContourEdges.vtp\");\n    writer->Update();\n  }\n\n  /*\n  // See which isocontours are being generated\n  auto values = bf->GetValues();\n  auto numOfContours = bf->GetNumberOfContours();\n  vtkIdType someContours = std::min(numContours, 10);\n  for (vtkIdType i = 0; i < someContours; i++)\n  {\n    cout << values[i] << \" \";\n  }\n  cout << endl;\n  */\n\n  // Color actor.\n  vtkNew<vtkPolyDataMapper> colorMapper;\n  colorMapper->SetInputConnection(bf->GetOutputPort(0));\n  colorMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> colorActor;\n  colorActor->SetMapper(colorMapper);\n\n  // Edge actor.\n  vtkNew<vtkPolyDataMapper> edgeMapper;\n  edgeMapper->SetInputConnection(bf->GetOutputPort(1));\n  edgeMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(edgeMapper);\n  edgeActor->GetProperty()->SetLineWidth(5);\n\n  // Create the RenderWindow, Renderer and both Actors.\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolyDataIsoLines\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer.\n  renderer->AddActor(colorActor);\n  renderer->AddActor(edgeActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolyDataIsoLines/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataIsoLines)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataIsoLines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataIsoLines MACOSX_BUNDLE PolyDataIsoLines.cxx )\n  target_link_libraries(PolyDataIsoLines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataIsoLines\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataIsoLines/#download-and-build-polydataisolines","title":"Download and Build PolyDataIsoLines","text":"

Click here to download PolyDataIsoLines and its CMakeLists.txt file. Once the tarball PolyDataIsoLines.tar has been downloaded and extracted,

cd PolyDataIsoLines/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataIsoLines\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataPointNormals/","title":"PolyDataPointNormals","text":"

vtk-examples/Cxx/PolyData/PolyDataPointNormals

"},{"location":"Cxx/PolyData/PolyDataPointNormals/#description","title":"Description","text":"

This demo adds a normal to each point in a polydata.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataPointNormals/#code","title":"Code","text":"

PolyDataPointNormals.cxx

#include <vtkCellArray.h>\n#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  ///////// Set Point Normals ///////////\n  // Create 3 points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Add the points to a polydata.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Set point normals.\n  vtkNew<vtkDoubleArray> pointNormalsArray;\n  pointNormalsArray->SetNumberOfComponents(3); // 3d normals (ie x,y,z)\n  pointNormalsArray->SetNumberOfTuples(polydata->GetNumberOfPoints());\n\n  // Construct the normal vectors.\n  double pN1[3] = {1.0, 0.0, 0.0};\n  double pN2[3] = {0.0, 1.0, 0.0};\n  double pN3[3] = {0.0, 0.0, 1.0};\n\n  // Add the data to the normals array.\n  pointNormalsArray->SetTuple(0, pN1);\n  pointNormalsArray->SetTuple(1, pN2);\n  pointNormalsArray->SetTuple(2, pN3);\n\n  // Add the normals to the points in the polydata.\n  polydata->GetPointData()->SetNormals(pointNormalsArray);\n\n  ///////// Get Point Normals ///////////\n  auto pointNormalsRetrieved =\n      dynamic_cast<vtkDoubleArray*>(polydata->GetPointData()->GetNormals());\n  if (pointNormalsRetrieved)\n  {\n    std::cout << \"There are \" << pointNormalsRetrieved->GetNumberOfTuples()\n              << \" point normals.\" << std::endl;\n\n    for (vtkIdType i = 0; i < pointNormalsRetrieved->GetNumberOfTuples(); i++)\n    {\n      double pN[3];\n      pointNormalsRetrieved->GetTuple(i, pN);\n      std::cout << \"Point normal \" << i << \": \" << pN[0] << \" \" << pN[1] << \" \"\n                << pN[2] << std::endl;\n    }\n\n  } // end if(pointNormalsRetrieved)\n  else\n  {\n    std::cout << \"No point normals.\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolyDataPointNormals/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataPointNormals)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataPointNormals: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataPointNormals MACOSX_BUNDLE PolyDataPointNormals.cxx )\n  target_link_libraries(PolyDataPointNormals PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataPointNormals\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataPointNormals/#download-and-build-polydatapointnormals","title":"Download and Build PolyDataPointNormals","text":"

Click here to download PolyDataPointNormals and its CMakeLists.txt file. Once the tarball PolyDataPointNormals.tar has been downloaded and extracted,

cd PolyDataPointNormals/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataPointNormals\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataPointSampler/","title":"PolyDataPointSampler","text":"

vtk-examples/Cxx/PolyData/PolyDataPointSampler

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/PolyDataPointSampler/#description","title":"Description","text":"

Original points are yellow and added points are red.

This example uses the src/Testing/Data/Torso.vtp dataset.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataPointSampler/#code","title":"Code","text":"

PolyDataPointSampler.cxx

#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataPointSampler.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  std::cout << \"# of original points: \" << polyData->GetNumberOfPoints()\n            << std::endl;\n  vtkNew<vtkPolyDataPointSampler> sample;\n  sample->SetInputData(polyData);\n  sample->SetDistance(range[0] / 50);\n  sample->Update();\n  std::cout << \"# of points after sampling: \"\n            << sample->GetOutput()->GetNumberOfPoints() << std::endl;\n\n  ///\n  double radius = range[0] * 0.01;\n  vtkNew<vtkSphereSource> originalSource;\n  originalSource->SetRadius(radius);\n\n  vtkNew<vtkGlyph3D> originalGlyph3D;\n  originalGlyph3D->SetInputData(polyData);\n  originalGlyph3D->SetSourceConnection(originalSource->GetOutputPort());\n  originalGlyph3D->ScalingOff();\n  originalGlyph3D->Update();\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(originalGlyph3D->GetOutputPort());\n  originalMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkSphereSource> sampleSource;\n  sampleSource->SetRadius(radius * 0.75);\n\n  vtkNew<vtkGlyph3D> sampleGlyph3D;\n  sampleGlyph3D->SetInputConnection(sample->GetOutputPort());\n  sampleGlyph3D->SetSourceConnection(sampleSource->GetOutputPort());\n  sampleGlyph3D->ScalingOff();\n  sampleGlyph3D->Update();\n\n  vtkNew<vtkPolyDataMapper> sampleMapper;\n  sampleMapper->SetInputConnection(sampleGlyph3D->GetOutputPort());\n  sampleMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> sampleActor;\n  sampleActor->SetMapper(sampleMapper);\n  sampleActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"PolyDataPointSampler\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(originalActor);\n  ren1->AddActor(sampleActor);\n\n  // Generate an interesting view.\n  ren1->GetActiveCamera()->SetPosition(1, 0, 0);\n  ren1->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  ren1->GetActiveCamera()->SetViewUp(0, 0, 1);\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphere;\n    sphere->SetRadius(1.0);\n    sphere->SetPhiResolution(21);\n    sphere->SetThetaResolution(41);\n    sphere->Update();\n    polyData = sphere->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/PolyData/PolyDataPointSampler/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataPointSampler)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataPointSampler: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataPointSampler MACOSX_BUNDLE PolyDataPointSampler.cxx )\n  target_link_libraries(PolyDataPointSampler PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataPointSampler\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataPointSampler/#download-and-build-polydatapointsampler","title":"Download and Build PolyDataPointSampler","text":"

Click here to download PolyDataPointSampler and its CMakeLists.txt file. Once the tarball PolyDataPointSampler.tar has been downloaded and extracted,

cd PolyDataPointSampler/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataPointSampler\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataToImageData/","title":"PolyDataToImageData","text":"

vtk-examples/Cxx/PolyData/PolyDataToImageData

"},{"location":"Cxx/PolyData/PolyDataToImageData/#description","title":"Description","text":"
  • Contributed by: Lars Friedrich

This example generates a sphere (prerequisite: closed surface of type vtkPolyData) and converts it into volume representation (vtkImageData) where the foreground voxels are 255 (inside) and the background voxels are 0 (outside). Internally [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ToImageStencil is utilized. The resultant image is saved to disk in metaimage file format (SphereVolume.mhd).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataToImageData/#code","title":"Code","text":"

PolyDataToImageData.cxx

#include <vtkImageData.h>\n#include <vtkImageStencil.h>\n#include <vtkMetaImageWriter.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataToImageStencil.h>\n#include <vtkSphereSource.h>\n\n/**\n * This program generates a sphere (closed surface, vtkPolyData) and converts it\n * into volume representation (vtkImageData) where the foreground voxels are 1\n * and the background voxels are 0. Internally vtkPolyDataToImageStencil is\n * utilized. The resultant image is saved to disk in metaimage file format\n * (SphereVolume.mhd).\n */\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(20);\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n  auto pd = sphereSource->GetOutput();\n  sphereSource->Update();\n\n  vtkNew<vtkImageData> whiteImage;\n  double bounds[6];\n  pd->GetBounds(bounds);\n  double spacing[3]; // desired volume spacing\n  spacing[0] = 0.5;\n  spacing[1] = 0.5;\n  spacing[2] = 0.5;\n  whiteImage->SetSpacing(spacing);\n\n  // compute dimensions\n  int dim[3];\n  for (int i = 0; i < 3; i++)\n  {\n    dim[i] = static_cast<int>(\n        ceil((bounds[i * 2 + 1] - bounds[i * 2]) / spacing[i]));\n  }\n  whiteImage->SetDimensions(dim);\n  whiteImage->SetExtent(0, dim[0] - 1, 0, dim[1] - 1, 0, dim[2] - 1);\n\n  double origin[3];\n  origin[0] = bounds[0] + spacing[0] / 2;\n  origin[1] = bounds[2] + spacing[1] / 2;\n  origin[2] = bounds[4] + spacing[2] / 2;\n  whiteImage->SetOrigin(origin);\n  whiteImage->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  // Fill the image with foreground voxels:\n  unsigned char inval = 255;\n  unsigned char outval = 0;\n  vtkIdType count = whiteImage->GetNumberOfPoints();\n  for (vtkIdType i = 0; i < count; ++i)\n  {\n    whiteImage->GetPointData()->GetScalars()->SetTuple1(i, inval);\n  }\n\n  // polygonal data --> image stencil:\n  vtkNew<vtkPolyDataToImageStencil> pol2stenc;\n  pol2stenc->SetInputData(pd);\n  pol2stenc->SetOutputOrigin(origin);\n  pol2stenc->SetOutputSpacing(spacing);\n  pol2stenc->SetOutputWholeExtent(whiteImage->GetExtent());\n  pol2stenc->Update();\n\n  // Cut the corresponding white image and set the background:\n  vtkNew<vtkImageStencil> imgstenc;\n  imgstenc->SetInputData(whiteImage);\n  imgstenc->SetStencilConnection(pol2stenc->GetOutputPort());\n  imgstenc->ReverseStencilOff();\n  imgstenc->SetBackgroundValue(outval);\n  imgstenc->Update();\n\n  vtkNew<vtkMetaImageWriter> writer;\n  writer->SetFileName(\"SphereVolume.mhd\");\n  writer->SetInputData(imgstenc->GetOutput());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolyDataToImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataToImageData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOImage\n  ImagingStencil\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataToImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataToImageData MACOSX_BUNDLE PolyDataToImageData.cxx )\n  target_link_libraries(PolyDataToImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataToImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataToImageData/#download-and-build-polydatatoimagedata","title":"Download and Build PolyDataToImageData","text":"

Click here to download PolyDataToImageData and its CMakeLists.txt file. Once the tarball PolyDataToImageData.tar has been downloaded and extracted,

cd PolyDataToImageData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataToImageData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolyDataToUnstructuredGrid/","title":"PolyDataToUnstructuredGrid","text":"

vtk-examples/Cxx/PolyData/PolyDataToUnstructuredGrid

"},{"location":"Cxx/PolyData/PolyDataToUnstructuredGrid/#description","title":"Description","text":"

There is not a filter whose sole purpose is converting a vtkPolyData to a vtkUnstructuredGrid. However, the append filter can accept any type of input, and produces a vtkUnstructuredGrid, so we can use it for this purpose.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolyDataToUnstructuredGrid/#code","title":"Code","text":"

PolyDataToUnstructuredGrid.cxx

#include <vtkAppendFilter.h>\n#include <vtkNew.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Combine the two data sets.\n  vtkNew<vtkAppendFilter> appendFilter;\n  appendFilter->AddInputData(sphereSource->GetOutput());\n  appendFilter->Update();\n\n  vtkNew<vtkUnstructuredGrid> unstructuredGrid;\n  unstructuredGrid->ShallowCopy(appendFilter->GetOutput());\n\n  // Write the unstructured grid.\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetFileName(\"UnstructuredGrid.vtu\");\n  writer->SetInputData(unstructuredGrid);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolyDataToUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataToUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataToUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataToUnstructuredGrid MACOSX_BUNDLE PolyDataToUnstructuredGrid.cxx )\n  target_link_libraries(PolyDataToUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataToUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolyDataToUnstructuredGrid/#download-and-build-polydatatounstructuredgrid","title":"Download and Build PolyDataToUnstructuredGrid","text":"

Click here to download PolyDataToUnstructuredGrid and its CMakeLists.txt file. Once the tarball PolyDataToUnstructuredGrid.tar has been downloaded and extracted,

cd PolyDataToUnstructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataToUnstructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolygonalSurfaceContourLineInterpolator/","title":"PolygonalSurfaceContourLineInterpolator","text":"

vtk-examples/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolygonalSurfaceContourLineInterpolator/#code","title":"Code","text":"

PolygonalSurfaceContourLineInterpolator.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientedGlyphContourRepresentation.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataCollection.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolygonalSurfaceContourLineInterpolator.h>\n#include <vtkPolygonalSurfacePointPlacer.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkPolyData> polyData;\n  if (argc < 2)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(40);\n    sphereSource->SetPhiResolution(20);\n    sphereSource->Update();\n\n    polyData = sphereSource->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n\n  // The Dijkistra interpolator will not accept cells that aren't triangles.\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputData(polyData);\n  triangleFilter->Update();\n\n  auto pd = triangleFilter->GetOutput();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(triangleFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the render window, renderer and interactor.\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolygonalSurfaceContourLineInterpolator\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size.\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  // Here comes the contour widget stuff...\n\n  vtkNew<vtkContourWidget> contourWidget;\n  contourWidget->SetInteractor(interactor);\n  vtkSmartPointer<vtkOrientedGlyphContourRepresentation> rep =\n      dynamic_cast<vtkOrientedGlyphContourRepresentation*>(\n          contourWidget->GetRepresentation());\n  rep->GetLinesProperty()->SetColor(colors->GetColor3d(\"Crimson\").GetData());\n  rep->GetLinesProperty()->SetLineWidth(3.0);\n\n  vtkNew<vtkPolygonalSurfacePointPlacer> pointPlacer;\n  pointPlacer->AddProp(actor);\n  pointPlacer->GetPolys()->AddItem(pd);\n  rep->SetPointPlacer(pointPlacer);\n\n  vtkNew<vtkPolygonalSurfaceContourLineInterpolator> interpolator;\n  interpolator->GetPolys()->AddItem(pd);\n  rep->SetLineInterpolator(interpolator);\n\n  renderWindow->Render();\n  interactor->Initialize();\n\n  contourWidget->EnabledOn();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolygonalSurfaceContourLineInterpolator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolygonalSurfaceContourLineInterpolator)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolygonalSurfaceContourLineInterpolator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolygonalSurfaceContourLineInterpolator MACOSX_BUNDLE PolygonalSurfaceContourLineInterpolator.cxx )\n  target_link_libraries(PolygonalSurfaceContourLineInterpolator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolygonalSurfaceContourLineInterpolator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolygonalSurfaceContourLineInterpolator/#download-and-build-polygonalsurfacecontourlineinterpolator","title":"Download and Build PolygonalSurfaceContourLineInterpolator","text":"

Click here to download PolygonalSurfaceContourLineInterpolator and its CMakeLists.txt file. Once the tarball PolygonalSurfaceContourLineInterpolator.tar has been downloaded and extracted,

cd PolygonalSurfaceContourLineInterpolator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolygonalSurfaceContourLineInterpolator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/PolygonalSurfacePointPlacer/","title":"PolygonalSurfacePointPlacer","text":"

vtk-examples/Cxx/PolyData/PolygonalSurfacePointPlacer

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/PolygonalSurfacePointPlacer/#description","title":"Description","text":"

This example demonstrates how to draw curves on a surface.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/PolygonalSurfacePointPlacer/#code","title":"Code","text":"

PolygonalSurfacePointPlacer.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkContourWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientedGlyphContourRepresentation.h>\n#include <vtkPolyDataCollection.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolygonalSurfacePointPlacer.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nclass MyCallback : public vtkCallbackCommand\n{\npublic:\n  static MyCallback* New()\n  {\n    return new MyCallback;\n  }\n  MyCallback()\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkContourWidget* contourWidget =\n        reinterpret_cast<vtkContourWidget*>(caller);\n    vtkContourRepresentation* rep = static_cast<vtkContourRepresentation*>(\n        contourWidget->GetRepresentation());\n    std::cout << \"There are \" << rep->GetNumberOfNodes() << \" nodes.\"\n              << std::endl;\n  }\n\n  void SetSphereSource(vtkSmartPointer<vtkSphereSource> sphere)\n  {\n    this->SphereSource = sphere;\n  }\n\nprivate:\n  vtkSmartPointer<vtkSphereSource> SphereSource;\n};\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(5);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the RenderWindow, Renderer.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolygonalSurfacePointPlacer\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  vtkNew<vtkContourWidget> contourWidget;\n  contourWidget->SetInteractor(interactor);\n\n  vtkNew<MyCallback> callback;\n  callback->SetSphereSource(sphereSource);\n  contourWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  vtkOrientedGlyphContourRepresentation* rep =\n      dynamic_cast<vtkOrientedGlyphContourRepresentation*>(\n          contourWidget->GetRepresentation());\n\n  vtkNew<vtkPolygonalSurfacePointPlacer> pointPlacer;\n  pointPlacer->AddProp(actor);\n  pointPlacer->GetPolys()->AddItem(sphereSource->GetOutput());\n\n  rep->GetLinesProperty()->SetColor(colors->GetColor3d(\"Crimson\").GetData());\n  rep->GetLinesProperty()->SetLineWidth(3.0);\n  rep->SetPointPlacer(pointPlacer);\n\n  contourWidget->EnabledOn();\n  renderer->ResetCamera();\n  renderWindow->Render();\n  interactor->Initialize();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/PolygonalSurfacePointPlacer/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolygonalSurfacePointPlacer)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolygonalSurfacePointPlacer: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolygonalSurfacePointPlacer MACOSX_BUNDLE PolygonalSurfacePointPlacer.cxx )\n  target_link_libraries(PolygonalSurfacePointPlacer PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolygonalSurfacePointPlacer\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/PolygonalSurfacePointPlacer/#download-and-build-polygonalsurfacepointplacer","title":"Download and Build PolygonalSurfacePointPlacer","text":"

Click here to download PolygonalSurfacePointPlacer and its CMakeLists.txt file. Once the tarball PolygonalSurfacePointPlacer.tar has been downloaded and extracted,

cd PolygonalSurfacePointPlacer/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolygonalSurfacePointPlacer\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ProcrustesAlignmentFilter/","title":"ProcrustesAlignmentFilter","text":"

vtk-examples/Cxx/PolyData/ProcrustesAlignmentFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ProcrustesAlignmentFilter/#description","title":"Description","text":"

This example aligns three objects (deformed spheres) using the Procrustes algorithm. The original shapes are shown on the left. The alignment using a rigid transform is shown in the middle, and the alignment using a similarity transform is shown on the right.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ProcrustesAlignmentFilter/#code","title":"Code","text":"

ProcrustesAlignmentFilter.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLandmarkTransform.h>\n#include <vtkMultiBlockDataGroupFilter.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSet.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProcrustesAlignmentFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n\n  // make two copies of the shape and distort them a little\n  vtkNew<vtkTransform> transform1;\n  transform1->Translate(0.2, 0.1, 0.3);\n  transform1->Scale(1.3, 1.1, 0.8);\n\n  vtkNew<vtkTransform> transform2;\n  transform2->Translate(0.3, 0.7, 0.1);\n  transform2->Scale(1.0, 0.1, 1.8);\n\n  vtkNew<vtkTransformPolyDataFilter> transformer1;\n  transformer1->SetInputConnection(sphereSource->GetOutputPort());\n  transformer1->SetTransform(transform1);\n\n  vtkNew<vtkTransformPolyDataFilter> transformer2;\n  transformer2->SetInputConnection(sphereSource->GetOutputPort());\n  transformer2->SetTransform(transform2);\n\n  // map these three shapes into the first renderer\n  vtkNew<vtkPolyDataMapper> map1a;\n  map1a->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> Actor1a;\n  Actor1a->SetMapper(map1a);\n  Actor1a->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkPolyDataMapper> map1b;\n  map1b->SetInputConnection(transformer1->GetOutputPort());\n\n  vtkNew<vtkActor> Actor1b;\n  Actor1b->SetMapper(map1b);\n  Actor1b->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkPolyDataMapper> map1c;\n  map1c->SetInputConnection(transformer2->GetOutputPort());\n  vtkNew<vtkActor> Actor1c;\n  Actor1c->SetMapper(map1c);\n  Actor1c->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n\n  // align the shapes using Procrustes (using SetModeToRigidBody)\n  vtkNew<vtkProcrustesAlignmentFilter> procrustes1;\n  vtkNew<vtkMultiBlockDataGroupFilter> group;\n  group->AddInputConnection(sphereSource->GetOutputPort());\n  group->AddInputConnection(transformer1->GetOutputPort());\n  group->AddInputConnection(transformer2->GetOutputPort());\n  procrustes1->SetInputConnection(group->GetOutputPort());\n  procrustes1->GetLandmarkTransform()->SetModeToRigidBody();\n\n  // map the aligned shapes into the second renderer\n  vtkNew<vtkDataSetMapper> map2a;\n\n  procrustes1->Update();\n  map2a->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes1->GetOutput()->GetBlock(0)));\n\n  vtkNew<vtkActor> Actor2a;\n  Actor2a->SetMapper(map2a);\n  Actor2a->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkDataSetMapper> map2b;\n  procrustes1->Update();\n  map2b->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes1->GetOutput()->GetBlock(1)));\n\n  vtkNew<vtkActor> Actor2b;\n  Actor2b->SetMapper(map2b);\n  Actor2b->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkDataSetMapper> map2c;\n  procrustes1->Update();\n  map2c->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes1->GetOutput()->GetBlock(2)));\n\n  vtkNew<vtkActor> Actor2c;\n  Actor2c->SetMapper(map2c);\n  Actor2c->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n\n  // align the shapes using Procrustes (using SetModeToSimilarity (default))\n  vtkNew<vtkProcrustesAlignmentFilter> procrustes2;\n  procrustes2->SetInputConnection(group->GetOutputPort());\n\n  // map the aligned shapes into the third renderer\n  vtkNew<vtkDataSetMapper> map3a;\n  procrustes2->Update();\n  map3a->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes2->GetOutput()->GetBlock(0)));\n\n  vtkNew<vtkActor> Actor3a;\n  Actor3a->SetMapper(map3a);\n  Actor3a->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkDataSetMapper> map3b;\n  procrustes2->Update();\n  map3b->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes2->GetOutput()->GetBlock(1)));\n\n  vtkNew<vtkActor> Actor3b;\n  Actor3b->SetMapper(map3b);\n  Actor3b->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkDataSetMapper> map3c;\n  procrustes2->Update();\n  map3c->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes2->GetOutput()->GetBlock(2)));\n\n  vtkNew<vtkActor> Actor3c;\n  Actor3c->SetMapper(map3c);\n  Actor3c->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create the RenderWindow and its three Renderers\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderer> ren2;\n  vtkNew<vtkRenderer> ren3;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->AddRenderer(ren2);\n  renWin->AddRenderer(ren3);\n  renWin->SetSize(600, 300);\n  renWin->SetWindowName(\"ProcrustesAlignmentFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer\n  ren1->AddActor(Actor1a);\n  ren1->AddActor(Actor1b);\n  ren1->AddActor(Actor1c);\n\n  ren2->AddActor(Actor2a);\n  ren2->AddActor(Actor2b);\n  ren2->AddActor(Actor2c);\n\n  ren3->AddActor(Actor3a);\n  ren3->AddActor(Actor3b);\n  ren3->AddActor(Actor3c);\n\n  // set the properties of the renderers\n\n  ren1->SetBackground(colors->GetColor3d(\"Bisque\").GetData());\n  ren1->SetViewport(0.0, 0.0, 0.33, 1.0);\n  ren1->GetActiveCamera()->SetPosition(1, -1, 0);\n  ren1->ResetCamera();\n\n  ren2->SetBackground(colors->GetColor3d(\"Cornsilk\").GetData());\n  ren2->SetViewport(0.33, 0.0, 0.66, 1.0);\n  ren2->ResetCamera();\n  ren2->GetActiveCamera()->SetPosition(1, -1, 0);\n  ren2->ResetCamera();\n\n  ren3->SetBackground(colors->GetColor3d(\"Eggshell\").GetData());\n  ren3->SetViewport(0.66, 0.0, 1.0, 1.0);\n  ren3->ResetCamera();\n  ren3->GetActiveCamera()->SetPosition(1, -1, 0);\n  ren3->ResetCamera();\n\n  renWin->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ProcrustesAlignmentFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProcrustesAlignmentFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersHybrid\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProcrustesAlignmentFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProcrustesAlignmentFilter MACOSX_BUNDLE ProcrustesAlignmentFilter.cxx )\n  target_link_libraries(ProcrustesAlignmentFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProcrustesAlignmentFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ProcrustesAlignmentFilter/#download-and-build-procrustesalignmentfilter","title":"Download and Build ProcrustesAlignmentFilter","text":"

Click here to download ProcrustesAlignmentFilter and its CMakeLists.txt file. Once the tarball ProcrustesAlignmentFilter.tar has been downloaded and extracted,

cd ProcrustesAlignmentFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ProcrustesAlignmentFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/QuantizePolyDataPoints/","title":"QuantizePolyDataPoints","text":"

vtk-examples/Cxx/PolyData/QuantizePolyDataPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/QuantizePolyDataPoints/#description","title":"Description","text":"

This example demonstrates how to \"snap\" points onto a discrete grid. This example rounds the coordinates of each point the the nearest 0.1

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/QuantizePolyDataPoints/#code","title":"Code","text":"

QuantizePolyDataPoints.cxx

#include <vtkCamera.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkQuantizePolyDataPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(100);\n  pointSource->Update();\n\n  std::cout << \"There are \" << pointSource->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  vtkNew<vtkQuantizePolyDataPoints> quantizeFilter;\n  quantizeFilter->SetInputConnection(pointSource->GetOutputPort());\n  quantizeFilter->SetQFactor(.1);\n  quantizeFilter->Update();\n\n  vtkPolyData* quantized = quantizeFilter->GetOutput();\n  std::cout << \"There are \" << quantized->GetNumberOfPoints()\n            << \" quantized points.\" << std::endl;\n\n  for (vtkIdType i = 0; i < pointSource->GetOutput()->GetNumberOfPoints(); i++)\n  {\n    double pOrig[3];\n    double pQuantized[3];\n    pointSource->GetOutput()->GetPoint(i, pOrig);\n    quantized->GetPoints()->GetPoint(i, pQuantized);\n\n    std::cout << \"Point \" << i << \" : (\" << pOrig[0] << \", \" << pOrig[1] << \", \"\n              << pOrig[2] << \")\"\n              << \" (\" << pQuantized[0] << \", \" << pQuantized[1] << \", \"\n              << pQuantized[2] << \")\" << std::endl;\n  }\n\n  double radius = 0.02;\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(radius);\n\n  vtkNew<vtkGlyph3DMapper> inputMapper;\n  inputMapper->SetInputConnection(pointSource->GetOutputPort());\n  inputMapper->SetSourceConnection(sphereSource->GetOutputPort());\n  inputMapper->ScalarVisibilityOff();\n  inputMapper->ScalingOff();\n\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(colors->GetColor3d(\"Orchid\").GetData());\n\n  vtkNew<vtkGlyph3DMapper> quantizedMapper;\n  quantizedMapper->SetInputConnection(quantizeFilter->GetOutputPort());\n  quantizedMapper->SetSourceConnection(sphereSource->GetOutputPort());\n  quantizedMapper->ScalarVisibilityOff();\n  quantizedMapper->ScalingOff();\n\n  vtkNew<vtkActor> quantizedActor;\n  quantizedActor->SetMapper(quantizedMapper);\n  quantizedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Orchid\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 360);\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"QuantizePolyDataPoints\");\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Bisque\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"PaleTurquoise\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(quantizedActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/QuantizePolyDataPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuantizePolyDataPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuantizePolyDataPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuantizePolyDataPoints MACOSX_BUNDLE QuantizePolyDataPoints.cxx )\n  target_link_libraries(QuantizePolyDataPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuantizePolyDataPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/QuantizePolyDataPoints/#download-and-build-quantizepolydatapoints","title":"Download and Build QuantizePolyDataPoints","text":"

Click here to download QuantizePolyDataPoints and its CMakeLists.txt file. Once the tarball QuantizePolyDataPoints.tar has been downloaded and extracted,

cd QuantizePolyDataPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QuantizePolyDataPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/Reflection/","title":"Reflection","text":"

vtk-examples/Cxx/PolyData/Reflection

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/Reflection/#description","title":"Description","text":"

Note

This example uses vtkReflectionFilter, which outputs a vtkDataObject. For an example that returns a vtkPolyData, see TransformPolyData.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/Reflection/#code","title":"Code","text":"

Reflection.cxx

#include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkReflectionFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Mint\").GetData());\n\n  // Reflection\n  vtkNew<vtkReflectionFilter> reflectionFilter;\n  reflectionFilter->SetInputConnection(coneSource->GetOutputPort());\n  reflectionFilter->CopyInputOff();\n  reflectionFilter->Update();\n\n  vtkNew<vtkDataSetMapper> reflectionMapper;\n  reflectionMapper->SetInputConnection(reflectionFilter->GetOutputPort());\n  vtkNew<vtkActor> reflectionActor;\n  reflectionActor->SetMapper(reflectionMapper);\n  reflectionActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Reflection\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(coneActor);\n  renderer->AddActor(reflectionActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/Reflection/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Reflection)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Reflection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Reflection MACOSX_BUNDLE Reflection.cxx )\n  target_link_libraries(Reflection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Reflection\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/Reflection/#download-and-build-reflection","title":"Download and Build Reflection","text":"

Click here to download Reflection and its CMakeLists.txt file. Once the tarball Reflection.tar has been downloaded and extracted,

cd Reflection/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Reflection\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/RemoveOutsideSurface/","title":"RemoveOutsideSurface","text":"

vtk-examples/Cxx/PolyData/RemoveOutsideSurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/RemoveOutsideSurface/#description","title":"Description","text":"

This example removes the outer surface of a multiple surface vtkPolyData model. The examples assumes the outside surface is closed and there is only one outside surface. It also assumes that the center of the model lies inside the outer surface.

The example proceeds as follows:

  1. Use vtkConnectivityFilter to label all of the regions in the model with a region id.
  2. Cast a ray from outside the bounds of the model into the center of the model. Use a vtkCellLocator to intersect the ray with the model. The intersected cell will be on the outside surface of the model.
  3. The vtkCellData of the intersected cell will have the region id of the cell.
  4. Use a vtkCellIterator to visit each cell of the model. Cells whose region id is not equal to the interesected cell's region io are retained on a new vtkPolyData

The resulting vtkPolyData will contain all but the outside surface.

If run without arguments, the example generates several small (in area) spheres inside a large (in area) sphere. The inner sphere have more cells than the outer sphere, but will not be extracted.

The gold model is the original polydata and the blue model is the original with tghe outer surface removed.

You can try your own surface by specifying a XML PolyData file (.vtp) on the command line.

Seealso

ExtractOutsideSurface extracts only the outside surface.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/RemoveOutsideSurface/#code","title":"Code","text":"

RemoveOutsideSurface.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkCellLocator.h>\n#include <vtkConnectivityFilter.h>\n#include <vtkGenericCell.h>\n#include <vtkIdTypeArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // PolyData to process.\n  vtkSmartPointer<vtkPolyData> polyData;\n\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkAppendPolyData> appendFilter;\n\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    for (int i = 0; i < 20; ++i)\n    {\n      // Small spheres with most polgons\n      vtkNew<vtkSphereSource> sphereSource1;\n      sphereSource1->SetThetaResolution(10);\n      sphereSource1->SetPhiResolution(10);\n      auto x = randomSequence->GetRangeValue(4.0, 14.0);\n      randomSequence->Next();\n      auto y = randomSequence->GetRangeValue(-3.0, 5.0);\n      randomSequence->Next();\n      // auto z = randomSequence->GetRangeValue(4.0, 14.0);\n      randomSequence->Next();\n      sphereSource1->SetCenter(x, y, x);\n      sphereSource1->SetRadius(1.0);\n      appendFilter->AddInputConnection(sphereSource1->GetOutputPort());\n    }\n\n    // Large sphere with least polygons.\n    vtkNew<vtkSphereSource> sphereSource2;\n    sphereSource2->SetRadius(10);\n    sphereSource2->SetCenter(10, 1, 10);\n\n    appendFilter->AddInputConnection(sphereSource2->GetOutputPort());\n    appendFilter->Update();\n    polyData = appendFilter->GetOutput();\n  }\n\n  double center[3], bounds[6];\n  polyData->GetCenter(center);\n  std::cout << \"Center of data: \" << center[0] << \", \" << center[1] << \", \"\n            << center[2] << std::endl;\n  polyData->GetPoints()->GetBounds(bounds);\n  std::cout << \"Bounds of data: \" << bounds[0] << \", \" << bounds[1] << \", \"\n            << bounds[2] << \", \" << bounds[3] << \", \" << bounds[4] << \", \"\n            << bounds[5] << std::endl;\n\n  // Extract all regions and label cells with region number.\n  vtkNew<vtkConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputData(polyData);\n  connectivityFilter->SetExtractionModeToAllRegions();\n  connectivityFilter->ColorRegionsOn();\n  connectivityFilter->Update();\n\n  // Build a cell locator.\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(connectivityFilter->GetOutput());\n  cellLocator->BuildLocator();\n\n  // Now fire a ray from outside the bounds to the center and find a\n  // cell. This cell should be on the outside surface.\n  double rayStart[3];\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    rayStart[i] = bounds[2 * i + 1] * 1.1;\n  }\n\n  vtkIdType cellId = -1;\n  double xyz[3], t, pcoords[3];\n  int subId;\n\n  cellLocator->IntersectWithLine(rayStart, center, 0.0001, t, xyz, pcoords,\n                                 subId, cellId);\n\n  vtkIdTypeArray* cd = dynamic_cast<vtkIdTypeArray*>(\n      connectivityFilter->GetOutput()->GetCellData()->GetScalars());\n  vtkIdType outsideRegionId = cd->GetTuple1(cellId);\n  std::cout << \"Id of cell on outside surface: \" << cellId << std::endl;\n  std::cout << \"CellData at \" << cellId << \": \" << outsideRegionId << std::endl;\n\n  // Build a polydata from cells that are not in the outside surface\n  // Iterate over the original cells.\n  vtkNew<vtkPolyData> insidePolyData;\n  insidePolyData->Allocate();\n  insidePolyData->SetPoints(connectivityFilter->GetOutput()->GetPoints());\n\n  vtkNew<vtkGenericCell> cell;\n  auto it = connectivityFilter->GetOutput()->NewCellIterator();\n  vtkIdType originalCellId = 0;\n  for (it->InitTraversal(); !it->IsDoneWithTraversal();\n       it->GoToNextCell(), ++originalCellId)\n  {\n    //  Retain cell if it is NOT an outside cell.\n    if (cd->GetTuple1(originalCellId) != outsideRegionId)\n    {\n      it->GetCell(cell);\n      insidePolyData->InsertNextCell(it->GetCellType(), cell->GetPointIds());\n    }\n  }\n  it->Delete();\n\n  // Create a mapper and actor for original data.\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputData(polyData);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->BackfaceCullingOn();\n  originalActor->GetProperty()->SetOpacity(.5);\n  originalActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a mapper and actor for extracted data.\n  vtkNew<vtkPolyDataMapper> extractedMapper;\n  extractedMapper->SetInputData(insidePolyData);\n\n  vtkNew<vtkActor> extractedActor;\n  extractedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n  extractedActor->SetMapper(extractedMapper);\n  extractedActor->GetProperty()->SetOpacity(0.5);\n  extractedActor->GetProperty()->BackfaceCullingOn();\n\n  // Create a renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(originalActor);\n  renderer->AddActor(extractedActor);\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"Beige\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  extractedActor->SetPosition((bounds[1] - bounds[0]) / 1.9, 0, 0);\n  originalActor->SetPosition(-(bounds[1] - bounds[0]) / 1.9, 0, 0);\n\n  // Create a render window.\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(renderer);\n  renwin->SetSize(512, 512);\n  renwin->SetWindowName(\"RemoveOutsideSurface\");\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n  renwin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/RemoveOutsideSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RemoveOutsideSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RemoveOutsideSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RemoveOutsideSurface MACOSX_BUNDLE RemoveOutsideSurface.cxx )\n  target_link_libraries(RemoveOutsideSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RemoveOutsideSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/RemoveOutsideSurface/#download-and-build-removeoutsidesurface","title":"Download and Build RemoveOutsideSurface","text":"

Click here to download RemoveOutsideSurface and its CMakeLists.txt file. Once the tarball RemoveOutsideSurface.tar has been downloaded and extracted,

cd RemoveOutsideSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RemoveOutsideSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/RemoveVertices/","title":"RemoveVertices","text":"

vtk-examples/Cxx/PolyData/RemoveVertices

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/RemoveVertices/#code","title":"Code","text":"

RemoveVertices.cxx

#include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtkXMLPolyDataWriter.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtp e.g. Bunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string filename = argv[1];\n\n  // Read all the data from the file.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkPolyData> output;\n  output->ShallowCopy(reader->GetOutput());\n  // output->SetVerts(NULL);\n  vtkNew<vtkCellArray> verts;\n  output->SetVerts(verts);\n  // output->SetPoints(reader->GetOutput()->GetPoints());\n  // output->SetPolys(reader->GetOutput()->GetPolys());\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(\"test.vtp\");\n  writer->SetInputData(output);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/RemoveVertices/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RemoveVertices)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RemoveVertices: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RemoveVertices MACOSX_BUNDLE RemoveVertices.cxx )\n  target_link_libraries(RemoveVertices PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RemoveVertices\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/RemoveVertices/#download-and-build-removevertices","title":"Download and Build RemoveVertices","text":"

Click here to download RemoveVertices and its CMakeLists.txt file. Once the tarball RemoveVertices.tar has been downloaded and extracted,

cd RemoveVertices/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RemoveVertices\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ResampleAppendedPolyData/","title":"ResampleAppendedPolyData","text":"

vtk-examples/Cxx/PolyData/ResampleAppendedPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ResampleAppendedPolyData/#description","title":"Description","text":"

The example populates a level terrain with randomly positioned and scaled objects selected from vtkPlatonicSolidSource.

The example proceeds as follows:

  1. Create a terrain using vtkPlaneSource.
  2. Generate objects using vtkPlatonicSolidSource, randomly selecting the type of solid.
  3. Randomly scale and place the object using std::random.
  4. Use vtkAppendPolyDatato to append the object to the terrain and other objects.
  5. Create a higher or lower resolution terrain.
  6. For each point in the new terrain, create a long line, through the point.
  7. Use vtkCellLocator::IntersectWithLine to find the intersection of the line and use its z value as the new terrain height.
  8. Display original and resampled terrain in side-by-side viewports.

Note

The example was motivated on this question on VTK's Discourse.

Note

Note that std::mt19937_64 gives different results for Microsoft Visual Studio and Linux gcc so it has been commented out and vtkMinimalStandardRandomSequence used instead.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ResampleAppendedPolyData/#code","title":"Code","text":"

ResampleAppendedPolyData.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkCellLocator.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n// #include <random>\n\nint main(int, char*[])\n{\n  // Define adjustable paramaters.\n  constexpr double xMin = -10.0;\n  constexpr double xMax = 10.0;\n  constexpr double yMin = -10.0;\n  constexpr double yMax = 10.0;\n  constexpr int xResolution = 100;\n  constexpr int yResolution = 100;\n  constexpr double scaleMin = 0.2;\n  constexpr double scaleMax = 1.5;\n  constexpr int numberOfObjects = 200;\n  constexpr int probeResolution = 200.0;\n\n  // Generate terrain.\n  vtkNew<vtkPlaneSource> terrain;\n  terrain->SetOrigin(xMin, yMin, 0.0);\n  terrain->SetPoint2(xMin, yMax, 0.0);\n  terrain->SetPoint1(xMax, yMin, 0.0);\n  terrain->SetXResolution(xResolution);\n  terrain->SetYResolution(yResolution);\n  terrain->Update();\n\n  // Generate objects and append them to terrain.\n  vtkNew<vtkAppendPolyData> append;\n  append->AddInputConnection(terrain->GetOutputPort());\n\n  // Commented out since it gives different results for VS and gcc.\n  // std::mt19937_64 mt(4355412); // Standard mersenne twister engine\n  // std::uniform_int_distribution<> solid(0, 4);\n  // std::uniform_real_distribution<> scale(scaleMin, scaleMax);\n  // std::uniform_real_distribution<> position(xMin + 1.0, xMax - 1.0);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(4355412);\n\n  for (auto i = 0; i < numberOfObjects; ++i)\n  {\n    int solid = static_cast<int>(randomSequence->GetRangeValue(0, 4));\n    randomSequence->Next();\n    double s = randomSequence->GetRangeValue(scaleMin, scaleMax);\n    randomSequence->Next();\n    double x, y;\n    x = randomSequence->GetRangeValue(xMin + 1.0, xMax - 1.0);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(yMin + 1.0, yMax - 1.0);\n    randomSequence->Next();\n\n    // Generate an object.\n    vtkNew<vtkPlatonicSolidSource> platonic;\n    // platonic->SetSolidType(solid(mt));\n    platonic->SetSolidType(solid);\n\n    // Translate and scale.\n    vtkNew<vtkTransform> transform;\n    // double s = scale(mt);\n    // transform->Translate(position(mt), position(mt), 0.0);\n    transform->Translate(x, y, 0.0);\n    transform->Scale(s, s, s);\n    vtkNew<vtkTransformPolyDataFilter> transformPD;\n    transformPD->SetTransform(transform);\n    transformPD->SetInputConnection(platonic->GetOutputPort());\n    transformPD->Update();\n\n    vtkNew<vtkPolyData> pd;\n    pd->DeepCopy(transformPD->GetOutput());\n    append->AddInputData(pd);\n  }\n  append->Update();\n\n  // Resample terrian.\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(append->GetOutput());\n  cellLocator->BuildLocator();\n\n  // Generate a probe plane.\n  vtkNew<vtkPlaneSource> probeTerrain;\n  probeTerrain->SetOrigin(terrain->GetOrigin());\n  probeTerrain->SetPoint2(terrain->GetPoint2());\n  probeTerrain->SetPoint1(terrain->GetPoint1());\n  probeTerrain->SetXResolution(probeResolution);\n  probeTerrain->SetYResolution(probeResolution);\n  probeTerrain->Update();\n\n  vtkPoints* probePoints = probeTerrain->GetOutput()->GetPoints();\n  for (auto i = 0; i < probeTerrain->GetOutput()->GetNumberOfPoints(); ++i)\n  {\n    int subId;\n    double t, xyz[3], pcoords[3];\n    double rayStart[3], rayEnd[3];\n    probePoints->GetPoint(i, rayStart);\n    rayStart[2] += 100000.0;\n    probePoints->GetPoint(i, rayEnd);\n    rayEnd[2] -= 100000.0;\n\n    if (cellLocator->IntersectWithLine(rayStart, rayEnd, 0.0001, t, xyz,\n                                       pcoords, subId))\n    {\n      // The new elevation is in xyz[2].\n      double pt[3];\n      probePoints->GetPoint(i, pt);\n      probePoints->SetPoint(i, pt[0], pt[1], xyz[2]);\n    }\n  }\n  probeTerrain->GetOutput()->GetPointData()->SetNormals(nullptr);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  // Two viewports, left for original and right for resampled.\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(append->GetOutputPort());\n  originalMapper->SetInputData(append->GetOutput());\n  originalMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetRepresentationToWireframe();\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Seashell\").GetData());\n\n  vtkNew<vtkPolyDataMapper> resampledMapper;\n  resampledMapper->SetInputConnection(append->GetOutputPort());\n  resampledMapper->SetInputData(probeTerrain->GetOutput());\n  resampledMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> resampledActor;\n  resampledActor->SetMapper(resampledMapper);\n  resampledActor->GetProperty()->SetRepresentationToWireframe();\n  resampledActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Seashell\").GetData());\n\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->UseHiddenLineRemovalOn();\n  rightRenderer->AddActor(resampledActor);\n  rightRenderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->UseHiddenLineRemovalOn();\n  leftRenderer->AddActor(originalActor);\n  leftRenderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(rightRenderer);\n  renderWindow->AddRenderer(leftRenderer);\n  renderWindow->SetSize(1024, 512);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"ResampleAppendedPolyData\");\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindow->Render();\n  vtkCamera* camera;\n  camera = leftRenderer->GetActiveCamera();\n  camera->SetFocalPoint(0.0, 0.0, 0.0);\n  camera->SetPosition(1.0, 0.0, 0.0);\n  camera->SetViewUp(0.0, 0.0, 1.0);\n  camera->Azimuth(30.0);\n  camera->Elevation(45.0);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->SetActiveCamera(camera);\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ResampleAppendedPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ResampleAppendedPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ResampleAppendedPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ResampleAppendedPolyData MACOSX_BUNDLE ResampleAppendedPolyData.cxx )\n  target_link_libraries(ResampleAppendedPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ResampleAppendedPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ResampleAppendedPolyData/#download-and-build-resampleappendedpolydata","title":"Download and Build ResampleAppendedPolyData","text":"

Click here to download ResampleAppendedPolyData and its CMakeLists.txt file. Once the tarball ResampleAppendedPolyData.tar has been downloaded and extracted,

cd ResampleAppendedPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ResampleAppendedPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ResamplePolyLine/","title":"ResamplePolyLine","text":"

vtk-examples/Cxx/PolyData/ResamplePolyLine

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/ResamplePolyLine/#description","title":"Description","text":"

This example resamples a polyline with a vtkCardinalSpline. The resampled line will have 10 times the number of points contained in the original polyline. If no XML file is provided, a random polyline is generated.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ResamplePolyLine/#code","title":"Code","text":"

ResamplePolyLine.cxx

#include <vtkActor.h>\n#include <vtkCardinalSpline.h>\n#include <vtkCellArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSplineFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = vtkSmartPointer<vtkPolyData>::New();\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    unsigned int numberOfPoints = 10;\n    vtkNew<vtkPoints> points;\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n    for (unsigned int i = 0; i < numberOfPoints; ++i)\n    {\n      double x, y, z;\n      // Random position and radius.\n      x = randomSequence->GetRangeValue(-1.0, 1.0);\n      randomSequence->Next();\n      y = randomSequence->GetRangeValue(-1.0, 1.0);\n      randomSequence->Next();\n      z = randomSequence->GetRangeValue(-1.0, 1.0);\n      randomSequence->Next();\n      points->InsertNextPoint(x, y, z);\n    }\n    vtkNew<vtkCellArray> lines;\n    lines->InsertNextCell(numberOfPoints);\n    for (unsigned int i = 0; i < numberOfPoints; ++i)\n    {\n      lines->InsertCellPoint(i);\n    }\n    polyData->SetPoints(points);\n    polyData->SetLines(lines);\n  }\n\n  vtkNew<vtkCardinalSpline> spline;\n  spline->SetLeftConstraint(2);\n  spline->SetLeftValue(0.0);\n  spline->SetRightConstraint(2);\n  spline->SetRightValue(0.0);\n\n  vtkNew<vtkSplineFilter> splineFilter;\n  splineFilter->SetInputData(polyData);\n  splineFilter->SetNumberOfSubdivisions(polyData->GetNumberOfPoints() * 10);\n  splineFilter->SetSpline(spline);\n\n  vtkNew<vtkPolyDataMapper> splineMapper;\n  splineMapper->SetInputConnection(splineFilter->GetOutputPort());\n\n  vtkNew<vtkActor> splineActor;\n  splineActor->SetMapper(splineMapper);\n\n  vtkNew<vtkSphereSource> originalNodes;\n  originalNodes->SetRadius(.04);\n  originalNodes->SetPhiResolution(10);\n  originalNodes->SetThetaResolution(10);\n\n  vtkNew<vtkGlyph3D> glyphOriginal;\n  glyphOriginal->SetInputData(polyData);\n  glyphOriginal->SetSourceConnection(originalNodes->GetOutputPort());\n\n  vtkNew<vtkSphereSource> newNodes;\n  newNodes->SetRadius(.02);\n  newNodes->SetPhiResolution(10);\n  newNodes->SetThetaResolution(10);\n\n  vtkNew<vtkGlyph3D> glyphNew;\n  glyphNew->SetInputConnection(splineFilter->GetOutputPort());\n  glyphNew->SetSourceConnection(newNodes->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(glyphOriginal->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  originalActor->GetProperty()->SetOpacity(.6);\n\n  vtkNew<vtkPolyDataMapper> newMapper;\n  newMapper->SetInputConnection(glyphNew->GetOutputPort());\n\n  vtkNew<vtkActor> newActor;\n  newActor->SetMapper(newMapper);\n  newActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ResamplePolyLine\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(originalActor);\n  renderer->AddActor(newActor);\n  renderer->AddActor(splineActor);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ResamplePolyLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ResamplePolyLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ResamplePolyLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ResamplePolyLine MACOSX_BUNDLE ResamplePolyLine.cxx )\n  target_link_libraries(ResamplePolyLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ResamplePolyLine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ResamplePolyLine/#download-and-build-resamplepolyline","title":"Download and Build ResamplePolyLine","text":"

Click here to download ResamplePolyLine and its CMakeLists.txt file. Once the tarball ResamplePolyLine.tar has been downloaded and extracted,

cd ResamplePolyLine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ResamplePolyLine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ReverseSense/","title":"ReverseSense","text":"

vtk-examples/Cxx/PolyData/ReverseSense

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ReverseSense/#code","title":"Code","text":"

ReverseSense.cxx

#include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkReverseSense.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  auto pointNormals = dynamic_cast<vtkFloatArray*>(\n      sphereSource->GetOutput()->GetPointData()->GetNormals());\n\n  std::cout << std::endl << \"Normals: \" << std::endl;\n  // Display the first few normals.\n  for (unsigned int i = 0; i < 5; i++)\n  {\n    double pN[3];\n    pointNormals->GetTuple(i, pN);\n    std::cout << \"Point normal \" << i << \": \" << pN[0] << \" \" << pN[1] << \" \"\n              << pN[2] << std::endl;\n  }\n\n  vtkNew<vtkReverseSense> reverseSense;\n  reverseSense->SetInputConnection(sphereSource->GetOutputPort());\n  reverseSense->ReverseNormalsOn();\n  reverseSense->Update();\n\n  auto reversedNormals = dynamic_cast<vtkFloatArray*>(\n      reverseSense->GetOutput()->GetPointData()->GetNormals());\n\n  std::cout << std::endl << \"Reversed: \" << std::endl;\n  // Display the first few normals to verify that they are flipped\n  for (unsigned int i = 0; i < 5; i++)\n  {\n    double pN[3];\n    reversedNormals->GetTuple(i, pN);\n    std::cout << \"Reversed normal \" << i << \": \" << pN[0] << \" \" << pN[1] << \" \"\n              << pN[2] << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ReverseSense/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReverseSense)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReverseSense: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReverseSense MACOSX_BUNDLE ReverseSense.cxx )\n  target_link_libraries(ReverseSense PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReverseSense\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ReverseSense/#download-and-build-reversesense","title":"Download and Build ReverseSense","text":"

Click here to download ReverseSense and its CMakeLists.txt file. Once the tarball ReverseSense.tar has been downloaded and extracted,

cd ReverseSense/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReverseSense\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/RibbonFilter/","title":"RibbonFilter","text":"

vtk-examples/Cxx/PolyData/RibbonFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/RibbonFilter/#description","title":"Description","text":"

This example demonstrates how to draw a flat surface (a ribbon) along a line.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/RibbonFilter/#code","title":"Code","text":"

RibbonFilter.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRibbonFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Spiral parameters.\n  unsigned int nV = 256; // No. of vertices\n  double rS = 2;         // Spiral radius\n  unsigned int nCyc = 3; // No. of helical cycles\n  double h = 10;         // Height\n\n  unsigned int i;\n\n  // Create points and cells for a helix.\n  vtkNew<vtkPoints> points;\n  for (i = 0; i < nV; i++)\n  {\n    // Helical coordinates.\n    auto vX = rS * cos(2 * vtkMath::Pi() * nCyc * i / (nV - 1));\n    auto vY = rS * sin(2 * vtkMath::Pi() * nCyc * i / (nV - 1));\n    auto vZ = h * i / nV;\n    points->InsertPoint(i, vX, vY, vZ);\n  }\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(nV);\n  for (i = 0; i < nV; i++)\n  {\n    lines->InsertCellPoint(i);\n  }\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n  polyData->SetLines(lines);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  lineActor->GetProperty()->SetLineWidth(3);\n\n  // Create a ribbon around the line.\n  vtkNew<vtkRibbonFilter> ribbonFilter;\n  ribbonFilter->SetInputData(polyData);\n  ribbonFilter->SetWidth(.4);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> ribbonMapper;\n  ribbonMapper->SetInputConnection(ribbonFilter->GetOutputPort());\n\n  vtkNew<vtkActor> ribbonActor;\n  ribbonActor->SetMapper(ribbonMapper);\n  ribbonActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"RibbonFilter\");\n\n  // Add the actor to the scene.\n  renderer->AddActor(ribbonActor);\n  renderer->AddActor(lineActor);\n\n  // Render and interact.\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Generate an interesting view.\n  renderer->GetActiveCamera()->Azimuth(40);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/RibbonFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RibbonFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RibbonFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RibbonFilter MACOSX_BUNDLE RibbonFilter.cxx )\n  target_link_libraries(RibbonFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RibbonFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/RibbonFilter/#download-and-build-ribbonfilter","title":"Download and Build RibbonFilter","text":"

Click here to download RibbonFilter and its CMakeLists.txt file. Once the tarball RibbonFilter.tar has been downloaded and extracted,

cd RibbonFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RibbonFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/RotationAroundLine/","title":"RotationAroundLine","text":"

vtk-examples/Cxx/PolyData/RotationAroundLine

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/RotationAroundLine/#description","title":"Description","text":"

This example demonstrates how to rotate an object around an axis. For the demo, we rotate a cone 10 degrees around the y axis.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/RotationAroundLine/#code","title":"Code","text":"

RotationAroundLine.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a rendering window and renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"RotationAroundLine\");\n\n  // Create a renderwindowinteractor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create arrow\n  vtkNew<vtkArrowSource> source;\n\n  // Create a transform that rotates the arrow 45\u00b0 around the z-axis.\n  vtkNew<vtkTransform> transform;\n  transform->RotateWXYZ(45, 0, 0, 1);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetTransform(transform);\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->Update();\n\n  // Mapper for the original arrow.\n  vtkNew<vtkPolyDataMapper> coneMapper1;\n  coneMapper1->SetInputConnection(source->GetOutputPort());\n\n  // Another mapper for the rotated arrow.\n  vtkNew<vtkPolyDataMapper> coneMapper2;\n  coneMapper2->SetInputConnection(transformFilter->GetOutputPort());\n\n  // Actor for original arrow.\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(coneMapper1);\n\n  // Actor for rotated arrow.\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(coneMapper2);\n\n  // Color the original arrow.\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"LightCoral\").GetData());\n\n  // Color rotated arrow.\n  actor2->GetProperty()->SetColor(\n      colors->GetColor3d(\"PaleTurquoise\").GetData());\n\n  // Assign actor to the renderer.\n  ren->AddActor(actor1);\n  ren->AddActor(actor2);\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Enable the user interface interactor.\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/RotationAroundLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotationAroundLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotationAroundLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotationAroundLine MACOSX_BUNDLE RotationAroundLine.cxx )\n  target_link_libraries(RotationAroundLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotationAroundLine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/RotationAroundLine/#download-and-build-rotationaroundline","title":"Download and Build RotationAroundLine","text":"

Click here to download RotationAroundLine and its CMakeLists.txt file. Once the tarball RotationAroundLine.tar has been downloaded and extracted,

cd RotationAroundLine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RotationAroundLine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/RuledSurfaceFilter/","title":"RuledSurfaceFilter","text":"

vtk-examples/Cxx/PolyData/RuledSurfaceFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/RuledSurfaceFilter/#code","title":"Code","text":"

RuledSurfaceFilter.cxx

#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRuledSurfaceFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create first line.\n  vtkNew<vtkPoints> points;\n  points->InsertPoint(0, 0, 0, 1);\n  points->InsertPoint(1, 1, 0, 0);\n  points->InsertPoint(2, 0, 1, 0);\n  points->InsertPoint(3, 1, 1, 1);\n\n  vtkNew<vtkLine> line1;\n  line1->GetPointIds()->SetId(0, 0);\n  line1->GetPointIds()->SetId(1, 1);\n\n  vtkNew<vtkLine> line2;\n  line2->GetPointIds()->SetId(0, 2);\n  line2->GetPointIds()->SetId(1, 3);\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line1);\n  lines->InsertNextCell(line2);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetLines(lines);\n\n  vtkNew<vtkRuledSurfaceFilter> ruledSurfaceFilter;\n  ruledSurfaceFilter->SetInputData(polydata);\n  ruledSurfaceFilter->SetResolution(21, 21);\n  ruledSurfaceFilter->SetRuledModeToResample();\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RuledSurfaceFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(ruledSurfaceFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(60);\n  renderer->GetActiveCamera()->Elevation(60);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/RuledSurfaceFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RuledSurfaceFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RuledSurfaceFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RuledSurfaceFilter MACOSX_BUNDLE RuledSurfaceFilter.cxx )\n  target_link_libraries(RuledSurfaceFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RuledSurfaceFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/RuledSurfaceFilter/#download-and-build-ruledsurfacefilter","title":"Download and Build RuledSurfaceFilter","text":"

Click here to download RuledSurfaceFilter and its CMakeLists.txt file. Once the tarball RuledSurfaceFilter.tar has been downloaded and extracted,

cd RuledSurfaceFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RuledSurfaceFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/SelectPolyData/","title":"SelectPolyData","text":"

vtk-examples/Cxx/PolyData/SelectPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/SelectPolyData/#code","title":"Code","text":"

SelectPolyData.cxx

#include <vtkClipPolyData.h>\n#include <vtkLODActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelectPolyData.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(50);\n  sphereSource->SetThetaResolution(100);\n  sphereSource->Update();\n\n  vtkNew<vtkPoints> selectionPoints;\n\n  selectionPoints->InsertPoint(0, -0.16553, 0.135971, 0.451972);\n  selectionPoints->InsertPoint(1, -0.0880123, -0.134952, 0.4747);\n  selectionPoints->InsertPoint(2, 0.00292618, -0.134604, 0.482459);\n  selectionPoints->InsertPoint(3, 0.0641941, 0.067112, 0.490947);\n  selectionPoints->InsertPoint(4, 0.15577, 0.0734765, 0.469245);\n  selectionPoints->InsertPoint(5, 0.166667, -0.129217, 0.454622);\n  selectionPoints->InsertPoint(6, 0.241259, -0.123363, 0.420581);\n  selectionPoints->InsertPoint(7, 0.240334, 0.0727106, 0.432555);\n  selectionPoints->InsertPoint(8, 0.308529, 0.0844311, 0.384357);\n  selectionPoints->InsertPoint(9, 0.32672, -0.121674, 0.359187);\n  selectionPoints->InsertPoint(10, 0.380721, -0.117342, 0.302527);\n  selectionPoints->InsertPoint(11, 0.387804, 0.0455074, 0.312375);\n  selectionPoints->InsertPoint(12, 0.43943, -0.111673, 0.211707);\n  selectionPoints->InsertPoint(13, 0.470984, -0.0801913, 0.147919);\n  selectionPoints->InsertPoint(14, 0.436777, 0.0688872, 0.233021);\n  selectionPoints->InsertPoint(15, 0.44874, 0.188852, 0.109882);\n  selectionPoints->InsertPoint(16, 0.391352, 0.254285, 0.176943);\n  selectionPoints->InsertPoint(17, 0.373274, 0.154162, 0.294296);\n  selectionPoints->InsertPoint(18, 0.274659, 0.311654, 0.276609);\n  selectionPoints->InsertPoint(19, 0.206068, 0.31396, 0.329702);\n  selectionPoints->InsertPoint(20, 0.263789, 0.174982, 0.387308);\n  selectionPoints->InsertPoint(21, 0.213034, 0.175485, 0.417142);\n  selectionPoints->InsertPoint(22, 0.169113, 0.261974, 0.390286);\n  selectionPoints->InsertPoint(23, 0.102552, 0.25997, 0.414814);\n  selectionPoints->InsertPoint(24, 0.131512, 0.161254, 0.454705);\n  selectionPoints->InsertPoint(25, 0.000192443, 0.156264, 0.475307);\n  selectionPoints->InsertPoint(26, -0.0392091, 0.000251724, 0.499943);\n  selectionPoints->InsertPoint(27, -0.096161, 0.159646, 0.46438);\n\n  vtkNew<vtkSelectPolyData> loop;\n  loop->SetInputConnection(sphereSource->GetOutputPort());\n  loop->SetLoop(selectionPoints);\n  loop->GenerateSelectionScalarsOn();\n  loop->SetSelectionModeToSmallestRegion(); // negative scalars inside\n\n  vtkNew<vtkClipPolyData> clip;\n  clip->SetInputConnection(loop->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> clipMapper;\n  clipMapper->SetInputConnection(clip->GetOutputPort());\n  clipMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkLODActor> clipActor;\n  clipActor->SetMapper(clipMapper);\n  clipActor->SetBackfaceProperty(backProp);\n  clipActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SelectPolyData\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(clipActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetSize(500, 500);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/SelectPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectPolyData MACOSX_BUNDLE SelectPolyData.cxx )\n  target_link_libraries(SelectPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/SelectPolyData/#download-and-build-selectpolydata","title":"Download and Build SelectPolyData","text":"

Click here to download SelectPolyData and its CMakeLists.txt file. Once the tarball SelectPolyData.tar has been downloaded and extracted,

cd SelectPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SelectPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/SelectVisiblePoints/","title":"SelectVisiblePoints","text":"

vtk-examples/Cxx/PolyData/SelectVisiblePoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/SelectVisiblePoints/#description","title":"Description","text":"

This example demonstrates how to determine which objects are visible.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/SelectVisiblePoints/#code","title":"Code","text":"

SelectVisiblePoints.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelectVisiblePoints.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nclass MyInteractor : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MyInteractor* New();\n  vtkTypeMacro(MyInteractor, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnLeftButtonDown() override\n  {\n    this->VisibleFilter->Update();\n    std::cout << \"There are currently: \"\n              << this->VisibleFilter->GetOutput()->GetNumberOfPoints()\n              << \" visible.\" << std::endl;\n    // Forward events\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n\n  void SetVisibleFilter(vtkSmartPointer<vtkSelectVisiblePoints> vis)\n  {\n    this->VisibleFilter = vis;\n  }\n\nprivate:\n  vtkSmartPointer<vtkSelectVisiblePoints> VisibleFilter;\n};\n\nvtkStandardNewMacro(MyInteractor);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(5.0, 0, 0);\n  sphereSource->Update();\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetRadius(2.0);\n  pointSource->SetNumberOfPoints(200);\n  pointSource->Update();\n\n  // Create an actor and mapper.\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(pointSource->GetOutputPort());\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Honeydew\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SelectVisiblePoints\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(pointsActor);\n  renderer->SetBackground(colors->GetColor3d(\"ivory_black\").GetData());\n\n  vtkNew<vtkSelectVisiblePoints> selectVisiblePoints;\n  selectVisiblePoints->SetInputConnection(pointSource->GetOutputPort());\n  selectVisiblePoints->SetRenderer(renderer);\n  selectVisiblePoints->Update();\n\n  vtkNew<MyInteractor> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->SetVisibleFilter(selectVisiblePoints);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/SelectVisiblePoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectVisiblePoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectVisiblePoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectVisiblePoints MACOSX_BUNDLE SelectVisiblePoints.cxx )\n  target_link_libraries(SelectVisiblePoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectVisiblePoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/SelectVisiblePoints/#download-and-build-selectvisiblepoints","title":"Download and Build SelectVisiblePoints","text":"

Click here to download SelectVisiblePoints and its CMakeLists.txt file. Once the tarball SelectVisiblePoints.tar has been downloaded and extracted,

cd SelectVisiblePoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SelectVisiblePoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ShrinkPolyData/","title":"ShrinkPolyData","text":"

vtk-examples/Cxx/PolyData/ShrinkPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ShrinkPolyData/#code","title":"Code","text":"

ShrinkPolyData.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]); // e.g. cowHead.vtp\n    reader->Update();\n    inputPolyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetPhiResolution(15);\n    sphereSource->SetThetaResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkShrinkPolyData> shrink;\n  shrink->SetShrinkFactor(.8);\n  shrink->SetInputData(inputPolyData);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Salmon\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ShrinkPolyData\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ShrinkPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShrinkPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShrinkPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShrinkPolyData MACOSX_BUNDLE ShrinkPolyData.cxx )\n  target_link_libraries(ShrinkPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShrinkPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ShrinkPolyData/#download-and-build-shrinkpolydata","title":"Download and Build ShrinkPolyData","text":"

Click here to download ShrinkPolyData and its CMakeLists.txt file. Once the tarball ShrinkPolyData.tar has been downloaded and extracted,

cd ShrinkPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ShrinkPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/Silhouette/","title":"Silhouette","text":"

vtk-examples/Cxx/PolyData/Silhouette

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/Silhouette/#code","title":"Code","text":"

Silhouette.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataSilhouette.h>\n#include <vtkProperty.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  if (argc < 2)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n\n    polyData = sphereSource->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n\n    vtkNew<vtkCleanPolyData> clean;\n    clean->SetInputConnection(reader->GetOutputPort());\n    clean->Update();\n\n    polyData = clean->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // create mapper and actor for original model\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // create renderer and renderWindow\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  renderer->AddActor(actor); // view the original model\n\n  // Compute the silhouette\n  vtkNew<vtkPolyDataSilhouette> silhouette;\n  silhouette->SetInputData(polyData);\n  silhouette->SetCamera(renderer->GetActiveCamera());\n  silhouette->SetEnableFeatureAngle(0);\n\n  // create mapper and actor for silouette\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(silhouette->GetOutputPort());\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor2->GetProperty()->SetLineWidth(5);\n\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  // render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"Silhouette\");\n\n  renderWindow->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/Silhouette/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Silhouette)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersHybrid\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Silhouette: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Silhouette MACOSX_BUNDLE Silhouette.cxx )\n  target_link_libraries(Silhouette PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Silhouette\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/Silhouette/#download-and-build-silhouette","title":"Download and Build Silhouette","text":"

Click here to download Silhouette and its CMakeLists.txt file. Once the tarball Silhouette.tar has been downloaded and extracted,

cd Silhouette/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Silhouette\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/SmoothPolyDataFilter/","title":"SmoothPolyDataFilter","text":"

vtk-examples/Cxx/PolyData/SmoothPolyDataFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/SmoothPolyDataFilter/#code","title":"Code","text":"

SmoothPolyDataFilter.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDelaunay2D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmoothPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create parabola over a grid of points\n  vtkNew<vtkPoints> points;\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n\n  int GridSize = 20;\n  double z;\n  for (int x = -GridSize; x < GridSize; x++)\n  {\n    for (int y = -GridSize; y < GridSize; y++)\n    {\n      z = randomSequence->GetRangeValue(-1, 1) + 0.05 * x * x + 0.05 * y * y;\n      randomSequence->Next();\n      points->InsertNextPoint(x, y, z);\n    }\n  }\n\n  // Add the grid points to a polydata object\n  vtkNew<vtkPolyData> inputPolyData;\n  inputPolyData->SetPoints(points);\n\n  // Triangulate the grid points\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(inputPolyData);\n  delaunay->Update();\n\n  vtkNew<vtkSmoothPolyDataFilter> smoothFilter;\n  smoothFilter->SetInputConnection(delaunay->GetOutputPort());\n  smoothFilter->SetNumberOfIterations(15);\n  smoothFilter->SetRelaxationFactor(0.1);\n  smoothFilter->FeatureEdgeSmoothingOff();\n  smoothFilter->BoundarySmoothingOn();\n  smoothFilter->Update();\n\n  // Update normals on newly smoothed polydata\n  vtkNew<vtkPolyDataNormals> normalGenerator;\n  normalGenerator->SetInputConnection(smoothFilter->GetOutputPort());\n  normalGenerator->ComputePointNormalsOn();\n  normalGenerator->ComputeCellNormalsOn();\n  normalGenerator->Update();\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(delaunay->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkPolyDataMapper> smoothedMapper;\n  smoothedMapper->SetInputConnection(normalGenerator->GetOutputPort());\n  vtkNew<vtkActor> smoothedActor;\n  smoothedActor->SetMapper(smoothedMapper);\n  smoothedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"SmoothPolyDataFilter\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  // Add the input parabola to the left and the smoothed parabola to the right\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(smoothedActor);\n\n  leftRenderer->ResetCamera();\n  leftRenderer->GetActiveCamera()->Azimuth(130);\n  leftRenderer->GetActiveCamera()->Elevation(-80);\n  vtkCamera* camera;\n  camera = leftRenderer->GetActiveCamera();\n\n  rightRenderer->ResetCamera();\n  rightRenderer->GetActiveCamera()->Azimuth(130);\n  rightRenderer->GetActiveCamera()->Elevation(-80);\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/SmoothPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SmoothPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SmoothPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SmoothPolyDataFilter MACOSX_BUNDLE SmoothPolyDataFilter.cxx )\n  target_link_libraries(SmoothPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SmoothPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/SmoothPolyDataFilter/#download-and-build-smoothpolydatafilter","title":"Download and Build SmoothPolyDataFilter","text":"

Click here to download SmoothPolyDataFilter and its CMakeLists.txt file. Once the tarball SmoothPolyDataFilter.tar has been downloaded and extracted,

cd SmoothPolyDataFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SmoothPolyDataFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/Stripper/","title":"Stripper","text":"

vtk-examples/Cxx/PolyData/Stripper

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/Stripper/#code","title":"Code","text":"

Stripper.cxx

#include <vtkNew.h>\n#include <vtkSphereSource.h>\n#include <vtkStripper.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"Number of cells before stripping: \"\n            << sphereSource->GetOutput()->GetNumberOfCells() << std::endl;\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(sphereSource->GetOutputPort());\n  stripper->Update();\n\n  std::cout << \"Number of cells after stripping: \"\n            << stripper->GetOutput()->GetNumberOfCells() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/Stripper/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Stripper)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Stripper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Stripper MACOSX_BUNDLE Stripper.cxx )\n  target_link_libraries(Stripper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Stripper\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/Stripper/#download-and-build-stripper","title":"Download and Build Stripper","text":"

Click here to download Stripper and its CMakeLists.txt file. Once the tarball Stripper.tar has been downloaded and extracted,

cd Stripper/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Stripper\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ThinPlateSplineTransform/","title":"ThinPlateSplineTransform","text":"

vtk-examples/Cxx/PolyData/ThinPlateSplineTransform

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ThinPlateSplineTransform/#code","title":"Code","text":"

ThinPlateSplineTransform.cxx

#include <vtkActor2D.h>\n#include <vtkBMPReader.h>\n#include <vtkDataObject.h>\n#include <vtkImageBlend.h>\n#include <vtkImageGridSource.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper.h>\n#include <vtkImageReslice.h>\n#include <vtkInteractorStyleTerrain.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkThinPlateSplineTransform.h>\n\n#include <iostream>\n#include <string>\n\n// Warp an image with a thin plate spline.\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename.bmp e.g. masonry.bmp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // First, create an image to warp.\n  vtkNew<vtkImageGridSource> imageGrid;\n  imageGrid->SetGridSpacing(16, 16, 0);\n  imageGrid->SetGridOrigin(0, 0, 0);\n  imageGrid->SetDataExtent(0, 255, 0, 255, 0, 0);\n  imageGrid->SetDataScalarTypeToUnsignedChar();\n\n  vtkNew<vtkLookupTable> table;\n  table->SetTableRange(0, 1);\n  table->SetAlphaRange(0.0, 1.0);\n  table->SetHueRange(0.15, 0.15);\n  table->SetSaturationRange(1, 1);\n  table->SetValueRange(0, 1);\n  table->Build();\n\n  vtkNew<vtkImageMapToColors> alpha;\n  alpha->SetInputConnection(imageGrid->GetOutputPort());\n  alpha->SetLookupTable(table);\n\n  vtkNew<vtkBMPReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n  auto dataExtent = reader->GetDataExtent();\n  // Use dataExtent[1] and dataExtent[3] to set the render window size.\n\n  vtkNew<vtkImageBlend> blend;\n  blend->AddInputConnection(0, reader->GetOutputPort());\n  blend->AddInputConnection(0, alpha->GetOutputPort());\n\n  // Next, create a ThinPlateSpline transform.\n\n  vtkNew<vtkPoints> p1;\n  p1->SetNumberOfPoints(8);\n  p1->SetPoint(0, 0, 0, 0);\n  p1->SetPoint(1, 0, 255, 0);\n  p1->SetPoint(2, 255, 0, 0);\n  p1->SetPoint(3, 255, 255, 0);\n  p1->SetPoint(4, 96, 96, 0);\n  p1->SetPoint(5, 96, 159, 0);\n  p1->SetPoint(6, 159, 159, 0);\n  p1->SetPoint(7, 159, 96, 0);\n\n  vtkNew<vtkPoints> p2;\n  p2->SetNumberOfPoints(8);\n  p2->SetPoint(0, 0, 0, 0);\n  p2->SetPoint(1, 0, 255, 0);\n  p2->SetPoint(2, 255, 0, 0);\n  p2->SetPoint(3, 255, 255, 0);\n  p2->SetPoint(4, 96, 159, 0);\n  p2->SetPoint(5, 159, 159, 0);\n  p2->SetPoint(6, 159, 96, 0);\n  p2->SetPoint(7, 96, 96, 0);\n\n  vtkNew<vtkThinPlateSplineTransform> transform;\n  transform->SetSourceLandmarks(p2);\n  transform->SetTargetLandmarks(p1);\n  transform->SetBasisToR2LogR();\n  // You must invert the transform before passing it to vtkImageReslice.\n  transform->Inverse();\n\n  vtkNew<vtkImageReslice> reslice;\n  reslice->SetInputConnection(blend->GetOutputPort());\n  reslice->SetResliceTransform(transform);\n  reslice->SetInterpolationModeToLinear();\n  vtkNew<vtkImageMapper> map;\n  map->SetInputConnection(reslice->GetOutputPort());\n  map->SetColorWindow(255.0);\n  map->SetColorLevel(127.5);\n  map->SetZSlice(0);\n  vtkNew<vtkActor2D> act;\n  act->SetMapper(map);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(act);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->SetSize(dataExtent[1], dataExtent[3]);\n  window->SetWindowName(\"ThinPlateSplineTransform\");\n\n  window->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n  vtkNew<vtkInteractorStyleTerrain> style;\n  interactor->SetInteractorStyle(style);\n  window->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ThinPlateSplineTransform/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ThinPlateSplineTransform)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ThinPlateSplineTransform: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ThinPlateSplineTransform MACOSX_BUNDLE ThinPlateSplineTransform.cxx )\n  target_link_libraries(ThinPlateSplineTransform PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ThinPlateSplineTransform\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ThinPlateSplineTransform/#download-and-build-thinplatesplinetransform","title":"Download and Build ThinPlateSplineTransform","text":"

Click here to download ThinPlateSplineTransform and its CMakeLists.txt file. Once the tarball ThinPlateSplineTransform.tar has been downloaded and extracted,

cd ThinPlateSplineTransform/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ThinPlateSplineTransform\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ThresholdCells/","title":"ThresholdCells","text":"

vtk-examples/Cxx/PolyData/ThresholdCells

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ThresholdCells/#code","title":"Code","text":"

ThresholdCells.cxx

#include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkThreshold.h>\n#include <vtkTriangle.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(2, 2, 2);\n  points->InsertNextPoint(3, 3, 3);\n  points->InsertNextPoint(4, 4, 4);\n\n  // Create three triangles.\n  vtkNew<vtkTriangle> triangle0;\n  triangle0->GetPointIds()->SetId(0, 0);\n  triangle0->GetPointIds()->SetId(1, 1);\n  triangle0->GetPointIds()->SetId(2, 2);\n\n  vtkNew<vtkTriangle> triangle1;\n  triangle1->GetPointIds()->SetId(0, 1);\n  triangle1->GetPointIds()->SetId(1, 2);\n  triangle1->GetPointIds()->SetId(2, 3);\n\n  vtkNew<vtkTriangle> triangle2;\n  triangle2->GetPointIds()->SetId(0, 2);\n  triangle2->GetPointIds()->SetId(1, 3);\n  triangle2->GetPointIds()->SetId(2, 4);\n\n  // Add the triangles to a cell array.\n  vtkNew<vtkCellArray> triangles;\n  triangles->InsertNextCell(triangle0);\n  triangles->InsertNextCell(triangle1);\n  triangles->InsertNextCell(triangle2);\n\n  // Setup index array.\n  vtkNew<vtkIntArray> index;\n  index->SetNumberOfComponents(1);\n  index->SetName(\"index\");\n  index->InsertNextValue(0);\n  index->InsertNextValue(1);\n  index->InsertNextValue(2);\n\n  // Add points, cells and index array to a polydata.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetPolys(triangles);\n  polydata->GetCellData()->AddArray(index);\n\n  std::cout << \"There are \" << polydata->GetNumberOfCells()\n            << \" cells before thresholding.\" << std::endl;\n\n  vtkNew<vtkThreshold> threshold;\n  threshold->SetInputData(polydata);\n  threshold->SetLowerThreshold(1);\n  threshold->SetThresholdFunction(vtkThreshold::THRESHOLD_LOWER);\n  // Doesn't work because the array is not added as SCALARS, i.e. via SetScalars\n  // threshold->SetInputArrayToProcess(0, 0, 0,\n  // vtkDataObject::FIELD_ASSOCIATION_CELLS, vtkDataSetAttributes::SCALARS); use\n  // like this:\n  threshold->SetInputArrayToProcess(\n      0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, \"index\");\n  threshold->Update();\n\n  vtkUnstructuredGrid* thresholdedPolydata = threshold->GetOutput();\n  std::cout << \"There are \" << thresholdedPolydata->GetNumberOfCells()\n            << \" cells after thresholding.\" << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ThresholdCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ThresholdCells)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ThresholdCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ThresholdCells MACOSX_BUNDLE ThresholdCells.cxx )\n  target_link_libraries(ThresholdCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ThresholdCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ThresholdCells/#download-and-build-thresholdcells","title":"Download and Build ThresholdCells","text":"

Click here to download ThresholdCells and its CMakeLists.txt file. Once the tarball ThresholdCells.tar has been downloaded and extracted,

cd ThresholdCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ThresholdCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/ThresholdPoints/","title":"ThresholdPoints","text":"

vtk-examples/Cxx/PolyData/ThresholdPoints

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/ThresholdPoints/#code","title":"Code","text":"

ThresholdPoints.cxx

#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkThresholdPoints.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(2, 2, 2);\n  points->InsertNextPoint(3, 3, 3);\n  points->InsertNextPoint(4, 4, 4);\n\n  std::cout << \"There are \" << points->GetNumberOfPoints()\n            << \" points before thresholding.\" << std::endl;\n\n  // Setup position index.\n  vtkNew<vtkIntArray> index;\n  index->SetNumberOfComponents(1);\n  index->SetName(\"index\");\n  index->InsertNextValue(0);\n  index->InsertNextValue(1);\n  index->InsertNextValue(2);\n  index->InsertNextValue(3);\n  index->InsertNextValue(4);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->AddArray(index);\n\n  vtkNew<vtkThresholdPoints> threshold;\n  threshold->SetInputData(polydata);\n  threshold->ThresholdByLower(2);\n  threshold->SetInputArrayToProcess(\n      0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, \"index\");\n  threshold->Update();\n\n  // vtkPolyData* thresholdedPolydata = threshold->GetOutput();\n  vtkPolyData* thresholdedPolydata = threshold->GetOutput();\n  std::cout << \"There are \" << thresholdedPolydata->GetNumberOfPoints()\n            << \" points after thresholding.\" << std::endl;\n  for (vtkIdType i = 0; i < thresholdedPolydata->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    thresholdedPolydata->GetPoint(i, p);\n    std::cout << \"Point \" << i << \" : \" << p[0] << \" \" << p[1] << \" \" << p[2]\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/ThresholdPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ThresholdPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ThresholdPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ThresholdPoints MACOSX_BUNDLE ThresholdPoints.cxx )\n  target_link_libraries(ThresholdPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ThresholdPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/ThresholdPoints/#download-and-build-thresholdpoints","title":"Download and Build ThresholdPoints","text":"

Click here to download ThresholdPoints and its CMakeLists.txt file. Once the tarball ThresholdPoints.tar has been downloaded and extracted,

cd ThresholdPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ThresholdPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/TransformFilter/","title":"TransformFilter","text":"

vtk-examples/Cxx/PolyData/TransformFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/TransformFilter/#description","title":"Description","text":"

This example stretches an arrow.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/TransformFilter/#code","title":"Code","text":"

TransformFilter.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n\n  vtkNew<vtkTransform> transform;\n  transform->Scale(5, 1, 1);\n\n  vtkNew<vtkTransformFilter> transformFilter;\n  transformFilter->SetInputConnection(arrowSource->GetOutputPort());\n  transformFilter->SetTransform(transform);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(transformFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Coral\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TransformFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/TransformFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformFilter MACOSX_BUNDLE TransformFilter.cxx )\n  target_link_libraries(TransformFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/TransformFilter/#download-and-build-transformfilter","title":"Download and Build TransformFilter","text":"

Click here to download TransformFilter and its CMakeLists.txt file. Once the tarball TransformFilter.tar has been downloaded and extracted,

cd TransformFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TransformFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/TransformOrderDemo/","title":"TransformOrderDemo","text":"

vtk-examples/Cxx/PolyData/TransformOrderDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/TransformOrderDemo/#description","title":"Description","text":"

This example creates an image. In the left viewport, it translates the image, then translates and rotates the image. In the right viewport, it rotates the image, then rotates and translates the image. One can see that the result is clearly not the same!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/TransformOrderDemo/#code","title":"Code","text":"

TransformOrderDemo.cxx

#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> actor1a;\n  actor1a->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n  vtkNew<vtkImageActor> actor1b;\n  actor1b->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> actor2a;\n  actor2a->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> actor2b;\n  actor2b->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Create the transformation\n  vtkNew<vtkTransform> transform1a;\n  transform1a->PostMultiply();\n  transform1a->Translate(10.0, 0.0, 0.0);\n  actor1a->SetUserTransform(transform1a);\n\n  vtkNew<vtkTransform> transform1b;\n  transform1b->PostMultiply();\n  transform1b->Translate(10.0, 0.0, 0.0);\n  transform1b->RotateZ(40.0);\n  actor1b->SetUserTransform(transform1b);\n\n  vtkNew<vtkTransform> transform2a;\n  transform2a->PostMultiply();\n  transform2a->RotateZ(40.0);\n  actor2a->SetUserTransform(transform2a);\n\n  vtkNew<vtkTransform> transform2b;\n  transform2b->PostMultiply();\n  transform2b->RotateZ(40.0);\n  transform2b->Translate(10.0, 0.0, 0.0);\n  actor2b->SetUserTransform(transform2b);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Cetup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 640);\n  renderWindow->SetWindowName(\"TransformOrderDemo\");\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // an interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkAxesActor> axes;\n  axes->AxisLabelsOff();\n  axes->SetTotalLength(5, 5, 5);\n\n  vtkCamera* camera;\n  camera = leftRenderer->GetActiveCamera();\n  leftRenderer->AddActor(axes);\n  leftRenderer->AddActor(actor1a);\n  leftRenderer->AddActor(actor1b);\n\n  rightRenderer->AddActor(axes);\n  rightRenderer->AddActor(actor2a);\n  rightRenderer->AddActor(actor2b);\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->ResetCamera();\n  // rightRenderer->ResetCamera();\n  camera->Zoom(1.3);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/TransformOrderDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformOrderDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformOrderDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformOrderDemo MACOSX_BUNDLE TransformOrderDemo.cxx )\n  target_link_libraries(TransformOrderDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformOrderDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/TransformOrderDemo/#download-and-build-transformorderdemo","title":"Download and Build TransformOrderDemo","text":"

Click here to download TransformOrderDemo and its CMakeLists.txt file. Once the tarball TransformOrderDemo.tar has been downloaded and extracted,

cd TransformOrderDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TransformOrderDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/TransformPipeline/","title":"TransformPipeline","text":"

vtk-examples/Cxx/PolyData/TransformPipeline

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/TransformPipeline/#description","title":"Description","text":"

This example demonstrates how to connect a transformation for keeping the coordinates one actor relative to another. I used a robotic arm because it's good example used originally by James D. Foley in book: Computer Graphics: Principles and Practice in C. Someone who read this book may want to know how to make it in VTK.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/TransformPipeline/#code","title":"Code","text":"

TransformPipeline.cxx

// This example describes the transformation pipeline. Robotic arm was used to\n// demonstrate an example.\n#include <vtkActor.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"Robotic Arm\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // arm\n  vtkNew<vtkCylinderSource> arm;\n  arm->SetRadius(8);\n  arm->SetHeight(20);\n  arm->SetResolution(20);\n\n  vtkNew<vtkPolyDataMapper> armMapper;\n  armMapper->SetInputConnection(arm->GetOutputPort());\n\n  vtkNew<vtkTransform> armTransform;\n\n  vtkNew<vtkActor> armActor;\n  armActor->SetUserTransform(armTransform);\n  armActor->SetMapper(armMapper);\n  armActor->GetProperty()->SetColor(colors->GetColor3d(\"SandyBrown\").GetData());\n\n  // forearm\n  vtkNew<vtkCylinderSource> forearm;\n  forearm->SetRadius(6);\n  forearm->SetHeight(15);\n  forearm->SetResolution(20);\n  forearm->SetCenter(*(arm->GetCenter()),\n                     *(arm->GetCenter() + 1) + forearm->GetHeight(),\n                     *(arm->GetCenter() + 2));\n\n  vtkNew<vtkPolyDataMapper> forearmMapper;\n  forearmMapper->SetInputConnection(forearm->GetOutputPort());\n\n  vtkNew<vtkTransform> forearmTransform;\n  forearmTransform->SetInput(armTransform);\n\n  vtkNew<vtkActor> forearmActor;\n  forearmActor->SetUserTransform(forearmTransform);\n  forearmActor->SetMapper(forearmMapper);\n  forearmActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"RoyalBLue\").GetData());\n\n  // hand\n  vtkNew<vtkCylinderSource> hand;\n  hand->SetRadius(4);\n  hand->SetHeight(10);\n  hand->SetResolution(20);\n  hand->SetCenter(*(forearm->GetCenter()),\n                  *(forearm->GetCenter() + 1) + hand->GetHeight(),\n                  *(forearm->GetCenter() + 2));\n\n  vtkNew<vtkPolyDataMapper> handMapper;\n  handMapper->SetInputConnection(hand->GetOutputPort());\n\n  vtkNew<vtkTransform> handTransform;\n  handTransform->SetInput(forearmTransform);\n\n  vtkNew<vtkActor> handActor;\n  handActor->SetUserTransform(handTransform);\n  handActor->SetMapper(handMapper);\n  handActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"GreenYellow\").GetData());\n\n  ren1->AddActor(armActor);\n  ren1->AddActor(forearmActor);\n  ren1->AddActor(handActor);\n\n  renWin->Render();\n\n  // execution of robot arm motion\n  for (int i = 0; i < 45; i++)\n  {\n    armTransform->Identity();\n    armTransform->RotateZ(-i);\n    renWin->Render();\n  }\n  // execution of robot forearm motion\n  for (int i = 0; i < 45; i++)\n  {\n    forearmTransform->Identity();\n    forearmTransform->RotateZ(i);\n    renWin->Render();\n  }\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/TransformPipeline/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformPipeline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformPipeline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformPipeline MACOSX_BUNDLE TransformPipeline.cxx )\n  target_link_libraries(TransformPipeline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformPipeline\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/TransformPipeline/#download-and-build-transformpipeline","title":"Download and Build TransformPipeline","text":"

Click here to download TransformPipeline and its CMakeLists.txt file. Once the tarball TransformPipeline.tar has been downloaded and extracted,

cd TransformPipeline/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TransformPipeline\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/TriangleArea/","title":"TriangleArea","text":"

vtk-examples/Cxx/PolyData/TriangleArea

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/TriangleArea/#code","title":"Code","text":"

TriangleArea.cxx

#include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkTriangle.h>\n\nint main(int, char*[])\n{\n  // setup points (geometry)\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // create a triangle on the three points in the polydata\n  vtkNew<vtkTriangle> triangle1;\n  triangle1->GetPointIds()->SetId(0, 0);\n  triangle1->GetPointIds()->SetId(1, 1);\n  triangle1->GetPointIds()->SetId(2, 2);\n\n  vtkNew<vtkTriangle> triangle2;\n  triangle2->GetPointIds()->SetId(0, 2);\n  triangle2->GetPointIds()->SetId(1, 3);\n  triangle2->GetPointIds()->SetId(2, 0);\n\n  // add the triangles to the list of triangles\n  vtkNew<vtkCellArray> triangles;\n  triangles->InsertNextCell(triangle1);\n  triangles->InsertNextCell(triangle2);\n\n  // create a polydata object\n  vtkNew<vtkPolyData> polydata;\n\n  // add the geometry and topology to the polydata\n  polydata->SetPoints(points);\n  polydata->SetPolys(triangles);\n\n  for (vtkIdType i = 0; i < polydata->GetNumberOfCells(); i++)\n  {\n    vtkCell* cell = polydata->GetCell(0);\n\n    vtkTriangle* triangle = dynamic_cast<vtkTriangle*>(cell);\n    double p0[3];\n    double p1[3];\n    double p2[3];\n    triangle->GetPoints()->GetPoint(0, p0);\n    std::cout << \"p0: \" << p0[0] << \" \" << p0[1] << \" \" << p0[2] << std::endl;\n    triangle->GetPoints()->GetPoint(1, p1);\n    std::cout << \"p1: \" << p1[0] << \" \" << p1[1] << \" \" << p1[2] << std::endl;\n    triangle->GetPoints()->GetPoint(2, p2);\n    std::cout << \"p2: \" << p2[0] << \" \" << p2[1] << \" \" << p2[2] << std::endl;\n\n    double area = vtkTriangle::TriangleArea(p0, p1, p2);\n\n    std::cout << \"area of triangle \" << i << \": \" << area << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/TriangleArea/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TriangleArea)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TriangleArea: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TriangleArea MACOSX_BUNDLE TriangleArea.cxx )\n  target_link_libraries(TriangleArea PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TriangleArea\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/TriangleArea/#download-and-build-trianglearea","title":"Download and Build TriangleArea","text":"

Click here to download TriangleArea and its CMakeLists.txt file. Once the tarball TriangleArea.tar has been downloaded and extracted,

cd TriangleArea/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TriangleArea\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/TriangleColoredPoints/","title":"TriangleColoredPoints","text":"

vtk-examples/Cxx/PolyData/TriangleColoredPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/TriangleColoredPoints/#description","title":"Description","text":"

This example shows how by adding a color to each vertex of a triangle, the triangle's color will be smoothly varying between the colors of the vertices.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/TriangleColoredPoints/#code","title":"Code","text":"

TriangleColoredPoints.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangle.h>\n#include <vtkUnsignedCharArray.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> nc;\n\n  // Setup points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Define some colors.\n  unsigned char red[3] = {255, 0, 0};\n  unsigned char green[3] = {0, 255, 0};\n  unsigned char blue[3] = {0, 0, 255};\n\n  // Setup the colors array.\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n\n  // Add the three colors we have created to the array.\n  colors->InsertNextTupleValue(red);\n  colors->InsertNextTupleValue(green);\n  colors->InsertNextTupleValue(blue);\n\n  // Create a triangle.\n  vtkNew<vtkCellArray> triangles;\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n  triangles->InsertNextCell(triangle);\n\n  // Create a polydata object and add everything to it.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetPolys(triangles);\n  polydata->GetPointData()->SetScalars(colors);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TriangleColoredPoints\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(nc->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/TriangleColoredPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TriangleColoredPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TriangleColoredPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TriangleColoredPoints MACOSX_BUNDLE TriangleColoredPoints.cxx )\n  target_link_libraries(TriangleColoredPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TriangleColoredPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/TriangleColoredPoints/#download-and-build-trianglecoloredpoints","title":"Download and Build TriangleColoredPoints","text":"

Click here to download TriangleColoredPoints and its CMakeLists.txt file. Once the tarball TriangleColoredPoints.tar has been downloaded and extracted,

cd TriangleColoredPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TriangleColoredPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/TriangleSolidColor/","title":"TriangleSolidColor","text":"

vtk-examples/Cxx/PolyData/TriangleSolidColor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/TriangleSolidColor/#code","title":"Code","text":"

TriangleSolidColor.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangle.h>\n#include <vtkUnsignedCharArray.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> nc;\n\n  // Setup points.\n  vtkNew<vtkPoints> points;\n  // vtkNew<vtkCellArray> vertices;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n  // Pick a color\n  colors->InsertNextTupleValue(nc->GetColor3ub(\"LightSeaGreen\").GetData());\n\n  vtkNew<vtkCellArray> triangles;\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n  triangles->InsertNextCell(triangle);\n\n  vtkNew<vtkPolyData> polydata;\n\n  polydata->SetPoints(points);\n  polydata->SetPolys(triangles);\n  polydata->GetCellData()->SetScalars(colors);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TriangleSolidColor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(nc->GetColor3d(\"SlateGray\").GetData());\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/TriangleSolidColor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TriangleSolidColor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TriangleSolidColor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TriangleSolidColor MACOSX_BUNDLE TriangleSolidColor.cxx )\n  target_link_libraries(TriangleSolidColor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TriangleSolidColor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/TriangleSolidColor/#download-and-build-trianglesolidcolor","title":"Download and Build TriangleSolidColor","text":"

Click here to download TriangleSolidColor and its CMakeLists.txt file. Once the tarball TriangleSolidColor.tar has been downloaded and extracted,

cd TriangleSolidColor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TriangleSolidColor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/TubeFilter/","title":"TubeFilter","text":"

vtk-examples/Cxx/PolyData/TubeFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/TubeFilter/#description","title":"Description","text":"

This example creates a tube around a line. This is helpful because when you zoom the camera, the thickness of a line remains constant, while the thickness of a tube varies.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/TubeFilter/#code","title":"Code","text":"

TubeFilter.cxx

#include <vtkActor.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n\n/*\n * This example creates a tube around a line.\n * This is helpful because when you zoom the camera,\n * the thickness of a line remains constant,\n * while the thickness of a tube varies.\n * */\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n  // Create a line.\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(1.0, 0.0, 0.0);\n  lineSource->SetPoint2(0.0, 1.0, 0.0);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(lineSource->GetOutputPort());\n  vtkNew<vtkActor> lineActor;\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  lineActor->SetMapper(lineMapper);\n\n  // Create a tube (cylinder) around the line.\n  vtkNew<vtkTubeFilter> tubeFilter;\n  tubeFilter->SetInputConnection(lineSource->GetOutputPort());\n  tubeFilter->SetRadius(.025); // default is .5\n  tubeFilter->SetNumberOfSides(50);\n  tubeFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> tubeMapper;\n  tubeMapper->SetInputConnection(tubeFilter->GetOutputPort());\n  vtkNew<vtkActor> tubeActor;\n  tubeActor->GetProperty()->SetOpacity(\n      0.5); // Make the tube have some transparency.\n  tubeActor->SetMapper(tubeMapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TubeFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(tubeActor);\n  renderer->AddActor(lineActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/TubeFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TubeFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TubeFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TubeFilter MACOSX_BUNDLE TubeFilter.cxx )\n  target_link_libraries(TubeFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TubeFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/TubeFilter/#download-and-build-tubefilter","title":"Download and Build TubeFilter","text":"

Click here to download TubeFilter and its CMakeLists.txt file. Once the tarball TubeFilter.tar has been downloaded and extracted,

cd TubeFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TubeFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/VertexConnectivity/","title":"VertexConnectivity","text":"

vtk-examples/Cxx/PolyData/VertexConnectivity

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/VertexConnectivity/#description","title":"Description","text":"

The input must be only edges (i.e. vtkExtractEdges must be run).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/VertexConnectivity/#code","title":"Code","text":"

VertexConnectivity.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractEdges.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdList.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <iostream>\n#include <string>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nnamespace {\n\nvtkSmartPointer<vtkIdList> GetConnectedVertices(vtkPolyData* mesh, int id);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(sphereSource->GetOutputPort());\n  triangleFilter->Update();\n\n  vtkNew<vtkExtractEdges> extractEdges;\n  extractEdges->SetInputConnection(triangleFilter->GetOutputPort());\n  extractEdges->Update();\n\n  vtkSmartPointer<vtkPolyData> mesh = extractEdges->GetOutput();\n\n  vtkSmartPointer<vtkIdList> connectedVertices = GetConnectedVertices(mesh, 0);\n\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  std::cout << \"Connected vertices: \";\n  for (vtkIdType i = 0; i < connectedVertices->GetNumberOfIds(); i++)\n  {\n    std::cout << connectedVertices->GetId(i) << \" \";\n    ids->InsertNextValue(connectedVertices->GetId(i));\n  }\n  std::cout << std::endl;\n\n  vtkNew<vtkDataSetMapper> connectedVertexMapper;\n\n  {\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::POINT);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n\n    extractSelection->SetInputConnection(0, extractEdges->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    vtkNew<vtkVertexGlyphFilter> glyphFilter;\n    glyphFilter->SetInputConnection(extractSelection->GetOutputPort());\n    glyphFilter->Update();\n\n    connectedVertexMapper->SetInputConnection(glyphFilter->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> connectedVertexActor;\n  connectedVertexActor->SetMapper(connectedVertexMapper);\n  connectedVertexActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Red\").GetData());\n  connectedVertexActor->GetProperty()->SetPointSize(5);\n\n  vtkNew<vtkDataSetMapper> queryVertexMapper;\n\n  {\n    vtkNew<vtkIdTypeArray> ids2;\n    ids2->SetNumberOfComponents(1);\n    ids2->InsertNextValue(0);\n\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::POINT);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids2);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n\n    extractSelection->SetInputConnection(0, extractEdges->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    vtkNew<vtkVertexGlyphFilter> glyphFilter;\n    glyphFilter->SetInputConnection(extractSelection->GetOutputPort());\n    glyphFilter->Update();\n\n    queryVertexMapper->SetInputConnection(glyphFilter->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> queryVertexActor;\n  queryVertexActor->SetMapper(queryVertexMapper);\n  queryVertexActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Lime\").GetData());\n  queryVertexActor->GetProperty()->SetPointSize(5);\n\n  vtkNew<vtkDataSetMapper> sphereMapper;\n  sphereMapper->SetInputConnection(extractEdges->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Snow\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VertexConnectivity\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(queryVertexActor);\n  renderer->AddActor(connectedVertexActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkIdList> GetConnectedVertices(vtkPolyData* mesh, int id)\n{\n  vtkNew<vtkIdList> connectedVertices;\n\n  // Get all cells that vertex 'id' is a part of.\n  vtkNew<vtkIdList> cellIdList;\n  mesh->GetPointCells(id, cellIdList);\n\n  /*\n  cout << \"Vertex 0 is used in cells \";\n  for(vtkIdType i = 0; i < cellIdList->GetNumberOfIds(); i++)\n    {\n    cout << cellIdList->GetId(i) << \", \";\n    }\n  cout << endl;\n  */\n\n  for (vtkIdType i = 0; i < cellIdList->GetNumberOfIds(); i++)\n  {\n    // cout << \"id \" << i << \" : \" << cellIdList->GetId(i) << endl;\n\n    vtkNew<vtkIdList> pointIdList;\n    mesh->GetCellPoints(cellIdList->GetId(i), pointIdList);\n\n    // cout << \"End points are \" << pointIdList->GetId(0) << \" and \" <<\n    // pointIdList->GetId(1) << endl;\n\n    if (pointIdList->GetId(0) != id)\n    {\n      // cout << \"Connected to \" << pointIdList->GetId(0) << endl;\n      connectedVertices->InsertNextId(pointIdList->GetId(0));\n    }\n    else\n    {\n      // cout << \"Connected to \" << pointIdList->GetId(1) << endl;\n      connectedVertices->InsertNextId(pointIdList->GetId(1));\n    }\n  }\n\n  return connectedVertices;\n}\n\n} // namespace\n
"},{"location":"Cxx/PolyData/VertexConnectivity/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VertexConnectivity)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VertexConnectivity: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VertexConnectivity MACOSX_BUNDLE VertexConnectivity.cxx )\n  target_link_libraries(VertexConnectivity PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VertexConnectivity\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/VertexConnectivity/#download-and-build-vertexconnectivity","title":"Download and Build VertexConnectivity","text":"

Click here to download VertexConnectivity and its CMakeLists.txt file. Once the tarball VertexConnectivity.tar has been downloaded and extracted,

cd VertexConnectivity/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VertexConnectivity\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/WarpScalar/","title":"WarpScalar","text":"

vtk-examples/Cxx/PolyData/WarpScalar

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/WarpScalar/#code","title":"Code","text":"

WarpScalar.cxx

#include <vtkActor.h>\n#include <vtkDoubleArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkWarpScalar.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create Scalars.\n  vtkNew<vtkDoubleArray> scalars;\n  int numberOfPoints = sphereSource->GetOutput()->GetNumberOfPoints();\n  scalars->SetNumberOfTuples(numberOfPoints);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  for (vtkIdType i = 0; i < numberOfPoints; ++i)\n  {\n    scalars->SetTuple1(i, randomSequence->GetRangeValue(0.0, 1.0 / 7.0));\n    randomSequence->Next();\n  }\n\n  sphereSource->GetOutput()->GetPointData()->SetScalars(scalars);\n\n  vtkNew<vtkWarpScalar> warpScalar;\n  warpScalar->SetInputConnection(sphereSource->GetOutputPort());\n  warpScalar->SetScaleFactor(1); // Use the scalars themselves.\n\n  // Required for SetNormal to have an effect.\n  warpScalar->UseNormalOn();\n  warpScalar->SetNormal(0, 0, 1);\n\n  warpScalar->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(warpScalar->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WarpScalar\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/WarpScalar/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WarpScalar)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WarpScalar: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WarpScalar MACOSX_BUNDLE WarpScalar.cxx )\n  target_link_libraries(WarpScalar PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WarpScalar\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/WarpScalar/#download-and-build-warpscalar","title":"Download and Build WarpScalar","text":"

Click here to download WarpScalar and its CMakeLists.txt file. Once the tarball WarpScalar.tar has been downloaded and extracted,

cd WarpScalar/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WarpScalar\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/WarpSurface/","title":"WarpSurface","text":"

vtk-examples/Cxx/PolyData/WarpSurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/PolyData/WarpSurface/#description","title":"Description","text":"

The image was produced using src/Testing/Data/cowHead.vtp and a scale of .1.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/WarpSurface/#code","title":"Code","text":"

WarpSurface.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkWarpVector.h>\n#include <vtkXMLPolyDataReader.h>\nint main(int argc, char* argv[])\n{\n  double scale = 1.0;\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  // If a file is provided, use it, otherwise generate a sphere\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]); // e.g. cowHead.vtp\n    reader->Update();\n    inputPolyData = reader->GetOutput();\n    if (argc > 2)\n    {\n      scale = atof(argv[2]);\n    }\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetPhiResolution(15);\n    sphereSource->SetThetaResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkCleanPolyData> clean;\n  clean->SetInputData(inputPolyData);\n\n  // Generate normals\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(clean->GetOutputPort());\n  normals->SplittingOff();\n\n  // Warp using the normals\n  vtkNew<vtkWarpVector> warp;\n  warp->SetInputConnection(normals->GetOutputPort());\n  warp->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS,\n                               vtkDataSetAttributes::NORMALS);\n  warp->SetScaleFactor(scale);\n\n  // Visualize the original and warped models\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(warp->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> warpedActor;\n  warpedActor->SetMapper(mapper);\n  warpedActor->GetProperty()->SetColor(colors->GetColor4d(\"Flesh\").GetData());\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(normals->GetOutputPort());\n  originalMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetInterpolationToFlat();\n  originalActor->GetProperty()->SetColor(colors->GetColor4d(\"Flesh\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"WarpSurface\");\n\n  // Create a camera for all renderers\n  vtkNew<vtkCamera> camera;\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  leftRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornFlower\").GetData());\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->AddActor(originalActor);\n  rightRenderer->AddActor(warpedActor);\n\n  rightRenderer->ResetCamera();\n\n  renderWindow->AddRenderer(rightRenderer);\n  renderWindow->AddRenderer(leftRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/WarpSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WarpSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WarpSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WarpSurface MACOSX_BUNDLE WarpSurface.cxx )\n  target_link_libraries(WarpSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WarpSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/WarpSurface/#download-and-build-warpsurface","title":"Download and Build WarpSurface","text":"

Click here to download WarpSurface and its CMakeLists.txt file. Once the tarball WarpSurface.tar has been downloaded and extracted,

cd WarpSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WarpSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/WarpVector/","title":"WarpVector","text":"

vtk-examples/Cxx/PolyData/WarpVector

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/WarpVector/#code","title":"Code","text":"

WarpVector.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkDoubleArray.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkWarpVector.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(2.0, 0.0, 0.0);\n  points->InsertNextPoint(3.0, 0.0, 0.0);\n  points->InsertNextPoint(4.0, 0.0, 0.0);\n\n  vtkNew<vtkCellArray> lines;\n  vtkNew<vtkLine> line;\n  line->GetPointIds()->SetId(0, 0);\n  line->GetPointIds()->SetId(1, 1);\n  lines->InsertNextCell(line);\n  line->GetPointIds()->SetId(0, 1);\n  line->GetPointIds()->SetId(1, 2);\n  lines->InsertNextCell(line);\n  line->GetPointIds()->SetId(0, 2);\n  line->GetPointIds()->SetId(1, 3);\n  lines->InsertNextCell(line);\n  line->GetPointIds()->SetId(0, 3);\n  line->GetPointIds()->SetId(1, 4);\n  lines->InsertNextCell(line);\n\n  vtkNew<vtkDoubleArray> warpData;\n  warpData->SetNumberOfComponents(3);\n  warpData->SetName(\"warpData\");\n  double warp[3] = {0.0, 0.0, 0.0};\n  warp[1] = 0.0;\n  warpData->InsertNextTuple(warp);\n  warp[1] = 0.1;\n  warpData->InsertNextTuple(warp);\n  warp[1] = 0.3;\n  warpData->InsertNextTuple(warp);\n  warp[1] = 0.0;\n  warpData->InsertNextTuple(warp);\n  warp[1] = 0.1;\n  warpData->InsertNextTuple(warp);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetLines(lines);\n  polydata->GetPointData()->AddArray(warpData);\n  polydata->GetPointData()->SetActiveVectors(warpData->GetName());\n\n  // WarpVector will use the array marked as active vector in polydata\n  // it has to be a 3 component array with the same number of\n  // tuples as points in polydata.\n  vtkNew<vtkWarpVector> warpVector;\n  warpVector->SetInputData(polydata);\n  warpVector->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(warpVector->GetPolyDataOutput());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"cobalt_green\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WarpVector\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/WarpVector/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WarpVector)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WarpVector: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WarpVector MACOSX_BUNDLE WarpVector.cxx )\n  target_link_libraries(WarpVector PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WarpVector\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/WarpVector/#download-and-build-warpvector","title":"Download and Build WarpVector","text":"

Click here to download WarpVector and its CMakeLists.txt file. Once the tarball WarpVector.tar has been downloaded and extracted,

cd WarpVector/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WarpVector\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/PolyData/WeightedTransformFilter/","title":"WeightedTransformFilter","text":"

vtk-examples/Cxx/PolyData/WeightedTransformFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/PolyData/WeightedTransformFilter/#code","title":"Code","text":"

WeightedTransformFilter.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n#include <vtkWeightedTransformFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Use a sphere as a basis of the shape.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(40);\n  sphere->SetThetaResolution(40);\n  sphere->Update();\n\n  vtkPolyData* sphereData = sphere->GetOutput();\n\n  // Create a data array to hold the weighting coefficients.\n  vtkNew<vtkFloatArray> tfarray;\n  vtkIdType npoints = sphereData->GetNumberOfPoints();\n  tfarray->SetNumberOfComponents(2);\n  tfarray->SetNumberOfTuples(npoints);\n\n  // Parameterize the sphere along the z axis, and fill the weights\n  // with (1.0-a, a) to linearly interpolate across the shape.\n  for (int i = 0; i < npoints; i++)\n  {\n    double pt[3];\n    sphereData->GetPoint(i, pt);\n    //    double x = pt[0];\n    //    double y = pt[1];\n    double z = pt[2];\n\n    double zn = z + 0.5;\n    double zn1 = 1.0 - zn;\n    if (zn > 1.0)\n    {\n      zn = 1.0;\n    }\n    if (zn1 < 0.0)\n    {\n      zn1 = 0.0;\n    }\n\n    tfarray->SetComponent(i, 0, zn1);\n    tfarray->SetComponent(i, 1, zn);\n  }\n\n  // Create field data to hold the array, and bind it to the sphere.\n  //  vtkNew<vtkFieldData> fd;\n  tfarray->SetName(\"weights\");\n  sphereData->GetPointData()->AddArray(tfarray);\n\n  // Use an ordinary transform to stretch the shape.\n  vtkNew<vtkTransform> stretch;\n  stretch->Scale(1, 1, 3.2);\n\n  vtkNew<vtkTransformFilter> stretchFilter;\n  stretchFilter->SetInputData(sphereData);\n  stretchFilter->SetTransform(stretch);\n\n  // Now, for the weighted transform stuff.\n  vtkNew<vtkWeightedTransformFilter> weightedTrans;\n\n  // Create two transforms to interpolate between.\n  vtkNew<vtkTransform> identity;\n  identity->Identity();\n\n  vtkNew<vtkTransform> rotated;\n  double rotatedAngle = 45;\n  rotated->RotateX(rotatedAngle);\n\n  weightedTrans->SetNumberOfTransforms(2);\n  weightedTrans->SetTransform(identity, 0);\n  weightedTrans->SetTransform(rotated, 1);\n  // Which data array should the filter use ?\n  weightedTrans->SetWeightArray(\"weights\");\n\n  weightedTrans->SetInputConnection(stretchFilter->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> weightedTransMapper;\n  weightedTransMapper->SetInputConnection(weightedTrans->GetOutputPort());\n  vtkNew<vtkActor> weightedTransActor;\n  weightedTransActor->SetMapper(weightedTransMapper);\n  weightedTransActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  weightedTransActor->GetProperty()->SetRepresentationToSurface();\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WeightedTransformFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(weightedTransActor);\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n  renderWindow->SetSize(300, 300);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(90);\n  renderer->GetActiveCamera()->Dolly(1);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/PolyData/WeightedTransformFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WeightedTransformFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersHybrid\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WeightedTransformFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WeightedTransformFilter MACOSX_BUNDLE WeightedTransformFilter.cxx )\n  target_link_libraries(WeightedTransformFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WeightedTransformFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/PolyData/WeightedTransformFilter/#download-and-build-weightedtransformfilter","title":"Download and Build WeightedTransformFilter","text":"

Click here to download WeightedTransformFilter and its CMakeLists.txt file. Once the tarball WeightedTransformFilter.tar has been downloaded and extracted,

cd WeightedTransformFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WeightedTransformFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Qt/BarChartQt/","title":"BarChartQt","text":"

vtk-examples/Cxx/Qt/BarChartQt

"},{"location":"Cxx/Qt/BarChartQt/#description","title":"Description","text":"

This example shows how to create a Bar Chart.

Also see the BarChart example.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/BarChartQt/#code","title":"Code","text":"

BarChartQt.cxx

#include \"BarChartQt.h\"\n#include \"ui_BarChartQt.h\"\n\n#include <vtkAxis.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkTextProperty.h>\n#include <vtkVersion.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n#if VTK_VERSION_NUMBER >= 90000000000ULL\n#define VTK900 1\n#endif\n\nnamespace {\n// Monthly circulation data.\nint data_2008[] = {10822, 10941, 9979,  10370, 9460, 11228,\n                   15093, 12231, 10160, 9816,  9384, 7892};\nint data_2009[] = {9058,  9474,  9979,  9408, 8900, 11569,\n                   14688, 12231, 10294, 9585, 8957, 8590};\nint data_2010[] = {9058,  10941, 9979,  10270, 8900, 11228,\n                   14688, 12231, 10160, 9585,  9384, 8590};\n} // namespace\n\n// Constructor\nBarChartQt::BarChartQt(QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::BarChartQt)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;\n#if VTK890\n  this->ui->qvtkWidget->setRenderWindow(renderWindow);\n#else\n  this->ui->qvtkWidget->SetRenderWindow(renderWindow);\n#endif\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Seashell\");\n  vtkColor3d axisColor = colors->GetColor3d(\"Black\");\n  vtkColor3d titleColor = colors->GetColor3d(\"MidnightBlue\");\n\n  vtkNew<vtkChartXY> chart;\n\n  // Set various properties.\n  vtkAxis* xAxis = chart->GetAxis(vtkAxis::BOTTOM);\n  xAxis->SetTitle(\"Monthly\");\n  xAxis->GetTitleProperties()->SetColor(axisColor.GetData());\n  xAxis->GetTitleProperties()->SetFontSize(16);\n  xAxis->GetTitleProperties()->ItalicOn();\n  xAxis->GetLabelProperties()->SetColor(axisColor.GetData());\n  xAxis->SetGridVisible(true);\n  xAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"Black\"));\n\n  vtkAxis* yAxis = chart->GetAxis(vtkAxis::LEFT);\n  yAxis->SetTitle(\"Circulation\");\n  yAxis->GetTitleProperties()->SetColor(axisColor.GetData());\n  yAxis->GetTitleProperties()->SetFontSize(16);\n  yAxis->GetTitleProperties()->ItalicOn();\n  yAxis->GetLabelProperties()->SetColor(axisColor.GetData());\n  yAxis->SetGridVisible(true);\n  yAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"Black\"));\n\n  chart->SetTitle(\"Circulation 2008, 2009, 2010\");\n  chart->GetTitleProperties()->SetFontSize(24);\n  chart->GetTitleProperties()->SetColor(titleColor.GetData());\n  chart->GetTitleProperties()->BoldOn();\n\n  // Set up a 2D scene, add an XY chart to it\n  vtkNew<vtkContextView> view;\n  view->SetRenderWindow(renderWindow);\n  view->GetRenderer()->SetBackground(backgroundColor.GetData());\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkIntArray> arrMonth;\n  arrMonth->SetName(\"Month\");\n  table->AddColumn(arrMonth);\n\n  vtkNew<vtkIntArray> arr2008;\n  arr2008->SetName(\"2008\");\n  table->AddColumn(arr2008);\n\n  vtkNew<vtkIntArray> arr2009;\n  arr2009->SetName(\"2009\");\n  table->AddColumn(arr2009);\n\n  vtkNew<vtkIntArray> arr2010;\n  arr2010->SetName(\"2010\");\n  table->AddColumn(arr2010);\n\n  table->SetNumberOfRows(12);\n  for (int i = 0; i < 12; i++)\n  {\n    table->SetValue(i, 0, i + 1);\n    table->SetValue(i, 1, data_2008[i]);\n    table->SetValue(i, 2, data_2009[i]);\n    table->SetValue(i, 3, data_2010[i]);\n  }\n\n  // Add multiple line plots, setting the colors etc.\n  vtkPlot* line = 0;\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetInputData(table, 0, 1);\n  auto rgba = colors->GetColor4ub(\"YellowGreen\");\n  line->SetColor(rgba[0], rgba[1], rgba[2], rgba[3]);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetInputData(table, 0, 2);\n  rgba = colors->GetColor4ub(\"Salmon\");\n  line->SetColor(rgba[0], rgba[1], rgba[2], rgba[3]);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetInputData(table, 0, 3);\n  rgba = colors->GetColor4ub(\"CornflowerBlue\");\n  line->SetColor(rgba[0], rgba[1], rgba[2], rgba[3]);\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n\n#if !defined(VTK900)\n  view->SetInteractor(this->ui->qvtkWidget->GetInteractor());\n#endif\n  // VTK/Qt wedded\n#if VTK890\n  this->ui->qvtkWidget->setRenderWindow(view->GetRenderWindow());\n#else\n  this->ui->qvtkWidget->SetRenderWindow(view->GetRenderWindow());\n#endif\n\n  // Set up action signals and slots.\n  connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));\n}\n\nBarChartQt::~BarChartQt()\n{\n  delete this->ui;\n}\n\nvoid BarChartQt::slotExit()\n{\n  std::cout << \"Exiting\" << std::endl;\n  qApp->exit();\n}\n

BarChartQtDriver.cxx

#include <QApplication>\n#include <QSurfaceFormat>\n\n#include <QVTKOpenGLNativeWidget.h>\n\n#include \"BarChartQt.h\"\n\nint main(int argc, char** argv)\n{\n  // Needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  // QT Stuff\n  QApplication app(argc, argv);\n\n  BarChartQt BarChartQt;\n  BarChartQt.show();\n\n  return app.exec();\n}\n

BarChartQt.h

#ifndef BarChartQt_H\n#define BarChartQt_H\n\n#include <QMainWindow>\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass BarChartQt;\n}\n\nclass BarChartQt : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  // Constructor/Destructor\n  explicit BarChartQt(QWidget* parent = nullptr);\n  virtual ~BarChartQt();\n\npublic slots:\n\n  void slotExit();\n\nprivate:\n  // Designer form\n  Ui::BarChartQt* ui;\n};\n\n#endif\n

BarChartQt.ui

<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>BarChartQt</class>\n <widget class=\"QMainWindow\" name=\"BarChartQt\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n     <width>660</width>\n     <height>520</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>BarChartQt</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidget\">\n    <property name=\"geometry\">\n     <rect>\n      <x>10</x>\n      <y>20</y>\n      <width>640</width>\n      <height>480</height>\n     </rect>\n    </property>\n   </widget>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources>\n\n </resources>\n <connections/>\n</ui>\n
"},{"location":"Cxx/Qt/BarChartQt/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(BarChartQt)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"BarChartQt: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"BarChartQt: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(BarChartQt MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(BarChartQt ${qt_components})\nelse()\n  target_link_libraries(BarChartQt ${qt_modules})\nendif()\ntarget_link_libraries(BarChartQt ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BarChartQt\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/BarChartQt/#download-and-build-barchartqt","title":"Download and Build BarChartQt","text":"

Click here to download BarChartQt and its CMakeLists.txt file. Once the tarball BarChartQt.tar has been downloaded and extracted,

 cd BarChartQt/build\n

This example requires Qt and VTK.

If VTK and Qt are installed:

 cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

 cmake -DVTK_DIR=/home/me/vtk_build ..\n

If Qt is not found on your system, you will need to tell CMake where to find qmake:

cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

Build the project:

make\n

and run it:

./BarChartQt\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

"},{"location":"Cxx/Qt/BorderWidgetQt/","title":"BorderWidgetQt","text":"

vtk-examples/Cxx/Qt/BorderWidgetQt

"},{"location":"Cxx/Qt/BorderWidgetQt/#description","title":"Description","text":"

This example draws a border around a region selected with the mouse. Note that the default border color is white - so if you have a white background you will not see anything!

Also see the BorderWidget example.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/BorderWidgetQt/#code","title":"Code","text":"

BorderWidgetQt.cxx

#include \"BorderWidgetQt.h\"\n#include \"ui_BorderWidgetQt.h\"\n\n#include <vtkBorderRepresentation.h>\n#include <vtkBorderWidget.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n#include <vtkWidgetCallbackMapper.h>\n#include <vtkWidgetEvent.h>\n\n#include <iostream>\n#include <string>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\nnamespace {\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n\nclass vtkCustomBorderWidget : public vtkBorderWidget\n{\npublic:\n  static vtkCustomBorderWidget* New();\n  vtkTypeMacro(vtkCustomBorderWidget, vtkBorderWidget);\n\n  static void EndSelectAction(vtkAbstractWidget* w);\n\n  vtkCustomBorderWidget();\n};\n\nvtkStandardNewMacro(vtkCustomBorderWidget);\n\n} // namespace\n\n// Constructor\nBorderWidgetQt::BorderWidgetQt(QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::BorderWidgetQt)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;\n#if VTK890\n  this->ui->qvtkWidget->setRenderWindow(renderWindow);\n#else\n  this->ui->qvtkWidget->SetRenderWindow(renderWindow);\n#endif\n\n  auto lut = GetPlatonicLUT();\n\n  vtkNew<vtkPlatonicSolidSource> source;\n  source->SetSolidTypeToDodecahedron();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, 19);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->GetActiveCamera()->Elevation(30.0);\n  renderer->GetActiveCamera()->Azimuth(180.0);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Connect VTK with Qt.\n#if VTK890\n  this->ui->qvtkWidget->renderWindow()->AddRenderer(renderer);\n#else\n  this->ui->qvtkWidget->GetRenderWindow()->AddRenderer(renderer);\n#endif\n\n  // Add a border widget to the renderer.\n  this->BorderWidget = vtkNew<vtkCustomBorderWidget>();\n#if VTK890\n  this->BorderWidget->SetInteractor(this->ui->qvtkWidget->interactor());\n#else\n  this->borderWidget->SetInteractor(this->ui->qvtkWidget->GetInteractor());\n#endif\n  this->BorderWidget->CreateDefaultRepresentation();\n  this->BorderWidget->SelectableOff();\n  this->BorderWidget->On();\n}\n\nBorderWidgetQt::~BorderWidgetQt()\n{\n  delete this->ui;\n}\n\nnamespace {\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\nvtkCustomBorderWidget::vtkCustomBorderWidget()\n{\n  this->CallbackMapper->SetCallbackMethod(\n      vtkCommand::MiddleButtonReleaseEvent, vtkWidgetEvent::EndSelect, this,\n      vtkCustomBorderWidget::EndSelectAction);\n}\n\nvoid vtkCustomBorderWidget::EndSelectAction(vtkAbstractWidget* w)\n{\n  vtkBorderWidget* borderWidget = dynamic_cast<vtkBorderWidget*>(w);\n\n  // Get the actual box coordinates/planes.\n  // vtkNew<vtkPolyData> polydata;\n\n  // Get the bottom left corner.\n  auto lowerLeft =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPosition();\n  std::cout << \"Lower left: \" << lowerLeft[0] << \" \" << lowerLeft[1]\n            << std::endl;\n\n  auto upperRight =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPosition2();\n  std::cout << \"Upper right: \" << lowerLeft[0] + upperRight[0] << \" \"\n            << lowerLeft[1] + upperRight[1] << std::endl;\n\n  vtkBorderWidget::EndSelectAction(w);\n}\n\n} // namespace\n

BorderWidgetQt.ui

<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>BorderWidgetQt</class>\n <widget class=\"QMainWindow\" name=\"BorderWidgetQt\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>572</width>\n    <height>583</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>BorderWidgetQt</string>\n  </property>\n  <property name=\"windowIcon\">\n   <iconset resource=\"Icons/icons.qrc\">\n    <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n  </property>\n  <property name=\"iconSize\">\n   <size>\n    <width>22</width>\n    <height>22</height>\n   </size>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidget\" native=\"true\">\n    <property name=\"geometry\">\n     <rect>\n      <x>10</x>\n      <y>20</y>\n      <width>511</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/fileopen.png</normaloff>:/Icons/fileopen.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"icon\">\n    <iconset>\n     <normaloff/>\n    </iconset>\n   </property>\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/print.png</normaloff>:/Icons/print.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/filesave.png</normaloff>:/Icons/filesave.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources>\n  <include location=\"Icons/icons.qrc\"/>\n </resources>\n <connections/>\n</ui>\n

BorderWidgetQtDriver.cxx

#include <QApplication>\n#include <QSurfaceFormat>\n#include <QVTKOpenGLNativeWidget.h>\n\n#include \"BorderWidgetQt.h\"\n\nint main(int argc, char* argv[])\n{\n  // needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  QApplication app(argc, argv);\n\n  BorderWidgetQt borderWidgetQt;\n  borderWidgetQt.show();\n\n  return app.exec();\n}\n

BorderWidgetQt.h

#ifndef BorderWidgetQt_H\n#define BorderWidgetQt_H\n\n#include <QMainWindow>\n#include <vtkSmartPointer.h>\n\nclass vtkBorderWidget;\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass BorderWidgetQt;\n}\n\nclass BorderWidgetQt : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  // Constructor/Destructor\n  explicit BorderWidgetQt(QWidget* parent = nullptr);\n  virtual ~BorderWidgetQt();\n\nprivate:\n  vtkSmartPointer<vtkBorderWidget> BorderWidget;\n  // Designer form\n  Ui::BorderWidgetQt* ui;\n};\n\n#endif\n
"},{"location":"Cxx/Qt/BorderWidgetQt/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(BorderWidgetQt)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"BorderWidgetQt: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"BorderWidgetQt: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(BorderWidgetQt MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(BorderWidgetQt ${qt_components})\nelse()\n  target_link_libraries(BorderWidgetQt ${qt_modules})\nendif()\ntarget_link_libraries(BorderWidgetQt ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BorderWidgetQt\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/BorderWidgetQt/#download-and-build-borderwidgetqt","title":"Download and Build BorderWidgetQt","text":"

Click here to download BorderWidgetQt and its CMakeLists.txt file. Once the tarball BorderWidgetQt.tar has been downloaded and extracted,

 cd BorderWidgetQt/build\n

This example requires Qt and VTK.

If VTK and Qt are installed:

 cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

 cmake -DVTK_DIR=/home/me/vtk_build ..\n

If Qt is not found on your system, you will need to tell CMake where to find qmake:

cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

Build the project:

make\n

and run it:

./BorderWidgetQt\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

"},{"location":"Cxx/Qt/EventQtSlotConnect/","title":"EventQtSlotConnect","text":"

vtk-examples/Cxx/Qt/EventQtSlotConnect

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/EventQtSlotConnect/#code","title":"Code","text":"

EventQtSlotConnect.cxx

#include \"EventQtSlotConnect.h\"\n#include \"ui_EventQtSlotConnect.h\"\n\n#include <vtkEventQtSlotConnect.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n#include <iostream>\n#include <string>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\nnamespace {\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n} // namespace\n\n// Constructor\nEventQtSlotConnect::EventQtSlotConnect(QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::EventQtSlotConnect)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;\n#if VTK890\n  this->ui->qvtkWidget->setRenderWindow(renderWindow);\n#else\n  this->ui->qvtkWidget->SetRenderWindow(renderWindow);\n#endif\n\n  vtkNew<vtkEventQtSlotConnect> slotConnector;\n  this->Connections = slotConnector;\n\n  auto lut = GetPlatonicLUT();\n\n  vtkNew<vtkPlatonicSolidSource> source;\n  source->SetSolidTypeToOctahedron();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, 19);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n#if VTK890\n  this->ui->qvtkWidget->renderWindow()->AddRenderer(renderer);\n#else\n  this->ui->qvtkWidget->GetRenderWindow()->AddRenderer(renderer);\n#endif\n\n#if VTK890\n  this->Connections->Connect(\n      this->ui->qvtkWidget->renderWindow()->GetInteractor(),\n      vtkCommand::LeftButtonPressEvent, this,\n      SLOT(slot_clicked(vtkObject*, unsigned long, void*, void*)));\n#else\n  this->Connections->Connect(\n      this->qvtkWidget->GetRenderWindow()->GetInteractor(),\n      vtkCommand::LeftButtonPressEvent, this,\n      SLOT(slot_clicked(vtkObject*, unsigned long, void*, void*)));\n#endif\n};\n\nEventQtSlotConnect::~EventQtSlotConnect()\n{\n  delete this->ui;\n}\n\nvoid EventQtSlotConnect::slot_clicked(vtkObject*, unsigned long, void*, void*)\n{\n  std::cout << \"Clicked.\" << std::endl;\n}\n\nnamespace {\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\n} // namespace\n

EventQtSlotConnect.ui

<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>EventQtSlotConnect</class>\n <widget class=\"QMainWindow\" name=\"EventQtSlotConnect\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>561</width>\n    <height>575</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>EventQtSlotConnect</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\n    <item>\n     <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidget\">\n      <property name=\"sizePolicy\">\n       <sizepolicy hsizetype=\"Expanding\" vsizetype=\"MinimumExpanding\">\n        <horstretch>0</horstretch>\n        <verstretch>0</verstretch>\n       </sizepolicy>\n      </property>\n     </widget>\n    </item>\n   </layout>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources/>\n <connections/>\n</ui>\n

EventQtSlotConnect.h

#ifndef EventQtSlotConnect_H\n#define EventQtSlotConnect_H\n\n#include <QMainWindow>\n\n#include <vtkObject.h>\n#include <vtkSmartPointer.h>\n\n// Forward class declarations\nclass vtkEventQtSlotConnect;\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass EventQtSlotConnect;\n}\n\nclass EventQtSlotConnect : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  explicit EventQtSlotConnect(QWidget* parent = nullptr);\n  virtual ~EventQtSlotConnect();\n\npublic slots:\n\n  void slot_clicked(vtkObject*, unsigned long, void*, void*);\n\nprivate:\n  vtkSmartPointer<vtkEventQtSlotConnect> Connections;\n  // Designer form\n  Ui::EventQtSlotConnect* ui;\n};\n\n#endif\n

EventQtSlotConnectDriver.cxx

#include <QApplication>\n#include <QSurfaceFormat>\n\n#include <QVTKOpenGLNativeWidget.h>\n\n#include \"EventQtSlotConnect.h\"\n\nint main(int argc, char** argv)\n{\n  // needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  QApplication app(argc, argv);\n\n  EventQtSlotConnect eventQtSlotConnect;\n  eventQtSlotConnect.show();\n\n  return app.exec();\n}\n
"},{"location":"Cxx/Qt/EventQtSlotConnect/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(EventQtSlotConnect)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  GUISupportQt\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"EventQtSlotConnect: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"EventQtSlotConnect: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(EventQtSlotConnect MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(EventQtSlotConnect ${qt_components})\nelse()\n  target_link_libraries(EventQtSlotConnect ${qt_modules})\nendif()\ntarget_link_libraries(EventQtSlotConnect ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EventQtSlotConnect\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/EventQtSlotConnect/#download-and-build-eventqtslotconnect","title":"Download and Build EventQtSlotConnect","text":"

Click here to download EventQtSlotConnect and its CMakeLists.txt file. Once the tarball EventQtSlotConnect.tar has been downloaded and extracted,

 cd EventQtSlotConnect/build\n

This example requires Qt and VTK.

If VTK and Qt are installed:

 cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

 cmake -DVTK_DIR=/home/me/vtk_build ..\n

If Qt is not found on your system, you will need to tell CMake where to find qmake:

cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

Build the project:

make\n

and run it:

./EventQtSlotConnect\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

"},{"location":"Cxx/Qt/ImageDataToQImage/","title":"ImageDataToQImage","text":"

vtk-examples/Cxx/Qt/ImageDataToQImage

"},{"location":"Cxx/Qt/ImageDataToQImage/#description","title":"Description","text":"

This example shows how a vtkImageData can be converted into a QImage.

Seealso

the QImageToImageSource example.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/ImageDataToQImage/#code","title":"Code","text":"

ImageDataToQImage.cxx

#include <vtkImageData.h>\n#include <vtkNew.h>\n#include <vtkSmartPointer.h>\n\n#include <QApplication>\n#include <QColor>\n#include <QImage>\n\n// Create a green 50x50 imageData for demonstration purposes\nvtkSmartPointer<vtkImageData> createDemoImageData()\n{\n  vtkNew<vtkImageData> image;\n  image->SetDimensions(50, 50, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  int width = image->GetDimensions()[0];\n  int height = image->GetDimensions()[1];\n\n  for (int y = 0; y < height; y++)\n  {\n    for (int x = 0; x < width; x++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = 0;\n      pixel[1] = 255;\n      pixel[2] = 0;\n    }\n  }\n\n  return image;\n}\n\n// The actual conversion code\nQImage vtkImageDataToQImage(vtkSmartPointer<vtkImageData> imageData)\n{\n  if (!imageData)\n  {\n    return QImage();\n  }\n\n  /// \\todo retrieve just the UpdateExtent\n  int width = imageData->GetDimensions()[0];\n  int height = imageData->GetDimensions()[1];\n  QImage image(width, height, QImage::Format_RGB32);\n  QRgb* rgbPtr = reinterpret_cast<QRgb*>(image.bits()) + width * (height - 1);\n  unsigned char* colorsPtr =\n      reinterpret_cast<unsigned char*>(imageData->GetScalarPointer());\n\n  // Loop over the vtkImageData contents.\n  for (int row = 0; row < height; row++)\n  {\n    for (int col = 0; col < width; col++)\n    {\n      // Swap the vtkImageData RGB values with an equivalent QColor\n      *(rgbPtr++) = QColor(colorsPtr[0], colorsPtr[1], colorsPtr[2]).rgb();\n      colorsPtr += imageData->GetNumberOfScalarComponents();\n    }\n\n    rgbPtr -= width * 2;\n  }\n\n  return image;\n}\n\nint main(int argc, char* argv[])\n{\n  QApplication app(argc, argv);\n\n  QImage qimage = vtkImageDataToQImage(createDemoImageData());\n  qimage.save(\"qimage.png\");\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Qt/ImageDataToQImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDataToQImage)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDataToQImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDataToQImage MACOSX_BUNDLE ImageDataToQImage.cxx )\n  target_link_libraries(ImageDataToQImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDataToQImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/ImageDataToQImage/#download-and-build-imagedatatoqimage","title":"Download and Build ImageDataToQImage","text":"

Click here to download ImageDataToQImage and its CMakeLists.txt file. Once the tarball ImageDataToQImage.tar has been downloaded and extracted,

cd ImageDataToQImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageDataToQImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Qt/MinimalQtVTKApp/","title":"MinimalQtVTKApp","text":"

vtk-examples/Cxx/Qt/MinimalQtVTKApp

"},{"location":"Cxx/Qt/MinimalQtVTKApp/#description","title":"Description","text":"

This is meant to serve as a minimal Qt/VTK example for Qt application developers looking to use VTK and VTK developers looking to develop Qt applications.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/MinimalQtVTKApp/#code","title":"Code","text":"

MinimalQtVTKApp.cxx

#include <QVTKOpenGLNativeWidget.h>\n#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkPointData.h>\n#include <vtkProperty.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <QApplication>\n#include <QDockWidget>\n#include <QGridLayout>\n#include <QLabel>\n#include <QMainWindow>\n#include <QPointer>\n#include <QPushButton>\n#include <QVBoxLayout>\n\n#include <cmath>\n#include <cstdlib>\n#include <random>\n\nnamespace {\n/**\n * Deform the sphere source using a random amplitude and modes and render it in\n * the window\n *\n * @param sphere the original sphere source\n * @param mapper the mapper for the scene\n * @param window the window to render to\n * @param randEng the random number generator engine\n */\nvoid Randomize(vtkSphereSource* sphere, vtkMapper* mapper,\n               vtkGenericOpenGLRenderWindow* window, std::mt19937& randEng);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  QApplication app(argc, argv);\n\n  // Main window.\n  QMainWindow mainWindow;\n  mainWindow.resize(1200, 900);\n\n  // Control area.\n  QDockWidget controlDock;\n  mainWindow.addDockWidget(Qt::LeftDockWidgetArea, &controlDock);\n\n  QLabel controlDockTitle(\"Control Dock\");\n  controlDockTitle.setMargin(20);\n  controlDock.setTitleBarWidget(&controlDockTitle);\n\n  QPointer<QVBoxLayout> dockLayout = new QVBoxLayout();\n  QWidget layoutContainer;\n  layoutContainer.setLayout(dockLayout);\n  controlDock.setWidget(&layoutContainer);\n\n  QPushButton randomizeButton;\n  randomizeButton.setText(\"Randomize\");\n  dockLayout->addWidget(&randomizeButton);\n\n  // Render area.\n  QPointer<QVTKOpenGLNativeWidget> vtkRenderWidget =\n      new QVTKOpenGLNativeWidget();\n  mainWindow.setCentralWidget(vtkRenderWidget);\n\n  // VTK part.\n  vtkNew<vtkGenericOpenGLRenderWindow> window;\n  vtkRenderWidget->setRenderWindow(window.Get());\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetRadius(1.0);\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(100);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetEdgeVisibility(true);\n  actor->GetProperty()->SetRepresentationToSurface();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n\n  window->AddRenderer(renderer);\n\n  // Setup initial status.\n  std::mt19937 randEng(0);\n  ::Randomize(sphere, mapper, window, randEng);\n\n  // connect the buttons\n  QObject::connect(&randomizeButton, &QPushButton::released,\n                   [&]() { ::Randomize(sphere, mapper, window, randEng); });\n\n  mainWindow.show();\n\n  return app.exec();\n}\n\nnamespace {\nvoid Randomize(vtkSphereSource* sphere, vtkMapper* mapper,\n               vtkGenericOpenGLRenderWindow* window, std::mt19937& randEng)\n{\n  // Generate randomness.\n  double randAmp = 0.2 + ((randEng() % 1000) / 1000.0) * 0.2;\n  double randThetaFreq = 1.0 + (randEng() % 9);\n  double randPhiFreq = 1.0 + (randEng() % 9);\n\n  // Extract and prepare data.\n  sphere->Update();\n  vtkSmartPointer<vtkPolyData> newSphere;\n  newSphere.TakeReference(sphere->GetOutput()->NewInstance());\n  newSphere->DeepCopy(sphere->GetOutput());\n  vtkNew<vtkDoubleArray> height;\n  height->SetName(\"Height\");\n  height->SetNumberOfComponents(1);\n  height->SetNumberOfTuples(newSphere->GetNumberOfPoints());\n  newSphere->GetPointData()->AddArray(height);\n\n  // Deform the sphere.\n  for (int iP = 0; iP < newSphere->GetNumberOfPoints(); iP++)\n  {\n    double pt[3] = {0.0};\n    newSphere->GetPoint(iP, pt);\n    double theta = std::atan2(pt[1], pt[0]);\n    double phi =\n        std::atan2(pt[2], std::sqrt(std::pow(pt[0], 2) + std::pow(pt[1], 2)));\n    double thisAmp =\n        randAmp * std::cos(randThetaFreq * theta) * std::sin(randPhiFreq * phi);\n    height->SetValue(iP, thisAmp);\n    pt[0] += thisAmp * std::cos(theta) * std::cos(phi);\n    pt[1] += thisAmp * std::sin(theta) * std::cos(phi);\n    pt[2] += thisAmp * std::sin(phi);\n    newSphere->GetPoints()->SetPoint(iP, pt);\n  }\n  newSphere->GetPointData()->SetScalars(height);\n\n  // Reconfigure the pipeline to take the new deformed sphere.\n  mapper->SetInputDataObject(newSphere);\n  mapper->SetScalarModeToUsePointData();\n  mapper->ColorByArrayComponent(\"Height\", 0);\n  window->Render();\n}\n} // namespace\n
"},{"location":"Cxx/Qt/MinimalQtVTKApp/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(MinimalQtVTKApp)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n  GUISupportQt\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"MinimalQtVTKApp: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"MinimalQtVTKApp: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(MinimalQtVTKApp MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(MinimalQtVTKApp ${qt_components})\nelse()\n  target_link_libraries(MinimalQtVTKApp ${qt_modules})\nendif()\ntarget_link_libraries(MinimalQtVTKApp ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MinimalQtVTKApp\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/MinimalQtVTKApp/#download-and-build-minimalqtvtkapp","title":"Download and Build MinimalQtVTKApp","text":"

Click here to download MinimalQtVTKApp and its CMakeLists.txt file. Once the tarball MinimalQtVTKApp.tar has been downloaded and extracted,

 cd MinimalQtVTKApp/build\n

This example requires Qt and VTK.

If VTK and Qt are installed:

 cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

 cmake -DVTK_DIR=/home/me/vtk_build ..\n

If Qt is not found on your system, you will need to tell CMake where to find qmake:

cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

Build the project:

make\n

and run it:

./MinimalQtVTKApp\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

"},{"location":"Cxx/Qt/QImageToImageSource/","title":"QImageToImageSource","text":"

vtk-examples/Cxx/Qt/QImageToImageSource

"},{"location":"Cxx/Qt/QImageToImageSource/#description","title":"Description","text":"

This example demonstrates the use of vtkQImageToImageSource.

See also the ImageDataToQImage example.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/QImageToImageSource/#code","title":"Code","text":"

QImageToImageSource.cxx

#include <QApplication>\n#include <QPixmap>\n#include <vtkNew.h>\n\n#include <vtkQImageToImageSource.h>\n\nint main(int argc, char* argv[])\n{\n  QApplication app(argc, argv);\n\n  QPixmap pixmap(10, 10);\n  QColor color(10, 20, 30);\n  pixmap.fill(color);\n\n  vtkNew<vtkQImageToImageSource> qimageToImageSource;\n  QImage qimage = pixmap.toImage();\n  qimageToImageSource->SetQImage(&qimage);\n  qimageToImageSource->Update();\n\n  //  vtkImageData* image = qimageToImageSource->GetOutput();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Qt/QImageToImageSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QImageToImageSource)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  RenderingQt\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QImageToImageSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QImageToImageSource MACOSX_BUNDLE QImageToImageSource.cxx )\n  target_link_libraries(QImageToImageSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QImageToImageSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/QImageToImageSource/#download-and-build-qimagetoimagesource","title":"Download and Build QImageToImageSource","text":"

Click here to download QImageToImageSource and its CMakeLists.txt file. Once the tarball QImageToImageSource.tar has been downloaded and extracted,

cd QImageToImageSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QImageToImageSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Qt/RenderWindowNoUiFile/","title":"RenderWindowNoUiFile","text":"

vtk-examples/Cxx/Qt/RenderWindowNoUiFile

"},{"location":"Cxx/Qt/RenderWindowNoUiFile/#description","title":"Description","text":"

This is a very basic example that shows how to create a Qt window. Typically, one would want to design a form in the QtDesigner (this is shown in RenderWindowUISingleInheritance).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/RenderWindowNoUiFile/#code","title":"Code","text":"

RenderWindowNoUiFile.cxx

#include <QApplication>\n\n#include <vtkActor.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n#include <QSurfaceFormat>\n#include <QVTKOpenGLNativeWidget.h>\n\nnamespace {\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n} // namespace\n\nint main(int argc, char** argv)\n{\n  // Needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  QApplication app(argc, argv);\n\n  QVTKOpenGLNativeWidget widget;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;\n#if VTK890\n  widget.setRenderWindow(renderWindow);\n#else\n  widget.SetRenderWindow(renderWindow);\n#endif\n\n  widget.resize(600, 600);\n\n  auto lut = GetPlatonicLUT();\n\n  vtkNew<vtkPlatonicSolidSource> source;\n  source->SetSolidTypeToIcosahedron();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, 19);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n#if VTK890\n  widget.renderWindow()->AddRenderer(renderer);\n  widget.renderWindow()->SetWindowName(\"RenderWindowNoUIFile\");\n#else\n  widget.GetRenderWindow()->AddRenderer(renderer);\n  widget.GetRenderWindow()->SetWindowName(\"RenderWindowNoUIFile\");\n#endif\n  widget.show();\n\n  app.exec();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\n} // namespace\n
"},{"location":"Cxx/Qt/RenderWindowNoUiFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RenderWindowNoUiFile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  GUISupportQt\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RenderWindowNoUiFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RenderWindowNoUiFile MACOSX_BUNDLE RenderWindowNoUiFile.cxx )\n  target_link_libraries(RenderWindowNoUiFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RenderWindowNoUiFile\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/RenderWindowNoUiFile/#download-and-build-renderwindownouifile","title":"Download and Build RenderWindowNoUiFile","text":"

Click here to download RenderWindowNoUiFile and its CMakeLists.txt file. Once the tarball RenderWindowNoUiFile.tar has been downloaded and extracted,

cd RenderWindowNoUiFile/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RenderWindowNoUiFile\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Qt/RenderWindowUISingleInheritance/","title":"RenderWindowUISingleInheritance","text":"

vtk-examples/Cxx/Qt/RenderWindowUISingleInheritance

"},{"location":"Cxx/Qt/RenderWindowUISingleInheritance/#description","title":"Description","text":"

Using a QVTKOpenGLNativeWidget with the Qt Single Inheritance model. This cleanly separates the public interface of the class from its internals.

The main widget is derived from from QMainWindow and the class Ui::RenderWindowUISingleInheritance becomes a variable in the class.

The procedure is:

  • In the header file RenderWindowUISingleInheritance.h forward declare the class Ui_RenderWindowUISingleInheritance and create a private variable in the class:
private:\n  // Designer form\n  Ui_RenderWindowUISingleInheritance* ui;\n
  • In the source file RenderWindowUISingleInheritance.cxx, assign and initialise in the constructor:
  this->ui = new Ui_RenderWindowUISingleInheritance;\n  this->ui->setupUi(this);\n

This approach also ensures that when CMAKE_AUTOUIC is set to ON and subfolders are used we get a build with no errors.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/RenderWindowUISingleInheritance/#code","title":"Code","text":"

RenderWindowUISingleInheritance.cxx

#include \"RenderWindowUISingleInheritance.h\"\n#include \"ui_RenderWindowUISingleInheritance.h\"\n\n#include <vtkCamera.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\nnamespace {\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n} // namespace\n\n// Constructor\nRenderWindowUISingleInheritance::RenderWindowUISingleInheritance(\n    QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::RenderWindowUISingleInheritance)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;\n#if VTK890\n  this->ui->qvtkWidget->setRenderWindow(renderWindow);\n#else\n  this->ui->qvtkWidget->SetRenderWindow(renderWindow);\n#endif\n\n  auto lut = GetPlatonicLUT();\n\n  vtkNew<vtkPlatonicSolidSource> source;\n  source->SetSolidTypeToIcosahedron();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, 19);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->GetActiveCamera()->Azimuth(180.0);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // VTK/Qt wedded.\n#if VTK890\n  this->ui->qvtkWidget->renderWindow()->AddRenderer(renderer);\n  this->ui->qvtkWidget->renderWindow()->SetWindowName(\n      \"RenderWindowUISingleInheritance\");\n#else\n  this->ui->qvtkWidget->GetRenderWindow()->AddRenderer(renderer);\n  this->ui->qvtkWidget->GetRenderWindow()->SetWindowName(\n      \"RenderWindowUISingleInheritance\");\n#endif\n  // Set up action signals and slots.\n  connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));\n}\n\nRenderWindowUISingleInheritance::~RenderWindowUISingleInheritance()\n{\n  delete this->ui;\n}\n\nvoid RenderWindowUISingleInheritance::slotExit()\n{\n  qApp->exit();\n}\n\nnamespace {\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\n} // namespace\n

RenderWindowUISingleInheritanceDriver.cxx

#include <QApplication>\n#include <QSurfaceFormat>\n#include <QVTKOpenGLNativeWidget.h>\n\n#include \"RenderWindowUISingleInheritance.h\"\n\nint main(int argc, char** argv)\n{\n  // needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  // QT Stuff\n  QApplication app(argc, argv);\n\n  RenderWindowUISingleInheritance renderWindowUISingleInheritance;\n  renderWindowUISingleInheritance.show();\n\n  return app.exec();\n}\n

RenderWindowUISingleInheritance.h

#ifndef RenderWindowUISingleInheritance_H\n#define RenderWindowUISingleInheritance_H\n\n#include <vtkSmartPointer.h>\n\n#include <QMainWindow>\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass RenderWindowUISingleInheritance;\n}\n\nclass RenderWindowUISingleInheritance : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  // Constructor/Destructor\n  explicit RenderWindowUISingleInheritance(QWidget* parent = nullptr);\n  virtual ~RenderWindowUISingleInheritance();\n\nprivate:\n  // Designer form\n  Ui::RenderWindowUISingleInheritance* ui;\n\npublic slots:\n  void slotExit();\n};\n\n#endif\n

RenderWindowUISingleInheritance.ui

<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>RenderWindowUISingleInheritance</class>\n <widget class=\"QMainWindow\" name=\"RenderWindowUISingleInheritance\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>541</width>\n    <height>583</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>RenderWindowUISingleInheritance</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidget\">\n    <property name=\"geometry\">\n     <rect>\n      <x>10</x>\n      <y>20</y>\n      <width>511</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources>\n\n </resources>\n <connections/>\n</ui>\n
"},{"location":"Cxx/Qt/RenderWindowUISingleInheritance/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(RenderWindowUISingleInheritance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"RenderWindowUISingleInheritance: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"RenderWindowUISingleInheritance: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(RenderWindowUISingleInheritance MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(RenderWindowUISingleInheritance ${qt_components})\nelse()\n  target_link_libraries(RenderWindowUISingleInheritance ${qt_modules})\nendif()\ntarget_link_libraries(RenderWindowUISingleInheritance ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RenderWindowUISingleInheritance\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/RenderWindowUISingleInheritance/#download-and-build-renderwindowuisingleinheritance","title":"Download and Build RenderWindowUISingleInheritance","text":"

Click here to download RenderWindowUISingleInheritance and its CMakeLists.txt file. Once the tarball RenderWindowUISingleInheritance.tar has been downloaded and extracted,

 cd RenderWindowUISingleInheritance/build\n

This example requires Qt and VTK.

If VTK and Qt are installed:

 cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

 cmake -DVTK_DIR=/home/me/vtk_build ..\n

If Qt is not found on your system, you will need to tell CMake where to find qmake:

cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

Build the project:

make\n

and run it:

./RenderWindowUISingleInheritance\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

"},{"location":"Cxx/Qt/ShareCameraQt/","title":"ShareCameraQt","text":"

vtk-examples/Cxx/Qt/ShareCameraQt

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/ShareCameraQt/#code","title":"Code","text":"

ShareCameraQt.cxx

#include \"ShareCameraQt.h\"\n#include \"ui_ShareCameraQt.h\"\n\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n// Constructor\nShareCameraQt::ShareCameraQt(QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::ShareCameraQt)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindowLeft;\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindowRight;\n#if VTK890\n  this->ui->qvtkWidgetLeft->setRenderWindow(renderWindowLeft);\n  this->ui->qvtkWidgetRight->setRenderWindow(renderWindowRight);\n#else\n  this->ui->qvtkWidgetLeft->SetRenderWindow(renderWindowLeft);\n  this->ui->qvtkWidgetRight->SetRenderWindow(renderWindowRight);\n#endif\n\n  // Cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetDirection(0.0, 1.0, 0.0);\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor4d(\"Tomato\").GetData());\n\n  // Cube\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetXLength(0.8);\n  cubeSource->SetYLength(0.8);\n  cubeSource->SetZLength(0.8);\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"MediumSeaGreen\").GetData());\n\n  // VTK Renderer.\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->AddActor(coneActor);\n  leftRenderer->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n\n  // Add Actor to renderer.\n  rightRenderer->AddActor(cubeActor);\n  rightRenderer->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  // VTK/Qt wedded.\n#if VTK890\n  this->ui->qvtkWidgetLeft->renderWindow()->AddRenderer(leftRenderer);\n  this->ui->qvtkWidgetRight->renderWindow()->AddRenderer(rightRenderer);\n#else\n  this->ui->qvtkWidgetLeft->GetRenderWindow()->AddRenderer(leftRenderer);\n  this->ui->qvtkWidgetRight->GetRenderWindow()->AddRenderer(rightRenderer);\n#endif\n\n  rightRenderer->ResetCamera();\n  leftRenderer->ResetCamera();\n\n  // Here we share the camera.\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  // Position the cube using the left renderer active camera.\n  leftRenderer->GetActiveCamera()->Azimuth(60);\n  leftRenderer->ResetCamera();\n\n  // Set up action signals and slots.\n  connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));\n\n#if VTK890\n  this->ui->qvtkWidgetLeft->renderWindow()->AddObserver(\n      vtkCommand::ModifiedEvent, this, &ShareCameraQt::ModifiedHandler);\n#else\n  this->ui->qvtkWidgetLeft->GetRenderWindow()->AddObserver(\n      vtkCommand::ModifiedEvent, this, &ShareCameraQt::ModifiedHandler);\n#endif\n}\n\nvoid ShareCameraQt::ModifiedHandler()\n{\n#if VTK890\n  this->ui->qvtkWidgetRight->renderWindow()->Render();\n#else\n  this->ui->qvtkWidgetRight->GetRenderWindow()->Render();\n#endif\n}\n\nvoid ShareCameraQt::slotExit()\n{\n  qApp->exit();\n}\n

ShareCameraQtDriver.cxx

#include <QApplication>\n#include <QSurfaceFormat>\n#include <QVTKOpenGLNativeWidget.h>\n\n#include \"ShareCameraQt.h\"\n\nint main(int argc, char** argv)\n{\n  // needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  // QT Stuff\n  QApplication app(argc, argv);\n\n  ShareCameraQt shareCameraQt;\n  shareCameraQt.show();\n\n  return app.exec();\n}\n

ShareCameraQt.h

#ifndef ShareCameraQt_H\n#define ShareCameraQt_H\n\n#include <QMainWindow>\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass ShareCameraQt;\n}\n\nclass ShareCameraQt : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  // Constructor/Destructor\n  explicit ShareCameraQt(QWidget* parent = nullptr);\n  virtual ~ShareCameraQt() = default;\n\nprivate:\n  // Designer form\n  Ui::ShareCameraQt* ui;\n\npublic slots:\n  void slotExit();\n\nprotected:\n  void ModifiedHandler();\n};\n\n#endif\n

ShareCameraQt.ui

<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>ShareCameraQt</class>\n <widget class=\"QMainWindow\" name=\"ShareCameraQt\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>990</width>\n    <height>583</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ShareCameraQt</string>\n  </property>\n  <property name=\"windowIcon\">\n   <iconset resource=\"Icons/icons.qrc\">\n    <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n  </property>\n  <property name=\"iconSize\">\n   <size>\n    <width>22</width>\n    <height>22</height>\n   </size>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidgetLeft\">\n    <property name=\"geometry\">\n     <rect>\n      <x>10</x>\n      <y>20</y>\n      <width>511</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidgetRight\">\n    <property name=\"geometry\">\n     <rect>\n      <x>540</x>\n      <y>20</y>\n      <width>441</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/fileopen.png</normaloff>:/Icons/fileopen.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"icon\">\n    <iconset>\n     <normaloff/>\n    </iconset>\n   </property>\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/print.png</normaloff>:/Icons/print.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/filesave.png</normaloff>:/Icons/filesave.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources>\n  <include location=\"Icons/icons.qrc\"/>\n </resources>\n <connections/>\n</ui>\n
"},{"location":"Cxx/Qt/ShareCameraQt/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(ShareCameraQt)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShareCameraQt: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"ShareCameraQt: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(ShareCameraQt MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(ShareCameraQt ${qt_components})\nelse()\n  target_link_libraries(ShareCameraQt ${qt_modules})\nendif()\ntarget_link_libraries(ShareCameraQt ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShareCameraQt\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/ShareCameraQt/#download-and-build-sharecameraqt","title":"Download and Build ShareCameraQt","text":"

Click here to download ShareCameraQt and its CMakeLists.txt file. Once the tarball ShareCameraQt.tar has been downloaded and extracted,

 cd ShareCameraQt/build\n

This example requires Qt and VTK.

If VTK and Qt are installed:

 cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

 cmake -DVTK_DIR=/home/me/vtk_build ..\n

If Qt is not found on your system, you will need to tell CMake where to find qmake:

cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

Build the project:

make\n

and run it:

./ShareCameraQt\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

"},{"location":"Cxx/Qt/ShowEvent/","title":"ShowEvent","text":"

vtk-examples/Cxx/Qt/ShowEvent

"},{"location":"Cxx/Qt/ShowEvent/#description","title":"Description","text":"

Small example (not doing anything actually) to show the use of the overwritten QWidget::showEvent() function to initialize the VTK widget when it is actually used, not directly in the constructor.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/ShowEvent/#code","title":"Code","text":"

ShowEvent.cxx

#include <iostream>\n\n#include \"ShowEvent.h\"\n#include \"ui_ShowEvent.h\"\n\nShowEvent::ShowEvent(QWidget* parent) : QWidget(parent), ui(new Ui::ShowEvent)\n{\n  this->ui->setupUi(this);\n\n  // Do not do anything related to VTK display here!\n  std::cout << \"Constructor\" << std::endl;\n}\n\nvoid ShowEvent::showEvent(QShowEvent*)\n{\n  // Instead, do the VTK display things here!\n  std::cout << \"VTK Stuff\" << std::endl;\n}\n

ShowEventDriver.cxx

#include <QApplication>\n\n#include \"ShowEvent.h\"\n\nint main(int argc, char* argv[])\n{\n  QApplication app(argc, argv);\n  ShowEvent showEvent;\n\n  showEvent.show();\n  return app.exec();\n}\n

ShowEvent.h

#ifndef ShowEventQt_H\n#define ShowEventQt_H\n\n#include <QMainWindow>\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass ShowEvent;\n}\n\nclass ShowEvent : public QWidget //, private Ui::ShowEvent\n{\n  Q_OBJECT\n\npublic:\n  explicit ShowEvent(QWidget* parent = nullptr);\n  virtual ~ShowEvent() = default;\n\nprivate:\n  Ui::ShowEvent* ui;\n\nprotected:\n  void showEvent(QShowEvent* event);\n};\n\n#endif\n

ShowEvent.ui

<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>ShowEvent</class>\n <widget class=\"QWidget\" name=\"ShowEvent\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>312</width>\n    <height>243</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ShowEvent</string>\n  </property>\n  <layout class=\"QGridLayout\" name=\"gridLayout\">\n   <item row=\"0\" column=\"0\">\n    <widget class=\"QGraphicsView\" name=\"graphicsView\">\n     <property name=\"backgroundBrush\">\n      <brush brushstyle=\"NoBrush\">\n       <color alpha=\"255\">\n        <red>0</red>\n        <green>0</green>\n        <blue>0</blue>\n       </color>\n      </brush>\n     </property>\n    </widget>\n   </item>\n  </layout>\n </widget>\n <resources/>\n <connections/>\n</ui>\n
"},{"location":"Cxx/Qt/ShowEvent/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShowEvent)\n\nfind_package(VTK COMPONENTS \n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShowEvent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShowEvent MACOSX_BUNDLE ShowEvent.cxx )\n  target_link_libraries(ShowEvent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShowEvent\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/ShowEvent/#download-and-build-showevent","title":"Download and Build ShowEvent","text":"

Click here to download ShowEvent and its CMakeLists.txt file. Once the tarball ShowEvent.tar has been downloaded and extracted,

cd ShowEvent/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ShowEvent\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Qt/SideBySideRenderWindowsQt/","title":"SideBySideRenderWindowsQt","text":"

vtk-examples/Cxx/Qt/SideBySideRenderWindowsQt

"},{"location":"Cxx/Qt/SideBySideRenderWindowsQt/#description","title":"Description","text":"

Although this example includes ui_SideBySideRenderWindowsQt.h, this file is not distributed, it is created by Qt at compile time.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Qt/SideBySideRenderWindowsQt/#code","title":"Code","text":"

SideBySideRenderWindowsQt.cxx

#include \"SideBySideRenderWindowsQt.h\"\n#include \"ui_SideBySideRenderWindowsQt.h\"\n\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkElevationFilter.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n// Constructor\nSideBySideRenderWindowsQt::SideBySideRenderWindowsQt(QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::SideBySideRenderWindowsQt)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindowLeft;\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindowRight;\n#if VTK890\n  this->ui->qvtkWidgetLeft->setRenderWindow(renderWindowLeft);\n  this->ui->qvtkWidgetRight->setRenderWindow(renderWindowRight);\n#else\n  this->ui->qvtkWidgetLeft->SetRenderWindow(renderWindowLeft);\n  this->ui->qvtkWidgetRight->SetRenderWindow(renderWindowRight);\n#endif\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n  vtkNew<vtkElevationFilter> sphereElev;\n  sphereElev->SetInputConnection(sphereSource->GetOutputPort());\n  sphereElev->SetLowPoint(0, -1.0, 0);\n  sphereElev->SetHighPoint(0, 1.0, 0);\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereElev->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n\n  // Cube\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetXLength(0.8);\n  cubeSource->SetYLength(0.8);\n  cubeSource->SetZLength(0.8);\n  vtkNew<vtkElevationFilter> cubeElev;\n  cubeElev->SetInputConnection(cubeSource->GetOutputPort());\n  cubeElev->SetLowPoint(0, -1.0, 0);\n  cubeElev->SetHighPoint(0, 1.0, 0);\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeElev->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n\n  // VTK Renderer.\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->AddActor(sphereActor);\n  leftRenderer->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n\n  // Add Actor to renderer.\n  rightRenderer->AddActor(cubeActor);\n  rightRenderer->GetActiveCamera()->Azimuth(60);\n  rightRenderer->ResetCamera();\n  rightRenderer->GetActiveCamera()->Zoom(0.8);\n  rightRenderer->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  // VTK/Qt wedded.\n#if VTK890\n  this->ui->qvtkWidgetLeft->renderWindow()->AddRenderer(leftRenderer);\n  this->ui->qvtkWidgetRight->renderWindow()->AddRenderer(rightRenderer);\n#else\n  this->ui->qvtkWidgetLeft->GetRenderWindow()->AddRenderer(leftRenderer);\n  this->ui->qvtkWidgetRight->GetRenderWindow()->AddRenderer(rightRenderer);\n#endif\n\n  // Set up action signals and slots.\n  connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));\n}\n\nvoid SideBySideRenderWindowsQt::slotExit()\n{\n  qApp->exit();\n}\n

SideBySideRenderWindowsQt.ui

<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>SideBySideRenderWindowsQt</class>\n <widget class=\"QMainWindow\" name=\"SideBySideRenderWindowsQt\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>990</width>\n    <height>583</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>SideBySideRenderWindowsQt</string>\n  </property>\n  <property name=\"windowIcon\">\n   <iconset resource=\"Icons/icons.qrc\">\n    <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n  </property>\n  <property name=\"iconSize\">\n   <size>\n    <width>22</width>\n    <height>22</height>\n   </size>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidgetLeft\">\n    <property name=\"geometry\">\n     <rect>\n      <x>10</x>\n      <y>20</y>\n      <width>511</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidgetRight\">\n    <property name=\"geometry\">\n     <rect>\n      <x>540</x>\n      <y>20</y>\n      <width>441</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/fileopen.png</normaloff>:/Icons/fileopen.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"icon\">\n    <iconset>\n     <normaloff/>\n    </iconset>\n   </property>\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/print.png</normaloff>:/Icons/print.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/filesave.png</normaloff>:/Icons/filesave.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources>\n  <include location=\"Icons/icons.qrc\"/>\n </resources>\n <connections/>\n</ui>\n

SideBySideRenderWindowsQt.h

#ifndef SideBySideRenderWindowsQt_H\n#define SideBySideRenderWindowsQt_H\n\n#include <QMainWindow>\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass SideBySideRenderWindowsQt;\n}\n\nclass SideBySideRenderWindowsQt : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  // Constructor/Destructor\n  explicit SideBySideRenderWindowsQt(QWidget* parent = nullptr);\n  virtual ~SideBySideRenderWindowsQt() = default;\n\nprivate:\n  // Designer form\n  Ui::SideBySideRenderWindowsQt* ui;\n\npublic slots:\n\n  void slotExit();\n};\n\n#endif\n

SideBySideRenderWindowsQtDriver.cxx

#include <QApplication>\n#include <QSurfaceFormat>\n\n#include \"SideBySideRenderWindowsQt.h\"\n#include <QVTKOpenGLNativeWidget.h>\n\nint main(int argc, char** argv)\n{\n  // needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  // QT Stuff\n  QApplication app(argc, argv);\n\n  SideBySideRenderWindowsQt sideBySideRenderWindowsQt;\n  sideBySideRenderWindowsQt.show();\n\n  return app.exec();\n}\n
"},{"location":"Cxx/Qt/SideBySideRenderWindowsQt/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(SideBySideRenderWindowsQt)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"SideBySideRenderWindowsQt: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"SideBySideRenderWindowsQt: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(SideBySideRenderWindowsQt MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(SideBySideRenderWindowsQt ${qt_components})\nelse()\n  target_link_libraries(SideBySideRenderWindowsQt ${qt_modules})\nendif()\ntarget_link_libraries(SideBySideRenderWindowsQt ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SideBySideRenderWindowsQt\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Qt/SideBySideRenderWindowsQt/#download-and-build-sidebysiderenderwindowsqt","title":"Download and Build SideBySideRenderWindowsQt","text":"

Click here to download SideBySideRenderWindowsQt and its CMakeLists.txt file. Once the tarball SideBySideRenderWindowsQt.tar has been downloaded and extracted,

 cd SideBySideRenderWindowsQt/build\n

This example requires Qt and VTK.

If VTK and Qt are installed:

 cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

 cmake -DVTK_DIR=/home/me/vtk_build ..\n

If Qt is not found on your system, you will need to tell CMake where to find qmake:

cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

Build the project:

make\n

and run it:

./SideBySideRenderWindowsQt\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

"},{"location":"Cxx/RectilinearGrid/RGrid/","title":"RGrid","text":"

vtk-examples/Cxx/RectilinearGrid/RGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/RectilinearGrid/RGrid/#description","title":"Description","text":"

Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray.

Info

See Figure 5-20 in Chapter 5 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/RectilinearGrid/RGrid/#code","title":"Code","text":"

RGrid.cxx

// This example shows how to create a rectilinear grid.\n//\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRectilinearGridGeometryFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  int i;\n  static double x[47] = {\n      -1.22396,  -1.17188,  -1.11979,  -1.06771,  -1.01562,  -0.963542,\n      -0.911458, -0.859375, -0.807292, -0.755208, -0.703125, -0.651042,\n      -0.598958, -0.546875, -0.494792, -0.442708, -0.390625, -0.338542,\n      -0.286458, -0.234375, -0.182292, -0.130209, -0.078125, -0.026042,\n      0.0260415, 0.078125,  0.130208,  0.182291,  0.234375,  0.286458,\n      0.338542,  0.390625,  0.442708,  0.494792,  0.546875,  0.598958,\n      0.651042,  0.703125,  0.755208,  0.807292,  0.859375,  0.911458,\n      0.963542,  1.01562,   1.06771,   1.11979,   1.17188};\n  static double y[33] = {-1.25,     -1.17188,  -1.09375,  -1.01562,  -0.9375,\n                         -0.859375, -0.78125,  -0.703125, -0.625,    -0.546875,\n                         -0.46875,  -0.390625, -0.3125,   -0.234375, -0.15625,\n                         -0.078125, 0,         0.078125,  0.15625,   0.234375,\n                         0.3125,    0.390625,  0.46875,   0.546875,  0.625,\n                         0.703125,  0.78125,   0.859375,  0.9375,    1.01562,\n                         1.09375,   1.17188,   1.25};\n  static double z[44] = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.9,\n                         1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.75, 1.8, 1.9,\n                         2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.75, 2.8, 2.9,\n                         3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.75, 3.8, 3.9};\n\n  // Create a rectilinear grid by defining three arrays specifying the\n  // coordinates in the x-y-z directions.\n  vtkNew<vtkDoubleArray> xCoords;\n  for (i = 0; i < 47; i++)\n  {\n    xCoords->InsertNextValue(x[i]);\n  }\n  vtkNew<vtkDoubleArray> yCoords;\n  for (i = 0; i < 33; i++)\n  {\n    yCoords->InsertNextValue(y[i]);\n  }\n  vtkNew<vtkDoubleArray> zCoords;\n  for (i = 0; i < 44; i++)\n  {\n    zCoords->InsertNextValue(z[i]);\n  }\n  // The coordinates are assigned to the rectilinear grid. Make sure that\n  // the number of values in each of the XCoordinates, YCoordinates,\n  // and ZCoordinates is equal to what is defined in SetDimensions().\n  //\n  vtkNew<vtkRectilinearGrid> rgrid;\n  rgrid->SetDimensions(47, 33, 44);\n  rgrid->SetXCoordinates(xCoords);\n  rgrid->SetYCoordinates(yCoords);\n  rgrid->SetZCoordinates(zCoords);\n\n  // Extract a plane from the grid to see what we've got.\n  vtkNew<vtkRectilinearGridGeometryFilter> plane;\n  plane->SetInputData(rgrid);\n  plane->SetExtent(0, 46, 16, 16, 0, 43);\n\n  vtkNew<vtkPolyDataMapper> rgridMapper;\n  rgridMapper->SetInputConnection(plane->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> wireActor;\n  wireActor->SetMapper(rgridMapper);\n  wireActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  wireActor->GetProperty()->EdgeVisibilityOn();\n\n  // Create the usual rendering stuff.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"RGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(wireActor);\n  renderer->SetBackground(colors->GetColor3d(\"Beige\").GetData());\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Zoom(1.0);\n  renderer->ResetCamera();\n\n  renWin->SetSize(640, 480);\n\n  // interact with data\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/RectilinearGrid/RGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RGrid MACOSX_BUNDLE RGrid.cxx )\n  target_link_libraries(RGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/RectilinearGrid/RGrid/#download-and-build-rgrid","title":"Download and Build RGrid","text":"

Click here to download RGrid and its CMakeLists.txt file. Once the tarball RGrid.tar has been downloaded and extracted,

cd RGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/RectilinearGrid/RectilinearGrid/","title":"RectilinearGrid","text":"

vtk-examples/Cxx/RectilinearGrid/RectilinearGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/RectilinearGrid/RectilinearGrid/#description","title":"Description","text":"

Shows how to create a vtkRectilinearGrid.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/RectilinearGrid/RectilinearGrid/#code","title":"Code","text":"

RectilinearGrid.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid\n  vtkNew<vtkRectilinearGrid> grid;\n\n  grid->SetDimensions(2, 3, 1);\n\n  vtkNew<vtkDoubleArray> xArray;\n  xArray->InsertNextValue(0.0);\n  xArray->InsertNextValue(2.0);\n\n  vtkNew<vtkDoubleArray> yArray;\n  yArray->InsertNextValue(0.0);\n  yArray->InsertNextValue(1.0);\n  yArray->InsertNextValue(2.0);\n\n  vtkNew<vtkDoubleArray> zArray;\n  zArray->InsertNextValue(0.0);\n\n  grid->SetXCoordinates(xArray);\n  grid->SetYCoordinates(yArray);\n  grid->SetZCoordinates(zArray);\n\n  std::cout << \"There are \" << grid->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << grid->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n\n  for (vtkIdType id = 0; id < grid->GetNumberOfPoints(); id++)\n  {\n    double p[3];\n    grid->GetPoint(id, p);\n    std::cout << \"Point \" << id << \" : (\" << p[0] << \" , \" << p[1] << \" , \"\n              << p[2] << \")\" << std::endl;\n  }\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(grid);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RectilinearGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/RectilinearGrid/RectilinearGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RectilinearGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RectilinearGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RectilinearGrid MACOSX_BUNDLE RectilinearGrid.cxx )\n  target_link_libraries(RectilinearGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RectilinearGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/RectilinearGrid/RectilinearGrid/#download-and-build-rectilineargrid","title":"Download and Build RectilinearGrid","text":"

Click here to download RectilinearGrid and its CMakeLists.txt file. Once the tarball RectilinearGrid.tar has been downloaded and extracted,

cd RectilinearGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RectilinearGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/RectilinearGrid/RectilinearGridToTetrahedra/","title":"RectilinearGridToTetrahedra","text":"

vtk-examples/Cxx/RectilinearGrid/RectilinearGridToTetrahedra

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/RectilinearGrid/RectilinearGridToTetrahedra/#code","title":"Code","text":"

RectilinearGridToTetrahedra.cxx

#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRectilinearGridToTetrahedra.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  // Create a grid.\n  vtkNew<vtkRectilinearGrid> grid;\n\n  grid->SetDimensions(5, 4, 3);\n\n  vtkNew<vtkDoubleArray> xArray;\n  xArray->InsertNextValue(0.0);\n  xArray->InsertNextValue(1.0);\n  xArray->InsertNextValue(2.0);\n  xArray->InsertNextValue(3.0);\n  xArray->InsertNextValue(4.0);\n\n  vtkNew<vtkDoubleArray> yArray;\n  yArray->InsertNextValue(0.0);\n  yArray->InsertNextValue(1.0);\n  yArray->InsertNextValue(2.0);\n  yArray->InsertNextValue(3.0);\n\n  vtkNew<vtkDoubleArray> zArray;\n  zArray->InsertNextValue(0.0);\n  zArray->InsertNextValue(1.0);\n  zArray->InsertNextValue(2.0);\n\n  grid->SetXCoordinates(xArray);\n  grid->SetYCoordinates(yArray);\n  grid->SetZCoordinates(zArray);\n\n  vtkNew<vtkRectilinearGridToTetrahedra> rectilinearGridToTetrahedra;\n  rectilinearGridToTetrahedra->SetInputData(grid);\n  rectilinearGridToTetrahedra->Update();\n\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetFileName(\"output.vtu\");\n  writer->SetInputConnection(rectilinearGridToTetrahedra->GetOutputPort());\n  writer->Write();\n\n  std::cout << \"There are \"\n            << rectilinearGridToTetrahedra->GetOutput()->GetNumberOfCells()\n            << \" cells.\" << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/RectilinearGrid/RectilinearGridToTetrahedra/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RectilinearGridToTetrahedra)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RectilinearGridToTetrahedra: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RectilinearGridToTetrahedra MACOSX_BUNDLE RectilinearGridToTetrahedra.cxx )\n  target_link_libraries(RectilinearGridToTetrahedra PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RectilinearGridToTetrahedra\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/RectilinearGrid/RectilinearGridToTetrahedra/#download-and-build-rectilineargridtotetrahedra","title":"Download and Build RectilinearGridToTetrahedra","text":"

Click here to download RectilinearGridToTetrahedra and its CMakeLists.txt file. Once the tarball RectilinearGridToTetrahedra.tar has been downloaded and extracted,

cd RectilinearGridToTetrahedra/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RectilinearGridToTetrahedra\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/RectilinearGrid/VisualizeRectilinearGrid/","title":"VisualizeRectilinearGrid","text":"

vtk-examples/Cxx/RectilinearGrid/VisualizeRectilinearGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/RectilinearGrid/VisualizeRectilinearGrid/#code","title":"Code","text":"

VisualizeRectilinearGrid.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid.\n  vtkNew<vtkRectilinearGrid> grid;\n\n  grid->SetDimensions(2, 3, 2);\n\n  vtkNew<vtkDoubleArray> xArray;\n  xArray->InsertNextValue(0.0);\n  xArray->InsertNextValue(2.0);\n\n  vtkNew<vtkDoubleArray> yArray;\n  yArray->InsertNextValue(0.0);\n  yArray->InsertNextValue(1.0);\n  yArray->InsertNextValue(2.0);\n\n  vtkNew<vtkDoubleArray> zArray;\n  zArray->InsertNextValue(0.0);\n  zArray->InsertNextValue(5.0);\n\n  grid->SetXCoordinates(xArray);\n  grid->SetYCoordinates(yArray);\n  grid->SetZCoordinates(zArray);\n\n  vtkNew<vtkShrinkFilter> shrinkFilter;\n  shrinkFilter->SetInputData(grid);\n  shrinkFilter->SetShrinkFactor(.8);\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrinkFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VisualizeRectilinearGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->GetActiveCamera()->Roll(10.0);\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/RectilinearGrid/VisualizeRectilinearGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeRectilinearGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeRectilinearGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeRectilinearGrid MACOSX_BUNDLE VisualizeRectilinearGrid.cxx )\n  target_link_libraries(VisualizeRectilinearGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeRectilinearGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/RectilinearGrid/VisualizeRectilinearGrid/#download-and-build-visualizerectilineargrid","title":"Download and Build VisualizeRectilinearGrid","text":"

Click here to download VisualizeRectilinearGrid and its CMakeLists.txt file. Once the tarball VisualizeRectilinearGrid.tar has been downloaded and extracted,

cd VisualizeRectilinearGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VisualizeRectilinearGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/RenderMan/PolyDataRIB/","title":"PolyDataRIB","text":"

vtk-examples/Cxx/RenderMan/PolyDataRIB

"},{"location":"Cxx/RenderMan/PolyDataRIB/#description","title":"Description","text":"

To see the RenderMan results for this example, download and install the non-commercial version of RenderMan.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/RenderMan/PolyDataRIB/#code","title":"Code","text":"

PolyDataRIB.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRIBExporter.h>\n#include <vtkRIBProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n// static vtkSmartPointer<vtkRIBProperty> spatter(const char *sizes,\n//                                                const char *specksize,\n//                                                const char *spattercolor,\n//                                                const char *basecolor);\nnamespace {\nvtkSmartPointer<vtkRIBProperty> rmarble(const char* veining);\n}\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse command line arguments\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtp) [freqency]\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  const char* freq = \"1\";\n  if (argc > 2)\n  {\n    freq = argv[2];\n  }\n\n  std::string filename = argv[1];\n  std::string prefix =\n      vtksys::SystemTools::GetFilenameWithoutExtension(filename);\n\n  // Read all the data from the file\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(reader->GetOutputPort());\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  auto marble = rmarble(freq);\n  actor->SetProperty(marble);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolyDataRIB\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Generate an interesting view\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  prefix = prefix + \"_\" + freq;\n  vtkNew<vtkRIBExporter> aRib;\n  aRib->BackgroundOn();\n  aRib->SetInput(renderWindow);\n  aRib->SetFilePrefix(prefix.c_str());\n  aRib->Write();\n  std::cout << \"Exported RIB file is: \" << prefix << \".rib\" << std::endl;\n  if (getenv(\"RMANTREE\") == NULL)\n  {\n    std::cout << \"To render the generated rib file, set the environment \"\n                 \"variable RMANTREE to the base of your RenderMan install\"\n              << std::endl;\n  }\n  else\n  {\n    std::string rmantree = getenv(\"RMANTREE\");\n    std::cout << \"To create a tif file run: \" << std::endl;\n    std::cout << rmantree << \"bin/prman \" << prefix << \".rib \" << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n\n// vtkSmartPointer<vtkRIBProperty> spatter(const char *sizes,\n//                                         const char *specksize,\n//                                         const char *spattercolor,\n//                                         const char *basecolor)\n// {\n//   vtkNew<vtkRIBProperty> spatterProp;\n//   spatterProp->SetVariable(\"sizes\", \"float\");\n//   spatterProp->AddVariable(\"specksize\", \"float\");\n//   spatterProp->AddVariable(\"spattercolor\", \"color\");\n//   spatterProp->AddVariable(\"basecolor\", \"color\");\n\n//   spatterProp->SetSurfaceShaderParameter(\"sizes\", sizes);\n//   spatterProp->AddSurfaceShaderParameter(\"specksize\", specksize);\n//   spatterProp->AddSurfaceShaderParameter(\"spattercolor\", spattercolor);\n//   spatterProp->AddSurfaceShaderParameter(\"basecolor\", basecolor);\n//   spatterProp->SetSurfaceShader(\"spatter\");\n\n//   return spatterProp;\n// }\n\nnamespace {\nvtkSmartPointer<vtkRIBProperty> rmarble(const char* veining)\n{\n  vtkNew<vtkRIBProperty> rmarbleProp;\n  rmarbleProp->SetVariable(\"veining\", \"float\");\n  rmarbleProp->SetSurfaceShaderParameter(\"veining\", veining);\n  rmarbleProp->SetSurfaceShader(\"rmarble\");\n\n  return rmarbleProp;\n}\n} // namespace\n
"},{"location":"Cxx/RenderMan/PolyDataRIB/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataRIB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOExport\n  IOExportOpenGL2\n  IOExportPDF\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataRIB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataRIB MACOSX_BUNDLE PolyDataRIB.cxx )\n  target_link_libraries(PolyDataRIB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataRIB\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/RenderMan/PolyDataRIB/#download-and-build-polydatarib","title":"Download and Build PolyDataRIB","text":"

Click here to download PolyDataRIB and its CMakeLists.txt file. Once the tarball PolyDataRIB.tar has been downloaded and extracted,

cd PolyDataRIB/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PolyDataRIB\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/AmbientSpheres/","title":"AmbientSpheres","text":"

vtk-examples/Cxx/Rendering/AmbientSpheres

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/AmbientSpheres/#description","title":"Description","text":"

Note

This original source code for this example is here.

Info

Similar examples setting the diffuse and specular properties are: See DiffuseSpheres.cxx, DiffuseSpheres.py and SpecularSpheres.cxx, SpecularSpheres.py.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/AmbientSpheres/#code","title":"Code","text":"

AmbientSpheres.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"bkg\", bkg.data());\n\n  // The following lines create a sphere represented by polygons.\n  //\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(50);\n\n  // The mapper is responsible for pushing the geometry into the graphics\n  // library. It may also do color mapping, if scalars or other attributes\n  // are defined.\n  //\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  // The actor is a grouping mechanism: besides the geometry (mapper), it\n  // also has a property, transformation matrix, and/or texture map.\n  // In this example we create eight different spheres (two rows of four\n  // spheres) and set the ambient lighting coefficients. A little ambient\n  // is turned on so the sphere is not completely black on the back side.\n  //\n  // Since we are using the same sphere source and mapper for all eight spheres\n  // we will use a std::array holding the actors.\n  //\n  // If you want/need to use std::vector, then you must use\n  // std::vector<vtkSmartPointer<vtkActor>> spheres;\n  // and then, in a loop, create the object using\n  // spheres.push_back(vtkSmartPointer<vtkActor>::New());\n  //\n  // The reason:\n  // vtkNew, in contrast to vtkSmartPointer, has no assignment operator\n  // or copy constructor and owns one object for its whole lifetime.\n  // Thus vtkNew does not satisfy the CopyAssignable and CopyConstructible\n  // requirements needed for other std containers like std::vector or std::list.\n  // std::array, on the other hand, is a container encapsulating fixed size\n  // arrays so its elements do not need to be CopyAssignable and\n  // CopyConstructible.\n  //\n  // So:\n  //    std::array - vtkNew or vtkSmartPointer can be used.\n  //    std::vector, std::list - only vtkSmartPointer can be used.\n  //\n  auto const numberOfSpheres = 8;\n  std::array<vtkNew<vtkActor>, numberOfSpheres> spheres;\n  auto ambient = 0.125;\n  auto diffuse = 0.0;\n  auto specular = 0.0;\n  std::array<double, 3> position{{0, 0, 0}};\n  for (auto i = 0; i < spheres.size(); ++i)\n  {\n    spheres[i]->SetMapper(sphereMapper);\n    spheres[i]->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n    spheres[i]->GetProperty()->SetAmbient(ambient);\n    spheres[i]->GetProperty()->SetDiffuse(diffuse);\n    spheres[i]->GetProperty()->SetSpecular(specular);\n    spheres[i]->AddPosition(position.data());\n    ambient += 0.125;\n    position[0] += 1.25;\n    if (i == 3)\n    {\n      position[0] = 0;\n      position[1] = 1.25;\n    }\n  }\n\n  // Create the graphics structure. The renderer renders into the\n  // render window. The render window interactor captures mouse events\n  // and will perform appropriate camera or actor manipulation\n  // depending on the nature of the events.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  for (auto i = 0; i < numberOfSpheres; ++i)\n  {\n    ren->AddActor(spheres[i]);\n  }\n\n  ren->SetBackground(colors->GetColor3d(\"bkg\").GetData());\n  renWin->SetSize(640, 480);\n  std::cout << \"DPI: \" << renWin->GetDPI() << std::endl;\n  renWin->SetWindowName(\"AmbientSpheres\");\n\n  // Set up the lighting.\n  //\n  vtkNew<vtkLight> light;\n  light->SetFocalPoint(1.875, 0.6125, 0);\n  light->SetPosition(0.875, 1.6125, 1);\n  ren->AddLight(light);\n\n  // We want to eliminate perspective effects on the apparent lighting.\n  // Parallel camera projection will be used. To zoom in parallel projection\n  // mode, the ParallelScale is set.\n  //\n  ren->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  ren->GetActiveCamera()->SetPosition(0, 0, 1);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->GetActiveCamera()->ParallelProjectionOn();\n  ren->ResetCamera();\n  ren->GetActiveCamera()->SetParallelScale(2.0);\n  // This starts the event loop and invokes an initial render.\n  //\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/AmbientSpheres/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AmbientSpheres)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AmbientSpheres: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AmbientSpheres MACOSX_BUNDLE AmbientSpheres.cxx )\n  target_link_libraries(AmbientSpheres PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AmbientSpheres\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/AmbientSpheres/#download-and-build-ambientspheres","title":"Download and Build AmbientSpheres","text":"

Click here to download AmbientSpheres and its CMakeLists.txt file. Once the tarball AmbientSpheres.tar has been downloaded and extracted,

cd AmbientSpheres/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AmbientSpheres\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/CameraBlur/","title":"CameraBlur","text":"

vtk-examples/Cxx/Rendering/CameraBlur

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/CameraBlur/#description","title":"Description","text":"

Example of motion blur.

Info

See Figure 7-37 in Chapter 7 in the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/CameraBlur/#code","title":"Code","text":"

CameraBlur.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"Bkg\", bkg.data());\n\n  // Create the rendering objects.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the pipeline, ball and spikes.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(7);\n  sphere->SetThetaResolution(7);\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  vtkNew<vtkActor> sphereActor2;\n  sphereActor2->SetMapper(sphereMapper);\n\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(5);\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(sphere->GetOutputPort());\n  glyph->SetSourceConnection(cone->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->SetScaleFactor(0.25);\n  vtkNew<vtkPolyDataMapper> spikeMapper;\n  spikeMapper->SetInputConnection(glyph->GetOutputPort());\n  vtkNew<vtkActor> spikeActor;\n  spikeActor->SetMapper(spikeMapper);\n  vtkNew<vtkActor> spikeActor2;\n  spikeActor2->SetMapper(spikeMapper);\n\n  spikeActor->SetPosition(0, 0.7, 0);\n  sphereActor->SetPosition(0, 0.7, 0);\n  spikeActor2->SetPosition(0, -1.0, -10);\n  sphereActor2->SetPosition(0, -1.0, -10);\n  spikeActor2->SetScale(1.5, 1.5, 1.5);\n  sphereActor2->SetScale(1.5, 1.5, 1.5);\n\n  ren1->AddActor(sphereActor);\n  ren1->AddActor(spikeActor);\n  ren1->AddActor(sphereActor2);\n  ren1->AddActor(spikeActor2);\n  ren1->SetBackground(colors->GetColor3d(\"Bkg\").GetData());\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"CameraBlur\");\n  //   renWin->DoubleBufferOff();\n\n  // Do the first render and then zoom in a little.\n  renWin->Render();\n  ren1->GetActiveCamera()->SetFocalPoint(0, 0, 0.0);\n  ren1->GetActiveCamera()->Zoom(1.8);\n  ren1->GetActiveCamera()->SetFocalDisk(0.05);\n\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/CameraBlur/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraBlur)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraBlur: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraBlur MACOSX_BUNDLE CameraBlur.cxx )\n  target_link_libraries(CameraBlur PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraBlur\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/CameraBlur/#download-and-build-camerablur","title":"Download and Build CameraBlur","text":"

Click here to download CameraBlur and its CMakeLists.txt file. Once the tarball CameraBlur.tar has been downloaded and extracted,

cd CameraBlur/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CameraBlur\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/ColoredSphere/","title":"ColoredSphere","text":"

vtk-examples/Cxx/Rendering/ColoredSphere

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/ColoredSphere/#description","title":"Description","text":"

This demonstrates a simple visualization pipeline. A polygonal representation of a sphere is created with the source object (vtkSphereSource). The sphere is passed through a filter (vtkElevationFilter) that computes the height of each point of the sphere above a plane. The plane is perpendicular to the z-axis, and passes through the point (0,0,-1). The data is finally mapped (vtkDataSetMapper) through a lookup table. The mapping process converts height value into colors, and interfaces the sphere geometry to the rendering library. The mapper is assigned to an actor, and then the actor is displayed.

The execution of the pipeline occurs implicitly when we render the actor. Each actor asks its mapper to update itself. The mapper in turn asks its input to update itself. This process continues until a source object is encountered. Then the source will execute if modified since the last render.

Info

See Figure 4-19 in Chapter 4 the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/ColoredSphere/#code","title":"Code","text":"

ColoredSphere.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkElevationFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(12);\n  sphere->SetThetaResolution(12);\n\n  vtkNew<vtkElevationFilter> colorIt;\n  colorIt->SetInputConnection(sphere->GetOutputPort());\n  colorIt->SetLowPoint(0, 0, -1);\n  colorIt->SetHighPoint(0, 0, 1);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(colorIt->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ColoredSphere\");\n\n  renWin->Render();\n\n  // interact with data\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/ColoredSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColoredSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColoredSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColoredSphere MACOSX_BUNDLE ColoredSphere.cxx )\n  target_link_libraries(ColoredSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColoredSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/ColoredSphere/#download-and-build-coloredsphere","title":"Download and Build ColoredSphere","text":"

Click here to download ColoredSphere and its CMakeLists.txt file. Once the tarball ColoredSphere.tar has been downloaded and extracted,

cd ColoredSphere/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColoredSphere\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/Cone3/","title":"Cone3","text":"

vtk-examples/Cxx/Rendering/Cone3

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/Cone3/#description","title":"Description","text":"

Info

See Figure 3-27 in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/Cone3/#code","title":"Code","text":"

Cone3.cxx

//\n// This example demonstrates how to use multiple renderers within a\n// render window. It is a variation of the Cone.cxx example. Please\n// refer to that example for additional documentation.\n//\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the cone. The actor orchestrates rendering\n  // of the mapper's graphics primitives. An actor also refers to properties\n  // via a vtkProperty instance, and includes an internal transformation\n  // matrix. We set this actor's mapper to be coneMapper which we created\n  // above.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n\n  //\n  // Create two renderers and assign actors to them. A renderer renders into\n  // a viewport within the vtkRenderWindow. It is part or all of a window on\n  // the screen and it is responsible for drawing the actors it has.  We also\n  // set the background color here. In this example we are adding the same\n  // actor to two different renderers; it is okay to add different actors to\n  // different renderers as well.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->SetViewport(0.0, 0.0, 0.5, 1.0);\n\n  vtkNew<vtkRenderer> ren2;\n  ren2->AddActor(coneActor);\n  ren2->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n  ren2->SetViewport(0.5, 0.0, 1.0, 1.0);\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->AddRenderer(ren2);\n  renWin->SetSize(600, 300);\n  renWin->SetWindowName(\"Cone3\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  //\n  // Make one view 90 degrees from other.\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(90);\n\n  //\n  // Now we loop over 60 degrees and render the cone each time.\n  //\n  for (int i = 0; i < 60; ++i)\n  {\n    // render the image\n    renWin->Render();\n    // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth(1);\n    ren2->GetActiveCamera()->Azimuth(1);\n  }\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/Cone3/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cone3)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cone3: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cone3 MACOSX_BUNDLE Cone3.cxx )\n  target_link_libraries(Cone3 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cone3\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/Cone3/#download-and-build-cone3","title":"Download and Build Cone3","text":"

Click here to download Cone3 and its CMakeLists.txt file. Once the tarball Cone3.tar has been downloaded and extracted,

cd Cone3/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cone3\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/Cone4/","title":"Cone4","text":"

vtk-examples/Cxx/Rendering/Cone4

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/Cone4/#description","title":"Description","text":"

This example modifies vtkActor's properties and transformation matrix.

Info

See Figure 3-28 in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/Cone4/#code","title":"Code","text":"

Cone4.cxx

//\n// This example demonstrates the creation of multiple actors and the\n// manipulation of their properties and transformations. It is a\n// derivative of Cone.tcl, see that example for more information.\n//\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Next we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the first cone. The actor's properties are\n  // modified to give it different surface properties. By default, an actor\n  // is create with a property so the GetProperty() method can be used.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  coneActor->GetProperty()->SetDiffuse(0.7);\n  coneActor->GetProperty()->SetSpecular(0.4);\n  coneActor->GetProperty()->SetSpecularPower(20);\n\n  //\n  // Create a property and directly manipulate it. Assign it to the\n  // second actor.\n  //\n  vtkNew<vtkProperty> property;\n  property->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  property->SetDiffuse(0.7);\n  property->SetSpecular(0.4);\n  property->SetSpecularPower(20);\n\n  //\n  // Create a second actor and a property. The property is directly\n  // manipulated and then assigned to the actor. In this way, a single\n  // property can be shared among many actors. Note also that we use the\n  // same mapper as the first actor did. This way we avoid duplicating\n  // geometry, which may save lots of memory if the geoemtry is large.\n  vtkNew<vtkActor> coneActor2;\n  coneActor2->SetMapper(coneMapper);\n  coneActor2->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  coneActor2->SetProperty(property);\n  coneActor2->SetPosition(0, 2, 0);\n\n  //\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the background\n  // color here.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->AddActor(coneActor2);\n  ren1->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"Cone4\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  //\n  // Now we loop over 60 degrees and render the cone each time.\n  //\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->ResetCamera();\n  for (int i = 0; i < 60; ++i)\n  {\n    // render the image\n    renWin->Render();\n    // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth(1);\n  }\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/Cone4/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cone4)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cone4: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cone4 MACOSX_BUNDLE Cone4.cxx )\n  target_link_libraries(Cone4 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cone4\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/Cone4/#download-and-build-cone4","title":"Download and Build Cone4","text":"

Click here to download Cone4 and its CMakeLists.txt file. Once the tarball Cone4.tar has been downloaded and extracted,

cd Cone4/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cone4\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/DiffuseSpheres/","title":"DiffuseSpheres","text":"

vtk-examples/Cxx/Rendering/DiffuseSpheres

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/DiffuseSpheres/#description","title":"Description","text":"

Note

This original source code for this example is here.

Info

Similar examples setting the ambient and specular properties are: See AmbientSpheres.cxx, AmbientSpheres.py, AmbientSpheres.java and SpecularSpheres.cxx, SpecularSpheres.py.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/DiffuseSpheres/#code","title":"Code","text":"

DiffuseSpheres.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"bkg\", bkg.data());\n\n  // The following lines create a sphere represented by polygons.\n  //\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(50);\n\n  // The mapper is responsible for pushing the geometry into the graphics\n  // library. It may also do color mapping, if scalars or other attributes\n  // are defined.\n  //\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  // The actor is a grouping mechanism: besides the geometry (mapper), it\n  // also has a property, transformation matrix, and/or texture map.\n  // In this example we create eight different spheres (two rows of four\n  // spheres) and set the diffuse lighting coefficients. A little ambient\n  // is turned on so the sphere is not completely black on the back side.\n  //\n  // Since we are using the same sphere source and mapper for all eight spheres\n  // we will use a std::array holding the actors.\n  //\n  // If you want/need to use std::vector, then you must use\n  // std::vector<vtkSmartPointer<vtkActor>> spheres;\n  // and then, in a loop, create the object using\n  // spheres.push_back(vtkSmartPointer<vtkActor>::New());\n  //\n  // The reason:\n  // vtkNew, in contrast to vtkSmartPointer, has no assignment operator\n  // or copy constructor and owns one object for its whole lifetime.\n  // Thus vtkNew does not satisfy the CopyAssignable and CopyConstructible\n  // requirements needed for other std containers like std::vector or std::list.\n  // std::array, on the other hand, is a container encapsulating fixed size\n  // arrays so its elements do not need to be CopyAssignable and\n  // CopyConstructible.\n  //\n  // So:\n  //    std::array - vtkNew or vtkSmartPointer can be used.\n  //    std::vector, std::list - only vtkSmartPointer can be used.\n  //\n  auto const numberOfSpheres = 8;\n  std::array<vtkNew<vtkActor>, numberOfSpheres> spheres;\n  auto ambient = 0.3;\n  auto diffuse = 0.0;\n  auto specular = 0.0;\n  std::array<double, 3> position{{0, 0, 0}};\n  for (auto i = 0; i < spheres.size(); ++i)\n  {\n    spheres[i]->SetMapper(sphereMapper);\n    spheres[i]->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n    spheres[i]->GetProperty()->SetAmbient(ambient);\n    spheres[i]->GetProperty()->SetDiffuse(diffuse);\n    spheres[i]->GetProperty()->SetSpecular(specular);\n    spheres[i]->AddPosition(position.data());\n    std::cout << diffuse << std::endl;\n    diffuse += 0.125;\n    position[0] += 1.25;\n    if (i == 3)\n    {\n      position[0] = 0;\n      position[1] = 1.25;\n    }\n  }\n\n  // Create the graphics structure. The renderer renders into the\n  // render window. The render window interactor captures mouse events\n  // and will perform appropriate camera or actor manipulation\n  // depending on the nature of the events.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  for (auto i = 0; i < numberOfSpheres; ++i)\n  {\n    ren->AddActor(spheres[i]);\n  }\n\n  ren->SetBackground(colors->GetColor3d(\"bkg\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"DiffuseSpheres\");\n\n  // Set up the lighting.\n  //\n  vtkNew<vtkLight> light;\n  light->SetFocalPoint(1.875, 0.6125, 0);\n  light->SetPosition(0.875, 1.6125, 1);\n  ren->AddLight(light);\n\n  // We want to eliminate perspective effects on the apparent lighting.\n  // Parallel camera projection will be used. To zoom in parallel projection\n  // mode, the ParallelScale is set.\n  //\n  ren->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  ren->GetActiveCamera()->SetPosition(0, 0, 1);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->GetActiveCamera()->ParallelProjectionOn();\n  ren->ResetCamera();\n  ren->GetActiveCamera()->SetParallelScale(2.0);\n  // This starts the event loop and invokes an initial render.\n  //\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/DiffuseSpheres/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DiffuseSpheres)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DiffuseSpheres: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DiffuseSpheres MACOSX_BUNDLE DiffuseSpheres.cxx )\n  target_link_libraries(DiffuseSpheres PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DiffuseSpheres\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/DiffuseSpheres/#download-and-build-diffusespheres","title":"Download and Build DiffuseSpheres","text":"

Click here to download DiffuseSpheres and its CMakeLists.txt file. Once the tarball DiffuseSpheres.tar has been downloaded and extracted,

cd DiffuseSpheres/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DiffuseSpheres\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/FlatVersusGouraud/","title":"FlatVersusGouraud","text":"

vtk-examples/Cxx/Rendering/FlatVersusGouraud

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/FlatVersusGouraud/#description","title":"Description","text":"

Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look.

In this example, the flat and gouraud images for each pair have linked cameras. Rotate and zoom a pair to get a better look at the differences.

Info

See Figure 3-7 in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/FlatVersusGouraud/#code","title":"Code","text":"

FlatVersusGouraud.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid CreateSphere(vtkRenderer*, bool);\nvoid CreateCylinder(vtkRenderer*, bool);\nvoid CreateIsoSurface(vtkRenderer*, bool);\nvoid CreateModel(vtkRenderer*, bool, char*);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename\" << std::endl;\n    std::cout << \"where: filename is the file cow.obj\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  // Create the 8 renderers\n  vtkNew<vtkRenderer> flatSphereRenderer;\n  renderers.push_back(flatSphereRenderer);\n  vtkNew<vtkRenderer> flatCylinderRenderer;\n  renderers.push_back(flatCylinderRenderer);\n  vtkNew<vtkRenderer> flatIsoSurfaceRenderer;\n  renderers.push_back(flatIsoSurfaceRenderer);\n  vtkNew<vtkRenderer> flatModelRenderer;\n  renderers.push_back(flatModelRenderer);\n  vtkNew<vtkRenderer> smoothSphereRenderer;\n  renderers.push_back(smoothSphereRenderer);\n  vtkNew<vtkRenderer> smoothCylinderRenderer;\n  renderers.push_back(smoothCylinderRenderer);\n  vtkNew<vtkRenderer> smoothIsoSurfaceRenderer;\n  renderers.push_back(smoothIsoSurfaceRenderer);\n  vtkNew<vtkRenderer> smoothModelRenderer;\n  renderers.push_back(smoothModelRenderer);\n\n  // Add the actors\n  CreateSphere(flatSphereRenderer, true);\n  CreateCylinder(flatCylinderRenderer, true);\n  CreateIsoSurface(flatIsoSurfaceRenderer, true);\n  CreateModel(flatModelRenderer, true, argv[1]);\n\n  CreateSphere(smoothSphereRenderer, false);\n  CreateCylinder(smoothCylinderRenderer, false);\n  CreateIsoSurface(smoothIsoSurfaceRenderer, false);\n  CreateModel(smoothModelRenderer, false, argv[1]);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"FlatVersusGouraud\");\n\n  // Setup viewports for the renderers\n  int rendererSize = 256;\n  unsigned int xGridDimensions = 4;\n  unsigned int yGridDimensions = 2;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  for (size_t r = 0; r < renderers.size(); ++r)\n  {\n    renderers[r]->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    renderers[r]->GetActiveCamera()->Azimuth(20);\n    renderers[r]->GetActiveCamera()->Elevation(30);\n    renderers[r]->ResetCamera();\n    if (r > 3)\n    {\n      renderers[r]->SetActiveCamera(renderers[r - 4]->GetActiveCamera());\n    }\n    renderWindow->AddRenderer(renderers[r]);\n  }\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateSphere(vtkRenderer* renderer, bool flat)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkSphereSource> sphere;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n  if (flat)\n  {\n    actor->GetProperty()->SetInterpolationToFlat();\n  }\n  else\n  {\n    actor->GetProperty()->SetInterpolationToGouraud();\n  }\n  renderer->AddActor(actor);\n}\n\nvoid CreateCylinder(vtkRenderer* renderer, bool flat)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkCylinderSource> cylinder;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cylinder->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n  if (flat)\n  {\n    actor->GetProperty()->SetInterpolationToFlat();\n  }\n  else\n  {\n    actor->GetProperty()->SetInterpolationToGouraud();\n  }\n  renderer->AddActor(actor);\n}\n\nvoid CreateIsoSurface(vtkRenderer* renderer, bool flat)\n{\n  double range[2];\n  // Sample quadric function\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 2, 3, 0, 1, 0, 0, 0, 0, 0);\n\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(25, 25, 25);\n  sample->SetImplicitFunction(quadric);\n\n  // Generate implicit surface\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(sample->GetOutputPort());\n  range[0] = 1.0;\n  range[1] = 6.0;\n  contour->GenerateValues(5, range);\n\n  // Map contour\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contour->GetOutputPort());\n  contourMapper->SetScalarRange(0, 7);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(contourMapper);\n  if (flat)\n  {\n    actor->GetProperty()->SetInterpolationToFlat();\n  }\n  else\n  {\n    actor->GetProperty()->SetInterpolationToGouraud();\n  }\n  renderer->AddActor(actor);\n  return;\n}\n\nvoid CreateModel(vtkRenderer* renderer, bool flat, char* fileName)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkOBJReader> reader;\n  reader->SetFileName(fileName);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tan\").GetData());\n  if (flat)\n  {\n    actor->GetProperty()->SetInterpolationToFlat();\n  }\n  else\n  {\n    actor->GetProperty()->SetInterpolationToGouraud();\n  }\n  renderer->AddActor(actor);\n}\n} // namespace\n
"},{"location":"Cxx/Rendering/FlatVersusGouraud/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FlatVersusGouraud)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FlatVersusGouraud: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FlatVersusGouraud MACOSX_BUNDLE FlatVersusGouraud.cxx )\n  target_link_libraries(FlatVersusGouraud PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FlatVersusGouraud\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/FlatVersusGouraud/#download-and-build-flatversusgouraud","title":"Download and Build FlatVersusGouraud","text":"

Click here to download FlatVersusGouraud and its CMakeLists.txt file. Once the tarball FlatVersusGouraud.tar has been downloaded and extracted,

cd FlatVersusGouraud/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FlatVersusGouraud\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/GradientBackground/","title":"GradientBackground","text":"

vtk-examples/Cxx/Rendering/GradientBackground

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/GradientBackground/#description","title":"Description","text":"

Demonstrates the gradient backgrounds available in VTK.

The gradient background modes are:

  • Vertical
  • Horizontal
  • Radial Farthest Side
  • Radial Farthest Corner

The user can also edit the code to change the stop colors marking the beginning and end points in a gradient.

An option is provided for the user to read in a data file so that more interesting objects can be viewed.

The viewport border can also be set and colored.

For more information, see New in VTK 9.3: Radial Gradient Background

!!! note VTK 9.3 or later is required.

!!! note The C++ version requires C++ 17 or later as std::filesystem is used.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/GradientBackground/#code","title":"Code","text":"

GradientBackground.cxx

// Based on:\n//  https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/Core/Testing/Cxx/TestGradientBackground.cxx?ref_type=heads\n// See:\n//  [New in VTK 9.3: Radial Gradient\n//  Background](https://www.kitware.com/new-in-vtk-9-3-radial-gradient-background/)\n\n#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkColor.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkViewport.h>\n#include <vtk_cli11.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyDataMapper2D.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty2D.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <string>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\n/**\n * @brief ReadPolyData Read from a file containing vtkPolyData.\n *\n * ReadPolyData\n *    If the path is empty a cone is returned.\n *    If the extension is unknown a sphere is returned.\n *\n * @param path - The std::filesystem path to the file.\n * @return The vtkPolyData.\n */\nvtkNew<vtkPolyData> ReadPolyData(fs::path const& path);\n\n/**\n * @brief ViewportBorder Set a border around a viewport.\n *\n * @param renderer - The renderer corresponding to the viewport.\n * @param sides - A boolean array corresponding to [top, left, bottom, right].\n * @param borderColor - The color of the border.\n * @param borderWidth - The width of the border.\n */\nvoid ViewportBorder(vtkRenderer* renderer, const std::array<bool, 4>& sides,\n                    std::string const& borderColor,\n                    double const& borderWidth = 2);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n\n  CLI::App app{\"Demonstrates the background shading options.\"};\n\n  // Define options\n  std::string fileName{\"\"};\n  app.add_option(\"fileName\", fileName,\n                 \"A optional path to a file that contains vtkPolyData e.g. \"\n                 \"star-wars-vader-tie-fighter.obj\");\n  CLI11_PARSE(app, argc, argv);\n\n  auto path = fs::path(fileName);\n  if (!path.empty())\n  {\n    if (!fs::is_regular_file(path))\n    {\n      std::cerr << \"Unable to find: \" << path << std::endl;\n      return EXIT_FAILURE;\n    }\n  }\n\n  auto pd = ReadPolyData(path);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"GradientBackground\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<vtkRenderer> renderers[4];\n\n  // For each gradient specify the mode.\n  vtkViewport::GradientModes modes[4] = {\n      vtkViewport::GradientModes::VTK_GRADIENT_VERTICAL,\n      vtkViewport::GradientModes::VTK_GRADIENT_HORIZONTAL,\n      vtkViewport::GradientModes::VTK_GRADIENT_RADIAL_VIEWPORT_FARTHEST_SIDE,\n      vtkViewport::GradientModes::VTK_GRADIENT_RADIAL_VIEWPORT_FARTHEST_CORNER,\n  };\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(pd);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Honeydew\").GetData());\n  actor->GetProperty()->SetSpecular(0.3);\n  actor->GetProperty()->SetSpecularPower(60.0);\n\n  const auto renWidth = 640;\n  const auto renHeight = 480;\n\n  // The bounds for each view port.\n  double xmins[4] = {0.0, 0.5, 0.0, 0.5};\n  double ymins[4] = {0.0, 0.0, 0.5, 0.5};\n  double xmaxs[4] = {0.5, 1.0, 0.5, 1.0};\n  double ymaxs[4] = {0.5, 0.5, 1.0, 1.0};\n\n  // Here we select and name the colors.\n  // Feel free to change colors.\n  const auto bottomColor = colors->GetColor3d(\"Gold\");\n  const auto topColor = colors->GetColor3d(\"OrangeRed\");\n  const auto leftColor = colors->GetColor3d(\"Gold\");\n  const auto rightColor = colors->GetColor3d(\"OrangeRed\");\n  const auto centerColor = colors->GetColor3d(\"Gold\");\n  const auto sideColor = colors->GetColor3d(\"OrangeRed\");\n  const auto cornerColor = colors->GetColor3d(\"OrangeRed\");\n\n  const std::array<std::string, 4> viewportTitle{\"Vertical\", \"Horizontal\",\n                                                 \"Radial Farthest Side\",\n                                                 \"Radial Farthest Corner\"};\n\n  // Create one text property for all.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetJustificationToCentered();\n  textProperty->SetFontSize(renHeight / 12);\n  textProperty->SetColor(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkTextMapper> textMappers[4];\n  vtkNew<vtkActor2D> textActors[4];\n\n  // Define borders for the viewports {top, left, bottom, right}.\n  std::array<bool, 4> lb{false, true, true, false};\n  std::array<bool, 4> lbr{false, true, true, true};\n  std::array<bool, 4> tlb{true, true, true, false};\n  std::array<bool, 4> tlbr{true, true, true, true};\n  std::string borderColor = \"DarkGreen\";\n  auto borderWidth = 4.0;\n\n  for (int i = 0; i < 4; ++i)\n  {\n    auto textMapper = textMappers[i].Get();\n    textMapper->SetInput(viewportTitle[i].c_str());\n    textMapper->SetTextProperty(textProperty);\n\n    auto textActor = textActors[i].Get();\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(renWidth / 2, 8);\n\n    auto ren = renderers[i].Get();\n    ren->AddActor(textActor);\n    ren->AddActor(actor);\n    ren->GradientBackgroundOn();\n    ren->SetGradientMode(modes[i]);\n\n    ren->SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i]);\n\n    switch (i)\n    {\n    case 0:\n    default:\n      // Vertical\n      ren->SetBackground(bottomColor.GetData());\n      ren->SetBackground2(topColor.GetData());\n      ViewportBorder(ren, lb, borderColor, borderWidth);\n      break;\n    case 1:\n      // Horizontal\n      ren->SetBackground(leftColor.GetData());\n      ren->SetBackground2(rightColor.GetData());\n      ViewportBorder(ren, lbr, borderColor, borderWidth);\n      break;\n    case 2:\n      // Radial Farthest Side\n      ren->SetBackground(centerColor.GetData());\n      ren->SetBackground2(sideColor.GetData());\n      ViewportBorder(ren, tlb, borderColor, borderWidth);\n      break;\n    case 3:\n      // Radial Farthest Corner\n      ren->SetBackground(centerColor.GetData());\n      ren->SetBackground2(cornerColor.GetData());\n      ViewportBorder(ren, tlbr, borderColor, borderWidth);\n      break;\n    }\n\n    renWin->AddRenderer(ren);\n  }\n\n  renWin->SetInteractor(iRen);\n  renWin->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  iRen->Initialize();\n  iRen->UpdateSize(renWidth * 2, renHeight * 2);\n\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkNew<vtkPolyData> ReadPolyData(fs::path const& path)\n{\n\n  vtkNew<vtkPolyData> polyData;\n\n  if (path.empty())\n  {\n    // Default to a cone if the path is empty.\n    vtkNew<vtkConeSource> source;\n    source->SetResolution(25);\n    source->SetDirection(0, 1, 0);\n    source->SetHeight(1);\n    source->Update();\n    polyData->DeepCopy(source->GetOutput());\n    return polyData;\n  }\n\n  std::string extension = path.extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else\n  {\n    std::cerr << \"Warning: \" << path\n              << \" unknown extension, using a sphere instead.\" << std::endl;\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(50);\n    source->SetThetaResolution(50);\n    source->Update();\n    polyData->DeepCopy(source->GetOutput());\n  }\n  return polyData;\n}\n\nvoid ViewportBorder(vtkRenderer* renderer, std::array<bool, 4> const& sides,\n                    std::string const& borderColor, double const& borderWidth)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Points start at upper right and proceed anti-clockwise.\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  vtkNew<vtkCellArray> cells;\n  cells->Initialize();\n\n  if (sides[0])\n  {\n    // Top\n    vtkNew<vtkPolyLine> top;\n    top->GetPointIds()->SetNumberOfIds(2);\n    top->GetPointIds()->SetId(0, 0);\n    top->GetPointIds()->SetId(1, 1);\n    cells->InsertNextCell(top);\n  }\n  if (sides[1])\n  {\n    // Left\n    vtkNew<vtkPolyLine> left;\n    left->GetPointIds()->SetNumberOfIds(2);\n    left->GetPointIds()->SetId(0, 1);\n    left->GetPointIds()->SetId(1, 2);\n    cells->InsertNextCell(left);\n  }\n  if (sides[2])\n  {\n    // Bottom\n    vtkNew<vtkPolyLine> bottom;\n    bottom->GetPointIds()->SetNumberOfIds(2);\n    bottom->GetPointIds()->SetId(0, 2);\n    bottom->GetPointIds()->SetId(1, 3);\n    cells->InsertNextCell(bottom);\n  }\n  if (sides[3])\n  {\n    // Right\n    vtkNew<vtkPolyLine> right;\n    right->GetPointIds()->SetNumberOfIds(2);\n    right->GetPointIds()->SetId(0, 3);\n    right->GetPointIds()->SetId(1, 0);\n    cells->InsertNextCell(right);\n  }\n\n  // Now make the polydata and display it.\n  vtkNew<vtkPolyData> poly;\n  poly->Initialize();\n  poly->SetPoints(points);\n  poly->SetLines(cells);\n\n  // Use normalized viewport coordinates since\n  // they are independent of window size.\n  vtkNew<vtkCoordinate> coordinate;\n  coordinate->SetCoordinateSystemToNormalizedViewport();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(poly);\n  mapper->SetTransformCoordinate(coordinate);\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(borderColor).GetData());\n\n  // Line width should be at least 2 to be visible at extremes.\n  actor->GetProperty()->SetLineWidth(borderWidth);\n  renderer->AddViewProp(actor);\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/GradientBackground/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GradientBackground)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GradientBackground: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GradientBackground MACOSX_BUNDLE GradientBackground.cxx )\n  target_link_libraries(GradientBackground PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GradientBackground\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/GradientBackground/#download-and-build-gradientbackground","title":"Download and Build GradientBackground","text":"

Click here to download GradientBackground and its CMakeLists.txt file. Once the tarball GradientBackground.tar has been downloaded and extracted,

cd GradientBackground/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GradientBackground\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/HiddenLineRemoval/","title":"HiddenLineRemoval","text":"

vtk-examples/Cxx/Rendering/HiddenLineRemoval

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/HiddenLineRemoval/#code","title":"Code","text":"

HiddenLineRemoval.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // e.g. file cow.obj\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  backProp->SetSpecular(0.6);\n  backProp->SetSpecularPower(30);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProp);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(0.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HiddenLineRemoval\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Rendering/HiddenLineRemoval/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HiddenLineRemoval)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HiddenLineRemoval: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HiddenLineRemoval MACOSX_BUNDLE HiddenLineRemoval.cxx )\n  target_link_libraries(HiddenLineRemoval PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HiddenLineRemoval\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/HiddenLineRemoval/#download-and-build-hiddenlineremoval","title":"Download and Build HiddenLineRemoval","text":"

Click here to download HiddenLineRemoval and its CMakeLists.txt file. Once the tarball HiddenLineRemoval.tar has been downloaded and extracted,

cd HiddenLineRemoval/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HiddenLineRemoval\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/InterpolateCamera/","title":"InterpolateCamera","text":"

vtk-examples/Cxx/Rendering/InterpolateCamera

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/InterpolateCamera/#description","title":"Description","text":"

This example uses vtkCameraInterpolator to generate a smooth interpolation between camera views. The key points for the cameras' positions are generated from the vtkPolyData's bounding box. The cameras' focal points are at the center of the polydata.

The key points are computed from the corners of the bounding box. They are pushed out along a vector from the center to the corner point. The amount of pushing is a random multiplier of the range of the data.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/InterpolateCamera/#code","title":"Code","text":"

InterpolateCamera.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCameraInterpolator.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <array>\n#include <chrono>\n#include <iterator>\n// #include <random>\n#include <thread>\n#include <vector>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n\nvoid ComputeKeyPoints(vtkPolyData* polyData, std::array<double, 3>& center,\n                      std::vector<std::array<double, 3>>& keyPoints);\n\ntemplate <class T, std::size_t N>\nostream& operator<<(ostream& o, const std::array<T, N>& arr)\n{\n  copy(arr.cbegin(), arr.cend(), std::ostream_iterator<T>(o, \", \"));\n  return o;\n}\n\ntemplate <class T, std::size_t N>\nostream& operator<<(ostream& o, const std::vector<T>& vec)\n{\n  copy(vec.cbegin(), vec.cend(), std::ostream_iterator<T>(o, \", \"));\n  return o;\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Setup camera views for interpolation\n  vtkNew<vtkCameraInterpolator> interpolator;\n  interpolator->SetInterpolationTypeToSpline();\n\n  std::array<double, 3> center;\n  std::vector<std::array<double, 3>> keyPoints;\n  ComputeKeyPoints(polyData, center, keyPoints);\n\n  for (size_t i = 0; i < keyPoints.size() + 1; ++i)\n  {\n    // auto j = i;\n    vtkNew<vtkCamera> cam;\n    cam->SetFocalPoint(center.data());\n    if (i < keyPoints.size())\n    {\n      cam->SetPosition(keyPoints[i].data());\n    }\n    else\n    {\n      cam->SetPosition(keyPoints[0].data());\n    }\n    cam->SetViewUp(0.0, 0.0, 1.0);\n    interpolator->AddCamera((double)i, cam);\n  }\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  backProp->SetDiffuse(.76);\n  backProp->SetSpecular(.4);\n  backProp->SetSpecularPower(30);\n  ;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProp);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(.6);\n  actor->GetProperty()->SetSpecularPower(30);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"InterpolateCamera\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  renderer->SetActiveCamera(camera);\n\n  auto numSteps = 600;\n  auto minT = interpolator->GetMinimumT();\n  auto maxT = interpolator->GetMaximumT();\n  for (auto i = 0; i < numSteps; ++i)\n  {\n    double t = (double)i * (maxT - minT) / (double)(numSteps - 1);\n    interpolator->InterpolateCamera(t, camera);\n    renderer->ResetCameraClippingRange();\n    renderWindow->Render();\n    std::this_thread::sleep_for(std::chrono::milliseconds(50));\n  }\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid ComputeKeyPoints(vtkPolyData* polyData, std::array<double, 3>& center,\n                      std::vector<std::array<double, 3>>& keyPoints)\n{\n  // std::mt19937 mt(4355412); // Standard mersenne_twister_engine\n  // std::uniform_real_distribution<double> dis(1.0, 3.0);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(4355412);\n\n  // Get Bounding Box\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n\n  double range;\n  range = std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n                   bounds[5] - bounds[3]);\n\n  std::vector<std::array<double, 3>> points(8);\n  std::array<double, 3> point;\n  point = {{bounds[0], bounds[2], bounds[4]}};\n  points[0] = point;\n\n  point = {{bounds[1], bounds[2], bounds[4]}};\n  points[1] = point;\n\n  point = {{bounds[1], bounds[2], bounds[5]}};\n  points[2] = point;\n\n  point = {{bounds[0], bounds[2], bounds[5]}};\n  points[3] = point;\n\n  point = {{bounds[0], bounds[3], bounds[4]}};\n  points[4] = point;\n\n  point = {{bounds[1], bounds[3], bounds[4]}};\n  points[5] = point;\n\n  point = {{bounds[1], bounds[3], bounds[5]}};\n  points[6] = point;\n\n  point = {{bounds[0], bounds[3], bounds[5]}};\n  points[7] = point;\n\n  polyData->GetCenter(center.data());\n\n  for (size_t i = 0; i < points.size(); ++i)\n  {\n    std::array<double, 3> direction;\n    for (auto j = 0; j < 3; ++j)\n    {\n      direction[j] = points[i][j] - center[j];\n    }\n    vtkMath::Normalize(direction.data());\n    // double factor = dis(mt);\n    double factor = randomSequence->GetRangeValue(1.0, 3.0);\n    randomSequence->Next();\n    keyPoints.resize(8);\n    for (auto j = 0; j < 3; ++j)\n    {\n      keyPoints[i][j] = points[i][j] + direction[j] * range * factor;\n    }\n  }\n}\n} // namespace\n
"},{"location":"Cxx/Rendering/InterpolateCamera/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InterpolateCamera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InterpolateCamera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InterpolateCamera MACOSX_BUNDLE InterpolateCamera.cxx )\n  target_link_libraries(InterpolateCamera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InterpolateCamera\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/InterpolateCamera/#download-and-build-interpolatecamera","title":"Download and Build InterpolateCamera","text":"

Click here to download InterpolateCamera and its CMakeLists.txt file. Once the tarball InterpolateCamera.tar has been downloaded and extracted,

cd InterpolateCamera/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./InterpolateCamera\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/LayeredActors/","title":"LayeredActors","text":"

vtk-examples/Cxx/Rendering/LayeredActors

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/LayeredActors/#description","title":"Description","text":"

Demonstrates the use of two renderers in a render window. Notice that the second (and subsequent) renderers will have a transparent background.

The first layer (layer 0) contains the base object, a slab in this case. The second layer (layer 1) contains an object (axes in this case). This axes object will always be in front of the base layer object. When the program runs, the top-most layer will be the active layer, layer 1 in this case.

Two callbacks are provided, the first callback selects which layer is active:

  • Pressing 0 on the keyboard will let you manipulate the objects in layer 0.
  • Pressing 1 on the keyboard will let you manipulate the objects in layer 1.

The second callback allows you to orient objects in all layers using the object in the active layer.

Note

Objects in the top-most layer will always be in front of any objects in other layers.

Info

This is an extension of the TransparentBackground.cxx and TransparentBackground.py examples, extended by adding an extra callback so that the non-active layer objects move in conjunction with the active layer objects.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/LayeredActors/#code","title":"Code","text":"

LayeredActors.cxx

#include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkInteractorObserver.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkTransform.h>\n\n#include <array>\n#include <cstdlib>\n#include <iostream>\n\nnamespace {\n/**\n * Copy an array to the internal buffer within the vector class.\n *\n * @param arr - The array.\n * @return - The vector corresponding to the array.\n */\ntemplate <typename T>\nstd::vector<T> CopyArrayToVector(T* arr, std::size_t arr_len)\n{\n  return std::vector<T>(arr, arr + arr_len);\n}\n\n//! The positional information relating to the camera.\nstruct Orientation\n{\n  std::vector<double> position{0.0, 0.0, 0.0};\n  std::vector<double> focalPoint{0.0, 0.0, 0.0};\n  std::vector<double> viewUp{0.0, 0.0, 0.0};\n  double distance = 0;\n  std::vector<double> clipplingRange{0.0, 0.0};\n  std::vector<double> orientation{0.0, 0.0, 0.0};\n};\n\n/**\n * Select the layer to manipulate.\n */\nvoid SelectLayer(vtkObject* caller, long unsigned int eventId, void* clientData,\n                 void* callData);\n\n/**\n * Orient layer 0 based on the camera orientation in layer 1 or vice versa.\n */\nvoid OrientLayer(vtkObject* caller, long unsigned int eventId, void* clientData,\n                 void* callData);\n\n//! Get the camera orientation.\n/*\n * @param ren - the renderer.\n * @return The orientation parameters.\n */\nOrientation GetOrientation(vtkRenderer* ren);\n\n//! Set the camera orientation.\n/*\n *\n * @param ren - the renderer.\n * @param p - The orientation parameters.\n * @return\n */\nvoid SetOrientation(vtkRenderer* ren, Orientation const& p);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetXLength(4.0);\n  cubeSource->SetYLength(9.0);\n  cubeSource->SetZLength(1.0);\n  cubeSource->SetCenter(0.0, 0.0, 0.0);\n\n  // Make the slab and axes actors.\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"BurlyWood\").GetData());\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->EdgeVisibilityOn();\n  cubeActor->GetProperty()->SetLineWidth(2.0);\n  cubeActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"PapayaWhip\").GetData());\n  cubeActor->SetBackfaceProperty(back);\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 0.0, 0.0);\n\n  vtkNew<vtkAxesActor> axes;\n  // The axes can be positioned with a user transform.\n  axes->SetUserTransform(transform);\n\n  // The renderers, render window and interactor.\n  std::array<vtkNew<vtkRenderer>, 2> renderers;\n  vtkNew<vtkRenderWindow> renWin;\n  for (auto&& ren : renderers)\n  {\n    renWin->AddRenderer(ren);\n  }\n  renWin->SetSize(800, 800);\n  renWin->SetWindowName(\"LayeredActors\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  // Define the renderers and allocate them to layers.\n  // Layer 0 - background not transparent.\n  renderers[0]->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderers[0]->AddActor(cubeActor);\n  renderers[0]->SetLayer(0);\n\n  // Layer 1 - the background is transparent,\n  //       so we only see the layer 0 background color\n  renderers[1]->AddActor(axes);\n  renderers[1]->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderers[1]->SetLayer(1);\n\n  // Set a common camera view for each layer.\n  for (const auto& renderer : renderers)\n  {\n    auto camera = renderer->GetActiveCamera();\n    camera->Elevation(-30.0);\n    camera->Azimuth(-30.0);\n    renderer->ResetCamera();\n  }\n\n  // We have two layers.\n  renWin->SetNumberOfLayers(static_cast<int>(renderers.size()));\n\n  renWin->Render();\n\n  vtkNew<vtkCallbackCommand> selectLayerCB;\n  selectLayerCB->SetCallback(SelectLayer);\n  iRen->AddObserver(vtkCommand::KeyPressEvent, selectLayerCB);\n  vtkNew<vtkCallbackCommand> orientLayerCB;\n  orientLayerCB->SetCallback(OrientLayer);\n  iRen->AddObserver(vtkCommand::EndInteractionEvent, orientLayerCB);\n\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid SelectLayer(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                 void* vtkNotUsed(clientData), void* vtkNotUsed(callData))\n{\n  vtkRenderWindowInteractor* iRen =\n      static_cast<vtkRenderWindowInteractor*>(caller);\n  vtkRendererCollection* renderers = iRen->GetRenderWindow()->GetRenderers();\n  if (renderers->GetNumberOfItems() < 2)\n  {\n    std::cerr << \"We need at least two renderers, we have only \"\n              << renderers->GetNumberOfItems() << std::endl;\n    return;\n  }\n  renderers->InitTraversal();\n  // Top item.\n  vtkRenderer* ren0 = renderers->GetNextItem();\n  // Bottom item.\n  vtkRenderer* ren1 = renderers->GetNextItem();\n\n  std::string key = iRen->GetKeySym();\n\n  if (key == \"0\")\n  {\n    std::cout << \"Selected layer: \" << key << std::endl;\n    iRen->GetRenderWindow()\n        ->GetInteractor()\n        ->GetInteractorStyle()\n        ->SetDefaultRenderer(ren0);\n    ren0->InteractiveOn();\n    ren1->InteractiveOff();\n  }\n  if (key == \"1\")\n  {\n    std::cout << \"Selected layer: \" << key << std::endl;\n    iRen->GetRenderWindow()\n        ->GetInteractor()\n        ->GetInteractorStyle()\n        ->SetDefaultRenderer(ren1);\n    ren0->InteractiveOff();\n    ren1->InteractiveOn();\n  }\n}\n\nvoid OrientLayer(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                 void* vtkNotUsed(clientData), void* vtkNotUsed(callData))\n{\n  vtkRenderWindowInteractor* iRen =\n      static_cast<vtkRenderWindowInteractor*>(caller);\n  vtkRendererCollection* renderers = iRen->GetRenderWindow()->GetRenderers();\n  if (renderers->GetNumberOfItems() < 2)\n  {\n    std::cerr << \"We need at least two renderers, we have only \"\n              << renderers->GetNumberOfItems() << std::endl;\n    return;\n  }\n  renderers->InitTraversal();\n  // Top item.\n  vtkRenderer* ren0 = renderers->GetNextItem();\n  // Bottom item.\n  vtkRenderer* ren1 = renderers->GetNextItem();\n\n  if (ren1->GetInteractive())\n  {\n    auto orient1 = GetOrientation(ren1);\n    SetOrientation(ren0, orient1);\n    ren0->ResetCamera();\n  }\n  else\n  {\n    auto orient0 = GetOrientation(ren0);\n    SetOrientation(ren1, orient0);\n    ren1->ResetCamera();\n  }\n}\n\nOrientation GetOrientation(vtkRenderer* ren)\n{\n  Orientation p;\n\n  vtkCamera* camera = ren->GetActiveCamera();\n  p.position = CopyArrayToVector<double>(camera->GetPosition(), 3);\n  p.focalPoint = CopyArrayToVector<double>(camera->GetFocalPoint(), 3);\n  p.viewUp = CopyArrayToVector<double>(camera->GetViewUp(), 3);\n  p.distance = camera->GetDistance();\n  p.clipplingRange = CopyArrayToVector<double>(camera->GetClippingRange(), 2);\n  p.orientation = CopyArrayToVector<double>(camera->GetOrientation(), 3);\n\n  return p;\n}\n\nvoid SetOrientation(vtkRenderer* ren, Orientation const& p)\n{\n  vtkCamera* camera = ren->GetActiveCamera();\n  camera->SetPosition(p.position.data());\n  camera->SetFocalPoint(p.focalPoint.data());\n  camera->SetViewUp(p.viewUp.data());\n  camera->SetDistance(p.distance);\n  camera->SetClippingRange(p.clipplingRange.data());\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/LayeredActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LayeredActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LayeredActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LayeredActors MACOSX_BUNDLE LayeredActors.cxx )\n  target_link_libraries(LayeredActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LayeredActors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/LayeredActors/#download-and-build-layeredactors","title":"Download and Build LayeredActors","text":"

Click here to download LayeredActors and its CMakeLists.txt file. Once the tarball LayeredActors.tar has been downloaded and extracted,

cd LayeredActors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LayeredActors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/Mace/","title":"Mace","text":"

vtk-examples/Cxx/Rendering/Mace

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/Mace/#description","title":"Description","text":"

An example of multiple inputs and outputs.

Info

See Figure 4-21 in Chapter 4 the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/Mace/#code","title":"Code","text":"

Mace.cxx

#include <vtkConeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(8);\n  sphere->SetPhiResolution(8);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(6);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(sphere->GetOutputPort());\n  glyph->SetSourceConnection(cone->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->SetScaleFactor(0.25);\n\n  vtkNew<vtkPolyDataMapper> spikeMapper;\n  spikeMapper->SetInputConnection(glyph->GetOutputPort());\n\n  vtkNew<vtkActor> spikeActor;\n  spikeActor->SetMapper(spikeMapper);\n  spikeActor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(spikeActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"Mace\");\n\n  // interact with data\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/Mace/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Mace)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Mace: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Mace MACOSX_BUNDLE Mace.cxx )\n  target_link_libraries(Mace PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Mace\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/Mace/#download-and-build-mace","title":"Download and Build Mace","text":"

Click here to download Mace and its CMakeLists.txt file. Once the tarball Mace.tar has been downloaded and extracted,

cd Mace/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Mace\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/Model/","title":"Model","text":"

vtk-examples/Cxx/Rendering/Model

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/Model/#description","title":"Description","text":"

Info

See Figure 3-24 in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/Model/#code","title":"Code","text":"

Model.cxx

#include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> cubeColor{{250, 128, 114, 255}};\n  colors->SetColor(\"CubeColor\", cubeColor.data());\n  std::array<unsigned char, 4> bkg{{230, 230, 230, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // create rendering windows and three renderers\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderer> ren2;\n  vtkNew<vtkRenderWindow> renWindow1;\n  renWindow1->AddRenderer(ren1);\n  renWindow1->AddRenderer(ren2);\n  renWindow1->SetWindowName(\"Model\");\n\n  vtkNew<vtkRenderWindowInteractor> iren1;\n  iren1->SetRenderWindow(renWindow1);\n  vtkNew<vtkRenderer> ren3;\n  vtkNew<vtkRenderWindow> renWindow2;\n  renWindow2->AddRenderer(ren3);\n  renWindow2->SetWindowName(\"Model\");\n\n  vtkNew<vtkRenderWindowInteractor> iren2;\n  iren2->SetRenderWindow(renWindow2);\n\n  // create an actor and give it cone geometry\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(8);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // create an actor and give it cube geometry\n  vtkNew<vtkCubeSource> cube;\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cube->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"CubeColor\").GetData());\n\n  // create an actor and give it sphere geometry\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(16);\n  sphere->SetPhiResolution(16);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Melon\").GetData());\n\n  // assign our actor to both renderers\n  ren1->AddActor(coneActor);\n  ren2->AddActor(sphereActor);\n  ren3->AddActor(cubeActor);\n\n  // set the size of our window\n  renWindow1->SetSize(300, 150);\n  renWindow1->SetPosition(0, 50);\n  renWindow2->SetSize(300, 300);\n  renWindow2->SetPosition(0, 300);\n\n  // set the viewports and background of the renderers\n  ren1->SetViewport(0, 0, 0.5, 1);\n  ren1->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  ren2->SetViewport(0.5, 0, 1, 1);\n  ren2->SetBackground(colors->GetColor3d(\"Linen\").GetData());\n  ren3->SetBackground(colors->GetColor3d(\"Honeydew\").GetData());\n\n  // draw the resulting scene\n  renWindow1->Render();\n  renWindow2->Render();\n\n  iren1->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/Model/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Model)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Model: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Model MACOSX_BUNDLE Model.cxx )\n  target_link_libraries(Model PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Model\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/Model/#download-and-build-model","title":"Download and Build Model","text":"

Click here to download Model and its CMakeLists.txt file. Once the tarball Model.tar has been downloaded and extracted,

cd Model/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Model\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/MotionBlur/","title":"MotionBlur","text":"

vtk-examples/Cxx/Rendering/MotionBlur

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/MotionBlur/#description","title":"Description","text":"

Example of motin blur.

Info

See Figure 7-36 in Chapter 7 in the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/MotionBlur/#code","title":"Code","text":"

MotionBlur.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderStepsPass.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimpleMotionBlurPass.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file e.g. Armadillo.ply\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the colors.\n  std::array<unsigned char, 4> a1Diff{{255, 204, 77, 255}};\n  colors->SetColor(\"A1Diff\", a1Diff.data());\n  std::array<unsigned char, 4> a2Amb{{51, 51, 255, 255}};\n  colors->SetColor(\"A2Amb\", a2Amb.data());\n  std::array<unsigned char, 4> a2Diff{{51, 255, 204, 255}};\n  colors->SetColor(\"A2Diff\", a2Diff.data());\n  std::array<unsigned char, 4> a3Amb{{128, 166, 255, 255}};\n  colors->SetColor(\"A3Amb\", a3Amb.data());\n  std::array<unsigned char, 4> bkg{{77, 102, 153, 255}};\n  colors->SetColor(\"Bkg\", bkg.data());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Bkg\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(500, 500);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MotionBlur\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPLYReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  // Create three models.\n  {\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetAmbientColor(colors->GetColor3d(\"Red\").GetData());\n    actor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"A1Diff\").GetData());\n    actor->GetProperty()->SetSpecular(0.0);\n    actor->GetProperty()->SetDiffuse(0.5);\n    actor->GetProperty()->SetAmbient(0.3);\n    actor->SetPosition(-0.1, 0.0, -0.1);\n    renderer->AddActor(actor);\n  }\n\n  {\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetAmbientColor(\n        colors->GetColor3d(\"A2Amb\").GetData());\n    actor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"A2Diff\").GetData());\n    actor->GetProperty()->SetSpecularColor(\n        colors->GetColor3d(\"Black\").GetData());\n    actor->GetProperty()->SetSpecular(0.2);\n    actor->GetProperty()->SetDiffuse(0.9);\n    actor->GetProperty()->SetAmbient(0.1);\n    actor->GetProperty()->SetSpecularPower(10.0);\n    renderer->AddActor(actor);\n  }\n\n  {\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"A3Amb\").GetData());\n    actor->GetProperty()->SetSpecularColor(\n        colors->GetColor3d(\"White\").GetData());\n    actor->GetProperty()->SetSpecular(0.7);\n    actor->GetProperty()->SetDiffuse(0.4);\n    actor->GetProperty()->SetSpecularPower(60.0);\n    actor->SetPosition(0.1, 0.0, 0.1);\n    renderer->AddActor(actor);\n  }\n\n  renderWindow->SetMultiSamples(0);\n\n  // Create the basic VTK render steps.\n  vtkNew<vtkRenderStepsPass> basicPasses;\n\n  vtkNew<vtkSimpleMotionBlurPass> motion;\n  motion->SetDelegatePass(basicPasses);\n\n  // Tell the renderer to use our render pass pipeline.\n  vtkOpenGLRenderer* glrenderer =\n      dynamic_cast<vtkOpenGLRenderer*>(renderer.GetPointer());\n  glrenderer->SetPass(motion);\n\n  int numRenders = 30;\n\n  renderer->GetActiveCamera()->SetPosition(0, 0, -1);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(15.0);\n  renderer->GetActiveCamera()->Zoom(1.2);\n\n  renderWindow->Render();\n\n  for (int i = 0; i < numRenders; ++i)\n  {\n    renderer->GetActiveCamera()->Azimuth(10.0 / numRenders);\n    renderer->GetActiveCamera()->Elevation(10.0 / numRenders);\n    renderWindow->Render();\n  }\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/MotionBlur/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MotionBlur)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOPLY\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MotionBlur: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MotionBlur MACOSX_BUNDLE MotionBlur.cxx )\n  target_link_libraries(MotionBlur PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MotionBlur\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/MotionBlur/#download-and-build-motionblur","title":"Download and Build MotionBlur","text":"

Click here to download MotionBlur and its CMakeLists.txt file. Once the tarball MotionBlur.tar has been downloaded and extracted,

cd MotionBlur/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MotionBlur\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/OutlineGlowPass/","title":"OutlineGlowPass","text":"

vtk-examples/Cxx/Rendering/OutlineGlowPass

"},{"location":"Cxx/Rendering/OutlineGlowPass/#description","title":"Description","text":"

Demonstrates how to render an object in a scene with a glowing outline.

The class vtkOutlineGlowPass is designed to highlight parts of a scene by applying the render pass to a layered renderer on top of the main scene. For optimal results, actors that form the outline should be brightly colored with lighting disabled. The outline will have the color of the actors. There is only one outline around all objects rendered by the delegate.

When combined with layered renderers, this creates a very visible highlight without altering the highlighted object.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/OutlineGlowPass/#code","title":"Code","text":"

OutlineGlowPass.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOutlineGlowPass.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderStepsPass.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSmartPointer.h>\n#include <vtkVersion.h>\n\n#include <iomanip>\n#include <iostream>\n#include <string>\n\nnamespace {\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return True if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n} // namespace\n\nint main(int, char*[])\n{\n  if (!VTKVersionOk(9, 0, 20200909))\n  {\n    std::cerr\n        << \"You need VTK version 9.0.20200909 or greater to run this program.\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetMultiSamples(0);\n\n  iren->SetRenderWindow(renWin);\n\n  // Set up the renderers.\n  // One for the object and the other for the outline.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderer> rendererOutline;\n  rendererOutline->SetLayer(1);\n  renWin->SetNumberOfLayers(2);\n  renWin->AddRenderer(rendererOutline);\n  renWin->AddRenderer(renderer);\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n  // arrowSource->SetShaftRadius(1.0);\n  // arrowSource->SetTipLength(1.0);\n  arrowSource->Update();\n\n  // Create mapper and actor for the main renderer.\n  vtkNew<vtkPolyDataMapper> mapperMain;\n  mapperMain->SetInputConnection(arrowSource->GetOutputPort());\n\n  vtkNew<vtkActor> actorMain;\n  actorMain->SetMapper(mapperMain);\n  actorMain->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"LimeGreen\").GetData());\n\n  renderer->AddActor(actorMain);\n\n  // Lets make the outline glow!\n  // Create the render pass.\n  vtkNew<vtkRenderStepsPass> basicPasses;\n  vtkNew<vtkOutlineGlowPass> glowPass;\n  glowPass->SetDelegatePass(basicPasses);\n\n  // Apply the render pass to the highlight renderer.\n  rendererOutline->SetPass(glowPass);\n\n  // Create mapper and actor for the outline.\n  vtkNew<vtkPolyDataMapper> mapperOutline;\n  mapperOutline->SetInputConnection(arrowSource->GetOutputPort());\n\n  vtkNew<vtkActor> actorOutline;\n  actorOutline->SetMapper(mapperOutline);\n  actorOutline->GetProperty()->SetColor(\n      colors->GetColor3d(\"Magenta\").GetData());\n  actorOutline->GetProperty()->LightingOff();\n\n  rendererOutline->AddActor(actorOutline);\n\n  renWin->SetSize(600, 600);\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"DarkSlateBlue\").GetData());\n\n  renderer->ResetCamera();\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->Roll(45.0);\n  camera->Azimuth(-30.0);\n  camera->Elevation(-15.0);\n  renderer->ResetCamera();\n  // Now set the active camera for the outline.\n  rendererOutline->SetActiveCamera(camera);\n\n  renWin->SetWindowName(\"OutlineGlowPass\");\n\n  renWin->Render();\n\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n#ifndef VTK_VERSION_NUMBER\n  auto ver = vtkSmartPointer<vtkVersion>();\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  if (vtk_version_number >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#else\n  if (VTK_VERSION_NUMBER >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#endif\n}\n} // namespace\n
"},{"location":"Cxx/Rendering/OutlineGlowPass/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OutlineGlowPass)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OutlineGlowPass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OutlineGlowPass MACOSX_BUNDLE OutlineGlowPass.cxx )\n  target_link_libraries(OutlineGlowPass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OutlineGlowPass\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/OutlineGlowPass/#download-and-build-outlineglowpass","title":"Download and Build OutlineGlowPass","text":"

Click here to download OutlineGlowPass and its CMakeLists.txt file. Once the tarball OutlineGlowPass.tar has been downloaded and extracted,

cd OutlineGlowPass/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OutlineGlowPass\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/PBR_Anisotropy/","title":"PBR Anisotropy","text":"

vtk-examples/Cxx/Rendering/PBR_Anisotropy

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/PBR_Anisotropy/#description","title":"Description","text":"

This example is based on TestPBRAnisotropy.cxx and renders spheres with different anisotropy values.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Cxx/Rendering/PBR_Anisotropy/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/PBR_Anisotropy/#code","title":"Code","text":"

PBR_Anisotropy.cxx

#include <vtkActor.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkSphereSource.h>\n#include <vtkTextureMapToSphere.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Render spheres with different anisotropy values.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useEquirectangular{false};\n  app.add_flag(\"-e, --use_equirectangular\", useEquirectangular,\n               \"Use the equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useCubemap = !useEquirectangular;\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(75);\n  sphere->SetPhiResolution(75);\n\n  vtkNew<vtkTextureMapToSphere> textureMap;\n  textureMap->SetInputConnection(sphere->GetOutputPort());\n  textureMap->PreventSeamOff();\n\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(textureMap->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(tangents->GetOutputPort());\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 0.0, 0.0);\n    actorSphere->RotateX(20);\n    actorSphere->RotateY(20);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetAnisotropy(1.0);\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 1.0, 0.0);\n    actorSphere->RotateX(20);\n    actorSphere->RotateY(20);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(0.1);\n    actorSphere->GetProperty()->SetAnisotropy(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 2.0, 0.0);\n    actorSphere->RotateX(20);\n    actorSphere->RotateY(20);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(0.1);\n    actorSphere->GetProperty()->SetAnisotropy(1.0);\n    actorSphere->GetProperty()->SetAnisotropyRotation(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Anisotropy\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/PBR_Anisotropy/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Anisotropy)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  FiltersTexture\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Anisotropy: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Anisotropy MACOSX_BUNDLE PBR_Anisotropy.cxx )\n  target_link_libraries(PBR_Anisotropy PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Anisotropy\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/PBR_Anisotropy/#download-and-build-pbr_anisotropy","title":"Download and Build PBR_Anisotropy","text":"

Click here to download PBR_Anisotropy and its CMakeLists.txt file. Once the tarball PBR_Anisotropy.tar has been downloaded and extracted,

cd PBR_Anisotropy/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PBR_Anisotropy\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/PBR_Clear_Coat/","title":"PBR Clear Coat","text":"

vtk-examples/Cxx/Rendering/PBR_Clear_Coat

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/PBR_Clear_Coat/#description","title":"Description","text":"

This example is based on TestPBRClearCoat.cxx and renders a cube with custom texture mapping and a coat normal texture.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Cxx/Rendering/PBR_Clear_Coat/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/PBR_Clear_Coat/#code","title":"Code","text":"

PBR_Clear_Coat.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPNGReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkTexture.h>\n#include <vtkTriangleFilter.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\n      \"Render a cube with custom texture mapping and a coat normal texture.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useEquirectangular{false};\n  app.add_flag(\"-e, --use_equirectangular\", useEquirectangular,\n               \"Use the equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useCubemap = !useEquirectangular;\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n  ren->AutomaticLightCreationOff();\n\n  vtkNew<vtkLight> light;\n  light->SetPosition(2.0, 0.0, 2.0);\n  light->SetFocalPoint(0.0, 0.0, 0.0);\n\n  ren->AddLight(light);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n  ren->UseSphericalHarmonicsOff();\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkCubeSource> cube;\n\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(cube->GetOutputPort());\n\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(triangulation->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(tangents->GetOutputPort());\n\n  vtkNew<vtkPNGReader> materialReader;\n  materialReader->SetFileName(parameters.parameters[\"material\"].c_str());\n\n  vtkNew<vtkTexture> material;\n  material->InterpolateOn();\n  material->SetInputConnection(materialReader->GetOutputPort());\n\n  vtkNew<vtkPNGReader> albedoReader;\n  albedoReader->SetFileName(parameters.parameters[\"albedo\"].c_str());\n\n  vtkNew<vtkTexture> albedo;\n  albedo->UseSRGBColorSpaceOn();\n  albedo->InterpolateOn();\n  albedo->SetInputConnection(albedoReader->GetOutputPort());\n\n  vtkNew<vtkPNGReader> normalReader;\n  normalReader->SetFileName(parameters.parameters[\"normal\"].c_str());\n\n  // Uncomment this if you want a similar image to the VTK test image.\n  // vtkNew<vtkImageFlip> flip;\n  // flip->SetInputConnection(normalReader->GetOutputPort());\n  // flip->SetFilteredAxes(0);\n\n  vtkNew<vtkTexture> normal;\n  normal->InterpolateOn();\n  normal->SetInputConnection(normalReader->GetOutputPort());\n\n  vtkNew<vtkTexture> coatNormal;\n  coatNormal->InterpolateOn();\n  coatNormal->SetInputConnection(normalReader->GetOutputPort());\n  // Uncomment this if you want a similar image to the VTK test image.\n  // coatNormal->SetInputConnection(flip->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetOrientation(0.0, 25.0, 0.0);\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToPBR();\n\n  // Set metallic, roughness and coat strength to 1.0 as they act as multipliers\n  // with texture value.\n  actor->GetProperty()->SetMetallic(1.0);\n  actor->GetProperty()->SetRoughness(1.0);\n  actor->GetProperty()->SetCoatStrength(1.0);\n  actor->GetProperty()->SetCoatColor(colors->GetColor3d(\"Red\").GetData());\n\n  actor->GetProperty()->SetBaseColorTexture(albedo);\n  actor->GetProperty()->SetORMTexture(material);\n  actor->GetProperty()->SetNormalTexture(normal);\n  actor->GetProperty()->SetCoatNormalTexture(coatNormal);\n\n  ren->AddActor(actor);\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Clear_Coat\");\n\n  renWin->Render();\n  ren->GetActiveCamera()->Zoom(1.5);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/PBR_Clear_Coat/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Clear_Coat)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  FiltersCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Clear_Coat: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Clear_Coat MACOSX_BUNDLE PBR_Clear_Coat.cxx )\n  target_link_libraries(PBR_Clear_Coat PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Clear_Coat\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/PBR_Clear_Coat/#download-and-build-pbr_clear_coat","title":"Download and Build PBR_Clear_Coat","text":"

Click here to download PBR_Clear_Coat and its CMakeLists.txt file. Once the tarball PBR_Clear_Coat.tar has been downloaded and extracted,

cd PBR_Clear_Coat/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PBR_Clear_Coat\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/PBR_Edge_Tint/","title":"PBR Edge Tint","text":"

vtk-examples/Cxx/Rendering/PBR_Edge_Tint

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/PBR_Edge_Tint/#description","title":"Description","text":"

This example is based on TestPBREdgeTint.cxx and renders spheres with different edge colors using a skybox as image based lighting.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Cxx/Rendering/PBR_Edge_Tint/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/PBR_Edge_Tint/#code","title":"Code","text":"

PBR_Edge_Tint.cxx

#include <vtkActor.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkSphereSource.h>\n#include <vtkTexture.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Render spheres with different edge colors using a skybox as \"\n               \"image based lighting.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useCubemap{false};\n  app.add_flag(\"-c, --use_cubemap\", useCubemap,\n               \"Build the cubemap from the six cubemap files. Overrides the \"\n               \"equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(75);\n  sphere->SetPhiResolution(75);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 0.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetEdgeTint(\n        colors->GetColor3d(\"Black\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 1.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetEdgeTint(\n        colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 2.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetEdgeTint(\n        colors->GetColor3d(\"Red\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 3.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetEdgeTint(\n        colors->GetColor3d(\"Blue\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 4.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetEdgeTint(\n        colors->GetColor3d(\"Yellow\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Edge_Tint\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/PBR_Edge_Tint/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Edge_Tint)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Edge_Tint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Edge_Tint MACOSX_BUNDLE PBR_Edge_Tint.cxx )\n  target_link_libraries(PBR_Edge_Tint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Edge_Tint\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/PBR_Edge_Tint/#download-and-build-pbr_edge_tint","title":"Download and Build PBR_Edge_Tint","text":"

Click here to download PBR_Edge_Tint and its CMakeLists.txt file. Once the tarball PBR_Edge_Tint.tar has been downloaded and extracted,

cd PBR_Edge_Tint/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PBR_Edge_Tint\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/PBR_HDR_Environment/","title":"PBR HDR Environment","text":"

vtk-examples/Cxx/Rendering/PBR_HDR_Environment

"},{"location":"Cxx/Rendering/PBR_HDR_Environment/#description","title":"Description","text":"

This example is based on TestPBRHdrEnvironment.cxx and renders spheres with different materials using a skybox as image based lighting.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Cxx/Rendering/PBR_HDR_Environment/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/PBR_HDR_Environment/#code","title":"Code","text":"

PBR_HDR_Environment.cxx

#include <vtkActor.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkSphereSource.h>\n#include <vtkTexture.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Renders spheres with different materials using a skybox as \"\n               \"image based lighting.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useCubemap{false};\n  app.add_flag(\"-c, --use_cubemap\", useCubemap,\n               \"Build the cubemap from the six cubemap files. Overrides the \"\n               \"equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n  ren->UseSphericalHarmonicsOff();\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(75);\n  sphere->SetPhiResolution(75);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 0.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n\n    ren->AddActor(actorSphere);\n  }\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_HDR_Environment\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/PBR_HDR_Environment/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_HDR_Environment)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_HDR_Environment: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_HDR_Environment MACOSX_BUNDLE PBR_HDR_Environment.cxx )\n  target_link_libraries(PBR_HDR_Environment PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_HDR_Environment\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/PBR_HDR_Environment/#download-and-build-pbr_hdr_environment","title":"Download and Build PBR_HDR_Environment","text":"

Click here to download PBR_HDR_Environment and its CMakeLists.txt file. Once the tarball PBR_HDR_Environment.tar has been downloaded and extracted,

cd PBR_HDR_Environment/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PBR_HDR_Environment\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/PBR_Mapping/","title":"PBR Mapping","text":"

vtk-examples/Cxx/Rendering/PBR_Mapping

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/PBR_Mapping/#description","title":"Description","text":"

This example is based on TestPBRMapping.cxx and renders spheres with different edge colors using a skybox as image based lighting.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Cxx/Rendering/PBR_Mapping/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/PBR_Mapping/#code","title":"Code","text":"

PBR_Mapping.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPNGReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkTexture.h>\n#include <vtkTriangleFilter.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Render a cube with custom texture mapping.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useEquirectangular{false};\n  app.add_flag(\"-e, --use_equirectangular\", useEquirectangular,\n               \"Use the equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useCubemap = !useEquirectangular;\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n  ren->AutomaticLightCreationOff();\n\n  vtkNew<vtkLight> light;\n  light->SetPosition(2.0, 0.0, 2.0);\n  light->SetFocalPoint(0.0, 0.0, 0.0);\n\n  ren->AddLight(light);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n  ren->UseSphericalHarmonicsOff();\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkCubeSource> cube;\n\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(cube->GetOutputPort());\n\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(triangulation->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(tangents->GetOutputPort());\n\n  vtkNew<vtkPNGReader> materialReader;\n  materialReader->SetFileName(parameters.parameters[\"material\"].c_str());\n\n  vtkNew<vtkTexture> material;\n  material->InterpolateOn();\n  material->SetInputConnection(materialReader->GetOutputPort());\n\n  vtkNew<vtkPNGReader> albedoReader;\n  albedoReader->SetFileName(parameters.parameters[\"albedo\"].c_str());\n\n  vtkNew<vtkTexture> albedo;\n  albedo->UseSRGBColorSpaceOn();\n  albedo->InterpolateOn();\n  albedo->SetInputConnection(albedoReader->GetOutputPort());\n\n  vtkNew<vtkPNGReader> normalReader;\n  normalReader->SetFileName(parameters.parameters[\"normal\"].c_str());\n\n  vtkNew<vtkTexture> normal;\n  normal->InterpolateOn();\n  normal->SetInputConnection(normalReader->GetOutputPort());\n\n  vtkNew<vtkPNGReader> anisotropyReader;\n  anisotropyReader->SetFileName(parameters.parameters[\"anisotropy\"].c_str());\n\n  vtkNew<vtkTexture> anisotropy;\n  anisotropy->InterpolateOn();\n  anisotropy->SetInputConnection(anisotropyReader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetOrientation(0.0, 25.0, 0.0);\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToPBR();\n\n  // Set metallic, roughness, anisotropy and anisotropyRotation\n  // to 1.0 as they act as multipliers with texture value.\n  actor->GetProperty()->SetMetallic(1.0);\n  actor->GetProperty()->SetRoughness(1.0);\n  actor->GetProperty()->SetAnisotropy(1.0);\n  actor->GetProperty()->SetAnisotropyRotation(1.0);\n  actor->GetProperty()->SetCoatColor(colors->GetColor3d(\"White\").GetData());\n\n  actor->GetProperty()->SetBaseColorTexture(albedo);\n  actor->GetProperty()->SetORMTexture(material);\n  actor->GetProperty()->SetNormalTexture(normal);\n  actor->GetProperty()->SetAnisotropyTexture(anisotropy);\n\n  ren->AddActor(actor);\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Clear_Coat\");\n\n  renWin->Render();\n  ren->GetActiveCamera()->Zoom(1.5);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/PBR_Mapping/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Mapping)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  FiltersCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Mapping: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Mapping MACOSX_BUNDLE PBR_Mapping.cxx )\n  target_link_libraries(PBR_Mapping PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Mapping\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/PBR_Mapping/#download-and-build-pbr_mapping","title":"Download and Build PBR_Mapping","text":"

Click here to download PBR_Mapping and its CMakeLists.txt file. Once the tarball PBR_Mapping.tar has been downloaded and extracted,

cd PBR_Mapping/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PBR_Mapping\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/PBR_Materials/","title":"PBR Materials","text":"

vtk-examples/Cxx/Rendering/PBR_Materials

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/PBR_Materials/#description","title":"Description","text":"

This example is based on TestPBRMaterials.cxx and renders spheres with different materials using a skybox as image based lighting. Red, cyan and black spheres are dielectric, brass and white spheres are metallic. Roughness ranges from 0 to 1 in steps of 0.2.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Cxx/Rendering/PBR_Materials/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/PBR_Materials/#code","title":"Code","text":"

PBR_Materials.cxx

#include <vtkActor.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkSphereSource.h>\n#include <vtkTexture.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Render spheres with different materials using a skybox as \"\n               \"image based lighting.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useEquirectangular{false};\n  app.add_flag(\"-e, --use_equirectangular\", useEquirectangular,\n               \"Use the equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useCubemap = !useEquirectangular;\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(100);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 0.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 1.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Brass\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 2.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 3.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 4.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Materials\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/PBR_Materials/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Materials)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Materials: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Materials MACOSX_BUNDLE PBR_Materials.cxx )\n  target_link_libraries(PBR_Materials PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Materials\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/PBR_Materials/#download-and-build-pbr_materials","title":"Download and Build PBR_Materials","text":"

Click here to download PBR_Materials and its CMakeLists.txt file. Once the tarball PBR_Materials.tar has been downloaded and extracted,

cd PBR_Materials/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PBR_Materials\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/PBR_Materials_Coat/","title":"PBR Materials Coat","text":"

vtk-examples/Cxx/Rendering/PBR_Materials_Coat

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/PBR_Materials_Coat/#description","title":"Description","text":"

This example is based on TestPBRMaterialsCoat.cxx and renders spheres with different coat materials using a skybox as image based lighting.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Cxx/Rendering/PBR_Materials_Coat/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/PBR_Materials_Coat/#code","title":"Code","text":"

PBR_Materials_Coat.cxx

#include <vtkActor.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkSphereSource.h>\n#include <vtkTexture.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Render spheres with different coat materials using a skybox as \"\n               \"image based lighting.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useEquirectangular{false};\n  app.add_flag(\"-e, --use_equirectangular\", useEquirectangular,\n               \"Use the equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useCubemap = !useEquirectangular;\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n  colors->SetColor(\"DarkTeal\",\n                   std::array<unsigned char, 4>{0, 128, 77, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(75);\n  sphere->SetPhiResolution(75);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 0.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Brass\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(0.1);\n    actorSphere->GetProperty()->SetCoatStrength(1.0);\n    actorSphere->GetProperty()->SetCoatRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 1.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Brass\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(1.0);\n    actorSphere->GetProperty()->SetCoatStrength(1.0);\n    actorSphere->GetProperty()->SetCoatRoughness(i / 5.0);\n\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 2.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(0.1);\n    actorSphere->GetProperty()->SetCoatColor(\n        colors->GetColor3d(\"Red\").GetData());\n    actorSphere->GetProperty()->SetCoatRoughness(0.1);\n    actorSphere->GetProperty()->SetCoatStrength(i / 5.0);\n\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 3.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetRoughness(0.1);\n    actorSphere->GetProperty()->SetCoatColor(\n        colors->GetColor3d(\"Red\").GetData());\n    actorSphere->GetProperty()->SetCoatRoughness(1.0);\n    actorSphere->GetProperty()->SetCoatStrength(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 4.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(\n        colors->GetColor3d(\"DarkTeal\").GetData());\n    actorSphere->GetProperty()->SetBaseIOR(1.0 + (i / 3.0));\n    ren->AddActor(actorSphere);\n  }\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Materials_Coat\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/PBR_Materials_Coat/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Materials_Coat)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Materials_Coat: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Materials_Coat MACOSX_BUNDLE PBR_Materials_Coat.cxx )\n  target_link_libraries(PBR_Materials_Coat PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Materials_Coat\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/PBR_Materials_Coat/#download-and-build-pbr_materials_coat","title":"Download and Build PBR_Materials_Coat","text":"

Click here to download PBR_Materials_Coat and its CMakeLists.txt file. Once the tarball PBR_Materials_Coat.tar has been downloaded and extracted,

cd PBR_Materials_Coat/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PBR_Materials_Coat\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/PBR_Skybox/","title":"PBR Skybox","text":"

vtk-examples/Cxx/Rendering/PBR_Skybox

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/PBR_Skybox/#description","title":"Description","text":"

Demonstrates physically based rendering using image based lighting and a skybox.

Physically based rendering sets color, metallicity and roughness of the object, sliders are provided so that you can experiment with the various parameters.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

<DATA>/PBR_Skybox.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Cxx/Rendering/PBR_Skybox/#options","title":"Options","text":"
Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

Additionally, you can save a screenshot by pressing \"k\".

"},{"location":"Cxx/Rendering/PBR_Skybox/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Skybox.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/PBR_Skybox/#code","title":"Code","text":"

PBR_Skybox.cxx

#include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCameraPass.h>\n#include <vtkCleanPolyData.h>\n#include <vtkClipPolyData.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLightsPass.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpaquePass.h>\n#include <vtkOpenGLRenderWindow.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkOverlayPass.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkParametricBoy.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSequencePass.h>\n#include <vtkSkybox.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTexture.h>\n#include <vtkTexturedSphereSource.h>\n#include <vtkToneMappingPass.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n// For writing out the image.\n#include <vtkImageWriter.h>\n#include <vtkJPEGWriter.h>\n#include <vtkPNGWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <memory>\n#include <numeric>\n#include <sstream>\n#include <string>\n#include <vector>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define VTK_HAS_COW 1\n#endif\n\n#if VTK_HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return True if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n// Some sample surfaces to try.\nvtkSmartPointer<vtkPolyData> GetBoy();\nvtkSmartPointer<vtkPolyData> GetMobius();\nvtkSmartPointer<vtkPolyData> GetRandomHills();\nvtkSmartPointer<vtkPolyData> GetTorus();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetClippedSphere();\nvtkSmartPointer<vtkPolyData> GetCube();\nvtkSmartPointer<vtkPolyData> GetClippedCube();\n\n/**\n * Generate u, v texture coordinates on a parametric surface.\n *\n * @param uResolution: u resolution\n * @param vResolution: v resolution\n * @param pd: The polydata representing the surface.\n *\n * @return The polydata with the texture coordinates added.\n */\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd);\n\nclass SliderCallbackExposure : public vtkCommand\n{\npublic:\n  static SliderCallbackExposure* New()\n  {\n    return new SliderCallbackExposure;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetExposure(value);\n  }\n  SliderCallbackExposure() : property(nullptr)\n  {\n  }\n  vtkToneMappingPass* property;\n};\n\nclass SliderCallbackMetallic : public vtkCommand\n{\npublic:\n  static SliderCallbackMetallic* New()\n  {\n    return new SliderCallbackMetallic;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetMetallic(value);\n  }\n  SliderCallbackMetallic() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackRoughness : public vtkCommand\n{\npublic:\n  static SliderCallbackRoughness* New()\n  {\n    return new SliderCallbackRoughness;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetRoughness(value);\n  }\n  SliderCallbackRoughness() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nstruct SliderProperties\n{\n  // Set up the sliders\n  double tubeWidth{0.008};\n  double sliderLength{0.075};\n  double sliderWidth{0.025};\n  double endCapLength = 0.025;\n  double endCapWidth = 0.025;\n  double titleHeight{0.025};\n  double labelHeight{0.020};\n\n  double minimumValue{0.0};\n  double maximumValue{1.0};\n  double initialValue{0.0};\n\n  std::array<double, 2> p1{0.02, 0.1};\n  std::array<double, 2> p2{0.18, 0.1};\n\n  std::string title{\"\"};\n\n  std::string titleColor{\"Black\"};\n  std::string labelColor{\"Black\"};\n  std::string valueColor{\"DarkSlateGray\"};\n  std::string sliderColor{\"BurlyWood\"};\n  std::string selectedColor{\"Lime\"};\n  std::string barColor{\"Black\"};\n  std::string barEndsColor{\"Indigo\"};\n};\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties);\n\nclass PrintCallback : public vtkCallbackCommand\n{\npublic:\n  PrintCallback() : fn_{\"\"}, imageQuality_(1), rgba_(true)\n  {\n  }\n\n  static PrintCallback* New()\n  {\n    return new PrintCallback;\n  }\n\n  /*\n   * Create a vtkCallbackCommand and reimplement it.\n   *\n   */\n  void Execute(vtkObject* caller, unsigned long /*evId*/, void*) override\n  {\n    if (this->fn_.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto rwi = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n\n    // Get the keypress\n    std::string key = rwi->GetKeySym();\n    if (key == \"k\" && !this->fn_.empty())\n    {\n      auto w2If = vtkSmartPointer<vtkWindowToImageFilter>::New();\n      w2If->SetInput(rwi->GetRenderWindow());\n      w2If->SetScale(this->imageQuality_, this->imageQuality_);\n      if (rgba_)\n      {\n        w2If->SetInputBufferTypeToRGBA();\n      }\n      else\n      {\n        w2If->SetInputBufferTypeToRGB();\n      }\n      // Read from the front buffer.\n      w2If->ReadFrontBufferOn();\n      w2If->Update();\n      std::vector<std::string> jpeg{\".jpeg\", \".jpg\"};\n      auto writer = vtkSmartPointer<vtkImageWriter>::New();\n      if (std::find(jpeg.begin(), jpeg.end(), ext_) != jpeg.end())\n      {\n        writer = vtkSmartPointer<vtkJPEGWriter>::New();\n      }\n      else\n      {\n        writer = vtkSmartPointer<vtkPNGWriter>::New();\n      }\n      writer->SetFileName(this->fn_.c_str());\n      writer->SetInputConnection(w2If->GetOutputPort());\n      writer->Write();\n      std::cout << \"Screenshot saved to: \" << writer->GetFileName()\n                << std::endl;\n    }\n  }\n\n  /**\n   * Set the parameters for writing the\n   *  render window view to an image file.\n   *\n   * @param fileName The png image file name.\n   * @param imageQuality The image quality.\n   * @param rgba The buffer type, (if true, there is no background in the\n   * screenshot).\n   *\n   */\n  void SetParameters(const std::string& fileName, int imageQuality = 1,\n                     bool rgba = true)\n  {\n    if (fileName.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n    auto pth = fs::absolute(fileName);\n    auto ext = pth.extension().generic_string();\n    if (!pth.has_extension())\n      ext = \".png\";\n    std::transform(ext.begin(), ext.end(), ext.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::vector<std::string> validSuffixes{\".jpeg\", \".jpg\", \".png\"};\n    if (std::find(validSuffixes.begin(), validSuffixes.end(), ext) ==\n        validSuffixes.end())\n    {\n      ext = \".png\";\n    }\n    this->ext_ = ext;\n    this->fn_ = pth.replace_extension(this->ext_).generic_string();\n    this->imageQuality_ = imageQuality;\n    this->rgba_ = rgba;\n  }\n\nprivate:\n  PrintCallback(const PrintCallback&) = delete;\n  void operator=(const PrintCallback&) = delete;\n\n  std::string fn_;\n  std::string ext_;\n  int imageQuality_;\n  bool rgba_;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (!VTKVersionOk(9, 0, 0))\n  {\n    std::cerr << \"You need VTK version 9.0 or greater to run this program.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  CLI::App app{\"Demonstrates physically based rendering, image based lighting \"\n               \"and a skybox.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Skybox.json.\");\n  std::string surfaceName;\n  app.add_option(\"-s, --surface\", surfaceName,\n                 \"The name of the surface. Overrides the surface entry in the \"\n                 \"json file.\");\n  auto useCubemap{false};\n  app.add_flag(\"-c, --use_cubemap\", useCubemap,\n               \"Build the cubemap from the six cubemap files. Overrides the \"\n               \"equirectangular entry in the json file.\");\n  auto useTonemapping{false};\n  app.add_flag(\"-t, --use_tonemapping\", useTonemapping, \"Use tone mapping.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  if (!surfaceName.empty())\n  {\n    parameters.parameters[\"object\"] = surfaceName;\n  }\n\n  // Check for missing parameters.\n  if (parameters.parameters.find(\"bkgcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"bkgcolor\"] = \"BkgColor\";\n  }\n  if (parameters.parameters.find(\"objcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"objcolor\"] = \"White\";\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  // Build the pipeline.\n  // ren1 is for the slider rendering,\n  // ren2 is for the object rendering.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkOpenGLRenderer> ren2;\n  ren1->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n  ren2->SetBackground(\n      colors->GetColor3d(parameters.parameters[\"bkgcolor\"]).GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  // The order here is important.\n  // This ensures that the sliders will be in ren1.\n  renderWindow->AddRenderer(ren2);\n  renderWindow->AddRenderer(ren1);\n  ren1->SetViewport(0.0, 0.0, 0.2, 1.0);\n  ren2->SetViewport(0.2, 0.0, 1, 1);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  // Set up tone mapping so we can vary the exposure.\n  // Custom Passes.\n  vtkNew<vtkCameraPass> cameraP;\n  vtkNew<vtkSequencePass> seq;\n  vtkNew<vtkOpaquePass> opaque;\n  vtkNew<vtkLightsPass> lights;\n  vtkNew<vtkOverlayPass> overlay;\n\n  vtkNew<vtkRenderPassCollection> passes;\n  passes->AddItem(lights);\n  passes->AddItem(opaque);\n  passes->AddItem(overlay);\n  seq->SetPasses(passes);\n  cameraP->SetDelegatePass(seq);\n\n  vtkNew<vtkToneMappingPass> toneMappingP;\n  toneMappingP->SetToneMappingType(vtkToneMappingPass::GenericFilmic);\n  toneMappingP->SetGenericFilmicUncharted2Presets();\n  toneMappingP->SetExposure(1.0);\n  toneMappingP->SetDelegatePass(cameraP);\n\n  if (useTonemapping)\n  {\n    vtkOpenGLRenderer::SafeDownCast(ren2)->SetPass(toneMappingP);\n  }\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren2->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Turn off the default lighting and use image based lighting.\n  ren2->AutomaticLightCreationOff();\n  ren2->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren2->UseSphericalHarmonicsOn();\n    ren2->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren2->UseSphericalHarmonicsOff();\n    ren2->SetEnvironmentTexture(envTexture, true);\n  }\n\n  // Get the surface.\n  std::string desiredSurface = parameters.parameters[\"object\"];\n  std::transform(desiredSurface.begin(), desiredSurface.end(),\n                 desiredSurface.begin(),\n                 [](char c) { return std::tolower(c); });\n  std::map<std::string, int> availableSurfaces = {\n      {\"boy\", 0},   {\"mobius\", 1},     {\"randomhills\", 2},\n      {\"torus\", 3}, {\"sphere\", 4},     {\"clippedsphere\", 5},\n      {\"cube\", 6},  {\"clippedcube\", 7}};\n  if (availableSurfaces.find(desiredSurface) == availableSurfaces.end())\n  {\n    std::cout << \"The requested surface: \" << parameters.parameters[\"object\"]\n              << \" not found, reverting to Boys Surface.\" << std::endl;\n    desiredSurface = \"boy\";\n  }\n  vtkSmartPointer<vtkPolyData> source;\n  switch (availableSurfaces[desiredSurface])\n  {\n  case 1:\n    source = GetMobius();\n    break;\n  case 2:\n    source = GetRandomHills();\n    break;\n  case 3:\n    source = GetTorus();\n    break;\n  case 4:\n    source = GetSphere();\n    break;\n  case 5:\n    source = GetClippedSphere();\n    break;\n  case 6:\n    source = GetCube();\n    break;\n  case 7:\n    source = GetClippedCube();\n    break;\n  case 0:\n  default:\n    source = GetBoy();\n  };\n\n  // Lets use a smooth metallic surface.\n  auto diffuseCoefficient = 1.0;\n  auto roughnessCoefficient = 0.0;\n  auto metallicCoefficient = 1.0;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(source);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Enable PBR on the model.\n  actor->GetProperty()->SetInterpolationToPBR();\n  // Configure the basic properties.\n  actor->GetProperty()->SetColor(\n      colors->GetColor4d(parameters.parameters[\"objcolor\"]).GetData());\n  actor->GetProperty()->SetDiffuse(diffuseCoefficient);\n  actor->GetProperty()->SetRoughness(roughnessCoefficient);\n  actor->GetProperty()->SetMetallic(metallicCoefficient);\n  ren2->AddActor(actor);\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren2->AddActor(skybox);\n  }\n\n  // Create the slider callbacks to manipulate various parameters.\n\n  auto stepSize = 1.0 / 3.0;\n  auto posY = 0.1;\n  auto posX0 = 0.02;\n  auto posX1 = 0.18;\n\n  auto slwP = SliderProperties();\n\n  slwP.initialValue = 1.0;\n  slwP.maximumValue = 5.0;\n  slwP.title = \"Exposure\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swExposure = MakeSliderWidget(slwP);\n  swExposure->SetInteractor(interactor);\n  swExposure->SetAnimationModeToAnimate();\n  if (useTonemapping)\n  {\n    swExposure->EnabledOn();\n  }\n  else\n  {\n    swExposure->EnabledOff();\n  }\n  swExposure->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackExposure> swExpCB;\n  swExpCB->property = dynamic_cast<vtkToneMappingPass*>(ren2->GetPass());\n  swExposure->AddObserver(vtkCommand::InteractionEvent, swExpCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = metallicCoefficient;\n  slwP.maximumValue = 1.0;\n  slwP.title = \"Metallicity\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swMetallic = MakeSliderWidget(slwP);\n  swMetallic->SetInteractor(interactor);\n  swMetallic->SetAnimationModeToAnimate();\n  swMetallic->EnabledOn();\n  swMetallic->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackMetallic> swMetallicCB;\n  swMetallicCB->property = actor->GetProperty();\n  swMetallic->AddObserver(vtkCommand::InteractionEvent, swMetallicCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = roughnessCoefficient;\n  slwP.title = \"Roughness\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swRoughness = MakeSliderWidget(slwP);\n  swRoughness->SetInteractor(interactor);\n  swRoughness->SetAnimationModeToAnimate();\n  swRoughness->EnabledOn();\n  swRoughness->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackRoughness> swRoughnessCB;\n  swRoughnessCB->property = actor->GetProperty();\n  swRoughness->AddObserver(vtkCommand::InteractionEvent, swRoughnessCB);\n\n  auto name = fs::path(argv[0]).stem().generic_string();\n  renderWindow->SetSize(1000, 625);\n  renderWindow->Render();\n  renderWindow->SetWindowName(name.c_str());\n\n#if VTK_HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(ren2);\n  // Enable the widget.\n  camOrientManipulator->On();\n#else\n  vtkNew<vtkAxesActor> axes;\n\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  double rgba[4]{0.0, 0.0, 0.0, 0.0};\n  colors->GetColor(\"Carrot\", rgba);\n  widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n  widget->SetOrientationMarker(axes);\n  widget->SetInteractor(interactor);\n  widget->SetViewport(0.0, 0.0, 0.2, 0.2);\n  widget->EnabledOn();\n  widget->InteractiveOn();\n#endif\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<PrintCallback> printCallback;\n  printCallback->SetParameters(name, 1, false);\n  // printCallback->SetParameters(name + \".jpg\", 1, false);\n  interactor->AddObserver(vtkCommand::KeyPressEvent, printCallback);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n#ifndef VTK_VERSION_NUMBER\n  vtkNew<vtkVersion>();\n  ver;\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  if (vtk_version_number >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#else\n  if (VTK_VERSION_NUMBER >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#endif\n}\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\nvtkSmartPointer<vtkPolyData> GetBoy()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricBoy> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetMobius()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricMobius> surface;\n  surface->SetMinimumV(-0.25);\n  surface->SetMaximumV(0.25);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetRandomHills()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricRandomHills> surface;\n  surface->SetRandomSeed(1);\n  surface->SetNumberOfHills(30);\n  // If you want a plane\n  // surface->SetHillAmplitude(0);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricTorus> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(surface->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, 0);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(surface->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(clipper->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(3);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(subdivide->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(5);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, -1);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(subdivide->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(clipper->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(cleaner->GetOutputPort());\n  normals->FlipNormalsOn();\n  normals->SetFeatureAngle(60);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(normals->GetOutputPort());\n  tangents->ComputeCellTangentsOn();\n  tangents->ComputePointTangentsOn();\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd)\n{\n  float u0 = 1.0;\n  float v0 = 0.0;\n  float du = 1.0 / (uResolution - 1.0);\n  float dv = 1.0 / (vResolution - 1.0);\n  vtkIdType numPts = pd->GetNumberOfPoints();\n  vtkNew<vtkFloatArray> tCoords;\n  tCoords->SetNumberOfComponents(2);\n  tCoords->SetNumberOfTuples(numPts);\n  tCoords->SetName(\"Texture Coordinates\");\n  vtkIdType ptId = 0;\n  float u = u0;\n  for (auto i = 0; i < uResolution; ++i)\n  {\n    float v = v0;\n    for (auto j = 0; j < vResolution; ++j)\n    {\n      float tc[2]{u, v};\n      tCoords->SetTuple(ptId, tc);\n      v += dv;\n      ptId++;\n    }\n    u -= du;\n  }\n  pd->GetPointData()->SetTCoords(tCoords);\n  return pd;\n}\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkSliderRepresentation2D> slider;\n\n  slider->SetMinimumValue(properties.minimumValue);\n  slider->SetMaximumValue(properties.maximumValue);\n  slider->SetValue(properties.initialValue);\n  slider->SetTitleText(properties.title.c_str());\n\n  slider->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint1Coordinate()->SetValue(properties.p1[0], properties.p1[1]);\n  slider->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint2Coordinate()->SetValue(properties.p2[0], properties.p2[1]);\n\n  slider->SetTubeWidth(properties.tubeWidth);\n  slider->SetSliderLength(properties.sliderLength);\n  slider->SetSliderWidth(properties.sliderWidth);\n  slider->SetEndCapLength(properties.endCapLength);\n  slider->SetEndCapWidth(properties.endCapWidth);\n  slider->SetTitleHeight(properties.titleHeight);\n  slider->SetLabelHeight(properties.labelHeight);\n\n  // Set the color properties\n  // Change the color of the title.\n  slider->GetTitleProperty()->SetColor(\n      colors->GetColor3d(properties.titleColor).GetData());\n  // Change the color of the label.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.labelColor).GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(\n      colors->GetColor3d(properties.barColor).GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(\n      colors->GetColor3d(properties.barEndsColor).GetData());\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(\n      colors->GetColor3d(properties.sliderColor).GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(properties.selectedColor).GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.valueColor).GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetRepresentation(slider);\n\n  return sliderWidget;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/PBR_Skybox/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Skybox)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Skybox: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Skybox MACOSX_BUNDLE PBR_Skybox.cxx )\n  target_link_libraries(PBR_Skybox PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Skybox\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/PBR_Skybox/#download-and-build-pbr_skybox","title":"Download and Build PBR_Skybox","text":"

Click here to download PBR_Skybox and its CMakeLists.txt file. Once the tarball PBR_Skybox.tar has been downloaded and extracted,

cd PBR_Skybox/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PBR_Skybox\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/","title":"PBR Skybox Anisotropy","text":"

vtk-examples/Cxx/Rendering/PBR_Skybox_Anisotropy

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#description","title":"Description","text":"

Demonstrates physically based rendering (PBR) using image based lighting, anisotropic texturing and a skybox.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

<DATA>/PBR_Skybox_Anisotropy.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#options","title":"Options","text":"
Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

Additionally, you can save a screenshot by pressing \"k\".

"},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Skybox_Anisotropy.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#code","title":"Code","text":"

PBR_Skybox_Anisotropy.cxx

#include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCameraPass.h>\n#include <vtkCleanPolyData.h>\n#include <vtkClipPolyData.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLightsPass.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpaquePass.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkOverlayPass.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkParametricBoy.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSequencePass.h>\n#include <vtkSkybox.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTexture.h>\n#include <vtkTexturedSphereSource.h>\n#include <vtkToneMappingPass.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n// For writing out the image.\n#include <vtkImageWriter.h>\n#include <vtkJPEGWriter.h>\n#include <vtkPNGWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <numeric>\n#include <sstream>\n#include <string>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define VTK_HAS_COW 1\n#endif\n\n#if VTK_HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return True if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n/**\n * Read an image and convert it to a texture.\n *\n * @param path: The image path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadTexture(std::string path);\n\n/**\n * Check that the needed textures exist.\n *\n * @param parameters:  The parameters.\n * @param wantedTextures: The wanted textures.\n *\n * @return true if all the wanted textures are present.\n */\nbool CheckForMissingTextures(Parameters& parameters,\n                             std::vector<std::string> const& wantedTextures);\n\n// Some sample surfaces to try.\nvtkSmartPointer<vtkPolyData> GetBoy();\nvtkSmartPointer<vtkPolyData> GetMobius();\nvtkSmartPointer<vtkPolyData> GetRandomHills();\nvtkSmartPointer<vtkPolyData> GetTorus();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetClippedSphere();\nvtkSmartPointer<vtkPolyData> GetCube();\nvtkSmartPointer<vtkPolyData> GetClippedCube();\n\n/**\n * Generate u, v texture coordinates on a parametric surface.\n *\n * @param uResolution: u resolution\n * @param vResolution: v resolution\n * @param pd: The polydata representing the surface.\n *\n * @return The polydata with the texture coordinates added.\n */\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd);\n\nclass SliderCallbackExposure : public vtkCommand\n{\npublic:\n  static SliderCallbackExposure* New()\n  {\n    return new SliderCallbackExposure;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetExposure(value);\n  }\n  SliderCallbackExposure() : property(nullptr)\n  {\n  }\n  vtkToneMappingPass* property;\n};\n\nclass SliderCallbackMetallic : public vtkCommand\n{\npublic:\n  static SliderCallbackMetallic* New()\n  {\n    return new SliderCallbackMetallic;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetMetallic(value);\n  }\n  SliderCallbackMetallic() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackRoughness : public vtkCommand\n{\npublic:\n  static SliderCallbackRoughness* New()\n  {\n    return new SliderCallbackRoughness;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetRoughness(value);\n  }\n  SliderCallbackRoughness() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackOcclusionStrength : public vtkCommand\n{\npublic:\n  static SliderCallbackOcclusionStrength* New()\n  {\n    return new SliderCallbackOcclusionStrength;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetOcclusionStrength(value);\n  }\n  SliderCallbackOcclusionStrength() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackNormalScale : public vtkCommand\n{\npublic:\n  static SliderCallbackNormalScale* New()\n  {\n    return new SliderCallbackNormalScale;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetNormalScale(value);\n  }\n  SliderCallbackNormalScale() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackAnisotropy : public vtkCommand\n{\npublic:\n  static SliderCallbackAnisotropy* New()\n  {\n    return new SliderCallbackAnisotropy;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetAnisotropy(value);\n  }\n  SliderCallbackAnisotropy() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackAnisotropyRotation : public vtkCommand\n{\npublic:\n  static SliderCallbackAnisotropyRotation* New()\n  {\n    return new SliderCallbackAnisotropyRotation;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetAnisotropyRotation(value);\n  }\n  SliderCallbackAnisotropyRotation() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nstruct SliderProperties\n{\n  // Set up the sliders\n  double tubeWidth{0.008};\n  double sliderLength{0.075};\n  double sliderWidth{0.025};\n  double endCapLength = 0.025;\n  double endCapWidth = 0.025;\n  double titleHeight{0.025};\n  double labelHeight{0.020};\n\n  double minimumValue{0.0};\n  double maximumValue{1.0};\n  double initialValue{0.0};\n\n  std::array<double, 2> p1{0.02, 0.1};\n  std::array<double, 2> p2{0.18, 0.1};\n\n  std::string title{\"\"};\n\n  std::string titleColor{\"Black\"};\n  std::string labelColor{\"Black\"};\n  std::string valueColor{\"DarkSlateGray\"};\n  std::string sliderColor{\"BurlyWood\"};\n  std::string selectedColor{\"Lime\"};\n  std::string barColor{\"Black\"};\n  std::string barEndsColor{\"Indigo\"};\n};\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties);\n\nclass PrintCallback : public vtkCallbackCommand\n{\npublic:\n  PrintCallback() : fn_{\"\"}, imageQuality_(1), rgba_(true)\n  {\n  }\n\n  static PrintCallback* New()\n  {\n    return new PrintCallback;\n  }\n\n  /*\n   * Create a vtkCallbackCommand and reimplement it.\n   *\n   */\n  void Execute(vtkObject* caller, unsigned long /*evId*/, void*) override\n  {\n    if (this->fn_.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto rwi = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n\n    // Get the keypress\n    std::string key = rwi->GetKeySym();\n    if (key == \"k\" && !this->fn_.empty())\n    {\n      auto w2If = vtkSmartPointer<vtkWindowToImageFilter>::New();\n      w2If->SetInput(rwi->GetRenderWindow());\n      w2If->SetScale(this->imageQuality_, this->imageQuality_);\n      if (rgba_)\n      {\n        w2If->SetInputBufferTypeToRGBA();\n      }\n      else\n      {\n        w2If->SetInputBufferTypeToRGB();\n      }\n      // Read from the front buffer.\n      w2If->ReadFrontBufferOn();\n      w2If->Update();\n      std::vector<std::string> jpeg{\".jpeg\", \".jpg\"};\n      auto writer = vtkSmartPointer<vtkImageWriter>::New();\n      if (std::find(jpeg.begin(), jpeg.end(), ext_) != jpeg.end())\n      {\n        writer = vtkSmartPointer<vtkJPEGWriter>::New();\n      }\n      else\n      {\n        writer = vtkSmartPointer<vtkPNGWriter>::New();\n      }\n      writer->SetFileName(this->fn_.c_str());\n      writer->SetInputConnection(w2If->GetOutputPort());\n      writer->Write();\n      std::cout << \"Screenshot saved to: \" << writer->GetFileName()\n                << std::endl;\n    }\n  }\n\n  /**\n   * Set the parameters for writing the\n   *  render window view to an image file.\n   *\n   * @param fileName The png image file name.\n   * @param imageQuality The image quality.\n   * @param rgba The buffer type, (if true, there is no background in the\n   * screenshot).\n   *\n   */\n  void SetParameters(const std::string& fileName, int imageQuality = 1,\n                     bool rgba = true)\n  {\n    if (fileName.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n    auto pth = fs::absolute(fileName);\n    auto ext = pth.extension().generic_string();\n    if (!pth.has_extension())\n      ext = \".png\";\n    std::transform(ext.begin(), ext.end(), ext.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::vector<std::string> validSuffixes{\".jpeg\", \".jpg\", \".png\"};\n    if (std::find(validSuffixes.begin(), validSuffixes.end(), ext) ==\n        validSuffixes.end())\n    {\n      ext = \".png\";\n    }\n    this->ext_ = ext;\n    this->fn_ = pth.replace_extension(this->ext_).generic_string();\n    this->imageQuality_ = imageQuality;\n    this->rgba_ = rgba;\n  }\n\nprivate:\n  PrintCallback(const PrintCallback&) = delete;\n  void operator=(const PrintCallback&) = delete;\n\n  std::string fn_;\n  std::string ext_;\n  int imageQuality_;\n  bool rgba_;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (!VTKVersionOk(9, 0, 0))\n  {\n    std::cerr << \"You need VTK version 9.0 or greater to run this program.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  CLI::App app{\"Demonstrates physically based rendering, a skybox, \"\n               \"image based lighting and anisotropic texturing.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Skybox_Anisotropy.json.\");\n  std::string surfaceName;\n  app.add_option(\"-s, --surface\", surfaceName,\n                 \"The name of the surface. Overrides the surface entry in the \"\n                 \"json file.\");\n  auto useCubemap{false};\n  app.add_flag(\"-c, --use_cubemap\", useCubemap,\n               \"Build the cubemap from the six cubemap files. Overrides the \"\n               \"equirectangular entry in the json file.\");\n  auto useTonemapping{false};\n  app.add_flag(\"-t, --use_tonemapping\", useTonemapping, \"Use tone mapping.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  if (!surfaceName.empty())\n  {\n    parameters.parameters[\"object\"] = surfaceName;\n  }\n\n  // Check for missing parameters.\n  if (parameters.parameters.find(\"bkgcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"bkgcolor\"] = \"BkgColor\";\n  }\n  if (parameters.parameters.find(\"objcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"objcolor\"] = \"White\";\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  std::vector<std::string> wantedTextures{\"albedo\", \"normal\", \"material\",\n                                          \"anisotropy\"};\n  if (!CheckForMissingTextures(parameters, wantedTextures))\n  {\n    return EXIT_FAILURE;\n  }\n\n  // Build the pipeline.\n  // ren1 is for the slider rendering,\n  // ren2 is for the object rendering.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkOpenGLRenderer> ren2;\n  ren1->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n  ren2->SetBackground(\n      colors->GetColor3d(parameters.parameters[\"bkgcolor\"]).GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  // The order here is important.\n  // This ensures that the sliders will be in ren1.\n  renderWindow->AddRenderer(ren2);\n  renderWindow->AddRenderer(ren1);\n  ren1->SetViewport(0.0, 0.0, 0.2, 1.0);\n  ren2->SetViewport(0.2, 0.0, 1, 1);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  // Set up tone mapping so we can vary the exposure.\n  // Custom Passes.\n  vtkNew<vtkCameraPass> cameraP;\n  vtkNew<vtkSequencePass> seq;\n  vtkNew<vtkOpaquePass> opaque;\n  vtkNew<vtkLightsPass> lights;\n  vtkNew<vtkOverlayPass> overlay;\n\n  vtkNew<vtkRenderPassCollection> passes;\n  passes->AddItem(lights);\n  passes->AddItem(opaque);\n  passes->AddItem(overlay);\n  seq->SetPasses(passes);\n  cameraP->SetDelegatePass(seq);\n\n  vtkNew<vtkToneMappingPass> toneMappingP;\n  toneMappingP->SetToneMappingType(vtkToneMappingPass::GenericFilmic);\n  toneMappingP->SetGenericFilmicUncharted2Presets();\n  toneMappingP->SetExposure(1.0);\n  toneMappingP->SetDelegatePass(cameraP);\n\n  if (useTonemapping)\n  {\n    vtkOpenGLRenderer::SafeDownCast(ren2)->SetPass(toneMappingP);\n  }\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren2->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Turn off the default lighting and use image based lighting.\n  ren2->AutomaticLightCreationOff();\n  ren2->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren2->UseSphericalHarmonicsOn();\n    ren2->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren2->UseSphericalHarmonicsOff();\n    ren2->SetEnvironmentTexture(envTexture, true);\n  }\n\n  // Get the textures.\n  auto baseColor = ReadTexture(parameters.parameters[\"albedo\"]);\n  baseColor->SetColorModeToDirectScalars();\n  baseColor->UseSRGBColorSpaceOn();\n  auto normal = ReadTexture(parameters.parameters[\"normal\"]);\n  normal->SetColorModeToDirectScalars();\n  auto material = ReadTexture(parameters.parameters[\"material\"]);\n  material->SetColorModeToDirectScalars();\n  auto anisotropy = ReadTexture(parameters.parameters[\"anisotropy\"]);\n  anisotropy->SetColorModeToDirectScalars();\n\n  // Get the surface.\n  std::string desiredSurface = parameters.parameters[\"object\"];\n  std::transform(desiredSurface.begin(), desiredSurface.end(),\n                 desiredSurface.begin(),\n                 [](char c) { return std::tolower(c); });\n  std::map<std::string, int> availableSurfaces = {\n      {\"boy\", 0},   {\"mobius\", 1},     {\"randomhills\", 2},\n      {\"torus\", 3}, {\"sphere\", 4},     {\"clippedsphere\", 5},\n      {\"cube\", 6},  {\"clippedcube\", 7}};\n  if (availableSurfaces.find(desiredSurface) == availableSurfaces.end())\n  {\n    std::cout << \"The requested surface: \" << parameters.parameters[\"object\"]\n              << \" not found, reverting to Boys Surface.\" << std::endl;\n    desiredSurface = \"boy\";\n  }\n  vtkSmartPointer<vtkPolyData> source;\n  switch (availableSurfaces[desiredSurface])\n  {\n  case 1:\n    source = GetMobius();\n    break;\n  case 2:\n    source = GetRandomHills();\n    break;\n  case 3:\n    source = GetTorus();\n    break;\n  case 4:\n    source = GetSphere();\n    break;\n  case 5:\n    source = GetClippedSphere();\n    break;\n  case 6:\n    source = GetCube();\n    break;\n  case 7:\n    source = GetClippedCube();\n    break;\n  case 0:\n  default:\n    source = GetBoy();\n  };\n\n  // Let's use a nonmetallic surface.\n  auto diffuseCoefficient = 1.0;\n  auto roughnessCoefficient = 0.3;\n  auto metallicCoefficient = 0.0;\n  // Other parameters.\n  auto occlusionStrength = 1.0;\n  auto normalScale = 1.0;\n  auto anisotropyCoefficient = 1.0;\n  auto anisotropyRotation = 0.0;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(source);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  // Enable PBR on the model.\n  actor->GetProperty()->SetInterpolationToPBR();\n  // Configure the basic properties.\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n  actor->GetProperty()->SetDiffuse(diffuseCoefficient);\n  actor->GetProperty()->SetRoughness(roughnessCoefficient);\n  actor->GetProperty()->SetMetallic(metallicCoefficient);\n  // Configure textures (needs tcoords on the mesh).\n  actor->GetProperty()->SetBaseColorTexture(baseColor);\n  actor->GetProperty()->SetORMTexture(material);\n  actor->GetProperty()->SetOcclusionStrength(occlusionStrength);\n  // Needs tcoords, normals and tangents on the mesh.\n  actor->GetProperty()->SetNormalTexture(normal);\n  actor->GetProperty()->SetNormalScale(normalScale);\n  actor->GetProperty()->SetAnisotropyTexture(anisotropy);\n  actor->GetProperty()->SetAnisotropy(anisotropyCoefficient);\n  actor->GetProperty()->SetAnisotropyRotation(anisotropyRotation);\n  ren2->AddActor(actor);\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren2->AddActor(skybox);\n  }\n\n  // Create the slider callbacks to manipulate various parameters.\n\n  auto stepSize = 1.0 / 7.0;\n  auto posY = 0.1;\n  auto posX0 = 0.02;\n  auto posX1 = 0.18;\n\n  auto slwP = SliderProperties();\n\n  slwP.initialValue = 1.0;\n  slwP.maximumValue = 5.0;\n  slwP.title = \"Exposure\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swExposure = MakeSliderWidget(slwP);\n  swExposure->SetInteractor(interactor);\n  swExposure->SetAnimationModeToAnimate();\n  if (useTonemapping)\n  {\n    swExposure->EnabledOn();\n  }\n  else\n  {\n    swExposure->EnabledOff();\n  }\n  swExposure->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackExposure> swExpCB;\n  swExpCB->property = dynamic_cast<vtkToneMappingPass*>(ren2->GetPass());\n  swExposure->AddObserver(vtkCommand::InteractionEvent, swExpCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = metallicCoefficient;\n  slwP.maximumValue = 1.0;\n  slwP.title = \"Metallicity\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swMetallic = MakeSliderWidget(slwP);\n  swMetallic->SetInteractor(interactor);\n  swMetallic->SetAnimationModeToAnimate();\n  swMetallic->EnabledOn();\n  swMetallic->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackMetallic> swMetallicCB;\n  swMetallicCB->property = actor->GetProperty();\n  swMetallic->AddObserver(vtkCommand::InteractionEvent, swMetallicCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = roughnessCoefficient;\n  slwP.title = \"Roughness\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swRoughness = MakeSliderWidget(slwP);\n  swRoughness->SetInteractor(interactor);\n  swRoughness->SetAnimationModeToAnimate();\n  swRoughness->EnabledOn();\n  swRoughness->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackRoughness> swRoughnessCB;\n  swRoughnessCB->property = actor->GetProperty();\n  swRoughness->AddObserver(vtkCommand::InteractionEvent, swRoughnessCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = occlusionStrength;\n  slwP.maximumValue = 5.0;\n  slwP.title = \"Occlusion\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swOccStr = MakeSliderWidget(slwP);\n  swOccStr->SetInteractor(interactor);\n  swOccStr->SetAnimationModeToAnimate();\n  swOccStr->EnabledOn();\n  swOccStr->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackOcclusionStrength> swOccStrCB;\n  swOccStrCB->property = actor->GetProperty();\n  swOccStr->AddObserver(vtkCommand::InteractionEvent, swOccStrCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = normalScale;\n  slwP.maximumValue = 5;\n  slwP.title = \"Normal\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swNormal = MakeSliderWidget(slwP);\n  swNormal->SetInteractor(interactor);\n  swNormal->SetAnimationModeToAnimate();\n  swNormal->EnabledOn();\n  swNormal->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackNormalScale> swNormalCB;\n  swNormalCB->property = actor->GetProperty();\n  swNormal->AddObserver(vtkCommand::InteractionEvent, swNormalCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = anisotropyCoefficient;\n  slwP.maximumValue = 1;\n  slwP.title = \"Anisotropy\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swAnisotropy = MakeSliderWidget(slwP);\n  swAnisotropy->SetInteractor(interactor);\n  swAnisotropy->SetAnimationModeToAnimate();\n  swAnisotropy->EnabledOn();\n  swAnisotropy->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackAnisotropy> swAnisotropyCB;\n  swAnisotropyCB->property = actor->GetProperty();\n  swAnisotropy->AddObserver(vtkCommand::InteractionEvent, swAnisotropyCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = anisotropyRotation;\n  slwP.maximumValue = 1;\n  slwP.title = \"Anisotropy Rotation\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n  // posY += stepSize;\n\n  auto swAnisotropyRotation = MakeSliderWidget(slwP);\n  swAnisotropyRotation->SetInteractor(interactor);\n  swAnisotropyRotation->SetAnimationModeToAnimate();\n  swAnisotropyRotation->EnabledOn();\n  swAnisotropyRotation->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackAnisotropyRotation> swAnisotropyRotationCB;\n  swAnisotropyRotationCB->property = actor->GetProperty();\n  swAnisotropyRotation->AddObserver(vtkCommand::InteractionEvent,\n                                    swAnisotropyRotationCB);\n\n  auto name = fs::path(argv[0]).stem().generic_string();\n  renderWindow->SetSize(1000, 625);\n  renderWindow->Render();\n  renderWindow->SetWindowName(name.c_str());\n\n#if VTK_HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(ren2);\n  // Enable the widget.\n  camOrientManipulator->On();\n#else\n  vtkNew<vtkAxesActor> axes;\n\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  double rgba[4]{0.0, 0.0, 0.0, 0.0};\n  colors->GetColor(\"Carrot\", rgba);\n  widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n  widget->SetOrientationMarker(axes);\n  widget->SetInteractor(interactor);\n  widget->SetViewport(0.0, 0.0, 0.2, 0.2);\n  widget->EnabledOn();\n  widget->InteractiveOn();\n#endif\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<PrintCallback> printCallback;\n  printCallback->SetParameters(name, 1, false);\n  // printCallback->SetParameters(name + \".jpg\", 1, false);\n  interactor->AddObserver(vtkCommand::KeyPressEvent, printCallback);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n#ifndef VTK_VERSION_NUMBER\n  vtkNew<vtkVersion>();\n  ver;\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  if (vtk_version_number >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#else\n  if (VTK_VERSION_NUMBER >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#endif\n}\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\nvtkNew<vtkTexture> ReadTexture(std::string path)\n{\n  // Read the image which will be the texture\n  std::string extension;\n  if (path.find_last_of(\".\") != std::string::npos)\n  {\n    extension = path.substr(path.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  std::vector<std::string> validExtensions{\".jpg\", \".png\", \".bmp\", \".tiff\",\n                                           \".pnm\", \".pgm\", \".ppm\"};\n  vtkNew<vtkTexture> texture;\n  texture->InterpolateOn();\n\n  if (std::find(validExtensions.begin(), validExtensions.end(), extension) ==\n      validExtensions.end())\n  {\n    std::cout << \"Unable to read the texture file:\" << path << std::endl;\n    return texture;\n  }\n  // Read the images\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imgReader;\n  imgReader.TakeReference(readerFactory->CreateImageReader2(path.c_str()));\n  imgReader->SetFileName(path.c_str());\n\n  texture->SetInputConnection(imgReader->GetOutputPort());\n  texture->Update();\n\n  return texture;\n}\n\nbool CheckForMissingTextures(Parameters& parameters,\n                             std::vector<std::string> const& wantedTextures)\n{\n  bool haveTextures = true;\n\n  for (auto const& textureName : wantedTextures)\n  {\n    if (parameters.parameters.find(\"equirectangular\") ==\n        parameters.parameters.end())\n    {\n      std::cerr << \"Missing texture: \" << textureName << std::endl;\n      haveTextures = false;\n    }\n    else if (parameters.parameters[textureName].empty())\n    {\n      std::cerr << \"No texture path for: \" << textureName << std::endl;\n      haveTextures = false;\n    }\n  }\n\n  return haveTextures;\n}\n\nvtkSmartPointer<vtkPolyData> GetBoy()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricBoy> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetMobius()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricMobius> surface;\n  surface->SetMinimumV(-0.25);\n  surface->SetMaximumV(0.25);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetRandomHills()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricRandomHills> surface;\n  surface->SetRandomSeed(1);\n  surface->SetNumberOfHills(30);\n  // If you want a plane\n  // surface->SetHillAmplitude(0);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricTorus> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(surface->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, 0);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(surface->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(clipper->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(3);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(subdivide->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(5);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, -1);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(subdivide->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(clipper->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(cleaner->GetOutputPort());\n  normals->FlipNormalsOn();\n  normals->SetFeatureAngle(60);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(normals->GetOutputPort());\n  tangents->ComputeCellTangentsOn();\n  tangents->ComputePointTangentsOn();\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd)\n{\n  float u0 = 1.0;\n  float v0 = 0.0;\n  float du = 1.0 / (uResolution - 1.0);\n  float dv = 1.0 / (vResolution - 1.0);\n  vtkIdType numPts = pd->GetNumberOfPoints();\n  vtkNew<vtkFloatArray> tCoords;\n  tCoords->SetNumberOfComponents(2);\n  tCoords->SetNumberOfTuples(numPts);\n  tCoords->SetName(\"Texture Coordinates\");\n  vtkIdType ptId = 0;\n  float u = u0;\n  for (auto i = 0; i < uResolution; ++i)\n  {\n    float v = v0;\n    for (auto j = 0; j < vResolution; ++j)\n    {\n      float tc[2]{u, v};\n      tCoords->SetTuple(ptId, tc);\n      v += dv;\n      ptId++;\n    }\n    u -= du;\n  }\n  pd->GetPointData()->SetTCoords(tCoords);\n  return pd;\n}\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkSliderRepresentation2D> slider;\n\n  slider->SetMinimumValue(properties.minimumValue);\n  slider->SetMaximumValue(properties.maximumValue);\n  slider->SetValue(properties.initialValue);\n  slider->SetTitleText(properties.title.c_str());\n\n  slider->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint1Coordinate()->SetValue(properties.p1[0], properties.p1[1]);\n  slider->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint2Coordinate()->SetValue(properties.p2[0], properties.p2[1]);\n\n  slider->SetTubeWidth(properties.tubeWidth);\n  slider->SetSliderLength(properties.sliderLength);\n  slider->SetSliderWidth(properties.sliderWidth);\n  slider->SetEndCapLength(properties.endCapLength);\n  slider->SetEndCapWidth(properties.endCapWidth);\n  slider->SetTitleHeight(properties.titleHeight);\n  slider->SetLabelHeight(properties.labelHeight);\n\n  // Set the color properties\n  // Change the color of the title.\n  slider->GetTitleProperty()->SetColor(\n      colors->GetColor3d(properties.titleColor).GetData());\n  // Change the color of the label.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.labelColor).GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(\n      colors->GetColor3d(properties.barColor).GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(\n      colors->GetColor3d(properties.barEndsColor).GetData());\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(\n      colors->GetColor3d(properties.sliderColor).GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(properties.selectedColor).GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.valueColor).GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetRepresentation(slider);\n\n  return sliderWidget;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Skybox_Anisotropy)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Skybox_Anisotropy: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Skybox_Anisotropy MACOSX_BUNDLE PBR_Skybox_Anisotropy.cxx )\n  target_link_libraries(PBR_Skybox_Anisotropy PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Skybox_Anisotropy\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#download-and-build-pbr_skybox_anisotropy","title":"Download and Build PBR_Skybox_Anisotropy","text":"

Click here to download PBR_Skybox_Anisotropy and its CMakeLists.txt file. Once the tarball PBR_Skybox_Anisotropy.tar has been downloaded and extracted,

cd PBR_Skybox_Anisotropy/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PBR_Skybox_Anisotropy\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/","title":"PBR Skybox Texturing","text":"

vtk-examples/Cxx/Rendering/PBR_Skybox_Texturing

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#description","title":"Description","text":"

Demonstrates physically based rendering (PBR) using image based lighting, texturing and a skybox.

Physically based rendering sets metallicity, roughness, occlusion strength, the emissive factor and normal scaling of the object. Textures are used to set base color, ORM, emissivity and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

<DATA>/PBR_Skybox_Texturing.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#options","title":"Options","text":"
Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

Additionally, you can save a screenshot by pressing \"k\".

"},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Skybox_Texturing.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#code","title":"Code","text":"

PBR_Skybox_Texturing.cxx

#include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCameraPass.h>\n#include <vtkCleanPolyData.h>\n#include <vtkClipPolyData.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLightsPass.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpaquePass.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkOverlayPass.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkParametricBoy.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSequencePass.h>\n#include <vtkSkybox.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTexture.h>\n#include <vtkTexturedSphereSource.h>\n#include <vtkToneMappingPass.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n// For writing out the image.\n#include <vtkImageWriter.h>\n#include <vtkJPEGWriter.h>\n#include <vtkPNGWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <numeric>\n#include <sstream>\n#include <string>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define VTK_HAS_COW 1\n#endif\n\n#if VTK_HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return True if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n/**\n * Read an image and convert it to a texture.\n *\n * @param path: The image path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadTexture(std::string path);\n\n/**\n * Check that the needed textures exist.\n *\n * @param parameters:  The parameters.\n * @param wantedTextures: The wanted textures.\n *\n * @return true if all the wanted textures are present.\n */\nbool CheckForMissingTextures(Parameters& parameters,\n                             std::vector<std::string> const& wantedTextures);\n\n// Some sample surfaces to try.\nvtkSmartPointer<vtkPolyData> GetBoy();\nvtkSmartPointer<vtkPolyData> GetMobius();\nvtkSmartPointer<vtkPolyData> GetRandomHills();\nvtkSmartPointer<vtkPolyData> GetTorus();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetClippedSphere();\nvtkSmartPointer<vtkPolyData> GetCube();\nvtkSmartPointer<vtkPolyData> GetClippedCube();\n\n/**\n * Generate u, v texture coordinates on a parametric surface.\n *\n * @param uResolution: u resolution\n * @param vResolution: v resolution\n * @param pd: The polydata representing the surface.\n *\n * @return The polydata with the texture coordinates added.\n */\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd);\n\nclass SliderCallbackExposure : public vtkCommand\n{\npublic:\n  static SliderCallbackExposure* New()\n  {\n    return new SliderCallbackExposure;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetExposure(value);\n  }\n  SliderCallbackExposure() : property(nullptr)\n  {\n  }\n  vtkToneMappingPass* property;\n};\n\nclass SliderCallbackMetallic : public vtkCommand\n{\npublic:\n  static SliderCallbackMetallic* New()\n  {\n    return new SliderCallbackMetallic;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetMetallic(value);\n  }\n  SliderCallbackMetallic() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackRoughness : public vtkCommand\n{\npublic:\n  static SliderCallbackRoughness* New()\n  {\n    return new SliderCallbackRoughness;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetRoughness(value);\n  }\n  SliderCallbackRoughness() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackOcclusionStrength : public vtkCommand\n{\npublic:\n  static SliderCallbackOcclusionStrength* New()\n  {\n    return new SliderCallbackOcclusionStrength;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetOcclusionStrength(value);\n  }\n  SliderCallbackOcclusionStrength() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackNormalScale : public vtkCommand\n{\npublic:\n  static SliderCallbackNormalScale* New()\n  {\n    return new SliderCallbackNormalScale;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetNormalScale(value);\n  }\n  SliderCallbackNormalScale() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nstruct SliderProperties\n{\n  // Set up the sliders\n  double tubeWidth{0.008};\n  double sliderLength{0.075};\n  double sliderWidth{0.025};\n  double endCapLength = 0.025;\n  double endCapWidth = 0.025;\n  double titleHeight{0.025};\n  double labelHeight{0.020};\n\n  double minimumValue{0.0};\n  double maximumValue{1.0};\n  double initialValue{0.0};\n\n  std::array<double, 2> p1{0.02, 0.1};\n  std::array<double, 2> p2{0.18, 0.1};\n\n  std::string title{\"\"};\n\n  std::string titleColor{\"Black\"};\n  std::string labelColor{\"Black\"};\n  std::string valueColor{\"DarkSlateGray\"};\n  std::string sliderColor{\"BurlyWood\"};\n  std::string selectedColor{\"Lime\"};\n  std::string barColor{\"Black\"};\n  std::string barEndsColor{\"Indigo\"};\n};\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties);\n\nclass PrintCallback : public vtkCallbackCommand\n{\npublic:\n  PrintCallback() : fn_{\"\"}, imageQuality_(1), rgba_(true)\n  {\n  }\n\n  static PrintCallback* New()\n  {\n    return new PrintCallback;\n  }\n\n  /*\n   * Create a vtkCallbackCommand and reimplement it.\n   *\n   */\n  void Execute(vtkObject* caller, unsigned long /*evId*/, void*) override\n  {\n    if (this->fn_.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto rwi = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n\n    // Get the keypress\n    std::string key = rwi->GetKeySym();\n    if (key == \"k\" && !this->fn_.empty())\n    {\n      auto w2If = vtkSmartPointer<vtkWindowToImageFilter>::New();\n      w2If->SetInput(rwi->GetRenderWindow());\n      w2If->SetScale(this->imageQuality_, this->imageQuality_);\n      if (rgba_)\n      {\n        w2If->SetInputBufferTypeToRGBA();\n      }\n      else\n      {\n        w2If->SetInputBufferTypeToRGB();\n      }\n      // Read from the front buffer.\n      w2If->ReadFrontBufferOn();\n      w2If->Update();\n      std::vector<std::string> jpeg{\".jpeg\", \".jpg\"};\n      auto writer = vtkSmartPointer<vtkImageWriter>::New();\n      if (std::find(jpeg.begin(), jpeg.end(), ext_) != jpeg.end())\n      {\n        writer = vtkSmartPointer<vtkJPEGWriter>::New();\n      }\n      else\n      {\n        writer = vtkSmartPointer<vtkPNGWriter>::New();\n      }\n      writer->SetFileName(this->fn_.c_str());\n      writer->SetInputConnection(w2If->GetOutputPort());\n      writer->Write();\n      std::cout << \"Screenshot saved to: \" << writer->GetFileName()\n                << std::endl;\n    }\n  }\n\n  /**\n   * Set the parameters for writing the\n   *  render window view to an image file.\n   *\n   * @param fileName The png image file name.\n   * @param imageQuality The image quality.\n   * @param rgba The buffer type, (if true, there is no background in the\n   * screenshot).\n   *\n   */\n  void SetParameters(const std::string& fileName, int imageQuality = 1,\n                     bool rgba = true)\n  {\n    if (fileName.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n    auto pth = fs::absolute(fileName);\n    auto ext = pth.extension().generic_string();\n    if (!pth.has_extension())\n      ext = \".png\";\n    std::transform(ext.begin(), ext.end(), ext.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::vector<std::string> validSuffixes{\".jpeg\", \".jpg\", \".png\"};\n    if (std::find(validSuffixes.begin(), validSuffixes.end(), ext) ==\n        validSuffixes.end())\n    {\n      ext = \".png\";\n    }\n    this->ext_ = ext;\n    this->fn_ = pth.replace_extension(this->ext_).generic_string();\n    this->imageQuality_ = imageQuality;\n    this->rgba_ = rgba;\n  }\n\nprivate:\n  PrintCallback(const PrintCallback&) = delete;\n  void operator=(const PrintCallback&) = delete;\n\n  std::string fn_;\n  std::string ext_;\n  int imageQuality_;\n  bool rgba_;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (!VTKVersionOk(9, 0, 0))\n  {\n    std::cerr << \"You need VTK version 9.0 or greater to run this program.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n  // VTK blue\n  std::array<unsigned char, 4> col1{{6, 79, 141, 255}};\n  colors->SetColor(\"VTKBlue\", col1.data());\n  // Let's make a complementary colour to VTKBlue.\n  std::transform(col1.begin(), std::prev(col1.end()), col1.begin(),\n                 [](unsigned char c) { return 255 - c; });\n  colors->SetColor(\"VTKBlueComp\", col1.data());\n\n  CLI::App app{\"Demonstrates physically based rendering, a skybox, \"\n               \"image based lighting and texturing.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters.\");\n  std::string surfaceName;\n  app.add_option(\"-s, --surface\", surfaceName,\n                 \"The name of the surface. Overrides the surface entry in the \"\n                 \"json file.\");\n  auto useCubemap{false};\n  app.add_flag(\"-c, --use_cubemap\", useCubemap,\n               \"Build the cubemap from the six cubemap files. Overrides the \"\n               \"equirectangular entry in the json file.\");\n  auto useTonemapping{false};\n  app.add_flag(\"-t, --use_tonemapping\", useTonemapping, \"Use tone mapping.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  if (!surfaceName.empty())\n  {\n    parameters.parameters[\"object\"] = surfaceName;\n  }\n\n  // Check for missing parameters.\n  if (parameters.parameters.find(\"bkgcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"bkgcolor\"] = \"BkgColor\";\n  }\n  if (parameters.parameters.find(\"objcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"objcolor\"] = \"White\";\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  std::vector<std::string> wantedTextures{\"albedo\", \"normal\", \"material\",\n                                          \"emissive\"};\n  if (!CheckForMissingTextures(parameters, wantedTextures))\n  {\n    return EXIT_FAILURE;\n  }\n\n  // Build the pipeline.\n  // ren1 is for the slider rendering,\n  // ren2 is for the object rendering.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkOpenGLRenderer> ren2;\n  ren1->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n  ren2->SetBackground(\n      colors->GetColor3d(parameters.parameters[\"bkgcolor\"]).GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  // The order here is important.\n  // This ensures that the sliders will be in ren1.\n  renderWindow->AddRenderer(ren2);\n  renderWindow->AddRenderer(ren1);\n  ren1->SetViewport(0.0, 0.0, 0.2, 1.0);\n  ren2->SetViewport(0.2, 0.0, 1, 1);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  // Set up tone mapping so we can vary the exposure.\n  // Custom Passes.\n  vtkNew<vtkCameraPass> cameraP;\n  vtkNew<vtkSequencePass> seq;\n  vtkNew<vtkOpaquePass> opaque;\n  vtkNew<vtkLightsPass> lights;\n  vtkNew<vtkOverlayPass> overlay;\n\n  vtkNew<vtkRenderPassCollection> passes;\n  passes->AddItem(lights);\n  passes->AddItem(opaque);\n  passes->AddItem(overlay);\n  seq->SetPasses(passes);\n  cameraP->SetDelegatePass(seq);\n\n  vtkNew<vtkToneMappingPass> toneMappingP;\n  toneMappingP->SetToneMappingType(vtkToneMappingPass::GenericFilmic);\n  toneMappingP->SetGenericFilmicUncharted2Presets();\n  toneMappingP->SetExposure(1.0);\n  toneMappingP->SetDelegatePass(cameraP);\n\n  if (useTonemapping)\n  {\n    vtkOpenGLRenderer::SafeDownCast(ren2)->SetPass(toneMappingP);\n  }\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren2->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Turn off the default lighting and use image based lighting.\n  ren2->AutomaticLightCreationOff();\n  ren2->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren2->UseSphericalHarmonicsOn();\n    ren2->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren2->UseSphericalHarmonicsOff();\n    ren2->SetEnvironmentTexture(envTexture, true);\n  }\n\n  // Get the textures\n  auto baseColor = ReadTexture(parameters.parameters[\"albedo\"]);\n  baseColor->UseSRGBColorSpaceOn();\n  auto normal = ReadTexture(parameters.parameters[\"normal\"]);\n  auto material = ReadTexture(parameters.parameters[\"material\"]);\n  auto emissive = ReadTexture(parameters.parameters[\"emissive\"]);\n  emissive->UseSRGBColorSpaceOn();\n\n  // Get the surface.\n  std::string desiredSurface = parameters.parameters[\"object\"];\n  std::transform(desiredSurface.begin(), desiredSurface.end(),\n                 desiredSurface.begin(),\n                 [](char c) { return std::tolower(c); });\n  std::map<std::string, int> availableSurfaces = {\n      {\"boy\", 0},   {\"mobius\", 1},     {\"randomhills\", 2},\n      {\"torus\", 3}, {\"sphere\", 4},     {\"clippedsphere\", 5},\n      {\"cube\", 6},  {\"clippedcube\", 7}};\n  if (availableSurfaces.find(desiredSurface) == availableSurfaces.end())\n  {\n    std::cout << \"The requested surface: \" << parameters.parameters[\"object\"]\n              << \" not found, reverting to Boys Surface.\" << std::endl;\n    desiredSurface = \"boy\";\n  }\n  vtkSmartPointer<vtkPolyData> source;\n  switch (availableSurfaces[desiredSurface])\n  {\n  case 1:\n    source = GetMobius();\n    break;\n  case 2:\n    source = GetRandomHills();\n    break;\n  case 3:\n    source = GetTorus();\n    break;\n  case 4:\n    source = GetSphere();\n    break;\n  case 5:\n    source = GetClippedSphere();\n    break;\n  case 6:\n    source = GetCube();\n    break;\n  case 7:\n    source = GetClippedCube();\n    break;\n  case 0:\n  default:\n    source = GetBoy();\n  };\n\n  // Let's use a nonmetallic surface.\n  auto diffuseCoefficient = 1.0;\n  auto roughnessCoefficient = 0.3;\n  auto metallicCoefficient = 0.0;\n  // Other parameters.\n  auto occlusionStrength = 1.0;\n  auto normalScale = 1.0;\n  // auto emissiveCol = colors->GetColor3d(\"VTKBlueComp\").GetData();\n  // std::array<double, 3> emissiveFactor{emissiveCol[0], emissiveCol[1],\n  //                                      emissiveCol[2]};\n  // Make VTK silvery in appearance.\n  std::array<double, 3> emissiveFactor{1.0, 1.0, 1.0};\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(source);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Enable PBR on the model.\n  actor->GetProperty()->SetInterpolationToPBR();\n  // Configure the basic properties.\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n  actor->GetProperty()->SetDiffuse(diffuseCoefficient);\n  actor->GetProperty()->SetRoughness(roughnessCoefficient);\n  actor->GetProperty()->SetMetallic(metallicCoefficient);\n  // Configure textures (needs tcoords on the mesh).\n  actor->GetProperty()->SetBaseColorTexture(baseColor);\n  actor->GetProperty()->SetORMTexture(material);\n  actor->GetProperty()->SetOcclusionStrength(occlusionStrength);\n  actor->GetProperty()->SetEmissiveTexture(emissive);\n  actor->GetProperty()->SetEmissiveFactor(emissiveFactor.data());\n  // Needs tcoords, normals and tangents on the mesh.\n  actor->GetProperty()->SetNormalTexture(normal);\n  actor->GetProperty()->SetNormalScale(normalScale);\n  ren2->AddActor(actor);\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren2->AddActor(skybox);\n  }\n\n  // Create the slider callbacks to manipulate various parameters.\n\n  auto stepSize = 1.0 / 5.0;\n  auto posY = 0.1;\n  auto posX0 = 0.02;\n  auto posX1 = 0.18;\n\n  auto slwP = SliderProperties();\n  slwP.initialValue = 1.0;\n  slwP.maximumValue = 5.0;\n  slwP.title = \"Exposure\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swExposure = MakeSliderWidget(slwP);\n  swExposure->SetInteractor(interactor);\n  swExposure->SetAnimationModeToAnimate();\n  if (useTonemapping)\n  {\n    swExposure->EnabledOn();\n  }\n  else\n  {\n    swExposure->EnabledOff();\n  }\n  swExposure->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackExposure> swExpCB;\n  swExpCB->property = dynamic_cast<vtkToneMappingPass*>(ren2->GetPass());\n  swExposure->AddObserver(vtkCommand::InteractionEvent, swExpCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = metallicCoefficient;\n  slwP.maximumValue = 1.0;\n  slwP.title = \"Metallicity\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swMetallic = MakeSliderWidget(slwP);\n  swMetallic->SetInteractor(interactor);\n  swMetallic->SetAnimationModeToAnimate();\n  swMetallic->EnabledOn();\n  swMetallic->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackMetallic> swMetallicCB;\n  swMetallicCB->property = actor->GetProperty();\n  swMetallic->AddObserver(vtkCommand::InteractionEvent, swMetallicCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = roughnessCoefficient;\n  slwP.title = \"Roughness\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swRoughness = MakeSliderWidget(slwP);\n  swRoughness->SetInteractor(interactor);\n  swRoughness->SetAnimationModeToAnimate();\n  swRoughness->EnabledOn();\n  swRoughness->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackRoughness> swRoughnessCB;\n  swRoughnessCB->property = actor->GetProperty();\n  swRoughness->AddObserver(vtkCommand::InteractionEvent, swRoughnessCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = occlusionStrength;\n  slwP.maximumValue = 5;\n  slwP.title = \"Occlusion\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swOccStr = MakeSliderWidget(slwP);\n  swOccStr->SetInteractor(interactor);\n  swOccStr->SetAnimationModeToAnimate();\n  swOccStr->EnabledOn();\n  swOccStr->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackOcclusionStrength> swOccStrCB;\n  swOccStrCB->property = actor->GetProperty();\n  swOccStr->AddObserver(vtkCommand::InteractionEvent, swOccStrCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = normalScale;\n  slwP.maximumValue = 5;\n  slwP.title = \"Normal\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swNormal = MakeSliderWidget(slwP);\n  swNormal->SetInteractor(interactor);\n  swNormal->SetAnimationModeToAnimate();\n  swNormal->EnabledOn();\n  swNormal->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackNormalScale> swNormalCB;\n  swNormalCB->property = actor->GetProperty();\n  swNormal->AddObserver(vtkCommand::InteractionEvent, swNormalCB);\n\n  auto name = fs::path(argv[0]).stem().generic_string();\n  renderWindow->SetSize(1000, 625);\n  renderWindow->Render();\n  renderWindow->SetWindowName(name.c_str());\n\n#if VTK_HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(ren2);\n  // Enable the widget.\n  camOrientManipulator->On();\n#else\n  vtkNew<vtkAxesActor> axes;\n\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  double rgba[4]{0.0, 0.0, 0.0, 0.0};\n  colors->GetColor(\"Carrot\", rgba);\n  widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n  widget->SetOrientationMarker(axes);\n  widget->SetInteractor(interactor);\n  widget->SetViewport(0.0, 0.0, 0.2, 0.2);\n  widget->EnabledOn();\n  widget->InteractiveOn();\n#endif\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<PrintCallback> printCallback;\n  printCallback->SetParameters(name, 1, false);\n  // printCallback->SetParameters(name + \".jpg\", 1, false);\n  interactor->AddObserver(vtkCommand::KeyPressEvent, printCallback);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n#ifndef VTK_VERSION_NUMBER\n  vtkNew<vtkVersion>();\n  ver;\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  if (vtk_version_number >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#else\n  if (VTK_VERSION_NUMBER >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#endif\n}\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\nvtkNew<vtkTexture> ReadTexture(std::string path)\n{\n  // Read the image which will be the texture\n  std::string extension;\n  if (path.find_last_of(\".\") != std::string::npos)\n  {\n    extension = path.substr(path.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  std::vector<std::string> validExtensions{\".jpg\", \".png\", \".bmp\", \".tiff\",\n                                           \".pnm\", \".pgm\", \".ppm\"};\n  vtkNew<vtkTexture> texture;\n  texture->InterpolateOn();\n\n  if (std::find(validExtensions.begin(), validExtensions.end(), extension) ==\n      validExtensions.end())\n  {\n    std::cout << \"Unable to read the texture file:\" << path << std::endl;\n    return texture;\n  }\n  // Read the images\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imgReader;\n  imgReader.TakeReference(readerFactory->CreateImageReader2(path.c_str()));\n  imgReader->SetFileName(path.c_str());\n\n  texture->SetInputConnection(imgReader->GetOutputPort());\n  texture->Update();\n\n  return texture;\n}\n\nbool CheckForMissingTextures(Parameters& parameters,\n                             std::vector<std::string> const& wantedTextures)\n{\n  bool haveTextures = true;\n\n  for (auto const& textureName : wantedTextures)\n  {\n    if (parameters.parameters.find(\"equirectangular\") ==\n        parameters.parameters.end())\n    {\n      std::cerr << \"Missing texture: \" << textureName << std::endl;\n      haveTextures = false;\n    }\n    else if (parameters.parameters[textureName].empty())\n    {\n      std::cerr << \"No texture path for: \" << textureName << std::endl;\n      haveTextures = false;\n    }\n  }\n\n  return haveTextures;\n}\n\nvtkSmartPointer<vtkPolyData> GetBoy()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricBoy> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetMobius()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricMobius> surface;\n  surface->SetMinimumV(-0.25);\n  surface->SetMaximumV(0.25);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetRandomHills()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricRandomHills> surface;\n  surface->SetRandomSeed(1);\n  surface->SetNumberOfHills(30);\n  // If you want a plane\n  // surface->SetHillAmplitude(0);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricTorus> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(surface->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, 0);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(surface->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(clipper->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(3);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(subdivide->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(5);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, -1);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(subdivide->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(clipper->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(cleaner->GetOutputPort());\n  normals->FlipNormalsOn();\n  normals->SetFeatureAngle(60);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(normals->GetOutputPort());\n  tangents->ComputeCellTangentsOn();\n  tangents->ComputePointTangentsOff();\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd)\n{\n  float u0 = 1.0;\n  float v0 = 0.0;\n  float du = 1.0 / (uResolution - 1.0);\n  float dv = 1.0 / (vResolution - 1.0);\n  vtkIdType numPts = pd->GetNumberOfPoints();\n  vtkNew<vtkFloatArray> tCoords;\n  tCoords->SetNumberOfComponents(2);\n  tCoords->SetNumberOfTuples(numPts);\n  tCoords->SetName(\"Texture Coordinates\");\n  vtkIdType ptId = 0;\n  float u = u0;\n  for (auto i = 0; i < uResolution; ++i)\n  {\n    float v = v0;\n    for (auto j = 0; j < vResolution; ++j)\n    {\n      float tc[2]{u, v};\n      tCoords->SetTuple(ptId, tc);\n      v += dv;\n      ptId++;\n    }\n    u -= du;\n  }\n  pd->GetPointData()->SetTCoords(tCoords);\n  return pd;\n}\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkSliderRepresentation2D> slider;\n\n  slider->SetMinimumValue(properties.minimumValue);\n  slider->SetMaximumValue(properties.maximumValue);\n  slider->SetValue(properties.initialValue);\n  slider->SetTitleText(properties.title.c_str());\n\n  slider->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint1Coordinate()->SetValue(properties.p1[0], properties.p1[1]);\n  slider->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint2Coordinate()->SetValue(properties.p2[0], properties.p2[1]);\n\n  slider->SetTubeWidth(properties.tubeWidth);\n  slider->SetSliderLength(properties.sliderLength);\n  slider->SetSliderWidth(properties.sliderWidth);\n  slider->SetEndCapLength(properties.endCapLength);\n  slider->SetEndCapWidth(properties.endCapWidth);\n  slider->SetTitleHeight(properties.titleHeight);\n  slider->SetLabelHeight(properties.labelHeight);\n\n  // Set the color properties\n  // Change the color of the title.\n  slider->GetTitleProperty()->SetColor(\n      colors->GetColor3d(properties.titleColor).GetData());\n  // Change the color of the label.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.labelColor).GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(\n      colors->GetColor3d(properties.barColor).GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(\n      colors->GetColor3d(properties.barEndsColor).GetData());\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(\n      colors->GetColor3d(properties.sliderColor).GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(properties.selectedColor).GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.valueColor).GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetRepresentation(slider);\n\n  return sliderWidget;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Skybox_Texturing)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Skybox_Texturing: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Skybox_Texturing MACOSX_BUNDLE PBR_Skybox_Texturing.cxx )\n  target_link_libraries(PBR_Skybox_Texturing PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Skybox_Texturing\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#download-and-build-pbr_skybox_texturing","title":"Download and Build PBR_Skybox_Texturing","text":"

Click here to download PBR_Skybox_Texturing and its CMakeLists.txt file. Once the tarball PBR_Skybox_Texturing.tar has been downloaded and extracted,

cd PBR_Skybox_Texturing/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PBR_Skybox_Texturing\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/Rainbow/","title":"Rainbow","text":"

vtk-examples/Cxx/Rendering/Rainbow

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/Rainbow/#description","title":"Description","text":"

This example demonstrates the use and manipulation of vtkLookupTable's.

First a simple pipeline that reads a vtkStructuredGrid and then extracts a plane using vtkStructuredGeometryFilter from the grid. The plane will be colored differently by using different vtkLookupTable's.

Note

The Update method is manually invoked because it causes the reader to read; later on we use the output of the reader to set a range for the scalar values.

Note

This original tcl source code for this example is here.

Info

See Figure 6-3 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/Rainbow/#code","title":"Code","text":"

Rainbow.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\n// This example demonstrates the use and manipulation of lookup tables.\n\n// First create a simple pipeline that reads a structured grid\n// and then extracts a plane from the grid. The plane will be colored\n// differently by using different lookup tables.\n//\n// Note: The Update method is manually invoked because it causes the\n// reader to read; later on we use the output of the reader to set\n// a range for the scalar values.\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" filexyz.bin fileq.bin e.g.: combxyz.bin combq.bin\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkStructuredGrid* pl3dOutput =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  // Create the 4 renderers\n  vtkNew<vtkRenderer> grayScaleRenderer;\n  renderers.push_back(grayScaleRenderer);\n  vtkNew<vtkRenderer> rainbowBlueRedRenderer;\n  renderers.push_back(rainbowBlueRedRenderer);\n  vtkNew<vtkRenderer> rainbowRedBlueRenderer;\n  renderers.push_back(rainbowRedBlueRenderer);\n  vtkNew<vtkRenderer> largeContrastRenderer;\n  renderers.push_back(largeContrastRenderer);\n\n  std::vector<vtkSmartPointer<vtkLookupTable>> luts;\n\n  vtkNew<vtkLookupTable> grayScaleLut;\n  grayScaleLut->SetHueRange(0, 0);\n  grayScaleLut->SetSaturationRange(0, 0);\n  grayScaleLut->SetValueRange(0.2, 1.0);\n  grayScaleLut->SetNumberOfColors(256);\n  grayScaleLut->SetHueRange(0.0, 0.667);\n  grayScaleLut->Build();\n  luts.push_back(grayScaleLut);\n\n  vtkNew<vtkLookupTable> rainbowBlueRedLut;\n  rainbowBlueRedLut->SetNumberOfColors(256);\n  rainbowBlueRedLut->SetHueRange(0.667, 0.0);\n  rainbowBlueRedLut->Build();\n  luts.push_back(rainbowBlueRedLut);\n\n  vtkNew<vtkLookupTable> rainbowRedBlueLut;\n  rainbowRedBlueLut->SetNumberOfColors(256);\n  rainbowRedBlueLut->SetHueRange(0.0, 0.667);\n  rainbowRedBlueLut->Build();\n  luts.push_back(rainbowRedBlueLut);\n\n  vtkNew<vtkLookupTable> highContrastLut;\n  highContrastLut->SetNumberOfColors(256);\n  highContrastLut->Build();\n\n  for (int l = 0; l < 16; ++l)\n  {\n    highContrastLut->SetTableValue(l * 16, 1, 0, 0, 1);\n    highContrastLut->SetTableValue(l * 16 + 1, 0, 1, 0, 1);\n    highContrastLut->SetTableValue(l * 16 + 2, 0, 0, 1, 1);\n    highContrastLut->SetTableValue(l * 16 + 3, 0, 0, 0, 1);\n  }\n  luts.push_back(highContrastLut);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  int rendererSize = 256;\n  unsigned int xGridDimensions = 2;\n  unsigned int yGridDimensions = 2;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  vtkNew<vtkStructuredGridGeometryFilter> plane;\n  plane->SetInputData(pl3dOutput);\n  plane->SetExtent(1, 100, 1, 100, 7, 7);\n\n  for (size_t r = 0; r < renderers.size(); ++r)\n  {\n    vtkSmartPointer<vtkLookupTable> lut = luts[r];\n    vtkNew<vtkPolyDataMapper> planeMapper;\n    planeMapper->SetLookupTable(lut);\n    planeMapper->SetInputConnection(plane->GetOutputPort());\n    planeMapper->SetScalarRange(pl3dOutput->GetScalarRange());\n\n    vtkNew<vtkActor> planeActor;\n    planeActor->SetMapper(planeMapper);\n\n    // This creates an outline around the data.\n    vtkNew<vtkStructuredGridOutlineFilter> outline;\n    outline->SetInputData(pl3dOutput);\n\n    vtkNew<vtkPolyDataMapper> outlineMapper;\n    outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n    vtkNew<vtkActor> outlineActor;\n    outlineActor->SetMapper(outlineMapper);\n\n    // Create the RenderWindow, Renderer and both Actors.\n    //\n    renderers[r]->AddActor(outlineActor);\n    renderers[r]->AddActor(planeActor);\n\n    renderers[r]->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    renderers[r]->TwoSidedLightingOff();\n    renderers[r]->GetActiveCamera()->Azimuth(20);\n    renderers[r]->GetActiveCamera()->Elevation(30);\n    renderers[r]->ResetCamera();\n    if (r > 0)\n    {\n      renderers[r]->SetActiveCamera(renderers[0]->GetActiveCamera());\n    }\n    renderWindow->AddRenderer(renderers[r]);\n  }\n\n  // Add the actors to the renderer, set the background and size.\n\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  renderWindow->SetWindowName(\"Rainbow\");\n\n  interactor->Initialize();\n\n  vtkCamera* cam1 = renderers[0]->GetActiveCamera();\n  cam1->SetClippingRange(3.95297, 50);\n  cam1->SetFocalPoint(8.88908, 0.595038, 29.3342);\n  cam1->SetPosition(-12.3332, 31.7479, 41.2387);\n  cam1->SetViewUp(0.060772, -0.319905, 0.945498);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/Rainbow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Rainbow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Rainbow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Rainbow MACOSX_BUNDLE Rainbow.cxx )\n  target_link_libraries(Rainbow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Rainbow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/Rainbow/#download-and-build-rainbow","title":"Download and Build Rainbow","text":"

Click here to download Rainbow and its CMakeLists.txt file. Once the tarball Rainbow.tar has been downloaded and extracted,

cd Rainbow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Rainbow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/Rotations/","title":"Rotations","text":"

vtk-examples/Cxx/Rendering/Rotations

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/Rotations/#description","title":"Description","text":"

Rotations of a cow about her axes. In this model, the x axis is from the left to right; the y axis is from bottom to top; and the z axis emerges from the image. The camera location is the same in all four images.

Info

See Figure 3-31 in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/Rotations/#code","title":"Code","text":"

Rotations.cxx

#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <array>\n#include <cctype> // For to_lower\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\nvoid RotateX(vtkRenderWindow* renWin, vtkActor* actor);\nvoid RotateY(vtkRenderWindow* renWin, vtkActor* actor);\nvoid RotateZ(vtkRenderWindow* renWin, vtkActor* actor);\nvoid RotateXY(vtkRenderWindow* renWin, vtkActor* actor);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  /*\n  To match the illustrations in VTKTextbook.pdf, use BkgColor as the background\n    and Wheat as the cow colour.\n  Also comment out the lines:\n    modelActor->GetProperty()->SetSpecular(.6);\n    modelActor->GetProperty()->SetSpecularPower(30);\n  and use cow.g as the input data.\n  */\n\n  auto figure = 0;\n  std::string actorColor = \"Wheat\";\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [figure] [actorColor]\"\n              << std::endl;\n    std::cout << \"where: filename is the file cow.obj\" << std::endl;\n    std::cout << \"       figure is 0, 1, 2, or 3, default 0\" << std::endl;\n    std::cout << \"       actorColor: A color name, default Wheat.\" << std::endl;\n    std::cout << \"Options 0, 1, 2 and 3 are provided to let you generate \"\n                 \"approximations to the following figures:\\n Figure 3-31d, \"\n                 \"Figure 3-31a, Figure 3-33b and Figure 3-33c in Chapter 3 of \"\n                 \"the VTK Textbook.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n\n  if (argc == 3)\n  {\n    figure = atoi(argv[2]);\n  }\n  else if (argc > 3)\n  {\n    figure = atoi(argv[2]);\n    actorColor = argv[3];\n  }\n\n  // Create renderer stuff\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  // std::array<unsigned char, 4> bkg{{60, 93, 144, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"Rotations\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the pipeline.\n  //\n  auto polyData = ReadPolyData(fileName.c_str());\n\n  vtkNew<vtkPolyDataMapper> modelMapper;\n  modelMapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> modelActor;\n  modelActor->SetMapper(modelMapper);\n  modelActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(actorColor).GetData());\n\n  if (actorColor != \"Wheat\")\n  {\n    modelActor->GetProperty()->SetSpecular(0.6);\n    modelActor->GetProperty()->SetSpecularPower(30);\n  }\n\n  vtkNew<vtkAxes> modelAxesSource;\n  modelAxesSource->SetScaleFactor(10);\n  modelAxesSource->SetOrigin(0, 0, 0);\n\n  vtkNew<vtkPolyDataMapper> modelAxesMapper;\n  modelAxesMapper->SetInputConnection(modelAxesSource->GetOutputPort());\n\n  vtkNew<vtkActor> modelAxes;\n  modelAxes->SetMapper(modelAxesMapper);\n\n  ren1->AddActor(modelAxes);\n  modelAxes->VisibilityOff();\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(modelActor);\n  if (actorColor == \"Wheat\")\n  {\n    ren1->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  }\n  else\n  {\n    ren1->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  }\n  renWin->SetSize(640, 480);\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(0);\n  ren1->GetActiveCamera()->SetClippingRange(0.1, 1000.0);\n\n  modelAxes->VisibilityOn();\n\n  renWin->Render();\n  renWin->Render();\n\n  switch (figure)\n  {\n  default:\n  case 0:\n    RotateXY(renWin, modelActor);\n    break;\n  case 1:\n    RotateX(renWin, modelActor);\n    break;\n  case 2:\n    RotateY(renWin, modelActor);\n    break;\n  case 3:\n    RotateZ(renWin, modelActor);\n    break;\n  }\n  renWin->EraseOff();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid RotateX(vtkRenderWindow* renWin, vtkActor* actor)\n{\n  actor->SetOrientation(0, 0, 0);\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n\n  for (auto i = 0; i < 6; ++i)\n  {\n    actor->RotateX(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  renWin->EraseOn();\n}\n\nvoid RotateY(vtkRenderWindow* renWin, vtkActor* actor)\n{\n  actor->SetOrientation(0, 0, 0);\n  renWin->Render();\n  renWin->EraseOff();\n\n  for (auto i = 0; i < 6; ++i)\n  {\n    actor->RotateY(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  renWin->EraseOn();\n}\n\nvoid RotateZ(vtkRenderWindow* renWin, vtkActor* actor)\n{\n  actor->SetOrientation(0, 0, 0);\n  renWin->Render();\n  renWin->EraseOff();\n\n  for (auto i = 0; i < 6; ++i)\n  {\n    actor->RotateZ(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  renWin->EraseOn();\n}\n\nvoid RotateXY(vtkRenderWindow* renWin, vtkActor* actor)\n{\n  actor->SetOrientation(0, 0, 0);\n  actor->RotateX(60);\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n\n  for (auto i = 0; i < 6; ++i)\n  {\n    actor->RotateY(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  renWin->EraseOn();\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\n} // namespace\n
"},{"location":"Cxx/Rendering/Rotations/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Rotations)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Rotations: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Rotations MACOSX_BUNDLE Rotations.cxx )\n  target_link_libraries(Rotations PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Rotations\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/Rotations/#download-and-build-rotations","title":"Download and Build Rotations","text":"

Click here to download Rotations and its CMakeLists.txt file. Once the tarball Rotations.tar has been downloaded and extracted,

cd Rotations/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Rotations\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/RotationsA/","title":"RotationsA","text":"

vtk-examples/Cxx/Rendering/RotationsA

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/RotationsA/#code","title":"Code","text":"

RotationsA.cxx

// These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n// The command line parameters are: cow.obj 1\n#include \"Rotations.cxx\"\n
"},{"location":"Cxx/Rendering/RotationsA/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotationsA)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotationsA: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotationsA MACOSX_BUNDLE RotationsA.cxx )\n  target_link_libraries(RotationsA PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotationsA\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/RotationsA/#download-and-build-rotationsa","title":"Download and Build RotationsA","text":"

Click here to download RotationsA and its CMakeLists.txt file. Once the tarball RotationsA.tar has been downloaded and extracted,

cd RotationsA/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RotationsA\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/RotationsB/","title":"RotationsB","text":"

vtk-examples/Cxx/Rendering/RotationsB

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/RotationsB/#code","title":"Code","text":"

RotationsB.cxx

// These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n// The command line parameters are: cow.obj 2\n#include \"Rotations.cxx\"\n
"},{"location":"Cxx/Rendering/RotationsB/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotationsB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotationsB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotationsB MACOSX_BUNDLE RotationsB.cxx )\n  target_link_libraries(RotationsB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotationsB\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/RotationsB/#download-and-build-rotationsb","title":"Download and Build RotationsB","text":"

Click here to download RotationsB and its CMakeLists.txt file. Once the tarball RotationsB.tar has been downloaded and extracted,

cd RotationsB/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RotationsB\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/RotationsC/","title":"RotationsC","text":"

vtk-examples/Cxx/Rendering/RotationsC

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/RotationsC/#code","title":"Code","text":"

RotationsC.cxx

// These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n// The command line parameters are: cow.obj 3\n#include \"Rotations.cxx\"\n
"},{"location":"Cxx/Rendering/RotationsC/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotationsC)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotationsC: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotationsC MACOSX_BUNDLE RotationsC.cxx )\n  target_link_libraries(RotationsC PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotationsC\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/RotationsC/#download-and-build-rotationsc","title":"Download and Build RotationsC","text":"

Click here to download RotationsC and its CMakeLists.txt file. Once the tarball RotationsC.tar has been downloaded and extracted,

cd RotationsC/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RotationsC\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/RotationsD/","title":"RotationsD","text":"

vtk-examples/Cxx/Rendering/RotationsD

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/RotationsD/#code","title":"Code","text":"

RotationsD.cxx

// These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n// The command line parameters are: cow.obj 0\n#include \"Rotations.cxx\"\n
"},{"location":"Cxx/Rendering/RotationsD/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotationsD)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotationsD: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotationsD MACOSX_BUNDLE RotationsD.cxx )\n  target_link_libraries(RotationsD PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotationsD\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/RotationsD/#download-and-build-rotationsd","title":"Download and Build RotationsD","text":"

Click here to download RotationsD and its CMakeLists.txt file. Once the tarball RotationsD.tar has been downloaded and extracted,

cd RotationsD/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RotationsD\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/Shadows/","title":"Shadows","text":"

vtk-examples/Cxx/Rendering/Shadows

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/Shadows/#code","title":"Code","text":"

Shadows.cxx

// Test baking shadow maps.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCameraPass.h>\n#include <vtkCubeSource.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderStepsPass.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSequencePass.h>\n#include <vtkShadowMapBakerPass.h>\n#include <vtkShadowMapPass.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  // Read the polyData.\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"HighNoonSun\", 1.0, 1.0, .9843, 1.0); // Color temp. 5400k.\n  colors->SetColor(\"100W Tungsten\", 1.0, .8392, .6667,\n                   1.0); // Color temp. 2850k.\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkLight> light1;\n  light1->SetFocalPoint(0, 0, 0);\n  light1->SetPosition(0, 1, 0.2);\n  light1->SetColor(colors->GetColor3d(\"HighNoonSun\").GetData());\n  light1->SetIntensity(0.3);\n  renderer->AddLight(light1);\n\n  vtkNew<vtkLight> light2;\n  light2->SetFocalPoint(0, 0, 0);\n  light2->SetPosition(1.0, 1.0, 1.0);\n  light2->SetColor(colors->GetColor3d(\"100W Tungsten\").GetData());\n  light2->SetIntensity(0.8);\n  renderer->AddLight(light2);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetAmbientColor(\n      colors->GetColor3d(\"SaddleBrown\").GetData());\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Sienna\").GetData());\n  actor->GetProperty()->SetSpecularColor(colors->GetColor3d(\"White\").GetData());\n  actor->GetProperty()->SetSpecular(0.51);\n  actor->GetProperty()->SetDiffuse(0.7);\n  actor->GetProperty()->SetAmbient(0.7);\n  actor->GetProperty()->SetSpecularPower(30.0);\n  actor->GetProperty()->SetOpacity(1.0);\n  renderer->AddActor(actor);\n\n  // Add a plane.\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n\n  std::array<double, 3> range;\n  range[0] = bounds[1] - bounds[0];\n  range[1] = bounds[3] - bounds[2];\n  range[2] = bounds[5] - bounds[4];\n  std::cout << \"Range: \" << range[0] << \",\" << range[1] << \",\" << range[2]\n            << std::endl;\n  double expand = 1.0;\n  auto thickness = range[2] * 0.1;\n  vtkNew<vtkCubeSource> plane;\n  plane->SetCenter((bounds[1] + bounds[0]) / 2.0, bounds[2] - thickness / 2.0,\n                   (bounds[5] + bounds[4]) / 2.0);\n  plane->SetXLength(bounds[1] - bounds[0] + (range[0] * expand));\n  plane->SetYLength(thickness);\n  plane->SetZLength(bounds[5] - bounds[4] + (range[2] * expand));\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(plane->GetOutputPort());\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n  renderer->AddActor(planeActor);\n\n  renderWindow->SetMultiSamples(0);\n\n  vtkNew<vtkShadowMapPass> shadows;\n\n  vtkNew<vtkSequencePass> seq;\n\n  vtkNew<vtkRenderPassCollection> passes;\n  passes->AddItem(shadows->GetShadowMapBakerPass());\n  passes->AddItem(shadows);\n  seq->SetPasses(passes);\n\n  vtkNew<vtkCameraPass> cameraP;\n  cameraP->SetDelegatePass(seq);\n\n  // Tell the renderer to use our render pass pipeline.\n  vtkOpenGLRenderer* glrenderer =\n      dynamic_cast<vtkOpenGLRenderer*>(renderer.GetPointer());\n  glrenderer->SetPass(cameraP);\n\n  renderer->GetActiveCamera()->SetPosition(-0.2, 0.2, 1);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(2.25);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"Shadows\");\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(100);\n    source->SetPhiResolution(100);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Rendering/Shadows/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Shadows)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Shadows: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Shadows MACOSX_BUNDLE Shadows.cxx )\n  target_link_libraries(Shadows PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Shadows\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/Shadows/#download-and-build-shadows","title":"Download and Build Shadows","text":"

Click here to download Shadows and its CMakeLists.txt file. Once the tarball Shadows.tar has been downloaded and extracted,

cd Shadows/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Shadows\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/SpecularSpheres/","title":"SpecularSpheres","text":"

vtk-examples/Cxx/Rendering/SpecularSpheres

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/SpecularSpheres/#description","title":"Description","text":"

Note

The original source code for this example is here.

Info

See Figure 3-10 in Chapter 3 the VTK Textbook.

Info

Similar examples setting the ambient and diffuse properties are: See AmbientSpheres.cxx, AmbientSpheres.py, AmbientSpheres.java and DiffuseSpheres.cxx, DiffuseSpheres.py.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/SpecularSpheres/#code","title":"Code","text":"

SpecularSpheres.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"bkg\", bkg.data());\n\n  // The following lines create a sphere represented by polygons.\n  //\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(50);\n\n  // The mapper is responsible for pushing the geometry into the graphics\n  // library. It may also do color mapping, if scalars or other attributes\n  // are defined.\n  //\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  // The actor is a grouping mechanism: besides the geometry (mapper), it\n  // also has a property, transformation matrix, and/or texture map.\n  // In this example we create eight different spheres (two rows of four\n  // spheres) and set the specular lighting coefficients. A little ambient\n  // is turned on so the sphere is not completely black on the back side.\n  //\n  // Since we are using the same sphere source and mapper for all eight spheres\n  // we will use a std::array holding the actors.\n  //\n  // If you want/need to use std::vector, then you must use\n  // std::vector<vtkSmartPointer<vtkActor>> spheres;\n  // and then, in a loop, create the object using\n  // spheres.push_back(vtkSmartPointer<vtkActor>::New());\n  //\n  // The reason:\n  // vtkNew, in contrast to vtkSmartPointer, has no assignment operator\n  // or copy constructor and owns one object for its whole lifetime.\n  // Thus vtkNew does not satisfy the CopyAssignable and CopyConstructible\n  // requirements needed for other std containers like std::vector or std::list.\n  // std::array, on the other hand, is a container encapsulating fixed size\n  // arrays so its elements do not need to be CopyAssignable and\n  // CopyConstructible.\n  //\n  // So:\n  //    std::array - vtkNew or vtkSmartPointer can be used.\n  //    std::vector, std::list - only vtkSmartPointer can be used.\n  //\n  auto const numberOfSpheres = 8;\n  std::array<vtkNew<vtkActor>, numberOfSpheres> spheres;\n  auto ambient = 0.3;\n  auto diffuse = 0.5;\n  auto specular = 1.0;\n  auto spBase = 5.0;\n  auto spScale = 1.0;\n  std::array<double, 3> position{{0, 0, 0}};\n  for (auto i = 0; i < spheres.size(); ++i)\n  {\n    auto specularPower = spBase * spScale;\n    spheres[i]->SetMapper(sphereMapper);\n    spheres[i]->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n    spheres[i]->GetProperty()->SetAmbient(ambient);\n    spheres[i]->GetProperty()->SetDiffuse(diffuse);\n    spheres[i]->GetProperty()->SetSpecular(specular);\n    spheres[i]->GetProperty()->SetSpecularPower(specularPower);\n    spheres[i]->GetProperty()->SetSpecularColor(\n        colors->GetColor3d(\"White\").GetData());\n    spheres[i]->AddPosition(position.data());\n    spScale = spScale * 2.0;\n    position[0] += 1.25;\n    if (i == 3)\n    {\n      specular = 0.5;\n      spScale = 1.0;\n      position[0] = 0;\n      position[1] = 1.25;\n    }\n  }\n\n  // Create the graphics structure. The renderer renders into the\n  // render window. The render window interactor captures mouse events\n  // and will perform appropriate camera or actor manipulation\n  // depending on the nature of the events.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  for (auto i = 0; i < 8; ++i)\n  {\n    ren->AddActor(spheres[i]);\n  }\n\n  ren->SetBackground(colors->GetColor3d(\"bkg\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"SpecularSpheres\");\n\n  // Set up the lighting.\n  //\n  vtkNew<vtkLight> light;\n  light->SetFocalPoint(1.875, 0.6125, 0);\n  light->SetPosition(0.875, 1.6125, 1);\n  ren->AddLight(light);\n\n  // We want to eliminate perspective effects on the apparent lighting.\n  // Parallel camera projection will be used. To zoom in parallel projection\n  // mode, the ParallelScale is set.\n  //\n  ren->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  ren->GetActiveCamera()->SetPosition(0, 0, 1);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->GetActiveCamera()->ParallelProjectionOn();\n  ren->ResetCamera();\n  ren->GetActiveCamera()->SetParallelScale(2.0);\n  // This starts the event loop and invokes an initial render.\n  //\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/SpecularSpheres/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SpecularSpheres)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SpecularSpheres: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SpecularSpheres MACOSX_BUNDLE SpecularSpheres.cxx )\n  target_link_libraries(SpecularSpheres PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SpecularSpheres\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/SpecularSpheres/#download-and-build-specularspheres","title":"Download and Build SpecularSpheres","text":"

Click here to download SpecularSpheres and its CMakeLists.txt file. Once the tarball SpecularSpheres.tar has been downloaded and extracted,

cd SpecularSpheres/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SpecularSpheres\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/StippledLine/","title":"StippledLine","text":"

vtk-examples/Cxx/Rendering/StippledLine

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/StippledLine/#description","title":"Description","text":"

VTK OpenGL2 no longer supports Stippled Lines. This example uses texture mapping to created stippled lines. Two parameters, StipplePattern and StippleRepeat, control the pattern of the stippled lines.

StipplePattern is a 16-bit binary pattern, 1 = pixel on, 0 = pixel off.

StippleRepeat is the stippling repeat factor of a Line, which specifies how many times each bit in the pattern is to be repeated.

It can be tricky to set the proper pattern and repeat, so experiment.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/StippledLine/#code","title":"Code","text":"

StippledLine.cxx

#include <vtkActor.h>\n#include <vtkDoubleArray.h>\n#include <vtkImageData.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid StippledLine(vtkActor* actor, int LineStipplePattern = 0xFFFF,\n                  int LineStippleRepeat = 1);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkLineSource> lines;\n  // Create two points, P0 and P1\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {5.0, 0.0, 0.0};\n\n  lines->SetResolution(11);\n  lines->SetPoint1(p0);\n  lines->SetPoint2(p1);\n  lines->Update();\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(lines->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetLineWidth(5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  StippledLine(actor, 0xA1A1, 2);\n\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"StippledLine\");\n\n  renWin->AddRenderer(ren1);\n  vtkSmartPointer<vtkRenderWindowInteractor> iren =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renWin);\n  ren1->AddActor(actor);\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid StippledLine(vtkActor* actor, int lineStipplePattern,\n                  int lineStippleRepeat)\n{\n  vtkNew<vtkDoubleArray> tcoords;\n  vtkNew<vtkImageData> image;\n  vtkNew<vtkTexture> texture;\n\n  // Create texture.\n  int dimension = 16 * lineStippleRepeat;\n\n  image->SetDimensions(dimension, 1, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 4);\n  image->SetExtent(0, dimension - 1, 0, 0, 0, 0);\n  unsigned char* pixel;\n  pixel = static_cast<unsigned char*>(image->GetScalarPointer());\n  unsigned char on = 255;\n  unsigned char off = 0;\n  for (int i = 0; i < 16; ++i)\n  {\n    unsigned int mask = (1 << i);\n    unsigned int bit = (lineStipplePattern & mask) >> i;\n    unsigned char value = static_cast<unsigned char>(bit);\n    if (value == 0)\n    {\n      for (int j = 0; j < lineStippleRepeat; ++j)\n      {\n        *pixel = on;\n        *(pixel + 1) = on;\n        *(pixel + 2) = on;\n        *(pixel + 3) = off;\n        pixel += 4;\n      }\n    }\n    else\n    {\n      for (int j = 0; j < lineStippleRepeat; ++j)\n      {\n        *pixel = on;\n        *(pixel + 1) = on;\n        *(pixel + 2) = on;\n        *(pixel + 3) = on;\n        pixel += 4;\n      }\n    }\n  }\n  vtkPolyData* polyData =\n      dynamic_cast<vtkPolyData*>(actor->GetMapper()->GetInput());\n\n  // Create texture coordnates.\n  tcoords->SetNumberOfComponents(1);\n  tcoords->SetNumberOfTuples(polyData->GetNumberOfPoints());\n  for (int i = 0; i < polyData->GetNumberOfPoints(); ++i)\n  {\n    double value = static_cast<double>(i) * .5;\n    tcoords->SetTypedTuple(i, &value);\n  }\n\n  polyData->GetPointData()->SetTCoords(tcoords);\n  texture->SetInputData(image);\n  texture->InterpolateOff();\n  texture->RepeatOn();\n\n  actor->SetTexture(texture);\n}\n} // namespace\n
"},{"location":"Cxx/Rendering/StippledLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StippledLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StippledLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StippledLine MACOSX_BUNDLE StippledLine.cxx )\n  target_link_libraries(StippledLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StippledLine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/StippledLine/#download-and-build-stippledline","title":"Download and Build StippledLine","text":"

Click here to download StippledLine and its CMakeLists.txt file. Once the tarball StippledLine.tar has been downloaded and extracted,

cd StippledLine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StippledLine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/StringToImageDemo/","title":"StringToImageDemo","text":"

vtk-examples/Cxx/Rendering/StringToImageDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/StringToImageDemo/#description","title":"Description","text":"

This example demonstrates the use of vtkFreeTypeTools to populate an image with multiple strings converted into images. The final image is created using vtkImageBlend to blend each string image into the final image. If a string image does not fit in the final image or overlaps with an image in final, that sting image is skipped.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/StringToImageDemo/#code","title":"Code","text":"

StringToImageDemo.cxx

#include <vtkCamera.h>\n#include <vtkFreeTypeTools.h>\n#include <vtkImageBlend.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageIterator.h>\n#include <vtkImageViewer2.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStdString.h>\n#include <vtkTextProperty.h>\n\n#include <array>\n// #include <random>\n\nint main(int argc, char* argv[])\n{\n  vtkStdString text;\n  if (argc < 2)\n  {\n    text = \"Old Guys Rule\";\n  }\n  else\n  {\n    text = argv[1];\n  }\n\n  // Create a blank, black image\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 640, 0, 480, 0, 0);\n  drawing->SetDrawColor(0, 0, 0);\n  drawing->FillBox(0, 629, 0, 479);\n\n  // Create an image that will hold the final image\n  vtkNew<vtkImageBlend> final;\n  final->AddInputConnection(drawing->GetOutputPort());\n  final->SetOpacity(0, 1.0);\n  final->Update();\n\n  // Create an image of the string\n  int dpi = 150;\n  vtkFreeTypeTools* freeType = vtkFreeTypeTools::GetInstance();\n  freeType->ScaleToPowerTwoOff();\n\n  // Setup a property for the strings containing fixed parameters\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  textProperty->SetVerticalJustificationToCentered();\n  textProperty->SetJustificationToCentered();\n\n  // Distributions for random parameters\n  // std::mt19937 mt(4355412); // Standard mersenne_twister_engine\n  // std::uniform_int_distribution<> extentXDist(0, 640);\n  // std::uniform_int_distribution<> extentYDist(0, 480);\n  // std::uniform_int_distribution<> fontDist(6, 42);\n  // std::uniform_real_distribution<double> orientationDist(-90, 90);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n\n  // For each string, create an image and see if it overlaps with other images,\n  // if so, skip it\n  int tried = 600;\n  int accepted = 0;\n  for (int i = 0; i < tried; ++i)\n  {\n    // int fontSize = fontDist(mt);\n    int fontSize = static_cast<int>(randomSequence->GetRangeValue(6, 42));\n    randomSequence->Next();\n    // textProperty->SetOrientation(orientationDist(mt));\n    textProperty->SetOrientation(randomSequence->GetRangeValue(-90, 90));\n    randomSequence->Next();\n    textProperty->SetFontSize(fontSize);\n\n    vtkNew<vtkImageData> textImage;\n    freeType->RenderString(textProperty, text, dpi, textImage.GetPointer());\n\n    // Set the extent of the text image\n    std::array<int, 4> bb;\n    freeType->GetBoundingBox(textProperty, text, dpi, bb.data());\n    // int offsetX = extentXDist(mt);\n    // int offsetY = extentYDist(mt);\n    int offsetX = static_cast<int>(randomSequence->GetRangeValue(0, 640));\n    randomSequence->Next();\n    int offsetY = static_cast<int>(randomSequence->GetRangeValue(0, 480));\n    randomSequence->Next();\n    // Make sure the text image will fit on the final image\n    if (offsetX + bb[1] - bb[0] < 639 && offsetY + bb[3] - bb[2] < 479)\n    {\n      textImage->SetExtent(offsetX, offsetX + bb[1] - bb[0], offsetY,\n                           offsetY + bb[3] - bb[2], 0, 0);\n      vtkNew<vtkImageData> image;\n      final->Update();\n\n      // Does the text image overlap with images on the final image\n      vtkImageIterator<unsigned char> finalIt(final->GetOutput(),\n                                              textImage->GetExtent());\n      unsigned char R;\n      bool good = true;\n      while (!finalIt.IsAtEnd())\n      {\n        auto finalSpan = finalIt.BeginSpan();\n        while (finalSpan != finalIt.EndSpan())\n        {\n          R = *finalSpan++;\n          finalSpan++;\n          finalSpan++;\n          if (R != 0)\n          {\n            good = false;\n            break;\n          }\n        }\n        if (!good)\n        {\n          break;\n        }\n        finalIt.NextSpan();\n      }\n      if (good)\n      {\n        accepted++;\n        image->DeepCopy(textImage);\n        final->AddInputData(image);\n        final->SetOpacity(i + 1, 1.0); // text: 100% opaque\n        final->Update();\n      }\n    }\n  }\n  std::cout << \"Tried \" << tried << \", but only accepted \" << accepted\n            << std::endl;\n  // Display the result\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputData(final->GetOutput());\n  imageViewer->SetSize(640, 512);\n  imageViewer->SetupInteractor(interactor);\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Wheat\").GetData());\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderWindow()->SetWindowName(\"StringToImageDemo\");\n\n  auto camera = imageViewer->GetRenderer()->GetActiveCamera();\n  camera->ParallelProjectionOn();\n  camera->SetParallelScale(640 * 0.4);\n  imageViewer->GetRenderWindow()->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/StringToImageDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StringToImageDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StringToImageDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StringToImageDemo MACOSX_BUNDLE StringToImageDemo.cxx )\n  target_link_libraries(StringToImageDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StringToImageDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/StringToImageDemo/#download-and-build-stringtoimagedemo","title":"Download and Build StringToImageDemo","text":"

Click here to download StringToImageDemo and its CMakeLists.txt file. Once the tarball StringToImageDemo.tar has been downloaded and extracted,

cd StringToImageDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StringToImageDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/StripFran/","title":"StripFran","text":"

vtk-examples/Cxx/Rendering/StripFran

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/StripFran/#description","title":"Description","text":"

Triangle strip examples. Left, structured triangle mesh consisting of 134 strips each of 390 triangles. Right, Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip.

Info

See Figure 9-21 in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/StripFran/#code","title":"Code","text":"

StripFran.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDecimatePro.h>\n#include <vtkMaskPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fran_cut.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer1;\n  renderer1->SetViewport(0., 0., 0.5, 1.);\n\n  vtkNew<vtkRenderer> renderer2;\n  renderer2->SetViewport(0.5, 0., 1., 1.);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer1);\n  renderWindow->AddRenderer(renderer2);\n  renderWindow->SetWindowName(\"StripFran\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // create a cyberware source\n  //\n  vtkNew<vtkPolyDataReader> cyber;\n  cyber->SetFileName(argv[1]);\n\n  vtkNew<vtkDecimatePro> deci;\n  deci->SetInputConnection(cyber->GetOutputPort());\n  deci->SetTargetReduction(0.7);\n  deci->PreserveTopologyOn();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(deci->GetOutputPort());\n\n  vtkNew<vtkMaskPolyData> mask;\n  mask->SetInputConnection(deci->GetOutputPort());\n  mask->SetOnRatio(2);\n\n  vtkNew<vtkPolyDataMapper> cyberMapper;\n  cyberMapper->SetInputConnection(mask->GetOutputPort());\n\n  vtkNew<vtkActor> cyberActor;\n  cyberActor->SetMapper(cyberMapper);\n  cyberActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(cyber->GetOutputPort());\n\n  vtkNew<vtkMaskPolyData> stripperMask;\n  stripperMask->SetInputConnection(stripper->GetOutputPort());\n  stripperMask->SetOnRatio(2);\n\n  vtkNew<vtkPolyDataMapper> stripperMapper;\n  stripperMapper->SetInputConnection(stripperMask->GetOutputPort());\n\n  vtkNew<vtkActor> stripperActor;\n  stripperActor->SetMapper(stripperMapper);\n  stripperActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer1->AddActor(stripperActor);\n  renderer2->AddActor(cyberActor);\n  renderer1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer2->SetBackground(colors->GetColor3d(\"Papaya_Whip\").GetData());\n  renderWindow->SetSize(1024, 640);\n\n  // render the image\n  //\n  vtkNew<vtkCamera> cam1;\n  cam1->SetFocalPoint(0, 0, 0);\n  cam1->SetPosition(1, 0, 0);\n  cam1->SetViewUp(0, 1, 0);\n  renderer1->SetActiveCamera(cam1);\n  renderer2->SetActiveCamera(cam1);\n  renderer1->ResetCamera();\n  cam1->Azimuth(30);\n  cam1->Elevation(30);\n  cam1->Dolly(1.4);\n  renderer1->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/StripFran/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StripFran)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StripFran: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StripFran MACOSX_BUNDLE StripFran.cxx )\n  target_link_libraries(StripFran PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StripFran\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/StripFran/#download-and-build-stripfran","title":"Download and Build StripFran","text":"

Click here to download StripFran and its CMakeLists.txt file. Once the tarball StripFran.tar has been downloaded and extracted,

cd StripFran/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StripFran\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/TransformSphere/","title":"TransformSphere","text":"

vtk-examples/Cxx/Rendering/TransformSphere

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/TransformSphere/#description","title":"Description","text":"

This example extends the pipeline of the ColoredSphere.cxx example and shows the effects of type checking on the connectivity of process objects. We add a transform filter (vtkTransformFilter) to nonuniformly scale the sphere in the x-y-z directions. The transform filter only operates on objects with explicit point coordinate representation (i.e., a subclass of vtkPointSet ). However, the elevation filter generates the more general form vtkDataSet as output. Hence we cannot connect the transform filter to the elevation filter. But we can connect the transform filter to the sphere source, and then the elevation filter to the transform filter. (Note: an alternative method is to use vtkCastToConcrete to perform run-time casting.)

Info

See Figure 4-20 in Chapter 4 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/TransformSphere/#code","title":"Code","text":"

TransformSphere.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkElevationFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(12);\n  sphere->SetPhiResolution(12);\n\n  vtkNew<vtkTransform> aTransform;\n  aTransform->Scale(1, 1.5, 2);\n\n  vtkNew<vtkTransformFilter> transFilter;\n  transFilter->SetInputConnection(sphere->GetOutputPort());\n  transFilter->SetTransform(aTransform);\n\n  vtkNew<vtkElevationFilter> colorIt;\n  colorIt->SetInputConnection(transFilter->GetOutputPort());\n  colorIt->SetLowPoint(0, 0, -1);\n  colorIt->SetHighPoint(0, 0, 1);\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.667, 0);\n  lut->SetSaturationRange(1, 1);\n  lut->SetValueRange(1, 1);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetLookupTable(lut);\n  mapper->SetInputConnection(colorIt->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"TransformSphere\");\n\n  renWin->Render();\n\n  // interact with data\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Rendering/TransformSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformSphere MACOSX_BUNDLE TransformSphere.cxx )\n  target_link_libraries(TransformSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/TransformSphere/#download-and-build-transformsphere","title":"Download and Build TransformSphere","text":"

Click here to download TransformSphere and its CMakeLists.txt file. Once the tarball TransformSphere.tar has been downloaded and extracted,

cd TransformSphere/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TransformSphere\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/TransparentBackground/","title":"TransparentBackground","text":"

vtk-examples/Cxx/Rendering/TransparentBackground

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/TransparentBackground/#description","title":"Description","text":"

Demonstrates the use of two renderers. Notice that the second (and subsequent) renderers will have a transparent background.

You can manipulate the object in the second layer/renderer whilst the objects in the first layer/renderer form the background.

  • Pressing 0 on the keyboard will let you manipulate the objects in layer 0.
  • Pressing 1 on the keyboard will let you manipulate the objects in layer 1.

Info

Also see the LayeredActors.cxx and LayeredActors.py examples, where we have added an extra callback so that the non-active layer objects move in conjunction with the active layer objects.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/TransparentBackground/#code","title":"Code","text":"

TransparentBackground.cxx

/**\n  1. Create a cube and cone source.\n  2. Render it with the cube in layer 0 and the cone in layer 1 of the render\n  window.\n  3. Interact with it.\n  4. Notice that the cube and the cone are both visible and the layer 1\n  background is transparent.\n  5. Pressing '0' on the keyboard will let you manipulate the objects in\n  layer 0.\n  6. Pressing '1' on the keyboard will let you manipulate the objects in\n  layer 1.\n*/\n\n#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkInteractorObserver.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n\n#include <array>\n#include <cstdlib>\n#include <iomanip>\n#include <iostream>\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                              void* clientData, void* callData);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetXLength(4.0);\n  cubeSource->SetYLength(9.0);\n  cubeSource->SetZLength(1.0);\n  cubeSource->SetCenter(0.0, 0.0, 0.0);\n\n  // Render the cube\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"DarkGreen\").GetData());\n  cubeActor->SetMapper(cubeMapper);\n\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetCenter(0.0, 0.0, 0.0);\n  coneSource->SetHeight(1.0);\n  coneSource->SetRadius(0.25);\n  coneSource->SetDirection(0.0, 1.0, 0.0);\n  coneSource->SetResolution(60);\n  coneSource->CappingOn();\n\n  // Render the cone\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"DarkTurquoise\").GetData());\n  // Make the cone slightly transparent for fun\n  coneActor->GetProperty()->SetOpacity(0.75);\n  coneActor->SetMapper(coneMapper);\n\n  // The renderers, render window and interactor\n  std::array<vtkNew<vtkRenderer>, 2> renderers;\n  vtkNew<vtkRenderWindow> renWin;\n  for (auto&& ren : renderers)\n  {\n    renWin->AddRenderer(ren);\n  }\n  renWin->SetSize(800, 800);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Layer 0 - background not transparent\n  renderers[0]->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderers[0]->AddActor(cubeActor);\n  renderers[0]->SetLayer(0);\n\n  // Layer 1 - the background is transparent\n  //           so we only see the layer 0 background color\n  renderers[1]->AddActor(coneActor);\n  renderers[1]->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderers[1]->SetLayer(1);\n\n  // We have two layers\n  renWin->SetNumberOfLayers(static_cast<int>(renderers.size()));\n  renWin->Render();\n  renWin->SetWindowName(\"TransparentBackground\");\n  renWin->StereoRenderOff();\n\n  vtkNew<vtkCallbackCommand> keypressCallback;\n  keypressCallback->SetCallback(KeypressCallbackFunction);\n  iren->AddObserver(vtkCommand::KeyPressEvent, keypressCallback);\n\n  // Interact with the data\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject* caller,\n                              long unsigned int vtkNotUsed(eventId),\n                              void* vtkNotUsed(clientData),\n                              void* vtkNotUsed(callData))\n{\n  vtkRenderWindowInteractor* iren =\n      static_cast<vtkRenderWindowInteractor*>(caller);\n  vtkRendererCollection* renderers = iren->GetRenderWindow()->GetRenderers();\n  if (renderers->GetNumberOfItems() < 2)\n  {\n    std::cerr << \"We need at least two renderers, we have only \"\n              << renderers->GetNumberOfItems() << std::endl;\n    return;\n  }\n  renderers->InitTraversal();\n  // Top item\n  vtkRenderer* ren0 = renderers->GetNextItem();\n  // Bottom item\n  vtkRenderer* ren1 = renderers->GetNextItem();\n\n  std::string key = iren->GetKeySym();\n\n  if (key == \"0\")\n  {\n    iren->GetRenderWindow()\n        ->GetInteractor()\n        ->GetInteractorStyle()\n        ->SetDefaultRenderer(ren0);\n    ren0->InteractiveOn();\n    ren1->InteractiveOff();\n  }\n  if (key == \"1\")\n  {\n    iren->GetRenderWindow()\n        ->GetInteractor()\n        ->GetInteractorStyle()\n        ->SetDefaultRenderer(ren1);\n    ren0->InteractiveOff();\n    ren1->InteractiveOn();\n  }\n}\n} // namespace\n
"},{"location":"Cxx/Rendering/TransparentBackground/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransparentBackground)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransparentBackground: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransparentBackground MACOSX_BUNDLE TransparentBackground.cxx )\n  target_link_libraries(TransparentBackground PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransparentBackground\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/TransparentBackground/#download-and-build-transparentbackground","title":"Download and Build TransparentBackground","text":"

Click here to download TransparentBackground and its CMakeLists.txt file. Once the tarball TransparentBackground.tar has been downloaded and extracted,

cd TransparentBackground/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TransparentBackground\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/WalkCow/","title":"WalkCow","text":"

vtk-examples/Cxx/Rendering/WalkCow

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Rendering/WalkCow/#description","title":"Description","text":"

This generates Fig. 3-32: The cow \"walking\" around the global origin; Fig. 3-33: The cow rotating about a vector passing through her nose. (a) With origin (0,0,0). (b) With origin at (6.1,1.3,.02). found in VTKTextbook.

The example allows an optional second argument that selects the figure to be generated. A 0 generates Fig 3-32, 1 generates Fig 3-33a and 2 generates Fig 3-33b.

Info

See Figure 3-32 in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/WalkCow/#code","title":"Code","text":"

WalkCow.cxx

// Translated from walkCow.tcl\n\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkBYUReader.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkVersionMacros.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <array>\n\nnamespace {\n/*\nThese Rotate* and Walk functions create a scene where multiple\n   views of the object exist.\n\n  They all operate in a similar manner, namely:\n  1) Accept vtkActor, vtkRenderer, vtkRenderWindow as parameters.\n  2) Position the object.\n  3) Position the observer with the focal point sent to the centre\n      of the object.\n  4) Render and set EraseOff() in the render window.\n     Note that:\n      EraseOff() has to be called after a Render() call\n       to work in the desired way.\n  5) Then rotate or walk the object around the scene.\n  6) Write out the scene using Screenshot().\n  6) Set EraseOff() in the render window.\n  7) Reset the object position.\n\n*/\nvoid Rotate_X(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Rotate_Y(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Rotate_Z(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Rotate_XY(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Rotate_V_0(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Rotate_V_V(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Walk(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\n\n/*\n// Used to estimate positions similar to the book illustrations.\nstatic void CameraModifiedCallback(vtkObject* caller,\n                                   long unsigned int vtkNotUsed(eventId),\n                                   void* vtkNotUsed(clientData),\n                                   void* vtkNotUsed(callData));\n*/\n\n// Save a screenshot.\nvoid Screenshot(std::string fileName, vtkRenderWindow* renWin);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  int figure = 0;\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [figure]\" << std::endl;\n    std::cout << \"where: filename is the file cow.g\" << std::endl;\n    std::cout << \"       figure is 0, 1, or 2, default 0\" << std::endl;\n    std::cout\n        << \"Options 0, 1 and 2 are provided to let you generate\"\n           \" approximations to the following figures:\\n Figure 3-32,\"\n           \" Figure 3-33a and Figure 3-33b in Chapter 3 of the VTK Textbook.\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n  if (argc == 3)\n  {\n    figure = std::abs(atoi(argv[2]));\n    figure = (figure > 2) ? 0 : figure;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg1{{60, 93, 144, 255}};\n  colors->SetColor(\"BkgColor1\", bkg1.data());\n  std::array<unsigned char, 4> bkg2{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor2\", bkg2.data());\n\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // The cow pipeline.\n  vtkNew<vtkBYUReader> cow;\n  cow->SetGeometryFileName(fileName.c_str());\n  cow->Update();\n\n  vtkNew<vtkPolyDataMapper> cowMapper;\n  cowMapper->SetInputConnection(cow->GetOutputPort());\n  cowMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> cowActor;\n  cowActor->SetMapper(cowMapper);\n  cowActor->GetProperty()->SetColor(colors->GetColor3d(\"Wheat\").GetData());\n\n  ren->AddActor(cowActor);\n\n  // Axes pipeline.\n  vtkNew<vtkAxes> cowAxesSource;\n  cowAxesSource->SetScaleFactor(10.0);\n  cowAxesSource->SetOrigin(0, 0, 0);\n\n  vtkNew<vtkPolyDataMapper> cowAxesMapper;\n  cowAxesMapper->SetInputConnection(cowAxesSource->GetOutputPort());\n\n  vtkNew<vtkActor> cowAxes;\n  cowAxes->SetMapper(cowAxesMapper);\n  cowAxes->VisibilityOff();\n\n  ren->AddActor(cowAxes);\n\n  ren->SetBackground(colors->GetColor3d(\"BkgColor1\").GetData());\n  renWin->SetSize(600, 480);\n  renWin->SetWindowName(\"WalkCow\");\n\n  iren->Initialize();\n  cowAxes->VisibilityOn();\n  renWin->Render();\n\n  // Activate this if you want to see the Position and Focal point.\n  // vtkNew<vtkCallbackCommand> modifiedCallback;\n  // modifiedCallback->SetCallback(CameraModifiedCallback);\n  // ren->GetActiveCamera()->AddObserver(vtkCommand::ModifiedEvent,\n  // modifiedCallback);\n\n  // These four rotations use the same camera position.\n  Rotate_X(cowActor, ren, renWin);\n  Rotate_Y(cowActor, ren, renWin);\n  Rotate_Z(cowActor, ren, renWin);\n  Rotate_XY(cowActor, ren, renWin);\n\n  ren->SetBackground(colors->GetColor3d(\"BkgColor2\").GetData());\n  switch (figure)\n  {\n  default:\n  case 0:\n    Rotate_V_0(cowActor, ren, renWin);\n    Rotate_V_V(cowActor, ren, renWin);\n    // Walk() needs to go after Rotate_V_0() or Rotate_V_V().\n    Walk(cowActor, ren, renWin);\n    break;\n  case 1:\n    Rotate_V_0(cowActor, ren, renWin);\n    break;\n  case 2:\n    Rotate_V_V(cowActor, ren, renWin);\n    break;\n  }\n\n  // Interact with data.\n  // Keep the last rendered image.\n  renWin->EraseOff();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid Rotate_X(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // Six rotations about the x axis.\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(2, 25, 0);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->GetActiveCamera()->SetViewUp(0, 0, -1);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateX(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-31a.png\", renWin);\n  renWin->EraseOn();\n}\n\nvoid Rotate_Y(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // Six rotations about the y axis.\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(2, 0, 25);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateY(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-31b.png\", renWin);\n  renWin->EraseOn();\n}\n\nvoid Rotate_Z(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // Six rotations about the z axis.\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(2, 0, 25);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateZ(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-31c.png\", renWin);\n  renWin->EraseOn();\n}\n\nvoid Rotate_XY(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // First a rotation about the x axis, then six rotations about the y axis.\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(2, 0, 25);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  cowActor->RotateX(60);\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateY(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  cowActor->RotateX(-60);\n  Screenshot(\"Fig3-31d.png\", renWin);\n  renWin->EraseOn();\n}\n\nvoid Rotate_V_0(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // The cow rotating about a vector passing through her nose.\n  // With the origin at (0, 0, 0).\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  vtkNew<vtkTransform> cowPos;\n  cowPos->Identity();\n  cowPos->SetMatrix(cowActor->GetMatrix());\n  vtkNew<vtkTransform> cowTransform;\n  cowTransform->Identity();\n  cowActor->SetUserMatrix(cowTransform->GetMatrix());\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(16, 9, -12);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateWXYZ(60, 2.19574, -1.42455, -0.0331036);\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-33a.png\", renWin);\n  renWin->EraseOn();\n  // Put the cow back on the origin.\n  // for (int idx = 0; idx < 6; idx++)\n  //{\n  //  cowActor->RotateWXYZ(-60, 2.19574, -1.42455, -0.0331036);\n  //}\n  // cowActor->SetUserMatrix(cowPos->GetMatrix());\n  // ren->GetActiveCamera()->SetPosition(0, 0, 1);\n  // ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  // ren->ResetCamera();\n}\n\nvoid Rotate_V_V(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // The cow rotating about a vector passing through her nose.\n  // With the origin at (6.11414, 1.27386, 0.015175).\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  vtkNew<vtkTransform> cowPos;\n  cowPos->Identity();\n  cowPos->SetMatrix(cowActor->GetMatrix());\n  cowActor->SetOrigin(6.11414, 1.27386, 0.015175); // The cow's nose\n  vtkNew<vtkTransform> cowTransform;\n  cowTransform->Identity();\n  cowActor->SetUserMatrix(cowTransform->GetMatrix());\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(31, 23, -21);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateWXYZ(60, 2.19574, -1.42455, -0.0331036);\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-33b.png\", renWin);\n  renWin->EraseOn();\n  // Put the cow back on the origin.\n  // for (int idx = 0; idx < 6; idx++)\n  //{\n  //  cowActor->RotateWXYZ(-60, 2.19574, -1.42455, -0.0331036);\n  //}\n  // cowActor->SetUserMatrix(cowPos->GetMatrix());\n}\n\nvoid Walk(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // The cow \"walking\" around the global origin\n  vtkNew<vtkTransform> cowPos;\n  cowPos->Identity();\n  cowPos->SetMatrix(cowActor->GetMatrix());\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0.0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  vtkNew<vtkTransform> cowTransform;\n  cowTransform->Identity();\n  cowTransform->Translate(0, 0, 5);\n  cowActor->SetUserMatrix(cowTransform->GetMatrix());\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(1, 24, 16);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->GetActiveCamera()->SetViewUp(0, 0, -1);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowTransform->Identity();\n    cowTransform->RotateY(idx * 60);\n    cowTransform->Translate(0, 0, 5);\n    cowActor->SetUserMatrix(cowTransform->GetMatrix());\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-32.png\", renWin);\n  renWin->EraseOn();\n  // Walkies are over, put the cow back on the origin.\n  // cowActor->SetUserMatrix(cowPos->GetMatrix());\n}\n\n/*\nstatic void CameraModifiedCallback(vtkObject* caller,\n                                   long unsigned int vtkNotUsed(eventId),\n                                   void* vtkNotUsed(clientData),\n                                   void* vtkNotUsed(callData))\n{\n  std::cout << caller->GetClassName() << \" modified\" << std::endl;\n  vtkCamera* camera = static_cast<vtkCamera*>(caller);\n  // Print the interesting stuff.\n  std::cout << \"\\tPosition: \" << camera->GetPosition()[0] << \", \"\n            << camera->GetPosition()[1] << \", \" << camera->GetPosition()[2]\n            << std::endl;\n  std::cout << \"\\tFocal point: \" << camera->GetFocalPoint()[0] << \", \"\n            << camera->GetFocalPoint()[1] << \", \" << camera->GetFocalPoint()[2]\n            << std::endl;\n}\n*/\n\nvoid Screenshot(std::string fileName, vtkRenderWindow* renWin)\n{\n  vtkNew<vtkWindowToImageFilter> windowToImageFilter;\n  windowToImageFilter->SetInput(renWin);\n#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1\n  windowToImageFilter->SetScale(1); // image quality\n#else\n  windowToImageFilter->SetMagnification(1); // image quality\n#endif\n  // We are not recording the alpha (transparency) channel.\n  // windowToImageFilter->SetInputBufferTypeToRGBA();\n  windowToImageFilter->SetInputBufferTypeToRGB();\n  // Read from the front buffer.\n  windowToImageFilter->ReadFrontBufferOff();\n  windowToImageFilter->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(fileName.c_str());\n  writer->SetInputConnection(windowToImageFilter->GetOutputPort());\n  writer->Write();\n}\n} // namespace\n
"},{"location":"Cxx/Rendering/WalkCow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WalkCow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  IOGeometry\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WalkCow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WalkCow MACOSX_BUNDLE WalkCow.cxx )\n  target_link_libraries(WalkCow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WalkCow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/WalkCow/#download-and-build-walkcow","title":"Download and Build WalkCow","text":"

Click here to download WalkCow and its CMakeLists.txt file. Once the tarball WalkCow.tar has been downloaded and extracted,

cd WalkCow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WalkCow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/WalkCowA/","title":"WalkCowA","text":"

vtk-examples/Cxx/Rendering/WalkCowA

"},{"location":"Cxx/Rendering/WalkCowA/#description","title":"Description","text":"

This generates Fig. 3-33a: The cow rotating about a vector passing through her nose. (a) With origin (0,0,0).

Info

See Figure 3-33a in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/WalkCowA/#code","title":"Code","text":"

WalkCowA.cxx

// These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkBYUReader.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkVersionMacros.h>\n#include <vtkWindowToImageFilter.h>\n\n// The command line parameters are: cow.g 1\n#include \"WalkCow.cxx\"\n
"},{"location":"Cxx/Rendering/WalkCowA/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WalkCowA)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  IOGeometry\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WalkCowA: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WalkCowA MACOSX_BUNDLE WalkCowA.cxx )\n  target_link_libraries(WalkCowA PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WalkCowA\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/WalkCowA/#download-and-build-walkcowa","title":"Download and Build WalkCowA","text":"

Click here to download WalkCowA and its CMakeLists.txt file. Once the tarball WalkCowA.tar has been downloaded and extracted,

cd WalkCowA/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WalkCowA\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Rendering/WalkCowB/","title":"WalkCowB","text":"

vtk-examples/Cxx/Rendering/WalkCowB

"},{"location":"Cxx/Rendering/WalkCowB/#description","title":"Description","text":"

This generates Fig. 3-33b: The cow rotating about a vector passing through her nose.(b) With origin at (6.1,1.3,.02).

Info

See Figure 3-33b in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Rendering/WalkCowB/#code","title":"Code","text":"

WalkCowB.cxx

// These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkBYUReader.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkVersionMacros.h>\n#include <vtkWindowToImageFilter.h>\n\n// The command line parameters are: cow.g 2\n#include \"WalkCow.cxx\"\n
"},{"location":"Cxx/Rendering/WalkCowB/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WalkCowB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  IOGeometry\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WalkCowB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WalkCowB MACOSX_BUNDLE WalkCowB.cxx )\n  target_link_libraries(WalkCowB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WalkCowB\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Rendering/WalkCowB/#download-and-build-walkcowb","title":"Download and Build WalkCowB","text":"

Click here to download WalkCowB and its CMakeLists.txt file. Once the tarball WalkCowB.tar has been downloaded and extracted,

cd WalkCowB/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WalkCowB\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Shaders/BozoShader/","title":"BozoShader","text":"

vtk-examples/Cxx/Shaders/BozoShader

"},{"location":"Cxx/Shaders/BozoShader/#description","title":"Description","text":"

This example shows how to add user functions to a VTK shader. The example's fragment shader uses an implementation of Ken Perlin's noise function. Perlin received a Technical Achievement Academy Award for his work procedural texture.

The shader code contains a variable \"k\" that controls the frequency of the noisy colors. The default value will provide reasonable results for all polydata.

The file for the shader code is src/Testing/Data/Shaders/PerlinNoise.glsl.

usage

BozoShader PerlinNoise.glsl horse.ply

Cite

Perlin's original Siggraph Paper: Perlin, K. 1985. \"An Image Synthesizer.\" Computer Graphics 19(3).

Cite

This shader is inspired by Ken Perlin's Bozo shader.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Shaders/BozoShader/#code","title":"Code","text":"

BozoShader.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShaderProgram.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkTriangleMeshPointNormals.h>\n#include <vtkVersion.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\n// -----------------------------------------------------------------------\n// Update a uniform in the shader for each render. We do this with a\n// callback for the UpdateShaderEvent\nclass vtkShaderCallback : public vtkCommand\n{\npublic:\n  static vtkShaderCallback* New()\n  {\n    return new vtkShaderCallback;\n  }\n  vtkRenderer* Renderer;\n  float k;\n  void Execute(vtkObject*, unsigned long, void* calldata) override\n  {\n    vtkShaderProgram* program = reinterpret_cast<vtkShaderProgram*>(calldata);\n    if (program)\n    {\n      program->SetUniformf(\"k\", k);\n    }\n  }\n  void Print(std::ostream& os)\n  {\n    os << \"k: \" << k << std::endl;\n  }\n\n  vtkShaderCallback()\n  {\n    this->Renderer = nullptr;\n    this->k = 5;\n  }\n};\n} // namespace\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Shaders/PerlinNoise.glsl \"\n              << \"[polydataFile] \"\n              << \"[k(5)]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto polyData = ReadPolyData(argc > 2 ? argv[2] : \"\");\n\n  std::ifstream shaderFile(argv[1]);\n  std::ostringstream shaderCode;\n  shaderCode << shaderFile.rdbuf();\n\n  // Create a transform to rescale model\n  double center[3];\n  polyData->GetCenter(center);\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double maxBound =\n      std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n               bounds[5] - bounds[4]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Rescale polydata to [-1,1]\n  vtkNew<vtkTransform> userTransform;\n  userTransform->Translate(-center[0], -center[1], -center[2]);\n  userTransform->Scale(1.0 / maxBound, 1.0 / maxBound, 1.0 / maxBound);\n  vtkNew<vtkTransformPolyDataFilter> transform;\n  transform->SetTransform(userTransform);\n  transform->SetInputData(polyData);\n\n  vtkNew<vtkTriangleFilter> triangles;\n  triangles->SetInputConnection(transform->GetOutputPort());\n\n  vtkNew<vtkTriangleMeshPointNormals> norms;\n  norms->SetInputConnection(triangles->GetOutputPort());\n\n  mapper->SetInputConnection(norms->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetAmbientColor(0.2, 0.2, 0.2);\n  actor->GetProperty()->SetDiffuseColor(1.0, 1.0, 1.0);\n  actor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n  actor->GetProperty()->SetSpecular(0.5);\n  actor->GetProperty()->SetDiffuse(0.7);\n  actor->GetProperty()->SetAmbient(0.1);\n  actor->GetProperty()->SetSpecularPower(100.0);\n  actor->GetProperty()->SetOpacity(1.0);\n\n  // Modify the vertex shader to pass the position of the vertex\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n\n  // Add the code to generate noise\n  // These functions need to be defined outside of main. Use the System::Dec\n  // to declare and implement\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\"//VTK::System::Dec\",\n                                   false, // before the standard replacements\n                                   shaderCode.str(),\n                                   false // only do it once\n  );\n\n#else\n  mapper->AddShaderReplacement(vtkShader::Fragment, \"//VTK::System::Dec\",\n                               false, // before the standard replacements\n                               shaderCode.str(),\n                               false // only do it once\n  );\n#endif\n\n  // Define varying and uniforms for the fragment shader here\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform float k = 1.0;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform float k = 1.0;\\n\",\n      false // only do it once\n  );\n#endif\n\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"  vec3 noisyColor;\\n\"\n      \"  noisyColor.r = noise(k * 10.0 * myVertexMC);\\n\"\n      \"  noisyColor.g = noise(k * 11.0 * myVertexMC);\\n\"\n      \"  noisyColor.b = noise(k * 12.0 * myVertexMC);\\n\"\n      \"  /* map ranges of noise values into different colors */\\n\"\n      \"  int i;\\n\"\n      \"  float lowerValue = .3;\\n\"\n      \"  float upperValue = .6;\\n\"\n      \"  for ( i=0; i<3; i+=1)\\n\"\n      \"  {\\n\"\n      \"    noisyColor[i] = (noisyColor[i] + 1.0) / 2.0;\\n\"\n      \"    if (noisyColor[i] < lowerValue) \\n\"\n      \"    {\\n\"\n      \"      noisyColor[i] = lowerValue;\\n\"\n      \"    }\\n\"\n      \"    else\\n\"\n      \"    {\\n\"\n      \"      if (noisyColor[i] < upperValue)\\n\"\n      \"      {\\n\"\n      \"        noisyColor[i] = upperValue;\\n\"\n      \"      }\\n\"\n      \"      else\\n\"\n      \"      {\\n\"\n      \"        noisyColor[i] = 1.0;\\n\"\n      \"      }\\n\"\n      \"    }\\n\"\n      \"  }\\n\"\n      \"  fragOutput0.rgb = opacity * vec3(ambientColor + noisyColor * diffuse \"\n      \"+ specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"  vec3 noisyColor;\\n\"\n      \"  noisyColor.r = noise(k * 10.0 * myVertexMC);\\n\"\n      \"  noisyColor.g = noise(k * 11.0 * myVertexMC);\\n\"\n      \"  noisyColor.b = noise(k * 12.0 * myVertexMC);\\n\"\n      \"  /* map ranges of noise values into different colors */\\n\"\n      \"  int i;\\n\"\n      \"  float lowerValue = .3;\\n\"\n      \"  float upperValue = .6;\\n\"\n      \"  for ( i=0; i<3; i+=1)\\n\"\n      \"  {\\n\"\n      \"    noisyColor[i] = (noisyColor[i] + 1.0) / 2.0;\\n\"\n      \"    if (noisyColor[i] < lowerValue) \\n\"\n      \"    {\\n\"\n      \"      noisyColor[i] = lowerValue;\\n\"\n      \"    }\\n\"\n      \"    else\\n\"\n      \"    {\\n\"\n      \"      if (noisyColor[i] < upperValue)\\n\"\n      \"      {\\n\"\n      \"        noisyColor[i] = upperValue;\\n\"\n      \"      }\\n\"\n      \"      else\\n\"\n      \"      {\\n\"\n      \"        noisyColor[i] = 1.0;\\n\"\n      \"      }\\n\"\n      \"    }\\n\"\n      \"  }\\n\"\n      \"  fragOutput0.rgb = opacity * vec3(ambientColor + noisyColor * diffuse \"\n      \"+ specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#endif\n  vtkNew<vtkShaderCallback> myCallback;\n  myCallback->Renderer = renderer;\n  if (argc == 2 || argc == 3)\n  {\n    myCallback->k = 1;\n  }\n  else\n  {\n    myCallback->k = atof(argv[3]);\n  }\n  std::cout << \"Input: \" << (argc > 2 ? argv[2] : \"Generated Sphere\")\n            << std::endl;\n  myCallback->Print(std::cout);\n  mapper->AddObserver(vtkCommand::UpdateShaderEvent, myCallback);\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(-.3, 0, .08);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(.26, 0.0, .96);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.5);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"BozoShader\");\n  renderWindow->Render();\n  interactor->Start();\n\n  transform->GetOutput()->GetBounds(bounds);\n  std::cout << \"Range: \"\n            << \" x \" << bounds[1] - bounds[0] << \" y \" << bounds[3] - bounds[2]\n            << \" y \" << bounds[5] - bounds[4] << std::endl;\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Shaders/BozoShader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BozoShader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BozoShader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BozoShader MACOSX_BUNDLE BozoShader.cxx )\n  target_link_libraries(BozoShader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BozoShader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Shaders/BozoShader/#download-and-build-bozoshader","title":"Download and Build BozoShader","text":"

Click here to download BozoShader and its CMakeLists.txt file. Once the tarball BozoShader.tar has been downloaded and extracted,

cd BozoShader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BozoShader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Shaders/BozoShaderDemo/","title":"BozoShaderDemo","text":"

vtk-examples/Cxx/Shaders/BozoShaderDemo

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Shaders/BozoShaderDemo/#code","title":"Code","text":"

BozoShaderDemo.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShaderProgram.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkTriangleMeshPointNormals.h>\n#include <vtkVersion.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\n// -----------------------------------------------------------------------\n// Update a uniform in the shader for each render. We do this with a\n// callback for the UpdateShaderEvent\nclass vtkShaderCallback : public vtkCommand\n{\npublic:\n  static vtkShaderCallback* New()\n  {\n    return new vtkShaderCallback;\n  }\n  vtkRenderer* Renderer;\n  float k;\n  void Execute(vtkObject*, unsigned long, void* calldata) override\n  {\n    vtkShaderProgram* program = reinterpret_cast<vtkShaderProgram*>(calldata);\n    if (program)\n    {\n      program->SetUniformf(\"k\", k);\n    }\n  }\n  void Print(std::ostream& os)\n  {\n    os << \"k: \" << k << std::endl;\n  }\n\n  vtkShaderCallback()\n  {\n    this->Renderer = nullptr;\n    this->k = 5;\n  }\n};\n} // namespace\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" PerlnNoise.glsl \"\n              << \"[polydataFile] \"\n              << \"[k(5)]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(20);\n  //  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(0.3, 0.3, 0.3);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  for (int i = 2; i < argc; ++i)\n  {\n    std::cout << \"Reading file: \" << argv[i] << std::endl;\n    auto polyData = ReadPolyData(argv[i]);\n    std::ifstream shaderFile(argv[1]);\n    std::ostringstream shaderCode;\n    shaderCode << shaderFile.rdbuf();\n    shaderFile.close();\n\n    // Create a transform to rescale model\n    double center[3];\n    polyData->GetCenter(center);\n    double bounds[6];\n    polyData->GetBounds(bounds);\n    double maxBound =\n        std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n                 bounds[5] - bounds[4]);\n\n    // Create textActors\n    vtkNew<vtkTextMapper> textMapper;\n    textMapper->SetTextProperty(textProperty);\n    textMapper->SetInput(vtksys::SystemTools::GetFilenameName(argv[i]).c_str());\n\n    vtkNew<vtkActor2D> textActor;\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(20, 20);\n\n    vtkNew<vtkActor> actor;\n    vtkNew<vtkRenderer> renderer;\n    vtkNew<vtkOpenGLPolyDataMapper> mapper;\n    renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n    renderer->AddActor(actor);\n    renderer->AddActor(textActor);\n\n    // Rescale polydata to [-1,1]\n    vtkNew<vtkTransform> userTransform;\n    userTransform->Translate(-center[0], -center[1], -center[2]);\n    userTransform->Scale(1.0 / maxBound, 1.0 / maxBound, 1.0 / maxBound);\n    vtkNew<vtkTransformPolyDataFilter> transform;\n    transform->SetTransform(userTransform);\n    transform->SetInputData(polyData);\n\n    vtkNew<vtkTriangleFilter> triangles;\n    triangles->SetInputConnection(transform->GetOutputPort());\n\n    vtkNew<vtkTriangleMeshPointNormals> norms;\n    norms->SetInputConnection(triangles->GetOutputPort());\n\n    mapper->SetInputConnection(norms->GetOutputPort());\n    mapper->ScalarVisibilityOff();\n\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetAmbientColor(0.2, 0.2, 0.2);\n    actor->GetProperty()->SetDiffuseColor(1.0, 1.0, 1.0);\n    actor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n    actor->GetProperty()->SetSpecular(0.5);\n    actor->GetProperty()->SetDiffuse(0.7);\n    actor->GetProperty()->SetAmbient(0.1);\n    actor->GetProperty()->SetSpecularPower(100.0);\n    actor->GetProperty()->SetOpacity(1.0);\n\n    renderer->ResetCamera();\n    renderer->GetActiveCamera()->Zoom(1.2);\n\n    // Modify the vertex shader to pass the position of the vertex\n#if USE_SHADER_PROPERTIES\n    vtkShaderProperty* sp = actor->GetShaderProperty();\n    sp->AddVertexShaderReplacement(\n        \"//VTK::Normal::Dec\",  // replace the normal block\n        true,                  // before the standard replacements\n        \"//VTK::Normal::Dec\\n\" // we still want the default\n        \"  out vec4 myVertexMC;\\n\",\n        false // only do it once\n    );\n#else\n    mapper->AddShaderReplacement(\n        vtkShader::Vertex,\n        \"//VTK::Normal::Dec\",  // replace the normal block\n        true,                  // before the standard replacements\n        \"//VTK::Normal::Dec\\n\" // we still want the default\n        \"  out vec4 myVertexMC;\\n\",\n        false // only do it once\n    );\n#endif\n#if USE_SHADER_PROPERTIES\n    sp->AddVertexShaderReplacement(\n        \"//VTK::Normal::Impl\",  // replace the normal block\n        true,                   // before the standard replacements\n        \"//VTK::Normal::Impl\\n\" // we still want the default\n        \"  myVertexMC = vertexMC;\\n\",\n        false // only do it once\n    );\n\n#else\n    mapper->AddShaderReplacement(\n        vtkShader::Vertex,\n        \"//VTK::Normal::Impl\",  // replace the normal block\n        true,                   // before the standard replacements\n        \"//VTK::Normal::Impl\\n\" // we still want the default\n        \"  myVertexMC = vertexMC;\\n\",\n        false // only do it once\n    );\n\n#endif\n    // Add the code to generate noise\n    // These functions need to be defined outside of main. Use the System::Dec\n    // to declare and implement\n#if USE_SHADER_PROPERTIES\n    sp->AddFragmentShaderReplacement(\"//VTK::System::Dec\",\n                                     false, // before the standard replacements\n                                     shaderCode.str(),\n                                     false // only do it once\n    );\n#else\n    mapper->AddShaderReplacement(vtkShader::Fragment, \"//VTK::System::Dec\",\n                                 false, // before the standard replacements\n                                 shaderCode.str(),\n                                 false // only do it once\n    );\n#endif\n\n    // Define varying and uniforms for the fragment shader here\n#if USE_SHADER_PROPERTIES\n    sp->AddFragmentShaderReplacement(\n        \"//VTK::Normal::Dec\",  // replace the normal block\n        true,                  // before the standard replacements\n        \"//VTK::Normal::Dec\\n\" // we still want the default\n        \"  varying vec4 myVertexMC;\\n\"\n        \"  uniform float k = 1.0;\\n\",\n        false // only do it once\n    );\n#else\n    mapper->AddShaderReplacement(\n        vtkShader::Fragment,   // in the fragment shader\n        \"//VTK::Normal::Dec\",  // replace the normal block\n        true,                  // before the standard replacements\n        \"//VTK::Normal::Dec\\n\" // we still want the default\n        \"  varying vec4 myVertexMC;\\n\"\n        \"  uniform float k = 1.0;\\n\",\n        false // only do it once\n    );\n#endif\n\n#if USE_SHADER_PROPERTIES\n    sp->AddFragmentShaderReplacement(\n        \"//VTK::Light::Impl\",  // replace the light block\n        false,                 // after the standard replacements\n        \"//VTK::Light::Impl\\n\" // we still want the default calc\n        \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n        \"  vec3 noisyColor;\\n\"\n        \"  noisyColor.r = noise(k * 10.0 * myVertexMC);\\n\"\n        \"  noisyColor.g = noise(k * 11.0 * myVertexMC);\\n\"\n        \"  noisyColor.b = noise(k * 12.0 * myVertexMC);\\n\"\n        \"  /* map ranges of noise values into different colors */\\n\"\n        \"  int i;\\n\"\n        \"  float lowerValue = .3;\\n\"\n        \"  float upperValue = .6;\\n\"\n        \"  for ( i=0; i<3; i+=1)\\n\"\n        \"  {\\n\"\n        \"    noisyColor[i] = (noisyColor[i] + 1.0) / 2.0;\\n\"\n        \"    if (noisyColor[i] < lowerValue) \\n\"\n        \"    {\\n\"\n        \"      noisyColor[i] = lowerValue;\\n\"\n        \"    }\\n\"\n        \"    else\\n\"\n        \"    {\\n\"\n        \"      if (noisyColor[i] < upperValue)\\n\"\n        \"      {\\n\"\n        \"        noisyColor[i] = upperValue;\\n\"\n        \"      }\\n\"\n        \"      else\\n\"\n        \"      {\\n\"\n        \"        noisyColor[i] = 1.0;\\n\"\n        \"      }\\n\"\n        \"    }\\n\"\n        \"  }\\n\"\n        \"  fragOutput0.rgb = opacity * vec3(ambientColor + noisyColor * \"\n        \"diffuse + specular);\\n\"\n        \"  fragOutput0.a = opacity;\\n\",\n        false // only do it once\n    );\n#else\n    mapper->AddShaderReplacement(\n        vtkShader::Fragment,   // in the fragment shader\n        \"//VTK::Light::Impl\",  // replace the light block\n        false,                 // after the standard replacements\n        \"//VTK::Light::Impl\\n\" // we still want the default calc\n        \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n        \"  vec3 noisyColor;\\n\"\n        \"  noisyColor.r = noise(k * 10.0 * myVertexMC);\\n\"\n        \"  noisyColor.g = noise(k * 11.0 * myVertexMC);\\n\"\n        \"  noisyColor.b = noise(k * 12.0 * myVertexMC);\\n\"\n        \"  /* map ranges of noise values into different colors */\\n\"\n        \"  int i;\\n\"\n        \"  float lowerValue = .3;\\n\"\n        \"  float upperValue = .6;\\n\"\n        \"  for ( i=0; i<3; i+=1)\\n\"\n        \"  {\\n\"\n        \"    noisyColor[i] = (noisyColor[i] + 1.0) / 2.0;\\n\"\n        \"    if (noisyColor[i] < lowerValue) \\n\"\n        \"    {\\n\"\n        \"      noisyColor[i] = lowerValue;\\n\"\n        \"    }\\n\"\n        \"    else\\n\"\n        \"    {\\n\"\n        \"      if (noisyColor[i] < upperValue)\\n\"\n        \"      {\\n\"\n        \"        noisyColor[i] = upperValue;\\n\"\n        \"      }\\n\"\n        \"      else\\n\"\n        \"      {\\n\"\n        \"        noisyColor[i] = 1.0;\\n\"\n        \"      }\\n\"\n        \"    }\\n\"\n        \"  }\\n\"\n        \"  fragOutput0.rgb = opacity * vec3(ambientColor + noisyColor * \"\n        \"diffuse + specular);\\n\"\n        \"  fragOutput0.a = opacity;\\n\",\n        false // only do it once\n    );\n#endif\n    vtkNew<vtkShaderCallback> myCallback;\n    myCallback->Renderer = renderer;\n    myCallback->k = 1;\n    mapper->AddObserver(vtkCommand::UpdateShaderEvent, myCallback);\n  }\n\n  // Setup viewports for the renderers\n  int rendererSize = 250;\n  unsigned int xGridDimensions = 3;\n  unsigned int yGridDimensions = 3;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"BozoShaderDemo\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Shaders/BozoShaderDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BozoShaderDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BozoShaderDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BozoShaderDemo MACOSX_BUNDLE BozoShaderDemo.cxx )\n  target_link_libraries(BozoShaderDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BozoShaderDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Shaders/BozoShaderDemo/#download-and-build-bozoshaderdemo","title":"Download and Build BozoShaderDemo","text":"

Click here to download BozoShaderDemo and its CMakeLists.txt file. Once the tarball BozoShaderDemo.tar has been downloaded and extracted,

cd BozoShaderDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BozoShaderDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Shaders/ColorByNormal/","title":"ColorByNormal","text":"

vtk-examples/Cxx/Shaders/ColorByNormal

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Shaders/ColorByNormal/#description","title":"Description","text":"

This example modifies the shader to color based on model normal To do this we have to modify the vertex shader to pass the normal in model coordinates through to the fragment shader. By default the normal is converted to View coordinates and then passed on. We keep that, but add a varying for the original normal. Then we modify the fragment shader to set the diffuse color based on that normal.

Cite

This example was inspired by the test TestUserShader.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Shaders/ColorByNormal/#code","title":"Code","text":"

ColorByNormal.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangleMeshPointNormals.h>\n#include <vtkVersion.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <sstream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkTriangleMeshPointNormals> norms;\n  norms->SetInputData(polyData);\n\n  mapper->SetInputConnection(norms->GetOutputPort());\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetAmbientColor(0.2, 0.2, 1.0);\n  actor->GetProperty()->SetDiffuseColor(1.0, 0.65, 0.7);\n  actor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n  actor->GetProperty()->SetSpecular(0.5);\n  actor->GetProperty()->SetDiffuse(0.7);\n  actor->GetProperty()->SetAmbient(0.5);\n  actor->GetProperty()->SetSpecularPower(20.0);\n  actor->GetProperty()->SetOpacity(1.0);\n\n  // Modify the shader to color based on model normal\n  // To do this we have to modify the vertex shader\n  // to pass the normal in model coordinates\n  // through to the fragment shader. By default the normal\n  // is converted to View coordinates and then passed on.\n  // We keep that, but add a varying for the original normal.\n  // Then we modify the fragment shader to set the diffuse color\n  // based on that normal. First lets modify the vertex\n  // shader\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec3 myNormalMCVSOutput;\\n\", // but we add this\n      false                                   // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec3 myNormalMCVSOutput;\\n\", // but we add this\n      false                                   // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Impl\",                // replace the normal block\n      true,                                 // before the standard replacements\n      \"//VTK::Normal::Impl\\n\"               // we still want the default\n      \"  myNormalMCVSOutput = normalMC;\\n\", // but we add this\n      false                                 // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Impl\",                // replace the normal block\n      true,                                 // before the standard replacements\n      \"//VTK::Normal::Impl\\n\"               // we still want the default\n      \"  myNormalMCVSOutput = normalMC;\\n\", // but we add this\n      false                                 // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Color::Impl\", // dummy replacement for testing clear method\n      true, \"VTK::Color::Impl\\n\", false);\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Color::Impl\", // dummy replacement for testing clear method\n      true, \"VTK::Color::Impl\\n\", false);\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->ClearVertexShaderReplacement(\"//VTK::Color::Impl\", true);\n#else\n  mapper->ClearShaderReplacement(\n      vtkShader::Vertex, // clear our dummy replacement\n      \"//VTK::Color::Impl\", true);\n#endif\n\n  // now modify the fragment shader\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec3 myNormalMCVSOutput;\\n\", // but we add this\n      false                                   // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec3 myNormalMCVSOutput;\\n\", // but we add this\n      false                                   // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default calc\n      \"  diffuseColor = abs(myNormalMCVSOutput);\\n\", // but we add this\n      false                                          // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,    // in the fragment shader\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default calc\n      \"  diffuseColor = abs(myNormalMCVSOutput);\\n\", // but we add this\n      false                                          // only do it once\n  );\n#endif\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(1.0, 1.0, -1.0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->GetActiveCamera()->Elevation(30.0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.3);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ColorByNormal\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Shaders/ColorByNormal/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorByNormal)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorByNormal: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorByNormal MACOSX_BUNDLE ColorByNormal.cxx )\n  target_link_libraries(ColorByNormal PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorByNormal\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Shaders/ColorByNormal/#download-and-build-colorbynormal","title":"Download and Build ColorByNormal","text":"

Click here to download ColorByNormal and its CMakeLists.txt file. Once the tarball ColorByNormal.tar has been downloaded and extracted,

cd ColorByNormal/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorByNormal\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Shaders/CubeMap/","title":"CubeMap","text":"

vtk-examples/Cxx/Shaders/CubeMap

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Shaders/CubeMap/#code","title":"Code","text":"

CubeMap.cxx

// Inspired by the VTK test Rendering/OpenGL2/Testing/Cxx/TesCubeMap.cxx\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageFlip.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTexture.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <iostream>\n#include <string>\n\nnamespace {\n/**\n * Read the cube map.\n *\n * @param folderPath: The folder where the cube maps are stored.\n * @param fileRoot: The root of the individual cube map file names.\n * @param ext: The extension of the cube map files.\n * @param key: The key to data used to build the full file name.\n *\n * @return The cubemap texture.\n */\nvtkSmartPointer<vtkTexture> ReadCubeMap(std::string const& folderPath,\n                                        std::string const& fileRoot,\n                                        std::string const& ext, int const& key);\n\n} // namespace\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" horse.ply path_to_cubemap_files\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  vtkNew<vtkPLYReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataNormals> norms;\n  norms->SetInputConnection(reader->GetOutputPort());\n\n  auto texture = ReadCubeMap(argv[2], \"/skybox\", \".jpg\", 2);\n\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  mapper->SetInputConnection(norms->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  renderer->AddActor(actor);\n  actor->SetTexture(texture);\n  actor->SetMapper(mapper);\n\n  // Add new code in default VTK vertex shader\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n#endif\n      \"//VTK::PositionVC::Dec\",  // replace the normal block\n      true,                      // before the standard replacements\n      \"//VTK::PositionVC::Dec\\n\" // we still want the default\n      \"out vec3 TexCoords;\\n\",\n      false // only do it once\n  );\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n#endif\n      \"//VTK::PositionVC::Impl\",  // replace the normal block\n      true,                       // before the standard replacements\n      \"//VTK::PositionVC::Impl\\n\" // we still want the default\n      \"vec3 camPos = -MCVCMatrix[3].xyz * mat3(MCVCMatrix);\\n\"\n      \"TexCoords.xyz = reflect(vertexMC.xyz - camPos, normalize(normalMC));\\n\",\n      false // only do it once\n  );\n\n  // Replace VTK fragment shader\n#if USE_SHADER_PROPERTIES\n  sp->SetFragmentShaderCode(\n#else\n  mapper->SetFragmentShaderCode(\n#endif\n      \"//VTK::System::Dec\\n\" // always start with this line\n      \"//VTK::Output::Dec\\n\" // always have this line in your FS\n      \"in vec3 TexCoords;\\n\"\n      \"uniform samplerCube texture_0;\\n\"\n      \"void main () {\\n\"\n      \"  gl_FragData[0] = texture(texture_0, TexCoords);\\n\"\n      \"}\\n\");\n\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetPosition(-.4, .2, .15);\n  renderer->GetActiveCamera()->SetViewUp(.3, -.1, .9);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.4);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"CubeMap\");\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindow->GetInteractor()->SetInteractorStyle(style);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkTexture> ReadCubeMap(std::string const& folderPath,\n                                        std::string const& fileRoot,\n                                        std::string const& ext, int const& key)\n{\n  // A map of cube map naming conventions and the corresponding file name\n  // components.\n  std::map<int, std::vector<std::string>> fileNames{\n      {0, {\"right\", \"left\", \"top\", \"bottom\", \"front\", \"back\"}},\n      {1, {\"posx\", \"negx\", \"posy\", \"negy\", \"posz\", \"negz\"}},\n      {2, {\"-px\", \"-nx\", \"-py\", \"-ny\", \"-pz\", \"-nz\"}},\n      {3, {\"0\", \"1\", \"2\", \"3\", \"4\", \"5\"}}};\n  std::vector<std::string> fns;\n  if (fileNames.count(key))\n  {\n    fns = fileNames.at(key);\n  }\n  else\n  {\n    std::cerr << \"ReadCubeMap(): invalid key, unable to continue.\" << std::endl;\n    std::exit(EXIT_FAILURE);\n  }\n  vtkNew<vtkTexture> texture;\n  texture->CubeMapOn();\n  // Build the file names.\n  std::for_each(fns.begin(), fns.end(),\n                [&folderPath, &fileRoot, &ext](std::string& f) {\n                  f = folderPath + fileRoot + f + ext;\n                });\n  auto i = 0;\n  for (auto const& fn : fns)\n  {\n    vtkNew<vtkJPEGReader> imgReader;\n    imgReader->SetFileName(fn.c_str());\n\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    texture->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n  return texture;\n}\n\n} // namespace\n
"},{"location":"Cxx/Shaders/CubeMap/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CubeMap)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOImage\n  IOPLY\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CubeMap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CubeMap MACOSX_BUNDLE CubeMap.cxx )\n  target_link_libraries(CubeMap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CubeMap\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Shaders/CubeMap/#download-and-build-cubemap","title":"Download and Build CubeMap","text":"

Click here to download CubeMap and its CMakeLists.txt file. Once the tarball CubeMap.tar has been downloaded and extracted,

cd CubeMap/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CubeMap\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Shaders/MarbleShader/","title":"MarbleShader","text":"

vtk-examples/Cxx/Shaders/MarbleShader

"},{"location":"Cxx/Shaders/MarbleShader/#description","title":"Description","text":"

This example shows how to add user functions to a VTK shader. The example's fragment shader uses an implementation of Ken Perlin's noise function. Perlin received a Technical Achievement Academy Award for his work procedural texture.

The file for the shader code is src/Testing/Data/Shaders/PerlinNoise.glsl.

"},{"location":"Cxx/Shaders/MarbleShader/#parameters","title":"Parameters","text":"
  • veinfreq - controls the lowest frequency of the color veins e.g. 10
  • veinlevels - how many \"levels\" of vein tendrils it has e.g. 2
  • warpfreq - lowest frequency of the turbulent warping in the marble e.g. 10
  • _ warping_ - controls how much turbulent warping there will be e.g. 0.5
  • veincolor - the color of the veins e.g. white: 1 1 1
  • sharpness - controls how sharp or fuzzy the veins are (higher = sharper) e.g. 8

Cite

Perlin's original Siggraph Paper: Perlin, K. 1985. \"An Image Synthesizer.\" Computer Graphics 19(3).

Cite

This shader is inspired by Larry Gritz's veined marble shader.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Shaders/MarbleShader/#code","title":"Code","text":"

MarbleShader.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShaderProgram.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkTriangleMeshPointNormals.h>\n#include <vtkVersion.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\n// -----------------------------------------------------------------------\n// Update uniform variables in the shader for each render. We do this with a\n// callback for the UpdateShaderEvent\nclass ShaderCallback : public vtkCommand\n{\npublic:\n  static ShaderCallback* New()\n  {\n    return new ShaderCallback;\n  }\n  vtkRenderer* Renderer;\n  float veincolor[3];\n  float veinfreq;\n  int veinlevels;\n  float warpfreq;\n  float warping;\n  float sharpness;\n\n  void Execute(vtkObject*, unsigned long, void* calldata) override\n  {\n    vtkShaderProgram* program = reinterpret_cast<vtkShaderProgram*>(calldata);\n    if (program)\n    {\n      program->SetUniform3f(\"veincolor\", veincolor);\n      program->SetUniformf(\"veinfreq\", veinfreq);\n      program->SetUniformi(\"veinlevels\", veinlevels);\n      program->SetUniformf(\"warpfreq\", warpfreq);\n      program->SetUniformf(\"warping\", warping);\n      program->SetUniformf(\"sharpness\", sharpness);\n    }\n  }\n  void Print(std::ostream& os)\n  {\n    os << \"veincolor: \" << veincolor[0] << \", \" << veincolor[1] << \", \"\n       << veincolor[2] << std::endl;\n    os << \"veinfreq: \" << veinfreq << std::endl;\n    os << \"veinlevels: \" << veinlevels << std::endl;\n    os << \"warpfreq: \" << warpfreq << std::endl;\n    os << \"warping: \" << warping << std::endl;\n    os << \"sharpness: \" << sharpness << std::endl;\n  }\n\n  ShaderCallback()\n  {\n    this->Renderer = nullptr;\n    this->veincolor[0] = this->veincolor[1] = this->veincolor[2] = 1.0;\n    this->veinfreq = 10.0;\n    this->veinlevels = 2;\n    this->warpfreq = 1.0;\n    this->warping = .5;\n    this->sharpness = 8.0;\n  }\n};\n} // namespace\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" PerlnNoise.glsl \"\n              << \"[polydataFile] \"\n              << \"[veincolor(1,1,1)] \"\n              << \"[veinfreq(10)] \"\n              << \"[veinlevels(2)] \"\n              << \"[warpfreq(1)] \"\n              << \"[warping(.5)] \"\n              << \"[sharpness(8)]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto polyData = ReadPolyData(2 ? argv[2] : \"\");\n\n  std::ifstream shaderFile(argv[1]);\n  std::ostringstream shaderCode;\n  shaderCode << shaderFile.rdbuf();\n\n  // Create a transform to rescale model\n  double center[3];\n  polyData->GetCenter(center);\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double maxBound =\n      std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n               bounds[5] - bounds[4]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Rescale polydata to [-1,1]\n  vtkNew<vtkTransform> userTransform;\n  userTransform->Translate(-center[0], -center[1], -center[2]);\n  userTransform->Scale(1.0 / maxBound, 1.0 / maxBound, 1.0 / maxBound);\n  vtkNew<vtkTransformPolyDataFilter> transform;\n  transform->SetTransform(userTransform);\n  transform->SetInputData(polyData);\n\n  vtkNew<vtkTriangleFilter> triangles;\n  triangles->SetInputConnection(transform->GetOutputPort());\n\n  vtkNew<vtkTriangleMeshPointNormals> norms;\n  norms->SetInputConnection(triangles->GetOutputPort());\n\n  mapper->SetInputConnection(norms->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuse(1.0);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"ivoryblack\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(5);\n\n  // Modify the vertex shader to pass the position of the vertex\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n\n#endif\n\n  // Add the code to generate noise\n  // These functions need to be defined outside of main. Use the System::Dec\n  // to declare and implement\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\"//VTK::System::Dec\",\n                                   false, // before the standard replacements\n                                   shaderCode.str(),\n                                   false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(vtkShader::Fragment, \"//VTK::System::Dec\",\n                               false, // before the standard replacements\n                               shaderCode.str(),\n                               false // only do it once\n  );\n#endif\n// Define varying and uniforms for the fragment shader here\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform vec3 veincolor = vec3(1.0, 1.0, 1.0);\\n\"\n      \"  uniform float veinfreq = 10.0;\\n\"\n      \"  uniform int veinlevels = 2;\\n\"\n      \"  uniform float warpfreq = 1;\\n\"\n      \"  uniform float warping = .5;\\n\"\n      \"  uniform float sharpness = 8.0;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform vec3 veincolor = vec3(1.0, 1.0, 1.0);\\n\"\n      \"  uniform float veinfreq = 10.0;\\n\"\n      \"  uniform int veinlevels = 2;\\n\"\n      \"  uniform float warpfreq = 1;\\n\"\n      \"  uniform float warping = .5;\\n\"\n      \"  uniform float sharpness = 8.0;\\n\",\n      false // only do it once\n  );\n#endif\n\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"\\n\"\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"#define snoise(x) (2.0 * pnoise(x) - 1.0)\\n\"\n      \"  vec3 Ct;\\n\"\n      \"  int i;\\n\"\n      \"  float turb, freq;\\n\"\n      \"  float turbsum;\\n\"\n      \"  /* perturb the lookup */\\n\"\n      \"  freq = 1.0;\\n\"\n      \"  vec4 offset = vec4(0.0,0.0,0.0,0.0);\\n\"\n      \"  vec4 noisyPoint;\\n\"\n      \"  vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"\\n\"\n      \"    for (i = 0;  i < 6;  i += 1) {\\n\"\n      \"      noisyPoint[0] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[1] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[2] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[3] = 1.0;\\n\"\n      \"      offset += 2.0 * warping * (noisyPoint - 0.5)  / freq;\\n\"\n      \"      freq *= 2.0;\\n\"\n      \"    }\\n\"\n      \"    myLocalVertexMC.x += offset.x;\\n\"\n      \"    myLocalVertexMC.y += offset.y;\\n\"\n      \"    myLocalVertexMC.z += offset.z;\\n\"\n      \"\\n\"\n      \"    /* Now calculate the veining function for the lookup area */\\n\"\n      \"    turbsum = 0.0;  freq = 1.0;\\n\"\n      \"    myLocalVertexMC *= veinfreq;\\n\"\n      \"    for (i = 0;  i < veinlevels;  i += 1) {\\n\"\n      \"      turb = abs (snoise (myLocalVertexMC));\\n\"\n      \"      turb = pow (smoothstep (0.8, 1.0, 1.0 - turb), sharpness) / \"\n      \"freq;\\n\"\n      \"      turbsum += (1.0-turbsum) * turb;\\n\"\n      \"      freq *= 1.5;\\n\"\n      \"      myLocalVertexMC *= 1.5;\\n\"\n      \"    }\\n\"\n      \"\\n\"\n      \"    Ct = mix (diffuseColor, veincolor, turbsum);\\n\"\n      \"\\n\"\n      \"  fragOutput0.rgb = opacity * (ambientColor + Ct + specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"\\n\"\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"#define snoise(x) (2.0 * pnoise(x) - 1.0)\\n\"\n      \"  vec3 Ct;\\n\"\n      \"  int i;\\n\"\n      \"  float turb, freq;\\n\"\n      \"  float turbsum;\\n\"\n      \"  /* perturb the lookup */\\n\"\n      \"  freq = 1.0;\\n\"\n      \"  vec4 offset = vec4(0.0,0.0,0.0,0.0);\\n\"\n      \"  vec4 noisyPoint;\\n\"\n      \"  vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"\\n\"\n      \"    for (i = 0;  i < 6;  i += 1) {\\n\"\n      \"      noisyPoint[0] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[1] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[2] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[3] = 1.0;\\n\"\n      \"      offset += 2.0 * warping * (noisyPoint - 0.5)  / freq;\\n\"\n      \"      freq *= 2.0;\\n\"\n      \"    }\\n\"\n      \"    myLocalVertexMC.x += offset.x;\\n\"\n      \"    myLocalVertexMC.y += offset.y;\\n\"\n      \"    myLocalVertexMC.z += offset.z;\\n\"\n      \"\\n\"\n      \"    /* Now calculate the veining function for the lookup area */\\n\"\n      \"    turbsum = 0.0;  freq = 1.0;\\n\"\n      \"    myLocalVertexMC *= veinfreq;\\n\"\n      \"    for (i = 0;  i < veinlevels;  i += 1) {\\n\"\n      \"      turb = abs (snoise (myLocalVertexMC));\\n\"\n      \"      turb = pow (smoothstep (0.8, 1.0, 1.0 - turb), sharpness) / \"\n      \"freq;\\n\"\n      \"      turbsum += (1.0-turbsum) * turb;\\n\"\n      \"      freq *= 1.5;\\n\"\n      \"      myLocalVertexMC *= 1.5;\\n\"\n      \"    }\\n\"\n      \"\\n\"\n      \"    Ct = mix (diffuseColor, veincolor, turbsum);\\n\"\n      \"\\n\"\n      \"  fragOutput0.rgb = opacity * (ambientColor + Ct + specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#endif\n\n  vtkNew<ShaderCallback> myCallback;\n  myCallback->Renderer = renderer;\n  if (argc == 6)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n  }\n  if (argc == 7)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n    myCallback->veinfreq = atof(argv[6]);\n  }\n  if (argc == 8)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n    myCallback->veinfreq = atof(argv[6]);\n    myCallback->veinlevels = atoi(argv[7]);\n  }\n  if (argc == 9)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n    myCallback->veinfreq = atof(argv[6]);\n    myCallback->veinlevels = atoi(argv[7]);\n    myCallback->warpfreq = atof(argv[8]);\n  }\n  if (argc == 10)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n    myCallback->veinfreq = atof(argv[6]);\n    myCallback->veinlevels = atoi(argv[7]);\n    myCallback->warpfreq = atof(argv[8]);\n    myCallback->warping = atof(argv[9]);\n  }\n  if (argc == 11)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n    myCallback->veinfreq = atof(argv[6]);\n    myCallback->veinlevels = atoi(argv[7]);\n    myCallback->warpfreq = atof(argv[8]);\n    myCallback->warping = atof(argv[9]);\n    myCallback->sharpness = atof(argv[10]);\n  }\n  std::cout << \"Input: \" << (argc > 2 ? argv[2] : \"Generated Sphere\")\n            << std::endl;\n  myCallback->Print(std::cout);\n  mapper->AddObserver(vtkCommand::UpdateShaderEvent, myCallback);\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(-.3, 0, .08);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(.26, 0.0, .96);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.5);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"MarbleShader\");\n  renderWindow->Render();\n  interactor->Start();\n\n  transform->GetOutput()->GetBounds(bounds);\n  std::cout << \"Range: \"\n            << \" x \" << bounds[1] - bounds[0] << \" y \" << bounds[3] - bounds[2]\n            << \" y \" << bounds[5] - bounds[4] << std::endl;\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Shaders/MarbleShader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarbleShader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarbleShader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarbleShader MACOSX_BUNDLE MarbleShader.cxx )\n  target_link_libraries(MarbleShader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarbleShader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Shaders/MarbleShader/#download-and-build-marbleshader","title":"Download and Build MarbleShader","text":"

Click here to download MarbleShader and its CMakeLists.txt file. Once the tarball MarbleShader.tar has been downloaded and extracted,

cd MarbleShader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MarbleShader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Shaders/MarbleShaderDemo/","title":"MarbleShaderDemo","text":"

vtk-examples/Cxx/Shaders/MarbleShaderDemo

"},{"location":"Cxx/Shaders/MarbleShaderDemo/#description","title":"Description","text":"

Makes solid marble texture with strong veins. The \"veincolor\" parameter controls the color of the veins. The background color is given by the surface's DiffuseColor.

Explore the parameter space with the vtkSliderWidget.

"},{"location":"Cxx/Shaders/MarbleShaderDemo/#parameters","title":"Parameters","text":"
  • veinfreq - controls the lowest frequency of the color veins e.g. 10
  • veinlevels - how many \"levels\" of vein tendrils it has e.g. 2
  • warpfreq - lowest frequency of the turbulent warping in the marble e.g. 10
  • _ warping_ - controls how much turbulent warping there will be e.g. 0.5
  • veincolor - the color of the veins e.g. white: 1 1 1
  • sharpness - controls how sharp or fuzzy the veins are (higher = sharper) e.g. 8

Cite

This shader is inspired by Larry Gritz's veined marble shader.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Shaders/MarbleShaderDemo/#code","title":"Code","text":"

MarbleShaderDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkShaderProgram.h>\n#include <vtkSmartPointer.h>\n#include <vtkVersion.h>\n\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkTriangleMeshPointNormals.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <chrono>\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <thread>\n\n#define DELAY 200\nnamespace {\n// -----------------------------------------------------------------------\n// Update uniform variables in the shader for each render. We do this with a\n// callback for the UpdateShaderEvent\nclass ShaderCallback : public vtkCommand\n{\npublic:\n  static ShaderCallback* New()\n  {\n    return new ShaderCallback;\n  }\n  vtkRenderer* Renderer;\n  float veincolor[3];\n  float veinfreq;\n  float veinlevels;\n  float warpfreq;\n  float warping;\n  float sharpness;\n\n  void Execute(vtkObject*, unsigned long, void* calldata) override\n  {\n    vtkShaderProgram* program = reinterpret_cast<vtkShaderProgram*>(calldata);\n    if (program)\n    {\n      program->SetUniform3f(\"veincolor\", veincolor);\n      program->SetUniformf(\"veinfreq\", veinfreq);\n      program->SetUniformi(\"veinlevels\", veinlevels);\n      program->SetUniformf(\"warpfreq\", warpfreq);\n      program->SetUniformf(\"warping\", warping);\n      program->SetUniformf(\"sharpness\", sharpness);\n      std::cout << \"------------\" << std::endl;\n      Print(std::cout);\n    }\n  }\n  void Print(std::ostream& os)\n  {\n    os << \"veincolor: \" << veincolor[0] << \", \" << veincolor[1] << \", \"\n       << veincolor[2] << std::endl;\n    os << \"veinfreq: \" << veinfreq << std::endl;\n    os << \"veinlevels: \" << veinlevels << std::endl;\n    os << \"warpfreq: \" << warpfreq << std::endl;\n    os << \"warping: \" << warping << std::endl;\n    os << \"sharpness: \" << sharpness << std::endl;\n  }\n\n  ShaderCallback()\n  {\n    this->Renderer = nullptr;\n    this->veincolor[0] = this->veincolor[1] = this->veincolor[2] = 1.0;\n    this->veinfreq = 10.0;\n    this->veinlevels = 2;\n    this->warpfreq = 1.0;\n    this->warping = .5;\n    this->sharpness = 8.0;\n  }\n};\n\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackVeinFreq : public vtkCommand\n{\npublic:\n  static SliderCallbackVeinFreq* New()\n  {\n    return new SliderCallbackVeinFreq;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n\n    float value = static_cast<vtkSliderRepresentation2D*>(\n                      sliderWidget->GetRepresentation())\n                      ->GetValue();\n    this->Shader->veinfreq = value;\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackVeinFreq() : Shader(0)\n  {\n  }\n  ShaderCallback* Shader;\n};\n\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackVeinLevels : public vtkCommand\n{\npublic:\n  static SliderCallbackVeinLevels* New()\n  {\n    return new SliderCallbackVeinLevels;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n\n    int value = static_cast<vtkSliderRepresentation2D*>(\n                    sliderWidget->GetRepresentation())\n                    ->GetValue();\n    static_cast<vtkSliderRepresentation2D*>(sliderWidget->GetRepresentation())\n        ->SetValue(value);\n    this->Shader->veinlevels = value;\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackVeinLevels() : Shader(0)\n  {\n  }\n  ShaderCallback* Shader;\n};\n\nclass SliderCallbackWarpFreq : public vtkCommand\n{\npublic:\n  static SliderCallbackWarpFreq* New()\n  {\n    return new SliderCallbackWarpFreq;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n\n    float value = static_cast<vtkSliderRepresentation2D*>(\n                      sliderWidget->GetRepresentation())\n                      ->GetValue();\n    this->Shader->warpfreq = value;\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackWarpFreq() : Shader(0)\n  {\n  }\n  ShaderCallback* Shader;\n};\n\nclass SliderCallbackWarping : public vtkCommand\n{\npublic:\n  static SliderCallbackWarping* New()\n  {\n    return new SliderCallbackWarping;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n\n    float value = static_cast<vtkSliderRepresentation2D*>(\n                      sliderWidget->GetRepresentation())\n                      ->GetValue();\n    this->Shader->warping = value;\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackWarping() : Shader(0)\n  {\n  }\n  ShaderCallback* Shader;\n};\n\n} // namespace\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" PerlnNoise.glsl \"\n              << \"[polydataFile] \"\n              << \"[veincolor(1,1,1)] \"\n              << \"[veinfreq(10)] \"\n              << \"[veinlevels(2)] \"\n              << \"[warpfreq(1)] \"\n              << \"[warping(.5)] \"\n              << \"[sharpness(8)]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto polyData = ReadPolyData(argc > 2 ? argv[2] : \"\");\n\n  std::ifstream shaderFile(argv[1]);\n  std::ostringstream shaderCode;\n  shaderCode << shaderFile.rdbuf();\n\n  // Create a transform to rescale model\n  double center[3];\n  polyData->GetCenter(center);\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double maxBound =\n      std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n               bounds[5] - bounds[4]);\n\n  auto colors = vtkSmartPointer<vtkNamedColors>::New();\n\n  auto actor = vtkSmartPointer<vtkActor>::New();\n\n  auto renderer = vtkSmartPointer<vtkRenderer>::New();\n  auto mapper = vtkSmartPointer<vtkOpenGLPolyDataMapper>::New();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  auto style = vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();\n\n  auto interactor = vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  interactor->SetRenderWindow(renderWindow);\n  interactor->SetInteractorStyle(style);\n\n  // Rescale polydata to [-1,1]\n  auto userTransform = vtkSmartPointer<vtkTransform>::New();\n  userTransform->Translate(-center[0], -center[1], -center[2]);\n  userTransform->Scale(1.0 / maxBound, 1.0 / maxBound, 1.0 / maxBound);\n  auto transform = vtkSmartPointer<vtkTransformPolyDataFilter>::New();\n  transform->SetTransform(userTransform);\n  transform->SetInputData(polyData);\n\n  auto triangles = vtkSmartPointer<vtkTriangleFilter>::New();\n  triangles->SetInputConnection(transform->GetOutputPort());\n\n  auto norms = vtkSmartPointer<vtkTriangleMeshPointNormals>::New();\n  norms->SetInputConnection(triangles->GetOutputPort());\n\n  mapper->SetInputConnection(norms->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuse(1.0);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"wheat\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(50);\n\n  // Modify the vertex shader to pass the position of the vertex\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n\n  // Add the code to generate noise\n  // These functions need to be defined outside of main. Use the System::Dec\n  // to declare and implement\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\"//VTK::System::Dec\",\n                                   false, // before the standard replacements\n                                   shaderCode.str(),\n                                   false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(vtkShader::Fragment, // in the fragment shader\n                               \"//VTK::System::Dec\",\n                               false, // before the standard replacements\n                               shaderCode.str(),\n                               false // only do it once\n  );\n#endif\n// Define varying and uniforms for the fragment shader here\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform vec3 veincolor = vec3(1.0, 1.0, 1.0);\\n\"\n      \"  uniform float veinfreq = 10.0;\\n\"\n      \"  uniform int veinlevels = 2;\\n\"\n      \"  uniform float warpfreq = 1;\\n\"\n      \"  uniform float warping = .5;\\n\"\n      \"  uniform float sharpness = 8.0;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform vec3 veincolor = vec3(1.0, 1.0, 1.0);\\n\"\n      \"  uniform float veinfreq = 10.0;\\n\"\n      \"  uniform int veinlevels = 2;\\n\"\n      \"  uniform float warpfreq = 1;\\n\"\n      \"  uniform float warping = .5;\\n\"\n      \"  uniform float sharpness = 8.0;\\n\",\n      false // only do it once\n  );\n\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"\\n\"\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"#define snoise(x) (2.0 * pnoise(x) - 1.0)\\n\"\n      \"  vec3 Ct;\\n\"\n      \"  int i;\\n\"\n      \"  float turb, freq;\\n\"\n      \"  float turbsum;\\n\"\n      \"  /* perturb the lookup */\\n\"\n      \"  freq = 1.0;\\n\"\n      \"  vec4 offset = vec4(0.0,0.0,0.0,0.0);\\n\"\n      \"  vec4 noisyPoint;\\n\"\n      \"  vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"\\n\"\n      \"    for (i = 0;  i < 6;  i += 1) {\\n\"\n      \"      noisyPoint[0] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[1] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[2] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[3] = 1.0;\\n\"\n      \"      offset += 2.0 * warping * (noisyPoint - 0.5)  / freq;\\n\"\n      \"      freq *= 2.0;\\n\"\n      \"    }\\n\"\n      \"    myLocalVertexMC.x += offset.x;\\n\"\n      \"    myLocalVertexMC.y += offset.y;\\n\"\n      \"    myLocalVertexMC.z += offset.z;\\n\"\n      \"\\n\"\n      \"    /* Now calculate the veining function for the lookup area */\\n\"\n      \"    turbsum = 0.0;  freq = 1.0;\\n\"\n      \"    myLocalVertexMC *= veinfreq;\\n\"\n      \"    for (i = 0;  i < veinlevels;  i += 1) {\\n\"\n      \"      turb = abs (snoise (myLocalVertexMC));\\n\"\n      \"      turb = pow (smoothstep (0.8, 1.0, 1.0 - turb), sharpness) / \"\n      \"freq;\\n\"\n      \"      turbsum += (1.0-turbsum) * turb;\\n\"\n      \"      freq *= 1.5;\\n\"\n      \"      myLocalVertexMC *= 1.5;\\n\"\n      \"    }\\n\"\n      \"\\n\"\n      \"    Ct = mix (diffuseColor, veincolor, turbsum);\\n\"\n      \"\\n\"\n      \"  fragOutput0.rgb = opacity * (ambientColor + Ct + specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"\\n\"\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"#define snoise(x) (2.0 * pnoise(x) - 1.0)\\n\"\n      \"  vec3 Ct;\\n\"\n      \"  int i;\\n\"\n      \"  float turb, freq;\\n\"\n      \"  float turbsum;\\n\"\n      \"  /* perturb the lookup */\\n\"\n      \"  freq = 1.0;\\n\"\n      \"  vec4 offset = vec4(0.0,0.0,0.0,0.0);\\n\"\n      \"  vec4 noisyPoint;\\n\"\n      \"  vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"\\n\"\n      \"    for (i = 0;  i < 6;  i += 1) {\\n\"\n      \"      noisyPoint[0] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[1] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[2] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[3] = 1.0;\\n\"\n      \"      offset += 2.0 * warping * (noisyPoint - 0.5)  / freq;\\n\"\n      \"      freq *= 2.0;\\n\"\n      \"    }\\n\"\n      \"    myLocalVertexMC.x += offset.x;\\n\"\n      \"    myLocalVertexMC.y += offset.y;\\n\"\n      \"    myLocalVertexMC.z += offset.z;\\n\"\n      \"\\n\"\n      \"    /* Now calculate the veining function for the lookup area */\\n\"\n      \"    turbsum = 0.0;  freq = 1.0;\\n\"\n      \"    myLocalVertexMC *= veinfreq;\\n\"\n      \"    for (i = 0;  i < veinlevels;  i += 1) {\\n\"\n      \"      turb = abs (snoise (myLocalVertexMC));\\n\"\n      \"      turb = pow (smoothstep (0.8, 1.0, 1.0 - turb), sharpness) / \"\n      \"freq;\\n\"\n      \"      turbsum += (1.0-turbsum) * turb;\\n\"\n      \"      freq *= 1.5;\\n\"\n      \"      myLocalVertexMC *= 1.5;\\n\"\n      \"    }\\n\"\n      \"\\n\"\n      \"    Ct = mix (diffuseColor, veincolor, turbsum);\\n\"\n      \"\\n\"\n      \"  fragOutput0.rgb = opacity * (ambientColor + Ct + specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#endif\n\n  auto myCallback = vtkSmartPointer<ShaderCallback>::New();\n  myCallback->Renderer = renderer;\n\n  std::cout << \"Input: \" << (argc > 2 ? argv[2] : \"Generated Sphere\")\n            << std::endl;\n  myCallback->Print(std::cout);\n  mapper->AddObserver(vtkCommand::UpdateShaderEvent, myCallback);\n\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(.015);\n  double sliderLength(.008);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  auto sliderRepVeinFreq = vtkSmartPointer<vtkSliderRepresentation2D>::New();\n\n  sliderRepVeinFreq->SetMinimumValue(1.0);\n  sliderRepVeinFreq->SetMaximumValue(15.0);\n  sliderRepVeinFreq->SetValue(7.5);\n  sliderRepVeinFreq->SetTitleText(\"Vein Frequency\");\n\n  sliderRepVeinFreq->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepVeinFreq->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepVeinFreq->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepVeinFreq->GetPoint2Coordinate()->SetValue(.9, .1);\n\n  sliderRepVeinFreq->SetTubeWidth(tubeWidth);\n  sliderRepVeinFreq->SetSliderLength(sliderLength);\n  sliderRepVeinFreq->SetTitleHeight(titleHeight);\n  sliderRepVeinFreq->SetLabelHeight(labelHeight);\n\n  auto sliderWidgetVeinFreq = vtkSmartPointer<vtkSliderWidget>::New();\n  sliderWidgetVeinFreq->SetInteractor(interactor);\n  sliderWidgetVeinFreq->SetRepresentation(sliderRepVeinFreq);\n  sliderWidgetVeinFreq->SetAnimationModeToAnimate();\n  sliderWidgetVeinFreq->SetNumberOfAnimationSteps(10);\n  sliderWidgetVeinFreq->EnabledOn();\n\n  auto callbackVeinFreq = vtkSmartPointer<SliderCallbackVeinFreq>::New();\n  callbackVeinFreq->Shader = myCallback;\n\n  sliderWidgetVeinFreq->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackVeinFreq);\n\n  auto sliderRepVeinLevels = vtkSmartPointer<vtkSliderRepresentation2D>::New();\n\n  sliderRepVeinLevels->SetMinimumValue(1);\n  sliderRepVeinLevels->SetMaximumValue(5);\n  sliderRepVeinLevels->SetValue(3);\n  sliderRepVeinLevels->SetTitleText(\"Vein Levels\");\n\n  sliderRepVeinLevels->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepVeinLevels->GetPoint1Coordinate()->SetValue(.1, .9);\n  sliderRepVeinLevels->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepVeinLevels->GetPoint2Coordinate()->SetValue(.9, .9);\n\n  sliderRepVeinLevels->SetTubeWidth(tubeWidth);\n  sliderRepVeinLevels->SetSliderLength(sliderLength);\n  sliderRepVeinLevels->SetTitleHeight(titleHeight);\n  sliderRepVeinLevels->SetLabelHeight(labelHeight);\n\n  auto sliderWidgetVeinLevels = vtkSmartPointer<vtkSliderWidget>::New();\n  sliderWidgetVeinLevels->SetInteractor(interactor);\n  sliderWidgetVeinLevels->SetRepresentation(sliderRepVeinLevels);\n  sliderWidgetVeinLevels->SetAnimationModeToAnimate();\n  sliderWidgetVeinLevels->SetNumberOfAnimationSteps(10);\n  sliderWidgetVeinLevels->EnabledOn();\n\n  auto callbackVeinLevels = vtkSmartPointer<SliderCallbackVeinLevels>::New();\n  callbackVeinLevels->Shader = myCallback;\n  myCallback->veincolor[0] = colors->GetColor3d(\"Green\").GetData()[0];\n  myCallback->veincolor[1] = colors->GetColor3d(\"Green\").GetData()[1];\n  myCallback->veincolor[2] = colors->GetColor3d(\"Green\").GetData()[2];\n  sliderWidgetVeinLevels->AddObserver(vtkCommand::InteractionEvent,\n                                      callbackVeinLevels);\n\n  auto sliderRepWarpFreq = vtkSmartPointer<vtkSliderRepresentation2D>::New();\n\n  sliderRepWarpFreq->SetMinimumValue(1.0);\n  sliderRepWarpFreq->SetMaximumValue(2.0);\n  sliderRepWarpFreq->SetValue(1.5);\n  sliderRepWarpFreq->SetTitleText(\"Warp Frequency\");\n\n  sliderRepWarpFreq->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepWarpFreq->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepWarpFreq->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepWarpFreq->GetPoint2Coordinate()->SetValue(.1, .9);\n\n  sliderRepWarpFreq->SetTubeWidth(tubeWidth);\n  sliderRepWarpFreq->SetSliderLength(sliderLength);\n  sliderRepWarpFreq->SetTitleHeight(titleHeight);\n  sliderRepWarpFreq->SetLabelHeight(labelHeight);\n\n  auto sliderWidgetWarpFreq = vtkSmartPointer<vtkSliderWidget>::New();\n  sliderWidgetWarpFreq->SetInteractor(interactor);\n  sliderWidgetWarpFreq->SetRepresentation(sliderRepWarpFreq);\n  sliderWidgetWarpFreq->SetAnimationModeToAnimate();\n  sliderWidgetWarpFreq->SetNumberOfAnimationSteps(10);\n  sliderWidgetWarpFreq->EnabledOn();\n\n  auto callbackWarpFreq = vtkSmartPointer<SliderCallbackWarpFreq>::New();\n  callbackWarpFreq->Shader = myCallback;\n\n  sliderWidgetWarpFreq->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackWarpFreq);\n\n  auto sliderRepWarping = vtkSmartPointer<vtkSliderRepresentation2D>::New();\n\n  sliderRepWarping->SetMinimumValue(0.0);\n  sliderRepWarping->SetMaximumValue(1.0);\n  sliderRepWarping->SetValue(.5);\n  sliderRepWarping->SetTitleText(\"Warping\");\n\n  sliderRepWarping->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepWarping->GetPoint1Coordinate()->SetValue(.9, .1);\n  sliderRepWarping->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepWarping->GetPoint2Coordinate()->SetValue(.9, .9);\n\n  sliderRepWarping->SetTubeWidth(tubeWidth);\n  sliderRepWarping->SetSliderLength(sliderLength);\n  sliderRepWarping->SetTitleHeight(titleHeight);\n  sliderRepWarping->SetLabelHeight(labelHeight);\n\n  auto sliderWidgetWarping = vtkSmartPointer<vtkSliderWidget>::New();\n  sliderWidgetWarping->SetInteractor(interactor);\n  sliderWidgetWarping->SetRepresentation(sliderRepWarping);\n  sliderWidgetWarping->SetAnimationModeToAnimate();\n  sliderWidgetWarping->SetNumberOfAnimationSteps(10);\n  sliderWidgetWarping->EnabledOn();\n\n  auto callbackWarping = vtkSmartPointer<SliderCallbackWarping>::New();\n  callbackWarping->Shader = myCallback;\n\n  sliderWidgetWarping->AddObserver(vtkCommand::InteractionEvent,\n                                   callbackWarping);\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.5);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"MarbleShaderDemo\");\n  renderWindow->Render();\n  interactor->Start();\n\n  transform->GetOutput()->GetBounds(bounds);\n  std::cout << \"Range: \"\n            << \" x \" << bounds[1] - bounds[0] << \" y \" << bounds[3] - bounds[2]\n            << \" y \" << bounds[5] - bounds[4] << std::endl;\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Shaders/MarbleShaderDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarbleShaderDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarbleShaderDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarbleShaderDemo MACOSX_BUNDLE MarbleShaderDemo.cxx )\n  target_link_libraries(MarbleShaderDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarbleShaderDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Shaders/MarbleShaderDemo/#download-and-build-marbleshaderdemo","title":"Download and Build MarbleShaderDemo","text":"

Click here to download MarbleShaderDemo and its CMakeLists.txt file. Once the tarball MarbleShaderDemo.tar has been downloaded and extracted,

cd MarbleShaderDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MarbleShaderDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Shaders/SpatterShader/","title":"SpatterShader","text":"

vtk-examples/Cxx/Shaders/SpatterShader

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Shaders/SpatterShader/#code","title":"Code","text":"

SpatterShader.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShaderProgram.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\n// -----------------------------------------------------------------------\n// Update uniform variables in the shader for each render. We do this with a\n// callback for the UpdateShaderEvent\nclass ShaderCallback : public vtkCommand\n{\npublic:\n  static ShaderCallback* New()\n  {\n    return new ShaderCallback;\n  }\n  vtkRenderer* Renderer;\n  float specksize;\n  int sizes;\n  float basecolor[3];\n  float spattercolor[3];\n\n  void Execute(vtkObject*, unsigned long, void* calldata) override\n  {\n    vtkShaderProgram* program = reinterpret_cast<vtkShaderProgram*>(calldata);\n    if (program)\n    {\n      program->SetUniformf(\"specksize\", specksize);\n      program->SetUniformi(\"sizes\", sizes);\n      program->SetUniform3f(\"basecolor\", basecolor);\n      program->SetUniform3f(\"spattercolor\", spattercolor);\n    }\n  }\n\n  void Print(std::ostream& os)\n  {\n    os << \"specksize: \" << specksize << std::endl;\n    os << \"sizes: \" << sizes << std::endl;\n    os << \"basecolor: \" << basecolor[0] << \", \" << basecolor[1] << \", \"\n       << basecolor[2] << std::endl;\n    os << \"spattercolor: \" << spattercolor[0] << \", \" << spattercolor[1] << \", \"\n       << spattercolor[2] << std::endl;\n  }\n\n  ShaderCallback()\n  {\n    this->Renderer = nullptr;\n    // size of the smallest paint specks\n    this->specksize = .05;\n    // number of different sizes of paint specks (each doubles the previous\n    // size)\n    this->sizes = 3;\n    // the background color on which to spatter paint\n    this->basecolor[0] = this->basecolor[1] = this->basecolor[2] = .7;\n    //  the color of the paint spatters\n    this->spattercolor[0] = this->spattercolor[1] = this->spattercolor[2] = 0.0;\n  }\n};\n} // namespace\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" PerlnNoise.glsl \"\n              << \"[polydataFile] \"\n              << \"[specksize(.05)] \"\n              << \"[sizes(3)] \"\n              << \"[basecolor{.7,.7,.7)] \"\n              << \"[spattercolor(0.0,0.0,0.0)] \" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto polyData = ReadPolyData(argc > 2 ? argv[2] : \"\");\n\n  std::ifstream shaderFile(argv[1]);\n  std::ostringstream shaderCode;\n  shaderCode << shaderFile.rdbuf();\n\n  // Create a transform to rescale model\n  double center[3];\n  polyData->GetCenter(center);\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double maxBound =\n      std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n               bounds[5] - bounds[4]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Clean\n  vtkNew<vtkCleanPolyData> clean;\n  clean->SetInputData(polyData);\n\n  // Rescale polydata to [-1,1]\n  vtkNew<vtkTransform> userTransform;\n  userTransform->Translate(-center[0], -center[1], -center[2]);\n  userTransform->Scale(1.0 / maxBound, 1.0 / maxBound, 1.0 / maxBound);\n  vtkNew<vtkTransformPolyDataFilter> transform;\n  transform->SetTransform(userTransform);\n  transform->SetInputConnection(clean->GetOutputPort());\n\n  vtkNew<vtkTriangleFilter> triangles;\n  triangles->SetInputConnection(transform->GetOutputPort());\n\n  vtkNew<vtkPolyDataNormals> norms;\n  norms->SetInputConnection(triangles->GetOutputPort());\n\n  mapper->SetInputConnection(norms->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuse(1.0);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"ivoryblack\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(2);\n\n  // Modify the vertex shader to pass the position of the vertex\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n\n  // Add the code to generate noise\n  // These functions need to be defined outside of main. Use the System::Dec\n  // to declare and implement\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\"//VTK::System::Dec\",\n                                   false, // before the standard replacements\n                                   shaderCode.str(),\n                                   false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(vtkShader::Fragment, \"//VTK::System::Dec\",\n                               false, // before the standard replacements\n                               shaderCode.str(),\n                               false // only do it once\n  );\n#endif\n  // Define varying and uniforms for the fragment shader here\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"uniform float specksize = .05;\\n\"\n      \"uniform int sizes = 3;\\n\"\n      \"uniform vec3 basecolor = vec3(.7,.7,.7);\\n\"\n      \"uniform vec3 spattercolor = vec3(0.0, 0.0, 0.0);\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"uniform float specksize = .05;\\n\"\n      \"uniform int sizes = 3;\\n\"\n      \"uniform vec3 basecolor = vec3(.7,.7,.7);\\n\"\n      \"uniform vec3 spattercolor = vec3(0.0, 0.0, 0.0);\\n\",\n      false // only do it once\n  );\n#endif\n\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"\\n\"\n      \"float speckle, size, threshold = 0.7;\\n\"\n      \"vec3 paint;\\n\"\n      \"float scalefac;\\n\"\n      \"vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"scalefac = 1.0/specksize;\\n\"\n      \"paint = basecolor;\\n\"\n      \"for (size=1; size<=sizes; size +=1) {\\n\"\n      \"  speckle = pnoise(myLocalVertexMC * scalefac);\\n\"\n      \"  if (speckle > threshold) {\\n\"\n      \"    paint = spattercolor;\\n\"\n      \"    break;\\n\"\n      \"  }\\n\"\n      \"  scalefac /= 2.0;\\n\"\n      \"}\\n\"\n      \"/* get final color */\\n\"\n      \"fragOutput0.rgb = opacity * vec3(ambientColor + paint + specular);\\n\"\n      \"fragOutput0.a = opacity;\\n\",\n      false // only do once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"\\n\"\n      \"float speckle, size, threshold = 0.7;\\n\"\n      \"vec3 paint;\\n\"\n      \"float scalefac;\\n\"\n      \"vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"scalefac = 1.0/specksize;\\n\"\n      \"paint = basecolor;\\n\"\n      \"for (size=1; size<=sizes; size +=1) {\\n\"\n      \"  speckle = pnoise(myLocalVertexMC * scalefac);\\n\"\n      \"  if (speckle > threshold) {\\n\"\n      \"    paint = spattercolor;\\n\"\n      \"    break;\\n\"\n      \"  }\\n\"\n      \"  scalefac /= 2.0;\\n\"\n      \"}\\n\"\n      \"/* get final color */\\n\"\n      \"fragOutput0.rgb = opacity * vec3(ambientColor + paint + specular);\\n\"\n      \"fragOutput0.a = opacity;\\n\",\n      false // only do once\n  );\n#endif\n\n  vtkNew<ShaderCallback> myCallback;\n  myCallback->Renderer = renderer;\n  if (argc == 4)\n  {\n    myCallback->specksize = atof(argv[3]);\n  }\n  if (argc == 5)\n  {\n    myCallback->specksize = atof(argv[3]);\n    myCallback->sizes = atoi(argv[4]);\n  }\n  if (argc == 8)\n  {\n    myCallback->specksize = atof(argv[3]);\n    myCallback->sizes = atoi(argv[4]);\n    myCallback->basecolor[0] = atof(argv[5]);\n    myCallback->basecolor[1] = atof(argv[6]);\n    myCallback->basecolor[2] = atof(argv[7]);\n  }\n  if (argc == 11)\n  {\n    myCallback->specksize = atof(argv[3]);\n    myCallback->sizes = atoi(argv[4]);\n    myCallback->basecolor[0] = atof(argv[5]);\n    myCallback->basecolor[1] = atof(argv[6]);\n    myCallback->basecolor[2] = atof(argv[7]);\n    myCallback->spattercolor[0] = atof(argv[8]);\n    myCallback->spattercolor[1] = atof(argv[9]);\n    myCallback->spattercolor[2] = atof(argv[10]);\n  }\n  std::cout << \"Input: \" << (argc > 2 ? argv[2] : \"Generated Sphere\")\n            << std::endl;\n  myCallback->Print(std::cout);\n  mapper->AddObserver(vtkCommand::UpdateShaderEvent, myCallback);\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(-.3, 0, .08);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(.26, 0.0, .96);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.5);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"SpatterShader\");\n  renderWindow->Render();\n  interactor->Start();\n\n  transform->GetOutput()->GetBounds(bounds);\n  std::cout << \"Range: \"\n            << \" x \" << bounds[1] - bounds[0] << \" y \" << bounds[3] - bounds[2]\n            << \" y \" << bounds[5] - bounds[4] << std::endl;\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Shaders/SpatterShader/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SpatterShader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SpatterShader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SpatterShader MACOSX_BUNDLE SpatterShader.cxx )\n  target_link_libraries(SpatterShader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SpatterShader\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Shaders/SpatterShader/#download-and-build-spattershader","title":"Download and Build SpatterShader","text":"

Click here to download SpatterShader and its CMakeLists.txt file. Once the tarball SpatterShader.tar has been downloaded and extracted,

cd SpatterShader/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SpatterShader\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Shaders/SphereMap/","title":"SphereMap","text":"

vtk-examples/Cxx/Shaders/SphereMap

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Shaders/SphereMap/#code","title":"Code","text":"

SphereMap.cxx

/*=========================================================================\n\n  Program:   Visualization Toolkit\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkJPEGReader.h>\n#include <vtkLight.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSkybox.h>\n#include <vtkTexture.h>\n#include <vtkVersion.h>\n#include <vtkXMLPolyDataReader.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.vtp wintersun.jpg\" << std::endl;\n    return EXIT_SUCCESS;\n  }\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(0.0, 0.0, 0.0);\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkLight> light;\n  light->SetLightTypeToSceneLight();\n  light->SetPosition(1.0, 7.0, 1.0);\n  renderer->AddLight(light);\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataNormals> norms;\n  norms->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkTexture> texture;\n  texture->InterpolateOn();\n\n  // mipmapping works on many systems but is not\n  // core 3.2 for cube maps. VTK will silently\n  // ignore it if it is not supported. We commented it\n  // out here to make valid images easier\n  // texture->MipmapOn();\n\n  vtkNew<vtkJPEGReader> imgReader;\n  imgReader->SetFileName(argv[2]);\n  texture->SetInputConnection(imgReader->GetOutputPort());\n\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  mapper->SetInputConnection(norms->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetPosition(0, 0, 0);\n  actor->SetScale(6.0, 6.0, 6.0);\n  actor->GetProperty()->SetSpecular(0.8);\n  actor->GetProperty()->SetSpecularPower(20);\n  actor->GetProperty()->SetDiffuse(0.1);\n  actor->GetProperty()->SetAmbient(0.1);\n  actor->GetProperty()->SetDiffuseColor(1.0, 0.0, 0.4);\n  actor->GetProperty()->SetAmbientColor(0.4, 0.0, 1.0);\n  renderer->AddActor(actor);\n  actor->SetTexture(texture);\n  actor->SetMapper(mapper);\n\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::PositionVC::Dec\",  // replace\n      true,                      // before the standard replacements\n      \"//VTK::PositionVC::Dec\\n\" // we still want the default\n      \"out vec3 TexCoords;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::PositionVC::Dec\",  // replace\n      true,                      // before the standard replacements\n      \"//VTK::PositionVC::Dec\\n\" // we still want the default\n      \"out vec3 TexCoords;\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::PositionVC::Impl\",  // replace\n      true,                       // before the standard replacements\n      \"//VTK::PositionVC::Impl\\n\" // we still want the default\n      \"vec3 camPos = -MCVCMatrix[3].xyz * mat3(MCVCMatrix);\\n\"\n      \"TexCoords.xyz = reflect(vertexMC.xyz - camPos, normalize(normalMC));\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::PositionVC::Impl\",  // replace\n      true,                       // before the standard replacements\n      \"//VTK::PositionVC::Impl\\n\" // we still want the default\n      \"vec3 camPos = -MCVCMatrix[3].xyz * mat3(MCVCMatrix);\\n\"\n      \"TexCoords.xyz = reflect(vertexMC.xyz - camPos, normalize(normalMC));\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Dec\",  // replace\n      true,                 // before the standard replacements\n      \"//VTK::Light::Dec\\n\" // we still want the default\n      \"in vec3 TexCoords;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,\n      \"//VTK::Light::Dec\",  // replace\n      true,                 // before the standard replacements\n      \"//VTK::Light::Dec\\n\" // we still want the default\n      \"in vec3 TexCoords;\\n\",\n      false // only do it once\n  );\n#endif\n\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Impl\", // replace\n      true,                 // before the standard replacements\n      \"//VTK::Light::Impl\\n\"\n      \"  float phix = length(vec2(TexCoords.x, TexCoords.z));\\n\"\n      \"  vec3 skyColor = texture(actortexture, vec2(0.5*atan(TexCoords.z, \"\n      \"TexCoords.x)/3.1415927 + 0.5, atan(TexCoords.y,phix)/3.1415927 + \"\n      \"0.5)).xyz;\\n\"\n      \"  gl_FragData[0] = vec4(ambientColor + diffuse + specular + \"\n      \"specularColor*skyColor, opacity);\\n\", // we still want the default\n      false                                  // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,\n      \"//VTK::Light::Impl\", // replace\n      true,                 // before the standard replacements\n      \"//VTK::Light::Impl\\n\"\n      \"  float phix = length(vec2(TexCoords.x, TexCoords.z));\\n\"\n      \"  vec3 skyColor = texture(actortexture, vec2(0.5*atan(TexCoords.z, \"\n      \"TexCoords.x)/3.1415927 + 0.5, atan(TexCoords.y,phix)/3.1415927 + \"\n      \"0.5)).xyz;\\n\"\n      \"  gl_FragData[0] = vec4(ambientColor + diffuse + specular + \"\n      \"specularColor*skyColor, opacity);\\n\", // we still want the default\n      false                                  // only do it once\n  );\n#endif\n\n  vtkNew<vtkSkybox> world;\n  world->SetProjectionToSphere();\n  world->SetTexture(texture);\n  renderer->AddActor(world);\n\n  renderer->GetActiveCamera()->SetPosition(0.0, 0.55, 2.0);\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.55, 0.0);\n  renderer->GetActiveCamera()->SetViewAngle(60.0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.1);\n  renderer->GetActiveCamera()->Azimuth(0);\n  renderer->GetActiveCamera()->Elevation(5);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"SphereMap\");\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindow->GetInteractor()->SetInteractorStyle(style);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Shaders/SphereMap/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SphereMap)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  IOImage\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SphereMap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SphereMap MACOSX_BUNDLE SphereMap.cxx )\n  target_link_libraries(SphereMap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SphereMap\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Shaders/SphereMap/#download-and-build-spheremap","title":"Download and Build SphereMap","text":"

Click here to download SphereMap and its CMakeLists.txt file. Once the tarball SphereMap.tar has been downloaded and extracted,

cd SphereMap/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SphereMap\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/SimpleOperations/DistanceBetweenPoints/","title":"DistanceBetweenPoints","text":"

vtk-examples/Cxx/SimpleOperations/DistanceBetweenPoints

"},{"location":"Cxx/SimpleOperations/DistanceBetweenPoints/#description","title":"Description","text":"

This example finds the squared distance and the Euclidean distance between two 3D points.

Other languages

See (Python), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/SimpleOperations/DistanceBetweenPoints/#code","title":"Code","text":"

DistanceBetweenPoints.cxx

#include <vtkMath.h>\n\nint main(int, char*[])\n{\n  // Create two points.\n  double p0[3] = {0.0, 0.0, 0.0};\n  double p1[3] = {1.0, 1.0, 1.0};\n\n  // Find the squared distance between the points.\n  double squaredDistance = vtkMath::Distance2BetweenPoints(p0, p1);\n\n  // Take the square root to get the Euclidean distance between the points.\n  double distance = std::sqrt(squaredDistance);\n\n  // Output the results.\n  std::cout << \"SquaredDistance = \" << squaredDistance << std::endl;\n  std::cout << \"Distance = \" << distance << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/SimpleOperations/DistanceBetweenPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DistanceBetweenPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DistanceBetweenPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DistanceBetweenPoints MACOSX_BUNDLE DistanceBetweenPoints.cxx )\n  target_link_libraries(DistanceBetweenPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DistanceBetweenPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/SimpleOperations/DistanceBetweenPoints/#download-and-build-distancebetweenpoints","title":"Download and Build DistanceBetweenPoints","text":"

Click here to download DistanceBetweenPoints and its CMakeLists.txt file. Once the tarball DistanceBetweenPoints.tar has been downloaded and extracted,

cd DistanceBetweenPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DistanceBetweenPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/SimpleOperations/DistancePointToLine/","title":"DistancePointToLine","text":"

vtk-examples/Cxx/SimpleOperations/DistancePointToLine

"},{"location":"Cxx/SimpleOperations/DistancePointToLine/#description","title":"Description","text":"

This example computes the distance from a point to a line.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/SimpleOperations/DistancePointToLine/#code","title":"Code","text":"

DistancePointToLine.cxx

#include <vtkLine.h>\n#include <vtkNew.h>\n// #include <vtkPoints.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  double lineP0[3] = {0.0, 0.0, 0.0};\n  double lineP1[3] = {2.0, 0.0, 0.0};\n\n  double p0[3] = {1.0, 0, 0};\n  double p1[3] = {1.0, 2.0, 0};\n\n  /*\n  vtkNew<vtkLine> line;\n  line->GetPoints()->SetPoint(0, lineP0);\n  line->GetPoints()->SetPoint(0, lineP1);\n  */\n\n  {\n    double dist0 = vtkLine::DistanceToLine(p0, lineP0, lineP1);\n    std::cout << \"Dist0: \" << dist0 << std::endl;\n\n    double dist1 = vtkLine::DistanceToLine(p1, lineP0, lineP1);\n    std::cout << \"Dist1: \" << dist1 << std::endl;\n  }\n\n  {\n    double t;\n    double closest[3];\n    double dist0 = vtkLine::DistanceToLine(p0, lineP0, lineP1, t, closest);\n    std::cout << \"Dist0: \" << dist0 << \" closest point: \" << closest[0] << \" \"\n              << closest[1] << \" \" << closest[2] << std::endl;\n\n    double dist1 = vtkLine::DistanceToLine(p1, lineP0, lineP1, t, closest);\n    std::cout << \"Dist1: \" << dist1 << \" closest point: \" << closest[0] << \" \"\n              << closest[1] << \" \" << closest[2] << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/SimpleOperations/DistancePointToLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DistancePointToLine)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DistancePointToLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DistancePointToLine MACOSX_BUNDLE DistancePointToLine.cxx )\n  target_link_libraries(DistancePointToLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DistancePointToLine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/SimpleOperations/DistancePointToLine/#download-and-build-distancepointtoline","title":"Download and Build DistancePointToLine","text":"

Click here to download DistancePointToLine and its CMakeLists.txt file. Once the tarball DistancePointToLine.tar has been downloaded and extracted,

cd DistancePointToLine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DistancePointToLine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/SimpleOperations/FloatingPointExceptions/","title":"FloatingPointExceptions","text":"

vtk-examples/Cxx/SimpleOperations/FloatingPointExceptions

"},{"location":"Cxx/SimpleOperations/FloatingPointExceptions/#description","title":"Description","text":"

This example makes the illegal division by zero produce an error: Error: Floating point exception detected. Signal 8 rather than simply store \"inf\" in y.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/SimpleOperations/FloatingPointExceptions/#code","title":"Code","text":"

FloatingPointExceptions.cxx

#include <vtkFloatingPointExceptions.h>\n\n// Avoid the \"potential divide by 0\" warning from the Microsoft\n// compiler, since this example intentionally divides by 0\n#ifdef _MSC_VER\n#pragma warning(disable : 4723)\n#endif\n\nint main(int, char*[])\n{\n  // Disabled by default with gcc or visual studio.\n  // Enabled by default by Borland CC.\n  vtkFloatingPointExceptions::Enable();\n\n  double x = 0.0;\n  double y = 1.0 / x; // floating-point exception\n\n  std::cout << \"x: \" << x << \" y: \" << y << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/SimpleOperations/FloatingPointExceptions/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FloatingPointExceptions)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FloatingPointExceptions: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FloatingPointExceptions MACOSX_BUNDLE FloatingPointExceptions.cxx )\n  target_link_libraries(FloatingPointExceptions PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FloatingPointExceptions\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/SimpleOperations/FloatingPointExceptions/#download-and-build-floatingpointexceptions","title":"Download and Build FloatingPointExceptions","text":"

Click here to download FloatingPointExceptions and its CMakeLists.txt file. Once the tarball FloatingPointExceptions.tar has been downloaded and extracted,

cd FloatingPointExceptions/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FloatingPointExceptions\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/SimpleOperations/GaussianRandomNumber/","title":"GaussianRandomNumber","text":"

vtk-examples/Cxx/SimpleOperations/GaussianRandomNumber

"},{"location":"Cxx/SimpleOperations/GaussianRandomNumber/#description","title":"Description","text":"

This example generates 3 random numbers from a Gaussian distribution with mean 0.0 and standard deviation 2.0.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/SimpleOperations/GaussianRandomNumber/#code","title":"Code","text":"

GaussianRandomNumber.cxx

#include <vtkBoxMuellerRandomSequence.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // The number of random numbers we wish to produce\n  unsigned int numRand = 3;\n\n  vtkNew<vtkBoxMuellerRandomSequence> randomSequence;\n\n  // Generate numRand random numbers from a Gaussian distribution with mean 0.0\n  // and standard deviation 2.0\n  auto mean = 0.0;\n  auto standardDeviation = 2.0;\n  for (unsigned int i = 0; i < numRand; i++)\n  {\n    auto a = randomSequence->GetScaledValue(mean, standardDeviation);\n    randomSequence->Next();\n    std::cout << a << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/SimpleOperations/GaussianRandomNumber/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GaussianRandomNumber)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GaussianRandomNumber: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GaussianRandomNumber MACOSX_BUNDLE GaussianRandomNumber.cxx )\n  target_link_libraries(GaussianRandomNumber PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GaussianRandomNumber\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/SimpleOperations/GaussianRandomNumber/#download-and-build-gaussianrandomnumber","title":"Download and Build GaussianRandomNumber","text":"

Click here to download GaussianRandomNumber and its CMakeLists.txt file. Once the tarball GaussianRandomNumber.tar has been downloaded and extracted,

cd GaussianRandomNumber/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GaussianRandomNumber\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/SimpleOperations/PerspectiveTransform/","title":"PerspectiveTransform","text":"

vtk-examples/Cxx/SimpleOperations/PerspectiveTransform

"},{"location":"Cxx/SimpleOperations/PerspectiveTransform/#description","title":"Description","text":"

The perspective transform automatically appends the \"homogeneous 1\" to the point before it is multiplied by the matrix. It then divides the first 3 coordinates of the result by the 4th coordinate of the result. For comparison, the standard projection (vtkTransform) is also performed with the same matrix and the same point. Note that the results are much different.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/SimpleOperations/PerspectiveTransform/#code","title":"Code","text":"

PerspectiveTransform.cxx

#include <vtkMatrix4x4.h>\n#include <vtkNew.h>\n#include <vtkPerspectiveTransform.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMatrix4x4> m;\n  m->SetElement(0, 0, 1);\n  m->SetElement(0, 1, 2);\n  m->SetElement(0, 2, 3);\n  m->SetElement(0, 3, 4);\n  m->SetElement(1, 0, 2);\n  m->SetElement(1, 1, 2);\n  m->SetElement(1, 2, 3);\n  m->SetElement(1, 3, 4);\n  m->SetElement(2, 0, 3);\n  m->SetElement(2, 1, 2);\n  m->SetElement(2, 2, 3);\n  m->SetElement(2, 3, 4);\n  m->SetElement(3, 0, 4);\n  m->SetElement(3, 1, 2);\n  m->SetElement(3, 2, 3);\n  m->SetElement(3, 3, 4);\n\n  vtkNew<vtkPerspectiveTransform> perspectiveTransform;\n  perspectiveTransform->SetMatrix(m);\n\n  vtkNew<vtkTransform> transform;\n  transform->SetMatrix(m);\n\n  double p[3];\n  p[0] = 1.0;\n  p[1] = 2.0;\n  p[2] = 3.0;\n\n  double normalProjection[3];\n  transform->TransformPoint(p, normalProjection);\n\n  std::cout << \"Standard projection: \" << normalProjection[0] << \" \"\n            << normalProjection[1] << \" \" << normalProjection[2] << std::endl;\n\n  double perspectiveProjection[3];\n  perspectiveTransform->TransformPoint(p, perspectiveProjection);\n  std::cout << \"Perspective projection: \" << perspectiveProjection[0] << \" \"\n            << perspectiveProjection[1] << \" \" << perspectiveProjection[2]\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/SimpleOperations/PerspectiveTransform/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PerspectiveTransform)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonMath\n  CommonTransforms\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PerspectiveTransform: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PerspectiveTransform MACOSX_BUNDLE PerspectiveTransform.cxx )\n  target_link_libraries(PerspectiveTransform PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PerspectiveTransform\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/SimpleOperations/PerspectiveTransform/#download-and-build-perspectivetransform","title":"Download and Build PerspectiveTransform","text":"

Click here to download PerspectiveTransform and its CMakeLists.txt file. Once the tarball PerspectiveTransform.tar has been downloaded and extracted,

cd PerspectiveTransform/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PerspectiveTransform\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/SimpleOperations/ProjectPointPlane/","title":"ProjectPointPlane","text":"

vtk-examples/Cxx/SimpleOperations/ProjectPointPlane

"},{"location":"Cxx/SimpleOperations/ProjectPointPlane/#description","title":"Description","text":"

This example projects a point onto a plane. To use this example, you must have the CVSHEAD version of VTK (as of 2/2/2010).

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/SimpleOperations/ProjectPointPlane/#code","title":"Code","text":"

ProjectPointPlane.cxx

#include <vtkNew.h>\n#include <vtkPlane.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(0.0, 0.0, 0.0);\n  plane->SetNormal(0.0, 0.0, 1.0);\n\n  double p[3] = {23.1, 54.6, 9.2};\n  double origin[3] = {0.0, 0.0, 0.0};\n  double normal[3] = {0.0, 0.0, 1.0};\n  double projected[3];\n\n  plane->ProjectPoint(p, origin, normal, projected);\n\n  std::cout << \"Projected: \" << projected[0] << \" \" << projected[1] << \" \"\n            << projected[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/SimpleOperations/ProjectPointPlane/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProjectPointPlane)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProjectPointPlane: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProjectPointPlane MACOSX_BUNDLE ProjectPointPlane.cxx )\n  target_link_libraries(ProjectPointPlane PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProjectPointPlane\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/SimpleOperations/ProjectPointPlane/#download-and-build-projectpointplane","title":"Download and Build ProjectPointPlane","text":"

Click here to download ProjectPointPlane and its CMakeLists.txt file. Once the tarball ProjectPointPlane.tar has been downloaded and extracted,

cd ProjectPointPlane/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ProjectPointPlane\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/SimpleOperations/RandomSequence/","title":"RandomSequence","text":"

vtk-examples/Cxx/SimpleOperations/RandomSequence

"},{"location":"Cxx/SimpleOperations/RandomSequence/#description","title":"Description","text":"

This is the \"new\" (December, 2009) VTK way to produce random numbers. It is actually a random sequence generator.

Other languages

See (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/SimpleOperations/RandomSequence/#code","title":"Code","text":"

RandomSequence.cxx

#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // Create a random sequence generator.\n  vtkNew<vtkMinimalStandardRandomSequence> sequence;\n\n  // initialize the sequence\n  sequence->SetSeed(1);\n\n  // Get 3 random numbers.\n  double x = sequence->GetValue();\n  sequence->Next();\n  double y = sequence->GetValue();\n  sequence->Next();\n  double z = sequence->GetValue();\n\n  // You can also use seq->GetRangeValue(-1.0,1.0);\n  // to set a range on the random values.\n\n  // Output the resulting random numbersl\n  std::cout << \"x: \" << x << \" y: \" << y << \" z: \" << z << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/SimpleOperations/RandomSequence/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RandomSequence)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RandomSequence: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RandomSequence MACOSX_BUNDLE RandomSequence.cxx )\n  target_link_libraries(RandomSequence PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RandomSequence\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/SimpleOperations/RandomSequence/#download-and-build-randomsequence","title":"Download and Build RandomSequence","text":"

Click here to download RandomSequence and its CMakeLists.txt file. Once the tarball RandomSequence.tar has been downloaded and extracted,

cd RandomSequence/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RandomSequence\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/SimpleOperations/UniformRandomNumber/","title":"UniformRandomNumber","text":"

vtk-examples/Cxx/SimpleOperations/UniformRandomNumber

"},{"location":"Cxx/SimpleOperations/UniformRandomNumber/#description","title":"Description","text":"

This example generates 3 random numbers between 0 and 2 from a uniform distribution.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/SimpleOperations/UniformRandomNumber/#code","title":"Code","text":"

UniformRandomNumber.cxx

#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n\n#include <time.h>\n\nint main(int, char*[])\n{\n  // Set the number of random numbers we wish to produce to 3.\n  unsigned int numRand = 3;\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  // Without this line, the random numbers will be the same every iteration.\n  // randomSequence->SetSeed(time(NULL));\n\n  // Generate numRand random numbers from a uniform distribution between 0.0\n  // and 2.0\n  for (unsigned int i = 0; i < numRand; i++)\n  {\n    auto a = randomSequence->GetRangeValue(0.0, 2.0);\n    randomSequence->Next();\n\n    std::cout << a << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/SimpleOperations/UniformRandomNumber/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(UniformRandomNumber)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"UniformRandomNumber: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(UniformRandomNumber MACOSX_BUNDLE UniformRandomNumber.cxx )\n  target_link_libraries(UniformRandomNumber PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS UniformRandomNumber\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/SimpleOperations/UniformRandomNumber/#download-and-build-uniformrandomnumber","title":"Download and Build UniformRandomNumber","text":"

Click here to download UniformRandomNumber and its CMakeLists.txt file. Once the tarball UniformRandomNumber.tar has been downloaded and extracted,

cd UniformRandomNumber/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./UniformRandomNumber\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Snippets/CameraPosition/","title":"CameraPosition","text":""},{"location":"Cxx/Snippets/CameraPosition/#description","title":"Description","text":"

A callback that gives you the camera position and focal point.

"},{"location":"Cxx/Snippets/CameraPosition/#declaration-section","title":"Declaration Section","text":"
#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n\nnamespace {\n\n// Get the camera position.\nvoid CameraModifiedCallback(vtkObject* caller,\n                            long unsigned int vtkNotUsed(eventId),\n                            void* vtkNotUsed(clientData),\n                            void* vtkNotUsed(callData));\n} // namespace\n
"},{"location":"Cxx/Snippets/CameraPosition/#implementation-section","title":"Implementation Section","text":"
namespace {\n\nvoid CameraModifiedCallback(vtkObject* caller,\n                            long unsigned int vtkNotUsed(eventId),\n                            void* vtkNotUsed(clientData),\n                            void* vtkNotUsed(callData))\n{\n  std::cout << caller->GetClassName() << \" modified\" << std::endl;\n  vtkCamera* camera = static_cast<vtkCamera*>(caller);\n  // Print the interesting stuff.\n  std::cout << \"  auto camera = renderer->GetActiveCamera();\" << std::endl;\n  std::cout << \"  camera->SetPosition(\" << camera->GetPosition()[0] << \", \"\n            << camera->GetPosition()[1] << \", \" << camera->GetPosition()[2]\n            << \");\" << std::endl;\n  std::cout << \"  camera->SetFocalPoint(\" << camera->GetFocalPoint()[0] << \", \"\n            << camera->GetFocalPoint()[1] << \", \" << camera->GetFocalPoint()[2]\n            << \");\" << std::endl;\n  std::cout << \"  camera->SetViewUp(\" << camera->GetViewUp()[0] << \", \"\n            << camera->GetViewUp()[1] << \", \" << camera->GetViewUp()[2] << \");\"\n            << std::endl;\n  std::cout << \"  camera->SetDistance(\" << camera->GetDistance() << \");\"\n            << std::endl;\n  std::cout << \"  camera->SetClippingRange(\" << camera->GetClippingRange()[0]\n            << \", \" << camera->GetClippingRange()[1] << \");\" << std::endl;\n  std::cout << std::endl;\n}\n} // namespace\n
"},{"location":"Cxx/Snippets/CameraPosition/#usage","title":"Usage","text":"
  // Call vtkRenderWindow::Render() before this code e.g. renWin->Render();\n  vtkNew<vtkCallbackCommand> modifiedCallback;\n  modifiedCallback->SetCallback(CameraModifiedCallback);\n  renderer->GetActiveCamera()->AddObserver(vtkCommand::ModifiedEvent,\n                                           modifiedCallback);\n

Once you have the output, replace the renderer->GetActiveCamera()->AddObserver... line with the output data.

"},{"location":"Cxx/Snippets/CheckVTKVersion/","title":"CheckVTKVersion","text":""},{"location":"Cxx/Snippets/CheckVTKVersion/#description","title":"Description","text":"

This enables us to check the VTK version and provide alternatives for different VTK versions.

true is returned if the requested VTK version is >= the current version.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Cxx/Snippets/CheckVTKVersion/#declaration-section","title":"Declaration Section","text":"
#include <vtkNew.h>\n#include <vtkVersion.h>\n\nnamespace {\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return true if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n\n} // namespace\n
"},{"location":"Cxx/Snippets/CheckVTKVersion/#implementation-section","title":"Implementation Section","text":"
namespace {\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n  auto res = false;\n#ifndef VTK_VERSION_NUMBER\n  vtkNew<vtkVersion> ver;\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  res = vtk_version_number >= neededVersion;\n#else\n  res = VTK_VERSION_NUMBER >= neededVersion;\n#endif\n  return res;\n}\n\n} // namespace\n
"},{"location":"Cxx/Snippets/CheckVTKVersion/#typical-usage","title":"Typical usage","text":"
  // We can check and exit if the VTK version is too old.\n  if (!VTKVersionOk(9, 0, 0))\n  {\n    std::cerr << \"You need VTK version 9.0.0 or greater to run this program.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n

See:

  • PBR_Skybox for a typical usage example. Here we are deciding to use vtkCameraOrientationWidget instead of vtkOrientationMarkerWidget if the VTK version is >= 9.0.20210718.
  • CheckVTKVersion for a test/example.
"},{"location":"Cxx/Snippets/ChooseContrastingColor/","title":"ChooseContrastingColor","text":""},{"location":"Cxx/Snippets/ChooseContrastingColor/#description","title":"Description","text":"

Given a color, find a contrasting color. If the given color is \"light\", use the lightColor otherwise use the darkColor.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Cxx/Snippets/ChooseContrastingColor/#declaration-section","title":"Declaration Section","text":"
#include <vtkNamedColors.h>\n#include <vtkMath.h>\nnamespace\n{\n// Given a color, find a contrasting color. If the given color is \"light\",\n// use the lightColor otherwise use the darkColor\nvoid ChooseContrastingColor(double *rgbIn,\n                            double *rgbOut,\n                            const double threshold = .5,\n                            const std::string lightColor = \"white\",\n                            const std::string darkColor = \"black\");\n}\n
"},{"location":"Cxx/Snippets/ChooseContrastingColor/#implementation-section","title":"Implementation Section","text":"
namespace\n{\nvoid ChooseContrastingColor(double *rgbIn,\n                            double *rgbOut,\n                            const double threshold,\n                            const std::string lightColor,\n                            const std::string darkColor)\n{\n  auto colors = vtkSmartPointer<vtkNamedColors>::New();\n\n  double hsv[3];\n  // If the value is <= threshold, use a light color, otherwise use a dark color\n  vtkMath::RGBToHSV(rgbIn, hsv);\n  if (hsv[2] <= threshold)\n  {\n    colors->GetColor(lightColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n  else\n  {\n    colors->GetColor(darkColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n}\n}  // namespace\n
"},{"location":"Cxx/Snippets/PointToGlyph/","title":"PointToGlyph","text":""},{"location":"Cxx/Snippets/PointToGlyph/#description","title":"Description","text":"

Represent points as glyphs. The point is represented as a sphere.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Cxx/Snippets/PointToGlyph/#declaration-section","title":"Declaration Section","text":"
#include <vtkActor.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nnamespace\n{\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n}\n
"},{"location":"Cxx/Snippets/PointToGlyph/#implementation-section","title":"Implementation Section","text":"
namespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
"},{"location":"Cxx/Snippets/PointToGlyph/#usage","title":"Usage","text":"
  // Map the points to spheres\n  auto sphereActor = PointToGlyph(someFilter->GetOutput()->GetPoints(), 0.05);\n  // Set the actor color here\n
"},{"location":"Cxx/Snippets/ReadPolyData/","title":"ReadPolyData","text":""},{"location":"Cxx/Snippets/ReadPolyData/#description","title":"Description","text":"

Given a filename, uses the appropriate vtkPolyData reader to read any vtkPolyData file.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Cxx/Snippets/ReadPolyData/#declaration-section","title":"Declaration Section","text":"
// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <string> // For find_last_of()\n#include <cctype> // For to_lower\n\nnamespace {\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\n}\n
"},{"location":"Cxx/Snippets/ReadPolyData/#implementation-section","title":"Implementation Section","text":"
namespace {\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\n} // namespace\n
"},{"location":"Cxx/Snippets/RestoreSceneFromFieldData/","title":"RestoreSceneFromFieldData","text":""},{"location":"Cxx/Snippets/RestoreSceneFromFieldData/#description","title":"Description","text":"

Given a vtkDataSet, vtkActor and vtkCamera, restore the necessary variables in the vtkDataSet's vtkFieldData to recreate a scene to a file.

Note

The snippet currently just saves the vtkCamera variables.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Cxx/Snippets/RestoreSceneFromFieldData/#declaration-section","title":"Declaration Section","text":"
#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSet.h>\n#include <vtkFieldData.h>\n#include <vtkStringArray.h>\n#include <vtksys/RegularExpression.hxx>\n\nnamespace\n{\nvoid RestoreSceneFromFieldData(vtkDataSet *data,\n                               vtkActor *actor,\n                               vtkCamera *camera);\n}\n
"},{"location":"Cxx/Snippets/RestoreSceneFromFieldData/#implementation-section","title":"Implementation Section","text":"
namespace\n{\nvoid  RestoreSceneFromFieldData(vtkDataSet *data,\n                               vtkActor *actor,\n                               vtkCamera *camera)\n{\n\n  std::istringstream buffer;\n\n  // Get the saved camera information from the field data\n  if (vtkStringArray::SafeDownCast(\n        data->GetFieldData()->GetAbstractArray(\"Camera\")))\n  {\n    buffer.str(vtkStringArray::SafeDownCast(\n                 data->GetFieldData()->GetAbstractArray(\"Camera\"))->GetValue(0));\n  }\n  else\n  {\n    return;\n  }\n\n  std::string line;\n  double vector[3];\n  double scalar;\n\n  vtksys::RegularExpression reCP(\"^Camera:Position\");\n  vtksys::RegularExpression reCFP(\"^Camera:FocalPoint\");\n  vtksys::RegularExpression reCVU(\"^Camera:ViewUp\");\n  vtksys::RegularExpression reCVA(\"^Camera:ViewAngle\");\n  vtksys::RegularExpression reCCR(\"^Camera:ClippingRange\");\n  vtksys::RegularExpression floatNumber(\n      \"[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])\");\n  vtksys::RegularExpression floatScalar(\"[^0-9\\\\.\\\\-]*([0-9\\\\.\\\\-e]*[^,])\");\n\n  while (std::getline(buffer,line))\n  {\n    if (reCFP.find(line))\n    {\n      std::string rest(line, reCFP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetFocalPoint(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCP.find(line))\n    {\n      std::string rest(line, reCP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetPosition(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVU.find(line))\n    {\n      std::string rest(line, reCVU.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetViewUp(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVA.find(line))\n    {\n      std::string rest(line, reCVA.end());\n      if (floatScalar.find(rest))\n      {\n        camera->SetViewAngle(\n          atof(floatScalar.match(1).c_str()));\n      }\n    }\n    else if (reCCR.find(line))\n    {\n      std::string rest(line, reCCR.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetClippingRange(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()));\n      }\n    }\n    else\n    {\n      std::cout << \"Unrecognized line: \" << line << std::endl;\n    }\n  }\n}\n} // namespace\n
"},{"location":"Cxx/Snippets/RestoreSceneFromFile/","title":"RestoreSceneFromFile","text":""},{"location":"Cxx/Snippets/RestoreSceneFromFile/#description","title":"Description","text":"

Given a filename, vtkActor and vtkCamera, reads necessary variables to recreate the scene from a file.

Note

The snippet currently just restores the vtkCamera variables.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Cxx/Snippets/RestoreSceneFromFile/#declaration-section","title":"Declaration Section","text":"
#include <vtkActor.h>\n#include <vtkCamera.h>\nnamespace\n{\nvoid RestoreSceneFromFile(std::string fileName,\n                          vtkActor *actor,\n                          vtkCamera *camera);\n}\n
"},{"location":"Cxx/Snippets/RestoreSceneFromFile/#implementation-section","title":"Implementation Section","text":"
namespace\n{\n#include <fstream>\n\nvoid RestoreSceneFromFile(std::string fileName,\n                          vtkActor *actor,\n                          vtkCamera *camera)\n{\n  std::ifstream saveFile(fileName);\n  std::string line;\n  double vector[3];\n  double scalar;\n\n  vtksys::RegularExpression reCP(\"^Camera:Position\");\n  vtksys::RegularExpression reCFP(\"^Camera:FocalPoint\");\n  vtksys::RegularExpression reCVU(\"^Camera:ViewUp\");\n  vtksys::RegularExpression reCVA(\"^Camera:ViewAngle\");\n  vtksys::RegularExpression reCCR(\"^Camera:ClippingRange\");\n  vtksys::RegularExpression floatNumber(\n      \"[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])\");\n  vtksys::RegularExpression floatScalar(\"[^0-9\\\\.\\\\-]*([0-9\\\\.\\\\-e]*[^,])\");\n\n  while (std::getline(saveFile, line) && ! saveFile.eof())\n  {\n    if (reCFP.find(line))\n    {\n      std::string rest(line, reCFP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetFocalPoint(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCP.find(line))\n    {\n      std::string rest(line, reCP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetPosition(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVU.find(line))\n    {\n      std::string rest(line, reCVU.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetViewUp(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVA.find(line))\n    {\n      std::string rest(line, reCVA.end());\n      if (floatScalar.find(rest))\n      {\n        camera->SetViewAngle(\n          atof(floatScalar.match(1).c_str()));\n      }\n    }\n    else if (reCCR.find(line))\n    {\n      std::string rest(line, reCCR.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetClippingRange(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()));\n      }\n    }\n    else\n    {\n      std::cout << \"Unrecognized line: \" << line << std::endl;\n    }\n  }\n  saveFile.close();\n}\n} // namespace\n
"},{"location":"Cxx/Snippets/SaveSceneToFieldData/","title":"SaveSceneToFieldData","text":""},{"location":"Cxx/Snippets/SaveSceneToFieldData/#description","title":"Description","text":"

Given a vtkDataSet, vtkActor and vtkCamera, save necessary variables in the vtkDataSet's vtkFieldData to recreate a scene to a file.

Note

The snippet currently just saves the vtkCamera variables.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Cxx/Snippets/SaveSceneToFieldData/#declaration-section","title":"Declaration Section","text":"
namespace\n{\nvoid SaveSceneToFieldData(vtkDataSet *data,\n                          vtkActor *actor,\n                          vtkCamera *camera);\n}\n
"},{"location":"Cxx/Snippets/SaveSceneToFieldData/#implementation-section","title":"Implementation Section","text":"
#include <sstream>\n\nnamespace\n{\nvoid SaveSceneToFieldData(vtkDataSet *data,\n                          vtkActor *actor,\n                          vtkCamera *camera)\n{\n  std::ostringstream buffer;\n  double vector[3];\n  double scalar;\n\n  camera->GetFocalPoint(vector);\n  buffer << \"Camera:FocalPoint \"\n         << vector[0] << \", \"\n         << vector[1] << \", \"\n         << vector[2] << std::endl;\n  camera->GetPosition(vector);\n  buffer << \"Camera:Position \"\n           << vector[0] << \", \"\n           << vector[1] << \", \"\n           << vector[2] << std::endl;\n  camera->GetViewUp(vector);\n  buffer << \"Camera:ViewUp \"\n           << vector[0] << \", \"\n           << vector[1] << \", \"\n           << vector[2] << std::endl;\n  scalar = camera->GetViewAngle();\n  buffer << \"Camera:ViewAngle \"\n           << scalar << std::endl;\n  camera->GetClippingRange(vector);\n  buffer << \"Camera:ClippingRange \"\n           << vector[0] << \", \"\n           << vector[1] << std::endl;\n  vtkSmartPointer<vtkStringArray> cameraArray = \n    vtkSmartPointer<vtkStringArray>::New();\n  cameraArray->SetNumberOfValues(1);\n  cameraArray->SetValue(0, buffer.str());\n  cameraArray->SetName(\"Camera\");\n  data->GetFieldData()->AddArray(cameraArray);\n}\n} // namespace\n
"},{"location":"Cxx/Snippets/SaveSceneToFile/","title":"SaveSceneToFile","text":""},{"location":"Cxx/Snippets/SaveSceneToFile/#description","title":"Description","text":"

Given a filename, vtkActor and vtkCamera, save necessary variables to recreate a scene to a file.

Note

The snippet currently just saves the vtkCamera variables.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Cxx/Snippets/SaveSceneToFile/#declaration-section","title":"Declaration Section","text":"
#include <vtkActor.h>\n#include <vtkCamera.h>\nnamespace\n{\nvoid SaveSceneToFile(std::string fileName,\n                     vtkActor *actor,\n                     vtkCamera *camera);\n}\n
"},{"location":"Cxx/Snippets/SaveSceneToFile/#implementation-section","title":"Implementation Section","text":"
namespace\n{\n#include <fstream>\n\nvoid SaveSceneToFile(std::string fileName,\n                     vtkActor *actor,\n                     vtkCamera *camera)\n{\n// Actor\n//  Position, orientation, origin, scale, usrmatrix, usertransform\n//Camera\n//  FocalPoint, Position, ViewUp, ViewAngle, ClippingRange\n  std::ofstream saveFile(fileName, std::ofstream::out);\n  double vector[3];\n  double scalar;\n\n  camera->GetFocalPoint(vector);\n  saveFile << \"Camera:FocalPoint \"\n           << vector[0] << \", \"\n           << vector[1] << \", \"\n           << vector[2] << std::endl;\n  camera->GetPosition(vector);\n  saveFile << \"Camera:Position \"\n           << vector[0] << \", \"\n           << vector[1] << \", \"\n           << vector[2] << std::endl;\n  camera->GetViewUp(vector);\n  saveFile << \"Camera:ViewUp \"\n           << vector[0] << \", \"\n           << vector[1] << \", \"\n           << vector[2] << std::endl;\n  scalar = camera->GetViewAngle();\n  saveFile << \"Camera:ViewAngle \"\n           << scalar << std::endl;\n  camera->GetClippingRange(vector);\n  saveFile << \"Camera:ClippingRange \"\n           << vector[0] << \", \"\n           << vector[1] << std::endl;\n  saveFile.close();\n}\n} // namespace\n
"},{"location":"Cxx/Snippets/ViewportBorders/","title":"ViewportBorders","text":""},{"location":"Cxx/Snippets/ViewportBorders/#description","title":"Description","text":"

Draw the borders of a vtkRenderer's viewports.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Cxx/Snippets/ViewportBorders/#declaration-section","title":"Declaration Section","text":"
#include <vtkRenderer.h>\n#include <vtkPoints.h>\n#include <vtkCellArray.h>\n#include <vtkPolyLines.h>\n#include <vtkPolyData.h>\n#include <vtkCoordinate.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkActor2D.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n\nnamespace\n{\nvoid ViewportBorders(vtkSmartPointer<vtkRenderer> &renderer,\n                     double *color,\n                     bool last = false);\n}\n
"},{"location":"Cxx/Snippets/ViewportBorders/#implementation-section","title":"Implementation Section","text":"
namespace\n{\n// Draw the borders of a renderer's viewport\nvoid ViewportBorders(vtkSmartPointer<vtkRenderer> &renderer,\n                     double *color,\n                     bool last)\n{\n  // points start at upper right and proceed anti-clockwise\n  auto points = vtkSmartPointer<vtkPoints>::New();\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  // create cells, and lines\n  auto cells =  vtkSmartPointer<vtkCellArray>::New();\n  cells->Initialize(); \n\n  auto lines = vtkSmartPointer<vtkPolyLine>::New();\n\n  // only draw last line if this is the last viewport\n  // this prevents double vertical lines at right border\n  // if different colors are used for each border, then do\n  // not specify last\n  if (last)\n  {\n    lines->GetPointIds()->SetNumberOfIds(5);\n  }\n  else\n  {\n  lines->GetPointIds()->SetNumberOfIds(4);\n  }\n  for(unsigned int i = 0; i < 4; ++i)\n  {\n    lines->GetPointIds()->SetId(i,i);\n  }\n  if (last)\n  {\n    lines->GetPointIds()->SetId(4, 0);\n  }\n  cells->InsertNextCell(lines);\n\n  // now make tge polydata and display it\n  auto poly = vtkSmartPointer<vtkPolyData>::New();\n  poly->Initialize(); \n  poly->SetPoints(points); \n  poly->SetLines(cells); \n\n  // use normalized viewport coordinates since\n  // they are independent of window size\n  auto coordinate = vtkSmartPointer<vtkCoordinate>::New();\n  coordinate->SetCoordinateSystemToNormalizedViewport(); \n\n  auto mapper = vtkSmartPointer<vtkPolyDataMapper2D>::New();\n  mapper->SetInputData(poly); \n  mapper->SetTransformCoordinate(coordinate); \n\n  auto actor = vtkSmartPointer<vtkActor2D>::New();\n  actor->SetMapper(mapper); \n  actor->GetProperty()->SetColor(color);\n  // line width should be at least 2 to be visible at extremes\n\n  actor->GetProperty()->SetLineWidth(4.0); // Line Width \n\n  renderer->AddViewProp(actor);\n}\n} // namespace\n
"},{"location":"Cxx/Snippets/WriteImage/","title":"Description","text":"

Given a filename, render window and optionally a rgba value, take a screenshot of the render window and write it to a file. The extension of the filename determines what writer to use.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Cxx/Snippets/WriteImage/#c","title":"C++","text":""},{"location":"Cxx/Snippets/WriteImage/#declaration-section","title":"Declaration Section","text":"
#include <vtkBMPWriter.h>\n#include <vtkImageWriter.h>\n#include <vtkJPEGWriter.h>\n#include <vtkPNGWriter.h>\n#include <vtkPNMWriter.h>\n#include <vtkPostScriptWriter.h>\n#include <vtkTIFFWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <algorithm>\n#include <locale>\n#include <string>\n\nnamespace\n{\n/**\n * Write the render window view to an image file.\n * \n * Image types supported are:\n *  BMP, JPEG, PNM, PNG, PostScript, TIFF.\n * The default parameters are used for all writers, change as needed.\n * \n * @param fileName The file name, if no extension then PNG is assumed.\n * @param renWin The render window.\n * @param rgba Used to set the buffer type.\n * \n */\nvoid WriteImage(std::string const& fileName, vtkRenderWindow* renWin,\n                bool rgba = true);\n\n\n}\n
"},{"location":"Cxx/Snippets/WriteImage/#implementation-section","title":"Implementation Section","text":"
namespace {\n\nvoid WriteImage(std::string const& fileName, vtkRenderWindow* renWin, bool rgba)\n{\n  if (!fileName.empty())\n  {\n    std::string fn = fileName;\n    std::string ext;\n    auto found = fn.find_last_of(\".\");\n    if (found == std::string::npos)\n    {\n      ext = \".png\";\n      fn += ext;\n    }\n    else\n    {\n      ext = fileName.substr(found, fileName.size());\n    }\n    std::locale loc;\n    std::transform(ext.begin(), ext.end(), ext.begin(),\n                   [=](char const& c) { return std::tolower(c, loc); });\n    auto writer = vtkSmartPointer<vtkImageWriter>::New();\n    if (ext == \".bmp\")\n    {\n      writer = vtkSmartPointer<vtkBMPWriter>::New();\n    }\n    else if (ext == \".jpg\")\n    {\n      writer = vtkSmartPointer<vtkJPEGWriter>::New();\n    }\n    else if (ext == \".pnm\")\n    {\n      writer = vtkSmartPointer<vtkPNMWriter>::New();\n    }\n    else if (ext == \".ps\")\n    {\n      if (rgba)\n      {\n        rgba = false;\n      }\n      writer = vtkSmartPointer<vtkPostScriptWriter>::New();\n    }\n    else if (ext == \".tiff\")\n    {\n      writer = vtkSmartPointer<vtkTIFFWriter>::New();\n    }\n    else\n    {\n      writer = vtkSmartPointer<vtkPNGWriter>::New();\n    }\n    vtkNew<vtkWindowToImageFilter> window_to_image_filter;\n    window_to_image_filter->SetInput(renWin);\n    window_to_image_filter->SetScale(1); // image quality\n    if (rgba)\n    {\n      window_to_image_filter->SetInputBufferTypeToRGBA();\n    }\n    else\n    {\n      window_to_image_filter->SetInputBufferTypeToRGB();\n    }\n    // Read from the front buffer.\n    window_to_image_filter->ReadFrontBufferOff();\n    window_to_image_filter->Update();\n\n    writer->SetFileName(fn.c_str());\n    writer->SetInputConnection(window_to_image_filter->GetOutputPort());\n    writer->Write();\n  }\n  else\n  {\n    std::cerr << \"No filename provided.\" << std::endl;\n  }\n\n  return;\n}\n\n} // namespace\n
"},{"location":"Cxx/Snippets/WriteImage/#usage","title":"Usage","text":"
  WriteImage(f, renWin, false);\n
"},{"location":"Cxx/Snippets/WriteImage/#note","title":"Note","text":"

You may need to your edit your CMakeLists.txt adding this to the find_package(VTK COMPONENTS statement:

  IOImage\n  RenderingCore\n
"},{"location":"Cxx/StructuredGrid/BlankPoint/","title":"BlankPoint","text":"

vtk-examples/Cxx/StructuredGrid/BlankPoint

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/StructuredGrid/BlankPoint/#code","title":"Code","text":"

BlankPoint.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n\n#include <iostream>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  vtkNew<vtkPoints> points;\n\n  unsigned int gridSize = 8;\n  unsigned int counter = 0;\n  unsigned int ptIdx = 0;\n  // Create a 5x5 grid of points\n  for (unsigned int j = 0; j < gridSize; j++)\n  {\n    for (unsigned int i = 0; i < gridSize; i++)\n    {\n      if (i == 3 && j == 3) // Make one point higher than the rest\n      {\n        points->InsertNextPoint(i, j, 2);\n        std::cout << \"The different point is number \" << counter << std::endl;\n        ptIdx = counter;\n      }\n      else\n      {\n        // Make most of the points the same height\n        points->InsertNextPoint(i, j, 0);\n      }\n      counter++;\n    }\n  }\n\n  // Specify the dimensions of the grid, set the points and blank one point.\n  structuredGrid->SetDimensions(gridSize, gridSize, 1);\n  structuredGrid->SetPoints(points);\n  structuredGrid->BlankPoint(ptIdx);\n  structuredGrid->Modified();\n\n  // Check.\n  auto isVisible = [&structuredGrid](int const& ptNum) {\n    if (structuredGrid->IsPointVisible(ptNum))\n    {\n      std::cout << \"Point: \" << ptNum << \" is visible\" << std::endl;\n    }\n    else\n    {\n      std::cout << \"Point: \" << ptNum << \" is not visible\" << std::endl;\n    }\n  };\n\n  // Should not be visible.\n  isVisible(ptIdx);\n  // Should be visible.\n  isVisible(7);\n\n  // We need the geometry filter to ensure that the\n  // blanked point and surrounding faces is missing.\n  vtkNew<vtkStructuredGridGeometryFilter>geometryFilter;\n  geometryFilter->SetInputData(structuredGrid);\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> gridMapper;\n  // gridMapper->SetInputData(structuredGrid);\n  gridMapper->SetInputConnection(geometryFilter->GetOutputPort());\n\n\n  vtkNew<vtkActor> gridActor;\n  gridActor->SetMapper(gridMapper);\n  gridActor->GetProperty()->EdgeVisibilityOn();\n  gridActor->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Blue\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BlankPoint\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(gridActor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/StructuredGrid/BlankPoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BlankPoint)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BlankPoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BlankPoint MACOSX_BUNDLE BlankPoint.cxx )\n  target_link_libraries(BlankPoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BlankPoint\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/StructuredGrid/BlankPoint/#download-and-build-blankpoint","title":"Download and Build BlankPoint","text":"

Click here to download BlankPoint and its CMakeLists.txt file. Once the tarball BlankPoint.tar has been downloaded and extracted,

cd BlankPoint/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BlankPoint\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/StructuredGrid/GetLinearPointId/","title":"GetLinearPointId","text":"

vtk-examples/Cxx/StructuredGrid/GetLinearPointId

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/StructuredGrid/GetLinearPointId/#code","title":"Code","text":"

GetLinearPointId.cxx

#include <vtkNew.h>\n#include <vtkStructuredData.h>\n#include <vtkStructuredGrid.h>\n\nint main(int, char*[])\n{\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  // Set the dimensions of the grid\n  {\n    int dims[3] = {5, 10, 1};\n    structuredGrid->SetDimensions(dims);\n  }\n\n  // Retrieve the dimensions of the grid\n  int dimensions[3];\n  structuredGrid->GetDimensions(dimensions);\n\n  {\n    int queryPoint[3] = {4, 0, 0};\n    vtkIdType pointId =\n        vtkStructuredData::ComputePointId(dimensions, queryPoint);\n\n    std::cout << \"PointId: \" << pointId << std::endl; // Outputs '4'\n  }\n\n  {\n    int queryPoint[3] = {0, 1, 0};\n    vtkIdType pointId =\n        vtkStructuredData::ComputePointId(dimensions, queryPoint);\n\n    std::cout << \"PointId: \" << pointId << std::endl; // Outputs '5'\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/StructuredGrid/GetLinearPointId/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetLinearPointId)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetLinearPointId: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetLinearPointId MACOSX_BUNDLE GetLinearPointId.cxx )\n  target_link_libraries(GetLinearPointId PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetLinearPointId\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/StructuredGrid/GetLinearPointId/#download-and-build-getlinearpointid","title":"Download and Build GetLinearPointId","text":"

Click here to download GetLinearPointId and its CMakeLists.txt file. Once the tarball GetLinearPointId.tar has been downloaded and extracted,

cd GetLinearPointId/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GetLinearPointId\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/StructuredGrid/SGrid/","title":"SGrid","text":"

vtk-examples/Cxx/StructuredGrid/SGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/StructuredGrid/SGrid/#description","title":"Description","text":"

Creating a structured grid dataset of a semicylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction.

Info

See Figure 5-19 in Chapter 5 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/StructuredGrid/SGrid/#code","title":"Code","text":"

SGrid.cxx

// This example shows how to manually create a structured grid.\n// The basic idea is to instantiate vtkStructuredGrid, set its dimensions,\n// and then assign points defining the grid coordinate. The number of\n// points must equal the number of points implicit in the dimensions\n// (i.e., dimX*dimY*dimZ). Also, data attributes (either point or cell)\n// can be added to the dataset.\n//\n//\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDoubleArray.h>\n#include <vtkHedgeHog.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n\nint main(int, char*[])\n{\n  double x[3], v[3], rMin = 0.5, rMax = 1.0, deltaRad, deltaZ;\n  double radius, theta;\n  static int dims[3] = {13, 11, 11};\n\n  // Create the structured grid.\n  vtkNew<vtkStructuredGrid> sgrid;\n  sgrid->SetDimensions(dims);\n\n  // We also create the points and vectors. The points\n  // form a hemi-cylinder of data.\n  vtkNew<vtkDoubleArray> vectors;\n  vectors->SetNumberOfComponents(3);\n  vectors->SetNumberOfTuples(dims[0] * dims[1] * dims[2]);\n  vtkNew<vtkPoints> points;\n  points->Allocate(dims[0] * dims[1] * dims[2]);\n\n  deltaZ = 2.0 / (dims[2] - 1);\n  deltaRad = (rMax - rMin) / (dims[1] - 1);\n  v[2] = 0.0;\n  for (auto k = 0; k < dims[2]; k++)\n  {\n    x[2] = -1.0 + k * deltaZ;\n    auto kOffset = k * dims[0] * dims[1];\n    for (auto j = 0; j < dims[1]; j++)\n    {\n      radius = rMin + j * deltaRad;\n      auto jOffset = j * dims[0];\n      for (auto i = 0; i < dims[0]; i++)\n      {\n        theta = i * vtkMath::RadiansFromDegrees(15.0);\n        x[0] = radius * cos(theta);\n        x[1] = radius * sin(theta);\n        v[0] = -x[1];\n        v[1] = x[0];\n        auto offset = i + jOffset + kOffset;\n        points->InsertPoint(offset, x);\n        vectors->InsertTuple(offset, v);\n      }\n    }\n  }\n  sgrid->SetPoints(points);\n  sgrid->GetPointData()->SetVectors(vectors);\n\n  // We create a simple pipeline to display the data.\n  vtkNew<vtkHedgeHog> hedgehog;\n  hedgehog->SetInputData(sgrid);\n  hedgehog->SetScaleFactor(0.1);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> sgridMapper;\n  sgridMapper->SetInputConnection(hedgehog->GetOutputPort());\n  vtkNew<vtkActor> sgridActor;\n  sgridActor->SetMapper(sgridMapper);\n  sgridActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create the usual rendering stuff\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"SGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(sgridActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renWin->SetSize(640, 480);\n\n  // interact with data\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/StructuredGrid/SGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SGrid MACOSX_BUNDLE SGrid.cxx )\n  target_link_libraries(SGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/StructuredGrid/SGrid/#download-and-build-sgrid","title":"Download and Build SGrid","text":"

Click here to download SGrid and its CMakeLists.txt file. Once the tarball SGrid.tar has been downloaded and extracted,

cd SGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/StructuredGrid/StructuredGrid/","title":"StructuredGrid","text":"

vtk-examples/Cxx/StructuredGrid/StructuredGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/StructuredGrid/StructuredGrid/#description","title":"Description","text":"

This example reads and writes points into a structured grid.

The structured grid is colored by point data. However there is an option to color by cell data.

Demonstration code is also provided to list cells and their Ids along with listing point Ids shared between cells.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/StructuredGrid/StructuredGrid/#code","title":"Code","text":"

StructuredGrid.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n\n#include <iterator>\n#include <map>\n#include <set>\n\n#define USE_POINT_DATA\n// Uncomment the next line if you want to use cell data instead\n// #undef USE_POINT_DATA\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  size_t nx = 2, ny = 3, nz = 2;\n  auto dataSize = nx * ny * nz;\n\n  vtkNew<vtkDoubleArray> pointValues;\n  pointValues->SetNumberOfComponents(1);\n  pointValues->SetNumberOfTuples(dataSize);\n  for (size_t i = 0; i < dataSize; ++i)\n  {\n    pointValues->SetValue(i, i);\n  }\n\n  auto numberOfCells = (nx - 1) * (ny - 1) * (nz - 1);\n  vtkNew<vtkDoubleArray> cellValues;\n  cellValues->SetNumberOfTuples(numberOfCells);\n  for (size_t i = 0; i < numberOfCells; ++i)\n  {\n    cellValues->SetValue(i, i);\n  }\n\n  vtkNew<vtkPoints> points;\n  auto x = 0.0;\n  auto y = 0.0;\n  auto z = 0.0;\n  for (unsigned int k = 0; k < nz; k++)\n  {\n    z += 2.0;\n    for (unsigned int j = 0; j < ny; j++)\n    {\n      y += 1.0;\n      for (unsigned int i = 0; i < nx; i++)\n      {\n        x += .5;\n        points->InsertNextPoint(x, y, z);\n      }\n    }\n  }\n\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n  // Specify the dimensions of the grid\n  structuredGrid->SetDimensions(static_cast<int>(nx), static_cast<int>(ny),\n                                static_cast<int>(nz));\n  structuredGrid->SetPoints(points);\n  structuredGrid->GetCellData()->SetScalars(cellValues);\n  structuredGrid->GetPointData()->SetScalars(pointValues);\n\n  // The key is the cell Id and the value is a set of corresponding point Ids.\n  std::map<vtkIdType, std::set<vtkIdType>> cellPointIds;\n  vtkCellIterator* it = structuredGrid->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    vtkIdList* pointIds = it->GetPointIds();\n    std::set<vtkIdType> ptIds;\n    for (vtkIdType* id = pointIds->begin(); id != pointIds->end(); ++id)\n    {\n      ptIds.insert(*id);\n    }\n    cellPointIds[it->GetCellId()] = ptIds;\n  }\n  it->Delete();\n\n  std::cout << \"Cells and their points\" << std::endl;\n  for (auto const& cell : cellPointIds)\n  {\n    std::cout << \"Cell Id: \" << cell.first << \" Point Ids: \";\n    for (auto id = cell.second.begin(); id != cell.second.end(); ++id)\n      if (id != std::prev(cell.second.end()))\n      {\n        std::cout << *id << \", \";\n      }\n      else\n      {\n        std::cout << *id << std::endl;\n      }\n  }\n\n  // The key is the point Id and the value is a set of corresponding cell Ids.\n  std::map<vtkIdType, std::set<vtkIdType>>\n      commonPointIds; // = cellPointIds.begin()->second;\n  for (auto const& cell : cellPointIds)\n  {\n    for (auto pointId : cell.second)\n    {\n      commonPointIds[pointId].insert(cell.first);\n    }\n  }\n\n  std::cout << \"Point Ids shared between cells\" << std::endl;\n  for (auto point = commonPointIds.begin(); point != commonPointIds.end();\n       ++point)\n  {\n    if (point->second.size() > 1)\n    {\n      std::cout << \"Point Id: \" << point->first << \" CellIds: \";\n      for (auto cellId = point->second.begin(); cellId != point->second.end();\n           ++cellId)\n      {\n        if (cellId != std::prev(point->second.end()))\n        {\n          std::cout << *cellId << \", \";\n        }\n        else\n        {\n          std::cout << *cellId << std::endl;\n        }\n      }\n    }\n  }\n\n#if defined(USE_POINT_DATA)\n  // Use the point data\n  // Map the scalar values in the image to colors with a lookup table:\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(dataSize);\n  lut->Build();\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(structuredGrid);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, dataSize - 1);\n  mapper->ScalarVisibilityOn();\n#else\n  // Use the cell data\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(numberOfCells);\n  lut->Build();\n  // Assign some specific colors in this case\n  lut->SetTableValue(0, colors->GetColor4d(\"Red\").GetData());\n  lut->SetTableValue(numberOfCells - 1, colors->GetColor4d(\"Banana\").GetData());\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(structuredGrid);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, numberOfCells - 1);\n  // mapper->ScalarVisibilityOff();\n#endif\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Add the actor to the scene\n  ren->AddActor(actor);\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  ren->GetActiveCamera()->Azimuth(60);\n  ren->GetActiveCamera()->Elevation(-45);\n  ren->GetActiveCamera()->Dolly(1.2);\n  ren->ResetCamera();\n\n  // Render and interact\n  renWin->Render();\n  renWin->SetSize(800, 800);\n  renWin->SetWindowName(\"StructuredGrid\");\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/StructuredGrid/StructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredGrid MACOSX_BUNDLE StructuredGrid.cxx )\n  target_link_libraries(StructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/StructuredGrid/StructuredGrid/#download-and-build-structuredgrid","title":"Download and Build StructuredGrid","text":"

Click here to download StructuredGrid and its CMakeLists.txt file. Once the tarball StructuredGrid.tar has been downloaded and extracted,

cd StructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/StructuredGrid/StructuredGridOutline/","title":"StructuredGridOutline","text":"

vtk-examples/Cxx/StructuredGrid/StructuredGridOutline

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/StructuredGrid/StructuredGridOutline/#description","title":"Description","text":"

Visualize the outline of a structured grid.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/StructuredGrid/StructuredGridOutline/#code","title":"Code","text":"

StructuredGridOutline.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  vtkNew<vtkPoints> points;\n  unsigned int numi = 2;\n  unsigned int numj = 3;\n  unsigned int numk = 2;\n\n  for (unsigned int k = 0; k < numk; k++)\n  {\n    for (unsigned int j = 0; j < numj; j++)\n    {\n      for (unsigned int i = 0; i < numi; i++)\n      {\n        points->InsertNextPoint(i, j, k);\n      }\n    }\n  }\n\n  // specify the dimensions of the grid\n  structuredGrid->SetDimensions(numi, numj, numk);\n  structuredGrid->SetPoints(points);\n\n  std::cout << \"There are \" << structuredGrid->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << structuredGrid->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n\n  vtkNew<vtkStructuredGridOutlineFilter> outlineFilter;\n  outlineFilter->SetInputData(structuredGrid);\n  outlineFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(outlineFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"StructuredGridOutline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/StructuredGrid/StructuredGridOutline/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredGridOutline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredGridOutline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredGridOutline MACOSX_BUNDLE StructuredGridOutline.cxx )\n  target_link_libraries(StructuredGridOutline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredGridOutline\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/StructuredGrid/StructuredGridOutline/#download-and-build-structuredgridoutline","title":"Download and Build StructuredGridOutline","text":"

Click here to download StructuredGridOutline and its CMakeLists.txt file. Once the tarball StructuredGridOutline.tar has been downloaded and extracted,

cd StructuredGridOutline/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StructuredGridOutline\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/StructuredGrid/VisualizeStructuredGrid/","title":"VisualizeStructuredGrid","text":"

vtk-examples/Cxx/StructuredGrid/VisualizeStructuredGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/StructuredGrid/VisualizeStructuredGrid/#description","title":"Description","text":"

Visualize the points of a structured grid.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/StructuredGrid/VisualizeStructuredGrid/#code","title":"Code","text":"

VisualizeStructuredGrid.cxx

#include <vtkActor.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  vtkNew<vtkPoints> points;\n  unsigned int numi = 2;\n  unsigned int numj = 3;\n  unsigned int numk = 2;\n\n  for (unsigned int k = 0; k < numk; k++)\n  {\n    for (unsigned int j = 0; j < numj; j++)\n    {\n      for (unsigned int i = 0; i < numi; i++)\n      {\n        points->InsertNextPoint(i, j, k);\n      }\n    }\n  }\n\n  // Specify the dimensions of the grid\n  structuredGrid->SetDimensions(numi, numj, numk);\n  structuredGrid->SetPoints(points);\n\n  std::cout << \"There are \" << structuredGrid->GetNumberOfPoints() << \" points.\"\n            << std::endl; // there should be 2*3*2 = 12 points\n  std::cout << \"There are \" << structuredGrid->GetNumberOfCells() << \" cells.\"\n            << std::endl; // The 12 points define the corners of 2 cubes/cells\n                          // (4 points are shared by both cubes)\n\n  vtkNew<vtkStructuredGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputData(structuredGrid);\n  geometryFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometryFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(1);\n\n  // Visualize\n\n  // Map the points to spheres\n  auto sphereActor =\n      PointToGlyph(geometryFilter->GetOutput()->GetPoints(), 0.02);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VisualizeStructuredGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
"},{"location":"Cxx/StructuredGrid/VisualizeStructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeStructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeStructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeStructuredGrid MACOSX_BUNDLE VisualizeStructuredGrid.cxx )\n  target_link_libraries(VisualizeStructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeStructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/StructuredGrid/VisualizeStructuredGrid/#download-and-build-visualizestructuredgrid","title":"Download and Build VisualizeStructuredGrid","text":"

Click here to download VisualizeStructuredGrid and its CMakeLists.txt file. Once the tarball VisualizeStructuredGrid.tar has been downloaded and extracted,

cd VisualizeStructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VisualizeStructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/StructuredGrid/VisualizeStructuredGridCells/","title":"VisualizeStructuredGridCells","text":"

vtk-examples/Cxx/StructuredGrid/VisualizeStructuredGridCells

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/StructuredGrid/VisualizeStructuredGridCells/#code","title":"Code","text":"

VisualizeStructuredGridCells.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkStructuredGrid.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  vtkNew<vtkPoints> points;\n  unsigned int numi = 3;\n  unsigned int numj = 4;\n  unsigned int numk = 5;\n\n  for (unsigned int k = 0; k < numk; k++)\n  {\n    for (unsigned int j = 0; j < numj; j++)\n    {\n      for (unsigned int i = 0; i < numi; i++)\n      {\n        points->InsertNextPoint(i, j, k);\n      }\n    }\n  }\n\n  // Specify the dimensions of the grid\n  structuredGrid->SetDimensions(numi, numj, numk);\n  structuredGrid->SetPoints(points);\n\n  std::cout << \"There are \" << structuredGrid->GetNumberOfPoints()\n            << \" points before shrinking.\" << std::endl;\n  std::cout << \"There are \" << structuredGrid->GetNumberOfCells()\n            << \" cells before shrinking.\" << std::endl;\n\n  vtkNew<vtkShrinkFilter> shrinkFilter;\n  shrinkFilter->SetInputData(structuredGrid);\n  shrinkFilter->SetShrinkFactor(.8);\n  shrinkFilter->Update();\n\n  std::cout << \"There are \" << shrinkFilter->GetOutput()->GetNumberOfPoints()\n            << \" points after shrinking.\" << std::endl;\n  std::cout << \"There are \" << shrinkFilter->GetOutput()->GetNumberOfCells()\n            << \" cells after shrinking.\" << std::endl;\n\n  // Note: there are more points after shrinking because cells no longer share\n  // points.\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrinkFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VisualizeStructuredGridCells\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(9.56681, 4.14093, 5.85709);\n  camera->SetFocalPoint(1, 1.5, 2);\n  camera->SetViewUp(-0.172781, 0.94846, -0.26565);\n  camera->SetDistance(9.7592);\n  camera->SetClippingRange(5.84116, 14.7147);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/StructuredGrid/VisualizeStructuredGridCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeStructuredGridCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeStructuredGridCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeStructuredGridCells MACOSX_BUNDLE VisualizeStructuredGridCells.cxx )\n  target_link_libraries(VisualizeStructuredGridCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeStructuredGridCells\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/StructuredGrid/VisualizeStructuredGridCells/#download-and-build-visualizestructuredgridcells","title":"Download and Build VisualizeStructuredGridCells","text":"

Click here to download VisualizeStructuredGridCells and its CMakeLists.txt file. Once the tarball VisualizeStructuredGridCells.tar has been downloaded and extracted,

cd VisualizeStructuredGridCells/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VisualizeStructuredGridCells\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid/","title":"StructuredPointsToUnstructuredGrid","text":"

vtk-examples/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid/#code","title":"Code","text":"

StructuredPointsToUnstructuredGrid.cxx

#include <vtkNew.h>\n#include <vtkStructuredPoints.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  // Create a structuredpoints\n  vtkNew<vtkStructuredPoints> structuredPoints;\n\n  // Specify the size of the image data\n  structuredPoints->SetDimensions(2, 3, 1);\n  structuredPoints->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = structuredPoints->GetDimensions();\n\n  std::cout << \"Dims: \"\n            << \" x: \" << dims[0] << \" y: \" << dims[1] << \" z: \" << dims[2]\n            << std::endl;\n\n  std::cout << \"Number of points: \" << structuredPoints->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Number of cells: \" << structuredPoints->GetNumberOfCells()\n            << std::endl;\n\n  // fill every entry of the image data with \"2.0\"\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel =\n            static_cast<double*>(structuredPoints->GetScalarPointer(x, y, z));\n        pixel[0] = 2.0;\n      }\n    }\n  }\n\n  // Copy the points from the StructuredPoints to the UnstructuredGrid\n  vtkNew<vtkPoints> points;\n\n  // retrieve the entries from the grid and print them to the screen\n  for (vtkIdType i = 0; i < structuredPoints->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    structuredPoints->GetPoint(i, p);\n\n    points->InsertNextPoint(p);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetFileName(\"output.vtu\");\n  writer->SetInputData(ug);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredPointsToUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredPointsToUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredPointsToUnstructuredGrid MACOSX_BUNDLE StructuredPointsToUnstructuredGrid.cxx )\n  target_link_libraries(StructuredPointsToUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredPointsToUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid/#download-and-build-structuredpointstounstructuredgrid","title":"Download and Build StructuredPointsToUnstructuredGrid","text":"

Click here to download StructuredPointsToUnstructuredGrid and its CMakeLists.txt file. Once the tarball StructuredPointsToUnstructuredGrid.tar has been downloaded and extracted,

cd StructuredPointsToUnstructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StructuredPointsToUnstructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/StructuredPoints/Vol/","title":"Vol","text":"

vtk-examples/Cxx/StructuredPoints/Vol

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/StructuredPoints/Vol/#description","title":"Description","text":"

Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26^3.

Info

See Figure 5-18 in Chapter 5 the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/StructuredPoints/Vol/#code","title":"Code","text":"

Vol.cxx

#include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPoints.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkStructuredPoints> vol;\n  vol->SetDimensions(26, 26, 26);\n  vol->SetOrigin(-0.5, -0.5, -0.5);\n  auto sp = 1.0 / 25.0;\n  vol->SetSpacing(sp, sp, sp);\n\n  vtkNew<vtkDoubleArray> scalars;\n  scalars->SetNumberOfComponents(1);\n  scalars->SetNumberOfTuples(26 * 26 * 26);\n  for (auto k = 0; k < 26; k++)\n  {\n    auto z = -0.5 + k * sp;\n    auto kOffset = k * 26 * 26;\n    for (auto j = 0; j < 26; j++)\n    {\n      auto y = -0.5 + j * sp;\n      auto jOffset = j * 26;\n      for (auto i = 0; i < 26; i++)\n      {\n        auto x = -0.5 + i * sp;\n        auto s = x * x + y * y + z * z - (0.4 * 0.4);\n        auto offset = i + jOffset + kOffset;\n        scalars->InsertTuple(offset, &s);\n      }\n    }\n  }\n  vol->GetPointData()->SetScalars(scalars);\n\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputData(vol);\n  contour->SetValue(0, 0.0);\n\n  vtkNew<vtkPolyDataMapper> volMapper;\n  volMapper->SetInputConnection(contour->GetOutputPort());\n  volMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> volActor;\n  volActor->SetMapper(volMapper);\n  volActor->GetProperty()->EdgeVisibilityOn();\n  volActor->GetProperty()->SetColor(colors->GetColor3d(\"Salmon\").GetData());\n  renderer->AddActor(volActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"Vol\");\n\n  // interact with data\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/StructuredPoints/Vol/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Vol)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Vol: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Vol MACOSX_BUNDLE Vol.cxx )\n  target_link_libraries(Vol PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Vol\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/StructuredPoints/Vol/#download-and-build-vol","title":"Download and Build Vol","text":"

Click here to download Vol and its CMakeLists.txt file. Once the tarball Vol.tar has been downloaded and extracted,

cd Vol/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Vol\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Texture/AnimateVectors/","title":"AnimateVectors","text":"

vtk-examples/Cxx/Texture/AnimateVectors

"},{"location":"Cxx/Texture/AnimateVectors/#description","title":"Description","text":"

Texture maps can be animated as a function of time. By choosing a texture map whose intensity varies monotonically from dark to light, and then \u201cmoving\u201d the texture along an object,the object appears to crawl in the direction of the texture map motion. We can use this technique to add apparent motion to things like hedgehogs to show vector magnitude. This example uses texture map animation to simulate vector field motion.

Cite

See B. Yamrom and K. M. Martin. Vector Field Animation with Texture Maps. IEEE Computer Graphics and Applications. 15(2):22\u201324, 1995 for background.

Info

See Figure 7-3 in Chapter 7 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Texture/AnimateVectors/#code","title":"Code","text":"

AnimateVectors.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkTexture.h>\n#include <vtkThresholdPoints.h>\n\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" carotid.vtk vecAnim1.vtk ...\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // read data\n  //\n  // create pipeline\n  //\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkThresholdPoints> threshold;\n  threshold->SetInputConnection(reader->GetOutputPort());\n  threshold->ThresholdByUpper(200);\n\n  vtkNew<vtkLineSource> line;\n  line->SetResolution(1);\n\n  vtkNew<vtkGlyph3D> lines;\n  lines->SetInputConnection(threshold->GetOutputPort());\n  lines->SetSourceConnection(line->GetOutputPort());\n  lines->SetScaleFactor(0.005);\n  lines->SetScaleModeToScaleByScalar();\n  lines->Update();\n\n  vtkNew<vtkPolyDataMapper> vectorMapper;\n  vectorMapper->SetInputConnection(lines->GetOutputPort());\n  vectorMapper->SetScalarRange(lines->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> vectorActor;\n  vectorActor->SetMapper(vectorMapper);\n  vectorActor->GetProperty()->SetOpacity(0.99);\n  vectorActor->GetProperty()->SetLineWidth(1.5);\n\n  // outline\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  //  texture maps\n  std::vector<vtkSmartPointer<vtkTexture>> textureMaps;\n  for (int i = 2; i < argc; ++i)\n  {\n    vtkNew<vtkStructuredPointsReader> tmap;\n    tmap->SetFileName(argv[i]);\n\n    vtkNew<vtkTexture> texture;\n    texture->SetInputConnection(tmap->GetOutputPort());\n    texture->InterpolateOff();\n    texture->RepeatOff();\n    textureMaps.push_back(texture);\n  }\n  vectorActor->SetTexture(textureMaps[0]);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer->AddActor(vectorActor);\n  renderer->AddActor(outlineActor);\n\n  vtkNew<vtkCamera> cam1;\n  cam1->SetClippingRange(17.4043, 870.216);\n  cam1->SetFocalPoint(136.71, 104.025, 23);\n  cam1->SetPosition(204.747, 258.939, 63.7925);\n  cam1->SetViewUp(-0.102647, -0.210897, 0.972104);\n  cam1->Zoom(1.2);\n  renderer->SetActiveCamera(cam1);\n\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"AnimateVectors\");\n\n  // go into loop\n  for (int j = 0; j < 100; ++j)\n  {\n    for (size_t i = 0; i < textureMaps.size(); ++i)\n    {\n      vectorActor->SetTexture(textureMaps[i]);\n      renderWindow->Render();\n    }\n  }\n  interactor->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Texture/AnimateVectors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AnimateVectors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AnimateVectors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AnimateVectors MACOSX_BUNDLE AnimateVectors.cxx )\n  target_link_libraries(AnimateVectors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AnimateVectors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Texture/AnimateVectors/#download-and-build-animatevectors","title":"Download and Build AnimateVectors","text":"

Click here to download AnimateVectors and its CMakeLists.txt file. Once the tarball AnimateVectors.tar has been downloaded and extracted,

cd AnimateVectors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AnimateVectors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Texture/ProjectedTexture/","title":"ProjectedTexture","text":"

vtk-examples/Cxx/Texture/ProjectedTexture

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Texture/ProjectedTexture/#description","title":"Description","text":"

vtkProjectedTexture is tricky to set up. Picking the right parameters will take some iterations. The example uses vtkFrustumSource to help understand the parameters.

Cite

This example was inspired by Thomas Kilgus, German Cancer Research Center (DKFZ), Div. Medical and Biological Informatics, Junior group: Computer-assisted Interventions (E131), Im Neuenheimer Feld 280, 69120 Heidelberg, Germany

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Texture/ProjectedTexture/#code","title":"Code","text":"

ProjectedTexture.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFrustumSource.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProjectedTexture.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTexture.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" polydata texture e.g. fran_cut.vtk fran_cut.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> textureFile;\n  textureFile.TakeReference(readerFactory->CreateImageReader2(argv[2]));\n  textureFile->SetFileName(argv[2]);\n  textureFile->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  double center[3];\n  polyData->GetCenter(center);\n  std::cout << \"Center: \" << center[0] << \", \" << center[1] << \", \" << center[2]\n            << std::endl;\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(center[0], center[1] + .0375, center[2] + .5);\n  camera->SetFocalPoint(center[0], center[1] + .0375, center[2]);\n  camera->Azimuth(-45);\n  camera->Roll(-90);\n  camera->SetClippingRange(.5, .6);\n  double planesArray[24];\n\n  camera->GetFrustumPlanes(1.0, planesArray);\n\n  // Settings for vtkProjectedTexture\n\n  double aspect[3];\n  aspect[1] = 1.0;\n  aspect[2] = 1.0;\n  aspect[0] = 1.0;\n  //(1.0/ (vtkMath::RadiansFromDegrees(std::tan(camera->GetViewAngle()))))\n  /// 2.0;\n  std::cout << \"Aspect: \" << aspect[0] << \", \" << aspect[1] << \", \" << aspect[2]\n            << std::endl;\n\n  vtkNew<vtkProjectedTexture> projectedTexture;\n\n  projectedTexture->SetAspectRatio(aspect);\n  projectedTexture->SetPosition(camera->GetPosition());\n  projectedTexture->SetFocalPoint(camera->GetFocalPoint());\n  projectedTexture->SetUp(camera->GetViewUp()[0], camera->GetViewUp()[1],\n                          camera->GetViewUp()[2]);\n\n  projectedTexture->SetInputData(\n      polyData); // This can be the same as the one to project on.\n  projectedTexture->Update();\n\n  // Map Texture on Surface\n  polyData->GetPointData()->SetTCoords(\n      projectedTexture->GetOutput()->GetPointData()->GetTCoords());\n\n  vtkNew<vtkTexture> texture;\n  texture->SetInputData(textureFile->GetOutput());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetTexture(texture);\n\n  vtkNew<vtkPlanes> planes;\n  planes->SetFrustumPlanes(planesArray);\n\n  vtkNew<vtkFrustumSource> frustumSource;\n  frustumSource->ShowLinesOff();\n  frustumSource->SetPlanes(planes);\n  frustumSource->Update();\n\n  vtkNew<vtkPolyDataMapper> frustumMapper;\n  frustumMapper->SetInputConnection(frustumSource->GetOutputPort());\n\n  vtkNew<vtkActor> frustumActor;\n  frustumActor->SetMapper(frustumMapper);\n  frustumActor->GetProperty()->EdgeVisibilityOn();\n  frustumActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  frustumActor->GetProperty()->SetOpacity(.5);\n  frustumActor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->AddActor(frustumActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->SetActiveCamera(camera);\n  camera->Azimuth(180);\n  camera->Roll(-90);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ProjectedTexture\");\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Texture/ProjectedTexture/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProjectedTexture)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOImage\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProjectedTexture: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProjectedTexture MACOSX_BUNDLE ProjectedTexture.cxx )\n  target_link_libraries(ProjectedTexture PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProjectedTexture\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Texture/ProjectedTexture/#download-and-build-projectedtexture","title":"Download and Build ProjectedTexture","text":"

Click here to download ProjectedTexture and its CMakeLists.txt file. Once the tarball ProjectedTexture.tar has been downloaded and extracted,

cd ProjectedTexture/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ProjectedTexture\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Texture/TextureCutQuadric/","title":"TextureCutQuadric","text":"

vtk-examples/Cxx/Texture/TextureCutQuadric

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Texture/TextureCutQuadric/#description","title":"Description","text":"

Clip geometry using a 2D texture map and two implicit functions. The technique is described in : Geometric Clipping Using Boolean Textures.

Info

See Figure 9-45b in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Texture/TextureCutQuadric/#code","title":"Code","text":"

TextureCutQuadric.cxx

#include <vtkActor.h>\n#include <vtkBooleanTexture.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImplicitTextureCoords.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTexture.h>\n\nnamespace {\n\ndouble positions[][3]{{-4, 4, 0},  {-2, 4, 0},  {0, 4, 0},  {2, 4, 0},\n                      {-4, 2, 0},  {-2, 2, 0},  {0, 2, 0},  {2, 2, 0},\n                      {-4, 0, 0},  {-2, 0, 0},  {0, 0, 0},  {2, 0, 0},\n                      {-4, -2, 0}, {-2, -2, 0}, {0, -2, 0}, {2, -2, 0}};\n\nunsigned char solid[]{255, 255};\nunsigned char clear[]{255, 0};\nunsigned char edge[]{0, 255};\n\nvtkSmartPointer<vtkBooleanTexture> MakeBooleanTexture(int, int, int);\n} // namespace\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renWin;\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkRenderer> aren;\n\n  // define two elliptical cylinders\n  vtkNew<vtkQuadric> quadric1;\n  quadric1->SetCoefficients(1, 2, 0, 0, 0, 0, 0, 0, 0, -.07);\n\n  vtkNew<vtkQuadric> quadric2;\n  quadric2->SetCoefficients(2, 1, 0, 0, 0, 0, 0, 0, 0, -.07);\n\n  // create a sphere for all to use\n  vtkNew<vtkSphereSource> aSphere;\n  aSphere->SetPhiResolution(21);\n  aSphere->SetThetaResolution(21);\n\n  // create texture coordinates for all\n  vtkNew<vtkImplicitTextureCoords> tcoords;\n  tcoords->SetInputConnection(aSphere->GetOutputPort());\n  tcoords->SetRFunction(quadric1);\n  tcoords->SetSFunction(quadric2);\n\n  vtkNew<vtkDataSetMapper> aMapper;\n  aMapper->SetInputConnection(tcoords->GetOutputPort());\n\n  // create a mapper, sphere and texture map for each case\n  for (int i = 0; i < 16; i++)\n  {\n    auto aBoolean = MakeBooleanTexture(i, 64, 0);\n\n    vtkNew<vtkTexture> aTexture2;\n    aTexture2->SetInputConnection(aBoolean->GetOutputPort());\n    aTexture2->InterpolateOff();\n    aTexture2->RepeatOff();\n\n    vtkNew<vtkActor> anActor2;\n\n    anActor2->SetMapper(aMapper);\n    anActor2->SetTexture(aTexture2);\n    anActor2->SetPosition(&positions[i][0]);\n    anActor2->SetScale(2.0, 2.0, 2.0);\n    anActor2->GetProperty()->SetColor(\n        colors->GetColor3d(\"MistyRose\").GetData());\n\n    aren->AddActor(anActor2);\n  }\n\n  aren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(500, 500);\n  renWin->AddRenderer(aren);\n  renWin->SetWindowName(\"TextureCutQuadric\");\n\n  // interact with data\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkBooleanTexture>\nMakeBooleanTexture(int caseNumber, int resolution, int thickness)\n{\n  vtkNew<vtkBooleanTexture> booleanTexture;\n\n  booleanTexture->SetXSize(resolution);\n  booleanTexture->SetYSize(resolution);\n  booleanTexture->SetThickness(thickness);\n\n  switch (caseNumber)\n  {\n  case 0:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(solid);\n    booleanTexture->SetOnIn(solid);\n    booleanTexture->SetOnOut(solid);\n    booleanTexture->SetInOn(solid);\n    booleanTexture->SetOutOn(solid);\n    break;\n  case 1: /* cut inside 1 */\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(solid);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(solid);\n    break;\n  case 2: /* cut outside 1 */\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(solid);\n    booleanTexture->SetInOn(solid);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 3: /* cut all 1 */\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(clear);\n    booleanTexture->SetOnOut(solid);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 4:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(solid);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(solid);\n    break;\n  case 5:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(clear);\n    booleanTexture->SetOutOn(solid);\n    break;\n  case 6:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 7:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(clear);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(clear);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 8:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(solid);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(solid);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 9:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 10:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(solid);\n    booleanTexture->SetOutOn(clear);\n    break;\n  case 11:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(clear);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(clear);\n    break;\n  case 12:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(solid);\n    booleanTexture->SetOnOut(clear);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 13:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(clear);\n    booleanTexture->SetInOn(clear);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 14:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(clear);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(clear);\n    break;\n  case 15:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(clear);\n    booleanTexture->SetOnIn(clear);\n    booleanTexture->SetOnOut(clear);\n    booleanTexture->SetInOn(clear);\n    booleanTexture->SetOutOn(clear);\n    break;\n  }\n\n  return booleanTexture;\n}\n} // namespace\n
"},{"location":"Cxx/Texture/TextureCutQuadric/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureCutQuadric)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  FiltersTexture\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureCutQuadric: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureCutQuadric MACOSX_BUNDLE TextureCutQuadric.cxx )\n  target_link_libraries(TextureCutQuadric PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureCutQuadric\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Texture/TextureCutQuadric/#download-and-build-texturecutquadric","title":"Download and Build TextureCutQuadric","text":"

Click here to download TextureCutQuadric and its CMakeLists.txt file. Once the tarball TextureCutQuadric.tar has been downloaded and extracted,

cd TextureCutQuadric/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TextureCutQuadric\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Texture/TextureCutSphere/","title":"TextureCutSphere","text":"

vtk-examples/Cxx/Texture/TextureCutSphere

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Texture/TextureCutSphere/#description","title":"Description","text":"

Sphere cut with transparent texture.

Info

See Figure 9-43b in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Texture/TextureCutSphere/#code","title":"Code","text":"

TextureCutSphere.cxx

//\n// Cut an outer sphere to reveal an inner sphere.\n//\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkImplicitTextureCoords.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkTexture.h>\n\nint main(int /* argc */, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Hidden sphere.\n  vtkNew<vtkSphereSource> sphere1;\n  sphere1->SetRadius(0.5);\n\n  vtkNew<vtkPolyDataMapper> innerMapper;\n  innerMapper->SetInputConnection(sphere1->GetOutputPort());\n\n  vtkNew<vtkActor> innerSphere;\n  innerSphere->SetMapper(innerMapper);\n  innerSphere->GetProperty()->SetColor(\n      colors->GetColor3d(\"BlanchedAlmond\").GetData());\n\n  // Sphere to texture.\n  vtkNew<vtkSphereSource> sphere2;\n  sphere2->SetRadius(1.0);\n  sphere2->SetPhiResolution(21);\n  sphere2->SetThetaResolution(21);\n\n  vtkNew<vtkPlanes> planes;\n\n  double pts[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(2);\n  points->SetPoint(0, pts);\n  points->SetPoint(1, pts + 3);\n\n  double nrms[6] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0};\n  vtkNew<vtkDoubleArray> normals;\n  normals->SetNumberOfComponents(3);\n  normals->SetNumberOfTuples(2);\n  normals->SetTuple(0, nrms);\n  normals->SetTuple(1, nrms + 3);\n\n  planes->SetPoints(points);\n  planes->SetNormals(normals);\n\n  vtkNew<vtkImplicitTextureCoords> tcoords;\n  tcoords->SetInputConnection(sphere2->GetOutputPort());\n  tcoords->SetRFunction(planes);\n\n  vtkNew<vtkDataSetMapper> outerMapper;\n  outerMapper->SetInputConnection(tcoords->GetOutputPort());\n\n  vtkNew<vtkStructuredPointsReader> tmap;\n  tmap->SetFileName(argv[1]);\n\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(tmap->GetOutputPort());\n  texture->InterpolateOff();\n  texture->RepeatOff();\n\n  vtkNew<vtkActor> outerSphere;\n  outerSphere->SetMapper(outerMapper);\n  outerSphere->SetTexture(texture);\n  outerSphere->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightSalmon\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkRenderer> aren;\n  iren->SetRenderWindow(renWin);\n  renWin->AddRenderer(aren);\n\n  aren->AddActor(innerSphere);\n  aren->AddActor(outerSphere);\n  aren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  aren->GetActiveCamera()->Azimuth(-30);\n  aren->GetActiveCamera()->Elevation(-30);\n  aren->ResetCamera();\n\n  renWin->SetSize(500, 500);\n  renWin->SetWindowName(\"TextureCutSphere\");\n\n  // Interact with the data.\n  renWin->Render();\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Texture/TextureCutSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureCutSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  FiltersTexture\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureCutSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureCutSphere MACOSX_BUNDLE TextureCutSphere.cxx )\n  target_link_libraries(TextureCutSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureCutSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Texture/TextureCutSphere/#download-and-build-texturecutsphere","title":"Download and Build TextureCutSphere","text":"

Click here to download TextureCutSphere and its CMakeLists.txt file. Once the tarball TextureCutSphere.tar has been downloaded and extracted,

cd TextureCutSphere/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TextureCutSphere\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Texture/TexturePlane/","title":"TexturePlane","text":"

vtk-examples/Cxx/Texture/TexturePlane

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Texture/TexturePlane/#description","title":"Description","text":"

Simple example of texture mapping.

Info

See Figure 7-33 in Chapter 7 in the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Texture/TexturePlane/#code","title":"Code","text":"

TexturePlane.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n//\n// This simple example shows how to do basic texture mapping.\n//\n//\n// Load in the texture map. A texture is any unsigned char image. If it\n// is not of this type, you will have to map it through a lookup table\n// or by using vtkImageShiftScale.\n//\nint main(int argc, char* argv[])\n{\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> textureFile;\n  textureFile.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  textureFile->SetFileName(argv[1]);\n  textureFile->Update();\n\n  vtkNew<vtkTexture> atext;\n  atext->SetInputConnection(textureFile->GetOutputPort());\n  atext->InterpolateOn();\n\n  // Create a plane source and actor. The vtkPlanesSource generates\n  // texture coordinates.\n  //\n  vtkNew<vtkPlaneSource> plane;\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(plane->GetOutputPort());\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n  planeActor->SetTexture(atext);\n\n  // Create the RenderWindow, Renderer and both Actors\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(planeActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"TexturePlane\");\n\n  // render the image\n  renWin->Render();\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Roll(-20);\n  renderer->ResetCameraClippingRange();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Texture/TexturePlane/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TexturePlane)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TexturePlane: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TexturePlane MACOSX_BUNDLE TexturePlane.cxx )\n  target_link_libraries(TexturePlane PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TexturePlane\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Texture/TexturePlane/#download-and-build-textureplane","title":"Download and Build TexturePlane","text":"

Click here to download TexturePlane and its CMakeLists.txt file. Once the tarball TexturePlane.tar has been downloaded and extracted,

cd TexturePlane/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TexturePlane\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Texture/TextureThreshold/","title":"TextureThreshold","text":"

vtk-examples/Cxx/Texture/TextureThreshold

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Texture/TextureThreshold/#description","title":"Description","text":"

Demonstrating texture thresholding applied to scalar data from a simulation of fluid flow.

There are three planes cutting the blunt fin with different thresholds set. From the left, the scalar threshold is set so that:

  1. Only data with a scalar value greater than or equal to 1.5 is shown.
  2. Only data with a scalar value less than or equal to 1.5 is shown.
  3. Only data with a scalar value between 1.5 and 1.8 inclusive is shown.

Info

See Figure 9-43a in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Texture/TextureThreshold/#code","title":"Code","text":"

TextureThreshold.cxx

/*\nModified from VTK/Filters/Texture/Testing/Python/textureThreshold.py.\n\nDemonstrating texture thresholding applied to scalar data from a simulation of\nfluid flow->\n    There are three planes cutting the blunt fin with different thresholds set.\n     From the left, the scalar threshold is set so that:\n       1) Only data with a scalar value greater than or equal to 1.5 is shown.\n       2) Only data with a scalar value less than or equal to 1.5 is shown.\n*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkTexture.h>\n#include <vtkThresholdTextureCoords.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 4)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename1 filename2 filename3\"\n              << std::endl;\n    std::cout << \"where: filename1 is bluntfinxyz.bin,\\n\"\n              << \"       filename2 is bluntfinq.bin and\\n\"\n              << \"       filename3 is texThres2.vtk.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string dataFn1 = argv[1];\n  std::string dataFn2 = argv[2];\n  std::string textureFn = argv[3];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the data.\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(dataFn1.c_str());\n  pl3d->SetQFileName(dataFn2.c_str());\n  pl3d->SetScalarFunctionNumber(100); // Density\n  pl3d->SetVectorFunctionNumber(202); // Momentum\n  pl3d->Update();\n\n  vtkStructuredGrid* output =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // Make the wall (floor).\n  vtkNew<vtkStructuredGridGeometryFilter> wall;\n  wall->SetInputData(output);\n  wall->SetExtent(0, 100, 0, 0, 0, 100);\n  vtkNew<vtkPolyDataMapper> wallMap;\n  wallMap->SetInputConnection(wall->GetOutputPort());\n  wallMap->ScalarVisibilityOff();\n  vtkNew<vtkActor> wallActor;\n  wallActor->SetMapper(wallMap);\n  wallActor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // Make the fin (rear wall).\n  vtkNew<vtkStructuredGridGeometryFilter> fin;\n  fin->SetInputData(output);\n  fin->SetExtent(0, 100, 0, 100, 0, 0);\n  vtkNew<vtkPolyDataMapper> finMap;\n  finMap->SetInputConnection(fin->GetOutputPort());\n  finMap->ScalarVisibilityOff();\n  vtkNew<vtkActor> finActor;\n  finActor->SetMapper(finMap);\n  finActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Get the texture.\n  vtkNew<vtkStructuredPointsReader> tmap;\n  tmap->SetFileName(textureFn.c_str());\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(tmap->GetOutputPort());\n  texture->InterpolateOff();\n  texture->RepeatOff();\n\n  // Create the rendering window, renderer, and interactive renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Make the planes to threshold and texture.\n  std::vector<vtkSmartPointer<vtkStructuredGridGeometryFilter>> plane;\n  std::vector<vtkSmartPointer<vtkThresholdTextureCoords>> thresh;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> planeMap;\n  std::vector<vtkSmartPointer<vtkActor>> planeActor;\n  // Define the extents of planes that we will use.\n  std::vector<std::array<int, 6>> planeExtents{{10, 10, 0, 100, 0, 100},\n                                               {30, 30, 0, 100, 0, 100},\n                                               {35, 35, 0, 100, 0, 100}};\n  // Now set up the pipeline.\n  for (unsigned int i = 0; i < planeExtents.size(); ++i)\n  {\n    plane.push_back(vtkSmartPointer<vtkStructuredGridGeometryFilter>::New());\n    plane[i]->SetInputData(output);\n    plane[i]->SetExtent(planeExtents[i].data());\n    thresh.push_back(vtkSmartPointer<vtkThresholdTextureCoords>::New());\n    thresh[i]->SetInputConnection(plane[i]->GetOutputPort());\n    thresh[i]->SetInputConnection(plane[i]->GetOutputPort());\n    // If you want an image similar to Fig 9-43(a) in the VTK textbook, set\n    // thresh[i]->ThresholdByUpper(1.5); for all planes.\n    switch (i)\n    {\n    case 0:\n    default:\n      thresh[i]->ThresholdByUpper(1.5);\n      break;\n    case 1:\n      thresh[i]->ThresholdByLower(1.5);\n      break;\n    case 2:\n      thresh[i]->ThresholdBetween(1.5, 1.8);\n      break;\n    }\n    planeMap.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    planeMap[i]->SetInputConnection(thresh[i]->GetOutputPort());\n    planeMap[i]->SetScalarRange(output->GetScalarRange());\n    planeActor.push_back(vtkSmartPointer<vtkActor>::New());\n    planeActor[i]->SetMapper(planeMap[i]);\n    planeActor[i]->SetTexture(texture);\n    // The slight transparency gives a nice effect.\n    planeActor[i]->GetProperty()->SetOpacity(0.999);\n    ren->AddActor(planeActor[i]);\n  }\n  // Get an outline of the data set for context.\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(output);\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the remaining actors to the renderer, set the background and size.\n  ren->AddActor(outlineActor);\n  ren->AddActor(wallActor);\n  ren->AddActor(finActor);\n  ren->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"TextureThreshold\");\n\n  vtkNew<vtkCamera> cam;\n  cam->SetClippingRange(1.51176, 75.5879);\n  cam->SetFocalPoint(2.33749, 2.96739, 3.61023);\n  cam->SetPosition(10.8787, 5.27346, 15.8687);\n  cam->SetViewAngle(30);\n  cam->SetViewUp(-0.0610856, 0.987798, -0.143262);\n  ren->SetActiveCamera(cam);\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Texture/TextureThreshold/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureThreshold)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  FiltersTexture\n  IOLegacy\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureThreshold: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureThreshold MACOSX_BUNDLE TextureThreshold.cxx )\n  target_link_libraries(TextureThreshold PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureThreshold\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Texture/TextureThreshold/#download-and-build-texturethreshold","title":"Download and Build TextureThreshold","text":"

Click here to download TextureThreshold and its CMakeLists.txt file. Once the tarball TextureThreshold.tar has been downloaded and extracted,

cd TextureThreshold/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TextureThreshold\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Texture/TexturedSphere/","title":"TexturedSphere","text":"

vtk-examples/Cxx/Texture/TexturedSphere

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Texture/TexturedSphere/#code","title":"Code","text":"

TexturedSphere.cxx

#include <vtkActor.h>\n#include <vtkImageReader.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTexture.h>\n#include <vtkTextureMapToSphere.h>\n#include <vtkTexturedSphereSource.h>\n#include <vtkTransformTextureCoords.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" texture(.png/.ppm) e.g. earth.ppm\"\n              << \" [translate]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  double translate[3];\n  if (argc > 2)\n  {\n    translate[0] = atof(argv[2]);\n  }\n  else\n  {\n    translate[0] = 0.0;\n  }\n  translate[1] = 0.0;\n  translate[2] = 0.0;\n  std::cout << translate[0] << \", \" << translate[1] << \", \" << translate[2]\n            << \"\\n\";\n  // Create a sphere with texture coordinates\n  vtkNew<vtkTexturedSphereSource> source;\n  source->SetThetaResolution(100);\n  source->SetPhiResolution(100);\n\n  // Read texture file\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imageReader;\n  imageReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  imageReader->SetFileName(argv[1]);\n\n  // Create texture\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(imageReader->GetOutputPort());\n\n  vtkNew<vtkTransformTextureCoords> transformTexture;\n  transformTexture->SetInputConnection(source->GetOutputPort());\n  transformTexture->SetPosition(translate);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(transformTexture->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetTexture(texture);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TexturedSphere\");\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Texture/TexturedSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TexturedSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  FiltersTexture\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TexturedSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TexturedSphere MACOSX_BUNDLE TexturedSphere.cxx )\n  target_link_libraries(TexturedSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TexturedSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Texture/TexturedSphere/#download-and-build-texturedsphere","title":"Download and Build TexturedSphere","text":"

Click here to download TexturedSphere and its CMakeLists.txt file. Once the tarball TexturedSphere.tar has been downloaded and extracted,

cd TexturedSphere/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TexturedSphere\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Tutorial/Tutorial_Step1/","title":"Tutorial Step1","text":"

vtk-examples/Cxx/Tutorial/Tutorial_Step1

"},{"location":"Cxx/Tutorial/Tutorial_Step1/#description","title":"Description","text":"

This example creates a polygonal model of a cone, and then renders it to the screen. It will rotate the cone 360 degrees and then exit. The basic setup of source -> mapper -> actor -> renderer -> renderwindow is typical of most VTK programs.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Tutorial/Tutorial_Step1/#code","title":"Code","text":"

Tutorial_Step1.cxx

/*=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  //\n  // Next we create an instance of vtkNamedColors and we will use\n  // this to select colors for the object and background.\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Now we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the cone. The actor orchestrates rendering\n  // of the mapper's graphics primitives. An actor also refers to properties\n  // via a vtkProperty instance, and includes an internal transformation\n  // matrix. We set this actor's mapper to be coneMapper which we created\n  // above.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  //\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the background\n  // color here.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Tutorial_Step1\");\n\n  //\n  // Now we loop over 360 degrees and render the cone each time.\n  //\n  for (int i = 0; i < 360; ++i)\n  {\n    // Render the image\n    renWin->Render();\n    // Rotate the active camera by one degree.\n    ren1->GetActiveCamera()->Azimuth(1);\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Tutorial/Tutorial_Step1/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step1 MACOSX_BUNDLE Tutorial_Step1.cxx )\n  target_link_libraries(Tutorial_Step1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step1\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Tutorial/Tutorial_Step1/#download-and-build-tutorial_step1","title":"Download and Build Tutorial_Step1","text":"

Click here to download Tutorial_Step1 and its CMakeLists.txt file. Once the tarball Tutorial_Step1.tar has been downloaded and extracted,

cd Tutorial_Step1/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Tutorial_Step1\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Tutorial/Tutorial_Step2/","title":"Tutorial Step2","text":"

vtk-examples/Cxx/Tutorial/Tutorial_Step2

"},{"location":"Cxx/Tutorial/Tutorial_Step2/#description","title":"Description","text":"

This example shows how to add an observer to a C++ program. It extends the Tutorial_Step1 example (see that example for information on the basic setup).

VTK uses a command/observer design pattern. That is, observers watch for particular events that any vtkObject (or subclass) may invoke on itself. For example, the vtkRenderer invokes a \"StartEvent\" as it begins to render. Here we add an observer that invokes a command when this event is observed.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Tutorial/Tutorial_Step2/#code","title":"Code","text":"

Tutorial_Step2.cxx

/*=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n\n//\n// We put the callback in an anonymous namespace, i.e. a namespace with\n// no name. This anonymous namespace is only accessible within the file\n// that you have created it in. So it is a good way of declaring unique\n// identifiers and avoiding making global static variables.\n//\nnamespace {\n// Callback for the interaction.\nclass vtkMyCallback : public vtkCommand\n{\npublic:\n  static vtkMyCallback* New()\n  {\n    return new vtkMyCallback;\n  }\n  void Execute(vtkObject* caller, unsigned long, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto renderer = reinterpret_cast<vtkRenderer*>(caller);\n    std::cout << renderer->GetActiveCamera()->GetPosition()[0] << \" \"\n              << renderer->GetActiveCamera()->GetPosition()[1] << \" \"\n              << renderer->GetActiveCamera()->GetPosition()[2] << std::endl;\n  }\n  vtkMyCallback() = default;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // The pipeline creation is documented in Tutorial_Step1.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  ren1->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Tutorial_Step2\");\n\n  // Here is where we setup the observer.\n  vtkNew<vtkMyCallback> mo1;\n  ren1->AddObserver(vtkCommand::StartEvent, mo1);\n\n  //\n  // Now we loop over 360 degrees and render the cone each time.\n  //\n  for (int i = 0; i < 360; ++i)\n  {\n    // Render the image.\n    renWin->Render();\n    // Rotate the active camera by one degree.\n    ren1->GetActiveCamera()->Azimuth(1);\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Tutorial/Tutorial_Step2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step2 MACOSX_BUNDLE Tutorial_Step2.cxx )\n  target_link_libraries(Tutorial_Step2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Tutorial/Tutorial_Step2/#download-and-build-tutorial_step2","title":"Download and Build Tutorial_Step2","text":"

Click here to download Tutorial_Step2 and its CMakeLists.txt file. Once the tarball Tutorial_Step2.tar has been downloaded and extracted,

cd Tutorial_Step2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Tutorial_Step2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Tutorial/Tutorial_Step3/","title":"Tutorial Step3","text":"

vtk-examples/Cxx/Tutorial/Tutorial_Step3

"},{"location":"Cxx/Tutorial/Tutorial_Step3/#description","title":"Description","text":"

This example demonstrates how to use multiple renderers within a render window.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Tutorial/Tutorial_Step3/#code","title":"Code","text":"

Tutorial_Step3.cxx

/*=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Next we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the cone. The actor orchestrates rendering\n  // of the mapper's graphics primitives. An actor also refers to properties\n  // via a vtkProperty instance, and includes an internal transformation\n  // matrix. We set this actor's mapper to be coneMapper which we created\n  // above.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  //\n  // Create two renderers and assign actors to them. A renderer renders into\n  // a viewport within the vtkRenderWindow. It is part or all of a window on\n  // the screen and it is responsible for drawing the actors it has.  We also\n  // set the background color here. In this example we are adding the same\n  // actor to two different renderers; it is okay to add different actors to\n  // different renderers as well.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  ren1->SetViewport(0.0, 0.0, 0.5, 1.0);\n\n  vtkNew<vtkRenderer> ren2;\n  ren2->AddActor(coneActor);\n  ren2->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n  ren2->SetViewport(0.5, 0.0, 1.0, 1.0);\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->AddRenderer(ren2);\n  renWin->SetSize(600, 300);\n  renWin->SetWindowName(\"Tutorial_Step3\");\n\n  //\n  // Make one view 90 degrees from other.\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(90);\n\n  //\n  // Now we loop over 360 degrees and render the cones each time.\n  //\n  for (int i = 0; i < 360; ++i)\n  {\n    // render the image\n    renWin->Render();\n    // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth(1);\n    ren2->GetActiveCamera()->Azimuth(1);\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Tutorial/Tutorial_Step3/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step3)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step3: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step3 MACOSX_BUNDLE Tutorial_Step3.cxx )\n  target_link_libraries(Tutorial_Step3 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step3\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Tutorial/Tutorial_Step3/#download-and-build-tutorial_step3","title":"Download and Build Tutorial_Step3","text":"

Click here to download Tutorial_Step3 and its CMakeLists.txt file. Once the tarball Tutorial_Step3.tar has been downloaded and extracted,

cd Tutorial_Step3/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Tutorial_Step3\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Tutorial/Tutorial_Step4/","title":"Tutorial Step4","text":"

vtk-examples/Cxx/Tutorial/Tutorial_Step4

"},{"location":"Cxx/Tutorial/Tutorial_Step4/#description","title":"Description","text":"

This example demonstrates the creation of multiple actors and the manipulation of their properties and transformations.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Tutorial/Tutorial_Step4/#code","title":"Code","text":"

Tutorial_Step4.cxx

/*=========================================================================\n\n  Program:   Visualization Toolkit\n  Module:    Cone4.cxx\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Next we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the first cone. The actor's properties are\n  // modified to give it different surface properties. By default, an actor\n  // is create with a property so the GetProperty() method can be used.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(0.2, 0.63, 0.79);\n  coneActor->GetProperty()->SetDiffuse(0.7);\n  coneActor->GetProperty()->SetSpecular(0.4);\n  coneActor->GetProperty()->SetSpecularPower(20);\n\n  //\n  // Create a property and directly manipulate it. Assign it to the\n  // second actor.\n  //\n  vtkNew<vtkProperty> property;\n  property->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  property->SetDiffuse(0.7);\n  property->SetSpecular(0.4);\n  property->SetSpecularPower(20);\n\n  //\n  // Create a second actor and a property. The property is directly\n  // manipulated and then assigned to the actor. In this way, a single\n  // property can be shared among many actors. Note also that we use the\n  // same mapper as the first actor did. This way we avoid duplicating\n  // geometry, which may save lots of memory if the geometry is large.\n  vtkNew<vtkActor> coneActor2;\n  coneActor2->SetMapper(coneMapper);\n  coneActor2->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightSeaGreen\").GetData());\n  coneActor2->SetProperty(property);\n  coneActor2->SetPosition(0, 2, 0);\n\n  //\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the background\n  // color here.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->AddActor(coneActor2);\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Tutorial_Step4\");\n\n  //\n  // Now we loop over 360 degrees and render the cones each time.\n  //\n  for (int i = 0; i < 360; ++i)\n  {\n    // render the image\n    renWin->Render();\n    // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth(1);\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Tutorial/Tutorial_Step4/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step4)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step4: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step4 MACOSX_BUNDLE Tutorial_Step4.cxx )\n  target_link_libraries(Tutorial_Step4 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step4\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Tutorial/Tutorial_Step4/#download-and-build-tutorial_step4","title":"Download and Build Tutorial_Step4","text":"

Click here to download Tutorial_Step4 and its CMakeLists.txt file. Once the tarball Tutorial_Step4.tar has been downloaded and extracted,

cd Tutorial_Step4/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Tutorial_Step4\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Tutorial/Tutorial_Step5/","title":"Tutorial Step5","text":"

vtk-examples/Cxx/Tutorial/Tutorial_Step5

"},{"location":"Cxx/Tutorial/Tutorial_Step5/#description","title":"Description","text":"

This example introduces the concepts of interaction into the Python environment. A different interaction style (than the default) is defined.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Tutorial/Tutorial_Step5/#code","title":"Code","text":"

Tutorial_Step5.cxx

/*=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Next we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the cone. The actor orchestrates rendering\n  // of the mapper's graphics primitives. An actor also refers to properties\n  // via a vtkProperty instance, and includes an internal transformation\n  // matrix. We set this actor's mapper to be coneMapper which we created\n  // above.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Bisque\").GetData());\n\n  //\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the background\n  // color here.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Tutorial_Step5\");\n\n  //\n  // The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n  // mouse) in the vtkRenderWindow. These events are translated into\n  // event invocations that VTK understands (see VTK/Common/vtkCommand.h\n  // for all events that VTK processes). Then observers of these VTK\n  // events can process them as appropriate.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  //\n  // By default the vtkRenderWindowInteractor instantiates an instance\n  // of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n  // it observes into operations on the camera, actors, and/or properties\n  // in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n  // Here we specify a particular interactor style.\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  //\n  // Unlike the previous scripts where we performed some operations and then\n  // exited, here we leave an event loop running. The user can use the mouse\n  // and keyboard to perform the operations on the scene according to the\n  // current interaction style. When the user presses the \"e\" key, by default\n  // an ExitEvent is invoked by the vtkRenderWindowInteractor which is caught\n  // and drops out of the event loop (triggered by the Start() method that\n  // follows.\n  //\n  iren->Initialize();\n  iren->Start();\n\n  //\n  // Final note: recall that observers can watch for particular events and\n  // take appropriate action. Pressing \"u\" in the render window causes the\n  // vtkRenderWindowInteractor to invoke a UserEvent. This can be caught to\n  // popup a GUI, etc. See the Tcl Cone5.tcl example for an idea of how this\n  // works.\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Tutorial/Tutorial_Step5/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step5)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step5: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step5 MACOSX_BUNDLE Tutorial_Step5.cxx )\n  target_link_libraries(Tutorial_Step5 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step5\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Tutorial/Tutorial_Step5/#download-and-build-tutorial_step5","title":"Download and Build Tutorial_Step5","text":"

Click here to download Tutorial_Step5 and its CMakeLists.txt file. Once the tarball Tutorial_Step5.tar has been downloaded and extracted,

cd Tutorial_Step5/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Tutorial_Step5\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Tutorial/Tutorial_Step6/","title":"Tutorial Step6","text":"

vtk-examples/Cxx/Tutorial/Tutorial_Step6

"},{"location":"Cxx/Tutorial/Tutorial_Step6/#description","title":"Description","text":"

This example introduces 3D widgets. 3D widgets take advantage of the event/observer design pattern introduced previously. They typically have a particular representation in the scene which can be interactively selected and manipulated using the mouse and keyboard. As the widgets are manipulated, they in turn invoke events such as StartInteractionEvent, InteractionEvent, and EndInteractionEvent which can be used to manipulate the scene that the widget is embedded in. 3D widgets work in the context of the event loop which was set up in the previous example.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Tutorial/Tutorial_Step6/#code","title":"Code","text":"

Tutorial_Step6.cxx

/*=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkBoxWidget.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nnamespace {\n//\n// Similar to Tutorial_Step2.cxx, we define a callback for interaction.\n//\nclass vtkMyCallback : public vtkCommand\n{\npublic:\n  static vtkMyCallback* New()\n  {\n    return new vtkMyCallback;\n  }\n  void Execute(vtkObject* caller, unsigned long, void*) override\n  {\n    vtkNew<vtkTransform> t;\n    auto widget = reinterpret_cast<vtkBoxWidget*>(caller);\n    widget->GetTransform(t);\n    widget->GetProp3D()->SetUserTransform(t);\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Next we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the cone. The actor orchestrates rendering\n  // of the mapper's graphics primitives. An actor also refers to properties\n  // via a vtkProperty instance, and includes an internal transformation\n  // matrix. We set this actor's mapper to be coneMapper which we created\n  // above.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Bisque\").GetData());\n\n  //\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the background\n  // color here.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Tutorial_Step6\");\n\n  //\n  // The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n  // mouse) in the vtkRenderWindow. These events are translated into\n  // event invocations that VTK understands (see VTK/Common/vtkCommand.h\n  // for all events that VTK processes). Then observers of these VTK\n  // events can process them as appropriate.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  //\n  // By default the vtkRenderWindowInteractor instantiates an instance\n  // of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n  // it observes into operations on the camera, actors, and/or properties\n  // in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n  // Here we specify a particular interactor style.\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  //\n  // Here we use a vtkBoxWidget to transform the underlying coneActor (by\n  // manipulating its transformation matrix). Many other types of widgets\n  // are available for use, see the documentation for more details.\n  //\n  // The SetInteractor method is how 3D widgets are associated with the render\n  // window interactor. Internally, SetInteractor sets up a bunch of callbacks\n  // using the Command/Observer mechanism (AddObserver()). The place factor\n  // controls the initial size of the widget with respect to the bounding box\n  // of the input to the widget.\n  vtkNew<vtkBoxWidget> boxWidget;\n  boxWidget->SetInteractor(iren);\n  boxWidget->SetPlaceFactor(1.25);\n  boxWidget->GetOutlineProperty()->SetColor(\n      colors->GetColor3d(\"Gold\").GetData());\n\n  //\n  // Place the interactor initially. The input to a 3D widget is used to\n  // initially position and scale the widget. The EndInteractionEvent is\n  // observed which invokes the SelectPolygons callback.\n  //\n  boxWidget->SetProp3D(coneActor);\n  boxWidget->PlaceWidget();\n  vtkNew<vtkMyCallback> callback;\n  boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  //\n  // Normally the user presses the \"i\" key to bring a 3D widget to life. Here\n  // we will manually enable it so it appears with the cone.\n  //\n  boxWidget->On();\n\n  //\n  // Start the event loop.\n  //\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Tutorial/Tutorial_Step6/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step6)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step6: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step6 MACOSX_BUNDLE Tutorial_Step6.cxx )\n  target_link_libraries(Tutorial_Step6 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step6\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Tutorial/Tutorial_Step6/#download-and-build-tutorial_step6","title":"Download and Build Tutorial_Step6","text":"

Click here to download Tutorial_Step6 and its CMakeLists.txt file. Once the tarball Tutorial_Step6.tar has been downloaded and extracted,

cd Tutorial_Step6/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Tutorial_Step6\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/","title":"ClipUnstructuredGridWithPlane","text":"

vtk-examples/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/#description","title":"Description","text":"

The example uses vtkTableBasedClipDataSet to clip a vtkUnstructuredGrid. The resulting output and clipped output are presented in yellow and red respectively. To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each output about their centers.

Note that unlike other clipping filters (except for vtkClipPolyData), vtkTableBasedClipDataSet retains the original cells if they are not clipped.

After exiting, the example reports the number of each cell type for each output:

The inside dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 26116 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3751 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 17361 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 628 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 4376 times.\nThe clipped dataset contains a \n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 25655 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3715 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 16984 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 616 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 4340 times.\n

Compare these results with ClipUnstructuredGridWithPlane2 (C++), ClipUnstructuredGridWithPlane2 (Python). Also, the resulting vtkUnstructuredGrid's has 1/4 the number of cells.

usage

ClipUnstructuredGridWithPlane treemesh.vtk

thanks

Thanks to Bane Sullivan for sharing the treemesh.vtk unstructured grid dataset.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/#code","title":"Code","text":"

ClipUnstructuredGridWithPlane.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellTypes.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTableBasedClipDataSet.h>\n#include <vtkTransform.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtk e.g. treemesh.vtk\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Create the reader for the data.\n  std::string filename = argv[1];\n  std::cout << \"Loading \" << filename.c_str() << std::endl;\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n  double center[3];\n  reader->GetOutput()->GetCenter(center);\n\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  double xnorm[3] = {-1.0, -1.0, 1.0};\n\n  vtkNew<vtkPlane> clipPlane;\n  clipPlane->SetOrigin(reader->GetOutput()->GetCenter());\n  clipPlane->SetNormal(xnorm);\n\n  vtkNew<vtkTableBasedClipDataSet> clipper;\n  clipper->SetClipFunction(clipPlane);\n  clipper->SetInputData(reader->GetOutput());\n  clipper->SetValue(0.0);\n  clipper->GenerateClippedOutputOn();\n  clipper->Update();\n\n  vtkNew<vtkDataSetMapper> insideMapper;\n  insideMapper->SetInputData(clipper->GetOutput());\n  insideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> insideActor;\n  insideActor->SetMapper(insideMapper);\n  insideActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  insideActor->GetProperty()->SetAmbient(.3);\n  insideActor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkDataSetMapper> clippedMapper;\n  clippedMapper->SetInputData(clipper->GetClippedOutput());\n  clippedMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clippedActor;\n  clippedActor->SetMapper(clippedMapper);\n  clippedActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  insideActor->GetProperty()->SetAmbient(.3);\n  clippedActor->GetProperty()->EdgeVisibilityOn();\n\n  // Create transforms to make a better visualization\n  vtkNew<vtkTransform> insideTransform;\n  insideTransform->Translate(-(bounds[1] - bounds[0]) * .75, 0, 0);\n  insideTransform->Translate(center[0], center[1], center[2]);\n  insideTransform->RotateY(-120.0);\n  insideTransform->Translate(-center[0], -center[1], -center[2]);\n  insideActor->SetUserTransform(insideTransform);\n\n  vtkNew<vtkTransform> clippedTransform;\n  clippedTransform->Translate((bounds[1] - bounds[0]) * .75, 0, 0);\n  clippedTransform->Translate(center[0], center[1], center[2]);\n  clippedTransform->RotateY(60.0);\n  clippedTransform->Translate(-center[0], -center[1], -center[2]);\n  clippedActor->SetUserTransform(clippedTransform);\n\n  renderer->AddViewProp(clippedActor);\n  renderer->AddViewProp(insideActor);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ClipUnstructuredGridWithPlane\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  // Generate a report\n  vtkIdType numberOfCells = clipper->GetOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The inside dataset contains a \" << std::endl\n            << clipper->GetOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> CellContainer;\n  CellContainer cellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    cellMap[clipper->GetOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : cellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n\n  numberOfCells = clipper->GetClippedOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset contains a \" << std::endl\n            << clipper->GetClippedOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> OutsideCellContainer;\n  CellContainer outsideCellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    outsideCellMap[clipper->GetClippedOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : outsideCellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipUnstructuredGridWithPlane)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipUnstructuredGridWithPlane: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipUnstructuredGridWithPlane MACOSX_BUNDLE ClipUnstructuredGridWithPlane.cxx )\n  target_link_libraries(ClipUnstructuredGridWithPlane PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipUnstructuredGridWithPlane\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/#download-and-build-clipunstructuredgridwithplane","title":"Download and Build ClipUnstructuredGridWithPlane","text":"

Click here to download ClipUnstructuredGridWithPlane and its CMakeLists.txt file. Once the tarball ClipUnstructuredGridWithPlane.tar has been downloaded and extracted,

cd ClipUnstructuredGridWithPlane/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClipUnstructuredGridWithPlane\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/","title":"ClipUnstructuredGridWithPlane2","text":"

vtk-examples/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#description","title":"Description","text":"

The example uses vtkClipDataSet to clip a vtkUnstructuredGrid. The resulting output and clipped output are presented in yellow and red respectively. To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each output about their centers.

Note that this clipping filter does not retain the original cells if they are not clipped.

After exiting, the example reports the number of each cell type for each output:

The inside dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 110148 cells\n        Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 106998 times.\n        Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 3150 times.\nThe clipped dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 111824 cells\n        Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 107420 times.\n        Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 4404 times.\n

Compare these results with ClipUnstructuredGridWithPlane (C++) ClipUnstructuredGridWithPlane (Python). Notice that in this example, the original vtkHexahedron in the unclipped regions are converted to vtkTetra. Also, the resulting vtkUnstructuredGrid's have more than 4 times the number of cells.

usage

ClipUnstructuredGridWithPlane2 treemesh.vtk

thanks

Thanks to Bane Sullivan for sharing the treemesh.vtk unstructured grid dataset.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#code","title":"Code","text":"

ClipUnstructuredGridWithPlane2.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellTypes.h>\n#include <vtkClipDataSet.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtk e.g. treemesh.vtk\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Create the reader for the data.\n  std::string filename = argv[1];\n  std::cout << \"Loading \" << filename.c_str() << std::endl;\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n  double center[3];\n  reader->GetOutput()->GetCenter(center);\n\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  double xnorm[3] = {-1.0, -1.0, 1.0};\n\n  vtkNew<vtkPlane> clipPlane;\n  clipPlane->SetOrigin(reader->GetOutput()->GetCenter());\n  clipPlane->SetNormal(xnorm);\n\n  vtkNew<vtkClipDataSet> clipper;\n  clipper->SetClipFunction(clipPlane);\n  clipper->SetInputData(reader->GetOutput());\n  clipper->SetValue(0.0);\n  clipper->GenerateClippedOutputOn();\n  clipper->Update();\n\n  vtkNew<vtkDataSetMapper> insideMapper;\n  insideMapper->SetInputData(clipper->GetOutput());\n  insideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> insideActor;\n  insideActor->SetMapper(insideMapper);\n  insideActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"banana\").GetData());\n  insideActor->GetProperty()->SetAmbient(.3);\n  insideActor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkDataSetMapper> clippedMapper;\n  clippedMapper->SetInputData(clipper->GetClippedOutput());\n  clippedMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clippedActor;\n  clippedActor->SetMapper(clippedMapper);\n  clippedActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"tomato\").GetData());\n  insideActor->GetProperty()->SetAmbient(.3);\n  clippedActor->GetProperty()->EdgeVisibilityOn();\n\n  // Create transforms to make a better visualization\n  vtkNew<vtkTransform> insideTransform;\n  insideTransform->Translate(-(bounds[1] - bounds[0]) * .75, 0, 0);\n  insideTransform->Translate(center[0], center[1], center[2]);\n  insideTransform->RotateY(-120.0);\n  insideTransform->Translate(-center[0], -center[1], -center[2]);\n  insideActor->SetUserTransform(insideTransform);\n\n  vtkNew<vtkTransform> clippedTransform;\n  clippedTransform->Translate((bounds[1] - bounds[0]) * .75, 0, 0);\n  clippedTransform->Translate(center[0], center[1], center[2]);\n  clippedTransform->RotateY(60.0);\n  clippedTransform->Translate(-center[0], -center[1], -center[2]);\n  clippedActor->SetUserTransform(clippedTransform);\n\n  renderer->AddViewProp(clippedActor);\n  renderer->AddViewProp(insideActor);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ClipUnstructuredGridWithPlane2\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  // Generate a report\n  vtkIdType numberOfCells = clipper->GetOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The inside dataset contains a \" << std::endl\n            << clipper->GetOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> CellContainer;\n  CellContainer cellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    cellMap[clipper->GetOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : cellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n\n  numberOfCells = clipper->GetClippedOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset contains a \" << std::endl\n            << clipper->GetClippedOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> OutsideCellContainer;\n  CellContainer outsideCellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    outsideCellMap[clipper->GetClippedOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : outsideCellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipUnstructuredGridWithPlane2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipUnstructuredGridWithPlane2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipUnstructuredGridWithPlane2 MACOSX_BUNDLE ClipUnstructuredGridWithPlane2.cxx )\n  target_link_libraries(ClipUnstructuredGridWithPlane2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipUnstructuredGridWithPlane2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#download-and-build-clipunstructuredgridwithplane2","title":"Download and Build ClipUnstructuredGridWithPlane2","text":"

Click here to download ClipUnstructuredGridWithPlane2 and its CMakeLists.txt file. Once the tarball ClipUnstructuredGridWithPlane2.tar has been downloaded and extracted,

cd ClipUnstructuredGridWithPlane2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClipUnstructuredGridWithPlane2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/UnstructuredGrid/UGrid/","title":"UGrid","text":"

vtk-examples/Cxx/UnstructuredGrid/UGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/UnstructuredGrid/UGrid/#description","title":"Description","text":"

Creation of an unstructured grid.

Info

See Figure 5-21 in Chapter 05 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/UnstructuredGrid/UGrid/#code","title":"Code","text":"

UGrid.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellType.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  int i;\n  static double x[27][3] = {\n      {0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {0, 1, 0}, {1, 1, 0}, {2, 1, 0},\n      {0, 0, 1}, {1, 0, 1}, {2, 0, 1}, {0, 1, 1}, {1, 1, 1}, {2, 1, 1},\n      {0, 1, 2}, {1, 1, 2}, {2, 1, 2}, {0, 1, 3}, {1, 1, 3}, {2, 1, 3},\n      {0, 1, 4}, {1, 1, 4}, {2, 1, 4}, {0, 1, 5}, {1, 1, 5}, {2, 1, 5},\n      {0, 1, 6}, {1, 1, 6}, {2, 1, 6}};\n  static vtkIdType pts[12][8] = {\n      {0, 1, 4, 3, 6, 7, 10, 9},      {1, 2, 5, 4, 7, 8, 11, 10},\n      {6, 10, 9, 12, 0, 0, 0, 0},     {8, 11, 10, 14, 0, 0, 0, 0},\n      {16, 17, 14, 13, 12, 15, 0, 0}, {18, 15, 19, 16, 20, 17, 0, 0},\n      {22, 23, 20, 19, 0, 0, 0, 0},   {21, 22, 18, 0, 0, 0, 0, 0},\n      {22, 19, 18, 0, 0, 0, 0, 0},    {23, 26, 0, 0, 0, 0, 0, 0},\n      {21, 24, 0, 0, 0, 0, 0, 0},     {25, 0, 0, 0, 0, 0, 0, 0}};\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkPoints> points;\n  for (i = 0; i < 27; i++) points->InsertPoint(i, x[i]);\n\n  vtkNew<vtkUnstructuredGrid> ugrid;\n  ugrid->Allocate(100);\n  ugrid->InsertNextCell(VTK_HEXAHEDRON, 8, pts[0]);\n  ugrid->InsertNextCell(VTK_HEXAHEDRON, 8, pts[1]);\n  ugrid->InsertNextCell(VTK_TETRA, 4, pts[2]);\n  ugrid->InsertNextCell(VTK_TETRA, 4, pts[3]);\n  ugrid->InsertNextCell(VTK_POLYGON, 6, pts[4]);\n  ugrid->InsertNextCell(VTK_TRIANGLE_STRIP, 6, pts[5]);\n  ugrid->InsertNextCell(VTK_QUAD, 4, pts[6]);\n  ugrid->InsertNextCell(VTK_TRIANGLE, 3, pts[7]);\n  ugrid->InsertNextCell(VTK_TRIANGLE, 3, pts[8]);\n  ugrid->InsertNextCell(VTK_LINE, 2, pts[9]);\n  ugrid->InsertNextCell(VTK_LINE, 2, pts[10]);\n  ugrid->InsertNextCell(VTK_VERTEX, 1, pts[11]);\n\n  ugrid->SetPoints(points);\n\n  vtkNew<vtkDataSetMapper> ugridMapper;\n  ugridMapper->SetInputData(ugrid);\n\n  vtkNew<vtkActor> ugridActor;\n  ugridActor->SetMapper(ugridMapper);\n  ugridActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  ugridActor->GetProperty()->EdgeVisibilityOn();\n\n  renderer->AddActor(ugridActor);\n  renderer->SetBackground(colors->GetColor3d(\"Beige\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Dolly(1.2);\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"UGrid)\");\n\n  // interact with data\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/UnstructuredGrid/UGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(UGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"UGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(UGrid MACOSX_BUNDLE UGrid.cxx )\n  target_link_libraries(UGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS UGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/UnstructuredGrid/UGrid/#download-and-build-ugrid","title":"Download and Build UGrid","text":"

Click here to download UGrid and its CMakeLists.txt file. Once the tarball UGrid.tar has been downloaded and extracted,

cd UGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./UGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/2DArray/","title":"2DArray","text":"

vtk-examples/Cxx/Utilities/2DArray

"},{"location":"Cxx/Utilities/2DArray/#description","title":"Description","text":"

This example creates a 5x5 2D array and sets the (4,4) (zero based indexing, of course) entry to 5.0. Then it outputs this value to demonstrate accessing.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/2DArray/#code","title":"Code","text":"

2DArray.cxx

#include <vtkDenseArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDenseArray<double>> array;\n\n  array->Resize(5, 5);\n\n  array->SetValue(4, 4, 5.0);\n\n  std::cout << array->GetValue(4, 4) << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/2DArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(2DArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"2DArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(2DArray MACOSX_BUNDLE 2DArray.cxx )\n  target_link_libraries(2DArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS 2DArray\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/2DArray/#download-and-build-2darray","title":"Download and Build 2DArray","text":"

Click here to download 2DArray and its CMakeLists.txt file. Once the tarball 2DArray.tar has been downloaded and extracted,

cd 2DArray/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./2DArray\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/3DArray/","title":"3DArray","text":"

vtk-examples/Cxx/Utilities/3DArray

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/3DArray/#code","title":"Code","text":"

3DArray.cxx

#include <vtkDenseArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // Create an N-D array\n  vtkNew<vtkDenseArray<double>> array;\n\n  // Resize the array to 4x5x3\n  array->Resize(4, 5, 3);\n\n  // Set a value\n  int i = 0;\n  int j = 0;\n  int k = 0;\n  double value = 3.0;\n  array->SetValue(i, j, k, value);\n\n  // Get a value\n  std::cout << array->GetValue(i, j, k) << std::endl;\n\n  // Get size (bounds) of whole array\n  cout << array->GetExtents() << endl;\n\n  // Get size (bounds) of array dimensions\n  std::cout << array->GetExtents()[0] << std::endl;\n  std::cout << array->GetExtents()[1] << std::endl;\n  std::cout << array->GetExtents()[2] << std::endl;\n\n  // Get the bounds of the 0th dimension\n  std::cout << array->GetExtents()[0].GetBegin() << std::endl;\n  std::cout << array->GetExtents()[0].GetEnd() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/3DArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(3DArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"3DArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(3DArray MACOSX_BUNDLE 3DArray.cxx )\n  target_link_libraries(3DArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS 3DArray\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/3DArray/#download-and-build-3darray","title":"Download and Build 3DArray","text":"

Click here to download 3DArray and its CMakeLists.txt file. Once the tarball 3DArray.tar has been downloaded and extracted,

cd 3DArray/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./3DArray\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/Animation/","title":"Animation","text":"

vtk-examples/Cxx/Utilities/Animation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Utilities/Animation/#description","title":"Description","text":"

This example demonstrates how to create a simple animation. A timer is used to move a sphere across a scene.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/Animation/#code","title":"Code","text":"

Animation.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass vtkTimerCallback2 : public vtkCallbackCommand\n{\npublic:\n  vtkTimerCallback2() = default;\n\n  static vtkTimerCallback2* New()\n  {\n    vtkTimerCallback2* cb = new vtkTimerCallback2;\n    cb->TimerCount = 0;\n    return cb;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long eventId,\n                       void* vtkNotUsed(callData))\n  {\n    if (vtkCommand::TimerEvent == eventId)\n    {\n      ++this->TimerCount;\n    }\n    std::cout << this->TimerCount << std::endl;\n    actor->SetPosition(this->TimerCount, this->TimerCount, 0);\n    if (this->TimerCount < this->maxCount)\n    {\n\n      vtkRenderWindowInteractor* iren =\n          dynamic_cast<vtkRenderWindowInteractor*>(caller);\n      iren->GetRenderWindow()->Render();\n    }\n    else\n    {\n      vtkRenderWindowInteractor* iren =\n          dynamic_cast<vtkRenderWindowInteractor*>(caller);\n      if (this->timerId > -1)\n      {\n        iren->DestroyTimer(this->timerId);\n      }\n    }\n  }\n\nprivate:\n  int TimerCount = 0;\n\npublic:\n  vtkActor* actor = nullptr;\n  int timerId = 0;\n  int maxCount = -1;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(2.0);\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetSpecular(0.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Animation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Zoom(0.8);\n  renderWindow->Render();\n\n  // Initialize must be called prior to creating timer events.\n  renderWindowInteractor->Initialize();\n\n  // Sign up to receive TimerEvent\n  vtkNew<vtkTimerCallback2> cb;\n  cb->actor = actor;\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, cb);\n\n  int timerId = renderWindowInteractor->CreateRepeatingTimer(500);\n  std::cout << \"timerId: \" << timerId << std::endl;\n  // Destroy the timer when maxCount is reached.\n  cb->maxCount = 3;\n  cb->timerId = timerId;\n  // Start the interaction and timer\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/Animation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Animation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Animation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Animation MACOSX_BUNDLE Animation.cxx )\n  target_link_libraries(Animation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Animation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/Animation/#download-and-build-animation","title":"Download and Build Animation","text":"

Click here to download Animation and its CMakeLists.txt file. Once the tarball Animation.tar has been downloaded and extracted,

cd Animation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Animation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/AnimationScene/","title":"AnimationScene","text":"

vtk-examples/Cxx/Utilities/AnimationScene

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/AnimationScene/#code","title":"Code","text":"

AnimationScene.cxx

#include <vtkAnimationCue.h>\n#include <vtkAnimationScene.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass CueAnimator\n{\npublic:\n  CueAnimator()\n  {\n    this->SphereSource = 0;\n    this->Mapper = 0;\n    this->Actor = 0;\n  }\n\n  ~CueAnimator()\n  {\n    this->Cleanup();\n  }\n\n  void StartCue(vtkAnimationCue::AnimationCueInfo* vtkNotUsed(info),\n                vtkRenderer* ren)\n  {\n    vtkNew<vtkNamedColors> colors;\n\n    cout << \"*** IN StartCue \" << endl;\n    this->SphereSource = vtkSphereSource::New();\n    this->SphereSource->SetRadius(0.5);\n\n    this->Mapper = vtkPolyDataMapper::New();\n    this->Mapper->SetInputConnection(this->SphereSource->GetOutputPort());\n\n    this->Actor = vtkActor::New();\n    this->Actor->SetMapper(this->Mapper);\n    this->Actor->GetProperty()->SetSpecular(0.6);\n    this->Actor->GetProperty()->SetSpecularPower(30);\n    this->Actor->GetProperty()->SetColor(\n        colors->GetColor3d(\"Peacock\").GetData());\n\n    ren->AddActor(this->Actor);\n    ren->ResetCamera();\n    ren->Render();\n  }\n\n  void Tick(vtkAnimationCue::AnimationCueInfo* info, vtkRenderer* ren)\n  {\n    double newradius = 0.1 +\n        (static_cast<double>(info->AnimationTime - info->StartTime) /\n         static_cast<double>(info->EndTime - info->StartTime)) *\n            1;\n    this->SphereSource->SetRadius(newradius);\n    this->SphereSource->Update();\n    ren->Render();\n  }\n\n  void EndCue(vtkAnimationCue::AnimationCueInfo* vtkNotUsed(info),\n              vtkRenderer* ren)\n  {\n    (void)ren;\n    // don't remove the actor for the regression image.\n    //      ren->RemoveActor(this->Actor);\n    this->Cleanup();\n  }\n\nprotected:\n  vtkSphereSource* SphereSource;\n  vtkPolyDataMapper* Mapper;\n  vtkActor* Actor;\n\n  void Cleanup()\n  {\n    if (this->SphereSource != 0)\n    {\n      this->SphereSource->Delete();\n      this->SphereSource = 0;\n    }\n\n    if (this->Mapper != 0)\n    {\n      this->Mapper->Delete();\n      this->Mapper = 0;\n    }\n    if (this->Actor != 0)\n    {\n      this->Actor->Delete();\n      this->Actor = 0;\n    }\n  }\n};\n\nclass vtkAnimationCueObserver : public vtkCommand\n{\npublic:\n  static vtkAnimationCueObserver* New()\n  {\n    return new vtkAnimationCueObserver;\n  }\n\n  virtual void Execute(vtkObject* vtkNotUsed(caller), unsigned long event,\n                       void* calldata)\n  {\n    if (this->Animator != 0 && this->Renderer != 0)\n    {\n      vtkAnimationCue::AnimationCueInfo* info =\n          static_cast<vtkAnimationCue::AnimationCueInfo*>(calldata);\n      switch (event)\n      {\n      case vtkCommand::StartAnimationCueEvent:\n        this->Animator->StartCue(info, this->Renderer);\n        break;\n      case vtkCommand::EndAnimationCueEvent:\n        this->Animator->EndCue(info, this->Renderer);\n        break;\n      case vtkCommand::AnimationCueTickEvent:\n        this->Animator->Tick(info, this->Renderer);\n        break;\n      }\n    }\n    if (this->RenWin != 0)\n    {\n      this->RenWin->Render();\n    }\n  }\n\n  vtkRenderer* Renderer;\n  vtkRenderWindow* RenWin;\n  CueAnimator* Animator;\n\nprotected:\n  vtkAnimationCueObserver()\n  {\n    this->Renderer = 0;\n    this->Animator = 0;\n    this->RenWin = 0;\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the graphics structure. The renderer renders into the\n  // render window.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetMultiSamples(0);\n  renWin->SetWindowName(\"AnimationScene\");\n\n  iren->SetRenderWindow(renWin);\n  renWin->AddRenderer(ren1);\n  ren1->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n  renWin->Render();\n\n  // Create an Animation Scene\n  vtkNew<vtkAnimationScene> scene;\n\n  scene->SetModeToRealTime();\n  // scene->SetModeToSequence();\n\n  scene->SetLoop(0);\n  scene->SetFrameRate(5);\n  scene->SetStartTime(3);\n  scene->SetEndTime(20);\n\n  // Create an Animation Cue.\n  vtkNew<vtkAnimationCue> cue1;\n  cue1->SetStartTime(5);\n  cue1->SetEndTime(23);\n  scene->AddCue(cue1);\n\n  // Create cue animator;\n  CueAnimator animator;\n\n  // Create Cue observer.\n  vtkNew<vtkAnimationCueObserver> observer;\n  observer->Renderer = ren1;\n  observer->Animator = &animator;\n  observer->RenWin = renWin;\n\n  cue1->AddObserver(vtkCommand::StartAnimationCueEvent, observer);\n  cue1->AddObserver(vtkCommand::EndAnimationCueEvent, observer);\n  cue1->AddObserver(vtkCommand::AnimationCueTickEvent, observer);\n\n  scene->Play();\n  scene->Stop();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/AnimationScene/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AnimationScene)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AnimationScene: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AnimationScene MACOSX_BUNDLE AnimationScene.cxx )\n  target_link_libraries(AnimationScene PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AnimationScene\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/AnimationScene/#download-and-build-animationscene","title":"Download and Build AnimationScene","text":"

Click here to download AnimationScene and its CMakeLists.txt file. Once the tarball AnimationScene.tar has been downloaded and extracted,

cd AnimationScene/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AnimationScene\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ArrayCalculator/","title":"ArrayCalculator","text":"

vtk-examples/Cxx/Utilities/ArrayCalculator

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ArrayCalculator/#code","title":"Code","text":"

ArrayCalculator.cxx

#include <vtkArrayCalculator.h>\n#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(2.0, 0.0, 0.0);\n  points->InsertNextPoint(3.0, 0.0, 0.0);\n\n  vtkNew<vtkDoubleArray> array;\n  array->SetName(\"orig\");\n  array->InsertNextValue(1.0);\n  array->InsertNextValue(2.0);\n  array->InsertNextValue(3.0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->AddArray(array);\n\n  vtkNew<vtkArrayCalculator> calc1;\n  calc1->SetInputData(polydata);\n  calc1->AddScalarArrayName(\"orig\");\n  calc1->SetFunction(\"orig+1\");\n  calc1->SetResultArrayName(\"orig\");\n  calc1->Update();\n\n  auto output1 = dynamic_cast<vtkDoubleArray*>(\n      calc1->GetPolyDataOutput()->GetPointData()->GetArray(\"orig\"));\n\n  for (vtkIdType i = 0; i < output1->GetNumberOfTuples(); i++)\n  {\n    double val = output1->GetValue(i);\n    cout << \"output1 value \" << i << \": \" << val << endl;\n  }\n\n  vtkNew<vtkArrayCalculator> calc2;\n  calc2->SetInputData(polydata);\n  calc2->AddScalarArrayName(\"orig\");\n  calc2->SetFunction(\"if(orig=2,1,orig)\");\n  calc2->SetResultArrayName(\"new\");\n  calc2->Update();\n\n  auto output2 = dynamic_cast<vtkDoubleArray*>(\n      calc2->GetPolyDataOutput()->GetPointData()->GetArray(\"new\"));\n\n  for (vtkIdType i = 0; i < output2->GetNumberOfTuples(); i++)\n  {\n    double val = output2->GetValue(i);\n    cout << \"output2 value \" << i << \": \" << val << endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ArrayCalculator/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ArrayCalculator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ArrayCalculator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ArrayCalculator MACOSX_BUNDLE ArrayCalculator.cxx )\n  target_link_libraries(ArrayCalculator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ArrayCalculator\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ArrayCalculator/#download-and-build-arraycalculator","title":"Download and Build ArrayCalculator","text":"

Click here to download ArrayCalculator and its CMakeLists.txt file. Once the tarball ArrayCalculator.tar has been downloaded and extracted,

cd ArrayCalculator/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ArrayCalculator\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ArrayLookup/","title":"ArrayLookup","text":"

vtk-examples/Cxx/Utilities/ArrayLookup

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ArrayLookup/#code","title":"Code","text":"

ArrayLookup.cxx

#include <vtkFloatArray.h>\n#include <vtkIdList.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFloatArray> distances;\n  distances->SetNumberOfComponents(1);\n  distances->SetName(\"Distances\");\n\n  distances->InsertNextValue(5);\n  distances->InsertNextValue(15);\n  distances->InsertNextValue(15);\n  distances->InsertNextValue(25);\n  distances->InsertNextValue(15);\n\n  // Get first location\n  vtkIdType result = distances->LookupValue(15);\n  std::cout << \"result: \" << result << std::endl;\n\n  // Get all locations\n  vtkNew<vtkIdList> idList;\n  distances->LookupValue(15, idList);\n  std::cout << \"found at: \" << std::endl;\n  for (vtkIdType i = 0; i < idList->GetNumberOfIds(); i++)\n  {\n    std::cout << idList->GetId(i) << \" \";\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ArrayLookup/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ArrayLookup)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ArrayLookup: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ArrayLookup MACOSX_BUNDLE ArrayLookup.cxx )\n  target_link_libraries(ArrayLookup PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ArrayLookup\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ArrayLookup/#download-and-build-arraylookup","title":"Download and Build ArrayLookup","text":"

Click here to download ArrayLookup and its CMakeLists.txt file. Once the tarball ArrayLookup.tar has been downloaded and extracted,

cd ArrayLookup/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ArrayLookup\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ArrayRange/","title":"ArrayRange","text":"

vtk-examples/Cxx/Utilities/ArrayRange

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ArrayRange/#code","title":"Code","text":"

ArrayRange.cxx

#include <vtkFloatArray.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  /////////// Floats ///////////\n  {\n    vtkNew<vtkFloatArray> distances;\n    distances->SetNumberOfComponents(1);\n    distances->SetName(\"Distances\");\n\n    distances->InsertNextValue(5);\n    distances->InsertNextValue(15);\n    distances->InsertNextValue(25);\n\n    // Get min and max\n    double range[2];\n    distances->GetRange(range);\n    std::cout << \"range = \" << range[0] << \" \" << range[1] << std::endl;\n  }\n\n  /////////////// Ints //////////////\n  {\n    vtkNew<vtkIntArray> ints;\n    ints->SetNumberOfComponents(1);\n    ints->SetName(\"Ints\");\n\n    ints->InsertNextValue(5);\n    ints->InsertNextValue(15);\n    ints->InsertNextValue(25);\n\n    // Get min and max\n    int valuesRange[2];\n    ints->GetValueRange(valuesRange); // Note this is not GetRange()!\n    std::cout << \"valuesRange = \" << valuesRange[0] << \" \" << valuesRange[1]\n              << std::endl;\n  }\n\n  /////////// Range with negative values ///////////\n  {\n    vtkNew<vtkIntArray> ints;\n    ints->SetNumberOfComponents(1);\n    ints->SetName(\"Ints\");\n\n    ints->InsertNextValue(-50);\n    ints->InsertNextValue(15);\n    ints->InsertNextValue(25);\n\n    // Get min and max\n    int valuesRange[2];\n    ints->GetValueRange(valuesRange); // Note this is not GetRange()!\n    std::cout << \"valuesRange = \" << valuesRange[0] << \" \" << valuesRange[1]\n              << std::endl;\n  }\n\n  /////////// Magnitude range ///////////\n  {\n    vtkNew<vtkIntArray> ints;\n    ints->SetNumberOfComponents(1);\n    ints->SetName(\"Ints\");\n\n    ints->InsertNextValue(-50);\n    ints->InsertNextValue(15);\n    ints->InsertNextValue(25);\n\n    // Get min and max\n    int valuesRange[2];\n    ints->GetValueRange(valuesRange, -1);\n    std::cout << \"valuesRange = \" << valuesRange[0] << \" \" << valuesRange[1]\n              << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ArrayRange/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ArrayRange)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ArrayRange: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ArrayRange MACOSX_BUNDLE ArrayRange.cxx )\n  target_link_libraries(ArrayRange PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ArrayRange\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ArrayRange/#download-and-build-arrayrange","title":"Download and Build ArrayRange","text":"

Click here to download ArrayRange and its CMakeLists.txt file. Once the tarball ArrayRange.tar has been downloaded and extracted,

cd ArrayRange/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ArrayRange\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ArrayWriter/","title":"ArrayWriter","text":"

vtk-examples/Cxx/Utilities/ArrayWriter

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ArrayWriter/#code","title":"Code","text":"

ArrayWriter.cxx

#include <vtkArrayData.h>\n#include <vtkArrayWriter.h>\n#include <vtkDenseArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDenseArray<double>> array;\n  array->Resize(1, 3);\n  array->SetValue(0, 0, 1.0);\n  array->SetValue(0, 1, 2.0);\n  array->SetValue(0, 2, 3.0);\n  {\n    // Method 1\n    vtkNew<vtkArrayWriter> writer;\n    vtkNew<vtkArrayData> arrayData;\n    arrayData->AddArray(array);\n    writer->SetInputData(arrayData);\n    vtkStdString file1 = \"Test1.txt\";\n    writer->Write(file1);\n  }\n  {\n    vtkStdString file2 = \"Test2.txt\";\n    // Method 2\n    vtkNew<vtkArrayWriter> writer;\n    writer->Write(array, file2);\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ArrayWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ArrayWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ArrayWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ArrayWriter MACOSX_BUNDLE ArrayWriter.cxx )\n  target_link_libraries(ArrayWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ArrayWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ArrayWriter/#download-and-build-arraywriter","title":"Download and Build ArrayWriter","text":"

Click here to download ArrayWriter and its CMakeLists.txt file. Once the tarball ArrayWriter.tar has been downloaded and extracted,

cd ArrayWriter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ArrayWriter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/BoundingBox/","title":"BoundingBox","text":"

vtk-examples/Cxx/Utilities/BoundingBox

"},{"location":"Cxx/Utilities/BoundingBox/#description","title":"Description","text":"

Seealso

Outline and CubeAxesActor2D

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/BoundingBox/#code","title":"Code","text":"

BoundingBox.cxx

#include <vtkBoundingBox.h>\n\nint main(int, char*[])\n{\n  double p0[3] = {0, 0, 0};\n  double p1[3] = {0.5, 0.5, 0.5};\n  double p2[3] = {1.0, 1.0, 1.0};\n\n  vtkBoundingBox boundingBox;\n\n  boundingBox.AddPoint(p0);\n\n  double bounds[6];\n\n  boundingBox.GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \", \" << bounds[2]\n            << \", \" << bounds[3] << \", \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n\n  // After adding this point, the box gets bigger\n  boundingBox.AddPoint(p2);\n\n  boundingBox.GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \", \" << bounds[2]\n            << \", \" << bounds[3] << \", \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n\n  // After adding this point, the box size does not change as the point is\n  // already inside the box\n  boundingBox.AddPoint(p1);\n\n  boundingBox.GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \", \" << bounds[2]\n            << \", \" << bounds[3] << \", \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/BoundingBox/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoundingBox)\n\nfind_package(VTK COMPONENTS \n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoundingBox: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoundingBox MACOSX_BUNDLE BoundingBox.cxx )\n  target_link_libraries(BoundingBox PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoundingBox\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/BoundingBox/#download-and-build-boundingbox","title":"Download and Build BoundingBox","text":"

Click here to download BoundingBox and its CMakeLists.txt file. Once the tarball BoundingBox.tar has been downloaded and extracted,

cd BoundingBox/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BoundingBox\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/BoundingBoxIntersection/","title":"BoundingBoxIntersection","text":"

vtk-examples/Cxx/Utilities/BoundingBoxIntersection

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/BoundingBoxIntersection/#code","title":"Code","text":"

BoundingBoxIntersection.cxx

#include <vtkBoundingBox.h>\n\nint main(int, char*[])\n{\n  vtkBoundingBox boundingBox0;\n  boundingBox0.SetBounds(0, 1, 0, 1, 0, 1);\n\n  vtkBoundingBox boundingBox1;\n  boundingBox1.SetBounds(5, 6, 5, 6, 5, 6);\n\n  vtkBoundingBox boundingBox2;\n  boundingBox2.SetBounds(0.5, 1.5, 0.5, 1.5, 0.5, 1.5);\n\n  std::cout << boundingBox0.IntersectBox(boundingBox1)\n            << std::endl; // Should be 0\n  std::cout << boundingBox0.IntersectBox(boundingBox2)\n            << std::endl; // Should be 1\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/BoundingBoxIntersection/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoundingBoxIntersection)\n\nfind_package(VTK COMPONENTS \n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoundingBoxIntersection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoundingBoxIntersection MACOSX_BUNDLE BoundingBoxIntersection.cxx )\n  target_link_libraries(BoundingBoxIntersection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoundingBoxIntersection\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/BoundingBoxIntersection/#download-and-build-boundingboxintersection","title":"Download and Build BoundingBoxIntersection","text":"

Click here to download BoundingBoxIntersection and its CMakeLists.txt file. Once the tarball BoundingBoxIntersection.tar has been downloaded and extracted,

cd BoundingBoxIntersection/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BoundingBoxIntersection\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/Box/","title":"Box","text":"

vtk-examples/Cxx/Utilities/Box

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/Box/#code","title":"Code","text":"

Box.cxx

#include <vtkBox.h>\n\nint main(int, char*[])\n{\n  // Define a box\n  double bounds[6] = {-1, 1, -1, 1, -1, 1};\n\n  // Define a ray\n  double rayOrigin[3] = {-5.0, 0, 0};\n  double rayDirection[3] = {1, 0, 0};\n\n  double intersection[3];\n  double t;\n\n  auto hit =\n      vtkBox::IntersectBox(bounds, rayOrigin, rayDirection, intersection, t);\n\n  if (!hit)\n  {\n    std::cout << \"Not hit!\" << std::endl;\n  }\n  else\n  {\n    // Intersection should be (-1.0, 0, 0)\n    std::cout << \"Intersection is \" << intersection[0] << \" \" << intersection[1]\n              << \" \" << intersection[2] << std::endl;\n    std::cout << \"t is \" << t << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/Box/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Box)\n\nfind_package(VTK COMPONENTS \n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Box: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Box MACOSX_BUNDLE Box.cxx )\n  target_link_libraries(Box PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Box\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/Box/#download-and-build-box","title":"Download and Build Box","text":"

Click here to download Box and its CMakeLists.txt file. Once the tarball Box.tar has been downloaded and extracted,

cd Box/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Box\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/BrownianPoints/","title":"BrownianPoints","text":"

vtk-examples/Cxx/Utilities/BrownianPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/BrownianPoints/#code","title":"Code","text":"

BrownianPoints.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkBrownianPoints.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Generate random vectors.\n  vtkMath::RandomSeed(5070); // for testing\n  vtkNew<vtkBrownianPoints> brownianPoints;\n  brownianPoints->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkArrowSource> arrowSource;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetSourceConnection(arrowSource->GetOutputPort());\n  glyph3D->SetInputConnection(brownianPoints->GetOutputPort());\n  glyph3D->SetScaleFactor(0.3);\n\n  // Create a mapper and actor for sphere.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->SetMapper(mapper);\n\n  // Create a mapper and actor for glyphs.\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  glyphActor->SetMapper(glyphMapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(glyphActor);\n\n  // Create a nice view.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"BrownianPoints\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/BrownianPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BrownianPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BrownianPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BrownianPoints MACOSX_BUNDLE BrownianPoints.cxx )\n  target_link_libraries(BrownianPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BrownianPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/BrownianPoints/#download-and-build-brownianpoints","title":"Download and Build BrownianPoints","text":"

Click here to download BrownianPoints and its CMakeLists.txt file. Once the tarball BrownianPoints.tar has been downloaded and extracted,

cd BrownianPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BrownianPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/CameraModifiedEvent/","title":"CameraModifiedEvent","text":"

vtk-examples/Cxx/Utilities/CameraModifiedEvent

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/CameraModifiedEvent/#code","title":"Code","text":"

CameraModifiedEvent.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid CameraModifiedCallback(vtkObject* caller,\n                            long unsigned int vtkNotUsed(eventId),\n                            void* vtkNotUsed(clientData),\n                            void* vtkNotUsed(callData))\n{\n  std::cout << caller->GetClassName() << \" modified\" << std::endl;\n\n  vtkCamera* camera = static_cast<vtkCamera*>(caller);\n  // Print the interesting stuff.\n  std::cout << \"\\tPosition: \" << camera->GetPosition()[0] << \", \"\n            << camera->GetPosition()[1] << \", \" << camera->GetPosition()[2]\n            << std::endl;\n  std::cout << \"\\tFocal point: \" << camera->GetFocalPoint()[0] << \", \"\n            << camera->GetFocalPoint()[1] << \", \" << camera->GetFocalPoint()[2]\n            << std::endl;\n}\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CameraModifiedEvent\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkCallbackCommand> modifiedCallback;\n  modifiedCallback->SetCallback(CameraModifiedCallback);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->AddObserver(vtkCommand::ModifiedEvent,\n                                           modifiedCallback);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/CameraModifiedEvent/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraModifiedEvent)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraModifiedEvent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraModifiedEvent MACOSX_BUNDLE CameraModifiedEvent.cxx )\n  target_link_libraries(CameraModifiedEvent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraModifiedEvent\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/CameraModifiedEvent/#download-and-build-cameramodifiedevent","title":"Download and Build CameraModifiedEvent","text":"

Click here to download CameraModifiedEvent and its CMakeLists.txt file. Once the tarball CameraModifiedEvent.tar has been downloaded and extracted,

cd CameraModifiedEvent/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CameraModifiedEvent\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/CardinalSpline/","title":"CardinalSpline","text":"

vtk-examples/Cxx/Utilities/CardinalSpline

"},{"location":"Cxx/Utilities/CardinalSpline/#description","title":"Description","text":"

This example takes two points that have associated scalar values and allows you to interpolate the value at any point on the line between them using cardinal spline interpolation.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/CardinalSpline/#code","title":"Code","text":"

CardinalSpline.cxx

#include <vtkCardinalSpline.h>\n#include <vtkFloatArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // Create a scalar array.  The array could be associated with the scalars of a\n  // vtkDataSet\n  vtkNew<vtkFloatArray> distances;\n  distances->SetNumberOfComponents(1);\n  distances->SetName(\"Distances\");\n  distances->InsertNextValue(100.0);\n  distances->InsertNextValue(300.0);\n\n  // Create a cardinal spline to show how to linearly interpolate between two\n  // scalar values\n  vtkNew<vtkCardinalSpline> spline;\n  spline->ClosedOff();\n\n  // Set the left and right second derivatives to 0 corresponding to linear\n  // interpolation\n  spline->SetLeftConstraint(2);\n  spline->SetLeftValue(0);\n  spline->SetRightConstraint(2);\n  spline->SetRightValue(0);\n  double* r = distances->GetRange();\n  double xmin = r[0];\n  double xmax = r[1];\n  double length = xmax - xmin;\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); ++i)\n  {\n    double x = distances->GetTuple1(i);\n    double t = (x - xmin) / length;\n    spline->AddPoint(t, x);\n  }\n\n  // Evaluate every 50 distance units along the line\n  std::cout << \"Spline interpolation:\" << std::endl;\n  double dt = .25;\n  for (double t = dt; t <= 1. - dt; t += dt)\n  {\n    std::cout << \"t: \" << t << \" value = \" << spline->Evaluate(t) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/CardinalSpline/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CardinalSpline)\n\nfind_package(VTK COMPONENTS \n  CommonComputationalGeometry\n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CardinalSpline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CardinalSpline MACOSX_BUNDLE CardinalSpline.cxx )\n  target_link_libraries(CardinalSpline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CardinalSpline\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/CardinalSpline/#download-and-build-cardinalspline","title":"Download and Build CardinalSpline","text":"

Click here to download CardinalSpline and its CMakeLists.txt file. Once the tarball CardinalSpline.tar has been downloaded and extracted,

cd CardinalSpline/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CardinalSpline\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/CheckVTKVersion/","title":"CheckVTKVersion","text":"

vtk-examples/Cxx/Utilities/CheckVTKVersion

"},{"location":"Cxx/Utilities/CheckVTKVersion/#description","title":"Description","text":"

This example demonstrates how to check the VTK version with vtkVersion.

Also demonstrated is the usage of the various version macros.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/CheckVTKVersion/#code","title":"Code","text":"

CheckVTKVersion.cxx

#include <vtkNew.h>\n#include <vtkVersion.h>\n\n#include <array>\n#include <vector>\n\n#ifdef VTK_VERSION_NUMBER\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define VTK_HAS_COW 1\n#endif\n#endif\n\n#if VTK_HAS_COW\n// Add any specific includes here.\n// #include <vtkCameraOrientationWidget.h>\n#endif\n\nnamespace {\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return true if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n\n} // namespace\n\nint main(int, char*[])\n{\n  std::cout << \"VTK Version: \" << vtkVersion::GetVTKVersion() << std::endl;\n\n  // We can check and exit if the VTK version is too old.\n  if (!VTKVersionOk(9, 0, 0))\n  {\n    std::cerr << \"You need VTK version 9.0.0 or greater to run this program.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::vector<std::array<int, 3>> testVersions = {{9, 2, 20220831}, {9, 19, 0}};\n  for (auto const& ver : testVersions)\n  {\n    if (VTKVersionOk(ver[0], ver[1], ver[2]))\n    {\n      std::cout << \"This code works for VTK Versions >= \" << ver[0] << \".\"\n                << ver[1] << \".\" << ver[2] << std::endl;\n    }\n    else\n    {\n      std::cout << \"You need VTK Version \" << ver[0] << \".\" << ver[1] << \".\"\n                << ver[2] << \" or greater.\" << std::endl;\n    }\n  }\n\n  // If we want to use alternative code do it this way.\n#ifdef VTK_HAS_COW\n  std::cout << \"Using vtkCameraOrientationWidget.\" << std::endl;\n#else\n  std::cout << \"Fallback to using vtkAxesActor\" << std::endl;\n#endif\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n  auto res = false;\n#ifndef VTK_VERSION_NUMBER\n  vtkNew<vtkVersion> ver;\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  res = vtk_version_number >= neededVersion;\n#else\n  res = VTK_VERSION_NUMBER >= neededVersion;\n#endif\n  return res;\n}\n\n} // namespace\n
"},{"location":"Cxx/Utilities/CheckVTKVersion/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CheckVTKVersion)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  InteractionWidgets\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CheckVTKVersion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CheckVTKVersion MACOSX_BUNDLE CheckVTKVersion.cxx )\n  target_link_libraries(CheckVTKVersion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CheckVTKVersion\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/CheckVTKVersion/#download-and-build-checkvtkversion","title":"Download and Build CheckVTKVersion","text":"

Click here to download CheckVTKVersion and its CMakeLists.txt file. Once the tarball CheckVTKVersion.tar has been downloaded and extracted,

cd CheckVTKVersion/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CheckVTKVersion\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ColorLookupTable/","title":"ColorLookupTable","text":"

vtk-examples/Cxx/Utilities/ColorLookupTable

"},{"location":"Cxx/Utilities/ColorLookupTable/#description","title":"Description","text":"

This example shows how to create a table of colors that map from a continuous range of values.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ColorLookupTable/#code","title":"Code","text":"

ColorLookupTable.cxx

#include <vtkLookupTable.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkLookupTable> lookupTable;\n\n  lookupTable->SetTableRange(0.0, 10.0);\n  // If you don't want to use the whole color range, you can use\n  // SetValueRange, SetHueRange, and SetSaturationRange\n  lookupTable->Build();\n\n  double color[3];\n  lookupTable->GetColor(1.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  lookupTable->GetColor(5.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ColorLookupTable/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorLookupTable)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorLookupTable: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorLookupTable MACOSX_BUNDLE ColorLookupTable.cxx )\n  target_link_libraries(ColorLookupTable PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorLookupTable\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ColorLookupTable/#download-and-build-colorlookuptable","title":"Download and Build ColorLookupTable","text":"

Click here to download ColorLookupTable and its CMakeLists.txt file. Once the tarball ColorLookupTable.tar has been downloaded and extracted,

cd ColorLookupTable/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorLookupTable\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ColorMapToLUT/","title":"ColorMapToLUT","text":"

vtk-examples/Cxx/Utilities/ColorMapToLUT

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Utilities/ColorMapToLUT/#description","title":"Description","text":"

Demonstrate a cone using the vtkDiscretizableColorTransferFunction to generate the colormap.

These two Python functions can be used to generate C++ and Python functions from a JSON or XML colormap. They can then be copied into ColorMapToLUT.cxx, ColorMapToLUT.py or into your own code.

  • ColorMapToLUT_XML
  • ColorMapToLUT_JSON

Feel free to use either of these programs to generate different colormaps until you find one you like.

A good initial source for color maps is: SciVisColor -- this will provide you with plenty of XML examples.

ColorMapToLUT_JSON will allow you to select colormaps by name from ParaView Default Colormaps.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ColorMapToLUT/#code","title":"Code","text":"

ColorMapToLUT.cxx

#include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkDiscretizableColorTransferFunction.h>\n#include <vtkElevationFilter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n// #include <vtkSphereSource.h>\n\n#include <array>\n\nnamespace {\nvtkNew<vtkDiscretizableColorTransferFunction> GetCTF();\n\n}\n\nint main(int, char*[])\n{\n  std::array<unsigned char, 4> bkg{82, 87, 110, 255};\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"ParaViewBkg\", bkg.data());\n\n  vtkNew<vtkRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ColorMapToLUT\");\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  // vtkNew<vtkSphereSource> sphere;\n  // sphere->SetThetaResolution(64);\n  // sphere->SetPhiResolution(32);\n  // auto bounds = sphere->GetOutput()->GetBounds();\n\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(6);\n  cone->SetDirection(0, 1, 0);\n  cone->SetHeight(1);\n  cone->Update();\n  auto bounds = cone->GetOutput()->GetBounds();\n\n  vtkNew<vtkElevationFilter> elevation_filter;\n  elevation_filter->SetLowPoint(0, bounds[2], 0);\n  elevation_filter->SetHighPoint(0, bounds[3], 0);\n  elevation_filter->SetInputConnection(cone->GetOutputPort());\n  // elevation_filter->SetInputConnection(sphere->GetOutputPort());\n\n  auto ctf = GetCTF();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(elevation_filter->GetOutputPort());\n  mapper->SetLookupTable(ctf);\n  mapper->SetColorModeToMapScalars();\n  mapper->InterpolateScalarsBeforeMappingOn();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  ren->AddActor(actor);\n\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkNew<vtkDiscretizableColorTransferFunction> GetCTF()\n{\n  // name: Fast, creator: Francesca Samsel and Alan W. Scott\n  // interpolationspace: lab, interpolationtype: linear, space: RGB\n  // file name: Fast.xml\n\n  vtkNew<vtkDiscretizableColorTransferFunction> ctf;\n\n  ctf->SetColorSpaceToLab();\n  ctf->SetScaleToLinear();\n\n  ctf->SetNanColor(0, 0, 0);\n  ctf->SetAboveRangeColor(0, 0, 0);\n  ctf->UseAboveRangeColorOn();\n  ctf->SetBelowRangeColor(0, 0, 0);\n  ctf->UseBelowRangeColorOn();\n\n  ctf->AddRGBPoint(0, 0.05639999999999999, 0.05639999999999999, 0.47);\n  ctf->AddRGBPoint(0.17159223942480895, 0.24300000000000013, 0.4603500000000004,\n                   0.81);\n  ctf->AddRGBPoint(0.2984914818394138, 0.3568143826543521, 0.7450246485363142,\n                   0.954367702893722);\n  ctf->AddRGBPoint(0.4321287371255907, 0.6882, 0.93, 0.9179099999999999);\n  ctf->AddRGBPoint(0.5, 0.8994959551205902, 0.944646394975174,\n                   0.7686567142818399);\n  ctf->AddRGBPoint(0.5882260353170073, 0.957107977357604, 0.8338185108985666,\n                   0.5089156299842102);\n  ctf->AddRGBPoint(0.7061412605695164, 0.9275207599610714, 0.6214389091739178,\n                   0.31535705838676426);\n  ctf->AddRGBPoint(0.8476395308725272, 0.8, 0.3520000000000001,\n                   0.15999999999999998);\n  ctf->AddRGBPoint(1, 0.59, 0.07670000000000013, 0.11947499999999994);\n\n  ctf->SetNumberOfValues(9);\n  ctf->DiscretizeOff();\n\n  return ctf;\n}\n\n} // namespace\n
"},{"location":"Cxx/Utilities/ColorMapToLUT/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorMapToLUT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorMapToLUT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorMapToLUT MACOSX_BUNDLE ColorMapToLUT.cxx )\n  target_link_libraries(ColorMapToLUT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorMapToLUT\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ColorMapToLUT/#download-and-build-colormaptolut","title":"Download and Build ColorMapToLUT","text":"

Click here to download ColorMapToLUT and its CMakeLists.txt file. Once the tarball ColorMapToLUT.tar has been downloaded and extracted,

cd ColorMapToLUT/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorMapToLUT\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ColorTransferFunction/","title":"ColorTransferFunction","text":"

vtk-examples/Cxx/Utilities/ColorTransferFunction

"},{"location":"Cxx/Utilities/ColorTransferFunction/#description","title":"Description","text":"

This example demonstrates how to map the values (0.0 to 10.0) to the colors (red to green).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ColorTransferFunction/#code","title":"Code","text":"

ColorTransferFunction.cxx

#include <vtkColorTransferFunction.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkColorTransferFunction> colorTransferFunction;\n\n  colorTransferFunction->AddRGBPoint(0.0, 1, 0, 0);\n  colorTransferFunction->AddRGBPoint(10.0, 0, 1, 0);\n\n  double color[3];\n  colorTransferFunction->GetColor(1.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  colorTransferFunction->GetColor(5.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ColorTransferFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorTransferFunction)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorTransferFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorTransferFunction MACOSX_BUNDLE ColorTransferFunction.cxx )\n  target_link_libraries(ColorTransferFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorTransferFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ColorTransferFunction/#download-and-build-colortransferfunction","title":"Download and Build ColorTransferFunction","text":"

Click here to download ColorTransferFunction and its CMakeLists.txt file. Once the tarball ColorTransferFunction.tar has been downloaded and extracted,

cd ColorTransferFunction/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorTransferFunction\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/CommandSubclass/","title":"CommandSubclass","text":"

vtk-examples/Cxx/Utilities/CommandSubclass

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/CommandSubclass/#code","title":"Code","text":"

CommandSubclass.cxx

#include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\n// We wil use these to destroy the timer after maxCounter times.\nunsigned int counter = 0;\nunsigned int maxCounter = 5;\nvtkRenderWindowInteractor* iren;\n\nclass CommandSubclass2 : public vtkCommand\n{\npublic:\n  vtkTypeMacro(CommandSubclass2, vtkCommand);\n\n  static CommandSubclass2* New()\n  {\n    return new CommandSubclass2;\n  }\n\n  void Execute(vtkObject* vtkNotUsed(caller), unsigned long vtkNotUsed(eventId),\n               void* vtkNotUsed(callData))\n  {\n    std::cout << \"Timer callback\" << std::endl;\n    if (counter > maxCounter)\n    {\n      iren->DestroyTimer();\n    }\n    counter++;\n  }\n};\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CommandSubclass\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Initialize must be called prior to creating timer events.\n  renderWindowInteractor->Initialize();\n  iren = renderWindowInteractor;\n\n  vtkNew<CommandSubclass2> timerCallback;\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, timerCallback);\n  auto timerId = renderWindowInteractor->CreateRepeatingTimer(500);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/CommandSubclass/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CommandSubclass)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CommandSubclass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CommandSubclass MACOSX_BUNDLE CommandSubclass.cxx )\n  target_link_libraries(CommandSubclass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CommandSubclass\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/CommandSubclass/#download-and-build-commandsubclass","title":"Download and Build CommandSubclass","text":"

Click here to download CommandSubclass and its CMakeLists.txt file. Once the tarball CommandSubclass.tar has been downloaded and extracted,

cd CommandSubclass/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CommandSubclass\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ConstructTable/","title":"ConstructTable","text":"

vtk-examples/Cxx/Utilities/ConstructTable

"},{"location":"Cxx/Utilities/ConstructTable/#description","title":"Description","text":"

This example creates a 3x3 table. The columns MUST be added first - if you attempt to call AddRow type functions, they will not do anything (or produce errors) because the table still has 0 columns until you tell it otherwise. This example adds 3 empty columns to the table, then goes back and fills them in.

Warning: the table does not copy the data, so if you add the SAME column to the table each time, i.e.

[vtkSmartPointer](https://www.vtk.org/doc/nightly/html/classvtkSmartPointer.html#details)<[vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)Array> col = [vtkSmartPointer](https://www.vtk.org/doc/nightly/html/classvtkSmartPointer.html#details)<[vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)Array>::New();\n\ncol->InsertNextValue([vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)(0.0));\ncol->InsertNextValue([vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)(0.0));\ncol->InsertNextValue([vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)(0.0));\ntable->AddColumn(Col);\ntable->AddColumn(Col);\ntable->AddColumn(Col);\n

If you modify one of the entries in the table with Table->SetValue (r, c, [vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)(counter)); after they have all been set to the same column, the rth entry in EVERY column will be changed.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ConstructTable/#code","title":"Code","text":"

ConstructTable.cxx

#include <vtkNew.h>\n#include <vtkTable.h>\n#include <vtkVariant.h>\n#include <vtkVariantArray.h>\n\nint main(int, char*[])\n{\n  // construct an empty table\n  vtkNew<vtkTable> table;\n\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    vtkNew<vtkVariantArray> col;\n\n    col->InsertNextValue(vtkVariant(0.0));\n    col->InsertNextValue(vtkVariant(0.0));\n    col->InsertNextValue(vtkVariant(0.0));\n    table->AddColumn(col);\n  }\n\n  // fill the table with values\n  unsigned int counter = 0;\n  for (vtkIdType r = 0; r < table->GetNumberOfRows(); r++)\n  {\n    for (vtkIdType c = 0; c < table->GetNumberOfColumns(); c++)\n    {\n      table->SetValue(r, c, vtkVariant(counter));\n      counter++;\n    }\n  }\n\n  // print information about the table\n  std::cout << \"NumRows: \" << table->GetNumberOfRows() << std::endl;\n  std::cout << \"NumCols: \" << table->GetNumberOfColumns() << std::endl;\n\n  // display the table\n  table->Dump(3);\n\n  // access elements of the table\n  for (vtkIdType r = 0; r < table->GetNumberOfRows(); r++)\n  {\n    for (vtkIdType c = 0; c < table->GetNumberOfColumns(); c++)\n    {\n      vtkVariant v = table->GetValue(r, c);\n      std::cout << \"(r,c) = (\" << r << \",\" << c << \") = \" << v << std::endl;\n    }\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ConstructTable/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConstructTable)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConstructTable: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConstructTable MACOSX_BUNDLE ConstructTable.cxx )\n  target_link_libraries(ConstructTable PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConstructTable\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ConstructTable/#download-and-build-constructtable","title":"Download and Build ConstructTable","text":"

Click here to download ConstructTable and its CMakeLists.txt file. Once the tarball ConstructTable.tar has been downloaded and extracted,

cd ConstructTable/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ConstructTable\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/Coordinate/","title":"Coordinate","text":"

vtk-examples/Cxx/Utilities/Coordinate

"},{"location":"Cxx/Utilities/Coordinate/#description","title":"Description","text":"

There are many possible coordinate conversions. This example demonstrates NormalizedDisplay->Display.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/Coordinate/#code","title":"Code","text":"

Coordinate.cxx

#include <vtkCoordinate.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkRenderWindow> rendererWindow;\n\n  vtkNew<vtkRenderer> renderer;\n  rendererWindow->AddRenderer(renderer);\n  rendererWindow->Render();\n\n  vtkNew<vtkCoordinate> coordinate;\n  coordinate->SetCoordinateSystemToNormalizedDisplay();\n  coordinate->SetValue(.5, .5, 0);\n  std::cout << *coordinate << std::endl;\n  std::cout << coordinate->GetCoordinateSystemAsString() << std::endl;\n\n  int* val;\n  val = coordinate->GetComputedDisplayValue(renderer);\n  std::cout << \"Val: \" << val[0] << \" \" << val[1] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/Coordinate/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Coordinate)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Coordinate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Coordinate MACOSX_BUNDLE Coordinate.cxx )\n  target_link_libraries(Coordinate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Coordinate\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/Coordinate/#download-and-build-coordinate","title":"Download and Build Coordinate","text":"

Click here to download Coordinate and its CMakeLists.txt file. Once the tarball Coordinate.tar has been downloaded and extracted,

cd Coordinate/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Coordinate\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/CustomDenseArray/","title":"CustomDenseArray","text":"

vtk-examples/Cxx/Utilities/CustomDenseArray

"},{"location":"Cxx/Utilities/CustomDenseArray/#description","title":"Description","text":"

The only thing you have to do to enable your class to work with vtkDenseArray is add a single line:

operator [vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)() const { return [vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)(); }\n

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/CustomDenseArray/#code","title":"Code","text":"

CustomDenseArray.cxx

#include <vtkDenseArray.h>\n#include <vtkNew.h>\n\nstruct Point\n{\n  double x, y;\n\n  operator vtkVariant() const\n  {\n    return vtkVariant();\n  }\n};\n\nint main(int, char*[])\n{\n  Point point;\n  point.x = 1.0;\n  point.y = 2.0;\n\n  std::cout << point.x << \" \" << point.y << std::endl;\n\n  vtkNew<vtkDenseArray<Point>> array;\n  array->Resize(5, 5);\n\n  array->SetValue(4, 4, point);\n\n  Point retrievedPoint = array->GetValue(4, 4);\n  std::cout << retrievedPoint.x << \" \" << retrievedPoint.y << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/CustomDenseArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CustomDenseArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CustomDenseArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CustomDenseArray MACOSX_BUNDLE CustomDenseArray.cxx )\n  target_link_libraries(CustomDenseArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CustomDenseArray\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/CustomDenseArray/#download-and-build-customdensearray","title":"Download and Build CustomDenseArray","text":"

Click here to download CustomDenseArray and its CMakeLists.txt file. Once the tarball CustomDenseArray.tar has been downloaded and extracted,

cd CustomDenseArray/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CustomDenseArray\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/DataAnimation/","title":"DataAnimation","text":"

vtk-examples/Cxx/Utilities/DataAnimation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Utilities/DataAnimation/#description","title":"Description","text":"

This causes one point of the sphere to be moved outwards at each iteration.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/DataAnimation/#code","title":"Code","text":"

DataAnimation.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProgrammableFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid TimerCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                           void* clientData, void* callData);\n\nunsigned int counter = 0;\nunsigned int maxCount = 6;\n\nvoid AdjustPoints2(void* arguments)\n{\n  std::cout << \"AdjustPoints2\" << std::endl;\n  vtkProgrammableFilter* programmableFilter =\n      static_cast<vtkProgrammableFilter*>(arguments);\n\n  vtkPoints* inPts = programmableFilter->GetPolyDataInput()->GetPoints();\n  vtkIdType numPts = inPts->GetNumberOfPoints();\n  vtkNew<vtkPoints> newPts;\n  newPts->SetNumberOfPoints(numPts);\n\n  for (vtkIdType i = 0; i < numPts; i++)\n  {\n    double p[3];\n    inPts->GetPoint(i, p);\n    newPts->SetPoint(i, p);\n  }\n\n  double p0[3];\n  inPts->GetPoint(0, p0);\n  p0[2] = p0[2] + counter * 0.1;\n  newPts->SetPoint(0, p0);\n\n  programmableFilter->GetPolyDataOutput()->CopyStructure(\n      programmableFilter->GetPolyDataInput());\n  programmableFilter->GetPolyDataOutput()->SetPoints(newPts);\n}\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkProgrammableFilter> programmableFilter;\n  programmableFilter->SetInputConnection(sphereSource->GetOutputPort());\n\n  programmableFilter->SetExecuteMethod(AdjustPoints2, programmableFilter);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(programmableFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DataAnimation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Initialize must be called prior to creating timer events.\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->CreateRepeatingTimer(500);\n\n  vtkNew<vtkCallbackCommand> timerCallback;\n  timerCallback->SetCallback(TimerCallbackFunction);\n  timerCallback->SetClientData(programmableFilter);\n\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, timerCallback);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(2.26841, -1.51874, 1.805);\n  camera->SetFocalPoint(-0.148582, 0.0814323, 0.24803);\n  camera->SetViewUp(0.157813, 0.800687, 0.577923);\n  camera->SetDistance(3.29037);\n  camera->SetClippingRange(1.14823, 5.60288);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid TimerCallbackFunction(vtkObject* caller,\n                           long unsigned int vtkNotUsed(eventId),\n                           void* clientData, void* vtkNotUsed(callData))\n{\n  cout << \"timer callback\" << endl;\n\n  auto programmableFilter = static_cast<vtkProgrammableFilter*>(clientData);\n\n  vtkRenderWindowInteractor* iren =\n      static_cast<vtkRenderWindowInteractor*>(caller);\n\n  programmableFilter->Modified();\n\n  iren->Render();\n\n  if (counter > maxCount)\n  {\n    iren->DestroyTimer();\n  }\n\n  counter++;\n}\n} // namespace\n
"},{"location":"Cxx/Utilities/DataAnimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataAnimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersProgrammable\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataAnimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataAnimation MACOSX_BUNDLE DataAnimation.cxx )\n  target_link_libraries(DataAnimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataAnimation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/DataAnimation/#download-and-build-dataanimation","title":"Download and Build DataAnimation","text":"

Click here to download DataAnimation and its CMakeLists.txt file. Once the tarball DataAnimation.tar has been downloaded and extracted,

cd DataAnimation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DataAnimation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/DataAnimationSubclass/","title":"DataAnimationSubclass","text":"

vtk-examples/Cxx/Utilities/DataAnimationSubclass

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/DataAnimationSubclass/#code","title":"Code","text":"

DataAnimationSubclass.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProgrammableFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nunsigned int counter = 0;\n\nclass CommandSubclass : public vtkCommand\n{\npublic:\n  vtkTypeMacro(CommandSubclass, vtkCommand);\n  static CommandSubclass* New()\n  {\n    return new CommandSubclass;\n  }\n\n  void Execute(vtkObject* caller, unsigned long vtkNotUsed(eventId),\n               void* vtkNotUsed(callData)) override\n  {\n    std::cout << \"Timer callback\" << std::endl;\n\n    vtkRenderWindowInteractor* iren =\n        static_cast<vtkRenderWindowInteractor*>(caller);\n\n    this->ProgrammableFilter->Modified();\n\n    iren->Render();\n\n    if (counter > maxCount)\n    {\n      iren->DestroyTimer();\n    }\n  }\n  vtkSmartPointer<vtkProgrammableFilter> ProgrammableFilter;\n\npublic:\n  unsigned int maxCount = 7;\n};\n\nvoid AdjustPoints(void* arguments);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkProgrammableFilter> programmableFilter;\n  programmableFilter->SetInputConnection(sphereSource->GetOutputPort());\n  programmableFilter->SetExecuteMethod(AdjustPoints, programmableFilter);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(programmableFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DataAnimationWSubclass\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Initialize must be called prior to creating timer events.\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->CreateRepeatingTimer(500);\n\n  vtkNew<CommandSubclass> timerCallback;\n  timerCallback->ProgrammableFilter = programmableFilter;\n\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, timerCallback);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(2.26841, -1.51874, 1.805);\n  camera->SetFocalPoint(-0.148582, 0.0814323, 0.24803);\n  camera->SetViewUp(0.157813, 0.800687, 0.577923);\n  camera->SetDistance(3.29037);\n  camera->SetClippingRange(1.14823, 5.60288);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid AdjustPoints(void* arguments)\n{\n  std::cout << \"AdjustPoints\" << std::endl;\n  auto programmableFilter = static_cast<vtkProgrammableFilter*>(arguments);\n\n  vtkPoints* inPts = programmableFilter->GetPolyDataInput()->GetPoints();\n  vtkIdType numPts = inPts->GetNumberOfPoints();\n  vtkNew<vtkPoints> newPts;\n  newPts->SetNumberOfPoints(numPts);\n\n  for (vtkIdType i = 0; i < numPts; i++)\n  {\n    double p[3];\n    inPts->GetPoint(i, p);\n    newPts->SetPoint(i, p);\n  }\n\n  double p0[3];\n  inPts->GetPoint(0, p0);\n  p0[2] = p0[2] + counter * 0.1;\n  newPts->SetPoint(0, p0);\n\n  programmableFilter->GetPolyDataOutput()->CopyStructure(\n      programmableFilter->GetPolyDataInput());\n  programmableFilter->GetPolyDataOutput()->SetPoints(newPts);\n  counter++;\n}\n\n} // namespace\n
"},{"location":"Cxx/Utilities/DataAnimationSubclass/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataAnimationSubclass)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersProgrammable\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataAnimationSubclass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataAnimationSubclass MACOSX_BUNDLE DataAnimationSubclass.cxx )\n  target_link_libraries(DataAnimationSubclass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataAnimationSubclass\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/DataAnimationSubclass/#download-and-build-dataanimationsubclass","title":"Download and Build DataAnimationSubclass","text":"

Click here to download DataAnimationSubclass and its CMakeLists.txt file. Once the tarball DataAnimationSubclass.tar has been downloaded and extracted,

cd DataAnimationSubclass/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DataAnimationSubclass\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/DeepCopy/","title":"DeepCopy","text":"

vtk-examples/Cxx/Utilities/DeepCopy

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/DeepCopy/#code","title":"Code","text":"

DeepCopy.cxx

#include <vtkNew.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPolyData> polydata;\n\n  vtkNew<vtkPolyData> polydataCopy;\n\n  polydataCopy->DeepCopy(polydata);\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/DeepCopy/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DeepCopy)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DeepCopy: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DeepCopy MACOSX_BUNDLE DeepCopy.cxx )\n  target_link_libraries(DeepCopy PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DeepCopy\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/DeepCopy/#download-and-build-deepcopy","title":"Download and Build DeepCopy","text":"

Click here to download DeepCopy and its CMakeLists.txt file. Once the tarball DeepCopy.tar has been downloaded and extracted,

cd DeepCopy/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DeepCopy\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/DenseArrayRange/","title":"DenseArrayRange","text":"

vtk-examples/Cxx/Utilities/DenseArrayRange

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/DenseArrayRange/#code","title":"Code","text":"

DenseArrayRange.cxx

#include <vtkDenseArray.h>\n#include <vtkNew.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDenseArray<double>> array;\n  array->Resize(5, 1);\n\n  for (unsigned int i = 0; i < 5; i++)\n  {\n    array->SetValue(i, 0, 2.0 + i);\n    double val = array->GetValue(i, 0);\n    std::cout << \"val: \" << val << std::endl;\n  }\n\n  // int extent = array->GetExtents()[1];\n  int dim1start = array->GetExtent(0).GetBegin();\n  int dim1end = array->GetExtent(0).GetEnd();\n  std::cout << \"dim1: \" << dim1start << \" to \" << dim1end << std::endl;\n  // int dim2 = array->GetExtent(1)[1];\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/DenseArrayRange/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DenseArrayRange)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DenseArrayRange: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DenseArrayRange MACOSX_BUNDLE DenseArrayRange.cxx )\n  target_link_libraries(DenseArrayRange PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DenseArrayRange\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/DenseArrayRange/#download-and-build-densearrayrange","title":"Download and Build DenseArrayRange","text":"

Click here to download DenseArrayRange and its CMakeLists.txt file. Once the tarball DenseArrayRange.tar has been downloaded and extracted,

cd DenseArrayRange/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DenseArrayRange\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/DetermineActorType/","title":"DetermineActorType","text":"

vtk-examples/Cxx/Utilities/DetermineActorType

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/DetermineActorType/#code","title":"Code","text":"

DetermineActorType.cxx

#include <vtkActor.h>\n#include <vtkActorCollection.h>\n#include <vtkCamera.h>\n#include <vtkCubeAxesActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Cube axes\n  vtkNew<vtkCubeAxesActor> cubeAxesActor;\n\n  // Create a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  cubeAxesActor->SetCamera(renderer->GetActiveCamera());\n  cubeAxesActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  renderer->AddActor(actor);\n  renderer->AddActor(cubeAxesActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Determine the types of the actors - method 1\n  {\n    std::cout << \"Method 1:\" << std::endl;\n    vtkActorCollection* actorCollection = renderer->GetActors();\n    actorCollection->InitTraversal();\n\n    for (vtkIdType i = 0; i < actorCollection->GetNumberOfItems(); i++)\n    {\n      vtkActor* nextActor = actorCollection->GetNextActor();\n      std::cout << \"nextActor \" << i << \" : \" << nextActor->GetClassName()\n                << std::endl;\n      std::string className = nextActor->GetClassName();\n      std::string wantedClass = \"vtkCubeAxesActor\";\n      if (className == wantedClass)\n      {\n        std::cout << \"nextActor \" << i << \" is a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n      else\n      {\n        std::cout << \"nextActor \" << i << \" is NOT a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n    }\n  }\n\n  // Determine the types of the actors - method 2\n  {\n    std::cout << \"Method 2:\" << std::endl;\n    vtkActorCollection* actorCollection = renderer->GetActors();\n    actorCollection->InitTraversal();\n\n    for (vtkIdType i = 0; i < actorCollection->GetNumberOfItems(); i++)\n    {\n      vtkActor* nextActor = actorCollection->GetNextActor();\n      std::cout << \"nextActor \" << i << \" : \" << nextActor->GetClassName()\n                << std::endl;\n      if (nextActor->IsA(\"vtkCubeAxesActor\"))\n      {\n        std::cout << \"nextActor \" << i << \" is a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n      else\n      {\n        std::cout << \"nextActor \" << i << \" is NOT a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n    }\n  }\n\n  // Determine the types of the actors - method 3\n  {\n    std::cout << \"Method 3:\" << std::endl;\n    vtkActorCollection* actorCollection = renderer->GetActors();\n    actorCollection->InitTraversal();\n\n    for (vtkIdType i = 0; i < actorCollection->GetNumberOfItems(); i++)\n    {\n      vtkActor* nextActor = actorCollection->GetNextActor();\n      std::cout << \"nextActor \" << i << \" : \" << nextActor->GetClassName()\n                << std::endl;\n\n      if (dynamic_cast<vtkCubeAxesActor*>(nextActor) != 0)\n      {\n        std::cout << \"nextActor \" << i << \" is a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n      else\n      {\n        std::cout << \"nextActor \" << i << \" is NOT a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n    }\n  }\n\n  // Determine the types of the actors - method 4\n  {\n    std::cout << \"Method 4:\" << std::endl;\n    vtkActorCollection* actorCollection = renderer->GetActors();\n    actorCollection->InitTraversal();\n\n    for (vtkIdType i = 0; i < actorCollection->GetNumberOfItems(); i++)\n    {\n      vtkActor* nextActor = actorCollection->GetNextActor();\n      std::cout << \"nextActor \" << i << \" : \" << nextActor->GetClassName()\n                << std::endl;\n\n      if (dynamic_cast<vtkCubeAxesActor*>(nextActor) != 0)\n      {\n        std::cout << \"nextActor \" << i << \" is a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n      else\n      {\n        std::cout << \"nextActor \" << i << \" is NOT a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n    }\n  }\n\n  // Render the scene\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DetermineActorType\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(0, 0, 8.09748);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 1, 0);\n  camera->SetDistance(8.09748);\n  camera->SetClippingRange(6.0265, 10.7239);\n\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/DetermineActorType/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DetermineActorType)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DetermineActorType: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DetermineActorType MACOSX_BUNDLE DetermineActorType.cxx )\n  target_link_libraries(DetermineActorType PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DetermineActorType\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/DetermineActorType/#download-and-build-determineactortype","title":"Download and Build DetermineActorType","text":"

Click here to download DetermineActorType and its CMakeLists.txt file. Once the tarball DetermineActorType.tar has been downloaded and extracted,

cd DetermineActorType/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DetermineActorType\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/DiscretizableColorTransferFunction/","title":"DiscretizableColorTransferFunction","text":"

vtk-examples/Cxx/Utilities/DiscretizableColorTransferFunction

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/DiscretizableColorTransferFunction/#code","title":"Code","text":"

DiscretizableColorTransferFunction.cxx

#include <vtkDiscretizableColorTransferFunction.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDiscretizableColorTransferFunction>\n      discretizableColorTransferFunction;\n\n  discretizableColorTransferFunction->DiscretizeOn();\n  discretizableColorTransferFunction->SetNumberOfValues(2);\n\n  discretizableColorTransferFunction->AddRGBPoint(0.0, 1, 0, 0);\n  discretizableColorTransferFunction->AddRGBPoint(10.0, 0, 1, 0);\n  discretizableColorTransferFunction->Build();\n\n  double color[3];\n  discretizableColorTransferFunction->GetColor(1.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  discretizableColorTransferFunction->GetColor(5.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/DiscretizableColorTransferFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DiscretizableColorTransferFunction)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DiscretizableColorTransferFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DiscretizableColorTransferFunction MACOSX_BUNDLE DiscretizableColorTransferFunction.cxx )\n  target_link_libraries(DiscretizableColorTransferFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DiscretizableColorTransferFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/DiscretizableColorTransferFunction/#download-and-build-discretizablecolortransferfunction","title":"Download and Build DiscretizableColorTransferFunction","text":"

Click here to download DiscretizableColorTransferFunction and its CMakeLists.txt file. Once the tarball DiscretizableColorTransferFunction.tar has been downloaded and extracted,

cd DiscretizableColorTransferFunction/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DiscretizableColorTransferFunction\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ExtractArrayComponent/","title":"ExtractArrayComponent","text":"

vtk-examples/Cxx/Utilities/ExtractArrayComponent

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ExtractArrayComponent/#code","title":"Code","text":"

ExtractArrayComponent.cxx

#include <vtkArrayCalculator.h>\n#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(2.0, 0.0, 0.0);\n  points->InsertNextPoint(3.0, 0.0, 0.0);\n\n  vtkNew<vtkDoubleArray> array;\n  array->SetName(\"InputArray\");\n  array->SetNumberOfComponents(3);\n  array->InsertNextTuple3(1, 10, 100);\n  array->InsertNextTuple3(2, 20, 200);\n  array->InsertNextTuple3(3, 30, 300);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->AddArray(array);\n\n  vtkNew<vtkArrayCalculator> arrayCalculator;\n  arrayCalculator->SetInputData(polydata);\n  arrayCalculator->AddVectorArrayName(\"InputArray\");\n  // Extract component '1' from the InputArray by\n  // taking the dot product of each tuple with the\n  // vector (0,1,0)\n  arrayCalculator->SetFunction(\"dot(InputArray,jHat)\");\n  arrayCalculator->SetResultArrayName(\"OutputArray\");\n  arrayCalculator->Update();\n\n  vtkSmartPointer<vtkDoubleArray> outputArray = dynamic_cast<vtkDoubleArray*>(\n      arrayCalculator->GetPolyDataOutput()->GetPointData()->GetArray(\n          \"OutputArray\"));\n\n  for (vtkIdType i = 0; i < outputArray->GetNumberOfTuples(); i++)\n  {\n    double val = outputArray->GetValue(i);\n    std::cout << \"output value \" << i << \": \" << val << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ExtractArrayComponent/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractArrayComponent)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractArrayComponent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractArrayComponent MACOSX_BUNDLE ExtractArrayComponent.cxx )\n  target_link_libraries(ExtractArrayComponent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractArrayComponent\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ExtractArrayComponent/#download-and-build-extractarraycomponent","title":"Download and Build ExtractArrayComponent","text":"

Click here to download ExtractArrayComponent and its CMakeLists.txt file. Once the tarball ExtractArrayComponent.tar has been downloaded and extracted,

cd ExtractArrayComponent/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractArrayComponent\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ExtractFaces/","title":"ExtractFaces","text":"

vtk-examples/Cxx/Utilities/ExtractFaces

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ExtractFaces/#code","title":"Code","text":"

ExtractFaces.cxx

#include <vtkCellIterator.h>\n#include <vtkCellTypes.h>\n#include <vtkGenericCell.h>\n#include <vtkPointSet.h>\n#include <vtkXMLGenericDataObjectReader.h>\n\n#include <iostream>\n#include <map>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  std::map<std::string, int> cellMap;\n\n  for (int arg = 1; arg < argc; ++arg)\n  {\n    auto reader = vtkSmartPointer<vtkXMLGenericDataObjectReader>::New();\n    reader->SetFileName(argv[arg]);\n    reader->Update();\n\n    //    vtkPointSet *pointSet =\n    //    vtkPointSet::SafeDownCast(reader->GetOutput());;\n    vtkPointSet* pointSet = dynamic_cast<vtkPointSet*>(reader->GetOutput());\n    ;\n    auto it = pointSet->NewCellIterator();\n    for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n    {\n      auto cell = vtkSmartPointer<vtkGenericCell>::New();\n      it->GetCell(cell);\n      std::string cellName =\n          vtkCellTypes::GetClassNameFromTypeId(cell->GetCellType());\n      if (cellMap.count(cellName) == 0)\n      {\n        std::cout << \"Type: \" << cellName << \" has \" << cell->GetNumberOfFaces()\n                  << \" faces\" << std::endl;\n      }\n      cellMap[cellName]++;\n    }\n    it->Delete();\n  }\n  for (auto itm = cellMap.begin(); itm != cellMap.end(); ++itm)\n  {\n    std::cout << itm->first << \" occurs \" << itm->second << \" times\"\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ExtractFaces/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractFaces)\n\nfind_package(VTK COMPONENTS \n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractFaces: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractFaces MACOSX_BUNDLE ExtractFaces.cxx )\n  target_link_libraries(ExtractFaces PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractFaces\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ExtractFaces/#download-and-build-extractfaces","title":"Download and Build ExtractFaces","text":"

Click here to download ExtractFaces and its CMakeLists.txt file. Once the tarball ExtractFaces.tar has been downloaded and extracted,

cd ExtractFaces/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractFaces\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/FileOutputWindow/","title":"FileOutputWindow","text":"

vtk-examples/Cxx/Utilities/FileOutputWindow

"},{"location":"Cxx/Utilities/FileOutputWindow/#description","title":"Description","text":"

This example shows how to pipe error output to a text file instead of the usual vtk pop-up window.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/FileOutputWindow/#code","title":"Code","text":"

FileOutputWindow.cxx

#include <vtkFileOutputWindow.h>\n#include <vtkNew.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFileOutputWindow> fileOutputWindow;\n  fileOutputWindow->SetFileName(\"output.txt\");\n\n  // Note that the SetInstance function is a static member of vtkOutputWindow.\n  vtkOutputWindow::SetInstance(fileOutputWindow);\n\n  // This causes an error intentionally (file name not specified) - this error\n  // will be written to the file output.txt\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->Update();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/FileOutputWindow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FileOutputWindow)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FileOutputWindow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FileOutputWindow MACOSX_BUNDLE FileOutputWindow.cxx )\n  target_link_libraries(FileOutputWindow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FileOutputWindow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/FileOutputWindow/#download-and-build-fileoutputwindow","title":"Download and Build FileOutputWindow","text":"

Click here to download FileOutputWindow and its CMakeLists.txt file. Once the tarball FileOutputWindow.tar has been downloaded and extracted,

cd FileOutputWindow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FileOutputWindow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/FilenameFunctions/","title":"FilenameFunctions","text":"

vtk-examples/Cxx/Utilities/FilenameFunctions

"},{"location":"Cxx/Utilities/FilenameFunctions/#description","title":"Description","text":"

This example gets a list of all files in a directory. It then extracts the file extension and filename from each string.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/FilenameFunctions/#code","title":"Code","text":"

FilenameFunctions.cxx

#include <string>\n#include <vtkDirectory.h>\n#include <vtkNew.h>\n#include <vtksys/SystemTools.hxx>\n\nint main(int argc, char* argv[])\n{\n  std::string directoryName;\n  if (argc < 2)\n  {\n    directoryName = std::string(\".\");\n  }\n  else\n  {\n    directoryName = std::string(argv[1]);\n  }\n\n  vtkNew<vtkDirectory> directory;\n  int opened = directory->Open(directoryName.c_str());\n\n  if (!opened)\n  {\n    std::cout << \"Invalid directory!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int numberOfFiles = directory->GetNumberOfFiles();\n  std::cout << \"Number of files: \" << numberOfFiles << std::endl;\n\n  for (int i = 0; i < numberOfFiles; i++)\n  {\n    std::string fileString = directoryName;\n    fileString += \"/\";\n    fileString += directory->GetFile(i);\n\n    std::string ext = vtksys::SystemTools::GetFilenameLastExtension(fileString);\n    std::cout << fileString << \" extension: \" << ext << std::endl;\n\n    std::string name =\n        vtksys::SystemTools::GetFilenameWithoutLastExtension(fileString);\n    std::cout << \"name: \" << name << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/FilenameFunctions/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FilenameFunctions)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonSystem\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FilenameFunctions: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FilenameFunctions MACOSX_BUNDLE FilenameFunctions.cxx )\n  target_link_libraries(FilenameFunctions PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FilenameFunctions\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/FilenameFunctions/#download-and-build-filenamefunctions","title":"Download and Build FilenameFunctions","text":"

Click here to download FilenameFunctions and its CMakeLists.txt file. Once the tarball FilenameFunctions.tar has been downloaded and extracted,

cd FilenameFunctions/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FilenameFunctions\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ForLoop/","title":"ForLoop","text":"

vtk-examples/Cxx/Utilities/ForLoop

"},{"location":"Cxx/Utilities/ForLoop/#description","title":"Description","text":"

As a result of historical and evolving C++ standards there are are multiple ways of doing the same thing with vtkDataArrays in the VTK C++ code base. This example demonstrates various ways of iterating through a vtkDataArray and operating on the resultant tuple to create a new result. The result of the operation is inserted into a new vtkDataArray.

In this example, all the functions operate on a vtkTypeFloat64Array of vectors to compute a vtkTypeFloat64Array of magnitudes. We also test to ensure the correct magnitudes are generated.

This example demonstrates:

  • The classic for loop e.g. for (auto c = 0; c < 3; ++c) and static_cast.

    • naivemag3, demonstrates the classic for loop using a counter.
    • mag3GetPointer, uses raw pointers, it becomes a little complicated calling mag3Trampoline which then calls mag3Helper. Lots of static_cast has to be used.
    • mag3Explicit, instantiate a templated function with explicit types. It is similar to naivemag3.
  • A dispatcher/worker paradigm. This is the recommended approach. In the dispatcher function, we instantiate a worker. Then we use vtkArrayDispatch to generate optimised workers when the arrays are both float or double and fall back to just using the worker for other situations.

    • mag3Dispatch1 instantiates the struct Mag3Worker1 where we use accessors, APIType and assume the tuple sizes.
    • mag3Dispatch2a instantiates the struct Mag3Worker2a where range objects are used.
    • mag3Dispatch2b instantiates the struct Mag3Worker2b where range objects are used. Here ReferenceType and ConstReferenceType are used. Also elements in the range are accessed using operator[] like a STL indexed container.
    • mag3Dispatch3 instantiates the struct Mag3Worker3 where range objects are used. Here ValueType and ConstReferenceType are used. We also create a lambda to calculate the magnitude for each tuple. This is then used in std::transform to generate the magnitudes.

Refer to Further reading for more information.

Note that VTK provides a (not so well known) series of templated data types that are especially useful when dealing with data from other sources:

  • vtkTypeFloat32Array, vtkTypeFloat64Array,
  • vtkTypeInt8Array, vtkTypeInt64Array,
  • vtkTypeUInt8Array, vtkTypeUInt64Array
"},{"location":"Cxx/Utilities/ForLoop/#best-practice","title":"Best Practice","text":"

Yohann Bearzi has provided the following guidelines for best practices:

  • Whenever you hold a vtkDataArray for which you don't know the underlying type (i.e. you cannot safely vtkArrayDownCast), you should use vtkArrayDispatch and write your accesses in a functor. This prevents a bunch of implicit static_cast.
  • Whenever you hold a vtkDataArray on which you know the underlying type (ghost arrays for instance vtkUnsignedCharArray, or global ids vtkIdTypeArray), you should use vtkArrayDownCast.
  • When you finally hold a typed instance of vtkDataArray:

    • If the array only holds values (tuples with one component), use GetValue.
    • If the array holds tuples, you can prevent a copy for each access with AOS arrays by using vtk::ArrayTupleRange. In this case, the pointer of the corresponding tuple in the array is directly used for access.

If you want to use STL algorithms, such as std::transform or std::sort, convert your downcasted array into a range and proceed.

If you know at compile time how many components are in your array, you should template vtk::ArrayTupleRange and vtk::ArrayValueRange with the number of components (3 for 3D points, for instance).

It is left as an exercise for the reader to identify best practices in the example.

"},{"location":"Cxx/Utilities/ForLoop/#thanks","title":"Thanks","text":"

Special thanks must go to wangzhezhe for developing the source code on which this example is based, see this discourse article: get the raw pointer from the vtkPoints, the original source code is here: forloops.cpp.

"},{"location":"Cxx/Utilities/ForLoop/#further-reading","title":"Further reading","text":"

For further reading please see:

  • Working with vtkDataArrays: 2019 Edition
  • C++11 for-range support in VTK
  • New Data Array Layouts in VTK 7.1

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ForLoop/#code","title":"Code","text":"

ForLoop.cxx

#include <vtkArrayDispatch.h>\n#include <vtkDataArrayAccessor.h>\n#include <vtkDataArrayRange.h>\n#include <vtkNew.h>\n#include <vtkTypeFloat64Array.h>\n\n#include <algorithm>\n#include <array>\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <type_traits>\n#include <vector>\n\nnamespace {\n\n// Using naive way to go through the array.\nvoid naivemag3(vtkDataArray* vectors, vtkDataArray* magnitudes);\n\n// GetVoidPointer, mag3GetPointer call mag3Trampoline then call mag3Helper\nvoid mag3GetPointer(vtkDataArray* vecs, vtkDataArray* mags);\n\ntemplate <typename VecType>\nvoid mag3Trampoline(VecType* vecs, vtkDataArray* mags, vtkIdType numTuples);\n\ntemplate <typename VecType, typename MagType>\nvoid mag3Helper(VecType* vecs, MagType* mags, vtkIdType numTuples);\n\n// mag3 explicit types\ntemplate <typename ArrayT1, typename ArrayT2>\nvoid mag3Explicit(ArrayT1* vectors, ArrayT2* magnitudes);\n\nstruct Mag3Worker1\n{\n  template <typename VecArray, typename MagArray>\n  void operator()(VecArray* vecs, MagArray* mags)\n  {\n    // The Accessor types:\n    using VecAccess = vtkDataArrayAccessor<VecArray>;\n    using MagAccess = vtkDataArrayAccessor<MagArray>;\n\n    // The \"APITypes\"\n    // (explicit-type when possible, double for plain vtkDataArrays)\n    using VecType = typename VecAccess::APIType;\n    using MagType = typename MagAccess::APIType;\n\n    // Tell the compiler the tuple sizes to enable optimizations:\n    VTK_ASSUME(vecs->GetNumberOfComponents() == 3);\n    VTK_ASSUME(mags->GetNumberOfComponents() == 1);\n\n    const vtkIdType numTuples = vecs->GetNumberOfTuples();\n\n    VecAccess vecAccess{vecs};\n    MagAccess magAccess{mags};\n\n    for (vtkIdType t = 0; t < numTuples; ++t)\n    {\n      MagType mag = 0;\n      for (int c = 0; c < 3; ++c)\n      {\n        VecType comp = vecAccess.Get(t, c);\n        auto cc = static_cast<MagType>(comp);\n        mag += cc * cc;\n      }\n      mag = std::sqrt(mag);\n      magAccess.Set(t, 0, mag);\n    }\n  }\n};\n\nstruct Mag3Worker2a\n{\n  template <typename VecArray, typename MagArray>\n  void operator()(VecArray* vecs, MagArray* mags)\n  {\n    // Create range objects:\n    // Refer to this:\n    // https://vtk.org/doc/nightly/html/classvtkArrayDispatch.html\n    const auto vecRange = vtk::DataArrayTupleRange<3>(vecs);\n    auto magRange = vtk::DataArrayValueRange<1>(mags);\n\n    using VecType = typename decltype(vecRange)::ComponentType;\n    using MagType = typename decltype(magRange)::ValueType;\n\n    auto magIter = magRange.begin();\n    for (const auto& vecTuple : vecRange)\n    {\n      MagType mag = 0;\n      for (const VecType comp : vecTuple)\n      {\n        auto c = static_cast<MagType>(comp);\n        mag += c * c;\n      }\n      *magIter = std::sqrt(mag);\n      magIter++;\n    }\n  }\n};\n\n/**\n * This is similar to MagWorker2a but demonstrates the use of ReferenceType and\n * ConstReferenceType.\n *\n * Also elements in the range are accessed using operator[]\n * like an stl indexed container.\n *\n */\nstruct Mag3Worker2b\n{\n  template <typename VecArray, typename MagArray>\n  void operator()(VecArray* vecs, MagArray* mags)\n  {\n    // Create range objects:\n    const auto vecRange = vtk::DataArrayTupleRange<3>(vecs);\n    auto magRange = vtk::DataArrayValueRange<1>(mags);\n\n    using VecConstTupleRef =\n        typename decltype(vecRange)::ConstTupleReferenceType;\n    using VecConstCompRef =\n        typename decltype(vecRange)::ConstComponentReferenceType;\n    using MagRef = typename decltype(magRange)::ReferenceType;\n    using MagType = typename decltype(magRange)::ValueType;\n\n    for (vtkIdType id = 0; id < vecRange.size(); ++id)\n    {\n      MagRef magRef = magRange[id] = 0;\n      VecConstTupleRef vecTuple = vecRange[id];\n      for (VecConstCompRef&& comp : vecTuple)\n      {\n        auto c = static_cast<MagType>(comp);\n        magRef += c * c;\n      }\n      magRef = std::sqrt(magRef);\n    }\n  }\n};\n\n/**\n * Here we create a functor for use by std::transform.\n *\n */\nstruct Mag3Worker3\n{\n  template <typename VecArray, typename MagArray>\n  void operator()(VecArray* vecs, MagArray* mags)\n  {\n    // Create range objects:\n    const auto vecRange = vtk::DataArrayTupleRange<3>(vecs);\n    auto magRange = vtk::DataArrayValueRange<1>(mags);\n\n    using VecConstTupleRef =\n        typename decltype(vecRange)::ConstTupleReferenceType;\n    using MagType = typename decltype(magRange)::ValueType;\n\n    // Per-tuple magnitude functor for std::transform:\n    auto computeMag = [](VecConstTupleRef tuple) -> MagType {\n      MagType mag = 0;\n      for (const auto& comp : tuple)\n      {\n        auto c = static_cast<MagType>(comp);\n        mag += c * c;\n      }\n      return std::sqrt(mag);\n    };\n\n    std::transform(vecRange.cbegin(), vecRange.cend(), magRange.begin(),\n                   computeMag);\n  }\n};\n\nvoid mag3Dispatch1(vtkDataArray* vecs, vtkDataArray* mags);\n\nvoid mag3Dispatch2a(vtkDataArray* vecs, vtkDataArray* mags);\n\nvoid mag3Dispatch2b(vtkDataArray* vecs, vtkDataArray* mags);\n\nvoid mag3Dispatch3(vtkDataArray* vecs, vtkDataArray* mags);\n\nbool verifyResults(vtkDataArray* magnitudes,\n                   std::vector<std::string> const& expectedMagnitudes);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // The data and the result arrays.\n  // Of course you can use:\n  // vtkNew<vtkDoubleArray> darray;\n  // vtkNew<vtkDoubleArray> results;\n  // However, lets use the VTK templated data types:\n  vtkNew<vtkTypeFloat64Array> darray;\n  vtkNew<vtkTypeFloat64Array> results;\n\n  // The number of components must be set in advance.\n  darray->SetNumberOfComponents(3);\n  results->SetNumberOfComponents(1);\n\n  int TupleNum = 10;\n\n  darray->SetNumberOfTuples(TupleNum);\n  results->SetNumberOfTuples(TupleNum);\n\n  auto printTuple = [](const std::array<vtkTypeFloat64, 3> tuple) {\n    std::ostringstream os;\n    auto separator = \"\";\n    auto const sep = \", \";\n    for (const auto& t : tuple)\n    {\n      os.setf(ios::fixed, ios::floatfield);\n      os << std::setprecision(1) << separator << t;\n      separator = sep;\n    }\n    return os.str();\n  };\n\n  for (vtkIdType i = 0; i < TupleNum; i++)\n  {\n    std::array<vtkTypeFloat64, 3> tuple = {{i * 0.1, i * 0.2, i * 0.3}};\n    // std::cout << printTuple(tuple) << std::endl;\n\n    // If the number of tuples is not set in advance, we can use InsertTuple.\n    // darray->InsertTuple(i, tuple.data());\n    darray->SetTuple(i, tuple.data());\n  }\n\n  // Set up for testing.\n  std::vector<std::string> expectedMagnitudes{\n      \"0.000000\", \"0.374166\", \"0.748331\", \"1.122497\", \"1.496663\",\n      \"1.870829\", \"2.244994\", \"2.619160\", \"2.993326\", \"3.367492\"};\n  std::string failMessage =\n      \"---         Fail: Results don't match expected values.\";\n  auto exitValue = EXIT_SUCCESS;\n\n  // We could explicitly specify the capture list:\n  //  [&exitValue, &results, &expectedMagnitudes, &failMessage]\n  //  instead of just [&].\n  auto checkResult = [&]() {\n    if (!verifyResults(results, expectedMagnitudes))\n    {\n      std::cout << failMessage << std::endl;\n      exitValue = EXIT_FAILURE;\n    }\n  };\n\n  auto resetResults = [&]() {\n    for (vtkIdType i = 0; i < TupleNum; i++)\n    {\n      vtkTypeFloat64 v = 0;\n      results->SetTuple(i, &v);\n    }\n  };\n\n  // Using naive API.\n  naivemag3(darray, results);\n  checkResult();\n\n  // Reset results to zero.\n  resetResults();\n\n  // Using get raw pointer.\n  mag3GetPointer(darray, results);\n  checkResult();\n\n  // Reset results to zero.\n  resetResults();\n\n  // Instantiate with explicit type.\n  mag3Explicit<vtkTypeFloat64Array, vtkTypeFloat64Array>(darray, results);\n  checkResult();\n\n  // Worker and dispatcher, there are four different types of worker.\n  mag3Dispatch1(darray, results);\n  checkResult();\n\n  mag3Dispatch2a(darray, results);\n  checkResult();\n\n  mag3Dispatch2b(darray, results);\n  checkResult();\n\n  mag3Dispatch3(darray, results);\n  checkResult();\n\n  if (exitValue == EXIT_SUCCESS)\n  {\n    std::cout << \"All tests passed.\" << std::endl;\n  }\n  else\n  {\n    std::cout << \"Some tests failed.\" << std::endl;\n  }\n  return exitValue;\n}\n\nnamespace {\n\nvoid naivemag3(vtkDataArray* vectors, vtkDataArray* magnitudes)\n{\n  std::cout << \"--- Testing naivemag3\" << std::endl;\n  const vtkIdType numTuples = vectors->GetNumberOfTuples();\n  std::array<vtkTypeFloat64, 3> tuple;\n  for (vtkIdType t = 0; t < numTuples; ++t)\n  {\n    vectors->GetTuple(t, tuple.data());\n    vtkTypeFloat64 mag = 0.;\n    for (vtkTypeFloat64 comp : tuple)\n    {\n      // std::cout << \"comp \" << comp << std::endl;\n      mag += comp * comp;\n    }\n    mag = std::sqrt(mag);\n    // Assume that space is allocated.\n    magnitudes->SetTuple(t, &mag);\n  }\n}\n\n// GetVoidPointer, mag3GetPointer call mag3Trampoline then call mag3Helper\nvoid mag3GetPointer(vtkDataArray* vecs, vtkDataArray* mags)\n{\n  std::cout << \"--- Testing mag3GetPointer\" << std::endl;\n  const vtkIdType numTuples = vecs->GetNumberOfTuples();\n  // Resolve vecs data type:\n  switch (vecs->GetDataType())\n  {\n    vtkTemplateMacro(mag3Trampoline(\n        static_cast<VTK_TT*>(vecs->GetVoidPointer(0)), mags, numTuples));\n  default:\n    std::cout << \"error at mag3GetPointer\" << std::endl;\n  }\n}\n\ntemplate <typename VecType>\nvoid mag3Trampoline(VecType* vecs, vtkDataArray* mags, vtkIdType numTuples)\n{\n  // Resolve mags data type:\n  switch (mags->GetDataType())\n  {\n    vtkTemplateMacro(mag3Helper(\n        vecs, static_cast<VTK_TT*>(mags->GetVoidPointer(0)), numTuples));\n  default:\n    std::cout << \"error at mag3Trampoline\" << std::endl;\n  }\n}\n\ntemplate <typename VecType, typename MagType>\nvoid mag3Helper(VecType* vecs, MagType* mags, vtkIdType numTuples)\n{\n  for (vtkIdType t = 0; t < numTuples; ++t)\n  {\n    MagType mag = 0;\n    for (size_t i = 0; i < 3; ++i)\n    {\n      auto v = static_cast<MagType>(*vecs);\n      mag += v * v;\n      ++vecs;\n    }\n    *mags = std::sqrt(mag);\n    ++mags;\n  }\n}\n\ntemplate <typename ArrayT1, typename ArrayT2>\nvoid mag3Explicit(ArrayT1* vectors, ArrayT2* magnitudes)\n\n{\n  std::cout << \"--- Testing mag3Explicit\" << std::endl;\n  using VecType = typename ArrayT1::ValueType;\n  using MagType = typename ArrayT2::ValueType;\n\n  const vtkIdType numTuples = vectors->GetNumberOfTuples();\n\n  for (vtkIdType t = 0; t < numTuples; ++t)\n  {\n    MagType mag = 0;\n    for (int c = 0; c < 3; ++c)\n    {\n      VecType comp = vectors->GetTypedComponent(t, c);\n      mag += static_cast<MagType>(comp * comp);\n    }\n    mag = std::sqrt(mag);\n    magnitudes->SetTypedComponent(t, 0, mag);\n  }\n}\n\nvoid mag3Dispatch1(vtkDataArray* vecs, vtkDataArray* mags)\n{\n  std::cout << \"--- Testing mag3Dispatch1\" << std::endl;\n  Mag3Worker1 worker1;\n\n  // Create a dispatcher. We want to generate fast-paths for when\n  // vecs and mags both use doubles or floats, but fallback to a\n  // slow path for any other situation.\n  using Dispatcher =\n      vtkArrayDispatch::Dispatch2ByValueType<vtkArrayDispatch::Reals,\n                                             vtkArrayDispatch::Reals>;\n\n  if (!Dispatcher::Execute(vecs, mags, worker1))\n  {\n    // Otherwise fallback to using the vtkDataArray API.\n    worker1(vecs, mags);\n  }\n}\n\nvoid mag3Dispatch2a(vtkDataArray* vecs, vtkDataArray* mags)\n{\n  std::cout << \"--- Testing mag3Dispatch2a\" << std::endl;\n  Mag3Worker2a worker2a;\n\n  // Create a dispatcher. We want to generate fast-paths for when\n  // vecs and mags both use doubles or floats, but fallback to a\n  // slow path for any other situation.\n  using Dispatcher =\n      vtkArrayDispatch::Dispatch2ByValueType<vtkArrayDispatch::Reals,\n                                             vtkArrayDispatch::Reals>;\n\n  // Generate optimized workers when mags/vecs are both float|double\n  if (!Dispatcher::Execute(vecs, mags, worker2a))\n  {\n    // Otherwise fallback to using the vtkDataArray API.\n    worker2a(vecs, mags);\n  }\n}\n\nvoid mag3Dispatch2b(vtkDataArray* vecs, vtkDataArray* mags)\n{\n  std::cout << \"--- Testing mag3Dispatch2b\" << std::endl;\n  Mag3Worker2b worker2b;\n\n  // Create a dispatcher. We want to generate fast-paths for when\n  // vecs and mags both use doubles or floats, but fallback to a\n  // slow path for any other situation.\n  using Dispatcher =\n      vtkArrayDispatch::Dispatch2ByValueType<vtkArrayDispatch::Reals,\n                                             vtkArrayDispatch::Reals>;\n\n  // Generate optimized workers when mags/vecs are both float|double\n  if (!Dispatcher::Execute(vecs, mags, worker2b))\n  {\n    // Otherwise fallback to using the vtkDataArray API.\n    worker2b(vecs, mags);\n  }\n}\n\nvoid mag3Dispatch3(vtkDataArray* vecs, vtkDataArray* mags)\n{\n  std::cout << \"--- Testing mag3Dispatch3\" << std::endl;\n  Mag3Worker3 worker3;\n\n  // Create a dispatcher. We want to generate fast-paths for when\n  // vecs and mags both use doubles or floats, but fallback to a\n  // slow path for any other situation.\n  using Dispatcher =\n      vtkArrayDispatch::Dispatch2ByValueType<vtkArrayDispatch::Reals,\n                                             vtkArrayDispatch::Reals>;\n\n  // Generate optimized workers when mags/vecs are both float|double\n  if (!Dispatcher::Execute(vecs, mags, worker3))\n  {\n    // Otherwise fallback to using the vtkDataArray API.\n    worker3(vecs, mags);\n  }\n}\n\nbool verifyResults(vtkDataArray* magnitudes,\n                   std::vector<std::string> const& expectedMagnitudes)\n{\n  std::vector<std::string> actualMagnitudes;\n  auto magRange = vtk::DataArrayValueRange<1>(magnitudes);\n  for (const auto& magTuple : magRange)\n  {\n    std::ostringstream os;\n    os.setf(ios::fixed, ios::floatfield);\n    os << std::setprecision(6) << magTuple;\n    actualMagnitudes.push_back(os.str());\n  }\n\n  return (std::equal(actualMagnitudes.begin(), actualMagnitudes.end(),\n                     expectedMagnitudes.begin()));\n}\n\n} // namespace\n
"},{"location":"Cxx/Utilities/ForLoop/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ForLoop)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ForLoop: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ForLoop MACOSX_BUNDLE ForLoop.cxx )\n  target_link_libraries(ForLoop PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ForLoop\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ForLoop/#download-and-build-forloop","title":"Download and Build ForLoop","text":"

Click here to download ForLoop and its CMakeLists.txt file. Once the tarball ForLoop.tar has been downloaded and extracted,

cd ForLoop/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ForLoop\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/FrameRate/","title":"FrameRate","text":"

vtk-examples/Cxx/Utilities/FrameRate

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/FrameRate/#code","title":"Code","text":"

FrameRate.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid CallbackFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  for (unsigned int i = 0; i < 10; i++)\n  {\n    // Create a sphere\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetCenter(i, 0, 0);\n\n    // Create a mapper and actor\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"carrot\").GetData());\n\n    renderer->AddActor(actor);\n  }\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"FrameRate\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCallbackCommand> callback;\n\n  callback->SetCallback(CallbackFunction);\n  renderer->AddObserver(vtkCommand::EndEvent, callback);\n  renderer->SetBackground(colors->GetColor3d(\"sap_green\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CallbackFunction(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                      void* vtkNotUsed(clientData), void* vtkNotUsed(callData))\n{\n  vtkRenderer* renderer = static_cast<vtkRenderer*>(caller);\n\n  double timeInSeconds = renderer->GetLastRenderTimeInSeconds();\n  double fps = 1.0 / timeInSeconds;\n  std::cout << \"FPS: \" << fps << std::endl;\n\n  std::cout << \"Callback\" << std::endl;\n}\n} // namespace\n
"},{"location":"Cxx/Utilities/FrameRate/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FrameRate)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FrameRate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FrameRate MACOSX_BUNDLE FrameRate.cxx )\n  target_link_libraries(FrameRate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FrameRate\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/FrameRate/#download-and-build-framerate","title":"Download and Build FrameRate","text":"

Click here to download FrameRate and its CMakeLists.txt file. Once the tarball FrameRate.tar has been downloaded and extracted,

cd FrameRate/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FrameRate\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/FullScreen/","title":"FullScreen","text":"

vtk-examples/Cxx/Utilities/FullScreen

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/FullScreen/#code","title":"Code","text":"

FullScreen.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#define USE_SCREEN_SIZE\n// #undef USE_SCREEN_SIZE\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"FullScreen\");\n\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // We have two different approaches.\n#ifdef USE_SCREEN_SIZE\n  // This allows you to resize the window and shows the window name.\n  renderWindow->Render();\n  renderWindow->SetSize(renderWindow->GetScreenSize());\n#else\n  // Set to true to get full screen mode.\n  // This uses the whole screen for the image.\n  renderWindow->SetFullScreen(true);\n#endif\n\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/FullScreen/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FullScreen)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FullScreen: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FullScreen MACOSX_BUNDLE FullScreen.cxx )\n  target_link_libraries(FullScreen PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FullScreen\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/FullScreen/#download-and-build-fullscreen","title":"Download and Build FullScreen","text":"

Click here to download FullScreen and its CMakeLists.txt file. Once the tarball FullScreen.tar has been downloaded and extracted,

cd FullScreen/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FullScreen\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/FunctionParser/","title":"FunctionParser","text":"

vtk-examples/Cxx/Utilities/FunctionParser

"},{"location":"Cxx/Utilities/FunctionParser/#description","title":"Description","text":"

This example shows how to substitute values and evaluate a string such as \"a+b\".

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/FunctionParser/#code","title":"Code","text":"

FunctionParser.cxx

#include <vtkFunctionParser.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFunctionParser> functionParser;\n  functionParser->SetFunction(\"a+b\");\n\n  functionParser->SetScalarVariableValue(\"a\", 2);\n  functionParser->SetScalarVariableValue(\"b\", 3);\n\n  double result = functionParser->GetScalarResult();\n\n  std::cout << \"result: \" << result << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/FunctionParser/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FunctionParser)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonMisc\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FunctionParser: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FunctionParser MACOSX_BUNDLE FunctionParser.cxx )\n  target_link_libraries(FunctionParser PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FunctionParser\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/FunctionParser/#download-and-build-functionparser","title":"Download and Build FunctionParser","text":"

Click here to download FunctionParser and its CMakeLists.txt file. Once the tarball FunctionParser.tar has been downloaded and extracted,

cd FunctionParser/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FunctionParser\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/GetClassName/","title":"GetClassName","text":"

vtk-examples/Cxx/Utilities/GetClassName

"},{"location":"Cxx/Utilities/GetClassName/#description","title":"Description","text":"

This example demonstrates the GetClassName function. This should be available for every VTK class. This is extremely helpful for debugging - you are able to determine the type of a variable that is passed as an abstract type. With this information, the list of functions that can be called on this variable can be determined.

The example illustrates alternative ways to get the \"name\" of a class. Notice that the GetClassName provides a simple and useful solution.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/GetClassName/#code","title":"Code","text":"

GetClassName.cxx

#include <typeinfo>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n\nnamespace {\nstatic const char* unmangleName(const char* name);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n\n  std::cout << \"points->GetClassName():             \" << points->GetClassName()\n            << std::endl;\n  std::cout << \"Mangled\" << std::endl;\n  std::cout << \"\\ttypeid(points).name():              \" << typeid(points).name()\n            << std::endl;\n  std::cout << \"\\ttypeid(points.GetPointer()).name(): \"\n            << typeid(points.GetPointer()).name() << std::endl;\n  std::cout << \"Unmangled\" << std::endl;\n  std::cout << \"\\ttypeid(points.GetPointer()).name(): \"\n            << unmangleName(typeid(points).name()) << std::endl;\n  std::cout << \"\\ttypeid(points.GetPointer()).name(): \"\n            << unmangleName(typeid(points.GetPointer()).name()) << std::endl;\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// Better name demangling for gcc\n#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)\n#define GCC_USEDEMANGLE\n#endif\n\n#ifdef GCC_USEDEMANGLE\n#include <cstdlib>\n#include <cxxabi.h>\n#endif\n\nconst char* unmangleName(const char* name)\n{\n#ifdef GCC_USEDEMANGLE\n  char const* mangledName = name;\n  int status;\n  char* unmangled = abi::__cxa_demangle(mangledName, 0, 0, &status);\n  return unmangled;\n#else\n  return name;\n#endif\n}\n} // namespace\n
"},{"location":"Cxx/Utilities/GetClassName/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetClassName)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetClassName: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetClassName MACOSX_BUNDLE GetClassName.cxx )\n  target_link_libraries(GetClassName PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetClassName\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/GetClassName/#download-and-build-getclassname","title":"Download and Build GetClassName","text":"

Click here to download GetClassName and its CMakeLists.txt file. Once the tarball GetClassName.tar has been downloaded and extracted,

cd GetClassName/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GetClassName\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/GetDataRoot/","title":"GetDataRoot","text":"

vtk-examples/Cxx/Utilities/GetDataRoot

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/GetDataRoot/#code","title":"Code","text":"

GetDataRoot.cxx

#include <vtkNew.h>\n#include <vtkTesting.h>\n\nint main(int, char*[])\n{\n  // Locate VTK_DATA_ROOT\n  vtkNew<vtkTesting> testHelper;\n  std::string dataRoot = testHelper->GetDataRoot();\n\n  std::cout << \"dataRoot: \" << dataRoot << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/GetDataRoot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetDataRoot)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  TestingRendering\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetDataRoot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetDataRoot MACOSX_BUNDLE GetDataRoot.cxx )\n  target_link_libraries(GetDataRoot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetDataRoot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/GetDataRoot/#download-and-build-getdataroot","title":"Download and Build GetDataRoot","text":"

Click here to download GetDataRoot and its CMakeLists.txt file. Once the tarball GetDataRoot.tar has been downloaded and extracted,

cd GetDataRoot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./GetDataRoot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/KnownLengthArray/","title":"KnownLengthArray","text":"

vtk-examples/Cxx/Utilities/KnownLengthArray

"},{"location":"Cxx/Utilities/KnownLengthArray/#description","title":"Description","text":"

This example creates a VTK style float array. This can be easily interchanged with vtkIntArray, vtkDoubleArray, etc.

The terminology is as follows:

  • SetNumberOfComponents(): sets the number of elements that a tuple in the array will have. See VectorArrayKnownLength for an example with tuples with more than one element.
  • SetNumberOfValues(): sets the number of tuples the array will have. See UnknownLengthArray for an example where the number of values is not known in advance.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/KnownLengthArray/#code","title":"Code","text":"

KnownLengthArray.cxx

#include <vtkFloatArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFloatArray> distances;\n  distances->SetName(\"Distances\");\n  distances->SetNumberOfComponents(1);\n  distances->SetNumberOfValues(5);\n\n  // set values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    float f = (float)i + 0.1;\n    distances->SetValue(i, f);\n  }\n\n  // get values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    float f = distances->GetValue(i);\n    std::cout << f << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/KnownLengthArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KnownLengthArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KnownLengthArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KnownLengthArray MACOSX_BUNDLE KnownLengthArray.cxx )\n  target_link_libraries(KnownLengthArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KnownLengthArray\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/KnownLengthArray/#download-and-build-knownlengtharray","title":"Download and Build KnownLengthArray","text":"

Click here to download KnownLengthArray and its CMakeLists.txt file. Once the tarball KnownLengthArray.tar has been downloaded and extracted,

cd KnownLengthArray/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KnownLengthArray\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/LUTUtilities/","title":"LUTUtilities","text":"

vtk-examples/Cxx/Utilities/LUTUtilities

"},{"location":"Cxx/Utilities/LUTUtilities/#description","title":"Description","text":"

A class called LUTUtilities is demonstrated along with a test harness that shows you how to use the class.

This class allows you to:

  • Print the contents of the lookup table
  • Compare two lookup tables to see if they are the same.

The test harness is a function called: TestLookupTables that tests pairs of lookup tables against each other.

The program will not display any output if all tests are successful.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/LUTUtilities/#code","title":"Code","text":"

LUTUtilities.cxx

#include <vtkColorSeries.h>\n#include <vtkLookupTable.h>\n#include <vtkNew.h>\n#include <vtkVariantArray.h>\n\n#include <cstdlib>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\n//! Utilities for displaying and comparing lookup tables.\nclass LUTUtilities\n{\npublic:\n  //-----------------------------------------------------------------------------\n  //! Constructor.\n  LUTUtilities(){};\n\n  //-----------------------------------------------------------------------------\n  //! Destructor.\n  ~LUTUtilities(){};\n\n  //-----------------------------------------------------------------------------\n  //! Display the contents of the lookup table.\n  /*!\n   * @param lut - the lookup table.\n   * @return a string containing the table data.\n   */\n  std::string DisplayLUTAsString(vtkLookupTable* lut)\n  {\n    vtkIdType tv = lut->GetNumberOfTableValues();\n    double dR[2];\n    lut->GetTableRange(dR);\n    std::ostringstream os;\n    if (lut->GetIndexedLookup())\n    {\n      vtkIdType av = lut->GetNumberOfAnnotatedValues();\n      os << \"Categorical Lookup Table\\nNumber of annotated values: \" << av\n         << \" Number of table values: \" << tv << \"\\nTable Range: \" << std::fixed\n         << std::setw(8) << std::setprecision(6) << dR[0] << \" to \" << dR[1]\n         << std::endl;\n      if (av > 0)\n      {\n        for (vtkIdType i = 0; i < av; ++i)\n        {\n          double rgba[4];\n          lut->GetAnnotationColor(lut->GetAnnotatedValue(i), rgba);\n          os << std::setw(5) << lut->GetAnnotation(i) << \": \";\n          os << this->AssembleRGBAString(rgba);\n          os << std::endl;\n        }\n      }\n      else\n      {\n        for (vtkIdType i = 0; i < tv; ++i)\n        {\n          double rgba[4];\n          lut->GetTableValue(i, rgba);\n          os << std::setw(5) << i << \": \";\n          os << this->AssembleRGBAString(rgba);\n          os << std::endl;\n        }\n      }\n    }\n    else\n    {\n      os << \"Ordinal Lookup Table\\nNumber of table values : \" << tv\n         << \"\\nTable Range: \" << std::fixed << std::setw(8)\n         << std::setprecision(6) << dR[0] << \" to \" << dR[1] << std::endl;\n      std::vector<double> indices;\n      for (int i = 0; i < tv; ++i)\n      {\n        indices.push_back((dR[1] - dR[0]) * i / tv + dR[0]);\n      }\n      for (std::vector<double>::const_iterator p = indices.begin();\n           p != indices.end(); ++p)\n      {\n        double rgba[4];\n        lut->GetColor(*p, rgba);\n        rgba[3] = lut->GetOpacity(*p);\n        os << std::fixed << std::setw(5) << std::setprecision(2) << *p << \": \";\n        os << this->AssembleRGBAString(rgba);\n        os << std::endl;\n      }\n    }\n    return os.str();\n  }\n\n  //-----------------------------------------------------------------------------\n  //! Compare two lookup tables.\n  /*!\n   * @param lut1 - the lookup table.\n   * @param lut2 - the lookup table.\n   * @return true if the tables are the same.\n   */\n  std::pair<bool, std::string> CompareLUTs(vtkLookupTable* lut1,\n                                           vtkLookupTable* lut2)\n  {\n    std::pair<bool, std::string> res(true, \"\");\n    if (lut1->GetIndexedLookup() != lut2->GetIndexedLookup())\n    {\n      res.first = false;\n      res.second = \"One table is ordinal and the other is categorical.\";\n      return res;\n    }\n    if (lut1->GetIndexedLookup() &&\n        lut1->GetNumberOfAnnotatedValues() !=\n            lut2->GetNumberOfAnnotatedValues())\n    {\n      res.first = false;\n      res.second = \"The number of annotated values do not match.\";\n      return res;\n    }\n    if (lut1->GetNumberOfTableValues() != lut2->GetNumberOfTableValues())\n    {\n      res.first = false;\n      res.second = \"Table values do not match.\";\n      return res;\n    }\n    double dR1[2];\n    lut1->GetTableRange(dR1);\n    double dR2[2];\n    lut2->GetTableRange(dR2);\n    if (dR1[0] != dR2[0] && dR2[1] != dR1[1])\n    {\n      res.first = false;\n      res.second = \"Table ranges do not match.\";\n    }\n    if (lut1->GetIndexedLookup())\n    {\n      vtkIdType av = lut1->GetNumberOfAnnotatedValues();\n      if (av > 0)\n      {\n        for (vtkIdType i = 0; i < av; ++i)\n        {\n          if (lut1->GetAnnotation(i) != lut1->GetAnnotation(i))\n          {\n            res.first = false;\n            res.second = \"Annotations do not match.\";\n            return res;\n          }\n        }\n        for (vtkIdType i = 0; i < av; ++i)\n        {\n          double rgba1[4];\n          lut1->GetAnnotationColor(lut1->GetAnnotatedValue(i), rgba1);\n          double rgba2[4];\n          lut2->GetAnnotationColor(lut2->GetAnnotatedValue(i), rgba2);\n          if (!this->CompareRGBA(rgba1, rgba2))\n          {\n            res.first = false;\n            res.second = \"Colors do not match.\";\n            return res;\n          }\n        }\n      }\n      else\n      {\n        for (vtkIdType i = 0; i < av; ++i)\n        {\n          double rgba1[4];\n          lut1->GetTableValue(i, rgba1);\n          double rgba2[4];\n          lut2->GetTableValue(i, rgba2);\n          if (!this->CompareRGBA(rgba1, rgba2))\n          {\n            res.first = false;\n            res.second = \"Colors do not match.\";\n            return res;\n          }\n        }\n      }\n    }\n    else\n    {\n      vtkIdType tv = lut1->GetNumberOfTableValues();\n      std::vector<double> indices;\n      for (int i = 0; i < tv; ++i)\n      {\n        indices.push_back((dR1[1] - dR1[0]) * i / tv + dR1[0]);\n      }\n      for (std::vector<double>::const_iterator p = indices.begin();\n           p != indices.end(); ++p)\n      {\n        double rgba1[4];\n        lut1->GetColor(*p, rgba1);\n        rgba1[3] = lut1->GetOpacity(*p);\n        double rgba2[4];\n        lut2->GetColor(*p, rgba2);\n        rgba2[3] = lut2->GetOpacity(*p);\n        if (!this->CompareRGBA(rgba1, rgba2))\n        {\n          res.first = false;\n          res.second = \"Colors do not match.\";\n          return res;\n        }\n      }\n    }\n    return res;\n  }\n\nprivate:\n  //-----------------------------------------------------------------------------\n  //! Get a string of [R, G, B, A] as double.\n  std::string RGBAToDoubleString(double* rgba)\n  {\n    std::ostringstream os;\n    os << \"[\";\n    for (int i = 0; i < 4; ++i)\n    {\n      if (i == 0)\n      {\n        os << std::fixed << std::setw(8) << std::setprecision(6) << rgba[i];\n      }\n      else\n      {\n        os << std::fixed << std::setw(9) << std::setprecision(6) << rgba[i];\n      }\n      if (i < 3)\n      {\n        os << \",\";\n      }\n    }\n    os << \"]\";\n    return os.str();\n  }\n\n  //-----------------------------------------------------------------------------\n  //! Get a string of [R, G, B, A] as unsigned char.\n  std::string RGBAToCharString(double* rgba)\n  {\n    std::ostringstream os;\n    os << \"[\";\n    for (int i = 0; i < 4; ++i)\n    {\n      if (i == 0)\n      {\n        os << std::setw(3) << static_cast<int>(rgba[i] * 255);\n      }\n      else\n      {\n        os << std::setw(4) << static_cast<int>(rgba[i] * 255);\n      }\n      if (i < 3)\n      {\n        os << \",\";\n      }\n    }\n    os << \"]\";\n    return os.str();\n  }\n\n  //-----------------------------------------------------------------------------\n  //! Get a hexadecimal string of the RGB colors.\n  std::string RGBToHexString(double* rgba)\n  {\n    std::ostringstream os;\n    for (int i = 0; i < 3; ++i)\n    {\n      os << std::setw(2) << std::setfill('0') << std::hex\n         << static_cast<int>(rgba[i] * 255);\n    }\n    return os.str();\n  }\n\n  //-----------------------------------------------------------------------------\n  //! Get a string of [R, G, B, A] as double, unsigned char and hex.\n  std::string AssembleRGBAString(double* rgba)\n  {\n    std::ostringstream os;\n    os << this->RGBAToDoubleString(rgba);\n    os << \" \";\n    os << this->RGBAToCharString(rgba);\n    os << \" 0x\";\n    os << this->RGBToHexString(rgba);\n    return os.str();\n  }\n\n  //-----------------------------------------------------------------------------\n  //! Compare two rgba colors.\n  template <typename T> bool CompareRGBA(T* rgba1, T* rgba2)\n  {\n    bool areEquivalent = true;\n    for (int i = 0; i < 4; ++i)\n    {\n      areEquivalent &= rgba1[i] == rgba2[i];\n      if (!areEquivalent)\n      {\n        return false;\n      }\n    }\n    return true;\n  }\n};\n\n//-----------------------------------------------------------------------------\n//! Get all the color scheme names.\n/*!\n * @return a map of the names keyed on their index.\n */\nstd::map<int, std::string> GetAllColorSchemes()\n{\n  std::map<int, std::string> colorSchemes;\n  vtkNew<vtkColorSeries> colorSeries;\n  for (int i = 0; i < colorSeries->GetNumberOfColorSchemes(); ++i)\n  {\n    colorSeries->SetColorScheme(i);\n    colorSchemes[i] = colorSeries->GetColorSchemeName();\n  }\n  return colorSchemes;\n}\n\n//-----------------------------------------------------------------------------\n//! The available color scheme indexes and names.\n/*!\n * @param colorSchemes - a map of the names keyed on their index.\n * @return a string if the indexes and names.\n */\nstd::string AvailableColorSchemes(std::map<int, std::string>& colorSchemes)\n{\n  std::ostringstream os;\n  for (std::map<int, std::string>::const_iterator p = colorSchemes.begin();\n       p != colorSchemes.end(); ++p)\n  {\n    os << std::setw(3) << p->first << \"\\t\" << p->second << std::endl;\n  }\n  return os.str();\n}\n\n//-----------------------------------------------------------------------------\n//! Display the available color schemes.\nvoid DisplayAvailableColorSchemes()\n{\n  std::string line(\"-----------------------------------------------------------\"\n                   \"------------------\\n\");\n  std::map<int, std::string> colorSchemes;\n  colorSchemes = GetAllColorSchemes();\n  std::cout << line << AvailableColorSchemes(colorSchemes) << line << std::endl;\n}\n\n//-----------------------------------------------------------------------------\n//! Display the lookup tables and reason for failure.\n/*!\n * @param reason - the reason.\n * @param lut1 - the first lookup table.\n * @param lut2 - the second lookup table.\n */\nvoid DisplayResults(std::string& reason, vtkLookupTable* lut1,\n                    vtkLookupTable* lut2)\n{\n  LUTUtilities lutUtilities;\n  std::string line(\"-----------------------------------------------------------\"\n                   \"------------------\\n\");\n  std::cout << line;\n  std::cout << reason << std::endl;\n  std::cout << lutUtilities.DisplayLUTAsString(lut1) << std::endl;\n  std::cout << lutUtilities.DisplayLUTAsString(lut2) << std::endl;\n  std::cout << line;\n}\n\n//-----------------------------------------------------------------------------\n//! Test pairs of lookup tables.\n/*!\n * @param lut1 - the first lookup table.\n * @param lut2 - the second lookup table.\n * @param expected - if false a fail is expected.\n * @return true/false.\n */\nbool TestTables(vtkLookupTable* lut1, vtkLookupTable* lut2,\n                bool const expected = true)\n{\n  LUTUtilities lutUtilities;\n  std::pair<bool, std::string> comparison =\n      lutUtilities.CompareLUTs(lut1, lut2);\n  if (comparison.first != expected)\n  {\n    DisplayResults(comparison.second, lut1, lut2);\n  }\n  return (expected) ? comparison.first : !comparison.first;\n}\n\n//-----------------------------------------------------------------------------\n//! Test various combinations of lookup tables.\n/*!\n * @param lutMode - if true the tables are ordinal, categorical otherwise.\n * @return true if all tests passed.\n */\nbool TestLookupTables(bool const& lutMode)\n{\n  LUTUtilities lutUtilities;\n  vtkNew<vtkLookupTable> lut1;\n  vtkNew<vtkLookupTable> lut2;\n  vtkNew<vtkColorSeries> colorSeries;\n  int colorSeriesEnum = colorSeries->SPECTRUM;\n  colorSeries->SetColorScheme(colorSeriesEnum);\n\n  colorSeries->BuildLookupTable(lut1);\n  colorSeries->BuildLookupTable(lut2);\n  if (lutMode)\n  {\n    lut1->IndexedLookupOff();\n    lut2->IndexedLookupOff();\n  }\n  lut1->SetNanColor(1, 0, 0, 1);\n  lut2->SetNanColor(1, 0, 0, 1);\n\n  if (!lutMode)\n  {\n    //  For the annotation just use a letter of the alphabet.\n    vtkNew<vtkVariantArray> values1;\n    vtkNew<vtkVariantArray> values2;\n    std::string str = \"abcdefghijklmnopqrstuvwxyz\";\n    for (int i = 0; i < lut1->GetNumberOfTableValues(); ++i)\n    {\n      values1->InsertNextValue(vtkVariant(str.substr(i, 1)));\n    }\n    for (int i = 0; i < lut2->GetNumberOfTableValues(); ++i)\n    {\n      values2->InsertNextValue(vtkVariant(str.substr(i, 1)));\n    }\n    for (int i = 0; i < values1->GetNumberOfTuples(); ++i)\n    {\n      lut1->SetAnnotation(i, values1->GetValue(i).ToString());\n    }\n    for (int i = 0; i < values2->GetNumberOfTuples(); ++i)\n    {\n      lut2->SetAnnotation(i, values2->GetValue(i).ToString());\n    }\n  }\n\n  // Are they the same?\n  bool res = true;\n  res &= TestTables(lut1, lut2);\n\n  // Different size\n  lut2->SetNumberOfTableValues(5);\n  res &= TestTables(lut1, lut2, false);\n  lut2->SetNumberOfTableValues(lut1->GetNumberOfTableValues());\n  res &= TestTables(lut1, lut2);\n\n  if (lutMode)\n  {\n    // Different range\n    lut2->SetTableRange(1, 2);\n    res &= TestTables(lut1, lut2, false);\n    double tr[2];\n    lut1->GetTableRange(tr);\n    lut2->SetTableRange(tr);\n    res &= TestTables(lut1, lut2);\n\n    // Different color\n    colorSeriesEnum = colorSeries->COOL;\n    colorSeries->SetColorScheme(colorSeriesEnum);\n    vtkNew<vtkLookupTable> lut3;\n    colorSeries->BuildLookupTable(lut3);\n    lut3->IndexedLookupOff();\n    res &= TestTables(lut1, lut3, false);\n\n    // One indexed, the other ordinal.\n    lut1->IndexedLookupOn();\n    res &= TestTables(lut1, lut2, false);\n  }\n  else\n  {\n    // Different color\n    colorSeriesEnum = colorSeries->COOL;\n    colorSeries->SetColorScheme(colorSeriesEnum);\n    vtkNew<vtkLookupTable> lut3;\n    //  For the annotation just use a letter of the alphabet.\n    vtkNew<vtkVariantArray> values;\n    std::string str = \"abcdefghijklmnopqrstuvwxyz\";\n    for (int i = 0; i < lut1->GetNumberOfTableValues(); ++i)\n    {\n      values->InsertNextValue(vtkVariant(str.substr(i, 1)));\n    }\n    for (int i = 0; i < values->GetNumberOfTuples(); ++i)\n    {\n      lut3->SetAnnotation(i, values->GetValue(i).ToString());\n    }\n    colorSeries->BuildLookupTable(lut3);\n    res &= TestTables(lut1, lut3, false);\n\n    // Different annotations.\n    lut2->ResetAnnotations();\n    for (int i = 0; i < values->GetNumberOfTuples(); ++i)\n    {\n      if (i % 3 == 0)\n        continue;\n      lut2->SetAnnotation(i, values->GetValue(i).ToString());\n    }\n    res &= TestTables(lut1, lut2, false);\n\n    // No annotations.\n    lut1->ResetAnnotations();\n    lut2->ResetAnnotations();\n    res &= TestTables(lut1, lut2);\n\n    // One indexed, the other ordinal.\n    lut1->IndexedLookupOff();\n    res &= TestTables(lut1, lut2, false);\n  }\n\n  return res;\n}\n\n//-----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  // DisplayAvailableColorSchemes();\n  // Test ordinal LUTS.\n  bool res = TestLookupTables(true);\n  // Test categorical LUTs.\n  res &= TestLookupTables(false);\n  return (res) ? EXIT_SUCCESS : EXIT_FAILURE;\n}\n
"},{"location":"Cxx/Utilities/LUTUtilities/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LUTUtilities)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LUTUtilities: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LUTUtilities MACOSX_BUNDLE LUTUtilities.cxx )\n  target_link_libraries(LUTUtilities PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LUTUtilities\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/LUTUtilities/#download-and-build-lututilities","title":"Download and Build LUTUtilities","text":"

Click here to download LUTUtilities and its CMakeLists.txt file. Once the tarball LUTUtilities.tar has been downloaded and extracted,

cd LUTUtilities/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LUTUtilities\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/MassProperties/","title":"MassProperties","text":"

vtk-examples/Cxx/Utilities/MassProperties

"},{"location":"Cxx/Utilities/MassProperties/#description","title":"Description","text":"

This example uses vtkMassProperties to compute the volume of a closed mesh. vtkMassProperties requires triangles with consistent ordering. This example uses vtkFillHolesFilter and vtkTriangleFilter to ensure a closed, triangulated mesh. vtkPolyDataNormals enforces consistent normals.

If run with no arguments, a vtkSphereSource generates the vtkPolyData. Of given a file containing vtkPolyData, it computes that data's volume and surface area.

Cite

(Alyassin A.M. et al, \"Evaluation of new algorithms for the interactive measurement of surface area and volume\", Med Phys 21(6) 1994.)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/MassProperties/#code","title":"Code","text":"

MassProperties.cxx

#include <vtkFillHolesFilter.h>\n#include <vtkMassProperties.h>\n#include <vtkNew.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangleFilter.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  vtkNew<vtkFillHolesFilter> fillHolesFilter;\n  fillHolesFilter->SetInputData(polyData);\n  fillHolesFilter->SetHoleSize(1000.0);\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(fillHolesFilter->GetOutputPort());\n\n  // Make the triangle windong order consistent\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(triangleFilter->GetOutputPort());\n  normals->ConsistencyOn();\n  normals->SplittingOff();\n\n  vtkNew<vtkMassProperties> massProperties;\n  massProperties->SetInputConnection(normals->GetOutputPort());\n  massProperties->Update();\n  std::cout << \"Volume: \" << massProperties->GetVolume() << std::endl\n            << \"    VolumeX: \" << massProperties->GetVolumeX() << std::endl\n            << \"    VolumeY: \" << massProperties->GetVolumeY() << std::endl\n            << \"    VolumeZ: \" << massProperties->GetVolumeZ() << std::endl\n            << \"Area:   \" << massProperties->GetSurfaceArea() << std::endl\n            << \"    MinCellArea: \" << massProperties->GetMinCellArea()\n            << std::endl\n            << \"    MinCellArea: \" << massProperties->GetMaxCellArea()\n            << std::endl\n            << \"NormalizedShapeIndex: \"\n            << massProperties->GetNormalizedShapeIndex() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(51);\n    source->SetThetaResolution(51);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Utilities/MassProperties/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MassProperties)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MassProperties: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MassProperties MACOSX_BUNDLE MassProperties.cxx )\n  target_link_libraries(MassProperties PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MassProperties\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/MassProperties/#download-and-build-massproperties","title":"Download and Build MassProperties","text":"

Click here to download MassProperties and its CMakeLists.txt file. Once the tarball MassProperties.tar has been downloaded and extracted,

cd MassProperties/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MassProperties\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ObserveError/","title":"ObserveError","text":"

vtk-examples/Cxx/Utilities/ObserveError

"},{"location":"Cxx/Utilities/ObserveError/#description","title":"Description","text":"

When vtk encounters an error or warning, by default the message is written to standard output. This example shows how to catch the error or warning. The example prints to standard output, but an application may wish to present the error or warning in a different manner, e.g. write to a log file or present the message in a window.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ObserveError/#code","title":"Code","text":"

ObserveError.cxx

#include <string>\n#include <vtkCommand.h>\n#include <vtkImageData.h>\n#include <vtkNew.h>\n\nclass ErrorObserver : public vtkCommand\n{\npublic:\n  ErrorObserver()\n    : Error(false), Warning(false), ErrorMessage(\"\"), WarningMessage(\"\")\n  {\n  }\n  static ErrorObserver* New()\n  {\n    return new ErrorObserver;\n  }\n  bool GetError() const\n  {\n    return this->Error;\n  }\n  bool GetWarning() const\n  {\n    return this->Warning;\n  }\n  void Clear()\n  {\n    this->Error = false;\n    this->Warning = false;\n    this->ErrorMessage = \"\";\n    this->WarningMessage = \"\";\n  }\n  virtual void Execute(vtkObject* vtkNotUsed(caller), unsigned long event,\n                       void* calldata)\n  {\n    switch (event)\n    {\n    case vtkCommand::ErrorEvent:\n      ErrorMessage = static_cast<char*>(calldata);\n      this->Error = true;\n      break;\n    case vtkCommand::WarningEvent:\n      WarningMessage = static_cast<char*>(calldata);\n      this->Warning = true;\n      break;\n    }\n  }\n  std::string GetErrorMessage()\n  {\n    return ErrorMessage;\n  }\n  std::string GetWarningMessage()\n  {\n    return WarningMessage;\n  }\n\nprivate:\n  bool Error;\n  bool Warning;\n  std::string ErrorMessage;\n  std::string WarningMessage;\n};\n\nint main(int, char*[])\n{\n  vtkNew<ErrorObserver> errorObserver;\n\n  vtkNew<vtkImageData> image;\n  image->AddObserver(vtkCommand::ErrorEvent, errorObserver);\n  image->AddObserver(vtkCommand::WarningEvent, errorObserver);\n  image->GetCell(1);\n  if (errorObserver->GetError())\n  {\n    std::cout << \"Caught error! \" << errorObserver->GetErrorMessage();\n  }\n\n  image->ShallowCopy(NULL);\n  if (errorObserver->GetWarning())\n  {\n    std::cout << \"Caught warning! \" << errorObserver->GetWarningMessage();\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ObserveError/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ObserveError)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ObserveError: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ObserveError MACOSX_BUNDLE ObserveError.cxx )\n  target_link_libraries(ObserveError PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ObserveError\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ObserveError/#download-and-build-observeerror","title":"Download and Build ObserveError","text":"

Click here to download ObserveError and its CMakeLists.txt file. Once the tarball ObserveError.tar has been downloaded and extracted,

cd ObserveError/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ObserveError\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/OffScreenRendering/","title":"OffScreenRendering","text":"

vtk-examples/Cxx/Utilities/OffScreenRendering

"},{"location":"Cxx/Utilities/OffScreenRendering/#description","title":"Description","text":"

This example renders a scene directly to a file without displaying a window. You must turn on VTK_OPENGL_HAS_OSMESA in the VTK advanced build configuration.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/OffScreenRendering/#code","title":"Code","text":"

OffScreenRendering.cxx

#include <vtkActor.h>\n#include <vtkGraphicsFactory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkWindowToImageFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup offscreen rendering\n  vtkNew<vtkGraphicsFactory> graphics_factory;\n  graphics_factory->SetOffScreenOnlyMode(1);\n  graphics_factory->SetUseMesaClasses(1);\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetOffScreenRendering(1);\n  renderWindow->AddRenderer(renderer);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<vtkWindowToImageFilter> windowToImageFilter;\n  windowToImageFilter->SetInput(renderWindow);\n  windowToImageFilter->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(\"screenshot.png\");\n  writer->SetInputConnection(windowToImageFilter->GetOutputPort());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/OffScreenRendering/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OffScreenRendering)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OffScreenRendering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OffScreenRendering MACOSX_BUNDLE OffScreenRendering.cxx )\n  target_link_libraries(OffScreenRendering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OffScreenRendering\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/OffScreenRendering/#download-and-build-offscreenrendering","title":"Download and Build OffScreenRendering","text":"

Click here to download OffScreenRendering and its CMakeLists.txt file. Once the tarball OffScreenRendering.tar has been downloaded and extracted,

cd OffScreenRendering/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OffScreenRendering\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/PCADemo/","title":"PCADemo","text":"

vtk-examples/Cxx/Utilities/PCADemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/PCADemo/#code","title":"Code","text":"

PCADemo.cxx

#include <vtkActor.h>\n#include <vtkBoxMuellerRandomSequence.h>\n#include <vtkDoubleArray.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLine.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPCAStatistics.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTable.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVertexGlyphFilter.h>\n\nnamespace {\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkBoxMuellerRandomSequence> randomSequence;\n\n  vtkNew<vtkPoints> points;\n  for (unsigned int i = 0; i < 200; i++)\n  {\n    auto x = randomSequence->GetScaledValue(0, 2);\n    randomSequence->Next();\n    auto y = randomSequence->GetScaledValue(0, 5);\n    randomSequence->Next();\n    points->InsertNextPoint(x, y, 0);\n  }\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateZ(30);\n\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetTransform(transform);\n  transformFilter->SetInputData(polydata);\n  transformFilter->Update();\n\n  // These would be all of your \"x\" values.\n  vtkNew<vtkDoubleArray> xArray;\n  xArray->SetNumberOfComponents(1);\n  xArray->SetName(\"x\");\n\n  // These would be all of your \"y\" values.\n  vtkNew<vtkDoubleArray> yArray;\n  yArray->SetNumberOfComponents(1);\n  yArray->SetName(\"y\");\n\n  for (vtkIdType i = 0; i < polydata->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    transformFilter->GetOutput()->GetPoint(i, p);\n    xArray->InsertNextValue(p[0]);\n    yArray->InsertNextValue(p[1]);\n  }\n\n  vtkNew<vtkTable> datasetTable;\n  datasetTable->AddColumn(xArray);\n  datasetTable->AddColumn(yArray);\n\n  vtkNew<vtkPCAStatistics> pcaStatistics;\n  pcaStatistics->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA, datasetTable);\n\n  pcaStatistics->SetColumnStatus(\"x\", 1);\n  pcaStatistics->SetColumnStatus(\"y\", 1);\n\n  pcaStatistics->RequestSelectedColumns();\n  pcaStatistics->SetDeriveOption(true);\n  pcaStatistics->Update();\n\n  ///////// Eigenvalues ////////////\n  vtkNew<vtkDoubleArray> eigenvalues;\n  pcaStatistics->GetEigenvalues(eigenvalues);\n  for (vtkIdType i = 0; i < eigenvalues->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Eigenvalue \" << i << \" = \" << eigenvalues->GetValue(i)\n              << std::endl;\n  }\n\n  ///////// Eigenvectors ////////////\n  vtkNew<vtkDoubleArray> eigenvectors;\n\n  pcaStatistics->GetEigenvectors(eigenvectors);\n\n  vtkNew<vtkDoubleArray> evec1;\n  pcaStatistics->GetEigenvector(0, evec1);\n\n  vtkNew<vtkDoubleArray> evec2;\n  pcaStatistics->GetEigenvector(1, evec2);\n\n  double scale = 3.0;\n  vtkNew<vtkLineSource> vector1Source;\n  vector1Source->SetPoint1(0, 0, 0);\n  vector1Source->SetPoint1(scale * evec1->GetValue(0),\n                           scale * evec1->GetValue(1), 0);\n\n  vtkNew<vtkPolyDataMapper> vec1Mapper;\n  vec1Mapper->SetInputConnection(vector1Source->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> vector1Actor;\n  vector1Actor->SetMapper(vec1Mapper);\n  vector1Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LimeGreen\").GetData());\n  vector1Actor->GetProperty()->SetLineWidth(3);\n\n  vtkNew<vtkLineSource> vector2Source;\n  vector2Source->SetPoint1(0, 0, 0);\n  vector2Source->SetPoint1(scale * evec2->GetValue(0),\n                           scale * evec2->GetValue(1), 0);\n\n  vtkNew<vtkPolyDataMapper> vec2Mapper;\n  vec2Mapper->SetInputConnection(vector2Source->GetOutputPort());\n\n  vtkNew<vtkActor> vector2Actor;\n  vector2Actor->SetMapper(vec2Mapper);\n  vector2Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  vector2Actor->GetProperty()->SetLineWidth(3);\n\n  // Project all of the points onto the eigenvector with\n  // the largest eigenvalues\n  double p0[3];\n  p0[0] = -100 * evec1->GetValue(0);\n  p0[1] = -100 * evec1->GetValue(1);\n  p0[2] = 0;\n  double p1[3];\n  p1[0] = 100 * evec1->GetValue(0);\n  p1[1] = 100 * evec1->GetValue(1);\n  p1[2] = 0;\n\n  vtkNew<vtkPoints> projectedPoints;\n  for (vtkIdType i = 0; i < polydata->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    transformFilter->GetOutput()->GetPoint(i, p);\n    double t;\n    double closestPoint[3];\n    vtkLine::DistanceToLine(p, p0, p1, t, closestPoint);\n    double newP[3];\n    double v[3];\n    vtkMath::Subtract(p1, p0, v);\n    vtkMath::Normalize(v);\n    vtkMath::MultiplyScalar(v, t);\n    vtkMath::Add(p0, v, newP);\n    projectedPoints->InsertNextPoint(t, 0, 0);\n  }\n\n  vtkNew<vtkPolyData> projectedPolyData;\n  projectedPolyData->SetPoints(projectedPoints);\n\n  vtkNew<vtkVertexGlyphFilter> projectedGlyphFilter;\n  projectedGlyphFilter->SetInputData(projectedPolyData);\n  projectedGlyphFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> projectedMapper;\n  projectedMapper->SetInputConnection(projectedGlyphFilter->GetOutputPort());\n  vtkNew<vtkActor> projectedActor;\n  projectedActor->SetMapper(projectedMapper);\n  projectedActor->GetProperty()->SetPointSize(2);\n  projectedActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"PCADemo\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputConnection(transformFilter->GetOutputPort());\n  glyphFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(glyphFilter->GetOutputPort());\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetPointSize(1);\n\n  // Map the points to spheres\n  auto sphereActor =\n      PointToGlyph(transformFilter->GetOutput()->GetPoints(), 0.007);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n\n  // leftRenderer->AddActor(originalActor);\n  leftRenderer->AddActor(sphereActor);\n  leftRenderer->AddActor(vector1Actor);\n  leftRenderer->AddActor(vector2Actor);\n\n  rightRenderer->AddActor(projectedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
"},{"location":"Cxx/Utilities/PCADemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PCADemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  FiltersStatistics\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PCADemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PCADemo MACOSX_BUNDLE PCADemo.cxx )\n  target_link_libraries(PCADemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PCADemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/PCADemo/#download-and-build-pcademo","title":"Download and Build PCADemo","text":"

Click here to download PCADemo and its CMakeLists.txt file. Once the tarball PCADemo.tar has been downloaded and extracted,

cd PCADemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PCADemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/PCAStatistics/","title":"PCAStatistics","text":"

vtk-examples/Cxx/Utilities/PCAStatistics

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/PCAStatistics/#code","title":"Code","text":"

PCAStatistics.cxx

#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPCAStatistics.h>\n#include <vtkTable.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  // Each one of these arrays is a single component of\n  // the data. That is, if you have 3D spatial data (x,y,z)\n  // you need to construct an array of all the x values,\n  // an array of all the y values, and an array of all the\n  // z values.\n\n  // Construct a data set of 3 3D points.\n\n  // These would be all of your \"x\" values.\n  const char m0Name[] = \"M0\";\n  vtkNew<vtkDoubleArray> dataset1Arr;\n  dataset1Arr->SetNumberOfComponents(1);\n  dataset1Arr->SetName(m0Name);\n  dataset1Arr->InsertNextValue(0);\n  dataset1Arr->InsertNextValue(1);\n  dataset1Arr->InsertNextValue(0);\n\n  // These would be all of your \"y\" values.\n  const char m1Name[] = \"M1\";\n  vtkNew<vtkDoubleArray> dataset2Arr;\n  dataset2Arr->SetNumberOfComponents(1);\n  dataset2Arr->SetName(m1Name);\n  dataset2Arr->InsertNextValue(0);\n  dataset2Arr->InsertNextValue(0);\n  dataset2Arr->InsertNextValue(1);\n\n  // These would be all of your \"z\" values.\n  const char m2Name[] = \"M2\";\n  vtkNew<vtkDoubleArray> dataset3Arr;\n  dataset3Arr->SetNumberOfComponents(1);\n  dataset3Arr->SetName(m2Name);\n  dataset3Arr->InsertNextValue(0);\n  dataset3Arr->InsertNextValue(0);\n  dataset3Arr->InsertNextValue(0);\n\n  vtkNew<vtkTable> datasetTable;\n  datasetTable->AddColumn(dataset1Arr);\n  datasetTable->AddColumn(dataset2Arr);\n  datasetTable->AddColumn(dataset3Arr);\n\n  vtkNew<vtkPCAStatistics> pcaStatistics;\n  pcaStatistics->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA, datasetTable);\n  pcaStatistics->SetColumnStatus(\"M0\", 1);\n  pcaStatistics->SetColumnStatus(\"M1\", 1);\n  pcaStatistics->SetColumnStatus(\"M2\", 1);\n  pcaStatistics->RequestSelectedColumns();\n  pcaStatistics->SetDeriveOption(true);\n  pcaStatistics->Update();\n\n  ///////// Eigenvalues ////////////\n  vtkNew<vtkDoubleArray> eigenvalues;\n  pcaStatistics->GetEigenvalues(eigenvalues);\n  //  double eigenvaluesGroundTruth[3] = {.5, .166667, 0};\n  for (vtkIdType i = 0; i < eigenvalues->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Eigenvalue \" << i << \" = \" << eigenvalues->GetValue(i)\n              << std::endl;\n  }\n\n  ///////// Eigenvectors ////////////\n  vtkNew<vtkDoubleArray> eigenvectors;\n\n  pcaStatistics->GetEigenvectors(eigenvectors);\n  for (vtkIdType i = 0; i < eigenvectors->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Eigenvector \" << i << \" : \";\n    double* evec = new double[eigenvectors->GetNumberOfComponents()];\n    eigenvectors->GetTuple(i, evec);\n    for (vtkIdType j = 0; j < eigenvectors->GetNumberOfComponents(); j++)\n    {\n      std::cout << evec[j] << \" \";\n      vtkNew<vtkDoubleArray> eigenvectorSingle;\n      pcaStatistics->GetEigenvector(i, eigenvectorSingle);\n    }\n    delete[] evec;\n    std::cout << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/PCAStatistics/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PCAStatistics)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersStatistics\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PCAStatistics: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PCAStatistics MACOSX_BUNDLE PCAStatistics.cxx )\n  target_link_libraries(PCAStatistics PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PCAStatistics\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/PCAStatistics/#download-and-build-pcastatistics","title":"Download and Build PCAStatistics","text":"

Click here to download PCAStatistics and its CMakeLists.txt file. Once the tarball PCAStatistics.tar has been downloaded and extracted,

cd PCAStatistics/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PCAStatistics\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/PiecewiseFunction/","title":"PiecewiseFunction","text":"

vtk-examples/Cxx/Utilities/PiecewiseFunction

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/PiecewiseFunction/#code","title":"Code","text":"

PiecewiseFunction.cxx

#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPiecewiseFunction> piecewiseFunction;\n  piecewiseFunction->AddPoint(0.0, 0.0);\n  piecewiseFunction->AddPoint(1.0, 2.0);\n\n  double test = piecewiseFunction->GetValue(0.25);\n\n  std::cout << \"test: \" << test << \" (should be 0.5)\" << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/PiecewiseFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PiecewiseFunction)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PiecewiseFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PiecewiseFunction MACOSX_BUNDLE PiecewiseFunction.cxx )\n  target_link_libraries(PiecewiseFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PiecewiseFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/PiecewiseFunction/#download-and-build-piecewisefunction","title":"Download and Build PiecewiseFunction","text":"

Click here to download PiecewiseFunction and its CMakeLists.txt file. Once the tarball PiecewiseFunction.tar has been downloaded and extracted,

cd PiecewiseFunction/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PiecewiseFunction\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/PointInPolygon/","title":"PointInPolygon","text":"

vtk-examples/Cxx/Utilities/PointInPolygon

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/PointInPolygon/#code","title":"Code","text":"

PointInPolygon.cxx

#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolygon.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  // Create the polygon\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPoints()->InsertNextPoint(0.0, 0.0, 0.0);\n  polygon->GetPoints()->InsertNextPoint(1.0, 0.0, 0.0);\n  polygon->GetPoints()->InsertNextPoint(1.0, 1.0, 0.0);\n  polygon->GetPoints()->InsertNextPoint(0.0, 1.0, 0.0);\n\n  double testIn[3] = {0.5, 0.5, 0.0};\n  double testOut[3] = {2.0, 0.5, 0.0};\n\n  double n[3];\n  polygon->ComputeNormal(\n      polygon->GetPoints()->GetNumberOfPoints(),\n      static_cast<double*>(polygon->GetPoints()->GetData()->GetVoidPointer(0)),\n      n);\n\n  double bounds[6];\n  polygon->GetPoints()->GetBounds(bounds);\n\n  std::cout << \"testIn in polygon? \"\n            << polygon->PointInPolygon(\n                   testIn, polygon->GetPoints()->GetNumberOfPoints(),\n                   static_cast<double*>(\n                       polygon->GetPoints()->GetData()->GetVoidPointer(0)),\n                   bounds, n)\n            << std::endl;\n\n  std::cout << \"testOut in polygon? \"\n            << polygon->PointInPolygon(\n                   testOut, polygon->GetPoints()->GetNumberOfPoints(),\n                   static_cast<double*>(\n                       polygon->GetPoints()->GetData()->GetVoidPointer(0)),\n                   bounds, n)\n            << std::endl;\n\n  /*\n  std::cout << \"New functions:\" << std::endl;\n\n  std::cout << \"testIn in polygon? \" << polygon->PointInPolygon(testIn) <<\n  std::endl;\n\n  std::cout << \"testOut in polygon? \" << polygon->PointInPolygon(testOut) <<\n  std::endl;\n  */\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/PointInPolygon/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointInPolygon)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointInPolygon: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointInPolygon MACOSX_BUNDLE PointInPolygon.cxx )\n  target_link_libraries(PointInPolygon PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointInPolygon\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/PointInPolygon/#download-and-build-pointinpolygon","title":"Download and Build PointInPolygon","text":"

Click here to download PointInPolygon and its CMakeLists.txt file. Once the tarball PointInPolygon.tar has been downloaded and extracted,

cd PointInPolygon/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointInPolygon\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/RenderScalarToFloatBuffer/","title":"RenderScalarToFloatBuffer","text":"

vtk-examples/Cxx/Utilities/RenderScalarToFloatBuffer

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/RenderScalarToFloatBuffer/#code","title":"Code","text":"

RenderScalarToFloatBuffer.cxx

// Renders a scalar from a polydata into a float buffer.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCameraPass.h>\n#include <vtkDataSetReader.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSequencePass.h>\n#include <vtkValuePass.h>\n#include <vtkVersion.h>\n#include <vtkWindowToImageFilter.h>\n#include <vtkXMLImageDataWriter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 4)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" input(.vtk) array_name output(.vti) e.g. uGridEx.vtk \"\n                 \"scalars RenderScalarToFloatBuffer.vti\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<vtkDataSetReader> fileReader;\n\n  // Read .vtk file\n  fileReader->SetFileName(argv[1]);\n\n  // Render the scalar into an image\n  vtkNew<vtkDataSetSurfaceFilter> surface;\n  surface->SetInputConnection(fileReader->GetOutputPort());\n  mapper->SetInputConnection(surface->GetOutputPort());\n  actor->SetMapper(mapper);\n  renderer->AddActor(actor);\n  renWin->AddRenderer(renderer);\n  iRen->SetRenderWindow(renWin);\n  renWin->SetMultiSamples(0);\n  renderer->ResetCamera();\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->Elevation(-90);\n\n  vtkNew<vtkValuePass> valuePass;\n#if VTK_MAJOR_VERSION < 9\n  valuePass->SetRenderingMode(vtkValuePass::FLOATING_POINT);\n#endif\n  valuePass->SetInputArrayToProcess(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA,\n                                    argv[2]);\n  valuePass->SetInputComponentToProcess(0);\n  vtkNew<vtkRenderPassCollection> passes;\n  passes->AddItem(valuePass);\n  vtkNew<vtkSequencePass> sequence;\n  sequence->SetPasses(passes);\n  vtkNew<vtkCameraPass> cameraPass;\n  cameraPass->SetDelegatePass(sequence);\n  renderer->SetPass(cameraPass);\n  renWin->Render();\n  // Get the rendered image\n  vtkFloatArray* buffer = valuePass->GetFloatImageDataArray(renderer);\n  int* ext = valuePass->GetFloatImageExtents();\n  buffer->SetName(argv[2]);\n  vtkNew<vtkImageData> image;\n  image->SetExtent(ext);\n  image->GetPointData()->SetScalars(buffer);\n\n  // Write the image\n  vtkNew<vtkXMLImageDataWriter> writer;\n  writer->SetFileName(argv[3]);\n  writer->SetInputDataObject(image);\n  writer->Write();\n\n  // Show the image on the screen\n  renWin->RemoveRenderer(renderer);\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.6, 0);\n  lut->SetSaturationRange(1.0, 0);\n  lut->SetValueRange(0.5, 1.0);\n  lut->SetTableRange(image->GetScalarRange());\n  vtkNew<vtkImageMapToColors> mapColors;\n  mapColors->SetLookupTable(lut);\n  mapColors->SetInputDataObject(image);\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputConnection(mapColors->GetOutputPort());\n  vtkNew<vtkRenderer> ren;\n  ren->AddActor(imageActor);\n  ren->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renWin->AddRenderer(ren);\n  renWin->SetWindowName(\"RenderScalarToFloatBuffer\");\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/RenderScalarToFloatBuffer/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RenderScalarToFloatBuffer)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  IOLegacy\n  IOXML\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RenderScalarToFloatBuffer: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RenderScalarToFloatBuffer MACOSX_BUNDLE RenderScalarToFloatBuffer.cxx )\n  target_link_libraries(RenderScalarToFloatBuffer PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RenderScalarToFloatBuffer\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/RenderScalarToFloatBuffer/#download-and-build-renderscalartofloatbuffer","title":"Download and Build RenderScalarToFloatBuffer","text":"

Click here to download RenderScalarToFloatBuffer and its CMakeLists.txt file. Once the tarball RenderScalarToFloatBuffer.tar has been downloaded and extracted,

cd RenderScalarToFloatBuffer/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RenderScalarToFloatBuffer\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ReportRenderWindowCapabilities/","title":"ReportRenderWindowCapabilities","text":"

vtk-examples/Cxx/Utilities/ReportRenderWindowCapabilities

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ReportRenderWindowCapabilities/#code","title":"Code","text":"

ReportRenderWindowCapabilities.cxx

#include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer and render window<\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReportRenderWindowCapabilities\");\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  std::cout << renderWindow->ReportCapabilities();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ReportRenderWindowCapabilities/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReportRenderWindowCapabilities)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReportRenderWindowCapabilities: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReportRenderWindowCapabilities MACOSX_BUNDLE ReportRenderWindowCapabilities.cxx )\n  target_link_libraries(ReportRenderWindowCapabilities PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReportRenderWindowCapabilities\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ReportRenderWindowCapabilities/#download-and-build-reportrenderwindowcapabilities","title":"Download and Build ReportRenderWindowCapabilities","text":"

Click here to download ReportRenderWindowCapabilities and its CMakeLists.txt file. Once the tarball ReportRenderWindowCapabilities.tar has been downloaded and extracted,

cd ReportRenderWindowCapabilities/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReportRenderWindowCapabilities\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/RescaleReverseLUT/","title":"RescaleReverseLUT","text":"

vtk-examples/Cxx/Utilities/RescaleReverseLUT

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Utilities/RescaleReverseLUT/#description","title":"Description","text":"

This example shows how to adjust a colormap so that the colormap scalar range matches the scalar range on the object. This is done by adjusting the colormap so that the colormap scalar range matches the scalar range of the object by rescaling the control points and, optionally, reversing the order of the colors.

Of course, if you are generating the scalars, it may be easier to just change the scalar range of your filter. However, this may not be possible in some cases.

Here, we generate the original Color Transfer Function (CTF) corresponding to the seven colors that Isaac Newton labeled when dividing the spectrum of visible light in 1672. There are seven colors and the scalar range is [-1, 1].

The cylinder has a vtkElevationFilter applied to it with a scalar range of [0, 1].

There are four images:

  • Original - The cylinder is colored by only the top four colors from the CTF. This is because the elevation scalar range on the cylinder is [0, 1] and the CTF scalar range is [-1, 1]. So the coloring is green->violet.
  • Reversed - We have reversed the colors from the original CTF and the lower four colors in the original CTF are now the top four colors used to color the cylinder. The coloring is now green->red.
  • Rescaled - The original CTF is rescaled to the range [0, 1] to match the scalar range of the elevation filter. The coloring is red->violet.
  • Rescaled and Reversed - The original CTF is rescaled to the range [0, 1] and the colors reversed. The coloring is violet->red.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/RescaleReverseLUT/#code","title":"Code","text":"

RescaleReverseLUT.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCylinderSource.h>\n#include <vtkDiscretizableColorTransferFunction.h>\n#include <vtkElevationFilter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <array>\n#include <string>\n#include <vector>\n\nnamespace {\n/**\n * Generate the color transfer function.\n *\n * The seven colors corresponding to the colors that Isaac Newton labelled\n *     when dividing the spectrum of visible light in 1672 are used.\n *\n * The modern variant of these colors can be selected and used instead.\n *\n * See: [Rainbow](https://en.wikipedia.org/wiki/Rainbow)\n *\n * @param modern: Selects either Newton's original seven colors or the modern\n * version.\n *\n * @return The color transfer function.\n */\nvtkNew<vtkDiscretizableColorTransferFunction>\nGetCTF(bool const& modern = false);\n\n/**\n * Generate a new color transfer function from the old one,\n * adding in the new x and rgb values.\n *\n * @param oldCTF: The old color transfer function.\n * @param newX: The new color x-values.\n * @param newRGB: The color RGB values.\n * @param reverse: If true, reverse the colors.\n *\n * @return The new color transfer function.\n */\nvtkNew<vtkDiscretizableColorTransferFunction>\nGenerateNewCTF(vtkNew<vtkDiscretizableColorTransferFunction> const& oldCTF,\n               std::vector<double> const& newX,\n               std::vector<std::array<double, 3>> const& newRGB,\n               bool const& reverse = false);\n\n/**\n * Rescale the values.\n *\n * See:\n * https://stats.stackexchange.com/questions/25894/changing-the-scale-of-a-variable-to-0-100\n *\n * @param xv: The values to be rescaled.\n * @param newMin: The new minimum value.\n * @param newMax: The new maximum value.\n *\n * @return The rescaled values.\n */\nstd::vector<double> Rescale(std::vector<double> const& xv,\n                            double const& newMin = 0, double const& newMax = 1);\n\n/**\n * Rescale and, optionally, reverse the colors in the color transfer function.\n *\n * @param ctf: The color transfer function to rescale.\n * @param newMin: The new minimum value.\n * @param newMax: The new maximum value.\n * @param reverse: If true, reverse the colors.\n *\n * @return The rescaled color transfer function.\n */\nvtkNew<vtkDiscretizableColorTransferFunction>\nRescaleCTF(vtkNew<vtkDiscretizableColorTransferFunction> const& ctf,\n           double const& newMin = 0, double const& newMax = 1,\n           bool const& reverse = false);\n} // namespace\n\nint main(int, char*[])\n{\n  std::array<unsigned char, 4> bkg{82, 87, 110, 255};\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"ParaViewBkg\", bkg.data());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(640 * 2, 480 * 2);\n  renWin->SetWindowName(\"RescaleReverseLUT\");\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  std::vector<vtkNew<vtkDiscretizableColorTransferFunction>> ctf;\n  ctf.push_back(GetCTF(false));\n  const double* tmp = ctf[0]->GetRange();\n  ctf.push_back(RescaleCTF(ctf[0], 0, 1, false));\n  ctf.push_back(RescaleCTF(ctf[0], tmp[0], tmp[1], true));\n  ctf.push_back(RescaleCTF(ctf[0], 0, 1, true));\n\n  // Define viewport ranges.\n  std::array<double, 4> xMins{0.0, 0.0, 0.5, 0.5};\n  std::array<double, 4> xMaxs{0.5, 0.5, 1.0, 1.0};\n  std::array<double, 4> yMins{0.5, 0.0, 0.5, 0.0};\n  std::array<double, 4> yMaxs{1.0, 0.5, 1.0, 0.5};\n\n  // Define titles.\n  std::vector<std::string> titles{\"Orginal\", \"Rescaled\", \"Reversed\",\n                                  \"Rescaled and Reversed\"};\n\n  // Create a common text property->\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(36);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  std::vector<vtkSmartPointer<vtkCylinderSource>> sources;\n  std::vector<vtkSmartPointer<vtkElevationFilter>> elevation_filters;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkScalarBarActor>> scalarBars;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n\n  for (auto i = 0; i < 4; ++i)\n  {\n    vtkNew<vtkCylinderSource> cylinder;\n    cylinder->SetCenter(0.0, 0.0, 0.0);\n    cylinder->SetResolution(6);\n    cylinder->Update();\n    double* bounds = cylinder->GetOutput()->GetBounds();\n    sources.push_back(cylinder);\n\n    vtkNew<vtkElevationFilter> elevation_filter;\n    elevation_filter->SetScalarRange(0, 1);\n    elevation_filter->SetLowPoint(0, bounds[2], 0);\n    elevation_filter->SetHighPoint(0, bounds[3], 0);\n    elevation_filter->SetInputConnection(sources[i]->GetOutputPort());\n    elevation_filters.push_back(elevation_filter);\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(elevation_filters[i]->GetOutputPort());\n    mapper->SetLookupTable(ctf[i]);\n    mapper->SetColorModeToMapScalars();\n    mapper->InterpolateScalarsBeforeMappingOn();\n    mappers.push_back(mapper);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mappers[i]);\n    actors.push_back(actor);\n\n    // Add a scalar bar.\n    vtkNew<vtkScalarBarActor> scalarBar;\n    scalarBar->SetLookupTable(ctf[i]);\n    scalarBars.push_back(scalarBar);\n\n    vtkNew<vtkTextMapper> textMapper;\n    textMappers.push_back(textMapper);\n    textMappers[i]->SetInput(titles[i].c_str());\n    textMappers[i]->SetTextProperty(textProperty);\n\n    vtkNew<vtkActor2D> textActor;\n    textActors.push_back(textActor);\n    textActors[i]->SetMapper(textMappers[i]);\n    // Note: The position of an Actor2D is specified in display coordinates.\n    textActors[i]->SetPosition(300, 16);\n\n    vtkNew<vtkRenderer> ren;\n    ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n    ren->AddActor(actors[i]);\n    ren->AddActor(scalarBars[i]);\n    ren->AddActor(textActors[i]);\n    ren->SetViewport(xMins[i], yMins[i], xMaxs[i], yMaxs[i]);\n    renderers.push_back(ren);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkNew<vtkDiscretizableColorTransferFunction> GetCTF(bool const& modern)\n{\n  // name: Rainbow, creator: Andrew Maclean\n  // interpolationspace: RGB, space: rgb\n  // file name:\n\n  vtkNew<vtkDiscretizableColorTransferFunction> ctf;\n\n  ctf->SetColorSpaceToRGB();\n  ctf->SetScaleToLinear();\n  ctf->SetNanColor(0.5, 0.5, 0.5);\n  ctf->SetBelowRangeColor(0.0, 0.0, 0.0);\n  ctf->UseBelowRangeColorOn();\n  ctf->SetAboveRangeColor(1.0, 1.0, 1.0);\n  ctf->UseAboveRangeColorOn();\n\n  if (modern)\n  {\n    ctf->AddRGBPoint(-1.0, 1.0, 0.0, 0.0);                 // Red\n    ctf->AddRGBPoint(-2.0 / 3.0, 1.0, 128.0 / 255.0, 0.0); // Orange #ff8000\n    ctf->AddRGBPoint(-1.0 / 3.0, 1.0, 1.0, 0.0);           // Yellow\n    ctf->AddRGBPoint(0.0, 0.0, 1.0, 0.0);                  // Green  #00ff00\n    ctf->AddRGBPoint(1.0 / 3.0, 0.0, 1.0, 1.0);            // Cyan\n    ctf->AddRGBPoint(2.0 / 3.0, 0.0, 0.0, 1.0);            // Blue\n    ctf->AddRGBPoint(1.0, 128.0 / 255.0, 0.0, 1.0);        // Violet #8000ff\n  }\n  else\n  {\n    ctf->AddRGBPoint(-1.0, 1.0, 0.0, 0.0);                 // Red\n    ctf->AddRGBPoint(-2.0 / 3.0, 1.0, 165.0 / 255.0, 0.0); // Orange #00a500\n    ctf->AddRGBPoint(-1.0 / 3.0, 1.0, 1.0, 0.0);           // Yellow\n    ctf->AddRGBPoint(0.0, 0.0, 125.0 / 255.0, 0.0);        // Green  #008000\n    ctf->AddRGBPoint(1.0 / 3.0, 0.0, 153.0 / 255.0, 1.0);  // Blue   #0099ff\n    ctf->AddRGBPoint(2.0 / 3.0, 68.0 / 255.0, 0,\n                     153.0 / 255.0);                // Indigo #4400ff\n    ctf->AddRGBPoint(1.0, 153.0 / 255.0, 0.0, 1.0); // Violet #9900ff\n  }\n\n  ctf->SetNumberOfValues(7);\n  ctf->DiscretizeOn();\n\n  return ctf;\n}\n\nvtkNew<vtkDiscretizableColorTransferFunction>\nGenerateNewCTF(vtkNew<vtkDiscretizableColorTransferFunction> const& oldCTF,\n               std::vector<double> const& newX,\n               std::vector<std::array<double, 3>> const& newRGB,\n               bool const& reverse)\n{\n  vtkNew<vtkDiscretizableColorTransferFunction> newCTF;\n  newCTF->SetScale(oldCTF->GetScale());\n  newCTF->SetColorSpace(oldCTF->GetColorSpace());\n  newCTF->SetNanColor(oldCTF->GetNanColor());\n  if (!reverse)\n  {\n    newCTF->SetBelowRangeColor(oldCTF->GetBelowRangeColor());\n    newCTF->SetUseBelowRangeColor(oldCTF->GetUseBelowRangeColor());\n    newCTF->SetAboveRangeColor(oldCTF->GetAboveRangeColor());\n    newCTF->SetUseAboveRangeColor(oldCTF->GetUseAboveRangeColor());\n  }\n  else\n  {\n    newCTF->SetBelowRangeColor(oldCTF->GetAboveRangeColor());\n    newCTF->SetUseBelowRangeColor(oldCTF->GetUseAboveRangeColor());\n    newCTF->SetAboveRangeColor(oldCTF->GetBelowRangeColor());\n    newCTF->SetUseAboveRangeColor(oldCTF->GetUseBelowRangeColor());\n  }\n  newCTF->SetNumberOfValues(newX.size());\n  newCTF->SetDiscretize(oldCTF->GetDiscretize());\n  if (!reverse)\n  {\n    for (size_t i = 0; i < newX.size(); ++i)\n    {\n      newCTF->AddRGBPoint(newX[i], newRGB[i][0], newRGB[i][1],\n                          newRGB[i][2]);\n    }\n  }\n  else\n  {\n    auto sz = newX.size();\n    for (size_t i = 0; i < sz; i++)\n    {\n      auto j = sz - (i + 1);\n      newCTF->AddRGBPoint(newX[i], newRGB[j][0], newRGB[j][1],\n                          newRGB[j][2]);\n    }\n  }\n  newCTF->Build();\n  return newCTF;\n}\n\nstd::vector<double> Rescale(std::vector<double> const& values,\n                            double const& newMin, double const& newMax)\n{\n  std::vector<double> res;\n  double oldMin = *std::min_element(values.begin(), values.end());\n  double oldMax = *std::max_element(values.begin(), values.end());\n  for (size_t i = 0; i < values.size(); ++i)\n  {\n    double newV =\n        (newMax - newMin) / (oldMax - oldMin) * (values[i] - oldMin) + newMin;\n    // double newV1 =\n    //     (newMax - newMin) / (oldMax - oldMin) * (values[i] - oldMax) +\n    //     newMax;\n    res.push_back(newV);\n  }\n  return res;\n}\n\nvtkNew<vtkDiscretizableColorTransferFunction>\nRescaleCTF(vtkNew<vtkDiscretizableColorTransferFunction> const& ctf,\n           double const& newMin, double const& newMax, bool const& reverse)\n{\n  double r0;\n  double r1;\n\n  if (newMin > newMax)\n  {\n    r0 = newMax;\n    r1 = newMin;\n  }\n  else\n  {\n    r0 = newMin;\n    r1 = newMax;\n  }\n\n  std::vector<double> xv;\n  std::vector<std::array<double, 3>> rgbv;\n  double nv[6] = {0, 0, 0, 0, 0, 0};\n  for (auto i = 0; i < ctf->GetNumberOfValues(); ++i)\n  {\n    ctf->GetNodeValue(i, nv);\n    double x = nv[0];\n    std::array<double, 3> rgb;\n    for (auto j = 1; j < 4; ++j)\n    {\n      rgb[j - 1] = nv[j];\n    }\n    xv.push_back(x);\n    rgbv.push_back(rgb);\n  }\n  std::vector<double> xvr = Rescale(xv, r0, r1);\n\n  return GenerateNewCTF(ctf, xvr, rgbv, reverse);\n}\n\n} // namespace\n
"},{"location":"Cxx/Utilities/RescaleReverseLUT/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RescaleReverseLUT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RescaleReverseLUT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RescaleReverseLUT MACOSX_BUNDLE RescaleReverseLUT.cxx )\n  target_link_libraries(RescaleReverseLUT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RescaleReverseLUT\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/RescaleReverseLUT/#download-and-build-rescalereverselut","title":"Download and Build RescaleReverseLUT","text":"

Click here to download RescaleReverseLUT and its CMakeLists.txt file. Once the tarball RescaleReverseLUT.tar has been downloaded and extracted,

cd RescaleReverseLUT/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RescaleReverseLUT\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ResetCameraOrientation/","title":"ResetCameraOrientation","text":"

vtk-examples/Cxx/Utilities/ResetCameraOrientation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Utilities/ResetCameraOrientation/#description","title":"Description","text":"

This example demonstrates how to reset the camera orientation.

In this case, the original orientation is stored, a new orientation calculated, and, finally the original orientation is restored. The original, new and restored orientations of the cone are displayed in one second intervals. After this you can interact with the scene.

To set the camera position, you can use:

  • SetPosition, SetFocalPoint, SetViewUp, SetDistance, SetClippingRange
  • Roll, Elevation, Azimuth
  • SetRoll, Pitch, Yaw

If you haven't used SetDistance or SetClippingRange remember to ren->ResetCamera(); or ren.ResetCamera().

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ResetCameraOrientation/#code","title":"Code","text":"

ResetCameraOrientation.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <chrono>\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <thread>\n#include <vector>\n\nnamespace {\n\n//! The positional information relating to the camera.\nstruct Orientation\n{\n  void ToVector(const double* from, std::vector<double>& to)\n  {\n    for (size_t i = 0; i < to.size(); ++i)\n    {\n      to[i] = from[i];\n    }\n  };\n\n  std::vector<double> position{0.0, 0.0, 0.0};\n  std::vector<double> focalPoint{0.0, 0.0, 0.0};\n  std::vector<double> viewUp{0.0, 0.0, 0.0};\n  double distance = 0;\n  std::vector<double> clipplingRange{0.0, 0.0};\n  std::vector<double> orientation{0.0, 0.0, 0.0};\n};\n\n//! Produce a comma-separated string of numbers from a vector.\n/*\n *\n * @param v - the vector of doubles.\n * @param precision - number of decimal places.\n * @param width - the width.\n * @return A comma-separated string.\n */\nstd::string CommaSeparatedList(std::vector<double> const& v,\n                               const int precision = 6, const int width = 10);\n\n//! Get the camera orientation.\n/*\n * @param ren - the renderer.\n * @return The orientation parameters.\n */\nOrientation GetOrientation(vtkRenderer* ren);\n\n//! Set the camera orientation.\n/*\n *\n * @param ren - the renderer.\n * @param p - The orientation parameters.\n * @return\n */\nvoid SetOrientation(vtkRenderer* ren, Orientation const& p);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Bisque\").GetData());\n\n  vtkNew<vtkRenderer> ren;\n  ren->AddActor(coneActor);\n  ren->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"ResetCameraOrientation\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkCamera* camera = ren->GetActiveCamera();\n  camera->SetRoll(15);\n  camera->Elevation(-15);\n  camera->Azimuth(30);\n  ren->ResetCamera();\n\n  renWin->Render();\n  Orientation originalOrient = GetOrientation(ren);\n  std::cout << std::setw(23) << \"Original orientation:\"\n            << CommaSeparatedList(originalOrient.orientation) << std::endl;\n  std::this_thread::sleep_for(std::chrono::seconds(1));\n\n  camera->SetPosition(-3.568189, 5.220048, 2.352639);\n  camera->SetFocalPoint(-0.399044, -0.282865, 0.131438);\n  camera->SetViewUp(0.623411, 0.573532, -0.531431);\n  camera->SetDistance(6.727500);\n  camera->SetClippingRange(3.001430, 11.434082);\n  // No need to use ren->ResetCamera() as we have all the parameters.\n  renWin->Render();\n  Orientation newOrient = GetOrientation(ren);\n  std::cout << std::setw(23)\n            << \"New orientation:\" << CommaSeparatedList(newOrient.orientation)\n            << std::endl;\n  std::this_thread::sleep_for(std::chrono::seconds(1));\n\n  std::cout << \"Reloading the original orientation.\" << std::endl;\n  SetOrientation(ren, originalOrient);\n  renWin->Render();\n  Orientation check = GetOrientation(ren);\n  std::cout << std::setw(23)\n            << \"Final orientation:\" << CommaSeparatedList(check.orientation)\n            << std::endl;\n  std::this_thread::sleep_for(std::chrono::seconds(1));\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nstd::string CommaSeparatedList(std::vector<double> const& v,\n                               const int precision, const int width)\n{\n  std::ostringstream os;\n  for (auto p = v.begin(); p < v.end() - 1; ++p)\n  {\n    os << std::fixed << std::setw(width) << std::setprecision(precision) << *p\n       << \", \";\n  }\n  os << std::fixed << std::setw(width) << std::setprecision(precision)\n     << v.back();\n  return os.str();\n}\n\nOrientation GetOrientation(vtkRenderer* ren)\n{\n  Orientation p;\n\n  vtkCamera* camera = ren->GetActiveCamera();\n  p.ToVector(camera->GetPosition(), p.position);\n  p.ToVector(camera->GetFocalPoint(), p.focalPoint);\n  p.ToVector(camera->GetViewUp(), p.viewUp);\n  p.distance = camera->GetDistance();\n  p.ToVector(camera->GetClippingRange(), p.clipplingRange);\n  p.ToVector(camera->GetOrientation(), p.orientation);\n\n  return p;\n}\n\nvoid SetOrientation(vtkRenderer* ren, Orientation const& p)\n{\n  vtkCamera* camera = ren->GetActiveCamera();\n  camera->SetPosition(p.position.data());\n  camera->SetFocalPoint(p.focalPoint.data());\n  camera->SetViewUp(p.viewUp.data());\n  camera->SetDistance(p.distance);\n  camera->SetClippingRange(p.clipplingRange.data());\n}\n\n} // namespace\n
"},{"location":"Cxx/Utilities/ResetCameraOrientation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ResetCameraOrientation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ResetCameraOrientation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ResetCameraOrientation MACOSX_BUNDLE ResetCameraOrientation.cxx )\n  target_link_libraries(ResetCameraOrientation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ResetCameraOrientation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ResetCameraOrientation/#download-and-build-resetcameraorientation","title":"Download and Build ResetCameraOrientation","text":"

Click here to download ResetCameraOrientation and its CMakeLists.txt file. Once the tarball ResetCameraOrientation.tar has been downloaded and extracted,

cd ResetCameraOrientation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ResetCameraOrientation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/SaveSceneToFieldData/","title":"SaveSceneToFieldData","text":"

vtk-examples/Cxx/Utilities/SaveSceneToFieldData

"},{"location":"Cxx/Utilities/SaveSceneToFieldData/#description","title":"Description","text":"

This example saves a vtkCamera's parameters in the vtkFieldData of a vkDataSet.

To see how the scene is saved and restored,

  1. Interact with the scene. Press the e key to exit the first iteractor. The current state of the scene's vtkCamera will be saved in the vtkDataSet's vtkFieldData.

  2. Interact with the scene again. Press the e key to exit the second interactor. The scene will be restored to the previous state.

  3. Press the e key to exit the example.

Info

This example uses snippets.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/SaveSceneToFieldData/#code","title":"Code","text":"

SaveSceneToFieldData.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFieldData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vtksys/RegularExpression.hxx>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <fstream>\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\nvoid SaveSceneToFieldData(vtkDataSet* data, vtkActor* actor, vtkCamera* camera);\nvoid RestoreSceneFromFieldData(vtkDataSet* data, vtkActor* actor,\n                               vtkCamera* camera);\n} // namespace\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  ;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SaveSceneToFieldData\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  std::cout\n      << \"Interact with image to get desired view and then press 'e' or 'q'\"\n      << std::endl;\n\n  // Interact to change camera.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  // After the interaction is done, save the scene.\n  SaveSceneToFieldData(polyData, actor, renderer->GetActiveCamera());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  // After interaction, restore the scene.\n  RestoreSceneFromFieldData(polyData, actor, renderer->GetActiveCamera());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\n#include <sstream>\nnamespace {\nvoid SaveSceneToFieldData(vtkDataSet* data, vtkActor* /* actor */,\n                          vtkCamera* camera)\n{\n  std::ostringstream buffer;\n  double vector[3];\n  double scalar;\n\n  camera->GetFocalPoint(vector);\n  buffer << \"Camera:FocalPoint \" << vector[0] << \", \" << vector[1] << \", \"\n         << vector[2] << std::endl;\n  camera->GetPosition(vector);\n  buffer << \"Camera:Position \" << vector[0] << \", \" << vector[1] << \", \"\n         << vector[2] << std::endl;\n  camera->GetViewUp(vector);\n  buffer << \"Camera:ViewUp \" << vector[0] << \", \" << vector[1] << \", \"\n         << vector[2] << std::endl;\n  scalar = camera->GetViewAngle();\n  buffer << \"Camera:ViewAngle \" << scalar << std::endl;\n  camera->GetClippingRange(vector);\n  buffer << \"Camera:ClippingRange \" << vector[0] << \", \" << vector[1]\n         << std::endl;\n  vtkNew<vtkStringArray> cameraArray;\n  cameraArray->SetNumberOfValues(1);\n  cameraArray->SetValue(0, buffer.str());\n  cameraArray->SetName(\"Camera\");\n  data->GetFieldData()->AddArray(cameraArray);\n}\n\nvoid RestoreSceneFromFieldData(vtkDataSet* data, vtkActor* /* actor */,\n                               vtkCamera* camera)\n{\n\n  std::istringstream buffer;\n\n  // Get the saved camera information from the field data\n  if (dynamic_cast<vtkStringArray*>(\n          data->GetFieldData()->GetAbstractArray(\"Camera\")))\n  {\n    buffer.str(dynamic_cast<vtkStringArray*>(\n                   data->GetFieldData()->GetAbstractArray(\"Camera\"))\n                   ->GetValue(0));\n  }\n  else\n  {\n    return;\n  }\n\n  std::string line;\n\n  vtksys::RegularExpression reCP(\"^Camera:Position\");\n  vtksys::RegularExpression reCFP(\"^Camera:FocalPoint\");\n  vtksys::RegularExpression reCVU(\"^Camera:ViewUp\");\n  vtksys::RegularExpression reCVA(\"^Camera:ViewAngle\");\n  vtksys::RegularExpression reCCR(\"^Camera:ClippingRange\");\n  vtksys::RegularExpression floatNumber(\n      \"[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\"\n      \"\\\\-]*([0-9e\\\\.\\\\-]*[^,])\");\n  vtksys::RegularExpression floatScalar(\"[^0-9\\\\.\\\\-]*([0-9\\\\.\\\\-e]*[^,])\");\n\n  while (std::getline(buffer, line))\n  {\n    if (reCFP.find(line))\n    {\n      std::string rest(line, reCFP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetFocalPoint(atof(floatNumber.match(1).c_str()),\n                              atof(floatNumber.match(2).c_str()),\n                              atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCP.find(line))\n    {\n      std::string rest(line, reCP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetPosition(atof(floatNumber.match(1).c_str()),\n                            atof(floatNumber.match(2).c_str()),\n                            atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVU.find(line))\n    {\n      std::string rest(line, reCVU.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetViewUp(atof(floatNumber.match(1).c_str()),\n                          atof(floatNumber.match(2).c_str()),\n                          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVA.find(line))\n    {\n      std::string rest(line, reCVA.end());\n      if (floatScalar.find(rest))\n      {\n        camera->SetViewAngle(atof(floatScalar.match(1).c_str()));\n      }\n    }\n    else if (reCCR.find(line))\n    {\n      std::string rest(line, reCCR.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetClippingRange(atof(floatNumber.match(1).c_str()),\n                                 atof(floatNumber.match(2).c_str()));\n      }\n    }\n    else\n    {\n      std::cout << \"Unrecognized line: \" << line << std::endl;\n    }\n  }\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Utilities/SaveSceneToFieldData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SaveSceneToFieldData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SaveSceneToFieldData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SaveSceneToFieldData MACOSX_BUNDLE SaveSceneToFieldData.cxx )\n  target_link_libraries(SaveSceneToFieldData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SaveSceneToFieldData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/SaveSceneToFieldData/#download-and-build-savescenetofielddata","title":"Download and Build SaveSceneToFieldData","text":"

Click here to download SaveSceneToFieldData and its CMakeLists.txt file. Once the tarball SaveSceneToFieldData.tar has been downloaded and extracted,

cd SaveSceneToFieldData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SaveSceneToFieldData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/SaveSceneToFile/","title":"SaveSceneToFile","text":"

vtk-examples/Cxx/Utilities/SaveSceneToFile

"},{"location":"Cxx/Utilities/SaveSceneToFile/#description","title":"Description","text":"

This example saves a vtkCamera's parameters in a file.

To see how the scene is saved and restored,

  1. Interact with the scene. Press the e key to exit the first iteractor. The current state of the scene's vtkCamera will be saved in the file.
  2. Interact with the scene again. Press the e key to exit the second interactor. The saved file is read and the scene will be restored to the previous state.
  3. Press the e key to exit the example.

Info

This example uses snippets.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/SaveSceneToFile/#code","title":"Code","text":"

SaveSceneToFile.cxx

#include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTimerLog.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/RegularExpression.hxx>\n#include <vtksys/SystemTools.hxx>\n\n#include <fstream>\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n\nvoid SaveSceneToFile(std::string fileName, vtkActor* actor, vtkCamera* camera);\n\nvoid RestoreSceneFromFile(std::string fileName, vtkActor* actor,\n                          vtkCamera* camera);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  ;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  std::cout\n      << \"Interact with image to get desired view and then press 'e' or 'q'\"\n      << std::endl;\n\n  // Interact to change camera\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  // After the interaction is done, save the scene.\n  SaveSceneToFile(argv[2], actor, renderer->GetActiveCamera());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  // After interaction, restore the scene\n  RestoreSceneFromFile(argv[2], actor, renderer->GetActiveCamera());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid SaveSceneToFile(std::string fileName, vtkActor* /* actor */,\n                     vtkCamera* camera)\n{\n  // Actor\n  //  Position, orientation, origin, scale, usrmatrix, usertransform\n  // Camera\n  //  FocalPoint, Position, ViewUp, ViewAngle, ClippingRange\n  std::ofstream saveFile(fileName, std::ofstream::out);\n  double vector[3];\n  double scalar;\n\n  camera->GetFocalPoint(vector);\n  saveFile << \"Camera:FocalPoint \" << vector[0] << \", \" << vector[1] << \", \"\n           << vector[2] << std::endl;\n  camera->GetPosition(vector);\n  saveFile << \"Camera:Position \" << vector[0] << \", \" << vector[1] << \", \"\n           << vector[2] << std::endl;\n  camera->GetViewUp(vector);\n  saveFile << \"Camera:ViewUp \" << vector[0] << \", \" << vector[1] << \", \"\n           << vector[2] << std::endl;\n  scalar = camera->GetViewAngle();\n  saveFile << \"Camera:ViewAngle \" << scalar << std::endl;\n  camera->GetClippingRange(vector);\n  saveFile << \"Camera:ClippingRange \" << vector[0] << \", \" << vector[1]\n           << std::endl;\n  saveFile.close();\n}\n\nvoid RestoreSceneFromFile(std::string fileName, vtkActor* /* actor */,\n                          vtkCamera* camera)\n{\n  std::ifstream saveFile(fileName);\n  std::string line;\n\n  vtksys::RegularExpression reCP(\"^Camera:Position\");\n  vtksys::RegularExpression reCFP(\"^Camera:FocalPoint\");\n  vtksys::RegularExpression reCVU(\"^Camera:ViewUp\");\n  vtksys::RegularExpression reCVA(\"^Camera:ViewAngle\");\n  vtksys::RegularExpression reCCR(\"^Camera:ClippingRange\");\n  vtksys::RegularExpression floatNumber(\n      \"[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\"\n      \"\\\\-]*([0-9e\\\\.\\\\-]*[^,])\");\n  vtksys::RegularExpression floatScalar(\"[^0-9\\\\.\\\\-]*([0-9\\\\.\\\\-e]*[^,])\");\n\n  while (std::getline(saveFile, line) && !saveFile.eof())\n  {\n    if (reCFP.find(line))\n    {\n      std::string rest(line, reCFP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetFocalPoint(atof(floatNumber.match(1).c_str()),\n                              atof(floatNumber.match(2).c_str()),\n                              atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCP.find(line))\n    {\n      std::string rest(line, reCP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetPosition(atof(floatNumber.match(1).c_str()),\n                            atof(floatNumber.match(2).c_str()),\n                            atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVU.find(line))\n    {\n      std::string rest(line, reCVU.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetViewUp(atof(floatNumber.match(1).c_str()),\n                          atof(floatNumber.match(2).c_str()),\n                          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVA.find(line))\n    {\n      std::string rest(line, reCVA.end());\n      if (floatScalar.find(rest))\n      {\n        camera->SetViewAngle(atof(floatScalar.match(1).c_str()));\n      }\n    }\n    else if (reCCR.find(line))\n    {\n      std::string rest(line, reCCR.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetClippingRange(atof(floatNumber.match(1).c_str()),\n                                 atof(floatNumber.match(2).c_str()));\n      }\n    }\n    else\n    {\n      std::cout << \"Unrecognized line: \" << line << std::endl;\n    }\n  }\n  saveFile.close();\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Utilities/SaveSceneToFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SaveSceneToFile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonSystem\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SaveSceneToFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SaveSceneToFile MACOSX_BUNDLE SaveSceneToFile.cxx )\n  target_link_libraries(SaveSceneToFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SaveSceneToFile\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/SaveSceneToFile/#download-and-build-savescenetofile","title":"Download and Build SaveSceneToFile","text":"

Click here to download SaveSceneToFile and its CMakeLists.txt file. Once the tarball SaveSceneToFile.tar has been downloaded and extracted,

cd SaveSceneToFile/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SaveSceneToFile\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/Screenshot/","title":"Screenshot","text":"

vtk-examples/Cxx/Utilities/Screenshot

"},{"location":"Cxx/Utilities/Screenshot/#description","title":"Description","text":"

This example shows how to save the window to a file (png in this case). You can combine this with the KeypressEvents example to make a useful functionality.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/Screenshot/#code","title":"Code","text":"

Screenshot.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n#include <vtkWindowToImageFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n  sphereSource->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"IndianRed\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetAlphaBitPlanes(1); // enable usage of alpha channel\n  renderWindow->SetWindowName(\"Screenshot\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  renderWindow->Render();\n\n  // Screenshot\n  vtkNew<vtkWindowToImageFilter> windowToImageFilter;\n  windowToImageFilter->SetInput(renderWindow);\n#if VTK_MAJOR_VERSION >= 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90\n  windowToImageFilter->SetScale(2); // image quality\n#else\n  windowToImageFilter->SetMagnification(2); // image quality\n#endif\n  windowToImageFilter->SetInputBufferTypeToRGBA(); // also record the alpha\n                                                   // (transparency) channel\n  windowToImageFilter->ReadFrontBufferOff();       // read from the back buffer\n  windowToImageFilter->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(\"screenshot2.png\");\n  writer->SetInputConnection(windowToImageFilter->GetOutputPort());\n  writer->Write();\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/Screenshot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Screenshot)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Screenshot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Screenshot MACOSX_BUNDLE Screenshot.cxx )\n  target_link_libraries(Screenshot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Screenshot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/Screenshot/#download-and-build-screenshot","title":"Download and Build Screenshot","text":"

Click here to download Screenshot and its CMakeLists.txt file. Once the tarball Screenshot.tar has been downloaded and extracted,

cd Screenshot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Screenshot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ShallowCopy/","title":"ShallowCopy","text":"

vtk-examples/Cxx/Utilities/ShallowCopy

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ShallowCopy/#code","title":"Code","text":"

ShallowCopy.cxx

#include <vtkNew.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPolyData> polydata;\n\n  vtkNew<vtkPolyData> polydataCopy;\n\n  polydataCopy->ShallowCopy(polydata);\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ShallowCopy/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShallowCopy)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShallowCopy: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShallowCopy MACOSX_BUNDLE ShallowCopy.cxx )\n  target_link_libraries(ShallowCopy PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShallowCopy\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ShallowCopy/#download-and-build-shallowcopy","title":"Download and Build ShallowCopy","text":"

Click here to download ShallowCopy and its CMakeLists.txt file. Once the tarball ShallowCopy.tar has been downloaded and extracted,

cd ShallowCopy/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ShallowCopy\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ShareCamera/","title":"ShareCamera","text":"

vtk-examples/Cxx/Utilities/ShareCamera

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ShareCamera/#code","title":"Code","text":"

ShareCamera.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataAlgorithm.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <map>\n#include <vector>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // We store background colors in a vector. Then we extract the red, green and\n  // blue components later when coloring the reneder background.\n  std::vector<vtkColor3ub> rendererColors;\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorSchemeByName(\"Brewer Qualitative Pastel2\");\n  rendererColors.push_back(colorSeries->GetColor(0));\n  rendererColors.push_back(colorSeries->GetColor(1));\n  rendererColors.push_back(colorSeries->GetColor(2));\n  rendererColors.push_back(colorSeries->GetColor(3));\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  double xmins[4] = {0, 0.5, 0, 0.5};\n  double xmaxs[4] = {0.5, 1, 0.5, 1};\n  double ymins[4] = {0, 0, 0.5, 0.5};\n  double ymaxs[4] = {0.5, 0.5, 1, 1};\n\n  vtkCamera* camera = nullptr;\n\n  // Using the superclass for the sources\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> sources;\n\n  for (unsigned i = 0; i < 4; i++)\n  {\n    switch (i)\n    {\n    case 0: {\n      // Create a sphere\n      vtkNew<vtkSphereSource> sphereSource;\n      sphereSource->SetCenter(0.0, 0.0, 0.0);\n      sphereSource->Update();\n      sources.push_back(sphereSource);\n      break;\n    }\n    case 1: {\n      // Create a cone\n      vtkNew<vtkConeSource> coneSource;\n      coneSource->SetCenter(0.0, 0.0, 0.0);\n      coneSource->Update();\n      sources.push_back(coneSource);\n      break;\n    }\n    case 2: {\n      // Create a cube\n      vtkNew<vtkCubeSource> cubeSource;\n      cubeSource->SetCenter(0.0, 0.0, 0.0);\n      cubeSource->Update();\n      sources.push_back(cubeSource);\n      break;\n    }\n    default:\n    case 3: {\n      // Create a cylinder\n      vtkNew<vtkCylinderSource> cylinderSource;\n      cylinderSource->SetCenter(0.0, 0.0, 0.0);\n      cylinderSource->Update();\n      sources.push_back(cylinderSource);\n    }\n    };\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sources[i]->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(actor);\n    double r, g, b;\n    r = rendererColors[i].GetRed() / 255.0;\n    g = rendererColors[i].GetGreen() / 255.0;\n    b = rendererColors[i].GetBlue() / 255.0;\n    renderer->SetBackground(r, g, b);\n\n    renderWindow->AddRenderer(renderer);\n\n    if (i == 0)\n    {\n      camera = renderer->GetActiveCamera();\n      camera->Azimuth(30);\n      camera->Elevation(30);\n    }\n    else\n    {\n      renderer->SetActiveCamera(camera);\n    }\n    renderer->SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i]);\n\n    renderer->ResetCamera();\n  }\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ShareCamera\");\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ShareCamera/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShareCamera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonExecutionModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShareCamera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShareCamera MACOSX_BUNDLE ShareCamera.cxx )\n  target_link_libraries(ShareCamera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShareCamera\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ShareCamera/#download-and-build-sharecamera","title":"Download and Build ShareCamera","text":"

Click here to download ShareCamera and its CMakeLists.txt file. Once the tarball ShareCamera.tar has been downloaded and extracted,

cd ShareCamera/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ShareCamera\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ShepardMethod/","title":"ShepardMethod","text":"

vtk-examples/Cxx/Utilities/ShepardMethod

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Utilities/ShepardMethod/#description","title":"Description","text":"

This example samples unstructured points onto structured points using the Shepard method. The example starts with two points which have associated scalars (0 (black) and 1(white)). The results are displayed by coloring planes between the two points with the corresponding interpolated values. The values are reflected by black (0) to white (1).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ShepardMethod/#code","title":"Code","text":"

ShepardMethod.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkContourFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShepardMethod.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVertexGlyphFilter.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a set of vertices (polydata)\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(100.0, 0.0, 0.0);\n  points->InsertNextPoint(300.0, 0.0, 0.0);\n\n  // Setup colors\n  unsigned char white[3] = {255, 255, 255};\n  unsigned char black[3] = {0, 0, 0};\n\n  vtkNew<vtkUnsignedCharArray> vertexColors;\n  vertexColors->SetNumberOfComponents(3);\n  vertexColors->SetName(\"Colors\");\n  vertexColors->InsertNextTupleValue(black);\n  vertexColors->InsertNextTupleValue(white);\n\n  // Create a scalar array for the pointdata, each value represents the distance\n  // of the vertices from the first vertex.\n  vtkNew<vtkFloatArray> values;\n  values->SetNumberOfComponents(1);\n  values->SetName(\"Values\");\n  values->InsertNextValue(0.0);\n  values->InsertNextValue(1.0);\n\n  // We must make two objects, because the ShepardMethod uses the ActiveScalars,\n  // as does the renderer!\n  vtkNew<vtkPolyData> polydataToProcess;\n  polydataToProcess->SetPoints(points);\n  polydataToProcess->GetPointData()->SetScalars(values);\n\n  vtkNew<vtkPolyData> polydataToVisualize;\n  polydataToVisualize->SetPoints(points);\n  polydataToVisualize->GetPointData()->SetScalars(vertexColors);\n\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->AddInputData(polydataToVisualize);\n  vertexGlyphFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> vertsMapper;\n  // vertsMapper->ScalarVisibilityOff();\n  vertsMapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> vertsActor;\n  vertsActor->SetMapper(vertsMapper);\n  vertsActor->GetProperty()->SetColor(1, 0, 0);\n  vertsActor->GetProperty()->SetPointSize(3);\n\n  // Create a shepard filter to interpolate the vertices over a regularized\n  // image grid.\n  vtkNew<vtkShepardMethod> shepard;\n  shepard->SetInputData(polydataToProcess);\n  shepard->SetSampleDimensions(2, 2, 2);\n  shepard->SetModelBounds(100, 300, -10, 10, -10, 10);\n  shepard->SetMaximumDistance(1);\n\n  // Contour the shepard generated image at 3 isovalues.\n  // The accuracy of the results are highly dependent on how the shepard filter\n  // is set up.\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetNumberOfContours(3);\n  contourFilter->SetValue(0, 0.25);\n  contourFilter->SetValue(1, 0.50);\n  contourFilter->SetValue(2, 0.75);\n  contourFilter->SetInputConnection(shepard->GetOutputPort());\n  contourFilter->Update();\n\n  // Create a mapper and actor for the resulting isosurfaces.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contourFilter->GetOutputPort());\n  contourMapper->ScalarVisibilityOn();\n  contourMapper->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n  contourActor->GetProperty()->SetAmbient(1);\n  contourActor->GetProperty()->SetSpecular(0);\n  contourActor->GetProperty()->SetDiffuse(0);\n\n  // Report the results of the interpolation.\n  double* range = contourFilter->GetOutput()->GetScalarRange();\n\n  std::cout << \"Shepard interpolation:\" << std::endl;\n  std::cout << \"Contour output scalar range: \" << range[0] << \", \" << range[1]\n            << std::endl;\n\n  vtkIdType nCells = contourFilter->GetOutput()->GetNumberOfCells();\n  double bounds[6];\n  for (vtkIdType i = 0; i < nCells; ++i)\n  {\n    if (i %\n        2) // each isosurface value only has 2 cells so report on the odd ones.\n    {\n      contourFilter->GetOutput()->GetCellBounds(i, bounds);\n      std::cout << \"Cell \" << i << \", x position: \" << bounds[0] << std::endl;\n    }\n  }\n\n  // Create a transfer function to color the isosurfaces.\n  vtkNew<vtkColorTransferFunction> lut;\n  lut->SetColorSpaceToRGB();\n  lut->AddRGBPoint(range[0], 0, 0, 0); // black\n  lut->AddRGBPoint(range[1], 1, 1, 1); // white\n  lut->SetScaleToLinear();\n\n  contourMapper->SetLookupTable(lut);\n\n  // Create a renderer, render window and interactor.\n  vtkNew<vtkRenderer> renderer;\n  renderer->GradientBackgroundOn();\n  renderer->AddActor(contourActor);\n  renderer->AddActor(vertsActor);\n  renderer->SetBackground(colors->GetColor3d(\"Blue\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Magenta\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ShepardMethod\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Position the camera so that the image produced is viewable\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->SetPosition(450, 100, 100);\n  camera->SetFocalPoint(200, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ShepardMethod/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShepardMethod)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShepardMethod: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShepardMethod MACOSX_BUNDLE ShepardMethod.cxx )\n  target_link_libraries(ShepardMethod PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShepardMethod\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ShepardMethod/#download-and-build-shepardmethod","title":"Download and Build ShepardMethod","text":"

Click here to download ShepardMethod and its CMakeLists.txt file. Once the tarball ShepardMethod.tar has been downloaded and extracted,

cd ShepardMethod/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ShepardMethod\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/SortDataArray/","title":"SortDataArray","text":"

vtk-examples/Cxx/Utilities/SortDataArray

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/SortDataArray/#code","title":"Code","text":"

SortDataArray.cxx

#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkSortDataArray.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkDoubleArray> valueArray;\n  valueArray->InsertNextValue(20.0);\n  valueArray->InsertNextValue(10.0);\n  valueArray->InsertNextValue(30.0);\n\n  vtkNew<vtkIntArray> keyArray;\n  keyArray->InsertNextValue(1);\n  keyArray->InsertNextValue(0);\n  keyArray->InsertNextValue(2);\n\n  std::cout << \"Unsorted: \" << valueArray->GetValue(0) << \" \"\n            << valueArray->GetValue(1) << \" \" << valueArray->GetValue(2)\n            << std::endl;\n\n  // Sort the array\n  vtkNew<vtkSortDataArray> sortDataArray;\n  sortDataArray->Sort(keyArray, valueArray);\n\n  std::cout << \"Sorted: \" << valueArray->GetValue(0) << \" \"\n            << valueArray->GetValue(1) << \" \" << valueArray->GetValue(2)\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/SortDataArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SortDataArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SortDataArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SortDataArray MACOSX_BUNDLE SortDataArray.cxx )\n  target_link_libraries(SortDataArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SortDataArray\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/SortDataArray/#download-and-build-sortdataarray","title":"Download and Build SortDataArray","text":"

Click here to download SortDataArray and its CMakeLists.txt file. Once the tarball SortDataArray.tar has been downloaded and extracted,

cd SortDataArray/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SortDataArray\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/SparseArray/","title":"SparseArray","text":"

vtk-examples/Cxx/Utilities/SparseArray

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/SparseArray/#code","title":"Code","text":"

SparseArray.cxx

#include <vtkNew.h>\n#include <vtkSparseArray.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSparseArray<double>> array;\n  array->Resize(5, 1);\n  array->SetNullValue(-1);\n\n  for (unsigned int i = 0; i < 5; i++)\n  {\n    array->SetValue(i, 0, i);\n  }\n\n  for (unsigned int i = 0; i < 6; i++)\n  {\n    double val = array->GetValue(i, 0);\n    std::cout << val << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/SparseArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SparseArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SparseArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SparseArray MACOSX_BUNDLE SparseArray.cxx )\n  target_link_libraries(SparseArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SparseArray\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/SparseArray/#download-and-build-sparsearray","title":"Download and Build SparseArray","text":"

Click here to download SparseArray and its CMakeLists.txt file. Once the tarball SparseArray.tar has been downloaded and extracted,

cd SparseArray/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SparseArray\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/TimeStamp/","title":"TimeStamp","text":"

vtk-examples/Cxx/Utilities/TimeStamp

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/TimeStamp/#code","title":"Code","text":"

TimeStamp.cxx

#include <vtkTimeStamp.h>\n\nint main(int, char*[])\n{\n  vtkTimeStamp timeStamp;\n  std::cout << \"Time stamp: \" << timeStamp << std::endl;\n  timeStamp.Modified();\n  std::cout << \"Time stamp: \" << timeStamp << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/TimeStamp/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TimeStamp)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TimeStamp: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TimeStamp MACOSX_BUNDLE TimeStamp.cxx )\n  target_link_libraries(TimeStamp PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TimeStamp\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/TimeStamp/#download-and-build-timestamp","title":"Download and Build TimeStamp","text":"

Click here to download TimeStamp and its CMakeLists.txt file. Once the tarball TimeStamp.tar has been downloaded and extracted,

cd TimeStamp/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TimeStamp\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/Timer/","title":"Timer","text":"

vtk-examples/Cxx/Utilities/Timer

"},{"location":"Cxx/Utilities/Timer/#description","title":"Description","text":"

This example demonstrates how to use a timer with an interactor. It outputs a count every specified interval.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/Timer/#code","title":"Code","text":"

Timer.cxx

#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nclass vtkTimerCallback : public vtkCallbackCommand\n{\npublic:\n  vtkTimerCallback() = default;\n\n  static vtkTimerCallback* New()\n  {\n    vtkTimerCallback* cb = new vtkTimerCallback;\n    cb->TimerCount = 0;\n    return cb;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long eventId,\n                       void* vtkNotUsed(callData))\n  {\n    if (vtkCommand::TimerEvent == eventId)\n    {\n      ++this->TimerCount;\n    }\n    std::cout << this->TimerCount << std::endl;\n    if (this->TimerCount >= this->maxCount)\n    {\n      auto iren = dynamic_cast<vtkRenderWindowInteractor*>(caller);\n      if (this->timerId > -1)\n      {\n        iren->DestroyTimer(this->timerId);\n      }\n    }\n  }\n\nprivate:\n  int TimerCount = 0;\n\npublic:\n  int maxCount = 0;\n  int timerId = -1;\n};\n\nint main(int, char*[])\n{\n  // Setup renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Timer\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Initialize must be called prior to creating timer events.\n  renderWindow->Render();\n  interactor->Initialize();\n\n  // Sign up to receive TimerEvent.\n  vtkNew<vtkTimerCallback> cb;\n  interactor->AddObserver(vtkCommand::TimerEvent, cb);\n\n  int timerId = interactor->CreateRepeatingTimer(100);\n  std::cout << \"timerId: \" << timerId << std::endl;\n  // Destroy the timer when maxCount is reached.\n  cb->maxCount = 10;\n  cb->timerId = timerId;\n\n  // Note: nothing is displayed in the render window.\n  // Start the interaction and timer.\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/Timer/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Timer)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Timer: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Timer MACOSX_BUNDLE Timer.cxx )\n  target_link_libraries(Timer PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Timer\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/Timer/#download-and-build-timer","title":"Download and Build Timer","text":"

Click here to download Timer and its CMakeLists.txt file. Once the tarball Timer.tar has been downloaded and extracted,

cd Timer/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Timer\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/TimerLog/","title":"TimerLog","text":"

vtk-examples/Cxx/Utilities/TimerLog

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/TimerLog/#code","title":"Code","text":"

TimerLog.cxx

#include <vtkNew.h>\n#include <vtkTimerLog.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkTimerLog> timerLog;\n\n  std::cout << \"Current time: \" << timerLog->GetUniversalTime() << std::endl;\n\n  timerLog->MarkEvent(\"opened file\");\n\n  timerLog->MarkEvent(\"did other stuff\");\n\n  std::cout << \"Timer log:\" << *timerLog << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/TimerLog/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TimerLog)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonSystem\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TimerLog: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TimerLog MACOSX_BUNDLE TimerLog.cxx )\n  target_link_libraries(TimerLog PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TimerLog\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/TimerLog/#download-and-build-timerlog","title":"Download and Build TimerLog","text":"

Click here to download TimerLog and its CMakeLists.txt file. Once the tarball TimerLog.tar has been downloaded and extracted,

cd TimerLog/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TimerLog\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/UnknownLengthArray/","title":"UnknownLengthArray","text":"

vtk-examples/Cxx/Utilities/UnknownLengthArray

"},{"location":"Cxx/Utilities/UnknownLengthArray/#description","title":"Description","text":"

The only difference between this example and the KnownLengthArray example is that SetNumberOfValues() is not called, and SetValue() is replaced by InsertNextValue().

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/UnknownLengthArray/#code","title":"Code","text":"

UnknownLengthArray.cxx

#include <vtkFloatArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFloatArray> distances;\n  distances->SetName(\"Distances\");\n  distances->SetNumberOfComponents(1);\n\n  // set values\n  for (vtkIdType i = 0; i < 5; i++)\n  {\n    float f = (float)i + 0.1;\n    // this will allocate memory as necessary\n    distances->InsertNextValue(f);\n  }\n\n  // get values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    float f = distances->GetValue(i);\n    std::cout << f << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/UnknownLengthArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(UnknownLengthArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"UnknownLengthArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(UnknownLengthArray MACOSX_BUNDLE UnknownLengthArray.cxx )\n  target_link_libraries(UnknownLengthArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS UnknownLengthArray\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/UnknownLengthArray/#download-and-build-unknownlengtharray","title":"Download and Build UnknownLengthArray","text":"

Click here to download UnknownLengthArray and its CMakeLists.txt file. Once the tarball UnknownLengthArray.tar has been downloaded and extracted,

cd UnknownLengthArray/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./UnknownLengthArray\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/Variant/","title":"Variant","text":"

vtk-examples/Cxx/Utilities/Variant

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/Variant/#code","title":"Code","text":"

Variant.cxx

#include <vtkVariant.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  double dVal = vtkVariant(\"2\").ToDouble();\n  std::cout << \"dVal: \" << dVal << std::endl;\n  std::string strVal = vtkVariant(dVal).ToString();\n  std::cout << \"strVal: \" << strVal << std::endl;\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/Variant/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Variant)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Variant: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Variant MACOSX_BUNDLE Variant.cxx )\n  target_link_libraries(Variant PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Variant\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/Variant/#download-and-build-variant","title":"Download and Build Variant","text":"

Click here to download Variant and its CMakeLists.txt file. Once the tarball Variant.tar has been downloaded and extracted,

cd Variant/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Variant\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/Vector/","title":"Vector","text":"

vtk-examples/Cxx/Utilities/Vector

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/Vector/#code","title":"Code","text":"

Vector.cxx

#include <vtkVector.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkVector3d v(1.0, 2.0, 3.0);\n  std::cout << v.GetX() << \" \" << v.GetY() << \" \" << v.GetZ() << std::endl;\n\n  double* vals = v.GetData();\n\n  std::cout << vals[0] << \" \" << vals[1] << \" \" << vals[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/Vector/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Vector)\n\nfind_package(VTK COMPONENTS \n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Vector: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Vector MACOSX_BUNDLE Vector.cxx )\n  target_link_libraries(Vector PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Vector\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/Vector/#download-and-build-vector","title":"Download and Build Vector","text":"

Click here to download Vector and its CMakeLists.txt file. Once the tarball Vector.tar has been downloaded and extracted,

cd Vector/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Vector\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/VectorArrayKnownLength/","title":"VectorArrayKnownLength","text":"

vtk-examples/Cxx/Utilities/VectorArrayKnownLength

"},{"location":"Cxx/Utilities/VectorArrayKnownLength/#description","title":"Description","text":"

This example creates a VTK style float array of vectors. This can be easily interchanged with vtkIntArray, vtkDoubleArray, etc.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/VectorArrayKnownLength/#code","title":"Code","text":"

VectorArrayKnownLength.cxx

#include <vtkFloatArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFloatArray> distances;\n  distances->SetName(\"Distances\");\n  distances->SetNumberOfComponents(3);\n  distances->SetNumberOfTuples(5);\n\n  // set values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    float tuple[3];\n    tuple[0] = (float)i + 0.1;\n    tuple[1] = (float)i + 0.2;\n    tuple[2] = (float)i + 0.3;\n    distances->SetTuple(i, tuple);\n  }\n\n  // get values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    double d[3];\n    distances->GetTuple(i, d);\n    std::cout << d[0] << \" \" << d[1] << \" \" << d[2] << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/VectorArrayKnownLength/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorArrayKnownLength)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorArrayKnownLength: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorArrayKnownLength MACOSX_BUNDLE VectorArrayKnownLength.cxx )\n  target_link_libraries(VectorArrayKnownLength PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorArrayKnownLength\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/VectorArrayKnownLength/#download-and-build-vectorarrayknownlength","title":"Download and Build VectorArrayKnownLength","text":"

Click here to download VectorArrayKnownLength and its CMakeLists.txt file. Once the tarball VectorArrayKnownLength.tar has been downloaded and extracted,

cd VectorArrayKnownLength/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VectorArrayKnownLength\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/VectorArrayUnknownLength/","title":"VectorArrayUnknownLength","text":"

vtk-examples/Cxx/Utilities/VectorArrayUnknownLength

"},{"location":"Cxx/Utilities/VectorArrayUnknownLength/#description","title":"Description","text":"

This example creates a VTK style float array of vectors. This can be easily interchanged with vtkIntArray, vtkDoubleArray, etc.

The only difference between this example and the VectorArrayKnownLength example is that SetNumberOfValues() is not called, and SetTuple() is replaced by InsertNextTuple().

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/VectorArrayUnknownLength/#code","title":"Code","text":"

VectorArrayUnknownLength.cxx

#include <vtkFloatArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFloatArray> distances;\n  distances->SetName(\"Distances\");\n  distances->SetNumberOfComponents(3);\n\n  // set values\n  for (vtkIdType i = 0; i < 5; i++)\n  {\n    float tuple[3];\n    tuple[0] = (float)i + 0.1;\n    tuple[1] = (float)i + 0.2;\n    tuple[2] = (float)i + 0.3;\n    // this will allocate memory as necessary\n    distances->InsertNextTuple(tuple);\n  }\n\n  // get values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    double d[3];\n    distances->GetTuple(i, d);\n    std::cout << d[0] << \" \" << d[1] << \" \" << d[2] << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/VectorArrayUnknownLength/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorArrayUnknownLength)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorArrayUnknownLength: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorArrayUnknownLength MACOSX_BUNDLE VectorArrayUnknownLength.cxx )\n  target_link_libraries(VectorArrayUnknownLength PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorArrayUnknownLength\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/VectorArrayUnknownLength/#download-and-build-vectorarrayunknownlength","title":"Download and Build VectorArrayUnknownLength","text":"

Click here to download VectorArrayUnknownLength and its CMakeLists.txt file. Once the tarball VectorArrayUnknownLength.tar has been downloaded and extracted,

cd VectorArrayUnknownLength/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VectorArrayUnknownLength\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ViewportBorders/","title":"ViewportBorders","text":"

vtk-examples/Cxx/Utilities/ViewportBorders

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Utilities/ViewportBorders/#description","title":"Description","text":"

Sometimes multiple vtkRenderer viewports can be difficult to differentiate. This example draws a border around each viewport. The example creates a vtkPolyLine that outlines the viewport. The coordinates for the vtkPoints are specified in normalized viewport coordinates. The coordinate selection is made with a vtkCoordinate. The vtkPolyDataMapper2D and vtkActor2D render the border.

To run the example, provide 1-N vtkPolyDataReader files.

This examples uses the data, src/Testing/Data/v.vtk,, src/Testing/Data/t.vtk and src/Testing/Data/k.vtk.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ViewportBorders/#code","title":"Code","text":"

ViewportBorders.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCellArray.h>\n#include <vtkCoordinate.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkPolyDataReader.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\nvoid ViewportBorder(vtkRenderer* renderer, double* color, bool last = false);\n}\n\nint main(int argc, char* argv[])\n{\n\n  int numberOfFiles = argc - 1;\n  if (numberOfFiles == 0)\n  {\n    std::cout << \"Usage\" << argv[0]\n              << \" file1 file2 file3 ... fileN e.g. v.vtk t.vtk k.vtk\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300 * numberOfFiles, 300);\n  renderWindow->SetWindowName(\"ViewportBorders\");\n\n  double size = 1.0 / numberOfFiles;\n  for (unsigned int i = 0; static_cast<int>(i) < numberOfFiles; ++i)\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(argv[i + 1]);\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(reader->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(actor);\n    renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n    double viewport[4];\n    viewport[0] = size * i;\n    viewport[1] = 0.0;\n    viewport[2] = size * (i + 1);\n    viewport[3] = 1.0;\n    renderer->SetViewport(viewport);\n    ViewportBorder(renderer, colors->GetColor3d(\"Gold\").GetData(),\n                   static_cast<int>(i) == numberOfFiles - 1);\n    renderWindow->AddRenderer(renderer);\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\n// Draw the borders of a renderer's viewport.\nvoid ViewportBorder(vtkRenderer* renderer, double* color, bool last)\n{\n  // points start at upper right and proceed anti-clockwise\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  // Create cells, and lines.\n  vtkNew<vtkCellArray> cells;\n  cells->Initialize();\n\n  vtkNew<vtkPolyLine> lines;\n\n  // Only draw last line if this is the last viewport.\n  // This prevents double vertical lines at right border.\n  // If different colors are used for each border, then do\n  // not specify last.\n  if (last)\n  {\n    lines->GetPointIds()->SetNumberOfIds(5);\n  }\n  else\n  {\n    lines->GetPointIds()->SetNumberOfIds(4);\n  }\n  for (unsigned int i = 0; i < 4; ++i)\n  {\n    lines->GetPointIds()->SetId(i, i);\n  }\n  if (last)\n  {\n    lines->GetPointIds()->SetId(4, 0);\n  }\n  cells->InsertNextCell(lines);\n\n  // Now make the polydata and display it.\n  vtkNew<vtkPolyData> poly;\n  poly->Initialize();\n  poly->SetPoints(points);\n  poly->SetLines(cells);\n\n  // Use normalized viewport coordinates since\n  // they are independent of window size.\n  vtkNew<vtkCoordinate> coordinate;\n  coordinate->SetCoordinateSystemToNormalizedViewport();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(poly);\n  mapper->SetTransformCoordinate(coordinate);\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(color);\n  // Line width should be at least 2 to be visible at extremes.\n\n  actor->GetProperty()->SetLineWidth(4.0); // Line Width\n\n  renderer->AddViewProp(actor);\n}\n} // namespace\n
"},{"location":"Cxx/Utilities/ViewportBorders/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ViewportBorders)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ViewportBorders: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ViewportBorders MACOSX_BUNDLE ViewportBorders.cxx )\n  target_link_libraries(ViewportBorders PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ViewportBorders\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ViewportBorders/#download-and-build-viewportborders","title":"Download and Build ViewportBorders","text":"

Click here to download ViewportBorders and its CMakeLists.txt file. Once the tarball ViewportBorders.tar has been downloaded and extracted,

cd ViewportBorders/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ViewportBorders\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/WindowModifiedEvent/","title":"WindowModifiedEvent","text":"

vtk-examples/Cxx/Utilities/WindowModifiedEvent

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Utilities/WindowModifiedEvent/#description","title":"Description","text":"

This example limits the horizontal window size to 400.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/WindowModifiedEvent/#code","title":"Code","text":"

WindowModifiedEvent.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nvoid WindowModifiedCallback(vtkObject* caller,\n                            long unsigned int vtkNotUsed(eventId),\n                            void* vtkNotUsed(clientData),\n                            void* vtkNotUsed(callData))\n{\n  std::cout << \"Window modified\" << std::endl;\n  std::cout << caller->GetClassName() << std::endl;\n\n  vtkRenderWindow* window = static_cast<vtkRenderWindow*>(caller);\n  int* windowSize = window->GetSize();\n  std::cout << \"Size: \" << windowSize[0] << \" \" << windowSize[1] << std::endl;\n\n  if (windowSize[0] > 400)\n  {\n    window->SetSize(400, windowSize[1]);\n    window->Render();\n    window->Modified();\n    window->Render();\n  }\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WindowModifiedEvent\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkCallbackCommand> m_pModifiedCallback;\n  m_pModifiedCallback->SetCallback(WindowModifiedCallback);\n  // m_pModifiedCallback->SetClientData(this);\n\n  renderWindow->AddObserver(vtkCommand::ModifiedEvent, m_pModifiedCallback);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/WindowModifiedEvent/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WindowModifiedEvent)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WindowModifiedEvent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WindowModifiedEvent MACOSX_BUNDLE WindowModifiedEvent.cxx )\n  target_link_libraries(WindowModifiedEvent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WindowModifiedEvent\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/WindowModifiedEvent/#download-and-build-windowmodifiedevent","title":"Download and Build WindowModifiedEvent","text":"

Click here to download WindowModifiedEvent and its CMakeLists.txt file. Once the tarball WindowModifiedEvent.tar has been downloaded and extracted,

cd WindowModifiedEvent/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WindowModifiedEvent\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Utilities/ZBuffer/","title":"ZBuffer","text":"

vtk-examples/Cxx/Utilities/ZBuffer

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Utilities/ZBuffer/#code","title":"Code","text":"

ZBuffer.cxx

// This demo creates depth map for a polydata instance by extracting\n// exact ZBuffer values.\n#include <vtkActor.h>\n#include <vtkBMPWriter.h>\n#include <vtkImageShiftScale.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n#include <vtkWindowToImageFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" input(.vtp) output(.bmp)\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  vtkNew<vtkXMLPolyDataReader> fileReader;\n  vtkNew<vtkWindowToImageFilter> filter;\n  vtkNew<vtkBMPWriter> imageWriter;\n  vtkNew<vtkImageShiftScale> scale;\n\n  // Read .vtp file\n  fileReader->SetFileName(argv[1]);\n\n  // Build visualization enviroment\n  mapper->SetInputConnection(fileReader->GetOutputPort());\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tan\").GetData());\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"WindowModifiedEvent\");\n\n  interactor->SetRenderWindow(renWin);\n  renWin->Render();\n\n  // Create Depth Map\n  filter->SetInput(renWin);\n#if VTK_MAJOR_VERSION >= 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90\n  filter->SetScale(1);\n#else\n  filter->SetMagnification(1);\n#endif\n  filter->SetInputBufferTypeToZBuffer(); // Extract z buffer value\n\n  scale->SetOutputScalarTypeToUnsignedChar();\n  scale->SetInputConnection(filter->GetOutputPort());\n  scale->SetShift(0);\n  scale->SetScale(-255);\n\n  // Write depth map as a .bmp image\n  imageWriter->SetFileName(argv[2]);\n  imageWriter->SetInputConnection(scale->GetOutputPort());\n  imageWriter->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Utilities/ZBuffer/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ZBuffer)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  IOXML\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ZBuffer: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ZBuffer MACOSX_BUNDLE ZBuffer.cxx )\n  target_link_libraries(ZBuffer PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ZBuffer\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Utilities/ZBuffer/#download-and-build-zbuffer","title":"Download and Build ZBuffer","text":"

Click here to download ZBuffer and its CMakeLists.txt file. Once the tarball ZBuffer.tar has been downloaded and extracted,

cd ZBuffer/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ZBuffer\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Video/FFMPEG/","title":"FFMPEG","text":"

vtk-examples/Cxx/Video/FFMPEG

"},{"location":"Cxx/Video/FFMPEG/#description","title":"Description","text":"

You must set VTK_USE_FFMPEG_ENCODER ON in your VTK build.

CMake won't find FFMPEG headers?

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Video/FFMPEG/#code","title":"Code","text":"

FFMPEG.cxx

#include <vtkFFMPEGWriter.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkNew.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 100, 0, 100, 0, 0);\n\n  vtkNew<vtkFFMPEGWriter> writer;\n\n  writer->SetInputConnection(source->GetOutputPort());\n  writer->SetFileName(\"test.avi\");\n  writer->Start();\n\n  for (unsigned int i = 0; i < 100; i++)\n  {\n    source->SetDrawColor(0, 0, 0, 1);   // black\n    source->FillBox(0, 100, 0, 100);    // clear image\n    source->SetDrawColor(255, 0, 0, 1); // red\n    source->FillBox(i, 20, 10, 20);\n    source->Update();\n\n    writer->Write();\n  }\n  writer->End();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Video/FFMPEG/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FFMPEG)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOFFMPEG\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FFMPEG: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FFMPEG MACOSX_BUNDLE FFMPEG.cxx )\n  target_link_libraries(FFMPEG PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FFMPEG\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Video/FFMPEG/#download-and-build-ffmpeg","title":"Download and Build FFMPEG","text":"

Click here to download FFMPEG and its CMakeLists.txt file. Once the tarball FFMPEG.tar has been downloaded and extracted,

cd FFMPEG/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FFMPEG\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Video/MPEG2/","title":"MPEG2","text":"

vtk-examples/Cxx/Video/MPEG2

"},{"location":"Cxx/Video/MPEG2/#description","title":"Description","text":"

You must set VTK_USE_MPEG2_ENCODER ON VTK_USE_OGGTHEORA_ENCODER ON in your VTK build.

CMake won't find MPEG2?

When compiling: cannot find -lvtkoggtheora

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Video/MPEG2/#code","title":"Code","text":"

MPEG2.cxx

#include <vtkImageCanvasSource2D.h>\n#include <vtkMPEG2Writer.h>\n#include <vtkNew.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 100, 0, 100, 0, 0);\n\n  vtkNew<vtkMPEG2Writer> writer;\n\n  writer->SetInputConnection(source->GetOutputPort());\n  writer->SetFileName(\"test.avi\");\n  writer->Start();\n\n  for (unsigned int i = 0; i < 100; i++)\n  {\n    source->SetDrawColor(0, 0, 0, 1);   // black\n    source->FillBox(0, 100, 0, 100);    // clear image\n    source->SetDrawColor(255, 0, 0, 1); // red\n    source->FillBox(i, 20, 10, 20);\n    source->Update();\n\n    writer->Write();\n  }\n  writer->End();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Video/MPEG2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MPEG2)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MPEG2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MPEG2 MACOSX_BUNDLE MPEG2.cxx )\n  target_link_libraries(MPEG2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MPEG2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Video/MPEG2/#download-and-build-mpeg2","title":"Download and Build MPEG2","text":"

Click here to download MPEG2 and its CMakeLists.txt file. Once the tarball MPEG2.tar has been downloaded and extracted,

cd MPEG2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MPEG2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Video/OggTheora/","title":"OggTheora","text":"

vtk-examples/Cxx/Video/OggTheora

"},{"location":"Cxx/Video/OggTheora/#description","title":"Description","text":"

can't find lvtkoggtheora

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Video/OggTheora/#code","title":"Code","text":"

OggTheora.cxx

#include <vtkImageCanvasSource2D.h>\n#include <vtkNew.h>\n#include <vtkOggTheoraWriter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 100, 0, 100, 0, 0);\n\n  vtkNew<vtkOggTheoraWriter> writer;\n\n  writer->SetInputConnection(source->GetOutputPort());\n  writer->SetFileName(\"test.avi\");\n  writer->Start();\n\n  for (unsigned int i = 0; i < 100; i++)\n  {\n    source->SetDrawColor(0, 0, 0, 1);   // black\n    source->FillBox(0, 100, 0, 100);    // clear image\n    source->SetDrawColor(255, 0, 0, 1); // red\n    source->FillBox(i, 20, 10, 20);\n    source->Update();\n\n    writer->Write();\n  }\n  writer->End();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Video/OggTheora/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OggTheora)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOOggTheora\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OggTheora: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OggTheora MACOSX_BUNDLE OggTheora.cxx )\n  target_link_libraries(OggTheora PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OggTheora\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Video/OggTheora/#download-and-build-oggtheora","title":"Download and Build OggTheora","text":"

Click here to download OggTheora and its CMakeLists.txt file. Once the tarball OggTheora.tar has been downloaded and extracted,

cd OggTheora/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OggTheora\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Views/RenderView/","title":"RenderView","text":"

vtk-examples/Cxx/Views/RenderView

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Views/RenderView/#description","title":"Description","text":"

Here is a little bit easier way to get your objects to appear on the screen.

Warning

This example requires the ViewsInfovis module,

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Views/RenderView/#code","title":"Code","text":"

RenderView.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderView.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkRenderView> renderView;\n  renderView->SetInteractionMode(vtkRenderView::INTERACTION_MODE_3D);\n  renderView->GetRenderer()->AddActor(actor);\n  renderView->RenderOnMouseMoveOn();\n  renderView->Update();\n  renderView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Beige\").GetData());\n\n  renderView->ResetCamera();\n  renderView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Views/RenderView/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RenderView)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RenderView: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RenderView MACOSX_BUNDLE RenderView.cxx )\n  target_link_libraries(RenderView PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RenderView\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Views/RenderView/#download-and-build-renderview","title":"Download and Build RenderView","text":"

Click here to download RenderView and its CMakeLists.txt file. Once the tarball RenderView.tar has been downloaded and extracted,

cd RenderView/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RenderView\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/AlphaFrequency/","title":"AlphaFrequency","text":"

vtk-examples/Cxx/Visualization/AlphaFrequency

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/AlphaFrequency/#code","title":"Code","text":"

AlphaFrequency.cxx

//\n// Create bar charts of frequency of letters.\n//\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorText.h>\n\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::vector<vtkSmartPointer<vtkVectorText>> letters;\n  std::vector<vtkSmartPointer<vtkLinearExtrusionFilter>> extrude;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n\n  char filename[512];\n  char text[2];\n  static char alphabet[] = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n  int i, j, freq[26], maxFreq;\n  float x, y;\n  FILE* fPtr;\n  int c;\n\n  //\n  // count the letters\n  //\n  if ((argc == 1) || ((argc == 2) && !(strcmp(\"-S\", argv[1]))))\n  {\n    cerr << \"Please provide filename: \" << argv[0] << \" filename\\n\";\n    strcpy(filename, \"./Makefile\");\n    cerr << \"Using the file \" << filename << \" as input\\n\";\n  }\n  else\n  {\n    strcpy(filename, argv[1]);\n  }\n\n  if ((fPtr = fopen(filename, \"r\")) == NULL)\n  {\n    cerr << \"Cannot open file: \" << filename << \"\\n\";\n    exit(1);\n  }\n\n  for (i = 0; i < 26; i++) freq[i] = 0;\n  while ((c = fgetc(fPtr)) != EOF)\n  {\n    if (isalpha(c))\n    {\n      c = tolower(c);\n      freq[c - 97]++;\n    }\n  }\n\n  for (maxFreq = 0, i = 0; i < 26; i++)\n    if (freq[i] > maxFreq)\n      maxFreq = freq[i];\n  //\n  // graphics stuff\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  //\n  // Setup letters\n  //\n  text[1] = '\\0';\n  for (i = 0; i < 26; i++)\n  {\n    text[0] = alphabet[i];\n    letters.push_back(vtkSmartPointer<vtkVectorText>::New());\n    letters[i]->SetText(text);\n\n    extrude.push_back(vtkSmartPointer<vtkLinearExtrusionFilter>::New());\n    extrude[i]->SetInputConnection(letters[i]->GetOutputPort());\n    extrude[i]->SetExtrusionType(VTK_VECTOR_EXTRUSION);\n    extrude[i]->SetVector(0, 0, 1.0);\n    extrude[i]->SetScaleFactor((double)freq[i] / maxFreq * 2.50);\n\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputConnection(extrude[i]->GetOutputPort());\n    mappers[i]->ScalarVisibilityOff();\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n    if (freq[i] <= 0)\n    {\n      actors[i]->VisibilityOff();\n    }\n    ren->AddActor(actors[i]);\n  }\n  //\n  // Position actors\n  //\n  for (y = 0.0, j = 0; j < 2; j++, y += (-3.0))\n  {\n    for (x = 0.0, i = 0; i < 13; i++, x += 1.5)\n    {\n      actors[j * 13 + i]->SetPosition(x, y, 0.0);\n    }\n  }\n\n  ren->ResetCamera();\n  ren->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  ren->GetActiveCamera()->Elevation(30.0);\n  ren->GetActiveCamera()->Azimuth(-30.0);\n  ren->GetActiveCamera()->Dolly(1.25);\n  ren->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"AlphaFrequency\");\n\n  // interact with data\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/AlphaFrequency/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AlphaFrequency)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AlphaFrequency: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AlphaFrequency MACOSX_BUNDLE AlphaFrequency.cxx )\n  target_link_libraries(AlphaFrequency PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AlphaFrequency\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/AlphaFrequency/#download-and-build-alphafrequency","title":"Download and Build AlphaFrequency","text":"

Click here to download AlphaFrequency and its CMakeLists.txt file. Once the tarball AlphaFrequency.tar has been downloaded and extracted,

cd AlphaFrequency/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AlphaFrequency\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/AnnotatedCubeActor/","title":"AnnotatedCubeActor","text":"

vtk-examples/Cxx/Visualization/AnnotatedCubeActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/AnnotatedCubeActor/#description","title":"Description","text":"

The example demonstrates how to create and label an annotated cube actor.

To colour the individual cube faces, see: ColoredAnnotatedCube.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/AnnotatedCubeActor/#code","title":"Code","text":"

AnnotatedCubeActor.cxx

#include <vtkAnnotatedCubeActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up the renderer, window, and interactor.\n  //\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"AnnotatedCubeActor\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkAnnotatedCubeActor> cube;\n  cube->SetFaceTextScale(2.0 / 3.0);\n\n  // Anatomic labelling.\n  //\n  cube->SetXPlusFaceText(\"A\");\n  cube->SetXMinusFaceText(\"P\");\n  cube->SetYPlusFaceText(\"L\");\n  cube->SetYMinusFaceText(\"R\");\n  cube->SetZPlusFaceText(\"S\");\n  cube->SetZMinusFaceText(\"I\");\n\n  // Change the vector text colors.\n  //\n  cube->GetTextEdgesProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  cube->GetTextEdgesProperty()->SetLineWidth(4);\n\n  // clang-format off\n  cube->GetXPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Turquoise\").GetData());\n  cube->GetXMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Turquoise\").GetData());\n  cube->GetYPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  cube->GetYMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  cube->GetZPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetZMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  // clang-format on\n\n  renderer->AddActor(cube);\n\n  // Set up an interesting view.\n  //\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->SetViewUp(0, 0, 1);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetPosition(4.5, 4.5, 2.5);\n  renderer->ResetCamera();\n  camera->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/AnnotatedCubeActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AnnotatedCubeActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AnnotatedCubeActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AnnotatedCubeActor MACOSX_BUNDLE AnnotatedCubeActor.cxx )\n  target_link_libraries(AnnotatedCubeActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AnnotatedCubeActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/AnnotatedCubeActor/#download-and-build-annotatedcubeactor","title":"Download and Build AnnotatedCubeActor","text":"

Click here to download AnnotatedCubeActor and its CMakeLists.txt file. Once the tarball AnnotatedCubeActor.tar has been downloaded and extracted,

cd AnnotatedCubeActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AnnotatedCubeActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Arbitrary3DCursor/","title":"Arbitrary3DCursor","text":"

vtk-examples/Cxx/Visualization/Arbitrary3DCursor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Arbitrary3DCursor/#code","title":"Code","text":"

Arbitrary3DCursor.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointWidget.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n\n// This does the actual work: updates the probe.\n// Callback for the interaction.\nclass vtkmyPWCallback : public vtkCallbackCommand\n{\npublic:\n  vtkmyPWCallback() = default;\n\n  static vtkmyPWCallback* New()\n  {\n    return new vtkmyPWCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkPointWidget* pointWidget = reinterpret_cast<vtkPointWidget*>(caller);\n    pointWidget->GetPolyData(this->PolyData);\n    double position[3];\n    pointWidget->GetPosition(position);\n    std::ostringstream text;\n    text << \"cursor: \" << std::fixed << std::setprecision(4) << position[0]\n         << \", \" << position[1] << \", \" << position[2];\n    this->PositionActor->SetInput(text.str().c_str());\n    this->CursorActor->VisibilityOn();\n  }\n\n  vtkPolyData* PolyData = nullptr;\n  vtkActor* CursorActor = nullptr;\n  vtkTextActor* PositionActor = nullptr;\n};\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    inputPolyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetPhiResolution(15);\n    sphereSource->SetThetaResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyData> point;\n\n  vtkNew<vtkProbeFilter> probe;\n  probe->SetInputData(point);\n  probe->SetSourceData(inputPolyData);\n\n  // Create glyph.\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(16);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(probe->GetOutputPort());\n  glyph->SetSourceConnection(cone->GetOutputPort());\n  glyph->SetVectorModeToUseVector();\n  glyph->SetScaleModeToDataScalingOff();\n  glyph->SetScaleFactor(inputPolyData->GetLength() * 0.1);\n\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyph->GetOutputPort());\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyphMapper);\n  glyphActor->VisibilityOn();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(inputPolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"gold\").GetData());\n\n  vtkNew<vtkTextActor> textActor;\n  textActor->GetTextProperty()->SetFontSize(12);\n  textActor->SetPosition(10, 20);\n  textActor->SetInput(\"cursor:\");\n  textActor->GetTextProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n\n  // Create the RenderWindow, Render1er and both Actors.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // The SetInteractor method is how 3D widgets are associated with the render\n  // window interactor. Internally, SetInteractor sets up a bunch of callbacks\n  // using the Command/Observer mechanism (AddObserver()).\n  vtkNew<vtkmyPWCallback> myCallback;\n  myCallback->PolyData = point;\n  myCallback->CursorActor = glyphActor;\n  myCallback->PositionActor = textActor;\n\n  // The point widget is used probe the dataset.\n  vtkNew<vtkPointWidget> pointWidget;\n  pointWidget->SetInteractor(iren);\n  pointWidget->SetInputData(inputPolyData);\n  pointWidget->AllOff();\n  pointWidget->PlaceWidget();\n  pointWidget->AddObserver(vtkCommand::InteractionEvent, myCallback);\n\n  ren1->AddActor(glyphActor);\n  ren1->AddActor(actor);\n  ren1->AddActor2D(textActor);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->GradientBackgroundOn();\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->SetBackground2(colors->GetColor3d(\"Wheat\").GetData());\n\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Arbitrary3DCursor\");\n  renWin->Render();\n  pointWidget->On();\n\n  // Render the image\n  iren->Initialize();\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Arbitrary3DCursor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Arbitrary3DCursor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Arbitrary3DCursor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Arbitrary3DCursor MACOSX_BUNDLE Arbitrary3DCursor.cxx )\n  target_link_libraries(Arbitrary3DCursor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Arbitrary3DCursor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Arbitrary3DCursor/#download-and-build-arbitrary3dcursor","title":"Download and Build Arbitrary3DCursor","text":"

Click here to download Arbitrary3DCursor and its CMakeLists.txt file. Once the tarball Arbitrary3DCursor.tar has been downloaded and extracted,

cd Arbitrary3DCursor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Arbitrary3DCursor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/AssignCellColorsFromLUT/","title":"AssignCellColorsFromLUT","text":"

vtk-examples/Cxx/Visualization/AssignCellColorsFromLUT

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/AssignCellColorsFromLUT/#description","title":"Description","text":"

Demonstrates how to assign colors to cells in a vtkPolyData structure using lookup tables. Two techniques are demonstrated:

  1. Using a lookup table of predefined colors.
  2. Using a lookup table generated from a color transfer function.

The resultant display shows in the left-hand column, the cells in a plane colored by the two lookup tables and in the right-hand column, the same polydata that has been read in from a file demonstrating that the structures are identical.

The top row of the display uses the color transfer function to create a green to tan transition in a diverging color space. Note that the central square is white indicating the midpoint.

The bottom row of the display uses a lookup table of predefined colors.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/AssignCellColorsFromLUT/#code","title":"Code","text":"

AssignCellColorsFromLUT.cxx

/*\nDemonstrates how to assign colors to cells in a vtkPolyData structure using\n lookup tables.\nTwo techniques are demonstrated:\n1) Using a lookup table of predefined colors.\n2) Using a lookup table generated from a color transfer function.\n\nThe resultant display shows in the left-hand column, the cells in a plane\ncolored by the two lookup tables and in the right-hand column, the same\npolydata that has been read in from a file demonstrating that the structures\nare identical.\n\nThe top row of the display uses the color transfer function to create a\ngreen to tan transition in a diverging color space.\nNote that the central square is white indicating the midpoint.\n\nThe bottom row of the display uses a lookup table of predefined colors.\n*/\n\n#include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <algorithm>\n#include <iomanip>\n#include <iostream>\n\ntemplate <typename T> void PrintColour(T& rgb)\n{\n  // Don't do this in real code! Range checking etc. is needed.\n  for (size_t i = 0; i < 3; ++i)\n  {\n    if (i < 2)\n    {\n      std::cout << static_cast<double>(rgb[i]) << \" \";\n    }\n    else\n    {\n      std::cout << static_cast<double>(rgb[i]);\n    }\n  }\n}\n\n//! Make a lookup table from a set of named colors.\n/*\n * See: http://www.vtk.org/doc/nightly/html/classvtkColorTransferFunction.html\n */\nvoid MakeLUT(size_t const& tableSize, vtkLookupTable* lut)\n{\n  vtkNew<vtkNamedColors> nc;\n\n  lut->SetNumberOfTableValues(static_cast<vtkIdType>(tableSize));\n  lut->Build();\n\n  // Fill in a few known colors, the rest will be generated if needed.\n  lut->SetTableValue(0, nc->GetColor4d(\"Black\").GetData());\n  lut->SetTableValue(1, nc->GetColor4d(\"Banana\").GetData());\n  lut->SetTableValue(2, nc->GetColor4d(\"Tomato\").GetData());\n  lut->SetTableValue(3, nc->GetColor4d(\"Wheat\").GetData());\n  lut->SetTableValue(4, nc->GetColor4d(\"Lavender\").GetData());\n  lut->SetTableValue(5, nc->GetColor4d(\"Flesh\").GetData());\n  lut->SetTableValue(6, nc->GetColor4d(\"Raspberry\").GetData());\n  lut->SetTableValue(7, nc->GetColor4d(\"Salmon\").GetData());\n  lut->SetTableValue(8, nc->GetColor4d(\"Mint\").GetData());\n  lut->SetTableValue(9, nc->GetColor4d(\"Peacock\").GetData());\n}\n\n//! Use a color transfer Function to generate the colors in the lookup table.\nvoid MakeLUTFromCTF(size_t const& tableSize, vtkLookupTable* lut)\n{\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  // Green to tan.\n  ctf->AddRGBPoint(0.0, 0.085, 0.532, 0.201);\n  ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n  ctf->AddRGBPoint(1.0, 0.677, 0.492, 0.093);\n\n  lut->SetNumberOfTableValues(static_cast<vtkIdType>(tableSize));\n  lut->Build();\n\n  for (size_t i = 0; i < tableSize; ++i)\n  {\n    double* rgb;\n    rgb = ctf->GetColor(static_cast<double>(i) / tableSize);\n    lut->SetTableValue(static_cast<vtkIdType>(i), rgb);\n  }\n}\n\n//! Create the cell data using the colors from the lookup table.\nvoid MakeCellData(size_t const& tableSize, vtkLookupTable* lut,\n                  vtkUnsignedCharArray* colors)\n{\n  for (size_t i = 1; i < tableSize; i++)\n  {\n    double rgb[3];\n    unsigned char ucrgb[3];\n    // Get the interpolated color.\n    // Of course you can use any function whose range is [0...1]\n    // to get the required color and assign it to a cell Id.\n    // In this case we are just using the cell (Id + 1)/(tableSize - 1)\n    // to get the interpolated color.\n    lut->GetColor(static_cast<double>(i) / (tableSize - 1), rgb);\n    for (size_t j = 0; j < 3; ++j)\n    {\n      ucrgb[j] = static_cast<unsigned char>(rgb[j] * 255);\n    }\n    colors->InsertNextTuple3(ucrgb[0], ucrgb[1], ucrgb[2]);\n    // Print out what we have.\n    std::cout << \"(\";\n    PrintColour<double[3]>(rgb);\n    std::cout << \") (\";\n    PrintColour<unsigned char[3]>(ucrgb);\n    std::cout << \")\" << std::endl;\n  }\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> nc;\n\n  // Provide some geometry.\n  int resolution = 3;\n  vtkNew<vtkPlaneSource> plane11;\n  plane11->SetXResolution(resolution);\n  plane11->SetYResolution(resolution);\n\n  vtkNew<vtkPlaneSource> plane12;\n  plane12->SetXResolution(resolution);\n  plane12->SetYResolution(resolution);\n\n  // Create a lookup table to map cell data to colors.\n  vtkNew<vtkLookupTable> lut1;\n  vtkNew<vtkLookupTable> lut2;\n  int tableSize = std::max(resolution * resolution + 1, 10);\n\n  // Force an update so we can set cell data.\n  plane11->Update();\n  plane12->Update();\n\n  MakeLUT(tableSize, lut1);\n  MakeLUTFromCTF(tableSize, lut2);\n\n  vtkNew<vtkUnsignedCharArray> colorData1;\n  colorData1->SetName(\"colors\"); // Any name will work here.\n  colorData1->SetNumberOfComponents(3);\n  std::cout << \"Using a lookup table from a set of named colors.\" << std::endl;\n  MakeCellData(tableSize, lut1, colorData1);\n  // Then use SetScalars() to add it to the vtkPolyData structure,\n  // this will then be interpreted as a color table.\n  plane11->GetOutput()->GetCellData()->SetScalars(colorData1);\n\n  vtkNew<vtkUnsignedCharArray> colorData2;\n  colorData2->SetName(\"colors\");\n  colorData2->SetNumberOfComponents(3);\n  std::cout << \"Using a lookup table created from a color transfer function.\"\n            << std::endl;\n  MakeCellData(tableSize, lut2, colorData2);\n  plane12->GetOutput()->GetCellData()->SetScalars(colorData2);\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> mapper11;\n  mapper11->SetInputConnection(plane11->GetOutputPort());\n  // Now, instead of doing this:\n  // mapper11->SetScalarRange(0, tableSize - 1);\n  // mapper11->SetLookupTable(lut1);\n  // We can just use the color data that we created from the lookup table and\n  // assigned to the cells:\n  mapper11->SetScalarModeToUseCellData();\n  mapper11->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper12;\n  mapper12->SetInputConnection(plane12->GetOutputPort());\n  mapper12->SetScalarModeToUseCellData();\n  mapper12->Update();\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(\"pdlut.vtp\");\n  writer->SetInputData(mapper11->GetInput());\n  // This is set so we can see the data in a text editor.\n  writer->SetDataModeToAscii();\n  writer->Write();\n  writer->SetFileName(\"pdctf.vtp\");\n  writer->SetInputData(mapper12->GetInput());\n  writer->Write();\n\n  vtkNew<vtkActor> actor11;\n  actor11->SetMapper(mapper11);\n  vtkNew<vtkActor> actor12;\n  actor12->SetMapper(mapper12);\n\n  // Let's read in the data we wrote out.\n  vtkNew<vtkXMLPolyDataReader> reader1;\n  reader1->SetFileName(\"pdlut.vtp\");\n\n  vtkNew<vtkXMLPolyDataReader> reader2;\n  reader2->SetFileName(\"pdctf.vtp\");\n\n  vtkNew<vtkPolyDataMapper> mapper21;\n  mapper21->SetInputConnection(reader1->GetOutputPort());\n  mapper21->SetScalarModeToUseCellData();\n  mapper21->Update();\n  vtkNew<vtkActor> actor21;\n  actor21->SetMapper(mapper11);\n\n  vtkNew<vtkPolyDataMapper> mapper22;\n  mapper22->SetInputConnection(reader2->GetOutputPort());\n  mapper22->SetScalarModeToUseCellData();\n  mapper22->Update();\n  vtkNew<vtkActor> actor22;\n  actor22->SetMapper(mapper22);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double viewport11[4] = {0.0, 0.0, 0.5, 0.5};\n  double viewport12[4] = {0.0, 0.5, 0.5, 1.0};\n  double viewport21[4] = {0.5, 0.0, 1.0, 0.5};\n  double viewport22[4] = {0.5, 0.5, 1.0, 1.0};\n\n  // Set up the renderers.\n  vtkNew<vtkRenderer> ren11;\n  vtkNew<vtkRenderer> ren12;\n  vtkNew<vtkRenderer> ren21;\n  vtkNew<vtkRenderer> ren22;\n\n  // Setup the render windows.\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"AssignCellColorsFromLUT\");\n\n  renWin->AddRenderer(ren11);\n  renWin->AddRenderer(ren12);\n  renWin->AddRenderer(ren21);\n  renWin->AddRenderer(ren22);\n  ren11->SetViewport(viewport11);\n  ren12->SetViewport(viewport12);\n  ren21->SetViewport(viewport21);\n  ren22->SetViewport(viewport22);\n  ren11->SetBackground(nc->GetColor3d(\"MidnightBlue\").GetData());\n  ren12->SetBackground(nc->GetColor3d(\"MidnightBlue\").GetData());\n  ren21->SetBackground(nc->GetColor3d(\"MidnightBlue\").GetData());\n  ren22->SetBackground(nc->GetColor3d(\"MidnightBlue\").GetData());\n  ren11->AddActor(actor11);\n  ren12->AddActor(actor12);\n  ren21->AddActor(actor21);\n  ren22->AddActor(actor22);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/AssignCellColorsFromLUT/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AssignCellColorsFromLUT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AssignCellColorsFromLUT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AssignCellColorsFromLUT MACOSX_BUNDLE AssignCellColorsFromLUT.cxx )\n  target_link_libraries(AssignCellColorsFromLUT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AssignCellColorsFromLUT\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/AssignCellColorsFromLUT/#download-and-build-assigncellcolorsfromlut","title":"Download and Build AssignCellColorsFromLUT","text":"

Click here to download AssignCellColorsFromLUT and its CMakeLists.txt file. Once the tarball AssignCellColorsFromLUT.tar has been downloaded and extracted,

cd AssignCellColorsFromLUT/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AssignCellColorsFromLUT\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/AxisActor/","title":"AxisActor","text":"

vtk-examples/Cxx/Visualization/AxisActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/AxisActor/#description","title":"Description","text":"

This example illustrates the use of vtkAxisActor. This is a fairly complicated object that allows extensive control over a single axis. The parameters may be tricky to setup. vtkAxisActor is usually used onsode other classes,e.g. vtkCubeAxisActor.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/AxisActor/#code","title":"Code","text":"

AxisActor.cxx

#include <vtkActor.h>\n#include <vtkAxisActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkStringArray.h>\n#include <vtkTextProperty.h>\n\n#include <iostream>\n#include <string>\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> source;\n  source->SetPhiResolution(31);\n  source->SetThetaResolution(31);\n  source->Update();\n  double bounds[6];\n  source->GetOutput()->GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[2] << \", \" << bounds[3]\n            << \", \" << bounds[1] << \", \" << bounds[3] << \", \" << bounds[5]\n            << std::endl;\n  double center[3];\n  source->GetOutput()->GetCenter(center);\n  std::cout << \"Center: \" << center[0] << \", \" << center[1] << \", \" << center[2]\n            << std::endl;\n\n  // Create the axis actor.\n  vtkNew<vtkAxisActor> axis;\n  axis->SetPoint1(-1.1, 0.0, 0.0);\n  axis->SetPoint2(1.1, 0.0, 0.0);\n  axis->SetTickLocationToBoth();\n  axis->SetAxisTypeToX();\n  axis->SetTitle(\"A Sphere\");\n  axis->SetTitleScale(0.2);\n  axis->TitleVisibilityOn();\n\n  axis->SetMajorTickSize(0.05);\n  axis->SetMinorTickSize(1);\n  axis->DrawGridlinesOff();\n  axis->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"banana\").GetData());\n  axis->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"orange\").GetData());\n\n  vtkNew<vtkStringArray> labels;\n  labels->SetNumberOfTuples(1);\n  labels->SetValue(0, \"x Axis\");\n\n  axis->SetLabels(labels);\n  axis->SetLabelScale(.1);\n  axis->MinorTicksVisibleOn();\n  axis->SetDeltaMajor(0, .1);\n  axis->SetCalculateTitleOffset(0);\n  axis->SetCalculateLabelOffset(0);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor4d(\"Tomato\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"AxisActor\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  axis->SetCamera(renderer->GetActiveCamera());\n\n  renderer->AddActor(actor);\n  renderer->AddActor(axis);\n\n  renderer->SetBackground(colors->GetColor4d(\"SlateGray\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderer->ResetCamera();\n  renderer->ResetCameraClippingRange();\n\n  // Render the image.\n  renderWindow->Render();\n\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/AxisActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AxisActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AxisActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AxisActor MACOSX_BUNDLE AxisActor.cxx )\n  target_link_libraries(AxisActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AxisActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/AxisActor/#download-and-build-axisactor","title":"Download and Build AxisActor","text":"

Click here to download AxisActor and its CMakeLists.txt file. Once the tarball AxisActor.tar has been downloaded and extracted,

cd AxisActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AxisActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/BackfaceCulling/","title":"BackfaceCulling","text":"

vtk-examples/Cxx/Visualization/BackfaceCulling

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/BackfaceCulling/#description","title":"Description","text":"

This example renders a sphere with backface culling enabled.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/BackfaceCulling/#code","title":"Code","text":"

BackfaceCulling.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  actor->SetBackfaceProperty(backProperty);\n  // Since back face culling is on, when you zoom into the sphere, you won't see\n  // the gold colored backface.\n  actor->GetProperty()->BackfaceCullingOn();\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BackfaceCulling\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/BackfaceCulling/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BackfaceCulling)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BackfaceCulling: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BackfaceCulling MACOSX_BUNDLE BackfaceCulling.cxx )\n  target_link_libraries(BackfaceCulling PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BackfaceCulling\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/BackfaceCulling/#download-and-build-backfaceculling","title":"Download and Build BackfaceCulling","text":"

Click here to download BackfaceCulling and its CMakeLists.txt file. Once the tarball BackfaceCulling.tar has been downloaded and extracted,

cd BackfaceCulling/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BackfaceCulling\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/BackgroundColor/","title":"BackgroundColor","text":"

vtk-examples/Cxx/Visualization/BackgroundColor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/BackgroundColor/#description","title":"Description","text":"

This example demonstrates how to change the background color of the render window.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/BackgroundColor/#code","title":"Code","text":"

BackgroundColor.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(4.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"SeaGreen\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BackgroundColor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Plum\").GetData());\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/BackgroundColor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BackgroundColor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BackgroundColor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BackgroundColor MACOSX_BUNDLE BackgroundColor.cxx )\n  target_link_libraries(BackgroundColor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BackgroundColor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/BackgroundColor/#download-and-build-backgroundcolor","title":"Download and Build BackgroundColor","text":"

Click here to download BackgroundColor and its CMakeLists.txt file. Once the tarball BackgroundColor.tar has been downloaded and extracted,

cd BackgroundColor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BackgroundColor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/BackgroundGradient/","title":"BackgroundGradient","text":"

vtk-examples/Cxx/Visualization/BackgroundGradient

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/BackgroundGradient/#code","title":"Code","text":"

BackgroundGradient.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"SeaGreen\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BackgroundGradient\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n\n  // Setup the background gradient\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"Banana\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/BackgroundGradient/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BackgroundGradient)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BackgroundGradient: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BackgroundGradient MACOSX_BUNDLE BackgroundGradient.cxx )\n  target_link_libraries(BackgroundGradient PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BackgroundGradient\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/BackgroundGradient/#download-and-build-backgroundgradient","title":"Download and Build BackgroundGradient","text":"

Click here to download BackgroundGradient and its CMakeLists.txt file. Once the tarball BackgroundGradient.tar has been downloaded and extracted,

cd BackgroundGradient/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BackgroundGradient\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/BackgroundTexture/","title":"BackgroundTexture","text":"

vtk-examples/Cxx/Visualization/BackgroundTexture

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/BackgroundTexture/#code","title":"Code","text":"

BackgroundTexture.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkContourFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShepardMethod.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVertexGlyphFilter.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a set of vertices (polydata)\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(100.0, 0.0, 0.0);\n  points->InsertNextPoint(300.0, 0.0, 0.0);\n\n  // Setup colors\n  unsigned char white[3] = {255, 255, 255};\n  unsigned char black[3] = {0, 0, 0};\n\n  vtkNew<vtkUnsignedCharArray> vertexColors;\n  vertexColors->SetNumberOfComponents(3);\n  vertexColors->SetName(\"Colors\");\n  vertexColors->InsertNextTupleValue(black);\n  vertexColors->InsertNextTupleValue(white);\n\n  // Create a scalar array for the pointdata, each value represents the\n  // distance. of the vertices from the first vertex\n  vtkNew<vtkFloatArray> values;\n  values->SetNumberOfComponents(1);\n  values->SetName(\"Values\");\n  values->InsertNextValue(0.0);\n  values->InsertNextValue(1.0);\n\n  // We must make two objects, because the ShepardMethod uses the ActiveScalars,\n  // as does the renderer!\n  vtkNew<vtkPolyData> polydataToProcess;\n  polydataToProcess->SetPoints(points);\n  polydataToProcess->GetPointData()->SetScalars(values);\n\n  vtkNew<vtkPolyData> polydataToVisualize;\n  polydataToVisualize->SetPoints(points);\n  polydataToVisualize->GetPointData()->SetScalars(vertexColors);\n\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->AddInputData(polydataToVisualize);\n  vertexGlyphFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> vertsMapper;\n  // vertsMapper->ScalarVisibilityOff();\n  vertsMapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> vertsActor;\n  vertsActor->SetMapper(vertsMapper);\n  vertsActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  vertsActor->GetProperty()->SetPointSize(3);\n\n  // Create a Shepard filter to interpolate the vertices over a regularized\n  // image grid.\n  vtkNew<vtkShepardMethod> shepard;\n  shepard->SetInputData(polydataToProcess);\n  shepard->SetSampleDimensions(2, 2, 2);\n  shepard->SetModelBounds(100, 300, -10, 10, -10, 10);\n  shepard->SetMaximumDistance(1);\n\n  // Contour the shepard generated image at 3 isovalues.\n  // The accuracy of the results are highly dependent on how the shepard filter\n  // is set up.\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetNumberOfContours(3);\n  contourFilter->SetValue(0, 0.25);\n  contourFilter->SetValue(1, 0.50);\n  contourFilter->SetValue(2, 0.75);\n  contourFilter->SetInputConnection(shepard->GetOutputPort());\n  contourFilter->Update();\n\n  // Create a mapper and actor for the resulting isosurfaces.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contourFilter->GetOutputPort());\n  contourMapper->ScalarVisibilityOn();\n  contourMapper->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n  contourActor->GetProperty()->SetAmbient(1);\n  contourActor->GetProperty()->SetSpecular(0);\n  contourActor->GetProperty()->SetDiffuse(0);\n\n  // Report the results of the interpolation.\n  double* range = contourFilter->GetOutput()->GetScalarRange();\n\n  std::cout << \"Shepard interpolation:\" << std::endl;\n  std::cout << \"contour output scalar range: \" << range[0] << \", \" << range[1]\n            << std::endl;\n\n  vtkIdType nCells = contourFilter->GetOutput()->GetNumberOfCells();\n  double bounds[6];\n  for (vtkIdType i = 0; i < nCells; ++i)\n  {\n    if (i %\n        2) // Each isosurface value only has 2 cells so report on the odd ones\n    {\n      contourFilter->GetOutput()->GetCellBounds(i, bounds);\n      std::cout << \"cell \" << i << \", x position: \" << bounds[0] << std::endl;\n    }\n  }\n\n  // Create a transfer function to color the isosurfaces.\n  vtkNew<vtkColorTransferFunction> lut;\n  lut->SetColorSpaceToRGB();\n  lut->AddRGBPoint(range[0], 0, 0, 0); // black\n  lut->AddRGBPoint(range[1], 1, 1, 1); // white\n  lut->SetScaleToLinear();\n\n  contourMapper->SetLookupTable(lut);\n\n  // Create a renderer, render window and interactor.\n  vtkNew<vtkRenderer> renderer;\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"Blue\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Magenta\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BackgroundTexture\");\n\n  renderer->AddActor(contourActor);\n  renderer->AddActor(vertsActor);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Position the camera so that the image produced is viewable.\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->SetPosition(450, 100, 100);\n  camera->SetFocalPoint(200, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/BackgroundTexture/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BackgroundTexture)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BackgroundTexture: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BackgroundTexture MACOSX_BUNDLE BackgroundTexture.cxx )\n  target_link_libraries(BackgroundTexture PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BackgroundTexture\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/BackgroundTexture/#download-and-build-backgroundtexture","title":"Download and Build BackgroundTexture","text":"

Click here to download BackgroundTexture and its CMakeLists.txt file. Once the tarball BackgroundTexture.tar has been downloaded and extracted,

cd BackgroundTexture/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BackgroundTexture\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/BillboardTextActor3D/","title":"BillboardTextActor3D","text":"

vtk-examples/Cxx/Visualization/BillboardTextActor3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/BillboardTextActor3D/#code","title":"Code","text":"

BillboardTextActor3D.cxx

#include <vtkActor.h>\n#include <vtkBillboardTextActor3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\nvoid ActorCallback(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                   void* clientData, void* vtkNotUsed(callData))\n{\n  auto textActor = static_cast<vtkBillboardTextActor3D*>(clientData);\n  auto actor = static_cast<vtkActor*>(caller);\n  std::ostringstream label;\n  label << std::setprecision(3) << actor->GetPosition()[0] << \", \"\n        << actor->GetPosition()[1] << \", \" << actor->GetPosition()[2]\n        << std::endl;\n  textActor->SetPosition(actor->GetPosition());\n  textActor->SetInput(label.str().c_str());\n}\n\nvoid RandomPosition(double p[3], double const& min_r, double const& max_r,\n                    vtkMinimalStandardRandomSequence* rng);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // For testing\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  // rng->SetSeed(8775070);\n  rng->SetSeed(5127);\n\n  // Create a renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Create a render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BillboardTextActor3D\");\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n\n  auto min_r = -10.0;\n  auto max_r = 10.0;\n\n  for (auto i = 0; i < 10; ++i)\n  {\n    if (i == 0)\n    {\n      // Create an actor representing the origin\n      vtkNew<vtkPolyDataMapper> mapper;\n      mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n      vtkNew<vtkActor> actor;\n      actor->SetMapper(mapper);\n      actor->SetPosition(0, 0, 0);\n      actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n      renderer->AddActor(actor);\n    }\n    // Create a mapper\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n    // Create an actor\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->SetPosition(0, 0, 0);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n    // Setup the text and add it to the renderer\n    vtkNew<vtkBillboardTextActor3D> textActor;\n    textActor->SetInput(\"\");\n    textActor->SetPosition(actor->GetPosition());\n    textActor->GetTextProperty()->SetFontSize(12);\n    textActor->GetTextProperty()->SetColor(\n        colors->GetColor3d(\"Gold\").GetData());\n    textActor->GetTextProperty()->SetJustificationToCentered();\n\n    renderer->AddActor(actor);\n    renderer->AddActor(textActor);\n\n    // If you want to use a callback, do this:\n    // vtkNew<vtkCallbackCommand> actorCallback;\n    // actorCallback->SetCallback(ActorCallback);\n    // actorCallback->SetClientData(textActor);\n    // actor->AddObserver(vtkCommand::ModifiedEvent, actorCallback);\n    // Otherwise do this:\n    double position[3];\n    RandomPosition(position, min_r, max_r, rng);\n    actor->SetPosition(position);\n    std::ostringstream label;\n    label << std::setprecision(3) << actor->GetPosition()[0] << \", \"\n          << actor->GetPosition()[1] << \", \" << actor->GetPosition()[2]\n          << std::endl;\n    textActor->SetPosition(actor->GetPosition());\n    textActor->SetInput(label.str().c_str());\n  }\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"BillboardTextActor3D\");\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid RandomPosition(double p[3], double const& min_r, double const& max_r,\n                    vtkMinimalStandardRandomSequence* rng)\n{\n  for (auto i = 0; i < 3; ++i)\n  {\n    p[i] = rng->GetRangeValue(min_r, max_r);\n    rng->Next();\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/BillboardTextActor3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BillboardTextActor3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BillboardTextActor3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BillboardTextActor3D MACOSX_BUNDLE BillboardTextActor3D.cxx )\n  target_link_libraries(BillboardTextActor3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BillboardTextActor3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/BillboardTextActor3D/#download-and-build-billboardtextactor3d","title":"Download and Build BillboardTextActor3D","text":"

Click here to download BillboardTextActor3D and its CMakeLists.txt file. Once the tarball BillboardTextActor3D.tar has been downloaded and extracted,

cd BillboardTextActor3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BillboardTextActor3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/BlobbyLogo/","title":"BlobbyLogo","text":"

vtk-examples/Cxx/Visualization/BlobbyLogo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/BlobbyLogo/#description","title":"Description","text":"

This is the blobby vtk logo described in chapter 12 of the VTK textbook. The example uses vtkAppendPolyData to combine three vtkPolyData. A vtkImplicitModeller creates a vtkImageData of the distnaces from the polydata triangles. vtkContourFilter extracts an isosurface representing an offset surface.

This examples uses the data src/Testing/Data/v.vtk, src/Testing/Data/t.vtk and src/Testing/Data/k.vtk.

Info

See Figure 12-13 in Chapter 12 the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/BlobbyLogo/#code","title":"Code","text":"

BlobbyLogo.cxx

//\n// use implicit modeller to create the VTK logo\n//\n\n#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitModeller.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 4)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" v.vtk t.vtk k.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> aRenderWindow;\n  aRenderWindow->AddRenderer(aRenderer);\n  aRenderWindow->SetWindowName(\"BlobbyLogo\");\n\n  vtkNew<vtkRenderWindowInteractor> anInteractor;\n  anInteractor->SetRenderWindow(aRenderWindow);\n  aRenderWindow->SetSize(300, 300);\n\n  // read the geometry file containing the letter v\n  vtkNew<vtkPolyDataReader> letterV;\n  letterV->SetFileName(argv[1]);\n\n  // read the geometry file containing the letter t\n  vtkNew<vtkPolyDataReader> letterT;\n  letterT->SetFileName(argv[2]);\n\n  // read the geometry file containing the letter k\n  vtkNew<vtkPolyDataReader> letterK;\n  letterK->SetFileName(argv[3]);\n\n  // create a transform and transform filter for each letter\n  vtkNew<vtkTransform> VTransform;\n  vtkNew<vtkTransformPolyDataFilter> VTransformFilter;\n  VTransformFilter->SetInputConnection(letterV->GetOutputPort());\n  VTransformFilter->SetTransform(VTransform);\n\n  vtkNew<vtkTransform> TTransform;\n  vtkNew<vtkTransformPolyDataFilter> TTransformFilter;\n  TTransformFilter->SetInputConnection(letterT->GetOutputPort());\n  TTransformFilter->SetTransform(TTransform);\n\n  vtkNew<vtkTransform> KTransform;\n  vtkNew<vtkTransformPolyDataFilter> KTransformFilter;\n  KTransformFilter->SetInputConnection(letterK->GetOutputPort());\n  KTransformFilter->SetTransform(KTransform);\n\n  // now append them all\n  vtkNew<vtkAppendPolyData> appendAll;\n  appendAll->AddInputConnection(VTransformFilter->GetOutputPort());\n  appendAll->AddInputConnection(TTransformFilter->GetOutputPort());\n  appendAll->AddInputConnection(KTransformFilter->GetOutputPort());\n\n  // create normals\n  vtkNew<vtkPolyDataNormals> logoNormals;\n  logoNormals->SetInputConnection(appendAll->GetOutputPort());\n  logoNormals->SetFeatureAngle(60);\n\n  // map to rendering primitives\n  vtkNew<vtkPolyDataMapper> logoMapper;\n  logoMapper->SetInputConnection(logoNormals->GetOutputPort());\n\n  // now an actor\n  vtkNew<vtkActor> logo;\n  logo->SetMapper(logoMapper);\n\n  // now create an implicit model of the same letter\n  vtkNew<vtkImplicitModeller> blobbyLogoImp;\n  blobbyLogoImp->SetInputConnection(appendAll->GetOutputPort());\n  blobbyLogoImp->SetMaximumDistance(.075);\n  blobbyLogoImp->SetSampleDimensions(64, 64, 64);\n  blobbyLogoImp->SetAdjustDistance(0.05);\n\n  // extract an iso surface\n  vtkNew<vtkContourFilter> blobbyLogoIso;\n  blobbyLogoIso->SetInputConnection(blobbyLogoImp->GetOutputPort());\n  blobbyLogoIso->SetValue(1, 1.5);\n\n  // map to rendering primitives\n  vtkNew<vtkPolyDataMapper> blobbyLogoMapper;\n  blobbyLogoMapper->SetInputConnection(blobbyLogoIso->GetOutputPort());\n  blobbyLogoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkProperty> tomato;\n  tomato->SetDiffuseColor(colors->GetColor3d(\"tomato\").GetData());\n  tomato->SetSpecular(.3);\n  tomato->SetSpecularPower(20);\n\n  vtkNew<vtkProperty> banana;\n  banana->SetDiffuseColor(colors->GetColor3d(\"banana\").GetData());\n  banana->SetDiffuse(.7);\n  banana->SetSpecular(.4);\n  banana->SetSpecularPower(20);\n\n  // now an actor\n  vtkNew<vtkActor> blobbyLogo;\n  blobbyLogo->SetMapper(blobbyLogoMapper);\n  blobbyLogo->SetProperty(banana);\n\n  // position the letters\n\n  VTransform->Translate(-16.0, 0.0, 12.5);\n  VTransform->RotateY(40);\n\n  KTransform->Translate(14.0, 0.0, 0.0);\n  KTransform->RotateY(-40);\n\n  // move the polygonal letters to the front\n  logo->SetProperty(tomato);\n  logo->SetPosition(0, 0, 6);\n\n  aRenderer->AddActor(logo);\n  aRenderer->AddActor(blobbyLogo);\n\n  aRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  aRenderWindow->Render();\n\n  // interact with data\n  anInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/BlobbyLogo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BlobbyLogo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersHybrid\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BlobbyLogo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BlobbyLogo MACOSX_BUNDLE BlobbyLogo.cxx )\n  target_link_libraries(BlobbyLogo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BlobbyLogo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/BlobbyLogo/#download-and-build-blobbylogo","title":"Download and Build BlobbyLogo","text":"

Click here to download BlobbyLogo and its CMakeLists.txt file. Once the tarball BlobbyLogo.tar has been downloaded and extracted,

cd BlobbyLogo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BlobbyLogo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Blow/","title":"Blow","text":"

vtk-examples/Cxx/Visualization/Blow

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/Blow/#description","title":"Description","text":"

Extrusion blow molding process.

In the extrusion blow molding process, a material is extruded through an annular die to form a hollow cylinder. This cylinder is called a parison. Two mold halves are then closed on the parison, while at the same time the parison is inflated with air. Some of the parison material remains within the mold while some becomes waste material. The material is typically a polymer plastic softened with heat, but blow molding has been used to form metal parts. Plastic bottles are often manufactured using a blow molding process.

In this example the polymer was molded using an isothermal, nonlinear-elastic, incompressible (rubber-like) material. Triangular membrane finite elements were used to model the parison, while a combination of triangular and quadrilateral finite elements were used to model the mold. The mold surface is assumed to be rigid, and the parison is assumed to attach to the mold upon contact. Thus the thinning of the parison is controlled by its stretching during inflation and the sequence in which it contacts the mold.

Ten steps of the analysis are illustrated. The color of the parison indicates its thickness. Using a rainbow scale, red areas are thinnest while blue regions are thickest. Our visualization shows clearly one problem with the analysis technique we are using. Note that while the nodes (i.e., points) of the finite element mesh are prevented from passing through the mold, the interior of the triangular elements are not. This is apparent from the occlusion of the mold wireframe by the parison mesh.

You can also view the individual steps.

Info

See Figure 12-17 in Chapter 12 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Blow/#code","title":"Code","text":"

Blow.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConnectivityFilter.h>\n#include <vtkContourFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDataSetReader.h>\n#include <vtkGeometryFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkWarpVector.h>\n\n#include <cstdlib>\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [data_point] e.g. blow.vtk\"\n              << std::endl;\n    std::cout << \"where: filename is blow.vtk.\" << std::endl;\n    std::cout << \"       data_point allows you to specify which frame is to be \"\n                 \"displayed.\"\n              << std::endl;\n    std::cout << \"       If data_point < 0 or data_point > 9 all ten \"\n                 \"frames are then displayed.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Default is to display all ten frames.\n  auto dataPoint = -1;\n  std::string fileName = argv[1];\n  if (argc > 2)\n  {\n    dataPoint = atoi(argv[2]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::vector<std::string> thickness;\n  std::vector<std::string> displacement;\n  for (auto i = 0; i < 10; ++i)\n  {\n    std::ostringstream os;\n    os << i;\n    thickness.push_back(\"thickness\" + os.str());\n    displacement.push_back(\"displacement\" + os.str());\n    os.str(\"\");\n  }\n\n  std::vector<vtkSmartPointer<vtkDataSetReader>> reader;\n  std::vector<vtkSmartPointer<vtkWarpVector>> warp;\n  std::vector<vtkSmartPointer<vtkConnectivityFilter>> connect;\n  std::vector<vtkSmartPointer<vtkGeometryFilter>> mold;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> moldMapper;\n  std::vector<vtkSmartPointer<vtkActor>> moldActor;\n  std::vector<vtkSmartPointer<vtkConnectivityFilter>> connect2;\n  std::vector<vtkSmartPointer<vtkGeometryFilter>> parison;\n  std::vector<vtkSmartPointer<vtkPolyDataNormals>> normals2;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> parisonMapper;\n  std::vector<vtkSmartPointer<vtkActor>> parisonActor;\n  std::vector<vtkSmartPointer<vtkContourFilter>> cf;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> contourMapper;\n  std::vector<vtkSmartPointer<vtkActor>> contours;\n  std::vector<vtkSmartPointer<vtkRenderer>> ren;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.0, 0.66667);\n\n  for (auto i = 0; i < 10; ++i)\n  {\n    // Create the reader and warp the data vith vectors.\n    reader.push_back(vtkSmartPointer<vtkDataSetReader>::New());\n    reader[i]->SetFileName(fileName.c_str());\n    reader[i]->SetScalarsName(thickness[i].c_str());\n    reader[i]->SetVectorsName(displacement[i].c_str());\n    reader[i]->Update();\n\n    warp.push_back(vtkSmartPointer<vtkWarpVector>::New());\n    warp[i]->SetInputData(reader[i]->GetUnstructuredGridOutput());\n\n    // Extract the mold from the mesh using connectivity.\n    connect.push_back(vtkSmartPointer<vtkConnectivityFilter>::New());\n    connect[i]->SetInputConnection(warp[i]->GetOutputPort());\n    connect[i]->SetExtractionModeToSpecifiedRegions();\n    connect[i]->AddSpecifiedRegion(0);\n    connect[i]->AddSpecifiedRegion(1);\n    mold.push_back(vtkSmartPointer<vtkGeometryFilter>::New());\n    mold[i]->SetInputConnection(connect[i]->GetOutputPort());\n    moldMapper.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    moldMapper[i]->SetInputConnection(mold[i]->GetOutputPort());\n    moldMapper[i]->ScalarVisibilityOff();\n    moldActor.push_back(vtkSmartPointer<vtkActor>::New());\n    moldActor[i]->SetMapper(moldMapper[i]);\n    moldActor[i]->GetProperty()->SetColor(\n        colors->GetColor3d(\"ivory_black\").GetData());\n    moldActor[i]->GetProperty()->SetRepresentationToWireframe();\n\n    // Extract the parison from the mesh using connectivity.\n    connect2.push_back(vtkSmartPointer<vtkConnectivityFilter>::New());\n    connect2[i]->SetInputConnection(warp[i]->GetOutputPort());\n    connect2[i]->SetExtractionModeToSpecifiedRegions();\n    connect2[i]->AddSpecifiedRegion(2);\n    parison.push_back(vtkSmartPointer<vtkGeometryFilter>::New());\n    parison[i]->SetInputConnection(connect2[i]->GetOutputPort());\n    normals2.push_back(vtkSmartPointer<vtkPolyDataNormals>::New());\n    normals2[i]->SetInputConnection(parison[i]->GetOutputPort());\n    normals2[i]->SetFeatureAngle(60);\n    parisonMapper.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    parisonMapper[i]->SetInputConnection(normals2[i]->GetOutputPort());\n    parisonMapper[i]->SetLookupTable(lut);\n    parisonMapper[i]->SetScalarRange(0.12, 1.0);\n    parisonActor.push_back(vtkSmartPointer<vtkActor>::New());\n    parisonActor[i]->SetMapper(parisonMapper[i]);\n\n    cf.push_back(vtkSmartPointer<vtkContourFilter>::New());\n    cf[i]->SetInputConnection(connect2[i]->GetOutputPort());\n    cf[i]->SetValue(0, 0.5);\n    contourMapper.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    contourMapper[i]->SetInputConnection(cf[i]->GetOutputPort());\n    contours.push_back(vtkSmartPointer<vtkActor>::New());\n    contours[i]->SetMapper(contourMapper[i]);\n\n    ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n    ren[i]->AddActor(moldActor[i]);\n    ren[i]->AddActor(parisonActor[i]);\n    ren[i]->AddActor(contours[i]);\n    ren[i]->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n    ren[i]->GetActiveCamera()->SetPosition(50.973277, 12.298821, 29.102547);\n    ren[i]->GetActiveCamera()->SetFocalPoint(0.141547, 12.298821, -0.245166);\n    ren[i]->GetActiveCamera()->SetViewUp(-0.500000, 0.000000, 0.866025);\n    ren[i]->GetActiveCamera()->SetClippingRange(36.640827, 78.614680);\n  }\n\n  // Create the RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  auto rendererSizeX = 750;\n  auto rendererSizeY = 400;\n  auto renWinScale = 0.5;\n  renWin->SetWindowName(\"Blow\");\n  if (dataPoint >= 0 && dataPoint < 10)\n  {\n    renWin->AddRenderer(ren[dataPoint]);\n    renWin->SetSize(rendererSizeX, rendererSizeY);\n  }\n  else\n  {\n    auto gridDimensionsX = 2;\n    auto gridDimensionsY = 5;\n    renWin->SetSize(int(rendererSizeX * gridDimensionsX * renWinScale),\n                    int(rendererSizeY * gridDimensionsY * renWinScale));\n    // Add and position the renders to the render window.\n    for (auto row = 0; row < gridDimensionsY; ++row)\n    {\n      for (auto col = 0; col < gridDimensionsX; ++col)\n      {\n        auto idx = row * gridDimensionsX + col;\n        auto x0 = double(col) / gridDimensionsX;\n        auto y0 = double(gridDimensionsY - row - 1) / gridDimensionsY;\n        auto x1 = double(col + 1) / gridDimensionsX;\n        auto y1 = double(gridDimensionsY - row) / gridDimensionsY;\n        renWin->AddRenderer(ren[idx]);\n        ren[idx]->SetViewport(x0, y0, x1, y1);\n      }\n    }\n  }\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Blow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Blow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Blow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Blow MACOSX_BUNDLE Blow.cxx )\n  target_link_libraries(Blow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Blow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Blow/#download-and-build-blow","title":"Download and Build Blow","text":"

Click here to download Blow and its CMakeLists.txt file. Once the tarball Blow.tar has been downloaded and extracted,

cd Blow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Blow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/BoxClipStructuredPoints/","title":"BoxClipStructuredPoints","text":"

vtk-examples/Cxx/Visualization/BoxClipStructuredPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/BoxClipStructuredPoints/#description","title":"Description","text":"

Note

The image was generated with this volume data: src/Testing/Data/HeadMRVolume.mhd, src/Testing/Data/HeadMRVolume.raw and src/Testing/Data/polyline.vtk.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/BoxClipStructuredPoints/#code","title":"Code","text":"

BoxClipStructuredPoints.cxx

#include <vtkActor.h>\n#include <vtkBoxClipDataSet.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageData.h>\n#include <vtkLookupTable.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.mhd e.g. HeadMRVolume.mhd\"\n              << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Silver\");\n\n  // Read the data.\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n\n  double range[2];\n  reader->GetOutput()->GetScalarRange(range);\n\n  double minBoxPoint[3];\n  double maxBoxPoint[3];\n  minBoxPoint[0] = (bounds[1] - bounds[0]) / 2.0 + bounds[0];\n  minBoxPoint[1] = (bounds[3] - bounds[2]) / 2.0 + bounds[2];\n  minBoxPoint[2] = (bounds[5] - bounds[4]) / 2.0 + bounds[4];\n  maxBoxPoint[0] = bounds[1];\n  maxBoxPoint[1] = bounds[3];\n  maxBoxPoint[2] = bounds[5];\n\n  vtkNew<vtkBoxClipDataSet> boxClip;\n  boxClip->SetInputConnection(reader->GetOutputPort());\n\n  const double minusx[] = {-1.0, -0.5, 0.0};\n  const double minusy[] = {0.0, -1.0, 0.0};\n  const double minusz[] = {0.0, 0.0, -1.0};\n  const double plusx[] = {1.0, 0.0, 0.0};\n  const double plusy[] = {0.0, 1.0, 0.0};\n  const double plusz[] = {0.0, 0.0, 1.0};\n  boxClip->SetBoxClip(minusx, minBoxPoint, minusy, minBoxPoint, minusz,\n                      minBoxPoint, plusx, maxBoxPoint, plusy, maxBoxPoint,\n                      plusz, maxBoxPoint);\n  boxClip->GenerateClippedOutputOn();\n\n  // Define a lut.\n  vtkNew<vtkLookupTable> lut1;\n  lut1->SetHueRange(0.667, 0);\n\n  vtkNew<vtkDataSetMapper> mapperIn;\n  mapperIn->SetInputConnection(boxClip->GetOutputPort(0));\n  mapperIn->SetScalarRange(reader->GetOutput()->GetScalarRange());\n  mapperIn->SetLookupTable(lut1);\n  mapperIn->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actorIn;\n  actorIn->SetMapper(mapperIn);\n\n  vtkNew<vtkDataSetMapper> mapperOut;\n  mapperOut->SetInputConnection(boxClip->GetOutputPort(1));\n  mapperOut->SetScalarRange(reader->GetOutput()->GetScalarRange());\n  mapperOut->SetLookupTable(lut1);\n  mapperOut->SetColorModeToMapScalars();\n\n  // Move the outside actor.\n  vtkNew<vtkActor> actorOut;\n  actorOut->SetMapper(mapperOut);\n  actorOut->AddPosition(-0.5 * (maxBoxPoint[0] - minBoxPoint[0]),\n                        -0.5 * (maxBoxPoint[1] - minBoxPoint[1]),\n                        -0.5 * (maxBoxPoint[2] - minBoxPoint[2]));\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"BoxClipStructuredPoints\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actorIn);\n  renderer->AddActor(actorOut);\n\n  // Generate an interesting view.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/BoxClipStructuredPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoxClipStructuredPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoxClipStructuredPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoxClipStructuredPoints MACOSX_BUNDLE BoxClipStructuredPoints.cxx )\n  target_link_libraries(BoxClipStructuredPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoxClipStructuredPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/BoxClipStructuredPoints/#download-and-build-boxclipstructuredpoints","title":"Download and Build BoxClipStructuredPoints","text":"

Click here to download BoxClipStructuredPoints and its CMakeLists.txt file. Once the tarball BoxClipStructuredPoints.tar has been downloaded and extracted,

cd BoxClipStructuredPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BoxClipStructuredPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/BoxClipUnstructuredGrid/","title":"BoxClipUnstructuredGrid","text":"

vtk-examples/Cxx/Visualization/BoxClipUnstructuredGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/BoxClipUnstructuredGrid/#description","title":"Description","text":"

This example uses the data src/Testing/Data/hexa.vtk.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/BoxClipUnstructuredGrid/#code","title":"Code","text":"

BoxClipUnstructuredGrid.cxx

#include <vtkActor.h>\n#include <vtkBoxClipDataSet.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.vtk e.g. hexa.vtk\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Silver\");\n\n  // Read the data\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n\n  double range[2];\n  reader->GetOutput()->GetScalarRange(range);\n\n  double minBoxPoint[3];\n  double maxBoxPoint[3];\n  minBoxPoint[0] = (bounds[1] - bounds[0]) / 2.0 + bounds[0];\n  minBoxPoint[1] = (bounds[3] - bounds[2]) / 2.0 + bounds[2];\n  minBoxPoint[2] = (bounds[5] - bounds[4]) / 2.0 + bounds[4];\n  maxBoxPoint[0] = bounds[1];\n  maxBoxPoint[1] = bounds[3];\n  maxBoxPoint[2] = bounds[5];\n\n  vtkNew<vtkBoxClipDataSet> boxClip;\n  boxClip->SetInputConnection(reader->GetOutputPort());\n  boxClip->GenerateClippedOutputOn();\n\n  const double minusx[] = {-1.0, -0.5, 0.0};\n  const double minusy[] = {0.0, -1.0, 0.0};\n  const double minusz[] = {0.0, 0.0, -1.0};\n  const double plusx[] = {1.0, 0.0, 0.0};\n  const double plusy[] = {0.0, 1.0, 0.0};\n  const double plusz[] = {0.0, 0.0, 1.0};\n  boxClip->SetBoxClip(minusx, minBoxPoint, minusy, minBoxPoint, minusz,\n                      minBoxPoint, plusx, maxBoxPoint, plusy, maxBoxPoint,\n                      plusz, maxBoxPoint);\n\n  // Define a lut\n  vtkNew<vtkLookupTable> lut1;\n  lut1->SetHueRange(.667, 0);\n\n  vtkNew<vtkDataSetMapper> mapperIn;\n  mapperIn->SetInputConnection(boxClip->GetOutputPort());\n  mapperIn->SetScalarRange(reader->GetOutput()->GetScalarRange());\n  mapperIn->SetLookupTable(lut1);\n  mapperIn->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actorIn;\n  actorIn->SetMapper(mapperIn);\n\n  vtkNew<vtkDataSetMapper> mapperOut;\n  mapperOut->SetInputConnection(boxClip->GetOutputPort(1));\n  mapperOut->SetScalarRange(reader->GetOutput()->GetScalarRange());\n  mapperOut->SetLookupTable(lut1);\n  mapperOut->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actorOut;\n  actorOut->SetMapper(mapperOut);\n  actorOut->AddPosition(-0.5 * (maxBoxPoint[0] - minBoxPoint[0]),\n                        -0.5 * (maxBoxPoint[1] - minBoxPoint[1]),\n                        -0.5 * (maxBoxPoint[2] - minBoxPoint[2]));\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"BoxClipUnstructuredGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actorIn);\n  renderer->AddActor(actorOut);\n\n  // Generate an interesting view\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/BoxClipUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoxClipUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoxClipUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoxClipUnstructuredGrid MACOSX_BUNDLE BoxClipUnstructuredGrid.cxx )\n  target_link_libraries(BoxClipUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoxClipUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/BoxClipUnstructuredGrid/#download-and-build-boxclipunstructuredgrid","title":"Download and Build BoxClipUnstructuredGrid","text":"

Click here to download BoxClipUnstructuredGrid and its CMakeLists.txt file. Once the tarball BoxClipUnstructuredGrid.tar has been downloaded and extracted,

cd BoxClipUnstructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BoxClipUnstructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Camera/","title":"Camera","text":"

vtk-examples/Cxx/Visualization/Camera

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Camera/#code","title":"Code","text":"

Camera.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(10.0);\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetSpecular(0.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"LightSkyBlue\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, 0, 100);\n  camera->SetFocalPoint(0, 0, 0);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n\n  renderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Camera\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Camera/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Camera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Camera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Camera MACOSX_BUNDLE Camera.cxx )\n  target_link_libraries(Camera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Camera\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Camera/#download-and-build-camera","title":"Download and Build Camera","text":"

Click here to download Camera and its CMakeLists.txt file. Once the tarball Camera.tar has been downloaded and extracted,

cd Camera/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Camera\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CameraActor/","title":"CameraActor","text":"

vtk-examples/Cxx/Visualization/CameraActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CameraActor/#code","title":"Code","text":"

CameraActor.cxx

#include <vtkCamera.h>\n#include <vtkCameraActor.h>\n#include <vtkMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(400);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n\n  // Camera\n  vtkNew<vtkCamera> camera;\n\n  vtkNew<vtkCameraActor> cameraActor;\n  cameraActor->SetCamera(camera);\n  cameraActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Black\").GetData());\n\n  // (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).\n  auto bounds = cameraActor->GetBounds();\n  std::cout << \"bounds: \" << bounds[0] << \" \" << bounds[1] << \" \" << bounds[2]\n            << \" \" << bounds[3] << \" \" << bounds[4] << \" \" << bounds[5]\n            << std::endl;\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CameraActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(sphereActor);\n  // Compute the active camera parameters\n  renderer->ResetCamera();\n\n  // Set the camera parameters for the camera actor\n  camera->DeepCopy(renderer->GetActiveCamera());\n  renderer->AddActor(cameraActor);\n\n  // Position the camera so that we can see the camera actor\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/CameraActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraActor MACOSX_BUNDLE CameraActor.cxx )\n  target_link_libraries(CameraActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CameraActor/#download-and-build-cameraactor","title":"Download and Build CameraActor","text":"

Click here to download CameraActor and its CMakeLists.txt file. Once the tarball CameraActor.tar has been downloaded and extracted,

cd CameraActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CameraActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CameraModel1/","title":"CameraModel1","text":"

vtk-examples/Cxx/Visualization/CameraModel1

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/CameraModel1/#description","title":"Description","text":"

This example illustrates the camera movement around the focal point.

Note

For camera movement centered at the camera position see CameraModel2.

Note

This is an adaptation of the code written by Chung Kai Lun Pete.

Note

This example corresponds to Figure 3-12 in the VTK Text.

Info

See Figure 3-12 in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CameraModel1/#code","title":"Code","text":"

CameraModel1.cxx

/*\n   Adaptation of the code by\n        Author: Chung Kai Lun Peter\n        Email: hkpeterpeter@gmail.com\n        File:\n                demo_vtk_camera_1.cpp\n        Purpose:\n                Ported from camera.tcl from the VTK textbook.\n                It illustrates the camera model of VTK.\n*/\n\n#include <vtkAppendFilter.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkConeSource.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImplicitModeller.h>\n#include <vtkLODActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRotationalExtrusionFilter.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkWarpTo.h>\n\n#include <algorithm>\n#include <array>\n\nint main(int /* argc */, char* /* argv */[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the colors.\n  std::array<unsigned char, 4> azArrowColor{{255, 77, 77}};\n  colors->SetColor(\"AzimuthArrowColor\", azArrowColor.data());\n  std::array<unsigned char, 4> elevArrowColor{{77, 255, 77}};\n  colors->SetColor(\"ElevationArrowColor\", elevArrowColor.data());\n  std::array<unsigned char, 4> rollArrowColor{{255, 255, 77}};\n  colors->SetColor(\"RollArrowColor\", rollArrowColor.data());\n  std::array<unsigned char, 4> spikeColor{{255, 77, 255}};\n  colors->SetColor(\"SpikeColor\", spikeColor.data());\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // create a camera model\n  vtkNew<vtkConeSource> camCS;\n  camCS->SetHeight(1.5);\n  camCS->SetResolution(12);\n  camCS->SetRadius(0.4);\n\n  vtkNew<vtkCubeSource> camCBS;\n  camCBS->SetXLength(1.5);\n  camCBS->SetZLength(0.8);\n  camCBS->SetCenter(0.4, 0, 0);\n\n  vtkNew<vtkAppendFilter> camAPD;\n  camAPD->AddInputConnection(camCS->GetOutputPort());\n  camAPD->AddInputConnection(camCBS->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> camMapper;\n  camMapper->SetInputConnection(camAPD->GetOutputPort());\n\n  vtkNew<vtkLODActor> camActor;\n  camActor->SetMapper(camMapper);\n  camActor->SetScale(2, 2, 2);\n\n  // draw the arrows\n  vtkNew<vtkPolyData> pd;\n  vtkNew<vtkCellArray> ca;\n  vtkNew<vtkPoints> fp;\n  fp->InsertNextPoint(0, 1, 0);\n  fp->InsertNextPoint(8, 1, 0);\n  fp->InsertNextPoint(8, 2, 0);\n  fp->InsertNextPoint(10, 0.01, 0);\n  fp->InsertNextPoint(8, -2, 0);\n  fp->InsertNextPoint(8, -1, 0);\n  fp->InsertNextPoint(0, -1, 0);\n  ca->InsertNextCell(7);\n  ca->InsertCellPoint(0);\n  ca->InsertCellPoint(1);\n  ca->InsertCellPoint(2);\n  ca->InsertCellPoint(3);\n  ca->InsertCellPoint(4);\n  ca->InsertCellPoint(5);\n  ca->InsertCellPoint(6);\n  pd->SetPoints(fp);\n  pd->SetPolys(ca);\n\n  vtkNew<vtkPolyData> pd2;\n  vtkNew<vtkCellArray> ca2;\n  vtkNew<vtkPoints> fp2;\n  fp2->InsertNextPoint(0, 1, 0);\n  fp2->InsertNextPoint(8, 1, 0);\n  fp2->InsertNextPoint(8, 2, 0);\n  fp2->InsertNextPoint(10, 0.01, 0);\n  ca2->InsertNextCell(4);\n  ca2->InsertCellPoint(0);\n  ca2->InsertCellPoint(1);\n  ca2->InsertCellPoint(2);\n  ca2->InsertCellPoint(3);\n  pd2->SetPoints(fp2);\n  pd2->SetLines(ca2);\n\n  vtkNew<vtkImplicitModeller> arrowIM;\n  arrowIM->SetInputData(pd);\n  arrowIM->SetSampleDimensions(50, 20, 8);\n\n  vtkNew<vtkContourFilter> arrowCF;\n  arrowCF->SetInputConnection(arrowIM->GetOutputPort());\n  arrowCF->SetValue(0, 0.2);\n\n  vtkNew<vtkWarpTo> arrowWT;\n  arrowWT->SetInputConnection(arrowCF->GetOutputPort());\n  arrowWT->SetPosition(5, 0, 5);\n  arrowWT->SetScaleFactor(0.85);\n  arrowWT->AbsoluteOn();\n\n  vtkNew<vtkTransform> arrowT;\n  arrowT->RotateY(60);\n  arrowT->Translate(-1.33198, 0, -1.479);\n  arrowT->Scale(1, 0.5, 1);\n\n  vtkNew<vtkTransformFilter> arrowTF;\n  arrowTF->SetInputConnection(arrowWT->GetOutputPort());\n  arrowTF->SetTransform(arrowT);\n\n  vtkNew<vtkDataSetMapper> arrowMapper;\n  arrowMapper->SetInputConnection(arrowTF->GetOutputPort());\n  arrowMapper->ScalarVisibilityOff();\n\n  // draw the azimuth arrows\n  vtkNew<vtkLODActor> a1Actor;\n  a1Actor->SetMapper(arrowMapper);\n  a1Actor->RotateZ(180);\n  a1Actor->SetPosition(1, 0, -1);\n  a1Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AzimuthArrowColor\").GetData());\n  a1Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a1Actor->GetProperty()->SetSpecular(0.3);\n  a1Actor->GetProperty()->SetSpecularPower(20);\n  a1Actor->GetProperty()->SetAmbient(0.2);\n  a1Actor->GetProperty()->SetDiffuse(0.8);\n\n  vtkNew<vtkLODActor> a2Actor;\n  a2Actor->SetMapper(arrowMapper);\n  a2Actor->RotateZ(180);\n  a2Actor->RotateX(180);\n  a2Actor->SetPosition(1, 0, 1);\n  a2Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AzimuthArrowColor\").GetData());\n  a2Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a2Actor->GetProperty()->SetSpecular(0.3);\n  a2Actor->GetProperty()->SetSpecularPower(20);\n  a2Actor->GetProperty()->SetAmbient(0.2);\n  a2Actor->GetProperty()->SetDiffuse(0.8);\n\n  // draw the elevation arrows\n  vtkNew<vtkLODActor> a3Actor;\n  a3Actor->SetMapper(arrowMapper);\n  a3Actor->RotateZ(180);\n  a3Actor->RotateX(90);\n  a3Actor->SetPosition(1, -1, 0);\n  a3Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"ElevationArrowColor\").GetData());\n  a3Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a3Actor->GetProperty()->SetSpecular(0.3);\n  a3Actor->GetProperty()->SetSpecularPower(20);\n  a3Actor->GetProperty()->SetAmbient(0.2);\n  a3Actor->GetProperty()->SetDiffuse(0.8);\n\n  vtkNew<vtkLODActor> a4Actor;\n  a4Actor->SetMapper(arrowMapper);\n  a4Actor->RotateZ(180);\n  a4Actor->RotateX(-90);\n  a4Actor->SetPosition(1, 1, 0);\n  a4Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"ElevationArrowColor\").GetData());\n  a4Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a4Actor->GetProperty()->SetSpecular(0.3);\n  a4Actor->GetProperty()->SetSpecularPower(20);\n  a4Actor->GetProperty()->SetAmbient(0.2);\n  a4Actor->GetProperty()->SetDiffuse(0.8);\n\n  // draw the DOP\n  vtkNew<vtkTransform> arrowT2;\n  arrowT2->Scale(1, 0.6, 1);\n  arrowT2->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> arrowTF2;\n  arrowTF2->SetInputData(pd2);\n  arrowTF2->SetTransform(arrowT2);\n\n  vtkNew<vtkRotationalExtrusionFilter> arrowREF;\n  arrowREF->SetInputConnection(arrowTF2->GetOutputPort());\n  arrowREF->CappingOff();\n  arrowREF->SetResolution(30);\n\n  vtkNew<vtkPolyDataMapper> spikeMapper;\n  spikeMapper->SetInputConnection(arrowREF->GetOutputPort());\n\n  vtkNew<vtkLODActor> a5Actor;\n  a5Actor->SetMapper(spikeMapper);\n  a5Actor->SetScale(.3, .3, .6);\n  a5Actor->RotateY(90);\n  a5Actor->SetPosition(-2, 0, 0);\n  a5Actor->GetProperty()->SetColor(colors->GetColor3d(\"SpikeColor\").GetData());\n  a5Actor->GetProperty()->SetAmbient(0.2);\n  a5Actor->GetProperty()->SetDiffuse(0.8);\n\n  // focal point\n  vtkNew<vtkSphereSource> fps;\n  fps->SetRadius(0.5);\n  vtkNew<vtkPolyDataMapper> fpMapper;\n  fpMapper->SetInputConnection(fps->GetOutputPort());\n  vtkNew<vtkLODActor> fpActor;\n  fpActor->SetMapper(fpMapper);\n  fpActor->SetPosition(-9, 0, 0);\n  fpActor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  fpActor->GetProperty()->SetSpecular(0.3);\n  fpActor->GetProperty()->SetAmbient(0.2);\n  fpActor->GetProperty()->SetDiffuse(0.8);\n  fpActor->GetProperty()->SetSpecularPower(20);\n\n  // create the roll arrows\n  vtkNew<vtkWarpTo> arrowWT2;\n  arrowWT2->SetInputConnection(arrowCF->GetOutputPort());\n  arrowWT2->SetPosition(5, 0, 2.5);\n  arrowWT2->SetScaleFactor(0.95);\n  arrowWT2->AbsoluteOn();\n\n  vtkNew<vtkTransform> arrowT3;\n  arrowT3->Translate(-2.50358, 0, -1.70408);\n  arrowT3->Scale(0.5, 0.3, 1);\n\n  vtkNew<vtkTransformFilter> arrowTF3;\n  arrowTF3->SetInputConnection(arrowWT2->GetOutputPort());\n  arrowTF3->SetTransform(arrowT3);\n\n  vtkNew<vtkDataSetMapper> arrowMapper2;\n  arrowMapper2->SetInputConnection(arrowTF3->GetOutputPort());\n  arrowMapper2->ScalarVisibilityOff();\n\n  // draw the roll arrows\n  vtkNew<vtkLODActor> a6Actor;\n  a6Actor->SetMapper(arrowMapper2);\n  a6Actor->RotateZ(90);\n  a6Actor->SetPosition(-4, 0, 0);\n  a6Actor->SetScale(1.5, 1.5, 1.5);\n  a6Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"RollArrowColor\").GetData());\n  a6Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a6Actor->GetProperty()->SetSpecular(0.3);\n  a6Actor->GetProperty()->SetSpecularPower(20);\n  a6Actor->GetProperty()->SetAmbient(0.2);\n  a6Actor->GetProperty()->SetDiffuse(0.8);\n\n  // Add the actors to the renderer, set the background and size\n  ren1->AddActor(camActor);\n  ren1->AddActor(a1Actor);\n  ren1->AddActor(a2Actor);\n  ren1->AddActor(a3Actor);\n  ren1->AddActor(a4Actor);\n  ren1->AddActor(a5Actor);\n  ren1->AddActor(a6Actor);\n  ren1->AddActor(fpActor);\n  ren1->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CameraModel1\");\n\n  // render the image\n\n  vtkCamera* cam1 = (ren1->GetActiveCamera());\n  ren1->ResetCamera();\n  cam1->Azimuth(150);\n  cam1->Elevation(30);\n  cam1->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  // Create a TextActor for azimuth  (a1 and a2 actor's color)\n  vtkNew<vtkTextActor> text;\n  text->SetInput(\"Azimuth\");\n  vtkTextProperty* tprop = text->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a1Actor->GetProperty()->GetColor());\n  text->SetDisplayPosition(20, 50);\n  ren1->AddActor2D(text);\n\n  // Create a TextActor for elevation  (a3 and a4 actor's color)\n  vtkNew<vtkTextActor> text2;\n  text2->SetInput(\"Elevation\");\n  tprop = text2->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a3Actor->GetProperty()->GetColor());\n  text2->SetDisplayPosition(20, 100);\n  ren1->AddActor2D(text2);\n\n  // Create a TextActor for roll (a6 actor's color)\n  vtkNew<vtkTextActor> text3;\n  text3->SetInput(\"Roll\");\n  tprop = text3->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a6Actor->GetProperty()->GetColor());\n  text3->SetDisplayPosition(20, 150);\n  ren1->AddActor2D(text3);\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/CameraModel1/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraModel1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersHybrid\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraModel1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraModel1 MACOSX_BUNDLE CameraModel1.cxx )\n  target_link_libraries(CameraModel1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraModel1\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CameraModel1/#download-and-build-cameramodel1","title":"Download and Build CameraModel1","text":"

Click here to download CameraModel1 and its CMakeLists.txt file. Once the tarball CameraModel1.tar has been downloaded and extracted,

cd CameraModel1/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CameraModel1\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CameraModel2/","title":"CameraModel2","text":"

vtk-examples/Cxx/Visualization/CameraModel2

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/CameraModel2/#description","title":"Description","text":"

This example illustrates the camera movement centered at the camera position.

Note

For camera movement around the focal point see CameraModel1.

Note

This is an adaptation of the code written by Chung Kai Lun Pete.

Info

See Figure 3-13 in Chapter 3 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CameraModel2/#code","title":"Code","text":"

CameraModel2.cxx

/*\n   Adaptation of the code by\n        Author: Chung Kai Lun Peter\n        Email: hkpeterpeter@gmail.com\n        File:\n            demo_vtk_camera_2.cpp\n        Purpose:\n                Ported from camera2.tcl.\n                It illustrates the camera model of VTK.\n*/\n\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkConeSource.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImplicitModeller.h>\n#include <vtkLODActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRotationalExtrusionFilter.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkWarpTo.h>\n\n#include <algorithm>\n#include <array>\n\nint main(int /* argc */, char* /* argv */[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the colors.\n  std::array<unsigned char, 4> azArrowColor{{255, 77, 77}};\n  colors->SetColor(\"AzimuthArrowColor\", azArrowColor.data());\n  std::array<unsigned char, 4> elevArrowColor{{77, 255, 77}};\n  colors->SetColor(\"ElevationArrowColor\", elevArrowColor.data());\n  std::array<unsigned char, 4> rollArrowColor{{255, 255, 77}};\n  colors->SetColor(\"RollArrowColor\", rollArrowColor.data());\n  std::array<unsigned char, 4> spikeColor{{255, 77, 255}};\n  colors->SetColor(\"SpikeColor\", spikeColor.data());\n  std::array<unsigned char, 4> upSpikeColor{{77, 255, 255}};\n  colors->SetColor(\"UpSpikeColor\", upSpikeColor.data());\n\n  // create a camera model\n  vtkNew<vtkConeSource> camCS;\n  camCS->SetHeight(1.5);\n  camCS->SetResolution(12);\n  camCS->SetRadius(0.4);\n\n  vtkNew<vtkCubeSource> camCBS;\n  camCBS->SetXLength(1.5);\n  camCBS->SetZLength(0.8);\n  camCBS->SetCenter(0.4, 0, 0);\n\n  vtkNew<vtkAppendPolyData> camAPD;\n  camAPD->AddInputConnection(camCBS->GetOutputPort());\n  camAPD->AddInputConnection(camCS->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> camMapper;\n  camMapper->SetInputConnection(camAPD->GetOutputPort());\n  vtkNew<vtkLODActor> camActor;\n  camActor->SetMapper(camMapper);\n  camActor->SetScale(2, 2, 2);\n\n  // draw the arrows\n  vtkNew<vtkPolyData> pd;\n  vtkNew<vtkCellArray> ca;\n  vtkNew<vtkPoints> pts;\n  pts->InsertNextPoint(0, 1, 0);\n  pts->InsertNextPoint(8, 1, 0);\n  pts->InsertNextPoint(8, 2, 0);\n  pts->InsertNextPoint(10, 0, 0);\n  pts->InsertNextPoint(8, -2, 0);\n  pts->InsertNextPoint(8, -1, 0);\n  pts->InsertNextPoint(0, -1, 0);\n  ca->InsertNextCell(7);\n  ca->InsertCellPoint(0);\n  ca->InsertCellPoint(1);\n  ca->InsertCellPoint(2);\n  ca->InsertCellPoint(3);\n  ca->InsertCellPoint(4);\n  ca->InsertCellPoint(5);\n  ca->InsertCellPoint(6);\n  pd->SetPoints(pts);\n  pd->SetPolys(ca);\n\n  vtkNew<vtkPolyData> pd2;\n  vtkNew<vtkCellArray> ca2;\n  vtkNew<vtkPoints> pts2;\n  pts2->InsertNextPoint(0, 1, 0);\n  pts2->InsertNextPoint(8, 1, 0);\n  pts2->InsertNextPoint(8, 2, 0);\n  pts2->InsertNextPoint(10, 0.01, 0);\n  ca2->InsertNextCell(4);\n  ca2->InsertCellPoint(0);\n  ca2->InsertCellPoint(1);\n  ca2->InsertCellPoint(2);\n  ca2->InsertCellPoint(3);\n  pd2->SetPoints(pts2);\n  pd2->SetLines(ca2);\n\n  vtkNew<vtkImplicitModeller> arrowIM;\n  arrowIM->SetInputData(pd);\n  arrowIM->SetSampleDimensions(50, 20, 8);\n\n  vtkNew<vtkContourFilter> arrowCF;\n  arrowCF->SetInputConnection(arrowIM->GetOutputPort());\n  arrowCF->SetValue(0, 0.2);\n\n  vtkNew<vtkWarpTo> arrowWT;\n  arrowWT->SetInputConnection(arrowCF->GetOutputPort());\n  arrowWT->SetPosition(5, 0, 5);\n  arrowWT->SetScaleFactor(0.85);\n  arrowWT->AbsoluteOn();\n\n  vtkNew<vtkTransform> arrowT;\n  arrowT->RotateY(60);\n  arrowT->Translate(-1.33198, 0, -1.479);\n  arrowT->Scale(1, 0.5, 1);\n\n  vtkNew<vtkTransformFilter> arrowTF;\n  arrowTF->SetInputConnection(arrowWT->GetOutputPort());\n  arrowTF->SetTransform(arrowT);\n\n  vtkNew<vtkDataSetMapper> arrowMapper;\n  arrowMapper->SetInputConnection(arrowTF->GetOutputPort());\n  arrowMapper->ScalarVisibilityOff();\n\n  // draw the azimuth arrows\n  vtkNew<vtkLODActor> a1Actor;\n  a1Actor->SetMapper(arrowMapper);\n  a1Actor->SetPosition(-9, 0, -1);\n  a1Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AzimuthArrowColor\").GetData());\n  a1Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a1Actor->GetProperty()->SetSpecular(0.3);\n  a1Actor->GetProperty()->SetSpecularPower(20);\n  a1Actor->GetProperty()->SetAmbient(0.2);\n  a1Actor->GetProperty()->SetDiffuse(0.8);\n\n  vtkNew<vtkLODActor> a2Actor;\n  a2Actor->SetMapper(arrowMapper);\n  a2Actor->RotateX(180);\n  a2Actor->SetPosition(-9, 0, 1);\n  a2Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AzimuthArrowColor\").GetData());\n  a2Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a2Actor->GetProperty()->SetSpecular(0.3);\n  a2Actor->GetProperty()->SetSpecularPower(20);\n  a2Actor->GetProperty()->SetAmbient(0.2);\n  a2Actor->GetProperty()->SetDiffuse(0.8);\n\n  // draw the elevation arrows\n  vtkNew<vtkLODActor> a3Actor;\n  a3Actor->SetMapper(arrowMapper);\n  a3Actor->RotateX(-90);\n  a3Actor->SetPosition(-9, -1, 0);\n  a3Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"ElevationArrowColor\").GetData());\n  a3Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a3Actor->GetProperty()->SetSpecular(0.3);\n  a3Actor->GetProperty()->SetSpecularPower(20);\n  a3Actor->GetProperty()->SetAmbient(0.2);\n  a3Actor->GetProperty()->SetDiffuse(0.8);\n\n  vtkNew<vtkLODActor> a4Actor;\n  a4Actor->SetMapper(arrowMapper);\n  a4Actor->RotateX(90);\n  a4Actor->SetPosition(-9, 1, 0);\n  a4Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"ElevationArrowColor\").GetData());\n  a4Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a4Actor->GetProperty()->SetSpecular(0.3);\n  a4Actor->GetProperty()->SetSpecularPower(20);\n  a4Actor->GetProperty()->SetAmbient(0.2);\n  a4Actor->GetProperty()->SetDiffuse(0.8);\n\n  // draw the DOP\n  vtkNew<vtkTransform> arrowT2;\n  arrowT2->Scale(1, 0.6, 1);\n  arrowT2->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> arrowTF2;\n  arrowTF2->SetInputData(pd2);\n  arrowTF2->SetTransform(arrowT2);\n\n  vtkNew<vtkRotationalExtrusionFilter> arrowREF;\n  arrowREF->SetInputConnection(arrowTF2->GetOutputPort());\n  arrowREF->CappingOff();\n  arrowREF->SetResolution(30);\n\n  vtkNew<vtkPolyDataMapper> spikeMapper;\n  spikeMapper->SetInputConnection(arrowREF->GetOutputPort());\n\n  vtkNew<vtkLODActor> a5Actor;\n  a5Actor->SetMapper(spikeMapper);\n  a5Actor->SetScale(0.3, 0.3, 0.6);\n  a5Actor->RotateY(-90);\n  a5Actor->SetPosition(-8, 0, 0);\n  a5Actor->GetProperty()->SetColor(colors->GetColor3d(\"SpikeColor\").GetData());\n  a5Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a5Actor->GetProperty()->SetSpecular(0.3);\n  a5Actor->GetProperty()->SetAmbient(0.2);\n  a5Actor->GetProperty()->SetDiffuse(0.8);\n  a5Actor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkLODActor> a7Actor;\n  a7Actor->SetMapper(spikeMapper);\n  a7Actor->SetScale(0.2, 0.2, 0.7);\n  a7Actor->RotateZ(90);\n  a7Actor->RotateY(-90);\n  a7Actor->SetPosition(-9, 1, 0);\n  a7Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"UpSpikeColor\").GetData());\n  a7Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a7Actor->GetProperty()->SetSpecular(0.3);\n  a7Actor->GetProperty()->SetAmbient(0.2);\n  a7Actor->GetProperty()->SetDiffuse(0.8);\n  a7Actor->GetProperty()->SetSpecularPower(20);\n\n  // focal point\n  vtkNew<vtkSphereSource> ss;\n  ss->SetRadius(0.5);\n  vtkNew<vtkPolyDataMapper> fpMapper;\n  fpMapper->SetInputConnection(ss->GetOutputPort());\n  vtkNew<vtkLODActor> fpActor;\n  fpActor->SetMapper(fpMapper);\n  fpActor->SetPosition(-9, 0, 0);\n  fpActor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  fpActor->GetProperty()->SetSpecular(0.3);\n  fpActor->GetProperty()->SetAmbient(0.2);\n  fpActor->GetProperty()->SetDiffuse(0.8);\n  fpActor->GetProperty()->SetSpecularPower(20);\n\n  // create the roll arrows\n  vtkNew<vtkWarpTo> arrowWT2;\n  arrowWT2->SetInputConnection(arrowCF->GetOutputPort());\n  arrowWT2->SetPosition(5, 0, 2.5);\n  arrowWT2->SetScaleFactor(0.95);\n  arrowWT2->AbsoluteOn();\n\n  vtkNew<vtkTransform> arrowT3;\n  arrowT3->Translate(-2.50358, 0, -1.70408);\n  arrowT3->Scale(0.5, 0.3, 1);\n\n  vtkNew<vtkTransformFilter> arrowTF3;\n  arrowTF3->SetInputConnection(arrowWT2->GetOutputPort());\n  arrowTF3->SetTransform(arrowT3);\n\n  vtkNew<vtkDataSetMapper> arrowMapper2;\n  arrowMapper2->SetInputConnection(arrowTF3->GetOutputPort());\n  arrowMapper2->ScalarVisibilityOff();\n\n  // draw the roll arrows\n  vtkNew<vtkLODActor> a6Actor;\n  a6Actor->SetMapper(arrowMapper2);\n  a6Actor->RotateZ(90);\n  a6Actor->SetPosition(-4, 0, 0);\n  a6Actor->SetScale(1.5, 1.5, 1.5);\n  a6Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"RollArrowColor\").GetData());\n  a6Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a6Actor->GetProperty()->SetSpecular(0.3);\n  a6Actor->GetProperty()->SetSpecularPower(20);\n  a6Actor->GetProperty()->SetAmbient(0.2);\n  a6Actor->GetProperty()->SetDiffuse(0.8);\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  ren1->AddActor(camActor);\n  ren1->AddActor(a1Actor);\n  ren1->AddActor(a2Actor);\n  ren1->AddActor(a3Actor);\n  ren1->AddActor(a4Actor);\n  ren1->AddActor(a5Actor);\n  ren1->AddActor(a6Actor);\n  ren1->AddActor(a7Actor);\n  ren1->AddActor(fpActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CameraModel2\");\n\n  // render the image\n\n  vtkCamera* cam1 = (ren1->GetActiveCamera());\n  ren1->ResetCamera();\n  cam1->Azimuth(150);\n  cam1->Elevation(30);\n  cam1->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  // Create a TextActor for Yaw  (a1 and a2 actor's color)\n  vtkNew<vtkTextActor> text;\n  text->SetInput(\"Yaw\");\n  vtkTextProperty* tprop = text->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a1Actor->GetProperty()->GetColor());\n  text->SetDisplayPosition(20, 50);\n  ren1->AddActor2D(text);\n\n  // Create a TextActor for Pitch  (a3 and a4 actor's color)\n  vtkNew<vtkTextActor> text2;\n  text2->SetInput(\"Pitch\");\n  tprop = text2->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a3Actor->GetProperty()->GetColor());\n  text2->SetDisplayPosition(20, 100);\n  ren1->AddActor2D(text2);\n\n  // Create a TextActor for roll (a6 actor's color)\n  vtkNew<vtkTextActor> text3;\n  text3->SetInput(\"Roll\");\n  tprop = text3->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a6Actor->GetProperty()->GetColor());\n  text3->SetDisplayPosition(20, 150);\n  ren1->AddActor2D(text3);\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/CameraModel2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraModel2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersHybrid\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraModel2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraModel2 MACOSX_BUNDLE CameraModel2.cxx )\n  target_link_libraries(CameraModel2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraModel2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CameraModel2/#download-and-build-cameramodel2","title":"Download and Build CameraModel2","text":"

Click here to download CameraModel2 and its CMakeLists.txt file. Once the tarball CameraModel2.tar has been downloaded and extracted,

cd CameraModel2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CameraModel2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CaptionActor2D/","title":"CaptionActor2D","text":"

vtk-examples/Cxx/Visualization/CaptionActor2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CaptionActor2D/#code","title":"Code","text":"

CaptionActor2D.cxx

#include <vtkAbstractPicker.h>\n#include <vtkActor2D.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\nclass MyStyle : public vtkInteractorStyleImage\n{\npublic:\n  static MyStyle* New();\n  vtkTypeMacro(MyStyle, vtkInteractorStyleImage);\n\n  std::vector<vtkActor2D*> Numbers;\n\n  void OnLeftButtonDown()\n  {\n    // std::cout << \"Picking pixel: \" << this->Interactor->GetEventPosition()[0]\n    // << \" \" << this->Interactor->GetEventPosition()[1] << std::endl;\n    this->Interactor->GetPicker()->Pick(\n        this->Interactor->GetEventPosition()[0],\n        this->Interactor->GetEventPosition()[1],\n        0, // always zero.\n        // this->Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer());\n        this->CurrentRenderer);\n    double picked[3];\n    this->Interactor->GetPicker()->GetPickPosition(picked);\n    // std::cout << \"Picked point with coordinate: \" << picked[0] << \" \" <<\n    // picked[1] << \" \" << picked[2] << std::endl;\n\n    this->AddNumber(picked);\n\n    // Forward events\n    vtkInteractorStyleImage::OnLeftButtonDown();\n\n    // this->Interactor->GetRenderWindow()->Render();\n    this->Interactor->Render();\n  }\n\n  void AddNumber(double p[3])\n  {\n    std::cout << \"Adding marker at \" << p[0] << \" \" << p[1]; //<< std::endl;\n\n    // normally, with an image you would do\n    // double* s = image->GetSpacing();\n    // double* o = image->GetOrigin();\n    // p[0] = static_cast<int>( (p[0] - o[0]) / s[0] + 0.5 );\n    p[0] = static_cast<int>(p[0] + 0.5);\n    p[1] = static_cast<int>(p[1] + 0.5);\n\n    std::cout << \" -> \" << p[0] << \" \" << p[1] << std::endl;\n\n    // Convert the current number to a string\n    std::stringstream ss;\n    ss << Numbers.size();\n    std::cout << \"Adding number: \" << ss.str() << std::endl;\n\n    // Create an actor for the text\n    vtkNew<vtkCaptionActor2D> captionActor;\n    captionActor->SetCaption(ss.str().c_str());\n    captionActor->SetAttachmentPoint(p);\n    captionActor->BorderOff();\n    captionActor->GetCaptionTextProperty()->BoldOff();\n    captionActor->GetCaptionTextProperty()->ItalicOff();\n    captionActor->GetCaptionTextProperty()->ShadowOff();\n    captionActor->ThreeDimensionalLeaderOff();\n\n    this->CurrentRenderer->AddViewProp(captionActor);\n\n    this->Numbers.push_back(captionActor);\n  }\n};\n\nvtkStandardNewMacro(MyStyle);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a blank, black image.\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 20, 0, 50, 0, 0);\n  drawing->FillBox(0, 20, 0, 50);\n\n  // Draw a red circle of radius 5 centered at (9,10).\n  drawing->SetDrawColor(255, 0, 0, 0);\n  drawing->DrawCircle(9, 10, 5);\n  drawing->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(drawing->GetOutputPort());\n  actor->InterpolateOff();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CaptionActor2D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"Blue\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<MyStyle> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->SetDefaultRenderer(renderer);\n  style->SetCurrentRenderer(renderer);\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/CaptionActor2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CaptionActor2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CaptionActor2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CaptionActor2D MACOSX_BUNDLE CaptionActor2D.cxx )\n  target_link_libraries(CaptionActor2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CaptionActor2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CaptionActor2D/#download-and-build-captionactor2d","title":"Download and Build CaptionActor2D","text":"

Click here to download CaptionActor2D and its CMakeLists.txt file. Once the tarball CaptionActor2D.tar has been downloaded and extracted,

cd CaptionActor2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CaptionActor2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ChooseTextColor/","title":"ChooseTextColor","text":"

vtk-examples/Cxx/Visualization/ChooseTextColor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ChooseTextColor/#description","title":"Description","text":"

This example uses a simple algorithm to choose a color that \"contrasts\" with another color. The ChooseContrastingColor procedure converts the input RGB value to HSV using vtkMath::RGBToHSV. If the value is <= .5, the light color is chosen as the contrasting color. Otherwise, the dark color is chosen. The default light color is white and the default dark color is black. Any color from vtkNamedColors can be specified for the light and dark colors.

To run the example with your own arguments:

ChooseTextColor fontFile [background] [lightColor] [darkColor]\n

Info

VTKNamedColorPatches shows the available colors.

Info

The ChooseContrastingColor procedure is reusable, Cut and paste the declarations and code into other examples.

Tip

There are many sources of TrueType fonts. Here is one source.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ChooseTextColor/#code","title":"Code","text":"

ChooseTextColor.cxx

#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\n// Given a color, find a contrasting color. If the given color is \"light\",\n// use the lightColor otherwise use the darkColor.\nvoid ChooseContrastingColor(double* rgbIn, double* rgbOut,\n                            const double threshold = .5,\n                            const std::string& lightColor = \"white\",\n                            const std::string& darkColor = \"black\");\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" font.ttf [backColor] [lightColor] [darkColor]\" << std::endl;\n    std::cerr << \"E.g. Canterbury.ttf Pink MintCream SaddleBrown\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Defaults\n  double threshold(.8);\n  std::string backColor = \"SlateGray\";\n  std::string lightColor = \"White\";\n  std::string darkColor = \"Black\";\n  if (argc > 2)\n  {\n    backColor = argv[2];\n  }\n  if (argc > 3)\n  {\n    lightColor = argv[3];\n  }\n  if (argc > 4)\n  {\n    darkColor = argv[4];\n  }\n\n  std::string fontFile(argv[1]);\n  std::stringstream str;\n  str << \"Font: \"\n      << vtksys::SystemTools::GetFilenameWithoutExtension(std::string(argv[1]))\n      << \"\\n\"\n      << \"Background: \" << backColor << \"\\n\"\n      << \"Light Color: \" << lightColor << \"\\n\"\n      << \"Dark Color: \" << darkColor;\n\n  int width = 640;\n  int height = 480;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkTextActor> actor;\n  actor->GetTextProperty()->SetJustificationToCentered();\n  actor->GetTextProperty()->SetVerticalJustificationToCentered();\n  actor->SetTextScaleModeToViewport();\n  actor->SetInput(str.str().c_str());\n  actor->SetPosition(width / 2, height / 2);\n  actor->GetTextProperty()->BoldOff();\n  actor->GetTextProperty()->SetFontSize(40);\n  actor->GetTextProperty()->SetFontFamily(VTK_FONT_FILE);\n  actor->GetTextProperty()->SetFontFile(fontFile.c_str());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(backColor.c_str()).GetData());\n\n  // Compute a good color for text on the renderer background.\n  double rgb[3];\n  ChooseContrastingColor(renderer->GetBackground(), rgb, threshold, lightColor,\n                         darkColor);\n  std::cout << rgb[0] << \",\" << rgb[1] << \",\" << rgb[2] << std::endl;\n  actor->GetTextProperty()->SetColor(rgb);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->SetSize(width, height);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ChooseTextColor\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid ChooseContrastingColor(double* rgbIn, double* rgbOut,\n                            const double threshold,\n                            const std::string& lightColor,\n                            const std::string& darkColor)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  double hsv[3];\n  // If the value is <= threshold, use a light color, otherwise use a dark\n  // color.\n  vtkMath::RGBToHSV(rgbIn, hsv);\n  if (hsv[2] <= threshold)\n  {\n    colors->GetColor(lightColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n  else\n  {\n    colors->GetColor(darkColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/ChooseTextColor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ChooseTextColor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ChooseTextColor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ChooseTextColor MACOSX_BUNDLE ChooseTextColor.cxx )\n  target_link_libraries(ChooseTextColor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ChooseTextColor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ChooseTextColor/#download-and-build-choosetextcolor","title":"Download and Build ChooseTextColor","text":"

Click here to download ChooseTextColor and its CMakeLists.txt file. Once the tarball ChooseTextColor.tar has been downloaded and extracted,

cd ChooseTextColor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ChooseTextColor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ChooseTextColorDemo/","title":"ChooseTextColorDemo","text":"

vtk-examples/Cxx/Visualization/ChooseTextColorDemo

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ChooseTextColorDemo/#code","title":"Code","text":"

ChooseTextColorDemo.cxx

#include <vtkCamera.h>\n#include <vtkCoordinate.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n\n// For drawing the vieport border.\n#include <vtkActor2D.h>\n#include <vtkCellArray.h>\n#include <vtkCoordinate.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderer.h>\n\nnamespace {\n// Given a color, find a contrasting color. If the given color is \"light\",\n// use the lightColor otherwise use the darkColor.\nvoid ChooseContrastingColor(double* rgbIn, double* rgbOut,\n                            double threshold = .5,\n                            const std::string& lightColor = \"white\",\n                            const std::string& darkColor = \"black\");\n\nvoid ViewportBorder(vtkRenderer* renderer, double* color, bool last = false);\n\nvoid RandomHSV(double hsv[3], double const& min_r, double const& max_r,\n               vtkMinimalStandardRandomSequence* rng);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // For testing\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n  // rng->SetSeed(4355412);\n\n  double threshold = .5;\n  std::string lightColor = \"white\";\n  std::string darkColor = \"black\";\n  if (argc > 1)\n  {\n    threshold = atof(argv[1]);\n  }\n  if (argc > 2)\n  {\n    lightColor = argv[2];\n  }\n  if (argc > 3)\n  {\n    darkColor = argv[3];\n  }\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  unsigned int xGridDimensions = 10;\n  unsigned int yGridDimensions = 10;\n  auto min_r = 0.0;\n  auto max_r = 1.0;\n  for (auto i = 0; i < static_cast<int>(xGridDimensions * yGridDimensions); ++i)\n  {\n    // Create textActors\n    vtkNew<vtkTextActor> textActor;\n    textActor->GetTextProperty()->SetJustificationToCentered();\n    textActor->GetTextProperty()->SetVerticalJustificationToCentered();\n    textActor->SetInput(\"Text\");\n    textActor->SetPosition(50, 50);\n    textActor->GetTextProperty()->BoldOff();\n    textActor->GetTextProperty()->SetFontSize(20);\n\n    // Setup renderer\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(textActor);\n    double hsv[3];\n    RandomHSV(hsv, min_r, max_r, rng);\n    double rgb[3];\n    vtkMath::HSVToRGB(hsv, rgb);\n    renderer->SetBackground(rgb);\n    // Compute a good color for text on the renderer background\n    ChooseContrastingColor(renderer->GetBackground(), rgb, threshold,\n                           lightColor, darkColor);\n    textActor->GetTextProperty()->SetColor(rgb);\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n  }\n\n  // Setup viewports for the renderers\n  int rendererSize = 100;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  renderWindow->SetWindowName(\"ChooseTextColorDemo\");\n\n  for (auto row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (auto col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      auto index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      renderers[index]->SetViewport(viewport);\n      ViewportBorder(renderers[index], colors->GetColor3d(\"White\").GetData(),\n                     col == static_cast<int>(xGridDimensions));\n    }\n  }\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// draw the borders of a renderer's viewport\nvoid ViewportBorder(vtkRenderer* renderer, double* color, bool last)\n{\n  // Points start at upper right and proceed anti-clockwise\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  // create cells, and lines\n  vtkNew<vtkCellArray> cells;\n  cells->Initialize();\n\n  vtkNew<vtkPolyLine> lines;\n\n  // Only draw the last line if this is the last viewport.\n  // This prevents double vertical lines at the right border.\n  // If different colors are used for each border, then do\n  // not specify last.\n  if (last)\n  {\n    lines->GetPointIds()->SetNumberOfIds(5);\n  }\n  else\n  {\n    lines->GetPointIds()->SetNumberOfIds(4);\n  }\n  for (unsigned int i = 0; i < 4; ++i)\n  {\n    lines->GetPointIds()->SetId(i, i);\n  }\n  if (last)\n  {\n    lines->GetPointIds()->SetId(4, 0);\n  }\n  cells->InsertNextCell(lines);\n\n  // Now make the polydata and display it.\n  vtkNew<vtkPolyData> poly;\n  poly->Initialize();\n  poly->SetPoints(points);\n  poly->SetLines(cells);\n\n  // Use normalized viewport coordinates since\n  // they are independent of window size.\n  vtkNew<vtkCoordinate> coordinate;\n  coordinate->SetCoordinateSystemToNormalizedViewport();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(poly);\n  mapper->SetTransformCoordinate(coordinate);\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(color);\n  // line width should be at least 2 to be visible at extremes.\n\n  actor->GetProperty()->SetLineWidth(4.0); // Line Width\n\n  renderer->AddViewProp(actor);\n}\n\nvoid ChooseContrastingColor(double* rgbIn, double* rgbOut, double threshold,\n                            const std::string& lightColor,\n                            const std::string& darkColor)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  double hsv[3];\n  // If the value is <= threshold, use a light color, otherwise use a dark\n  // color.\n  vtkMath::RGBToHSV(rgbIn, hsv);\n  if (hsv[2] <= threshold)\n  {\n    colors->GetColor(lightColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n  else\n  {\n    colors->GetColor(darkColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n}\n\nvoid RandomHSV(double hsv[3], double const& min_r, double const& max_r,\n               vtkMinimalStandardRandomSequence* rng)\n{\n  for (auto i = 0; i < 3; ++i)\n  {\n    hsv[i] = rng->GetRangeValue(min_r, max_r);\n    rng->Next();\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/ChooseTextColorDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ChooseTextColorDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ChooseTextColorDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ChooseTextColorDemo MACOSX_BUNDLE ChooseTextColorDemo.cxx )\n  target_link_libraries(ChooseTextColorDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ChooseTextColorDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ChooseTextColorDemo/#download-and-build-choosetextcolordemo","title":"Download and Build ChooseTextColorDemo","text":"

Click here to download ChooseTextColorDemo and its CMakeLists.txt file. Once the tarball ChooseTextColorDemo.tar has been downloaded and extracted,

cd ChooseTextColorDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ChooseTextColorDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ClipArt/","title":"ClipArt","text":"

vtk-examples/Cxx/Visualization/ClipArt

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ClipArt/#description","title":"Description","text":"

This is an adaptation of the VTK test clipArt.tcl. Provide a jpg file with 2D clipart and the example will create 3D polydata model. The examples illustrates a number of VTK classes including vtkImageThreshold, vtkImageSeedConnectivity, vtkDecimatePro and vtkClipPolyData.

The example assumes that the image has a white background. Try it with this src/Testing/Data/stormy.jpg.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ClipArt/#code","title":"Code","text":"

ClipArt.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkDecimatePro.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageRGBToHSV.h>\n#include <vtkImageSeedConnectivity.h>\n#include <vtkImageShrink3D.h>\n#include <vtkImageThreshold.h>\n#include <vtkJPEGReader.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n#include <vtkTextureMapToPlane.h>\n#include <vtkTriangleFilter.h>\n\n#include <vtkInformation.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.jpg) e.g. stormy.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkJPEGReader> imageIn;\n  imageIn->SetFileName(argv[1]);\n\n  // Convert the image to hsv so that we can threshold on value.\n  vtkNew<vtkImageRGBToHSV> toHSV;\n  toHSV->SetInputConnection(imageIn->GetOutputPort());\n\n  // Just work with the value\n  vtkNew<vtkImageExtractComponents> extractImage;\n  extractImage->SetInputConnection(toHSV->GetOutputPort());\n  extractImage->SetComponents(2);\n\n  // Threshold to a black/white image.\n  vtkNew<vtkImageThreshold> threshold1;\n  threshold1->SetInputConnection(extractImage->GetOutputPort());\n  threshold1->ThresholdByUpper(230);\n  threshold1->SetInValue(255);\n  threshold1->SetOutValue(0);\n  threshold1->Update();\n\n  // Place a seed in each corner and label connected pixels with 255.\n  threshold1->UpdateInformation();\n\n  int* extent = threshold1->GetOutputInformation(0)->Get(\n      vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());\n  vtkNew<vtkImageSeedConnectivity> connect;\n  connect->SetInputConnection(threshold1->GetOutputPort());\n  connect->SetInputConnectValue(255);\n  connect->SetOutputConnectedValue(255);\n  connect->SetOutputUnconnectedValue(0);\n  connect->AddSeed(extent[0], extent[2]);\n  connect->AddSeed(extent[1], extent[2]);\n  connect->AddSeed(extent[1], extent[3]);\n  connect->AddSeed(extent[0], extent[3]);\n\n  // Smooth a little before clipping.\n  vtkNew<vtkImageGaussianSmooth> smooth;\n  smooth->SetDimensionality(2);\n  smooth->SetStandardDeviation(1.0, 1.0);\n  smooth->SetInputConnection(connect->GetOutputPort());\n\n  vtkNew<vtkImageShrink3D> shrink;\n  shrink->SetInputConnection(smooth->GetOutputPort());\n  shrink->SetShrinkFactors(1, 1, 1);\n  shrink->AveragingOn();\n\n  // Convert the image to polydata.\n  vtkNew<vtkImageDataGeometryFilter> geometry;\n  geometry->SetInputConnection(shrink->GetOutputPort());\n\n  // Create texture coordinates\n  vtkNew<vtkTextureMapToPlane> geometryTexture;\n  geometryTexture->SetInputConnection(geometry->GetOutputPort());\n  geometryTexture->SetOrigin(0, 0, 0);\n  geometryTexture->SetPoint1(extent[1], 0, 0);\n  geometryTexture->SetPoint2(0, extent[3], 0);\n\n  // Clip the geometry.\n  vtkNew<vtkClipPolyData> clip;\n  clip->SetInputConnection(geometryTexture->GetOutputPort());\n  clip->SetValue(5.5);\n  clip->GenerateClipScalarsOff();\n  clip->InsideOutOff();\n  clip->InsideOutOn();\n\n  vtkNew<vtkTriangleFilter> triangles;\n  triangles->SetInputConnection(clip->GetOutputPort());\n\n  vtkNew<vtkDecimatePro> decimate;\n  decimate->SetInputConnection(triangles->GetOutputPort());\n  decimate->BoundaryVertexDeletionOn();\n  decimate->SetDegree(100);\n  decimate->PreserveTopologyOn();\n  decimate->SetTargetReduction(.99);\n\n  vtkNew<vtkLinearExtrusionFilter> extrude;\n  extrude->SetInputConnection(decimate->GetOutputPort());\n  extrude->SetExtrusionTypeToNormalExtrusion();\n  extrude->SetScaleFactor(-10);\n\n  vtkNew<vtkPolyDataMapper> map;\n  map->SetInputConnection(extrude->GetOutputPort());\n  map->ScalarVisibilityOff();\n\n  vtkNew<vtkTexture> imageTexture;\n  imageTexture->InterpolateOn();\n  imageTexture->SetInputConnection(imageIn->GetOutputPort());\n\n  vtkNew<vtkActor> clipart;\n  clipart->SetMapper(map);\n  clipart->SetTexture(imageTexture);\n\n  // Create the RenderWindow, Renderer and Interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ClipArt\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(clipart);\n\n  // Create a nice view.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  renderer->SetBackground(0.2, 0.3, 0.4);\n  renderWindow->SetSize(320, 256);\n\n  interactor->Initialize();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ClipArt/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipArt)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonExecutionModel\n  FiltersCore\n  FiltersGeometry\n  FiltersModeling\n  FiltersTexture\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingGeneral\n  ImagingMorphological\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipArt: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipArt MACOSX_BUNDLE ClipArt.cxx )\n  target_link_libraries(ClipArt PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipArt\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ClipArt/#download-and-build-clipart","title":"Download and Build ClipArt","text":"

Click here to download ClipArt and its CMakeLists.txt file. Once the tarball ClipArt.tar has been downloaded and extracted,

cd ClipArt/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClipArt\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CloseWindow/","title":"CloseWindow","text":"

vtk-examples/Cxx/Visualization/CloseWindow

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CloseWindow/#code","title":"Code","text":"

CloseWindow.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                              void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCallbackCommand> keypressCallback;\n  keypressCallback->SetCallback(KeypressCallbackFunction);\n  renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent,\n                                      keypressCallback);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"First Window\");\n  renderWindowInteractor->Start();\n\n  std::cout << \"Window 1 closed...\" << std::endl;\n\n  // Make another interactor, but use the same render window.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor2;\n  renderWindowInteractor2->AddObserver(vtkCommand::KeyPressEvent,\n                                       keypressCallback);\n\n  // Note: We can change actor and background colors for the second window.\n  actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BlanchedAlmond\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindowInteractor2->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"Second Window\");\n\n  renderWindowInteractor2->Start();\n  std::cout << \"Window 2 closed. Exiting...\" << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject* caller,\n                              long unsigned int vtkNotUsed(eventId),\n                              void* vtkNotUsed(clientData),\n                              void* vtkNotUsed(callData))\n{\n\n  auto iren = static_cast<vtkRenderWindowInteractor*>(caller);\n  // Close the window.\n  iren->GetRenderWindow()->Finalize();\n\n  // Stop the interactor.\n  iren->TerminateApp();\n  std::cout << \"Closing window...\" << std::endl;\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/CloseWindow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CloseWindow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CloseWindow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CloseWindow MACOSX_BUNDLE CloseWindow.cxx )\n  target_link_libraries(CloseWindow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CloseWindow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CloseWindow/#download-and-build-closewindow","title":"Download and Build CloseWindow","text":"

Click here to download CloseWindow and its CMakeLists.txt file. Once the tarball CloseWindow.tar has been downloaded and extracted,

cd CloseWindow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CloseWindow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CollisionDetection/","title":"CollisionDetection","text":"

vtk-examples/Cxx/Visualization/CollisionDetection

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/CollisionDetection/#description","title":"Description","text":"

This examples uses vtkCollisionDetectionFilter to find the intersection between a fixed (solid white) and moving (red wireframe) sphere. The animation places the moving sphere some distance from the fixed sphere and moves the moving sphere until it contacts the fixed sphere.

Three collision modes are available and can be set as the first argument on the command line.

  1. All contacts (0) finds all the contacting cell pairs with two points per collision.
  2. First contact (1) quickly find the first contact point.
  3. Half contacts (2) finds all the contacting cell pairs with one points per collision.

The animation pauses between each frame. The total animation should be 3 seconds.

Three videos on the VTK Examples Project youtube playlist show each of the collision modes.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CollisionDetection/#code","title":"Code","text":"

CollisionDetection.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCollisionDetectionFilter.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n\n#include <sstream>\n#include <thread>\n\nint main(int argc, char* argv[])\n{\n  int contactMode = 0;\n  if (argc > 1)\n  {\n    contactMode = std::stoi(std::string(argv[1]));\n  }\n  vtkNew<vtkSphereSource> sphere0;\n  sphere0->SetRadius(0.29);\n  sphere0->SetPhiResolution(31);\n  sphere0->SetThetaResolution(31);\n  sphere0->SetCenter(0.0, 0, 0);\n\n  vtkNew<vtkSphereSource> sphere1;\n  sphere1->SetPhiResolution(30);\n  sphere1->SetThetaResolution(30);\n  sphere1->SetRadius(0.3);\n\n  vtkNew<vtkMatrix4x4> matrix1;\n  vtkNew<vtkTransform> transform0;\n\n  vtkNew<vtkCollisionDetectionFilter> collide;\n  collide->SetInputConnection(0, sphere0->GetOutputPort());\n  collide->SetTransform(0, transform0);\n  collide->SetInputConnection(1, sphere1->GetOutputPort());\n  collide->SetMatrix(1, matrix1);\n  collide->SetBoxTolerance(0.0);\n  collide->SetCellTolerance(0.0);\n  collide->SetNumberOfCellsPerNode(2);\n  if (contactMode == 0)\n  {\n    collide->SetCollisionModeToAllContacts();\n  }\n  else if (contactMode == 1)\n  {\n    collide->SetCollisionModeToFirstContact();\n  }\n  else\n  {\n    collide->SetCollisionModeToHalfContacts();\n  }\n  collide->GenerateScalarsOn();\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(collide->GetOutputPort(0));\n  mapper1->ScalarVisibilityOff();\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->BackfaceCullingOn();\n  actor1->SetUserTransform(transform0);\n  actor1->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  actor1->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(collide->GetOutputPort(1));\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->BackfaceCullingOn();\n  actor2->SetUserMatrix(matrix1);\n\n  vtkNew<vtkPolyDataMapper> mapper3;\n  mapper3->SetInputConnection(collide->GetContactsOutputPort());\n  mapper3->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> actor3;\n  actor3->SetMapper(mapper3);\n  actor3->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  actor3->GetProperty()->SetLineWidth(3.0);\n\n  vtkNew<vtkTextActor> txt;\n  txt->GetTextProperty()->SetFontSize(18);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->AddActor(actor3);\n  renderer->AddActor(txt);\n  renderer->SetBackground(colors->GetColor3d(\"Gray\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Move the first object\n  int numSteps = 100;\n  double dx = 1.0 / static_cast<double>(numSteps) * 2.0;\n  transform0->Translate(-numSteps * dx - .3, 0.0, 0.0);\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Azimuth(-60);\n  renderer->GetActiveCamera()->Elevation(45);\n  renderer->GetActiveCamera()->Dolly(1.2);\n\n  renderWindow->SetWindowName(\"CollisionDetection\");\n  renderWindow->Render();\n\n  for (int i = 0; i < numSteps; ++i)\n  {\n    transform0->Translate(dx, 0.0, 0.0);\n    renderer->ResetCameraClippingRange();\n    std::ostringstream textStream;\n    textStream << collide->GetCollisionModeAsString()\n               << \": Number of contact cells is \"\n               << collide->GetNumberOfContacts();\n    txt->SetInput(textStream.str().c_str());\n    renderWindow->Render();\n    if (collide->GetNumberOfContacts() > 0)\n    {\n      break;\n    }\n    // The total animation time is 3 seconds.\n    std::this_thread::sleep_for(std::chrono::milliseconds(3000 / numSteps));\n  }\n  renderer->ResetCamera();\n  renderWindow->Render();\n  interactor->Start();\n  // In Field Data there will be an array named \"ContactCells\".\n  // This array indexes contacting cells (e.g.) index 50 of array 0\n  //  points to a cell (triangle) which contacts/intersects a cell\n  //  at index 50 of array 1.\n  // You can directly obtain these, see GetContactCells(int i)\n  //  in the documentation.\n  // collide->GetOutput(0)->Print(std::cout);\n  // collide->GetOutput(1)->Print(std::cout);\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/CollisionDetection/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CollisionDetection)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonMath\n  CommonTransforms\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CollisionDetection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CollisionDetection MACOSX_BUNDLE CollisionDetection.cxx )\n  target_link_libraries(CollisionDetection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CollisionDetection\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CollisionDetection/#download-and-build-collisiondetection","title":"Download and Build CollisionDetection","text":"

Click here to download CollisionDetection and its CMakeLists.txt file. Once the tarball CollisionDetection.tar has been downloaded and extracted,

cd CollisionDetection/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CollisionDetection\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ColorActorEdges/","title":"ColorActorEdges","text":"

vtk-examples/Cxx/Visualization/ColorActorEdges

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ColorActorEdges/#description","title":"Description","text":"

This example colors the edges of a actor.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ColorActorEdges/#code","title":"Code","text":"

ColorActorEdges.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  // Flat shading\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  // Set the color for edges of the sphere.\n  actor->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Red\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColorActorEdges\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ColorActorEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorActorEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorActorEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorActorEdges MACOSX_BUNDLE ColorActorEdges.cxx )\n  target_link_libraries(ColorActorEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorActorEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ColorActorEdges/#download-and-build-coloractoredges","title":"Download and Build ColorActorEdges","text":"

Click here to download ColorActorEdges and its CMakeLists.txt file. Once the tarball ColorActorEdges.tar has been downloaded and extracted,

cd ColorActorEdges/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorActorEdges\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ColorAnActor/","title":"ColorAnActor","text":"

vtk-examples/Cxx/Visualization/ColorAnActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ColorAnActor/#description","title":"Description","text":"

This example creates a red sphere.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ColorAnActor/#code","title":"Code","text":"

ColorAnActor.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Set the color of the sphere\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Bisque\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColorAnActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Navy\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ColorAnActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorAnActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorAnActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorAnActor MACOSX_BUNDLE ColorAnActor.cxx )\n  target_link_libraries(ColorAnActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorAnActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ColorAnActor/#download-and-build-coloranactor","title":"Download and Build ColorAnActor","text":"

Click here to download ColorAnActor and its CMakeLists.txt file. Once the tarball ColorAnActor.tar has been downloaded and extracted,

cd ColorAnActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorAnActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ColorGlyphs/","title":"ColorGlyphs","text":"

vtk-examples/Cxx/Visualization/ColorGlyphs

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ColorGlyphs/#description","title":"Description","text":"

This example creates a red, green, and blue cube.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ColorGlyphs/#code","title":"Code","text":"

ColorGlyphs.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> nc;\n\n  // Create points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(5, 0, 0);\n  points->InsertNextPoint(10, 0, 0);\n\n  // Setup scales. This can also be an Int array\n  // char is used since it takes the least memory\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetName(\"colors\");\n  colors->SetNumberOfComponents(3);\n  unsigned char r[3] = {255, 0, 0};\n  unsigned char g[3] = {0, 255, 0};\n  unsigned char b[3] = {0, 0, 255};\n  colors->InsertNextTupleValue(r);\n  colors->InsertNextTupleValue(g);\n  colors->InsertNextTupleValue(b);\n\n  // Combine into a polydata\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->SetScalars(colors);\n\n  // Create anything you want here, we will use a cube for the demo.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetColorModeToColorByScalar();\n  glyph3D->SetSourceConnection(cubeSource->GetOutputPort());\n  glyph3D->SetInputData(polydata);\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph3D->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColorGlyphs\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(nc->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Elevation(20);\n  renderer->GetActiveCamera()->Azimuth(10);\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ColorGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorGlyphs MACOSX_BUNDLE ColorGlyphs.cxx )\n  target_link_libraries(ColorGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ColorGlyphs/#download-and-build-colorglyphs","title":"Download and Build ColorGlyphs","text":"

Click here to download ColorGlyphs and its CMakeLists.txt file. Once the tarball ColorGlyphs.tar has been downloaded and extracted,

cd ColorGlyphs/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorGlyphs\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ColorSeriesPatches/","title":"ColorSeriesPatches","text":"

vtk-examples/Cxx/Visualization/ColorSeriesPatches

"},{"location":"Cxx/Visualization/ColorSeriesPatches/#description","title":"Description","text":"

This example shows how to produce a HTML page called VTKColorSeriesPatches showing the available colors series in vtkColorSeries.

It also shows how to select the text color based on luminance. In this case, Digital CCIR601 is used, which gives less weight to the red and blue components of a color.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ColorSeriesPatches/#code","title":"Code","text":"

ColorSeriesPatches.cxx

/*\n * Produce a HTML page called VTKColorSeriesPatches.html showing the available\n * color series in vtkColorSeries.\n *\n * It also shows how to select the text color based on luminance.\n * In this case Digital CCIR601 is used which gives less weight to the red and\n * blue components of a color.\n *\n */\n\n#include <vtkColorSeries.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n\n#include <algorithm>\n#include <cstdlib>\n#include <fstream>\n#include <iostream>\n#include <map>\n#include <regex>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n\n//! Convert to and from HTML color strings.\nclass HTMLToFromRGBAColor\n{\npublic:\n  HTMLToFromRGBAColor() = default;\n  virtual ~HTMLToFromRGBAColor() = default;\n\npublic:\n  bool IsValidHTMLColorString(std::string const& s);\n  std::string RGBToHTMLColor(vtkColor3ub const& rgb);\n  vtkColor3ub HTMLColorToRGB(std::string const& colorString);\n  double RGBToLumaCCIR601(vtkColor3ub const& rgb);\n};\n\n/**\n * Holds the color series id, name and colors.\n */\nclass ColorStructures\n{\npublic:\n  ColorStructures() : max_colors(0)\n  {\n    this->Init();\n  }\n\n  virtual ~ColorStructures() = default;\n\nprivate:\n  void Init();\n\npublic:\n  std::map<int, std::pair<std::string, std::vector<vtkColor3ub>>> cs_colors;\n  int max_colors;\n};\n\n/**\n * This class creates a HTML Table displaying all the colors in\n * the class vtkColorSeries.\n */\nclass HTMLTableMaker\n{\n\npublic:\n  HTMLTableMaker() = default;\n\n  ~HTMLTableMaker() = default;\n\npublic:\n  std::string MakeHTMLTable();\n\nprivate:\n  std::string MakeHTMLStyle();\n  std::string MakeHTMLHeader();\n  std::string MakeTableHeader();\n  std::string MakeTD1(int const idx, std::string const& name);\n  std::string MakeTD2(std::vector<vtkColor3ub> const& rgb);\n  std::string MakeTable();\n\nprivate:\n  vtkNew<vtkNamedColors> nc;\n  ColorStructures cs = ColorStructures();\n  HTMLToFromRGBAColor htmlRGBA = HTMLToFromRGBAColor();\n};\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  HTMLTableMaker ncpt;\n\n  std::ofstream outputFile;\n  outputFile.open(\"VTKColorSeriesPatches.html\",\n                  ios::out | ios::trunc | ios::binary);\n  outputFile << ncpt.MakeHTMLTable();\n  outputFile.close();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nbool HTMLToFromRGBAColor::IsValidHTMLColorString(std::string const& s)\n{\n  if (s.size() == 7 || s.size() == 9) // #rrggbb or #rrggbbaa\n  {\n    if (s.compare(0, 1, \"#\") == 0 &&\n        s.find_first_not_of(\"0123456789abcdefABCDEF\", 1) == std::string::npos)\n    {\n      return true;\n    }\n  }\n  return false;\n}\n\nstd::string HTMLToFromRGBAColor::RGBToHTMLColor(vtkColor3ub const& rgb)\n{\n  std::string s = \"#\";\n  std::ostringstream os;\n  os << std::setfill('0') << std::hex << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetRed()) << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetGreen()) << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetBlue());\n  s += os.str();\n  return s;\n}\n\nvtkColor3ub HTMLToFromRGBAColor::HTMLColorToRGB(std::string const& colorString)\n{\n  vtkColor3ub c(0, 0, 0);\n  if (IsValidHTMLColorString(colorString) && colorString.size() == 7)\n  {\n    auto i = 1;\n    while (i < static_cast<int>(colorString.size()))\n    {\n      std::istringstream is(colorString.substr(i, 2));\n      int x;\n      is >> std::hex >> x;\n      c[(i - 1) / 2] = x;\n      i += 2;\n    }\n  }\n  return c;\n}\n\ndouble HTMLToFromRGBAColor::RGBToLumaCCIR601(vtkColor3ub const& rgb)\n{\n  return 0.299 * rgb.GetRed() + 0.587 * rgb.GetGreen() + 0.114 * rgb.GetBlue();\n}\n\nvoid ColorStructures::Init()\n{\n  auto cs = vtkColorSeries::New();\n  std::vector<int> sizes;\n  for (auto i = 0; i < cs->GetNumberOfColorSchemes(); ++i)\n  {\n    cs->SetColorScheme(i);\n    sizes.push_back(cs->GetNumberOfColors());\n    std::vector<vtkColor3ub> vc;\n    for (auto j = 0; j < cs->GetNumberOfColors(); ++j)\n    {\n      vc.push_back(cs->GetColor(j));\n    }\n    this->cs_colors[i] = std::pair<std::string, std::vector<vtkColor3ub>>(\n        cs->GetColorSchemeName(), vc);\n  }\n  this->max_colors = *std::max_element(sizes.begin(), sizes.end());\n}\n\nstd::string HTMLTableMaker::MakeHTMLStyle()\n{\n  std::string s = \"  <style>\\n\";\n  s += \"\\n\";\n  s += \"  body {\\n\";\n  s += \"    background-color: snow\\n\";\n  s += \"  }\\n\";\n  s += \"  h1 {text-align:left;}\\n\";\n  s += \"  h2 {text-align:left;}\\n\";\n  s += \"  h3 {text-align:left;}\\n\";\n  s += \"  h4 {text-align:left;}\\n\";\n  s += \"  h5 {text-align:left;}\\n\";\n  s += \"  h6 {text-align:left;}\\n\";\n  s += \"\\n\";\n  s += \"  p {text-align:left;}\\n\";\n  s += \"\\n\";\n  s += \"  table {\\n\";\n  s += \"    font-family: arial, sans-serif;\\n\";\n  s += \"    border-collapse: collapse;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"    padding: 4px;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  th {\\n\";\n  s += \"    background: LightSteelBlue;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  th[colspan]:not([colspan=\\\"1\\\"]) {\\n\";\n  s += \"    background: LightSteelBlue;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"    text-align : center;\\n\";\n  s += \"    vertical-align : top;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  tr {\\n\";\n  s += \"    background: MintCream;\\n\";\n  s += \"    vertical-align : top;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  td {\\n\";\n  s += \"    background: MintCream;\\n\";\n  s += \"    border: 1px solid #dddddd;\\n\";\n  s += \"    text-align: left;\\n\";\n  s += \"    padding: 8px;\\n\";\n  s += \"    font-family: monospace;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"    font-weight: bold;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  td[colspan]:not([colspan=\\\"1\\\"]) {\\n\";\n  s += \"    text-align : center;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  .cour {\\n\";\n  s += \"    font-family: Courier;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  html, body {\\n\";\n  s += \"    height: 100%;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  html {\\n\";\n  s += \"    display: table;\\n\";\n  s += \"    margin: auto;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  body {\\n\";\n  s += \"    display: table-cell;\\n\";\n  s += \"    vertical-align: middle;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  thead {color: DarkGreen;}\\n\";\n  s += \"  tbody {color: MidnightBlue;}\\n\";\n  s += \"  tfoot {color: SaddleBrown;}\\n\";\n  s += \"\\n\";\n  s += \"  </style>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeHTMLHeader()\n{\n  std::string s = \"<!DOCTYPE html>\\n\";\n  s += \"<html lang=\\\"en\\\">\\n\";\n  s += \"<head>\\n\";\n  s += \"<meta charset=\\\"UTF-8\\\" />\\n\";\n  s += \"<title>vtkColorSeries</title>\\n\";\n  s += this->MakeHTMLStyle();\n  s += \"</head>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTableHeader()\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<th>Index</th>\\n\";\n  s +=\n      \"<th colspan=\\\"\" + std::to_string(this->cs.max_colors) + \"\\\">Name</th>\\n\";\n  s += \"</tr>\\n\";\n  s += \"<tr>\\n\";\n  s += \"<th></th>\\n\";\n  s += \"<th colspan=\\\"\" + std::to_string(this->cs.max_colors) +\n      \"\\\">Colors in the Series</th>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTD1(int const idx, std::string const& name)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<td>\";\n  s += \"<b>\" + std::to_string(idx) + \"</b>\";\n  s += \"</td>\\n\";\n\n  s += \"<td colspan=\\\"\" + std::to_string(this->cs.max_colors) + \"\\\">\";\n  s += \"<b>\" + name + \"</b>\";\n  s += \"</td>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\nstd::string HTMLTableMaker::MakeTD2(std::vector<vtkColor3ub> const& rgbs)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<td></td>\\n\";\n\n  auto cnt = 0;\n  for (auto p : rgbs)\n  {\n    std::ostringstream os;\n    os << std::setw(3) << cnt << \"&#160;&#160;\";\n    auto ss = std::regex_replace(os.str(), std::regex(\" \"), \"&#160;\");\n    auto y = this->htmlRGBA.RGBToLumaCCIR601(p);\n    std::string textColor{\"#000000\"}; // Black\n    if (y < 255 / 2.0)\n    {\n      textColor = \"#ffffff\"; // White\n    }\n    s += \"<td style=\\\"background:\" + this->htmlRGBA.RGBToHTMLColor(p) +\n        \";color:\" + textColor;\n    s += \"\\\">\" + ss + \"</td>\\n\";\n    ++cnt;\n  }\n  if (cnt < this->cs.max_colors)\n  {\n    s += \"<td colspan=\\\"\" + std::to_string(this->cs.max_colors - cnt) +\n        \"\\\"> &#160; </td>\\n\";\n  }\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTable()\n{\n  auto res = this->MakeTableHeader();\n  for (auto const& p : this->cs.cs_colors)\n  {\n    auto idx = p.first;\n    auto name = p.second.first;\n    res += this->MakeTD1(idx, name);\n    res += this->MakeTD2(p.second.second);\n  }\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeHTMLTable()\n{\n  auto res = this->MakeHTMLHeader();\n  res += \"<body>\\n\";\n  res += \"<h1>Color series available in vtkColorSeries</h1>\\n\";\n  res += \"<table>\\n\";\n  res += this->MakeTable();\n  res += \"</table>\\n\";\n  res += \"</body>\\n\";\n  return res;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/ColorSeriesPatches/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorSeriesPatches)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorSeriesPatches: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorSeriesPatches MACOSX_BUNDLE ColorSeriesPatches.cxx )\n  target_link_libraries(ColorSeriesPatches PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorSeriesPatches\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ColorSeriesPatches/#download-and-build-colorseriespatches","title":"Download and Build ColorSeriesPatches","text":"

Click here to download ColorSeriesPatches and its CMakeLists.txt file. Once the tarball ColorSeriesPatches.tar has been downloaded and extracted,

cd ColorSeriesPatches/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorSeriesPatches\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ColoredAnnotatedCube/","title":"ColoredAnnotatedCube","text":"

vtk-examples/Cxx/Visualization/ColoredAnnotatedCube

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ColoredAnnotatedCube/#description","title":"Description","text":"

This example demonstrates how to color the individual faces of an annotated cube.

This is based on a very nice example by Rodrigo Figueiredo in this discussion.

The process is:

  • Create the annotated cube actor using vtkAnnotatedCubeActor.
  • Select the names on the faces, text colors and, if needed, any rotations of the text.
  • Make the annotated cube transparent.
  • Create a cube actor with colored faces.
  • Combine the annotated cube actor and cube actor into a prop assembly using vtkPropAssembly. Since the annotated cube and the cube are the same size you get an assembly with colored cube faces and the requisite text.
  • Create a vtkOrientationMarkerWidget and set the set the orientation marker to be the prop assembly.

The function MakeAnnotatedCubeActor generates the annotated cube with different colored faces which is then added to a vtkOrientationMarkerWidget.

The colored annotated cube is then placed in the lower left of the view (default). Additionally, a vtkOrientationMarkerWidget containing an axes actor has been added to the lower right of the view.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ColoredAnnotatedCube/#code","title":"Code","text":"

ColoredAnnotatedCube.cxx

#include <vtkAnnotatedCubeActor.h>\n#include <vtkAxesActor.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkCamera.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkCellData.h>\n#include <vtkColorSeries.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkElevationFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPropAssembly.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\nnamespace {\n/**\n * Nake the annotated cube actor with different colored faces.\n *\n * @param colors: Used to set the colors of the cube faces.\n * @return The annotated cube actor.\n */\nvtkSmartPointer<vtkPropAssembly> MakeAnnotatedCubeActor(vtkNamedColors* colors);\n\n/**\n * Make an axes actor.\n *\n * @param scale: Sets the scale and direction of the axes.\n * @param xyzLabels: Labels for the axes.\n * @return The axes actor.\n */\nvtkSmartPointer<vtkAxesActor>\nMakeAxesActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels);\n\n} // namespace\n\nint main(int, char*[])\n{\n  // Basic stuff setup\n  // Set up the renderer, window, and interactor.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetSize(640, 480);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Create a cone with an elliptical base whose major axis is in the\n  // X-direction.\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetCenter(0.0, 0.0, 0.0);\n  coneSource->SetRadius(5.0);\n  coneSource->SetHeight(15.0);\n  coneSource->SetDirection(0, 1, 0);\n  coneSource->SetResolution(60);\n  coneSource->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Scale(1.0, 1.0, 0.75);\n\n  vtkNew<vtkTransformPolyDataFilter> transF;\n  transF->SetInputConnection(coneSource->GetOutputPort());\n  transF->SetTransform(transform);\n\n  double bounds[6];\n  transF->GetOutput()->GetBounds(bounds);\n\n  vtkNew<vtkElevationFilter> elevation;\n  elevation->SetInputConnection(transF->GetOutputPort());\n  elevation->SetLowPoint(0, bounds[2], 0);\n  elevation->SetHighPoint(0, bounds[3], 0);\n\n  vtkNew<vtkBandedPolyDataContourFilter> bandedContours;\n  bandedContours->SetInputConnection(elevation->GetOutputPort());\n  bandedContours->SetScalarModeToValue();\n  bandedContours->GenerateContourEdgesOn();\n  bandedContours->GenerateValues(11, elevation->GetScalarRange());\n\n  // Make a lookup table using a color series.\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_DIVERGING_SPECTRAL_11);\n\n  vtkNew<vtkLookupTable> lut;\n  colorSeries->BuildLookupTable(lut, vtkColorSeries::ORDINAL);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(bandedContours->GetOutputPort());\n  coneMapper->SetScalarRange(elevation->GetScalarRange());\n  coneMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n\n  // Contouring\n  vtkNew<vtkPolyDataMapper> contourLineMapper;\n  contourLineMapper->SetInputData(bandedContours->GetContourEdgesOutput());\n  contourLineMapper->SetScalarRange(elevation->GetScalarRange());\n  contourLineMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> contourLineActor;\n  contourLineActor->SetMapper(contourLineMapper);\n  contourLineActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"DimGray\").GetData());\n\n  // Set up the Orientation Marker Widget.\n  auto prop_assembly = MakeAnnotatedCubeActor(colors);\n  vtkNew<vtkOrientationMarkerWidget> om1;\n  om1->SetOrientationMarker(prop_assembly);\n  om1->SetInteractor(iRen);\n  om1->SetDefaultRenderer(ren);\n  om1->On();\n  om1->InteractiveOn();\n\n  std::array<std::string, 3> xyzLabels{{\"X\", \"Y\", \"Z\"}};\n  std::array<double, 3> scale{{1.0, 1.0, 1.0}};\n  auto axes = MakeAxesActor(scale, xyzLabels);\n\n  vtkNew<vtkOrientationMarkerWidget> om2;\n  om2->SetOrientationMarker(axes);\n  // Position lower right in the viewport.\n  om2->SetViewport(0.8, 0, 1.0, 0.2);\n  om2->SetInteractor(iRen);\n  om2->EnabledOn();\n  om2->InteractiveOn();\n\n  ren->AddActor(coneActor);\n  ren->AddActor(contourLineActor);\n  ren->SetBackground2(colors->GetColor3d(\"RoyalBlue\").GetData());\n  ren->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n  ren->GradientBackgroundOn();\n  ren->GetActiveCamera()->Azimuth(45);\n  ren->GetActiveCamera()->Pitch(-22.5);\n  ren->ResetCamera();\n\n  renWin->SetSize(600, 600);\n  renWin->Render();\n  renWin->SetWindowName(\"ColoredAnnotatedCube\");\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPropAssembly> MakeAnnotatedCubeActor(vtkNamedColors* colors)\n{\n  // Annotated Cube setup.\n  vtkNew<vtkAnnotatedCubeActor> annotated_cube;\n  annotated_cube->SetFaceTextScale(0.366667);\n\n  // Anatomic labeling\n  annotated_cube->SetXPlusFaceText(\"X+\");\n  annotated_cube->SetXMinusFaceText(\"X-\");\n  annotated_cube->SetYPlusFaceText(\"Y+\");\n  annotated_cube->SetYMinusFaceText(\"Y-\");\n  annotated_cube->SetZPlusFaceText(\"Z+\");\n  annotated_cube->SetZMinusFaceText(\"Z-\");\n\n  // Change the vector text colors.\n  annotated_cube->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"Black\").GetData());\n  annotated_cube->GetTextEdgesProperty()->SetLineWidth(1);\n\n  annotated_cube->GetXPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Turquoise\").GetData());\n  annotated_cube->GetXMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Turquoise\").GetData());\n  annotated_cube->GetYPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  annotated_cube->GetYMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  annotated_cube->GetZPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  annotated_cube->GetZMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  annotated_cube->SetXFaceTextRotation(90);\n  annotated_cube->SetYFaceTextRotation(180);\n  annotated_cube->SetZFaceTextRotation(-90);\n  // Make the annotated cube transparent.\n  annotated_cube->GetCubeProperty()->SetOpacity(0);\n\n  // Colored faces cube setup.\n  vtkNew<vtkCubeSource> cube_source;\n  cube_source->Update();\n\n  vtkNew<vtkUnsignedCharArray> face_colors;\n  face_colors->SetNumberOfComponents(3);\n  auto face_x_plus = colors->GetColor3ub(\"Red\").GetData();\n  auto face_x_minus = colors->GetColor3ub(\"Green\").GetData();\n  auto face_y_plus = colors->GetColor3ub(\"Blue\").GetData();\n  auto face_y_minus = colors->GetColor3ub(\"Yellow\").GetData();\n  auto face_z_plus = colors->GetColor3ub(\"Cyan\").GetData();\n  auto face_z_minus = colors->GetColor3ub(\"Magenta\").GetData();\n  face_colors->InsertNextTypedTuple(face_x_minus);\n  face_colors->InsertNextTypedTuple(face_x_plus);\n  face_colors->InsertNextTypedTuple(face_y_minus);\n  face_colors->InsertNextTypedTuple(face_y_plus);\n  face_colors->InsertNextTypedTuple(face_z_minus);\n  face_colors->InsertNextTypedTuple(face_z_plus);\n\n  cube_source->GetOutput()->GetCellData()->SetScalars(face_colors);\n  cube_source->Update();\n\n  vtkNew<vtkPolyDataMapper> cube_mapper;\n  cube_mapper->SetInputData(cube_source->GetOutput());\n  cube_mapper->Update();\n\n  vtkNew<vtkActor> cube_actor;\n  cube_actor->SetMapper(cube_mapper);\n\n  // Assemble the colored cube and annotated cube texts into a composite prop.\n  vtkNew<vtkPropAssembly> prop_assembly;\n  prop_assembly->AddPart(annotated_cube);\n  prop_assembly->AddPart(cube_actor);\n  return prop_assembly;\n}\n\nvtkSmartPointer<vtkAxesActor>\nMakeAxesActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels)\n{\n  vtkNew<vtkAxesActor> axes;\n  axes->SetScale(scale[0], scale[1], scale[2]);\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(xyzLabels[0].c_str());\n  axes->SetYAxisLabelText(xyzLabels[1].c_str());\n  axes->SetZAxisLabelText(xyzLabels[2].c_str());\n  axes->SetCylinderRadius(0.5 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.025 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.5 * axes->GetSphereRadius());\n  vtkTextProperty* tprop =\n      axes->GetXAxisCaptionActor2D()->GetCaptionTextProperty();\n  tprop->ItalicOn();\n  tprop->ShadowOn();\n  tprop->SetFontFamilyToTimes();\n  // Use the same text properties on the other two axes.\n  axes->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  axes->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  return axes;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/ColoredAnnotatedCube/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColoredAnnotatedCube)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColoredAnnotatedCube: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColoredAnnotatedCube MACOSX_BUNDLE ColoredAnnotatedCube.cxx )\n  target_link_libraries(ColoredAnnotatedCube PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColoredAnnotatedCube\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ColoredAnnotatedCube/#download-and-build-coloredannotatedcube","title":"Download and Build ColoredAnnotatedCube","text":"

Click here to download ColoredAnnotatedCube and its CMakeLists.txt file. Once the tarball ColoredAnnotatedCube.tar has been downloaded and extracted,

cd ColoredAnnotatedCube/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColoredAnnotatedCube\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ComplexV/","title":"ComplexV","text":"

vtk-examples/Cxx/Visualization/ComplexV

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ComplexV/#description","title":"Description","text":"

ComplexV from the VTK Textbook. The original example was written in TCL.

The example shows 167,000 3D vectors (using oriented and scaled lines) in the region of the human carotid artery. The larger vectors lie inside the arteries, the smaller vectors lie outside the arteries and are randomly oriented (measurement error) but small in magnitude. Clearly the details of the vector field are not discernible from this image.

Info

See Figure 6-13 in Chapter 6 the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ComplexV/#code","title":"Code","text":"

ComplexV.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkHedgeHog.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" carotid.vtk\" << std::endl;\n    return EXIT_SUCCESS;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkHedgeHog> hhog;\n  hhog->SetInputConnection(reader->GetOutputPort());\n  hhog->SetScaleFactor(0.3);\n\n  vtkNew<vtkLookupTable> lut;\n  //  lut->SetHueRange(.667, 0.0);\n  lut->Build();\n\n  vtkNew<vtkPolyDataMapper> hhogMapper;\n  hhogMapper->SetInputConnection(hhog->GetOutputPort());\n  hhogMapper->SetScalarRange(50, 550);\n  hhogMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> hhogActor;\n  hhogActor->SetMapper(hhogMapper);\n\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> aRenderWindow;\n  aRenderWindow->AddRenderer(aRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> anInteractor;\n  anInteractor->SetRenderWindow(aRenderWindow);\n  aRenderWindow->SetSize(640, 480);\n  aRenderWindow->SetWindowName(\"ComplexV\");\n\n  aRenderer->AddActor(outlineActor);\n  aRenderer->AddActor(hhogActor);\n\n  aRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Generate an interesting view\n\n  aRenderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  aRenderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  aRenderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  aRenderer->ResetCamera();\n\n  aRenderer->GetActiveCamera()->Azimuth(60);\n  aRenderer->GetActiveCamera()->Elevation(30);\n  aRenderer->GetActiveCamera()->Dolly(1.1);\n  aRenderer->ResetCameraClippingRange();\n\n  aRenderWindow->Render();\n\n  // interact with data\n  anInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ComplexV/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ComplexV)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ComplexV: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ComplexV MACOSX_BUNDLE ComplexV.cxx )\n  target_link_libraries(ComplexV PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ComplexV\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ComplexV/#download-and-build-complexv","title":"Download and Build ComplexV","text":"

Click here to download ComplexV and its CMakeLists.txt file. Once the tarball ComplexV.tar has been downloaded and extracted,

cd ComplexV/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ComplexV\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CornerAnnotation/","title":"CornerAnnotation","text":"

vtk-examples/Cxx/Visualization/CornerAnnotation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CornerAnnotation/#code","title":"Code","text":"

CornerAnnotation.cxx

#include <vtkActor.h>\n#include <vtkCornerAnnotation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CornerAnnotation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Annotate the image with window/level and mouse over pixel information.\n  vtkNew<vtkCornerAnnotation> cornerAnnotation;\n  cornerAnnotation->SetLinearFontScaleFactor(2);\n  cornerAnnotation->SetNonlinearFontScaleFactor(1);\n  cornerAnnotation->SetMaximumFontSize(20);\n  cornerAnnotation->SetText(0, \"lower left\");\n  cornerAnnotation->SetText(1, \"lower right\");\n  cornerAnnotation->SetText(2, \"upper left\");\n  cornerAnnotation->SetText(3, \"upper right\");\n  cornerAnnotation->GetTextProperty()->SetColor(\n      colors->GetColor3d(\"Gold\").GetData());\n\n  renderer->AddViewProp(cornerAnnotation);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/CornerAnnotation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CornerAnnotation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CornerAnnotation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CornerAnnotation MACOSX_BUNDLE CornerAnnotation.cxx )\n  target_link_libraries(CornerAnnotation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CornerAnnotation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CornerAnnotation/#download-and-build-cornerannotation","title":"Download and Build CornerAnnotation","text":"

Click here to download CornerAnnotation and its CMakeLists.txt file. Once the tarball CornerAnnotation.tar has been downloaded and extracted,

cd CornerAnnotation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CornerAnnotation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/","title":"CorrectlyRenderTranslucentGeometry","text":"

vtk-examples/Cxx/Visualization/CorrectlyRenderTranslucentGeometry

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/#description","title":"Description","text":"
  • Contributed by: Lars Friedrich

Correctly rendering translucent geometry with OpenGL-functionality in the background (as in the case of VTK) requires non-intersecting polygons and depth-sorted traversal. In general these requirements are not satisfied as the inherent order of scene traversal is object-based. Using a method, namely depth peeling, presented by NVIDIA in 2001 Interactive Order-Independent Transparency, shadow mapping (multi-pass rendering) in conjunction with alpha test can be consulted to achieve correct blending of the rendered objects in the frame buffer.

VTK implements this feature since November 2006 as described in the VTK WIKI (Francois Bertel). Unfortunately depth peeling has several OpenGL extension, context and driver requirements (but also runs on Mesa) which restrict the approach's usage to modern GPUs. Usually this feature slows down the rendering process depending on the configuration (occlusion ratio and maximum number of iterative peels).

However if depth peeling is not available on a certain machine, depth sorting can be accomplished on the CPU using DepthSortPolyData. This is usually much slower than the GPU-implementation and furthermore brings additional restrictions with it (e.g. poly data must be merged within one set).

This example program generates a set of intersecting (overlapping) spheres that have transparency properties. The program automatically checks whether depth peeling is supported or not. If depth peeling is not supported, CPU-based depth sorting is used. In addition the program tries to determine an average frame rate for the scene.

The following image shows the spheres arrangement (and view position) and compares the different render modes: no special translucency treatment, CPU depth sorting and GPU depth peeling.

"},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/#program-usage","title":"Program Usage","text":"
./CorrectlyRenderTranslucentGeometry Theta Phi MaximumPeels OcclusionRatio ForceDepthSortingFlag DoNotUseAnyDepthRelatedAlgorithmFlag\n

Theta ... spheres' THETA resolution

Phi ... spheres' PHI resolution

MaximumPeels ... maximum number of depth peels (multi-pass rendering) for depth peeling mode

OcclusionRatio ... occlusion ratio for depth peeling mode (0.0 for a perfect rendered image, >0.0 for a non-perfect image which is expected to be slower)

ForceDepthSortingFlag ... force depth sorting even if depth peeling is supported

DoNotUseAnyDepthRelatedAlgorithmFlag ... neither use depth peeling nor depth sorting - just render as usual

Example calls:

./CorrectlyRenderTranslucentGeometry 100 100 50 0.1 0 0 ... will render the spheres using depth peeling if available (depth sorting otherwise)\n\n./CorrectlyRenderTranslucentGeometry 100 100 50 0.1 1 0 ... will render the spheres using depth sorting even if depth peeling is available\n\n./CorrectlyRenderTranslucentGeometry 100 100 50 0.1 0 1 ... will render the spheres using neither depth peeling nor depth sorting\n

Resultant frame rates show that depth peeling is usually much faster than the CPU-implementation, however, it will slow down the rendering process due to internal multi-pass rendering.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/#code","title":"Code","text":"

CorrectlyRenderTranslucentGeometry.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkDepthSortPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTimerLog.h>\n#include <vtkTransform.h>\n\nnamespace {\n\n/**\n * Generate a bunch of overlapping spheres within one poly data set:\n * one big sphere evenly surrounded by four small spheres that intersect the\n * centered sphere.\n * @param theta sphere sampling resolution (THETA)\n * @param phi sphere sampling resolution (PHI)\n * @return the set of spheres within one logical poly data set\n **/\nvtkSmartPointer<vtkAppendPolyData> GenerateOverlappingBunchOfSpheres(int theta,\n                                                                     int phi);\n\n/**\n * Setup the rendering environment for depth peeling (general depth peeling\n * support is requested).\n * @see IsDepthPeelingSupported()\n * @param renderWindow a valid openGL-supporting render window\n * @param renderer a valid renderer instance\n * @param maxNoOfPeels maximum number of depth peels (multi-pass rendering)\n * @param occulusionRation the occlusion ration (0.0 means a perfect image,\n * >0.0 means a non-perfect image which in general results in faster rendering)\n * @return TRUE if depth peeling could be set up\n */\nbool SetupEnvironmentForDepthPeeling(vtkRenderWindow* renderWindow,\n                                     vtkRenderer* renderer, int maxNoOfPeels,\n                                     double occlusionRatio);\n\n/**\n * Find out whether this box supports depth peeling. Depth peeling requires\n * a variety of openGL extensions and appropriate drivers.\n * @param renderWindow a valid openGL-supporting render window\n * @param renderer a valid renderer instance\n * @param doItOffscreen do the test off screen which means that nothing is\n * rendered to screen (this requires the box to support off screen rendering)\n * @return TRUE if depth peeling is supported, FALSE otherwise (which means\n * that another strategy must be used for correct rendering of translucent\n * geometry, e.g. CPU-based depth sorting)\n */\nbool IsDepthPeelingSupported(vtkRenderWindow* renderWindow,\n                             vtkRenderer* renderer, bool doItOffScreen);\n} // namespace\n\n/**\n * Example application demonstrating correct rendering of translucent geometry.\n * It will automatically detect whether depth peeling is supported by the\n * hardware and software, and will apply depth peeling if possible. Otherwise\n * a fallback strategy is used: depth sorting on the CPU.\n * <br>Usage:\n * [ProgramName] Theta Phi MaximumPeels OcclusionRatio ForceDepthSortingFlag\n * DoNotUseAnyDepthRelatedAlgorithmFlag\n * <br>\n * Theta ... spheres' THETA resolution <br>\n * Phi ... spheres' PHI resolution <br>\n * MaximumPeels ... maximum number of depth peels (multi-pass rendering) for\n * depth peeling mode <br>\n * OcclusionRatio ... occlusion ratio for depth peeling mode (0.0 for a\n * perfect rendered image, >0.0 for a non-perfect image which is expected to\n * be slower) <br>\n * ForceDepthSortingFlag ... force depth sorting even if depth peeling is\n * supported <br>\n * DoNotUseAnyDepthRelatedAlgorithmFlag ... neither use depth peeling nor\n * depth sorting - just render as usual\n */\nint main(int argc, char* argv[])\n{\n  if (argc != 7)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Theta Phi MaximumPeels \"\n              << \"OcclusionRatio ForceDepthSortingFlag \"\n              << \"DoNotUseAnyDepthRelatedAlgorithmFlag\" << std::endl;\n    std::cerr << \"100 100 50 0.1 0 0\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  int theta = atoi(argv[1]);\n  int phi = atoi(argv[2]);\n  int maxPeels = atoi(argv[3]);\n  double occulusionRatio = atof(argv[4]);\n  bool forceDepthSort = atoi(argv[5]) == 1;\n  bool withoutAnyDepthThings = atoi(argv[6]) == 1;\n\n  // Generate a translucent sphere poly data set that partially overlaps:\n  auto translucentGeometry = GenerateOverlappingBunchOfSpheres(theta, phi);\n\n  // generate a basic Mapper and Actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(translucentGeometry->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetOpacity(0.5); // translucent !!!\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Crimson\").GetData());\n  actor->RotateX(-72); // put the objects in a position where it is easy to see\n                       // different overlapping regions\n\n  // Create the RenderWindow, Renderer and RenderWindowInteractor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 400);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CorrectlyRenderTranslucentGeometry\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Setup view geometry\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(2.2); // so the object is larger\n  renderWindow->Render();\n\n  // Answer the key question: Does this box support GPU Depth Peeling?\n  bool useDepthPeeling = IsDepthPeelingSupported(renderWindow, renderer, true);\n  std::cout << \"DEPTH PEELING SUPPORT: \" << (useDepthPeeling ? \"YES\" : \"NO\")\n            << std::endl;\n\n  int success = EXIT_SUCCESS;\n\n  // Use depth peeling if available and not explicitly prohibited, otherwise we\n  // use manual depth sorting\n  std::cout << std::endl << \"CHOSEN MODE: \";\n  if (useDepthPeeling && !forceDepthSort && !withoutAnyDepthThings) // GPU\n  {\n    std::cout << \"*** DEPTH PEELING ***\" << std::endl;\n    // Setup GPU depth peeling with configured parameters\n    success = !SetupEnvironmentForDepthPeeling(renderWindow, renderer, maxPeels,\n                                               occulusionRatio);\n  }\n  else if (!withoutAnyDepthThings) // CPU\n  {\n    std::cout << \"*** DEPTH SORTING ***\" << std::endl;\n    // Setup CPU depth sorting filter\n    vtkNew<vtkDepthSortPolyData> depthSort;\n    depthSort->SetInputConnection(translucentGeometry->GetOutputPort());\n    depthSort->SetDirectionToBackToFront();\n    depthSort->SetVector(1, 1, 1);\n    depthSort->SetCamera(renderer->GetActiveCamera());\n    depthSort->SortScalarsOff(); // do not really need this here\n    // Bring it to the mapper's input\n    mapper->SetInputConnection(depthSort->GetOutputPort());\n    depthSort->Update();\n  }\n  else\n  {\n    std::cout << \"*** NEITHER DEPTH PEELING NOR DEPTH SORTING ***\" << std::endl;\n  }\n\n  // Initialize interaction\n  renderWindowInteractor->Initialize();\n\n  // Check the average frame rate when rotating the actor\n  int endCount = 100;\n  vtkNew<vtkTimerLog> clock;\n  // Set a user transform for successively rotating the camera position\n  vtkNew<vtkTransform> transform;\n  transform->Identity();\n  transform->RotateY(2.0); // rotate 2 degrees around Y-axis at each iteration\n  auto camera = renderer->GetActiveCamera();\n  double camPos[3]; // camera position\n  // Start test\n  clock->StartTimer();\n  for (int i = 0; i < endCount; i++)\n  {\n    camera->GetPosition(camPos);\n    transform->TransformPoint(camPos, camPos);\n    camera->SetPosition(camPos);\n    renderWindow->Render();\n  }\n  clock->StopTimer();\n  double frameRate = (double)endCount / clock->GetElapsedTime();\n  std::cout << \"AVERAGE FRAME RATE: \" << frameRate << \" fps\" << std::endl;\n\n  // Start interaction\n  renderWindowInteractor->Start();\n\n  return success;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkAppendPolyData> GenerateOverlappingBunchOfSpheres(int theta,\n                                                                     int phi)\n{\n  vtkNew<vtkAppendPolyData> appendData;\n\n  for (int i = 0; i < 5; i++)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(theta);\n    sphereSource->SetPhiResolution(phi);\n    sphereSource->SetRadius(0.5); // all spheres except the center\n                                  // one should have radius = 0.5\n    switch (i)\n    {\n    case 0:\n      sphereSource->SetRadius(1);\n      sphereSource->SetCenter(0, 0, 0);\n      break;\n    case 1:\n      sphereSource->SetCenter(1, 0, 0);\n      break;\n    case 2:\n      sphereSource->SetCenter(-1, 0, 0);\n      break;\n    case 3:\n      sphereSource->SetCenter(0, 1, 0);\n      break;\n    case 4:\n      sphereSource->SetCenter(0, -1, 0);\n      break;\n    }\n    sphereSource->Update();\n    appendData->AddInputConnection(sphereSource->GetOutputPort());\n  }\n\n  return appendData;\n}\n\nbool SetupEnvironmentForDepthPeeling(vtkRenderWindow* renderWindow,\n                                     vtkRenderer* renderer, int maxNoOfPeels,\n                                     double occlusionRatio)\n{\n  if (!renderWindow || !renderer)\n    return false;\n\n  // 1. Use a render window with alpha bits (as initial value is 0 (false)):\n  renderWindow->SetAlphaBitPlanes(true);\n\n  // 2. Force to not pick a framebuffer with a multisample buffer\n  // (as initial value is 8):\n  renderWindow->SetMultiSamples(0);\n\n  // 3. Choose to use depth peeling (if supported) (initial value is 0 (false)):\n  renderer->SetUseDepthPeeling(true);\n\n  // 4. Set depth peeling parameters\n  // - Set the maximum number of rendering passes (initial value is 4):\n  renderer->SetMaximumNumberOfPeels(maxNoOfPeels);\n  // - Set the occlusion ratio (initial value is 0.0, exact image):\n  renderer->SetOcclusionRatio(occlusionRatio);\n\n  return true;\n}\n\nbool IsDepthPeelingSupported(vtkRenderWindow* renderWindow,\n                             vtkRenderer* renderer, bool doItOffScreen)\n{\n\n  bool success = true;\n\n  // Save original renderer / render window state\n  bool origOffScreenRendering = renderWindow->GetOffScreenRendering() == 1;\n  bool origAlphaBitPlanes = renderWindow->GetAlphaBitPlanes() == 1;\n  int origMultiSamples = renderWindow->GetMultiSamples();\n  bool origUseDepthPeeling = renderer->GetUseDepthPeeling() == 1;\n  int origMaxPeels = renderer->GetMaximumNumberOfPeels();\n  double origOcclusionRatio = renderer->GetOcclusionRatio();\n\n  // Activate off screen rendering on demand\n  renderWindow->SetOffScreenRendering(doItOffScreen);\n\n  // Setup environment for depth peeling (with some default parametrization)\n  success = success &&\n      SetupEnvironmentForDepthPeeling(renderWindow, renderer, 100, 0.1);\n\n  // Do a test render\n  renderWindow->Render();\n\n  // Check whether depth peeling was used\n  success = success && renderer->GetLastRenderingUsedDepthPeeling();\n\n  // recover original state\n  renderWindow->SetOffScreenRendering(origOffScreenRendering);\n  renderWindow->SetAlphaBitPlanes(origAlphaBitPlanes);\n  renderWindow->SetMultiSamples(origMultiSamples);\n  renderer->SetUseDepthPeeling(origUseDepthPeeling);\n  renderer->SetMaximumNumberOfPeels(origMaxPeels);\n  renderer->SetOcclusionRatio(origOcclusionRatio);\n\n  return success;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CorrectlyRenderTranslucentGeometry)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonSystem\n  CommonTransforms\n  FiltersCore\n  FiltersHybrid\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CorrectlyRenderTranslucentGeometry: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CorrectlyRenderTranslucentGeometry MACOSX_BUNDLE CorrectlyRenderTranslucentGeometry.cxx )\n  target_link_libraries(CorrectlyRenderTranslucentGeometry PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CorrectlyRenderTranslucentGeometry\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/#download-and-build-correctlyrendertranslucentgeometry","title":"Download and Build CorrectlyRenderTranslucentGeometry","text":"

Click here to download CorrectlyRenderTranslucentGeometry and its CMakeLists.txt file. Once the tarball CorrectlyRenderTranslucentGeometry.tar has been downloaded and extracted,

cd CorrectlyRenderTranslucentGeometry/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CorrectlyRenderTranslucentGeometry\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CreateColorSeriesDemo/","title":"CreateColorSeriesDemo","text":"

vtk-examples/Cxx/Visualization/CreateColorSeriesDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/CreateColorSeriesDemo/#description","title":"Description","text":"

This example demonstrates how to create a custom vtkColorSeries. The examples produces a vtkLookupTable explicitly. The vtkLookupTable is populated with colors from the vtkColorSeries using GetColorRepeating, since the size of the vtkLookupTable may be larger than the colors in the vtkColorSeries.

A vtkPlaneSource generates the geometry. The vtkCellData is populated with increasing integers starting at 1.

Ten different color series are generated from VTK color names in vtkNamedColors. The first argument of the example is one of \"Blue\", \"Brown\", \"Red\", \"Orange\", \"White\", \"Grey\", \"Magenta\", \"Cyan\", \"Yellow\" and \"Green\".

The colors are added from left to right, row by row, from the bottom left-hand corner of the table.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CreateColorSeriesDemo/#code","title":"Code","text":"

CreateColorSeriesDemo.cxx

#include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkColorSeries.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <map>\n#include <string>\n#include <vector>\n\nnamespace {\nvoid CreateLookupTableVTKBlue(vtkLookupTable* lut, int tableSize = 0);\nvoid CreateLookupTableVTKBrown(vtkLookupTable* lut, int tableSize = 0);\nvoid CreateLookupTableVTKRed(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKOrange(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKWhite(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKGrey(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKMagenta(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKCyan(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKYellow(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKGreen(vtkLookupTable* lu, int tableSize = 0);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  std::string seriesName = \"Red\";\n  if (argc > 1)\n  {\n    seriesName = argv[1];\n  }\n\n  // Provide some geometry.\n  int resolution = 6;\n  vtkNew<vtkPlaneSource> aPlane;\n  aPlane->SetXResolution(resolution);\n  aPlane->SetYResolution(resolution);\n\n  // Create cell data.\n  vtkNew<vtkFloatArray> cellData;\n  for (int i = 0; i < resolution * resolution; i++)\n  {\n    cellData->InsertNextValue(i);\n  }\n  aPlane->Update(); // Force an update so we can set cell data.\n  aPlane->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkLookupTable> lut;\n  if (seriesName == \"Blue\")\n  {\n    CreateLookupTableVTKBlue(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Brown\")\n  {\n    CreateLookupTableVTKBrown(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Red\")\n  {\n    CreateLookupTableVTKRed(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Orange\")\n  {\n    CreateLookupTableVTKOrange(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"White\")\n  {\n    CreateLookupTableVTKWhite(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Grey\")\n  {\n    CreateLookupTableVTKGrey(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Magenta\")\n  {\n    CreateLookupTableVTKMagenta(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Cyan\")\n  {\n    CreateLookupTableVTKCyan(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Yellow\")\n  {\n    CreateLookupTableVTKYellow(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Green\")\n  {\n    CreateLookupTableVTKGreen(lut, resolution * resolution + 1);\n  }\n  else\n  {\n    std::cout << \"Bad series name: \" << seriesName << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetLookupTable(lut);\n  mapper->SetInputConnection(aPlane->GetOutputPort());\n  mapper->SetScalarModeToUseCellData();\n  mapper->SetScalarRange(0, resolution * resolution + 1);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CreateColorSeriesDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateLookupTableVTKBlue(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKBlueColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"alice_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"blue_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"blue_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadet\"));\n  myColors->AddColor(nc->GetColor3ub(\"cobalt\"));\n  myColors->AddColor(nc->GetColor3ub(\"cornflower\"));\n  myColors->AddColor(nc->GetColor3ub(\"cerulean\"));\n  myColors->AddColor(nc->GetColor3ub(\"dodger_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"indigo\"));\n  myColors->AddColor(nc->GetColor3ub(\"manganese_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"midnight_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"navy\"));\n  myColors->AddColor(nc->GetColor3ub(\"peacock\"));\n  myColors->AddColor(nc->GetColor3ub(\"powder_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"royal_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_blue_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_blue_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_blue_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"sky_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"sky_blue_deep\"));\n  myColors->AddColor(nc->GetColor3ub(\"sky_blue_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"steel_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"steel_blue_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"turquoise_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"ultramarine\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKBrown(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKBrownColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"beige\"));\n  myColors->AddColor(nc->GetColor3ub(\"brown\"));\n  myColors->AddColor(nc->GetColor3ub(\"brown_madder\"));\n  myColors->AddColor(nc->GetColor3ub(\"brown_ochre\"));\n  myColors->AddColor(nc->GetColor3ub(\"burlywood\"));\n  myColors->AddColor(nc->GetColor3ub(\"burnt_sienna\"));\n  myColors->AddColor(nc->GetColor3ub(\"burnt_umber\"));\n  myColors->AddColor(nc->GetColor3ub(\"chocolate\"));\n  myColors->AddColor(nc->GetColor3ub(\"deep_ochre\"));\n  myColors->AddColor(nc->GetColor3ub(\"flesh\"));\n  myColors->AddColor(nc->GetColor3ub(\"flesh_ochre\"));\n  myColors->AddColor(nc->GetColor3ub(\"gold_ochre\"));\n  myColors->AddColor(nc->GetColor3ub(\"greenish_umber\"));\n  myColors->AddColor(nc->GetColor3ub(\"khaki\"));\n  myColors->AddColor(nc->GetColor3ub(\"khaki_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"light_beige\"));\n  myColors->AddColor(nc->GetColor3ub(\"peru\"));\n  myColors->AddColor(nc->GetColor3ub(\"rosy_brown\"));\n  myColors->AddColor(nc->GetColor3ub(\"raw_sienna\"));\n  myColors->AddColor(nc->GetColor3ub(\"raw_umber\"));\n  myColors->AddColor(nc->GetColor3ub(\"sepia\"));\n  myColors->AddColor(nc->GetColor3ub(\"sienna\"));\n  myColors->AddColor(nc->GetColor3ub(\"saddle_brown\"));\n  myColors->AddColor(nc->GetColor3ub(\"sandy_brown\"));\n  myColors->AddColor(nc->GetColor3ub(\"tan\"));\n  myColors->AddColor(nc->GetColor3ub(\"van_dyke_brown\"));\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKRed(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKRedColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"alizarin_crimson\"));\n  myColors->AddColor(nc->GetColor3ub(\"brick\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_red_deep\"));\n  myColors->AddColor(nc->GetColor3ub(\"coral\"));\n  myColors->AddColor(nc->GetColor3ub(\"coral_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"deep_pink\"));\n  myColors->AddColor(nc->GetColor3ub(\"english_red\"));\n  myColors->AddColor(nc->GetColor3ub(\"firebrick\"));\n  myColors->AddColor(nc->GetColor3ub(\"geranium_lake\"));\n  myColors->AddColor(nc->GetColor3ub(\"hot_pink\"));\n  myColors->AddColor(nc->GetColor3ub(\"indian_red\"));\n  myColors->AddColor(nc->GetColor3ub(\"light_salmon\"));\n  myColors->AddColor(nc->GetColor3ub(\"madder_lake_deep\"));\n  myColors->AddColor(nc->GetColor3ub(\"maroon\"));\n  myColors->AddColor(nc->GetColor3ub(\"pink\"));\n  myColors->AddColor(nc->GetColor3ub(\"pink_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"raspberry\"));\n  myColors->AddColor(nc->GetColor3ub(\"red\"));\n  myColors->AddColor(nc->GetColor3ub(\"rose_madder\"));\n  myColors->AddColor(nc->GetColor3ub(\"salmon\"));\n  myColors->AddColor(nc->GetColor3ub(\"tomato\"));\n  myColors->AddColor(nc->GetColor3ub(\"venetian_red\"));\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKGrey(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->SetColorSchemeByName(\"VTKGreyColors\");\n  myColors->AddColor(nc->GetColor3ub(\"cold_grey\"));\n  myColors->AddColor(nc->GetColor3ub(\"dim_grey\"));\n  myColors->AddColor(nc->GetColor3ub(\"grey\"));\n  myColors->AddColor(nc->GetColor3ub(\"light_grey\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_grey\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_grey_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_grey_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"warm_grey\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKWhite(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->SetColorSchemeByName(\"VTKWhiteColors\");\n  myColors->AddColor(nc->GetColor3ub(\"antique_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"azure\"));\n  myColors->AddColor(nc->GetColor3ub(\"bisque\"));\n  myColors->AddColor(nc->GetColor3ub(\"blanched_almond\"));\n  myColors->AddColor(nc->GetColor3ub(\"cornsilk\"));\n  myColors->AddColor(nc->GetColor3ub(\"eggshell\"));\n  myColors->AddColor(nc->GetColor3ub(\"floral_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"gainsboro\"));\n  myColors->AddColor(nc->GetColor3ub(\"ghost_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"honeydew\"));\n  myColors->AddColor(nc->GetColor3ub(\"ivory\"));\n  myColors->AddColor(nc->GetColor3ub(\"lavender\"));\n  myColors->AddColor(nc->GetColor3ub(\"lavender_blush\"));\n  myColors->AddColor(nc->GetColor3ub(\"lemon_chiffon\"));\n  myColors->AddColor(nc->GetColor3ub(\"linen\"));\n  myColors->AddColor(nc->GetColor3ub(\"mint_cream\"));\n  myColors->AddColor(nc->GetColor3ub(\"misty_rose\"));\n  myColors->AddColor(nc->GetColor3ub(\"moccasin\"));\n  myColors->AddColor(nc->GetColor3ub(\"navajo_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"old_lace\"));\n  myColors->AddColor(nc->GetColor3ub(\"papaya_whip\"));\n  myColors->AddColor(nc->GetColor3ub(\"peach_puff\"));\n  myColors->AddColor(nc->GetColor3ub(\"seashell\"));\n  myColors->AddColor(nc->GetColor3ub(\"snow\"));\n  myColors->AddColor(nc->GetColor3ub(\"thistle\"));\n  myColors->AddColor(nc->GetColor3ub(\"titanium_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"wheat\"));\n  myColors->AddColor(nc->GetColor3ub(\"white\"));\n  myColors->AddColor(nc->GetColor3ub(\"white_smoke\"));\n  myColors->AddColor(nc->GetColor3ub(\"zinc_white\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKOrange(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKOrangeColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_orange\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_red_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"carrot\"));\n  myColors->AddColor(nc->GetColor3ub(\"dark_orange\"));\n  myColors->AddColor(nc->GetColor3ub(\"mars_orange\"));\n  myColors->AddColor(nc->GetColor3ub(\"mars_yellow\"));\n  myColors->AddColor(nc->GetColor3ub(\"orange\"));\n  myColors->AddColor(nc->GetColor3ub(\"orange_red\"));\n  myColors->AddColor(nc->GetColor3ub(\"yellow_ochre\"));\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKMagenta(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKMagentaColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"blue_violet\"));\n  myColors->AddColor(nc->GetColor3ub(\"cobalt_violet_deep\"));\n  myColors->AddColor(nc->GetColor3ub(\"magenta\"));\n  myColors->AddColor(nc->GetColor3ub(\"orchid\"));\n  myColors->AddColor(nc->GetColor3ub(\"orchid_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"orchid_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"permanent_red_violet\"));\n  myColors->AddColor(nc->GetColor3ub(\"plum\"));\n  myColors->AddColor(nc->GetColor3ub(\"purple\"));\n  myColors->AddColor(nc->GetColor3ub(\"purple_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"ultramarine_violet\"));\n  myColors->AddColor(nc->GetColor3ub(\"violet\"));\n  myColors->AddColor(nc->GetColor3ub(\"violet_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"violet_red\"));\n  myColors->AddColor(nc->GetColor3ub(\"violet_red_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"violet_red_pale\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKCyan(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKCyanColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"aquamarine\"));\n  myColors->AddColor(nc->GetColor3ub(\"aquamarine_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"cyan\"));\n  myColors->AddColor(nc->GetColor3ub(\"cyan_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"turquoise\"));\n  myColors->AddColor(nc->GetColor3ub(\"turquoise_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"turquoise_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"turquoise_pale\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKYellow(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKYellowColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"aureoline_yellow\"));\n  myColors->AddColor(nc->GetColor3ub(\"banana\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_lemon\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_yellow\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_yellow_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"gold\"));\n  myColors->AddColor(nc->GetColor3ub(\"goldenrod\"));\n  myColors->AddColor(nc->GetColor3ub(\"goldenrod_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"goldenrod_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"goldenrod_pale\"));\n  myColors->AddColor(nc->GetColor3ub(\"light_goldenrod\"));\n  myColors->AddColor(nc->GetColor3ub(\"melon\"));\n  myColors->AddColor(nc->GetColor3ub(\"naples_yellow_deep\"));\n  myColors->AddColor(nc->GetColor3ub(\"yellow\"));\n  myColors->AddColor(nc->GetColor3ub(\"yellow_light\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKGreen(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKGreenColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"chartreuse\"));\n  myColors->AddColor(nc->GetColor3ub(\"chrome_oxide_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"cinnabar_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"cobalt_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"emerald_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"forest_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"green\"));\n  myColors->AddColor(nc->GetColor3ub(\"green_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"green_pale\"));\n  myColors->AddColor(nc->GetColor3ub(\"green_yellow\"));\n  myColors->AddColor(nc->GetColor3ub(\"lawn_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"lime_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"mint\"));\n  myColors->AddColor(nc->GetColor3ub(\"olive\"));\n  myColors->AddColor(nc->GetColor3ub(\"olive_drab\"));\n  myColors->AddColor(nc->GetColor3ub(\"olive_green_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"permanent_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"sap_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"sea_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"sea_green_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"sea_green_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"sea_green_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"spring_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"spring_green_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"terre_verte\"));\n  myColors->AddColor(nc->GetColor3ub(\"viridian_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"yellow_green\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/CreateColorSeriesDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CreateColorSeriesDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CreateColorSeriesDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CreateColorSeriesDemo MACOSX_BUNDLE CreateColorSeriesDemo.cxx )\n  target_link_libraries(CreateColorSeriesDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CreateColorSeriesDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CreateColorSeriesDemo/#download-and-build-createcolorseriesdemo","title":"Download and Build CreateColorSeriesDemo","text":"

Click here to download CreateColorSeriesDemo and its CMakeLists.txt file. Once the tarball CreateColorSeriesDemo.tar has been downloaded and extracted,

cd CreateColorSeriesDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CreateColorSeriesDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CubeAxesActor/","title":"CubeAxesActor","text":"

vtk-examples/Cxx/Visualization/CubeAxesActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CubeAxesActor/#code","title":"Code","text":"

CubeAxesActor.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeAxesActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  // Define colors for this example.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkColor3d backgroundColor = colors->GetColor3d(\"DarkSlateGray\");\n  vtkColor3d actorColor = colors->GetColor3d(\"Tomato\");\n  vtkColor3d axis1Color = colors->GetColor3d(\"Salmon\");\n  vtkColor3d axis2Color = colors->GetColor3d(\"PaleGreen\");\n  vtkColor3d axis3Color = colors->GetColor3d(\"LightSkyBlue\");\n\n  // Create a superquadric.\n  vtkNew<vtkSuperquadricSource> superquadricSource;\n  superquadricSource->SetPhiRoundness(3.1);\n  superquadricSource->SetThetaRoundness(1.0);\n  superquadricSource->Update(); // Needed to GetBounds later\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(superquadricSource->GetOutputPort());\n\n  vtkNew<vtkActor> superquadricActor;\n  superquadricActor->SetMapper(mapper);\n  superquadricActor->GetProperty()->SetDiffuseColor(actorColor.GetData());\n  superquadricActor->GetProperty()->SetDiffuse(.7);\n  superquadricActor->GetProperty()->SetSpecular(.7);\n  superquadricActor->GetProperty()->SetSpecularPower(50.0);\n\n  vtkNew<vtkCubeAxesActor> cubeAxesActor;\n  cubeAxesActor->SetUseTextActor3D(1);\n  cubeAxesActor->SetBounds(superquadricSource->GetOutput()->GetBounds());\n  cubeAxesActor->SetCamera(renderer->GetActiveCamera());\n  cubeAxesActor->GetTitleTextProperty(0)->SetColor(axis1Color.GetData());\n  cubeAxesActor->GetTitleTextProperty(0)->SetFontSize(48);\n  cubeAxesActor->GetLabelTextProperty(0)->SetColor(axis1Color.GetData());\n\n  cubeAxesActor->GetTitleTextProperty(1)->SetColor(axis2Color.GetData());\n  cubeAxesActor->GetLabelTextProperty(1)->SetColor(axis2Color.GetData());\n\n  cubeAxesActor->GetTitleTextProperty(2)->SetColor(axis3Color.GetData());\n  cubeAxesActor->GetLabelTextProperty(2)->SetColor(axis3Color.GetData());\n\n  cubeAxesActor->DrawXGridlinesOn();\n  cubeAxesActor->DrawYGridlinesOn();\n  cubeAxesActor->DrawZGridlinesOn();\n#if VTK_MAJOR_VERSION == 6\n  cubeAxesActor->SetGridLineLocation(VTK_GRID_LINES_FURTHEST);\n#endif\n#if VTK_MAJOR_VERSION > 6\n  cubeAxesActor->SetGridLineLocation(cubeAxesActor->VTK_GRID_LINES_FURTHEST);\n#endif\n\n  cubeAxesActor->XAxisMinorTickVisibilityOff();\n  cubeAxesActor->YAxisMinorTickVisibilityOff();\n  cubeAxesActor->ZAxisMinorTickVisibilityOff();\n\n  cubeAxesActor->SetFlyModeToStaticEdges();\n  renderer->AddActor(cubeAxesActor);\n  renderer->AddActor(superquadricActor);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n  renderer->SetBackground(backgroundColor.GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"CubeAxesActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Zoom(0.8);\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/CubeAxesActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CubeAxesActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CubeAxesActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CubeAxesActor MACOSX_BUNDLE CubeAxesActor.cxx )\n  target_link_libraries(CubeAxesActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CubeAxesActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CubeAxesActor/#download-and-build-cubeaxesactor","title":"Download and Build CubeAxesActor","text":"

Click here to download CubeAxesActor and its CMakeLists.txt file. Once the tarball CubeAxesActor.tar has been downloaded and extracted,

cd CubeAxesActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CubeAxesActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CubeAxesActor2D/","title":"CubeAxesActor2D","text":"

vtk-examples/Cxx/Visualization/CubeAxesActor2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/CubeAxesActor2D/#description","title":"Description","text":"

For more information on how to configure this actor, see this email.

Seealso

BoundingBox and Outline.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CubeAxesActor2D/#code","title":"Code","text":"

CubeAxesActor2D.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeAxesActor2D.h>\n#include <vtkLODActor.h>\n// #include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\n// The vtkCubeAxesActor2D draws axes on the bounding box of the data set and\n// labels the axes with x-y-z coordinates.\n\n//----------------------------------------------------------------------------//\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPlatonicSolidSource> icosahedron;\n  icosahedron->SetSolidTypeToIcosahedron();\n\n  // Create a vtkPolyDataNormals filter to calculate the normals of the data\n  // set.\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(icosahedron->GetOutputPort());\n\n  // Set up the associated mapper and actor.\n  vtkNew<vtkPolyDataMapper> icosahedron_mapper;\n  icosahedron_mapper->SetInputConnection(normals->GetOutputPort());\n  icosahedron_mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkLODActor> icosahedron_actor;\n  icosahedron_actor->SetMapper(icosahedron_mapper.GetPointer());\n  icosahedron_actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Plum\").GetData());\n\n  // Create a vtkOutlineFilter to draw the bounding box of the data set.\n  // Also create the associated mapper and actor.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> map_outline;\n  map_outline->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outline_actor;\n  outline_actor->SetMapper(map_outline.GetPointer());\n  outline_actor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the Renderers.  Assign them the appropriate viewport\n  // coordinates, active camera, and light.\n  vtkNew<vtkRenderer> ren;\n  ren->SetViewport(0, 0, 0.5, 1.0);\n  // It is also possible to enhance the display with cameras.\n  // ren->SetActiveCamera(camera);\n  // ren->AddLight(light);\n\n  vtkNew<vtkRenderer> ren2;\n  ren2->SetViewport(0.5, 0, 1.0, 1.0);\n  ren2->SetActiveCamera(ren->GetActiveCamera());\n  // ren2->AddLight(light);\n\n  // Create the RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren.GetPointer());\n  renWin->AddRenderer(ren2.GetPointer());\n  renWin->SetWindowName(\"CubeAxesActor2D\");\n  renWin->SetSize(1200, 600);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin.GetPointer());\n\n  // Add the actors to the renderer, and set the background.\n  ren->AddViewProp(icosahedron_actor.GetPointer());\n  ren->AddViewProp(outline_actor.GetPointer());\n  ren2->AddViewProp(icosahedron_actor.GetPointer());\n  ren2->AddViewProp(outline_actor.GetPointer());\n\n  ren->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  ren2->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Create a text property for both cube axes.\n  vtkNew<vtkTextProperty> tprop;\n  tprop->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  tprop->ShadowOn();\n  tprop->SetFontSize(20);\n\n  // Create a vtkCubeAxesActor2D. Use the outer edges of the bounding box to\n  // draw the axes. Add the actor to the renderer.\n  vtkNew<vtkCubeAxesActor2D> axes;\n  axes->SetInputConnection(normals->GetOutputPort());\n  axes->SetCamera(ren->GetActiveCamera());\n  axes->SetLabelFormat(\"%6.4g\");\n  axes->SetFlyModeToOuterEdges();\n  axes->SetAxisTitleTextProperty(tprop.GetPointer());\n  axes->SetAxisLabelTextProperty(tprop.GetPointer());\n  ren->AddViewProp(axes.GetPointer());\n\n  // Create a vtkCubeAxesActor2D. Use the closest vertex to the camera to\n  // determine where to draw the axes. Add the actor to the renderer.\n  vtkNew<vtkCubeAxesActor2D> axes2;\n  axes2->SetViewProp(icosahedron_actor.GetPointer());\n  axes2->SetCamera(ren2->GetActiveCamera());\n  axes2->SetLabelFormat(\"%6.4g\");\n  axes2->SetFlyModeToClosestTriad();\n  axes2->ScalingOff();\n  axes2->SetAxisTitleTextProperty(tprop.GetPointer());\n  axes2->SetAxisLabelTextProperty(tprop.GetPointer());\n  ren2->AddViewProp(axes2.GetPointer());\n\n  ren->ResetCamera();\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/CubeAxesActor2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CubeAxesActor2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CubeAxesActor2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CubeAxesActor2D MACOSX_BUNDLE CubeAxesActor2D.cxx )\n  target_link_libraries(CubeAxesActor2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CubeAxesActor2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CubeAxesActor2D/#download-and-build-cubeaxesactor2d","title":"Download and Build CubeAxesActor2D","text":"

Click here to download CubeAxesActor2D and its CMakeLists.txt file. Once the tarball CubeAxesActor2D.tar has been downloaded and extracted,

cd CubeAxesActor2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CubeAxesActor2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Cursor2D/","title":"Cursor2D","text":"

vtk-examples/Cxx/Visualization/Cursor2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Cursor2D/#code","title":"Code","text":"

Cursor2D.cxx

#include <vtkActor.h>\n#include <vtkCursor2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Cursor2D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkCursor2D> cursor;\n  cursor->SetModelBounds(-10, 10, -10, 10, 0, 0);\n  cursor->AllOn();\n  cursor->SetFocalPoint(5.0, 5.0, 0.0);\n  cursor->OutlineOn();\n  cursor->Update();\n\n  vtkNew<vtkPolyDataMapper> cursorMapper;\n  cursorMapper->SetInputConnection(cursor->GetOutputPort());\n  vtkNew<vtkActor> cursorActor;\n  cursorActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  cursorActor->SetMapper(cursorMapper);\n  renderer->AddActor(cursorActor);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Cursor2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cursor2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cursor2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cursor2D MACOSX_BUNDLE Cursor2D.cxx )\n  target_link_libraries(Cursor2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cursor2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Cursor2D/#download-and-build-cursor2d","title":"Download and Build Cursor2D","text":"

Click here to download Cursor2D and its CMakeLists.txt file. Once the tarball Cursor2D.tar has been downloaded and extracted,

cd Cursor2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cursor2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Cursor3D/","title":"Cursor3D","text":"

vtk-examples/Cxx/Visualization/Cursor3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Cursor3D/#code","title":"Code","text":"

Cursor3D.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCursor3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"Cursor3D\");\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkCursor3D> cursor;\n  cursor->SetModelBounds(-10, 10, -10, 10, -10, 10);\n  cursor->AllOn();\n  cursor->OutlineOff();\n  cursor->Update();\n\n  vtkNew<vtkPolyDataMapper> cursorMapper;\n  cursorMapper->SetInputConnection(cursor->GetOutputPort());\n  vtkNew<vtkActor> cursorActor;\n  cursorActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  cursorActor->SetMapper(cursorMapper);\n  renderer->AddActor(cursorActor);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Cursor3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cursor3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cursor3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cursor3D MACOSX_BUNDLE Cursor3D.cxx )\n  target_link_libraries(Cursor3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cursor3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Cursor3D/#download-and-build-cursor3d","title":"Download and Build Cursor3D","text":"

Click here to download Cursor3D and its CMakeLists.txt file. Once the tarball Cursor3D.tar has been downloaded and extracted,

cd Cursor3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cursor3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CursorShape/","title":"CursorShape","text":"

vtk-examples/Cxx/Visualization/CursorShape

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CursorShape/#code","title":"Code","text":"

CursorShape.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CursorShape\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n\n  // This must occur after the above Render() call or it does not work.\n  renderWindow->SetCurrentCursor(VTK_CURSOR_HAND);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/CursorShape/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CursorShape)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CursorShape: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CursorShape MACOSX_BUNDLE CursorShape.cxx )\n  target_link_libraries(CursorShape PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CursorShape\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CursorShape/#download-and-build-cursorshape","title":"Download and Build CursorShape","text":"

Click here to download CursorShape and its CMakeLists.txt file. Once the tarball CursorShape.tar has been downloaded and extracted,

cd CursorShape/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CursorShape\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CurvatureBandsWithGlyphs/","title":"CurvatureBandsWithGlyphs","text":"

vtk-examples/Cxx/Visualization/CurvatureBandsWithGlyphs

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/CurvatureBandsWithGlyphs/#description","title":"Description","text":"

In this example we are coloring the surface by partitioning the gaussian curvature into bands and using arrows to display the normals on the surface.

Rather beautiful surfaces are generated.

The banded contour filter and an indexed lookup table are used to generate the curvature bands on the surface. To further enhance the surface, the surface normals are glyphed and colored by elevation using a diverging lookup table.

Note that:

  • If the regions on a surface have zero Gaussian curvature, then they can be flattened into a plane with no distortion, and the geometry of the region is Euclidean geometry.

  • If the regions on a surface have positive Gaussian curvature, then the geometry of the surface is spherical geometry.

  • If the regions on the surface have a negative Gaussian curvature, then the geometry of the surface is hyperbolic geometry.

In the above image you can see that the random hills incorporate all of these geometries.

The surface selected is the parametric random hills surface. The problem with the random hills surface is:

  • Most of the gaussian curvatures will lie in the range -1 to 0.2 (say) with a few large values say 20 to 40 at the peaks of the hills.
  • The edges of the random hills surface also have large irregular values so we need to handle these also. In order to fix this, a function is provided to adjust the edges.

So we need to manually generate custom bands to group the curvatures. The bands selected in the examples show that the surface is mostly planar with some hyperbolic regions (saddle points) and some spherical regions.

Feel free to experiment with different color schemes and/or the other sources from the parametric function group or the torus etc.

You will usually need to adjust the parameters for maskPts, arrow and glyph for a nice appearance.

A histogram of the frequencies is also output to the console. This is useful if you want to get an idea of the distribution of the scalars in each band.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CurvatureBandsWithGlyphs/#code","title":"Code","text":"

CurvatureBandsWithGlyphs.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkColorSeries.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkCurvatures.h>\n#include <vtkDelaunay2D.h>\n#include <vtkDoubleArray.h>\n#include <vtkElevationFilter.h>\n#include <vtkFeatureEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdFilter.h>\n#include <vtkIdList.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkReverseSense.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVariant.h>\n#include <vtkVariantArray.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\n#include <algorithm>\n#include <array>\n#include <cctype>\n#include <cmath>\n#include <cstdlib>\n#include <cstring>\n#include <functional>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <numeric>\n#include <set>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n\n//! Adjust curvatures along the edges of the surface.\n/*!\n * This function adjusts curvatures along the edges of the surface by replacing\n *  the value with the average value of the curvatures of points in the\n *  neighborhood.\n *\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param epsilon: Curvature values less than this will be set to zero.\n * @return\n */\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon = 1.0e-08);\n\n//! Constrain curvatures to the range [lower_bound ... upper_bound].\n/*!\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param lowerBound: The lower bound.\n * @param upperBound: The upper bound.\n * @return\n */\nvoid ConstrainCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                         double const& lowerBound = 0.0,\n                         double const& upperBound = 0.0);\n\n//! Generate elevations over the surface.\n/*!\n@param src - the vtkPolyData source.\n@return elev - the elevations.\n*/\nvtkSmartPointer<vtkPolyData> GetElevations(vtkPolyData* src);\n\nvtkSmartPointer<vtkPolyData> GetHills();\nvtkSmartPointer<vtkPolyData> GetParametricHills();\nvtkSmartPointer<vtkPolyData> GetParametricTorus();\nvtkSmartPointer<vtkPolyData> GetPlane();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetTorus();\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& source);\n\nvtkSmartPointer<vtkColorSeries> GetColorSeries();\n\nvtkSmartPointer<vtkLookupTable> GetCategoricalLUT();\n\nvtkSmartPointer<vtkLookupTable> GetOrdinaLUT();\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLUT();\n\nvtkSmartPointer<vtkLookupTable> ReverseLUT(vtkLookupTable* lut);\n\n//!  Glyph the normals on the surface.\n/*!\n@param src - the vtkPolyData source.\n#param scaleFactor - the scale factor for the glyphs.\n@param reverseNormals - if True the normals on the surface are reversed.\n@return The glyphs.\n*/\nvtkNew<vtkGlyph3D> GetGlyphs(vtkPolyData* src, double const& scaleFactor = 1.0,\n                             bool const& reverseNormals = false);\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision = 2,\n                                            bool const& nearestInteger = false);\n\n//! Divide a range into custom bands\n/*!\nYou need to specify each band as an array [r1, r2] where r1 < r2 and\nappend these to a vector.\nThe vector should ultimately look\nlike this: [[r1, r2], [r2, r3], [r3, r4]...]\n\n@param dR - [min, max] the range that is to be covered by the bands.\n@param numberOfBands - the number of bands, a positive integer.\n@param myBands - the bands.\n@return  A map consisting of the band inxex and [min, midpoint, max] for each\nband.\n*/\nstd::map<int, std::vector<double>>\nGetCustomBands(double const dR[2], int const& numberOfBands,\n               std::vector<std::array<double, 2>> const& myBands);\n\n//! Divide a range into integral bands\n/*!\nDivide a range into bands\n@param dR - [min, max] the range that is to be covered by the bands.\n@returnA map consisting of the band inxex and [min, midpoint, max] for each\nband.\n*/\nstd::map<int, std::vector<double>> GetIntegralBands(double const dR[2]);\n\n//! Count the number of scalars in each band.\n/*\n * The scalars used are the active scalars in the polydata.\n *\n * @param bands - the bands.\n * @param src - the vtkPolyData source.\n * @return The frequencies of the scalars in each band.\n */\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src);\n//!\n/*\n * The bands and frequencies are adjusted so that the first and last\n *  frequencies in the range are non-zero.\n * @param bands: The bands.\n * @param freq: The frequencies.\n */\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq);\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision = 2);\n\n} // namespace\n\nint main(int, char*[])\n{\n  // Get the surface\n  std::string desiredSurface{\"RandomHills\"};\n  // desiredSurface = \"Hills\";\n  // desiredSurface = \"ParametricTorus\";\n  // desiredSurface = \"Plane\";\n  // desiredSurface = \"RandomHills\";\n  // desiredSurface = \"Sphere\";\n  // desiredSurface = \"Torus\";\n  auto source = GetSource(desiredSurface);\n\n  // The length of the normal arrow glyphs.\n  auto scaleFactor = 1.0;\n  if (desiredSurface == \"Hills\")\n  {\n    scaleFactor = 0.5;\n  }\n  if (desiredSurface == \"Sphere\")\n  {\n    scaleFactor = 2.0;\n  }\n  std::cout << desiredSurface << std::endl;\n\n  auto gaussianCurvature = true;\n  std::string curvature =\n      (gaussianCurvature) ? \"Gauss_Curvature\" : \"Mean_Curvature\";\n\n  vtkNew<vtkCurvatures> cc;\n  cc->SetInputData(source);\n  std::vector<std::string> needsAdjusting{\"Hills\", \"ParametricTorus\", \"Plane\",\n                                          \"RandomHills\", \"Torus\"};\n  if (gaussianCurvature)\n  {\n    cc->SetCurvatureTypeToGaussian();\n    cc->Update();\n    if (std::find(needsAdjusting.begin(), needsAdjusting.end(),\n                  desiredSurface) != needsAdjusting.end())\n    {\n      AdjustEdgeCurvatures(cc->GetOutput(), curvature);\n    }\n    if (desiredSurface == \"Plane\")\n    {\n      ConstrainCurvatures(cc->GetOutput(), curvature, 0.0, 0.0);\n    }\n    if (desiredSurface == \"Sphere\")\n    {\n\n      // Gaussian curvature is 1/r^2\n      ConstrainCurvatures(cc->GetOutput(), curvature, 4.0, 4.0);\n    }\n  }\n  else\n  {\n\n    cc->SetCurvatureTypeToMean();\n    cc->Update();\n    if (std::find(needsAdjusting.begin(), needsAdjusting.end(),\n                  desiredSurface) != needsAdjusting.end())\n    {\n      AdjustEdgeCurvatures(cc->GetOutput(), curvature);\n    }\n    if (desiredSurface == \"Plane\")\n    {\n      ConstrainCurvatures(cc->GetOutput(), curvature, 0.0, 0.0);\n    }\n    if (desiredSurface == \"Sphere\")\n    {\n\n      // Mean curvature is 1/r\n      ConstrainCurvatures(cc->GetOutput(), curvature, 2.0, 2.0);\n    }\n  }\n\n  cc->GetOutput()->GetPointData()->SetActiveScalars(curvature.c_str());\n  auto scalarRangeCurvatures = cc->GetOutput()\n                                   ->GetPointData()\n                                   ->GetScalars(curvature.c_str())\n                                   ->GetRange();\n  auto scalarRangeElevation =\n      cc->GetOutput()->GetPointData()->GetScalars(\"Elevation\")->GetRange();\n\n  auto lut = GetCategoricalLUT();\n  auto lut1 = GetDivergingLUT();\n  lut->SetTableRange(scalarRangeCurvatures);\n  lut1->SetTableRange(scalarRangeElevation);\n  auto numberOfBands = lut->GetNumberOfTableValues();\n  auto precision = 10;\n  auto bands = GetBands(scalarRangeCurvatures, numberOfBands, precision, false);\n\n  if (desiredSurface == \"RandomHills\")\n  {\n    // These are my custom bands.\n    // Generated by first running:\n    // bands = GetBands(scalarRangeCurvatures, numberOfBands, precision, false);\n    // then:\n    //  std::vector<int> freq = Frequencies(bands, src);\n    //  PrintBandsFrequencies(bands, freq);\n    // Finally using the output to create this table:\n    // std::vector<std::array<double, 2>> myBands = {\n    //    {-0.630, -0.190},  {-0.190, -0.043}, {-0.043, -0.0136},\n    //    {-0.0136, 0.0158}, {0.0158, 0.0452}, {0.0452, 0.0746},12\n    //    {0.0746, 0.104},   {0.104, 0.251},   {0.251, 1.131}};\n    //  This demonstrates that the gaussian curvature of the surface\n    //   is mostly planar with some hyperbolic regions (saddle points)\n    //   and some spherical regions.\n    std::vector<std::array<double, 2>> myBands = {\n        {-0.630, -0.190}, {-0.190, -0.043}, {-0.043, 0.0452}, {0.0452, 0.0746},\n        {0.0746, 0.104},  {0.104, 0.251},   {0.251, 1.131}};\n\n    // Comment this out if you want to see how allocating\n    // equally spaced bands works.\n    bands = GetCustomBands(scalarRangeCurvatures, numberOfBands, myBands);\n    // Adjust the number of table values\n    lut->SetNumberOfTableValues(static_cast<vtkIdType>(bands.size()));\n  }\n  else if (desiredSurface == \"Hills\")\n  {\n    std::vector<std::array<double, 2>> myBands = {\n        {-2.104, -0.15},   {-0.15, -0.1},   {-0.1, -0.05},\n        {-0.05, -0.02},    {-0.02, -0.005}, {-0.005, -0.0005},\n        {-0.0005, 0.0005}, {0.0005, 0.09},  {0.09, 4.972},\n    };\n\n    // Comment this out if you want to see how allocating\n    // equally spaced bands works.\n    bands = GetCustomBands(scalarRangeCurvatures, numberOfBands, myBands);\n    // Adjust the number of table values\n    lut->SetNumberOfTableValues(static_cast<vtkIdType>(bands.size()));\n  }\n\n  // Let's do a frequency table.\n  auto freq = GetFrequencies(bands, cc->GetOutput());\n  AdjustFrequencyRanges(bands, freq);\n  PrintBandsFrequencies(bands, freq);\n\n  scalarRangeCurvatures[0] = bands.begin()->second[0];\n  scalarRangeCurvatures[1] = std::prev(bands.end())->second[2];\n  lut->SetTableRange(scalarRangeCurvatures);\n  lut->SetNumberOfTableValues(bands.size());\n\n  // We will use the midpoint of the band as the label.\n  std::vector<std::string> labels;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    std::ostringstream os;\n    os << std::fixed << std::setw(6) << std::setprecision(2) << p->second[1];\n    labels.push_back(os.str());\n  }\n\n  // Annotate\n  vtkNew<vtkVariantArray> values;\n  for (size_t i = 0; i < labels.size(); ++i)\n  {\n    values->InsertNextValue(vtkVariant(labels[i]));\n  }\n  for (vtkIdType i = 0; i < values->GetNumberOfTuples(); ++i)\n  {\n    lut->SetAnnotation(i, values->GetValue(i).ToString());\n  }\n\n  // Create a lookup table with the colors reversed.\n  auto lutr = ReverseLUT(lut);\n\n  // Create the contour bands.\n  vtkNew<vtkBandedPolyDataContourFilter> bcf;\n  bcf->SetInputData(cc->GetOutput());\n  // Use either the minimum or maximum value for each band.\n  int i = 0;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    bcf->SetValue(i, p->second[2]);\n    ++i;\n  }\n  // We will use an indexed lookup table.\n  bcf->SetScalarModeToIndex();\n  bcf->GenerateContourEdgesOn();\n\n  // Generate the glyphs on the original surface.\n\n  auto glyph = GetGlyphs(cc->GetOutput(), scaleFactor, false);\n\n  // ------------------------------------------------------------\n  // Create the mappers and actors\n  // ------------------------------------------------------------\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  colors->SetColor(\"BkgColor\",\n                   std::array<unsigned char, 4>{179, 204, 255, 255}.data());\n  colors->SetColor(\"ParaViewBkg\",\n                   std::array<unsigned char, 4>{82, 87, 110, 255}.data());\n\n  vtkNew<vtkPolyDataMapper> srcMapper;\n  srcMapper->SetInputConnection(bcf->GetOutputPort());\n  srcMapper->SetScalarRange(scalarRangeCurvatures);\n  srcMapper->SetLookupTable(lut);\n  srcMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> srcActor;\n  srcActor->SetMapper(srcMapper);\n\n  // Create contour edges\n  vtkNew<vtkPolyDataMapper> edgeMapper;\n  edgeMapper->SetInputData(bcf->GetContourEdgesOutput());\n  edgeMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(edgeMapper);\n  edgeActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyph->GetOutputPort());\n  glyphMapper->SetScalarModeToUsePointFieldData();\n  glyphMapper->SetColorModeToMapScalars();\n  glyphMapper->ScalarVisibilityOn();\n  glyphMapper->SelectColorArray(\"Elevation\");\n  // Colour by scalars.\n  glyphMapper->SetLookupTable(lut1);\n  glyphMapper->SetScalarRange(scalarRangeElevation);\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyphMapper);\n\n  auto windowWidth = 800;\n  auto windowHeight = 800;\n\n  // Add scalar bars.\n  auto curvatureType = curvature;\n  std::replace(curvatureType.begin(), curvatureType.end(), '_', '\\n');\n\n  vtkNew<vtkScalarBarActor> scalarBar;\n  // This LUT puts the lowest value at the top of the scalar bar.\n  // scalarBar->SetLookupTable(lut);\n  // Use this LUT if you want the highest value at the top.\n  scalarBar->SetLookupTable(lutr);\n  scalarBar->SetTitle(curvatureType.c_str());\n  scalarBar->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->GetAnnotationTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->UnconstrainedFontSizeOn();\n  scalarBar->SetMaximumWidthInPixels(windowWidth / 8);\n  scalarBar->SetMaximumHeightInPixels(windowHeight / 3);\n  scalarBar->SetPosition(0.85, 0.05);\n\n  vtkNew<vtkScalarBarActor> scalarBarElev;\n  scalarBarElev->SetLookupTable(lut1);\n  scalarBarElev->SetTitle(\"Elevation\");\n  scalarBarElev->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBarElev->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBarElev->GetAnnotationTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBarElev->UnconstrainedFontSizeOn();\n  if (desiredSurface == \"Plane\")\n  {\n    scalarBarElev->SetNumberOfLabels(1);\n  }\n  else\n  {\n    scalarBarElev->SetNumberOfLabels(5);\n  }\n  scalarBarElev->SetMaximumWidthInPixels(windowWidth / 8);\n  scalarBarElev->SetMaximumHeightInPixels(windowHeight / 3);\n  // scalarBarElev->SetBarRatio(scalarBarElev->GetBarRatio() * 0.5);\n  scalarBarElev->SetPosition(0.85, 0.4);\n\n  // ------------------------------------------------------------\n  // Create the RenderWindow, Renderer and Interactor\n  // ------------------------------------------------------------\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  renWin->AddRenderer(ren);\n  // Important: The interactor must be set prior to enabling the widget.\n  iren->SetRenderWindow(renWin);\n#ifdef HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(ren);\n  // Enable the widget.\n  camOrientManipulator->On();\n#endif\n\n  // add actors\n  ren->AddViewProp(srcActor);\n  ren->AddViewProp(edgeActor);\n  ren->AddViewProp(glyphActor);\n  ren->AddActor2D(scalarBar);\n  ren->AddActor2D(scalarBarElev);\n\n  ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n  renWin->SetSize(windowWidth, windowHeight);\n  renWin->SetWindowName(\"CurvatureBandsWithGlyphs\");\n\n  if (desiredSurface == \"RandomHills\")\n  {\n    auto camera = ren->GetActiveCamera();\n    camera->SetPosition(10.9299, 59.1505, 24.9823);\n    camera->SetFocalPoint(2.21692, 7.97545, 7.75135);\n    camera->SetViewUp(-0.230136, 0.345504, -0.909761);\n    camera->SetDistance(54.6966);\n    camera->SetClippingRange(36.3006, 77.9852);\n    renWin->Render();\n  }\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon)\n{\n  auto PointNeighbourhood =\n      [&source](vtkIdType const& pId) -> std::set<vtkIdType> {\n    // Extract the topological neighbors for point pId. In two steps:\n    //  1) source->GetPointCells(pId, cellIds)\n    //  2) source->GetCellPoints(cellId, cellPointIds) for all cellId in cellIds\n    vtkNew<vtkIdList> cellIds;\n    source->GetPointCells(pId, cellIds);\n    std::set<vtkIdType> neighbours;\n    for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); ++i)\n    {\n      auto cellId = cellIds->GetId(i);\n      vtkNew<vtkIdList> cellPointIds;\n      source->GetCellPoints(cellId, cellPointIds);\n      for (vtkIdType j = 0; j < cellPointIds->GetNumberOfIds(); ++j)\n      {\n        neighbours.insert(cellPointIds->GetId(j));\n      }\n    }\n    return neighbours;\n  };\n\n  auto ComputeDistance = [&source](vtkIdType const& ptIdA,\n                                   vtkIdType const& ptIdB) {\n    std::array<double, 3> ptA{0.0, 0.0, 0.0};\n    std::array<double, 3> ptB{0.0, 0.0, 0.0};\n    std::array<double, 3> ptC{0.0, 0.0, 0.0};\n    source->GetPoint(ptIdA, ptA.data());\n    source->GetPoint(ptIdB, ptB.data());\n    std::transform(std::begin(ptA), std::end(ptA), std::begin(ptB),\n                   std::begin(ptC), std::minus<double>());\n    // Calculate the norm.\n    auto result = std::sqrt(std::inner_product(std::begin(ptC), std::end(ptC),\n                                               std::begin(ptC), 0.0));\n    return result;\n  };\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n\n  // Get the boundary point IDs.\n  std::string name = \"Ids\";\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputData(source);\n  idFilter->SetPointIds(true);\n  idFilter->SetCellIds(false);\n  idFilter->SetPointIdsArrayName(name.c_str());\n  idFilter->SetCellIdsArrayName(name.c_str());\n  idFilter->Update();\n\n  vtkNew<vtkFeatureEdges> edges;\n\n  edges->SetInputConnection(idFilter->GetOutputPort());\n  edges->BoundaryEdgesOn();\n  edges->ManifoldEdgesOff();\n  edges->NonManifoldEdgesOff();\n  edges->FeatureEdgesOff();\n  edges->Update();\n\n  auto edgeAarray =\n      edges->GetOutput()->GetPointData()->GetAbstractArray(name.c_str());\n  std::vector<vtkIdType> boundaryIds;\n  for (vtkIdType i = 0; i < edges->GetOutput()->GetNumberOfPoints(); ++i)\n  {\n    boundaryIds.push_back(edgeAarray->GetVariantValue(i).ToInt());\n  }\n  // Remove duplicate Ids.\n  std::set<vtkIdType> pIdsSet(boundaryIds.begin(), boundaryIds.end());\n  for (auto const pId : boundaryIds)\n  {\n    auto pIdsNeighbors = PointNeighbourhood(pId);\n    std::set<vtkIdType> pIdsNeighborsInterior;\n    std::set_difference(\n        pIdsNeighbors.begin(), pIdsNeighbors.end(), pIdsSet.begin(),\n        pIdsSet.end(),\n        std::inserter(pIdsNeighborsInterior, pIdsNeighborsInterior.begin()));\n    // Compute distances and extract curvature values.\n    std::vector<double> curvs;\n    std::vector<double> dists;\n    for (auto const pIdN : pIdsNeighborsInterior)\n    {\n      curvs.push_back(curvatures[pIdN]);\n      dists.push_back(ComputeDistance(pIdN, pId));\n    }\n    std::vector<vtkIdType> nonZeroDistIds;\n    for (size_t i = 0; i < dists.size(); ++i)\n    {\n      if (dists[i] > 0)\n      {\n        nonZeroDistIds.push_back(i);\n      }\n    }\n    std::vector<double> curvsNonZero;\n    std::vector<double> distsNonZero;\n    for (auto const i : nonZeroDistIds)\n    {\n      curvsNonZero.push_back(curvs[i]);\n      distsNonZero.push_back(dists[i]);\n    }\n    // Iterate over the edge points and compute the curvature as the weighted\n    // average of the neighbours.\n    auto countInvalid = 0;\n    auto newCurv = 0.0;\n    if (curvsNonZero.size() > 0)\n    {\n      std::vector<double> weights;\n      double sum = 0.0;\n      for (auto const d : distsNonZero)\n      {\n        sum += 1.0 / d;\n        weights.push_back(1.0 / d);\n      }\n      for (size_t i = 0; i < weights.size(); ++i)\n      {\n        weights[i] = weights[i] / sum;\n      }\n      newCurv = std::inner_product(curvsNonZero.begin(), curvsNonZero.end(),\n                                   weights.begin(), 0.0);\n    }\n    else\n    {\n      // Corner case.\n      // countInvalid += 1;\n      // Assuming the curvature of the point is planar.\n      newCurv = 0.0;\n    }\n    // Set the new curvature value.\n    curvatures[pId] = newCurv;\n  }\n\n  // Set small values to zero.\n  if (epsilon != 0.0)\n  {\n    auto eps = std::abs(epsilon);\n    for (size_t i = 0; i < curvatures.size(); ++i)\n    {\n      if (std::abs(curvatures[i]) < eps)\n      {\n        curvatures[i] = 0.0;\n      }\n    }\n  }\n\n  if (static_cast<size_t>(source->GetNumberOfPoints()) != curvatures.size())\n  {\n    std::string s = curvatureName;\n    s += \":\\nCannot add the adjusted curvatures to the source.\\n\";\n    s += \" The number of points in source does not equal the\\n\";\n    s += \" number of point ids in the adjusted curvature array.\";\n    std::cerr << s << std::endl;\n    return;\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\nvoid ConstrainCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                         double const& lowerBound, double const& upperBound)\n{\n  std::array<double, 2> bounds{0.0, 0.0};\n  if (lowerBound < upperBound)\n  {\n    bounds[0] = lowerBound;\n    bounds[1] = upperBound;\n  }\n  else\n  {\n    bounds[0] = upperBound;\n    bounds[1] = lowerBound;\n  }\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n  //  Set upper and lower bounds.\n  for (size_t i = 0; i < curvatures.size(); ++i)\n  {\n    if (curvatures[i] < bounds[0])\n    {\n      curvatures[i] = bounds[0];\n    }\n    else\n    {\n      if (curvatures[i] > bounds[1])\n      {\n        curvatures[i] = bounds[1];\n      }\n    }\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  source->GetPointData()->RemoveArray(curvatureName.c_str());\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\nvtkSmartPointer<vtkPolyData> GetElevations(vtkPolyData* src)\n{\n  double bounds[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};\n  src->GetBounds(bounds);\n  if (std::abs(bounds[2]) < 1.0e-8 && std::abs(bounds[3]) < 1.0e-8)\n  {\n    bounds[3] = bounds[2] + 1;\n  }\n  vtkNew<vtkElevationFilter> elevFilter;\n  elevFilter->SetInputData(src);\n  elevFilter->SetLowPoint(0, bounds[2], 0);\n  elevFilter->SetHighPoint(0, bounds[3], 0);\n  elevFilter->SetScalarRange(bounds[2], bounds[3]);\n  elevFilter->Update();\n\n  return elevFilter->GetPolyDataOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetHills()\n{\n  // Create four hills on a plane.\n  // This will have regions of negative, zero and positive Gsaussian curvatures.\n\n  auto xRes = 50;\n  auto yRes = 50;\n  auto xMin = -5.0;\n  auto xMax = 5.0;\n  auto dx = (xMax - xMin) / (xRes - 1.0);\n  auto yMin = -5.0;\n  auto yMax = 5.0;\n  auto dy = (yMax - yMin) / (xRes - 1.0);\n\n  // Make a grid.\n  vtkNew<vtkPoints> points;\n  for (auto i = 0; i < xRes; ++i)\n  {\n    auto x = xMin + i * dx;\n    for (auto j = 0; j < yRes; ++j)\n    {\n      auto y = yMin + j * dy;\n      points->InsertNextPoint(x, y, 0);\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> plane;\n  plane->SetPoints(points);\n\n  // Triangulate the grid.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(plane);\n  delaunay->Update();\n\n  auto polydata = delaunay->GetOutput();\n\n  vtkNew<vtkDoubleArray> elevation;\n  elevation->SetNumberOfTuples(points->GetNumberOfPoints());\n\n  //  We define the parameters for the hills here.\n  // [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n  std::vector<std::array<double, 5>> hd{{-2.5, -2.5, 2.5, 6.5, 3.5},\n                                        {2.5, 2.5, 2.5, 2.5, 2},\n                                        {5.0, -2.5, 1.5, 1.5, 2.5},\n                                        {-5.0, 5, 2.5, 3.0, 3}};\n  std::array<double, 2> xx{0.0, 0.0};\n  for (auto i = 0; i < points->GetNumberOfPoints(); ++i)\n  {\n    auto x = polydata->GetPoint(i);\n    for (size_t j = 0; j < hd.size(); ++j)\n    {\n      xx[0] = std::pow(x[0] - hd[j][0] / hd[j][2], 2.0);\n      xx[1] = std::pow(x[1] - hd[j][1] / hd[j][3], 2.0);\n      x[2] += hd[j][4] * std::exp(-(xx[0] + xx[1]) / 2.0);\n    }\n    polydata->GetPoints()->SetPoint(i, x);\n    elevation->SetValue(i, x[2]);\n  }\n\n  vtkNew<vtkFloatArray> textures;\n  textures->SetNumberOfComponents(2);\n  textures->SetNumberOfTuples(2 * polydata->GetNumberOfPoints());\n  textures->SetName(\"Textures\");\n\n  for (auto i = 0; i < xRes; ++i)\n  {\n    float tc[2];\n    tc[0] = i / (xRes - 1.0);\n    for (auto j = 0; j < yRes; ++j)\n    {\n      // tc[1] = 1.0 - j / (yRes - 1.0);\n      tc[1] = j / (yRes - 1.0);\n      textures->SetTuple(static_cast<vtkIdType>(i) * yRes + j, tc);\n    }\n  }\n\n  polydata->GetPointData()->SetScalars(elevation);\n  polydata->GetPointData()->GetScalars()->SetName(\"Elevation\");\n  polydata->GetPointData()->SetTCoords(textures);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(polydata);\n  normals->SetInputData(polydata);\n  normals->SetFeatureAngle(30);\n  normals->SplittingOff();\n\n  vtkNew<vtkTransform> tr1;\n  tr1->RotateX(-90);\n\n  vtkNew<vtkTransformPolyDataFilter> tf1;\n  tf1->SetInputConnection(normals->GetOutputPort());\n  tf1->SetTransform(tr1);\n  tf1->Update();\n\n  return tf1->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetParametricHills()\n{\n  vtkNew<vtkParametricRandomHills> fn;\n  fn->AllowRandomGenerationOn();\n  fn->SetRandomSeed(1);\n  fn->SetNumberOfHills(30);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetParametricFunction(fn);\n  source->SetUResolution(50);\n  source->SetVResolution(50);\n  source->SetScalarModeToZ();\n  source->Update();\n\n  // Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n  // source->GetOutput()->GetPointData()->GetNormals()->SetName(\"Normals\");\n  // source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Scalars\");\n  // Rename the scalars to \"Elevation\" since we are using the Z-scalars as\n  // elevations.\n  source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Elevation\");\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetParametricTorus()\n{\n  vtkNew<vtkParametricTorus> fn;\n  fn->SetRingRadius(5);\n  fn->SetCrossSectionRadius(2);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetParametricFunction(fn);\n  source->SetUResolution(50);\n  source->SetVResolution(50);\n  source->SetScalarModeToZ();\n  source->Update();\n\n  // Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n  // source->GetOutput()->GetPointData()->GetNormals()->SetName(\"Normals\");\n  // source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Scalars\");\n  // Rename the scalars to \"Elevation\" since we are using the Z-scalars as\n  // elevations.\n  source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Elevation\");\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetPlane()\n{\n  vtkNew<vtkPlaneSource> source;\n  source->SetOrigin(-10.0, -10.0, 0.0);\n  source->SetPoint2(-10.0, 10.0, 0.0);\n  source->SetPoint1(10.0, -10.0, 0.0);\n  source->SetXResolution(20);\n  source->SetYResolution(20);\n  source->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 0.0, 0.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  // We have a m x n array of quadrilaterals arranged as a regular tiling in a\n  // plane. So pass it through a triangle filter since the curvature filter only\n  // operates on polys.\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(transformFilter->GetOutputPort());\n\n  // Pass it though a CleanPolyDataFilter and merge any points which\n  // are coincident, or very close\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  return cleaner->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  vtkNew<vtkSphereSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetRadius(10.0);\n  source->SetThetaResolution(32);\n  source->SetPhiResolution(32);\n  source->Update();\n\n  return source->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  vtkNew<vtkSuperquadricSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetCenter(1.0, 1.0, 1.0);\n  source->SetPhiResolution(64);\n  source->SetThetaResolution(64);\n  source->SetThetaRoundness(1);\n  source->SetThickness(0.5);\n  source->SetSize(10);\n  source->SetToroidal(1);\n  source->Update();\n\n  // The quadric is made of strips, so pass it through a triangle filter as\n  // the curvature filter only operates on polys\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(source->GetOutputPort());\n\n  // The quadric has nasty discontinuities from the way the edges are generated\n  // so let's pass it though a CleanPolyDataFilter and merge any points which\n  // are coincident, or very close\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  return cleaner->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& source)\n{\n  std::string surface = source;\n  std::transform(surface.begin(), surface.end(), surface.begin(),\n                 [](unsigned char c) { return std::tolower(c); });\n  std::map<std::string, int> available_surfaces = {\n      {\"hills\", 0},       {\"parametrictorus\", 1}, {\"plane\", 2},\n      {\"randomhills\", 3}, {\"sphere\", 4},          {\"torus\", 5}};\n  if (available_surfaces.find(surface) == available_surfaces.end())\n  {\n    std::cout << \"The surface is not available.\" << std::endl;\n    std::cout << \"Using RandomHills instead.\" << std::endl;\n    surface = \"randomhills\";\n  }\n  switch (available_surfaces[surface])\n  {\n  case 0:\n    return GetHills();\n    break;\n  case 1:\n    return GetParametricTorus();\n    break;\n  case 2:\n    return GetElevations(GetPlane());\n    break;\n  case 3:\n    return GetParametricHills();\n    break;\n  case 4:\n    return GetElevations(GetSphere());\n    break;\n  case 5:\n    return GetElevations(GetTorus());\n    break;\n  }\n  return GetParametricHills();\n}\n\nvtkSmartPointer<vtkColorSeries> GetColorSeries()\n{\n\n  vtkNew<vtkColorSeries> colorSeries;\n  // Select a color scheme.\n  int colorSeriesEnum;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_BROWN_BLUE_GREEN_9;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_10;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_3;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_PURPLE_ORANGE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_PURPLE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_GREEN_9;\n  colorSeriesEnum = colorSeries->BREWER_QUALITATIVE_SET3;\n  // colorSeriesEnum = colorSeries->CITRUS;\n  colorSeries->SetColorScheme(colorSeriesEnum);\n  return colorSeries;\n}\n\nvtkSmartPointer<vtkLookupTable> GetCategoricalLUT()\n{\n  vtkSmartPointer<vtkColorSeries> colorSeries = GetColorSeries();\n  // Make the lookup table.\n  vtkNew<vtkLookupTable> lut;\n  colorSeries->BuildLookupTable(lut, vtkColorSeries::CATEGORICAL);\n  lut->SetNanColor(0, 0, 0, 1);\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> GetOrdinaLUT()\n{\n  vtkSmartPointer<vtkColorSeries> colorSeries = GetColorSeries();\n  // Make the lookup table.\n  vtkNew<vtkLookupTable> lut;\n  colorSeries->BuildLookupTable(lut, vtkColorSeries::ORDINAL);\n  lut->SetNanColor(0, 0, 0, 1);\n\n  return lut;\n}\n\n// clang-format off\n/**\n * See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n *\n *                   start point         midPoint            end point\n * cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n * purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n * green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n * blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n * green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n *\n */\n// clang-format on\nvtkSmartPointer<vtkLookupTable> GetDivergingLUT()\n{\n\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, 0.085, 0.532, 0.201);\n  ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n  ctf->AddRGBPoint(1.0, 0.758, 0.214, 0.233);\n\n  auto tableSize = 256;\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(static_cast<double>(i) / lut->GetNumberOfColors(),\n                  rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(static_cast<vtkIdType>(i), rgba.data());\n  }\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> ReverseLUT(vtkLookupTable* lut)\n{\n  // First do a deep copy just to get the whole structure\n  // and then reverse the colors and annotations.\n  vtkNew<vtkLookupTable> lutr;\n  lutr->DeepCopy(lut);\n  vtkIdType t = lut->GetNumberOfTableValues() - 1;\n  for (vtkIdType i = t; i >= 0; --i)\n  {\n    std::array<double, 3> rgb{0.0, 0.0, 0.0};\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    lut->GetColor(i, rgb.data());\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    rgba[3] = lut->GetOpacity(i);\n    lutr->SetTableValue(t - i, rgba.data());\n  }\n  t = lut->GetNumberOfAnnotatedValues() - 1;\n  for (vtkIdType i = t; i >= 0; --i)\n  {\n    lutr->SetAnnotation(t - i, lut->GetAnnotation(i));\n  }\n\n  return lutr;\n}\n\nvtkNew<vtkGlyph3D> GetGlyphs(vtkPolyData* src, double const& scaleFactor,\n                             bool const& reverseNormals)\n{\n  // Sometimes the contouring algorithm can create a volume whose gradient\n  // vector and ordering of polygon(using the right hand rule) are\n  // inconsistent. vtkReverseSense cures this problem.\n  vtkNew<vtkReverseSense> reverse;\n  vtkNew<vtkMaskPoints> maskPts;\n  maskPts->SetOnRatio(5);\n  maskPts->RandomModeOn();\n  if (reverseNormals)\n  {\n    reverse->SetInputData(src);\n    reverse->ReverseCellsOn();\n    reverse->ReverseNormalsOn();\n    maskPts->SetInputConnection(reverse->GetOutputPort());\n  }\n  else\n  {\n    maskPts->SetInputData(src);\n  }\n\n  // Source for the glyph filter\n  vtkNew<vtkArrowSource> arrow;\n  arrow->SetTipResolution(16);\n  arrow->SetTipLength(0.3);\n  arrow->SetTipRadius(0.1);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetSourceConnection(arrow->GetOutputPort());\n  glyph->SetInputConnection(maskPts->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleFactor(scaleFactor);\n  glyph->SetColorModeToColorByVector();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->OrientOn();\n  glyph->Update();\n\n  return glyph;\n}\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision,\n                                            bool const& nearestInteger)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  auto RoundOff = [&prec](const double& x) {\n    auto pow_10 = std::pow(10.0, prec);\n    return std::round(x * pow_10) / pow_10;\n  };\n\n  std::map<int, std::vector<double>> bands;\n  if ((dR[1] < dR[0]) || (numberOfBands <= 0))\n  {\n    return bands;\n  }\n  double x[2];\n  for (int i = 0; i < 2; ++i)\n  {\n    x[i] = dR[i];\n  }\n  if (nearestInteger)\n  {\n    x[0] = std::floor(x[0]);\n    x[1] = std::ceil(x[1]);\n  }\n  double dx = (x[1] - x[0]) / static_cast<double>(numberOfBands);\n  std::vector<double> b;\n  b.push_back(x[0]);\n  b.push_back(x[0] + dx / 2.0);\n  b.push_back(x[0] + dx);\n  for (int i = 0; i < numberOfBands; ++i)\n  {\n    if (i == 0)\n    {\n      for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n      {\n        *p = RoundOff(*p);\n      }\n      b[0] = x[0];\n    }\n    bands[i] = b;\n    for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n    {\n      *p = RoundOff(*p + dx);\n    }\n  }\n  return bands;\n}\n\nstd::map<int, std::vector<double>>\nGetCustomBands(double const dR[2], int const& numberOfBands,\n               std::vector<std::array<double, 2>> const& myBands)\n{\n  std::map<int, std::vector<double>> bands;\n  if ((dR[1] < dR[0]) || (numberOfBands <= 0))\n  {\n    return bands;\n  }\n\n  std::vector<std::array<double, 2>> x;\n  std::copy(myBands.begin(), myBands.end(), std::back_inserter(x));\n\n  // Determine the index of the range minimum and range maximum.\n  int idxMin = 0;\n  for (auto idx = 0; idx < static_cast<int>(myBands.size()); ++idx)\n  {\n    if (dR[0] < myBands[idx][1] && dR[0] >= myBands[idx][0])\n    {\n      idxMin = idx;\n      break;\n    }\n  }\n  int idxMax = static_cast<int>(myBands.size()) - 1;\n  for (int idx = static_cast<int>(myBands.size()) - 1; idx >= 0; --idx)\n  {\n    if (dR[1] < myBands[idx][1] && dR[1] >= myBands[idx][0])\n    {\n      idxMax = static_cast<int>(idx);\n      break;\n    }\n  }\n\n  // Set the minimum to match the range minimum.\n  x[idxMin][0] = dR[0];\n  x[idxMax][1] = dR[1];\n  for (int i = idxMin; i < idxMax + 1; ++i)\n  {\n    std::vector<double> b(3);\n    b[0] = x[i][0];\n    b[1] = x[i][0] + (x[i][1] - x[i][0]) / 2.0;\n    b[2] = x[i][1];\n    bands[i] = b;\n  }\n  return bands;\n}\n\nstd::map<int, std::vector<double>> GetIntegralBands(double const dR[2])\n{\n  std::map<int, std::vector<double>> bands;\n  if (dR[1] < dR[0])\n  {\n    return bands;\n  }\n  double x[2];\n  for (int i = 0; i < 2; ++i)\n  {\n    x[i] = dR[i];\n  }\n  x[0] = std::floor(x[0]);\n  x[1] = std::ceil(x[1]);\n  int numberOfBands = static_cast<int>(std::abs(x[1]) + std::abs(x[0]));\n  return GetBands(x, numberOfBands, false);\n}\n\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src)\n{\n  std::map<int, int> freq;\n  for (auto i = 0; i < static_cast<int>(bands.size()); ++i)\n  {\n    freq[i] = 0;\n  }\n  vtkIdType tuples = src->GetPointData()->GetScalars()->GetNumberOfTuples();\n  for (int i = 0; i < tuples; ++i)\n  {\n    double* x = src->GetPointData()->GetScalars()->GetTuple(i);\n    for (auto j = 0; j < static_cast<int>(bands.size()); ++j)\n    {\n      if (*x <= bands[j][2])\n      {\n        freq[j] = freq[j] + 1;\n        break;\n      }\n    }\n  }\n  return freq;\n}\n\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq)\n{\n  // Get the indices of the first and last non-zero elements.\n  auto first = 0;\n  for (auto i = 0; i < static_cast<int>(freq.size()); ++i)\n  {\n    if (freq[i] != 0)\n    {\n      first = i;\n      break;\n    }\n  }\n  std::vector<int> keys;\n  for (std::map<int, int>::iterator it = freq.begin(); it != freq.end(); ++it)\n  {\n    keys.push_back(it->first);\n  }\n  std::reverse(keys.begin(), keys.end());\n  auto last = keys[0];\n  for (size_t i = 0; i < keys.size(); ++i)\n  {\n    if (freq[keys[i]] != 0)\n    {\n      last = keys[i];\n      break;\n    }\n  }\n  // Now adjust the ranges.\n  std::map<int, int>::iterator freqItr;\n  freqItr = freq.find(first);\n  freq.erase(freq.begin(), freqItr);\n  freqItr = ++freq.find(last);\n  freq.erase(freqItr, freq.end());\n  std::map<int, std::vector<double>>::iterator bandItr;\n  bandItr = bands.find(first);\n  bands.erase(bands.begin(), bandItr);\n  bandItr = ++bands.find(last);\n  bands.erase(bandItr, bands.end());\n  // Reindex freq and bands.\n  std::map<int, int> adjFreq;\n  int idx = 0;\n  for (auto p : freq)\n  {\n    adjFreq[idx] = p.second;\n    ++idx;\n  }\n  std::map<int, std::vector<double>> adjBands;\n  idx = 0;\n  for (auto const& p : bands)\n  {\n    adjBands[idx] = p.second;\n    ++idx;\n  }\n  bands = adjBands;\n  freq = adjFreq;\n}\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  if (bands.size() != freq.size())\n  {\n    std::cout << \"Bands and frequencies must be the same size.\" << std::endl;\n    return;\n  }\n  std::ostringstream os;\n  os << \"Bands & Frequencies:\\n\";\n  size_t idx = 0;\n  auto total = 0;\n  auto width = prec + 6;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    total += freq[p->first];\n    for (std::vector<double>::const_iterator q = p->second.begin();\n         q != p->second.end(); ++q)\n    {\n      if (q == p->second.begin())\n      {\n        os << std::setw(4) << idx << \" [\";\n      }\n      if (q == std::prev(p->second.end()))\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \"]: \" << std::setw(8) << freq[p->first] << \"\\n\";\n      }\n      else\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \", \";\n      }\n    }\n    ++idx;\n  }\n  width = 3 * width + 13;\n  os << std::left << std::setw(width) << \"Total\" << std::right << std::setw(8)\n     << total << std::endl;\n  std::cout << os.str() << endl;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/CurvatureBandsWithGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CurvatureBandsWithGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CurvatureBandsWithGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CurvatureBandsWithGlyphs MACOSX_BUNDLE CurvatureBandsWithGlyphs.cxx )\n  target_link_libraries(CurvatureBandsWithGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CurvatureBandsWithGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CurvatureBandsWithGlyphs/#download-and-build-curvaturebandswithglyphs","title":"Download and Build CurvatureBandsWithGlyphs","text":"

Click here to download CurvatureBandsWithGlyphs and its CMakeLists.txt file. Once the tarball CurvatureBandsWithGlyphs.tar has been downloaded and extracted,

cd CurvatureBandsWithGlyphs/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CurvatureBandsWithGlyphs\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/CurvedReformation/","title":"CurvedReformation","text":"

vtk-examples/Cxx/Visualization/CurvedReformation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/CurvedReformation/#description","title":"Description","text":"

This example makes a curved reformation of a volume. The example requires three parameters:

  1. Input volume
  2. Input polydata that defines a polyline for the reformation. The polyline will be resampled with a cubic spline
  3. Resolution is the result resolution of the reformation.

Note

The image was generated with this volume data: src/Testing/Data/HeadMRVolume.mhd and src/Testing/Data/HeadMRVolume.raw and this polyLine data: src/Testing/Data/polyline.vtk.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/CurvedReformation/#code","title":"Code","text":"

CurvedReformation.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSplineFilter.h>\n#include <vtkWindowLevelLookupTable.h>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> SweepLine(vtkPolyData* line, double direction[3],\n                                       double distance, unsigned int cols);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify arguments\n  if (argc < 4)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputVolume PolyDataInput\"\n              << \" Resolution\" << std::endl;\n    std::cout << \"e.g. HeadMRVolume.mhd polyline.vtk 200\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Parse arguments.\n  std::string volumeFileName = argv[1];\n  std::string polyDataFileName = argv[2];\n  std::stringstream ssResolution;\n  ssResolution << argv[3];\n  unsigned int resolution;\n  ssResolution >> resolution;\n\n  // Output arguments.\n  std::cout << \"InputVolume: \" << volumeFileName << std::endl\n            << \"PolyDataInput: \" << polyDataFileName << std::endl\n            << \"Resolution: \" << resolution << std::endl;\n\n  // Read the volume data.\n  vtkNew<vtkImageReader2Factory> imageFactory;\n  vtkSmartPointer<vtkImageReader2> imageReader;\n  imageReader.TakeReference(\n      imageFactory->CreateImageReader2(volumeFileName.c_str()));\n  imageReader->SetFileName(volumeFileName.c_str());\n  imageReader->Update();\n\n  // Read the Polyline.\n  vtkNew<vtkPolyDataReader> polyLineReader;\n  polyLineReader->SetFileName(polyDataFileName.c_str());\n  polyLineReader->Update();\n\n  vtkNew<vtkSplineFilter> spline;\n  spline->SetInputConnection(polyLineReader->GetOutputPort());\n  spline->SetSubdivideToSpecified();\n  spline->SetNumberOfSubdivisions(resolution);\n\n  // Sweep the line to form a surface.\n  double direction[3];\n  direction[0] = 0.0;\n  direction[1] = 0.0;\n  direction[2] = 1.0;\n  double distance = 164;\n  spline->Update();\n  auto surface =\n      SweepLine(spline->GetOutput(), direction, distance, atoi(argv[3]));\n\n  // Probe the volume with the extruded surface.\n  vtkNew<vtkProbeFilter> sampleVolume;\n  sampleVolume->SetInputConnection(1, imageReader->GetOutputPort());\n  sampleVolume->SetInputData(0, surface);\n\n  // Compute a simple window/level based on scalar range.\n  vtkNew<vtkWindowLevelLookupTable> wlLut;\n  double range = imageReader->GetOutput()->GetScalarRange()[1] -\n      imageReader->GetOutput()->GetScalarRange()[0];\n  double level = (imageReader->GetOutput()->GetScalarRange()[1] +\n                  imageReader->GetOutput()->GetScalarRange()[0]) /\n      2.0;\n  wlLut->SetWindow(range);\n  wlLut->SetLevel(level);\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(sampleVolume->GetOutputPort());\n  mapper->SetLookupTable(wlLut);\n  mapper->SetScalarRange(0, 255);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CurvedReformation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Set the camera for viewing medical images.\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->GetActiveCamera()->SetPosition(0, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  renderer->ResetCamera();\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkPolyData> SweepLine(vtkPolyData* line, double direction[3],\n                                       double distance, unsigned int cols)\n{\n  unsigned int rows = line->GetNumberOfPoints();\n  double spacing = distance / cols;\n  vtkNew<vtkPolyData> surface;\n\n  // Generate the points.\n  cols++;\n  unsigned int numberOfPoints = rows * cols;\n  unsigned int numberOfPolys = (rows - 1) * (cols - 1);\n  vtkNew<vtkPoints> points;\n  points->Allocate(numberOfPoints);\n  vtkNew<vtkCellArray> polys;\n  polys->Allocate(numberOfPolys * 4);\n\n  double x[3];\n  unsigned int cnt = 0;\n  for (unsigned int row = 0; row < rows; row++)\n  {\n    for (unsigned int col = 0; col < cols; col++)\n    {\n      double p[3];\n      line->GetPoint(row, p);\n      x[0] = p[0] + direction[0] * col * spacing;\n      x[1] = p[1] + direction[1] * col * spacing;\n      x[2] = p[2] + direction[2] * col * spacing;\n      points->InsertPoint(cnt++, x);\n    }\n  }\n  // Generate the quads.\n  vtkIdType pts[4];\n  for (unsigned int row = 0; row < rows - 1; row++)\n  {\n    for (unsigned int col = 0; col < cols - 1; col++)\n    {\n      pts[0] = col + row * (cols);\n      pts[1] = pts[0] + 1;\n      pts[2] = pts[0] + cols + 1;\n      pts[3] = pts[0] + cols;\n      polys->InsertNextCell(4, pts);\n    }\n  }\n  surface->SetPoints(points);\n  surface->SetPolys(polys);\n\n  return surface;\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/CurvedReformation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CurvedReformation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  IOImage\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CurvedReformation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CurvedReformation MACOSX_BUNDLE CurvedReformation.cxx )\n  target_link_libraries(CurvedReformation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CurvedReformation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/CurvedReformation/#download-and-build-curvedreformation","title":"Download and Build CurvedReformation","text":"

Click here to download CurvedReformation and its CMakeLists.txt file. Once the tarball CurvedReformation.tar has been downloaded and extracted,

cd CurvedReformation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CurvedReformation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/DepthSortPolyData/","title":"DepthSortPolyData","text":"

vtk-examples/Cxx/Visualization/DepthSortPolyData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/DepthSortPolyData/#description","title":"Description","text":"
  • Contributed by: Lars Friedrich

This is a C++-port of the VTK example '''DepthSort.py''' found in [VTKSourceDir/Examples/VisualizationAlgorithms/Python(https://gitlab.kitware.com/vtk/vtk/blob/master/Examples/VisualizationAlgorithms/Python/DepthSort.py). It was slightly modified. It generates 5 spheres with configurable PHI and THETA resolution. The spheres overlap. Therefore, correct blending and visualization in general requires depth sorting of the underlying polygons which will not happen when simply using a poly data mapper. Depth sorting can be achieved by connecting a vtkDepthSortPolyData filter to the mapper instead of the pure poly data.

"},{"location":"Cxx/Visualization/DepthSortPolyData/#program-usage","title":"Program Usage","text":"
Usage: ./DepthSortPolyData DepthSortFlag ThetaResolution  PhiResolution ScalarVisibilityFlag*\n\nDepthSortFlag ... activate/deactivate the depth sorting algorithm\n\nThetaResolution ... THETA resolution for the spheres\n\nPhiResolution ... PHI resolution for the spheres\n\nScalarVisibilityFlag ... show/hide the found depth values as scalars\n

Example calls:

./DepthSortPolyData 0 100 100 0\n... will render the spheres 'as usual' (without depth sorting); in general you will be confronted with situations (specific view directions) where you cannot determine whether a small sphere is behind or in front of the big center sphere\n
./DepthSortPolyData 1 100 100 0\n... will render the spheres using depth sorting; the sphere depth order should now be visually traceable\n
./DepthSortPolyData 1 100 100 1\n... will render the spheres using depth sorting; the depth values are mapped to the spheres and renderd on the surfaces\n

Using higher PHI/THETA resolutions shows how depth sorting reduces the frame rate.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/DepthSortPolyData/#code","title":"Code","text":"

DepthSortPolyData.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkDepthSortPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc != 5)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" DepthSortFlag ThetaResolution \"\n              << \" PhiResolution ScalarVisibilityFlag\" << std::endl;\n    std::cerr << \"1 100 100 0\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  bool doDepthSort = atoi(argv[1]) == 1;\n  int theta = atoi(argv[2]);\n  int phi = atoi(argv[3]);\n  bool scalarVisibility = atoi(argv[4]) == 1;\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a bunch of spheres that overlap and cannot be easily arranged\n  // so that the blending works without sorting. They are appended into a\n  // single vtkPolyData because the filter only sorts within a single\n  // vtkPolyData input.\n  vtkNew<vtkAppendPolyData> appendData;\n\n  for (int i = 0; i < 5; i++)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(theta);\n    sphereSource->SetPhiResolution(phi);\n    sphereSource->SetRadius(\n        0.5); // all sphere except the center one should have radius = 0.5\n    switch (i)\n    {\n    case 0:\n      sphereSource->SetRadius(1);\n      sphereSource->SetCenter(0, 0, 0);\n      break;\n    case 1:\n      sphereSource->SetCenter(1, 0, 0);\n      break;\n    case 2:\n      sphereSource->SetCenter(-1, 0, 0);\n      break;\n    case 3:\n      sphereSource->SetCenter(0, 1, 0);\n      break;\n    case 4:\n      sphereSource->SetCenter(0, -1, 0);\n      break;\n    }\n    sphereSource->Update();\n    appendData->AddInputConnection(sphereSource->GetOutputPort());\n  }\n\n  // The dephSort object is set up to generate scalars representing\n  // the sort depth.  A camera is assigned for the sorting. The camera\n  // defines the sort vector (position and focal point).\n  vtkNew<vtkCamera> camera;\n  vtkNew<vtkDepthSortPolyData> depthSort;\n\n  depthSort->SetInputConnection(appendData->GetOutputPort());\n  depthSort->SetDirectionToBackToFront();\n  depthSort->SetVector(1, 1, 1);\n  depthSort->SetCamera(camera);\n  depthSort->SortScalarsOn();\n  depthSort->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  if (doDepthSort)\n  {\n    mapper->SetInputConnection(depthSort->GetOutputPort());\n  }\n  else\n  {\n    mapper->SetInputConnection(appendData->GetOutputPort());\n  }\n\n  mapper->SetScalarVisibility(scalarVisibility);\n  if (scalarVisibility)\n  {\n    mapper->SetScalarRange(0, depthSort->GetOutput()->GetNumberOfCells());\n  }\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetOpacity(0.5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Crimson\").GetData());\n  actor->RotateX(-72); // put the object in a position where it is easy\n  // to see different overlapping regions\n\n  // If an Prop3D is supplied, then its transformation matrix is taken\n  // into account during sorting.\n  depthSort->SetProp3D(actor);\n\n  // Create the RenderWindow, Renderer and both Actors\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetActiveCamera(camera);\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DepthSortPolyData\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->SetSize(600, 400);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(2.2); // so the object is larger\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/DepthSortPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DepthSortPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersHybrid\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DepthSortPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DepthSortPolyData MACOSX_BUNDLE DepthSortPolyData.cxx )\n  target_link_libraries(DepthSortPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DepthSortPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/DepthSortPolyData/#download-and-build-depthsortpolydata","title":"Download and Build DepthSortPolyData","text":"

Click here to download DepthSortPolyData and its CMakeLists.txt file. Once the tarball DepthSortPolyData.tar has been downloaded and extracted,

cd DepthSortPolyData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DepthSortPolyData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/DisplayCoordinateAxes/","title":"DisplayCoordinateAxes","text":"

vtk-examples/Cxx/Visualization/DisplayCoordinateAxes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/DisplayCoordinateAxes/#description","title":"Description","text":"

This example shows how to display the coordinate axes in the render window.

Seealso

Axes.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/DisplayCoordinateAxes/#code","title":"Code","text":"

DisplayCoordinateAxes.cxx

#include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n  sphereSource->Update();\n\n  vtkPolyData* polydata = sphereSource->GetOutput();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  // Create an actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"DisplayCoordinateAxes\");\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkAxesActor> axes;\n\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  double rgba[4]{0.0, 0.0, 0.0, 0.0};\n  colors->GetColor(\"Carrot\", rgba);\n  widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n  widget->SetOrientationMarker(axes);\n  widget->SetInteractor(renderWindowInteractor);\n  widget->SetViewport(0.0, 0.0, 0.4, 0.4);\n  widget->SetEnabled(1);\n  widget->InteractiveOn();\n\n  renderer->GetActiveCamera()->Azimuth(50);\n  renderer->GetActiveCamera()->Elevation(-30);\n\n  renderer->ResetCamera();\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/DisplayCoordinateAxes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DisplayCoordinateAxes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DisplayCoordinateAxes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DisplayCoordinateAxes MACOSX_BUNDLE DisplayCoordinateAxes.cxx )\n  target_link_libraries(DisplayCoordinateAxes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DisplayCoordinateAxes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/DisplayCoordinateAxes/#download-and-build-displaycoordinateaxes","title":"Download and Build DisplayCoordinateAxes","text":"

Click here to download DisplayCoordinateAxes and its CMakeLists.txt file. Once the tarball DisplayCoordinateAxes.tar has been downloaded and extracted,

cd DisplayCoordinateAxes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DisplayCoordinateAxes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/DisplayQuadricSurfaces/","title":"DisplayQuadricSurfaces","text":"

vtk-examples/Cxx/Visualization/DisplayQuadricSurfaces

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/DisplayQuadricSurfaces/#description","title":"Description","text":"

This example demonstrates how to display several types of quadric surfaces.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/DisplayQuadricSurfaces/#code","title":"Code","text":"

DisplayQuadricSurfaces.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\nnamespace {\nvoid Other();\nvoid Sphere();\nvoid Cone();\nvoid Ellipsoid();\nvoid Cylinder();\nvoid HyperboloidOneSheet();\nvoid HyperboloidTwoSheets();\nvoid HyperbolicParaboloid();\nvoid EllipticParaboloid();\n\nvoid PlotFunction(vtkQuadric* quadric, double value);\n} // namespace\n\nint main(int, char*[])\n{\n  // Other();\n  // Sphere();\n  // Cone();\n  // Ellipsoid();\n  // Cylinder();\n  // HyperboloidOneSheet();\n  // HyperboloidTwoSheets();\n  // HyperbolicParaboloid();\n  EllipticParaboloid();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid Sphere()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, 1, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2 + 1*z^2\n\n  PlotFunction(quadric, 1.0);\n}\n\nvoid EllipticParaboloid()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, 0, 0, 0, 0, 0, 0, -1, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2\n\n  PlotFunction(quadric, 10.0);\n}\n\nvoid HyperbolicParaboloid()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, -1, 0, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 - 1*y^2\n\n  PlotFunction(quadric, 10.0);\n}\n\nvoid Cylinder()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, 0, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2\n\n  PlotFunction(quadric, 1.0);\n}\n\nvoid HyperboloidOneSheet()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2\n\n  PlotFunction(quadric, 1.0);\n}\n\nvoid HyperboloidTwoSheets()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2\n\n  PlotFunction(quadric, -1.0);\n}\n\nvoid Ellipsoid()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, 2, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2 + 1*z^2\n\n  PlotFunction(quadric, -1.0);\n}\n\nvoid Cone()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2 - 1*z^2\n  PlotFunction(quadric, 0.0);\n}\n\nvoid Other()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 0.5*x^2 + 1*y^2 + 0.2*z^2 + 0*x*y + 0.1*y*z +\n  // 0*x*z + 0*x + 0.2*y + 0*z + 0\n  PlotFunction(quadric, 1.0);\n}\n\nvoid PlotFunction(vtkQuadric* quadric, double value)\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Sample the quadric function.\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(quadric);\n  // double xmin = 0, xmax=1, ymin=0, ymax=1, zmin=0, zmax=1;\n  double bounds[6]{-10, 11, -10, 10, -10, 10};\n  sample->SetModelBounds(bounds);\n\n  // Create five surfaces F(x,y,z) = constant between range specified.\n  /*\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(5, 0.0, 1.2);\n  */\n\n  // Create the 0 isosurface.\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(1, value, value);\n\n  // Map the contours to graphical primitives.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contours->GetOutputPort());\n  contourMapper->SetScalarRange(0.0, 1.2);\n\n  // Create an actor for the contours.\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n\n  // -- create a box around the function to indicate the sampling volume --\n\n  // Create outline.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(sample->GetOutputPort());\n\n  // Map it to graphics primitives.\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  // Create an actor for it.\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Setup the window.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"DisplayQuadricSurfaces\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the scene.\n  ren1->AddActor(contourActor);\n  ren1->AddActor(outlineActor);\n  ren1->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n\n  // Render and interact.\n  renWin->Render();\n  ren1->GetActiveCamera()->Azimuth(-55);\n  ren1->GetActiveCamera()->Elevation(15);\n  iren->Start();\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/DisplayQuadricSurfaces/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DisplayQuadricSurfaces)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DisplayQuadricSurfaces: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DisplayQuadricSurfaces MACOSX_BUNDLE DisplayQuadricSurfaces.cxx )\n  target_link_libraries(DisplayQuadricSurfaces PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DisplayQuadricSurfaces\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/DisplayQuadricSurfaces/#download-and-build-displayquadricsurfaces","title":"Download and Build DisplayQuadricSurfaces","text":"

Click here to download DisplayQuadricSurfaces and its CMakeLists.txt file. Once the tarball DisplayQuadricSurfaces.tar has been downloaded and extracted,

cd DisplayQuadricSurfaces/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DisplayQuadricSurfaces\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/DistanceToCamera/","title":"DistanceToCamera","text":"

vtk-examples/Cxx/Visualization/DistanceToCamera

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/DistanceToCamera/#description","title":"Description","text":"

This example produces two arrows whose scale stays fixed with respect to the distance from the camera (i.e. as you zoom in and out). Standard spheres are drawn for comparison.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/DistanceToCamera/#code","title":"Code","text":"

DistanceToCamera.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkDistanceToCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //---------------------------------------------------------------------------\n  // Draw some arrows that maintain a fixed size during zooming.\n\n  // Create a set of points.\n  vtkNew<vtkPointSource> fixedPointSource;\n  fixedPointSource->SetNumberOfPoints(2);\n\n  // Calculate the distance to the camera of each point.\n  vtkNew<vtkDistanceToCamera> distanceToCamera;\n  distanceToCamera->SetInputConnection(fixedPointSource->GetOutputPort());\n  distanceToCamera->SetScreenSize(100.0);\n\n  // Glyph each point with an arrow.\n  vtkNew<vtkArrowSource> arrow;\n  vtkNew<vtkGlyph3D> fixedGlyph;\n  fixedGlyph->SetInputConnection(distanceToCamera->GetOutputPort());\n  fixedGlyph->SetSourceConnection(arrow->GetOutputPort());\n\n  // Scale each point.\n  fixedGlyph->SetScaleModeToScaleByScalar();\n  fixedGlyph->SetInputArrayToProcess(\n      0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, \"DistanceToCamera\");\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> fixedMapper;\n  fixedMapper->SetInputConnection(fixedGlyph->GetOutputPort());\n  fixedMapper->SetScalarVisibility(false);\n\n  // Create an actor.\n  vtkNew<vtkActor> fixedActor;\n  fixedActor->SetMapper(fixedMapper);\n  fixedActor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  //---------------------------------------------------------------------------\n  // Draw some spheres that get bigger when zooming in.\n  // Create a set of points.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(4);\n\n  // Glyph each point with a sphere.\n  vtkNew<vtkSphereSource> sphere;\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(pointSource->GetOutputPort());\n  glyph->SetSourceConnection(sphere->GetOutputPort());\n  glyph->SetScaleFactor(0.1);\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph->GetOutputPort());\n  mapper->SetScalarVisibility(false);\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  //---------------------------------------------------------------------------\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DistanceToCamera\");\n\n  // Give DistanceToCamera a pointer to the renderer.\n  distanceToCamera->SetRenderer(renderer);\n\n  // Add the actors to the scene.\n  renderer->AddActor(fixedActor);\n  renderer->AddActor(actor);\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/DistanceToCamera/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DistanceToCamera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DistanceToCamera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DistanceToCamera MACOSX_BUNDLE DistanceToCamera.cxx )\n  target_link_libraries(DistanceToCamera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DistanceToCamera\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/DistanceToCamera/#download-and-build-distancetocamera","title":"Download and Build DistanceToCamera","text":"

Click here to download DistanceToCamera and its CMakeLists.txt file. Once the tarball DistanceToCamera.tar has been downloaded and extracted,

cd DistanceToCamera/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DistanceToCamera\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/DrawText/","title":"DrawText","text":"

vtk-examples/Cxx/Visualization/DrawText

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/DrawText/#description","title":"Description","text":"

This example writes \"Hello world\" in the bottom left corner of the render window. The text size and color are set. There are many properties that can be set that control how the text is changed when the render window is resized, but they are not covered in this example.

This example draws text in 2D. For an example using 3D text that can be placed on the scene like a regular vtkActor, see VectorText. For an example of drawing text, also in 2D, but into a vtkImageData object rather than into the render window, see ImageText.

Seealso

TextWidget

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/DrawText/#code","title":"Code","text":"

DrawText.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(sphereSource->GetOutput());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer.\n  vtkNew<vtkRenderer> renderer;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Create a render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DrawText\");\n\n  // Create an interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Setup the text and add it to the renderer.\n  vtkNew<vtkTextActor> textActor;\n  textActor->SetInput(\"Hello world\");\n  textActor->SetPosition2(10, 40);\n  textActor->GetTextProperty()->SetFontSize(24);\n  textActor->GetTextProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  renderer->AddActor2D(textActor);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/DrawText/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DrawText)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DrawText: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DrawText MACOSX_BUNDLE DrawText.cxx )\n  target_link_libraries(DrawText PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DrawText\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/DrawText/#download-and-build-drawtext","title":"Download and Build DrawText","text":"

Click here to download DrawText and its CMakeLists.txt file. Once the tarball DrawText.tar has been downloaded and extracted,

cd DrawText/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DrawText\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/EdgePoints/","title":"EdgePoints","text":"

vtk-examples/Cxx/Visualization/EdgePoints

"},{"location":"Cxx/Visualization/EdgePoints/#description","title":"Description","text":"

This example uses vtkEdgePoints to generat a set of points that lie on an isosurface. Points are generated along the edges of cells that starddle the given iso value. Unlike vtkMarchingCubes it does not generate normals at the points.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/EdgePoints/#code","title":"Code","text":"

EdgePoints.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkEdgePoints.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd e.g. mhd 500\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  double isoValue = 0.0;\n  if (argc > 2)\n  {\n    isoValue = std::stod(std::string(argv[2]));\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> isoColor{{255, 125, 64}};\n  colors->SetColor(\"IsoColor\", isoColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aRenderer);\n  renWin->SetWindowName(\"EdgePoints\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkEdgePoints> isoExtractor;\n  isoExtractor->SetInputConnection(reader->GetOutputPort());\n  isoExtractor->SetValue(isoValue);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(isoExtractor->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> iso;\n  iso->SetMapper(isoMapper);\n  iso->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Bisque\").GetData());\n\n  // An outline provides context around the data.\n  //\n  vtkNew<vtkOutlineFilter> outlineData;\n  outlineData->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outlineData->GetOutputPort());\n\n  vtkNew<vtkActor> outline;\n  outline->SetMapper(mapOutline);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // It is convenient to create an initial view of the data. The FocalPoint\n  // and Position form a vector direction. Later on (ResetCamera() method)\n  // this vector is used to position the camera to look at the data in\n  // this direction.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n\n  // Actors are added to the renderer. An initial camera view is created.\n  // The Dolly() method moves the camera towards the FocalPoint,\n  // thereby enlarging the image.\n  aRenderer->AddActor(outline);\n  aRenderer->AddActor(iso);\n  aRenderer->SetActiveCamera(aCamera);\n  aRenderer->ResetCamera();\n  aCamera->Dolly(1.1);\n\n  // Set a background color for the renderer and set the size of the\n  // render window (expressed in pixels).\n  aRenderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renWin->SetSize(640, 480);\n\n  // Note that when camera movement occurs (as it does in the Dolly()\n  // method), the clipping planes often need adjusting. Clipping planes\n  // consist of two planes: near and far along the view direction. The\n  // near plane clips out objects in front of the plane; the far plane\n  // clips out objects behind the plane. This way only what is drawn\n  // between the planes is actually rendered.\n  aRenderer->ResetCameraClippingRange();\n\n  // Initialize the event loop and then start it.\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/EdgePoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EdgePoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersModeling\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EdgePoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EdgePoints MACOSX_BUNDLE EdgePoints.cxx )\n  target_link_libraries(EdgePoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EdgePoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/EdgePoints/#download-and-build-edgepoints","title":"Download and Build EdgePoints","text":"

Click here to download EdgePoints and its CMakeLists.txt file. Once the tarball EdgePoints.tar has been downloaded and extracted,

cd EdgePoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./EdgePoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ElevationBandsWithGlyphs/","title":"ElevationBandsWithGlyphs","text":"

vtk-examples/Cxx/Visualization/ElevationBandsWithGlyphs

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ElevationBandsWithGlyphs/#description","title":"Description","text":"

In this example we are coloring the surface by partitioning the elevation into bands and using arrows to display the normals on the surface.

Rather beautiful surfaces are generated.

The banded contour filter and an indexed lookup table are used along with the elevation filter to generate the banding on the surface. To further enhance the surface, the surface normals are glyphed and colored by elevation using an ordinal lookup table.

Feel free to experiment with different color schemes and/or the other sources from the parametric function group or a cone etc.

You will usually need to adjust the parameters for maskPts, arrow and glyph for a nice appearance. Do this in the function MakeGlyphs().

You may also need to add an elevation filter to generate the scalars as demonstrated in MakeSphere().

PrintBandsFrequencies() allows you to inspect the bands and the number of scalars in each band. This are useful if you want to get an idea of the distribution of the scalars in each band.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ElevationBandsWithGlyphs/#code","title":"Code","text":"

ElevationBandsWithGlyphs.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkColorSeries.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkDelaunay2D.h>\n#include <vtkDoubleArray.h>\n#include <vtkElevationFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkReverseSense.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVariant.h>\n#include <vtkVariantArray.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\n#include <algorithm>\n#include <array>\n#include <cctype>\n#include <cmath>\n#include <cstdlib>\n#include <cstring>\n#include <functional>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <numeric>\n#include <set>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n//! Generate elevations over the surface.\n/*!\n@param src - the vtkPolyData source.\n@return elev - the elevations.\n*/\nvtkSmartPointer<vtkPolyData> GetElevations(vtkPolyData* src);\n\nvtkSmartPointer<vtkPolyData> GetHills();\nvtkSmartPointer<vtkPolyData> GetParametricHills();\nvtkSmartPointer<vtkPolyData> GetParametricTorus();\nvtkSmartPointer<vtkPolyData> GetPlane();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetTorus();\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& source);\n\nvtkSmartPointer<vtkColorSeries> GetColorSeries();\n\nvtkSmartPointer<vtkLookupTable> GetCategoricalLUT();\n\nvtkSmartPointer<vtkLookupTable> GetOrdinaLUT();\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLUT();\n\nvtkSmartPointer<vtkLookupTable> ReverseLUT(vtkLookupTable* lut);\n\n//!  Glyph the normals on the surface.\n/*!\n@param src - the vtkPolyData source.\n#param scaleFactor - the scale factor for the glyphs.\n@param reverseNormals - if True the normals on the surface are reversed.\n@return The glyphs.\n*/\nvtkNew<vtkGlyph3D> GetGlyphs(vtkPolyData* src, double const& scaleFactor = 1.0,\n                             bool const& reverseNormals = false);\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision = 2,\n                                            bool const& nearestInteger = false);\n\n//! Divide a range into custom bands\n/*!\nYou need to specify each band as an array [r1, r2] where r1 < r2 and\nappend these to a vector.\nThe vector should ultimately look\nlike this: [[r1, r2], [r2, r3], [r3, r4]...]\n\n@param dR - [min, max] the range that is to be covered by the bands.\n@param numberOfBands - the number of bands, a positive integer.\n@param myBands - the bands.\n@return  A map consisting of the band inxex and [min, midpoint, max] for each\nband.\n*/\nstd::map<int, std::vector<double>>\nGetCustomBands(double const dR[2], int const& numberOfBands,\n               std::vector<std::array<double, 2>> const& myBands);\n\n//! Divide a range into integral bands\n/*!\nDivide a range into bands\n@param dR - [min, max] the range that is to be covered by the bands.\n@returnA map consisting of the band inxex and [min, midpoint, max] for each\nband.\n*/\nstd::map<int, std::vector<double>> GetIntegralBands(double const dR[2]);\n\n//! Count the number of scalars in each band.\n/*\n * The scalars used are the active scalars in the polydata.\n *\n * @param bands - the bands.\n * @param src - the vtkPolyData source.\n * @return The frequencies of the scalars in each band.\n */\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src);\n//!\n/*\n * The bands and frequencies are adjusted so that the first and last\n *  frequencies in the range are non-zero.\n * @param bands: The bands.\n * @param freq: The frequencies.\n */\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq);\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision = 2);\n\n} // namespace\n\nint main(int, char*[])\n{\n  // Get the surface\n  std::string desiredSurface{\"RandomHills\"};\n  // desiredSurface = \"Hills\";\n  // desiredSurface = \"ParametricTorus\";\n  // desiredSurface = \"Plane\";\n  // desiredSurface = \"RandomHills\";\n  // desiredSurface = \"Sphere\";\n  // desiredSurface = \"Torus\";\n  auto source = GetSource(desiredSurface);\n\n  // The length of the normal arrow glyphs.\n  auto scaleFactor = 1.0;\n  if (desiredSurface == \"Hills\")\n  {\n    scaleFactor = 0.5;\n  }\n  if (desiredSurface == \"Sphere\")\n  {\n    scaleFactor = 2.0;\n  }\n  std::cout << desiredSurface << std::endl;\n\n  source->GetPointData()->SetActiveScalars(\"Elevation\");\n  auto scalarRange =\n      source->GetPointData()->GetScalars(\"Elevation\")->GetRange();\n\n  auto lut = GetCategoricalLUT();\n  auto lut1 = GetOrdinaLUT();\n  lut->SetTableRange(scalarRange);\n  lut1->SetTableRange(scalarRange);\n  vtkIdType numberOfBands = lut->GetNumberOfTableValues();\n  auto precision = 10;\n  auto bands = GetBands(scalarRange, numberOfBands, precision, false);\n\n  if (desiredSurface == \"RandomHills\")\n  {\n    // These are my custom bands.\n    // Generated by first running:\n    // bands = GetBands(scalarRange, numberOfBands, precision, false);\n    // then:\n    //  std::vector<int> freq = Frequencies(bands, source);\n    //  PrintBandsFrequencies(bands, freq);\n    // Finally using the output to create this table:\n    std::vector<std::array<double, 2>> myBands = {\n        {0, 1.0},   {1.0, 2.0}, {2.0, 3.0}, {3.0, 4.0},\n        {4.0, 5.0}, {5.0, 6.0}, {6.0, 7.0}, {7.0, 8.0}};\n    // Comment this out if you want to see how allocating\n    // equally spaced bands works.\n    bands = GetCustomBands(scalarRange, numberOfBands, myBands);\n    // bands = GetBands(scalarRange, numberOfBands, precision, false);\n    // Adjust the number of table values\n  }\n  lut->SetNumberOfTableValues(static_cast<vtkIdType>(bands.size()));\n  lut1->SetNumberOfTableValues(static_cast<vtkIdType>(bands.size()));\n\n  // Let's do a frequency table.\n  auto freq = GetFrequencies(bands, source);\n  AdjustFrequencyRanges(bands, freq);\n  PrintBandsFrequencies(bands, freq);\n\n  scalarRange[0] = bands.begin()->second[0];\n  scalarRange[1] = std::prev(bands.end())->second[2];\n  lut->SetTableRange(scalarRange);\n  lut->SetNumberOfTableValues(bands.size());\n\n  // We will use the midpoint of the band as the label.\n  std::vector<std::string> labels;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    std::ostringstream os;\n    os << std::fixed << std::setw(6) << std::setprecision(2) << p->second[1];\n    labels.push_back(os.str());\n  }\n\n  // Annotate\n  vtkNew<vtkVariantArray> values;\n  for (size_t i = 0; i < labels.size(); ++i)\n  {\n    values->InsertNextValue(vtkVariant(labels[i]));\n  }\n  for (vtkIdType i = 0; i < values->GetNumberOfTuples(); ++i)\n  {\n    lut->SetAnnotation(i, values->GetValue(i).ToString());\n  }\n\n  // Create a lookup table with the colors reversed.\n  auto lutr = ReverseLUT(lut);\n\n  // Create the contour bands.\n  vtkNew<vtkBandedPolyDataContourFilter> bcf;\n  bcf->SetInputData(source);\n  // Use either the minimum or maximum value for each band.\n  int i = 0;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    bcf->SetValue(i, p->second[2]);\n    ++i;\n  }\n  // We will use an indexed lookup table.\n  bcf->SetScalarModeToIndex();\n  bcf->GenerateContourEdgesOn();\n\n  // Generate the glyphs on the original surface.\n  auto glyph = GetGlyphs(source, scaleFactor, false);\n\n  // ------------------------------------------------------------\n  // Create the mappers and actors\n  // ------------------------------------------------------------\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  colors->SetColor(\"BkgColor\",\n                   std::array<unsigned char, 4>{179, 204, 255, 255}.data());\n  colors->SetColor(\"ParaViewBkg\",\n                   std::array<unsigned char, 4>{82, 87, 110, 255}.data());\n\n  vtkNew<vtkPolyDataMapper> srcMapper;\n  srcMapper->SetInputConnection(bcf->GetOutputPort());\n  srcMapper->SetScalarRange(scalarRange);\n  srcMapper->SetLookupTable(lut);\n  srcMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> srcActor;\n  srcActor->SetMapper(srcMapper);\n\n  // Create contour edges\n  vtkNew<vtkPolyDataMapper> edgeMapper;\n  edgeMapper->SetInputData(bcf->GetContourEdgesOutput());\n  edgeMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(edgeMapper);\n  edgeActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyph->GetOutputPort());\n  glyphMapper->SetScalarModeToUsePointFieldData();\n  glyphMapper->SetColorModeToMapScalars();\n  glyphMapper->ScalarVisibilityOn();\n  glyphMapper->SelectColorArray(\"Elevation\");\n  // Colour by scalars.\n  glyphMapper->SetLookupTable(lut1);\n  glyphMapper->SetScalarRange(scalarRange);\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyphMapper);\n\n  auto windowWidth = 800;\n  auto windowHeight = 800;\n\n  // Add scalar bars.\n  vtkNew<vtkScalarBarActor> scalarBar;\n  // This LUT puts the lowest value at the top of the scalar bar.\n  // scalarBar->SetLookupTable(lut);\n  // Use this LUT if you want the highest value at the top.\n  scalarBar->SetLookupTable(lutr);\n  scalarBar->SetTitle(\"Elevation\");\n  scalarBar->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->GetAnnotationTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->UnconstrainedFontSizeOn();\n  scalarBar->SetMaximumWidthInPixels(windowWidth / 8);\n  scalarBar->SetMaximumHeightInPixels(windowHeight / 3);\n  scalarBar->SetPosition(0.85, 0.05);\n\n  // ------------------------------------------------------------\n  // Create the RenderWindow, Renderer and Interactor\n  // ------------------------------------------------------------\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  renWin->AddRenderer(ren);\n  // Important: The interactor must be set prior to enabling the widget.\n  iren->SetRenderWindow(renWin);\n#ifdef HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(ren);\n  // Enable the widget.\n  camOrientManipulator->On();\n#endif\n\n  // add actors\n  ren->AddViewProp(srcActor);\n  ren->AddViewProp(edgeActor);\n  ren->AddViewProp(glyphActor);\n  ren->AddActor2D(scalarBar);\n\n  ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n  renWin->SetSize(windowWidth, windowHeight);\n  renWin->SetWindowName(\"ElevationBandsWithGlyphs\");\n\n  if (desiredSurface == \"RandomHills\")\n  {\n    auto camera = ren->GetActiveCamera();\n    camera->SetPosition(10.9299, 59.1505, 24.9823);\n    camera->SetFocalPoint(2.21692, 7.97545, 7.75135);\n    camera->SetViewUp(-0.230136, 0.345504, -0.909761);\n    camera->SetDistance(54.6966);\n    camera->SetClippingRange(36.3006, 77.9852);\n    renWin->Render();\n  }\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> GetElevations(vtkPolyData* src)\n{\n  double bounds[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};\n  src->GetBounds(bounds);\n  if (std::abs(bounds[2]) < 1.0e-8 && std::abs(bounds[3]) < 1.0e-8)\n  {\n    bounds[3] = bounds[2] + 1;\n  }\n  vtkNew<vtkElevationFilter> elevFilter;\n  elevFilter->SetInputData(src);\n  elevFilter->SetLowPoint(0, bounds[2], 0);\n  elevFilter->SetHighPoint(0, bounds[3], 0);\n  elevFilter->SetScalarRange(bounds[2], bounds[3]);\n  elevFilter->Update();\n\n  return elevFilter->GetPolyDataOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetHills()\n{\n  // Create four hills on a plane.\n  // This will have regions of negative, zero and positive Gsaussian curvatures.\n\n  auto xRes = 50;\n  auto yRes = 50;\n  auto xMin = -5.0;\n  auto xMax = 5.0;\n  auto dx = (xMax - xMin) / (xRes - 1.0);\n  auto yMin = -5.0;\n  auto yMax = 5.0;\n  auto dy = (yMax - yMin) / (xRes - 1.0);\n\n  // Make a grid.\n  vtkNew<vtkPoints> points;\n  for (auto i = 0; i < xRes; ++i)\n  {\n    auto x = xMin + i * dx;\n    for (auto j = 0; j < yRes; ++j)\n    {\n      auto y = yMin + j * dy;\n      points->InsertNextPoint(x, y, 0);\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> plane;\n  plane->SetPoints(points);\n\n  // Triangulate the grid.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(plane);\n  delaunay->Update();\n\n  auto polydata = delaunay->GetOutput();\n\n  vtkNew<vtkDoubleArray> elevation;\n  elevation->SetNumberOfTuples(points->GetNumberOfPoints());\n\n  //  We define the parameters for the hills here.\n  // [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n  std::vector<std::array<double, 5>> hd{{-2.5, -2.5, 2.5, 6.5, 3.5},\n                                        {2.5, 2.5, 2.5, 2.5, 2},\n                                        {5.0, -2.5, 1.5, 1.5, 2.5},\n                                        {-5.0, 5, 2.5, 3.0, 3}};\n  std::array<double, 2> xx{0.0, 0.0};\n  for (auto i = 0; i < points->GetNumberOfPoints(); ++i)\n  {\n    auto x = polydata->GetPoint(i);\n    for (size_t j = 0; j < hd.size(); ++j)\n    {\n      xx[0] = std::pow(x[0] - hd[j][0] / hd[j][2], 2.0);\n      xx[1] = std::pow(x[1] - hd[j][1] / hd[j][3], 2.0);\n      x[2] += hd[j][4] * std::exp(-(xx[0] + xx[1]) / 2.0);\n    }\n    polydata->GetPoints()->SetPoint(i, x);\n    elevation->SetValue(i, x[2]);\n  }\n\n  vtkNew<vtkFloatArray> textures;\n  textures->SetNumberOfComponents(2);\n  textures->SetNumberOfTuples(2 * polydata->GetNumberOfPoints());\n  textures->SetName(\"Textures\");\n\n  for (auto i = 0; i < xRes; ++i)\n  {\n    float tc[2];\n    tc[0] = i / (xRes - 1.0);\n    for (auto j = 0; j < yRes; ++j)\n    {\n      // tc[1] = 1.0 - j / (yRes - 1.0);\n      tc[1] = j / (yRes - 1.0);\n      textures->SetTuple(static_cast<vtkIdType>(i) * yRes + j, tc);\n    }\n  }\n\n  polydata->GetPointData()->SetScalars(elevation);\n  polydata->GetPointData()->GetScalars()->SetName(\"Elevation\");\n  polydata->GetPointData()->SetTCoords(textures);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(polydata);\n  normals->SetInputData(polydata);\n  normals->SetFeatureAngle(30);\n  normals->SplittingOff();\n\n  vtkNew<vtkTransform> tr1;\n  tr1->RotateX(-90);\n\n  vtkNew<vtkTransformPolyDataFilter> tf1;\n  tf1->SetInputConnection(normals->GetOutputPort());\n  tf1->SetTransform(tr1);\n  tf1->Update();\n\n  return tf1->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetParametricHills()\n{\n  vtkNew<vtkParametricRandomHills> fn;\n  fn->AllowRandomGenerationOn();\n  fn->SetRandomSeed(1);\n  fn->SetNumberOfHills(30);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetParametricFunction(fn);\n  source->SetUResolution(50);\n  source->SetVResolution(50);\n  source->SetScalarModeToZ();\n  source->Update();\n\n  // Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n  // source->GetOutput()->GetPointData()->GetNormals()->SetName(\"Normals\");\n  // source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Scalars\");\n  // Rename the scalars to \"Elevation\" since we are using the Z-scalars as\n  // elevations.\n  source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Elevation\");\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetParametricTorus()\n{\n  vtkNew<vtkParametricTorus> fn;\n  fn->SetRingRadius(5);\n  fn->SetCrossSectionRadius(2);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetParametricFunction(fn);\n  source->SetUResolution(50);\n  source->SetVResolution(50);\n  source->SetScalarModeToZ();\n  source->Update();\n\n  // Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n  // source->GetOutput()->GetPointData()->GetNormals()->SetName(\"Normals\");\n  // source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Scalars\");\n  // Rename the scalars to \"Elevation\" since we are using the Z-scalars as\n  // elevations.\n  source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Elevation\");\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetPlane()\n{\n  vtkNew<vtkPlaneSource> source;\n  source->SetOrigin(-10.0, -10.0, 0.0);\n  source->SetPoint2(-10.0, 10.0, 0.0);\n  source->SetPoint1(10.0, -10.0, 0.0);\n  source->SetXResolution(20);\n  source->SetYResolution(20);\n  source->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 0.0, 0.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  // We have a m x n array of quadrilaterals arranged as a regular tiling in a\n  // plane. So pass it through a triangle filter since the curvature filter only\n  // operates on polys.\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(transformFilter->GetOutputPort());\n\n  // Pass it though a CleanPolyDataFilter and merge any points which\n  // are coincident, or very close\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  return cleaner->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  vtkNew<vtkSphereSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetRadius(10.0);\n  source->SetThetaResolution(32);\n  source->SetPhiResolution(32);\n  source->Update();\n\n  return source->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  vtkNew<vtkSuperquadricSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetCenter(1.0, 1.0, 1.0);\n  source->SetPhiResolution(64);\n  source->SetThetaResolution(64);\n  source->SetThetaRoundness(1);\n  source->SetThickness(0.5);\n  source->SetSize(10);\n  source->SetToroidal(1);\n  source->Update();\n\n  // The quadric is made of strips, so pass it through a triangle filter as\n  // the curvature filter only operates on polys\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(source->GetOutputPort());\n\n  // The quadric has nasty discontinuities from the way the edges are generated\n  // so let's pass it though a CleanPolyDataFilter and merge any points which\n  // are coincident, or very close\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  return cleaner->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& source)\n{\n  std::string surface = source;\n  std::transform(surface.begin(), surface.end(), surface.begin(),\n                 [](unsigned char c) { return std::tolower(c); });\n  std::map<std::string, int> available_surfaces = {\n      {\"hills\", 0},       {\"parametrictorus\", 1}, {\"plane\", 2},\n      {\"randomhills\", 3}, {\"sphere\", 4},          {\"torus\", 5}};\n  if (available_surfaces.find(surface) == available_surfaces.end())\n  {\n    std::cout << \"The surface is not available.\" << std::endl;\n    std::cout << \"Using RandomHills instead.\" << std::endl;\n    surface = \"randomhills\";\n  }\n  switch (available_surfaces[surface])\n  {\n  case 0:\n    return GetHills();\n    break;\n  case 1:\n    return GetParametricTorus();\n    break;\n  case 2:\n    return GetElevations(GetPlane());\n    break;\n  case 3:\n    return GetParametricHills();\n    break;\n  case 4:\n    return GetElevations(GetSphere());\n    break;\n  case 5:\n    return GetElevations(GetTorus());\n    break;\n  }\n  return GetParametricHills();\n}\n\nvtkSmartPointer<vtkColorSeries> GetColorSeries()\n{\n\n  vtkNew<vtkColorSeries> colorSeries;\n  // Select a color scheme.\n  int colorSeriesEnum;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_BROWN_BLUE_GREEN_9;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_10;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_3;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_PURPLE_ORANGE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_PURPLE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_GREEN_9;\n  colorSeriesEnum = colorSeries->BREWER_QUALITATIVE_SET3;\n  // colorSeriesEnum = colorSeries->CITRUS;\n  colorSeries->SetColorScheme(colorSeriesEnum);\n  return colorSeries;\n}\n\nvtkSmartPointer<vtkLookupTable> GetCategoricalLUT()\n{\n  vtkSmartPointer<vtkColorSeries> colorSeries = GetColorSeries();\n  // Make the lookup table.\n  vtkNew<vtkLookupTable> lut;\n  colorSeries->BuildLookupTable(lut, vtkColorSeries::CATEGORICAL);\n  lut->SetNanColor(0, 0, 0, 1);\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> GetOrdinaLUT()\n{\n  vtkSmartPointer<vtkColorSeries> colorSeries = GetColorSeries();\n  // Make the lookup table.\n  vtkNew<vtkLookupTable> lut;\n  colorSeries->BuildLookupTable(lut, vtkColorSeries::ORDINAL);\n  lut->SetNanColor(0, 0, 0, 1);\n\n  return lut;\n}\n\n// clang-format off\n/**\n * See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n *\n *                   start point         midPoint            end point\n * cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n * purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n * green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n * blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n * green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n *\n */\n// clang-format on\nvtkSmartPointer<vtkLookupTable> GetDivergingLUT()\n{\n\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, 0.085, 0.532, 0.201);\n  ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n  ctf->AddRGBPoint(1.0, 0.758, 0.214, 0.233);\n\n  auto tableSize = 256;\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(static_cast<double>(i) / lut->GetNumberOfColors(),\n                  rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(static_cast<vtkIdType>(i), rgba.data());\n  }\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> ReverseLUT(vtkLookupTable* lut)\n{\n  // First do a deep copy just to get the whole structure\n  // and then reverse the colors and annotations.\n  vtkNew<vtkLookupTable> lutr;\n  lutr->DeepCopy(lut);\n  vtkIdType t = lut->GetNumberOfTableValues() - 1;\n  for (vtkIdType i = t; i >= 0; --i)\n  {\n    std::array<double, 3> rgb{0.0, 0.0, 0.0};\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    lut->GetColor(i, rgb.data());\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    rgba[3] = lut->GetOpacity(i);\n    lutr->SetTableValue(t - i, rgba.data());\n  }\n  t = lut->GetNumberOfAnnotatedValues() - 1;\n  for (vtkIdType i = t; i >= 0; --i)\n  {\n    lutr->SetAnnotation(t - i, lut->GetAnnotation(i));\n  }\n\n  return lutr;\n}\n\nvtkNew<vtkGlyph3D> GetGlyphs(vtkPolyData* src, double const& scaleFactor,\n                             bool const& reverseNormals)\n{\n  // Sometimes the contouring algorithm can create a volume whose gradient\n  // vector and ordering of polygon(using the right hand rule) are\n  // inconsistent. vtkReverseSense cures this problem.\n  vtkNew<vtkReverseSense> reverse;\n  vtkNew<vtkMaskPoints> maskPts;\n  maskPts->SetOnRatio(5);\n  maskPts->RandomModeOn();\n  if (reverseNormals)\n  {\n    reverse->SetInputData(src);\n    reverse->ReverseCellsOn();\n    reverse->ReverseNormalsOn();\n    maskPts->SetInputConnection(reverse->GetOutputPort());\n  }\n  else\n  {\n    maskPts->SetInputData(src);\n  }\n\n  // Source for the glyph filter\n  vtkNew<vtkArrowSource> arrow;\n  arrow->SetTipResolution(16);\n  arrow->SetTipLength(0.3);\n  arrow->SetTipRadius(0.1);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetSourceConnection(arrow->GetOutputPort());\n  glyph->SetInputConnection(maskPts->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleFactor(scaleFactor);\n  glyph->SetColorModeToColorByVector();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->OrientOn();\n  glyph->Update();\n\n  return glyph;\n}\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision,\n                                            bool const& nearestInteger)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  auto RoundOff = [&prec](const double& x) {\n    auto pow_10 = std::pow(10.0, prec);\n    return std::round(x * pow_10) / pow_10;\n  };\n\n  std::map<int, std::vector<double>> bands;\n  if ((dR[1] < dR[0]) || (numberOfBands <= 0))\n  {\n    return bands;\n  }\n  double x[2];\n  for (int i = 0; i < 2; ++i)\n  {\n    x[i] = dR[i];\n  }\n  if (nearestInteger)\n  {\n    x[0] = std::floor(x[0]);\n    x[1] = std::ceil(x[1]);\n  }\n  double dx = (x[1] - x[0]) / static_cast<double>(numberOfBands);\n  std::vector<double> b;\n  b.push_back(x[0]);\n  b.push_back(x[0] + dx / 2.0);\n  b.push_back(x[0] + dx);\n  for (int i = 0; i < numberOfBands; ++i)\n  {\n    if (i == 0)\n    {\n      for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n      {\n        *p = RoundOff(*p);\n      }\n      b[0] = x[0];\n    }\n    bands[i] = b;\n    for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n    {\n      *p = RoundOff(*p + dx);\n    }\n  }\n  return bands;\n}\n\nstd::map<int, std::vector<double>>\nGetCustomBands(double const dR[2], int const& numberOfBands,\n               std::vector<std::array<double, 2>> const& myBands)\n{\n  std::map<int, std::vector<double>> bands;\n  if ((dR[1] < dR[0]) || (numberOfBands <= 0))\n  {\n    return bands;\n  }\n\n  std::vector<std::array<double, 2>> x;\n  std::copy(myBands.begin(), myBands.end(), std::back_inserter(x));\n\n  // Determine the index of the range minimum and range maximum.\n  int idxMin = 0;\n  for (auto idx = 0; idx < static_cast<int>(myBands.size()); ++idx)\n  {\n    if (dR[0] < myBands[idx][1] && dR[0] >= myBands[idx][0])\n    {\n      idxMin = idx;\n      break;\n    }\n  }\n  int idxMax = static_cast<int>(myBands.size()) - 1;\n  for (int idx = static_cast<int>(myBands.size()) - 1; idx >= 0; --idx)\n  {\n    if (dR[1] < myBands[idx][1] && dR[1] >= myBands[idx][0])\n    {\n      idxMax = static_cast<int>(idx);\n      break;\n    }\n  }\n\n  // Set the minimum to match the range minimum.\n  x[idxMin][0] = dR[0];\n  x[idxMax][1] = dR[1];\n  for (int i = idxMin; i < idxMax + 1; ++i)\n  {\n    std::vector<double> b(3);\n    b[0] = x[i][0];\n    b[1] = x[i][0] + (x[i][1] - x[i][0]) / 2.0;\n    b[2] = x[i][1];\n    bands[i] = b;\n  }\n  return bands;\n}\n\nstd::map<int, std::vector<double>> GetIntegralBands(double const dR[2])\n{\n  std::map<int, std::vector<double>> bands;\n  if (dR[1] < dR[0])\n  {\n    return bands;\n  }\n  double x[2];\n  for (int i = 0; i < 2; ++i)\n  {\n    x[i] = dR[i];\n  }\n  x[0] = std::floor(x[0]);\n  x[1] = std::ceil(x[1]);\n  int numberOfBands = static_cast<int>(std::abs(x[1]) + std::abs(x[0]));\n  return GetBands(x, numberOfBands, false);\n}\n\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src)\n{\n  std::map<int, int> freq;\n  for (auto i = 0; i < static_cast<int>(bands.size()); ++i)\n  {\n    freq[i] = 0;\n  }\n  vtkIdType tuples = src->GetPointData()->GetScalars()->GetNumberOfTuples();\n  for (int i = 0; i < tuples; ++i)\n  {\n    double* x = src->GetPointData()->GetScalars()->GetTuple(i);\n    for (auto j = 0; j < static_cast<int>(bands.size()); ++j)\n    {\n      if (*x <= bands[j][2])\n      {\n        freq[j] = freq[j] + 1;\n        break;\n      }\n    }\n  }\n  return freq;\n}\n\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq)\n{\n  // Get the indices of the first and last non-zero elements.\n  auto first = 0;\n  for (auto i = 0; i < static_cast<int>(freq.size()); ++i)\n  {\n    if (freq[i] != 0)\n    {\n      first = i;\n      break;\n    }\n  }\n  std::vector<int> keys;\n  for (std::map<int, int>::iterator it = freq.begin(); it != freq.end(); ++it)\n  {\n    keys.push_back(it->first);\n  }\n  std::reverse(keys.begin(), keys.end());\n  auto last = keys[0];\n  for (size_t i = 0; i < keys.size(); ++i)\n  {\n    if (freq[keys[i]] != 0)\n    {\n      last = keys[i];\n      break;\n    }\n  }\n  // Now adjust the ranges.\n  std::map<int, int>::iterator freqItr;\n  freqItr = freq.find(first);\n  freq.erase(freq.begin(), freqItr);\n  freqItr = ++freq.find(last);\n  freq.erase(freqItr, freq.end());\n  std::map<int, std::vector<double>>::iterator bandItr;\n  bandItr = bands.find(first);\n  bands.erase(bands.begin(), bandItr);\n  bandItr = ++bands.find(last);\n  bands.erase(bandItr, bands.end());\n  // Reindex freq and bands.\n  std::map<int, int> adjFreq;\n  int idx = 0;\n  for (auto p : freq)\n  {\n    adjFreq[idx] = p.second;\n    ++idx;\n  }\n  std::map<int, std::vector<double>> adjBands;\n  idx = 0;\n  for (auto const& p : bands)\n  {\n    adjBands[idx] = p.second;\n    ++idx;\n  }\n  bands = adjBands;\n  freq = adjFreq;\n}\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  if (bands.size() != freq.size())\n  {\n    std::cout << \"Bands and frequencies must be the same size.\" << std::endl;\n    return;\n  }\n  std::ostringstream os;\n  os << \"Bands & Frequencies:\\n\";\n  size_t idx = 0;\n  auto total = 0;\n  auto width = prec + 6;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    total += freq[p->first];\n    for (std::vector<double>::const_iterator q = p->second.begin();\n         q != p->second.end(); ++q)\n    {\n      if (q == p->second.begin())\n      {\n        os << std::setw(4) << idx << \" [\";\n      }\n      if (q == std::prev(p->second.end()))\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \"]: \" << std::setw(8) << freq[p->first] << \"\\n\";\n      }\n      else\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \", \";\n      }\n    }\n    ++idx;\n  }\n  width = 3 * width + 13;\n  os << std::left << std::setw(width) << \"Total\" << std::right << std::setw(8)\n     << total << std::endl;\n  std::cout << os.str() << endl;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/ElevationBandsWithGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ElevationBandsWithGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ElevationBandsWithGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ElevationBandsWithGlyphs MACOSX_BUNDLE ElevationBandsWithGlyphs.cxx )\n  target_link_libraries(ElevationBandsWithGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ElevationBandsWithGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ElevationBandsWithGlyphs/#download-and-build-elevationbandswithglyphs","title":"Download and Build ElevationBandsWithGlyphs","text":"

Click here to download ElevationBandsWithGlyphs and its CMakeLists.txt file. Once the tarball ElevationBandsWithGlyphs.tar has been downloaded and extracted,

cd ElevationBandsWithGlyphs/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ElevationBandsWithGlyphs\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ExtrudePolyDataAlongLine/","title":"ExtrudePolyDataAlongLine","text":"

vtk-examples/Cxx/Visualization/ExtrudePolyDataAlongLine

"},{"location":"Cxx/Visualization/ExtrudePolyDataAlongLine/#description","title":"Description","text":"

Extrude a 2D polydata along a line. It uses vtkRuledSurfaceFilter.

The example proceeds as follows:

  1. Obtain the 2D polydata from a file( or generate a disk).

  2. Generates random points in 3D space and fits a spline to the points.

  3. Computes an orientation frame at each point on the line.

  4. Places a copy of the 2D polydata at each point on the line, oriented by the the frame at that point.

  5. For each contour in the 2D polydata, appends all of the copies.

  6. Creates a ruled surface for each contour.

Note

This example requires the remote module ''SplineDrivenImageSampler.'' Check to see if the file ''SplineDrivenImageSlicer.remote.cmake'' exists in VTK/Remote. If it does not, copy this file to ''VTK/Remote/SplineDrivenImageSlicer.remote.cmake''.

Warning

A bug in vtkRuledSurfaceFilter occasionally drops triangles. This is being fixed.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ExtrudePolyDataAlongLine/#code","title":"Code","text":"

ExtrudePolyDataAlongLine.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkDiskSource.h>\n#include <vtkFeatureEdges.h>\n#include <vtkFrenetSerretFrame.h>\n#include <vtkLineSource.h>\n#include <vtkMath.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRuledSurfaceFilter.h>\n#include <vtkSmartPointer.h>\n#include <vtkStripper.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // For testing\n  vtkMath::RandomSeed(7859821);\n  // Read a polydata\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  int numberOfContours = polyData->GetNumberOfLines();\n  std::cout << \"Number of contours: \" << numberOfContours << std::endl;\n\n  // Generate  some random points\n  int numberOfPoints = 10;\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(numberOfPoints);\n  pointSource->Update();\n\n  vtkPoints* points = pointSource->GetOutput()->GetPoints();\n\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetPoints(points);\n\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->SetUResolution(50 * numberOfPoints);\n  functionSource->SetVResolution(50 * numberOfPoints);\n  functionSource->SetWResolution(50 * numberOfPoints);\n\n  // Create the frame\n  vtkNew<vtkFrenetSerretFrame> frame;\n  frame->SetInputConnection(functionSource->GetOutputPort());\n  frame->ConsistentNormalsOn();\n  frame->Update();\n\n  frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSNormals\");\n  frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSTangents\");\n  frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSBinormals\");\n\n  vtkPoints* linePoints = frame->GetOutput()->GetPoints();\n\n  std::vector<vtkSmartPointer<vtkAppendPolyData>> skeletons;\n  for (int i = 0; i < numberOfContours; ++i)\n  {\n    skeletons.push_back(vtkSmartPointer<vtkAppendPolyData>::New());\n  }\n\n  for (int i = 0; i < linePoints->GetNumberOfPoints(); ++i)\n  {\n    vtkNew<vtkTransform> transform;\n\n    // Compute a basis\n    double normalizedX[3];\n    frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSNormals\");\n    frame->GetOutput()->GetPointData()->GetVectors()->GetTuple(i, normalizedX);\n    double normalizedY[3];\n    frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSBinormals\");\n    frame->GetOutput()->GetPointData()->GetVectors()->GetTuple(i, normalizedY);\n    double normalizedZ[3];\n    frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSTangents\");\n    frame->GetOutput()->GetPointData()->GetVectors()->GetTuple(i, normalizedZ);\n\n    // Create the direction cosine matrix\n    vtkNew<vtkMatrix4x4> matrix;\n    matrix->Identity();\n    for (unsigned int j = 0; j < 3; ++j)\n    {\n      matrix->SetElement(j, 0, normalizedX[j]);\n      matrix->SetElement(j, 1, normalizedY[j]);\n      matrix->SetElement(j, 2, normalizedZ[j]);\n    }\n\n    transform->Translate(linePoints->GetPoint(i)[0], linePoints->GetPoint(i)[1],\n                         linePoints->GetPoint(i)[2]);\n    transform->Scale(.02, .02, .02);\n    transform->Concatenate(matrix);\n\n    vtkNew<vtkTransformPolyDataFilter> transformPD;\n    vtkNew<vtkPolyData> polyDataCopy;\n    polyDataCopy->DeepCopy(polyData);\n\n    transformPD->SetTransform(transform);\n    transformPD->SetInputData(polyDataCopy);\n    transformPD->Update();\n\n    vtkNew<vtkPolyDataConnectivityFilter> contours;\n    contours->SetInputConnection(transformPD->GetOutputPort());\n    contours->Update();\n    for (int r = 0; r < contours->GetNumberOfExtractedRegions(); ++r)\n    {\n      contours->SetExtractionModeToSpecifiedRegions();\n      contours->InitializeSpecifiedRegionList();\n      contours->AddSpecifiedRegion(r);\n      contours->Update();\n      vtkNew<vtkPolyData> skeleton;\n      skeleton->DeepCopy(contours->GetOutput());\n      skeletons[r]->AddInputData(skeleton);\n    }\n  }\n  vtkNew<vtkRenderer> renderer;\n\n  for (int i = 0; i < numberOfContours; ++i)\n  {\n    vtkNew<vtkRuledSurfaceFilter> ruled;\n    ruled->SetRuledModeToPointWalk();\n    ruled->CloseSurfaceOff();\n    ruled->SetOnRatio(1);\n    ruled->SetDistanceFactor(10000000);\n    ruled->SetInputConnection(skeletons[i]->GetOutputPort());\n\n    vtkNew<vtkPolyDataNormals> normals;\n    normals->SetInputConnection(ruled->GetOutputPort());\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(normals->GetOutputPort());\n    vtkNew<vtkProperty> backProp;\n    backProp->SetColor(1.0, 0.3882, 0.278);\n    vtkNew<vtkActor> actor;\n    actor->SetBackfaceProperty(backProp);\n    actor->GetProperty()->SetColor(0.8900, 0.8100, 0.3400);\n    actor->SetMapper(mapper);\n    renderer->AddActor(actor);\n  }\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(.4, .5, .7);\n\n  // Pick a good view\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.1);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(512, 512);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n\n    // Center the data\n    vtkNew<vtkTransform> transform;\n    std::cout << reader->GetOutput()->GetCenter()[0] << \", \"\n              << reader->GetOutput()->GetCenter()[1] << \", \"\n              << reader->GetOutput()->GetCenter()[2] << std::endl;\n    transform->Translate(-reader->GetOutput()->GetCenter()[0],\n                         -reader->GetOutput()->GetCenter()[1],\n                         -reader->GetOutput()->GetCenter()[2]);\n    vtkNew<vtkTransformPolyDataFilter> transformPD;\n    transformPD->SetTransform(transform);\n    transformPD->SetInputData(reader->GetOutput());\n    transformPD->Update();\n\n    polyData = transformPD->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkDiskSource> diskSource;\n    diskSource->SetCircumferentialResolution(3);\n\n    vtkNew<vtkCleanPolyData> clean;\n    clean->SetInputConnection(diskSource->GetOutputPort());\n\n    vtkNew<vtkFeatureEdges> edges;\n    edges->SetInputConnection(clean->GetOutputPort());\n    edges->NonManifoldEdgesOff();\n    edges->ManifoldEdgesOff();\n    edges->BoundaryEdgesOn();\n    edges->FeatureEdgesOff();\n\n    vtkNew<vtkStripper> stripper;\n    stripper->SetInputConnection(edges->GetOutputPort());\n    stripper->Update();\n    polyData = stripper->GetOutput();\n\n#if 0\n    vtkNew<vtkLineSource> lineSource;\n    lineSource->SetResolution(10);\n    lineSource->Update();\n\n    polyData = lineSource->GetOutput();\n#endif\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/ExtrudePolyDataAlongLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtrudePolyDataAlongLine)\n\nfind_package(VTK COMPONENTS \n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonMath\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtrudePolyDataAlongLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtrudePolyDataAlongLine MACOSX_BUNDLE ExtrudePolyDataAlongLine.cxx )\n  target_link_libraries(ExtrudePolyDataAlongLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtrudePolyDataAlongLine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ExtrudePolyDataAlongLine/#download-and-build-extrudepolydataalongline","title":"Download and Build ExtrudePolyDataAlongLine","text":"

Click here to download ExtrudePolyDataAlongLine and its CMakeLists.txt file. Once the tarball ExtrudePolyDataAlongLine.tar has been downloaded and extracted,

cd ExtrudePolyDataAlongLine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtrudePolyDataAlongLine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/FastSplatter/","title":"FastSplatter","text":"

vtk-examples/Cxx/Visualization/FastSplatter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/FastSplatter/#code","title":"Code","text":"

FastSplatter.cxx

#include <vtkFastSplatter.h>\n#include <vtkImageData.h>\n#include <vtkImageShiftScale.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\nconstexpr int SPLAT_IMAGE_SIZE = 100;\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // For the purposes of this example we'll build the splat image by\n  // hand.\n\n  vtkNew<vtkImageData> splatImage;\n  splatImage->SetDimensions(SPLAT_IMAGE_SIZE, SPLAT_IMAGE_SIZE, 1);\n  splatImage->AllocateScalars(VTK_FLOAT, 1);\n\n  for (int i = 0; i < SPLAT_IMAGE_SIZE; ++i)\n  {\n    for (int j = 0; j < SPLAT_IMAGE_SIZE; ++j)\n    {\n      double xCoord =\n          1 - fabs((i - SPLAT_IMAGE_SIZE / 2) / (SPLAT_IMAGE_SIZE / 2.0));\n      double yCoord =\n          1 - fabs((j - SPLAT_IMAGE_SIZE / 2) / (SPLAT_IMAGE_SIZE / 2.0));\n\n      splatImage->SetScalarComponentFromDouble(i, j, 0, 0, xCoord * yCoord);\n    }\n  }\n\n  vtkNew<vtkPolyData> splatPoints;\n  vtkNew<vtkPoints> points;\n\n  points->SetNumberOfPoints(5);\n  double point[3];\n\n  point[0] = 0;\n  point[1] = 0;\n  point[2] = 0;\n  points->SetPoint(0, point);\n\n  point[0] = 1;\n  point[1] = 1;\n  point[2] = 0;\n  points->SetPoint(1, point);\n\n  point[0] = -1;\n  point[1] = 1;\n  point[2] = 0;\n  points->SetPoint(2, point);\n\n  point[0] = 1;\n  point[1] = -1;\n  point[2] = 0;\n  points->SetPoint(3, point);\n\n  point[0] = -1;\n  point[1] = -1;\n  point[2] = 0;\n  points->SetPoint(4, point);\n\n  splatPoints->SetPoints(points);\n\n  vtkNew<vtkFastSplatter> splatter;\n  splatter->SetInputData(splatPoints);\n  splatter->SetInputData(1, splatImage);\n  splatter->SetOutputDimensions(2 * SPLAT_IMAGE_SIZE, 2 * SPLAT_IMAGE_SIZE, 1);\n\n  // The image viewers and writers are only happy with unsigned char\n  // images.  This will convert the floats into that format.\n  vtkNew<vtkImageShiftScale> resultScale;\n  resultScale->SetOutputScalarTypeToUnsignedChar();\n  resultScale->SetShift(0);\n  resultScale->SetScale(255);\n  resultScale->SetInputConnection(splatter->GetOutputPort());\n\n  splatter->Update();\n  resultScale->Update();\n\n  // Set up a viewer for the image.  vtkImageViewer and\n  // vtkImageViewer2 are convenient wrappers around vtkActor2D,\n  // vtkImageMapper, vtkRenderer, and vtkRenderWindow.  All you need\n  // to supply is the interactor and hooray, Bob's your uncle.\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(resultScale->GetOutputPort());\n  imageViewer->SetColorLevel(127);\n  imageViewer->SetColorWindow(255);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  imageViewer->SetupInteractor(iren);\n\n  imageViewer->Render();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SlateGray\").GetData());\n  imageViewer->GetRenderer()->ResetCamera();\n\n  imageViewer->GetRenderWindow()->SetWindowName(\"FastSplatter\");\n\n  imageViewer->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/FastSplatter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FastSplatter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingHybrid\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FastSplatter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FastSplatter MACOSX_BUNDLE FastSplatter.cxx )\n  target_link_libraries(FastSplatter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FastSplatter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/FastSplatter/#download-and-build-fastsplatter","title":"Download and Build FastSplatter","text":"

Click here to download FastSplatter and its CMakeLists.txt file. Once the tarball FastSplatter.tar has been downloaded and extracted,

cd FastSplatter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FastSplatter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/FlatShading/","title":"FlatShading","text":"

vtk-examples/Cxx/Visualization/FlatShading

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/FlatShading/#code","title":"Code","text":"

FlatShading.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Set shading to flat.\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"FlatShading\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderer->GetActiveCamera()->Azimuth(-55);\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/FlatShading/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FlatShading)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FlatShading: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FlatShading MACOSX_BUNDLE FlatShading.cxx )\n  target_link_libraries(FlatShading PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FlatShading\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/FlatShading/#download-and-build-flatshading","title":"Download and Build FlatShading","text":"

Click here to download FlatShading and its CMakeLists.txt file. Once the tarball FlatShading.tar has been downloaded and extracted,

cd FlatShading/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FlatShading\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Follower/","title":"Follower","text":"

vtk-examples/Cxx/Visualization/Follower

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/Follower/#description","title":"Description","text":"

The text is a 3D actor and is placed in 3D space, but stays right side up and facing the camera, while the cube does not.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Follower/#code","title":"Code","text":"

Follower.cxx

#include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkFollower.h>\n#include <vtkInteractorStyle.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorText.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create some text.\n  vtkNew<vtkVectorText> textSource;\n  textSource->SetText(\"Hello\");\n\n  // Create a mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(textSource->GetOutputPort());\n\n  // Create a subclass of vtkActor: a vtkFollower that remains facing the\n  // camera.\n  vtkNew<vtkFollower> follower;\n  follower->SetMapper(mapper);\n  follower->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a transparent cube that does not move around to face the camera.\n  vtkNew<vtkCubeSource> cubeSource;\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  cubeActor->GetProperty()->SetOpacity(0.3);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Follower\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  dynamic_cast<vtkInteractorStyle*>(\n      renderWindowInteractor->GetInteractorStyle())\n      ->AutoAdjustCameraClippingRangeOn();\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(follower);\n  renderer->AddActor(cubeActor);\n  renderer->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n  follower->SetCamera(renderer->GetActiveCamera());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Follower/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Follower)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Follower: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Follower MACOSX_BUNDLE Follower.cxx )\n  target_link_libraries(Follower PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Follower\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Follower/#download-and-build-follower","title":"Download and Build Follower","text":"

Click here to download Follower and its CMakeLists.txt file. Once the tarball Follower.tar has been downloaded and extracted,

cd Follower/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Follower\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/FontFile/","title":"FontFile","text":"

vtk-examples/Cxx/Visualization/FontFile

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/FontFile/#description","title":"Description","text":"

The example uses an external font file. There are many sources of TrueType fonts. Here is one source.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/FontFile/#code","title":"Code","text":"

FontFile.cxx

#include <vtkActor2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[1] << \" font.ttf e.g. CopyPaste.ttf\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fontFile(argv[1]);\n  std::stringstream str;\n  str << \"Font: \"\n      << vtksys::SystemTools::GetFilenameWithoutExtension(std::string(argv[1]))\n      << \"\\n\"\n      << \"Sample multiline\\ntext rendered\\nusing FreeTypeTools.\";\n\n  int width = 640;\n  int height = 480;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkTextMapper> mapper;\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetPosition(width / 2, height / 2);\n  actor->SetMapper(mapper);\n  mapper->GetTextProperty()->BoldOff();\n  ;\n  mapper->GetTextProperty()->SetFontSize(50);\n  mapper->GetTextProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  mapper->GetTextProperty()->SetJustificationToCentered();\n  mapper->GetTextProperty()->SetVerticalJustificationToCentered();\n  mapper->GetTextProperty()->SetFontFamily(VTK_FONT_FILE);\n  mapper->GetTextProperty()->SetFontFile(fontFile.c_str());\n  mapper->SetInput(str.str().c_str());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->SetSize(width, height);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"FontFile\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/FontFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FontFile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FontFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FontFile MACOSX_BUNDLE FontFile.cxx )\n  target_link_libraries(FontFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FontFile\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/FontFile/#download-and-build-fontfile","title":"Download and Build FontFile","text":"

Click here to download FontFile and its CMakeLists.txt file. Once the tarball FontFile.tar has been downloaded and extracted,

cd FontFile/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FontFile\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/FrogBrain/","title":"FrogBrain","text":"

vtk-examples/Cxx/Visualization/FrogBrain

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/FrogBrain/#description","title":"Description","text":"

The frog's brain. Model extracted without smoothing (left) and with smoothing (right).

Info

See Figure 12-7 in Chapter 12 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/FrogBrain/#code","title":"Code","text":"

FrogBrain.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageThreshold.h>\n#include <vtkLookupTable.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n#include <vtkVersion.h>\n#include <vtkWindowedSincPolyDataFilter.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <map>\n\nnamespace {\nvoid CreateFrogLut(vtkLookupTable* colorLut);\nvoid CreateFrogActor(std::string fileName, int tissue, vtkActor* actor);\nvoid CreateSmoothFrogActor(std::string fileName, int tissue, vtkActor* actor);\nvoid CreateTissueMap(std::map<std::string, int>& tissueMap);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \"InputFile(.mhd) Tissue e.g.frogtissue.mhd brain\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::map<std::string, int> tissueMap;\n  CreateTissueMap(tissueMap);\n\n  vtkNew<vtkLookupTable> colorLut;\n  colorLut->SetNumberOfColors(17);\n  colorLut->SetTableRange(0, 16);\n  colorLut->Build();\n\n  CreateFrogLut(colorLut);\n\n  vtkNew<vtkNamedColors> colors;\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> rendererLeft;\n  rendererLeft->SetViewport(0, 0, 0.5, 1);\n  vtkNew<vtkRenderer> rendererRight;\n  rendererRight->SetViewport(0.5, 0, 1, 1);\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(rendererLeft);\n  renderWindow->AddRenderer(rendererRight);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetDiffuseColor(\n      colorLut->GetTableValue(tissueMap[argv[2]]));\n  CreateFrogActor(argv[1], tissueMap[argv[2]], actor);\n  rendererLeft->AddActor(actor);\n\n  vtkNew<vtkActor> actorSmooth;\n  actorSmooth->GetProperty()->SetDiffuseColor(\n      colorLut->GetTableValue(tissueMap[argv[2]]));\n  actorSmooth->GetProperty()->SetDiffuse(1.0);\n  actorSmooth->GetProperty()->SetSpecular(.5);\n  actorSmooth->GetProperty()->SetSpecularPower(100);\n  CreateSmoothFrogActor(argv[1], tissueMap[argv[2]], actorSmooth);\n  rendererRight->AddActor(actorSmooth);\n\n  rendererLeft->ResetCamera();\n  rendererLeft->GetActiveCamera()->SetViewUp(-1, 0, 0);\n  rendererLeft->GetActiveCamera()->Azimuth(180);\n  rendererLeft->ResetCameraClippingRange();\n\n  rendererLeft->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n  rendererRight->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n  rendererRight->SetActiveCamera(rendererLeft->GetActiveCamera());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"FrogBrain\");\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateTissueMap(std::map<std::string, int>& tissueMap)\n{\n  tissueMap[\"blood\"] = 1;\n  tissueMap[\"brain\"] = 2;\n  tissueMap[\"duodenum\"] = 3;\n  tissueMap[\"eyeRetina\"] = 4;\n  tissueMap[\"eyeWhite\"] = 5;\n  tissueMap[\"heart\"] = 6;\n  tissueMap[\"ileum\"] = 7;\n  tissueMap[\"kidney\"] = 8;\n  tissueMap[\"intestine\"] = 9;\n  tissueMap[\"liver\"] = 10;\n  tissueMap[\"lung\"] = 11;\n  tissueMap[\"nerve\"] = 12;\n  tissueMap[\"skeleton\"] = 13;\n  tissueMap[\"spleen\"] = 14;\n  tissueMap[\"stomach\"] = 15;\n  return;\n}\n\nvoid CreateSmoothFrogActor(std::string fileName, int tissue, vtkActor* actor)\n{\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageThreshold> selectTissue;\n  selectTissue->ThresholdBetween(tissue, tissue);\n  selectTissue->SetInValue(255);\n  selectTissue->SetOutValue(0);\n  selectTissue->SetInputConnection(reader->GetOutputPort());\n\n  int gaussianRadius = 1;\n  double gaussianStandardDeviation = 2.0;\n  vtkNew<vtkImageGaussianSmooth> gaussian;\n  gaussian->SetStandardDeviations(gaussianStandardDeviation,\n                                  gaussianStandardDeviation,\n                                  gaussianStandardDeviation);\n  gaussian->SetRadiusFactors(gaussianRadius, gaussianRadius, gaussianRadius);\n  gaussian->SetInputConnection(selectTissue->GetOutputPort());\n\n  double isoValue = 127.5;\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> iso_surface;\n#else\n  vtkNew<vtkMarchingCubes> iso_surface;\n#endif\n  iso_surface->SetInputConnection(gaussian->GetOutputPort());\n  iso_surface->ComputeScalarsOff();\n  iso_surface->ComputeGradientsOff();\n  iso_surface->ComputeNormalsOff();\n  iso_surface->SetValue(0, isoValue);\n\n  int smoothingIterations = 20;\n  double passBand = 0.001;\n  double featureAngle = 60.0;\n  vtkNew<vtkWindowedSincPolyDataFilter> smoother;\n  smoother->SetInputConnection(iso_surface->GetOutputPort());\n  smoother->SetNumberOfIterations(smoothingIterations);\n  smoother->BoundarySmoothingOff();\n  smoother->FeatureEdgeSmoothingOff();\n  smoother->SetFeatureAngle(featureAngle);\n  smoother->SetPassBand(passBand);\n  smoother->NonManifoldSmoothingOn();\n  smoother->NormalizeCoordinatesOn();\n  smoother->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(smoother->GetOutputPort());\n  normals->SetFeatureAngle(featureAngle);\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(stripper->GetOutputPort());\n\n  actor->SetMapper(mapper);\n  return;\n}\n\nvoid CreateFrogActor(std::string fileName, int tissue, vtkActor* actor)\n{\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageThreshold> selectTissue;\n  selectTissue->ThresholdBetween(tissue, tissue);\n  selectTissue->SetInValue(255);\n  selectTissue->SetOutValue(0);\n  selectTissue->SetInputConnection(reader->GetOutputPort());\n\n  double isoValue = 63.5;\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> iso_surface;\n#else\n  vtkNew<vtkMarchingCubes> iso_surface;\n#endif\n  iso_surface->SetInputConnection(selectTissue->GetOutputPort());\n  iso_surface->ComputeScalarsOff();\n  iso_surface->ComputeGradientsOff();\n  iso_surface->ComputeNormalsOn();\n  iso_surface->SetValue(0, isoValue);\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(iso_surface->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(stripper->GetOutputPort());\n\n  actor->SetMapper(mapper);\n  return;\n}\n\nvoid CreateFrogLut(vtkLookupTable* colorLut)\n{\n  vtkNew<vtkNamedColors> colors;\n  colorLut->SetTableValue(0, 0, 0, 0, 0);\n  colorLut->SetTableValue(1,\n                          colors->GetColor4d(\"salmon\").GetData()); // blood\n  colorLut->SetTableValue(2,\n                          colors->GetColor4d(\"beige\").GetData()); // brain\n  colorLut->SetTableValue(3,\n                          colors->GetColor4d(\"orange\").GetData()); // duodenum\n  colorLut->SetTableValue(\n      4,\n      colors->GetColor4d(\"misty_rose\").GetData()); // eye_retina\n  colorLut->SetTableValue(5,\n                          colors->GetColor4d(\"white\").GetData()); // eye_white\n  colorLut->SetTableValue(6,\n                          colors->GetColor4d(\"tomato\").GetData()); // heart\n  colorLut->SetTableValue(7,\n                          colors->GetColor4d(\"raspberry\").GetData()); // ileum\n  colorLut->SetTableValue(8,\n                          colors->GetColor4d(\"banana\").GetData()); // kidney\n  colorLut->SetTableValue(9,\n                          colors->GetColor4d(\"peru\").GetData()); // l_intestine\n  colorLut->SetTableValue(10,\n                          colors->GetColor4d(\"pink\").GetData()); // liver\n  colorLut->SetTableValue(11,\n                          colors->GetColor4d(\"powder_blue\").GetData()); // lung\n  colorLut->SetTableValue(12,\n                          colors->GetColor4d(\"carrot\").GetData()); // nerve\n  colorLut->SetTableValue(13,\n                          colors->GetColor4d(\"wheat\").GetData()); // skeleton\n  colorLut->SetTableValue(14,\n                          colors->GetColor4d(\"violet\").GetData()); // spleen\n  colorLut->SetTableValue(15,\n                          colors->GetColor4d(\"plum\").GetData()); // stomach\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/FrogBrain/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FrogBrain)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FrogBrain: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FrogBrain MACOSX_BUNDLE FrogBrain.cxx )\n  target_link_libraries(FrogBrain PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FrogBrain\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/FrogBrain/#download-and-build-frogbrain","title":"Download and Build FrogBrain","text":"

Click here to download FrogBrain and its CMakeLists.txt file. Once the tarball FrogBrain.tar has been downloaded and extracted,

cd FrogBrain/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FrogBrain\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/FrogSlice/","title":"FrogSlice","text":"

vtk-examples/Cxx/Visualization/FrogSlice

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/FrogSlice/#description","title":"Description","text":"

This example uses a dataset derived from a frog. This data was prepared at Lawrence Berkeley National Laboratories and is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels. (To accommodate the volume readers we have in VTK, we processed the mask files and combined them all into one vtkMetaImageReader .mhd file. Integer numbers 1\u201315 to represent the 15 tissues.

This example shows a photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow.

Info

See Figure 12-6 in Chapter 12 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/FrogSlice/#code","title":"Code","text":"

FrogSlice.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageConstantPad.h>\n#include <vtkLookupTable.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTexture.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkWindowLevelLookupTable.h>\n\n#include <map>\n#include <string>\n\nnamespace {\nvoid CreateFrogLut(vtkLookupTable* colorLut);\nvoid SliceOrder(\n    std::map<std::string, vtkSmartPointer<vtkTransform>>& sliceOrder);\n} // namespace\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" frog.mhd frogtissue.mhd [slice]\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  int sliceNumber = 39; // to match figure 12-6\n  if (argc > 3)\n  {\n    sliceNumber = atoi(argv[3]);\n  }\n  std::map<std::string, vtkSmartPointer<vtkTransform>> sliceOrder;\n  SliceOrder(sliceOrder);\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Now create the RenderWindow, Renderer and Interactor\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderer> ren2;\n  vtkNew<vtkRenderer> ren3;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->AddRenderer(ren2);\n  renWin->AddRenderer(ren3);\n  renWin->SetWindowName(\"FrogSlice\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkMetaImageReader> greyReader;\n  greyReader->SetFileName(argv[1]);\n  greyReader->Update();\n\n  vtkNew<vtkImageConstantPad> greyPadder;\n  greyPadder->SetInputConnection(greyReader->GetOutputPort());\n  greyPadder->SetOutputWholeExtent(0, 511, 0, 511, sliceNumber, sliceNumber);\n  greyPadder->SetConstant(0);\n\n  vtkNew<vtkPlaneSource> greyPlane;\n\n  vtkNew<vtkTransformPolyDataFilter> greyTransform;\n  greyTransform->SetTransform(sliceOrder[\"hfsi\"]);\n  greyTransform->SetInputConnection(greyPlane->GetOutputPort());\n\n  vtkNew<vtkPolyDataNormals> greyNormals;\n  greyNormals->SetInputConnection(greyTransform->GetOutputPort());\n  greyNormals->FlipNormalsOff();\n\n  vtkNew<vtkWindowLevelLookupTable> wllut;\n  wllut->SetWindow(255);\n  wllut->SetLevel(128);\n  wllut->SetTableRange(0, 255);\n  wllut->Build();\n\n  vtkNew<vtkPolyDataMapper> greyMapper;\n  greyMapper->SetInputConnection(greyPlane->GetOutputPort());\n\n  vtkNew<vtkTexture> greyTexture;\n  greyTexture->SetInputConnection(greyPadder->GetOutputPort());\n  greyTexture->SetLookupTable(wllut);\n  greyTexture->SetColorModeToMapScalars();\n  greyTexture->InterpolateOn();\n\n  vtkNew<vtkActor> greyActor;\n  greyActor->SetMapper(greyMapper);\n  greyActor->SetTexture(greyTexture);\n\n  vtkNew<vtkMetaImageReader> segmentReader;\n  segmentReader->SetFileName(argv[2]);\n  segmentReader->Update();\n\n  vtkNew<vtkImageConstantPad> segmentPadder;\n  segmentPadder->SetInputConnection(segmentReader->GetOutputPort());\n  segmentPadder->SetOutputWholeExtent(0, 511, 0, 511, sliceNumber, sliceNumber);\n  segmentPadder->SetConstant(0);\n\n  vtkNew<vtkPlaneSource> segmentPlane;\n\n  vtkNew<vtkTransformPolyDataFilter> segmentTransform;\n  segmentTransform->SetTransform(sliceOrder[\"hfsi\"]);\n  segmentTransform->SetInputConnection(segmentPlane->GetOutputPort());\n\n  vtkNew<vtkPolyDataNormals> segmentNormals;\n  segmentNormals->SetInputConnection(segmentTransform->GetOutputPort());\n  segmentNormals->FlipNormalsOn();\n\n  vtkNew<vtkLookupTable> colorLut;\n  colorLut->SetNumberOfColors(17);\n  colorLut->SetTableRange(0, 16);\n  colorLut->Build();\n  CreateFrogLut(colorLut);\n\n  vtkNew<vtkPolyDataMapper> segmentMapper;\n  segmentMapper->SetInputConnection(segmentPlane->GetOutputPort());\n\n  vtkNew<vtkTexture> segmentTexture;\n  segmentTexture->SetInputConnection(segmentPadder->GetOutputPort());\n  segmentTexture->SetLookupTable(colorLut);\n  segmentTexture->SetColorModeToMapScalars();\n  segmentTexture->InterpolateOff();\n\n  vtkNew<vtkActor> segmentActor;\n  segmentActor->SetMapper(segmentMapper);\n  segmentActor->SetTexture(segmentTexture);\n\n  vtkNew<vtkActor> segmentOverlayActor;\n  segmentOverlayActor->SetMapper(segmentMapper);\n  segmentOverlayActor->SetTexture(segmentTexture);\n\n  segmentOverlayActor->GetProperty()->SetOpacity(.5);\n  ren1->SetBackground(0, 0, 0);\n  ren1->SetViewport(0, .5, .5, 1);\n  renWin->SetSize(640, 480);\n  ren1->AddActor(greyActor);\n\n  ren2->SetBackground(0, 0, 0);\n  ren2->SetViewport(.5, .5, 1, 1);\n  ren2->AddActor(segmentActor);\n\n  vtkNew<vtkCamera> cam1;\n  cam1->SetViewUp(0, -1, 0);\n  cam1->SetPosition(0, 0, -1);\n  ren1->SetActiveCamera(cam1);\n  ren1->ResetCamera();\n  cam1->SetViewUp(0, -1, 0);\n  cam1->SetPosition(0.0554068, -0.0596001, -0.491383);\n  cam1->SetFocalPoint(0.0554068, -0.0596001, 0);\n  ren1->ResetCameraClippingRange();\n\n  ren3->AddActor(greyActor);\n  ren3->AddActor(segmentOverlayActor);\n  segmentOverlayActor->SetPosition(0, 0, -0.01);\n\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren2->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren3->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  ren3->SetViewport(0, 0, 1, .5);\n\n  ren2->SetActiveCamera(ren1->GetActiveCamera());\n  ren3->SetActiveCamera(ren1->GetActiveCamera());\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateFrogLut(vtkLookupTable* colorLut)\n{\n  vtkNew<vtkNamedColors> colors;\n  colorLut->SetTableValue(0, colors->GetColor4d(\"black\").GetData());\n  colorLut->SetTableValue(1,\n                          colors->GetColor4d(\"salmon\").GetData()); // blood\n  colorLut->SetTableValue(2,\n                          colors->GetColor4d(\"beige\").GetData()); // brain\n  colorLut->SetTableValue(3,\n                          colors->GetColor4d(\"orange\").GetData()); // duodenum\n  colorLut->SetTableValue(\n      4,\n      colors->GetColor4d(\"misty_rose\").GetData()); // eye_retina\n  colorLut->SetTableValue(5,\n                          colors->GetColor4d(\"white\").GetData()); // eye_white\n  colorLut->SetTableValue(6,\n                          colors->GetColor4d(\"tomato\").GetData()); // heart\n  colorLut->SetTableValue(7,\n                          colors->GetColor4d(\"raspberry\").GetData()); // ileum\n  colorLut->SetTableValue(8,\n                          colors->GetColor4d(\"banana\").GetData()); // kidney\n  colorLut->SetTableValue(9,\n                          colors->GetColor4d(\"peru\").GetData()); // l_intestine\n  colorLut->SetTableValue(10,\n                          colors->GetColor4d(\"pink\").GetData()); // liver\n  colorLut->SetTableValue(11,\n                          colors->GetColor4d(\"powder_blue\").GetData()); // lung\n  colorLut->SetTableValue(12,\n                          colors->GetColor4d(\"carrot\").GetData()); // nerve\n  colorLut->SetTableValue(13,\n                          colors->GetColor4d(\"wheat\").GetData()); // skeleton\n  colorLut->SetTableValue(14,\n                          colors->GetColor4d(\"violet\").GetData()); // spleen\n  colorLut->SetTableValue(15,\n                          colors->GetColor4d(\"plum\").GetData()); // stomach\n}\n\nvoid SliceOrder(\n    std::map<std::string, vtkSmartPointer<vtkTransform>>& sliceOrder)\n{\n  //\n  // these transformations permute medical image data to maintain proper\n  // orientation regardless of the acquisition order. After applying these\n  // transforms with vtkTransformFilter, a view up of 0,-1,0 will result in\n  // the body part facing the viewer. NOTE: some transformations have a -1\n  // scale factor for one of the components.\n  //       To ensure proper polygon orientation and normal direction, you must\n  //       apply the vtkPolyDataNormals filter.\n  //\n  // Naming:\n  // si - superior to inferior (top to bottom)\n  // is - inferior to superior (bottom to top)\n  // ap - anterior to posterior (front to back)\n  // pa - posterior to anterior (back to front)\n  // lr - left to right\n  // rl - right to left\n  //\n  double siMatrix[16] = {1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1};\n  vtkNew<vtkTransform> si;\n  si->SetMatrix(siMatrix);\n  sliceOrder[\"si\"] = si;\n\n  double isMatrix[16] = {1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, 1};\n  vtkNew<vtkTransform> is;\n  is->SetMatrix(isMatrix);\n  sliceOrder[\"is\"] = is;\n\n  vtkNew<vtkTransform> ap;\n  ap->Scale(1, -1, 1);\n  sliceOrder[\"ap\"] = ap;\n\n  vtkNew<vtkTransform> pa;\n  pa->Scale(1, -1, -1);\n  sliceOrder[\"pa\"] = pa;\n\n  double lrMatrix[16] = {0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1};\n  vtkNew<vtkTransform> lr;\n  lr->SetMatrix(lrMatrix);\n  sliceOrder[\"lr\"] = lr;\n\n  double rlMatrix[16] = {0, 0, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1};\n  vtkNew<vtkTransform> rl;\n  rl->SetMatrix(rlMatrix);\n  sliceOrder[\"rl\"] = rl;\n\n  //\n  // The previous transforms assume radiological views of the slices (viewed\n  // from the feet). other modalities such as physical sectioning may view\n  // from the head. these transforms modify the original with a 180 rotation\n  // about y\n  //\n  double hfMatrix[16] = {-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1};\n  vtkNew<vtkTransform> hf;\n  hf->SetMatrix(hfMatrix);\n  sliceOrder[\"hf\"] = hf;\n\n  vtkNew<vtkTransform> hfsi;\n  hfsi->Concatenate(hf->GetMatrix());\n  hfsi->Concatenate(si->GetMatrix());\n  sliceOrder[\"hfsi\"] = hfsi;\n\n  vtkNew<vtkTransform> hfis;\n  hfis->Concatenate(hf->GetMatrix());\n  hfis->Concatenate(is->GetMatrix());\n  sliceOrder[\"hfis\"] = hfis;\n\n  vtkNew<vtkTransform> hfap;\n  hfap->Concatenate(hf->GetMatrix());\n  hfap->Concatenate(ap->GetMatrix());\n  sliceOrder[\"hfap\"] = hfap;\n\n  vtkNew<vtkTransform> hfpa;\n  hfpa->Concatenate(hf->GetMatrix());\n  hfpa->Concatenate(pa->GetMatrix());\n  sliceOrder[\"hfpa\"] = hfpa;\n\n  vtkNew<vtkTransform> hflr;\n  hflr->Concatenate(hf->GetMatrix());\n  hflr->Concatenate(lr->GetMatrix());\n  sliceOrder[\"\"] = hflr;\n\n  vtkNew<vtkTransform> hfrl;\n  hfrl->Concatenate(hf->GetMatrix());\n  hfrl->Concatenate(rl->GetMatrix());\n  sliceOrder[\"hfrl\"] = hfrl;\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/FrogSlice/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FrogSlice)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FrogSlice: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FrogSlice MACOSX_BUNDLE FrogSlice.cxx )\n  target_link_libraries(FrogSlice PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FrogSlice\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/FrogSlice/#download-and-build-frogslice","title":"Download and Build FrogSlice","text":"

Click here to download FrogSlice and its CMakeLists.txt file. Once the tarball FrogSlice.tar has been downloaded and extracted,

cd FrogSlice/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FrogSlice\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/FroggieSurface/","title":"FroggieSurface","text":"

vtk-examples/Cxx/Visualization/FroggieSurface

"},{"location":"Cxx/Visualization/FroggieSurface/#description","title":"Description","text":"

Construct surfaces from a segmented frog dataset. Up to fifteen different surfaces may be extracted. The example, FroggieView is similar to this example and uses sliders to control the opacities of the tissues.

By default the frog is oriented so that we look down on the dorsal (posterior) surface and the superior surface faces the top of the screen. The frog is rendered with the skin being translucent so that you can see the internal organs.

In the lower left of the image there is a prop assembly with labelled XYZ axes and a cube labelled with anatomical orientations:

  • Sagittal plane
  • L - left
  • R - right
  • Coronal plane
  • A - anterior
  • P - posterior
  • Transverse plane
  • S - superior
  • I - inferior

This prop assembly can be moved and resized.

Individual tissues can be specified by using the \"-t\" option e.g. \"-t skin skeleton\".

We use vtkFlyingEdges3D to take the 3D structured point set and generate the iso-surfaces. However, if desired, you can specify vtkMarchingCubes instead, use the option \"-m\".

The parameters used to generate the example image are loaded from a JSON file containing the data needed to access and generate the actors for each tissue along with other supplementary data such as the data file names. This means that the user need only load this one file in order to generate the data for rendering. This file is called:

<DATA>/Frog_mhd.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see Frog_mhd_format.

The code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder.

The dataset was prepared at the Lawrence Berkeley National Laboratories and is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels.

To accommodate the volume readers in VTK, the mask files were processed and combined into one vtkMetaImageReader file, called frogtissue.mhd. Integer numbers 1-15 are used to represent the 15 tissues. A similar process was done for the frog skin with the result being stored in a file called frog.mhd.

Further information:

  • VTK Examples - FroggieSurface and FroggieView

Info

Mutually exclusive options \"-a, -b, -c, -d\" are provided to let you generate approximations to the following figures: Figure 12-9a, Figure 12-9b, Figure 12-9c, and Figure 12-9d in Chapter 12 of the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/FroggieSurface/#code","title":"Code","text":"

FroggieSurface.cxx

#include <vtkActor.h>\n#include <vtkAnnotatedCubeActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkCameraOrientationWidget.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkDecimatePro.h>\n#include <vtkFlyingEdges3D.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageIslandRemoval2D.h>\n#include <vtkImageShrink3D.h>\n#include <vtkImageThreshold.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMarchingCubes.h>\n#include <vtkMatrix4x4.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProp3D.h>\n#include <vtkPropAssembly.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStripper.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkWindowedSincPolyDataFilter.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <fstream>\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <variant>\n\nnamespace fs = std::filesystem;\n\nnamespace {\nstruct Parameters\n{\n  std::vector<std::string> names;\n  std::map<std::string, std::string> colors;\n  std::map<std::string, std::string> mhdFiles;\n  std::vector<std::string> fig_129b;\n  std::vector<std::string> fig_129cd;\n  std::map<std::string,\n           std::map<std::string, std::variant<int, double, std::string>>>\n      tissues;\n\n  bool parsedOk{false};\n};\n\n/**\n * Take a string and convert it to lowercase.\n *\n * See: https://en.cppreference.com/w/cpp/string/byte/tolower\n * Only works with ASCII characters.\n *\n * @param s: The string to be converted to lowercase.\n *\n * @return The lowercase version of the string.\n */\nstd::string ToLowerCase(std::string s);\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid ParseJSON(const fs::path fnPath, Parameters& parameters);\n\n/**\n * Create the lookup table for the frog tissues.\n *\n * Each table value corresponds the color of one of the frog tissues.\n *\n * @param indices: The tissue name and index.\n * @param colors: The tissue name and color.\n * @return: The lookup table.\n */\nvtkNew<vtkLookupTable>\nCreateTissueLUT(std::map<std::string, int> const& indices,\n                std::map<std::string, std::string>& colors);\n\nclass SliceOrder\n{\n  // clang-format off\n  /*\n    These transformations permute image and other geometric data to maintain\n      proper orientation regardless of the acquisition order. After applying\n      these transforms with vtkTransformFilter, a view up of 0, -1, 0 will\n      result in the body part facing the viewer.\n\n    NOTE: Some transformations have a -1 scale factor for one of the components.\n          To ensure proper polygon orientation and normal direction,\n            you must apply the vtkPolyDataNormals filter.\n\n    Naming (the nomenclature is medical):\n      si - superior to inferior (top to bottom)\n      is - inferior to superior (bottom to top)\n      ap - anterior to posterior (front to back)\n      pa - posterior to anterior (back to front)\n      lr - left to right\n      rl - right to left\n\n    */\n  // clang-format on\n\npublic:\n  /**\n   * Generate the transforms corresponding to the slice order.\n   */\n  SliceOrder();\n\n  virtual ~SliceOrder() = default;\n\npublic:\n  /**\n   * Returns the vtkTransform corresponding to the slice order.\n   *\n   * @param sliceOrder: The slice order.\n   * @return The vtkTransform corresponding to the slice order.\n   */\n  vtkSmartPointer<vtkTransform> Get(std::string const& sliceOrder);\n\n  /**\n   * Print the homogenous matrix corresponding to the slice order.\n   *\n   * @param order: The slice order.\n   */\n  void PrintTransform(std::string const& order);\n\n  /**\n   * Print all the homogenous matrices corresponding to the slice orders.\n   *\n   */\n  void PrintAlltransforms();\n\nprivate:\n  std::map<std::string, vtkSmartPointer<vtkTransform>> transform;\n};\n\n/**\n * Create the actor for a specific tissue.\n *\n * @param name: The tissue name.\n * @param tissue: The tissue parameters.\n * @param files: The path to the tissue files.\n * @param flying_edges: If true use flying edges.\n * @param decimate: If true decimate.\n * @param lut: The color lookup table for the tissues.\n * @param so: The transforms corresponding to the slice order.\n * @param actor: The actor.\n */\nvoid CreateTissueActor(\n    std::string const& name,\n    std::map<std::string, std::variant<int, double, std::string>>& tissue,\n    std::map<std::string, std::string>& files, bool const& flying_edges,\n    bool const& decimate, vtkLookupTable& color_lut, SliceOrder& so,\n    vtkActor* actor);\n\n/**\n * @param scale: Sets the scale and direction of the axes.\n * @param xyzLabels: Labels for the axes.\n * @return The axes actor.\n */\nvtkNew<vtkAxesActor> MakeAxesActor(std::array<double, 3>& scale,\n                                   std::array<std::string, 3> const& xyzLabels);\n\n/**\n * @param cubeLabels: The labels for the cube faces.\n * @param colors: Used to set the colors of the cube faces.\n * @return The annotated cube actor.\n */\nvtkNew<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(std::array<std::string, 6> const& cubeLabels,\n                       vtkNamedColors* colors);\n\n/**\n * @param labelSelector: The selector used to define labels for the axes and\n * cube.\n * @param colors: Used to set the colors of the cube faces.\n * @return The combined axes and annotated cube prop.\n */\nvtkNew<vtkPropAssembly> MakeCubeActor(std::string const& labelSelector,\n                                      vtkNamedColors* colors);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Construct surfaces from a segmented frog dataset.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file e.g. Frog_mhd.json.\")\n      ->required()\n      ->check(CLI::ExistingFile);\n\n  bool flyingEdges = true;\n  app.add_flag(\"-m{false},!-n\", flyingEdges,\n               \"Use flying edges by default, marching cubes if set.\");\n  bool decimation{false};\n  // -o: obliterate a synonym for decimation.\n  app.add_flag(\"-o\", decimation, \"Decimate if set.\");\n\n  std::vector<std::string> chosenTissues;\n  app.add_option(\"-t\", chosenTissues, \"Select one or more tissues.\");\n\n  std::array<bool, 6> view{false, false, false, false, false, false};\n  auto* ogroup =\n      app.add_option_group(\"view\",\n                           \"Select the orientation of the frog. Only none or \"\n                           \"one of these can be selected.\");\n  ogroup->add_flag(\"-a\", view[0],\n                   \"The view corresponds to Fig 12-9a in the VTK Textbook\");\n  ogroup->add_flag(\"-b\", view[1],\n                   \"The view corresponds to Fig 12-9b in the VTK Textbook\");\n  ogroup->add_flag(\"-c\", view[2],\n                   \"The view corresponds to Fig 12-9c in the VTK Textbook\");\n  ogroup->add_flag(\"-d\", view[3],\n                   \"The view corresponds to Fig 12-9d in the VTK Textbook\");\n  ogroup->add_flag(\n      \"-l\", view[4],\n      \"The view corresponds to looking down on the anterior surface\");\n  ogroup->add_flag(\"-p\", view[5],\n                   \"The view corresponds to looking down on the posterior \"\n                   \"surface (the default)\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto selectCount = std::count_if(view.begin(), view.end(),\n                                   [=](const bool& e) { return e == true; });\n  if (selectCount > 1)\n  {\n    std::cerr << \"Only one or none of the options -a, -b, -c, -d, -l, -p can \"\n                 \"be selected;\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  ParseJSON(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  std::vector<std::string> tissues;\n  std::map<std::string, int> indices;\n\n  for (auto const& n : parameters.names)\n  {\n    if (n != \"brainbin\")\n    {\n      tissues.push_back(n);\n      indices[n] = *std::get_if<int>(&parameters.tissues[n][\"tissue\"]);\n    }\n  }\n  auto lut = CreateTissueLUT(indices, parameters.colors);\n\n  char selectFigure{'\\0'};\n  if (selectCount == 1)\n  {\n    if (view[0])\n    {\n      selectFigure = 'a';\n    }\n    else if (view[1])\n    {\n      // No skin.\n      tissues = parameters.fig_129b;\n      selectFigure = 'b';\n    }\n    else if (view[2])\n    {\n      // No skin, blood and skeleton.\n      tissues = parameters.fig_129cd;\n      selectFigure = 'c';\n    }\n    else if (view[3])\n    {\n      // No skin, blood and skeleton.\n      tissues = parameters.fig_129cd;\n      selectFigure = 'd';\n    }\n    else if (view[4])\n    {\n      // Looking down on the anterior surface.\n      selectFigure = 'l';\n    }\n    else // The default\n    {\n      // Looking down on the posterior surface.\n      selectFigure = 'p';\n    }\n  }\n\n  if (!chosenTissues.empty())\n  {\n    for (auto i = 0; i < chosenTissues.size(); ++i)\n    {\n      chosenTissues[i] = ToLowerCase(chosenTissues[i]);\n    }\n    std::vector<std::string> res;\n    auto has_brainbin{false};\n    if (std::find(chosenTissues.begin(), chosenTissues.end(), \"brainbin\") !=\n        chosenTissues.end())\n    {\n      std::cout << \"Using brainbin instead of brain.\" << std::endl;\n      res.push_back(\"brainbin\");\n      indices.erase(\"brain\");\n      indices[\"brainbin\"] = 2;\n      parameters.colors.erase(\"brain\");\n      parameters.colors[\"brainbin\"] = \"beige\";\n      has_brainbin = true;\n    }\n    for (auto const& ct : chosenTissues)\n    {\n      if (has_brainbin && (ct == \"brain\" || ct == \"brainbin\"))\n      {\n        continue;\n      }\n      if (std::find(tissues.begin(), tissues.end(), ct) != tissues.end())\n      {\n        res.push_back(ct);\n      }\n      else\n      {\n        std::cout << \"Tissue: \" << ct << \" is not available.\" << std::endl;\n        return EXIT_FAILURE;\n      }\n    }\n    if (res.size() == 1 && res[0] == \"skin\")\n    {\n      parameters.tissues[\"skin\"][\"opacity\"] = 1.0;\n    }\n    tissues = res;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"ParaViewBkg\",\n                   std::array<unsigned char, 4>{82, 87, 110, 255}.data());\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  SliceOrder so;\n  // so.PrintAlltransforms();\n\n  size_t colorSize{0};\n  for (auto const& p : parameters.colors)\n  {\n    colorSize = std::max(colorSize, p.second.size());\n  }\n  size_t nameSize{0};\n  for (auto const& p : parameters.names)\n  {\n    nameSize = std::max(nameSize, p.size());\n  }\n\n  std::string line(7 + nameSize + colorSize, '-');\n\n  std::cout << line << '\\n'\n            << std::setw(nameSize) << std::left << \"Tissue\"\n            << \" Label \"\n            << \"Color\" << '\\n'\n            << line << std::endl;\n  auto intSize = 2;\n\n  for (auto const& name : tissues)\n  {\n    vtkNew<vtkActor> actor;\n    CreateTissueActor(name, parameters.tissues[name], parameters.mhdFiles,\n                      flyingEdges, decimation, *lut, so, actor);\n    ren->AddActor(actor);\n    std::cout << std::setw(nameSize) << std::left << name << \" \"\n              << std::setw(intSize + 3) << std::right << indices[name] << \" \"\n              << std::setw(colorSize) << std::left << parameters.colors[name]\n              << std::endl;\n  }\n  std::cout << line << std::endl;\n\n  renWin->SetSize(1024, 1024);\n  renWin->SetWindowName(\"FroggieSurface\");\n\n  ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n\n  auto camera = ren->GetActiveCamera();\n  // Superior Anterior Left\n  auto labels{\"sal\"};\n  if (selectFigure == 'a')\n  {\n    // Fig 12-9a in the VTK Textbook\n    camera->SetPosition(742.731237, -441.329635, -877.192015);\n    camera->SetFocalPoint(247.637687, 120.680880, -253.487473);\n    camera->SetViewUp(-0.323882, -0.816232, 0.478398);\n    camera->SetDistance(974.669585);\n    camera->SetClippingRange(311.646383, 1803.630763);\n  }\n  else if (selectFigure == 'b')\n  {\n    // Fig 12-9b in the VTK Textbook\n    camera->SetPosition(717.356065, -429.889054, -845.381584);\n    camera->SetFocalPoint(243.071719, 100.996487, -247.446340);\n    camera->SetViewUp(-0.320495, -0.820148, 0.473962);\n    camera->SetDistance(929.683631);\n    camera->SetClippingRange(293.464446, 1732.794957);\n  }\n  else if (selectFigure == 'c')\n  {\n    // Fig 12-9c in the VTK Textbook\n    camera->SetPosition(447.560023, -136.611491, -454.753689);\n    camera->SetFocalPoint(253.142277, 91.949451, -238.583973);\n    camera->SetViewUp(-0.425438, -0.786048, 0.448477);\n    camera->SetDistance(369.821187);\n    camera->SetClippingRange(0.829116, 829.115939);\n  }\n  else if (selectFigure == 'd')\n  {\n    // Fig 12-9d in the VTK Textbook\n    camera->SetPosition(347.826249, -469.633647, -236.234262);\n    camera->SetFocalPoint(296.893207, 89.307704, -225.156581);\n    camera->SetViewUp(-0.687345, -0.076948, 0.722244);\n    camera->SetDistance(561.366478);\n    camera->SetClippingRange(347.962064, 839.649856);\n  }\n  else if (selectFigure == 'l')\n  {\n    // Orient so that we look down on the anterior surface and\n    //  the superior surface faces the top of the screen.\n    // Left Superior Anterior\n    labels = \"lsa\";\n    vtkNew<vtkTransform> transform;\n    transform->SetMatrix(camera->GetModelTransformMatrix());\n    transform->RotateY(90);\n    transform->RotateZ(90);\n    camera->SetModelTransformMatrix(transform->GetMatrix());\n    ren->ResetCamera();\n  }\n  else\n  {\n    // Orient so that we look down on the posterior surface and\n    //  the superior surface faces the top of the screen.\n    // Right Superior Posterior\n    labels = \"rsp\";\n    vtkNew<vtkTransform> transform;\n    transform->SetMatrix(camera->GetModelTransformMatrix());\n    transform->RotateY(-90);\n    transform->RotateZ(90);\n    camera->SetModelTransformMatrix(transform->GetMatrix());\n    ren->ResetCamera();\n  }\n\n  vtkNew<vtkCameraOrientationWidget> cow;\n  cow->SetParentRenderer(ren);\n  // Turn off if you do not want it.\n  cow->On();\n  cow->EnabledOn();\n\n  auto axes = MakeCubeActor(labels, colors);\n  vtkNew<vtkOrientationMarkerWidget> om;\n  om->SetOrientationMarker(axes);\n  // Position upper left in the viewport.\n  // om->SetViewport(0.0, 0.8, 0.2, 1.0);\n  // Position lower left in the viewport.\n  om->SetViewport(0, 0, 0.2, 0.2);\n  om->SetInteractor(iRen);\n  om->EnabledOn();\n  om->InteractiveOn();\n\n  renWin->Render();\n\n  iRen->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::string ToLowerCase(std::string s)\n{\n  std::transform(s.begin(), s.end(), s.begin(),\n                 [](unsigned char c) { return std::tolower(c); } // correct\n  );\n  return s;\n}\n\nvoid ParseJSON(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Get the parameters that we need.\n  fs::path mhdPath;\n  std::vector<std::string> fileNames;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (outer.name() == \"files\")\n    {\n      std::string path;\n      for (Json::Value::const_iterator pth = root[\"files\"].begin();\n           pth != root[\"files\"].end(); ++pth)\n      {\n        if (pth.name() == \"root\")\n        {\n          mhdPath = fs::path(pth->asString());\n        }\n        if (pth.name() == \"mhd_files\")\n        {\n          for (Json::Value::const_iterator fls =\n                   root[\"files\"][\"mhd_files\"].begin();\n               fls != root[\"files\"][\"mhd_files\"].end(); ++fls)\n          {\n            fileNames.push_back(fls->asString());\n          }\n        }\n      }\n    }\n    if (outer.name() == \"tissues\")\n    {\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"colors\"].begin();\n           tc != root[\"tissues\"][\"colors\"].end(); ++tc)\n      {\n        parameters.colors[tc.name()] = tc->asString();\n      }\n    }\n    if (outer.name() == \"figures\")\n    {\n      for (Json::Value::const_iterator c = root[\"figures\"][\"fig12-9b\"].begin();\n           c != root[\"figures\"][\"fig12-9b\"].end(); ++c)\n      {\n        parameters.fig_129b.push_back(c->asString());\n      }\n      for (Json::Value::const_iterator c = root[\"figures\"][\"fig12-9cd\"].begin();\n           c != root[\"figures\"][\"fig12-9cd\"].end(); ++c)\n      {\n        parameters.fig_129cd.push_back(c->asString());\n      }\n    }\n    if (outer.name() == \"tissue_parameters\")\n    {\n      // A map of the parameters and the type of the parameter.\n      std::map<std::string, std::string> parameterTypes;\n      for (Json::Value::const_iterator p =\n               root[\"tissue_parameters\"][\"parameter types\"].begin();\n           p != root[\"tissue_parameters\"][\"parameter types\"].end(); ++p)\n      {\n        parameterTypes[p.name()] = p->asString();\n      }\n\n      // Map a variant of the correct type to the parameter name.\n      // parameterTypes: A map of the parameters and the type of the parameter.\n      // p: The Json iterator\n      // kv: The map of the parameter name (ket) and\n      //     the vatiant of the correct type (value).\n      auto populate =\n          [&parameterTypes](\n              Json::Value::const_iterator& p,\n              std::map<std::string, std::variant<int, double, std::string>>&\n                  kv) {\n            std::string n = p.name();\n            if (parameterTypes.find(n) == parameterTypes.end())\n            {\n              std::cout << \"We cannot determine the type for \" << n\n                        << std::endl;\n              return;\n            }\n            if (parameterTypes[p.name()] == \"int\")\n            {\n              kv[ToLowerCase(p.name())] = p->asInt();\n            }\n            if (parameterTypes[p.name()] == \"dbl\")\n            {\n              kv[ToLowerCase(p.name())] = p->asDouble();\n            }\n            if (parameterTypes[p.name()] == \"str\")\n            {\n              kv[ToLowerCase(p.name())] = p->asString();\n            }\n          };\n\n      std::map<std::string, std::variant<int, double, std::string>> bp;\n      for (Json::Value::const_iterator p =\n               root[\"tissue_parameters\"][\"default\"].begin();\n           p != root[\"tissue_parameters\"][\"default\"].end(); ++p)\n      {\n        populate(p, bp);\n      }\n      for (Json::Value::const_iterator p =\n               root[\"tissue_parameters\"][\"frog\"].begin();\n           p != root[\"tissue_parameters\"][\"frog\"].end(); ++p)\n      {\n        populate(p, bp);\n      }\n      std::set<std::string> exclude{\"default\", \"frog\", \"parameter types\"};\n      for (Json::Value::const_iterator p = root[\"tissue_parameters\"].begin();\n           p != root[\"tissue_parameters\"].end(); ++p)\n      {\n        if (exclude.find(p.name()) != exclude.end())\n        {\n          continue;\n        }\n        std::map<std::string, std::variant<int, double, std::string>> tmp;\n        std::copy(bp.begin(), bp.end(), std::inserter(tmp, tmp.end()));\n        for (Json::Value::const_iterator q =\n                 root[\"tissue_parameters\"][p.name()].begin();\n             q != root[\"tissue_parameters\"][p.name()].end(); ++q)\n        {\n          populate(q, tmp);\n        }\n        parameters.tissues[p.name()] = tmp;\n        parameters.names.push_back(p.name());\n      }\n    }\n  }\n\n  //  Build and check the paths.\n  if (!fileNames.empty())\n  {\n    if (fileNames.size() != 2)\n    {\n      std::cerr << \"Expected two file names.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < fileNames.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / mhdPath / fs::path(fileNames[i]);\n        fileNames[i] = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << fileNames[i]\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.mhdFiles[pth.stem().string()] =\n              pth.make_preferred().string();\n        }\n      }\n    }\n  }\n  else\n  {\n    std::cerr << \"Expected .mhd file names in the JSON file.\";\n    parameters.parsedOk = false;\n  }\n}\n\nvtkNew<vtkLookupTable>\nCreateTissueLUT(std::map<std::string, int> const& indices,\n                std::map<std::string, std::string>& colors)\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(colors.size());\n  lut->SetTableRange(0, colors.size() - 1);\n  lut->Build();\n\n  vtkNew<vtkNamedColors> nc;\n\n  for (auto const& p : indices)\n  {\n    lut->SetTableValue(p.second, nc->GetColor4d(colors[p.first]).GetData());\n  }\n\n  return lut;\n}\n\nSliceOrder::SliceOrder()\n{\n  vtkNew<vtkMatrix4x4> si_mat;\n  si_mat->Zero();\n  si_mat->SetElement(0, 0, 1);\n  si_mat->SetElement(1, 2, 1);\n  si_mat->SetElement(2, 1, -1);\n  si_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> is_mat;\n  is_mat->Zero();\n  is_mat->SetElement(0, 0, 1);\n  is_mat->SetElement(1, 2, -1);\n  is_mat->SetElement(2, 1, -1);\n  is_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> lr_mat;\n  lr_mat->Zero();\n  lr_mat->SetElement(0, 2, -1);\n  lr_mat->SetElement(1, 1, -1);\n  lr_mat->SetElement(2, 0, 1);\n  lr_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> rl_mat;\n  rl_mat->Zero();\n  rl_mat->SetElement(0, 2, 1);\n  rl_mat->SetElement(1, 1, -1);\n  rl_mat->SetElement(2, 0, 1);\n  rl_mat->SetElement(3, 3, 1);\n\n  // The previous transforms assume radiological views of the slices\n  //  (viewed from the feet).\n  // Other modalities such as physical sectioning may view from the head.\n  // The following transforms modify the original with a 180\u00b0 rotation about y\n\n  vtkNew<vtkMatrix4x4> hf_mat;\n  hf_mat->Zero();\n  hf_mat->SetElement(0, 0, -1);\n  hf_mat->SetElement(1, 1, 1);\n  hf_mat->SetElement(2, 2, -1);\n  hf_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkTransform> si_trans;\n  si_trans->SetMatrix(si_mat);\n  this->transform[\"si\"] = si_trans;\n\n  vtkNew<vtkTransform> is_trans;\n  is_trans->SetMatrix(is_mat);\n  this->transform[\"is\"] = is_trans;\n\n  vtkNew<vtkTransform> ap_trans;\n  ap_trans->Scale(1, -1, 1);\n  this->transform[\"ap\"] = ap_trans;\n\n  vtkNew<vtkTransform> pa_trans;\n  pa_trans->Scale(1, -1, -1);\n  this->transform[\"pa\"] = pa_trans;\n\n  vtkNew<vtkTransform> lr_trans;\n  lr_trans->SetMatrix(lr_mat);\n  this->transform[\"lr\"] = lr_trans;\n\n  vtkNew<vtkTransform> rl_trans;\n  lr_trans->SetMatrix(rl_mat);\n  this->transform[\"rl\"] = rl_trans;\n\n  vtkNew<vtkTransform> hf_trans;\n  hf_trans->SetMatrix(hf_mat);\n  this->transform[\"hf\"] = hf_trans;\n\n  vtkNew<vtkTransform> hf_si_trans;\n  hf_si_trans->SetMatrix(hf_mat);\n  hf_si_trans->Concatenate(si_mat);\n  this->transform[\"hfsi\"] = hf_si_trans;\n\n  vtkNew<vtkTransform> hf_is_trans;\n  hf_is_trans->SetMatrix(hf_mat);\n  hf_is_trans->Concatenate(is_mat);\n  this->transform[\"hfis\"] = hf_is_trans;\n\n  vtkNew<vtkTransform> hf_ap_trans;\n  hf_ap_trans->SetMatrix(hf_mat);\n  hf_ap_trans->Scale(1, -1, 1);\n  this->transform[\"hfap\"] = hf_ap_trans;\n\n  vtkNew<vtkTransform> hf_pa_trans;\n  hf_pa_trans->SetMatrix(hf_mat);\n  hf_pa_trans->Scale(1, -1, -1);\n  this->transform[\"hfpa\"] = hf_pa_trans;\n\n  vtkNew<vtkTransform> hf_lr_trans;\n  hf_lr_trans->SetMatrix(hf_mat);\n  hf_lr_trans->Concatenate(lr_mat);\n  this->transform[\"hflr\"] = hf_lr_trans;\n\n  vtkNew<vtkTransform> hf_rl_trans;\n  hf_rl_trans->SetMatrix(hf_mat);\n  hf_rl_trans->Concatenate(rl_mat);\n  this->transform[\"hfrl\"] = hf_rl_trans;\n\n  // Identity\n  this->transform[\"I\"] = vtkNew<vtkTransform>();\n\n  // Zero\n  vtkNew<vtkTransform> z_trans;\n  z_trans->Scale(0, 0, 0);\n  this->transform[\"Z\"] = z_trans;\n}\n\nvoid SliceOrder::PrintTransform(std::string const& order)\n{\n  auto m = this->transform[order]->GetMatrix();\n  std::ostringstream os;\n  os.setf(std::ios_base::fmtflags(), std::ios_base::floatfield);\n  os << order << '\\n';\n  for (int i = 0; i < 4; ++i)\n  {\n    for (int j = 0; j < 4; ++j)\n    {\n      if (j < 3)\n      {\n        os << std::setw(6) << std::right << std::setprecision(2)\n           << m->GetElement(i, j) << \" \";\n      }\n      else\n      {\n        os << std::setw(6) << std::right << m->GetElement(i, j) << '\\n';\n      }\n    }\n  }\n  std::cout << os.str() << '\\n';\n  os.str(\"\");\n}\n\nvoid SliceOrder::PrintAlltransforms()\n{\n  for (auto const p : this->transform)\n  {\n    PrintTransform(p.first);\n  }\n}\n\nvtkSmartPointer<vtkTransform> SliceOrder::Get(std::string const& sliceOrder)\n{\n  return this->transform[sliceOrder];\n}\n\nvoid CreateTissueActor(\n    std::string const& name,\n    std::map<std::string, std::variant<int, double, std::string>>& tissue,\n    std::map<std::string, std::string>& files, bool const& flying_edges,\n    bool const& decimate, vtkLookupTable& color_lut, SliceOrder& so,\n    vtkActor* actor)\n{\n\n  auto pixelSize = *std::get_if<int>(&tissue[\"pixel_size\"]);\n  auto spacing = *std::get_if<double>(&tissue[\"spacing\"]);\n  auto startSlice = *std::get_if<int>(&tissue[\"start_slice\"]);\n  std::array<double, 3> dataSpacing{static_cast<double>(pixelSize),\n                                    static_cast<double>(pixelSize), spacing};\n  auto columns = *std::get_if<int>(&tissue[\"columns\"]);\n  auto rows = *std::get_if<int>(&tissue[\"rows\"]);\n  std::array<double, 3> dataOrigin = {-(columns / 2.0) * pixelSize,\n                                      -(rows / 2.0) * pixelSize,\n                                      startSlice * spacing};\n  std::array<int, 6> voi;\n  voi[0] = *std::get_if<int>(&tissue[\"start_column\"]);\n  voi[1] = *std::get_if<int>(&tissue[\"end_column\"]);\n  voi[2] = *std::get_if<int>(&tissue[\"start_row\"]);\n  voi[3] = *std::get_if<int>(&tissue[\"end_row\"]);\n  voi[4] = *std::get_if<int>(&tissue[\"start_slice\"]);\n  voi[5] = *std::get_if<int>(&tissue[\"end_slice\"]);\n  // Adjust y bounds for PNM coordinate system.\n  auto tmp = voi[2];\n  voi[2] = rows - voi[3] - 1;\n  voi[3] = rows - tmp - 1;\n\n  std::string fn;\n  if (name == \"skin\")\n  {\n    fn = files[\"frog\"];\n  }\n  else\n  {\n    fn = files[\"frogtissue\"];\n  }\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(fn.c_str());\n  reader->SetDataSpacing(dataSpacing.data());\n  reader->SetDataOrigin(dataOrigin.data());\n  reader->SetDataExtent(voi.data());\n  reader->Update();\n\n  // These are used to determine what filters\n  // to use based on the options chosen.\n  auto islandRemoverFlag{false};\n  auto selectTissueFlag{false};\n  auto gaussianFlag{false};\n\n  vtkNew<vtkImageIslandRemoval2D> islandRemover;\n  vtkNew<vtkImageThreshold> selectTissue;\n  if (name != \"skin\")\n  {\n    auto ir = *std::get_if<double>(&tissue[\"island_replace\"]);\n    auto ia = *std::get_if<double>(&tissue[\"island_area\"]);\n    auto idx = *std::get_if<int>(&tissue[\"tissue\"]);\n    if (ir > 0)\n    {\n      islandRemover->SetAreaThreshold(ia);\n      islandRemover->SetIslandValue(ir);\n      islandRemover->SetReplaceValue(idx);\n      islandRemover->SetInputConnection(reader->GetOutputPort());\n      islandRemover->Update();\n      islandRemoverFlag = true;\n    }\n    selectTissue->ThresholdBetween(idx, idx);\n    selectTissue->SetInValue(255);\n    selectTissue->SetOutValue(0);\n    if (islandRemoverFlag)\n    {\n      selectTissue->SetInputConnection(islandRemover->GetOutputPort());\n    }\n    else\n    {\n      selectTissue->SetInputConnection(reader->GetOutputPort());\n    }\n    selectTissue->Update();\n    selectTissueFlag = true;\n  }\n\n  std::array<int, 3> sampleRate;\n  sampleRate[0] = *std::get_if<int>(&tissue[\"sample_rate_column\"]);\n  sampleRate[1] = *std::get_if<int>(&tissue[\"sample_rate_row\"]);\n  sampleRate[2] = *std::get_if<int>(&tissue[\"sample_rate_slice\"]);\n  vtkNew<vtkImageShrink3D> shrinker;\n  if (selectTissueFlag)\n  {\n    shrinker->SetInputConnection(selectTissue->GetOutputPort());\n  }\n  else\n  {\n    shrinker->SetInputConnection(reader->GetOutputPort());\n  }\n  shrinker->SetShrinkFactors(sampleRate.data());\n  shrinker->AveragingOn();\n  shrinker->Update();\n\n  std::array<double, 3> gsd;\n  gsd[0] = *std::get_if<double>(&tissue[\"gaussian_standard_deviation_column\"]);\n  gsd[1] = *std::get_if<double>(&tissue[\"gaussian_standard_deviation_row\"]);\n  gsd[2] = *std::get_if<double>(&tissue[\"gaussian_standard_deviation_slice\"]);\n\n  vtkNew<vtkImageGaussianSmooth> gaussian;\n\n  bool allZero =\n      std::all_of(gsd.begin(), gsd.end(), [](double i) { return i == 0; });\n  if (!allZero)\n  {\n    std::array<double, 3> grf;\n    grf[0] = *std::get_if<double>(&tissue[\"gaussian_radius_factor_column\"]);\n    grf[1] = *std::get_if<double>(&tissue[\"gaussian_radius_factor_row\"]);\n    grf[2] = *std::get_if<double>(&tissue[\"gaussian_radius_factor_slice\"]);\n\n    gaussian->SetStandardDeviations(gsd.data());\n    gaussian->SetRadiusFactors(grf.data());\n    gaussian->SetInputConnection(shrinker->GetOutputPort());\n    gaussian->Update();\n    gaussianFlag = true;\n  }\n\n  auto iso_value = *std::get_if<double>(&tissue[\"value\"]);\n  vtkNew<vtkFlyingEdges3D> flyingIsoSurface;\n  vtkNew<vtkMarchingCubes> marchingIsoSurface;\n  if (flying_edges)\n  {\n    if (gaussianFlag)\n    {\n      flyingIsoSurface->SetInputConnection(gaussian->GetOutputPort());\n    }\n    else\n    {\n      flyingIsoSurface->SetInputConnection(shrinker->GetOutputPort());\n    }\n    flyingIsoSurface->ComputeScalarsOff();\n    flyingIsoSurface->ComputeGradientsOff();\n    flyingIsoSurface->ComputeNormalsOff();\n    flyingIsoSurface->SetValue(0, iso_value);\n    flyingIsoSurface->Update();\n  }\n  else\n  {\n    if (gaussianFlag)\n    {\n      marchingIsoSurface->SetInputConnection(gaussian->GetOutputPort());\n    }\n    else\n    {\n      marchingIsoSurface->SetInputConnection(shrinker->GetOutputPort());\n    }\n    marchingIsoSurface->ComputeScalarsOff();\n    marchingIsoSurface->ComputeGradientsOff();\n    marchingIsoSurface->ComputeNormalsOff();\n    marchingIsoSurface->SetValue(0, iso_value);\n    marchingIsoSurface->Update();\n  }\n\n  auto sliceOrder = *std::get_if<std::string>(&tissue[\"slice_order\"]);\n  auto transform = vtkSmartPointer<vtkTransform>::New();\n  transform = so.Get(sliceOrder);\n  vtkNew<vtkTransformPolyDataFilter> tf;\n  tf->SetTransform(transform);\n  if (flying_edges)\n  {\n    tf->SetInputConnection(flyingIsoSurface->GetOutputPort());\n  }\n  else\n  {\n    tf->SetInputConnection(marchingIsoSurface->GetOutputPort());\n  }\n\n  vtkNew<vtkDecimatePro> decimator;\n  if (decimate)\n  {\n    auto decimateAngle = *std::get_if<double>(&tissue[\"decimate_angle\"]);\n    auto decimateError = *std::get_if<double>(&tissue[\"decimate_error\"]);\n    auto decimateReduction =\n        *std::get_if<double>(&tissue[\"decimate_reduction\"]);\n    decimator->SetInputConnection(tf->GetOutputPort());\n    decimator->SetFeatureAngle(decimateAngle);\n    decimator->PreserveTopologyOn();\n    decimator->SetErrorIsAbsolute(1);\n    decimator->SetAbsoluteError(decimateError);\n    decimator->SetTargetReduction(decimateReduction);\n  }\n\n  vtkNew<vtkWindowedSincPolyDataFilter> smoother;\n  auto smoothIterations = *std::get_if<int>(&tissue[\"smooth_iterations\"]);\n  if (smoothIterations != 0)\n  {\n    auto smoothAngle = *std::get_if<double>(&tissue[\"smooth_angle\"]);\n    auto smoothFactor = *std::get_if<double>(&tissue[\"smooth_factor\"]);\n    if (decimate)\n    {\n      smoother->SetInputConnection(decimator->GetOutputPort());\n    }\n    else\n    {\n      smoother->SetInputConnection(tf->GetOutputPort());\n    }\n    smoother->SetNumberOfIterations(smoothIterations);\n    smoother->BoundarySmoothingOff();\n    smoother->FeatureEdgeSmoothingOff();\n    smoother->SetFeatureAngle(smoothAngle);\n    smoother->SetPassBand(smoothFactor);\n    smoother->NonManifoldSmoothingOn();\n    smoother->NormalizeCoordinatesOff();\n    smoother->Update();\n  }\n\n  auto featureAngle = *std::get_if<double>(&tissue[\"feature_angle\"]);\n  vtkNew<vtkPolyDataNormals> normals;\n  if (smoothIterations != 0)\n  {\n    normals->SetInputConnection(smoother->GetOutputPort());\n  }\n  else\n  {\n    if (decimate)\n    {\n      normals->SetInputConnection(decimator->GetOutputPort());\n    }\n    else\n    {\n      normals->SetInputConnection(tf->GetOutputPort());\n    }\n  }\n  normals->SetFeatureAngle(featureAngle);\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(stripper->GetOutputPort());\n\n  auto opacity = *std::get_if<double>(&tissue[\"opacity\"]);\n  auto tissue_color =\n      color_lut.GetTableValue(*std::get_if<int>(&tissue[\"tissue\"]));\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetOpacity(opacity);\n  actor->GetProperty()->SetDiffuseColor(tissue_color);\n  actor->GetProperty()->SetSpecular(0.5);\n  actor->GetProperty()->SetSpecularPower(10);\n}\n\nvtkNew<vtkAxesActor> MakeAxesActor(std::array<double, 3>& scale,\n                                   std::array<std::string, 3> const& xyzLabels)\n{\n  vtkNew<vtkAxesActor> axes;\n  axes->SetScale(scale.data());\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(xyzLabels[0].c_str());\n  axes->SetYAxisLabelText(xyzLabels[1].c_str());\n  axes->SetZAxisLabelText(xyzLabels[2].c_str());\n  axes->SetCylinderRadius(0.5 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.025 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.5 * axes->GetSphereRadius());\n  auto tprop = axes->GetXAxisCaptionActor2D()->GetCaptionTextProperty();\n  tprop->ItalicOn();\n  tprop->ShadowOn();\n  tprop->SetFontFamilyToTimes();\n  // Use the same text properties on the other two axes.\n  axes->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  axes->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  return axes;\n}\n\nvtkNew<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(std::array<std::string, 6> const& cubeLabels,\n                       vtkNamedColors* colors)\n{\n  // A cube with labeled faces.\n  vtkNew<vtkAnnotatedCubeActor> cube;\n  cube->SetXPlusFaceText(cubeLabels[0].c_str());\n  cube->SetXMinusFaceText(cubeLabels[1].c_str());\n  cube->SetYPlusFaceText(cubeLabels[2].c_str());\n  cube->SetYMinusFaceText(cubeLabels[3].c_str());\n  cube->SetZPlusFaceText(cubeLabels[4].c_str());\n  cube->SetZMinusFaceText(cubeLabels[5].c_str());\n  cube->SetFaceTextScale(0.5);\n  cube->GetCubeProperty()->SetColor(colors->GetColor3d(\"Gainsboro\").GetData());\n\n  cube->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Change the vector text colors.\n  cube->GetXPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetXMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetYPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetYMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetZPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  cube->GetZMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  return cube;\n}\n\nvtkNew<vtkPropAssembly> MakeCubeActor(std::string const& labelSelector,\n                                      vtkNamedColors* colors)\n{\n  std::array<std::string, 3> xyzLabels;\n  std::array<std::string, 6> cubeLabels;\n  std::array<double, 3> scale;\n  if (labelSelector == \"sal\")\n  {\n    // xyzLabels = std::array<std::string,3>{\"S\", \"A\", \"L\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"S\", \"I\", \"A\", \"P\", \"L\", \"R\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else if (labelSelector == \"rsp\")\n  {\n    // xyzLabels = std::array<std::string, 3>{\"R\", \"S\", \"P\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"R\", \"L\", \"S\", \"I\", \"P\", \"A\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else if (labelSelector == \"lsa\")\n  {\n    // xyzLabels = std::array<std::string, 3>{\"L\", \"S\", \"A\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"L\", \"R\", \"S\", \"I\", \"A\", \"P\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else\n  {\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"+X\", \"-X\", \"+Y\", \"-Y\", \"+Z\", \"-Z\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n\n  // We are combining a vtkAxesActor and a vtkAnnotatedCubeActor\n  // into a vtkPropAssembly\n  auto cube = MakeAnnotatedCubeActor(cubeLabels, colors);\n  auto axes = MakeAxesActor(scale, xyzLabels);\n\n  // Combine orientation markers into one with an assembly.\n  vtkNew<vtkPropAssembly> assembly;\n  assembly->AddPart(axes);\n  assembly->AddPart(cube);\n  return assembly;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/FroggieSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FroggieSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonMath\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  ImagingMorphological\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FroggieSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FroggieSurface MACOSX_BUNDLE FroggieSurface.cxx )\n  target_link_libraries(FroggieSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FroggieSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/FroggieSurface/#download-and-build-froggiesurface","title":"Download and Build FroggieSurface","text":"

Click here to download FroggieSurface and its CMakeLists.txt file. Once the tarball FroggieSurface.tar has been downloaded and extracted,

cd FroggieSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FroggieSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/FroggieView/","title":"FroggieView","text":"

vtk-examples/Cxx/Visualization/FroggieView

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/FroggieView/#description","title":"Description","text":"

View surfaces of a segmented frog dataset using preprocessed *.vtk tissue files. This means that loading and processing is much faster when comapred with FroggieSurface.

FroggieView provides the ability to turn on and off surfaces, control their opacity through the use of sliders and control the camera position.

By default the frog is oriented so that we look down on the dorsal (posterior) surface and the superior surface faces the top of the screen. The frog is rendered with the skin being translucent so that you can see the internal organs.

In the lower left of the image there is a prop assembly with labelled XYZ axes and a cube labelled with anatomical orientations:

  • Sagittal plane
  • L - left
  • R - right
  • Coronal plane
  • A - anterior
  • P - posterior
  • Transverse plane
  • S - superior
  • I - inferior

This prop assembly can be moved and resized.

The opacity of each tissue is controlled by a slider, additionally you can turn all the sliders on or off by pressing the \"n\" key.

If the option \"-n\" is selected, no sliders will displayed.

Individual tissues can be specified by using the \"-t\" option e.g. \"-t skin skeleton\".

The parameters used to generate the example image are loaded from a JSON file containing the data needed to access and generate the actors for each tissue along with other supplementary data such as the data file names. This means that the user need only load this one file in order to generate the data for rendering. This file is called:

<DATA>/Frog_vtk.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see Frog_vtk_format.

The code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder.

The dataset was prepared at the Lawrence Berkeley National Laboratories. It is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels.

Further information:

  • VTK Examples - FroggieSurface and FroggieView

Info

Mutually exclusive options \"-a -b -c -d\" are provided to let you generate approximations to the following figures: Figure 12-9a, Figure 12-9b, Figure 12-9c, and Figure 12-9d in Chapter 12 of the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/FroggieView/#code","title":"Code","text":"

FroggieView.cxx

#include <vtkActor.h>\n#include <vtkAnnotatedCubeActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCameraOrientationWidget.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProp3D.h>\n#include <vtkPropAssembly.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <fstream>\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace fs = std::filesystem;\n\nnamespace {\nstruct Parameters\n{\n  std::vector<std::string> names;\n  std::map<std::string, std::string> colors;\n  std::map<std::string, int> indices;\n  std::map<std::string, std::string> orientation;\n  std::map<std::string, double> opacity;\n  std::map<std::string, std::string> vtkFiles;\n  std::vector<std::string> fig_129b;\n  std::vector<std::string> fig_129cd;\n\n  bool parsedOk{false};\n};\n\n/**\n * Take a string and convert it to lowercase.\n *\n * See: https://en.cppreference.com/w/cpp/string/byte/tolower\n * Only works with ASCII characters.\n *\n * @param s: The string to be converted to lowercase.\n *\n * @return The lowercase version of the string.\n */\nstd::string ToLowerCase(std::string s);\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid ParseJSON(const fs::path fnPath, Parameters& parameters);\n\n/**\n * Create the lookup table for the frog tissues.\n *\n * Each table value corresponds the color of one of the frog tissues.\n *\n * @param indices: The tissue name and index.\n * @param colors: The tissue name and color.\n * @return: The lookup table.\n */\nvtkNew<vtkLookupTable>\nCreateTissueLUT(std::map<std::string, int> const& indices,\n                std::map<std::string, std::string>& colors);\n\nclass SliceOrder\n{\n  // clang-format off\n  /*\n    These transformations permute image and other geometric data to maintain\n      proper orientation regardless of the acquisition order. After applying\n      these transforms with vtkTransformFilter, a view up of 0, -1, 0 will\n      result in the body part facing the viewer.\n\n    NOTE: Some transformations have a -1 scale factor for one of the components.\n          To ensure proper polygon orientation and normal direction,\n            you must apply the vtkPolyDataNormals filter.\n\n    Naming (the nomenclature is medical):\n      si - superior to inferior (top to bottom)\n      is - inferior to superior (bottom to top)\n      ap - anterior to posterior (front to back)\n      pa - posterior to anterior (back to front)\n      lr - left to right\n      rl - right to left\n\n    */\n  // clang-format on\n\npublic:\n  /**\n   * Generate the transforms corresponding to the slice order.\n   */\n  SliceOrder();\n\n  virtual ~SliceOrder() = default;\n\npublic:\n  /**\n   * Returns the vtkTransform corresponding to the slice order.\n   *\n   * @param sliceOrder: The slice order.\n   * @return The vtkTransform corresponding to the slice order.\n   */\n  vtkSmartPointer<vtkTransform> Get(std::string const& sliceOrder);\n\n  /**\n   * Print the homogenous matrix corresponding to the slice order.\n   *\n   * @param order: The slice order.\n   */\n  void PrintTransform(std::string const& order);\n\n  /**\n   * Print all the homogenous matrices corresponding to the slice orders.\n   *\n   */\n  void PrintAlltransforms();\n\nprivate:\n  std::map<std::string, vtkSmartPointer<vtkTransform>> transform;\n};\n\n/**\n * @param scale: Sets the scale and direction of the axes.\n * @param xyzLabels: Labels for the axes.\n * @return The axes actor.\n */\nvtkNew<vtkAxesActor> MakeAxesActor(std::array<double, 3>& scale,\n                                   std::array<std::string, 3> const& xyzLabels);\n\n/**\n * @param cubeLabels: The labels for the cube faces.\n * @param colors: Used to set the colors of the cube faces.\n * @return The annotated cube actor.\n */\nvtkNew<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(std::array<std::string, 6> const& cubeLabels,\n                       vtkNamedColors* colors);\n\n/**\n * @param labelSelector: The selector used to define labels for the axes and\n * cube.\n * @param colors: Used to set the colors of the cube faces.\n * @return The combined axes and annotated cube prop.\n */\nvtkNew<vtkPropAssembly> MakeCubeActor(std::string const& labelSelector,\n                                      vtkNamedColors* colors);\n\nclass SliderCallbackOpacity : public vtkCallbackCommand\n{\npublic:\n  static SliderCallbackOpacity* New()\n  {\n    return new SliderCallbackOpacity;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetOpacity(value);\n  }\n  SliderCallbackOpacity() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\nstruct SliderProperties\n{\n  double tubeWidth{0.004};\n  double sliderLength{0.015};\n  double sliderWidth{0.008};\n  double endCapLength{0.008};\n  double endCapWidth{0.02};\n  double titleHeight{0.02};\n  double labelHeight{0.02};\n\n  double valueMinimum{0.0};\n  double valueMaximum{1.0};\n  double valueInitial{1.0};\n\n  std::array<double, 2> p1{0.02, 0.1};\n  std::array<double, 2> p2{0.18, 0.1};\n\n  std::string title;\n\n  std::string titleColor{\"Black\"};\n  std::string labelColor{\"Black\"};\n  std::string valueColor{\"DarkSlateGray\"};\n  std::string sliderColor{\"BurlyWood\"};\n  std::string selectedColor{\"Lime\"};\n  std::string barColor{\"Black\"};\n  std::string barEndsColor{\"Indigo\"};\n};\n\n/**\n * @param properties: The slider properties.\n * @param lut: The color lookup table.\n * @param idx: The tissue index.\n * @return The slider widget.\n */\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& sp,\n                                         vtkLookupTable* lut, int const& idx);\n\nclass SliderToggleCallback : public vtkCallbackCommand\n{\npublic:\n  SliderToggleCallback() = default;\n\n  static SliderToggleCallback* New()\n  {\n    return new SliderToggleCallback;\n  }\n\n  /*\n   * Create a vtkCallbackCommand and reimplement it.\n   *\n   */\n  void Execute(vtkObject* caller, unsigned long /*evId*/, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto rwi = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n\n    // Get the keypress\n    std::string key = rwi->GetKeySym();\n    if (key == \"n\")\n    {\n      for (auto const& p : *this->sliders)\n      {\n        if (p.second->GetEnabled())\n        {\n          p.second->Off();\n        }\n        else\n        {\n          p.second->On();\n        }\n      }\n    }\n  }\n\n  /**\n   * For handling the sliders.\n   *\n   * @param sliders The sliders.\n   *\n   */\n  void SetParameters(\n      std::map<std::string, vtkSmartPointer<vtkSliderWidget>>* sliders)\n  {\n    this->sliders = sliders;\n  }\n\nprivate:\n  SliderToggleCallback(const SliderToggleCallback&) = delete;\n  void operator=(const SliderToggleCallback&) = delete;\n\n  std::map<std::string, vtkSmartPointer<vtkSliderWidget>>* sliders{nullptr};\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"View surfaces of a segmented frog dataset using preprocessed \"\n               \"VTK tissue files.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file e.g. Frog_vtk.json.\")\n      ->required()\n      ->check(CLI::ExistingFile);\n\n  std::vector<std::string> chosenTissues;\n  app.add_option(\"-t\", chosenTissues, \"Select one or more tissues.\");\n  auto noSliders = false;\n  app.add_flag(\"-n\", noSliders, \"No sliders\");\n\n  std::array<bool, 6> view{false, false, false, false};\n  auto* ogroup = app.add_option_group(\n      \"view\",\n      \"Select a view corresponding to Fig 12-9 in the VTK Textbook. Only one \"\n      \"or none of these can be selected.\");\n  ogroup->add_flag(\"-a\", view[0],\n                   \"The view corresponds to Fig 12-9a in the VTK Textbook\");\n  ogroup->add_flag(\"-b\", view[1],\n                   \"The view corresponds to Fig 12-9b in the VTK Textbook\");\n  ogroup->add_flag(\"-c\", view[2],\n                   \"The view corresponds to Fig 12-9c in the VTK Textbook\");\n  ogroup->add_flag(\"-d\", view[3],\n                   \"The view corresponds to Fig 12-9d in the VTK Textbook\");\n  ogroup->add_flag(\n      \"-l\", view[4],\n      \"The view corresponds to looking down on the anterior surface\");\n  ogroup->add_flag(\"-p\", view[5],\n                   \"The view corresponds to looking down on the posterior \"\n                   \"surface (the default)\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto selectCount = std::count_if(view.begin(), view.end(),\n                                   [=](const bool& e) { return e == true; });\n  if (selectCount > 1)\n  {\n    std::cerr << \"Only one or none of the options -a, -b, -c, -d, -l, -p can \"\n                 \"be selected;\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  ParseJSON(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto tissues = parameters.names;\n  auto indices = parameters.indices;\n\n  auto lut = CreateTissueLUT(parameters.indices, parameters.colors);\n\n  char selectFigure{'\\0'};\n  if (selectCount == 1)\n  {\n    if (view[0])\n    {\n      selectFigure = 'a';\n    }\n    else if (view[1])\n    {\n      // No skin.\n      tissues = parameters.fig_129b;\n      selectFigure = 'b';\n    }\n    else if (view[2])\n    {\n      // No skin, blood and skeleton.\n      tissues = parameters.fig_129cd;\n      selectFigure = 'c';\n    }\n    else if (view[3])\n    {\n      // No skin, blood and skeleton.\n      tissues = parameters.fig_129cd;\n      selectFigure = 'd';\n    }\n    else if (view[4])\n    {\n      // Looking down on the anterior surface.\n      selectFigure = 'l';\n    }\n    else // The default\n    {\n      // Looking down on the posterior surface.\n      selectFigure = 'p';\n    }\n  }\n\n  if (!chosenTissues.empty())\n  {\n    for (auto i = 0; i < chosenTissues.size(); ++i)\n    {\n      chosenTissues[i] = ToLowerCase(chosenTissues[i]);\n    }\n    std::vector<std::string> res;\n    auto has_brainbin{false};\n    if (std::find(chosenTissues.begin(), chosenTissues.end(), \"brainbin\") !=\n        chosenTissues.end())\n    {\n      std::cout << \"Using brainbin instead of brain.\" << std::endl;\n      res.push_back(\"brainbin\");\n      indices.erase(\"brain\");\n      indices[\"brainbin\"] = 2;\n      parameters.colors.erase(\"brain\");\n      parameters.colors[\"brainbin\"] = \"beige\";\n      has_brainbin = true;\n    }\n    for (auto const& ct : chosenTissues)\n    {\n      if (has_brainbin && (ct == \"brain\" || ct == \"brainbin\"))\n      {\n        continue;\n      }\n      if (std::find(tissues.begin(), tissues.end(), ct) != tissues.end())\n      {\n        res.push_back(ct);\n      }\n      else\n      {\n        std::cout << \"Tissue: \" << ct << \" is not available.\" << std::endl;\n        return EXIT_FAILURE;\n      }\n    }\n    if (res.size() == 1 && res[0] == \"skin\")\n    {\n      parameters.opacity[\"skin\"] = 1.0;\n    }\n    tissues = res;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"ParaViewBkg\",\n                   std::array<unsigned char, 4>{82, 87, 110, 255}.data());\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  SliceOrder so;\n  // so.PrintAlltransforms();\n\n  size_t colorSize{0};\n  for (auto const& p : parameters.colors)\n  {\n    colorSize = std::max(colorSize, p.second.size());\n  }\n  size_t nameSize{0};\n  for (auto const& p : parameters.names)\n  {\n    nameSize = std::max(nameSize, p.size());\n  }\n\n  std::map<std::string, vtkSmartPointer<vtkSliderWidget>> sliders;\n  auto leftStepSize = 1.0 / 9;\n  auto leftPosY = 0.275;\n  auto leftPosX0 = 0.02;\n  auto leftPosX1 = 0.18;\n  auto rightStepSize = 1.0 / 9;\n  auto rightPosY = 0.05;\n  auto rightPosX0 = 0.8 + 0.02;\n  auto rightPosX1 = 0.8 + 0.18;\n\n  auto sliderCount = 0;\n\n  std::string line(7 + nameSize + colorSize, '-');\n\n  std::cout << line << '\\n'\n            << std::setw(nameSize) << std::left << \"Tissue\"\n            << \" Label \"\n            << \"Color\" << '\\n'\n            << line << std::endl;\n  auto intSize = 2;\n\n  for (auto const& tissue : tissues)\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(parameters.vtkFiles[tissue].c_str());\n    reader->Update();\n\n    auto trans = so.Get(parameters.orientation[tissue]);\n    trans->Scale(1, -1, -1);\n\n    vtkNew<vtkTransformPolyDataFilter> tf;\n    tf->SetInputConnection(reader->GetOutputPort());\n    tf->SetTransform(trans);\n    tf->SetInputConnection(reader->GetOutputPort());\n\n    vtkNew<vtkPolyDataNormals> normals;\n    normals->SetInputConnection(tf->GetOutputPort());\n    normals->SetFeatureAngle(60.0);\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(normals->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetOpacity(parameters.opacity[tissue]);\n    actor->GetProperty()->SetDiffuseColor(lut->GetTableValue(indices[tissue]));\n    actor->GetProperty()->SetSpecular(0.2);\n    actor->GetProperty()->SetSpecularPower(10);\n\n    ren->AddActor(actor);\n\n    if (!noSliders)\n    {\n      auto sp = SliderProperties();\n\n      sp.valueInitial = parameters.opacity[tissue];\n      sp.title = tissue;\n\n      // Screen coordinates.\n      if (sliderCount < 7)\n      {\n        sp.p1[0] = leftPosX0;\n        sp.p1[1] = leftPosY;\n        sp.p2[0] = leftPosX1;\n        sp.p2[1] = leftPosY;\n        leftPosY += leftStepSize;\n      }\n      else\n      {\n        sp.p1[0] = rightPosX0;\n        sp.p1[1] = rightPosY;\n        sp.p2[0] = rightPosX1;\n        sp.p2[1] = rightPosY;\n        rightPosY += rightStepSize;\n      }\n\n      auto sliderWidget = MakeSliderWidget(sp, lut, parameters.indices[tissue]);\n\n      sliderWidget->SetInteractor(iRen);\n      sliderWidget->SetAnimationModeToAnimate();\n      sliderWidget->EnabledOn();\n\n      vtkNew<SliderCallbackOpacity> cb;\n      cb->property = actor->GetProperty();\n      sliderWidget->AddObserver(vtkCommand::InteractionEvent, cb);\n      sliders[tissue] = sliderWidget;\n      sliderCount += 1;\n    }\n    std::cout << std::setw(nameSize) << std::left << tissue << \" \"\n              << std::setw(intSize + 3) << std::right << indices[tissue] << \" \"\n              << std::setw(colorSize) << std::left << parameters.colors[tissue]\n              << std::endl;\n  }\n  std::cout << line << std::endl;\n\n  if (noSliders)\n  {\n    renWin->SetSize(1024, 1024);\n  }\n  else\n  {\n    renWin->SetSize(1024 + 400, 1024);\n  }\n  renWin->SetWindowName(\"FroggieView\");\n\n  ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n\n  auto camera = ren->GetActiveCamera();\n  // Superior Anterior Left\n  auto labels{\"sal\"};\n  if (selectFigure == 'a')\n  {\n    // Fig 12-9a in the VTK Textbook\n    camera->SetPosition(495.722368, -447.474954, -646.308030);\n    camera->SetFocalPoint(137.612066, -40.962376, -195.171023);\n    camera->SetViewUp(-0.323882, -0.816232, 0.478398);\n    camera->SetDistance(704.996499);\n    camera->SetClippingRange(319.797039, 1809.449285);\n  }\n  else if (selectFigure == 'b')\n  {\n    // Fig 12-9b in the VTK Textbook\n    camera->SetPosition(478.683494, -420.477744, -643.112038);\n    camera->SetFocalPoint(135.624874, -36.478435, -210.614440);\n    camera->SetViewUp(-0.320495, -0.820148, 0.473962);\n    camera->SetDistance(672.457328);\n    camera->SetClippingRange(307.326771, 1765.990822);\n  }\n  else if (selectFigure == 'c')\n  {\n    // Fig 12-9c in the VTK Textbook\n    camera->SetPosition(201.363313, -147.260834, -229.885066);\n    camera->SetFocalPoint(140.626206, -75.857216, -162.352531);\n    camera->SetViewUp(-0.425438, -0.786048, 0.448477);\n    camera->SetDistance(115.534047);\n    camera->SetClippingRange(7.109870, 854.091718);\n  }\n  else if (selectFigure == 'd')\n  {\n    // Fig 12-9d in the VTK Textbook\n    camera->SetPosition(115.361727, -484.656410, -6.193827);\n    camera->SetFocalPoint(49.126343, 98.501094, 1.323317);\n    camera->SetViewUp(-0.649127, -0.083475, 0.756086);\n    camera->SetDistance(586.955116);\n    camera->SetClippingRange(360.549218, 866.876230);\n  }\n  else if (selectFigure == 'l')\n  {\n    // Orient so that we look down on the anterior surface and\n    //  the superior surface faces the top of the screen.\n    // Left Superior Anterior\n    labels = \"lsa\";\n    vtkNew<vtkTransform> transform;\n    transform->SetMatrix(camera->GetModelTransformMatrix());\n    transform->RotateY(90);\n    transform->RotateZ(90);\n    camera->SetModelTransformMatrix(transform->GetMatrix());\n    ren->ResetCamera();\n  }\n  else\n  {\n    // Orient so that we look down on the posterior surface and\n    //  the superior surface faces the top of the screen.\n    // Right Superior Posterior\n    labels = \"rsp\";\n    vtkNew<vtkTransform> transform;\n    transform->SetMatrix(camera->GetModelTransformMatrix());\n    transform->RotateY(-90);\n    transform->RotateZ(90);\n    camera->SetModelTransformMatrix(transform->GetMatrix());\n    ren->ResetCamera();\n  }\n\n  vtkNew<vtkCameraOrientationWidget> cow;\n  cow->SetParentRenderer(ren);\n  if (noSliders)\n  {\n    // Turn off if you do not want it.\n    cow->On();\n    cow->EnabledOn();\n  }\n  else\n  {\n    cow->Off();\n    cow->EnabledOff();\n  }\n\n  auto axes = MakeCubeActor(labels, colors);\n  vtkNew<vtkOrientationMarkerWidget> om;\n  om->SetOrientationMarker(axes);\n  // Position upper left in the viewport.\n  // om->SetViewport(0.0, 0.8, 0.2, 1.0);\n  // Position lower left in the viewport.\n  om->SetViewport(0, 0, 0.2, 0.2);\n  om->SetInteractor(iRen);\n  om->EnabledOn();\n  om->InteractiveOn();\n\n  renWin->Render();\n\n  vtkNew<SliderToggleCallback> sliderToggle;\n  sliderToggle->SetParameters(&sliders);\n  iRen->AddObserver(vtkCommand::KeyPressEvent, sliderToggle);\n\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::string ToLowerCase(std::string s)\n{\n  std::transform(s.begin(), s.end(), s.begin(),\n                 [](unsigned char c) { return std::tolower(c); } // correct\n  );\n  return s;\n}\n\nvoid ParseJSON(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Get the parameters that we need.\n  fs::path vtkPath;\n  std::vector<std::string> fileNames;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (outer.name() == \"files\")\n    {\n      std::string path;\n      for (Json::Value::const_iterator pth = root[\"files\"].begin();\n           pth != root[\"files\"].end(); ++pth)\n      {\n        if (pth.name() == \"root\")\n        {\n          vtkPath = fs::path(pth->asString());\n        }\n        if (pth.name() == \"vtk_files\")\n        {\n          for (Json::Value::const_iterator fls =\n                   root[\"files\"][\"vtk_files\"].begin();\n               fls != root[\"files\"][\"vtk_files\"].end(); ++fls)\n          {\n            fileNames.push_back(fls->asString());\n          }\n        }\n      }\n    }\n    if (outer.name() == \"tissues\")\n    {\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"names\"].begin();\n           tc != root[\"tissues\"][\"names\"].end(); ++tc)\n      {\n        parameters.names.push_back(tc->asString());\n      }\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"indices\"].begin();\n           tc != root[\"tissues\"][\"indices\"].end(); ++tc)\n      {\n        parameters.indices[tc.name()] = tc->asInt();\n      }\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"colors\"].begin();\n           tc != root[\"tissues\"][\"colors\"].end(); ++tc)\n      {\n        parameters.colors[tc.name()] = tc->asString();\n      }\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"indices\"].begin();\n           tc != root[\"tissues\"][\"indices\"].end(); ++tc)\n      {\n        parameters.indices[tc.name()] = tc->asInt();\n      }\n      for (Json::Value::const_iterator tc =\n               root[\"tissues\"][\"orientation\"].begin();\n           tc != root[\"tissues\"][\"orientation\"].end(); ++tc)\n      {\n        parameters.orientation[tc.name()] = tc->asString();\n      }\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"opacity\"].begin();\n           tc != root[\"tissues\"][\"opacity\"].end(); ++tc)\n      {\n        parameters.opacity[tc.name()] = tc->asDouble();\n      }\n    }\n    if (outer.name() == \"figures\")\n    {\n      for (Json::Value::const_iterator c = root[\"figures\"][\"fig12-9b\"].begin();\n           c != root[\"figures\"][\"fig12-9b\"].end(); ++c)\n      {\n        parameters.fig_129b.push_back(c->asString());\n      }\n      for (Json::Value::const_iterator c = root[\"figures\"][\"fig12-9cd\"].begin();\n           c != root[\"figures\"][\"fig12-9cd\"].end(); ++c)\n      {\n        parameters.fig_129cd.push_back(c->asString());\n      }\n    }\n  }\n\n  //  Build and check the paths.\n  if (!fileNames.empty())\n  {\n    if (fileNames.size() != 17)\n    {\n      std::cerr << \"Expected seventeen file names.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < fileNames.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / vtkPath / fs::path(fileNames[i]);\n        fileNames[i] = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << fileNames[i]\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.vtkFiles[pth.stem().string()] =\n              pth.make_preferred().string();\n        }\n      }\n    }\n  }\n  else\n  {\n    std::cerr << \"Expected .vtk file names in the JSON file.\";\n    parameters.parsedOk = false;\n  }\n}\n\nvtkNew<vtkLookupTable>\nCreateTissueLUT(std::map<std::string, int> const& indices,\n                std::map<std::string, std::string>& colors)\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(colors.size());\n  lut->SetTableRange(0, colors.size() - 1);\n  lut->Build();\n\n  vtkNew<vtkNamedColors> nc;\n\n  for (auto const& p : indices)\n  {\n    lut->SetTableValue(p.second, nc->GetColor4d(colors[p.first]).GetData());\n  }\n\n  return lut;\n}\n\nSliceOrder::SliceOrder()\n{\n  vtkNew<vtkMatrix4x4> si_mat;\n  si_mat->Zero();\n  si_mat->SetElement(0, 0, 1);\n  si_mat->SetElement(1, 2, 1);\n  si_mat->SetElement(2, 1, -1);\n  si_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> is_mat;\n  is_mat->Zero();\n  is_mat->SetElement(0, 0, 1);\n  is_mat->SetElement(1, 2, -1);\n  is_mat->SetElement(2, 1, -1);\n  is_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> lr_mat;\n  lr_mat->Zero();\n  lr_mat->SetElement(0, 2, -1);\n  lr_mat->SetElement(1, 1, -1);\n  lr_mat->SetElement(2, 0, 1);\n  lr_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> rl_mat;\n  rl_mat->Zero();\n  rl_mat->SetElement(0, 2, 1);\n  rl_mat->SetElement(1, 1, -1);\n  rl_mat->SetElement(2, 0, 1);\n  rl_mat->SetElement(3, 3, 1);\n\n  // The previous transforms assume radiological views of the slices\n  //  (viewed from the feet).\n  // Other modalities such as physical sectioning may view from the head.\n  // The following transforms modify the original with a 180\u00b0 rotation about y\n\n  vtkNew<vtkMatrix4x4> hf_mat;\n  hf_mat->Zero();\n  hf_mat->SetElement(0, 0, -1);\n  hf_mat->SetElement(1, 1, 1);\n  hf_mat->SetElement(2, 2, -1);\n  hf_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkTransform> si_trans;\n  si_trans->SetMatrix(si_mat);\n  this->transform[\"si\"] = si_trans;\n\n  vtkNew<vtkTransform> is_trans;\n  is_trans->SetMatrix(is_mat);\n  this->transform[\"is\"] = is_trans;\n\n  vtkNew<vtkTransform> ap_trans;\n  ap_trans->Scale(1, -1, 1);\n  this->transform[\"ap\"] = ap_trans;\n\n  vtkNew<vtkTransform> pa_trans;\n  pa_trans->Scale(1, -1, -1);\n  this->transform[\"pa\"] = pa_trans;\n\n  vtkNew<vtkTransform> lr_trans;\n  lr_trans->SetMatrix(lr_mat);\n  this->transform[\"lr\"] = lr_trans;\n\n  vtkNew<vtkTransform> rl_trans;\n  lr_trans->SetMatrix(rl_mat);\n  this->transform[\"rl\"] = rl_trans;\n\n  vtkNew<vtkTransform> hf_trans;\n  hf_trans->SetMatrix(hf_mat);\n  this->transform[\"hf\"] = hf_trans;\n\n  vtkNew<vtkTransform> hf_si_trans;\n  hf_si_trans->SetMatrix(hf_mat);\n  hf_si_trans->Concatenate(si_mat);\n  this->transform[\"hfsi\"] = hf_si_trans;\n\n  vtkNew<vtkTransform> hf_is_trans;\n  hf_is_trans->SetMatrix(hf_mat);\n  hf_is_trans->Concatenate(is_mat);\n  this->transform[\"hfis\"] = hf_is_trans;\n\n  vtkNew<vtkTransform> hf_ap_trans;\n  hf_ap_trans->SetMatrix(hf_mat);\n  hf_ap_trans->Scale(1, -1, 1);\n  this->transform[\"hfap\"] = hf_ap_trans;\n\n  vtkNew<vtkTransform> hf_pa_trans;\n  hf_pa_trans->SetMatrix(hf_mat);\n  hf_pa_trans->Scale(1, -1, -1);\n  this->transform[\"hfpa\"] = hf_pa_trans;\n\n  vtkNew<vtkTransform> hf_lr_trans;\n  hf_lr_trans->SetMatrix(hf_mat);\n  hf_lr_trans->Concatenate(lr_mat);\n  this->transform[\"hflr\"] = hf_lr_trans;\n\n  vtkNew<vtkTransform> hf_rl_trans;\n  hf_rl_trans->SetMatrix(hf_mat);\n  hf_rl_trans->Concatenate(rl_mat);\n  this->transform[\"hfrl\"] = hf_rl_trans;\n\n  // Identity\n  this->transform[\"I\"] = vtkNew<vtkTransform>();\n\n  // Zero\n  vtkNew<vtkTransform> z_trans;\n  z_trans->Scale(0, 0, 0);\n  this->transform[\"Z\"] = z_trans;\n}\n\nvoid SliceOrder::PrintTransform(std::string const& order)\n{\n  auto m = this->transform[order]->GetMatrix();\n  std::ostringstream os;\n  os.setf(std::ios_base::fmtflags(), std::ios_base::floatfield);\n  os << order << '\\n';\n  for (int i = 0; i < 4; ++i)\n  {\n    for (int j = 0; j < 4; ++j)\n    {\n      if (j < 3)\n      {\n        os << std::setw(6) << std::right << std::setprecision(2)\n           << m->GetElement(i, j) << \" \";\n      }\n      else\n      {\n        os << std::setw(6) << std::right << m->GetElement(i, j) << '\\n';\n      }\n    }\n  }\n  std::cout << os.str() << '\\n';\n  os.str(\"\");\n}\n\nvoid SliceOrder::PrintAlltransforms()\n{\n  for (auto const& p : this->transform)\n  {\n    PrintTransform(p.first);\n  }\n}\n\nvtkSmartPointer<vtkTransform> SliceOrder::Get(std::string const& sliceOrder)\n{\n  return this->transform[sliceOrder];\n}\n\nvtkNew<vtkAxesActor> MakeAxesActor(std::array<double, 3>& scale,\n                                   std::array<std::string, 3> const& xyzLabels)\n{\n  vtkNew<vtkAxesActor> axes;\n  axes->SetScale(scale.data());\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(xyzLabels[0].c_str());\n  axes->SetYAxisLabelText(xyzLabels[1].c_str());\n  axes->SetZAxisLabelText(xyzLabels[2].c_str());\n  axes->SetCylinderRadius(0.5 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.025 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.5 * axes->GetSphereRadius());\n  auto tprop = axes->GetXAxisCaptionActor2D()->GetCaptionTextProperty();\n  tprop->ItalicOn();\n  tprop->ShadowOn();\n  tprop->SetFontFamilyToTimes();\n  // Use the same text properties on the other two axes.\n  axes->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  axes->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  return axes;\n}\n\nvtkNew<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(std::array<std::string, 6> const& cubeLabels,\n                       vtkNamedColors* colors)\n{\n  // A cube with labeled faces.\n  vtkNew<vtkAnnotatedCubeActor> cube;\n  cube->SetXPlusFaceText(cubeLabels[0].c_str());\n  cube->SetXMinusFaceText(cubeLabels[1].c_str());\n  cube->SetYPlusFaceText(cubeLabels[2].c_str());\n  cube->SetYMinusFaceText(cubeLabels[3].c_str());\n  cube->SetZPlusFaceText(cubeLabels[4].c_str());\n  cube->SetZMinusFaceText(cubeLabels[5].c_str());\n  cube->SetFaceTextScale(0.5);\n  cube->GetCubeProperty()->SetColor(colors->GetColor3d(\"Gainsboro\").GetData());\n\n  cube->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Change the vector text colors.\n  cube->GetXPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetXMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetYPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetYMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetZPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  cube->GetZMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  return cube;\n}\n\nvtkNew<vtkPropAssembly> MakeCubeActor(std::string const& labelSelector,\n                                      vtkNamedColors* colors)\n{\n  std::array<std::string, 3> xyzLabels;\n  std::array<std::string, 6> cubeLabels;\n  std::array<double, 3> scale;\n  if (labelSelector == \"sal\")\n  {\n    // xyzLabels = std::array<std::string,3>{\"S\", \"A\", \"L\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"S\", \"I\", \"A\", \"P\", \"L\", \"R\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else if (labelSelector == \"rsp\")\n  {\n    // xyzLabels = std::array<std::string, 3>{\"R\", \"S\", \"P\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"R\", \"L\", \"S\", \"I\", \"P\", \"A\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else if (labelSelector == \"lsa\")\n  {\n    // xyzLabels = std::array<std::string, 3>{\"L\", \"S\", \"A\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"L\", \"R\", \"S\", \"I\", \"A\", \"P\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else\n  {\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"+X\", \"-X\", \"+Y\", \"-Y\", \"+Z\", \"-Z\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n\n  // We are combining a vtkAxesActor and a vtkAnnotatedCubeActor\n  // into a vtkPropAssembly\n  auto cube = MakeAnnotatedCubeActor(cubeLabels, colors);\n  auto axes = MakeAxesActor(scale, xyzLabels);\n\n  // Combine orientation markers into one with an assembly.\n  vtkNew<vtkPropAssembly> assembly;\n  assembly->AddPart(axes);\n  assembly->AddPart(cube);\n  return assembly;\n}\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& sp,\n                                         vtkLookupTable* lut, int const& idx)\n{\n  vtkNew<vtkSliderRepresentation2D> slider;\n\n  slider->SetMinimumValue(sp.valueMinimum);\n  slider->SetMaximumValue(sp.valueMaximum);\n  slider->SetValue(sp.valueInitial);\n  slider->SetTitleText(sp.title.c_str());\n\n  slider->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint1Coordinate()->SetValue(sp.p1[0], sp.p1[1]);\n  slider->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint2Coordinate()->SetValue(sp.p2[0], sp.p2[1]);\n\n  slider->SetTubeWidth(sp.tubeWidth);\n  slider->SetSliderLength(sp.sliderLength);\n  slider->SetSliderWidth(sp.sliderWidth);\n  slider->SetEndCapLength(sp.endCapLength);\n  slider->SetEndCapWidth(sp.endCapWidth);\n  slider->SetTitleHeight(sp.titleHeight);\n  slider->SetLabelHeight(sp.labelHeight);\n\n  vtkNew<vtkNamedColors> colors;\n  // Set the colors of the slider components.\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(\n      colors->GetColor3d(sp.barColor).GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(\n      colors->GetColor3d(sp.barEndsColor).GetData());\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(\n      colors->GetColor3d(sp.sliderColor).GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(sp.selectedColor).GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(sp.valueColor).GetData());\n  //  Use the one color for the labels.\n  // slider->GetTitleProperty()->SetColor(colors->GetColor3d(sp.labelColor));\n  // Change the color of the text indicating what the slider controls.\n  if (idx >= 0 && idx < 16)\n  {\n    slider->GetTitleProperty()->SetColor(lut->GetTableValue(idx));\n    slider->GetTitleProperty()->ShadowOff();\n  }\n  else\n  {\n    slider->GetTitleProperty()->SetColor(\n        colors->GetColor3d(sp.titleColor).GetData());\n  }\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetRepresentation(slider);\n\n  return sliderWidget;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/FroggieView/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FroggieView)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonMath\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  IOLegacy\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FroggieView: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FroggieView MACOSX_BUNDLE FroggieView.cxx )\n  target_link_libraries(FroggieView PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FroggieView\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/FroggieView/#download-and-build-froggieview","title":"Download and Build FroggieView","text":"

Click here to download FroggieView and its CMakeLists.txt file. Once the tarball FroggieView.tar has been downloaded and extracted,

cd FroggieView/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FroggieView\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Glyph3DImage/","title":"Glyph3DImage","text":"

vtk-examples/Cxx/Visualization/Glyph3DImage

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/Glyph3DImage/#description","title":"Description","text":"

Supply an image to this example and see the image points glyphed with a vtkPoint. To see the points you may have to interactively zoom the image.

Note

vtkGlyph3DMapper can glyph points from any type of vtkDataObject that has vtkPoints.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Glyph3DImage/#code","title":"Code","text":"

Glyph3DImage.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Verify command line arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" BinaryImage e.g. \" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read file.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  // Create anything you want here, we will use a point\n  // Create the geometry of a point (the coordinate).\n  vtkNew<vtkPoints> points;\n  const float p[3] = {0.0, 0.0, 0.0};\n  points->InsertNextPoint(p);\n\n  vtkNew<vtkCellArray> vertices;\n  vtkIdType pid[1];\n  pid[0] = points->InsertNextPoint(p);\n  vertices->InsertNextCell(1, pid);\n\n  // Create a polydata object.\n  vtkNew<vtkPolyData> point;\n  point->SetPoints(points);\n  point->SetVerts(vertices);\n\n  vtkNew<vtkGlyph3DMapper> glyph3Dmapper;\n  glyph3Dmapper->SetSourceData(point);\n  glyph3Dmapper->SetInputConnection(reader->GetOutputPort());\n  glyph3Dmapper->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(glyph3Dmapper);\n  actor->GetProperty()->SetPointSize(3);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Glyph3DImage\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Glyph3DImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Glyph3DImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Glyph3DImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Glyph3DImage MACOSX_BUNDLE Glyph3DImage.cxx )\n  target_link_libraries(Glyph3DImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Glyph3DImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Glyph3DImage/#download-and-build-glyph3dimage","title":"Download and Build Glyph3DImage","text":"

Click here to download Glyph3DImage and its CMakeLists.txt file. Once the tarball Glyph3DImage.tar has been downloaded and extracted,

cd Glyph3DImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Glyph3DImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Glyph3DMapper/","title":"Glyph3DMapper","text":"

vtk-examples/Cxx/Visualization/Glyph3DMapper

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Glyph3DMapper/#code","title":"Code","text":"

Glyph3DMapper.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(2, 2, 2);\n\n  vtkNew<vtkFloatArray> scaleFactors;\n  scaleFactors->SetNumberOfComponents(3);\n  scaleFactors->SetName(\"Scale Factors\");\n  scaleFactors->InsertNextTuple3(0.7, 1.0, 1.0);\n  scaleFactors->InsertNextTuple3(1.0, 0.7, 1.0);\n  scaleFactors->InsertNextTuple3(1.0, 1.0, 0.7);\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetName(\"Colors\");\n  colors->SetNumberOfComponents(3);\n  colors->InsertNextTypedTuple(namedColors->GetColor3ub(\"Red\").GetData());\n  colors->InsertNextTypedTuple(namedColors->GetColor3ub(\"Green\").GetData());\n  colors->InsertNextTypedTuple(namedColors->GetColor3ub(\"Blue\").GetData());\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->AddArray(colors);\n  polydata->GetPointData()->AddArray(scaleFactors);\n\n  // Create anything you want here, we will use a cube for the demo.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkGlyph3DMapper> glyph3Dmapper;\n  glyph3Dmapper->SetSourceConnection(cubeSource->GetOutputPort());\n  glyph3Dmapper->SetInputData(polydata);\n  glyph3Dmapper->SetScalarModeToUsePointFieldData();\n  glyph3Dmapper->SetScaleArray(\"Scale Factors\");\n  glyph3Dmapper->SetScaleModeToScaleByVectorComponents();\n  glyph3Dmapper->SelectColorArray(\"Colors\");\n  glyph3Dmapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(glyph3Dmapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Glyph3DMapper\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  // Position the camera.\n  renderer->GetActiveCamera()->SetPosition(-10, 5, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(1, 1, 1);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Glyph3DMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Glyph3DMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Glyph3DMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Glyph3DMapper MACOSX_BUNDLE Glyph3DMapper.cxx )\n  target_link_libraries(Glyph3DMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Glyph3DMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Glyph3DMapper/#download-and-build-glyph3dmapper","title":"Download and Build Glyph3DMapper","text":"

Click here to download Glyph3DMapper and its CMakeLists.txt file. Once the tarball Glyph3DMapper.tar has been downloaded and extracted,

cd Glyph3DMapper/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Glyph3DMapper\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Hanoi/","title":"Hanoi","text":"

vtk-examples/Cxx/Visualization/Hanoi

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/Hanoi/#description","title":"Description","text":"

This is three-dimensional implementation of the Towers of Hanoi.

Here we visualize the operation of the recursive Towers of Hanoi puzzle. In this puzzle there are three pegs. In the initial position there are one or more disks(or pucks) of varying diameter on the pegs. The disks are sorted according to disk diameter, so that the largest disk is on the bottom, followed by the next largest, and so on. The goal of the puzzle is to move the disks from one peg to another, moving the disks one at a time, and never placing a larger disk on top of a smaller disk.

Here we first set up the scene with the table, pegs and pucks. Then we use a function called Hanoi() to begin the recursion. A second function MovePuck() moves the puck from one peg to another.

To give a pleasing visual effect we move the disk in small, user-specified increments, flipping the disc over as it moves from one peg to the next. Option -s controls the user-defined increments. The option -c 2 freezes a disk in mid air moving from one peg to another.

Info

See Figure 12-20c in Chapter 12 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Hanoi/#code","title":"Code","text":"

Hanoi.cxx

/*\n\nTranslated from:\n   http://www.new-npac.org/projects/sv2all/sv2/vtk/graphics/examplesCxx/Hanoi.cxx\n\n\nHanoi - application example does 3D towers of hanoi.\nUsage:\n Hanoi -p # -s # -r # -c #\n where -p is the number of starting pucks on the peg;\n       -s is the number of steps to take during animation;\n       -r is the resolution of each puck\n       -c controls output of the program.\n*/\n\n#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCylinderSource.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkVersion.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <sstream>\n#include <stack>\n#include <string>\n#include <vector>\n\nnamespace {\nvoid PrintCameraOrientation(vtkCamera* cam);\n\n/**\nHere we inherit from vtkCallbackCommand and set pointers to any\nclient and/or call data as needed.\nWhen the class is implemented, it becomes the callback function.\n*/\nclass CameraModifiedCallback : public vtkCallbackCommand\n{\npublic:\n  static CameraModifiedCallback* New()\n  {\n    return new CameraModifiedCallback;\n  }\n  // Here we Create a vtkCallbackCommand and reimplement it.\n  void Execute(vtkObject* caller, unsigned long evId, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    vtkRenderWindowInteractor* interactor =\n        reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n    // Just do this to demonstrate who called callback and the event that\n    // triggered it.\n    std::cout << interactor->GetClassName() << \"  Event Id: \" << evId\n              << std::endl;\n\n    // Now print the camera orientation.\n    PrintCameraOrientation(this->cam);\n  }\n  CameraModifiedCallback() : cam(nullptr)\n  {\n  }\n  // Set pointers to any clientData or callData here.\n  vtkCamera* cam;\n\nprivate:\n  CameraModifiedCallback(const CameraModifiedCallback&) = delete;\n  void operator=(const CameraModifiedCallback&) = delete;\n};\n\n// Find command line parameters.\nstd::vector<std::string>::iterator FindParameter(std::string const& p,\n                                                 std::vector<std::string>& v);\n\ntypedef std::array<std::stack<vtkSmartPointer<vtkActor>>, 3> PegArray;\n\n/**\n * This routine is responsible for moving pucks from peg1 to peg2.\n *\n * @param peg1 Initial peg.\n * @param peg2 Final peg.\n */\nvoid MovePuck(vtkRenderWindow* renWin, PegArray& pegStack, int peg1, int peg2);\n\n/**\n* Tower of Hanoi.\n*\n* @param n Number of disks.\n* @param peg1 Source.\n* @param peg2 Target.\n* @param peg3 Helper.\n\n*/\nvoid Hanoi(vtkRenderWindow* renWin, PegArray& pegStack, int n, int peg1,\n           int peg2, int peg3);\n\n// Save a screenshot.\nvoid Screenshot(std::string fileName, vtkRenderWindow* renWin);\n\n// Default values.\nauto numberOfPucks = 5;\nauto numberOfSteps = 5;\nauto puckResolution = 48;\nauto configuration = 0;  // Selecting output.\nauto gotFigure2 = false; // Used to bail out of recursion if configuration == 2.\nauto L = 1.0;            // Puck height.\nauto H = 1.1 * numberOfPucks * L; // Peg height.\nauto R = 0.5;                     // Peg radius.\nauto rMin = 4.0 * R;              // The minimum allowable radius of disks.\nauto rMax = 12.0 * R;             // The maximum allowable radius of disks\nauto D = 1.1 * 1.25 * rMax;       // The distance between the pegs.\nauto numberOfMoves = 0;\nauto const maxPucks = 20;\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Here we parse the command line.\n  std::vector<std::string> parameters;\n  for (auto i = 1; i < argc; ++i)\n  {\n    parameters.push_back(argv[i]);\n  }\n  auto p = FindParameter(std::string(\"?\"), parameters);\n  if (p != parameters.end())\n  {\n    std::cerr << \"Usage:   \" << argv[0] << \" [-p #] [-s #] [r #] [-c #]\"\n              << std::endl;\n    std::cerr << \"Where:        -p specifies the number of pucks.\" << std::endl;\n    std::cerr << \"              -s specifies the number of steps.\" << std::endl;\n    std::cerr << \"              -r specifies the puck resolution.\" << std::endl;\n    std::cerr << \"              -c specifies configuration.\" << std::endl;\n    std::cerr << \"                 0 final configuration.\" << std::endl;\n    std::cerr << \"                 1 initial configuration.\" << std::endl;\n    std::cerr << \"                 2 intermediate configuration.\" << std::endl;\n    std::cerr << \"                 3 final configuration and save images\"\n              << std::endl;\n    std::cerr << \"Defaults:  -p 5 -s 5 -r 48 -c 0\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  p = FindParameter(std::string(\"-p\"), parameters);\n  if (p != parameters.end() && std::next(p) != parameters.end())\n  {\n    numberOfPucks = std::abs(atoi(std::next(p)->c_str()));\n  }\n  p = FindParameter(std::string(\"-s\"), parameters);\n  if (p != parameters.end() && std::next(p) != parameters.end())\n  {\n    numberOfSteps = std::abs(atoi(std::next(p)->c_str()));\n  }\n  p = FindParameter(std::string(\"-r\"), parameters);\n  if (p != parameters.end() && std::next(p) != parameters.end())\n  {\n    puckResolution = std::abs(atoi(std::next(p)->c_str()));\n  }\n  p = FindParameter(std::string(\"-c\"), parameters);\n  if (p != parameters.end() && std::next(p) != parameters.end())\n  {\n    configuration = std::abs(atoi(std::next(p)->c_str()));\n  }\n\n  // Initialize variables and check input.\n  if (numberOfPucks < 2)\n  {\n    std::cerr << \"Please use more pucks!\\n\";\n    return EXIT_FAILURE;\n  }\n\n  if (numberOfPucks > maxPucks)\n  {\n    std::cerr << \"Too many pucks specified! Maximum is \" << maxPucks << \"\\n\";\n    return EXIT_FAILURE;\n  }\n\n  if (numberOfSteps < 3)\n  {\n    std::cerr << \"Please use more steps!\\n\";\n    return EXIT_FAILURE;\n  }\n\n  if (configuration > 3)\n  {\n    std::cerr << \"0>= configuration <= 3\\n\";\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Our rendering window.\n  vtkNew<vtkRenderWindow> renWin;\n\n  // Create renderer and render window interactor.\n  vtkNew<vtkRenderer> ren;\n  renWin->AddRenderer(ren);\n  renWin->SetSize(1200, 750);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren->SetBackground(colors->GetColor3d(\"PapayaWhip\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(41.0433, 27.9637, 30.442);\n  camera->SetFocalPoint(11.5603, -1.51931, 0.95899);\n  camera->SetClippingRange(18.9599, 91.6042);\n  camera->SetViewUp(0, 1, 0);\n\n  ren->SetActiveCamera(camera);\n\n  // Create geometry: table, pegs, and pucks.\n  vtkNew<vtkCylinderSource> pegGeometry;\n  pegGeometry->SetResolution(8);\n  vtkNew<vtkPolyDataMapper> pegMapper;\n  pegMapper->SetInputConnection(pegGeometry->GetOutputPort());\n\n  vtkNew<vtkCylinderSource> puckGeometry;\n  puckGeometry->SetResolution(puckResolution);\n  vtkNew<vtkPolyDataMapper> puckMapper;\n  puckMapper->SetInputConnection(puckGeometry->GetOutputPort());\n\n  vtkNew<vtkPlaneSource> tableGeometry;\n  tableGeometry->SetResolution(10, 10);\n  vtkNew<vtkPolyDataMapper> tableMapper;\n  tableMapper->SetInputConnection(tableGeometry->GetOutputPort());\n\n  // Create the actors: table top, pegs, and pucks\n  // The table\n  vtkNew<vtkActor> table;\n  ren->AddActor(table);\n  table->SetMapper(tableMapper);\n  // table->GetProperty()->SetColor(0.9569, 0.6431, 0.3765);\n  table->GetProperty()->SetColor(colors->GetColor3d(\"SaddleBrown\").GetData());\n  table->AddPosition(D, 0, 0);\n  table->SetScale(4 * D, 2 * D, 3 * D);\n  table->RotateX(90);\n\n  // The pegs (using cylinder geometry).  Note that the pegs have to translated\n  // in the  y-direction because the cylinder is centered about the origin.\n  H = 1.1 * numberOfPucks * L;\n  std::vector<vtkSmartPointer<vtkActor>> peg;\n  for (auto i = 0; i < 3; ++i)\n  {\n    peg.push_back(vtkSmartPointer<vtkActor>::New());\n    ren->AddActor(peg[i]);\n    peg[i]->SetMapper(pegMapper);\n    // peg[i]->GetProperty()->SetColor(1, 1, 1);\n    peg[i]->GetProperty()->SetColor(colors->GetColor3d(\"Lavender\").GetData());\n    peg[i]->AddPosition(i * D, H / 2, 0);\n    peg[i]->SetScale(1, H, 1);\n  }\n\n  // Three pegs, each a stack of a vector of actors.\n  PegArray pegStack;\n\n  // The pucks (using cylinder geometry). Always loaded on peg# 0.\n  std::vector<vtkSmartPointer<vtkActor>> puck;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(1);\n  for (auto i = 0; i < numberOfPucks; ++i)\n  {\n    puck.push_back(vtkSmartPointer<vtkActor>::New());\n    puck[i]->SetMapper(puckMapper);\n    std::array<double, 3> color{{0, 0, 0}};\n    for (auto j = 0; j < 3; ++j)\n    {\n      color[j] = randomSequence->GetValue();\n      randomSequence->Next();\n    }\n    puck[i]->GetProperty()->SetColor(color.data());\n    puck[i]->AddPosition(0, i * L + L / 2, 0);\n    auto scale = rMax - i * (rMax - rMin) / (numberOfPucks - 1);\n    puck[i]->SetScale(scale, 1, scale);\n    ren->AddActor(puck[i]);\n    pegStack[0].push(puck[i]);\n  }\n\n  // Reset the camera to view all actors.\n  renWin->Render();\n  renWin->SetWindowName(\"Hanoi\");\n\n  if (configuration == 3)\n  {\n    Screenshot(\"hanoi0.png\", renWin);\n  }\n  if (configuration != 1)\n  {\n    // Begin recursion.\n    Hanoi(renWin, pegStack, numberOfPucks - 1, 0, 2, 1);\n    Hanoi(renWin, pegStack, 1, 0, 1, 2);\n    if (!gotFigure2)\n    {\n      Hanoi(renWin, pegStack, numberOfPucks - 1, 2, 1, 0);\n\n      renWin->Render();\n      if (configuration == 3)\n      {\n        Screenshot(\"hanoi2.png\", renWin);\n      }\n    }\n    // Report output.\n    cout << \"Number of moves: \" << numberOfMoves << \"\\n\"\n         << \"Polygons rendered each frame: \"\n         << 3 * 8 + 1 + numberOfPucks * (2 + puckResolution) << \"\\n\"\n         << \"Total number of frames: \" << numberOfMoves * 3 * numberOfSteps\n         << \"\\n\";\n  }\n  vtkNew<CameraModifiedCallback> getOrientation;\n  // Set the camera to use.\n  getOrientation->cam = ren->GetActiveCamera();\n  iren->AddObserver(vtkCommand::EndInteractionEvent, getOrientation);\n\n  // Render the image.\n  iren->Initialize();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::vector<std::string>::iterator FindParameter(std::string const& p,\n                                                 std::vector<std::string>& v)\n{\n  return std::find(v.begin(), v.end(), p);\n}\n\nvoid MovePuck(vtkRenderWindow* renWin, PegArray& pegStack, int peg1, int peg2)\n{\n  numberOfMoves++;\n\n  // Get the actor to move\n  vtkActor* movingActor = pegStack[peg1].top();\n  pegStack[peg1].pop();\n\n  // Get the distance to move up.\n  auto distance =\n      (H - (L * (static_cast<int>(pegStack[peg1].size()) - 1)) + rMax) /\n      numberOfSteps;\n  for (auto i = 0; i < numberOfSteps; i++)\n  {\n    movingActor->AddPosition(0, distance, 0);\n    renWin->Render();\n  }\n\n  // get the distance to move across\n  distance = (peg2 - peg1) * D / numberOfSteps;\n  auto flipAngle = 180.0 / numberOfSteps;\n  for (auto i = 0; i < numberOfSteps; i++)\n  {\n    movingActor->AddPosition(distance, 0, 0);\n    movingActor->RotateX(flipAngle);\n    renWin->Render();\n    if (numberOfMoves == 13 && i == 3) // for making book image\n    {\n      if (configuration == 3 || configuration == 2)\n      {\n        vtkCamera* cam =\n            renWin->GetRenderers()->GetFirstRenderer()->GetActiveCamera();\n        vtkNew<vtkCamera> camera1;\n        camera1->SetPosition(54.7263, 41.6467, 44.125);\n        camera1->SetFocalPoint(11.5603, -1.51931, 0.95899);\n        camera1->SetClippingRange(42.4226, 115.659);\n        camera1->SetViewUp(0, 1, 0);\n        renWin->GetRenderers()->GetFirstRenderer()->SetActiveCamera(camera1);\n        renWin->Render();\n        if (configuration == 3)\n        {\n          Screenshot(\"hanoi1.png\", renWin);\n        }\n        if (configuration == 2)\n        {\n          gotFigure2 = true;\n          break;\n        }\n        renWin->GetRenderers()->GetFirstRenderer()->SetActiveCamera(cam);\n        renWin->Render();\n      }\n    }\n  }\n\n  if (gotFigure2)\n  {\n    pegStack[peg2].push(movingActor);\n    return;\n  }\n\n  // Get the distance to move down.\n  distance = ((L * (static_cast<int>(pegStack[peg2].size()) - 1)) - H - rMax) /\n      numberOfSteps;\n\n  for (auto i = 0; i < numberOfSteps; i++)\n  {\n    movingActor->AddPosition(0, distance, 0);\n    renWin->Render();\n  }\n\n  pegStack[peg2].push(movingActor);\n}\n\nvoid Hanoi(vtkRenderWindow* renWin, PegArray& pegStack, int n, int peg1,\n           int peg2, int peg3)\n{\n  // If gotFigure2 is true, we break out of the recursion.\n  if (gotFigure2)\n  {\n    return;\n  }\n  if (n != 1)\n  {\n    Hanoi(renWin, pegStack, n - 1, peg1, peg3, peg2);\n    if (gotFigure2)\n    {\n      return;\n    }\n    Hanoi(renWin, pegStack, 1, peg1, peg2, peg3);\n    Hanoi(renWin, pegStack, n - 1, peg3, peg2, peg1);\n  }\n  else\n  {\n    MovePuck(renWin, pegStack, peg1, peg2);\n  }\n  return;\n}\n\nvoid Screenshot(std::string fileName, vtkRenderWindow* renWin)\n{\n  vtkNew<vtkWindowToImageFilter> windowToImageFilter;\n  windowToImageFilter->SetInput(renWin);\n\n#if VTK_MAJOR_VERSION >= 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90\n  windowToImageFilter->SetScale(1); // image quality\n#else\n  windowToImageFilter->SetMagnification(1); // image quality\n#endif\n\n  // We are not recording the alpha (transparency) channel.\n  // windowToImageFilter->SetInputBufferTypeToRGBA();\n  windowToImageFilter->SetInputBufferTypeToRGB();\n  // Read from the front buffer.\n  windowToImageFilter->ReadFrontBufferOff();\n  windowToImageFilter->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(fileName.c_str());\n  writer->SetInputConnection(windowToImageFilter->GetOutputPort());\n  writer->Write();\n}\n\n/**\nGet a comma separated list.\n*/\ntemplate <typename T> std::string CommaSeparatedList(std::vector<T> v)\n{\n  std::ostringstream os;\n  std::copy(v.begin(), v.end() - 1, std::ostream_iterator<T>(os, \", \"));\n  os << v.back();\n  return os.str();\n}\n\n/**\nPrint the camera orientation.\n*/\nvoid PrintCameraOrientation(vtkCamera* cam)\n{\n  auto width = 16;\n  double pos[3];\n  cam->GetPosition(pos);\n  double fp[3];\n  cam->GetFocalPoint(fp);\n  double vu[3];\n  cam->GetViewUp(vu);\n  double cr[2];\n  cam->GetClippingRange(cr);\n  std::cout << setw(width) << \"Position: \"\n            << CommaSeparatedList(std::vector<double>(pos, pos + 3))\n            << std::endl;\n  std::cout << setw(width) << \"Focal point: \"\n            << CommaSeparatedList(std::vector<double>(fp, fp + 3)) << std::endl;\n  std::cout << setw(width) << \"Clipping range: \"\n            << CommaSeparatedList(std::vector<double>(cr, cr + 2)) << std::endl;\n  std::cout << setw(width) << \"View up: \"\n            << CommaSeparatedList(std::vector<double>(vu, vu + 3)) << std::endl;\n  std::cout << setw(width) << \"Distance: \" << cam->GetDistance() << std::endl;\n};\n} // namespace\n
"},{"location":"Cxx/Visualization/Hanoi/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Hanoi)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Hanoi: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Hanoi MACOSX_BUNDLE Hanoi.cxx )\n  target_link_libraries(Hanoi PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Hanoi\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Hanoi/#download-and-build-hanoi","title":"Download and Build Hanoi","text":"

Click here to download Hanoi and its CMakeLists.txt file. Once the tarball Hanoi.tar has been downloaded and extracted,

cd Hanoi/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Hanoi\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/HanoiInitial/","title":"HanoiInitial","text":"

vtk-examples/Cxx/Visualization/HanoiInitial

"},{"location":"Cxx/Visualization/HanoiInitial/#description","title":"Description","text":"

Towers of Hanoi, initial configuration,

Info

See Figure 12-20a in Chapter 12 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/HanoiInitial/#code","title":"Code","text":"

HanoiInitial.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCylinderSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkPNGWriter.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkWindowToImageFilter.h>\n\n// Start this program with the parameter: -c 1\n#include \"Hanoi.cxx\"\n
"},{"location":"Cxx/Visualization/HanoiInitial/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HanoiInitial)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HanoiInitial: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HanoiInitial MACOSX_BUNDLE HanoiInitial.cxx )\n  target_link_libraries(HanoiInitial PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HanoiInitial\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/HanoiInitial/#download-and-build-hanoiinitial","title":"Download and Build HanoiInitial","text":"

Click here to download HanoiInitial and its CMakeLists.txt file. Once the tarball HanoiInitial.tar has been downloaded and extracted,

cd HanoiInitial/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HanoiInitial\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/HanoiIntermediate/","title":"HanoiIntermediate","text":"

vtk-examples/Cxx/Visualization/HanoiIntermediate

"},{"location":"Cxx/Visualization/HanoiIntermediate/#description","title":"Description","text":"

Towers of Hanoi, intermediate configuration,

Info

See Figure 12-20b in Chapter 12 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/HanoiIntermediate/#code","title":"Code","text":"

HanoiIntermediate.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCylinderSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkPNGWriter.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkWindowToImageFilter.h>\n\n// Start this program with the parameter: -c 2\n#include \"Hanoi.cxx\"\n
"},{"location":"Cxx/Visualization/HanoiIntermediate/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HanoiIntermediate)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HanoiIntermediate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HanoiIntermediate MACOSX_BUNDLE HanoiIntermediate.cxx )\n  target_link_libraries(HanoiIntermediate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HanoiIntermediate\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/HanoiIntermediate/#download-and-build-hanoiintermediate","title":"Download and Build HanoiIntermediate","text":"

Click here to download HanoiIntermediate and its CMakeLists.txt file. Once the tarball HanoiIntermediate.tar has been downloaded and extracted,

cd HanoiIntermediate/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HanoiIntermediate\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Hawaii/","title":"Hawaii","text":"

vtk-examples/Cxx/Visualization/Hawaii

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/Hawaii/#description","title":"Description","text":"

Visualize elevations by coloring the scalar values with a lookup table.

This is a translation of the original hawaii.tcl with a few additional enhancements. The image is centered on Honolulu. Diamond Head is the crater lower left. Punchbowl is the crater in the centre.

Info

See Figure 6-12 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Hawaii/#code","title":"Code","text":"

Hawaii.cxx

// Translated from hawaii.tcl\n\n/*\n\nProduce figure 6-12 from the VTK Textbook.\nIt is a translation of the original hawaii.tcl with a few additional\nenhancements.\nThe image is centered on Honolulu, O'ahu.\nDiamond Head is the crater lower left. Punchbowl is the crater in the centre.\n\nThe colorScheme option allows you to select a series of colour schemes.\n0: The default, a lookup using a \"Brewer\" palette.\n1: The original: A lookup table of 256 colours ranging from deep blue (water) to\nyellow-white (mountain top).\n2: A lookup table with a preset number of colours.\n\n*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkDataSetMapper.h>\n#include <vtkElevationFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nnamespace {\n//! Create a lookup table.\n/*!\n@param lut - An indexed lookup table.\n*/\nvoid MakeLUT(int const& colorScheme, vtkLookupTable* lut);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [colorScheme]\" << std::endl;\n    std::cout << \"where: filename is the file honolulu.vtk.\" << std::endl;\n    std::cout << \"       colorScheme is 0, 1, or 2, default 0\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int colorScheme = 0;\n  std::string fileName = argv[1];\n\n  if (argc == 3)\n  {\n    colorScheme = std::abs(atoi(argv[2]));\n    colorScheme = (colorScheme > 2) ? 0 : colorScheme;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Read a vtk file\n  //\n  vtkNew<vtkPolyDataReader> hawaii;\n  hawaii->SetFileName(fileName.c_str());\n  hawaii->Update();\n  double bounds[6];\n  hawaii->GetOutput()->GetBounds(bounds);\n\n  vtkNew<vtkElevationFilter> elevation;\n  elevation->SetInputConnection(hawaii->GetOutputPort());\n  elevation->SetLowPoint(0, 0, 0);\n  elevation->SetHighPoint(0, 0, 1000);\n  elevation->SetScalarRange(0, 1000);\n\n  vtkNew<vtkLookupTable> lut;\n  MakeLUT(colorScheme, lut);\n\n  vtkNew<vtkDataSetMapper> hawaiiMapper;\n  hawaiiMapper->SetInputConnection(elevation->GetOutputPort());\n  hawaiiMapper->SetScalarRange(0, 1000);\n  hawaiiMapper->ScalarVisibilityOn();\n  hawaiiMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> hawaiiActor;\n  hawaiiActor->SetMapper(hawaiiMapper);\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren->AddActor(hawaiiActor);\n  // Match the window shape to the object.\n  // renWin->SetSize(500, int(500 * bounds[1] / bounds[3]));\n  renWin->SetSize(500, 500);\n  renWin->SetWindowName(\"Hawaii\");\n\n  // Render the image.\n  // Centered on Honolulu,\n  // Diamond Head is the crater lower left.\n  // Punchbowl is the crater in the centre.\n  renWin->Render();\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  ren->GetActiveCamera()->Zoom(1.5);\n  ren->GetActiveCamera()->Roll(-90);\n  ren->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeLUT(int const& colorScheme, vtkLookupTable* lut)\n{\n  vtkNew<vtkNamedColors> colors;\n  // Select a color scheme.\n  switch (colorScheme)\n  {\n  case 0:\n  default: {\n    // Make the lookup using a Brewer palette.\n    vtkNew<vtkColorSeries> colorSeries;\n    colorSeries->SetNumberOfColors(8);\n    int colorSeriesEnum = colorSeries->BREWER_DIVERGING_BROWN_BLUE_GREEN_8;\n    colorSeries->SetColorScheme(colorSeriesEnum);\n    colorSeries->BuildLookupTable(lut, colorSeries->ORDINAL);\n    lut->SetNanColor(1, 0, 0, 1);\n    break;\n  }\n  case 1: {\n    // A lookup table of 256 colours ranging from\n    //  deep blue(water) to yellow - white(mountain top)\n    //  is used to color map this figure.\n    lut->SetHueRange(0.7, 0);\n    lut->SetSaturationRange(1.0, 0);\n    lut->SetValueRange(0.5, 1.0);\n    break;\n  }\n  case 2:\n    // Make the lookup table with a preset number of colours.\n    vtkNew<vtkColorSeries> colorSeries;\n    colorSeries->SetNumberOfColors(8);\n    colorSeries->SetColorSchemeName(\"Hawaii\");\n    colorSeries->SetColor(0, colors->GetColor3ub(\"turquoise_blue\"));\n    colorSeries->SetColor(1, colors->GetColor3ub(\"sea_green_medium\"));\n    colorSeries->SetColor(2, colors->GetColor3ub(\"sap_green\"));\n    colorSeries->SetColor(3, colors->GetColor3ub(\"green_dark\"));\n    colorSeries->SetColor(4, colors->GetColor3ub(\"tan\"));\n    colorSeries->SetColor(5, colors->GetColor3ub(\"beige\"));\n    colorSeries->SetColor(6, colors->GetColor3ub(\"light_beige\"));\n    colorSeries->SetColor(7, colors->GetColor3ub(\"bisque\"));\n    colorSeries->BuildLookupTable(lut, colorSeries->ORDINAL);\n    lut->SetNanColor(1, 0, 0, 1);\n  };\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/Hawaii/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Hawaii)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Hawaii: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Hawaii MACOSX_BUNDLE Hawaii.cxx )\n  target_link_libraries(Hawaii PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Hawaii\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Hawaii/#download-and-build-hawaii","title":"Download and Build Hawaii","text":"

Click here to download Hawaii and its CMakeLists.txt file. Once the tarball Hawaii.tar has been downloaded and extracted,

cd Hawaii/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Hawaii\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/HedgeHog/","title":"HedgeHog","text":"

vtk-examples/Cxx/Visualization/HedgeHog

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/HedgeHog/#code","title":"Code","text":"

HedgeHog.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFloatArray.h>\n#include <vtkHedgeHog.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n\nnamespace {\n\nvoid CreateData(vtkStructuredGrid* sgrid);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the structured grid.\n  vtkNew<vtkStructuredGrid> sgrid;\n  CreateData(sgrid);\n\n  // We create a simple pipeline to display the data.\n  vtkNew<vtkHedgeHog> hedgehog;\n  hedgehog->SetInputData(sgrid);\n  hedgehog->SetScaleFactor(0.1);\n\n  vtkNew<vtkPolyDataMapper> sgridMapper;\n  sgridMapper->SetInputConnection(hedgehog->GetOutputPort());\n\n  vtkNew<vtkActor> sgridActor;\n  sgridActor->SetMapper(sgridMapper);\n  sgridActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create the usual rendering stuff.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"HedgeHog\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(sgridActor);\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renWin->SetSize(300, 300);\n\n  // interact with data\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateData(vtkStructuredGrid* sgrid)\n{\n  // int i, j, k, kOffset, jOffset, offset;\n  float x[3], v[3], rMin = 0.5, rMax = 1.0;\n  // float radius, theta;\n  static int dims[3]{13, 11, 11};\n  sgrid->SetDimensions(dims);\n\n  // We also create the points and vectors. The points\n  // form a hemi-cylinder of data.\n  vtkNew<vtkFloatArray> vectors;\n  vectors->SetNumberOfComponents(3);\n  vectors->SetNumberOfTuples(dims[0] * dims[1] * dims[2]);\n\n  vtkNew<vtkPoints> points;\n  points->Allocate(dims[0] * dims[1] * dims[2]);\n\n  auto deltaZ = 2.0 / (dims[2] - 1);\n  auto deltaRad = (rMax - rMin) / (dims[1] - 1);\n  v[2] = 0.0;\n  for (auto k = 0; k < dims[2]; k++)\n  {\n    x[2] = -1.0 + k * deltaZ;\n    auto kOffset = k * dims[0] * dims[1];\n    for (auto j = 0; j < dims[1]; j++)\n    {\n      auto radius = rMin + j * deltaRad;\n      auto jOffset = j * dims[0];\n      for (auto i = 0; i < dims[0]; i++)\n      {\n        auto theta = i * vtkMath::RadiansFromDegrees(15.0);\n        x[0] = radius * cos(theta);\n        x[1] = radius * sin(theta);\n        v[0] = -x[1];\n        v[1] = x[0];\n        auto offset = i + jOffset + kOffset;\n        points->InsertPoint(offset, x);\n        vectors->InsertTuple(offset, v);\n      }\n    }\n  }\n  sgrid->SetPoints(points);\n\n  sgrid->GetPointData()->SetVectors(vectors);\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/HedgeHog/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HedgeHog)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HedgeHog: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HedgeHog MACOSX_BUNDLE HedgeHog.cxx )\n  target_link_libraries(HedgeHog PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HedgeHog\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/HedgeHog/#download-and-build-hedgehog","title":"Download and Build HedgeHog","text":"

Click here to download HedgeHog and its CMakeLists.txt file. Once the tarball HedgeHog.tar has been downloaded and extracted,

cd HedgeHog/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HedgeHog\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/HideActor/","title":"HideActor","text":"

vtk-examples/Cxx/Visualization/HideActor

"},{"location":"Cxx/Visualization/HideActor/#description","title":"Description","text":"

Display two spheres, then hide one, then hide both.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/HideActor/#code","title":"Code","text":"

HideActor.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPropCollection.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere 1\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(4.0);\n  sphereSource1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereSource1->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere 2\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10.0, 0.0, 0.0);\n  sphereSource2->SetRadius(3.0);\n  sphereSource2->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(sphereSource2->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Honeydew\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HideActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleSwitch> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  // renderWindowInteractor->Start();\n\n  // Change the background color so we know we are done with the original two\n  // sphere display.\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Hide one actor at a time.\n  vtkPropCollection* props =\n      renderer->GetViewProps(); // iterate through and set each visibility to 0.\n  props->InitTraversal();\n  for (int i = 0; i < props->GetNumberOfItems(); i++)\n  {\n    props->GetNextProp()->VisibilityOff();\n\n    renderer->ResetCamera();\n    renderWindow->Render();\n  }\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/HideActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HideActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HideActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HideActor MACOSX_BUNDLE HideActor.cxx )\n  target_link_libraries(HideActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HideActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/HideActor/#download-and-build-hideactor","title":"Download and Build HideActor","text":"

Click here to download HideActor and its CMakeLists.txt file. Once the tarball HideActor.tar has been downloaded and extracted,

cd HideActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HideActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/HideAllActors/","title":"HideAllActors","text":"

vtk-examples/Cxx/Visualization/HideAllActors

"},{"location":"Cxx/Visualization/HideAllActors/#description","title":"Description","text":"

Display two spheres, then hide everything and turn the screen red.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/HideAllActors/#code","title":"Code","text":"

HideAllActors.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere 1\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(4.0);\n  sphereSource1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereSource1->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere 2\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10.0, 0.0, 0.0);\n  sphereSource2->SetRadius(3.0);\n  sphereSource2->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(sphereSource2->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Honeydew\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HideActor\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleSwitch> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  // renderWindowInteractor->Start();\n\n  renderer->RemoveAllViewProps();\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->Render();\n  renderer->ResetCamera();\n\n  // Why doesn't the screen change color until I click/move the mouse?\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/HideAllActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HideAllActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HideAllActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HideAllActors MACOSX_BUNDLE HideAllActors.cxx )\n  target_link_libraries(HideAllActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HideAllActors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/HideAllActors/#download-and-build-hideallactors","title":"Download and Build HideAllActors","text":"

Click here to download HideAllActors and its CMakeLists.txt file. Once the tarball HideAllActors.tar has been downloaded and extracted,

cd HideAllActors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HideAllActors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/IsosurfaceSampling/","title":"IsosurfaceSampling","text":"

vtk-examples/Cxx/Visualization/IsosurfaceSampling

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/IsosurfaceSampling/#description","title":"Description","text":"

This example illustrates how to create an isosurface and create point data on that isosurface that is sampled from another dataset. This example creates an isosurface of a sphere and then uses the vtkProbeFilter to compute point data from a sampled cylinder.

Note

All point data is sampled, even the normals. This example restores the original isosurface normals after the probe. The example has one optional command line argument that controls the sample resolution of the sphere and cylinder. The default is 50.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/IsosurfaceSampling/#code","title":"Code","text":"

IsosurfaceSampling.cxx

#include <vtkActor.h>\n#include <vtkCylinder.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\nint main(int argc, char* argv[])\n{\n  int resolution = 50;\n  if (argc > 1)\n  {\n    resolution = atoi(argv[1]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sampled sphere.\n  vtkNew<vtkSphere> implicitSphere;\n  double radius = 1.0;\n  implicitSphere->SetRadius(radius);\n\n  vtkNew<vtkSampleFunction> sampledSphere;\n  sampledSphere->SetSampleDimensions(resolution, resolution, resolution);\n  double xMin = -radius * 2.0;\n  double xMax = radius * 2.0;\n  sampledSphere->SetModelBounds(xMin, xMax, xMin, xMax, xMin, xMax);\n  sampledSphere->SetImplicitFunction(implicitSphere);\n\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> isoSphere;\n#else\n  vtkNew<vtkMarchingCubes> isoSphere;\n#endif\n  isoSphere->SetValue(0, 1.0);\n  isoSphere->SetInputConnection(sampledSphere->GetOutputPort());\n\n  // Create a sampled cylinder.\n  vtkNew<vtkCylinder> implicitCylinder;\n  implicitCylinder->SetRadius(radius / 2.0);\n  vtkNew<vtkSampleFunction> sampledCylinder;\n  sampledCylinder->SetSampleDimensions(resolution, resolution, resolution);\n  sampledCylinder->SetModelBounds(xMin, xMax, xMin, xMax, xMin, xMax);\n  sampledCylinder->SetImplicitFunction(implicitCylinder);\n\n  // Probe cylinder with the sphere isosurface.\n  vtkNew<vtkProbeFilter> probeCylinder;\n  probeCylinder->SetInputConnection(0, isoSphere->GetOutputPort());\n  probeCylinder->SetInputConnection(1, sampledCylinder->GetOutputPort());\n  probeCylinder->Update();\n\n  // Restore the original normals.\n  probeCylinder->GetOutput()->GetPointData()->SetNormals(\n      isoSphere->GetOutput()->GetPointData()->GetNormals());\n\n  std::cout << \"Scalar range: \"\n            << probeCylinder->GetOutput()->GetScalarRange()[0] << \", \"\n            << probeCylinder->GetOutput()->GetScalarRange()[1] << std::endl;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapSphere;\n  mapSphere->SetInputConnection(probeCylinder->GetOutputPort());\n  mapSphere->SetScalarRange(probeCylinder->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> sphere;\n  sphere->SetMapper(mapSphere);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"IsosurfaceSampling\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(sphere);\n  renderer->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/IsosurfaceSampling/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IsosurfaceSampling)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IsosurfaceSampling: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IsosurfaceSampling MACOSX_BUNDLE IsosurfaceSampling.cxx )\n  target_link_libraries(IsosurfaceSampling PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IsosurfaceSampling\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/IsosurfaceSampling/#download-and-build-isosurfacesampling","title":"Download and Build IsosurfaceSampling","text":"

Click here to download IsosurfaceSampling and its CMakeLists.txt file. Once the tarball IsosurfaceSampling.tar has been downloaded and extracted,

cd IsosurfaceSampling/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IsosurfaceSampling\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Kitchen/","title":"Kitchen","text":"

vtk-examples/Cxx/Visualization/Kitchen

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/Kitchen/#description","title":"Description","text":"

The example shows forty streamlines in a small kitchen. The room has two windows, a door(with air leakage), and a cooking area with a hot stove. The air leakage and temperature variation combine to produce air convection currents throughout the kitchen. The starting positions of the streamlines were defined by creating a rake, or curve (and its associated points). Here the rake was a straight line modeled with a vtkLineSource. These streamlines clearly show features of the flow field. By releasing many streamlines simultaneously we obtain even more information, as the eye tends to assemble nearby streamlines into a \u201cglobal\u201d understanding of flow field features.

Info

See Figure 6-18 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Kitchen/#code","title":"Code","text":"

Kitchen.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredGridReader.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" kitchen.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  double range[2];\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the furniture colors.\n  std::array<unsigned char, 4> furnColor{{204, 204, 153, 255}};\n  colors->SetColor(\"Furniture\", furnColor.data());\n\n  vtkNew<vtkRenderer> aren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  //\n  // Read data.\n  //\n  vtkNew<vtkStructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update(); // Force a read to occur.\n  reader->GetOutput()->GetLength();\n\n  double maxTime = 0.0;\n\n  if (reader->GetOutput()->GetPointData()->GetScalars())\n  {\n    reader->GetOutput()->GetPointData()->GetScalars()->GetRange(range);\n  }\n  if (reader->GetOutput()->GetPointData()->GetVectors())\n  {\n    auto maxVelocity =\n        reader->GetOutput()->GetPointData()->GetVectors()->GetMaxNorm();\n    maxTime = 4.0 * reader->GetOutput()->GetLength() / maxVelocity;\n  }\n  //\n  // Outline around data.\n  //\n  vtkNew<vtkStructuredGridOutlineFilter> outlineF;\n  outlineF->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outlineF->GetOutputPort());\n  vtkNew<vtkActor> outline;\n  outline->SetMapper(outlineMapper);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"LampBlack\").GetData());\n  //\n  // Set up shaded surfaces (i.e., supporting geometry).\n  //\n  vtkNew<vtkStructuredGridGeometryFilter> doorGeom;\n  doorGeom->SetInputConnection(reader->GetOutputPort());\n  doorGeom->SetExtent(27, 27, 14, 18, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapDoor;\n  mapDoor->SetInputConnection(doorGeom->GetOutputPort());\n  mapDoor->ScalarVisibilityOff();\n  vtkNew<vtkActor> door;\n  door->SetMapper(mapDoor);\n  door->GetProperty()->SetColor(colors->GetColor3d(\"Burlywood\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> window1Geom;\n  window1Geom->SetInputConnection(reader->GetOutputPort());\n  window1Geom->SetExtent(0, 0, 9, 18, 6, 12);\n  vtkNew<vtkPolyDataMapper> mapWindow1;\n  mapWindow1->SetInputConnection(window1Geom->GetOutputPort());\n  mapWindow1->ScalarVisibilityOff();\n  vtkNew<vtkActor> window1;\n  window1->SetMapper(mapWindow1);\n  window1->GetProperty()->SetColor(colors->GetColor3d(\"SkyBlue\").GetData());\n  window1->GetProperty()->SetOpacity(.6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> window2Geom;\n  window2Geom->SetInputConnection(reader->GetOutputPort());\n  window2Geom->SetExtent(5, 12, 23, 23, 6, 12);\n  vtkNew<vtkPolyDataMapper> mapWindow2;\n  mapWindow2->SetInputConnection(window2Geom->GetOutputPort());\n  mapWindow2->ScalarVisibilityOff();\n  vtkNew<vtkActor> window2;\n  window2->SetMapper(mapWindow2);\n  window2->GetProperty()->SetColor(colors->GetColor3d(\"SkyBlue\").GetData());\n  window2->GetProperty()->SetOpacity(.6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower1Geom;\n  klower1Geom->SetInputConnection(reader->GetOutputPort());\n  klower1Geom->SetExtent(17, 17, 0, 11, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower1;\n  mapKlower1->SetInputConnection(klower1Geom->GetOutputPort());\n  mapKlower1->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower1;\n  klower1->SetMapper(mapKlower1);\n  klower1->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower2Geom;\n  klower2Geom->SetInputConnection(reader->GetOutputPort());\n  klower2Geom->SetExtent(19, 19, 0, 11, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower2;\n  mapKlower2->SetInputConnection(klower2Geom->GetOutputPort());\n  mapKlower2->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower2;\n  klower2->SetMapper(mapKlower2);\n  klower2->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower3Geom;\n  klower3Geom->SetInputConnection(reader->GetOutputPort());\n  klower3Geom->SetExtent(17, 19, 0, 0, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower3;\n  mapKlower3->SetInputConnection(klower3Geom->GetOutputPort());\n  mapKlower3->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower3;\n  klower3->SetMapper(mapKlower3);\n  klower3->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower4Geom;\n  klower4Geom->SetInputConnection(reader->GetOutputPort());\n  klower4Geom->SetExtent(17, 19, 11, 11, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower4;\n  mapKlower4->SetInputConnection(klower4Geom->GetOutputPort());\n  mapKlower4->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower4;\n  klower4->SetMapper(mapKlower4);\n  klower4->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower5Geom;\n  klower5Geom->SetInputConnection(reader->GetOutputPort());\n  klower5Geom->SetExtent(17, 19, 0, 11, 0, 0);\n  vtkNew<vtkPolyDataMapper> mapKlower5;\n  mapKlower5->SetInputConnection(klower5Geom->GetOutputPort());\n  mapKlower5->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower5;\n  klower5->SetMapper(mapKlower5);\n  klower5->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower6Geom;\n  klower6Geom->SetInputConnection(reader->GetOutputPort());\n  klower6Geom->SetExtent(17, 19, 0, 7, 6, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower6;\n  mapKlower6->SetInputConnection(klower6Geom->GetOutputPort());\n  mapKlower6->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower6;\n  klower6->SetMapper(mapKlower6);\n  klower6->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower7Geom;\n  klower7Geom->SetInputConnection(reader->GetOutputPort());\n  klower7Geom->SetExtent(17, 19, 9, 11, 6, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower7;\n  mapKlower7->SetInputConnection(klower7Geom->GetOutputPort());\n  mapKlower7->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower7;\n  klower7->SetMapper(mapKlower7);\n  klower7->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> hood1Geom;\n  hood1Geom->SetInputConnection(reader->GetOutputPort());\n  hood1Geom->SetExtent(17, 17, 0, 11, 11, 16);\n  vtkNew<vtkPolyDataMapper> mapHood1;\n  mapHood1->SetInputConnection(hood1Geom->GetOutputPort());\n  mapHood1->ScalarVisibilityOff();\n  vtkNew<vtkActor> hood1;\n  hood1->SetMapper(mapHood1);\n  hood1->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> hood2Geom;\n  hood2Geom->SetInputConnection(reader->GetOutputPort());\n  hood2Geom->SetExtent(19, 19, 0, 11, 11, 16);\n  vtkNew<vtkPolyDataMapper> mapHood2;\n  mapHood2->SetInputConnection(hood2Geom->GetOutputPort());\n  mapHood2->ScalarVisibilityOff();\n  vtkNew<vtkActor> hood2;\n  hood2->SetMapper(mapHood2);\n  hood2->GetProperty()->SetColor(colors->GetColor3d(\"Furniture\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> hood3Geom;\n  hood3Geom->SetInputConnection(reader->GetOutputPort());\n  hood3Geom->SetExtent(17, 19, 0, 0, 11, 16);\n  vtkNew<vtkPolyDataMapper> mapHood3;\n  mapHood3->SetInputConnection(hood3Geom->GetOutputPort());\n  mapHood3->ScalarVisibilityOff();\n  vtkNew<vtkActor> hood3;\n  hood3->SetMapper(mapHood3);\n  hood3->GetProperty()->SetColor(colors->GetColor3d(\"Furniture\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> hood4Geom;\n  hood4Geom->SetInputConnection(reader->GetOutputPort());\n  hood4Geom->SetExtent(17, 19, 11, 11, 11, 16);\n  vtkNew<vtkPolyDataMapper> mapHood4;\n  mapHood4->SetInputConnection(hood4Geom->GetOutputPort());\n  mapHood4->ScalarVisibilityOff();\n  vtkNew<vtkActor> hood4;\n  hood4->SetMapper(mapHood4);\n  hood4->GetProperty()->SetColor(colors->GetColor3d(\"Furniture\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> hood6Geom;\n  hood6Geom->SetInputConnection(reader->GetOutputPort());\n  hood6Geom->SetExtent(17, 19, 0, 11, 16, 16);\n  vtkNew<vtkPolyDataMapper> mapHood6;\n  mapHood6->SetInputConnection(hood6Geom->GetOutputPort());\n  mapHood6->ScalarVisibilityOff();\n  vtkNew<vtkActor> hood6;\n  hood6->SetMapper(mapHood6);\n  hood6->GetProperty()->SetColor(colors->GetColor3d(\"Furniture\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> cookingPlateGeom;\n  cookingPlateGeom->SetInputConnection(reader->GetOutputPort());\n  cookingPlateGeom->SetExtent(17, 19, 7, 9, 6, 6);\n  vtkNew<vtkPolyDataMapper> mapCookingPlate;\n  mapCookingPlate->SetInputConnection(cookingPlateGeom->GetOutputPort());\n  mapCookingPlate->ScalarVisibilityOff();\n  vtkNew<vtkActor> cookingPlate;\n  cookingPlate->SetMapper(mapCookingPlate);\n  cookingPlate->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> filterGeom;\n  filterGeom->SetInputConnection(reader->GetOutputPort());\n  filterGeom->SetExtent(17, 19, 7, 9, 11, 11);\n  vtkNew<vtkPolyDataMapper> mapFilter;\n  mapFilter->SetInputConnection(filterGeom->GetOutputPort());\n  mapFilter->ScalarVisibilityOff();\n  vtkNew<vtkActor> filter;\n  filter->SetMapper(mapFilter);\n  filter->GetProperty()->SetColor(colors->GetColor3d(\"Furniture\").GetData());\n  //\n  // Regular streamlines.\n  //\n  vtkNew<vtkLineSource> line;\n  line->SetResolution(39);\n  line->SetPoint1(0.08, 2.50, 0.71);\n  line->SetPoint2(0.08, 4.50, 0.71);\n  vtkNew<vtkPolyDataMapper> rakeMapper;\n  rakeMapper->SetInputConnection(line->GetOutputPort());\n  vtkNew<vtkActor> rake;\n  rake->SetMapper(rakeMapper);\n\n  vtkNew<vtkStreamTracer> streamers;\n  // streamers->DebugOn();\n  streamers->SetInputConnection(reader->GetOutputPort());\n  streamers->SetSourceConnection(line->GetOutputPort());\n  streamers->SetMaximumPropagation(maxTime);\n  streamers->SetInitialIntegrationStep(.5);\n  streamers->SetMinimumIntegrationStep(.1);\n  streamers->SetIntegratorType(2);\n  streamers->Update();\n\n  vtkNew<vtkPolyDataMapper> streamersMapper;\n  streamersMapper->SetInputConnection(streamers->GetOutputPort());\n  streamersMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> lines;\n  lines->SetMapper(streamersMapper);\n  lines->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  aren->TwoSidedLightingOn();\n\n  aren->AddActor(outline);\n  aren->AddActor(door);\n  aren->AddActor(window1);\n  aren->AddActor(window2);\n  aren->AddActor(klower1);\n  aren->AddActor(klower2);\n  aren->AddActor(klower3);\n  aren->AddActor(klower4);\n  aren->AddActor(klower5);\n  aren->AddActor(klower6);\n  aren->AddActor(klower7);\n  aren->AddActor(hood1);\n  aren->AddActor(hood2);\n  aren->AddActor(hood3);\n  aren->AddActor(hood4);\n  aren->AddActor(hood6);\n  aren->AddActor(cookingPlate);\n  aren->AddActor(filter);\n  aren->AddActor(lines);\n  aren->AddActor(rake);\n\n  aren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkCamera> aCamera;\n  aren->SetActiveCamera(aCamera);\n  aren->ResetCamera();\n\n  aCamera->SetFocalPoint(3.505, 2.505, 1.255);\n  aCamera->SetPosition(3.505, 24.6196, 1.255);\n  aCamera->SetViewUp(0, 0, 1);\n  aCamera->Azimuth(60);\n  aCamera->Elevation(30);\n  aCamera->Dolly(1.4);\n  aren->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 512);\n  renWin->Render();\n  renWin->SetWindowName(\"Kitchen\");\n\n  // Interact with the data.\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Kitchen/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Kitchen)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Kitchen: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Kitchen MACOSX_BUNDLE Kitchen.cxx )\n  target_link_libraries(Kitchen PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Kitchen\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Kitchen/#download-and-build-kitchen","title":"Download and Build Kitchen","text":"

Click here to download Kitchen and its CMakeLists.txt file. Once the tarball Kitchen.tar has been downloaded and extracted,

cd Kitchen/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Kitchen\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/KochSnowflake/","title":"KochSnowflake","text":"

vtk-examples/Cxx/Visualization/KochSnowflake

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/KochSnowflake/#description","title":"Description","text":"

This demo uses recursion to represent a Koch snowflake fractal. For more information about this fractal, there are many resources on the web: http://en.wikipedia.org/wiki/Koch_snowflake, http://mathworld.wolfram.com/KochSnowflake.html.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/KochSnowflake/#code","title":"Code","text":"

KochSnowflake.cxx

#include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangle.h>\n\nnamespace {\n\nconstexpr int LEVEL = 6;\n\n/*----------------------------------------------------------------------------*\n *                       Koch Snowflake as vtkPolyLine                        *\n *----------------------------------------------------------------------------*/\nvtkSmartPointer<vtkPolyData> AsPolyLine(vtkSmartPointer<vtkPoints> points,\n                                        int level);\n\n/*----------------------------------------------------------------------------*\n *                Koch Snowflake as collection of vtkTriangles                *\n *----------------------------------------------------------------------------*/\nvoid AsTriangles(int start, int end, vtkCellArray* cells, int level,\n                 vtkIntArray* data);\n\n} // namespace\n\n/*----------------------------------------------------------------------------*\n *                                Main Method                                 *\n *----------------------------------------------------------------------------*/\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Initially, set up the points to be an equilateral triangle. Note that the\n  // first point is the same as the last point to make this a closed curve when\n  // I create the vtkPolyLine.\n  vtkNew<vtkPoints> points;\n  for (int i = 0; i < 4; i++)\n  {\n    points->InsertNextPoint(cos(2. * vtkMath::Pi() * i / 3),\n                            sin(2 * vtkMath::Pi() * i / 3.), 0.);\n  }\n\n  auto outline_pd = AsPolyLine(points, LEVEL);\n  // You have already gone through the trouble of putting the points in the\n  // right places - so \"all\" you need to do now is to create polygons from the\n  // points that are in the vtkPoints.\n\n  // The points that are passed in, have an overlap of the beginning and the\n  // end.\n\n  // Set this up for each of the initial sides, then call the recursive\n  // function.\n  vtkNew<vtkCellArray> triangles;\n  int stride = outline_pd->GetPoints()->GetNumberOfPoints() / 3;\n\n  // The cell data will allow us to color the triangles based on the level of\n  // the iteration of the Koch snowflake.\n  vtkNew<vtkIntArray> data;\n  data->SetNumberOfComponents(0);\n  data->SetName(\"Iteration Level\");\n\n  // This is the starting triangle.\n  vtkNew<vtkTriangle> t;\n  t->GetPointIds()->SetId(0, 0);\n  t->GetPointIds()->SetId(1, stride);\n  t->GetPointIds()->SetId(2, 2 * stride);\n  triangles->InsertNextCell(t);\n  data->InsertNextValue(0);\n\n  AsTriangles(0, stride, triangles, 1, data);\n  AsTriangles(stride, 2 * stride, triangles, 1, data);\n  AsTriangles(2 * stride, 3 * stride, triangles, 1, data);\n\n  vtkNew<vtkPolyData> triangle_pd;\n  triangle_pd->SetPoints(outline_pd->GetPoints());\n  triangle_pd->SetPolys(triangles);\n  triangle_pd->GetCellData()->SetScalars(data);\n\n  //-----------------//\n  // rendering stuff //\n  //-----------------//\n  vtkNew<vtkPolyDataMapper> outline_mapper;\n  outline_mapper->SetInputData(outline_pd);\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(256);\n  lut->SetHueRange(0.6, 0.6);\n  lut->SetSaturationRange(0., 1.);\n  lut->Build();\n\n  vtkNew<vtkPolyDataMapper> triangle_mapper;\n  triangle_mapper->SetInputData(triangle_pd);\n  triangle_mapper->SetScalarRange(0.0, LEVEL);\n  triangle_mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> outline_actor;\n  outline_actor->SetMapper(outline_mapper);\n\n  vtkNew<vtkActor> triangle_actor;\n  triangle_actor->SetMapper(triangle_mapper);\n\n  vtkNew<vtkRenderer> outline_ren;\n  outline_ren->AddActor(outline_actor);\n  outline_ren->SetViewport(0.0, 0.0, 0.5, 1.0);\n  outline_ren->SetBackground(colors->GetColor3d(\"CornFlowerBLue\").GetData());\n\n  vtkNew<vtkRenderer> triangle_ren;\n  triangle_ren->AddActor(triangle_actor);\n  triangle_ren->SetViewport(0.5, 0.0, 1.0, 1.0);\n  triangle_ren->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n  triangle_ren->SetActiveCamera(outline_ren->GetActiveCamera());\n\n  vtkNew<vtkRenderWindow> renw;\n  renw->SetMultiSamples(0);\n  renw->AddRenderer(outline_ren);\n  renw->AddRenderer(triangle_ren);\n  renw->SetSize(800, 400);\n  renw->SetWindowName(\"KochSnowflake\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renw);\n\n  outline_ren->ResetCamera();\n  renw->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkPolyData> AsPolyLine(vtkSmartPointer<vtkPoints> points,\n                                        int level)\n{\n  // Use the points from the previous iteration to create the points of the\n  // next level. There is an assumption on my part that the curve is traversed\n  // in a counterclockwise fashion. If the initial triangle above is written to\n  // describe clockwise motion, the points will face inward instead of outward.\n  for (int i = 0; i < level; i++)\n  {\n    // We're going to make the next set of points from the old one and swap\n    // them at the end. The vtkSmartPointer will go out of scope and be\n    // deleted.\n    vtkNew<vtkPoints> temp;\n    double v0[3];\n    double v1[3];\n\n    // The first point of the previous vtkPoints is the first point of the next\n    // vtkPoints.\n    points->GetPoint(0, v0);\n    temp->InsertNextPoint(v0);\n\n    // Iterate over \"edges\" in the vtkPoints\n    for (int ii = 1; ii < points->GetNumberOfPoints(); ii++)\n    {\n      points->GetPoint(ii - 1, v0);\n      points->GetPoint(ii, v1);\n      double t = sqrt(vtkMath::Distance2BetweenPoints(v0, v1));\n      double nx = (v1[0] - v0[0]) / t; // x-component of edge unit tangent\n      double ny = (v1[1] - v0[1]) / t; // y-component of edge unit tangent\n\n      v1[0] = v0[0] + nx * t / 3.;\n      v1[1] = v0[1] + ny * t / 3.;\n      v1[2] = 0.;\n      temp->InsertNextPoint(v1);\n\n      v1[0] = v0[0] + t * (nx / 2. + ny * sqrt(3.) / 6.);\n      v1[1] = v0[1] + t * (ny / 2. - nx * sqrt(3.) / 6.);\n      v1[2] = 0.;\n      temp->InsertNextPoint(v1);\n\n      v1[0] = v0[0] + 2. / 3. * nx * t;\n      v1[1] = v0[1] + 2. / 3. * ny * t;\n      v1[2] = 0.;\n      temp->InsertNextPoint(v1);\n\n      v1[0] = v0[0] + nx * t;\n      v1[1] = v0[1] + ny * t;\n      v1[2] = 0.;\n      temp->InsertNextPoint(v1);\n    }\n    points = temp;\n  }\n\n  // draw the outline\n  vtkNew<vtkCellArray> lines;\n  vtkNew<vtkPolyLine> pl;\n  pl->GetPointIds()->SetNumberOfIds(points->GetNumberOfPoints());\n  for (int i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    pl->GetPointIds()->SetId(i, i);\n  }\n  lines->InsertNextCell(pl);\n\n  // Complete the polydata.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetLines(lines);\n  polydata->SetPoints(points);\n\n  return polydata;\n}\n\nvoid AsTriangles(int start, int end, vtkCellArray* cells, int level,\n                 vtkIntArray* data)\n{\n  if (end - start >= 3)\n  {\n    int stride = (end - start + 1) / 4;\n\n    vtkNew<vtkTriangle> triangle;\n    triangle->GetPointIds()->SetId(0, start + stride);\n    triangle->GetPointIds()->SetId(1, start + 2 * stride);\n    triangle->GetPointIds()->SetId(2, start + 3 * stride);\n\n    cells->InsertNextCell(triangle);\n    data->InsertNextValue(level);\n\n    AsTriangles(start, start + stride, cells, level + 1, data);\n    AsTriangles(start + stride, start + 2 * stride, cells, level + 1, data);\n    AsTriangles(start + 2 * stride, start + 3 * stride, cells, level + 1, data);\n    AsTriangles(start + 3 * stride, start + 4 * stride, cells, level + 1, data);\n  }\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/KochSnowflake/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KochSnowflake)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KochSnowflake: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KochSnowflake MACOSX_BUNDLE KochSnowflake.cxx )\n  target_link_libraries(KochSnowflake PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KochSnowflake\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/KochSnowflake/#download-and-build-kochsnowflake","title":"Download and Build KochSnowflake","text":"

Click here to download KochSnowflake and its CMakeLists.txt file. Once the tarball KochSnowflake.tar has been downloaded and extracted,

cd KochSnowflake/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./KochSnowflake\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/LODProp3D/","title":"LODProp3D","text":"

vtk-examples/Cxx/Visualization/LODProp3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/LODProp3D/#description","title":"Description","text":"

If you have a fast graphics card, you may not see a difference.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/LODProp3D/#code","title":"Code","text":"

LODProp3D.cxx

#include <vtkCallbackCommand.h>\n#include <vtkLODProp3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid RefreshCallback(vtkObject* vtkNotUsed(caller),\n                     long unsigned int vtkNotUsed(eventId), void* clientData,\n                     void* vtkNotUsed(callData));\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // High res sphere.\n  vtkNew<vtkSphereSource> highResSphereSource;\n  int res = 100;\n  highResSphereSource->SetThetaResolution(res);\n  highResSphereSource->SetPhiResolution(res);\n  highResSphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> highResMapper;\n  highResMapper->SetInputConnection(highResSphereSource->GetOutputPort());\n\n  // Low res sphere.\n  vtkNew<vtkSphereSource> lowResSphereSource;\n\n  vtkNew<vtkPolyDataMapper> lowResMapper;\n  lowResMapper->SetInputConnection(lowResSphereSource->GetOutputPort());\n\n  vtkNew<vtkProperty> propertyLowRes;\n  propertyLowRes->SetDiffuseColor(\n      colors->GetColor3d(\"BlanchedAlmond\").GetData());\n  propertyLowRes->SetInterpolationToFlat();\n\n  vtkNew<vtkProperty> propertyHighRes;\n  propertyHighRes->SetDiffuseColor(colors->GetColor3d(\"MistyRose\").GetData());\n  propertyHighRes->SetInterpolationToFlat();\n\n  vtkNew<vtkLODProp3D> prop;\n  prop->AddLOD(lowResMapper, propertyLowRes, 0.0);\n  prop->AddLOD(highResMapper, propertyHighRes, 0.0);\n\n  std::cout << \"There are \" << prop->GetNumberOfLODs() << \" LODs\" << std::endl;\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LODProp3D\");\n\n  // prop->SetAllocatedRenderTime(1e-6,renderer);\n  prop->SetAllocatedRenderTime(1e-12, renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(prop);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkCallbackCommand> refreshCallback;\n  refreshCallback->SetCallback(RefreshCallback);\n  refreshCallback->SetClientData(prop);\n\n  renderWindow->AddObserver(vtkCommand::ModifiedEvent, refreshCallback);\n\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid RefreshCallback(vtkObject* vtkNotUsed(caller),\n                     long unsigned int vtkNotUsed(eventId), void* clientData,\n                     void* vtkNotUsed(callData))\n{\n  auto lodProp = static_cast<vtkLODProp3D*>(clientData);\n  std::cout << \"Last rendered LOD ID: \" << lodProp->GetLastRenderedLODID()\n            << std::endl;\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/LODProp3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LODProp3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LODProp3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LODProp3D MACOSX_BUNDLE LODProp3D.cxx )\n  target_link_libraries(LODProp3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LODProp3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/LODProp3D/#download-and-build-lodprop3d","title":"Download and Build LODProp3D","text":"

Click here to download LODProp3D and its CMakeLists.txt file. Once the tarball LODProp3D.tar has been downloaded and extracted,

cd LODProp3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LODProp3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/LabelContours/","title":"LabelContours","text":"

vtk-examples/Cxx/Visualization/LabelContours

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/LabelContours/#description","title":"Description","text":"

This example labels isolines created by vtkContourFilter. After the isolines are generated, the resulting disconnected lines segments are gathered into polylines by vtkStripper. Then an appropriate position along each line is chosen to place the label for the contour. Two strategies for label placement are illustrated: a point at the midpoint of the line or a random point. vtkLabeledDataMapper places the labels for the contour lines.

The program can be run with an input XML polydata file (.vtp) or without arguments. If a file is specified then one, two or a range of contours can be specified. If run without a file name, the example generates a random scalar field on a plane.

Note

The labels are represented as vtkActor2D's. If they are generated for a 3D surface, the labels that should be hidden will still be displayed.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/LabelContours/#code","title":"Code","text":"

LabelContours.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCellArray.h>\n#include <vtkContourFilter.h>\n#include <vtkDataArray.h>\n#include <vtkDoubleArray.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStripper.h>\n#include <vtkTextProperty.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iomanip>\n#include <iostream>\n\n#ifdef VTK_CELL_ARRAY_V2\n#include <vtkCellArrayIterator.h>\n#endif // VTK_CELL_ARRAY_V2\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int pointThreshold = 10;\n\n  vtkSmartPointer<vtkPolyData> polyData;\n  vtkNew<vtkContourFilter> contours;\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(1);\n\n  // If a file is present, read it, otherwise generate some random\n  // scalars on a plane.\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    double range[2];\n    reader->GetOutput()->GetScalarRange(range);\n    polyData = reader->GetOutput();\n\n    std::cout << \"range: \" << range[0] << \", \" << range[1] << std::endl;\n    contours->SetValue(0, (range[1] + range[0]) / 2.0);\n\n    contours->SetInputConnection(reader->GetOutputPort());\n    if (argc == 3)\n    {\n      contours->SetValue(0, atof(argv[2]));\n    }\n    else if (argc == 4)\n    {\n      contours->SetValue(0, atof(argv[2]));\n      contours->SetValue(1, atof(argv[3]));\n    }\n    else if (argc == 5)\n    {\n      contours->GenerateValues(atoi(argv[2]), atof(argv[3]), atof(argv[4]));\n    }\n  }\n  else\n  {\n    vtkNew<vtkPlaneSource> plane;\n    plane->SetXResolution(10);\n    plane->SetYResolution(10);\n    plane->Update();\n\n    vtkNew<vtkDoubleArray> randomScalars;\n    randomScalars->SetNumberOfComponents(1);\n    randomScalars->SetName(\"Isovalues\");\n    for (int i = 0; i < plane->GetOutput()->GetNumberOfPoints(); i++)\n    {\n      randomScalars->InsertNextTuple1(\n          randomSequence->GetRangeValue(-100.0, 100.0));\n      randomSequence->Next();\n    }\n    plane->GetOutput()->GetPointData()->SetScalars(randomScalars);\n    polyData = plane->GetOutput();\n    contours->SetInputConnection(plane->GetOutputPort());\n    contours->GenerateValues(5, -100, 100);\n    pointThreshold = 0;\n  }\n\n  // Connect the segments of the contours into polylines.\n  vtkNew<vtkStripper> contourStripper;\n  contourStripper->SetInputConnection(contours->GetOutputPort());\n  contourStripper->Update();\n\n  auto numberOfContourLines = contourStripper->GetOutput()->GetNumberOfLines();\n\n  std::cout << \"There are \" << numberOfContourLines << \" contour lines.\"\n            << std::endl;\n\n  vtkPoints* points = contourStripper->GetOutput()->GetPoints();\n  vtkCellArray* cells = contourStripper->GetOutput()->GetLines();\n  vtkDataArray* scalars =\n      contourStripper->GetOutput()->GetPointData()->GetScalars();\n\n  // Create a polydata that contains point locations for the contour\n  // line labels.\n  vtkNew<vtkPolyData> labelPolyData;\n  vtkNew<vtkPoints> labelPoints;\n  vtkNew<vtkDoubleArray> labelScalars;\n  labelScalars->SetNumberOfComponents(1);\n  labelScalars->SetName(\"Isovalues\");\n\n#ifdef VTK_CELL_ARRAY_V2\n\n  // Newer versions of vtkCellArray prefer local iterators:\n  auto cellIter = vtk::TakeSmartPointer(cells->NewIterator());\n  for (cellIter->GoToFirstCell(); !cellIter->IsDoneWithTraversal();\n       cellIter->GoToNextCell())\n  {\n    vtkIdList* cell = cellIter->GetCurrentCell();\n    if (cell->GetNumberOfIds() < pointThreshold)\n    {\n      continue;\n    }\n    std::cout << \"Line \" << cellIter->GetCurrentCellId() << \": \" << std::endl;\n\n    // Compute the point id to hold the label.\n    // Mid point or a random point.\n    // const vtkIdType samplePtIdx = cell->GetNumberOfIds() / 2;\n    const vtkIdType samplePtIdx = static_cast<vtkIdType>(\n        randomSequence->GetRangeValue(0, cell->GetNumberOfIds()));\n    randomSequence->Next();\n\n    auto midPointId = cell->GetId(samplePtIdx);\n\n    double midPoint[3];\n    points->GetPoint(midPointId, midPoint);\n    std::cout << \"\\tmidPoint is \" << midPointId << \" with coordinate \"\n              << \"(\" << std::fixed << std::setprecision(2) << midPoint[0]\n              << \", \" << midPoint[1] << \", \" << midPoint[2] << \")\"\n              << \" and value \" << scalars->GetTuple1(midPointId) << std::endl;\n    labelPoints->InsertNextPoint(midPoint);\n    labelScalars->InsertNextTuple1(scalars->GetTuple1(midPointId));\n  }\n\n#else // VTK_CELL_ARRAY_V2\n\n  // Older implementations of vtkCellArray use internal iterator APIs (not\n  // thread safe):\n  vtkIdType* indices;\n  vtkIdType numberOfPoints;\n  unsigned int lineCount = 0;\n  for (cells->InitTraversal(); cells->GetNextCell(numberOfPoints, indices);\n       lineCount++)\n  {\n    if (numberOfPoints < pointThreshold)\n    {\n      continue;\n    }\n    std::cout << \"Line \" << lineCount << \": \" << std::endl;\n\n    // Compute the point id to hold the label.\n    // Mid point or a random point.\n    // auto midPointId = indices[numberOfPoints / 2];\n    // auto midPointId =\n    //    indices[static_cast<vtkIdType>(vtkMath::Random(0, numberOfPoints))];\n    const vtkIdType samplePtIdx = static_cast<vtkIdType>(\n        randomSequence->GetRangeValue(0, cell->GetNumberOfIds()));\n    randomSequence->Next();\n\n    double midPoint[3];\n    points->GetPoint(midPointId, midPoint);\n    std::cout << \"\\tmidPoint is \" << midPointId << \" with coordinate \"\n              << \"(\" << std::fixed << std::setprecision(2) << midPoint[0]\n              << \", \" << midPoint[1] << \", \" << midPoint[2] << \")\"\n              << \" and value \" << scalars->GetTuple1(midPointId) << std::endl;\n    labelPoints->InsertNextPoint(midPoint);\n    labelScalars->InsertNextTuple1(scalars->GetTuple1(midPointId));\n  }\n\n#endif // VTK_CELL_ARRAY_V2\n\n  labelPolyData->SetPoints(labelPoints);\n  labelPolyData->GetPointData()->SetScalars(labelScalars);\n\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contourStripper->GetOutputPort());\n  contourMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isolines;\n  isolines->SetMapper(contourMapper);\n  isolines->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  isolines->GetProperty()->SetLineWidth(2);\n\n  vtkNew<vtkLookupTable> surfaceLUT;\n  surfaceLUT->SetRange(polyData->GetPointData()->GetScalars()->GetRange());\n  surfaceLUT->Build();\n\n  vtkNew<vtkPolyDataMapper> surfaceMapper;\n  surfaceMapper->SetInputData(polyData);\n  surfaceMapper->ScalarVisibilityOn();\n  surfaceMapper->SetScalarRange(\n      polyData->GetPointData()->GetScalars()->GetRange());\n  surfaceMapper->SetLookupTable(surfaceLUT);\n\n  vtkNew<vtkActor> surface;\n  surface->SetMapper(surfaceMapper);\n\n  // The labeled data mapper will place labels at the points.\n  vtkNew<vtkLabeledDataMapper> labelMapper;\n  labelMapper->SetFieldDataName(\"Isovalues\");\n  labelMapper->SetInputData(labelPolyData);\n  labelMapper->SetLabelModeToLabelScalars();\n  labelMapper->SetLabelFormat(\"%6.2f\");\n  labelMapper->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkActor2D> isolabels;\n  isolabels->SetMapper(labelMapper);\n\n  // Create a renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(600, 600);\n  renderWindow->SetWindowName(\"LabelContours\");\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(surface);\n  renderer->AddActor(isolines);\n  renderer->AddActor(isolabels);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render the scene (lights and cameras are created automatically).\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/LabelContours/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LabelContours)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LabelContours: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LabelContours MACOSX_BUNDLE LabelContours.cxx )\n  target_link_libraries(LabelContours PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LabelContours\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/LabelContours/#download-and-build-labelcontours","title":"Download and Build LabelContours","text":"

Click here to download LabelContours and its CMakeLists.txt file. Once the tarball LabelContours.tar has been downloaded and extracted,

cd LabelContours/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LabelContours\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/LabelPlacementMapper/","title":"LabelPlacementMapper","text":"

vtk-examples/Cxx/Visualization/LabelPlacementMapper

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/LabelPlacementMapper/#description","title":"Description","text":"

This example demonstrates how to add labels from an array to points. Each point is given a priority that determines which labels are visible when space is limited.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/LabelPlacementMapper/#code","title":"Code","text":"

LabelPlacementMapper.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkIntArray.h>\n#include <vtkLabelPlacementMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPointSetToLabelHierarchy.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkStringArray.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph.\n * @param scale - The scale, used to determine the size of the glyph.\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05.\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a point set.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(6);\n  pointSource->Update();\n\n  // Add label array.\n  vtkNew<vtkStringArray> labels;\n  labels->SetNumberOfValues(6);\n  labels->SetName(\"labels\");\n  labels->SetValue(0, \"Priority 10\");\n  labels->SetValue(1, \"Priority 7\");\n  labels->SetValue(2, \"Priority 6\");\n  labels->SetValue(3, \"Priority 4\");\n  labels->SetValue(4, \"Priority 4\");\n  labels->SetValue(5, \"Priority 4\");\n  pointSource->GetOutput()->GetPointData()->AddArray(labels);\n\n  // Add priority array.\n  vtkNew<vtkIntArray> sizes;\n  sizes->SetNumberOfValues(6);\n  sizes->SetName(\"sizes\");\n  sizes->SetValue(0, 10);\n  sizes->SetValue(1, 7);\n  sizes->SetValue(2, 6);\n  sizes->SetValue(3, 4);\n  sizes->SetValue(4, 4);\n  sizes->SetValue(5, 4);\n  pointSource->GetOutput()->GetPointData()->AddArray(sizes);\n\n  // Create a mapper and actor for the points.\n  vtkNew<vtkPolyDataMapper> pointMapper;\n  pointMapper->SetInputConnection(pointSource->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n\n  // Map the points to spheres\n  auto sphereActor = PointToGlyph(pointSource->GetOutput()->GetPoints(), 0.05);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Generate the label hierarchy.\n  vtkNew<vtkPointSetToLabelHierarchy> pointSetToLabelHierarchyFilter;\n  pointSetToLabelHierarchyFilter->SetInputConnection(\n      pointSource->GetOutputPort());\n  pointSetToLabelHierarchyFilter->SetLabelArrayName(\"labels\");\n  pointSetToLabelHierarchyFilter->SetPriorityArrayName(\"sizes\");\n  pointSetToLabelHierarchyFilter->Update();\n\n  // Create a mapper and actor for the labels.\n  vtkNew<vtkLabelPlacementMapper> labelMapper;\n  labelMapper->SetInputConnection(\n      pointSetToLabelHierarchyFilter->GetOutputPort());\n  vtkNew<vtkActor2D> labelActor;\n  labelActor->SetMapper(labelMapper);\n  // labelActor->GetProperty()->SetColor(\n  //    colors->GetColor3d(\"Yellow\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LabelPlacementMapper\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(pointActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(labelActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/LabelPlacementMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LabelPlacementMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LabelPlacementMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LabelPlacementMapper MACOSX_BUNDLE LabelPlacementMapper.cxx )\n  target_link_libraries(LabelPlacementMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LabelPlacementMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/LabelPlacementMapper/#download-and-build-labelplacementmapper","title":"Download and Build LabelPlacementMapper","text":"

Click here to download LabelPlacementMapper and its CMakeLists.txt file. Once the tarball LabelPlacementMapper.tar has been downloaded and extracted,

cd LabelPlacementMapper/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LabelPlacementMapper\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/LabeledDataMapper/","title":"LabeledDataMapper","text":"

vtk-examples/Cxx/Visualization/LabeledDataMapper

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/LabeledDataMapper/#description","title":"Description","text":"

This example demonstrates how to display the point ID at each point.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/LabeledDataMapper/#code","title":"Code","text":"

LabeledDataMapper.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph.\n * @param scale - The scale, used to determine the size of the glyph.\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05.\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n  // Create a point set\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(10);\n  pointSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> pointMapper;\n  pointMapper->SetInputConnection(pointSource->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetPointSize(1);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Map the points to spheres.\n  auto sphereActor = PointToGlyph(pointSource->GetOutput()->GetPoints(), 0.02);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkLabeledDataMapper> labelMapper;\n  labelMapper->SetInputConnection(pointSource->GetOutputPort());\n  labelMapper->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"Magenta\").GetData());\n\n  vtkNew<vtkActor2D> labelActor;\n  labelActor->SetMapper(labelMapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LabeledDataMapper\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  // renderer->AddActor(pointActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(labelActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/LabeledDataMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LabeledDataMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LabeledDataMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LabeledDataMapper MACOSX_BUNDLE LabeledDataMapper.cxx )\n  target_link_libraries(LabeledDataMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LabeledDataMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/LabeledDataMapper/#download-and-build-labeleddatamapper","title":"Download and Build LabeledDataMapper","text":"

Click here to download LabeledDataMapper and its CMakeLists.txt file. Once the tarball LabeledDataMapper.tar has been downloaded and extracted,

cd LabeledDataMapper/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LabeledDataMapper\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/LabeledMesh/","title":"LabeledMesh","text":"

vtk-examples/Cxx/Visualization/LabeledMesh

"},{"location":"Cxx/Visualization/LabeledMesh/#description","title":"Description","text":"

This example was translated into C++ from its TCL counterpart by Jake Nickel from the University of Iowa. It demonstrates the use of vtkLabeledDataMapper. This class is used for displaying numerical data from an underlying data set. In the case of this example, the underlying data are the point and cell ids.

Note

This original source code for this example is here.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/LabeledMesh/#code","title":"Code","text":"

LabeledMesh.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCellArray.h>\n#include <vtkCellCenters.h>\n#include <vtkIdFilter.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelectVisiblePoints.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nnamespace {\nint xLength;\nint yLength;\ntypedef struct\n{\n  vtkSmartPointer<vtkSelectVisiblePoints> visPts;\n  vtkSmartPointer<vtkSelectVisiblePoints> visCells;\n  vtkSmartPointer<vtkPoints> pts;\n  vtkSmartPointer<vtkRenderWindow> renWin;\n} VTKData;\n\n// Create a procedure to draw the selection window at each location it\n// is moved to.\nvoid PlaceWindow(VTKData const& data, int xmin, int ymin);\n\n// Create a procedure to move the selection window across the data set.\nvoid MoveWindow(VTKData const& data);\n\n} // namespace\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a selection window.  We will display the point and cell ids that\n  // lie within this window.\n  int xmin = 200;\n  xLength = 100;\n  int xmax = xmin + xLength;\n  int ymin = 200;\n  yLength = 100;\n  int ymax = ymin + yLength;\n\n  vtkNew<vtkPoints> pts;\n  pts->InsertPoint(0, xmin, ymin, 0);\n  pts->InsertPoint(1, xmax, ymin, 0);\n  pts->InsertPoint(2, xmax, ymax, 0);\n  pts->InsertPoint(3, xmin, ymax, 0);\n\n  vtkNew<vtkCellArray> rect;\n  rect->InsertNextCell(5);\n  rect->InsertCellPoint(0);\n  rect->InsertCellPoint(1);\n  rect->InsertCellPoint(2);\n  rect->InsertCellPoint(3);\n  rect->InsertCellPoint(0);\n\n  vtkNew<vtkPolyData> selectRect;\n  selectRect->SetPoints(pts);\n  selectRect->SetLines(rect);\n\n  vtkNew<vtkPolyDataMapper2D> rectMapper;\n  rectMapper->SetInputData(selectRect);\n\n  vtkNew<vtkActor2D> rectActor;\n  rectActor->SetMapper(rectMapper);\n  rectActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create a sphere and its associated mapper and actor.\n  vtkNew<vtkSphereSource> sphere;\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BurlyWood\").GetData());\n\n  // Generate data arrays containing point and cell ids\n  vtkNew<vtkIdFilter> ids;\n  ids->SetInputConnection(sphere->GetOutputPort());\n  ids->PointIdsOn();\n  ids->CellIdsOn();\n  ids->FieldDataOn();\n\n  // Create the renderer here because vtkSelectVisiblePoints needs it.\n  vtkNew<vtkRenderer> ren1;\n  ren1->UseHiddenLineRemovalOn();\n\n  // Create labels for points\n  vtkNew<vtkSelectVisiblePoints> visPts;\n  visPts->SetInputConnection(ids->GetOutputPort());\n  visPts->SetRenderer(ren1);\n  visPts->SelectionWindowOn();\n  visPts->SetSelection(xmin, xmin + xLength, ymin, ymin + yLength);\n\n  // Create the mapper to display the point ids.  Specify the\n  // format to use for the labels.  Also create the associated actor.\n  vtkNew<vtkLabeledDataMapper> ldm;\n  ldm->SetInputConnection(visPts->GetOutputPort());\n  ldm->SetLabelModeToLabelFieldData();\n\n  vtkNew<vtkActor2D> pointLabels;\n  pointLabels->SetMapper(ldm);\n  pointLabels->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // Create labels for cells\n  vtkNew<vtkCellCenters> cc;\n  cc->SetInputConnection(ids->GetOutputPort());\n\n  vtkNew<vtkSelectVisiblePoints> visCells;\n  visCells->SetInputConnection(cc->GetOutputPort());\n  visCells->SetRenderer(ren1);\n  visCells->SelectionWindowOn();\n  visCells->SetSelection(xmin, xmin + xLength, ymin, ymin + yLength);\n\n  // Create the mapper to display the cell ids.  Specify the\n  // format to use for the labels.  Also create the associated actor.\n  vtkNew<vtkLabeledDataMapper> cellMapper;\n  cellMapper->SetInputConnection(visCells->GetOutputPort());\n  cellMapper->SetLabelModeToLabelFieldData();\n  cellMapper->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"DarkGreen\").GetData());\n\n  vtkNew<vtkActor2D> cellLabels;\n  cellLabels->SetMapper(cellMapper);\n\n  // Create the RenderWindow and RenderWindowInteractor\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer; set the background and size; render\n  ren1->AddActor(sphereActor);\n  ren1->AddActor2D(rectActor);\n  ren1->AddActor2D(pointLabels);\n  ren1->AddActor2D(cellLabels);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renWin->SetSize(500, 500);\n  renWin->SetWindowName(\"LabeledMesh\");\n\n  renWin->Render();\n\n  VTKData data = {visPts, visCells, pts, renWin};\n\n  // Move the selection window across the data set.\n  MoveWindow(data);\n\n  // Put the selection window in the center of the render window.\n  // This works because the xmin = ymin = 200, xLength = yLength = 100, and\n  // the render window size is 500 x 500.\n  PlaceWindow(data, xmin, ymin);\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid PlaceWindow(VTKData const& data, int xmin, int ymin)\n{\n  int xmax = xmin + xLength;\n  int ymax = ymin + yLength;\n\n  data.visPts->SetSelection(xmin, xmax, ymin, ymax);\n  data.visCells->SetSelection(xmin, xmax, ymin, ymax);\n\n  data.pts->InsertPoint(0, xmin, ymin, 0);\n  data.pts->InsertPoint(1, xmin, ymin, 0);\n  data.pts->InsertPoint(2, xmin, ymin, 0);\n  data.pts->InsertPoint(3, xmin, ymin, 0);\n\n  // Call Modified because InsertPoints does not modify vtkPoints\n  // (for performance reasons).\n  data.pts->Modified();\n\n  data.renWin->Render();\n}\n\nvoid MoveWindow(VTKData const& data)\n{\n  for (int y = 100; y < 300; y += 25)\n  {\n    for (int x = 100; x < 300; x += 25)\n    {\n      PlaceWindow(data, x, y);\n    }\n  }\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/LabeledMesh/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LabeledMesh)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LabeledMesh: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LabeledMesh MACOSX_BUNDLE LabeledMesh.cxx )\n  target_link_libraries(LabeledMesh PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LabeledMesh\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/LabeledMesh/#download-and-build-labeledmesh","title":"Download and Build LabeledMesh","text":"

Click here to download LabeledMesh and its CMakeLists.txt file. Once the tarball LabeledMesh.tar has been downloaded and extracted,

cd LabeledMesh/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LabeledMesh\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Legend/","title":"Legend","text":"

vtk-examples/Cxx/Visualization/Legend

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Legend/#code","title":"Code","text":"

Legend.cxx

#include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5000.0);\n  sphereSource->Update();\n\n  vtkPolyData* polydata = sphereSource->GetOutput();\n\n  // Create a mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  // Create an actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Legend\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkLegendBoxActor> legend;\n  legend->SetNumberOfEntries(2);\n\n  double color[4];\n\n  vtkNew<vtkCubeSource> legendBox;\n  legendBox->Update();\n  colors->GetColor(\"Tomato\", color);\n  legend->SetEntry(0, legendBox->GetOutput(), \"Box\", color);\n\n  colors->GetColor(\"Banana\", color);\n  legend->SetEntry(1, sphereSource->GetOutput(), \"Ball\", color);\n\n  // place legend in lower right\n  legend->GetPositionCoordinate()->SetCoordinateSystemToView();\n  legend->GetPositionCoordinate()->SetValue(0.5, -1.0);\n\n  legend->GetPosition2Coordinate()->SetCoordinateSystemToView();\n  legend->GetPosition2Coordinate()->SetValue(1.0, -0.5);\n\n  legend->UseBackgroundOn();\n  double background[4];\n  colors->GetColor(\"SlateGray\", background);\n  legend->SetBackgroundColor(background);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(legend);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->Render();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Legend/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Legend)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Legend: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Legend MACOSX_BUNDLE Legend.cxx )\n  target_link_libraries(Legend PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Legend\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Legend/#download-and-build-legend","title":"Download and Build Legend","text":"

Click here to download Legend and its CMakeLists.txt file. Once the tarball Legend.tar has been downloaded and extracted,

cd Legend/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Legend\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/LegendScaleActor/","title":"LegendScaleActor","text":"

vtk-examples/Cxx/Visualization/LegendScaleActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/LegendScaleActor/#code","title":"Code","text":"

LegendScaleActor.cxx

#include <vtkActor.h>\n#include <vtkLegendScaleActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricEnneper.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // The source will be a parametric function.\n  vtkNew<vtkParametricEnneper> src;\n  vtkNew<vtkParametricFunctionSource> fnSrc;\n  fnSrc->SetParametricFunction(src);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(fnSrc->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LegendScaleActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkLegendScaleActor> legendScaleActor;\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor(legendScaleActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/LegendScaleActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LegendScaleActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LegendScaleActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LegendScaleActor MACOSX_BUNDLE LegendScaleActor.cxx )\n  target_link_libraries(LegendScaleActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LegendScaleActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/LegendScaleActor/#download-and-build-legendscaleactor","title":"Download and Build LegendScaleActor","text":"

Click here to download LegendScaleActor and its CMakeLists.txt file. Once the tarball LegendScaleActor.tar has been downloaded and extracted,

cd LegendScaleActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LegendScaleActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/LineWidth/","title":"LineWidth","text":"

vtk-examples/Cxx/Visualization/LineWidth

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/LineWidth/#code","title":"Code","text":"

LineWidth.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkLineSource> lineSource;\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(lineSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetLineWidth(5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LineWidth\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Roll(45);\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/LineWidth/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LineWidth)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LineWidth: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LineWidth MACOSX_BUNDLE LineWidth.cxx )\n  target_link_libraries(LineWidth PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LineWidth\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/LineWidth/#download-and-build-linewidth","title":"Download and Build LineWidth","text":"

Click here to download LineWidth and its CMakeLists.txt file. Once the tarball LineWidth.tar has been downloaded and extracted,

cd LineWidth/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LineWidth\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/LoopShrink/","title":"LoopShrink","text":"

vtk-examples/Cxx/Visualization/LoopShrink

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/LoopShrink/#description","title":"Description","text":"

A network with a loop. VTK 5.0 and later do not allow you to execute a looping visualization network; this was possible in previous versions of VTK.

Info

See Figure 4-22 in Chapter 4 the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/LoopShrink/#code","title":"Code","text":"

LoopShrink.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCullerCollection.h>\n#include <vtkDataSetMapper.h>\n#include <vtkElevationFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->GetCullers()->RemoveAllItems();\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(12);\n  sphere->SetPhiResolution(12);\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(sphere->GetOutputPort());\n  shrink->SetShrinkFactor(0.9);\n\n  vtkNew<vtkElevationFilter> colorIt;\n  colorIt->SetInputConnection(shrink->GetOutputPort());\n  colorIt->SetLowPoint(0, 0, -.5);\n  colorIt->SetHighPoint(0, 0, .5);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(colorIt->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"LavenderBlush\").GetData());\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"LoopShrink\");\n\n  renWin->Render();\n\n  renderer->GetActiveCamera()->Zoom(1.5);\n\n  // Interact with the data.\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/LoopShrink/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LoopShrink)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LoopShrink: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LoopShrink MACOSX_BUNDLE LoopShrink.cxx )\n  target_link_libraries(LoopShrink PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LoopShrink\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/LoopShrink/#download-and-build-loopshrink","title":"Download and Build LoopShrink","text":"

Click here to download LoopShrink and its CMakeLists.txt file. Once the tarball LoopShrink.tar has been downloaded and extracted,

cd LoopShrink/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LoopShrink\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Lorenz/","title":"Lorenz","text":"

vtk-examples/Cxx/Visualization/Lorenz

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/Lorenz/#description","title":"Description","text":"

This example visualizes a Lorenz strange attractor by integrating the Lorenz equations in a volume. The number of visits in each voxel is recorded as a scalar function. The surface is extracted via vtkMarchingCubes using a visit value of 50. The number of integration steps is 10 million, in a volume of dimensions 200^3. The surface roughness is caused by the discrete nature of the evaluation function.

Info

See Figure 6-25 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Lorenz/#code","title":"Code","text":"

Lorenz.cxx

//\n/*\n * Create an iso-surface of the Lorenz attractor.\n *\n * Here we visualize a Lorenz strange attractor by integrating the Lorenz\n * equations in a volume. The number of visits in each voxel is recorded as a\n * scalar function. The surface is extracted via marching cubes using a visit\n * value of 50. The number of integration steps is 10 million, in a volume of\n * dimensions 200 x 200 * x 200. The surface roughness is caused by the discrete\n * nature of the evaluation function.\n */\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShortArray.h>\n#include <vtkStructuredPoints.h>\n\nint main(int, char*[])\n{\n  double Pr = 10.0; // The Lorenz parameters.\n  double b = 2.667;\n  double r = 28.0;\n  double x, y, z;       // starting (and current) x, y, z\n  double h = 0.01;      // integration step size\n  int resolution = 200; // slice resolution\n  int iter = 10000000;  // number of iterations\n  double xmin = -30.0;  // x, y, z range for voxels\n  double xmax = 30.0;\n  double ymin = -30.0;\n  double ymax = 30.0;\n  double zmin = -10.0;\n  double zmax = 60.0;\n\n  void options(int, char**);\n\n  // Take a stab at an integration step size.\n  auto xIncr = resolution / (xmax - xmin);\n  auto yIncr = resolution / (ymax - ymin);\n  auto zIncr = resolution / (zmax - zmin);\n\n  printf(\"The Lorenz Attractor\\n\");\n  printf(\"  Pr = %f\\n\", Pr);\n  printf(\"  b = %f\\n\", b);\n  printf(\"  r = %f\\n\", r);\n  printf(\"  integration step size = %f\\n\", h);\n  printf(\"  slice resolution = %d\\n\", resolution);\n  printf(\"  # of iterations = %d\\n\", iter);\n  printf(\"  specified range:\\n\");\n  printf(\"      x: %f, %f\\n\", xmin, xmax);\n  printf(\"      y: %f, %f\\n\", ymin, ymax);\n  printf(\"      z: %f, %f\\n\", zmin, zmax);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  x = randomSequence->GetRangeValue(xmin, xmax);\n  randomSequence->Next();\n  y = randomSequence->GetRangeValue(ymin, ymax);\n  randomSequence->Next();\n  z = randomSequence->GetRangeValue(zmin, zmax);\n  randomSequence->Next();\n  printf(\"  starting at %f, %f, %f\\n\", x, y, z);\n\n  // Allocate memory for the slices.\n  auto sliceSize = resolution * resolution;\n  auto numPts = sliceSize * resolution;\n  vtkNew<vtkShortArray> scalars;\n  auto s = scalars->WritePointer(0, numPts);\n  for (auto i = 0; i < numPts; i++)\n  {\n    s[i] = 0;\n  }\n  for (auto j = 0; j < iter; j++)\n  {\n    // Integrate to next time step.\n    auto xx = x + h * Pr * (y - x);\n    auto yy = y + h * (x * (r - z) - y);\n    auto zz = z + h * (x * y - (b * z));\n\n    x = xx;\n    y = yy;\n    z = zz;\n\n    // Calculate voxel index.\n    if (x < xmax && x > xmin && y < ymax && y > ymin && z < zmax && z > zmin)\n    {\n      auto xxx = static_cast<short>(static_cast<double>(xx - xmin) * xIncr);\n      auto yyy = static_cast<short>(static_cast<double>(yy - ymin) * yIncr);\n      auto zzz = static_cast<short>(static_cast<double>(zz - zmin) * zIncr);\n      auto index = xxx + yyy * resolution + zzz * sliceSize;\n      s[index] += 1;\n    }\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkStructuredPoints> volume;\n  volume->GetPointData()->SetScalars(scalars);\n  volume->SetDimensions(resolution, resolution, resolution);\n  volume->SetOrigin(xmin, ymin, zmin);\n  volume->SetSpacing((xmax - xmin) / resolution, (ymax - ymin) / resolution,\n                     (zmax - zmin) / resolution);\n\n  printf(\"  contouring...\\n\");\n  // Do the graphics dance.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create iso-surface.\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputData(volume);\n  contour->SetValue(0, 50);\n\n  // Create mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(contour->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"PaleGoldenrod\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"Lorenz\");\n\n  // Interact with the data.\n  renWin->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-67.645167, -25.714343, 63.483516);\n  camera->SetFocalPoint(3.224902, -4.398594, 29.552112);\n  camera->SetViewUp(-0.232264, 0.965078, 0.121151);\n  camera->SetDistance(81.414176);\n  camera->SetClippingRange(18.428905, 160.896031);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Lorenz/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Lorenz)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Lorenz: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Lorenz MACOSX_BUNDLE Lorenz.cxx )\n  target_link_libraries(Lorenz PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Lorenz\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Lorenz/#download-and-build-lorenz","title":"Download and Build Lorenz","text":"

Click here to download Lorenz and its CMakeLists.txt file. Once the tarball Lorenz.tar has been downloaded and extracted,

cd Lorenz/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Lorenz\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Morph3D/","title":"Morph3D","text":"

vtk-examples/Cxx/Visualization/Morph3D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/Morph3D/#description","title":"Description","text":"

This example uses vtkInterpolateDataSetAttributes to interpolate datasets created using vtkImplicitModeller. Then vtkContourFilter extracts the resulting isosurface. An animation loop of 100 steps shows each interpolated isosurface with a 100 millisecond delay between each frame.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Morph3D/#code","title":"Code","text":"

Morph3D.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitModeller.h>\n#include <vtkInterpolateDataSetAttributes.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorText.h>\n\n#include <vtksys/SystemTools.hxx>\n\nint main(int argc, char* argv[])\n{\n  double t = 2.0;\n  if (argc > 1)\n  {\n    t = atof(argv[1]);\n  }\n\n  // make the letter v\n  vtkNew<vtkVectorText> letterV;\n  letterV->SetText(\"v\");\n\n  // read the geometry file containing the letter t\n  vtkNew<vtkVectorText> letterT;\n  letterT->SetText(\"t\");\n\n  // read the geometry file containing the letter k\n  vtkNew<vtkVectorText> letterK;\n  letterK->SetText(\"k\");\n\n  // create implicit models of each letter\n  vtkNew<vtkImplicitModeller> blobbyV;\n  blobbyV->SetInputConnection(letterV->GetOutputPort());\n  blobbyV->SetMaximumDistance(.2);\n  blobbyV->SetSampleDimensions(50, 50, 12);\n  blobbyV->SetModelBounds(-0.5, 1.5, -0.5, 1.5, -0.5, 0.5);\n\n  vtkNew<vtkImplicitModeller> blobbyT;\n  blobbyT->SetInputConnection(letterT->GetOutputPort());\n  blobbyT->SetMaximumDistance(.2);\n  blobbyT->SetSampleDimensions(50, 50, 12);\n  blobbyT->SetModelBounds(-0.5, 1.5, -0.5, 1.5, -0.5, 0.5);\n\n  vtkNew<vtkImplicitModeller> blobbyK;\n  blobbyK->SetInputConnection(letterK->GetOutputPort());\n  blobbyK->SetMaximumDistance(.2);\n  blobbyK->SetSampleDimensions(50, 50, 12);\n  blobbyK->SetModelBounds(-0.5, 1.5, -0.5, 1.5, -0.5, 0.5);\n\n  // Interpolate the data\n  vtkNew<vtkInterpolateDataSetAttributes> interpolate;\n  interpolate->AddInputConnection(blobbyV->GetOutputPort());\n  interpolate->AddInputConnection(blobbyT->GetOutputPort());\n  interpolate->AddInputConnection(blobbyK->GetOutputPort());\n  interpolate->SetT(0.0);\n\n  // extract an iso surface\n  vtkNew<vtkContourFilter> blobbyIso;\n  blobbyIso->SetInputConnection(interpolate->GetOutputPort());\n  blobbyIso->SetValue(0, 0.1);\n\n  // map to rendering primitives\n  vtkNew<vtkPolyDataMapper> blobbyMapper;\n  blobbyMapper->SetInputConnection(blobbyIso->GetOutputPort());\n  blobbyMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkNamedColors> colors;\n\n  // now an actor\n  vtkNew<vtkActor> blobby;\n  blobby->SetMapper(blobbyMapper);\n  blobby->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  blobby->GetProperty()->EdgeVisibilityOn();\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCamera> camera;\n  camera->SetClippingRange(0.265, 13.2);\n  camera->SetFocalPoint(0.539, 0.47464, 0);\n  camera->SetPosition(0.539, 0.474674, 2.644);\n  camera->SetViewUp(0, 1, 0);\n  camera->Azimuth(30.);\n  camera->Elevation(30.);\n  renderer->SetActiveCamera(camera);\n\n  //  now  make a renderer and tell it about lights and actors\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"Morph3D\");\n\n  renderer->AddActor(blobby);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  for (unsigned i = 0; i < 100; ++i)\n  {\n    interpolate->SetT(i / 99.0 * 2.0);\n    interpolate->Modified();\n    renderWindow->Render();\n    vtksys::SystemTools::Delay(100);\n  }\n  interpolate->SetT(t);\n  renderWindow->Render();\n\n  // interact\n  interactor->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Morph3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Morph3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Morph3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Morph3D MACOSX_BUNDLE Morph3D.cxx )\n  target_link_libraries(Morph3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Morph3D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Morph3D/#download-and-build-morph3d","title":"Download and Build Morph3D","text":"

Click here to download Morph3D and its CMakeLists.txt file. Once the tarball Morph3D.tar has been downloaded and extracted,

cd Morph3D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Morph3D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/MovableAxes/","title":"MovableAxes","text":"

vtk-examples/Cxx/Visualization/MovableAxes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/MovableAxes/#description","title":"Description","text":"

With vtkAxesActor, a hybrid object with 3D axes and 2D label props, it is not possible to move the labels along with the axes with vtkInteractorStyleTrackballActor. Here we create new axes labels using a different 3D prop: vtkFollower, and update their positions with a custom callback command.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/MovableAxes/#code","title":"Code","text":"

MovableAxes.cxx

#include <vtkActor.h>\n#include <vtkAssembly.h>\n#include <vtkAssemblyPath.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkFollower.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextActor.h>\n#include <vtkVectorText.h>\n\nnamespace {\n//----------------------------------------------------------------------------\nclass vtkPositionCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkPositionCallback* New()\n  {\n    return new vtkPositionCallback;\n  }\n\n  void Execute(vtkObject* vtkNotUsed(caller), unsigned long vtkNotUsed(event),\n               void* vtkNotUsed(callData))\n  {\n    this->Axes->InitPathTraversal();\n    vtkAssemblyPath* path = 0;\n    int count = 0;\n    vtkFollower* followers[3] = {this->XLabel, this->YLabel, this->ZLabel};\n    int followerId = 0;\n    while ((path = this->Axes->GetNextPath()) != NULL)\n    {\n      if (count++ > 2)\n      {\n        vtkProp3D* prop3D =\n            static_cast<vtkProp3D*>(path->GetLastNode()->GetViewProp());\n        if (prop3D)\n        {\n          prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());\n          followers[followerId]->SetPosition(prop3D->GetCenter());\n          followerId++;\n          prop3D->PokeMatrix(NULL);\n        }\n      }\n    }\n  }\n\n  vtkPositionCallback() : XLabel(0), YLabel(0), ZLabel(0), Axes(0)\n  {\n  }\n\n  vtkFollower* XLabel;\n  vtkFollower* YLabel;\n  vtkFollower* ZLabel;\n  vtkAssembly* Axes;\n};\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  //  vtkPolyData* cone = coneSource->GetOutput();\n\n  // create a mapper\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n\n  // create an actor\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MovableAxes\");\n\n  // an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(coneActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // vtkAxesActor is currently not designed to work with\n  // vtkInteractorStyleTrackballActor since it is a hybrid object containing\n  // both vtkProp3D's and vtkActor2D's, the latter of which does not have a 3D\n  // position that can be manipulated.\n  vtkNew<vtkAxesActor> axes;\n\n  // Get a copy of the axes' constituent 3D actors and put them into a\n  // vtkAssembly so they can be manipulated as one prop.\n  vtkNew<vtkPropCollection> collection;\n  axes->GetActors(collection);\n\n  collection->InitTraversal();\n\n  vtkNew<vtkAssembly> movableAxes;\n\n  for (int i = 0; i < collection->GetNumberOfItems(); ++i)\n  {\n    movableAxes->AddPart((vtkProp3D*)collection->GetNextProp());\n  }\n\n  renderer->AddActor(movableAxes);\n\n  // Create our own labels that will follow and face the camera.\n  vtkNew<vtkFollower> xLabel;\n  vtkNew<vtkVectorText> xText;\n  vtkNew<vtkPolyDataMapper> xTextMapper;\n  xText->SetText(\"X\");\n  xTextMapper->SetInputConnection(xText->GetOutputPort());\n  xLabel->SetMapper(xTextMapper);\n  xLabel->SetScale(0.3);\n  xLabel->SetCamera(renderer->GetActiveCamera());\n  xLabel->SetPosition(\n      ((vtkProp3D*)collection->GetItemAsObject(3))->GetCenter()); // XAxisTip\n  xLabel->PickableOff();\n  renderer->AddActor(xLabel);\n\n  vtkNew<vtkFollower> yLabel;\n  vtkNew<vtkVectorText> yText;\n  vtkNew<vtkPolyDataMapper> yTextMapper;\n  yText->SetText(\"Y\");\n  yTextMapper->SetInputConnection(yText->GetOutputPort());\n  yLabel->SetMapper(yTextMapper);\n  yLabel->SetScale(0.3);\n  yLabel->SetCamera(renderer->GetActiveCamera());\n  yLabel->SetPosition(\n      ((vtkProp3D*)collection->GetItemAsObject(4))->GetCenter()); // YAxisTip\n  yLabel->PickableOff();\n  renderer->AddActor(yLabel);\n\n  vtkNew<vtkFollower> zLabel;\n  vtkNew<vtkVectorText> zText;\n  vtkNew<vtkPolyDataMapper> zTextMapper;\n  zText->SetText(\"Z\");\n  zTextMapper->SetInputConnection(zText->GetOutputPort());\n  zLabel->SetMapper(zTextMapper);\n  zLabel->SetScale(0.3);\n  zLabel->SetCamera(renderer->GetActiveCamera());\n  zLabel->SetPosition(\n      ((vtkProp3D*)collection->GetItemAsObject(5))->GetCenter()); // ZAxisTip\n  zLabel->PickableOff();\n  renderer->AddActor(zLabel);\n\n  // Custom callback to set the positions of the labels.\n  vtkNew<vtkPositionCallback> callback;\n  callback->XLabel = xLabel;\n  callback->YLabel = yLabel;\n  callback->ZLabel = zLabel;\n  callback->Axes = movableAxes;\n\n  renderer->ResetCamera();\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballActor> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/MovableAxes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MovableAxes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MovableAxes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MovableAxes MACOSX_BUNDLE MovableAxes.cxx )\n  target_link_libraries(MovableAxes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MovableAxes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/MovableAxes/#download-and-build-movableaxes","title":"Download and Build MovableAxes","text":"

Click here to download MovableAxes and its CMakeLists.txt file. Once the tarball MovableAxes.tar has been downloaded and extracted,

cd MovableAxes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MovableAxes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/MoveActor/","title":"MoveActor","text":"

vtk-examples/Cxx/Visualization/MoveActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/MoveActor/#description","title":"Description","text":"

This example creates two spheres. They can be moved/scaled/rotated independent of each other using the mouse.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/MoveActor/#code","title":"Code","text":"

MoveActor.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere 1\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(4.0);\n  sphereSource1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereSource1->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere 2\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10.0, 0.0, 0.0);\n  sphereSource2->SetRadius(3.0);\n  sphereSource2->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(sphereSource2->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MoveActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballActor> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/MoveActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MoveActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MoveActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MoveActor MACOSX_BUNDLE MoveActor.cxx )\n  target_link_libraries(MoveActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MoveActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/MoveActor/#download-and-build-moveactor","title":"Download and Build MoveActor","text":"

Click here to download MoveActor and its CMakeLists.txt file. Once the tarball MoveActor.tar has been downloaded and extracted,

cd MoveActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MoveActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/MoveCamera/","title":"MoveCamera","text":"

vtk-examples/Cxx/Visualization/MoveCamera

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/MoveCamera/#description","title":"Description","text":"

This example creates two spheres. They will move together when the mouse is used to interact with the scene because the camera is actually what is moving causing the view of the spheres to change.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/MoveCamera/#code","title":"Code","text":"

MoveCamera.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere 1\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(4.0);\n  sphereSource1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereSource1->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere 2\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10.0, 0.0, 0.0);\n  sphereSource2->SetRadius(3.0);\n  sphereSource2->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(sphereSource2->GetOutputPort());\n\n  // Create an actor\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MoveCamera\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =\n      vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/MoveCamera/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MoveCamera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MoveCamera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MoveCamera MACOSX_BUNDLE MoveCamera.cxx )\n  target_link_libraries(MoveCamera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MoveCamera\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/MoveCamera/#download-and-build-movecamera","title":"Download and Build MoveCamera","text":"

Click here to download MoveCamera and its CMakeLists.txt file. Once the tarball MoveCamera.tar has been downloaded and extracted,

cd MoveCamera/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MoveCamera\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/MultipleActors/","title":"MultipleActors","text":"

vtk-examples/Cxx/Visualization/MultipleActors

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/MultipleActors/#description","title":"Description","text":"

This example creates two spheres and renders them. The idea is to show that each object needs its own mapper and actor and then multiple actors can be added to a renderer.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/MultipleActors/#code","title":"Code","text":"

MultipleActors.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere 1\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(4.0);\n  sphereSource1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereSource1->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere 2\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10.0, 0.0, 0.0);\n  sphereSource2->SetRadius(3.0);\n  sphereSource2->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(sphereSource2->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MultipleActors\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/MultipleActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultipleActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultipleActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultipleActors MACOSX_BUNDLE MultipleActors.cxx )\n  target_link_libraries(MultipleActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultipleActors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/MultipleActors/#download-and-build-multipleactors","title":"Download and Build MultipleActors","text":"

Click here to download MultipleActors and its CMakeLists.txt file. Once the tarball MultipleActors.tar has been downloaded and extracted,

cd MultipleActors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MultipleActors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/MultipleRenderWindows/","title":"MultipleRenderWindows","text":"

vtk-examples/Cxx/Visualization/MultipleRenderWindows

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/MultipleRenderWindows/#description","title":"Description","text":"

This example creates four render windows. Three of the windows will close individually and closing one window will close all the others. Guess which one!

You can also press 'q' or 'e' to close a window.

If the parameter 's' (C++) or '-s (Python) is specified, then updating the camera position in one window will also update the position in the other windows. Pressing 'q' or 'e' closes all windows. Note that in this mode you must use 'q' or 'e' to close the windows.

Note

The image you see here is the test image. When you run this program you will see an image similar to MultipleViewports however each object will be in a separate window.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/MultipleRenderWindows/#code","title":"Code","text":"

MultipleRenderWindows.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkCylinderSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\nstd::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> GetSources();\n\n// Define interaction style\nclass KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static KeyPressInteractorStyle* New();\n  vtkTypeMacro(KeyPressInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnKeyPress()\n  {\n    // Get the keypress\n    vtkRenderWindowInteractor* rwi = this->Interactor;\n    std::string key = rwi->GetKeySym();\n\n    if (key == \"e\" || key == \"q\" || key == \"E\" || key == \"Q\")\n    {\n      *status = false;\n    }\n\n    // Forward events\n    vtkInteractorStyleTrackballCamera::OnKeyPress();\n  }\n\npublic:\n  bool* status = nullptr;\n};\nvtkStandardNewMacro(KeyPressInteractorStyle);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto simultaneousUpdate = false;\n  if ((argc > 1) &&\n      (std::string(argv[1]) == \"s\" || std::string(argv[1]) == \"S\"))\n  {\n    simultaneousUpdate = true;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Have some fun with colors\n  std::vector<std::string> renBkg{\"AliceBlue\", \"GhostWhite\", \"WhiteSmoke\",\n                                  \"Seashell\"};\n  std::vector<std::string> actorColor{\"Bisque\", \"RosyBrown\", \"Goldenrod\",\n                                      \"Chocolate\"};\n  // Window sizes and spacing.\n  auto width = 300;\n  auto height = 300;\n  // Add extra space around each window.\n  auto dx = 20;\n  auto dy = 40;\n  auto w = width + dx;\n  auto h = height + dy;\n\n  std::vector<vtkSmartPointer<vtkRenderWindowInteractor>> interactors;\n  std::vector<vtkSmartPointer<KeyPressInteractorStyle>> styles;\n  std::array<bool, 4> running{true, true, true, true};\n\n  vtkCamera* camera = nullptr;\n  auto sources = GetSources();\n\n  for (unsigned int i = 0; i < 4; i++)\n  {\n    vtkNew<vtkRenderWindow> renderWindow;\n    renderWindow->SetSize(width, height);\n\n    vtkNew<vtkRenderer> renderer;\n\n    // Use the same initial camera for each renderer.\n    if (i == 0)\n    {\n      camera = renderer->GetActiveCamera();\n      camera->Azimuth(30);\n      camera->Elevation(30);\n    }\n    else\n    {\n      renderer->SetActiveCamera(camera);\n    }\n\n    renderWindow->AddRenderer(renderer);\n\n    vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n    interactors.push_back(renderWindowInteractor);\n\n    renderWindowInteractor->SetRenderWindow(renderWindow);\n    renderWindow->Render();\n    std::stringstream ss;\n    ss << \"MultipleRenderWindows \" << i;\n    renderWindow->SetWindowName(ss.str().c_str());\n    renderWindow->SetPosition((i % 2) * w, h - (i / 2) * h);\n\n    // Create a mapper and actor.\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sources[i]->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(actorColor[i]).GetData());\n\n    renderer->AddActor(actor);\n    renderer->SetBackground(colors->GetColor3d(renBkg[i]).GetData());\n\n    renderer->ResetCamera();\n\n    running[i] = true;\n    vtkNew<KeyPressInteractorStyle> style;\n    styles.push_back(style);\n    styles[i]->status = &running[i];\n    interactors[i]->SetInteractorStyle(styles[i]);\n    styles[i]->SetCurrentRenderer(renderer);\n  }\n\n  // Start the interaction.\n  if (simultaneousUpdate)\n  {\n    // Changes in any window will be simultaneously reflected in the other\n    // windows.\n    interactors[0]->Initialize();\n    // If all are running then process the commands.\n    while (std::all_of(running.begin(), running.end(),\n                       [](bool i) { return i == true; }))\n    {\n      for (unsigned int i = 0; i < 4; i++)\n      {\n        if (running[i])\n        {\n          interactors[i]->ProcessEvents();\n          interactors[i]->Render();\n        }\n        else\n        {\n          interactors[i]->TerminateApp();\n          std::cout << \"Window \" << i << \" has stopped running.\" << std::endl;\n        }\n      }\n    }\n  }\n  else\n  {\n    // Changes in any window will be reflected in the other\n    // windows when you click in the window.\n    interactors[0]->Start();\n  }\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nstd::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> GetSources()\n{\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> sources;\n  for (unsigned i = 0; i < 4; i++)\n  {\n    // Create a sphere.\n    vtkNew<vtkSphereSource> sphere;\n    sphere->SetCenter(0.0, 0.0, 0.0);\n    sphere->Update();\n    sources.push_back(sphere);\n    // Create a cone.\n    vtkNew<vtkConeSource> cone;\n    cone->SetCenter(0.0, 0.0, 0.0);\n    cone->SetDirection(0, 1, 0);\n    cone->Update();\n    sources.push_back(cone);\n    // Create a cube.\n    vtkNew<vtkCubeSource> cube;\n    cube->SetCenter(0.0, 0.0, 0.0);\n    cube->Update();\n    sources.push_back(cube);\n    // Create a cylinder.\n    vtkNew<vtkCylinderSource> cylinder;\n    cylinder->SetCenter(0.0, 0.0, 0.0);\n    cylinder->Update();\n    sources.push_back(cylinder);\n  }\n  return sources;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/MultipleRenderWindows/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultipleRenderWindows)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultipleRenderWindows: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultipleRenderWindows MACOSX_BUNDLE MultipleRenderWindows.cxx )\n  target_link_libraries(MultipleRenderWindows PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultipleRenderWindows\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/MultipleRenderWindows/#download-and-build-multiplerenderwindows","title":"Download and Build MultipleRenderWindows","text":"

Click here to download MultipleRenderWindows and its CMakeLists.txt file. Once the tarball MultipleRenderWindows.tar has been downloaded and extracted,

cd MultipleRenderWindows/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MultipleRenderWindows\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/MultipleViewports/","title":"MultipleViewports","text":"

vtk-examples/Cxx/Visualization/MultipleViewports

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/MultipleViewports/#description","title":"Description","text":"

This example creates a window with 4 viewports. Updating the camera position in one viewport will also update the position in the other viewports.

See MultipleRenderWindows for an example using multiple windows.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/MultipleViewports/#code","title":"Code","text":"

MultipleViewports.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vector>\n\nnamespace {\nstd::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> GetSources();\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  double xmins[4] = {0, .5, 0, .5};\n  double xmaxs[4] = {0.5, 1, 0.5, 1};\n  double ymins[4] = {0, 0, .5, .5};\n  double ymaxs[4] = {0.5, 0.5, 1, 1};\n  // Have some fun with colors.\n  std::vector<std::string> renBkg{\"AliceBlue\", \"GhostWhite\", \"WhiteSmoke\",\n                                  \"Seashell\"};\n  std::vector<std::string> actorColor{\"Bisque\", \"RosyBrown\", \"Goldenrod\",\n                                      \"Chocolate\"};\n  vtkCamera* camera = nullptr;\n  auto sources = GetSources();\n\n  for (unsigned i = 0; i < 4; i++)\n  {\n    vtkNew<vtkRenderer> renderer;\n\n    renderWindow->AddRenderer(renderer);\n    renderer->SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i]);\n\n    // Share the camera between viewports.\n    if (i == 0)\n    {\n      camera = renderer->GetActiveCamera();\n      camera->Azimuth(30);\n      camera->Elevation(30);\n    }\n    else\n    {\n      renderer->SetActiveCamera(camera);\n    }\n\n    // Create a mapper and actor.\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sources[i]->GetOutputPort());\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(actorColor[i]).GetData());\n\n    renderer->AddActor(actor);\n    renderer->SetBackground(colors->GetColor3d(renBkg[i]).GetData());\n\n    renderer->ResetCamera();\n  }\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"MultipleViewPorts\");\n  renderWindow->SetSize(600, 600);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nstd::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> GetSources()\n{\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> sources;\n  for (unsigned i = 0; i < 4; i++)\n  {\n    // Create a sphere.\n    vtkNew<vtkSphereSource> sphere;\n    sphere->SetCenter(0.0, 0.0, 0.0);\n    sphere->Update();\n    sources.push_back(sphere);\n    // Create a cone.\n    vtkNew<vtkConeSource> cone;\n    cone->SetCenter(0.0, 0.0, 0.0);\n    cone->SetDirection(0, 1, 0);\n    cone->Update();\n    sources.push_back(cone);\n    // Create a cube.\n    vtkNew<vtkCubeSource> cube;\n    cube->SetCenter(0.0, 0.0, 0.0);\n    cube->Update();\n    sources.push_back(cube);\n    // Create a cylinder.\n    vtkNew<vtkCylinderSource> cylinder;\n    cylinder->SetCenter(0.0, 0.0, 0.0);\n    cylinder->Update();\n    sources.push_back(cylinder);\n  }\n  return sources;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/MultipleViewports/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultipleViewports)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultipleViewports: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultipleViewports MACOSX_BUNDLE MultipleViewports.cxx )\n  target_link_libraries(MultipleViewports PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultipleViewports\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/MultipleViewports/#download-and-build-multipleviewports","title":"Download and Build MultipleViewports","text":"

Click here to download MultipleViewports and its CMakeLists.txt file. Once the tarball MultipleViewports.tar has been downloaded and extracted,

cd MultipleViewports/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MultipleViewports\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/NamedColorPatches/","title":"NamedColorPatches","text":"

vtk-examples/Cxx/Visualization/NamedColorPatches

"},{"location":"Cxx/Visualization/NamedColorPatches/#description","title":"Description","text":"

This example shows how to produce a HTML page called VTKNamedColorPatches showing the available colors in vtkNamedColors.

It also shows how to select the text color based on luminance. In this case, Digital CCIR601 is used, which gives less weight to the red and blue components of a color.

In the class HTMLTableMaker there are four methods for generating HTML pages:

  • MakeCombinedColorPage() -- Makes an indexed page with all the colors and names in the class vtkNamedColors (the default).
  • MakeWebColorPage() -- Makes a page of just the colors and names known to Web Browsers.
  • MakeVTKColorPage() -- Makes a page of colors and names corresponding to to additional colors commonly used in VTK.
  • MakeSynonymColorPage() -- Makes a page of color names and their synonyms.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/NamedColorPatches/#code","title":"Code","text":"

NamedColorPatches.cxx

/*\n * Produce a HTML page called VTKNamedColorPatches.html showing the available\n * colors in vtkNamedColors.\n *\n * It also shows how to select the text color based on luminance.\n * In this case Digital CCIR601 is used which gives less weight to the red and\n * blue components of a color.\n *\n */\n\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n\n#include <algorithm>\n#include <cctype>\n#include <cstdlib>\n#include <fstream>\n#include <functional>\n#include <iostream>\n#include <iterator>\n#include <locale>\n#include <map>\n#include <regex>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n\n//! Convert to and from HTML color strings.\nclass HTMLToFromRGBAColor\n{\npublic:\n  HTMLToFromRGBAColor() = default;\n  virtual ~HTMLToFromRGBAColor() = default;\n\npublic:\n  bool IsValidHTMLColorString(std::string const& s);\n  std::string RGBToHTMLColor(vtkColor3ub const& rgb);\n  vtkColor3ub HTMLColorToRGB(std::string const& colorString);\n  double RGBToLumaCCIR601(vtkColor3ub const& rgb);\n};\n\n/**\n * Holds the color names, grouped by color class, and information about table\n * layout and ordering.\n */\nclass ColorStructures\n{\npublic:\n  ColorStructures()\n  {\n    this->Init();\n  }\n\n  virtual ~ColorStructures() = default;\n\nprivate:\n  void Init();\n\npublic:\n  std::map<std::string, std::vector<std::string>> cn;\n  // Ordering of the tables and when to start and end a column of\n  // tables in the layout.\n  std::vector<std::string> cnOrder;\n  std::vector<std::string> cnStartTable;\n  std::vector<std::string> cnEndTable;\n\n  std::map<std::string, std::vector<std::string>> vtkcn;\n  // Ordering of the tables and when to start and end a column of\n  // tables in the layout.\n  std::vector<std::string> vtkcnOrder;\n  std::vector<std::string> vtkcnStartTable;\n  std::vector<std::string> vtkcnEndTable;\n};\n\n/**\n * This class creates HTML Tables displaying all the colors in\n * the class vtkNamedColors grouped by various categories.\n */\nclass HTMLTableMaker\n{\n\npublic:\n  HTMLTableMaker() = default;\n\n  ~HTMLTableMaker() = default;\n\npublic:\n  std::string MakeWebColorPage();\n  std::string MakeVTKColorPage();\n  std::string MakeSynonymColorPage();\n  std::string MakeCombinedColorPage();\n\nprivate:\n  std::vector<std::vector<std::string>> GetSynonyms();\n  std::string FormatRGBForHTML(vtkColor3ub const& rgb);\n  std::string MakeHTMLStyle();\n  std::string MakeHTMLHeader();\n  std::string MakeHTMLIndex();\n  std::string MakeTableHeader(std::string const& title);\n  std::string MakeTD(std::string const& name);\n  //! Use when the name is a color name known to the web browser.\n  std::string MakeTR(const std::string& name, vtkColor3ub const& rgb,\n                     const std::string& textColor);\n  //! Use when the name is not a color name known to the web browser.\n  std::string MakeTR_HTML(const std::string& name, const std::string& htmlColor,\n                          vtkColor3ub const& rgb, const std::string& textColor);\n  std::string MakeWebColorTables();\n  std::string MakeVTKColorTables();\n  std::string MakeSynonymColorTable();\n\nprivate:\n  vtkNew<vtkNamedColors> nc;\n  ColorStructures cs = ColorStructures();\n  HTMLToFromRGBAColor htmlRGBA = HTMLToFromRGBAColor();\n};\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  HTMLTableMaker ncpt;\n\n  std::ofstream outputFile;\n  outputFile.open(\"VTKNamedColorPatches.html\",\n                  ios::out | ios::trunc | ios::binary);\n  outputFile << ncpt.MakeCombinedColorPage();\n  // outputFile << ncpt.MakeWebColorPage();\n  // outputFile << ncpt.MakeVTKColorPage();\n  // outputFile << ncpt.MakeSynonymColorPage();\n  outputFile.close();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nbool HTMLToFromRGBAColor::IsValidHTMLColorString(std::string const& s)\n{\n  if (s.size() == 7 || s.size() == 9) // #rrggbb or #rrggbbaa\n  {\n    if (s.compare(0, 1, \"#\") == 0 &&\n        s.find_first_not_of(\"0123456789abcdefABCDEF\", 1) == std::string::npos)\n    {\n      return true;\n    }\n  }\n  return false;\n}\n\nstd::string HTMLToFromRGBAColor::RGBToHTMLColor(vtkColor3ub const& rgb)\n{\n  std::string s = \"#\";\n  std::ostringstream os;\n  os << std::setfill('0') << std::hex << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetRed()) << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetGreen()) << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetBlue());\n  s += os.str();\n  return s;\n}\n\nvtkColor3ub HTMLToFromRGBAColor::HTMLColorToRGB(std::string const& colorString)\n{\n  vtkColor3ub c(0, 0, 0);\n  if (IsValidHTMLColorString(colorString) && colorString.size() == 7)\n  {\n    auto i = 1;\n    while (i < static_cast<int>(colorString.size()))\n    {\n      std::istringstream is(colorString.substr(i, 2));\n      int x;\n      is >> std::hex >> x;\n      c[(i - 1) / 2] = x;\n      i += 2;\n    }\n  }\n  return c;\n}\n\ndouble HTMLToFromRGBAColor::RGBToLumaCCIR601(vtkColor3ub const& rgb)\n{\n  return 0.299 * rgb.GetRed() + 0.587 * rgb.GetGreen() + 0.114 * rgb.GetBlue();\n}\n\nvoid ColorStructures::Init()\n{\n  // clang-format off\n    this->cn = {\n          {\"Red\",\n              {\"IndianRed\", \"LightCoral\", \"Salmon\", \"DarkSalmon\",\n              \"LightSalmon\", \"Red\", \"Crimson\", \"FireBrick\", \"DarkRed\"}},\n      {\"Pink\",\n        {\"Pink\", \"LightPink\", \"HotPink\", \"DeepPink\",\n        \"MediumVioletRed\", \"PaleVioletRed\"}},\n      {\"Orange\",\n        {\"LightSalmon\", \"Coral\", \"Tomato\", \"OrangeRed\",\n        \"DarkOrange\", \"Orange\"}},\n      {\"Yellow\",\n        {\"Gold\", \"Yellow\", \"LightYellow\", \"LemonChiffon\",\n        \"LightGoldenrodYellow\", \"PapayaWhip\", \"Moccasin\",\n        \"PeachPuff\", \"PaleGoldenrod\", \"Khaki\", \"DarkKhaki\"}},\n      {\"Purple\",\n        {\"Lavender\", \"Thistle\", \"Plum\", \"Violet\", \"Orchid\",\n        \"Fuchsia\", \"Magenta\", \"MediumOrchid\", \"MediumPurple\",\n        \"BlueViolet\", \"DarkViolet\", \"DarkOrchid\", \"DarkMagenta\",\n        \"Purple\", \"Indigo\", \"DarkSlateBlue\", \"SlateBlue\",\n        \"MediumSlateBlue\"}},\n      {\"Green\",\n        {\"GreenYellow\", \"Chartreuse\", \"LawnGreen\", \"Lime\",\n        \"LimeGreen\", \"PaleGreen\", \"LightGreen\",\n        \"MediumSpringGreen\", \"SpringGreen\", \"MediumSeaGreen\",\n        \"SeaGreen\", \"ForestGreen\", \"Green\", \"DarkGreen\",\n        \"YellowGreen\", \"OliveDrab\", \"Olive\", \"DarkOliveGreen\",\n        \"MediumAquamarine\", \"DarkSeaGreen\", \"LightSeaGreen\",\n        \"DarkCyan\", \"Teal\"}},\n      {\"Blue/Cyan\",\n        {\"Aqua\", \"Cyan\", \"LightCyan\", \"PaleTurquoise\",\n        \"Aquamarine\", \"Turquoise\", \"MediumTurquoise\",\n        \"DarkTurquoise\", \"CadetBlue\", \"SteelBlue\",\n        \"LightSteelBlue\", \"PowderBlue\", \"LightBlue\",\n        \"SkyBlue\", \"LightSkyBlue\", \"DeepSkyBlue\",\n        \"DodgerBlue\",  \"CornflowerBlue\", \"RoyalBlue\", \"Blue\",\n        \"MediumBlue\",  \"DarkBlue\", \"Navy\", \"MidnightBlue\"}},\n      {\"Brown\",\n        {\"Cornsilk\", \"BlanchedAlmond\", \"Bisque\", \"NavajoWhite\",\n        \"Wheat\", \"BurlyWood\", \"Tan\", \"RosyBrown\", \"SandyBrown\",\n        \"Goldenrod\", \"DarkGoldenrod\", \"Peru\", \"Chocolate\",\n        \"SaddleBrown\", \"Sienna\", \"Brown\", \"Maroon\"}},\n      {\"White\",\n        {\"White\", \"Snow\", \"Honeydew\", \"MintCream\", \"Azure\",\n        \"AliceBlue\", \"GhostWhite\", \"WhiteSmoke\", \"Seashell\",\n        \"Beige\", \"OldLace\", \"FloralWhite\", \"Ivory\",\n        \"AntiqueWhite\", \"Linen\",\n        \"LavenderBlush\", \"MistyRose\"}},\n      {\"Gray\",\n        {\"Gainsboro\", \"LightGrey\", \"Silver\", \"DarkGray\", \"Gray\",\n        \"DimGray\", \"LightSlateGray\", \"SlateGray\", \"DarkSlateGray\",\n        \"Black\"}}\n    };\n    // Ordering of the tables and when to start and end a column of tables\n    // in the layout.\n    this->cnOrder = {\n      \"Red\",   \"Pink\",      \"Orange\", \"Yellow\", \"Purple\",\n      \"Green\", \"Blue/Cyan\", \"Brown\",  \"White\",  \"Gray\"};\n    this->cnStartTable = {\"Red\", \"Green\", \"Brown\"};\n    this->cnEndTable = {\"Purple\", \"Blue/Cyan\", \"Gray\"};\n\n    this->vtkcn = {\n      {\"Whites\",\n        {\"antique_white\", \"azure\", \"bisque\",  \"blanched_almond\",\n        \"cornsilk\", \"eggshell\", \"floral_white\", \"gainsboro\",\n        \"ghost_white\", \"honeydew\", \"ivory\", \"lavender\",\n        \"lavender_blush\", \"lemon_chiffon\", \"linen\", \"mint_cream\",\n        \"misty_rose\", \"moccasin\", \"navajo_white\", \"old_lace\",\n        \"papaya_whip\", \"peach_puff\", \"seashell\", \"snow\",\n        \"thistle\", \"titanium_white\", \"wheat\", \"white\",\n        \"white_smoke\", \"zinc_white\"}},\n      {\"Greys\",\n        {\"cold_grey\", \"dim_grey\", \"grey\", \"light_grey\",\n        \"slate_grey\", \"slate_grey_dark\", \"slate_grey_light\",\n        \"warm_grey\"}},\n      {\"Blacks\",\n        {\"black\", \"ivory_black\", \"lamp_black\"}},\n      {\"Reds\",\n        {\"alizarin_crimson\", \"brick\",  \"cadmium_red_deep\",  \"coral\",\n        \"coral_light\", \"deep_pink\", \"english_red\", \"firebrick\",\n        \"geranium_lake\", \"hot_pink\", \"indian_red\", \"light_salmon\",\n        \"madder_lake_deep\", \"maroon\", \"pink\", \"pink_light\",\n        \"raspberry\", \"red\", \"rose_madder\", \"salmon\", \"tomato\",\n        \"venetian_red\"}},\n      {\"Browns\",\n        {\"beige\", \"brown\", \"brown_madder\", \"brown_ochre\",\n        \"burlywood\", \"burnt_sienna\", \"burnt_umber\", \"chocolate\",\n        \"deep_ochre\", \"flesh\", \"flesh_ochre\", \"gold_ochre\",\n        \"greenish_umber\", \"khaki\", \"khaki_dark\", \"light_beige\",\n        \"peru\", \"rosy_brown\", \"raw_sienna\", \"raw_umber\", \"sepia\",\n        \"sienna\", \"saddle_brown\", \"sandy_brown\", \"tan\",\n        \"van_dyke_brown\"}},\n      {\"Oranges\",\n        {\"cadmium_orange\", \"cadmium_red_light\", \"carrot\",\n        \"dark_orange\", \"mars_orange\", \"mars_yellow\", \"orange\",\n        \"orange_red\", \"yellow_ochre\"}},\n      {\"Yellows\",\n        {\"aureoline_yellow\", \"banana\", \"cadmium_lemon\",\n        \"cadmium_yellow\", \"cadmium_yellow_light\", \"gold\",\n        \"goldenrod\", \"goldenrod_dark\", \"goldenrod_light\",\n        \"goldenrod_pale\", \"light_goldenrod\", \"melon\",\n        \"naples_yellow_deep\", \"yellow\", \"yellow_light\"}},\n      {\"Greens\",\n        {\"chartreuse\", \"chrome_oxide_green\", \"cinnabar_green\",\n        \"cobalt_green\", \"emerald_green\", \"forest_green\", \"green\",\n        \"green_dark\", \"green_pale\", \"green_yellow\", \"lawn_green\",\n        \"lime_green\", \"mint\", \"olive\", \"olive_drab\",\n        \"olive_green_dark\", \"permanent_green\", \"sap_green\",\n        \"sea_green\", \"sea_green_dark\", \"sea_green_medium\",\n        \"sea_green_light\", \"spring_green\", \"spring_green_medium\",\n        \"terre_verte\", \"viridian_light\", \"yellow_green\"}},\n      {\"Cyans\",\n        {\"aquamarine\", \"aquamarine_medium\", \"cyan\", \"cyan_white\",\n        \"turquoise\", \"turquoise_dark\", \"turquoise_medium\",\n        \"turquoise_pale\"}},\n      {\"Blues\",\n        {\"alice_blue\", \"blue\", \"blue_light\", \"blue_medium\",\n        \"cadet\", \"cobalt\", \"cornflower\", \"cerulean\", \"dodger_blue\",\n        \"indigo\", \"manganese_blue\", \"midnight_blue\", \"navy\",\n        \"peacock\", \"powder_blue\", \"royal_blue\", \"slate_blue\",\n        \"slate_blue_dark\", \"slate_blue_light\",\n        \"slate_blue_medium\", \"sky_blue\", \"sky_blue_deep\",\n        \"sky_blue_light\", \"steel_blue\", \"steel_blue_light\",\n        \"turquoise_blue\", \"ultramarine\"}},\n      {\"Magentas\",\n        {\"blue_violet\", \"cobalt_violet_deep\", \"magenta\",\n        \"orchid\", \"orchid_dark\", \"orchid_medium\",\n        \"permanent_red_violet\", \"plum\", \"purple\",\n        \"purple_medium\", \"ultramarine_violet\", \"violet\",\n        \"violet_dark\", \"violet_red\", \"violet_red_medium\",\n        \"violet_red_pale\"}}\n    };\n    // Ordering of the tables and when to start and end a column of tables\n    // in the layout.\n    this->vtkcnOrder = {\n      \"Whites\",  \"Greys\",  \"Blacks\", \"Reds\",  \"Oranges\", \"Browns\",\n      \"Yellows\", \"Greens\", \"Cyans\",  \"Blues\", \"Magentas\"};\n    this->vtkcnStartTable = {\"Whites\", \"Browns\",  \"Cyans\"};\n    this->vtkcnEndTable = {\"Oranges\", \"Greens\", \"Magentas\"};\n  // clang-format on\n}\n\nstd::string HTMLTableMaker::MakeWebColorPage()\n{\n  std::string res = this->MakeHTMLHeader();\n  res += \"<body>\\n\";\n  res += \"<h1>Colors available in vtkNamedColors</h1>\\n\";\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"3\\\">Web Color Names</th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeWebColorTables();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"</body>\\n\";\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeVTKColorPage()\n{\n  std::string res = this->MakeHTMLHeader();\n  res += \"<body>\\n\";\n  res += \"<h1>Colors available in vtkNamedColors</h1>\\n\";\n  res += \"The web colors take precedence over colors of the same\";\n  res += \" name in VTK Color Names.\\n\";\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"3\\\">VTK Color Names</th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeVTKColorTables();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"</body>\\n\";\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeSynonymColorPage()\n{\n  std::string res = this->MakeHTMLHeader();\n  res += \"<body>\\n\";\n  res += \"<h1>Synonyms in vtkNamedColors</h1>\\n\";\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"2\\\">Synonyms</th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeSynonymColorTable();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"</body>\\n\";\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeCombinedColorPage()\n{\n  std::string res = this->MakeHTMLHeader();\n  res += \"<body>\\n\";\n  res += \"<h1>Colors available in vtkNamedColors</h1>\\n\";\n  res += \"The class vtkNamedColors provides color names and their\";\n  res += \" values for the convenience of the user.\\n\";\n  res += \"<br>The following tables show the available colors along with\";\n  res += \" their red, green and blue values.\\n\";\n  res += this->MakeHTMLIndex();\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"3\\\"><a id=\\\"WebColorNames\\\">Web color Names</a></th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeWebColorTables();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"<br>\\n\";\n\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"3\\\"><a id=\\\"VTKColorNames\\\">VTK color Names</a></th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeVTKColorTables();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"<br>\\n\";\n\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"2\\\"><a id=\\\"Synonyms\\\">Synonyms</a></th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeSynonymColorTable();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"</body>\\n\";\n  return res;\n}\n\nstd::vector<std::vector<std::string>> HTMLTableMaker::GetSynonyms()\n{\n  auto ncsyn = this->nc->GetSynonyms();\n  std::stringstream ss(std::regex_replace(ncsyn, std::regex(\"\\n\\n\"), \"*\"));\n  std::string synonyms;\n  std::vector<std::vector<std::string>> sn;\n  while (std::getline(ss, synonyms, '*'))\n  {\n    std::vector<std::string> syns;\n    std::stringstream ss1(synonyms);\n    std::string color;\n    while (std::getline(ss1, color, '\\n'))\n    {\n      syns.push_back(std::move(color));\n    }\n    sn.push_back(std::move(syns));\n  }\n  return sn;\n}\n\nstd::string HTMLTableMaker::MakeHTMLStyle()\n{\n  std::string s = \"  <style>\\n\";\n  s += \"  \\n\";\n  s += \"  body {\\n\";\n  s += \"    background-color: snow\\n\";\n  s += \"  }\\n\";\n  s += \"  h1 {text-align:left;}\\n\";\n  s += \"  h2 {text-align:left;}\\n\";\n  s += \"  h3 {text-align:left;}\\n\";\n  s += \"  h4 {text-align:left;}\\n\";\n  s += \"  h5 {text-align:left;}\\n\";\n  s += \"  h6 {text-align:left;}\\n\";\n  s += \"  \\n\";\n  s += \"  p {text-align:left;}\\n\";\n  s += \"  \\n\";\n  s += \"  table {\\n\";\n  s += \"    font-family: arial, sans-serif;\\n\";\n  s += \"    border-collapse: collapse;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"    padding: 4px;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  th[colspan]:not([colspan=\\\"1\\\"]) {\\n\";\n  s += \"    background: LightSteelBlue;\\n\";\n  s += \"    font-size: x-large;\\n\";\n  s += \"    text-align : center;\";\n  s += \"    vertical-align : top;\\n\";\n  s += \"  }\\n\";\n  s += \"  th {\\n\";\n  s += \"    background: LightSteelBlue;\\n\";\n  s += \"  }\\n\";\n  s += \"  td, th {\\n\";\n  s += \"    border: 1px solid #dddddd;\\n\";\n  s += \"    text-align: left;\\n\";\n  s += \"    padding: 8px;\\n\";\n  s += \"    font-family: monospace;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"    font-weight: bold;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  tr {\\n\";\n  s += \"    background: WhiteSmoke;\\n\";\n  s += \"    vertical-align : top;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  td[colspan]:not([colspan=\\\"1\\\"]) {\\n\";\n  s += \"    background: MintCream;\\n\";\n  s += \"    font-size: large;\\n\";\n  s += \"    text-align : center;\";\n  s += \"    vertical-align : top;\\n\";\n  s += \"  }\\n\";\n  s += \"  td {\\n\";\n  s += \"    background: WhiteSmoke;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  .cour {\\n\";\n  s += \"    font-family: Courier;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  html, body {\\n\";\n  s += \"    height: 100%;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  html {\\n\";\n  s += \"    display: table;\\n\";\n  s += \"    margin: auto;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  body {\\n\";\n  s += \"    display: table-cell;\\n\";\n  s += \"    vertical-align: middle;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  thead {color: DarkGreen;}\\n\";\n  s += \"  tbody {color: MidnightBlue;}\\n\";\n  s += \"  tfoot {color: SaddleBrown;}\\n\";\n  s += \"\\n\";\n  s += \"  </style>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeHTMLHeader()\n{\n  std::string s = \"<!DOCTYPE html>\\n\";\n  s += \"<html lang=\\\"en\\\">\\n\";\n  s += \"<head>\\n\";\n  s += \"<meta charset=\\\"UTF-8\\\" />\\n\";\n  s += \"<title>vtkNamedColors</title>\\n\";\n  s += this->MakeHTMLStyle();\n  s += \"</head>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeHTMLIndex()\n{\n  std::string s = \"<h2>Index</h2>\\n\";\n  s += \"<ul>\\n\";\n  s += \"\\t<li><a href=\\\"#WebColorNames\\\">Web color Names</a>\";\n  s += \" These colors correspond to those in\";\n  s += \" <a href=\\\"http://en.wikipedia.org/wiki/Web_colors\\\"\";\n  s += \" title=\\\"Web Colors\\\">Web Colors</a>.\\n\";\n  s += \"</li>\\n\";\n  s += \"\\t<li><a href=\\\"#VTKColorNames\\\">VTK color Names</a>\\n\";\n  s += \" The colors correspond to additional colors commonly used in VTK.\\n\";\n  s += \"<br>The web colors take precedence over colors with\\n\";\n  s += \" the same name (case insensitive) here.\\n\";\n  s += \"</li>\\n\";\n  s += \"\\t<li><a href=\\\"#Synonyms\\\">Synonyms</a></li>\\n\";\n  s += \"</ul>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTableHeader(std::string const& title)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<th>\";\n  s += title;\n  s += \"</th>\\n\";\n  s += \"<th>Decimal code<br>\\n\";\n  s += \"&#160;&#160;R\";\n  s += \"&#160;&#160;&#160;&#160;G\";\n  s += \"&#160;&#160;&#160;&#160;B</th>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTD(std::string const& name)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<td colspan=\\\"2\\\">\";\n  s += \"<b>\" + name + \"</b>\";\n  s += \"</td>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::FormatRGBForHTML(vtkColor3ub const& rgb)\n{\n  std::ostringstream os;\n  os << std::setw(3) << static_cast<unsigned int>(rgb.GetRed())\n     << \"&#160;&#160;\" << std::setw(3)\n     << static_cast<unsigned int>(rgb.GetGreen()) << \"&#160;&#160;\"\n     << std::setw(3) << static_cast<unsigned int>(rgb.GetBlue());\n  return std::regex_replace(os.str(), std::regex(\" \"), \"&#160;\");\n}\n\nstd::string HTMLTableMaker::MakeTR(const std::string& name,\n                                   vtkColor3ub const& rgb,\n                                   const std::string& textColor)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<td style=\\\"background:\" + name + \";color:\" + textColor;\n  s += \"\\\">\" + name + \"</td>\\n\";\n  s += \"<td style=\\\"background:\" + name + \";color:\" + textColor;\n  s += \"\\\">\" + this->FormatRGBForHTML(rgb) + \"</td>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTR_HTML(const std::string& name,\n                                        const std::string& htmlColor,\n                                        vtkColor3ub const& rgb,\n                                        const std::string& textColor)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<td style=\\\"background:\" + htmlColor + \";color:\" + textColor;\n  s += \"\\\">\" + name + \"</td>\\n\";\n  s += \"<td style=\\\"background:\" + htmlColor + \";color:\" + textColor;\n  s += \"\\\">\" + this->FormatRGBForHTML(rgb) + \"</td>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeWebColorTables()\n{\n  std::string res;\n  for (auto const& p : cs.cnOrder)\n  {\n    if (std::find(this->cs.cnStartTable.begin(), this->cs.cnStartTable.end(),\n                  p) != this->cs.cnStartTable.end())\n    {\n      res += \"<td>\\n\";\n      res += \"<table>\\n\";\n      res += this->MakeTableHeader(\"HTML name\");\n    }\n    // Add in the name of the group in the color table.\n    res += this->MakeTD(p + \" colors\");\n    auto values = this->cs.cn[p];\n    for (auto const& q : values)\n    {\n      auto rgb = this->nc->GetColor3ub(q);\n      auto y = this->htmlRGBA.RGBToLumaCCIR601(rgb);\n      std::string textColor{\"#000000\"}; // Black\n      if (y < 255 / 2.0)\n      {\n        textColor = \"#ffffff\"; // White\n      }\n      // Make the row for each color in the group.\n      // Here we use the name to set the background color\n      //  as it is known to the web browser.\n      res += this->MakeTR(q, rgb, textColor);\n    }\n    if (std::find(this->cs.cnEndTable.begin(), this->cs.cnEndTable.end(), p) !=\n        this->cs.cnEndTable.end())\n    {\n      res += \"</table>\\n\";\n      res += \"</td>\\n\";\n    }\n  }\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeVTKColorTables()\n{\n  std::string res;\n\n  for (auto const& p : cs.vtkcnOrder)\n  {\n    if (std::find(this->cs.vtkcnStartTable.begin(),\n                  this->cs.vtkcnStartTable.end(),\n                  p) != this->cs.vtkcnStartTable.end())\n    {\n      res += \"<td>\\n\";\n      res += \"<table>\\n\";\n      res += this->MakeTableHeader(\"HTML name\");\n    }\n    // Add in the name of the group in the color table.\n    res += this->MakeTD(p);\n    auto values = this->cs.vtkcn[p];\n    for (auto const& q : values)\n    {\n      auto rgb = this->nc->GetColor3ub(q);\n      auto y = this->htmlRGBA.RGBToLumaCCIR601(rgb);\n      std::string textColor{\"#000000\"}; // Black\n      if (y < 255 / 2.0)\n      {\n        textColor = \"#ffffff\"; // White\n      }\n      // We must set the background color to a specific\n      // HTML color as the color name may not be a standard\n      // name known to the web browser.\n      auto htmlColor = htmlRGBA.RGBToHTMLColor(rgb);\n      // Make the row for each color in the group.\n      res += this->MakeTR_HTML(q, htmlColor, rgb, textColor);\n    }\n    if (std::find(this->cs.vtkcnEndTable.begin(), this->cs.vtkcnEndTable.end(),\n                  p) != this->cs.vtkcnEndTable.end())\n    {\n      res += \"</table>\\n\";\n      res += \"</td>\\n\";\n    }\n  }\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeSynonymColorTable()\n{\n  auto synonyms = this->GetSynonyms();\n  std::vector<std::string> cn;\n  for (const auto& p : this->cs.cn)\n  {\n    std::copy(p.second.begin(), p.second.end(), std::back_inserter(cn));\n  }\n  std::map<std::string, std::string> d;\n  for (const auto& p : cn)\n  {\n    // Make a lowercase key.\n    std::string key;\n    key.resize(p.size());\n    std::transform(p.begin(), p.end(), key.begin(),\n                   [](unsigned char const& c) -> unsigned char {\n                     return std::tolower(c);\n                   });\n    d[key] = p;\n  }\n  // End point of first table.\n  auto end1 = synonyms.size() / 2;\n  if (end1 * 2 < synonyms.size())\n  {\n    end1 += 1;\n  }\n  std::string res;\n  res += \"<td>\\n\";\n  res += \"<table>\\n\";\n  res += this->MakeTableHeader(\"Synonyms\");\n  size_t count = 0;\n  for (auto p : synonyms)\n  {\n    if (count == end1)\n    {\n      res += \"</table>\\n\";\n      res += \"</td>\\n\";\n      res += \"<td>\\n\";\n      res += \"<table>\\n\";\n      res += this->MakeTableHeader(\"Synonyms\");\n    }\n    for (auto& q : p)\n    {\n      // Replace the lowercase name with the proper name.\n      if (d.find(q) != d.end())\n      {\n        q = d[q];\n      }\n    }\n    std::sort(p.begin(), p.end());\n    std::string names;\n    for (auto const& q : p)\n    {\n      names += q;\n      if (q != p.back())\n      {\n        names += \", \";\n      }\n    }\n    auto rgb = this->nc->GetColor3ub(*(p.begin()));\n    auto y = this->htmlRGBA.RGBToLumaCCIR601(rgb);\n    std::string textColor{\"#000000\"}; // Black\n    if (y < 255 / 2.0)\n    {\n      textColor = \"#ffffff\"; // White\n    }\n    // We must set the background color to a specific\n    // HTML color because names is just a list of\n    // synonyms for that particular color.\n    auto htmlColor = this->htmlRGBA.RGBToHTMLColor(rgb);\n    // Make the row for each color in the group.\n    res += this->MakeTR_HTML(names, htmlColor, rgb, textColor);\n    count++;\n  }\n  res += \"</table>\\n\";\n  res += \"</td>\\n\";\n  return res;\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/NamedColorPatches/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NamedColorPatches)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NamedColorPatches: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NamedColorPatches MACOSX_BUNDLE NamedColorPatches.cxx )\n  target_link_libraries(NamedColorPatches PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NamedColorPatches\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/NamedColorPatches/#download-and-build-namedcolorpatches","title":"Download and Build NamedColorPatches","text":"

Click here to download NamedColorPatches and its CMakeLists.txt file. Once the tarball NamedColorPatches.tar has been downloaded and extracted,

cd NamedColorPatches/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./NamedColorPatches\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/NamedColors/","title":"NamedColors","text":"

vtk-examples/Cxx/Visualization/NamedColors

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/NamedColors/#description","title":"Description","text":"

This example demonstrates the usage of the vtkNamedColors class. Some helper functions are also implemented.

A cone is created and contoured using the BandedPolyDataContourFilter, it is then colored using a LookupTable where the colors have been assigned using color names.

A list of available color names and any synonyms are also output.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/NamedColors/#code","title":"Code","text":"

NamedColors.cxx

/*\nThis example demonstrates the usage of the vtNamedColor class.\n*/\n#include <vtkActor.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkConeSource.h>\n#include <vtkElevationFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <algorithm>\n#include <iostream>\n#include <regex>\n#include <sstream>\n#include <vector>\n\nnamespace {\n// Get the color names.\nstd::vector<std::string> GetColorNames(vtkNamedColors* namedColors);\n\n// Get the synonyms.\nstd::vector<std::vector<std::string>> GetSynonyms(vtkNamedColors* namedColors);\n\n// Print out the colors.\nvoid PrintColors(vtkNamedColors* namedColors);\n\n// Print out the synonyms.\nvoid PrintSynonyms(vtkNamedColors* namedColors);\n\n// Find any synonyms for a specified color.\nstd::vector<std::string> FindSynonyms(const std::string& color,\n                                      vtkNamedColors* namedColors);\n\n} // namespace\n\n// Create a cone, contour it using the banded contour filter and\n// color it with the primary additive and subtractive colors.\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // We can print out the variables.\n  // The color name and RGBA values are displayed.\n  // namedColors->PrintSelf(std::cout,vtkIndent(2));\n\n  // Here we just print out the colors and any\n  // synonyms.\n  PrintColors(namedColors);\n  PrintSynonyms(namedColors);\n\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetCenter(0.0, 0.0, 0.0);\n  coneSource->SetRadius(5.0);\n  coneSource->SetHeight(10);\n  coneSource->SetDirection(0, 1, 0);\n  coneSource->SetResolution(6);\n  coneSource->Update();\n\n  double bounds[6];\n  coneSource->GetOutput()->GetBounds(bounds);\n\n  vtkNew<vtkElevationFilter> elevation;\n  elevation->SetInputConnection(coneSource->GetOutputPort());\n  elevation->SetLowPoint(0, bounds[2], 0);\n  elevation->SetHighPoint(0, bounds[3], 0);\n\n  vtkNew<vtkBandedPolyDataContourFilter> bcf;\n  bcf->SetInputConnection(elevation->GetOutputPort());\n  bcf->SetScalarModeToValue();\n  bcf->GenerateContourEdgesOn();\n  bcf->GenerateValues(7, elevation->GetScalarRange());\n\n  double rgba[4];\n  // Test setting and getting colors here.\n  // We are also modifying alpha.\n  namedColors->GetColor(\"Red\", rgba);\n  // Make it semitransparent.\n  rgba[3] = 0.5;\n  namedColors->SetColor(\"My Red\", rgba);\n  // Does \"My Red\" match anything?\n  // Demonstrates how to find synonyms.\n  auto matchingColors = FindSynonyms(\"My Red\", namedColors);\n  if (!matchingColors.empty())\n  {\n    std::cout << \"Matching colors to My Red: \";\n    size_t i = 1;\n    for (auto const& p : matchingColors)\n    {\n      std::cout << p;\n      if (i < matchingColors.size())\n      {\n        std::cout << \", \";\n        i = 1;\n      }\n      ++i;\n    }\n    std::cout << std::endl;\n  }\n  // Build a simple lookup table of\n  // primary additive and subtractive colors.\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(7);\n  lut->SetTableValue(0, namedColors->GetColor4d(\"My Red\").GetData());\n  // Let's make the dark green one partially transparent.\n  namedColors->GetColor(\"Lime\", rgba);\n  rgba[3] = 0.3;\n  lut->SetTableValue(1, rgba);\n  lut->SetTableValue(2, namedColors->GetColor4d(\"Blue\").GetData());\n  lut->SetTableValue(3, namedColors->GetColor4d(\"Cyan\").GetData());\n  lut->SetTableValue(4, namedColors->GetColor4d(\"Magenta\").GetData());\n  lut->SetTableValue(5, namedColors->GetColor4d(\"Yellow\").GetData());\n  lut->SetTableValue(6, namedColors->GetColor4d(\"White\").GetData());\n  lut->SetTableRange(elevation->GetScalarRange());\n  lut->Build();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(bcf->GetOutputPort());\n  mapper->SetScalarRange(elevation->GetScalarRange());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkPolyDataMapper> contourLineMapper;\n  contourLineMapper->SetInputData(bcf->GetContourEdgesOutput());\n  contourLineMapper->SetScalarRange(elevation->GetScalarRange());\n  contourLineMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkActor> contourLineActor;\n  contourLineActor->SetMapper(contourLineMapper);\n  contourLineActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(contourLineActor);\n  renderer->SetBackground2(namedColors->GetColor3d(\"RoyalBlue\").GetData());\n  renderer->SetBackground(namedColors->GetColor3d(\"MistyRose\").GetData());\n  renderer->GradientBackgroundOn();\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"NamedColors\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nstd::vector<std::string> GetColorNames(vtkNamedColors* namedColors)\n{\n  std::stringstream ss(namedColors->GetColorNames());\n  std::string color;\n  std::vector<std::string> cn;\n  while (std::getline(ss, color, '\\n'))\n  {\n    cn.push_back(std::move(color));\n  }\n  return cn;\n}\n\nstd::vector<std::vector<std::string>> GetSynonyms(vtkNamedColors* namedColors)\n{\n  auto ncsyn = namedColors->GetSynonyms();\n  std::stringstream ss(std::regex_replace(ncsyn, std::regex(\"\\n\\n\"), \"*\"));\n  std::string synonyms;\n  std::vector<std::vector<std::string>> sn;\n  while (std::getline(ss, synonyms, '*'))\n  {\n    std::vector<std::string> syns;\n    std::stringstream ss1(synonyms);\n    std::string color;\n    while (std::getline(ss1, color, '\\n'))\n    {\n      syns.push_back(std::move(color));\n    }\n    sn.push_back(std::move(syns));\n  }\n  return sn;\n}\n\nstd::vector<std::string> FindSynonyms(const std::string& color,\n                                      vtkNamedColors* namedColors)\n{\n  auto availableColors = GetColorNames(namedColors);\n  // We will be matching on RGB only.\n  auto myColor = namedColors->GetColor3ub(color);\n  // Colors are all stored as lower case, so convert color to lower case.\n  std::string lcColor;\n  std::transform(color.begin(), color.end(), std::back_inserter(lcColor),\n                 (int (*)(int))std::tolower);\n  std::vector<std::string> synonyms;\n  for (auto const& p : availableColors)\n  {\n    auto c = namedColors->GetColor3ub(p);\n    if (myColor.Compare(c, 1))\n    {\n      synonyms.push_back(p);\n    }\n  }\n  return synonyms;\n}\n\nvoid PrintColors(vtkNamedColors* namedColors)\n{\n  // Get the available colors:\n  auto colors = GetColorNames(namedColors);\n  std::cout << \"There are \" << colors.size() << \" colors:\" << std::endl;\n  auto max_str =\n      std::max_element(colors.begin(), colors.end(),\n                       [](std::string const& a, std::string const& b) {\n                         return a.size() < b.size();\n                       });\n  auto max_str_len = max_str->size();\n  auto n = 0;\n  std::ostringstream os;\n  for (auto const& p : colors)\n  {\n    ++n;\n    if (n % 5 == 0)\n    {\n      os << std::left << p << std::endl;\n    }\n    else\n    {\n      os << std::left << std::setw(max_str_len) << p << \" \";\n    }\n  }\n  std::string s = std::regex_replace(os.str(), std::regex(\"\\\\s+$\"), \"\\n\");\n  std::cout << s << std::endl;\n}\n\nvoid PrintSynonyms(vtkNamedColors* namedColors)\n{\n  // Get the synonyms:\n  auto synonyms = GetSynonyms(namedColors);\n  std::cout << \"There are \" << synonyms.size() << \" synonyms:\" << std::endl;\n  // Get the size of the longest synonym name.\n  size_t max_str_len = 0;\n  for (auto const& p : synonyms)\n  {\n    auto max_str = std::max_element(\n        p.begin(), p.end(), [](std::string const& a, std::string const& b) {\n          return a.size() < b.size();\n        });\n    max_str_len =\n        (max_str_len < max_str->size()) ? max_str->size() : max_str_len;\n  }\n  for (auto const& p : synonyms)\n  {\n    size_t n = 0;\n    for (auto const& q : p)\n    {\n      ++n;\n      if (n < p.size())\n      {\n        std::cout << std::left << std::setw(max_str_len) << q << \" \";\n      }\n      else\n      {\n        std::cout << q << std::endl;\n      }\n    }\n  }\n  std::cout << std::endl;\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/NamedColors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NamedColors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NamedColors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NamedColors MACOSX_BUNDLE NamedColors.cxx )\n  target_link_libraries(NamedColors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NamedColors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/NamedColors/#download-and-build-namedcolors","title":"Download and Build NamedColors","text":"

Click here to download NamedColors and its CMakeLists.txt file. Once the tarball NamedColors.tar has been downloaded and extracted,

cd NamedColors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./NamedColors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/NoShading/","title":"NoShading","text":"

vtk-examples/Cxx/Visualization/NoShading

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/NoShading/#code","title":"Code","text":"

NoShading.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n  actor->GetProperty()->SetAmbient(1);\n  actor->GetProperty()->SetDiffuse(0);\n  actor->GetProperty()->SetSpecular(0);\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"NoShading\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/NoShading/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NoShading)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NoShading: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NoShading MACOSX_BUNDLE NoShading.cxx )\n  target_link_libraries(NoShading PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NoShading\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/NoShading/#download-and-build-noshading","title":"Download and Build NoShading","text":"

Click here to download NoShading and its CMakeLists.txt file. Once the tarball NoShading.tar has been downloaded and extracted,

cd NoShading/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./NoShading\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/NormalsDemo/","title":"NormalsDemo","text":"

vtk-examples/Cxx/Visualization/NormalsDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/NormalsDemo/#description","title":"Description","text":"

This example demonstrates the generation of normals. The left image shows the orignal faceted model. The center image shows the model with generated normals, but no consideration for sharp features. The third image shows the model with a 30 degree feature angle and splitting on.

Theis example uses the src/Testing/Data/42400-IDGH.stl dataset.

Info

See Figure 9-24 in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/NormalsDemo/#code","title":"Code","text":"

NormalsDemo.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"White\").GetData());\n\n  // Create background colors for each viewport\n  std::vector<vtkColor3d> backgroundColors;\n  backgroundColors.push_back(colors->GetColor3d(\"Cornsilk\"));\n  backgroundColors.push_back(colors->GetColor3d(\"NavajoWhite\"));\n  backgroundColors.push_back(colors->GetColor3d(\"Tan\"));\n\n  // Create a renderer for each view port.\n  std::vector<vtkSmartPointer<vtkRenderer>> ren;\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren[0]->SetViewport(0, 0, 1.0 / 3.0, 1);         // Input\n  ren[1]->SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1); // Normals (no split)\n  ren[2]->SetViewport(2.0 / 3.0, 0, 1, 1);         // Normals (split)\n\n  // Shared camera.\n  vtkNew<vtkCamera> camera;\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(polyData);\n  normals->SetFeatureAngle(30.0);\n  for (int i = 0; i < 3; ++i)\n  {\n    if (i == 0)\n    {\n      normals->ComputePointNormalsOff();\n    }\n    else if (i == 1)\n    {\n      normals->ComputePointNormalsOn();\n      normals->SplittingOff();\n    }\n    else\n    {\n      normals->ComputePointNormalsOn();\n      normals->SplittingOn();\n    }\n\n    normals->Update();\n\n    vtkNew<vtkPolyData> normalsPolyData;\n    normalsPolyData->DeepCopy(normals->GetOutput());\n\n    // Mapper\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(normalsPolyData);\n    mapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"Peacock\").GetData());\n    actor->GetProperty()->SetDiffuse(.7);\n    actor->GetProperty()->SetSpecularPower(20);\n    actor->GetProperty()->SetSpecular(.5);\n\n    // Add the actor.\n    ren[i]->SetBackground(backgroundColors[i].GetData());\n    ren[i]->SetActiveCamera(camera);\n    ren[i]->AddActor(actor);\n  }\n\n  // Render window.\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(ren[0]);\n  renwin->AddRenderer(ren[1]);\n  renwin->AddRenderer(ren[2]);\n  renwin->SetWindowName(\"NormalsDemo\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renwin);\n\n  renwin->SetSize(900, 300);\n  ren[0]->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  ren[0]->GetActiveCamera()->SetPosition(1, 0, 0);\n  ren[0]->GetActiveCamera()->SetViewUp(0, 0, -1);\n  ren[0]->ResetCamera();\n\n  ren[0]->GetActiveCamera()->Azimuth(120);\n  ren[0]->GetActiveCamera()->Elevation(30);\n  ren[0]->GetActiveCamera()->Dolly(1.1);\n  ren[0]->ResetCameraClippingRange();\n\n  renwin->Render();\n  ren[0]->ResetCamera();\n  renwin->Render();\n\n  // Start\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphere;\n    sphere->SetPhiResolution(11);\n    sphere->SetThetaResolution(11);\n\n    sphere->Update();\n    polyData = sphere->GetOutput();\n  }\n  vtkNew<vtkCleanPolyData> clean;\n  clean->SetInputData(polyData);\n  clean->Update();\n  return clean->GetOutput();\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/NormalsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NormalsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NormalsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NormalsDemo MACOSX_BUNDLE NormalsDemo.cxx )\n  target_link_libraries(NormalsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NormalsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/NormalsDemo/#download-and-build-normalsdemo","title":"Download and Build NormalsDemo","text":"

Click here to download NormalsDemo and its CMakeLists.txt file. Once the tarball NormalsDemo.tar has been downloaded and extracted,

cd NormalsDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./NormalsDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Opacity/","title":"Opacity","text":"

vtk-examples/Cxx/Visualization/Opacity

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Opacity/#code","title":"Code","text":"

Opacity.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Cube\n  vtkNew<vtkCubeSource> cubeSource;\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->GetProperty()->SetOpacity(0.5);\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGreen\").GetData());\n  sphereActor->GetProperty()->SetOpacity(0.7);\n  sphereActor->SetMapper(sphereMapper);\n\n  // Create renderers and add actors of plane and cube\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(cubeActor);\n  renderer->AddActor(sphereActor);\n\n  // Add renderer to renderwindow and render\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Opacity\");\n\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Azimuth(-22.5);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n\n  interactor->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Opacity/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Opacity)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Opacity: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Opacity MACOSX_BUNDLE Opacity.cxx )\n  target_link_libraries(Opacity PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Opacity\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Opacity/#download-and-build-opacity","title":"Download and Build Opacity","text":"

Click here to download Opacity and its CMakeLists.txt file. Once the tarball Opacity.tar has been downloaded and extracted,

cd Opacity/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Opacity\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/OrientedGlyphs/","title":"OrientedGlyphs","text":"

vtk-examples/Cxx/Visualization/OrientedGlyphs

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/OrientedGlyphs/#code","title":"Code","text":"

OrientedGlyphs.cxx

#include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyData> input;\n  input->ShallowCopy(sphereSource->GetOutput());\n\n  vtkNew<vtkArrowSource> arrowSource;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetSourceConnection(arrowSource->GetOutputPort());\n  glyph3D->SetVectorModeToUseNormal();\n  glyph3D->SetInputData(input);\n  glyph3D->SetScaleFactor(.2);\n  glyph3D->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OrientedGlyphs\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  renderWindow->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-0.399941, -1.070475, 2.931458);\n  camera->SetFocalPoint(-0.000000, -0.000000, 0.000000);\n  camera->SetViewUp(-0.028450, 0.940195, 0.339448);\n  camera->SetDistance(3.146318);\n  camera->SetClippingRange(1.182293, 5.626211);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/OrientedGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientedGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientedGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientedGlyphs MACOSX_BUNDLE OrientedGlyphs.cxx )\n  target_link_libraries(OrientedGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientedGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/OrientedGlyphs/#download-and-build-orientedglyphs","title":"Download and Build OrientedGlyphs","text":"

Click here to download OrientedGlyphs and its CMakeLists.txt file. Once the tarball OrientedGlyphs.tar has been downloaded and extracted,

cd OrientedGlyphs/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OrientedGlyphs\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/PointDataSubdivision/","title":"PointDataSubdivision","text":"

vtk-examples/Cxx/Visualization/PointDataSubdivision

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/PointDataSubdivision/#description","title":"Description","text":""},{"location":"Cxx/Visualization/PointDataSubdivision/#introduction","title":"Introduction","text":"

This example demonstrates the use of the vtkLinearSubdivisionFilter and vtkButterflySubdivisionFilter.

In order to see the effects of these filters a triptych is created that demonstrates the effect of applying the filter.

The user can select from a list of sources to render, specify whether normals are displayed, what type of shading to use and the number of normals to glyph.

A representative set of sources to render are provided in the class called Sources. The user is encouraged to experiment with different sources to see the effect of the filters.

"},{"location":"Cxx/Visualization/PointDataSubdivision/#adding-more-sources","title":"Adding more sources.","text":"

If you add more sources, you may need to provide one or all of these filters:

  • A vtkTriangleFilter
  • A vtkPolyDataNormals filter
  • A vtkElevationFilter.
  • A vtkCleanPolyData filter.
  • For parametric sources, you may need to apply one of both of JoinUOff() or JoinVOff().

The representative sources provided in the class Sources should provide good templates.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/PointDataSubdivision/#code","title":"Code","text":"

PointDataSubdivision.cxx

#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkArrowSource.h>\n#include <vtkAxesActor.h>\n#include <vtkButterflySubdivisionFilter.h>\n#include <vtkCamera.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkCleanPolyData.h>\n#include <vtkColorSeries.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkConeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkElevationFilter.h>\n#include <vtkGlyph3D.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPNGWriter.h>\n#include <vtkParametricBoy.h>\n#include <vtkParametricEllipsoid.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderLargeImage.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTriangleFilter.h>\n\n#include <algorithm>\n#include <iostream>\n#include <map>\n#include <string>\n\nnamespace {\n/**\n * If you add more sources, you may need to provide one or all of these filters:\n *  - A Triangle filter\n *  - A Normal filter\n *  - An elevation filter.\n *  - A CleanPolyData filter.\n *  - For parametric sources, we may need to apply one of both of JoinUOff() or\n * JoinVOff().\n *\n * Use the representative sources provided here as templates.\n */\n\nvoid ParametricTorusSource(vtkPolyData* src);\n\nvoid EllipsoidSource(vtkPolyData* src);\n\nvoid BoySource(vtkPolyData* src);\n\nvoid MobiusSource(vtkPolyData* src);\n\nvoid ParametricRandomHills(vtkPolyData* src);\n\nvoid SphereSource(vtkPolyData* src);\n\n/**\n * Make a torus as the source using vtkSuperquadricSource.\n */\nvoid SuperquadricSource(vtkPolyData* src);\n\nvoid ConeSource(vtkPolyData* src);\n\n/**\n * Make a lookup table using a predefined color series.\n *\n * @param scalarRange The range of the scalars to be coloured.\n *\n * @return A lookup table.\n */\nvtkSmartPointer<vtkColorTransferFunction> MakeLUT(double* scalarRange);\n\n/**\n * Create the actor for glyphing the normals.\n *\n * @param source the surface.\n * @param glyphPoints The number of points used by the mask filter.\n * @param scalarRange The range in terms of scalar minimum and maximum.\n * @param scaleFactor The scaling factor for the glyph.\n * @param lut The lookup table to use.\n *\n * @return The glyph actor.\n */\n\nvtkSmartPointer<vtkActor> GlyphActor(vtkPolyData* source, int glyphPoints,\n                                     double* scalarRange, double scaleFactor,\n                                     vtkColorTransferFunction* lut);\n\n/**\n * Create the actor for a surface.\n *\n * @param surface The surface.\n * @param scalarRange The range in terms of scalar minimum and maximum.\n * @param lut The lookup table to use.\n *\n * @return The actor for the surface.\n */\nvtkSmartPointer<vtkActor> MakeSurfaceActor(vtkPolyData* surface,\n                                           double* scalarRange,\n                                           vtkColorTransferFunction* lut);\n\n/**\n * Create a label.\n *\n * @param textLabel The label.\n * @param renWinSize The size of the render window. Used to set the font size.\n *\n * @return The actor for the text label.\n */\nvtkSmartPointer<vtkActor2D> MakeLabel(const char* textLabel, int renWinSize);\n\n/**\n * Make an axis actor.\n *\n * @return The axis actor.\n */\nvtkSmartPointer<vtkAxesActor> MakeAxesActor();\n\n/**\n * Create an orientation marker for a given renderer.\n *\n * @param renderer The renderer.\n * @param iren The interactor.\n *\n * @return: The orientation marker.\n */\nvtkSmartPointer<vtkOrientationMarkerWidget>\nMakeOrientationMarker(vtkRenderer* renderer, vtkRenderWindowInteractor* iren);\n\n/**\n * Save the image as a PNG.\n *\n * @param ren the renderer.\n * @param fn the file name.\n * @param magnification the magnification, usually 1.\n */\nvoid WritePNG(vtkRenderer* ren, char* fn, int magnification = 1);\n\n} // namespace\n\n/**\n * Demonstrates point data subdivision with the glyphing of normals on the\n * surface.\n *\n * This program takes a surface and displays three surfaces.\n *\n * The first surface is the original surface and the second and third surfaces\n * have had linear and butterfly interpolation applied respectively.\n *\n * The user can control the object to use, normal generation, type of shading\n * and number of points to use for the normals.\n */\nint main(int argc, char* argv[])\n{\n  if (argc < 1)\n  {\n    std::cerr << \"Missing parameters.\" << std::endl;\n    std::cerr << \"Usage: \" << argv[0]\n              << \"sourcetouse: (parametric_torus; parametric_ellipsoid; boy; \"\n                 \"sphere; mobius; cone; random_hills; superquadric)\"\n              << \"[displayNormals]\"\n              << \"[gouraudInterpolation]\"\n              << \"[glyphPoints]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::map<std::string, int> availableSurfaces{{\"parametric_torus\", 0},\n                                               {\"parametric_ellipsoid\", 1},\n                                               {\"boy\", 2},\n                                               {\"sphere\", 3},\n                                               {\"mobius\", 4},\n                                               {\"cone\", 5},\n                                               {\"random_hills\", 6},\n                                               {\"superquadric\", 7}};\n\n  std::string desiredSurface{\"parametric_torus\"};\n  if (argc < 2)\n  {\n    std::cout << \"Using parametric_torus as the surface.\" << std::endl;\n  }\n  else\n  {\n    desiredSurface = argv[1];\n    std::transform(desiredSurface.begin(), desiredSurface.end(),\n                   desiredSurface.begin(),\n                   [](char c) { return std::tolower(c); });\n    if (availableSurfaces.find(desiredSurface) == availableSurfaces.end())\n    {\n      std::cout << \"The requested surface: \" << argv[1]\n                << \" not found, reverting to using parametric_torus.\"\n                << std::endl;\n      desiredSurface = \"parametric_torus\";\n    }\n  }\n\n  vtkNew<vtkPolyData> polyData;\n  switch (availableSurfaces[desiredSurface])\n  {\n  case 0:\n    ParametricTorusSource(polyData);\n    break;\n  case 1:\n    EllipsoidSource(polyData);\n    break;\n  case 2:\n    BoySource(polyData.GetPointer());\n    break;\n  case 3:\n    SphereSource(polyData);\n    break;\n  case 4:\n    MobiusSource(polyData);\n    break;\n  case 5:\n    ConeSource(polyData);\n    break;\n  case 6:\n    ParametricRandomHills(polyData);\n    break;\n  case 7:\n    SuperquadricSource(polyData);\n    break;\n  default:\n    ParametricTorusSource(polyData);\n  }\n\n  bool displayNormals = true;\n  if (argc > 2)\n  {\n    displayNormals = (atoi(argv[2]) != 0);\n  }\n\n  bool gouraudInterpolation = true;\n  if (argc > 3)\n  {\n    gouraudInterpolation = (atoi(argv[3]) != 0);\n  }\n\n  int glyphPoints = 50;\n  if (argc > 4)\n  {\n    glyphPoints = atoi(argv[4]);\n  }\n\n  // The size of the render window.\n  int renWinXSize = 1200;\n  int renWinYSize = renWinXSize / 3;\n  int minRenWinDim = std::min(renWinXSize, renWinYSize);\n\n  // [xMin, xMax, yMin, yMax, zMin, zMax]\n  double* bounds = polyData->GetBounds();\n  // Use this to scale the normal glyph.\n  std::vector<double> dims;\n  dims.push_back(std::abs(bounds[1] - bounds[0]));\n  dims.push_back(std::abs(bounds[3] - bounds[2]));\n  dims.push_back(std::abs(bounds[5] - bounds[4]));\n  double scaleFactor = *std::min_element(dims.begin(), dims.end()) * 0.2;\n\n  polyData->GetPointData()->GetScalars()->SetName(\"Elevation\");\n  double* scalarRange = polyData->GetScalarRange();\n\n  vtkNew<vtkButterflySubdivisionFilter> butterfly;\n  butterfly->SetInputData(polyData);\n  butterfly->SetNumberOfSubdivisions(3);\n  butterfly->Update();\n\n  vtkNew<vtkLinearSubdivisionFilter> linear;\n  linear->SetInputData(polyData);\n  linear->SetNumberOfSubdivisions(3);\n  linear->Update();\n\n  vtkSmartPointer<vtkColorTransferFunction> lut = MakeLUT(scalarRange);\n\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  actors.push_back(MakeSurfaceActor(butterfly->GetOutput(), scalarRange, lut));\n  actors.push_back(MakeSurfaceActor(linear->GetOutput(), scalarRange, lut));\n  actors.push_back(MakeSurfaceActor(polyData, scalarRange, lut));\n\n  // Let's visualise the normals.\n  std::vector<vtkSmartPointer<vtkActor>> glyphActors;\n  if (displayNormals)\n  {\n    glyphActors.push_back(GlyphActor(butterfly->GetOutput(), glyphPoints,\n                                     scalarRange, scaleFactor, lut));\n    glyphActors.push_back(GlyphActor(linear->GetOutput(), glyphPoints,\n                                     scalarRange, scaleFactor, lut));\n    glyphActors.push_back(\n        GlyphActor(polyData, glyphPoints, scalarRange, scaleFactor, lut));\n  }\n\n  std::vector<vtkSmartPointer<vtkActor2D>> labelActors;\n  labelActors.push_back(MakeLabel(\"Butterfly Subdivision\", minRenWinDim));\n  labelActors.push_back(MakeLabel(\"Linear Subdivision\", minRenWinDim));\n  labelActors.push_back(MakeLabel(\"Original\", minRenWinDim));\n\n  std::vector<vtkSmartPointer<vtkRenderer>> ren;\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren[2]->SetViewport(0, 0, 1.0 / 3.0, 1);         // Original\n  ren[1]->SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1); // Linear\n  ren[0]->SetViewport(2.0 / 3.0, 0, 1, 1);         // Butterfly\n\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkNamedColors> nc;\n\n  // Orientation markers.\n  std::vector<vtkSmartPointer<vtkOrientationMarkerWidget>> om;\n\n  // Shared camera.\n  vtkNew<vtkCamera> camera;\n\n  // Make the imaging pipelines.\n  for (unsigned int i = 0; i < ren.size(); ++i)\n  {\n    renWin->AddRenderer(ren[i]);\n\n    ren[i]->AddActor(actors[i]);\n    ren[i]->AddActor(labelActors[i]);\n    ren[i]->SetBackground(nc->GetColor3d(\"SlateGray\").GetData());\n    ren[i]->SetActiveCamera(camera);\n    if (displayNormals)\n    {\n      ren[i]->AddActor(glyphActors[i]);\n    }\n\n    om.push_back(MakeOrientationMarker(ren[i], iren));\n  }\n  renWin->SetSize(renWinXSize, renWinYSize);\n\n  iren->Initialize();\n\n  if (gouraudInterpolation)\n  {\n    for (unsigned int i = 0; i < actors.size(); ++i)\n    {\n      actors[i]->GetProperty()->SetInterpolationToGouraud();\n    }\n  }\n  else\n  {\n    for (unsigned int i = 0; i < actors.size(); ++i)\n    {\n      actors[i]->GetProperty()->SetInterpolationToFlat();\n    }\n  }\n\n  renWin->Render();\n  ren[0]->ResetCamera();\n  renWin->Render();\n  renWin->SetWindowName(\"PointDataSubdivision\");\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid ParametricTorusSource(vtkPolyData* src)\n{\n  vtkNew<vtkParametricTorus> torus;\n  torus->JoinUOff();\n  torus->JoinVOff();\n\n  vtkNew<vtkParametricFunctionSource> torusSource;\n  torusSource->SetParametricFunction(torus);\n  torusSource->SetScalarModeToZ();\n  torusSource->Update();\n\n  src->ShallowCopy(torusSource->GetOutput());\n}\n\nvoid EllipsoidSource(vtkPolyData* src)\n{\n  vtkNew<vtkParametricEllipsoid> ellipsoid;\n  ellipsoid->SetXRadius(0.5);\n  ellipsoid->SetYRadius(1.0);\n  ellipsoid->SetZRadius(2.0);\n  ellipsoid->JoinUOff();\n  // ellipsoid->JoinVOff();\n\n  vtkNew<vtkParametricFunctionSource> ellipsoidSource;\n  ellipsoidSource->SetParametricFunction(ellipsoid);\n  ellipsoidSource->SetScalarModeToZ();\n  ellipsoidSource->Update();\n\n  src->ShallowCopy(ellipsoidSource->GetOutput());\n}\n\nvoid BoySource(vtkPolyData* src)\n{\n  vtkNew<vtkParametricBoy> boy;\n  boy->JoinUOff();\n  // boy->JoinVOff();\n\n  vtkNew<vtkParametricFunctionSource> boySource;\n  boySource->SetParametricFunction(boy);\n  boySource->SetScalarModeToZ();\n  boySource->Update();\n  src->ShallowCopy(boySource->GetOutput());\n}\n\nvoid MobiusSource(vtkPolyData* src)\n{\n  vtkNew<vtkParametricMobius> mobius;\n  mobius->SetRadius(2);\n  mobius->SetMinimumV(-0.5);\n  mobius->SetMaximumV(0.5);\n  mobius->JoinUOff();\n\n  vtkNew<vtkParametricFunctionSource> mobiusSource;\n  mobiusSource->SetParametricFunction(mobius);\n  mobiusSource->SetScalarModeToX();\n  mobiusSource->Update();\n\n  src->ShallowCopy(mobiusSource->GetOutput());\n}\n\nvoid ParametricRandomHills(vtkPolyData* src)\n{\n  vtkNew<vtkParametricRandomHills> randomHills;\n  // randomHills->AllowRandomGenerationOff();\n  randomHills->SetRandomSeed(1);\n  randomHills->SetNumberOfHills(30);\n\n  vtkNew<vtkParametricFunctionSource> randomHillsSource;\n  randomHillsSource->SetParametricFunction(randomHills);\n  randomHillsSource->SetScalarModeToZ();\n  randomHillsSource->SetUResolution(10);\n  randomHillsSource->SetVResolution(10);\n  randomHillsSource->Update();\n\n  src->ShallowCopy(randomHillsSource->GetOutput());\n}\n\nvoid SphereSource(vtkPolyData* src)\n{\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(11);\n  sphere->SetThetaResolution(11);\n  sphere->Update();\n  double* sphereBounds = sphere->GetOutput()->GetBounds();\n\n  vtkNew<vtkElevationFilter> elev;\n  elev->SetInputConnection(sphere->GetOutputPort());\n  elev->SetLowPoint(0, sphereBounds[2], 0);\n  elev->SetHighPoint(0, sphereBounds[3], 0);\n  elev->Update();\n\n  src->ShallowCopy(elev->GetPolyDataOutput());\n}\n\nvoid SuperquadricSource(vtkPolyData* src)\n{\n  vtkNew<vtkSuperquadricSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetScale(1.0, 1.0, 1.0);\n  source->SetPhiResolution(64);\n  source->SetThetaResolution(64);\n  source->SetThetaRoundness(1);\n  source->SetThickness(0.5);\n  source->SetSize(10);\n  source->SetToroidal(1);\n\n  // The quadric is made of strips, so pass it through a triangle filter as\n  // the curvature filter only operates on polys.\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(source->GetOutputPort());\n\n  // The quadric has nasty discontinuities from the way the edges are\n  // generated so let's pass it though a CleanPolyDataFilter and merge any\n  // points which are coincident, or very close.\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n  double* cleanerBounds = cleaner->GetOutput()->GetBounds();\n\n  vtkNew<vtkElevationFilter> elev;\n  elev->SetInputConnection(cleaner->GetOutputPort());\n  elev->SetLowPoint(0, cleanerBounds[2], 0);\n  elev->SetHighPoint(0, cleanerBounds[3], 0);\n  elev->Update();\n\n  src->ShallowCopy(elev->GetPolyDataOutput());\n}\n\nvoid ConeSource(vtkPolyData* src)\n{\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(6);\n  cone->CappingOn();\n  cone->Update();\n  double* coneBounds = cone->GetOutput()->GetBounds();\n\n  vtkNew<vtkPolyDataNormals> coneNormals;\n  coneNormals->SetInputConnection(cone->GetOutputPort());\n\n  vtkNew<vtkElevationFilter> elev;\n  elev->SetInputConnection(coneNormals->GetOutputPort());\n  elev->SetLowPoint(coneBounds[0], 0, 0);\n  elev->SetHighPoint(coneBounds[1], 0, 0);\n\n  // vtkButterflySubdivisionFilter and vtkLinearSubdivisionFilter operate on\n  // triangles.\n  vtkNew<vtkTriangleFilter> tf;\n  tf->SetInputConnection(elev->GetOutputPort());\n  tf->Update();\n\n  src->ShallowCopy(tf->GetOutput());\n}\n\nvtkSmartPointer<vtkColorTransferFunction> MakeLUT(double* scalarRange)\n{\n  vtkNew<vtkColorSeries> colorSeries;\n  // Select a color scheme.\n  // for (unsigned int i = 0; i < 62; ++i)\n  //{\n  //  colorSeries->SetColorScheme(i);\n  //  std::cout << \"Colour scheme: \" << colorSeries->GetColorScheme() << \": \" <<\n  //  colorSeries->GetColorSchemeName();\n  //}\n\n  // Colour scheme 61: Brewer Qualitative Set3\n  colorSeries->SetColorScheme(61);\n  // We use this colour series to create the transfer function.\n  vtkNew<vtkColorTransferFunction> lut;\n  lut->SetColorSpaceToHSV();\n  int numColors = colorSeries->GetNumberOfColors();\n  for (int i = 0; i < numColors; ++i)\n  {\n    vtkColor3ub color = colorSeries->GetColor(i);\n    std::vector<double> c;\n    for (unsigned int j = 0; j < 3; ++j)\n    {\n      c.push_back(color[j] / 255.0);\n    }\n    double t = scalarRange[0] +\n        (scalarRange[1] - scalarRange[0]) / (numColors - 1) * i;\n    lut->AddRGBPoint(t, c[0], c[1], c[2]);\n  }\n  return lut;\n}\n\nvtkSmartPointer<vtkActor> GlyphActor(vtkPolyData* source, int glyphPoints,\n                                     double* scalarRange, double scaleFactor,\n                                     vtkColorTransferFunction* lut)\n{\n  vtkNew<vtkArrowSource> arrowSource;\n  // Subsample the dataset.\n  vtkNew<vtkMaskPoints> maskPts;\n  maskPts->SetInputData(source);\n  maskPts->SetOnRatio(source->GetNumberOfPoints() / glyphPoints);\n  maskPts->SetRandomMode(1);\n\n  vtkNew<vtkGlyph3D> arrowGlyph;\n  arrowGlyph->SetScaleFactor(scaleFactor);\n  arrowGlyph->SetVectorModeToUseNormal();\n  arrowGlyph->SetColorModeToColorByScalar();\n  arrowGlyph->SetScaleModeToScaleByVector();\n  arrowGlyph->OrientOn();\n  arrowGlyph->SetSourceConnection(arrowSource->GetOutputPort());\n  arrowGlyph->SetInputConnection(maskPts->GetOutputPort());\n  arrowGlyph->Update();\n\n  vtkNew<vtkDataSetMapper> arrowGlyphMapper;\n  // Colour by scalars.\n  arrowGlyphMapper->SetScalarRange(scalarRange);\n  arrowGlyphMapper->SetColorModeToMapScalars();\n  arrowGlyphMapper->ScalarVisibilityOn();\n  arrowGlyphMapper->SetLookupTable(lut);\n  arrowGlyphMapper->SetInputConnection(arrowGlyph->GetOutputPort());\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(arrowGlyphMapper);\n  return glyphActor;\n}\n\nvtkSmartPointer<vtkActor> MakeSurfaceActor(vtkPolyData* surface,\n                                           double* scalarRange,\n                                           vtkColorTransferFunction* lut)\n{\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(surface);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(scalarRange);\n  mapper->SetColorModeToMapScalars();\n  mapper->ScalarVisibilityOn();\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  return actor;\n}\n\nvtkSmartPointer<vtkActor2D> MakeLabel(const char* textLabel, int renWinSize)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetJustificationToCentered();\n  textProperty->SetFontSize(int(renWinSize / 20));\n\n  vtkNew<vtkTextMapper> mapper;\n  mapper->SetInput(textLabel);\n  mapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->SetPosition(renWinSize / 2.0, renWinSize / 20);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  return actor;\n}\n\nvtkSmartPointer<vtkAxesActor> MakeAxesActor()\n{\n  vtkNew<vtkAxesActor> axes;\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(\"X\");\n  axes->SetYAxisLabelText(\"Y\");\n  axes->SetZAxisLabelText(\"Z\");\n  axes->SetTotalLength(1.0, 1.0, 1.0);\n  axes->SetCylinderRadius(1.0 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.75 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.0 * axes->GetSphereRadius());\n  axes->GetXAxisCaptionActor2D()->GetTextActor()->GetScaledTextProperty();\n  axes->GetXAxisCaptionActor2D()->GetTextActor()->SetTextScaleModeToNone();\n  axes->GetYAxisCaptionActor2D()->GetTextActor()->GetScaledTextProperty();\n  axes->GetYAxisCaptionActor2D()->GetTextActor()->SetTextScaleModeToNone();\n  axes->GetZAxisCaptionActor2D()->GetTextActor()->GetScaledTextProperty();\n  axes->GetZAxisCaptionActor2D()->GetTextActor()->SetTextScaleModeToNone();\n  return axes;\n}\n\nvtkSmartPointer<vtkOrientationMarkerWidget>\nMakeOrientationMarker(vtkRenderer* renderer, vtkRenderWindowInteractor* iren)\n{\n  vtkNew<vtkOrientationMarkerWidget> om;\n  auto axesActor = MakeAxesActor();\n  om->SetOrientationMarker(axesActor);\n  // Position lower left in the viewport.\n  om->SetViewport(0, 0, 0.2, 0.2);\n  om->SetInteractor(iren);\n  om->SetDefaultRenderer(renderer);\n  om->EnabledOn();\n  om->InteractiveOn();\n  return om;\n}\n\nvoid WritePNG(vtkRenderer* ren, char* fn, int magnification)\n{\n  vtkNew<vtkRenderLargeImage> renLgeIm;\n  vtkNew<vtkPNGWriter> imgWriter;\n  renLgeIm->SetInput(ren);\n  renLgeIm->SetMagnification(magnification);\n  imgWriter->SetInputConnection(renLgeIm->GetOutputPort());\n  imgWriter->SetFileName(fn);\n  imgWriter->Write();\n}\n\n} // namespace\n
"},{"location":"Cxx/Visualization/PointDataSubdivision/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointDataSubdivision)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersHybrid\n  FiltersModeling\n  FiltersSources\n  IOImage\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointDataSubdivision: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointDataSubdivision MACOSX_BUNDLE PointDataSubdivision.cxx )\n  target_link_libraries(PointDataSubdivision PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointDataSubdivision\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/PointDataSubdivision/#download-and-build-pointdatasubdivision","title":"Download and Build PointDataSubdivision","text":"

Click here to download PointDataSubdivision and its CMakeLists.txt file. Once the tarball PointDataSubdivision.tar has been downloaded and extracted,

cd PointDataSubdivision/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointDataSubdivision\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/PointSize/","title":"PointSize","text":"

vtk-examples/Cxx/Visualization/PointSize

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/PointSize/#description","title":"Description","text":"

This example demonstrates how to change the size of an actor's points.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/PointSize/#code","title":"Code","text":"

PointSize.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create points.\n  vtkNew<vtkPointSource> src;\n  src->SetCenter(0, 0, 0);\n  src->SetNumberOfPoints(10);\n  src->SetRadius(5);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(src->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointSize\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBLue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/PointSize/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointSize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointSize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointSize MACOSX_BUNDLE PointSize.cxx )\n  target_link_libraries(PointSize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointSize\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/PointSize/#download-and-build-pointsize","title":"Download and Build PointSize","text":"

Click here to download PointSize and its CMakeLists.txt file. Once the tarball PointSize.tar has been downloaded and extracted,

cd PointSize/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PointSize\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ProgrammableGlyphFilter/","title":"ProgrammableGlyphFilter","text":"

vtk-examples/Cxx/Visualization/ProgrammableGlyphFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ProgrammableGlyphFilter/#code","title":"Code","text":"

ProgrammableGlyphFilter.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProgrammableGlyphFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nvoid CalcGlyph(void* arg);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(5, 0, 0);\n  points->InsertNextPoint(10, 0, 0);\n\n  // Combine into a polydata.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkProgrammableGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n  glyphFilter->SetGlyphMethod(CalcGlyph, glyphFilter);\n  // need a default glyph, but this should not be used\n  vtkNew<vtkConeSource> coneSource;\n  glyphFilter->SetSourceConnection(coneSource->GetOutputPort());\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ProgrammableGlyphFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CalcGlyph(void* arg)\n{\n\n  vtkProgrammableGlyphFilter* glyphFilter = (vtkProgrammableGlyphFilter*)arg;\n\n  if (!glyphFilter)\n  {\n    std::cerr << \"glyphFilter is not valid!\" << std::endl;\n  }\n  double pointCoords[3];\n  glyphFilter->GetPoint(pointCoords);\n\n  std::cout << \"Calling CalcGlyph for point \" << glyphFilter->GetPointId()\n            << std::endl;\n  std::cout << \"Point coords are: \" << pointCoords[0] << \" \" << pointCoords[1]\n            << \" \" << pointCoords[2] << std::endl;\n  if (glyphFilter->GetPointId() == 0)\n  {\n    vtkNew<vtkConeSource> coneSource;\n    coneSource->SetCenter(pointCoords);\n    glyphFilter->SetSourceConnection(coneSource->GetOutputPort());\n  }\n  else if (glyphFilter->GetPointId() == 1)\n  {\n    vtkNew<vtkCubeSource> cubeSource;\n    cubeSource->SetCenter(pointCoords);\n    glyphFilter->SetSourceConnection(cubeSource->GetOutputPort());\n  }\n  else if (glyphFilter->GetPointId() == 2)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetCenter(pointCoords);\n    glyphFilter->SetSourceConnection(sphereSource->GetOutputPort());\n  }\n}\n\n} // namespace```\n###CMakeLists.txt\n```cmake\ncmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProgrammableGlyphFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersProgrammable\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProgrammableGlyphFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProgrammableGlyphFilter MACOSX_BUNDLE ProgrammableGlyphFilter.cxx )\n  target_link_libraries(ProgrammableGlyphFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProgrammableGlyphFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ProgrammableGlyphFilter/#download-and-build-programmableglyphfilter","title":"Download and Build ProgrammableGlyphFilter","text":"

Click here to download ProgrammableGlyphFilter and its CMakeLists.txt file. Once the tarball ProgrammableGlyphFilter.tar has been downloaded and extracted,

cd ProgrammableGlyphFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ProgrammableGlyphFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ProjectSphere/","title":"ProjectSphere","text":"

vtk-examples/Cxx/Visualization/ProjectSphere

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ProjectSphere/#code","title":"Code","text":"

ProjectSphere.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkElevationFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSuperEllipsoid.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProjectSphereFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkParametricSuperEllipsoid> surface;\n  surface->SetN1(2.0);\n  surface->SetN2(0.5);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetParametricFunction(surface);\n\n  vtkNew<vtkElevationFilter> elevationFilter;\n  elevationFilter->SetInputConnection(source->GetOutputPort());\n  elevationFilter->SetLowPoint(0.0, 0.0, -4.0);\n  elevationFilter->SetHighPoint(0.0, 0.0, 4.0);\n  elevationFilter->Update();\n\n  // Deep copy the point data since in some versions of VTK,\n  // the ProjectSphereFilter modifies the input point data.\n  vtkNew<vtkPolyData> pd1;\n  pd1->DeepCopy(elevationFilter->GetOutput());\n\n  vtkNew<vtkProjectSphereFilter> sphereProject1;\n  sphereProject1->SetInputConnection(elevationFilter->GetOutputPort());\n  sphereProject1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereProject1->GetOutputPort());\n  mapper1->SetScalarRange(\n      sphereProject1->GetOutput()->GetPointData()->GetScalars()->GetRange());\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputData(pd1);\n  mapper2->SetScalarRange(pd1->GetPointData()->GetScalars()->GetRange());\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n\n  // A render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"RosyBrown\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  leftRenderer->AddActor(actor2);\n  rightRenderer->AddActor(actor1);\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  leftRenderer->GetActiveCamera()->Azimuth(30);\n  leftRenderer->GetActiveCamera()->Elevation(-30);\n  leftRenderer->ResetCamera();\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ProjectSphere\");\n\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ProjectSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProjectSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProjectSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProjectSphere MACOSX_BUNDLE ProjectSphere.cxx )\n  target_link_libraries(ProjectSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProjectSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ProjectSphere/#download-and-build-projectsphere","title":"Download and Build ProjectSphere","text":"

Click here to download ProjectSphere and its CMakeLists.txt file. Once the tarball ProjectSphere.tar has been downloaded and extracted,

cd ProjectSphere/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ProjectSphere\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ProteinRibbons/","title":"ProteinRibbons","text":"

vtk-examples/Cxx/Visualization/ProteinRibbons

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ProteinRibbons/#description","title":"Description","text":"

This example reads Protein Data Bank files. The example expects a file in .pdb format.

Here src/Testing/Data/2j6g.pdb is the sample file.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ProteinRibbons/#code","title":"Code","text":"

ProteinRibbons.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPDBReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProteinRibbonFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.pdb e.g. 2j6g.pdb\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string fileName(argv[1]);\n\n  // read protein from pdb\n  vtkNew<vtkPDBReader> reader;\n  reader->SetFileName(fileName.c_str());\n\n  // setup ribbon filter\n  vtkNew<vtkProteinRibbonFilter> ribbonFilter;\n  ribbonFilter->SetInputConnection(reader->GetOutputPort());\n\n  // setup poly data mapper\n  vtkNew<vtkPolyDataMapper> polyDataMapper;\n  polyDataMapper->SetInputConnection(ribbonFilter->GetOutputPort());\n\n  // setup actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(polyDataMapper);\n  actor->GetProperty()->SetDiffuse(.7);\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(80.0);\n\n  // setup render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  vtkInteractorStyleSwitch* style =\n      dynamic_cast<vtkInteractorStyleSwitch*>(interactor->GetInteractorStyle());\n  style->SetCurrentStyleToTrackballCamera();\n\n  vtkNew<vtkNamedColors> colors;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ProteinRibbons\");\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(45);\n  renderer->GetActiveCamera()->Elevation(45);\n  renderer->GetActiveCamera()->Zoom(1.7);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  // Finally render the scene\n  renderWindow->SetMultiSamples(0);\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ProteinRibbons/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProteinRibbons)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  DomainsChemistry\n  DomainsChemistryOpenGL2\n  IOChemistry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProteinRibbons: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProteinRibbons MACOSX_BUNDLE ProteinRibbons.cxx )\n  target_link_libraries(ProteinRibbons PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProteinRibbons\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ProteinRibbons/#download-and-build-proteinribbons","title":"Download and Build ProteinRibbons","text":"

Click here to download ProteinRibbons and its CMakeLists.txt file. Once the tarball ProteinRibbons.tar has been downloaded and extracted,

cd ProteinRibbons/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ProteinRibbons\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/QuadraticSurface/","title":"QuadraticSurface","text":"

vtk-examples/Cxx/Visualization/QuadraticSurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/QuadraticSurface/#description","title":"Description","text":"

This example demonstrates how to create and display a quadratic surface.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/QuadraticSurface/#code","title":"Code","text":"

QuadraticSurface.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the quadric function definition\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0);\n\n  // Sample the quadric function\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(quadric);\n  double xmin = 0, xmax = 1, ymin = 0, ymax = 1, zmin = 0, zmax = 1;\n  sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetInputConnection(sample->GetOutputPort());\n  contourFilter->GenerateValues(1, 1.0, 1.0);\n  contourFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(contourFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"QuadraticSurface\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"LimeGreen\").GetData());\n\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Elevation(-45);\n  renderer->GetActiveCamera()->Azimuth(45);\n  renderer->ResetCamera();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/QuadraticSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadraticSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadraticSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadraticSurface MACOSX_BUNDLE QuadraticSurface.cxx )\n  target_link_libraries(QuadraticSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadraticSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/QuadraticSurface/#download-and-build-quadraticsurface","title":"Download and Build QuadraticSurface","text":"

Click here to download QuadraticSurface and its CMakeLists.txt file. Once the tarball QuadraticSurface.tar has been downloaded and extracted,

cd QuadraticSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QuadraticSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/QuadricLODActor/","title":"QuadricLODActor","text":"

vtk-examples/Cxx/Visualization/QuadricLODActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/QuadricLODActor/#description","title":"Description","text":"

If you have a fast graphics card you may not see a difference with the sphere model.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/QuadricLODActor/#code","title":"Code","text":"

QuadricLODActor.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadricLODActor.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // High res sphere.\n  vtkNew<vtkSphereSource> highResSphereSource;\n  highResSphereSource->SetThetaResolution(200);\n  highResSphereSource->SetPhiResolution(200);\n  highResSphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> highResMapper;\n  highResMapper->SetInputConnection(highResSphereSource->GetOutputPort());\n\n  vtkNew<vtkQuadricLODActor> actor;\n  actor->SetMapper(highResMapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"QuadricLODActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindowInteractor->SetDesiredUpdateRate(1e20);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/QuadricLODActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadricLODActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadricLODActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadricLODActor MACOSX_BUNDLE QuadricLODActor.cxx )\n  target_link_libraries(QuadricLODActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadricLODActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/QuadricLODActor/#download-and-build-quadriclodactor","title":"Download and Build QuadricLODActor","text":"

Click here to download QuadricLODActor and its CMakeLists.txt file. Once the tarball QuadricLODActor.tar has been downloaded and extracted,

cd QuadricLODActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QuadricLODActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/QuadricVisualization/","title":"QuadricVisualization","text":"

vtk-examples/Cxx/Visualization/QuadricVisualization

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/QuadricVisualization/#description","title":"Description","text":"

Visualizing a quadric function F(x,y,z) = c

This example is inspired by the Figure 4-1, page 83, in the VTK Book.

Info

See Figure 4-1 in Chapter 4 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/QuadricVisualization/#code","title":"Code","text":"

QuadricVisualization.cxx

#include <vtkActor.h>\n#include <vtkAppendFilter.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractVOI.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\nnamespace {\nvoid CreateIsosurface(vtkSampleFunction* function, vtkActor* actor,\n                      unsigned int numberOfContours = 5);\n\nvoid CreatePlanes(vtkSampleFunction* function, vtkActor* actor,\n                  unsigned int numberOfPlanes);\n\nvoid CreateContours(vtkSampleFunction* function, vtkActor* actor,\n                    unsigned int numberOfPlanes, unsigned int numberOfContours);\n\nvoid CreateOutline(vtkSampleFunction* function, vtkActor* actor);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->SetSize(640, 480);\n\n  //\n  // Create the surface of the implicit function.\n  //\n  // double range[2];\n\n  // Sample the quadric function.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 2, 3, 0, 1, 0, 0, 0, 0, 0);\n\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(25, 25, 25);\n  sample->SetImplicitFunction(quadric);\n\n  vtkNew<vtkActor> isoActor;\n  CreateIsosurface(sample, isoActor);\n  vtkNew<vtkActor> outlineIsoActor;\n  CreateOutline(sample, outlineIsoActor);\n\n  vtkNew<vtkActor> planesActor;\n  CreatePlanes(sample, planesActor, 3);\n  vtkNew<vtkActor> outlinePlanesActor;\n  CreateOutline(sample, outlinePlanesActor);\n  planesActor->AddPosition(isoActor->GetBounds()[0] * 2.0, 0, 0);\n  outlinePlanesActor->AddPosition(isoActor->GetBounds()[0] * 2.0, 0, 0);\n\n  vtkNew<vtkActor> contourActor;\n  CreateContours(sample, contourActor, 3, 15);\n  vtkNew<vtkActor> outlineContourActor;\n  CreateOutline(sample, outlineContourActor);\n  contourActor->AddPosition(isoActor->GetBounds()[0] * 4.0, 0, 0);\n  outlineContourActor->AddPosition(isoActor->GetBounds()[0] * 4.0, 0, 0);\n\n  renderer->AddActor(planesActor);\n  renderer->AddActor(outlinePlanesActor);\n  renderer->AddActor(contourActor);\n  renderer->AddActor(outlineContourActor);\n  renderer->AddActor(isoActor);\n  renderer->AddActor(outlineIsoActor);\n\n  renderer->TwoSidedLightingOn();\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Try to set camera to match figure on book.\n  renderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, -1);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(20);\n  renderer->GetActiveCamera()->Azimuth(10);\n  renderer->GetActiveCamera()->Dolly(1.2);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"QuadricVisualization\");\n\n  renderWindow->Render();\n\n  // interact with data.\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateIsosurface(vtkSampleFunction* function, vtkActor* actor,\n                      unsigned int numberOfContours)\n{\n  double range[2];\n  // Generate the implicit surface.\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(function->GetOutputPort());\n  range[0] = 1.0;\n  range[1] = 6.0;\n  contour->GenerateValues(numberOfContours, range);\n\n  // Map contour\n  vtkNew<vtkPolyDataMapper> isosurfaceMapper;\n  isosurfaceMapper->SetInputConnection(contour->GetOutputPort());\n  isosurfaceMapper->SetScalarRange(0, 7);\n\n  actor->SetMapper(isosurfaceMapper);\n  return;\n}\n\nvoid CreatePlanes(vtkSampleFunction* function, vtkActor* actor,\n                  unsigned int numberOfPlanes)\n{\n  //\n  // Extract planes from the implicit function.\n  //\n\n  vtkNew<vtkAppendFilter> append;\n\n  int dims[3];\n  function->GetSampleDimensions(dims);\n  int sliceIncr = (dims[2] - 1) / (numberOfPlanes + 1);\n\n  int slice = -4;\n  for (unsigned int i = 0; i < numberOfPlanes; ++i)\n  {\n    vtkNew<vtkExtractVOI> extract;\n    extract->SetInputConnection(function->GetOutputPort());\n    extract->SetVOI(0, dims[0] - 1, 0, dims[1] - 1, slice + sliceIncr,\n                    slice + sliceIncr);\n    append->AddInputConnection(extract->GetOutputPort());\n    slice += sliceIncr;\n  }\n  append->Update();\n\n  // Map planes.\n  vtkNew<vtkDataSetMapper> planesMapper;\n  planesMapper->SetInputConnection(append->GetOutputPort());\n  planesMapper->SetScalarRange(0, 7);\n\n  actor->SetMapper(planesMapper);\n  actor->GetProperty()->SetAmbient(1.);\n  return;\n}\n\nvoid CreateContours(vtkSampleFunction* function, vtkActor* actor,\n                    unsigned int numberOfPlanes, unsigned int numberOfContours)\n{\n  //\n  // Extract planes from the implicit function.\n  //\n\n  vtkNew<vtkAppendFilter> append;\n\n  int dims[3];\n  function->GetSampleDimensions(dims);\n  int sliceIncr = (dims[2] - 1) / (numberOfPlanes + 1);\n\n  int slice = -4;\n  for (unsigned int i = 0; i < numberOfPlanes; ++i)\n  {\n    vtkNew<vtkExtractVOI> extract;\n    extract->SetInputConnection(function->GetOutputPort());\n    extract->SetVOI(0, dims[0] - 1, 0, dims[1] - 1, slice + sliceIncr,\n                    slice + sliceIncr);\n    double range[2];\n    range[0] = 1.0;\n    range[1] = 6.0;\n    vtkNew<vtkContourFilter> contour;\n    contour->SetInputConnection(extract->GetOutputPort());\n    contour->GenerateValues(numberOfContours, range);\n    append->AddInputConnection(contour->GetOutputPort());\n    slice += sliceIncr;\n  }\n  append->Update();\n\n  // Map contours.\n  vtkNew<vtkDataSetMapper> contoursMapper;\n  contoursMapper->SetInputConnection(append->GetOutputPort());\n  contoursMapper->SetScalarRange(0, 7);\n\n  actor->SetMapper(contoursMapper);\n  actor->GetProperty()->SetAmbient(1.);\n  return;\n}\n\nvoid CreateOutline(vtkSampleFunction* source, vtkActor* actor)\n{\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  actor->SetMapper(outlineMapper);\n  return;\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/QuadricVisualization/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadricVisualization)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  ImagingCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadricVisualization: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadricVisualization MACOSX_BUNDLE QuadricVisualization.cxx )\n  target_link_libraries(QuadricVisualization PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadricVisualization\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/QuadricVisualization/#download-and-build-quadricvisualization","title":"Download and Build QuadricVisualization","text":"

Click here to download QuadricVisualization and its CMakeLists.txt file. Once the tarball QuadricVisualization.tar has been downloaded and extracted,

cd QuadricVisualization/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./QuadricVisualization\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/RandomProbe/","title":"RandomProbe","text":"

vtk-examples/Cxx/Visualization/RandomProbe

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/RandomProbe/#code","title":"Code","text":"

RandomProbe.cxx

#include <vtkActor.h>\n#include <vtkCone.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphereSource.h>\n#include <vtkThreshold.h>\n#include <vtkThresholdPoints.h>\n\nint main(int argc, char* argv[])\n{\n  int resolution = 50;\n  if (argc > 1)\n  {\n    resolution = atoi(argv[1]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sampled cone.\n  vtkNew<vtkCone> implicitCone;\n  implicitCone->SetAngle(30.0);\n\n  double radius = 1.0;\n  vtkNew<vtkSampleFunction> sampledCone;\n  sampledCone->SetSampleDimensions(resolution, resolution, resolution);\n  double xMin = -radius * 2.0;\n  double xMax = radius * 2.0;\n  sampledCone->SetModelBounds(xMin, xMax, xMin, xMax, xMin, xMax);\n  sampledCone->SetImplicitFunction(implicitCone);\n\n  vtkNew<vtkThreshold> thresholdCone;\n  thresholdCone->SetInputConnection(sampledCone->GetOutputPort());\n  thresholdCone->SetLowerThreshold(0);\n  thresholdCone->SetThresholdFunction(vtkThreshold::THRESHOLD_LOWER);\n\n  vtkNew<vtkPointSource> randomPoints;\n  randomPoints->SetCenter(0.0, 0.0, 0.0);\n  randomPoints->SetNumberOfPoints(10000);\n  randomPoints->SetDistributionToUniform();\n  randomPoints->SetRadius(xMax);\n\n  // Probe the cone dataset with random points.\n  vtkNew<vtkProbeFilter> randomProbe;\n  randomProbe->SetInputConnection(0, randomPoints->GetOutputPort());\n  randomProbe->SetInputConnection(1, thresholdCone->GetOutputPort());\n  randomProbe->Update();\n  randomProbe->GetOutput()->GetPointData()->SetActiveScalars(\n      \"vtkValidPointMask\");\n\n  vtkNew<vtkThresholdPoints> selectPoints;\n  selectPoints->SetInputConnection(randomProbe->GetOutputPort());\n  selectPoints->ThresholdByUpper(1.0);\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetRadius(0.025);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetSourceConnection(sphere->GetOutputPort());\n  glyph->SetInputConnection(selectPoints->GetOutputPort());\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(glyph->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RandomProbe\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/RandomProbe/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RandomProbe)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RandomProbe: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RandomProbe MACOSX_BUNDLE RandomProbe.cxx )\n  target_link_libraries(RandomProbe PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RandomProbe\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/RandomProbe/#download-and-build-randomprobe","title":"Download and Build RandomProbe","text":"

Click here to download RandomProbe and its CMakeLists.txt file. Once the tarball RandomProbe.tar has been downloaded and extracted,

cd RandomProbe/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RandomProbe\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/RenderLargeImage/","title":"RenderLargeImage","text":"

vtk-examples/Cxx/Visualization/RenderLargeImage

"},{"location":"Cxx/Visualization/RenderLargeImage/#description","title":"Description","text":"

This example renders a high resolution image. The image can be much larger than the window on the screen. It is useful if you need an image for a large poster, or you can down sample the image to produce a high quality anti-aliased image.

The example takes up to three arguments. The first, an input polydata, is required, as is the second, a .png file to hold the high res image. An optional third argument specifies the magnification of the high res image (default 4).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/RenderLargeImage/#code","title":"Code","text":"

RenderLargeImage.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderLargeImage.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input(.vtp) Output(.png) [Magnification]\" << std::endl;\n    std::cerr << \"e.g. Bunny.vtp Bunny.png 4\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  int magnification = 4;\n  if (argc == 4)\n  {\n    magnification = atoi(argv[3]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tan\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RenderLargeImage\");\n\n  renderer->AddActor(actor);\n\n  // Let the renderer compute good position and focal point.\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n\n  std::cout\n      << \"Interact with image to get desired view and then press 'e' or 'q'\"\n      << std::endl;\n\n  interactor->Start();\n\n  std::cout << \"Generating large image size: \"\n            << renderWindow->GetSize()[0] * magnification << \" by \"\n            << renderWindow->GetSize()[1] * magnification << std::endl;\n\n  vtkNew<vtkRenderLargeImage> renderLarge;\n  renderLarge->SetInput(renderer);\n  renderLarge->SetMagnification(magnification);\n\n  std::cout << \"Saving image in \" << argv[2] << std::endl;\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(argv[2]);\n  writer->SetInputConnection(renderLarge->GetOutputPort());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/RenderLargeImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RenderLargeImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersHybrid\n  IOImage\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RenderLargeImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RenderLargeImage MACOSX_BUNDLE RenderLargeImage.cxx )\n  target_link_libraries(RenderLargeImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RenderLargeImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/RenderLargeImage/#download-and-build-renderlargeimage","title":"Download and Build RenderLargeImage","text":"

Click here to download RenderLargeImage and its CMakeLists.txt file. Once the tarball RenderLargeImage.tar has been downloaded and extracted,

cd RenderLargeImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RenderLargeImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ReverseAccess/","title":"ReverseAccess","text":"

vtk-examples/Cxx/Visualization/ReverseAccess

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ReverseAccess/#code","title":"Code","text":"

ReverseAccess.cxx

//\n// This example demonstrates how to access the source object\n// (e.g. vtkSphereSource) from the actor reversely.\n//\n// Some standard vtk headers.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n// Additionally needed vtk header for this example.\n#include <vtkAlgorithmOutput.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Source\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetRadius(0.5);\n  // Mapper\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n  // Actor\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Renderer\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"ReverseAccess\");\n\n  // Add actor to the renderer.\n  ren1->AddActor(sphereActor);\n\n  //\n  // Now we retrieve the source object from vtkActor reversely,\n  // meaning we don't use the spheresource object we instantiated\n  // above directly,\n  // instead we retrieve a reference to the spheresource through the\n  // actor.\n  // An advantage of this concept might be that we don't need to\n  // maintain the source object anymore\n  // in a more complex application.\n  // To demonstrate that we can modify properties of the spheresource\n  // through this reference\n  // beside changing some properties of the actor (in this example we\n  // change actor's x-position),\n  // we change the radius of the spheresource as well.\n  //\n  // The next two lines are the core lines for reverse access.\n  //\n  vtkSmartPointer<vtkAlgorithm> algorithm =\n      sphereActor->GetMapper()->GetInputConnection(0, 0)->GetProducer();\n  auto srcReference = dynamic_cast<vtkSphereSource*>(algorithm.GetPointer());\n\n  float origRadius = srcReference->GetRadius();\n  for (int i = 0; i < 360; ++i)\n  {\n    // Change radius of the sphere source.\n    srcReference->SetRadius(origRadius *\n                            (1 + sin((float)i / 180.0 * vtkMath::Pi())));\n    // Change the x-position of the actor.\n    sphereActor->SetPosition(sin((float)i / 45.0 * vtkMath::Pi()) * 0.5, 0, 0);\n    renWin->Render();\n  }\n\n  //\n  // Thanks to the usage of vtkSmartPointer there is no explicit need\n  // to free any objects at this point.\n  //\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ReverseAccess/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReverseAccess)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonExecutionModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReverseAccess: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReverseAccess MACOSX_BUNDLE ReverseAccess.cxx )\n  target_link_libraries(ReverseAccess PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReverseAccess\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ReverseAccess/#download-and-build-reverseaccess","title":"Download and Build ReverseAccess","text":"

Click here to download ReverseAccess and its CMakeLists.txt file. Once the tarball ReverseAccess.tar has been downloaded and extracted,

cd ReverseAccess/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ReverseAccess\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/RotateActor/","title":"RotateActor","text":"

vtk-examples/Cxx/Visualization/RotateActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/RotateActor/#description","title":"Description","text":"

This example shows how to rotate an actor. It also shows how to get the current transformation of the actor so it can then be applied to the actual object if so desired.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/RotateActor/#code","title":"Code","text":"

RotateActor.cxx

#include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\n// Define interaction style.\nclass MyInteractorStyle : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static MyInteractorStyle* New();\n  vtkTypeMacro(MyInteractorStyle, vtkInteractorStyleTrackballActor);\n\n  virtual void OnLeftButtonDown()\n  {\n    std::cout << \"Pressed left mouse button.\" << std::endl;\n\n    vtkNew<vtkMatrix4x4> m;\n    this->Actor->GetMatrix(m);\n    std::cout << \"Matrix: \" << endl << *m << std::endl;\n\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnLeftButtonDown();\n  }\n\n  virtual void OnLeftButtonUp()\n  {\n    std::cout << \"Released left mouse button.\" << std::endl;\n\n    vtkNew<vtkMatrix4x4> m;\n    this->Actor->GetMatrix(m);\n    std::cout << \"Matrix: \" << endl << *m << std::endl;\n\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnLeftButtonUp();\n  }\n\n  void SetActor(vtkSmartPointer<vtkActor> actor)\n  {\n    this->Actor = actor;\n  }\n\nprivate:\n  vtkSmartPointer<vtkActor> Actor;\n};\nvtkStandardNewMacro(MyInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cone.\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->RotateY(45);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RotateActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<MyInteractorStyle> style;\n  style->SetActor(actor);\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/RotateActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotateActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonMath\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotateActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotateActor MACOSX_BUNDLE RotateActor.cxx )\n  target_link_libraries(RotateActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotateActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/RotateActor/#download-and-build-rotateactor","title":"Download and Build RotateActor","text":"

Click here to download RotateActor and its CMakeLists.txt file. Once the tarball RotateActor.tar has been downloaded and extracted,

cd RotateActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RotateActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ScalarBarActor/","title":"ScalarBarActor","text":"

vtk-examples/Cxx/Visualization/ScalarBarActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ScalarBarActor/#description","title":"Description","text":"

This example demonstrates how to make a color bar to that reflects the range of values associated with a data set.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ScalarBarActor/#code","title":"Code","text":"

ScalarBarActor.cxx

#include <vtkActor.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere for some geometry.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetCenter(0, 0, 0);\n  sphere->SetRadius(1);\n  sphere->Update();\n\n  // Create scalar data to associate with the vertices of the sphere.\n  int numPts = sphere->GetOutput()->GetPoints()->GetNumberOfPoints();\n  vtkNew<vtkFloatArray> scalars;\n  scalars->SetNumberOfValues(numPts);\n  for (int i = 0; i < numPts; ++i)\n  {\n    scalars->SetValue(i, static_cast<float>(i) / numPts);\n  }\n  vtkNew<vtkPolyData> poly;\n  poly->DeepCopy(sphere->GetOutput());\n  poly->GetPointData()->SetScalars(scalars);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(poly);\n  mapper->ScalarVisibilityOn();\n  mapper->SetScalarModeToUsePointData();\n  mapper->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(mapper->GetLookupTable());\n  scalarBar->SetTitle(\"Title\");\n  scalarBar->SetNumberOfLabels(4);\n\n  // Create a lookup table to share between the mapper and the scalarbar.\n  vtkNew<vtkLookupTable> hueLut;\n  hueLut->SetTableRange(0, 1);\n  hueLut->SetHueRange(0, 1);\n  hueLut->SetSaturationRange(1, 1);\n  hueLut->SetValueRange(1, 1);\n  hueLut->Build();\n\n  mapper->SetLookupTable(hueLut);\n  scalarBar->SetLookupTable(hueLut);\n\n  // Create a renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"Indigo\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"LightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ScalarBarActor\");\n\n  // Create an interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor2D(scalarBar);\n\n  // Render the scene (lights and cameras are created automatically).\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ScalarBarActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScalarBarActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScalarBarActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScalarBarActor MACOSX_BUNDLE ScalarBarActor.cxx )\n  target_link_libraries(ScalarBarActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScalarBarActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ScalarBarActor/#download-and-build-scalarbaractor","title":"Download and Build ScalarBarActor","text":"

Click here to download ScalarBarActor and its CMakeLists.txt file. Once the tarball ScalarBarActor.tar has been downloaded and extracted,

cd ScalarBarActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ScalarBarActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ScalarBarActorColorSeries/","title":"ScalarBarActorColorSeries","text":"

vtk-examples/Cxx/Visualization/ScalarBarActorColorSeries

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ScalarBarActorColorSeries/#code","title":"Code","text":"

ScalarBarActorColorSeries.cxx

#include <vtkActor.h>\n#include <vtkColorSeries.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere fora some geometry.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetCenter(0, 0, 0);\n  sphere->SetRadius(1);\n  sphere->SetPhiResolution(30);\n  sphere->SetThetaResolution(60);\n  sphere->Update();\n\n  // Create scalar data to associate with the vertices of the sphere.\n  int numPts = sphere->GetOutput()->GetPoints()->GetNumberOfPoints();\n  vtkNew<vtkFloatArray> scalars;\n  scalars->SetNumberOfValues(numPts);\n  for (int i = 0; i < numPts; ++i)\n  {\n    scalars->SetValue(i, static_cast<float>(i) / numPts);\n  }\n  vtkNew<vtkPolyData> poly;\n  poly->DeepCopy(sphere->GetOutput());\n  poly->GetPointData()->SetScalars(scalars);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(poly);\n  mapper->ScalarVisibilityOn();\n  mapper->SetScalarModeToUsePointData();\n  mapper->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(mapper->GetLookupTable());\n  scalarBar->SetTitle(\"Beachball\");\n  scalarBar->SetNumberOfLabels(4);\n\n  // Create a lookup table to share between the mapper and the scalarbar.\n  vtkNew<vtkLookupTable> seriesLut;\n\n  vtkNew<vtkColorSeries> series;\n  int seriesEnum = series->BREWER_QUALITATIVE_SET3;\n  series->SetColorScheme(seriesEnum);\n  series->BuildLookupTable(seriesLut, series->ORDINAL);\n\n  mapper->SetLookupTable(seriesLut);\n  scalarBar->SetLookupTable(seriesLut);\n\n  // Create a renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"NavajoWhite\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ScalarBarActorColorSeries\");\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor2D(scalarBar);\n\n  // Render the scene (lights and cameras are created automatically).\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ScalarBarActorColorSeries/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScalarBarActorColorSeries)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScalarBarActorColorSeries: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScalarBarActorColorSeries MACOSX_BUNDLE ScalarBarActorColorSeries.cxx )\n  target_link_libraries(ScalarBarActorColorSeries PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScalarBarActorColorSeries\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ScalarBarActorColorSeries/#download-and-build-scalarbaractorcolorseries","title":"Download and Build ScalarBarActorColorSeries","text":"

Click here to download ScalarBarActorColorSeries and its CMakeLists.txt file. Once the tarball ScalarBarActorColorSeries.tar has been downloaded and extracted,

cd ScalarBarActorColorSeries/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ScalarBarActorColorSeries\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ScalarVisibility/","title":"ScalarVisibility","text":"

vtk-examples/Cxx/Visualization/ScalarVisibility

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ScalarVisibility/#code","title":"Code","text":"

ScalarVisibility.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(pointSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  actor->GetProperty()->SetPointSize(2);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ScalarVisibility\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ScalarVisibility/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScalarVisibility)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScalarVisibility: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScalarVisibility MACOSX_BUNDLE ScalarVisibility.cxx )\n  target_link_libraries(ScalarVisibility PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScalarVisibility\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ScalarVisibility/#download-and-build-scalarvisibility","title":"Download and Build ScalarVisibility","text":"

Click here to download ScalarVisibility and its CMakeLists.txt file. Once the tarball ScalarVisibility.tar has been downloaded and extracted,

cd ScalarVisibility/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ScalarVisibility\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ScaleGlyphs/","title":"ScaleGlyphs","text":"

vtk-examples/Cxx/Visualization/ScaleGlyphs

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ScaleGlyphs/#code","title":"Code","text":"

ScaleGlyphs.cxx

#include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(5, 0, 0);\n  points->InsertNextPoint(10, 0, 0);\n\n  // Setup scales.\n  vtkNew<vtkFloatArray> scales;\n  scales->SetName(\"scales\");\n\n  scales->InsertNextValue(1.0);\n  scales->InsertNextValue(2.0);\n  scales->InsertNextValue(3.0);\n\n  // Combine into a polydata\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->SetScalars(scales);\n\n  // Create anything you want here, we will use a cube for the demo.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetScaleModeToScaleByScalar();\n  glyph3D->SetSourceConnection(cubeSource->GetOutputPort());\n  glyph3D->SetInputData(polydata);\n  glyph3D->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph3D->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ScaleGlyphs\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/ScaleGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScaleGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScaleGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScaleGlyphs MACOSX_BUNDLE ScaleGlyphs.cxx )\n  target_link_libraries(ScaleGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScaleGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ScaleGlyphs/#download-and-build-scaleglyphs","title":"Download and Build ScaleGlyphs","text":"

Click here to download ScaleGlyphs and its CMakeLists.txt file. Once the tarball ScaleGlyphs.tar has been downloaded and extracted,

cd ScaleGlyphs/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ScaleGlyphs\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/SceneBounds/","title":"SceneBounds","text":"

vtk-examples/Cxx/Visualization/SceneBounds

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/SceneBounds/#code","title":"Code","text":"

SceneBounds.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetCenter(5.0, 0.0, 0.0);\n  cubeSource->Update();\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"Thistle\").GetData());\n\n  // Visualization.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SceneBounds\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(cubeActor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  double bounds[6];\n  renderer->ComputeVisiblePropBounds(bounds);\n  std::cout << bounds[0] << \" \" << bounds[1] << \" \" << bounds[2] << \" \"\n            << bounds[3] << \" \" << bounds[4] << \" \" << bounds[5] << std::endl;\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/SceneBounds/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SceneBounds)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SceneBounds: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SceneBounds MACOSX_BUNDLE SceneBounds.cxx )\n  target_link_libraries(SceneBounds PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SceneBounds\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/SceneBounds/#download-and-build-scenebounds","title":"Download and Build SceneBounds","text":"

Click here to download SceneBounds and its CMakeLists.txt file. Once the tarball SceneBounds.tar has been downloaded and extracted,

cd SceneBounds/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SceneBounds\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/SelectWindowRegion/","title":"SelectWindowRegion","text":"

vtk-examples/Cxx/Visualization/SelectWindowRegion

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/SelectWindowRegion/#code","title":"Code","text":"

SelectWindowRegion.cxx

#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleRubberBand2D.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nvoid SelectionChangedCallbackFunction(vtkObject* caller,\n                                      long unsigned int eventId,\n                                      void* clientData, void* callData);\n}\n\nint main(int argc, char* argv[])\n{\n  // Parse input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: Filename e.g. Ox.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFilename = argv[1];\n\n  // Read the image.\n  vtkNew<vtkJPEGReader> jPEGReader;\n  jPEGReader->SetFileName(inputFilename.c_str());\n  jPEGReader->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(jPEGReader->GetOutputPort());\n\n  // Setup the SelectionChangedEvent callback.\n  vtkNew<vtkCallbackCommand> selectionChangedCallback;\n  selectionChangedCallback->SetCallback(SelectionChangedCallbackFunction);\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SelectWindowRegion\");\n\n  // Setup 2D interaction style.\n  vtkNew<vtkInteractorStyleRubberBand2D> style;\n  style->AddObserver(vtkCommand::SelectionChangedEvent,\n                     selectionChangedCallback);\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid SelectionChangedCallbackFunction(vtkObject* vtkNotUsed(caller),\n                                      long unsigned int vtkNotUsed(eventId),\n                                      void* vtkNotUsed(clientData),\n                                      void* callData)\n{\n  std::cout << \"Selection changed callback\" << std::endl;\n\n  unsigned int* rect = reinterpret_cast<unsigned int*>(callData);\n  unsigned int pos1X = rect[0];\n  unsigned int pos1Y = rect[1];\n  unsigned int pos2X = rect[2];\n  unsigned int pos2Y = rect[3];\n\n  std::cout << \"Start x: \" << pos1X << \" Start y: \" << pos1Y\n            << \" End x: \" << pos2X << \" End y: \" << pos2Y << std::endl;\n}\n\n/*\n//You could override this, but then you have to reimplement the functionality.\n//Instead, you should use an observer\n\nvoid vtkInteractorStyleRubberBand2D::OnLeftButtonUp()\n{\n  std::cout << \"LeftButtonUp!\" << std::endl;\n\n  std::cout << \"Start: \" << this->StartPosition[0] << \" \" <<\nthis->StartPosition[1] << std::endl; std::cout << \"End: \" <<\nthis->EndPosition[0] << \" \" << this->EndPosition[1] << std::endl;\n\n  //this->Superclass.OnLeftButtonUp(); //doesn't work\n\n  InvokeEvent(vtkCommand::EndPickEvent);\n  InvokeEvent(vtkCommand::SelectionChangedEvent);\n\n}\n*/\n} // namespace\n
"},{"location":"Cxx/Visualization/SelectWindowRegion/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectWindowRegion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectWindowRegion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectWindowRegion MACOSX_BUNDLE SelectWindowRegion.cxx )\n  target_link_libraries(SelectWindowRegion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectWindowRegion\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/SelectWindowRegion/#download-and-build-selectwindowregion","title":"Download and Build SelectWindowRegion","text":"

Click here to download SelectWindowRegion and its CMakeLists.txt file. Once the tarball SelectWindowRegion.tar has been downloaded and extracted,

cd SelectWindowRegion/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SelectWindowRegion\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ShadowsLightsDemo/","title":"ShadowsLightsDemo","text":"

vtk-examples/Cxx/Visualization/ShadowsLightsDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ShadowsLightsDemo/#code","title":"Code","text":"

ShadowsLightsDemo.cxx

// The scene consists of:\n// 1) four actors: a rectangle, a box, a cone and a sphere.\n//    The box, the cone and the sphere are above the rectangle.\n// 2) Two spotlights, one in the direction of the box, another one in the\n//    direction of the sphere.\n//    Both lights are above the box, the cone and  the sphere.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCameraPass.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkLight.h>\n#include <vtkLightActor.h>\n#include <vtkLightCollection.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpaquePass.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSequencePass.h>\n#include <vtkShadowMapBakerPass.h>\n#include <vtkShadowMapPass.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// For each spotlight, add a light frustum wireframe representation and a cone\n// wireframe representation, colored with the light color.\nvoid AddLightActors(vtkRenderer* r);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(400, 400);\n  renderWindow->SetMultiSamples(0);\n\n  renderWindow->SetAlphaBitPlanes(1);\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkOpenGLRenderer> renderer;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkSequencePass> seq;\n\n  vtkNew<vtkRenderPassCollection> passes;\n\n  vtkNew<vtkShadowMapPass> shadows;\n  passes->AddItem(shadows->GetShadowMapBakerPass());\n  passes->AddItem(shadows);\n\n  vtkNew<vtkOpaquePass> opaque;\n  passes->AddItem(opaque);\n\n  seq->SetPasses(passes);\n\n  vtkNew<vtkCameraPass> cameraP;\n  cameraP->SetDelegatePass(seq);\n\n  // Tell the renderer to use our render pass pipeline.\n  vtkOpenGLRenderer* glrenderer =\n      dynamic_cast<vtkOpenGLRenderer*>(renderer.GetPointer());\n  glrenderer->SetPass(cameraP);\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d boxColor = colors->GetColor3d(\"Tomato\");\n  vtkColor3d rectangleColor = colors->GetColor3d(\"Beige\");\n  vtkColor3d coneColor = colors->GetColor3d(\"Peacock\");\n  vtkColor3d sphereColor = colors->GetColor3d(\"Banana\");\n\n  vtkNew<vtkPlaneSource> rectangleSource;\n  rectangleSource->SetOrigin(-5.0, 0.0, 5.0);\n  rectangleSource->SetPoint1(5.0, 0.0, 5.0);\n  rectangleSource->SetPoint2(-5.0, 0.0, -5.0);\n  rectangleSource->SetResolution(100, 100);\n\n  vtkNew<vtkPolyDataMapper> rectangleMapper;\n  rectangleMapper->SetInputConnection(rectangleSource->GetOutputPort());\n\n  rectangleMapper->SetScalarVisibility(0);\n\n  vtkNew<vtkActor> rectangleActor;\n  rectangleActor->SetMapper(rectangleMapper);\n  rectangleActor->SetVisibility(1);\n  rectangleActor->GetProperty()->SetColor(rectangleColor.GetData());\n\n  vtkNew<vtkCubeSource> boxSource;\n  boxSource->SetXLength(2.0);\n\n  vtkNew<vtkPolyDataNormals> boxNormals;\n  boxNormals->SetInputConnection(boxSource->GetOutputPort());\n  boxNormals->ComputePointNormalsOff();\n  boxNormals->ComputeCellNormalsOn();\n  boxNormals->Update();\n  boxNormals->GetOutput()->GetPointData()->SetNormals(nullptr);\n\n  vtkNew<vtkPolyDataMapper> boxMapper;\n  boxMapper->SetInputConnection(boxNormals->GetOutputPort());\n  boxMapper->SetScalarVisibility(0);\n\n  vtkNew<vtkActor> boxActor;\n  boxActor->SetMapper(boxMapper);\n  boxActor->SetVisibility(1);\n  boxActor->SetPosition(-2.0, 2.0, 0.0);\n  boxActor->GetProperty()->SetColor(boxColor.GetData());\n\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetResolution(24);\n  coneSource->SetDirection(1.0, 1.0, 1.0);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n  coneMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->VisibilityOn();\n  coneActor->SetPosition(0.0, 1.0, 1.0);\n  coneActor->GetProperty()->SetColor(coneColor.GetData());\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetThetaResolution(32);\n  sphereSource->SetPhiResolution(32);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  sphereMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n\n  sphereActor->VisibilityOn();\n  sphereActor->SetPosition(2.0, 2.0, -1.0);\n  sphereActor->GetProperty()->SetColor(sphereColor.GetData());\n\n  renderer->AddViewProp(rectangleActor);\n  renderer->AddViewProp(boxActor);\n  renderer->AddViewProp(coneActor);\n  renderer->AddViewProp(sphereActor);\n\n  // Spotlights.\n\n  // Lighting the box.\n  vtkNew<vtkLight> l1;\n  l1->SetPosition(-4.0, 4.0, -1.0);\n  l1->SetFocalPoint(boxActor->GetPosition());\n  l1->SetColor(colors->GetColor3d(\"White\").GetData());\n  l1->PositionalOn();\n  renderer->AddLight(l1);\n  l1->SwitchOn();\n\n  // Lighting the sphere.\n  vtkNew<vtkLight> l2;\n  l2->SetPosition(4.0, 5.0, 1.0);\n  l2->SetFocalPoint(sphereActor->GetPosition());\n  l2->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n  l2->PositionalOn();\n  renderer->AddLight(l2);\n  l2->SwitchOn();\n\n  AddLightActors(renderer);\n\n  renderer->SetBackground2(colors->GetColor3d(\"Black\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->SetGradientBackground(true);\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ShadowsLightsDemo\");\n\n  renderer->ResetCamera();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->Azimuth(40.0);\n  camera->Elevation(10.0);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// For each spotlight, add a light frustum wireframe representation and a cone\n// wireframe representation, colored with the light color.\nvoid AddLightActors(vtkRenderer* r)\n{\n  vtkLightCollection* lights = r->GetLights();\n  lights->InitTraversal();\n\n  vtkLight* light = lights->GetNextItem();\n  while (light != 0)\n  {\n    double angle = light->GetConeAngle();\n    if (light->LightTypeIsSceneLight() && light->GetPositional() &&\n        angle < 180.0) // spotlight\n    {\n      vtkNew<vtkLightActor> light_actor;\n      light_actor->SetLight(light);\n      r->AddViewProp(light_actor);\n    }\n    light = lights->GetNextItem();\n  }\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/ShadowsLightsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShadowsLightsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShadowsLightsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShadowsLightsDemo MACOSX_BUNDLE ShadowsLightsDemo.cxx )\n  target_link_libraries(ShadowsLightsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShadowsLightsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ShadowsLightsDemo/#download-and-build-shadowslightsdemo","title":"Download and Build ShadowsLightsDemo","text":"

Click here to download ShadowsLightsDemo and its CMakeLists.txt file. Once the tarball ShadowsLightsDemo.tar has been downloaded and extracted,

cd ShadowsLightsDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ShadowsLightsDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/ShepardInterpolation/","title":"ShepardInterpolation","text":"

vtk-examples/Cxx/Visualization/ShepardInterpolation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/ShepardInterpolation/#description","title":"Description","text":"

Use vtkShepardMethod to interpolate the scalars of a vtkPolyData. The zero-contour of the original and interpoltated scalars are extracted with vtkContourFilter. The original data is shown in red and the interpolated data in shown in yellow.

Usage:

ShepardInterpolation polydata [resolution]\n

where: - polydata is a polydata file with scalar data. - resolution is the sampling resoluton, default 100.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/ShepardInterpolation/#code","title":"Code","text":"

ShepardInterpolation.cxx

#include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkShepardMethod.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Parse input arguments.\n  if (argc < 3)\n  {\n    std::cout\n        << \"Required parameters: Filename  resolution e.g. cowHead.vtp 100\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  unsigned int resolution = 100;\n  if (argc >= 3)\n  {\n    resolution = std::atoi(argv[2]);\n  }\n  vtkNew<vtkShepardMethod> interpolator;\n  interpolator->SetInputData(polyData);\n  interpolator->SetModelBounds(polyData->GetBounds());\n  interpolator->SetSampleDimensions(resolution, resolution, resolution);\n  interpolator->SetNullValue(-10000);\n  interpolator->Update();\n  std::cout << \"Scalar Range: \"\n            << interpolator->GetOutput()->GetScalarRange()[0] << \", \"\n            << interpolator->GetOutput()->GetScalarRange()[1] << std::endl;\n\n  vtkNew<vtkProbeFilter> probe;\n  probe->SetInputData(0, polyData);\n  probe->SetInputConnection(1, interpolator->GetOutputPort());\n\n  vtkNew<vtkContourFilter> interpolatedContour;\n  interpolatedContour->SetInputConnection(probe->GetOutputPort());\n  interpolatedContour->SetValue(0, 0.0);\n\n  vtkNew<vtkContourFilter> originalContour;\n  originalContour->SetInputData(polyData);\n  originalContour->SetValue(0, 0.0);\n\n  vtkNew<vtkPolyDataMapper> interpolatedMapper;\n  interpolatedMapper->SetInputConnection(interpolatedContour->GetOutputPort());\n  interpolatedMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> interpolatedActor;\n  interpolatedActor->SetMapper(interpolatedMapper);\n  interpolatedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  interpolatedActor->GetProperty()->SetLineWidth(4.0);\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(originalContour->GetOutputPort());\n  originalMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  originalActor->GetProperty()->SetLineWidth(4.0);\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ShepardInterpolation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(interpolatedActor);\n  renderer->AddActor(originalActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/ShepardInterpolation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShepardInterpolation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShepardInterpolation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShepardInterpolation MACOSX_BUNDLE ShepardInterpolation.cxx )\n  target_link_libraries(ShepardInterpolation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShepardInterpolation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/ShepardInterpolation/#download-and-build-shepardinterpolation","title":"Download and Build ShepardInterpolation","text":"

Click here to download ShepardInterpolation and its CMakeLists.txt file. Once the tarball ShepardInterpolation.tar has been downloaded and extracted,

cd ShepardInterpolation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ShepardInterpolation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/SideBySideViewports/","title":"SideBySideViewports","text":"

vtk-examples/Cxx/Visualization/SideBySideViewports

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/SideBySideViewports/#description","title":"Description","text":"

This example splits the window into a left and right side. A sphere is drawn on the left and a cube is drawn on the right.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/SideBySideViewports/#code","title":"Code","text":"

SideBySideViewports.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVertexGlyphFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Setup a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MediumSeaGreen\").GetData());\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"SideBySideViewports\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  // Add the sphere to the left and the cube to the right.\n  leftRenderer->AddActor(sphereActor);\n  rightRenderer->AddActor(cubeActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->ResetCamera();\n  rightRenderer->GetActiveCamera()->Azimuth(30);\n  rightRenderer->GetActiveCamera()->Elevation(30);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/SideBySideViewports/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SideBySideViewports)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SideBySideViewports: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SideBySideViewports MACOSX_BUNDLE SideBySideViewports.cxx )\n  target_link_libraries(SideBySideViewports PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SideBySideViewports\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/SideBySideViewports/#download-and-build-sidebysideviewports","title":"Download and Build SideBySideViewports","text":"

Click here to download SideBySideViewports and its CMakeLists.txt file. Once the tarball SideBySideViewports.tar has been downloaded and extracted,

cd SideBySideViewports/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SideBySideViewports\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/StreamLines/","title":"StreamLines","text":"

vtk-examples/Cxx/Visualization/StreamLines

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/StreamLines/#code","title":"Code","text":"

StreamLines.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Required arguments: xyzFile qFile e.g. combxyz.bin combq.bin\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  std::string xyzFile = argv[1]; // \"combxyz.bin\";\n  std::string qFile = argv[2];   // \"combq.bin\";\n\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(xyzFile.c_str());\n  pl3d->SetQFileName(qFile.c_str());\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  // Source of the streamlines\n  vtkNew<vtkPlaneSource> seeds;\n  seeds->SetXResolution(4);\n  seeds->SetYResolution(4);\n  seeds->SetOrigin(2, -2, 26);\n  seeds->SetPoint1(2, 2, 26);\n  seeds->SetPoint2(2, -2, 32);\n\n  // Streamline itself\n  vtkNew<vtkStreamTracer> streamLine;\n  pl3d->Update();\n  streamLine->SetInputData(pl3d->GetOutput()->GetBlock(0));\n  streamLine->SetSourceConnection(seeds->GetOutputPort());\n  streamLine->SetMaximumPropagation(100);\n  streamLine->SetInitialIntegrationStep(0.1);\n  streamLine->SetIntegrationDirectionToBoth();\n\n  // streamLine->SetStartPosition(2,-2,30);\n  // as alternative to the SetSource(), which can handle multiple\n  // streamlines, you can set a SINGLE streamline from\n  // SetStartPosition()\n\n  vtkNew<vtkPolyDataMapper> streamLineMapper;\n  streamLineMapper->SetInputConnection(streamLine->GetOutputPort());\n\n  vtkNew<vtkActor> streamLineActor;\n  streamLineActor->SetMapper(streamLineMapper);\n  streamLineActor->VisibilityOn();\n\n  // Outline-Filter for the grid\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"White\").GetData());\n\n  // Create the RenderWindow, Renderer and Actors\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"StreamLines\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  renderer->AddActor(streamLineActor);\n  renderer->AddActor(outlineActor);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->SetBackground(namedColors->GetColor3d(\"MidnightBlue\").GetData());\n  renderWindow->SetSize(300, 300);\n  interactor->Initialize();\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(-32.8, -12.3, 46.3);\n  renderer->GetActiveCamera()->SetFocalPoint(8.3, 0.03, 29.8);\n  renderer->GetActiveCamera()->SetViewUp(0.2, 0.5, 0.9);\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/StreamLines/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StreamLines)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StreamLines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StreamLines MACOSX_BUNDLE StreamLines.cxx )\n  target_link_libraries(StreamLines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StreamLines\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/StreamLines/#download-and-build-streamlines","title":"Download and Build StreamLines","text":"

Click here to download StreamLines and its CMakeLists.txt file. Once the tarball StreamLines.tar has been downloaded and extracted,

cd StreamLines/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StreamLines\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/StructuredDataTypes/","title":"StructuredDataTypes","text":"

vtk-examples/Cxx/Visualization/StructuredDataTypes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/StructuredDataTypes/#code","title":"Code","text":"

StructuredDataTypes.cxx

#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkTransform.h>\n#include <vtkXMLImageDataWriter.h>\n#include <vtkXMLRectilinearGridWriter.h>\n#include <vtkXMLStructuredGridWriter.h>\n\nnamespace {\nvoid ImageData(vtkImageData* data, const int gridSize);\nvoid RectilinearGrid(vtkRectilinearGrid* data, const int gridSize);\nvoid StructuredGrid(vtkStructuredGrid* data, const int gridSize);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int gridSize = 5;\n  vtkNew<vtkImageData> imageData;\n  ImageData(imageData, gridSize);\n  vtkNew<vtkDataSetMapper> imageDataMapper;\n  imageDataMapper->SetInputData(imageData);\n  imageDataMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> imageDataActor;\n  imageDataActor->GetProperty()->SetRepresentationToWireframe();\n  imageDataActor->SetMapper(imageDataMapper);\n  imageDataActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRectilinearGrid> rectilinearGrid;\n  RectilinearGrid(rectilinearGrid, gridSize);\n  vtkNew<vtkDataSetMapper> rectilinearGridMapper;\n  rectilinearGridMapper->SetInputData(rectilinearGrid);\n\n  vtkNew<vtkActor> rectilinearGridActor;\n  rectilinearGridActor->GetProperty()->SetRepresentationToWireframe();\n  rectilinearGridActor->SetMapper(rectilinearGridMapper);\n  rectilinearGridActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkStructuredGrid> structuredGrid;\n  StructuredGrid(structuredGrid, gridSize);\n  vtkNew<vtkDataSetMapper> structuredGridMapper;\n  structuredGridMapper->SetInputData(structuredGrid);\n\n  vtkNew<vtkActor> structuredGridActor;\n  structuredGridActor->GetProperty()->SetRepresentationToWireframe();\n  structuredGridActor->SetMapper(structuredGridMapper);\n  structuredGridActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"StructuredDataTypes\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup three renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"Plum\").GetData());\n\n  // Add the image on the left, rectilinear in the center, structured on the\n  // right\n  leftRenderer->AddActor(imageDataActor);\n  centerRenderer->AddActor(rectilinearGridActor);\n  rightRenderer->AddActor(structuredGridActor);\n\n  leftRenderer->ResetCamera();\n  centerRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n  // rightRenderer->GetActiveCamera()->Azimuth(30);\n  // rightRenderer->GetActiveCamera()->Elevation(30);\n\n  renderWindow->Render();\n  interactor->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid ImageData(vtkImageData* data, const int gridSize)\n{\n\n  data->SetExtent(0, gridSize - 1, 0, gridSize - 1, 0, gridSize - 1);\n  data->AllocateScalars(VTK_DOUBLE, 1);\n\n  vtkNew<vtkXMLImageDataWriter> writer;\n  writer->SetFileName(\"imagedata.vti\");\n  writer->SetInputData(data);\n  writer->Write();\n}\n\nvoid RectilinearGrid(vtkRectilinearGrid* data, const int gridSize)\n{\n\n  data->SetExtent(0, gridSize - 1, 0, gridSize - 1, 0, gridSize - 1);\n\n  vtkNew<vtkDoubleArray> xCoords;\n  xCoords->SetNumberOfComponents(1);\n  vtkNew<vtkDoubleArray> yCoords;\n  yCoords->SetNumberOfComponents(1);\n  vtkNew<vtkDoubleArray> zCoords;\n  zCoords->SetNumberOfComponents(1);\n\n  for (int i = 0; i < gridSize; i++)\n  {\n    if (i == 0)\n    {\n      xCoords->InsertNextValue(0);\n      yCoords->InsertNextValue(0);\n      zCoords->InsertNextValue(0);\n      continue;\n    }\n    double oldX = xCoords->GetValue(i - 1);\n    double oldY = xCoords->GetValue(i - 1);\n    double oldZ = xCoords->GetValue(i - 1);\n    xCoords->InsertNextValue(oldX + i * i);\n    yCoords->InsertNextValue(oldY + i * i);\n    zCoords->InsertNextValue(oldZ + i * i);\n  }\n\n  data->SetXCoordinates(xCoords);\n  data->SetYCoordinates(yCoords);\n  data->SetZCoordinates(zCoords);\n\n  vtkNew<vtkXMLRectilinearGridWriter> writer;\n  writer->SetFileName(\"rectilineargrid.vtr\");\n  writer->SetInputData(data);\n  writer->Write();\n}\n\nvoid StructuredGrid(vtkStructuredGrid* data, const int gridSize)\n{\n  data->SetExtent(0, gridSize - 1, 0, gridSize - 1, 0, gridSize - 1);\n  vtkNew<vtkPoints> points;\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateZ(30);\n\n  for (int k = 0; k < gridSize; k++)\n  {\n    for (int j = 0; j < gridSize; j++)\n    {\n      for (int i = 0; i < gridSize; i++)\n      {\n        double p[4];\n        p[0] = i;\n        p[1] = j;\n        p[2] = k;\n        p[3] = 1;\n        double pout[4];\n        transform->MultiplyPoint(p, pout);\n\n        points->InsertNextPoint(pout[0], pout[1], pout[2]);\n      }\n    }\n  }\n\n  data->SetPoints(points);\n\n  vtkNew<vtkXMLStructuredGridWriter> writer;\n  writer->SetFileName(\"structuredgrid.vts\");\n  writer->SetInputData(data);\n  writer->Write();\n}\n} // namespace\n
"},{"location":"Cxx/Visualization/StructuredDataTypes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredDataTypes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredDataTypes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredDataTypes MACOSX_BUNDLE StructuredDataTypes.cxx )\n  target_link_libraries(StructuredDataTypes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredDataTypes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/StructuredDataTypes/#download-and-build-structureddatatypes","title":"Download and Build StructuredDataTypes","text":"

Click here to download StructuredDataTypes and its CMakeLists.txt file. Once the tarball StructuredDataTypes.tar has been downloaded and extracted,

cd StructuredDataTypes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StructuredDataTypes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/TensorGlyph/","title":"TensorGlyph","text":"

vtk-examples/Cxx/Visualization/TensorGlyph

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/TensorGlyph/#description","title":"Description","text":"

This example demonstrates how to apply a rotation+scaling matrix to each point in a data set. We use a cube as the glyph so that simple rotations are easy to interpret. Specifically, we glyph one point with no rotation/scaling, and a second point with a rotation of 45 degrees around the x axis.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/TensorGlyph/#code","title":"Code","text":"

TensorGlyph.cxx

#include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTensorGlyph.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(5.0, 0.0, 0.0);\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n\n  vtkNew<vtkDoubleArray> tensors;\n  tensors->SetNumberOfTuples(2);\n  tensors->SetNumberOfComponents(9);\n\n  tensors->InsertTuple9(0, 1, 0, 0, 0, 1, 0, 0, 0, 1);\n  tensors->InsertTuple9(1, 1, 0, 0, 0, 0.7, 0.7, 0, -0.7, 0.7); // column major\n\n  polyData->GetPointData()->SetTensors(tensors);\n\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  vtkNew<vtkTensorGlyph> tensorGlyph;\n  tensorGlyph->SetInputData(polyData);\n  tensorGlyph->SetSourceConnection(cubeSource->GetOutputPort());\n  tensorGlyph->ColorGlyphsOff();\n  tensorGlyph->ThreeGlyphsOff();\n  tensorGlyph->ExtractEigenvaluesOff();\n  tensorGlyph->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(tensorGlyph->GetOutput());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"LightSalmon\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TensorGlyph\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/TensorGlyph/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TensorGlyph)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TensorGlyph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TensorGlyph MACOSX_BUNDLE TensorGlyph.cxx )\n  target_link_libraries(TensorGlyph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TensorGlyph\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/TensorGlyph/#download-and-build-tensorglyph","title":"Download and Build TensorGlyph","text":"

Click here to download TensorGlyph and its CMakeLists.txt file. Once the tarball TensorGlyph.tar has been downloaded and extracted,

cd TensorGlyph/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TensorGlyph\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/TextSource/","title":"TextSource","text":"

vtk-examples/Cxx/Visualization/TextSource

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/TextSource/#description","title":"Description","text":"

This example displays a 3D polygonal text saying \"Hello\", using the 9x15 font from X Windows. That is a raster (pixelized) font, so characters are formed by converting the pixels on each character into quadrilaterals. vtkVectorText generates higher quality polygonal representations of text, so it is recommended instead -- see VectorText for an example of this.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/TextSource/#code","title":"Code","text":"

TextSource.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create text\n  vtkNew<vtkTextSource> textSource;\n  textSource->SetText(\"Hello\");\n  textSource->SetForegroundColor(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  textSource->SetBackgroundColor(colors->GetColor3d(\"NavajoWhite\").GetData());\n  // Turn off if you don't want the background drawn with the text.\n  textSource->BackingOn();\n  textSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(textSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TextSource\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Bisque\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/TextSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextSource MACOSX_BUNDLE TextSource.cxx )\n  target_link_libraries(TextSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextSource\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/TextSource/#download-and-build-textsource","title":"Download and Build TextSource","text":"

Click here to download TextSource and its CMakeLists.txt file. Once the tarball TextSource.tar has been downloaded and extracted,

cd TextSource/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TextSource\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/TextureMapImageData/","title":"TextureMapImageData","text":"

vtk-examples/Cxx/Visualization/TextureMapImageData

"},{"location":"Cxx/Visualization/TextureMapImageData/#description","title":"Description","text":"

This example creates an image and texture maps it onto a plane.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/TextureMapImageData/#code","title":"Code","text":"

TextureMapImageData.cxx

#include <vtkImageCanvasSource2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"ForestGreen\").GetData();\n  auto color2 = colors->GetColor3ub(\"DarkMagenta\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create an image\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 20, 0, 20, 0, 0);\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(0, 20, 0, 20);\n  imageSource->SetDrawColor(drawColor2.data());\n  imageSource->DrawSegment(0, 0, 19, 19);\n  imageSource->DrawSegment(19, 0, 0, 19);\n  imageSource->Update();\n\n  // Create a plane\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetCenter(0.0, 0.0, 0.0);\n  plane->SetNormal(0.0, 0.0, 1.0);\n\n  // Apply the texture\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(plane->GetOutputPort());\n\n  vtkNew<vtkActor> texturedPlane;\n  texturedPlane->SetMapper(planeMapper);\n  texturedPlane->SetTexture(texture);\n\n  // Visualize the textured plane\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(texturedPlane);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TextureMapImageData\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/TextureMapImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureMapImageData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureMapImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureMapImageData MACOSX_BUNDLE TextureMapImageData.cxx )\n  target_link_libraries(TextureMapImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureMapImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/TextureMapImageData/#download-and-build-texturemapimagedata","title":"Download and Build TextureMapImageData","text":"

Click here to download TextureMapImageData and its CMakeLists.txt file. Once the tarball TextureMapImageData.tar has been downloaded and extracted,

cd TextureMapImageData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TextureMapImageData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/TextureMapPlane/","title":"TextureMapPlane","text":"

vtk-examples/Cxx/Visualization/TextureMapPlane

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/TextureMapPlane/#description","title":"Description","text":"

This example reads a jpg image file and uses it to texture map a plane.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/TextureMapPlane/#code","title":"Code","text":"

TextureMapPlane.cxx

#include <vtkImageData.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n#include <vtkTextureMapToPlane.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename e.g. Yinyang.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFilename = argv[1];\n\n  // Read the image which will be the texture\n  vtkNew<vtkJPEGReader> jPEGReader;\n  jPEGReader->SetFileName(inputFilename.c_str());\n\n  // Create a plane\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetCenter(0.0, 0.0, 0.0);\n  plane->SetNormal(0.0, 0.0, 1.0);\n\n  // Apply the texture\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(jPEGReader->GetOutputPort());\n\n  vtkNew<vtkTextureMapToPlane> texturePlane;\n  texturePlane->SetInputConnection(plane->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(texturePlane->GetOutputPort());\n\n  vtkNew<vtkActor> texturedPlane;\n  texturedPlane->SetMapper(planeMapper);\n  texturedPlane->SetTexture(texture);\n  texturedPlane->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize the textured plane\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(texturedPlane);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TextureMapPlane\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/TextureMapPlane/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureMapPlane)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  FiltersTexture\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureMapPlane: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureMapPlane MACOSX_BUNDLE TextureMapPlane.cxx )\n  target_link_libraries(TextureMapPlane PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureMapPlane\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/TextureMapPlane/#download-and-build-texturemapplane","title":"Download and Build TextureMapPlane","text":"

Click here to download TextureMapPlane and its CMakeLists.txt file. Once the tarball TextureMapPlane.tar has been downloaded and extracted,

cd TextureMapPlane/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TextureMapPlane\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/TextureMapQuad/","title":"TextureMapQuad","text":"

vtk-examples/Cxx/Visualization/TextureMapQuad

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/TextureMapQuad/#description","title":"Description","text":"

This example defines 4 points (coplanar) and textures them using the input image.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/TextureMapQuad/#code","title":"Code","text":"

TextureMapQuad.cxx

#include <string>\n#include <vtkCellArray.h>\n#include <vtkFloatArray.h>\n#include <vtkImageData.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolygon.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments\n  if (argc != 2)\n  {\n    std::cerr << \"Usage:\" << argv[0] << \" Filename e.g. Yinyang.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFilename = argv[1];\n\n  // Read the image which will be the texture\n  vtkNew<vtkJPEGReader> jPEGReader;\n  jPEGReader->SetFileName(inputFilename.c_str());\n\n  // Create a plane\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 2.0, 0.0);\n\n  vtkNew<vtkCellArray> polygons;\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPointIds()->SetNumberOfIds(4); // make a quad\n  polygon->GetPointIds()->SetId(0, 0);\n  polygon->GetPointIds()->SetId(1, 1);\n  polygon->GetPointIds()->SetId(2, 2);\n  polygon->GetPointIds()->SetId(3, 3);\n\n  polygons->InsertNextCell(polygon);\n\n  vtkNew<vtkPolyData> quad;\n  quad->SetPoints(points);\n  quad->SetPolys(polygons);\n\n  vtkNew<vtkFloatArray> textureCoordinates;\n  textureCoordinates->SetNumberOfComponents(2);\n  textureCoordinates->SetName(\"TextureCoordinates\");\n\n  float tuple[2] = {0.0, 0.0};\n  textureCoordinates->InsertNextTuple(tuple);\n  tuple[0] = 1.0;\n  tuple[1] = 0.0;\n  textureCoordinates->InsertNextTuple(tuple);\n  tuple[0] = 1.0;\n  tuple[1] = 1.0;\n  textureCoordinates->InsertNextTuple(tuple);\n  tuple[0] = 0.0;\n  tuple[1] = 2.0;\n  textureCoordinates->InsertNextTuple(tuple);\n\n  quad->GetPointData()->SetTCoords(textureCoordinates);\n\n  // Apply the texture\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(jPEGReader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(quad);\n\n  vtkNew<vtkActor> texturedQuad;\n  texturedQuad->SetMapper(mapper);\n  texturedQuad->SetTexture(texture);\n  texturedQuad->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize the textured plane\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(texturedQuad);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TextureMapQuad\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/TextureMapQuad/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureMapQuad)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureMapQuad: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureMapQuad MACOSX_BUNDLE TextureMapQuad.cxx )\n  target_link_libraries(TextureMapQuad PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureMapQuad\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/TextureMapQuad/#download-and-build-texturemapquad","title":"Download and Build TextureMapQuad","text":"

Click here to download TextureMapQuad and its CMakeLists.txt file. Once the tarball TextureMapQuad.tar has been downloaded and extracted,

cd TextureMapQuad/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TextureMapQuad\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/TransformActor/","title":"TransformActor","text":"

vtk-examples/Cxx/Visualization/TransformActor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/TransformActor/#description","title":"Description","text":"

This examples demonstrates how to transform an actor. This is different than using vtkTransformPolyDataFilter in that it doesn't actually transform the data (you can't access the transformed coordinates) - it is all done on the video card.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/TransformActor/#code","title":"Code","text":"

TransformActor.cxx

#include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource1;\n  coneSource1->Update();\n\n  vtkNew<vtkConeSource> coneSource2;\n  coneSource2->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(coneSource1->GetOutputPort());\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a second, transformed cone\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(coneSource2->GetOutputPort());\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  vtkNew<vtkTransform> transform;\n  transform->PostMultiply(); // this is the key line\n  transform->RotateZ(90.0);\n\n  actor2->SetUserTransform(transform);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TransformActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/TransformActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformActor MACOSX_BUNDLE TransformActor.cxx )\n  target_link_libraries(TransformActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformActor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/TransformActor/#download-and-build-transformactor","title":"Download and Build TransformActor","text":"

Click here to download TransformActor and its CMakeLists.txt file. Once the tarball TransformActor.tar has been downloaded and extracted,

cd TransformActor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TransformActor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/TransformActorCollection/","title":"TransformActorCollection","text":"

vtk-examples/Cxx/Visualization/TransformActorCollection

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/TransformActorCollection/#code","title":"Code","text":"

TransformActorCollection.cxx

#include <vtkActor.h>\n#include <vtkActorCollection.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  // Create a cone.\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetHeight(3);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Lavender\").GetData());\n\n  renderer->AddActor(sphereActor);\n\n  vtkNew<vtkActorCollection> actorCollection;\n  actorCollection->AddItem(cubeActor);\n  actorCollection->AddItem(coneActor);\n  actorCollection->InitTraversal();\n\n  vtkNew<vtkTransform> transform;\n  transform->PostMultiply(); // This is the key line.\n  transform->Translate(5.0, 0, 0);\n\n  // actorCollection->SetUserTransform(transform);\n\n  for (vtkIdType i = 0; i < actorCollection->GetNumberOfItems(); i++)\n  {\n    vtkActor* actor = actorCollection->GetNextActor();\n    actor->SetUserTransform(transform);\n    renderer->AddActor(actor);\n  }\n\n  // Create a renderer, render window, and interactor.\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TransformActorCollection\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/TransformActorCollection/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformActorCollection)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformActorCollection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformActorCollection MACOSX_BUNDLE TransformActorCollection.cxx )\n  target_link_libraries(TransformActorCollection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformActorCollection\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/TransformActorCollection/#download-and-build-transformactorcollection","title":"Download and Build TransformActorCollection","text":"

Click here to download TransformActorCollection and its CMakeLists.txt file. Once the tarball TransformActorCollection.tar has been downloaded and extracted,

cd TransformActorCollection/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TransformActorCollection\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/VectorField/","title":"VectorField","text":"

vtk-examples/Cxx/Visualization/VectorField

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/VectorField/#code","title":"Code","text":"

VectorField.cxx

#include <vtkArrowSource.h>\n#include <vtkGlyph2D.h>\n#include <vtkImageData.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n// #include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageData> image;\n\n  // Specify the size of the image data.\n  image->SetDimensions(50, 50, 1);\n  image->AllocateScalars(VTK_FLOAT, 3);\n\n  int* dims = image->GetDimensions();\n\n  // Zero the image.\n  for (auto z = 0; z < dims[2]; ++z)\n  {\n    for (auto y = 0; y < dims[1]; ++y)\n    {\n      for (auto x = 0; x < dims[0]; ++x)\n      {\n        auto pixel = static_cast<float*>(image->GetScalarPointer(x, y, z));\n        pixel[0] = 0.0;\n        pixel[1] = 0.0;\n        pixel[2] = 0.0;\n      }\n    }\n  }\n\n  // Set two vectors.\n  {\n    auto pixel = static_cast<float*>(image->GetScalarPointer(20, 20, 0));\n    pixel[0] = -10.0;\n    pixel[1] = 5.0;\n  }\n\n  {\n    auto pixel = static_cast<float*>(image->GetScalarPointer(30, 30, 0));\n    pixel[0] = 10.0;\n    pixel[1] = 10.0;\n  }\n\n  // A better way to do this is (should be tested for compatibility and\n  // correctness).\n  // std::cout << image->GetPointData()->GetScalars()->GetName() << std::endl;\n  image->GetPointData()->SetActiveVectors(\n      image->GetPointData()->GetScalars()->GetName());\n  // image->GetPointData()->SetActiveVectors(\"ImageScalars\");\n\n  // Setup the arrows\n  vtkNew<vtkArrowSource> arrowSource;\n  arrowSource->Update();\n\n  vtkNew<vtkGlyph2D> glyphFilter;\n  glyphFilter->SetSourceConnection(arrowSource->GetOutputPort());\n  glyphFilter->OrientOn();\n  glyphFilter->SetVectorModeToUseVector();\n  glyphFilter->SetInputData(image);\n  glyphFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageSliceMapper> imageMapper;\n  imageMapper->SetInputData(image);\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageMapper);\n\n  vtkNew<vtkPolyDataMapper> vectorMapper;\n  vectorMapper->SetInputConnection(glyphFilter->GetOutputPort());\n  vtkNew<vtkActor> vectorActor;\n  vectorActor->SetMapper(vectorMapper);\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->AddViewProp(vectorActor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VectorField\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  // vtkNew<vtkInteractorStyleImage> style;\n  // renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/VectorField/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorField)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorField: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorField MACOSX_BUNDLE VectorField.cxx )\n  target_link_libraries(VectorField PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorField\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/VectorField/#download-and-build-vectorfield","title":"Download and Build VectorField","text":"

Click here to download VectorField and its CMakeLists.txt file. Once the tarball VectorField.tar has been downloaded and extracted,

cd VectorField/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VectorField\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/VectorOfActors/","title":"VectorOfActors","text":"

vtk-examples/Cxx/Visualization/VectorOfActors

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/VectorOfActors/#description","title":"Description","text":"

This example creates multiple actors and stores them in a vector. The resulting image is 10 spheres in a line.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/VectorOfActors/#code","title":"Code","text":"

VectorOfActors.cxx

#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vector>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n\n  for (unsigned int i = 0; i < 10; i++)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetCenter(i, 0.0, 0.0);\n    sphereSource->SetRadius(0.2);\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n    actors.push_back(actor);\n  }\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VectorOfActors\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  for (unsigned int i = 0; i < actors.size(); i++)\n  {\n    renderer->AddActor(actors[i]);\n  }\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/VectorOfActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorOfActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorOfActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorOfActors MACOSX_BUNDLE VectorOfActors.cxx )\n  target_link_libraries(VectorOfActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorOfActors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/VectorOfActors/#download-and-build-vectorofactors","title":"Download and Build VectorOfActors","text":"

Click here to download VectorOfActors and its CMakeLists.txt file. Once the tarball VectorOfActors.tar has been downloaded and extracted,

cd VectorOfActors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VectorOfActors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/VectorText/","title":"VectorText","text":"

vtk-examples/Cxx/Visualization/VectorText

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/VectorText/#description","title":"Description","text":"

This example displays a red \"Hello\" in 3D space. For an example where the text always faces the camera, see Follower.

If you want to draw text in 2D rather than 3D, take a look at TextWidget or DrawText.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/VectorText/#code","title":"Code","text":"

VectorText.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorText.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create text.\n  vtkNew<vtkVectorText> textSource;\n  textSource->SetText(\"Hello\");\n  textSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(textSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VectorText\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Bisque\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/VectorText/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorText)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorText: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorText MACOSX_BUNDLE VectorText.cxx )\n  target_link_libraries(VectorText PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorText\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/VectorText/#download-and-build-vectortext","title":"Download and Build VectorText","text":"

Click here to download VectorText and its CMakeLists.txt file. Once the tarball VectorText.tar has been downloaded and extracted,

cd VectorText/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VectorText\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Visualize2DPoints/","title":"Visualize2DPoints","text":"

vtk-examples/Cxx/Visualization/Visualize2DPoints

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/Visualize2DPoints/#description","title":"Description","text":"

This example shows how to render a set of points. The example reads the points from a vtp file specified as the first command line argument. Ring is an example data set.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Visualize2DPoints/#code","title":"Code","text":"

Visualize2DPoints.cxx

#include <vtkActor2D.h>\n#include <vtkCellArray.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n// #include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: Filename e.g. Ring.vtp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n  vtkPolyData* polydata = reader->GetOutput();\n  // vtkPoints* Points = Polydata->GetPoints();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(polydata);\n  mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n\n  vtkProperty2D* property2D = actor->GetProperty();\n  property2D->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  property2D->SetPointSize(2.0);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Renderer and RenderWindow.\n  renderer->ResetCamera();\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Visualize2DPoints\");\n\n  renderWindow->SetSize(200, 200);\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Visualize2DPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Visualize2DPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Visualize2DPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Visualize2DPoints MACOSX_BUNDLE Visualize2DPoints.cxx )\n  target_link_libraries(Visualize2DPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Visualize2DPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Visualize2DPoints/#download-and-build-visualize2dpoints","title":"Download and Build Visualize2DPoints","text":"

Click here to download Visualize2DPoints and its CMakeLists.txt file. Once the tarball Visualize2DPoints.tar has been downloaded and extracted,

cd Visualize2DPoints/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Visualize2DPoints\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/VisualizeImageData/","title":"VisualizeImageData","text":"

vtk-examples/Cxx/Visualization/VisualizeImageData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/VisualizeImageData/#code","title":"Code","text":"

VisualizeImageData.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(3, 3, 2);\n  imageData->SetSpacing(1.0, 1.0, 1.0);\n  imageData->SetOrigin(0.0, 0.0, 0.0);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(imageData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderer> renderer;\n\n  // Add both renderers to the window\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VisualizeImageData\");\n\n  // Add a sphere to the left and a cube to the right\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/VisualizeImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeImageData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeImageData MACOSX_BUNDLE VisualizeImageData.cxx )\n  target_link_libraries(VisualizeImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/VisualizeImageData/#download-and-build-visualizeimagedata","title":"Download and Build VisualizeImageData","text":"

Click here to download VisualizeImageData and its CMakeLists.txt file. Once the tarball VisualizeImageData.tar has been downloaded and extracted,

cd VisualizeImageData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VisualizeImageData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/VisualizeVTP/","title":"VisualizeVTP","text":"

vtk-examples/Cxx/Visualization/VisualizeVTP

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/VisualizeVTP/#description","title":"Description","text":"

This example shows how to load a vtp file and render it in an interactive window. The example accepts a .vtp file on the command line.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/VisualizeVTP/#code","title":"Code","text":"

VisualizeVTP.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtp) e.g. Bummy.vtp\"\n              << std::endl;\n    return (EXIT_FAILURE);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Create a mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  // Create an actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tan\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VisualizeVTP\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->Render();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/VisualizeVTP/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeVTP)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeVTP: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeVTP MACOSX_BUNDLE VisualizeVTP.cxx )\n  target_link_libraries(VisualizeVTP PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeVTP\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/VisualizeVTP/#download-and-build-visualizevtp","title":"Download and Build VisualizeVTP","text":"

Click here to download VisualizeVTP and its CMakeLists.txt file. Once the tarball VisualizeVTP.tar has been downloaded and extracted,

cd VisualizeVTP/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VisualizeVTP\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/WindowSize/","title":"WindowSize","text":"

vtk-examples/Cxx/Visualization/WindowSize

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/WindowSize/#code","title":"Code","text":"

WindowSize.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(200, 100); //(width, height)\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WindowSize\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/WindowSize/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WindowSize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WindowSize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WindowSize MACOSX_BUNDLE WindowSize.cxx )\n  target_link_libraries(WindowSize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WindowSize\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/WindowSize/#download-and-build-windowsize","title":"Download and Build WindowSize","text":"

Click here to download WindowSize and its CMakeLists.txt file. Once the tarball WindowSize.tar has been downloaded and extracted,

cd WindowSize/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WindowSize\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/WindowTitle/","title":"WindowTitle","text":"

vtk-examples/Cxx/Visualization/WindowTitle

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Visualization/WindowTitle/#description","title":"Description","text":"

This example shows how to change the title of the window.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/WindowTitle/#code","title":"Code","text":"

WindowTitle.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"WindowTitle\"); // Set the title.\n\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/WindowTitle/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WindowTitle)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WindowTitle: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WindowTitle MACOSX_BUNDLE WindowTitle.cxx )\n  target_link_libraries(WindowTitle PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WindowTitle\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/WindowTitle/#download-and-build-windowtitle","title":"Download and Build WindowTitle","text":"

Click here to download WindowTitle and its CMakeLists.txt file. Once the tarball WindowTitle.tar has been downloaded and extracted,

cd WindowTitle/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WindowTitle\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Visualization/Wireframe/","title":"Wireframe","text":"

vtk-examples/Cxx/Visualization/Wireframe

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Visualization/Wireframe/#code","title":"Code","text":"

Wireframe.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(3, 3, 2);\n  imageData->SetSpacing(1.0, 1.0, 1.0);\n  imageData->SetOrigin(0.0, 0.0, 0.0);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(imageData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderer> renderer;\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Wireframe\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Navy\").GetData());\n\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Visualization/Wireframe/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Wireframe)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Wireframe: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Wireframe MACOSX_BUNDLE Wireframe.cxx )\n  target_link_libraries(Wireframe PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Wireframe\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Visualization/Wireframe/#download-and-build-wireframe","title":"Download and Build Wireframe","text":"

Click here to download Wireframe and its CMakeLists.txt file. Once the tarball Wireframe.tar has been downloaded and extracted,

cd Wireframe/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Wireframe\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/AnatomicalOrientation/","title":"AnatomicalOrientation","text":"

vtk-examples/Cxx/VisualizationAlgorithms/AnatomicalOrientation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/AnatomicalOrientation/#description","title":"Description","text":"

This depicts a human figure transected by the three commonly used anatomical planes:

  • Sagittal plane \u2013 is perpendicular to the ground divides the body into a left section and a right section.
  • Coronal plane \u2013 is perpendicular to the ground and divides the body into a front (anterior) section and back (posterior) section.
  • Transverse plane \u2013 or axial plane is parallel to the ground divides the body into an upper (superior) section and a bottom (inferior) section.

Four annotated cube actors are also provided demonstrating different coordinate systems. The annotations on the faces of the cube actors are:

  • Sagittal plane
    • L - left.
    • R - right.
  • Coronal plane
    • A - anterior.
    • P - posterior.
  • Transverse plane
    • S - superior.
    • I - inferior.

The annotated cube actors demonstrate the various coordinate systems: - The anatomical coordinate system forming a 3D basis is defined along the anatomical axes of anterior-posterior, inferior-superior, and left-right. These are the positive directions. In a Cartesian system this is RPS (Right, Posterior, Superior). The top-left annotated cube actor shows this basis, this is a left-handed system. - RAS (Right, Anterior, Superior), left-right, posterior-anterior, and inferior-superior. This is the usual right-handed system used by VTK and Slicer. The bottom left annotated cube actor shows this basis. - LPS (Left, Posterior, Superior), right-left, anterior-posterior, and inferior-superior. This is used in DICOM images and by the ITK toolkit. The bottom right annotated cube actor shows this basis. - The upper right cube actor has no axes and simply shows the planes.

RPS is a left-handed system whilst RAS and LPS are right-handed.

Note that the text for the planes is carefully placed to avoid obstructing the figure and it also sits slightly above the plane.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/AnatomicalOrientation/#code","title":"Code","text":"

AnatomicalOrientation.cxx

/*\n * The human data file is taken from:\n * https://github.com/Slicer/Slicer/blob/master/Base/Logic/Resources/OrientationMarkers/Human.vtp\n * Thanks to the Slicer people for providing this.\n *\n */\n\n#include <vtkAnnotatedCubeActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPropAssembly.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVectorText.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <algorithm>\n#include <array>\n#include <iomanip>\n#include <iostream>\n#include <vector>\n\nnamespace {\n\n/**\n * @param scale Sets the scale and direction of the axes.\n * @param xyzLabels Labels for the axes.\n * @return The axes actor.\n */\nvtkSmartPointer<vtkAxesActor>\nMakeAxesActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels);\n\n/**\n * @param colors Used to set the colors of the cube faces.\n * @return The annotated cube actor.\n */\nvtkSmartPointer<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(vtkNamedColors* colors);\n\n/**\n * @param scale Sets the scale and direction of the axes.\n * @param xyzLabels Labels for the axes.\n * @param colors Used to set the colors of the cube faces.\n * @return The combined axes and annotated cube prop.\n */\nvtkSmartPointer<vtkPropAssembly>\nMakeCubeActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels, vtkNamedColors* colors);\n\n/**\n * Make the traverse, coronal and saggital planes.\n *\n * @param colors Used to set the color of the planes.\n * @return The planes actors.\n */\nstd::vector<vtkSmartPointer<vtkActor>> MakePlanesActors(vtkNamedColors* colors);\n\n/**\n * Generate text to place on the planes.\n * Careful placement is needed here.\n * @return The text actors.\n */\nstd::vector<vtkSmartPointer<vtkActor>> AddTextToPlanes();\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fileName\" << std::endl;\n    std::cout << \"where: fileName is Human.vtp.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName(argv[1]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the rendering window, renderer, and interactive renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(780, 780);\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Make an annotated cube actor with axes and then add it into an orientation\n  // marker widget.\n  // Three of these need to be made.\n\n  // Right Posterior Superior\n  std::array<std::string, 3> xyzLabels{{\"X\", \"Y\", \"Z\"}};\n  std::array<double, 3> scale{{1.5, -1.5, 1.5}};\n  auto axes = MakeCubeActor(scale, xyzLabels, colors);\n  vtkNew<vtkOrientationMarkerWidget> om;\n  om->SetOrientationMarker(axes);\n  // Position upper left in the viewport.\n  om->SetViewport(0.0, 0.8, 0.2, 1.0);\n  om->SetInteractor(iren);\n  om->EnabledOn();\n  om->InteractiveOn();\n\n  // Right, Anterior, Superior.\n  std::array<double, 3> scale1{{1.5, 1.5, 1.5}};\n  auto axes1 = MakeCubeActor(scale1, xyzLabels, colors);\n  vtkNew<vtkOrientationMarkerWidget> om1;\n  om1->SetOrientationMarker(axes1);\n  // Position lower left in the viewport.\n  om1->SetViewport(0, 0, 0.2, 0.2);\n  om1->SetInteractor(iren);\n  om1->EnabledOn();\n  om1->InteractiveOn();\n\n  // Left, Posterior, Superior.\n  std::array<double, 3> scale2{{-1.5, -1.5, 1.5}};\n  auto axes2 = MakeCubeActor(scale2, xyzLabels, colors);\n  vtkNew<vtkOrientationMarkerWidget> om2;\n  om2->SetOrientationMarker(axes2);\n  // Position lower right in the viewport.\n  om2->SetViewport(0.8, 0, 1.0, 0.2);\n  om2->SetInteractor(iren);\n  om2->EnabledOn();\n  om2->InteractiveOn();\n\n  // Finally create an annotated cube actor adding it into an orientation marker\n  // widget.\n  auto axes3 = MakeAnnotatedCubeActor(colors);\n  vtkNew<vtkOrientationMarkerWidget> om3;\n  om3->SetOrientationMarker(axes3);\n  // Position upper right in the viewport.\n  om3->SetViewport(0.8, 0.8, 1.0, 1.0);\n  om3->SetInteractor(iren);\n  om3->EnabledOn();\n  om3->InteractiveOn();\n\n  // Read in the model.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkPolyDataMapper> humanMapper;\n  humanMapper->SetInputConnection(reader->GetOutputPort());\n  humanMapper->SetScalarModeToUsePointFieldData();\n  humanMapper->SelectColorArray(\"Color\");\n  humanMapper->SetColorModeToDirectScalars();\n\n  vtkNew<vtkActor> humanActor;\n  humanActor->SetMapper(humanMapper);\n  std::vector<double> bounds(6, 0);\n  humanActor->GetBounds(&bounds[0]);\n  std::vector<double>::iterator maxElt =\n      std::max_element(bounds.begin(), bounds.end());\n  // Scale the actor\n  humanActor->SetScale(1.0 / *maxElt);\n  ren->AddActor(humanActor);\n\n  // Make the planes.\n  auto actors = MakePlanesActors(colors);\n  for (auto const& actor : actors)\n  {\n    ren->AddViewProp(actor);\n  }\n\n  // Label them.\n  auto textActors = AddTextToPlanes();\n  for (auto const& actor : textActors)\n  {\n    ren->AddViewProp(actor);\n  }\n\n  // Interact\n  ren->SetBackground2(colors->GetColor3d(\"OldLace\").GetData());\n  ren->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n  ren->GradientBackgroundOn();\n  ren->ResetCamera();\n  ren->GetActiveCamera()->Zoom(1.6);\n  ren->GetActiveCamera()->SetPosition(-2.3, 4.1, 4.2);\n  ren->GetActiveCamera()->SetViewUp(0.0, 0.0, 1.0);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  //  Call SetWindowName after renWin.Render() is called.\n  renWin->SetWindowName(\"AnatomicalOrientation\");\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkAxesActor>\nMakeAxesActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels)\n{\n  vtkNew<vtkAxesActor> axes;\n  axes->SetScale(scale[0], scale[1], scale[2]);\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(xyzLabels[0].c_str());\n  axes->SetYAxisLabelText(xyzLabels[1].c_str());\n  axes->SetZAxisLabelText(xyzLabels[2].c_str());\n  axes->SetCylinderRadius(0.5 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.025 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.5 * axes->GetSphereRadius());\n  vtkTextProperty* tprop =\n      axes->GetXAxisCaptionActor2D()->GetCaptionTextProperty();\n  tprop->ItalicOn();\n  tprop->ShadowOn();\n  tprop->SetFontFamilyToTimes();\n  // Use the same text properties on the other two axes.\n  axes->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  axes->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  return axes;\n}\n\nvtkSmartPointer<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(vtkNamedColors* colors)\n{\n  // A cube with labeled faces.\n  vtkNew<vtkAnnotatedCubeActor> cube;\n  cube->SetXPlusFaceText(\"R\");  // Right\n  cube->SetXMinusFaceText(\"L\"); // Left\n  cube->SetYPlusFaceText(\"A\");  // Anterior\n  cube->SetYMinusFaceText(\"P\"); // Posterior\n  cube->SetZPlusFaceText(\"S\");  // Superior/Cranial\n  cube->SetZMinusFaceText(\"I\"); // Inferior/Caudal\n  cube->SetFaceTextScale(0.5);\n  cube->GetCubeProperty()->SetColor(colors->GetColor3d(\"Gainsboro\").GetData());\n\n  cube->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Change the vector text colors.\n  cube->GetXPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetXMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetYPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetYMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetZPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  cube->GetZMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  return cube;\n}\n\nvtkSmartPointer<vtkPropAssembly>\nMakeCubeActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels, vtkNamedColors* colors)\n{\n  // We are combining a vtk.vtkAxesActor and a vtk.vtkAnnotatedCubeActor\n  // into a vtk.vtkPropAssembly\n  vtkSmartPointer<vtkAnnotatedCubeActor> cube = MakeAnnotatedCubeActor(colors);\n  vtkSmartPointer<vtkAxesActor> axes = MakeAxesActor(scale, xyzLabels);\n\n  // Combine orientation markers into one with an assembly.\n  vtkNew<vtkPropAssembly> assembly;\n  assembly->AddPart(axes);\n  assembly->AddPart(cube);\n  return assembly;\n}\n\nvtkSmartPointer<vtkTransformPolyDataFilter>\nMakePlane(std::array<int, 2>& resolution, std::array<double, 3>& origin,\n          std::array<double, 3>& point1, std::array<double, 3>& point2,\n          std::array<double, 4>& wxyz, std::array<double, 3>& translate)\n{\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetResolution(resolution[0], resolution[1]);\n  plane->SetOrigin(origin.data());\n  plane->SetPoint1(point1.data());\n  plane->SetPoint2(point2.data());\n  vtkNew<vtkTransform> trnf;\n  trnf->RotateWXYZ(wxyz[0], wxyz[1], wxyz[2], wxyz[3]);\n  trnf->Translate(translate.data());\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane;\n  tpdPlane->SetTransform(trnf);\n  tpdPlane->SetInputConnection(plane->GetOutputPort());\n  return tpdPlane;\n}\n\nstd::vector<vtkSmartPointer<vtkActor>> MakePlanesActors(vtkNamedColors* colors)\n{\n  std::vector<vtkSmartPointer<vtkTransformPolyDataFilter>> planes;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n\n  // Parameters for a plane lying in the x-y plane.\n  std::array<int, 2> resolution{{10, 10}};\n  std::array<double, 3> origin{{0.0, 0.0, 0.0}};\n  std::array<double, 3> point1{{1, 0, 0}};\n  std::array<double, 3> point2{{0, 1, 0}};\n\n  std::array<double, 4> wxyz0{{0, 0, 0, 0}};\n  std::array<double, 3> translate{{-0.5, -0.5, 0}};\n  std::array<double, 4> wxyz1{{-90, 1, 0, 0}};\n  std::array<double, 4> wxyz2{{-90, 0, 1, 0}};\n  planes.push_back(MakePlane(resolution, origin, point1, point2, wxyz0,\n                             translate)); // x-y plane\n  planes.push_back(MakePlane(resolution, origin, point1, point2, wxyz1,\n                             translate)); // x-z plane\n  planes.push_back(MakePlane(resolution, origin, point1, point2, wxyz2,\n                             translate)); // y-z plane\n  for (size_t i = 0; i < planes.size(); ++i)\n  {\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputConnection(planes[i]->GetOutputPort());\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n  }\n  actors[0]->GetProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData()); // Transverse plane\n  actors[1]->GetProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData()); // Coronal plane\n  actors[2]->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData()); // Saggital plane\n  return actors;\n}\n\nstd::vector<vtkSmartPointer<vtkActor>> AddTextToPlanes()\n{\n  std::vector<vtkSmartPointer<vtkActor>> textActors;\n  std::array<double, 3> scale{{0.04, 0.04, 0.04}};\n\n  vtkNew<vtkVectorText> text1;\n  text1->SetText(\"Transverse\\nPlane\\n\\nSuperior\\nCranial\");\n  vtkNew<vtkTransform> trnf1;\n  trnf1->RotateZ(-90);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane1;\n  tpdPlane1->SetTransform(trnf1);\n  tpdPlane1->SetInputConnection(text1->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper1;\n  textMapper1->SetInputConnection(tpdPlane1->GetOutputPort());\n  vtkNew<vtkActor> textActor1;\n  textActor1->SetMapper(textMapper1);\n  textActor1->SetScale(scale.data());\n  textActor1->AddPosition(0.4, 0.49, 0.01);\n  textActors.push_back(textActor1);\n\n  vtkNew<vtkVectorText> text2;\n  text2->SetText(\"Transverse\\nPlane\\n\\nInferior\\n(Caudal)\");\n  vtkNew<vtkTransform> trnf2;\n  trnf2->RotateZ(270);\n  trnf2->RotateWXYZ(180, 0, 1, 0);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane2;\n  tpdPlane2->SetTransform(trnf2);\n  tpdPlane2->SetInputConnection(text2->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper2;\n  textMapper2->SetInputConnection(tpdPlane2->GetOutputPort());\n  vtkNew<vtkActor> textActor2;\n  textActor2->SetMapper(textMapper2);\n  textActor2->SetScale(scale.data());\n  textActor2->AddPosition(0.4, -0.49, -0.01);\n  textActors.push_back(textActor2);\n\n  vtkNew<vtkVectorText> text3;\n  text3->SetText(\"Sagittal\\nPlane\\n\\nLeft\");\n  vtkNew<vtkTransform> trnf3;\n  trnf3->RotateX(90);\n  trnf3->RotateWXYZ(-90, 0, 1, 0);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane3;\n  tpdPlane3->SetTransform(trnf3);\n  tpdPlane3->SetInputConnection(text3->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper3;\n  textMapper3->SetInputConnection(tpdPlane3->GetOutputPort());\n  vtkNew<vtkActor> textActor3;\n  textActor3->SetMapper(textMapper3);\n  textActor3->SetScale(scale.data());\n  textActor3->AddPosition(-0.01, 0.49, 0.4);\n  textActors.push_back(textActor3);\n\n  vtkNew<vtkVectorText> text4;\n  text4->SetText(\"Sagittal\\nPlane\\n\\nRight\");\n  vtkNew<vtkTransform> trnf4;\n  trnf4->RotateX(90);\n  trnf4->RotateWXYZ(-270, 0, 1, 0);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane4;\n  tpdPlane4->SetTransform(trnf4);\n  tpdPlane4->SetInputConnection(text4->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper4;\n  textMapper4->SetInputConnection(tpdPlane4->GetOutputPort());\n  vtkNew<vtkActor> textActor4;\n  textActor4->SetMapper(textMapper4);\n  textActor4->SetScale(scale.data());\n  textActor4->AddPosition(0.01, -0.49, 0.4);\n  textActors.push_back(textActor4);\n\n  vtkNew<vtkVectorText> text5;\n  text5->SetText(\"Coronal\\nPlane\\n\\nAnterior\");\n  vtkNew<vtkTransform> trnf5;\n  trnf5->RotateY(-180);\n  trnf5->RotateWXYZ(-90, 1, 0, 0);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane5;\n  tpdPlane5->SetTransform(trnf5);\n  tpdPlane5->SetInputConnection(text5->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper5;\n  textMapper5->SetInputConnection(tpdPlane5->GetOutputPort());\n  vtkNew<vtkActor> textActor5;\n  textActor5->SetMapper(textMapper5);\n  textActor5->SetScale(scale.data());\n  textActor5->AddPosition(0.49, 0.01, 0.20);\n  textActors.push_back(textActor5);\n\n  vtkNew<vtkVectorText> text6;\n  text6->SetText(\"Coronal\\nPlane\\n\\nPosterior\");\n  vtkNew<vtkTransform> trnf6;\n  trnf6->RotateWXYZ(90, 1, 0, 0);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane6;\n  tpdPlane6->SetTransform(trnf6);\n  tpdPlane6->SetInputConnection(text6->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper6;\n  textMapper6->SetInputConnection(tpdPlane6->GetOutputPort());\n  vtkNew<vtkActor> textActor6;\n  textActor6->SetMapper(textMapper6);\n  textActor6->SetScale(scale.data());\n  textActor6->AddPosition(-0.49, -0.01, 0.3);\n  textActors.push_back(textActor6);\n\n  return textActors;\n}\n} // namespace\n
"},{"location":"Cxx/VisualizationAlgorithms/AnatomicalOrientation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AnatomicalOrientation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AnatomicalOrientation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AnatomicalOrientation MACOSX_BUNDLE AnatomicalOrientation.cxx )\n  target_link_libraries(AnatomicalOrientation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AnatomicalOrientation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/AnatomicalOrientation/#download-and-build-anatomicalorientation","title":"Download and Build AnatomicalOrientation","text":"

Click here to download AnatomicalOrientation and its CMakeLists.txt file. Once the tarball AnatomicalOrientation.tar has been downloaded and extracted,

cd AnatomicalOrientation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AnatomicalOrientation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/","title":"BandedPolyDataContourFilter","text":"

vtk-examples/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/#description","title":"Description","text":"

Note

This original source code for this example is here.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/#code","title":"Code","text":"

BandedPolyDataContourFilter.cxx

#include <vtkActor.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> pts;\n  pts->InsertPoint(0, 0, 0, 0);\n  pts->InsertPoint(1, 0, 1, 0);\n  pts->InsertPoint(2, 0, 2, 0);\n  pts->InsertPoint(3, 1, 0, 0);\n  pts->InsertPoint(4, 1, 1, 0);\n  pts->InsertPoint(5, 1, 2, 0);\n  pts->InsertPoint(6, 2, 0, 0);\n  pts->InsertPoint(7, 2, 2, 0);\n  pts->InsertPoint(8, 3, 0, 0);\n  pts->InsertPoint(9, 3, 1, 0);\n  pts->InsertPoint(10, 3, 2, 0);\n  pts->InsertPoint(11, 4, 0, 0);\n  pts->InsertPoint(12, 6, 0, 0);\n  pts->InsertPoint(13, 5, 2, 0);\n  pts->InsertPoint(14, 7, 0, 0);\n  pts->InsertPoint(15, 9, 0, 0);\n  pts->InsertPoint(16, 7, 2, 0);\n  pts->InsertPoint(17, 9, 2, 0);\n  pts->InsertPoint(18, 10, 0, 0);\n  pts->InsertPoint(19, 12, 0, 0);\n  pts->InsertPoint(20, 10, 1, 0);\n  pts->InsertPoint(21, 12, 1, 0);\n  pts->InsertPoint(22, 10, 2, 0);\n  pts->InsertPoint(23, 12, 2, 0);\n  pts->InsertPoint(24, 10, 3, 0);\n  pts->InsertPoint(25, 12, 3, 0);\n\n  vtkNew<vtkCellArray> polys;\n  polys->InsertNextCell(4);\n  polys->InsertCellPoint(14);\n  polys->InsertCellPoint(15);\n  polys->InsertCellPoint(17);\n  polys->InsertCellPoint(16);\n  polys->InsertNextCell(3);\n  polys->InsertCellPoint(11);\n  polys->InsertCellPoint(12);\n  polys->InsertCellPoint(13);\n\n  vtkNew<vtkFloatArray> scalars;\n  scalars->SetNumberOfTuples(26);\n  scalars->SetTuple1(0, 0);\n  scalars->SetTuple1(1, 50);\n  scalars->SetTuple1(2, 100);\n  scalars->SetTuple1(3, 0);\n  scalars->SetTuple1(4, 50);\n  scalars->SetTuple1(5, 100);\n  scalars->SetTuple1(6, 10);\n  scalars->SetTuple1(7, 90);\n  scalars->SetTuple1(8, 10);\n  scalars->SetTuple1(9, 50);\n  scalars->SetTuple1(10, 90);\n  scalars->SetTuple1(11, 10);\n  scalars->SetTuple1(12, 40);\n  scalars->SetTuple1(13, 100);\n  scalars->SetTuple1(14, 0);\n  scalars->SetTuple1(15, 60);\n  scalars->SetTuple1(16, 40);\n  scalars->SetTuple1(17, 100);\n  scalars->SetTuple1(18, 0);\n  scalars->SetTuple1(19, 25);\n  scalars->SetTuple1(20, 25);\n  scalars->SetTuple1(21, 50);\n  scalars->SetTuple1(22, 50);\n  scalars->SetTuple1(23, 75);\n  scalars->SetTuple1(24, 75);\n  scalars->SetTuple1(25, 100);\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(pts);\n  polyData->SetPolys(polys);\n  polyData->GetPointData()->SetScalars(scalars);\n\n  vtkNew<vtkBandedPolyDataContourFilter> bf;\n  bf->SetInputData(polyData);\n  bf->GenerateValues(5, 25, 75);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(bf->GetOutputPort());\n  mapper->SetScalarModeToUseCellData();\n  mapper->SetScalarRange(0, 4);\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create the RenderWindow, Renderer and both Actors.\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size.\n  renderer->AddActor(actor);\n\n  renderWindow->SetSize(1200, 400);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"BandedPolyDataContourFilter\");\n\n  renderer->SetBackground(colors->GetColor3d(\"Melon\").GetData());\n  renderer->GetActiveCamera()->Zoom(2.5);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BandedPolyDataContourFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BandedPolyDataContourFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BandedPolyDataContourFilter MACOSX_BUNDLE BandedPolyDataContourFilter.cxx )\n  target_link_libraries(BandedPolyDataContourFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BandedPolyDataContourFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/#download-and-build-bandedpolydatacontourfilter","title":"Download and Build BandedPolyDataContourFilter","text":"

Click here to download BandedPolyDataContourFilter and its CMakeLists.txt file. Once the tarball BandedPolyDataContourFilter.tar has been downloaded and extracted,

cd BandedPolyDataContourFilter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BandedPolyDataContourFilter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/BluntStreamlines/","title":"BluntStreamlines","text":"

vtk-examples/Cxx/VisualizationAlgorithms/BluntStreamlines

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/BluntStreamlines/#description","title":"Description","text":"

This example shows airflow around a blunt fin. This example consists of a wall with half a rounded fin projecting into the fluid flow. (Using arguments of symmetry, only half of the domain was modeled.) Twenty-five streamlines are released upstream of the fin. The boundary layer effects near the junction of the fin and wall are clearly evident from the streamlines. In this area, flow recirculation is apparent, as well as the reduced flow speed.

Info

See Figure 6-19 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/BluntStreamlines/#code","title":"Code","text":"

BluntStreamlines.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLineSource.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc != 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" bluntfinxyz.bin bluntfinq.bin\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  double range[2], c[3];\n  double maxTime = 0.0;\n\n  auto colors = vtkSmartPointer<vtkNamedColors>::New();\n\n  auto aren = vtkSmartPointer<vtkRenderer>::New();\n  auto renWin = vtkSmartPointer<vtkRenderWindow>::New();\n  renWin->AddRenderer(aren);\n  auto iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renWin);\n\n  std::string xyzFilename = argv[1];\n  std::string qFilename = argv[2];\n\n  auto reader = vtkSmartPointer<vtkMultiBlockPLOT3DReader>::New();\n  reader->SetXYZFileName(xyzFilename.c_str());\n  reader->SetQFileName(qFilename.c_str());\n  reader->Update(); // Force a read to occur.\n\n  vtkStructuredGrid* pd =\n      dynamic_cast<vtkStructuredGrid*>(reader->GetOutput()->GetBlock(0));\n  pd->GetCenter(c);\n  if (pd->GetPointData()->GetScalars())\n  {\n    pd->GetPointData()->GetScalars()->GetRange(range);\n  }\n  if (pd->GetPointData()->GetVectors())\n  {\n    auto maxVelocity = pd->GetPointData()->GetVectors()->GetMaxNorm();\n    maxTime = 20.0 * pd->GetLength() / maxVelocity;\n  }\n\n  auto outlineF = vtkSmartPointer<vtkStructuredGridOutlineFilter>::New();\n  outlineF->SetInputData(pd);\n\n  auto outlineMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n  outlineMapper->SetInputConnection(outlineF->GetOutputPort());\n\n  auto outline = vtkSmartPointer<vtkActor>::New();\n  outline->SetMapper(outlineMapper);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"Moccasin\").GetData());\n  outline->GetProperty()->SetLineWidth(2.0);\n\n  //\n  // Some geometry for context.\n  //\n  auto wall = vtkSmartPointer<vtkStructuredGridGeometryFilter>::New();\n  wall->SetInputData(pd);\n  wall->SetExtent(0, 100, 0, 100, 0, 0);\n\n  auto wallMap = vtkSmartPointer<vtkPolyDataMapper>::New();\n  wallMap->SetInputConnection(wall->GetOutputPort());\n  wallMap->ScalarVisibilityOff();\n\n  auto wallActor = vtkSmartPointer<vtkActor>::New();\n  wallActor->SetMapper(wallMap);\n  wallActor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  auto fin = vtkSmartPointer<vtkStructuredGridGeometryFilter>::New();\n  fin->SetInputData(pd);\n  fin->SetExtent(0, 100, 0, 0, 0, 100);\n\n  auto finMap = vtkSmartPointer<vtkPolyDataMapper>::New();\n  finMap->SetInputConnection(fin->GetOutputPort());\n  finMap->ScalarVisibilityOff();\n\n  auto finActor = vtkSmartPointer<vtkActor>::New();\n  finActor->SetMapper(finMap);\n  finActor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n  //\n  // Regular streamlines.\n  //\n  auto line1 = vtkSmartPointer<vtkLineSource>::New();\n  line1->SetResolution(25);\n  line1->SetPoint1(-6.36, 0.25, 0.06);\n  line1->SetPoint2(-6.36, 0.25, 5.37);\n\n  auto rakeMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n  rakeMapper->SetInputConnection(line1->GetOutputPort());\n\n  auto rake1 = vtkSmartPointer<vtkActor>::New();\n  rake1->SetMapper(rakeMapper);\n  rake1->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  rake1->GetProperty()->SetLineWidth(5);\n\n  auto streamers = vtkSmartPointer<vtkStreamTracer>::New();\n  //  streamers->DebugOn();\n  streamers->SetInputConnection(reader->GetOutputPort());\n  streamers->SetSourceConnection(line1->GetOutputPort());\n  streamers->SetMaximumPropagation(maxTime);\n  streamers->SetInitialIntegrationStep(0.2);\n  streamers->SetMinimumIntegrationStep(0.01);\n  streamers->SetIntegratorType(2);\n  streamers->Update();\n\n  auto streamersMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n  streamersMapper->SetInputConnection(streamers->GetOutputPort());\n  streamersMapper->SetScalarRange(range);\n\n  auto lines = vtkSmartPointer<vtkActor>::New();\n  lines->SetMapper(streamersMapper);\n\n  aren->AddActor(outline);\n  aren->AddActor(wallActor);\n  aren->AddActor(finActor);\n  aren->AddActor(rake1);\n  aren->AddActor(lines);\n  aren->SetBackground(colors->GetColor3d(\"Gray\").GetData());\n\n  aren->ResetCamera();\n  aren->GetActiveCamera()->Elevation(30.0);\n  aren->GetActiveCamera()->Azimuth(30.0);\n  aren->GetActiveCamera()->Dolly(1.2);\n  aren->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"BluntStreamlines\");\n  renWin->Render();\n\n  // Interact with data.\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/BluntStreamlines/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BluntStreamlines)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BluntStreamlines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BluntStreamlines MACOSX_BUNDLE BluntStreamlines.cxx )\n  target_link_libraries(BluntStreamlines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BluntStreamlines\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/BluntStreamlines/#download-and-build-bluntstreamlines","title":"Download and Build BluntStreamlines","text":"

Click here to download BluntStreamlines and its CMakeLists.txt file. Once the tarball BluntStreamlines.tar has been downloaded and extracted,

cd BluntStreamlines/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BluntStreamlines\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/CarotidFlow/","title":"CarotidFlow","text":"

vtk-examples/Cxx/VisualizationAlgorithms/CarotidFlow

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/CarotidFlow/#description","title":"Description","text":"

This example generates streamtubes of blood velocity. an isosurface of speed provides context. The starting positions for the streamtubes were determined by experimenting with the data. Because of the way the data was measured and the resolution of the velocity field, many streamers travel outside the artery. This is because the boundary layer of the blood flow is not captured due to limitations in data resolution. Consequently, as the blood flows around curves, there is a component of the velocity field that directs the streamtube outside the artery. As a result it is hard to find starting positions for the streamtubes that yield interesting results. The examples uses the source object vtkPointSource in combination with vtkThresholdPoints to work around this problem. vtkPointSource generates random points centered around a sphere of a specified radius. We need only find an approximate position for the starting points of the streamtubes and then generate a cloud of random seed points. vtkThresholdPoints is used to cull points that may be generated outside the regions of high flow velocity.

Cite

See 3D Phase Contrast MRI of Cerebral Blood Flow and Surface Anatomy for background.

Info

See Figure 6-44 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/CarotidFlow/#code","title":"Code","text":"

CarotidFlow.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" carotid.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // create pipeline\n  //\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkPointSource> psource;\n  psource->SetNumberOfPoints(25);\n  psource->SetCenter(133.1, 116.3, 5.0);\n  psource->SetRadius(2.0);\n\n  vtkNew<vtkThresholdPoints> threshold;\n  threshold->SetInputConnection(reader->GetOutputPort());\n  threshold->ThresholdByUpper(275);\n\n  vtkNew<vtkStreamTracer> streamers;\n  streamers->SetInputConnection(reader->GetOutputPort());\n  streamers->SetSourceConnection(psource->GetOutputPort());\n  //  streamers->SetMaximumPropagationUnitToTimeUnit();\n  streamers->SetMaximumPropagation(100.0);\n  //  streamers->SetInitialIntegrationStepUnitToCellLengthUnit();\n  streamers->SetInitialIntegrationStep(0.2);\n  streamers->SetTerminalSpeed(.01);\n  streamers->Update();\n  double range[2];\n  range[0] =\n      streamers->GetOutput()->GetPointData()->GetScalars()->GetRange()[0];\n  range[1] =\n      streamers->GetOutput()->GetPointData()->GetScalars()->GetRange()[1];\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(streamers->GetOutputPort());\n  tubes->SetRadius(0.3);\n  tubes->SetNumberOfSides(6);\n  tubes->SetVaryRadius(0);\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(.667, 0.0);\n  lut->Build();\n\n  vtkNew<vtkPolyDataMapper> streamerMapper;\n  streamerMapper->SetInputConnection(tubes->GetOutputPort());\n  streamerMapper->SetScalarRange(range[0], range[1]);\n  streamerMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> streamerActor;\n  streamerActor->SetMapper(streamerMapper);\n\n  // contours of speed\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->SetValue(0, 175);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetRepresentationToWireframe();\n  isoActor->GetProperty()->SetOpacity(0.25);\n\n  // outline\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(streamerActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CarotidFlow\");\n\n  vtkNew<vtkCamera> cam1;\n  cam1->SetClippingRange(17.4043, 870.216);\n  cam1->SetFocalPoint(136.71, 104.025, 23);\n  cam1->SetPosition(204.747, 258.939, 63.7925);\n  cam1->SetViewUp(-0.102647, -0.210897, 0.972104);\n  cam1->Zoom(1.2);\n  ren1->SetActiveCamera(cam1);\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/CarotidFlow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CarotidFlow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersModeling\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CarotidFlow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CarotidFlow MACOSX_BUNDLE CarotidFlow.cxx )\n  target_link_libraries(CarotidFlow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CarotidFlow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/CarotidFlow/#download-and-build-carotidflow","title":"Download and Build CarotidFlow","text":"

Click here to download CarotidFlow and its CMakeLists.txt file. Once the tarball CarotidFlow.tar has been downloaded and extracted,

cd CarotidFlow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CarotidFlow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/","title":"CarotidFlowGlyphs","text":"

vtk-examples/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/#description","title":"Description","text":"

Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude.

Info

See Figure 6-43 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/#code","title":"Code","text":"

CarotidFlowGlyphs.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkContourFilter.h>\n#include <vtkGlyph3D.h>\n#include <vtkLookupTable.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPoints.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkThresholdPoints.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" carotid.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkSmartPointer<vtkNamedColors> colors =\n      vtkSmartPointer<vtkNamedColors>::New();\n\n  vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();\n\n  vtkSmartPointer<vtkRenderWindow> renWin =\n      vtkSmartPointer<vtkRenderWindow>::New();\n  renWin->AddRenderer(ren1);\n\n  vtkSmartPointer<vtkRenderWindowInteractor> iren =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renWin);\n\n  // create pipeline\n  //\n  vtkSmartPointer<vtkStructuredPointsReader> reader =\n      vtkSmartPointer<vtkStructuredPointsReader>::New();\n  reader->SetFileName(argv[1]);\n\n  vtkSmartPointer<vtkThresholdPoints> threshold =\n      vtkSmartPointer<vtkThresholdPoints>::New();\n  threshold->SetInputConnection(reader->GetOutputPort());\n  threshold->ThresholdByUpper(200);\n\n  vtkSmartPointer<vtkMaskPoints> mask = vtkSmartPointer<vtkMaskPoints>::New();\n  mask->SetInputConnection(threshold->GetOutputPort());\n  mask->SetOnRatio(5);\n\n  vtkSmartPointer<vtkConeSource> cone = vtkSmartPointer<vtkConeSource>::New();\n  cone->SetResolution(11);\n  cone->SetHeight(1);\n  cone->SetRadius(0.25);\n\n  vtkSmartPointer<vtkGlyph3D> cones = vtkSmartPointer<vtkGlyph3D>::New();\n  cones->SetInputConnection(mask->GetOutputPort());\n  cones->SetSourceConnection(cone->GetOutputPort());\n  cones->SetScaleFactor(0.4);\n  cones->SetScaleModeToScaleByVector();\n\n  vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New();\n  lut->SetHueRange(.667, 0.0);\n  lut->Build();\n\n  double range[2];\n  cones->Update();\n  range[0] = cones->GetOutput()->GetPointData()->GetScalars()->GetRange()[0];\n  range[1] = cones->GetOutput()->GetPointData()->GetScalars()->GetRange()[1];\n  std::cout << \"range: \" << range[0] << \", \" << range[1] << std::endl;\n\n  vtkSmartPointer<vtkPolyDataMapper> vectorMapper =\n      vtkSmartPointer<vtkPolyDataMapper>::New();\n  vectorMapper->SetInputConnection(cones->GetOutputPort());\n  vectorMapper->SetScalarRange(range[0], range[1]);\n  vectorMapper->SetLookupTable(lut);\n\n  vtkSmartPointer<vtkActor> vectorActor = vtkSmartPointer<vtkActor>::New();\n  vectorActor->SetMapper(vectorMapper);\n\n  // Contours of speed.\n  vtkSmartPointer<vtkContourFilter> iso =\n      vtkSmartPointer<vtkContourFilter>::New();\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->SetValue(0, 175);\n\n  vtkSmartPointer<vtkPolyDataMapper> isoMapper =\n      vtkSmartPointer<vtkPolyDataMapper>::New();\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkSmartPointer<vtkActor> isoActor = vtkSmartPointer<vtkActor>::New();\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetRepresentationToWireframe();\n  isoActor->GetProperty()->SetOpacity(0.25);\n\n  // Outline\n  vtkSmartPointer<vtkOutlineFilter> outline =\n      vtkSmartPointer<vtkOutlineFilter>::New();\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkSmartPointer<vtkPolyDataMapper> outlineMapper =\n      vtkSmartPointer<vtkPolyDataMapper>::New();\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkSmartPointer<vtkActor> outlineActor = vtkSmartPointer<vtkActor>::New();\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(vectorActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CarotidFlowGlyphs\");\n\n  vtkSmartPointer<vtkCamera> cam1 = vtkSmartPointer<vtkCamera>::New();\n  cam1->SetClippingRange(17.4043, 870.216);\n  cam1->SetFocalPoint(136.71, 104.025, 23);\n  cam1->SetPosition(204.747, 258.939, 63.7925);\n  cam1->SetViewUp(-0.102647, -0.210897, 0.972104);\n  cam1->Zoom(1.2);\n  ren1->SetActiveCamera(cam1);\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CarotidFlowGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CarotidFlowGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CarotidFlowGlyphs MACOSX_BUNDLE CarotidFlowGlyphs.cxx )\n  target_link_libraries(CarotidFlowGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CarotidFlowGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/#download-and-build-carotidflowglyphs","title":"Download and Build CarotidFlowGlyphs","text":"

Click here to download CarotidFlowGlyphs and its CMakeLists.txt file. Once the tarball CarotidFlowGlyphs.tar has been downloaded and extracted,

cd CarotidFlowGlyphs/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CarotidFlowGlyphs\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/ClipSphereCylinder/","title":"ClipSphereCylinder","text":"

vtk-examples/Cxx/VisualizationAlgorithms/ClipSphereCylinder

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/ClipSphereCylinder/#description","title":"Description","text":"

Clipping is implemented in vtkClipPolyData . Each polygonal data primitive implements the operation in its Clip() method using case tables. vtkClipPolyData has methods to control whether an implicit function provides the scalar data or whether the dataset\u2019s scalar data will be used. ComputeScalarDataOn() uses the implicit function and ComputeScalarDataOff() uses the dataset\u2019s scalar data. Two output polygonal datasets are produced. These are accessed with GetOutput() and GetClippedOutput() methods. GetOutput() returns the polygonal data that is \u201cinside\u201d the clipping region while GetClippedOutput() returns polygonal data that is \u201coutside\u201d the region. (Note that GenerateClippedOutputOn() must be enabled if you are to get the clipped output.) The meaning of inside and outside can be reversed using the InsideOutOn().

This example shows a plane of quadrilaterals clipped with a boolean implicit function.

Info

See Figure 9-48 in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/ClipSphereCylinder/#code","title":"Code","text":"

ClipSphereCylinder.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkCylinder.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphere.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  // Demonstrate the use of clipping on polygonal data\n  //\n\n  // create pipeline\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetXResolution(25);\n  plane->SetYResolution(25);\n  plane->SetOrigin(-1, -1, 0);\n  plane->SetPoint1(1, -1, 0);\n  plane->SetPoint2(-1, 1, 0);\n\n  vtkNew<vtkTransform> transformSphere;\n  transformSphere->Identity();\n  transformSphere->Translate(.4, -.4, 0);\n  transformSphere->Inverse();\n\n  vtkNew<vtkSphere> sphere;\n  sphere->SetTransform(transformSphere);\n  sphere->SetRadius(.5);\n\n  vtkNew<vtkTransform> transformCylinder;\n  transformCylinder->Identity();\n  transformCylinder->Translate(-.4, .4, 0);\n  transformCylinder->RotateZ(30);\n  transformCylinder->RotateY(60);\n  transformCylinder->RotateX(90);\n  transformCylinder->Inverse();\n\n  vtkNew<vtkCylinder> cylinder;\n  cylinder->SetTransform(transformCylinder);\n  cylinder->SetRadius(.3);\n\n  vtkNew<vtkImplicitBoolean> boolean;\n  boolean->AddFunction(cylinder);\n  boolean->AddFunction(sphere);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(plane->GetOutputPort());\n  clipper->SetClipFunction(boolean);\n  clipper->GenerateClippedOutputOn();\n  clipper->GenerateClipScalarsOn();\n  clipper->SetValue(0);\n\n  vtkNew<vtkPolyDataMapper> clipMapper;\n  clipMapper->SetInputConnection(clipper->GetOutputPort());\n  clipMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clipActor;\n  clipActor->SetMapper(clipMapper);\n  clipActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  clipActor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkPolyDataMapper> clipInsideMapper;\n  clipInsideMapper->SetInputData(clipper->GetClippedOutput());\n  clipInsideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clipInsideActor;\n  clipInsideActor->SetMapper(clipInsideMapper);\n  clipInsideActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"LightBlue\").GetData());\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(clipActor);\n\n  ren1->AddActor(clipInsideActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.4);\n  ren1->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ClipSphereCylinder\");\n\n  // render the image\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/ClipSphereCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipSphereCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipSphereCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipSphereCylinder MACOSX_BUNDLE ClipSphereCylinder.cxx )\n  target_link_libraries(ClipSphereCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipSphereCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/ClipSphereCylinder/#download-and-build-clipspherecylinder","title":"Download and Build ClipSphereCylinder","text":"

Click here to download ClipSphereCylinder and its CMakeLists.txt file. Once the tarball ClipSphereCylinder.tar has been downloaded and extracted,

cd ClipSphereCylinder/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ClipSphereCylinder\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/ColorIsosurface/","title":"ColorIsosurface","text":"

vtk-examples/Cxx/VisualizationAlgorithms/ColorIsosurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/ColorIsosurface/#description","title":"Description","text":"

This example shows how to color an isosurface with other data. Basically an isosurface is generated, and a data array is selected and used by the mapper to color the surface.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/ColorIsosurface/#code","title":"Code","text":"

ColorIsosurface.cxx

// This example shows how to color an isosurface with other\n// data. Basically an isosurface is generated, and a data array is\n// selected and used by the mapper to color the surface.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkLODActor.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Read some data. The important thing here is to read a function as a\n  // data array as well as the scalar and vector.  (here function 153 is\n  // named \"Velocity Magnitude\").Later this data array will be used to\n  // color the isosurface.\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->AddFunction(153);\n  pl3d->Update();\n\n  // The contour filter uses the labeled scalar (function number 100\n  // above to generate the contour surface; all other data is\n  // interpolated during the contouring process.\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputData(pl3d->GetOutput()->GetBlock(0));\n  iso->SetValue(0, .24);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(iso->GetOutputPort());\n  normals->SetFeatureAngle(45);\n\n  // We indicate to the mapper to use the velcoity magnitude, which is a\n  // vtkDataArray that makes up part of the point attribute data.\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(normals->GetOutputPort());\n  isoMapper->ScalarVisibilityOn();\n  isoMapper->SetScalarRange(0, 1500);\n  isoMapper->SetScalarModeToUsePointFieldData();\n  isoMapper->ColorByArrayComponent(\"VelocityMagnitude\", 0);\n\n  vtkNew<vtkLODActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->SetNumberOfCloudPoints(1000);\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Create the usual rendering stuff.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Add the actors to the renderer, set the background and size.\n  renderer->AddActor(outlineActor);\n  renderer->AddActor(isoActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ColorIsosurface\");\n\n  // Pick a good view\n  vtkCamera* cam1 = renderer->GetActiveCamera();\n  cam1->SetClippingRange(3.95297, 50);\n  cam1->SetFocalPoint(9.71821, 0.458166, 29.3999);\n  cam1->SetPosition(2.7439, -37.3196, 38.7167);\n  cam1->SetViewUp(-0.16123, 0.264271, 0.950876);\n  cam1->Zoom(1.3);\n\n  interactor->Initialize();\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/ColorIsosurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorIsosurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorIsosurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorIsosurface MACOSX_BUNDLE ColorIsosurface.cxx )\n  target_link_libraries(ColorIsosurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorIsosurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/ColorIsosurface/#download-and-build-colorisosurface","title":"Download and Build ColorIsosurface","text":"

Click here to download ColorIsosurface and its CMakeLists.txt file. Once the tarball ColorIsosurface.tar has been downloaded and extracted,

cd ColorIsosurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ColorIsosurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/CombustorIsosurface/","title":"CombustorIsosurface","text":"

vtk-examples/Cxx/VisualizationAlgorithms/CombustorIsosurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/CombustorIsosurface/#description","title":"Description","text":"

This example generates an isosurface of constant flow density.

Info

See Figure 6-11c in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/CombustorIsosurface/#code","title":"Code","text":"

CombustorIsosurface.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create pipeline.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputData(pl3d->GetOutput()->GetBlock(0));\n  iso->SetValue(0, .38);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(iso->GetOutputPort());\n  normals->SetFeatureAngle(45);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(normals->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"WhiteSmoke\").GetData());\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputConnection(pl3d->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CombustorIsosurface\");\n\n  ren1->GetActiveCamera()->SetFocalPoint(9.71821, 0.458166, 29.3999);\n  ren1->GetActiveCamera()->SetPosition(2.7439, -37.3196, 38.7167);\n  ren1->GetActiveCamera()->SetViewUp(-0.16123, 0.264271, 0.950876);\n  ren1->GetActiveCamera()->Zoom(1.3);\n  ren1->ResetCameraClippingRange();\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/CombustorIsosurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CombustorIsosurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CombustorIsosurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CombustorIsosurface MACOSX_BUNDLE CombustorIsosurface.cxx )\n  target_link_libraries(CombustorIsosurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CombustorIsosurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/CombustorIsosurface/#download-and-build-combustorisosurface","title":"Download and Build CombustorIsosurface","text":"

Click here to download CombustorIsosurface and its CMakeLists.txt file. Once the tarball CombustorIsosurface.tar has been downloaded and extracted,

cd CombustorIsosurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CombustorIsosurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/ContourQuadric/","title":"ContourQuadric","text":"

vtk-examples/Cxx/VisualizationAlgorithms/ContourQuadric

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/ContourQuadric/#description","title":"Description","text":"

Contouring quadric function. Pipeline topology, and C++ code

Info

See Figure 6-39 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/ContourQuadric/#code","title":"Code","text":"

ContourQuadric.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> aren;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  //\n  // Create surfaces F(x,y,z) = constant\n  //\n  // Sample quadric function\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0);\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(quadric);\n\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(sample->GetOutputPort());\n  contour->GenerateValues(5, 0, 1.2);\n\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contour->GetOutputPort());\n  contourMapper->SetScalarRange(0, 1.2);\n\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n\n  // Create outline\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(sample->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Brown\").GetData());\n  outlineActor->GetProperty()->SetLineWidth(3.0);\n\n  //\n  // Rendering stuff\n  //\n  aren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  aren->AddActor(contourActor);\n  aren->AddActor(outlineActor);\n\n  aren->ResetCamera();\n  aren->GetActiveCamera()->Azimuth(30);\n  aren->GetActiveCamera()->Elevation(30);\n\n  renWin->SetSize(640, 512);\n  renWin->Render();\n  renWin->SetWindowName(\"ContourQuadric\");\n\n  // interact with data\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/ContourQuadric/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ContourQuadric)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ContourQuadric: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ContourQuadric MACOSX_BUNDLE ContourQuadric.cxx )\n  target_link_libraries(ContourQuadric PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ContourQuadric\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/ContourQuadric/#download-and-build-contourquadric","title":"Download and Build ContourQuadric","text":"

Click here to download ContourQuadric and its CMakeLists.txt file. Once the tarball ContourQuadric.tar has been downloaded and extracted,

cd ContourQuadric/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ContourQuadric\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/CreateBFont/","title":"CreateBFont","text":"

vtk-examples/Cxx/VisualizationAlgorithms/CreateBFont

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/CreateBFont/#description","title":"Description","text":"

A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles.

Info

See Figure 9-10 in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/CreateBFont/#code","title":"Code","text":"

CreateBFont.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNMReader.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" image.pgm e.g. B.pgm\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Now create the RenderWindow, Renderer and Interactor.\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkPNMReader> imageIn;\n  imageIn->SetFileName(argv[1]);\n\n  vtkNew<vtkImageGaussianSmooth> gaussian;\n  gaussian->SetStandardDeviations(2, 2);\n  gaussian->SetDimensionality(2);\n  gaussian->SetRadiusFactors(1, 1);\n  gaussian->SetInputConnection(imageIn->GetOutputPort());\n\n  vtkNew<vtkImageDataGeometryFilter> geometry;\n  geometry->SetInputConnection(gaussian->GetOutputPort());\n\n  vtkNew<vtkClipPolyData> aClipper;\n  aClipper->SetInputConnection(geometry->GetOutputPort());\n  aClipper->SetValue(127.5);\n  aClipper->GenerateClipScalarsOff();\n  aClipper->InsideOutOn();\n  aClipper->GetOutput()->GetPointData()->CopyScalarsOff();\n  aClipper->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(aClipper->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> letter;\n  letter->SetMapper(mapper);\n\n  ren1->AddActor(letter);\n  letter->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"LampBlack\").GetData());\n  letter->GetProperty()->SetRepresentationToWireframe();\n\n  ren1->SetBackground(colors->GetColor3d(\"WhiteSmoke\").GetData());\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.2);\n  ren1->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CreateBFont\");\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/CreateBFont/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CreateBFont)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  IOImage\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CreateBFont: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CreateBFont MACOSX_BUNDLE CreateBFont.cxx )\n  target_link_libraries(CreateBFont PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CreateBFont\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/CreateBFont/#download-and-build-createbfont","title":"Download and Build CreateBFont","text":"

Click here to download CreateBFont and its CMakeLists.txt file. Once the tarball CreateBFont.tar has been downloaded and extracted,

cd CreateBFont/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CreateBFont\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/CutStructuredGrid/","title":"CutStructuredGrid","text":"

vtk-examples/Cxx/VisualizationAlgorithms/CutStructuredGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/CutStructuredGrid/#description","title":"Description","text":"

This example cuts through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used.

Info

See Figure 6-31 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/CutStructuredGrid/#code","title":"Code","text":"

CutStructuredGrid.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCutter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // cut data\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkStructuredGrid* sg =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(sg->GetCenter());\n  plane->SetNormal(-0.287, 0, 0.9579);\n\n  vtkNew<vtkCutter> planeCut;\n  planeCut->SetInputData(pl3d->GetOutput()->GetBlock(0));\n  planeCut->SetCutFunction(plane);\n\n  vtkNew<vtkDataSetMapper> cutMapper;\n  cutMapper->SetInputConnection(planeCut->GetOutputPort());\n  cutMapper->SetScalarRange(sg->GetPointData()->GetScalars()->GetRange());\n\n  vtkNew<vtkActor> cutActor;\n  cutActor->SetMapper(cutMapper);\n\n  // Extract plane.\n  vtkNew<vtkStructuredGridGeometryFilter> compPlane;\n  compPlane->SetInputData(sg);\n  compPlane->SetExtent(0, 100, 0, 100, 9, 9);\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(compPlane->GetOutputPort());\n  planeMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n  planeActor->GetProperty()->SetRepresentationToWireframe();\n  planeActor->GetProperty()->SetColor(colors->GetColor3d(\"Wheat\").GetData());\n\n  // Outline\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Wheat\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(planeActor);\n  ren1->AddActor(cutActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CutStructuredGrid\");\n\n  auto camera = ren1->GetActiveCamera();\n  camera->SetPosition(5.02611, -23.535, 50.3979);\n  camera->SetFocalPoint(9.33614, 0.0414149, 30.112);\n  camera->SetViewUp(-0.0676794, 0.657814, 0.750134);\n  camera->SetDistance(31.3997);\n  camera->SetClippingRange(12.1468, 55.8147);\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/CutStructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CutStructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CutStructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CutStructuredGrid MACOSX_BUNDLE CutStructuredGrid.cxx )\n  target_link_libraries(CutStructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CutStructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/CutStructuredGrid/#download-and-build-cutstructuredgrid","title":"Download and Build CutStructuredGrid","text":"

Click here to download CutStructuredGrid and its CMakeLists.txt file. Once the tarball CutStructuredGrid.tar has been downloaded and extracted,

cd CutStructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CutStructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/CutWithCutFunction/","title":"CutWithCutFunction","text":"

vtk-examples/Cxx/VisualizationAlgorithms/CutWithCutFunction

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/CutWithCutFunction/#code","title":"Code","text":"

CutWithCutFunction.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCutter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" inputFilename(.vtp) [numberOfCuts]\"\n              << std::endl;\n    std::cout << \"where: inputFilename is Torso.vtp and\";\n    std::cout << \" numberOfCuts is 20.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string inputFilename = argv[1];\n\n  int numberOfCuts = 10;\n  if (argc > 2)\n  {\n    numberOfCuts = atoi(argv[2]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \" \" << bounds[2]\n            << \", \" << bounds[3] << \" \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin((bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0,\n                   bounds[4]);\n  plane->SetNormal(0, 0, 1);\n\n  // Create cutter.\n  double high = plane->EvaluateFunction(\n      (bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0, bounds[5]);\n\n  vtkNew<vtkCutter> cutter;\n  cutter->SetInputConnection(reader->GetOutputPort());\n  cutter->SetCutFunction(plane);\n  cutter->GenerateValues(numberOfCuts, .99, .99 * high);\n\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n  cutterMapper->ScalarVisibilityOff();\n\n  // Create cut actor.\n  vtkNew<vtkActor> cutterActor;\n  cutterActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  cutterActor->GetProperty()->SetLineWidth(2);\n  cutterActor->SetMapper(cutterMapper);\n\n  // Create model actor.\n  vtkNew<vtkPolyDataMapper> modelMapper;\n  modelMapper->SetInputConnection(reader->GetOutputPort());\n  modelMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> modelActor;\n  modelActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n  modelActor->SetMapper(modelMapper);\n\n  // Create renderers and add actors of plane and model.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(cutterActor);\n  renderer->AddActor(modelActor);\n\n  // Add renderer to renderwindow and render.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(600, 600);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"CutWithCutFunction\");\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/CutWithCutFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CutWithCutFunction)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CutWithCutFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CutWithCutFunction MACOSX_BUNDLE CutWithCutFunction.cxx )\n  target_link_libraries(CutWithCutFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CutWithCutFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/CutWithCutFunction/#download-and-build-cutwithcutfunction","title":"Download and Build CutWithCutFunction","text":"

Click here to download CutWithCutFunction and its CMakeLists.txt file. Once the tarball CutWithCutFunction.tar has been downloaded and extracted,

cd CutWithCutFunction/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CutWithCutFunction\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/CutWithScalars/","title":"CutWithScalars","text":"

vtk-examples/Cxx/VisualizationAlgorithms/CutWithScalars

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/CutWithScalars/#description","title":"Description","text":"

This example cuts a surface model of the skin with a series of planes produces contour lines. Lines are wrapped with tubes for clarity.

Info

See Figure 6-33 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/CutWithScalars/#code","title":"Code","text":"

CutWithScalars.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" inputFilename(.vtp) [numberOfCuts]\"\n              << std::endl;\n    std::cout << \"where: inputFilename is Torso.vtp and\";\n    std::cout << \" numberOfCuts is 20.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string inputFilename = argv[1];\n\n  int numberOfCuts = 10;\n  if (argc > 2)\n  {\n    numberOfCuts = atoi(argv[2]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \" \" << bounds[2]\n            << \", \" << bounds[3] << \" \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin((bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0,\n                   (bounds[5] + bounds[4]) / 2.0);\n  plane->SetNormal(0, 0, 1);\n\n  // Create Scalars.\n  vtkNew<vtkDoubleArray> scalars;\n  int numberOfPoints = reader->GetOutput()->GetNumberOfPoints();\n  scalars->SetNumberOfTuples(numberOfPoints);\n  vtkPoints* pts = reader->GetOutput()->GetPoints();\n  for (int i = 0; i < numberOfPoints; ++i)\n  {\n    double point[3];\n    pts->GetPoint(i, point);\n    scalars->SetTuple1(i, plane->EvaluateFunction(point));\n  }\n  reader->GetOutput()->GetPointData()->SetScalars(scalars);\n  reader->GetOutput()->GetPointData()->GetScalars()->GetRange();\n\n  // Create cutter.\n  vtkNew<vtkContourFilter> cutter;\n  cutter->SetInputConnection(reader->GetOutputPort());\n  cutter->ComputeScalarsOff();\n  cutter->ComputeNormalsOff();\n  cutter->GenerateValues(\n      numberOfCuts,\n      .99 * reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[0],\n      .99 * reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[1]);\n\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n  cutterMapper->ScalarVisibilityOff();\n\n  // Create cut actor.\n  vtkNew<vtkActor> cutterActor;\n  cutterActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  cutterActor->GetProperty()->SetLineWidth(2);\n  cutterActor->SetMapper(cutterMapper);\n\n  // Create model actor.\n  vtkNew<vtkPolyDataMapper> modelMapper;\n  modelMapper->SetInputConnection(reader->GetOutputPort());\n  modelMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> modelActor;\n  modelActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n  modelActor->SetMapper(modelMapper);\n\n  // Create renderers and add actors of plane and model.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(cutterActor);\n  renderer->AddActor(modelActor);\n\n  // Add renderer to renderwindow and render.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(600, 600);\n  renderWindow->SetWindowName(\"CutWithScalars\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/CutWithScalars/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CutWithScalars)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CutWithScalars: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CutWithScalars MACOSX_BUNDLE CutWithScalars.cxx )\n  target_link_libraries(CutWithScalars PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CutWithScalars\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/CutWithScalars/#download-and-build-cutwithscalars","title":"Download and Build CutWithScalars","text":"

Click here to download CutWithScalars and its CMakeLists.txt file. Once the tarball CutWithScalars.tar has been downloaded and extracted,

cd CutWithScalars/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CutWithScalars\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/Cutter/","title":"Cutter","text":"

vtk-examples/Cxx/VisualizationAlgorithms/Cutter

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/Cutter/#code","title":"Code","text":"

Cutter.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkCutter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCubeSource> cube;\n  cube->SetXLength(40);\n  cube->SetYLength(30);\n  cube->SetZLength(20);\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cube->GetOutputPort());\n\n  // Create a plane to cut,here it cuts in the XZ direction (xz\n  // normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0)\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(10, 0, 0);\n  plane->SetNormal(1, 0, 0);\n\n  // Create cutter\n  vtkNew<vtkCutter> cutter;\n  cutter->SetCutFunction(plane);\n  cutter->SetInputConnection(cube->GetOutputPort());\n  cutter->Update();\n\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n  cutterMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  // Create plane actor\n  vtkNew<vtkActor> planeActor;\n  planeActor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  planeActor->GetProperty()->SetLineWidth(2);\n  planeActor->GetProperty()->SetAmbient(1.0);\n  planeActor->GetProperty()->SetDiffuse(0.0);\n  planeActor->SetMapper(cutterMapper);\n\n  // Create cube actor\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Aquamarine\").GetData());\n  cubeActor->GetProperty()->SetOpacity(0.5);\n  cubeActor->SetMapper(cubeMapper);\n\n  // Create renderers and add actors of plane and cube\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(planeActor); // display the rectangle resulting from the\n                                  // cut\n  renderer->AddActor(cubeActor);  // display the cube\n\n  // Add renderer to renderwindow and render\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(600, 600);\n  renderWindow->SetWindowName(\"Cutter\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-37.2611, -86.2155, 44.841);\n  camera->SetFocalPoint(0.569422, -1.65124, -2.49482);\n  camera->SetViewUp(0.160129, 0.42663, 0.890138);\n  camera->SetDistance(104.033);\n  camera->SetClippingRange(55.2019, 165.753);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/Cutter/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cutter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cutter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cutter MACOSX_BUNDLE Cutter.cxx )\n  target_link_libraries(Cutter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cutter\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/Cutter/#download-and-build-cutter","title":"Download and Build Cutter","text":"

Click here to download Cutter and its CMakeLists.txt file. Once the tarball Cutter.tar has been downloaded and extracted,

cd Cutter/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Cutter\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/DataSetSurface/","title":"DataSetSurface","text":"

vtk-examples/Cxx/VisualizationAlgorithms/DataSetSurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/DataSetSurface/#code","title":"Code","text":"

DataSetSurface.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkCutter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkHexahedron.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <array>\n#include <cstdlib>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup the coordinates of eight points\n  // (the two faces must be in counter clockwise order as viewed from the\n  // outside)\n  std::array<std::array<double, 3>, 8> pointCoords{{{{0.0, 0.0, 0.0}},\n                                                    {{1.0, 0.0, 0.0}},\n                                                    {{1.0, 1.0, 0.0}},\n                                                    {{0.0, 1.0, 0.0}},\n                                                    {{0.0, 0.0, 1.0}},\n                                                    {{1.0, 0.0, 1.0}},\n                                                    {{1.0, 1.0, 1.0}},\n                                                    {{0.0, 1.0, 1.0}}}};\n\n  // Create the points and a hexahedron from the points.\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkHexahedron> hexa;\n  for (auto i = 0; i < pointCoords.size(); ++i)\n  {\n    points->InsertNextPoint(pointCoords[i].data());\n    hexa->GetPointIds()->SetId(i, i);\n  }\n\n  // Add the hexahedron to a cell array.\n  vtkNew<vtkCellArray> hexs;\n  hexs->InsertNextCell(hexa);\n\n  // Add the points and hexahedron to an unstructured grid.\n  vtkNew<vtkUnstructuredGrid> uGrid;\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(hexa->GetCellType(), hexa->GetPointIds());\n\n  // Extract the outer (polygonal) surface.\n  vtkNew<vtkDataSetSurfaceFilter> surface;\n  surface->SetInputData(uGrid);\n  surface->Update();\n\n  vtkNew<vtkDataSetMapper> aBeamMapper;\n  aBeamMapper->SetInputConnection(surface->GetOutputPort());\n  vtkNew<vtkActor> aBeamActor;\n  aBeamActor->SetMapper(aBeamMapper);\n  aBeamActor->AddPosition(0, 0, 0);\n  aBeamActor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  aBeamActor->GetProperty()->SetOpacity(0.60);\n  aBeamActor->GetProperty()->EdgeVisibilityOn();\n  aBeamActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"Black\").GetData());\n  aBeamActor->GetProperty()->SetLineWidth(1.5);\n\n  // Create a plane to cut, here it cuts in the XZ direction\n  // (xz normal=(1,0,0); XY =(0,0,1), YZ =(0,1,0)\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(0.5, 0, 0);\n  plane->SetNormal(1, 0, 0);\n\n  // Create cutter\n  vtkNew<vtkCutter> cutter;\n  cutter->SetCutFunction(plane);\n  cutter->SetInputData(aBeamActor->GetMapper()->GetInput());\n  cutter->Update();\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n\n  // Create plane actor\n  vtkNew<vtkActor> planeActor;\n  planeActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  planeActor->GetProperty()->SetLineWidth(2);\n  planeActor->SetMapper(cutterMapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"DatasetSurface\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(aBeamActor);\n  renderer->AddActor(planeActor);\n  renderer->SetBackground(colors->GetColor3d(\"Seashell\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(-25);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/DataSetSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataSetSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataSetSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataSetSurface MACOSX_BUNDLE DataSetSurface.cxx )\n  target_link_libraries(DataSetSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataSetSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/DataSetSurface/#download-and-build-datasetsurface","title":"Download and Build DataSetSurface","text":"

Click here to download DataSetSurface and its CMakeLists.txt file. Once the tarball DataSetSurface.tar has been downloaded and extracted,

cd DataSetSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DataSetSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/DecimateFran/","title":"DecimateFran","text":"

vtk-examples/Cxx/VisualizationAlgorithms/DecimateFran

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/DecimateFran/#description","title":"Description","text":"

This examples shows reduction on the order of 90 percent for a 10:1 compression ratio. the wireframe image are shown to accentuate the density of the polygonal meshes. The left-hand image is the original data; the right-hand image is the decimated mesh.

Info

See Figure 9-27a in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/DecimateFran/#code","title":"Code","text":"

DecimateFran.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDecimatePro.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fran_cut.vtk fran_cut.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // This example shows how to use decimation to reduce a polygonal mesh. We\n  // also use mesh smoothing and generate surface normals to give a pleasing\n  // result.\n  //\n\n  // We start by reading some data that was originally captured from\n  // a Cyberware laser digitizing system.\n  //\n  vtkNew<vtkPolyDataReader> fran;\n  fran->SetFileName(argv[1]);\n\n  // Read the corresponding texture\n  vtkNew<vtkPNGReader> textureReader;\n  textureReader->SetFileName(argv[2]);\n\n  vtkNew<vtkTexture> texture;\n  texture->InterpolateOn();\n  texture->SetInputConnection(textureReader->GetOutputPort());\n\n  // We want to preserve topology (not let any cracks form). This may limit\n  // the total reduction possible, which we have specified at 90%.\n  //\n  vtkNew<vtkDecimatePro> deci;\n  deci->SetInputConnection(fran->GetOutputPort());\n  deci->SetTargetReduction(0.9);\n  deci->PreserveTopologyOn();\n\n  vtkNew<vtkPolyDataNormals> decimatedNormals;\n  decimatedNormals->SetInputConnection(deci->GetOutputPort());\n  decimatedNormals->FlipNormalsOn();\n  decimatedNormals->SetFeatureAngle(60);\n\n  vtkNew<vtkPolyDataNormals> originalNormals;\n  originalNormals->SetInputConnection(fran->GetOutputPort());\n  originalNormals->FlipNormalsOn();\n  originalNormals->SetFeatureAngle(60);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> decimatedMapper;\n  decimatedMapper->SetInputConnection(decimatedNormals->GetOutputPort());\n\n  vtkNew<vtkActor> decimatedActor;\n  decimatedActor->SetMapper(decimatedMapper);\n  decimatedActor->GetProperty()->SetAmbient(.5);\n  decimatedActor->GetProperty()->SetDiffuse(.5);\n  decimatedActor->SetTexture(texture);\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(originalNormals->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetAmbient(.5);\n  originalActor->GetProperty()->SetDiffuse(.5);\n  originalActor->SetTexture(texture);\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> renderer1;\n  renderer1->SetViewport(0.0, 0.0, 0.5, 1.0);\n\n  vtkNew<vtkRenderer> renderer2;\n  renderer2->SetViewport(0.5, 0.0, 1.0, 1.0);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer1);\n  renderWindow->AddRenderer(renderer2);\n  renderWindow->SetWindowName(\"DecimateFran\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer1->AddActor(originalActor);\n  renderer2->AddActor(decimatedActor);\n  renderer1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer2->SetBackground(colors->GetColor3d(\"Papaya_Whip\").GetData());\n  renderWindow->SetSize(800, 400);\n\n  // render the image\n  //\n  vtkNew<vtkCamera> cam1;\n  cam1->SetClippingRange(0.0475572, 2.37786);\n  cam1->SetFocalPoint(0.052665, -0.129454, -0.0573973);\n  cam1->SetPosition(0.327637, -0.116299, -0.256418);\n  cam1->SetViewUp(-0.0225386, 0.999137, 0.034901);\n  renderer1->SetActiveCamera(cam1);\n  renderer2->SetActiveCamera(cam1);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/DecimateFran/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DecimateFran)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOImage\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DecimateFran: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DecimateFran MACOSX_BUNDLE DecimateFran.cxx )\n  target_link_libraries(DecimateFran PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DecimateFran\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/DecimateFran/#download-and-build-decimatefran","title":"Download and Build DecimateFran","text":"

Click here to download DecimateFran and its CMakeLists.txt file. Once the tarball DecimateFran.tar has been downloaded and extracted,

cd DecimateFran/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DecimateFran\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/DecimateHawaii/","title":"DecimateHawaii","text":"

vtk-examples/Cxx/VisualizationAlgorithms/DecimateHawaii

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/DecimateHawaii/#description","title":"Description","text":"

This examples shows reduction on the order of 90 percent for a 10:1 compression ratio. the wireframe image are shown to accentuate the density of the polygonal meshes. The left-hand image is the original data; the right-hand image is the decimated mesh.

Info

See Figure 9-27b in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/DecimateHawaii/#code","title":"Code","text":"

DecimateHawaii.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDecimatePro.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" honolulu.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // This example shows how to use decimation to reduce a polygonal mesh. We\n  // also use mesh smoothing and generate surface normals to give a pleasing\n  // result.\n  //\n\n  vtkNew<vtkPolyDataReader> hawaii;\n  hawaii->SetFileName(argv[1]);\n\n  // We want to preserve topology (not let any cracks form). This may limit\n  // the total reduction possible, which we have specified at 90%.\n  //\n  vtkNew<vtkDecimatePro> deci;\n  deci->SetInputConnection(hawaii->GetOutputPort());\n  deci->SetTargetReduction(0.9);\n  deci->PreserveTopologyOn();\n\n  vtkNew<vtkPolyDataNormals> decimatedNormals;\n  decimatedNormals->SetInputConnection(deci->GetOutputPort());\n  decimatedNormals->FlipNormalsOn();\n  decimatedNormals->SetFeatureAngle(60);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> decimatedMapper;\n  decimatedMapper->SetInputConnection(decimatedNormals->GetOutputPort());\n\n  vtkNew<vtkActor> decimatedActor;\n  decimatedActor->SetMapper(decimatedMapper);\n  decimatedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Sienna\").GetData());\n  decimatedActor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(decimatedNormals->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Sienna\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> renderer1;\n  renderer1->SetViewport(0.0, 0.0, 0.5, 1.0);\n\n  vtkNew<vtkRenderer> renderer2;\n  renderer2->SetViewport(0.5, 0.0, 1.0, 1.0);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer1);\n  renderWindow->AddRenderer(renderer2);\n  renderWindow->SetWindowName(\"DecimateHawaii\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  renderer1->AddActor(originalActor);\n  renderer2->AddActor(decimatedActor);\n  renderer1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer2->SetBackground(colors->GetColor3d(\"Papaya_Whip\").GetData());\n  renderWindow->SetSize(800, 400);\n\n  // Render the image.\n  //\n  vtkNew<vtkCamera> cam1;\n  renderer1->SetActiveCamera(cam1);\n  renderer2->SetActiveCamera(cam1);\n  renderer1->ResetCamera();\n  cam1->Elevation(-30);\n  cam1->Dolly(1.2);\n  renderer1->ResetCameraClippingRange();\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/DecimateHawaii/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DecimateHawaii)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DecimateHawaii: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DecimateHawaii MACOSX_BUNDLE DecimateHawaii.cxx )\n  target_link_libraries(DecimateHawaii PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DecimateHawaii\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/DecimateHawaii/#download-and-build-decimatehawaii","title":"Download and Build DecimateHawaii","text":"

Click here to download DecimateHawaii and its CMakeLists.txt file. Once the tarball DecimateHawaii.tar has been downloaded and extracted,

cd DecimateHawaii/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DecimateHawaii\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/DisplacementPlot/","title":"DisplacementPlot","text":"

vtk-examples/Cxx/VisualizationAlgorithms/DisplacementPlot

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/DisplacementPlot/#description","title":"Description","text":"

This example shows modal lines for a vibrating rectangular beam. The vibration mode in this figure is the second torsional mode, clearly indicated by the crossing modal lines.

The default color scheme shows cool color for maximum negative motion, warm color maximum positive motion, with white at the nodes.

For other possible color maps see: Diverging Color Maps for Scientific Visualization.

Info

See Figure 6-15 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/DisplacementPlot/#code","title":"Code","text":"

DisplacementPlot.cxx

// Translated from dispPlot.tcl\n/*\nProduce figure 6-15(b) from the VTK Textbook.\nSurface plot of a vibrating plane.\n\nThe color_scheme option allows you to select a series of colour schemes.\n0: The default:- cool maximum negative motion,\n                 warm maximum positive motion, white at the nodes.\n1: Alternate choice:- green maximum negative motion,\n                      purple maximum positive motion, white at the nodes.\n2: The original:- white at maximum motion, black at the nodes.\n\n*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorDot.h>\n#include <vtkWarpVector.h>\n\nnamespace {\n//! Create a lookup table.\n/*!\n@param lut - An indexed lookup table.\n*/\nvoid MakeLUT(int const& colorScheme, vtkLookupTable* lut);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [colorScheme]\" << std::endl;\n    std::cout << \"where: filename is the file plate.vtk.\" << std::endl;\n    std::cout << \"       colorScheme is 0, 1, or 2, default 0\" << std::endl;\n    std::cout << \"Produces figure 6-15(b) Surface plot of vibrating plane from \"\n                 \"the VTK Textbook.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int colorScheme = 0;\n  std::string fileName = argv[1];\n\n  if (argc == 3)\n  {\n    colorScheme = std::abs(atoi(argv[2]));\n    colorScheme = (colorScheme > 2) ? 0 : colorScheme;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read a vtk file\n  //\n  vtkNew<vtkPolyDataReader> plate;\n  plate->SetFileName(fileName.c_str());\n  plate->SetVectorsName(\"mode8\");\n  plate->Update();\n\n  vtkNew<vtkWarpVector> warp;\n  warp->SetInputConnection(plate->GetOutputPort());\n  warp->SetScaleFactor(0.5);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(warp->GetOutputPort());\n\n  vtkNew<vtkVectorDot> color;\n  color->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkLookupTable> lut;\n  MakeLUT(colorScheme, lut);\n\n  vtkNew<vtkDataSetMapper> plateMapper;\n  plateMapper->SetInputConnection(color->GetOutputPort());\n  plateMapper->SetLookupTable(lut);\n  plateMapper->SetScalarRange(-1, 1);\n\n  vtkNew<vtkActor> plateActor;\n  plateActor->SetMapper(plateMapper);\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"DisplacementPlot\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren->AddActor(plateActor);\n  ren->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  ren->GetActiveCamera()->SetPosition(13.3991, 14.0764, 9.97787);\n  ren->GetActiveCamera()->SetFocalPoint(1.50437, 0.481517, 4.52992);\n  ren->GetActiveCamera()->SetViewAngle(30);\n  ren->GetActiveCamera()->SetViewUp(-0.120861, 0.458556, -0.880408);\n  ren->GetActiveCamera()->SetClippingRange(12.5724, 26.8374);\n  // Render the image.\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeLUT(int const& colorScheme, vtkLookupTable* lut)\n{\n  // See: [Diverging Color Maps for Scientific Visualization]\n  //      (http://www.kennethmoreland.com/color-maps/)\n  auto nc = 256;\n  vtkNew<vtkColorTransferFunction> ctf;\n  switch (colorScheme)\n  {\n  case 0:\n  default:\n    // Cool to warm diverging.\n    ctf->SetColorSpaceToDiverging();\n    ctf->AddRGBPoint(0.0, 0.230, 0.299, 0.754);\n    ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n    ctf->AddRGBPoint(1.0, 0.706, 0.016, 0.150);\n    lut->SetNumberOfTableValues(nc);\n    lut->Build();\n    for (auto i = 0; i < nc; ++i)\n    {\n      double rgb[4] = {0.0, 0.0, 0.0, 1.0};\n      ctf->GetColor(static_cast<double>(i) / nc, rgb);\n      lut->SetTableValue(i, rgb);\n    }\n    break;\n  case 1:\n    // Green to purple diverging.\n    ctf->SetColorSpaceToDiverging();\n    ctf->AddRGBPoint(0.0, 0.085, 0.532, 0.201);\n    ctf->AddRGBPoint(1.0, 0.436, 0.308, 0.631);\n    lut->SetNumberOfTableValues(nc);\n    lut->Build();\n    for (auto i = 0; i < nc; ++i)\n    {\n      double rgb[4] = {0.0, 0.0, 0.0, 1.0};\n      ctf->GetColor(static_cast<double>(i) / nc, rgb);\n      lut->SetTableValue(i, rgb);\n    }\n    break;\n  case 2: {\n    // Make a lookup table, black in the centre with bright areas\n    //   at the beginning and end of the table.\n    // This is from the original code.\n    auto nc2 = nc / 2;\n    lut->SetNumberOfColors(nc);\n    lut->Build();\n    for (auto i = 0; i < nc2; ++i)\n    {\n      // White to black.\n      auto v = (double(nc2) - i) / double(nc2);\n      lut->SetTableValue(i, v, v, v, 1);\n    }\n    for (auto i = nc2; i < nc; ++i)\n    {\n      // Black to white.\n      auto v = (i - double(nc2)) / double(nc2);\n      lut->SetTableValue(i, v, v, v, 1);\n    }\n    break;\n  }\n  }\n}\n} // namespace\n
"},{"location":"Cxx/VisualizationAlgorithms/DisplacementPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DisplacementPlot)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DisplacementPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DisplacementPlot MACOSX_BUNDLE DisplacementPlot.cxx )\n  target_link_libraries(DisplacementPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DisplacementPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/DisplacementPlot/#download-and-build-displacementplot","title":"Download and Build DisplacementPlot","text":"

Click here to download DisplacementPlot and its CMakeLists.txt file. Once the tarball DisplacementPlot.tar has been downloaded and extracted,

cd DisplacementPlot/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DisplacementPlot\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/ExponentialCosine/","title":"ExponentialCosine","text":"

vtk-examples/Cxx/VisualizationAlgorithms/ExponentialCosine

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/ExponentialCosine/#description","title":"Description","text":"

Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values.

Info

See Figure 9-4a in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/ExponentialCosine/#code","title":"Code","text":"

ExponentialCosine.cxx

//\n// Brute force computation of Bessel functions. Might be better to create a\n// filter (or source) object. Might also consider vtkSampleFunction.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkWarpScalar.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create plane to warp.\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetResolution(300, 300);\n\n  vtkNew<vtkTransform> transform;\n  transform->Scale(10.0, 10.0, 1.0);\n\n  vtkNew<vtkTransformPolyDataFilter> transF;\n  transF->SetInputConnection(plane->GetOutputPort());\n  transF->SetTransform(transform);\n  transF->Update();\n\n  // Compute Bessel function and derivatives. This portion could be\n  // encapsulated into source or filter object.\n  //\n  auto input = transF->GetOutput();\n  auto numPts = input->GetNumberOfPoints();\n\n  vtkNew<vtkPoints> newPts;\n  newPts->SetNumberOfPoints(numPts);\n\n  vtkNew<vtkDoubleArray> derivs;\n  derivs->SetNumberOfTuples(numPts);\n\n  vtkNew<vtkPolyData> bessel;\n  bessel->CopyStructure(input);\n  bessel->SetPoints(newPts);\n  bessel->GetPointData()->SetScalars(derivs);\n\n  double x[3];\n\n  for (auto i = 0; i < numPts; i++)\n  {\n    input->GetPoint(i, x);\n    auto r = sqrt(static_cast<double>(x[0] * x[0]) + x[1] * x[1]);\n    x[2] = exp(-r) * cos(10.0 * r);\n    newPts->SetPoint(i, x);\n    auto deriv = -exp(-r) * (cos(10.0 * r) + 10.0 * sin(10.0 * r));\n    derivs->SetValue(i, deriv);\n  }\n\n  // Warp plane.\n  vtkNew<vtkWarpScalar> warp;\n  warp->SetInputData(bessel);\n  warp->XYPlaneOn();\n  warp->SetScaleFactor(0.5);\n\n  // Mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(warp->GetOutputPort());\n  double tmp[2];\n  bessel->GetScalarRange(tmp);\n  mapper->SetScalarRange(tmp[0], tmp[1]);\n\n  vtkNew<vtkActor> carpet;\n  carpet->SetMapper(mapper);\n\n  // Assign our actor to the renderer.\n  ren->AddActor(carpet);\n  ren->SetBackground(colors->GetColor3d(\"Beige\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ExponentialCosine\");\n\n  // Draw the resulting scene.\n  ren->ResetCamera();\n  ren->GetActiveCamera()->Zoom(1.35);\n  ren->GetActiveCamera()->Elevation(-55);\n  ren->GetActiveCamera()->Azimuth(25);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/ExponentialCosine/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExponentialCosine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExponentialCosine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExponentialCosine MACOSX_BUNDLE ExponentialCosine.cxx )\n  target_link_libraries(ExponentialCosine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExponentialCosine\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/ExponentialCosine/#download-and-build-exponentialcosine","title":"Download and Build ExponentialCosine","text":"

Click here to download ExponentialCosine and its CMakeLists.txt file. Once the tarball ExponentialCosine.tar has been downloaded and extracted,

cd ExponentialCosine/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExponentialCosine\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/ExtractData/","title":"ExtractData","text":"

vtk-examples/Cxx/VisualizationAlgorithms/ExtractData

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/ExtractData/#description","title":"Description","text":"

This example takes advantage of the properties of implicit functions to select and cut data. In particular it uses the region separation property to select data. Selecting or extracting data with an implicit function means choosing cells and points (and associated attribute data) that lie within a particular region of the function. To determine whether a point x-y-z lies within a region, we simply evaluate the point and examine the sign of the result. A cell lies in a region if all its points lie in the region. Here, two ellipses are used in combination to select voxels within a volume dataset. Note that extracting data often changes the structure of the dataset. In this example the input type is a image data dataset, while the output type is an unstructured grid dataset.

Info

See Figure 6-24 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/ExtractData/#code","title":"Code","text":"

ExtractData.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractGeometry.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkShrinkFilter.h>\n#include <vtkSphere.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  // extract data\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0);\n\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(quadric);\n  sample->ComputeNormalsOff();\n\n  vtkNew<vtkTransform> trans;\n  trans->Scale(1, 0.5, 0.333);\n\n  vtkNew<vtkSphere> sphere;\n  sphere->SetRadius(0.25);\n  sphere->SetTransform(trans);\n\n  vtkNew<vtkTransform> trans2;\n  trans2->Scale(0.25, 0.5, 1.0);\n\n  vtkNew<vtkSphere> sphere2;\n  sphere2->SetRadius(0.25);\n  sphere2->SetTransform(trans2);\n\n  vtkNew<vtkImplicitBoolean> booleanUnion;\n  booleanUnion->AddFunction(sphere);\n  booleanUnion->AddFunction(sphere2);\n  booleanUnion->SetOperationType(0); // boolean Union\n\n  vtkNew<vtkExtractGeometry> extract;\n  extract->SetInputConnection(sample->GetOutputPort());\n  extract->SetImplicitFunction(booleanUnion);\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(extract->GetOutputPort());\n  shrink->SetShrinkFactor(0.5);\n\n  vtkNew<vtkDataSetMapper> dataMapper;\n  dataMapper->SetInputConnection(shrink->GetOutputPort());\n  vtkNew<vtkActor> dataActor;\n  dataActor->SetMapper(dataMapper);\n\n  // outline\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(sample->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(0, 0, 0);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(dataActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ExtractData\");\n  renWin->Render();\n\n  ren1->GetActiveCamera()->Azimuth(30);\n  ren1->GetActiveCamera()->Elevation(30);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/ExtractData/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersExtraction\n  FiltersGeneral\n  FiltersModeling\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractData MACOSX_BUNDLE ExtractData.cxx )\n  target_link_libraries(ExtractData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractData\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/ExtractData/#download-and-build-extractdata","title":"Download and Build ExtractData","text":"

Click here to download ExtractData and its CMakeLists.txt file. Once the tarball ExtractData.tar has been downloaded and extracted,

cd ExtractData/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ExtractData\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/FilledContours/","title":"FilledContours","text":"

vtk-examples/Cxx/VisualizationAlgorithms/FilledContours

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/FilledContours/#description","title":"Description","text":"

This example produces filled contours using the vtkClipPolyData filter. There is a sample data file src/Testing/Data/filledContours.vtp.

Note

This original source code for this example is here.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/FilledContours/#code","title":"Code","text":"

FilledContours.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCellData.h>\n#include <vtkCleanPolyData.h>\n#include <vtkClipPolyData.h>\n#include <vtkContourFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr\n        << \"Usage: \" << argv[0]\n        << \" InputPolyDataFile(.vtp) NumberOfContours e.g filledContours.vtp 10\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the file\n  vtkNew<vtkXMLPolyDataReader> reader;\n\n  reader->SetFileName(argv[1]);\n  reader->Update(); // Update so that we can get the scalar range.\n\n  double scalarRange[2];\n  reader->GetOutput()->GetPointData()->GetScalars()->GetRange(scalarRange);\n\n  vtkNew<vtkAppendPolyData> appendFilledContours;\n\n  int numberOfContours = atoi(argv[2]);\n\n  double delta = (scalarRange[1] - scalarRange[0]) /\n      static_cast<double>(numberOfContours - 1);\n\n  // Keep the clippers alive.\n  std::vector<vtkSmartPointer<vtkClipPolyData>> clippersLo;\n  std::vector<vtkSmartPointer<vtkClipPolyData>> clippersHi;\n\n  for (int i = 0; i < numberOfContours; i++)\n  {\n    double valueLo = scalarRange[0] + static_cast<double>(i) * delta;\n    double valueHi = scalarRange[0] + static_cast<double>(i + 1) * delta;\n    clippersLo.push_back(vtkSmartPointer<vtkClipPolyData>::New());\n    clippersLo[i]->SetValue(valueLo);\n    if (i == 0)\n    {\n      clippersLo[i]->SetInputConnection(reader->GetOutputPort());\n    }\n    else\n    {\n      clippersLo[i]->SetInputConnection(clippersHi[i - 1]->GetOutputPort(1));\n    }\n    clippersLo[i]->InsideOutOff();\n    clippersLo[i]->Update();\n\n    clippersHi.push_back(vtkSmartPointer<vtkClipPolyData>::New());\n    clippersHi[i]->SetValue(valueHi);\n    clippersHi[i]->SetInputConnection(clippersLo[i]->GetOutputPort());\n    clippersHi[i]->GenerateClippedOutputOn();\n    clippersHi[i]->InsideOutOn();\n    clippersHi[i]->Update();\n    if (clippersHi[i]->GetOutput()->GetNumberOfCells() == 0)\n    {\n      continue;\n    }\n\n    vtkNew<vtkFloatArray> cd;\n    cd->SetNumberOfComponents(1);\n    cd->SetNumberOfTuples(clippersHi[i]->GetOutput()->GetNumberOfCells());\n    cd->FillComponent(0, valueLo);\n\n    clippersHi[i]->GetOutput()->GetCellData()->SetScalars(cd);\n    appendFilledContours->AddInputConnection(clippersHi[i]->GetOutputPort());\n  }\n\n  vtkNew<vtkCleanPolyData> filledContours;\n  filledContours->SetInputConnection(appendFilledContours->GetOutputPort());\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(numberOfContours + 1);\n  lut->Build();\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(filledContours->GetOutputPort());\n  contourMapper->SetScalarRange(scalarRange[0], scalarRange[1]);\n  contourMapper->SetScalarModeToUseCellData();\n  contourMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n  contourActor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(filledContours->GetOutputPort());\n  contours->GenerateValues(numberOfContours, scalarRange[0], scalarRange[1]);\n\n  vtkNew<vtkPolyDataMapper> contourLineMapperer;\n  contourLineMapperer->SetInputConnection(contours->GetOutputPort());\n  contourLineMapperer->SetScalarRange(scalarRange[0], scalarRange[1]);\n  contourLineMapperer->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> contourLineActor;\n  contourLineActor->SetMapper(contourLineMapperer);\n  contourLineActor->GetProperty()->SetLineWidth(2);\n\n  // The usual renderer, render window and interactor.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"FilledContours\");\n\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors\n  ren1->AddActor(contourActor);\n  ren1->AddActor(contourLineActor);\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Begin interaction.\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/FilledContours/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FilledContours)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FilledContours: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FilledContours MACOSX_BUNDLE FilledContours.cxx )\n  target_link_libraries(FilledContours PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FilledContours\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/FilledContours/#download-and-build-filledcontours","title":"Download and Build FilledContours","text":"

Click here to download FilledContours and its CMakeLists.txt file. Once the tarball FilledContours.tar has been downloaded and extracted,

cd FilledContours/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FilledContours\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/FindCellIntersections/","title":"FindCellIntersections","text":"

vtk-examples/Cxx/VisualizationAlgorithms/FindCellIntersections

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/FindCellIntersections/#description","title":"Description","text":"

This example shows how to use cell locator's FindCellsAlongLine method to visualize the cells that are intersected in an unstructured grid. The example uses the data file: src/Testing/Data/Disc_BiQuadraticQuads_0_0.vtu.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/FindCellIntersections/#code","title":"Code","text":"

FindCellIntersections.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellLocator.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkIdList.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" filename.vtu e.g. Disc_BiQuadraticQuads_0_0.vtu\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Get the filename from the command line.\n  std::string inputFilename = argv[1];\n\n  // Read a xml unstructured grid dataset\n  vtkNew<vtkXMLUnstructuredGridReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // The line goes through the center of the data and runs along the x axis.\n  double center[3];\n  reader->GetOutput()->GetCenter(center);\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n\n  double startRay[3];\n  startRay[0] = bounds[0] - center[0];\n  startRay[1] = center[1];\n  startRay[2] = center[2];\n\n  double endRay[3];\n  endRay[0] = bounds[1] + center[0];\n  endRay[1] = center[1];\n  endRay[2] = center[2];\n  std::cout << \"center: \" << center[0] << \", \" << center[1] << \", \" << center[2]\n            << std::endl;\n  std::cout << \"startRay: \" << startRay[0] << \", \" << startRay[1] << \", \"\n            << startRay[2] << std::endl;\n  std::cout << \"endRay: \" << endRay[0] << \", \" << endRay[1] << \", \" << endRay[2]\n            << std::endl;\n\n  // Initialize all of the cell data colors.\n  vtkNew<vtkUnsignedCharArray> cellData;\n  cellData->SetNumberOfComponents(3);\n  cellData->SetNumberOfTuples(reader->GetOutput()->GetNumberOfCells());\n  reader->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  // A lambda to scale the contents of the array x by 255.\n  auto scale = [](double* x) {\n    for (int i = 0; i < 3; ++i)\n    {\n      x[i] = x[i] * 255;\n    };\n  };\n\n  double rgb[3]{0, 0, 0};\n  colors->GetColorRGB(\"Banana\", rgb);\n  scale(rgb);\n  for (int i = 0; i < cellData->GetNumberOfTuples(); ++i)\n  {\n    cellData->InsertTuple(i, rgb);\n  }\n\n  // Find the cells that intersect the line and color those cells.\n  vtkNew<vtkIdList> cellIds;\n  vtkNew<vtkCellLocator> locator;\n  locator->SetDataSet(reader->GetOutput());\n  locator->BuildLocator();\n  locator->FindCellsAlongLine(startRay, endRay, 0.001, cellIds);\n\n  colors->GetColorRGB(\"Tomato\", rgb);\n  scale(rgb);\n  for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); ++i)\n  {\n    cellData->InsertTuple(cellIds->GetId(i), rgb);\n  }\n\n  // Shrink each cell to make them visible.\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(reader->GetOutputPort());\n  shrink->SetShrinkFactor(0.95);\n\n  // Convert the cells to polydata.\n  vtkNew<vtkDataSetSurfaceFilter> surface;\n  surface->SetInputConnection(shrink->GetOutputPort());\n  surface->SetNonlinearSubdivisionLevel(2);\n  surface->Update();\n\n  // Create a line.\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(startRay);\n  lineSource->SetPoint2(endRay);\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(lineSource->GetOutputPort());\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n\n  // Render the results.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOn();\n  mapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->AddActor(lineActor);\n  renderer->SetBackground(colors->GetColor3d(\"Cobalt\").GetData());\n\n  // Make an oblique view.\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  iren->SetRenderWindow(renWin);\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"FindCellIntersections\");\n\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/FindCellIntersections/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FindCellIntersections)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersGeometry\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FindCellIntersections: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FindCellIntersections MACOSX_BUNDLE FindCellIntersections.cxx )\n  target_link_libraries(FindCellIntersections PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FindCellIntersections\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/FindCellIntersections/#download-and-build-findcellintersections","title":"Download and Build FindCellIntersections","text":"

Click here to download FindCellIntersections and its CMakeLists.txt file. Once the tarball FindCellIntersections.tar has been downloaded and extracted,

cd FindCellIntersections/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FindCellIntersections\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/FireFlow/","title":"FireFlow","text":"

vtk-examples/Cxx/VisualizationAlgorithms/FireFlow

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/FireFlow/#description","title":"Description","text":"

The example illustrates how to combine a geometric description of a scene with a fluid flow solution. The vtkVRMLImporter read the geometry file which is a .wrl file. The file contains 32 actors. The vtkXMLUnstructuredGridReader reads the solution.

vtkStreamTracer generates streamline seeds with points generated by vtkPointSource. vtkContourFilter generates an isosurface of the velocity. A vtkSphereSource shows the sphere used in the vtkPointSource filter.

For an interactive version of this example, see FireFlowDemo.

Cite

The solution and geometry data is from the Mayavi project. Mayavi is a python application that provides an easy to use interface to many vtk filters. Both a command-line and GUI interface are provided. If you use the Mayavi data or the Mayavi application, please use the following citation in any published work: Ramachandran, P. and Varoquaux, G., Mayavi: 3D Visualization of Scientific Data IEEE Computing in Science & Engineering, 13 (2), pp. 40-51 (2011).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/FireFlow/#code","title":"Code","text":"

FireFlow.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkGenericOutlineFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkStreamTracer.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVRMLImporter.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \"  geometry.wrl velocity.vtu e.g. room_vis.wrl fire_ug.vtu\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d isoSurfaceColor = colors->GetColor3d(\"WhiteSmoke\");\n  vtkColor3d sphereColor = colors->GetColor3d(\"hotpink\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SlateGray\");\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Import the VRML Files that define the geometry.\n  vtkNew<vtkVRMLImporter> vrmlImport;\n  vrmlImport->SetRenderWindow(renderWindow);\n  vrmlImport->SetFileName(argv[1]);\n  vrmlImport->Update();\n\n  // Read the UnstructuredGrid define the solution.\n  vtkNew<vtkXMLUnstructuredGridReader> solution;\n  solution->SetFileName(argv[2]);\n  solution->Update();\n\n  // Create an outline.\n  vtkNew<vtkGenericOutlineFilter> outline;\n  outline->SetInputConnection(solution->GetOutputPort());\n\n  // Create Seeds.\n  vtkNew<vtkPointSource> seeds;\n  seeds->SetRadius(0.2);\n  seeds->SetCenter(3.5, 0.625, 1.25);\n  seeds->SetNumberOfPoints(50);\n\n  // Create streamlines.\n  vtkNew<vtkStreamTracer> streamTracer;\n  streamTracer->SetIntegrationDirectionToBoth();\n  streamTracer->SetInputConnection(solution->GetOutputPort());\n  streamTracer->SetSourceConnection(seeds->GetOutputPort());\n  streamTracer->SetMaximumPropagation(50);\n  streamTracer->SetInitialIntegrationStep(.2);\n  streamTracer->SetMinimumIntegrationStep(.01);\n  streamTracer->SetIntegratorType(1);\n  streamTracer->SetComputeVorticity(1);\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(streamTracer->GetOutputPort());\n  tubes->SetNumberOfSides(8);\n  tubes->SetRadius(.02);\n  tubes->SetVaryRadius(0);\n\n  vtkNew<vtkPolyDataMapper> mapTubes;\n  mapTubes->SetInputConnection(tubes->GetOutputPort());\n  mapTubes->SetScalarRange(solution->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> tubesActor;\n  tubesActor->SetMapper(mapTubes);\n\n  // Create an Isosurface.\n  vtkNew<vtkContourFilter> isoSurface;\n  isoSurface->SetValue(0, 550.0);\n  isoSurface->SetInputConnection(solution->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> isoSurfaceMapper;\n  isoSurfaceMapper->SetInputConnection(isoSurface->GetOutputPort());\n  isoSurfaceMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoSurfaceActor;\n  isoSurfaceActor->SetMapper(isoSurfaceMapper);\n  isoSurfaceActor->GetProperty()->SetOpacity(.5);\n  isoSurfaceActor->GetProperty()->SetDiffuseColor(isoSurfaceColor.GetData());\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetCenter(seeds->GetCenter());\n  sphere->SetRadius(seeds->GetRadius());\n  sphere->SetThetaResolution(20);\n  sphere->SetPhiResolution(11);\n  ;\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetOpacity(1.0);\n  sphereActor->GetProperty()->SetSpecular(.4);\n  sphereActor->GetProperty()->SetSpecularPower(80);\n  sphereActor->GetProperty()->SetDiffuseColor(sphereColor.GetData());\n\n  renderer->AddActor(tubesActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(isoSurfaceActor);\n\n  renderer->SetBackground(backgroundColor.GetData());\n  renderWindow->SetSize(640, 512);\n  renderWindow->SetWindowName(\"FireFlow\");\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Azimuth(20.0);\n  renderer->GetActiveCamera()->Elevation(10.0);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/FireFlow/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FireFlow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeneric\n  FiltersSources\n  IOImport\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FireFlow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FireFlow MACOSX_BUNDLE FireFlow.cxx )\n  target_link_libraries(FireFlow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FireFlow\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/FireFlow/#download-and-build-fireflow","title":"Download and Build FireFlow","text":"

Click here to download FireFlow and its CMakeLists.txt file. Once the tarball FireFlow.tar has been downloaded and extracted,

cd FireFlow/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FireFlow\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/FireFlowDemo/","title":"FireFlowDemo","text":"

vtk-examples/Cxx/VisualizationAlgorithms/FireFlowDemo

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/FireFlowDemo/#description","title":"Description","text":"

This example adds interaction to FireFlow.

The example uses vtkSliderWidget's to manipulate the center of the vtkPointSource that provides seed for the streamlines. As the X, Y, or Z center corrdiantes change, the streamlines are changed. The range of the x, y, and z coordinates are limited to the bounds of the solution dataset. There is a built in delay of 500 milliseconds to make the animation between selections consistent.

Here's the embedded video

showing the interactive movement of the seeding sphere.

Cite

The solution and geometry data is from the Mayavi project. Mayavi is a python application that provides an easy to use interface to many vtk filters. Both a command-line and GUI interface are provided. If you use the Mayavi data or the Mayavi application, please use the following citation in any published work: Ramachandran, P. and Varoquaux, G., Mayavi: 3D Visualization of Scientific Data IEEE Computing in Science & Engineering, 13 (2), pp. 40-51 (2011).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/FireFlowDemo/#code","title":"Code","text":"

FireFlowDemo.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkGenericOutlineFilter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkStreamTracer.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVRMLImporter.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\n#include <array>\n#include <chrono>\n#include <iostream>\n#include <string>\n#include <thread>\n\nnamespace {\nvoid MakeXWidget(vtkSliderWidget*, vtkPointSource*, vtkSphereSource*,\n                 vtkRenderer*, vtkRenderWindowInteractor*);\nvoid MakeYWidget(vtkSliderWidget*, vtkPointSource*, vtkSphereSource*,\n                 vtkRenderer*, vtkRenderWindowInteractor*);\nvoid MakeZWidget(vtkSliderWidget*, vtkPointSource*, vtkSphereSource*,\n                 vtkRenderer*, vtkRenderWindowInteractor*);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \"  geometry.wrl velocity.vtu e.g. room_vis.wrl fire_ug.vtu\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d isoSurfaceColor = colors->GetColor3d(\"WhiteSmoke\");\n  vtkColor3d sphereColor = colors->GetColor3d(\"hotpink\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SlateGray\");\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Import the VRML Files that define the geometry.\n  vtkNew<vtkVRMLImporter> vrmlImport;\n  vrmlImport->SetRenderWindow(renderWindow);\n  vrmlImport->SetFileName(argv[1]);\n  vrmlImport->Update();\n\n  // Read the UnstructuredGrid define the solution.\n  vtkNew<vtkXMLUnstructuredGridReader> solution;\n  solution->SetFileName(argv[2]);\n  solution->Update();\n\n  std::array<double, 6> bounds;\n  solution->GetOutput()->GetBounds(bounds.data());\n\n  // Create an outline.\n  vtkNew<vtkGenericOutlineFilter> outline;\n  outline->SetInputConnection(solution->GetOutputPort());\n\n  // Create Seeds.\n  vtkNew<vtkPointSource> seeds;\n  seeds->SetRadius(0.2);\n  seeds->SetCenter(3.0, 1.6, 1.25);\n  seeds->SetNumberOfPoints(50);\n\n  // Create streamlines.\n  vtkNew<vtkStreamTracer> streamTracer;\n  streamTracer->SetIntegrationDirectionToBoth();\n  streamTracer->SetInputConnection(solution->GetOutputPort());\n  streamTracer->SetSourceConnection(seeds->GetOutputPort());\n  streamTracer->SetMaximumPropagation(50);\n  streamTracer->SetInitialIntegrationStep(.2);\n  streamTracer->SetMinimumIntegrationStep(.01);\n  streamTracer->SetIntegratorType(2);\n  streamTracer->SetComputeVorticity(1);\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(streamTracer->GetOutputPort());\n  tubes->SetNumberOfSides(8);\n  tubes->SetRadius(.02);\n  tubes->SetVaryRadius(0);\n\n  vtkNew<vtkPolyDataMapper> mapTubes;\n  mapTubes->SetInputConnection(tubes->GetOutputPort());\n  mapTubes->SetScalarRange(solution->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> tubesActor;\n  tubesActor->SetMapper(mapTubes);\n\n  // Create an Isosurface.\n  vtkNew<vtkContourFilter> isoSurface;\n  isoSurface->SetValue(0, 500.0);\n  isoSurface->SetInputConnection(solution->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> isoSurfaceMapper;\n  isoSurfaceMapper->SetInputConnection(isoSurface->GetOutputPort());\n  isoSurfaceMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoSurfaceActor;\n  isoSurfaceActor->SetMapper(isoSurfaceMapper);\n  isoSurfaceActor->GetProperty()->SetOpacity(.5);\n  isoSurfaceActor->GetProperty()->SetDiffuseColor(isoSurfaceColor.GetData());\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetCenter(seeds->GetCenter());\n  sphere->SetRadius(seeds->GetRadius());\n  sphere->SetThetaResolution(20);\n  sphere->SetPhiResolution(11);\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetOpacity(1.0);\n  sphereActor->GetProperty()->SetSpecular(.4);\n  sphereActor->GetProperty()->SetSpecularPower(80);\n  sphereActor->GetProperty()->SetDiffuseColor(sphereColor.GetData());\n\n  renderer->AddActor(tubesActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(isoSurfaceActor);\n\n  renderer->SetBackground(backgroundColor.GetData());\n  renderWindow->SetSize(640, 512);\n  renderWindow->SetWindowName(\"FireFlowDemo\");\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Azimuth(20.0);\n  renderer->GetActiveCamera()->Elevation(10.0);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n\n  // Create widgets to manipulate point source center.\n  vtkNew<vtkSliderWidget> xWidget;\n  MakeXWidget(xWidget, seeds, sphere, renderer, renderWindowInteractor);\n  dynamic_cast<vtkSliderRepresentation2D*>(xWidget->GetRepresentation())\n      ->SetMinimumValue(bounds[0]);\n  dynamic_cast<vtkSliderRepresentation2D*>(xWidget->GetRepresentation())\n      ->SetMaximumValue(bounds[1]);\n  vtkNew<vtkSliderWidget> yWidget;\n  MakeYWidget(yWidget, seeds, sphere, renderer, renderWindowInteractor);\n  dynamic_cast<vtkSliderRepresentation2D*>(yWidget->GetRepresentation())\n      ->SetMinimumValue(bounds[2]);\n  dynamic_cast<vtkSliderRepresentation2D*>(yWidget->GetRepresentation())\n      ->SetMaximumValue(bounds[3]);\n  vtkNew<vtkSliderWidget> zWidget;\n  MakeZWidget(zWidget, seeds, sphere, renderer, renderWindowInteractor);\n  dynamic_cast<vtkSliderRepresentation2D*>(zWidget->GetRepresentation())\n      ->SetMinimumValue(bounds[4]);\n  dynamic_cast<vtkSliderRepresentation2D*>(zWidget->GetRepresentation())\n      ->SetMaximumValue(bounds[5]);\n\n  renderWindow->Render();\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n#define DELAY 500\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackX : public vtkCallbackCommand\n{\npublic:\n  static SliderCallbackX* New()\n  {\n    return new SliderCallbackX;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    double center[3];\n    this->PointSource->GetCenter(center);\n    center[0] = value;\n    this->PointSource->SetCenter(center);\n    SphereSource->SetCenter(center);\n    PointSource->Modified();\n    PointSource->Update();\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackX() = default;\n  vtkPointSource* PointSource = nullptr;\n  vtkSphereSource* SphereSource = nullptr;\n};\n\nvoid MakeXWidget(vtkSliderWidget* widget, vtkPointSource* pointSource,\n                 vtkSphereSource* sphereSource, vtkRenderer* renderer,\n                 vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepX;\n\n  sliderRepX->SetRenderer(renderer);\n\n  sliderRepX->SetMinimumValue(-1000.0);\n  sliderRepX->SetMaximumValue(1000);\n  sliderRepX->SetValue(pointSource->GetCenter()[0]);\n  sliderRepX->SetTitleText(\"X\");\n  sliderRepX->SetRenderer(renderer);\n  sliderRepX->GetPoint1Coordinate()->SetValue(0.1, 0.1);\n  sliderRepX->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedViewport();\n  sliderRepX->GetPoint2Coordinate()->SetValue(0.3, 0.1);\n  sliderRepX->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepX->SetTubeWidth(tubeWidth);\n  sliderRepX->SetSliderLength(sliderLength);\n  sliderRepX->SetTitleHeight(titleHeight);\n  sliderRepX->SetLabelHeight(labelHeight);\n  sliderRepX->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepX->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepX->GetSliderProperty()->SetColor(0.0, 0.0, 0.0);\n  sliderRepX->BuildRepresentation();\n\n  widget->SetRepresentation(sliderRepX);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  auto callbackX = vtkSmartPointer<SliderCallbackX>::New();\n  callbackX->PointSource = pointSource;\n  callbackX->SphereSource = sphereSource;\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackX);\n}\n\nclass SliderCallbackY : public vtkCallbackCommand\n{\npublic:\n  static SliderCallbackY* New()\n  {\n    return new SliderCallbackY;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    double center[3];\n    this->PointSource->GetCenter(center);\n    center[1] = value;\n    this->PointSource->SetCenter(center);\n    this->SphereSource->SetCenter(center);\n    PointSource->Modified();\n    PointSource->Update();\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackY() = default;\n  vtkPointSource* PointSource = nullptr;\n  vtkSphereSource* SphereSource = nullptr;\n};\n\nvoid MakeYWidget(vtkSliderWidget* widget, vtkPointSource* pointSource,\n                 vtkSphereSource* sphereSource, vtkRenderer* renderer,\n                 vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepY;\n\n  sliderRepY->SetRenderer(renderer);\n\n  sliderRepY->SetMinimumValue(-1000.0);\n  sliderRepY->SetMaximumValue(1000);\n  sliderRepY->SetValue(pointSource->GetCenter()[1]);\n  sliderRepY->SetTitleText(\"Y\");\n  sliderRepY->SetRenderer(renderer);\n  sliderRepY->GetPoint1Coordinate()->SetValue(0.4, 0.1);\n  sliderRepY->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedViewport();\n  sliderRepY->GetPoint2Coordinate()->SetValue(0.6, 0.1);\n  sliderRepY->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepY->SetTubeWidth(tubeWidth);\n  sliderRepY->SetSliderLength(sliderLength);\n  sliderRepY->SetTitleHeight(titleHeight);\n  sliderRepY->SetLabelHeight(labelHeight);\n  sliderRepY->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepY->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepY->GetSliderProperty()->SetColor(0.0, 0.0, 0.0);\n  sliderRepY->BuildRepresentation();\n\n  widget->SetRepresentation(sliderRepY);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  auto callbackY = vtkSmartPointer<SliderCallbackY>::New();\n  callbackY->PointSource = pointSource;\n  callbackY->SphereSource = sphereSource;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackY);\n}\n\nclass SliderCallbackZ : public vtkCallbackCommand\n{\npublic:\n  static SliderCallbackZ* New()\n  {\n    return new SliderCallbackZ;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    double center[3];\n    this->PointSource->GetCenter(center);\n    center[2] = value;\n    this->PointSource->SetCenter(center);\n    this->SphereSource->SetCenter(center);\n    PointSource->Modified();\n    PointSource->Update();\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackZ() = default;\n  vtkPointSource* PointSource = nullptr;\n  vtkSphereSource* SphereSource = nullptr;\n};\n\nvoid MakeZWidget(vtkSliderWidget* widget, vtkPointSource* pointSource,\n                 vtkSphereSource* sphereSource, vtkRenderer* renderer,\n                 vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepZ;\n\n  sliderRepZ->SetRenderer(renderer);\n\n  sliderRepZ->SetMinimumValue(-1000.0);\n  sliderRepZ->SetMaximumValue(1000);\n  sliderRepZ->SetValue(pointSource->GetCenter()[2]);\n  sliderRepZ->SetTitleText(\"Z\");\n  sliderRepZ->SetRenderer(renderer);\n  sliderRepZ->GetPoint1Coordinate()->SetValue(0.7, 0.1);\n  sliderRepZ->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedViewport();\n  sliderRepZ->GetPoint2Coordinate()->SetValue(0.9, 0.1);\n  sliderRepZ->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepZ->SetTubeWidth(tubeWidth);\n  sliderRepZ->SetSliderLength(sliderLength);\n  sliderRepZ->SetTitleHeight(titleHeight);\n  sliderRepZ->SetLabelHeight(labelHeight);\n  sliderRepZ->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepZ->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepZ->GetSliderProperty()->SetColor(0.0, 0.0, 0.0);\n  sliderRepZ->BuildRepresentation();\n\n  widget->SetRepresentation(sliderRepZ);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  auto callbackZ = vtkSmartPointer<SliderCallbackZ>::New();\n  callbackZ->PointSource = pointSource;\n  callbackZ->SphereSource = sphereSource;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackZ);\n}\n} // namespace\n
"},{"location":"Cxx/VisualizationAlgorithms/FireFlowDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FireFlowDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeneric\n  FiltersSources\n  IOImport\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FireFlowDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FireFlowDemo MACOSX_BUNDLE FireFlowDemo.cxx )\n  target_link_libraries(FireFlowDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FireFlowDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/FireFlowDemo/#download-and-build-fireflowdemo","title":"Download and Build FireFlowDemo","text":"

Click here to download FireFlowDemo and its CMakeLists.txt file. Once the tarball FireFlowDemo.tar has been downloaded and extracted,

cd FireFlowDemo/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FireFlowDemo\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/FlyingHeadSlice/","title":"FlyingHeadSlice","text":"

vtk-examples/Cxx/VisualizationAlgorithms/FlyingHeadSlice

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/FlyingHeadSlice/#description","title":"Description","text":"

This example generates 2D contour lines on one CT slice through the head. The contours correspond to density values of the tissues and are colored according to density value.

This example is a modification of HeadSlice using vtkFlyingEdges2D for contouring. However there is an option to use vtkContourFilter instead.

Info

See Figure 6-11a in Chapter 6 of the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/FlyingHeadSlice/#code","title":"Code","text":"

FlyingHeadSlice.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkExtractVOI.h>\n#include <vtkFlyingEdges2D.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Generate 2D contour lines, corresponding to tissue density, \"\n                 \"on one CT slice through the head.\"\n              << std::endl;\n    std::cout << \"The contour lines are colored by the tissue density.\"\n              << std::endl;\n    std::cout << \"Usage: \" << argv[0] << \" FullHead.mhd [useContourFilter]\"\n              << std::endl;\n    std::cout << \"where: filename is FullHead.mhd,\" << std::endl;\n    std::cout << \"       useContourFilter = 0|1\" << std::endl;\n    std::cout << \"Examples:\" << std::endl;\n    std::cout << \"Contouring, using vtkFlyingEdges2D: FullHead.mhd\"\n              << std::endl;\n    std::cout << \"Contouring, using vtkContourFilter: FullHead.mhd 1\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useContourFilter = false;\n  if (argc > 2)\n  {\n    if (atoi(argv[2]) != 0)\n    {\n      useContourFilter = true;\n    }\n  }\n\n  if (useContourFilter)\n  {\n    std::cout << \"Using vtkContourFilter.\" << std::endl;\n  }\n  else\n  {\n    std::cout << \"Using vtkFlyingEdges2D.\" << std::endl;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the pipeline.\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkExtractVOI> extractVOI;\n  extractVOI->SetInputConnection(reader->GetOutputPort());\n  extractVOI->SetVOI(0, 255, 0, 255, 45, 45);\n  extractVOI->Update();\n  // double* scalarRange = extractVOI->GetOutput()->GetScalarRange();\n  std::array<double, 2> scalarRange = {{500, 1150}};\n  // std::cout << scalarRange[0] << \", \" << scalarRange[1] << std::endl;\n\n  vtkNew<vtkContourFilter> contour;\n  vtkNew<vtkFlyingEdges2D> flyingEdges;\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  if (useContourFilter)\n  {\n    contour->SetInputConnection(extractVOI->GetOutputPort());\n    contour->GenerateValues(12, scalarRange.data());\n    isoMapper->SetInputConnection(contour->GetOutputPort());\n  }\n  else\n  {\n    flyingEdges->SetInputConnection(extractVOI->GetOutputPort());\n    flyingEdges->GenerateValues(12, scalarRange.data());\n    isoMapper->SetInputConnection(flyingEdges->GetOutputPort());\n  }\n  isoMapper->ScalarVisibilityOn();\n  isoMapper->SetScalarRange(scalarRange.data());\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Wheat\").GetData());\n\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(extractVOI->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 640);\n  renWin->SetWindowName(\"FlyingHeadSlice\");\n  renWin->Render();\n\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/FlyingHeadSlice/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FlyingHeadSlice)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FlyingHeadSlice: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FlyingHeadSlice MACOSX_BUNDLE FlyingHeadSlice.cxx )\n  target_link_libraries(FlyingHeadSlice PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FlyingHeadSlice\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/FlyingHeadSlice/#download-and-build-flyingheadslice","title":"Download and Build FlyingHeadSlice","text":"

Click here to download FlyingHeadSlice and its CMakeLists.txt file. Once the tarball FlyingHeadSlice.tar has been downloaded and extracted,

cd FlyingHeadSlice/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FlyingHeadSlice\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/HeadBone/","title":"HeadBone","text":"

vtk-examples/Cxx/VisualizationAlgorithms/HeadBone

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/HeadBone/#description","title":"Description","text":"

This example generates an isosurface of human bone.

Info

See Figure 6-11b in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/HeadBone/#code","title":"Code","text":"

HeadBone.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMergePoints.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" FullHead.mhd\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create pipeline.\n  //\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkMergePoints> locator;\n  locator->SetDivisions(64, 64, 92);\n  locator->SetNumberOfPointsPerBucket(2);\n  locator->AutomaticOff();\n\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> iso;\n#else\n  vtkNew<vtkMarchingCubes> iso;\n#endif\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->ComputeGradientsOn();\n  iso->ComputeScalarsOff();\n  iso->SetValue(0, 1150);\n#ifndef USE_FLYING_EDGES\n  iso->SetLocator(locator);\n#endif\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Ivory\").GetData());\n\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  ren1->GetActiveCamera()->SetPosition(0, -1, 0);\n  ren1->GetActiveCamera()->SetViewUp(0, 0, -1);\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"HeadBone\");\n\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/HeadBone/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HeadBone)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HeadBone: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HeadBone MACOSX_BUNDLE HeadBone.cxx )\n  target_link_libraries(HeadBone PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HeadBone\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/HeadBone/#download-and-build-headbone","title":"Download and Build HeadBone","text":"

Click here to download HeadBone and its CMakeLists.txt file. Once the tarball HeadBone.tar has been downloaded and extracted,

cd HeadBone/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HeadBone\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/HeadSlice/","title":"HeadSlice","text":"

vtk-examples/Cxx/VisualizationAlgorithms/HeadSlice

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/HeadSlice/#description","title":"Description","text":"

This example generates contours on one CT slice through the head,

Info

See Figure 6-11a in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/HeadSlice/#code","title":"Code","text":"

HeadSlice.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkExtractVOI.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" FullHead.mhd\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // create pipeline\n  //\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkExtractVOI> extractVOI;\n  extractVOI->SetInputConnection(reader->GetOutputPort());\n  extractVOI->SetVOI(0, 255, 0, 255, 45, 45);\n\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputConnection(extractVOI->GetOutputPort());\n  iso->GenerateValues(12, 500, 1150);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Wheat\").GetData());\n\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(extractVOI->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 640);\n  renWin->SetWindowName(\"HeadSlice\");\n\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/HeadSlice/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HeadSlice)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HeadSlice: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HeadSlice MACOSX_BUNDLE HeadSlice.cxx )\n  target_link_libraries(HeadSlice PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HeadSlice\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/HeadSlice/#download-and-build-headslice","title":"Download and Build HeadSlice","text":"

Click here to download HeadSlice and its CMakeLists.txt file. Once the tarball HeadSlice.tar has been downloaded and extracted,

cd HeadSlice/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HeadSlice\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/Hello/","title":"Hello","text":"

vtk-examples/Cxx/VisualizationAlgorithms/Hello

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/Hello/#description","title":"Description","text":"

Implicit modelling used to thicken a stroked font. Original lines can be seen within the translucent implicit surface.

Info

See Figure 6-28 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/Hello/#code","title":"Code","text":"

Hello.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitModeller.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" hello.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  // Create lines which serve as the \"seed\" geometry. The lines spell the\n  // word \"hello\".\n  //\n  vtkNew<vtkPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  lineActor->GetProperty()->SetLineWidth(3.0);\n\n  // Create implicit model with vtkImplicitModeller. This computes a scalar\n  // field which is the distance from the generating geometry. The contour\n  // filter then extracts the geometry at the distance value 0.25 from the\n  // generating geometry.\n  //\n  vtkNew<vtkImplicitModeller> imp;\n  imp->SetInputConnection(reader->GetOutputPort());\n  imp->SetSampleDimensions(110, 40, 20);\n  imp->SetMaximumDistance(0.25);\n  imp->SetModelBounds(-1.0, 10.0, -1.0, 3.0, -1.0, 1.0);\n\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(imp->GetOutputPort());\n  contour->SetValue(0, 0.25);\n\n  vtkNew<vtkPolyDataMapper> impMapper;\n  impMapper->SetInputConnection(contour->GetOutputPort());\n  impMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> impActor;\n  impActor->SetMapper(impMapper);\n  impActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  impActor->GetProperty()->SetOpacity(0.5);\n\n  // Create the usual graphics stuff.\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(lineActor);\n  ren1->AddActor(impActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"Hello\");\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(4.5, 1, 0);\n  camera->SetPosition(4.5, 1.0, 6.73257);\n  camera->SetViewUp(0, 1, 0);\n\n  ren1->SetActiveCamera(camera);\n  ren1->ResetCamera();\n  camera->Dolly(1.3);\n  camera->SetClippingRange(1.81325, 90.6627);\n\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/Hello/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Hello)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersHybrid\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Hello: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Hello MACOSX_BUNDLE Hello.cxx )\n  target_link_libraries(Hello PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Hello\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/Hello/#download-and-build-hello","title":"Download and Build Hello","text":"

Click here to download Hello and its CMakeLists.txt file. Once the tarball Hello.tar has been downloaded and extracted,

cd Hello/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Hello\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/HyperStreamline/","title":"HyperStreamline","text":"

vtk-examples/Cxx/VisualizationAlgorithms/HyperStreamline

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/HyperStreamline/#description","title":"Description","text":"

This is an example of hyperstreamlines. The data is from a point load applied to semi-infinite domain. Compare this image to TensorEllipsoids that used tensor ellipsoids to visualize the same data. Notice that there is less clutter and more information available from the hyperstreamline visualization.

Info

See Figure 9-15 in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/HyperStreamline/#code","title":"Code","text":"

HyperStreamline.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkHyperStreamline.h>\n#include <vtkImageData.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkLogLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointLoad.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  // Create the RenderWindow, Renderer and interactive renderer.\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetMultiSamples(0);\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // set VTK_INTEGRATE_BOTH_DIRECTIONS 2\n\n  //\n  // Generate tensors.\n  vtkNew<vtkPointLoad> ptLoad;\n  ptLoad->SetLoadValue(100.0);\n  ptLoad->SetSampleDimensions(20, 20, 20);\n  ptLoad->ComputeEffectiveStressOn();\n  ptLoad->SetModelBounds(-10, 10, -10, 10, -10, 10);\n  ptLoad->Update();\n\n  // Generate hyperstreamlines.\n  vtkNew<vtkHyperStreamline> s1;\n  s1->SetInputData(ptLoad->GetOutput());\n  s1->SetStartPosition(9, 9, -9);\n  s1->IntegrateMinorEigenvector();\n  s1->SetMaximumPropagationDistance(18.0);\n  s1->SetIntegrationStepLength(0.1);\n  s1->SetStepLength(0.01);\n  s1->SetRadius(0.25);\n  s1->SetNumberOfSides(18);\n  s1->SetIntegrationDirectionToIntegrateBothDirections();\n  s1->Update();\n\n  // Map hyperstreamlines.\n  vtkNew<vtkLogLookupTable> lut;\n  lut->SetHueRange(.6667, 0.0);\n\n  vtkNew<vtkPolyDataMapper> s1Mapper;\n  s1Mapper->SetInputConnection(s1->GetOutputPort());\n  s1Mapper->SetLookupTable(lut);\n  s1Mapper->SetScalarRange(ptLoad->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> s1Actor;\n  s1Actor->SetMapper(s1Mapper);\n\n  vtkNew<vtkHyperStreamline> s2;\n  s2->SetInputData(ptLoad->GetOutput());\n  s2->SetStartPosition(-9, -9, -9);\n  s2->IntegrateMinorEigenvector();\n  s2->SetMaximumPropagationDistance(18.0);\n  s2->SetIntegrationStepLength(0.1);\n  s2->SetStepLength(0.01);\n  s2->SetRadius(0.25);\n  s2->SetNumberOfSides(18);\n  s2->SetIntegrationDirectionToIntegrateBothDirections();\n  s2->Update();\n\n  vtkNew<vtkPolyDataMapper> s2Mapper;\n  s2Mapper->SetInputConnection(s2->GetOutputPort());\n  s2Mapper->SetLookupTable(lut);\n  s2Mapper->SetScalarRange(ptLoad->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> s2Actor;\n  s2Actor->SetMapper(s2Mapper);\n\n  vtkNew<vtkHyperStreamline> s3;\n  s3->SetInputData(ptLoad->GetOutput());\n  s3->SetStartPosition(9, -9, -9);\n  s3->IntegrateMinorEigenvector();\n  s3->SetMaximumPropagationDistance(18.0);\n  s3->SetIntegrationStepLength(0.1);\n  s3->SetStepLength(0.01);\n  s3->SetRadius(0.25);\n  s3->SetNumberOfSides(18);\n  s3->SetIntegrationDirectionToIntegrateBothDirections();\n  s3->Update();\n\n  vtkNew<vtkPolyDataMapper> s3Mapper;\n  s3Mapper->SetInputConnection(s3->GetOutputPort());\n  s3Mapper->SetLookupTable(lut);\n  s3Mapper->SetScalarRange(ptLoad->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> s3Actor;\n  s3Actor->SetMapper(s3Mapper);\n\n  vtkNew<vtkHyperStreamline> s4;\n  s4->SetInputData(ptLoad->GetOutput());\n  s4->SetStartPosition(-9, 9, -9);\n  s4->IntegrateMinorEigenvector();\n  s4->SetMaximumPropagationDistance(18.0);\n  s4->SetIntegrationStepLength(0.1);\n  s4->SetStepLength(0.01);\n  s4->SetRadius(0.25);\n  s4->SetNumberOfSides(18);\n  s4->SetIntegrationDirectionToIntegrateBothDirections();\n  s4->Update();\n\n  vtkNew<vtkPolyDataMapper> s4Mapper;\n  s4Mapper->SetInputConnection(s4->GetOutputPort());\n  s4Mapper->SetLookupTable(lut);\n  s4Mapper->SetScalarRange(ptLoad->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> s4Actor;\n  s4Actor->SetMapper(s4Mapper);\n\n  // Plane for context.\n  //\n  vtkNew<vtkImageDataGeometryFilter> g;\n  g->SetInputData(ptLoad->GetOutput());\n  g->SetExtent(0, 100, 0, 100, 0, 0);\n  g->Update(); // for scalar range\n\n  vtkNew<vtkPolyDataMapper> gm;\n  gm->SetInputConnection(g->GetOutputPort());\n  gm->SetScalarRange(g->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> ga;\n  ga->SetMapper(gm);\n\n  // Create outline around data.\n  //\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputData(ptLoad->GetOutput());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create cone indicating application of load.\n  //\n  vtkNew<vtkConeSource> coneSrc;\n  coneSrc->SetRadius(0.5);\n  coneSrc->SetHeight(2);\n\n  vtkNew<vtkPolyDataMapper> coneMap;\n  coneMap->SetInputConnection(coneSrc->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMap);\n  coneActor->SetPosition(0, 0, 11);\n  coneActor->RotateY(90);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(0.113766, -1.13665, -1.01919);\n  camera->SetPosition(-29.4886, -63.1488, 26.5807);\n  camera->SetViewAngle(24.4617);\n  camera->SetViewUp(0.17138, 0.331163, 0.927879);\n  camera->SetClippingRange(1, 100);\n\n  ren1->AddActor(s1Actor);\n  ren1->AddActor(s2Actor);\n  ren1->AddActor(s3Actor);\n  ren1->AddActor(s4Actor);\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(coneActor);\n  ren1->AddActor(ga);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->SetActiveCamera(camera);\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"HyperStreamline\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/HyperStreamline/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HyperStreamline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersGeometry\n  FiltersModeling\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HyperStreamline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HyperStreamline MACOSX_BUNDLE HyperStreamline.cxx )\n  target_link_libraries(HyperStreamline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HyperStreamline\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/HyperStreamline/#download-and-build-hyperstreamline","title":"Download and Build HyperStreamline","text":"

Click here to download HyperStreamline and its CMakeLists.txt file. Once the tarball HyperStreamline.tar has been downloaded and extracted,

cd HyperStreamline/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HyperStreamline\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/IceCream/","title":"IceCream","text":"

vtk-examples/Cxx/VisualizationAlgorithms/IceCream

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/IceCream/#description","title":"Description","text":"

This example demonstrates how to use boolean combinations of implicit functions to create a model of an ice cream cone.

Info

See Figure 6-23c in Chapter 6 the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/IceCream/#code","title":"Code","text":"

IceCream.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCone.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\nint main(int, char*[])\n{\n  // This example demonstrates how to use boolean combinations of implicit\n  // functions to create a model of an ice cream cone.\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create implicit function primitives. These have been carefully placed to\n  // give the effect that we want. We are going to use various combinations of\n  // these functions to create the shape we want; for example, we use planes\n  // intersected with a cone (which is infinite in extent) to get a finite\n  // cone.\n  //\n  vtkNew<vtkCone> cone;\n  cone->SetAngle(20);\n\n  vtkNew<vtkPlane> vertPlane;\n  vertPlane->SetOrigin(.1, 0, 0);\n  vertPlane->SetNormal(-1, 0, 0);\n\n  vtkNew<vtkPlane> basePlane;\n  basePlane->SetOrigin(1.2, 0, 0);\n  basePlane->SetNormal(1, 0, 0);\n\n  vtkNew<vtkSphere> iceCream;\n  iceCream->SetCenter(1.333, 0, 0);\n  iceCream->SetRadius(0.5);\n\n  vtkNew<vtkSphere> bite;\n  bite->SetCenter(1.5, 0, 0.5);\n  bite->SetRadius(0.25);\n\n  // Combine primitives to build ice-cream cone. Clip the cone with planes.\n  vtkNew<vtkImplicitBoolean> theCone;\n  theCone->SetOperationTypeToIntersection();\n  theCone->AddFunction(cone);\n  theCone->AddFunction(vertPlane);\n  theCone->AddFunction(basePlane);\n\n  // Take a bite out of the ice cream.\n  vtkNew<vtkImplicitBoolean> theCream;\n  theCream->SetOperationTypeToDifference();\n  theCream->AddFunction(iceCream);\n  theCream->AddFunction(bite);\n\n  // The sample function generates a distance function from the\n  // implicit function (which in this case is the cone). This is\n  // then contoured to get a polygonal surface.\n  //\n  vtkNew<vtkSampleFunction> theConeSample;\n  theConeSample->SetImplicitFunction(theCone);\n  theConeSample->SetModelBounds(-1, 1.5, -1.25, 1.25, -1.25, 1.25);\n  theConeSample->SetSampleDimensions(128, 128, 128);\n  theConeSample->ComputeNormalsOff();\n\n  vtkNew<vtkContourFilter> theConeSurface;\n  theConeSurface->SetInputConnection(theConeSample->GetOutputPort());\n  theConeSurface->SetValue(0, 0.0);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(theConeSurface->GetOutputPort());\n  coneMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"chocolate\").GetData());\n\n  // The same here for the ice cream.\n  //\n  vtkNew<vtkSampleFunction> theCreamSample;\n  theCreamSample->SetImplicitFunction(theCream);\n  theCreamSample->SetModelBounds(0, 2.5, -1.25, 1.25, -1.25, 1.25);\n  theCreamSample->SetSampleDimensions(128, 128, 128);\n  theCreamSample->ComputeNormalsOff();\n\n  vtkNew<vtkContourFilter> theCreamSurface;\n  theCreamSurface->SetInputConnection(theCreamSample->GetOutputPort());\n  theCreamSurface->SetValue(0, 0.0);\n\n  vtkNew<vtkPolyDataMapper> creamMapper;\n  creamMapper->SetInputConnection(theCreamSurface->GetOutputPort());\n  creamMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> creamActor;\n  creamActor->SetMapper(creamMapper);\n  creamActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"mint\").GetData());\n  creamActor->GetProperty()->SetSpecular(.6);\n  creamActor->GetProperty()->SetSpecularPower(50);\n\n  // Create the usual rendering stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(coneActor);\n  ren1->AddActor(creamActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"IceCream\");\n\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Roll(90);\n  ren1->GetActiveCamera()->Dolly(1.25);\n  ren1->ResetCameraClippingRange();\n  iren->Initialize();\n\n  // render the image\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/IceCream/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IceCream)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IceCream: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IceCream MACOSX_BUNDLE IceCream.cxx )\n  target_link_libraries(IceCream PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IceCream\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/IceCream/#download-and-build-icecream","title":"Download and Build IceCream","text":"

Click here to download IceCream and its CMakeLists.txt file. Once the tarball IceCream.tar has been downloaded and extracted,

cd IceCream/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IceCream\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/ImageGradient/","title":"ImageGradient","text":"

vtk-examples/Cxx/VisualizationAlgorithms/ImageGradient

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/ImageGradient/#description","title":"Description","text":"

We create an imaging pipeline to visualize gradient information.

The gradient direction is mapped into color hue value while the gradient magnitude is mapped into the color saturation.

Info

See Figure 10-16 in Chapter 10 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/ImageGradient/#code","title":"Code","text":"

ImageGradient.cxx

/*\n * Visualization of gradient information.\n *\n */\n\n#include <vtkImageCast.h>\n#include <vtkImageConstantPad.h>\n#include <vtkImageEuclideanToPolar.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageGradient.h>\n#include <vtkImageHSVToRGB.h>\n#include <vtkImageMagnify.h>\n#include <vtkImageViewer.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iomanip>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fileName\" << std::endl;\n    std::cout << \"where: fileName is FullHead.mhd.\" << std::endl;\n    std::cout << \"Note: The file FullHead.raw.gz must also be present in the \"\n                 \"same folder.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the CT data of the human head.\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToFloat();\n\n  // Magnify the image.\n  vtkNew<vtkImageMagnify> magnify;\n  magnify->SetInputConnection(cast->GetOutputPort());\n  magnify->SetMagnificationFactors(2, 2, 1);\n  magnify->InterpolateOn();\n\n  // Smooth the data.\n  // Remove high frequency artifacts due to linear interpolation.\n  vtkNew<vtkImageGaussianSmooth> smooth;\n  smooth->SetInputConnection(magnify->GetOutputPort());\n  smooth->SetDimensionality(2);\n  smooth->SetStandardDeviations(1.5, 1.5, 0.0);\n  smooth->SetRadiusFactors(2.01, 2.01, 0.0);\n\n  // Compute the 2D gradient.\n  vtkNew<vtkImageGradient> gradient;\n  gradient->SetInputConnection(smooth->GetOutputPort());\n  gradient->SetDimensionality(2);\n\n  // Convert the data to polar coordinates.\n  // The image magnitude is mapped into saturation value,\n  //  whilst the gradient direction is mapped into hue value.\n  vtkNew<vtkImageEuclideanToPolar> polar;\n  polar->SetInputConnection(gradient->GetOutputPort());\n  polar->SetThetaMaximum(255.0);\n\n  // Add a third component to the data.\n  // This is needed since the gradient filter only generates two components,\n  //  and we need three components to represent color.\n  vtkNew<vtkImageConstantPad> pad;\n  pad->SetInputConnection(polar->GetOutputPort());\n  pad->SetOutputNumberOfScalarComponents(3);\n  pad->SetConstant(200.0);\n\n  // At this point we have Hue, Value, Saturation.\n  // Permute components so saturation will be constant.\n  // Re-arrange components into HSV order.\n  vtkNew<vtkImageExtractComponents> permute;\n  permute->SetInputConnection(pad->GetOutputPort());\n  permute->SetComponents(0, 2, 1);\n\n  // Convert back into RGB values.\n  vtkNew<vtkImageHSVToRGB> rgb;\n  rgb->SetInputConnection(permute->GetOutputPort());\n  rgb->SetMaximum(255.0);\n\n  // Set up a viewer for the image.\n  // Note that vtkImageViewer and vtkImageViewer2 are convenience wrappers\n  // around\n  // vtkActor2D, vtkImageMapper, vtkRenderer, and vtkRenderWindow.\n  // So all that needs to be supplied is the interactor.\n  vtkNew<vtkImageViewer> viewer;\n  viewer->SetInputConnection(rgb->GetOutputPort());\n  viewer->SetZSlice(22);\n  viewer->SetColorWindow(255.0);\n  viewer->SetColorLevel(127.0);\n  viewer->GetRenderWindow()->SetSize(512, 512);\n  viewer->GetRenderer()->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  viewer->GetRenderWindow()->SetWindowName(\"ImageGradient\");\n\n  // Create the RenderWindowInteractor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  viewer->SetupInteractor(iren);\n  viewer->Render();\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/ImageGradient/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageGradient)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingGeneral\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageGradient: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageGradient MACOSX_BUNDLE ImageGradient.cxx )\n  target_link_libraries(ImageGradient PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageGradient\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/ImageGradient/#download-and-build-imagegradient","title":"Download and Build ImageGradient","text":"

Click here to download ImageGradient and its CMakeLists.txt file. Once the tarball ImageGradient.tar has been downloaded and extracted,

cd ImageGradient/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageGradient\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/IronIsoSurface/","title":"IronIsoSurface","text":"

vtk-examples/Cxx/VisualizationAlgorithms/IronIsoSurface

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/IronIsoSurface/#description","title":"Description","text":"

This example generates an isosurface of electron potential of an iron protein molecule.

Info

See Figure 6-11d in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/IronIsoSurface/#code","title":"Code","text":"

IronIsoSurface.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" ironProt.vtk\" << std::endl;\n    return EXIT_SUCCESS;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // create pipeline\n  //\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->SetValue(0, 128);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 640);\n  renWin->SetWindowName(\"IronIsoSurface\");\n\n  // render the image\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(30);\n  ren1->GetActiveCamera()->Elevation(30);\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/IronIsoSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IronIsoSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IronIsoSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IronIsoSurface MACOSX_BUNDLE IronIsoSurface.cxx )\n  target_link_libraries(IronIsoSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IronIsoSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/IronIsoSurface/#download-and-build-ironisosurface","title":"Download and Build IronIsoSurface","text":"

Click here to download IronIsoSurface and its CMakeLists.txt file. Once the tarball IronIsoSurface.tar has been downloaded and extracted,

cd IronIsoSurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IronIsoSurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/LOx/","title":"LOx","text":"

vtk-examples/Cxx/VisualizationAlgorithms/LOx

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/LOx/#description","title":"Description","text":"

Streamtubes created by using the computational grid just in front of the post as a source for seeds

Info

See Figure 12-16 in Chapter 12 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/LOx/#code","title":"Code","text":"

LOx.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <string>\n\n//// LOx post CFD case study.\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" postxyz.bin postq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Read the data.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->AutoDetectFormatOn();\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(153);\n  pl3d->SetVectorFunctionNumber(200);\n  pl3d->Update();\n\n  vtkStructuredGrid* sg =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Blue to red lut.\n  //\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.667, 0.0);\n\n  // Computational planes.\n  vtkNew<vtkStructuredGridGeometryFilter> floorComp;\n  floorComp->SetExtent(0, 37, 0, 75, 0, 0);\n  floorComp->SetInputData(sg);\n  floorComp->Update();\n\n  vtkNew<vtkPolyDataMapper> floorMapper;\n  floorMapper->SetInputConnection(floorComp->GetOutputPort());\n  floorMapper->ScalarVisibilityOff();\n  floorMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> floorActor;\n  floorActor->SetMapper(floorMapper);\n  floorActor->GetProperty()->SetRepresentationToWireframe();\n  floorActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n  floorActor->GetProperty()->SetLineWidth(2);\n\n  vtkNew<vtkStructuredGridGeometryFilter> subFloorComp;\n\n  subFloorComp->SetExtent(0, 37, 0, 15, 22, 22);\n  subFloorComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> subFloorMapper;\n  subFloorMapper->SetInputConnection(subFloorComp->GetOutputPort());\n  subFloorMapper->SetLookupTable(lut);\n  subFloorMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> subFloorActor;\n\n  subFloorActor->SetMapper(subFloorMapper);\n\n  vtkNew<vtkStructuredGridGeometryFilter> subFloor2Comp;\n  subFloor2Comp->SetExtent(0, 37, 60, 75, 22, 22);\n  subFloor2Comp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> subFloor2Mapper;\n  subFloor2Mapper->SetInputConnection(subFloor2Comp->GetOutputPort());\n  subFloor2Mapper->SetLookupTable(lut);\n  subFloor2Mapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> subFloor2Actor;\n\n  subFloor2Actor->SetMapper(subFloor2Mapper);\n\n  vtkNew<vtkStructuredGridGeometryFilter> postComp;\n\n  postComp->SetExtent(10, 10, 0, 75, 0, 37);\n  postComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> postMapper;\n  postMapper->SetInputConnection(postComp->GetOutputPort());\n  postMapper->SetLookupTable(lut);\n  postMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> postActor;\n  postActor->SetMapper(postMapper);\n  postActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> fanComp;\n  fanComp->SetExtent(0, 37, 38, 38, 0, 37);\n  fanComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> fanMapper;\n  fanMapper->SetInputConnection(fanComp->GetOutputPort());\n  fanMapper->SetLookupTable(lut);\n  fanMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> fanActor;\n\n  fanActor->SetMapper(fanMapper);\n  fanActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  // Streamers\n  //\n  // Spherical seed points.\n  vtkNew<vtkPointSource> rake;\n  rake->SetCenter(-0.74, 0, 0.3);\n  rake->SetNumberOfPoints(10);\n\n  // A line of seed points.\n  vtkNew<vtkStructuredGridGeometryFilter> seedsComp;\n  seedsComp->SetExtent(10, 10, 37, 39, 1, 27);\n  seedsComp->SetInputData(sg);\n\n  vtkNew<vtkStreamTracer> streamers;\n  streamers->SetInputConnection(pl3d->GetOutputPort());\n\n  // streamers SetSource [rake GetOutput]\n  streamers->SetSourceConnection(seedsComp->GetOutputPort());\n  streamers->SetMaximumPropagation(250);\n  streamers->SetInitialIntegrationStep(.2);\n  streamers->SetMinimumIntegrationStep(.01);\n  streamers->SetIntegratorType(2);\n  streamers->Update();\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(streamers->GetOutputPort());\n  tubes->SetNumberOfSides(8);\n  tubes->SetRadius(0.08);\n  tubes->SetVaryRadius(0);\n\n  vtkNew<vtkPolyDataMapper> mapTubes;\n\n  mapTubes->SetInputConnection(tubes->GetOutputPort());\n  mapTubes->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> tubesActor;\n  tubesActor->SetMapper(mapTubes);\n\n  // outline\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  // Create graphics stuff\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(floorActor);\n  //  ren1->AddActor(subFloorActor);\n  //  ren1->AddActor(subFloor2Actor);\n  ren1->AddActor(postActor);\n  //  ren1->AddActor(fanActor);\n  ren1->AddActor(tubesActor);\n\n  vtkNew<vtkCamera> aCam;\n  aCam->SetFocalPoint(2.47736, -0.150024, 2.42361);\n  aCam->SetPosition(1.57547, -13.4601, 5.47872);\n  aCam->SetViewUp(0.00197003, 0.223588, 0.974682);\n  //  aCam->Dolly(4.0);\n  aCam->SetClippingRange(1, 100);\n\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->SetActiveCamera(aCam);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"LOx\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/LOx/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LOx)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LOx: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LOx MACOSX_BUNDLE LOx.cxx )\n  target_link_libraries(LOx PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LOx\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/LOx/#download-and-build-lox","title":"Download and Build LOx","text":"

Click here to download LOx and its CMakeLists.txt file. Once the tarball LOx.tar has been downloaded and extracted,

cd LOx/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LOx\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/LOxGrid/","title":"LOxGrid","text":"

vtk-examples/Cxx/VisualizationAlgorithms/LOxGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/LOxGrid/#desription","title":"Desription","text":"

Portion of computational grid for the LOx post.

Info

See Figure 12-14 in Chapter 12 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/LOxGrid/#code","title":"Code","text":"

LOxGrid.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkTubeFilter.h>\n\n//// LOx post CFD case study\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" postxyz.bin postq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Read the data.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->AutoDetectFormatOn();\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(153);\n  pl3d->SetVectorFunctionNumber(200);\n  pl3d->Update();\n\n  vtkStructuredGrid* sg =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Blue to red lut.\n  //\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.667, 0.0);\n\n  // Computational planes.\n  vtkNew<vtkStructuredGridGeometryFilter> floorComp;\n  floorComp->SetExtent(0, 37, 0, 75, 0, 0);\n  floorComp->SetInputData(sg);\n  floorComp->Update();\n\n  vtkNew<vtkPolyDataMapper> floorMapper;\n  floorMapper->SetInputConnection(floorComp->GetOutputPort());\n  floorMapper->ScalarVisibilityOff();\n  floorMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> floorActor;\n  floorActor->SetMapper(floorMapper);\n  floorActor->GetProperty()->SetRepresentationToWireframe();\n  floorActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n  floorActor->GetProperty()->SetLineWidth(2);\n\n  vtkNew<vtkStructuredGridGeometryFilter> subFloorComp;\n\n  subFloorComp->SetExtent(0, 37, 0, 15, 22, 22);\n  subFloorComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> subFloorMapper;\n  subFloorMapper->SetInputConnection(subFloorComp->GetOutputPort());\n  subFloorMapper->SetLookupTable(lut);\n  subFloorMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> subFloorActor;\n\n  subFloorActor->SetMapper(subFloorMapper);\n\n  vtkNew<vtkStructuredGridGeometryFilter> subFloor2Comp;\n  subFloor2Comp->SetExtent(0, 37, 60, 75, 22, 22);\n  subFloor2Comp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> subFloor2Mapper;\n  subFloor2Mapper->SetInputConnection(subFloor2Comp->GetOutputPort());\n  subFloor2Mapper->SetLookupTable(lut);\n  subFloor2Mapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> subFloor2Actor;\n\n  subFloor2Actor->SetMapper(subFloor2Mapper);\n\n  vtkNew<vtkStructuredGridGeometryFilter> postComp;\n\n  postComp->SetExtent(10, 10, 0, 75, 0, 37);\n  postComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> postMapper;\n  postMapper->SetInputConnection(postComp->GetOutputPort());\n  postMapper->SetLookupTable(lut);\n  postMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> postActor;\n  postActor->SetMapper(postMapper);\n  postActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> fanComp;\n  fanComp->SetExtent(0, 37, 38, 38, 0, 37);\n  fanComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> fanMapper;\n  fanMapper->SetInputConnection(fanComp->GetOutputPort());\n  fanMapper->SetLookupTable(lut);\n  fanMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> fanActor;\n\n  fanActor->SetMapper(fanMapper);\n  fanActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  // streamers\n  //\n  // Spherical seed points.\n  vtkNew<vtkPointSource> rake;\n  rake->SetCenter(-0.74, 0, 0.3);\n  rake->SetNumberOfPoints(10);\n\n  // A line of seed points.\n  vtkNew<vtkStructuredGridGeometryFilter> seedsComp;\n  seedsComp->SetExtent(10, 10, 37, 39, 1, 35);\n  seedsComp->SetInputData(sg);\n\n  vtkNew<vtkStreamTracer> streamers;\n  streamers->SetInputConnection(pl3d->GetOutputPort());\n\n  //    streamers SetSource [rake GetOutput]\n  streamers->SetSourceConnection(seedsComp->GetOutputPort());\n  streamers->SetMaximumPropagation(250);\n  streamers->SetInitialIntegrationStep(.2);\n  streamers->SetMinimumIntegrationStep(.01);\n  streamers->SetIntegratorType(2);\n  streamers->Update();\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(streamers->GetOutputPort());\n  tubes->SetNumberOfSides(8);\n  tubes->SetRadius(0.08);\n  tubes->SetVaryRadius(0);\n\n  vtkNew<vtkPolyDataMapper> mapTubes;\n\n  mapTubes->SetInputConnection(tubes->GetOutputPort());\n  mapTubes->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> tubesActor;\n  tubesActor->SetMapper(mapTubes);\n\n  // Outline\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  // Create graphics stuff\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(floorActor);\n  ren1->AddActor(subFloorActor);\n  ren1->AddActor(subFloor2Actor);\n  ren1->AddActor(postActor);\n  ren1->AddActor(fanActor);\n  ren1->AddActor(tubesActor);\n\n  vtkNew<vtkCamera> aCam;\n  aCam->SetFocalPoint(0.00657892, 0, 2.41026);\n  aCam->SetPosition(-1.94838, -47.1275, 39.4607);\n  aCam->SetViewUp(0.00653193, 0.617865, 0.786257);\n  ren1->ResetCamera();\n  aCam->Dolly(1.);\n  aCam->SetClippingRange(1, 100);\n\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->SetActiveCamera(aCam);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"LOxGrid\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/LOxGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LOxGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LOxGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LOxGrid MACOSX_BUNDLE LOxGrid.cxx )\n  target_link_libraries(LOxGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LOxGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/LOxGrid/#download-and-build-loxgrid","title":"Download and Build LOxGrid","text":"

Click here to download LOxGrid and its CMakeLists.txt file. Once the tarball LOxGrid.tar has been downloaded and extracted,

cd LOxGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LOxGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/LOxSeeds/","title":"LOxSeeds","text":"

vtk-examples/Cxx/VisualizationAlgorithms/LOxSeeds

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/LOxSeeds/#description","title":"Description","text":"

Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown.

Info

See Figure 12-15 in Chapter 12 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/LOxSeeds/#code","title":"Code","text":"

LOxSeeds.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <string>\n\n//// LOx post CFD case study\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" postxyz.bin postq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Read the data.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->AutoDetectFormatOn();\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(153);\n  pl3d->SetVectorFunctionNumber(200);\n  pl3d->Update();\n\n  vtkStructuredGrid* sg =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Blue to red lut.\n  //\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.667, 0.0);\n\n  std::vector<double*> seeds;\n  double seed1[3] = {-0.74, 0.0, 0.3};\n  double seed2[3] = {-0.74, 0.0, 1.0};\n  double seed3[3] = {-0.74, 0.0, 2.0};\n  double seed4[3] = {-0.74, 0.0, 3.0};\n  seeds.push_back(seed1);\n  seeds.push_back(seed2);\n  seeds.push_back(seed3);\n  seeds.push_back(seed4);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  for (size_t s = 0; s < seeds.size(); ++s)\n  {\n    // Computational planes.\n    vtkNew<vtkStructuredGridGeometryFilter> floorComp;\n    floorComp->SetExtent(0, 37, 0, 75, 0, 0);\n    floorComp->SetInputData(sg);\n    floorComp->Update();\n\n    vtkNew<vtkPolyDataMapper> floorMapper;\n    floorMapper->SetInputConnection(floorComp->GetOutputPort());\n    floorMapper->ScalarVisibilityOff();\n    floorMapper->SetLookupTable(lut);\n\n    vtkNew<vtkActor> floorActor;\n    floorActor->SetMapper(floorMapper);\n    floorActor->GetProperty()->SetRepresentationToWireframe();\n    floorActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n    floorActor->GetProperty()->SetLineWidth(2);\n\n    vtkNew<vtkStructuredGridGeometryFilter> postComp;\n    postComp->SetExtent(10, 10, 0, 75, 0, 37);\n    postComp->SetInputData(sg);\n\n    vtkNew<vtkPolyDataMapper> postMapper;\n    postMapper->SetInputConnection(postComp->GetOutputPort());\n    postMapper->SetLookupTable(lut);\n    postMapper->SetScalarRange(sg->GetScalarRange());\n    // postMapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> postActor;\n    postActor->SetMapper(postMapper);\n    // postActor->GetProperty()->SetRepresentationToWireframe();\n    postActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n    // streamers\n    //\n    // Spherical seed points.\n    vtkNew<vtkPointSource> rake;\n    rake->SetCenter(seeds[s]);\n    rake->SetNumberOfPoints(10);\n\n    vtkNew<vtkStreamTracer> streamers;\n    streamers->SetInputConnection(pl3d->GetOutputPort());\n\n    // streamers SetSource [rake GetOutput]\n    streamers->SetSourceConnection(rake->GetOutputPort());\n    streamers->SetMaximumPropagation(250);\n    streamers->SetInitialIntegrationStep(.2);\n    streamers->SetMinimumIntegrationStep(.01);\n    streamers->SetIntegratorType(2);\n    streamers->Update();\n\n    vtkNew<vtkTubeFilter> tubes;\n    tubes->SetInputConnection(streamers->GetOutputPort());\n    tubes->SetNumberOfSides(8);\n    tubes->SetRadius(0.08);\n    tubes->SetVaryRadius(0);\n\n    vtkNew<vtkPolyDataMapper> mapTubes;\n\n    mapTubes->SetInputConnection(tubes->GetOutputPort());\n    mapTubes->SetScalarRange(sg->GetScalarRange());\n\n    vtkNew<vtkActor> tubesActor;\n    tubesActor->SetMapper(mapTubes);\n\n    vtkNew<vtkRenderer> renderer;\n\n    renderer->AddActor(floorActor);\n    renderer->AddActor(postActor);\n    renderer->AddActor(tubesActor);\n    renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    renderers.push_back(renderer);\n  }\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  // Setup viewports for the renderers.\n  int rendererSize = 256;\n  unsigned int xGridDimensions = 2;\n  unsigned int yGridDimensions = 2;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(0.918037, -0.0779233, 2.69513);\n  camera->SetPosition(0.840735, -23.6176, 8.50211);\n  camera->SetViewUp(0.00227904, 0.239501, 0.970893);\n  camera->SetClippingRange(1, 100);\n\n  renderers[0]->SetActiveCamera(camera);\n  for (size_t r = 0; r < renderers.size(); ++r)\n  {\n    renderWindow->AddRenderer(renderers[r]);\n    if (r > 0)\n    {\n      renderers[r]->SetActiveCamera(camera);\n    }\n  }\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetSize(512, 512);\n  renderWindow->SetWindowName(\"LOxSeeds\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/LOxSeeds/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LOxSeeds)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LOxSeeds: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LOxSeeds MACOSX_BUNDLE LOxSeeds.cxx )\n  target_link_libraries(LOxSeeds PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LOxSeeds\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/LOxSeeds/#download-and-build-loxseeds","title":"Download and Build LOxSeeds","text":"

Click here to download LOxSeeds and its CMakeLists.txt file. Once the tarball LOxSeeds.tar has been downloaded and extracted,

cd LOxSeeds/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LOxSeeds\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCases/","title":"MarchingCases","text":"

vtk-examples/Cxx/VisualizationAlgorithms/MarchingCases

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCases/#description","title":"Description","text":"

This example will help you understand the Marching Cubes Algorithm. The example takes one optional argument, a case number. There are 15 Marching Cubes cases, 0-14. There are also 15 complementary cases where the inside/outside value is flipped. To see a complementary case, supply a negative case number. For example, -7 is the complementary case of 7.

Note

According to the ACM Digital Library, the Marching Cubes paper is the most cited Siggraph paper.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCases/#code","title":"Code","text":"

MarchingCases.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkExtractEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVectorText.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\n#include <algorithm>\n#include <iostream>\n#include <iterator>\n#include <map>\n#include <sstream>\n\nnamespace {\nstd::string ProgramParameters(std::string const& programName);\n\nvoid case0(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case1(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case2(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case3(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case4(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case5(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case6(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case7(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case8(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case9(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case10(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case11(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case12(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case13(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case14(vtkFloatArray*, vtkVectorText*, int, int);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  std::map<int, void (*)(vtkFloatArray*, vtkVectorText*, int, int)> cases;\n  cases[0] = &case0;\n  cases[1] = &case1;\n  cases[2] = &case2;\n  cases[3] = &case3;\n  cases[4] = &case4;\n  cases[5] = &case5;\n  cases[6] = &case6;\n  cases[7] = &case7;\n  cases[8] = &case8;\n  cases[9] = &case9;\n  cases[10] = &case10;\n  cases[11] = &case11;\n  cases[12] = &case12;\n  cases[13] = &case13;\n  cases[14] = &case14;\n\n  std::vector<int> mcCases;\n  auto mcCase = 7;\n  auto rotation = 0;\n  auto label = true;\n  if (argc > 1)\n  {\n    if (argc < 3)\n    {\n      std::cerr << ProgramParameters(argv[0]) << std::endl;\n      return EXIT_FAILURE;\n    }\n    auto numberOfCases = std::abs(atoi(argv[1]));\n    if (argc < numberOfCases + 2)\n    {\n      std::cerr << ProgramParameters(argv[0]) << std::endl;\n      return EXIT_FAILURE;\n    }\n    for (auto i = 0; i < numberOfCases; ++i)\n    {\n      mcCase = atoi(argv[i + 2]);\n      if (std::abs(mcCase) < 0 || std::abs(mcCase) > 14)\n      {\n        std::cerr << argv[0] << \" bad case number \" << mcCase << std::endl;\n        return EXIT_FAILURE;\n      }\n      mcCases.push_back(mcCase);\n    }\n    // Look for the optional parameters.\n    if (numberOfCases + 2 < argc)\n    {\n      // We have rotation.\n      rotation = std::abs(atoi(argv[numberOfCases + 2])) % 4;\n    }\n    if (numberOfCases + 3 < argc)\n    {\n      // We have a label option.\n      label = atoi(argv[numberOfCases + 3]) != 0;\n    }\n  }\n  else\n  {\n    mcCases.push_back(mcCase);\n  }\n\n  if (mcCases.size() == 1)\n  {\n    std::cout << \"Case: \" << mcCases[0] << std::endl;\n  }\n  else\n  {\n    if (!mcCases.empty())\n    {\n      std::ostringstream ss;\n      std::copy(mcCases.begin(), mcCases.end() - 1,\n                std::ostream_iterator<int>(ss, \", \"));\n      ss << mcCases.back();\n      std::cout << \"Cases: \" << ss.str() << std::endl;\n    }\n  }\n  std::cout << \"Rotated: \" << rotation * 90 << \" degrees.\" << std::endl;\n\n  vtkNew<vtkNamedColors> color;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(640, 480);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Always use a grid of four columns unless number of cases < 4.\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  int gridSize = ((static_cast<int>(mcCases.size()) + 3) / 4) * 4;\n  gridSize = static_cast<int>(mcCases.size()) < 4\n      ? static_cast<int>(mcCases.size())\n      : gridSize;\n  for (int i = 0; i < gridSize; ++i)\n  {\n    // Create the Renderer\n    vtkNew<vtkRenderer> renderer;\n    renderers.push_back(renderer);\n    // Set the background color.\n    renderers[i]->SetBackground(color->GetColor3d(\"slate_grey\").GetData());\n    renWin->AddRenderer(renderer);\n  }\n\n  for (size_t i = 0; i < mcCases.size(); ++i)\n  {\n    // Define a Single Cube\n    vtkNew<vtkFloatArray> Scalars;\n    Scalars->InsertNextValue(1.0);\n    Scalars->InsertNextValue(0.0);\n    Scalars->InsertNextValue(0.0);\n    Scalars->InsertNextValue(1.0);\n    Scalars->InsertNextValue(0.0);\n    Scalars->InsertNextValue(0.0);\n    Scalars->InsertNextValue(0.0);\n    Scalars->InsertNextValue(0.0);\n\n    vtkNew<vtkPoints> Points;\n    Points->InsertNextPoint(0, 0, 0);\n    Points->InsertNextPoint(1, 0, 0);\n    Points->InsertNextPoint(1, 1, 0);\n    Points->InsertNextPoint(0, 1, 0);\n    Points->InsertNextPoint(0, 0, 1);\n    Points->InsertNextPoint(1, 0, 1);\n    Points->InsertNextPoint(1, 1, 1);\n    Points->InsertNextPoint(0, 1, 1);\n\n    vtkNew<vtkIdList> Ids;\n    Ids->InsertNextId(0);\n    Ids->InsertNextId(1);\n    Ids->InsertNextId(2);\n    Ids->InsertNextId(3);\n    Ids->InsertNextId(4);\n    Ids->InsertNextId(5);\n    Ids->InsertNextId(6);\n    Ids->InsertNextId(7);\n\n    vtkNew<vtkUnstructuredGrid> Grid;\n    Grid->Allocate(10, 10);\n    Grid->InsertNextCell(12, Ids);\n    Grid->SetPoints(Points);\n    Grid->GetPointData()->SetScalars(Scalars);\n\n    // Find the triangles that lie along the 0.5 contour in this cube.\n    vtkNew<vtkContourFilter> Marching;\n    Marching->SetInputData(Grid);\n    Marching->SetValue(0, 0.5);\n    Marching->Update();\n\n    // Extract the edges of the triangles just found.\n    vtkNew<vtkExtractEdges> triangleEdges;\n    triangleEdges->SetInputConnection(Marching->GetOutputPort());\n\n    // Draw the edges as tubes instead of lines.  Also create the associated\n    // mapper and actor to display the tubes.\n    vtkNew<vtkTubeFilter> triangleEdgeTubes;\n    triangleEdgeTubes->SetInputConnection(triangleEdges->GetOutputPort());\n    triangleEdgeTubes->SetRadius(.005);\n    triangleEdgeTubes->SetNumberOfSides(6);\n    triangleEdgeTubes->UseDefaultNormalOn();\n    triangleEdgeTubes->SetDefaultNormal(.577, .577, .577);\n\n    vtkNew<vtkPolyDataMapper> triangleEdgeMapper;\n    triangleEdgeMapper->SetInputConnection(triangleEdgeTubes->GetOutputPort());\n    triangleEdgeMapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> triangleEdgeActor;\n    triangleEdgeActor->SetMapper(triangleEdgeMapper);\n    triangleEdgeActor->GetProperty()->SetDiffuseColor(\n        color->GetColor3d(\"lamp_black\").GetData());\n    triangleEdgeActor->GetProperty()->SetSpecular(.4);\n    triangleEdgeActor->GetProperty()->SetSpecularPower(10);\n\n    // Shrink the triangles we found earlier.  Create the associated mapper\n    // and actor.  Set the opacity of the shrunken triangles.\n    vtkNew<vtkShrinkPolyData> aShrinker;\n    aShrinker->SetShrinkFactor(1);\n    aShrinker->SetInputConnection(Marching->GetOutputPort());\n\n    vtkNew<vtkPolyDataMapper> aMapper;\n    aMapper->ScalarVisibilityOff();\n    aMapper->SetInputConnection(aShrinker->GetOutputPort());\n\n    vtkNew<vtkActor> Triangles;\n    Triangles->SetMapper(aMapper);\n    Triangles->GetProperty()->SetDiffuseColor(\n        color->GetColor3d(\"banana\").GetData());\n    Triangles->GetProperty()->SetOpacity(.6);\n\n    // Draw a cube the same size and at the same position as the one\n    // created previously.  Extract the edges because we only want to see\n    // the outline of the cube.  Pass the edges through a vtkTubeFilter so\n    // they are displayed as tubes rather than lines.\n    vtkNew<vtkCubeSource> CubeModel;\n    CubeModel->SetCenter(.5, .5, .5);\n\n    vtkNew<vtkExtractEdges> Edges;\n    Edges->SetInputConnection(CubeModel->GetOutputPort());\n\n    vtkNew<vtkTubeFilter> Tubes;\n    Tubes->SetInputConnection(Edges->GetOutputPort());\n    Tubes->SetRadius(.01);\n    Tubes->SetNumberOfSides(6);\n    Tubes->UseDefaultNormalOn();\n    Tubes->SetDefaultNormal(.577, .577, .577);\n    // Create the mapper and actor to display the cube edges.\n    vtkNew<vtkPolyDataMapper> TubeMapper;\n    TubeMapper->SetInputConnection(Tubes->GetOutputPort());\n    vtkNew<vtkActor> CubeEdges;\n    CubeEdges->SetMapper(TubeMapper);\n    CubeEdges->GetProperty()->SetDiffuseColor(\n        color->GetColor3d(\"khaki\").GetData());\n    CubeEdges->GetProperty()->SetSpecular(.4);\n    CubeEdges->GetProperty()->SetSpecularPower(10);\n\n    // Create a sphere to use as a glyph source for vtkGlyph3D.\n    vtkNew<vtkSphereSource> Sphere;\n    Sphere->SetRadius(0.04);\n    Sphere->SetPhiResolution(20);\n    Sphere->SetThetaResolution(20);\n    // Remove the part of the cube with data values below 0.5.\n    vtkNew<vtkThresholdPoints> ThresholdIn;\n    ThresholdIn->SetInputData(Grid);\n    ThresholdIn->ThresholdByUpper(.5);\n    // Display spheres at the vertices remaining in the cube data set after\n    // it was passed through vtkThresholdPoints.\n    vtkNew<vtkGlyph3D> Vertices;\n    Vertices->SetInputConnection(ThresholdIn->GetOutputPort());\n    Vertices->SetSourceConnection(Sphere->GetOutputPort());\n    // Create a mapper and actor to display the glyphs.\n    vtkNew<vtkPolyDataMapper> SphereMapper;\n    SphereMapper->SetInputConnection(Vertices->GetOutputPort());\n    SphereMapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> CubeVertices;\n    CubeVertices->SetMapper(SphereMapper);\n    CubeVertices->GetProperty()->SetDiffuseColor(\n        color->GetColor3d(\"tomato\").GetData());\n\n    // Define the text for the label\n    vtkNew<vtkVectorText> caseLabel;\n    caseLabel->SetText(\"Case 1\");\n\n    vtkNew<vtkActor> labelActor;\n\n    if (label)\n    {\n      // Set up a transform to move the label to a new position.\n      vtkNew<vtkTransform> aLabelTransform;\n      aLabelTransform->Identity();\n      // Position the label according to the rotation of the figure.\n      switch (rotation)\n      {\n      case 0:\n      default:\n        aLabelTransform->Translate(-0.2, 0, 1.25);\n        aLabelTransform->Scale(.05, .05, .05);\n        break;\n      case 1:\n        aLabelTransform->RotateY(90);\n        aLabelTransform->Translate(-1.25, 0, 1.25);\n        aLabelTransform->Scale(.05, .05, .05);\n        break;\n      case 2:\n        aLabelTransform->RotateY(180);\n        aLabelTransform->Translate(-1.25, 0, 0.2);\n        aLabelTransform->Scale(.05, .05, .05);\n        break;\n      case 3:\n        aLabelTransform->RotateY(270);\n        aLabelTransform->Translate(-0.2, 0, 0.2);\n        aLabelTransform->Scale(.05, .05, .05);\n        break;\n      }\n\n      // Move the label to a new position.\n      vtkNew<vtkTransformPolyDataFilter> labelTransform;\n      labelTransform->SetTransform(aLabelTransform);\n      labelTransform->SetInputConnection(caseLabel->GetOutputPort());\n\n      // Create a mapper and actor to display the text.\n      vtkNew<vtkPolyDataMapper> labelMapper;\n      labelMapper->SetInputConnection(labelTransform->GetOutputPort());\n\n      labelActor->SetMapper(labelMapper);\n    }\n    // Define the base that the cube sits on.  Create its associated mapper\n    // and actor.  Set the position of the actor.\n    vtkNew<vtkCubeSource> baseModel;\n    baseModel->SetXLength(1.5);\n    baseModel->SetYLength(.01);\n    baseModel->SetZLength(1.5);\n\n    vtkNew<vtkPolyDataMapper> baseMapper;\n    baseMapper->SetInputConnection(baseModel->GetOutputPort());\n\n    vtkNew<vtkActor> base;\n    base->SetMapper(baseMapper);\n    base->SetPosition(.5, -0.09, .5);\n\n    // Set the scalar values for this case of marching cubes.\n    // A negative case number will generate a complementary case\n    mcCase = mcCases[i];\n    if (mcCase < 0)\n    {\n      cases[-mcCase](Scalars, caseLabel, 0, 1);\n    }\n    else\n    {\n      cases[mcCase](Scalars, caseLabel, 1, 0);\n    }\n    // Force the grid to update.\n    Grid->Modified();\n\n    // Add the actors to the renderer\n    renderers[i]->AddActor(triangleEdgeActor);\n    renderers[i]->AddActor(base);\n    if (label)\n    {\n      renderers[i]->AddActor(labelActor);\n    }\n    renderers[i]->AddActor(CubeEdges);\n    renderers[i]->AddActor(CubeVertices);\n    renderers[i]->AddActor(Triangles);\n\n    // Position the camera.\n    renderers[i]->GetActiveCamera()->Dolly(1.2);\n    // Rotate the camera an extra 30 degrees so the cube is not face on.\n    switch (rotation)\n    {\n    case 0:\n    default:\n      renderers[i]->GetActiveCamera()->Azimuth(30);\n      break;\n    case 1:\n      renderers[i]->GetActiveCamera()->Azimuth(30 + 90);\n      break;\n    case 2:\n      renderers[i]->GetActiveCamera()->Azimuth(30 + 180);\n      break;\n    case 3:\n      renderers[i]->GetActiveCamera()->Azimuth(30 + 270);\n      break;\n    }\n    renderers[i]->GetActiveCamera()->Elevation(20);\n    renderers[i]->ResetCamera();\n    renderers[i]->ResetCameraClippingRange();\n    if (i > 0)\n    {\n      renderers[i]->SetActiveCamera(renderers[0]->GetActiveCamera());\n    }\n  }\n  // Setup viewports for the renderers\n  int rendererSize = 300;\n  int xGridDimensions = static_cast<int>(mcCases.size()) < 4\n      ? static_cast<int>(mcCases.size())\n      : 4;\n  int yGridDimensions = (static_cast<int>(mcCases.size()) - 1) / 4 + 1;\n  std::cout << \"Grid dimensions: (x, y): (\" << xGridDimensions << \", \"\n            << yGridDimensions << \")\" << std::endl;\n  renWin->SetSize(rendererSize * xGridDimensions,\n                  rendererSize * yGridDimensions);\n  renWin->SetWindowName(\"MarchingCases\");\n\n  for (int row = 0; row < yGridDimensions; row++)\n  {\n    for (int col = 0; col < xGridDimensions; col++)\n    {\n      int index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::string ProgramParameters(std::string const& programName)\n{\n  std::string ret =\n      \"Usage: \" + programName + \" [n [cases [cases ...]] [rotation] [label]\\n\";\n  ret += \"\\nMarching cubes cases for 3D isosurface generation.\\n\";\n  ret += \"arguments:\\n\";\n  ret += \"n         The number of cases\\n\";\n  ret += \"cases     A list of integers i such that 0 <= i < 14\\n\";\n  ret += \"            corresponding to the cases desired.\\n\";\n  ret += \"rotation  Rotate camera around the cube, for i such that 0 <= abs(i) \"\n         \"< 4,\\n\";\n  ret += \"            corresponding to 0, 90, 180, 270 degrees. Default = 0\\n\";\n  ret += \"label     Display a label entering 0 corresponds to false any other \"\n         \"number is true.\\n\";\n  ret += \"            Default is  true, 0 == false.\\n\";\n  ret += \"\\nExample parameter lists:\\n\";\n  ret +=\n      \"\\n3 1 7 12 3 0 Display three cubes: 7, 12, 3 rotated by 270 degrees\\n\";\n  ret += \"               around the y-axis with no labels.\\n\";\n  ret += \"1 7         Display one cube: 7, no rotation with a label.\\n\";\n  ret += \"1 7 0 0     Display one cube: 7, no rotation, no label.\\n\";\n\n  return ret;\n}\n\nvoid case0(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 0 - 00000000\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 0 - 11111111\");\n  }\n}\n\nvoid case1(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 1 - 00000001\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 1c - 11111110\");\n  }\n}\n\nvoid case2(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 2 - 00000011\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 2c - 11111100\");\n  }\n}\n\nvoid case3(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, IN);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 3 - 00000101\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 3c - 11111010\");\n  }\n}\n\nvoid case4(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 4 - 01000001\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 4c - 10111110\");\n  }\n}\n\nvoid case5(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 5 - 00110010\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 5c - 11001101\");\n  }\n}\n\nvoid case6(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 6 - 00011010\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 6c - 11100101\");\n  }\n}\n\nvoid case7(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 7 - 01000011\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 7c - 10111100\");\n  }\n}\n\nvoid case8(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 8 - 00110011\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 8c - 11001100\");\n  }\n}\n\nvoid case9(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, IN);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 9 - 01001110\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 9c - 10110001\");\n  }\n}\nvoid case10(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 10 - 01101001\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 10c - 10010110\");\n  }\n}\n\nvoid case11(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 11 - 01110001\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 11c - 10001110\");\n  }\n}\n\nvoid case12(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 12 - 00111010\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 12c - 11000101\");\n  }\n}\n\nvoid case13(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 13 - 01011010\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 13c - 10100101\");\n  }\n}\n\nvoid case14(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, IN);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, IN);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 14 - 11101101\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 14c - 00010010\");\n  }\n}\n} // namespace\n
"},{"location":"Cxx/VisualizationAlgorithms/MarchingCases/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCases)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCases: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCases MACOSX_BUNDLE MarchingCases.cxx )\n  target_link_libraries(MarchingCases PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCases\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/MarchingCases/#download-and-build-marchingcases","title":"Download and Build MarchingCases","text":"

Click here to download MarchingCases and its CMakeLists.txt file. Once the tarball MarchingCases.tar has been downloaded and extracted,

cd MarchingCases/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MarchingCases\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesA/","title":"MarchingCasesA","text":"

vtk-examples/Cxx/VisualizationAlgorithms/MarchingCasesA

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesA/#description","title":"Description","text":"

Marching cubes cases for 3D isosurface generation. The 256 possible cases have been reduced to 15 cases using symmetry. Red vertices are greater than the selected isosurface value.

This example runs the example MarchingCases with the arguments 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14.

Info

See Figure 6-6 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesA/#code","title":"Code","text":"

MarchingCasesA.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkExtractEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVectorText.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\n#include \"MarchingCases.cxx\"\n
"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesA/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCasesA)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCasesA: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCasesA MACOSX_BUNDLE MarchingCasesA.cxx )\n  target_link_libraries(MarchingCasesA PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCasesA\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesA/#download-and-build-marchingcasesa","title":"Download and Build MarchingCasesA","text":"

Click here to download MarchingCasesA and its CMakeLists.txt file. Once the tarball MarchingCasesA.tar has been downloaded and extracted,

cd MarchingCasesA/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MarchingCasesA\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesB/","title":"MarchingCasesB","text":"

vtk-examples/Cxx/VisualizationAlgorithms/MarchingCasesB

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesB/#description","title":"Description","text":"

Marching cubes complementary cases.

The example runs the example MarchingCases with the arguments 6 -3 -6 -7 -10 -12 -13

Cases 3c, 6c, 7c, 10c, 12c and 13c are displayed.

Info

See Figure 6-10 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesB/#code","title":"Code","text":"

MarchingCasesB.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkExtractEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVectorText.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\n#include \"MarchingCases.cxx\"\n
"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesB/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCasesB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCasesB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCasesB MACOSX_BUNDLE MarchingCasesB.cxx )\n  target_link_libraries(MarchingCasesB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCasesB\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesB/#download-and-build-marchingcasesb","title":"Download and Build MarchingCasesB","text":"

Click here to download MarchingCasesB and its CMakeLists.txt file. Once the tarball MarchingCasesB.tar has been downloaded and extracted,

cd MarchingCasesB/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MarchingCasesB\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesC/","title":"MarchingCasesC","text":"

vtk-examples/Cxx/VisualizationAlgorithms/MarchingCasesC

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesC/#description","title":"Description","text":"

Marching cubes cases.

The example runs the example MarchingCases with the argument 1 3 1 0

Case 3 is rotated 90 degrees about the y-axis with no label.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesC/#code","title":"Code","text":"

MarchingCasesC.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkExtractEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVectorText.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\n#include \"MarchingCases.cxx\"\n
"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesC/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCasesC)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCasesC: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCasesC MACOSX_BUNDLE MarchingCasesC.cxx )\n  target_link_libraries(MarchingCasesC PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCasesC\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesC/#download-and-build-marchingcasesc","title":"Download and Build MarchingCasesC","text":"

Click here to download MarchingCasesC and its CMakeLists.txt file. Once the tarball MarchingCasesC.tar has been downloaded and extracted,

cd MarchingCasesC/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MarchingCasesC\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesD/","title":"MarchingCasesD","text":"

vtk-examples/Cxx/VisualizationAlgorithms/MarchingCasesD

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesD/#description","title":"Description","text":"

Marching cubes cases.

The example runs the example MarchingCases with the argument 1 7 2 0

Case 7 is rotated 180 degrees about the y-axis with no label.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesD/#code","title":"Code","text":"

MarchingCasesD.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkExtractEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVectorText.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\n#include \"MarchingCases.cxx\"\n
"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesD/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCasesD)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCasesD: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCasesD MACOSX_BUNDLE MarchingCasesD.cxx )\n  target_link_libraries(MarchingCasesD PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCasesD\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesD/#download-and-build-marchingcasesd","title":"Download and Build MarchingCasesD","text":"

Click here to download MarchingCasesD and its CMakeLists.txt file. Once the tarball MarchingCasesD.tar has been downloaded and extracted,

cd MarchingCasesD/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MarchingCasesD\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/Motor/","title":"Motor","text":"

vtk-examples/Cxx/VisualizationAlgorithms/Motor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/Motor/#description","title":"Description","text":"

This is an example of texture clipping using a transparent texture map. The motor shown consists of five complex parts, some of which are hidden by the outer casing. To see the inside of the motor, we define an implicit clipping function. This function is simply the intersection of two planes to form a clipping \"corner\". The object vtkImplicitTextureCoords is used in combination with this implicit function to generate texture coordinates. These objects are then rendered with the appropriate texture map and the internal parts of the motor can be seen.

The texture map consists of three regions (as described previously in the chapter). The concealed region is transparent. The transition region is opaque but with a black (zero intensity) color. The highlighted region is full intensity and opaque. As can be seen from the result , the boundaries appear as black borders giving a nice visual effect.

Note the use of vectors in the C++ version and lists in the Python version to reduce repetitious code.

Info

See Figure 9-53 in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/Motor/#code","title":"Code","text":"

Motor.cxx

/*\nThis code is based on the VTK file: /IO/Geometry/Testing/Python/motor.py.\n*/\n\n#include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFloatArray.h>\n#include <vtkImplicitTextureCoords.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkTexture.h>\n\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" textureFile motorFile\" << std::endl;\n    std::cout << \"where: textureFile is the texture file: texThres2.vtk.\"\n              << std::endl;\n    std::cout << \"       motorFile is ihe motor file: motor.g.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string textureFile = argv[1];\n  std::string motorFile = argv[2];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the Renderer, RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the cutting planes.\n  vtkNew<vtkPlanes> planes;\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkFloatArray> norms;\n\n  norms->SetNumberOfComponents(3);\n  points->InsertPoint(0, 0.0, 0.0, 0.0);\n  norms->InsertTuple3(0, 0.0, 0.0, 1.0);\n  points->InsertPoint(1, 0.0, 0.0, 0.0);\n  norms->InsertTuple3(1, -1.0, 0.0, 0.0);\n  planes->SetPoints(points);\n  planes->SetNormals(norms);\n\n  // Get the texture.\n  vtkNew<vtkStructuredPointsReader> texReader;\n  texReader->SetFileName(textureFile.c_str());\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(texReader->GetOutputPort());\n  texture->InterpolateOff();\n  texture->RepeatOff();\n\n  // Set up the pipelines for the parts of the motor.\n  // We will use lists of pipeline objects.\n  auto numberOfParts = 5;\n  std::vector<vtkSmartPointer<vtkBYUReader>> byu;\n  std::vector<vtkSmartPointer<vtkPolyDataNormals>> normals;\n  std::vector<vtkSmartPointer<vtkImplicitTextureCoords>> tex;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> byuMapper;\n  std::vector<vtkSmartPointer<vtkActor>> byuActor;\n  std::vector<std::string> partColours{\"cold_grey\", \"peacock\", \"raw_sienna\",\n                                       \"banana\", \"peach_puff\"};\n  // Use this to control which parts to display.\n  std::vector<bool> displayParts(numberOfParts, true);\n  // If displayParts[2] = false; then an image like that in the VTK tests is\n  // produced.\n\n  for (auto i = 0; i < numberOfParts; ++i)\n  {\n    byu.push_back(vtkSmartPointer<vtkBYUReader>::New());\n    byu[i]->SetGeometryFileName(motorFile.c_str());\n    byu[i]->SetPartNumber(i + 1);\n\n    normals.push_back(vtkSmartPointer<vtkPolyDataNormals>::New());\n    normals[i]->SetInputConnection(byu[i]->GetOutputPort());\n\n    tex.push_back(vtkSmartPointer<vtkImplicitTextureCoords>::New());\n    tex[i]->SetInputConnection(normals[i]->GetOutputPort());\n    tex[i]->SetRFunction(planes);\n    // tex[i]->FlipTextureOn();\n\n    byuMapper.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    byuMapper[i]->SetInputConnection(tex[i]->GetOutputPort());\n\n    byuActor.push_back(vtkSmartPointer<vtkActor>::New());\n    byuActor[i]->SetMapper(byuMapper[i]);\n    byuActor[i]->SetTexture(texture);\n    byuActor[i]->GetProperty()->SetColor(\n        colors->GetColor3d(partColours[i]).GetData());\n\n    ren->AddActor(byuActor[i]);\n    if (displayParts[i])\n    {\n      byuActor[i]->VisibilityOn();\n    }\n    else\n    {\n      byuActor[i]->VisibilityOff();\n    }\n  }\n\n  ren->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"Motor\");\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(0.0286334, 0.0362996, 0.0379685);\n  camera->SetPosition(1.37067, 1.08629, -1.30349);\n  camera->SetViewAngle(17.673);\n  camera->SetClippingRange(1, 10);\n  camera->SetViewUp(-0.376306, -0.5085, -0.774482);\n  ren->SetActiveCamera(camera);\n\n  // Render the image.\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/Motor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Motor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersTexture\n  IOGeometry\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Motor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Motor MACOSX_BUNDLE Motor.cxx )\n  target_link_libraries(Motor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Motor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/Motor/#download-and-build-motor","title":"Download and Build Motor","text":"

Click here to download Motor and its CMakeLists.txt file. Once the tarball Motor.tar has been downloaded and extracted,

cd Motor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Motor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/Office/","title":"Office","text":"

vtk-examples/Cxx/VisualizationAlgorithms/Office

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/Office/#description","title":"Description","text":"

Using random point seeds to create streamlines.

This example demonstrates the use of vtkPointSource to generate streamlines. The dataset is a structured grid representation of a CFD simulation of flow in a small office with flow velocity and a scalar pressure field. As this picture shows, there are a couple of bookcases, desks, a window, and an inlet and outlet for the ventilation system. On one of the desks is a small, intense heat source (e.g., a cigarette).

We generate 25 streamlines that are started near the inlet using a vtkPointSource point generator. By adjusting a single parameter (e.g., the center of the point source) it is possible to quickly explore our simulation data.

This program provides you with an optional parameter to select from one of several point source centers. The figure was created using:

./Office office.vtk 3\n

Info

See Figure 9-47 in Chapter 9 in the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/Office/#code","title":"Code","text":"

Office.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredGridReader.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" filename [center] e.g. office.binary.vtk 3\" << std::endl;\n    std::cout\n        << \"Demonstrate the use of vtkPointSource to generate streamlines.\"\n        << std::endl;\n    std::cout << \"Where: \" << std::endl;\n    std::cout << \"       filename: office.binary.vtk\" << std::endl;\n    std::cout << \"       center: An optional parameter choosing the center for \"\n                 \"the seeds.\"\n              << std::endl;\n    std::cout\n        << \"               0 - Corresponds to Fig 9-47(a) in the VTK textbook.\"\n        << std::endl;\n    std::cout << \"               1 - A slight shift to the left.\" << std::endl;\n    std::cout << \"               2 - A slight shift to the upper left. (from \"\n                 \"the Original code).\"\n              << std::endl;\n    std::cout\n        << \"               3 - The default, a slight shift to the upper left.\"\n        << std::endl;\n    std::cout << \"                   Roughly corresponds to Fig 9-47(b) in the \"\n                 \"VTK textbook.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto center = 3;\n  if (argc > 2)\n  {\n    center = std::abs(atoi(argv[2]));\n  }\n  // These are the centers for the streamline seed.\n  std::vector<std::array<double, 3>> seedCenters{\n      {0.0, 2.1, 0.5}, {0.1, 2.1, 0.5}, {0.1, 2.7, 0.5}, {0.08, 2.7, 0.5}};\n  center = (center < static_cast<int>(seedCenters.size()))\n      ? center\n      : static_cast<int>(seedCenters.size()) - 1;\n\n  vtkNew<vtkNamedColors> colors;\n  std::array<double, 3> tableTopColor = {0.59, 0.427, 0.392};\n  std::array<double, 3> filingCabinetColor = {0.8, 0.8, 0.6};\n  std::array<double, 3> bookShelfColor = {0.8, 0.8, 0.6};\n  std::array<double, 3> windowColor = {0.3, 0.3, 0.5};\n  colors->SetColor(\"TableTop\", tableTopColor.data());\n  colors->SetColor(\"FilingCabinet\", filingCabinetColor.data());\n  colors->SetColor(\"BookShelf\", bookShelfColor.data());\n  colors->SetColor(\"Window\", windowColor.data());\n\n  // We read a data file that represents a CFD analysis of airflow in an office\n  // (with ventilation and a burning cigarette).\n  vtkNew<vtkStructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Create the scene.\n  // We generate a whole bunch of planes which correspond to\n  // the geometry in the analysis; tables, bookshelves and so on.\n  vtkNew<vtkStructuredGridGeometryFilter> table1;\n  table1->SetInputConnection(reader->GetOutputPort());\n  table1->SetExtent(11, 15, 7, 9, 8, 8);\n  vtkNew<vtkPolyDataMapper> mapTable1;\n  mapTable1->SetInputConnection(table1->GetOutputPort());\n  mapTable1->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> table1Actor;\n  table1Actor->SetMapper(mapTable1);\n  table1Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"TableTop\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> table2;\n  table2->SetInputConnection(reader->GetOutputPort());\n  table2->SetExtent(11, 15, 10, 12, 8, 8);\n  vtkNew<vtkPolyDataMapper> mapTable2;\n  mapTable2->SetInputConnection(table2->GetOutputPort());\n  mapTable2->ScalarVisibilityOff();\n  vtkNew<vtkActor> table2Actor;\n  table2Actor->SetMapper(mapTable2);\n  table2Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"TableTop\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> FilingCabinet1;\n  FilingCabinet1->SetInputConnection(reader->GetOutputPort());\n  FilingCabinet1->SetExtent(15, 15, 7, 9, 0, 8);\n  vtkNew<vtkPolyDataMapper> mapFilingCabinet1;\n  mapFilingCabinet1->SetInputConnection(FilingCabinet1->GetOutputPort());\n  mapFilingCabinet1->ScalarVisibilityOff();\n  vtkNew<vtkActor> FilingCabinet1Actor;\n  FilingCabinet1Actor->SetMapper(mapFilingCabinet1);\n  FilingCabinet1Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"FilingCabinet\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> FilingCabinet2;\n  FilingCabinet2->SetInputConnection(reader->GetOutputPort());\n  FilingCabinet2->SetExtent(15, 15, 10, 12, 0, 8);\n  vtkNew<vtkPolyDataMapper> mapFilingCabinet2;\n  mapFilingCabinet2->SetInputConnection(FilingCabinet2->GetOutputPort());\n  mapFilingCabinet2->ScalarVisibilityOff();\n  vtkNew<vtkActor> FilingCabinet2Actor;\n  FilingCabinet2Actor->SetMapper(mapFilingCabinet2);\n  FilingCabinet2Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"FilingCabinet\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Top;\n  bookshelf1Top->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Top->SetExtent(13, 13, 0, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Top;\n\n  mapBookshelf1Top->SetInputConnection(bookshelf1Top->GetOutputPort());\n  mapBookshelf1Top->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1TopActor;\n  bookshelf1TopActor->SetMapper(mapBookshelf1Top);\n  bookshelf1TopActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Bottom;\n  bookshelf1Bottom->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Bottom->SetExtent(20, 20, 0, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Bottom;\n  mapBookshelf1Bottom->SetInputConnection(bookshelf1Bottom->GetOutputPort());\n  mapBookshelf1Bottom->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1BottomActor;\n  bookshelf1BottomActor->SetMapper(mapBookshelf1Bottom);\n  bookshelf1BottomActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Front;\n  bookshelf1Front->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Front->SetExtent(13, 20, 0, 0, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Front;\n  mapBookshelf1Front->SetInputConnection(bookshelf1Front->GetOutputPort());\n  mapBookshelf1Front->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1FrontActor;\n  bookshelf1FrontActor->SetMapper(mapBookshelf1Front);\n  bookshelf1FrontActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Back;\n  bookshelf1Back->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Back->SetExtent(13, 20, 4, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Back;\n  mapBookshelf1Back->SetInputConnection(bookshelf1Back->GetOutputPort());\n  mapBookshelf1Back->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1BackActor;\n  bookshelf1BackActor->SetMapper(mapBookshelf1Back);\n  bookshelf1BackActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1LHS;\n  bookshelf1LHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf1LHS->SetExtent(13, 20, 0, 4, 0, 0);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1LHS;\n  mapBookshelf1LHS->SetInputConnection(bookshelf1LHS->GetOutputPort());\n  mapBookshelf1LHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1LHSActor;\n  bookshelf1LHSActor->SetMapper(mapBookshelf1LHS);\n  bookshelf1LHSActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1RHS;\n  bookshelf1RHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf1RHS->SetExtent(13, 20, 0, 4, 11, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1RHS;\n  mapBookshelf1RHS->SetInputConnection(bookshelf1RHS->GetOutputPort());\n  mapBookshelf1RHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1RHSActor;\n  bookshelf1RHSActor->SetMapper(mapBookshelf1RHS);\n  bookshelf1RHSActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Top;\n  bookshelf2Top->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Top->SetExtent(13, 13, 15, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Top;\n  mapBookshelf2Top->SetInputConnection(bookshelf2Top->GetOutputPort());\n  mapBookshelf2Top->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2TopActor;\n  bookshelf2TopActor->SetMapper(mapBookshelf2Top);\n  bookshelf2TopActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Bottom;\n  bookshelf2Bottom->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Bottom->SetExtent(20, 20, 15, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Bottom;\n  mapBookshelf2Bottom->SetInputConnection(bookshelf2Bottom->GetOutputPort());\n  mapBookshelf2Bottom->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2BottomActor;\n  bookshelf2BottomActor->SetMapper(mapBookshelf2Bottom);\n  bookshelf2BottomActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Front;\n  bookshelf2Front->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Front->SetExtent(13, 20, 15, 15, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Front;\n  mapBookshelf2Front->SetInputConnection(bookshelf2Front->GetOutputPort());\n  mapBookshelf2Front->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2FrontActor;\n\n  bookshelf2FrontActor->SetMapper(mapBookshelf2Front);\n  bookshelf2FrontActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Back;\n  bookshelf2Back->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Back->SetExtent(13, 20, 19, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Back;\n  mapBookshelf2Back->SetInputConnection(bookshelf2Back->GetOutputPort());\n  mapBookshelf2Back->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2BackActor;\n  bookshelf2BackActor->SetMapper(mapBookshelf2Back);\n  bookshelf2BackActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2LHS;\n\n  bookshelf2LHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf2LHS->SetExtent(13, 20, 15, 19, 0, 0);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2LHS;\n  mapBookshelf2LHS->SetInputConnection(bookshelf2LHS->GetOutputPort());\n  mapBookshelf2LHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2LHSActor;\n  bookshelf2LHSActor->SetMapper(mapBookshelf2LHS);\n  bookshelf2LHSActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2RHS;\n  bookshelf2RHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf2RHS->SetExtent(13, 20, 15, 19, 11, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2RHS;\n  mapBookshelf2RHS->SetInputConnection(bookshelf2RHS->GetOutputPort());\n  mapBookshelf2RHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2RHSActor;\n  bookshelf2RHSActor->SetMapper(mapBookshelf2RHS);\n  bookshelf2RHSActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> window;\n  window->SetInputConnection(reader->GetOutputPort());\n  window->SetExtent(20, 20, 6, 13, 10, 13);\n  vtkNew<vtkPolyDataMapper> mapWindow;\n\n  mapWindow->SetInputConnection(window->GetOutputPort());\n  mapWindow->ScalarVisibilityOff();\n  vtkNew<vtkActor> windowActor;\n  windowActor->SetMapper(mapWindow);\n  windowActor->GetProperty()->SetColor(colors->GetColor3d(\"Window\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> outlet;\n  outlet->SetInputConnection(reader->GetOutputPort());\n  outlet->SetExtent(0, 0, 9, 10, 14, 16);\n  vtkNew<vtkPolyDataMapper> mapOutlet;\n  mapOutlet->SetInputConnection(outlet->GetOutputPort());\n  mapOutlet->ScalarVisibilityOff();\n  vtkNew<vtkActor> outletActor;\n  outletActor->SetMapper(mapOutlet);\n  outletActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"lamp_black\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> inlet;\n  inlet->SetInputConnection(reader->GetOutputPort());\n  inlet->SetExtent(0, 0, 9, 10, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapInlet;\n  mapInlet->SetInputConnection(inlet->GetOutputPort());\n  mapInlet->ScalarVisibilityOff();\n  vtkNew<vtkActor> inletActor;\n  inletActor->SetMapper(mapInlet);\n  inletActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"lamp_black\").GetData());\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(mapOutline);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the source for the streamtubes.\n  vtkNew<vtkPointSource> seeds;\n  seeds->SetRadius(0.075);\n  seeds->SetCenter(seedCenters[center].data());\n  seeds->SetNumberOfPoints(25);\n  vtkNew<vtkStreamTracer> streamers;\n  streamers->SetInputConnection(reader->GetOutputPort());\n  streamers->SetSourceConnection(seeds->GetOutputPort());\n  streamers->SetMaximumPropagation(500);\n  streamers->SetMinimumIntegrationStep(0.1);\n  streamers->SetMaximumIntegrationStep(1.0);\n  streamers->SetInitialIntegrationStep(0.2);\n  streamers->SetIntegratorType(2);\n  streamers->Update();\n  vtkNew<vtkPolyDataMapper> mapStreamers;\n  mapStreamers->SetInputConnection(streamers->GetOutputPort());\n  mapStreamers->SetScalarRange(\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange());\n  vtkNew<vtkActor> streamersActor;\n  streamersActor->SetMapper(mapStreamers);\n\n  // Now create the usual graphics stuff.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(table1Actor);\n  renderer->AddActor(table2Actor);\n  renderer->AddActor(FilingCabinet1Actor);\n  renderer->AddActor(FilingCabinet2Actor);\n  renderer->AddActor(bookshelf1TopActor);\n  renderer->AddActor(bookshelf1BottomActor);\n  renderer->AddActor(bookshelf1FrontActor);\n  renderer->AddActor(bookshelf1BackActor);\n  renderer->AddActor(bookshelf1LHSActor);\n  renderer->AddActor(bookshelf1RHSActor);\n  renderer->AddActor(bookshelf2TopActor);\n  renderer->AddActor(bookshelf2BottomActor);\n  renderer->AddActor(bookshelf2FrontActor);\n  renderer->AddActor(bookshelf2BackActor);\n  renderer->AddActor(bookshelf2LHSActor);\n  renderer->AddActor(bookshelf2RHSActor);\n  renderer->AddActor(windowActor);\n  renderer->AddActor(outletActor);\n  renderer->AddActor(inletActor);\n  renderer->AddActor(outlineActor);\n  renderer->AddActor(streamersActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Here we specify a particular view.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetClippingRange(0.726079, 36.3039);\n  aCamera->SetFocalPoint(2.43584, 2.15046, 1.11104);\n  aCamera->SetPosition(-4.76183, -10.4426, 3.17203);\n  aCamera->SetViewUp(0.0511273, 0.132773, 0.989827);\n  aCamera->SetViewAngle(18.604);\n  aCamera->Zoom(1.2);\n\n  renderer->SetActiveCamera(aCamera);\n\n  renderWindow->SetSize(640, 400);\n  renderWindow->SetWindowName(\"Office\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/Office/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Office)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Office: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Office MACOSX_BUNDLE Office.cxx )\n  target_link_libraries(Office PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Office\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/Office/#download-and-build-office","title":"Download and Build Office","text":"

Click here to download Office and its CMakeLists.txt file. Once the tarball Office.tar has been downloaded and extracted,

cd Office/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Office\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/OfficeA/","title":"OfficeA","text":"

vtk-examples/Cxx/VisualizationAlgorithms/OfficeA

"},{"location":"Cxx/VisualizationAlgorithms/OfficeA/#description","title":"Description","text":"

This example runs Office.cxx as follows:

  ./OfficeA office.binary.vtk 0\n

Info

See Figure 9-47 in Chapter 9 in the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/OfficeA/#code","title":"Code","text":"

OfficeA.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredGridReader.h>\n\n#include \"Office.cxx\"\n
"},{"location":"Cxx/VisualizationAlgorithms/OfficeA/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OfficeA)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OfficeA: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OfficeA MACOSX_BUNDLE OfficeA.cxx )\n  target_link_libraries(OfficeA PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OfficeA\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/OfficeA/#download-and-build-officea","title":"Download and Build OfficeA","text":"

Click here to download OfficeA and its CMakeLists.txt file. Once the tarball OfficeA.tar has been downloaded and extracted,

cd OfficeA/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OfficeA\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/OfficeTube/","title":"OfficeTube","text":"

vtk-examples/Cxx/VisualizationAlgorithms/OfficeTube

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/OfficeTube/#description","title":"Description","text":"

The stream polygon. (a) Planar view. (b) Aligned with vector. (c) Aligned along streamline. (d) Sweeping polygon to form tube.

Info

See Figure 9-12 in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/OfficeTube/#code","title":"Code","text":"

OfficeTube.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRungeKutta4.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredGridReader.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" office.binary.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // We read a data file the is a CFD analysis of airflow in an office (with\n  // ventilation and a burning cigarette). We force an update so that we\n  // can query the output for its length, i.e., the length of the diagonal\n  // of the bounding box. This is useful for normalizing the data.\n  //\n  vtkNew<vtkStructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update(); // force a read to occur\n\n  // Now we will generate a single streamline in the data. We select the\n  // integration order to use (RungeKutta order 4) and associate it with\n  // the streamer. The start position is the position in world space where\n  // we want to begin streamline integration; and we integrate in both\n  // directions. The step length is the length of the line segments that\n  // make up the streamline (i.e., related to display). The\n  // IntegrationStepLength specifies the integration step length as a\n  // fraction of the cell size that the streamline is in.\n  vtkNew<vtkRungeKutta4> integ;\n\n  vtkNew<vtkStreamTracer> streamer;\n  streamer->SetInputConnection(reader->GetOutputPort());\n  streamer->SetStartPosition(0.1, 2.1, 0.5);\n  streamer->SetMaximumPropagation(500);\n  streamer->SetInitialIntegrationStep(0.05);\n  streamer->SetIntegrationDirectionToBoth();\n  streamer->SetIntegrator(integ);\n\n  // The tube is wrapped around the generated streamline. By varying the radius\n  // by the inverse of vector magnitude, we are creating a tube whose radius is\n  // proportional to mass flux (in incompressible flow).\n  vtkNew<vtkTubeFilter> streamTube;\n  streamTube->SetInputConnection(streamer->GetOutputPort());\n  streamTube->SetInputArrayToProcess(\n      1, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, \"vectors\");\n  streamTube->SetRadius(0.02);\n  streamTube->SetNumberOfSides(12);\n  streamTube->SetVaryRadiusToVaryRadiusByVector();\n\n  vtkNew<vtkPolyDataMapper> mapStreamTube;\n  mapStreamTube->SetInputConnection(streamTube->GetOutputPort());\n  mapStreamTube->SetScalarRange(\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange());\n\n  vtkNew<vtkActor> streamTubeActor;\n  streamTubeActor->SetMapper(mapStreamTube);\n  streamTubeActor->GetProperty()->BackfaceCullingOn();\n\n  // From here on we generate a whole bunch of planes which correspond to\n  // the geometry in the analysis; tables, bookshelves and so on.\n  vtkNew<vtkStructuredGridGeometryFilter> table1;\n  table1->SetInputConnection(reader->GetOutputPort());\n  table1->SetExtent(11, 15, 7, 9, 8, 8);\n  vtkNew<vtkPolyDataMapper> mapTable1;\n  mapTable1->SetInputConnection(table1->GetOutputPort());\n  mapTable1->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> table1Actor;\n  table1Actor->SetMapper(mapTable1);\n  table1Actor->GetProperty()->SetColor(.59, .427, .392);\n\n  vtkNew<vtkStructuredGridGeometryFilter> table2;\n  table2->SetInputConnection(reader->GetOutputPort());\n  table2->SetExtent(11, 15, 10, 12, 8, 8);\n  vtkNew<vtkPolyDataMapper> mapTable2;\n  mapTable2->SetInputConnection(table2->GetOutputPort());\n  mapTable2->ScalarVisibilityOff();\n  vtkNew<vtkActor> table2Actor;\n  table2Actor->SetMapper(mapTable2);\n  table2Actor->GetProperty()->SetColor(.59, .427, .392);\n\n  vtkNew<vtkStructuredGridGeometryFilter> FilingCabinet1;\n  FilingCabinet1->SetInputConnection(reader->GetOutputPort());\n  FilingCabinet1->SetExtent(15, 15, 7, 9, 0, 8);\n  vtkNew<vtkPolyDataMapper> mapFilingCabinet1;\n  mapFilingCabinet1->SetInputConnection(FilingCabinet1->GetOutputPort());\n  mapFilingCabinet1->ScalarVisibilityOff();\n  vtkNew<vtkActor> FilingCabinet1Actor;\n  FilingCabinet1Actor->SetMapper(mapFilingCabinet1);\n  FilingCabinet1Actor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> FilingCabinet2;\n  FilingCabinet2->SetInputConnection(reader->GetOutputPort());\n  FilingCabinet2->SetExtent(15, 15, 10, 12, 0, 8);\n  vtkNew<vtkPolyDataMapper> mapFilingCabinet2;\n  mapFilingCabinet2->SetInputConnection(FilingCabinet2->GetOutputPort());\n  mapFilingCabinet2->ScalarVisibilityOff();\n  vtkNew<vtkActor> FilingCabinet2Actor;\n  FilingCabinet2Actor->SetMapper(mapFilingCabinet2);\n  FilingCabinet2Actor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Top;\n  bookshelf1Top->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Top->SetExtent(13, 13, 0, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Top;\n\n  mapBookshelf1Top->SetInputConnection(bookshelf1Top->GetOutputPort());\n  mapBookshelf1Top->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1TopActor;\n  bookshelf1TopActor->SetMapper(mapBookshelf1Top);\n  bookshelf1TopActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Bottom;\n  bookshelf1Bottom->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Bottom->SetExtent(20, 20, 0, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Bottom;\n  mapBookshelf1Bottom->SetInputConnection(bookshelf1Bottom->GetOutputPort());\n  mapBookshelf1Bottom->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1BottomActor;\n  bookshelf1BottomActor->SetMapper(mapBookshelf1Bottom);\n  bookshelf1BottomActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Front;\n  bookshelf1Front->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Front->SetExtent(13, 20, 0, 0, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Front;\n  mapBookshelf1Front->SetInputConnection(bookshelf1Front->GetOutputPort());\n  mapBookshelf1Front->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1FrontActor;\n  bookshelf1FrontActor->SetMapper(mapBookshelf1Front);\n  bookshelf1FrontActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Back;\n  bookshelf1Back->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Back->SetExtent(13, 20, 4, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Back;\n  mapBookshelf1Back->SetInputConnection(bookshelf1Back->GetOutputPort());\n  mapBookshelf1Back->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1BackActor;\n  bookshelf1BackActor->SetMapper(mapBookshelf1Back);\n  bookshelf1BackActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1LHS;\n  bookshelf1LHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf1LHS->SetExtent(13, 20, 0, 4, 0, 0);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1LHS;\n  mapBookshelf1LHS->SetInputConnection(bookshelf1LHS->GetOutputPort());\n  mapBookshelf1LHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1LHSActor;\n  bookshelf1LHSActor->SetMapper(mapBookshelf1LHS);\n  bookshelf1LHSActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1RHS;\n  bookshelf1RHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf1RHS->SetExtent(13, 20, 0, 4, 11, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1RHS;\n  mapBookshelf1RHS->SetInputConnection(bookshelf1RHS->GetOutputPort());\n  mapBookshelf1RHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1RHSActor;\n  bookshelf1RHSActor->SetMapper(mapBookshelf1RHS);\n  bookshelf1RHSActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Top;\n  bookshelf2Top->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Top->SetExtent(13, 13, 15, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Top;\n  mapBookshelf2Top->SetInputConnection(bookshelf2Top->GetOutputPort());\n  mapBookshelf2Top->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2TopActor;\n  bookshelf2TopActor->SetMapper(mapBookshelf2Top);\n  bookshelf2TopActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Bottom;\n  bookshelf2Bottom->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Bottom->SetExtent(20, 20, 15, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Bottom;\n  mapBookshelf2Bottom->SetInputConnection(bookshelf2Bottom->GetOutputPort());\n  mapBookshelf2Bottom->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2BottomActor;\n  bookshelf2BottomActor->SetMapper(mapBookshelf2Bottom);\n  bookshelf2BottomActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Front;\n  bookshelf2Front->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Front->SetExtent(13, 20, 15, 15, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Front;\n  mapBookshelf2Front->SetInputConnection(bookshelf2Front->GetOutputPort());\n  mapBookshelf2Front->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2FrontActor;\n\n  bookshelf2FrontActor->SetMapper(mapBookshelf2Front);\n  bookshelf2FrontActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Back;\n  bookshelf2Back->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Back->SetExtent(13, 20, 19, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Back;\n  mapBookshelf2Back->SetInputConnection(bookshelf2Back->GetOutputPort());\n  mapBookshelf2Back->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2BackActor;\n  bookshelf2BackActor->SetMapper(mapBookshelf2Back);\n  bookshelf2BackActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2LHS;\n\n  bookshelf2LHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf2LHS->SetExtent(13, 20, 15, 19, 0, 0);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2LHS;\n  mapBookshelf2LHS->SetInputConnection(bookshelf2LHS->GetOutputPort());\n  mapBookshelf2LHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2LHSActor;\n  bookshelf2LHSActor->SetMapper(mapBookshelf2LHS);\n  bookshelf2LHSActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2RHS;\n  bookshelf2RHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf2RHS->SetExtent(13, 20, 15, 19, 11, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2RHS;\n  mapBookshelf2RHS->SetInputConnection(bookshelf2RHS->GetOutputPort());\n  mapBookshelf2RHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2RHSActor;\n  bookshelf2RHSActor->SetMapper(mapBookshelf2RHS);\n  bookshelf2RHSActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> window;\n  window->SetInputConnection(reader->GetOutputPort());\n  window->SetExtent(20, 20, 6, 13, 10, 13);\n  vtkNew<vtkPolyDataMapper> mapWindow;\n\n  mapWindow->SetInputConnection(window->GetOutputPort());\n  mapWindow->ScalarVisibilityOff();\n  vtkNew<vtkActor> windowActor;\n  windowActor->SetMapper(mapWindow);\n  windowActor->GetProperty()->SetColor(.3, .3, .5);\n\n  vtkNew<vtkStructuredGridGeometryFilter> outlet;\n  outlet->SetInputConnection(reader->GetOutputPort());\n  outlet->SetExtent(0, 0, 9, 10, 14, 16);\n  vtkNew<vtkPolyDataMapper> mapOutlet;\n  mapOutlet->SetInputConnection(outlet->GetOutputPort());\n  mapOutlet->ScalarVisibilityOff();\n  vtkNew<vtkActor> outletActor;\n  outletActor->SetMapper(mapOutlet);\n  outletActor->GetProperty()->SetColor(0, 0, 0);\n\n  vtkNew<vtkStructuredGridGeometryFilter> inlet;\n  inlet->SetInputConnection(reader->GetOutputPort());\n  inlet->SetExtent(0, 0, 9, 10, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapInlet;\n  mapInlet->SetInputConnection(inlet->GetOutputPort());\n  mapInlet->ScalarVisibilityOff();\n  vtkNew<vtkActor> inletActor;\n  inletActor->SetMapper(mapInlet);\n  inletActor->GetProperty()->SetColor(0, 0, 0);\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(mapOutline);\n  outlineActor->GetProperty()->SetColor(0, 0, 0);\n\n  // Now create the usual graphics stuff.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(table1Actor);\n  renderer->AddActor(table2Actor);\n  renderer->AddActor(FilingCabinet1Actor);\n  renderer->AddActor(FilingCabinet2Actor);\n  renderer->AddActor(bookshelf1TopActor);\n  renderer->AddActor(bookshelf1BottomActor);\n  renderer->AddActor(bookshelf1FrontActor);\n  renderer->AddActor(bookshelf1BackActor);\n  renderer->AddActor(bookshelf1LHSActor);\n  renderer->AddActor(bookshelf1RHSActor);\n  renderer->AddActor(bookshelf2TopActor);\n  renderer->AddActor(bookshelf2BottomActor);\n  renderer->AddActor(bookshelf2FrontActor);\n  renderer->AddActor(bookshelf2BackActor);\n  renderer->AddActor(bookshelf2LHSActor);\n  renderer->AddActor(bookshelf2RHSActor);\n  renderer->AddActor(windowActor);\n  renderer->AddActor(outletActor);\n  renderer->AddActor(inletActor);\n  renderer->AddActor(outlineActor);\n  renderer->AddActor(streamTubeActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Here we specify a particular view.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetClippingRange(0.726079, 36.3039);\n  aCamera->SetFocalPoint(2.43584, 2.15046, 1.11104);\n  aCamera->SetPosition(-4.76183, -10.4426, 3.17203);\n  aCamera->SetViewUp(0.0511273, 0.132773, 0.989827);\n  aCamera->SetViewAngle(18.604);\n  aCamera->Zoom(1.2);\n\n  renderer->SetActiveCamera(aCamera);\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"OfficeTube\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/OfficeTube/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OfficeTube)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonMath\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OfficeTube: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OfficeTube MACOSX_BUNDLE OfficeTube.cxx )\n  target_link_libraries(OfficeTube PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OfficeTube\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/OfficeTube/#download-and-build-officetube","title":"Download and Build OfficeTube","text":"

Click here to download OfficeTube and its CMakeLists.txt file. Once the tarball OfficeTube.tar has been downloaded and extracted,

cd OfficeTube/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OfficeTube\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/","title":"PineRootConnectivity","text":"

vtk-examples/Cxx/VisualizationAlgorithms/PineRootConnectivity

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#description","title":"Description","text":"

Demonstrates how to apply the connectivity filter to remove noisy isosurfaces.

To illustrate the application of connectivity analysis, we will use an MRI dataset generated by Janet MacFall at the Center for In Vivo Microscopy at Duke University. The dataset is a volume of dimensions 256^3. The data is of the root system of a small pine tree. Using the class vtkSliceCubes , an implementation of marching cubes for large volumes, we generate an initial isosurface represented by 351,536 triangles. This is a faster way of manipulating this data. If you have a large enough computer you can process the volume directly with a vtk image reader and vtkMarchingCubes. The example on this other page shows the initial dataset. Notice that there are many small, disconnected isosurfaces due to noise and isolated moisture in the data. We use vtkConnectivityFilter to remove these small, disconnected surfaces. The example on this page shows the result of applying the filter. Over 50,000 triangles were removed, leaving 299,380 triangles. The vtkConnectivityFilter is a general filter taking datasets as input, and generating an unstructured grid as output. It functions by extracting cells that are connected at points (i.e., share common points). In this example the single largest surface is extracted. It is also possible to specify cell ids and point ids and extract surfaces connected to these.

Info

To count the number of triangles in the polydata we do the following:

Cite

Comparative Water Uptake by Roots of Different Ages in Seedlings of Loblolly Pine (Pinus taeda L.) December 1991. New Phytologist 119(4):551 - 560.

Info

See Figure 9-51 in Chapter 9 in the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#c","title":"C++","text":"

We use a lambda function c++ auto NumberofTriangles = [](auto *pd)

"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#python","title":"Python","text":"

We just implement: python def NumberOfTriangles(pd): within the scope of the calling function.

"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#code","title":"Code","text":"

PineRootConnectivity.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMCubesReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#ifdef VTK_CELL_ARRAY_V2\n#include <vtkCellArrayIterator.h>\n#endif // VTK_CELL_ARRAY_V2\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [noConnectivity]\"\n              << std::endl;\n    std::cout << \"where: filename is pine_root.tri.\" << std::endl;\n    std::cout << \"       if noConnectivity is nonzero then the connectivity \"\n                 \"filter is ignored.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  /**\n   * Count the triangles in the polydata.\n   * @param pd: vtkPolyData.\n   * @return The number of triangles.\n   */\n  auto NumberofTriangles = [](vtkPolyData* pd) {\n    vtkCellArray* cells = pd->GetPolys();\n    vtkIdType npts = 0;\n    auto numOfTriangles = 0;\n#ifdef VTK_CELL_ARRAY_V2\n\n    // Newer versions of vtkCellArray prefer local iterators:\n    auto cellIter = vtk::TakeSmartPointer(cells->NewIterator());\n    for (cellIter->GoToFirstCell(); !cellIter->IsDoneWithTraversal();\n         cellIter->GoToNextCell())\n    {\n      auto cell = cellIter->GetCurrentCell();\n      if (cell == nullptr)\n      {\n        break;\n      }\n      // If a cell has three points it is a triangle.\n      if (cell->GetNumberOfIds() == 3)\n      {\n        numOfTriangles++;\n      }\n    }\n\n#else  // VTK_CELL_ARRAY_V2\n\n    // Older implementations of vtkCellArray use internal iterator APIs (not\n    // thread safe):\n    vtkIdType* pts;\n    for (auto i = 0; i < pd->GetNumberOfPolys(); ++i)\n    {\n      int c = cells->GetNextCell(npts, pts);\n      if (c == 0)\n      {\n        break;\n      }\n      // If a cell has three points it is a triangle.\n      if (npts == 3)\n      {\n        numOfTriangles++;\n      }\n    }\n#endif // VTK_CELL_ARRAY_V2\n\n    return numOfTriangles;\n  };\n\n  std::string fileName = argv[1];\n  auto noConnectivity = false;\n  if (argc > 2)\n  {\n    noConnectivity = atoi(argv[2]) != 0;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the pipeline.\n  vtkNew<vtkMCubesReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->FlipNormalsOff();\n  if (!noConnectivity)\n  {\n    reader->Update();\n    std::cout << \"Before Connectivity there are: \"\n              << NumberofTriangles(reader->GetOutput()) << \" triangles.\"\n              << std::endl;\n  }\n\n  vtkNew<vtkPolyDataConnectivityFilter> connect;\n  connect->SetInputConnection(reader->GetOutputPort());\n  connect->SetExtractionModeToLargestRegion();\n  if (!noConnectivity)\n  {\n    connect->Update();\n    std::cout << \"After Connectivity there are:  \"\n              << NumberofTriangles(\n                     dynamic_cast<vtkPolyData*>(connect->GetOutput()))\n              << \" triangles.\" << std::endl;\n  }\n\n  vtkNew<vtkDataSetMapper> isoMapper;\n  if (noConnectivity)\n  {\n    isoMapper->SetInputConnection(reader->GetOutputPort());\n  }\n  else\n  {\n    isoMapper->SetInputConnection(connect->GetOutputPort());\n  }\n  isoMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"raw_sienna\").GetData());\n\n  // Get an outline of the data set for context.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the Renderer, RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(outlineActor);\n  ren->AddActor(isoActor);\n  // renWin->SetSize(750, 750);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"PineRootConnectivity\");\n\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkCamera* cam = ren->GetActiveCamera();\n  cam->SetFocalPoint(40.6018, 37.2813, 50.1953);\n  cam->SetPosition(40.6018, -280.533, 47.0172);\n  cam->ComputeViewPlaneNormal();\n  cam->SetClippingRange(26.1073, 1305.36);\n  cam->SetViewAngle(20.9219);\n  cam->SetViewUp(0.0, 0.0, 1.0);\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PineRootConnectivity)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PineRootConnectivity: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PineRootConnectivity MACOSX_BUNDLE PineRootConnectivity.cxx )\n  target_link_libraries(PineRootConnectivity PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PineRootConnectivity\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#download-and-build-pinerootconnectivity","title":"Download and Build PineRootConnectivity","text":"

Click here to download PineRootConnectivity and its CMakeLists.txt file. Once the tarball PineRootConnectivity.tar has been downloaded and extracted,

cd PineRootConnectivity/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PineRootConnectivity\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivityA/","title":"PineRootConnectivityA","text":"

vtk-examples/Cxx/VisualizationAlgorithms/PineRootConnectivityA

"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivityA/#description","title":"Description","text":"

This example applies connectivity filter to remove noisy isosurface. Data is from 256^3 volume data of the root system of a pine tree.

The example runs PineRootConnectivity as follows:

PineRootConnectivityA pine_root.tri 1\n

Info

See Figure 9-51a in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivityA/#code","title":"Code","text":"

PineRootConnectivityA.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredGridReader.h>\n\n#include \"PineRootConnectivity.cxx\"\n
"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivityA/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PineRootConnectivityA)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PineRootConnectivityA: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PineRootConnectivityA MACOSX_BUNDLE PineRootConnectivityA.cxx )\n  target_link_libraries(PineRootConnectivityA PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PineRootConnectivityA\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivityA/#download-and-build-pinerootconnectivitya","title":"Download and Build PineRootConnectivityA","text":"

Click here to download PineRootConnectivityA and its CMakeLists.txt file. Once the tarball PineRootConnectivityA.tar has been downloaded and extracted,

cd PineRootConnectivityA/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PineRootConnectivityA\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/","title":"PineRootDecimation","text":"

vtk-examples/Cxx/VisualizationAlgorithms/PineRootDecimation

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#description","title":"Description","text":"

Demonstrates how to apply the decimation filter to get a reduced data size and then the connectivity filter to remove noisy isosurfaces. The data is from the root system of a pine tree.

To count the number of triangles in the polydata we do the following:

"},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#c","title":"C++","text":"

We use a lambda function

auto NumberofTriangles = [](auto *pd)\n
"},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#python","title":"Python","text":"

We just implement:

def NumberOfTriangles(pd):\n

within the scope of the calling function.

Info

See Figure 9-52 in Chapter 9 in the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#code","title":"Code","text":"

PineRootDecimation.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkConnectivityFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDecimatePro.h>\n#include <vtkMCubesReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#ifdef VTK_CELL_ARRAY_V2\n#include <vtkCellArrayIterator.h>\n#endif // VTK_CELL_ARRAY_V2\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename\" << std::endl;\n    std::cout << \"where: filename is pine_root.tri.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  /**\n   * Count the triangles in the polydata.\n   * @param pd: vtkPolyData.\n   * @return The number of triangles.\n   */\n  auto NumberofTriangles = [](vtkPolyData* pd) {\n    vtkCellArray* cells = pd->GetPolys();\n    vtkIdType npts = 0;\n    auto numOfTriangles = 0;\n#ifdef VTK_CELL_ARRAY_V2\n\n    // Newer versions of vtkCellArray prefer local iterators:\n    auto cellIter = vtk::TakeSmartPointer(cells->NewIterator());\n    for (cellIter->GoToFirstCell(); !cellIter->IsDoneWithTraversal();\n         cellIter->GoToNextCell())\n    {\n      auto cell = cellIter->GetCurrentCell();\n      if (cell == nullptr)\n      {\n        break;\n      }\n      // If a cell has three points it is a triangle.\n      if (cell->GetNumberOfIds() == 3)\n      {\n        numOfTriangles++;\n      }\n    }\n\n#else  // VTK_CELL_ARRAY_V2\n\n    // Older implementations of vtkCellArray use internal iterator APIs (not\n    // thread safe):\n    vtkIdType* pts;\n    for (auto i = 0; i < pd->GetNumberOfPolys(); ++i)\n    {\n      int c = cells->GetNextCell(npts, pts);\n      if (c == 0)\n      {\n        break;\n      }\n      // If a cell has three points it is a triangle.\n      if (npts == 3)\n      {\n        numOfTriangles++;\n      }\n    }\n#endif // VTK_CELL_ARRAY_V2\n\n    return numOfTriangles;\n  };\n  ///**\n  //* Count the triangles in the polydata.\n  //* @param pd: vtkPolyData.\n  //* @return The number of triangles.\n  //*/\n  // auto NumberofTriangles = [](vtkPolyData* pd) {\n  //  vtkCellArray* cells = pd->GetPolys();\n  //  vtkIdType npts = 0;\n  //  vtkIdType* pts;\n  //  auto numOfTriangles = 0;\n  //  for (auto i = 0; i < pd->GetNumberOfPolys(); ++i)\n  //  {\n  //    int c = cells->GetNextCell(npts, pts);\n  //    if (c == 0)\n  //    {\n  //      break;\n  //    }\n  //    // If a cell has three points it is a triangle.\n  //    if (npts == 3)\n  //    {\n  //      numOfTriangles++;\n  //    }\n  //  }\n  //  return numOfTriangles;\n  //};\n\n  std::string fileName = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the pipeline.\n  vtkNew<vtkMCubesReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->FlipNormalsOff();\n  reader->Update();\n  std::cout << \"Before Decimation there are:  \"\n            << NumberofTriangles(reader->GetOutput()) << \" triangles.\"\n            << std::endl;\n\n  vtkNew<vtkDecimatePro> deci;\n  deci->SetInputConnection(reader->GetOutputPort());\n  deci->SetTargetReduction(0.9);\n  deci->SetAbsoluteError(0.0005);\n  deci->SetFeatureAngle(30);\n  deci->SetErrorIsAbsolute(1);\n  deci->AccumulateErrorOn();\n  // deci->SplittingOff();\n  deci->Update();\n  std::cout << \"After Decimation there are:   \"\n            << NumberofTriangles(deci->GetOutput()) << \" triangles.\"\n            << std::endl;\n\n  vtkNew<vtkConnectivityFilter> connect;\n  connect->SetInputConnection(deci->GetOutputPort());\n  connect->SetExtractionModeToLargestRegion();\n  connect->Update();\n  // Note the use of dynamic_cast<vtkPolyData*> here.\n  std::cout << \"After Connectivity there are: \"\n            << NumberofTriangles(\n                   dynamic_cast<vtkPolyData*>(connect->GetOutput()))\n            << \" triangles.\" << std::endl;\n\n  vtkNew<vtkDataSetMapper> isoMapper;\n  isoMapper->SetInputConnection(connect->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"raw_sienna\").GetData());\n\n  // Get an outline of the data set for context.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the Renderer, RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(outlineActor);\n  ren->AddActor(isoActor);\n  // renWin->SetSize(750, 750);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"PineRootDecimation\");\n\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkCamera* cam = ren->GetActiveCamera();\n  cam->SetFocalPoint(40.6018, 37.2813, 50.1953);\n  cam->SetPosition(40.6018, -280.533, 47.0172);\n  cam->ComputeViewPlaneNormal();\n  cam->SetClippingRange(26.1073, 1305.36);\n  cam->SetViewAngle(20.9219);\n  cam->SetViewUp(0.0, 0.0, 1.0);\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PineRootDecimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PineRootDecimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PineRootDecimation MACOSX_BUNDLE PineRootDecimation.cxx )\n  target_link_libraries(PineRootDecimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PineRootDecimation\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#download-and-build-pinerootdecimation","title":"Download and Build PineRootDecimation","text":"

Click here to download PineRootDecimation and its CMakeLists.txt file. Once the tarball PineRootDecimation.tar has been downloaded and extracted,

cd PineRootDecimation/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PineRootDecimation\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/PlateVibration/","title":"PlateVibration","text":"

vtk-examples/Cxx/VisualizationAlgorithms/PlateVibration

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/PlateVibration/#description","title":"Description","text":"

The motion of a vibrating beam is shown. The original undeformed outline is shown as a wireframe.

Info

See Figure 6-14a in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/PlateVibration/#code","title":"Code","text":"

PlateVibration.cxx

// Translated from vib.tcl\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorDot.h>\n#include <vtkWarpVector.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  auto Scale = [](std::vector<double>& v, double scale) {\n    std::transform(std::begin(v), std::end(v), std::begin(v),\n                   [=](double const& n) { return n / scale; });\n    return;\n  };\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename\" << std::endl;\n    std::cout << \"where: filename is the file plate.vtk.\" << std::endl;\n    std::cout\n        << \"Produces figure 6-14(a) Beam displacement from the VTK Textbook.\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color and plate color.\n  std::array<unsigned char, 4> bar{{255, 160, 140}};\n  colors->SetColor(\"PlateColor\", bar.data());\n  std::array<unsigned char, 4> bkg{{65, 99, 149}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Read a vtk file.\n  //\n  vtkNew<vtkPolyDataReader> plate;\n  plate->SetFileName(fileName.c_str());\n  plate->Update();\n  double bounds[6];\n  plate->GetOutput()->GetBounds(bounds);\n  plate->SetVectorsName(\"mode2\");\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(plate->GetOutputPort());\n  vtkNew<vtkWarpVector> warp;\n  warp->SetInputConnection(normals->GetOutputPort());\n  warp->SetScaleFactor(0.5);\n  vtkNew<vtkVectorDot> color;\n  color->SetInputConnection(warp->GetOutputPort());\n  vtkNew<vtkDataSetMapper> plateMapper;\n  plateMapper->SetInputConnection(warp->GetOutputPort());\n  vtkNew<vtkActor> plateActor;\n  plateActor->SetMapper(plateMapper);\n  plateActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"PlateColor\").GetData());\n  plateActor->RotateX(-90);\n\n  // Create the outline.\n  //\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(plate->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->RotateX(-90);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren->AddActor(plateActor);\n  ren->AddActor(outlineActor);\n  renWin->SetSize(500, 500);\n  renWin->SetWindowName(\"PlateVibration\");\n\n  // Render the image.\n  renWin->Render();\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(-3.7, 13, 15.5);\n  ren->ResetCameraClippingRange();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/PlateVibration/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlateVibration)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlateVibration: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlateVibration MACOSX_BUNDLE PlateVibration.cxx )\n  target_link_libraries(PlateVibration PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlateVibration\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/PlateVibration/#download-and-build-platevibration","title":"Download and Build PlateVibration","text":"

Click here to download PlateVibration and its CMakeLists.txt file. Once the tarball PlateVibration.tar has been downloaded and extracted,

cd PlateVibration/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PlateVibration\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/ProbeCombustor/","title":"ProbeCombustor","text":"

vtk-examples/Cxx/VisualizationAlgorithms/ProbeCombustor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/ProbeCombustor/#description","title":"Description","text":"

Probing obtains dataset attributes by sampling one dataset (the input) with a set of points (the probe). Probing is also called \u201cresampling.\u201d Examples include probing an input dataset with a sequence of points along a line, on a plane, or in a volume. The result of the probing is a new dataset (the output) with the topological and geometric structure of the probe dataset, and point attributes interpolated from the input dataset. Once the probing operation is completed, the output dataset can be visualized with any of the appropriate techniques in VTK.

This example illustrates the details of the probing process. For every point in the probe dataset, the location in the input dataset (i.e., cell, subcell, and parametric coordinates) and interpolation weights are determined. Then the data values from the cell are interpolated to the probe point. Probe points that are outside the input dataset are assigned a nil (or appropriate) value. This process repeats for all points in the probe dataset.

Info

See Figure 9-19 in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/ProbeCombustor/#code","title":"Code","text":"

ProbeCombustor.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <iostream>\n#include <string>\n\n// This shows how to probe a dataset with a plane. The probed data is then\n// contoured.\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // create pipeline\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkStructuredGrid* sg =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // We create three planes and position them in the correct position\n  // using transform filters. They are then appended together and used as\n  // a probe.\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetResolution(50, 50);\n\n  vtkNew<vtkTransform> transP1;\n  transP1->Translate(3.7, 0.0, 28.37);\n  transP1->Scale(5, 5, 5);\n  transP1->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> tpd1;\n  tpd1->SetInputConnection(plane->GetOutputPort());\n  tpd1->SetTransform(transP1);\n\n  vtkNew<vtkOutlineFilter> outTpd1;\n  outTpd1->SetInputConnection(tpd1->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapTpd1;\n  mapTpd1->SetInputConnection(outTpd1->GetOutputPort());\n\n  vtkNew<vtkActor> tpd1Actor;\n  tpd1Actor->SetMapper(mapTpd1);\n  tpd1Actor->GetProperty()->SetColor(0, 0, 0);\n  tpd1Actor->GetProperty()->SetLineWidth(2.0);\n\n  vtkNew<vtkTransform> transP2;\n  transP2->Translate(9.2, 0.0, 31.20);\n  transP2->Scale(5, 5, 5);\n  transP2->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> tpd2;\n  tpd2->SetInputConnection(plane->GetOutputPort());\n  tpd2->SetTransform(transP2);\n\n  vtkNew<vtkOutlineFilter> outTpd2;\n  outTpd2->SetInputConnection(tpd2->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapTpd2;\n  mapTpd2->SetInputConnection(outTpd2->GetOutputPort());\n\n  vtkNew<vtkActor> tpd2Actor;\n  tpd2Actor->SetMapper(mapTpd2);\n  tpd2Actor->GetProperty()->SetColor(0, 0, 0);\n  tpd2Actor->GetProperty()->SetLineWidth(2.0);\n\n  vtkNew<vtkTransform> transP3;\n  transP3->Translate(13.27, 0.0, 33.30);\n  transP3->Scale(5, 5, 5);\n  transP3->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> tpd3;\n  tpd3->SetInputConnection(plane->GetOutputPort());\n  tpd3->SetTransform(transP3);\n\n  vtkNew<vtkOutlineFilter> outTpd3;\n  outTpd3->SetInputConnection(tpd3->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapTpd3;\n  mapTpd3->SetInputConnection(outTpd3->GetOutputPort());\n\n  vtkNew<vtkActor> tpd3Actor;\n  tpd3Actor->SetMapper(mapTpd3);\n  tpd3Actor->GetProperty()->SetColor(0, 0, 0);\n  tpd3Actor->GetProperty()->SetLineWidth(2.0);\n\n  vtkNew<vtkAppendPolyData> appendF;\n  appendF->AddInputConnection(tpd1->GetOutputPort());\n  appendF->AddInputConnection(tpd2->GetOutputPort());\n  appendF->AddInputConnection(tpd3->GetOutputPort());\n\n  // The vtkProbeFilter takes two inputs. One is a dataset to use as the probe\n  // geometry (SetInputConnection); the other is the data to probe\n  // (SetSourceConnection). The output dataset structure (geometry and\n  // topology) of the probe is the same as the structure of the input. The\n  // probing process generates new data values resampled from the source.\n  vtkNew<vtkProbeFilter> probe;\n  probe->SetInputConnection(appendF->GetOutputPort());\n  probe->SetSourceData(sg);\n\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(probe->GetOutputPort());\n  contour->GenerateValues(50, sg->GetScalarRange());\n\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contour->GetOutputPort());\n  contourMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(contourMapper);\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(0, 0, 0);\n  outlineActor->GetProperty()->SetLineWidth(2.0);\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(planeActor);\n  ren1->AddActor(tpd1Actor);\n  ren1->AddActor(tpd2Actor);\n  ren1->AddActor(tpd3Actor);\n  ren1->SetBackground(colors->GetColor3d(\"Gainsboro\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ProbeCombustor\");\n\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->SetClippingRange(3.95297, 50);\n  ren1->GetActiveCamera()->SetFocalPoint(8.88908, 0.595038, 29.3342);\n  ren1->GetActiveCamera()->SetPosition(-12.3332, 31.7479, 41.2387);\n  ren1->GetActiveCamera()->SetViewUp(0.060772, -0.319905, 0.945498);\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/ProbeCombustor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProbeCombustor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProbeCombustor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProbeCombustor MACOSX_BUNDLE ProbeCombustor.cxx )\n  target_link_libraries(ProbeCombustor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProbeCombustor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/ProbeCombustor/#download-and-build-probecombustor","title":"Download and Build ProbeCombustor","text":"

Click here to download ProbeCombustor and its CMakeLists.txt file. Once the tarball ProbeCombustor.tar has been downloaded and extracted,

cd ProbeCombustor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ProbeCombustor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/SingleSplat/","title":"SingleSplat","text":"

vtk-examples/Cxx/VisualizationAlgorithms/SingleSplat

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/SingleSplat/#description","title":"Description","text":"

This example shows a single elliptical splat.

Info

See Figure 9-38a in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/SingleSplat/#code","title":"Code","text":"

SingleSplat.cxx

#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkConeSource.h>\n#include <vtkContourFilter.h>\n#include <vtkDoubleArray.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> aren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create single splat point.\n  vtkNew<vtkPoints> pts;\n  vtkNew<vtkCellArray> verts;\n  vtkNew<vtkDoubleArray> norms;\n  vtkNew<vtkDoubleArray> scalars;\n\n  std::array<double, 3> x{0.0, 0.0, 0.0};\n  pts->InsertNextPoint(x.data());\n  norms->SetNumberOfTuples(1);\n  norms->SetNumberOfComponents(3);\n  std::array<double, 3> n{0.707, 0.707, 0.0};\n  norms->InsertTuple(0, n.data());\n  scalars->SetNumberOfTuples(1);\n  scalars->SetNumberOfComponents(1);\n  scalars->InsertTuple1(0, 1.0);\n\n  verts->InsertNextCell(1);\n  verts->InsertCellPoint(0);\n\n  vtkNew<vtkPolyData> pData;\n  pData->SetPoints(pts);\n  pData->SetVerts(verts);\n  pData->GetPointData()->SetNormals(norms);\n  pData->GetPointData()->SetScalars(scalars);\n\n  // Splat point and generate isosurface.\n  vtkNew<vtkGaussianSplatter> splat;\n  splat->SetInputData(pData);\n  splat->SetModelBounds(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);\n  splat->SetSampleDimensions(75, 75, 75);\n  splat->SetRadius(0.5);\n  splat->SetEccentricity(5.0);\n  splat->SetExponentFactor(-3.25);\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(splat->GetOutputPort());\n  contour->SetValue(0, 0.9);\n  vtkNew<vtkPolyDataMapper> splatMapper;\n  splatMapper->SetInputConnection(contour->GetOutputPort());\n  vtkNew<vtkActor> splatActor;\n  splatActor->SetMapper(splatMapper);\n\n  // Create outline.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(splat->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Brown\").GetData());\n\n  // Create cone to indicate direction.\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(24);\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->SetScale(0.75, 0.75, 0.75);\n  coneActor->RotateZ(45.0);\n  coneActor->AddPosition(0.50, 0.50, 0.0);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"DeepPink\").GetData());\n  //\n  // Rendering stuff.\n  //\n  aren->SetBackground(colors->GetColor3d(\"Beige\").GetData());\n  aren->AddActor(splatActor);\n  aren->AddActor(outlineActor);\n  aren->AddActor(coneActor);\n\n  renWin->SetSize(640, 640);\n  renWin->SetWindowName(\"SingleSplat\");\n  renWin->Render();\n\n  // interact with data.\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/SingleSplat/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SingleSplat)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SingleSplat: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SingleSplat MACOSX_BUNDLE SingleSplat.cxx )\n  target_link_libraries(SingleSplat PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SingleSplat\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/SingleSplat/#download-and-build-singlesplat","title":"Download and Build SingleSplat","text":"

Click here to download SingleSplat and its CMakeLists.txt file. Once the tarball SingleSplat.tar has been downloaded and extracted,

cd SingleSplat/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SingleSplat\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/SpikeFran/","title":"SpikeFran","text":"

vtk-examples/Cxx/VisualizationAlgorithms/SpikeFran

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/SpikeFran/#description","title":"Description","text":"

This examples uses glyphs to indicate surface normals on model of human face. Glyph positions are randomly selected.

Info

See Figure 6-30 in Chapter 6 the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/SpikeFran/#code","title":"Code","text":"

SpikeFran.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n// This example demonstrates the use of glyphing. We also use a mask filter\n// to select a subset of points to glyph.\n\n// Read a data file. This originally was a Cyberware laser digitizer scan\n// of Fran J.'s face. Surface normals are generated based on local geometry\n// (i.e., the polygon normals surrounding each point are averaged). We flip\n// the normals because we want them to point out from Fran's face.\n//\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fran_cut.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataReader> fran;\n  fran->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(fran->GetOutputPort());\n  normals->FlipNormalsOn();\n\n  vtkNew<vtkPolyDataMapper> franMapper;\n  franMapper->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkActor> franActor;\n  franActor->SetMapper(franMapper);\n  franActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n\n  // We subsample the dataset because we want to glyph just a subset of\n  // the points. Otherwise the display is cluttered and cannot be easily\n  // read. The RandomModeOn and SetOnRatio combine to random select one out\n  // of every 10 points in the dataset.\n  //\n  vtkNew<vtkMaskPoints> ptMask;\n  ptMask->SetInputConnection(normals->GetOutputPort());\n  ptMask->SetOnRatio(10);\n  ptMask->RandomModeOn();\n\n  // In this case we are using a cone as a glyph. We transform the cone so\n  // its base is at 0,0,0. This is the point where glyph rotation occurs.\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(6);\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.5, 0.0, 0.0);\n\n  vtkNew<vtkTransformPolyDataFilter> transformF;\n  transformF->SetInputConnection(cone->GetOutputPort());\n  transformF->SetTransform(transform);\n\n  // vtkGlyph3D takes two inputs: the input point set (SetInputConnection)\n  // which can be any vtkDataSet; and the glyph (SetSourceConnection) which\n  // must be a vtkPolyData.  We are interested in orienting the glyphs by the\n  // surface normals that we previously generated.\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(ptMask->GetOutputPort());\n  glyph->SetSourceConnection(transformF->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->SetScaleFactor(0.004);\n\n  vtkNew<vtkPolyDataMapper> spikeMapper;\n  spikeMapper->SetInputConnection(glyph->GetOutputPort());\n\n  vtkNew<vtkActor> spikeActor;\n  spikeActor->SetMapper(spikeMapper);\n  spikeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Emerald_Green\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(franActor);\n  ren1->AddActor(spikeActor);\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"SpikeFran\");\n\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // render the image\n  //\n  renWin->Render();\n\n  ren1->GetActiveCamera()->Zoom(1.4);\n  ren1->GetActiveCamera()->Azimuth(110);\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/SpikeFran/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SpikeFran)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SpikeFran: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SpikeFran MACOSX_BUNDLE SpikeFran.cxx )\n  target_link_libraries(SpikeFran PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SpikeFran\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/SpikeFran/#download-and-build-spikefran","title":"Download and Build SpikeFran","text":"

Click here to download SpikeFran and its CMakeLists.txt file. Once the tarball SpikeFran.tar has been downloaded and extracted,

cd SpikeFran/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SpikeFran\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/SplatFace/","title":"SplatFace","text":"

vtk-examples/Cxx/VisualizationAlgorithms/SplatFace

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/SplatFace/#description","title":"Description","text":"

Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction. Points regularly subsampled and overlayed on original mesh.

Info

See Figure 9-38b in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/SplatFace/#code","title":"Code","text":"

SplatFace.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fran_cut.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // read cyberware file\n  //\n  vtkNew<vtkPolyDataReader> cyber;\n  cyber->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(cyber->GetOutputPort());\n\n  vtkNew<vtkMaskPoints> mask;\n  mask->SetInputConnection(normals->GetOutputPort());\n  mask->SetOnRatio(8);\n  //   mask->RandomModeOn();\n\n  vtkNew<vtkGaussianSplatter> splatter;\n  splatter->SetInputConnection(mask->GetOutputPort());\n  splatter->SetSampleDimensions(100, 100, 100);\n  splatter->SetEccentricity(2.5);\n  splatter->NormalWarpingOn();\n  splatter->SetScaleFactor(1.0);\n  splatter->SetRadius(0.025);\n\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(splatter->GetOutputPort());\n  contour->SetValue(0, 0.25);\n\n  vtkNew<vtkPolyDataMapper> splatMapper;\n  splatMapper->SetInputConnection(contour->GetOutputPort());\n  splatMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> splatActor;\n  splatActor->SetMapper(splatMapper);\n  splatActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n\n  vtkNew<vtkPolyDataMapper> cyberMapper;\n  cyberMapper->SetInputConnection(cyber->GetOutputPort());\n  cyberMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> cyberActor;\n  cyberActor->SetMapper(cyberMapper);\n  cyberActor->GetProperty()->SetRepresentationToWireframe();\n  cyberActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Turquoise\").GetData());\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(cyberActor);\n  ren1->AddActor(splatActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"SplatFace\");\n\n  vtkNew<vtkCamera> camera;\n  camera->SetClippingRange(0.0332682, 1.66341);\n  camera->SetFocalPoint(0.0511519, -0.127555, -0.0554379);\n  camera->SetPosition(0.516567, -0.124763, -0.349538);\n  camera->SetViewAngle(18.1279);\n  camera->SetViewUp(-0.013125, 0.99985, -0.0112779);\n  ren1->SetActiveCamera(camera);\n\n  // render the image\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/SplatFace/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SplatFace)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOLegacy\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SplatFace: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SplatFace MACOSX_BUNDLE SplatFace.cxx )\n  target_link_libraries(SplatFace PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SplatFace\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/SplatFace/#download-and-build-splatface","title":"Download and Build SplatFace","text":"

Click here to download SplatFace and its CMakeLists.txt file. Once the tarball SplatFace.tar has been downloaded and extracted,

cd SplatFace/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SplatFace\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/Stocks/","title":"Stocks","text":"

vtk-examples/Cxx/VisualizationAlgorithms/Stocks

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/Stocks/#description","title":"Description","text":"

Two views of the stock case study. Here the tube filter has been replaced by a ribbon filter followed with a linear extrusion filter.

Info

See Figure 12-11 in Chapter 12 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/Stocks/#code","title":"Code","text":"

Stocks.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFollower.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRibbonFilter.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkVectorText.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid AddStock(std::vector<vtkSmartPointer<vtkRenderer>> renderers,\n              char* filename, std::string name, double& zPosition,\n              bool useTubes);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // set up the stocks\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  vtkNew<vtkRenderer> topRenderer;\n  vtkNew<vtkRenderer> bottomRenderer;\n  renderers.push_back(topRenderer);\n  renderers.push_back(bottomRenderer);\n\n  // List of one or more filenames corresponding to stocks.\n  // e.g. GE.vtk GM.vtk IBM.vtk DEC.vtk [0|1].\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \"\\n A list of one or more filenames corresponding to\\n stocks \"\n                 \"with a flag to use tubes.\\n e.g. GE.vtk GM.vtk \"\n                 \"IBM.vtk DEC.vtk 0\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  bool useTubes = true;\n  if (atoi(argv[argc - 1]) == 1)\n  {\n    useTubes = false;\n  }\n\n  double zPosition = 0.0;\n  for (int i = 1; i < argc - 1; ++i)\n  {\n    AddStock(renderers, argv[i],\n             vtksys::SystemTools::GetFilenameWithoutExtension(argv[i]),\n             zPosition, useTubes);\n  }\n\n  // Setup render window and interactor.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderers[0]);\n  renderWindow->AddRenderer(renderers[1]);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderers[0]->SetViewport(0.0, .4, 1.0, 1.0);\n  renderers[1]->SetViewport(0.0, 0.0, 1.0, .4);\n\n  renderers[0]->GetActiveCamera()->SetViewAngle(5.0);\n  renderers[0]->ResetCamera();\n  renderers[0]->GetActiveCamera()->Zoom(1.4);\n  renderers[0]->ResetCameraClippingRange();\n  renderers[0]->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderers[1]->GetActiveCamera()->SetViewUp(0, 0, -1);\n  renderers[1]->GetActiveCamera()->SetPosition(0, 1, 0);\n  renderers[1]->GetActiveCamera()->SetViewAngle(5.0);\n  renderers[1]->ResetCamera();\n  renderers[1]->GetActiveCamera()->Zoom(2.2);\n  renderers[1]->ResetCameraClippingRange();\n  renderers[1]->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  renderWindow->SetSize(500, 800);\n  renderWindow->SetWindowName(\"Stocks\");\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// Create the stocks.\nvoid AddStock(std::vector<vtkSmartPointer<vtkRenderer>> renderers,\n              char* filename, std::string name, double& zPosition,\n              bool useTubes)\n{\n  std::cout << \"Adding \" << name << std::endl;\n\n  // Read the data.\n  vtkNew<vtkPolyDataReader> PolyDataRead;\n  PolyDataRead->SetFileName(filename);\n  PolyDataRead->Update();\n\n  // Create labels.\n  vtkNew<vtkVectorText> TextSrc;\n  TextSrc->SetText(name.c_str());\n\n  vtkIdType numberOfPoints = PolyDataRead->GetOutput()->GetNumberOfPoints();\n\n  double nameLocation[3];\n  double x, y, z;\n\n  vtkIdType nameIndex = (numberOfPoints - 1) * .8;\n\n  PolyDataRead->GetOutput()->GetPoint(nameIndex, nameLocation);\n\n  x = nameLocation[0] * .15;\n  y = nameLocation[1] + 5.0;\n  z = zPosition;\n\n  // Create a tube and ribbpn filter. One or the other will be used.\n\n  vtkNew<vtkTubeFilter> TubeFilter;\n  TubeFilter->SetInputConnection(PolyDataRead->GetOutputPort());\n  TubeFilter->SetNumberOfSides(8);\n  TubeFilter->SetRadius(0.5);\n  TubeFilter->SetRadiusFactor(10000);\n\n  vtkNew<vtkRibbonFilter> RibbonFilter;\n  RibbonFilter->SetInputConnection(PolyDataRead->GetOutputPort());\n  RibbonFilter->VaryWidthOn();\n  RibbonFilter->SetWidthFactor(5);\n  RibbonFilter->SetDefaultNormal(0, 1, 0);\n  RibbonFilter->UseDefaultNormalOn();\n\n  vtkNew<vtkLinearExtrusionFilter> Extrude;\n  Extrude->SetInputConnection(RibbonFilter->GetOutputPort());\n  Extrude->SetVector(0, 1, 0);\n  Extrude->SetExtrusionType(1);\n  Extrude->SetScaleFactor(0.7);\n\n  vtkNew<vtkTransform> Transform;\n  Transform->Translate(0, 0, zPosition);\n  Transform->Scale(0.15, 1, 1);\n\n  vtkNew<vtkTransformPolyDataFilter> TransformFilter;\n  TransformFilter->SetTransform(Transform);\n\n  // Select tubes or ribbons.\n  if (useTubes)\n  {\n    TransformFilter->SetInputConnection(TubeFilter->GetOutputPort());\n  }\n  else\n  {\n    TransformFilter->SetInputConnection(Extrude->GetOutputPort());\n  }\n  for (size_t r = 0; r < renderers.size(); ++r)\n  {\n    vtkNew<vtkPolyDataMapper> LabelMapper;\n    LabelMapper->SetInputConnection(TextSrc->GetOutputPort());\n\n    vtkNew<vtkFollower> LabelActor;\n    LabelActor->SetMapper(LabelMapper);\n    LabelActor->SetPosition(x, y, z);\n    LabelActor->SetScale(2, 2, 2);\n    LabelActor->SetOrigin(TextSrc->GetOutput()->GetCenter());\n\n    // Increment zPosition.\n    zPosition += 8.0;\n\n    vtkNew<vtkPolyDataMapper> StockMapper;\n    StockMapper->SetInputConnection(TransformFilter->GetOutputPort());\n    StockMapper->SetScalarRange(0, 8000);\n    vtkNew<vtkActor> StockActor;\n    StockActor->SetMapper(StockMapper);\n\n    renderers[r]->AddActor(StockActor);\n    renderers[r]->AddActor(LabelActor);\n    LabelActor->SetCamera(renderers[r]->GetActiveCamera());\n  }\n  return;\n}\n} // namespace\n
"},{"location":"Cxx/VisualizationAlgorithms/Stocks/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Stocks)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Stocks: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Stocks MACOSX_BUNDLE Stocks.cxx )\n  target_link_libraries(Stocks PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Stocks\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/Stocks/#download-and-build-stocks","title":"Download and Build Stocks","text":"

Click here to download Stocks and its CMakeLists.txt file. Once the tarball Stocks.tar has been downloaded and extracted,

cd Stocks/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Stocks\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/","title":"StreamlinesWithLineWidget","text":"

vtk-examples/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/#description","title":"Description","text":""},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/#produce-streamlines-in-the-combustor-dataset","title":"Produce streamlines in the combustor dataset.","text":"

This example demonstrates how to use the vtkLineWidget to seed and manipulate streamlines. Two line widgets are created. The first is invoked by pressing 'i', the second by pressing 'L' (capital). Both can exist together.

If the fourth parameter is non-zero, it is used to generate an image with streamlines:

  1. The third parameter value is changed to 25.
  2. The camera position and first line widget are positioned differently.
  3. The streamlines are displayed running from the first line widget.
  4. The second line widget is still available.

In the C++ version, note how we handle callbacks by first implementing a class, then instantiating it and then passing references to the needed variables to it. Finally we add it as an observer.

For the Python version we define a class passing the needed variables in the __init__ function and then implementing a _call__ function that does the work.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/#code","title":"Code","text":"

StreamlinesWithLineWidget.cxx

/*\nModified from VTK/Examples/GUI/Python/StreamlinesWithLineWidget.py.\nThis program encompasses the functionality of\nStreamlinesWithLineWidget.tcl and LineWidget.tcl.\n\n        Produce streamlines in the combustor dataset.\n\nThis example demonstrates how to use the vtkLineWidget to seed and\nmanipulate streamlines. Two line widgets are created. The first is invoked\nby pressing 'i', the second by pressing 'L' (capital). Both can exist\ntogether.\n\nIf the fourth parameter is non-zero:\n 1) The third parameter value is changed to 25.\n 2) The camera position and first line widget are positioned differently.\n 3) The streamlines are displayed running from the first line widget.\n 4) The second line widget is still available.\nThis is used to test the code.\n\n*/\n\n#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkLineWidget.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRibbonFilter.h>\n#include <vtkRungeKutta4.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nclass EnableActorCallback : public vtkCallbackCommand\n{\npublic:\n  static EnableActorCallback* New()\n  {\n    return new EnableActorCallback;\n  }\n  void Execute(vtkObject* /*caller*/, unsigned long, void*) override\n  {\n    this->actor->VisibilityOn();\n  }\n  EnableActorCallback() : actor(nullptr)\n  {\n  }\n  vtkActor* actor;\n};\n\n// The Line Widget callback.\nclass LWCallback : public vtkCallbackCommand\n{\npublic:\n  static LWCallback* New()\n  {\n    return new LWCallback;\n  }\n  void Execute(vtkObject* caller, unsigned long, void*) override\n  {\n    vtkLineWidget* lineWidget = reinterpret_cast<vtkLineWidget*>(caller);\n    lineWidget->GetPolyData(this->polyData);\n    this->renWin->Render();\n  }\n  LWCallback() : polyData(nullptr), renWin(nullptr)\n  {\n  }\n  vtkPolyData* polyData;\n  vtkRenderWindow* renWin;\n};\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" filename1 filename2 [numOfStreamLines] [illustration]\"\n              << std::endl;\n    std::cout << \"where: filename1 is combxyz.bin and filename2 is combq.bin.\"\n              << std::endl;\n    std::cout\n        << \"       numOfStreamLines is the number of streamlines, default 25\"\n        << std::endl;\n    std::cout << \"       illustration, if non-zero, reproduce Fig 7-39 of the \"\n                 \"VTK Textbook.\"\n              << std::endl;\n    std::cout << \"e.g. combxyz.bin combq.bin 10 1\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto numOfStreamLines = 25;\n  auto illustration = false;\n  std::string fileName1 = argv[1];\n  std::string fileName2 = argv[2];\n  if (argc > 3)\n  {\n    numOfStreamLines = atoi(argv[3]);\n  }\n  if (argc > 4)\n  {\n    illustration = atoi(argv[4]) != 0;\n    if (illustration)\n    {\n      numOfStreamLines = 25;\n    }\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Start by loading some data.\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(fileName1.c_str());\n  pl3d->SetQFileName(fileName2.c_str());\n  pl3d->SetScalarFunctionNumber(100); // Density\n  pl3d->SetVectorFunctionNumber(202); // Momentum\n  pl3d->Update();\n\n  vtkStructuredGrid* pl3d_output =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // Create the Renderer, RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Needed by: vtkStreamTracer and vtkLineWidget.\n  vtkNew<vtkPolyData> seeds;\n  vtkNew<vtkActor> streamline;\n  vtkNew<vtkPolyData> seeds2;\n  vtkNew<vtkActor> streamline2;\n\n  // The line widget is used seed the streamlines.\n  vtkNew<vtkLineWidget> lineWidget;\n  lineWidget->SetResolution(numOfStreamLines);\n  lineWidget->SetInputData(pl3d_output);\n  lineWidget->GetPolyData(seeds);\n  if (illustration)\n  {\n    lineWidget->SetAlignToNone();\n    lineWidget->SetPoint1(0.974678, 5.073630, 31.217961);\n    lineWidget->SetPoint2(0.457544, -4.995921, 31.080175);\n  }\n  else\n  {\n    lineWidget->SetAlignToYAxis();\n  }\n  lineWidget->ClampToBoundsOn();\n  lineWidget->PlaceWidget();\n\n  lineWidget->SetInteractor(iren);\n\n  // Associate the line widget with the interactor and setup the callbacks.\n  vtkNew<LWCallback> GenerateStreamlines;\n  GenerateStreamlines->polyData = seeds;\n  GenerateStreamlines->renWin = renWin;\n  vtkNew<EnableActorCallback> BeginInteraction;\n  BeginInteraction->actor = streamline;\n  lineWidget->AddObserver(vtkCommand::StartInteractionEvent, BeginInteraction);\n  lineWidget->AddObserver(vtkCommand::InteractionEvent, GenerateStreamlines);\n\n  // The second line widget is used seed more streamlines.\n  vtkNew<vtkLineWidget> lineWidget2;\n  lineWidget2->SetResolution(numOfStreamLines);\n  lineWidget2->SetInputData(pl3d_output);\n  lineWidget2->GetPolyData(seeds2);\n  lineWidget2->SetKeyPressActivationValue('L');\n  lineWidget2->SetAlignToZAxis();\n  lineWidget->ClampToBoundsOn();\n  lineWidget2->PlaceWidget();\n\n  lineWidget2->SetInteractor(iren);\n\n  // Associate the line widget with the interactor and setup the callbacks.\n  vtkNew<LWCallback> GenerateStreamlines2;\n  GenerateStreamlines2->polyData = seeds2;\n  GenerateStreamlines2->renWin = renWin;\n  vtkNew<EnableActorCallback> BeginInteraction2;\n  BeginInteraction2->actor = streamline2;\n  lineWidget2->AddObserver(vtkCommand::StartInteractionEvent,\n                           BeginInteraction2);\n  lineWidget2->AddObserver(vtkCommand::InteractionEvent, GenerateStreamlines2);\n\n  // Here we set up two streamlines.\n  vtkNew<vtkRungeKutta4> rk4;\n  vtkNew<vtkStreamTracer> streamer;\n  streamer->SetInputData(pl3d_output);\n  streamer->SetSourceData(seeds);\n  streamer->SetMaximumPropagation(100);\n  streamer->SetInitialIntegrationStep(0.2);\n  streamer->SetIntegrationDirectionToForward();\n  streamer->SetComputeVorticity(1);\n  streamer->SetIntegrator(rk4);\n  vtkNew<vtkRibbonFilter> rf;\n  rf->SetInputConnection(streamer->GetOutputPort());\n  rf->SetWidth(0.1);\n  rf->SetWidthFactor(5);\n  vtkNew<vtkPolyDataMapper> streamMapper;\n  streamMapper->SetInputConnection(rf->GetOutputPort());\n  streamMapper->SetScalarRange(pl3d_output->GetScalarRange());\n  streamline->SetMapper(streamMapper);\n  streamline->VisibilityOff();\n\n  vtkNew<vtkStreamTracer> streamer2;\n  streamer2->SetInputData(pl3d_output);\n  streamer2->SetSourceData(seeds2);\n  streamer2->SetMaximumPropagation(100);\n  streamer2->SetInitialIntegrationStep(0.2);\n  streamer2->SetIntegrationDirectionToForward();\n  streamer2->SetComputeVorticity(1);\n  streamer2->SetIntegrator(rk4);\n  vtkNew<vtkRibbonFilter> rf2;\n  rf2->SetInputConnection(streamer2->GetOutputPort());\n  rf2->SetWidth(0.1);\n  rf2->SetWidthFactor(5);\n  vtkNew<vtkPolyDataMapper> streamMapper2;\n  streamMapper2->SetInputConnection(rf2->GetOutputPort());\n  streamMapper2->SetScalarRange(pl3d_output->GetScalarRange());\n  streamline2->SetMapper(streamMapper2);\n  streamline2->VisibilityOff();\n\n  // Get an outline of the data set for context.\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3d_output);\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(outlineActor);\n  ren->AddActor(streamline);\n  ren->AddActor(streamline2);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"StreamlinesWithLineWidget\");\n\n  vtkCamera* cam = ren->GetActiveCamera();\n  if (illustration)\n  {\n    // We need to directly display the streamlines in this case.\n    lineWidget->EnabledOn();\n    streamline->VisibilityOn();\n    lineWidget->GetPolyData(seeds);\n    renWin->Render();\n\n    cam->SetClippingRange(14.216207, 68.382915);\n    cam->SetFocalPoint(9.718210, 0.458166, 29.399900);\n    cam->SetPosition(-15.827551, -16.997463, 54.003120);\n    cam->SetViewUp(0.616076, 0.179428, 0.766979);\n    ren->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  }\n  else\n  {\n    lineWidget->EnabledOn();\n    streamline->VisibilityOn();\n    lineWidget->GetPolyData(seeds);\n    renWin->Render();\n\n    cam->SetClippingRange(3.95297, 50);\n    cam->SetFocalPoint(9.71821, 0.458166, 29.3999);\n    cam->SetPosition(2.7439, -37.3196, 38.7167);\n    cam->SetViewUp(-0.16123, 0.264271, 0.950876);\n    ren->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  }\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StreamlinesWithLineWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonMath\n  FiltersCore\n  FiltersFlowPaths\n  FiltersModeling\n  IOParallel\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StreamlinesWithLineWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StreamlinesWithLineWidget MACOSX_BUNDLE StreamlinesWithLineWidget.cxx )\n  target_link_libraries(StreamlinesWithLineWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StreamlinesWithLineWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/#download-and-build-streamlineswithlinewidget","title":"Download and Build StreamlinesWithLineWidget","text":"

Click here to download StreamlinesWithLineWidget and its CMakeLists.txt file. Once the tarball StreamlinesWithLineWidget.tar has been downloaded and extracted,

cd StreamlinesWithLineWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./StreamlinesWithLineWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/TensorAxes/","title":"TensorAxes","text":"

vtk-examples/Cxx/VisualizationAlgorithms/TensorAxes

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/TensorAxes/#description","title":"Description","text":"

This example visualizes the analytical results of Boussinesq's problem from Saada. The figure shows the results by displaying the scaled and oriented principal axes of the stress tensor. (These are called tensor axes.)

Info

See Figure 6-22a in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/TensorAxes/#code","title":"Code","text":"

TensorAxes.cxx

// Translated from tenAxes.tcl\n\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointLoad.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTensorGlyph.h>\n#include <vtkTubeFilter.h>\n\nnamespace {\nvoid MakeLogLUT(vtkLookupTable* lut);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and interactive renderer.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Generate the tensors.\n  vtkNew<vtkPointLoad> ptLoad;\n  ptLoad->SetLoadValue(100.0);\n  ptLoad->SetSampleDimensions(6, 6, 6);\n  ptLoad->ComputeEffectiveStressOn();\n  ptLoad->SetModelBounds(-10, 10, -10, 10, -10, 10);\n\n  // Extract a plane of data.\n  vtkNew<vtkImageDataGeometryFilter> plane;\n  plane->SetInputConnection(ptLoad->GetOutputPort());\n  plane->SetExtent(2, 2, 0, 99, 0, 99);\n\n  // Generate the tensor axes.\n  vtkNew<vtkAxes> axes;\n  axes->SetScaleFactor(0.5);\n\n  vtkNew<vtkTubeFilter> tubeAxes;\n  tubeAxes->SetInputConnection(axes->GetOutputPort());\n  tubeAxes->SetRadius(0.1);\n  tubeAxes->SetNumberOfSides(6);\n\n  vtkNew<vtkTensorGlyph> tensorAxes;\n  tensorAxes->SetInputConnection(ptLoad->GetOutputPort());\n  tensorAxes->SetSourceConnection(axes->GetOutputPort());\n  tensorAxes->SetScaleFactor(10);\n  tensorAxes->ClampScalingOn();\n\n  // Map contour\n  vtkNew<vtkLookupTable> lut;\n  MakeLogLUT(lut);\n\n  vtkNew<vtkPolyDataMapper> tensorAxesMapper;\n  tensorAxesMapper->SetInputConnection(tensorAxes->GetOutputPort());\n  tensorAxesMapper->SetLookupTable(lut);\n  plane->Update(); // force update for scalar range\n\n  tensorAxesMapper->SetScalarRange(plane->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> tensorActor;\n  tensorActor->SetMapper(tensorAxesMapper);\n\n  // Create an outline around the data.\n  //\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(ptLoad->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  //\n  // Create a cone whose apex indicates the application of load.\n  //\n  vtkNew<vtkConeSource> coneSrc;\n  coneSrc->SetRadius(0.5);\n  coneSrc->SetHeight(2);\n  vtkNew<vtkPolyDataMapper> coneMap;\n  coneMap->SetInputConnection(coneSrc->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMap);\n  coneActor->SetPosition(0, 0, 11);\n  coneActor->RotateY(90);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(0.113766, -1.13665, -1.01919);\n  camera->SetPosition(-29.4886, -63.1488, 26.5807);\n  camera->SetViewAngle(24.4617);\n  camera->SetViewUp(0.17138, 0.331163, 0.927879);\n  camera->SetClippingRange(1, 100);\n\n  ren->AddActor(tensorActor);\n  ren->AddActor(outlineActor);\n  ren->AddActor(coneActor);\n  ren->SetBackground(colors->GetColor3d(\"WhiteSmoke\").GetData());\n  ren->SetActiveCamera(camera);\n\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"TensorAxes\");\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeLogLUT(vtkLookupTable* lut)\n{\n  // Original\n  lut->SetScaleToLog10();\n  lut->SetHueRange(.6667, 0.0);\n  lut->Build();\n}\n} // namespace\n
"},{"location":"Cxx/VisualizationAlgorithms/TensorAxes/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TensorAxes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  FiltersModeling\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TensorAxes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TensorAxes MACOSX_BUNDLE TensorAxes.cxx )\n  target_link_libraries(TensorAxes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TensorAxes\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/TensorAxes/#download-and-build-tensoraxes","title":"Download and Build TensorAxes","text":"

Click here to download TensorAxes and its CMakeLists.txt file. Once the tarball TensorAxes.tar has been downloaded and extracted,

cd TensorAxes/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TensorAxes\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/TensorEllipsoids/","title":"TensorEllipsoids","text":"

vtk-examples/Cxx/VisualizationAlgorithms/TensorEllipsoids

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/TensorEllipsoids/#description","title":"Description","text":"

This example visualizes the analytical results of Boussinesq's problem from Saada. The figure shows the results by displaying the scaled and oriented principal axes as tensor ellipsoids representing the stress tensor. (These are called tensor axes.)

Info

See Figure 6-22b in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/TensorEllipsoids/#code","title":"Code","text":"

TensorEllipsoids.cxx

// Translated from tenEllip.tcl\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkConeSource.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointLoad.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTensorGlyph.h>\n\nnamespace {\nvoid MakeLogLUT(vtkLookupTable* lut);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and interactive renderer.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Generate the tensors.\n  vtkNew<vtkPointLoad> ptLoad;\n  ptLoad->SetLoadValue(100.0);\n  ptLoad->SetSampleDimensions(6, 6, 6);\n  ptLoad->ComputeEffectiveStressOn();\n  ptLoad->SetModelBounds(-10, 10, -10, 10, -10, 10);\n\n  // Extract a plane of data.\n  vtkNew<vtkImageDataGeometryFilter> plane;\n  plane->SetInputConnection(ptLoad->GetOutputPort());\n  plane->SetExtent(2, 2, 0, 99, 0, 99);\n\n  // Generate the ellipsoids.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(8);\n  sphere->SetPhiResolution(8);\n  vtkNew<vtkTensorGlyph> tensorEllipsoids;\n  tensorEllipsoids->SetInputConnection(ptLoad->GetOutputPort());\n  tensorEllipsoids->SetSourceConnection(sphere->GetOutputPort());\n  tensorEllipsoids->SetScaleFactor(10);\n  tensorEllipsoids->ClampScalingOn();\n\n  vtkNew<vtkPolyDataNormals> ellipNormals;\n  ellipNormals->SetInputConnection(tensorEllipsoids->GetOutputPort());\n\n  // Map contour.\n  vtkNew<vtkLookupTable> lut;\n  MakeLogLUT(lut);\n  vtkNew<vtkPolyDataMapper> tensorEllipsoidsMapper;\n  tensorEllipsoidsMapper->SetInputConnection(ellipNormals->GetOutputPort());\n  tensorEllipsoidsMapper->SetLookupTable(lut);\n  plane->Update(); // force update for scalar range\n  tensorEllipsoidsMapper->SetScalarRange(plane->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> tensorActor;\n  tensorActor->SetMapper(tensorEllipsoidsMapper);\n\n  // Create an outline around the data.\n  //\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(ptLoad->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create a cone whose apex indicates the application of load.\n  //\n  vtkNew<vtkConeSource> coneSrc;\n  coneSrc->SetRadius(0.5);\n  coneSrc->SetHeight(2);\n  vtkNew<vtkPolyDataMapper> coneMap;\n  coneMap->SetInputConnection(coneSrc->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMap);\n  coneActor->SetPosition(0, 0, 11);\n  coneActor->RotateY(90);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(0.113766, -1.13665, -1.01919);\n  camera->SetPosition(-29.4886, -63.1488, 26.5807);\n  camera->SetViewAngle(24.4617);\n  camera->SetViewUp(0.17138, 0.331163, 0.927879);\n  camera->SetClippingRange(1, 100);\n\n  ren->AddActor(tensorActor);\n  ren->AddActor(outlineActor);\n  ren->AddActor(coneActor);\n  ren->SetBackground(colors->GetColor3d(\"WhiteSmoke\").GetData());\n  ren->SetActiveCamera(camera);\n\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"TensorEllipsoids\");\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeLogLUT(vtkLookupTable* lut)\n{\n  // Make the lookup using a Brewer palette.\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetNumberOfColors(8);\n  int colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_8;\n  colorSeries->SetColorScheme(colorSeriesEnum);\n  lut->SetScaleToLog10();\n  colorSeries->BuildLookupTable(lut, colorSeries->ORDINAL);\n  lut->SetNanColor(1, 0, 0, 1);\n  // Original\n  // lut->SetScaleToLog10();\n  // lut->SetHueRange(.6667, 0.0);\n  // lut->Build();\n}\n} // namespace\n
"},{"location":"Cxx/VisualizationAlgorithms/TensorEllipsoids/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TensorEllipsoids)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeometry\n  FiltersModeling\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TensorEllipsoids: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TensorEllipsoids MACOSX_BUNDLE TensorEllipsoids.cxx )\n  target_link_libraries(TensorEllipsoids PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TensorEllipsoids\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/TensorEllipsoids/#download-and-build-tensorellipsoids","title":"Download and Build TensorEllipsoids","text":"

Click here to download TensorEllipsoids and its CMakeLists.txt file. Once the tarball TensorEllipsoids.tar has been downloaded and extracted,

cd TensorEllipsoids/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TensorEllipsoids\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/TubesFromSplines/","title":"TubesFromSplines","text":"

vtk-examples/Cxx/VisualizationAlgorithms/TubesFromSplines

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/TubesFromSplines/#description","title":"Description","text":"

This example shows how to interpolate a set of points and generate tubes around the resulting polyline. Scalars associated with the points are also interpolated and used to vary the radius of the tube.

Note

This example was inspired by a question asked by Adam Sankowski.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/TubesFromSplines/#code","title":"Code","text":"

TubesFromSplines.cxx

#include <vtkActor.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n#include <vtkTupleInterpolator.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertPoint(0, 1, 0, 0);\n  points->InsertPoint(1, 2, 0, 0);\n  points->InsertPoint(2, 3, 1, 0);\n  points->InsertPoint(3, 4, 1, 0);\n  points->InsertPoint(4, 5, 0, 0);\n  points->InsertPoint(5, 6, 0, 0);\n\n  // Fit a spline to the points.\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetPoints(points);\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->SetUResolution(10 * points->GetNumberOfPoints());\n  functionSource->Update();\n\n  // Interpolate the scalars.\n  double rad;\n  vtkNew<vtkTupleInterpolator> interpolatedRadius;\n  interpolatedRadius->SetInterpolationTypeToLinear();\n  interpolatedRadius->SetNumberOfComponents(1);\n  rad = .2;\n  interpolatedRadius->AddTuple(0, &rad);\n  rad = .2;\n  interpolatedRadius->AddTuple(1, &rad);\n  rad = .2;\n  interpolatedRadius->AddTuple(2, &rad);\n  rad = .1;\n  interpolatedRadius->AddTuple(3, &rad);\n  rad = .1;\n  interpolatedRadius->AddTuple(4, &rad);\n  rad = .1;\n  interpolatedRadius->AddTuple(5, &rad);\n\n  // Generate the radius scalars.\n  vtkNew<vtkDoubleArray> tubeRadius;\n  unsigned int n = functionSource->GetOutput()->GetNumberOfPoints();\n  tubeRadius->SetNumberOfTuples(n);\n  tubeRadius->SetName(\"TubeRadius\");\n  auto tMin = interpolatedRadius->GetMinimumT();\n  auto tMax = interpolatedRadius->GetMaximumT();\n  double r;\n  for (unsigned int i = 0; i < n; ++i)\n  {\n    auto t = (tMax - tMin) / (n - 1) * i + tMin;\n    interpolatedRadius->InterpolateTuple(t, &r);\n    tubeRadius->SetTuple1(i, r);\n  }\n\n  // Add the scalars to the polydata.\n  auto tubePolyData = functionSource->GetOutput();\n  tubePolyData->GetPointData()->AddArray(tubeRadius);\n  tubePolyData->GetPointData()->SetActiveScalars(\"TubeRadius\");\n\n  // Create the tubes.\n  vtkNew<vtkTubeFilter> tuber;\n  tuber->SetInputData(tubePolyData);\n  tuber->SetNumberOfSides(20);\n  tuber->SetVaryRadiusToVaryRadiusByAbsoluteScalar();\n\n  //--------------\n  // Setup actors and mappers.\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputData(tubePolyData);\n  lineMapper->SetScalarRange(tubePolyData->GetScalarRange());\n\n  vtkNew<vtkPolyDataMapper> tubeMapper;\n  tubeMapper->SetInputConnection(tuber->GetOutputPort());\n  tubeMapper->SetScalarRange(tubePolyData->GetScalarRange());\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetLineWidth(3);\n  vtkNew<vtkActor> tubeActor;\n  tubeActor->SetMapper(tubeMapper);\n  tubeActor->GetProperty()->SetOpacity(0.6);\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"TubesFromSplines\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(lineActor);\n  renderer->AddActor(tubeActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/TubesFromSplines/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TubesFromSplines)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TubesFromSplines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TubesFromSplines MACOSX_BUNDLE TubesFromSplines.cxx )\n  target_link_libraries(TubesFromSplines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TubesFromSplines\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/TubesFromSplines/#download-and-build-tubesfromsplines","title":"Download and Build TubesFromSplines","text":"

Click here to download TubesFromSplines and its CMakeLists.txt file. Once the tarball TubesFromSplines.tar has been downloaded and extracted,

cd TubesFromSplines/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TubesFromSplines\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/","title":"TubesWithVaryingRadiusAndColors","text":"

vtk-examples/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/#description","title":"Description","text":"

This example shows how to vary the radius of a tube with one scalar and color the tube with another.

  • Contributed by Marcus Thamson

Note

This original source code for this example is here.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/#code","title":"Code","text":"

TubesWithVaryingRadiusAndColors.cxx

#include <math.h>\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDoubleArray.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnsignedCharArray.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> nc;\n\n  // Spiral tube\n  unsigned int nV = 256;       // No. of vertices\n  unsigned int nCyc = 5;       // No. of spiral cycles\n  double rT1 = 0.1, rT2 = 0.5; // Start/end tube radii\n  double rS = 2;               // Spiral radius\n  double h = 10;               // Height\n  unsigned int nTv = 8;        // No. of surface elements for each tube vertex\n\n  // Create points and cells for the helix.\n  vtkNew<vtkPoints> points;\n  for (unsigned int i = 0; i < nV; i++)\n  {\n    // Helcial coordinates\n    auto vX = rS * cos(2 * vtkMath::Pi() * nCyc * i / (nV - 1));\n    auto vY = rS * sin(2 * vtkMath::Pi() * nCyc * i / (nV - 1));\n    auto vZ = h * i / nV;\n    points->InsertPoint(i, vX, vY, vZ);\n  }\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(nV);\n  for (unsigned int i = 0; i < nV; i++)\n  {\n    lines->InsertCellPoint(i);\n  }\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n  polyData->SetLines(lines);\n\n  // Varying tube radius using sine-function.\n  vtkNew<vtkDoubleArray> tubeRadius;\n  tubeRadius->SetName(\"TubeRadius\");\n  tubeRadius->SetNumberOfTuples(nV);\n  for (unsigned int i = 0; i < nV; i++)\n  {\n    tubeRadius->SetTuple1(\n        i, rT1 + (rT2 - rT1) * sin(vtkMath::Pi() * i / (nV - 1)));\n  }\n  polyData->GetPointData()->AddArray(tubeRadius);\n  polyData->GetPointData()->SetActiveScalars(\"TubeRadius\");\n\n  // RBG array (could add Alpha channel too I guess...).\n  // Varying from blue to red.\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetName(\"Colors\");\n  colors->SetNumberOfComponents(3);\n  colors->SetNumberOfTuples(nV);\n  for (unsigned int i = 0; i < nV; i++)\n  {\n    colors->InsertTuple3(i, int(255 * i / (nV - 1)), 0,\n                         int(255 * (nV - 1 - i) / (nV - 1)));\n  }\n  polyData->GetPointData()->AddArray(colors);\n\n  vtkNew<vtkTubeFilter> tube;\n  tube->SetInputData(polyData);\n  tube->SetNumberOfSides(nTv);\n  tube->SetVaryRadiusToVaryRadiusByAbsoluteScalar();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(tube->GetOutputPort());\n  mapper->ScalarVisibilityOn();\n  mapper->SetScalarModeToUsePointFieldData();\n  mapper->SelectColorArray(\"Colors\");\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(nc->GetColor3d(\"SteelBlue\").GetData());\n\n  // Make an oblique view.\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  iren->SetRenderWindow(renWin);\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(500, 500);\n  renWin->Render();\n  renWin->SetWindowName(\"TubesWithVaryingRadiusAndColors\");\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TubesWithVaryingRadiusAndColors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TubesWithVaryingRadiusAndColors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TubesWithVaryingRadiusAndColors MACOSX_BUNDLE TubesWithVaryingRadiusAndColors.cxx )\n  target_link_libraries(TubesWithVaryingRadiusAndColors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TubesWithVaryingRadiusAndColors\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/#download-and-build-tubeswithvaryingradiusandcolors","title":"Download and Build TubesWithVaryingRadiusAndColors","text":"

Click here to download TubesWithVaryingRadiusAndColors and its CMakeLists.txt file. Once the tarball TubesWithVaryingRadiusAndColors.tar has been downloaded and extracted,

cd TubesWithVaryingRadiusAndColors/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TubesWithVaryingRadiusAndColors\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/VelocityProfile/","title":"VelocityProfile","text":"

vtk-examples/Cxx/VisualizationAlgorithms/VelocityProfile

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/VelocityProfile/#description","title":"Description","text":"

This example shows shows warped planes in a structured grid dataset. The planes are warped according to flow momentum. The relative back and forward flow are clearly visible in the deformation of the planes.

Info

See Figure 6-14b in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/VelocityProfile/#code","title":"Code","text":"

VelocityProfile.cxx

// Translated from velProf.tcl.\n\n#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkWarpVector.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename1 filename2\" << std::endl;\n    std::cout << \"where: filename1 is combxyz.bin and filename2 is combq.bin.\"\n              << std::endl;\n    std::cout << \"Produces figure 6-14(b) Flow momentum from the VTK Textbook.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName1 = argv[1];\n  std::string fileName2 = argv[2];\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> bkg{{65, 99, 149}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Read a vtk file\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(fileName1.c_str());\n  pl3d->SetQFileName(fileName2.c_str());\n  pl3d->SetScalarFunctionNumber(100); // Density\n  pl3d->SetVectorFunctionNumber(202); // Momentum\n  pl3d->Update();\n\n  vtkStructuredGrid* pl3dOutput =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // What do we know about the data?\n  // Get the extent of the data: imin, imax, jmin, jmax, kmin, kmax\n  int extent[6] = {0, 0, 0, 0, 0, 0};\n  pl3dOutput->GetExtent(extent);\n  double scalarRange[2] = {0.0, 0.0};\n  pl3dOutput->GetScalarRange(scalarRange);\n\n  // Planes are specified using a imin, imax, jmin, jmax, kmin, kmax coordinate\n  // specification. Min and max i,j,k values are clamped to 0 and maximum value.\n  // See the variable named extent for the values.\n  //\n  vtkNew<vtkStructuredGridGeometryFilter> plane;\n  plane->SetInputData(pl3dOutput);\n  plane->SetExtent(10, 10, 1, extent[3], 1, extent[5]);\n\n  vtkNew<vtkStructuredGridGeometryFilter> plane2;\n  plane2->SetInputData(pl3dOutput);\n  plane2->SetExtent(30, 30, 1, extent[3], 1, extent[5]);\n\n  vtkNew<vtkStructuredGridGeometryFilter> plane3;\n  plane3->SetInputData(pl3dOutput);\n  plane3->SetExtent(45, 45, 1, extent[3], 1, extent[5]);\n\n  // We use an append filter because that way we can do the warping, etc. just\n  // using a single pipeline and actor.\n  //\n  vtkNew<vtkAppendPolyData> appendF;\n  appendF->AddInputConnection(plane->GetOutputPort());\n  appendF->AddInputConnection(plane2->GetOutputPort());\n  appendF->AddInputConnection(plane3->GetOutputPort());\n\n  // Warp\n  vtkNew<vtkWarpVector> warp;\n  warp->SetInputConnection(appendF->GetOutputPort());\n  warp->SetScaleFactor(0.005);\n  warp->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(warp->GetPolyDataOutput());\n  normals->SetFeatureAngle(45);\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(normals->GetOutputPort());\n  planeMapper->SetScalarRange(scalarRange);\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n\n  // The outline provides context for the data and the planes.\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3dOutput);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren->AddActor(planeActor);\n  ren->AddActor(outlineActor);\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"VelocityProfile\");\n\n  iren->Initialize();\n\n  renWin->Render();\n\n  ren->GetActiveCamera()->SetPosition(19.8562, -31.8912, 47.0755);\n  ren->GetActiveCamera()->SetFocalPoint(8.255, 0.147815, 29.7631);\n  ren->GetActiveCamera()->SetViewUp(-0.0333325, 0.465756, 0.884285);\n  ren->GetActiveCamera()->SetClippingRange(17.3078, 64.6375);\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/VelocityProfile/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VelocityProfile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VelocityProfile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VelocityProfile MACOSX_BUNDLE VelocityProfile.cxx )\n  target_link_libraries(VelocityProfile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VelocityProfile\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/VelocityProfile/#download-and-build-velocityprofile","title":"Download and Build VelocityProfile","text":"

Click here to download VelocityProfile and its CMakeLists.txt file. Once the tarball VelocityProfile.tar has been downloaded and extracted,

cd VelocityProfile/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./VelocityProfile\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VisualizationAlgorithms/WarpCombustor/","title":"WarpCombustor","text":"

vtk-examples/Cxx/VisualizationAlgorithms/WarpCombustor

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VisualizationAlgorithms/WarpCombustor/#description","title":"Description","text":"

This example demonstrates how to extract \"computational planes\" from a structured dataset. Structured data has a natural, logical coordinate system based on i-j-k indices. Specifying imin,imax, jmin,jmax, kmin,kmax pairs can indicate a point, line, plane, or volume of data.

In this example, we extract three planes and warp them using scalar values in the direction of the local normal at each point. This gives a sort of \"velocity profile\" that indicates the nature of the flow.

Info

See Figure 9-4b in Chapter 9 The VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VisualizationAlgorithms/WarpCombustor/#code","title":"Code","text":"

WarpCombustor.cxx

#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkWarpScalar.h>\n\n#include <iostream>\n#include <string>\n\n// This example demonstrates how to extract \"computational planes\" from a\n// structured dataset. Structured data has a natural, logical coordinate\n// system based on i-j-k indices. Specifying imin,imax, jmin,jmax, kmin,kmax\n// pairs can indicate a point, line, plane, or volume of data.\n//\n// In this example, we extract three planes and warp them using scalar values\n// in the direction of the local normal at each point. This gives a sort of\n// \"velocity profile\" that indicates the nature of the flow.\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Here we read data from a annular combustor. A combustor burns fuel and air\n  // in a gas turbine (e.g., a jet engine) and the hot gas eventually makes its\n  // way to the turbine section.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkStructuredGrid* pl3dOutput =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // Planes are specified using a imin,imax, jmin,jmax, kmin,kmax coordinate\n  // specification. Min and max i,j,k values are clamped to 0 and maximum value.\n  //\n  vtkNew<vtkStructuredGridGeometryFilter> plane;\n  plane->SetInputData(pl3dOutput);\n  plane->SetExtent(10, 10, 1, 100, 1, 100);\n\n  vtkNew<vtkStructuredGridGeometryFilter> plane2;\n  plane2->SetInputData(pl3dOutput);\n  plane2->SetExtent(30, 30, 1, 100, 1, 100);\n  vtkNew<vtkStructuredGridGeometryFilter> plane3;\n  plane3->SetInputData(pl3dOutput);\n  plane3->SetExtent(45, 45, 1, 100, 1, 100);\n\n  // We use an append filter because that way we can do the warping, etc. just\n  // using a single pipeline and actor.\n  //\n  vtkNew<vtkAppendPolyData> appendF;\n  appendF->AddInputConnection(plane->GetOutputPort());\n  appendF->AddInputConnection(plane2->GetOutputPort());\n  appendF->AddInputConnection(plane3->GetOutputPort());\n\n  vtkNew<vtkWarpScalar> warp;\n  warp->SetInputConnection(appendF->GetOutputPort());\n  warp->UseNormalOn();\n  warp->SetNormal(1.0, 0.0, 0.0);\n  warp->SetScaleFactor(2.5);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(warp->GetOutputPort());\n  normals->SetFeatureAngle(60);\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(normals->GetOutputPort());\n  planeMapper->SetScalarRange(pl3dOutput->GetScalarRange());\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n\n  // The outline provides context for the data and the planes.\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3dOutput);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the usual graphics stuff.\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(planeActor);\n  ren1->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"WarpCombustor\");\n\n  // Create an initial view.\n  ren1->GetActiveCamera()->SetClippingRange(3.95297, 50);\n  ren1->GetActiveCamera()->SetFocalPoint(8.88908, 0.595038, 29.3342);\n  ren1->GetActiveCamera()->SetPosition(-12.3332, 31.7479, 41.2387);\n  ren1->GetActiveCamera()->SetViewUp(0.060772, -0.319905, 0.945498);\n  iren->Initialize();\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VisualizationAlgorithms/WarpCombustor/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WarpCombustor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WarpCombustor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WarpCombustor MACOSX_BUNDLE WarpCombustor.cxx )\n  target_link_libraries(WarpCombustor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WarpCombustor\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VisualizationAlgorithms/WarpCombustor/#download-and-build-warpcombustor","title":"Download and Build WarpCombustor","text":"

Click here to download WarpCombustor and its CMakeLists.txt file. Once the tarball WarpCombustor.tar has been downloaded and extracted,

cd WarpCombustor/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./WarpCombustor\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/","title":"FixedPointVolumeRayCastMapperCT","text":"

vtk-examples/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT

"},{"location":"Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/#description","title":"Description","text":"

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Note

This original source code for this example is here.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/#code","title":"Code","text":"

FixedPointVolumeRayCastMapperCT.cxx

#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkDICOMImageReader.h>\n#include <vtkFixedPointVolumeRayCastMapper.h>\n#include <vtkImageData.h>\n#include <vtkImageResample.h>\n#include <vtkInteractorObserver.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVolume.h>\n#include <vtkVolumeProperty.h>\n#include <vtkXMLImageDataReader.h>\n\n#include <iostream>\n#include <string>\n\n#define VTI_FILETYPE 1\n#define MHA_FILETYPE 2\n\nnamespace {\nvoid PrintUsage()\n{\n  std::cout << \"Usage: \" << std::endl;\n  std::cout << std::endl;\n  std::cout << \"  FixedPointVolumeRayCastMapperCT <options>\" << std::endl;\n  std::cout << std::endl;\n  std::cout << \"where options may include: \" << std::endl;\n  std::cout << std::endl;\n  std::cout << \"  -DICOM <directory>\" << std::endl;\n  std::cout << \"  -VTI <filename>\" << std::endl;\n  std::cout << \"  -MHA <filename>\" << std::endl;\n  std::cout << \"  -DependentComponents\" << std::endl;\n  std::cout << \"  -Clip\" << std::endl;\n  std::cout << \"  -MIP <window> <level>\" << std::endl;\n  std::cout << \"  -CompositeRamp <window> <level>\" << std::endl;\n  std::cout << \"  -CompositeShadeRamp <window> <level>\" << std::endl;\n  std::cout << \"  -CT_Skin\" << std::endl;\n  std::cout << \"  -CT_Bone\" << std::endl;\n  std::cout << \"  -CT_Muscle\" << std::endl;\n  std::cout << \"  -FrameRate <rate>\" << std::endl;\n  std::cout << \"  -DataReduction <factor>\" << std::endl;\n  std::cout << std::endl;\n  std::cout\n      << \"You must use either the -DICOM option to specify the directory where\"\n      << std::endl;\n  std::cout\n      << \"the data is located or the -VTI or -MHA option to specify the path \"\n         \"of a .vti file.\"\n      << std::endl;\n  std::cout << std::endl;\n  std::cout << \"By default, the program assumes that the file has independent \"\n               \"components,\"\n            << std::endl;\n  std::cout\n      << \"use -DependentComponents to specify that the file has dependent \"\n         \"components.\"\n      << std::endl;\n  std::cout << std::endl;\n  std::cout << \"Use the -Clip option to display a cube widget for clipping the \"\n               \"volume.\"\n            << std::endl;\n  std::cout\n      << \"Use the -FrameRate option with a desired frame rate (in frames per \"\n         \"second)\"\n      << std::endl;\n  std::cout << \"which will control the interactive rendering rate.\"\n            << std::endl;\n  std::cout\n      << \"Use the -DataReduction option with a reduction factor (greater than \"\n         \"zero and\"\n      << std::endl;\n  std::cout << \"less than one) to reduce the data before rendering.\"\n            << std::endl;\n  std::cout << \"Use one of the remaining options to specify the blend function\"\n            << std::endl;\n  std::cout\n      << \"and transfer functions. The -MIP option utilizes a maximum intensity\"\n      << std::endl;\n  std::cout << \"projection method, while the others utilize compositing. The\"\n            << std::endl;\n  std::cout << \"-CompositeRamp option is unshaded compositing, while the other\"\n            << std::endl;\n  std::cout << \"compositing options employ shading.\" << std::endl;\n  std::cout << std::endl;\n  std::cout << \"Note: MIP, CompositeRamp, CompositeShadeRamp, CT_Skin, CT_Bone,\"\n            << std::endl;\n  std::cout\n      << \"and CT_Muscle are appropriate for DICOM data. MIP, CompositeRamp,\"\n      << std::endl;\n  std::cout << \"and RGB_Composite are appropriate for RGB data.\" << std::endl;\n  std::cout << std::endl;\n  std::cout\n      << \"Example: FixedPointVolumeRayCastMapperCT -DICOM CTNeck -MIP 4096 1024\"\n      << std::endl;\n  std::cout << \"e.g. -MHA /FullHead.mhd -CT_Bone\" << std::endl;\n  std::cout << std::endl;\n}\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Parse the parameters\n\n  int count = 1;\n  char* dirname = NULL;\n  double opacityWindow = 4096;\n  double opacityLevel = 2048;\n  int blendType = 0;\n  int clip = 0;\n  double reductionFactor = 1.0;\n  double frameRate = 10.0;\n  char* fileName = 0;\n  int fileType = 0;\n\n  bool independentComponents = true;\n\n  while (count < argc)\n  {\n    if (!strcmp(argv[count], \"?\"))\n    {\n      PrintUsage();\n      exit(EXIT_SUCCESS);\n    }\n    else if (!strcmp(argv[count], \"-DICOM\"))\n    {\n      size_t size = strlen(argv[count + 1]) + 1;\n      dirname = new char[size];\n      snprintf(dirname, size, \"%s\", argv[count + 1]);\n      count += 2;\n    }\n    else if (!strcmp(argv[count], \"-VTI\"))\n    {\n      size_t size = strlen(argv[count + 1]) + 1;\n      fileName = new char[size];\n      fileType = VTI_FILETYPE;\n      snprintf(fileName, size, \"%s\", argv[count + 1]);\n      count += 2;\n    }\n    else if (!strcmp(argv[count], \"-MHA\"))\n    {\n      size_t size = strlen(argv[count + 1]) + 1;\n      fileName = new char[size];\n      fileType = MHA_FILETYPE;\n      snprintf(fileName, size, \"%s\", argv[count + 1]);\n      count += 2;\n    }\n    else if (!strcmp(argv[count], \"-Clip\"))\n    {\n      clip = 1;\n      count++;\n    }\n    else if (!strcmp(argv[count], \"-MIP\"))\n    {\n      opacityWindow = atof(argv[count + 1]);\n      opacityLevel = atof(argv[count + 2]);\n      blendType = 0;\n      count += 3;\n    }\n    else if (!strcmp(argv[count], \"-CompositeRamp\"))\n    {\n      opacityWindow = atof(argv[count + 1]);\n      opacityLevel = atof(argv[count + 2]);\n      blendType = 1;\n      count += 3;\n    }\n    else if (!strcmp(argv[count], \"-CompositeShadeRamp\"))\n    {\n      opacityWindow = atof(argv[count + 1]);\n      opacityLevel = atof(argv[count + 2]);\n      blendType = 2;\n      count += 3;\n    }\n    else if (!strcmp(argv[count], \"-CT_Skin\"))\n    {\n      blendType = 3;\n      count += 1;\n    }\n    else if (!strcmp(argv[count], \"-CT_Bone\"))\n    {\n      blendType = 4;\n      count += 1;\n    }\n    else if (!strcmp(argv[count], \"-CT_Muscle\"))\n    {\n      blendType = 5;\n      count += 1;\n    }\n    else if (!strcmp(argv[count], \"-RGB_Composite\"))\n    {\n      blendType = 6;\n      count += 1;\n    }\n    else if (!strcmp(argv[count], \"-FrameRate\"))\n    {\n      frameRate = atof(argv[count + 1]);\n      if (frameRate < 0.01 || frameRate > 60.0)\n      {\n        std::cout << \"Invalid frame rate - use a number between 0.01 and 60.0\"\n                  << std::endl;\n        std::cout << \"Using default frame rate of 10 frames per second.\"\n                  << std::endl;\n        frameRate = 10.0;\n      }\n      count += 2;\n    }\n    else if (!strcmp(argv[count], \"-ReductionFactor\"))\n    {\n      reductionFactor = atof(argv[count + 1]);\n      if (reductionFactor <= 0.0 || reductionFactor >= 1.0)\n      {\n        std::cout << \"Invalid reduction factor - use a number between 0 and 1 \"\n                     \"(exclusive)\"\n                  << std::endl;\n        std::cout << \"Using the default of no reduction.\" << std::endl;\n        reductionFactor = 1.0;\n      }\n      count += 2;\n    }\n    else if (!strcmp(argv[count], \"-DependentComponents\"))\n    {\n      independentComponents = false;\n      count += 1;\n    }\n    else\n    {\n      std::cout << \"Unrecognized option: \" << argv[count] << std::endl;\n      std::cout << std::endl;\n      PrintUsage();\n      exit(EXIT_FAILURE);\n    }\n  }\n\n  if (!dirname && !fileName)\n  {\n    std::cout\n        << \"Error: you must specify a directory of DICOM data or a .vti file \"\n           \"or a .mha!\"\n        << std::endl;\n    std::cout << std::endl;\n    PrintUsage();\n    exit(EXIT_FAILURE);\n  }\n\n  // Create the renderer, render window and interactor\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n\n  // Connect it all. Note that funny arithematic on the\n  // SetDesiredUpdateRate - the vtkRenderWindow divides it\n  // allocated time across all renderers, and the renderer\n  // divides it time across all props. If clip is\n  // true then there are two props\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  iren->SetDesiredUpdateRate(frameRate / (1 + clip));\n\n  iren->GetInteractorStyle()->SetDefaultRenderer(renderer);\n\n  // Read the data\n  vtkSmartPointer<vtkAlgorithm> reader;\n  vtkSmartPointer<vtkImageData> input;\n  if (dirname)\n  {\n    vtkNew<vtkDICOMImageReader> dicomReader;\n    dicomReader->SetDirectoryName(dirname);\n    dicomReader->Update();\n    input = dicomReader->GetOutput();\n    reader = dicomReader;\n  }\n  else if (fileType == VTI_FILETYPE)\n  {\n    vtkNew<vtkXMLImageDataReader> xmlReader;\n    xmlReader->SetFileName(fileName);\n    xmlReader->Update();\n    input = xmlReader->GetOutput();\n    reader = xmlReader;\n  }\n  else if (fileType == MHA_FILETYPE)\n  {\n    vtkNew<vtkMetaImageReader> metaReader;\n    metaReader->SetFileName(fileName);\n    metaReader->Update();\n    input = metaReader->GetOutput();\n    reader = metaReader;\n  }\n  else\n  {\n    std::cout << \"Error! Not VTI or MHA!\" << std::endl;\n    exit(EXIT_FAILURE);\n  }\n\n  // Verify that we actually have a volume\n  int dim[3];\n  input->GetDimensions(dim);\n\n  if (dim[0] < 2 || dim[1] < 2 || dim[2] < 2)\n  {\n    std::cout << \"Error loading data!\" << std::endl;\n    exit(EXIT_FAILURE);\n  }\n\n  vtkNew<vtkImageResample> resample;\n  if (reductionFactor < 1.0)\n  {\n    resample->SetInputConnection(reader->GetOutputPort());\n    resample->SetAxisMagnificationFactor(0, reductionFactor);\n    resample->SetAxisMagnificationFactor(1, reductionFactor);\n    resample->SetAxisMagnificationFactor(2, reductionFactor);\n  }\n\n  // Create our volume and mapper\n  vtkNew<vtkVolume> volume;\n  vtkNew<vtkFixedPointVolumeRayCastMapper> mapper;\n\n  if (reductionFactor < 1.0)\n  {\n    mapper->SetInputConnection(resample->GetOutputPort());\n  }\n  else\n  {\n    mapper->SetInputConnection(reader->GetOutputPort());\n  }\n\n  // Set the sample distance on the ray to be 1/2 the average spacing\n  double spacing[3];\n  if (reductionFactor < 1.0)\n  {\n    resample->GetOutput()->GetSpacing(spacing);\n  }\n  else\n  {\n    input->GetSpacing(spacing);\n  }\n\n  //  mapper->SetSampleDistance( (spacing[0]+spacing[1]+spacing[2])/6.0 );\n  //  mapper->SetMaximumImageSampleDistance(10.0);\n\n  // Create our transfer function\n  vtkNew<vtkColorTransferFunction> colorFun;\n  vtkNew<vtkPiecewiseFunction> opacityFun;\n  // Create the property and attach the transfer functions\n  vtkNew<vtkVolumeProperty> property;\n  property->SetIndependentComponents(independentComponents);\n  property->SetColor(colorFun);\n  property->SetScalarOpacity(opacityFun);\n  property->SetInterpolationTypeToLinear();\n\n  // connect up the volume to the property and the mapper\n  volume->SetProperty(property);\n  volume->SetMapper(mapper);\n\n  // Depending on the blend type selected as a command line option,\n  // adjust the transfer function\n  switch (blendType)\n  {\n  // MIP\n  // Create an opacity ramp from the window and level values.\n  // Color is white. Blending is MIP.\n  case 0:\n    colorFun->AddRGBSegment(0.0, 1.0, 1.0, 1.0, 255.0, 1.0, 1.0, 1.0);\n    opacityFun->AddSegment(opacityLevel - 0.5 * opacityWindow, 0.0,\n                           opacityLevel + 0.5 * opacityWindow, 1.0);\n    mapper->SetBlendModeToMaximumIntensity();\n    break;\n\n  // CompositeRamp\n  // Create a ramp from the window and level values. Use compositing\n  // without shading. Color is a ramp from black to white.\n  case 1:\n    colorFun->AddRGBSegment(opacityLevel - 0.5 * opacityWindow, 0.0, 0.0, 0.0,\n                            opacityLevel + 0.5 * opacityWindow, 1.0, 1.0, 1.0);\n    opacityFun->AddSegment(opacityLevel - 0.5 * opacityWindow, 0.0,\n                           opacityLevel + 0.5 * opacityWindow, 1.0);\n    mapper->SetBlendModeToComposite();\n    property->ShadeOff();\n    break;\n\n  // CompositeShadeRamp\n  // Create a ramp from the window and level values. Use compositing\n  // with shading. Color is white.\n  case 2:\n    colorFun->AddRGBSegment(0.0, 1.0, 1.0, 1.0, 255.0, 1.0, 1.0, 1.0);\n    opacityFun->AddSegment(opacityLevel - 0.5 * opacityWindow, 0.0,\n                           opacityLevel + 0.5 * opacityWindow, 1.0);\n    mapper->SetBlendModeToComposite();\n    property->ShadeOn();\n    break;\n\n  // CT_Skin\n  // Use compositing and functions set to highlight skin in CT data\n  // Not for use on RGB data\n  case 3:\n    colorFun->AddRGBPoint(-3024, 0, 0, 0, 0.5, 0.0);\n    colorFun->AddRGBPoint(-1000, .62, .36, .18, 0.5, 0.0);\n    colorFun->AddRGBPoint(-500, .88, .60, .29, 0.33, 0.45);\n    colorFun->AddRGBPoint(3071, .83, .66, 1, 0.5, 0.0);\n\n    opacityFun->AddPoint(-3024, 0, 0.5, 0.0);\n    opacityFun->AddPoint(-1000, 0, 0.5, 0.0);\n    opacityFun->AddPoint(-500, 1.0, 0.33, 0.45);\n    opacityFun->AddPoint(3071, 1.0, 0.5, 0.0);\n\n    mapper->SetBlendModeToComposite();\n    property->ShadeOn();\n    property->SetAmbient(0.1);\n    property->SetDiffuse(0.9);\n    property->SetSpecular(0.2);\n    property->SetSpecularPower(10.0);\n    property->SetScalarOpacityUnitDistance(0.8919);\n    break;\n\n  // CT_Bone\n  // Use compositing and functions set to highlight bone in CT data\n  // Not for use on RGB data\n  case 4:\n    colorFun->AddRGBPoint(-3024, 0, 0, 0, 0.5, 0.0);\n    colorFun->AddRGBPoint(-16, 0.73, 0.25, 0.30, 0.49, .61);\n    colorFun->AddRGBPoint(641, .90, .82, .56, .5, 0.0);\n    colorFun->AddRGBPoint(3071, 1, 1, 1, .5, 0.0);\n\n    opacityFun->AddPoint(-3024, 0, 0.5, 0.0);\n    opacityFun->AddPoint(-16, 0, .49, .61);\n    opacityFun->AddPoint(641, .72, .5, 0.0);\n    opacityFun->AddPoint(3071, .71, 0.5, 0.0);\n\n    mapper->SetBlendModeToComposite();\n    property->ShadeOn();\n    property->SetAmbient(0.1);\n    property->SetDiffuse(0.9);\n    property->SetSpecular(0.2);\n    property->SetSpecularPower(10.0);\n    property->SetScalarOpacityUnitDistance(0.8919);\n    break;\n\n  // CT_Muscle\n  // Use compositing and functions set to highlight muscle in CT data\n  // Not for use on RGB data\n  case 5:\n    colorFun->AddRGBPoint(-3024, 0, 0, 0, 0.5, 0.0);\n    colorFun->AddRGBPoint(-155, .55, .25, .15, 0.5, .92);\n    colorFun->AddRGBPoint(217, .88, .60, .29, 0.33, 0.45);\n    colorFun->AddRGBPoint(420, 1, .94, .95, 0.5, 0.0);\n    colorFun->AddRGBPoint(3071, .83, .66, 1, 0.5, 0.0);\n\n    opacityFun->AddPoint(-3024, 0, 0.5, 0.0);\n    opacityFun->AddPoint(-155, 0, 0.5, 0.92);\n    opacityFun->AddPoint(217, .68, 0.33, 0.45);\n    opacityFun->AddPoint(420, .83, 0.5, 0.0);\n    opacityFun->AddPoint(3071, .80, 0.5, 0.0);\n\n    mapper->SetBlendModeToComposite();\n    property->ShadeOn();\n    property->SetAmbient(0.1);\n    property->SetDiffuse(0.9);\n    property->SetSpecular(0.2);\n    property->SetSpecularPower(10.0);\n    property->SetScalarOpacityUnitDistance(0.8919);\n    break;\n\n  // RGB_Composite\n  // Use compositing and functions set to highlight red/green/blue regions\n  // in RGB data. Not for use on single component data\n  case 6:\n    opacityFun->AddPoint(0, 0.0);\n    opacityFun->AddPoint(5.0, 0.0);\n    opacityFun->AddPoint(30.0, 0.05);\n    opacityFun->AddPoint(31.0, 0.0);\n    opacityFun->AddPoint(90.0, 0.0);\n    opacityFun->AddPoint(100.0, 0.3);\n    opacityFun->AddPoint(110.0, 0.0);\n    opacityFun->AddPoint(190.0, 0.0);\n    opacityFun->AddPoint(200.0, 0.4);\n    opacityFun->AddPoint(210.0, 0.0);\n    opacityFun->AddPoint(245.0, 0.0);\n    opacityFun->AddPoint(255.0, 0.5);\n\n    mapper->SetBlendModeToComposite();\n    property->ShadeOff();\n    property->SetScalarOpacityUnitDistance(1.0);\n    break;\n  default:\n    vtkGenericWarningMacro(\"Unknown blend type.\");\n    break;\n  }\n\n  // Set the default window size\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"FixedPointVolumeRayCastMapperCT\");\n  renWin->Render();\n\n  // Add the volume to the scene\n  renderer->AddVolume(volume);\n\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(56.8656, -297.084, 78.913);\n  camera->SetFocalPoint(109.139, 120.604, 63.5486);\n  camera->SetViewUp(-0.00782421, -0.0357807, -0.999329);\n  camera->SetDistance(421.227);\n  camera->SetClippingRange(146.564, 767.987);\n\n  // interact with data\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FixedPointVolumeRayCastMapperCT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  IOXML\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolume\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FixedPointVolumeRayCastMapperCT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FixedPointVolumeRayCastMapperCT MACOSX_BUNDLE FixedPointVolumeRayCastMapperCT.cxx )\n  target_link_libraries(FixedPointVolumeRayCastMapperCT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FixedPointVolumeRayCastMapperCT\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/#download-and-build-fixedpointvolumeraycastmapperct","title":"Download and Build FixedPointVolumeRayCastMapperCT","text":"

Click here to download FixedPointVolumeRayCastMapperCT and its CMakeLists.txt file. Once the tarball FixedPointVolumeRayCastMapperCT.tar has been downloaded and extracted,

cd FixedPointVolumeRayCastMapperCT/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./FixedPointVolumeRayCastMapperCT\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VolumeRendering/IntermixedUnstructuredGrid/","title":"IntermixedUnstructuredGrid","text":"

vtk-examples/Cxx/VolumeRendering/IntermixedUnstructuredGrid

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VolumeRendering/IntermixedUnstructuredGrid/#code","title":"Code","text":"

IntermixedUnstructuredGrid.cxx

/* converted from:\n *\nhttps://github.com/Kitware/VTK/blob/49fbbe479dfdf47c86c02d6cae48c41b9c844b04/Examples/VolumeRendering/Tcl/IntermixedUnstructuredGrid.tcl\n*\n*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkContourFilter.h>\n#include <vtkDataSetTriangleFilter.h>\n#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSLCReader.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkThreshold.h>\n#include <vtkUnstructuredGridVolumeRayCastMapper.h>\n#include <vtkVolumeProperty.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" file.vtk file.slc e.g. ironProt.vtk neghip.slc\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create the reader for the data\n  // This is the data the will be volume rendered\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // create a reader for the other data that will\n  // be contoured and displayed as a polygonal mesh\n  vtkNew<vtkSLCReader> reader2;\n  reader2->SetFileName(argv[2]);\n\n  // convert from vtkImageData to vtkUnstructuredGrid, remove\n  // any cells where all values are below 80\n  vtkNew<vtkThreshold> thresh;\n  thresh->SetUpperThreshold(80);\n  thresh->SetThresholdFunction(vtkThreshold::THRESHOLD_UPPER);\n  // thresh->ThresholdByUpper(80);\n  thresh->AllScalarsOff();\n  thresh->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkDataSetTriangleFilter> trifilter;\n  trifilter->SetInputConnection(thresh->GetOutputPort());\n\n  // Create transfer mapping scalar value to opacity\n  vtkNew<vtkPiecewiseFunction> opacityTransferFunction;\n  opacityTransferFunction->AddPoint(80, 0.0);\n  opacityTransferFunction->AddPoint(120, 0.2);\n  opacityTransferFunction->AddPoint(255, 0.2);\n\n  // Create transfer mapping scalar value to color\n  vtkNew<vtkColorTransferFunction> colorTransferFunction;\n  colorTransferFunction->AddRGBPoint(80.0, 0.0, 0.0, 0.0);\n  colorTransferFunction->AddRGBPoint(120.0, 0.0, 0.0, 1.0);\n  colorTransferFunction->AddRGBPoint(160.0, 1.0, 0.0, 0.0);\n  colorTransferFunction->AddRGBPoint(200.0, 0.0, 1.0, 0.0);\n  colorTransferFunction->AddRGBPoint(255.0, 0.0, 1.0, 1.0);\n\n  // The property describes how the data will look\n  vtkNew<vtkVolumeProperty> volumeProperty;\n  volumeProperty->SetColor(colorTransferFunction);\n  volumeProperty->SetScalarOpacity(opacityTransferFunction);\n  volumeProperty->ShadeOff();\n  volumeProperty->SetInterpolationTypeToLinear();\n\n  // The mapper / ray cast function know how to render the data\n  vtkNew<vtkUnstructuredGridVolumeRayCastMapper> volumeMapper;\n  volumeMapper->SetInputConnection(trifilter->GetOutputPort());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(640, 512);\n  vtkNew<vtkRenderer> ren1;\n\n  // contour the second dataset\n  vtkNew<vtkContourFilter> contour;\n  contour->SetValue(0, 80);\n  contour->SetInputConnection(reader2->GetOutputPort());\n\n  // create a mapper for the polygonal data\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(contour->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // create an actor for the polygonal data\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  ren1->AddViewProp(actor);\n\n  ren1->SetBackground(0.1, 0.4, 0.2);\n\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"IntermixedUnstructuredGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkVolume> volume;\n  volume->SetMapper(volumeMapper);\n  volume->SetProperty(volumeProperty);\n\n  ren1->AddVolume(volume);\n\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Zoom(1.5);\n\n  // Render composite. In default mode. For coverage.\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VolumeRendering/IntermixedUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IntermixedUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  IOImage\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolume\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IntermixedUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IntermixedUnstructuredGrid MACOSX_BUNDLE IntermixedUnstructuredGrid.cxx )\n  target_link_libraries(IntermixedUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IntermixedUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VolumeRendering/IntermixedUnstructuredGrid/#download-and-build-intermixedunstructuredgrid","title":"Download and Build IntermixedUnstructuredGrid","text":"

Click here to download IntermixedUnstructuredGrid and its CMakeLists.txt file. Once the tarball IntermixedUnstructuredGrid.tar has been downloaded and extracted,

cd IntermixedUnstructuredGrid/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./IntermixedUnstructuredGrid\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VolumeRendering/MinIntensityRendering/","title":"MinIntensityRendering","text":"

vtk-examples/Cxx/VolumeRendering/MinIntensityRendering

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VolumeRendering/MinIntensityRendering/#code","title":"Code","text":"

MinIntensityRendering.cxx

#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkFixedPointVolumeRayCastMapper.h>\n#include <vtkImageClip.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkVolume.h>\n#include <vtkVolumeProperty.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Required arguments: vtkFile e.g. ironProt.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the renderers, render window, and interactor.\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  vtkNew<vtkRenderer> ren;\n  renWin->AddRenderer(ren);\n  renWin->SetWindowName(\"MinIntensityRendering\");\n\n  // Read the data from a vtk file\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Create a transfer function mapping scalar value to opacity.\n  vtkNew<vtkPiecewiseFunction> oTFun;\n  oTFun->AddSegment(0, 1.0, 256, 0.1);\n\n  vtkNew<vtkColorTransferFunction> cTFun;\n  cTFun->AddRGBPoint(0, 1.0, 1.0, 1.0);\n  cTFun->AddRGBPoint(255, 1.0, 1.0, 1.0);\n\n  // Need to crop to actually see minimum intensity.\n  vtkNew<vtkImageClip> clip;\n  clip->SetInputConnection(reader->GetOutputPort());\n  clip->SetOutputWholeExtent(0, 66, 0, 66, 30, 37);\n  clip->ClipDataOn();\n\n  vtkNew<vtkVolumeProperty> property;\n  property->SetScalarOpacity(oTFun);\n  property->SetColor(cTFun);\n  property->SetInterpolationTypeToLinear();\n\n  vtkNew<vtkFixedPointVolumeRayCastMapper> mapper;\n  mapper->SetBlendModeToMinimumIntensity();\n  mapper->SetInputConnection(clip->GetOutputPort());\n\n  vtkNew<vtkVolume> volume;\n  volume->SetMapper(mapper);\n  volume->SetProperty(property);\n\n  ren->AddViewProp(volume);\n  ren->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renWin->Render();\n\n  ren->GetActiveCamera()->Zoom(1.3);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VolumeRendering/MinIntensityRendering/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MinIntensityRendering)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOLegacy\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolume\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MinIntensityRendering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MinIntensityRendering MACOSX_BUNDLE MinIntensityRendering.cxx )\n  target_link_libraries(MinIntensityRendering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MinIntensityRendering\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VolumeRendering/MinIntensityRendering/#download-and-build-minintensityrendering","title":"Download and Build MinIntensityRendering","text":"

Click here to download MinIntensityRendering and its CMakeLists.txt file. Once the tarball MinIntensityRendering.tar has been downloaded and extracted,

cd MinIntensityRendering/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./MinIntensityRendering\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VolumeRendering/OpenVRVolume/","title":"OpenVRVolume","text":"

vtk-examples/Cxx/VolumeRendering/OpenVRVolume

"},{"location":"Cxx/VolumeRendering/OpenVRVolume/#description","title":"Description","text":"

This example renders a simple artificial 10x10x10 volume in OpenVR.

Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VolumeRendering/OpenVRVolume/#code","title":"Code","text":"

OpenVRVolume.cxx

#include <vtkActor.h>\n#include <vtkColorSeries.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkSmartVolumeMapper.h>\n#include <vtkVolumeProperty.h>\n\nint main(int argc, char* argv[])\n{\n  int dim[3] = {10, 10, 10};\n  double spc[3] = {0.05, 0.05, 0.05};\n  vtkNew<vtkImageData> img;\n  img->SetDimensions(dim);\n  img->AllocateScalars(VTK_INT, 1);\n  img->SetSpacing(spc);\n  for (int x = 0; x < dim[0]; ++x)\n    for (int y = 0; y < dim[1]; ++y)\n      for (int z = 0; z < dim[2]; ++z)\n      {\n        img->SetScalarComponentFromDouble(x, y, z, 0, x);\n      }\n  vtkNew<vtkColorSeries> colors;\n  colors->SetColorScheme(vtkColorSeries::BREWER_QUALITATIVE_SET3);\n  vtkNew<vtkColorTransferFunction> ctf;\n  for (int x = 0; x < dim[0]; ++x)\n  {\n    auto c = colors->GetColor(x);\n    ctf->AddRGBPoint(x, c.GetRed() / 255.0, c.GetGreen() / 255.0,\n                     c.GetBlue() / 255.0);\n  }\n  ctf->AddRGBPoint(dim[0], 1.0, 1.0, 1.0);\n  ctf->Build();\n  vtkNew<vtkSmartVolumeMapper> volMapper;\n  vtkNew<vtkVolume> volume;\n  vtkNew<vtkVolumeProperty> volProp;\n  volMapper->SetBlendModeToComposite();\n  volume->SetMapper(volMapper);\n  volume->SetProperty(volProp);\n  volume->SetVisibility(true);\n  volMapper->SetInputData(img);\n  volProp->SetColor(0, ctf);\n  vtkNew<vtkPiecewiseFunction> otf;\n  otf->AddPoint(0.0, 1.0);\n  otf->AddPoint(dim[0], 1.0);\n  volProp->SetScalarOpacity(0, otf);\n  volProp->Modified();\n  volProp->SetScalarOpacityUnitDistance(1);\n\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkOpenVRRenderer> renderer;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkNamedColors> namedColors;\n  renderer->SetBackground(namedColors->GetColor3d(\"ForestGreen\").GetData());\n  renderer->AddVolume(volume);\n  volume->SetPosition(0, 0.5, 0);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VolumeRendering/OpenVRVolume/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRVolume)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRVolume: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRVolume MACOSX_BUNDLE OpenVRVolume.cxx )\n  target_link_libraries(OpenVRVolume PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRVolume\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VolumeRendering/OpenVRVolume/#download-and-build-openvrvolume","title":"Download and Build OpenVRVolume","text":"

Click here to download OpenVRVolume and its CMakeLists.txt file. Once the tarball OpenVRVolume.tar has been downloaded and extracted,

cd OpenVRVolume/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OpenVRVolume\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VolumeRendering/PseudoVolumeRendering/","title":"PseudoVolumeRendering","text":"

vtk-examples/Cxx/VolumeRendering/PseudoVolumeRendering

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/VolumeRendering/PseudoVolumeRendering/#description","title":"Description","text":"

This example uses 100 cut planes with opacity of 0.05. Rendered back-to-front to simulate volume rendering.

Info

See Figure 6-32 in Chapter 6 the VTK Textbook.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VolumeRendering/PseudoVolumeRendering/#code","title":"Code","text":"

PseudoVolumeRendering.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCutter.h>\n#include <vtkExtractGrid.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <string>\n\n// Perform psuedo volume rendering in a structured grid by compositing\n// translucent cut planes. This same trick can be used for unstructured\n// grids. Note that for better results, more planes can be created. Also,\n// if your data is vtkImageData, there are much faster methods for volume\n// rendering.\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create pipeline. Read structured grid data.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkStructuredGrid* pl3dOutput =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // A convenience, use this filter to limit data for experimentation.\n  vtkNew<vtkExtractGrid> extract;\n  extract->SetVOI(1, 55, -1000, 1000, -1000, 1000);\n  extract->SetInputData(pl3dOutput);\n\n  // The (implicit) plane is used to do the cutting.\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(0, 4, 2);\n  plane->SetNormal(0, 1, 0);\n\n  // The cutter is set up to process each contour value over all cells\n  // (SetSortByToSortByCell). This results in an ordered output of polygons\n  // which is key to the compositing.\n  vtkNew<vtkCutter> cutter;\n  cutter->SetInputConnection(extract->GetOutputPort());\n  cutter->SetCutFunction(plane);\n  cutter->GenerateCutScalarsOff();\n  cutter->SetSortByToSortByCell();\n\n  vtkNew<vtkLookupTable> clut;\n  clut->SetHueRange(0, .67);\n  clut->Build();\n\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n  cutterMapper->SetScalarRange(.18, .7);\n  cutterMapper->SetLookupTable(clut);\n\n  vtkNew<vtkActor> cut;\n  cut->SetMapper(cutterMapper);\n\n  // Add in some surface geometry for interest.\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputData(pl3dOutput);\n  iso->SetValue(0, .22);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(iso->GetOutputPort());\n  normals->SetFeatureAngle(60);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(normals->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  isoActor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  isoActor->GetProperty()->SetDiffuse(.8);\n  isoActor->GetProperty()->SetSpecular(.5);\n  isoActor->GetProperty()->SetSpecularPower(30);\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3dOutput);\n\n  vtkNew<vtkStripper> outlineStrip;\n  outlineStrip->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkTubeFilter> outlineTubes;\n  outlineTubes->SetInputConnection(outline->GetOutputPort());\n  outlineTubes->SetInputConnection(outlineStrip->GetOutputPort());\n  outlineTubes->SetRadius(.1);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outlineTubes->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Create the RenderWindow, Renderer and Interactor.\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  ren1->AddActor(isoActor);\n  isoActor->VisibilityOn();\n  ren1->AddActor(cut);\n\n  unsigned int n = 20;\n  double opacity = 1.0 / (static_cast<double>(n)) * 5.0;\n  cut->GetProperty()->SetOpacity(1);\n  ren1->SetBackground(colors->GetColor3d(\"Slategray\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"PseudoVolumeRendering\");\n\n  ren1->GetActiveCamera()->SetClippingRange(3.95297, 50);\n  ren1->GetActiveCamera()->SetFocalPoint(9.71821, 0.458166, 29.3999);\n  ren1->GetActiveCamera()->SetPosition(2.7439, -37.3196, 38.7167);\n  ren1->GetActiveCamera()->ComputeViewPlaneNormal();\n  ren1->GetActiveCamera()->SetViewUp(-0.16123, 0.264271, 0.950876);\n\n  // Cut: generates n cut planes normal to camera's view plane.\n  //\n  plane->SetNormal(ren1->GetActiveCamera()->GetViewPlaneNormal());\n  plane->SetOrigin(ren1->GetActiveCamera()->GetFocalPoint());\n  cutter->GenerateValues(n, -5, 5);\n  clut->SetAlphaRange(opacity, opacity);\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VolumeRendering/PseudoVolumeRendering/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PseudoVolumeRendering)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PseudoVolumeRendering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PseudoVolumeRendering MACOSX_BUNDLE PseudoVolumeRendering.cxx )\n  target_link_libraries(PseudoVolumeRendering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PseudoVolumeRendering\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VolumeRendering/PseudoVolumeRendering/#download-and-build-pseudovolumerendering","title":"Download and Build PseudoVolumeRendering","text":"

Click here to download PseudoVolumeRendering and its CMakeLists.txt file. Once the tarball PseudoVolumeRendering.tar has been downloaded and extracted,

cd PseudoVolumeRendering/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PseudoVolumeRendering\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VolumeRendering/RayCastIsosurface/","title":"RayCastIsosurface","text":"

vtk-examples/Cxx/VolumeRendering/RayCastIsosurface

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

"},{"location":"Cxx/VolumeRendering/RayCastIsosurface/#description","title":"Description","text":"

This examples show how volume rendering can produce isosurface-like images. Using vtkOpenGLGPUVolumeRayCastMapper with an isosurface blend mode, two isosurfaces are created using appropriate transfer functions. The effect is similar to what is shown in MedicalDemo2. The user can specify the .mhd file and the two isosurface values. The example uses 500 and 1150 for the two isosurface values. The volume rendering \"surfaces\" are fuzzier than the hard surfaces created by vtkMarchingCubes in MedicalDemo3.

Usage

    RayCastIsosurface FullHead.mhd 500 1150\n

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VolumeRendering/RayCastIsosurface/#code","title":"Code","text":"

RayCastIsosurface.cxx

#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkContourValues.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLGPUVolumeRayCastMapper.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVolume.h>\n#include <vtkVolumeProperty.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  double iso1 = 500.0;\n  double iso2 = 1150.0;\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.mnd [iso1=500] [iso2=1150]\"\n              << std::endl;\n    std::cout << \"e.g. FullHead.mhd 500 1150\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkOpenGLGPUVolumeRayCastMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n  mapper->AutoAdjustSampleDistancesOff();\n  mapper->SetSampleDistance(0.5);\n  mapper->SetBlendModeToIsoSurface();\n\n  if (argc > 3)\n  {\n    iso1 = atof(argv[2]);\n    iso2 = atof(argv[3]);\n  }\n  vtkNew<vtkColorTransferFunction> colorTransferFunction;\n  colorTransferFunction->RemoveAllPoints();\n  colorTransferFunction->AddRGBPoint(iso2,\n                                     colors->GetColor3d(\"ivory\").GetData()[0],\n                                     colors->GetColor3d(\"ivory\").GetData()[1],\n                                     colors->GetColor3d(\"ivory\").GetData()[2]);\n  colorTransferFunction->AddRGBPoint(iso1,\n                                     colors->GetColor3d(\"flesh\").GetData()[0],\n                                     colors->GetColor3d(\"flesh\").GetData()[1],\n                                     colors->GetColor3d(\"flesh\").GetData()[2]);\n\n  vtkNew<vtkPiecewiseFunction> scalarOpacity;\n  scalarOpacity->AddPoint(iso1, .3);\n  scalarOpacity->AddPoint(iso2, 0.6);\n\n  vtkNew<vtkVolumeProperty> volumeProperty;\n  volumeProperty->ShadeOn();\n  volumeProperty->SetInterpolationTypeToLinear();\n  volumeProperty->SetColor(colorTransferFunction);\n  volumeProperty->SetScalarOpacity(scalarOpacity);\n\n  vtkNew<vtkVolume> volume;\n  volume->SetMapper(mapper);\n  volume->SetProperty(volumeProperty);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddVolume(volume);\n  renderer->SetBackground(colors->GetColor3d(\"cornflower\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(800, 600);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RayCastIsosurface\");\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  interactor->SetInteractorStyle(style);\n\n  // Add some contour values to draw iso surfaces\n  volumeProperty->GetIsoSurfaceValues()->SetValue(0, iso1);\n  volumeProperty->GetIsoSurfaceValues()->SetValue(1, iso2);\n\n  // Generate a good view\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n\n  renderer->SetActiveCamera(aCamera);\n  renderer->ResetCamera();\n\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n  aCamera->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VolumeRendering/RayCastIsosurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RayCastIsosurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonMisc\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RayCastIsosurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RayCastIsosurface MACOSX_BUNDLE RayCastIsosurface.cxx )\n  target_link_libraries(RayCastIsosurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RayCastIsosurface\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VolumeRendering/RayCastIsosurface/#download-and-build-raycastisosurface","title":"Download and Build RayCastIsosurface","text":"

Click here to download RayCastIsosurface and its CMakeLists.txt file. Once the tarball RayCastIsosurface.tar has been downloaded and extracted,

cd RayCastIsosurface/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RayCastIsosurface\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/VolumeRendering/SimpleRayCast/","title":"SimpleRayCast","text":"

vtk-examples/Cxx/VolumeRendering/SimpleRayCast

"},{"location":"Cxx/VolumeRendering/SimpleRayCast/#description","title":"Description","text":"

Volume rendering of a high potential iron protein.

Info

See Figure 7-34 in Chapter 7 the VTK Textbook.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/VolumeRendering/SimpleRayCast/#code","title":"Code","text":"

SimpleRayCast.cxx

#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkFixedPointVolumeRayCastMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkVolume.h>\n#include <vtkVolumeProperty.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" ironProt.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // This is a simple volume rendering example that\n  // uses a vtkFixedPointVolumeRayCastMapper\n\n  // Create the standard renderer, render window\n  // and interactor\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the reader for the data\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Create transfer mapping scalar value to opacity\n  vtkNew<vtkPiecewiseFunction> opacityTransferFunction;\n  opacityTransferFunction->AddPoint(20, 0.0);\n  opacityTransferFunction->AddPoint(255, 0.2);\n\n  // Create transfer mapping scalar value to color\n  vtkNew<vtkColorTransferFunction> colorTransferFunction;\n  colorTransferFunction->AddRGBPoint(0.0, 0.0, 0.0, 0.0);\n  colorTransferFunction->AddRGBPoint(64.0, 1.0, 0.0, 0.0);\n  colorTransferFunction->AddRGBPoint(128.0, 0.0, 0.0, 1.0);\n  colorTransferFunction->AddRGBPoint(192.0, 0.0, 1.0, 0.0);\n  colorTransferFunction->AddRGBPoint(255.0, 0.0, 0.2, 0.0);\n\n  // The property describes how the data will look\n  vtkNew<vtkVolumeProperty> volumeProperty;\n  volumeProperty->SetColor(colorTransferFunction);\n  volumeProperty->SetScalarOpacity(opacityTransferFunction);\n  volumeProperty->ShadeOn();\n  volumeProperty->SetInterpolationTypeToLinear();\n\n  // The mapper / ray cast function know how to render the data\n  vtkNew<vtkFixedPointVolumeRayCastMapper> volumeMapper;\n  volumeMapper->SetInputConnection(reader->GetOutputPort());\n\n  // The volume holds the mapper and the property and\n  // can be used to position/orient the volume\n  vtkNew<vtkVolume> volume;\n  volume->SetMapper(volumeMapper);\n  volume->SetProperty(volumeProperty);\n\n  ren1->AddVolume(volume);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  ren1->GetActiveCamera()->Azimuth(45);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->ResetCameraClippingRange();\n  ren1->ResetCamera();\n\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"SimpleRayCast\");\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/VolumeRendering/SimpleRayCast/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SimpleRayCast)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolume\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SimpleRayCast: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SimpleRayCast MACOSX_BUNDLE SimpleRayCast.cxx )\n  target_link_libraries(SimpleRayCast PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SimpleRayCast\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/VolumeRendering/SimpleRayCast/#download-and-build-simpleraycast","title":"Download and Build SimpleRayCast","text":"

Click here to download SimpleRayCast and its CMakeLists.txt file. Once the tarball SimpleRayCast.tar has been downloaded and extracted,

cd SimpleRayCast/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SimpleRayCast\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/AffineWidget/","title":"AffineWidget","text":"

vtk-examples/Cxx/Widgets/AffineWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/AffineWidget/#description","title":"Description","text":"

This example demonstrates use of a vtkAffineWidget to apply transforms to a 3D prop in the x-y plane.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/AffineWidget/#code","title":"Code","text":"

AffineWidget.cxx

#include <vtkActor.h>\n#include <vtkAffineRepresentation2D.h>\n#include <vtkAffineWidget.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n\nnamespace {\nclass vtkAffineCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkAffineCallback* New()\n  {\n    return new vtkAffineCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*);\n  vtkAffineCallback() : Actor(0), AffineRep(0)\n  {\n    this->Transform = vtkTransform::New();\n  }\n  ~vtkAffineCallback()\n  {\n    this->Transform->Delete();\n  }\n  vtkActor* Actor;\n  vtkAffineRepresentation2D* AffineRep;\n  vtkTransform* Transform;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create two spheres: a larger one and a smaller one on top of the larger one\n  // to show a reference point while rotating\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetRadius(0.075);\n  sphereSource2->SetCenter(0, 0.5, 0);\n  sphereSource2->Update();\n\n  // Append the two spheres into one vtkPolyData\n  vtkNew<vtkAppendPolyData> append;\n  append->AddInputConnection(sphereSource->GetOutputPort());\n  append->AddInputConnection(sphereSource2->GetOutputPort());\n\n  // Create a plane centered over the larger sphere with 4x4 sub sections\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->SetXResolution(4);\n  planeSource->SetYResolution(4);\n  planeSource->SetOrigin(-1, -1, 0);\n  planeSource->SetPoint1(1, -1, 0);\n  planeSource->SetPoint2(-1, 1, 0);\n\n  // Create a mapper and actor for the plane: show it as a wireframe\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(planeSource->GetOutputPort());\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n  planeActor->GetProperty()->SetRepresentationToWireframe();\n  planeActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  // Create a mapper and actor for the spheres\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(append->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"AffineWidget\");\n\n  renderer->AddActor(actor);\n  renderer->AddActor(planeActor);\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"LightSkyBlue\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  dynamic_cast<vtkInteractorStyleSwitch*>(\n      renderWindowInteractor->GetInteractorStyle())\n      ->SetCurrentStyleToTrackballCamera();\n\n  // Create an affine widget to manipulate the actor\n  // the widget currently only has a 2D representation and therefore applies\n  // transforms in the X-Y plane only\n  vtkNew<vtkAffineWidget> affineWidget;\n  affineWidget->SetInteractor(renderWindowInteractor);\n  affineWidget->CreateDefaultRepresentation();\n  dynamic_cast<vtkAffineRepresentation2D*>(affineWidget->GetRepresentation())\n      ->PlaceWidget(actor->GetBounds());\n\n  vtkNew<vtkAffineCallback> affineCallback;\n  affineCallback->Actor = actor;\n  affineCallback->AffineRep = dynamic_cast<vtkAffineRepresentation2D*>(\n      affineWidget->GetRepresentation());\n\n  affineWidget->AddObserver(vtkCommand::InteractionEvent, affineCallback);\n  affineWidget->AddObserver(vtkCommand::EndInteractionEvent, affineCallback);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  affineWidget->On();\n\n  // begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid vtkAffineCallback::Execute(vtkObject*, unsigned long vtkNotUsed(event),\n                                void*)\n{\n  this->AffineRep->GetTransform(this->Transform);\n  this->Actor->SetUserTransform(this->Transform);\n}\n} // namespace\n
"},{"location":"Cxx/Widgets/AffineWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AffineWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AffineWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AffineWidget MACOSX_BUNDLE AffineWidget.cxx )\n  target_link_libraries(AffineWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AffineWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/AffineWidget/#download-and-build-affinewidget","title":"Download and Build AffineWidget","text":"

Click here to download AffineWidget and its CMakeLists.txt file. Once the tarball AffineWidget.tar has been downloaded and extracted,

cd AffineWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AffineWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/AngleWidget/","title":"AngleWidget","text":"

vtk-examples/Cxx/Widgets/AngleWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/AngleWidget/#description","title":"Description","text":"

Click three points to create an angle. You can then drag the points around.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/AngleWidget/#code","title":"Code","text":"

AngleWidget.cxx

#include <vtkAngleWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"AngleWidget\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkAngleWidget> angleWidget;\n  angleWidget->SetInteractor(renderWindowInteractor);\n  angleWidget->CreateDefaultRepresentation();\n\n  // Render\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  angleWidget->On();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/AngleWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AngleWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AngleWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AngleWidget MACOSX_BUNDLE AngleWidget.cxx )\n  target_link_libraries(AngleWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AngleWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/AngleWidget/#download-and-build-anglewidget","title":"Download and Build AngleWidget","text":"

Click here to download AngleWidget and its CMakeLists.txt file. Once the tarball AngleWidget.tar has been downloaded and extracted,

cd AngleWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AngleWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/AngleWidget2D/","title":"AngleWidget2D","text":"

vtk-examples/Cxx/Widgets/AngleWidget2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/AngleWidget2D/#description","title":"Description","text":"

The arc is still visible?

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/AngleWidget2D/#code","title":"Code","text":"

AngleWidget2D.cxx

#include <vtkAngleRepresentation2D.h>\n#include <vtkAngleWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"AngleWidget2D\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  double pos1[3] = {50.0, 200.0, 0.0};\n  double pos2[3] = {200.0, 20.0, 0.0};\n  double center[3] = {100.0, 100.0, 0.0};\n  vtkNew<vtkAngleRepresentation2D> rep;\n  rep->ArcVisibilityOff();\n\n  vtkNew<vtkAngleWidget> angleWidget;\n  angleWidget->CreateDefaultRepresentation();\n  angleWidget->SetRepresentation(rep);\n  angleWidget->SetInteractor(renderWindowInteractor);\n\n  renderWindow->Render();\n\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  angleWidget->On();\n  rep->SetPoint1DisplayPosition(pos1);\n  rep->SetPoint2DisplayPosition(pos2);\n  rep->SetCenterDisplayPosition(center);\n  rep->Ray1VisibilityOn();\n  rep->Ray2VisibilityOn();\n  rep->ArcVisibilityOn();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/AngleWidget2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AngleWidget2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AngleWidget2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AngleWidget2D MACOSX_BUNDLE AngleWidget2D.cxx )\n  target_link_libraries(AngleWidget2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AngleWidget2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/AngleWidget2D/#download-and-build-anglewidget2d","title":"Download and Build AngleWidget2D","text":"

Click here to download AngleWidget2D and its CMakeLists.txt file. Once the tarball AngleWidget2D.tar has been downloaded and extracted,

cd AngleWidget2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./AngleWidget2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/BalloonWidget/","title":"BalloonWidget","text":"

vtk-examples/Cxx/Widgets/BalloonWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/BalloonWidget/#description","title":"Description","text":"

This example creates a sphere and a regular polygon. The balloon text describes each object when you hover over it.

Note

This original source code for this example is here.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/BalloonWidget/#code","title":"Code","text":"

BalloonWidget.cxx

#include <vtkActor.h>\n#include <vtkBalloonRepresentation.h>\n#include <vtkBalloonWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRegularPolygonSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(-4.0, 0.0, 0.0);\n  sphereSource->SetRadius(4.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Regular Polygon.\n  vtkNew<vtkRegularPolygonSource> regularPolygonSource;\n  regularPolygonSource->SetCenter(4.0, 0.0, 0.0);\n  regularPolygonSource->SetRadius(4.0);\n  regularPolygonSource->Update();\n\n  vtkNew<vtkPolyDataMapper> regularPolygonMapper;\n  regularPolygonMapper->SetInputConnection(\n      regularPolygonSource->GetOutputPort());\n\n  vtkNew<vtkActor> regularPolygonActor;\n  regularPolygonActor->SetMapper(regularPolygonMapper);\n  regularPolygonActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Cornsilk\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetWindowName(\"BalloonWidget\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Create the widget.\n  vtkNew<vtkBalloonRepresentation> balloonRep;\n  balloonRep->SetBalloonLayoutToImageRight();\n\n  vtkNew<vtkBalloonWidget> balloonWidget;\n  balloonWidget->SetInteractor(iRen);\n  balloonWidget->SetRepresentation(balloonRep);\n  balloonWidget->AddBalloon(sphereActor, \"This is a sphere\", nullptr);\n  balloonWidget->AddBalloon(regularPolygonActor, \"This is a regular polygon\",\n                            nullptr);\n\n  // Add the actors to the scene.\n  ren->AddActor(sphereActor);\n  ren->AddActor(regularPolygonActor);\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renWin->Render();\n\n  balloonWidget->EnabledOn();\n\n  // Begin mouse interaction.\n  iRen->Initialize();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/BalloonWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BalloonWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BalloonWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BalloonWidget MACOSX_BUNDLE BalloonWidget.cxx )\n  target_link_libraries(BalloonWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BalloonWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/BalloonWidget/#download-and-build-balloonwidget","title":"Download and Build BalloonWidget","text":"

Click here to download BalloonWidget and its CMakeLists.txt file. Once the tarball BalloonWidget.tar has been downloaded and extracted,

cd BalloonWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BalloonWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/BiDimensionalWidget/","title":"BiDimensionalWidget","text":"

vtk-examples/Cxx/Widgets/BiDimensionalWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/BiDimensionalWidget/#code","title":"Code","text":"

BiDimensionalWidget.cxx

#include <vtkActor.h>\n#include <vtkBiDimensionalRepresentation2D.h>\n#include <vtkBiDimensionalWidget.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass vtkBiDimensionalCallback : public vtkCommand\n{\npublic:\n  static vtkBiDimensionalCallback* New()\n  {\n    return new vtkBiDimensionalCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n\n    vtkBiDimensionalWidget* biDimensionalWidget =\n        reinterpret_cast<vtkBiDimensionalWidget*>(caller);\n\n    vtkBiDimensionalRepresentation2D* representation =\n        static_cast<vtkBiDimensionalRepresentation2D*>(\n            biDimensionalWidget->GetRepresentation());\n\n    double p1[3];\n    representation->GetPoint1DisplayPosition(p1);\n    double p2[3];\n    representation->GetPoint1DisplayPosition(p2);\n    double p3[3];\n    representation->GetPoint1DisplayPosition(p3);\n    double p4[3];\n    representation->GetPoint1DisplayPosition(p4);\n\n    // Display one of the points, just so we know it's working\n    std::cout << \"P1: \" << p1[0] << \" \" << p1[1] << \" \" << p1[2] << std::endl;\n  }\n  vtkBiDimensionalCallback()\n  {\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"DarkOliveGreen\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BiDimensionalWidget\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkBiDimensionalWidget> biDimensionalWidget;\n  biDimensionalWidget->SetInteractor(renderWindowInteractor);\n  biDimensionalWidget->CreateDefaultRepresentation();\n\n  vtkNew<vtkBiDimensionalCallback> biDimensionalCallback;\n\n  biDimensionalWidget->AddObserver(vtkCommand::InteractionEvent,\n                                   biDimensionalCallback);\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  biDimensionalWidget->On();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/BiDimensionalWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BiDimensionalWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BiDimensionalWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BiDimensionalWidget MACOSX_BUNDLE BiDimensionalWidget.cxx )\n  target_link_libraries(BiDimensionalWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BiDimensionalWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/BiDimensionalWidget/#download-and-build-bidimensionalwidget","title":"Download and Build BiDimensionalWidget","text":"

Click here to download BiDimensionalWidget and its CMakeLists.txt file. Once the tarball BiDimensionalWidget.tar has been downloaded and extracted,

cd BiDimensionalWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BiDimensionalWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/BorderWidget/","title":"BorderWidget","text":"

vtk-examples/Cxx/Widgets/BorderWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/BorderWidget/#description","title":"Description","text":"

This example draws a border around a region selected with the mouse. Note that the default border color is white - so if you have a white background you will not see anything!

Also see the BorderWidgetQt example.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/BorderWidget/#code","title":"Code","text":"

BorderWidget.cxx

#include <vtkActor.h>\n#include <vtkBorderRepresentation.h>\n#include <vtkBorderWidget.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkWidgetCallbackMapper.h>\n#include <vtkWidgetEvent.h>\n\nnamespace {\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n\nclass vtkCustomBorderWidget : public vtkBorderWidget\n{\npublic:\n  static vtkCustomBorderWidget* New();\n  vtkTypeMacro(vtkCustomBorderWidget, vtkBorderWidget);\n\n  static void EndSelectAction(vtkAbstractWidget* w);\n\n  vtkCustomBorderWidget();\n};\n\nvtkStandardNewMacro(vtkCustomBorderWidget);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto lut = GetPlatonicLUT();\n\n  vtkNew<vtkPlatonicSolidSource> source;\n  source->SetSolidTypeToDodecahedron();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, 19);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  // actor->GetProperty()->SetColor(\n  //     colors->GetColor3d(\"DarkOliveGreen\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderer->GetActiveCamera()->Elevation(30.0);\n  renderer->GetActiveCamera()->Azimuth(180.0);\n  renderWindow->SetWindowName(\"BorderWidget\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCustomBorderWidget> borderWidget;\n  borderWidget->SetInteractor(renderWindowInteractor);\n  borderWidget->CreateDefaultRepresentation();\n  borderWidget->SelectableOff();\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindowInteractor->Initialize();\n  renderer->ResetCamera();\n  renderWindow->Render();\n  borderWidget->On();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\nvtkCustomBorderWidget::vtkCustomBorderWidget()\n{\n  this->CallbackMapper->SetCallbackMethod(\n      vtkCommand::MiddleButtonReleaseEvent, vtkWidgetEvent::EndSelect, this,\n      vtkCustomBorderWidget::EndSelectAction);\n}\n\nvoid vtkCustomBorderWidget::EndSelectAction(vtkAbstractWidget* w)\n{\n  vtkBorderWidget* borderWidget = dynamic_cast<vtkBorderWidget*>(w);\n\n  // Get the actual box coordinates/planes.\n  // vtkNew<vtkPolyData> polydata;\n\n  // Get the bottom left corner.\n  auto lowerLeft =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPosition();\n  std::cout << \"Lower left: \" << lowerLeft[0] << \" \" << lowerLeft[1]\n            << std::endl;\n\n  auto upperRight =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPosition2();\n  std::cout << \"Upper right: \" << lowerLeft[0] + upperRight[0] << \" \"\n            << lowerLeft[1] + upperRight[1] << std::endl;\n\n  vtkBorderWidget::EndSelectAction(w);\n}\n\n} // namespace\n
"},{"location":"Cxx/Widgets/BorderWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BorderWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BorderWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BorderWidget MACOSX_BUNDLE BorderWidget.cxx )\n  target_link_libraries(BorderWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BorderWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/BorderWidget/#download-and-build-borderwidget","title":"Download and Build BorderWidget","text":"

Click here to download BorderWidget and its CMakeLists.txt file. Once the tarball BorderWidget.tar has been downloaded and extracted,

cd BorderWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BorderWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/BoxWidget/","title":"BoxWidget","text":"

vtk-examples/Cxx/Widgets/BoxWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/BoxWidget/#description","title":"Description","text":"

This example uses a vtkBoxWidget to manipulate an actor. The class includes geometry to draw a box around the object, which is bound to it via SetProp3D. The box is dimensioned using the SetPlaceFactor method, and positioned with the PlaceWidget method. After the initial setup, synchronizing the box with the object is done through a custom callback class, which is passed to the box widget through the AddObserver method.

For a widget that isn't tied to a specific vtkProp3D and has its geometric representation separate from the interaction logic, see the example BoxWidget2.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/BoxWidget/#code","title":"Code","text":"

BoxWidget.cxx

#include <vtkActor.h>\n#include <vtkBoxWidget.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nnamespace {\nclass vtkMyCallback : public vtkCommand\n{\npublic:\n  static vtkMyCallback* New()\n  {\n    return new vtkMyCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    // Here we use the vtkBoxWidget to transform the underlying coneActor\n    // (by manipulating its transformation matrix).\n    vtkNew<vtkTransform> t;\n    vtkBoxWidget* widget = reinterpret_cast<vtkBoxWidget*>(caller);\n    widget->GetTransform(t);\n    widget->GetProp3D()->SetUserTransform(t);\n  }\n};\n} // namespace\n\nint main(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> cone;\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(coneActor);\n  renderer->SetBackground(colors->GetColor3d(\"Blue\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetSize(300, 300);\n  window->SetWindowName(\"BoxWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  vtkNew<vtkBoxWidget> boxWidget;\n  boxWidget->SetInteractor(interactor);\n\n  boxWidget->SetProp3D(coneActor);\n  boxWidget->SetPlaceFactor(1.25); // Make the box 1.25x larger than the actor\n  boxWidget->PlaceWidget();\n\n  vtkNew<vtkMyCallback> callback;\n  boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  boxWidget->On();\n\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/BoxWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoxWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoxWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoxWidget MACOSX_BUNDLE BoxWidget.cxx )\n  target_link_libraries(BoxWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoxWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/BoxWidget/#download-and-build-boxwidget","title":"Download and Build BoxWidget","text":"

Click here to download BoxWidget and its CMakeLists.txt file. Once the tarball BoxWidget.tar has been downloaded and extracted,

cd BoxWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BoxWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/BoxWidget2/","title":"BoxWidget2","text":"

vtk-examples/Cxx/Widgets/BoxWidget2

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/BoxWidget2/#description","title":"Description","text":"

This example uses a [vtkBoxWidget](https://www.vtk.org/doc/nightly/html/classvtkBoxWidget.html#details)2 to manipulate an actor. The widget only contains the interaction logic; the actual box is drawn by the accompanying vtkBoxRepresentation. Contrary to the older vtkBoxWidget, this widget doesn't provide functionality to assign it to one or more actors, so that has to be implemented manually. The box is dimensioned and positioned by passing a bounding box to PlaceWidget method, with the SetPlaceFactor method providing a scaling factor in relation to that bounding box. The transformations applied to the box can be used to manipulate any number of object(s), via a custom callback class, which is passed to the box widget through the AddObserver method.

The older implementation vtkBoxWidget provides functionality to receive a vtkProp3D for the initial positioning and sizing, but the transformation synchronization still needs to be done manually. See BoxWidget for a simple example of how to use it.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/BoxWidget2/#code","title":"Code","text":"

BoxWidget2.cxx

#include <vtkActor.h>\n#include <vtkBoxRepresentation.h>\n#include <vtkBoxWidget2.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nnamespace {\nclass vtkBoxCallback : public vtkCommand\n{\npublic:\n  static vtkBoxCallback* New()\n  {\n    return new vtkBoxCallback;\n  }\n\n  vtkSmartPointer<vtkActor> m_actor;\n\n  void SetActor(vtkSmartPointer<vtkActor> actor)\n  {\n    m_actor = actor;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSmartPointer<vtkBoxWidget2> boxWidget =\n        dynamic_cast<vtkBoxWidget2*>(caller);\n\n    vtkNew<vtkTransform> t;\n\n    dynamic_cast<vtkBoxRepresentation*>(boxWidget->GetRepresentation())\n        ->GetTransform(t);\n    this->m_actor->SetUserTransform(t);\n  }\n\n  vtkBoxCallback()\n  {\n  }\n};\n} // namespace\n\nint main(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetHeight(1.5);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Blue\").GetData());\n  renderer->ResetCamera(); // Reposition camera so the whole scene is visible\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BoxWidget2\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Use the \"trackball camera\" interactor style, rather than the default\n  // \"joystick camera\"\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkBoxWidget2> boxWidget;\n  boxWidget->SetInteractor(renderWindowInteractor);\n  boxWidget->GetRepresentation()->SetPlaceFactor(1); // Default is 0.5\n  boxWidget->GetRepresentation()->PlaceWidget(actor->GetBounds());\n\n  // Set up a callback for the interactor to call so we can manipulate the actor\n  vtkNew<vtkBoxCallback> boxCallback;\n  boxCallback->SetActor(actor);\n  boxWidget->AddObserver(vtkCommand::InteractionEvent, boxCallback);\n\n  boxWidget->On();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/BoxWidget2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoxWidget2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoxWidget2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoxWidget2 MACOSX_BUNDLE BoxWidget2.cxx )\n  target_link_libraries(BoxWidget2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoxWidget2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/BoxWidget2/#download-and-build-boxwidget2","title":"Download and Build BoxWidget2","text":"

Click here to download BoxWidget2 and its CMakeLists.txt file. Once the tarball BoxWidget2.tar has been downloaded and extracted,

cd BoxWidget2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./BoxWidget2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/CameraOrientationWidget/","title":"CameraOrientationWidget","text":"

vtk-examples/Cxx/Widgets/CameraOrientationWidget

"},{"location":"Cxx/Widgets/CameraOrientationWidget/#description","title":"Description","text":"

This example demonstrates a 3D camera orientation gizmo.

The widget representation has shafts and little spheres with text on them. The spheres always follow the camera.

The widget representation's orientation is synchronized with the camera of the parent renderer.

To look down on any particular axis, simply click on a handle.

To rotate the camera and get a feel of the camera orientation, either move mouse in the renderer or click on a handle and move it around.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/CameraOrientationWidget/#code","title":"Code","text":"

CameraOrientationWidget.cxx

#include <vtkActor.h>\n#include <vtkCameraOrientationWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Demonstrates a 3D camera orientation widget.\" << std::endl;\n    std::cout << \"Usage: \" << argv[0] << \" fileName\" << std::endl;\n    std::cout << \"where: fileName is cow.vtp.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string fileName(argv[1]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iRen;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(fileName.c_str());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n  actor->SetMapper(mapper);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"CameraOrientationWidget\");\n\n  // Important: The interactor must be set prior to enabling the widget.\n  iRen->SetRenderWindow(renWin);\n\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(renderer);\n  // Enable the widget.\n  camOrientManipulator->On();\n\n  renWin->Render();\n  iRen->Initialize();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/CameraOrientationWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraOrientationWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraOrientationWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraOrientationWidget MACOSX_BUNDLE CameraOrientationWidget.cxx )\n  target_link_libraries(CameraOrientationWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraOrientationWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/CameraOrientationWidget/#download-and-build-cameraorientationwidget","title":"Download and Build CameraOrientationWidget","text":"

Click here to download CameraOrientationWidget and its CMakeLists.txt file. Once the tarball CameraOrientationWidget.tar has been downloaded and extracted,

cd CameraOrientationWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CameraOrientationWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/CaptionWidget/","title":"CaptionWidget","text":"

vtk-examples/Cxx/Widgets/CaptionWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/CaptionWidget/#code","title":"Code","text":"

CaptionWidget.cxx

#include <vtkActor.h>\n// #include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkCaptionRepresentation.h>\n#include <vtkCaptionWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n// #include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"DarkOliveGreen\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CaptionWidget\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create the widget and its representation.\n  vtkNew<vtkCaptionRepresentation> captionRepresentation;\n  captionRepresentation->GetCaptionActor2D()->SetCaption(\"Test caption\");\n  captionRepresentation->GetCaptionActor2D()\n      ->GetTextActor()\n      ->GetTextProperty()\n      ->SetFontSize(100);\n\n  double pos[3] = {.5, 0, 0};\n  captionRepresentation->SetAnchorPosition(pos);\n\n  vtkNew<vtkCaptionWidget> captionWidget;\n  captionWidget->SetInteractor(renderWindowInteractor);\n  captionWidget->SetRepresentation(captionRepresentation);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Blue\").GetData());\n\n  renderWindow->Render();\n\n  // Rotate the camera to bring the point the caption is pointing to into view.\n  renderer->GetActiveCamera()->Azimuth(90);\n\n  captionWidget->On();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/CaptionWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CaptionWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CaptionWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CaptionWidget MACOSX_BUNDLE CaptionWidget.cxx )\n  target_link_libraries(CaptionWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CaptionWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/CaptionWidget/#download-and-build-captionwidget","title":"Download and Build CaptionWidget","text":"

Click here to download CaptionWidget and its CMakeLists.txt file. Once the tarball CaptionWidget.tar has been downloaded and extracted,

cd CaptionWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CaptionWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/CheckerboardWidget/","title":"CheckerboardWidget","text":"

vtk-examples/Cxx/Widgets/CheckerboardWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/CheckerboardWidget/#description","title":"Description","text":"

Compare two images with a checkerboard. The widget permits interactive control of the number of checkers in the x/y directions. Checkerboards are often used to compare the results of image registration. For an alternative image comparison widget try the RectilinearWipeWidget.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/CheckerboardWidget/#code","title":"Code","text":"

CheckerboardWidget.cxx

#include <vtkCheckerboardRepresentation.h>\n#include <vtkCheckerboardWidget.h>\n#include <vtkImageActor.h>\n#include <vtkImageCheckerboard.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input1Filename Input2Filename e.g. Gourds2.jpg, Ox.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the images.\n  vtkNew<vtkJPEGReader> reader1;\n  reader1->SetFileName(argv[1]);\n\n  vtkNew<vtkJPEGReader> reader2;\n  reader2->SetFileName(argv[2]);\n\n  // Create a checker pipeline.\n  vtkNew<vtkImageCheckerboard> checker;\n  checker->SetInputConnection(0, reader1->GetOutputPort());\n  checker->SetInputConnection(1, reader2->GetOutputPort());\n  checker->SetNumberOfDivisions(3, 3, 1);\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"CheckerboardWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkImageActor> checkerActor;\n  checkerActor->GetMapper()->SetInputConnection(checker->GetOutputPort());\n\n  // VTK widgets consist of two parts: the widget part that handles\n  // event processing; and the widget representation that defines how\n  // the widget appears in the scene,\n  // (i.e., matters pertaining to geometry).\n  vtkNew<vtkCheckerboardWidget> checkerWidget;\n  checkerWidget->SetInteractor(iren);\n\n  vtkCheckerboardRepresentation* checkerWidgetRep =\n      static_cast<vtkCheckerboardRepresentation*>(\n          checkerWidget->GetRepresentation());\n\n  checkerWidgetRep->SetImageActor(checkerActor);\n  checkerWidgetRep->SetCheckerboard(checker);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(checkerActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(300, 300);\n\n  // Render the image.\n  //\n  iren->Initialize();\n  renWin->Render();\n  checkerWidget->On();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/CheckerboardWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CheckerboardWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingGeneral\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CheckerboardWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CheckerboardWidget MACOSX_BUNDLE CheckerboardWidget.cxx )\n  target_link_libraries(CheckerboardWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CheckerboardWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/CheckerboardWidget/#download-and-build-checkerboardwidget","title":"Download and Build CheckerboardWidget","text":"

Click here to download CheckerboardWidget and its CMakeLists.txt file. Once the tarball CheckerboardWidget.tar has been downloaded and extracted,

cd CheckerboardWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CheckerboardWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/CompassWidget/","title":"CompassWidget","text":"

vtk-examples/Cxx/Widgets/CompassWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/CompassWidget/#description","title":"Description","text":"

This example creates a compass widget in the top right corner of the window. The widget can be used to modify the camera position via its distance and tilt sliders and its heading compass wheel.

Note for this example to work correctly VTK with version >= 9.2.20220831 is required.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/CompassWidget/#code","title":"Code","text":"

CompassWidget.cxx

#include <vtkAnnotatedCubeActor.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkCompassRepresentation.h>\n#include <vtkCompassWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#if VTK_VERSION_NUMBER >= 90220220831ULL\n#define VTK_HAS_IMPROVED_COMPASSWIDGETREPRESENTATION 1\n#endif\n\nclass vtkICWValueChangedCallback : public vtkCommand\n{\npublic:\n  static vtkICWValueChangedCallback* New()\n  {\n    return new vtkICWValueChangedCallback();\n  }\n  virtual void Execute(vtkObject* caller, unsigned long vtkNotUsed(eventId),\n                       void* vtkNotUsed(callData))\n  {\n    vtkCompassWidget* widget = vtkCompassWidget::SafeDownCast(caller);\n    vtkCamera* camera = widget->GetCurrentRenderer()->GetActiveCamera();\n\n    // calculate new camera position from compass widget parameters\n    double distance = widget->GetDistance();\n    double tilt = widget->GetTilt();\n    double heading = widget->GetHeading();\n\n    double pos[3] = {0, 0, 0};\n    pos[0] = distance * cos(vtkMath::RadiansFromDegrees(heading)) *\n        cos(vtkMath::RadiansFromDegrees(tilt));\n    pos[1] = distance * sin(vtkMath::RadiansFromDegrees(heading)) *\n        cos(vtkMath::RadiansFromDegrees(tilt));\n    pos[2] = distance * sin(vtkMath::RadiansFromDegrees(tilt));\n\n    camera->SetPosition(pos);\n    camera->SetFocalPoint(0, 0, 0);\n    camera->SetViewUp(0, 0, 1);\n    camera->SetClippingRange(0.1, distance + 1);\n\n    widget->GetCurrentRenderer()->Render();\n  }\n  vtkICWValueChangedCallback()\n  {\n  }\n};\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // a cube with text on its faces\n  vtkNew<vtkAnnotatedCubeActor> actor;\n  actor->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"Black\").GetData());\n  actor->GetCubeProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // create the widget and its representation\n  vtkNew<vtkCompassRepresentation> compassRepresentation;\n#ifdef VTK_HAS_IMPROVED_COMPASSWIDGETREPRESENTATION\n  compassRepresentation->SetMinimumDistance(2);\n  compassRepresentation->SetMaximumDistance(10);\n#endif\n\n  vtkNew<vtkCompassWidget> compassWidget;\n  compassWidget->SetInteractor(renderWindowInteractor);\n  compassWidget->SetRepresentation(compassRepresentation);\n  compassWidget->SetDistance(5.0);\n\n  // create the callback\n  vtkNew<vtkICWValueChangedCallback> valueChangedCallback;\n  compassWidget->AddObserver(vtkCommand::WidgetValueChangedEvent,\n                             valueChangedCallback);\n\n  // add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"CompassWidget\");\n\n  renderWindow->Render();\n  compassWidget->EnabledOn();\n\n  // no interactor style - camera is moved by widget callback\n  renderWindowInteractor->SetInteractorStyle(nullptr);\n\n  // set camera to initial position\n  compassWidget->InvokeEvent(vtkCommand::WidgetValueChangedEvent);\n\n  // begin interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/CompassWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CompassWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CompassWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CompassWidget MACOSX_BUNDLE CompassWidget.cxx )\n  target_link_libraries(CompassWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CompassWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/CompassWidget/#download-and-build-compasswidget","title":"Download and Build CompassWidget","text":"

Click here to download CompassWidget and its CMakeLists.txt file. Once the tarball CompassWidget.tar has been downloaded and extracted,

cd CompassWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./CompassWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/ContourWidget/","title":"ContourWidget","text":"

vtk-examples/Cxx/Widgets/ContourWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/ContourWidget/#description","title":"Description","text":"

This example generates a set of points which lie on a circle, and the contour through these points. This contour can be interactively warped/modified by dragging the control points.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/ContourWidget/#code","title":"Code","text":"

ContourWidget.cxx

#include <vtkCellArray.h>\n#include <vtkContourWidget.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientedGlyphContourRepresentation.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the contour widget\n  vtkNew<vtkContourWidget> contourWidget;\n\n  // Override the default representation for the contour widget to customize its\n  // look\n  vtkNew<vtkOrientedGlyphContourRepresentation> contourRepresentation;\n  contourRepresentation->GetLinesProperty()->SetColor(\n      colors->GetColor3d(\"Red\").GetData());\n  contourWidget->SetRepresentation(contourRepresentation);\n\n  // Generate a set of points arranged in a circle\n  int numPts = 10;\n  vtkNew<vtkPoints> points;\n  for (int i = 0; i < numPts; i++)\n  {\n    // Create numPts points evenly spread around a circumference of radius 0.1\n    const double angle = 2.0 * vtkMath::Pi() * i / numPts;\n    points->InsertPoint(static_cast<vtkIdType>(i), 0.1 * cos(angle),\n                        0.1 * sin(angle), 0.0);\n  }\n\n  // Create a cell array to connect the points into meaningful geometry\n  vtkIdType* vertexIndices = new vtkIdType[numPts + 1];\n  for (int i = 0; i < numPts; i++)\n  {\n    vertexIndices[i] = static_cast<vtkIdType>(i);\n  }\n  // Set the last vertex to 0; this means the last line segment will join the\n  // 19th point (vertices[19]) with the first one (vertices[0]), thus closing\n  // the circle.\n  vertexIndices[numPts] = 0;\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(numPts + 1, vertexIndices);\n\n  // Create polydata to hold the geometry just created, and populate it\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetLines(lines);\n\n  // Create the renderer to visualize the scene\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Create the GUI window to hold the rendered scene\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ContourWidget\");\n  renderWindow->SetSize(600, 600);\n\n  // Create the events manager for the renderer window\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Use the \"trackball camera\" interactor style, rather than the default\n  // \"joystick camera\"\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  // Set up the contour widget within the visualization pipeline just assembled\n  contourWidget->SetInteractor(interactor);\n  contourWidget->On(); // Turn on the interactor observer\n  contourWidget->Initialize(polydata);\n  renderer->ResetCamera(); // Reposition camera to fit the scene elements\n\n  // Start the interaction\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/ContourWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ContourWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ContourWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ContourWidget MACOSX_BUNDLE ContourWidget.cxx )\n  target_link_libraries(ContourWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ContourWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/ContourWidget/#download-and-build-contourwidget","title":"Download and Build ContourWidget","text":"

Click here to download ContourWidget and its CMakeLists.txt file. Once the tarball ContourWidget.tar has been downloaded and extracted,

cd ContourWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ContourWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/DistanceWidget/","title":"DistanceWidget","text":"

vtk-examples/Cxx/Widgets/DistanceWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/DistanceWidget/#description","title":"Description","text":"
  • Contributed by Arnaud Gelas

Click two points to see the distance between them.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/DistanceWidget/#code","title":"Code","text":"

DistanceWidget.cxx

#include <vtkDistanceRepresentation.h>\n#include <vtkDistanceWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DistanceWidget\");\n\n  renderer->SetBackground(colors->GetColor3d(\"Navy\").GetData());\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkDistanceWidget> distanceWidget;\n  distanceWidget->SetInteractor(renderWindowInteractor);\n  distanceWidget->CreateDefaultRepresentation();\n  static_cast<vtkDistanceRepresentation*>(distanceWidget->GetRepresentation())\n      ->SetLabelFormat(\"%-#6.3g mm\");\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  distanceWidget->On();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/DistanceWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DistanceWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DistanceWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DistanceWidget MACOSX_BUNDLE DistanceWidget.cxx )\n  target_link_libraries(DistanceWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DistanceWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/DistanceWidget/#download-and-build-distancewidget","title":"Download and Build DistanceWidget","text":"

Click here to download DistanceWidget and its CMakeLists.txt file. Once the tarball DistanceWidget.tar has been downloaded and extracted,

cd DistanceWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./DistanceWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/HoverWidget/","title":"HoverWidget","text":"

vtk-examples/Cxx/Widgets/HoverWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/HoverWidget/#code","title":"Code","text":"

HoverWidget.cxx

#include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkHoverWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass vtkHoverCallback : public vtkCommand\n{\npublic:\n  static vtkHoverCallback* New()\n  {\n    return new vtkHoverCallback;\n  }\n\n  vtkHoverCallback()\n  {\n  }\n\n  virtual void Execute(vtkObject*, unsigned long event,\n                       void* vtkNotUsed(calldata))\n  {\n    switch (event)\n    {\n    case vtkCommand::TimerEvent:\n      std::cout\n          << \"TimerEvent -> the mouse stopped moving and the widget hovered\"\n          << std::endl;\n      break;\n    case vtkCommand::EndInteractionEvent:\n      std::cout << \"EndInteractionEvent -> the mouse started to move\"\n                << std::endl;\n      break;\n    }\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HoverWidget\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create the widget\n  vtkNew<vtkHoverWidget> hoverWidget;\n  hoverWidget->SetInteractor(renderWindowInteractor);\n  hoverWidget->SetTimerDuration(1000);\n\n  // Create a callback to listen to the widget's two VTK events\n  vtkNew<vtkHoverCallback> hoverCallback;\n  hoverWidget->AddObserver(vtkCommand::TimerEvent, hoverCallback);\n  hoverWidget->AddObserver(vtkCommand::EndInteractionEvent, hoverCallback);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  hoverWidget->On();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/HoverWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HoverWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HoverWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HoverWidget MACOSX_BUNDLE HoverWidget.cxx )\n  target_link_libraries(HoverWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HoverWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/HoverWidget/#download-and-build-hoverwidget","title":"Download and Build HoverWidget","text":"

Click here to download HoverWidget and its CMakeLists.txt file. Once the tarball HoverWidget.tar has been downloaded and extracted,

cd HoverWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./HoverWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/ImagePlaneWidget/","title":"ImagePlaneWidget","text":"

vtk-examples/Cxx/Widgets/ImagePlaneWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/ImagePlaneWidget/#code","title":"Code","text":"

ImagePlaneWidget.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImagePlaneWidget.h>\n// #include <vtkInteractorStyleTrackballActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImagePlaneWidget\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // vtkNew<vtkInteractorStyleTrackballActor> style;\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkImagePlaneWidget> planeWidget;\n  planeWidget->SetInteractor(renderWindowInteractor);\n  planeWidget->TextureVisibilityOff();\n\n  double origin[3] = {0, 1, 0};\n  planeWidget->SetOrigin(origin);\n  planeWidget->UpdatePlacement();\n\n  // Render\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Azimuth(-45);\n  renderer->GetActiveCamera()->Zoom(0.85);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  planeWidget->On();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/ImagePlaneWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImagePlaneWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImagePlaneWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImagePlaneWidget MACOSX_BUNDLE ImagePlaneWidget.cxx )\n  target_link_libraries(ImagePlaneWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImagePlaneWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/ImagePlaneWidget/#download-and-build-imageplanewidget","title":"Download and Build ImagePlaneWidget","text":"

Click here to download ImagePlaneWidget and its CMakeLists.txt file. Once the tarball ImagePlaneWidget.tar has been downloaded and extracted,

cd ImagePlaneWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImagePlaneWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/ImageTracerWidget/","title":"ImageTracerWidget","text":"

vtk-examples/Cxx/Widgets/ImageTracerWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/ImageTracerWidget/#code","title":"Code","text":"

ImageTracerWidget.cxx

#include <vtkCallbackCommand.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageTracerWidget.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid CallbackFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"SlateGray\").GetData();\n  auto color2 = colors->GetColor3ub(\"Tomato\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetExtent(0, 20, 0, 50, 0, 0);\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(0, 20, 0, 50);\n  imageSource->SetDrawColor(drawColor2.data());\n  imageSource->FillBox(0, 10, 0, 30);\n  imageSource->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderer->ResetCamera();\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageTracerWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  vtkNew<vtkImageTracerWidget> tracer;\n  tracer->GetLineProperty()->SetLineWidth(5);\n  tracer->SetInteractor(interactor);\n  tracer->SetViewProp(actor);\n  renderWindow->Render();\n\n  // The observer must be added BEFORE the On() call.\n  vtkNew<vtkCallbackCommand> callback;\n  callback->SetCallback(CallbackFunction);\n  tracer->AddObserver(vtkCommand::EndInteractionEvent, callback);\n\n  tracer->On();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CallbackFunction(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                      void* vtkNotUsed(clientData), void* vtkNotUsed(callData))\n{\n  vtkImageTracerWidget* tracerWidget =\n      static_cast<vtkImageTracerWidget*>(caller);\n\n  vtkNew<vtkPolyData> path;\n\n  tracerWidget->GetPath(path);\n  std::cout << \"There are \" << path->GetNumberOfPoints()\n            << \" points in the path.\" << std::endl;\n}\n} // end anonymous namespace\n
"},{"location":"Cxx/Widgets/ImageTracerWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageTracerWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageTracerWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageTracerWidget MACOSX_BUNDLE ImageTracerWidget.cxx )\n  target_link_libraries(ImageTracerWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageTracerWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/ImageTracerWidget/#download-and-build-imagetracerwidget","title":"Download and Build ImageTracerWidget","text":"

Click here to download ImageTracerWidget and its CMakeLists.txt file. Once the tarball ImageTracerWidget.tar has been downloaded and extracted,

cd ImageTracerWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageTracerWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/ImageTracerWidgetInsideContour/","title":"ImageTracerWidgetInsideContour","text":"

vtk-examples/Cxx/Widgets/ImageTracerWidgetInsideContour

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/ImageTracerWidgetInsideContour/#code","title":"Code","text":"

ImageTracerWidgetInsideContour.cxx

#include <vtkCallbackCommand.h>\n#include <vtkImageAccumulate.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageStencilToImage.h>\n#include <vtkImageTracerWidget.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataToImageStencil.h>\n#include <vtkPolygon.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid CallbackFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\nvoid CreateImage1(vtkImageData*);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> image;\n  CreateImage1(image);\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputData(image);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderer->ResetCamera();\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageTracerWidgetInsideContour\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  vtkNew<vtkImageTracerWidget> tracer;\n  tracer->GetLineProperty()->SetLineWidth(5);\n  tracer->SetInteractor(interactor);\n  tracer->SetViewProp(actor);\n  tracer->AutoCloseOn();\n  renderWindow->Render();\n\n  // The observer must be added BEFORE the On() call.\n  vtkNew<vtkCallbackCommand> callback;\n  callback->SetCallback(CallbackFunction);\n  callback->SetClientData(image);\n  tracer->AddObserver(vtkCommand::EndInteractionEvent, callback);\n\n  tracer->On();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CallbackFunction(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                      void* clientData, void* vtkNotUsed(callData))\n{\n  vtkImageTracerWidget* tracerWidget =\n      static_cast<vtkImageTracerWidget*>(caller);\n\n  vtkNew<vtkPolyData> path;\n\n  if (!tracerWidget->IsClosed())\n  {\n    std::cout << \"Path not closed!\" << std::endl;\n    return;\n  }\n\n  tracerWidget->GetPath(path);\n  std::cout << \"There are \" << path->GetNumberOfPoints()\n            << \" points in the path.\" << std::endl;\n\n  vtkImageData* image = static_cast<vtkImageData*>(clientData);\n\n  vtkNew<vtkPolyDataToImageStencil> polyDataToImageStencil;\n  polyDataToImageStencil->SetTolerance(0);\n  polyDataToImageStencil->SetInputData(path);\n  polyDataToImageStencil->SetOutputOrigin(image->GetOrigin());\n  polyDataToImageStencil->SetOutputSpacing(image->GetSpacing());\n  polyDataToImageStencil->SetOutputWholeExtent(image->GetExtent());\n  polyDataToImageStencil->Update();\n\n  vtkNew<vtkImageStencilToImage> imageStencilToImage;\n  imageStencilToImage->SetInputConnection(\n      polyDataToImageStencil->GetOutputPort());\n  imageStencilToImage->SetInsideValue(255);\n  imageStencilToImage->Update();\n\n  vtkNew<vtkImageAccumulate> imageAccumulate;\n  imageAccumulate->SetStencilData(polyDataToImageStencil->GetOutput());\n  imageAccumulate->SetInputData(image);\n  imageAccumulate->Update();\n  std::cout << \"Voxel count: \" << imageAccumulate->GetVoxelCount() << std::endl;\n\n  // vtkNew<vtkPNGWriter> writer;\n  // writer->SetFileName(\"selection.png\");\n  // writer->SetInputConnection(imageStencilToImage->GetOutputPort());\n  // writer->Write();\n}\n\nvoid CreateImage1(vtkImageData* image)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"DarkGray\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetNumberOfScalarComponents(1);\n  imageSource->SetExtent(0, 20, 0, 50, 0, 0);\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(0, 20, 0, 50);\n  imageSource->Update();\n\n  image->ShallowCopy(imageSource->GetOutput());\n}\n} // end anonymous namespace\n
"},{"location":"Cxx/Widgets/ImageTracerWidgetInsideContour/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageTracerWidgetInsideContour)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingSources\n  ImagingStatistics\n  ImagingStencil\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageTracerWidgetInsideContour: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageTracerWidgetInsideContour MACOSX_BUNDLE ImageTracerWidgetInsideContour.cxx )\n  target_link_libraries(ImageTracerWidgetInsideContour PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageTracerWidgetInsideContour\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/ImageTracerWidgetInsideContour/#download-and-build-imagetracerwidgetinsidecontour","title":"Download and Build ImageTracerWidgetInsideContour","text":"

Click here to download ImageTracerWidgetInsideContour and its CMakeLists.txt file. Once the tarball ImageTracerWidgetInsideContour.tar has been downloaded and extracted,

cd ImageTracerWidgetInsideContour/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageTracerWidgetInsideContour\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/ImageTracerWidgetNonPlanar/","title":"ImageTracerWidgetNonPlanar","text":"

vtk-examples/Cxx/Widgets/ImageTracerWidgetNonPlanar

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/ImageTracerWidgetNonPlanar/#code","title":"Code","text":"

ImageTracerWidgetNonPlanar.cxx

#include <vtkActor.h>\n#include <vtkImageTracerWidget.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageTracerWidgetNonPlanar\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkImageTracerWidget> tracerWidget;\n  tracerWidget->SetInteractor(renderWindowInteractor);\n  tracerWidget->SetViewProp(actor);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  tracerWidget->On();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/ImageTracerWidgetNonPlanar/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageTracerWidgetNonPlanar)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageTracerWidgetNonPlanar: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageTracerWidgetNonPlanar MACOSX_BUNDLE ImageTracerWidgetNonPlanar.cxx )\n  target_link_libraries(ImageTracerWidgetNonPlanar PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageTracerWidgetNonPlanar\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/ImageTracerWidgetNonPlanar/#download-and-build-imagetracerwidgetnonplanar","title":"Download and Build ImageTracerWidgetNonPlanar","text":"

Click here to download ImageTracerWidgetNonPlanar and its CMakeLists.txt file. Once the tarball ImageTracerWidgetNonPlanar.tar has been downloaded and extracted,

cd ImageTracerWidgetNonPlanar/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImageTracerWidgetNonPlanar\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/ImplicitPlaneWidget2/","title":"ImplicitPlaneWidget2","text":"

vtk-examples/Cxx/Widgets/ImplicitPlaneWidget2

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/ImplicitPlaneWidget2/#description","title":"Description","text":"

This example shows how to use the second generation ImplicitPlaneWidget2 to interactively define the clipping plane for a polydata. If no arguments are specified, a vtkSphereSource generates the polydata. By specifying a .vtp file, the example can operate on arbitrary polydata.

For example, try VTKData/Data/cow.vtp.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/ImplicitPlaneWidget2/#code","title":"Code","text":"

ImplicitPlaneWidget2.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkCommand.h>\n#include <vtkImplicitPlaneRepresentation.h>\n#include <vtkImplicitPlaneWidget2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\n// Callback for the interaction\n// This does the actual work: updates the vtkPlane implicit function.\n// This in turn causes the pipeline to update and clip the object.\nclass vtkIPWCallback : public vtkCommand\n{\npublic:\n  static vtkIPWCallback* New()\n  {\n    return new vtkIPWCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkImplicitPlaneWidget2* planeWidget =\n        reinterpret_cast<vtkImplicitPlaneWidget2*>(caller);\n    vtkImplicitPlaneRepresentation* rep =\n        reinterpret_cast<vtkImplicitPlaneRepresentation*>(\n            planeWidget->GetRepresentation());\n    rep->GetPlane(this->plane);\n  }\n\n  vtkIPWCallback() = default;\n\n  vtkPlane* plane{nullptr};\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(10.0);\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n\n  // Setup a visualization pipeline.\n  vtkNew<vtkPlane> plane;\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetClipFunction(plane);\n  clipper->InsideOutOn();\n  if (argc < 2)\n  {\n    clipper->SetInputConnection(sphereSource->GetOutputPort());\n  }\n  else\n  {\n    reader->SetFileName(argv[1]);\n    clipper->SetInputConnection(reader->GetOutputPort());\n  }\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(clipper->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkProperty> backFaces;\n  backFaces->SetDiffuseColor(colors->GetColor3d(\"Gold\").GetData());\n\n  actor->SetBackfaceProperty(backFaces);\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitPlaneWidget2\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // The callback will do the work.\n  vtkNew<vtkIPWCallback> myCallback;\n  myCallback->plane = plane;\n\n  vtkNew<vtkImplicitPlaneRepresentation> rep;\n  rep->SetPlaceFactor(1.25); // This must be set prior to placing the widget.\n  rep->PlaceWidget(actor->GetBounds());\n  rep->SetNormal(plane->GetNormal());\n\n  vtkNew<vtkImplicitPlaneWidget2> planeWidget;\n  planeWidget->SetInteractor(renderWindowInteractor);\n  planeWidget->SetRepresentation(rep);\n  planeWidget->AddObserver(vtkCommand::InteractionEvent, myCallback);\n\n  renderer->GetActiveCamera()->Azimuth(-60);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(0.75);\n\n  // Render and interact.\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  planeWidget->On();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/ImplicitPlaneWidget2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitPlaneWidget2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitPlaneWidget2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitPlaneWidget2 MACOSX_BUNDLE ImplicitPlaneWidget2.cxx )\n  target_link_libraries(ImplicitPlaneWidget2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitPlaneWidget2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/ImplicitPlaneWidget2/#download-and-build-implicitplanewidget2","title":"Download and Build ImplicitPlaneWidget2","text":"

Click here to download ImplicitPlaneWidget2 and its CMakeLists.txt file. Once the tarball ImplicitPlaneWidget2.tar has been downloaded and extracted,

cd ImplicitPlaneWidget2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ImplicitPlaneWidget2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/LineWidget2/","title":"LineWidget2","text":"

vtk-examples/Cxx/Widgets/LineWidget2

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/LineWidget2/#code","title":"Code","text":"

LineWidget2.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkLineRepresentation.h>\n#include <vtkLineWidget2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// This does the actual work.\n// Callback for the interaction\nclass vtkLineCallback : public vtkCommand\n{\npublic:\n  static vtkLineCallback* New()\n  {\n    return new vtkLineCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n\n    vtkLineWidget2* lineWidget = reinterpret_cast<vtkLineWidget2*>(caller);\n\n    // Get the actual box coordinates of the line\n    vtkNew<vtkPolyData> polydata;\n    static_cast<vtkLineRepresentation*>(lineWidget->GetRepresentation())\n        ->GetPolyData(polydata);\n\n    // Display one of the points, just so we know it's working\n    double p[3];\n    polydata->GetPoint(0, p);\n    std::cout << \"P: \" << p[0] << \" \" << p[1] << \" \" << p[2] << std::endl;\n  }\n  vtkLineCallback()\n  {\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LineWidget2\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkLineWidget2> lineWidget;\n  lineWidget->SetInteractor(renderWindowInteractor);\n  lineWidget->CreateDefaultRepresentation();\n\n  // You could do this if you want to set properties at this point:\n  // vtkNew<vtkLineRepresentation> lineRepresentation;\n  // lineWidget->SetRepresentation(lineRepresentation);\n\n  vtkNew<vtkLineCallback> lineCallback;\n\n  lineWidget->AddObserver(vtkCommand::InteractionEvent, lineCallback);\n\n  // Render\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  lineWidget->On();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/LineWidget2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LineWidget2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LineWidget2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LineWidget2 MACOSX_BUNDLE LineWidget2.cxx )\n  target_link_libraries(LineWidget2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LineWidget2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/LineWidget2/#download-and-build-linewidget2","title":"Download and Build LineWidget2","text":"

Click here to download LineWidget2 and its CMakeLists.txt file. Once the tarball LineWidget2.tar has been downloaded and extracted,

cd LineWidget2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LineWidget2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/LogoWidget/","title":"LogoWidget","text":"

vtk-examples/Cxx/Widgets/LogoWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/LogoWidget/#description","title":"Description","text":"

Turn the widget on before the render. Otherwise, it won't appear until you interact with the scene.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/LogoWidget/#code","title":"Code","text":"

LogoWidget.cxx

#include <vtkActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkLogoRepresentation.h>\n#include <vtkLogoWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n  // colors->SetColor(\"Bkg\", 0.2, 0.3, 0.4);\n\n  // A sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(4.0);\n  sphereSource->SetPhiResolution(4);\n  sphereSource->SetThetaResolution(8);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LogoWidget\");\n\n  renderer->AddActor(actor);\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 200, 0, 200, 0, 0);\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Coral\").GetData();\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color2 = colors->GetColor3ub(\"Black\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Clear the image.\n  // Note: SetDrawColour() uses double values of the rgb colors in the\n  //       range [0 ... 255]\n  //       So SetDrawColour(255, 255, 255) is white.\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(0, 200, 0, 200);\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(100, 100, 50);\n  drawing->Update();\n\n  vtkNew<vtkLogoRepresentation> logoRepresentation;\n  logoRepresentation->SetImage(drawing->GetOutput());\n  logoRepresentation->SetPosition(0, 0);\n  logoRepresentation->SetPosition2(0.4, 0.4);\n  logoRepresentation->GetImageProperty()->SetOpacity(.7);\n\n  vtkNew<vtkLogoWidget> logoWidget;\n  logoWidget->SetInteractor(renderWindowInteractor);\n  logoWidget->SetRepresentation(logoRepresentation);\n\n  renderWindow->Render();\n  logoWidget->On();\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBLue\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/LogoWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LogoWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  ImagingSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LogoWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LogoWidget MACOSX_BUNDLE LogoWidget.cxx )\n  target_link_libraries(LogoWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LogoWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/LogoWidget/#download-and-build-logowidget","title":"Download and Build LogoWidget","text":"

Click here to download LogoWidget and its CMakeLists.txt file. Once the tarball LogoWidget.tar has been downloaded and extracted,

cd LogoWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./LogoWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/OrientationMarkerWidget/","title":"OrientationMarkerWidget","text":"

vtk-examples/Cxx/Widgets/OrientationMarkerWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/OrientationMarkerWidget/#code","title":"Code","text":"

OrientationMarkerWidget.cxx

#include <vtkActor.h>\n#include <vtkAnnotatedCubeActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // create a rendering window and renderer;\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetWindowName(\"OrientationMarkerWidget\");\n\n  // create a renderwindowinteractor;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkCubeSource> cube;\n  cube->SetXLength(200);\n  cube->SetYLength(200);\n  cube->SetZLength(200);\n  cube->Update();\n  vtkNew<vtkPolyDataMapper> cm;\n  cm->SetInputConnection(cube->GetOutputPort());\n  vtkNew<vtkActor> ca;\n  ca->SetMapper(cm);\n  ca->GetProperty()->SetColor(colors->GetColor3d(\"BurlyWood\").GetData());\n  ca->GetProperty()->EdgeVisibilityOn();\n  ca->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Red\").GetData());\n\n  // assign actor to the renderer;\n  ren->AddActor(ca);\n  ren->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkAnnotatedCubeActor> axesActor;\n  axesActor->SetXPlusFaceText(\"L\");\n  axesActor->SetXMinusFaceText(\"R\");\n  axesActor->SetYMinusFaceText(\"I\");\n  axesActor->SetYPlusFaceText(\"S\");\n  axesActor->SetZMinusFaceText(\"P\");\n  axesActor->SetZPlusFaceText(\"A\");\n  axesActor->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"Yellow\").GetData());\n  axesActor->GetTextEdgesProperty()->SetLineWidth(2);\n  axesActor->GetCubeProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n  vtkNew<vtkOrientationMarkerWidget> axes;\n  axes->SetOrientationMarker(axesActor);\n  axes->SetInteractor(iren);\n  axes->EnabledOn();\n  axes->InteractiveOn();\n  ren->ResetCamera();\n\n  // enable user interface interactor;\n  iren->Initialize();\n  renWin->Render();\n  ren->GetActiveCamera()->Azimuth(45);\n  ren->GetActiveCamera()->Elevation(30);\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/OrientationMarkerWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientationMarkerWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientationMarkerWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientationMarkerWidget MACOSX_BUNDLE OrientationMarkerWidget.cxx )\n  target_link_libraries(OrientationMarkerWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientationMarkerWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/OrientationMarkerWidget/#download-and-build-orientationmarkerwidget","title":"Download and Build OrientationMarkerWidget","text":"

Click here to download OrientationMarkerWidget and its CMakeLists.txt file. Once the tarball OrientationMarkerWidget.tar has been downloaded and extracted,

cd OrientationMarkerWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OrientationMarkerWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/OrientationMarkerWidget1/","title":"OrientationMarkerWidget1","text":"

vtk-examples/Cxx/Widgets/OrientationMarkerWidget1

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/OrientationMarkerWidget1/#description","title":"Description","text":"

This example uses a polydata as an orientation icon. You can get the bunny data src/Testing/Data/Bunny.vtp.

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/OrientationMarkerWidget1/#code","title":"Code","text":"

OrientationMarkerWidget1.cxx

#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtp) e.g. Bunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the polydata for the icon\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkDataSetMapper> iconMapper;\n  iconMapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> iconActor;\n  iconActor->SetMapper(iconMapper);\n  iconActor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  // Set up the renderer, window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(400, 400);\n  renWin->SetWindowName(\"OrientationMarkerWidget1\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  double r;\n  double g;\n  double b;\n  colors->GetColor(\"Wheat\", r, g, b);\n  // Set up the widget\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  widget->SetOrientationMarker(iconActor);\n  widget->SetInteractor(iren);\n  widget->SetViewport(0.0, 0.0, 0.2, 0.2);\n  widget->SetOutlineColor(r, g, b);\n  widget->SetEnabled(1);\n  widget->InteractiveOn();\n\n  // Create a superquadric\n  vtkNew<vtkSuperquadricSource> superquadricSource;\n  superquadricSource->SetPhiRoundness(0.2);\n  superquadricSource->SetThetaRoundness(0.8);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> superquadricMapper;\n  superquadricMapper->SetInputConnection(superquadricSource->GetOutputPort());\n\n  vtkNew<vtkActor> superquadricActor;\n  superquadricActor->SetMapper(superquadricMapper);\n  superquadricActor->GetProperty()->SetInterpolationToFlat();\n  superquadricActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Carrot\").GetData());\n  superquadricActor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  superquadricActor->GetProperty()->SetDiffuse(.6);\n  superquadricActor->GetProperty()->SetSpecular(.5);\n  superquadricActor->GetProperty()->SetSpecularPower(5.0);\n\n  renderer->AddActor(superquadricActor);\n  renderer->ResetCamera();\n\n  renWin->Render();\n\n  iren->Initialize();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/OrientationMarkerWidget1/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientationMarkerWidget1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientationMarkerWidget1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientationMarkerWidget1 MACOSX_BUNDLE OrientationMarkerWidget1.cxx )\n  target_link_libraries(OrientationMarkerWidget1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientationMarkerWidget1\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/OrientationMarkerWidget1/#download-and-build-orientationmarkerwidget1","title":"Download and Build OrientationMarkerWidget1","text":"

Click here to download OrientationMarkerWidget1 and its CMakeLists.txt file. Once the tarball OrientationMarkerWidget1.tar has been downloaded and extracted,

cd OrientationMarkerWidget1/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./OrientationMarkerWidget1\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/PlaneWidget/","title":"PlaneWidget","text":"

vtk-examples/Cxx/Widgets/PlaneWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/PlaneWidget/#code","title":"Code","text":"

PlaneWidget.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneWidget.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PlaneWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPlaneWidget> planeWidget;\n  planeWidget->SetInteractor(renderWindowInteractor);\n\n  planeWidget->On();\n\n  renderWindowInteractor->Initialize();\n\n  renderer->ResetCamera();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/PlaneWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlaneWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlaneWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlaneWidget MACOSX_BUNDLE PlaneWidget.cxx )\n  target_link_libraries(PlaneWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlaneWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/PlaneWidget/#download-and-build-planewidget","title":"Download and Build PlaneWidget","text":"

Click here to download PlaneWidget and its CMakeLists.txt file. Once the tarball PlaneWidget.tar has been downloaded and extracted,

cd PlaneWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./PlaneWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/RectilinearWipeWidget/","title":"RectilinearWipeWidget","text":"

vtk-examples/Cxx/Widgets/RectilinearWipeWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/RectilinearWipeWidget/#description","title":"Description","text":"

This example illustrates the Rectilinear Wipe widget. This widget is useful for comparing two images. There are 7 different image comparison modes. A rectilinear wipe is a 2x2 checkerboard pattern created by combining two separate images, where various combinations of the checker squares are possible. Using this widget, the user can adjust the layout of the checker pattern, such as moving the center point, moving the horizontal separator, or moving the vertical separator.

Pressing keys 0-6 select the various wipe modes.

For an alternative image comparison widget try the Checkerboard widget.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/RectilinearWipeWidget/#code","title":"Code","text":"

RectilinearWipeWidget.cxx

#include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageRectilinearWipe.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRectilinearWipeRepresentation.h>\n#include <vtkRectilinearWipeWidget.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n// Define interaction style.\nclass WipeInteractorStyle : public vtkInteractorStyleImage\n{\npublic:\n  static WipeInteractorStyle* New();\n  vtkTypeMacro(WipeInteractorStyle, vtkInteractorStyleImage);\n\n  virtual void OnChar()\n  {\n    if (this->Wipe)\n    {\n      vtkRenderWindowInteractor* rwi = this->Interactor;\n      switch (rwi->GetKeyCode())\n      {\n      case '0':\n        this->Wipe->SetWipe(0);\n        break;\n      case '1':\n        this->Wipe->SetWipe(1);\n        break;\n      case '2':\n        this->Wipe->SetWipe(2);\n        break;\n      case '3':\n        this->Wipe->SetWipe(3);\n        break;\n      case '4':\n        this->Wipe->SetWipe(4);\n        break;\n      case '5':\n        this->Wipe->SetWipe(5);\n        break;\n      case '6':\n        this->Wipe->SetWipe(6);\n        break;\n      default:\n        this->Superclass::OnChar();\n        break;\n      }\n    }\n  }\n  void SetWipe(vtkImageRectilinearWipe* wipe)\n  {\n    this->Wipe = wipe;\n  }\n\nprotected:\n  WipeInteractorStyle()\n  {\n    this->Wipe = NULL;\n  }\n\nprivate:\n  vtkImageRectilinearWipe* Wipe;\n};\nvtkStandardNewMacro(WipeInteractorStyle);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input1Filename Input2Filename e.g. Gourds2.jpg Ox.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  int wipeMode = 0;\n  if (argc > 3)\n  {\n    wipeMode = atoi(argv[3]);\n  }\n  // Read the images.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader1;\n  reader1.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader1->SetFileName(argv[1]);\n\n  vtkSmartPointer<vtkImageReader2> reader2;\n  reader2.TakeReference(readerFactory->CreateImageReader2(argv[2]));\n  reader2->SetFileName(argv[2]);\n\n  // Create a wipe pipeline.\n  vtkNew<vtkImageRectilinearWipe> wipe;\n  wipe->SetInputConnection(0, reader1->GetOutputPort());\n  wipe->SetInputConnection(1, reader2->GetOutputPort());\n  wipe->SetPosition(256, 256);\n  wipe->SetWipe(wipeMode);\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"RectilinearWipeWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<WipeInteractorStyle> style;\n  iren->SetInteractorStyle(style);\n  style->SetWipe(wipe);\n\n  vtkNew<vtkImageActor> wipeActor;\n  wipeActor->GetMapper()->SetInputConnection(wipe->GetOutputPort());\n\n  // VTK widgets consist of two parts: the widget part that handles\n  // event processing; and the widget representation that defines how\n  // the widget appears in the scene,\n  // (i.e., matters pertaining to geometry).\n  vtkNew<vtkRectilinearWipeWidget> wipeWidget;\n  wipeWidget->SetInteractor(iren);\n\n  vtkRectilinearWipeRepresentation* wipeWidgetRep =\n      static_cast<vtkRectilinearWipeRepresentation*>(\n          wipeWidget->GetRepresentation());\n\n  wipeWidgetRep->SetImageActor(wipeActor);\n  wipeWidgetRep->SetRectilinearWipe(wipe);\n  wipeWidgetRep->GetProperty()->SetLineWidth(2.0);\n  wipeWidgetRep->GetProperty()->SetOpacity(0.75);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(wipeActor);\n  renWin->SetSize(300, 300);\n\n  // Render the image.\n  //\n  renWin->Render();\n  wipeWidget->On();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/RectilinearWipeWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RectilinearWipeWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingHybrid\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RectilinearWipeWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RectilinearWipeWidget MACOSX_BUNDLE RectilinearWipeWidget.cxx )\n  target_link_libraries(RectilinearWipeWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RectilinearWipeWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/RectilinearWipeWidget/#download-and-build-rectilinearwipewidget","title":"Download and Build RectilinearWipeWidget","text":"

Click here to download RectilinearWipeWidget and its CMakeLists.txt file. Once the tarball RectilinearWipeWidget.tar has been downloaded and extracted,

cd RectilinearWipeWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./RectilinearWipeWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/ScalarBarWidget/","title":"ScalarBarWidget","text":"

vtk-examples/Cxx/Widgets/ScalarBarWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/ScalarBarWidget/#code","title":"Code","text":"

ScalarBarWidget.cxx

#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkScalarBarWidget.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtk) e.g.uGridEx.vtk\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create a custom lut. The lut is used for both the mapper and the\n  // scalarBar.\n  vtkNew<vtkLookupTable> lut;\n  lut->Build();\n\n  // Read the source file.\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update(); // Needed because of GetScalarRange.\n  auto output = reader->GetOutput();\n  auto scalarRange = output->GetScalarRange();\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(output);\n  mapper->SetScalarRange(scalarRange);\n  mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(300, 300);\n  renderWindow->SetWindowName(\"ScalarBarWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Create the scalarBar.\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetOrientationToHorizontal();\n  scalarBar->SetLookupTable(lut);\n\n  // Create the scalarBarWidget.\n  vtkNew<vtkScalarBarWidget> scalarBarWidget;\n  scalarBarWidget->SetInteractor(interactor);\n  scalarBarWidget->SetScalarBarActor(scalarBar);\n  scalarBarWidget->On();\n\n  interactor->Initialize();\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(-6.4, 10.3, 1.4);\n  renderer->GetActiveCamera()->SetFocalPoint(1.0, 0.5, 3.0);\n  renderer->GetActiveCamera()->SetViewUp(0.6, 0.4, -0.7);\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/ScalarBarWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScalarBarWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOLegacy\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScalarBarWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScalarBarWidget MACOSX_BUNDLE ScalarBarWidget.cxx )\n  target_link_libraries(ScalarBarWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScalarBarWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/ScalarBarWidget/#download-and-build-scalarbarwidget","title":"Download and Build ScalarBarWidget","text":"

Click here to download ScalarBarWidget and its CMakeLists.txt file. Once the tarball ScalarBarWidget.tar has been downloaded and extracted,

cd ScalarBarWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./ScalarBarWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/SeedWidget/","title":"SeedWidget","text":"

vtk-examples/Cxx/Widgets/SeedWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/SeedWidget/#description","title":"Description","text":"

This example demonstrates how to use vtkSeedWidget, which generates (seeds) points to be placed in the scene in the locations where the user clicks.

The points can then be used for operations like connectivity, segmentation, and region growing. For an example using a custom callback where such operations can be assembled, see SeedWidgetWithCustomCallback.

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/SeedWidget/#code","title":"Code","text":"

SeedWidget.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointHandleRepresentation2D.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h> // For setting the color in the handles.\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSeedRepresentation.h>\n#include <vtkSeedWidget.h>\n#include <vtkSphereSource.h>\n\nint main(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetWindowName(\"SeedWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n\n  // Create the representation for the seed widget and for its handles.\n  vtkNew<vtkPointHandleRepresentation2D> handleRep;\n  handleRep->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  vtkNew<vtkSeedRepresentation> widgetRep;\n  widgetRep->SetHandleRepresentation(handleRep);\n\n  // Create the seed widget.\n  vtkNew<vtkSeedWidget> seedWidget;\n  seedWidget->SetInteractor(interactor);\n  seedWidget->SetRepresentation(widgetRep);\n\n  seedWidget->On();\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/SeedWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SeedWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SeedWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SeedWidget MACOSX_BUNDLE SeedWidget.cxx )\n  target_link_libraries(SeedWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SeedWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/SeedWidget/#download-and-build-seedwidget","title":"Download and Build SeedWidget","text":"

Click here to download SeedWidget and its CMakeLists.txt file. Once the tarball SeedWidget.tar has been downloaded and extracted,

cd SeedWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SeedWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/SeedWidgetImage/","title":"SeedWidgetImage","text":"

vtk-examples/Cxx/Widgets/SeedWidgetImage

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/SeedWidgetImage/#code","title":"Code","text":"

SeedWidgetImage.cxx

#include <vtkCallbackCommand.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointHandleRepresentation2D.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSeedRepresentation.h>\n#include <vtkSeedWidget.h>\n#include <vtkSmartPointer.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nnamespace {\nclass vtkSeedImageCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkSeedImageCallback* New()\n  {\n    return new vtkSeedImageCallback;\n  }\n\n  vtkSeedImageCallback() = default;\n\n  virtual void Execute(vtkObject*, unsigned long event, void* calldata)\n  {\n    if (event == vtkCommand::PlacePointEvent)\n    {\n      std::cout << \"Placing point...\" << std::endl;\n      std::cout << \"There are now \"\n                << this->SeedRepresentation->GetNumberOfSeeds() << \" seeds.\"\n                << std::endl;\n      for (unsigned int seedId = 0; static_cast<int>(seedId) <\n           this->SeedRepresentation->GetNumberOfSeeds();\n           seedId++)\n      {\n        double pos[3];\n        this->SeedRepresentation->GetSeedDisplayPosition(seedId, pos);\n        std::cout << \"Seed \" << seedId << \" : (\" << pos[0] << \" \" << pos[1]\n                  << \" \" << pos[2] << \")\" << std::endl;\n      }\n      return;\n    }\n    if (event == vtkCommand::InteractionEvent)\n    {\n      std::cout << \"Interaction...\" << std::endl;\n      if (calldata)\n      {\n        double pos[3];\n        this->SeedRepresentation->GetSeedDisplayPosition(0, pos);\n        std::cout << \"Moved to (\" << pos[0] << \" \" << pos[1] << \" \" << pos[2]\n                  << \")\" << std::endl;\n      }\n      return;\n    }\n  }\n\n  void SetRepresentation(vtkSmartPointer<vtkSeedRepresentation> rep)\n  {\n    this->SeedRepresentation = rep;\n  }\n  void SetWidget(vtkSmartPointer<vtkSeedWidget> widget)\n  {\n    this->SeedWidget = widget;\n  }\n\nprivate:\n  vtkSeedRepresentation* SeedRepresentation = nullptr;\n  vtkSeedWidget* SeedWidget = nullptr;\n};\n} // namespace\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"MidnightBlue\").GetData();\n  auto color2 = colors->GetColor3ub(\"Tomato\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 20, 0, 50, 0, 0);\n  // Make a blue background.\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(0, 20, 0, 50);\n  // Make a red circle.\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(9, 10, 5);\n  drawing->Update();\n\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->SetInputData(drawing->GetOutput());\n\n  // Create a renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SeedWidgetImage\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Setup interactor style.\n  vtkNew<vtkInteractorStyleImage> interactorStyleImage;\n  renderWindowInteractor->SetInteractorStyle(interactorStyleImage);\n\n  // Create the representation\n  vtkNew<vtkPointHandleRepresentation2D> handle;\n  handle->GetProperty()->SetColor(1, 0, 0);\n  vtkNew<vtkSeedRepresentation> rep;\n  rep->SetHandleRepresentation(handle);\n\n  // Seed widget.\n  vtkNew<vtkSeedWidget> seedWidget;\n  seedWidget->SetInteractor(renderWindowInteractor);\n  seedWidget->SetRepresentation(rep);\n\n  vtkNew<vtkSeedImageCallback> seedCallback;\n  seedCallback->SetRepresentation(rep);\n  seedCallback->SetWidget(seedWidget);\n  seedWidget->AddObserver(vtkCommand::PlacePointEvent, seedCallback);\n  seedWidget->AddObserver(vtkCommand::InteractionEvent, seedCallback);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  seedWidget->On();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/SeedWidgetImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SeedWidgetImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SeedWidgetImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SeedWidgetImage MACOSX_BUNDLE SeedWidgetImage.cxx )\n  target_link_libraries(SeedWidgetImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SeedWidgetImage\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/SeedWidgetImage/#download-and-build-seedwidgetimage","title":"Download and Build SeedWidgetImage","text":"

Click here to download SeedWidgetImage and its CMakeLists.txt file. Once the tarball SeedWidgetImage.tar has been downloaded and extracted,

cd SeedWidgetImage/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SeedWidgetImage\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/SeedWidgetWithCustomCallback/","title":"SeedWidgetWithCustomCallback","text":"

vtk-examples/Cxx/Widgets/SeedWidgetWithCustomCallback

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/SeedWidgetWithCustomCallback/#descriptionn","title":"Descriptionn","text":"

This example demonstrates how to place seed points in the scene. The seed points can be used for operations like connectivity, segmentation, and region growing.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/SeedWidgetWithCustomCallback/#code","title":"Code","text":"

SeedWidgetWithCustomCallback.cxx

#include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointHandleRepresentation2D.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSeedRepresentation.h>\n#include <vtkSeedWidget.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass vtkSeedCallback : public vtkCommand\n{\npublic:\n  static vtkSeedCallback* New()\n  {\n    return new vtkSeedCallback;\n  }\n\n  vtkSeedCallback()\n  {\n  }\n\n  virtual void Execute(vtkObject*, unsigned long event, void* calldata)\n  {\n    if (event == vtkCommand::PlacePointEvent)\n    {\n      std::cout << \"Point placed, total of: \"\n                << this->SeedRepresentation->GetNumberOfSeeds() << std::endl;\n    }\n    if (event == vtkCommand::InteractionEvent)\n    {\n      if (calldata)\n      {\n        std::cout << \"Interacting with seed : \"\n                  << *(static_cast<int*>(calldata)) << std::endl;\n      }\n    }\n\n    std::cout << \"List of seeds (Display coordinates):\" << std::endl;\n    for (vtkIdType i = 0; i < this->SeedRepresentation->GetNumberOfSeeds(); i++)\n    {\n      double pos[3];\n      this->SeedRepresentation->GetSeedDisplayPosition(i, pos);\n      std::cout << \"(\" << pos[0] << \" \" << pos[1] << \" \" << pos[2] << \")\"\n                << std::endl;\n    }\n  }\n\n  void SetRepresentation(vtkSeedRepresentation* rep)\n  {\n    this->SeedRepresentation = rep;\n  }\n\nprivate:\n  vtkSeedRepresentation* SeedRepresentation;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SeedWidgetWithCustomCallback\");\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create the representation\n  vtkNew<vtkPointHandleRepresentation2D> handle;\n  handle->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  vtkNew<vtkSeedRepresentation> rep;\n  rep->SetHandleRepresentation(handle);\n\n  // Seed widget\n  vtkNew<vtkSeedWidget> seedWidget;\n  seedWidget->SetInteractor(renderWindowInteractor);\n  seedWidget->SetRepresentation(rep);\n\n  vtkNew<vtkSeedCallback> seedCallback;\n  seedCallback->SetRepresentation(rep);\n  seedWidget->AddObserver(vtkCommand::PlacePointEvent, seedCallback);\n  seedWidget->AddObserver(vtkCommand::InteractionEvent, seedCallback);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  seedWidget->On();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/SeedWidgetWithCustomCallback/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SeedWidgetWithCustomCallback)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SeedWidgetWithCustomCallback: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SeedWidgetWithCustomCallback MACOSX_BUNDLE SeedWidgetWithCustomCallback.cxx )\n  target_link_libraries(SeedWidgetWithCustomCallback PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SeedWidgetWithCustomCallback\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/SeedWidgetWithCustomCallback/#download-and-build-seedwidgetwithcustomcallback","title":"Download and Build SeedWidgetWithCustomCallback","text":"

Click here to download SeedWidgetWithCustomCallback and its CMakeLists.txt file. Once the tarball SeedWidgetWithCustomCallback.tar has been downloaded and extracted,

cd SeedWidgetWithCustomCallback/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SeedWidgetWithCustomCallback\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/Slider/","title":"Slider","text":"

vtk-examples/Cxx/Widgets/Slider

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/Slider/#description","title":"Description","text":"

This example demonstrates how to use a 3D slider widget. Here, the slider controls the resolution of the sphere. The slider is positioned in world coordinates - so if you rotate/translate/scale the scene, the slider will change orientation/position/size. Contrast this with Slider2D that remains at a fixed location in the window.

If the callback is connected to InteractionEvent, the scene will update whenever the mouse is moved on the slider. This is not ideal if the re-rendering takes significant time as it will make the interaction very choppy. If you want to move the slider and have the scene update when the mouse button is released, connect the callback to EndInteractionEvent instead.

Note

This original source code for this example is here.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/Slider/#code","title":"Code","text":"

Slider.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation3D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// The callback does the work.\n// The callback keeps a pointer to the sphere whose resolution is\n// controlled. After constructing the callback, the program sets the\n// SphereSource of the callback to the object to be controlled.\nclass vtkSliderCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->SphereSource->SetPhiResolution(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue() /\n        2);\n    this->SphereSource->SetThetaResolution(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n  }\n  vtkSliderCallback() : SphereSource(0)\n  {\n  }\n  vtkSphereSource* SphereSource;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(4.0);\n  sphereSource->SetPhiResolution(4);\n  sphereSource->SetThetaResolution(8);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n  actor->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Slider\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation3D> sliderRep;\n  sliderRep->SetMinimumValue(3.0);\n  sliderRep->SetMaximumValue(50.0);\n  sliderRep->SetValue(sphereSource->GetThetaResolution());\n  sliderRep->SetTitleText(\"Sphere Resolution\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToWorld();\n  sliderRep->GetPoint1Coordinate()->SetValue(-4, 6, 0);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToWorld();\n  sliderRep->GetPoint2Coordinate()->SetValue(4, 6, 0);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->SphereSource = sphereSource;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderer->GetActiveCamera()->Dolly(0.9);\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/Slider/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Slider)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Slider: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Slider MACOSX_BUNDLE Slider.cxx )\n  target_link_libraries(Slider PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Slider\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/Slider/#download-and-build-slider","title":"Download and Build Slider","text":"

Click here to download Slider and its CMakeLists.txt file. Once the tarball Slider.tar has been downloaded and extracted,

cd Slider/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Slider\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/Slider2D/","title":"Slider2D","text":"

vtk-examples/Cxx/Widgets/Slider2D

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/Slider2D/#description","title":"Description","text":"

This example demonstrates how to use a slider that is drawn in window coordinates - so if you move the scene the slider is not affected. Contrast this with the 3D slider widget that remains at a fixed location in the world coordinates.

If the callback is connected to InteractionEvent, the scene will update immediately. This is not ideal if the re-rendering takes significant time as it will make the interaction very choppy. If you want to move the slider and have the scene update when the mouse button is released, connect the callback to EndInteractionEvent instead.

Note

This original source code for this example is here.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/Slider2D/#code","title":"Code","text":"

Slider2D.cxx

#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n// This does the actual work.\n// Callback for the interaction.\nclass vtkSliderCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->SphereSource->SetPhiResolution(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->SphereSource->SetThetaResolution(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n  }\n  vtkSliderCallback() : SphereSource(0)\n  {\n  }\n  vtkSphereSource* SphereSource;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(4.0);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n  actor->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Slider2D\");\n  renderWindow->SetSize(640, 480);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n\n  sliderRep->SetMinimumValue(3.0);\n  sliderRep->SetMaximumValue(20.0);\n  sliderRep->SetValue(5.0);\n  sliderRep->SetTitleText(\"Sphere Resolution\");\n\n  // Set color properties:\n  //   // Set color properties:\n  // Change the color of the knob that slides\n  sliderRep->GetSliderProperty()->SetColor(\n      colors->GetColor3d(\"Green\").GetData());\n  // Change the color of the text indicating what the slider controls\n  sliderRep->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  // Change the color of the text displaying the value\n  sliderRep->GetLabelProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  // Change the color of the knob when the mouse is held on it\n  sliderRep->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"DeepPink\").GetData());\n  // Change the color of the bar\n  sliderRep->GetTubeProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  // Change the color of the ends of the bar\n  sliderRep->GetCapProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  sliderRep->SetSliderLength(0.05);\n  sliderRep->SetSliderWidth(0.025);\n  sliderRep->SetEndCapLength(0.02);\n\n  // Display pixel values (640 X 480)\n  // sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToDisplay();\n  // sliderRep->GetPoint1Coordinate()->SetValue(128, 48);\n  // sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToDisplay();\n  // sliderRep->GetPoint2Coordinate()->SetValue(512, 48);\n  // Or use this - better because it scales to the window size:\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(0.2, 0.1);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(0.8, 0.1);\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->SphereSource = sphereSource;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/Slider2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Slider2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Slider2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Slider2D MACOSX_BUNDLE Slider2D.cxx )\n  target_link_libraries(Slider2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Slider2D\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/Slider2D/#download-and-build-slider2d","title":"Download and Build Slider2D","text":"

Click here to download Slider2D and its CMakeLists.txt file. Once the tarball Slider2D.tar has been downloaded and extracted,

cd Slider2D/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./Slider2D\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/SphereWidget/","title":"SphereWidget","text":"

vtk-examples/Cxx/Widgets/SphereWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/SphereWidget/#code","title":"Code","text":"

SphereWidget.cxx

#include <vtkCallbackCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereWidget.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nclass SphereCallback : public vtkCallbackCommand\n{\npublic:\n  static SphereCallback* New()\n  {\n    return new SphereCallback;\n  }\n  SphereCallback()\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n\n    vtkSphereWidget* sphereWidget = reinterpret_cast<vtkSphereWidget*>(caller);\n\n    double center[3];\n    sphereWidget->GetCenter(center);\n    std::cout << \"Center: \" << center[0] << \" \" << center[1] << \" \" << center[2]\n              << std::endl;\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SphereWidget\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkSphereWidget> sphereWidget;\n  sphereWidget->SetInteractor(renderWindowInteractor);\n  sphereWidget->SetRepresentationToSurface();\n  sphereWidget->GetSphereProperty()->SetColor(\n      colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<SphereCallback> sphereCallback;\n\n  sphereWidget->AddObserver(vtkCommand::InteractionEvent, sphereCallback);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  sphereWidget->On();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/SphereWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SphereWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SphereWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SphereWidget MACOSX_BUNDLE SphereWidget.cxx )\n  target_link_libraries(SphereWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SphereWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/SphereWidget/#download-and-build-spherewidget","title":"Download and Build SphereWidget","text":"

Click here to download SphereWidget and its CMakeLists.txt file. Once the tarball SphereWidget.tar has been downloaded and extracted,

cd SphereWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SphereWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/SphereWidget2/","title":"SphereWidget2","text":"

vtk-examples/Cxx/Widgets/SphereWidget2

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/SphereWidget2/#description","title":"Description","text":"

The spherical coordinates of the widget's handle match the coordinates that it displays in the window. The world coordinates of the handle are also shown.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/SphereWidget2/#code","title":"Code","text":"

SphereWidget2.cxx

#include <vtkCommand.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphere.h>\n#include <vtkSphereRepresentation.h>\n#include <vtkSphereWidget2.h>\n\nnamespace {\n// Callback that displays the sphere widget's spherical handle postion\n// in both sphercial (relative to the widget's center) and cartesian global\n// coordinates\nclass vtkSphereCallback : public vtkCommand\n{\npublic:\n  static vtkSphereCallback* New()\n  {\n    return new vtkSphereCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSphereWidget2* sphereWidget =\n        reinterpret_cast<vtkSphereWidget2*>(caller);\n\n    double center[3], handlePosition[3];\n    vtkSphereRepresentation* sphereRepresentation =\n        dynamic_cast<vtkSphereRepresentation*>(\n            sphereWidget->GetRepresentation());\n    sphereRepresentation->GetHandlePosition(handlePosition);\n    sphereRepresentation->GetSphere(this->Sphere);\n\n    this->Sphere->GetCenter(center);\n\n    double radius = sqrt(static_cast<double>(\n        vtkMath::Distance2BetweenPoints(center, handlePosition)));\n    radius = (radius <= 0.0 ? 1.0 : radius);\n    double theta = vtkMath::DegreesFromRadians(atan2(\n        (handlePosition[1] - center[1]), (handlePosition[0] - center[0])));\n    double phi = vtkMath::DegreesFromRadians(\n        acos((handlePosition[2] - center[2]) / radius));\n\n    std::cout << \"r, theta, phi: (\" << std::setprecision(3) << radius << \", \"\n              << theta << \", \" << phi << \") \"\n              << \"x, y, z: (\" << handlePosition[0] << \", \" << handlePosition[1]\n              << \", \" << handlePosition[2] << \") \" << std::endl;\n  }\n\n  vtkSphereCallback()\n  {\n    this->Sphere = vtkSphere::New();\n  }\n  ~vtkSphereCallback()\n  {\n    this->Sphere->Delete();\n  }\n\n  vtkSphere* Sphere;\n};\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a renderer and a render window\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SphereWidget2\");\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create a sphere widget\n  vtkNew<vtkSphereWidget2> sphereWidget;\n  sphereWidget->SetInteractor(renderWindowInteractor);\n  sphereWidget->CreateDefaultRepresentation();\n\n  vtkSphereRepresentation* sphereRepresentation =\n      dynamic_cast<vtkSphereRepresentation*>(sphereWidget->GetRepresentation());\n  sphereRepresentation->HandleVisibilityOn();\n\n  vtkNew<vtkSphereCallback> sphereCallback;\n\n  sphereWidget->AddObserver(vtkCommand::InteractionEvent, sphereCallback);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  sphereWidget->On();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/SphereWidget2/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SphereWidget2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SphereWidget2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SphereWidget2 MACOSX_BUNDLE SphereWidget2.cxx )\n  target_link_libraries(SphereWidget2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SphereWidget2\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/SphereWidget2/#download-and-build-spherewidget2","title":"Download and Build SphereWidget2","text":"

Click here to download SphereWidget2 and its CMakeLists.txt file. Once the tarball SphereWidget2.tar has been downloaded and extracted,

cd SphereWidget2/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SphereWidget2\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/SphereWidgetEvents/","title":"SphereWidgetEvents","text":"

vtk-examples/Cxx/Widgets/SphereWidgetEvents

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/SphereWidgetEvents/#description","title":"Description","text":"

This example shows how to subclass a widget so that events can be further customized.

Contributed by: Alex Malyushytskyy.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/SphereWidgetEvents/#code","title":"Code","text":"

SphereWidgetEvents.cxx

#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereWidget.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nclass MySphereWidget : public vtkSphereWidget\n{\npublic:\n  static MySphereWidget* New();\n  vtkTypeMacro(MySphereWidget, vtkSphereWidget);\n\n  // Handles the events\n  static void ProcessEvents(vtkObject* object, unsigned long event,\n                            void* clientdata, void* calldata);\n\nprotected:\n  MySphereWidget();\n\n  // Create a new callback command rather than using the one defined in\n  // vtkSphereWidget. This prevents problems with unexpected behavior due\n  // to the AbortFlag being manipulated.\n  vtkSmartPointer<vtkCallbackCommand> MyEventCallbackCommand;\n};\n\nMySphereWidget::MySphereWidget()\n{\n\n  this->MyEventCallbackCommand = vtkSmartPointer<vtkCallbackCommand>::New();\n\n  // Connect our own callback command to our own ProcessEvents function.\n  // This way we do not have to deal with side effects of\n  // SphereWidget::ProcessEvents.\n  this->MyEventCallbackCommand->SetCallback(MySphereWidget::ProcessEvents);\n\n  // Connect our callback function to a few events.\n  this->AddObserver(vtkCommand::StartInteractionEvent,\n                    this->MyEventCallbackCommand);\n\n  this->AddObserver(vtkCommand::InteractionEvent, this->MyEventCallbackCommand);\n\n  this->AddObserver(vtkCommand::EndInteractionEvent,\n                    this->MyEventCallbackCommand);\n}\n\nvoid MySphereWidget::ProcessEvents(vtkObject* vtkNotUsed(object),\n                                   unsigned long event,\n                                   void* vtkNotUsed(clientdata),\n                                   void* vtkNotUsed(calldata))\n{\n  switch (event)\n  {\n  case vtkCommand::StartInteractionEvent:\n    std::cout << \"StartInteractionEvent\" << std::endl;\n    break;\n  case vtkCommand::EndInteractionEvent:\n    std::cout << \"EndInteractionEvent\" << std::endl;\n    break;\n  case vtkCommand::InteractionEvent:\n    std::cout << \"InteractionEvent\" << std::endl;\n    break;\n  }\n}\n\nvtkStandardNewMacro(MySphereWidget);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create  a renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SphereWidgetEvents\");\n\n  // Create an interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<MySphereWidget> sphereWidget;\n  sphereWidget->SetInteractor(renderWindowInteractor);\n  sphereWidget->SetRepresentationToSurface();\n  sphereWidget->HandleVisibilityOn();\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  sphereWidget->On();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/SphereWidgetEvents/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SphereWidgetEvents)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SphereWidgetEvents: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SphereWidgetEvents MACOSX_BUNDLE SphereWidgetEvents.cxx )\n  target_link_libraries(SphereWidgetEvents PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SphereWidgetEvents\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/SphereWidgetEvents/#download-and-build-spherewidgetevents","title":"Download and Build SphereWidgetEvents","text":"

Click here to download SphereWidgetEvents and its CMakeLists.txt file. Once the tarball SphereWidgetEvents.tar has been downloaded and extracted,

cd SphereWidgetEvents/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SphereWidgetEvents\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/SplineWidget/","title":"SplineWidget","text":"

vtk-examples/Cxx/Widgets/SplineWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/SplineWidget/#description","title":"Description","text":"

Note

This original source code for this example is here.

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/SplineWidget/#code","title":"Code","text":"

SplineWidget.cxx

#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSplineWidget2.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SplineWidget\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkSplineWidget2> splineWidget;\n  splineWidget->SetInteractor(renderWindowInteractor);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  splineWidget->On();\n  renderer->ResetCamera();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/SplineWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SplineWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SplineWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SplineWidget MACOSX_BUNDLE SplineWidget.cxx )\n  target_link_libraries(SplineWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SplineWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/SplineWidget/#download-and-build-splinewidget","title":"Download and Build SplineWidget","text":"

Click here to download SplineWidget and its CMakeLists.txt file. Once the tarball SplineWidget.tar has been downloaded and extracted,

cd SplineWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./SplineWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/TextWidget/","title":"TextWidget","text":"

vtk-examples/Cxx/Widgets/TextWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/TextWidget/#description","title":"Description","text":"

Seealso

DrawText

Other languages

See (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/TextWidget/#code","title":"Code","text":"

TextWidget.cxx

#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n#include <vtkTextRepresentation.h>\n#include <vtkTextWidget.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Create a test pipeline.\n  vtkNew<vtkSphereSource> sphereSource;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the widget\n  vtkNew<vtkTextActor> textActor;\n  textActor->SetInput(\"This is a test\");\n  textActor->GetTextProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n\n  vtkNew<vtkTextWidget> textWidget;\n\n  vtkNew<vtkTextRepresentation> textRepresentation;\n  textRepresentation->GetPositionCoordinate()->SetValue(0.15, 0.15);\n  textRepresentation->GetPosition2Coordinate()->SetValue(0.7, 0.2);\n  textWidget->SetRepresentation(textRepresentation);\n\n  textWidget->SetInteractor(interactor);\n  textWidget->SetTextActor(textActor);\n  textWidget->SelectableOff();\n\n  // Add the actors to the renderer, set the background and size.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderWindow->SetSize(300, 300);\n  renderWindow->SetWindowName(\"TextWidget\");\n\n  interactor->Initialize();\n  renderWindow->Render();\n  textWidget->On();\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
"},{"location":"Cxx/Widgets/TextWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextWidget MACOSX_BUNDLE TextWidget.cxx )\n  target_link_libraries(TextWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/TextWidget/#download-and-build-textwidget","title":"Download and Build TextWidget","text":"

Click here to download TextWidget and its CMakeLists.txt file. Once the tarball TextWidget.tar has been downloaded and extracted,

cd TextWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TextWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Cxx/Widgets/TexturedButtonWidget/","title":"TexturedButtonWidget","text":"

vtk-examples/Cxx/Widgets/TexturedButtonWidget

ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

"},{"location":"Cxx/Widgets/TexturedButtonWidget/#description","title":"Description","text":"

This example creates a textured 2D button. The button is placed in the upper right of the display.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Cxx/Widgets/TexturedButtonWidget/#code","title":"Code","text":"

TexturedButtonWidget.cxx

#include <vtkActor.h>\n#include <vtkButtonWidget.h>\n#include <vtkCoordinate.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTexturedButtonRepresentation2D.h>\n\n#include <array>\n\nnamespace {\nvoid CreateImage(vtkImageData* image, std::string const& color1,\n                 std::string const& color2);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create two images for texture\n  vtkNew<vtkImageData> image1;\n  vtkNew<vtkImageData> image2;\n  unsigned char banana[3] = {227, 207, 87};\n  unsigned char tomato[3] = {255, 99, 71};\n  CreateImage(image1, \"Banana\", \"Tomato\");\n  CreateImage(image2, \"Tomato\", \"Banana\");\n\n  // Create some geometry\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TexturedButtonWidget\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create the widget and its representation\n  vtkNew<vtkTexturedButtonRepresentation2D> buttonRepresentation;\n  buttonRepresentation->SetNumberOfStates(2);\n  buttonRepresentation->SetButtonTexture(0, image1);\n  buttonRepresentation->SetButtonTexture(1, image2);\n\n  vtkNew<vtkButtonWidget> buttonWidget;\n  buttonWidget->SetInteractor(renderWindowInteractor);\n  buttonWidget->SetRepresentation(buttonRepresentation);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBLue\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n\n  // Place the widget. Must be done after a render so that the\n  // viewport is defined..\n  // Here the widget placement is in normalized display coordinates.\n  vtkNew<vtkCoordinate> upperRight;\n  upperRight->SetCoordinateSystemToNormalizedDisplay();\n  upperRight->SetValue(1.0, 1.0);\n\n  double bds[6];\n  double sz = 50.0;\n  bds[0] = upperRight->GetComputedDisplayValue(renderer)[0] - sz;\n  bds[1] = bds[0] + sz;\n  bds[2] = upperRight->GetComputedDisplayValue(renderer)[1] - sz;\n  bds[3] = bds[2] + sz;\n  bds[4] = bds[5] = 0.0;\n\n  // Scale to 1, default is .5\n  buttonRepresentation->SetPlaceFactor(1);\n  buttonRepresentation->PlaceWidget(bds);\n\n  buttonWidget->On();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateImage(vtkImageData* image, std::string const& color1,\n                 std::string const& color2)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 3> dc1{0, 0, 0};\n  std::array<unsigned char, 3> dc2{0, 0, 0};\n  auto c1 = colors->GetColor3ub(color1).GetData();\n  auto c2 = colors->GetColor3ub(color2).GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    dc1[i] = c1[i];\n    dc2[i] = c2[i];\n  }\n\n  // Specify the size of the image data.\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  int* dims = image->GetDimensions();\n\n  // Fill the image with\n  for (int y = 0; y < dims[1]; y++)\n  {\n    for (int x = 0; x < dims[0]; x++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (int i = 0; i < 3; ++i)\n      {\n        if (x < 5)\n        {\n          pixel[i] = dc1[i];\n        }\n        else\n        {\n          pixel[i] = dc2[i];\n        }\n      }\n    }\n  }\n}\n} // namespace\n
"},{"location":"Cxx/Widgets/TexturedButtonWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TexturedButtonWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TexturedButtonWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TexturedButtonWidget MACOSX_BUNDLE TexturedButtonWidget.cxx )\n  target_link_libraries(TexturedButtonWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TexturedButtonWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
"},{"location":"Cxx/Widgets/TexturedButtonWidget/#download-and-build-texturedbuttonwidget","title":"Download and Build TexturedButtonWidget","text":"

Click here to download TexturedButtonWidget and its CMakeLists.txt file. Once the tarball TexturedButtonWidget.tar has been downloaded and extracted,

cd TexturedButtonWidget/build\n

If VTK is installed:

cmake ..\n

If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

Build the project:

make\n

and run it:

./TexturedButtonWidget\n

WINDOWS USERS

Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

"},{"location":"Documentation/Frog_mhd_format/","title":"Frog MHD Format","text":"

The following keys are recognised:

"},{"location":"Documentation/Frog_mhd_format/#keys","title":"Keys","text":"
  • title: A title.
  • files: A vector/list of paths to the *.mhd files needed.
  • tissues
  • colors: A map/dict of tissue names and colors.
  • figures
  • fig12-9b: The vector/list of tissues needed for figure 12-9b.
  • fig12-9cd: The vector/list of tissues needed for figure 12-9c and 12-9d.
  • tissue_parameters: The required parameters for each tissue are specified here.
  • parameter types: A map/dict of tissue parameters of each tissue parameter and its type. Essential for C++ code.
  • default>: The default tissue parameters, a map/dict of tissue parameters and values.
  • <tissue name>: The map/dict of tissue parameters and values for each tissue.
"},{"location":"Documentation/Frog_vtk_format/","title":"Frog VTK Format","text":"

The following keys are recognised:

"},{"location":"Documentation/Frog_vtk_format/#keys","title":"Keys","text":"
  • title: A title.
  • files: A vector/list of paths to the *.vtk files needed.
  • tissues
  • names: A vector/list of the tissue names.
  • indices: A map/dict of tissue names and index.
  • colors: A map/dict of tissue names and colors.
  • orientation: A map/dict of tissue names and orientation.
  • opacity: A map/dict of tissue names and opacity.
  • figures
  • fig12-9b: The vector/list of tissues needed for figure 12-9b.
  • fig12-9cd: The vector/list of tissues needed for figure 12-9c and 12-9d.
"},{"location":"Documentation/PBR_JSON_format/","title":"PBR JSON file format","text":"

The following keys and values are recognised when parsing the JSON files used by the PBR examples:

"},{"location":"Documentation/PBR_JSON_format/#keys","title":"Keys","text":""},{"location":"Documentation/PBR_JSON_format/#general","title":"General","text":"
  • title: A title, it could indicate the program using this file.
  • object: The object name.
  • objcolor: The colour of the object.
  • bkgcolor: The background colour of the scene.
  • skybox: Use the cubemap or equirectangular files as a skybox.
"},{"location":"Documentation/PBR_JSON_format/#environment-textures","title":"Environment textures","text":"
  • cubemap: The vector of six paths to the cube maps used to generate the environment texture.
  • equirectangular: An equirectangular file used to generate the environment texture.

You must specify at least one of these keys. If both are specified then equirectangular will be used by default.

"},{"location":"Documentation/PBR_JSON_format/#object-textures","title":"Object Textures","text":"
  • albedo: A file setting the perceived color (base colour texture) of the object, the diffuse color for non-metallic objects or the specular color for metallic objects.
  • normal: A file setting the normal map (texture). This allows a more precise shading without the need to subdivide the geometry. Stores the normal direction {x,y,z} in the Red/Green/Blue (RGB) channels.
  • material: A file setting the ambient Occlusion/Roughness/Metallic factors in the RGB channels. Also called ORM texture.
  • coat: A file containing the Coat Normal Texture, a normal map for the clear coat layer.
  • anisotropy: A file setting the Anisotropy Texture controlling the anisotropy strength in the red channel, while the green channel holds the anisotropy rotation. The blue channel is discarded.
  • emissive: A file setting the light-emitting texture or Emissive Texture. Note that the material will not actually emit light, and the texture is ignored by OSPRay and NVidia pathtracing backends.

Note: Generally only a subset of the available keys are used in any given application.

"},{"location":"Documentation/PBR_JSON_format/#values","title":"Values","text":"

The values consist of strings:

  • For the key object: The name of the object to be used is specified e.g. \"Boy\".
  • For the key skybox: true or false are the allowed values.
  • For the keys objcolor or bkgcolor: the name of a colour is the value e.g. \"MidnightBlue\". See: VTKNamedColorPatches for colour names.

The remaining keys have values specifying paths to the needed files. These paths are relative to where the JSON file's location is in the filesystem.

The value for cubemap is a vector of six paths with this orientation and ordering:

  • [right, left, top, bottom, front, back]

or

  • [+x, -x, +y, -y, +z, -z]

The cubemap key has two subkeys:

  • root: Specifying the path to the cubemaps.
  • files: The ordered list of six files corresponding to the cubemaps.
"},{"location":"Documentation/PBR_JSON_format/#example","title":"Example","text":"
{\n  \"title\": \"Parameters for PBR_Skybox_Anisotropy\",\n  \"object\": \"Boy\",\n  \"bkgcolor\": \"MidnightBlue\",\n  \"objcolor\": \"Seashell\",\n  \"skybox\": true,\n  \"cubemap\": {\n    \"root\": \"./Skyboxes/skybox0\",\n    \"files\": [\n      \"right.jpg\",\n      \"left.jpg\",\n      \"top.jpg\",\n      \"bottom.jpg\",\n      \"front.jpg\",\n      \"back.jpg\"\n    ]\n  },\n  \"equirectangular\": \"./Skyboxes/spiaggia_di_mondello_4k.hdr\",\n  \"xequirectangular\": \"./Skyboxes/skybox0/skybox.jpg\",\n  \"albedo\": \"./Textures/Anisotropic/CarbonFiberAniso_albedo.png\",\n  \"normal\": \"./Textures/Anisotropic/CarbonFiberAniso_normal.png\",\n  \"material\": \"./Textures/Anisotropic/CarbonFiberAniso_orm.png\",\n  \"anisotropy\": \"./Textures/Anisotropic/CarbonFiberAniso_anisotropyAngle.png\"\n}\n

Note:

  • In the above example, the relative paths assume that the folders Skyboxes and Textures are subfolders relative to the directory where this file is located.
  • the key xequirectangular will not be loaded, to load it, change it to equirectangular and skybox.jpg will be used instead of spiaggia_di_mondello_4k.hd.
"},{"location":"Instructions/ConvertingFiguresToExamples/","title":"ConvertingFiguresToExamples","text":""},{"location":"Instructions/ConvertingFiguresToExamples/#converting-figures-to-examples","title":"Converting Figures to Examples","text":"

There is an ongoing effort to convert the examples in the VTK Book into VTKExamples.

"},{"location":"Instructions/ConvertingFiguresToExamples/#the-process","title":"The process","text":"
  1. Follow the procedure ForDevelopers to contribute examples.
  2. Download a copy of the VTK Book.
  3. Look at the VTKBookFigures page and look for examples that have not been converted. These examples will not have a link to source code.
  4. Go to your VTK source checkout. Run the script getDeletedFile.sh, found in src/Admin folder, with the name of the source file (e.g. walkCow.tcl) in the figure example to be converted. This script will create a source file in the current directory and also report the URL for the original repo location of the example.
  5. Pick a source directory to contain the new example. Look at the Chapter heading in the book to guide where to put the new example.
  6. Convert the source tcl code or old C++ code to C++ code that will compile and run with the current VTK API. Follow the guidelines for coding C++ examples.
  7. If the figure example name is short, e.g. bluntStr we suggest giving it a more descriptive name e.g. BluntStreamlines. Notice the first letter is uppercase.
  8. Edit the VTKBookFigures page as follows:
    1. In the first column of the table, add a link from the Figure to the source code.
    2. In the second column of the table, add the VTK classes that are illustrated by the example.
    3. In the third column, cut and paste the caption from the VTK Book.
    4. If there is a source file mentioned in the caption, make link to the original code URL printed by the getDeletedFile.sh script.
"},{"location":"Instructions/ForAdministrators/","title":"ForAdministrators","text":""},{"location":"Instructions/ForAdministrators/#administrators","title":"Administrators","text":"

Administrators have write access to the VTK Examples Source and to the VTK Examples Web Source. If you are a User go here or a Developer go here.

"},{"location":"Instructions/ForAdministrators/#organization-of-the-repositories","title":"Organization of the Repositories","text":"

The source files for the examples and other files are stored in VTK Examples Source. The web files are stored in a separate repository VTK Examples Web Source.

"},{"location":"Instructions/ForAdministrators/#source-repository","title":"Source Repository","text":"

The repository contains several types of files.

All example source code, descriptions, test data, and test baselines are stored in the src/ tree.

The major elements of the tree are:

|--\n  |-- CMakeLists.txt   # To build all of the examples\n  |-- _layouts         # Contains _default.html\n  |-- custom_theme     # tweaks to the material theme\n  |-- mkdocs.yml       # config file for MkDocs\n  |-- src              # all of the content to create site/\n    |-- SyncSiteWithRepo.sh  # master script to update site/\n    |-- Admin\n    |   |-- ScrapeRepo.py       # script to create docs/ in the web site folder\n    |   |-- VTKCMakeLists       # template for Cxx examples\n    |   |-- VTKQtCMakeLists     # template for Cxx Qt\n    |   |-- Trame_template      # template for Trame\n    |-- Artifacts       # Additional images, docs, etc.\n    |-- Images          # Images used in creating the static web pages.\n    |-- Instructions    # Documentation\n    |-- LANGUAGE.md     # Summary file for language\n    |-- LANGUAGE        # Language examples\n    |   |-- TOPIC\n    |-- Testing\n    |   |-- Baseline # Baselines for examples\n    |   |   |-- LANGUAGE\n    |   |   |   |-- TOPIC\n    |   |-- Data    # Data for examples\n    |-- VTKBook         # Markdown version of the VTK Book\n    |-- VTKBookLaTeX    # LaTex version of the VTK Book\n    |-- stylesheets\n        |-- extra.css # mkdocs search config\n
"},{"location":"Instructions/ForAdministrators/#web-repository","title":"Web Repository","text":"

This repository is separate from the vtk examples source files. It contains the generated web pages and other needed files that are copied across from the source repository.

|--\n  |-- site\n  |-- src               # needed content for site generation and site/ operation\n    |-- Artifacts       # Additional images, docs, etc.\n    |-- Cache           # Stores cache files used by ScrapeRepo.py.\n    |-- Coverage        # Stores VTK classes used and classes used by language.\n    |-- Images          # Images used in creating the static web pages.\n    |-- Trame           # Additional files specific to this topic.\n    |-- VTKBook         # Additional files specific to this topic.\n    |-- VTKFileFormats  # Additional files specific to this topic.\n    |-- Testing\n    |   |-- Baseline # Baselines for examples\n    |   |   |-- LANGUAGE\n    |   |   |   |-- TOPIC\n    |   |-- Data    # Data for examples\n|-- Tarballs        # Tar files for each Cxx and Trame example\n
"},{"location":"Instructions/ForAdministrators/#look-and-feel","title":"Look and Feel","text":"

A priority in moving from the wiki media VTK Wiki Examples to the Github pages VTK Examples was to provide a modern, familiar look and feel. We also wanted to support tablet and mobile platforms. We chose MkDocs because it generated static HTML pages that can be hosted anywhere.

"},{"location":"Instructions/ForAdministrators/#mkdocs","title":"MkDocs","text":""},{"location":"Instructions/ForAdministrators/#installing-mkdocs","title":"Installing MkDocs","text":"

MkDocs is a python package and can be installed using conda or pip.

"},{"location":"Instructions/ForAdministrators/#configuring-mkdocs","title":"Configuring MkDocs","text":"

The mkdocs.yml file contains the configuration parameters:

site_name: vtk-examples\nsite_url: https://examples.vtk.org/site/\nrepo_name: Kitware/vtk-examples\nrepo_url: https://github.com/Kitware/vtk-examples\n\ntheme:\n    name: material\n    custom_dir: custom_theme/\n\nmarkdown_extensions:\n    - pymdownx.arithmatex\n    - pymdownx.tasklist:\n        custom_checkbox: true\n    - pymdownx.magiclink\n    - admonition\n    - codehilite:\n        guess_lang: false\n        use_pygments: true\n    - footnotes\n    - toc:\n        permalink: true\ngoogle_analytics:\n    -  'UA-3660134-4'\n    -  'auto'\nextra_css:\n    -  'stylesheets/extra.css'\ncopyright: '<font color=#666>Content is available under </font><a href=\"https://creativecommons.org/licenses/by/2.5/\" title=\"Attribution2.5\">Attribution2.5</a> <font color=#666>unless otherwise noted.</font>'\nextra_javascript:\n    - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML'\n
"},{"location":"Instructions/ForAdministrators/#markdown-extensions","title":"Markdown Extensions","text":"

A number of markdown extensions are available.

"},{"location":"Instructions/ForAdministrators/#admonition","title":"admonition","text":"

Admonitions are specially marked \"topics\" that can appear anywhere an ordinary body element can. They contain arbitrary body elements. Typically, an admonition is rendered as an offset block in a document, sometimes outlined or shaded, with a title matching the admonition type. For example:

Note

This is a note or seealso admonition

Summary

This is a summary or todo admonition

Info

This is an info or todo admonition

Tip

This is a tip, hint or important admonition

Success

This is a success, check or done admonition

Question

This is a question,help faq admonition

Warning

This is a warning, caution or attention admonition

Failure

This is a failure, fail or missing admonition

Danger

This is a danger or error admonition

Bug

This is a bug admonition

Quote

This is a quote or cite admonition

Cite

This is a cite admonition

"},{"location":"Instructions/ForAdministrators/#codehilite","title":"codehilite","text":"

The codehilite extension highlights code depending on the language.

"},{"location":"Instructions/ForAdministrators/#toc","title":"toc","text":"

The toc extension generates a table of contents, like the one at the right of this page.

"},{"location":"Instructions/ForAdministrators/#mkdocs-materials-theme","title":"MkDocs Materials theme","text":"

The Materials theme is built using Google's Material Design guidelines. It offers a unified experience across platforms. The look and feel is a familiar one.

"},{"location":"Instructions/ForAdministrators/#configuring-materials","title":"Configuring Materials","text":"

The materials theme is selected in the theme section of the mkdocs.yml file.

"},{"location":"Instructions/ForAdministrators/#google-analytics","title":"Google Analytics","text":"

Google Analytics tracks the site usage, providing lots of useful statistics. To have Google Analytics track web usage, you need to register the URL with the Google Analytics System. After registration, an HTML snippet is provided to include on every web page to be tracked.

"},{"location":"Instructions/ForAdministrators/#configuring-google-analytics","title":"Configuring Google Analytics","text":"

The google_analytics keyword in the mkdocs.yml file specifies the google analytics unique code for this web site. Currently commented out as this only applies to the old site.

The custom_theme/main.html file defines the metadata for the google site verification:

<meta name=\"google-site-verification\" content=\"nJqh3TVb_44fMl2gS61agt_bRNFEaI496UaXYL-wLZI\" />\n
"},{"location":"Instructions/ForAdministrators/#google-custom-search-engine","title":"Google Custom Search Engine","text":"

The overall look and feel are established at https://cse.google.com/cse/. After setting up the search engine, you can get the code to add to the web pages.

<script>\n  (function() {\n    var cx = '47656ffcafe2e7ab2';\n    var gcse = document.createElement('script');\n    gcse.type = 'text/javascript';\n    gcse.async = true;\n    gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;\n    var s = document.getElementsByTagName('script')[0];\n    s.parentNode.insertBefore(gcse, s);\n  })();\n</script>\n
"},{"location":"Instructions/ForAdministrators/#configuring-gcse","title":"Configuring GCSE","text":"

The code is added to custom_theme/main.html.

<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<gcse:searchbox-only>Search</gcse:searchbox-only>\n
"},{"location":"Instructions/ForAdministrators/#implementing-gcse","title":"Implementing GCSE","text":"

The search box is added to the web pages by adding the gcse search box html to custom_theme/partials/search.html.

    <gcse:searchbox-only>Search</gcse:searchbox-only>\n
"},{"location":"Instructions/ForAdministrators/#performance","title":"Performance","text":""},{"location":"Instructions/ForAdministrators/#lazy-image-loading","title":"Lazy Image Loading","text":"

The first implementation had problems loading the Cxx summary. The number of embedded images exceeded the throttle limits of Github. A lazy image load solution solved the problem. Now, images are only loaded if they appear in the browser window.

The Lazy Image Loading is implemented in javascript. The javascript is stored in custom_theme/main.html. It uses a clever trick. Images that should be lazy loaded use a tag with a class=lazy and attribute data_src. If the image is in the viewport, the data_src is removed, and the image renders.

"},{"location":"Instructions/ForAdministrators/#tiny-urls","title":"Tiny URLs","text":"

The web pages have many URL's that link to images and VTK doxygen pages. The long length of these URLs can increase page load times, especially on the language summary pages.

http://tinyurl.com provides a service to map the long URL's into shorted URLs. To speed up the process, we cache the long/short URLs in a file src/Cache/TestImages.cache in the local checkout of the web repository. ScrapeRepo.py uses this cache to only convert URLs that are not in the cache. ScrapeRepo.py updates the cache after each run.

"},{"location":"Instructions/ForAdministrators/#minify-html-pages","title":"Minify HTML pages","text":"

mkdocs generates HTML pages from the markdown files in doc in the local checkout of the web repository. These pages have lots of white space. We use the python package htmlmin to compress the generated HTML. The compressed pages are about 30% smaller after running htmlmin. We use the command line to process each site in the local checkout of the web repository.

htmlmin must be installed and can be installed using conda or pip

"},{"location":"Instructions/ForAdministrators/#administrator-tasks","title":"Administrator Tasks","text":"

They are

  • Vet new submissions making sure the guidelines are followed.
  • Merge and ...
  • Update web pages after new submissions by running src/SyncSiteWithRepo/py in the .

In order do do this, administrators need to clone the Web Repository and follow these Web Site Maintenance Instructions.

"},{"location":"Instructions/ForAdministrators/#some-notes-about-scraperepopy-and-syncsitewithreposh","title":"Some notes about ScrapeRepo.py and SyncSiteWithRepo.sh","text":""},{"location":"Instructions/ForAdministrators/#scraperepopy","title":"ScrapeRepo.py","text":"

Given a repo_dir, site_url, web_site_url, web_repo_url, web_repo_dir and a vtk_src_dir, ScrapeRepo.py proceeds as follows with all files being copied in the the Web Repository:

  1. Adds thumbnails to the Cxx.md, Python.md etc. summary pages. A thumbnail is added if a src/Testing/Baseline/LANG/TOPIC/TestEXAMPLE.png image exists for the example.

  2. Copies non-example .md files like Cxx.md and Python.md files to docs/.

  3. For each example source file create docs/LANG/TOPIC/EXAMPLE.md file that contains:

    1. If src/Testing/Baseline/LANG/TOPIC/TestEXAMPLE.png exists add the image
    2. If a src/LANG/TOPIC/EXAMPLE.md description file exists, insert the description
    3. Insert the source code from src/LANG/TOPIC/EXAMPLE.EXTENSION
  4. For each Cxx source file

    1. If Cxx/TOPIC/EXAMPLE.cmake exists, add it as the CMakeLists section of the .md file, otherwise, fill in the VTKCMakelists template, including the files listed in the optional src/Cxx/TOPIC/EXAMPLE.extras file.
  5. For each Cxx source file, create a src/Tarballs/EXAMPLE.tar file containing the source and CMakeLists.txt file.

"},{"location":"Instructions/ForAdministrators/#syncsitewithreposh","title":"SyncSiteWithRepo.sh","text":"
  1. Checks for a virtual environment called vtk-examples-web and activates it. This environment contains mkdocs-material and htmlmin. Installing mkdocs-material will automatically install compatible versions of all dependencies: MkDocs, Markdown, Pygments and Python Markdown Extensions.

    Note: There are instructions for how to setup the virtual environment in the header comments of the script.

  2. Copies across all needed files such as baseline images and other essential files like mkdocs.yml using rsync.

  3. Creates the coverage files

    The VTKClassesUsedInExamples.py python script generates two tables for each language. One table lists each class and what classes it uses. The second table lists the classes that are not used in any example.

  4. Wipes the docs and site directory

    The docs directory contains all of the md and HTML files for the site. A clean directory prevents old files from being used.

    The site directory contains all of the static html files for the site. A clean directory prevents old files from being used.

  5. Runs the ScrapeRepo.py python script.

    This script populates the docs directory.

  6. Checks for a successful scrape

    This sanity check sees if a reasonable number of files have been updated.

  7. Copies the style sheets and runs mkdocs to build the static website in the folder called site.

  8. Minifies the HTML

"},{"location":"Instructions/ForDevelopers/","title":"ForDevelopers","text":""},{"location":"Instructions/ForDevelopers/#developers","title":"Developers","text":"

The success of the VTK Examples depends on the contributions from the VTK user community. If you wish to contribute to this valuable resource, please follow these guidelines. If you are a VTK Example User, go here or an Example Administrator go here.

C++, C#, Python, Java and Trame examples are welcome! Examples should illustrate a single concept.

"},{"location":"Instructions/ForDevelopers/#follow-the-coding-guidelines","title":"Follow the Coding Guidelines","text":"

When you write an example, please follow the coding guidelines. Create the example in your local repository, compile and run it before you generate a pull request.

Tip

Look at existing examples that may be similar to your one in order to get an idea of layout, formatting conventions, file naming etc.

"},{"location":"Instructions/ForDevelopers/#setup-for-development","title":"Setup for Development","text":"

This assumes you have VTK, CMake, git and git lfs installed.

"},{"location":"Instructions/ForDevelopers/#fork-the-repository","title":"Fork the repository","text":"

Go to the VTK Examples Repository, sign in/register, and then fork the repository.

A fork is a copy of a project. Forking a repository allows you to make changes without affecting the original project.

"},{"location":"Instructions/ForDevelopers/#clone-the-vtk-examples-repository-onto-your-local-machine-and-build-it","title":"Clone the VTK examples repository onto your local machine and build it","text":"

If you are using SSH:

    git clone git@gitlab.kitware.com:<username>/vtk-examples.git\n

If You are using HTTPS:

    git clone https://gitlab.kitware.com/<username>/vtk-examples.git\n
"},{"location":"Instructions/ForDevelopers/#add-the-vtk-examples-repository-as-a-remote-called-upstream","title":"Add the vtk-examples repository as a remote called upstream","text":"
    cd vtk-examples\n    git remote add upstream https://gitlab.kitware.com/vtk/vtk-examples.git\n
"},{"location":"Instructions/ForDevelopers/#now-build-it","title":"Now build it","text":"
    cd vtk-examples\n    cd build\n    cmake -DVTK_DIR:PATH=YOUR_VTK_BIN_DIR -DBUILD_TESTING:BOOL=ON ..\n    make\n

where YOUR_VTK_BIN_DIR is the location of your VTK build.

"},{"location":"Instructions/ForDevelopers/#before-adding-your-examples","title":"Before adding your examples","text":"

Sync your repository with the vtk-examples repository. Remember that to run the following commands, you need to be in the vtk-examples directory.

    git fetch upstream\n    git switch master\n    git merge upstream/master\n    git push\n
  • Build the vtk-examples code
    cd vtk-examples\n    cd build\n    cmake -DVTK_DIR:PATH=YOUR_VTK_BIN_DIR -DBUILD_TESTING:BOOL=ON ..\n    make\n

where YOUR_VTK_BIN_DIR is the location of your VTK build.

"},{"location":"Instructions/ForDevelopers/#add-the-example","title":"Add the example","text":"

Create a branch in your repository

    git checkout -b MyNewExample\n

where MyNewExample is the name of your new example.

"},{"location":"Instructions/ForDevelopers/#choose-a-topic","title":"Choose a Topic","text":"

The examples are organized by topic.

  • For C++, Python Java, C#, current topics include Animation, DataStructures, Filters, GeometricObjects, Image, Meshes etc.

  • For Trame, current topics include Advanced, Applications, MiniApps etc.

"},{"location":"Instructions/ForDevelopers/#write-the-source","title":"Write the source","text":"
  • The following snippets may be of use:

  • Cxx available snippets.

  • Python available snippets.
  • Java available snippets.

  • Save your source code in vtk-examples/src/LANGUAGE/TOPIC/

    Where LANGUAGE is Cxx, Python, CSharp or Java and TOPIC is the topic that you have chosen.

  • Trame examples are a single folder and these are saved in vtk-examples/src/Trame/TOPIC/

"},{"location":"Instructions/ForDevelopers/#c","title":"C++","text":"
  • If you find relevant to add a WebAssembly preview to your example, follow this guide. If not, you have to add the name of your example to vtk-examples/src/Admin/exclude_wasm.txt to avoid the website build script from generating a link to an example that doesn't exist.

  • Build and test your example (NOTE: only for cxx examples)

        cd vtk-examples/build\n        cmake ..\n        make\n        ctest -V -R MyNewExample\n

Note: If MyNewExample is not built, then in the directory where you put the file, do:

    touch CMakeLists.txt\n
  • If your C++ example does any rendering, the test will fail the first time and create an image in vtk-examples/build/Testing/Temporary. The image will be called TestMyNewExample.png.

  • Copy the image into: vtk-examples/src/Testing/Baseline/LANG/TOPIC/. For Python and other languages, create an image with the proper name using a screen capture and copy that image into the proper location.

  • Rerun ctest and the test should pass.

At this point you are ready to push the changes to GitLab.

"},{"location":"Instructions/ForDevelopers/#python-java-and-c","title":"Python, Java and C","text":"

Please check the coding guidelines for Python code.

If you are basing your code on a Cxx example use the same name as the Cxx example. This ensures that automatic cross-referencing works.

Keep the same directory structure as that in Cxx.

  • Follow first three steps above.
  • Manually create a test image if your example does any rendering. The image should be called TestMyNewExample.png.

The following snippets can be used to write the image out:

  • WriteImage for Python
  • WriteImage for Java
"},{"location":"Instructions/ForDevelopers/#trame","title":"Trame","text":"

Create a folder called MyNewExample in vtk-examples/src/Trame/TOPIC/MyNewExample

If you have an image, either jpg or png, it must be named MyNewExample.jpg or MyNewExample.png. If both images exist the jpg one will be used.

If you want a description it must be named MyNewExample.md with the first two lines being:

### Description\n

Use markdown to format the description. Also look at existing files for layout ideas.

Then add your Trame file(s) to the folder.

Note

All Python files will be picked up and rendered on the web page. A tarball will be automatically generated and a link for downloading will be provided.

"},{"location":"Instructions/ForDevelopers/#add-the-example-to-the-language-page","title":"Add the example to the language page","text":"

Depending on the language of your example, edit the file Cxx.md, Python.md, CSharp.md, Java.md or Trame.md.

Find the section for your topic and add a line for your new example. The format of the line is:

[MyNewExample](LANG/TOPIC/MyNewExample) | short description\n

where LANG is one of Cxx, Python, CSharp, Java or Trame.

If an image exists, it will be automatically picked up.

"},{"location":"Instructions/ForDevelopers/#commit-your-changes-to-your-topic-branch","title":"Commit your changes to your topic branch","text":"
git add MyNewExample.cxx\n

and if you have a baseline image,

git add Testing/Baseline/LANG/TOPIC/TestMyNewExample.png\n

finally,

git commit\n
"},{"location":"Instructions/ForDevelopers/#push-the-changes-to-gitlab","title":"Push the changes to GitLab","text":"
git push origin MyNewExample\n
"},{"location":"Instructions/ForDevelopers/#go-to-your-gitlab-project","title":"Go to your GitLab project","text":"

Then generate a merge request for review.

See here for how to generate a merge request.

"},{"location":"Instructions/ForDevelopers/#advanced-usage","title":"Advanced usage","text":""},{"location":"Instructions/ForDevelopers/#add-a-description","title":"Add a description","text":"

If your example could benefit from an extended description, you can create a file MyNewExample.md. Store the file alongside your source code. Use markdown to format the description. Also look at existing files for layout ideas.

The first two lines must be:

### Description\n

In the markdown file any references to the vtk classes will be automatically converted to HTML links in the final documentation. This will cause problems when a VTK class name is used in a reference or when there are non-existent links in the documentation. To circumvent this just surround the vtk object with two question marks, for example: ?vtkTypeFloat32Array?.

"},{"location":"Instructions/ForDevelopers/#add-arguments-to-the-test","title":"Add arguments to the test","text":"

If your example requires arguments, you will need to edit the CMakeLists.txt in the topic directory.

  • Add the name of your example to the NEEDS_ARGS variable

  • Add an ADD_TEST line. See other CMakeLists.txt files for examples.

"},{"location":"Instructions/ForDevelopers/#add-extra-files-to-a-c-example","title":"Add extra files to a C++ example","text":"

Most C++ examples consist of one file. If other files are required, place them in the same directory as the example. Then add a file with the same prefix as the example name and a .extras suffix. List each extra filename in the .extras file, one filename per line.

Warning

If you add extra files to the example, but do not add their filenames to the .extras file, they will appear in the left-hand file menus and will not be included in the tar file for the example.

"},{"location":"Instructions/ForUsers/","title":"ForUsers","text":""},{"location":"Instructions/ForUsers/#users","title":"Users","text":"

This assumes you have VTK, CMake, git and git lfs installed.

If you want to use the examples repository VTK Examples, you have several options:

  • If you want to add/update examples: go here
  • Users: Read the following instructions.
"},{"location":"Instructions/ForUsers/#build-an-example","title":"Build an example","text":"

For C++ examples, go to the bottom of the page for the example that you have selected and read the instructions on how to build the example. A *.tar file is provided with the code, a CMake file and a build directory. Additionally, if there are examples in other languages, these are provided also.

For other languages, you can copy the code to your clipboard and paste into your favourite editor.

"},{"location":"Instructions/ForUsers/#build-all-of-the-examples","title":"Build all of the examples","text":"

If you are getting excited about learning VTK and are tired of downloading individual examples, you can build them all.

Go to the VTK Examples and you can:

  • Download the repository and untar or unzip it as needed into a folder called vtk-examples. Then go to the folder and:
   cd vtk-examples\n   cd build\n   cmake -DVTK_DIR:PATH=YOUR_VTK_BIN_DIR -DBUILD_TESTING:BOOL=ON ..\n   make\n

where YOUR_VTK_BIN_DIR is the location of your VTK build.

  • Clone the VTK examples repository:
   git clone https://gitlab.kitware.com/vtk/vtk-examples.git\n   cd vtk-examples\n   cd build\n   cmake -DVTK_DIR:PATH=YOUR_VTK_BIN_DIR -DBUILD_TESTING:BOOL=ON ..\n   make\n

where YOUR_VTK_BIN_DIR is the location of your VTK build.

"},{"location":"Instructions/ForUsers/#update-the-examples-repository","title":"Update the examples repository","text":"

From now on, if you cloned the examples repository, you can get the latest updates:

cd vtk-examples\ngit pull --rebase\ncd build\ncmake ../vtk-examples\nmake\n
"},{"location":"Instructions/ForUsers/#run-all-of-the-examples","title":"Run all of the examples","text":"
ctest\n
"},{"location":"Instructions/Guidelines/","title":"Guidelines","text":""},{"location":"Instructions/Guidelines/#guidelines","title":"Guidelines","text":"

Although education of new users is the main motivation, the VTK Examples should also:

  1. Encourage good programming style
  2. Promote the proper and modern way to use VTK and write VTK programs
  3. Facilitate the nightly compilation and testing of examples that reside in the VTK Examples repository.

These requirements must be met without compromising the main goal of user education.

"},{"location":"Instructions/Guidelines/#guidelines-for-each-language","title":"Guidelines for each language","text":"

All examples should follow the VTK programming style and there should be a single blank line at the end of the example

"},{"location":"Instructions/Guidelines/#c","title":"C++","text":"
  • The indentation style can be characterized as the AllmannStyle. The curly brace (scope delimiter) is on a separate line and aligns with the control statement. The control block is indented by two spaces (no tabs). A suitable .clang-format is provided in src/Cxx. Most IDE's can be be configured to use this file for formatting. See clang-format for more information.

    Example:

    if (this->Locator == locator)\n    {\n      return;\n    }\n    for (i = 0; i < this->Source->GetNumberOfPoints(); i++)\n    {\n      p1 = this->Source->GetPoint(i);\n      [...]\n    }\n
  • Where appropriate, explicitly use the std:: namespace:
    std::cout << \"Print something\" << std::endl;\n

rather than

    cout << \"Print something\" << endl;\n
  • All includes from the toolkit should use <...> notation. This follows C++ programming conventions.

    For example: #include <vtkContourFilter.h> is preferred over #include \"vtkContourFilter.h\"

  • The main program must have the following signature:

    int main (int argc, char *argv[])\n

or, if argc and argv are not referenced in the code,

    int main (int, char *[])\n
  • If arguments are required, a check similar to the following should be made at the start of the main program.
  float alpha = 0.5;\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtp [alpha] e.g. Bunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  if (argc > 2)\n  {\n    alpha = atof(argv[2]);\n  }\n
  • An example should never call exit(). If the main program executes successfully, it should
    return EXIT_SUCCESS;\n

otherwise

    return EXIT_FAILURE;\n
  • The use of SmartPointers is preferred in VTK examples, generally use vtkNew and only use vtkSmartPointerwhere appropriate.
    vtkNew<vtkCutter> cutter;\n

or (where needed)

    auto cutter = vtkSmartPointer<vtkCutter>::New();\n
  • When building pipelines, the new SetInputConnection(), GetOutputPort() methods should be used.

  • Input/Output filenames

    When possible, filenames should be passed on the command line. This gives the examples utility beyond the data that is used in the specific example.

  • If there are just a few parameters for the example, these should be passed in as arguments. This increases the utility of the example and facilitates testing.

    For example, this program

    Delaunay3D InputPolydataFileName(.vtp) Alpha\n
would use the arguments in this manner\n
    reader->SetFileName (argv[1]);\n    delaunay3D->SetAlpha(atof(argv[2]));\n
  • Always provide a background for the renderers. Avoid setting the background to white.

  • Use vtkNamedColors for setting colors of actors and renderer backgrounds. VTKNamedColorPatches shows the colors that are available. If you are using a color series, then you can choose what you want from here VTKColorSeriesPatches.

For example,

  #include <vtkNamedColors.h>\n\n  int main(int, char*[])\n  {\n\n    vtkNew<vtkNamedColors> namedColors;\n\n    renderer->SetBackground(namedColors->GetColor3d(\"Khaki\").GetData());\n

is preferred over

    renderer->SetBackground(0.9412, 0.9020, 0.5490);\n
  • Use admonitions to warn/cite/info, etc. Here is a summary of admonitions.
"},{"location":"Instructions/Guidelines/#python","title":"Python","text":"

In general, Python submissions should follow the VTK Programming style and the comments outlined for C++ above (with language appropriate modifications).

Python code styling follows PEP 8 -- Style Guide for Python Code.

Python code is tested in a similar manner to C++ code, so it must follow this layout:

#!/usr/bin/env python\n\nimport vtkmodules.all as vtk\n\ndef main(argv):\n    \"\"\"\n    Get parameters (if needed)\n    Instantiate your classes, call them and any defs.\n    \"\"\"\n\n\nif __name__ == '__main__':\n    import sys\n    main(sys.argv)\n

Use argparse where needed:

#!/usr/bin/env python\n\nimport vtkmodules.all as vtk\n\n\ndef main(argv):\n    xyz_fn, q_fn = get_program_parameters(argv)\n    colors = vtk.vtkNamedColors()\n\n    # Do the work\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Some description.'\n    epilogue = '''\n    Extra information.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('xyz_filename', help='combxyz.bin.')\n    parser.add_argument('q_filename', help='combq.bin.')\n    args = parser.parse_args()\n    return args.xyz_filename, args.q_filename\n\n\nif __name__ == '__main__':\n    # import sys\n    main(sys.argv)\n

For the Input/Output of filenames and parameters. Use this snippet GetProgramParameters.

It you do not know what vtk modules and classes you need use:

import vtkmodules.all as vtk\n

instead of:

from vtkmodules.<SomeVTKModule> import <SomeVTKClass>\n
"},{"location":"Instructions/Guidelines/#generatingediting-import-statements","title":"Generating/Editing Import Statements","text":"

Finally, when you are happy with everything, make sure only the requisite VTK classes and constants that you are using in your code are loaded when your program runs. To do this, run your code through VTKImportsForPython, it will analyse your code producing a list of import statements for you.

At the end of the list that is produced, there are a series of commented out statements consisting of imports that you may need to enable. Only enable the ones you really need and include the statement # noinspection PyUnresolvedReferences for PyCharm users, as this will prevent the statement from being removed.

e.g The most common ones will be:

# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n

Remove any unused ones.

"},{"location":"Instructions/Guidelines/#java","title":"Java","text":"

In general, Java submissions should follow the VTK Programming style and the comments outlined for C++ above (with language appropriate modification).

For Java code layout, look at CylinderExample

Java code styling follows the usual style as implemented in the IDEs.

However note:

  • No Tabs
"},{"location":"Instructions/WebSiteMaintenance/","title":"WebSiteMaintenance","text":""},{"location":"Instructions/WebSiteMaintenance/#maintaining-the-github-web-site","title":"Maintaining the GitHub web site","text":"

This website will just contain the web files and any files needed by them. The repository from which these files are generated is your fork of the VTK Examples Repository. For this discussion we are assuming that you have cloned your fork of this site into a repository called vtk-examples.

"},{"location":"Instructions/WebSiteMaintenance/#setup-for-updating-the-web-pages","title":"Setup for Updating the Web Pages","text":"

This assumes you have VTK, CMake, git, git lfs, mkdocs, pygments and htmlmin installed along with the checkout of your fork of the VTK Examples Repository.

"},{"location":"Instructions/WebSiteMaintenance/#fork-the-repository","title":"Fork the repository","text":"

Go to the VTK Examples Web Site Repository sign in/register, and then fork the repository.

A fork is a copy of a project. Forking a repository allows you to make changes without affecting the original project.

If you want to see what your build of the web pages will look like, go to your settings. Then scroll down until you find GitHub Pages and set the Source Branch to gh-pages.

"},{"location":"Instructions/WebSiteMaintenance/#clone-the-vtk-examples-web-site-repository","title":"Clone the VTK Examples Web Site Repository","text":"
git clone git@github.com:<github_username>/vtk-examples.git vtk-examples-web\ncd vtk-examples-web\n
"},{"location":"Instructions/WebSiteMaintenance/#add-the-vtk-examples-web-site-repository-as-a-remote-called-upstream","title":"Add the VTK Examples Web Site Repository as a remote called upstream","text":"
cd vtk-examples-web\ngit remote add upstream https://github.com/Kitware/vtk-examples\n
"},{"location":"Instructions/WebSiteMaintenance/#updating-web-pages","title":"Updating web pages","text":"

For this discussion we are assuming a directory structure something like this:

|--\n  |-- VTK               # The VTK Source files\n  |-- vtk-examples      # The VTK Examples source files\n  |-- vtk-examples-web  # The VTK Examples Web Source files\n
"},{"location":"Instructions/WebSiteMaintenance/#step-1-sync-your-vtk-examples-repository","title":"Step 1: Sync your vtk-examples repository","text":"

Remember that to run the following commands, you need to be in your vtk-examples folder.

cd vtk-examples\ngit fetch upstream\ngit switch master\ngit merge upstream/master\ngit push\n

Note: You can use your own unmerged branch here but do not submit a merge request as it will be out of sync with the vtk-examples master.

"},{"location":"Instructions/WebSiteMaintenance/#step-2-sync-your-vtk-examples-web-repository-and-checkout-gh-pages","title":"Step 2: Sync your vtk-examples-web repository and checkout gh-pages","text":"

Sync your repository with the VTK Examples Web Site Repository. Remember that to run the following commands, you need to be in your vtk-examples-web folder.

cd vtk-examples-web\ngit fetch upstream\ngit switch master\ngit merge upstream/master\ngit push\ngit switch gh-pages\n

Note: If you are doing this for the first time replace: git switch gh-pages with git switch -c gh-pages --track origin/gh-pages

Important: You must be on the gh-pages branch in vtk-examples-web before doing the next steps. So remember to do git switch gh_pages!

"},{"location":"Instructions/WebSiteMaintenance/#step-3-build-the-web-site","title":"Step 3: Build the web site","text":"

Go to the vtk-examples folder, ensure that the file mkdocs.yml has the correct parameters.

Then in the top-level folder of vtk-examples:

../src/SyncSiteWithRepo.sh SITE_URL WEB_SITE_URL WEB_REPO_URL WEB_DIR VTK_SOURCE_DIR\n

where:

  • SITE_URL is the VTK Examples source repository URL, e.g. https://gitlab.kitware.com/vtk/vtk-examples
  • WEB_SITE_URL is the VTK Examples website site URL, e.g. https://examples.vtk.org/site/
  • WEB_REPO_URL is the VTK Examples website source URL, e.g. https://github.com/Kitware/vtk-examples
  • WEB_REPO_DIR is the local website source dir, e.g. local_path/vtk-examples-web
  • VTK_DIR is the local VTK source directory, e.g. local_path/VTK

Remember that local paths are absolute or full paths, not relative paths.

Then, once this script finishes:

"},{"location":"Instructions/WebSiteMaintenance/#step-4-verify-that-the-site-works","title":"Step 4: Verify that the site works","text":"

Go to the folder mentioned in the instructions at the end of the script and verify that the site works.

"},{"location":"Instructions/WebSiteMaintenance/#step-5-commit-add-and-push","title":"Step 5: Commit, Add and Push","text":"
git status\ngit commit -a -m\"Updating files\"\ngit push\n

If there are new files:

git status\ngit add <The files>\ngit commit -m\"Adding new files\"\ngit push\n
"},{"location":"Instructions/WebSiteMaintenance/#step-6-check-it-all-works","title":"Step 6: Check it all works","text":"

Verify that the links etc. are OK on https://<username>.github.io/vtk-examples/site/

Do not submit a merge request. This needs to be done by an admisistrator.

"},{"location":"Instructions/WebSiteMaintenance/#step-7-for-administrators","title":"Step 7: For Administrators","text":"

If you are an administrator and:

  • You had checked out the master in step 1.
  • The web site https://<username>.github.io/vtk-examples/site/ is OK with all the links etc. working.

Then go to your fork https://github.com/<username>/vtk-examples and submit a merge request.

"},{"location":"Java/Snippets/","title":"Snippets","text":""},{"location":"Java/Snippets/#description","title":"Description","text":"

Snippets are chunks of code that can be cut (snipped) and pasted into examples. We want each example to be stand-alone, so we do not keep the snippet code in a library.

"},{"location":"Java/Snippets/#available-snippets","title":"Available snippets","text":""},{"location":"Java/Snippets/#writeimage","title":"WriteImage","text":"

Take a screen shot and save it to a file.

"},{"location":"Java/Annotation/MultiLineText/","title":"MultiLineText","text":"

vtk-examples/Java/Annotation/MultiLineText

"},{"location":"Java/Annotation/MultiLineText/#description","title":"Description","text":"

This example demonstrates the use of multiline 2D text using vtkTextMapper. It shows several justifications as well as single-line and multiple-line text inputs.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Annotation/MultiLineText/#code","title":"Code","text":"

MultiLineText.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkTextProperty;\nimport vtk.vtkTextMapper;\nimport vtk.vtkActor2D;\nimport vtk.vtkPoints;\nimport vtk.vtkCellArray;\nimport vtk.vtkNamedColors;\nimport vtk.vtkCoordinate;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper2D;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\n\npublic class MultiLineText  \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static\n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For singleLineTextB Actor Color\n    double singleLineTextActorBColor[] = new double[4];\n    //For singleLineTextActorC Color\n    double singleLineTextActorCColor[] = new double[4];\n    //For singleLineTextActorT Color\n    double singleLineTextActorTColor[] = new double[4];\n    //For textMapperLColor\n    double textMapperLColor[] = new double[4];\n    //For textMapperCColor\n    double textMapperCColor[] = new double[4];\n    //For textMapperRColor\n    double textMapperRColor[] = new double[4];\n    //For gridActor\n    double Grid_Actor[] = new double[4];\n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color to singleLineTextActorB Color\n    Color.GetColor(\"IndianRed\",singleLineTextActorBColor);\n    //Change Color Name to Use your own Color to singleLineTextActorC  Color\n    Color.GetColor(\"DarkBlue\",singleLineTextActorCColor);\n    //Change Color Name to Use your own Color to singleLineTextActorT  Color\n    Color.GetColor(\"Maroon\",singleLineTextActorTColor);\n    //Change Color Name to Use your own Color to textMapperLColor\n    Color.GetColor(\"Crimson\",textMapperLColor);\n    //Change Color Name to Use your own Color to textMapperCColor\n    Color.GetColor(\"Black\",textMapperCColor);\n    //Change Color Name to Use your own Color to textMapperRColor\n    Color.GetColor(\"Navy\",textMapperRColor);\n    //Change Color Name to Use your own Color to textMapperRColor\n    Color.GetColor(\"DimGray\",Grid_Actor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"BlanchedAlmond\",BgColor);\n\n\n    vtkTextProperty singleLineTextProp = new vtkTextProperty();\n    singleLineTextProp.SetFontSize(24);\n    singleLineTextProp.SetFontFamilyToArial();\n    singleLineTextProp.BoldOff();\n    singleLineTextProp.ItalicOff();\n    singleLineTextProp.ShadowOff();\n\n    vtkTextProperty multiLineTextProp = new vtkTextProperty();\n    multiLineTextProp.ShallowCopy(singleLineTextProp);\n    multiLineTextProp.BoldOn();\n    multiLineTextProp.ItalicOn();\n    multiLineTextProp.ShadowOn();\n    multiLineTextProp.SetLineSpacing(0.8);\n\n    vtkTextMapper singleLineTextB = new vtkTextMapper();\n    singleLineTextB .SetInput(\"Single Line(Bottom)\");\n    singleLineTextB.GetTextProperty().ShallowCopy(singleLineTextProp);\n    singleLineTextB.GetTextProperty().SetVerticalJustificationToBottom();\n    singleLineTextB .GetTextProperty().SetColor(singleLineTextActorBColor);\n\n    vtkActor2D singleLineTextActorB = new vtkActor2D();\n    singleLineTextActorB.SetMapper(singleLineTextB);\n    singleLineTextActorB.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    singleLineTextActorB.GetPositionCoordinate().SetValue(0.05, 0.85);\n\n\n    vtkTextMapper singleLineTextC = new vtkTextMapper();\n    singleLineTextC .SetInput(\"Single Line(centered)\");\n    singleLineTextC.GetTextProperty().ShallowCopy(singleLineTextProp);\n    singleLineTextC.GetTextProperty().SetVerticalJustificationToCentered();\n    singleLineTextC .GetTextProperty().SetColor(singleLineTextActorCColor);\n\n    vtkActor2D singleLineTextActorC = new vtkActor2D();\n    singleLineTextActorC.SetMapper(singleLineTextC);\n    singleLineTextActorC.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    singleLineTextActorC.GetPositionCoordinate().SetValue(0.05, 0.75);\n\n    vtkTextMapper singleLineTextT = new vtkTextMapper();\n    singleLineTextT .SetInput(\"Single Line(Top)\");\n    singleLineTextT.GetTextProperty().ShallowCopy(singleLineTextProp);\n    singleLineTextT.GetTextProperty().SetVerticalJustificationToTop();\n    singleLineTextT .GetTextProperty().SetColor(singleLineTextActorTColor);\n\n    vtkActor2D singleLineTextActorT = new vtkActor2D();\n    singleLineTextActorT.SetMapper(singleLineTextT);\n    singleLineTextActorT.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    singleLineTextActorT.GetPositionCoordinate().SetValue(0.05, 0.65);  \n\n    vtkTextMapper textMapperL = new vtkTextMapper();\n    textMapperL .SetInput(\"This is\\nmulti-line\\ntext output\\n(left-top)\");\n    textMapperL.GetTextProperty().ShallowCopy(multiLineTextProp);\n    textMapperL.GetTextProperty().SetJustificationToLeft();\n    textMapperL.GetTextProperty().SetVerticalJustificationToTop();\n    textMapperL .GetTextProperty().SetColor(textMapperLColor);\n\n    vtkActor2D textActorL = new vtkActor2D();\n    textActorL.SetMapper(textMapperL);\n    textActorL.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    textActorL.GetPositionCoordinate().SetValue(0.05, 0.5);\n\n    vtkTextMapper textMapperC = new vtkTextMapper();\n    textMapperC .SetInput(\"This is\\nmulti-line\\ntext output\\n(centered)\");\n    textMapperC.GetTextProperty().ShallowCopy(multiLineTextProp);\n    textMapperC.GetTextProperty().SetJustificationToCentered();\n    textMapperC.GetTextProperty().SetVerticalJustificationToCentered();\n    textMapperC .GetTextProperty().SetColor(textMapperCColor);\n\n    vtkActor2D textActorC = new vtkActor2D();\n    textActorC.SetMapper(textMapperC);\n    textActorC.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    textActorC.GetPositionCoordinate().SetValue(0.5, 0.5);\n\n    vtkTextMapper textMapperR = new vtkTextMapper();\n    textMapperR .SetInput(\"This is\\nmulti-line\\ntext output\\n(right-bottom)\");\n    textMapperR.GetTextProperty().ShallowCopy(multiLineTextProp);\n    textMapperR.GetTextProperty().SetJustificationToRight();\n    textMapperR.GetTextProperty().SetVerticalJustificationToBottom();\n    textMapperR .GetTextProperty().SetColor(textMapperRColor);\n\n    vtkActor2D textActorR = new vtkActor2D();\n    textActorR.SetMapper(textMapperR);\n    textActorR.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    textActorR.GetPositionCoordinate().SetValue(0.95, 0.5);\n\n    vtkPoints Pts = new vtkPoints();\n    Pts.InsertNextPoint(0.05, 0.0, 0.0);\n    Pts.InsertNextPoint(0.05, 1.0, 0.0);\n    Pts.InsertNextPoint(0.5, 0.0, 0.0);\n    Pts.InsertNextPoint(0.5, 1.0, 0.0);\n    Pts.InsertNextPoint(0.95, 0.0, 0.0);\n    Pts.InsertNextPoint(0.95, 1.0, 0.0);\n    Pts.InsertNextPoint(0.0, 0.5, 0.0);\n    Pts.InsertNextPoint(1.0, 0.5, 0.0);\n    Pts.InsertNextPoint(0.00, 0.85, 0.0);\n    Pts.InsertNextPoint(0.50, 0.85, 0.0);\n    Pts.InsertNextPoint(0.00, 0.75, 0.0);\n    Pts.InsertNextPoint(0.50, 0.75, 0.0);\n    Pts.InsertNextPoint(0.00, 0.65, 0.0);\n    Pts.InsertNextPoint(0.50, 0.65, 0.0);\n\n    vtkCellArray Lines = new vtkCellArray();\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(0);\n    Lines.InsertNextCell(1);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(3);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(4);\n    Lines.InsertNextCell(5);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(6);\n    Lines.InsertNextCell(7);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(8);\n    Lines.InsertNextCell(9);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(10);\n    Lines.InsertNextCell(11);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(12);\n    Lines.InsertNextCell(13);\n\n    vtkPolyData Grid = new vtkPolyData();\n    Grid.SetPoints(Pts);\n    Grid.SetLines(Lines);\n\n    vtkCoordinate normCoords = new vtkCoordinate();\n    normCoords.SetCoordinateSystemToNormalizedViewport();\n\n    vtkPolyDataMapper2D Mapper = new vtkPolyDataMapper2D();\n    Mapper.SetInputData(Grid);\n    Mapper.SetTransformCoordinate(normCoords);\n\n    vtkActor2D GridActor = new vtkActor2D();\n    GridActor.SetMapper(Mapper);\n    GridActor.GetProperty().SetColor(Grid_Actor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor2D(textActorL);\n    ren.AddActor2D(textActorC);\n    ren.AddActor2D(textActorR);\n    ren.AddActor2D(singleLineTextActorB);\n    ren.AddActor2D(singleLineTextActorC);\n    ren.AddActor2D(singleLineTextActorT);\n    ren.AddActor2D(GridActor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(500,500);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
"},{"location":"Java/Annotation/TextOrigin/","title":"TextOrigin","text":"

vtk-examples/Java/Annotation/TextOrigin

"},{"location":"Java/Annotation/TextOrigin/#description","title":"Description","text":"

This example demonstrates the use of vtkVectorText and vtkFollower. vtkVectorText is used to create 3D annotation. vtkFollower is used to position the 3D text and to ensure that the text always faces the renderer's active camera (i.e., the text is always readable).

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Annotation/TextOrigin/#code","title":"Code","text":"

TextOrigin.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkActor;\nimport vtk.vtkAxes;\nimport vtk.vtkVectorText;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkFollower;\nimport vtk.vtkNamedColors;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\n\npublic class TextOrigin  {\n  // private static final long serialVersionUID = 1L;\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) {\n\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Text Actor Color\n    double TextActorColor[] = new double[4];\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"IndianRed\",TextActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"LightGrey\",BgColor);\n\n\n    // Create the axes and the associated mapper and actor.\n    vtkAxes Axes = new vtkAxes();\n    Axes.SetOrigin(0, 0, 0);\n\n    vtkPolyDataMapper AxesMapper = new vtkPolyDataMapper();\n    AxesMapper.SetInputConnection(Axes.GetOutputPort());\n\n    vtkActor AxesActor = new vtkActor();\n    AxesActor.SetMapper(AxesMapper);\n\n    // Create the 3D text and the associated mapper and follower (a type of actor).  \n    //Position the text so it is displayed over the origin of the axes.\n    vtkVectorText aText = new vtkVectorText();\n    aText.SetText(\"Origin\");\n\n\n    vtkPolyDataMapper TextMapper = new vtkPolyDataMapper();\n    TextMapper.SetInputConnection(aText.GetOutputPort());\n\n\n    vtkFollower TextActor = new vtkFollower();\n    TextActor.SetMapper(TextMapper);\n    TextActor.SetScale(0.2, 0.2, 0.2);\n    TextActor.AddPosition(0, -0.1, 0);\n    TextActor.GetProperty().SetColor(TextActorColor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(TextActor);\n    ren.AddActor(AxesActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n    ren.GetActiveCamera().Zoom(1.6);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
"},{"location":"Java/CompositeData/CompositePolyDataMapper/","title":"CompositePolyDataMapper","text":"

vtk-examples/Java/CompositeData/CompositePolyDataMapper

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/CompositeData/CompositePolyDataMapper/#code","title":"Code","text":"

CompositePolyDataMapper.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkMultiBlockDataSet;\nimport vtk.vtkCompositePolyDataMapper2;\nimport vtk.vtkCompositeDataDisplayAttributes;\nimport vtk.vtkNamedColors;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\n\n\npublic class CompositePolyDataMapper  {\n  //private static final long serialVersionUID = 1L;\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Red\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",BgColor);\n\n\n    vtkSphereSource Sphere1 = new vtkSphereSource();\n    Sphere1.SetRadius(3);\n    Sphere1.SetCenter(0, 0, 0);\n    Sphere1.Update();\n\n    vtkSphereSource Sphere2 = new vtkSphereSource();\n    Sphere2.SetRadius(2);\n    Sphere2.SetCenter(2, 0, 0);\n    Sphere2.Update();\n\n    vtkMultiBlockDataSet MBDS = new vtkMultiBlockDataSet();\n    MBDS.SetNumberOfBlocks(3);\n    MBDS.SetBlock(0, Sphere1.GetOutput());\n    // Leave block 1 NULL.  \n    //NULL blocks are valid and should be handled by algorithms that process multiblock datasets.  \n    //Especially when running in parallel where the blocks owned by other processes are NULL in this process\n    MBDS.SetBlock(2, Sphere2.GetOutput());\n\n    vtkCompositePolyDataMapper2 Mapper = new vtkCompositePolyDataMapper2();\n    Mapper.SetInputDataObject(MBDS);\n\n\n    vtkCompositeDataDisplayAttributes CDSA = new vtkCompositeDataDisplayAttributes();\n    Mapper.SetCompositeDataDisplayAttributes(CDSA);\n    // You can use the vtkCompositeDataDisplayAttributes to set the color,\n    // opacity and visibiliy of individual blocks of the multiblock dataset.\n    // Attributes are mapped by block pointers (vtkDataObject*), so these can\n    // be queried by their flat index through a convenience function in the\n    // attribute class (vtkCompositeDataDisplayAttributes::DataObjectFromIndex).\n    // Alternatively, one can set attributes directly through the mapper using\n    // flat indices.\n    // This sets the block at flat index 3 red\n    // Note that the index is the flat index in the tree, so the whole multiblock\n    // is index 0 and the blocks are flat indexes 1, 2 and 3.  This affects\n    // the block returned by mbds->GetBlock(2)\n    Mapper.SetBlockColor(3, ActorColor);\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
"},{"location":"Java/Coverage/JavaVTKClassesNotUsed/","title":"VTK Classes not used in the Examples","text":""},{"location":"Java/Coverage/JavaVTKClassesNotUsed/#java","title":"Java","text":"

Out of 3113 available VTK classes, 2840 have not been used.

VTK Class VTK Class VTK Class VTK Class VTK Class vtk2DHistogramItem vtk3DCursorRepresentation vtk3DCursorWidget vtk3DLinearGridCrinkleExtractor vtk3DLinearGridInternal vtk3DLinearGridPlaneCutter vtk3DWidget vtkABI vtkADIOS2CoreImageReader vtkADIOS2VTXReader vtkAMRBaseParticlesReader vtkAMRBaseReader vtkAMRBox vtkAMRCutPlane vtkAMRDataInternals vtkAMRDataSetCache vtkAMREnzoParticlesReader vtkAMREnzoReader vtkAMREnzoReaderInternal vtkAMRFlashParticlesReader vtkAMRFlashReader vtkAMRFlashReaderInternal vtkAMRGaussianPulseSource vtkAMRInformation vtkAMRInterpolatedVelocityField vtkAMRResampleFilter vtkAMRSliceFilter vtkAMRToMultiBlockFilter vtkAMRUtilities vtkAMRVelodyneReader vtkAMRVelodyneReaderInternal vtkAMRVolumeMapper vtkAMReXGridHeader vtkAMReXGridLevelHeader vtkAMReXGridReader vtkAMReXGridReaderInternal vtkAMReXParticlesReader vtkAOSDataArrayTemplate vtkASCIITextCodec vtkAVIWriter vtkAVSucdReader vtkAbstractArray vtkAbstractCellArray vtkAbstractCellLinks vtkAbstractCellLocator vtkAbstractContextBufferId vtkAbstractContextItem vtkAbstractElectronicData vtkAbstractGridConnectivity vtkAbstractHyperTreeGridMapper vtkAbstractImageInterpolator vtkAbstractInteractionDevice vtkAbstractInterpolatedVelocityField vtkAbstractMapper vtkAbstractMapper3D vtkAbstractParticleWriter vtkAbstractPicker vtkAbstractPointLocator vtkAbstractPolyDataReader vtkAbstractPolygonalHandleRepresentation3D vtkAbstractPropPicker vtkAbstractRenderDevice vtkAbstractSplineRepresentation vtkAbstractTransform vtkAbstractVolumeMapper vtkAbstractWidget vtkActor2DCollection vtkActorNode vtkAdaptiveDataSetSurfaceFilter vtkAdaptiveResampleToImage vtkAdaptiveSubdivisionFilter vtkAdaptiveTemporalInterpolator vtkAddMembershipArray vtkAdjacencyMatrixToEdgeTable vtkAdjacentVertexIterator vtkAffineRepresentation vtkAffineRepresentation2D vtkAffineWidget vtkAggregateDataSetFilter vtkAggregateToPartitionedDataSetCollection vtkAlembicExporter vtkAlgorithm vtkAlgorithmOutput vtkAlignImageDataSetFilter vtkAmoebaMinimizer vtkAnariActorNode vtkAnariCameraNode vtkAnariCompositePolyDataMapperNode vtkAnariFollowerNode vtkAnariLightNode vtkAnariPass vtkAnariPolyDataMapperNode vtkAnariProfiling vtkAnariRendererNode vtkAnariTestInteractor vtkAnariViewNodeFactory vtkAnariVolumeInterface vtkAnariVolumeMapper vtkAnariVolumeMapperNode vtkAnariVolumeNode vtkAnariWindowNode vtkAndroidOutputWindow vtkAndroidRenderWindowInteractor vtkAngleRepresentation vtkAngleRepresentation3D vtkAngularPeriodicDataArray vtkAngularPeriodicFilter vtkAnimateModes vtkAnimationCue vtkAnimationScene vtkAnnotation vtkAnnotationLayers vtkAnnotationLayersAlgorithm vtkAppendArcLength vtkAppendCompositeDataLeaves vtkAppendDataSets vtkAppendFilter vtkAppendLocationAttributes vtkAppendPartitionedDataSetCollection vtkAppendPoints vtkAppendSelection vtkApplyColors vtkApplyIcons vtkApproximatingSubdivisionFilter vtkArcGridActorPrivate vtkArcParallelEdgeStrategy vtkArcPlotter vtkArcSource vtkArchiver vtkAreaContourSpectrumFilter vtkAreaLayout vtkAreaLayoutStrategy vtkAreaPicker vtkArray vtkArrayCalculator vtkArrayCoordinates vtkArrayData vtkArrayDataAlgorithm vtkArrayDataReader vtkArrayDataWriter vtkArrayDispatch vtkArrayExtents vtkArrayExtentsList vtkArrayInterpolate vtkArrayIterator vtkArrayIteratorIncludes vtkArrayIteratorTemplate vtkArrayListTemplate vtkArrayNorm vtkArrayPrint vtkArrayRange vtkArrayReader vtkArrayRename vtkArrayRenderer vtkArraySort vtkArrayToTable vtkArrayWeights vtkArrayWriter vtkAssemblyNode vtkAssemblyPath vtkAssemblyPaths vtkAssignAttribute vtkAssignCoordinates vtkAssignCoordinatesLayoutStrategy vtkAtom vtkAtomicMutex vtkAttributeClustering2DLayoutStrategy vtkAttributeDataToFieldDataFilter vtkAttributeDataToTableFilter vtkAttributeSmoothingFilter vtkAttributesErrorMetric vtkAutoCorrelativeStatistics vtkAvatar vtkAxesTransformRepresentation vtkAxesTransformWidget vtkAxis vtkAxisActor vtkAxisActor2D vtkAxisActor2DMock vtkAxisExtended vtkAxisFollower vtkAxisGridActorPrivate vtkBMPWriter vtkBSPCuts vtkBSPIntersections vtkBSplineTransform vtkBTSReader vtkBYUReader vtkBYUWriter vtkBackgroundColorMonitor vtkBandedPolyDataContourFilter vtkBarChartActor vtkBase64InputStream vtkBase64OutputStream vtkBase64Utilities vtkBatchedSurfaceLICMapper vtkBatches vtkBezierContourLineInterpolator vtkBezierCurve vtkBezierHexahedron vtkBezierInterpolation vtkBezierQuadrilateral vtkBezierTetra vtkBezierTriangle vtkBezierWedge vtkBiDimensionalRepresentation vtkBiDimensionalRepresentation2D vtkBiDimensionalWidget vtkBiQuadraticQuad vtkBiQuadraticQuadraticHexahedron vtkBiQuadraticQuadraticWedge vtkBiQuadraticTriangle vtkBilinearQuadIntersection vtkBillboardTextActor3D vtkBinCellDataFilter vtkBinnedDecimation vtkBiomTableReader vtkBitArray vtkBitArrayIterator vtkBivariateLinearTableThreshold vtkBlankStructuredGrid vtkBlankStructuredGridWithImage vtkBlockDistribution vtkBlockIdScalars vtkBlockItem vtkBlockSelector vtkBlueObeliskData vtkBlueObeliskDataParser vtkBond vtkBooleanOperationPolyDataFilter vtkBooleanTexture vtkBoostBetweennessClustering vtkBoostBiconnectedComponents vtkBoostBrandesCentrality vtkBoostBreadthFirstSearch vtkBoostBreadthFirstSearchTree vtkBoostConnectedComponents vtkBoostDividedEdgeBundling vtkBoostExtractLargestComponent vtkBoostKruskalMinimumSpanningTree vtkBoostLogWeighting vtkBoostPrimMinimumSpanningTree vtkBoostRandomSparseArraySource vtkBoostSplitTableField vtkBorderRepresentation vtkBorderWidget vtkBoundaryMeshQuality vtkBoundedPlanePointPlacer vtkBoundingBox vtkBox vtkBoxClipDataSet vtkBoxLayoutStrategy vtkBoxMuellerRandomSequence vtkBoxRepresentation vtkBoxWidget2 vtkBreakPoint vtkBrokenLineWidget vtkBrush vtkBuffer vtkBufferedArchiver vtkButterflySubdivisionFilter vtkButtonRepresentation vtkButtonSource vtkButtonWidget vtkByteSwap vtkCGMWriter vtkCGNSCache vtkCGNSFileSeriesReader vtkCGNSReader vtkCGNSReaderInternal vtkCONVERGECFDCGNSReader vtkCONVERGECFDReader vtkCPExodusIIElementBlock vtkCPExodusIIElementBlockCellIterator vtkCPExodusIIElementBlockImpl vtkCPExodusIIInSituReader vtkCPExodusIINodalCoordinatesTemplate vtkCPExodusIIResultsArrayTemplate vtkCachedStreamingDemandDrivenPipeline vtkCallbackCommand vtkCamera3DRepresentation vtkCamera3DWidget vtkCameraHandleSource vtkCameraInterpolator vtkCameraNode vtkCameraOrientationRepresentation vtkCameraOrientationWidget vtkCameraPass vtkCameraPathRepresentation vtkCameraPathWidget vtkCameraRepresentation vtkCameraWidget vtkCapsuleSource vtkCaptionActor2D vtkCardinalSpline vtkCastToConcrete vtkCategoryLegend vtkCell vtkCell3D vtkCellArrayIterator vtkCellAttribute vtkCellAttributeCalculator vtkCellAttributeInformation vtkCellCenterDepthSort vtkCellCentersPointPlacer vtkCellData vtkCellDataToPointData vtkCellDerivatives vtkCellDistanceSelector vtkCellGraphicsPrimitiveMap vtkCellGrid vtkCellGridAlgorithm vtkCellGridBoundsQuery vtkCellGridComputeSurface vtkCellGridElevation vtkCellGridElevationQuery vtkCellGridEvaluator vtkCellGridIOQuery vtkCellGridMapper vtkCellGridPointProbe vtkCellGridQuery vtkCellGridRangeQuery vtkCellGridReader vtkCellGridRenderRequest vtkCellGridResponder vtkCellGridResponderBase vtkCellGridResponders vtkCellGridSidesQuery vtkCellGridWriter vtkCellIterator vtkCellLinks vtkCellLocator vtkCellLocatorStrategy vtkCellMetadata vtkCellQuality vtkCellSizeFilter vtkCellTreeLocator vtkCellType vtkCellTypeSource vtkCellTypes vtkCellValidator vtkCenteredSliderRepresentation vtkCenteredSliderWidget vtkCesium3DTilesReader vtkCesium3DTilesWriter vtkCesiumB3DMReader vtkCesiumPointCloudWriter vtkChacoGraphReader vtkChacoReader vtkCharArray vtkChart vtkChart2DHistogram vtkChartBox vtkChartHistogram2D vtkChartLegend vtkChartMatrix vtkChartParallelCoordinates vtkChartPie vtkChartXY vtkChartXYZ vtkCheckerboardRepresentation vtkCheckerboardSplatter vtkCheckerboardWidget vtkCirclePackFrontChainLayoutStrategy vtkCirclePackLayout vtkCirclePackLayoutStrategy vtkCirclePackToPolyData vtkCircularLayoutStrategy vtkCityGMLReader vtkCleanPolyData vtkCleanUnstructuredGrid vtkCleanUnstructuredGridCells vtkClearRGBPass vtkClearZPass vtkClientServerCompositePass vtkClientServerSynchronizedRenderers vtkClientSocket vtkClipClosedSurface vtkClipConvexPolyData vtkClipDataSet vtkClipPolyData vtkClipVolume vtkClosedSurfacePointPlacer vtkClosestNPointsStrategy vtkClosestPointStrategy vtkClustering2DLayoutStrategy vtkCocoaMacOSXSDKCompatibility vtkCocoaRenderWindow vtkCocoaRenderWindowInteractor vtkCocoaTkUtilities vtkCoincidentPoints vtkCollapseGraph vtkCollapseVerticesByArray vtkCollectGraph vtkCollectPolyData vtkCollectTable vtkCollection vtkCollectionElement vtkCollectionIterator vtkCollisionDetectionFilter vtkColor vtkColor3 vtkColor3d vtkColor3f vtkColor3ub vtkColor4 vtkColor4d vtkColor4f vtkColor4ub vtkColorLegend vtkColorTransferControlPointsItem vtkColorTransferFunctionItem vtkCommand vtkCommonInformationKeyManager vtkCommunicator vtkCommunity2DLayoutStrategy vtkCompositeCellGridMapper vtkCompositeCellGridReader vtkCompositeControlPointsItem vtkCompositeCutter vtkCompositeDataDisplayAttributesLegacy vtkCompositeDataGeometryFilter vtkCompositeDataIterator vtkCompositeDataPipeline vtkCompositeDataProbeFilter vtkCompositeDataReader vtkCompositeDataSet vtkCompositeDataSetAlgorithm vtkCompositeDataWriter vtkCompositeImplicitBackend vtkCompositeInterpolatedVelocityField vtkCompositeMapperHelper2 vtkCompositeMapperHelperData vtkCompositePolyDataMapper vtkCompositePolyDataMapperDelegator vtkCompositeRGBAPass vtkCompositeRenderManager vtkCompositeSurfaceLICMapper vtkCompositeSurfaceLICMapperDelegator vtkCompositeTransferFunctionItem vtkCompositeZPass vtkCompositedSynchronizedRenderers vtkCompositer vtkCompressCompositer vtkComputeHistogram2DOutliers vtkComputeQuantiles vtkComputeQuartiles vtkConduitArrayUtilities vtkConduitSource vtkConduitToDataObject vtkConeLayoutStrategy vtkConnectedPointsFilter vtkConnectivityFilter vtkConstrained2DLayoutStrategy vtkConstrainedPointHandleRepresentation vtkConstrainedSmoothingFilter vtkConsumerDataFilter vtkContext2D vtkContext3D vtkContextActor vtkContextArea vtkContextClip vtkContextDevice2D vtkContextDevice3D vtkContextInteractorStyle vtkContextItem vtkContextKeyEvent vtkContextMapper2D vtkContextMouseEvent vtkContextPolygon vtkContextScene vtkContextScenePrivate vtkContextTransform vtkContextView vtkContingencyStatistics vtkContinuousScatterplot vtkContinuousValueWidget vtkContinuousValueWidgetRepresentation vtkContour3DLinearGrid vtkContourGrid vtkContourHelper vtkContourLineInterpolator vtkContourLoopExtraction vtkContourRepresentation vtkContourRepresentationInternals vtkContourRepresentationNode vtkContourRepresentationPoint vtkContourTriangulator vtkContourValues vtkContourWidget vtkControlPointsItem vtkConvertSelection vtkConvertSelectionDomain vtkConvertToMultiBlockDataSet vtkConvertToPartitionedDataSetCollection vtkConvertToPointCloud vtkConvertToPolyhedra vtkConvexHull2D vtkCookieCutter vtkCoordinateFrame vtkCoordinateFrameRepresentation vtkCoordinateFrameWidget vtkCorrelativeStatistics vtkCosmicTreeLayoutStrategy vtkCountFaces vtkCountVertices vtkCubicLine vtkCuller vtkCullerCollection vtkCurvatures vtkCurveRepresentation vtkCutMaterial vtkCylinder vtkCylindricalTransform vtkDGAttributeInformation vtkDGBoundsResponder vtkDGCell vtkDGEdge vtkDGElevationResponder vtkDGEvaluator vtkDGHex vtkDGIOResponder vtkDGInterpolateCalculator vtkDGPyr vtkDGQuad vtkDGRangeResponder vtkDGRenderResponder vtkDGSidesResponder vtkDGTet vtkDGTranscribeUnstructuredCells vtkDGTri vtkDGVert vtkDGWdg vtkDIMACSGraphReader vtkDIMACSGraphWriter vtkDIYAggregateDataSetFilter vtkDIYDataExchanger vtkDIYExplicitAssigner vtkDIYGhostUtilities vtkDIYKdTreeUtilities vtkDIYUtilities vtkDIYUtilitiesCleanup vtkDSPFilterDefinition vtkDSPFilterGroup vtkDataArray vtkDataArrayCollection vtkDataArrayCollectionIterator vtkDataArraySelection vtkDataAssembly vtkDataAssemblyUtilities vtkDataAssemblyVisitor vtkDataCompressor vtkDataEncoder vtkDataObject vtkDataObjectAlgorithm vtkDataObjectCollection vtkDataObjectGenerator vtkDataObjectMeshCache vtkDataObjectReader vtkDataObjectToConduit vtkDataObjectToDataSetFilter vtkDataObjectToTable vtkDataObjectTree vtkDataObjectTreeIndex vtkDataObjectTreeInternals vtkDataObjectTreeIterator vtkDataObjectTypes vtkDataObjectWriter vtkDataReader vtkDataSet vtkDataSetAlgorithm vtkDataSetAttributes vtkDataSetAttributesFieldList vtkDataSetCellIterator vtkDataSetCollection vtkDataSetEdgeSubdivisionCriterion vtkDataSetGradient vtkDataSetGradientPrecompute vtkDataSetReader vtkDataSetRegionSurfaceFilter vtkDataSetSurfaceFilter vtkDataSetToDataObjectFilter vtkDataSetTriangleFilter vtkDataSetWriter vtkDataTransferHelper vtkDataWriter vtkDatabaseToTableReader vtkDateToNumeric vtkDeRhamCell vtkDebugLeaks vtkDebugLeaksManager vtkDebugLeaksObserver vtkDecimatePolylineFilter vtkDecimatePro vtkDefaultPass vtkDeflectNormals vtkDeformPointSet vtkDelimitedTextReader vtkDelimitedTextWriter vtkDemandDrivenPipeline vtkDendrogramItem vtkDenseArray vtkDensifyPointCloudFilter vtkDensifyPolyData vtkDependentDimensionInfo vtkDepthImageProcessingPass vtkDepthImageToPointCloud vtkDepthOfFieldPass vtkDepthPeelingPass vtkDepthSortPolyData vtkDescriptiveStatistics vtkDeserializer vtkDiagonalMatrixSource vtkDicer vtkDijkstraGraphGeodesicPath vtkDijkstraGraphInternals vtkDijkstraImageContourLineInterpolator vtkDijkstraImageGeodesicPath vtkDimensionInfo vtkDirectedAcyclicGraph vtkDirectedGraph vtkDirectedGraphAlgorithm vtkDirectionEncoder vtkDirectory vtkDiscreteFlyingEdges2D vtkDiscreteFlyingEdges3D vtkDiscreteFlyingEdgesClipper2D vtkDiscreteMarchingCubes vtkDisplaySizedImplicitPlaneRepresentation vtkDisplaySizedImplicitPlaneWidget vtkDistancePolyDataFilter vtkDistanceRepresentation vtkDistanceRepresentation2D vtkDistanceRepresentation3D vtkDistributedDataFilter vtkDistributedGraphHelper vtkDistributedPointCloudFilter vtkDotProductSimilarity vtkDrawTexturedElements vtkDualDepthPeelingPass vtkDummyCommunicator vtkDummyController vtkDummyGPUInfoList vtkDuplicatePolyData vtkDynamic2DLabelMapper vtkDynamicLoader vtkEDLShading vtkEGLRenderWindow vtkERFReader vtkEdgeCenters vtkEdgeLayout vtkEdgeLayoutStrategy vtkEdgeListIterator vtkEdgePoints vtkEdgeSubdivisionCriterion vtkEdgeTable vtkEllipseArcSource vtkEllipsoidTensorProbeRepresentation vtkEllipsoidalGaussianKernel vtkEllipticalButtonSource vtkEmptyCell vtkEmptyRepresentation vtkEnSight6BinaryReader vtkEnSight6Reader vtkEnSightGoldBinaryReader vtkEnSightGoldReader vtkEnSightMasterServerReader vtkEnSightReader vtkEnSightWriter vtkEncodedGradientEstimator vtkEncodedGradientShader vtkEndFor vtkEnsembleSource vtkEnzoReaderBlock vtkEnzoReaderInternal vtkEqualizerContextItem vtkEqualizerFilter vtkEquirectangularToCubeMapTexture vtkErrorCode vtkEuclideanClusterExtraction vtkEvenlySpacedStreamlines2D vtkEvent vtkEventData vtkEventDataDevice3D vtkEventDataForDevice vtkEventForwarderCommand vtkEventQtSlotConnect vtkExecutableRunner vtkExecutionAggregator vtkExecutionRange vtkExecutionTimer vtkExecutive vtkExodusIICache vtkExodusIICacheEntry vtkExodusIICacheKey vtkExodusIIReader vtkExodusIIReaderIntPointCheck vtkExodusIIReaderParser vtkExodusIIReaderPrivate vtkExodusIIReaderScalarCheck vtkExodusIIReaderTensorCheck vtkExodusIIReaderVariableCheck vtkExodusIIReaderVectorCheck vtkExpandMarkedElements vtkExpandSelectedGraph vtkExplicitStructuredGrid vtkExplicitStructuredGridAlgorithm vtkExplicitStructuredGridCrop vtkExplicitStructuredGridSurfaceFilter vtkExplicitStructuredGridToUnstructuredGrid vtkExporter vtkExprTkFunctionParser vtkExtentRCBPartitioner vtkExtentSplitter vtkExtentTranslator vtkExternalLight vtkExternalOpenGLCamera vtkExternalOpenGLRenderWindow vtkExternalOpenGLRenderer vtkExtractArray vtkExtractBlock vtkExtractBlockUsingDataAssembly vtkExtractCTHPart vtkExtractCells vtkExtractCellsAlongPolyLine vtkExtractCellsByType vtkExtractDataArraysOverTime vtkExtractDataOverTime vtkExtractDataSets vtkExtractEnclosedPoints vtkExtractExodusGlobalTemporalVariables vtkExtractFunctionalBagPlot vtkExtractGeometry vtkExtractGhostCells vtkExtractGrid vtkExtractHierarchicalBins vtkExtractHistogram vtkExtractHistogram2D vtkExtractLevel vtkExtractParticlesOverTime vtkExtractPiece vtkExtractPointCloudPiece vtkExtractPoints vtkExtractPolyDataGeometry vtkExtractPolyDataPiece vtkExtractRectilinearGrid vtkExtractSelectedArraysOverTime vtkExtractSelectedFrustum vtkExtractSelectedGraph vtkExtractSelectedRows vtkExtractSelectedTree vtkExtractSelection vtkExtractSelectionBase vtkExtractStructuredGridHelper vtkExtractSubsetWithSeed vtkExtractSurface vtkExtractTensorComponents vtkExtractTimeSteps vtkExtractUnstructuredGrid vtkExtractUnstructuredGridPiece vtkExtractUserDefinedPiece vtkExtractVectorComponents vtkFDSReader vtkFFMPEGVideoSource vtkFFMPEGWriter vtkFFT vtkFLUENTCFFReader vtkFLUENTReader vtkFXAAOptions vtkFacetReader vtkFacetWriter vtkFast2DLayoutStrategy vtkFastSplatter vtkFiberSurface vtkFidesReader vtkFieldData vtkFieldDataSerializer vtkFieldDataToAttributeDataFilter vtkFieldDataToDataSetAttribute vtkFileOutputWindow vtkFileResourceStream vtkFileSeriesHelper vtkFillHolesFilter vtkFilteringInformationKeyManager vtkFiltersCellGrid vtkFindCellStrategy vtkFiniteDifferenceGradientEstimator vtkFiniteElementFieldDistributor vtkFinitePlaneRepresentation vtkFinitePlaneWidget vtkFitToHeightMapFilter vtkFixedPointRayCastImage vtkFixedPointVolumeRayCastCompositeGOHelper vtkFixedPointVolumeRayCastCompositeGOShadeHelper vtkFixedPointVolumeRayCastCompositeHelper vtkFixedPointVolumeRayCastCompositeShadeHelper vtkFixedPointVolumeRayCastHelper vtkFixedPointVolumeRayCastMIPHelper vtkFixedSizeHandleRepresentation vtkFixedSizeHandleRepresentation3D vtkFixedWidthTextReader vtkFlagpoleLabel vtkFlashReaderInternal vtkFloatingPointExceptions vtkFlyingEdges2D vtkFlyingEdges3D vtkFlyingEdgesPlaneCutter vtkFocalPlaneContourRepresentation vtkFocalPlanePointPlacer vtkFontConfigFreeTypeTools vtkForEach vtkForceDirectedLayoutStrategy vtkForceStaticMesh vtkForceTime vtkFrameBufferObjectBase vtkFramebufferPass vtkFreeTypeLabelRenderStrategy vtkFreeTypeStringToImage vtkFreeTypeTools vtkFreeTypeToolsCleanup vtkFrustumCoverageCuller vtkFrustumSelector vtkFunctionSet vtkGAMBITReader vtkGDAL vtkGDALRasterConverter vtkGDALRasterReader vtkGDALRasterReprojection vtkGDALVectorReader vtkGESignaReader vtkGL2PSExporter vtkGLSLModCamera vtkGLSLModCoincidentTopology vtkGLSLModLight vtkGLSLModPixelDebugger vtkGLSLModifierBase vtkGLSLModifierFactory vtkGLTFDocumentLoader vtkGLTFDocumentLoaderInternals vtkGLTFExporter vtkGLTFImporter vtkGLTFReader vtkGLTFTexture vtkGLTFWriter vtkGLTFWriterUtils vtkGPUInfo vtkGPUInfoList vtkGPUInfoListArray vtkGPUVolumeRayCastMapper vtkGarbageCollector vtkGarbageCollectorManager vtkGaussianBlurPass vtkGaussianCubeReader vtkGaussianCubeReader2 vtkGaussianKernel vtkGaussianRandomSequence vtkGaussianSplatter vtkGeneralTransform vtkGeneralizedKernel vtkGenerateGlobalIds vtkGenerateIndexArray vtkGenerateProcessIds vtkGenerateTimeSteps vtkGenericAdaptorCell vtkGenericAttribute vtkGenericAttributeCollection vtkGenericCell vtkGenericCellIterator vtkGenericCellTessellator vtkGenericClip vtkGenericContourFilter vtkGenericCutter vtkGenericDataArray vtkGenericDataArrayLookupHelper vtkGenericDataObjectReader vtkGenericDataObjectWriter vtkGenericDataSet vtkGenericDataSetTessellator vtkGenericEdgeTable vtkGenericEnSightReader vtkGenericGeometryFilter vtkGenericGlyph3DFilter vtkGenericImageInterpolator vtkGenericInterpolatedVelocityField vtkGenericMovieWriter vtkGenericOpenGLRenderWindow vtkGenericOpenGLResourceFreeCallback vtkGenericOutlineFilter vtkGenericPointIterator vtkGenericProbeFilter vtkGenericRenderWindowInteractor vtkGenericStreamTracer vtkGenericSubdivisionErrorMetric vtkGenericVertexAttributeMapping vtkGeoEdgeStrategy vtkGeoJSONFeature vtkGeoJSONReader vtkGeoJSONWriter vtkGeoMath vtkGeoProjection vtkGeoTransform vtkGeodesicPath vtkGeometricErrorMetric vtkGeometryFilter vtkGhostCellsGenerator vtkGlobFileNames vtkGlyphSource2D vtkGradientFilter vtkGraph vtkGraphAlgorithm vtkGraphAnnotationLayersFilter vtkGraphEdge vtkGraphGeodesicPath vtkGraphHierarchicalBundleEdges vtkGraphInternals vtkGraphItem vtkGraphLayout vtkGraphLayoutFilter vtkGraphLayoutStrategy vtkGraphReader vtkGraphToGlyphs vtkGraphToPoints vtkGraphToPolyData vtkGraphWeightEuclideanDistanceFilter vtkGraphWeightFilter vtkGraphWriter vtkGraphicsFactory vtkGreedyTerrainDecimation vtkGridSynchronizedTemplates3D vtkGridTransform vtkGroupDataSetsFilter vtkGroupLeafVertices vtkGroupTimeStepsFilter vtkH5PartReader vtkH5RageReader vtkHDF5Helper vtkHDFReader vtkHDFReaderImplementation vtkHDFVersion vtkHDFWriter vtkHDFWriterImplementation vtkHDRReader vtkHandleRepresentation vtkHandleSource vtkHandleWidget vtkHardwarePicker vtkHardwareSelector vtkHardwareWindow vtkHausdorffDistancePointSetFilter vtkHeap vtkHeatmapItem vtkHexagonalPrism vtkHexahedron vtkHiddenLineRemovalPass vtkHierarchicalBinningFilter vtkHierarchicalBoxDataSet vtkHierarchicalBoxDataSetAlgorithm vtkHierarchicalDataExtractDataSets vtkHierarchicalDataExtractLevel vtkHierarchicalDataLevelFilter vtkHierarchicalDataSetGeometryFilter vtkHierarchicalGraphPipeline vtkHierarchicalGraphView vtkHierarchicalPolyDataMapper vtkHigherOrderCurve vtkHigherOrderHexahedron vtkHigherOrderInterpolation vtkHigherOrderQuadrilateral vtkHigherOrderTetra vtkHigherOrderTriangle vtkHigherOrderWedge vtkHighestDensityRegionsStatistics vtkHomogeneousTransform vtkHoudiniPolyDataWriter vtkHoverWidget vtkHull vtkHyperStreamline vtkHyperTree vtkHyperTreeGrid vtkHyperTreeGridAlgorithm vtkHyperTreeGridAxisClip vtkHyperTreeGridAxisCut vtkHyperTreeGridAxisReflection vtkHyperTreeGridCellCenters vtkHyperTreeGridContour vtkHyperTreeGridDepthLimiter vtkHyperTreeGridEntry vtkHyperTreeGridEvaluateCoarse vtkHyperTreeGridExtractGhostCells vtkHyperTreeGridFeatureEdges vtkHyperTreeGridGeometricLocator vtkHyperTreeGridGeometry vtkHyperTreeGridGeometry1DImpl vtkHyperTreeGridGeometry2DImpl vtkHyperTreeGridGeometry3DImpl vtkHyperTreeGridGeometryEntry vtkHyperTreeGridGeometryImpl vtkHyperTreeGridGeometryLevelEntry vtkHyperTreeGridGeometrySmallDimensionsImpl vtkHyperTreeGridGeometryUnlimitedEntry vtkHyperTreeGridGeometryUnlimitedLevelEntry vtkHyperTreeGridGhostCellsGenerator vtkHyperTreeGridGhostCellsGeneratorInternals vtkHyperTreeGridGradient vtkHyperTreeGridIterator vtkHyperTreeGridLevelEntry vtkHyperTreeGridLocator vtkHyperTreeGridMapper vtkHyperTreeGridNonOrientedCursor vtkHyperTreeGridNonOrientedGeometryCursor vtkHyperTreeGridNonOrientedMooreSuperCursor vtkHyperTreeGridNonOrientedMooreSuperCursorLight vtkHyperTreeGridNonOrientedSuperCursor vtkHyperTreeGridNonOrientedSuperCursorLight vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor vtkHyperTreeGridNonOrientedUnlimitedSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight vtkHyperTreeGridOrientedCursor vtkHyperTreeGridOrientedGeometryCursor vtkHyperTreeGridOutlineFilter vtkHyperTreeGridPlaneCutter vtkHyperTreeGridPreConfiguredSource vtkHyperTreeGridProbeFilter vtkHyperTreeGridScales vtkHyperTreeGridThreshold vtkHyperTreeGridToDualGrid vtkHyperTreeGridToUnstructuredGrid vtkHyperTreeGridVisibleLeavesSize vtkIOCellGrid vtkIOSRenderWindow vtkIOSRenderWindowInteractor vtkIOSSFilesScanner vtkIOSSModel vtkIOSSReader vtkIOSSReaderInternal vtkIOSSWriter vtkIOStream vtkIOStreamFwd vtkISIReader vtkIVExporter vtkIVWriter vtkIcicleView vtkIconGlyphFilter vtkIdFilter vtkIdList vtkIdListCollection vtkIdentityTransform vtkImageAccumulate vtkImageActorPointPlacer vtkImageAlgorithm vtkImageAnisotropicDiffusion2D vtkImageAnisotropicDiffusion3D vtkImageAppend vtkImageAppendComponents vtkImageBSplineCoefficients vtkImageBSplineInternals vtkImageBSplineInterpolator vtkImageButterworthHighPass vtkImageButterworthLowPass vtkImageCacheFilter vtkImageChangeInformation vtkImageCheckerboard vtkImageCityBlockDistance vtkImageClip vtkImageConnectivityFilter vtkImageConnector vtkImageConnectorSeed vtkImageConstantPad vtkImageContinuousDilate3D vtkImageContinuousErode3D vtkImageConvolve vtkImageCorrelation vtkImageCroppingRegionsWidget vtkImageCursor3D vtkImageDataLIC2D vtkImageDataOutlineFilter vtkImageDataStreamer vtkImageDataToExplicitStructuredGrid vtkImageDataToHyperTreeGrid vtkImageDataToPointSet vtkImageDataToUniformGrid vtkImageDecomposeFilter vtkImageDifference vtkImageDilateErode3D vtkImageDivergence vtkImageDotProduct vtkImageEuclideanDistance vtkImageEuclideanToPolar vtkImageExport vtkImageExtractComponents vtkImageFourierCenter vtkImageFourierFilter vtkImageGaussianSmooth vtkImageGaussianSource vtkImageGradient vtkImageGradientMagnitude vtkImageHSIToRGB vtkImageHSVToRGB vtkImageHistogram vtkImageHistogramStatistics vtkImageHybridMedian2D vtkImageIdealHighPass vtkImageIdealLowPass vtkImageImport vtkImageImportExecutive vtkImageInPlaceFilter vtkImageInterpolator vtkImageIslandRemoval2D vtkImageItem vtkImageIterateFilter vtkImageIterator vtkImageLaplacian vtkImageLogarithmicScale vtkImageLogic vtkImageLuminance vtkImageMagnify vtkImageMagnitude vtkImageMapToRGBA vtkImageMapToWindowLevelColors vtkImageMapper3D vtkImageMarchingCubes vtkImageMask vtkImageMaskBits vtkImageMathematics vtkImageMedian3D vtkImageMirrorPad vtkImageNoiseSource vtkImageNonMaximumSuppression vtkImageOpenClose3D vtkImageOrthoPlanes vtkImagePadFilter vtkImagePointDataIterator vtkImagePointIterator vtkImageProbeFilter vtkImageProcessingPass vtkImageProgressIterator vtkImageProperty vtkImageQuantizeRGBToIndex vtkImageRFFT vtkImageRGBToHSI vtkImageRGBToHSV vtkImageRGBToXYZ vtkImageRGBToYIQ vtkImageRange3D vtkImageReader vtkImageReader2Collection vtkImageRectilinearWipe vtkImageRenderManager vtkImageResample vtkImageResize vtkImageResliceMapper vtkImageResliceToColors vtkImageSSIM vtkImageSeedConnectivity vtkImageSeparableConvolution vtkImageShiftScale vtkImageShrink3D vtkImageSincInterpolator vtkImageSkeleton2D vtkImageSlab vtkImageSlabReslice vtkImageSlice vtkImageSliceCollection vtkImageSliceMapper vtkImageSobel2D vtkImageSobel3D vtkImageSpatialAlgorithm vtkImageStack vtkImageStencil vtkImageStencilAlgorithm vtkImageStencilData vtkImageStencilIterator vtkImageStencilRaster vtkImageStencilSource vtkImageStencilToImage vtkImageThreshold vtkImageThresholdConnectivity vtkImageToAMR vtkImageToImageStencil vtkImageToPoints vtkImageToPolyDataFilter vtkImageToStructuredGrid vtkImageToStructuredPoints vtkImageTransform vtkImageTranslateExtent vtkImageVariance3D vtkImageViewer vtkImageWrapPad vtkImageWriter vtkImageXYZToLAB vtkImageYIQToRGB vtkImplicitArray vtkImplicitCylinderRepresentation vtkImplicitCylinderWidget vtkImplicitFunction vtkImplicitFunctionCollection vtkImplicitFunctionToImageStencil vtkImplicitHalo vtkImplicitImageRepresentation vtkImplicitPlaneRepresentation vtkImplicitPlaneWidget vtkImplicitPlaneWidget2 vtkImplicitPolyDataDistance vtkImplicitProjectOnPlaneDistance vtkImplicitSelectionLoop vtkImplicitSum vtkImplicitTextureCoords vtkImplicitVolume vtkImplicitWindowFunction vtkImporter vtkImprintFilter vtkInEdgeIterator vtkIncrementalForceLayout vtkIncrementalOctreeNode vtkIncrementalOctreePointLocator vtkIncrementalPointLocator vtkIndent vtkIndexedImplicitBackend vtkInformation vtkInformationDataObjectKey vtkInformationDataObjectMetaDataKey vtkInformationDoubleKey vtkInformationDoubleVectorKey vtkInformationExecutivePortKey vtkInformationExecutivePortVectorKey vtkInformationIdTypeKey vtkInformationInformationKey vtkInformationInformationVectorKey vtkInformationIntegerKey vtkInformationIntegerPointerKey vtkInformationIntegerRequestKey vtkInformationIntegerVectorKey vtkInformationInternals vtkInformationIterator vtkInformationKey vtkInformationKeyLookup vtkInformationKeyVectorKey vtkInformationObjectBaseKey vtkInformationObjectBaseVectorKey vtkInformationQuadratureSchemeDefinitionVectorKey vtkInformationRequestKey vtkInformationStringKey vtkInformationStringVectorKey vtkInformationUnsignedLongKey vtkInformationVariantKey vtkInformationVariantVectorKey vtkInformationVector vtkInitialValueProblemSolver vtkInputStream vtkIntArray vtkIntegrateAttributes vtkInteractiveArea vtkInteractorEventRecorder vtkInteractorStyle3D vtkInteractorStyleAreaSelectHover vtkInteractorStyleDrawPolygon vtkInteractorStyleFlight vtkInteractorStyleJoystickActor vtkInteractorStyleJoystickCamera vtkInteractorStyleMultiTouchCamera vtkInteractorStyleRubberBand2D vtkInteractorStyleRubberBand3D vtkInteractorStyleSwitchBase vtkInteractorStyleTreeMapHover vtkInteractorStyleUnicam vtkInteractorStyleUser vtkInterpolateCalculator vtkInterpolateDataSetAttributes vtkInterpolatingSubdivisionFilter vtkInterpolationKernel vtkInterpolatorInternals vtkIntersectionCounter vtkIntersectionPolyDataFilter vtkIterativeClosestPointTransform vtkJSONDataSetWriter vtkJSONImageWriter vtkJSONRenderWindowExporter vtkJSONSceneExporter vtkJavaScriptDataWriter vtkJoinTables vtkKCoreDecomposition vtkKCoreLayout vtkKMeansAssessFunctor vtkKMeansDistanceFunctor vtkKMeansDistanceFunctorCalculator vtkKMeansStatistics vtkKdNode vtkKdTree vtkKdTreeSelector vtkLASRasterReader vtkLASReader vtkLICNoiseHelper vtkLICRandomNoise2D vtkLICRandomNumberGeneratorInterface vtkLODProp3D vtkLSDynaPart vtkLSDynaPartCollection vtkLSDynaReader vtkLSDynaSummaryParser vtkLZ4DataCompressor vtkLZMADataCompressor vtkLabelHierarchy vtkLabelHierarchyAlgorithm vtkLabelHierarchyCompositeIterator vtkLabelHierarchyIterator vtkLabelPlacementMapper vtkLabelPlacer vtkLabelRenderStrategy vtkLabelSizeCalculator vtkLabeledContourMapper vtkLabeledContourPolyDataItem vtkLabeledDataMapper vtkLabeledTreeMapDataMapper vtkLagrangeCurve vtkLagrangeHexahedron vtkLagrangeInterpolation vtkLagrangeQuadrilateral vtkLagrangeTetra vtkLagrangeTriangle vtkLagrangeWedge vtkLagrangianBasicIntegrationModel vtkLagrangianMatidaIntegrationModel vtkLagrangianParticle vtkLagrangianParticleTracker vtkLandmarkTransform vtkLargeInteger vtkLassoStencilSource vtkLeaderActor2D vtkLegacyReaderVersion vtkLengthDistribution vtkLevelIdScalars vtkLightCollection vtkLightKit vtkLightNode vtkLightRepresentation vtkLightWidget vtkLightingMapPass vtkLightsPass vtkLineIntegralConvolution2D vtkLineRepresentation vtkLineWidget vtkLineWidget2 vtkLinearCellExtrusionFilter vtkLinearContourLineInterpolator vtkLinearKernel vtkLinearSelector vtkLinearSubdivisionFilter vtkLinearToQuadraticCellsFilter vtkLinearTransform vtkLinearTransformCellLocator vtkLinkEdgels vtkLocationSelector vtkLocator vtkLogLookupTable vtkLogger vtkLongArray vtkLongLongArray vtkLookupTableItem vtkLookupTableWithEnabling vtkLoopBooleanPolyDataFilter vtkLoopSubdivisionFilter vtkMCubesReader vtkMCubesWriter vtkMFCWindow vtkMFIXReader vtkMINCImageAttributes vtkMINCImageReader vtkMINCImageWriter vtkMNIObjectReader vtkMNIObjectWriter vtkMNITagPointReader vtkMNITagPointWriter vtkMNITransformReader vtkMNITransformWriter vtkMP4Writer vtkMPASReader vtkMPI4PyCommunicator vtkMPICommunicator vtkMPIController vtkMPIEventLog vtkMPIImageReader vtkMPIMultiBlockPLOT3DReader vtkMPIPixelTT vtkMPIPixelView vtkMRCReader vtkMagnifierRepresentation vtkMagnifierWidget vtkMapArrayValues vtkMapMaskTextureId vtkMappedDataArray vtkMappedUnstructuredGrid vtkMappedUnstructuredGridCellIterator vtkMapper vtkMapper2D vtkMapperCollection vtkMapperNode vtkMarchingContourFilter vtkMarchingSquares vtkMarkBoundaryFilter vtkMarkerUtilities vtkMarshalContext vtkMaskFields vtkMaskPointsFilter vtkMaskPolyData vtkMassProperties vtkMathPrivate vtkMathTextFreeTypeTextRenderer vtkMathTextUtilities vtkMathTextUtilitiesCleanup vtkMathUtilities vtkMatplotlibMathTextUtilities vtkMatricizeArray vtkMatrixMathFilter vtkMatrixToHomogeneousTransform vtkMatrixToLinearTransform vtkMeanValueCoordinatesInterpolator vtkMeasurementCubeHandleRepresentation3D vtkMedicalImageProperties vtkMedicalImageReader2 vtkMemkindRAII vtkMemoryLimitImageDataStreamer vtkMemoryResourceStream vtkMergeArrays vtkMergeCells vtkMergeColumns vtkMergeDataObjectFilter vtkMergeFields vtkMergeFilter vtkMergeGraphs vtkMergePoints vtkMergeTables vtkMergeTimeFilter vtkMergeVectorComponents vtkMersenneTwister vtkMetaImageWriter vtkModelMetadata vtkModifiedBSPTree vtkMolecule vtkMoleculeAlgorithm vtkMoleculeAppend vtkMoleculeReaderBase vtkMoleculeToAtomBallFilter vtkMoleculeToBondStickFilter vtkMoleculeToLinesFilter vtkMoleculeToPolyDataFilter vtkMotionFXCFGReader vtkMultiBlockDataGroupFilter vtkMultiBlockDataSetAlgorithm vtkMultiBlockMergeFilter vtkMultiBlockPLOT3DReaderRecord vtkMultiBlockUnstructuredGridVolumeMapper vtkMultiBlockVolumeMapper vtkMultiCorrelativeAssessFunctor vtkMultiCorrelativeStatistics vtkMultiNewickTreeReader vtkMultiObjectMassProperties vtkMultiPieceDataSet vtkMultiProcessController vtkMultiProcessStream vtkMultiThreader vtkMultiThreshold vtkMultiTimeStepAlgorithm vtkMultiVolume vtkMutableGraphHelper vtkMySQLDatabase vtkMySQLDatabasePrivate vtkMySQLQuery vtkMySQLToTableReader vtkNIFTIImageHeader vtkNIFTIImageReader vtkNIFTIImageWriter vtkNativePartitioningStrategy vtkNeighborCells vtkNek5000Reader vtkNetCDFCAMReader vtkNetCDFCFReader vtkNetCDFCFWriter vtkNetCDFPOPReader vtkNetCDFReader vtkNetCDFUGRIDReader vtkNetCDFUGRIDeader vtkNetworkHierarchy vtkNew vtkNewickTreeReader vtkNewickTreeWriter vtkNonLinearCell vtkNonMergingPointLocator vtkNonOverlappingAMR vtkNonOverlappingAMRAlgorithm vtkNonOverlappingAMRLevelIdScalars vtkNormalizeMatrixVectors vtkNrrdReader vtkNumberToString vtkOBBDicer vtkOBBNode vtkOBBTree vtkOBJExporter vtkOBJImporter vtkOBJPolyDataProcessor vtkOBJWriter vtkOCCTReader vtkODBCDatabase vtkODBCInternals vtkODBCQuery vtkOMETIFFReader vtkOMFReader vtkOOGLExporter vtkOSOpenGLRenderWindow vtkOSPRayAMRVolumeMapperNode vtkOSPRayActorNode vtkOSPRayCache vtkOSPRayCacheItemObject vtkOSPRayCameraNode vtkOSPRayCompositePolyDataMapper2Node vtkOSPRayCompositePolyDataMapperNode vtkOSPRayLightNode vtkOSPRayMaterialHelpers vtkOSPRayMaterialLibrary vtkOSPRayMoleculeMapperNode vtkOSPRayPass vtkOSPRayPointGaussianMapperNode vtkOSPRayPolyDataMapperNode vtkOSPRayRendererNode vtkOSPRayTestInteractor vtkOSPRayUnstructuredVolumeMapperNode vtkOSPRayViewNodeFactory vtkOSPRayVolumeInterface vtkOSPRayVolumeMapper vtkOSPRayVolumeMapperNode vtkOSPRayVolumeNode vtkOSPRayWindowNode vtkOStrStreamWrapper vtkOStreamWrapper vtkOTDensityMap vtkOTFilter vtkOTKernelSmoothing vtkOTScatterPlotMatrix vtkOTUtilities vtkObjectBase vtkObjectFactory vtkObjectFactoryCollection vtkObjectFactoryRegistryCleanup vtkObjectIdMap vtkObserverMediator vtkOctreeImageToPointSetFilter vtkOctreePointLocatorNode vtkOldStyleCallbackCommand vtkOpaquePass vtkOpenFOAMReader vtkOpenGL2ContextDevice2DCellArrayHelper vtkOpenGL2ContextDevice2DPrivate vtkOpenGLActor vtkOpenGLArrayTextureBufferAdapter vtkOpenGLAvatar vtkOpenGLBatchedPolyDataMapper vtkOpenGLBillboardTextActor3D vtkOpenGLBufferObject vtkOpenGLCamera vtkOpenGLCellGridMapper vtkOpenGLCellToVTKCellMap vtkOpenGLCompositePolyDataMapperDelegator vtkOpenGLContextActor vtkOpenGLContextBufferId vtkOpenGLContextDevice2D vtkOpenGLContextDevice3D vtkOpenGLContextDeviceBufferObjectBuilder vtkOpenGLES30PolyDataMapper2D vtkOpenGLFXAAFilter vtkOpenGLFXAAPass vtkOpenGLFluidMapper vtkOpenGLFramebufferObject vtkOpenGLGL2PSExporter vtkOpenGLGL2PSHelper vtkOpenGLGL2PSHelperImpl vtkOpenGLGPUVolumeRayCastMapper vtkOpenGLGlyph3DHelper vtkOpenGLGlyph3DMapper vtkOpenGLHardwareSelector vtkOpenGLHelper vtkOpenGLHyperTreeGridMapper vtkOpenGLImageAlgorithmCallback vtkOpenGLImageAlgorithmHelper vtkOpenGLImageGradient vtkOpenGLImageMapper vtkOpenGLImageSliceMapper vtkOpenGLIndexBufferObject vtkOpenGLInstanceCulling vtkOpenGLLabeledContourMapper vtkOpenGLLight vtkOpenGLLowMemoryBatchedPolyDataMapper vtkOpenGLLowMemoryCellTypeAgent vtkOpenGLLowMemoryLinesAgent vtkOpenGLLowMemoryPolyDataMapper vtkOpenGLLowMemoryPolygonsAgent vtkOpenGLLowMemoryStripsAgent vtkOpenGLLowMemoryVerticesAgent vtkOpenGLMoleculeMapper vtkOpenGLMovieSphere vtkOpenGLPointGaussianMapper vtkOpenGLPointGaussianMapperHelper vtkOpenGLPolyDataMapper vtkOpenGLPolyDataMapper2D vtkOpenGLProjectedTetrahedraMapper vtkOpenGLPropItem vtkOpenGLProperty vtkOpenGLQuadHelper vtkOpenGLRayCastImageDisplayHelper vtkOpenGLRenderPass vtkOpenGLRenderTimer vtkOpenGLRenderTimerLog vtkOpenGLRenderUtilities vtkOpenGLRenderWindow vtkOpenGLRenderer vtkOpenGLResourceFreeCallback vtkOpenGLShaderCache vtkOpenGLShaderDeclaration vtkOpenGLShaderProperty vtkOpenGLSkybox vtkOpenGLSphereMapper vtkOpenGLState vtkOpenGLStickMapper vtkOpenGLTextActor vtkOpenGLTextActor3D vtkOpenGLTextMapper vtkOpenGLTexture vtkOpenGLUniforms vtkOpenGLVertexArrayObject vtkOpenGLVertexBufferObject vtkOpenGLVertexBufferObjectCache vtkOpenGLVertexBufferObjectGroup vtkOpenGLVolumeGradientOpacityTable vtkOpenGLVolumeLookupTable vtkOpenGLVolumeLookupTables vtkOpenGLVolumeMaskGradientOpacityTransferFunction2D vtkOpenGLVolumeMaskTransferFunction2D vtkOpenGLVolumeOpacityTable vtkOpenGLVolumeRGBTable vtkOpenGLVolumeTransferFunction2D vtkOpenQubeElectronicData vtkOpenQubeMoleculeSource vtkOpenSlideReader vtkOpenVDBReader vtkOpenVDBWriter vtkOpenVRCamera vtkOpenVRCameraPose vtkOpenVRControlsHelper vtkOpenVRDefaultOverlay vtkOpenVRInteractorStyle vtkOpenVRModel vtkOpenVROverlay vtkOpenVROverlaySpot vtkOpenVRRenderWindow vtkOpenVRRenderWindowInteractor vtkOpenVRRenderer vtkOpenXRCamera vtkOpenXRControlsHelper vtkOpenXRInteractorStyle vtkOpenXRManager vtkOpenXRManagerConnection vtkOpenXRManagerD3DGraphics vtkOpenXRManagerGraphics vtkOpenXRManagerOpenGLGraphics vtkOpenXRManagerRemoteConnection vtkOpenXRModel vtkOpenXRRemotingRenderWindow vtkOpenXRRenderWindow vtkOpenXRRenderWindowInteractor vtkOpenXRRenderer vtkOpenXRUtilities vtkOrderIndependentTranslucentPass vtkOrderStatistics vtkOrderedTriangulator vtkOrientPolyData vtkOrientationRepresentation vtkOrientationWidget vtkOrientedGlyphContourRepresentation vtkOrientedGlyphFocalPlaneContourRepresentation vtkOrientedPolygonalHandleRepresentation3D vtkOutEdgeIterator vtkOutlineCornerFilter vtkOutlineCornerSource vtkOutlineGlowPass vtkOutlineSource vtkOutputStream vtkOutputWindow vtkOutputWindowCleanup vtkOverlappingAMR vtkOverlappingAMRAlgorithm vtkOverlappingAMRLevelIdScalars vtkOverlappingCellsDetector vtkOverlayPass vtkOverrideInformation vtkOverrideInformationCollection vtkPAutoCorrelativeStatistics vtkPBRIrradianceTexture vtkPBRLUTTexture vtkPBRPrefilterTexture vtkPBivariateLinearTableThreshold vtkPCAAnalysisFilter vtkPCACurvatureEstimation vtkPCANormalEstimation vtkPCAStatistics vtkPCellDataToPointData vtkPCellSizeFilter vtkPChacoReader vtkPComputeHistogram2DOutliers vtkPComputeQuantiles vtkPComputeQuartiles vtkPConnectivityFilter vtkPContingencyStatistics vtkPConvertToMultiBlockDataSet vtkPCorrelativeStatistics vtkPDALReader vtkPDFContextDevice2D vtkPDFExporter vtkPDataSetReader vtkPDataSetWriter vtkPDescriptiveStatistics vtkPDirectory vtkPDistributedDataFilter vtkPExodusIIReader vtkPExodusIIWriter vtkPExtractDataArraysOverTime vtkPExtractExodusGlobalTemporalVariables vtkPExtractGrid vtkPExtractHistogram2D vtkPExtractRectilinearGrid vtkPExtractSelectedArraysOverTime vtkPExtractVOI vtkPHardwareSelector vtkPHyperTreeGridProbeFilter vtkPIOReader vtkPImageWriter vtkPKMeansStatisitcs vtkPKMeansStatistics vtkPKdTree vtkPLSDynaReader vtkPLagrangianParticleTracker vtkPLineIntegralConvolution2D vtkPLinearExtrusionFilter vtkPMaskPoints vtkPMergeArrays vtkPMultiCorrelativeStatistics vtkPNetCDFPOPReader vtkPNrrdReader vtkPOVExporter vtkPOpenFOAMReader vtkPOrderStatistics vtkPOutlineCornerFilter vtkPOutlineFilter vtkPOutlineFilterInternals vtkPPCAStatistics vtkPPainterCommunicator vtkPPairwiseExtractHistogram2D vtkPParticlePathFilter vtkPParticleTracer vtkPParticleTracerBase vtkPPixelTransfer vtkPPolyDataNormals vtkPProbeFilter vtkPProjectSphereFilter vtkPReflectionFilter vtkPResampleFilter vtkPResampleToImage vtkPResampleWithDataSet vtkPSLACReader vtkPSimpleBondPerceiver vtkPSphereSource vtkPStreaklineFilter vtkPStreamTracer vtkPStructuredGridConnectivity vtkPSurfaceLICComposite vtkPSurfaceLICInterface vtkPSystemTools vtkPTSReader vtkPTextureMapToSphere vtkPVWebGLExporter vtkPWindBladeReader vtkPXdmf3Writer vtkPYoungsMaterialInterface vtkPackLabels vtkPainterCommunicator vtkPairwiseExtractHistogram2D vtkPanoramicProjectionPass vtkParallelAMRUtilities vtkParallelCoordinatesActor vtkParallelCoordinatesHistogramRepresentation vtkParallelCoordinatesInteractorStyle vtkParallelCoordinatesRepresentation vtkParallelCoordinatesView vtkParallelReader vtkParallelRenderManager vtkParallelTimer vtkParallelVectors vtkParallelopipedRepresentation vtkParallelopipedWidget vtkParametricBohemianDome vtkParametricBour vtkParametricBoy vtkParametricCatalanMinimal vtkParametricConicSpiral vtkParametricCrossCap vtkParametricDini vtkParametricEllipsoid vtkParametricEnneper vtkParametricFunction vtkParametricHenneberg vtkParametricKlein vtkParametricKuen vtkParametricMobius vtkParametricPluckerConoid vtkParametricPseudosphere vtkParametricRandomHills vtkParametricRoman vtkParametricSuperToroid vtkParametricTorus vtkParticlePathFilter vtkParticleTracer vtkParticleTracerBase vtkPartitionBalancer vtkPartitionedArchiver vtkPartitionedDataSet vtkPartitionedDataSetAlgorithm vtkPartitionedDataSetCollection vtkPartitionedDataSetCollectionAlgorithm vtkPartitionedDataSetCollectionSource vtkPartitionedDataSetSource vtkPartitioningStrategy vtkPassArrays vtkPassInputTypeAlgorithm vtkPassSelectedArrays vtkPassThroughEdgeStrategy vtkPassThroughLayoutStrategy vtkPath vtkPen vtkPentagonalPrism vtkPeriodicDataArray vtkPeriodicFilter vtkPeriodicTable vtkPerturbCoincidentVertices vtkPhyloXMLTreeReader vtkPhyloXMLTreeWriter vtkPicker vtkPickingManager vtkPieChartActor vtkPieceRequestFilter vtkPieceScalars vtkPiecewiseControlPointsItem vtkPiecewiseFunctionAlgorithm vtkPiecewiseFunctionItem vtkPiecewiseFunctionShiftScale vtkPiecewisePointHandleItem vtkPipelineGraphSource vtkPipelineSize vtkPixel vtkPixelBufferObject vtkPixelExtent vtkPixelExtentIO vtkPixelTransfer vtkPlaneCollection vtkPlaneCutter vtkPlaybackRepresentation vtkPlaybackWidget vtkPlot vtkPlot3D vtkPlot3DMetaReader vtkPlotArea vtkPlotBag vtkPlotBar vtkPlotBarRangeHandlesItem vtkPlotBox vtkPlotFunctionalBag vtkPlotGrid vtkPlotHistogram2D vtkPlotLine vtkPlotLine3D vtkPlotParallelCoordinates vtkPlotPie vtkPlotPoints vtkPlotPoints3D vtkPlotRangeHandlesItem vtkPlotStacked vtkPlotSurface vtkPointCloudFilter vtkPointCloudRepresentation vtkPointCloudWidget vtkPointConnectivityFilter vtkPointData vtkPointDataToCellData vtkPointDensityFilter vtkPointFillPass vtkPointGaussianMapper vtkPointHandleRepresentation3D vtkPointHandleSource vtkPointInterpolator vtkPointInterpolator2D vtkPointLoad vtkPointLocator vtkPointOccupancyFilter vtkPointPicker vtkPointPlacer vtkPointSet vtkPointSetAlgorithm vtkPointSetCellIterator vtkPointSetStreamer vtkPointSetToLabelHierarchy vtkPointSetToMoleculeFilter vtkPointSetToOctreeImageFilter vtkPointSmoothingFilter vtkPointWidget vtkPoints2D vtkPointsProjectedHull vtkPoissonDiskSampler vtkPolarAxesActor vtkPolarAxesActor2D vtkPolyDataAlgorithm vtkPolyDataCollection vtkPolyDataContourLineInterpolator vtkPolyDataEdgeConnectivityFilter vtkPolyDataInternals vtkPolyDataItem vtkPolyDataMapperNode vtkPolyDataPlaneClipper vtkPolyDataPlaneCutter vtkPolyDataPointPlacer vtkPolyDataPointSampler vtkPolyDataSilhouette vtkPolyDataSourceWidget vtkPolyDataStreamer vtkPolyDataTangents vtkPolyDataToImageStencil vtkPolyDataToReebGraphFilter vtkPolyDataToUnstructuredGrid vtkPolyDataWriter vtkPolyLineRepresentation vtkPolyLineSource vtkPolyLineWidget vtkPolyPlane vtkPolyPointSource vtkPolyVertex vtkPolygonBuilder vtkPolygonalHandleRepresentation3D vtkPolygonalSurfaceContourLineInterpolator vtkPolygonalSurfacePointPlacer vtkPolyhedron vtkPolyhedronUtilities vtkPolynomialSolversUnivariate vtkPostScriptWriter vtkPostgreSQLDatabase vtkPostgreSQLDatabasePrivate vtkPostgreSQLQuery vtkPostgreSQLToTableReader vtkPriorityQueue vtkProStarReader vtkProbabilisticVoronoiKernel vtkProbeLineFilter vtkProbePolyhedron vtkProbeSelectedLocations vtkProcess vtkProcessGroup vtkProcessIdScalars vtkProcrustesAlignmentFilter vtkProgrammableAttributeDataFilter vtkProgrammableDataObjectSource vtkProgrammableElectronicData vtkProgrammableFilter vtkProgrammableGlyphFilter vtkProgrammableSource vtkProgressBarRepresentation vtkProgressBarWidget vtkProgressObserver vtkProjectPointsToPlane vtkProjectedTerrainPath vtkProjectedTetrahedraMapper vtkProjectedTexture vtkProp vtkProp3D vtkProp3DAxisFollower vtkProp3DButtonRepresentation vtkProp3DCollection vtkProp3DFollower vtkPropAssembly vtkPropItem vtkPropPicker vtkProperty2D vtkPruneTreeFilter vtkPythonAlgorithm vtkPythonArchiver vtkPythonItem vtkQImageToImageSource vtkQWidgetRepresentation vtkQWidgetTexture vtkQWidgetWidget vtkQtAbstractModelAdapter vtkQtAnnotationLayersModelAdapter vtkQtAnnotationView vtkQtConnection vtkQtDebugLeaksModel vtkQtDebugLeaksView vtkQtInitialization vtkQtLabelRenderStrategy vtkQtListView vtkQtRecordView vtkQtSQLDatabase vtkQtSQLQuery vtkQtStringToImage vtkQtTableModelAdapter vtkQtTableRepresentation vtkQtTableView vtkQtTimePointUtility vtkQtTreeModelAdapter vtkQtTreeRingLabelMapper vtkQtTreeView vtkQtView vtkQuadRotationalExtrusionFilter vtkQuadraticEdge vtkQuadraticHexahedron vtkQuadraticLinearQuad vtkQuadraticLinearWedge vtkQuadraticPolygon vtkQuadraticPyramid vtkQuadraticQuad vtkQuadraticTetra vtkQuadraticTriangle vtkQuadraticWedge vtkQuadraturePointInterpolator vtkQuadraturePointsGenerator vtkQuadratureSchemeDefinition vtkQuadratureSchemeDictionaryGenerator vtkQuadric vtkQuadricClustering vtkQuadricDecimation vtkQuadricLODActor vtkQuantizePolyDataPoints vtkQuaternion vtkQuaternionInterpolator vtkQuaterniond vtkQuaternionf vtkRIBExporter vtkRIBLight vtkRIBProperty vtkRISReader vtkROIStencilSource vtkRTXMLPolyDataReader vtkRadialGridActor2D vtkRadiusOutlierRemoval vtkRandomAttributeGenerator vtkRandomHyperTreeGridSource vtkRandomLayoutStrategy vtkRandomPool vtkRandomSequence vtkRangeHandlesItem vtkRasterReprojectionFilter vtkRayCastImageDisplayHelper vtkRayCastStructures vtkReaderAlgorithm vtkRearrangeFields vtkRecoverGeometryWireframe vtkRect vtkRectangularButtonSource vtkRectd vtkRectf vtkRecti vtkRectilinearGridAlgorithm vtkRectilinearGridClip vtkRectilinearGridGeometryFilter vtkRectilinearGridOutlineFilter vtkRectilinearGridPartitioner vtkRectilinearGridReader vtkRectilinearGridToPointSet vtkRectilinearGridWriter vtkRectilinearSynchronizedTemplates vtkRectilinearWipeRepresentation vtkRectilinearWipeWidget vtkRecursiveDividingCubes vtkRecursiveSphereDirectionEncoder vtkRedistributeDataSetFilter vtkReduceTable vtkReebGraph vtkReebGraphSimplificationFilter vtkReebGraphSimplificationMetric vtkReebGraphSurfaceSkeletonFilter vtkReebGraphToJoinSplitTreeFilter vtkReebGraphVolumeSkeletonFilter vtkReferenceCount vtkRemoteInteractionAdapter vtkRemoveDuplicatePolys vtkRemoveGhosts vtkRemoveHiddenData vtkRemoveIsolatedVertices vtkRemovePolyData vtkRemoveUnusedPoints vtkRenderLargeImage vtkRenderPass vtkRenderPassCollection vtkRenderState vtkRenderStepsPass vtkRenderTimerLog vtkRenderViewBase vtkRenderWidget vtkRenderWindowCollection vtkRenderWindowInteractor3D vtkRenderbuffer vtkRenderedAreaPicker vtkRenderedGraphRepresentation vtkRenderedHierarchyRepresentation vtkRenderedRepresentation vtkRenderedSurfaceRepresentation vtkRenderedTreeAreaRepresentation vtkRendererCollection vtkRendererDelegate vtkRendererNode vtkRendererSource vtkRenderingCellGrid vtkResampleToImage vtkResampleWithDataSet vtkReservoirSampler vtkReservoirSamplerBase vtkResizingWindowToImageFilter vtkResliceCursor vtkResliceCursorActor vtkResliceCursorLineRepresentation vtkResliceCursorPicker vtkResliceCursorPolyDataAlgorithm vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation vtkResliceCursorWidget vtkResliceImageViewer vtkResliceImageViewerMeasurements vtkResourceFileLocator vtkResourceParser vtkResourceStream vtkReverseSense vtkRotationFilter vtkRowQuery vtkRowQueryToTable vtkRungeKutta2 vtkRungeKutta4 vtkRungeKutta45 vtkSCurveSpline vtkSDL2OpenGL2RenderWindow vtkSDL2OpenGLRenderWindow vtkSDL2RenderWindowInteractor vtkSDL2WebGPURenderWindow vtkSEPReader vtkSILBuilder vtkSLACParticleReader vtkSLACReader vtkSMPContourGrid vtkSMPMergePoints vtkSMPMergePolyDataHelper vtkSMPProgressObserver vtkSMPThreadLocal vtkSMPThreadLocalAPI vtkSMPThreadLocalImpl vtkSMPThreadLocalImplAbstract vtkSMPThreadLocalObject vtkSMPThreadPool vtkSMPTools vtkSMPToolsAPI vtkSMPToolsAPIInitialize vtkSMPToolsImpl vtkSOADataArrayTemplate vtkSPHCubicKernel vtkSPHInterpolator vtkSPHKernel vtkSPHQuarticKernel vtkSPHQuinticKernel vtkSQLDatabase vtkSQLDatabaseGraphSource vtkSQLDatabaseSchema vtkSQLDatabaseTableSource vtkSQLGraphReader vtkSQLQuery vtkSQLiteDatabase vtkSQLiteDatabaseInternals vtkSQLiteQuery vtkSQLiteToTableReader vtkSSAAPass vtkSSAOPass vtkSVGContextDevice2D vtkSVGExporter vtkSampleImplicitFunctionFilter vtkScalarBarActorInternal vtkScalarBarRepresentation vtkScalarBarWidget vtkScalarTree vtkScalarsToColors vtkScalarsToColorsItem vtkScalarsToTextureFilter vtkScaledSOADataArrayTemplate vtkScaledTextActor vtkScatterPlotMatrix vtkScenePicker vtkSectorSource vtkSegYBinaryHeaderBytesPositions vtkSegYIOUtils vtkSegYReader vtkSegYReaderInternal vtkSegYTrace vtkSegYTraceHeaderBytesPositions vtkSegYTraceReader vtkSelectEnclosedPoints vtkSelectPolyData vtkSelectVisiblePoints vtkSelectionAlgorithm vtkSelectionSource vtkSelector vtkSequencePass vtkSerializer vtkServerSocket vtkShader vtkShaderProgram vtkShaderProperty vtkShadowMapBakerPass vtkShadowMapPass vtkSharedFuture vtkSharedFutureBase vtkShepardKernel vtkShepardMethod vtkShortArray vtkSignedCharArray vtkSignedDistance vtkSimple3DCirclesStrategy vtkSimpleBondPerceiver vtkSimpleCellTessellator vtkSimpleElevationFilter vtkSimpleImageToImageFilter vtkSimpleMotionBlurPass vtkSimpleReader vtkSimpleScalarTree vtkSingleVTPExporter vtkSkybox vtkSliceAndDiceLayoutStrategy vtkSliceCubes vtkSliderRepresentation3D vtkSmartPointer vtkSmartPointerBase vtkSmartVector vtkSmartVolumeMapper vtkSmoothErrorMetric vtkSobelGradientMagnitudePass vtkSocket vtkSocketCollection vtkSocketCommunicator vtkSocketController vtkSortDataArray vtkSortFieldData vtkSortFileNames vtkSpanSpace vtkSpanTreeLayoutStrategy vtkSparseArray vtkSparseArrayToTable vtkSpatialRepresentationFilter vtkSpatioTemporalHarmonicsAttribute vtkSpatioTemporalHarmonicsSource vtkSphereHandleRepresentation vtkSpherePuzzle vtkSpherePuzzleArrows vtkSphereRepresentation vtkSphereTree vtkSphereTreeFilter vtkSphereWidget vtkSphereWidget2 vtkSpheres vtkSphericalDirectionEncoder vtkSphericalHarmonics vtkSphericalPointIterator vtkSphericalTransform vtkSpiderPlotActor vtkSpline vtkSplineFilter vtkSplineGraphEdges vtkSplineRepresentation vtkSplineWidget vtkSplitByCellScalarFilter vtkSplitColumnComponents vtkSplitField vtkSplitSharpEdgesPolyData vtkSquarifyLayoutStrategy vtkStackedTreeLayoutStrategy vtkStateStorage vtkStaticCellLinks vtkStaticCellLinksTemplate vtkStaticCellLocator vtkStaticCleanPolyData vtkStaticCleanUnstructuredGrid vtkStaticCompositeSource vtkStaticDataSource vtkStaticEdgeLocatorTemplate vtkStaticFaceHashLinksTemplate vtkStaticPointLocator vtkStaticPointLocator2D vtkStatisticalOutlierRemoval vtkStatisticsAlgorithm vtkStatisticsAlgorithmPrivate vtkStdString vtkStereoCompositor vtkStitchImageDataWithGhosts vtkStrahlerMetric vtkStreaklineFilter vtkStreamGraph vtkStreamSurface vtkStreamTracer vtkStreamerBase vtkStreamingDemandDrivenPipeline vtkStreamingStatistics vtkStreamingTessellator vtkStringArray vtkStringOutputWindow vtkStringToCategory vtkStringToImage vtkStringToNumeric vtkStringToken vtkStructuredAMRGridConnectivity vtkStructuredAMRNeighbor vtkStructuredCellArray vtkStructuredData vtkStructuredDataPlaneCutter vtkStructuredExtent vtkStructuredGridAlgorithm vtkStructuredGridAppend vtkStructuredGridClip vtkStructuredGridConnectivity vtkStructuredGridLIC2D vtkStructuredGridPartitioner vtkStructuredGridReader vtkStructuredGridWriter vtkStructuredImplicitConnectivity vtkStructuredNeighbor vtkStructuredPointArray vtkStructuredPointBackend vtkStructuredPointsCollection vtkStructuredPointsGeometryFilter vtkStructuredPointsWriter vtkStructuredTPointBackend vtkSubCommunicator vtkSubGroup vtkSubPixelPositionEdgels vtkSubdivideTetra vtkSubdivisionFilter vtkSurfaceLICComposite vtkSurfaceLICHelper vtkSurfaceLICInterface vtkSurfaceLICMapper vtkSurfaceNets2D vtkSurfaceNets3D vtkSurfaceReconstructionFilter vtkSynchronizeTimeFilter vtkSynchronizedRenderWindows vtkSynchronizedRenderers vtkSynchronizedTemplates2D vtkSynchronizedTemplates3D vtkSynchronizedTemplatesCutter3D vtkSystemIncludes vtkTDxInteractorStyle vtkTDxInteractorStyleCamera vtkTDxInteractorStyleSettings vtkTDxMotionEventInfo vtkTDxQtUnixDevices vtkTGAReader vtkTIFFReaderInternal vtkTRUCHASReader vtkTable vtkTableAlgorithm vtkTableBasedClipCases vtkTableBasedClipDataSet vtkTableFFT vtkTableReader vtkTableToArray vtkTableToDatabaseWriter vtkTableToGraph vtkTableToMySQLWriter vtkTableToPolyData vtkTableToPostgreSQLWriter vtkTableToSQLiteWriter vtkTableToSparseArray vtkTableToStructuredGrid vtkTableToTreeFilter vtkTableWriter vtkTanglegramItem vtkTclCommand vtkTecplotReader vtkTecplotTableReader vtkTemplateAliasMacro vtkTemporalAlgorithm vtkTemporalArrayOperatorFilter vtkTemporalDataSetCache vtkTemporalDelimitedTextReader vtkTemporalFractal vtkTemporalInterpolatedVelocityField vtkTemporalInterpolator vtkTemporalPathLineFilter vtkTemporalShiftScale vtkTemporalSnapToTimeStep vtkTemporalStatistics vtkTensorGlyph vtkTensorPrincipalInvariants vtkTensorProbeRepresentation vtkTensorProbeWidget vtkTensorRepresentation vtkTensorWidget vtkTerrainContourLineInterpolator vtkTerrainDataPointPlacer vtkTessellatedBoxSource vtkTessellatorFilter vtkTestDataArray vtkTestNewVar vtkTextActor3D vtkTextCodec vtkTextCodecFactory vtkTextPropertyCollection vtkTextRenderer vtkTextRendererCleanup vtkTextRendererStringToImage vtkTextSource vtkTextureIO vtkTextureImageCache vtkTextureMapToCylinder vtkTextureMapToPlane vtkTextureMapToSphere vtkTextureObject vtkTextureUnitManager vtkTexturedActor2D vtkTexturedButtonRepresentation vtkTexturedButtonRepresentation2D vtkThreadedCallbackQueue vtkThreadedCompositeDataPipeline vtkThreadedImageAlgorithm vtkThreadedImageWriter vtkThreadedTaskQueue vtkThresholdGraph vtkThresholdTable vtkThresholdTextureCoords vtkTimeInformation vtkTimePointUtility vtkTimeRange vtkTimeSource vtkTimeStamp vtkTimerLogCleanup vtkTimerLogScope vtkToAffineArrayStrategy vtkToConstantArrayStrategy vtkToImplicitArrayFilter vtkToImplicitRamerDouglasPeuckerStrategy vtkToImplicitStrategy vtkToImplicitTypeErasureStrategy vtkToneMappingPass vtkTooltipItem vtkTransferAttributes vtkTransform2D vtkTransformCollection vtkTransformConcatenation vtkTransformConcatenationStack vtkTransformCoordinateSystems vtkTransformFeedback vtkTransformInterpolator vtkTransformPair vtkTransformToGrid vtkTranslucentPass vtkTransmitImageDataPiece vtkTransmitPolyDataPiece vtkTransmitRectilinearGridPiece vtkTransmitStructuredDataPiece vtkTransmitStructuredGridPiece vtkTransmitUnstructuredGridPiece vtkTransposeMatrix vtkTransposeTable vtkTree vtkTreeAlgorithm vtkTreeAreaView vtkTreeBFSIterator vtkTreeCompositer vtkTreeDFSIterator vtkTreeDifferenceFilter vtkTreeFieldAggregator vtkTreeHeatmapItem vtkTreeIterator vtkTreeLayoutStrategy vtkTreeLevelsFilter vtkTreeMapLayout vtkTreeMapLayoutStrategy vtkTreeMapToPolyData vtkTreeMapView vtkTreeOrbitLayoutStrategy vtkTreeReader vtkTreeRingToPolyData vtkTreeRingView vtkTreeWriter vtkTriQuadraticHexahedron vtkTriQuadraticPyramid vtkTriangleMeshPointNormals vtkTriangularTCoords vtkTriangularTexture vtkTrimmedExtrusionFilter vtkTrivialConsumer vtkTrivialProducer vtkTryDowncastHelper1 vtkTryDowncastHelper2 vtkTryDowncastHelper3 vtkTubeBender vtkTulipReader vtkTuple vtkTupleInterpolator vtkTypeList vtkTypedArray vtkTypedDataArray vtkTypedDataArrayIterator vtkURI vtkURIComponent vtkURILoader vtkUTF16TextCodec vtkUTF8TextCodec vtkUncertaintyTubeFilter vtkUndirectedGraph vtkUndirectedGraphAlgorithm vtkUniformGrid vtkUniformGridAMR vtkUniformGridAMRAlgorithm vtkUniformGridAMRDataIterator vtkUniformGridPartitioner vtkUniformHyperTreeGrid vtkUniformHyperTreeGridSource vtkUniforms vtkUnsignedDistance vtkUnsignedIntArray vtkUnsignedLongArray vtkUnsignedLongLongArray vtkUnsignedShortArray vtkUnstructuredGridAlgorithm vtkUnstructuredGridBase vtkUnstructuredGridBaseAlgorithm vtkUnstructuredGridBunykRayCastFunction vtkUnstructuredGridCellIterator vtkUnstructuredGridGeometryFilter vtkUnstructuredGridHomogeneousRayIntegrator vtkUnstructuredGridLinearRayIntegrator vtkUnstructuredGridPartialPreIntegration vtkUnstructuredGridPreIntegration vtkUnstructuredGridQuadricDecimation vtkUnstructuredGridReader vtkUnstructuredGridToCellGrid vtkUnstructuredGridToExplicitStructuredGrid vtkUnstructuredGridToReebGraphFilter vtkUnstructuredGridVolumeMapper vtkUnstructuredGridVolumeRayCastFunction vtkUnstructuredGridVolumeRayCastIterator vtkUnstructuredGridVolumeRayCastMapper vtkUnstructuredGridVolumeRayIntegrator vtkUnstructuredGridVolumeZSweepMapper vtkUnstructuredGridWriter vtkUpdateCellsV8toV9 vtkVASPAnimationReader vtkVASPTessellationReader vtkVPICReader vtkVRCamera vtkVRCollaborationClient vtkVRControlsHelper vtkVRFollower vtkVRHMDCamera vtkVRHardwarePicker vtkVRInteractorStyle vtkVRMLExporter vtkVRMLUseStruct vtkVRMLYaccData vtkVRMenuRepresentation vtkVRMenuWidget vtkVRModel vtkVRPanelRepresentation vtkVRPanelWidget vtkVRRay vtkVRRenderWindow vtkVRRenderWindowInteractor vtkVRRenderer vtkValuePass vtkValueSelector vtkVariant vtkVariantArray vtkVariantBoostSerialization vtkVariantCast vtkVariantCreate vtkVariantExtract vtkVector vtkVector2 vtkVector2d vtkVector2f vtkVector2i vtkVector3 vtkVector3d vtkVector3f vtkVector3i vtkVector4 vtkVector4d vtkVector4i vtkVectorDot vtkVectorFieldTopology vtkVectorNorm vtkVeraOutReader vtkVersion vtkVertexAdjacencyList vtkVertexDegree vtkVertexListIterator vtkVideoSource vtkView vtkViewDependentErrorMetric vtkViewNode vtkViewNodeFactory vtkViewTheme vtkViewUpdater vtkViewport vtkVisibilitySort vtkVoidArray vtkVolume16Reader vtkVolumeCollection vtkVolumeContourSpectrumFilter vtkVolumeInputHelper vtkVolumeMapper vtkVolumeMapperNode vtkVolumeMask vtkVolumeNode vtkVolumeOfRevolutionFilter vtkVolumeOutlineSource vtkVolumePicker vtkVolumeRayCastSpaceLeapingImageFilter vtkVolumeReader vtkVolumeStateRAII vtkVolumeTexture vtkVolumetricPass vtkVoronoi2D vtkVoronoiKernel vtkVortexCore vtkVoxel vtkVoxelContoursToSurfaceFilter vtkVoxelGrid vtkVoxelModeller vtkVtkJSSceneGraphSerializer vtkVtkJSViewNodeFactory vtkWGPUContext vtkWarpLens vtkWarpScalar vtkWarpTransform vtkWarpVector vtkWasmSceneManager vtkWeakPointer vtkWeakPointerBase vtkWeakReference vtkWebApplication vtkWebAssemblyRenderWindowInteractor vtkWebGLDataSet vtkWebGLExporter vtkWebGLObject vtkWebGLPolyData vtkWebGLWidget vtkWebGPUActor vtkWebGPUCamera vtkWebGPUClearPass vtkWebGPUHardwareSelector vtkWebGPUInternalsBindGroup vtkWebGPUInternalsBindGroupLayout vtkWebGPUInternalsBuffer vtkWebGPUInternalsPipelineLayout vtkWebGPUInternalsRenderPassCreateInfo vtkWebGPUInternalsRenderPassDescriptor vtkWebGPUInternalsRenderPipelineDescriptor vtkWebGPUInternalsShaderModule vtkWebGPULight vtkWebGPUPolyDataMapper vtkWebGPUProperty vtkWebGPURenderPass vtkWebGPURenderWindow vtkWebGPURenderer vtkWebInteractionEvent vtkWebUtilities vtkWedge vtkWeightedTransformFilter vtkWendlandQuinticKernel vtkWidgetCallbackMapper vtkWidgetEvent vtkWidgetEventTranslator vtkWidgetRepresentation vtkWidgetSet vtkWin32HardwareWindow vtkWin32Header vtkWin32OpenGL2RenderWindow vtkWin32OpenGLDXRenderWindow vtkWin32OpenGLRenderWindow vtkWin32OutputWindow vtkWin32ProcessOutputWindow vtkWin32RenderWindowInteractor vtkWin32VideoSource vtkWindBladeReader vtkWindow vtkWindowLevelLookupTable vtkWindowNode vtkWindowedSincPolyDataFilter vtkWordCloud vtkWorldPointPicker vtkWrappingHints vtkWriter vtkX3DExporter vtkX3DExporterFIWriter vtkX3DExporterFIWriterHelper vtkX3DExporterWriter vtkX3DExporterXMLWriter vtkXGMLReader vtkXMLCompositeDataReader vtkXMLCompositeDataSetWriterHelper vtkXMLCompositeDataWriter vtkXMLDataElement vtkXMLDataHeader vtkXMLDataHeaderImpl vtkXMLDataObjectWriter vtkXMLDataParser vtkXMLDataReader vtkXMLDataSetWriter vtkXMLDataWriterHelper vtkXMLFileOutputWindow vtkXMLFileReadTester vtkXMLGenericDataObjectReader vtkXMLHierarchicalBoxDataFileConverter vtkXMLHierarchicalBoxDataReader vtkXMLHierarchicalBoxDataWriter vtkXMLHierarchicalDataReader vtkXMLHyperTreeGridReader vtkXMLHyperTreeGridWriter vtkXMLImageDataReader vtkXMLImageDataWriter vtkXMLMultiBlockDataReader vtkXMLMultiBlockDataWriter vtkXMLMultiGroupDataReader vtkXMLPDataObjectReader vtkXMLPDataObjectWriter vtkXMLPDataReader vtkXMLPDataSetWriter vtkXMLPDataWriter vtkXMLPHierarchicalBoxDataWriter vtkXMLPHyperTreeGridReader vtkXMLPHyperTreeGridWriter vtkXMLPImageDataReader vtkXMLPMultiBlockDataWriter vtkXMLPPolyDataReader vtkXMLPPolyDataWriter vtkXMLPRectilinearGridReader vtkXMLPRectilinearGridWriter vtkXMLPStructuredDataReader vtkXMLPStructuredDataWriter vtkXMLPStructuredGridReader vtkXMLPStructuredGridWriter vtkXMLPTableReader vtkXMLPTableWriter vtkXMLPUniformGridAMRWriter vtkXMLPUnstructuredDataReader vtkXMLPUnstructuredDataWriter vtkXMLPUnstructuredGridReader vtkXMLParser vtkXMLPartitionedDataSetCollectionReader vtkXMLPartitionedDataSetCollectionWriter vtkXMLPartitionedDataSetReader vtkXMLPartitionedDataSetWriter vtkXMLReader vtkXMLReaderVersion vtkXMLRectilinearGridWriter vtkXMLStructuredDataReader vtkXMLStructuredDataWriter vtkXMLTableReader vtkXMLTableWriter vtkXMLTreeReader vtkXMLUniformGridAMRReader vtkXMLUniformGridAMRWriter vtkXMLUnstructuredDataReader vtkXMLUnstructuredDataWriter vtkXMLUtilities vtkXMLWriter vtkXMLWriter2 vtkXMLWriterBase vtkXOpenGLRenderWindow vtkXRenderWindowInteractor vtkXWebGPURenderWindow vtkXYPlotActor vtkXYPlotRepresentation vtkXYPlotWidget vtkXYZMolReader vtkXYZMolReader2 vtkXdmf3ArrayKeeper vtkXdmf3ArraySelection vtkXdmf3DataSet vtkXdmf3HeavyDataHandler vtkXdmf3LightDataHandler vtkXdmf3Reader vtkXdmf3SILBuilder vtkXdmf3Writer vtkXdmfArraySelection vtkXdmfDataArray vtkXdmfDocument vtkXdmfDomain vtkXdmfHeavyData vtkXdmfReader vtkXdmfReaderInternal vtkXdmfWriter vtkYieldCriteria vtkYoungsMaterialInterface vtkZLibDataCompressor vtkZSpaceCamera vtkZSpaceCoreCompatibilitySDKManager vtkZSpaceCoreSDKManager vtkZSpaceGenericRenderWindow vtkZSpaceHardwarePicker vtkZSpaceInteractorStyle vtkZSpaceRayActor vtkZSpaceRenderWindowInteractor vtkZSpaceRenderer vtkZSpaceSDKManager vtkZSpaceWin32RenderWindow vtkmAverageToCells vtkmAverageToPoints vtkmCleanGrid vtkmClip vtkmContour vtkmCoordinateSystemTransform vtkmDataArray vtkmDataSet vtkmExternalFaces vtkmExtractVOI vtkmFilterOverrides vtkmGradient vtkmHistogram vtkmImageConnectivity vtkmLevelOfDetail vtkmNDHistogram vtkmPointElevation vtkmPointTransform vtkmPolyDataNormals vtkmProbe vtkmSlice vtkmThreshold vtkmTriangleMeshPointNormals vtkmWarpScalar vtkmWarpVector"},{"location":"Java/Coverage/JavaVTKClassesUsed/","title":"VTK Classes used in the Examples","text":""},{"location":"Java/Coverage/JavaVTKClassesUsed/#java","title":"Java","text":"

Out of 3113 available VTK classes, 273 are demonstrated here.

"},{"location":"Java/Coverage/JavaVTKClassesUsed/#excluded-classes","title":"Excluded classes","text":"

These classes are excluded since they occur in the majority of the examples:

VTK Class VTK Class VTK Class vtkActor vtkCamera vtkNamedColors vtkPolyDataMapper vtkProperty vtkRenderer vtkRenderWindow vtkRenderWindowInteractor"},{"location":"Java/Coverage/JavaVTKClassesUsed/#classes-used","title":"Classes used","text":"VTK Class Examples vtk3DSImporter ThreeDSImporter vtkActor2D Actor2D MultiLineText ThinPlateSplineTransform vtkActorCollection ThreeDSImporter VRMLImporter vtkAngleRepresentation2D AngleWidget2D vtkAngleWidget AngleWidget AngleWidget2D vtkAnnotatedCubeActor AnnotatedCubeActor vtkAnnotationLink SelectGraphVertices vtkAppendPolyData AnimDataCone BlobbyLogo ColorDisconnectedRegions ImplicitSphere vtkArrowSource Arrow BrownianPoints DistanceToCamera OrientedArrow OrientedGlyphs TransformFilter VectorFieldExample vtkAssembly Assembly vtkAxes TextOrigin vtkAxesActor DisplayCoordinateAxes vtkBalloonRepresentation BalloonWidget vtkBalloonWidget BalloonWidget vtkBMPReader ReadBMP ThinPlateSplineTransform vtkBoundedPointSource FitImplicitFunction vtkBoxWidget Cone6 vtkBrownianPoints BrownianPoints vtkCameraActor CameraActor vtkCaptionRepresentation CaptionWidget vtkCaptionWidget CaptionWidget vtkCellArray AddCell Bottle EllipticalCylinder ImplicitSphere LongLine MultiLineText Polygon Pyramid Quad RibbonFilter RuledSurfaceFilter Spring Triangle TriangleColoredPoints TriangleStrip Vertex WriteVTU vtkCellCenters CellCenters vtkCellPicker SwingHandleMouseEvent vtkCenterOfMass CenterOfMass vtkCMLMoleculeReader ReadCML vtkColorSeries ScalarBarActorColorSeries vtkColorTransferFunction MedicalDemo4 SimpleRayCast vtkCompassRepresentation CompassWidget vtkCompassWidget CompassWidget vtkCompositeDataDisplayAttributes CompositePolyDataMapper vtkCompositePolyDataMapper2 CompositePolyDataMapper vtkCone IceCream RandomProbe vtkConeSource AnimDataCone Cone Cone6 Mace PickableOff Reflection ReportRenderWindowCapabilities RotationAroundLine SpikeFran TrackballActor TrackballCamera vtkContourFilter BlobbyLogo IceCream PerlinNoise ReadSLC SampleFunction Vol vtkConvexPointSet ConvexPointSet vtkCoordinate MultiLineText vtkCornerAnnotation CornerAnnotation vtkCubeAxesActor CubeAxesActor vtkCubeAxesActor2D CubeAxesActor2D vtkCubeSource Assembly Cutter Follower Glyph3D Legend Opacity ShrinkCube SideBySideViewports VectorFieldExample vtkCursor2D Cursor2D vtkCursor3D Cursor3D vtkCutter Cutter vtkCylinderSource CylinderExample OrientedCylinder TransformPipeline vtkDataRepresentation SelectGraphVertices vtkDataSetMapper BlankPoint CellCenters ConvexHullShrinkWrap ConvexPointSet Frustum HyperTreeGridSource LoopShrink OrientationMarkerWidget Pyramid RandomProbe ReadPolyData ReadRectilinearGrid RectilinearGrid Reflection ShrinkCube VisualizeImageData VisualizeRectilinearGrid WriteVTU vtkDelaunay2D Delaunay2D DelaunayMesh vtkDelaunay3D XMLPUnstructuredGridWriter vtkDEMReader DEMReader vtkDICOMImageReader ReadDICOM vtkDiscretizableColorTransferFunction DiscretizableColorTransferFunction vtkDiskSource BoundaryEdges Disk vtkDistanceToCamera DistanceToCamera vtkDistanceWidget DistanceWidget vtkDoubleArray GeoAssignCoordinates MeshQuality RectilinearGrid RectilinearGridToTetrahedra VisualizeRectilinearGrid Vol vtkEarthSource EarthSource vtkElevationFilter ColoredSphere LoopShrink ProjectSphere vtkExodusIIWriter ExodusIIWriter vtkExtractEdges DelaunayMesh vtkExtractVOI ReadSLC vtkFeatureEdges BoundaryEdges vtkFitImplicitFunction FitImplicitFunction vtkFixedPointVolumeRayCastMapper MedicalDemo4 SimpleRayCast vtkFloatArray ColorCells KnownLengthArray ScalarBarActor ScalarBarActorColorSeries UnknownLengthArray vtkFollower Follower TextOrigin vtkFrustumSource Frustum vtkFunctionParser FunctionParser vtkGlyph2D Glyph2D vtkGlyph3D BrownianPoints ConvexHullShrinkWrap DelaunayMesh DistanceToCamera FitImplicitFunction Glyph3D Mace OrientedGlyphs RandomProbe SpikeFran VectorFieldExample vtkGlyph3DMapper ConvexPointSet KochanekSpline vtkGraphLayoutView GraphPoints RandomGraphSource SelectGraphVertices VisualizeGraph vtkGraphMapper GeoAssignCoordinates vtkHedgeHog ComplexV vtkHyperTreeGridSource HyperTreeGridSource vtkIdTypeArray SelectGraphVertices vtkImageActor Cast DEMReader Flip ImageFFT ImageNormalize ImageOrientation ImageTest ImageWeightedSum MedicalDemo3 RTAnalyticSource WritePNM WriteTIFF vtkImageBlend ThinPlateSplineTransform vtkImageCanvasSource2D JPEGWriter LogoWidget OggTheora ShotNoise WritePNM WriteTIFF XMLPImageDataWriter vtkImageCast Cast Flip ImageFFT ImageNormalize ImageWeightedSum vtkImageData CellCenters VisualizeImageData vtkImageDataGeometryFilter StructuredPointsReader vtkImageEllipsoidSource ImageFFT ImageOrientation vtkImageFFT ImageFFT vtkImageFlip Flip vtkImageGridSource ThinPlateSplineTransform vtkImageMandelbrotSource Cast Flip ImageWeightedSum vtkImageMapper ThinPlateSplineTransform vtkImageMapToColors DEMReader MedicalDemo3 ThinPlateSplineTransform vtkImageNormalize ImageNormalize vtkImagePermute ImageOrientation vtkImagePlaneWidget ImagePlaneWidget vtkImageReader2 ImageTest StaticImage TexturedSphere TexturePlane vtkImageReader2Factory ImageTest StaticImage TexturedSphere TexturePlane vtkImageReslice ThinPlateSplineTransform vtkImageSinusoidSource ImageNormalize ImageSinusoidSource ImageWeightedSum vtkImageTracerWidget ImageTracerWidgetNonPlanar vtkImageViewer2 ImageSinusoidSource JPEGReader PNGReader ReadBMP ReadDICOM ReadPNM ReadTIFF StaticImage vtkImageWeightedSum ImageWeightedSum vtkImplicitBoolean IceCream vtkImplicitDataSet ImplicitDataSet vtkImplicitModeller BlobbyLogo vtkInteractorObserver ImageTest vtkInteractorStyle Follower vtkInteractorStyleImage Cast DEMReader Flip Glyph2D Glyph3D ImageFFT ImageOrientation ImageTest RTAnalyticSource WritePNM WriteTIFF vtkInteractorStyleRubberBandPick RubberBandPick vtkInteractorStyleRubberBandZoom RubberBandZoom vtkInteractorStyleSwitch ProteinRibbons StyleSwitch vtkInteractorStyleTerrain InteractorStyleTerrain ThinPlateSplineTransform vtkInteractorStyleTrackball ImageTracerWidgetNonPlanar vtkInteractorStyleTrackballActor MoveActor TrackballActor vtkInteractorStyleTrackballCamera AnimDataCone Cone6 DistanceToCamera ImagePlaneWidget JFrameRenderer MoveCamera MultipleActors SwingHandleMouseEvent TrackballCamera vtkJPEGReader JPEGReader vtkJPEGWriter JPEGWriter vtkKdTreePointLocator VisualizeKDTree vtkKochanekSpline KochanekSpline vtkLegendBoxActor Legend vtkLegendScaleActor LegendScaleActor vtkLight AmbientSpheres LightActor SpecularSpheres SpotLight vtkLightActor LightActor vtkLine LongLine RuledSurfaceFilter vtkLinearExtrusionFilter EllipticalCylinder vtkLineSource Line LineWidth TubeFilter WarpTo vtkLODActor CubeAxesActor2D vtkLogoRepresentation LogoWidget vtkLogoWidget LogoWidget vtkLookupTable ColorCells ColorLookupTable ComplexV DEMReader MedicalDemo3 ScalarBarActor ScalarBarActorColorSeries ThinPlateSplineTransform vtkMarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 vtkMaskPoints SpikeFran vtkMath BrownianPoints ColorCellsWithRGB DistanceBetweenPoints FitImplicitFunction NormalizeVector OrientedArrow OrientedCylinder RibbonFilter vtkMatrix3x3 MatrixInverse MatrixTranspose vtkMatrix4x4 OrientedArrow OrientedCylinder PerspectiveTransform vtkMeshQuality MeshQuality vtkMetaImageReader MedicalDemo1 MedicalDemo2 MedicalDemo3 MedicalDemo4 vtkMinimalStandardRandomSequence DelaunayMesh OrientedArrow OrientedCylinder RandomSequence vtkMoleculeMapper ReadCML vtkMultiBlockDataSet CompositePolyDataMapper vtkMultiBlockPLOT3DReader ReadPLOT3D vtkMutableDirectedGraph GeoAssignCoordinates vtkMutableUndirectedGraph GraphPoints VisualizeGraph vtkObject VectorFieldExample vtkOBJReader ReadOBJ vtkOctreePointLocator BuildOctree vtkOggTheoraWriter OggTheora vtkOrientationMarkerWidget DisplayCoordinateAxes OrientationMarkerWidget vtkOutlineFilter ComplexV CubeAxesActor2D MedicalDemo1 MedicalDemo2 MedicalDemo3 Outline ReadSLC SampleFunction vtkParametricFigure8Klein ParametricObjects vtkParametricFunctionSource KochanekSpline ParametricObjects ProjectSphere vtkParametricSpline KochanekSpline vtkParametricSuperEllipsoid ProjectSphere vtkParticleReader ParticleReader vtkPassThrough PassThrough vtkPDBReader ProteinRibbons vtkPerlinNoise PerlinNoise vtkPerspectiveTransform PerspectiveTransform vtkPiecewiseFunction MedicalDemo4 PiecewiseFunction SimpleRayCast vtkPlane Cutter IceCream ProjectPointPlane vtkPlanes Frustum vtkPlanesIntersection PlanesIntersection vtkPlaneSource ColorCells ColorCellsWithRGB SpotLight TexturePlane vtkPlaneWidget PlaneWidget vtkPlatonicSolidSource CubeAxesActor2D vtkPLYReader ReadPLY WritePLY vtkPLYWriter ConvertFile WritePLY vtkPNGReader PNGReader vtkPNGWriter Cone6 Screenshot ShotNoise vtkPNMReader ReadPNM WritePNM vtkPNMWriter WritePNM vtkPointHandleRepresentation2D SeedWidget vtkPoints Actor2D AddCell AnimDataCone BlankPoint Bottle BuildOctree CenterOfMass ColoredPoints ConvexPointSet Delaunay2D DelaunayMesh EllipticalCylinder Glyph2D Glyph3D GraphPoints ImplicitSphere KochanekSpline LongLine MultiLineText PlanesIntersection Polygon Pyramid Quad RibbonFilter RuledSurfaceFilter Spring StructuredGridOutline StructuredPointsToUnstructuredGrid ThinPlateSplineTransform Triangle TriangleColoredPoints TriangleStrip Vertex VertexGlyphFilter WriteVTP WriteVTU XMLStructuredGridWriter vtkPointSource ConvexHullShrinkWrap DistanceToCamera KochanekSpline RandomProbe ScalarVisibility VisualizeKDTree vtkPolyData Actor2D AddCell AnimDataCone Bottle BuildOctree CenterOfMass ColoredPoints ConvexPointSet Delaunay2D DelaunayMesh EllipticalCylinder Glyph2D Glyph3D ImplicitSphere KochanekSpline Legend LongLine MeshQuality MultiLineText OrientedGlyphs Polygon ProjectSphere Quad RibbonFilter RuledSurfaceFilter ScalarBarActor ScalarBarActorColorSeries Spring Triangle TriangleColoredPoints TriangleStrip VectorFieldExample Vertex VertexGlyphFilter VisualizeKDTree WriteVTP vtkPolyDataConnectivityFilter ColorDisconnectedRegions vtkPolyDataMapper2D Actor2D MultiLineText vtkPolyDataNormals BlobbyLogo CubeAxesActor2D SpikeFran Spring vtkPolyDataReader BlobbyLogo SpikeFran vtkPolygon Polygon vtkPolyLine EllipticalCylinder vtkProbeFilter RandomProbe vtkProjectSphereFilter ProjectSphere vtkPropCollection Assembly vtkProteinRibbonFilter ProteinRibbons vtkPyramid Pyramid vtkQuad Quad vtkRandomGraphSource RandomGraphSource SelectGraphVertices vtkRectilinearGrid RectilinearGrid RectilinearGridToTetrahedra VisualizeRectilinearGrid vtkRectilinearGridToTetrahedra RectilinearGridToTetrahedra vtkReflectionFilter Reflection vtkRegularPolygonSource BalloonWidget Circle Glyph2D RegularPolygonSource vtkRenderView RenderView vtkRibbonFilter RibbonFilter vtkRotationalExtrusionFilter Bottle Spring vtkRTAnalyticSource ImplicitDataSet RTAnalyticSource vtkRuledSurfaceFilter RuledSurfaceFilter vtkSampleFunction IceCream PerlinNoise RandomProbe SampleFunction vtkScalarBarActor ScalarBarActor ScalarBarActorColorSeries vtkSeedRepresentation SeedWidget vtkSeedWidget SeedWidget vtkSelection SelectGraphVertices vtkSelectionNode SelectGraphVertices vtkShrinkFilter Frustum HyperTreeGridSource LoopShrink ShrinkCube VisualizeRectilinearGrid vtkShrinkPolyData RegularPolygonSource vtkSimple2DLayoutStrategy VisualizeGraph vtkSimplePointsReader SimplePointsReader vtkSimplePointsWriter SimplePointsWriter vtkSLCReader ReadSLC vtkSliderRepresentation VisualizeKDTree vtkSliderRepresentation2D VisualizeKDTree vtkSliderWidget VisualizeKDTree vtkSmoothPolyDataFilter ConvexHullShrinkWrap vtkSphere FitImplicitFunction IceCream vtkSphereSource AmbientSpheres Animation Assembly BackfaceCulling BackgroundColor BackgroundGradient BalloonWidget BrownianPoints Camera CameraActor CaptionWidget ColorActorEdges ColorAnActor ColorDisconnectedRegions ColoredSphere CompassWidget CompositePolyDataMapper ConvexHullShrinkWrap ConvexPointSet CornerAnnotation Cursor2D Cursor3D CursorShape DelaunayMesh DisplayCoordinateAxes DistanceToCamera DrawText FitImplicitFunction FullScreen ImagePlaneWidget ImageTracerWidgetNonPlanar ImplicitSphere InteractorStyleTerrain JFrameRenderer KochanekSpline Legend LegendScaleActor LogoWidget LoopShrink Mace MeshQuality MoveActor MoveCamera MultipleActors MultipleViewports NoShading Opacity OrientedArrow OrientedCylinder OrientedGlyphs Outline PassThrough PlanesIntersection RandomProbe RenderView RubberBandPick RubberBandZoom ScalarBarActor ScalarBarActorColorSeries Screenshot SeedWidget SideBySideViewports SimplePointsWriter SpecularSpheres Stripper StyleSwitch SwingHandleMouseEvent TextWidget TrackballActor TrackballCamera TransformPolyData WindowSize WireframeSphere WritePLY WriteSTL XMLPUnstructuredGridWriter vtkSplineWidget2 SplineWidget vtkSTLReader ReadSTL WriteSTL vtkSTLWriter WriteSTL vtkStripper Bottle MedicalDemo2 MedicalDemo3 Stripper vtkStructuredGrid BlankPoint StructuredGridOutline XMLStructuredGridWriter vtkStructuredGridGeometryFilter ReadPLOT3D ReadStructuredGrid vtkStructuredGridOutlineFilter StructuredGridOutline vtkStructuredPoints StructuredPointsToUnstructuredGrid Vol vtkStructuredPointsReader ComplexV SimpleRayCast StructuredPointsReader vtkSuperquadric SampleFunction vtkSuperquadricSource CubeAxesActor OrientationMarkerWidget vtkTetra WriteVTU vtkTextActor DrawText TextActor TextWidget vtkTextMapper MultiLineText vtkTextProperty CubeAxesActor2D MultiLineText vtkTextRepresentation TextWidget vtkTexture TexturedSphere TexturePlane vtkTexturedSphereSource TexturedSphere vtkTextWidget TextWidget vtkThinPlateSplineTransform ThinPlateSplineTransform vtkThreshold RandomProbe vtkThresholdPoints RandomProbe VectorFieldExample vtkTIFFReader ReadTIFF WriteTIFF vtkTIFFWriter WriteTIFF vtkTimerLog TimerLog vtkTimeSourceExample ExodusIIWriter vtkTransform AnimDataCone Assembly BlobbyLogo Cone6 OrientedArrow OrientedCylinder PerspectiveTransform RotationAroundLine SpikeFran TransformFilter TransformPipeline TransformPolyData vtkTransformFilter TransformFilter vtkTransformPolyDataFilter BlobbyLogo OrientedArrow OrientedCylinder RotationAroundLine SpikeFran TransformPolyData vtkTransformTextureCoords TexturedSphere vtkTriangle AddCell Triangle TriangleColoredPoints vtkTriangleFilter MeshQuality vtkTriangleStrip TriangleStrip vtkTubeFilter Bottle DelaunayMesh ImplicitSphere TubeFilter WarpTo vtkUnsignedCharArray ColorCellsWithRGB ColoredPoints TriangleColoredPoints vtkUnstructuredGrid ConvexPointSet Pyramid StructuredPointsToUnstructuredGrid VectorFieldExample WriteVTU vtkVectorText Follower TextOrigin vtkVertex Vertex vtkVertexGlyphFilter Actor2D ColoredPoints Delaunay2D VertexGlyphFilter vtkVolume MedicalDemo4 SimpleRayCast vtkVolumeProperty MedicalDemo4 SimpleRayCast vtkVRMLImporter VRMLImporter vtkWarpTo WarpTo vtkWindowToImageFilter Cone6 Screenshot vtkXMLPImageDataWriter XMLPImageDataWriter vtkXMLPolyDataReader ConvertFile OrientationMarkerWidget ReadPolyData ReadVTP RotationAroundLine VisualizeVTP vtkXMLPolyDataWriter RotationAroundLine WriteVTP vtkXMLPUnstructuredGridWriter XMLPUnstructuredGridWriter vtkXMLRectilinearGridReader ReadRectilinearGrid vtkXMLStructuredGridReader ReadStructuredGrid vtkXMLStructuredGridWriter XMLStructuredGridWriter vtkXMLUnstructuredGridReader VectorFieldExample WriteVTU vtkXMLUnstructuredGridWriter RectilinearGridToTetrahedra StructuredPointsToUnstructuredGrid WriteVTU"},{"location":"Java/DataStructures/BuildOctree/","title":"BuildOctree","text":"

vtk-examples/Java/DataStructures/BuildOctree

"},{"location":"Java/DataStructures/BuildOctree/#description","title":"Description","text":"

Given a vtkDataSet, create an octree that is locally refined such that all leaf octants contain less than a certain amount of points.

Note that there is no size constraint that a leaf octant in relation to any of its neighbors.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/DataStructures/BuildOctree/#code","title":"Code","text":"

BuildOctree.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkOctreePointLocator;\npublic class BuildOctree \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //  Setup point coordinates\n    double x[] = new double[] {1.0, 0.0, 0.0};\n    double y[] = new double[] {0.0, 1.0, 0.0};\n    double z[] = new double[] {0.0, 0.0, 1.0};\n\n    vtkPoints points = new vtkPoints();\n\n    for(int i = 0; i < 3; ++i)\n    {\n      points.InsertNextPoint ( x[i], y[i], z[i] );\n    }\n\n    System.out.println(\"There are \" + \" \" + points.GetNumberOfPoints() + \" \" + \"points.\");\n\n    vtkPolyData polydata = new vtkPolyData();\n    polydata.SetPoints(points);\n\n    //Create the tree\n    vtkOctreePointLocator octree = new vtkOctreePointLocator();\n    octree.SetDataSet(polydata);\n    octree.BuildLocator();\n    System.out.println(\"Number of points in tree: \" + \" \" + octree.GetDataSet().GetNumberOfPoints());\n\n    double p[] = new double[3];\n    octree.GetDataSet().GetPoint(0,p);\n    System.out.println(\"p: \" + \" \" + p[0] + \" \" + p[1] + \" \" +p[2]);\n  }\n}\n
"},{"location":"Java/DataStructures/VisualizeKDTree/","title":"VisualizeKDTree","text":"

vtk-examples/Java/DataStructures/VisualizeKDTree

"},{"location":"Java/DataStructures/VisualizeKDTree/#description","title":"Description","text":"

This demo shows every level of a kdTree.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/DataStructures/VisualizeKDTree/#code","title":"Code","text":"

VisualizeKDTree.java

import vtk.*;\n\npublic class VisualizeKDTree\n{\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  static class vtkSliderCallback\n  {\n    void Execute()\n    {\n      this.Level = (int)Math.round(((vtkSliderRepresentation)SliderWidget.GetRepresentation()).GetValue());\n      this.KdTree.GenerateRepresentation(this.Level, this.PolyData);\n      this.Renderer.Render();\n    }\n\n    vtkKdTreePointLocator KdTree;\n    int Level = 0;\n    vtkPolyData PolyData;\n    vtkRenderer Renderer;\n    vtkSliderWidget SliderWidget;\n  }\n\n  public static void main(String[] args)\n  {\n    // Create a point cloud\n    vtkPointSource pointSource = new vtkPointSource();\n    pointSource.SetRadius(4);\n    pointSource.SetNumberOfPoints(1000);\n    pointSource.Update();\n\n    vtkPolyDataMapper pointsMapper = new vtkPolyDataMapper();\n    pointsMapper.SetInputConnection(pointSource.GetOutputPort());\n\n    vtkActor pointsActor = new vtkActor();\n    pointsActor.SetMapper(pointsMapper);\n    pointsActor.GetProperty().SetInterpolationToFlat();\n\n    int maxLevel = 20;\n    // Create the tree\n    vtkKdTreePointLocator kdTree = new vtkKdTreePointLocator();\n    kdTree.SetDataSet(pointSource.GetOutput());\n    kdTree.AutomaticOff();\n    kdTree.SetMaxLevel(maxLevel);\n    kdTree.BuildLocator();\n\n    // Initialize the representation\n    vtkPolyData polydata = new vtkPolyData();\n    kdTree.GenerateRepresentation(0, polydata);\n\n    vtkPolyDataMapper octreeMapper = new vtkPolyDataMapper();\n    octreeMapper.SetInputConnection(polydata.GetProducerPort());\n\n    vtkActor octreeActor = new vtkActor();\n    octreeActor.SetMapper(octreeMapper);\n    octreeActor.GetProperty().SetInterpolationToFlat();\n    octreeActor.GetProperty().SetRepresentationToWireframe();\n\n    // A renderer and render window\n    vtkRenderer renderer = new vtkRenderer();\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.AddRenderer(renderer);\n\n    // An interactor\n    vtkRenderWindowInteractor renderWindowInteractor =\n      new vtkRenderWindowInteractor();\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n\n    // Add the actors to the scene\n    renderer.AddActor(pointsActor);\n    renderer.AddActor(octreeActor);\n\n    // Render an image (lights and cameras are created automatically)\n    renderWindow.Render();\n\n    vtkSliderRepresentation2D sliderRep = new vtkSliderRepresentation2D();\n    sliderRep.SetMinimumValue(0);\n    sliderRep.SetMaximumValue(kdTree.GetLevel());\n    sliderRep.SetValue(0);\n    sliderRep.SetTitleText(\"Level\");\n    sliderRep.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay();\n    sliderRep.GetPoint1Coordinate().SetValue(.2, .2);\n    sliderRep.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay();\n    sliderRep.GetPoint2Coordinate().SetValue(.8, .2);\n    sliderRep.SetSliderLength(0.075);\n    sliderRep.SetSliderWidth(0.05);\n    sliderRep.SetEndCapLength(0.05);\n\n    vtkSliderWidget sliderWidget = new vtkSliderWidget();\n    sliderWidget.SetInteractor(renderWindowInteractor);\n    sliderWidget.SetRepresentation(sliderRep);\n    sliderWidget.SetAnimationModeToAnimate();\n    sliderWidget.EnabledOn();\n\n    vtkSliderCallback callback = new vtkSliderCallback();\n    callback.KdTree = kdTree;\n    callback.PolyData = polydata;\n    callback.Renderer = renderer;\n    callback.SliderWidget = sliderWidget;\n\n    sliderWidget.AddObserver(\"InteractionEvent\", callback, \"Execute\");\n\n    renderWindowInteractor.Initialize();\n    renderWindow.Render();\n\n    renderWindowInteractor.Start();\n  }\n}\n
"},{"location":"Java/Filtering/Delaunay2D/","title":"Delaunay2D","text":"

vtk-examples/Java/Filtering/Delaunay2D

"},{"location":"Java/Filtering/Delaunay2D/#description","title":"Description","text":"

This example generates a set of points aligned with an XY grid with random heights (z values). The Delaunay2D filter \"magically\" knows how to triangulate this type of point set because it projects the points by default onto the XY axis and then performs a 2D Delaunay triangulation. The result is a mesh on the input points.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Filtering/Delaunay2D/#code","title":"Code","text":"

Delaunay2D.java

import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkDelaunay2D;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkVertexGlyphFilter;\n\npublic class Delaunay2D \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For PointActor Color \n    double PointActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n    //MeshActorColor\n    double MeshActorColor[] = new double[4];\n\n    colors.GetColor(\"Coral\", PointActorColor);\n    colors.GetColor(\"DimGray\", Bgcolor);\n    colors.GetColor(\"Aquamarine\", MeshActorColor);\n\n    //Create a set of heighs on a grid.\n    // This is often called a \"terrain map\".\n\n    vtkPoints Points = new vtkPoints();  \n\n    int GridSize = 10;\n    for(int x = 0; x < GridSize; x++)\n    {\n      for(int y = 0; y < GridSize; y++)\n      {\n        Points.InsertNextPoint(x, y, (x+y)/(y+1));\n      }\n    }\n\n    //Add the grid points to a polydata object\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n\n\n    //Triangulate the grid points\n    vtkDelaunay2D Delaunay = new vtkDelaunay2D();\n    Delaunay.SetInputData(PolyData);\n\n    vtkPolyDataMapper MeshMapper = new vtkPolyDataMapper();\n    MeshMapper.SetInputConnection(Delaunay.GetOutputPort());\n\n    vtkActor MeshActor = new vtkActor();\n    MeshActor.SetMapper(MeshMapper);\n    MeshActor.GetProperty().SetColor(MeshActorColor);\n    MeshActor.GetProperty().EdgeVisibilityOn();\n\n\n    vtkVertexGlyphFilter GlyphFilter = new vtkVertexGlyphFilter();\n    GlyphFilter.SetInputData(PolyData);\n\n    vtkPolyDataMapper PointMapper = new vtkPolyDataMapper();\n    PointMapper.SetInputConnection(GlyphFilter.GetOutputPort());\n\n    vtkActor PointActor = new vtkActor();\n    PointActor.GetProperty().SetColor(PointActorColor);\n    PointActor.GetProperty().SetPointSize(5);\n    PointActor.SetMapper(PointMapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(PointActor);\n    ren.AddActor(MeshActor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  } \n}\n
"},{"location":"Java/Filtering/Glyph2D/","title":"Glyph2D","text":"

vtk-examples/Java/Filtering/Glyph2D

"},{"location":"Java/Filtering/Glyph2D/#description","title":"Description","text":"

Copy a 2D glyph to every point in the input set. We use a hexagon for the demo.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Filtering/Glyph2D/#code","title":"Code","text":"

Glyph2D.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkActor;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkGlyph2D;\nimport vtk.vtkInteractorStyleImage;\nimport vtk.vtkRegularPolygonSource;\n\npublic class Glyph2D \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"IndianRed\",BgColor);\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0, 0, 0);\n    Points.InsertNextPoint(1, 1, 0);\n    Points.InsertNextPoint(2, 2, 0);\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n\n    vtkRegularPolygonSource PolygonSource = new vtkRegularPolygonSource();\n\n    vtkGlyph2D Glyph2D = new vtkGlyph2D();\n    Glyph2D.SetSourceConnection(PolygonSource.GetOutputPort());\n    Glyph2D.SetInputData(PolyData);\n    Glyph2D.Update();\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Glyph2D.GetOutputPort());\n    Mapper.Update();\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise \n    ren.AddActor(Actor);\n    vtkInteractorStyleImage Style = new vtkInteractorStyleImage();\n    iren.SetInteractorStyle(Style);\n\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Filtering/Glyph3D/","title":"Glyph3D","text":"

vtk-examples/Java/Filtering/Glyph3D

"},{"location":"Java/Filtering/Glyph3D/#description","title":"Description","text":"

This example applies an object at every point using vtkGlyph3D We use a cube for the demo.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Filtering/Glyph3D/#code","title":"Code","text":"

Glyph3D.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkActor;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkInteractorStyleImage;\nimport vtk.vtkCubeSource;\n\npublic class Glyph3D \n{\n    // -----------------------------------------------------------------\n    // Load VTK library and print which library was not properly loaded\n    static \n    {\n        if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n        {\n            for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n            {\n                if (!lib.IsLoaded()) \n                {\n                    System.out.println(lib.GetLibraryName() + \" not loaded\");\n                }\n            }\n        }\n        vtkNativeLibrary.DisableOutputWindow(null);\n    }\n    // -----------------------------------------------------------------\n\n    public static void main(String s[]) \n    {\n        vtkNamedColors Color = new vtkNamedColors(); \n\n        //For Renderer Background Color\n        double BgColor[] = new double[4];\n\n        //For Actor Color\n        double ActorColor[] = new double[4];\n\n        //Change Color Name to Use your own Color for Renderer Background\n        Color.GetColor(\"DarkSeaGreen\",BgColor);\n\n        //Change Color Name to Use your own Color for Actor\n        Color.GetColor(\"Yellow\",ActorColor);\n\n        vtkPoints Points = new vtkPoints();\n        Points.InsertNextPoint(0, 0, 0);\n        Points.InsertNextPoint(1, 1, 1);\n        Points.InsertNextPoint(2, 2, 2);\n\n        vtkPolyData PolyData = new vtkPolyData();\n        PolyData.SetPoints(Points);\n\n        // Create anything you want here, we will use a cube for the demo.\n        vtkCubeSource CubeSource = new vtkCubeSource();\n\n        vtkGlyph3D Glyph3D = new vtkGlyph3D();\n        Glyph3D.SetSourceConnection(CubeSource.GetOutputPort());\n        Glyph3D.SetInputData(PolyData);\n        Glyph3D.Update();\n\n        vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n        Mapper.SetInputConnection(Glyph3D.GetOutputPort());\n        Mapper.Update();\n\n        vtkActor Actor = new vtkActor();\n        Actor.SetMapper(Mapper);\n        Actor.GetProperty().SetColor(ActorColor);\n\n        // Create the renderer, render window and interactor.\n        vtkRenderer ren = new vtkRenderer();\n        vtkRenderWindow renWin = new vtkRenderWindow();\n        renWin.AddRenderer(ren);\n        vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n        iren.SetRenderWindow(renWin);\n\n        // Visualise the arrow\n        ren.AddActor(Actor);\n        vtkInteractorStyleImage Style = new vtkInteractorStyleImage();\n        iren.SetInteractorStyle(Style);\n\n        ren.SetBackground(BgColor);\n        ren.ResetCamera();\n\n        renWin.SetSize(300,300);\n        renWin.Render();\n\n        iren.Initialize();\n        iren.Start();\n\n    }\n}\n
"},{"location":"Java/Filtering/PerlinNoise/","title":"PerlinNoise","text":"

vtk-examples/Java/Filtering/PerlinNoise

"},{"location":"Java/Filtering/PerlinNoise/#description","title":"Description","text":"

vtkPerlinNoise object computes a Perlin noise field as an implicit function.

Perlin noise, originally described by Ken Perlin, is a non-periodic and continuous noise function useful for modeling real-world objects.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Filtering/PerlinNoise/#code","title":"Code","text":"

PerlinNoise.java

import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkPerlinNoise;\nimport vtk.vtkSampleFunction;\nimport vtk.vtkContourFilter;\n\npublic class PerlinNoise \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Chartreuse\", actorColor);\n    colors.GetColor(\"DarkSalmon\", Bgcolor);\n\n    vtkPerlinNoise perlinNoise = new vtkPerlinNoise();\n    perlinNoise.SetFrequency(2, 1.25,1.5);\n    perlinNoise.SetPhase(0, 0, 0);\n\n    vtkSampleFunction Sample = new vtkSampleFunction();\n    Sample.SetImplicitFunction(perlinNoise);\n    Sample.SetSampleDimensions(65, 65, 20);\n    Sample.ComputeNormalsOff();\n\n    vtkContourFilter Surface = new vtkContourFilter();\n    Surface.SetInputConnection(Sample.GetOutputPort());\n    Surface.SetValue(0, 0);\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(Surface.GetOutputPort());\n    mapper.ScalarVisibilityOff();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(actorColor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n\n}\n
"},{"location":"Java/Filtering/TransformPolyData/","title":"TransformPolyData","text":"

vtk-examples/Java/Filtering/TransformPolyData

"},{"location":"Java/Filtering/TransformPolyData/#description","title":"Description","text":"

vtkTransformPolyDataFilter object is a filter to transform point coordinates and associated point and cell normals and vectors. This filter is specialized for polygonal data.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Filtering/TransformPolyData/#code","title":"Code","text":"

TransformPolyData.java

import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkTransform;\nimport vtk.vtkTransformPolyDataFilter;\n\n\npublic class TransformPolyData \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For OriginalActor Color\n    double OriginalActorColor[] = new double[4];\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    //TransformedActor color\n    double TransformedActorColor[] = new double[4];\n\n    colors.GetColor(\"LightSeaGreen\", OriginalActorColor);\n    colors.GetColor(\"Sienna\", Bgcolor);\n    colors.GetColor(\"DeepSkyBlue\", TransformedActorColor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper OriginalMapper = new vtkPolyDataMapper();\n    OriginalMapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor OriginalActor = new vtkActor();\n    OriginalActor.SetMapper(OriginalMapper);\n    OriginalActor.GetProperty().SetColor(OriginalActorColor);\n\n\n    //Set up the transform filter\n    vtkTransform Translation = new vtkTransform();\n    Translation.Translate(1.0, 2.0, 3.0);\n\n    vtkTransformPolyDataFilter TransformFilter = new vtkTransformPolyDataFilter();\n    TransformFilter.SetInputConnection(Sphere.GetOutputPort());\n    TransformFilter.SetTransform(Translation);\n    TransformFilter.Update();\n\n    //Set up the actor to display the transformed polydata\n    vtkPolyDataMapper TransformedMapper = new vtkPolyDataMapper();\n    TransformedMapper.SetInputConnection(TransformFilter.GetOutputPort());\n\n    vtkActor TransformedActor = new vtkActor();\n    TransformedActor.SetMapper(TransformedMapper);\n    TransformedActor.GetProperty().SetColor(TransformedActorColor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the Actor\n    ren.AddActor(OriginalActor);\n    ren.AddActor(TransformedActor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Filtering/VertexGlyphFilter/","title":"VertexGlyphFilter","text":"

vtk-examples/Java/Filtering/VertexGlyphFilter

"},{"location":"Java/Filtering/VertexGlyphFilter/#description","title":"Description","text":"

This example creates a set of points and adds a vertex at each point using vtkVertexGlyphFilter.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Filtering/VertexGlyphFilter/#code","title":"Code","text":"

VertexGlyphFilter.java

import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkVertexGlyphFilter;\n\npublic class VertexGlyphFilter \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n          {\n            System.out.println(lib.GetLibraryName() + \" not loaded\");\n          }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Black\", actorColor);\n    colors.GetColor(\"Gold\", Bgcolor);\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0, 0.0, 0.0);\n    Points.InsertNextPoint(1.0, 1.0, 1.0);\n    Points.InsertNextPoint(2.0, 2.0, 2.0);\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n\n    vtkVertexGlyphFilter VGF = new vtkVertexGlyphFilter();\n    VGF.AddInputData(PolyData);\n    VGF.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(VGF.GetOutputPort());\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(actorColor);\n    actor.GetProperty().SetPointSize(10);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Filtering/WarpTo/","title":"WarpTo","text":"

vtk-examples/Java/Filtering/WarpTo

"},{"location":"Java/Filtering/WarpTo/#description","title":"Description","text":"

vtkWarpTo object is a filter that modifies point coordinates by moving the points towards a user specified position.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Filtering/WarpTo/#code","title":"Code","text":"

WarpTo.java

import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkLineSource;\nimport vtk.vtkTubeFilter;\nimport vtk.vtkWarpTo;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class WarpTo \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Silver\", actorColor);\n    colors.GetColor(\"MidnightBlue\", Bgcolor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Create a line\n    vtkLineSource LineSource = new vtkLineSource();\n    LineSource.SetPoint1(0, 0, 0);\n    LineSource.SetPoint2(0, 1, 0);\n    LineSource.SetResolution(20);\n    LineSource.Update();\n\n    //Create a tube (cylinder) around the line\n    vtkTubeFilter TubeFilter = new vtkTubeFilter();\n    TubeFilter.SetInputConnection(LineSource.GetOutputPort());\n    TubeFilter.SetRadius(0.01);\n    TubeFilter.SetNumberOfSides(50);\n    TubeFilter.Update();\n\n    vtkWarpTo WarpTo = new vtkWarpTo();\n    WarpTo.SetInputConnection(TubeFilter.GetOutputPort());\n    WarpTo.SetPosition(10, 1, 0);\n    WarpTo.SetScaleFactor(5);\n    WarpTo.AbsoluteOn();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(WarpTo.GetOutputPort());\n    mapper.ScalarVisibilityOff();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(actorColor);\n\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/GeometricObjects/Arrow/","title":"Arrow","text":"

vtk-examples/Java/GeometricObjects/Arrow

"},{"location":"Java/GeometricObjects/Arrow/#description","title":"Description","text":"

vtkArrowSource object appends a cylinder to a cone to form an arrow.

The shaft base is always at (0,0,0). The arrow tip is always at (1,0,0). If \"Invert\" is true, then the ends are flipped i.e. tip is at (0,0,0) while base is at (1, 0, 0).

The resolution of the cone and shaft can be set and default to 6.

The radius of the cone and shaft can be set and default to 0.03 and 0.1. The length of the tip can also be set, and defaults to 0.35.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Arrow/#code","title":"Code","text":"

Arrow.java

import vtk.vtkActor;\nimport vtk.vtkArrowSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Arrow  \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    colors.GetColor(\"Tomato\", actorColor);\n    colors.GetColor(\"DarkSeaGreen\", Bgcolor);\n\n    //Create a Arrow \n    vtkArrowSource ArrowSource = new vtkArrowSource();\n    ArrowSource.Update();\n    //Uncomment below lines to set properties\n    //ArrowSource.SetShaftRadius(1.0);\n    //ArrowSource.SetTipLength(1.0);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(ArrowSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n     // Create the renderer, render window and interactor.\n     vtkRenderer ren = new vtkRenderer();\n     vtkRenderWindow renWin = new vtkRenderWindow();\n     renWin.AddRenderer(ren);\n     vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n     iren.SetRenderWindow(renWin);\n\n     // Visualise the arrow\n     ren.AddActor(Actor);\n     ren.SetBackground(Bgcolor);\n\n     renWin.SetSize(300, 300);\n     renWin.Render();\n\n     iren.Initialize();\n     iren.Start();\n  }\n}\n
"},{"location":"Java/GeometricObjects/Circle/","title":"Circle","text":"

vtk-examples/Java/GeometricObjects/Circle

"},{"location":"Java/GeometricObjects/Circle/#description","title":"Description","text":"

Java Program to display a Circle.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Circle/#code","title":"Code","text":"

Circle.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRegularPolygonSource;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\n\npublic class Circle \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    colors.GetColor(\"White\", actorColor);\n    colors.GetColor(\"DarkSeaGreen\", Bgcolor);\n\n    vtkRegularPolygonSource PolygoneSource = new vtkRegularPolygonSource();\n    PolygoneSource.SetNumberOfSides(100);\n    PolygoneSource.SetRadius(5);\n    PolygoneSource.SetCenter(0,0,0);\n    //Uncomment below line to Visualize outline of circle\n    PolygoneSource.GeneratePolygonOff();\n    PolygoneSource.Update();\n\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(PolygoneSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/GeometricObjects/Cone/","title":"Cone","text":"

vtk-examples/Java/GeometricObjects/Cone

"},{"location":"Java/GeometricObjects/Cone/#description","title":"Description","text":"

vtkConeSource object creates a cone centered at a specified point and pointing in a specified direction. (By default, the center is the origin and the direction is the x-axis.)

Depending upon the resolution of this object, different representations are created. If resolution=0 a line is created; if resolution=1, a single triangle is created; if resolution=2, two crossed triangles are created.

For resolution > 2, a 3D cone (with resolution number of sides) is created.

It also is possible to control whether the bottom of the cone is capped with a (resolution-sided) polygon, and to specify the height and radius of the cone.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Cone/#code","title":"Code","text":"

Cone.java

import vtk.vtkActor;\nimport vtk.vtkConeSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Cone \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries())\n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    colors.GetColor(\"MediumVioletRed\", actorColor);\n    colors.GetColor(\"Wheat\", Bgcolor);\n\n    //create a Cone\n    vtkConeSource ConeSource = new vtkConeSource();\n    //Uncomment below line to set the Resolution of Cone\n    // ConeSource.SetResolution(100);\n    ConeSource.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(ConeSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
"},{"location":"Java/GeometricObjects/ConvexPointSet/","title":"ConvexPointSet","text":"

vtk-examples/Java/GeometricObjects/ConvexPointSet

"},{"location":"Java/GeometricObjects/ConvexPointSet/#description","title":"Description","text":"

vtkConvexPointSet object represents a 3D cell defined by a convex set of points. An example of such a cell is an octant (from an octree).

vtkConvexPointSet uses the ordered triangulations approach (vtkOrderedTriangulator) to create triangulations guaranteed to be compatible across shared faces.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/ConvexPointSet/#code","title":"Code","text":"

ConvexPointSet.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkConvexPointSet;\nimport vtk.vtkPoints;\nimport vtk.vtkUnstructuredGrid;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyData;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkGlyph3DMapper;\n\n\npublic class ConvexPointSet \n{\n  //private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Point Actor Color\n    double PointActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Cyan\",ActorColor);\n    //Change Color Name to Use your own Color for Change Point Actor Color\n    Color.GetColor(\"OrangeRed\",PointActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkOrange\",BgColor);\n\n    vtkConvexPointSet CPS = new vtkConvexPointSet();\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0, 0, 0);\n    Points.InsertNextPoint(1, 0, 0);\n    Points.InsertNextPoint(1, 1, 0);\n    Points.InsertNextPoint(0, 1, 0);\n    Points.InsertNextPoint(0, 0, 1);\n    Points.InsertNextPoint(1, 0, 1);\n    Points.InsertNextPoint(1, 1, 1);\n    Points.InsertNextPoint(0, 1, 1);\n    Points.InsertNextPoint(0.5, 0, 0);\n    Points.InsertNextPoint(1, 0.5, 0);\n    Points.InsertNextPoint(0.5, 1, 0);\n    Points.InsertNextPoint(0, 0.5, 0);\n    Points.InsertNextPoint(0.5, 0.5, 0);\n\n    for (int i = 0; i < 13; ++i)\n    {\n      CPS.GetPointIds().InsertId(i, i);\n    }\n\n    vtkUnstructuredGrid UG = new vtkUnstructuredGrid();\n    UG.Allocate(1, 1);\n    UG.InsertNextCell(CPS.GetCellType(), CPS.GetPointIds());\n    UG.SetPoints(Points);\n\n\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputData(UG);   \n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(ActorColor);\n    Actor.GetProperty().SetLineWidth(3.0);\n    Actor.GetProperty().EdgeVisibilityOn();\n\n    // Glyph the points\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetRadius(0.03);\n    Sphere.SetPhiResolution(21);\n    Sphere.SetThetaResolution(21);\n\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n\n    vtkGlyph3DMapper PointMapper = new vtkGlyph3DMapper();\n    PointMapper.SetInputData(PolyData);\n    PointMapper.SetSourceConnection(Sphere.GetOutputPort());\n\n    vtkActor PointActor = new vtkActor();\n    PointActor.SetMapper(PointMapper);\n    PointActor.GetProperty().SetColor(PointActorColor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.AddActor(PointActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(210);\n    ren.GetActiveCamera().Elevation(30);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/GeometricObjects/CylinderExample/","title":"CylinderExample","text":"

vtk-examples/Java/GeometricObjects/CylinderExample

"},{"location":"Java/GeometricObjects/CylinderExample/#description","title":"Description","text":"

This example creates a minimal visualization program, demonstrating VTK's basic rendering and pipeline creation.

Note

This original C++ source code for this example is here.

Other languages

See (Cxx), (Python), (PythonicAPI)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/CylinderExample/#code","title":"Code","text":"

CylinderExample.java

import vtk.vtkActor;\nimport vtk.vtkCylinderSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\n\n// Then we define our class.\npublic class CylinderExample {\n  private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  // now the main program\n  public static void main(String args[]) {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    // Here is how you create your own named color.\n    double bkgColor[];\n    bkgColor = new double[]{0.1, 0.2, 0.4, 1.0};\n    // This corresponds to the unsigned char array\n    // {26, 51, 102, 255} seen in C++ code for setting\n    // colors not in vtkNamedColors.\n    colors.SetColor(\"BkgColor\", bkgColor);\n\n    // Now we use our own named color.\n    double bkg[] = new double[4];\n    colors.GetColor(\"BkgColor\", bkg);\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    colors.GetColor(\"Tomato\", actorColor);\n    //Renderer Background Color\n\n    // This creates a polygonal cylinder model with eight circumferential facets\n    // (i.e, in practice an octagonal prism).\n    vtkCylinderSource cylinder = new vtkCylinderSource();\n    cylinder.SetResolution(8);\n\n    // The actor is a grouping mechanism: besides the geometry (mapper), it\n    // also has a property, transformation matrix, and/or texture map.\n    // Here we set its color and rotate it around the X and Y axes.\n    vtkPolyDataMapper cylinderMapper = new vtkPolyDataMapper();\n    cylinderMapper.SetInputConnection(cylinder.GetOutputPort());\n\n    vtkActor cylinderActor = new vtkActor();\n    cylinderActor.SetMapper(cylinderMapper);\n    cylinderActor.GetProperty().SetColor(actorColor);\n    cylinderActor.RotateX(30.0);\n    cylinderActor.RotateY(-45.0);\n\n    // The renderer generates the image\n    // which is then displayed on the render window.\n    // It can be thought of as a scene to which the actor is added\n    vtkRenderer ren = new vtkRenderer();\n    ren.AddActor(cylinderActor);\n    ren.ResetCamera();\n    ren.GetActiveCamera().Zoom(1.5);\n    ren.SetBackground(bkg);\n\n    // The render window is the actual GUI window\n    // that appears on the computer screen\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetSize(300, 300);\n    renWin.SetWindowName(\"Cylinder\");\n\n\n    // The render window interactor captures mouse events\n    // and will perform appropriate camera or actor manipulation\n    // depending on the nature of the events.\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    renWin.Render();\n\n    iren.Initialize();\n    // This starts the event loop and as a side effect causes an initial render.\n    iren.Start();\n  }\n}\n
"},{"location":"Java/GeometricObjects/Disk/","title":"Disk","text":"

vtk-examples/Java/GeometricObjects/Disk

"},{"location":"Java/GeometricObjects/Disk/#description","title":"Description","text":"

vtkDiskSource objects creates a polygonal disk with a hole in the center.

The disk has zero height. The user can specify the inner and outer radius of the disk, and the radial and circumferential resolution of the polygonal representation.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Disk/#code","title":"Code","text":"

Disk.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkDiskSource;\nimport vtk.vtkNamedColors;\n\npublic class Disk  \n{\n\n  //-----------------------------------------------------------------\n  //Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    colors.GetColor(\"Gold\", actorColor);\n    colors.GetColor(\"Indigo\", Bgcolor);\n    //Create a Disk\n    vtkDiskSource Disk = new vtkDiskSource();\n\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Disk.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(1.0, 1.0, 0.5);  \n\n    Actor.GetProperty().SetColor(actorColor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/GeometricObjects/EllipticalCylinder/","title":"EllipticalCylinder","text":"

vtk-examples/Java/GeometricObjects/EllipticalCylinder

"},{"location":"Java/GeometricObjects/EllipticalCylinder/#description","title":"Description","text":"

The example creates an elliptical cross-section and stores it in a vtkPolyData. Then, the vtkLinearExtrusionFilter creates an elliptical cylinder by extruding the vtkPolyLine along a vector. The example sets the back-face property of the vtkActor to show the front and back face of the cylinder.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/EllipticalCylinder/#code","title":"Code","text":"

EllipticalCylinder.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyLine;\nimport vtk.vtkCellArray;\nimport vtk.vtkLinearExtrusionFilter;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkProperty;\nimport vtk.vtkCamera;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyData;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\n\n\npublic class EllipticalCylinder  \n{\n  //private static final long serialVersionUID = 1L;\n\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Line Actor Color\n    double LineActorColor[] = new double[4];\n    //For Back Color\n    double BackColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Cyan\",ActorColor);\n    //Change Color Name to Use your own Color for Change line Actor Color\n    Color.GetColor(\"OrangeRed\",LineActorColor);\n    //Change Color Name to Use your own Color for Back\n    Color.GetColor(\"OrangeRed\",BackColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DimGray\",BgColor);\n\n\n    double angle = 0;\n    double r1, r2;\n    double centerX, centerY;\n    r1 = 50;\n    r2 = 30;\n    centerX = 10.0;\n    centerY = 5.0;\n\n\n    vtkPoints Points = new vtkPoints();\n    int id = 0;\n    while (angle <= 2.0 * Math.PI + (Math.PI / 60.0))\n    {\n      Points.InsertNextPoint(r1 * Math.cos(angle)+centerX,r2 * Math.sin(angle)+ centerY, 0.0);\n      angle = angle + (Math.PI / 60.0);\n      ++id;\n    }\n\n    vtkPolyLine Line = new vtkPolyLine();\n    Line.GetPointIds().SetNumberOfIds(id);\n    for(int i = 0; i <id; ++i)\n    {\n      Line.GetPointIds().SetId(i, i);\n    }\n    vtkCellArray Lines = new vtkCellArray();\n    Lines.InsertNextCell(Line);\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n    PolyData.SetLines(Lines);\n\n    vtkLinearExtrusionFilter Extrude = new vtkLinearExtrusionFilter();\n    Extrude.SetInputData(PolyData);\n    Extrude.SetExtrusionTypeToNormalExtrusion();\n    Extrude.SetVector(0, 0, 100);\n    Extrude.Update();\n\n    vtkPolyDataMapper LineMapper = new vtkPolyDataMapper();\n    LineMapper.SetInputData(PolyData);\n\n    vtkActor LineActor = new vtkActor();\n    LineActor.SetMapper(LineMapper);\n    LineActor.GetProperty().SetColor(LineActorColor);\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Extrude.GetOutputPort());\n\n\n    vtkProperty Back = new vtkProperty();\n    Back.SetColor(BackColor);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(ActorColor);\n    Actor.SetBackfaceProperty(Back);\n\n    vtkCamera Camera = new vtkCamera();\n    Camera.SetPosition(0, 1, 0);\n    Camera.SetFocalPoint(0, 0, 0);\n    Camera.SetViewUp(0, 0, 1);\n    Camera.Azimuth(30);\n    Camera.Elevation(30);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.AddActor(LineActor);\n    ren.SetBackground(BgColor);\n    ren.SetActiveCamera(Camera);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/GeometricObjects/Frustum/","title":"Frustum","text":"

vtk-examples/Java/GeometricObjects/Frustum

"},{"location":"Java/GeometricObjects/Frustum/#description","title":"Description","text":"

This example gets the frustum from a camera and displays it on the screen in Java

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Frustum/#code","title":"Code","text":"

Frustum.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkPlanes;\nimport vtk.vtkFrustumSource;\nimport vtk.vtkShrinkFilter;\nimport vtk.vtkProperty;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkCamera;\nimport vtk.vtkNamedColors;\n\npublic class Frustum  \n{\n\n  //-----------------------------------------------------------------\n  //Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    //BackFace color \n    double BackColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"GreenYellow\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"RoyalBlue\",BgColor);\n    //Change Color Name to Use your own Color for BackFace Color\n    Color.GetColor(\"PeachPuff\",BackColor);\n\n    // A virtual camera for 3D rendering\n    vtkCamera Camera = new vtkCamera();\n    Camera.SetClippingRange(0.1,0.4);\n    double PlanesArray[] = new double[24];\n\n    Camera.GetFrustumPlanes(1.0, PlanesArray);\n\n    vtkPlanes Planes = new vtkPlanes();\n    Planes.SetFrustumPlanes(PlanesArray);\n\n    //To create a frustum defined by a set of planes. \n    vtkFrustumSource FrustumSource = new vtkFrustumSource();\n    FrustumSource.ShowLinesOff();\n    FrustumSource.SetPlanes(Planes);\n\n    //shrink cells composing an arbitrary data set\n    vtkShrinkFilter shrink = new vtkShrinkFilter();\n    shrink.SetInputConnection(FrustumSource.GetOutputPort());\n    shrink.SetShrinkFactor(.9);\n\n    //Create a Mapper and Actor\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputConnection(shrink.GetOutputPort());\n\n    vtkProperty Back = new vtkProperty();\n    Back.SetColor(BackColor);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetColor(ActorColor);\n    Actor.SetBackfaceProperty(Back);\n\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}  \n
"},{"location":"Java/GeometricObjects/Line/","title":"Line","text":"

vtk-examples/Java/GeometricObjects/Line

"},{"location":"Java/GeometricObjects/Line/#description","title":"Description","text":"

The line is a primary one-dimensional cell. It is defined by two points. The direction along the line is from the first point to the second point.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Line/#code","title":"Code","text":"

Line.java

import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkLineSource;\n\n\n\n\n//Author: Bharatesh Chakravarthi\n//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea. \n\n\npublic class Line extends JPanel implements ActionListener \n{\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public Line() \n  {\n    super(new BorderLayout());\n    double p0[] = new double[] {1.0,0.0,0.0};\n    double p1[] = new double[] {0.0,1.0,0.0};\n\n    //Create a Line\n    vtkLineSource LineSource = new vtkLineSource();\n    LineSource.SetPoint1(p0);\n    LineSource.SetPoint1(p1);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(LineSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(0.0, 0.5, 0.5); \n    Actor.GetProperty().SetLineWidth(5);\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(Actor);\n    renWin.GetRenderer().SetBackground(0.0, 0.1, 0.1);\n    renWin.resetCamera();\n\n    //Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e) \n  {\n    if (e.getSource().equals(exitButton)) \n    {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[]) \n  {\n    SwingUtilities.invokeLater(new Runnable() \n      {\n        public void run() \n        {\n          JFrame frame = new JFrame(\"Line\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new Line(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n} \n
"},{"location":"Java/GeometricObjects/LongLine/","title":"LongLine","text":"

vtk-examples/Java/GeometricObjects/LongLine

"},{"location":"Java/GeometricObjects/LongLine/#description","title":"Description","text":"

Java Program to Connect several points with a line to visualize as Long Line

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/LongLine/#code","title":"Code","text":"

LongLine.java

import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\n\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkLine;\nimport vtk.vtkCellArray;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\n\n\n//Author: Bharatesh Chakravarthi\n//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea. \n\n\npublic class LongLine extends JPanel implements ActionListener \n{\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public LongLine() \n  {\n    super(new BorderLayout());\n\n    double origin[] = new double[] {0.0,0.0,0.0};\n    double p0[] = new double[] {1.0,0.0,0.0};\n    double p1[] = new double[] {0.0,1.0,0.0};\n    double p2[] = new double[] {0.0,1.0,2.0};\n    double p3[] = new double[] {1.0,2.0,3.0};\n\n\n    //Create a vtkPoints object and store the points in it\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(origin);\n    Points.InsertNextPoint(p0);\n    Points.InsertNextPoint(p1);\n    Points.InsertNextPoint(p2);\n    Points.InsertNextPoint(p3);\n\n\n\n    // Create a cell array to store the lines in and add the lines to it\n\n    vtkCellArray Lines = new vtkCellArray();\n    for(int i = 0; i < 3; i++)\n    {\n      vtkLine Line = new vtkLine();\n      Line.GetPointIds().SetId(0, i);\n      Line.GetPointIds().SetId(1, i+1);\n      Lines.InsertNextCell(Line);\n    }\n\n    //// Create a polydata\n    vtkPolyData LinesPolyData = new vtkPolyData();\n    LinesPolyData.SetPoints(Points);\n    LinesPolyData.SetLines(Lines);\n\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(LinesPolyData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(1.0, 0.5, 0.5); \n    Actor.GetProperty().SetLineWidth(5);\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(Actor);\n    renWin.GetRenderer().SetBackground(0.1, 0.5, 0.1);\n    renWin.resetCamera();\n    renWin.resetCameraClippingRange();\n\n    // Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e)\n  {\n    if (e.getSource().equals(exitButton)) \n    {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[])\n  {\n    SwingUtilities.invokeLater(new Runnable()\n      {\n        public void run() \n        {\n          JFrame frame = new JFrame(\"Long Line\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new LongLine(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n}  \n
"},{"location":"Java/GeometricObjects/OrientedArrow/","title":"OrientedArrow","text":"

vtk-examples/Java/GeometricObjects/OrientedArrow

"},{"location":"Java/GeometricObjects/OrientedArrow/#description","title":"Description","text":"

This example illustrates how to create and display an arrow that passes through two points.

It demonstrates two different ways to apply the transform:

1) Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter. 2) Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/OrientedArrow/#code","title":"Code","text":"

OrientedArrow.java

import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\n\n\nimport vtk.vtkActor;\nimport vtk.vtkArrowSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkMinimalStandardRandomSequence;\nimport vtk.vtkNamedColors;\nimport vtk.vtkMath;\nimport vtk.vtkMatrix4x4;\nimport vtk.vtkTransform;\nimport vtk.vtkTransformPolyDataFilter;\nimport vtk.vtkSphereSource;\n\n\n//Author: Bharatesh Chakravarthi\n//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea. \n\n\npublic class OrientedArrow extends JPanel implements ActionListener {\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public OrientedArrow() {\n    super(new BorderLayout());\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double StartActorColor[] = new double[4];\n    double ArrowActorColor[] = new double[4];\n    double EndActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"GreenYellow\",StartActorColor);\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"Tomato\",ArrowActorColor);\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"Yellow\",EndActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    //Create a Arrow \n    vtkArrowSource ArrowSource = new vtkArrowSource();\n\n    double sp[] = new double[3];\n    double ep[] = new double[3];\n\n    // Generate a random start and end point\n    vtkMinimalStandardRandomSequence RandomNumbers = new vtkMinimalStandardRandomSequence();\n    RandomNumbers.SetSeed(8775070);\n    for(int i=0;i<3;++i) {\n      RandomNumbers.Next();\n      sp[i]=RandomNumbers.GetRangeValue(-10, 10);\n      RandomNumbers.Next();\n      ep[i]=RandomNumbers.GetRangeValue(-10, 10);\n    }\n\n    // Compute a basis\n    double normalizedX[] = new double[3];\n    double normalizedY[] = new double[3];\n    double normalizedZ[] = new double[3];\n\n    // The X axis is a vector from start to end\n    vtkMath ss = new vtkMath();\n    ss.Subtract(ep, sp, normalizedX);\n    double length;\n    length=ss.Norm(normalizedX);\n    ss.Normalize(normalizedX);\n\n    // The Z axis is an arbitrary vector cross X\n    double arbitary[] = new double[3];\n    for(int i=0;i<3;++i) {\n      RandomNumbers.Next();\n      arbitary[i]=RandomNumbers.GetRangeValue(-10, 10);\n    }\n    ss.Cross(normalizedX, arbitary, normalizedZ);\n    ss.Normalize(normalizedZ);\n    // The Y axis is Z cross X  \n    ss.Cross(normalizedZ, normalizedX, normalizedY);\n    vtkMatrix4x4 Matrix = new vtkMatrix4x4();\n\n    // Create the direction cosine matrix\n    Matrix.Identity();\n    for(int i=0;i<3;i++) {\n      Matrix.SetElement(i, 0, normalizedX[i]);\n      Matrix.SetElement(i, 1, normalizedY[i]);\n      Matrix.SetElement(i, 2, normalizedZ[i]);\n    } \n\n\n    //Apply the transforms\n    vtkTransform Transform = new vtkTransform();\n    Transform.Translate(sp);\n    Transform.Concatenate(Matrix);\n    Transform.Scale(length, length, length);\n\n    // Transform the polydata\n    vtkTransformPolyDataFilter TransformPD = new vtkTransformPolyDataFilter();\n    TransformPD.SetTransform(Transform);\n    TransformPD.SetInputConnection(ArrowSource.GetOutputPort());\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    vtkActor Actor = new vtkActor();\n    Mapper.SetInputConnection(ArrowSource.GetOutputPort());\n\n\n    Actor.SetMapper(Mapper);\n    Actor.SetUserMatrix(Transform.GetMatrix());\n    Actor.GetProperty().SetColor(ArrowActorColor);\n\n    //Create spheres for start and end point\n    vtkSphereSource SphereStartSource = new vtkSphereSource();\n    SphereStartSource.SetCenter(sp);\n    SphereStartSource.SetRadius(0.8);\n\n    vtkPolyDataMapper SphereStartMapper = new vtkPolyDataMapper();\n    SphereStartMapper.SetInputConnection(SphereStartSource.GetOutputPort());\n\n    vtkActor SphereStartActor = new vtkActor();\n    SphereStartActor.SetMapper(SphereStartMapper);\n    SphereStartActor.GetProperty().SetColor(StartActorColor);\n\n\n    vtkSphereSource SphereEndSource = new vtkSphereSource();\n    SphereEndSource.SetCenter(ep);\n    SphereEndSource.SetRadius(0.8);\n\n    vtkPolyDataMapper SphereEndMapper = new vtkPolyDataMapper();\n    SphereEndMapper.SetInputConnection(SphereEndSource.GetOutputPort());\n\n    vtkActor SphereEndActor = new vtkActor();\n    SphereEndActor.SetMapper(SphereEndMapper);\n    SphereEndActor.GetProperty().SetColor(EndActorColor);\n\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(Actor);\n    renWin.GetRenderer().AddActor(SphereStartActor);\n    renWin.GetRenderer().AddActor(SphereEndActor);\n    renWin.GetRenderer().SetBackground(BgColor);;\n    renWin.resetCamera();\n\n\n    // Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e) {\n    if (e.getSource().equals(exitButton)) {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[]) {\n    SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JFrame frame = new JFrame(\"Oriented Arrow\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new OrientedArrow(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n}\n
"},{"location":"Java/GeometricObjects/OrientedCylinder/","title":"OrientedCylinder","text":"

vtk-examples/Java/GeometricObjects/OrientedCylinder

"},{"location":"Java/GeometricObjects/OrientedCylinder/#description","title":"Description","text":"

This example illustrates how to create and display a cylinder that passes through two points.

It demonstrates two different ways to apply the transform:

1) Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter. 2) Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/OrientedCylinder/#code","title":"Code","text":"

OrientedCylinder.java

import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\n\n\nimport vtk.vtkActor;\nimport vtk.vtkCylinderSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkMinimalStandardRandomSequence;\nimport vtk.vtkNamedColors;\nimport vtk.vtkMath;\nimport vtk.vtkMatrix4x4;\nimport vtk.vtkTransform;\nimport vtk.vtkTransformPolyDataFilter;\nimport vtk.vtkSphereSource;\n\n\npublic class OrientedCylinder extends JPanel implements ActionListener {\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public OrientedCylinder() {\n    super(new BorderLayout());\n\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n\n    //For Actor Color\n    double StartActorColor[] = new double[4];\n    double CylinderActorColor[] = new double[4];\n    double EndActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"Red\",StartActorColor);\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"Lime\",CylinderActorColor);\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"Blue\",EndActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Ivory\",BgColor); \n\n    // Create a cylinder.\n    // Cylinder height vector is (0,1,0).\n    // Cylinder center is in the middle of the cylinder\n    vtkCylinderSource CylinderSource = new vtkCylinderSource();\n    CylinderSource.SetResolution(15);\n\n    double sp[] = new double[3];\n    double ep[] = new double[3];\n\n    // Generate a random start and end point\n    vtkMinimalStandardRandomSequence RandomNumbers = new vtkMinimalStandardRandomSequence();\n    RandomNumbers.SetSeed(8775070);\n    for(int i=0;i<3;++i) {\n      RandomNumbers.Next();\n      sp[i]=RandomNumbers.GetRangeValue(-10, 10);\n      RandomNumbers.Next();\n      ep[i]=RandomNumbers.GetRangeValue(-10, 10);\n    }\n\n    // Compute a basis\n    double normalizedX[] = new double[3];\n    double normalizedY[] = new double[3];\n    double normalizedZ[] = new double[3];\n\n    // The X axis is a vector from start to end\n    vtkMath ss = new vtkMath();\n    ss.Subtract(ep, sp, normalizedX);\n    double length;\n    length=ss.Norm(normalizedX);\n    ss.Normalize(normalizedX);\n\n    // The Z axis is an arbitrary vector cross X\n    double arbitary[] = new double[3];\n    for(int i=0;i<3;++i) {\n      RandomNumbers.Next();\n      arbitary[i]=RandomNumbers.GetRangeValue(-10, 10);\n    }\n    ss.Cross(normalizedX, arbitary, normalizedZ);\n    ss.Normalize(normalizedZ);\n\n    // The Y axis is Z cross X\n    ss.Cross(normalizedZ, normalizedX, normalizedY);\n    vtkMatrix4x4 Matrix = new vtkMatrix4x4();\n    // Create the direction cosine matrix\n    Matrix.Identity();\n    for(int i=0;i<3;i++) {\n      Matrix.SetElement(i, 0, normalizedX[i]);\n      Matrix.SetElement(i, 1, normalizedY[i]);\n      Matrix.SetElement(i, 2, normalizedZ[i]);\n    }\n\n    vtkTransform Transform = new vtkTransform();\n    Transform.Translate(sp);\n    Transform.Concatenate(Matrix);\n    Transform.RotateZ(-90.0);\n    Transform.Scale(1.0,length,1.0);\n    Transform.Translate(0.0,0.5,0.0);\n\n    // Apply the transforms\n    vtkTransformPolyDataFilter TransformPD = new vtkTransformPolyDataFilter();\n    TransformPD.SetTransform(Transform);\n    TransformPD.SetInputConnection(CylinderSource.GetOutputPort());\n\n    // Transform the polydata\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    vtkActor Actor = new vtkActor();\n    Mapper.SetInputConnection(CylinderSource.GetOutputPort());\n\n\n    Actor.SetMapper(Mapper);\n    Actor.SetUserMatrix(Transform.GetMatrix());\n    Actor.GetProperty().SetColor(CylinderActorColor);\n\n    vtkSphereSource SphereStartSource = new vtkSphereSource();\n    SphereStartSource.SetCenter(sp);\n    SphereStartSource.SetRadius(0.8);\n\n    vtkPolyDataMapper SphereStartMapper = new vtkPolyDataMapper();\n    SphereStartMapper.SetInputConnection(SphereStartSource.GetOutputPort());\n\n    vtkActor SphereStartActor = new vtkActor();\n    SphereStartActor.SetMapper(SphereStartMapper);\n    SphereStartActor.GetProperty().SetColor(StartActorColor);\n\n    vtkSphereSource SphereEndSource = new vtkSphereSource();\n    SphereEndSource.SetCenter(ep);\n    SphereEndSource.SetRadius(0.8);\n\n    vtkPolyDataMapper SphereEndMapper = new vtkPolyDataMapper();\n    SphereEndMapper.SetInputConnection(SphereEndSource.GetOutputPort());\n\n    vtkActor SphereEndActor = new vtkActor();\n    SphereEndActor.SetMapper(SphereEndMapper);\n    SphereEndActor.GetProperty().SetColor(EndActorColor);\n\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(Actor);\n    renWin.GetRenderer().AddActor(SphereStartActor);\n    renWin.GetRenderer().AddActor(SphereEndActor);\n    renWin.GetRenderer().SetBackground(BgColor);;\n    renWin.resetCamera();\n\n\n    // Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e) {\n    if (e.getSource().equals(exitButton)) {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[]) {\n    SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JFrame frame = new JFrame(\"Oriented Cylinder\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new OrientedCylinder(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n}\n
"},{"location":"Java/GeometricObjects/ParametricObjects/","title":"ParametricObjects","text":"

vtk-examples/Java/GeometricObjects/ParametricObjects

"},{"location":"Java/GeometricObjects/ParametricObjects/#description","title":"Description","text":"

See Parametric Equations for Surfaces by Andrew Maclean for an excellent description of these beautiful parametric surfaces. You can edit the following code by selecting any one of the functions and the corresponding object will be displayed.

Other languages

See (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/ParametricObjects/#code","title":"Code","text":"

ParametricObjects.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkParametricFunctionSource;\nimport vtk.vtkProperty;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\n\n\nimport vtk.vtkParametricFigure8Klein;\n//Uncomment one of the following includes that correspond\n//import vtk.vtkParametricBoy;\n//import vtk.vtkParametricConicSpiral;\n//import vtk.vtkParametricCrossCap ;\n//import vtk.vtkParametricDini ;\n//import vtk.vtkParametricEllipsoid;\n//import vtk.vtkParametricEnneper;\n//import vtk.vtkParametricKlein;\n//import vtk.vtkParametricMobius;\n//import vtk.vtkParametricRandomHills;\n//import vtk.vtkParametricRoman;\n//import vtk.vtkParametricSpline;\n//import vtk.vtkParametricSuperEllipsoid;\n//import vtk.vtkParametricSuperToroid;\n//import vtk.vtkParametricTorus;\n\n\n\n\npublic class ParametricObjects \n{\n  //private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Back Color\n    double BackColor[] = new double[4];\n    //For Diffuse Color\n    double DiffuseColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n\n    //Change Color Name to Use your own Color for Change Back Color\n    Color.GetColor(\"Navy\",BackColor);\n    //Change Color Name to Use your own Color for Change Diffuse Color\n    Color.GetColor(\"Red\",DiffuseColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Cornsilk\",BgColor);\n\n\n    vtkParametricFigure8Klein ParametricObject = new vtkParametricFigure8Klein();\n\n    // Uncomment one of the following and\n    // ensure the matching include (above) is umcommented).\n    //vtkParametricBoy parametricObject = new vtkParametricBoy();\n    //vtkParametricConicSpiral parametricObject = new vtkParametricConicSpiral();\n    //vtkParametricCrossCap parametricObject = new vtkParametricCrossCap();\n    //vtkParametricDini parametricObject = new vtkParametricDini();\n    //vtkParametricEllipsoid parametricObject = new vtkParametricEllipsoid();\n    //vtkParametricEnneper parametricObject = new vtkParametricEnneper();\n    //vtkParametricKlein parametricObject = new vtkParametricKlein();\n    //vtkParametricMobius parametricObject = new vtkParametricMobius();\n    //vtkParametricRandomHills parametricObject = new vtkParametricRandomHills();\n    //vtkParametricRoman parametricObject = new vtkParametricRoman();\n    //vtkParametricSpline parametricObject = new vtkParametricSpline();\n    //vtkParametricSuperEllipsoid parametricObject = new vtkParametricSuperEllipsoid();\n    //vtkParametricSuperToroid parametricObject = new vtkParametricSuperToroid();\n    //vtkParametricToru parametricObject = new vtkParametricToru();\n\n\n\n    vtkParametricFunctionSource parametricFunctionSource = new vtkParametricFunctionSource();\n    parametricFunctionSource.SetParametricFunction(ParametricObject);\n    parametricFunctionSource.Update();\n\n\n    vtkProperty BackProperty = new vtkProperty();\n    BackProperty.SetColor(BackColor);\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(parametricFunctionSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetDiffuseColor(DiffuseColor);\n    Actor.GetProperty().SetSpecular(0.5);\n    Actor.GetProperty().SetSpecularPower(20);\n    Actor.SetBackfaceProperty(BackProperty);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/GeometricObjects/PlanesIntersection/","title":"PlanesIntersection","text":"

vtk-examples/Java/GeometricObjects/PlanesIntersection

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/PlanesIntersection/#code","title":"Code","text":"

PlanesIntersection.java

import vtk.vtkSphereSource;\nimport vtk.vtkPoints;\nimport vtk.vtkPlanesIntersection;\nimport vtk.vtkNativeLibrary;\n\nclass PlanesIntersection{  \n\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n\n  public static void main(String args[]){  \n\n    vtkSphereSource SphereSource = new vtkSphereSource();\n    SphereSource.Update();\n\n    double bounds[] = new double[6];\n\n    SphereSource.GetOutput().GetBounds(bounds);\n    vtkPoints Box = new vtkPoints();\n    Box.SetNumberOfPoints(8);\n\n    double xMin, xMax, yMin, yMax, zMin, zMax;\n    xMin = bounds[0]; xMax = bounds[1];\n    yMin = bounds[2]; yMax = bounds[3];\n    zMin = bounds[4]; zMax = bounds[5];\n\n\n    Box.SetPoint(0, xMax, yMin, zMax);\n    Box.SetPoint(1, xMax, yMin, zMin);\n    Box.SetPoint(2, xMax, yMax, zMin);\n    Box.SetPoint(3, xMax, yMax, zMax);\n    Box.SetPoint(4, xMin, yMin, zMax);\n    Box.SetPoint(5, xMin, yMin, zMin);\n    Box.SetPoint(6, xMin, yMax, zMin);\n    Box.SetPoint(7, xMin, yMax, zMax);\n\n\n    vtkPlanesIntersection PlanesIntersection = new vtkPlanesIntersection();\n    PlanesIntersection.SetBounds(bounds);\n\n    int intersects = PlanesIntersection.IntersectsRegion(Box);\n    System.out.print(\"Intersects:\" + intersects );\n\n  }  \n}   \n
"},{"location":"Java/GeometricObjects/Polygon/","title":"Polygon","text":"

vtk-examples/Java/GeometricObjects/Polygon

"},{"location":"Java/GeometricObjects/Polygon/#description","title":"Description","text":"

Java Program to Display a polygon having n edges, where n is the number of points in the polygon.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Polygon/#code","title":"Code","text":"

Polygon.java

import vtk.vtkActor;\nimport vtk.vtkCellArray;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPolygon;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Polygon  \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n      }\n     }\n     vtkNativeLibrary.DisableOutputWindow(null);\n   }\n   // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Red\", actorColor);\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0,0.0,0.0);\n    Points.InsertNextPoint(1.0,0.0,0.0);\n    Points.InsertNextPoint(1.0,1.0,0.0);\n    Points.InsertNextPoint(0.0,1.0,0.0);\n\n\n    vtkPolygon Polygon = new vtkPolygon();\n    Polygon.GetPointIds().SetNumberOfIds(4);\n    Polygon.GetPointIds().SetId(0, 0);\n    Polygon.GetPointIds().SetId(1, 1);\n    Polygon.GetPointIds().SetId(2, 2);\n    Polygon.GetPointIds().SetId(3, 3);\n\n\n    vtkCellArray Polygons = new vtkCellArray();\n    Polygons.InsertNextCell(Polygon);\n\n\n    vtkPolyData PolygonPolyData = new vtkPolyData();\n    PolygonPolyData.SetPoints(Points);\n    PolygonPolyData.SetPolys(Polygons);\n\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(PolygonPolyData);\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor); \n    Actor.GetProperty().SetLineWidth(5);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();     \n\n  }\n} \n
"},{"location":"Java/GeometricObjects/Pyramid/","title":"Pyramid","text":"

vtk-examples/Java/GeometricObjects/Pyramid

"},{"location":"Java/GeometricObjects/Pyramid/#description","title":"Description","text":"

Java Program to visualize a Pyramid using vtkPyramid.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Pyramid/#code","title":"Code","text":"

Pyramid.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkPoints;\nimport vtk.vtkPyramid;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkUnstructuredGrid;\nimport vtk.vtkCellArray;\nimport vtk.vtkNamedColors;\n\n\npublic class Pyramid  \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static\n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n      }\n     }\n     vtkNativeLibrary.DisableOutputWindow(null);\n   }\n   // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Sienna\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Ivory\",BgColor);\n\n    vtkPoints Points = new vtkPoints();\n\n    double p0[] = new double[] {1.0,1.0,1.0};\n    double p1[] = new double[] {-1.0,1.0,1.0};\n    double p2[] = new double[] {-1.0,-1.0,1.0};\n    double p3[] = new double[] {1.0,-1.0, 1.0};\n    double p4[] = new double[] {0.0,0.0, 0.0};\n\n    Points.InsertNextPoint(p0);\n    Points.InsertNextPoint(p1);\n    Points.InsertNextPoint(p2);\n    Points.InsertNextPoint(p3);\n    Points.InsertNextPoint(p4);\n\n\n    vtkPyramid Pyramid = new vtkPyramid();\n    Pyramid.GetPointIds().SetId(0, 0);\n    Pyramid.GetPointIds().SetId(1, 1);\n    Pyramid.GetPointIds().SetId(2, 2);\n    Pyramid.GetPointIds().SetId(3, 3);\n    Pyramid.GetPointIds().SetId(4, 4);\n\n    vtkCellArray Cells = new vtkCellArray();\n    Cells.InsertNextCell(Pyramid);\n\n    vtkUnstructuredGrid UG = new vtkUnstructuredGrid();\n    UG.SetPoints(Points);\n    UG.InsertNextCell(Pyramid.GetCellType(), Pyramid.GetPointIds());\n\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputData(UG);\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetColor(ActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
"},{"location":"Java/GeometricObjects/Quad/","title":"Quad","text":"

vtk-examples/Java/GeometricObjects/Quad

"},{"location":"Java/GeometricObjects/Quad/#description","title":"Description","text":"

Java Program to display a Quad.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Quad/#code","title":"Code","text":"

Quad.java

import vtk.vtkActor;\nimport vtk.vtkCellArray;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkQuad;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Quad \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n   }\n   // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"DarkMagenta\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Coral\",BgColor);\n\n    //Create four points (must be in counter clockwise order)\n    double p0[] = new double[] {0.0, 0.0, 0.0};\n    double p1[] = new double[] {1.0, 0.0, 0.0};\n    double p2[] = new double[] {1.0, 1.0, 0.0};\n    double p3[] = new double[] {0.0, 1.0, 0.0};\n\n\n    //// Add the points to a vtkPoints object\n    vtkPoints Points = new vtkPoints(); \n    Points.InsertNextPoint(p0);\n    Points.InsertNextPoint(p1);\n    Points.InsertNextPoint(p2);\n    Points.InsertNextPoint(p3);\n\n    //Create a quad on the four points    \n    vtkQuad Quad = new vtkQuad();\n    Quad.GetPointIds().SetId(0, 0);\n    Quad.GetPointIds().SetId(1, 1);\n    Quad.GetPointIds().SetId(2, 2);\n    Quad.GetPointIds().SetId(3, 3);\n\n    //Create a cell array to store the Quad\n    vtkCellArray Quads = new vtkCellArray();\n    Quads.InsertNextCell(Quad);\n\n    //Create a polydata to store Points and Quad\n    vtkPolyData QuadData = new vtkPolyData();\n    //Add the points and Quad to the dataset\n    QuadData.SetPoints(Points);\n    QuadData.SetPolys(Quads);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(QuadData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(ActorColor); \n    Actor.GetProperty().SetLineWidth(5);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
"},{"location":"Java/GeometricObjects/RegularPolygonSource/","title":"RegularPolygonSource","text":"

vtk-examples/Java/GeometricObjects/RegularPolygonSource

"},{"location":"Java/GeometricObjects/RegularPolygonSource/#description","title":"Description","text":"

Java Program to create a pentagon.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/RegularPolygonSource/#code","title":"Code","text":"

RegularPolygonSource.java

import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\n\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\nimport vtk.vtkRegularPolygonSource;\nimport vtk.vtkShrinkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkProperty;\n\n\n\npublic class RegularPolygonSource extends JPanel implements ActionListener {\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public RegularPolygonSource() {\n    super(new BorderLayout());\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    //BackFace color \n    double BackColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"DarkMagenta\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"White\",BgColor);\n    //Change Color Name to Use your own Color for BackFace Color\n    Color.GetColor(\"Yellow\",BackColor);\n\n\n\n    vtkRegularPolygonSource PolygonSource = new vtkRegularPolygonSource();\n    PolygonSource.SetNumberOfSides(5);\n    PolygonSource.SetRadius(5);\n    PolygonSource.SetCenter(0,0,0);\n\n    //shrink cells composing an arbitrary data set\n    vtkShrinkPolyData shrink = new vtkShrinkPolyData();\n    shrink.SetInputConnection(PolygonSource.GetOutputPort());\n    shrink.SetShrinkFactor(.9);\n\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(shrink.GetOutputPort());\n\n    vtkProperty Back = new vtkProperty();\n    Back.SetColor(BackColor);\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetLineWidth(5);\n    Actor.GetProperty().SetColor(ActorColor); \n    Actor.SetBackfaceProperty(Back);\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(Actor);\n    renWin.resetCamera();\n    renWin.GetRenderer().SetBackground(BgColor);\n\n\n\n    // Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e) {\n    if (e.getSource().equals(exitButton)) {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[]) {\n    SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JFrame frame = new JFrame(\"Regular Polygon Source\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new RegularPolygonSource(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n}  \n
"},{"location":"Java/GeometricObjects/ShrinkCube/","title":"ShrinkCube","text":"

vtk-examples/Java/GeometricObjects/ShrinkCube

"},{"location":"Java/GeometricObjects/ShrinkCube/#description","title":"Description","text":"

Generates a cube using vtkCubeSource, then a shrink filter is applied.

vtkShrinkFilter object shrinks cells composing an arbitrary data set towards their centroid. The centroid of a cell is computed as the average position of the cell points. Shrinking results in disconnecting the cells from one another.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/ShrinkCube/#code","title":"Code","text":"

ShrinkCube.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkCubeSource;\nimport vtk.vtkShrinkFilter;\nimport vtk.vtkProperty;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class Cube \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {   \n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    //BackFace color \n    double BackColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"SpringGreen\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Red\",BgColor);\n    //Change Color Name to Use your own Color for BackFace Color\n    Color.GetColor(\"Yellow\",BackColor);\n\n\n    // Create a cube.\n    vtkCubeSource Cube = new vtkCubeSource();\n\n    //shrink cells composing an arbitrary data set\n    vtkShrinkFilter shrink = new vtkShrinkFilter();\n    shrink.SetInputConnection(Cube.GetOutputPort());\n    shrink.SetShrinkFactor(.9);\n\n    //Create a Mapper and Actor\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputConnection(shrink.GetOutputPort());\n\n    vtkProperty Back = new vtkProperty();\n    Back.SetColor(BackColor);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetColor(ActorColor);\n    Actor.SetBackfaceProperty(Back);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();   \n  }\n} \n
"},{"location":"Java/GeometricObjects/TextActor/","title":"TextActor","text":"

vtk-examples/Java/GeometricObjects/TextActor

"},{"location":"Java/GeometricObjects/TextActor/#description","title":"Description","text":"

Java Program to demonstrate the use of vtkTextActor. TextActor can be set with properties such as FontSize, FontFamily, DisplayPosition and so on.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/TextActor/#code","title":"Code","text":"

TextActor.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkTextActor;\nimport vtk.vtkNamedColors;\n\npublic class TextActor  \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  //-----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Red\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",Bgcolor);\n\n    vtkTextActor Text = new vtkTextActor();\n    Text.SetInput(\"Hello World\");\n    Text.SetDisplayPosition(20, 30);\n    Text.GetTextProperty().SetFontSize(40);\n    Text.GetTextProperty().SetFontFamilyToArial();\n    Text.GetTextProperty().BoldOn();\n    Text.GetTextProperty().ShadowOn();\n    Text.GetTextProperty().GetShadowOffset();\n    Text.GetTextProperty().SetColor(ActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the Actor\n    ren.AddActor(Text);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
"},{"location":"Java/GeometricObjects/Triangle/","title":"Triangle","text":"

vtk-examples/Java/GeometricObjects/Triangle

"},{"location":"Java/GeometricObjects/Triangle/#description","title":"Description","text":"

Java Program to visualize a Triangle The triangle is a primary two-dimensional cell. The triangle is defined by a counterclockwise ordered list of three points. The order of the points specifies the direction of the surface normal using the right-hand rule.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Triangle/#code","title":"Code","text":"

Triangle.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkTriangle;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class Triangle  \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Gold\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SpringGreen\",BgColor);\n\n\n    // Create a triangle\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(1.0,0.0,0.0);\n    Points.InsertNextPoint(0.0,0.0,0.0);\n    Points.InsertNextPoint(0.0,1.0,0.0);\n\n    vtkTriangle Triangle = new vtkTriangle();\n    Triangle.GetPointIds().SetId(0, 0);\n    Triangle.GetPointIds().SetId(1, 1);\n    Triangle.GetPointIds().SetId(2, 2);\n\n    vtkCellArray CellArray = new vtkCellArray();\n    CellArray.InsertNextCell(Triangle);\n\n\n    // Create a polydata object\n    vtkPolyData TrianglePolyData = new vtkPolyData();\n    // Add the geometry and topology to the polydata\n    TrianglePolyData.SetPoints(Points);\n    TrianglePolyData.SetPolys(CellArray);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(TrianglePolyData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetColor(ActorColor); \n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();     \n\n  }\n}  \n
"},{"location":"Java/GeometricObjects/TriangleStrip/","title":"TriangleStrip","text":"

vtk-examples/Java/GeometricObjects/TriangleStrip

"},{"location":"Java/GeometricObjects/TriangleStrip/#description","title":"Description","text":"

Java Program to display a triangle Strip.

The triangle strip is a composite two-dimensional cell consisting of one or more triangles. The points defining the triangle strip need not lie in a plane. The triangle strip is defined by an ordered list of n+2 points, where n is the number of triangles. The ordering of the points is such that each set of three points defines a triangle.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/TriangleStrip/#code","title":"Code","text":"

TriangleStrip.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkTriangleStrip;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\npublic class TriangleStrip  \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {  \n\n    vtkNamedColors Color = new vtkNamedColors();\n\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Lime\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Aqua\",BgColor);\n\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0,0.0,0.0);\n    Points.InsertNextPoint(0.0,1.0,0.0);\n    Points.InsertNextPoint(1.0,0.0,0.0);\n    Points.InsertNextPoint(1.5,1.0,0.0);\n\n    vtkTriangleStrip TriangleStrip = new vtkTriangleStrip();\n    TriangleStrip.GetPointIds().SetNumberOfIds(4);\n    TriangleStrip.GetPointIds().SetId(0, 0);\n    TriangleStrip.GetPointIds().SetId(1, 1);\n    TriangleStrip.GetPointIds().SetId(2, 2);\n    TriangleStrip.GetPointIds().SetId(3, 3);\n\n\n    vtkCellArray CellArray = new vtkCellArray();\n    CellArray.InsertNextCell(TriangleStrip);\n\n    vtkPolyData TrianglePolyData = new vtkPolyData();\n    TrianglePolyData.SetPoints(Points);\n    TrianglePolyData.SetPolys(CellArray);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(TrianglePolyData);\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetColor(ActorColor); \n    Actor.GetProperty().SetLineWidth(2.5);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}   \n
"},{"location":"Java/GeometricObjects/Vertex/","title":"Vertex","text":"

vtk-examples/Java/GeometricObjects/Vertex

"},{"location":"Java/GeometricObjects/Vertex/#description","title":"Description","text":"

Java Program to display a Vertex. The vertex is a primary zero-dimensional cell. It is defined by a single point.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/GeometricObjects/Vertex/#code","title":"Code","text":"

Vertex.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkVertex;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class Vertex\n{\n  //-----------------------------------------------------------------\n  //Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"OrangeRed\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkSlateGray\",BgColor);\n\n\n    //Create a 3D Point\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0,0.0,0.0);\n\n    //Create A Vertex Which in turn represents a 3D point\n    vtkVertex Vertex = new vtkVertex();\n    Vertex.GetPointIds().SetId(0, 0);\n\n    //Create a Cell Array -  a raw integer list that explicitly represents cell connectivity\n    vtkCellArray Vertices = new vtkCellArray();\n    Vertices.InsertNextCell(Vertex);\n\n    //Create a PolyData  which represents a geometric structure \n    //consisting of vertices, lines, polygons, and/or triangle strips\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n    PolyData.SetVerts(Vertices);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(PolyData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetPointSize(15);\n    Actor.GetProperty().SetColor(ActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}  \n
"},{"location":"Java/Geovis/CompassWidget/","title":"CompassWidget","text":"

vtk-examples/Java/Geovis/CompassWidget

"},{"location":"Java/Geovis/CompassWidget/#description","title":"Description","text":"

Java Program to create a compass at top right corner of the window in VTK

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Geovis/CompassWidget/#code","title":"Code","text":"

CompassWidget.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkActor;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkCompassRepresentation;\nimport vtk.vtkCompassWidget;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\n\n\npublic class CompassWidget  {\n  // private static final long serialVersionUID = 1L;\n\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",BgColor);\n\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(4.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n\n    vtkCompassRepresentation CompassRepresentation = new vtkCompassRepresentation();\n    vtkCompassWidget CompassWidget = new vtkCompassWidget();\n    CompassWidget.SetRepresentation(CompassRepresentation);\n    CompassWidget.EnabledOn();\n    CompassWidget.SetInteractor(iren);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetInteractor(iren);\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    CompassWidget.EnabledOn();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Start();\n    iren.Initialize();\n\n  }\n} \n
"},{"location":"Java/Geovis/EarthSource/","title":"EarthSource","text":"

vtk-examples/Java/Geovis/EarthSource

"},{"location":"Java/Geovis/EarthSource/#description","title":"Description","text":"

Java Program to Visualize Earth Source.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Geovis/EarthSource/#code","title":"Code","text":"

EarthSource.java

import vtk.vtkActor;\nimport vtk.vtkEarthSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class EarthSource\n{    \n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    double MyColors[] = new double[4];\n    vtkNamedColors Colors = new vtkNamedColors();\n    Colors.GetColor(\"Banana\",MyColors);\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n    Colors.GetColor(\"Black\", Bgcolor);\n\n    vtkEarthSource EarthSource = new vtkEarthSource();\n    EarthSource.OutlineOff();\n    //EarthSource.OutlineOn();\n    EarthSource.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(EarthSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(MyColors);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Geovis/GeoAssignCoordinates/","title":"GeoAssignCoordinates","text":"

vtk-examples/Java/Geovis/GeoAssignCoordinates

"},{"location":"Java/Geovis/GeoAssignCoordinates/#description","title":"Description","text":"

Given latitude and longitude arrays, take the values in those arrays and convert them to x,y,z world coordinates.

Uses a spherical model of the earth to do the conversion. The position is in meters relative to the center of the earth.

If a transform is given, use the transform to convert latitude and longitude to the world coordinate.

Note

The vtkGeovisCore classes as well as the module vtkViewsGeovis have been deprecated for VTK 8.2 and will be removed in a future version. See VTK Merge Request 4395

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Geovis/GeoAssignCoordinates/#code","title":"Code","text":"

GeoAssignCoordinates.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkMutableDirectedGraph;\nimport vtk.vtkDoubleArray;\nimport vtk.vtkGeoAssignCoordinates;\nimport vtk.vtkGraphMapper;\n\npublic class GeoAssignCoordinates \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {   \n    vtkMutableDirectedGraph g = new vtkMutableDirectedGraph();\n    vtkDoubleArray latitude = new vtkDoubleArray();\n    latitude.SetName(\"latitude\");\n\n    vtkDoubleArray longitude = new vtkDoubleArray();\n    longitude.SetName(\"longitude\");\n\n    for(int lat = -90; lat <= 90; lat += 10)\n    {\n      for(int lon = -180; lon <= 180; lon += 20)\n      {\n        g.AddVertex();\n        latitude.InsertNextValue(lat);\n        longitude.InsertNextValue(lon);\n      }\n    }\n\n    g.GetVertexData().AddArray(latitude);\n    g.GetVertexData().AddArray(longitude);\n\n    vtkGeoAssignCoordinates assign = new vtkGeoAssignCoordinates();\n    assign.SetInputData(g);\n    assign.SetLatitudeArrayName(\"latitude\");\n    assign.SetLongitudeArrayName(\"longitude\");\n    assign.SetGlobeRadius(1.0);\n    assign.Update();\n\n    vtkGraphMapper mapper = new vtkGraphMapper();\n    mapper.SetInputConnection(assign.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Graphs/RandomGraphSource/","title":"RandomGraphSource","text":"

vtk-examples/Java/Graphs/RandomGraphSource

"},{"location":"Java/Graphs/RandomGraphSource/#description","title":"Description","text":"

RandomGraphSource object generates a graph with a specified number of vertices, with the density of edges specified by either an exact number of edges or the probability of an edge.

You may additionally specify whether to begin with a random tree (which enforces graph connectivity).

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Graphs/RandomGraphSource/#code","title":"Code","text":"

RandomGraphSource.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRandomGraphSource;\nimport vtk.vtkGraphLayoutView;\n\npublic class RandomGraphSource \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkRandomGraphSource randomGraphSource =  new vtkRandomGraphSource();\n    randomGraphSource.SetNumberOfVertices(5);\n    randomGraphSource.SetNumberOfEdges(4);\n    randomGraphSource.SetSeed(1); // This ensures repeatable results for testing. Turn this off for real use.\n    randomGraphSource.Update();\n\n    vtkGraphLayoutView graphLayoutView = new vtkGraphLayoutView();\n    graphLayoutView.AddRepresentationFromInput(randomGraphSource.GetOutput());\n    graphLayoutView.ResetCamera();\n    graphLayoutView.Render();\n    graphLayoutView.GetInteractor().Start();\n\n  }\n}\n
"},{"location":"Java/Graphs/SelectGraphVertices/","title":"SelectGraphVertices","text":"

vtk-examples/Java/Graphs/SelectGraphVertices

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Graphs/SelectGraphVertices/#code","title":"Code","text":"

SelectGraphVertices.java

import vtk.vtkAnnotationLink;\nimport vtk.vtkDataRepresentation;\nimport vtk.vtkGraphLayoutView;\nimport vtk.vtkIdTypeArray;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRandomGraphSource;\nimport vtk.vtkSelection;\nimport vtk.vtkSelectionNode;\n\n/*\n * Java language example to select edges and vertices from a generated Graph.\n */\npublic class SelectGraphVertices {\n\n  static SelectGraphVertices me;\n\n  /*\n   * The following static calls will load the respective\n   * vtkJava interface libraries on first reference to this\n   * class.\n   */\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  /**\n   * All Java programs require a host class. in addition,\n   * these two instance variables provide access to the\n   * callback data used in this example.\n   */\n  vtkGraphLayoutView view;\n  vtkAnnotationLink link;\n\n  /*\n   * primary test driver, creates an instance of this class\n   * and then runs the example function.\n   */\n  public static void main(String[] args) {\n\n    me = new SelectGraphVertices();\n    me.doit();\n  }\n\n  /*\n   * doit creates local objects and instantiates instance variables\n   */\n  public void doit() {\n    vtkRandomGraphSource source = new vtkRandomGraphSource();\n    source.Update();\n\n    view = new vtkGraphLayoutView();\n    view.AddRepresentationFromInputConnection(source.GetOutputPort());\n    /*\n     * This was described as vtkRenderedGraphRepresentation in the python example,\n     * but the java type returns it as vtkDataRepresentation.\n     */\n    vtkDataRepresentation rep = view.GetRepresentation(0);\n\n    /*\n     * The vtkDataRepresentation should already have a vtkAnnotationLink,\n     * so we just want to grab it and add an observer with our callback function attached\n     * Note that Java callbacks use the this \"pointer\" to anchor vtk objects used by the callback\n     * to establish references to required vtkobjects.\n     */\n    link = rep.GetAnnotationLink();\n    link.AddObserver(\"AnnotationChangedEvent\", this, \"selectionCallback\");\n\n    view.GetRenderWindow().SetSize(600, 600);\n    view.ResetCamera();\n    view.Render();\n    view.GetInteractor().Start();\n\n  }\n\n  /*\n   * The Java callback signature has no parameters. This complicates some\n   * vtk processes by eliminating the eventid and user data normally available\n   * to C++ logic.\n   */\n  public void selectionCallback() {\n    // In C++ there is some extra data passed to the callback, but in Python\n    // the callback data is lost...\n\n    // There can be two selection nodes, but which one is vertices and which is edges\n    // does not seem to be guaranteed...\n    System.out.println(\"in selection callback\");\n\n    vtkSelection sel = link.GetCurrentSelection();\n    vtkSelectionNode node0 = sel.GetNode(0);\n    int node0_field_type = node0.GetFieldType();\n\n    vtkIdTypeArray sel_list0 = (vtkIdTypeArray) (link.GetCurrentSelection().GetNode(0).GetSelectionList());\n\n    vtkSelectionNode node1 = sel.GetNode(1);\n    int node1_field_type = node1.GetFieldType();\n\n    vtkIdTypeArray sel_list1 = (vtkIdTypeArray) (link.GetCurrentSelection().GetNode(1).GetSelectionList());\n\n    if (sel_list0.GetNumberOfTuples() > 0) {\n      printFieldType(node0_field_type);\n      for (int ii = 0; ii < sel_list0.GetNumberOfTuples(); ii++) {\n        System.out.print(\"\\t\" + sel_list0.GetValue(ii));\n      }\n      System.out.println(\" - on list 0.\");\n    }\n    if (sel_list1.GetNumberOfTuples() > 0) {\n      printFieldType(node1_field_type);\n      for (int ii = 0; ii < sel_list1.GetNumberOfTuples(); ii++) {\n        System.out.print(\"\\t\" + sel_list1.GetValue(ii));\n      }\n      System.out.println(\" - on list 1.\");\n    }\n    System.out.println(\"- - -\");\n\n  }\n\n  public void printFieldType(int field_type) {\n    if (field_type == 3)\n      System.out.print(\"Vertices Selected:\");\n    else if (field_type == 4)\n      System.out.print(\"Edges Selected:\");\n    else\n      System.out.print(\"Unknown type:\");\n  }\n\n}\n
"},{"location":"Java/Graphs/VisualizeGraph/","title":"VisualizeGraph","text":"

vtk-examples/Java/Graphs/VisualizeGraph

"},{"location":"Java/Graphs/VisualizeGraph/#description","title":"Description","text":"

This example shows how to construct a graph and visualize it using vtkMutableUndirectedGraph which is an undirected graph with additional functions for adding vertices and edges You can select edges and vertices with the mouse.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Graphs/VisualizeGraph/#code","title":"Code","text":"

VisualizeGraph.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkGraphLayoutView;\nimport vtk.vtkMutableUndirectedGraph;\nimport vtk.vtkSimple2DLayoutStrategy;\n\npublic class VisualizeGraph \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values())\n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n      vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkMutableUndirectedGraph G = new vtkMutableUndirectedGraph();\n    int v1 = G.AddVertex();\n    int v2 = G.AddVertex();\n\n    G.AddGraphEdge(v1, v2);\n    G.AddGraphEdge(v1, v2);\n\n    vtkGraphLayoutView GraphLayoutView = new vtkGraphLayoutView();\n    GraphLayoutView.AddRepresentationFromInput(G);\n    GraphLayoutView.SetLayoutStrategy(\"Simple 2D\");\n    GraphLayoutView.ResetCamera();\n    GraphLayoutView.Render();\n\n\n    vtkSimple2DLayoutStrategy Simple2DLayoutStrategy = new vtkSimple2DLayoutStrategy();\n    Simple2DLayoutStrategy.SetRandomSeed(0);\n    GraphLayoutView.GetLayoutStrategy();\n    GraphLayoutView.GetInteractor().Start();\n\n  }\n\n}\n
"},{"location":"Java/HyperTreeGrid/HyperTreeGridSource/","title":"HyperTreeGridSource","text":"

vtk-examples/Java/HyperTreeGrid/HyperTreeGridSource

"},{"location":"Java/HyperTreeGrid/HyperTreeGridSource/#description","title":"Description","text":"

Java Program to Demonstrate Hyper Tree Grid Source.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/HyperTreeGrid/HyperTreeGridSource/#code","title":"Code","text":"

HyperTreeGridSource.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkActor;\nimport vtk.vtkHyperTreeGridSource;\nimport vtk.vtkShrinkFilter;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkNamedColors;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class HyperTreeGridSource  {\n\n  //private static final long serialVersionUID = 1L;\n\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Burlywood\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Teal\",BgColor);\n\n\n    // Create hyper tree grid source\n    vtkHyperTreeGridSource Source = new vtkHyperTreeGridSource();\n    Source.SetMaximumLevel(6);\n    Source.SetGridSize(3, 3, 2);\n    Source.SetGridScale(1.5, 1.0, 0.7);\n    Source.SetDimension(3);\n    Source.SetBranchFactor(4);\n    Source.SetDescriptor(\"RRR .R. .RR ..R ..R .R.|R.......................... ........................... ........................... .............R............. ....RR.RR........R......... .....RRRR.....R.RR......... ........................... ........................... ...........................|........................... ........................... ........................... ...RR.RR.......RR.......... ........................... RR......................... ........................... ........................... ........................... ........................... ........................... ........................... ........................... ............RRR............|........................... ........................... .......RR.................. ........................... ........................... ........................... ........................... ........................... ........................... ........................... ...........................|........................... ...........................\" );\n    Source.Update();\n\n    vtkShrinkFilter Shrink = new vtkShrinkFilter();\n    Shrink.SetInputConnection(Source.GetOutputPort());\n    Shrink.SetShrinkFactor(0.8);\n\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputConnection(Shrink.GetOutputPort());\n    Mapper.ScalarVisibilityOff();\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetDiffuseColor(ActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n    ren.GetActiveCamera().Azimuth(150);\n    ren.GetActiveCamera().Elevation(130);\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n\n  }\n} \n
"},{"location":"Java/IO/ConvertFile/","title":"ConvertFile","text":"

vtk-examples/Java/IO/ConvertFile

"},{"location":"Java/IO/ConvertFile/#description","title":"Description","text":"

This example demonstrates how to read a file and then write it to a different type of file.

In this example, we read a vtp file and write a ply file, but simply by changing the reader/writer classes instantiated, different behavior can be achieved.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ConvertFile/#code","title":"Code","text":"

ConvertFile.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkPLYWriter;\nimport vtk.vtkXMLPolyDataReader;\n\npublic class ConvertFile\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n   }\n  vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------  \n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 2) \n    {\n      System.err.println(\"Usage: java -classpath ... InputVTP Filename(.vtp) OutputFilename(.ply) e.g input.vtp output.ply\");\n      return;\n    } \n\n    String inputFileName = args[0];\n    String outputFileName = args[1];\n\n    vtkXMLPolyDataReader reader = new vtkXMLPolyDataReader();\n    reader.SetFileName(inputFileName);\n    reader.Update();\n\n    vtkPLYWriter writer = new vtkPLYWriter();\n    writer.SetFileName(outputFileName);\n    writer.SetInputConnection(reader.GetOutputPort());\n    writer.Update();\n  }\n}\n
"},{"location":"Java/IO/DEMReader/","title":"DEMReader","text":"

vtk-examples/Java/IO/DEMReader

"},{"location":"Java/IO/DEMReader/#description","title":"Description","text":"

vtkDEMReader object reads digital elevation files and creates image data.

The reader reads the entire dem file and create a vtkImageData that contains a single scalar component that is the elevation in meters. The spacing is also expressed in meters.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/DEMReader/#code","title":"Code","text":"

DEMReader.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkDEMReader;\nimport vtk.vtkLookupTable;\nimport vtk.vtkImageMapToColors;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\npublic class DEMReader \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.dem) e.g SainteHelens.dem\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    //Read the file\n    vtkDEMReader reader = new vtkDEMReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkLookupTable lut = new vtkLookupTable();\n    lut.SetHueRange(0.6, 0);\n    lut.SetSaturationRange(1.0, 0);\n    lut.SetValueRange(0.5, 1.0);\n    lut.SetTableRange(reader.GetOutput().GetScalarRange());\n\n    //Visualize\n    vtkImageMapToColors mapColors = new vtkImageMapToColors();\n    mapColors.SetLookupTable(lut);\n    mapColors.SetInputConnection(reader.GetOutputPort());\n\n    //Create an actor\n    vtkImageActor actor = new vtkImageActor();\n    actor.GetMapper().SetInputConnection(mapColors.GetOutputPort());\n\n    //Setup renderer\n    vtkRenderer renderer = new vtkRenderer();\n    renderer.AddActor(actor);\n    renderer.ResetCamera();\n\n    //Setup render window\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.AddRenderer(renderer);\n\n    //Setup render window interactor\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n\n    renderWindowInteractor.SetInteractorStyle(style);\n\n    //Render and start interaction\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n    renderWindow.Render();\n\n    renderWindowInteractor.Initialize();\n    renderWindowInteractor.Start();\n\n  }\n}\n
"},{"location":"Java/IO/JPEGReader/","title":"JPEGReader","text":"

vtk-examples/Java/IO/JPEGReader

"},{"location":"Java/IO/JPEGReader/#description","title":"Description","text":"

vtkJPEGReader is a source object that reads JPEG/JPG files.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/JPEGReader/#code","title":"Code","text":"

JPEGReader.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkJPEGReader;\nimport vtk.vtkImageViewer2;\n\npublic class JPEGReader\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.jpg) e.g Pileated.jpg \");\n      return;\n    }\n\n    String inputFilename = args[0];\n\n    //Read the image\n    vtkJPEGReader jpegReader = new vtkJPEGReader();\n    jpegReader.SetFileName (inputFilename);\n\n    // Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection( jpegReader.GetOutputPort() );\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n  }\n}\n
"},{"location":"Java/IO/JPEGWriter/","title":"JPEGWriter","text":"

vtk-examples/Java/IO/JPEGWriter

"},{"location":"Java/IO/JPEGWriter/#description","title":"Description","text":"

Example Program to demonstrate the use of vtkJPEGWriter. vtkJPEGWriter writes JPEG files. It supports 1 and 3 component data of unsigned char.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/JPEGWriter/#code","title":"Code","text":"

JPEGWriter.java

import vtk.vtkImageCanvasSource2D;\nimport vtk.vtkJPEGWriter;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\n\npublic class JPEGWriter \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n    double bkgColor[] = new double[] {255, 0,0,1};\n    double boxColor[] = new double[] {255,255,0,1};\n\n    colors.SetColor(\"bkgColor\", bkgColor);\n    colors.SetColor(\"boxColor\", boxColor);\n\n\n     // Provide default values.\n     String fileName = \"Output.jpg\";\n     for(int i = 0; i < args.length; ++i)\n     {\n       switch (i) \n       {\n         case 0:\n         fileName = args[i];\n     break;\n       }\n    }\n\n    vtkImageCanvasSource2D ImageSource = new vtkImageCanvasSource2D();\n    ImageSource.SetExtent(0, 99, 0, 99, 0, 0);\n\n    //vtkJPEGWriter only accepts unsigned char input\n    ImageSource.SetScalarTypeToUnsignedChar();\n\n    //3 color channels: Red, Green and Blue\n    ImageSource.SetNumberOfScalarComponents(3);\n\n    //Fill the whole image with a blue background\n    ImageSource.SetDrawColor(bkgColor);\n    ImageSource.FillBox(0, 99, 0, 99);\n\n    //Paint a 30x30 white square into the image\n    ImageSource.SetDrawColor(boxColor);\n    ImageSource.FillBox(40, 70, 20, 50);\n\n    vtkJPEGWriter Writer = new vtkJPEGWriter();\n    Writer.SetFileName(fileName);\n    Writer.SetInputConnection(ImageSource.GetOutputPort());\n    Writer.Write();\n\n  }\n}\n
"},{"location":"Java/IO/PNGReader/","title":"PNGReader","text":"

vtk-examples/Java/IO/PNGReader

"},{"location":"Java/IO/PNGReader/#description","title":"Description","text":"

vtkPNGReader is a source object that reads PNG files.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/PNGReader/#code","title":"Code","text":"

PNGReader.java

import vtk.vtkImageViewer2;\nimport vtk.vtkPNGReader;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class PNGReader \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) {\n      System.err.println(\"Usage: java -classpath ... Filename(.png) e.g Gourds.png\");\n      return;\n    }\n    //  Read the image\n    vtkPNGReader reader = new vtkPNGReader();\n    reader.SetFileName(args[0]);\n\n    //  Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection(reader.GetOutputPort());\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n  }\n}\n
"},{"location":"Java/IO/ParticleReader/","title":"ParticleReader","text":"

vtk-examples/Java/IO/ParticleReader

"},{"location":"Java/IO/ParticleReader/#description","title":"Description","text":"

vtkParticleReader object reads either a binary or a text file of particles.

Each particle can have associated with it an optional scalar value. So the format is: x, y, z, scalar (all floats or doubles). The text file can consist of a comma delimited set of values.

In most cases vtkParticleReader can automatically determine whether the file is text or binary.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ParticleReader/#code","title":"Code","text":"

ParticleReader.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkParticleReader;\n\npublic class ParticleReader\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.raw) e.g Particles.raw\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Navy\",BgColor);\n\n    // Read the file\n    vtkParticleReader reader = new vtkParticleReader();\n    reader.SetFileName(Filename);\n    reader.SetDataByteOrderToBigEndian();\n    reader.Update();\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n    System.out.println(\"number of pieces:\" + \" \" + mapper.GetNumberOfPieces());\n    mapper.SetScalarRange(4, 9);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetPointSize(4);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/ReadBMP/","title":"ReadBMP","text":"

vtk-examples/Java/IO/ReadBMP

"},{"location":"Java/IO/ReadBMP/#description","title":"Description","text":"

vtkBMPReader is a source object that reads Windows BMP files. This includes indexed and 24 bit bitmaps Usually, all BMPs are converted to 24 bit RGB, but BMPs may be output as 8 bit images with a LookupTable if they allow 8 bit BMP flag is set.

BMPReader creates structured point datasets. The dimension of the dataset depends upon the number of files read. Reading a single file results in a 2D image, while reading more than one file results in a 3D volume.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadBMP/#code","title":"Code","text":"

ReadBMP.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkImageViewer2;\nimport vtk.vtkBMPReader;\n\n\npublic class ReadBMP \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.bmp) e.g masonry.bmp\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkBMPReader reader = new vtkBMPReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection(reader.GetOutputPort());\n    vtkRenderWindowInteractor renderWindowInteractor =new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n\n   }\n}\n
"},{"location":"Java/IO/ReadCML/","title":"ReadCML","text":"

vtk-examples/Java/IO/ReadCML

"},{"location":"Java/IO/ReadCML/#description","title":"Description","text":"

This example uses vtkCMLMoleculeReader to read a Chemistry Markup Language file. CML has been developed by Peter Murray-Rust and Henry Rzepa since 1995. It is the de facto XML for chemistry, accepted by publishers and with more than 1 million lines of Open Source code supporting it.

Info

This example uses the file porphyrin.cml. A description of the molecule Porphyrin is described here.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadCML/#code","title":"Code","text":"

ReadCML.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkCMLMoleculeReader;\nimport vtk.vtkMoleculeMapper;\n\npublic class ReadCML \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.cml) e.g porphyrin.cml\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Silver\", Bgcolor);\n\n    vtkCMLMoleculeReader cmlSource = new vtkCMLMoleculeReader();\n\n    cmlSource.SetFileName(inputFilename);\n\n    vtkMoleculeMapper molmapper = new vtkMoleculeMapper();\n    molmapper.SetInputConnection(cmlSource.GetOutputPort());\n\n    molmapper.UseBallAndStickSettings();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(molmapper);\n    actor.GetProperty().SetDiffuse(.7);\n    actor.GetProperty().SetSpecular(.5);\n    actor.GetProperty().SetSpecularPower(20.0);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.SetMultiSamples(0);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/IO/ReadDICOM/","title":"ReadDICOM","text":"

vtk-examples/Java/IO/ReadDICOM

"},{"location":"Java/IO/ReadDICOM/#description","title":"Description","text":"

vtkDICOMImageReader object is used read to DICOM images.

DICOM (stands for Digital Imaging in COmmunications and Medicine) is a medical image file format widely used to exchange data, provided by various modalities. Here is an example data set.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadDICOM/#code","title":"Code","text":"

ReadDICOM.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkImageViewer2;\nimport vtk.vtkDICOMImageReader;\n\n\npublic class ReadDICOM \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.img) e.g prostate.img\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkDICOMImageReader reader = new vtkDICOMImageReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection(reader.GetOutputPort());\n    vtkRenderWindowInteractor renderWindowInteractor =new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n\n   }\n}\n
"},{"location":"Java/IO/ReadOBJ/","title":"ReadOBJ","text":"

vtk-examples/Java/IO/ReadOBJ

"},{"location":"Java/IO/ReadOBJ/#description","title":"Description","text":"

This example demonstrates how to read a Wavefront OBJ file. The result is displayed.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadOBJ/#code","title":"Code","text":"

ReadOBJ.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkOBJReader;\n\npublic class ReadOBJ \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.obj) e.g trumpet.obj\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"HoneyDew\", actorColor);\n    colors.GetColor(\"SpringGreen\", Bgcolor);\n\n    vtkOBJReader reader = new vtkOBJReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetDiffuseColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(30);\n    ren.GetActiveCamera().Elevation(30);\n    ren.GetActiveCamera().Dolly(1.5);\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/IO/ReadPLOT3D/","title":"ReadPLOT3D","text":"

vtk-examples/Java/IO/ReadPLOT3D

"},{"location":"Java/IO/ReadPLOT3D/#description","title":"Description","text":"

vtkMultiBlockPLOT3DReader is a reader object that reads PLOT3D formatted files and generates structured grid(s) on output.

PLOT3D is a computer graphics program designed to visualize the grids and solutions of computational fluid dynamics.

PLOT3D files consist of a grid file (also known as XYZ file), an optional solution file (also known as a Q file), and an optional function file that contains user created data (currently unsupported).

The Q file contains solution information as follows: the four parameters free stream mach number (Fsmach), angle of attack (Alpha), Reynolds number (Re), and total integration time (Time). This information is stored in an array called Properties in the FieldData of each output (tuple 0: fsmach, tuple 1: alpha, tuple 2: re, tuple 3: time). In addition, the solution file contains the flow density (scalar), flow momentum (vector), and flow energy (scalar).

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadPLOT3D/#code","title":"Code","text":"

ReadPLOT3D.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkMultiBlockPLOT3DReader;\nimport vtk.vtkStructuredGridGeometryFilter;\n\n\npublic class ReadPLOT3D\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 2) \n    {\n      System.err.println(\"Usage: java -classpath ... XYZFilename(.bin) QFileName(.bin) e.g combxyz.bin combq.bin\");\n      return;\n    }\n    String xyzFilename = args[0];\n    String qFilename = args[1];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkMultiBlockPLOT3DReader reader = new vtkMultiBlockPLOT3DReader();\n    reader.SetXYZFileName(xyzFilename);\n    reader.SetQFileName(qFilename);\n    reader.SetScalarFunctionNumber(100);\n    reader.SetVectorFunctionNumber(202);\n    reader.Update();\n\n    vtkStructuredGridGeometryFilter geometryFilter = new vtkStructuredGridGeometryFilter();\n    geometryFilter.SetInputData(reader.GetOutput().GetBlock(0));\n    geometryFilter.Update();\n\n    // Visualize\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(geometryFilter.GetOutputPort());\n    mapper.ScalarVisibilityOff();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/ReadPLY/","title":"ReadPLY","text":"

vtk-examples/Java/IO/ReadPLY

"},{"location":"Java/IO/ReadPLY/#description","title":"Description","text":"

vtkPLYReader is a source object that reads polygonal data in Stanford University PLY file format (see http://graphics.stanford.edu/data/3Dscanrep). It requires that the elements \"vertex\" and \"face\" are defined.

The \"vertex\" element must have the properties \"x\", \"y\", and \"z\". The \"face\" element must have the property \"vertex_indices\" defined.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadPLY/#code","title":"Code","text":"

ReadPLY.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPLYReader;\n\npublic class ReadPLY \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.ply) e.g shark.ply\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkPLYReader reader = new vtkPLYReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/ReadPNM/","title":"ReadPNM","text":"

vtk-examples/Java/IO/ReadPNM

"},{"location":"Java/IO/ReadPNM/#description","title":"Description","text":"

vtkPNMReader is a source object that reads pnm (portable anymap) files. This includes .pbm (bitmap), .pgm (grayscale), and .ppm (pixmap) files. (Currently this object only reads binary versions of these files.)

PNMReader creates structured point datasets. The dimension of the dataset depends upon the number of files read. Reading a single file results in a 2D image, while reading more than one file results in a 3D volume.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadPNM/#code","title":"Code","text":"

ReadPNM.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkPNMReader;\nimport vtk.vtkImageViewer2;\n\n\npublic class ReadPNM \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.pnm) e.g Gourds.pnm\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkPNMReader reader = new vtkPNMReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection(reader.GetOutputPort());\n    vtkRenderWindowInteractor renderWindowInteractor =new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n\n   }\n}\n
"},{"location":"Java/IO/ReadPolyData/","title":"ReadPolyData","text":"

vtk-examples/Java/IO/ReadPolyData

"},{"location":"Java/IO/ReadPolyData/#description","title":"Description","text":"

vtkXMLPolyDataReader object reads the VTK XML PolyData file format. One polygonal data file can be read to produce one output. Streaming is supported. The standard extension for this reader's file format is \"vtp\". This reader is also used to read a single piece of the parallel file format.

An example data set can be found at src/Testing/Data/Torso.vtp.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadPolyData/#code","title":"Code","text":"

ReadPolyData.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkXMLPolyDataReader;\nimport vtk.vtkDataSetMapper;\n\npublic class ReadPolyData {\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) {\n\n    //parse command line arguments\n    if (args.length != 1) {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtp) e.g Torso.vtp\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bkg[] = new double[4];\n    double ActorColor[] = new double[4];\n\n    Color.GetColor(\"Teal\", Bkg);\n    Color.GetColor(\"BurlyWood\", ActorColor);\n\n    vtkXMLPolyDataReader reader = new vtkXMLPolyDataReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(ActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(Bkg);\n    ren.GetActiveCamera().Pitch(90);\n    ren.GetActiveCamera().SetViewUp(0, 0, 1);\n    ren.ResetCamera();\n\n    renWin.SetSize(600, 600);\n    renWin.Render();\n    renWin.SetWindowName(\"ReadPolyData\");\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/ReadRectilinearGrid/","title":"ReadRectilinearGrid","text":"

vtk-examples/Java/IO/ReadRectilinearGrid

"},{"location":"Java/IO/ReadRectilinearGrid/#description","title":"Description","text":"

vtkXMLRectilinearGridReader object reads the VTK XML RectilinearGrid file format.

One rectilinear grid file can be read to produce one output. Streaming is supported. The standard extension for this reader's file format is \"vtr\". This reader is also used to read a single piece of the parallel file format.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadRectilinearGrid/#code","title":"Code","text":"

ReadRectilinearGrid.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkXMLRectilinearGridReader;\nimport vtk.vtkDataSetMapper;\n\npublic class ReadRectilinearGrid\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtr) e.g RectilinearGrid.vtr\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkXMLRectilinearGridReader reader = new vtkXMLRectilinearGridReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetRepresentationToWireframe();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/ReadSLC/","title":"ReadSLC","text":"

vtk-examples/Java/IO/ReadSLC

"},{"location":"Java/IO/ReadSLC/#description","title":"Description","text":"

In this example you will familiarize yourself with the stages required to read a .slc file and create a visualization pipeline in VTK. Following is the three step procedure:

  1. Read the data from .slc file using vtkSLCReader

  2. Implement Marching cubes Algorithm using vtkContourFilter

  3. Create Visualization pipeline to visualize data using an actor, mapper and rendering window

Cite

This example was provided by Bharatesh Chakravarthi from Virtual Environment Lab, Chung-Ang University, Seoul, South Korea

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadSLC/#code","title":"Code","text":"

ReadSLC.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSLCReader;\nimport vtk.vtkContourFilter;\nimport vtk.vtkOutlineFilter;\nimport vtk.vtkExtractVOI;\n\n\npublic class  ReadSLC \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 2) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.slc) e.g vw_knee.slc\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    double isoValue = 72.0;\n    if (args.length != 2)\n    {\n      isoValue = 72.0;\n    }\n    else\n    {\n      isoValue = Integer.valueOf(args[1]);\n    }\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Ivory\", actorColor);\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    //Using vtkSLCReader to read Volumetric file format(<filename.slc>)\n    vtkSLCReader reader = new vtkSLCReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Implementing Marching Cubes Algorithm to create the surface using vtkContourFilter object \n    vtkContourFilter cFilter = new vtkContourFilter();\n    cFilter.SetInputConnection(reader.GetOutputPort());\n\n    // Change the range(2nd and 3rd Paramater) based on your\n    // requirement. recomended value for 1st parameter is above 1\n    // cFilter.GenerateValues(5, 80.0, 100.0); \n    cFilter.SetValue(0, isoValue);\n    cFilter.Update();\n\n    //Adding the outliner using vtkOutlineFilter object\n    vtkOutlineFilter outliner = new vtkOutlineFilter();\n    outliner.SetInputConnection(reader.GetOutputPort());\n    outliner.Update();\n\n    // Visualize\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(cFilter.GetOutputPort());\n    mapper.SetScalarVisibility(0);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetDiffuse(.8);\n    actor.GetProperty().SetDiffuseColor(actorColor);\n    actor.GetProperty().SetSpecular(.8);\n    actor.GetProperty().SetSpecularPower(120.0);\n\n    //extractVOI is used to fix the problem of subsampling of data and reduce slow interaction and increase loading speed\n    vtkExtractVOI extractVOI = new vtkExtractVOI();\n    extractVOI.SetInputConnection(reader.GetOutputPort());\n    extractVOI.SetSampleRate(2, 2, 2);\n    extractVOI.Update();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 512);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/IO/ReadSTL/","title":"ReadSTL","text":"

vtk-examples/Java/IO/ReadSTL

"},{"location":"Java/IO/ReadSTL/#description","title":"Description","text":"

vtkSTLReader is a source object that reads ASCII or binary stereo lithography files (.stl files). The FileName must be specified to vtkSTLReader. The object automatically detects whether the file is ASCII or binary.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadSTL/#code","title":"Code","text":"

ReadSTL.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSTLReader;\n\npublic class ReadSTL \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.stl) e.g 42400-IDGH.stl\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkSTLReader reader = new vtkSTLReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/ReadStructuredGrid/","title":"ReadStructuredGrid","text":"

vtk-examples/Java/IO/ReadStructuredGrid

"},{"location":"Java/IO/ReadStructuredGrid/#description","title":"Description","text":"

vtkXMLStructuredGridReader object reads the VTK XML StructuredGrid file format. One structured grid file can be read to produce one output. Streaming is supported. The standard extension for this reader's file format is \"vts\". This reader is also used to read a single piece of the parallel file format.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadStructuredGrid/#code","title":"Code","text":"

ReadStructuredGrid.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkXMLStructuredGridReader;\nimport vtk.vtkStructuredGridGeometryFilter;\n\npublic class ReadStructuredGrid \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vts) e.g StructuredGrid.vts\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkXMLStructuredGridReader reader = new vtkXMLStructuredGridReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkStructuredGridGeometryFilter geometryFilter = new vtkStructuredGridGeometryFilter();\n    geometryFilter.SetInputConnection(reader.GetOutputPort());\n    geometryFilter.Update();\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(geometryFilter.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetPointSize(3);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/ReadTIFF/","title":"ReadTIFF","text":"

vtk-examples/Java/IO/ReadTIFF

"},{"location":"Java/IO/ReadTIFF/#description","title":"Description","text":"

vtkTIFFReader is a source object that reads Tagged Image File Format (TIFF) files. It should be able to read almost any TIFF file.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadTIFF/#code","title":"Code","text":"

ReadTIFF.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkImageViewer2;\nimport vtk.vtkTIFFReader;\n\n\npublic class ReadTIFF \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.tif) e.g ColorCells.tif\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkTIFFReader reader = new vtkTIFFReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection(reader.GetOutputPort());\n    vtkRenderWindowInteractor renderWindowInteractor =new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n\n   }\n}\n
"},{"location":"Java/IO/ReadVTP/","title":"ReadVTP","text":"

vtk-examples/Java/IO/ReadVTP

Other languages

See (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ReadVTP/#code","title":"Code","text":"

ReadVTP.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkXMLPolyDataReader;\n\npublic class ReadVTP {\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args) {\n    //parse command line arguments\n    if (args.length != 1) {\n      System.err.println(\"Usage: java -classpath ... ReadVTP Filename(.vtp) e.g horse.vtp\");\n      return;\n    }\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[4];\n    double actorColor[] = new double[4];\n    colors.GetColor(\"AliceBlue\", bkg);\n    colors.GetColor(\"Tan\", actorColor);\n\n    String filename = args[0];\n\n    //read all the data from the file\n    vtkXMLPolyDataReader reader = new vtkXMLPolyDataReader();\n    reader.SetFileName(filename);\n    reader.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(actorColor);\n\n    //Create a renderer, render window, and interactor\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Add the actor to the scene\n    ren.AddActor(actor);\n    ren.SetBackground(bkg);\n\n    //Render and interact\n\n    iren.Initialize();\n    renWin.Render();\n    ren.GetActiveCamera().SetPosition(-0.5, 0.1, 0.0);\n    ren.GetActiveCamera().SetViewUp(0.1, 0.0, 1.0);\n    renWin.Render();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/IO/SimplePointsReader/","title":"SimplePointsReader","text":"

vtk-examples/Java/IO/SimplePointsReader

"},{"location":"Java/IO/SimplePointsReader/#description","title":"Description","text":"

A file of XYZ coordinates is a very easy format that can be used for simple storage from many applications. This example demonstrates how to read this type of file into a polydata object. An example file of three points would look like this:

0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0

As a demo, save the above three lines to a file called simple.xyz

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/SimplePointsReader/#code","title":"Code","text":"

SimplePointsReader.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSimplePointsReader;\n\npublic class SimplePointsReader \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.xyz) e.g simple.xyz\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkSimplePointsReader reader = new vtkSimplePointsReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetPointSize(5);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/SimplePointsWriter/","title":"SimplePointsWriter","text":"

vtk-examples/Java/IO/SimplePointsWriter

"},{"location":"Java/IO/SimplePointsWriter/#description","title":"Description","text":"

vtkSimplePointsWriter object writes a simple file of xyz coordinates.

Seealso

For the opposite operation (reading a points file) see the SimplePointsReader example.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/SimplePointsWriter/#code","title":"Code","text":"

SimplePointsWriter.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkSphereSource;\nimport vtk.vtkSimplePointsWriter;\n\npublic class SimplePointsWriter \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.xyz) e.g SimplePointWriter.xyz\");\n      return;\n    }\n    String inputFilename = args[0];\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkSimplePointsWriter writer = new vtkSimplePointsWriter();\n    writer.SetFileName(inputFilename);\n    writer.SetInputConnection(sphereSource.GetOutputPort());\n    writer.Write();\n\n  }\n}\n
"},{"location":"Java/IO/StructuredPointsReader/","title":"StructuredPointsReader","text":"

vtk-examples/Java/IO/StructuredPointsReader

"},{"location":"Java/IO/StructuredPointsReader/#description","title":"Description","text":"

vtkStructuredPointsReader is a source object that reads ASCII or binary structured points data files in vtk format.

The output of this reader is a single vtkStructuredPoints data object.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/StructuredPointsReader/#code","title":"Code","text":"

StructuredPointsReader.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkStructuredPointsReader;\nimport vtk.vtkImageDataGeometryFilter;\n\n\npublic class StructuredPointsReader\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtk) e.g StructuredPoints.vtk\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    // Read the file\n    vtkStructuredPointsReader reader = new vtkStructuredPointsReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    vtkImageDataGeometryFilter geometryFilter = new vtkImageDataGeometryFilter();\n    geometryFilter.SetInputConnection(reader.GetOutputPort());\n    geometryFilter.Update();\n\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(geometryFilter.GetOutputPort());\n\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetPointSize(4);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/ThreeDSImporter/","title":"ThreeDSImporter","text":"

vtk-examples/Java/IO/ThreeDSImporter

"},{"location":"Java/IO/ThreeDSImporter/#description","title":"Description","text":"

vtk3DSImporter object imports 3D Studio files into vtk.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/ThreeDSImporter/#code","title":"Code","text":"

ThreeDSImporter.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkActorCollection;\nimport vtk.vtk3DSImporter;\nimport vtk.vtkCamera;\n\npublic class ThreeDSImporter\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.3ds) e.g iflamingo.3ds\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    double BgColor2[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Gold\",BgColor);\n    Color.GetColor(\"Wheat\",BgColor2);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtk3DSImporter importer = new vtk3DSImporter();\n    importer.SetFileName(inputFilename);\n    importer.ComputeNormalsOn();\n\n    renWin.AddRenderer(ren);\n    ren.SetBackground2 (BgColor);\n    ren.SetBackground (BgColor2);\n    ren.GradientBackgroundOn();\n\n    importer.SetRenderWindow(renWin);\n    importer.Update();\n\n    vtkActorCollection actors = new vtkActorCollection();\n    actors = ren.GetActors();\n    System.out.println(\"There are\" + \" \" + actors.GetNumberOfItems() + \" \" + \"actors\");\n\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    vtkCamera camera = new vtkCamera();\n    camera.SetPosition (0, -1, 0);\n    camera.SetFocalPoint (0, 0, 0);\n    camera.SetViewUp (0, 0, 1);\n    camera.Azimuth(150);\n    camera.Elevation(30);\n\n    ren.SetActiveCamera(camera);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/VRMLImporter/","title":"VRMLImporter","text":"

vtk-examples/Java/IO/VRMLImporter

"},{"location":"Java/IO/VRMLImporter/#description","title":"Description","text":"

This example loads a wrl file and displays it on the screen. An example file is src/Testing/Data/sextant.wrl.

Warning

The vtkVRMLImporter only imports VRML 2.0 files.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/VRMLImporter/#code","title":"Code","text":"

VRMLImporter.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkActorCollection;\nimport vtk.vtkVRMLImporter;\n\npublic class VRMLImporter\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.wrl) e.g sextant.wrl\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Burlywood\",BgColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // VRML Import\n    vtkVRMLImporter importer = new vtkVRMLImporter();\n    importer.SetFileName (inputFilename);\n    importer.SetRenderWindow(renWin);\n    importer.Update();\n\n    vtkActorCollection actors = new vtkActorCollection();\n    actors = ren.GetActors();\n    System.out.println(\"There are\" + \" \" + actors.GetNumberOfItems() + \" actors\");\n\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/WritePLY/","title":"WritePLY","text":"

vtk-examples/Java/IO/WritePLY

"},{"location":"Java/IO/WritePLY/#description","title":"Description","text":"

vtkPLYWriter object writes polygonal data in Stanford University PLY format.

The data can be written in either binary (little or big endian) or ASCII representation. As for PointData and CellData, vtkPLYWriter cannot handle normals or vectors. It only handles RGB PointData and CellData

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/WritePLY/#code","title":"Code","text":"

WritePLY.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPLYReader;\nimport vtk.vtkPLYWriter;\nimport vtk.vtkSphereSource;\n\npublic class WritePLY\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.ply) e.g sphere.ply\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkPLYWriter plyWriter = new vtkPLYWriter();\n    plyWriter.SetFileName(Filename);\n    plyWriter.SetInputConnection(sphereSource.GetOutputPort());\n    plyWriter.Write();\n\n    //Read and display for verification\n    vtkPLYReader reader = new vtkPLYReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/WritePNM/","title":"WritePNM","text":"

vtk-examples/Java/IO/WritePNM

"},{"location":"Java/IO/WritePNM/#description","title":"Description","text":"

vtkPNMWriter objects writes Portable Any Map (PNM) file.

The PNM format is just an abstraction of the PBM, PGM, and PPM formats.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/WritePNM/#code","title":"Code","text":"

WritePNM.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkPNMWriter;\nimport vtk.vtkPNMReader;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\n\npublic class WritePNM\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.pnm) e.g OutputFile.pnm\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkImageCanvasSource2D imageSource = new vtkImageCanvasSource2D();\n    imageSource.SetScalarTypeToUnsignedChar();\n    imageSource.SetExtent(0,9,0,9,0,0);\n    imageSource.SetNumberOfScalarComponents(3);\n    imageSource.SetDrawColor(0, 0, 0, 0);\n    imageSource.FillBox(0,9,0,9);\n    imageSource.SetDrawColor(255, 0, 0, 0);\n    imageSource.FillBox(5,7,5,7);\n    imageSource.Update();\n\n    vtkPNMWriter pnmWriter = new vtkPNMWriter();\n    pnmWriter.SetFileName(Filename);\n    pnmWriter.SetInputConnection(imageSource.GetOutputPort());\n    pnmWriter.Write();\n\n    // Read and display for verification\n    vtkPNMReader reader = new vtkPNMReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    vtkImageActor actor = new vtkImageActor();\n    actor.GetMapper().SetInputConnection(reader.GetOutputPort());\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n    iren.SetInteractorStyle(style);\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/WriteSTL/","title":"WriteSTL","text":"

vtk-examples/Java/IO/WriteSTL

"},{"location":"Java/IO/WriteSTL/#description","title":"Description","text":"

vtkSTLWriter object writes Stereo Lithography (.stl) files in either ASCII or binary form.

An STL file describes a triangulated three-dimensional surface by the unit normal and vertices (ordered by the right-hand rule) of the triangles.

This example saves a 3D geometric data stored in a to an STL file.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/WriteSTL/#code","title":"Code","text":"

WriteSTL.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSTLReader;\nimport vtk.vtkSTLWriter;\nimport vtk.vtkSphereSource;\n\n\npublic class WriteSTL\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.stl) e.g sphere.stl\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkSTLWriter stlWriter = new vtkSTLWriter();\n    stlWriter.SetFileName(Filename);\n    stlWriter.SetInputConnection(sphereSource.GetOutputPort());\n    stlWriter.Write();\n\n    //Read and display for verification\n    vtkSTLReader reader = new vtkSTLReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/WriteTIFF/","title":"WriteTIFF","text":"

vtk-examples/Java/IO/WriteTIFF

"},{"location":"Java/IO/WriteTIFF/#description","title":"Description","text":"

vtkTIFFWriter object writes image data as a TIFF data file. Data can be written uncompressed or compressed. Several forms of compression are supported including packed bits, JPEG, deflation, and LZW.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/WriteTIFF/#code","title":"Code","text":"

WriteTIFF.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkTIFFWriter;\nimport vtk.vtkTIFFReader;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\npublic class WriteTIFF\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.tif) e.g OutputFile.tif\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkImageCanvasSource2D imageSource = new vtkImageCanvasSource2D();\n    imageSource.SetScalarTypeToUnsignedChar();\n    imageSource.SetExtent(0,9,0,9,0,0);\n    imageSource.SetNumberOfScalarComponents(3);\n    imageSource.SetDrawColor(0, 0, 0, 0);\n    imageSource.FillBox(0,9,0,9);\n    imageSource.SetDrawColor(255, 0, 0, 0);\n    imageSource.FillBox(5,7,5,7);\n    imageSource.Update();\n\n    vtkTIFFWriter tiffWriter = new vtkTIFFWriter();\n    tiffWriter.SetFileName(Filename);\n    tiffWriter.SetInputConnection(imageSource.GetOutputPort());\n    tiffWriter.Write();\n\n    //Read and display for verification\n    vtkTIFFReader reader = new vtkTIFFReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    vtkImageActor actor = new vtkImageActor();\n    actor.GetMapper().SetInputConnection(reader.GetOutputPort());\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n    iren.SetInteractorStyle(style);\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/IO/WriteVTP/","title":"WriteVTP","text":"

vtk-examples/Java/IO/WriteVTP

"},{"location":"Java/IO/WriteVTP/#description","title":"Description","text":"

In this example, we add 10 points to a polygonal data (polydata) object and write the result to a VTP file.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/WriteVTP/#code","title":"Code","text":"

WriteVTP.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkXMLPolyDataWriter;\n\npublic class WriteVTP {\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args) {\n    //parse command line arguments\n    if (args.length != 1) {\n      System.err.println(\"Usage: java -classpath ... WriteVTP Filename(.vtp) e.g WriteVTP.vtp\");\n      return;\n    }\n\n    String filename = args[0];\n\n    //Create 10 points.\n    vtkPoints points = new vtkPoints();\n\n    for (int i = 0; i < 10; ++i) {\n      points.InsertNextPoint(i, i, i);\n    }\n\n    //Create a polydata object and add the points to it.\n    vtkPolyData polydata = new vtkPolyData();\n    polydata.SetPoints(points);\n\n    //Write the file\n    vtkXMLPolyDataWriter writer = new vtkXMLPolyDataWriter();\n    writer.SetFileName(filename);\n    writer.SetInputData(polydata);\n\n    //Optional - set the mode. The default is binary.\n    //writer.SetDataModeToBinary();\n    //writer.SetDataModeToAscii();\n\n    writer.Write();\n  }\n}\n
"},{"location":"Java/IO/WriteVTU/","title":"WriteVTU","text":"

vtk-examples/Java/IO/WriteVTU

"},{"location":"Java/IO/WriteVTU/#description","title":"Description","text":"

vtkXMLUnstructuredGridWriter object writes the VTK XML UnstructuredGrid file format.

One unstructured grid input can be written into one file in any number of streamed pieces (if supported by the rest of the pipeline). The standard extension for this writer's file format is \"vtu\". This writer is also used to write a single piece of the parallel file format.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/WriteVTU/#code","title":"Code","text":"

WriteVTU.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPoints;\nimport vtk.vtkTetra;\nimport vtk.vtkCellArray;\nimport vtk.vtkUnstructuredGrid;\nimport vtk.vtkXMLUnstructuredGridWriter;\nimport vtk.vtkXMLUnstructuredGridReader;\nimport vtk.vtkDataSetMapper;\n\npublic class  WriteVTU\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtu) e.g tetra_test.vtu\");\n      return;\n    }\n    String Filename = args[0];\n    int VTK_TETRA = 10;\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Seagreen\", Bgcolor);\n\n    vtkPoints points = new vtkPoints();\n    points.InsertNextPoint(0, 0, 0);\n    points.InsertNextPoint(1, 0, 0);\n    points.InsertNextPoint(1, 1, 0);\n    points.InsertNextPoint(0, 1, 1);\n\n    vtkTetra tetra = new vtkTetra();\n\n    tetra.GetPointIds().SetId(0, 0);\n    tetra.GetPointIds().SetId(1, 1);\n    tetra.GetPointIds().SetId(2, 2);\n    tetra.GetPointIds().SetId(3, 3);\n\n    vtkCellArray cellArray = new vtkCellArray();\n    cellArray.InsertNextCell(tetra);\n\n    vtkUnstructuredGrid unstructuredGrid = new vtkUnstructuredGrid();\n    unstructuredGrid.SetPoints(points);\n    unstructuredGrid.SetCells(VTK_TETRA, cellArray);\n\n    // Write file\n    vtkXMLUnstructuredGridWriter writer = new vtkXMLUnstructuredGridWriter();\n    writer.SetFileName(Filename);\n    writer.SetInputData(unstructuredGrid);\n    writer.Write();\n\n    // Read and display file for verification that it was written correclty\n    vtkXMLUnstructuredGridReader reader = new vtkXMLUnstructuredGridReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(reader.GetOutputPort()); \n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/IO/XMLPImageDataWriter/","title":"XMLPImageDataWriter","text":"

vtk-examples/Java/IO/XMLPImageDataWriter

"},{"location":"Java/IO/XMLPImageDataWriter/#description","title":"Description","text":"

vtkXMLPImageDataWriter object writes the PVTK XML ImageData file format.

One image data input can be written into a parallel file format with any number of pieces spread across files. The standard extension for this writer's file format is \"pvti\". This writer uses vtkXMLImageDataWriter to write the individual piece files.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/XMLPImageDataWriter/#code","title":"Code","text":"

XMLPImageDataWriter.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkXMLPImageDataWriter;\n\n\npublic class XMLPImageDataWriter\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.pvti) e.g Test.pvti\");\n      return;\n    }\n    String Filename = args[0];\n    vtkImageCanvasSource2D drawing = new vtkImageCanvasSource2D();\n    drawing.SetNumberOfScalarComponents(3);\n    drawing.SetScalarTypeToUnsignedChar();\n    drawing.SetExtent(0, 20, 0, 50, 0, 1);\n    drawing.SetDrawColor(255.0, 255.0, 255.0);\n    drawing.DrawCircle(5, 5, 3);\n\n    int numberOfPieces = 4;\n\n    vtkXMLPImageDataWriter writer = new vtkXMLPImageDataWriter();\n    writer.SetInputConnection(drawing.GetOutputPort());\n    writer.SetFileName(Filename);\n    writer.SetNumberOfPieces(numberOfPieces);\n    writer.SetEndPiece(numberOfPieces-1);\n    writer.SetStartPiece(0);\n    writer.Update();\n\n  }\n}\n
"},{"location":"Java/IO/XMLPUnstructuredGridWriter/","title":"XMLPUnstructuredGridWriter","text":"

vtk-examples/Java/IO/XMLPUnstructuredGridWriter

"},{"location":"Java/IO/XMLPUnstructuredGridWriter/#description","title":"Description","text":"

vtkXMLPUnstructuredGridWriter object writes the PVTK XML UnstructuredGrid file format.

One unstructured grid input can be written into a parallel file format with any number of pieces spread across files.

The standard extension for this writer's file format is \"pvtu\". This writer uses vtkXMLUnstructuredGridWriter to write the individual piece files.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/XMLPUnstructuredGridWriter/#code","title":"Code","text":"

XMLPUnstructuredGridWriter.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkSphereSource;\nimport vtk.vtkDelaunay3D;\nimport vtk.vtkXMLPUnstructuredGridWriter;\n\npublic class XMLPUnstructuredGridWriter\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.pvtu) e.g Test.pvtu\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkDelaunay3D delaunay = new vtkDelaunay3D();\n    delaunay.SetInputConnection(sphereSource.GetOutputPort());\n    delaunay.Update();\n\n    vtkXMLPUnstructuredGridWriter writer = new vtkXMLPUnstructuredGridWriter();\n    writer.SetInputConnection(delaunay.GetOutputPort());\n    writer.SetFileName(Filename);\n    writer.SetNumberOfPieces(4);\n    writer.SetStartPiece(0);\n    writer.SetEndPiece(3);\n    writer.Update();\n\n  }\n}\n
"},{"location":"Java/IO/XMLStructuredGridWriter/","title":"XMLStructuredGridWriter","text":"

vtk-examples/Java/IO/XMLStructuredGridWriter

"},{"location":"Java/IO/XMLStructuredGridWriter/#description","title":"Description","text":"

vtkXMLStructuredGridWriter object writes the VTK XML StructuredGrid file format.

One structured grid input can be written into one file in any number of streamed pieces.

The standard extension for this writer's file format is \"vts\". This writer is also used to write a single piece of the parallel file format.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/IO/XMLStructuredGridWriter/#code","title":"Code","text":"

XMLStructuredGridWriter.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkStructuredGrid;\nimport vtk.vtkPoints;\nimport vtk.vtkXMLStructuredGridWriter;\n\n\npublic class XMLStructuredGridWriter\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vts) e.g output.vts\");\n      return;\n    }\n    String Filename = args[0];\n\n    // Create a grid\n    vtkStructuredGrid structuredGrid = new vtkStructuredGrid();\n\n    vtkPoints points = new vtkPoints();\n    points.InsertNextPoint(0, 0, 0);\n    points.InsertNextPoint(1, 0, 0);\n    points.InsertNextPoint(0, 1, 0);\n    points.InsertNextPoint(1, 1, 0);\n    points.InsertNextPoint(0, 2, 0);\n    points.InsertNextPoint(1, 2, 1);\n\n    // Specify the dimensions of the grid\n    structuredGrid.SetDimensions(2,3,1);\n    structuredGrid.SetPoints(points);\n\n    // Write file\n    vtkXMLStructuredGridWriter writer = new vtkXMLStructuredGridWriter();\n    writer.SetFileName(Filename);\n    writer.SetInputData(structuredGrid);\n    writer.Write();\n\n  }\n}\n
"},{"location":"Java/ImageData/ImageNormalize/","title":"ImageNormalize","text":"

vtk-examples/Java/ImageData/ImageNormalize

"},{"location":"Java/ImageData/ImageNormalize/#description","title":"Description","text":"

For each point, vtkImageNormalize object normalizes the vector defined by the scalar components. If the magnitude of this vector is zero, the output vector is zero also.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/ImageData/ImageNormalize/#code","title":"Code","text":"

ImageNormalize.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageSinusoidSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkImageNormalize;\nimport vtk.vtkImageCast;\nimport vtk.vtkImageActor;\n\n\npublic class ImageNormalize \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double left_bkg[] = new double[]{0.6, 0.5, 0.4, 1.0};\n    double right_bkg[] = new double[]{0.4, 0.5, 0.6, 1.0};\n\n    colors.SetColor(\"bkgColor\", left_bkg);\n    colors.SetColor(\"boxColor\", right_bkg);\n\n    //  Create an image\n    vtkImageSinusoidSource source = new vtkImageSinusoidSource();\n    source.Update();\n\n    vtkImageNormalize normalizeFilter = new vtkImageNormalize();\n\n    normalizeFilter.SetInputConnection(source.GetOutputPort());\n    normalizeFilter.Update();\n\n    vtkImageCast inputCastFilter = new vtkImageCast();\n    inputCastFilter.SetInputConnection(source.GetOutputPort());\n    inputCastFilter.SetOutputScalarTypeToUnsignedChar();\n    inputCastFilter.Update();\n\n    vtkImageCast normalizeCastFilter = new vtkImageCast();\n    normalizeCastFilter.SetInputConnection(normalizeFilter.GetOutputPort());\n    normalizeCastFilter.SetOutputScalarTypeToUnsignedChar();\n    normalizeCastFilter.Update();\n\n    //  Create actors\n    vtkImageActor inputActor = new vtkImageActor();\n    inputActor.GetMapper().SetInputConnection(inputCastFilter.GetOutputPort());\n\n    vtkImageActor normalizedActor = new vtkImageActor();\n    normalizedActor.GetMapper().SetInputConnection(normalizeCastFilter.GetOutputPort());\n\n    //  Create the render window and interactor.\n\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //  Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double leftViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};\n    double rightViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n\n    //  Setup both renderers\n    vtkRenderer leftRenderer = new vtkRenderer();\n    renWin.AddRenderer(leftRenderer);\n    leftRenderer.SetViewport(leftViewport);\n    leftRenderer.SetBackground(left_bkg);\n\n    vtkRenderer rightRenderer = new vtkRenderer();\n    renWin.AddRenderer(rightRenderer);\n    rightRenderer.SetViewport(rightViewport);\n    rightRenderer.SetBackground(right_bkg);\n\n    leftRenderer.AddActor(inputActor);\n    rightRenderer.AddActor(normalizedActor);\n\n    leftRenderer.ResetCamera();\n    rightRenderer.ResetCamera();\n\n    renWin.SetSize(600,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/ImageData/ImageWeightedSum/","title":"ImageWeightedSum","text":"

vtk-examples/Java/ImageData/ImageWeightedSum

"},{"location":"Java/ImageData/ImageWeightedSum/#description","title":"Description","text":"

Sum multiple images. Images must be of the same size and type.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/ImageData/ImageWeightedSum/#code","title":"Code","text":"

ImageWeightedSum.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkImageCast;\nimport vtk.vtkImageMandelbrotSource;\nimport vtk.vtkImageSinusoidSource;\nimport vtk.vtkImageWeightedSum;\nimport vtk.vtkImageActor;\n\npublic class ImageWeightedSum \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    double bkgL[] = new double[4] ;\n    double bkgC[] = new double[4] ;\n    double bkgR[] = new double [4] ;\n\n    Color.GetColor(\"Tan\",bkgL);\n    Color.GetColor(\"DarkCyan\",bkgC);\n    Color.GetColor(\"LightSlateGray\",bkgR);\n\n    //create an image\n    vtkImageMandelbrotSource source1 = new vtkImageMandelbrotSource();\n    source1.SetWholeExtent(0, 255, 0, 255, 0, 0);\n    source1.Update();\n\n    vtkImageCast source1Double = new vtkImageCast();\n    source1Double.SetInputConnection(0, source1.GetOutputPort());\n    source1Double.SetOutputScalarTypeToDouble();\n\n    vtkImageSinusoidSource source2 = new vtkImageSinusoidSource();\n    source2.SetWholeExtent(0, 255, 0, 255, 0, 0);\n    source2.Update();\n\n    vtkImageWeightedSum sumFilter = new vtkImageWeightedSum();\n    sumFilter.SetWeight(0, .8);\n    sumFilter.SetWeight(1, .2);\n    sumFilter.AddInputConnection(source1Double.GetOutputPort());\n    sumFilter.AddInputConnection(source2.GetOutputPort());\n\n    sumFilter.Update();\n\n    vtkImageCast source1CastFilter = new vtkImageCast();\n    source1CastFilter.SetInputConnection(source1.GetOutputPort());\n    source1CastFilter.SetOutputScalarTypeToUnsignedChar();\n    source1CastFilter.Update();\n\n    vtkImageCast source2CastFilter = new vtkImageCast();\n    source2CastFilter.SetInputConnection(source2.GetOutputPort());\n    source2CastFilter.SetOutputScalarTypeToUnsignedChar();\n    source2CastFilter.Update();\n\n    vtkImageCast summedCastFilter = new vtkImageCast();\n    summedCastFilter.SetInputConnection(sumFilter.GetOutputPort());\n    summedCastFilter.SetOutputScalarTypeToUnsignedChar();\n    summedCastFilter.Update();\n\n    //Create actors\n    vtkImageActor source1Actor = new vtkImageActor();\n    source1Actor.GetMapper().SetInputConnection(source1CastFilter.GetOutputPort());\n\n    vtkImageActor source2Actor = new vtkImageActor();\n    source2Actor.GetMapper().SetInputConnection(source2CastFilter.GetOutputPort());\n\n    vtkImageActor summedActor = new vtkImageActor();\n    summedActor.GetMapper().SetInputConnection(summedCastFilter.GetOutputPort());\n\n    // There will be one render window\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.SetSize(600, 300);\n\n    // And one interactor\n    vtkRenderWindowInteractor interactor = new vtkRenderWindowInteractor();\n    interactor.SetRenderWindow(renderWindow);\n\n    // Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double leftViewport[] = new double[] {0.0, 0.0, 0.33, 1.0};\n    double centerViewport[] = new double[]{0.33, 0.0, .66, 1.0};\n    double rightViewport[] = new double[] {0.66, 0.0, 1.0, 1.0};\n\n    // Setup renderers\n    vtkRenderer leftRenderer = new vtkRenderer();\n    renderWindow.AddRenderer(leftRenderer);\n    leftRenderer.SetViewport(leftViewport);\n    leftRenderer.SetBackground(bkgL);\n\n    vtkRenderer centerRenderer = new vtkRenderer();\n    renderWindow.AddRenderer(centerRenderer);\n    centerRenderer.SetViewport(centerViewport);\n    centerRenderer.SetBackground(bkgC);\n\n    vtkRenderer rightRenderer = new vtkRenderer();\n    renderWindow.AddRenderer(rightRenderer);\n    rightRenderer.SetViewport(rightViewport);\n    rightRenderer.SetBackground(bkgR);\n\n    leftRenderer.AddActor(source1Actor);\n    centerRenderer.AddActor(source2Actor);\n    rightRenderer.AddActor(summedActor);\n\n    leftRenderer.ResetCamera();\n    centerRenderer.ResetCamera();\n    rightRenderer.ResetCamera();\n\n    renderWindow.Render();\n    interactor.Start();\n  }\n}\n
"},{"location":"Java/ImageProcessing/ShotNoise/","title":"ShotNoise","text":"

vtk-examples/Java/ImageProcessing/ShotNoise

Description:

An Example program to Write PNG files. vtkPNGWriter writes PNG files. It supports 1 to 4 component data of unsigned char or unsigned short

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/ImageProcessing/ShotNoise/#code","title":"Code","text":"

ShotNoise.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkPNGWriter;\n\npublic class ShotNoise \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //Provide default values.\n    String fileName = \"TestShotNoise.png\";\n    for(int i = 0; i < args.length; ++i)\n    {\n      switch (i) \n      {\n        case 0:\n                fileName = args[i];\n                break;\n      }\n    }\n\n    vtkImageCanvasSource2D ImageCanvas = new vtkImageCanvasSource2D();\n\n    ImageCanvas.SetScalarTypeToUnsignedChar();\n\n    ImageCanvas.SetExtent(1, 256, 1, 256, 0, 0);\n    ImageCanvas.SetDrawColor(0);\n    ImageCanvas.FillBox(1, 256, 1, 256);\n    ImageCanvas.SetDrawColor(255);\n    ImageCanvas.FillBox(30, 255, 30, 225);\n    ImageCanvas.SetDrawColor(0);\n    ImageCanvas.FillBox(60, 195, 60, 195);\n    ImageCanvas.SetDrawColor(255);\n    ImageCanvas.FillTube(100, 100, 154, 154, 40);\n    ImageCanvas.SetDrawColor(0);\n    ImageCanvas.DrawSegment(45, 45, 45, 210);\n    ImageCanvas.DrawSegment(45, 210, 210, 210);\n    ImageCanvas.DrawSegment(210, 210, 210, 45);\n    ImageCanvas.DrawSegment(210, 45, 45, 45);\n    ImageCanvas.DrawSegment(100, 150, 150, 100);\n    ImageCanvas.DrawSegment(110, 160, 160, 110);\n    ImageCanvas.DrawSegment(90, 140, 140, 90);\n    ImageCanvas.DrawSegment(120, 170, 170, 120);\n    ImageCanvas.DrawSegment(80, 130, 130, 80);\n    ImageCanvas.Update();\n\n    vtkPNGWriter Writer = new vtkPNGWriter();\n    Writer.SetInputConnection(ImageCanvas.GetOutputPort());\n    Writer.SetFileName(fileName);\n    Writer.Write();\n  }\n}\n
"},{"location":"Java/Images/Actor2D/","title":"Actor2D","text":"

vtk-examples/Java/Images/Actor2D

"},{"location":"Java/Images/Actor2D/#description","title":"Description","text":"

Example to demonstrate an actor that draws 2D data.

The object [vtkActor](https://www.vtk.org/doc/nightly/html/classvtkActor.html#details)2D is similar to vtkActor, but it is made to be used with two dimensional images and annotation.

[vtkActor](https://www.vtk.org/doc/nightly/html/classvtkActor.html#details)2D object has a position but does not use a transformation matrix like vtkActor and it has a reference to a vtkMapper2D object which does the rendering.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Images/Actor2D/#code","title":"Code","text":"

Actor2D.java

import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPoints;\nimport vtk.vtkVertexGlyphFilter;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper2D;\nimport vtk.vtkActor2D;\n\npublic class Actor2D \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Lime\", actorColor);\n    colors.GetColor(\"DarkSlateGray\", Bgcolor);\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(10, 10, 0);\n    Points.InsertNextPoint(100, 100, 0);\n    Points.InsertNextPoint(200, 200, 0);\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n\n    vtkVertexGlyphFilter GlyphFilter = new vtkVertexGlyphFilter();\n    GlyphFilter.SetInputData(PolyData);\n    GlyphFilter.Update();\n\n    vtkPolyDataMapper2D Mapper = new vtkPolyDataMapper2D();\n    Mapper.SetInputConnection(GlyphFilter.GetOutputPort());\n    Mapper.Update();\n\n    vtkActor2D Actor = new vtkActor2D();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n    Actor.GetProperty().SetPointSize(8);\n\n    // Create the renderer, render window and Interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actor to the scene\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Images/Cast/","title":"Cast","text":"

vtk-examples/Java/Images/Cast

"},{"location":"Java/Images/Cast/#description","title":"Description","text":"

vtkImageCast object filter casts the input type to match the output type in the image processing pipeline.

The filter does nothing if the input already has the correct type. To specify the \"CastTo\" type, use \"SetOutputScalarType\" method.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Images/Cast/#code","title":"Code","text":"

Cast.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageMandelbrotSource;\nimport vtk.vtkImageCast;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\npublic class Cast\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------  \n\n  public static void main(String args[]) \n  {\n    //Create a float image\n    vtkImageMandelbrotSource source = new vtkImageMandelbrotSource();\n    source.Update();\n\n    System.out.println(source.GetOutput().GetScalarTypeAsString());\n\n    vtkImageCast castFilter = new vtkImageCast();\n    castFilter.SetInputConnection(source.GetOutputPort());\n    castFilter.SetOutputScalarTypeToUnsignedChar();\n    castFilter.Update();\n\n    //Create an actor\n    vtkImageActor actor = new vtkImageActor();\n    actor.GetMapper().SetInputConnection(castFilter.GetOutputPort());\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    ren.AddActor(actor);\n    ren.ResetCamera();\n\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n    iren.SetInteractorStyle(style);\n    iren.SetRenderWindow(renWin);\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Images/Flip/","title":"Flip","text":"

vtk-examples/Java/Images/Flip

"},{"location":"Java/Images/Flip/#description","title":"Description","text":"

This example demonstrates how to flip an image over an axis.

vtkImageFlip object will reflect the data along the filtered axis. This filter is actually a thin wrapper around vtkImageReslice.

Need a better source image (non-symmetrical!).

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Images/Flip/#code","title":"Code","text":"

Flip.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkImageMandelbrotSource;\nimport vtk.vtkImageCast;\nimport vtk.vtkImageFlip;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\n\npublic class Flip \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For inputRenderer Color\n    double inputRendererColor[] = new double[] {.4, .5, .9, 1};\n    //For xActor Color\n    double xActorColor[] = new double [] {.4, .5, .6, 1};\n    //For yActor Color\n    double yActorColor[] = new double[] {.4, .5, .7, 1};\n    //For zActor Color\n    double zActorColor[] = new double[] {.4, .5, .8, 1};\n\n\n    //Change Color Name to Use your own Color for Change inputRenderer Color\n    Color.SetColor(\"inputRendererColor\",inputRendererColor);\n    //Change Color Name to Use your own Color for Change xActorColor Color\n    Color.SetColor(\"xActorColor\",xActorColor);\n    //Change Color Name to Use your own Color for Change yActorColor Color\n    Color.SetColor(\"yActorColor\",yActorColor);\n    //Change Color Name to Use your own Color for Change zActorColor Color\n    Color.SetColor(\"zActorColor\",zActorColor);\n\n\n    //Create an image\n    vtkImageMandelbrotSource source = new vtkImageMandelbrotSource();\n    source.Update();\n\n    vtkImageCast castSource = new vtkImageCast();\n    castSource.SetOutputScalarTypeToUnsignedChar();\n    castSource.SetInputConnection(source.GetOutputPort());\n    castSource.Update();\n\n    vtkImageFlip flipXFilter = new vtkImageFlip();\n    flipXFilter.SetFilteredAxis(0); // flip x axis\n    flipXFilter.SetInputConnection(source.GetOutputPort());\n    flipXFilter.Update();\n\n    vtkImageCast castXFilter = new vtkImageCast();\n    castXFilter.SetOutputScalarTypeToUnsignedChar();\n    castXFilter.SetInputConnection(flipXFilter.GetOutputPort());\n    castXFilter.Update();\n\n    vtkImageFlip flipYFilter = new vtkImageFlip();\n    flipYFilter.SetFilteredAxis(1); // flip y axis\n    flipYFilter.SetInputConnection(source.GetOutputPort());\n    flipYFilter.Update();\n\n    vtkImageCast castYFilter = new vtkImageCast();\n    castYFilter.SetOutputScalarTypeToUnsignedChar();\n    castYFilter.SetInputConnection(flipYFilter.GetOutputPort());\n    castYFilter.Update();\n\n    vtkImageFlip flipZFilter = new vtkImageFlip();\n    flipZFilter.SetFilteredAxis(2); // flip z axis\n    flipZFilter.SetInputConnection(source.GetOutputPort());\n    flipZFilter.Update();\n\n    vtkImageCast castZFilter = new vtkImageCast();\n    castZFilter.SetOutputScalarTypeToUnsignedChar();\n    castZFilter.SetInputConnection(flipZFilter.GetOutputPort());\n    castZFilter.Update();\n\n    //Create actors\n    vtkImageActor inputActor = new vtkImageActor();\n    inputActor.GetMapper().SetInputConnection(castSource.GetOutputPort());\n\n    vtkImageActor xActor = new vtkImageActor();\n    xActor.GetMapper().SetInputConnection(castXFilter.GetOutputPort());\n\n    vtkImageActor yActor = new vtkImageActor();\n    yActor.GetMapper().SetInputConnection(castYFilter.GetOutputPort());\n\n    vtkImageActor zActor = new vtkImageActor();\n    zActor.GetMapper().SetInputConnection(castZFilter.GetOutputPort());\n\n    //Define viewport ranges\n    //(xmin, ymin, xmax, ymax)\n    double inputViewport[] = new double[] {0.0, 0.0, 0.25, 1.0};\n    double xViewport[] = new double[] {0.25, 0.0, 0.5, 1.0};\n    double yViewport[] = new double[] {0.5, 0.0, 0.75, 1.0};\n    double zViewport[] = new double[] {0.75, 0.0, 1.0, 1.0};\n\n    // Setup renderers\n    vtkRenderer inputRenderer = new vtkRenderer();\n    inputRenderer.SetViewport(inputViewport);\n    inputRenderer.AddActor(inputActor);\n    inputRenderer.ResetCamera();\n    inputRenderer.SetBackground(inputRendererColor);\n\n    vtkRenderer xRenderer = new vtkRenderer();\n    xRenderer.SetViewport(xViewport);\n    xRenderer.AddActor(xActor);\n    xRenderer.ResetCamera();\n    xRenderer.SetBackground(xActorColor);\n\n    vtkRenderer yRenderer = new vtkRenderer();\n    yRenderer.SetViewport(yViewport);\n    yRenderer.AddActor(yActor);\n    yRenderer.ResetCamera();\n    yRenderer.SetBackground(yActorColor);\n\n    vtkRenderer zRenderer = new vtkRenderer();\n    zRenderer.SetViewport(zViewport);\n    zRenderer.AddActor(zActor);\n    zRenderer.ResetCamera();\n    zRenderer.SetBackground(zActorColor);\n\n\n    // Setup render window\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.SetSize(1000, 250);\n    renderWindow.AddRenderer(inputRenderer);\n    renderWindow.AddRenderer(xRenderer);\n    renderWindow.AddRenderer(yRenderer);\n    renderWindow.AddRenderer(zRenderer);\n\n    // Setup render window interactor\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n\n    renderWindowInteractor.SetInteractorStyle(style);\n\n    // Render and start interaction\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n    renderWindow.Render();\n    renderWindowInteractor.Initialize();\n\n    renderWindowInteractor.Start();\n\n  }\n}\n
"},{"location":"Java/Images/ImageFFT/","title":"ImageFFT","text":"

vtk-examples/Java/Images/ImageFFT

"},{"location":"Java/Images/ImageFFT/#description","title":"Description","text":"

vtkImageFFT object implements a fast Fourier transform.

The input can have real or complex data in any components and data types, but the output is always complex doubles with real values in component0, and imaginary values in component1.

The filter is fastest for images that have power of two sizes. The filter uses a butterfly diagram for each prime factor of the dimension.

This makes images with prime number dimensions (i.e. 17x17) much slower to compute. Multi dimensional (i.e volumes) FFT's are decomposed so that each axis executes serially.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Images/ImageFFT/#code","title":"Code","text":"

ImageFFT.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkImageEllipsoidSource;\nimport vtk.vtkImageFFT;\nimport vtk.vtkImageCast;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\npublic class ImageFFT\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    double OriginalRendererBgColor[] = new double[] {.4, .5, .6, 1};\n    Color.SetColor(\"OriginalRendererBgColor\",OriginalRendererBgColor);\n\n    double fftRendererBgColor[] = new double[] {.4, .5, .7, 1};\n    Color.SetColor(\"fftRendererBgColor\",fftRendererBgColor);\n\n    //Create an image\n    vtkImageEllipsoidSource source = new vtkImageEllipsoidSource();\n    source.SetWholeExtent(0, 20, 0, 20, 0, 0);\n    source.SetCenter(10,10,0);\n    source.SetRadius(3,4,0);\n    source.Update();\n\n    vtkImageFFT fftFilter = new vtkImageFFT();\n    fftFilter.SetInputConnection(source.GetOutputPort());\n    fftFilter.Update();\n\n    vtkImageCast fftCastFilter = new vtkImageCast();\n    fftCastFilter.SetInputConnection(fftFilter.GetOutputPort());\n    fftCastFilter.SetOutputScalarTypeToUnsignedChar();\n    fftCastFilter.Update();\n\n    //Create actors\n    vtkImageActor originalActor = new vtkImageActor();\n    originalActor.GetMapper().SetInputConnection(source.GetOutputPort());\n\n    vtkImageActor fftActor = new vtkImageActor();\n    fftActor.GetMapper().SetInputConnection(fftCastFilter.GetOutputPort());\n\n    //Define viewport ranges\n    //(xmin, ymin, xmax, ymax)\n    double originalViewport[]= new double[] {0.0, 0.0, 0.5, 1.0};\n    double fftViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n    //Setup renderers\n    vtkRenderer originalRenderer = new vtkRenderer();\n    originalRenderer.SetViewport(originalViewport);\n    originalRenderer.AddActor(originalActor);\n    originalRenderer.ResetCamera();\n    originalRenderer.SetBackground(OriginalRendererBgColor);\n\n    vtkRenderer fftRenderer = new vtkRenderer();\n    fftRenderer.SetViewport(fftViewport);\n    fftRenderer.AddActor(fftActor);\n    fftRenderer.ResetCamera();\n    fftRenderer.SetBackground(fftRendererBgColor);\n\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.SetSize(600, 300);\n    renderWindow.AddRenderer(originalRenderer);\n    renderWindow.AddRenderer(fftRenderer);\n\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n\n    renderWindowInteractor.SetInteractorStyle(style);\n\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n    renderWindow.Render();\n    renderWindowInteractor.Initialize();\n\n    renderWindowInteractor.Start();\n\n  }\n}\n
"},{"location":"Java/Images/ImageSinusoidSource/","title":"ImageSinusoidSource","text":"

vtk-examples/Java/Images/ImageSinusoidSource

"},{"location":"Java/Images/ImageSinusoidSource/#description","title":"Description","text":"

vtkImageSinusoidSource object just produces images with pixel values determined by a sinusoid.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Images/ImageSinusoidSource/#code","title":"Code","text":"

ImageSinusoidSource.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkImageSinusoidSource;\nimport vtk.vtkImageViewer2;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class ImageSinusoidSource \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\npublic static void main(String args[]) \n{\n\n  vtkImageSinusoidSource sinusoidSource = new vtkImageSinusoidSource();\n  sinusoidSource.Update();\n\n  //Visualize\n  vtkImageViewer2 imageViewer = new vtkImageViewer2();\n  imageViewer.SetInputConnection(sinusoidSource.GetOutputPort());\n  imageViewer.GetRenderWindow().SetSize( 500, 500 );\n  imageViewer.GetRenderer().ResetCamera();\n\n  vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n  imageViewer.GetRenderWindow().SetInteractor(iren);\n  iren.SetInteractorStyle(null);\n  imageViewer.Render();\n\n  iren.Initialize();\n  iren.Start();\n\n }\n}\n
"},{"location":"Java/Images/RTAnalyticSource/","title":"RTAnalyticSource","text":"

vtk-examples/Java/Images/RTAnalyticSource

"},{"location":"Java/Images/RTAnalyticSource/#description","title":"Description","text":"

Example to Create an image for regression testing.

vtkRTAnalyticSource object just produces images with pixel values determined by a MaximumGaussianXMagsin(XFreqx)sin(YFreqy)cos(ZFreqz) Values are float scalars on point data with name \"RTData\".

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Images/RTAnalyticSource/#code","title":"Code","text":"

RTAnalyticSource.java

import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageActor;\nimport vtk.vtkRTAnalyticSource;\nimport vtk.vtkInteractorStyleImage;\n\npublic class RTAnalyticSource \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DarkRed\", Bgcolor);\n\n    vtkRTAnalyticSource AnalyticSource = new vtkRTAnalyticSource();\n    AnalyticSource.SetWholeExtent(-10, 10, -10, 10, 0, 0);\n\n    vtkImageActor ImageActor = new vtkImageActor();\n    ImageActor.GetMapper().SetInputConnection(AnalyticSource.GetOutputPort());\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleImage Style = new vtkInteractorStyleImage();\n    iren.SetInteractorStyle(Style);\n\n    // Visualize Actor\n    ren.AddActor(ImageActor);\n    ren.SetBackground(Bgcolor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Images/StaticImage/","title":"StaticImage","text":"

vtk-examples/Java/Images/StaticImage

Description:

This example displays a 2D image in a non-interactable window. vtkImageCanvasSource2D is a source that starts as a blank image. User may add to the image with two-dimensional drawing routines. It can paint multi-spectral images. vtkImageViewer2 is a convenience class for displaying a 2D image

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Images/StaticImage/#code","title":"Code","text":"

StaticImage.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkImageReader2;\nimport vtk.vtkImageViewer2;\nimport vtk.vtkImageReader2Factory;\n\npublic class StaticImage \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    // Read the image (Pass the Image File Name as Argument)\n    vtkImageReader2Factory ReaderFactory = new vtkImageReader2Factory();\n    vtkImageReader2 Reader = ReaderFactory.CreateImageReader2(args[0]);\n    Reader.SetFileName(args[0]);\n    Reader.Update();\n\n    // Visualize\n    vtkImageViewer2 ImageViewer = new vtkImageViewer2();\n    ImageViewer.SetInputConnection(Reader.GetOutputPort());\n    ImageViewer.GetRenderWindow().SetSize(500, 500);\n    ImageViewer.GetRenderer().ResetCamera();\n\n    // Set up an interactor that does not respond to mouse events\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    ImageViewer.GetRenderWindow().SetInteractor(iren);\n    iren.SetInteractorStyle(null);\n    ImageViewer.Render();\n\n    // Start the event loop\n    iren.Initialize();\n    iren.Start();\n\n    Reader.Delete();\n  }\n}\n
"},{"location":"Java/Imaging/ImageTest/","title":"ImageTest","text":"

vtk-examples/Java/Imaging/ImageTest

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Imaging/ImageTest/#code","title":"Code","text":"

ImageTest.java

import java.awt.FileDialog;\nimport java.awt.Frame;\nimport vtk.*;\n\npublic class ImageTest  {\n\n  /**\n     * ImageTest provides a means to test the ImageReader2Factory\n     * Image files understood by vtk are displayed, \n     * all others are reported with a message. \n     */\n  vtkRenderWindow renWin;\n  vtkRenderWindowInteractor iren;\n  vtkRenderer ren1;\n  vtkImageReader2Factory imageReaderFactory;\n  vtkImageReader2 imageReader;\n  vtkImageActor ImageActor;\n  vtkInteractorObserver imageStyle;\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args) {\n\n    ImageTest me = new ImageTest();\n    me.doit();\n\n  }\n\n\n  public void doit() {\n    /*\n         * Use a file dialog to allow selection of any file for \n         * test of the imagereaderfactory.\n         * only does one file per exection.\n         */\n    System.out.println(\"init in ImageTest\");\n    ren1 = new vtkRenderer();\n    renWin = new vtkRenderWindow();\n    iren = new vtkRenderWindowInteractor();\n    imageStyle = new vtkInteractorStyleImage();\n\n    FileDialog fd = new FileDialog( new Frame(),\"File name to load\",\n                                    FileDialog.LOAD);\n    fd.setFile(\"*.*\");\n    fd.setVisible(true);\n    String selected = fd.getFile();\n    fd.setVisible(false);\n    if (selected != null) {\n      String outname = fd.getDirectory() + selected;\n\n      imageReaderFactory = new vtkImageReader2Factory();\n      imageReader = imageReaderFactory.CreateImageReader2(outname);\n      if (imageReader != null) {\n        imageReader.SetFileName(outname);\n        imageReader.SetDataOrigin(0, 0, 0);\n        imageReader.Update();\n\n        ImageActor = new vtkImageActor();\n        ImageActor.SetInput(imageReader.GetOutput());\n        renWin.AddRenderer(ren1);\n        iren.SetRenderWindow(renWin);\n\n        iren.SetInteractorStyle(imageStyle);\n\n        ren1.AddActor(ImageActor);\n        renWin.AddRenderer(ren1);\n\n        iren.Initialize();\n        iren.Start();\n        System.out.println(\"Return from interactor\");\n        renWin.Finalize();\n      } else {\n        System.out.println(\"No reader found for \" + outname);\n      }\n\n    } else {\n      System.out.println(\"No file name selected\");\n    }\n\n  }\n}\n
"},{"location":"Java/ImplicitFunctions/ImplicitDataSet/","title":"ImplicitDataSet","text":"

vtk-examples/Java/ImplicitFunctions/ImplicitDataSet

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/ImplicitFunctions/ImplicitDataSet/#code","title":"Code","text":"

ImplicitDataSet.java

import vtk.vtkRTAnalyticSource;\nimport vtk.vtkImplicitDataSet;\nimport vtk.vtkNativeLibrary;\n\nclass ImplicitDataSet{  \n\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n\n  public static void main(String args[]){  \n\n    vtkRTAnalyticSource waveletSource = new vtkRTAnalyticSource();\n    waveletSource.Update();\n\n    vtkImplicitDataSet implicitWavelet = new vtkImplicitDataSet();\n    implicitWavelet.SetDataSet(waveletSource.GetOutput());\n\n    double x[] = new double[] {0.5,0,0};\n    // Value should roughly be 258.658.\n\n\n    System.out.print(\"x: \" + implicitWavelet.EvaluateFunction(x));\n\n  }   \n}   \n
"},{"location":"Java/ImplicitFunctions/ImplicitSphere/","title":"ImplicitSphere","text":"

vtk-examples/Java/ImplicitFunctions/ImplicitSphere

"},{"location":"Java/ImplicitFunctions/ImplicitSphere/#description","title":"Description","text":"

This example creates a polygonal model of two spheres and 3 tubes, and then renders it to the screen. It will rotate the scene 360 degrees and then exit. The basic setup of source -> mapper -> actor -> renderer -> renderwindow is typical of most VTK programs.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/ImplicitFunctions/ImplicitSphere/#code","title":"Code","text":"

ImplicitSphere.java

//\n// This example creates a polygonal model of two spheres and 3 tubes, and then renders it to\n// the screen. It will rotate the scene 360 degrees and then exit. The basic\n// setup of source -> mapper -> actor -> renderer -> renderwindow is \n// typical of most VTK programs.\n//\n\n// We import the vtk wrapped classes first.\nimport vtk.*;\n\n// Then we define our class.\npublic class Sphere {\n\n  // In the static contructor we load in the native code.\n  // The libraries must be in your path to work.\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  // Now the main program\n  public static void main (String []args) {\n    // \n    // Next we create an instance of vtkSphereSource and set some of its\n    // properties. The instance of vtkSphereSource \"sphere\" is part of a\n    // visualization pipeline (it is a source process object); it produces data\n    // (output type is vtkPolyData) which other filters may process.\n    //\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetRadius( 1.0 );\n    sphere.SetPhiResolution(12);\n    sphere.SetThetaResolution( 12 );\n\n    vtkSphereSource sph = new vtkSphereSource();\n    vtkAppendPolyData apf = new vtkAppendPolyData();\n    vtkPolyData pd = new vtkPolyData(); \n    vtkTubeFilter tubes = new vtkTubeFilter();\n    vtkCellArray polys = new vtkCellArray(); \n    vtkPoints points = new vtkPoints();\n    points.Allocate(10, 10);\n    polys.Allocate(10, 10);\n    pd.Allocate(10, 10);\n    sph.SetCenter(3, 0, 2);\n    sph.SetRadius(2);\n    sph.SetThetaResolution(25);\n    sph.SetPhiResolution(25);\n    sph.Update(); \n    points.InsertNextPoint(3, 0, 2);\n    points.InsertNextPoint(3, 3, 3);\n    points.InsertNextPoint(5, 3, 3);\n    points.InsertNextPoint(2, 4, 2);\n    points.InsertNextPoint(4,4,4);\n\n    polys.InsertNextCell(2);\n    polys.InsertCellPoint(0);\n    polys.InsertCellPoint(1);\n    polys.InsertNextCell(2);\n    polys.InsertCellPoint(1);\n    polys.InsertCellPoint(2);\n    polys.InsertNextCell(2);\n    polys.InsertCellPoint(2);\n    polys.InsertCellPoint(3);\n    polys.InsertNextCell(2);\n    polys.InsertCellPoint(3);\n    polys.InsertCellPoint(1);\n    pd.SetLines(polys);\n    pd.SetPoints(points);\n    tubes.AddInput(pd);\n    tubes.SetRadius(.25);\n    tubes.SetNumberOfSides(9);\n    tubes.Update();\n\n    apf.AddInput(tubes.GetOutput());\n    apf.AddInput(sphere.GetOutput());\n    apf.AddInput(sph.GetOutput());\n    // \n    // In this example we terminate the pipeline with a mapper process object.\n    // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    // between the source and the mapper.)  We create an instance of\n    // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    // connect the output of the sphere souece to the input of this mapper.\n    //\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInput( apf.GetOutput() );\n    // \n    // Create an actor to represent the sphere. The actor orchestrates rendering\n    // of the mapper's graphics primitives. An actor also refers to properties\n    // via a vtkProperty instance, and includes an internal transformation\n    // matrix. We set this actor's mapper to be sphereMapper which we created\n    // above.\n    //\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper( sphereMapper );\n\n    //\n    // Create the Renderer and assign actors to it. A renderer is like a\n    // viewport. It is part or all of a window on the screen and it is\n    // responsible for drawing the actors it has.  We also set the background\n    // color here\n    //\n    vtkRenderer ren1 = new vtkRenderer();\n    ren1.AddActor( sphereActor );\n    ren1.SetBackground( 0.1, 0.2, 0.4 );\n\n    //\n    // Finally we create the render window which will show up on the screen\n    // We put our renderer into the render window using AddRenderer. We also\n    // set the size to be 300 pixels by 300\n    //\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer( ren1 );\n    renWin.SetSize( 300, 300 );\n\n    //\n    // Now we loop over 360 degrees and render the sphere each time\n    //\n    int i;\n    for (i = 0; i < 360; ++i)\n    {\n      // render the image\n      renWin.Render();\n      try {\n        Thread.sleep(100);\n      } catch (Throwable e) {\n        e.printStackTrace();\n      }\n      // rotate the active camera by one degree\n      ren1.GetActiveCamera().Azimuth( 1 );\n    }\n\n    try {\n      Thread.sleep(1000);\n    } catch (Throwable e1) {\n      e1.printStackTrace();\n    }\n\n  } \n}\n
"},{"location":"Java/ImplicitFunctions/SampleFunction/","title":"SampleFunction","text":"

vtk-examples/Java/ImplicitFunctions/SampleFunction

"},{"location":"Java/ImplicitFunctions/SampleFunction/#description","title":"Description","text":"

vtkSampleFunction is a source object that evaluates an implicit function and normals at each point in a vtkStructuredPoints.

The user can specify the sample dimensions and location in space to perform the sampling. To create closed surfaces (in conjunction with the vtkContourFilter), capping can be turned on to set a particular value on the boundaries of the sample space.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/ImplicitFunctions/SampleFunction/#code","title":"Code","text":"

SampleFunction.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSuperquadric;\nimport vtk.vtkSampleFunction;\nimport vtk.vtkContourFilter;\nimport vtk.vtkOutlineFilter;\n\n\npublic class SampleFunction\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Outline Actor Color\n    double OutlineActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Black\",OutlineActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Tan\",BgColor);\n\n    vtkSuperquadric implicitFunction = new vtkSuperquadric();\n    implicitFunction.SetPhiRoundness(2.5);\n    implicitFunction.SetThetaRoundness(.5);\n\n    //Sample the function\n    vtkSampleFunction sample = new vtkSampleFunction();\n    sample.SetSampleDimensions(50,50,50);\n    sample.SetImplicitFunction(implicitFunction);\n    double value = 2.0;\n    double xmin = -value, xmax = value, ymin = -value, ymax = value, zmin = -value, zmax = value;\n    sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n    //Create the 0 isosurface\n    vtkContourFilter contours = new vtkContourFilter();\n    contours.SetInputConnection(sample.GetOutputPort());\n    contours.GenerateValues(1, 2.0, 2.0);\n\n    //Map the contours to graphical primitives\n    vtkPolyDataMapper contourMapper = new vtkPolyDataMapper();\n    contourMapper.SetInputConnection(contours.GetOutputPort());\n    contourMapper.SetScalarRange(0.0, 1.2);\n\n    //Create an actor for the contours\n    vtkActor contourActor = new vtkActor();\n    contourActor.SetMapper(contourMapper);\n\n    //create a box around the function to indicate the sampling volume --\n\n    //Create outline\n    vtkOutlineFilter outline = new vtkOutlineFilter();\n    outline.SetInputConnection(sample.GetOutputPort());\n\n    // Map it to graphics primitives\n    vtkPolyDataMapper outlineMapper = new vtkPolyDataMapper();\n    outlineMapper.SetInputConnection(outline.GetOutputPort());\n\n    // Create an actor for it\n    vtkActor outlineActor = new vtkActor();\n    outlineActor.SetMapper(outlineMapper);\n    outlineActor.GetProperty().SetColor(OutlineActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(contourActor);\n    ren.AddActor(outlineActor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/InfoVis/GraphPoints/","title":"GraphPoints","text":"

vtk-examples/Java/InfoVis/GraphPoints

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/InfoVis/GraphPoints/#code","title":"Code","text":"

GraphPoints.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkGraphLayoutView;\nimport vtk.vtkMutableUndirectedGraph;\n\n\npublic class GraphPoints \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n     vtkMutableUndirectedGraph graph = new vtkMutableUndirectedGraph();\n\n     // Create 3 vertices\n     int v1 = graph.AddVertex();\n     int v2 = graph.AddVertex();\n     int v3 = graph.AddVertex();\n\n     graph.AddGraphEdge(v1, v2);\n     graph.AddGraphEdge(v1, v3);\n\n     vtkPoints points = new vtkPoints();\n     points.InsertNextPoint(0.0, 0.0, 0.0);\n     points.InsertNextPoint(1.0, 0.0, 0.0);\n     points.InsertNextPoint(0.0, 1.0, 0.0);\n\n     graph.SetPoints(points);\n\n     System.out.println(\"Number of output points: \" + \" \" + graph.GetPoints().GetNumberOfPoints());\n\n     vtkGraphLayoutView graphLayoutView = new vtkGraphLayoutView();\n     graphLayoutView.AddRepresentationFromInput(graph);\n     graphLayoutView.SetLayoutStrategy(\"Pass Through\");\n     graphLayoutView.ResetCamera();\n     graphLayoutView.Render();\n     graphLayoutView.GetInteractor().Start();\n\n  }\n}\n
"},{"location":"Java/InfoVis/PassThrough/","title":"PassThrough","text":"

vtk-examples/Java/InfoVis/PassThrough

"},{"location":"Java/InfoVis/PassThrough/#description","title":"Description","text":"

vtkPassThrough object copies the input into the output.

The output type is always the same as the input object type.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/InfoVis/PassThrough/#code","title":"Code","text":"

PassThrough.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkPassThrough;\nimport vtk.vtkSphereSource;\n\npublic class PassThrough \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    System.out.println(\"Points before:\" + \" \" + sphereSource.GetOutput().GetNumberOfPoints());\n\n    vtkPassThrough passThrough = new vtkPassThrough();\n    passThrough.SetInputConnection(sphereSource.GetOutputPort());\n    passThrough.Update();\n    passThrough.GetOutput();\n\n    System.out.println(\"Points after:\" + \" \" + sphereSource.GetOutput().GetNumberOfPoints());\n\n  }\n}\n
"},{"location":"Java/Interaction/Assembly/","title":"Assembly","text":"

vtk-examples/Java/Interaction/Assembly

"},{"location":"Java/Interaction/Assembly/#description","title":"Description","text":"

vtkAssembly is an object that groups vtkProp3Ds, its subclasses, and other assemblies into a tree-like hierarchy.

The vtkProp3Ds and assemblies can then be transformed together by transforming just the root assembly of the hierarchy.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Interaction/Assembly/#code","title":"Code","text":"

Assembly.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkCubeSource;\nimport vtk.vtkAssembly;\nimport vtk.vtkTransform;\nimport vtk.vtkPropCollection;\n\n\npublic class Assembly \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For sphereActor Color\n    double sphereActorColor[] = new double[4];\n    //For cubeActor Color\n    double cubeActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Banana\", sphereActorColor);\n    colors.GetColor(\"Tomato\", cubeActorColor);\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n    sphereActor.GetProperty().SetColor(sphereActorColor);\n\n    // Create a cube\n    vtkCubeSource cubeSource = new vtkCubeSource();\n    cubeSource.SetCenter(5.0, 0.0, 0.0);\n    cubeSource.Update();\n\n    vtkPolyDataMapper cubeMapper = new vtkPolyDataMapper();\n    cubeMapper.SetInputConnection(cubeSource.GetOutputPort());\n\n    vtkActor cubeActor = new vtkActor();\n    cubeActor.SetMapper(cubeMapper);\n    cubeActor.GetProperty().SetColor(cubeActorColor);\n\n    // Combine the sphere and cube into an assembly\n    vtkAssembly assembly = new vtkAssembly();\n    assembly.AddPart(sphereActor);\n    assembly.AddPart(cubeActor);\n\n    // Apply a transform to the whole assembly\n    vtkTransform transform = new vtkTransform();\n    transform.PostMultiply(); //this is the key line\n    transform.Translate(5.0, 0, 0);\n\n    assembly.SetUserTransform(transform);\n\n    // Extract each actor from the assembly and change its opacity\n    vtkPropCollection collection = new vtkPropCollection();\n\n    assembly.GetActors(collection);\n    collection.InitTraversal();\n    cubeActor.GetProperty().SetOpacity(0.5);\n    sphereActor.GetProperty().SetOpacity(0.5);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(assembly);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Interaction/InteractorStyleTerrain/","title":"InteractorStyleTerrain","text":"

vtk-examples/Java/Interaction/InteractorStyleTerrain

"},{"location":"Java/Interaction/InteractorStyleTerrain/#description","title":"Description","text":"

vtkInteractorStyleTerrain object is used to manipulate a camera which is viewing a scene with a natural view up, e.g., terrain.

The camera in such a scene is manipulated by specifying azimuth (angle around the view up vector) and elevation (the angle from the horizon).

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Interaction/InteractorStyleTerrain/#code","title":"Code","text":"

InteractorStyleTerrain.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkInteractorStyleTerrain;\n\npublic class InteractorStyleTerrain\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    // Create an actor\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the scene\n    ren.AddActor(Actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleTerrain style = new vtkInteractorStyleTerrain();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Interaction/PickableOff/","title":"PickableOff","text":"

vtk-examples/Java/Interaction/PickableOff

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Interaction/PickableOff/#code","title":"Code","text":"

PickableOff.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkConeSource;\n\npublic class PickableOff\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For coneActor0 Color\n    double coneActor0Color[] = new double[4];\n    //For coneActor1 Color\n    double coneActor1Color[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Gold\", coneActor0Color);\n    colors.GetColor(\"Lime\", coneActor1Color);\n    colors.GetColor(\"DarkGray\", Bgcolor);\n\n    vtkConeSource ConeSource0 = new vtkConeSource();\n    ConeSource0.Update();\n\n    vtkConeSource ConeSource1 = new vtkConeSource();\n    ConeSource1.SetCenter(5, 0, 0);\n    ConeSource1.Update();\n\n    vtkPolyDataMapper coneMapper0 = new vtkPolyDataMapper();\n    coneMapper0.SetInputConnection(ConeSource0.GetOutputPort());\n\n    vtkPolyDataMapper coneMapper1 = new vtkPolyDataMapper();\n    coneMapper1.SetInputConnection(ConeSource1.GetOutputPort());\n\n    vtkActor coneActor0 = new vtkActor();\n    coneActor0.SetMapper(coneMapper0);\n    coneActor0.GetProperty().SetColor(coneActor0Color);\n\n    vtkActor coneActor1 = new vtkActor();\n    coneActor1.SetMapper(coneMapper1);\n    coneActor1.GetProperty().SetColor(coneActor1Color);\n    coneActor1.PickableOff();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(coneActor0);\n    ren.AddActor(coneActor1);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Interaction/RubberBandPick/","title":"RubberBandPick","text":"

vtk-examples/Java/Interaction/RubberBandPick

"},{"location":"Java/Interaction/RubberBandPick/#description","title":"Description","text":"

vtkInteractorStyleRubberBandPick object allows the user to draw a rectangle in the render window by hitting 'r' and then using the left mouse button. When the mouse button is released, the attached picker operates on the pixel in the center of the selection rectangle.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Interaction/RubberBandPick/#code","title":"Code","text":"

RubberBandPick.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkInteractorStyleRubberBandPick;\n\npublic class RubberBandPick \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    // Create an actor\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the scene\n    ren.AddActor(Actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleRubberBandPick style = new vtkInteractorStyleRubberBandPick();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Interaction/RubberBandZoom/","title":"RubberBandZoom","text":"

vtk-examples/Java/Interaction/RubberBandZoom

"},{"location":"Java/Interaction/RubberBandZoom/#description","title":"Description","text":"

This example demonstrates how to select a region of the window to zoom in.

vtkInteractorStyleRubberBandZoom object allows the user to draw a rectangle in the render window using the left mouse button.

When the mouse button is released, the current camera zooms by an amount determined from the shorter side of the drawn rectangle.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Interaction/RubberBandZoom/#code","title":"Code","text":"

RubberBandZoom.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkInteractorStyleRubberBandZoom;\n\npublic class RubberBandZoom \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    // Create an actor\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the scene\n    ren.AddActor(Actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleRubberBandZoom style = new vtkInteractorStyleRubberBandZoom();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Interaction/StyleSwitch/","title":"StyleSwitch","text":"

vtk-examples/Java/Interaction/StyleSwitch

"},{"location":"Java/Interaction/StyleSwitch/#description","title":"Description","text":"

The class vtkInteractorStyleSwitch allows handles interactively switching between four interactor styles -- joystick actor, joystick camera, trackball actor, and trackball camera. Type 'j' or 't' to select joystick or trackball, and type 'c' or 'a' to select camera or actor. The default interactor style is joystick camera.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Interaction/StyleSwitch/#code","title":"Code","text":"

StyleSwitch.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkInteractorStyleSwitch;\n\npublic class StyleSwitch \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    // Create an actor\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the scene\n    ren.AddActor(Actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleSwitch style = new vtkInteractorStyleSwitch();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Interaction/TrackballActor/","title":"TrackballActor","text":"

vtk-examples/Java/Interaction/TrackballActor

"},{"location":"Java/Interaction/TrackballActor/#description","title":"Description","text":"

This example shows how to visualize data in \"trackball\" mode. That is, click and drag actors is the way to interact.

Contrast this with TrackballCamera.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Interaction/TrackballActor/#code","title":"Code","text":"

TrackballActor.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkConeSource;\nimport vtk.vtkInteractorStyleTrackballActor;\n\npublic class TrackballActor \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(1.0, 0.0, 0.0 );\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper  = new vtkPolyDataMapper();\n    sphereMapper .SetInputData (sphereSource.GetOutput());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create a Cone\n    vtkConeSource ConeSource = new vtkConeSource();\n\n    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();\n    coneMapper.SetInputConnection(ConeSource.GetOutputPort());\n\n    vtkActor coneActor  = new vtkActor();\n    coneActor.SetMapper(coneMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor);\n    ren.AddActor(coneActor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetWindowName(\"Trackball Actor\");\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleTrackballActor style = new vtkInteractorStyleTrackballActor();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n   }\n}\n
"},{"location":"Java/Interaction/TrackballCamera/","title":"TrackballCamera","text":"

vtk-examples/Java/Interaction/TrackballCamera

"},{"location":"Java/Interaction/TrackballCamera/#description","title":"Description","text":"

This example demonstrates the trackball camera mode. When the mouse is clicked and dragged from anywhere in the window, the camera is modified.

Contrast this with TrackballActor.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Interaction/TrackballCamera/#code","title":"Code","text":"

TrackballCamera.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkConeSource;\nimport vtk.vtkInteractorStyleTrackballCamera;\n\npublic class TrackballCamera \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(1.0, 0.0, 0.0 );\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper  = new vtkPolyDataMapper();\n    sphereMapper .SetInputData (sphereSource.GetOutput());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create a Cone\n    vtkConeSource ConeSource = new vtkConeSource();\n\n    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();\n    coneMapper.SetInputConnection(ConeSource.GetOutputPort());\n\n    vtkActor coneActor  = new vtkActor();\n    coneActor.SetMapper(coneMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor);\n    ren.AddActor(coneActor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetWindowName(\"Trackball Camera\");\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Lighting/LightActor/","title":"LightActor","text":"

vtk-examples/Java/Lighting/LightActor

"},{"location":"Java/Lighting/LightActor/#description","title":"Description","text":"

Java Program to demonstrate the use of vtkLightActor.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Lighting/LightActor/#code","title":"Code","text":"

LightActor.java

import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\n\nimport vtk.vtkLight;\nimport vtk.vtkLightActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\n\n\npublic class LightActor extends JPanel implements ActionListener {\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public LightActor() {\n    super(new BorderLayout());\n\n    // Display where the light is  \n    vtkLight Light = new vtkLight();\n    Light.SetPositional(1);\n\n    vtkLightActor LightActor = new vtkLightActor();\n    LightActor.SetLight(Light);\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(LightActor);\n    renWin.GetRenderer().AddViewProp(LightActor);\n    renWin.resetCamera();\n\n\n    // Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e) {\n    if (e.getSource().equals(exitButton)) {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[]) {\n    SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JFrame frame = new JFrame(\"Light Actor\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new LightActor(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n} \n
"},{"location":"Java/Lighting/SpotLight/","title":"SpotLight","text":"

vtk-examples/Java/Lighting/SpotLight

"},{"location":"Java/Lighting/SpotLight/#description","title":"Description","text":"

This example places two vtkLight's with PositionalOn().

This example was inspired by Oliver Natt's question (and python script) on the VTK Users mailing list.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Lighting/SpotLight/#code","title":"Code","text":"

SpotLight.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPlaneSource;\nimport vtk.vtkLight;\n\npublic class SpotLight\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For greenLight \n    double greenLightColor[] = new double[4];\n    //For PinkLight \n    double pinkLightColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    //Renderer Background1 Color\n    double BgColor2[] = new double[4];\n\n    //Change Color Name to Use your own Color \n    Color.GetColor(\"Lawn_green\",greenLightColor);\n    Color.GetColor(\"DeepPink\",pinkLightColor);\n    Color.GetColor(\"RoyalBlue\",BgColor);\n    Color.GetColor(\"SkyBlue\",BgColor2);\n\n    vtkPlaneSource PlaneSource = new vtkPlaneSource();\n    PlaneSource.SetOrigin(-5.0, 0.0, 5.0);\n    PlaneSource.SetPoint1(5.0, 0.0, 5.0);\n    PlaneSource.SetPoint2(-5.0, 0.0, -5.0);\n    PlaneSource.SetResolution(100, 100);\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(PlaneSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    vtkLight greenLight = new vtkLight();\n    greenLight.PositionalOn();\n    greenLight.SetPosition(-4.0, 4.0, -1.0);\n    greenLight.SetColor(greenLightColor);\n    greenLight.SetIntensity(0.5);\n\n    vtkLight pinkLight = new vtkLight();\n    pinkLight.PositionalOn();\n    pinkLight.SetPosition(4.0, 5.0,1.0);\n    pinkLight.SetColor(pinkLightColor);\n    pinkLight.SetIntensity(0.6);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetSize(640, 480);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(Actor);\n\n    // set camera view\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(40.0);\n    ren.GetActiveCamera().Elevation(30.0);\n\n    // add lights to the renderer\n    ren.AddLight(pinkLight);\n    ren.AddLight(greenLight);\n\n    ren.SetBackground(BgColor);\n    ren.SetBackground2(BgColor2);\n    ren.GradientBackgroundOn();\n\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Math/MatrixInverse/","title":"MatrixInverse","text":"

vtk-examples/Java/Math/MatrixInverse

"},{"location":"Java/Math/MatrixInverse/#description","title":"Description","text":"

vtkMatrix3x3 object is used to represent and manipulate 3x3 matrices. Specifically, it is designed to work on 3x3 transformation matrices found in 2D rendering using homogeneous coordinates [x y w].

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Math/MatrixInverse/#code","title":"Code","text":"

MatrixInverse.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkMatrix3x3;\n\n\npublic class MatrixInverse \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    // For a 3x3 matrices\n    vtkMatrix3x3 Matrix = new vtkMatrix3x3();\n\n    Matrix.SetElement(2, 1, 2.0); // Set element (0,0) to 1.0\n\n    System.out.println(Matrix);\n\n    Matrix.Invert();\n\n    System.out.println(Matrix); \n  }\n}\n
"},{"location":"Java/Math/MatrixTranspose/","title":"MatrixTranspose","text":"

vtk-examples/Java/Math/MatrixTranspose

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Math/MatrixTranspose/#code","title":"Code","text":"

MatrixTranspose.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkMatrix3x3;\n\npublic class MatrixTranspose \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    // For a 3x3 matrices\n    vtkMatrix3x3 Matrix = new vtkMatrix3x3();\n\n    Matrix.SetElement(2, 1, 2.0); // Set element (0,0) to 1.0\n\n    System.out.println(Matrix);\n\n    Matrix.Transpose();\n\n    System.out.println(Matrix); \n  }\n}\n
"},{"location":"Java/Math/NormalizeVector/","title":"NormalizeVector","text":"

vtk-examples/Java/Math/NormalizeVector

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Math/NormalizeVector/#code","title":"Code","text":"

NormalizeVector.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkMath;\n\n\npublic class NormalizeVector\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    double a[] = new double[] {100.0, 2.0, 1.0};\n    System.out.println(a[0] + \" \" + a[1] + \" \" + a[2]);\n    vtkMath M = new vtkMath();\n    M.Normalize(a);\n    System.out.println(a[0] + \" \" + a[1] + \" \" + a[2]);\n  }\n}\n
"},{"location":"Java/Medical/MedicalDemo1/","title":"MedicalDemo1","text":"

vtk-examples/Java/Medical/MedicalDemo1

"},{"location":"Java/Medical/MedicalDemo1/#description","title":"Description","text":"

The skin extracted from a CT dataset of the head.

usage

MedicalDemo1 FullHead.mhd

Note

This original source code for this example is here.

Info

See Figure 12-2 in Chapter 12 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Medical/MedicalDemo1/#code","title":"Code","text":"

MedicalDemo1.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkMetaImageReader;\nimport vtk.vtkMarchingCubes;\nimport vtk.vtkOutlineFilter;\nimport vtk.vtkCamera;\n\n\npublic class MedicalDemo1 \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.mhd) e.g FullHead.mhd\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For skin  Color\n    double skinColor[] = new double[4];\n    //For outline Color\n    double outlineColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Coral\", skinColor);\n    colors.GetColor(\"Black\", outlineColor);\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkMetaImageReader reader = new vtkMetaImageReader();\n    reader.SetFileName(inputFilename);\n\n    // An isosurface, or contour value of 500 is known to correspond to the skin of the patient.\n    vtkMarchingCubes skinExtractor = new vtkMarchingCubes();\n    skinExtractor.SetInputConnection(reader.GetOutputPort());\n    skinExtractor.SetValue(0, 500);\n\n    vtkPolyDataMapper skinMapper = new vtkPolyDataMapper();\n    skinMapper.SetInputConnection(skinExtractor.GetOutputPort());\n    skinMapper.ScalarVisibilityOff();\n\n    vtkActor skin = new vtkActor();\n    skin.SetMapper(skinMapper);\n    skin.GetProperty().SetDiffuseColor(skinColor);\n\n    // An outline provides context around the data.\n    vtkOutlineFilter outlineData = new vtkOutlineFilter();\n    outlineData.SetInputConnection(reader.GetOutputPort());\n\n    vtkPolyDataMapper mapOutline = new vtkPolyDataMapper();\n    mapOutline.SetInputConnection(outlineData.GetOutputPort());\n\n    vtkActor outline = new vtkActor();\n    outline.SetMapper(mapOutline);\n    outline.GetProperty().SetColor(outlineColor);\n\n    // It is convenient to create an initial view of the data. \n    // The FocalPoint and Position form a vector direction. \n    // Later on (ResetCamera() method) this vector is used to position the camera to look at the data in this direction.\n\n    vtkCamera aCamera = new vtkCamera();\n    aCamera.SetViewUp (0, 0, -1);\n    aCamera.SetPosition (0, -1, 0);\n    aCamera.SetFocalPoint (0, 0, 0);\n    aCamera.ComputeViewPlaneNormal();\n    aCamera.Azimuth(30.0);\n    aCamera.Elevation(30.0);\n\n    // Actors are added to the renderer. An initial camera view is created.\n    // The Dolly() method moves the camera towards the FocalPoint, thereby enlarging the image.\n\n    ren.AddActor(outline);\n    ren.AddActor(skin);\n    ren.SetActiveCamera(aCamera);\n    ren.ResetCamera ();\n    aCamera.Dolly(1.0);\n\n    // Set a background color for the renderer and set the size of the\n    // render window (expressed in pixels).\n    ren.SetBackground(Bgcolor);\n\n    // Note that when camera movement occurs (as it does in the Dolly()\n    // method), the clipping planes often need adjusting. Clipping planes\n    // consist of two planes: near and far along the view direction. The\n    // near plane clips out objects in front of the plane; the far plane\n    // clips out objects behind the plane. This way only what is drawn\n    // between the planes is actually rendered.\n    ren.ResetCameraClippingRange ();\n\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Medical/MedicalDemo2/","title":"MedicalDemo2","text":"

vtk-examples/Java/Medical/MedicalDemo2

"},{"location":"Java/Medical/MedicalDemo2/#description","title":"Description","text":"

Skin and bone isosurfaces.

Usage

MedicalDemo2 FullHead.mhd

Note

This original source code for this example is here.

Info

See Figure 12-3 in Chapter 12 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Medical/MedicalDemo2/#code","title":"Code","text":"

MedicalDemo2.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkMetaImageReader;\nimport vtk.vtkMarchingCubes;\nimport vtk.vtkOutlineFilter;\nimport vtk.vtkCamera;\nimport vtk.vtkStripper;\n\npublic class MedicalDemo2\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.mhd) e.g FullHead.mhd\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For bone Color\n    double boneColor[] = new double[4];\n    //For skin  Color\n    double skinColor[] = new double[4];\n    //For outline Color\n    double outlineColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Ivory\", boneColor);\n    colors.GetColor(\"Coral\", skinColor);\n    colors.GetColor(\"Black\", outlineColor);\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // The following reader is used to read a series of 2D slices (images)\n    // that compose the volume. The slice dimensions are set, and the\n    // pixel spacing. The data Endianness must also be specified. The reader\n    // uses the FilePrefix in combination with the slice number to construct\n    // filenames using the format FilePrefix.%d. (In this case the FilePrefix\n    // is the root name of the file: quarter.)\n\n    vtkMetaImageReader reader = new vtkMetaImageReader();\n    reader.SetFileName(inputFilename);\n\n    // An isosurface, or contour value of 500 is known to correspond to the\n    // skin of the patient.\n    // The triangle stripper is used to create triangle strips from the\n    // isosurface; these render much faster on many systems.\n    vtkMarchingCubes skinExtractor = new vtkMarchingCubes();\n    skinExtractor.SetInputConnection(reader.GetOutputPort());\n    skinExtractor.SetValue(0, 500);\n\n    vtkStripper skinStripper = new  vtkStripper();\n    skinStripper.SetInputConnection(skinExtractor.GetOutputPort());\n\n    vtkPolyDataMapper skinMapper = new vtkPolyDataMapper();\n    skinMapper.SetInputConnection(skinStripper.GetOutputPort());\n    skinMapper.ScalarVisibilityOff();\n\n    vtkActor skin = new vtkActor();\n    skin.SetMapper(skinMapper);\n    skin.GetProperty().SetDiffuseColor(skinColor);\n    skin.GetProperty().SetSpecular(.3);\n    skin.GetProperty().SetSpecularPower(20);\n    skin.GetProperty().SetOpacity(.5);\n\n    // An isosurface, or contour value of 1150 is known to correspond to the\n    // bone of the patient.\n    // The triangle stripper is used to create triangle strips from the\n    // isosurface; these render much faster on may systems.\n    vtkMarchingCubes boneExtractor = new vtkMarchingCubes();\n    boneExtractor.SetInputConnection(reader.GetOutputPort());\n    boneExtractor.SetValue(0, 1150);\n\n    vtkStripper boneStripper = new vtkStripper();\n    boneStripper.SetInputConnection(boneExtractor.GetOutputPort());\n\n    vtkPolyDataMapper boneMapper = new vtkPolyDataMapper();\n    boneMapper.SetInputConnection(boneStripper.GetOutputPort());\n    boneMapper.ScalarVisibilityOff();\n\n    vtkActor bone = new vtkActor();\n    bone.SetMapper(boneMapper);\n    bone.GetProperty().SetDiffuseColor(boneColor);\n\n    // An outline provides context around the data.\n    vtkOutlineFilter outlineData = new vtkOutlineFilter();\n    outlineData.SetInputConnection(reader.GetOutputPort());\n\n    vtkPolyDataMapper mapOutline = new vtkPolyDataMapper();\n    mapOutline.SetInputConnection(outlineData.GetOutputPort());\n\n    vtkActor outline = new vtkActor();\n    outline.SetMapper(mapOutline);\n    outline.GetProperty().SetColor(outlineColor);\n\n    // It is convenient to create an initial view of the data. \n    // The FocalPoint and Position form a vector direction. \n    // Later on (ResetCamera() method) this vector is used to position the camera to look at the data in this direction.\n\n    vtkCamera aCamera = new vtkCamera();\n    aCamera.SetViewUp (0, 0, -1);\n    aCamera.SetPosition (0, -1, 0);\n    aCamera.SetFocalPoint (0, 0, 0);\n    aCamera.ComputeViewPlaneNormal();\n    aCamera.Azimuth(30.0);\n    aCamera.Elevation(30.0);\n\n    // Actors are added to the renderer. An initial camera view is created.\n    // The Dolly() method moves the camera towards the FocalPoint, thereby enlarging the image.\n\n    ren.AddActor(outline);\n    ren.AddActor(skin);\n    ren.AddActor(bone);\n    ren.SetActiveCamera(aCamera);\n    ren.ResetCamera ();\n    aCamera.Dolly(1.0);\n\n    // Set a background color for the renderer and set the size of the\n    // render window (expressed in pixels).\n    ren.SetBackground(Bgcolor);\n\n    // Note that when camera movement occurs (as it does in the Dolly()\n    // method), the clipping planes often need adjusting. Clipping planes\n    // consist of two planes: near and far along the view direction. The\n    // near plane clips out objects in front of the plane; the far plane\n    // clips out objects behind the plane. This way only what is drawn\n    // between the planes is actually rendered.\n    ren.ResetCameraClippingRange ();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Medical/MedicalDemo3/","title":"MedicalDemo3","text":"

vtk-examples/Java/Medical/MedicalDemo3

"},{"location":"Java/Medical/MedicalDemo3/#description","title":"Description","text":"

Composite image of three planes and translucent skin

Usage

MedicalDemo3 FullHead.mhd

Note

This original source code for this example is here.

Info

See Figure 12-4 in Chapter 12 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Medical/MedicalDemo3/#code","title":"Code","text":"

MedicalDemo3.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkMetaImageReader;\nimport vtk.vtkMarchingCubes;\nimport vtk.vtkOutlineFilter;\nimport vtk.vtkCamera;\nimport vtk.vtkStripper;\nimport vtk.vtkLookupTable;\nimport vtk.vtkImageMapToColors;\nimport vtk.vtkImageActor;\n\npublic class MedicalDemo3\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.mhd) e.g FullHead.mhd\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For bone Color\n    double boneColor[] = new double[4];\n    //For skin  Color\n    double skinColor[] = new double[4];\n    //For outline Color\n    double outlineColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Ivory\", boneColor);\n    colors.GetColor(\"Coral\", skinColor);\n    colors.GetColor(\"Black\", outlineColor);\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // The following reader is used to read a series of 2D slices (images)\n    // that compose the volume. The slice dimensions are set, and the\n    // pixel spacing. The data Endianness must also be specified. The reader\n    // uses the FilePrefix in combination with the slice number to construct\n    // filenames using the format FilePrefix.%d. (In this case the FilePrefix\n    // is the root name of the file: quarter.)\n\n    vtkMetaImageReader reader = new vtkMetaImageReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // An isosurface, or contour value of 500 is known to correspond to the\n    // skin of the patient.\n    // The triangle stripper is used to create triangle strips from the\n    // isosurface; these render much faster on many systems.\n    vtkMarchingCubes skinExtractor = new vtkMarchingCubes();\n    skinExtractor.SetInputConnection(reader.GetOutputPort());\n    skinExtractor.SetValue(0, 500);\n    skinExtractor.Update();\n\n    vtkStripper skinStripper = new  vtkStripper();\n    skinStripper.SetInputConnection(skinExtractor.GetOutputPort());\n    skinStripper.Update();\n\n    vtkPolyDataMapper skinMapper = new vtkPolyDataMapper();\n    skinMapper.SetInputConnection(skinStripper.GetOutputPort());\n    skinMapper.ScalarVisibilityOff();\n\n    vtkActor skin = new vtkActor();\n    skin.SetMapper(skinMapper);\n    skin.GetProperty().SetDiffuseColor(skinColor);\n    skin.GetProperty().SetSpecular(.3);\n    skin.GetProperty().SetSpecularPower(20);\n\n    // An isosurface, or contour value of 1150 is known to correspond to the\n    // bone of the patient.\n    // The triangle stripper is used to create triangle strips from the\n    // isosurface; these render much faster on may systems.\n    vtkMarchingCubes boneExtractor = new vtkMarchingCubes();\n    boneExtractor.SetInputConnection(reader.GetOutputPort());\n    boneExtractor.SetValue(0, 1150);\n\n    vtkStripper boneStripper = new vtkStripper();\n    boneStripper.SetInputConnection(boneExtractor.GetOutputPort());\n\n    vtkPolyDataMapper boneMapper = new vtkPolyDataMapper();\n    boneMapper.SetInputConnection(boneStripper.GetOutputPort());\n    boneMapper.ScalarVisibilityOff();\n\n    vtkActor bone = new vtkActor();\n    bone.SetMapper(boneMapper);\n    bone.GetProperty().SetDiffuseColor(boneColor);\n\n    // An outline provides context around the data.\n    vtkOutlineFilter outlineData = new vtkOutlineFilter();\n    outlineData.SetInputConnection(reader.GetOutputPort());\n\n    vtkPolyDataMapper mapOutline = new vtkPolyDataMapper();\n    mapOutline.SetInputConnection(outlineData.GetOutputPort());\n\n    vtkActor outline = new vtkActor();\n    outline.SetMapper(mapOutline);\n    outline.GetProperty().SetColor(outlineColor);\n\n    // Now we are creating three orthogonal planes passing through the volume. \n    // Each plane uses a different texture map and therefore has different coloration.\n    // Start by creating a black/white lookup table.\n\n    vtkLookupTable bwLut = new vtkLookupTable();\n    bwLut.SetTableRange (0, 2000);\n    bwLut.SetSaturationRange (0, 0);\n    bwLut.SetHueRange (0, 0);\n    bwLut.SetValueRange (0, 1);\n    bwLut.Build(); //effective built\n\n    // Now create a lookup table that consists of the full hue circle (from HSV).\n    vtkLookupTable hueLut = new vtkLookupTable();\n    hueLut.SetTableRange (0, 2000);\n    hueLut.SetHueRange (0, 1);\n    hueLut.SetSaturationRange (1, 1);\n    hueLut.SetValueRange (1, 1);\n    hueLut.Build(); //effective built\n\n    // Finally, create a lookup table with a single hue but having a range\n    // in the saturation of the hue.\n    vtkLookupTable satLut = new vtkLookupTable();\n    satLut.SetTableRange (0, 2000);\n    satLut.SetHueRange (.6, .6);\n    satLut.SetSaturationRange (0, 1);\n    satLut.SetValueRange (1, 1);\n    satLut.Build(); //effective built\n\n    // Create the first of the three planes. The filter vtkImageMapToColors\n    // maps the data through the corresponding lookup table created above.  The\n    // vtkImageActor is a type of vtkProp and conveniently displays an image on\n    // a single quadrilateral plane. It does this using texture mapping and as\n    // a result is quite fast. (Note: the input image has to be unsigned char\n    // values, which the vtkImageMapToColors produces.) Note also that by\n    // specifying the DisplayExtent, the pipeline requests data of this extent\n    // and the vtkImageMapToColors only processes a slice of data.\n\n    vtkImageMapToColors sagittalColors = new vtkImageMapToColors();\n    sagittalColors.SetInputConnection(reader.GetOutputPort());\n    sagittalColors.SetLookupTable(bwLut);\n    sagittalColors.Update();\n\n    vtkImageActor sagittal = new vtkImageActor();\n    sagittal.GetMapper().SetInputConnection(sagittalColors.GetOutputPort());\n    sagittal.SetDisplayExtent(128, 128, 0,255, 0,92);\n    sagittal.ForceOpaqueOn();\n\n    // Create the second (axial) plane of the three planes. We use the\n    // same approach as before except that the extent differs.\n    vtkImageMapToColors axialColors = new vtkImageMapToColors();\n    axialColors.SetInputConnection(reader.GetOutputPort());\n    axialColors.SetLookupTable(hueLut);\n    axialColors.Update();\n\n    vtkImageActor axial = new vtkImageActor();\n    axial.GetMapper().SetInputConnection(axialColors.GetOutputPort());\n    axial.SetDisplayExtent(0,255, 0,255, 46,46);\n    axial.ForceOpaqueOn();\n\n    // Create the third (coronal) plane of the three planes. We use\n    // the same approach as before except that the extent differs.\n    vtkImageMapToColors coronalColors = new vtkImageMapToColors();\n    coronalColors.SetInputConnection(reader.GetOutputPort());\n    coronalColors.SetLookupTable(satLut);\n    coronalColors.Update();\n\n    vtkImageActor coronal = new vtkImageActor();\n    coronal.GetMapper().SetInputConnection(coronalColors.GetOutputPort());\n    coronal.SetDisplayExtent(0,255, 128,128, 0,92);\n    coronal.ForceOpaqueOn();\n\n    // It is convenient to create an initial view of the data. \n    // The FocalPoint and Position form a vector direction. \n    // Later on (ResetCamera() method) this vector is used to position the camera to look at the data in this direction.\n\n    vtkCamera aCamera = new vtkCamera();\n    aCamera.SetViewUp (0, 0, -1);\n    aCamera.SetPosition (0, -1, 0);\n    aCamera.SetFocalPoint (0, 0, 0);\n    aCamera.ComputeViewPlaneNormal();\n    aCamera.Azimuth(30.0);\n    aCamera.Elevation(30.0);\n\n    // Actors are added to the renderer. An initial camera view is created.\n    // The Dolly() method moves the camera towards the FocalPoint, thereby enlarging the image.\n\n    ren.AddActor(outline);\n    ren.AddActor(sagittal);\n    ren.AddActor(axial);\n    ren.AddActor(coronal);\n    ren.AddActor(skin);\n    ren.AddActor(bone);\n    ren.SetActiveCamera(aCamera);\n    ren.ResetCamera ();\n    aCamera.Dolly(1.0);\n\n    // Turn off bone for this example.\n    bone.VisibilityOff();\n\n    // Set skin to semi-transparent.\n    skin.GetProperty().SetOpacity(0.5);\n\n    // Set a background color for the renderer and set the size of the\n    // render window (expressed in pixels).\n    ren.SetBackground(Bgcolor);\n\n    // Note that when camera movement occurs (as it does in the Dolly()\n    // method), the clipping planes often need adjusting. Clipping planes\n    // consist of two planes: near and far along the view direction. The\n    // near plane clips out objects in front of the plane; the far plane\n    // clips out objects behind the plane. This way only what is drawn\n    // between the planes is actually rendered.\n    ren.ResetCameraClippingRange ();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Medical/MedicalDemo4/","title":"MedicalDemo4","text":"

vtk-examples/Java/Medical/MedicalDemo4

"},{"location":"Java/Medical/MedicalDemo4/#description","title":"Description","text":"

Volume rendering of the dataset.

Usage

MedicalDemo4 FullHead.mhd

Note

This original source code for this example is here.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Medical/MedicalDemo4/#code","title":"Code","text":"

MedicalDemo4.java

import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkMetaImageReader;\nimport vtk.vtkCamera;\nimport vtk.vtkColorTransferFunction;\nimport vtk.vtkPiecewiseFunction;\nimport vtk.vtkFixedPointVolumeRayCastMapper;\nimport vtk.vtkVolumeProperty;\nimport vtk.vtkVolume;\n\npublic class MedicalDemo4 \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.mhd) e.g FullHead.mhd\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // The following reader is used to read a series of 2D slices (images)\n    // that compose the volume. The slice dimensions are set, and the\n    // pixel spacing. The data Endianness must also be specified. The reader\n    // uses the FilePrefix in combination with the slice number to construct\n    // filenames using the format FilePrefix.%d. (In this case the FilePrefix\n    // is the root name of the file: quarter.)\n\n    vtkMetaImageReader reader = new vtkMetaImageReader();\n    reader.SetFileName(inputFilename);\n\n    // The volume will be displayed by ray-cast alpha compositing.\n    // A ray-cast mapper is needed to do the ray-casting.\n    vtkFixedPointVolumeRayCastMapper volumeMapper = new vtkFixedPointVolumeRayCastMapper();\n    volumeMapper.SetInputConnection(reader.GetOutputPort());\n\n    // The color transfer function maps voxel intensities to colors.\n    // It is modality-specific, and often anatomy-specific as well.\n    // The goal is to one color for flesh (between 500 and 1000)\n    // and another color for bone (1150 and over).\n    vtkColorTransferFunction volumeColor = new vtkColorTransferFunction();\n    volumeColor.AddRGBPoint(0,    0.0, 0.0, 0.0);\n    volumeColor.AddRGBPoint(500,  1.0, 0.5, 0.3);\n    volumeColor.AddRGBPoint(1000, 1.0, 0.5, 0.3);\n    volumeColor.AddRGBPoint(1150, 1.0, 1.0, 0.9);\n\n    // The opacity transfer function is used to control the opacity\n    // of different tissue types.\n    vtkPiecewiseFunction volumeScalarOpacity = new vtkPiecewiseFunction();\n    volumeScalarOpacity.AddPoint(0,    0.00);\n    volumeScalarOpacity.AddPoint(500,  0.15);\n    volumeScalarOpacity.AddPoint(1000, 0.15);\n    volumeScalarOpacity.AddPoint(1150, 0.85);\n\n    // The gradient opacity function is used to decrease the opacity\n    // in the \"flat\" regions of the volume while maintaining the opacity\n    // at the boundaries between tissue types.  The gradient is measured\n    // as the amount by which the intensity changes over unit distance.\n    // For most medical data, the unit distance is 1mm.\n    vtkPiecewiseFunction volumeGradientOpacity = new vtkPiecewiseFunction();\n    volumeGradientOpacity.AddPoint(0,   0.0);\n    volumeGradientOpacity.AddPoint(90,  0.5);\n    volumeGradientOpacity.AddPoint(100, 1.0);\n\n    // The VolumeProperty attaches the color and opacity functions to the\n    // volume, and sets other volume properties.  The interpolation should\n    // be set to linear to do a high-quality rendering.  The ShadeOn option\n    // turns on directional lighting, which will usually enhance the\n    // appearance of the volume and make it look more \"3D\".  However,\n    // the quality of the shading depends on how accurately the gradient\n    // of the volume can be calculated, and for noisy data the gradient\n    // estimation will be very poor.  The impact of the shading can be\n    // decreased by increasing the Ambient coefficient while decreasing\n    // the Diffuse and Specular coefficient.  To increase the impact\n    // of shading, decrease the Ambient and increase the Diffuse and Specular.\n    vtkVolumeProperty volumeProperty = new vtkVolumeProperty();\n    volumeProperty.SetColor(volumeColor);\n    volumeProperty.SetScalarOpacity(volumeScalarOpacity);\n    volumeProperty.SetGradientOpacity(volumeGradientOpacity);\n    volumeProperty.SetInterpolationTypeToLinear();\n    volumeProperty.ShadeOn();\n    volumeProperty.SetAmbient(0.4);\n    volumeProperty.SetDiffuse(0.6);\n    volumeProperty.SetSpecular(0.2);\n\n    // The vtkVolume is a vtkProp3D (like a vtkActor) and controls the position\n    // and orientation of the volume in world coordinates.\n    vtkVolume volume = new vtkVolume();\n    volume.SetMapper(volumeMapper);\n    volume.SetProperty(volumeProperty);\n    double c[] = new double[3];\n    c=volume.GetCenter();\n\n    ren.AddViewProp(volume);\n\n    // Set up an initial view of the volume.  The focal point will be the\n    // center of the volume, and the camera position will be 400mm to the\n    // patient's left (which is our right).\n\n    vtkCamera camera = new vtkCamera();\n    camera.SetViewUp (0, 0, -1);\n    camera.SetPosition (c[0], c[1] - 400, c[2]);\n    camera.SetFocalPoint (c[0], c[1], c[2]);\n    camera.Azimuth(30.0);\n    camera.Elevation(30.0);\n    camera.Dolly(0.75);\n\n    // Actors are added to the renderer. An initial camera view is created.\n    // The Dolly() method moves the camera towards the FocalPoint, thereby enlarging the image.\n\n    ren.SetActiveCamera(camera);\n\n    // Set a background color for the renderer and set the size of the\n    // render window (expressed in pixels).\n    ren.SetBackground(Bgcolor);\n\n    // Note that when camera movement occurs (as it does in the Dolly()\n    // method), the clipping planes often need adjusting. Clipping planes\n    // consist of two planes: near and far along the view direction. The\n    // near plane clips out objects in front of the plane; the far plane\n    // clips out objects behind the plane. This way only what is drawn\n    // between the planes is actually rendered.\n    ren.ResetCameraClippingRange ();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Meshes/AddCell/","title":"AddCell","text":"

vtk-examples/Java/Meshes/AddCell

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Meshes/AddCell/#code","title":"Code","text":"

AddCell.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkTriangle;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\n\npublic class AddCell\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //  Create a triangle\n    vtkPoints points = new vtkPoints();\n    points.InsertNextPoint ( 1.0, 0.0, 0.0 );\n    points.InsertNextPoint ( 0.0, 0.0, 0.0 );\n    points.InsertNextPoint ( 0.0, 1.0, 0.0 );\n\n    vtkTriangle triangle = new vtkTriangle();\n    triangle.GetPointIds().SetId ( 0, 0 );\n    triangle.GetPointIds().SetId ( 1, 1 );\n    triangle.GetPointIds().SetId ( 2, 2 );\n\n    vtkCellArray triangles = new vtkCellArray();\n    triangles.InsertNextCell ( triangle );\n\n    // Create a polydata object\n    vtkPolyData polyData = new vtkPolyData();\n\n    // Add the geometry and topology to the polydata\n    polyData.SetPoints ( points );\n    polyData.SetPolys ( triangles );\n\n    System.out.println(\"There are \" + \" \" + polyData.GetNumberOfCells() + \" \" + \"cells.\");\n    polyData.GetPolys().InsertNextCell(triangle);\n    System.out.println(\"There are \" + \" \" + polyData.GetNumberOfCells() + \" \" + \"cells.\");\n\n  }\n}\n
"},{"location":"Java/Meshes/BoundaryEdges/","title":"BoundaryEdges","text":"

vtk-examples/Java/Meshes/BoundaryEdges

"},{"location":"Java/Meshes/BoundaryEdges/#description","title":"Description","text":"

vtkFeatureEdges object is a filter to extract special types of edges from input polygonal data.

These edges are either 1) boundary (used by one polygon) or a line cell 2) non-manifold (used by three or more polygons) 3) feature edges (edges used by two triangles and whose dihedral angle > FeatureAngle) or 4) manifold edges (edges used by exactly two polygons).

Edges may also be \"colored\" (i.e., scalar values assigned) based on edge type. The cell coloring is assigned to the cell data of the extracted edges.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Meshes/BoundaryEdges/#code","title":"Code","text":"

BoundaryEdges.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkDiskSource;\nimport vtk.vtkFeatureEdges;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\n\n\npublic class BoundaryEdges\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4]; \n\n    colors.GetColor(\"DarkSeaGreen\", Bgcolor);\n\n    vtkDiskSource diskSource = new vtkDiskSource();\n    diskSource.Update();\n    vtkFeatureEdges featureEdges = new vtkFeatureEdges();\n    featureEdges.SetInputConnection(diskSource.GetOutputPort());\n    featureEdges.BoundaryEdgesOn();\n    featureEdges.FeatureEdgesOff();\n    featureEdges.ManifoldEdgesOff();\n    featureEdges.NonManifoldEdgesOff();\n    featureEdges.Update();\n\n    //Visualize the Actor\n    vtkPolyDataMapper edgeMapper = new vtkPolyDataMapper();\n    edgeMapper.SetInputConnection(featureEdges.GetOutputPort());\n    vtkActor edgeActor = new vtkActor();\n    edgeActor.SetMapper(edgeMapper);\n\n    vtkPolyDataMapper diskMapper = new vtkPolyDataMapper();\n    diskMapper.SetInputConnection(diskSource.GetOutputPort());\n    vtkActor diskActor = new vtkActor();\n    diskActor.SetMapper(diskMapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(diskActor);\n    ren.AddActor(edgeActor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Modelling/Bottle/","title":"Bottle","text":"

vtk-examples/Java/Modelling/Bottle

"},{"location":"Java/Modelling/Bottle/#description","title":"Description","text":"

vtkRotationalExtrusionFilter object is a modeling filter.

It takes polygonal data as input and generates polygonal data on output. The input dataset is swept around the z-axis to create new polygonal primitives.

These primitives form a \"skirt\" or swept surface. For example, sweeping a line results in a cylindrical shell, and sweeping a circle creates a torus.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Modelling/Bottle/#code","title":"Code","text":"

Bottle.java

import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPoints;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkRotationalExtrusionFilter;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkActor;\nimport vtk.vtkStripper;\nimport vtk.vtkTubeFilter;\n\n\npublic class Bottle\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\npublic static void main(String args[]) \n{\n\n  vtkNamedColors colors = new vtkNamedColors(); \n\n  //Bottle Actor Color\n  double Bottlecolor[] = new double[4]; \n  colors.GetColor(\"Mint\", Bottlecolor);\n  //ProfileActor Color\n  double ProfileActorcolor[] = new double[4]; \n  colors.GetColor(\"Tomato\", ProfileActorcolor);\n  //Renderer Background Color\n  double Bgcolor[] = new double[4]; \n  colors.GetColor(\"Burlywood\", Bgcolor);\n\n  //Create the renderer, render window and interactor.\n  vtkRenderer ren = new vtkRenderer();\n  vtkRenderWindow renWin = new vtkRenderWindow();\n  renWin.AddRenderer(ren);\n  vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n  iren.SetRenderWindow(renWin);\n\n  //create bottle profile\n\n  vtkPoints points = new vtkPoints();\n  points.InsertPoint(0, 0.01, 0.0, 0.0);\n  points.InsertPoint(1, 1.5, 0.0, 0.0);\n  points.InsertPoint(2, 1.5, 0.0, 3.5);\n  points.InsertPoint(3, 1.25, 0.0, 3.75);\n  points.InsertPoint(4, 0.75, 0.0, 4.00);\n  points.InsertPoint(5, 0.6, 0.0, 4.35);\n  points.InsertPoint(6, 0.7, 0.0, 4.65);\n  points.InsertPoint(7, 1.0, 0.0, 4.75);\n  points.InsertPoint(8, 1.0, 0.0, 5.0);\n  points.InsertPoint(9, 0.2, 0.0, 5.0);\n\n  vtkCellArray lines = new vtkCellArray();\n  lines.InsertNextCell(10);//number of points\n  lines.InsertCellPoint(0);\n  lines.InsertCellPoint(1);\n  lines.InsertCellPoint(2);\n  lines.InsertCellPoint(3);\n  lines.InsertCellPoint(4);\n  lines.InsertCellPoint(5);\n  lines.InsertCellPoint(6);\n  lines.InsertCellPoint(7);\n  lines.InsertCellPoint(8);\n  lines.InsertCellPoint(9);\n\n  vtkPolyData profile = new vtkPolyData();\n  profile.SetPoints(points);\n  profile.SetLines(lines);\n\n  //extrude profile to make bottle\n\n  vtkRotationalExtrusionFilter extrude = new vtkRotationalExtrusionFilter();\n  extrude.SetInputData(profile);\n  extrude.SetResolution(60);\n\n  vtkPolyDataMapper map = new vtkPolyDataMapper();\n  map.SetInputConnection(extrude.GetOutputPort());\n\n  vtkActor bottle = new vtkActor();\n  bottle.SetMapper(map);\n  bottle.GetProperty().SetColor(Bottlecolor);\n\n  //display the profile\n  vtkStripper stripper = new vtkStripper();\n  stripper.SetInputData(profile);\n\n  vtkTubeFilter tubes = new vtkTubeFilter();\n  tubes.SetInputConnection(stripper.GetOutputPort());\n  tubes.SetNumberOfSides(11);\n  tubes.SetRadius(.05);\n\n  vtkPolyDataMapper profileMapper = new vtkPolyDataMapper();\n  profileMapper.SetInputConnection(tubes.GetOutputPort());\n\n  vtkActor profileActor = new vtkActor();\n  profileActor.SetMapper(profileMapper);\n  profileActor.GetProperty().SetColor(ProfileActorcolor);\n\n  //Add the actors to the renderer, set the background and size\n  ren.AddActor(bottle);\n  ren.AddActor(profileActor);\n  ren.SetBackground(Bgcolor);\n\n  renWin.SetSize(640,480);\n  renWin.Render();\n\n  ren.GetActiveCamera().SetPosition(1, 0, 0);\n  ren.GetActiveCamera().SetFocalPoint(0, 0, 0);\n  ren.GetActiveCamera().SetViewUp(0, 0, 1);\n  ren.ResetCamera();\n  ren.GetActiveCamera().Azimuth(30);\n  ren.GetActiveCamera().Elevation(30);\n\n  iren.Initialize();\n  iren.Start();\n\n }\n}\n
"},{"location":"Java/Modelling/DelaunayMesh/","title":"DelaunayMesh","text":"

vtk-examples/Java/Modelling/DelaunayMesh

"},{"location":"Java/Modelling/DelaunayMesh/#description","title":"Description","text":"

This is two dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlited with spheres and tubes.

Info

See Figure 9-54 in Chapter 9 The VTK Textbook.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Modelling/DelaunayMesh/#code","title":"Code","text":"

DelaunayMesh.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPoints;\nimport vtk.vtkMinimalStandardRandomSequence;\nimport vtk.vtkPolyData;\nimport vtk.vtkDelaunay2D;\nimport vtk.vtkExtractEdges;\nimport vtk.vtkTubeFilter;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkSphereSource;\n\npublic class DelaunayMesh \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For mesh Actor Color\n    double meshActorColor[] = new double[4];\n    //For edge Actor Color\n    double edgeActorColor[] = new double[4];\n    //For ball Actor Color\n    double ballActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change mesh Actor Color\n    Color.GetColor(\"MidnightBlue\",meshActorColor);\n    //Change Color Name to Use your own Color for Change edge Actor Color\n    Color.GetColor(\"Peacock\",edgeActorColor);\n    //Change Color Name to Use your own Color for Change ball Actor Color\n    Color.GetColor(\"hot_pink\",ballActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"AliceBlue\",BgColor);\n\n    //Generate some \"random\" points.\n    vtkPoints points = new vtkPoints();\n    vtkMinimalStandardRandomSequence randomSequence = new vtkMinimalStandardRandomSequence();\n    randomSequence.SetSeed(1);\n    double p1;\n    double p2;\n    for (int i = 0; i < 50; ++i)\n    {\n      p1 = randomSequence.GetValue();\n      randomSequence.Next();\n      p2 = randomSequence.GetValue();\n      randomSequence.Next();\n      points.InsertPoint(i, p1, p2, 0.0);\n    }\n\n    //Create a polydata with the points we just created.\n    vtkPolyData profile = new vtkPolyData();\n    profile.SetPoints(points);\n\n    //Perform a 2D Delaunay triangulation on them.\n    vtkDelaunay2D delny = new vtkDelaunay2D();\n    delny.SetInputData(profile);\n    delny.SetTolerance(0.001);\n    vtkPolyDataMapper mapMesh = new vtkPolyDataMapper();\n    mapMesh.SetInputConnection(delny.GetOutputPort());\n\n    vtkActor meshActor = new vtkActor();\n    meshActor.SetMapper(mapMesh);\n    meshActor.GetProperty().SetColor(meshActorColor);\n\n    // We will now create a nice looking mesh by wrapping the edges in tubes,\n    // and putting fat spheres at the points.\n    vtkExtractEdges extract = new vtkExtractEdges();\n    extract.SetInputConnection(delny.GetOutputPort());\n\n    vtkTubeFilter tubes = new vtkTubeFilter();\n    tubes.SetInputConnection(extract.GetOutputPort());\n    tubes.SetRadius(0.01);\n    tubes.SetNumberOfSides(6);\n\n    vtkPolyDataMapper mapEdges = new vtkPolyDataMapper();\n    mapEdges.SetInputConnection(tubes.GetOutputPort());\n\n    vtkActor edgeActor = new vtkActor();\n    edgeActor.SetMapper(mapEdges);\n    edgeActor.GetProperty().SetColor(edgeActorColor);\n    edgeActor.GetProperty().SetSpecularColor(1, 1, 1);\n    edgeActor.GetProperty().SetSpecular(0.3);\n    edgeActor.GetProperty().SetSpecularPower(20);\n    edgeActor.GetProperty().SetAmbient(0.2);\n    edgeActor.GetProperty().SetDiffuse(0.8);\n\n    vtkSphereSource ball = new vtkSphereSource();\n    ball.SetRadius(0.025);\n    ball.SetThetaResolution(12);\n    ball.SetPhiResolution(12);\n\n    vtkGlyph3D balls = new vtkGlyph3D();\n    balls.SetInputConnection(delny.GetOutputPort());\n    balls.SetSourceConnection(ball.GetOutputPort());\n\n    vtkPolyDataMapper mapBalls = new vtkPolyDataMapper();\n    mapBalls.SetInputConnection(balls.GetOutputPort());\n\n    vtkActor ballActor = new vtkActor();\n    ballActor.SetMapper(mapBalls);\n    ballActor.GetProperty().SetColor(ballActorColor);\n    ballActor.GetProperty().SetSpecularColor(1, 1, 1);\n    ballActor.GetProperty().SetSpecular(0.3);\n    ballActor.GetProperty().SetSpecularPower(20);\n    ballActor.GetProperty().SetAmbient(0.2);\n    ballActor.GetProperty().SetDiffuse(0.8);\n\n    //  Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(ballActor);\n    ren.AddActor(edgeActor);\n\n    ren.ResetCamera();\n    ren.GetActiveCamera().Zoom(1.3);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Modelling/Spring/","title":"Spring","text":"

vtk-examples/Java/Modelling/Spring

"},{"location":"Java/Modelling/Spring/#description","title":"Description","text":"

vtkRotationalExtrusionFilter object is a modeling filter.

It takes polygonal data as input and generates polygonal data on output. The input dataset is swept around the z-axis to create new polygonal primitives.

These primitives form a \"skirt\" or swept surface. For example, sweeping a line results in a cylindrical shell, and sweeping a circle creates a torus.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Modelling/Spring/#code","title":"Code","text":"

Spring.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPoints;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkRotationalExtrusionFilter;\nimport vtk.vtkPolyDataNormals;\n\n\n\npublic class Spring\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"PowderBlue\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Burlywood\",BgColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //create spring profile (a circle)\n\n    vtkPoints points = new vtkPoints();\n    points.InsertPoint(0, 1.0, 0.0, 0.0);\n    points.InsertPoint(1, 1.0732, 0.0, -0.1768);\n    points.InsertPoint(2, 1.25, 0.0, -0.25);\n    points.InsertPoint(3, 1.4268, 0.0, -0.1768);\n    points.InsertPoint(4, 1.5, 0.0, 0.00);\n    points.InsertPoint(5, 1.4268, 0.0, 0.1768);\n    points.InsertPoint(6, 1.25, 0.0, 0.25);\n    points.InsertPoint(7, 1.0732, 0.0, 0.1768);\n\n    vtkCellArray poly = new vtkCellArray();\n    poly.InsertNextCell(8);//number of points\n    poly.InsertCellPoint(0);\n    poly.InsertCellPoint(1);\n    poly.InsertCellPoint(2);\n    poly.InsertCellPoint(3);\n    poly.InsertCellPoint(4);\n    poly.InsertCellPoint(5);\n    poly.InsertCellPoint(6);\n    poly.InsertCellPoint(7);\n\n    vtkPolyData profile = new vtkPolyData();\n    profile.SetPoints(points);\n    profile.SetPolys(poly);\n\n    //extrude profile to make spring\n    vtkRotationalExtrusionFilter extrude = new vtkRotationalExtrusionFilter();\n    extrude.SetInputData(profile);\n    extrude.SetResolution(360);\n    extrude.SetTranslation(6);\n    extrude.SetDeltaRadius(1.0);\n    extrude.SetAngle(2160.0);//six revolutions\n\n    vtkPolyDataNormals normals = new vtkPolyDataNormals();\n    normals.SetInputConnection(extrude.GetOutputPort());\n    normals.SetFeatureAngle(60);\n\n    vtkPolyDataMapper map = new vtkPolyDataMapper();\n    map.SetInputConnection(normals.GetOutputPort());\n\n    vtkActor spring = new vtkActor();\n    spring.SetMapper(map);\n    spring.GetProperty().SetColor(ActorColor);\n    spring.GetProperty().SetDiffuse(0.7);\n    spring.GetProperty().SetSpecular(0.4);\n    spring.GetProperty().SetSpecularPower(20);\n    spring.GetProperty().BackfaceCullingOn();\n\n    ren.AddActor(spring);\n    ren.SetBackground(BgColor);\n\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(90);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Parallel/ExodusIIWriter/","title":"ExodusIIWriter","text":"

vtk-examples/Java/Parallel/ExodusIIWriter

"},{"location":"Java/Parallel/ExodusIIWriter/#description","title":"Description","text":"

Example Program to Demonstrate the usage of vtkExodusIIWriter - a vtkWriter that writes it's vtkUnstructuredGrid input to an Exodus II file Exodus files contain much information that is not captured in a vtkUnstructuredGrid, such as time steps, information lines, node sets, and side sets.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Parallel/ExodusIIWriter/#code","title":"Code","text":"

ExodusIIWriter.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkExodusIIWriter;\nimport vtk.vtkTimeSourceExample;\n\npublic class ExodusIIWriter \n{\n// -----------------------------------------------------------------\n// Load VTK library and print which library was not properly loaded\nstatic \n{\n  if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n  {\n    for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n    {\n      if (!lib.IsLoaded()) \n      { \n        System.out.println(lib.GetLibraryName() + \" not loaded\");\n      }\n    }\n  }\n  vtkNativeLibrary.DisableOutputWindow(null);\n}\n// -----------------------------------------------------------------\n\npublic static void main(String args[]) \n{                   \n  // Provide default values.\n  String fileName = \"Output.exii\";\n  for(int i = 0; i < args.length; ++i)\n  {\n    switch (i) \n    {\n      case 0:\n      fileName = args[i];\n      break;\n\n    }\n  }\n  vtkTimeSourceExample TimeSource = new vtkTimeSourceExample();\n  vtkExodusIIWriter ExodusWriter = new vtkExodusIIWriter();\n  ExodusWriter.SetFileName(fileName);\n  ExodusWriter.SetInputConnection(TimeSource.GetOutputPort());\n  ExodusWriter.WriteAllTimeStepsOn();\n  ExodusWriter.Write();\n }        \n}\n
"},{"location":"Java/Points/FitImplicitFunction/","title":"FitImplicitFunction","text":"

vtk-examples/Java/Points/FitImplicitFunction

"},{"location":"Java/Points/FitImplicitFunction/#description","title":"Description","text":"

vtkFitImplicitFunction object extracts the points that are on the surface of an implicit function (within some threshold).

Implicit functions in VTK are any function of the form f(x,y,z)=c, where values c==0 are considered the surface of the implicit function.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Points/FitImplicitFunction/#code","title":"Code","text":"

FitImplicitFunction.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkMath;\nimport vtk.vtkNamedColors;\nimport vtk.vtkBoundedPointSource;\nimport vtk.vtkSphere;\nimport vtk.vtkFitImplicitFunction;\nimport vtk.vtkSphereSource;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\n\n\npublic class FitImplicitFunction \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Renderer Background Color\n    double glyph3DActorcolor[] = new double[4];\n\n    //For Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Gray\",Bgcolor);\n\n    //Change Color Name to Use your own Color for Actor\n    Color.GetColor(\"Yellow\",glyph3DActorcolor);\n\n    vtkMath RS = new vtkMath();\n    RS.RandomSeed(4355412);\n    double radius = 1.0;\n\n    vtkBoundedPointSource points = new vtkBoundedPointSource();\n    points.SetNumberOfPoints(1000000);\n    points.SetBounds(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0);\n\n    vtkSphere sphere = new vtkSphere();\n    sphere.SetRadius(radius);\n\n    vtkFitImplicitFunction fit = new vtkFitImplicitFunction();\n    fit.SetInputConnection(points.GetOutputPort());\n    fit.SetImplicitFunction(sphere);\n    fit.SetThreshold(.01);\n    fit.Update();\n    System.out.println(fit.GetOutput().GetNumberOfPoints() + \" \" + \"out of\" + \" \" + points.GetNumberOfPoints() + \" \" + \"points are within\" + \" \" + fit.GetThreshold() + \" \" + \"of the implicit function\");  \n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetRadius(radius * .05);\n\n    vtkGlyph3D glyph3D = new vtkGlyph3D();\n    glyph3D.SetInputConnection(fit.GetOutputPort());\n    glyph3D.SetSourceConnection(sphereSource.GetOutputPort());\n    glyph3D.ScalingOff();\n    glyph3D.Update();\n\n    vtkPolyDataMapper glyph3DMapper = new vtkPolyDataMapper();\n    glyph3DMapper.SetInputConnection(glyph3D.GetOutputPort());\n\n    vtkActor glyph3DActor = new vtkActor();\n    glyph3DActor.SetMapper(glyph3DMapper);\n    glyph3DActor.GetProperty().SetColor(glyph3DActorcolor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(glyph3DActor);\n\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(120);\n    ren.GetActiveCamera().Elevation(30);\n    ren.GetActiveCamera().Dolly(1.0);\n    ren.ResetCameraClippingRange();\n\n    ren.SetBackground(Bgcolor);\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/PolyData/CellCenters/","title":"CellCenters","text":"

vtk-examples/Java/PolyData/CellCenters

"},{"location":"Java/PolyData/CellCenters/#description","title":"Description","text":"

vtkCellCenters is a filter that takes as input any dataset and generates on output points at the center of the cells in the dataset.

These points can be used for placing glyphs (vtkGlyph3D) or labeling.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/CellCenters/#code","title":"Code","text":"

CellCenters.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageData;\nimport vtk.vtkCellCenters;\nimport vtk.vtkDataSetMapper;\n\n\npublic class CellCenters \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {  \n    // Create an image data\n    vtkImageData imageData = new vtkImageData();\n\n    // Specify the size of the image data\n    imageData.SetDimensions(3,3,2);\n    imageData.SetSpacing(1.0, 1.0, 1.0);\n    imageData.SetOrigin(0.0, 0.0, 0.0);\n\n    vtkCellCenters cellCentersFilter = new vtkCellCenters();\n    cellCentersFilter.SetInputData(imageData);\n    cellCentersFilter.VertexCellsOn();\n    cellCentersFilter.Update();\n\n    // Access the cell centers\n    for(int i = 0; i < cellCentersFilter.GetOutput().GetNumberOfPoints(); i++)\n    {\n      double p[] = new double[3];\n      cellCentersFilter.GetOutput().GetPoint(i, p);\n      System.out.print(\"Point \" + \" \" + i + \" : \" + \" \" +  p[0] + \" , \" + p[1] + \" , \" + p[2] + \"\\n\"); \n    }\n\n    // Display the cell centers\n    vtkDataSetMapper centerMapper = new vtkDataSetMapper();\n    centerMapper.SetInputConnection(cellCentersFilter.GetOutputPort());\n\n    vtkActor centerActor = new vtkActor();\n    centerActor.SetMapper(centerMapper);\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputData(imageData);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetRepresentationToWireframe();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(actor);\n    ren.AddActor(centerActor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/PolyData/CenterOfMass/","title":"CenterOfMass","text":"

vtk-examples/Java/PolyData/CenterOfMass

"},{"location":"Java/PolyData/CenterOfMass/#description","title":"Description","text":"

vtkCenterOfMass object finds the \"center of mass\" of a vtkPointSet (vtkPolyData or vtkUnstructuredGrid).

Optionally, the user can specify to use the scalars as weights in the computation.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/CenterOfMass/#code","title":"Code","text":"

CenterOfMass.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkCenterOfMass;\nimport vtk.vtkPolyData;\nimport vtk.vtkPoints;\n\npublic class CenterOfMass \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {  \n    vtkPoints points = new vtkPoints();\n    points.InsertNextPoint(0,0,0);\n    points.InsertNextPoint(1,0,0);\n    points.InsertNextPoint(0,1,0);\n    points.InsertNextPoint(1,1,0);\n\n    vtkPolyData polydata = new vtkPolyData();\n    polydata.SetPoints(points);\n\n    // Compute the center of mass\n    vtkCenterOfMass centerOfMassFilter = new vtkCenterOfMass();\n    centerOfMassFilter.SetInputData(polydata);\n    centerOfMassFilter.SetUseScalarsAsWeights(false);\n    centerOfMassFilter.Update();\n\n    double center[] = new double[3];\n    center = centerOfMassFilter.GetCenter();\n    System.out.print(\"Center of mass is \" + \" \" + center[0] + \" \" + center[1] + \" \" + center[2]);\n  }\n}\n
"},{"location":"Java/PolyData/ColorCells/","title":"ColorCells","text":"

vtk-examples/Java/PolyData/ColorCells

"},{"location":"Java/PolyData/ColorCells/#description","title":"Description","text":"

This example shows how to assign specific colors to individual cells of a vtkPolyData using a vtkLookupTable. The vtkCellData has a vtkFloatArray that contains a scalar values.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/ColorCells/#code","title":"Code","text":"

ColorCells.java

import vtk.vtkActor;\nimport vtk.vtkFloatArray;\nimport vtk.vtkLookupTable;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPlaneSource;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class ColorCells {\n  private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n    // Provide some geometry\n    int xResolution = 3;\n    int yResolution = 3;\n\n    vtkPlaneSource aPlane = new vtkPlaneSource();\n    aPlane.SetXResolution(xResolution);\n    aPlane.SetYResolution(yResolution);\n\n    // Create cell data\n    vtkFloatArray cellData = new vtkFloatArray();\n    for (int i = 0; i < xResolution * yResolution; i++) {\n      cellData.InsertNextValue(i + 1);\n    }\n\n    // Fill in a few known colors, the rest will be generated if needed\n    vtkNamedColors color = new vtkNamedColors();\n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    color.GetColor(\"DarkGray\", BgColor);\n\n    // Assign some colors to an array\n    double[][] tableColors = new double[11][4];\n    color.GetColor(\"Black\", tableColors[0]);\n    color.GetColor(\"Banana\", tableColors[1]);\n    color.GetColor(\"Tomato\", tableColors[2]);\n    color.GetColor(\"Wheat\", tableColors[3]);\n    color.GetColor(\"Lavender\", tableColors[4]);\n    color.GetColor(\"Flesh\", tableColors[5]);\n    color.GetColor(\"Raspberry\", tableColors[6]);\n    color.GetColor(\"Salmon\", tableColors[7]);\n    color.GetColor(\"Mint\", tableColors[8]);\n    color.GetColor(\"Peacock\", tableColors[9]);\n    color.GetColor(\"DarkGray\", tableColors[10]);\n\n    // Create a lookup table to map cell data to colors\n    vtkLookupTable lut = new vtkLookupTable();\n    int tableSize = Math.max(xResolution * yResolution + 1, 10);\n    lut.SetNumberOfTableValues(tableSize);\n    lut.Build();\n\n    for (int i = 0; i < tableSize; ++i) {\n      lut.SetTableValue(i, tableColors[i]);\n    }\n\n    // Force an update so we can set cell data\n    aPlane.Update();\n    aPlane.GetOutput().GetCellData().SetScalars(cellData);\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(aPlane.GetOutputPort());\n    mapper.SetScalarRange(0, tableSize - 1);\n    mapper.SetLookupTable(lut);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(600, 600);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
"},{"location":"Java/PolyData/ColorCellsWithRGB/","title":"ColorCellsWithRGB","text":"

vtk-examples/Java/PolyData/ColorCellsWithRGB

"},{"location":"Java/PolyData/ColorCellsWithRGB/#description","title":"Description","text":"

This example shows how to assign specific colors to individual cells of a vtkPolyData. This example stores the vtkCellData as rgb triples in a vtkUnsignedCharArray.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/ColorCellsWithRGB/#code","title":"Code","text":"

ColorCellsWithRGB.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkMath;\nimport vtk.vtkUnsignedCharArray;\nimport vtk.vtkPlaneSource;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class ColorCellsWithRGB  \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkGray\",BgColor);\n\n    // Provide some geometry\n    int resolutionX = 5;\n    int resolutionY = 3;\n\n    vtkPlaneSource aPlane = new vtkPlaneSource();\n    aPlane.SetXResolution(resolutionX);\n    aPlane.SetYResolution(resolutionY);\n    aPlane.Update();\n\n    // Create cell data  \n    vtkMath RS = new vtkMath();\n    RS.RandomSeed(8775070);\n\n    vtkUnsignedCharArray CellData = new vtkUnsignedCharArray();\n    CellData.SetNumberOfComponents(3);\n    CellData.SetNumberOfTuples(aPlane.GetOutput().GetNumberOfCells());\n\n    for(int i=0;i<aPlane.GetOutput().GetNumberOfCells();i++)\n    {\n      double rgb[] = new double[3];\n      rgb[0] = RS.Random(64, 255);\n      rgb[1] = RS.Random(64, 255);\n      rgb[2] = RS.Random(64, 255);\n      CellData.InsertTuple3(i, rgb[0], rgb[1],rgb[2]);\n\n    }\n\n    aPlane.GetOutput().GetCellData().SetScalars(CellData);\n\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(aPlane.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
"},{"location":"Java/PolyData/ColorDisconnectedRegions/","title":"ColorDisconnectedRegions","text":"

vtk-examples/Java/PolyData/ColorDisconnectedRegions

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/ColorDisconnectedRegions/#code","title":"Code","text":"

ColorDisconnectedRegions.java

import vtk.vtkActor;\nimport vtk.vtkAppendPolyData;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataConnectivityFilter;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\n\n\npublic class ColorDisconnectedRegions {\n  private static final long serialVersionUID = 1L;\n\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) {\n    // Create some spheres\n    vtkSphereSource sphere1 = new vtkSphereSource();\n    sphere1.Update();\n\n    vtkSphereSource sphere2 = new vtkSphereSource();\n    sphere2.SetCenter(5.0, 0.0, 0.0);\n    sphere2.Update();\n\n    vtkSphereSource sphere3 = new vtkSphereSource();\n    sphere3.SetCenter(10.0, 0.0, 0.0);\n    sphere3.Update();\n\n    vtkAppendPolyData appendFilter = new vtkAppendPolyData();\n    appendFilter.AddInputConnection(sphere1.GetOutputPort());\n    appendFilter.AddInputConnection(sphere2.GetOutputPort());\n    appendFilter.AddInputConnection(sphere3.GetOutputPort());\n    appendFilter.Update();\n\n    vtkPolyDataConnectivityFilter connectivityFilter = new vtkPolyDataConnectivityFilter();\n    connectivityFilter.SetInputConnection(appendFilter.GetOutputPort());\n    connectivityFilter.SetExtractionModeToAllRegions();\n    connectivityFilter.ColorRegionsOn();\n    connectivityFilter.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(connectivityFilter.GetOutputPort());\n    mapper.SetScalarRange(connectivityFilter.GetOutput().GetPointData().GetArray(\"RegionId\").GetRange());\n    mapper.Update();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(actor);\n    ren.ResetCamera();\n    ren.GetActiveCamera().Zoom(0.9);\n\n    renWin.SetSize(600, 600);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/PolyData/ColoredPoints/","title":"ColoredPoints","text":"

vtk-examples/Java/PolyData/ColoredPoints

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/ColoredPoints/#code","title":"Code","text":"

ColoredPoints.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkVertexGlyphFilter;\nimport vtk.vtkUnsignedCharArray;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class ColoredPoints \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static\n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // ----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Snow\", Bgcolor);\n\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0, 0.0, 0.0);\n    Points.InsertNextPoint(1.0, 0.0, 0.0);\n    Points.InsertNextPoint(0.0, 1.0, 0.0);\n\n\n    vtkPolyData PointsPolydata = new vtkPolyData();\n    PointsPolydata.SetPoints(Points);\n\n    vtkVertexGlyphFilter VertexFilter = new vtkVertexGlyphFilter();\n    VertexFilter.SetInputData(PointsPolydata);\n    VertexFilter.Update();\n\n    vtkPolyData Polydata = new vtkPolyData();\n    Polydata.ShallowCopy(VertexFilter.GetOutput());\n\n    vtkUnsignedCharArray Colors = new vtkUnsignedCharArray();\n    Colors.SetNumberOfComponents(3);\n    Colors.SetName(\"Colors\");\n    Colors.InsertNextTuple3(0,139,0);\n    Colors.InsertNextTuple3(139,0, 0);\n    Colors.InsertNextTuple3(0, 0,139);\n\n    Polydata.GetPointData().SetScalars(Colors);\n\n    //Visualize\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(Polydata);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetPointSize(15);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the Actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/PolyData/ConvexHullShrinkWrap/","title":"ConvexHullShrinkWrap","text":"

vtk-examples/Java/PolyData/ConvexHullShrinkWrap

"},{"location":"Java/PolyData/ConvexHullShrinkWrap/#description","title":"Description","text":"

This example creates a point cloud, and a sphere larger than the point cloud which fully contains the cloud. It then \"shrink wraps\" the sphere onto the points. This produces approximately a convex hull.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/ConvexHullShrinkWrap/#code","title":"Code","text":"

ConvexHullShrinkWrap.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkSphereSource;\nimport vtk.vtkPointSource;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkSmoothPolyDataFilter;\n\npublic class ConvexHullShrinkWrap  \n{\n  // ----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Glyph3DActor Color\n    double GlyphActorColor[] = new double[4];\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double EdgeColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Banana\",GlyphActorColor);\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Tomato\",ActorColor);\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"IvoryBlack\",EdgeColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkSlateGray\",BgColor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetRadius(10.0);\n    Sphere.SetPhiResolution(50);\n    Sphere.SetThetaResolution(50);\n    vtkPointSource PointSource = new vtkPointSource();\n    PointSource.SetNumberOfPoints(60);\n    PointSource.SetRadius(2);\n\n    vtkSmoothPolyDataFilter SmoothFilter = new vtkSmoothPolyDataFilter();\n    SmoothFilter.SetInputConnection(0, Sphere.GetOutputPort());\n    SmoothFilter.SetInputConnection(1, PointSource.GetOutputPort());\n\n    vtkSphereSource GlyphSource = new vtkSphereSource();\n    GlyphSource.SetRadius(0.04);\n\n    vtkGlyph3D Glyph3D = new vtkGlyph3D();\n    Glyph3D.SetInputConnection(PointSource.GetOutputPort());\n    Glyph3D.SetSourceConnection(GlyphSource.GetOutputPort());\n    Glyph3D.ScalingOff();\n\n    vtkDataSetMapper Glyph3DMapper = new vtkDataSetMapper();\n    Glyph3DMapper.SetInputConnection(Glyph3D.GetOutputPort());\n    Glyph3DMapper.ScalarVisibilityOff();\n\n    vtkActor Glyph3DActor = new vtkActor();\n    Glyph3DActor.SetMapper(Glyph3DMapper);\n    Glyph3DActor.GetProperty().SetColor(GlyphActorColor);\n\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputConnection(SmoothFilter.GetOutputPort());\n    Mapper.ScalarVisibilityOff();\n\n    // Create an actor for the surface  \n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetDiffuseColor(ActorColor);\n    Actor.GetProperty().SetEdgeColor(EdgeColor);\n    Actor.GetProperty().SetOpacity(1.0);\n    Actor.GetProperty().EdgeVisibilityOff();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.AddActor(Glyph3DActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n\n  }\n}\n
"},{"location":"Java/PolyData/KochanekSpline/","title":"KochanekSpline","text":"

vtk-examples/Java/PolyData/KochanekSpline

"},{"location":"Java/PolyData/KochanekSpline/#description","title":"Description","text":"

The vtkKochanekSpline provides three parameters to control the shape of the spline:

  1. Tension - Changes the length of the tangent vector
  2. Bias - Primarily changes the direction of the tangent vector
  3. Continuity - Changes the sharpness in change between tangents

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/KochanekSpline/#code","title":"Code","text":"

KochanekSpline.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPointSource;\nimport vtk.vtkPoints;\nimport vtk.vtkKochanekSpline;\nimport vtk.vtkParametricSpline;\nimport vtk.vtkParametricFunctionSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPolyData;\nimport vtk.vtkSphereSource;\nimport vtk.vtkGlyph3DMapper;\n\npublic class KochanekSpline  \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Point Actor Color\n    double PointActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"DarkSlateGrey\",ActorColor);\n    //Change Color Name to Use your own Color for Change Outline Actor Color\n    Color.GetColor(\"Red\",PointActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"White\",BgColor);\n\n    int numberOfPoints = 10;\n    vtkPointSource pointSource = new vtkPointSource();\n    pointSource.SetNumberOfPoints(numberOfPoints);\n    pointSource.Update();\n\n    vtkPoints Points = pointSource.GetOutput().GetPoints();\n\n    vtkKochanekSpline xSpline = new vtkKochanekSpline();\n    vtkKochanekSpline ySpline = new vtkKochanekSpline();\n    vtkKochanekSpline zSpline = new vtkKochanekSpline();\n\n    vtkParametricSpline spline = new vtkParametricSpline();\n    spline.SetXSpline(xSpline);\n    spline.SetYSpline(ySpline);\n    spline.SetZSpline(zSpline);\n    spline.SetPoints(Points);\n\n    vtkParametricFunctionSource functionSource = new vtkParametricFunctionSource();\n    functionSource.SetParametricFunction(spline);\n    functionSource.SetUResolution(50*numberOfPoints);\n    functionSource.SetVResolution(50*numberOfPoints);\n    functionSource.SetWResolution(50*numberOfPoints);\n    functionSource.Update();\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(functionSource.GetOutputPort());\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(ActorColor);\n    Actor.GetProperty().SetLineWidth(3.0);\n\n    //Glyph the points\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetRadius(0.02);\n    Sphere.SetPhiResolution(21);\n    Sphere.SetThetaResolution(21);\n\n\n    vtkPolyData polyData = new vtkPolyData();\n    polyData.SetPoints(Points);\n\n    vtkGlyph3DMapper PointMapper = new vtkGlyph3DMapper();\n    PointMapper.SetInputData(polyData);\n    PointMapper.SetSourceConnection(Sphere.GetOutputPort());\n\n    vtkActor PointActor = new vtkActor();\n    PointActor.SetMapper(PointMapper);\n    PointActor.GetProperty().SetColor(PointActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.AddActor(PointActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/PolyData/MeshQuality/","title":"MeshQuality","text":"

vtk-examples/Java/PolyData/MeshQuality

"},{"location":"Java/PolyData/MeshQuality/#description","title":"Description","text":"

This example uses one of many selectable methods to determine the quality of a mesh. In this case, we have selected to use the area of the triangles. We show how to retrieve the quality metric computed on each triangle after the process is completed.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/MeshQuality/#code","title":"Code","text":"

MeshQuality.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkSphereSource;\nimport vtk.vtkTriangleFilter;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyData;\nimport vtk.vtkMeshQuality;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkDoubleArray;\n\npublic class MeshQuality \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"NavajoWhite\",BgColor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    //Sphere.SetCenter(0.0,0.0,0.0);\n    phere.SetRadius(5.0);\n    Sphere.Update();\n\n    //Change Phi and Theta Value for Smooth Surface\n    Sphere.SetPhiResolution(12);\n    Sphere.SetThetaResolution(14);\n\n    vtkTriangleFilter triangleFilter = new vtkTriangleFilter();\n    triangleFilter.SetInputConnection(Sphere.GetOutputPort());\n    triangleFilter.Update();\n\n    vtkPolyData Mesh = triangleFilter.GetOutput();\n    System.out.println(\"There are\" + \" \" +  Mesh.GetNumberOfCells() +\" \"  + \"Cells\");\n\n\n    vtkMeshQuality QualityFilter = new vtkMeshQuality();\n    QualityFilter.SetInputData(Mesh);\n    QualityFilter.SetTriangleQualityMeasureToArea();\n    QualityFilter.Update();\n\n\n    vtkDoubleArray QualityArray = new vtkDoubleArray().FastDownCast(QualityFilter.GetOutput().GetCellData().GetArray(\"Quality\"));\n    System.out.println(\"There are\" + QualityArray.GetNumberOfTuples() + \"values\");\n\n\n    for(int i=0;i<QualityArray.GetNumberOfTuples();i++)\n    {\n      double val = QualityArray.GetValue(i);\n      System.out.println(\"Value\" + \" \"+i + \" \" + val);\n\n    }\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.ShallowCopy(QualityFilter.GetOutput());\n\n    //Create a Mapper and Actor for Sphere\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(PolyData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/PolyData/Outline/","title":"Outline","text":"

vtk-examples/Java/PolyData/Outline

"},{"location":"Java/PolyData/Outline/#description","title":"Description","text":"

This example shows how to draw the outline of the dataset.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/Outline/#code","title":"Code","text":"

Outline.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkSphereSource;\nimport vtk.vtkOutlineFilter;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Outline \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Outline Actor Color\n    double OutlineActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"LightCoral\",ActorColor);\n    //Change Color Name to Use your own Color for Change Outline Actor Color\n    Color.GetColor(\"Black\",OutlineActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Cornsilk\",BgColor);\n\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(5.0);\n    Sphere.Update();\n\n    //Change Phi and Theta Value for Smooth Surface\n    Sphere.SetPhiResolution(20);\n    Sphere.SetThetaResolution(20);\n\n    //Create a Mapper and Actor for Sphere\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(ActorColor);\n\n\n    // Create the outline \n    vtkOutlineFilter OutLiner = new vtkOutlineFilter();\n    OutLiner.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkPolyDataMapper OutlineMapper = new vtkPolyDataMapper();\n    OutlineMapper.SetInputConnection(OutLiner.GetOutputPort());\n\n    vtkActor OutlineActor = new vtkActor();\n    OutlineActor.SetMapper(OutlineMapper);\n    OutlineActor.GetProperty().SetColor(OutlineActorColor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.AddActor(OutlineActor);\n    ren.SetBackground(BgColor);\n    ren.GetActiveCamera().Azimuth(40);\n    ren.GetActiveCamera().Elevation(30);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/PolyData/Reflection/","title":"Reflection","text":"

vtk-examples/Java/PolyData/Reflection

"},{"location":"Java/PolyData/Reflection/#description","title":"Description","text":"

Java Program to visualize reflection in VTK.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/Reflection/#code","title":"Code","text":"

Reflection.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkConeSource;\nimport vtk.vtkReflectionFilter;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\n\npublic class Reflection  \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Cone Actor\n    double ConeActorColor[] = new double[4];\n\n    //For Reflection Actor\n    double ReflectionActorColor[] = new double[4];\n\n    //Renderer Background Color    \n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Cone Actor\n    Color.GetColor(\"Mint\",ConeActorColor);\n\n    //Change Color Name to Use your own Color for Reflection Actor\n    Color.GetColor(\"Tomato\",ReflectionActorColor);\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Wheat\",BgColor);\n\n    // Create a Cone\n    vtkConeSource ConeSource = new vtkConeSource();\n    ConeSource.Update();\n\n    // Create a mapper and actor\n    vtkPolyDataMapper ConeMapper = new vtkPolyDataMapper();\n    ConeMapper.SetInputConnection(ConeSource.GetOutputPort());\n\n\n    vtkActor ConeActor = new vtkActor();\n    ConeActor.SetMapper(ConeMapper);\n    ConeActor.GetProperty().SetColor(ConeActorColor);\n\n    // Reflection\n    vtkReflectionFilter ReflectionFilter = new vtkReflectionFilter();\n    ReflectionFilter.SetInputConnection(ConeSource.GetOutputPort());\n    ReflectionFilter.CopyInputOff();\n    ReflectionFilter.Update();\n\n    vtkDataSetMapper ReflectionMapper = new vtkDataSetMapper();\n    ReflectionMapper.SetInputConnection(ReflectionFilter.GetOutputPort());\n\n    vtkActor ReflectionActor = new vtkActor();\n    ReflectionActor.SetMapper(ReflectionMapper);\n    ReflectionActor.GetProperty().SetColor(ReflectionActorColor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(ConeActor);\n    ren.AddActor(ReflectionActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
"},{"location":"Java/PolyData/RibbonFilter/","title":"RibbonFilter","text":"

vtk-examples/Java/PolyData/RibbonFilter

"},{"location":"Java/PolyData/RibbonFilter/#description","title":"Description","text":"

Java Program which demonstrates how to draw a flat surface (a ribbon) along a line.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/RibbonFilter/#code","title":"Code","text":"

RibbonFilter.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkMath;\nimport vtk.vtkCellArray;\nimport vtk.vtkRibbonFilter;\nimport vtk.vtkNamedColors;\n\npublic class RibbonFilter \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Line Actor Color\n    double LineActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Sienna\",LineActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SteelBlue\",BgColor);\n\n    // No. of vertices\n    int nV = 256;      \n    double vX, vY, vZ;\n    // Spiral radius\n    double rS = 2;  \n    // No. of spiral cycles\n    int nCyc = 3;    \n    // Height\n    double h = 10;              \n\n    int i;\n\n    // Create points and cells for a spiral\n    vtkPoints Points = new vtkPoints();\n    vtkMath findPI = new vtkMath(); \n    for(i = 0; i < nV; i++)\n    {\n      // Spiral coordinates\n      vX = rS * Math.cos(2 * findPI.Pi()* nCyc * i / (nV - 1));\n      vY = rS * Math.sin(2 * findPI.Pi() * nCyc * i / (nV - 1));\n      vZ = h * i / nV;\n      Points.InsertPoint(i, vX, vY, vZ);\n    }\n\n    vtkCellArray Lines = new vtkCellArray();\n    Lines.InsertNextCell(nV);\n    for (i = 0; i < nV; i++)\n    {\n      Lines.InsertCellPoint(i);\n    }\n\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n    PolyData.SetLines(Lines);\n\n    // Create a mapper and actor\n    vtkPolyDataMapper LineMapper = new vtkPolyDataMapper();\n    LineMapper.SetInputData(PolyData);\n\n\n    vtkActor LineActor = new vtkActor();\n    LineActor.SetMapper(LineMapper);\n    LineActor.GetProperty().SetColor(LineActorColor);\n    LineActor.GetProperty().SetLineWidth(3);\n\n    // Create a ribbon around the line\n    vtkRibbonFilter RibbonFilter = new vtkRibbonFilter();\n    RibbonFilter.SetInputData(PolyData);\n    RibbonFilter.SetWidth(0.4);\n\n    // Create a mapper and actor for Ribbon\n    vtkPolyDataMapper RibbonMapper = new vtkPolyDataMapper();\n    RibbonMapper.SetInputConnection(RibbonFilter.GetOutputPort());\n\n\n    vtkActor RibbonActor = new vtkActor();\n    RibbonActor.SetMapper(RibbonMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n\n    // Visualise the arrow\n    ren.AddActor(LineActor);\n    ren.AddActor(RibbonActor);\n    ren.SetBackground(BgColor);\n    ren.GetActiveCamera().Azimuth(40);\n    ren.GetActiveCamera().Elevation(30);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
"},{"location":"Java/PolyData/RotationAroundLine/","title":"RotationAroundLine","text":"

vtk-examples/Java/PolyData/RotationAroundLine

"},{"location":"Java/PolyData/RotationAroundLine/#description","title":"Description","text":"

This example demonstrates how to rotate an object around an axis. For the demo, we rotate a cone by 10 degrees around the y axis.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/RotationAroundLine/#code","title":"Code","text":"

RotationAroundLine.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkConeSource;\nimport vtk.vtkXMLPolyDataWriter;\nimport vtk.vtkTransformPolyDataFilter;\nimport vtk.vtkTransform;\nimport vtk.vtkXMLPolyDataReader;\n\npublic class RotationAroundLine \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 2) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtp) Filename(.vtp) e.g original.vtp transformed.vtp\");\n      return;\n    }\n    String inputFilename = args[0];\n    String outputFilename = args[1];\n\n    // Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double leftViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};\n    double rightViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", actorColor);\n    colors.GetColor(\"Turquoise\", Bgcolor);\n\n    //Create a cone\n    vtkConeSource coneSource = new vtkConeSource();\n\n    {\n     vtkXMLPolyDataWriter writer = new vtkXMLPolyDataWriter();\n     writer.SetInputConnection(coneSource.GetOutputPort());\n     writer.SetFileName(inputFilename);\n     writer.Write();\n    }\n\n    vtkTransform transform = new vtkTransform();\n    //transform.RotateWXYZ(double angle, double x, double y, double z);\n    transform.RotateWXYZ(10, 0, 1, 0);\n\n    vtkTransformPolyDataFilter transformFilter = new vtkTransformPolyDataFilter();\n\n    transformFilter.SetTransform(transform);\n    transformFilter.SetInputConnection(coneSource.GetOutputPort());\n    transformFilter.Update();\n\n    {\n     vtkXMLPolyDataWriter writer = new vtkXMLPolyDataWriter();\n     writer.SetInputConnection(transformFilter.GetOutputPort());\n     writer.SetFileName(outputFilename);\n     writer.Write();\n    }\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Original Actor\n    vtkXMLPolyDataReader original_reader = new vtkXMLPolyDataReader();\n    original_reader.SetFileName(inputFilename);\n    original_reader.Update();\n\n    vtkPolyDataMapper original_mapper = new vtkPolyDataMapper();\n    original_mapper.SetInputConnection(original_reader.GetOutputPort());\n\n    vtkActor original_actor = new vtkActor();\n    original_actor.SetMapper(original_mapper);\n\n    // Transformed Actor\n    vtkXMLPolyDataReader Transformed_reader = new vtkXMLPolyDataReader();\n    Transformed_reader.SetFileName(outputFilename);\n    Transformed_reader.Update();\n\n    vtkPolyDataMapper Transformed_mapper = new vtkPolyDataMapper();\n    Transformed_mapper.SetInputConnection(Transformed_reader.GetOutputPort());\n\n    vtkActor Transformed_actor = new vtkActor();\n    Transformed_actor.SetMapper(Transformed_mapper);\n\n    // Setup both renderers\n    vtkRenderer leftRenderer = new vtkRenderer();\n    renWin.AddRenderer(leftRenderer);\n    leftRenderer.SetViewport(leftViewport);\n    leftRenderer.SetBackground(Bgcolor);  \n\n    vtkRenderer rightRenderer = new vtkRenderer();\n    renWin.AddRenderer(rightRenderer);\n    rightRenderer.SetViewport(rightViewport);\n    rightRenderer.SetBackground(Bgcolor);\n\n    leftRenderer.AddActor(original_actor);\n    rightRenderer.AddActor(Transformed_actor);\n\n    leftRenderer.ResetCamera();\n    rightRenderer.ResetCamera();\n\n    renWin.SetSize(600, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/PolyData/RuledSurfaceFilter/","title":"RuledSurfaceFilter","text":"

vtk-examples/Java/PolyData/RuledSurfaceFilter

"},{"location":"Java/PolyData/RuledSurfaceFilter/#description","title":"Description","text":"

vtkRuledSurfaceFilter object is a filter that generates a surface from a set of lines. The lines are assumed to be \"parallel\" in the sense that they do not intersect and remain somewhat close to one another.

A surface is generated by connecting the points defining each pair of lines with straight lines. This creates a strip for each pair of lines (i.e., a triangulation is created from two generating lines).

The filter can handle an arbitrary number of lines, with lines i and i+1 assumed connected.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/RuledSurfaceFilter/#code","title":"Code","text":"

RuledSurfaceFilter.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPoints;\nimport vtk.vtkLine;\nimport vtk.vtkCellArray;\nimport vtk.vtkRuledSurfaceFilter;\nimport vtk.vtkPolyData;\n\npublic class RuledSurfaceFilter \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n   vtkNamedColors colors = new vtkNamedColors();\n   //For Actor Color\n   double actorColor[] = new double[4];\n   //Renderer Background Color\n   double Bgcolor[] = new double[4];\n\n   colors.GetColor(\"Khaki\", actorColor);\n   colors.GetColor(\"LightSlateGray\", Bgcolor);\n   // Create first line.\n   vtkPoints points = new vtkPoints();\n   points.InsertPoint(0, 0, 0, 1);\n   points.InsertPoint(1, 1, 0, 0);\n   points.InsertPoint(2, 0, 1, 0);\n   points.InsertPoint(3, 1, 1, 1);\n\n   vtkLine line1 = new vtkLine();\n   line1.GetPointIds().SetId(0, 0);\n   line1.GetPointIds().SetId(1, 1);\n\n   vtkLine line2 = new vtkLine();\n   line2.GetPointIds().SetId(0, 2);\n   line2.GetPointIds().SetId(1, 3);\n\n   vtkCellArray lines = new vtkCellArray();\n   lines.InsertNextCell(line1);\n   lines.InsertNextCell(line2);\n\n   vtkPolyData polydata = new vtkPolyData();\n   polydata.SetPoints(points);\n   polydata.SetLines(lines);\n\n   vtkRuledSurfaceFilter ruledSurfaceFilter = new vtkRuledSurfaceFilter();\n   ruledSurfaceFilter.SetInputData(polydata);\n   ruledSurfaceFilter.SetResolution(21, 21);\n   ruledSurfaceFilter.SetRuledModeToResample();\n\n   // Create the renderer, render window and interactor.\n   vtkRenderer ren = new vtkRenderer();\n   vtkRenderWindow renWin = new vtkRenderWindow();\n   renWin.AddRenderer(ren);\n   vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n   iren.SetRenderWindow(renWin);\n\n   vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n   mapper.SetInputConnection(ruledSurfaceFilter.GetOutputPort());\n\n   vtkActor actor = new vtkActor();\n   actor.SetMapper(mapper);\n   actor.GetProperty().SetColor(actorColor);\n\n   // Add the actors to the renderer, set the background and size\n   ren.AddActor(actor);\n\n   ren.ResetCamera();\n   ren.GetActiveCamera().Azimuth(60);\n   ren.GetActiveCamera().Elevation(60);\n   ren.GetActiveCamera().Dolly(1.2);\n   ren.ResetCameraClippingRange();\n\n   ren.SetBackground(Bgcolor);\n\n   renWin.SetSize(400, 400);\n   renWin.Render();\n\n   iren.Initialize();\n   iren.Start();\n  }\n}\n
"},{"location":"Java/PolyData/Stripper/","title":"Stripper","text":"

vtk-examples/Java/PolyData/Stripper

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/Stripper/#code","title":"Code","text":"

Stripper.java

import vtk.vtkSphereSource;\nimport vtk.vtkStripper;\nimport vtk.vtkNativeLibrary;\n\nclass Stripper{  \n\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n\n  public static void main(String args[]){  \n\n    vtkSphereSource SphereSource = new vtkSphereSource();\n    SphereSource.Update();\n\n    System.out.println(\"Number of cells before stripping:\" + SphereSource.GetOutput().GetNumberOfCells() );\n\n\n    vtkStripper Stripper = new vtkStripper();\n    Stripper.SetInputConnection(SphereSource.GetOutputPort());\n    Stripper.Update();\n\n\n    System.out.println(\"Number of cells after stripping:\" + Stripper.GetOutput().GetNumberOfCells() );\n\n\n  }  \n}   \n
"},{"location":"Java/PolyData/ThinPlateSplineTransform/","title":"ThinPlateSplineTransform","text":"

vtk-examples/Java/PolyData/ThinPlateSplineTransform

"},{"location":"Java/PolyData/ThinPlateSplineTransform/#description","title":"Description","text":"

vtkThinPlateSplineTransform object describes a nonlinear warp transform defined by a set of source and target landmarks.

Any point on the mesh close to a source landmark will be moved to a place close to the corresponding target landmark. The points in between are interpolated smoothly using Bookstein's Thin Plate Spline algorithm.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/ThinPlateSplineTransform/#code","title":"Code","text":"

ThinPlateSplineTransform.java

import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageGridSource;\nimport vtk.vtkLookupTable;\nimport vtk.vtkImageMapToColors;\nimport vtk.vtkBMPReader;\nimport vtk.vtkImageBlend;\nimport vtk.vtkPoints;\nimport vtk.vtkThinPlateSplineTransform;\nimport vtk.vtkImageReslice;\nimport vtk.vtkImageMapper;\nimport vtk.vtkActor2D;\nimport vtk.vtkInteractorStyleTerrain;\n\npublic class ThinPlateSplineTransform \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.bmp) e.g masonry.bmp\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Black\", Bgcolor);\n\n    // First, create an image to warp\n    vtkImageGridSource imageGrid = new vtkImageGridSource();\n    imageGrid.SetGridSpacing(16, 16, 0);\n    imageGrid.SetGridOrigin(0, 0, 0);\n    imageGrid.SetDataExtent(0, 255, 0, 255, 0, 0);\n    imageGrid.SetDataScalarTypeToUnsignedChar();\n\n    vtkLookupTable table = new vtkLookupTable();\n    table.SetTableRange(0, 1);\n    table.SetAlphaRange(0.0, 1.0);\n    table.SetHueRange(0.15, 0.15);\n    table.SetSaturationRange(1, 1);\n    table.SetValueRange(0, 1 );\n    table.Build();\n\n    vtkImageMapToColors alpha = new vtkImageMapToColors();\n    alpha.SetInputConnection(imageGrid.GetOutputPort());\n    alpha.SetLookupTable( table );\n\n    vtkBMPReader reader = new vtkBMPReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkImageBlend blend = new vtkImageBlend();\n    blend.AddInputConnection(0, reader.GetOutputPort());\n    blend.AddInputConnection(0, alpha.GetOutputPort());\n\n    // Next, create a ThinPlateSpline transform\n    vtkPoints p1 = new vtkPoints();\n    p1.SetNumberOfPoints( 8 );\n    p1.SetPoint(0, 0, 0, 0);\n    p1.SetPoint(1, 0, 255, 0);\n    p1.SetPoint(2, 255, 0, 0);\n    p1.SetPoint(3, 255, 255, 0);\n    p1.SetPoint(4, 96, 96, 0);\n    p1.SetPoint(5, 96, 159, 0);\n    p1.SetPoint(6, 159, 159, 0);\n    p1.SetPoint(7, 159, 96, 0);\n\n    vtkPoints p2 = new vtkPoints();\n    p2.SetNumberOfPoints( 8 );\n    p2.SetPoint(0, 0, 0, 0);\n    p2.SetPoint(1, 0, 255, 0);\n    p2.SetPoint(2, 255, 0, 0);\n    p2.SetPoint(3, 255, 255, 0);\n    p2.SetPoint(4, 96, 159, 0);\n    p2.SetPoint(5, 159, 159, 0);\n    p2.SetPoint(6, 159, 96, 0);\n    p2.SetPoint(7, 96, 96, 0);\n\n    vtkThinPlateSplineTransform transform = new vtkThinPlateSplineTransform();\n    transform.SetSourceLandmarks(p2);\n    transform.SetTargetLandmarks(p1);\n    transform.SetBasisToR2LogR();\n    // You must invert the transform before passing it to vtkImageReslice\n    transform.Inverse();\n\n    vtkImageReslice reslice = new vtkImageReslice();\n    reslice.SetInputConnection(blend.GetOutputPort());\n    reslice.SetResliceTransform(transform);\n    reslice.SetInterpolationModeToLinear();\n\n    vtkImageMapper map = new vtkImageMapper();\n    map.SetInputConnection(reslice.GetOutputPort());\n    map.SetColorWindow( 255.0);\n    map.SetColorLevel(127.5);\n    map.SetZSlice(0);\n\n    vtkActor2D  actor = new vtkActor2D();\n    actor.SetMapper(map);\n    actor.SetPosition(0.0, 0.0);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleTerrain style = new vtkInteractorStyleTerrain();\n    iren.SetInteractorStyle(style);\n\n    // Visualize\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/PolyData/TransformFilter/","title":"TransformFilter","text":"

vtk-examples/Java/PolyData/TransformFilter

"},{"location":"Java/PolyData/TransformFilter/#description","title":"Description","text":"

vtkTransformFilter is an object to transform point coordinates, and associated point normals and vectors, as well as cell normals and vectors.

Transformed data array will be stored in a float array or a double array. Other point and cel data are passed through the filter, unless TransformAllInputVectors is set to true, in this case all other 3 components arrays from point and cell data will be transformed as well.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/TransformFilter/#code","title":"Code","text":"

TransformFilter.java

import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkArrowSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkTransform;\nimport vtk.vtkTransformFilter;\n\n\npublic class TransformFilter \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static\n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SteelBlue\", actorColor);\n    colors.GetColor(\"BurlyWood\", Bgcolor);\n\n    //Create an Arrow\n    vtkArrowSource arrowSource = new vtkArrowSource();\n\n    vtkTransform Transform = new vtkTransform();\n    Transform.Scale(5, 1, 1);\n\n    vtkTransformFilter TransformFilter = new vtkTransformFilter();\n    TransformFilter.SetTransform(Transform);\n    TransformFilter.SetInputConnection(arrowSource.GetOutputPort());\n    TransformFilter.SetTransform(Transform);\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(TransformFilter.GetOutputPort());\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/PolyData/TransformPipeline/","title":"TransformPipeline","text":"

vtk-examples/Java/PolyData/TransformPipeline

"},{"location":"Java/PolyData/TransformPipeline/#description","title":"Description","text":"

This example demonstrate how to connect a transformation for keeping coordinate one actor relative to another.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/TransformPipeline/#code","title":"Code","text":"

TransformPipeline.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkCylinderSource;\nimport vtk.vtkTransform;\n\npublic class TransformPipeline\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n   vtkNamedColors colors = new vtkNamedColors();\n\n   //For arm Color\n   double armColor[] = new double[4];\n   //For forearm Color\n   double forearmColor[] = new double[4];\n   //For hand Color\n   double handColor[] = new double[4];\n   //Renderer Background Color\n   double Bgcolor[] = new double[4];\n\n   colors.GetColor(\"DarkKhaki\", armColor);\n   colors.GetColor(\"Blue\", forearmColor);\n   colors.GetColor(\"GreenYellow\", handColor);\n   colors.GetColor(\"MidnightBlue\", Bgcolor);\n\n   //arm\n   vtkCylinderSource arm = new vtkCylinderSource();\n   arm.SetRadius(8);\n   arm.SetHeight(20);\n   arm.SetResolution(20);\n\n   vtkPolyDataMapper armMapper = new vtkPolyDataMapper();\n   armMapper.SetInputConnection(arm.GetOutputPort());\n\n   vtkTransform armTransform = new vtkTransform();\n\n   vtkActor armActor = new vtkActor();\n   armActor.SetUserTransform(armTransform);\n   armActor.SetMapper(armMapper);\n   armActor.GetProperty().SetColor(armColor);\n\n   //forearm\n   vtkCylinderSource forearm = new vtkCylinderSource();\n   forearm.SetRadius(6);\n   forearm.SetHeight(15);\n   forearm.SetResolution(20);\n   forearm.SetCenter(0, 10.5, -2.5);;\n\n   vtkPolyDataMapper forearmMapper = new vtkPolyDataMapper();\n   forearmMapper.SetInputConnection(forearm.GetOutputPort());\n\n   vtkTransform forearmTransform = new vtkTransform();\n   forearmTransform.SetInput(armTransform);\n\n   vtkActor forearmActor = new vtkActor();\n   forearmActor.SetUserTransform(forearmTransform);\n   forearmActor.SetMapper(forearmMapper);\n   forearmActor.GetProperty().SetColor(forearmColor);\n\n   //hand\n   vtkCylinderSource hand = new vtkCylinderSource();\n   hand.SetRadius(4);\n   hand.SetHeight(10);\n   hand.SetResolution(20);\n   hand.SetCenter(0, 18.5, -2.5);\n\n   vtkPolyDataMapper handMapper = new vtkPolyDataMapper();\n   handMapper.SetInputConnection(hand.GetOutputPort());\n\n   vtkTransform handTransform = new vtkTransform();\n   handTransform.SetInput(forearmTransform);\n\n   vtkActor handActor = new vtkActor();\n   handActor.SetUserTransform(handTransform);\n   handActor.SetMapper(handMapper);\n   handActor.GetProperty().SetColor(handColor);\n\n   // Create the renderer, render window and interactor.\n   vtkRenderer ren = new vtkRenderer();\n   vtkRenderWindow renWin = new vtkRenderWindow();\n   renWin.AddRenderer(ren);\n   vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n   iren.SetRenderWindow(renWin);\n\n   ren.AddActor(armActor);\n   ren.AddActor(forearmActor);\n   ren.AddActor(handActor);\n   ren.SetBackground(Bgcolor);\n   renWin.Render();\n\n   //execution of robot arm motion\n   for (int i = 0; i<45; i++)\n   {\n    armTransform.Identity();\n    armTransform.RotateZ(-i);\n    renWin.Render();\n   }\n   //execution of robot forearm motion\n   for (int i = 0; i<45; i++)\n   {\n    forearmTransform.Identity();\n    forearmTransform.RotateZ(i);\n    renWin.Render();\n   }\n   iren.Start();\n  }\n}\n
"},{"location":"Java/PolyData/TriangleColoredPoints/","title":"TriangleColoredPoints","text":"

vtk-examples/Java/PolyData/TriangleColoredPoints

"},{"location":"Java/PolyData/TriangleColoredPoints/#description","title":"Description","text":"

This example shows how by adding a color to each vertex of a triangle, the triangle's color will be smoothly varying between the colors of the vertices.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/TriangleColoredPoints/#code","title":"Code","text":"

TriangleColoredPoints.java

import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkPoints;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkPolyData;\nimport vtk.vtkTriangle;\nimport vtk.vtkUnsignedCharArray;\nimport vtk.vtkCellArray;\nimport vtk.vtkNamedColors;\n\npublic class TriangleColoredPoints \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static\n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Black\", Bgcolor);\n\n    // Setup points\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0, 0.0, 0.0);\n    Points.InsertNextPoint(1.0, 0.0, 0.0);\n    Points.InsertNextPoint(0.0, 1.0, 0.0);\n\n    //Setup the colors array\n    vtkUnsignedCharArray Colors = new vtkUnsignedCharArray();\n    Colors.SetNumberOfComponents(3);\n    Colors.SetName(\"Colors\");\n\n   //Add the three colors we have created to the array\n    Colors.InsertNextTuple3(255,0, 0);\n    Colors.InsertNextTuple3(0, 255, 0);\n    Colors.InsertNextTuple3(0, 0, 255);\n\n    //Create a triangle\n    vtkCellArray Triangles = new vtkCellArray();\n    vtkTriangle Triangle = new vtkTriangle();\n    Triangle.GetPointIds().SetId(0, 0);\n    Triangle.GetPointIds().SetId(1, 1);\n    Triangle.GetPointIds().SetId(2, 2);\n    Triangles.InsertNextCell(Triangle);\n\n    //Create a polydata object and add everything to it\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n    PolyData.SetPolys(Triangles);\n    PolyData.GetPointData().SetScalars(Colors);\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(PolyData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/PolyData/TubeFilter/","title":"TubeFilter","text":"

vtk-examples/Java/PolyData/TubeFilter

"},{"location":"Java/PolyData/TubeFilter/#description","title":"Description","text":"

This example creates a tube around a line. This is helpful because when you zoom the camera, the thickness of a line remains constant, while the thickness of a tube varies.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/PolyData/TubeFilter/#code","title":"Code","text":"

TubeFilter.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkLineSource;\nimport vtk.vtkTubeFilter;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class TubeFilter  \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    /*\n            * This example creates a tube around a line. \n            * This is helpful because when you zoom the camera, \n            * the thickness of a line remains constant, \n            * while the thickness of a tube varies.\n            * */\n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Actor\n    Color.GetColor(\"Red\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Gray\",BgColor);\n\n    // Create a line\n    vtkLineSource LineSource = new vtkLineSource();\n    LineSource.SetPoint1(1.0, 0.0, 0.0);\n    LineSource.SetPoint2(.0, 1.0, 0.0);\n\n    // Create a mapper and actor\n    vtkPolyDataMapper LineMapper = new vtkPolyDataMapper();\n    LineMapper.SetInputConnection(LineSource.GetOutputPort());\n\n\n    vtkActor LineActor = new vtkActor();\n    LineActor.SetMapper(LineMapper);\n    LineActor.GetProperty().SetColor(ActorColor);\n    LineActor.GetProperty().SetLineWidth(3);\n\n    vtkTubeFilter TubeFilter = new vtkTubeFilter();\n    TubeFilter.SetInputConnection(LineSource.GetOutputPort());\n    TubeFilter.SetRadius(0.025);\n    TubeFilter.SetNumberOfSides(50);\n    TubeFilter.Update();\n\n\n    vtkPolyDataMapper TubeMapper = new vtkPolyDataMapper();\n    TubeMapper.SetInputConnection(TubeFilter.GetOutputPort());\n\n    vtkActor TubeActor = new vtkActor();\n    TubeActor.SetMapper(TubeMapper);\n    //Make the tube have some transparency.\n    TubeActor.GetProperty().SetOpacity(0.5);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(LineActor);\n    ren.AddActor(TubeActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
"},{"location":"Java/RectilinearGrid/RectilinearGrid/","title":"RectilinearGrid","text":"

vtk-examples/Java/RectilinearGrid/RectilinearGrid

"},{"location":"Java/RectilinearGrid/RectilinearGrid/#description","title":"Description","text":"

vtkRectilinearGrid object represents a geometric structure that is topologically regular with variable spacing in the three coordinate directions x-y-z.

To define a vtkRectilinearGrid, you must specify the dimensions of the data and provide three arrays of values specifying the coordinates along the x-y-z axes. The coordinate arrays are specified using three vtkDataArray objects (one for x, one for y, one for z).

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/RectilinearGrid/RectilinearGrid/#code","title":"Code","text":"

RectilinearGrid.java

import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkRectilinearGrid;\nimport vtk.vtkDoubleArray;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkActor;\n\npublic class RectilinearGrid\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double Bgcolor[] = new double[] {0.3, 0.6, 0.3}; \n    colors.SetColor(\"Bgcolor\", Bgcolor);\n\n    //Create a grid\n    vtkRectilinearGrid grid = new vtkRectilinearGrid();\n\n    grid.SetDimensions(2,3,1);\n\n    vtkDoubleArray xArray = new vtkDoubleArray();\n    xArray.InsertNextValue(0.0);\n    xArray.InsertNextValue(2.0);\n\n    vtkDoubleArray yArray = new vtkDoubleArray();\n    yArray.InsertNextValue(0.0);\n    yArray.InsertNextValue(1.0);\n    yArray.InsertNextValue(2.0);\n\n    vtkDoubleArray zArray = new vtkDoubleArray();\n    zArray.InsertNextValue(0.0);\n\n    grid.SetXCoordinates(xArray);\n    grid.SetYCoordinates(yArray);\n    grid.SetZCoordinates(zArray);\n\n    System.out.println(\"There are\" + \" \" + grid.GetNumberOfPoints() + \" \" +  \"points.\"); \n    System.out.println(\"There are\" + \" \" + grid.GetNumberOfCells() + \" \" + \"cells.\");\n\n    for(int id = 0; id < grid.GetNumberOfPoints(); id++)\n    {\n      double p[] = new double[3];\n      grid.GetPoint(id, p);\n      System.out.println(\"Point \" + \" \" +  id + \" \" +  \" : (\" + \" \" +  p[0] + \" \" +  \" , \" + \" \" + p[1] + \" \" +  \" , \" + \" \" +  p[2] + \" \" + \")\" );\n    }\n\n    //Create a mapper and actor\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputData(grid);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor); // Background color green\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/RectilinearGrid/RectilinearGridToTetrahedra/","title":"RectilinearGridToTetrahedra","text":"

vtk-examples/Java/RectilinearGrid/RectilinearGridToTetrahedra

"},{"location":"Java/RectilinearGrid/RectilinearGridToTetrahedra/#description","title":"Description","text":"

vtkRectilinearGridToTetrahedra object forms a mesh of Tetrahedra from a vtkRectilinearGrid.

The tetrahedra can be 5 per cell, 6 per cell, or a mixture of 5 or 12 per cell. The resulting mesh is consistent, meaning that there are no edge crossings and that each tetrahedron face is shared by two tetrahedra, except those tetrahedra on the boundary. All tetrahedra are right handed.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/RectilinearGrid/RectilinearGridToTetrahedra/#code","title":"Code","text":"

RectilinearGridToTetrahedra.java

import vtk.vtkDoubleArray;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRectilinearGrid;\nimport vtk.vtkRectilinearGridToTetrahedra;\nimport vtk.vtkXMLUnstructuredGridWriter;\n\npublic class RectilinearGridToTetrahedra \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  { \n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtu) e.g output.vtu\");\n      return;\n    }\n    String Filename = args[0];\n\n    // Create a grid\n    vtkRectilinearGrid grid = new vtkRectilinearGrid();\n\n    grid.SetDimensions(5,4,3);\n\n    vtkDoubleArray xArray = new vtkDoubleArray();\n    xArray.InsertNextValue(0.0);\n    xArray.InsertNextValue(1.0);\n    xArray.InsertNextValue(2.0);\n    xArray.InsertNextValue(3.0);\n    xArray.InsertNextValue(4.0);\n\n    vtkDoubleArray yArray = new vtkDoubleArray();\n    yArray.InsertNextValue(0.0);\n    yArray.InsertNextValue(1.0);\n    yArray.InsertNextValue(2.0);\n    yArray.InsertNextValue(3.0);\n\n    vtkDoubleArray zArray = new vtkDoubleArray();\n    zArray.InsertNextValue(0.0);\n    zArray.InsertNextValue(1.0);\n    zArray.InsertNextValue(2.0);\n\n    grid.SetXCoordinates(xArray);\n    grid.SetYCoordinates(yArray);\n    grid.SetZCoordinates(zArray);\n\n    vtkRectilinearGridToTetrahedra rectilinearGridToTetrahedra = new vtkRectilinearGridToTetrahedra();\n    rectilinearGridToTetrahedra.SetInputData(grid);\n    rectilinearGridToTetrahedra.Update();\n\n    vtkXMLUnstructuredGridWriter writer = new vtkXMLUnstructuredGridWriter();\n    writer.SetFileName(Filename);\n    writer.SetInputConnection(rectilinearGridToTetrahedra.GetOutputPort());\n    writer.Write();\n\n    System.out.println(\"There are \" + \" \" + rectilinearGridToTetrahedra.GetOutput().GetNumberOfCells() + \" \" + \" cells.\"); \n\n  }\n}\n
"},{"location":"Java/RectilinearGrid/VisualizeRectilinearGrid/","title":"VisualizeRectilinearGrid","text":"

vtk-examples/Java/RectilinearGrid/VisualizeRectilinearGrid

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/RectilinearGrid/VisualizeRectilinearGrid/#code","title":"Code","text":"

VisualizeRectilinearGrid.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkRectilinearGrid;\nimport vtk.vtkDoubleArray;\nimport vtk.vtkShrinkFilter;\nimport vtk.vtkDataSetMapper;\n\npublic class VisualizeRectilinearGrid \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    // Create a grid\n    vtkRectilinearGrid grid = new vtkRectilinearGrid();\n\n    grid.SetDimensions(2,3,2);\n\n    vtkDoubleArray xArray = new vtkDoubleArray();\n    xArray.InsertNextValue(0.0);\n    xArray.InsertNextValue(2.0);\n\n    vtkDoubleArray yArray = new vtkDoubleArray();\n    yArray.InsertNextValue(0.0);\n    yArray.InsertNextValue(1.0);\n    yArray.InsertNextValue(2.0);\n\n    vtkDoubleArray zArray = new vtkDoubleArray();\n    zArray.InsertNextValue(0.0);\n    zArray.InsertNextValue(5.0);\n\n    grid.SetXCoordinates(xArray);\n    grid.SetYCoordinates(yArray);\n    grid.SetZCoordinates(zArray);\n\n    vtkShrinkFilter shrinkFilter = new vtkShrinkFilter();\n    shrinkFilter.SetInputData(grid);\n    shrinkFilter.SetShrinkFactor(.8);\n\n    // Create a mapper and actor\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(shrinkFilter.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(actor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Rendering/AmbientSpheres/","title":"AmbientSpheres","text":"

vtk-examples/Java/Rendering/AmbientSpheres

"},{"location":"Java/Rendering/AmbientSpheres/#description","title":"Description","text":"

Note

The original source code for this example is here.

Info

Similar examples setting the diffuse and specular properties are: See DiffuseSpheres.cxx, DiffuseSpheres.py and SpecularSpheres.cxx, SpecularSpheres.py.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Rendering/AmbientSpheres/#code","title":"Code","text":"

AmbientSpheres.java

import vtk.vtkActor;\nimport vtk.vtkLight;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\n\npublic class AmbientSpheres {\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[]{0.1, 0.2, 0.4, 1.0};\n\n    double spheresColor[] = new double[4];\n    colors.GetColor(\"Red\", spheresColor);\n\n    // The following lines create a sphere represented by polygons.\n    //\n    vtkSphereSource SphereSource = new vtkSphereSource();\n    SphereSource.SetThetaResolution(100);\n    SphereSource.SetPhiResolution(50);\n\n    // The mapper is responsible for pushing the geometry into the graphics\n    // library. It may also do color mapping, if scalars or other attributes\n    // are defined.\n    //\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(SphereSource.GetOutputPort());\n\n    // The actor is a grouping mechanism: besides the geometry (mapper), it\n    // also has a property, transformation matrix, and/or texture map.\n    // In this example we create eight different spheres (two rows of four\n    // spheres) and set the specular lighting coefficients. A little ambient\n    // is turned on so the sphere is not completely black on the back side.\n\n    // Since we are using the same sphere source and mapper for all eight spheres\n    // we will use an array.\n    //\n    double ambient = 0.125;\n    double diffuse = 0.0;\n    double specular = 0.0;\n    double position[] = new double[]{0.0, 0.0, 0.0};\n    vtkActor[] Sphere = new vtkActor[8];\n    for (int i = 0; i < 8; ++i) {\n      Sphere[i] = new vtkActor();\n      Sphere[i].SetMapper(sphereMapper);\n      Sphere[i].GetProperty().SetColor(spheresColor);\n      Sphere[i].GetProperty().SetAmbient(ambient);\n      Sphere[i].GetProperty().SetDiffuse(diffuse);\n      Sphere[i].GetProperty().SetSpecular(specular);\n      Sphere[i].AddPosition(position);\n      ambient += 0.125;\n      position[0] += 1.25;\n      if (i == 3) {\n        position[0] = 0;\n        position[1] = 1.25;\n      }\n    }\n\n    // Create the graphics structure. The renderer renders into the\n    // render window. The render window interactor captures mouse events\n    // and will perform appropriate camera or actor manipulation\n    // depending on the nature of the events.\n    //\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the renderer, set the background and size.\n    for (int i = 0; i < 8; ++i) {\n      ren.AddActor(Sphere[i]);\n    }\n    ren.SetBackground(bkg);\n    renWin.SetSize(640, 480);\n\n    // Set up the lighting.\n    vtkLight Light = new vtkLight();\n    Light.SetFocalPoint(1.875, 0.6125, 0);\n    Light.SetPosition(0.875, 1.6125, 1);\n    ren.AddLight(Light);\n\n    // We want to eliminate perspective effects on the apparent lighting.\n    // Parallel camera projection will be used. To zoom in parallel projection\n    // mode, the ParallelScale is set.\n    //\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0);\n    ren.GetActiveCamera().SetPosition(0, 0, 1);\n    ren.GetActiveCamera().SetViewUp(0, 1, 0);\n    ren.GetActiveCamera().ParallelProjectionOn();\n    ren.ResetCamera();\n    ren.GetActiveCamera().SetParallelScale(2.0);\n\n    iren.Initialize();\n    renWin.Render();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Rendering/ColoredSphere/","title":"ColoredSphere","text":"

vtk-examples/Java/Rendering/ColoredSphere

"},{"location":"Java/Rendering/ColoredSphere/#description","title":"Description","text":"

This demonstrates a simple visualization pipeline. A polygonal representation of a sphere is created with the source object (vtkSphereSource). The sphere is passed through a filter (vtkElevationFilter) that computes the height of each point of the sphere above a plane. The plane is perpendicular to the z-axis, and passes through the point (0,0,-1). The data is finally mapped (vtkDataSetMapper) through a lookup table. The mapping process converts height value into colors, and interfaces the sphere geometry to the rendering library. The mapper is assigned to an actor, and then the actor is displayed.

The execution of the pipeline occurs implicitly when we render the actor. Each actor asks its mapper to update itself. The mapper in turn asks its input to update itself. This process continues until a source object is encountered. Then the source will execute if modified since the last render.

Info

See Figure 4-19 in Chapter 4 the VTK Textbook.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Rendering/ColoredSphere/#code","title":"Code","text":"

ColoredSphere.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSphereSource;\nimport vtk.vtkElevationFilter;\n\npublic class ColoredSphere \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n     //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    //  Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetPhiResolution(12); \n    sphere.SetThetaResolution(12);\n\n    vtkElevationFilter colorIt = new vtkElevationFilter();\n    colorIt.SetInputConnection(sphere.GetOutputPort());\n    colorIt.SetLowPoint(0,0,-1);\n    colorIt.SetHighPoint(0,0,1);\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(colorIt.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Rendering/Cone6/","title":"Cone6","text":"

vtk-examples/Java/Rendering/Cone6

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Rendering/Cone6/#code","title":"Code","text":"

Cone6.java

import vtk.vtkActor;\nimport vtk.vtkBoxWidget;\nimport vtk.vtkConeSource;\nimport vtk.vtkInteractorStyleTrackballCamera;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkTransform;\n\n// For writing an image\nimport vtk.vtkPNGWriter;\nimport vtk.vtkWindowToImageFilter;\n\npublic class Cone6 {\n  private static final long serialVersionUID = 1L;\n\n  /**\n   * @param args\n   */\n  // load the necessary interface libraries on first reference to the \n  // class.\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  // create the box widget as an instance variable so we can interact\n  // with it from the interaction call back. \n  vtkBoxWidget boxWidget = null;\n\n  public static void main(String[] args) {\n    // We will start by creating an instance of our Cone6 example\n    // This example uses callbacks, and for Java that requires an instance\n    // object to own the callback logic.\n\n    Cone6 myCone = new Cone6();\n    myCone.doit();\n  }\n\n  // Similar to Step2/Java/Cone2.java, we define a callback for\n  // interaction. In this case we will apply the box transform to the its prop3D. \n  // Java callbacks do not have parameters. \n  void myCallback() {\n    vtkTransform t = new vtkTransform();\n    boxWidget.GetTransform(t);\n    boxWidget.GetProp3D().SetUserTransform(t);\n  }\n\n  /*\n   * The doit() function is simply the instance function to perform the\n   * construction of the vtk pipeline for this example.\n   */\n  void doit() {\n\n    // This example introduces 3D widgets. 3D widgets take advantage of the\n    // event/observer design pattern introduced previously. They typically\n    // have a particular representation in the scene which can be\n    // interactively\n    // selected and manipulated using the mouse and keyboard. As the widgets\n    // are manipulated, they in turn invoke events such as\n    // StartInteractionEvent,\n    // InteractionEvent, and EndInteractionEvent which can be used to\n    // manipulate\n    // the scene that the widget is embedded in. 3D widgets work in the\n    // context\n    // of the event loop which was set up in the previous example.\n    //\n\n    // Next we create an instance of vtkConeSource and set some of its\n    // properties. The instance of vtkConeSource \"cone\" is part of a\n    // visualization pipeline (it is a source process object); it produces\n    // data (output type is vtkPolyData) which other filters may process.\n    vtkConeSource cone = new vtkConeSource();\n    cone.SetHeight(3.0);\n    cone.SetRadius(1.0);\n    cone.SetResolution(10);\n\n    // In this example we terminate the pipeline with a mapper process\n    // object.\n    // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    // between the source and the mapper.) We create an instance of\n    // vtkPolyDataMapper to map the polygonal data into graphics primitives.\n    // We\n    // connect the output of the cone souece to the input of this mapper.\n    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();\n    coneMapper.SetInputData(cone.GetOutput());\n\n    // Create an actor to represent the cone. The actor orchestrates\n    // rendering of\n    // the mapper's graphics primitives. An actor also refers to properties\n    // via a\n    // vtkProperty instance, and includes an internal transformation matrix.\n    // We\n    // set this actor's mapper to be coneMapper which we created above.\n    vtkActor coneActor = new vtkActor();\n    coneActor.SetMapper(coneMapper);\n\n    // Create the Renderer and assign actors to it. A renderer is like a\n    // viewport. It is part or all of a window on the screen and it is\n    // responsible for drawing the actors it has. We also set the\n    // background color here.\n    vtkRenderer ren1 = new vtkRenderer();\n    ren1.AddActor(coneActor);\n    ren1.SetBackground(0.1, 0.2, 0.4);\n\n    // Finally we create the render window which will show up on the screen\n    // We put our renderer into the render window using AddRenderer. We\n    // also set the size to be 300 pixels by 300.\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren1);\n    renWin.SetSize(300, 300);\n\n    // The vtkRenderWindowInteractor class watches for events (e.g.,\n    // keypress,\n    // mouse) in the vtkRenderWindow. These events are translated into\n    // event invocations that VTK understands (see VTK/Common/vtkCommand.h\n    // for all events that VTK processes). Then observers of these VTK\n    // events can process them as appropriate.\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // By default the vtkRenderWindowInteractor instantiates an instance\n    // of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n    // it observes into operations on the camera, actors, and/or properties\n    // in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n    // Here we specify a particular interactor style.\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n\n\n    // Here we use a vtkBoxWidget to transform the underlying coneActor (by\n    // manipulating its transformation matrix). Many other types of widgets\n    // are available for use, see the documentation for more details.\n    //\n    // The SetInteractor method is how 3D widgets are associated with the\n    // render\n    // window interactor. Internally, SetInteractor sets up a bunch of\n    // callbacks\n    // using the Command/Observer mechanism (AddObserver()). The place\n    // factor\n    // controls the initial size of the widget with respect to the bounding\n    // box\n    // of the input to the widget.\n    boxWidget = new vtkBoxWidget();\n    boxWidget.SetInteractor(iren);\n    boxWidget.SetPlaceFactor(1.25);\n\n    // Place the interactor initially. The input to a 3D widget is used to\n    // initially position and scale the widget. The EndInteractionEvent is\n    // observed which invokes the SelectPolygons callback.\n    boxWidget.SetProp3D(coneActor);\n    boxWidget.PlaceWidget();\n\n    // Now for every interaction event that is generated by the boxWidget,\n    // call our callback function.\n    boxWidget.AddObserver(\"InteractionEvent\", this, \"myCallback\");\n\n    // Normally the user presses the \"i\" key to bring a 3D widget to\n    // life. Here we will manually enable it so it appears with the cone.\n    boxWidget.On();\n\n    // Start the event loop.\n    iren.Initialize();\n    renWin.Render();\n    iren.Start();\n\n    // There is no explicit need to free any objects at this point.\n    // Once Java exits, memory is automatically freed.\n\n  }\n\n\n}\n
"},{"location":"Java/Rendering/Mace/","title":"Mace","text":"

vtk-examples/Java/Rendering/Mace

"},{"location":"Java/Rendering/Mace/#description","title":"Description","text":"

An example of multiple inputs and outputs.

Info

See Figure 4-21 in Chapter 4 the VTK Textbook.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Rendering/Mace/#code","title":"Code","text":"

Mace.java

import vtk.vtkActor;\nimport vtk.vtkConeSource;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\n\npublic class Mace \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkSeaGreen\",Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n\n    Sphere.SetPhiResolution(8);\n    Sphere.SetThetaResolution(8);\n\n    //Create a Mapper and Actor for Sphere\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    //create a Cone\n    vtkConeSource Cone = new vtkConeSource();\n    Cone.SetResolution(6);\n\n    vtkGlyph3D Glyph = new vtkGlyph3D();\n    Glyph.SetInputConnection(Sphere.GetOutputPort());\n    Glyph.SetSourceConnection(Cone.GetOutputPort());\n\n    Glyph.SetVectorModeToUseNormal();\n    Glyph.SetScaleModeToScaleByVector();\n    Glyph.SetScaleFactor(0.25);\n\n    vtkPolyDataMapper spikeMapper = new vtkPolyDataMapper();\n    spikeMapper.SetInputConnection(Glyph.GetOutputPort());\n\n    vtkActor spikeActor = new vtkActor();\n    spikeActor.SetMapper(spikeMapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(spikeActor);\n    ren.AddActor(sphereActor);\n\n    ren.SetBackground(Bgcolor);\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Rendering/SpecularSpheres/","title":"SpecularSpheres","text":"

vtk-examples/Java/Rendering/SpecularSpheres

"},{"location":"Java/Rendering/SpecularSpheres/#description","title":"Description","text":"

Note

The original source code for this example is here.

Info

See Figure 3-10 in Chapter 3 the VTK Textbook.

Info

Similar examples setting the ambient and diffuse properties are: See AmbientSpheres.cxx, AmbientSpheres.py, AmbientSpheres.java and DiffuseSpheres.cxx, DiffuseSpheres.py.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Rendering/SpecularSpheres/#code","title":"Code","text":"

SpecularSpheres.java

import vtk.vtkActor;\nimport vtk.vtkLight;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\n\n\npublic class SpecularSpheres \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[]{0.1, 0.2, 0.4, 1.0};\n\n    double spheresColor[] = new double[4];\n    colors.GetColor(\"Red\", spheresColor);\n\n    double specularColor[] = new double[4];\n    colors.GetColor(\"White\", specularColor);\n\n    // The following lines create a sphere represented by polygons.\n    //\n    vtkSphereSource SphereSource = new vtkSphereSource();\n    SphereSource.SetThetaResolution(100);\n    SphereSource.SetPhiResolution(50);\n\n    // The mapper is responsible for pushing the geometry into the graphics\n    // library. It may also do color mapping, if scalars or other attributes\n    // are defined.\n    //\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(SphereSource.GetOutputPort());\n\n    // The actor is a grouping mechanism: besides the geometry (mapper), it\n    // also has a property, transformation matrix, and/or texture map.\n    // In this example we create eight different spheres (two rows of four\n    // spheres) and set the specular lighting coefficients. A little ambient\n    // is turned on so the sphere is not completely black on the back side.\n\n    // Since we are using the same sphere source and mapper for all eight spheres\n    // we will use an array.\n\n    double specularPower;\n    int numberOfSpheres = 8;\n    double ambient = 0.3;\n    double diffuse = 0.5;\n    double specular = 1.0;\n    double spBase = 5.0;\n    double spScale = 1.0;\n    double position[] = new double[]{0.0, 0.0, 0.0};\n    vtkActor[] Sphere = new vtkActor[8];\n    for (int i = 0; i < numberOfSpheres; ++i) \n    {\n      specularPower = spBase * spScale;\n      Sphere[i] = new vtkActor();\n      Sphere[i].SetMapper(sphereMapper);\n      Sphere[i].GetProperty().SetColor(spheresColor);\n      Sphere[i].GetProperty().SetAmbient(ambient);\n      Sphere[i].GetProperty().SetDiffuse(diffuse);\n      Sphere[i].GetProperty().SetSpecular(specular);\n      Sphere[i].GetProperty().SetSpecularPower(specularPower);\n      Sphere[i].GetProperty().SetSpecularColor(specularColor);\n      Sphere[i].AddPosition(position);\n      spScale = spScale * 2.0;\n      position[0] += 1.25;\n      if (i == 3)\n      {\n        specular = 0.5;\n        spScale = 1.0;\n        position[0] = 0;\n        position[1] = 1.25;\n      }\n    }\n\n    // Create the graphics structure. The renderer renders into the\n    // render window. The render window interactor captures mouse events\n    // and will perform appropriate camera or actor manipulation\n    // depending on the nature of the events.\n    //\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the renderer, set the background and size.\n    for (int i = 0; i < numberOfSpheres; ++i) \n    {\n      ren.AddActor(Sphere[i]);\n    }\n    ren.SetBackground(bkg);\n    renWin.SetSize(640, 480);\n\n    // Set up the lighting.\n    vtkLight Light = new vtkLight();\n    Light.SetFocalPoint(1.875, 0.6125, 0);\n    Light.SetPosition(0.875, 1.6125, 1);\n    ren.AddLight(Light);\n\n    // We want to eliminate perspective effects on the apparent lighting.\n    // Parallel camera projection will be used. To zoom in parallel projection\n    // mode, the ParallelScale is set.\n    //\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0);\n    ren.GetActiveCamera().SetPosition(0, 0, 1);\n    ren.GetActiveCamera().SetViewUp(0, 1, 0);\n    ren.GetActiveCamera().ParallelProjectionOn();\n    ren.ResetCamera();\n    ren.GetActiveCamera().SetParallelScale(2.0);\n\n    iren.Initialize();\n    renWin.Render();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/SimpleOperations/DistanceBetweenPoints/","title":"DistanceBetweenPoints","text":"

vtk-examples/Java/SimpleOperations/DistanceBetweenPoints

"},{"location":"Java/SimpleOperations/DistanceBetweenPoints/#description","title":"Description","text":"

This example finds the squared distance and the Euclidean distance between two 3D points.

Other languages

See (Cxx), (Python), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/SimpleOperations/DistanceBetweenPoints/#code","title":"Code","text":"

DistanceBetweenPoints.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkMath;\n\n\npublic class DistanceBetweenPoints \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n      }\n     }\n     vtkNativeLibrary.DisableOutputWindow(null);\n   }\n   // -----------------------------------------------------------------\n\npublic static void main(String s[]) \n{                     \n  // Create two points.\n  double p0[] = new double[] {0.0, 0.0, 0.0};\n  double p1[] = new double[] {1.0, 1.0, 1.0};\n\n  // Find the squared distance between the points.\n  vtkMath squaredDistance = new vtkMath();\n  double squaredDist = squaredDistance.Distance2BetweenPoints(p0, p1);\n\n  // Take the square root to get the Euclidean distance between the points.\n  double distance = Math.sqrt(squaredDist);\n\n  // Output the results.\n  System.out.println(\"Squared Distance:\" + \" \" + squaredDist);\n  System.out.println(\"Distance:\" + \" \" + distance);\n\n }\n}\n
"},{"location":"Java/SimpleOperations/PerspectiveTransform/","title":"PerspectiveTransform","text":"

vtk-examples/Java/SimpleOperations/PerspectiveTransform

Description:

The perspective transform automatically appends the \"homogeneous 1\" to the point before it is multiplied by the matrix. It then divides the first 3 coordinates of the result by the 4th coordinate of the result. For comparison, the standard projection vtkTransform) is also performed with the same matrix and the same point. Note that the results are much different.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/SimpleOperations/PerspectiveTransform/#code","title":"Code","text":"

PerspectiveTransform.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkPerspectiveTransform;\nimport vtk.vtkTransform;\nimport vtk.vtkMatrix4x4;\n\npublic class PerspectiveTransform \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkMatrix4x4 M = new vtkMatrix4x4();\n    M.SetElement(0, 0, 1);\n    M.SetElement(0, 1, 2);\n    M.SetElement(0, 2, 3);\n    M.SetElement(0, 3, 4);\n    M.SetElement(1, 0, 2);\n    M.SetElement(1, 1, 2);\n    M.SetElement(1, 2, 3);\n    M.SetElement(1, 3, 4);\n    M.SetElement(2, 0, 3);\n    M.SetElement(2, 1, 2);\n    M.SetElement(2, 2, 1);\n    M.SetElement(2, 3, 4);\n    M.SetElement(3, 0, 4);\n    M.SetElement(3, 1, 2);\n    M.SetElement(3, 2, 3);\n    M.SetElement(3, 3, 4);\n\n    vtkPerspectiveTransform PT = new vtkPerspectiveTransform();\n    PT.SetMatrix(M);\n\n    vtkTransform Transform = new vtkTransform();\n    Transform.SetMatrix(M);\n\n    double p[] = new double[] {1.0,2.0,3.0};\n\n    double normalProjection[] = new double[3];\n    Transform.TransformPoint(p, normalProjection);\n    System.out.println(normalProjection[0] + \" \" + normalProjection[1] + \" \" + normalProjection[2]);\n\n    double perspectiveProjection[] = new double[3];\n    PT.TransformPoint(p, perspectiveProjection);\n    System.out.println(perspectiveProjection[0] + \" \" + perspectiveProjection[1] + \" \" + perspectiveProjection[2]);\n  }       \n}\n
"},{"location":"Java/SimpleOperations/ProjectPointPlane/","title":"ProjectPointPlane","text":"

vtk-examples/Java/SimpleOperations/ProjectPointPlane

"},{"location":"Java/SimpleOperations/ProjectPointPlane/#description","title":"Description","text":"

vtkPlane object provides methods for various plane computations. These include projecting points onto a plane, evaluating the plane equation, and returning plane normal.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/SimpleOperations/ProjectPointPlane/#code","title":"Code","text":"

ProjectPointPlane.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkPlane;\n\n\npublic class ProjectPointPlane\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {         \n    vtkPlane Plane = new vtkPlane();\n    Plane.SetOrigin(0, 0, 0);\n    Plane.SetNormal(0, 0, 1.0);\n\n    double p[] = new double[] {23.1, 54.6, 9.2};\n    double origin[] = new double[] {0.0, 0.0, 0.0};\n    double normal[] = new double[] {0.0, 0.0, 1.0};\n    double projected[] = new double[3];\n\n    Plane.ProjectPoint(p, origin, normal, projected);\n    System.out.println(\"Projected:\" + \" \" + projected[0] + \" \" + projected[1] + \" \" + projected[2] );\n  }       \n}\n
"},{"location":"Java/SimpleOperations/RandomSequence/","title":"RandomSequence","text":"

vtk-examples/Java/SimpleOperations/RandomSequence

"},{"location":"Java/SimpleOperations/RandomSequence/#description","title":"Description","text":"

vtkMinimalStandardRandomSequence object is a sequence of statistically independent pseudo random numbers uniformly distributed between 0.0 and 1.0.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/SimpleOperations/RandomSequence/#code","title":"Code","text":"

RandomSequence.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkMinimalStandardRandomSequence;\n\n\npublic class RandomSequence \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                   \n    //Create a random sequence generator.\n    vtkMinimalStandardRandomSequence Sequence = new vtkMinimalStandardRandomSequence();\n    //initialize the sequence\n    Sequence.SetSeed(1);\n\n    //Get 3 random numbers.\n    double x = Sequence.GetValue();\n    Sequence.Next();\n    double y = Sequence.GetValue();\n    Sequence.Next();\n    double z = Sequence.GetValue();\n    Sequence.Next();\n\n    // You can also use Sequence.GetRangeValue(-1.0, 1.0) to set a range on the random values.\n\n    System.out.println(\"X:\"+x + \"\\n\" + \"Y:\" + y + \"\\n\" + \"Z:\"+ z);\n\n  }       \n}\n
"},{"location":"Java/Snippets/WriteImage/","title":"Description","text":"

Given a filename, render window and optionally a rgba value, take a screenshot of the render window and write it to a file.

After using it, remove the function and the corresponding call.

Typical usage would be:

  // ...\n  renWin.Render();\n  // After creating the test image, this line must be removed.\n  writeImage(renWin, \"Test<Name of the Java File>.png\");\n\n  iren.Initialize();\n  iren.Start();\n

These imports are needed.

// For writing an image\nimport vtk.vtkPNGWriter;\nimport vtk.vtkWindowToImageFilter;\n

To use the snippet, click the Copy to clipboard at the upper left of the code blocks.

"},{"location":"Java/Snippets/WriteImage/#java","title":"Java","text":""},{"location":"Java/Snippets/WriteImage/#declaration-section","title":"Declaration Section","text":"
/**\n  * Write the render window to a PNG file.\n  * <p>\n  * After creating the image, this function should be removed.\n  *\n  * @param renWin The render window\n  * @param fn     The name of the image file.\n  */\npublic static void writeImage(vtkRenderWindow renWin, String fn) {\n  vtkWindowToImageFilter windowToImageFilter = new vtkWindowToImageFilter();\n  windowToImageFilter.SetInput(renWin);\n  windowToImageFilter.SetScale(1);\n  windowToImageFilter.SetInputBufferTypeToRGB();\n\n  windowToImageFilter.ReadFrontBufferOff();\n  windowToImageFilter.Update();\n\n  vtkPNGWriter writer = new vtkPNGWriter();\n  writer.SetFileName(fn);\n  writer.SetInputConnection(windowToImageFilter.GetOutputPort());\n  writer.Write();\n}\n
"},{"location":"Java/Snippets/WriteImage/#usage","title":"Usage","text":"
  // After creating the test image, this line must be removed.\n  writeImage(renWin, \"Test<Name of the Java File>.png\");\n
"},{"location":"Java/StructuredGrid/BlankPoint/","title":"BlankPoint","text":"

vtk-examples/Java/StructuredGrid/BlankPoint

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/StructuredGrid/BlankPoint/#code","title":"Code","text":"

BlankPoint.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkStructuredGrid;\nimport vtk.vtkPoints;\nimport vtk.vtkDataSetMapper;\n\npublic class BlankPoint {\n\n    // -----------------------------------------------------------------\n      // Load VTK library and print which library was not properly loaded\n      static \n      {\n        if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n        {\n          for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n          {\n            if (!lib.IsLoaded()) \n            {\n              System.out.println(lib.GetLibraryName() + \" not loaded\");\n            }\n          }\n        }\n        vtkNativeLibrary.DisableOutputWindow(null);\n      }\n      // -----------------------------------------------------------------\n\n\n      public static void main(String args[]) \n      {\n\n        vtkNamedColors colors = new vtkNamedColors();\n\n        //Renderer Background Color\n        double Bgcolor[] = new double[4];\n\n        colors.GetColor(\"Seagreen\", Bgcolor);\n\n        // Create a grid\n        vtkStructuredGrid structuredGrid = new vtkStructuredGrid();\n\n        vtkPoints points = new vtkPoints();\n\n        int gridSize = 8;\n        int counter = 0;\n        // Create a 5x5 grid of points\n        for( int j = 0; j < gridSize; j++)\n        {\n          for( int i = 0; i < gridSize; i++)\n          {\n            if(i == 3 && j == 3) // Make one point higher than the rest\n            {\n              points.InsertNextPoint(i, j, 2);\n              System.out.println(\"The different point is number \" + \" \" + counter );\n            }\n            else\n            {\n              points.InsertNextPoint(i, j, 0); // Make most of the points the same height\n            }\n            counter++;\n          }\n        }\n\n        // Specify the dimensions of the grid\n        structuredGrid.SetDimensions(gridSize,gridSize,1);\n\n        structuredGrid.SetPoints(points);\n\n        structuredGrid.BlankPoint(27);\n        structuredGrid.Modified();\n\n        // Create a mapper and actor\n        vtkDataSetMapper gridMapper = new vtkDataSetMapper();\n        gridMapper.SetInputData(structuredGrid);\n\n        vtkActor gridActor = new vtkActor();\n        gridActor.SetMapper(gridMapper);\n        gridActor.GetProperty().EdgeVisibilityOn();\n        gridActor.GetProperty().SetEdgeColor(0,0,1);\n\n\n        // Create the renderer, render window and interactor.\n        vtkRenderer ren = new vtkRenderer();\n        vtkRenderWindow renWin = new vtkRenderWindow();\n        renWin.AddRenderer(ren);\n        vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n        iren.SetRenderWindow(renWin);\n\n        // Visualise\n        ren.AddActor(gridActor);\n\n        ren.SetBackground(Bgcolor);\n\n        renWin.SetSize(300, 300);\n        renWin.Render();\n\n        iren.Initialize();\n        iren.Start();\n      }\n\n}\n
"},{"location":"Java/StructuredGrid/StructuredGridOutline/","title":"StructuredGridOutline","text":"

vtk-examples/Java/StructuredGrid/StructuredGridOutline

"},{"location":"Java/StructuredGrid/StructuredGridOutline/#description","title":"Description","text":"

[vtkStructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkStructuredGrid.html#details)OutlineFilter object is a filter that generates a wireframe outline of a structured grid (vtkStructuredGrid).

Structured data is topologically a cube, so the outline will have 12 \"edges\".

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/StructuredGrid/StructuredGridOutline/#code","title":"Code","text":"

StructuredGridOutline.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkStructuredGrid;\nimport vtk.vtkPoints;\nimport vtk.vtkStructuredGridOutlineFilter;\nimport vtk.vtkActor;\nimport vtk.vtkPolyDataMapper;\n\npublic class StructuredGridOutline \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //  Create a grid\n    vtkStructuredGrid structuredGrid = new vtkStructuredGrid();\n\n    vtkPoints points = new vtkPoints();\n    int numi = 2;\n    int numj = 3;\n    int numk = 2;\n\n    for(int k = 0; k < numk; k++)\n    {\n      for(int j = 0; j < numj; j++)\n      {\n        for(int i = 0; i < numi; i++)\n        {\n          points.InsertNextPoint(i, j, k);\n        }\n      }\n    }\n\n    //specify the dimensions of the grid\n    structuredGrid.SetDimensions(numi, numj, numk);\n    structuredGrid.SetPoints(points);\n\n    System.out.println(\"There are \" + \" \" + structuredGrid.GetNumberOfPoints() + \" \" + \"points.\");\n    System.out.println(\"There are \" + \" \" + structuredGrid.GetNumberOfCells() + \" \" + \"cells.\");\n\n    vtkStructuredGridOutlineFilter outlineFilter = new vtkStructuredGridOutlineFilter();\n    outlineFilter.SetInputData(structuredGrid);\n    outlineFilter.Update();\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(outlineFilter.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/StructuredPoints/StructuredPointsToUnstructuredGrid/","title":"StructuredPointsToUnstructuredGrid","text":"

vtk-examples/Java/StructuredPoints/StructuredPointsToUnstructuredGrid

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/StructuredPoints/StructuredPointsToUnstructuredGrid/#code","title":"Code","text":"

StructuredPointsToUnstructuredGrid.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkStructuredPoints;\nimport vtk.vtkPoints;\nimport vtk.vtkUnstructuredGrid;\nimport vtk.vtkXMLUnstructuredGridWriter;\n\npublic class StructuredPointsToUnstructuredGrid \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtu) e.g output.vtu\");\n      return;\n    }\n    String outputFilename = args[0];\n\n    // Create a structuredpoints\n    vtkStructuredPoints structuredPoints = new vtkStructuredPoints();\n\n    // Specify the size of the image data\n    structuredPoints.SetDimensions(2,3,1);\n    int VTK_DOUBLE = 11;\n    structuredPoints.AllocateScalars(VTK_DOUBLE,1);\n\n    int dims[] = new int[3];\n    dims=structuredPoints.GetDimensions();\n\n    System.out.println(\"Dims: \" + \"\\n\" + \" x: \" + \" \" + dims[0] + \" \" +  \" y: \" + dims[1] + \" z: \" + \" \" + dims[2] );\n    System.out.println(\"Number of points: \" + \" \" + structuredPoints.GetNumberOfPoints());\n    System.out.println(\"Number of cells: \" + \" \" + structuredPoints.GetNumberOfCells());\n\n    // Copy the points from the StructuredPoints to the UnstructuredGrid\n    vtkPoints points = new vtkPoints();\n\n    //retrieve the entries from the grid and print them to the screen\n    double p[] = new double[3];\n    for(int i = 0; i < structuredPoints.GetNumberOfPoints(); i++)\n    {\n      structuredPoints.GetPoint(i, p);\n      points.InsertNextPoint(p);\n    }\n\n    vtkUnstructuredGrid ug = new vtkUnstructuredGrid();\n    ug.SetPoints(points);\n\n    vtkXMLUnstructuredGridWriter writer = new vtkXMLUnstructuredGridWriter();\n    writer.SetFileName(outputFilename);\n    writer.SetInputData(ug);\n    writer.Write();\n\n  }\n}\n
"},{"location":"Java/StructuredPoints/Vol/","title":"Vol","text":"

vtk-examples/Java/StructuredPoints/Vol

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/StructuredPoints/Vol/#code","title":"Code","text":"

Vol.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkStructuredPoints;\nimport vtk.vtkDoubleArray;\nimport vtk.vtkContourFilter;\n\npublic class Vol \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    int i, j, k, kOffset, jOffset, offset;\n    double x, y, z, sp;\n    double s;\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Salmon\", actorColor);\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    vtkStructuredPoints vol = new vtkStructuredPoints();\n    vol.SetDimensions(26,26,26);\n    vol.SetOrigin(-0.5,-0.5,-0.5);\n    sp = 1.0/25.0;\n    vol.SetSpacing(sp, sp, sp);\n\n    vtkDoubleArray scalars = new vtkDoubleArray();\n    scalars.SetNumberOfComponents(1);\n    scalars.SetNumberOfTuples(26*26*26);\n    for (k=0; k<26; k++)\n    {\n     z = -0.5 + k*sp;\n     kOffset = k * 26 * 26;\n     for (j=0; j<26; j++) \n     {\n      y = -0.5 + j*sp;\n      jOffset = j * 26;\n      for (i=0; i<26; i++) \n      {\n       x = -0.5 + i*sp;\n       s = x*x + y*y + z*z - (0.4*0.4);\n       offset = i + jOffset + kOffset;\n       scalars.InsertTuple1(offset, s);\n      }\n     }\n    }\n\n    vol.GetPointData().SetScalars(scalars);\n    vtkContourFilter contour = new vtkContourFilter();\n    contour.SetInputData(vol);\n    contour.SetValue(0,0.0);\n\n    vtkPolyDataMapper volMapper = new vtkPolyDataMapper();\n    volMapper.SetInputConnection(contour.GetOutputPort());\n    volMapper.ScalarVisibilityOff();\n\n    vtkActor volActor = new vtkActor();\n    volActor.SetMapper(volMapper);\n    volActor.GetProperty().EdgeVisibilityOn();\n    volActor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(volActor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/SwingIntegration/JFrameRenderer/","title":"JFrameRenderer","text":"

vtk-examples/Java/SwingIntegration/JFrameRenderer

"},{"location":"Java/SwingIntegration/JFrameRenderer/#description","title":"Description","text":"

This example shows how to render a VTK scene in a JFrame using a vtkRenderWindowPanel.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/SwingIntegration/JFrameRenderer/#code","title":"Code","text":"

JFrameRenderer.java

import java.awt.*;\nimport javax.swing.*;\n\nimport vtk.*;\n\npublic class JFrameRenderer extends JFrame {\n\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  private vtkRenderWindowPanel renderWindowPanel;\n\n  public JFrameRenderer() {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[4];\n    double actorColor[] = new double[4];\n    colors.GetColor(\"RoyalBlue\", bkg);\n    colors.GetColor(\"LemonChiffon\", actorColor);\n\n    // Create a sphere source\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetRadius(10.0);\n\n    // Create a sphere mapper\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(sphere.GetOutputPort());\n\n    //create sphere actor\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n    sphereActor.GetProperty().SetColor(actorColor);\n\n    // Create a render window panel to display the sphere\n    renderWindowPanel = new vtkRenderWindowPanel();\n    renderWindowPanel.setPreferredSize(new Dimension(600, 600));\n    renderWindowPanel.setInteractorStyle(new vtkInteractorStyleTrackballCamera());\n\n    add(renderWindowPanel, BorderLayout.CENTER);\n\n    renderWindowPanel.GetRenderer().AddActor(sphereActor);\n    renderWindowPanel.GetRenderer().SetBackground(bkg);\n  }\n\n  public static void main(String[] args) {\n    try {\n      SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JPopupMenu.setDefaultLightWeightPopupEnabled(false);\n          ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);\n\n          JFrame frame = new JFrameRenderer();\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.pack();\n          frame.setVisible(true);\n          ((JFrameRenderer) frame).render();\n        }\n      });\n    } catch (Exception e) {\n      e.printStackTrace();\n    }\n  }\n\n  public void render() {\n    renderWindowPanel.Render();\n  }\n}\n
"},{"location":"Java/SwingIntegration/SwingHandleMouseEvent/","title":"SwingHandleMouseEvent","text":"

vtk-examples/Java/SwingIntegration/SwingHandleMouseEvent

"},{"location":"Java/SwingIntegration/SwingHandleMouseEvent/#description","title":"Description","text":"

This example shows how to display in a JLabel the point the mouse is hovering over using a mouse listener.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/SwingIntegration/SwingHandleMouseEvent/#code","title":"Code","text":"

SwingHandleMouseEvent.java

import java.awt.*;\nimport java.awt.event.*;\nimport javax.swing.*;\nimport javax.swing.border.*;\n\nimport vtk.*;\n\npublic class SwingHandleMouseEvent extends JFrame {\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public SwingHandleMouseEvent() {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[4];\n    double actorColor[] = new double[4];\n    colors.GetColor(\"RoyalBlue\", bkg);\n    colors.GetColor(\"LemonChiffon\", actorColor);\n\n    // Create a sphere source\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetRadius(10.0);\n\n    // Create a sphere mapper\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(sphere.GetOutputPort());\n\n    //create sphere actor\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n    sphereActor.GetProperty().SetColor(actorColor);\n\n    // Create a render window panel to display the sphere\n    final vtkRenderWindowPanel renderWindowPanel = new vtkRenderWindowPanel();\n    renderWindowPanel.setPreferredSize(new Dimension(600, 600));\n    renderWindowPanel.setInteractorStyle(new vtkInteractorStyleTrackballCamera());\n\n    add(renderWindowPanel, BorderLayout.CENTER);\n\n    renderWindowPanel.GetRenderer().AddActor(sphereActor);\n    renderWindowPanel.GetRenderer().SetBackground(bkg);\n\n    // Create a status bar\n    JPanel statusBar = new JPanel(new BorderLayout());\n    final JLabel label = new JLabel(\" \", SwingConstants.RIGHT);\n    statusBar.add(label, BorderLayout.EAST);\n    statusBar.setBorder(new BevelBorder(BevelBorder.LOWERED));\n\n    add(statusBar, BorderLayout.SOUTH);\n\n    final vtkCellPicker cellPicker = new vtkCellPicker();\n\n    // Show the point on the sphere the mouse is hovering over in the status bar\n    renderWindowPanel.addMouseMotionListener(new MouseMotionAdapter() {\n      public void mouseMoved(MouseEvent e) {\n        // The call to Pick needs to be surrounded by lock and unlock to prevent crashes.\n        renderWindowPanel.lock();\n        int pickSucceeded = cellPicker.Pick(e.getX(), renderWindowPanel.getHeight() - e.getY() - 1,\n            0.0, renderWindowPanel.GetRenderer());\n        renderWindowPanel.unlock();\n\n        if (pickSucceeded == 1) {\n          double[] p = cellPicker.GetPickPosition();\n          label.setText(\"Position: \" + p[0] + \", \" + p[1] + \", \" + p[2]);\n        } else {\n          label.setText(\" \");\n        }\n      }\n    });\n  }\n\n  public static void main(String[] args) {\n    try {\n      SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JPopupMenu.setDefaultLightWeightPopupEnabled(false);\n          ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);\n\n          JFrame frame = new SwingHandleMouseEvent();\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.pack();\n          frame.setVisible(true);\n        }\n      });\n    } catch (Exception e) {\n      e.printStackTrace();\n    }\n  }\n}\n
"},{"location":"Java/Texture/TexturePlane/","title":"TexturePlane","text":"

vtk-examples/Java/Texture/TexturePlane

"},{"location":"Java/Texture/TexturePlane/#description","title":"Description","text":"

vtkTexture is an object that handles loading and binding of texture maps.

It obtains its data from an input image data dataset type. Thus you can create visualization pipelines to read, process, and construct textures. Note that textures will only work if texture coordinates are also defined, and if the rendering system supports texture.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Texture/TexturePlane/#code","title":"Code","text":"

TexturePlane.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageReader2Factory;\nimport vtk.vtkImageReader2;\nimport vtk.vtkTexture;\nimport vtk.vtkPlaneSource;\n\npublic class TexturePlane \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.bmp) e.g masonry.bmp\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    vtkImageReader2Factory readerFactory = new vtkImageReader2Factory();\n    vtkImageReader2 textureFile = new vtkImageReader2();\n    textureFile = readerFactory.CreateImageReader2(inputFilename);\n    textureFile.SetFileName(inputFilename);\n    textureFile.Update();\n\n    vtkTexture atext = new vtkTexture();\n    atext.SetInputConnection(textureFile.GetOutputPort());\n    atext.InterpolateOn();\n\n    // Create a plane source and actor. The vtkPlanesSource generates texture coordinates.\n\n    vtkPlaneSource plane = new vtkPlaneSource();\n\n    vtkPolyDataMapper  planeMapper = new vtkPolyDataMapper();\n    planeMapper.SetInputConnection(plane.GetOutputPort());\n\n    vtkActor planeActor = new vtkActor();\n    planeActor.SetMapper(planeMapper);\n    planeActor.SetTexture(atext);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // VisualiZe\n    ren.AddActor(planeActor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    ren.ResetCamera();\n    ren.GetActiveCamera().Elevation(-30);\n    ren.GetActiveCamera().Roll(-20);\n    ren.ResetCameraClippingRange();\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Texture/TexturedSphere/","title":"TexturedSphere","text":"

vtk-examples/Java/Texture/TexturedSphere

"},{"location":"Java/Texture/TexturedSphere/#description","title":"Description","text":"

vtkTexturedSphereSource object creates a polygonal sphere of specified radius centered at the origin.

The resolution (polygonal discretization) in both the latitude (phi) and longitude (theta) directions can be specified. It also is possible to create partial sphere by specifying maximum phi and theta angles.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Texture/TexturedSphere/#code","title":"Code","text":"

TexturedSphere.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkTexturedSphereSource;\nimport vtk.vtkImageReader2Factory;\nimport vtk.vtkTexture;\nimport vtk.vtkImageReader2;\nimport vtk.vtkTransformTextureCoords;\n\npublic class TexturedSphere \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length < 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.png or .ppm) translate e.g earth.ppm 0 \");\n      return;\n    }\n    double translate[] = new double[3];\n    String inputFilename = args[0];\n\n    if (args.length > 1)\n    {\n        translate[0] = Double.parseDouble(args[1]);\n    }\n    else \n    {\n        translate[0] = 0.0;\n    }\n    translate[1] = 0.0;\n    translate[2] = 0.0;\n\n    System.out.print(translate[0] + \" \" + translate[1] + \" \" + translate[2] + \"\\n\");\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create a sphere with texture coordinates\n    vtkTexturedSphereSource source = new vtkTexturedSphereSource();\n    source.SetPhiResolution(40);\n    source.SetThetaResolution(40);\n\n    // Read texture file\n    vtkImageReader2Factory readerFactory = new vtkImageReader2Factory();\n    vtkImageReader2 imageReader = new vtkImageReader2();\n    imageReader = readerFactory.CreateImageReader2(inputFilename);\n    imageReader.SetFileName(inputFilename);\n\n    // Create texture\n    vtkTexture texture = new vtkTexture();\n    texture.SetInputConnection(imageReader.GetOutputPort());\n\n    vtkTransformTextureCoords transformTexture = new vtkTransformTextureCoords();\n    transformTexture.SetInputConnection(source.GetOutputPort());\n    transformTexture.SetPosition(translate);\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(transformTexture.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.SetTexture(texture);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Utilities/BrownianPoints/","title":"BrownianPoints","text":"

vtk-examples/Java/Utilities/BrownianPoints

"},{"location":"Java/Utilities/BrownianPoints/#description","title":"Description","text":"

vtkBrownianPoints object is a filter object that assigns a random vector (i.e., magnitude and direction) to each point.

The minimum and maximum speed values can be controlled by the user.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/BrownianPoints/#code","title":"Code","text":"

BrownianPoints.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSphereSource;\nimport vtk.vtkArrowSource;\nimport vtk.vtkBrownianPoints;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkMath;\n\npublic class BrownianPoints \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Actor Color\n    double glyphActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Banana\",glyphActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    //Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n\n    //Generate random vectors\n    vtkMath math = new vtkMath( );\n    math.RandomSeed(5070); // for testing\n    vtkBrownianPoints brownianPoints = new vtkBrownianPoints();\n    brownianPoints.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkArrowSource arrowSource = new vtkArrowSource();\n\n    vtkGlyph3D glyph3D = new vtkGlyph3D();\n    glyph3D.SetSourceConnection(arrowSource.GetOutputPort());\n    glyph3D.SetInputConnection(brownianPoints.GetOutputPort());\n    glyph3D.SetScaleFactor(.3);\n\n    //Create a mapper and actor for sphere\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.GetProperty().EdgeVisibilityOn();\n    actor.GetProperty().SetInterpolationToFlat();\n    actor.SetMapper(mapper);\n\n    //Create a mapper and actor for glyphs\n    vtkPolyDataMapper glyphMapper = new vtkPolyDataMapper();\n    glyphMapper.SetInputConnection(glyph3D.GetOutputPort());\n\n    vtkActor glyphActor = new vtkActor();\n    glyphActor.GetProperty().SetColor(glyphActorColor);\n    glyphActor.SetMapper(glyphMapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.AddActor(glyphActor);\n\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(30    );\n    ren.GetActiveCamera().Elevation(30);\n    ren.GetActiveCamera().Dolly(1.4);\n    ren.ResetCameraClippingRange();\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Utilities/ColorLookupTable/","title":"ColorLookupTable","text":"

vtk-examples/Java/Utilities/ColorLookupTable

"},{"location":"Java/Utilities/ColorLookupTable/#description","title":"Description","text":"

This example shows how to create a table of colors that map from a continuous range of values.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/ColorLookupTable/#code","title":"Code","text":"

ColorLookupTable.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkLookupTable;\n\npublic class ColorLookupTable\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \"not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // ------------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkLookupTable lookupTable = new vtkLookupTable();\n    lookupTable.SetTableRange(0.0, 10.0);\n    // If you don't want to use the whole color range, you can use\n    // SetValueRange, SetHueRange, and SetSaturationRange\n    lookupTable.Build();\n\n    double color[] = new double[3];\n    lookupTable.GetColor(1.0, color);\n\n    System.out.println(color[0]  + \" \" + color[1] + \" \" + color[2]);\n\n    lookupTable.GetColor(5.0, color);\n\n    System.out.println(color[0]  + \" \" + color[1] + \" \" + color[2]);\n\n  }\n}\n
"},{"location":"Java/Utilities/DiscretizableColorTransferFunction/","title":"DiscretizableColorTransferFunction","text":"

vtk-examples/Java/Utilities/DiscretizableColorTransferFunction

"},{"location":"Java/Utilities/DiscretizableColorTransferFunction/#description","title":"Description","text":"

vtkDiscretizableColorTransferFunction object is a cross between a vtkColorTransferFunction and vtkLookupTable selectively combining the functionality of both.

This class is a vtkColorTransferFunction allowing users to specify the RGB control points that control the color transfer function. At the same time, by setting Discretize to 1 (true), one can force the transfer function to only have NumberOfValues discrete colors.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/DiscretizableColorTransferFunction/#code","title":"Code","text":"

DiscretizableColorTransferFunction.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkDiscretizableColorTransferFunction;\n\npublic class DiscretizableColorTransferFunction \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  { \n   vtkDiscretizableColorTransferFunction discretizableColorTransferFunction = new vtkDiscretizableColorTransferFunction();\n   discretizableColorTransferFunction.DiscretizeOn();\n   discretizableColorTransferFunction.SetNumberOfValues(2);\n\n   discretizableColorTransferFunction.AddRGBPoint(0.0, 1, 0, 0);\n   discretizableColorTransferFunction.AddRGBPoint(10.0, 0, 1, 0);\n   discretizableColorTransferFunction.Build();\n\n   double color[] = new double[3];\n   discretizableColorTransferFunction.GetColor(1.0, color);\n\n   System.out.println(color[0] +\" \" + color[1] + \" \" + color[2]);\n\n   discretizableColorTransferFunction.GetColor(5.0, color);\n   System.out.println(color[0] +\" \" + color[1] + \" \" + color[2]);   \n  }\n}\n
"},{"location":"Java/Utilities/FullScreen/","title":"FullScreen","text":"

vtk-examples/Java/Utilities/FullScreen

"},{"location":"Java/Utilities/FullScreen/#description","title":"Description","text":"

Example Program to Demonstrate Full Screen Render Window.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/FullScreen/#code","title":"Code","text":"

FullScreen.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkSphereSource;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\n\n\npublic class FullScreen \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n   }\n   vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  //-----------------------------------------------------------------\n\n public static void main(String s[]) \n {\n   // Create a sphere\n   vtkSphereSource SphereSource = new vtkSphereSource();\n   SphereSource.Update();\n\n   vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n   Mapper.SetInputConnection(SphereSource.GetOutputPort());\n\n  vtkActor Actor = new vtkActor();\n  Actor.SetMapper(Mapper);\n\n  // Create the renderer, render window and interactor.\n  vtkRenderer ren = new vtkRenderer();\n  vtkRenderWindow renWin = new vtkRenderWindow();\n  renWin.AddRenderer(ren);\n  vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n  iren.SetRenderWindow(renWin);\n\n  // Visualise Sphere in full screen window\n  ren.AddActor(Actor);\n  renWin.Render();\n  renWin.SetFullScreen(1);\n  ren.ResetCamera();\n  ren.ResetCameraClippingRange();\n\n  iren.Initialize();\n  iren.Start();\n }\n}\n
"},{"location":"Java/Utilities/FunctionParser/","title":"FunctionParser","text":"

vtk-examples/Java/Utilities/FunctionParser

"},{"location":"Java/Utilities/FunctionParser/#description","title":"Description","text":"

vtkFunctionParser object that takes in a mathematical expression as a char string, parses it, and evaluates it at the specified values of the variables in the input string.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/FunctionParser/#code","title":"Code","text":"

FunctionParser.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkFunctionParser;\n\npublic class FunctionParser \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n   vtkFunctionParser functionParser = new vtkFunctionParser();\n   functionParser.SetFunction(\"a+b\");\n   functionParser.SetScalarVariableValue( \"a\", 2);\n   functionParser.SetScalarVariableValue( \"b\", 3);\n\n   double result = functionParser.GetScalarResult();\n\n   System.out.println(\"Result:\" +\" \" +result);\n  }\n}\n
"},{"location":"Java/Utilities/GetDataRoot/","title":"GetDataRoot","text":"

vtk-examples/Java/Utilities/GetDataRoot

"},{"location":"Java/Utilities/GetDataRoot/#description","title":"Description","text":"

vtkTesting object is a unified VTK regression testing framework.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/GetDataRoot/#code","title":"Code","text":"

GetDataRoot.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkTesting;\n\npublic class GetDataRoot \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n   vtkTesting testHelper = new vtkTesting();\n   String dataRoot = testHelper.GetDataRoot();\n\n   System.out.print(\"DataRoot:\" + \" \" + dataRoot);\n  }\n}\n
"},{"location":"Java/Utilities/KnownLengthArray/","title":"KnownLengthArray","text":"

vtk-examples/Java/Utilities/KnownLengthArray

"},{"location":"Java/Utilities/KnownLengthArray/#description","title":"Description","text":"

This example creates a VTK style float array. This can be easily interchanged with vtkIntArray, vtkDoubleArray, etc.

The terminology is as follows:

  • SetNumberOfComponents(): sets the number of elements that a tuple in the array will have. See VectorArrayKnownLength for an example with tuples with more than one element.

  • SetNumberOfValues(): sets the number of tuples the array will have. See UnknownLengthArray for an example where the number of values is not known in advance.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/KnownLengthArray/#code","title":"Code","text":"

KnownLengthArray.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkFloatArray;\n\npublic class KnownLengthArray \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n //-----------------------------------------------------------------\n public static void main(String s[]) \n {  \n    vtkFloatArray Distances = new vtkFloatArray();\n    Distances.SetName(\"Distances\");\n    Distances.SetNumberOfComponents(1);\n    Distances.SetNumberOfValues(5);\n\n    //set values\n    for(int i = 0; i < Distances.GetNumberOfTuples(); i++)\n    {\n      double f = i + 0.1;\n      Distances.SetValue(i, f);\n    }\n\n    //get values\n    for(int i = 0; i < Distances.GetNumberOfTuples(); i++)\n    {\n      double f = Distances.GetValue(i);\n      System.out.println(f);\n    }       \n\n  }\n}\n
"},{"location":"Java/Utilities/PiecewiseFunction/","title":"PiecewiseFunction","text":"

vtk-examples/Java/Utilities/PiecewiseFunction

"},{"location":"Java/Utilities/PiecewiseFunction/#description","title":"Description","text":"

vtkPiecewiseFunction object defines a piecewise function mapping. This mapping allows the addition of control points, and allows the user to control the function between the control points.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/PiecewiseFunction/#code","title":"Code","text":"

PiecewiseFunction.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkPiecewiseFunction;\n\npublic class PiecewiseFunction \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n   vtkPiecewiseFunction piecewiseFunction = new vtkPiecewiseFunction();\n   piecewiseFunction.AddPoint(0.0, 0.0);\n   piecewiseFunction.AddPoint(1.0, 2.0);\n\n   double test = piecewiseFunction.GetValue(0.25);\n\n   System.out.println( \"Test: \"  + \" \" + test); //(should be 0.5)\n  }\n}\n
"},{"location":"Java/Utilities/ReportRenderWindowCapabilities/","title":"ReportRenderWindowCapabilities","text":"

vtk-examples/Java/Utilities/ReportRenderWindowCapabilities

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/ReportRenderWindowCapabilities/#code","title":"Code","text":"

ReportRenderWindowCapabilities.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\nimport vtk.vtkConeSource;\n\npublic class ReportRenderWindowCapabilities \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n   //Create a cone\n   vtkConeSource coneSource = new vtkConeSource();\n   coneSource.Update();\n\n   //Create a mapper and actor\n   vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n   mapper.SetInputConnection(coneSource.GetOutputPort());\n\n   vtkActor actor = new vtkActor();\n   actor.SetMapper(mapper);\n\n   // Create the renderer, render window\n   vtkRenderer ren = new vtkRenderer();\n   vtkRenderWindow renWin = new vtkRenderWindow();\n   renWin.AddRenderer(ren);\n\n   ren.AddActor(actor);\n\n   renWin.Render();\n\n   System.out.println(renWin.ReportCapabilities());\n  }\n}\n
"},{"location":"Java/Utilities/Screenshot/","title":"Screenshot","text":"

vtk-examples/Java/Utilities/Screenshot

"},{"location":"Java/Utilities/Screenshot/#description","title":"Description","text":"

vtkWindowToImageFilter object provides methods needed to read the data in a vtkWindow and use it as input to the imaging pipeline.

This is useful for saving an image to a file for example. The window can be read as either RGB or RGBA pixels

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/Screenshot/#code","title":"Code","text":"

Screenshot.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkPNGWriter;\nimport vtk.vtkWindowToImageFilter;\n\npublic class Screenshot \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void writeImage(vtkRenderWindow renWin, String fn) \n  { \n    vtkWindowToImageFilter windowToImageFilter = new vtkWindowToImageFilter();\n    windowToImageFilter.SetInput(renWin);\n    windowToImageFilter.SetScale(1);\n    windowToImageFilter.SetInputBufferTypeToRGB();\n\n    windowToImageFilter.ReadFrontBufferOff();\n    windowToImageFilter.Update();\n\n    vtkPNGWriter writer = new vtkPNGWriter();\n    writer.SetFileName(fn);\n    writer.SetInputConnection(windowToImageFilter.GetOutputPort());\n    writer.Write();\n  }\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.png) e.g screenshot.png\");\n      return;\n    }\n    String fileName = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource.SetRadius(4.0);\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper  = new vtkPolyDataMapper();\n    sphereMapper.SetInputData (sphereSource.GetOutput());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetAlphaBitPlanes(1);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    writeImage(renWin, fileName);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Utilities/TimerLog/","title":"TimerLog","text":"

vtk-examples/Java/Utilities/TimerLog

"},{"location":"Java/Utilities/TimerLog/#description","title":"Description","text":"

Example to Demonstrate Timer support and logging.

The object [vtkTimerLog](https://www.vtk.org/doc/nightly/html/classvtkTimerLog.html#details) contains walltime and cputime measurements associated with a given event.

These results can be later analyzed when \"dumping out\" the table. In addition, vtkTimerLog allows the user to simply get the current time, and to start/stop a simple timer that is separate from the timing table logging.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/TimerLog/#code","title":"Code","text":"

TimerLog.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkTimerLog;\n\npublic class TimerLog \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  //-----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkTimerLog TimerLog = new vtkTimerLog();\n\n    System.out.println(\"Current Time:\" + TimerLog.GetUniversalTime());\n    TimerLog.MarkEvent(\"File Opened\");\n    TimerLog.MarkEvent(\"Did Somthing\");\n    System.out.println(\"Timer Log:\" + TimerLog);         \n  }\n}\n
"},{"location":"Java/Utilities/UnknownLengthArray/","title":"UnknownLengthArray","text":"

vtk-examples/Java/Utilities/UnknownLengthArray

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Utilities/UnknownLengthArray/#code","title":"Code","text":"

UnknownLengthArray.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkFloatArray;\n\npublic class UnknownLengthArray \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  //-----------------------------------------------------------------\n\n  public static void main(String s[]) \n  { \n    vtkFloatArray Distances = new vtkFloatArray();\n    Distances.SetName(\"Distances\");\n    Distances.SetNumberOfComponents(1);\n    //set values\n    for(int i = 0; i < 5; i++)\n    {\n      double f = i + 0.1;\n      //this will allocate memory as necessary\n      Distances.InsertNextValue(f);\n    }\n    //get values\n    for(int i = 0; i <Distances.GetNumberOfTuples(); i++)\n    {\n      double f = Distances.GetValue(i);\n      System.out.println(f);\n    }       \n  }\n}\n
"},{"location":"Java/Video/OggTheora/","title":"OggTheora","text":"

vtk-examples/Java/Video/OggTheora

"},{"location":"Java/Video/OggTheora/#description","title":"Description","text":"

vtkOggTheoraWriter object is an adapter that allows VTK to use the ogg and theora libraries to write movie files.

This class creates .ogv files containing theora encoded video without audio.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Video/OggTheora/#code","title":"Code","text":"

OggTheora.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkOggTheoraWriter;\nimport vtk.vtkNamedColors;\n\n\npublic class OggTheora \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n     //parse command line arguments\n    if (args.length != 1) \n    {\n        System.err.println(\"Usage: java -classpath ... OggTheora Filename(.avi) e.g OggTheora.avi\");\n        return;\n    }\n\n    String fileName = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkgcolor[] = new double[] {0, 0,0,1};\n    double boxcolor[] = new double[] {255,0,0,1};\n\n    colors.SetColor(\"bkgColor\", bkgcolor);\n    colors.SetColor(\"boxColor\", boxcolor);\n\n    vtkImageCanvasSource2D source = new vtkImageCanvasSource2D();\n    source.SetScalarTypeToUnsignedChar();\n    source.SetNumberOfScalarComponents(3);\n    source.SetExtent(0, 100, 0, 100, 0, 0);\n\n    vtkOggTheoraWriter writer = new vtkOggTheoraWriter();\n\n    writer.SetInputConnection(source.GetOutputPort());\n    writer.SetFileName(fileName);\n    writer.Start();\n\n    for(int i = 0; i < 100; i++)\n    {\n      source.SetDrawColor(bkgcolor); //black\n      source.FillBox(0, 100, 0, 100); //clear image\n\n      source.SetDrawColor(boxcolor); //red\n      source.FillBox(i, 20, 10, 20);\n\n      source.Update();\n      writer.Write();\n    }\n    writer.End();\n  }\n}\n
"},{"location":"Java/Views/RenderView/","title":"RenderView","text":"

vtk-examples/Java/Views/RenderView

"},{"location":"Java/Views/RenderView/#description","title":"Description","text":"

Here is a little bit easier way in Java to get your objects to appear on the screen using vtkRenderer which provides an abstract specification for renderers.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Views/RenderView/#code","title":"Code","text":"

RenderView.java

import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderView;\nimport vtk.vtkNamedColors;\n\npublic class RenderView\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                 \n   vtkNamedColors colors = new vtkNamedColors();\n   //For Actor Color\n   double actorColor[] = new double[4];\n   //Renderer Background Color\n   double Bgcolor[] = new double[4];\n   colors.GetColor(\"Crimson\", actorColor);\n   colors.GetColor(\"MidnightBlue\", Bgcolor);\n\n   //Create a Sphere\n   vtkSphereSource Sphere = new vtkSphereSource();\n   Sphere.SetCenter(0.0,0.0,0.0);\n   Sphere.SetRadius(1.0);\n   Sphere.Update();\n\n   //Create a Mapper and Actor\n   vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n   Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n   vtkActor Actor = new vtkActor();\n   Actor.SetMapper(Mapper);\n   Actor.GetProperty().SetColor(actorColor);\n\n   vtkRenderView RenderView = new vtkRenderView();\n   RenderView.SetInteractionModeTo3D();\n   RenderView.GetRenderer().AddActor(Actor);\n   RenderView.GetRenderer().SetBackground(Bgcolor);\n   RenderView.Update();\n\n   RenderView.ResetCamera();\n   RenderView.GetInteractor().Start();  \n\n  }       \n}\n
"},{"location":"Java/Visualization/AnimDataCone/","title":"AnimDataCone","text":"

vtk-examples/Java/Visualization/AnimDataCone

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/AnimDataCone/#code","title":"Code","text":"

AnimDataCone.java

// First we import the VTK package that will make available all\n// of the VTK commands to Java.\n\nimport vtk.*;\n\npublic class AnimDataCone {\n\n  // this is an array of transforms to apply to the vtkPolyData.\n  static double moves[][] =\n      {{1.11, 1., 1.}, // expand on x\n          {1.11, 1., 1.}, // expand on x\n          {1.11, 1., 1.}, // expand on x\n          {.9009, 1., 1.}, // contract on x\n          {.9009, 1., 1.}, // contract on x\n          {.9009, 1., 1.}, // contract on x\n          {1., 1.11, 1.}, // expand on y\n          {1., 1.11, 1.}, // expand on y\n          {1., 1.11, 1.}, // expand on y\n          {1., .9009, 1.}, // contract on y\n          {1., .9009, 1.}, // contract on y\n          {1., .9009, 1.}, // contract on y\n          {1., 1., 1.11}, // expand on z\n          {1., 1., 1.11}, // expand on z\n          {1., 1., 1.11}, // expand on z\n          {1., 1., .9009}, // contract on z\n          {1., 1., .9009}, // contract on z\n          {1., 1., .9009} // contract on z\n      };\n\n  /**\n   * @param args\n   */\n  // load the necessary interface libraries on first reference to the\n  // class.\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  // declare the interactor as an instance variable so we can refer to it\n  // in the timer callback. we will pass the instance pointer to this\n  // class for the callback to be invoked on.\n  vtkRenderWindowInteractor iren = null;\n  // create an instance polydata object to hold the animated polydata\n  vtkAppendPolyData pd = null;\n  // create the Transform as an instance variable so we can interact\n  // with it from the interaction call back.\n  vtkTransform Transform = null;\n  // animState is how we manage the transform choices.\n  // each animState is a frame of animation. in this case\n  // a selected scale transform in the array of scale settings\n  // in the moves array.\n  int animState = 0;\n\n  public static void main(String[] args) {\n    // We will start by creating an instance of our AnimDataCone example\n    // This example uses callbacks, and for Java that requires an instance\n    // object to own the callback logic.\n\n    AnimDataCone myCone = new AnimDataCone();\n    myCone.doit();\n  }\n\n  /*\n   * The TimerEvent is specified as the TimerEvent callback\n   * to the RenderWindowInteractor. The polydata modification\n   * is done here as well as the call to the renderWindow to\n   * render the updated scene.\n   */\n  void StartRender() {\n\n    vtkPolyData mpd = pd.GetPolyDataInput(0);\n    vtkPoints pts = mpd.GetPoints();\n    int ptct = pts.GetNumberOfPoints();\n    Transform.Identity();\n    Transform.Scale(AnimDataCone.moves[animState]);\n    // this would probably be better done with a property or assembly,\n    // but this clearly illustrates the modification of point data\n    // cycle through the animation frames\n    animState = (++animState) % 18;\n    // Actually, marking the polydata as modified\n    // is the key to the animation.\n    // Comment the following pd.modified() and nothing\n    // will appear to happen, inspite of all the preceding.\n    // the pipeline UpdateExtent() only processes data that\n    // a modification time stamp more recent than the last render.\n    pd.Modified();\n    // Uncomment the following to get a log of time in milliseconds \n    // for each rendered frame. \n    //  System.out.println(\"Render:\" + System.currentTimeMillis());\n  }\n\n  /*\n   * The doit() function is simply the instance function to perform the\n   * construction of the vtk pipeline for this example.\n   */\n  void doit() {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[]{0.1, 0.2, 0.4, 1.0};\n    double actorColor[] = new double[4];\n    colors.GetColor(\"White\", actorColor);\n\n    // This example illustrates animation via the startrender callback/\n    //\n    Transform = new vtkTransform();\n    // Next we create an instance of vtkConeSource and set some of its\n    // properties. The instance of vtkConeSource \"cone\" is part of a\n    // visualization pipeline (it is a source process object); it produces\n    // data (output type is vtkPolyData) which other filters may process.\n    vtkConeSource cone = new vtkConeSource();\n    cone.SetHeight(3.0);\n    cone.SetRadius(1.0);\n    cone.SetResolution(10);\n\n    pd = new vtkAppendPolyData();\n\n    pd.SetInputConnection(cone.GetOutputPort());\n    // In this example we terminate the pipeline with a mapper process\n    // object.\n    // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    // between the source and the mapper.) We create an instance of\n    // vtkPolyDataMapper to map the polygonal data into graphics primitives.\n    // We connect the output of the cone source to the input of this mapper.\n    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();\n    coneMapper.SetInputConnection(pd.GetOutputPort());\n\n    // Create an actor to represent the cone. The actor orchestrates\n    // rendering of\n    // the mapper's graphics primitives. An actor also refers to properties\n    // via a\n    // vtkProperty instance, and includes an internal transformation matrix.\n    // We\n    // set this actor's mapper to be coneMapper which we created above.\n    vtkActor coneActor = new vtkActor();\n    coneActor.SetMapper(coneMapper);\n    coneActor.GetProperty().SetColor(actorColor);\n\n    // Create the Renderer and assign actors to it. A renderer is like a\n    // viewport. It is part or all of a window on the screen and it is\n    // responsible for drawing the actors it has. We also set the\n    // background color here.\n    vtkRenderer ren1 = new vtkRenderer();\n    ren1.AddActor(coneActor);\n    ren1.SetBackground(bkg);\n\n    // Finally we create the render window which will show up on the screen\n    // We put our renderer into the render window using AddRenderer. We\n    // also set the size to be 300 pixels by 300.\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren1);\n    renWin.SetSize(600, 600);\n\n    // The vtkRenderWindowInteractor class watches for events (e.g.,\n    // keypress,\n    // mouse) in the vtkRenderWindow. These events are translated into\n    // event invocations that VTK understands (see VTK/Common/vtkCommand.h\n    // for all events that VTK processes). Then observers of these VTK\n    // events can process them as appropriate.\n    iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // By default the vtkRenderWindowInteractor instantiates an instance\n    // of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n    // it observes into operations on the camera, actors, and/or properties\n    // in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n    // Here we specify a particular interactor style.\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n\n    // Start the event loop.\n    iren.Initialize();\n    ren1.Render();\n    // Now for every window render we call our callback function to update\n    // the model\n    // resulting in another render.\n    ren1.AddObserver(\"StartEvent\", this, \"StartRender\");\n    iren.CreateRepeatingTimer(50);\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/Animation/","title":"Animation","text":"

vtk-examples/Java/Visualization/Animation

"},{"location":"Java/Visualization/Animation/#description","title":"Description","text":"

This example demonstrates how to create a simple animation. A timer is used to move a sphere across a scene.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/Animation/#code","title":"Code","text":"

Animation.java

import vtk.*;\n\npublic class Animation\n{\n\n  static\n  {\n    System.loadLibrary(\"vtkCommonCoreJava\");\n    System.loadLibrary(\"vtkFiltersSourcesJava\");\n    System.loadLibrary(\"vtkFiltersCoreJava\");\n    System.loadLibrary(\"vtkInteractionStyleJava\");\n    System.loadLibrary(\"vtkRenderingCoreJava\");\n    System.loadLibrary(\"vtkRenderingOpenGL2Java\");\n  }\n\n  static class vtkTimerCallback\n  {\n    void Execute()\n    {\n      ++this.TimerCount;\n      System.out.println(this.TimerCount);\n      actor.SetPosition(this.TimerCount, this.TimerCount,0);\n      iren.GetRenderWindow().Render();\n    }\n\n    private int TimerCount = 0;\n    public vtkActor actor;\n    public vtkRenderWindowInteractor iren;\n  }\n\n  public static void main(String[] args)\n  {\n    //Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0);\n    sphereSource.SetRadius(5.0);\n    sphereSource.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create a renderer, render window, and interactor\n    vtkRenderer renderer = new vtkRenderer();\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.AddRenderer(renderer);\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n\n    //Add the actor to the scene\n    renderer.AddActor(actor);\n    renderer.SetBackground(1,1,1); // Background color white\n\n    //Render and interact\n    renderWindow.Render();\n\n    // Initialize must be called prior to creating timer events.\n    renderWindowInteractor.Initialize();\n\n    // Sign up to receive TimerEvent\n    vtkTimerCallback cb = new vtkTimerCallback();\n    cb.actor = actor;\n    cb.iren = renderWindowInteractor;\n    renderWindowInteractor.AddObserver(\"TimerEvent\", cb, \"Execute\");\n\n    int timerId = renderWindowInteractor.CreateRepeatingTimer(100);\n    System.out.println(\"timerId: \" + timerId);\n\n    //start the interaction and timer\n    renderWindowInteractor.Start();\n  }\n}\n
"},{"location":"Java/Visualization/AnnotatedCubeActor/","title":"AnnotatedCubeActor","text":"

vtk-examples/Java/Visualization/AnnotatedCubeActor

"},{"location":"Java/Visualization/AnnotatedCubeActor/#description","title":"Description","text":"

vtkAnnotatedCubeActor object is a hybrid 3D actor used to represent an anatomical orientation marker in a scene.

The class consists of a 3D unit cube centered on the origin with each face labelled in correspondence to a particular coordinate direction.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/AnnotatedCubeActor/#code","title":"Code","text":"

AnnotatedCubeActor.java

import vtk.vtkRenderWindow;\nimport vtk.vtkAnnotatedCubeActor;\nimport vtk.vtkCamera;\nimport vtk.vtkProperty;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class AnnotatedCubeActor \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -------------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double renBgcolor[] = new double[4];\n\n    //Renderer Background Color\n     double Cubecolor[] = new double[4];\n\n    //Renderer Cube Text Edge Color\n    double CubeTextEdge[] = new double[4];\n\n    //Renderer xText plus and Minus Color\n    double Xplus[] = new double[4];\n    double Xminus[] = new double[4];\n\n    //Renderer yText plus and Minus Color\n    double Yplus[] = new double[4];\n    double Yminus[] = new double[4];\n\n    //Renderer zText plus and Minus Color\n    double Zplus[] = new double[4];\n    double Zminus[] = new double[4];\n\n    colors.GetColor(\"DeepPink\", renBgcolor);\n    colors.GetColor(\"Aquamarine\", Cubecolor);\n    colors.GetColor(\"Gold\", CubeTextEdge);\n    colors.GetColor(\"Turquoise\", Xplus);\n    colors.GetColor(\"Turquoise\", Xminus);\n    colors.GetColor(\"Mint\", Yplus);\n    colors.GetColor(\"Mint\", Yminus);\n    colors.GetColor(\"RoyalBlue\", Yplus);\n    colors.GetColor(\"RoyalBlue\", Yminus);\n\n    vtkAnnotatedCubeActor Cube = new vtkAnnotatedCubeActor();\n    Cube.SetFaceTextScale(0.666667);\n    Cube.GetCubeProperty().SetColor(Cubecolor);\n\n    // set up the renderer, window, and interactor\n    vtkRenderer ren = new vtkRenderer();\n    ren.SetBackground(renBgcolor);\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetSize(300,300);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // anatomic labelling \n    Cube.SetXPlusFaceText(\"A\");\n    Cube.SetXMinusFaceText(\"P\");\n    Cube.SetYPlusFaceText(\"L\");\n    Cube.SetYMinusFaceText(\"R\");\n    Cube.SetZPlusFaceText(\"S\");\n    Cube.SetZMinusFaceText(\"I\");\n\n    // change the vector text colors\n    Cube.GetTextEdgesProperty().SetColor(CubeTextEdge);\n    Cube.GetTextEdgesProperty().SetLineWidth(4);\n\n    vtkProperty Property = new vtkProperty();\n    Property = Cube.GetXPlusFaceProperty();\n    Property.SetColor(Xplus);\n    Property = Cube.GetXMinusFaceProperty();\n    Property.SetColor(Xminus);\n\n    Property = Cube.GetYPlusFaceProperty();\n    Property.SetColor(Yplus);\n    Property = Cube.GetYMinusFaceProperty();\n    Property.SetColor(Yminus);\n\n    Property = Cube.GetZPlusFaceProperty();\n    Property.SetColor(Zplus);\n    Property = Cube.GetZMinusFaceProperty();\n    Property.SetColor(Zminus);\n\n    ren.AddActor(Cube);\n\n    // set up an interesting view\n    vtkCamera Camera = new vtkCamera();\n    Camera.SetViewUp(0, 0, 1);\n    Camera.SetFocalPoint(0, 0, 0);\n    Camera.SetPosition(4.5, 4.5, 2.5);\n    ren.ResetCamera();\n    Camera.Dolly(1.4);\n\n    ren.ResetCameraClippingRange();\n    ren.GetActiveCamera().Azimuth(40);\n    ren.GetActiveCamera().Elevation(30);\n    iren.Initialize();\n    iren.Start();\n\n  }   \n}\n
"},{"location":"Java/Visualization/BackfaceCulling/","title":"BackfaceCulling","text":"

vtk-examples/Java/Visualization/BackfaceCulling

"},{"location":"Java/Visualization/BackfaceCulling/#description","title":"Description","text":"

This example renders a sphere with backface culling enabled.

If backface culling is on, polygons facing away from camera are not drawn.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/BackfaceCulling/#code","title":"Code","text":"

BackfaceCulling.java

import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class BackfaceCulling \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tan\", actorColor);\n    colors.GetColor(\"Aquamarine\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    //Enable BackFaceCulling\n    Actor.GetProperty().BackfaceCullingOn();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/BackgroundColor/","title":"BackgroundColor","text":"

vtk-examples/Java/Visualization/BackgroundColor

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/BackgroundColor/#code","title":"Code","text":"

BackgroundColor.java

import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class BackgroundColor \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n    if (!lib.IsLoaded()) \n    {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------  \n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DarkOrange\", actorColor);\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0, 0, 0);\n    Sphere.SetRadius(4.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the Sphere\n    ren.AddActor(Actor);\n\n    //Setting up the Renderer Background Color.\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/BackgroundGradient/","title":"BackgroundGradient","text":"

vtk-examples/Java/Visualization/BackgroundGradient

"},{"location":"Java/Visualization/BackgroundGradient/#description","title":"Description","text":"

An Example to demonstrating a viewport having a gradient background using the Background (bottom) and Background2 (top) colors.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/BackgroundGradient/#code","title":"Code","text":"

BackgroundGradient.java

import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class BackgroundGradient\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n    if (!lib.IsLoaded()) \n    {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n       }\n      }\n      vtkNativeLibrary.DisableOutputWindow(null);\n     }\n     // -----------------------------------------------------------------   \n\n     public static void main(String args[]) \n     {\n       vtkNamedColors colors = new vtkNamedColors();\n\n       //For Actor Color\n       double actorColor[] = new double[4];\n\n       //Renderer Background Color\n       double Bgcolor[] = new double[4];\n\n       //Renderer Background Color\n       double Bgcolor_2[] = new double[4];\n\n       colors.GetColor(\"MediumSpringGreen\", actorColor);\n       colors.GetColor(\"Banana\", Bgcolor);\n       colors.GetColor(\"Tomato\", Bgcolor_2);\n\n       //Create a Sphere\n       vtkSphereSource Sphere = new vtkSphereSource();\n       Sphere.Update();\n\n       //Create a Mapper and Actor\n       vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n       Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n       vtkActor Actor = new vtkActor();\n       Actor.SetMapper(Mapper);\n       Actor.GetProperty().SetColor(actorColor);\n\n\n       // Create the renderer, render window and interactor.\n       vtkRenderer ren = new vtkRenderer();\n       vtkRenderWindow renWin = new vtkRenderWindow();\n       renWin.AddRenderer(ren);\n       vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n       iren.SetRenderWindow(renWin);\n\n       // Visualise the arrow\n       ren.AddActor(Actor);\n\n       //Setting up the background gradient\n       ren.GradientBackgroundOn();\n       ren.SetBackground(Bgcolor);\n       ren.SetBackground2(Bgcolor_2);\n\n       renWin.SetSize(300, 300);\n       renWin.Render();\n\n       iren.Initialize();\n       iren.Start();\n     }  \n}\n
"},{"location":"Java/Visualization/BlobbyLogo/","title":"BlobbyLogo","text":"

vtk-examples/Java/Visualization/BlobbyLogo

"},{"location":"Java/Visualization/BlobbyLogo/#description","title":"Description","text":"

This is the blobby vtk logo described in chapter 12 of the VTK textbook. The example uses vtkAppendPolyData to combine three vtkPolyData. A vtkImplicitModeller creates a vtkImageData of the distnaces from the polydata triangles. vtkContourFilter extracts an isosurface representing an offset surface.

This examples uses the data src/Testing/Data/v.vtk, src/Testing/Data/t.vtk and src/Testing/Data/k.vtk.

Info

See Figure 12-13 in Chapter 12 the VTK Textbook.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/BlobbyLogo/#code","title":"Code","text":"

BlobbyLogo.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPolyDataReader;\nimport vtk.vtkTransform;\nimport vtk.vtkTransformPolyDataFilter;\nimport vtk.vtkPolyDataNormals;\nimport vtk.vtkAppendPolyData;\nimport vtk.vtkImplicitModeller;\nimport vtk.vtkContourFilter;\nimport vtk.vtkProperty;\n\npublic class BlobbyLogo \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 3) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtk) Filename(.vtk) Filename(.vtk) e.g v.vtk t.vtk k.vtk\");\n      return;\n    }\n\n    vtkRenderer aRenderer = new vtkRenderer();\n    vtkRenderWindow aRenderWindow = new vtkRenderWindow();\n    aRenderWindow.AddRenderer(aRenderer);\n    vtkRenderWindowInteractor anInteractor = new vtkRenderWindowInteractor();\n    anInteractor.SetRenderWindow(aRenderWindow);\n    aRenderWindow.SetSize( 300, 300 );\n\n    //read the geometry file containing the letter v\n    vtkPolyDataReader letterV = new vtkPolyDataReader();\n    letterV.SetFileName (args[0]);\n\n    //read the geometry file containing the letter t\n    vtkPolyDataReader letterT = new vtkPolyDataReader();\n    letterT.SetFileName (args[1]);\n\n    //read the geometry file containing the letter k\n    vtkPolyDataReader letterK = new vtkPolyDataReader();\n    letterK.SetFileName (args[2]);\n\n    //create a transform and transform filter for each letter\n    vtkTransform VTransform = new vtkTransform();\n    vtkTransformPolyDataFilter VTransformFilter = new vtkTransformPolyDataFilter();\n    VTransformFilter.SetInputConnection(letterV.GetOutputPort());\n    VTransformFilter.SetTransform (VTransform);\n\n    vtkTransform TTransform = new vtkTransform();\n    vtkTransformPolyDataFilter TTransformFilter = new vtkTransformPolyDataFilter();\n    TTransformFilter.SetInputConnection (letterT.GetOutputPort());\n    TTransformFilter.SetTransform (TTransform);\n\n    vtkTransform KTransform = new vtkTransform();\n    vtkTransformPolyDataFilter KTransformFilter = new vtkTransformPolyDataFilter();\n    KTransformFilter.SetInputConnection(letterK.GetOutputPort());\n    KTransformFilter.SetTransform (KTransform);\n\n    //now append them all\n    vtkAppendPolyData appendAll = new vtkAppendPolyData();\n    appendAll.AddInputConnection (VTransformFilter.GetOutputPort());\n    appendAll.AddInputConnection (TTransformFilter.GetOutputPort());\n    appendAll.AddInputConnection (KTransformFilter.GetOutputPort());\n\n    //create normals\n    vtkPolyDataNormals logoNormals = new vtkPolyDataNormals();\n    logoNormals.SetInputConnection (appendAll.GetOutputPort());\n    logoNormals.SetFeatureAngle (60);\n\n    //map to rendering primitives\n    vtkPolyDataMapper logoMapper = new vtkPolyDataMapper();\n    logoMapper.SetInputConnection (logoNormals.GetOutputPort());\n\n    //now an actor\n    vtkActor logo = new vtkActor();\n    logo.SetMapper (logoMapper);\n\n    //now create an implicit model of the same letter\n    vtkImplicitModeller blobbyLogoImp = new vtkImplicitModeller();\n    blobbyLogoImp.SetInputConnection(appendAll.GetOutputPort());\n    blobbyLogoImp.SetMaximumDistance (.075);\n    blobbyLogoImp.SetSampleDimensions (64,64,64); \n    blobbyLogoImp.SetAdjustDistance (0.05);\n\n    //extract an iso surface\n    vtkContourFilter blobbyLogoIso = new vtkContourFilter();\n    blobbyLogoIso.SetInputConnection(blobbyLogoImp.GetOutputPort());\n    blobbyLogoIso.SetValue (1, 1.5);\n\n    //map to rendering primitives\n    vtkPolyDataMapper blobbyLogoMapper = new vtkPolyDataMapper();\n    blobbyLogoMapper.SetInputConnection(blobbyLogoIso.GetOutputPort());\n    blobbyLogoMapper.ScalarVisibilityOff ();\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    double tomatoColor[] = new double[4];\n    double bananaColor[] = new double[4];\n    double BgColor[] = new double[4];\n\n    Color.GetColor(\"tomato\",tomatoColor);\n    Color.GetColor(\"banana\",bananaColor);\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    vtkProperty tomato = new vtkProperty();\n    tomato.SetDiffuseColor(tomatoColor);\n    tomato.SetSpecular(.3);\n    tomato.SetSpecularPower(20);\n\n    vtkProperty banana = new vtkProperty();\n    banana.SetDiffuseColor(bananaColor);\n    banana.SetDiffuse (.7);\n    banana.SetSpecular(.4);\n    banana.SetSpecularPower(20);\n\n    //An actor\n    vtkActor blobbyLogo = new vtkActor();\n    blobbyLogo.SetMapper (blobbyLogoMapper);\n    blobbyLogo.SetProperty (banana);\n\n    // position the letters\n\n    VTransform.Translate (-16.0,0.0,12.5);\n    VTransform.RotateY (40);\n\n    KTransform.Translate (14.0, 0.0, 0.0);\n    KTransform.RotateY (-40);\n\n    // move the polygonal letters to the front\n    logo.SetProperty (tomato);\n    logo.SetPosition(0,0,6);\n\n    aRenderer.AddActor(logo);\n    aRenderer.AddActor(blobbyLogo);\n\n    aRenderer.SetBackground(BgColor);\n\n    aRenderWindow.Render();\n\n    // interact with data\n    anInteractor.Start();\n\n  }\n}\n
"},{"location":"Java/Visualization/Camera/","title":"Camera","text":"

vtk-examples/Java/Visualization/Camera

"},{"location":"Java/Visualization/Camera/#description","title":"Description","text":"

vtkCamera object is a virtual camera for 3D rendering.

It provides methods to position and orient the view point and focal point. Convenience methods for moving about the focal point also are provided.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/Camera/#code","title":"Code","text":"

Camera.java

import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkCamera;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class Camera \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------  \n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DeepSkyBlue\", actorColor);\n    colors.GetColor(\"Coral\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0, 0, 0);\n    Sphere.SetRadius(1.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    //Setting up Camera\n    vtkCamera Camera = new vtkCamera();\n    Camera.SetPosition(0, 0, 20);\n    Camera.SetFocalPoint(0, 0, 0);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    ren.SetActiveCamera(Camera);\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the Actor\n    ren.AddActor(Actor);\n    //Setting up the Renderer Background Color.\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/CameraActor/","title":"CameraActor","text":"

vtk-examples/Java/Visualization/CameraActor

"},{"location":"Java/Visualization/CameraActor/#description","title":"Description","text":"

vtkCameraActor object is an actor used to represent a camera by its wireframe frustum.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/CameraActor/#code","title":"Code","text":"

CameraActor.java

import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkCamera;\nimport vtk.vtkCameraActor;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class CameraActor\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------  \n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //For Camera Actor Color\n    double CamActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DeepSkyBlue\", actorColor);\n    colors.GetColor(\"Black\", CamActorColor);\n    colors.GetColor(\"Coral\", Bgcolor);\n\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetRadius(4);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    //Setting up Camera\n    vtkCamera Camera = new vtkCamera();\n\n    //Camera Actor\n    vtkCameraActor CameraActor = new vtkCameraActor();\n    CameraActor.SetCamera(Camera);\n    CameraActor.GetProperty().SetColor(CamActorColor);\n    double bounds[] = new double[6];\n    CameraActor.GetBounds(bounds);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the Camera Actor\n    ren.AddActor(Actor);\n    ren.ResetCamera();\n    Camera.DeepCopy(ren.GetActiveCamera());\n    ren.AddActor(CameraActor);\n\n    //Setting up Camera\n\n    //ren.GetActiveCamera().SetPosition(0, 0, 1);\n    //ren.GetActiveCamera().SetFocalPoint(0, 0, 0);\n    ren.GetActiveCamera().SetViewUp(1, 0, 0);\n    ren.GetActiveCamera().Azimuth(130);\n    ren.GetActiveCamera().Elevation(130);\n    //ren.GetActiveCamera().Zoom(1);\n\n    //Setting up the Renderer Background Color.\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/ColorActorEdges/","title":"ColorActorEdges","text":"

vtk-examples/Java/Visualization/ColorActorEdges

"},{"location":"Java/Visualization/ColorActorEdges/#description","title":"Description","text":"

This example colors the edges of a actor.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/ColorActorEdges/#code","title":"Code","text":"

ColorActorEdges.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\npublic class ColorActorEdges \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n\n    colors.GetColor(\"Red\", actorColor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(5.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    //  Flat shading\n    Actor.GetProperty().SetInterpolationToFlat();\n\n    // Set the color for edges of the sphere\n    Actor.GetProperty().SetEdgeColor(actorColor);\n    Actor.GetProperty().EdgeVisibilityOn();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(Actor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/ColorAnActor/","title":"ColorAnActor","text":"

vtk-examples/Java/Visualization/ColorAnActor

"},{"location":"Java/Visualization/ColorAnActor/#description","title":"Description","text":"

This example creates a red sphere.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/ColorAnActor/#code","title":"Code","text":"

ColorAnActor.java

import vtk.*;\n\npublic class ColorAnActor {\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args)\n  {\n    //Create a sphere\n    vtkSphereSource sphereSource = \n      new vtkSphereSource();\n    sphereSource.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = \n      new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Set the color of the sphere\n    actor.GetProperty().SetColor(1.0, 0.0, 0.0); //(R,G,B)\n\n    //Create a renderer, render window, and interactor\n    vtkRenderer renderer = \n      new vtkRenderer();\n    vtkRenderWindow renderWindow = \n      new vtkRenderWindow();\n    renderWindow.AddRenderer(renderer);\n    vtkRenderWindowInteractor renderWindowInteractor = \n      new vtkRenderWindowInteractor();\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n\n    //Add the actor to the scene\n    renderer.AddActor(actor);\n    renderer.SetBackground(1,1,1); // Background color white\n\n    //Render and interact\n    renderWindow.Render();\n    renderWindowInteractor.Start();\n  }\n}\n
"},{"location":"Java/Visualization/ComplexV/","title":"ComplexV","text":"

vtk-examples/Java/Visualization/ComplexV

"},{"location":"Java/Visualization/ComplexV/#description","title":"Description","text":"

ComplexV from the VTK Textbook. The original example was written in TCL.

The example shows 167,000 3D vectors (using oriented and scaled lines) in the region of the human carotid artery.

The larger vectors lie inside the arteries, the smaller vectors lie outside the arteries and are randomly oriented (measurement error) but small in magnitude. Clearly the details of the vector field are not discernible from this image.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/ComplexV/#code","title":"Code","text":"

ComplexV.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkStructuredPointsReader;\nimport vtk.vtkHedgeHog;\nimport vtk.vtkLookupTable;\nimport vtk.vtkOutlineFilter;\n\n\npublic class ComplexV \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtk) e.g carotid.vtk\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For outline Actor Color\n    double outlineactorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Black\", outlineactorColor);\n    colors.GetColor(\"Gray\", Bgcolor);\n\n    vtkStructuredPointsReader reader = new vtkStructuredPointsReader();\n    reader.SetFileName(inputFilename);\n\n    vtkHedgeHog hhog = new vtkHedgeHog();\n    hhog.SetInputConnection(reader.GetOutputPort());\n    hhog.SetScaleFactor(0.3);\n\n    vtkLookupTable lut = new vtkLookupTable();\n    // lut.SetHueRange(.667, 0.0);\n    lut.Build();\n\n    vtkPolyDataMapper hhogMapper = new vtkPolyDataMapper();\n    hhogMapper.SetInputConnection(hhog.GetOutputPort());\n    hhogMapper.SetScalarRange(50, 550);\n    hhogMapper.SetLookupTable(lut);\n\n    vtkActor hhogActor = new vtkActor();\n    hhogActor.SetMapper(hhogMapper);\n\n    vtkOutlineFilter outline = new vtkOutlineFilter();\n    outline.SetInputConnection(reader.GetOutputPort());\n\n    vtkPolyDataMapper outlineMapper = new vtkPolyDataMapper();\n    outlineMapper.SetInputConnection(outline.GetOutputPort());\n\n    vtkActor outlineActor = new vtkActor();\n    outlineActor.SetMapper(outlineMapper);\n    outlineActor.GetProperty().SetColor(outlineactorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(outlineActor);\n    ren.AddActor(hhogActor);\n\n    ren.SetBackground(Bgcolor);\n\n    ren.GetActiveCamera().SetFocalPoint(0,0,0);\n    ren.GetActiveCamera().SetPosition(1,0,0);\n    ren.GetActiveCamera().SetViewUp(0,0,1);\n    ren.ResetCamera();\n\n    ren.GetActiveCamera().Azimuth(60);\n    ren.GetActiveCamera().Elevation(30);\n    ren.GetActiveCamera().Dolly(1.1);\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/CornerAnnotation/","title":"CornerAnnotation","text":"

vtk-examples/Java/Visualization/CornerAnnotation

"},{"location":"Java/Visualization/CornerAnnotation/#description","title":"Description","text":"

vtkCornerAnnotation is an annotation object that manages four text actors / mappers to provide annotation in the four corners of a viewport.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/CornerAnnotation/#code","title":"Code","text":"

CornerAnnotation.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkCornerAnnotation;\n\npublic class CornerAnnotation \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Annotation Color\n    double AnnotationColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", AnnotationColor);\n    colors.GetColor(\"White\", Bgcolor);\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource.SetRadius(5.0 );\n    sphereSource.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputData (sphereSource.GetOutput());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper ( mapper );\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Annotate the image with window/level and mouse over pixel information\n    vtkCornerAnnotation cornerAnnotation = new vtkCornerAnnotation();\n    cornerAnnotation.SetLinearFontScaleFactor(2);\n    cornerAnnotation.SetNonlinearFontScaleFactor(1);\n    cornerAnnotation.SetMaximumFontSize(20);\n    cornerAnnotation.SetText(0, \"Lower left\");\n    cornerAnnotation.SetText(1, \"Lower right\");\n    cornerAnnotation.SetText(2, \"Upper left\");\n    cornerAnnotation.SetText(3, \"Upper right\");\n    cornerAnnotation.GetTextProperty().SetColor(AnnotationColor);\n\n    // Visualise\n    ren.AddViewProp( cornerAnnotation );\n    ren.AddActor( actor );\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/CubeAxesActor/","title":"CubeAxesActor","text":"

vtk-examples/Java/Visualization/CubeAxesActor

"},{"location":"Java/Visualization/CubeAxesActor/#description","title":"Description","text":"

vtkCubeAxesActor object is a composite actor that draws axes of the bounding box of an input dataset.

The axes include labels and titles for the x-y-z axes. The algorithm selects which axes to draw based on the user-defined 'fly' mode. (STATIC is default). 'STATIC' constructs axes from all edges of the bounding box. 'CLOSEST_TRIAD' consists of the three axes x-y-z forming a triad that lies closest to the specified camera. 'FURTHEST_TRIAD' consists of the three axes x-y-z forming a triad that lies furthest from the specified camera. 'OUTER_EDGES' is constructed from edges that are on the \"exterior\" of the bounding box, exterior as determined from examining outer edges of the bounding box in projection (display) space.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/CubeAxesActor/#code","title":"Code","text":"

CubeAxesActor.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSuperquadricSource;\nimport vtk.vtkCubeAxesActor;\n\npublic class CubeAxesActor \n{\n  private static final int VTK_GRID_LINES_FURTHEST = 2;\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //For axis1 Color\n    double axis1Color[] = new double[4];\n    //For axis2 Color\n    double axis2Color[] = new double[4];\n    //For axis3 Color\n    double axis3Color[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", actorColor);\n    colors.GetColor(\"Salmon\", axis1Color);\n    colors.GetColor(\"PaleGreen\", axis2Color);\n    colors.GetColor(\"DodgerBlue\", axis3Color);\n    colors.GetColor(\"Indigo\", Bgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //  Create a superquadric\n    vtkSuperquadricSource superquadricSource = new vtkSuperquadricSource();\n    superquadricSource.SetPhiRoundness(3.1);\n    superquadricSource.SetThetaRoundness(1.0);\n    superquadricSource.Update(); // needed to GetBounds later\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(superquadricSource.GetOutputPort());\n\n    vtkActor superquadricActor = new vtkActor();\n    superquadricActor.SetMapper(mapper);\n    superquadricActor.GetProperty().SetDiffuseColor(actorColor);\n    superquadricActor.GetProperty().SetDiffuse(.7);\n    superquadricActor.GetProperty().SetSpecular(.7);\n    superquadricActor.GetProperty().SetSpecularPower(50.0);\n\n    vtkCubeAxesActor cubeAxesActor = new vtkCubeAxesActor();\n    cubeAxesActor.SetUseTextActor3D(1);\n    cubeAxesActor.SetBounds(superquadricSource.GetOutput().GetBounds());\n    cubeAxesActor.SetCamera(ren.GetActiveCamera());\n    cubeAxesActor.GetTitleTextProperty(0).SetColor(axis1Color);\n    cubeAxesActor.GetTitleTextProperty(0).SetFontSize(48);\n    cubeAxesActor.GetLabelTextProperty(0).SetColor(axis1Color);\n\n    cubeAxesActor.GetTitleTextProperty(1).SetColor(axis2Color);\n    cubeAxesActor.GetLabelTextProperty(1).SetColor(axis2Color);\n    cubeAxesActor.GetTitleTextProperty(2).SetColor(axis3Color);\n    cubeAxesActor.GetLabelTextProperty(2).SetColor(axis3Color);\n\n    cubeAxesActor.DrawXGridlinesOn();\n    cubeAxesActor.DrawYGridlinesOn();\n    cubeAxesActor.DrawZGridlinesOn();\n    cubeAxesActor.SetGridLineLocation(VTK_GRID_LINES_FURTHEST);\n\n    cubeAxesActor.XAxisMinorTickVisibilityOff();\n    cubeAxesActor.YAxisMinorTickVisibilityOff();\n    cubeAxesActor.ZAxisMinorTickVisibilityOff();\n\n    cubeAxesActor.SetFlyModeToStaticEdges();\n    ren.AddActor(cubeAxesActor);\n    ren.AddActor(superquadricActor);\n    ren.GetActiveCamera().Azimuth(30);\n    ren.GetActiveCamera().Elevation(30);\n\n    ren.ResetCamera();\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(1200, 900);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/CubeAxesActor2D/","title":"CubeAxesActor2D","text":"

vtk-examples/Java/Visualization/CubeAxesActor2D

"},{"location":"Java/Visualization/CubeAxesActor2D/#description","title":"Description","text":"

vtkCubeAxesActor2D object draws axes on the bounding box of the data set and labels the axes with x-y-z coordinates.

vtkPlatonicSolidSource object can generate each of the five Platonic solids: tetrahedron, cube, octahedron, icosahedron, and dodecahedron. Each of the solids is placed inside a sphere centered at the origin with radius 1.0.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/CubeAxesActor2D/#code","title":"Code","text":"

CubeAxesActor2D.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPlatonicSolidSource;\nimport vtk.vtkPolyDataNormals;\nimport vtk.vtkTextProperty;\nimport vtk.vtkCubeAxesActor2D;\nimport vtk.vtkLODActor;\nimport vtk.vtkOutlineFilter;\n\n\npublic class CubeAxesActor2D \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For icosahedron_actor Color\n    double icosahedronActorColor[] = new double[4];\n    //For outline actor Color\n    double outlineActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Magenta\", icosahedronActorColor);\n    colors.GetColor(\"Black\", outlineActorColor);\n    colors.GetColor(\"DarkSlateBlue\", Bgcolor);\n\n    vtkPlatonicSolidSource icosahedron = new vtkPlatonicSolidSource();\n    icosahedron.SetSolidTypeToIcosahedron();\n\n    // Create a vtkPolyDataNormals filter to calculate the normals of the data set.\n    vtkPolyDataNormals normals = new vtkPolyDataNormals();\n    normals.SetInputConnection(icosahedron.GetOutputPort());\n\n    // Set up the associated mapper and actor.\n    vtkPolyDataMapper icosahedron_mapper = new vtkPolyDataMapper();\n    icosahedron_mapper.SetInputConnection(normals.GetOutputPort());\n    icosahedron_mapper.ScalarVisibilityOff();\n\n    vtkLODActor icosahedron_actor = new vtkLODActor();\n    icosahedron_actor.SetMapper(icosahedron_mapper);\n    icosahedron_actor.GetProperty().SetColor(icosahedronActorColor);\n\n    // Create a vtkOutlineFilter to draw the bounding box of the data set.\n    // Also create the associated mapper and actor.\n    vtkOutlineFilter outline = new vtkOutlineFilter();\n    outline.SetInputConnection(normals.GetOutputPort());\n\n    vtkPolyDataMapper map_outline = new vtkPolyDataMapper();\n    map_outline.SetInputConnection(outline.GetOutputPort());\n\n    vtkActor outline_actor = new vtkActor();\n    outline_actor.SetMapper(map_outline);\n    outline_actor.GetProperty().SetColor(outlineActorColor);\n\n    // Create the Renderers.  Assign them the appropriate viewport\n    // coordinates, active camera, and light.\n\n    vtkRenderer ren = new vtkRenderer();\n    ren.SetViewport(0.0, 0.0, 0.5, 1.0);\n\n    vtkRenderer ren2 = new vtkRenderer();\n    ren2.SetViewport(0.5, 0.0, 1.0, 1.0);;\n    ren2.SetActiveCamera(ren.GetActiveCamera());    \n\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.AddRenderer(ren2);\n    renWin.SetWindowName(\"VTK - Cube Axes\");\n    renWin.SetSize(600, 300);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddViewProp(icosahedron_actor);\n    ren.AddViewProp(outline_actor);\n    ren2.AddViewProp(icosahedron_actor);\n    ren2.AddViewProp(outline_actor);\n\n    ren.SetBackground(Bgcolor);\n    ren2.SetBackground(Bgcolor);\n\n    // Create a text property for both cube axes\n    vtkTextProperty tprop = new vtkTextProperty();\n    tprop.SetColor(1, 1, 1);\n    tprop.ShadowOn();\n    tprop.SetFontSize(20);\n\n    //  Create a vtkCubeAxesActor2D.  Use the outer edges of the bounding box to\n    // draw the axes.  Add the actor to the renderer.\n    vtkCubeAxesActor2D axes = new vtkCubeAxesActor2D();\n    axes.SetInputConnection(normals.GetOutputPort());\n    axes.SetCamera(ren.GetActiveCamera());\n    axes.SetLabelFormat(\"%6.4g\");\n    axes.SetFlyModeToOuterEdges();\n    axes.SetAxisTitleTextProperty(tprop);\n    axes.SetAxisLabelTextProperty(tprop);\n    ren.AddViewProp(axes);\n\n    //  Create a vtkCubeAxesActor2D.  Use the closest vertex to the camera to\n    // determine where to draw the axes.  Add the actor to the renderer.\n    vtkCubeAxesActor2D axes2 = new vtkCubeAxesActor2D();\n    axes2.SetViewProp(icosahedron_actor);\n    axes2.SetCamera(ren2.GetActiveCamera());\n    axes2.SetLabelFormat(\"%6.4g\");\n    axes2.SetFlyModeToClosestTriad();\n    axes2.ScalingOff();\n    axes2.SetAxisTitleTextProperty(tprop);\n    axes2.SetAxisLabelTextProperty(tprop);\n    ren2.AddViewProp(axes2);\n\n    ren.ResetCamera();\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/Cursor2D/","title":"Cursor2D","text":"

vtk-examples/Java/Visualization/Cursor2D

"},{"location":"Java/Visualization/Cursor2D/#description","title":"Description","text":"

Example program to generate a 2D cursor representation.

vtkCursor2D is a class that generates a 2D cursor representation. The cursor consists of two intersection axes lines that meet at the cursor focus.

Several optional features are available as well. An optional 2D bounding box may be enabled.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/Cursor2D/#code","title":"Code","text":"

Cursor2D.java

import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkCursor2D;\n\npublic class Cursor2D\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                 \n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //For Cursor Actor Color\n    double CursorActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Crimson\", actorColor);\n    colors.GetColor(\"White\", CursorActorColor);\n    colors.GetColor(\"CadetBlue\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(5.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the Actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    //Setup 2D cursor representation\n    vtkCursor2D Cursor = new vtkCursor2D();\n    Cursor.SetModelBounds(-10, 10, -10, 10, 0, 0);\n    Cursor.AllOn();\n    Cursor.SetFocalPoint(5.0, 5.0, 5.0);\n    Cursor.OutlineOn();\n    Cursor.Update();\n\n    //Mapper for Cursor\n    vtkPolyDataMapper CursorMapper = new vtkPolyDataMapper();\n    CursorMapper.SetInputConnection(Cursor.GetOutputPort());\n\n    //Cursor Actor\n    vtkActor CursorActor = new vtkActor();\n    CursorActor.SetMapper(CursorMapper);\n    CursorActor.GetProperty().SetColor(CursorActorColor);\n    ren.AddActor(CursorActor);\n\n    ren.ResetCamera();\n    iren.Start();\n\n  }       \n}\n
"},{"location":"Java/Visualization/Cursor3D/","title":"Cursor3D","text":"

vtk-examples/Java/Visualization/Cursor3D

"},{"location":"Java/Visualization/Cursor3D/#description","title":"Description","text":"

vtkCursor3D is an object that generates 3D representation of a cursor.

The cursor consists of a wireframe bounding box, three intersecting axes lines that meet at the cursor focus, and \"shadows\" or projections of the axes against the sides of the bounding box. Each of these components can be turned on/off.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/Cursor3D/#code","title":"Code","text":"

Cursor3D.java

import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkCursor3D;\n\npublic class Cursor3D\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                 \n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //For Cursor Actor Color\n    double CursorActorColor[] = new double[4];\n    //Renderer Background Color\n     double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"LightPink\", actorColor);\n    colors.GetColor(\"Brown\", CursorActorColor);\n    colors.GetColor(\"MediumSpringGreen\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(5.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    vtkCursor3D Cursor = new vtkCursor3D();\n    Cursor.SetModelBounds(-10, 10, -10, 10, -10, 10);\n    Cursor.AllOn();\n    Cursor.OutlineOff();\n    Cursor.Update();\n\n    vtkPolyDataMapper CursorMapper = new vtkPolyDataMapper();\n    CursorMapper.SetInputConnection(Cursor.GetOutputPort());\n    vtkActor CursorActor = new vtkActor();\n    CursorActor.SetMapper(CursorMapper);\n    CursorActor.GetProperty().SetColor(CursorActorColor);\n    ren.AddActor(CursorActor);\n\n    ren.ResetCamera();\n    iren.Start();       \n  }       \n}\n
"},{"location":"Java/Visualization/CursorShape/","title":"CursorShape","text":"

vtk-examples/Java/Visualization/CursorShape

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/CursorShape/#code","title":"Code","text":"

CursorShape.java

import java.awt.Cursor;\nimport vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class CursorShape\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                 \n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n\n    //For Cursor Actor Color\n    double CursorActorColor[] = new double[4];\n\n   //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"LightPink\", actorColor);\n    colors.GetColor(\"Brown\", CursorActorColor);\n    colors.GetColor(\"MediumSpringGreen\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.Render();\n    //This must occur after the above Render() call or it does not work \n    renWin.SetCurrentCursor(Cursor.HAND_CURSOR);\n\n    ren.ResetCamera();\n    iren.Start();   \n  }       \n}\n
"},{"location":"Java/Visualization/DisplayCoordinateAxes/","title":"DisplayCoordinateAxes","text":"

vtk-examples/Java/Visualization/DisplayCoordinateAxes

"},{"location":"Java/Visualization/DisplayCoordinateAxes/#description","title":"Description","text":"

This example shows how to display the coordinate axes in the render window.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/DisplayCoordinateAxes/#code","title":"Code","text":"

DisplayCoordinateAxes.java

import vtk.vtkActor;\nimport vtk.vtkAxesActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkOrientationMarkerWidget;\nimport vtk.vtkSphereSource;\n\npublic class DisplayCoordinateAxes\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    //Sphere1\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource.SetRadius(1.0);\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper  = new vtkPolyDataMapper();\n    sphereMapper.SetInputData (sphereSource.GetOutput());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetWindowName(\"Display Coordinate Axes\");\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(sphereActor);\n    ren.SetBackground(Bgcolor);\n\n    vtkAxesActor axes = new vtkAxesActor();\n\n    vtkOrientationMarkerWidget widget = new vtkOrientationMarkerWidget();\n    double rgba[] = new double[] {0.0, 0.0, 0.0, 0.0};\n    colors.GetColor(\"Carrot\",rgba);\n    widget.SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n    widget.SetOrientationMarker(axes);\n    widget.SetInteractor(iren);\n    widget.SetViewport( 0.0, 0.0, 0.4, 0.4 );\n    widget.SetEnabled(1);\n    widget.InteractiveOn();\n\n    ren.GetActiveCamera().Azimuth(50);\n    ren.GetActiveCamera().Elevation(-30);\n    ren.ResetCamera();\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/DistanceToCamera/","title":"DistanceToCamera","text":"

vtk-examples/Java/Visualization/DistanceToCamera

"},{"location":"Java/Visualization/DistanceToCamera/#description","title":"Description","text":"

This example produces two arrows whose scale stays fixed with respect to the distance from the camera (i.e. as you zoom in and out). Standard spheres are drawn for comparison.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/DistanceToCamera/#code","title":"Code","text":"

DistanceToCamera.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPointSource;\nimport vtk.vtkDistanceToCamera;\nimport vtk.vtkArrowSource;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkInteractorStyleTrackballCamera;\nimport vtk.vtkSphereSource;\n\npublic class DistanceToCamera \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For fixedActor Color\n    double fixedActorColor[] = new double[4];\n    //For sphereActor Color\n    double sphereActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Aqua\", fixedActorColor);\n    colors.GetColor(\"Yellow\",sphereActorColor);\n    colors.GetColor(\"White\", Bgcolor);\n\n    // Draw some arrows that maintain a fixed size during zooming.\n    // Create a set of points.\n    vtkPointSource fixedPointSource = new vtkPointSource();\n    fixedPointSource.SetNumberOfPoints(2);\n\n    // Calculate the distance to the camera of each point.\n    vtkDistanceToCamera distanceToCamera = new vtkDistanceToCamera();\n    distanceToCamera.SetInputConnection(fixedPointSource.GetOutputPort());\n    distanceToCamera.SetScreenSize(100.0);\n\n    // Glyph each point with an arrow.\n    vtkArrowSource arrow = new vtkArrowSource();\n    vtkGlyph3D fixedGlyph = new vtkGlyph3D();\n    fixedGlyph.SetInputConnection(distanceToCamera.GetOutputPort());\n    fixedGlyph.SetSourceConnection(arrow.GetOutputPort());\n\n    // Scale each point.\n    fixedGlyph.SetScaleModeToScaleByScalar();\n    fixedGlyph.SetInputArrayToProcess(0, 0, 0, 0, \"DistanceToCamera\");\n\n    // Create a mapper.\n    vtkPolyDataMapper fixedMapper = new vtkPolyDataMapper();\n    fixedMapper.SetInputConnection(fixedGlyph.GetOutputPort());\n    fixedMapper.SetScalarVisibility(0);\n\n    // Create an actor.\n    vtkActor fixedActor = new vtkActor();\n    fixedActor.SetMapper(fixedMapper);\n    fixedActor.GetProperty().SetColor(fixedActorColor);\n\n    // Draw some spheres that get bigger when zooming in.\n    // Create a set of points.\n    vtkPointSource pointSource = new vtkPointSource();\n    pointSource.SetNumberOfPoints(4);\n\n    // Glyph each point with a sphere.\n    vtkSphereSource sphere = new vtkSphereSource();\n    vtkGlyph3D glyph = new vtkGlyph3D();\n    glyph.SetInputConnection(pointSource.GetOutputPort());\n    glyph.SetSourceConnection(sphere.GetOutputPort());\n    glyph.SetScaleFactor(0.1);\n\n    // Create a mapper.\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(glyph.GetOutputPort());\n    mapper.SetScalarVisibility(0);\n\n    // Create an actor.\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(sphereActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    ren.SetBackground(Bgcolor);\n\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n\n    // Give DistanceToCamera a pointer to the renderer.\n    distanceToCamera.SetRenderer(ren);\n\n    // Visualize\n    ren.AddActor(fixedActor);\n    ren.AddActor(actor);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n    iren.SetRenderWindow(renWin);\n\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/DrawText/","title":"DrawText","text":"

vtk-examples/Java/Visualization/DrawText

"},{"location":"Java/Visualization/DrawText/#description","title":"Description","text":"

This example writes \"Hello world\" in the bottom left corner of the render window. The text size and color are set. There are many properties that can be set that control how the text is changed when the render window is resized, but they are not covered in this example.

This example draws text in 2D. For an example using 3D text that can be placed on the scene like a regular vtkActor, see VectorText.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/DrawText/#code","title":"Code","text":"

DrawText.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkTextActor;\n\npublic class DrawText \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For textActor Color\n    double textactorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", textactorColor);\n    colors.GetColor(\"White\", Bgcolor);\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource.SetRadius(5.0 );\n    sphereSource.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputData (sphereSource.GetOutput());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper ( mapper );\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Setup the text and add it to the renderer\n    vtkTextActor textActor = new vtkTextActor();\n    textActor.SetInput(\"Hello world\");\n    textActor.SetPosition2(10, 40);\n    textActor.GetTextProperty().SetFontSize (24);\n    textActor.GetTextProperty().SetColor (textactorColor);\n    ren.AddActor2D(textActor);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/Follower/","title":"Follower","text":"

vtk-examples/Java/Visualization/Follower

"},{"location":"Java/Visualization/Follower/#description","title":"Description","text":"

The text stays right side up and facing the camera, while the cube does not.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/Follower/#code","title":"Code","text":"

Follower.java

import vtk.*;\n\npublic class Follower\n{\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args)\n  {\n    //Create some text\n    vtkVectorText textSource = new vtkVectorText();\n    textSource.SetText( \"Hello\" );\n\n    //Create a mapper\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection( textSource.GetOutputPort() );\n\n    //Create a subclass of vtkActor: a vtkFollower that remains facing the camera\n    vtkFollower follower = new vtkFollower();\n    follower.SetMapper( mapper );\n    follower.GetProperty().SetColor( 1, 0, 0 ); // red \n\n    //Create a transparent cube that does not move around to face the camera\n    vtkCubeSource cubeSource = new vtkCubeSource();\n    vtkPolyDataMapper cubeMapper = new vtkPolyDataMapper();\n    cubeMapper.SetInputConnection( cubeSource.GetOutputPort() );\n    vtkActor cubeActor = new vtkActor();\n    cubeActor.SetMapper( cubeMapper );\n    cubeActor.GetProperty().SetColor( 0, 0, 1 ); // blue\n    cubeActor.GetProperty().SetOpacity( 0.3 );\n\n    //Create a renderer, render window, and interactor\n    vtkRenderer renderer = new vtkRenderer();\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.AddRenderer( renderer );\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    ((vtkInteractorStyle)renderWindowInteractor.GetInteractorStyle()).AutoAdjustCameraClippingRangeOn();\n    renderWindowInteractor.SetRenderWindow( renderWindow );\n\n    //Add the actor to the scene\n    renderer.AddActor( follower );\n    renderer.AddActor( cubeActor );\n    renderer.SetBackground( 1, 1, 1 ); // Background color white\n    follower.SetCamera( renderer.GetActiveCamera() );\n\n    //Render and interact\n    renderWindow.Render();\n    renderer.ResetCamera();\n    renderWindow.Render();\n    renderWindowInteractor.Start();\n  }\n}\n
"},{"location":"Java/Visualization/ImageOrientation/","title":"ImageOrientation","text":"

vtk-examples/Java/Visualization/ImageOrientation

"},{"location":"Java/Visualization/ImageOrientation/#description","title":"Description","text":"

vtkImagePermute object reorders the axes of the input. Filtered axes specify the input axes which become X, Y, Z. The input has to have the same scalar type of the output. The filter does copy the data when it executes.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/ImageOrientation/#code","title":"Code","text":"

ImageOrientation.java

import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageEllipsoidSource;\nimport vtk.vtkImagePermute;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\n\npublic class ImageOrientation \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For originalViewport Color\n    double originalViewportColor[] = new double[4];\n    //For permutedViewport Color\n    double permutedViewportColor[] = new double[4];\n\n    colors.GetColor(\"SlateGray\", originalViewportColor);\n    colors.GetColor(\"LightSteelBlue\",permutedViewportColor);\n\n    // Create an image\n    vtkImageEllipsoidSource source = new vtkImageEllipsoidSource();\n    source.SetWholeExtent(0, 20, 0, 20, 0, 0);\n    source.SetCenter(10,10,0);\n    source.SetRadius(2,5,0);\n    source.Update();\n\n    vtkImagePermute permuteFilter = new vtkImagePermute();\n    permuteFilter.SetInputConnection(source.GetOutputPort());\n    permuteFilter.SetFilteredAxes(1,0,2);\n    permuteFilter.Update();\n\n    // Create actors\n    vtkImageActor originalActor = new vtkImageActor();\n    originalActor.GetMapper().SetInputConnection(source.GetOutputPort());\n\n    vtkImageActor permutedActor = new vtkImageActor();\n    permutedActor.GetMapper().SetInputConnection(permuteFilter.GetOutputPort());\n\n    // Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double originalViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};\n    double permutedViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n    // Setup renderers\n    vtkRenderer originalRenderer = new vtkRenderer();\n    originalRenderer.SetViewport(originalViewport);\n    originalRenderer.AddActor(originalActor);\n    originalRenderer.ResetCamera();\n    originalRenderer.SetBackground(originalViewportColor);\n\n    vtkRenderer permutedRenderer = new vtkRenderer();\n    permutedRenderer.SetViewport(permutedViewport);\n    permutedRenderer.AddActor(permutedActor);\n    permutedRenderer.ResetCamera();\n    permutedRenderer.SetBackground(permutedViewportColor);\n\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.SetSize(600, 300);\n    renderWindow.AddRenderer(originalRenderer);\n    renderWindow.AddRenderer(permutedRenderer);\n\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n\n    vtkInteractorStyleImage style =new vtkInteractorStyleImage();\n\n    renderWindowInteractor.SetInteractorStyle(style);\n\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n    renderWindow.Render();\n    renderWindowInteractor.Initialize();\n\n    renderWindowInteractor.Start();\n  }\n}\n
"},{"location":"Java/Visualization/Legend/","title":"Legend","text":"

vtk-examples/Java/Visualization/Legend

"},{"location":"Java/Visualization/Legend/#description","title":"Description","text":"

vtkLegendBoxActor object is used to associate a symbol with a text string.

The user specifies a vtkPolyData to use as the symbol, and a string associated with the symbol. The actor can then be placed in the scene in the same way that any other vtkActor2D can be used.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/Legend/#code","title":"Code","text":"

Legend.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkLegendBoxActor;\nimport vtk.vtkCubeSource;\nimport vtk.vtkPolyData;\n\n\npublic class Legend \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For boxLegendColor\n    double boxLegendColor[] = new double[4];\n    //For ballLegendColor\n    double ballLegendColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n    //Renderer legend Background Color\n    double legendBgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", boxLegendColor);\n    colors.GetColor(\"banana\", ballLegendColor);\n    colors.GetColor(\"cyan\", Bgcolor);\n    colors.GetColor(\"warm_grey\", legendBgcolor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0);\n    sphereSource.SetRadius(5000.0);\n    sphereSource.Update();\n\n    vtkPolyData polydata = sphereSource.GetOutput();\n\n    // Create a mapper\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputData(polydata);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    vtkLegendBoxActor legend = new vtkLegendBoxActor();\n    legend.SetNumberOfEntries(2);\n\n    vtkCubeSource legendBox = new vtkCubeSource();\n    legendBox.Update();\n    legend.SetEntry(0, legendBox.GetOutput(), \"Box\", boxLegendColor);\n    legend.SetEntry(1, sphereSource.GetOutput(), \"Ball\", ballLegendColor);\n\n    // place legend in lower right\n    legend.GetPositionCoordinate().SetCoordinateSystemToView();\n    legend.GetPositionCoordinate().SetValue(.5, -1.0);\n\n    legend.GetPosition2Coordinate().SetCoordinateSystemToView();\n    legend.GetPosition2Coordinate().SetValue(1.0, -0.5);\n\n    legend.UseBackgroundOn();\n    legend.SetBackgroundColor(legendBgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n    ren.AddActor(legend);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/LegendScaleActor/","title":"LegendScaleActor","text":"

vtk-examples/Java/Visualization/LegendScaleActor

"},{"location":"Java/Visualization/LegendScaleActor/#description","title":"Description","text":"

vtkLegendScaleActor object is used to annotate the render window. Its basic goal is to provide an indication of the scale of the scene. Four axes surrounding the render window indicate (in a variety of ways) the scale of what the camera is viewing. An option also exists for displaying a scale legend.

The axes can be programmed either to display distance scales or x-y coordinate values. By default, the scales display a distance. However, if you know that the view is down the z-axis, the scales can be programmed to display x-y coordinate values.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/LegendScaleActor/#code","title":"Code","text":"

LegendScaleActor.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkLegendScaleActor;\n\npublic class LegendScaleActor \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DarkSlateBlue\", Bgcolor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper  = new vtkPolyDataMapper();\n    sphereMapper .SetInputData (sphereSource.GetOutput());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkLegendScaleActor legendScaleActor = new vtkLegendScaleActor();\n\n    // Visualize\n    ren.AddActor(sphereActor);\n    ren.AddActor(legendScaleActor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/LineWidth/","title":"LineWidth","text":"

vtk-examples/Java/Visualization/LineWidth

"},{"location":"Java/Visualization/LineWidth/#description","title":"Description","text":"

vtkLineSource is a source object that creates a polyline defined by two endpoints. The number of segments composing the polyline is controlled by setting the object resolution.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/LineWidth/#code","title":"Code","text":"

LineWidth.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkLineSource;\n\npublic class LineWidth \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkLineSource lineSource = new vtkLineSource();\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(lineSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetLineWidth(5);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/LoopShrink/","title":"LoopShrink","text":"

vtk-examples/Java/Visualization/LoopShrink

"},{"location":"Java/Visualization/LoopShrink/#description","title":"Description","text":"

vtkShrinkFilter object shrinks cells composing an arbitrary data set towards their centroid.

The centroid of a cell is computed as the average position of the cell points. Shrinking results in disconnecting the cells from one another. The output of this filter is of general dataset type vtkUnstructuredGrid.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/LoopShrink/#code","title":"Code","text":"

LoopShrink.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkShrinkFilter;\nimport vtk.vtkElevationFilter;\n\n\npublic class LoopShrink \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetThetaResolution(12); sphere.SetPhiResolution(12);\n\n    vtkShrinkFilter shrink = new vtkShrinkFilter();\n    shrink.SetInputConnection(sphere.GetOutputPort());\n    shrink.SetShrinkFactor(0.9);\n\n    vtkElevationFilter colorIt = new vtkElevationFilter();\n    colorIt.SetInputConnection(shrink.GetOutputPort());\n    colorIt.SetLowPoint(0,0,-.5);\n    colorIt.SetHighPoint(0,0,.5);\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(colorIt.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/MoveActor/","title":"MoveActor","text":"

vtk-examples/Java/Visualization/MoveActor

"},{"location":"Java/Visualization/MoveActor/#description","title":"Description","text":"

This example creates two spheres. They can be moved/scaled/rotated independent of each other using the mouse.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/MoveActor/#code","title":"Code","text":"

MoveActor.java

import vtk.vtkActor;\nimport vtk.vtkInteractorStyleTrackballActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\npublic class MoveActor\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    //Sphere1\n    vtkSphereSource sphereSource1 = new vtkSphereSource();\n    sphereSource1.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource1.SetRadius(4.0);\n    sphereSource1.Update();\n\n    vtkPolyDataMapper sphereMapper1  = new vtkPolyDataMapper();\n    sphereMapper1 .SetInputData (sphereSource1.GetOutput());\n\n    vtkActor sphereActor1 = new vtkActor();\n    sphereActor1.SetMapper(sphereMapper1);\n\n    //Sphere2\n    vtkSphereSource sphereSource2 = new vtkSphereSource();\n    sphereSource2.SetCenter(10.0, 0.0, 0.0 );\n    sphereSource2.SetRadius(3.0);\n    sphereSource2.Update();\n\n    vtkPolyDataMapper sphereMapper2  = new vtkPolyDataMapper();\n    sphereMapper2 .SetInputData (sphereSource2.GetOutput());\n\n    vtkActor sphereActor2 = new vtkActor();\n    sphereActor2.SetMapper(sphereMapper2);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor1);\n    ren.AddActor(sphereActor2);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    vtkInteractorStyleTrackballActor style = new vtkInteractorStyleTrackballActor();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/MoveCamera/","title":"MoveCamera","text":"

vtk-examples/Java/Visualization/MoveCamera

"},{"location":"Java/Visualization/MoveCamera/#description","title":"Description","text":"

This example creates two spheres. They will move together when the mouse is used to interact with the scene because the camera is actually what is moving causing the view of the spheres to change.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/MoveCamera/#code","title":"Code","text":"

MoveCamera.java

import vtk.vtkActor;\nimport vtk.vtkInteractorStyleTrackballCamera;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\npublic class MoveCamera\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    //Sphere1\n    vtkSphereSource sphereSource1 = new vtkSphereSource();\n    sphereSource1.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource1.SetRadius(4.0);\n    sphereSource1.Update();\n\n    vtkPolyDataMapper sphereMapper1  = new vtkPolyDataMapper();\n    sphereMapper1 .SetInputData (sphereSource1.GetOutput());\n\n    vtkActor sphereActor1 = new vtkActor();\n    sphereActor1.SetMapper(sphereMapper1);\n\n    //Sphere2\n    vtkSphereSource sphereSource2 = new vtkSphereSource();\n    sphereSource2.SetCenter(10.0, 0.0, 0.0 );\n    sphereSource2.SetRadius(3.0);\n    sphereSource2.Update();\n\n    vtkPolyDataMapper sphereMapper2  = new vtkPolyDataMapper();\n    sphereMapper2 .SetInputData (sphereSource2.GetOutput());\n\n    vtkActor sphereActor2 = new vtkActor();\n    sphereActor2.SetMapper(sphereMapper2);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor1);\n    ren.AddActor(sphereActor2);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/MultipleActors/","title":"MultipleActors","text":"

vtk-examples/Java/Visualization/MultipleActors

"},{"location":"Java/Visualization/MultipleActors/#description","title":"Description","text":"

This example creates two spheres and renders them. The idea is to show that each object needs its own mapper and actor and then multiple actors can be added to a renderer.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/MultipleActors/#code","title":"Code","text":"

MultipleActors.java

import vtk.vtkActor;\nimport vtk.vtkInteractorStyleTrackballCamera;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\npublic class MultipleActors\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    //Sphere1\n    vtkSphereSource sphereSource1 = new vtkSphereSource();\n    sphereSource1.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource1.SetRadius(4.0);\n    sphereSource1.Update();\n\n    vtkPolyDataMapper sphereMapper1  = new vtkPolyDataMapper();\n    sphereMapper1 .SetInputData (sphereSource1.GetOutput());\n\n    vtkActor sphereActor1 = new vtkActor();\n    sphereActor1.SetMapper(sphereMapper1);\n\n    //Sphere2\n    vtkSphereSource sphereSource2 = new vtkSphereSource();\n    sphereSource2.SetCenter(10.0, 0.0, 0.0 );\n    sphereSource2.SetRadius(3.0);\n    sphereSource2.Update();\n\n    vtkPolyDataMapper sphereMapper2  = new vtkPolyDataMapper();\n    sphereMapper2 .SetInputData (sphereSource2.GetOutput());\n\n    vtkActor sphereActor2 = new vtkActor();\n    sphereActor2.SetMapper(sphereMapper2);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor1);\n    ren.AddActor(sphereActor2);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/MultipleViewports/","title":"MultipleViewports","text":"

vtk-examples/Java/Visualization/MultipleViewports

"},{"location":"Java/Visualization/MultipleViewports/#description","title":"Description","text":"

This example creates a window with 4 viewports.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/MultipleViewports/#code","title":"Code","text":"

MultipleViewports.java

import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\npublic class MultipleViewports \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //  Define viewport ranges\n    double xmins[] = new double[] {0.0, 0.5, 0.0, 0.5};\n    double xmaxs[] = new double[] {0.5, 1.0, 0.5, 1.0};\n    double ymins[] = new double[] {0.0, 0.0, 0.5, 0.5};\n    double ymaxs[] = new double[] {0.5, 0.5, 1.0, 1.0};\n\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    for(int i = 0; i < 4; i++)\n    {\n     vtkRenderer ren = new vtkRenderer();\n     renWin.AddRenderer(ren);\n     ren.SetViewport(xmins[i],ymins[i],xmaxs[i],ymaxs[i]);\n\n     // Create a sphere\n     vtkSphereSource sphereSource = new vtkSphereSource();\n     sphereSource.SetCenter(0.0, 0.0, 0.0);\n     sphereSource.SetRadius(5);\n     sphereSource.Update();\n\n     // Create a mapper and actor\n     vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n     mapper.SetInputConnection(sphereSource.GetOutputPort());\n     vtkActor actor = new vtkActor();\n     actor.SetMapper(mapper);\n     ren.AddActor(actor);\n     ren.ResetCamera();\n\n     renWin.Render();\n     renWin.SetWindowName(\"Multiple ViewPorts\");\n    }    \n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/NoShading/","title":"NoShading","text":"

vtk-examples/Java/Visualization/NoShading

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/NoShading/#code","title":"Code","text":"

NoShading.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSphereSource;\n\npublic class NoShading\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Red\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"White\",BgColor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();  \n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(ActorColor); //red\n    actor.GetProperty().SetAmbient(1);\n    actor.GetProperty().SetDiffuse(0);\n    actor.GetProperty().SetSpecular(0);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor); // Background color white\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Visualization/Opacity/","title":"Opacity","text":"

vtk-examples/Java/Visualization/Opacity

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/Opacity/#code","title":"Code","text":"

Opacity.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkCubeSource;\nimport vtk.vtkSphereSource;\n\npublic class Opacity \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //Cube\n    vtkCubeSource cubeSource = new vtkCubeSource();\n    vtkPolyDataMapper cubeMapper = new vtkPolyDataMapper();\n    cubeMapper.SetInputConnection(cubeSource.GetOutputPort());\n\n    vtkActor cubeActor = new vtkActor();\n    cubeActor.GetProperty().SetOpacity(0.5);\n    cubeActor.SetMapper(cubeMapper);\n\n    //Sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor sphereActor =  new vtkActor();\n    sphereActor.GetProperty().SetColor(0.5,1,0.5);\n    sphereActor.GetProperty().SetOpacity(0.5);\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(cubeActor);\n    ren.AddActor(sphereActor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Visualization/OrientedGlyphs/","title":"OrientedGlyphs","text":"

vtk-examples/Java/Visualization/OrientedGlyphs

"},{"location":"Java/Visualization/OrientedGlyphs/#description","title":"Description","text":"

vtkGlyph3D object is a filter that copies a geometric representation (called a glyph) to every point in the input dataset.

The glyph is defined with polygonal data from a source filter input and it may be oriented along the input vectors or normals, and it may be scaled according to scalar data or vector magnitude.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/OrientedGlyphs/#code","title":"Code","text":"

OrientedGlyphs.java

import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkArrowSource;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\npublic class OrientedGlyphs\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                 \n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Teal\", actorColor);\n    colors.GetColor(\"Khaki\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyData Input = new vtkPolyData();\n    Input.ShallowCopy(Sphere.GetOutput());\n\n    vtkArrowSource ArrowSource = new vtkArrowSource();\n\n    vtkGlyph3D Glyph3D = new vtkGlyph3D();\n    Glyph3D.SetSourceConnection(ArrowSource.GetOutputPort());\n    Glyph3D.SetInputData(Input);\n    Glyph3D.SetScaleFactor(0.2);\n    Glyph3D.Update();\n\n    // Visualize\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Glyph3D.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.Render();\n    iren.Start();\n\n  }       \n}\n
"},{"location":"Java/Visualization/ProjectSphere/","title":"ProjectSphere","text":"

vtk-examples/Java/Visualization/ProjectSphere

"},{"location":"Java/Visualization/ProjectSphere/#description","title":"Description","text":"

vtkProjectSphereFilter object is a filter to 'unroll' a sphere. The unroll longitude is -180.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/ProjectSphere/#code","title":"Code","text":"

ProjectSphere.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkProjectSphereFilter;\nimport vtk.vtkElevationFilter;\nimport vtk.vtkParametricSuperEllipsoid;\nimport vtk.vtkParametricFunctionSource;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\n\npublic class ProjectSphere\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double leftRenderercolor[] = new double[4];\n    double rightRenderercolor[] = new double[4];\n\n    colors.GetColor(\"Tan\", leftRenderercolor);\n    colors.GetColor(\"LightSlateGray\", rightRenderercolor);\n\n    vtkParametricSuperEllipsoid surface = new vtkParametricSuperEllipsoid();\n    surface.SetN1(2.0);\n    surface.SetN2(0.5);\n\n    vtkParametricFunctionSource source = new vtkParametricFunctionSource();\n    source.SetParametricFunction(surface);\n\n    vtkElevationFilter elevationFilter = new vtkElevationFilter();\n    elevationFilter.SetInputConnection(source.GetOutputPort());\n    elevationFilter.SetLowPoint(0.0, 0.0, -4.0);\n    elevationFilter.SetHighPoint(0.0, 0.0, 4.0);\n    elevationFilter.Update();\n\n    // Deep copy the point data since in some versions of VTK, the ProjectSphereFilter modifies the input point data \n    vtkPolyData pd1 = new vtkPolyData();\n    pd1.DeepCopy(elevationFilter.GetOutput());\n\n    vtkProjectSphereFilter sphereProject1 = new vtkProjectSphereFilter();\n    sphereProject1.SetInputConnection(elevationFilter.GetOutputPort());\n    sphereProject1.Update();\n\n    vtkPolyDataMapper mapper1 = new vtkPolyDataMapper();\n    mapper1.SetInputConnection(sphereProject1.GetOutputPort());\n    mapper1.SetScalarRange(sphereProject1.GetOutput().GetPointData().GetScalars().GetRange());\n\n    vtkActor actor1 = new vtkActor();\n    actor1.SetMapper(mapper1);\n\n    vtkPolyDataMapper mapper2 = new vtkPolyDataMapper();\n    mapper2.SetInputData(pd1);\n    mapper2.SetScalarRange(pd1.GetPointData().GetScalars().GetRange());  \n\n    vtkActor actor2 = new vtkActor();\n    actor2.SetMapper(mapper2);\n\n    // A render window\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n\n    // Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double leftViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};\n    double rightViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n    // Setup both renderers\n    vtkRenderer leftRenderer = new vtkRenderer();\n    renderWindow.AddRenderer(leftRenderer);\n    leftRenderer.SetViewport(leftViewport);\n    leftRenderer.SetBackground(.6, .5, .4);\n\n    vtkRenderer rightRenderer = new vtkRenderer();\n    renderWindow.AddRenderer(rightRenderer);\n    rightRenderer.SetViewport(rightViewport);\n    rightRenderer.SetBackground(.4, .5, .6);\n\n    leftRenderer.AddActor(actor2);\n    rightRenderer.AddActor(actor1);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renderWindow);\n\n    leftRenderer.GetActiveCamera().Azimuth(30);\n    leftRenderer.GetActiveCamera().Elevation(-30);\n    leftRenderer.ResetCamera();\n\n    renderWindow.SetSize(640, 480);\n    renderWindow.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/ProteinRibbons/","title":"ProteinRibbons","text":"

vtk-examples/Java/Visualization/ProteinRibbons

"},{"location":"Java/Visualization/ProteinRibbons/#description","title":"Description","text":"

vtkProteinRibbonFilter object is a polydata algorithm that generates protein ribbons.

vtkPDBReader is a source object that reads Molecule files.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/ProteinRibbons/#code","title":"Code","text":"

ProteinRibbons.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkProteinRibbonFilter;\nimport vtk.vtkPDBReader;\nimport vtk.vtkInteractorStyleSwitch;\nimport vtk.vtkPolyDataMapper;\n\npublic class ProteinRibbons\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.pdb) e.g 2j6g.pdb\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Silver\", Bgcolor);\n\n    // read protein from pdb\n    vtkPDBReader reader = new vtkPDBReader();\n    reader.SetFileName(Filename);\n\n    // setup ribbon filter\n    vtkProteinRibbonFilter ribbonFilter = new vtkProteinRibbonFilter();\n    ribbonFilter.SetInputConnection(reader.GetOutputPort());\n\n    // setup poly data mapper\n    vtkPolyDataMapper polyDataMapper = new vtkPolyDataMapper();\n    polyDataMapper.SetInputConnection(ribbonFilter.GetOutputPort());\n\n    // setup actor\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(polyDataMapper);\n    actor.GetProperty().SetDiffuse(.7);\n    actor.GetProperty().SetSpecular(.5);\n    actor.GetProperty().SetSpecularPower(80.0);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleSwitch style = new vtkInteractorStyleSwitch();\n    style.SetCurrentStyleToTrackballCamera();\n\n    // Visualise\n    ren.AddActor(actor);\n    ren.ResetCameraClippingRange();\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.SetMultiSamples(0);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/RandomProbe/","title":"RandomProbe","text":"

vtk-examples/Java/Visualization/RandomProbe

"},{"location":"Java/Visualization/RandomProbe/#description","title":"Description","text":"

vtkProbeFilter object is a filter that computes point attributes (e.g., scalars, vectors, etc.) at specified point positions.

The filter has two inputs: the Input and Source. The Input geometric structure is passed through the filter. The point attributes are computed at the Input point positions by interpolating into the source data.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/RandomProbe/#code","title":"Code","text":"

RandomProbe.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkCone;\nimport vtk.vtkSampleFunction;\nimport vtk.vtkThreshold;\nimport vtk.vtkPointSource;\nimport vtk.vtkProbeFilter;\nimport vtk.vtkThresholdPoints;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkSphereSource;\n\n\npublic class RandomProbe\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    int resolution = 50;\n\n    //parse command line arguments\n    if (args.length > 1) \n    {\n      String res = args[0];\n      resolution = Integer.parseInt(res);\n    }\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n    colors.GetColor(\"DeepSkyBlue\", Bgcolor);\n\n    // Create a sampled cone\n    vtkCone implicitCone = new vtkCone();\n    implicitCone.SetAngle(30.0);\n\n    double radius = 1.0;\n    vtkSampleFunction sampledCone = new vtkSampleFunction();\n    sampledCone.SetSampleDimensions(resolution, resolution, resolution);\n    double xMin = -radius * 2.0;\n    double xMax =  radius * 2.0;\n    sampledCone.SetModelBounds(xMin, xMax, xMin, xMax, xMin, xMax);\n    sampledCone.SetImplicitFunction(implicitCone);\n\n    vtkThreshold thresholdCone = new vtkThreshold();\n    thresholdCone.SetInputConnection(sampledCone.GetOutputPort());\n    thresholdCone.ThresholdByLower(0);\n\n    vtkPointSource randomPoints = new vtkPointSource();\n    randomPoints.SetCenter (0.0, 0.0, 0.0);\n    randomPoints.SetNumberOfPoints(10000);\n    randomPoints.SetDistributionToUniform();\n    randomPoints.SetRadius(xMax);\n\n    // Probe the cone dataset with random points\n    vtkProbeFilter randomProbe = new vtkProbeFilter();\n    randomProbe.SetInputConnection(0, randomPoints.GetOutputPort());\n    randomProbe.SetInputConnection(1, thresholdCone.GetOutputPort());\n    randomProbe.Update();\n    randomProbe.GetOutput().GetPointData().SetActiveScalars(\"vtkValidPointMask\");\n\n    vtkThresholdPoints selectPoints = new vtkThresholdPoints();\n    selectPoints.SetInputConnection(randomProbe.GetOutputPort());\n    selectPoints.ThresholdByUpper(1.0);\n\n    vtkSphereSource sphere =new vtkSphereSource();\n    sphere.SetRadius(.05);\n\n    vtkGlyph3D glyph = new vtkGlyph3D();\n    glyph.SetSourceConnection(sphere.GetOutputPort());\n    glyph.SetInputConnection(selectPoints.GetOutputPort());\n\n    // Create a mapper and actor\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(glyph.GetOutputPort());\n    mapper.ScalarVisibilityOff();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/ScalarBarActor/","title":"ScalarBarActor","text":"

vtk-examples/Java/Visualization/ScalarBarActor

"},{"location":"Java/Visualization/ScalarBarActor/#description","title":"Description","text":"

This example demonstrates how to make a color bar to that reflects the range of values associated with a data set.

vtkScalarBarActor object creates a scalar bar with tick marks. A scalar bar is a legend that indicates to the viewer the correspondence between color value and data value. The legend consists of a rectangular bar made of rectangular pieces each colored a constant value.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/ScalarBarActor/#code","title":"Code","text":"

ScalarBarActor.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkFloatArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkScalarBarActor;\nimport vtk.vtkLookupTable;\n\n\npublic class ScalarBarActor \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Background  Color\n    double Bgcolor[] = new double[4];\n    //Renderer Background2 Color\n    double Bgcolor2[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n    colors.GetColor(\"Black\", Bgcolor2);\n\n    // Create a sphere for some geometry\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetCenter(0,0,0);\n    sphere.SetRadius(1);\n    sphere.Update();\n\n    // Create scalar data to associate with the vertices of the sphere\n    int numPts = sphere.GetOutput().GetPoints().GetNumberOfPoints();\n    vtkFloatArray scalars = new vtkFloatArray();\n    scalars.SetNumberOfValues( numPts );\n    for( int i = 0; i < numPts; ++i )\n    {\n      scalars.SetValue(i,(float)(i)/numPts);\n    }\n\n    vtkPolyData poly = new vtkPolyData();\n    poly.DeepCopy(sphere.GetOutput());\n    poly.GetPointData().SetScalars(scalars);\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputData(poly);\n    mapper.ScalarVisibilityOn();\n    mapper.SetScalarModeToUsePointData();\n    mapper.SetColorModeToMapScalars();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    vtkScalarBarActor scalarBar = new vtkScalarBarActor();\n    scalarBar.SetLookupTable(mapper.GetLookupTable());\n    scalarBar.SetTitle(\"Title\");\n    scalarBar.SetNumberOfLabels(4);\n\n    // Create a lookup table to share between the mapper and the scalarbar\n    vtkLookupTable hueLut = new vtkLookupTable();\n    hueLut.SetTableRange (0, 1);\n    hueLut.SetHueRange (0, 1);\n    hueLut.SetSaturationRange (1, 1);\n    hueLut.SetValueRange (1, 1);\n    hueLut.Build();\n\n    mapper.SetLookupTable( hueLut );\n    scalarBar.SetLookupTable( hueLut );\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.GradientBackgroundOn();\n    ren.AddActor(actor);\n    ren.AddActor2D(scalarBar);\n    ren.SetBackground(Bgcolor);\n    ren.SetBackground2(Bgcolor2);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/ScalarBarActorColorSeries/","title":"ScalarBarActorColorSeries","text":"

vtk-examples/Java/Visualization/ScalarBarActorColorSeries

"},{"location":"Java/Visualization/ScalarBarActorColorSeries/#description","title":"Description","text":"

The vtkColorSeries object stores palettes of colors. There are several default palettes (or schemes) available and functions to control several aspects of what colors are returned. In essence a color scheme is set and then the number of colors and individual color values may be requested.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/ScalarBarActorColorSeries/#code","title":"Code","text":"

ScalarBarActorColorSeries.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkFloatArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkScalarBarActor;\nimport vtk.vtkLookupTable;\nimport vtk.vtkColorSeries;\n\n\npublic class ScalarBarActorColorSeries \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Background  Color\n    double Bgcolor[] = new double[4];\n    //Renderer Background2 Color\n    double Bgcolor2[] = new double[4];\n\n    colors.GetColor(\"Crimson\", Bgcolor);\n    colors.GetColor(\"NavajoWhite\", Bgcolor2);\n\n    // Create a sphere for some geometry\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetCenter(0,0,0);\n    sphere.SetRadius(1);\n    sphere.SetPhiResolution(30);\n    sphere.SetThetaResolution(60);\n    sphere.Update();\n\n    // Create scalar data to associate with the vertices of the sphere\n    int numPts = sphere.GetOutput().GetPoints().GetNumberOfPoints();\n    vtkFloatArray scalars = new vtkFloatArray();\n    scalars.SetNumberOfValues( numPts );\n    for( int i = 0; i < numPts; ++i )\n    {\n      scalars.SetValue(i,(float)(i)/numPts);\n    }\n\n    vtkPolyData poly = new vtkPolyData();\n    poly.DeepCopy(sphere.GetOutput());\n    poly.GetPointData().SetScalars(scalars);\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputData(poly);\n    mapper.ScalarVisibilityOn();\n    mapper.SetScalarModeToUsePointData();\n    mapper.SetColorModeToMapScalars();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetInterpolationToFlat();\n\n    vtkScalarBarActor scalarBar = new vtkScalarBarActor();\n    scalarBar.SetLookupTable(mapper.GetLookupTable());\n    scalarBar.SetTitle(\"Beachball\");\n    scalarBar.SetNumberOfLabels(4);\n\n    // Create a lookup table to share between the mapper and the scalarbar\n    vtkLookupTable seriesLut = new vtkLookupTable();\n\n    vtkColorSeries series = new vtkColorSeries();\n    int seriesEnum = 16;\n    series.SetColorScheme(seriesEnum);\n    series.BuildLookupTable(seriesLut, 0);\n\n    mapper.SetLookupTable(seriesLut);\n    scalarBar.SetLookupTable(seriesLut);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.GradientBackgroundOn();\n    ren.AddActor(actor);\n    ren.AddActor2D(scalarBar);\n    ren.SetBackground(Bgcolor);\n    ren.SetBackground2(Bgcolor2);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/ScalarVisibility/","title":"ScalarVisibility","text":"

vtk-examples/Java/Visualization/ScalarVisibility

"},{"location":"Java/Visualization/ScalarVisibility/#description","title":"Description","text":"

vtkPointSource is a source object that creates a user-specified number of points within a specified radius about a specified center point.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/ScalarVisibility/#code","title":"Code","text":"

ScalarVisibility.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPointSource;\n\n\npublic class ScalarVisibility \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    colors.GetColor(\"Red\", actorColor);\n\n    vtkPointSource pointSource = new vtkPointSource();\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(pointSource.GetOutputPort());\n    mapper.ScalarVisibilityOff();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper( mapper );\n    actor.GetProperty().SetColor(actorColor);\n    actor.GetProperty().SetPointSize(8);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/SideBySideViewports/","title":"SideBySideViewports","text":"

vtk-examples/Java/Visualization/SideBySideViewports

"},{"location":"Java/Visualization/SideBySideViewports/#description","title":"Description","text":"

This example splits the window into a left and right side. A sphere is drawn on the left and a cube is drawn on the right.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/SideBySideViewports/#code","title":"Code","text":"

SideBySideViewports.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkCubeSource;\n\npublic class SideBySideViewports \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //leftRenderer Background Color\n    double leftRenderercolor[] = new double[4];\n    //rightRenderer Background Color\n    double rightRenderercolor[] = new double[4];\n\n    colors.GetColor(\"Tan\", leftRenderercolor);\n    colors.GetColor(\"LightSlateGray\", rightRenderercolor);\n\n    // Setup sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(sphereSource.GetOutputPort());\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Setup cube\n    vtkCubeSource cubeSource = new vtkCubeSource();\n    cubeSource.Update();\n    vtkPolyDataMapper cubeMapper = new vtkPolyDataMapper();\n    cubeMapper.SetInputConnection(cubeSource.GetOutputPort());\n    vtkActor cubeActor = new vtkActor();\n    cubeActor.SetMapper(cubeMapper);\n    cubeActor.GetProperty().SetDiffuseColor(.3, .6, .4);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double leftViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};\n    double rightViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n    // Setup both renderers\n    vtkRenderer leftRenderer = new vtkRenderer();\n    renWin.AddRenderer(leftRenderer);\n    leftRenderer.SetViewport(leftViewport);\n    leftRenderer.SetBackground(leftRenderercolor);  \n\n    vtkRenderer rightRenderer = new vtkRenderer();\n    renWin.AddRenderer(rightRenderer);\n    rightRenderer.SetViewport(rightViewport);\n    rightRenderer.SetBackground(rightRenderercolor);  \n\n    // Add the sphere to the left and the cube to the right\n    leftRenderer.AddActor(sphereActor);\n    rightRenderer.AddActor(cubeActor);\n\n    leftRenderer.ResetCamera();\n\n    rightRenderer.ResetCamera();\n    rightRenderer.GetActiveCamera().Azimuth(30);\n    rightRenderer.GetActiveCamera().Elevation(30);\n\n    renWin.SetSize(600, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Visualization/VectorFieldExample/","title":"VectorFieldExample","text":"

vtk-examples/Java/Visualization/VectorFieldExample

"},{"location":"Java/Visualization/VectorFieldExample/#description","title":"Description","text":"

The code below shows how to load a vector field from a vtu file, where some data is stored and we are only interested in the vector field.

Note

Please make sure that you adapt the code below to your system properties, like e.g. paths to native vtk libraries.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/VectorFieldExample/#code","title":"Code","text":"

VectorFieldExample.java

import java.awt.BorderLayout;\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.Serializable;\nimport java.util.concurrent.TimeUnit;\nimport javax.swing.JFrame;\nimport javax.swing.SwingUtilities;\n\nimport vtk.vtkActor;\nimport vtk.vtkArrowSource;\nimport vtk.vtkCubeSource;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkObject;\nimport vtk.vtkPanel;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkThresholdPoints;\nimport vtk.vtkUnstructuredGrid;\nimport vtk.vtkXMLUnstructuredGridReader;\n\n\npublic class VectorFieldExample implements Serializable {\n\n  private static final long serialVersionUID = 1L;\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static vtkPanel showVectorField(\n      File file,\n      int elementInFile,\n      double threshold,\n      double scaleFactor) {\n\n    vtkXMLUnstructuredGridReader reader = new vtkXMLUnstructuredGridReader();\n\n    reader.SetFileName(file.getAbsolutePath());\n    reader.Update();\n    vtkUnstructuredGrid image = reader.GetOutput();\n    image.GetPointData().SetVectors(image.GetPointData().GetArray(elementInFile));\n\n    vtkThresholdPoints thresholdVector = new vtkThresholdPoints();\n    thresholdVector.SetInputData(image);\n    thresholdVector.SetInputArrayToProcess(\n        elementInFile,\n        image.GetInformation());\n\n    thresholdVector.ThresholdByUpper(threshold);\n    thresholdVector.Update();\n\n\n    // represent vector field\n    vtkGlyph3D vectorGlyph = new vtkGlyph3D();\n    vtkArrowSource arrowSource = new vtkArrowSource();\n    vtkPolyDataMapper vectorGlyphMapper = new vtkPolyDataMapper();\n\n    int n = image.GetPointData().GetNumberOfArrays();\n    for (int i = 0; i < n; i++) {\n      System.out.println(\"name of array[\" + i + \"]: \" + image.GetPointData().GetArrayName(i));\n    }\n\n    vtkPolyData tmp = thresholdVector.GetOutput();\n    System.out.println(\"number of thresholded points: \" + tmp.GetNumberOfPoints());\n\n    vectorGlyph.SetInputData(image);\n    vectorGlyph.SetSourceConnection(arrowSource.GetOutputPort());\n    vectorGlyph.SetScaleModeToScaleByVector();\n    vectorGlyph.SetVectorModeToUseVector();\n    vectorGlyph.ScalingOn();\n    vectorGlyph.OrientOn();\n    vectorGlyph.SetInputArrayToProcess(\n        elementInFile,\n        image.GetInformation());\n\n    vectorGlyph.SetScaleFactor(scaleFactor);\n\n    vectorGlyph.Update();\n\n    vectorGlyphMapper.SetInputConnection(vectorGlyph.GetOutputPort());\n    vectorGlyphMapper.Update();\n\n    vtkActor vectorActor = new vtkActor();\n    vectorActor.SetMapper(vectorGlyphMapper);\n\n\n    vtkPanel vis = new vtkPanel();\n    vis.GetRenderer().AddActor(vectorActor);\n\n    return vis;\n  }\n\n  //  public static void main(String s[]) throws IOException {\n  public static void main(String[] args) {\n    //parse command line arguments\n    if (args.length != 1) {\n      System.err.println(\"Usage: java -classpath ... VectorFieldExample Filename(.vtu) e.g tetra.vtu\");\n      return;\n    }\n\n    String filename = args[0];\n\n    SwingUtilities.invokeLater(new Runnable() {\n\n      @Override\n      public void run() {\n\n        JFrame frame = new JFrame(\"VTKJPanel Demo\");\n        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\n        File file = new File(filename); // needs to be replaced\n\n        vtkPanel panel = showVectorField(file, 2, 0.001, 0.05); // values need to be replaced\n\n        frame.add(panel, BorderLayout.CENTER);\n        frame.setSize(600, 600);\n        frame.setLocationRelativeTo(null);\n        frame.setVisible(true);\n\n        panel.repaint();\n\n      }\n    });\n  }\n}\n
"},{"location":"Java/Visualization/VisualizeImageData/","title":"VisualizeImageData","text":"

vtk-examples/Java/Visualization/VisualizeImageData

"},{"location":"Java/Visualization/VisualizeImageData/#description","title":"Description","text":"

vtkImageData is a data object that is a concrete implementation of vtkDataSet.

vtkImageData represents a geometric structure that is a topological and geometrical regular array of points.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/VisualizeImageData/#code","title":"Code","text":"

VisualizeImageData.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkImageData;\nimport vtk.vtkDataSetMapper;\n\npublic class VisualizeImageData \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Gold\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SpringGreen\",BgColor);\n\n    //  Create an image data\n    vtkImageData imageData = new vtkImageData();\n\n    // Specify the size of the image data\n    imageData.SetDimensions(3,3,2);\n    imageData.SetSpacing(1.0, 1.0, 1.0);\n    imageData.SetOrigin(0.0, 0.0, 0.0);\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputData(imageData);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Visualization/VisualizeVTP/","title":"VisualizeVTP","text":"

vtk-examples/Java/Visualization/VisualizeVTP

"},{"location":"Java/Visualization/VisualizeVTP/#description","title":"Description","text":"

This example shows how to load a vtp file and render it in an interactive window.

The example accepts a .vtp file on the command line.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/VisualizeVTP/#code","title":"Code","text":"

VisualizeVTP.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkXMLPolyDataReader;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\n\npublic class VisualizeVTP \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"LightSlateGray\",BgColor);\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtp) e.g Bunny.vtp\");\n      return;\n    }\n\n    //Read the polydata for the icon\n    vtkXMLPolyDataReader reader =  new vtkXMLPolyDataReader();\n    reader.SetFileName(args[0]);\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Visualization/WindowSize/","title":"WindowSize","text":"

vtk-examples/Java/Visualization/WindowSize

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/WindowSize/#code","title":"Code","text":"

WindowSize.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\n\npublic class WindowSize \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",BgColor);\n\n    //Sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    //sphereSource.SetCenter(0.0, 0.0, 0.0);\n    sphereSource.SetRadius(5.0);\n    sphereSource.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(200,100); //(width, height)\n\n    renWin.Render();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Visualization/WireframeSphere/","title":"WireframeSphere","text":"

vtk-examples/Java/Visualization/WireframeSphere

"},{"location":"Java/Visualization/WireframeSphere/#description","title":"Description","text":"

This Program demonstrates how to create a wire-frame sphere in Java using VTK.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Visualization/WireframeSphere/#code","title":"Code","text":"

WireframeSphere.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Sphere\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[])\n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    colors.GetColor(\"Silver\", actorColor);\n    colors.GetColor(\"PaleVioletRed\", Bgcolor);\n\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(1.0);\n    Sphere.Update();\n\n    //Change Phi and Theta Value for Smooth Surface\n    Sphere.SetPhiResolution(10);\n    Sphere.SetThetaResolution(10);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n    //Setting up the wireframe property to Sphere. Comment the below line to display Solid Sphere\n    Actor.GetProperty().SetRepresentationToWireframe();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n }\n
"},{"location":"Java/VisualizationAlgorithms/Cutter/","title":"Cutter","text":"

vtk-examples/Java/VisualizationAlgorithms/Cutter

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/VisualizationAlgorithms/Cutter/#code","title":"Code","text":"

Cutter.java

import vtk.vtkActor;\nimport vtk.vtkCubeSource;\nimport vtk.vtkCutter;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPlane;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class Cutter {\n  private static final long serialVersionUID = 1L;\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args) {\n    vtkNamedColors color = new vtkNamedColors();\n    double planeColor[] = new double[4];\n    color.GetColor(\"Yellow\", planeColor);\n    double cubeColor[] = new double[4];\n    color.GetColor(\"Aquamarine\", cubeColor);\n    double bgColor[] = new double[4];\n    color.GetColor(\"Silver\", bgColor);\n\n\n    vtkCubeSource cube = new vtkCubeSource();\n    cube.SetXLength(40);\n    cube.SetYLength(30);\n    cube.SetZLength(20);\n    vtkPolyDataMapper cubeMapper = new vtkPolyDataMapper();\n    cubeMapper.SetInputConnection(cube.GetOutputPort());\n\n    // create a plane to cut,here it cuts in the XZ direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0)\n    vtkPlane plane = new vtkPlane();\n    plane.SetOrigin(10, 0, 0);\n    plane.SetNormal(1, 0, 0);\n\n    //create cutter\n    vtkCutter cutter = new vtkCutter();\n    cutter.SetCutFunction(plane);\n    cutter.SetInputData(cubeMapper.GetInput());\n    cutter.Update();\n\n    vtkPolyDataMapper cutterMapper = new vtkPolyDataMapper();\n    cutterMapper.SetInputConnection(cutter.GetOutputPort());\n\n    //create plane actor\n    vtkActor planeActor = new vtkActor();\n    planeActor.GetProperty().SetColor(planeColor);\n    planeActor.GetProperty().SetLineWidth(2);\n    planeActor.SetMapper(cutterMapper);\n\n    //create cube actor\n    vtkActor cubeActor = new vtkActor();\n    cubeActor.GetProperty().SetColor(cubeColor);\n    cubeActor.GetProperty().SetOpacity(0.3);\n    cubeActor.SetMapper(cubeMapper);\n\n    //create renderers and add actors of plane and cube\n    vtkRenderer ren = new vtkRenderer();\n    ren.AddActor(planeActor);\n    ren.AddActor(cubeActor);\n\n    //Add renderer to renderwindow and render\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetSize(600, 600);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n    ren.SetBackground(bgColor);\n    renWin.Render();\n\n    iren.Start();\n  }\n}\n
"},{"location":"Java/VisualizationAlgorithms/IceCream/","title":"IceCream","text":"

vtk-examples/Java/VisualizationAlgorithms/IceCream

"},{"location":"Java/VisualizationAlgorithms/IceCream/#description","title":"Description","text":"

This example demonstrates how to use boolean combinations of implicit functions to create a model of an ice cream cone.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/VisualizationAlgorithms/IceCream/#code","title":"Code","text":"

IceCream.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkCone;\nimport vtk.vtkPlane;\nimport vtk.vtkSphere;\nimport vtk.vtkImplicitBoolean;\nimport vtk.vtkSampleFunction;\nimport vtk.vtkContourFilter;\n\n\npublic class IceCream \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    // This example demonstrates how to use boolean combinations of implicit \n    //functions to create a model of an ice cream cone.\n\n    // Create implicit function primitives. These have been carefully placed to\n    // give the effect that we want. We are going to use various combinations of\n    // these functions to create the shape we want; for example, we use planes\n    // intersected with a cone (which is infinite in extent) to get a finite cone.\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For coneActor Color\n    double coneActorColor[] = new double[4];\n    //For creamActor Color\n    double creamActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"chocolate\", coneActorColor);\n    colors.GetColor(\"mint\", creamActorColor);\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    vtkCone cone = new vtkCone();\n    cone.SetAngle(20);\n\n    vtkPlane vertPlane = new vtkPlane();\n    vertPlane.SetOrigin(.1, 0, 0);\n    vertPlane.SetNormal(-1, 0, 0);\n\n    vtkPlane basePlane = new vtkPlane();\n    basePlane.SetOrigin(1.2, 0, 0);\n    basePlane.SetNormal(1, 0, 0);\n\n    vtkSphere iceCream = new vtkSphere();\n    iceCream.SetCenter(1.333, 0, 0);\n    iceCream.SetRadius(0.5);\n\n    vtkSphere bite = new vtkSphere();\n    bite.SetCenter(1.5, 0, 0.5);\n    bite.SetRadius(0.25);\n\n    // Combine primitives to build ice-cream cone. Clip the cone with planes.\n    vtkImplicitBoolean theCone = new vtkImplicitBoolean();\n    theCone.SetOperationTypeToIntersection();\n    theCone.AddFunction(cone);\n    theCone.AddFunction(vertPlane);\n    theCone.AddFunction(basePlane);\n\n    // Take a bite out of the ice cream.\n    vtkImplicitBoolean theCream = new vtkImplicitBoolean();\n    theCream.SetOperationTypeToDifference();\n    theCream.AddFunction(iceCream);\n    theCream.AddFunction(bite);\n\n    // The sample function generates a distance function from the\n    // implicit function (which in this case is the cone). \n    // This is then contoured to get a polygonal surface.\n\n    vtkSampleFunction theConeSample = new vtkSampleFunction();\n    theConeSample.SetImplicitFunction(theCone);\n    theConeSample.SetModelBounds(-1, 1.5, -1.25, 1.25, -1.25, 1.25);\n    theConeSample.SetSampleDimensions(128, 128, 128);\n    theConeSample.ComputeNormalsOff();\n\n    vtkContourFilter theConeSurface = new vtkContourFilter();\n    theConeSurface.SetInputConnection(theConeSample.GetOutputPort());\n    theConeSurface.SetValue(0, 0.0);\n\n    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();\n    coneMapper.SetInputConnection(theConeSurface.GetOutputPort());\n    coneMapper.ScalarVisibilityOff();\n\n    vtkActor coneActor = new vtkActor();\n    coneActor.SetMapper(coneMapper);\n    coneActor.GetProperty().SetColor(coneActorColor);\n\n    //The same here for the ice cream.\n\n    vtkSampleFunction theCreamSample = new vtkSampleFunction();\n    theCreamSample.SetImplicitFunction(theCream);\n    theCreamSample.SetModelBounds(0, 2.5, -1.25, 1.25, -1.25, 1.25);\n    theCreamSample.SetSampleDimensions(128, 128, 128);\n    theCreamSample.ComputeNormalsOff();\n\n    vtkContourFilter theCreamSurface = new vtkContourFilter();\n    theCreamSurface.SetInputConnection(theCreamSample.GetOutputPort());\n    theCreamSurface.SetValue(0, 0.0);\n\n    vtkPolyDataMapper creamMapper = new vtkPolyDataMapper();\n    creamMapper.SetInputConnection(theCreamSurface.GetOutputPort());\n    creamMapper.ScalarVisibilityOff();\n\n    vtkActor creamActor = new vtkActor();\n    creamActor.SetMapper(creamMapper);\n    creamActor.GetProperty().SetDiffuseColor(creamActorColor);\n    creamActor.GetProperty().SetSpecular(.6);\n    creamActor.GetProperty().SetSpecularPower(50);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(coneActor);\n    ren.AddActor(creamActor);\n    ren.SetBackground(Bgcolor);\n    ren.ResetCamera();\n    ren.GetActiveCamera().Roll(90);\n    ren.GetActiveCamera().Dolly(1.25);\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/VisualizationAlgorithms/SpikeFran/","title":"SpikeFran","text":"

vtk-examples/Java/VisualizationAlgorithms/SpikeFran

"},{"location":"Java/VisualizationAlgorithms/SpikeFran/#description","title":"Description","text":"

This examples uses glyphs to indicate surface normals on model of human face. Glyph positions are randomly selected.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/VisualizationAlgorithms/SpikeFran/#code","title":"Code","text":"

SpikeFran.java

import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkPolyDataReader;\nimport vtk.vtkPolyDataNormals;\nimport vtk.vtkTransformPolyDataFilter;\nimport vtk.vtkMaskPoints;\nimport vtk.vtkConeSource;\nimport vtk.vtkTransform;\n\npublic class SpikeFran\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtk) e.g fran_cut.vtk\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For franActor Color\n    double franActorColor[] = new double[4];\n    //For spikeActor Color\n    double spikeActorColor[] = new double[4];\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Flesh\", franActorColor);\n    colors.GetColor(\"Emerald_Green\", spikeActorColor);\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    vtkPolyDataReader fran = new vtkPolyDataReader();\n    fran.SetFileName(inputFilename);\n\n    vtkPolyDataNormals normals = new vtkPolyDataNormals();\n    normals.SetInputConnection(fran.GetOutputPort());\n    normals.FlipNormalsOn();\n\n    vtkPolyDataMapper franMapper = new vtkPolyDataMapper();\n    franMapper.SetInputConnection(normals.GetOutputPort());\n\n    vtkActor franActor = new vtkActor();\n    franActor.SetMapper(franMapper);\n    franActor.GetProperty().SetColor(franActorColor);\n\n    // We subsample the dataset because we want to glyph just a subset of\n    // the points. Otherwise the display is cluttered and cannot be easily\n    // read. The RandomModeOn and SetOnRatio combine to random select one out\n    // of every 10 points in the dataset.\n\n    vtkMaskPoints ptMask = new vtkMaskPoints();\n    ptMask.SetInputConnection(normals.GetOutputPort());\n    ptMask.SetOnRatio(10);\n    ptMask.RandomModeOn();\n\n    // In this case we are using a cone as a glyph. We transform the cone so\n    // its base is at 0,0,0. This is the point where glyph rotation occurs.\n\n    vtkConeSource cone = new vtkConeSource();\n    cone.SetResolution(6);\n\n    vtkTransform transform = new vtkTransform();\n    transform.Translate(0.5, 0.0, 0.0);\n\n    vtkTransformPolyDataFilter transformF = new vtkTransformPolyDataFilter();\n    transformF.SetInputConnection(cone.GetOutputPort());\n    transformF.SetTransform(transform);\n\n    // vtkGlyph3D takes two inputs: the input point set (SetInputConnection)\n    // which can be any vtkDataSet; and the glyph (SetSourceConnection) which\n    // must be a vtkPolyData.  We are interested in orienting the glyphs by the\n    // surface normals that we previously generated.\n\n    vtkGlyph3D glyph = new vtkGlyph3D();\n    glyph.SetInputConnection(ptMask.GetOutputPort());\n    glyph.SetSourceConnection(transformF.GetOutputPort());\n    glyph.SetVectorModeToUseNormal();\n    glyph.SetScaleModeToScaleByVector();\n    glyph.SetScaleFactor(0.004);\n\n    vtkPolyDataMapper spikeMapper = new vtkPolyDataMapper();\n    spikeMapper.SetInputConnection(glyph.GetOutputPort());\n\n    vtkActor spikeActor = new vtkActor();\n    spikeActor.SetMapper(spikeMapper);\n    spikeActor.GetProperty().SetColor(spikeActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetSize(640, 480);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(franActor);\n    ren.AddActor(spikeActor);\n    renWin.Render();\n\n    ren.SetBackground(Bgcolor);\n    ren.GetActiveCamera().Zoom(1.4);\n    ren.GetActiveCamera().Azimuth(110);\n\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/VolumeRendering/SimpleRayCast/","title":"SimpleRayCast","text":"

vtk-examples/Java/VolumeRendering/SimpleRayCast

"},{"location":"Java/VolumeRendering/SimpleRayCast/#description","title":"Description","text":"

Volume rendering of a high potential iron protein.

Info

See Figure 7-34 in Chapter 7 the VTK Textbook.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/VolumeRendering/SimpleRayCast/#code","title":"Code","text":"

SimpleRayCast.java

import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkStructuredPointsReader;\nimport vtk.vtkPiecewiseFunction;\nimport vtk.vtkColorTransferFunction;\nimport vtk.vtkVolumeProperty;\nimport vtk.vtkFixedPointVolumeRayCastMapper;\nimport vtk.vtkVolume;\n\n\npublic class SimpleRayCast \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtk) e.g ironProt.vtk\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", actorColor);\n    colors.GetColor(\"Wheat\", Bgcolor);\n\n    // Create the reader for the data\n    vtkStructuredPointsReader reader = new vtkStructuredPointsReader();\n    reader.SetFileName(inputFilename);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Create transfer mapping scalar value to opacity\n    vtkPiecewiseFunction opacityTransferFunction = new vtkPiecewiseFunction();\n    opacityTransferFunction.AddPoint(20, 0.0);\n    opacityTransferFunction.AddPoint(255, 0.2);\n\n    // Create transfer mapping scalar value to color\n    vtkColorTransferFunction colorTransferFunction = new vtkColorTransferFunction();\n    colorTransferFunction.AddRGBPoint(0.0, 0.0, 0.0, 0.0);\n    colorTransferFunction.AddRGBPoint(64.0, 1.0, 0.0, 0.0);\n    colorTransferFunction.AddRGBPoint(128.0, 0.0, 0.0, 1.0);\n    colorTransferFunction.AddRGBPoint(192.0, 0.0, 1.0, 0.0);\n    colorTransferFunction.AddRGBPoint(255.0, 0.0, 0.2, 0.0);\n\n    // The property describes how the data will look\n    vtkVolumeProperty volumeProperty = new vtkVolumeProperty();\n    volumeProperty.SetColor(colorTransferFunction);\n    volumeProperty.SetScalarOpacity(opacityTransferFunction);\n    volumeProperty.ShadeOn();\n    volumeProperty.SetInterpolationTypeToLinear();\n\n    // The mapper / ray cast function know how to render the data\n    vtkFixedPointVolumeRayCastMapper volumeMapper = new vtkFixedPointVolumeRayCastMapper();\n    volumeMapper.SetInputConnection(reader.GetOutputPort());\n\n    // The volume holds the mapper and the property and can be used to position/orient the volume\n    vtkVolume volume = new vtkVolume();\n    volume.SetMapper(volumeMapper);\n    volume.SetProperty(volumeProperty);\n\n    ren.AddVolume(volume);\n    ren.SetBackground(Bgcolor);\n    ren.GetActiveCamera().Azimuth(45);\n    ren.GetActiveCamera().Elevation(30);\n    ren.ResetCameraClippingRange();\n    ren.ResetCamera();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Widgets/AngleWidget/","title":"AngleWidget","text":"

vtk-examples/Java/Widgets/AngleWidget

"},{"location":"Java/Widgets/AngleWidget/#description","title":"Description","text":"

Click three points to create an angle. You can then drag the points around.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/AngleWidget/#code","title":"Code","text":"

AngleWidget.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkAngleWidget;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\n\n\npublic class AngleWidget {\n  //private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",BgColor);\n\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetInteractor(iren);\n    iren.SetRenderWindow(renWin);\n    ren.ResetCamera();\n    ren.SetBackground(BgColor);\n\n    // Angle Widget  \n    vtkAngleWidget angleWidget = new vtkAngleWidget();\n    angleWidget.SetInteractor(iren);\n    angleWidget .CreateDefaultRepresentation();\n\n    angleWidget.On();\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Start();\n    iren.Initialize();\n\n\n  }\n} \n
"},{"location":"Java/Widgets/AngleWidget2D/","title":"AngleWidget2D","text":"

vtk-examples/Java/Widgets/AngleWidget2D

"},{"location":"Java/Widgets/AngleWidget2D/#description","title":"Description","text":"

The arc is still visible?

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/AngleWidget2D/#code","title":"Code","text":"

AngleWidget2D.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkAngleRepresentation2D;\nimport vtk.vtkAngleWidget;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\n\n\npublic class AngleWidget2D  {\n  //private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) {\n\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",BgColor);\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n\n    double pos1[] = new double[] {50.0, 200.0, 0.0};\n    double pos2[] = new double[] {200.0, 20.0, 0.0};\n    double center[] =new double[] {100.0, 100.0, 0.0};\n\n    vtkAngleRepresentation2D Rep = new vtkAngleRepresentation2D();\n    Rep.ArcVisibilityOff();\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetInteractor(iren);\n    iren.SetRenderWindow(renWin);\n    ren.ResetCamera();\n    ren.SetBackground(BgColor);\n\n    // Angle Widget  \n    vtkAngleWidget angleWidget = new vtkAngleWidget();\n    angleWidget.SetInteractor(iren);\n    angleWidget .CreateDefaultRepresentation();\n    angleWidget.SetRepresentation(Rep);\n\n    angleWidget.On();\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n\n    Rep.SetPoint1DisplayPosition(pos1);\n    Rep.SetPoint2DisplayPosition(pos2);\n    Rep.SetCenterDisplayPosition(center);\n    Rep.Ray1VisibilityOn();\n    Rep.Ray2VisibilityOn();\n    Rep.ArcVisibilityOn();\n\n    iren.Start();\n\n  }\n} \n
"},{"location":"Java/Widgets/BalloonWidget/","title":"BalloonWidget","text":"

vtk-examples/Java/Widgets/BalloonWidget

"},{"location":"Java/Widgets/BalloonWidget/#description","title":"Description","text":"

This example creates a sphere and a regular polygon. The balloon text describes each object when you hover over it.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/BalloonWidget/#code","title":"Code","text":"

BalloonWidget.java

import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRegularPolygonSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkBalloonRepresentation;\nimport vtk.vtkBalloonWidget;\nimport vtk.vtkSphereSource;\n\n\npublic class BalloonWidget \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double SphereactorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n    //PolygonActor color\n    double PolygonActorColor[] = new double[4];\n\n    colors.GetColor(\"OrangeRed\", SphereactorColor);\n    colors.GetColor(\"SkyBlue\", Bgcolor);\n    colors.GetColor(\"Indigo\", PolygonActorColor);\n\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(-4.0,0.0,0.0);\n    Sphere.SetRadius(4.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor SphereActor = new vtkActor();\n    SphereActor.SetMapper(Mapper);\n    SphereActor.GetProperty().SetColor(SphereactorColor);\n\n    //Regular Polygon\n    vtkRegularPolygonSource RegularPolygon = new vtkRegularPolygonSource();\n    RegularPolygon.SetCenter(4, 0, 0);\n    RegularPolygon.SetRadius(4);\n    RegularPolygon.Update();\n\n    vtkPolyDataMapper PolygonMapper = new vtkPolyDataMapper();\n    PolygonMapper.SetInputConnection(RegularPolygon.GetOutputPort());\n\n    vtkActor PolygonActor = new vtkActor();\n    PolygonActor.SetMapper(PolygonMapper);\n    PolygonActor.GetProperty().SetColor(PolygonActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Create the widget\n    vtkBalloonRepresentation BalloonRep = new vtkBalloonRepresentation();\n    BalloonRep.SetBalloonLayoutToImageRight();\n\n\n    vtkBalloonWidget BalloonWidget = new vtkBalloonWidget();\n    BalloonWidget.SetInteractor(iren);\n    BalloonWidget.SetRepresentation(BalloonRep);\n    BalloonWidget.AddBalloon(SphereActor,\"Sphere\");\n    BalloonWidget.AddBalloon(PolygonActor,\"Polygon\");\n\n    // Visualise the arrow\n    ren.AddActor(SphereActor);\n    ren.AddActor(PolygonActor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n    BalloonWidget.EnabledOn();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Widgets/CaptionWidget/","title":"CaptionWidget","text":"

vtk-examples/Java/Widgets/CaptionWidget

"},{"location":"Java/Widgets/CaptionWidget/#description","title":"Description","text":"

vtkCaptionWidget object provides support for interactively placing a caption on the 2D overlay plane.

A caption is defined by some text with a leader (e.g., arrow) that points from the text to a point in the scene.

The caption is represented by a vtkCaptionRepresentation. It uses the event bindings of its superclass (vtkBorderWidget) to control the placement of the text, and adds the ability to move the attachment point around. In addition, when the caption text is selected, the widget emits a ActivateEvent that observers can watch for. This is useful for opening GUI dialogoues to adjust font characteristics, etc.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/CaptionWidget/#code","title":"Code","text":"

CaptionWidget.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSphereSource;\nimport vtk.vtkCaptionRepresentation;\nimport vtk.vtkCaptionWidget;\n\npublic class CaptionWidget \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"red\",BgColor);\n\n    //Sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Create the widget and its representation\n    vtkCaptionRepresentation captionRepresentation = new vtkCaptionRepresentation();\n    captionRepresentation.GetCaptionActor2D().SetCaption(\"Test Caption\");\n    captionRepresentation.GetCaptionActor2D().GetTextActor().GetTextProperty().SetFontSize(100);\n\n    double pos[] = new double[] {0.5, 0, 0};\n    captionRepresentation.SetAnchorPosition(pos);\n\n    vtkCaptionWidget captionWidget = new vtkCaptionWidget();\n    captionWidget.SetInteractor(iren);\n    captionWidget.SetRepresentation(captionRepresentation);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n    captionWidget.On();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Widgets/DistanceWidget/","title":"DistanceWidget","text":"

vtk-examples/Java/Widgets/DistanceWidget

"},{"location":"Java/Widgets/DistanceWidget/#description","title":"Description","text":"

The vtkDistanceWidget object is used to measure the distance between two points.

The two end points can be positioned independently, and when they are released, a special PlacePointEvent is invoked so that special operations may be take to reposition the point (snap to grid, etc.)

The widget has two different modes of interaction - when initially defined (i.e., placing the two points) and then a manipulate mode (adjusting the position of the two points).

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/DistanceWidget/#code","title":"Code","text":"

DistanceWidget.java

import vtk.vtkRenderWindow;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkDistanceWidget;\n\n\npublic class DistanceWidget \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DimGray\", Bgcolor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkDistanceWidget DistanceWidget = new vtkDistanceWidget();\n    DistanceWidget.SetInteractor(iren);\n    DistanceWidget.CreateDefaultRepresentation();\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n    DistanceWidget.On();\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Widgets/ImagePlaneWidget/","title":"ImagePlaneWidget","text":"

vtk-examples/Java/Widgets/ImagePlaneWidget

"},{"location":"Java/Widgets/ImagePlaneWidget/#description","title":"Description","text":"

This 3D widget defines a plane that can be interactively placed in an image volume.

A nice feature of the object is that the vtkImagePlaneWidget, like any 3D widget, will work with the current interactor style.

That is, if vtkImagePlaneWidget does not handle an event, then all other registered observers (including the interactor style) have an opportunity to process the event. Otherwise, the vtkImagePlaneWidget will terminate the processing of the event that it handles.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/ImagePlaneWidget/#code","title":"Code","text":"

ImagePlaneWidget.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkActor;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkInteractorStyleTrackballCamera;\nimport vtk.vtkImagePlaneWidget;\n\npublic class ImagePlaneWidget\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //Sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle( style );\n\n    vtkImagePlaneWidget planeWidget = new vtkImagePlaneWidget();\n    planeWidget.SetInteractor(iren);\n    planeWidget.TextureVisibilityOff();\n\n    double origin[] = new double[]{0, 1, 0};\n    planeWidget.SetOrigin(origin);\n    planeWidget.UpdatePlacement();\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n    planeWidget.On();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Widgets/ImageTracerWidgetNonPlanar/","title":"ImageTracerWidgetNonPlanar","text":"

vtk-examples/Java/Widgets/ImageTracerWidgetNonPlanar

"},{"location":"Java/Widgets/ImageTracerWidgetNonPlanar/#description","title":"Description","text":"

vtkImageTracerWidget object is designed for manually tracing over image data.

The button actions and key modifiers are as follows for controlling the widget:

1) Left button click over the image, hold and drag draws a free hand line.

2) Left button click and release erases the widget line, if it exists, and repositions the first handle.

3) Middle button click starts a snap drawn line. The line is terminated by clicking the middle button while depressing the ctrl key.

4) When tracing a continuous or snap drawn line, if the last cursor position is within a specified tolerance to the first handle, the widget line will form a closed loop.

5) Right button clicking and holding on any handle that is part of a snap drawn line allows handle dragging: existing line segments are updated accordingly. If the path is open and AutoClose is set to On, the path can be closed by repositioning the first and last points over one another.

6) Ctrl key + right button down on any handle will erase it: existing snap drawn line segments are updated accordingly. If the line was formed by continuous tracing, the line is deleted leaving one handle.

7) Shift key + right button down on any snap drawn line segment will insert a handle at the cursor position. The line segment is split accordingly.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/ImageTracerWidgetNonPlanar/#code","title":"Code","text":"

ImageTracerWidgetNonPlanar.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkActor;\nimport vtk.vtkImageTracerWidget;\nimport vtk.vtkInteractorStyleTrackball;\nimport vtk.vtkSphereSource;\n\npublic class ImageTracerWidgetNonPlanar \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"LightCoral\",BgColor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    ren.AddActor(Actor);\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleTrackball Style = new vtkInteractorStyleTrackball();\n    iren.SetInteractorStyle(Style);  \n\n    vtkImageTracerWidget TracerWidget = new vtkImageTracerWidget();\n    TracerWidget.SetInteractor(iren);\n    TracerWidget.SetViewProp(Actor);\n    TracerWidget.On();\n\n    ren.SetBackground(BgColor);\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Start();\n    iren.Initialize();\n\n  }\n}\n
"},{"location":"Java/Widgets/LogoWidget/","title":"LogoWidget","text":"

vtk-examples/Java/Widgets/LogoWidget

"},{"location":"Java/Widgets/LogoWidget/#description","title":"Description","text":"

vtkLogoWidget object provides support for interactively displaying and manipulating a logo.

Logos are defined by an image and vtkLogoWidget allows you to interactively place and resize the image logo.

To use this widget, simply create a vtkLogoRepresentation and associate it with the vtkLogoWidget. Turn the widget on before the render. Otherwise, it won't appear until you interact with the scene.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/LogoWidget/#code","title":"Code","text":"

LogoWidget.java

import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkActor;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkLogoRepresentation;\nimport vtk.vtkLogoWidget;  \n\npublic class LogoWidget\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double Bgcolor[] = new double[] {0.2, 0.3, 0.4}; \n\n    //A sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0);\n    sphereSource.SetRadius(4.0);\n    sphereSource.SetPhiResolution(4);\n    sphereSource.SetThetaResolution(8);\n    sphereSource.Update();\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Create an image\n    vtkImageCanvasSource2D drawing = new vtkImageCanvasSource2D();\n    drawing.SetScalarTypeToUnsignedChar();\n    drawing.SetNumberOfScalarComponents(3);\n    drawing.SetExtent(0,200,0,200,0,0);\n\n    //Clear the image\n    // Note: SetDrawColour() uses double values of the rgb colors in the\n    //       range [0 ... 255]\n    //       So SetDrawColour(255, 255, 255) is white.\n    drawing.SetDrawColor(255, 127, 100);\n    drawing.FillBox(0,200,0,200);\n    drawing.SetDrawColor(0, 0, 0);\n    drawing.DrawCircle(100, 100, 50);\n    drawing.Update();\n\n    vtkLogoRepresentation logoRepresentation = new vtkLogoRepresentation();\n    logoRepresentation.SetImage(drawing.GetOutput());\n    logoRepresentation.SetPosition(0,0);\n    logoRepresentation.SetPosition2(.4, .4);\n    logoRepresentation.GetImageProperty().SetOpacity(.7);\n\n    vtkLogoWidget logoWidget = new vtkLogoWidget();\n    logoWidget.SetInteractor(iren);\n    logoWidget.SetRepresentation(logoRepresentation);\n    logoWidget.On();\n\n    ren.SetBackground(Bgcolor);\n    ren.AddActor(actor);\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
"},{"location":"Java/Widgets/OrientationMarkerWidget/","title":"OrientationMarkerWidget","text":"

vtk-examples/Java/Widgets/OrientationMarkerWidget

"},{"location":"Java/Widgets/OrientationMarkerWidget/#description","title":"Description","text":"

vtkOrientationMarkerWidget object provides support for interactively manipulating the position, size, and apparent orientation of a prop that represents an orientation marker.

This class works by adding its internal renderer to an external \"parent\" renderer on a different layer. The input orientation marker is rendered as an overlay on the parent renderer and, thus, appears superposed over all props in the parent's scene.

The camera view of the orientation the marker is made to match that of the parent's by means of an observer mechanism, giving the illusion that the orientation of the marker reflects that of the prop(s) in the parent's scene.

The widget listens to left mouse button and mouse movement events. It will change the cursor shape based on its location. If the cursor is over the overlay renderer, it will change the cursor shape to a SIZEALL shape or to a resize corner shape (e.g., SIZENW) if the cursor is near a corner. If the left mouse button is pressed and held down while moving, the overlay renderer, and hence, the orientation marker, is resized or moved. In the case of a resize operation, releasing the left mouse button causes the widget to enforce its renderer to be square. The diagonally opposite corner to the one moved is repositioned such that all edges of the renderer have the same length: the minimum.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/OrientationMarkerWidget/#code","title":"Code","text":"

OrientationMarkerWidget.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkXMLPolyDataReader;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkOrientationMarkerWidget;\nimport vtk.vtkSuperquadricSource;\n\n\npublic class OrientationMarkerWidget \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtp) e.g Bunny.vtp\");\n      return;\n    }\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For icon Actor Color\n    double iconActorColor[] = new double[4];\n    //For superquadricActor Color\n    double superquadricActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change icon Actor Color\n    Color.GetColor(\"Silver\",iconActorColor);\n    //Change Color Name to Use your own Color for Change icon superquadricActorColor\n    Color.GetColor(\"Carrot\",superquadricActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    //Read the polydata for the icon\n    vtkXMLPolyDataReader reader =  new vtkXMLPolyDataReader();\n    reader.SetFileName(args[0]);\n\n    vtkDataSetMapper iconMapper = new vtkDataSetMapper();\n    iconMapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor iconActor = new vtkActor();\n    iconActor.SetMapper(iconMapper);\n    iconActor.GetProperty().SetColor(iconActorColor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Set up the widget\n    vtkOrientationMarkerWidget widget = new vtkOrientationMarkerWidget();\n    widget.SetOrientationMarker( iconActor );\n    widget.SetInteractor( iren );\n    widget.SetViewport( 0.0, 0.0, 0.2, 0.2 );\n    widget.SetEnabled( 1 );\n    widget.InteractiveOn();\n\n    //Create a superquadric\n    vtkSuperquadricSource superquadricSource = new vtkSuperquadricSource();\n    superquadricSource.SetPhiRoundness(0.2);\n    superquadricSource.SetThetaRoundness(0.8);\n\n    //Create a mapper and actor\n    vtkPolyDataMapper superquadricMapper = new vtkPolyDataMapper();\n    superquadricMapper.SetInputConnection(superquadricSource.GetOutputPort());\n\n    vtkActor superquadricActor = new vtkActor();\n    superquadricActor.SetMapper(superquadricMapper);\n    superquadricActor.GetProperty().SetInterpolationToFlat();\n    superquadricActor.GetProperty().SetDiffuseColor(superquadricActorColor);\n    superquadricActor.GetProperty().SetSpecularColor(1.0, 1.0, 1.0);\n    superquadricActor.GetProperty().SetDiffuse(.6);\n    superquadricActor.GetProperty().SetSpecular(.5);\n    superquadricActor.GetProperty().SetSpecularPower(5.0);\n\n    ren.AddActor(superquadricActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Widgets/PlaneWidget/","title":"PlaneWidget","text":"

vtk-examples/Java/Widgets/PlaneWidget

Description:

vtkPlaneWidget defines a finite (bounded) plane that can be interactively placed in a scene. The plane has four handles (at its corner vertices), a normal vector, and the plane itself. The handles are used to resize the plane; the normal vector to rotate it, and the plane can be picked and translated.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/PlaneWidget/#code","title":"Code","text":"

PlaneWidget.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkPlaneWidget;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\n\npublic class PlaneWidget \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetInteractor(iren);\n    iren.SetRenderWindow(renWin);\n    ren.ResetCamera();\n    ren.SetBackground(BgColor);\n\n    // Angle Widget  \n    vtkPlaneWidget PlaneWidget = new vtkPlaneWidget();\n    PlaneWidget.SetInteractor(iren);\n\n    PlaneWidget.On();\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Start();\n    iren.Initialize();\n\n  }\n}\n
"},{"location":"Java/Widgets/SeedWidget/","title":"SeedWidget","text":"

vtk-examples/Java/Widgets/SeedWidget

"},{"location":"Java/Widgets/SeedWidget/#description","title":"Description","text":"

This example demonstrates how to use vtkSeedWidget, which generates (seeds) points to be placed in the scene in the locations where the user clicks.

The points can then be used for operations like connectivity, segmentation, and region growing. For an example using a custom callback where such operations can be assembled, see SeedWidgetWithCustomCallback.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/SeedWidget/#code","title":"Code","text":"

SeedWidget.java

import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkSeedWidget;\nimport vtk.vtkSeedRepresentation;\nimport vtk.vtkPointHandleRepresentation2D;\n\npublic class SeedWidget \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Crimson\", actorColor);\n    colors.GetColor(\"MediumAquamarine\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkPointHandleRepresentation2D HandleRep = new vtkPointHandleRepresentation2D();\n    HandleRep.GetProperty().SetColor(actorColor);\n\n    vtkSeedRepresentation WidgetRep = new vtkSeedRepresentation();\n    WidgetRep.SetHandleRepresentation(HandleRep);\n\n    // Create the seed widget\n    vtkSeedWidget SeedWidget = new vtkSeedWidget();\n    SeedWidget.SetInteractor(iren);\n    SeedWidget.SetRepresentation(WidgetRep);\n\n    SeedWidget.On();\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
"},{"location":"Java/Widgets/SplineWidget/","title":"SplineWidget","text":"

vtk-examples/Java/Widgets/SplineWidget

"},{"location":"Java/Widgets/SplineWidget/#description","title":"Description","text":"

Java Program to demonstrate the SplineWidget.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/SplineWidget/#code","title":"Code","text":"

SplineWidget.java

import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSplineWidget2;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\n\n\npublic class SplineWidget  \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkSalmon\",BgColor);\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetInteractor(iren);\n    iren.SetRenderWindow(renWin);\n    ren.ResetCamera();\n    ren.SetBackground(BgColor);\n\n    vtkSplineWidget2 splineWidget = new vtkSplineWidget2();\n    splineWidget.SetInteractor(iren);\n\n\n    iren.Initialize();\n    splineWidget.On();\n    iren.Start();\n\n  }\n\n}\n
"},{"location":"Java/Widgets/TextWidget/","title":"TextWidget","text":"

vtk-examples/Java/Widgets/TextWidget

"},{"location":"Java/Widgets/TextWidget/#description","title":"Description","text":"

vtkTextWidget object provides support for interactively placing text on the 2D overlay plane.

The text is defined by an instance of vtkTextActor object.

Other languages

See (Cxx), (Python)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Java/Widgets/TextWidget/#code","title":"Code","text":"

TextWidget.java

import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkTextActor;\nimport vtk.vtkTextRepresentation;\nimport vtk.vtkTextWidget;\n\n\npublic class TextWidget \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n         if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n   vtkNativeLibrary.DisableOutputWindow(null);\n  }\n // -----------------------------------------------------------------\n\n public static void main(String args[]) \n {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    //TextColor \n    double TextColor[] = new double[4];\n\n    colors.GetColor(\"DimGray\", actorColor);\n    colors.GetColor(\"MidnightBlue\", Bgcolor);\n    colors.GetColor(\"Yellow\", TextColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the text widget\n    vtkTextActor TextActor = new vtkTextActor();\n    TextActor.SetInput(\"This is a Sphere\");\n    TextActor.GetTextProperty().SetColor(TextColor);\n    TextActor.GetTextProperty().SetFontFamilyToCourier();\n\n    vtkTextWidget TextWidget = new vtkTextWidget();\n\n    vtkTextRepresentation TextRepresentation = new vtkTextRepresentation();\n    TextRepresentation.GetPositionCoordinate().SetValue(0.15, 0.15);\n    TextRepresentation.GetPosition2Coordinate().SetValue(0.7, 0.2);\n    TextWidget.SetRepresentation(TextRepresentation);\n    TextWidget.SetInteractor(iren);\n    TextWidget.SetTextActor(TextActor);\n    TextWidget.SelectableOff();\n\n\n    //Visualize the actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n    TextWidget.On();\n\n    iren.Initialize();\n    iren.Start();\n  }  \n}\n
"},{"location":"Python/Snippets/","title":"Snippets","text":""},{"location":"Python/Snippets/#description","title":"Description","text":"

Snippets are chunks of code that can be cut (snipped) and pasted into examples. We want each example to be stand-alone, so we do not keep the snippet code in a library.

"},{"location":"Python/Snippets/#available-snippets","title":"Available snippets","text":""},{"location":"Python/Snippets/#cameraposition","title":"CameraPosition","text":"

Output the camera position while moving the image.

"},{"location":"Python/Snippets/#checkvtkversion","title":"CheckVTKVersion","text":"

Check the VTK version returning True if the requested VTK version is >= the current version.

"},{"location":"Python/Snippets/#pointtoglyph","title":"PointToGlyph","text":"

Represent points as glyphs.

"},{"location":"Python/Snippets/#getprogramparameters","title":"GetProgramParameters","text":"

Get the program parameters.

"},{"location":"Python/Snippets/#readpolydata","title":"ReadPolyData","text":"

Uses the appropriate vtkPolyData reader to read any vtkPolyData file.

"},{"location":"Python/Snippets/#writeimage","title":"WriteImage","text":"

Take a screen shot from the render window and write it to a file. The file extension selects the writer to use.

"},{"location":"Python/Annotation/MultiLineText/","title":"MultiLineText","text":"

vtk-examples/Python/Annotation/MultiLineText

"},{"location":"Python/Annotation/MultiLineText/#description","title":"Description","text":"

This example demonstrates the use of multiline 2D text using vtkTextMapper. It shows several justifications as well as single-line and multiple-line text inputs.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Annotation/MultiLineText/#code","title":"Code","text":"

MultiLineText.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor2D,\n    vtkCoordinate,\n    vtkPolyDataMapper2D,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    font_size = 24\n\n    # Create the text mappers and the associated Actor2Ds.\n    # The font and text properties (except justification) are the same for\n    # each single line mapper. Let's create a common text property object\n    singleLineTextProp = vtkTextProperty()\n    singleLineTextProp.SetFontSize(font_size)\n    singleLineTextProp.SetFontFamilyToArial()\n    singleLineTextProp.BoldOff()\n    singleLineTextProp.ItalicOff()\n    singleLineTextProp.ShadowOff()\n\n    # The font and text properties (except justification) are the same for\n    # each multi line mapper. Let's create a common text property object\n    multiLineTextProp = vtkTextProperty()\n    multiLineTextProp.ShallowCopy(singleLineTextProp)\n    multiLineTextProp.BoldOn()\n    multiLineTextProp.ItalicOn()\n    multiLineTextProp.ShadowOn()\n    multiLineTextProp.SetLineSpacing(0.8)\n\n    colors = vtkNamedColors()\n\n    # The text is on a single line and bottom-justified.\n    singleLineTextB = vtkTextMapper()\n    singleLineTextB.SetInput('Single line (bottom)')\n    tprop = singleLineTextB.GetTextProperty()\n    tprop.ShallowCopy(singleLineTextProp)\n    tprop.SetVerticalJustificationToBottom()\n    tprop.SetColor(colors.GetColor3d('Tomato'))\n\n    singleLineTextActorB = vtkActor2D()\n    singleLineTextActorB.SetMapper(singleLineTextB)\n    singleLineTextActorB.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    singleLineTextActorB.GetPositionCoordinate().SetValue(0.05, 0.85)\n\n    # The text is on a single line and center-justified (vertical justification).\n    singleLineTextC = vtkTextMapper()\n    singleLineTextC.SetInput('Single line (centered)')\n    tprop = singleLineTextC.GetTextProperty()\n    tprop.ShallowCopy(singleLineTextProp)\n    tprop.SetVerticalJustificationToCentered()\n    tprop.SetColor(colors.GetColor3d('DarkGreen'))\n    singleLineTextActorC = vtkActor2D()\n\n    singleLineTextActorC.SetMapper(singleLineTextC)\n    singleLineTextActorC.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    singleLineTextActorC.GetPositionCoordinate().SetValue(0.05, 0.75)\n\n    # The text is on a single line and top-justified.\n    singleLineTextT = vtkTextMapper()\n    singleLineTextT.SetInput('Single line (top)')\n    tprop = singleLineTextT.GetTextProperty()\n    tprop.ShallowCopy(singleLineTextProp)\n    tprop.SetVerticalJustificationToTop()\n    tprop.SetColor(colors.GetColor3d('Peacock'))\n\n    singleLineTextActorT = vtkActor2D()\n    singleLineTextActorT.SetMapper(singleLineTextT)\n    singleLineTextActorT.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    singleLineTextActorT.GetPositionCoordinate().SetValue(0.05, 0.65)\n\n    # The text is on multiple lines and left- and top-justified.\n    textMapperL = vtkTextMapper()\n    textMapperL.SetInput('This is\\nmulti-line\\ntext output\\n(left-top)')\n    tprop = textMapperL.GetTextProperty()\n    tprop.ShallowCopy(multiLineTextProp)\n    tprop.SetJustificationToLeft()\n    tprop.SetVerticalJustificationToTop()\n    tprop.SetColor(colors.GetColor3d('Tomato'))\n\n    textActorL = vtkActor2D()\n    textActorL.SetMapper(textMapperL)\n    textActorL.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    textActorL.GetPositionCoordinate().SetValue(0.05, 0.5)\n\n    # The text is on multiple lines and center-justified (both horizontal and vertical).\n    textMapperC = vtkTextMapper()\n    textMapperC.SetInput('This is\\nmulti-line\\ntext output\\n(centered)')\n    tprop = textMapperC.GetTextProperty()\n    tprop.ShallowCopy(multiLineTextProp)\n    tprop.SetJustificationToCentered()\n    tprop.SetVerticalJustificationToCentered()\n    tprop.SetColor(colors.GetColor3d('DarkGreen'))\n\n    textActorC = vtkActor2D()\n    textActorC.SetMapper(textMapperC)\n    textActorC.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    textActorC.GetPositionCoordinate().SetValue(0.5, 0.5)\n\n    # The text is on multiple lines and right- and bottom-justified.\n    textMapperR = vtkTextMapper()\n    textMapperR.SetInput('This is\\nmulti-line\\ntext output\\n(right-bottom)')\n    tprop = textMapperR.GetTextProperty()\n    tprop.ShallowCopy(multiLineTextProp)\n    tprop.SetJustificationToRight()\n    tprop.SetVerticalJustificationToBottom()\n    tprop.SetColor(colors.GetColor3d('Peacock'))\n\n    textActorR = vtkActor2D()\n    textActorR.SetMapper(textMapperR)\n    textActorR.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    textActorR.GetPositionCoordinate().SetValue(0.95, 0.5)\n\n    # Draw the grid to demonstrate the placement of the text.\n\n    # Set up the necessary points.\n    Pts = vtkPoints()\n    Pts.InsertNextPoint(0.05, 0.0, 0.0)\n    Pts.InsertNextPoint(0.05, 1.0, 0.0)\n    Pts.InsertNextPoint(0.5, 0.0, 0.0)\n    Pts.InsertNextPoint(0.5, 1.0, 0.0)\n    Pts.InsertNextPoint(0.95, 0.0, 0.0)\n    Pts.InsertNextPoint(0.95, 1.0, 0.0)\n    Pts.InsertNextPoint(0.0, 0.5, 0.0)\n    Pts.InsertNextPoint(1.0, 0.5, 0.0)\n    Pts.InsertNextPoint(0.00, 0.85, 0.0)\n    Pts.InsertNextPoint(0.50, 0.85, 0.0)\n    Pts.InsertNextPoint(0.00, 0.75, 0.0)\n    Pts.InsertNextPoint(0.50, 0.75, 0.0)\n    Pts.InsertNextPoint(0.00, 0.65, 0.0)\n    Pts.InsertNextPoint(0.50, 0.65, 0.0)\n\n    # Set up the lines that use these points.\n    Lines = vtkCellArray()\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(0)\n    Lines.InsertCellPoint(1)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(2)\n    Lines.InsertCellPoint(3)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(4)\n    Lines.InsertCellPoint(5)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(6)\n    Lines.InsertCellPoint(7)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(8)\n    Lines.InsertCellPoint(9)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(10)\n    Lines.InsertCellPoint(11)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(12)\n    Lines.InsertCellPoint(13)\n\n    # Create a grid that uses these points and lines.\n    Grid = vtkPolyData()\n    Grid.SetPoints(Pts)\n    Grid.SetLines(Lines)\n    # Set up the coordinate system.\n    normCoords = vtkCoordinate()\n    normCoords.SetCoordinateSystemToNormalizedViewport()\n\n    # Set up the mapper and actor (2D) for the grid.\n    mapper = vtkPolyDataMapper2D()\n    mapper.SetInputData(Grid)\n    mapper.SetTransformCoordinate(normCoords)\n    gridActor = vtkActor2D()\n    gridActor.SetMapper(mapper)\n    gridActor.GetProperty().SetColor(colors.GetColor3d('DimGray'))\n\n    # Create the Renderer, RenderWindow, and RenderWindowInteractor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the renderer set the background and size zoom in closer to the image render\n    renderer.AddActor2D(textActorL)\n    renderer.AddActor2D(textActorC)\n    renderer.AddActor2D(textActorR)\n    renderer.AddActor2D(singleLineTextActorB)\n    renderer.AddActor2D(singleLineTextActorC)\n    renderer.AddActor2D(singleLineTextActorT)\n    renderer.AddActor2D(gridActor)\n\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n    renderWindow.SetSize(640, 480)\n    renderer.GetActiveCamera().Zoom(1.5)\n\n    # Enable user interface interactor\n    interactor.Initialize()\n    renderWindow.SetWindowName('MultiLineText')\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Annotation/TextOrigin/","title":"TextOrigin","text":"

vtk-examples/Python/Annotation/TextOrigin

"},{"location":"Python/Annotation/TextOrigin/#description","title":"Description","text":"

This example demonstrates the use of vtkVectorText and vtkFollower. vtkVectorText is used to create 3D annotation. vtkFollower is used to position the 3D text and to ensure that the text always faces the renderer's active camera (i.e., the text is always readable).

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Annotation/TextOrigin/#code","title":"Code","text":"

TextOrigin.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkAxes\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkFollower,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the axes and the associated mapper and actor.\n    axes = vtkAxes()\n    axes.SetOrigin(0, 0, 0)\n    axesMapper = vtkPolyDataMapper()\n    axesMapper.SetInputConnection(axes.GetOutputPort())\n    axesActor = vtkActor()\n    axesActor.SetMapper(axesMapper)\n\n    # Create the 3D text and the associated mapper and follower (a type of actor).  Position the text so it is displayed over the origin of the axes.\n    atext = vtkVectorText()\n    atext.SetText('Origin')\n    textMapper = vtkPolyDataMapper()\n    textMapper.SetInputConnection(atext.GetOutputPort())\n    textActor = vtkFollower()\n    textActor.SetMapper(textMapper)\n    textActor.SetScale(0.2, 0.2, 0.2)\n    textActor.AddPosition(0, -0.1, 0)\n    textActor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n\n    # Create the Renderer, RenderWindow, and RenderWindowInteractor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    style = vtkInteractorStyleTrackballCamera()\n    interactor.SetInteractorStyle(style)\n\n    # Add the actors to the renderer.\n    renderer.AddActor(axesActor)\n    renderer.AddActor(textActor)\n\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # Zoom in closer.\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Zoom(1.6)\n\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # Reset the clipping range of the camera; set the camera of the follower; render.\n    renderer.ResetCameraClippingRange()\n    textActor.SetCamera(renderer.GetActiveCamera())\n\n    interactor.Initialize()\n    renderWindow.SetWindowName('TextOrigin')\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Arrays/GetValues/","title":"GetValues","text":"

vtk-examples/Python/Arrays/GetValues

"},{"location":"Python/Arrays/GetValues/#description","title":"Description","text":"

Get values from a vtkPolyData source, normals in this case.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Arrays/GetValues/#code","title":"Code","text":"

GetValues.py

#!/usr/bin/env python\n\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\n\n\ndef main():\n    # setup sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    polydata = vtkPolyData()\n    polydata.ShallowCopy(sphereSource.GetOutput())\n\n    normals = polydata.GetPointData().GetNormals()\n    normal0 = normals.GetTuple3(0)\n\n    print('Normal0: {:3.1f} {:3.1f} {:3.1f}'.format(normal0[0], normal0[1], normal0[2]))\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Arrays/RenameArray/","title":"RenameArray","text":"

vtk-examples/Python/Arrays/RenameArray

"},{"location":"Python/Arrays/RenameArray/#description","title":"Description","text":"

Renaming the normals array.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Arrays/RenameArray/#code","title":"Code","text":"

RenameArray.py

#!/usr/bin/env python\n\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef main():\n    # setup sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    polydata = vtkPolyData()\n    polydata.ShallowCopy(sphereSource.GetOutput())\n\n    normals = polydata.GetPointData().GetNormals()\n    normals.SetName('TestN')\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName('Test.vtp')\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/CompositeData/CompositePolyDataMapper/","title":"CompositePolyDataMapper","text":"

vtk-examples/Python/CompositeData/CompositePolyDataMapper

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/CompositeData/CompositePolyDataMapper/#code","title":"Code","text":"

CompositePolyDataMapper.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCompositeDataDisplayAttributes,\n    vtkCompositePolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create Sphere 1.\n    sphere1 = vtkSphereSource()\n    sphere1.SetRadius(3)\n    sphere1.SetCenter(0, 0, 0)\n    sphere1.Update()\n\n    # Create Sphere 2.\n    sphere2 = vtkSphereSource()\n    sphere2.SetRadius(2)\n    sphere2.SetCenter(2, 0, 0)\n    sphere2.Update()\n\n    mbds = vtkMultiBlockDataSet()\n    mbds.SetNumberOfBlocks(3)\n    mbds.SetBlock(0, sphere1.GetOutput())\n    # Leave block 1 NULL.  NULL blocks are valid and should be handled by\n    # algorithms that process multiblock datasets.  Especially when\n    # running in parallel where the blocks owned by other processes are\n    # NULL in this process.\n    mbds.SetBlock(2, sphere2.GetOutput())\n\n    # Use vtkCompositePolyDataMapper2 if VTK Version < 90020230516\n    mapper = vtkCompositePolyDataMapper()\n    mapper.SetInputDataObject(mbds)\n    cdsa = vtkCompositeDataDisplayAttributes()\n    mapper.SetCompositeDataDisplayAttributes(cdsa)\n\n    # You can use the vtkCompositeDataDisplayAttributes to set the color,\n    # opacity and visibiliy of individual blocks of the multiblock dataset.\n    # Attributes are mapped by block pointers (vtkDataObject*), so these can\n    # be queried by their flat index through a convenience function in the\n    # attribute class (vtkCompositeDataDisplayAttributes::DataObjectFromIndex).\n    # Alternatively, one can set attributes directly through the mapper using\n    # flat indices.\n    #\n    # This sets the block at flat index 3 red\n    # Note that the index is the flat index in the tree, so the whole multiblock\n    # is index 0 and the blocks are flat indexes 1, 2 and 3.  This affects\n    # the block returned by mbds.GetBlock(2).\n    mapper.SetBlockColor(3, colors.GetColor3d('Red'))\n    # Color the spheres.\n    mapper.SetBlockColor(1, colors.GetColor3d('LavenderBlush'))\n    mapper.SetBlockColor(2, colors.GetColor3d('Lavender'))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create the Renderer, RenderWindow, and RenderWindowInteractor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Enable user interface interactor.\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SteelBlue'))\n    renderWindow.SetWindowName('CompositePolyDataMapper')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/CompositeData/MultiBlockDataSet/","title":"MultiBlockDataSet","text":"

vtk-examples/Python/CompositeData/MultiBlockDataSet

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/CompositeData/MultiBlockDataSet/#code","title":"Code","text":"

MultiBlockDataSet.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet\n\n# vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n# VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\ntry:\n    from vtkmodules.vtkFiltersCore import vtkExtractEdges\nexcept ImportError:\n    from vtkmodules.vtkFiltersExtraction import vtkExtractEdges\nfrom vtkmodules.vtkFiltersGeometry import vtkCompositeDataGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # PART 1 Make some Data.\n    # Make a tree.\n    root = vtkMultiBlockDataSet()\n\n    branch = vtkMultiBlockDataSet()\n    root.SetBlock(0, branch)\n\n    # Make some leaves.\n    leaf1 = vtkSphereSource()\n    leaf1.SetCenter(0, 0, 0)\n    leaf1.Update()\n    branch.SetBlock(0, leaf1.GetOutput())\n\n    leaf2 = vtkSphereSource()\n    leaf2.SetCenter(1.75, 2.5, 0)\n    leaf2.SetRadius(1.5)\n    leaf2.Update()\n    branch.SetBlock(1, leaf2.GetOutput())\n\n    leaf3 = vtkSphereSource()\n    leaf3.SetCenter(4, 0, 0)\n    leaf3.SetRadius(2)\n    leaf3.Update()\n    root.SetBlock(1, leaf3.GetOutput())\n\n    # PART 2 Do something with the data\n    # a non composite aware filter, the pipeline will iterate\n    edges = vtkExtractEdges()\n    edges.SetInputData(root)\n\n    # PART 3 Show the data\n    # also demonstrate a composite aware filter\n    # this filter aggregates all blocks into one polydata\n    # this is handy for display, although fairly limited.\n    polydata = vtkCompositeDataGeometryFilter()\n    polydata.SetInputConnection(edges.GetOutputPort())\n\n    # Create the Renderer, RenderWindow, and RenderWindowInteractor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(0, polydata.GetOutputPort(0))\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n    actor.GetProperty().SetLineWidth(2)\n    actor.SetMapper(mapper)\n\n    # Enable user interface interactor.\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('CornflowerBlue'))\n    renderWindow.SetWindowName('MultiBlockDataSet')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/CompositeData/OverlappingAMR/","title":"OverlappingAMR","text":"

vtk-examples/Python/CompositeData/OverlappingAMR

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/CompositeData/OverlappingAMR/#code","title":"Code","text":"

OverlappingAMR.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkAMRBox,\n    vtkOverlappingAMR,\n    vtkSphere,\n    vtkUniformGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersGeometry import vtkCompositeDataGeometryFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef MakeScalars(dims, origin, spacing, scalars):\n    # Implicit function used to compute scalars\n    sphere = vtkSphere()\n    sphere.SetRadius(3)\n    sphere.SetCenter(5, 5, 5)\n    scalars.SetNumberOfTuples(dims[0] * dims[1] * dims[2])\n    for k in range(0, dims[2]):\n        z = origin[2] + spacing[2] * k\n        for j in range(0, dims[1]):\n            y = origin[1] + spacing[1] * j\n            for i in range(0, dims[0]):\n                x = origin[0] + spacing[0] * i\n                scalars.SetValue(k * dims[0] * dims[1] + j * dims[0] + i, sphere.EvaluateFunction(x, y, z))\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create and populate the AMR dataset\n    # The dataset should look like\n    # Level 0\n    #   uniform grid, dimensions 11, 11, 11, AMR box (0, 0, 0) - (9, 9, 9) \n    # Level 1 - refinement ratio : 2\n    #   uniform grid, dimensions 11, 11, 11, AMR box (0, 0, 0) - (9, 9, 9)\n    #   uniform grid, dimensions 11, 11, 11, AMR box (10, 10, 10) - (19, 19, 19)\n    # Use MakeScalars() above to fill the scalar arrays\n\n    amr = vtkOverlappingAMR()\n    blocksPerLevel = [1, 2]\n    amr.Initialize(2, blocksPerLevel)\n\n    origin = [0.0, 0.0, 0.0]\n    spacing = [1.0, 1.0, 1.0]\n    dims = [11, 11, 11]\n\n    ug1 = vtkUniformGrid()\n    # Geometry\n    ug1.SetOrigin(origin)\n    ug1.SetSpacing(spacing)\n    ug1.SetDimensions(dims)\n\n    # Data\n    scalars = vtkFloatArray()\n    ug1.GetPointData().SetScalars(scalars)\n    MakeScalars(dims, origin, spacing, scalars)\n\n    lo = [0, 0, 0]\n    hi = [9, 9, 9]\n    box1 = vtkAMRBox()\n    amr.SetAMRBox(0, 0, box1)\n    amr.SetDataSet(0, 0, ug1)\n\n    spacing2 = [0.5, 0.5, 0.5]\n    ug2 = vtkUniformGrid()\n    # Geometry\n    ug2.SetOrigin(origin)\n    ug2.SetSpacing(spacing2)\n    ug2.SetDimensions(dims)\n\n    # Data\n    scalars2 = vtkFloatArray()\n    ug2.GetPointData().SetScalars(scalars2)\n    MakeScalars(dims, origin, spacing2, scalars2)\n\n    lo2 = [0, 0, 0]\n    hi2 = [9, 9, 9]\n    box2 = vtkAMRBox()\n    amr.SetAMRBox(1, 0, box2)\n    amr.SetDataSet(1, 0, ug2)\n\n    origin3 = [5, 5, 5]\n    ug3 = vtkUniformGrid()\n\n    # Geometry\n    ug3.SetOrigin(origin3)\n    ug3.SetSpacing(spacing2)\n    ug3.SetDimensions(dims)\n\n    # Data\n    scalars3 = vtkFloatArray()\n    ug3.GetPointData().SetScalars(scalars3)\n    MakeScalars(dims, origin3, spacing2, scalars3)\n\n    lo3 = [10, 10, 10]\n    hi3 = [19, 19, 19]\n    box3 = vtkAMRBox()\n    amr.SetAMRBox(1, 1, box3)\n    amr.SetDataSet(1, 1, ug3)\n    amr.SetRefinementRatio(0, 2)\n\n    # Render the amr data here.\n    of = vtkOutlineFilter()\n    of.SetInputData(amr)\n\n    geomFilter = vtkCompositeDataGeometryFilter()\n    geomFilter.SetInputConnection(of.GetOutputPort())\n\n    # Create an iso-surface - at 10.\n    cf = vtkContourFilter()\n    cf.SetInputData(amr)\n    cf.SetNumberOfContours(1)\n    cf.SetValue(0, 10.0)\n\n    geomFilter2 = vtkCompositeDataGeometryFilter()\n    geomFilter2.SetInputConnection(cf.GetOutputPort())\n\n    # Create the render window, renderer, and interactor.\n    aren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(aren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Associate the geometry with a mapper and the mapper to an actor.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(of.GetOutputPort())\n    actor1 = vtkActor()\n    actor1.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n    actor1.SetMapper(mapper)\n\n    # Associate the geometry with a mapper and the mapper to an actor.\n    mapper2 = vtkPolyDataMapper()\n    mapper2.SetInputConnection(geomFilter2.GetOutputPort())\n    actor2 = vtkActor()\n    actor2.SetMapper(mapper2)\n\n    # Add the actor to the renderer and start handling events.\n    aren.AddActor(actor1)\n    aren.AddActor(actor2)\n    aren.SetBackground(colors.GetColor3d('CornflowerBlue'))\n    renWin.SetWindowName('OverlappingAMR')\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Coverage/PythonVTKClassesNotUsed/","title":"VTK Classes not used in the Examples","text":""},{"location":"Python/Coverage/PythonVTKClassesNotUsed/#python","title":"Python","text":"

Out of 3113 available VTK classes, 2660 have not been used.

VTK Class VTK Class VTK Class VTK Class VTK Class vtk2DHistogramItem vtk3DCursorRepresentation vtk3DCursorWidget vtk3DLinearGridCrinkleExtractor vtk3DLinearGridInternal vtk3DLinearGridPlaneCutter vtk3DWidget vtkABI vtkADIOS2CoreImageReader vtkADIOS2VTXReader vtkAMRBaseParticlesReader vtkAMRBaseReader vtkAMRCutPlane vtkAMRDataInternals vtkAMRDataSetCache vtkAMREnzoParticlesReader vtkAMREnzoReader vtkAMREnzoReaderInternal vtkAMRFlashParticlesReader vtkAMRFlashReader vtkAMRFlashReaderInternal vtkAMRGaussianPulseSource vtkAMRInformation vtkAMRInterpolatedVelocityField vtkAMRResampleFilter vtkAMRSliceFilter vtkAMRToMultiBlockFilter vtkAMRUtilities vtkAMRVelodyneReader vtkAMRVelodyneReaderInternal vtkAMRVolumeMapper vtkAMReXGridHeader vtkAMReXGridLevelHeader vtkAMReXGridReader vtkAMReXGridReaderInternal vtkAMReXParticlesReader vtkAOSDataArrayTemplate vtkASCIITextCodec vtkAVIWriter vtkAVSucdReader vtkAbstractArray vtkAbstractCellArray vtkAbstractCellLinks vtkAbstractCellLocator vtkAbstractContextBufferId vtkAbstractContextItem vtkAbstractElectronicData vtkAbstractGridConnectivity vtkAbstractHyperTreeGridMapper vtkAbstractImageInterpolator vtkAbstractInteractionDevice vtkAbstractInterpolatedVelocityField vtkAbstractMapper vtkAbstractMapper3D vtkAbstractParticleWriter vtkAbstractPicker vtkAbstractPointLocator vtkAbstractPolyDataReader vtkAbstractPolygonalHandleRepresentation3D vtkAbstractPropPicker vtkAbstractRenderDevice vtkAbstractSplineRepresentation vtkAbstractTransform vtkAbstractVolumeMapper vtkAbstractWidget vtkActor2DCollection vtkActorCollection vtkActorNode vtkAdaptiveDataSetSurfaceFilter vtkAdaptiveResampleToImage vtkAdaptiveSubdivisionFilter vtkAdaptiveTemporalInterpolator vtkAddMembershipArray vtkAdjacencyMatrixToEdgeTable vtkAdjacentVertexIterator vtkAffineRepresentation vtkAffineRepresentation2D vtkAffineWidget vtkAggregateDataSetFilter vtkAggregateToPartitionedDataSetCollection vtkAlembicExporter vtkAlgorithmOutput vtkAlignImageDataSetFilter vtkAmoebaMinimizer vtkAnariActorNode vtkAnariCameraNode vtkAnariCompositePolyDataMapperNode vtkAnariFollowerNode vtkAnariLightNode vtkAnariPass vtkAnariPolyDataMapperNode vtkAnariProfiling vtkAnariRendererNode vtkAnariTestInteractor vtkAnariViewNodeFactory vtkAnariVolumeInterface vtkAnariVolumeMapper vtkAnariVolumeMapperNode vtkAnariVolumeNode vtkAnariWindowNode vtkAndroidOutputWindow vtkAndroidRenderWindowInteractor vtkAngleRepresentation vtkAngleRepresentation2D vtkAngleRepresentation3D vtkAngleWidget vtkAngularPeriodicDataArray vtkAngularPeriodicFilter vtkAnimateModes vtkAnimationCue vtkAnimationScene vtkAnnotation vtkAnnotationLayers vtkAnnotationLayersAlgorithm vtkAppendArcLength vtkAppendCompositeDataLeaves vtkAppendDataSets vtkAppendLocationAttributes vtkAppendPartitionedDataSetCollection vtkAppendPoints vtkAppendSelection vtkApplyColors vtkApplyIcons vtkApproximatingSubdivisionFilter vtkArcGridActorPrivate vtkArcParallelEdgeStrategy vtkArcPlotter vtkArcSource vtkArchiver vtkAreaContourSpectrumFilter vtkAreaLayout vtkAreaLayoutStrategy vtkAreaPicker vtkArray vtkArrayCalculator vtkArrayCoordinates vtkArrayData vtkArrayDataAlgorithm vtkArrayDataReader vtkArrayDataWriter vtkArrayDispatch vtkArrayExtents vtkArrayExtentsList vtkArrayInterpolate vtkArrayIterator vtkArrayIteratorIncludes vtkArrayIteratorTemplate vtkArrayListTemplate vtkArrayNorm vtkArrayPrint vtkArrayRange vtkArrayReader vtkArrayRename vtkArrayRenderer vtkArraySort vtkArrayToTable vtkArrayWeights vtkArrayWriter vtkAssembly vtkAssemblyNode vtkAssemblyPath vtkAssemblyPaths vtkAssignAttribute vtkAssignCoordinates vtkAssignCoordinatesLayoutStrategy vtkAtom vtkAtomicMutex vtkAttributeClustering2DLayoutStrategy vtkAttributeDataToFieldDataFilter vtkAttributeDataToTableFilter vtkAttributeSmoothingFilter vtkAttributesErrorMetric vtkAutoCorrelativeStatistics vtkAvatar vtkAxesTransformRepresentation vtkAxesTransformWidget vtkAxisActor vtkAxisActor2D vtkAxisActor2DMock vtkAxisExtended vtkAxisFollower vtkAxisGridActorPrivate vtkBSPCuts vtkBSPIntersections vtkBSplineTransform vtkBTSReader vtkBYUWriter vtkBackgroundColorMonitor vtkBarChartActor vtkBase64InputStream vtkBase64OutputStream vtkBase64Utilities vtkBatchedSurfaceLICMapper vtkBatches vtkBezierContourLineInterpolator vtkBezierCurve vtkBezierHexahedron vtkBezierInterpolation vtkBezierQuadrilateral vtkBezierTetra vtkBezierTriangle vtkBezierWedge vtkBiDimensionalRepresentation vtkBiDimensionalRepresentation2D vtkBiDimensionalWidget vtkBilinearQuadIntersection vtkBinCellDataFilter vtkBinnedDecimation vtkBiomTableReader vtkBitArray vtkBitArrayIterator vtkBivariateLinearTableThreshold vtkBlankStructuredGrid vtkBlankStructuredGridWithImage vtkBlockDistribution vtkBlockIdScalars vtkBlockItem vtkBlockSelector vtkBlueObeliskData vtkBlueObeliskDataParser vtkBond vtkBoostBetweennessClustering vtkBoostBiconnectedComponents vtkBoostBrandesCentrality vtkBoostBreadthFirstSearch vtkBoostBreadthFirstSearchTree vtkBoostConnectedComponents vtkBoostDividedEdgeBundling vtkBoostExtractLargestComponent vtkBoostKruskalMinimumSpanningTree vtkBoostLogWeighting vtkBoostPrimMinimumSpanningTree vtkBoostRandomSparseArraySource vtkBoostSplitTableField vtkBorderRepresentation vtkBorderWidget vtkBoundaryMeshQuality vtkBoundedPlanePointPlacer vtkBoundedPointSource vtkBoundingBox vtkBoxClipDataSet vtkBoxLayoutStrategy vtkBoxMuellerRandomSequence vtkBoxRepresentation vtkBoxWidget2 vtkBreakPoint vtkBrokenLineWidget vtkBrush vtkBuffer vtkBufferedArchiver vtkButtonRepresentation vtkButtonSource vtkButtonWidget vtkByteSwap vtkCGMWriter vtkCGNSCache vtkCGNSFileSeriesReader vtkCGNSReader vtkCGNSReaderInternal vtkCMLMoleculeReader vtkCONVERGECFDCGNSReader vtkCONVERGECFDReader vtkCPExodusIIElementBlock vtkCPExodusIIElementBlockCellIterator vtkCPExodusIIElementBlockImpl vtkCPExodusIIInSituReader vtkCPExodusIINodalCoordinatesTemplate vtkCPExodusIIResultsArrayTemplate vtkCachedStreamingDemandDrivenPipeline vtkCallbackCommand vtkCamera3DRepresentation vtkCamera3DWidget vtkCameraActor vtkCameraHandleSource vtkCameraInterpolator vtkCameraNode vtkCameraOrientationRepresentation vtkCameraPathRepresentation vtkCameraPathWidget vtkCameraRepresentation vtkCameraWidget vtkCapsuleSource vtkCaptionActor2D vtkCaptionRepresentation vtkCaptionWidget vtkCardinalSpline vtkCastToConcrete vtkCell3D vtkCellArrayIterator vtkCellAttribute vtkCellAttributeCalculator vtkCellAttributeInformation vtkCellCenterDepthSort vtkCellCenters vtkCellCentersPointPlacer vtkCellData vtkCellDataToPointData vtkCellDerivatives vtkCellDistanceSelector vtkCellGraphicsPrimitiveMap vtkCellGrid vtkCellGridAlgorithm vtkCellGridBoundsQuery vtkCellGridComputeSurface vtkCellGridElevation vtkCellGridElevationQuery vtkCellGridEvaluator vtkCellGridIOQuery vtkCellGridMapper vtkCellGridPointProbe vtkCellGridQuery vtkCellGridRangeQuery vtkCellGridReader vtkCellGridRenderRequest vtkCellGridResponder vtkCellGridResponderBase vtkCellGridResponders vtkCellGridSidesQuery vtkCellGridWriter vtkCellIterator vtkCellLinks vtkCellLocatorStrategy vtkCellMetadata vtkCellQuality vtkCellSizeFilter vtkCellTreeLocator vtkCellType vtkCellValidator vtkCenterOfMass vtkCenteredSliderRepresentation vtkCenteredSliderWidget vtkCesium3DTilesReader vtkCesium3DTilesWriter vtkCesiumB3DMReader vtkCesiumPointCloudWriter vtkChacoGraphReader vtkChacoReader vtkCharArray vtkChart2DHistogram vtkChartBox vtkChartHistogram2D vtkChartLegend vtkChartMatrix vtkChartParallelCoordinates vtkChartPie vtkCheckerboardRepresentation vtkCheckerboardSplatter vtkCheckerboardWidget vtkCirclePackFrontChainLayoutStrategy vtkCirclePackLayout vtkCirclePackLayoutStrategy vtkCirclePackToPolyData vtkCityGMLReader vtkCleanUnstructuredGrid vtkCleanUnstructuredGridCells vtkClearRGBPass vtkClearZPass vtkClientServerCompositePass vtkClientServerSynchronizedRenderers vtkClientSocket vtkClipClosedSurface vtkClipConvexPolyData vtkClipVolume vtkClosedSurfacePointPlacer vtkClosestNPointsStrategy vtkClosestPointStrategy vtkClustering2DLayoutStrategy vtkCocoaMacOSXSDKCompatibility vtkCocoaRenderWindow vtkCocoaRenderWindowInteractor vtkCocoaTkUtilities vtkCoincidentPoints vtkCollapseGraph vtkCollapseVerticesByArray vtkCollectGraph vtkCollectPolyData vtkCollectTable vtkCollection vtkCollectionElement vtkCollectionIterator vtkColor vtkColor3 vtkColor3d vtkColor3f vtkColor4 vtkColor4d vtkColor4f vtkColor4ub vtkColorLegend vtkColorTransferControlPointsItem vtkColorTransferFunctionItem vtkCommonInformationKeyManager vtkCommunicator vtkCommunity2DLayoutStrategy vtkCompositeCellGridMapper vtkCompositeCellGridReader vtkCompositeControlPointsItem vtkCompositeCutter vtkCompositeDataDisplayAttributesLegacy vtkCompositeDataIterator vtkCompositeDataPipeline vtkCompositeDataProbeFilter vtkCompositeDataReader vtkCompositeDataSet vtkCompositeDataSetAlgorithm vtkCompositeDataWriter vtkCompositeImplicitBackend vtkCompositeInterpolatedVelocityField vtkCompositeMapperHelper2 vtkCompositeMapperHelperData vtkCompositePolyDataMapper2 vtkCompositePolyDataMapperDelegator vtkCompositeRGBAPass vtkCompositeRenderManager vtkCompositeSurfaceLICMapper vtkCompositeSurfaceLICMapperDelegator vtkCompositeTransferFunctionItem vtkCompositeZPass vtkCompositedSynchronizedRenderers vtkCompositer vtkCompressCompositer vtkComputeHistogram2DOutliers vtkComputeQuantiles vtkComputeQuartiles vtkConduitArrayUtilities vtkConduitSource vtkConduitToDataObject vtkConeLayoutStrategy vtkConnectedPointsFilter vtkConstrained2DLayoutStrategy vtkConstrainedPointHandleRepresentation vtkConstrainedSmoothingFilter vtkConsumerDataFilter vtkContext2D vtkContext3D vtkContextArea vtkContextClip vtkContextDevice2D vtkContextDevice3D vtkContextInteractorStyle vtkContextItem vtkContextKeyEvent vtkContextMapper2D vtkContextPolygon vtkContextScenePrivate vtkContingencyStatistics vtkContinuousScatterplot vtkContinuousValueWidget vtkContinuousValueWidgetRepresentation vtkContour3DLinearGrid vtkContourGrid vtkContourHelper vtkContourLineInterpolator vtkContourLoopExtraction vtkContourRepresentation vtkContourRepresentationInternals vtkContourRepresentationNode vtkContourRepresentationPoint vtkContourValues vtkControlPointsItem vtkConvertSelection vtkConvertSelectionDomain vtkConvertToMultiBlockDataSet vtkConvertToPartitionedDataSetCollection vtkConvertToPointCloud vtkConvertToPolyhedra vtkConvexHull2D vtkCookieCutter vtkCoordinateFrame vtkCoordinateFrameRepresentation vtkCoordinateFrameWidget vtkCornerAnnotation vtkCorrelativeStatistics vtkCosmicTreeLayoutStrategy vtkCountFaces vtkCountVertices vtkCubeAxesActor2D vtkCuller vtkCullerCollection vtkCursor2D vtkCursor3D vtkCurveRepresentation vtkCutMaterial vtkCylindricalTransform vtkDEMReader vtkDGAttributeInformation vtkDGBoundsResponder vtkDGCell vtkDGEdge vtkDGElevationResponder vtkDGEvaluator vtkDGHex vtkDGIOResponder vtkDGInterpolateCalculator vtkDGPyr vtkDGQuad vtkDGRangeResponder vtkDGRenderResponder vtkDGSidesResponder vtkDGTet vtkDGTranscribeUnstructuredCells vtkDGTri vtkDGVert vtkDGWdg vtkDIMACSGraphReader vtkDIMACSGraphWriter vtkDIYAggregateDataSetFilter vtkDIYDataExchanger vtkDIYExplicitAssigner vtkDIYGhostUtilities vtkDIYKdTreeUtilities vtkDIYUtilities vtkDIYUtilitiesCleanup vtkDSPFilterDefinition vtkDSPFilterGroup vtkDataArray vtkDataArrayCollection vtkDataArrayCollectionIterator vtkDataArraySelection vtkDataAssembly vtkDataAssemblyUtilities vtkDataAssemblyVisitor vtkDataCompressor vtkDataEncoder vtkDataObjectAlgorithm vtkDataObjectCollection vtkDataObjectGenerator vtkDataObjectMeshCache vtkDataObjectToConduit vtkDataObjectToTable vtkDataObjectTree vtkDataObjectTreeIndex vtkDataObjectTreeInternals vtkDataObjectTreeIterator vtkDataObjectTypes vtkDataObjectWriter vtkDataReader vtkDataRepresentation vtkDataSet vtkDataSetAlgorithm vtkDataSetAttributesFieldList vtkDataSetCellIterator vtkDataSetCollection vtkDataSetEdgeSubdivisionCriterion vtkDataSetGradient vtkDataSetGradientPrecompute vtkDataSetRegionSurfaceFilter vtkDataSetToDataObjectFilter vtkDataSetTriangleFilter vtkDataSetWriter vtkDataTransferHelper vtkDataWriter vtkDatabaseToTableReader vtkDateToNumeric vtkDeRhamCell vtkDebugLeaks vtkDebugLeaksManager vtkDebugLeaksObserver vtkDecimatePolylineFilter vtkDefaultPass vtkDeflectNormals vtkDelimitedTextWriter vtkDemandDrivenPipeline vtkDendrogramItem vtkDenseArray vtkDensifyPointCloudFilter vtkDensifyPolyData vtkDependentDimensionInfo vtkDepthImageProcessingPass vtkDepthImageToPointCloud vtkDepthOfFieldPass vtkDepthPeelingPass vtkDepthSortPolyData vtkDescriptiveStatistics vtkDeserializer vtkDiagonalMatrixSource vtkDicer vtkDijkstraGraphGeodesicPath vtkDijkstraGraphInternals vtkDijkstraImageContourLineInterpolator vtkDijkstraImageGeodesicPath vtkDimensionInfo vtkDirectedAcyclicGraph vtkDirectedGraph vtkDirectedGraphAlgorithm vtkDirectionEncoder vtkDirectory vtkDiscreteFlyingEdges2D vtkDiscreteFlyingEdgesClipper2D vtkDisplaySizedImplicitPlaneRepresentation vtkDisplaySizedImplicitPlaneWidget vtkDistancePolyDataFilter vtkDistanceRepresentation vtkDistanceRepresentation2D vtkDistanceRepresentation3D vtkDistanceToCamera vtkDistanceWidget vtkDistributedDataFilter vtkDistributedGraphHelper vtkDistributedPointCloudFilter vtkDotProductSimilarity vtkDrawTexturedElements vtkDualDepthPeelingPass vtkDummyCommunicator vtkDummyController vtkDummyGPUInfoList vtkDuplicatePolyData vtkDynamic2DLabelMapper vtkDynamicLoader vtkEDLShading vtkEGLRenderWindow vtkERFReader vtkEdgeCenters vtkEdgeLayout vtkEdgeLayoutStrategy vtkEdgeListIterator vtkEdgePoints vtkEdgeSubdivisionCriterion vtkEdgeTable vtkEllipseArcSource vtkEllipsoidTensorProbeRepresentation vtkEllipsoidalGaussianKernel vtkEllipticalButtonSource vtkEmptyCell vtkEmptyRepresentation vtkEnSight6BinaryReader vtkEnSight6Reader vtkEnSightGoldBinaryReader vtkEnSightGoldReader vtkEnSightMasterServerReader vtkEnSightReader vtkEnSightWriter vtkEncodedGradientEstimator vtkEncodedGradientShader vtkEndFor vtkEnsembleSource vtkEnzoReaderBlock vtkEnzoReaderInternal vtkEqualizerContextItem vtkEqualizerFilter vtkEquirectangularToCubeMapTexture vtkErrorCode vtkEuclideanClusterExtraction vtkEvenlySpacedStreamlines2D vtkEvent vtkEventData vtkEventDataDevice3D vtkEventDataForDevice vtkEventForwarderCommand vtkEventQtSlotConnect vtkExecutableRunner vtkExecutionAggregator vtkExecutionRange vtkExecutionTimer vtkExecutive vtkExodusIICache vtkExodusIICacheEntry vtkExodusIICacheKey vtkExodusIIReaderIntPointCheck vtkExodusIIReaderParser vtkExodusIIReaderPrivate vtkExodusIIReaderScalarCheck vtkExodusIIReaderTensorCheck vtkExodusIIReaderVariableCheck vtkExodusIIReaderVectorCheck vtkExodusIIWriter vtkExpandMarkedElements vtkExpandSelectedGraph vtkExplicitStructuredGridAlgorithm vtkExplicitStructuredGridCrop vtkExplicitStructuredGridSurfaceFilter vtkExporter vtkExprTkFunctionParser vtkExtentRCBPartitioner vtkExtentSplitter vtkExtentTranslator vtkExternalLight vtkExternalOpenGLCamera vtkExternalOpenGLRenderWindow vtkExternalOpenGLRenderer vtkExtractArray vtkExtractBlock vtkExtractBlockUsingDataAssembly vtkExtractCTHPart vtkExtractCells vtkExtractCellsAlongPolyLine vtkExtractCellsByType vtkExtractDataArraysOverTime vtkExtractDataOverTime vtkExtractDataSets vtkExtractEnclosedPoints vtkExtractExodusGlobalTemporalVariables vtkExtractFunctionalBagPlot vtkExtractGhostCells vtkExtractHierarchicalBins vtkExtractHistogram vtkExtractHistogram2D vtkExtractLevel vtkExtractParticlesOverTime vtkExtractPiece vtkExtractPointCloudPiece vtkExtractPoints vtkExtractPolyDataGeometry vtkExtractPolyDataPiece vtkExtractRectilinearGrid vtkExtractSelectedArraysOverTime vtkExtractSelectedFrustum vtkExtractSelectedGraph vtkExtractSelectedRows vtkExtractSelectedTree vtkExtractSelectionBase vtkExtractStructuredGridHelper vtkExtractSubsetWithSeed vtkExtractSurface vtkExtractTensorComponents vtkExtractTimeSteps vtkExtractUnstructuredGrid vtkExtractUnstructuredGridPiece vtkExtractUserDefinedPiece vtkExtractVectorComponents vtkFDSReader vtkFFMPEGVideoSource vtkFFMPEGWriter vtkFFT vtkFLUENTCFFReader vtkFLUENTReader vtkFXAAOptions vtkFacetReader vtkFacetWriter vtkFast2DLayoutStrategy vtkFastSplatter vtkFiberSurface vtkFidesReader vtkFieldData vtkFieldDataSerializer vtkFieldDataToDataSetAttribute vtkFileOutputWindow vtkFileResourceStream vtkFileSeriesHelper vtkFillHolesFilter vtkFilteringInformationKeyManager vtkFiltersCellGrid vtkFindCellStrategy vtkFiniteDifferenceGradientEstimator vtkFiniteElementFieldDistributor vtkFinitePlaneRepresentation vtkFinitePlaneWidget vtkFitImplicitFunction vtkFitToHeightMapFilter vtkFixedPointRayCastImage vtkFixedPointVolumeRayCastCompositeGOHelper vtkFixedPointVolumeRayCastCompositeGOShadeHelper vtkFixedPointVolumeRayCastCompositeHelper vtkFixedPointVolumeRayCastCompositeShadeHelper vtkFixedPointVolumeRayCastHelper vtkFixedPointVolumeRayCastMIPHelper vtkFixedSizeHandleRepresentation vtkFixedSizeHandleRepresentation3D vtkFixedWidthTextReader vtkFlagpoleLabel vtkFlashReaderInternal vtkFloatingPointExceptions vtkFlyingEdgesPlaneCutter vtkFocalPlaneContourRepresentation vtkFocalPlanePointPlacer vtkFontConfigFreeTypeTools vtkForEach vtkForceStaticMesh vtkForceTime vtkFrameBufferObjectBase vtkFramebufferPass vtkFreeTypeLabelRenderStrategy vtkFreeTypeStringToImage vtkFreeTypeTools vtkFreeTypeToolsCleanup vtkFrustumCoverageCuller vtkFrustumSelector vtkFunctionParser vtkFunctionSet vtkGAMBITReader vtkGDAL vtkGDALRasterConverter vtkGDALRasterReader vtkGDALRasterReprojection vtkGDALVectorReader vtkGESignaReader vtkGL2PSExporter vtkGLSLModCamera vtkGLSLModCoincidentTopology vtkGLSLModLight vtkGLSLModPixelDebugger vtkGLSLModifierBase vtkGLSLModifierFactory vtkGLTFDocumentLoader vtkGLTFDocumentLoaderInternals vtkGLTFExporter vtkGLTFImporter vtkGLTFReader vtkGLTFTexture vtkGLTFWriter vtkGLTFWriterUtils vtkGPUInfo vtkGPUInfoList vtkGPUInfoListArray vtkGPUVolumeRayCastMapper vtkGarbageCollector vtkGarbageCollectorManager vtkGaussianBlurPass vtkGaussianCubeReader vtkGaussianCubeReader2 vtkGaussianRandomSequence vtkGeneralTransform vtkGeneralizedKernel vtkGenerateGlobalIds vtkGenerateIndexArray vtkGenerateProcessIds vtkGenerateTimeSteps vtkGenericAdaptorCell vtkGenericAttribute vtkGenericAttributeCollection vtkGenericCellIterator vtkGenericCellTessellator vtkGenericClip vtkGenericContourFilter vtkGenericCutter vtkGenericDataArray vtkGenericDataArrayLookupHelper vtkGenericDataObjectReader vtkGenericDataObjectWriter vtkGenericDataSet vtkGenericDataSetTessellator vtkGenericEdgeTable vtkGenericEnSightReader vtkGenericGeometryFilter vtkGenericGlyph3DFilter vtkGenericImageInterpolator vtkGenericInterpolatedVelocityField vtkGenericMovieWriter vtkGenericOpenGLRenderWindow vtkGenericOpenGLResourceFreeCallback vtkGenericOutlineFilter vtkGenericPointIterator vtkGenericProbeFilter vtkGenericRenderWindowInteractor vtkGenericStreamTracer vtkGenericSubdivisionErrorMetric vtkGenericVertexAttributeMapping vtkGeoEdgeStrategy vtkGeoJSONFeature vtkGeoJSONReader vtkGeoJSONWriter vtkGeoMath vtkGeoProjection vtkGeoTransform vtkGeodesicPath vtkGeometricErrorMetric vtkGhostCellsGenerator vtkGlobFileNames vtkGradientFilter vtkGraph vtkGraphAlgorithm vtkGraphAnnotationLayersFilter vtkGraphEdge vtkGraphGeodesicPath vtkGraphHierarchicalBundleEdges vtkGraphInternals vtkGraphItem vtkGraphLayoutFilter vtkGraphLayoutStrategy vtkGraphMapper vtkGraphReader vtkGraphToPoints vtkGraphWeightEuclideanDistanceFilter vtkGraphWeightFilter vtkGraphWriter vtkGraphicsFactory vtkGreedyTerrainDecimation vtkGridSynchronizedTemplates3D vtkGridTransform vtkGroupDataSetsFilter vtkGroupLeafVertices vtkGroupTimeStepsFilter vtkH5PartReader vtkH5RageReader vtkHDF5Helper vtkHDFReaderImplementation vtkHDFVersion vtkHDFWriter vtkHDFWriterImplementation vtkHandleRepresentation vtkHandleSource vtkHandleWidget vtkHardwarePicker vtkHardwareWindow vtkHeap vtkHeatmapItem vtkHiddenLineRemovalPass vtkHierarchicalBinningFilter vtkHierarchicalBoxDataSet vtkHierarchicalBoxDataSetAlgorithm vtkHierarchicalDataExtractDataSets vtkHierarchicalDataExtractLevel vtkHierarchicalDataLevelFilter vtkHierarchicalDataSetGeometryFilter vtkHierarchicalGraphPipeline vtkHierarchicalGraphView vtkHierarchicalPolyDataMapper vtkHigherOrderCurve vtkHigherOrderHexahedron vtkHigherOrderInterpolation vtkHigherOrderQuadrilateral vtkHigherOrderTetra vtkHigherOrderTriangle vtkHigherOrderWedge vtkHighestDensityRegionsStatistics vtkHomogeneousTransform vtkHoudiniPolyDataWriter vtkHoverWidget vtkHyperTree vtkHyperTreeGrid vtkHyperTreeGridAlgorithm vtkHyperTreeGridAxisClip vtkHyperTreeGridAxisCut vtkHyperTreeGridAxisReflection vtkHyperTreeGridCellCenters vtkHyperTreeGridContour vtkHyperTreeGridDepthLimiter vtkHyperTreeGridEntry vtkHyperTreeGridEvaluateCoarse vtkHyperTreeGridExtractGhostCells vtkHyperTreeGridFeatureEdges vtkHyperTreeGridGeometricLocator vtkHyperTreeGridGeometry vtkHyperTreeGridGeometry1DImpl vtkHyperTreeGridGeometry2DImpl vtkHyperTreeGridGeometry3DImpl vtkHyperTreeGridGeometryEntry vtkHyperTreeGridGeometryImpl vtkHyperTreeGridGeometryLevelEntry vtkHyperTreeGridGeometrySmallDimensionsImpl vtkHyperTreeGridGeometryUnlimitedEntry vtkHyperTreeGridGeometryUnlimitedLevelEntry vtkHyperTreeGridGhostCellsGenerator vtkHyperTreeGridGhostCellsGeneratorInternals vtkHyperTreeGridGradient vtkHyperTreeGridIterator vtkHyperTreeGridLevelEntry vtkHyperTreeGridLocator vtkHyperTreeGridMapper vtkHyperTreeGridNonOrientedCursor vtkHyperTreeGridNonOrientedGeometryCursor vtkHyperTreeGridNonOrientedMooreSuperCursor vtkHyperTreeGridNonOrientedMooreSuperCursorLight vtkHyperTreeGridNonOrientedSuperCursor vtkHyperTreeGridNonOrientedSuperCursorLight vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor vtkHyperTreeGridNonOrientedUnlimitedSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight vtkHyperTreeGridOrientedCursor vtkHyperTreeGridOrientedGeometryCursor vtkHyperTreeGridOutlineFilter vtkHyperTreeGridPlaneCutter vtkHyperTreeGridPreConfiguredSource vtkHyperTreeGridProbeFilter vtkHyperTreeGridScales vtkHyperTreeGridThreshold vtkHyperTreeGridToDualGrid vtkHyperTreeGridVisibleLeavesSize vtkIOCellGrid vtkIOSRenderWindow vtkIOSRenderWindowInteractor vtkIOSSFilesScanner vtkIOSSModel vtkIOSSReader vtkIOSSReaderInternal vtkIOSSWriter vtkIOStream vtkIOStreamFwd vtkISIReader vtkIVExporter vtkIVWriter vtkIcicleView vtkIconGlyphFilter vtkIdListCollection vtkIdentityTransform vtkImageActorPointPlacer vtkImageAlgorithm vtkImageAnisotropicDiffusion2D vtkImageAnisotropicDiffusion3D vtkImageAppendComponents vtkImageBSplineCoefficients vtkImageBSplineInternals vtkImageBSplineInterpolator vtkImageBlend vtkImageButterworthLowPass vtkImageCacheFilter vtkImageChangeInformation vtkImageCheckerboard vtkImageCityBlockDistance vtkImageClip vtkImageConnectivityFilter vtkImageConnector vtkImageConnectorSeed vtkImageContinuousDilate3D vtkImageContinuousErode3D vtkImageConvolve vtkImageCorrelation vtkImageCroppingRegionsWidget vtkImageCursor3D vtkImageDataLIC2D vtkImageDataOutlineFilter vtkImageDataStreamer vtkImageDataToExplicitStructuredGrid vtkImageDataToHyperTreeGrid vtkImageDataToPointSet vtkImageDataToUniformGrid vtkImageDecomposeFilter vtkImageDifference vtkImageDivergence vtkImageDotProduct vtkImageEllipsoidSource vtkImageEuclideanDistance vtkImageExport vtkImageFourierFilter vtkImageGaussianSource vtkImageGradientMagnitude vtkImageGridSource vtkImageHSIToRGB vtkImageHistogram vtkImageHistogramStatistics vtkImageIdealLowPass vtkImageImportExecutive vtkImageInPlaceFilter vtkImageInterpolator vtkImageItem vtkImageIterateFilter vtkImageIterator vtkImageLogic vtkImageMapToRGBA vtkImageMapper vtkImageMapper3D vtkImageMask vtkImageMaskBits vtkImageNonMaximumSuppression vtkImageOpenClose3D vtkImageOrthoPlanes vtkImagePadFilter vtkImagePermute vtkImagePlaneWidget vtkImagePointDataIterator vtkImagePointIterator vtkImageProbeFilter vtkImageProcessingPass vtkImageProgressIterator vtkImageProperty vtkImageQuantizeRGBToIndex vtkImageRGBToHSI vtkImageRGBToHSV vtkImageRGBToXYZ vtkImageRGBToYIQ vtkImageRange3D vtkImageReader vtkImageReader2 vtkImageReader2Collection vtkImageRectilinearWipe vtkImageRenderManager vtkImageResample vtkImageResize vtkImageReslice vtkImageResliceMapper vtkImageResliceToColors vtkImageSSIM vtkImageSeparableConvolution vtkImageSincInterpolator vtkImageSkeleton2D vtkImageSlab vtkImageSlabReslice vtkImageSlice vtkImageSliceCollection vtkImageSliceMapper vtkImageSobel2D vtkImageSobel3D vtkImageSpatialAlgorithm vtkImageStack vtkImageStencilAlgorithm vtkImageStencilData vtkImageStencilIterator vtkImageStencilRaster vtkImageStencilSource vtkImageStencilToImage vtkImageThresholdConnectivity vtkImageToAMR vtkImageToImageStencil vtkImageToPoints vtkImageToPolyDataFilter vtkImageToStructuredGrid vtkImageToStructuredPoints vtkImageTracerWidget vtkImageTransform vtkImageTranslateExtent vtkImageVariance3D vtkImageWriter vtkImageXYZToLAB vtkImageYIQToRGB vtkImplicitArray vtkImplicitCylinderRepresentation vtkImplicitCylinderWidget vtkImplicitDataSet vtkImplicitFunction vtkImplicitFunctionCollection vtkImplicitFunctionToImageStencil vtkImplicitHalo vtkImplicitImageRepresentation vtkImplicitPlaneWidget vtkImplicitProjectOnPlaneDistance vtkImplicitSelectionLoop vtkImplicitSum vtkImplicitVolume vtkImplicitWindowFunction vtkImporter vtkImprintFilter vtkInEdgeIterator vtkIncrementalForceLayout vtkIncrementalOctreeNode vtkIncrementalOctreePointLocator vtkIncrementalPointLocator vtkIndent vtkIndexedImplicitBackend vtkInformation vtkInformationDataObjectKey vtkInformationDataObjectMetaDataKey vtkInformationDoubleKey vtkInformationDoubleVectorKey vtkInformationExecutivePortKey vtkInformationExecutivePortVectorKey vtkInformationIdTypeKey vtkInformationInformationKey vtkInformationInformationVectorKey vtkInformationIntegerKey vtkInformationIntegerPointerKey vtkInformationIntegerRequestKey vtkInformationIntegerVectorKey vtkInformationInternals vtkInformationIterator vtkInformationKey vtkInformationKeyLookup vtkInformationKeyVectorKey vtkInformationObjectBaseKey vtkInformationObjectBaseVectorKey vtkInformationQuadratureSchemeDefinitionVectorKey vtkInformationRequestKey vtkInformationStringKey vtkInformationStringVectorKey vtkInformationUnsignedLongKey vtkInformationVariantKey vtkInformationVariantVectorKey vtkInformationVector vtkInitialValueProblemSolver vtkInputStream vtkIntegrateAttributes vtkInteractiveArea vtkInteractorEventRecorder vtkInteractorObserver vtkInteractorStyle vtkInteractorStyle3D vtkInteractorStyleAreaSelectHover vtkInteractorStyleDrawPolygon vtkInteractorStyleFlight vtkInteractorStyleJoystickActor vtkInteractorStyleJoystickCamera vtkInteractorStyleMultiTouchCamera vtkInteractorStyleRubberBand2D vtkInteractorStyleRubberBand3D vtkInteractorStyleRubberBandZoom vtkInteractorStyleSwitch vtkInteractorStyleSwitchBase vtkInteractorStyleTerrain vtkInteractorStyleTrackball vtkInteractorStyleTreeMapHover vtkInteractorStyleUnicam vtkInteractorStyleUser vtkInterpolateCalculator vtkInterpolateDataSetAttributes vtkInterpolatingSubdivisionFilter vtkInterpolationKernel vtkInterpolatorInternals vtkIntersectionCounter vtkIntersectionPolyDataFilter vtkJSONDataSetWriter vtkJSONImageWriter vtkJSONRenderWindowExporter vtkJSONSceneExporter vtkJavaScriptDataWriter vtkJoinTables vtkKCoreDecomposition vtkKCoreLayout vtkKMeansAssessFunctor vtkKMeansDistanceFunctor vtkKMeansDistanceFunctorCalculator vtkKMeansStatistics vtkKdNode vtkKdTree vtkKdTreePointLocator vtkKdTreeSelector vtkKochanekSpline vtkLASRasterReader vtkLASReader vtkLICNoiseHelper vtkLICRandomNoise2D vtkLICRandomNumberGeneratorInterface vtkLODProp3D vtkLSDynaPart vtkLSDynaPartCollection vtkLSDynaReader vtkLSDynaSummaryParser vtkLZ4DataCompressor vtkLZMADataCompressor vtkLabelHierarchy vtkLabelHierarchyAlgorithm vtkLabelHierarchyCompositeIterator vtkLabelHierarchyIterator vtkLabelPlacementMapper vtkLabelPlacer vtkLabelRenderStrategy vtkLabelSizeCalculator vtkLabeledContourMapper vtkLabeledContourPolyDataItem vtkLabeledTreeMapDataMapper vtkLagrangeCurve vtkLagrangeHexahedron vtkLagrangeInterpolation vtkLagrangeQuadrilateral vtkLagrangeTetra vtkLagrangeTriangle vtkLagrangeWedge vtkLagrangianBasicIntegrationModel vtkLagrangianMatidaIntegrationModel vtkLagrangianParticle vtkLagrangianParticleTracker vtkLargeInteger vtkLassoStencilSource vtkLeaderActor2D vtkLegacyReaderVersion vtkLegendBoxActor vtkLegendScaleActor vtkLengthDistribution vtkLevelIdScalars vtkLightCollection vtkLightKit vtkLightNode vtkLightRepresentation vtkLightWidget vtkLightingMapPass vtkLineIntegralConvolution2D vtkLineRepresentation vtkLineWidget2 vtkLinearCellExtrusionFilter vtkLinearContourLineInterpolator vtkLinearKernel vtkLinearSelector vtkLinearToQuadraticCellsFilter vtkLinearTransform vtkLinearTransformCellLocator vtkLinkEdgels vtkLocationSelector vtkLocator vtkLogger vtkLogoRepresentation vtkLogoWidget vtkLongArray vtkLongLongArray vtkLookupTableItem vtkLookupTableWithEnabling vtkLoopBooleanPolyDataFilter vtkMCubesWriter vtkMFCWindow vtkMFIXReader vtkMINCImageAttributes vtkMINCImageReader vtkMINCImageWriter vtkMNIObjectReader vtkMNIObjectWriter vtkMNITagPointReader vtkMNITagPointWriter vtkMNITransformReader vtkMNITransformWriter vtkMP4Writer vtkMPASReader vtkMPI4PyCommunicator vtkMPICommunicator vtkMPIController vtkMPIEventLog vtkMPIImageReader vtkMPIMultiBlockPLOT3DReader vtkMPIPixelTT vtkMPIPixelView vtkMRCReader vtkMagnifierRepresentation vtkMagnifierWidget vtkMapArrayValues vtkMapMaskTextureId vtkMappedDataArray vtkMappedUnstructuredGrid vtkMappedUnstructuredGridCellIterator vtkMapper vtkMapper2D vtkMapperCollection vtkMapperNode vtkMarkBoundaryFilter vtkMarkerUtilities vtkMarshalContext vtkMaskPointsFilter vtkMassProperties vtkMathPrivate vtkMathTextFreeTypeTextRenderer vtkMathTextUtilities vtkMathTextUtilitiesCleanup vtkMathUtilities vtkMatplotlibMathTextUtilities vtkMatricizeArray vtkMatrix3x3 vtkMatrixMathFilter vtkMatrixToHomogeneousTransform vtkMatrixToLinearTransform vtkMeanValueCoordinatesInterpolator vtkMeasurementCubeHandleRepresentation3D vtkMedicalImageProperties vtkMedicalImageReader2 vtkMemkindRAII vtkMemoryLimitImageDataStreamer vtkMemoryResourceStream vtkMergeArrays vtkMergeCells vtkMergeColumns vtkMergeDataObjectFilter vtkMergeFields vtkMergeGraphs vtkMergeTables vtkMergeTimeFilter vtkMergeVectorComponents vtkMersenneTwister vtkMeshQuality vtkModelMetadata vtkModifiedBSPTree vtkMolecule vtkMoleculeAlgorithm vtkMoleculeAppend vtkMoleculeMapper vtkMoleculeReaderBase vtkMoleculeToAtomBallFilter vtkMoleculeToBondStickFilter vtkMoleculeToLinesFilter vtkMoleculeToPolyDataFilter vtkMotionFXCFGReader vtkMultiBlockDataGroupFilter vtkMultiBlockDataSetAlgorithm vtkMultiBlockMergeFilter vtkMultiBlockPLOT3DReaderRecord vtkMultiBlockUnstructuredGridVolumeMapper vtkMultiBlockVolumeMapper vtkMultiCorrelativeAssessFunctor vtkMultiCorrelativeStatistics vtkMultiNewickTreeReader vtkMultiObjectMassProperties vtkMultiPieceDataSet vtkMultiProcessController vtkMultiProcessStream vtkMultiThreader vtkMultiTimeStepAlgorithm vtkMultiVolume vtkMutableGraphHelper vtkMySQLDatabase vtkMySQLDatabasePrivate vtkMySQLQuery vtkMySQLToTableReader vtkNIFTIImageHeader vtkNIFTIImageReader vtkNIFTIImageWriter vtkNativePartitioningStrategy vtkNeighborCells vtkNek5000Reader vtkNetCDFCAMReader vtkNetCDFCFReader vtkNetCDFCFWriter vtkNetCDFPOPReader vtkNetCDFReader vtkNetCDFUGRIDReader vtkNetCDFUGRIDeader vtkNetworkHierarchy vtkNewickTreeReader vtkNewickTreeWriter vtkNonLinearCell vtkNonMergingPointLocator vtkNonOverlappingAMR vtkNonOverlappingAMRAlgorithm vtkNonOverlappingAMRLevelIdScalars vtkNormalizeMatrixVectors vtkNrrdReader vtkNumberToString vtkOBBDicer vtkOBBNode vtkOBJExporter vtkOBJImporter vtkOBJPolyDataProcessor vtkOBJWriter vtkOCCTReader vtkODBCDatabase vtkODBCInternals vtkODBCQuery vtkOMETIFFReader vtkOMFReader vtkOOGLExporter vtkOSOpenGLRenderWindow vtkOSPRayAMRVolumeMapperNode vtkOSPRayActorNode vtkOSPRayCache vtkOSPRayCacheItemObject vtkOSPRayCameraNode vtkOSPRayCompositePolyDataMapper2Node vtkOSPRayCompositePolyDataMapperNode vtkOSPRayLightNode vtkOSPRayMaterialHelpers vtkOSPRayMaterialLibrary vtkOSPRayMoleculeMapperNode vtkOSPRayPass vtkOSPRayPointGaussianMapperNode vtkOSPRayPolyDataMapperNode vtkOSPRayRendererNode vtkOSPRayTestInteractor vtkOSPRayUnstructuredVolumeMapperNode vtkOSPRayViewNodeFactory vtkOSPRayVolumeInterface vtkOSPRayVolumeMapper vtkOSPRayVolumeMapperNode vtkOSPRayVolumeNode vtkOSPRayWindowNode vtkOStrStreamWrapper vtkOStreamWrapper vtkOTDensityMap vtkOTFilter vtkOTKernelSmoothing vtkOTScatterPlotMatrix vtkOTUtilities vtkObject vtkObjectBase vtkObjectFactory vtkObjectFactoryCollection vtkObjectFactoryRegistryCleanup vtkObjectIdMap vtkObserverMediator vtkOctreeImageToPointSetFilter vtkOctreePointLocator vtkOctreePointLocatorNode vtkOggTheoraWriter vtkOldStyleCallbackCommand vtkOpenFOAMReader vtkOpenGL2ContextDevice2DCellArrayHelper vtkOpenGL2ContextDevice2DPrivate vtkOpenGLActor vtkOpenGLArrayTextureBufferAdapter vtkOpenGLAvatar vtkOpenGLBatchedPolyDataMapper vtkOpenGLBillboardTextActor3D vtkOpenGLBufferObject vtkOpenGLCamera vtkOpenGLCellGridMapper vtkOpenGLCellToVTKCellMap vtkOpenGLCompositePolyDataMapperDelegator vtkOpenGLContextActor vtkOpenGLContextBufferId vtkOpenGLContextDevice2D vtkOpenGLContextDevice3D vtkOpenGLContextDeviceBufferObjectBuilder vtkOpenGLES30PolyDataMapper2D vtkOpenGLFXAAFilter vtkOpenGLFXAAPass vtkOpenGLFluidMapper vtkOpenGLFramebufferObject vtkOpenGLGL2PSExporter vtkOpenGLGL2PSHelper vtkOpenGLGL2PSHelperImpl vtkOpenGLGPUVolumeRayCastMapper vtkOpenGLGlyph3DHelper vtkOpenGLGlyph3DMapper vtkOpenGLHardwareSelector vtkOpenGLHelper vtkOpenGLHyperTreeGridMapper vtkOpenGLImageAlgorithmCallback vtkOpenGLImageAlgorithmHelper vtkOpenGLImageGradient vtkOpenGLImageMapper vtkOpenGLImageSliceMapper vtkOpenGLIndexBufferObject vtkOpenGLInstanceCulling vtkOpenGLLabeledContourMapper vtkOpenGLLight vtkOpenGLLowMemoryBatchedPolyDataMapper vtkOpenGLLowMemoryCellTypeAgent vtkOpenGLLowMemoryLinesAgent vtkOpenGLLowMemoryPolyDataMapper vtkOpenGLLowMemoryPolygonsAgent vtkOpenGLLowMemoryStripsAgent vtkOpenGLLowMemoryVerticesAgent vtkOpenGLMoleculeMapper vtkOpenGLMovieSphere vtkOpenGLPointGaussianMapper vtkOpenGLPointGaussianMapperHelper vtkOpenGLPolyDataMapper vtkOpenGLPolyDataMapper2D vtkOpenGLProjectedTetrahedraMapper vtkOpenGLPropItem vtkOpenGLProperty vtkOpenGLQuadHelper vtkOpenGLRenderPass vtkOpenGLRenderTimer vtkOpenGLRenderTimerLog vtkOpenGLRenderUtilities vtkOpenGLRenderWindow vtkOpenGLResourceFreeCallback vtkOpenGLShaderCache vtkOpenGLShaderDeclaration vtkOpenGLShaderProperty vtkOpenGLSphereMapper vtkOpenGLState vtkOpenGLStickMapper vtkOpenGLTextActor vtkOpenGLTextActor3D vtkOpenGLTextMapper vtkOpenGLTexture vtkOpenGLUniforms vtkOpenGLVertexArrayObject vtkOpenGLVertexBufferObject vtkOpenGLVertexBufferObjectCache vtkOpenGLVertexBufferObjectGroup vtkOpenGLVolumeGradientOpacityTable vtkOpenGLVolumeLookupTable vtkOpenGLVolumeLookupTables vtkOpenGLVolumeMaskGradientOpacityTransferFunction2D vtkOpenGLVolumeMaskTransferFunction2D vtkOpenGLVolumeOpacityTable vtkOpenGLVolumeRGBTable vtkOpenGLVolumeTransferFunction2D vtkOpenQubeElectronicData vtkOpenQubeMoleculeSource vtkOpenSlideReader vtkOpenVDBReader vtkOpenVDBWriter vtkOpenVRCamera vtkOpenVRCameraPose vtkOpenVRControlsHelper vtkOpenVRDefaultOverlay vtkOpenVRInteractorStyle vtkOpenVRModel vtkOpenVROverlay vtkOpenVROverlaySpot vtkOpenVRRenderWindow vtkOpenVRRenderWindowInteractor vtkOpenVRRenderer vtkOpenXRCamera vtkOpenXRControlsHelper vtkOpenXRInteractorStyle vtkOpenXRManager vtkOpenXRManagerConnection vtkOpenXRManagerD3DGraphics vtkOpenXRManagerGraphics vtkOpenXRManagerOpenGLGraphics vtkOpenXRManagerRemoteConnection vtkOpenXRModel vtkOpenXRRemotingRenderWindow vtkOpenXRRenderWindow vtkOpenXRRenderWindowInteractor vtkOpenXRRenderer vtkOpenXRUtilities vtkOrderIndependentTranslucentPass vtkOrderStatistics vtkOrderedTriangulator vtkOrientPolyData vtkOrientationRepresentation vtkOrientationWidget vtkOrientedGlyphFocalPlaneContourRepresentation vtkOrientedPolygonalHandleRepresentation3D vtkOutEdgeIterator vtkOutlineCornerFilter vtkOutlineCornerSource vtkOutlineSource vtkOutputStream vtkOutputWindow vtkOutputWindowCleanup vtkOverlappingAMRAlgorithm vtkOverlappingAMRLevelIdScalars vtkOverlappingCellsDetector vtkOverrideInformation vtkOverrideInformationCollection vtkPAutoCorrelativeStatistics vtkPBRIrradianceTexture vtkPBRLUTTexture vtkPBRPrefilterTexture vtkPBivariateLinearTableThreshold vtkPCAAnalysisFilter vtkPCACurvatureEstimation vtkPCANormalEstimation vtkPCAStatistics vtkPCellDataToPointData vtkPCellSizeFilter vtkPChacoReader vtkPComputeHistogram2DOutliers vtkPComputeQuantiles vtkPComputeQuartiles vtkPConnectivityFilter vtkPContingencyStatistics vtkPConvertToMultiBlockDataSet vtkPCorrelativeStatistics vtkPDALReader vtkPDBReader vtkPDFContextDevice2D vtkPDFExporter vtkPDataSetReader vtkPDataSetWriter vtkPDescriptiveStatistics vtkPDirectory vtkPDistributedDataFilter vtkPExodusIIReader vtkPExodusIIWriter vtkPExtractDataArraysOverTime vtkPExtractExodusGlobalTemporalVariables vtkPExtractGrid vtkPExtractHistogram2D vtkPExtractRectilinearGrid vtkPExtractSelectedArraysOverTime vtkPExtractVOI vtkPHardwareSelector vtkPHyperTreeGridProbeFilter vtkPIOReader vtkPImageWriter vtkPKMeansStatisitcs vtkPKMeansStatistics vtkPKdTree vtkPLSDynaReader vtkPLagrangianParticleTracker vtkPLineIntegralConvolution2D vtkPLinearExtrusionFilter vtkPMaskPoints vtkPMergeArrays vtkPMultiCorrelativeStatistics vtkPNetCDFPOPReader vtkPNrrdReader vtkPOVExporter vtkPOpenFOAMReader vtkPOrderStatistics vtkPOutlineCornerFilter vtkPOutlineFilter vtkPOutlineFilterInternals vtkPPCAStatistics vtkPPainterCommunicator vtkPPairwiseExtractHistogram2D vtkPParticlePathFilter vtkPParticleTracer vtkPParticleTracerBase vtkPPixelTransfer vtkPPolyDataNormals vtkPProbeFilter vtkPProjectSphereFilter vtkPReflectionFilter vtkPResampleFilter vtkPResampleToImage vtkPResampleWithDataSet vtkPSLACReader vtkPSimpleBondPerceiver vtkPSphereSource vtkPStreaklineFilter vtkPStreamTracer vtkPStructuredGridConnectivity vtkPSurfaceLICComposite vtkPSurfaceLICInterface vtkPSystemTools vtkPTSReader vtkPTextureMapToSphere vtkPVWebGLExporter vtkPWindBladeReader vtkPXdmf3Writer vtkPYoungsMaterialInterface vtkPackLabels vtkPainterCommunicator vtkPairwiseExtractHistogram2D vtkPanoramicProjectionPass vtkParallelAMRUtilities vtkParallelCoordinatesActor vtkParallelCoordinatesHistogramRepresentation vtkParallelCoordinatesInteractorStyle vtkParallelReader vtkParallelRenderManager vtkParallelTimer vtkParallelVectors vtkParallelopipedRepresentation vtkParallelopipedWidget vtkParametricFunction vtkParticlePathFilter vtkParticleReader vtkParticleTracer vtkParticleTracerBase vtkPartitionBalancer vtkPartitionedArchiver vtkPartitionedDataSet vtkPartitionedDataSetAlgorithm vtkPartitionedDataSetCollection vtkPartitionedDataSetCollectionAlgorithm vtkPartitionedDataSetCollectionSource vtkPartitionedDataSetSource vtkPartitioningStrategy vtkPassArrays vtkPassInputTypeAlgorithm vtkPassSelectedArrays vtkPassThrough vtkPassThroughEdgeStrategy vtkPassThroughLayoutStrategy vtkPath vtkPen vtkPeriodicDataArray vtkPeriodicFilter vtkPeriodicTable vtkPerspectiveTransform vtkPerturbCoincidentVertices vtkPhyloXMLTreeReader vtkPhyloXMLTreeWriter vtkPicker vtkPickingManager vtkPieChartActor vtkPieceRequestFilter vtkPieceScalars vtkPiecewiseControlPointsItem vtkPiecewiseFunctionAlgorithm vtkPiecewiseFunctionItem vtkPiecewiseFunctionShiftScale vtkPiecewisePointHandleItem vtkPipelineGraphSource vtkPipelineSize vtkPixelBufferObject vtkPixelExtent vtkPixelExtentIO vtkPixelTransfer vtkPlaneCollection vtkPlaneCutter vtkPlaneWidget vtkPlaybackRepresentation vtkPlaybackWidget vtkPlot vtkPlot3D vtkPlot3DMetaReader vtkPlotArea vtkPlotBag vtkPlotBar vtkPlotBarRangeHandlesItem vtkPlotBox vtkPlotFunctionalBag vtkPlotGrid vtkPlotHistogram2D vtkPlotLine vtkPlotLine3D vtkPlotParallelCoordinates vtkPlotPie vtkPlotPoints3D vtkPlotRangeHandlesItem vtkPlotStacked vtkPointCloudFilter vtkPointCloudRepresentation vtkPointCloudWidget vtkPointConnectivityFilter vtkPointData vtkPointDataToCellData vtkPointDensityFilter vtkPointFillPass vtkPointHandleRepresentation2D vtkPointHandleRepresentation3D vtkPointHandleSource vtkPointInterpolator2D vtkPointLocator vtkPointOccupancyFilter vtkPointPicker vtkPointPlacer vtkPointSet vtkPointSetAlgorithm vtkPointSetCellIterator vtkPointSetStreamer vtkPointSetToLabelHierarchy vtkPointSetToMoleculeFilter vtkPointSetToOctreeImageFilter vtkPointSmoothingFilter vtkPointWidget vtkPoints2D vtkPointsProjectedHull vtkPoissonDiskSampler vtkPolarAxesActor vtkPolarAxesActor2D vtkPolyDataAlgorithm vtkPolyDataCollection vtkPolyDataContourLineInterpolator vtkPolyDataEdgeConnectivityFilter vtkPolyDataInternals vtkPolyDataItem vtkPolyDataMapperNode vtkPolyDataPlaneClipper vtkPolyDataPlaneCutter vtkPolyDataPointPlacer vtkPolyDataPointSampler vtkPolyDataSourceWidget vtkPolyDataStreamer vtkPolyDataToReebGraphFilter vtkPolyDataToUnstructuredGrid vtkPolyLineRepresentation vtkPolyLineSource vtkPolyLineWidget vtkPolyPlane vtkPolyPointSource vtkPolygonBuilder vtkPolygonalHandleRepresentation3D vtkPolygonalSurfaceContourLineInterpolator vtkPolygonalSurfacePointPlacer vtkPolyhedronUtilities vtkPolynomialSolversUnivariate vtkPostgreSQLDatabase vtkPostgreSQLDatabasePrivate vtkPostgreSQLQuery vtkPostgreSQLToTableReader vtkPriorityQueue vtkProStarReader vtkProbabilisticVoronoiKernel vtkProbeLineFilter vtkProbePolyhedron vtkProbeSelectedLocations vtkProcess vtkProcessGroup vtkProcessIdScalars vtkProcrustesAlignmentFilter vtkProgrammableAttributeDataFilter vtkProgrammableDataObjectSource vtkProgrammableElectronicData vtkProgrammableFilter vtkProgrammableSource vtkProgressBarRepresentation vtkProgressBarWidget vtkProgressObserver vtkProjectPointsToPlane vtkProjectSphereFilter vtkProjectedTerrainPath vtkProjectedTetrahedraMapper vtkProjectedTexture vtkProp vtkProp3DAxisFollower vtkProp3DButtonRepresentation vtkProp3DCollection vtkProp3DFollower vtkPropCollection vtkPropItem vtkProperty2D vtkProteinRibbonFilter vtkPruneTreeFilter vtkPythonAlgorithm vtkPythonArchiver vtkPythonItem vtkQImageToImageSource vtkQWidgetRepresentation vtkQWidgetTexture vtkQWidgetWidget vtkQtAbstractModelAdapter vtkQtAnnotationLayersModelAdapter vtkQtAnnotationView vtkQtConnection vtkQtDebugLeaksModel vtkQtDebugLeaksView vtkQtInitialization vtkQtLabelRenderStrategy vtkQtListView vtkQtRecordView vtkQtSQLDatabase vtkQtSQLQuery vtkQtStringToImage vtkQtTableModelAdapter vtkQtTableRepresentation vtkQtTableView vtkQtTimePointUtility vtkQtTreeModelAdapter vtkQtTreeRingLabelMapper vtkQtTreeView vtkQtView vtkQuadRotationalExtrusionFilter vtkQuadraturePointInterpolator vtkQuadraturePointsGenerator vtkQuadratureSchemeDefinition vtkQuadratureSchemeDictionaryGenerator vtkQuadricClustering vtkQuadricDecimation vtkQuadricLODActor vtkQuantizePolyDataPoints vtkQuaternion vtkQuaternionInterpolator vtkQuaterniond vtkQuaternionf vtkRIBExporter vtkRIBLight vtkRIBProperty vtkRISReader vtkROIStencilSource vtkRTXMLPolyDataReader vtkRadialGridActor2D vtkRadiusOutlierRemoval vtkRandomAttributeGenerator vtkRandomHyperTreeGridSource vtkRandomLayoutStrategy vtkRandomPool vtkRandomSequence vtkRangeHandlesItem vtkRasterReprojectionFilter vtkRayCastImageDisplayHelper vtkRayCastStructures vtkReaderAlgorithm vtkRearrangeFields vtkRecoverGeometryWireframe vtkRect vtkRectangularButtonSource vtkRectd vtkRecti vtkRectilinearGridAlgorithm vtkRectilinearGridClip vtkRectilinearGridOutlineFilter vtkRectilinearGridPartitioner vtkRectilinearGridReader vtkRectilinearGridToPointSet vtkRectilinearGridToTetrahedra vtkRectilinearGridWriter vtkRectilinearSynchronizedTemplates vtkRectilinearWipeRepresentation vtkRectilinearWipeWidget vtkRecursiveDividingCubes vtkRecursiveSphereDirectionEncoder vtkRedistributeDataSetFilter vtkReduceTable vtkReebGraph vtkReebGraphSimplificationFilter vtkReebGraphSimplificationMetric vtkReebGraphSurfaceSkeletonFilter vtkReebGraphToJoinSplitTreeFilter vtkReebGraphVolumeSkeletonFilter vtkReferenceCount vtkReflectionFilter vtkRemoteInteractionAdapter vtkRemoveDuplicatePolys vtkRemoveGhosts vtkRemoveHiddenData vtkRemoveIsolatedVertices vtkRemovePolyData vtkRemoveUnusedPoints vtkRenderPass vtkRenderState vtkRenderTimerLog vtkRenderView vtkRenderViewBase vtkRenderWidget vtkRenderWindowCollection vtkRenderWindowInteractor3D vtkRenderbuffer vtkRenderedAreaPicker vtkRenderedHierarchyRepresentation vtkRenderedRepresentation vtkRenderedSurfaceRepresentation vtkRenderedTreeAreaRepresentation vtkRendererCollection vtkRendererDelegate vtkRendererNode vtkRendererSource vtkRenderingCellGrid vtkResampleToImage vtkReservoirSampler vtkReservoirSamplerBase vtkResizingWindowToImageFilter vtkResliceCursor vtkResliceCursorActor vtkResliceCursorLineRepresentation vtkResliceCursorPicker vtkResliceCursorPolyDataAlgorithm vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation vtkResliceCursorWidget vtkResliceImageViewer vtkResliceImageViewerMeasurements vtkResourceFileLocator vtkResourceParser vtkResourceStream vtkRotationFilter vtkRowQuery vtkRowQueryToTable vtkRungeKutta2 vtkRungeKutta45 vtkSCurveSpline vtkSDL2OpenGL2RenderWindow vtkSDL2OpenGLRenderWindow vtkSDL2RenderWindowInteractor vtkSDL2WebGPURenderWindow vtkSEPReader vtkSILBuilder vtkSLACParticleReader vtkSLACReader vtkSMPContourGrid vtkSMPMergePoints vtkSMPMergePolyDataHelper vtkSMPProgressObserver vtkSMPThreadLocal vtkSMPThreadLocalAPI vtkSMPThreadLocalImpl vtkSMPThreadLocalImplAbstract vtkSMPThreadLocalObject vtkSMPThreadPool vtkSMPTools vtkSMPToolsAPI vtkSMPToolsAPIInitialize vtkSMPToolsImpl vtkSOADataArrayTemplate vtkSPHCubicKernel vtkSPHInterpolator vtkSPHKernel vtkSPHQuarticKernel vtkSPHQuinticKernel vtkSQLDatabase vtkSQLDatabaseGraphSource vtkSQLDatabaseSchema vtkSQLDatabaseTableSource vtkSQLGraphReader vtkSQLQuery vtkSQLiteDatabase vtkSQLiteDatabaseInternals vtkSQLiteQuery vtkSQLiteToTableReader vtkSSAAPass vtkSSAOPass vtkSVGContextDevice2D vtkSVGExporter vtkSampleImplicitFunctionFilter vtkScalarBarActorInternal vtkScalarBarRepresentation vtkScalarTree vtkScalarsToColors vtkScalarsToColorsItem vtkScalarsToTextureFilter vtkScaledSOADataArrayTemplate vtkScaledTextActor vtkScatterPlotMatrix vtkScenePicker vtkSectorSource vtkSeedRepresentation vtkSeedWidget vtkSegYBinaryHeaderBytesPositions vtkSegYIOUtils vtkSegYReader vtkSegYReaderInternal vtkSegYTrace vtkSegYTraceHeaderBytesPositions vtkSegYTraceReader vtkSelectPolyData vtkSelectVisiblePoints vtkSelectionAlgorithm vtkSelectionSource vtkSelector vtkSerializer vtkServerSocket vtkShader vtkShaderProgram vtkShaderProperty vtkShadowMapBakerPass vtkSharedFuture vtkSharedFutureBase vtkShepardKernel vtkShepardMethod vtkSignedCharArray vtkSignedDistance vtkSimple3DCirclesStrategy vtkSimpleBondPerceiver vtkSimpleCellTessellator vtkSimpleElevationFilter vtkSimpleImageToImageFilter vtkSimplePointsReader vtkSimplePointsWriter vtkSimpleReader vtkSimpleScalarTree vtkSingleVTPExporter vtkSliceAndDiceLayoutStrategy vtkSliceCubes vtkSliderRepresentation vtkSliderRepresentation3D vtkSmartPointer vtkSmartPointerBase vtkSmartVector vtkSmartVolumeMapper vtkSmoothErrorMetric vtkSmoothPolyDataFilter vtkSobelGradientMagnitudePass vtkSocket vtkSocketCollection vtkSocketCommunicator vtkSocketController vtkSortDataArray vtkSortFieldData vtkSortFileNames vtkSpanSpace vtkSpanTreeLayoutStrategy vtkSparseArray vtkSparseArrayToTable vtkSpatialRepresentationFilter vtkSpatioTemporalHarmonicsAttribute vtkSpatioTemporalHarmonicsSource vtkSphereHandleRepresentation vtkSpherePuzzle vtkSpherePuzzleArrows vtkSphereRepresentation vtkSphereTree vtkSphereTreeFilter vtkSphereWidget2 vtkSpheres vtkSphericalDirectionEncoder vtkSphericalHarmonics vtkSphericalPointIterator vtkSphericalTransform vtkSpline vtkSplineFilter vtkSplineGraphEdges vtkSplineRepresentation vtkSplineWidget2 vtkSplitByCellScalarFilter vtkSplitColumnComponents vtkSplitField vtkSplitSharpEdgesPolyData vtkSquarifyLayoutStrategy vtkStackedTreeLayoutStrategy vtkStateStorage vtkStaticCellLinks vtkStaticCellLinksTemplate vtkStaticCellLocator vtkStaticCleanPolyData vtkStaticCleanUnstructuredGrid vtkStaticCompositeSource vtkStaticDataSource vtkStaticEdgeLocatorTemplate vtkStaticFaceHashLinksTemplate vtkStaticPointLocator vtkStaticPointLocator2D vtkStatisticalOutlierRemoval vtkStatisticsAlgorithm vtkStatisticsAlgorithmPrivate vtkStdString vtkStereoCompositor vtkStitchImageDataWithGhosts vtkStrahlerMetric vtkStreaklineFilter vtkStreamGraph vtkStreamSurface vtkStreamerBase vtkStreamingDemandDrivenPipeline vtkStreamingStatistics vtkStreamingTessellator vtkStringOutputWindow vtkStringToCategory vtkStringToImage vtkStringToNumeric vtkStringToken vtkStructuredAMRGridConnectivity vtkStructuredAMRNeighbor vtkStructuredCellArray vtkStructuredData vtkStructuredDataPlaneCutter vtkStructuredExtent vtkStructuredGridAlgorithm vtkStructuredGridAppend vtkStructuredGridClip vtkStructuredGridConnectivity vtkStructuredGridLIC2D vtkStructuredGridPartitioner vtkStructuredGridWriter vtkStructuredImplicitConnectivity vtkStructuredNeighbor vtkStructuredPointArray vtkStructuredPointBackend vtkStructuredPointsCollection vtkStructuredPointsGeometryFilter vtkStructuredPointsWriter vtkStructuredTPointBackend vtkSubCommunicator vtkSubGroup vtkSubPixelPositionEdgels vtkSubdivideTetra vtkSubdivisionFilter vtkSurfaceLICComposite vtkSurfaceLICHelper vtkSurfaceLICInterface vtkSurfaceLICMapper vtkSurfaceNets2D vtkSurfaceNets3D vtkSurfaceReconstructionFilter vtkSynchronizeTimeFilter vtkSynchronizedRenderWindows vtkSynchronizedRenderers vtkSynchronizedTemplates2D vtkSynchronizedTemplates3D vtkSynchronizedTemplatesCutter3D vtkSystemIncludes vtkTDxInteractorStyle vtkTDxInteractorStyleCamera vtkTDxInteractorStyleSettings vtkTDxMotionEventInfo vtkTDxQtUnixDevices vtkTGAReader vtkTIFFReader vtkTIFFReaderInternal vtkTRUCHASReader vtkTableAlgorithm vtkTableBasedClipCases vtkTableFFT vtkTableReader vtkTableToArray vtkTableToDatabaseWriter vtkTableToGraph vtkTableToMySQLWriter vtkTableToPostgreSQLWriter vtkTableToSQLiteWriter vtkTableToSparseArray vtkTableToStructuredGrid vtkTableToTreeFilter vtkTableWriter vtkTanglegramItem vtkTclCommand vtkTecplotReader vtkTecplotTableReader vtkTemplateAliasMacro vtkTemporalAlgorithm vtkTemporalArrayOperatorFilter vtkTemporalDataSetCache vtkTemporalDelimitedTextReader vtkTemporalFractal vtkTemporalInterpolatedVelocityField vtkTemporalInterpolator vtkTemporalPathLineFilter vtkTemporalShiftScale vtkTemporalSnapToTimeStep vtkTemporalStatistics vtkTensorPrincipalInvariants vtkTensorProbeRepresentation vtkTensorProbeWidget vtkTensorRepresentation vtkTensorWidget vtkTerrainContourLineInterpolator vtkTerrainDataPointPlacer vtkTestDataArray vtkTestNewVar vtkTextActor3D vtkTextCodec vtkTextCodecFactory vtkTextPropertyCollection vtkTextRenderer vtkTextRendererCleanup vtkTextRendererStringToImage vtkTextureIO vtkTextureImageCache vtkTextureMapToCylinder vtkTextureMapToPlane vtkTextureObject vtkTextureUnitManager vtkTexturedActor2D vtkTexturedButtonRepresentation vtkTexturedButtonRepresentation2D vtkThinPlateSplineTransform vtkThreadedCallbackQueue vtkThreadedCompositeDataPipeline vtkThreadedImageAlgorithm vtkThreadedImageWriter vtkThreadedTaskQueue vtkThresholdGraph vtkThresholdTable vtkTimeInformation vtkTimePointUtility vtkTimeRange vtkTimeSource vtkTimeSourceExample vtkTimeStamp vtkTimerLog vtkTimerLogCleanup vtkTimerLogScope vtkToAffineArrayStrategy vtkToConstantArrayStrategy vtkToImplicitArrayFilter vtkToImplicitRamerDouglasPeuckerStrategy vtkToImplicitStrategy vtkToImplicitTypeErasureStrategy vtkTooltipItem vtkTransferAttributes vtkTransform2D vtkTransformCollection vtkTransformConcatenation vtkTransformConcatenationStack vtkTransformCoordinateSystems vtkTransformFeedback vtkTransformInterpolator vtkTransformPair vtkTransformTextureCoords vtkTransformToGrid vtkTranslucentPass vtkTransmitImageDataPiece vtkTransmitPolyDataPiece vtkTransmitRectilinearGridPiece vtkTransmitStructuredDataPiece vtkTransmitStructuredGridPiece vtkTransmitUnstructuredGridPiece vtkTransposeMatrix vtkTransposeTable vtkTreeAlgorithm vtkTreeAreaView vtkTreeBFSIterator vtkTreeCompositer vtkTreeDFSIterator vtkTreeDifferenceFilter vtkTreeFieldAggregator vtkTreeHeatmapItem vtkTreeIterator vtkTreeLayoutStrategy vtkTreeLevelsFilter vtkTreeMapLayout vtkTreeMapLayoutStrategy vtkTreeMapToPolyData vtkTreeMapView vtkTreeOrbitLayoutStrategy vtkTreeReader vtkTreeRingToPolyData vtkTreeRingView vtkTreeWriter vtkTriQuadraticPyramid vtkTriangleMeshPointNormals vtkTriangularTCoords vtkTriangularTexture vtkTrimmedExtrusionFilter vtkTrivialConsumer vtkTrivialProducer vtkTryDowncastHelper1 vtkTryDowncastHelper2 vtkTryDowncastHelper3 vtkTubeBender vtkTulipReader vtkTuple vtkTupleInterpolator vtkTypeList vtkTypedArray vtkTypedDataArray vtkTypedDataArrayIterator vtkURI vtkURIComponent vtkURILoader vtkUTF16TextCodec vtkUTF8TextCodec vtkUncertaintyTubeFilter vtkUndirectedGraph vtkUndirectedGraphAlgorithm vtkUniformGridAMR vtkUniformGridAMRAlgorithm vtkUniformGridAMRDataIterator vtkUniformGridPartitioner vtkUniformHyperTreeGrid vtkUniformHyperTreeGridSource vtkUniforms vtkUnsignedDistance vtkUnsignedIntArray vtkUnsignedLongArray vtkUnsignedLongLongArray vtkUnsignedShortArray vtkUnstructuredGridAlgorithm vtkUnstructuredGridBase vtkUnstructuredGridBaseAlgorithm vtkUnstructuredGridBunykRayCastFunction vtkUnstructuredGridCellIterator vtkUnstructuredGridGeometryFilter vtkUnstructuredGridHomogeneousRayIntegrator vtkUnstructuredGridLinearRayIntegrator vtkUnstructuredGridPartialPreIntegration vtkUnstructuredGridPreIntegration vtkUnstructuredGridQuadricDecimation vtkUnstructuredGridToCellGrid vtkUnstructuredGridToReebGraphFilter vtkUnstructuredGridVolumeMapper vtkUnstructuredGridVolumeRayCastFunction vtkUnstructuredGridVolumeRayCastIterator vtkUnstructuredGridVolumeRayCastMapper vtkUnstructuredGridVolumeRayIntegrator vtkUnstructuredGridVolumeZSweepMapper vtkUpdateCellsV8toV9 vtkVASPAnimationReader vtkVASPTessellationReader vtkVPICReader vtkVRCamera vtkVRCollaborationClient vtkVRControlsHelper vtkVRFollower vtkVRHMDCamera vtkVRHardwarePicker vtkVRInteractorStyle vtkVRMLExporter vtkVRMLImporter vtkVRMLUseStruct vtkVRMLYaccData vtkVRMenuRepresentation vtkVRMenuWidget vtkVRModel vtkVRPanelRepresentation vtkVRPanelWidget vtkVRRay vtkVRRenderWindow vtkVRRenderWindowInteractor vtkVRRenderer vtkValuePass vtkValueSelector vtkVariantBoostSerialization vtkVector vtkVector2 vtkVector2d vtkVector2f vtkVector3 vtkVector3d vtkVector3f vtkVector3i vtkVector4 vtkVector4d vtkVector4i vtkVectorFieldTopology vtkVectorNorm vtkVeraOutReader vtkVertexAdjacencyList vtkVertexDegree vtkVertexListIterator vtkVideoSource vtkView vtkViewDependentErrorMetric vtkViewNode vtkViewNodeFactory vtkVisibilitySort vtkVoidArray vtkVolume16Reader vtkVolumeCollection vtkVolumeContourSpectrumFilter vtkVolumeInputHelper vtkVolumeMapper vtkVolumeMapperNode vtkVolumeMask vtkVolumeNode vtkVolumeOfRevolutionFilter vtkVolumeOutlineSource vtkVolumePicker vtkVolumeRayCastSpaceLeapingImageFilter vtkVolumeReader vtkVolumeStateRAII vtkVolumeTexture vtkVolumetricPass vtkVoronoi2D vtkVoronoiKernel vtkVortexCore vtkVoxelContoursToSurfaceFilter vtkVoxelGrid vtkVtkJSSceneGraphSerializer vtkVtkJSViewNodeFactory vtkWGPUContext vtkWarpLens vtkWarpTransform vtkWasmSceneManager vtkWeakPointer vtkWeakPointerBase vtkWeakReference vtkWebApplication vtkWebAssemblyRenderWindowInteractor vtkWebGLDataSet vtkWebGLExporter vtkWebGLObject vtkWebGLPolyData vtkWebGLWidget vtkWebGPUActor vtkWebGPUCamera vtkWebGPUClearPass vtkWebGPUHardwareSelector vtkWebGPUInternalsBindGroup vtkWebGPUInternalsBindGroupLayout vtkWebGPUInternalsBuffer vtkWebGPUInternalsPipelineLayout vtkWebGPUInternalsRenderPassCreateInfo vtkWebGPUInternalsRenderPassDescriptor vtkWebGPUInternalsRenderPipelineDescriptor vtkWebGPUInternalsShaderModule vtkWebGPULight vtkWebGPUPolyDataMapper vtkWebGPUProperty vtkWebGPURenderPass vtkWebGPURenderWindow vtkWebGPURenderer vtkWebInteractionEvent vtkWebUtilities vtkWeightedTransformFilter vtkWendlandQuinticKernel vtkWidgetCallbackMapper vtkWidgetEventTranslator vtkWidgetRepresentation vtkWidgetSet vtkWin32HardwareWindow vtkWin32Header vtkWin32OpenGL2RenderWindow vtkWin32OpenGLDXRenderWindow vtkWin32OpenGLRenderWindow vtkWin32OutputWindow vtkWin32ProcessOutputWindow vtkWin32RenderWindowInteractor vtkWin32VideoSource vtkWindBladeReader vtkWindow vtkWindowNode vtkWordCloud vtkWorldPointPicker vtkWrappingHints vtkWriter vtkX3DExporter vtkX3DExporterFIWriter vtkX3DExporterFIWriterHelper vtkX3DExporterWriter vtkX3DExporterXMLWriter vtkXGMLReader vtkXMLCompositeDataReader vtkXMLCompositeDataSetWriterHelper vtkXMLCompositeDataWriter vtkXMLDataElement vtkXMLDataHeader vtkXMLDataHeaderImpl vtkXMLDataObjectWriter vtkXMLDataParser vtkXMLDataReader vtkXMLDataWriterHelper vtkXMLFileOutputWindow vtkXMLFileReadTester vtkXMLGenericDataObjectReader vtkXMLHierarchicalBoxDataFileConverter vtkXMLHierarchicalBoxDataReader vtkXMLHierarchicalBoxDataWriter vtkXMLHierarchicalDataReader vtkXMLHyperTreeGridReader vtkXMLHyperTreeGridWriter vtkXMLMultiBlockDataReader vtkXMLMultiBlockDataWriter vtkXMLMultiGroupDataReader vtkXMLPDataObjectReader vtkXMLPDataObjectWriter vtkXMLPDataReader vtkXMLPDataSetWriter vtkXMLPDataWriter vtkXMLPHierarchicalBoxDataWriter vtkXMLPHyperTreeGridReader vtkXMLPHyperTreeGridWriter vtkXMLPImageDataReader vtkXMLPImageDataWriter vtkXMLPMultiBlockDataWriter vtkXMLPPolyDataReader vtkXMLPPolyDataWriter vtkXMLPRectilinearGridReader vtkXMLPRectilinearGridWriter vtkXMLPStructuredDataReader vtkXMLPStructuredDataWriter vtkXMLPStructuredGridReader vtkXMLPStructuredGridWriter vtkXMLPTableReader vtkXMLPTableWriter vtkXMLPUniformGridAMRWriter vtkXMLPUnstructuredDataReader vtkXMLPUnstructuredDataWriter vtkXMLPUnstructuredGridReader vtkXMLPUnstructuredGridWriter vtkXMLParser vtkXMLPartitionedDataSetCollectionReader vtkXMLPartitionedDataSetCollectionWriter vtkXMLPartitionedDataSetReader vtkXMLPartitionedDataSetWriter vtkXMLReader vtkXMLReaderVersion vtkXMLRectilinearGridReader vtkXMLRectilinearGridWriter vtkXMLStructuredDataReader vtkXMLStructuredDataWriter vtkXMLStructuredGridReader vtkXMLStructuredGridWriter vtkXMLTableReader vtkXMLTableWriter vtkXMLTreeReader vtkXMLUniformGridAMRReader vtkXMLUniformGridAMRWriter vtkXMLUnstructuredDataReader vtkXMLUnstructuredDataWriter vtkXMLUtilities vtkXMLWriter vtkXMLWriter2 vtkXMLWriterBase vtkXOpenGLRenderWindow vtkXRenderWindowInteractor vtkXWebGPURenderWindow vtkXYPlotActor vtkXYPlotRepresentation vtkXYPlotWidget vtkXYZMolReader vtkXYZMolReader2 vtkXdmf3ArrayKeeper vtkXdmf3ArraySelection vtkXdmf3DataSet vtkXdmf3HeavyDataHandler vtkXdmf3LightDataHandler vtkXdmf3Reader vtkXdmf3SILBuilder vtkXdmf3Writer vtkXdmfArraySelection vtkXdmfDataArray vtkXdmfDocument vtkXdmfDomain vtkXdmfHeavyData vtkXdmfReader vtkXdmfReaderInternal vtkXdmfWriter vtkYieldCriteria vtkYoungsMaterialInterface vtkZLibDataCompressor vtkZSpaceCamera vtkZSpaceCoreCompatibilitySDKManager vtkZSpaceCoreSDKManager vtkZSpaceGenericRenderWindow vtkZSpaceHardwarePicker vtkZSpaceInteractorStyle vtkZSpaceRayActor vtkZSpaceRenderWindowInteractor vtkZSpaceRenderer vtkZSpaceSDKManager vtkZSpaceWin32RenderWindow vtkmAverageToCells vtkmAverageToPoints vtkmCleanGrid vtkmClip vtkmContour vtkmCoordinateSystemTransform vtkmDataArray vtkmDataSet vtkmExternalFaces vtkmExtractVOI vtkmFilterOverrides vtkmGradient vtkmHistogram vtkmImageConnectivity vtkmLevelOfDetail vtkmNDHistogram vtkmPointElevation vtkmPointTransform vtkmPolyDataNormals vtkmProbe vtkmSlice vtkmThreshold vtkmTriangleMeshPointNormals vtkmWarpScalar vtkmWarpVector"},{"location":"Python/Coverage/PythonVTKClassesUsed/","title":"VTK Classes used in the Examples","text":""},{"location":"Python/Coverage/PythonVTKClassesUsed/#python","title":"Python","text":"

Out of 3113 available VTK classes, 453 are demonstrated here.

"},{"location":"Python/Coverage/PythonVTKClassesUsed/#excluded-classes","title":"Excluded classes","text":"

These classes are excluded since they occur in the majority of the examples:

VTK Class VTK Class VTK Class vtkActor vtkCamera vtkNamedColors vtkPolyDataMapper vtkProperty vtkRenderer vtkRenderWindow vtkRenderWindowInteractor"},{"location":"Python/Coverage/PythonVTKClassesUsed/#classes-used","title":"Classes used","text":"VTK Class Examples vtk3DSImporter 3DSImporter vtkActor2D Actor2D Cell3DDemonstration CellTypeSource CurvaturesAdjustEdges CurvaturesDemo GeometricObjectsDemo GradientBackground IsoparametricCellsDemo LinearCellDemo MultiLineText ParametricObjectsDemo Planes PlatonicSolids PointDataSubdivision QuadraticHexahedronDemo QuadraticTetraDemo ReadDICOMSeries ReadLegacyUnstructuredGrid RescaleReverseLUT SourceObjectsDemo vtkAlgorithm TessellatedBoxSource vtkAMRBox OverlappingAMR vtkAnnotatedCubeActor AnatomicalOrientation AnnotatedCubeActor ColoredAnnotatedCube CompassWidget FroggieSurface FroggieView OrientationMarkerWidget vtkAnnotationLink ParallelCoordinatesExtraction SelectedGraphIDs vtkAppendFilter AppendFilter CameraModel1 ConnectivityFilter QuadricVisualization vtkAppendPolyData BlobbyLogo CameraModel2 CombinePolyData ProbeCombustor VelocityProfile WarpCombustor vtkArrowSource Arrow CurvatureBandsWithGlyphs ElevationBandsWithGlyphs EllipticalCylinderDemo GeometricObjectsDemo OrientedArrow OrientedGlyphs OutlineGlowPass ParametricObjectsDemo PointDataSubdivision RotationAroundLine vtkAxes Finance FinanceFieldData Rotations TensorAxes TextOrigin WalkCow vtkAxesActor AlignTwoPolyDatas AnatomicalOrientation Axes CallBack ColoredAnnotatedCube CSVReadEdit CSVReadEdit1 DisplayCoordinateAxes FroggieSurface FroggieView LayeredActors PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkAxis MultiplePlots vtkBalloonRepresentation BalloonWidget vtkBalloonWidget BalloonWidget vtkBandedPolyDataContourFilter ColoredAnnotatedCube CurvatureBandsWithGlyphs ElevationBandsWithGlyphs NamedColors vtkBillboardTextActor3D BillboardTextActor3D vtkBiQuadraticQuad IsoparametricCellsDemo vtkBiQuadraticQuadraticHexahedron IsoparametricCellsDemo vtkBiQuadraticQuadraticWedge IsoparametricCellsDemo vtkBiQuadraticTriangle IsoparametricCellsDemo vtkBMPReader ImageWarp vtkBMPWriter Hanoi ImageWriter vtkBooleanOperationPolyDataFilter BooleanOperationPolyDataFilter vtkBooleanTexture TextureCutQuadric vtkBox BooleanOperationImplicitFunctions vtkBoxWidget BoxWidget Tutorial_Step6 vtkBrownianPoints ParallelCoordinatesExtraction ParallelCoordinatesView vtkButterflySubdivisionFilter PointDataSubdivision SmoothMeshGrid vtkBYUReader AlignTwoPolyDatas BooleanOperationPolyDataFilter CapClip CellsInsideObject ClosedSurface Decimation GradientBackground Motor NormalsDemo Rotations SaveSceneToFieldData SaveSceneToFile Shadows WalkCow vtkCameraOrientationWidget AlignTwoPolyDatas CameraOrientationWidget CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges ElevationBandsWithGlyphs FroggieSurface FroggieView PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing SplineWidget vtkCameraPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Shadows ShadowsLightsDemo vtkCategoryLegend ReadLegacyUnstructuredGrid vtkCell CellTypeSource vtkCellArray Bottle CameraModel1 CameraModel2 CappedSphere Cell3DDemonstration ColoredLines ColoredTriangle ConstrainedDelaunay2D ContourWidget CreateESGrid CSVReadEdit CSVReadEdit1 Cube DataSetSurface DeformPointSet EllipticalCylinder EllipticalCylinderDemo GradientBackground Hexahedron IterateOverLines IterativeClosestPoints KochSnowflake LinearCellDemo LineOnMesh LongLine MultiLineText NOVCAGraph Point Polygon PolyLine PolyLine1 Pyramid Quad RuledSurfaceFilter SingleSplat SmoothMeshGrid SolidColoredTriangle Spring Tetrahedron Triangle TriangleColoredPoints TriangleCornerVertices TriangleStrip Vertex WarpVector WriteTriangleToFile vtkCellLocator LineOnMesh vtkCellPicker CellPicking vtkCellTypes CellTypeSource ClipDataSetWithPolyData ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ReadLegacyUnstructuredGrid vtkCellTypeSource CellTypeSource vtkChart MultiplePlots ScatterPlot vtkChartXY MultiplePlots ScatterPlot vtkChartXYZ SurfacePlot vtkCircularLayoutStrategy LabelVerticesAndEdges vtkCleanPolyData BooleanOperationPolyDataFilter CombinePolyData CurvatureBandsWithGlyphs CurvaturesDemo ElevationBandsWithGlyphs LineOnMesh PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision SmoothMeshGrid vtkClipDataSet ClipDataSetWithPolyData ClipDataSetWithPolyData1 ClipUnstructuredGridWithPlane2 TissueLens vtkClipPolyData CapClip ClipSphereCylinder CreateBFont ImplicitPlaneWidget2 PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing SolidClip vtkCollisionDetectionFilter CollisionDetection vtkColor3ub PointDataSubdivision vtkColorSeries CellTypeSource ColoredAnnotatedCube ColorSeriesPatches CreateColorSeriesDemo CurvatureBandsWithGlyphs Curvatures ElevationBandsWithGlyphs Hawaii LUTUtilities PointDataSubdivision ShareCamera TensorEllipsoids vtkColorTransferFunction AssignCellColorsFromLUT CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo DisplacementPlot ElevationBandsWithGlyphs MedicalDemo4 MeshLabelImageColor PointDataSubdivision SimpleRayCast VTKWithNumpy vtkCommand BillboardTextActor3D CompassWidget ContourWidget FroggieView ImplicitPlaneWidget2 ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing QuadraticHexahedronDemo QuadraticTetraDemo SplineWidget vtkCompassRepresentation CompassWidget vtkCompassWidget CompassWidget vtkCompositeDataDisplayAttributes CompositePolyDataMapper vtkCompositeDataGeometryFilter MultiBlockDataSet OverlappingAMR ReadExodusData vtkCompositePolyDataMapper CompositePolyDataMapper vtkCone IceCream vtkConeSource BoxWidget CallBack CameraBlur CameraModel1 CameraModel2 CarotidFlowGlyphs ClampGlyphSizes ClipDataSetWithPolyData ClipDataSetWithPolyData1 ColoredAnnotatedCube ColorMapToLUT ColorMapToLUT_JSON ColorMapToLUT_XML CombinePolyData Cone Cone3 Cone4 GeometricObjectsDemo GlyphTable GradientBackground HyperStreamline Mace Model MultipleRenderWindows MultipleViewports NamedColors Outline PointDataSubdivision ProgrammableGlyphFilter ResetCameraOrientation ShadowsLightsDemo ShareCamera SingleSplat SourceObjectsDemo SpikeFran TensorAxes TensorEllipsoids TransparentBackground Tutorial_Step1 Tutorial_Step2 Tutorial_Step3 Tutorial_Step4 Tutorial_Step5 Tutorial_Step6 vtkConnectivityFilter Blow ConnectivityFilter PineRootConnectivity PineRootDecimation vtkContextActor MultiplePlots vtkContextMouseEvent SurfacePlot vtkContextScene MultiplePlots vtkContextTransform ReadLegacyUnstructuredGrid vtkContextView ReadLegacyUnstructuredGrid ScatterPlot SurfacePlot vtkContourFilter BlobbyLogo Blow BooleanOperationImplicitFunctions CameraModel1 CameraModel2 CarotidFlow CarotidFlowGlyphs CombustorIsosurface ContourQuadric CutWithScalars DisplayQuadricSurfaces Finance FlatVersusGouraud FlyingHeadSlice GaussianSplat HeadSlice Hello IceCream ImplicitQuadric ImplicitSphere ImplicitSphere1 IronIsoSurface Lorenz MarchingCases OverlappingAMR PerlinNoise ProbeCombustor PseudoVolumeRendering QuadricVisualization ReadSLC SampleFunction SingleSplat SplatFace Vol vtkContourTriangulator ContourTriangulator vtkContourWidget ContourWidget vtkConvexPointSet ConvexPointSet vtkCoordinate GradientBackground MultiLineText vtkCubeAxesActor CubeAxesActor vtkCubeSource CameraModel1 CameraModel2 ColoredAnnotatedCube Cube1 CurvaturesAdjustEdges Cutter GeometricObjectsDemo Glyph3D GlyphTable LayeredActors MarchingCases Model MultipleRenderWindows MultipleViewports OrientationMarkerWidget PBR_Clear_Coat PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ProgrammableGlyphFilter Shadows ShadowsLightsDemo ShareCamera ShrinkCube SourceObjectsDemo TransparentBackground vtkCubicLine IsoparametricCellsDemo vtkCurvatures CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo vtkCutter CutStructuredGrid Cutter CutWithCutFunction DataSetSurface ExtractPolyLinesFromPolyData FilledPolygon PolyDataContourToImageData PolyDataToImageDataStencil PseudoVolumeRendering vtkCylinder ClipSphereCylinder IsosurfaceSampling vtkCylinderSource Cylinder CylinderExample FlatVersusGouraud GeometricObjectsDemo Hanoi MultipleRenderWindows MultipleViewports OrientedCylinder RescaleReverseLUT ShareCamera SourceObjectsDemo SplineWidget vtkDataObject CellsInsideObject GenerateCubesFromLabels GenerateModelsFromLabels HardwareSelector OfficeTube SpiderPlot vtkDataObjectReader FinanceFieldData vtkDataObjectToDataSetFilter FinanceFieldData vtkDataSetAttributes GenerateCubesFromLabels GenerateModelsFromLabels vtkDataSetMapper AlignTwoPolyDatas AppendFilter BlankPoint Blow CameraModel1 CameraModel2 CapClip Cell3DDemonstration CellPicking CellsInsideObject CellTypeSource ClipDataSetWithPolyData ClipDataSetWithPolyData1 ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ColoredSphere ConnectivityFilter ContourTriangulator ConvexPointSet CreateESGrid CutStructuredGrid DataSetSurface DisplacementPlot ExponentialCosine ExtractData ExtractSelection ExtractSelectionCells Hawaii Hexahedron HyperTreeGridSource ImageWarp IsoparametricCellsDemo LinearCellDemo LoadESGrid LoopShrink Motor OrientationMarkerWidget1 ParallelCoordinatesExtraction PineRootDecimation PlateVibration PointDataSubdivision Polyhedron Pyramid QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo QuadricVisualization ReadImageData ReadLegacyUnstructuredGrid ReadUnstructuredGrid RectilinearGrid ScalarBarWidget ShrinkCube TessellatedBoxSource Tetrahedron TextureCutQuadric TextureCutSphere TextureThreshold TissueLens TransformSphere TriangleStrip UGrid VisualizeRectilinearGrid WarpTo vtkDataSetReader Blow Office OfficeTube vtkDataSetSurfaceFilter DataSetSurface vtkDecimatePro DecimateFran DecimateHawaii Decimation FroggieSurface PineRootDecimation StripFran vtkDeformPointSet DeformPointSet vtkDelaunay2D ColoredElevationMap ConstrainedDelaunay2D CurvatureBandsWithGlyphs CurvaturesAdjustEdges Delaunay2D DelaunayMesh ElevationBandsWithGlyphs TriangulateTerrainMap vtkDelaunay3D ConnectivityFilter vtkDelimitedTextReader CSVReadEdit1 PointInterpolator vtkDICOMImageReader MarchingCubes ReadDICOM ReadDICOMSeries vtkDiscreteFlyingEdges3D DiscreteMarchingCubes GenerateModelsFromLabels MeshLabelImageColor vtkDiscreteMarchingCubes DiscreteMarchingCubes GenerateModelsFromLabels MeshLabelImageColor SmoothDiscreteMarchingCubes vtkDiscretizableColorTransferFunction ColorMapToLUT ColorMapToLUT_JSON ColorMapToLUT_XML RescaleReverseLUT TransientHDFReader vtkDiskSource BoundaryEdges Disk GeometricObjectsDemo SourceObjectsDemo vtkDoubleArray CurvatureBandsWithGlyphs CurvaturesAdjustEdges CutWithScalars EdgeWeights ElevationBandsWithGlyphs ExponentialCosine LabelVerticesAndEdges RectilinearGrid RGrid SGrid SingleSplat StippledLine TextureCutSphere VisualizeRectilinearGrid Vol WarpVector vtkEarthSource EarthSource vtkElevationFilter ClampGlyphSizes ColoredAnnotatedCube ColoredSphere ColorMapToLUT ColorMapToLUT_JSON ColorMapToLUT_XML CurvatureBandsWithGlyphs DeformPointSet ElevationBandsWithGlyphs GlyphTable Hawaii LoopShrink NamedColors ParallelCoordinatesExtraction ParallelCoordinatesView PointDataSubdivision ProgrammableGlyphs RescaleReverseLUT TransformSphere vtkExodusIIReader ReadExodusData vtkExplicitStructuredGrid CreateESGrid vtkExplicitStructuredGridToUnstructuredGrid CreateESGrid vtkExtractEdges DelaunayMesh MarchingCases MultiBlockDataSet ReadLegacyUnstructuredGrid vtkExtractGeometry ExtractData vtkExtractGrid PseudoVolumeRendering vtkExtractSelection CellPicking ExtractSelection ExtractSelectionCells ParallelCoordinatesExtraction vtkExtractVOI FlyingHeadSlice HeadSlice MeshLabelImageColor QuadricVisualization vtkFeatureEdges BoundaryEdges CapClip ClosedSurface CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo FilledPolygon vtkFieldDataToAttributeDataFilter FinanceFieldData vtkFixedPointVolumeRayCastMapper MedicalDemo4 SimpleRayCast VTKWithNumpy vtkFloatArray ClipDataSetWithPolyData ClipDataSetWithPolyData1 CreateColorSeriesDemo Cube CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs Finance ImplicitPolyDataDistance MarchingCases Motor MultiplePlots OverlappingAMR PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ScaleVertices ScatterPlot SpiderPlot SurfacePlot vtkFlyingEdges2D FlyingHeadSlice vtkFlyingEdges3D ExtractLargestIsosurface FrogBrain FroggieSurface HeadBone IsosurfaceSampling MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 TissueLens vtkFollower FinanceFieldData Stocks TextOrigin vtkForceDirectedLayoutStrategy ConstructGraph EdgeWeights RandomGraphSource ScaleVertices vtkFrustumSource Frustum vtkGaussianKernel PointInterpolator vtkGaussianSplatter Finance FinanceFieldData GaussianSplat SingleSplat SplatFace vtkGenericCell QuadraticHexahedronDemo QuadraticTetraDemo ReadLegacyUnstructuredGrid vtkGeometryFilter Blow GenerateCubesFromLabels GenerateModelsFromLabels vtkGlyph2D Glyph2D vtkGlyph3D AnimateVectors CameraBlur CarotidFlowGlyphs ClampGlyphSizes CurvatureBandsWithGlyphs DelaunayMesh ElevationBandsWithGlyphs Glyph3D GlyphTable Mace MarchingCases OrientedGlyphs ParametricObjectsDemo PointDataSubdivision QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo SpikeFran VisualizeDirectedGraph vtkGlyph3DMapper AppendFilter ConvexPointSet InteractorStyleTrackballCamera IsoparametricCellsDemo LinearCellDemo ReadLegacyUnstructuredGrid vtkGlyphSource2D VisualizeDirectedGraph vtkGraphLayout VisualizeDirectedGraph vtkGraphLayoutView ColorEdges ColorVertexLabels ColorVerticesLookupTable ConstructGraph ConstructTree CreateTree EdgeWeights LabelVerticesAndEdges RandomGraphSource ScaleVertices SelectedGraphIDs SelectedVerticesAndEdges SideBySideGraphs VisualizeDirectedGraph VisualizeGraph vtkGraphToGlyphs ScaleVertices vtkGraphToPolyData GraphToPolyData VisualizeDirectedGraph vtkHardwareSelector HardwareSelector vtkHausdorffDistancePointSetFilter AlignTwoPolyDatas vtkHDFReader TransientHDFReader vtkHDRReader HDRReader PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkHedgeHog ComplexV SGrid vtkHexagonalPrism Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkHexahedron Cell3DDemonstration DataSetSurface Hexahedron LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkHull Planes vtkHyperStreamline HyperStreamline vtkHyperTreeGridSource HyperTreeGridSource vtkHyperTreeGridToUnstructuredGrid HyperTreeGridSource vtkIdFilter CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo vtkIdList Cell3DDemonstration Cube CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo ExtractPolyLinesFromPolyData IterateOverLines MarchingCases PineRootConnectivity PineRootDecimation Polyhedron vtkIdTypeArray CellPicking ExtractSelection ExtractSelectionCells vtkImageAccumulate GenerateModelsFromLabels vtkImageActor Attenuation BackgroundImage Cast EnhanceEdges GaussianSmooth HybridMedianComparison IdealHighPass ImageNormalize ImageWeightedSum MedianComparison MedicalDemo3 MorphologyComparison Pad VTKSpectrum vtkImageAppend PolyDataToImageDataStencil vtkImageButterworthHighPass IdealHighPass vtkImageCanvasSource2D BackgroundImage ImageDataGeometryFilter vtkImageCast Attenuation Cast EnhanceEdges GaussianSmooth HybridMedianComparison ImageGradient ImageNormalize ImageWeightedSum MedianComparison vtkImageConstantPad FrogSlice ImageGradient Pad vtkImageData DiscreteMarchingCubes HybridMedianComparison MarchingCubes MedianComparison PointInterpolator PolyDataContourToImageData PseudoVolumeRendering SmoothDiscreteMarchingCubes StippledLine WriteReadVtkImageData vtkImageDataGeometryFilter CreateBFont HyperStreamline ImageDataGeometryFilter ImageWarp TensorAxes TensorEllipsoids WriteReadVtkImageData vtkImageDilateErode3D MorphologyComparison vtkImageEuclideanToPolar ImageGradient vtkImageExtractComponents IdealHighPass ImageGradient vtkImageFFT IdealHighPass VTKSpectrum vtkImageFlip PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkImageFourierCenter VTKSpectrum vtkImageGaussianSmooth Attenuation CreateBFont FrogBrain FroggieSurface GaussianSmooth ImageGradient IsoSubsample MedianComparison vtkImageGradient ClampGlyphSizes GlyphTable ImageGradient ParallelCoordinatesExtraction ParallelCoordinatesView vtkImageHSVToRGB ImageGradient vtkImageHybridMedian2D HybridMedianComparison vtkImageIdealHighPass IdealHighPass vtkImageImport VTKWithNumpy vtkImageIslandRemoval2D FroggieSurface vtkImageLaplacian EnhanceEdges vtkImageLogarithmicScale VTKSpectrum vtkImageLuminance ImageWarp vtkImageMagnify ImageGradient vtkImageMagnitude VTKSpectrum vtkImageMandelbrotSource Cast ImageWeightedSum vtkImageMapToColors MedicalDemo3 VTKSpectrum vtkImageMapToWindowLevelColors EnhanceEdges IdealHighPass Pad vtkImageMarchingCubes IsoSubsample vtkImageMathematics Attenuation DiscreteMarchingCubes EnhanceEdges HybridMedianComparison MedianComparison SmoothDiscreteMarchingCubes vtkImageMedian3D HybridMedianComparison MedianComparison vtkImageMirrorPad Pad vtkImageNoiseSource HybridMedianComparison MedianComparison vtkImageNormalize ImageNormalize vtkImageReader2Factory Attenuation EnhanceEdges GaussianSmooth HybridMedianComparison IdealHighPass IsoSubsample MedianComparison MorphologyComparison Pad PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing TexturePlane VTKSpectrum vtkImageRFFT IdealHighPass vtkImageSeedConnectivity MorphologyComparison vtkImageShiftScale Attenuation vtkImageShrink3D FroggieSurface IsoSubsample vtkImageSinusoidSource ImageNormalize ImageWeightedSum vtkImageStencil PolyDataContourToImageData PolyDataToImageDataStencil vtkImageThreshold DiscreteMarchingCubes FrogBrain FroggieSurface HybridMedianComparison MedianComparison SmoothDiscreteMarchingCubes vtkImageViewer HDRReader ImageGradient PolyDataToImageDataStencil vtkImageViewer2 ReadDICOM ReadDICOMSeries vtkImageWeightedSum ImageWeightedSum SumVTKImages vtkImageWrapPad GenerateCubesFromLabels vtkImplicitBoolean BooleanOperationImplicitFunctions ClipSphereCylinder ExtractData IceCream vtkImplicitModeller BlobbyLogo CameraModel1 CameraModel2 Hello vtkImplicitPlaneRepresentation ImplicitPlaneWidget2 vtkImplicitPlaneWidget2 ImplicitPlaneWidget2 vtkImplicitPolyDataDistance ClipDataSetWithPolyData ClipDataSetWithPolyData1 ImplicitPolyDataDistance vtkImplicitTextureCoords Motor TextureCutQuadric TextureCutSphere vtkIntArray CellTypeSource ColorEdges ColorVertexLabels ColorVerticesLookupTable KochSnowflake LabelVerticesAndEdges NOVCAGraph ScaleVertices vtkInteractorStyleImage Attenuation Cast EnhanceEdges GaussianSmooth Glyph2D HybridMedianComparison IdealHighPass MedianComparison MorphologyComparison Pad ReadDICOMSeries VTKSpectrum vtkInteractorStyleRubberBandPick CreateESGrid LoadESGrid vtkInteractorStyleTrackballActor InteractorStyleTrackballActor vtkInteractorStyleTrackballCamera CellPicking ClampGlyphSizes ColorMapToLUT ColorMapToLUT_JSON ColorMapToLUT_XML CompassWidget CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs EllipticalCylinder EllipticalCylinderDemo FroggieSurface FroggieView GlyphTable GradientBackground HardwareSelector HighlightPickedActor HighlightWithSilhouette InteractorStyleTrackballCamera LayeredActors MouseEvents MouseEventsObserver MultipleRenderWindows PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing RescaleReverseLUT ResetCameraOrientation SplineWidget StreamLines TextOrigin TransientHDFReader Tutorial_Step5 Tutorial_Step6 vtkIterativeClosestPointTransform AlignTwoPolyDatas IterativeClosestPoints vtkJPEGReader BackgroundImage SphereTexture vtkJPEGWriter Hanoi ImageWriter PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkLabeledDataMapper IsoparametricCellsDemo LinearCellDemo ReadLegacyUnstructuredGrid vtkLandmarkTransform AlignTwoPolyDatas vtkLight AmbientSpheres DiffuseSpheres PBR_Clear_Coat PBR_Mapping Shadows ShadowsLightsDemo SpecularSpheres vtkLightActor ShadowsLightsDemo vtkLightsPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkLine CappedSphere ColoredLines IterateOverLines LinearCellDemo LongLine RuledSurfaceFilter WarpVector WriteLegacyLinearCells WriteXMLLinearCells vtkLinearExtrusionFilter AlphaFrequency EllipticalCylinder EllipticalCylinderDemo PolyDataContourToImageData Stocks vtkLinearSubdivisionFilter CurvaturesAdjustEdges PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkLineSource AnimateVectors BluntStreamlines GeometricObjectsDemo Kitchen Line SourceObjectsDemo StippledLine TubeFilter WarpTo vtkLineWidget StreamlinesWithLineWidget vtkLODActor CameraModel1 CameraModel2 MeshLabelImageColor vtkLogLookupTable HyperStreamline vtkLookupTable AssignCellColorsFromLUT Blow CarotidFlow CarotidFlowGlyphs CellTypeSource ColoredAnnotatedCube ColoredElevationMap ColorEdges ColorVerticesLookupTable ComplexV CreateColorSeriesDemo CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo DiscreteMarchingCubes DisplacementPlot ElevationBandsWithGlyphs FrogBrain FroggieSurface FroggieView FrogSlice Hawaii KochSnowflake LOx LOxGrid LOxSeeds LUTUtilities MedicalDemo3 MeshLabelImageColor NamedColors ParallelCoordinatesExtraction PlatonicSolids PseudoVolumeRendering Rainbow ReadLegacyUnstructuredGrid ScalarBarWidget ScaleVertices SmoothDiscreteMarchingCubes TensorAxes TensorEllipsoids TissueLens TransformSphere vtkLoopSubdivisionFilter LineOnMesh SmoothMeshGrid vtkMarchingContourFilter FinanceFieldData vtkMarchingCubes ExtractLargestIsosurface FrogBrain FroggieSurface HeadBone IsosurfaceSampling MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 TissueLens vtkMarchingSquares ContourTriangulator vtkMaskFields GenerateModelsFromLabels vtkMaskPoints CarotidFlowGlyphs CurvatureBandsWithGlyphs ElevationBandsWithGlyphs ParametricObjectsDemo PointDataSubdivision SpikeFran SplatFace vtkMaskPolyData StripFran vtkMath CompassWidget DistanceBetweenPoints EllipticalCylinder EllipticalCylinderDemo OrientedArrow OrientedCylinder ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo SGrid vtkMatrix4x4 CollisionDetection EllipticalCylinderDemo FroggieSurface FroggieView FrogSlice OrientedArrow OrientedCylinder vtkMCubesReader PineRootConnectivity PineRootDecimation vtkMergeFilter ImageWarp vtkMergePoints HeadBone vtkMetaImageReader FlyingHeadSlice FrogBrain FroggieSurface FrogSlice GenerateCubesFromLabels GenerateModelsFromLabels HeadBone HeadSlice ImageGradient MedicalDemo1 MedicalDemo2 MedicalDemo3 MedicalDemo4 MeshLabelImageColor TissueLens vtkMetaImageWriter PolyDataContourToImageData vtkMinimalStandardRandomSequence BillboardTextActor3D CellTypeSource ColoredElevationMap ConstrainedDelaunay2D DelaunayMesh DiscreteMarchingCubes EllipticalCylinderDemo Hanoi HighlightPickedActor HighlightWithSilhouette Lorenz OrientedArrow OrientedCylinder ParametricObjectsDemo QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo SmoothDiscreteMarchingCubes SmoothMeshGrid SpiderPlot TriangulateTerrainMap vtkMultiBlockDataSet CellsInsideObject CompositePolyDataMapper MultiBlockDataSet vtkMultiBlockPLOT3DReader BluntStreamlines CombustorIsosurface CutStructuredGrid LOx LOxGrid LOxSeeds ProbeCombustor PseudoVolumeRendering Rainbow ReadPLOT3D StreamLines StreamlinesWithLineWidget TextureThreshold VelocityProfile WarpCombustor vtkMultiThreshold CellsInsideObject vtkMutableDirectedGraph ColorEdges ColorVertexLabels ColorVerticesLookupTable ConstructTree CreateTree EdgeWeights VisualizeDirectedGraph VisualizeGraph vtkMutableUndirectedGraph ConstructGraph GraphToPolyData LabelVerticesAndEdges ScaleVertices SideBySideGraphs vtkNew ColorMapToLUT_JSON ColorMapToLUT_XML vtkOBBTree AlignTwoPolyDatas vtkOBJReader AlignTwoPolyDatas BooleanOperationPolyDataFilter CapClip CellsInsideObject ClosedSurface Decimation FlatVersusGouraud GradientBackground NormalsDemo Rotations SaveSceneToFieldData SaveSceneToFile Shadows vtkOpaquePass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ShadowsLightsDemo vtkOpenGLRayCastImageDisplayHelper SimpleRayCast VTKWithNumpy vtkOpenGLRenderer PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat ShadowsLightsDemo vtkOpenGLSkybox PBR_Anisotropy PBR_Materials PBR_Materials_Coat vtkOrientationMarkerWidget AlignTwoPolyDatas AnatomicalOrientation CallBack ColoredAnnotatedCube CSVReadEdit CSVReadEdit1 DisplayCoordinateAxes FroggieSurface FroggieView OrientationMarkerWidget OrientationMarkerWidget1 PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkOrientedGlyphContourRepresentation ContourWidget vtkOutlineFilter AnimateVectors CallBack CarotidFlow CarotidFlowGlyphs ComplexV ContourQuadric DisplayQuadricSurfaces ExtractData FlyingHeadSlice HeadBone HeadSlice HyperStreamline IronIsoSurface MedicalDemo1 MedicalDemo2 MedicalDemo3 Outline OverlappingAMR ParallelCoordinatesExtraction PineRootConnectivity PineRootDecimation PlateVibration ProbeCombustor QuadricVisualization ReadSLC SampleFunction SingleSplat TensorAxes TensorEllipsoids vtkOutlineGlowPass OutlineGlowPass vtkOverlappingAMR OverlappingAMR vtkOverlayPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkParallelCoordinatesRepresentation ParallelCoordinatesExtraction ParallelCoordinatesView vtkParallelCoordinatesView ParallelCoordinatesExtraction ParallelCoordinatesView vtkParametricBohemianDome ParametricObjectsDemo vtkParametricBour CurvaturesAdjustEdges ParametricObjectsDemo vtkParametricBoy ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricCatalanMinimal ParametricObjectsDemo vtkParametricConicSpiral ParametricObjectsDemo vtkParametricCrossCap ParametricObjectsDemo vtkParametricDini ParametricObjectsDemo vtkParametricEllipsoid ParametricObjectsDemo PointDataSubdivision vtkParametricEnneper CurvaturesAdjustEdges ParametricObjectsDemo vtkParametricFigure8Klein ParametricObjectsDemo vtkParametricFunctionSource CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs LineOnMesh ParametricKuenDemo ParametricObjectsDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricHenneberg ParametricObjectsDemo vtkParametricKlein ParametricObjectsDemo vtkParametricKuen ParametricKuenDemo ParametricObjectsDemo vtkParametricMobius CurvaturesAdjustEdges ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricPluckerConoid ParametricObjectsDemo vtkParametricPseudosphere ParametricObjectsDemo vtkParametricRandomHills CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricRoman ParametricObjectsDemo vtkParametricSpline LineOnMesh ParametricObjectsDemo vtkParametricSuperEllipsoid ParametricObjectsDemo ParametricSuperEllipsoidDemo vtkParametricSuperToroid ParametricObjectsDemo ParametricSuperToroidDemo vtkParametricTorus CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkPentagonalPrism Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPerlinNoise PerlinNoise vtkPiecewiseFunction MedicalDemo4 SimpleRayCast VTKWithNumpy vtkPixel LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPlane CapClip ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 CutStructuredGrid Cutter CutWithCutFunction CutWithScalars DataSetSurface ExtractPolyLinesFromPolyData FilledPolygon IceCream ImplicitPlaneWidget2 PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PolyDataContourToImageData PolyDataToImageDataStencil PseudoVolumeRendering SolidClip vtkPlanes Frustum Motor Planes TextureCutSphere vtkPlanesIntersection PlanesIntersection vtkPlaneSource AnatomicalOrientation AssignCellColorsFromLUT CellPicking ClipSphereCylinder CreateColorSeriesDemo CurvatureBandsWithGlyphs ElevationBandsWithGlyphs ExponentialCosine FrogSlice Hanoi Plane ProbeCombustor ProgrammableGlyphs ShadowsLightsDemo SourceObjectsDemo StreamLines TexturePlane vtkPlatonicSolidSource PlatonicSolids vtkPlotPoints MultiplePlots ScatterPlot vtkPlotSurface SurfacePlot vtkPLYReader AlignTwoPolyDatas BooleanOperationPolyDataFilter CapClip CellsInsideObject ClosedSurface Decimation GradientBackground MotionBlur NormalsDemo Rotations SaveSceneToFieldData SaveSceneToFile Shadows WritePLY vtkPLYWriter WritePLY vtkPNGReader ContourTriangulator DecimateFran PBR_Clear_Coat PBR_Mapping PolyDataToImageDataStencil vtkPNGWriter Cell3DDemonstration Hanoi ImageWriter ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision PolyDataContourToImageData Screenshot WalkCow vtkPNMReader CreateBFont vtkPNMWriter Hanoi ImageWriter vtkPointGaussianMapper PointInterpolator vtkPointInterpolator PointInterpolator vtkPointLoad HyperStreamline TensorAxes TensorEllipsoids vtkPoints Actor2D AlignTwoPolyDatas AppendFilter BlankPoint Bottle CameraModel1 CameraModel2 CappedSphere Cell3DDemonstration CellTypeSource ColoredElevationMap ColoredLines ColoredTriangle ColorVerticesLookupTable ConstrainedDelaunay2D ContourWidget ConvexPointSet CreateESGrid CSVReadEdit Cube CurvatureBandsWithGlyphs CurvaturesAdjustEdges DataSetSurface DeformPointSet Delaunay2D DelaunayMesh ElevationBandsWithGlyphs EllipticalCylinder EllipticalCylinderDemo ExponentialCosine Finance Glyph2D Glyph3D GradientBackground GraphToPolyData Hexahedron ImplicitPolyDataDistance IterateOverLines IterativeClosestPoints KochSnowflake LinearCellDemo LineOnMesh LongLine MarchingCases Motor MultiLineText NOVCAGraph ParametricObjectsDemo PlanesIntersection Point Polygon PolygonIntersection Polyhedron PolyLine PolyLine1 ProgrammableGlyphFilter Pyramid Quad QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo RuledSurfaceFilter SGrid SideBySideGraphs SingleSplat SmoothMeshGrid SolidColoredTriangle Spring Tetrahedron TextureCutSphere Triangle TriangleColoredPoints TriangleCorners TriangleCornerVertices TriangleStrip TriangulateTerrainMap UGrid Vertex VertexGlyphFilter WarpVector WriteLegacyLinearCells WriteTriangleToFile WriteXMLLinearCells vtkPointSource AppendFilter CarotidFlow ExtractSelection InteractorStyleTrackballCamera LOx LOxGrid LOxSeeds NOVCAGraph Office PointSize PointSource SourceObjectsDemo vtkPolyData Actor2D AlignTwoPolyDatas AppendFilter AssignCellColorsFromLUT BooleanOperationPolyDataFilter Bottle CameraModel1 CameraModel2 CapClip CappedSphere ColoredElevationMap ColoredLines ColoredTriangle CombinePolyData ConstrainedDelaunay2D ContourWidget ConvexPointSet CSVReadEdit Cube CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo Decimation DeformPointSet Delaunay2D DelaunayMesh ElevationBandsWithGlyphs EllipticalCylinder EllipticalCylinderDemo ExponentialCosine FilledPolygon GaussianSplat GenerateModelsFromLabels GetValues Glyph2D Glyph3D GradientBackground ImplicitPolyDataDistance InteractorStyleTrackballCamera IterateOverLines IterativeClosestPoints KochSnowflake LineOnMesh LongLine MultiLineText NormalsDemo OrientedGlyphs PineRootConnectivity PineRootDecimation Planes Point Polygon PolyLine PolyLine1 ProgrammableGlyphFilter Quad RenameArray RuledSurfaceFilter SingleSplat SmoothMeshGrid SolidColoredTriangle Spring StreamlinesWithLineWidget Triangle TriangleColoredPoints TriangleCorners TriangleCornerVertices TriangleStrip TriangulateTerrainMap Vertex VertexGlyphFilter WarpVector WriteTriangleToFile vtkPolyDataConnectivityFilter ExtractLargestIsosurface PineRootConnectivity vtkPolyDataMapper2D Actor2D GradientBackground MultiLineText vtkPolyDataNormals BlobbyLogo Blow CombustorIsosurface CurvatureBandsWithGlyphs CurvaturesAdjustEdges DecimateFran DecimateHawaii DisplacementPlot ElevationBandsWithGlyphs FrogBrain FroggieSurface FroggieView FrogSlice MeshLabelImageColor Motor NormalsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PlateVibration PointDataSubdivision PseudoVolumeRendering ShadowsLightsDemo SpikeFran SplatFace Spring StripFran TensorEllipsoids VelocityProfile WarpCombustor vtkPolyDataReader AlignTwoPolyDatas BlobbyLogo BooleanOperationPolyDataFilter CellsInsideObject ClosedSurface DecimateFran DecimateHawaii Decimation DisplacementPlot FroggieView GradientBackground Hawaii Hello PlateVibration SpikeFran SplatFace Stocks StripFran vtkPolyDataSilhouette HighlightWithSilhouette vtkPolyDataTangents CurvaturesAdjustEdges PBR_Anisotropy PBR_Clear_Coat PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkPolyDataToImageStencil PolyDataContourToImageData PolyDataToImageDataStencil vtkPolyDataWriter AlignTwoPolyDatas vtkPolygon ConstrainedDelaunay2D LinearCellDemo Polygon PolygonIntersection WriteLegacyLinearCells WriteXMLLinearCells vtkPolyhedron Dodecahedron vtkPolyLine CSVReadEdit CSVReadEdit1 EllipticalCylinder EllipticalCylinderDemo GradientBackground KochSnowflake LinearCellDemo PolyLine WriteLegacyLinearCells WriteXMLLinearCells vtkPolyVertex LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPostScriptWriter Hanoi ImageWriter vtkProbeFilter IsosurfaceSampling ProbeCombustor TissueLens vtkProgrammableGlyphFilter ProgrammableGlyphFilter ProgrammableGlyphs vtkProp3D OrientedArrow OrientedCylinder vtkPropAssembly AnatomicalOrientation ColoredAnnotatedCube FroggieSurface FroggieView vtkPropPicker HighlightPickedActor HighlightWithSilhouette vtkPyramid Cell3DDemonstration LinearCellDemo Pyramid WriteLegacyLinearCells WriteXMLLinearCells vtkQuad LinearCellDemo Quad WriteLegacyLinearCells WriteXMLLinearCells vtkQuadraticEdge IsoparametricCellsDemo vtkQuadraticHexahedron IsoparametricCellsDemo QuadraticHexahedron QuadraticHexahedronDemo vtkQuadraticLinearQuad IsoparametricCellsDemo vtkQuadraticLinearWedge IsoparametricCellsDemo vtkQuadraticPolygon IsoparametricCellsDemo vtkQuadraticPyramid IsoparametricCellsDemo vtkQuadraticQuad IsoparametricCellsDemo vtkQuadraticTetra IsoparametricCellsDemo QuadraticTetra QuadraticTetraDemo vtkQuadraticTriangle IsoparametricCellsDemo vtkQuadraticWedge IsoparametricCellsDemo vtkQuadric ContourQuadric DisplayQuadricSurfaces ExtractData FlatVersusGouraud ImplicitQuadric QuadricVisualization TextureCutQuadric vtkRandomGraphSource RandomGraphSource SelectedGraphIDs SelectedVerticesAndEdges vtkRectf SurfacePlot vtkRectilinearGrid ClipDataSetWithPolyData ClipDataSetWithPolyData1 RectilinearGrid RGrid VisualizeRectilinearGrid vtkRectilinearGridGeometryFilter ClipDataSetWithPolyData ClipDataSetWithPolyData1 RGrid vtkRegularPolygonSource BalloonWidget Circle GeometricObjectsDemo Glyph2D RegularPolygonSource vtkRenderedGraphRepresentation ColorVertexLabels ScaleVertices vtkRenderLargeImage PointDataSubdivision vtkRenderPassCollection PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Shadows ShadowsLightsDemo vtkRenderStepsPass MotionBlur OutlineGlowPass vtkResampleWithDataSet PointInterpolator vtkReverseSense CurvatureBandsWithGlyphs ElevationBandsWithGlyphs vtkRibbonFilter Stocks StreamlinesWithLineWidget vtkRotationalExtrusionFilter Bottle CameraModel1 CameraModel2 CappedSphere Spring vtkRTAnalyticSource ClampGlyphSizes GlyphTable ParallelCoordinatesExtraction ParallelCoordinatesView vtkRuledSurfaceFilter RuledSurfaceFilter vtkRungeKutta4 OfficeTube StreamlinesWithLineWidget vtkSampleFunction Attenuation BooleanOperationImplicitFunctions ContourQuadric DiscreteMarchingCubes DisplayQuadricSurfaces ExtractData FlatVersusGouraud IceCream ImplicitQuadric ImplicitSphere ImplicitSphere1 IsosurfaceSampling PerlinNoise QuadricVisualization SampleFunction SmoothDiscreteMarchingCubes vtkScalarBarActor CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs RescaleReverseLUT ScalarBarWidget vtkScalarBarWidget ScalarBarWidget vtkSelectEnclosedPoints CellsInsideObject vtkSelection CellPicking ExtractSelection ExtractSelectionCells vtkSelectionNode CellPicking ExtractSelection ExtractSelectionCells vtkSequencePass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Shadows ShadowsLightsDemo vtkShadowMapPass Shadows ShadowsLightsDemo vtkShortArray Lorenz vtkShrinkFilter CellTypeSource ExtractData HyperTreeGridSource LoopShrink ReadLegacyUnstructuredGrid ShrinkCube TessellatedBoxSource VisualizeRectilinearGrid vtkShrinkPolyData Frustum MarchingCases RegularPolygonSource vtkSimple2DLayoutStrategy SelectedGraphIDs VisualizeDirectedGraph vtkSimpleMotionBlurPass MotionBlur vtkSkybox PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkSLCReader ReadSLC vtkSliderRepresentation2D FroggieView ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing QuadraticHexahedronDemo QuadraticTetraDemo vtkSliderWidget FroggieView ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing QuadraticHexahedronDemo QuadraticTetraDemo vtkSphere Attenuation BooleanOperationImplicitFunctions ClipSphereCylinder DiscreteMarchingCubes ExtractData IceCream ImplicitSphere ImplicitSphere1 IsosurfaceSampling OverlappingAMR SmoothDiscreteMarchingCubes TissueLens vtkSphereSource AmbientSpheres Animation AppendFilter Axes BalloonWidget BillboardTextActor3D BooleanOperationPolyDataFilter Camera CameraBlur CameraModel1 CameraModel2 CapClip CollisionDetection ColorAnActor ColoredSphere ColorMapToLUT ColorMapToLUT_JSON ColorMapToLUT_XML CombinePolyData CompositePolyDataMapper ConnectivityFilter ConvexPointSet CurvatureBandsWithGlyphs Decimation DeformPointSet DelaunayMesh DiffuseSpheres DisplayCoordinateAxes EarthSource ElevationBandsWithGlyphs EmbedInPyQt EmbedInPyQt2 ExtractPolyLinesFromPolyData ExtractSelectionCells FilledPolygon FlatVersusGouraud GaussianSplat GeometricObjectsDemo GetValues GlyphTable GradientBackground HardwareSelector HighlightPickedActor HighlightWithSilhouette ImageWriter ImplicitPlaneWidget2 ImplicitPolyDataDistance InteractorStyleTrackballActor InteractorStyleTrackballCamera IsoparametricCellsDemo LinearCellDemo LoopShrink Mace MarchingCases MarchingCubes Model MouseEvents MouseEventsObserver MultiBlockDataSet MultipleRenderWindows MultipleViewports OrientedArrow OrientedCylinder OrientedGlyphs PBR_Anisotropy PBR_Edge_Tint PBR_HDR_Environment PBR_Materials PBR_Materials_Coat Planes PlanesIntersection PointDataSubdivision PolyDataContourToImageData PolyDataToImageDataStencil ProgrammableGlyphFilter QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo ReadLegacyUnstructuredGrid RenameArray Rotations Screenshot Shadows ShadowsLightsDemo ShareCamera SourceObjectsDemo SpecularSpheres Sphere SphereTexture TensorEllipsoids TextureCutQuadric TextureCutSphere TextWidget TissueLens TransformPolyData TransformSphere WindowTitle WritePLY WriteSTL vtkSphereWidget SphereWidget vtkSpiderPlotActor SpiderPlot vtkSplineWidget SplineWidget vtkSTLReader AlignTwoPolyDatas BooleanOperationPolyDataFilter CapClip CellsInsideObject ClosedSurface Decimation GradientBackground NormalsDemo PointInterpolator ReadSTL Rotations SaveSceneToFieldData SaveSceneToFile Shadows WriteSTL vtkSTLWriter WriteSTL vtkStreamTracer BluntStreamlines CarotidFlow Kitchen LOx LOxGrid LOxSeeds Office OfficeTube StreamLines StreamlinesWithLineWidget vtkStringArray CreateTree SaveSceneToFieldData Variant vtkStripper Bottle CapClip ExtractPolyLinesFromPolyData FilledPolygon FrogBrain FroggieSurface MedicalDemo2 MedicalDemo3 PolyDataContourToImageData PolyDataToImageDataStencil PseudoVolumeRendering StripFran vtkStructuredGrid BlankPoint SGrid vtkStructuredGridGeometryFilter BlankPoint BluntStreamlines CutStructuredGrid Kitchen LOx LOxGrid LOxSeeds Office OfficeTube Rainbow ReadPLOT3D TextureThreshold VelocityProfile WarpCombustor vtkStructuredGridOutlineFilter BluntStreamlines CombustorIsosurface CutStructuredGrid Kitchen LOx LOxGrid Office OfficeTube ProbeCombustor PseudoVolumeRendering Rainbow StreamLines StreamlinesWithLineWidget TextureThreshold VelocityProfile WarpCombustor vtkStructuredGridReader Kitchen vtkStructuredPoints Lorenz Vol vtkStructuredPointsReader AnimateVectors CarotidFlow CarotidFlowGlyphs ComplexV ExtractLargestIsosurface IronIsoSurface Motor SimpleRayCast TextureCutSphere TextureThreshold vtkSuperquadric SampleFunction vtkSuperquadricSource BackgroundImage CubeAxesActor CurvatureBandsWithGlyphs CurvaturesDemo ElevationBandsWithGlyphs OrientationMarkerWidget1 PointDataSubdivision ProgrammableGlyphs SolidClip vtkTable MultiplePlots ScatterPlot SurfacePlot vtkTableBasedClipDataSet ClipUnstructuredGridWithPlane vtkTableToPolyData CSVReadEdit1 PointInterpolator vtkTensorGlyph TensorAxes TensorEllipsoids vtkTessellatedBoxSource TessellatedBoxSource vtkTessellatorFilter CellTypeSource QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo vtkTetra Cell3DDemonstration CellTypeSource LinearCellDemo Tetrahedron WriteLegacyLinearCells WriteXMLLinearCells vtkTextActor CameraModel1 CameraModel2 CollisionDetection TextActor TextWidget vtkTextMapper Cell3DDemonstration CellTypeSource CurvaturesAdjustEdges CurvaturesDemo GeometricObjectsDemo GradientBackground IsoparametricCellsDemo LinearCellDemo MultiLineText ParametricObjectsDemo Planes PlatonicSolids PointDataSubdivision QuadraticHexahedronDemo QuadraticTetraDemo ReadDICOMSeries RescaleReverseLUT SourceObjectsDemo vtkTextProperty Cell3DDemonstration CellTypeSource CurvaturesAdjustEdges CurvaturesDemo GeometricObjectsDemo GradientBackground IsoparametricCellsDemo LinearCellDemo MultiLineText ParametricObjectsDemo Planes PlatonicSolids PointDataSubdivision QuadraticHexahedronDemo QuadraticTetraDemo ReadDICOMSeries RescaleReverseLUT SourceObjectsDemo vtkTextRepresentation TextWidget vtkTextSource SourceObjectsDemo TextSource vtkTexture AnimateVectors DecimateFran FrogSlice Motor PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing SphereTexture StippledLine TextureCutQuadric TextureCutSphere TexturePlane TextureThreshold vtkTexturedSphereSource CurvaturesAdjustEdges PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkTextureMapToSphere PBR_Anisotropy SphereTexture vtkTextWidget TextWidget vtkThreshold GenerateCubesFromLabels GenerateModelsFromLabels vtkThresholdPoints AnimateVectors CarotidFlow CarotidFlowGlyphs MarchingCases vtkThresholdTextureCoords TextureThreshold vtkTIFFWriter Hanoi ImageWriter vtkToneMappingPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkTransform AlignTwoPolyDatas AnatomicalOrientation Axes BlobbyLogo BoxWidget CameraModel1 CameraModel2 CellsInsideObject ClipSphereCylinder ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 CollisionDetection ColoredAnnotatedCube CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs EllipticalCylinderDemo ExponentialCosine ExtractData FroggieSurface FroggieView FrogSlice GenerateCubesFromLabels LayeredActors MarchingCases OrientedArrow OrientedCylinder PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ProbeCombustor RotationAroundLine SpikeFran Stocks TransformPolyData TransformSphere Tutorial_Step6 WalkCow vtkTransformFilter CameraModel1 CameraModel2 CurvaturesDemo FroggieSurface FroggieView FrogSlice GenerateCubesFromLabels TransformSphere vtkTransformPolyDataFilter AlignTwoPolyDatas AnatomicalOrientation BlobbyLogo CameraModel1 CameraModel2 CellsInsideObject ColoredAnnotatedCube CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs EllipticalCylinderDemo ExponentialCosine FroggieSurface FroggieView FrogSlice IterativeClosestPoints MarchingCases OrientedArrow OrientedCylinder PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ProbeCombustor RotationAroundLine SpikeFran Stocks TransformPolyData vtkTree ConstructTree CreateTree vtkTriangle CellTypeSource ColoredTriangle KochSnowflake LinearCellDemo LineOnMesh SmoothMeshGrid SolidColoredTriangle Triangle WriteLegacyLinearCells WriteTriangleToFile WriteXMLLinearCells vtkTriangleFilter BooleanOperationPolyDataFilter CellPicking CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo Decimation ElevationBandsWithGlyphs PBR_Clear_Coat PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision PolyDataToImageDataStencil vtkTriangleStrip LinearCellDemo TriangleStrip WriteLegacyLinearCells WriteXMLLinearCells vtkTriQuadraticHexahedron IsoparametricCellsDemo vtkTubeFilter Bottle CarotidFlow DelaunayMesh EllipticalCylinderDemo Finance FinanceFieldData LOx LOxGrid LOxSeeds MarchingCases OfficeTube PseudoVolumeRendering ReadLegacyUnstructuredGrid Stocks TensorAxes TubeFilter WarpTo vtkUniformGrid OverlappingAMR vtkUnsignedCharArray AssignCellColorsFromLUT ColoredAnnotatedCube ColoredElevationMap ColoredLines ColoredTriangle LineOnMesh SmoothMeshGrid SolidColoredTriangle TriangleColoredPoints vtkUnstructuredGrid AppendFilter Cell3DDemonstration CellPicking ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ConvexPointSet CreateESGrid DataSetSurface ExtractSelection ExtractSelectionCells Finance Hexahedron IsoparametricCellsDemo LinearCellDemo MarchingCases NOVCAGraph Polyhedron Pyramid QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo ReadLegacyUnstructuredGrid Tetrahedron UGrid WriteLegacyLinearCells WriteXMLLinearCells vtkUnstructuredGridReader ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ReadLegacyUnstructuredGrid ScalarBarWidget vtkUnstructuredGridToExplicitStructuredGrid CreateESGrid LoadESGrid vtkUnstructuredGridWriter WriteLegacyLinearCells vtkVariant CurvatureBandsWithGlyphs ElevationBandsWithGlyphs LUTUtilities Variant vtkVariantArray CurvatureBandsWithGlyphs ElevationBandsWithGlyphs LUTUtilities ReadLegacyUnstructuredGrid Variant vtkVariantCast Variant vtkVariantCreate Variant vtkVariantExtract Variant vtkVector2i SurfacePlot vtkVectorDot DisplacementPlot PlateVibration vtkVectorText AlphaFrequency AnatomicalOrientation FinanceFieldData MarchingCases Stocks TextOrigin VectorText vtkVersion AlignTwoPolyDatas AssignCellColorsFromLUT CheckVTKVersion CompassWidget CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo DiscreteMarchingCubes ElevationBandsWithGlyphs ExtractLargestIsosurface FrogBrain GenerateModelsFromLabels HeadBone IsosurfaceSampling MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 MeshLabelImageColor OutlineGlowPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision SplineWidget TissueLens VTKImportsForPython vtkVertex LinearCellDemo Vertex WriteLegacyLinearCells WriteXMLLinearCells vtkVertexGlyphFilter Actor2D Delaunay2D ImplicitPolyDataDistance TriangulateTerrainMap VertexGlyphFilter vtkViewport GradientBackground vtkViewTheme ColorEdges ColorVerticesLookupTable CreateTree ScaleVertices SelectedGraphIDs vtkViewUpdater ParallelCoordinatesExtraction vtkVolume MedicalDemo4 SimpleRayCast VTKWithNumpy vtkVolumeProperty MedicalDemo4 SimpleRayCast VTKWithNumpy vtkVoxel Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkVoxelModeller MarchingCubes vtkWarpScalar ExponentialCosine ImageWarp WarpCombustor vtkWarpTo CameraModel1 CameraModel2 WarpTo vtkWarpVector Blow DisplacementPlot PlateVibration VelocityProfile WarpVector vtkWedge Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkWidgetEvent ContourWidget vtkWindowedSincPolyDataFilter FrogBrain FroggieSurface GenerateModelsFromLabels MeshLabelImageColor SmoothDiscreteMarchingCubes vtkWindowLevelLookupTable FrogSlice VTKSpectrum vtkWindowToImageFilter Cell3DDemonstration Hanoi ImageWriter ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Screenshot WalkCow vtkXMLDataSetWriter WriteXMLLinearCells vtkXMLImageDataReader ReadImageData WriteReadVtkImageData vtkXMLImageDataWriter WriteReadVtkImageData vtkXMLPolyDataReader AlignTwoPolyDatas AnatomicalOrientation AssignCellColorsFromLUT BooleanOperationPolyDataFilter CameraOrientationWidget CellsInsideObject ClosedSurface Curvatures CutWithCutFunction CutWithScalars Decimation GradientBackground ImplicitPlaneWidget2 NormalsDemo OrientationMarkerWidget1 ReadPolyData ReadVTP Rotations vtkXMLPolyDataWriter AssignCellColorsFromLUT ColoredTriangle CSVReadEdit CSVReadEdit1 Curvatures CurvaturesAdjustEdges GenerateModelsFromLabels PolyDataContourToImageData RenameArray SolidColoredTriangle TriangleColoredPoints TriangleCorners TriangleCornerVertices WriteTriangleToFile vtkXMLUnstructuredGridReader LoadESGrid ReadUnstructuredGrid vtkXMLUnstructuredGridWriter NOVCAGraph Polyhedron"},{"location":"Python/DataManipulation/LineOnMesh/","title":"LineOnMesh","text":"

vtk-examples/Python/DataManipulation/LineOnMesh

"},{"location":"Python/DataManipulation/LineOnMesh/#description","title":"Description","text":"

Create a terrain with regularly spaced points and smooth the terrain (see SmoothMeshgrid. Then, a vtkCellLocator is used to find the intersection between vertical lines and the surface (using the IntersectWithLine method). Each intersection is saved as x, y, z coordinates and used to plot a spline on the surface.

  • Contributed by Michka Popoff

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/DataManipulation/LineOnMesh/#code","title":"Code","text":"

LineOnMesh.py

#!/usr/bin/env python\n\nimport numpy as np\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import vtkParametricSpline\nfrom vtkmodules.vtkCommonCore import (\n    mutable,\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkCellLocator,\n    vtkPolyData,\n    vtkTriangle\n)\nfrom vtkmodules.vtkFiltersCore import vtkCleanPolyData\nfrom vtkmodules.vtkFiltersModeling import vtkLoopSubdivisionFilter\nfrom vtkmodules.vtkFiltersSources import vtkParametricFunctionSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    named_colors = vtkNamedColors()\n\n    # Make a 32 x 32 grid.\n    size = 32\n\n    # Define z values for the topography.\n    # Comment out the following line if you want a different random\n    #  distribution each time the script is run.\n    np.random.seed(3)\n    topography = np.random.randint(0, 5, (size, size))\n\n    # Define points, triangles and colors\n    colors = vtkUnsignedCharArray()\n    colors.SetNumberOfComponents(3)\n    points = vtkPoints()\n    triangles = vtkCellArray()\n\n    # Build the meshgrid manually.\n    count = 0\n    for i in range(size - 1):\n        for j in range(size - 1):\n            z1 = topography[i][j]\n            z2 = topography[i][j + 1]\n            z3 = topography[i + 1][j]\n\n            # Triangle 1\n            points.InsertNextPoint(i, j, z1)\n            points.InsertNextPoint(i, (j + 1), z2)\n            points.InsertNextPoint((i + 1), j, z3)\n\n            triangle = vtkTriangle()\n            triangle.GetPointIds().SetId(0, count)\n            triangle.GetPointIds().SetId(1, count + 1)\n            triangle.GetPointIds().SetId(2, count + 2)\n\n            triangles.InsertNextCell(triangle)\n\n            z1 = topography[i][j + 1]\n            z2 = topography[i + 1][j + 1]\n            z3 = topography[i + 1][j]\n\n            # Triangle 2\n            points.InsertNextPoint(i, (j + 1), z1)\n            points.InsertNextPoint((i + 1), (j + 1), z2)\n            points.InsertNextPoint((i + 1), j, z3)\n\n            triangle = vtkTriangle()\n            triangle.GetPointIds().SetId(0, count + 3)\n            triangle.GetPointIds().SetId(1, count + 4)\n            triangle.GetPointIds().SetId(2, count + 5)\n\n            count += 6\n\n            triangles.InsertNextCell(triangle)\n\n            # Add some color.\n            r = [int(i / float(size) * 255), int(j / float(size) * 255), 0]\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n\n    # Create a polydata object.\n    trianglePolyData = vtkPolyData()\n\n    # Add the geometry and topology to the polydata.\n    trianglePolyData.SetPoints(points)\n    trianglePolyData.GetPointData().SetScalars(colors)\n    trianglePolyData.SetPolys(triangles)\n\n    # Clean the polydata so that the edges are shared!\n    cleanPolyData = vtkCleanPolyData()\n    cleanPolyData.SetInputData(trianglePolyData)\n\n    # Use a filter to smooth the data (will add triangles and smooth).\n    smooth_loop = vtkLoopSubdivisionFilter()\n    smooth_loop.SetNumberOfSubdivisions(3)\n    smooth_loop.SetInputConnection(cleanPolyData.GetOutputPort())\n\n    # Create a mapper and actor for smoothed dataset.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(smooth_loop.GetOutputPort())\n    actor_loop = vtkActor()\n    actor_loop.SetMapper(mapper)\n    actor_loop.GetProperty().SetInterpolationToFlat()\n\n    # Update the pipeline so that vtkCellLocator finds cells!\n    smooth_loop.Update()\n\n    # Define a cellLocator to be able to compute intersections between lines.\n    # and the surface\n    locator = vtkCellLocator()\n    locator.SetDataSet(smooth_loop.GetOutput())\n    locator.BuildLocator()\n\n    maxloop = 1000\n    dist = 20.0 / maxloop\n    tolerance = 0.001\n\n    # Make a list of points. Each point is the intersection of a vertical line\n    # defined by p1 and p2 and the surface.\n    points = vtkPoints()\n    for i in range(maxloop):\n        p1 = [2 + i * dist, 16, -1]\n        p2 = [2 + i * dist, 16, 6]\n\n        # Outputs (we need only pos which is the x, y, z position\n        # of the intersection)\n        t = mutable(0)\n        pos = [0.0, 0.0, 0.0]\n        pcoords = [0.0, 0.0, 0.0]\n        subId = mutable(0)\n        locator.IntersectWithLine(p1, p2, tolerance, t, pos, pcoords, subId)\n\n        # Add a slight offset in z.\n        pos[2] += 0.01\n        # Add the x, y, z position of the intersection.\n        points.InsertNextPoint(pos)\n\n    # Create a spline and add the points\n    spline = vtkParametricSpline()\n    spline.SetPoints(points)\n    functionSource = vtkParametricFunctionSource()\n    functionSource.SetUResolution(maxloop)\n    functionSource.SetParametricFunction(spline)\n\n    # Map the spline\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(functionSource.GetOutputPort())\n\n    # Define the line actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(named_colors.GetColor3d('Red'))\n    actor.GetProperty().SetLineWidth(3)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add actors and render\n    renderer.AddActor(actor)\n    renderer.AddActor(actor_loop)\n\n    renderer.SetBackground(named_colors.GetColor3d('Cornsilk'))\n    renderWindow.SetSize(800, 800)\n    renderWindow.Render()\n    renderer.GetActiveCamera().SetPosition(-32.471276, 53.258788, 61.209332)\n    renderer.GetActiveCamera().SetFocalPoint(15.500000, 15.500000, 2.000000)\n    renderer.GetActiveCamera().SetViewUp(0.348057, -0.636740, 0.688055)\n    renderer.ResetCameraClippingRange()\n    renderWindow.SetWindowName('LineOnMesh')\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/DataManipulation/MeshLabelImageColor/","title":"MeshLabelImageColor","text":"

vtk-examples/Python/DataManipulation/MeshLabelImageColor

"},{"location":"Python/DataManipulation/MeshLabelImageColor/#description","title":"Description","text":"

This example takes a label image in Meta format and meshes a single label of it. It then smooths the mesh and colours the vertices according to the displacement error introduced by the smoothing. The whole thing is then displayed.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/DataManipulation/MeshLabelImageColor/#code","title":"Code","text":"

MeshLabelImageColor.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataNormals,\n    vtkWindowedSincPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkDiscreteFlyingEdges3D,\n    vtkDiscreteMarchingCubes\n)\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkExtractVOI\nfrom vtkmodules.vtkRenderingCore import (\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingLOD import vtkLODActor\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n    ifn, index = get_program_parameters()\n\n    # Prepare to read the file.\n    reader_volume = vtkMetaImageReader()\n    reader_volume.SetFileName(ifn)\n    reader_volume.Update()\n\n    # Extract the region of interest.\n    voi = vtkExtractVOI()\n    voi.SetInputConnection(reader_volume.GetOutputPort())\n    voi.SetVOI(0, 517, 0, 228, 0, 392)\n    voi.SetSampleRate(1, 1, 1)\n    voi.Update()  # Necessary for GetScalarRange().\n    srange = voi.GetOutput().GetScalarRange()  # Needs Update() before!\n    print('Range', srange)\n\n    # Prepare surface generation.\n    # For label images.\n    if use_flying_edges:\n        try:\n            contour = vtkDiscreteFlyingEdges3D()\n        except AttributeError:\n            contour = vtkDiscreteMarchingCubes()\n    else:\n        contour = vtkDiscreteMarchingCubes()\n    contour.SetInputConnection(voi.GetOutputPort())\n    # contour.ComputeNormalsOn()\n\n    print('Doing label', index)\n\n    contour.SetValue(0, index)\n    contour.Update()  # Needed for GetNumberOfPolys()!!!\n\n    smoother = vtkWindowedSincPolyDataFilter()\n    smoother.SetInputConnection(contour.GetOutputPort())\n    smoother.SetNumberOfIterations(30)  # This has little effect on the error!\n    # smoother.BoundarySmoothingOff()\n    # smoother.FeatureEdgeSmoothingOff()\n    # smoother.SetFeatureAngle(120.0)\n    # smoother.SetPassBand(0.001)        # This increases the error a lot!\n    smoother.NonManifoldSmoothingOn()\n    smoother.NormalizeCoordinatesOn()\n    smoother.GenerateErrorScalarsOn()\n    # smoother.GenerateErrorVectorsOn()\n    smoother.Update()\n\n    # Find min and max of the smoother error.\n    se_range = smoother.GetOutput().GetPointData().GetScalars().GetRange()\n    print('Smoother error range:', se_range)\n    if se_range[1] > 1:\n        print('Big smoother error: min/max:', se_range[0], se_range[1])\n\n    lut = get_diverging_lut(4)\n\n    # Calculate cell normals.\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(smoother.GetOutputPort())\n    normals.ComputeCellNormalsOn()\n    normals.ComputePointNormalsOff()\n    normals.ConsistencyOn()\n    normals.AutoOrientNormalsOn()\n    normals.Update()  # Creates vtkPolyData.\n    normals.SetFeatureAngle(60.0)\n\n    mapper = vtkPolyDataMapper()\n    # mapper.SetInputConnection(smoother.GetOutputPort()) # This has no normals.\n    mapper.SetInputConnection(normals.GetOutputPort())  # This is better for visibility.)\n    mapper.ScalarVisibilityOn()  # Show colour.\n    mapper.SetScalarRange(se_range)\n    # mapper.SetScalarModeToUseCellData() # Contains the label eg. 31\n    mapper.SetScalarModeToUsePointData()  # The smoother error relates to the verts.\n    mapper.SetLookupTable(lut)\n\n    # Take the isosurface data and create geometry.\n    actor = vtkLODActor()\n    actor.SetNumberOfCloudPoints(100000)\n    actor.SetMapper(mapper)\n\n    # Create the renderer.\n    ren = vtkRenderer()\n    ren.SetBackground(colors.GetColor3d('DimGray'))\n    ren.AddActor(actor)\n\n    # Create a window for the renderer of size 600X600\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetSize(600, 600)\n    ren_win.SetWindowName('MeshLabelImageColor')\n    ren_win.Render()\n\n    # Set a user interface interactor for the render window.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Start the initialization and rendering.\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'MeshLabelImageColor.'\n    epilogue = '''\n        Takes a label image in Meta format and meshes a single label of it.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='labels.mhd')\n    parser.add_argument('label', nargs='?', const=1, type=int, default=31, help='The label to use e.g 31')\n    args = parser.parse_args()\n    return args.filename, args.label\n\n\ndef get_diverging_lut(ct=0):\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n\n    :param ct: The index of the color map to use.\n    :return: The lookup table.\n    \"\"\"\n\n    cm = dict()\n    # Start point = 0.0, mid point = 0.5 and end point = 1.0.\n    # Each value is a list with three sublists corresponding to the start point,\n    # mid point and end point along with the rgb color values for the respective point.\n    # cool to warm\n    cm[0] = [[0.0, 0.230, 0.299, 0.754], [0.5, 0.865, 0.865, 0.865], [1.0, 0.706, 0.016, 0.150]]\n    # purple to orange\n    cm[1] = [[0.0, 0.436, 0.308, 0.631], [0.5, 0.865, 0.865, 0.865], [1.0, 0.759, 0.334, 0.046]]\n    # green to purple\n    cm[2] = [[0.0, 0.085, 0.532, 0.201], [0.5, 0.865, 0.865, 0.865], [1.0, 0.436, 0.308, 0.631]]\n    # blue to brown\n    cm[3] = [[0.0, 0.217, 0.525, 0.910], [0.5, 0.865, 0.865, 0.865], [1.0, 0.677, 0.492, 0.093]]\n    # green to red\n    cm[4] = [[0.0, 0.085, 0.532, 0.201], [0.5, 0.865, 0.865, 0.865], [1.0, 0.758, 0.214, 0.233]]\n\n    ct = abs(ct)\n    if ct > len(cm) - 1:\n        ct = 0\n        print('The selected diverging color map is unavailable. Using the default cool to warm one.')\n\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    for scheme in cm[ct]:\n        ctf.AddRGBPoint(*scheme)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ExplicitStructuredGrid/CreateESGrid/","title":"CreateESGrid","text":"

vtk-examples/Python/ExplicitStructuredGrid/CreateESGrid

"},{"location":"Python/ExplicitStructuredGrid/CreateESGrid/#description","title":"Description","text":"

This example demonstrates how (1) to create an explicit structured grid and (2) to convert an explicit structured grid into an unstructured grid or vice versa.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ExplicitStructuredGrid/CreateESGrid/#code","title":"Code","text":"

CreateESGrid.py

#!/usr/bin/env python\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkExplicitStructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkExplicitStructuredGridToUnstructuredGrid,\n    vtkUnstructuredGridToExplicitStructuredGrid\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleRubberBandPick\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef create_explicit_structured_grid(dimensions, spacing=(1, 1, 1)):\n    \"\"\"Create an explicit structured grid.\n\n    Parameters\n    ----------\n    dimensions : tuple(int, int, int)\n        The number of points in the I, J and K directions.\n    spacing : tuple(int, int, int)\n        The spacing between points in the I, J and K directions.\n\n    Returns\n    -------\n    grid : vtkExplicitStructuredGrid\n        An explicit structured grid.\n\n    \"\"\"\n    ni, nj, nk = dimensions\n    si, sj, sk = spacing\n\n    points = vtkPoints()\n    for z in range(0, nk * sk, sk):\n        for y in range(0, nj * sj, sj):\n            for x in range(0, ni * si, si):\n                points.InsertNextPoint((x, y, z))\n\n    cells = vtkCellArray()\n    for k in range(0, nk - 1):\n        for j in range(0, nj - 1):\n            for i in range(0, ni - 1):\n                multi_index = ([i, i + 1, i + 1, i, i, i + 1, i + 1, i],\n                               [j, j, j + 1, j + 1, j, j, j + 1, j + 1],\n                               [k, k, k, k, k + 1, k + 1, k + 1, k + 1])\n                pts = np.ravel_multi_index(multi_index, dimensions, order='F')\n                cells.InsertNextCell(8, pts)\n\n    grid = vtkExplicitStructuredGrid()\n    grid.SetDimensions(ni, nj, nk)\n    grid.SetPoints(points)\n    grid.SetCells(cells)\n    return grid\n\n\ndef convert_to_unstructured_grid(grid):\n    \"\"\"Convert explicit structured grid to unstructured grid.\n\n    Parameters\n    ----------\n    grid : vtkExplicitStructuredGrid\n        An explicit structured grid.\n\n    Returns\n    -------\n    vtkUnstructuredGrid\n        An unstructured grid.\n\n    \"\"\"\n    converter = vtkExplicitStructuredGridToUnstructuredGrid()\n    converter.SetInputData(grid)\n    converter.Update()\n    return converter.GetOutput()\n\n\ndef convert_to_explicit_structured_grid(grid):\n    \"\"\"Convert unstructured grid to explicit structured grid.\n\n    Parameters\n    ----------\n    grid : UnstructuredGrid\n        An unstructured grid.\n\n    Returns\n    -------\n    vtkExplicitStructuredGrid\n        An explicit structured grid. The ``'BLOCK_I'``, ``'BLOCK_J'`` and\n        ``'BLOCK_K'`` cell arrays are required.\n\n    \"\"\"\n    converter = vtkUnstructuredGridToExplicitStructuredGrid()\n    converter.SetInputData(grid)\n    converter.SetInputArrayToProcess(0, 0, 0, 1, 'BLOCK_I')\n    converter.SetInputArrayToProcess(1, 0, 0, 1, 'BLOCK_J')\n    converter.SetInputArrayToProcess(2, 0, 0, 1, 'BLOCK_K')\n    converter.Update()\n    return converter.GetOutput()\n\n\ndef main():\n    grid = create_explicit_structured_grid((5, 6, 7), (20, 10, 1))\n    grid = convert_to_unstructured_grid(grid)\n    grid = convert_to_explicit_structured_grid(grid)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(grid)\n\n    colors = vtkNamedColors()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().LightingOff()\n    actor.GetProperty().SetColor(colors.GetColor3d('Seashell'))\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    window = vtkRenderWindow()\n    window.AddRenderer(renderer)\n    window.SetWindowName('CreateESGrid')\n    window.SetSize(1024, 768)\n    window.Render()\n\n    camera = renderer.GetActiveCamera()\n    camera.SetPosition(8.383354, -72.468670, 94.262605)\n    camera.SetFocalPoint(42.295234, 21.111537, -0.863606)\n    camera.SetViewUp(0.152863, 0.676710, 0.720206)\n    camera.SetDistance(137.681759)\n    camera.SetClippingRange(78.173985, 211.583658)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(window)\n    interactor.SetInteractorStyle(vtkInteractorStyleRubberBandPick())\n    window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ExplicitStructuredGrid/LoadESGrid/","title":"LoadESGrid","text":"

vtk-examples/Python/ExplicitStructuredGrid/LoadESGrid

"},{"location":"Python/ExplicitStructuredGrid/LoadESGrid/#description","title":"Description","text":"

This example displays the UNISIM-II-D reservoir model using the vtkExplicitStructuredGrid class.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ExplicitStructuredGrid/LoadESGrid/#code","title":"Code","text":"

LoadESGrid.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkUnstructuredGridToExplicitStructuredGrid\nfrom vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleRubberBandPick\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Load an explicit structured grid from a file'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('fn', help='The explicit structured grid file name e.g. UNISIM-II-D.vtu.')\n    args = parser.parse_args()\n    return args.fn\n\n\ndef main(fn):\n    reader = vtkXMLUnstructuredGridReader()\n    reader.SetFileName(fn)\n    reader.Update()\n\n    converter = vtkUnstructuredGridToExplicitStructuredGrid()\n    converter.GlobalWarningDisplayOff()  # hide VTK errors\n    converter.SetInputConnection(reader.GetOutputPort())\n    converter.SetInputArrayToProcess(0, 0, 0, 1, 'BLOCK_I')\n    converter.SetInputArrayToProcess(1, 0, 0, 1, 'BLOCK_J')\n    converter.SetInputArrayToProcess(2, 0, 0, 1, 'BLOCK_K')\n    converter.Update()\n\n    grid = converter.GetOutput()\n    grid.ComputeFacesConnectivityFlagsArray()\n    grid.GetCellData().SetActiveScalars('ConnectivityFlags')\n\n    scalars = grid.GetCellData().GetArray('ConnectivityFlags')\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(grid)\n    mapper.SetColorModeToMapScalars()\n    mapper.SetScalarRange(scalars.GetRange())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DimGray'))\n\n    window = vtkRenderWindow()\n    window.AddRenderer(renderer)\n    window.SetWindowName('LoadESGrid')\n    window.SetSize(1024, 768)\n    window.Render()\n\n    camera = renderer.GetActiveCamera()\n    camera.SetPosition(312452.407650, 7474760.406373, 3507.364723)\n    camera.SetFocalPoint(314388.388434, 7481520.509575, -2287.477388)\n    camera.SetViewUp(0.089920, 0.633216, 0.768734)\n    camera.SetDistance(9111.926908)\n    camera.SetClippingRange(595.217338, 19595.429475)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(window)\n    interactor.SetInteractorStyle(vtkInteractorStyleRubberBandPick())\n    window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    import sys\n\n    fn = get_program_parameters(sys.argv)\n    main(fn)\n
"},{"location":"Python/Filtering/AppendFilter/","title":"AppendFilter","text":"

vtk-examples/Python/Filtering/AppendFilter

"},{"location":"Python/Filtering/AppendFilter/#description","title":"Description","text":"

This example loads points into a polydata and an unstructured grid then combines them.

The example should be extended to show cells being combined as well.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/AppendFilter/#code","title":"Code","text":"

AppendFilter.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkPolyData,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkAppendFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkPointSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkGlyph3DMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create 5 points (vtkPolyData)\n    pointSource = vtkPointSource()\n    pointSource.SetNumberOfPoints(5)\n    pointSource.Update()\n\n    polydata = pointSource.GetOutput()\n\n    print('There are', polydata.GetNumberOfPoints(), 'points in the polydata.')\n\n    # Create 2 points in a vtkUnstructuredGrid\n    points = vtkPoints()\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0, 0, 1)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    print('There are', ug.GetNumberOfPoints(), 'points in the unstructured.')\n\n    # Combine the two data sets\n    appendFilter = vtkAppendFilter()\n    appendFilter.AddInputData(polydata)\n    appendFilter.AddInputData(ug)\n    appendFilter.Update()\n\n    combined = vtkUnstructuredGrid()\n\n    combined = appendFilter.GetOutput()\n    print('There are', combined.GetNumberOfPoints(), 'points combined.')\n\n    # Create a mapper and actor\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(appendFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetPointSize(5)\n\n    # Map the points to spheres\n    sphereActor = point_to_glyph(appendFilter.GetOutput().GetPoints(), 0.05)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d(\"Gold\"))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor(sphereActor)\n    renderer.SetBackground(colors.GetColor3d('RoyalBlue'))\n\n    # Render and interact\n    renderWindow.SetWindowName('AppendFilter')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef point_to_glyph(points, scale):\n    \"\"\"\n    Convert points to glyphs.\n    :param points: The points to glyph.\n    :param scale: The scale, used to determine the size of the\n                  glyph representing the point, expressed as a\n                  fraction of the largest side of the bounding\n                  box surrounding the points. e.g. 0.05\n    :return: The actor.\n    \"\"\"\n\n    bounds = points.GetBounds()\n    max_len = 0.0\n    for i in range(0, 3):\n        max_len = max(bounds[i + 1] - bounds[i], max_len)\n\n    sphere_source = vtkSphereSource()\n    sphere_source.SetRadius(scale * max_len)\n\n    pd = vtkPolyData()\n    pd.SetPoints(points)\n\n    mapper = vtkGlyph3DMapper()\n    mapper.SetInputData(pd)\n    mapper.SetSourceConnection(sphere_source.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    mapper.ScalingOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    return actor\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/CombinePolyData/","title":"CombinePolyData","text":"

vtk-examples/Python/Filtering/CombinePolyData

"},{"location":"Python/Filtering/CombinePolyData/#description","title":"Description","text":"

This example reads two .vtp files (or produces them if not specified as command line arguments), combines them, and displays the result to the screen.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/CombinePolyData/#code","title":"Code","text":"

CombinePolyData.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkCleanPolyData\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [0.3, 0.2, 0.1, 1.0])\n\n    input1 = vtkPolyData()\n    input2 = vtkPolyData()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(5, 0, 0)\n    sphereSource.Update()\n\n    input1.ShallowCopy(sphereSource.GetOutput())\n\n    coneSource = vtkConeSource()\n    coneSource.Update()\n\n    input2.ShallowCopy(coneSource.GetOutput())\n\n    # Append the two meshes\n    appendFilter = vtkAppendPolyData()\n    appendFilter.AddInputData(input1)\n    appendFilter.AddInputData(input2)\n\n    appendFilter.Update()\n\n    #  Remove any duplicate points.\n    cleanFilter = vtkCleanPolyData()\n    cleanFilter.SetInputConnection(appendFilter.GetOutputPort())\n    cleanFilter.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(cleanFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n\n    # Render and interact\n    renderWindowInteractor.Initialize()\n    renderWindow.Render()\n    renderWindow.SetWindowName('CombinePolyData')\n    renderer.SetBackground(colors.GetColor3d('deep_ochre'))\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/ConnectivityFilter/","title":"ConnectivityFilter","text":"

vtk-examples/Python/Filtering/ConnectivityFilter

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/ConnectivityFilter/#code","title":"Code","text":"

ConnectivityFilter.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendFilter,\n    vtkConnectivityFilter,\n    vtkDelaunay3D\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphereSource1 = vtkSphereSource()\n    sphereSource1.Update()\n\n    delaunay1 = vtkDelaunay3D()\n    delaunay1.SetInputConnection(sphereSource1.GetOutputPort())\n    delaunay1.Update()\n\n    sphereSource2 = vtkSphereSource()\n    sphereSource2.SetCenter(5, 0, 0)\n    sphereSource2.Update()\n\n    delaunay2 = vtkDelaunay3D()\n    delaunay2.SetInputConnection(sphereSource2.GetOutputPort())\n    delaunay2.Update()\n\n    appendFilter = vtkAppendFilter()\n    appendFilter.AddInputConnection(delaunay1.GetOutputPort())\n    appendFilter.AddInputConnection(delaunay2.GetOutputPort())\n    appendFilter.Update()\n\n    connectivityFilter = vtkConnectivityFilter()\n    connectivityFilter.SetInputConnection(appendFilter.GetOutputPort())\n    connectivityFilter.SetExtractionModeToAllRegions()\n    connectivityFilter.ColorRegionsOn()\n    connectivityFilter.Update()\n\n    # Visualize\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(connectivityFilter.GetOutputPort())\n    mapper.Update()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n\n    # renWindow = vtkRenderWindow()\n    # renWindow.AddRenderer(renderer)\n    # iren = vtkRenderWindowInteractor()\n    # iren.SetRenderWindow(renWindow)\n    # iren.Initialize()\n    # iren.Start()\n    renWindow = vtkRenderWindow()\n    renWindow.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWindow)\n\n    iren.Initialize()\n    renWindow.Render()\n    renWindow.SetWindowName('ConnectivityFilter')\n    renderer.SetBackground(colors.GetColor3d('deep_ochre'))\n    renderer.GetActiveCamera().Zoom(0.9)\n    renWindow.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/ConstrainedDelaunay2D/","title":"ConstrainedDelaunay2D","text":"

vtk-examples/Python/Filtering/ConstrainedDelaunay2D

"},{"location":"Python/Filtering/ConstrainedDelaunay2D/#description","title":"Description","text":"

Perform a 2D Delaunay triangulation respecting a specified boundary. This examples constructs a 10x10 grid of points. It then defines a polygon that uses the points in the grid. We want to triangulate all of the points except the region inside the boundary of the polygon. We expect a rectangular hole of size 4x3 in the resulting triangulated plane.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/ConstrainedDelaunay2D/#code","title":"Code","text":"

ConstrainedDelaunay2D.py

#!/usr/bin/python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolygon\n)\nfrom vtkmodules.vtkFiltersCore import vtkDelaunay2D\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Generate a 10 x 10 grid of points\n    points = vtkPoints()\n    gridSize = 10\n    seed = 0\n    randomSequence = vtkMinimalStandardRandomSequence()\n    randomSequence.Initialize(seed)\n    for x in range(gridSize):\n        for y in range(gridSize):\n            d1 = randomSequence.GetValue() / 2.0 - 0.25\n            randomSequence.Next()\n            d2 = randomSequence.GetValue() / 2.0 - 0.25\n            randomSequence.Next()\n            points.InsertNextPoint(x + d1, y + d2, 0)\n\n    aPolyData = vtkPolyData()\n    aPolyData.SetPoints(points)\n\n    # Create a cell array to store the polygon in\n    aCellArray = vtkCellArray()\n\n    # Define a polygonal hole with a clockwise polygon\n    aPolygon = vtkPolygon()\n\n    aPolygon.GetPointIds().InsertNextId(22)\n    aPolygon.GetPointIds().InsertNextId(23)\n    aPolygon.GetPointIds().InsertNextId(24)\n    aPolygon.GetPointIds().InsertNextId(25)\n    aPolygon.GetPointIds().InsertNextId(35)\n    aPolygon.GetPointIds().InsertNextId(45)\n    aPolygon.GetPointIds().InsertNextId(44)\n    aPolygon.GetPointIds().InsertNextId(43)\n    aPolygon.GetPointIds().InsertNextId(42)\n    aPolygon.GetPointIds().InsertNextId(32)\n\n    aCellArray.InsertNextCell(aPolygon)\n\n    # Create a polydata to store the boundary. The points must be the\n    # same as the points we will triangulate.\n    boundary = vtkPolyData()\n    boundary.SetPoints(aPolyData.GetPoints())\n    boundary.SetPolys(aCellArray)\n\n    # Triangulate the grid points\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(aPolyData)\n    delaunay.SetSourceData(boundary)\n\n    # Visualize\n    meshMapper = vtkPolyDataMapper()\n    meshMapper.SetInputConnection(delaunay.GetOutputPort())\n\n    meshActor = vtkActor()\n    meshActor.SetMapper(meshMapper)\n    meshActor.GetProperty().EdgeVisibilityOn()\n    meshActor.GetProperty().SetEdgeColor(colors.GetColor3d('Peacock'))\n    meshActor.GetProperty().SetInterpolationToFlat()\n\n    boundaryMapper = vtkPolyDataMapper()\n    boundaryMapper.SetInputData(boundary)\n\n    boundaryActor = vtkActor()\n    boundaryActor.SetMapper(boundaryMapper)\n    boundaryActor.GetProperty().SetColor(colors.GetColor3d('Raspberry'))\n    boundaryActor.GetProperty().SetLineWidth(3)\n    boundaryActor.GetProperty().EdgeVisibilityOn()\n    boundaryActor.GetProperty().SetEdgeColor(colors.GetColor3d('Red'))\n    boundaryActor.GetProperty().SetRepresentationToWireframe()\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(meshActor)\n    renderer.AddActor(boundaryActor)\n    renderer.SetBackground(colors.GetColor3d('Mint'))\n\n    # Render and interact\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('ConstrainedDelaunay2D')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/Delaunay2D/","title":"Delaunay2D","text":"

vtk-examples/Python/Filtering/Delaunay2D

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/Delaunay2D/#code","title":"Code","text":"

Delaunay2D.py

#!/usr/bin/python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkDelaunay2D\nfrom vtkmodules.vtkFiltersGeneral import vtkVertexGlyphFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a set of heights on a grid.\n    # This is often called a \"terrain map\".\n    points = vtkPoints()\n\n    gridSize = 10\n    for x in range(gridSize):\n        for y in range(gridSize):\n            points.InsertNextPoint(x, y, int((x + y) / (y + 1)))\n\n    # Add the grid points to a polydata object\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(polydata)\n\n    # Visualize\n    meshMapper = vtkPolyDataMapper()\n    meshMapper.SetInputConnection(delaunay.GetOutputPort())\n\n    meshActor = vtkActor()\n    meshActor.SetMapper(meshMapper)\n    meshActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    meshActor.GetProperty().EdgeVisibilityOn()\n\n    glyphFilter = vtkVertexGlyphFilter()\n    glyphFilter.SetInputData(polydata)\n\n    pointMapper = vtkPolyDataMapper()\n    pointMapper.SetInputConnection(glyphFilter.GetOutputPort())\n\n    pointActor = vtkActor()\n    pointActor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n    pointActor.GetProperty().SetPointSize(5)\n    pointActor.SetMapper(pointMapper)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(meshActor)\n    renderer.AddActor(pointActor)\n    renderer.SetBackground(colors.GetColor3d('Mint'))\n\n    renderWindowInteractor.Initialize()\n    renderWindow.SetWindowName('Delaunay2D')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/GaussianSplat/","title":"GaussianSplat","text":"

vtk-examples/Python/Filtering/GaussianSplat

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/GaussianSplat/#code","title":"Code","text":"

GaussianSplat.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkImagingHybrid import vtkGaussianSplatter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Create points on a sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    colors = vtkNamedColors()\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(sphereSource.GetOutput().GetPoints())\n\n    splatter = vtkGaussianSplatter()\n    splatter.SetInputData(polydata)\n    splatter.SetSampleDimensions(50, 50, 50)\n    splatter.SetRadius(0.5)\n    splatter.ScalarWarpingOff()\n\n    surface = vtkContourFilter()\n    surface.SetInputConnection(splatter.GetOutputPort())\n    surface.SetValue(0, 0.01)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    renderWindow.SetWindowName('GaussianSplat')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/Glyph2D/","title":"Glyph2D","text":"

vtk-examples/Python/Filtering/Glyph2D

"},{"location":"Python/Filtering/Glyph2D/#description","title":"Description","text":"

Copy a polydata to every point in the input set. We use a hexagon for the demo.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/Glyph2D/#code","title":"Code","text":"

Glyph2D.py

#!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkGlyph2D\nfrom vtkmodules.vtkFiltersSources import vtkRegularPolygonSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(2, 2, 0)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    # Create anything you want here, we will use a polygon for the demo.\n    polygonSource = vtkRegularPolygonSource()  # default is 6 sides\n\n    glyph2D = vtkGlyph2D()\n    glyph2D.SetSourceConnection(polygonSource.GetOutputPort())\n    glyph2D.SetInputData(polydata)\n    glyph2D.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph2D.GetOutputPort())\n    mapper.Update()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Salmon'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    style = vtkInteractorStyleImage()\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindow.SetWindowName('Glyph2D');\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/Glyph3D/","title":"Glyph3D","text":"

vtk-examples/Python/Filtering/Glyph3D

"},{"location":"Python/Filtering/Glyph3D/#description","title":"Description","text":"

This example applies an object at every point. We use a cube for the demo.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/Glyph3D/#code","title":"Code","text":"

Glyph3D.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 1, 1)\n    points.InsertNextPoint(2, 2, 2)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    # Create anything you want here, we will use a cube for the demo.\n    cubeSource = vtkCubeSource()\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetSourceConnection(cubeSource.GetOutputPort())\n    glyph3D.SetInputData(polydata)\n    glyph3D.Update()\n\n    # Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph3D.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Salmon'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))  # Background Slate Gray\n\n    renderWindow.SetWindowName('Glyph2D');\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/IterativeClosestPoints/","title":"IterativeClosestPoints","text":"

vtk-examples/Python/Filtering/IterativeClosestPoints

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/IterativeClosestPoints/#code","title":"Code","text":"

IterativeClosestPoints.py

#!/usr/bin/env python\n\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkIterativeClosestPointTransform,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\n\n\ndef main():\n    # ============ create source points ==============\n    print(\"Creating source points...\")\n    sourcePoints = vtkPoints()\n    sourceVertices = vtkCellArray()\n\n    sp_id = sourcePoints.InsertNextPoint(1.0, 0.1, 0.0)\n    sourceVertices.InsertNextCell(1)\n    sourceVertices.InsertCellPoint(sp_id)\n\n    sp_id = sourcePoints.InsertNextPoint(0.1, 1.1, 0.0)\n    sourceVertices.InsertNextCell(1)\n    sourceVertices.InsertCellPoint(sp_id)\n\n    sp_id = sourcePoints.InsertNextPoint(0.0, 0.1, 1.0)\n    sourceVertices.InsertNextCell(1)\n    sourceVertices.InsertCellPoint(sp_id)\n\n    source = vtkPolyData()\n    source.SetPoints(sourcePoints)\n    source.SetVerts(sourceVertices)\n\n    print(\"Displaying source points...\")\n    # ============ display source points ==============\n    pointCount = 3\n    for index in range(pointCount):\n        point = [0, 0, 0]\n        sourcePoints.GetPoint(index, point)\n        print(\"source point[%s]=%s\" % (index, point))\n\n    # ============ create target points ==============\n    print(\"Creating target points...\")\n    targetPoints = vtkPoints()\n    targetVertices = vtkCellArray()\n\n    tp_id = targetPoints.InsertNextPoint(1.0, 0.0, 0.0)\n    targetVertices.InsertNextCell(1)\n    targetVertices.InsertCellPoint(tp_id)\n\n    tp_id = targetPoints.InsertNextPoint(0.0, 1.0, 0.0)\n    targetVertices.InsertNextCell(1)\n    targetVertices.InsertCellPoint(tp_id)\n\n    tp_id = targetPoints.InsertNextPoint(0.0, 0.0, 1.0)\n    targetVertices.InsertNextCell(1)\n    targetVertices.InsertCellPoint(tp_id)\n\n    target = vtkPolyData()\n    target.SetPoints(targetPoints)\n    target.SetVerts(targetVertices)\n\n    # ============ display target points ==============\n    print(\"Displaying target points...\")\n    pointCount = 3\n    for index in range(pointCount):\n        point = [0, 0, 0]\n        targetPoints.GetPoint(index, point)\n        print(\"target point[%s]=%s\" % (index, point))\n\n    print(\"Running ICP ----------------\")\n    # ============ run ICP ==============\n    icp = vtkIterativeClosestPointTransform()\n    icp.SetSource(source)\n    icp.SetTarget(target)\n    icp.GetLandmarkTransform().SetModeToRigidBody()\n    # icp.DebugOn()\n    icp.SetMaximumNumberOfIterations(20)\n    icp.StartByMatchingCentroidsOn()\n    icp.Modified()\n    icp.Update()\n\n    icpTransformFilter = vtkTransformPolyDataFilter()\n    icpTransformFilter.SetInputData(source)\n\n    icpTransformFilter.SetTransform(icp)\n    icpTransformFilter.Update()\n\n    transformedSource = icpTransformFilter.GetOutput()\n\n    # ============ display transformed points ==============\n    pointCount = 3\n    for index in range(pointCount):\n        point = [0, 0, 0]\n        transformedSource.GetPoint(index, point)\n        print(\"transformed source point[%s]=%s\" % (index, point))\n\n\nif __name__ == \"__main__\":\n    main()\n
"},{"location":"Python/Filtering/PerlinNoise/","title":"PerlinNoise","text":"

vtk-examples/Python/Filtering/PerlinNoise

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/PerlinNoise/#code","title":"Code","text":"

PerlinNoise.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPerlinNoise\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    perlinNoise = vtkPerlinNoise()\n    perlinNoise.SetFrequency(2, 1.25, 1.5)\n    perlinNoise.SetPhase(0, 0, 0)\n\n    sample = vtkSampleFunction()\n    sample.SetImplicitFunction(perlinNoise)\n    sample.SetSampleDimensions(65, 65, 20)\n    sample.ComputeNormalsOff()\n\n    surface = vtkContourFilter()\n    surface.SetInputConnection(sample.GetOutputPort())\n    surface.SetValue(0, 0.0)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('SteelBlue'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the renderer, set the background and size\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renderWindow.SetWindowName('PerlinNoise')\n    renderWindow.SetSize(300, 300)\n    renderer.ResetCamera()\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/TransformPolyData/","title":"TransformPolyData","text":"

vtk-examples/Python/Filtering/TransformPolyData

"},{"location":"Python/Filtering/TransformPolyData/#description","title":"Description","text":"

This example demonstrates how to apply a transform to a data set. It uses vtkTransformPolyDataFilter, but it can be replaced with vtkTransformFilter for different types of data sets, including vtkUnstructuredGrid and vtkStructuredGrid. vtkTransformFilter will work with vtkPolyData, too).

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/TransformPolyData/#code","title":"Code","text":"

TransformPolyData.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the polydata geometry\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    # Set up the actor to display the untransformed polydata\n    originalMapper = vtkPolyDataMapper()\n    originalMapper.SetInputConnection(sphereSource.GetOutputPort())\n\n    originalActor = vtkActor()\n    originalActor.SetMapper(originalMapper)\n    originalActor.GetProperty().SetColor(colors.GetColor3d('Blue'))\n\n    # Set up the transform filter\n    translation = vtkTransform()\n    translation.Translate(1.0, 2.0, 3.0)\n\n    transformFilter = vtkTransformPolyDataFilter()\n    transformFilter.SetInputConnection(sphereSource.GetOutputPort())\n    transformFilter.SetTransform(translation)\n    transformFilter.Update()\n\n    # Set up the actor to display the transformed polydata\n    transformedMapper = vtkPolyDataMapper()\n    transformedMapper.SetInputConnection(transformFilter.GetOutputPort())\n\n    transformedActor = vtkActor()\n    transformedActor.SetMapper(transformedMapper)\n    transformedActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    # Set up the rest of the visualization pipeline\n    renderer = vtkRenderer()\n    renderer.AddActor(originalActor)\n    renderer.AddActor(transformedActor)\n    renderer.SetBackground(colors.GetColor3d('Green'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderWindow.SetWindowName('TransformPolyData')\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/TriangulateTerrainMap/","title":"TriangulateTerrainMap","text":"

vtk-examples/Python/Filtering/TriangulateTerrainMap

"},{"location":"Python/Filtering/TriangulateTerrainMap/#description","title":"Description","text":"

This example generates heights (z-values) on a 10x10 grid (a terrain map) and triangulates the points.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/TriangulateTerrainMap/#code","title":"Code","text":"

TriangulateTerrainMap.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkDelaunay2D\nfrom vtkmodules.vtkFiltersGeneral import vtkVertexGlyphFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Create points on an XY grid with random Z coordinate\n    points = vtkPoints()\n    gridSize = 10\n    seed = 0\n    randomSequence = vtkMinimalStandardRandomSequence()\n    randomSequence.Initialize(seed)\n    for x in range(0, gridSize):\n        for y in range(0, gridSize):\n            d = randomSequence.GetValue()\n            randomSequence.Next()\n            points.InsertNextPoint(x, y, d * 3)\n\n    # Add the grid points to a polydata object\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    glyphFilter = vtkVertexGlyphFilter()\n    glyphFilter.SetInputData(polydata)\n    glyphFilter.Update()\n\n    # Create a mapper and actor\n    pointsMapper = vtkPolyDataMapper()\n    pointsMapper.SetInputConnection(glyphFilter.GetOutputPort())\n\n    pointsActor = vtkActor()\n    pointsActor.SetMapper(pointsMapper)\n    pointsActor.GetProperty().SetPointSize(3)\n    pointsActor.GetProperty().SetColor(colors.GetColor3d(\"Red\"))\n\n    # Triangulate the grid points\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(polydata)\n    delaunay.Update()\n\n    # Create a mapper and actor\n    triangulatedMapper = vtkPolyDataMapper()\n    triangulatedMapper.SetInputConnection(delaunay.GetOutputPort())\n\n    triangulatedActor = vtkActor()\n    triangulatedActor.SetMapper(triangulatedMapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(pointsActor)\n    renderer.AddActor(triangulatedActor)\n    renderer.SetBackground(colors.GetColor3d(\"Green\"))  # Background color green\n\n    # Render and interact\n    renderWindow.SetWindowName('TriangulateTerrainMap')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/VertexGlyphFilter/","title":"VertexGlyphFilter","text":"

vtk-examples/Python/Filtering/VertexGlyphFilter

"},{"location":"Python/Filtering/VertexGlyphFilter/#description","title":"Description","text":"

This example creates a set of points and adds a vertex at each point using vtkVertexGlyphFilter.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/VertexGlyphFilter/#code","title":"Code","text":"

VertexGlyphFilter.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersGeneral import vtkVertexGlyphFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 1, 1)\n    points.InsertNextPoint(2, 2, 2)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    vertexGlyphFilter = vtkVertexGlyphFilter()\n    vertexGlyphFilter.AddInputData(polydata)\n    vertexGlyphFilter.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(vertexGlyphFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetPointSize(10)\n    actor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Green'))\n\n    # Render and interact\n    renderWindow.SetWindowName('VertexGlyphFilter')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Filtering/WarpTo/","title":"WarpTo","text":"

vtk-examples/Python/Filtering/WarpTo

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Filtering/WarpTo/#code","title":"Code","text":"

WarpTo.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpTo\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Create the RenderWindow, Renderer and both Actors\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Create a line\n    lineSource = vtkLineSource()\n    lineSource.SetPoint1(0.0, 0.0, 0.0)\n    lineSource.SetPoint2(0.0, 1.0, 0.0)\n    lineSource.SetResolution(20)\n    lineSource.Update()\n\n    # Create a tube (cylinder) around the line\n    tubeFilter = vtkTubeFilter()\n    tubeFilter.SetInputConnection(lineSource.GetOutputPort())\n    tubeFilter.SetRadius(.01)  # default is .5\n    tubeFilter.SetNumberOfSides(50)\n    tubeFilter.Update()\n\n    warpTo = vtkWarpTo()\n    warpTo.SetInputConnection(tubeFilter.GetOutputPort())\n    warpTo.SetPosition(10, 1, 0)\n    warpTo.SetScaleFactor(5)\n    warpTo.AbsoluteOn()\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(warpTo.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    renderer.SetBackground(colors.GetColor3d('Green'))\n    renderer.AddActor(actor)\n\n    renderWindow.SetWindowName('WarpTo')\n    renderWindow.Render()\n\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Arrow/","title":"Arrow","text":"

vtk-examples/Python/GeometricObjects/Arrow

"},{"location":"Python/GeometricObjects/Arrow/#description","title":"Description","text":"

vtkArrowSource object appends a cylinder to a cone to form an arrow.

The shaft base is always at (0,0,0). The arrow tip is always at (1,0,0). If \"Invert\" is true, then the ends are flipped i.e. tip is at (0,0,0) while base is at (1, 0, 0).

The resolution of the cone and shaft can be set and default to 6.

The radius of the cone and shaft can be set and default to 0.03 and 0.1. The length of the tip can also be set, and defaults to 0.35.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Arrow/#code","title":"Code","text":"

Arrow.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkArrowSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    arrowSource = vtkArrowSource()\n    # arrowSource.SetShaftRadius(0.01)\n    # arrowSource.SetTipLength(.9)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(arrowSource.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Arrow')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    renderWindow.SetWindowName('Arrow')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Axes/","title":"Axes","text":"

vtk-examples/Python/GeometricObjects/Axes

"},{"location":"Python/GeometricObjects/Axes/#description","title":"Description","text":"

This example shows how to position an vtkAxesActor in 3D. Notice that position and orientation of the vtkAxesActor is done with a user transform.

Seealso

DisplayCoordinateAxes.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Axes/#code","title":"Code","text":"

Axes.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a Sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(0.5)\n\n    # create a mapper\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphereSource.GetOutputPort())\n\n    # create an actor\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n\n    # a renderer and render window\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Axes')\n    renderWindow.AddRenderer(renderer)\n\n    # an interactor\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # add the actors to the scene\n    renderer.AddActor(sphereActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    transform = vtkTransform()\n    transform.Translate(1.0, 0.0, 0.0)\n\n    axes = vtkAxesActor()\n    #  The axes are positioned with a user transform\n    axes.SetUserTransform(transform)\n\n    # properties of the axes labels can be set as follows\n    # this sets the x axis label to red\n    # axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetColor(colors.GetColor3d('Red'));\n\n    # the actual text of the axis label can be changed:\n    # axes->SetXAxisLabelText('test');\n\n    renderer.AddActor(axes)\n\n    renderer.GetActiveCamera().Azimuth(50)\n    renderer.GetActiveCamera().Elevation(-30)\n\n    renderer.ResetCamera()\n    renderWindow.SetWindowName('Axes')\n    renderWindow.Render()\n\n    # begin mouse interaction\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Cell3DDemonstration/","title":"Cell3DDemonstration","text":"

vtk-examples/Python/GeometricObjects/Cell3DDemonstration

"},{"location":"Python/GeometricObjects/Cell3DDemonstration/#description","title":"Description","text":"

This is a demonstration of how to construct and display geometric objects using the classes derived from vtkCell3D. For each object we specify the points and cell Ids.

From this we create an unstructured grid. In some cases a vtkCellArray is used and the result is added to the unstructured grid, see: MakePolyhedron() and MakeTetrahedron().

Also demonstrated is the use of vectors to hold the unstructured grids, mappers, actors and renderers.

The resultant objects are then displayed in a grid.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Cell3DDemonstration/#code","title":"Code","text":"

Cell3DDemonstration.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkIdList,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_POLYHEDRON,\n    VTK_TETRA,\n    vtkCellArray,\n    vtkHexagonalPrism,\n    vtkHexahedron,\n    vtkPentagonalPrism,\n    vtkPyramid,\n    vtkTetra,\n    vtkUnstructuredGrid,\n    vtkVoxel,\n    vtkWedge\n)\nfrom vtkmodules.vtkIOImage import vtkPNGWriter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty,\n    vtkWindowToImageFilter\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    titles = list()\n    textMappers = list()\n    textActors = list()\n\n    uGrids = list()\n    mappers = list()\n    actors = list()\n    renderers = list()\n\n    uGrids.append(MakeHexagonalPrism())\n    titles.append('Hexagonal Prism')\n    uGrids.append(MakeHexahedron())\n    titles.append('Hexahedron')\n    uGrids.append(MakePentagonalPrism())\n    titles.append('Pentagonal Prism')\n\n    uGrids.append(MakePolyhedron())\n    titles.append('Polyhedron')\n    uGrids.append(MakePyramid())\n    titles.append('Pyramid')\n    uGrids.append(MakeTetrahedron())\n    titles.append('Tetrahedron')\n\n    uGrids.append(MakeVoxel())\n    titles.append('Voxel')\n    uGrids.append(MakeWedge())\n    titles.append('Wedge')\n\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName('Cell3DDemonstration')\n\n    iRen = vtkRenderWindowInteractor()\n    iRen.SetRenderWindow(renWin)\n\n    # Create one text property for all\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(16)\n    textProperty.SetJustificationToCentered()\n    textProperty.SetColor(colors.GetColor3d('LightGoldenrodYellow'))\n\n    # Create and link the mappers actors and renderers together.\n    for i in range(0, len(uGrids)):\n        textMappers.append(vtkTextMapper())\n        textActors.append(vtkActor2D())\n\n        mappers.append(vtkDataSetMapper())\n        actors.append(vtkActor())\n        renderers.append(vtkRenderer())\n\n        mappers[i].SetInputData(uGrids[i])\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n        renderers[i].AddViewProp(actors[i])\n\n        textMappers[i].SetInput(titles[i])\n        textMappers[i].SetTextProperty(textProperty)\n\n        textActors[i].SetMapper(textMappers[i])\n        textActors[i].SetPosition(120, 16)\n        renderers[i].AddViewProp(textActors[i])\n\n        renWin.AddRenderer(renderers[i])\n\n    gridDimensions = 3\n    rendererSize = 300\n\n    renWin.SetSize(rendererSize * gridDimensions,\n                   rendererSize * gridDimensions)\n\n    for row in range(0, gridDimensions):\n        for col in range(0, gridDimensions):\n            index = row * gridDimensions + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewport = [\n                float(col) * rendererSize /\n                (gridDimensions * rendererSize),\n                float(gridDimensions - (row + 1)) * rendererSize /\n                (gridDimensions * rendererSize),\n                float(col + 1) * rendererSize /\n                (gridDimensions * rendererSize),\n                float(gridDimensions - row) * rendererSize /\n                (gridDimensions * rendererSize)]\n\n            if index > len(actors) - 1:\n                # Add a renderer even if there is no actor.\n                # This makes the render window background all the same color.\n                ren = vtkRenderer()\n                ren.SetBackground(colors.GetColor3d('BkgColor'))\n                ren.SetViewport(viewport)\n                renWin.AddRenderer(ren)\n                continue\n\n            renderers[index].SetViewport(viewport)\n            renderers[index].SetBackground(colors.GetColor3d('BkgColor'))\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(30)\n            renderers[index].GetActiveCamera().Elevation(-30)\n            renderers[index].GetActiveCamera().Zoom(0.85)\n            renderers[index].ResetCameraClippingRange()\n\n    iRen.Initialize()\n    renWin.SetWindowName('Cell3DDemonstration')\n    renWin.Render()\n    iRen.Start()\n\n\ndef MakeHexagonalPrism():\n    \"\"\"\n      3D: hexagonal prism: a wedge with an hexagonal base.\n      Be careful, the base face ordering is different from wedge.\n    \"\"\"\n\n    numberOfVertices = 12\n\n    points = vtkPoints()\n\n    points.InsertNextPoint(0.0, 0.0, 1.0)\n    points.InsertNextPoint(1.0, 0.0, 1.0)\n    points.InsertNextPoint(1.5, 0.5, 1.0)\n    points.InsertNextPoint(1.0, 1.0, 1.0)\n    points.InsertNextPoint(0.0, 1.0, 1.0)\n    points.InsertNextPoint(-0.5, 0.5, 1.0)\n\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(1.5, 0.5, 0.0)\n    points.InsertNextPoint(1.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n    points.InsertNextPoint(-0.5, 0.5, 0.0)\n\n    hexagonalPrism = vtkHexagonalPrism()\n    for i in range(0, numberOfVertices):\n        hexagonalPrism.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.InsertNextCell(hexagonalPrism.GetCellType(),\n                      hexagonalPrism.GetPointIds())\n    ug.SetPoints(points)\n\n    return ug\n\n\ndef MakeHexahedron():\n    \"\"\"\n      A regular hexagon (cube) with all faces square and three squares around\n       each vertex is created below.\n\n      Setup the coordinates of eight points\n       (the two faces must be in counter clockwise\n       order as viewed from the outside).\n\n      As an exercise you can modify the coordinates of the points to create\n       seven topologically distinct convex hexahedras.\n    \"\"\"\n    numberOfVertices = 8\n\n    # Create the points\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 0.0, 1.0)\n    points.InsertNextPoint(1.0, 0.0, 1.0)\n    points.InsertNextPoint(1.0, 1.0, 1.0)\n    points.InsertNextPoint(0.0, 1.0, 1.0)\n\n    # Create a hexahedron from the points\n    hex_ = vtkHexahedron()\n    for i in range(0, numberOfVertices):\n        hex_.GetPointIds().SetId(i, i)\n\n    # Add the points and hexahedron to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(hex_.GetCellType(), hex_.GetPointIds())\n\n    return uGrid\n\n\ndef MakePentagonalPrism():\n    numberOfVertices = 10\n\n    # Create the points\n    points = vtkPoints()\n    points.InsertNextPoint(11, 10, 10)\n    points.InsertNextPoint(13, 10, 10)\n    points.InsertNextPoint(14, 12, 10)\n    points.InsertNextPoint(12, 14, 10)\n    points.InsertNextPoint(10, 12, 10)\n    points.InsertNextPoint(11, 10, 14)\n    points.InsertNextPoint(13, 10, 14)\n    points.InsertNextPoint(14, 12, 14)\n    points.InsertNextPoint(12, 14, 14)\n    points.InsertNextPoint(10, 12, 14)\n\n    # Pentagonal Prism\n    pentagonalPrism = vtkPentagonalPrism()\n    for i in range(0, numberOfVertices):\n        pentagonalPrism.GetPointIds().SetId(i, i)\n\n    # Add the points and hexahedron to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(pentagonalPrism.GetCellType(),\n                         pentagonalPrism.GetPointIds())\n\n    return uGrid\n\n\ndef MakePolyhedron():\n    \"\"\"\n      Make a regular dodecahedron. It consists of twelve regular pentagonal\n      faces with three faces meeting at each vertex.\n    \"\"\"\n    # numberOfVertices = 20\n    numberOfFaces = 12\n    # numberOfFaceVertices = 5\n\n    points = vtkPoints()\n    points.InsertNextPoint(1.21412, 0, 1.58931)\n    points.InsertNextPoint(0.375185, 1.1547, 1.58931)\n    points.InsertNextPoint(-0.982247, 0.713644, 1.58931)\n    points.InsertNextPoint(-0.982247, -0.713644, 1.58931)\n    points.InsertNextPoint(0.375185, -1.1547, 1.58931)\n    points.InsertNextPoint(1.96449, 0, 0.375185)\n    points.InsertNextPoint(0.607062, 1.86835, 0.375185)\n    points.InsertNextPoint(-1.58931, 1.1547, 0.375185)\n    points.InsertNextPoint(-1.58931, -1.1547, 0.375185)\n    points.InsertNextPoint(0.607062, -1.86835, 0.375185)\n    points.InsertNextPoint(1.58931, 1.1547, -0.375185)\n    points.InsertNextPoint(-0.607062, 1.86835, -0.375185)\n    points.InsertNextPoint(-1.96449, 0, -0.375185)\n    points.InsertNextPoint(-0.607062, -1.86835, -0.375185)\n    points.InsertNextPoint(1.58931, -1.1547, -0.375185)\n    points.InsertNextPoint(0.982247, 0.713644, -1.58931)\n    points.InsertNextPoint(-0.375185, 1.1547, -1.58931)\n    points.InsertNextPoint(-1.21412, 0, -1.58931)\n    points.InsertNextPoint(-0.375185, -1.1547, -1.58931)\n    points.InsertNextPoint(0.982247, -0.713644, -1.58931)\n\n    # Dimensions are [numberOfFaces][numberOfFaceVertices]\n    dodechedronFace = [\n        [0, 1, 2, 3, 4],\n        [0, 5, 10, 6, 1],\n        [1, 6, 11, 7, 2],\n        [2, 7, 12, 8, 3],\n        [3, 8, 13, 9, 4],\n        [4, 9, 14, 5, 0],\n        [15, 10, 5, 14, 19],\n        [16, 11, 6, 10, 15],\n        [17, 12, 7, 11, 16],\n        [18, 13, 8, 12, 17],\n        [19, 14, 9, 13, 18],\n        [19, 18, 17, 16, 15]\n    ]\n\n    dodechedronFacesIdList = vtkIdList()\n    # Number faces that make up the cell.\n    dodechedronFacesIdList.InsertNextId(numberOfFaces)\n    for face in dodechedronFace:\n        # Number of points in the face == numberOfFaceVertices\n        dodechedronFacesIdList.InsertNextId(len(face))\n        # Insert the pointIds for that face.\n        [dodechedronFacesIdList.InsertNextId(i) for i in face]\n\n    uGrid = vtkUnstructuredGrid()\n    uGrid.InsertNextCell(VTK_POLYHEDRON, dodechedronFacesIdList)\n    uGrid.SetPoints(points)\n\n    return uGrid\n\n\ndef MakePyramid():\n    \"\"\"\n      Make a regular square pyramid.\n    \"\"\"\n    numberOfVertices = 5\n\n    points = vtkPoints()\n\n    p = [\n        [1.0, 1.0, 0.0],\n        [-1.0, 1.0, 0.0],\n        [-1.0, -1.0, 0.0],\n        [1.0, -1.0, 0.0],\n        [0.0, 0.0, 1.0]\n    ]\n    for pt in p:\n        points.InsertNextPoint(pt)\n\n    pyramid = vtkPyramid()\n    for i in range(0, numberOfVertices):\n        pyramid.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(pyramid.GetCellType(), pyramid.GetPointIds())\n\n    return ug\n\n\ndef MakeTetrahedron():\n    \"\"\"\n      Make a tetrahedron.\n    \"\"\"\n    numberOfVertices = 4\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 1, 1)\n\n    tetra = vtkTetra()\n    for i in range(0, numberOfVertices):\n        tetra.GetPointIds().SetId(i, i)\n\n    cellArray = vtkCellArray()\n    cellArray.InsertNextCell(tetra)\n\n    unstructuredGrid = vtkUnstructuredGrid()\n    unstructuredGrid.SetPoints(points)\n    unstructuredGrid.SetCells(VTK_TETRA, cellArray)\n\n    return unstructuredGrid\n\n\ndef MakeVoxel():\n    \"\"\"\n      A voxel is a representation of a regular grid in 3-D space.\n    \"\"\"\n    numberOfVertices = 8\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, 1)\n    points.InsertNextPoint(0, 1, 1)\n    points.InsertNextPoint(1, 1, 1)\n\n    voxel = vtkVoxel()\n    for i in range(0, numberOfVertices):\n        voxel.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(voxel.GetCellType(), voxel.GetPointIds())\n\n    return ug\n\n\ndef MakeWedge():\n    \"\"\"\n      A wedge consists of two triangular ends and three rectangular faces.\n    \"\"\"\n\n    numberOfVertices = 6\n\n    points = vtkPoints()\n\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0, .5, .5)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(1, 0.0, 0.0)\n    points.InsertNextPoint(1, .5, .5)\n\n    wedge = vtkWedge()\n    for i in range(0, numberOfVertices):\n        wedge.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(wedge.GetCellType(), wedge.GetPointIds())\n\n    return ug\n\n\ndef WritePNG(renWin, fn, magnification=1):\n    \"\"\"\n      Screenshot\n\n      Write out a png corresponding to the render window.\n\n      :param: renWin - the render window.\n      :param: fn - the file name.\n      :param: magnification - the magnification.\n    \"\"\"\n    windowToImageFilter = vtkWindowToImageFilter()\n    windowToImageFilter.SetInput(renWin)\n    windowToImageFilter.SetMagnification(magnification)\n    # Record the alpha (transparency) channel\n    # windowToImageFilter.SetInputBufferTypeToRGBA()\n    windowToImageFilter.SetInputBufferTypeToRGB()\n    # Read from the back buffer\n    windowToImageFilter.ReadFrontBufferOff()\n    windowToImageFilter.Update()\n\n    writer = vtkPNGWriter()\n    writer.SetFileName(fn)\n    writer.SetInputConnection(windowToImageFilter.GetOutputPort())\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/CellTypeSource/","title":"CellTypeSource","text":"

vtk-examples/Python/GeometricObjects/CellTypeSource

"},{"location":"Python/GeometricObjects/CellTypeSource/#description","title":"Description","text":"

This example uses [vtkCell](https://www.vtk.org/doc/nightly/html/classvtkCell.html#details)TypeSource to generate a vtkUnstructuredGrid. If a cell does not fill a rectangular area or volume, then multiple cells will be generated. For example, a vtkTetra requires 12 cells to fill a cube. A vtkTriangle requires two cells to fill a square. [vtkCell](https://www.vtk.org/doc/nightly/html/classvtkCell.html#details)TypeSource generates a uniform set of coordinates. The example perturbs those coordinates to illustrate the results of the vtkTessellatorFilter. Also, each cell is passed through vtkShrinkFilter to help identify the cells. Each generated cell also has a unique color.

The example takes an optional argument, a vtkCell name.

For example, to generate vtkTriangles, run

CellTypeSource [vtkTriangle](https://www.vtk.org/doc/nightly/html/classvtkTriangle.html#details)\n

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/CellTypeSource/#code","title":"Code","text":"

CellTypeSource.py

# !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import (\n    vtkIntArray,\n    vtkLookupTable,\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_CUBIC_LINE,\n    VTK_HEXAHEDRON,\n    VTK_LINE,\n    VTK_PYRAMID,\n    VTK_QUAD,\n    VTK_QUADRATIC_EDGE,\n    VTK_QUADRATIC_HEXAHEDRON,\n    VTK_QUADRATIC_PYRAMID,\n    VTK_QUADRATIC_QUAD,\n    VTK_QUADRATIC_TETRA,\n    VTK_QUADRATIC_TRIANGLE,\n    VTK_QUADRATIC_WEDGE,\n    VTK_TETRA,\n    VTK_TRIANGLE,\n    VTK_WEDGE,\n    vtkCellTypes\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkShrinkFilter,\n    vtkTessellatorFilter\n)\nfrom vtkmodules.vtkFiltersSources import vtkCellTypeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    cellName = get_program_parameters()\n\n    # Store the cell class names in a dictionary.\n    cellMap = dict()\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_LINE)] = VTK_LINE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_EDGE)] = VTK_QUADRATIC_EDGE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_CUBIC_LINE)] = VTK_CUBIC_LINE\n\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_TRIANGLE)] = VTK_TRIANGLE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_TRIANGLE)] = VTK_QUADRATIC_TRIANGLE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUAD)] = VTK_QUAD\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_QUAD)] = VTK_QUADRATIC_QUAD\n\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_TETRA)] = VTK_TETRA\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_HEXAHEDRON)] = VTK_HEXAHEDRON\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_WEDGE)] = VTK_WEDGE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_PYRAMID)] = VTK_PYRAMID\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_WEDGE)] = VTK_QUADRATIC_WEDGE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_PYRAMID)] = VTK_QUADRATIC_PYRAMID\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_HEXAHEDRON)] = VTK_QUADRATIC_HEXAHEDRON\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_TETRA)] = VTK_QUADRATIC_TETRA\n\n    if cellName not in cellMap:\n        print('Cell type ', cellName, ' is not supported.')\n        return\n    source = vtkCellTypeSource()\n    source.SetCellType(cellMap[cellName])\n    source.Update()\n    print('Cell: ', cellName)\n\n    originalPoints = source.GetOutput().GetPoints()\n    points = vtkPoints()\n    points.SetNumberOfPoints(source.GetOutput().GetNumberOfPoints())\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(5070)  # for testing\n    for i in range(0, points.GetNumberOfPoints()):\n        perturbation = [0.0] * 3\n        for j in range(0, 3):\n            rng.Next()\n            perturbation[j] = rng.GetRangeValue(-0.1, 0.1)\n        currentPoint = [0.0] * 3\n        originalPoints.GetPoint(i, currentPoint)\n        points.SetPoint(i, currentPoint[0] + perturbation[0],\n                        currentPoint[1] + perturbation[1],\n                        currentPoint[2] + perturbation[2])\n    source.GetOutput().SetPoints(points)\n\n    numCells = source.GetOutput().GetNumberOfCells()\n    print('Number of cells: ', numCells)\n    idArray = vtkIntArray()\n    idArray.SetNumberOfTuples(numCells)\n    for i in range(0, numCells):\n        idArray.InsertTuple1(i, i + 1)\n    idArray.SetName('Ids')\n    source.GetOutput().GetCellData().AddArray(idArray)\n    source.GetOutput().GetCellData().SetActiveScalars('Ids')\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(source.GetOutputPort())\n    shrink.SetShrinkFactor(.8)\n\n    tessellate = vtkTessellatorFilter()\n    tessellate.SetInputConnection(shrink.GetOutputPort())\n    tessellate.SetMaximumNumberOfSubdivisions(3)\n\n    # Create a lookup table to map cell data to colors.\n    lut = vtkLookupTable()\n\n    colorSeries = vtkColorSeries()\n    seriesEnum = colorSeries.BREWER_QUALITATIVE_SET3\n    colorSeries.SetColorScheme(seriesEnum)\n    colorSeries.BuildLookupTable(lut, colorSeries.ORDINAL)\n\n    # Fill in a few known colors, the rest will be generated if needed.\n    colors = vtkNamedColors()\n\n    # Create a mapper and actor.\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n    mapper.SetInputConnection(shrink.GetOutputPort())\n    mapper.SetScalarRange(0, numCells + 1)\n    mapper.SetLookupTable(lut)\n    mapper.SetScalarModeToUseCellData()\n    mapper.SetResolveCoincidentTopologyToPolygonOffset()\n    if (source.GetCellType() == VTK_QUADRATIC_PYRAMID or\n            source.GetCellType() == VTK_QUADRATIC_WEDGE):\n        mapper.SetInputConnection(shrink.GetOutputPort())\n    else:\n        mapper.SetInputConnection(tessellate.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    #  actor.GetProperty().SetLineWidth(3)\n\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(20)\n    textProperty.SetJustificationToCentered()\n    textProperty.SetColor(colors.GetColor3d('Lamp_Black'))\n\n    textMapper = vtkTextMapper()\n    textMapper.SetInput(cellName)\n    textMapper.SetTextProperty(textProperty)\n\n    textActor = vtkActor2D()\n    textActor.SetMapper(textMapper)\n    textActor.SetPosition(320, 20)\n\n    # Create a renderer, render window, and interactor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('CellTypeSource')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene.\n    renderer.AddViewProp(textActor)\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    # Render and interact.\n    renderWindow.SetSize(640, 480)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Cell Type Source.'\n    epilogue = '''\n    You can supply an optional argument consisting of a vtkCell name e.g: vtkTriangle.\n    The default is vtkTetra.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('cell_name', nargs='?', const='vtkTetra', default='vtkTetra', type=str, help='The cell name.')\n    args = parser.parse_args()\n    return args.cell_name\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Circle/","title":"Circle","text":"

vtk-examples/Python/GeometricObjects/Circle

"},{"location":"Python/GeometricObjects/Circle/#description","title":"Description","text":"

A circle is simply the limiting case of a regular polygon. We use vtkRegularPolygonSource with a large number of Sides to approximate a circle.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Circle/#code","title":"Code","text":"

Circle.py

#!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkRegularPolygonSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a circle\n    polygonSource = vtkRegularPolygonSource()\n    # Comment this line to generate a disk instead of a circle.\n    polygonSource.GeneratePolygonOff()\n    polygonSource.SetNumberOfSides(50)\n    polygonSource.SetRadius(5.0)\n    polygonSource.SetCenter(0.0, 0.0, 0.0)\n\n    #  Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(polygonSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Cornsilk'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Circle\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    renderWindow.SetWindowName('Circle')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/ColoredLines/","title":"ColoredLines","text":"

vtk-examples/Python/GeometricObjects/ColoredLines

"},{"location":"Python/GeometricObjects/ColoredLines/#description","title":"Description","text":"

Displays two lines, each with a different color.

Seealso

LongLine.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/ColoredLines/#code","title":"Code","text":"

ColoredLines.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Create the polydata where we will store all the geometric data\n    linesPolyData = vtkPolyData()\n\n    # Create three points\n    origin = [0.0, 0.0, 0.0]\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [0.0, 1.0, 0.0]\n\n    # Create a vtkPoints container and store the points in it\n    pts = vtkPoints()\n    pts.InsertNextPoint(origin)\n    pts.InsertNextPoint(p0)\n    pts.InsertNextPoint(p1)\n\n    # Add the points to the polydata container\n    linesPolyData.SetPoints(pts)\n\n    # Create the first line (between Origin and P0)\n    line0 = vtkLine()\n    line0.GetPointIds().SetId(0, 0)  # the second 0 is the index of the Origin in linesPolyData's points\n    line0.GetPointIds().SetId(1, 1)  # the second 1 is the index of P0 in linesPolyData's points\n\n    # Create the second line (between Origin and P1)\n    line1 = vtkLine()\n    line1.GetPointIds().SetId(0, 0)  # the second 0 is the index of the Origin in linesPolyData's points\n    line1.GetPointIds().SetId(1, 2)  # 2 is the index of P1 in linesPolyData's points\n\n    # Create a vtkCellArray container and store the lines in it\n    lines = vtkCellArray()\n    lines.InsertNextCell(line0)\n    lines.InsertNextCell(line1)\n\n    # Add the lines to the polydata container\n    linesPolyData.SetLines(lines)\n\n    namedColors = vtkNamedColors()\n\n    # Create a vtkUnsignedCharArray container and store the colors in it\n    colors = vtkUnsignedCharArray()\n    colors.SetNumberOfComponents(3)\n    try:\n        colors.InsertNextTupleValue(namedColors.GetColor3ub(\"Tomato\"))\n        colors.InsertNextTupleValue(namedColors.GetColor3ub(\"Mint\"))\n    except AttributeError:\n        # For compatibility with new VTK generic data arrays.\n        colors.InsertNextTypedTuple(namedColors.GetColor3ub(\"Tomato\"))\n        colors.InsertNextTypedTuple(namedColors.GetColor3ub(\"Mint\"))\n\n    # Color the lines.\n    # SetScalars() automatically associates the values in the data array passed as parameter\n    # to the elements in the same indices of the cell data array on which it is called.\n    # This means the first component (red) of the colors array\n    # is matched with the first component of the cell array (line 0)\n    # and the second component (green) of the colors array\n    # is matched with the second component of the cell array (line 1)\n    linesPolyData.GetCellData().SetScalars(colors)\n\n    # Setup the visualization pipeline\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(linesPolyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetLineWidth(4)\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(namedColors.GetColor3d(\"SlateGray\"))\n\n    window = vtkRenderWindow()\n    window.SetWindowName(\"ColoredLines\")\n    window.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(window)\n\n    # Visualize\n    window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Cone/","title":"Cone","text":"

vtk-examples/Python/GeometricObjects/Cone

"},{"location":"Python/GeometricObjects/Cone/#description","title":"Description","text":"

vtkConeSource object creates a cone centered at a specified point and pointing in a specified direction. (By default, the center is the origin and the direction is the x-axis.)

Depending upon the resolution of this object, different representations are created. If resolution=0 a line is created; if resolution=1, a single triangle is created; if resolution=2, two crossed triangles are created.

For resolution > 2, a 3D cone (with resolution number of sides) is created.

It also is possible to control whether the bottom of the cone is capped with a (resolution-sided) polygon, and to specify the height and radius of the cone.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Cone/#code","title":"Code","text":"

Cone.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    coneSource = vtkConeSource()\n    # coneSource.SetResolution(60)\n    # coneSource.SetCenter(-2,0,0)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(coneSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('bisque'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Salmon'))\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('Cone')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/ConvexPointSet/","title":"ConvexPointSet","text":"

vtk-examples/Python/GeometricObjects/ConvexPointSet

"},{"location":"Python/GeometricObjects/ConvexPointSet/#description","title":"Description","text":"

vtkConvexPointSet object represents a 3D cell defined by a convex set of points. An example of such a cell is an octant (from an octree).

vtkConvexPointSet uses the ordered triangulations approach (vtkOrderedTriangulator) to create triangulations guaranteed to be compatible across shared faces.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/ConvexPointSet/#code","title":"Code","text":"

ConvexPointSet.py

# !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkConvexPointSet,\n    vtkPolyData,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkGlyph3DMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    cps = vtkConvexPointSet()\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, 1)\n    points.InsertNextPoint(1, 1, 1)\n    points.InsertNextPoint(0, 1, 1)\n    points.InsertNextPoint(0.5, 0, 0)\n    points.InsertNextPoint(1, 0.5, 0)\n    points.InsertNextPoint(0.5, 1, 0)\n    points.InsertNextPoint(0, 0.5, 0)\n    points.InsertNextPoint(0.5, 0.5, 0)\n\n    for i in range(0, 13):\n        cps.GetPointIds().InsertId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.Allocate(1, 1)\n    ug.InsertNextCell(cps.GetCellType(), cps.GetPointIds())\n    ug.SetPoints(points)\n\n    colors = vtkNamedColors()\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(ug)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n    actor.GetProperty().SetLineWidth(3)\n    actor.GetProperty().EdgeVisibilityOn()\n\n    # Glyph the points\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(21)\n    sphere.SetThetaResolution(21)\n    sphere.SetRadius(.03)\n\n    # Create a polydata to store everything in\n    polyData = vtkPolyData()\n    polyData.SetPoints(points)\n\n    pointMapper = vtkGlyph3DMapper()\n    pointMapper.SetInputData(polyData)\n    pointMapper.SetSourceConnection(sphere.GetOutputPort())\n\n    pointActor = vtkActor()\n    pointActor.SetMapper(pointMapper)\n    pointActor.GetProperty().SetColor(colors.GetColor3d(\"Peacock\"))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"ConvexPointSet\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor(pointActor)\n    renderer.SetBackground(colors.GetColor3d(\"Silver\"))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(210)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    # Render and interact\n    renderWindow.SetSize(640, 480)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Cube/","title":"Cube","text":"

vtk-examples/Python/GeometricObjects/Cube

"},{"location":"Python/GeometricObjects/Cube/#description","title":"Description","text":"

This is based on the C++ example Examples/DataManipulation/Cxx/Cube.cxx in the VTK source distribution.

It illustrates the manual use of vtkPolyData to construct a cube and differs from the Wiki examples Cube1.cxx and Cube1.py, which use vtkCubeSource.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Cube/#code","title":"Code","text":"

Cube.py

#!/usr/bin/env python\n\n\"\"\"\nThis is (almost) a direct C++ to Python transliteration of\n <VTK-root>/Examples/DataManipulation/Cxx/Cube.cxx from the VTK\n source distribution, which \"shows how to manually create vtkPolyData\"\n\nA convenience function, mkVtkIdList(), has been added and one if/else\n so the example also works in version 6 or later.\nIf your VTK version is 5.x then remove the line: colors = vtkNamedColors()\n and replace the set background parameters with (1.0, 0.9688, 0.8594)\n\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkIdList,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef mkVtkIdList(it):\n    \"\"\"\n    Makes a vtkIdList from a Python iterable. I'm kinda surprised that\n     this is necessary, since I assumed that this kind of thing would\n     have been built into the wrapper and happen transparently, but it\n     seems not.\n\n    :param it: A python iterable.\n    :return: A vtkIdList\n    \"\"\"\n    vil = vtkIdList()\n    for i in it:\n        vil.InsertNextId(int(i))\n    return vil\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # x = array of 8 3-tuples of float representing the vertices of a cube:\n    x = [(0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (1.0, 1.0, 0.0), (0.0, 1.0, 0.0),\n         (0.0, 0.0, 1.0), (1.0, 0.0, 1.0), (1.0, 1.0, 1.0), (0.0, 1.0, 1.0)]\n\n    # pts = array of 6 4-tuples of vtkIdType (int) representing the faces\n    #     of the cube in terms of the above vertices\n    pts = [(0, 3, 2, 1), (4, 5, 6, 7), (0, 1, 5, 4),\n           (1, 2, 6, 5), (2, 3, 7, 6), (3, 0, 4, 7)]\n\n    # We'll create the building blocks of polydata including data attributes.\n    cube = vtkPolyData()\n    points = vtkPoints()\n    polys = vtkCellArray()\n    scalars = vtkFloatArray()\n\n    # Load the point, cell, and data attributes.\n    for i, xi in enumerate(x):\n        points.InsertPoint(i, xi)\n    for pt in pts:\n        polys.InsertNextCell(mkVtkIdList(pt))\n    for i, _ in enumerate(x):\n        scalars.InsertTuple1(i, i)\n\n    # We now assign the pieces to the vtkPolyData.\n    cube.SetPoints(points)\n    cube.SetPolys(polys)\n    cube.GetPointData().SetScalars(scalars)\n\n    # Now we'll look at it.\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputData(cube)\n    cubeMapper.SetScalarRange(cube.GetScalarRange())\n    cubeActor = vtkActor()\n    cubeActor.SetMapper(cubeMapper)\n\n    # The usual rendering stuff.\n    camera = vtkCamera()\n    camera.SetPosition(1, 1, 1)\n    camera.SetFocalPoint(0, 0, 0)\n\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    renderer.AddActor(cubeActor)\n    renderer.SetActiveCamera(camera)\n    renderer.ResetCamera()\n    renderer.SetBackground(colors.GetColor3d(\"Cornsilk\"))\n\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName(\"Cube\")\n\n    # interact with data\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
"},{"location":"Python/GeometricObjects/Cube1/","title":"Cube1","text":"

vtk-examples/Python/GeometricObjects/Cube1

"},{"location":"Python/GeometricObjects/Cube1/#description","title":"Description","text":"

Display a cube.

A nice simple example that demonstrates the operation of the VTK pipeline.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Cube1/#code","title":"Code","text":"

Cube1.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a rendering window and renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName('Cube1')\n    renWin.AddRenderer(ren)\n\n    # Create a renderwindowinteractor.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create cube.\n    cube = vtkCubeSource()\n    cube.Update()\n\n    # mapper\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputData(cube.GetOutput())\n\n    # Actor.\n    cubeActor = vtkActor()\n    cubeActor.SetMapper(cubeMapper)\n    cubeActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n\n    # Assign actor to the renderer.\n    ren.AddActor(cubeActor)\n\n    ren.ResetCamera()\n    ren.GetActiveCamera().Azimuth(30)\n    ren.GetActiveCamera().Elevation(30)\n    ren.ResetCameraClippingRange()\n    ren.SetBackground(colors.GetColor3d('Silver'))\n\n    # Enable user interface interactor.\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Cylinder/","title":"Cylinder","text":"

vtk-examples/Python/GeometricObjects/Cylinder

"},{"location":"Python/GeometricObjects/Cylinder/#description","title":"Description","text":"

vtkCylinderSource object creates a polygonal cylinder centered at Center.

The axis of the cylinder is aligned along the global y-axis. The height and radius of the cylinder can be specified, as well as the number of sides.

It is also possible to control whether the cylinder is open-ended or capped. If you have the end points of the cylinder, you should use a vtkLineSource followed by a vtkTubeFilter instead of the vtkCylinderSource.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Cylinder/#code","title":"Code","text":"

Cylinder.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkCylinderSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a sphere\n    cylinderSource = vtkCylinderSource()\n    cylinderSource.SetCenter(0.0, 0.0, 0.0)\n    cylinderSource.SetRadius(5.0)\n    cylinderSource.SetHeight(7.0)\n    cylinderSource.SetResolution(100)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(cylinderSource.GetOutputPort())\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('Cornsilk'))\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Cylinder')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/CylinderExample/","title":"CylinderExample","text":"

vtk-examples/Python/GeometricObjects/CylinderExample

"},{"location":"Python/GeometricObjects/CylinderExample/#description","title":"Description","text":"

This example creates a minimal visualization program, demonstrating VTK's basic rendering and pipeline creation.

Note

This original C++ source code for this example is here.

Other languages

See (Cxx), (PythonicAPI), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/CylinderExample/#code","title":"Code","text":"

CylinderExample.py

#!/usr/bin/env python\n\n# This simple example shows how to do basic rendering and pipeline\n# creation.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkCylinderSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Set the background color.\n    bkg = map(lambda x: x / 255.0, [26, 51, 102, 255])\n    colors.SetColor(\"BkgColor\", *bkg)\n\n    # This creates a polygonal cylinder model with eight circumferential\n    # facets.\n    cylinder = vtkCylinderSource()\n    cylinder.SetResolution(8)\n\n    # The mapper is responsible for pushing the geometry into the graphics\n    # library. It may also do color mapping, if scalars or other\n    # attributes are defined.\n    cylinderMapper = vtkPolyDataMapper()\n    cylinderMapper.SetInputConnection(cylinder.GetOutputPort())\n\n    # The actor is a grouping mechanism: besides the geometry (mapper), it\n    # also has a property, transformation matrix, and/or texture map.\n    # Here we set its color and rotate it -22.5 degrees.\n    cylinderActor = vtkActor()\n    cylinderActor.SetMapper(cylinderMapper)\n    cylinderActor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n    cylinderActor.RotateX(30.0)\n    cylinderActor.RotateY(-45.0)\n\n    # Create the graphics structure. The renderer renders into the render\n    # window. The render window interactor captures mouse events and will\n    # perform appropriate camera or actor manipulation depending on the\n    # nature of the events.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    ren.AddActor(cylinderActor)\n    ren.SetBackground(colors.GetColor3d(\"BkgColor\"))\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('CylinderExample')\n\n    # This allows the interactor to initalize itself. It has to be\n    # called before an event loop.\n    iren.Initialize()\n\n    # We'll zoom in a little by accessing the camera and invoking a \"Zoom\"\n    # method on it.\n    ren.ResetCamera()\n    ren.GetActiveCamera().Zoom(1.5)\n    renWin.Render()\n\n    # Start the event loop.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Disk/","title":"Disk","text":"

vtk-examples/Python/GeometricObjects/Disk

"},{"location":"Python/GeometricObjects/Disk/#description","title":"Description","text":"

vtkDiskSource objects creates a polygonal disk with a hole in the center.

The disk has zero height. The user can specify the inner and outer radius of the disk, and the radial and circumferential resolution of the polygonal representation.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Disk/#code","title":"Code","text":"

Disk.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkDiskSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    diskSource = vtkDiskSource()\n\n    # Create a mapper and actor.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(diskSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Cornsilk\"))\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Disk\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d(\"DarkGreen\"))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Dodecahedron/","title":"Dodecahedron","text":"

vtk-examples/Python/GeometricObjects/Dodecahedron

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Dodecahedron/#code","title":"Code","text":"

Dodecahedron.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyhedron\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    dodecahedron = MakeDodecahedron()\n\n    # Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(dodecahedron.GetPolyData())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(\n        colors.GetColor3d('PapayaWhip'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Dodecahedron')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('CadetBlue'))\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    renderer.ResetCamera()\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef MakeDodecahedron():\n    aDodecahedron = vtkPolyhedron()\n\n    for i in range(0, 20):\n        aDodecahedron.GetPointIds().InsertNextId(i)\n\n    aDodecahedron.GetPoints().InsertNextPoint(1.21412, 0, 1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(0.375185, 1.1547, 1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.982247, 0.713644, 1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.982247, -0.713644, 1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(0.375185, -1.1547, 1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(1.96449, 0, 0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(0.607062, 1.86835, 0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(-1.58931, 1.1547, 0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(-1.58931, -1.1547, 0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(0.607062, -1.86835, 0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(1.58931, 1.1547, -0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.607062, 1.86835, -0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(-1.96449, 0, -0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.607062, -1.86835, -0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(1.58931, -1.1547, -0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(0.982247, 0.713644, -1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.375185, 1.1547, -1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(-1.21412, 0, -1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.375185, -1.1547, -1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(0.982247, -0.713644, -1.58931)\n\n    faces = [12,  # number of faces\n             5, 0, 1, 2, 3, 4,  # number of ids on face, ids\n             5, 0, 5, 10, 6, 1,\n             5, 1, 6, 11, 7, 2,\n             5, 2, 7, 12, 8, 3,\n             5, 3, 8, 13, 9, 4,\n             5, 4, 9, 14, 5, 0,\n             5, 15, 10, 5, 14, 19,\n             5, 16, 11, 6, 10, 15,\n             5, 17, 12, 7, 11, 16,\n             5, 18, 13, 8, 12, 17,\n             5, 19, 14, 9, 13, 18,\n             5, 19, 18, 17, 16, 15]\n\n    aDodecahedron.SetFaces(faces)\n    aDodecahedron.Initialize()\n\n    return aDodecahedron\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/EarthSource/","title":"EarthSource","text":"

vtk-examples/Python/GeometricObjects/EarthSource

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/EarthSource/#code","title":"Code","text":"

EarthSource.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersHybrid import vtkEarthSource\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Earth source\n    earthSource = vtkEarthSource()\n    earthSource.OutlineOn()\n    earthSource.Update()\n    r = earthSource.GetRadius()\n\n    # Create a sphere\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(100)\n    sphere.SetPhiResolution(100)\n    sphere.SetRadius(earthSource.GetRadius())\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(earthSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor(sphereActor)\n    renderer.SetBackground(colors.GetColor3d('Black'))\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('EarthSource')\n\n    # Render and interact\n    renderWindow.Render()\n\n    # # screenshot code:\n    # w2if = vtkWindowToImageFilter()\n    # w2if.SetInput(renderWindow)\n    # w2if.Update()\n    #\n    # writer = vtkPNGWriter()\n    # writer.SetFileName('TestEarthSource.png')\n    # writer.SetInputConnection(w2if.GetOutputPort())\n    # writer.Write()\n\n    # begin interaction\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/EllipticalCylinder/","title":"EllipticalCylinder","text":"

vtk-examples/Python/GeometricObjects/EllipticalCylinder

"},{"location":"Python/GeometricObjects/EllipticalCylinder/#description","title":"Description","text":"

The example creates an elliptical cross-section and stores it in a vtkPolyData. Then, the vtkLinearExtrusionFilter creates an elliptical cylinder by extruding the vtkPolyLine along a vector. The example sets the backface property of the vtkActor to show the front and back face of the cylinder.

Seealso

EllipticalCylinderDemo to see the vtkPolyLine and the vector represented as an oriented

arrow.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/EllipticalCylinder/#code","title":"Code","text":"

EllipticalCylinder.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMath,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkFiltersModeling import vtkLinearExtrusionFilter\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    angle = 0\n    r1 = 50\n    r2 = 30\n    centerX = 10.0\n    centerY = 5.0\n\n    points = vtkPoints()\n    idx = 0\n    while angle <= 2.0 * vtkMath.Pi() + (vtkMath.Pi() / 60.0):\n        points.InsertNextPoint(r1 * math.cos(angle) + centerX,\n                               r2 * math.sin(angle) + centerY,\n                               0.0)\n        angle = angle + (vtkMath.Pi() / 60.0)\n        idx += 1\n\n    line = vtkPolyLine()\n    line.GetPointIds().SetNumberOfIds(idx)\n    for i in range(0, idx):\n        line.GetPointIds().SetId(i, i)\n\n    lines = vtkCellArray()\n    lines.InsertNextCell(line)\n\n    polyData = vtkPolyData()\n    polyData.SetPoints(points)\n    polyData.SetLines(lines)\n\n    extrude = vtkLinearExtrusionFilter()\n    extrude.SetInputData(polyData)\n    extrude.SetExtrusionTypeToNormalExtrusion()\n    extrude.SetVector(0, 0, 100.0)\n    extrude.Update()\n\n    lineMapper = vtkPolyDataMapper()\n    lineMapper.SetInputData(polyData)\n\n    lineActor = vtkActor()\n    lineActor.SetMapper(lineMapper)\n    lineActor.GetProperty().SetColor(colors.GetColor3d(\"Peacock\"))\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(extrude.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d(\"Tomato\"))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n    actor.SetBackfaceProperty(back)\n\n    ren = vtkRenderer()\n    ren.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    ren.AddActor(actor)\n    ren.AddActor(lineActor)\n\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName(\"EllipticalCylinder\")\n    renWin.AddRenderer(ren)\n    renWin.SetSize(600, 600)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    camera = vtkCamera()\n    camera.SetPosition(0, 1, 0)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetViewUp(0, 0, 1)\n    camera.Azimuth(30)\n    camera.Elevation(30)\n\n    ren.SetActiveCamera(camera)\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/EllipticalCylinderDemo/","title":"EllipticalCylinderDemo","text":"

vtk-examples/Python/GeometricObjects/EllipticalCylinderDemo

"},{"location":"Python/GeometricObjects/EllipticalCylinderDemo/#description","title":"Description","text":"

The example shows the vtkPolyLine that forms the base of the elliptical cylinder and an oriented arrow that represents the vector that vtkLinearExtrusionFilter uses to create the cylinder. The example takes an optional triple that defines the vector for the filter. The length of the vector is the height of the cylinder.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/EllipticalCylinderDemo/#code","title":"Code","text":"

EllipticalCylinderDemo.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMath,\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkLinearExtrusionFilter\nfrom vtkmodules.vtkFiltersSources import vtkArrowSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    nx, ny, nz = get_program_parameters()\n    colors = vtkNamedColors()\n\n    angle = 0\n    r1 = 50\n    r2 = 30\n    centerX = 10.0\n    centerY = 5.0\n\n    points = vtkPoints()\n    idx = 0\n    while angle <= 2.0 * vtkMath.Pi() + (vtkMath.Pi() / 60.0):\n        points.InsertNextPoint(r1 * math.cos(angle) + centerX,\n                               r2 * math.sin(angle) + centerY,\n                               0.0)\n        angle = angle + (vtkMath.Pi() / 60.0)\n        idx += 1\n\n    line = vtkPolyLine()\n    line.GetPointIds().SetNumberOfIds(idx)\n    for i in range(0, idx):\n        line.GetPointIds().SetId(i, i)\n\n    lines = vtkCellArray()\n    lines.InsertNextCell(line)\n\n    polyData = vtkPolyData()\n    polyData.SetPoints(points)\n    polyData.SetLines(lines)\n\n    extrude = vtkLinearExtrusionFilter()\n    extrude.SetInputData(polyData)\n    extrude.SetExtrusionTypeToNormalExtrusion()\n    extrude.SetVector(nx, ny, nz)\n    extrude.Update()\n\n    # Create an oriented arrow\n    startPoint = [0.0] * 3\n    endPoint = [0.0] * 3\n    startPoint[0] = centerX\n    startPoint[1] = centerY\n    startPoint[2] = 0.0\n    for i in range(0, 3):\n        endPoint[i] = startPoint[i] + extrude.GetVector()[i]\n\n    # Compute a basis\n    normalizedX = [0.0] * 3\n    normalizedY = [0.0] * 3\n    normalizedZ = [0.0] * 3\n\n    # The X axis is a vector from start to end\n    vtkMath.Subtract(endPoint, startPoint, normalizedX)\n    length = vtkMath.Norm(normalizedX)\n    vtkMath.Normalize(normalizedX)\n\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(8775070)\n    max_r = 10.0\n\n    # The Z axis is an arbitrary vector cross X\n    arbitrary = [0.0] * 3\n    for i in range(0, 3):\n        arbitrary[i] = rng.GetRangeValue(-max_r, max_r)\n        rng.Next()\n    vtkMath.Cross(normalizedX, arbitrary, normalizedZ)\n    vtkMath.Normalize(normalizedZ)\n\n    # The Y axis is Z cross X\n    vtkMath.Cross(normalizedZ, normalizedX, normalizedY)\n    matrix = vtkMatrix4x4()\n\n    # Create the direction cosine matrix\n    matrix.Identity()\n    for i in range(0, 3):\n        matrix.SetElement(i, 0, normalizedX[i])\n        matrix.SetElement(i, 1, normalizedY[i])\n        matrix.SetElement(i, 2, normalizedZ[i])\n\n    # Apply the transforms\n    transform = vtkTransform()\n    transform.Translate(startPoint)\n    transform.Concatenate(matrix)\n    transform.Scale(length, length, length)\n\n    arrowSource = vtkArrowSource()\n    arrowSource.SetTipResolution(31)\n    arrowSource.SetShaftResolution(21)\n\n    # Transform the polydata\n    transformPD = vtkTransformPolyDataFilter()\n    transformPD.SetTransform(transform)\n    transformPD.SetInputConnection(arrowSource.GetOutputPort())\n\n    # Create a mapper and actor for the arrow\n    arrowMapper = vtkPolyDataMapper()\n    arrowMapper.SetInputConnection(transformPD.GetOutputPort())\n\n    arrowActor = vtkActor()\n    arrowActor.SetMapper(arrowMapper)\n    arrowActor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n\n    tubes = vtkTubeFilter()\n    tubes.SetInputData(polyData)\n    tubes.SetRadius(2.0)\n    tubes.SetNumberOfSides(21)\n\n    lineMapper = vtkPolyDataMapper()\n    lineMapper.SetInputConnection(tubes.GetOutputPort())\n\n    lineActor = vtkActor()\n    lineActor.SetMapper(lineMapper)\n    lineActor.GetProperty().SetColor(colors.GetColor3d(\"Peacock\"))\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(extrude.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n    actor.GetProperty().SetOpacity(.7)\n\n    ren = vtkRenderer()\n    ren.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    ren.AddActor(actor)\n    ren.AddActor(lineActor)\n    ren.AddActor(arrowActor)\n\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName(\"Elliptical Cylinder Demo\")\n    renWin.AddRenderer(ren)\n    renWin.SetSize(600, 600)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    camera = vtkCamera()\n    camera.SetPosition(0, 1, 0)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetViewUp(0, 0, 1)\n    camera.Azimuth(30)\n    camera.Elevation(30)\n\n    ren.SetActiveCamera(camera)\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Elliptical Cylinder Demo.'\n    epilogue = '''\nThe example shows the vtkPolyLine that forms the base of the elliptical cylinder\n and an oriented arrow that represents the vector that vtkLinearExtrusionFilter\n uses to create the cylinder.\nThe example takes an optional triple that defines the vector for the filter.\nThe length of the vector is the height of the cylinder.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-nx', nargs='?', const=0.0, default=0.0, type=float)\n    parser.add_argument('-ny', nargs='?', const=0.0, default=0.0, type=float)\n    parser.add_argument('-nz', nargs='?', const=100.0, default=100.0, type=float)\n    args = parser.parse_args()\n    return args.nx, args.ny, args.nz\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Frustum/","title":"Frustum","text":"

vtk-examples/Python/GeometricObjects/Frustum

"},{"location":"Python/GeometricObjects/Frustum/#description","title":"Description","text":"

This example gets the frustum from a camera and displays it on the screen.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Frustum/#code","title":"Code","text":"

Frustum.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPlanes\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkPolyData\nfrom vtkmodules.vtkFiltersSources import vtkFrustumSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    camera = vtkCamera()\n    camera.SetClippingRange(0.1, 0.4)\n    planesArray = [0] * 24\n\n    camera.GetFrustumPlanes(1.0, planesArray)\n\n    planes = vtkPlanes()\n    planes.SetFrustumPlanes(planesArray)\n\n    frustumSource = vtkFrustumSource()\n    frustumSource.ShowLinesOff()\n    frustumSource.SetPlanes(planes)\n\n    shrink = vtkShrinkPolyData()\n    shrink.SetInputConnection(frustumSource.GetOutputPort())\n    shrink.SetShrinkFactor(.9)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(shrink.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d(\"Tomato\"))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n    actor.SetBackfaceProperty(back)\n\n    # a renderer and render window\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Frustum\")\n    renderWindow.AddRenderer(renderer)\n\n    # an interactor\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d(\"Silver\"))\n\n    # Position the camera so that we can see the frustum\n    renderer.GetActiveCamera().SetPosition(1, 0, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 1, 0)\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCamera()\n\n    # render an image (lights and cameras are created automatically)\n    renderWindow.Render()\n\n    # begin mouse interaction\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/GeometricObjectsDemo/","title":"GeometricObjectsDemo","text":"

vtk-examples/Python/GeometricObjects/GeometricObjectsDemo

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/GeometricObjectsDemo/#code","title":"Code","text":"

GeometricObjectsDemo.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkConeSource,\n    vtkCubeSource,\n    vtkCylinderSource,\n    vtkDiskSource,\n    vtkLineSource,\n    vtkRegularPolygonSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor(\"BkgColor\", [51, 77, 102, 255])\n\n    # Create container to hold the 3D object generators (sources)\n    geometricObjectSources = list()\n\n    # Populate the container with the various object sources to be demonstrated\n    geometricObjectSources.append(vtkArrowSource())\n    geometricObjectSources.append(vtkConeSource())\n    geometricObjectSources.append(vtkCubeSource())\n    geometricObjectSources.append(vtkCylinderSource())\n    geometricObjectSources.append(vtkDiskSource())\n    geometricObjectSources.append(vtkLineSource())\n    geometricObjectSources.append(vtkRegularPolygonSource())\n    geometricObjectSources.append(vtkSphereSource())\n\n    # Create containers for the remaining nodes of each pipeline\n    mappers = list()\n    actors = list()\n    textmappers = list()\n    textactors = list()\n\n    # Create a common text property.\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(16)\n    textProperty.SetJustificationToCentered()\n    textProperty.SetColor(colors.GetColor3d('LightGoldenrodYellow'))\n\n    # Create a mapper and actor for each object and the corresponding text label\n    for i in range(0, len(geometricObjectSources)):\n        geometricObjectSources[i].Update()\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[i].SetInputConnection(geometricObjectSources[i].GetOutputPort())\n\n        actors.append(vtkActor())\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n        textmappers.append(vtkTextMapper())\n        textmappers[i].SetInput(\n            geometricObjectSources[i].GetClassName())  # set text label to the name of the object source\n        textmappers[i].SetTextProperty(textProperty)\n\n        textactors.append(vtkActor2D())\n        textactors[i].SetMapper(textmappers[i])\n        textactors[i].SetPosition(120, 16)  # Note: the position of an Actor2D is specified in display coordinates\n\n    # Define size of the grid that will hold the objects\n    gridCols = 3\n    gridRows = 3\n    # Define side length (in pixels) of each renderer square\n    rendererSize = 300\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('GeometricObjectsDemo')\n    renderWindow.SetSize(rendererSize * gridCols, rendererSize * gridRows)\n\n    # Set up a grid of viewports for each renderer\n    for row in range(0, gridRows):\n        for col in range(0, gridCols):\n            index = row * gridCols + col\n\n            # Create a renderer for this grid cell\n            renderer = vtkRenderer()\n            renderer.SetBackground(colors.GetColor3d('BkgColor'))\n\n            # Set the renderer's viewport dimensions (xmin, ymin, xmax, ymax) within the render window.\n            # Note that for the Y values, we need to subtract the row index from gridRows\n            # because the viewport Y axis points upwards, but we want to draw the grid from top to down\n            viewport = [\n                float(col) / gridCols,\n                float(gridRows - row - 1) / gridRows,\n                float(col + 1) / gridCols,\n                float(gridRows - row) / gridRows\n            ]\n            renderer.SetViewport(viewport)\n\n            # Add the corresponding actor and label for this grid cell, if they exist\n            if index < len(geometricObjectSources):\n                renderer.AddActor(actors[index])\n                renderer.AddActor(textactors[index])\n                renderer.ResetCameraClippingRange()\n\n            renderWindow.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Hexahedron/","title":"Hexahedron","text":"

vtk-examples/Python/GeometricObjects/Hexahedron

"},{"location":"Python/GeometricObjects/Hexahedron/#description","title":"Description","text":"

The hexahedron is a primary three-dimensional cell consisting of six quadrilateral faces, twelve edges, and eight vertices. The hexahedron is defined by an ordered list of eight points. The faces and edges must not intersect any other faces and edges, and the hexahedron must be convex.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Hexahedron/#code","title":"Code","text":"

Hexahedron.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkHexahedron,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor(\"BkgColor\", [51, 77, 102, 255])\n\n    # For the hexahedron setup the coordinates of eight points.\n    # The two faces must be in counter clockwise order as viewed from the\n    # outside.\n    pointCoordinates = list()\n    pointCoordinates.append([0.0, 0.0, 0.0])  # Face 1\n    pointCoordinates.append([1.0, 0.0, 0.0])\n    pointCoordinates.append([1.0, 1.0, 0.0])\n    pointCoordinates.append([0.0, 1.0, 0.0])\n    pointCoordinates.append([0.0, 0.0, 1.0])  # Face 2\n    pointCoordinates.append([1.0, 0.0, 1.0])\n    pointCoordinates.append([1.0, 1.0, 1.0])\n    pointCoordinates.append([0.0, 1.0, 1.0])\n\n    # Create the points.\n    points = vtkPoints()\n\n    # Create a hexahedron from the points.\n    hexahedron = vtkHexahedron()\n\n    for i in range(0, len(pointCoordinates)):\n        points.InsertNextPoint(pointCoordinates[i])\n        hexahedron.GetPointIds().SetId(i, i)\n\n    # Add the hexahedron to a cell array.\n    hexs = vtkCellArray()\n    hexs.InsertNextCell(hexahedron)\n\n    # Add the points and hexahedron to an unstructured grid.\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(hexahedron.GetCellType(), hexahedron.GetPointIds())\n\n    # Visualize.\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(uGrid)\n\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d(\"PeachPuff\"))\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Hexahedron\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d(\"BkgColor\"))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/IsoparametricCellsDemo/","title":"IsoparametricCellsDemo","text":"

vtk-examples/Python/GeometricObjects/IsoparametricCellsDemo

"},{"location":"Python/GeometricObjects/IsoparametricCellsDemo/#description","title":"Description","text":"

This example shows the isoparametric cells supported by the VTK. These cells are nonlinear and contain one or more mid-side vertices. Isoparametric elements are typically used in finite element analysis. The term isoparametric is derived from the use of the same shape functions (or interpolation functions) to define the element's geometric shape as are used to define the displacements within the element.

This example illustrates each cell's representation using its parametric coordinates (pcoords) as the vertices of the cell. In practice, the vertices will correspond to physical points in a finite element model. Use vtkTessellatorFilter to better see the shape of the cell. See for example, QuadraticHexahedronDemo and QuadraticTetraDemo.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/IsoparametricCellsDemo/#code","title":"Code","text":"

IsoparametricCellsDemo.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkBiQuadraticQuad,\n    vtkBiQuadraticQuadraticHexahedron,\n    vtkBiQuadraticQuadraticWedge,\n    vtkBiQuadraticTriangle,\n    vtkCubicLine,\n    vtkQuadraticEdge,\n    vtkQuadraticHexahedron,\n    vtkQuadraticLinearQuad,\n    vtkQuadraticLinearWedge,\n    vtkQuadraticPolygon,\n    vtkQuadraticPyramid,\n    vtkQuadraticQuad,\n    vtkQuadraticTetra,\n    vtkQuadraticTriangle,\n    vtkQuadraticWedge,\n    vtkTriQuadraticHexahedron,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkGlyph3DMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\nfrom vtkmodules.vtkRenderingLabel import vtkLabeledDataMapper\n\n\ndef main():\n    titles = list()\n    textMappers = list()\n    textActors = list()\n\n    uGrids = list()\n    mappers = list()\n    actors = list()\n    renderers = list()\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticEdge()))\n    titles.append('VTK_QUADRATIC_EDGE (= 21)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticTriangle()))\n    titles.append('VTK_QUADRATIC_TRIANGLE (= 22)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticQuad()))\n    titles.append('VTK_QUADRATIC_QUAD (= 23)')\n\n    uGrids.append(MakeQuadraticPolygon())\n    titles.append('VTK_QUADRATIC_POLYGON (= 36)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticTetra()))\n    titles.append('VTK_QUADRATIC_TETRA (= 24)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticHexahedron()))\n    titles.append('VTK_QUADRATIC_HEXAHEDRON (= 25)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticWedge()))\n    titles.append('VTK_QUADRATIC_WEDGE (= 26)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticPyramid()))\n    titles.append('VTK_QUADRATIC_PYRAMID (= 27)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkBiQuadraticQuad()))\n    titles.append('VTK_BIQUADRATIC_QUAD (= 28)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkTriQuadraticHexahedron()))\n    titles.append('VTK_TRIQUADRATIC_HEXAHEDRON (= 29)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticLinearQuad()))\n    titles.append('VTK_QUADRATIC_LINEAR_QUAD (= 30)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticLinearWedge()))\n    titles.append('VTK_QUADRATIC_LINEAR_WEDGE (= 31)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkBiQuadraticQuadraticWedge()))\n    titles.append('VTK_BIQUADRATIC_QUADRATIC_WEDGE (= 32)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkBiQuadraticQuadraticHexahedron()))\n    titles.append('VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON (= 33)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkBiQuadraticTriangle()))\n    titles.append('VTK_BIQUADRATIC_TRIANGLE (= 34)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkCubicLine()))\n    titles.append('VTK_CUBIC_LINE (= 35)')\n\n    colors = vtkNamedColors()\n\n    renWin = vtkRenderWindow()\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName('Isoparametric Cell')\n\n    iRen = vtkRenderWindowInteractor()\n    iRen.SetRenderWindow(renWin)\n\n    # Create one sphere for all\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(21)\n    sphere.SetThetaResolution(21)\n    sphere.SetRadius(.08)\n\n    # Create one text property for all\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(10)\n    textProperty.SetJustificationToCentered()\n\n    # Create and link the mappers actors and renderers together.\n    for i in range(0, len(uGrids)):\n        print('Creating:', titles[i])\n        textMappers.append(vtkTextMapper())\n        textActors.append(vtkActor2D())\n\n        textMappers[i].GetTextProperty().SetFontSize(10)\n        textMappers[i].GetTextProperty().ShadowOn()\n        mappers.append(vtkDataSetMapper())\n        actors.append(vtkActor())\n        renderers.append(vtkRenderer())\n        mappers[i].SetInputData(uGrids[i])\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('Tomato'))\n        actors[i].GetProperty().EdgeVisibilityOn()\n        actors[i].GetProperty().SetLineWidth(3)\n        actors[i].GetProperty().SetOpacity(.5)\n        renderers[i].AddViewProp(actors[i])\n\n        textMappers[i].SetInput(titles[i])\n        textActors[i].SetMapper(textMappers[i])\n        textActors[i].SetPosition(50, 10)\n        renderers[i].AddViewProp(textActors[i])\n\n        # Label the points\n        labelMapper = vtkLabeledDataMapper()\n        labelMapper.SetInputData(uGrids[i])\n        labelActor = vtkActor2D()\n        labelActor.SetMapper(labelMapper)\n        renderers[i].AddViewProp(labelActor)\n\n        # Glyph the points\n        pointMapper = vtkGlyph3DMapper()\n        pointMapper.SetInputData(uGrids[i])\n        pointMapper.SetSourceConnection(sphere.GetOutputPort())\n        pointMapper.ScalingOff()\n        pointMapper.ScalarVisibilityOff()\n\n        pointActor = vtkActor()\n        pointActor.SetMapper(pointMapper)\n        pointActor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n        pointActor.GetProperty().SetSpecular(.6)\n        pointActor.GetProperty().SetSpecularColor(1.0, 1.0, 1.0)\n        pointActor.GetProperty().SetSpecularPower(100)\n        renderers[i].AddViewProp(pointActor)\n\n        renWin.AddRenderer(renderers[i])\n\n    # Setup the viewports\n    xGridDimensions = 4\n    yGridDimensions = 4\n    rendererSize = 240\n    renWin.SetSize(rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(0, xGridDimensions):\n            index = row * xGridDimensions + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions,\n                        float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions,\n                        float(yGridDimensions - row) / yGridDimensions]\n\n            if index > (len(actors) - 1):\n                # Add a renderer even if there is no actor.\n                # This makes the render window background all the same color.\n                ren = vtkRenderer()\n                ren.SetBackground(colors.GetColor3d('SlateGray'))\n                ren.SetViewport(viewport)\n                renWin.AddRenderer(ren)\n                continue\n\n            renderers[index].SetViewport(viewport)\n            renderers[index].SetBackground(colors.GetColor3d('SlateGray'))\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(30)\n            renderers[index].GetActiveCamera().Elevation(-30)\n            renderers[index].ResetCameraClippingRange()\n\n    iRen.Initialize()\n    renWin.Render()\n    iRen.Start()\n\n\n# These functions return a vtkUnstructured grid corresponding to the object.\n\ndef MakeUnstructuredGrid(aCell):\n    pcoords = aCell.GetParametricCoords()\n    for i in range(0, aCell.GetNumberOfPoints()):\n        aCell.GetPointIds().SetId(i, i)\n        aCell.GetPoints().SetPoint(i, (pcoords[3 * i]), (pcoords[3 * i + 1]), (pcoords[3 * i + 2]))\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(aCell.GetPoints())\n    ug.InsertNextCell(aCell.GetCellType(), aCell.GetPointIds())\n    return ug\n\n\ndef MakeQuadraticPolygon():\n    quadraticPolygon = vtkQuadraticPolygon()\n\n    quadraticPolygon.GetPointIds().SetNumberOfIds(8)\n    quadraticPolygon.GetPointIds().SetId(0, 0)\n    quadraticPolygon.GetPointIds().SetId(1, 1)\n    quadraticPolygon.GetPointIds().SetId(2, 2)\n    quadraticPolygon.GetPointIds().SetId(3, 3)\n    quadraticPolygon.GetPointIds().SetId(4, 4)\n    quadraticPolygon.GetPointIds().SetId(5, 5)\n    quadraticPolygon.GetPointIds().SetId(6, 6)\n    quadraticPolygon.GetPointIds().SetId(7, 7)\n\n    quadraticPolygon.GetPoints().SetNumberOfPoints(8)\n    quadraticPolygon.GetPoints().SetPoint(0, 0.0, 0.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(1, 2.0, 0.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(2, 2.0, 2.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(3, 0.0, 2.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(4, 1.0, 0.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(5, 2.0, 1.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(6, 1.0, 2.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(7, 0.0, 1.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(5, 3.0, 1.0, 0.0)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(quadraticPolygon.GetPoints())\n    ug.InsertNextCell(quadraticPolygon.GetCellType(), quadraticPolygon.GetPointIds())\n    return ug\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Line/","title":"Line","text":"

vtk-examples/Python/GeometricObjects/Line

"},{"location":"Python/GeometricObjects/Line/#description","title":"Description","text":"

The line is a primary one-dimensional cell. It is defined by two points. The direction along the line is from the first point to the second point.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Line/#code","title":"Code","text":"

Line.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Create two points, P0 and P1\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [0.0, 1.0, 0.0]\n\n    lineSource = vtkLineSource()\n    lineSource.SetPoint1(p0)\n    lineSource.SetPoint2(p1)\n\n    # Visualize\n    colors = vtkNamedColors()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(lineSource.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetLineWidth(4)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Peacock\"))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Line\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.SetBackground(colors.GetColor3d(\"Silver\"))\n    renderer.AddActor(actor)\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/LinearCellDemo/","title":"LinearCellDemo","text":"

vtk-examples/Python/GeometricObjects/LinearCellDemo

"},{"location":"Python/GeometricObjects/LinearCellDemo/#description","title":"Description","text":"

Linear cell types found in VTK. Numbers define ordering of the defining points.

Options are provided to show a wireframe (-w) or to colour the back face differently from the front face (-b).

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/LinearCellDemo/#code","title":"Code","text":"

LinearCellDemo.py

# !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    # VTK_HEXAGONAL_PRISM,\n    # VTK_HEXAHEDRON,\n    # VTK_LINE,\n    # VTK_PENTAGONAL_PRISM,\n    # VTK_PIXEL,\n    # VTK_POLY_LINE,\n    # VTK_POLY_VERTEX,\n    # VTK_POLYGON,\n    # VTK_PYRAMID,\n    # VTK_QUAD,\n    VTK_TETRA,\n    # VTK_TRIANGLE,\n    # VTK_TRIANGLE_STRIP,\n    # VTK_VERTEX,\n    # VTK_VOXEL,\n    # VTK_WEDGE,\n    vtkCellArray,\n    vtkHexagonalPrism,\n    vtkHexahedron,\n    vtkLine,\n    vtkPentagonalPrism,\n    vtkPixel,\n    vtkPolyLine,\n    vtkPolyVertex,\n    vtkPolygon,\n    vtkPyramid,\n    vtkQuad,\n    vtkTetra,\n    vtkTriangle,\n    vtkTriangleStrip,\n    vtkUnstructuredGrid,\n    vtkVertex,\n    vtkVoxel,\n    vtkWedge\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkGlyph3DMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\nfrom vtkmodules.vtkRenderingLabel import vtkLabeledDataMapper\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrate the linear cell types found in VTK. Numbers define ordering of the defining points.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    group1 = parser.add_mutually_exclusive_group()\n    group1.add_argument('-w', '--wireframe', action='store_true',\n                        help='Render a wireframe.')\n    group1.add_argument('-b', '--backface', action='store_true',\n                        help='Display the back face in a different colour.')\n    args = parser.parse_args()\n    return args.wireframe, args.backface\n\n\ndef main():\n    wireframe_on, backface_on = get_program_parameters()\n\n    titles = list()\n    text_mappers = list()\n    text_actors = list()\n\n    u_grids = list()\n    mappers = list()\n    actors = list()\n    renderers = list()\n\n    u_grids.append(make_vertex())\n    titles.append('VTK_VERTEX (=1)')\n    u_grids.append(make_poly_vertex())\n    titles.append('VTK_POLY_VERTEX (=2)')\n    u_grids.append(make_line())\n    titles.append('VTK_LINE (=3)')\n    u_grids.append(make_polyline())\n    titles.append('VTK_POLY_LINE (=4)')\n    u_grids.append(make_triangle())\n    titles.append('VTK_TRIANGLE (=5)')\n    u_grids.append(make_triangle_strip())\n    titles.append('VTK_TRIANGLE_STRIP (=6)')\n    u_grids.append(make_polygon())\n    titles.append('VTK_POLYGON (=7)')\n    u_grids.append(make_pixel())\n    titles.append('VTK_PIXEL (=8)')\n    u_grids.append(make_quad())\n    titles.append('VTK_QUAD (=9)')\n    u_grids.append(make_tetra())\n    titles.append('VTK_TETRA (=10)')\n    u_grids.append(make_voxel())\n    titles.append('VTK_VOXEL (=11)')\n    u_grids.append(make_hexahedron())\n    titles.append('VTK_HEXAHEDRON (=12)')\n    u_grids.append(make_wedge())\n    titles.append('VTK_WEDGE (=13)')\n    u_grids.append(make_pyramid())\n    titles.append('VTK_PYRAMID (=14)')\n    u_grids.append(make_pentagonal_prism())\n    titles.append('VTK_PENTAGONAL_PRISM (=15)')\n    u_grids.append(make_hexagonal_prism())\n    titles.append('VTK_HEXAGONAL_PRISM (=16)')\n\n    colors = vtkNamedColors()\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetWindowName('LinearCellDemo')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Create one sphere for all\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(21)\n    sphere.SetThetaResolution(21)\n    sphere.SetRadius(.08)\n\n    # Create one text property for all\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(10)\n    text_property.SetJustificationToCentered()\n    text_property.SetColor(colors.GetColor3d('Black'))\n\n    back_property = vtkProperty()\n    back_property.SetColor(colors.GetColor3d('MediumSeaGreen'))\n\n    # Create and link the mappers actors and renderers together.\n    for i in range(0, len(u_grids)):\n        print('Creating:', titles[i])\n        text_mappers.append(vtkTextMapper())\n        text_actors.append(vtkActor2D())\n\n        mappers.append(vtkDataSetMapper())\n        actors.append(vtkActor())\n        renderers.append(vtkRenderer())\n        mappers[i].SetInputData(u_grids[i])\n        actors[i].SetMapper(mappers[i])\n        if wireframe_on:\n            actors[i].GetProperty().SetRepresentationToWireframe()\n            actors[i].GetProperty().SetLineWidth(2)\n            actors[i].GetProperty().SetOpacity(1)\n            actors[i].GetProperty().SetColor(colors.GetColor3d('Black'))\n        else:\n            actors[i].GetProperty().EdgeVisibilityOn()\n            actors[i].GetProperty().SetLineWidth(3)\n            actors[i].GetProperty().SetColor(colors.GetColor3d('Tomato'))\n            if backface_on:\n                actors[i].SetBackfaceProperty(back_property)\n                actors[i].GetProperty().SetOpacity(1)\n            else:\n                actors[i].GetProperty().SetOpacity(0.5)\n        renderers[i].AddViewProp(actors[i])\n\n        text_mappers[i].SetInput(titles[i])\n        text_actors[i].SetMapper(text_mappers[i])\n        text_actors[i].SetPosition(50, 10)\n        if wireframe_on:\n            text_actors[i].GetProperty().SetColor(colors.GetColor3d('Black'))\n        renderers[i].AddViewProp(text_actors[i])\n\n        # Label the points\n        label_mapper = vtkLabeledDataMapper()\n        label_mapper.SetInputData(u_grids[i])\n        label_actor = vtkActor2D()\n        label_actor.SetMapper(label_mapper)\n        if wireframe_on:\n            label_actor.GetProperty().SetColor(colors.GetColor3d('Snow'))\n        renderers[i].AddViewProp(label_actor)\n\n        # Glyph the points\n        point_mapper = vtkGlyph3DMapper()\n        point_mapper.SetInputData(u_grids[i])\n        point_mapper.SetSourceConnection(sphere.GetOutputPort())\n        point_mapper.ScalingOn()\n        point_mapper.ScalarVisibilityOff()\n\n        point_actor = vtkActor()\n        point_actor.SetMapper(point_mapper)\n        if wireframe_on:\n            point_actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n        else:\n            point_actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n        point_actor.GetProperty().SetSpecular(.6)\n        point_actor.GetProperty().SetSpecularColor(1.0, 1.0, 1.0)\n        point_actor.GetProperty().SetSpecularPower(100)\n        renderers[i].AddViewProp(point_actor)\n\n        ren_win.AddRenderer(renderers[i])\n\n    # Set up the viewports\n    grid_dimensions_x = 4\n    grid_dimensions_y = 4\n    renderer_size = 300\n    ren_win.SetSize(renderer_size * grid_dimensions_x, renderer_size * grid_dimensions_y)\n    for row in range(0, grid_dimensions_y):\n        for col in range(0, grid_dimensions_x):\n            index = row * grid_dimensions_x + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / grid_dimensions_x,\n                        float(grid_dimensions_y - (row + 1)) / grid_dimensions_y,\n                        float(col + 1) / grid_dimensions_x,\n                        float(grid_dimensions_y - row) / grid_dimensions_y]\n\n            if index > (len(actors) - 1):\n                # Add a renderer even if there is no actor.\n                # This makes the render window background all the same color.\n                ren = vtkRenderer()\n                if wireframe_on:\n                    ren.SetBackground(colors.GetColor3d('LightSlateGray'))\n                else:\n                    ren.SetBackground(colors.GetColor3d('SlateGray'))\n                ren.SetViewport(viewport)\n                ren_win.AddRenderer(ren)\n                continue\n\n            if wireframe_on:\n                renderers[index].SetBackground(colors.GetColor3d('LightSlateGray'))\n            else:\n                renderers[index].SetBackground(colors.GetColor3d('SlateGray'))\n            renderers[index].SetViewport(viewport)\n            renderers[index].ResetCamera()\n            if index == 0:\n                renderers[index].GetActiveCamera().Dolly(0.1)\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 1:\n                renderers[index].GetActiveCamera().Dolly(0.8)\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 2:\n                renderers[index].GetActiveCamera().Dolly(0.4)\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 4:\n                renderers[index].GetActiveCamera().Dolly(0.7)\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 5:\n                renderers[index].GetActiveCamera().Dolly(1.1)\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 6:\n                renderers[index].GetActiveCamera().Azimuth(0)\n                renderers[index].GetActiveCamera().Elevation(-45)\n            elif index == 7:\n                renderers[index].GetActiveCamera().Azimuth(0)\n                renderers[index].GetActiveCamera().Elevation(-45)\n            elif index == 8:\n                renderers[index].GetActiveCamera().Azimuth(0)\n                renderers[index].GetActiveCamera().Elevation(-45)\n            elif index == 9:\n                renderers[index].GetActiveCamera().Azimuth(0)\n                renderers[index].GetActiveCamera().Elevation(-22.5)\n            elif index == 10:\n                renderers[index].GetActiveCamera().Azimuth(-22.5)\n                renderers[index].GetActiveCamera().Elevation(15)\n            elif index == 11:\n                renderers[index].GetActiveCamera().Azimuth(-22.5)\n                renderers[index].GetActiveCamera().Elevation(15)\n            elif index == 12:\n                renderers[index].GetActiveCamera().Azimuth(-45)\n                renderers[index].GetActiveCamera().Elevation(15)\n            elif index == 13:\n                renderers[index].GetActiveCamera().Azimuth(0)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 14:\n                renderers[index].GetActiveCamera().Azimuth(-22.5)\n                renderers[index].GetActiveCamera().Elevation(10)\n            elif index == 15:\n                renderers[index].GetActiveCamera().Azimuth(-30)\n                renderers[index].GetActiveCamera().Elevation(15)\n            else:\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            renderers[index].ResetCameraClippingRange()\n\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\n# These functions return a vtkUnstructured grid corresponding to the object.\n\ndef make_vertex():\n    # A vertex is a cell that represents a 3D point\n    number_of_vertices = 1\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n\n    vertex = vtkVertex()\n    for i in range(0, number_of_vertices):\n        vertex.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(vertex.GetCellType(), vertex.GetPointIds())\n\n    return ug\n\n\ndef make_poly_vertex():\n    # A polyvertex is a cell represents a set of 0D vertices\n    number_of_vertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, 0.4)\n    points.InsertNextPoint(0, 1, 0.6)\n\n    poly_vertex = vtkPolyVertex()\n    poly_vertex.GetPointIds().SetNumberOfIds(number_of_vertices)\n\n    for i in range(0, number_of_vertices):\n        poly_vertex.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(poly_vertex.GetCellType(), poly_vertex.GetPointIds())\n\n    return ug\n\n\ndef make_line():\n    # A line is a cell that represents a 1D point\n    number_of_vertices = 2\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0.5, 0.5, 0)\n\n    line = vtkLine()\n    for i in range(0, number_of_vertices):\n        line.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(line.GetCellType(), line.GetPointIds())\n\n    return ug\n\n\ndef make_polyline():\n    # A polyline is a cell that represents a set of 1D lines\n    number_of_vertices = 5\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0.5, 0)\n    points.InsertNextPoint(0.5, 0, 0)\n    points.InsertNextPoint(1, 0.3, 0)\n    points.InsertNextPoint(1.5, 0.4, 0)\n    points.InsertNextPoint(2.0, 0.4, 0)\n\n    polyline = vtkPolyLine()\n    polyline.GetPointIds().SetNumberOfIds(number_of_vertices)\n\n    for i in range(0, number_of_vertices):\n        polyline.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polyline.GetCellType(), polyline.GetPointIds())\n\n    return ug\n\n\ndef make_triangle():\n    # A triangle is a cell that represents a 1D point\n    number_of_vertices = 3\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0.5, 0.5, 0)\n    points.InsertNextPoint(.2, 1, 0)\n\n    triangle = vtkTriangle()\n    for i in range(0, number_of_vertices):\n        triangle.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds())\n\n    return ug\n\n\ndef make_triangle_strip():\n    # A triangle is a cell that represents a triangle strip\n    number_of_vertices = 10\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, -.1, 0)\n    points.InsertNextPoint(0.5, 1, 0)\n    points.InsertNextPoint(2.0, -0.1, 0)\n    points.InsertNextPoint(1.5, 0.8, 0)\n    points.InsertNextPoint(3.0, 0, 0)\n    points.InsertNextPoint(2.5, 0.9, 0)\n    points.InsertNextPoint(4.0, -0.2, 0)\n    points.InsertNextPoint(3.5, 0.8, 0)\n    points.InsertNextPoint(4.5, 1.1, 0)\n\n    trianglestrip = vtkTriangleStrip()\n    trianglestrip.GetPointIds().SetNumberOfIds(number_of_vertices)\n    for i in range(0, number_of_vertices):\n        trianglestrip.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(trianglestrip.GetCellType(), trianglestrip.GetPointIds())\n\n    return ug\n\n\ndef make_polygon():\n    # A polygon is a cell that represents a polygon\n    number_of_vertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, -0.1, 0)\n    points.InsertNextPoint(0.8, 0.5, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0.6, 1.2, 0)\n    points.InsertNextPoint(0, 0.8, 0)\n\n    polygon = vtkPolygon()\n    polygon.GetPointIds().SetNumberOfIds(number_of_vertices)\n    for i in range(0, number_of_vertices):\n        polygon.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polygon.GetCellType(), polygon.GetPointIds())\n\n    return ug\n\n\ndef make_pixel():\n    # A pixel is a cell that represents a pixel\n    pixel = vtkPixel()\n    pixel.GetPoints().SetPoint(0, 0, 0, 0)\n    pixel.GetPoints().SetPoint(1, 1, 0, 0)\n    pixel.GetPoints().SetPoint(2, 0, 1, 0)\n    pixel.GetPoints().SetPoint(3, 1, 1, 0)\n\n    pixel.GetPointIds().SetId(0, 0)\n    pixel.GetPointIds().SetId(1, 1)\n    pixel.GetPointIds().SetId(2, 2)\n    pixel.GetPointIds().SetId(3, 3)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(pixel.GetPoints())\n    ug.InsertNextCell(pixel.GetCellType(), pixel.GetPointIds())\n\n    return ug\n\n\ndef make_quad():\n    # A quad is a cell that represents a quad\n    quad = vtkQuad()\n    quad.GetPoints().SetPoint(0, 0, 0, 0)\n    quad.GetPoints().SetPoint(1, 1, 0, 0)\n    quad.GetPoints().SetPoint(2, 1, 1, 0)\n    quad.GetPoints().SetPoint(3, 0, 1, 0)\n\n    quad.GetPointIds().SetId(0, 0)\n    quad.GetPointIds().SetId(1, 1)\n    quad.GetPointIds().SetId(2, 2)\n    quad.GetPointIds().SetId(3, 3)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(quad.GetPoints())\n    ug.InsertNextCell(quad.GetCellType(), quad.GetPointIds())\n\n    return ug\n\n\ndef make_tetra():\n    # Make a tetrahedron.\n    number_of_vertices = 4\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 1, 1)\n\n    tetra = vtkTetra()\n    for i in range(0, number_of_vertices):\n        tetra.GetPointIds().SetId(i, i)\n\n    cell_array = vtkCellArray()\n    cell_array.InsertNextCell(tetra)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.SetCells(VTK_TETRA, cell_array)\n\n    return ug\n\n\ndef make_voxel():\n    # A voxel is a representation of a regular grid in 3-D space.\n    number_of_vertices = 8\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, 1)\n    points.InsertNextPoint(0, 1, 1)\n    points.InsertNextPoint(1, 1, 1)\n\n    voxel = vtkVoxel()\n    for i in range(0, number_of_vertices):\n        voxel.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(voxel.GetCellType(), voxel.GetPointIds())\n\n    return ug\n\n\ndef make_hexahedron():\n    # A regular hexagon (cube) with all faces square and three squares around\n    # each vertex is created below.\n\n    # Set up the coordinates of eight points\n    # (the two faces must be in counter-clockwise\n    # order as viewed from the outside).\n\n    number_of_vertices = 8\n\n    # Create the points\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, 1)\n    points.InsertNextPoint(1, 1, 1)\n    points.InsertNextPoint(0, 1, 1)\n\n    # Create a hexahedron from the points\n    hexhedr = vtkHexahedron()\n    for i in range(0, number_of_vertices):\n        hexhedr.GetPointIds().SetId(i, i)\n\n    # Add the points and hexahedron to an unstructured grid\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(hexhedr.GetCellType(), hexhedr.GetPointIds())\n\n    return ug\n\n\ndef make_wedge():\n    # A wedge consists of two triangular ends and three rectangular faces.\n\n    number_of_vertices = 6\n\n    points = vtkPoints()\n\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0, 0.5, 0.5)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(1, 0.0, 0.0)\n    points.InsertNextPoint(1, 0.5, 0.5)\n\n    wedge = vtkWedge()\n    for i in range(0, number_of_vertices):\n        wedge.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(wedge.GetCellType(), wedge.GetPointIds())\n\n    return ug\n\n\ndef make_pyramid():\n    # Make a regular square pyramid.\n    number_of_vertices = 5\n\n    points = vtkPoints()\n\n    p0 = [1.0, 1.0, 0.0]\n    p1 = [-1.0, 1.0, 0.0]\n    p2 = [-1.0, -1.0, 0.0]\n    p3 = [1.0, -1.0, 0.0]\n    p4 = [0.0, 0.0, 1.0]\n\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n    points.InsertNextPoint(p4)\n\n    pyramid = vtkPyramid()\n    for i in range(0, number_of_vertices):\n        pyramid.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(pyramid.GetCellType(), pyramid.GetPointIds())\n\n    return ug\n\n\ndef make_pentagonal_prism():\n    pentagonal_prism = vtkPentagonalPrism()\n\n    pentagonal_prism.GetPointIds().SetId(0, 0)\n    pentagonal_prism.GetPointIds().SetId(1, 1)\n    pentagonal_prism.GetPointIds().SetId(2, 2)\n    pentagonal_prism.GetPointIds().SetId(3, 3)\n    pentagonal_prism.GetPointIds().SetId(4, 4)\n    pentagonal_prism.GetPointIds().SetId(5, 5)\n    pentagonal_prism.GetPointIds().SetId(6, 6)\n    pentagonal_prism.GetPointIds().SetId(7, 7)\n    pentagonal_prism.GetPointIds().SetId(8, 8)\n    pentagonal_prism.GetPointIds().SetId(9, 9)\n\n    scale = 2.0\n    pentagonal_prism.GetPoints().SetPoint(0, 11 / scale, 10 / scale, 10 / scale)\n    pentagonal_prism.GetPoints().SetPoint(1, 13 / scale, 10 / scale, 10 / scale)\n    pentagonal_prism.GetPoints().SetPoint(2, 14 / scale, 12 / scale, 10 / scale)\n    pentagonal_prism.GetPoints().SetPoint(3, 12 / scale, 14 / scale, 10 / scale)\n    pentagonal_prism.GetPoints().SetPoint(4, 10 / scale, 12 / scale, 10 / scale)\n    pentagonal_prism.GetPoints().SetPoint(5, 11 / scale, 10 / scale, 14 / scale)\n    pentagonal_prism.GetPoints().SetPoint(6, 13 / scale, 10 / scale, 14 / scale)\n    pentagonal_prism.GetPoints().SetPoint(7, 14 / scale, 12 / scale, 14 / scale)\n    pentagonal_prism.GetPoints().SetPoint(8, 12 / scale, 14 / scale, 14 / scale)\n    pentagonal_prism.GetPoints().SetPoint(9, 10 / scale, 12 / scale, 14 / scale)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(pentagonal_prism.GetPoints())\n    ug.InsertNextCell(pentagonal_prism.GetCellType(), pentagonal_prism.GetPointIds())\n\n    return ug\n\n\ndef make_hexagonal_prism():\n    hexagonal_prism = vtkHexagonalPrism()\n    hexagonal_prism.GetPointIds().SetId(0, 0)\n    hexagonal_prism.GetPointIds().SetId(1, 1)\n    hexagonal_prism.GetPointIds().SetId(2, 2)\n    hexagonal_prism.GetPointIds().SetId(3, 3)\n    hexagonal_prism.GetPointIds().SetId(4, 4)\n    hexagonal_prism.GetPointIds().SetId(5, 5)\n    hexagonal_prism.GetPointIds().SetId(6, 6)\n    hexagonal_prism.GetPointIds().SetId(7, 7)\n    hexagonal_prism.GetPointIds().SetId(8, 8)\n    hexagonal_prism.GetPointIds().SetId(9, 9)\n    hexagonal_prism.GetPointIds().SetId(10, 10)\n    hexagonal_prism.GetPointIds().SetId(11, 11)\n\n    scale = 2.0\n    hexagonal_prism.GetPoints().SetPoint(0, 11 / scale, 10 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(1, 13 / scale, 10 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(2, 14 / scale, 12 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(3, 13 / scale, 14 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(4, 11 / scale, 14 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(5, 10 / scale, 12 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(6, 11 / scale, 10 / scale, 14 / scale)\n    hexagonal_prism.GetPoints().SetPoint(7, 13 / scale, 10 / scale, 14 / scale)\n    hexagonal_prism.GetPoints().SetPoint(8, 14 / scale, 12 / scale, 14 / scale)\n    hexagonal_prism.GetPoints().SetPoint(9, 13 / scale, 14 / scale, 14 / scale)\n    hexagonal_prism.GetPoints().SetPoint(10, 11 / scale, 14 / scale, 14 / scale)\n    hexagonal_prism.GetPoints().SetPoint(11, 10 / scale, 12 / scale, 14 / scale)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(hexagonal_prism.GetPoints())\n    ug.InsertNextCell(hexagonal_prism.GetCellType(), hexagonal_prism.GetPointIds())\n\n    return ug\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/LongLine/","title":"LongLine","text":"

vtk-examples/Python/GeometricObjects/LongLine

"},{"location":"Python/GeometricObjects/LongLine/#description","title":"Description","text":"

Connect several points with a line.

Seealso

ColoredLines.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/LongLine/#code","title":"Code","text":"

LongLine.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Create five points.\n    origin = [0.0, 0.0, 0.0]\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [0.0, 1.0, 0.0]\n    p2 = [0.0, 1.0, 2.0]\n    p3 = [1.0, 2.0, 3.0]\n\n    # Create a vtkPoints object and store the points in it\n    points = vtkPoints()\n    points.InsertNextPoint(origin)\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n\n    # Create a cell array to store the lines in and add the lines to it\n    lines = vtkCellArray()\n\n    for i in range(0, 3):\n        line = vtkLine()\n        line.GetPointIds().SetId(0, i)\n        line.GetPointIds().SetId(1, i + 1)\n        lines.InsertNextCell(line)\n\n    # Create a polydata to store everything in\n    linesPolyData = vtkPolyData()\n\n    # Add the points to the dataset\n    linesPolyData.SetPoints(points)\n\n    # Add the lines to the dataset\n    linesPolyData.SetLines(lines)\n\n    # Setup actor and mapper\n    colors = vtkNamedColors()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(linesPolyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetLineWidth(4)\n    actor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n\n    # Setup render window, renderer, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('LongLine')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderer.AddActor(actor)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/OrientedArrow/","title":"OrientedArrow","text":"

vtk-examples/Python/GeometricObjects/OrientedArrow

"},{"location":"Python/GeometricObjects/OrientedArrow/#description","title":"Description","text":"

This example illustrates how to create and display an arrow that passes through two points.

It demonstrates two different ways to apply the transform:

  1. Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter.

  2. Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

Switch between the two methods by #defining USER_MATRIX or leaving out the #define.

Seealso

Compare this example with OrientedCylinder. The transform is different because the cylinder

height direction is along the y-axis and the arrow height is along the x axis.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/OrientedArrow/#code","title":"Code","text":"

OrientedArrow.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMath,\n    vtkMinimalStandardRandomSequence\n)\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\"\"\"\nThere are two alternative ways to apply the transform.\n 1) Use vtkTransformPolyDataFilter to create a new transformed polydata.\n    This method is useful if the transformed polydata is needed\n      later in the pipeline\n    To do this, set USER_MATRIX = True\n 2) Apply the transform directly to the actor using vtkProp3D's SetUserMatrix.\n    No new data is produced.\n    To do this, set USER_MATRIX = False\n\"\"\"\nUSER_MATRIX = True\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 77, 255])\n\n    # Create an arrow.\n    arrowSource = vtkArrowSource()\n\n    # Generate a random start and end point\n    startPoint = [0] * 3\n    endPoint = [0] * 3\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(8775070)  # For testing.\n    for i in range(0, 3):\n        rng.Next()\n        startPoint[i] = rng.GetRangeValue(-10, 10)\n        rng.Next()\n        endPoint[i] = rng.GetRangeValue(-10, 10)\n\n    # Compute a basis\n    normalizedX = [0] * 3\n    normalizedY = [0] * 3\n    normalizedZ = [0] * 3\n\n    # The X axis is a vector from start to end\n    vtkMath.Subtract(endPoint, startPoint, normalizedX)\n    length = vtkMath.Norm(normalizedX)\n    vtkMath.Normalize(normalizedX)\n\n    # The Z axis is an arbitrary vector cross X\n    arbitrary = [0] * 3\n    for i in range(0, 3):\n        rng.Next()\n        arbitrary[i] = rng.GetRangeValue(-10, 10)\n    vtkMath.Cross(normalizedX, arbitrary, normalizedZ)\n    vtkMath.Normalize(normalizedZ)\n\n    # The Y axis is Z cross X\n    vtkMath.Cross(normalizedZ, normalizedX, normalizedY)\n    matrix = vtkMatrix4x4()\n\n    # Create the direction cosine matrix\n    matrix.Identity()\n    for i in range(0, 3):\n        matrix.SetElement(i, 0, normalizedX[i])\n        matrix.SetElement(i, 1, normalizedY[i])\n        matrix.SetElement(i, 2, normalizedZ[i])\n\n    # Apply the transforms\n    transform = vtkTransform()\n    transform.Translate(startPoint)\n    transform.Concatenate(matrix)\n    transform.Scale(length, length, length)\n\n    # Transform the polydata\n    transformPD = vtkTransformPolyDataFilter()\n    transformPD.SetTransform(transform)\n    transformPD.SetInputConnection(arrowSource.GetOutputPort())\n\n    # Create a mapper and actor for the arrow\n    mapper = vtkPolyDataMapper()\n    actor = vtkActor()\n    if USER_MATRIX:\n        mapper.SetInputConnection(arrowSource.GetOutputPort())\n        actor.SetUserMatrix(transform.GetMatrix())\n    else:\n        mapper.SetInputConnection(transformPD.GetOutputPort())\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Cyan'))\n\n    # Create spheres for start and end point\n    sphereStartSource = vtkSphereSource()\n    sphereStartSource.SetCenter(startPoint)\n    sphereStartSource.SetRadius(0.8)\n    sphereStartMapper = vtkPolyDataMapper()\n    sphereStartMapper.SetInputConnection(sphereStartSource.GetOutputPort())\n    sphereStart = vtkActor()\n    sphereStart.SetMapper(sphereStartMapper)\n    sphereStart.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n\n    sphereEndSource = vtkSphereSource()\n    sphereEndSource.SetCenter(endPoint)\n    sphereEndSource.SetRadius(0.8)\n    sphereEndMapper = vtkPolyDataMapper()\n    sphereEndMapper.SetInputConnection(sphereEndSource.GetOutputPort())\n    sphereEnd = vtkActor()\n    sphereEnd.SetMapper(sphereEndMapper)\n    sphereEnd.GetProperty().SetColor(colors.GetColor3d('Magenta'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('OrientedArrow')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor(sphereStart)\n    renderer.AddActor(sphereEnd)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/OrientedCylinder/","title":"OrientedCylinder","text":"

vtk-examples/Python/GeometricObjects/OrientedCylinder

"},{"location":"Python/GeometricObjects/OrientedCylinder/#description","title":"Description","text":"

This example illustrates how to create and display a cylinder that passes through two points.

It demonstrates two different ways to apply the transform:

  1. Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter.

  2. Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

Switch between the two methods by setting USER_MATRIX to True or False.

Seealso

Compare this example with OrientedArrow. The transform is different because the cylinder height

direction is along the y-axis and the arrow height is along the x axis.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/OrientedCylinder/#code","title":"Code","text":"

OrientedCylinder.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMath,\n    vtkMinimalStandardRandomSequence\n)\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCylinderSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\"\"\"\nThere are two alternative ways to apply the transform.\n 1) Use vtkTransformPolyDataFilter to create a new transformed polydata.\n    This method is useful if the transformed polydata is needed\n      later in the pipeline\n    To do this, set USER_MATRIX = True\n 2) Apply the transform directly to the actor using vtkProp3D's SetUserMatrix.\n    No new data is produced.\n    To do this, set USER_MATRIX = False\n\"\"\"\nUSER_MATRIX = True\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 77, 255])\n\n    # Create a cylinder.\n    # Cylinder height vector is (0,1,0).\n    # Cylinder center is in the middle of the cylinder\n    cylinderSource = vtkCylinderSource()\n    cylinderSource.SetResolution(15)\n\n    # Generate a random start and end point\n    startPoint = [0] * 3\n    endPoint = [0] * 3\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(8775070)  # For testing.\n    for i in range(0, 3):\n        rng.Next()\n        startPoint[i] = rng.GetRangeValue(-10, 10)\n        rng.Next()\n        endPoint[i] = rng.GetRangeValue(-10, 10)\n\n    # Compute a basis\n    normalizedX = [0] * 3\n    normalizedY = [0] * 3\n    normalizedZ = [0] * 3\n\n    # The X axis is a vector from start to end\n    vtkMath.Subtract(endPoint, startPoint, normalizedX)\n    length = vtkMath.Norm(normalizedX)\n    vtkMath.Normalize(normalizedX)\n\n    # The Z axis is an arbitrary vector cross X\n    arbitrary = [0] * 3\n    for i in range(0, 3):\n        rng.Next()\n        arbitrary[i] = rng.GetRangeValue(-10, 10)\n    vtkMath.Cross(normalizedX, arbitrary, normalizedZ)\n    vtkMath.Normalize(normalizedZ)\n\n    # The Y axis is Z cross X\n    vtkMath.Cross(normalizedZ, normalizedX, normalizedY)\n    matrix = vtkMatrix4x4()\n\n    # Create the direction cosine matrix\n    matrix.Identity()\n    for i in range(0, 3):\n        matrix.SetElement(i, 0, normalizedX[i])\n        matrix.SetElement(i, 1, normalizedY[i])\n        matrix.SetElement(i, 2, normalizedZ[i])\n\n    # Apply the transforms\n    transform = vtkTransform()\n    transform.Translate(startPoint)  # translate to starting point\n    transform.Concatenate(matrix)  # apply direction cosines\n    transform.RotateZ(-90.0)  # align cylinder to x axis\n    transform.Scale(1.0, length, 1.0)  # scale along the height vector\n    transform.Translate(0, .5, 0)  # translate to start of cylinder\n\n    # Transform the polydata\n    transformPD = vtkTransformPolyDataFilter()\n    transformPD.SetTransform(transform)\n    transformPD.SetInputConnection(cylinderSource.GetOutputPort())\n\n    # Create a mapper and actor for the arrow\n    mapper = vtkPolyDataMapper()\n    actor = vtkActor()\n    if USER_MATRIX:\n        mapper.SetInputConnection(cylinderSource.GetOutputPort())\n        actor.SetUserMatrix(transform.GetMatrix())\n    else:\n        mapper.SetInputConnection(transformPD.GetOutputPort())\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Cyan'))\n\n    # Create spheres for start and end point\n    sphereStartSource = vtkSphereSource()\n    sphereStartSource.SetCenter(startPoint)\n    sphereStartSource.SetRadius(0.8)\n    sphereStartMapper = vtkPolyDataMapper()\n    sphereStartMapper.SetInputConnection(sphereStartSource.GetOutputPort())\n    sphereStart = vtkActor()\n    sphereStart.SetMapper(sphereStartMapper)\n    sphereStart.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n\n    sphereEndSource = vtkSphereSource()\n    sphereEndSource.SetCenter(endPoint)\n    sphereEndSource.SetRadius(0.8)\n    sphereEndMapper = vtkPolyDataMapper()\n    sphereEndMapper.SetInputConnection(sphereEndSource.GetOutputPort())\n    sphereEnd = vtkActor()\n    sphereEnd.SetMapper(sphereEndMapper)\n    sphereEnd.GetProperty().SetColor(colors.GetColor3d('Magenta'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('Oriented Cylinder')\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor(sphereStart)\n    renderer.AddActor(sphereEnd)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/ParametricKuenDemo/","title":"ParametricKuenDemo","text":"

vtk-examples/Python/GeometricObjects/ParametricKuenDemo

"},{"location":"Python/GeometricObjects/ParametricKuenDemo/#description","title":"Description","text":"

The example shows interaction with the vtkParametricKuen vtkParametricFunctionSource. The Kuen Surface This surface of constant Gaussian curvature K = -1 was discovered early. It is very popular because of its beauty.

Here's the embedded video:

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/ParametricKuenDemo/#code","title":"Code","text":"

ParametricKuenDemo.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import vtkParametricKuen\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkMath\n)\nfrom vtkmodules.vtkFiltersSources import vtkParametricFunctionSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    surface = vtkParametricKuen()\n    source = vtkParametricFunctionSource()\n\n    renderer = vtkRenderer()\n    mapper = vtkPolyDataMapper()\n    actor = vtkActor()\n\n    backProperty = vtkProperty()\n    backProperty.SetColor(colors.GetColor3d('Tomato'))\n\n    # Create a parametric function source, renderer, mapper, and actor\n    source.SetParametricFunction(surface)\n\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor.SetMapper(mapper)\n    actor.SetBackfaceProperty(backProperty)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n    actor.GetProperty().SetSpecular(.5)\n    actor.GetProperty().SetSpecularPower(20)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('ParametricKuenDemo')\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Setup a slider widget for each varying parameter\n    tubeWidth = 0.008\n    sliderLength = 0.008\n    titleHeight = 0.02\n    labelHeight = 0.02\n\n    sliderRepMinimumU = vtkSliderRepresentation2D()\n\n    sliderRepMinimumU.SetMinimumValue(-4.5)\n    sliderRepMinimumU.SetMaximumValue(4.5)\n    sliderRepMinimumU.SetValue(-4.5)\n    sliderRepMinimumU.SetTitleText('U min')\n\n    sliderRepMinimumU.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumU.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepMinimumU.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumU.GetPoint2Coordinate().SetValue(.9, .1)\n\n    sliderRepMinimumU.SetTubeWidth(tubeWidth)\n    sliderRepMinimumU.SetSliderLength(sliderLength)\n    sliderRepMinimumU.SetTitleHeight(titleHeight)\n    sliderRepMinimumU.SetLabelHeight(labelHeight)\n\n    sliderWidgetMinimumU = vtkSliderWidget()\n    sliderWidgetMinimumU.SetInteractor(interactor)\n    sliderWidgetMinimumU.SetRepresentation(sliderRepMinimumU)\n    sliderWidgetMinimumU.SetAnimationModeToAnimate()\n    sliderWidgetMinimumU.EnabledOn()\n\n    sliderWidgetMinimumU.AddObserver('InteractionEvent', SliderCallbackMinimumU(surface))\n\n    sliderRepMaximumU = vtkSliderRepresentation2D()\n\n    sliderRepMaximumU.SetMinimumValue(-4.5)\n    sliderRepMaximumU.SetMaximumValue(4.5)\n    sliderRepMaximumU.SetValue(4.5)\n    sliderRepMaximumU.SetTitleText('U max')\n\n    sliderRepMaximumU.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMaximumU.GetPoint1Coordinate().SetValue(.1, .9)\n    sliderRepMaximumU.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMaximumU.GetPoint2Coordinate().SetValue(.9, .9)\n\n    sliderRepMaximumU.SetTubeWidth(tubeWidth)\n    sliderRepMaximumU.SetSliderLength(sliderLength)\n    sliderRepMaximumU.SetTitleHeight(titleHeight)\n    sliderRepMaximumU.SetLabelHeight(labelHeight)\n\n    sliderWidgetMaximumU = vtkSliderWidget()\n    sliderWidgetMaximumU.SetInteractor(interactor)\n    sliderWidgetMaximumU.SetRepresentation(sliderRepMaximumU)\n    sliderWidgetMaximumU.SetAnimationModeToAnimate()\n    sliderWidgetMaximumU.EnabledOn()\n\n    sliderWidgetMaximumU.AddObserver('InteractionEvent', SliderCallbackMaximumU(surface))\n\n    sliderRepMinimumV = vtkSliderRepresentation2D()\n\n    sliderRepMinimumV.SetMinimumValue(0.05)\n    sliderRepMinimumV.SetMaximumValue(vtkMath.Pi())\n    sliderRepMinimumV.SetValue(0.0)\n    sliderRepMinimumV.SetTitleText('V min')\n\n    sliderRepMinimumV.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepMinimumV.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint2Coordinate().SetValue(.1, .9)\n\n    sliderRepMinimumV.SetTubeWidth(tubeWidth)\n    sliderRepMinimumV.SetSliderLength(sliderLength)\n    sliderRepMinimumV.SetTitleHeight(titleHeight)\n    sliderRepMinimumV.SetLabelHeight(labelHeight)\n\n    sliderWidgetMinimumV = vtkSliderWidget()\n    sliderWidgetMinimumV.SetInteractor(interactor)\n    sliderWidgetMinimumV.SetRepresentation(sliderRepMinimumV)\n    sliderWidgetMinimumV.SetAnimationModeToAnimate()\n    sliderWidgetMinimumV.EnabledOn()\n\n    sliderWidgetMinimumV.AddObserver(vtkCommand.InteractionEvent, SliderCallbackMinimumV(surface))\n\n    sliderRepMaximumV = vtkSliderRepresentation2D()\n\n    sliderRepMaximumV.SetMinimumValue(0.05)\n    sliderRepMaximumV.SetMaximumValue(vtkMath.Pi() - .05)\n    sliderRepMaximumV.SetValue(vtkMath.Pi())\n    sliderRepMaximumV.SetTitleText('V max')\n\n    sliderRepMaximumV.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMaximumV.GetPoint1Coordinate().SetValue(.9, .1)\n    sliderRepMaximumV.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMaximumV.GetPoint2Coordinate().SetValue(.9, .9)\n    sliderRepMaximumV.SetTubeWidth(tubeWidth)\n    sliderRepMaximumV.SetSliderLength(sliderLength)\n    sliderRepMaximumV.SetTitleHeight(titleHeight)\n    sliderRepMaximumV.SetLabelHeight(labelHeight)\n\n    sliderWidgetMaximumV = vtkSliderWidget()\n    sliderWidgetMaximumV.SetInteractor(interactor)\n    sliderWidgetMaximumV.SetRepresentation(sliderRepMaximumV)\n    sliderWidgetMaximumV.SetAnimationModeToAnimate()\n    sliderWidgetMaximumV.EnabledOn()\n\n    sliderWidgetMaximumV.AddObserver(vtkCommand.InteractionEvent, SliderCallbackMaximumV(surface))\n\n    surface.SetMinimumU(-4.5)\n    surface.SetMaximumU(4.5)\n    surface.SetMinimumV(0.05)\n    surface.SetMaximumV(vtkMath.Pi() - .05)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n    renderWindow.Render()\n\n    interactor.Initialize()\n\n    interactor.Start()\n\n\n# These callbacks do the actual work.\n# Callbacks for the interactions\nclass SliderCallbackMinimumU():\n    def __init__(self, kuen):\n        self.kuen = kuen\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        if value > 0.9 * self.kuen.GetMaximumU():\n            value = 0.99 * self.kuen.GetMaximumU()\n            sliderWidget.GetRepresentation().SetValue(value)\n        self.kuen.SetMinimumU(value)\n\n\nclass SliderCallbackMaximumU():\n    def __init__(self, kuen):\n        self.kuen = kuen\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        if value < self.kuen.GetMinimumU() + .01:\n            value = self.kuen.GetMinimumU() + .01\n            sliderWidget.GetRepresentation().SetValue(value)\n        self.kuen.SetMaximumU(value)\n\n\nclass SliderCallbackMinimumV():\n    def __init__(self, kuen):\n        self.kuen = kuen\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        if value > 0.9 * self.kuen.GetMaximumV():\n            value = 0.99 * self.kuen.GetMaximumV()\n            sliderWidget.GetRepresentation().SetValue(value)\n        self.kuen.SetMinimumV(value)\n\n\nclass SliderCallbackMaximumV():\n    def __init__(self, kuen):\n        self.kuen = kuen\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        if value < self.kuen.GetMinimumV() + .01:\n            value = self.kuen.GetMinimumV() + .01\n            sliderWidget.GetRepresentation().SetValue(value)\n        self.kuen.SetMaximumV(value)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/ParametricObjectsDemo/","title":"ParametricObjectsDemo","text":"

vtk-examples/Python/GeometricObjects/ParametricObjectsDemo

"},{"location":"Python/GeometricObjects/ParametricObjectsDemo/#description","title":"Description","text":"

Demonstrates the Parametric classes added by Andrew Maclean and additional classes added by Tim Meehan. The parametric spline is also included.

Options are provided to:

  • Specify a single surface (-s SURFACE_NAME)
  • Color the back-face (-b)
  • Add normals (-n)
  • Display the geometric bounds of the object (-l)

You can save a screenshot by pressing \"k\".

With respect to your VTK build you may need to specify one or more of:

-DVTK_MODULE_ENABLE_VTK_cli11=WANT\n-DVTK_MODULE_ENABLE_VTK_fmt=WANT\n

If -DVTK_BUILD_TESTING=ON is specified when building VTK then VTK:cli11 and VTK::fmt will be automatically enabled.

Note

To really appreciate the complexity of some of these surfaces, select a single surface, and use the options -b -n. Also try specifying wireframe (toggle \"w\" on the keyboard) and zooming in and out.

Tip

If you color the back face, the three-dimensional orientable surfaces will only show backface coloring inside the surface e.g ConicSpiral or Torus. For three dimensional non-orientable surfaces; backface coloring is visible because of the twisting used to generate these surfaces e.g Boy or Figure8Klein.

Cite

See: Parametric Equations for Surfaces, for more information. This paper provides a description of fifteen surfaces, including their parametric equations and derivatives. Also provided is an example of how to create your own surface, namely the Figure-8 Torus.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/ParametricObjectsDemo/#code","title":"Code","text":"

ParametricObjectsDemo.py

#!/usr/bin/env python3\n\n\"\"\"\n    Demonstrate all the parametric objects.\n\"\"\"\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBohemianDome,\n    vtkParametricBour,\n    vtkParametricBoy,\n    vtkParametricCatalanMinimal,\n    vtkParametricConicSpiral,\n    vtkParametricCrossCap,\n    vtkParametricDini,\n    vtkParametricEllipsoid,\n    vtkParametricEnneper,\n    vtkParametricFigure8Klein,\n    vtkParametricHenneberg,\n    vtkParametricKlein,\n    vtkParametricKuen,\n    vtkParametricMobius,\n    vtkParametricPluckerConoid,\n    vtkParametricPseudosphere,\n    vtkParametricRandomHills,\n    vtkParametricRoman,\n    vtkParametricSpline,\n    vtkParametricSuperEllipsoid,\n    vtkParametricSuperToroid,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkGlyph3D,\n    vtkMaskPoints\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkParametricFunctionSource\n)\nfrom vtkmodules.vtkIOImage import (\n    vtkPNGWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty,\n    vtkWindowToImageFilter\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Display the parametric surfaces.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-s', '--surface_name', default=None, help='The name of the surface.')\n    parser.add_argument('-b', '--back_face', action='store_true', help='Color the back face.')\n    parser.add_argument('-n', '--normals', action='store_true', help='Display normals.')\n    parser.add_argument('-l', '--limits', action='store_true', help='Display the geometric bounds of the object..')\n    args = parser.parse_args()\n    return args.surface_name, args.back_face, args.normals, args.limits\n\n\ndef main():\n    surface_name, back_face, normals, limits = get_program_parameters()\n\n    # Get the parametric functions and build the pipeline\n    pfn = get_parametric_functions()\n\n    # Check for a single surface.\n    single_surface = [None, False]\n    if surface_name:\n        sn = surface_name.lower()\n        for t in pfn.keys():\n            if sn == t.lower():\n                single_surface[0] = t\n                single_surface[1] = True\n    if surface_name and not single_surface[1]:\n        print('Nonexistent surface:', surface_name)\n        return\n\n    if single_surface[1]:\n        renderer_size = 1000\n        grid_column_dimensions = 1\n        grid_row_dimensions = 1\n    else:\n        renderer_size = 200\n        grid_column_dimensions = 5\n        grid_row_dimensions = 5\n\n    colors = vtkNamedColors()\n\n    # Create one text property for all.\n    text_property = vtkTextProperty()\n    text_property.SetJustificationToCentered()\n    text_property.SetFontSize(int(renderer_size / 12))\n    text_property.SetColor(colors.GetColor3d(\"LavenderBlush\"))\n\n    # Create a parametric function source, renderer, mapper, and actor\n    # for each object.\n    pfn_srcs = []\n    renderers = []\n    mappers = []\n    actors = []\n    text_mappers = []\n    text_actors = []\n\n    # Glyph the normals.\n    mask_pts = []\n    arrow = []\n    glyph = []\n    glyph_mapper = []\n    glyph_actor = []\n\n    back_property = vtkProperty()\n    if back_face:\n        back_property.SetColor(colors.GetColor3d(\"Peru\"))\n\n    # Now decide on the surfaces to build.\n    surfaces = dict()\n    if single_surface[1]:\n        surfaces[single_surface[0]] = pfn[single_surface[0]]\n    else:\n        surfaces = pfn\n\n    # The bounding boxes for each object.\n    bounding_boxes = dict()\n    indexed_names = dict()\n    # The index of each parametric object.\n    obj_idx = -1\n    sorted_names = list()\n    for obj in sorted(surfaces.keys()):\n        obj_idx += 1\n        indexed_names[obj_idx] = obj\n        pfn_srcs.append(vtkParametricFunctionSource())\n        pfn_srcs[obj_idx].SetParametricFunction(surfaces[obj])\n        pfn_srcs[obj_idx].SetUResolution(51)\n        pfn_srcs[obj_idx].SetVResolution(51)\n        pfn_srcs[obj_idx].SetWResolution(51)\n        pfn_srcs[obj_idx].Update()\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[obj_idx].SetInputConnection(pfn_srcs[obj_idx].GetOutputPort())\n\n        actors.append(vtkActor())\n        actors[obj_idx].SetMapper(mappers[obj_idx])\n        actors[obj_idx].GetProperty().SetColor(colors.GetColor3d(\"NavajoWhite\"))\n        if back_face:\n            actors[obj_idx].SetBackfaceProperty(back_property)\n\n        text_mappers.append(vtkTextMapper())\n        text_mappers[obj_idx].SetInput(obj)\n        text_mappers[obj_idx].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[obj_idx].SetMapper(text_mappers[obj_idx])\n        text_actors[obj_idx].SetPosition(renderer_size / 2.0, 8)\n\n        renderers.append(vtkRenderer())\n        renderers[obj_idx].SetBackground(colors.GetColor3d(\"MidnightBlue\"))\n\n        bounds = pfn_srcs[obj_idx].GetOutput().GetBounds()\n        bounding_boxes[obj] = bounds\n\n        if normals:\n            # Glyphing\n            mask_pts.append(vtkMaskPoints())\n            mask_pts[obj_idx].RandomModeOn()\n            mask_pts[obj_idx].SetMaximumNumberOfPoints(150)\n            mask_pts[obj_idx].SetInputConnection(pfn_srcs[obj_idx].GetOutputPort())\n\n            arrow.append(vtkArrowSource())\n            arrow[obj_idx].SetTipResolution(16)\n            arrow[obj_idx].SetTipLength(0.3)\n            arrow[obj_idx].SetTipRadius(0.1)\n\n            glyph_scale = get_maximum_length(bounding_boxes[obj])\n\n            glyph.append(vtkGlyph3D())\n            glyph[obj_idx].SetSourceConnection(arrow[obj_idx].GetOutputPort())\n            glyph[obj_idx].SetInputConnection(mask_pts[obj_idx].GetOutputPort())\n            glyph[obj_idx].SetVectorModeToUseNormal()\n            glyph[obj_idx].SetScaleFactor(glyph_scale / 10.0)\n            glyph[obj_idx].OrientOn()\n            glyph[obj_idx].Update()\n\n            glyph_mapper.append(vtkPolyDataMapper())\n            glyph_mapper[obj_idx].SetInputConnection(\n                glyph[obj_idx].GetOutputPort())\n\n            glyph_actor.append(vtkActor())\n            glyph_actor[obj_idx].SetMapper(glyph_mapper[obj_idx])\n            glyph_actor[obj_idx].GetProperty().SetColor(colors.GetColor3d(\"GreenYellow\"))\n\n    # Need a renderer even if there is no actor.\n    for i in range(obj_idx + 1, grid_column_dimensions * grid_row_dimensions):\n        renderers.append(vtkRenderer())\n        renderers[i].SetBackground(colors.GetColor3d(\"MidnightBlue\"))\n        sorted_names.append(None)\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(renderer_size * grid_column_dimensions, renderer_size * grid_row_dimensions)\n\n    for row in range(0, grid_row_dimensions):\n        for col in range(0, grid_column_dimensions):\n            index = row * grid_column_dimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [\n                float(col) * renderer_size / (grid_column_dimensions * renderer_size),\n                float(grid_row_dimensions - (row + 1)) * renderer_size / (grid_row_dimensions * renderer_size),\n                float(col + 1) * renderer_size / (grid_column_dimensions * renderer_size),\n                float(grid_row_dimensions - row) * renderer_size / (grid_row_dimensions * renderer_size)]\n            ren_win.AddRenderer(renderers[index])\n            renderers[index].SetViewport(viewport)\n            if index > obj_idx:\n                continue\n            renderers[index].AddActor(actors[index])\n            # Normals can only be computed for polygons and triangle strips.\n            # The Spline is a line.\n            if normals and indexed_names[index] != 'Spline':\n                renderers[index].AddActor(glyph_actor[index])\n            renderers[index].AddActor(text_actors[index])\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(30)\n            renderers[index].GetActiveCamera().Elevation(-30)\n            renderers[index].GetActiveCamera().Zoom(0.9)\n            renderers[index].ResetCameraClippingRange()\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    if limits:\n        for k, v in bounding_boxes.items():\n            display_bounding_box_and_center(k, v)\n\n    if surface_name:\n        fn = single_surface[0]\n    else:\n        fn = 'ParametricObjectsDemo'\n    ren_win.SetWindowName(fn)\n\n    print_callback = PrintCallback(iren, fn, 1, False)\n    iren.AddObserver('KeyPressEvent', print_callback)\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_parametric_functions():\n    \"\"\"\n    Create a map of the parametric functions and set some parameters.\n    The first key groups the parametric functions and the\n      second key is the name of the function.\n\n    :return: The map of functions.\n    \"\"\"\n    pfn = dict()\n    pfn['Boy'] = vtkParametricBoy()\n    pfn['ConicSpiral'] = vtkParametricConicSpiral()\n    pfn['CrossCap'] = vtkParametricCrossCap()\n    pfn['Dini'] = vtkParametricDini()\n    pfn['Ellipsoid'] = vtkParametricEllipsoid()\n    pfn['Enneper'] = vtkParametricEnneper()\n    pfn['Figure8Klein'] = vtkParametricFigure8Klein()\n    pfn['Klein'] = vtkParametricKlein()\n    pfn['Mobius'] = vtkParametricMobius()\n    pfn['RandomHills'] = vtkParametricRandomHills()\n    pfn['Roman'] = vtkParametricRoman()\n    pfn['SuperEllipsoid'] = vtkParametricSuperEllipsoid()\n    pfn['SuperToroid'] = vtkParametricSuperToroid()\n    pfn['Torus'] = vtkParametricTorus()\n    pfn['Spline'] = vtkParametricSpline()\n    # Extra parametric surfaces.\n    pfn['BohemianDome'] = vtkParametricBohemianDome()\n    pfn['Bour'] = vtkParametricBour()\n    pfn['CatalanMinimal'] = vtkParametricCatalanMinimal()\n    pfn['Henneberg'] = vtkParametricHenneberg()\n    pfn['Kuen'] = vtkParametricKuen()\n    pfn['PluckerConoid'] = vtkParametricPluckerConoid()\n    pfn['Pseudosphere'] = vtkParametricPseudosphere()\n    # Now set some parameters.\n    pfn[\"Ellipsoid\"].SetXRadius(0.5)\n    pfn[\"Ellipsoid\"].SetYRadius(2.0)\n    pfn[\"Mobius\"].SetRadius(2.0)\n    pfn[\"Mobius\"].SetMinimumV(-0.5)\n    pfn[\"Mobius\"].SetMaximumV(0.5)\n    pfn[\"RandomHills\"].AllowRandomGenerationOn()\n    pfn[\"RandomHills\"].SetRandomSeed(1)\n    pfn[\"RandomHills\"].SetNumberOfHills(30)\n    pfn[\"SuperEllipsoid\"].SetN1(0.5)\n    pfn[\"SuperEllipsoid\"].SetN2(0.4)\n    pfn[\"SuperToroid\"].SetN1(0.5)\n    pfn[\"SuperToroid\"].SetN2(3.0)\n    # The spline needs points\n    spline_points = vtkPoints()\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(8775070)\n    for p in range(0, 10):\n        xyz = [None] * 3\n        for idx in range(0, len(xyz)):\n            xyz[idx] = rng.GetRangeValue(-1.0, 1.0)\n            rng.Next()\n        spline_points.InsertNextPoint(xyz)\n\n    pfn[\"Spline\"].SetPoints(spline_points)\n    # Extra parametric surfaces.\n    pfn[\"BohemianDome\"].SetA(5.0)\n    pfn[\"BohemianDome\"].SetB(1.0)\n    pfn[\"BohemianDome\"].SetC(2.0)\n    pfn[\"Kuen\"].SetDeltaV0(0.001)\n\n    return pfn\n\n\ndef get_centre(bounds):\n    \"\"\"\n    Get the centre of the object from the bounding box.\n\n    :param bounds: The bounding box of the object.\n    :return:\n    \"\"\"\n    if len(bounds) != 6:\n        return None\n    return [bounds[i] - (bounds[i] - bounds[i - 1]) / 2.0 for i in range(1, len(bounds), 2)]\n\n\ndef get_maximum_length(bounds):\n    \"\"\"\n    Calculate the maximum length of the side bounding box.\n\n    :param bounds: The bounding box of the object.\n    :return:\n    \"\"\"\n    if len(bounds) != 6:\n        return None\n    return max([bounds[i] - bounds[i - 1] for i in range(1, len(bounds), 2)])\n\n\ndef display_bounding_box_and_center(name, bounds):\n    \"\"\"\n    Display the dimensions of the bounding box, maximum diagonal length\n     and coordinates of the centre.\n\n    :param name: The name of the object.\n    :param bounds: The bounding box of the object.\n    :return:\n    \"\"\"\n    if len(bounds) != 6:\n        return\n    max_len = get_maximum_length(bounds)\n    centre = get_centre(bounds)\n    s = '{:21s}\\n'.format(name)\n    s += '{:21s}{:1s}'.format('  Bounds (min, max)', ':')\n    s += '{:s}({:6.2f}, {:6.2f})'.format(' x:', bounds[0], bounds[1])\n    s += '{:s}({:6.2f}, {:6.2f})'.format(' y:', bounds[2], bounds[3])\n    s += '{:s}({:6.2f}, {:6.2f})\\n'.format(' z:', bounds[4], bounds[5])\n    if max_len:\n        s += '  Maximum side length: {:6.2f}\\n'.format(max_len)\n    if centre:\n        s += '  Centre (x, y, z)   : ({:6.2f}, {:6.2f}, {:6.2f})\\n'.format(centre[0], centre[1], centre[2])\n    print(s)\n\n\nclass PrintCallback:\n    def __init__(self, caller, file_name, image_quality=1, rgba=True):\n        self.caller = caller\n        self.image_quality = image_quality\n        # rgba is the the buffer type,\n        #  (if true, there is no background in the screenshot).\n        self.rgba = rgba\n        parent = Path(file_name).resolve().parent\n        pth = Path(parent) / file_name\n        self.path = Path(str(pth)).with_suffix('.png')\n\n    def __call__(self, caller, ev):\n        # Save the screenshot.\n        if caller.GetKeyCode() == \"k\":\n            w2if = vtkWindowToImageFilter()\n            w2if.SetInput(caller.GetRenderWindow())\n            w2if.SetScale(self.image_quality, self.image_quality)\n            if self.rgba:\n                w2if.SetInputBufferTypeToRGBA()\n            else:\n                w2if.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            w2if.ReadFrontBufferOn()\n            w2if.Update()\n            writer = vtkPNGWriter()\n            writer.SetFileName(self.path)\n            writer.SetInputData(w2if.GetOutput())\n            writer.Write()\n            print('Screenshot saved to:', self.path.name)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/ParametricSuperEllipsoidDemo/","title":"ParametricSuperEllipsoidDemo","text":"

vtk-examples/Python/GeometricObjects/ParametricSuperEllipsoidDemo

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/ParametricSuperEllipsoidDemo/#code","title":"Code","text":"

ParametricSuperEllipsoidDemo.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import vtkParametricSuperEllipsoid\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkMath\n)\nfrom vtkmodules.vtkFiltersSources import vtkParametricFunctionSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    surface = vtkParametricSuperEllipsoid()\n    source = vtkParametricFunctionSource()\n\n    renderer = vtkRenderer()\n    mapper = vtkPolyDataMapper()\n    actor = vtkActor()\n\n    backProperty = vtkProperty()\n    backProperty.SetColor(colors.GetColor3d('Tomato'))\n\n    # Create a parametric function source, renderer, mapper, and actor\n    source.SetParametricFunction(surface)\n\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor.SetMapper(mapper)\n    actor.SetBackfaceProperty(backProperty)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n    actor.GetProperty().SetSpecular(.5)\n    actor.GetProperty().SetSpecularPower(20)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('ParametricSuperEllipsoidDemo')\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Setup a slider widget for each varying parameter\n    tubeWidth = 0.008\n    sliderLength = 0.008\n    titleHeight = 0.04\n    labelHeight = 0.04\n\n    sliderRepN1 = vtkSliderRepresentation2D()\n\n    sliderRepN1.SetMinimumValue(0.0)\n    sliderRepN1.SetMaximumValue(4.0)\n    sliderRepN1.SetValue(1.0)\n    sliderRepN1.SetTitleText('Z squareness')\n\n    sliderRepN1.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN1.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepN1.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN1.GetPoint2Coordinate().SetValue(.9, .1)\n\n    sliderRepN1.SetTubeWidth(tubeWidth)\n    sliderRepN1.SetSliderLength(sliderLength)\n    sliderRepN1.SetTitleHeight(titleHeight)\n    sliderRepN1.SetLabelHeight(labelHeight)\n\n    sliderWidgetN1 = vtkSliderWidget()\n    sliderWidgetN1.SetInteractor(interactor)\n    sliderWidgetN1.SetRepresentation(sliderRepN1)\n    sliderWidgetN1.SetAnimationModeToAnimate()\n    sliderWidgetN1.EnabledOn()\n\n    sliderWidgetN1.AddObserver(vtkCommand.InteractionEvent, SliderCallbackN1(surface))\n\n    sliderRepN2 = vtkSliderRepresentation2D()\n\n    sliderRepN2.SetMinimumValue(0.0001)\n    sliderRepN2.SetMaximumValue(4.0)\n    sliderRepN2.SetValue(1.0)\n    sliderRepN2.SetTitleText('XY squareness')\n\n    sliderRepN2.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN2.GetPoint1Coordinate().SetValue(.1, .9)\n    sliderRepN2.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN2.GetPoint2Coordinate().SetValue(.9, .9)\n\n    sliderRepN2.SetTubeWidth(tubeWidth)\n    sliderRepN2.SetSliderLength(sliderLength)\n    sliderRepN2.SetTitleHeight(titleHeight)\n    sliderRepN2.SetLabelHeight(labelHeight)\n\n    sliderWidgetN2 = vtkSliderWidget()\n    sliderWidgetN2.SetInteractor(interactor)\n    sliderWidgetN2.SetRepresentation(sliderRepN2)\n    sliderWidgetN2.SetAnimationModeToAnimate()\n    sliderWidgetN2.EnabledOn()\n\n    sliderWidgetN2.AddObserver(vtkCommand.InteractionEvent, SliderCallbackN2(surface))\n\n    sliderRepMinimumV = vtkSliderRepresentation2D()\n\n    sliderRepN1.SetMinimumValue(.0001)\n    sliderRepMinimumV.SetMaximumValue(.9999 * vtkMath.Pi())\n    sliderRepMinimumV.SetValue(.0001)\n    sliderRepMinimumV.SetTitleText('V min')\n\n    sliderRepMinimumV.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepMinimumV.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint2Coordinate().SetValue(.1, .9)\n\n    sliderRepMinimumV.SetTubeWidth(tubeWidth)\n    sliderRepMinimumV.SetSliderLength(sliderLength)\n    sliderRepMinimumV.SetTitleHeight(titleHeight)\n    sliderRepMinimumV.SetLabelHeight(labelHeight)\n\n    surface.SetN1(1.0)\n    surface.SetN2(1.0)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n    renderWindow.Render()\n\n    interactor.Initialize()\n\n    interactor.Start()\n\n\n# These callbacks do the actual work.\n# Callbacks for the interactions\n\nclass SliderCallbackN1():\n    def __init__(self, superEllipsoid):\n        self.superEllipsoid = superEllipsoid\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.superEllipsoid.SetN1(value)\n\n\nclass SliderCallbackN2():\n    def __init__(self, superEllipsoid):\n        self.superEllipsoid = superEllipsoid\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.superEllipsoid.SetN2(value)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/ParametricSuperToroidDemo/","title":"ParametricSuperToroidDemo","text":"

vtk-examples/Python/GeometricObjects/ParametricSuperToroidDemo

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/ParametricSuperToroidDemo/#code","title":"Code","text":"

ParametricSuperToroidDemo.py

# !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import vtkParametricSuperToroid\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkMath\n)\nfrom vtkmodules.vtkFiltersSources import vtkParametricFunctionSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    surface = vtkParametricSuperToroid()\n    source = vtkParametricFunctionSource()\n\n    renderer = vtkRenderer()\n    mapper = vtkPolyDataMapper()\n    actor = vtkActor()\n\n    backProperty = vtkProperty()\n    backProperty.SetColor(colors.GetColor3d('Tomato'))\n\n    # Create a parametric function source, renderer, mapper, and actor\n    source.SetParametricFunction(surface)\n\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor.SetMapper(mapper)\n    actor.SetBackfaceProperty(backProperty)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n    actor.GetProperty().SetSpecular(.5)\n    actor.GetProperty().SetSpecularPower(20)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('ParametricSuperToroidDemo')\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Setup a slider widget for each varying parameter\n    tubeWidth = 0.008\n    sliderLength = 0.008\n    titleHeight = 0.04\n    labelHeight = 0.04\n\n    sliderRepN1 = vtkSliderRepresentation2D()\n\n    sliderRepN1.SetMinimumValue(0.0)\n    sliderRepN1.SetMaximumValue(4.0)\n    sliderRepN1.SetValue(1.0)\n    sliderRepN1.SetTitleText('Z squareness')\n\n    sliderRepN1.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN1.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepN1.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN1.GetPoint2Coordinate().SetValue(.9, .1)\n\n    sliderRepN1.SetTubeWidth(tubeWidth)\n    sliderRepN1.SetSliderLength(sliderLength)\n    sliderRepN1.SetTitleHeight(titleHeight)\n    sliderRepN1.SetLabelHeight(labelHeight)\n\n    sliderWidgetN1 = vtkSliderWidget()\n    sliderWidgetN1.SetInteractor(interactor)\n    sliderWidgetN1.SetRepresentation(sliderRepN1)\n    sliderWidgetN1.SetAnimationModeToAnimate()\n    sliderWidgetN1.EnabledOn()\n\n    sliderWidgetN1.AddObserver(vtkCommand.InteractionEvent, SliderCallbackN1(surface))\n\n    sliderRepN2 = vtkSliderRepresentation2D()\n\n    sliderRepN2.SetMinimumValue(0.0001)\n    sliderRepN2.SetMaximumValue(4.0)\n    sliderRepN2.SetValue(1.0)\n    sliderRepN2.SetTitleText('XY squareness')\n\n    sliderRepN2.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN2.GetPoint1Coordinate().SetValue(.1, .9)\n    sliderRepN2.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN2.GetPoint2Coordinate().SetValue(.9, .9)\n\n    sliderRepN2.SetTubeWidth(tubeWidth)\n    sliderRepN2.SetSliderLength(sliderLength)\n    sliderRepN2.SetTitleHeight(titleHeight)\n    sliderRepN2.SetLabelHeight(labelHeight)\n\n    sliderWidgetN2 = vtkSliderWidget()\n    sliderWidgetN2.SetInteractor(interactor)\n    sliderWidgetN2.SetRepresentation(sliderRepN2)\n    sliderWidgetN2.SetAnimationModeToAnimate()\n    sliderWidgetN2.EnabledOn()\n\n    sliderWidgetN2.AddObserver(vtkCommand.InteractionEvent, SliderCallbackN2(surface))\n\n    sliderRepMinimumV = vtkSliderRepresentation2D()\n\n    sliderRepN1.SetMinimumValue(.0001)\n    sliderRepMinimumV.SetMaximumValue(.9999 * vtkMath.Pi())\n    sliderRepMinimumV.SetValue(.0001)\n    sliderRepMinimumV.SetTitleText('V min')\n\n    sliderRepMinimumV.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepMinimumV.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint2Coordinate().SetValue(.1, .9)\n\n    sliderRepMinimumV.SetTubeWidth(tubeWidth)\n    sliderRepMinimumV.SetSliderLength(sliderLength)\n    sliderRepMinimumV.SetTitleHeight(titleHeight)\n    sliderRepMinimumV.SetLabelHeight(labelHeight)\n\n    surface.SetN1(1.0)\n    surface.SetN2(1.0)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n    renderWindow.Render()\n\n    interactor.Initialize()\n\n    interactor.Start()\n\n\n# These callbacks do the actual work.\n# Callbacks for the interactions\n\nclass SliderCallbackN1():\n    def __init__(self, superToroid):\n        self.superToroid = superToroid\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.superToroid.SetN1(value)\n\n\nclass SliderCallbackN2():\n    def __init__(self, superToroid):\n        self.superToroid = superToroid\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.superToroid.SetN2(value)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Plane/","title":"Plane","text":"

vtk-examples/Python/GeometricObjects/Plane

"},{"location":"Python/GeometricObjects/Plane/#description","title":"Description","text":"

vtkPlaneSource object creates an m x n array of quadrilaterals arranged as a regular tiling in a plane.

The plane is defined by specifying an origin point, and then two other points that, together with the origin, define two axes for the plane. These axes do not have to be orthogonal - so you can create a parallelogram. (The axes must not be parallel.) The resolution of the plane (i.e., number of subdivisions) is controlled by the ivars XResolution and YResolution.

By default, the plane is centered at the origin and perpendicular to the z-axis, with width and height of length 1 and resolutions set to 1.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Plane/#code","title":"Code","text":"

Plane.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 77, 255])\n\n    # Create a plane\n    planeSource = vtkPlaneSource()\n    planeSource.SetCenter(1.0, 0.0, 0.0)\n    planeSource.SetNormal(1.0, 0.0, 1.0)\n    planeSource.Update()\n\n    plane = planeSource.GetOutput()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(plane)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n\n    # Create a renderer, render window and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Plane')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Planes/","title":"Planes","text":"

vtk-examples/Python/GeometricObjects/Planes

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Planes/#code","title":"Code","text":"

Planes.py

#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkPlanes,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import vtkHull\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    planes = list()\n    titles = list()\n\n    # Using frustum planes.\n    titles.append('Using frustum planes')\n    camera = vtkCamera()\n    planes_array = [0] * 24\n    camera.GetFrustumPlanes(1, planes_array)\n    planes.append(vtkPlanes())\n    planes[0].SetFrustumPlanes(planes_array)\n\n    # Using bounds.\n    titles.append('Using bounds')\n    sphere_source = vtkSphereSource()\n    sphere_source.Update()\n    bounds = [0] * 6\n    sphere_source.GetOutput().GetBounds(bounds)\n    planes.append(vtkPlanes())\n    planes[1].SetBounds(bounds)\n\n    # At this point we have the planes created by both of the methods above.\n    # You can do whatever you want with them.\n\n    # For visualisation we will produce an n-sided convex hull\n    # and visualise it.\n\n    # Create a common text property.\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(16)\n    text_property.SetJustificationToCentered()\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.SetWindowName('Planes')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    hulls = list()\n    pds = list()\n    mappers = list()\n    actors = list()\n    renderers = list()\n    text_mappers = list()\n    text_actors = list()\n    for i in range(0, len(planes)):\n        hulls.append(vtkHull())\n        hulls[i].SetPlanes(planes[i])\n\n        pds.append(vtkPolyData())\n\n        # To generate the convex hull we supply a vtkPolyData object and a bounding box.\n        # We define the bounding box to be where we expect the resulting polyhedron to lie.\n        # Make it a generous fit as it is only used to create the initial\n        # polygons that are eventually clipped.\n        hulls[i].GenerateHull(pds[i], -200, 200, -200, 200, -200, 200)\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[i].SetInputData(pds[i])\n\n        actors.append(vtkActor())\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('Moccasin'))\n        actors[i].GetProperty().SetSpecular(0.8)\n        actors[i].GetProperty().SetSpecularPower(30)\n\n        renderers.append(vtkRenderer())\n        renderers[i].AddActor(actors[i])\n\n        text_mappers.append(vtkTextMapper())\n        text_mappers[i].SetInput(titles[i])\n        text_mappers[i].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[i].SetMapper(text_mappers[i])\n        text_actors[i].SetPosition(100, 10)\n        renderers[i].AddViewProp(text_actors[i])\n\n        ren_win.AddRenderer(renderers[i])\n\n    # Setup the viewports\n    x_grid_dimensions = 2\n    y_grid_dimensions = 1\n    renderer_size = 300\n    ren_win.SetSize(renderer_size * x_grid_dimensions, renderer_size * y_grid_dimensions)\n    for row in range(0, y_grid_dimensions):\n        for col in range(0, x_grid_dimensions):\n            index = row * x_grid_dimensions + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / x_grid_dimensions,\n                        float(y_grid_dimensions - (row + 1)) / y_grid_dimensions,\n                        float(col + 1) / x_grid_dimensions,\n                        float(y_grid_dimensions - row) / y_grid_dimensions]\n\n            if index > (len(actors) - 1):\n                # Add a renderer even if there is no actor.\n                # This makes the render window background all the same color.\n                ren = vtkRenderer()\n                ren.SetBackground(colors.GetColor3d('DarkSlateGray'))\n                ren.SetViewport(viewport)\n                ren_win.AddRenderer(ren)\n                continue\n\n            renderers[index].SetViewport(viewport)\n            renderers[index].SetBackground(colors.GetColor3d('DarkSlateGray'))\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(30)\n            renderers[index].GetActiveCamera().Elevation(-30)\n            renderers[index].ResetCameraClippingRange()\n\n    iren.Initialize()\n    ren_win.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/PlanesIntersection/","title":"PlanesIntersection","text":"

vtk-examples/Python/GeometricObjects/PlanesIntersection

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/PlanesIntersection/#code","title":"Code","text":"

PlanesIntersection.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPlanesIntersection\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\n\ndef main():\n\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    bounds = [0 for i in range(6)]\n    sphereSource.GetOutput().GetBounds(bounds)\n\n    box = vtkPoints()\n\n    box.SetNumberOfPoints(8)\n\n    xMin = bounds[0]\n    xMax = bounds[1]\n    yMin = bounds[2]\n    yMax = bounds[3]\n    zMin = bounds[4]\n    zMax = bounds[5]\n\n    box.SetPoint(0, xMax, yMin, zMax)\n    box.SetPoint(1, xMax, yMin, zMin)\n    box.SetPoint(2, xMax, yMax, zMin)\n    box.SetPoint(3, xMax, yMax, zMax)\n    box.SetPoint(4, xMin, yMin, zMax)\n    box.SetPoint(5, xMin, yMin, zMin)\n    box.SetPoint(6, xMin, yMax, zMin)\n    box.SetPoint(7, xMin, yMax, zMax)\n\n    planesIntersection = vtkPlanesIntersection()\n    planesIntersection.SetBounds(bounds)\n\n    intersects = planesIntersection.IntersectsRegion(box)\n    if intersects == 1:\n        res = 'Yes'\n    else:\n        res = 'No'\n    print('Intersects? ', res)\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/PlatonicSolids/","title":"PlatonicSolids","text":"

vtk-examples/Python/GeometricObjects/PlatonicSolids

"},{"location":"Python/GeometricObjects/PlatonicSolids/#description","title":"Description","text":"

Display all five Platonic solids in a grid.

Platonic solids are regular, convex polyhedrons. They are constructed by congruent (identical in shape and size) regular (all angles equal and all sides equal) polygonal faces with the same number of faces meeting at each vertex.

Five solids satisfy the above criteria:

Figure Tetrahedron Cube Octahedron Icosahedron Dodecahedron Vertices 4 8 6 (2 \u00d7 3) 12 (4 \u00d7 3) 20 (8 + 4 \u00d7 3) Edges 6 12 12 30 30 Faces 4 6 8 20 12

The relationship between vertices, edges and faces is given by Euler's formula:

V - E + F = 2\n

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/PlatonicSolids/#code","title":"Code","text":"

PlatonicSolids.py

#!/usr/bin/env python\n\nfrom collections import namedtuple\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersSources import vtkPlatonicSolidSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    mappers = list()\n    actors = list()\n    text_mappers = list()\n    text_actors = list()\n    renderers = list()\n\n    # Create a common text property.\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(16)\n    text_property.SetJustificationToCentered()\n\n    # Create the render window and interactor.\n    ren_win = vtkRenderWindow()\n    ren_win.SetWindowName('PlatonicSolids')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    name_orientation = get_name_orientation()\n    lut = get_platonic_lut()\n    platonic_solids = list()\n\n    for i in range(0, len(name_orientation)):\n        platonic_solids.append(vtkPlatonicSolidSource())\n        platonic_solids[i].SetSolidType(i)\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[i].SetInputConnection(platonic_solids[i].GetOutputPort())\n        mappers[i].SetLookupTable(lut)\n        mappers[i].SetScalarRange(0, 19)\n\n        actors.append(vtkActor())\n        actors[i].SetMapper(mappers[i])\n\n        text_mappers.append(vtkTextMapper())\n        text_mappers[i].SetInput(name_orientation[i].name)\n        text_mappers[i].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[i].SetMapper(text_mappers[i])\n        text_actors[i].SetPosition(120, 16)\n\n        renderers.append(vtkRenderer())\n        renderers[i].AddActor(actors[i])\n        renderers[i].AddViewProp(text_actors[i])\n\n        ren_win.AddRenderer(renderers[i])\n\n    # Set up the viewports.\n    grid_dimension_x = 3\n    grid_dimension_y = 2\n    renderer_size = 300\n    ren_win.SetSize(renderer_size * grid_dimension_x, renderer_size * grid_dimension_y)\n    for row in range(0, grid_dimension_y):\n        for col in range(0, grid_dimension_x):\n            index = row * grid_dimension_x + col\n\n            # (x_min, y_min, x_max, y_max)\n            viewport = [float(col) / grid_dimension_x,\n                        float(grid_dimension_y - (row + 1)) / grid_dimension_y,\n                        float(col + 1) / grid_dimension_x,\n                        float(grid_dimension_y - row) / grid_dimension_y]\n\n            if index > (len(actors) - 1):\n                # Add a renderer even if there is no actor.\n                # This makes the render window background all the same color.\n                ren = vtkRenderer()\n                ren.SetBackground(colors.GetColor3d('SlateGray'))\n                ren.SetViewport(viewport)\n                ren_win.AddRenderer(ren)\n                continue\n\n            renderers[index].SetViewport(viewport)\n            renderers[index].SetBackground(colors.GetColor3d('SlateGray'))\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(name_orientation[index].azimuth)\n            renderers[index].GetActiveCamera().Elevation(name_orientation[index].elevation)\n            renderers[index].GetActiveCamera().Zoom(name_orientation[index].zoom)\n            renderers[index].ResetCameraClippingRange()\n\n    iren.Initialize()\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_name_orientation():\n    \"\"\"\n    Get the platonic solid names and initial orientations.\n\n    :return: The solids and their initial orientations.\n    \"\"\"\n\n    # [[name, azimuth, elevation, zoom] ...]\n    res = [['Tetrahedron', 45.0, 30.0, 1.0],\n           ['Cube', -60.0, 45.0, 0.8],\n           ['Octahedron', -15.0, 10.0, 1.0],\n           ['Icosahedron', 4.5, 18.0, 1.0],\n           ['Dodecahedron', 171.0, 22.0, 1.0]]\n\n    platonic_solids = namedtuple('platonic_solids', ('name', 'azimuth', 'elevation', 'zoom'))\n    # Convert res to a list of named tuples.\n    res = [platonic_solids(*row) for row in res]\n    return res\n\n\ndef get_platonic_lut():\n    \"\"\"\n    Get a specialised lookup table for the platonic solids.\n\n    Since each face of a vtkPlatonicSolidSource has a different\n    cell scalar, we create a lookup table with a different colour\n    for each face.\n    The colors have been carefully chosen so that adjacent cells\n    are colored distinctly.\n\n    :return: The lookup table.\n    \"\"\"\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(20)\n    lut.SetTableRange(0.0, 19.0)\n    lut.Build()\n    lut.SetTableValue(0, 0.1, 0.1, 0.1)\n    lut.SetTableValue(1, 0, 0, 1)\n    lut.SetTableValue(2, 0, 1, 0)\n    lut.SetTableValue(3, 0, 1, 1)\n    lut.SetTableValue(4, 1, 0, 0)\n    lut.SetTableValue(5, 1, 0, 1)\n    lut.SetTableValue(6, 1, 1, 0)\n    lut.SetTableValue(7, 0.9, 0.7, 0.9)\n    lut.SetTableValue(8, 0.5, 0.5, 0.5)\n    lut.SetTableValue(9, 0.0, 0.0, 0.7)\n    lut.SetTableValue(10, 0.5, 0.7, 0.5)\n    lut.SetTableValue(11, 0, 0.7, 0.7)\n    lut.SetTableValue(12, 0.7, 0, 0)\n    lut.SetTableValue(13, 0.7, 0, 0.7)\n    lut.SetTableValue(14, 0.7, 0.7, 0)\n    lut.SetTableValue(15, 0, 0, 0.4)\n    lut.SetTableValue(16, 0, 0.4, 0)\n    lut.SetTableValue(17, 0, 0.4, 0.4)\n    lut.SetTableValue(18, 0.4, 0, 0)\n    lut.SetTableValue(19, 0.4, 0, 0.4)\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Point/","title":"Point","text":"

vtk-examples/Python/GeometricObjects/Point

"},{"location":"Python/GeometricObjects/Point/#description","title":"Description","text":"

vtkPoints object represents 3D points. The data model for vtkPoints is an array of vx-vy-vz triplets accessible by ( point or cell) id.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Point/#code","title":"Code","text":"

Point.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the geometry of a point (the coordinate)\n    points = vtkPoints()\n    p = [1.0, 2.0, 3.0]\n\n    # Create the topology of the point (a vertex)\n    vertices = vtkCellArray()\n    # We need an an array of point id's for InsertNextCell.\n    pid = [0]\n    pid[0] = points.InsertNextPoint(p)\n    vertices.InsertNextCell(1, pid)\n\n    # Create a polydata object\n    point = vtkPolyData()\n\n    # Set the points and vertices we created as the geometry and topology of the polydata\n    point.SetPoints(points)\n    point.SetVerts(vertices)\n\n    # Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(point)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n    actor.GetProperty().SetPointSize(20)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Point')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/PolyLine/","title":"PolyLine","text":"

vtk-examples/Python/GeometricObjects/PolyLine

"},{"location":"Python/GeometricObjects/PolyLine/#description","title":"Description","text":"

The polyline is a composite one-dimensional cell consisting of one or more connected lines. The polyline is defined by an ordered list of n+1 points, where n is the number of lines in the polyline. Each pair of points (i, i+1) defines a line.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/PolyLine/#code","title":"Code","text":"

PolyLine.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create five points.\n    origin = [0.0, 0.0, 0.0]\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [0.0, 1.0, 0.0]\n    p2 = [0.0, 1.0, 2.0]\n    p3 = [1.0, 2.0, 3.0]\n\n    # Create a vtkPoints object and store the points in it\n    points = vtkPoints()\n    points.InsertNextPoint(origin)\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n\n    polyLine = vtkPolyLine()\n    polyLine.GetPointIds().SetNumberOfIds(5)\n    for i in range(0, 5):\n        polyLine.GetPointIds().SetId(i, i)\n\n    # Create a cell array to store the lines in and add the lines to it\n    cells = vtkCellArray()\n    cells.InsertNextCell(polyLine)\n\n    # Create a polydata to store everything in\n    polyData = vtkPolyData()\n\n    # Add the points to the dataset\n    polyData.SetPoints(points)\n\n    # Add the lines to the dataset\n    polyData.SetLines(cells)\n\n    # Setup actor and mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n    # Setup render window, renderer, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('PolyLine')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkOliveGreen'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/PolyLine1/","title":"PolyLine1","text":"

vtk-examples/Python/GeometricObjects/PolyLine1

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/PolyLine1/#code","title":"Code","text":"

PolyLine1.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# This example demonstrates how to create a polyline through several ordered points.\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    # vtkPoints represents 3D points. The data model for vtkPoints is an array of\n    # vx-vy-vz triplets accessible by (point or cell) id.\n    points = vtkPoints()\n    points.SetNumberOfPoints(6)\n    c = math.cos(math.pi / 6)  # helper variable\n    points.SetPoint(0, 0.0, -1.0, 0.0)\n    points.SetPoint(1, c, -0.5, 0.0)\n    points.SetPoint(2, c, 0.5, 0.0)\n    points.SetPoint(3, 0.0, 1.0, 0.0)\n    points.SetPoint(4, -c, 0.5, 0.0)\n    points.SetPoint(5, -c, -0.5, 0.0)\n\n    # vtkCellArray is a supporting object that explicitly represents cell connectivity.\n    # The cell array structure is a raw integer list of the form:\n    # (n,id1,id2,...,idn, n,id1,id2,...,idn, ...) where n is the number of points in\n    # the cell, and id is a zero-offset index into an associated point list.\n    lines = vtkCellArray()\n    lines.InsertNextCell(7)\n    lines.InsertCellPoint(0)\n    lines.InsertCellPoint(1)\n    lines.InsertCellPoint(2)\n    lines.InsertCellPoint(3)\n    lines.InsertCellPoint(4)\n    lines.InsertCellPoint(5)\n    lines.InsertCellPoint(0)\n\n    # vtkPolyData is a data object that is a concrete implementation of vtkDataSet.\n    # vtkPolyData represents a geometric structure consisting of vertices, lines,\n    # polygons, and/or triangle strips\n    polygon = vtkPolyData()\n    polygon.SetPoints(points)\n    polygon.SetLines(lines)\n\n    # vtkPolyDataMapper is a class that maps polygonal data (i.e., vtkPolyData)\n    # to graphics primitives\n    polygonMapper = vtkPolyDataMapper()\n    polygonMapper.SetInputData(polygon)\n    polygonMapper.Update()\n\n    # Create an actor to represent the polygon. The actor orchestrates rendering of\n    # the mapper's graphics primitives. An actor also refers to properties via a\n    # vtkProperty instance, and includes an internal transformation matrix. We\n    # set this actor's mapper to be polygonMapper which we created above.\n    polygonActor = vtkActor()\n    polygonActor.SetMapper(polygonMapper)\n    polygonActor.GetProperty().SetColor(colors.GetColor3d('AliceBlue'))\n\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is\n    # responsible for drawing the actors it has.  We also set the\n    # background color here.\n    ren = vtkRenderer()\n    ren.AddActor(polygonActor)\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n\n    # Automatically set up the camera based on the visible actors.\n    # The camera will reposition itself to view the center point of the actors,\n    # and move along its initial view plane normal\n    # (i.e., vector defined from camera position to focal point) so that all of the\n    # actors can be seen.\n    ren.ResetCamera()\n\n    # Finally we create the render window which will show up on the screen\n    # We put our renderer into the render window using AddRenderer. We\n    # also set the size to be 300 pixels by 300.\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName('PolyLine1')\n    renWin.AddRenderer(ren)\n    renWin.SetSize(300, 300)\n\n    # The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n    # mouse) in the vtkRenderWindow. These events are translated into\n    # event invocations that VTK understands (see VTK/Common/vtkCommand.h\n    # for all events that VTK processes). Then observers of these VTK\n    # events can process them as appropriate.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Polygon/","title":"Polygon","text":"

vtk-examples/Python/GeometricObjects/Polygon

"},{"location":"Python/GeometricObjects/Polygon/#description","title":"Description","text":"

The polygon is a primary two-dimensional cell. The polygon is defined by an ordered list of three or more points lying in a plane. The polygon normal is implicitly defined by a counterclockwise ordering of its points using the right-hand rule.

The polygon may be nonconvex, but may not have internal loops, and it cannot self-intersect. The polygon has n edges, where n is the number of points in the polygon.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Polygon/#code","title":"Code","text":"

Polygon.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolygon\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Setup four points\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    # Create the polygon\n    polygon = vtkPolygon()\n    polygon.GetPointIds().SetNumberOfIds(4)  # make a quad\n    polygon.GetPointIds().SetId(0, 0)\n    polygon.GetPointIds().SetId(1, 1)\n    polygon.GetPointIds().SetId(2, 2)\n    polygon.GetPointIds().SetId(3, 3)\n\n    # Add the polygon to a list of polygons\n    polygons = vtkCellArray()\n    polygons.InsertNextCell(polygon)\n\n    # Create a PolyData\n    polygonPolyData = vtkPolyData()\n    polygonPolyData.SetPoints(points)\n    polygonPolyData.SetPolys(polygons)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polygonPolyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Polygon')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Salmon'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/PolygonIntersection/","title":"PolygonIntersection","text":"

vtk-examples/Python/GeometricObjects/PolygonIntersection

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/PolygonIntersection/#code","title":"Code","text":"

PolygonIntersection.py

#!/usr/bin/env python\nfrom __future__ import print_function\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import (\n    mutable,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolygon\n\n\ndef main():\n    # Create a square in the x-y plane.\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    # Create the polygon\n    polygon = vtkPolygon()\n    polygon.GetPoints().DeepCopy(points)\n    polygon.GetPointIds().SetNumberOfIds(4)  # The 4 corners of the square\n    for i in range(4):\n        polygon.GetPointIds().SetId(i, i)\n\n    # Inputs\n    p1 = [0.1, 0, -1.0]\n    p2 = [0.1, 0, 1.0]\n    tolerance = 0.001\n\n    # Outputs\n    t = mutable(0)  # Parametric coordinate of intersection (0 (corresponding to p1) to 1 (corresponding to p2))\n    x = [0.0, 0.0, 0.0]\n    pcoords = [0.0, 0.0, 0.0]\n    subId = mutable(0)\n    iD = polygon.IntersectWithLine(p1, p2, tolerance, t, x, pcoords, subId)\n\n    print('intersected? ', 'Yes' if iD == 1 else 'No')\n    print('intersection: ', x)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Polyhedron/","title":"Polyhedron","text":"

vtk-examples/Python/GeometricObjects/Polyhedron

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Polyhedron/#code","title":"Code","text":"

Polyhedron.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkIdList,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_POLYHEDRON,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkIOXML import vtkXMLUnstructuredGridWriter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create polyhedron (cube)\n    # The point Ids are: [0, 1, 2, 3, 4, 5, 6, 7]\n\n    points = vtkPoints()\n    points.InsertNextPoint(-1.0, -1.0, -1.0)\n    points.InsertNextPoint(1.0, -1.0, -1.0)\n    points.InsertNextPoint(1.0, 1.0, -1.0)\n    points.InsertNextPoint(-1.0, 1.0, -1.0)\n    points.InsertNextPoint(-1.0, -1.0, 1.0)\n    points.InsertNextPoint(1.0, -1.0, 1.0)\n    points.InsertNextPoint(1.0, 1.0, 1.0)\n    points.InsertNextPoint(-1.0, 1.0, 1.0)\n\n    # These are the point ids corresponding to each face.\n    faces = [[0, 3, 2, 1], [0, 4, 7, 3], [4, 5, 6, 7], [5, 1, 2, 6], [0, 1, 5, 4], [2, 3, 7, 6]]\n    faceId = vtkIdList()\n    faceId.InsertNextId(6)  # Six faces make up the cell.\n    for face in faces:\n        faceId.InsertNextId(len(face))  # The number of points in the face.\n        [faceId.InsertNextId(i) for i in face]\n\n    ugrid = vtkUnstructuredGrid()\n    ugrid.SetPoints(points)\n    ugrid.InsertNextCell(VTK_POLYHEDRON, faceId)\n\n    # Here we write out the cube.\n    writer = vtkXMLUnstructuredGridWriter()\n    writer.SetInputData(ugrid)\n    writer.SetFileName('polyhedron.vtu')\n    writer.SetDataModeToAscii()\n    writer.Update()\n\n    # Create a mapper and actor\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(ugrid)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(\n        colors.GetColor3d('Silver'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Polyhedron')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Salmon'))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Pyramid/","title":"Pyramid","text":"

vtk-examples/Python/GeometricObjects/Pyramid

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Pyramid/#code","title":"Code","text":"

Pyramid.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPyramid,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n\n    p0 = [1.0, 1.0, 1.0]\n    p1 = [-1.0, 1.0, 1.0]\n    p2 = [-1.0, -1.0, 1.0]\n    p3 = [1.0, -1.0, 1.0]\n    p4 = [0.0, 0.0, 0.0]\n\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n    points.InsertNextPoint(p4)\n\n    pyramid = vtkPyramid()\n    pyramid.GetPointIds().SetId(0, 0)\n    pyramid.GetPointIds().SetId(1, 1)\n    pyramid.GetPointIds().SetId(2, 2)\n    pyramid.GetPointIds().SetId(3, 3)\n    pyramid.GetPointIds().SetId(4, 4)\n\n    cells = vtkCellArray()\n    cells.InsertNextCell(pyramid)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(pyramid.GetCellType(), pyramid.GetPointIds())\n\n    # Create an actor and mapper\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(ug)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Pyramid\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n\n    # Create a nice view\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(180)\n    renderer.GetActiveCamera().Elevation(-20)\n    renderer.ResetCameraClippingRange()\n\n    renderer.SetBackground(colors.GetColor3d(\"Silver\"))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Quad/","title":"Quad","text":"

vtk-examples/Python/GeometricObjects/Quad

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Quad/#code","title":"Code","text":"

Quad.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkQuad\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create four points (must be in counter clockwise order)\n    p0 = [0.0, 0.0, 0.0]\n    p1 = [1.0, 0.0, 0.0]\n    p2 = [1.0, 1.0, 0.0]\n    p3 = [0.0, 1.0, 0.0]\n\n    # Add the points to a vtkPoints object\n    points = vtkPoints()\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n\n    # Create a quad on the four points\n    quad = vtkQuad()\n    quad.GetPointIds().SetId(0, 0)\n    quad.GetPointIds().SetId(1, 1)\n    quad.GetPointIds().SetId(2, 2)\n    quad.GetPointIds().SetId(3, 3)\n\n    # Create a cell array to store the quad in\n    quads = vtkCellArray()\n    quads.InsertNextCell(quad)\n\n    # Create a polydata to store everything in\n    polydata = vtkPolyData()\n\n    # Add the points and quads to the dataset\n    polydata.SetPoints(points)\n    polydata.SetPolys(quads)\n\n    # Setup actor and mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polydata)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    # Setup render window, renderer, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Quad')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Salmon'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/QuadraticHexahedron/","title":"QuadraticHexahedron","text":"

vtk-examples/Python/GeometricObjects/QuadraticHexahedron

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/QuadraticHexahedron/#code","title":"Code","text":"

QuadraticHexahedron.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkQuadraticHexahedron,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersGeneral import vtkTessellatorFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    namedColors = vtkNamedColors()\n\n    uGrid = MakeQuadraticHexahedron()\n\n    tessellate = vtkTessellatorFilter()\n    tessellate.SetInputData(uGrid)\n    tessellate.SetMaximumNumberOfSubdivisions(2)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(tessellate.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Create an actor for the grid\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(\n        namedColors.GetColor3d('Tomato'))\n    actor.GetProperty().SetEdgeColor(\n        namedColors.GetColor3d('IvoryBlack'))\n    actor.GetProperty().EdgeVisibilityOn()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetRadius(0.02)\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetInputData(uGrid)\n    glyph3D.SetSourceConnection(sphereSource.GetOutputPort())\n    glyph3D.ScalingOff()\n    glyph3D.Update()\n\n    glyph3DMapper = vtkDataSetMapper()\n    glyph3DMapper.SetInputConnection(glyph3D.GetOutputPort())\n    glyph3DMapper.ScalarVisibilityOff()\n\n    glyph3DActor = vtkActor()\n    glyph3DActor.SetMapper(glyph3DMapper)\n    glyph3DActor.GetProperty().SetColor(\n        namedColors.GetColor3d('Banana'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('QuadraticHexahedron')\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(glyph3DActor)\n    renderer.SetBackground(namedColors.GetColor3d('SlateGray'))\n\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef MakeQuadraticHexahedron():\n    aHexahedron = vtkQuadraticHexahedron()\n    points = vtkPoints()\n\n    pcoords = aHexahedron.GetParametricCoords()\n    rng = vtkMinimalStandardRandomSequence()\n    points.SetNumberOfPoints(aHexahedron.GetNumberOfPoints())\n    rng.SetSeed(5070)  # for testing\n    for i in range(0, aHexahedron.GetNumberOfPoints()):\n        perturbation = [0.0] * 3\n        for j in range(0, 3):\n            rng.Next()\n            perturbation[j] = rng.GetRangeValue(-0.1, 0.1)\n        aHexahedron.GetPointIds().SetId(i, i)\n        points.SetPoint(i, pcoords[3 * i] + perturbation[0],\n                        pcoords[3 * i + 1] + perturbation[1],\n                        pcoords[3 * i + 2] + perturbation[2])\n\n    # Add the points and hexahedron to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(aHexahedron.GetCellType(), aHexahedron.GetPointIds())\n\n    return uGrid\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/QuadraticHexahedronDemo/","title":"QuadraticHexahedronDemo","text":"

vtk-examples/Python/GeometricObjects/QuadraticHexahedronDemo

"},{"location":"Python/GeometricObjects/QuadraticHexahedronDemo/#description","title":"Description","text":"

This example shows the effect of changing the chord length error for a vtkQuadraticHexahedron.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/QuadraticHexahedronDemo/#code","title":"Code","text":"

QuadraticHexahedronDemo.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkGenericCell,\n    vtkQuadraticHexahedron,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersGeneral import vtkTessellatorFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    namedColors = vtkNamedColors()\n\n    uGrid = MakeQuadraticHexahedron()\n\n    tessellate = vtkTessellatorFilter()\n    tessellate.SetInputData(uGrid)\n    tessellate.SetChordError(0.035)\n    tessellate.Update()\n\n    cellMap = dict()\n\n    numTets = 0\n    cell = vtkGenericCell()\n    it = tessellate.GetOutput().NewCellIterator()\n    it.InitTraversal()\n    while not it.IsDoneWithTraversal():\n        it.GetCell(cell)\n        cellMap[cell.GetRepresentativeCell().GetClassName()] = numTets\n        numTets += 1\n        it.GoToNextCell()\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(tessellate.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Create an actor for the grid\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(\n        namedColors.GetColor3d('Tomato'))\n    actor.GetProperty().SetEdgeColor(\n        namedColors.GetColor3d('IvoryBlack'))\n    actor.GetProperty().EdgeVisibilityOn()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetRadius(0.02)\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetInputData(uGrid)\n    glyph3D.SetSourceConnection(sphereSource.GetOutputPort())\n    glyph3D.ScalingOff()\n    glyph3D.Update()\n\n    glyph3DMapper = vtkDataSetMapper()\n    glyph3DMapper.SetInputConnection(glyph3D.GetOutputPort())\n    glyph3DMapper.ScalarVisibilityOff()\n\n    glyph3DActor = vtkActor()\n    glyph3DActor.SetMapper(glyph3DMapper)\n    glyph3DActor.GetProperty().SetColor(\n        namedColors.GetColor3d('Banana'))\n\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(24)\n\n    ss = '# of Tetras: ' + str(numTets)\n    textMapper = vtkTextMapper()\n    textMapper.SetInput(ss)\n    textMapper.SetTextProperty(textProperty)\n\n    textActor = vtkActor2D()\n    textActor.SetMapper(textMapper)\n    textActor.SetPosition(10, 400)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('QuadraticHexahedronDemo')\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 512)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    widget = vtkSliderWidget()\n    MakeWidget(widget, tessellate, textMapper, interactor)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(glyph3DActor)\n    renderer.AddViewProp(textActor)\n    renderer.SetBackground(namedColors.GetColor3d('SlateGray'))\n\n    renderWindow.Render()\n\n    interactor.Start()\n\n\nclass SliderCallbackChordError():\n    def __init__(self, tessellate, textMapper):\n        self.tessellate = tessellate\n        self.textMapper = textMapper\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.tessellate.SetChordError(value)\n        self.tessellate.SetMaximumNumberOfSubdivisions(4)\n        self.tessellate.Update()\n\n        cellMap = dict()\n\n        numTets = 0\n        cell = vtkGenericCell()\n        it = self.tessellate.GetOutput().NewCellIterator()\n        it.InitTraversal()\n        while not it.IsDoneWithTraversal():\n            it.GetCell(cell)\n            cellMap[cell.GetRepresentativeCell().GetClassName()] = numTets\n            numTets += 1\n            it.GoToNextCell()\n        ss = '# of Tetras: ' + str(numTets)\n        self.textMapper.SetInput(ss)\n\n\ndef MakeWidget(widget, tessellate, textMapper, interactor):\n    # Setup a slider widget for each varying parameter\n    tubeWidth = 0.008\n    sliderLength = 0.008\n    titleHeight = 0.04\n    labelHeight = 0.04\n\n    sliderRepChordError = vtkSliderRepresentation2D()\n\n    sliderRepChordError.SetMinimumValue(0.0)\n    sliderRepChordError.SetMaximumValue(0.07)\n    sliderRepChordError.SetValue(tessellate.GetChordError())\n    sliderRepChordError.SetTitleText('Chord error')\n\n    sliderRepChordError.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepChordError.GetPoint1Coordinate().SetValue(0.1, 0.1)\n    sliderRepChordError.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepChordError.GetPoint2Coordinate().SetValue(0.9, 0.1)\n\n    sliderRepChordError.SetTubeWidth(tubeWidth)\n    sliderRepChordError.SetSliderLength(sliderLength)\n    sliderRepChordError.SetTitleHeight(titleHeight)\n    sliderRepChordError.SetLabelHeight(labelHeight)\n\n    widget.SetInteractor(interactor)\n    widget.SetRepresentation(sliderRepChordError)\n    widget.SetAnimationModeToAnimate()\n    widget.EnabledOn()\n\n    widget.AddObserver(vtkCommand.InteractionEvent, SliderCallbackChordError(tessellate, textMapper))\n\n\ndef MakeQuadraticHexahedron():\n    aHexahedron = vtkQuadraticHexahedron()\n    points = vtkPoints()\n\n    pcoords = aHexahedron.GetParametricCoords()\n    rng = vtkMinimalStandardRandomSequence()\n    points.SetNumberOfPoints(aHexahedron.GetNumberOfPoints())\n    rng.SetSeed(5070)  # for testing\n    for i in range(0, aHexahedron.GetNumberOfPoints()):\n        perturbation = [0.0] * 3\n        for j in range(0, 3):\n            rng.Next()\n            perturbation[j] = rng.GetRangeValue(-0.1, 0.1)\n        aHexahedron.GetPointIds().SetId(i, i)\n        points.SetPoint(i, pcoords[3 * i] + perturbation[0],\n                        pcoords[3 * i + 1] + perturbation[1],\n                        pcoords[3 * i + 2] + perturbation[2])\n\n    # Add the points and hexahedron to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(aHexahedron.GetCellType(), aHexahedron.GetPointIds())\n\n    return uGrid\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/QuadraticTetra/","title":"QuadraticTetra","text":"

vtk-examples/Python/GeometricObjects/QuadraticTetra

"},{"location":"Python/GeometricObjects/QuadraticTetra/#description","title":"Description","text":"

The quadratic tetrahedron is a primary three-dimensional cell. It is defined by ten points. The first four points are located at the vertices of the tetrahedron; the next six are located in the middle of each of the six edges.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/QuadraticTetra/#code","title":"Code","text":"

QuadraticTetra.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkQuadraticTetra,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersGeneral import vtkTessellatorFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    namedColors = vtkNamedColors()\n\n    uGrid = MakeQuadraticTetra()\n\n    tessellate = vtkTessellatorFilter()\n    tessellate.SetInputData(uGrid)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(tessellate.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Create an actor for the grid\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(\n        namedColors.GetColor3d('Tomato'))\n    actor.GetProperty().SetEdgeColor(\n        namedColors.GetColor3d('IvoryBlack'))\n    actor.GetProperty().EdgeVisibilityOn()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetRadius(0.02)\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetInputData(uGrid)\n    glyph3D.SetSourceConnection(sphereSource.GetOutputPort())\n    glyph3D.ScalingOff()\n    glyph3D.Update()\n\n    glyph3DMapper = vtkDataSetMapper()\n    glyph3DMapper.SetInputConnection(glyph3D.GetOutputPort())\n    glyph3DMapper.ScalarVisibilityOff()\n\n    glyph3DActor = vtkActor()\n    glyph3DActor.SetMapper(glyph3DMapper)\n    glyph3DActor.GetProperty().SetColor(\n        namedColors.GetColor3d('Banana'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('QuadraticTetra')\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(glyph3DActor)\n    renderer.SetBackground(namedColors.GetColor3d('SlateGray'))\n\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef MakeQuadraticTetra():\n    aTetra = vtkQuadraticTetra()\n    points = vtkPoints()\n\n    pcoords = aTetra.GetParametricCoords()\n    rng = vtkMinimalStandardRandomSequence()\n    points.SetNumberOfPoints(aTetra.GetNumberOfPoints())\n    rng.SetSeed(5070)  # for testing\n    for i in range(0, aTetra.GetNumberOfPoints()):\n        perturbation = [0.0] * 3\n        for j in range(0, 3):\n            rng.Next()\n            perturbation[j] = rng.GetRangeValue(-0.1, 0.1)\n        aTetra.GetPointIds().SetId(i, i)\n        points.SetPoint(i, pcoords[3 * i] + perturbation[0],\n                        pcoords[3 * i + 1] + perturbation[1],\n                        pcoords[3 * i + 2] + perturbation[2])\n\n    # Add the points and tetra to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(aTetra.GetCellType(), aTetra.GetPointIds())\n\n    return uGrid\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/QuadraticTetraDemo/","title":"QuadraticTetraDemo","text":"

vtk-examples/Python/GeometricObjects/QuadraticTetraDemo

"},{"location":"Python/GeometricObjects/QuadraticTetraDemo/#description","title":"Description","text":"

This example shows the effect of changing the chord length error for a vtkQuadraticTetra.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/QuadraticTetraDemo/#code","title":"Code","text":"

QuadraticTetraDemo.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkGenericCell,\n    vtkQuadraticTetra,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersGeneral import vtkTessellatorFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    namedColors = vtkNamedColors()\n\n    uGrid = MakeQuadraticTetra()\n\n    tessellate = vtkTessellatorFilter()\n    tessellate.SetInputData(uGrid)\n    tessellate.SetChordError(.035)\n    tessellate.Update()\n\n    cellMap = dict()\n\n    numTets = 0\n    cell = vtkGenericCell()\n    it = tessellate.GetOutput().NewCellIterator()\n    it.InitTraversal()\n    while not it.IsDoneWithTraversal():\n        it.GetCell(cell)\n        cellMap[cell.GetRepresentativeCell().GetClassName()] = numTets\n        numTets += 1\n        it.GoToNextCell()\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(tessellate.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Create an actor for the grid\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(\n        namedColors.GetColor3d('Tomato'))\n    actor.GetProperty().SetEdgeColor(\n        namedColors.GetColor3d('IvoryBlack'))\n    actor.GetProperty().EdgeVisibilityOn()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetRadius(0.02)\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetInputData(uGrid)\n    glyph3D.SetSourceConnection(sphereSource.GetOutputPort())\n    glyph3D.ScalingOff()\n    glyph3D.Update()\n\n    glyph3DMapper = vtkDataSetMapper()\n    glyph3DMapper.SetInputConnection(glyph3D.GetOutputPort())\n    glyph3DMapper.ScalarVisibilityOff()\n\n    glyph3DActor = vtkActor()\n    glyph3DActor.SetMapper(glyph3DMapper)\n    glyph3DActor.GetProperty().SetColor(\n        namedColors.GetColor3d('Banana'))\n\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(24)\n\n    ss = '# of Tetras: ' + str(numTets)\n    textMapper = vtkTextMapper()\n    textMapper.SetInput(ss)\n    textMapper.SetTextProperty(textProperty)\n\n    textActor = vtkActor2D()\n    textActor.SetMapper(textMapper)\n    textActor.SetPosition(10, 400)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('QuadraticTetraDemo')\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 512)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    widget = vtkSliderWidget()\n    MakeWidget(widget, tessellate, textMapper, interactor)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(glyph3DActor)\n    renderer.AddViewProp(textActor)\n    renderer.SetBackground(namedColors.GetColor3d('SlateGray'))\n\n    renderWindow.Render()\n\n    interactor.Start()\n\n\nclass SliderCallbackChordError():\n    def __init__(self, tessellate, textMapper):\n        self.tessellate = tessellate\n        self.textMapper = textMapper\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.tessellate.SetChordError(value)\n        self.tessellate.SetMaximumNumberOfSubdivisions(5)\n        self.tessellate.Update()\n\n        cellMap = dict()\n\n        numTets = 0\n        cell = vtkGenericCell()\n        it = self.tessellate.GetOutput().NewCellIterator()\n        it.InitTraversal()\n        while not it.IsDoneWithTraversal():\n            it.GetCell(cell)\n            cellMap[cell.GetRepresentativeCell().GetClassName()] = numTets\n            numTets += 1\n            it.GoToNextCell()\n        ss = '# of Tetras: ' + str(numTets)\n        self.textMapper.SetInput(ss)\n\n\ndef MakeWidget(widget, tessellate, textMapper, interactor):\n    # Setup a slider widget for each varying parameter\n    tubeWidth = 0.008\n    sliderLength = 0.008\n    titleHeight = 0.04\n    labelHeight = 0.04\n\n    sliderRepChordError = vtkSliderRepresentation2D()\n\n    sliderRepChordError.SetMinimumValue(0.0)\n    sliderRepChordError.SetMaximumValue(0.07)\n    sliderRepChordError.SetValue(tessellate.GetChordError())\n    sliderRepChordError.SetTitleText('Chord error')\n\n    sliderRepChordError.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepChordError.GetPoint1Coordinate().SetValue(0.1, 0.1)\n    sliderRepChordError.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepChordError.GetPoint2Coordinate().SetValue(0.9, 0.1)\n\n    sliderRepChordError.SetTubeWidth(tubeWidth)\n    sliderRepChordError.SetSliderLength(sliderLength)\n    sliderRepChordError.SetTitleHeight(titleHeight)\n    sliderRepChordError.SetLabelHeight(labelHeight)\n\n    widget.SetInteractor(interactor)\n    widget.SetRepresentation(sliderRepChordError)\n    widget.SetAnimationModeToAnimate()\n    widget.EnabledOn()\n\n    widget.AddObserver(vtkCommand.InteractionEvent, SliderCallbackChordError(tessellate, textMapper))\n\n\ndef MakeQuadraticTetra():\n    aTetra = vtkQuadraticTetra()\n    points = vtkPoints()\n\n    pcoords = aTetra.GetParametricCoords()\n    rng = vtkMinimalStandardRandomSequence()\n    points.SetNumberOfPoints(aTetra.GetNumberOfPoints())\n    rng.SetSeed(5070)  # for testing\n    for i in range(0, aTetra.GetNumberOfPoints()):\n        perturbation = [0.0] * 3\n        for j in range(0, 3):\n            rng.Next()\n            perturbation[j] = rng.GetRangeValue(-0.2, 0.2)\n        aTetra.GetPointIds().SetId(i, i)\n        points.SetPoint(i, pcoords[3 * i] + perturbation[0],\n                        pcoords[3 * i + 1] + perturbation[1],\n                        pcoords[3 * i + 2] + perturbation[2])\n\n    # Add the points and tetra to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(aTetra.GetCellType(), aTetra.GetPointIds())\n\n    return uGrid\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/RegularPolygonSource/","title":"RegularPolygonSource","text":"

vtk-examples/Python/GeometricObjects/RegularPolygonSource

"},{"location":"Python/GeometricObjects/RegularPolygonSource/#description","title":"Description","text":"

This example creates a pentagon.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/RegularPolygonSource/#code","title":"Code","text":"

RegularPolygonSource.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkPolyData\nfrom vtkmodules.vtkFiltersSources import vtkRegularPolygonSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a pentagon\n    polygonSource = vtkRegularPolygonSource()\n    polygonSource.SetNumberOfSides(5)\n    polygonSource.SetRadius(5)\n    polygonSource.SetCenter(0, 0, 0)\n\n    shrink = vtkShrinkPolyData()\n    shrink.SetInputConnection(polygonSource.GetOutputPort())\n    shrink.SetShrinkFactor(0.9)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(shrink.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d('Tomato'))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetLineWidth(5)\n    actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    actor.SetBackfaceProperty(back)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('RegularPolygonSource')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/ShrinkCube/","title":"ShrinkCube","text":"

vtk-examples/Python/GeometricObjects/ShrinkCube

"},{"location":"Python/GeometricObjects/ShrinkCube/#description","title":"Description","text":"

Generates a cube using vtkCubeSource, then a shrink filter is applied.

vtkShrinkFilter object shrinks cells composing an arbitrary data set towards their centroid. The centroid of a cell is computed as the average position of the cell points. Shrinking results in disconnecting the cells from one another.

Seealso

TessellatedBoxSource generates multiple quads or triangles per side.

Info

See Figure 5-17 in Chapter 5 the VTK Textbook.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/ShrinkCube/#code","title":"Code","text":"

ShrinkCube.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a cube.\n    cubeSource = vtkCubeSource()\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(cubeSource.GetOutputPort())\n    shrink.SetShrinkFactor(0.9)\n\n    # Create a mapper and actor.\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(shrink.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d('Tomato'))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    actor.SetBackfaceProperty(back)\n\n    # Create a renderer, render window, and interactor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    # Render and interact\n    renderWindow.SetWindowName('ShrinkCube')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/SourceObjectsDemo/","title":"SourceObjectsDemo","text":"

vtk-examples/Python/GeometricObjects/SourceObjectsDemo

"},{"location":"Python/GeometricObjects/SourceObjectsDemo/#description","title":"Description","text":"

Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source.

Info

See Figure 3-26 in Chapter 3 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/SourceObjectsDemo/#code","title":"Code","text":"

SourceObjectsDemo.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkCylinderSource,\n    vtkDiskSource,\n    vtkLineSource,\n    vtkPlaneSource,\n    vtkPointSource,\n    vtkSphereSource,\n    vtkTextSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    sourceObjects = list()\n    sourceObjects.append(vtkSphereSource())\n    sourceObjects[-1].SetPhiResolution(21)\n    sourceObjects[-1].SetThetaResolution(21)\n\n    sourceObjects.append(vtkConeSource())\n    sourceObjects[-1].SetResolution(51)\n\n    sourceObjects.append(vtkCylinderSource())\n    sourceObjects[-1].SetResolution(51)\n\n    sourceObjects.append(vtkCubeSource())\n    sourceObjects.append(vtkPlaneSource())\n    sourceObjects.append(vtkTextSource())\n    sourceObjects[-1].SetText('Hello')\n    sourceObjects[-1].BackingOff()\n\n    sourceObjects.append(vtkPointSource())\n    sourceObjects[-1].SetNumberOfPoints(500)\n\n    sourceObjects.append(vtkDiskSource())\n    sourceObjects[-1].SetCircumferentialResolution(51)\n\n    sourceObjects.append(vtkLineSource())\n\n    renderers = list()\n    mappers = list()\n    actors = list()\n    textmappers = list()\n    textactors = list()\n\n    # Create one text property for all.\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(16)\n    textProperty.SetJustificationToCentered()\n    textProperty.SetColor(colors.GetColor3d('LightGoldenrodYellow'))\n\n    backProperty = vtkProperty()\n    backProperty.SetColor(colors.GetColor3d('Tomato'))\n\n    # Create a source, renderer, mapper, and actor\n    # for each object.\n    for i in range(0, len(sourceObjects)):\n        mappers.append(vtkPolyDataMapper())\n        mappers[i].SetInputConnection(sourceObjects[i].GetOutputPort())\n\n        actors.append(vtkActor())\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n        actors[i].SetBackfaceProperty(backProperty)\n\n        textmappers.append(vtkTextMapper())\n        textmappers[i].SetInput(sourceObjects[i].GetClassName())\n        textmappers[i].SetTextProperty(textProperty)\n\n        textactors.append(vtkActor2D())\n        textactors[i].SetMapper(textmappers[i])\n        textactors[i].SetPosition(120, 16)\n        renderers.append(vtkRenderer())\n\n    gridDimensions = 3\n\n    # We need a renderer even if there is no actor.\n    for i in range(len(sourceObjects), gridDimensions ** 2):\n        renderers.append(vtkRenderer())\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('SourceObjectsDemo')\n    rendererSize = 300\n    renderWindow.SetSize(rendererSize * gridDimensions, rendererSize * gridDimensions)\n\n    for row in range(0, gridDimensions):\n        for col in range(0, gridDimensions):\n            index = row * gridDimensions + col\n            x0 = float(col) / gridDimensions\n            y0 = float(gridDimensions - row - 1) / gridDimensions\n            x1 = float(col + 1) / gridDimensions\n            y1 = float(gridDimensions - row) / gridDimensions\n            renderWindow.AddRenderer(renderers[index])\n            renderers[index].SetViewport(x0, y0, x1, y1)\n\n            if index > (len(sourceObjects) - 1):\n                continue\n\n            renderers[index].AddActor(actors[index])\n            renderers[index].AddActor(textactors[index])\n            renderers[index].SetBackground(colors.GetColor3d('BkgColor'))\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(30)\n            renderers[index].GetActiveCamera().Elevation(30)\n            renderers[index].GetActiveCamera().Zoom(0.8)\n            renderers[index].ResetCameraClippingRange()\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Sphere/","title":"Sphere","text":"

vtk-examples/Python/GeometricObjects/Sphere

"},{"location":"Python/GeometricObjects/Sphere/#description","title":"Description","text":"

vtkSphereSource object creates a sphere (represented by polygons) of specified radius centered at the origin.

The resolution (polygonal discretization) in both the latitude (phi) and longitude (theta) directions can be specified.

It also is possible to create partial spheres by specifying maximum phi and theta angles. By default, the surface tessellation of the sphere uses triangles; however you can set LatLongTessellation to produce a tessellation using quadrilaterals.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Sphere/#code","title":"Code","text":"

Sphere.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(5.0)\n    # Make the surface smooth.\n    sphereSource.SetPhiResolution(100)\n    sphereSource.SetThetaResolution(100)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphereSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Cornsilk\"))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Sphere\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d(\"DarkGreen\"))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/TessellatedBoxSource/","title":"TessellatedBoxSource","text":"

vtk-examples/Python/GeometricObjects/TessellatedBoxSource

"},{"location":"Python/GeometricObjects/TessellatedBoxSource/#description","title":"Description","text":"

Generates a box(cube) using vtkTessellatedBoxSource with 6 sides. The faces of the box can be subdivided into multiple triangles or quads.

Seealso

Cube generates multiple quads or triangles per side.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/TessellatedBoxSource/#code","title":"Code","text":"

TessellatedBoxSource.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonExecutionModel import vtkAlgorithm\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersSources import vtkTessellatedBoxSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    bounds = [-10.0, 10.0, 10.0, 20.0, -5.0, 5.0]\n\n    boxSource = vtkTessellatedBoxSource()\n    boxSource.SetLevel(3)\n    boxSource.QuadsOn()\n    boxSource.SetBounds(bounds)\n    boxSource.SetOutputPointsPrecision(vtkAlgorithm.SINGLE_PRECISION)\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(boxSource.GetOutputPort())\n    shrink.SetShrinkFactor(.8)\n\n    # Create a mapper and actor.\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(shrink.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d('Tomato'))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    actor.SetBackfaceProperty(back)\n\n    # Create a renderer, render window, and interactor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene.\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    # Render and interact.\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('TessellatedBoxSource')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Tetrahedron/","title":"Tetrahedron","text":"

vtk-examples/Python/GeometricObjects/Tetrahedron

"},{"location":"Python/GeometricObjects/Tetrahedron/#description","title":"Description","text":"

Tetrahedron. The tetrahedron is a primary three-dimensional cell. The tetrahedron is defined by a list of four nonplanar points. The tetrahedron has six edges and four triangular faces.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Tetrahedron/#code","title":"Code","text":"

Tetrahedron.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_TETRA,\n    vtkCellArray,\n    vtkTetra,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 1, 1)\n\n    points.InsertNextPoint(2, 2, 2)\n    points.InsertNextPoint(3, 2, 2)\n    points.InsertNextPoint(3, 3, 2)\n    points.InsertNextPoint(2, 3, 3)\n\n    # The first tetrahedron\n    unstructuredGrid1 = vtkUnstructuredGrid()\n    unstructuredGrid1.SetPoints(points)\n\n    tetra = vtkTetra()\n\n    tetra.GetPointIds().SetId(0, 0)\n    tetra.GetPointIds().SetId(1, 1)\n    tetra.GetPointIds().SetId(2, 2)\n    tetra.GetPointIds().SetId(3, 3)\n\n    cellArray = vtkCellArray()\n    cellArray.InsertNextCell(tetra)\n    unstructuredGrid1.SetCells(VTK_TETRA, cellArray)\n\n    # The second tetrahedron\n    unstructuredGrid2 = vtkUnstructuredGrid()\n    unstructuredGrid2.SetPoints(points)\n\n    tetra = vtkTetra()\n\n    tetra.GetPointIds().SetId(0, 4)\n    tetra.GetPointIds().SetId(1, 5)\n    tetra.GetPointIds().SetId(2, 6)\n    tetra.GetPointIds().SetId(3, 7)\n\n    cellArray = vtkCellArray()\n    cellArray.InsertNextCell(tetra)\n    unstructuredGrid2.SetCells(VTK_TETRA, cellArray)\n\n    # Create a mapper and actor\n    mapper1 = vtkDataSetMapper()\n    mapper1.SetInputData(unstructuredGrid1)\n\n    actor1 = vtkActor()\n    actor1.SetMapper(mapper1)\n    actor1.GetProperty().SetColor(colors.GetColor3d(\"Cyan\"))\n\n    # Create a mapper and actor\n    mapper2 = vtkDataSetMapper()\n    mapper2.SetInputData(unstructuredGrid2)\n\n    actor2 = vtkActor()\n    actor2.SetMapper(mapper2)\n    actor2.GetProperty().SetColor(colors.GetColor3d(\"Yellow\"))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Tetrahedron\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor1)\n    renderer.AddActor(actor2)\n    renderer.SetBackground(colors.GetColor3d(\"DarkGreen\"))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(-10)\n    renderer.GetActiveCamera().Elevation(-20)\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/TextActor/","title":"TextActor","text":"

vtk-examples/Python/GeometricObjects/TextActor

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/TextActor/#code","title":"Code","text":"

TextActor.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextActor\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a rendering window and renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName('TextActor')\n    renWin.AddRenderer(ren)\n\n    # Create a render window interactor.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create a text actor.\n    txt = vtkTextActor()\n    txt.SetInput('Hello World!')\n    txtprop = txt.GetTextProperty()\n    txtprop.SetFontFamilyToArial()\n    txtprop.BoldOn()\n    txtprop.SetFontSize(36)\n    txtprop.ShadowOn()\n    txtprop.SetShadowOffset(4, 4)\n    txtprop.SetColor(colors.GetColor3d('Cornsilk'))\n    txt.SetDisplayPosition(20, 30)\n\n    # Assign actor to the renderer.\n    ren.AddActor(txt)\n    ren.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    # Enable user interface interactor.\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Triangle/","title":"Triangle","text":"

vtk-examples/Python/GeometricObjects/Triangle

"},{"location":"Python/GeometricObjects/Triangle/#description","title":"Description","text":"

The triangle is a primary two-dimensional cell. The triangle is defined by a counterclockwise ordered list of three points. The order of the points specifies the direction of the surface normal using the right-hand rule.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Triangle/#code","title":"Code","text":"

Triangle.py

# !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangle\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a triangle\n    points = vtkPoints()\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    triangle = vtkTriangle()\n    triangle.GetPointIds().SetId(0, 0)\n    triangle.GetPointIds().SetId(1, 1)\n    triangle.GetPointIds().SetId(2, 2)\n\n    triangles = vtkCellArray()\n    triangles.InsertNextCell(triangle)\n\n    # Create a polydata object\n    trianglePolyData = vtkPolyData()\n\n    # Add the geometry and topology to the polydata\n    trianglePolyData.SetPoints(points)\n    trianglePolyData.SetPolys(triangles)\n\n    # Create mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(trianglePolyData)\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and an interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Triangle')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/TriangleStrip/","title":"TriangleStrip","text":"

vtk-examples/Python/GeometricObjects/TriangleStrip

"},{"location":"Python/GeometricObjects/TriangleStrip/#description","title":"Description","text":"

The triangle strip is a composite two-dimensional cell consisting of one or more triangles. The points defining the triangle strip need not lie in a plane. The triangle strip is defined by an ordered list of n+2 points, where n is the number of triangles. The ordering of the points is such that each set of three points defines a triangle.

Info

See this wikipedia article for an explanation.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/TriangleStrip/#code","title":"Code","text":"

TriangleStrip.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangleStrip\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1.5, 1, 0)\n\n    triangleStrip = vtkTriangleStrip()\n    triangleStrip.GetPointIds().SetNumberOfIds(4)\n    triangleStrip.GetPointIds().SetId(0, 0)\n    triangleStrip.GetPointIds().SetId(1, 1)\n    triangleStrip.GetPointIds().SetId(2, 2)\n    triangleStrip.GetPointIds().SetId(3, 3)\n\n    cells = vtkCellArray()\n    cells.InsertNextCell(triangleStrip)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n    polydata.SetStrips(cells)\n\n    # Create an actor and mapper\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(polydata)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n    actor.GetProperty().SetRepresentationToWireframe()\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('TriangleStrip')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/GeometricObjects/Vertex/","title":"Vertex","text":"

vtk-examples/Python/GeometricObjects/Vertex

"},{"location":"Python/GeometricObjects/Vertex/#description","title":"Description","text":"

The vertex is a primary zero-dimensional cell. It is defined by a single point.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/GeometricObjects/Vertex/#code","title":"Code","text":"

Vertex.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkVertex\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n\n    vertex = vtkVertex()\n    vertex.GetPointIds().SetId(0, 0)\n\n    vertices = vtkCellArray()\n    vertices.InsertNextCell(vertex)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n    polydata.SetVerts(vertices)\n\n    # Setup actor and mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polydata)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetPointSize(30)\n    actor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # Setup render window, renderer, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Vertex')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/ColorEdges/","title":"ColorEdges","text":"

vtk-examples/Python/Graphs/ColorEdges

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/ColorEdges/#code","title":"Code","text":"

ColorEdges.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkIntArray,\n    vtkLookupTable\n)\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkViewsCore import vtkViewTheme\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    graph = vtkMutableDirectedGraph()\n    # Create a graph\n    v1 = graph.AddVertex()\n    v2 = graph.AddVertex()\n    v3 = graph.AddVertex()\n\n    graph.AddGraphEdge(v1, v2)\n    graph.AddGraphEdge(v2, v3)\n\n    # Create the color array\n    edgeColors = vtkIntArray()\n    edgeColors.SetNumberOfComponents(1)\n    edgeColors.SetName('Color')\n\n    lookupTable = vtkLookupTable()\n    lookupTable.SetNumberOfTableValues(2)\n    lookupTable.SetTableValue(0, colors.GetColor4d('Red'))\n    lookupTable.SetTableValue(1, colors.GetColor4d('Lime'))\n    lookupTable.Build()\n\n    edgeColors.InsertNextValue(0)\n    edgeColors.InsertNextValue(1)\n\n    # Add the color array to the graph\n    graph.GetEdgeData().AddArray(edgeColors)\n\n    graphLayoutView = vtkGraphLayoutView()\n    graphLayoutView.AddRepresentationFromInput(graph)\n    graphLayoutView.SetLayoutStrategy('Simple 2D')\n    graphLayoutView.GetLayoutStrategy().SetEdgeWeightField('Graphs')\n    graphLayoutView.GetLayoutStrategy().SetWeightEdges(1)\n    graphLayoutView.SetEdgeColorArrayName('Color')\n    graphLayoutView.SetEdgeLabelVisibility(1)\n    graphLayoutView.ColorEdgesOn()\n\n    theme = vtkViewTheme()\n    theme.SetCellLookupTable(lookupTable)\n\n    graphLayoutView.ApplyViewTheme(theme)\n    graphLayoutView.ResetCamera()\n    graphLayoutView.GetRenderer().GetActiveCamera().Zoom(0.8)\n    graphLayoutView.Render()\n    graphLayoutView.GetLayoutStrategy().SetRandomSeed(0)\n    graphLayoutView.GetInteractor().Initialize()\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/ColorVertexLabels/","title":"ColorVertexLabels","text":"

vtk-examples/Python/Graphs/ColorVertexLabels

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/ColorVertexLabels/#code","title":"Code","text":"

ColorVertexLabels.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIntArray\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkViewsInfovis import (\n    vtkGraphLayoutView,\n    vtkRenderedGraphRepresentation\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a graph\n    graph = vtkMutableDirectedGraph()\n\n    v1 = graph.AddVertex()\n    v2 = graph.AddVertex()\n    graph.AddEdge(v1, v2)\n\n    # Create an array for the vertex labels\n    vertexIDs = vtkIntArray()\n    vertexIDs.SetNumberOfComponents(1)\n    vertexIDs.SetName('VertexIDs')\n\n    # Set the vertex labels\n    vertexIDs.InsertNextValue(0)\n    vertexIDs.InsertNextValue(1)\n\n    # Add the array to the graph\n    graph.GetVertexData().AddArray(vertexIDs)\n\n    graphLayoutView = vtkGraphLayoutView()\n    graphLayoutView.AddRepresentationFromInput(graph)\n    graphLayoutView.SetVertexLabelVisibility(1)\n\n    rGraph = vtkRenderedGraphRepresentation()\n    rGraph.SafeDownCast(graphLayoutView.GetRepresentation()).GetVertexLabelTextProperty().SetColor(\n        colors.GetColor3d('Red'))\n    graphLayoutView.SetLayoutStrategyToSimple2D()\n    graphLayoutView.SetVertexLabelArrayName('VertexIDs')\n    graphLayoutView.SetVertexLabelVisibility(True)\n    graphLayoutView.ResetCamera()\n    graphLayoutView.GetRenderer().GetActiveCamera().Zoom(0.8)\n    graphLayoutView.Render()\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/ColorVerticesLookupTable/","title":"ColorVerticesLookupTable","text":"

vtk-examples/Python/Graphs/ColorVerticesLookupTable

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/ColorVerticesLookupTable/#code","title":"Code","text":"

ColorVerticesLookupTable.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkIntArray,\n    vtkLookupTable,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkViewsCore import vtkViewTheme\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a graph\n    graph = vtkMutableDirectedGraph()\n\n    v1 = graph.AddVertex()\n    v2 = graph.AddVertex()\n    v3 = graph.AddVertex()\n    graph.AddEdge(v1, v2)\n    graph.AddEdge(v2, v3)\n\n    # Manually set the position of the vertices\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(2, 0, 0)\n\n    graph.SetPoints(points)\n\n    # Create the color array\n    vertexColors = vtkIntArray()\n    vertexColors.SetNumberOfComponents(1)\n    vertexColors.SetName('Color')\n\n    lookupTable = vtkLookupTable()\n    lookupTable.SetNumberOfTableValues(3)\n    lookupTable.SetTableValue(0, colors.GetColor4d('Red'))\n    lookupTable.SetTableValue(1, colors.GetColor4d('White'))\n    lookupTable.SetTableValue(2, colors.GetColor4d('Lime'))\n    lookupTable.Build()\n\n    vertexColors.InsertNextValue(0)\n    vertexColors.InsertNextValue(1)\n    vertexColors.InsertNextValue(2)\n\n    # Add the color array to the graph\n    graph.GetVertexData().AddArray(vertexColors)\n\n    # Visualize\n    graphLayoutView = vtkGraphLayoutView()\n    graphLayoutView.AddRepresentationFromInput(graph)\n    graphLayoutView.SetLayoutStrategyToPassThrough()\n    graphLayoutView.SetVertexColorArrayName('Color')\n    graphLayoutView.ColorVerticesOn()\n\n    theme = vtkViewTheme()\n    theme.SetPointLookupTable(lookupTable)\n\n    graphLayoutView.ApplyViewTheme(theme)\n    graphLayoutView.ResetCamera()\n    graphLayoutView.GetInteractor().Initialize()\n    graphLayoutView.GetRenderer().GetActiveCamera().Zoom(0.8)\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/ConstructGraph/","title":"ConstructGraph","text":"

vtk-examples/Python/Graphs/ConstructGraph

"},{"location":"Python/Graphs/ConstructGraph/#description","title":"Description","text":"

This example shows how to construct a simple graph.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/ConstructGraph/#code","title":"Code","text":"

ConstructGraph.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkMutableUndirectedGraph\nfrom vtkmodules.vtkInfovisLayout import vtkForceDirectedLayoutStrategy\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    g = vtkMutableUndirectedGraph()\n\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n\n    g.AddEdge(v1, v2)\n    print('Number of vertices:', g.GetNumberOfVertices())\n    print('Number of edges:', g.GetNumberOfEdges())\n\n    g.AddEdge(v1, v2)\n    print('Number of vertices:', g.GetNumberOfVertices())\n    print('Number of edges:', g.GetNumberOfEdges())\n\n    force_directed = vtkForceDirectedLayoutStrategy()\n\n    graph_layout_view = vtkGraphLayoutView()\n    graph_layout_view.AddRepresentationFromInput(g)\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view.SetLayoutStrategy(force_directed)\n    graph_layout_view.SetLayoutStrategyToForceDirected()\n    graph_layout_view.ResetCamera()\n    graph_layout_view.GetRenderer().SetBackground(colors.GetColor3d('Navy'))\n    graph_layout_view.GetRenderer().SetBackground2(colors.GetColor3d('MidnightBlue'))\n    graph_layout_view.GetRenderWindow().SetWindowName('ConstructGraph')\n    graph_layout_view.Render()\n    graph_layout_view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/ConstructTree/","title":"ConstructTree","text":"

vtk-examples/Python/Graphs/ConstructTree

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/ConstructTree/#code","title":"Code","text":"

ConstructTree.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkMutableDirectedGraph,\n    vtkTree\n)\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    graph = vtkMutableDirectedGraph()\n\n    v1 = graph.AddVertex()\n    v2 = graph.AddChild(v1)\n    graph.AddChild(v1)\n    graph.AddChild(v2)\n\n    # equivalent to:\n    # V1 = g.AddVertex()\n    # V2 = g.AddVertex()\n    # V3 = g.AddVertex()\n    # V4 = g.AddVertex()\n\n    # g.AddEdge ( V1, V2 )\n    # g.AddEdge ( V1, V3 )\n    # g.AddEdge ( V2, V4 )\n\n    tree = vtkTree()\n    success = tree.CheckedShallowCopy(graph)\n    print('Success?', success)\n    # std::cout << 'Success? ' << success << std::endl\n\n    treeLayoutView = vtkGraphLayoutView()\n    treeLayoutView.AddRepresentationFromInput(tree)\n    treeLayoutView.SetLayoutStrategyToTree()\n    treeLayoutView.ResetCamera()\n    treeLayoutView.Render()\n    treeLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/CreateTree/","title":"CreateTree","text":"

vtk-examples/Python/Graphs/CreateTree

"},{"location":"Python/Graphs/CreateTree/#description","title":"Description","text":"

We create the tree, and label the vertices and edges.

Info

This is an update of the original example found in vtk/Examples/Infovis/Cxx/CreateTree.cxx.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/CreateTree/#code","title":"Code","text":"

CreateTree.py

#!/usr/bin/env python\n\n# This example creates a tree and labels the vertices and edges.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkStringArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkMutableDirectedGraph,\n    vtkTree\n)\nfrom vtkmodules.vtkViewsCore import vtkViewTheme\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    graph = vtkMutableDirectedGraph()\n\n    a = graph.AddVertex()\n    b = graph.AddChild(a)\n    c = graph.AddChild(a)\n    d = graph.AddChild(b)\n    e = graph.AddChild(c)\n    f = graph.AddChild(c)\n\n    vertex_labels = vtkStringArray()\n    vertex_labels.SetName('VertexLabel')\n    vertex_labels.InsertValue(a, 'a')\n    vertex_labels.InsertValue(b, 'b')\n    vertex_labels.InsertValue(c, 'c')\n    vertex_labels.InsertValue(d, 'd')\n    vertex_labels.InsertValue(e, 'e')\n    vertex_labels.InsertValue(f, 'f')\n    graph.GetVertexData().AddArray(vertex_labels)\n    edge_labels = vtkStringArray()\n    edge_labels.SetName('EdgeLabel')\n    edge_labels.InsertValue(graph.GetEdgeId(a, b), 'a -> b')\n    edge_labels.InsertValue(graph.GetEdgeId(a, c), 'a -> c')\n    edge_labels.InsertValue(graph.GetEdgeId(b, d), 'b -> d')\n    edge_labels.InsertValue(graph.GetEdgeId(c, e), 'c -> e')\n    edge_labels.InsertValue(graph.GetEdgeId(c, f), 'c -> f')\n    graph.GetEdgeData().AddArray(edge_labels)\n\n    tree = vtkTree()\n    valid_tree = tree.CheckedShallowCopy(graph)\n    if not valid_tree:\n        print('Invalid tree')\n        return\n\n    view = vtkGraphLayoutView()\n    view.SetRepresentationFromInput(tree)\n    # Apply a theme to the views\n    theme = vtkViewTheme()\n    view.ApplyViewTheme(theme.CreateMellowTheme())\n    view.SetVertexColorArrayName('VertexDegree')\n    view.SetColorVertices(True)\n    view.SetVertexLabelArrayName('VertexLabel')\n    view.SetVertexLabelVisibility(True)\n    view.SetEdgeLabelArrayName('EdgeLabel')\n    view.SetEdgeLabelVisibility(True)\n    view.SetLayoutStrategyToTree()\n\n    view.ResetCamera()\n    view.GetRenderWindow().SetSize(600, 600)\n    view.GetRenderWindow().SetWindowName('CreateTree')\n    view.GetRenderWindow().Render()\n    view.GetInteractor().Initialize()\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/EdgeWeights/","title":"EdgeWeights","text":"

vtk-examples/Python/Graphs/EdgeWeights

"},{"location":"Python/Graphs/EdgeWeights/#description","title":"Description","text":"
  • Contributed by Jim McCusker

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/EdgeWeights/#code","title":"Code","text":"

EdgeWeights.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkInfovisLayout import vtkForceDirectedLayoutStrategy\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    g = vtkMutableDirectedGraph()\n\n    # Create 3 vertices\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n    v3 = g.AddVertex()\n\n    # Create a fully connected graph\n    g.AddGraphEdge(v1, v2)\n    g.AddGraphEdge(v2, v3)\n    g.AddGraphEdge(v1, v3)\n\n    # Create the edge weight array\n    weights = vtkDoubleArray()\n    weights.SetNumberOfComponents(1)\n    weights.SetName('Weights')\n\n    # Set the edge weights\n    weights.InsertNextValue(1.0)\n    weights.InsertNextValue(1.0)\n    weights.InsertNextValue(2.0)\n\n    # Add the edge weight array to the graph\n    g.GetEdgeData().AddArray(weights)\n\n    print('Number of edges:', g.GetNumberOfEdges())\n\n    force_directed = vtkForceDirectedLayoutStrategy()\n\n    graph_layout_view = vtkGraphLayoutView()\n    graph_layout_view.AddRepresentationFromInput(g)\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view.SetLayoutStrategy(force_directed)\n    graph_layout_view.SetLayoutStrategyToForceDirected()\n    graph_layout_view.AddRepresentationFromInput(g)\n    graph_layout_view.GetLayoutStrategy().SetEdgeWeightField('Weights')\n    graph_layout_view.GetLayoutStrategy().SetWeightEdges(1)\n    graph_layout_view.SetEdgeLabelArrayName('Weights')\n    graph_layout_view.EdgeLabelVisibilityOn()\n    graph_layout_view.GetRenderer().SetBackground(colors.GetColor3d('Navy'))\n    graph_layout_view.GetRenderer().SetBackground2(colors.GetColor3d('MidnightBlue'))\n    graph_layout_view.GetRenderWindow().SetWindowName('EdgeWeights')\n    graph_layout_view.ResetCamera()\n    graph_layout_view.Render()\n    graph_layout_view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/GraphToPolyData/","title":"GraphToPolyData","text":"

vtk-examples/Python/Graphs/GraphToPolyData

"},{"location":"Python/Graphs/GraphToPolyData/#description","title":"Description","text":"

This example creates a simple graph and then converts it to a polydata for visualization using Paraview.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/GraphToPolyData/#code","title":"Code","text":"

GraphToPolyData.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkMutableUndirectedGraph\nfrom vtkmodules.vtkFiltersSources import vtkGraphToPolyData\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Create a graph\n    g = vtkMutableUndirectedGraph()\n\n    # Add 4 vertices to the graph\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n    v3 = g.AddVertex()\n    v4 = g.AddVertex()\n\n    # Add 3 edges to the graph\n    g.AddEdge(v1, v2)\n    g.AddEdge(v1, v3)\n    g.AddEdge(v1, v4)\n\n    # Create 4 points - one for each vertex\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 0.0, 1.0)\n\n    # Add the coordinates of the points to the graph\n    g.SetPoints(points)\n\n    # Convert the graph to a polydata\n    graphToPolyData = vtkGraphToPolyData()\n    graphToPolyData.SetInputData(g)\n    graphToPolyData.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(graphToPolyData.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Green'))\n\n    # Render and interact\n    renderWindow.SetWindowName('GraphToPolyData')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/LabelVerticesAndEdges/","title":"LabelVerticesAndEdges","text":"

vtk-examples/Python/Graphs/LabelVerticesAndEdges

"},{"location":"Python/Graphs/LabelVerticesAndEdges/#description","title":"Description","text":"

This example sets and displays labels of vertices and edges of a graph.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/LabelVerticesAndEdges/#code","title":"Code","text":"

LabelVerticesAndEdges.py

#!/usr/bin/env python\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkIntArray\n)\nfrom vtkmodules.vtkCommonDataModel import vtkMutableUndirectedGraph\nfrom vtkmodules.vtkInfovisLayout import vtkCircularLayoutStrategy\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    g = vtkMutableUndirectedGraph()\n\n    # Create 3 vertices\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n    v3 = g.AddVertex()\n\n    # Create a fully connected graph\n    g.AddEdge(v1, v2)\n    g.AddEdge(v2, v3)\n    g.AddEdge(v1, v3)\n\n    # Create the edge weight array\n    weights = vtkDoubleArray()\n    weights.SetNumberOfComponents(1)\n    weights.SetName('Weights')\n\n    # Set the edge weights\n    weights.InsertNextValue(1.0)\n    weights.InsertNextValue(1.0)\n    weights.InsertNextValue(2.0)\n\n    # Create an array for the vertex labels\n    vertexIDs = vtkIntArray()\n    vertexIDs.SetNumberOfComponents(1)\n    vertexIDs.SetName('VertexIDs')\n\n    # Set the vertex labels\n    vertexIDs.InsertNextValue(0)\n    vertexIDs.InsertNextValue(1)\n    vertexIDs.InsertNextValue(2)\n\n    # Add the edge weight array to the graph\n    g.GetEdgeData().AddArray(weights)\n    g.GetVertexData().AddArray(vertexIDs)\n\n    circularLayoutStrategy = vtkCircularLayoutStrategy()\n\n    graphLayoutView = vtkGraphLayoutView()\n    graphLayoutView.AddRepresentationFromInput(g)\n\n    graphLayoutView.SetLayoutStrategy(circularLayoutStrategy)\n    graphLayoutView.SetVertexLabelVisibility(1)\n    graphLayoutView.SetEdgeLabelVisibility(1)\n    graphLayoutView.SetEdgeLabelArrayName('Weights')  # default is 'labels'\n    graphLayoutView.SetVertexLabelArrayName('VertexIDs')  # default is 'labels'\n    graphLayoutView.GetRepresentation().GetVertexLabelTextProperty().SetColor(\n        colors.GetColor3d('Yellow'))\n    graphLayoutView.GetRepresentation().GetEdgeLabelTextProperty().SetColor(\n        colors.GetColor3d('Lime'))\n    graphLayoutView.ResetCamera()\n    graphLayoutView.Render()\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/NOVCAGraph/","title":"NOVCAGraph","text":"

vtk-examples/Python/Graphs/NOVCAGraph

"},{"location":"Python/Graphs/NOVCAGraph/#description","title":"Description","text":"
  • This example shows how to construct a graph to visualize it in ParaView/VisIt using the VTK output file testVertex.vtu.

  • Contributed by Sanjaya Gajurel, Case Western Reserve University

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/NOVCAGraph/#code","title":"Code","text":"

NOVCAGraph.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import (\n    vtkIntArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_LINE,\n    vtkCellArray,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOXML import vtkXMLUnstructuredGridWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Building a graph using Unstructured Grid & dumping it into a vtk file.'\n    epilogue = '''\n        Building a graph using Unstructured Grid & dumping it into a vtk file, to be visualized using ParaView.\n\n        The generated file can then be used in ParaView/VisIt.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtk filename, e.g. vertex.vtu.', nargs='?', const='vertex.vtu',\n                        type=str, default='testVertex.vtu')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    fn = get_program_parameters()\n\n    pointSource = vtkPointSource()\n    pointSource.Update()\n\n    # Create an integer array to store vertex id data & link it with its degree value as a scalar.\n    degree = vtkIntArray()\n    degree.SetNumberOfComponents(1)\n    degree.SetName('degree')\n    degree.SetNumberOfTuples(7)\n    degree.SetValue(0, 2)\n    degree.SetValue(1, 1)\n    degree.SetValue(2, 3)\n    degree.SetValue(3, 3)\n    degree.SetValue(4, 4)\n    degree.SetValue(5, 2)\n    degree.SetValue(6, 1)\n\n    pointSource.GetOutput().GetPointData().AddArray(degree)\n\n    # Assign co-ordinates for vertices\n    Points = vtkPoints()\n    Points.InsertNextPoint(0, 1, 0)\n    Points.InsertNextPoint(0, 0, 0)\n    Points.InsertNextPoint(1, 1, 0)\n    Points.InsertNextPoint(1, 0, 0)\n    Points.InsertNextPoint(2, 1, 0)\n    Points.InsertNextPoint(2, 0, 0)\n    Points.InsertNextPoint(3, 0, 0)\n\n    # Establish the specified edges using CellArray\n    line = vtkCellArray()\n    line.Allocate(8)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(0)\n    line.InsertCellPoint(1)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(0)\n    line.InsertCellPoint(2)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(2)\n    line.InsertCellPoint(3)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(2)\n    line.InsertCellPoint(4)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(3)\n    line.InsertCellPoint(4)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(3)\n    line.InsertCellPoint(5)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(4)\n    line.InsertCellPoint(5)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(4)\n    line.InsertCellPoint(6)\n\n    # Add the vertices and edges to unstructured Grid\n    G = vtkUnstructuredGrid()\n    G.GetPointData().SetScalars(degree)\n    G.SetPoints(Points)\n    G.SetCells(VTK_LINE, line)\n\n    # Dump the graph in VTK unstructured format (.vtu)\n    gw = vtkXMLUnstructuredGridWriter()\n    gw.SetFileName(fn)\n    gw.SetInputData(G)\n    gw.Write()\n    print('---> ')\n\n    print('Feed the vertex.vtu file in ParaView/VisIt.')\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/RandomGraphSource/","title":"RandomGraphSource","text":"

vtk-examples/Python/Graphs/RandomGraphSource

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/RandomGraphSource/#code","title":"Code","text":"

RandomGraphSource.py

#!/usr/bin/env python\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkInfovisCore import vtkRandomGraphSource\nfrom vtkmodules.vtkInfovisLayout import vtkForceDirectedLayoutStrategy\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    random_graph_source = vtkRandomGraphSource()\n    random_graph_source.SetNumberOfVertices(5)\n    random_graph_source.SetNumberOfEdges(4)\n    # This ensures repeatable results for testing. Turn this off for real use.\n    random_graph_source.SetSeed(123)\n    random_graph_source.Update()\n\n    force_directed = vtkForceDirectedLayoutStrategy()\n\n    graph_layout_view = vtkGraphLayoutView()\n    graph_layout_view.AddRepresentationFromInput(random_graph_source.GetOutput())\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view.SetLayoutStrategy(force_directed)\n    graph_layout_view.SetLayoutStrategyToForceDirected()\n    graph_layout_view.GetRenderer().SetBackground(colors.GetColor3d('Navy'))\n    graph_layout_view.GetRenderer().SetBackground2(colors.GetColor3d('MidnightBlue'))\n    graph_layout_view.GetRenderWindow().SetWindowName('RandomGraphSource')\n    graph_layout_view.Render()\n    graph_layout_view.ResetCamera()\n    graph_layout_view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/ScaleVertices/","title":"ScaleVertices","text":"

vtk-examples/Python/Graphs/ScaleVertices

"},{"location":"Python/Graphs/ScaleVertices/#description","title":"Description","text":"

Scale the vertices based on a data array.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/ScaleVertices/#code","title":"Code","text":"

ScaleVertices.py

#!/usr/bin/env python\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkIntArray,\n    vtkLookupTable\n)\nfrom vtkmodules.vtkCommonDataModel import vtkMutableUndirectedGraph\nfrom vtkmodules.vtkInfovisLayout import vtkForceDirectedLayoutStrategy\nfrom vtkmodules.vtkRenderingCore import vtkGraphToGlyphs\nfrom vtkmodules.vtkViewsCore import vtkViewTheme\nfrom vtkmodules.vtkViewsInfovis import (\n    vtkGraphLayoutView,\n    vtkRenderedGraphRepresentation\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    g = vtkMutableUndirectedGraph()\n\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n\n    g.AddEdge(v1, v2)\n    g.AddEdge(v1, v2)\n\n    scales = vtkFloatArray()\n    scales.SetNumberOfComponents(1)\n    scales.SetName('Scales')\n    scales.InsertNextValue(2.0)\n    scales.InsertNextValue(5.0)\n\n    # Add the scale array to the graph\n    g.GetVertexData().AddArray(scales)\n\n    # Create the color array\n    vertexColors = vtkIntArray()\n    vertexColors.SetNumberOfComponents(1)\n    vertexColors.SetName('Color')\n\n    lookupTable = vtkLookupTable()\n    lookupTable.SetNumberOfTableValues(2)\n    lookupTable.SetTableValue(0, colors.GetColor4d('Yellow'))\n    lookupTable.SetTableValue(1, colors.GetColor4d('Lime'))\n    lookupTable.Build()\n\n    vertexColors.InsertNextValue(0)\n    vertexColors.InsertNextValue(1)\n\n    # Add the color array to the graph\n    g.GetVertexData().AddArray(vertexColors)\n\n    theme = vtkViewTheme()\n    theme.SetPointLookupTable(lookupTable)\n\n    force_directed = vtkForceDirectedLayoutStrategy()\n\n    layout_view = vtkGraphLayoutView()\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view.SetLayoutStrategy(force_directed)\n    layout_view.SetLayoutStrategyToForceDirected()\n    layout_view.AddRepresentationFromInput(g)\n    layout_view.ApplyViewTheme(theme)\n    layout_view.ScaledGlyphsOn()\n    layout_view.SetScalingArrayName('Scales')\n    layout_view.SetVertexColorArrayName('Color')\n    layout_view.ColorVerticesOn()\n    rGraph = vtkRenderedGraphRepresentation()\n    gGlyph = vtkGraphToGlyphs()\n    rGraph.SafeDownCast(layout_view.GetRepresentation()).SetGlyphType(gGlyph.CIRCLE)\n    layout_view.GetRenderer().SetBackground(colors.GetColor3d('Navy'))\n    layout_view.GetRenderer().SetBackground2(colors.GetColor3d('MidnightBlue'))\n    layout_view.GetRenderWindow().SetWindowName('ScaleVertices')\n    layout_view.Render()\n    layout_view.ResetCamera()\n    layout_view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/SelectedVerticesAndEdges/","title":"SelectedVerticesAndEdges","text":"

vtk-examples/Python/Graphs/SelectedVerticesAndEdges

"},{"location":"Python/Graphs/SelectedVerticesAndEdges/#description","title":"Description","text":"
  • Contributed by Eric Monson

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/SelectedVerticesAndEdges/#code","title":"Code","text":"

SelectedVerticesAndEdges.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkInfovisCore import vtkRandomGraphSource\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\nsource = vtkRandomGraphSource()\nsource.Update()\n\nview = vtkGraphLayoutView()\nview.AddRepresentationFromInputConnection(source.GetOutputPort())\n\n\ndef selectionCallback(caller, event):\n    # In C++ there is some extra data passed to the callback, but in Python\n    # the callback data is lost...\n\n    # There should be two selection nodes, but which one is vertices and which\n    # is edges does not seem to be guaranteed...\n    sel = caller.GetCurrentSelection()\n    node0 = sel.GetNode(0)\n    node0_field_type = node0.GetFieldType()\n    sel_list0 = caller.GetCurrentSelection().GetNode(0).GetSelectionList()\n    node1 = sel.GetNode(1)\n    node1_field_type = node1.GetFieldType()\n    sel_list1 = caller.GetCurrentSelection().GetNode(1).GetSelectionList()\n\n    if (sel_list0.GetNumberOfTuples() > 0):\n        printFieldType(node0_field_type)\n        for ii in range(sel_list0.GetNumberOfTuples()):\n            print('\\t', sel_list0.GetValue(ii))\n\n    if (sel_list1.GetNumberOfTuples() > 0):\n        printFieldType(node1_field_type)\n        for ii in range(sel_list1.GetNumberOfTuples()):\n            print('\\t', sel_list1.GetValue(ii))\n\n        print('- - -')\n\n\ndef printFieldType(field_type):\n    if field_type == 3:\n        print('Vertices Selected:')\n    elif field_type == 4:\n        print('Edges Selected:')\n    else:\n        print('Unknown type:')\n\n\ndef main():\n    rep = view.GetRepresentation(0)\n\n    # The vtkRenderedGraphRepresentation should already have a vtkAnnotationLink,\n    # so we just want to grab it and add an observer with our callback function\n    # attached\n    link = rep.GetAnnotationLink()\n    link.AddObserver('AnnotationChangedEvent', selectionCallback)\n\n    view.GetRenderWindow().SetSize(600, 600)\n    view.ResetCamera()\n    view.Render()\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/SideBySideGraphs/","title":"SideBySideGraphs","text":"

vtk-examples/Python/Graphs/SideBySideGraphs

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/SideBySideGraphs/#code","title":"Code","text":"

SideBySideGraphs.py

#!/usr/bin/env python\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkMutableUndirectedGraph\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor\n)\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the first graph\n    g0 = vtkMutableUndirectedGraph()\n\n    v1 = g0.AddVertex()\n    v2 = g0.AddVertex()\n    v3 = g0.AddVertex()\n\n    g0.AddEdge(v1, v2)\n    g0.AddEdge(v2, v3)\n    g0.AddEdge(v1, v3)\n\n    # Create points\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    # Add the coordinates of the points to the graph\n    g0.SetPoints(points)\n\n    # Create the second graph\n    g1 = vtkMutableUndirectedGraph()\n\n    v1 = g1.AddVertex()\n    v2 = g1.AddVertex()\n\n    g1.AddEdge(v1, v2)\n\n    # Create points\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n\n    # Add the coordinates of the points to the graph\n    g1.SetPoints(points)\n\n    # There will be one render window\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 300)\n    ren_win.SetWindowName('SideBySideGraphs')\n\n    iren = vtkRenderWindowInteractor()\n\n    # Define viewport ranges\n    # (xmin, ymin, xmax, ymax)\n    left_viewport = [0.0, 0.0, 0.5, 1.0]\n    right_viewport = [0.5, 0.0, 1.0, 1.0]\n\n    graph_layout_view0 = vtkGraphLayoutView()\n    graph_layout_view0.SetRenderWindow(ren_win)\n    graph_layout_view0.SetInteractor(iren)\n    graph_layout_view0.GetRenderer().SetViewport(left_viewport)\n    graph_layout_view0.AddRepresentationFromInput(g0)\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view0.SetLayoutStrategy(force_directed)\n    graph_layout_view0.SetLayoutStrategyToForceDirected()\n    graph_layout_view0.GetRenderer().SetBackground(colors.GetColor3d('Navy'))\n    graph_layout_view0.GetRenderer().SetBackground2(colors.GetColor3d('MidnightBlue'))\n    graph_layout_view0.Render()\n    graph_layout_view0.ResetCamera()\n\n    graph_layout_view1 = vtkGraphLayoutView()\n    graph_layout_view1.SetRenderWindow(ren_win)\n    graph_layout_view1.SetInteractor(iren)\n    graph_layout_view1.GetRenderer().SetViewport(right_viewport)\n    graph_layout_view1.AddRepresentationFromInput(g0)\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view1.SetLayoutStrategy(force_directed)\n    graph_layout_view1.SetLayoutStrategyToForceDirected()\n    graph_layout_view1.AddRepresentationFromInput(g1)\n    graph_layout_view1.GetRenderer().SetBackground(colors.GetColor3d('DarkGreen'))\n    graph_layout_view1.GetRenderer().SetBackground2(colors.GetColor3d('ForestGreen'))\n    graph_layout_view1.Render()\n    graph_layout_view1.ResetCamera()\n\n    # graph_layout_view0.GetInteractor().Start()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/VisualizeDirectedGraph/","title":"VisualizeDirectedGraph","text":"

vtk-examples/Python/Graphs/VisualizeDirectedGraph

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/VisualizeDirectedGraph/#code","title":"Code","text":"

VisualizeDirectedGraph.py

#!/usr/bin/env python\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersSources import (\n    vtkGlyphSource2D,\n    vtkGraphToPolyData\n)\nfrom vtkmodules.vtkInfovisLayout import (\n    vtkGraphLayout,\n    vtkSimple2DLayoutStrategy\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper\n)\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    g = vtkMutableDirectedGraph()\n\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n    v3 = g.AddVertex()\n\n    g.AddEdge(v1, v2)\n    g.AddEdge(v2, v3)\n    g.AddEdge(v3, v1)\n\n    # Do layout manually before handing graph to the view.\n    # This allows us to know the positions of edge arrows.\n    graphLayoutView = vtkGraphLayoutView()\n\n    layout = vtkGraphLayout()\n    strategy = vtkSimple2DLayoutStrategy()\n    layout.SetInputData(g)\n    layout.SetLayoutStrategy(strategy)\n\n    # Tell the view to use the vertex layout we provide\n    graphLayoutView.SetLayoutStrategyToPassThrough()\n    # The arrows will be positioned on a straight line between two\n    # vertices so tell the view not to draw arcs for parallel edges\n    graphLayoutView.SetEdgeLayoutStrategyToPassThrough()\n\n    # Add the graph to the view. This will render vertices and edges,\n    # but not edge arrows.\n    graphLayoutView.AddRepresentationFromInputConnection(layout.GetOutputPort())\n\n    # Manually create an actor containing the glyphed arrows.\n    graphToPoly = vtkGraphToPolyData()\n    graphToPoly.SetInputConnection(layout.GetOutputPort())\n    graphToPoly.EdgeGlyphOutputOn()\n\n    # Set the position (0: edge start, 1: edge end) where\n    # the edge arrows should go.\n    graphToPoly.SetEdgeGlyphPosition(0.98)\n\n    # Make a simple edge arrow for glyphing.\n    arrowSource = vtkGlyphSource2D()\n    arrowSource.SetGlyphTypeToEdgeArrow()\n    arrowSource.SetScale(0.1)\n    arrowSource.Update()\n\n    # Use Glyph3D to repeat the glyph on all edges.\n    arrowGlyph = vtkGlyph3D()\n    arrowGlyph.SetInputConnection(0, graphToPoly.GetOutputPort(1))\n    arrowGlyph.SetInputConnection(1, arrowSource.GetOutputPort())\n\n    # Add the edge arrow actor to the view.\n    arrowMapper = vtkPolyDataMapper()\n    arrowMapper.SetInputConnection(arrowGlyph.GetOutputPort())\n    arrowActor = vtkActor()\n    arrowActor.SetMapper(arrowMapper)\n    graphLayoutView.GetRenderer().AddActor(arrowActor)\n\n    graphLayoutView.ResetCamera()\n    graphLayoutView.Render()\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Graphs/VisualizeGraph/","title":"VisualizeGraph","text":"

vtk-examples/Python/Graphs/VisualizeGraph

"},{"location":"Python/Graphs/VisualizeGraph/#description","title":"Description","text":"
  • Contributed by Jim McCusker

Note

AddEdge() is not enabled through python, but AddGraphEdge() is.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Graphs/VisualizeGraph/#code","title":"Code","text":"

VisualizeGraph.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    g = vtkMutableDirectedGraph()\n\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n\n    g.AddGraphEdge(v1, v2)\n    g.AddGraphEdge(v1, v2)\n\n    graphLayoutView = vtkGraphLayoutView()\n    graphLayoutView.AddRepresentationFromInput(g)\n    graphLayoutView.SetLayoutStrategy('Simple 2D')\n    graphLayoutView.ResetCamera()\n    graphLayoutView.Render()\n\n    graphLayoutView.GetLayoutStrategy().SetRandomSeed(0)\n\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/HyperTreeGrid/HyperTreeGridSource/","title":"HyperTreeGridSource","text":"

vtk-examples/Python/HyperTreeGrid/HyperTreeGridSource

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/HyperTreeGrid/HyperTreeGridSource/#code","title":"Code","text":"

HyperTreeGridSource.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersHyperTree import vtkHyperTreeGridToUnstructuredGrid\nfrom vtkmodules.vtkFiltersSources import vtkHyperTreeGridSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Create hyper tree grid source\n\n    descriptor = 'RRR .R. .RR ..R ..R .R.|R.......................... ' \\\n                 '........................... ........................... ' \\\n                 '.............R............. ....RR.RR........R......... ' \\\n                 '.....RRRR.....R.RR......... ........................... ' \\\n                 '........................... ' \\\n                 '...........................|........................... ' \\\n                 '........................... ........................... ' \\\n                 '...RR.RR.......RR.......... ........................... ' \\\n                 'RR......................... ........................... ' \\\n                 '........................... ........................... ' \\\n                 '........................... ........................... ' \\\n                 '........................... ........................... ' \\\n                 '............RRR............|........................... ' \\\n                 '........................... .......RR.................. ' \\\n                 '........................... ........................... ' \\\n                 '........................... ........................... ' \\\n                 '........................... ........................... ' \\\n                 '........................... ' \\\n                 '...........................|........................... ' \\\n                 '...........................'\n\n    source = vtkHyperTreeGridSource()\n    source.SetMaximumLevel(6)\n    source.SetDimensions(4, 4, 3)  # GridCell 3, 3, 2\n    source.SetGridScale(1.5, 1.0, 0.7)\n    source.SetBranchFactor(4)\n    source.SetDescriptor(descriptor)\n    source.Update()\n\n    # Hyper tree grid to unstructured grid filter\n    htg2ug = vtkHyperTreeGridToUnstructuredGrid()\n    htg2ug.SetInputConnection(source.GetOutputPort())\n    htg2ug.Update()\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(htg2ug.GetOutputPort())\n    shrink.SetShrinkFactor(.8)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(shrink.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Burlywood'))\n\n    # Create the RenderWindow, Renderer and Interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderer.AddActor(actor)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(150)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.Render()\n    renderWindow.SetWindowName('HyperTreeGridSource')\n\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/3DSImporter/","title":"3DSImporter","text":"

vtk-examples/Python/IO/3DSImporter

"},{"location":"Python/IO/3DSImporter/#description","title":"Description","text":"

This example illustrates Importing files in VTK. An importer creates a vtkRenderWindow that describes the scene.

Info

See Figure 4-13 in Chapter 4 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/3DSImporter/#code","title":"Code","text":"

3DSImporter.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImport import vtk3DSImporter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkCamera,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    importer = vtk3DSImporter()\n    importer.SetFileName(fileName)\n    importer.ComputeNormalsOn()\n\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n\n    renWin.AddRenderer(renderer)\n    renderer.SetBackground2(colors.GetColor3d('Gold'))\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renderer.GradientBackgroundOn()\n\n    iren.SetRenderWindow(renWin)\n    importer.SetRenderWindow(renWin)\n    importer.Update()\n\n    # actors = vtkActorCollection()\n    actors = renderer.GetActors()\n    print('There are', actors.GetNumberOfItems(), 'actors.')\n\n    renWin.SetWindowName('3DSImporter')\n    renWin.Render()\n    camera = vtkCamera()\n    camera.SetPosition(0, -1, 0)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetViewUp(0, 0, 1)\n    camera.Azimuth(150)\n    camera.Elevation(30)\n\n    renderer.SetActiveCamera(camera)\n    renderer.ResetCamera()\n    renderer.ResetCameraClippingRange()\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Importing a 3ds file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='iflamingo.3ds.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/CSVReadEdit/","title":"CSVReadEdit","text":"

vtk-examples/Python/IO/CSVReadEdit

"},{"location":"Python/IO/CSVReadEdit/#description","title":"Description","text":"

This example loads a CSV file, edits it and visualises the result.

It demonstrates the use of pandas to read and edit the CSV input file, then use numpy and the vtk-numpy interface for building the resultant vtkPolyData object based on the options selected.

The key thing about pandas is it can read/write data in various formats: CSV and text files, Microsoft Excel, SQL databases, and the fast HDF5 format. It is highly optimized for performance and the DataFrame object allows for extensive row/column manipulation. So we can edit the data, creating new columns, and, finally, select only relevant columns for further analysis by VTK.

In this case we select columns using numpy to create the three-dimensional point data array data. The numpy objects are then converted to vtk data structures and integrated into a vtkPolyData object.

The process is this:

CSV->pandas(read/edit/select)->numpy->numpy_to_vtk->[vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)\n

Note how easy it is the get the three-dimensional coordinates using numpy.

The files used to generate the example are:

<DATA>/LakeGininderra.csv\n<DATA>/LakeGininderra.kmz\n

Where:

  • <DATA> is the path to vtk-examples/src/Testing/Data
  • LakeGininderra.csv is the CSV file used by this program.
  • LakeGininderra.kmz can be loaded into Google Earth to display the track.

The parameters for typical usage are something like this:

<DATA>/LakeGininderra.csv -u -c -pResults\n
A Google Earth image of the track.

Further information:

  • Easy Data Conversion to VTK with Python.
  • Installing pandas.
  • VTK Examples - New CSV Examples

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/CSVReadEdit/#code","title":"Code","text":"

CSVReadEdit.py

#!/usr/bin/env python3\n\nfrom pathlib import Path\n\nimport pandas as pd\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtk.util import numpy_support\nfrom vtkmodules.vtkCommonColor import (\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import vtkLookupTable, vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget, vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor, vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Edit data from a CSV file and visualise it.'\n    epilogue = '''\n    This program selects ECEF, Geographic or UTM coordinates from the input file and:\n       1) Visualises the resultant ECEF or UTM points and lines.\n       2) If ECEF or UTM is selected, optionally creates and saves a VTP file for further analysis.\n       3) Optionally saves the CSV file.\n    If Geographic coordinates are selected, only the resultant CSV file can be saved.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('file_name', help='The CSV file containing the data.')\n    parser.add_argument('-c', '--csv', action='store_true', help='Save the resultant CSV file.')\n    parser.add_argument('-v', '--vtp', action='store_true', help='Save the .vtp file.')\n    parser.add_argument('-p', '--path', default='.',\n                        help='The path to be appended to the .vtp and optional .csv file')\n\n    group = parser.add_mutually_exclusive_group(required=True)\n    group.add_argument('-e', '--ecef', action='store_true', help='Use ECEF coordinates.')\n    group.add_argument('-u', '--utm', action='store_true', help='Use UTM coordinates.')\n    group.add_argument('-g', '--geo', action='store_true', help='Use geographic coordinates (latitude/longitude).')\n\n    args = parser.parse_args()\n    return args.file_name, args.csv, args.vtp, args.path, args.ecef, args.utm, args.geo\n\n\ndef main():\n    ifn, csv, vtp, sp, ecef, utm, geo = get_program_parameters()\n    file_name = Path(ifn)\n    if not file_name.is_file():\n        print('Unable to read:', file_name)\n        return\n    pth = Path(sp)\n    if not pth.is_dir():\n        if pth.is_file():\n            print(sp, ' must be a path')\n            return\n    pth.mkdir(parents=True, exist_ok=True)\n\n    # Build the output paths.\n    csv_fn = Path(pth / Path(ifn).stem).with_suffix('.csv')\n    vtp_fn = Path(pth / Path(ifn).stem).with_suffix('.vtp')\n    if ecef:\n        vtp_fn = vtp_fn.with_stem(vtp_fn.stem + '_ecef')\n    if utm:\n        vtp_fn = vtp_fn.with_stem(vtp_fn.stem + '_utm')\n\n    # Create a DataFrame from the csv file.\n    df = pd.read_csv(file_name)\n\n    # Use the column called 'Index' as the index.\n    # This ensures that we can trace back each row to the original data.\n    df.set_index('Index', inplace=True)\n\n    # For ECEF coordinates, we want to look down from the zenith.\n    # So calculate the mid-point of the latitude.\n    lat_details = df['Latitude'].describe()\n    lat_mid_pt = (lat_details['max'] + lat_details['min']) / 2\n\n    dfv = None\n    # Copy what we want to a new DataFrame and drop any rows with missing values.\n    if ecef:\n        dfv = df[['X(m)', 'Y(m)', 'Z(m)', 'Elevation(m)']].dropna(\n            subset=['X(m)', 'Y(m)', 'Z(m)'])\n        if csv:\n            ecef_csv_fn = csv_fn.with_stem(csv_fn.stem + '_ecef')\n            dfv.to_csv(ecef_csv_fn, index=True, index_label='Index', header=True)\n    elif utm:\n        dfv = df[['Easting(m)', 'Northing(m)', 'Elevation(m)']].dropna(\n            subset=['Easting(m)', 'Northing(m)', 'Elevation(m)'])\n        # Duplicate the elevation column, this will become the z-coordinate when UTM is selected.\n        dfv['Elev'] = dfv.loc[:, 'Elevation(m)']\n        if csv:\n            utm_csv_fn = csv_fn.with_stem(csv_fn.stem + '_utm')\n            dfv.to_csv(utm_csv_fn, index=True, index_label='Index', header=True)\n    else:\n        df_geo = df[['Longitude', 'Latitude', 'Elevation(m)']].dropna(\n            subset=['Longitude', 'Latitude', 'Elevation(m)'])\n        geo_csv_fn = csv_fn.with_stem(csv_fn.stem + '_geo')\n        df_geo.to_csv(geo_csv_fn, index=True, index_label='Index', header=True)\n\n    if ecef:\n        xyz = dfv[['X(m)', 'Y(m)', 'Z(m)']].to_numpy()\n    elif utm:\n        xyz = dfv[['Easting(m)', 'Northing(m)', 'Elevation(m)']].to_numpy()\n    else:\n        print('Only ECEF or UTM coordinates can be visualised.')\n        return\n\n    elev = df[['Elevation(m)']].to_numpy()\n\n    # Create the poly data.\n    poly_data = vtkPolyData()\n    points = vtkPoints()\n    points.SetData(numpy_support.numpy_to_vtk(xyz))\n    poly_data.SetPoints(points)\n\n    # Set an index\n    idx = numpy_support.numpy_to_vtk(elev)\n    idx.SetName('Index')\n    poly_data.GetPointData().AddArray(idx)\n\n    # We use the elevation as the active scalars.\n    scal = numpy_support.numpy_to_vtk(elev)\n    scal.SetName('Elevation(m)')\n    poly_data.GetPointData().SetScalars(scal)\n    poly_data.GetPointData().SetActiveScalars('Elevation(m)')\n    elev_range = poly_data.GetPointData().GetScalars().GetRange()\n\n    num_pts = poly_data.GetNumberOfPoints()\n    poly_line = vtkPolyLine()\n    poly_line.GetPointIds().SetNumberOfIds(num_pts)\n    for i in range(0, num_pts):\n        poly_line.GetPointIds().SetId(i, i)\n\n    # Create a cell array to store the lines in and add the lines to it.\n    cells = vtkCellArray()\n    cells.InsertNextCell(poly_line)\n\n    # Add the lines to the dataset\n    poly_data.SetLines(cells)\n\n    poly_data.Modified()\n\n    # Rotate the ECEF coordinates\n    # into VTK coordinates so that on the screen:\n    # Y points North, X points East and Z points up.\n    transform = vtkTransform()\n    if utm:\n        # Scale the elevation.\n        transform.Scale(1, 1, 1)\n    if ecef:\n        # Rotate the ECEF coordinates\n        # into VTK coordinates so that on the screen:\n        # Y points North, X points East and Z points up.\n        transform.RotateX(-(90 - lat_mid_pt))\n        transform.RotateY(0)\n        transform.RotateZ(90 - lat_mid_pt)\n\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputDataObject(poly_data)\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    if vtp:\n        writer = vtkXMLPolyDataWriter()\n        writer.SetFileName(vtp_fn)\n        writer.SetInputConnection(transform_filter.GetOutputPort())\n        writer.SetDataModeToBinary()\n        writer.Write()\n\n    colors = vtkNamedColors()\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    lut = get_diverging_lut('cool_warm')\n    # lut = get_diverging_lut1('DarkRed', 'Gainsboro', 'Green')\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(transform_filter.GetOutputPort())\n    mapper.SetScalarRange(elev_range)\n    mapper.SetLookupTable(lut)\n    mapper.ScalarVisibilityOn()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    window_width = 1024\n    window_height = 1024\n\n    # Create a scalar bar\n    scalar_bar = vtkScalarBarActor()\n    scalar_bar.SetLookupTable(mapper.GetLookupTable())\n    scalar_bar.SetTitle('Elevation')\n    scalar_bar.UnconstrainedFontSizeOff()\n    scalar_bar.SetNumberOfLabels(6)\n    scalar_bar.SetVerticalTitleSeparation(50)\n    scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar.SetMaximumHeightInPixels(window_height // 2)\n    scalar_bar.SetBarRatio(scalar_bar.GetBarRatio() * 0.5)\n    scalar_bar.SetPosition(0.87, 0.1)\n\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(window_width, window_height)\n    if ecef:\n        ren_win.SetWindowName('ECEF')\n    elif utm:\n        ren_win.SetWindowName('UTM')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(scalar_bar)\n    renderer.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    cam_orient_manipulator = vtkCameraOrientationWidget()\n    cam_orient_manipulator.SetParentRenderer(renderer)\n    cam_orient_manipulator.On()\n\n    axes = vtkAxesActor()\n    axes.SetXAxisLabelText('East')\n    axes.SetYAxisLabelText('North')\n    # Zenith\n    axes.SetZAxisLabelText('Zenith')\n\n    widget = vtkOrientationMarkerWidget()\n    rgba = [0] * 4\n    colors.GetColor('Carrot', rgba)\n    widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n    widget.SetOrientationMarker(axes)\n    widget.SetInteractor(iren)\n    widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n    widget.SetEnabled(1)\n    widget.InteractiveOn()\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(0)\n\n    iren.Initialize()\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_diverging_lut(color_map: str, table_size: int = 256):\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start-point         mid-point           end-point\\n\n    cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\\n\n    purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\\n\n    green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\\n\n    blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\\n\n    green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\\n\n\n    :param color_map: The color map to use e.g. cool_warm.\n    :param table_size: The table size.\n    :return:\n    \"\"\"\n    color_maps = dict()\n    color_maps['cool_warm'] = {'start': (0.230, 0.299, 0.754), 'mid': (0.865, 0.865, 0.865),\n                               'end': (0.706, 0.016, 0.150)}\n    color_maps['purple_orange'] = {'start': (0.436, 0.308, 0.631), 'mid': (0.865, 0.865, 0.865),\n                                   'end': (0.759, 0.334, 0.046)}\n    color_maps['green_purple'] = {'start': (0.085, 0.532, 0.201), 'mid': (0.865, 0.865, 0.865),\n                                  'end': (0.436, 0.308, 0.631)}\n    color_maps['blue_brown'] = {'start': (0.217, 0.525, 0.910), 'mid': (0.865, 0.865, 0.865),\n                                'end': (0.677, 0.492, 0.093)}\n    color_maps['green_red'] = {'start': (0.085, 0.532, 0.201), 'mid': (0.865, 0.865, 0.865),\n                               'end': (0.758, 0.214, 0.233)}\n\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    cm = color_maps[color_map]\n\n    ctf.AddRGBPoint(0.0, *cm['start'])\n    ctf.AddRGBPoint(0.5, *cm['mid'])\n    ctf.AddRGBPoint(1.0, *cm['end'])\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef get_diverging_lut1(start: str, mid: str, end: str, table_size: int = 256):\n    \"\"\"\n    Create a diverging lookup table from three named colors.\n\n    :param start: The start-point point color.\n    :param mid: The mid-point color.\n    :param end: The end-point color.\n    :param table_size:  The table size.\n    :return:\n    \"\"\"\n    colors = vtkNamedColors()\n    # Colour transfer function.\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    p1 = [0.0] + list(colors.GetColor3d(start))\n    p2 = [0.5] + list(colors.GetColor3d(mid))\n    p3 = [1.0] + list(colors.GetColor3d(end))\n    ctf.AddRGBPoint(*p1)\n    ctf.AddRGBPoint(*p2)\n    ctf.AddRGBPoint(*p3)\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/CSVReadEdit1/","title":"CSVReadEdit1","text":"

vtk-examples/Python/IO/CSVReadEdit1

"},{"location":"Python/IO/CSVReadEdit1/#description","title":"Description","text":"

This example loads a CSV file, edits it and visualises the result.

It demonstrates the use of pandas to read and edit the CSV input file, then create a temporary file containing the desired columns. This temporary file is subsequently read and parsed using vtkDelimitedTextReader.

The key thing about pandas is it can read/write data in various formats: CSV and text files, Microsoft Excel, SQL databases, and the fast HDF5 format. It is highly optimized for performance and the DataFrame object allows for extensive row/column manipulation. So we can edit the data, creating new columns, and, finally, select only relevant columns for further analysis by VTK.

In this case we create a temporary CSV file of selected columns and read this with vtkDelimitedTextReader.

The process is this:

CSV->pandas(read/edit/select)->CSV->[vtkDelimitedTextReader](https://www.vtk.org/doc/nightly/html/classvtkDelimitedTextReader.html#details)->[vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)\n

By going down this route we don't overload the delimited text reader with the effort of processing any unneeded columns of data.

The files used to generate the example are:

<DATA>/LakeGininderra.csv\n<DATA>/LakeGininderra.kmz\n

Where:

  • <DATA> is the path to vtk-examples/src/Testing/Data
  • LakeGininderra.csv is the CSV file used by this program.
  • LakeGininderra.kmz can be loaded into Google Earth to display the track.

The parameters for typical usage are something like this:

<DATA>/LakeGininderra.csv -e -c -pResults\n
A Google Earth image of the track.

Further information:

  • Easy Data Conversion to VTK with Python.
  • Installing pandas.
  • VTK Examples - New CSV Examples

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/CSVReadEdit1/#code","title":"Code","text":"

CSVReadEdit1.py

#!/usr/bin/env python3\n\nimport tempfile\nfrom pathlib import Path\n\nimport pandas as pd\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTableToPolyData, vtkTransformPolyDataFilter\nfrom vtkmodules.vtkIOInfovis import vtkDelimitedTextReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget, vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor, vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Edit data from a CSV file and visualise it.'\n    epilogue = '''\n    This program selects ECEF, Geographic or UTM coordinates from the input file and:\n       1) Visualises the resultant ECEF or UTM points and lines.\n       2) If ECEF or UTM is selected, optionally creates and saves a VTP file for further analysis.\n       3) Optionally saves the CSV file.\n    If Geographic coordinates are selected, only the resultant CSV file can be saved.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('file_name', help='The CSV file containing the data.')\n    parser.add_argument('-c', '--csv', action='store_true', help='Save the resultant CSV file.')\n    parser.add_argument('-v', '--vtp', action='store_true', help='Save the .vtp file.')\n    parser.add_argument('-p', '--path', default='.',\n                        help='The path to be appended to the .vtp and optional .csv file')\n\n    group = parser.add_mutually_exclusive_group(required=True)\n    group.add_argument('-e', '--ecef', action='store_true', help='Use ECEF coordinates.')\n    group.add_argument('-u', '--utm', action='store_true', help='Use UTM coordinates.')\n    group.add_argument('-g', '--geo', action='store_true', help='Use geographic coordinates (latitude/longitude).')\n\n    args = parser.parse_args()\n    return args.file_name, args.csv, args.vtp, args.path, args.ecef, args.utm, args.geo\n\n\ndef main():\n    ifn, csv, vtp, sp, ecef, utm, geo = get_program_parameters()\n    file_name = Path(ifn)\n    if not file_name.is_file():\n        print('Unable to read:', file_name)\n        return\n    pth = Path(sp)\n    if not pth.is_dir():\n        if pth.is_file():\n            print(sp, ' must be a path')\n            return\n    pth.mkdir(parents=True, exist_ok=True)\n\n    # Build the output paths.\n    csv_fn = Path(pth / Path(ifn).stem).with_suffix('.csv')\n    vtp_fn = Path(pth / Path(ifn).stem).with_suffix('.vtp')\n    if ecef:\n        vtp_fn = vtp_fn.with_stem(vtp_fn.stem + '_ecef')\n    if utm:\n        vtp_fn = vtp_fn.with_stem(vtp_fn.stem + '_utm')\n\n    # Create a DataFrame from the csv file.\n    df = pd.read_csv(file_name)\n\n    # Use the column called 'Index' as the index.\n    # This ensures that we can trace back each row to the original data.\n    df.set_index('Index', inplace=True)\n\n    # For ECEF coordinates, we want to look down from the zenith.\n    # So calculate the mid-point of the latitude.\n    lat_details = df['Latitude'].describe()\n    lat_mid_pt = (lat_details['max'] + lat_details['min']) / 2\n\n    # Create a temporary csv file with just the needed columns.\n    tmp_dir = tempfile.gettempdir()\n    if tmp_dir is None:\n        print('Unable to find', tmp_dir)\n        return\n    tmp_path = Path(tmp_dir, f'tmp_{file_name.name}')\n\n    dfv = None\n    # Copy what we want to a new DataFrame and drop any rows with missing values.\n    if ecef:\n        dfv = df[['X(m)', 'Y(m)', 'Z(m)', 'Elevation(m)']].dropna(\n            subset=['X(m)', 'Y(m)', 'Z(m)'])\n        if csv:\n            ecef_csv_fn = csv_fn.with_stem(csv_fn.stem + '_ecef')\n            dfv.to_csv(ecef_csv_fn, index=True, index_label='Index', header=True)\n    elif utm:\n        dfv = df[['Easting(m)', 'Northing(m)', 'Elevation(m)']].dropna(\n            subset=['Easting(m)', 'Northing(m)', 'Elevation(m)'])\n        # Duplicate the elevation column, this will become the z-coordinate when UTM is selected.\n        dfv['Elev'] = dfv.loc[:, 'Elevation(m)']\n        if csv:\n            utm_csv_fn = csv_fn.with_stem(csv_fn.stem + '_utm')\n            dfv.to_csv(utm_csv_fn, index=True, index_label='Index', header=True)\n    else:\n        df_geo = df[['Longitude', 'Latitude', 'Elevation(m)']].dropna(\n            subset=['Longitude', 'Latitude', 'Elevation(m)'])\n        geo_csv_fn = csv_fn.with_stem(csv_fn.stem + '_geo')\n        df_geo.to_csv(geo_csv_fn, index=True, index_label='Index', header=True)\n\n    if ecef or utm:\n        # Write out the DataFrame.\n        dfv.to_csv(tmp_path, index=True, index_label='Index', header=True)\n\n    points_reader = vtkDelimitedTextReader()\n    points_reader.SetFileName(tmp_path)\n    points_reader.DetectNumericColumnsOn()\n    points_reader.SetFieldDelimiterCharacters(',')\n    points_reader.SetHaveHeaders(True)\n\n    table_pd = vtkTableToPolyData()\n    table_pd.SetInputConnection(points_reader.GetOutputPort())\n    if ecef:\n        table_pd.SetXColumn('X(m)')\n        table_pd.SetYColumn('Y(m)')\n        table_pd.SetZColumn('Z(m)')\n    elif utm:\n        table_pd.SetXColumn('Easting(m)')\n        table_pd.SetYColumn('Northing(m)')\n        table_pd.SetZColumn('Elev')\n    else:\n        # Remove the temporary file, it is not needed any more.\n        tmp_path.unlink(missing_ok=True)\n        print('Only ECEF or UTM coordinates can be visualised.')\n        return\n    table_pd.Update()\n\n    # Remove the temporary file, it is not needed any more.\n    tmp_path.unlink(missing_ok=True)\n\n    poly_data = table_pd.GetOutput()\n    # poly_data = transform_filter.GetOutput()\n    # We use the elevation as the active scalars.\n    poly_data.GetPointData().SetActiveScalars('Elevation(m)')\n    elev_range = poly_data.GetPointData().GetScalars().GetRange()\n\n    num_pts = poly_data.GetNumberOfPoints()\n\n    poly_line = vtkPolyLine()\n    poly_line.GetPointIds().SetNumberOfIds(num_pts)\n    for i in range(0, num_pts):\n        poly_line.GetPointIds().SetId(i, i)\n\n    # Create a cell array to store the lines in and add the lines to it.\n    cells = vtkCellArray()\n    cells.InsertNextCell(poly_line)\n\n    # Add the lines to the dataset\n    poly_data.SetLines(cells)\n\n    poly_data.Modified()\n\n    transform = vtkTransform()\n    if utm:\n        # Scale the elevation.\n        transform.Scale(1, 1, 1)\n    if ecef:\n        # Rotate the ECEF coordinates\n        # into VTK coordinates so that on the screen:\n        # Y points North, X points East and Z points up.\n        transform.RotateX(-(90 - lat_mid_pt))\n        transform.RotateY(0)\n        transform.RotateZ(90 - lat_mid_pt)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputData(table_pd.GetOutput())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    if vtp:\n        writer = vtkXMLPolyDataWriter()\n        writer.SetFileName(vtp_fn)\n        writer.SetInputConnection(transform_filter.GetOutputPort())\n        writer.SetDataModeToBinary()\n        writer.Write()\n\n    colors = vtkNamedColors()\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    lut = get_diverging_lut('cool_warm')\n    # lut = get_diverging_lut1('DarkRed', 'Gainsboro', 'Green')\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(transform_filter.GetOutputPort())\n    mapper.SetScalarRange(elev_range)\n    mapper.SetLookupTable(lut)\n    mapper.ScalarVisibilityOn()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    window_width = 1024\n    window_height = 1024\n\n    # Create a scalar bar\n    scalar_bar = vtkScalarBarActor()\n    scalar_bar.SetLookupTable(mapper.GetLookupTable())\n    scalar_bar.SetTitle('Elevation')\n    scalar_bar.UnconstrainedFontSizeOff()\n    scalar_bar.SetNumberOfLabels(6)\n    scalar_bar.SetVerticalTitleSeparation(50)\n    scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar.SetMaximumHeightInPixels(window_height // 2)\n    scalar_bar.SetBarRatio(scalar_bar.GetBarRatio() * 0.6)\n    scalar_bar.SetPosition(0.87, 0.1)\n\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(window_width, window_height)\n    if ecef:\n        ren_win.SetWindowName('ECEF')\n    elif utm:\n        ren_win.SetWindowName('UTM')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(scalar_bar)\n    renderer.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    cam_orient_manipulator = vtkCameraOrientationWidget()\n    cam_orient_manipulator.SetParentRenderer(renderer)\n    cam_orient_manipulator.On()\n\n    axes = vtkAxesActor()\n    axes.SetXAxisLabelText('East')\n    axes.SetYAxisLabelText('North')\n    # Zenith\n    axes.SetZAxisLabelText('Zenith')\n\n    widget = vtkOrientationMarkerWidget()\n    rgba = [0] * 4\n    colors.GetColor('Carrot', rgba)\n    widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n    widget.SetOrientationMarker(axes)\n    widget.SetInteractor(iren)\n    widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n    widget.SetEnabled(1)\n    widget.InteractiveOn()\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(0)\n\n    iren.Initialize()\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_diverging_lut(color_map: str, table_size: int = 256):\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start-point         mid-point           end-point\\n\n    cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\\n\n    purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\\n\n    green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\\n\n    blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\\n\n    green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\\n\n\n    :param color_map: The color map to use e.g. cool_warm.\n    :param table_size: The table size.\n    :return:\n    \"\"\"\n    color_maps = dict()\n    color_maps['cool_warm'] = {'start': (0.230, 0.299, 0.754), 'mid': (0.865, 0.865, 0.865),\n                               'end': (0.706, 0.016, 0.150)}\n    color_maps['purple_orange'] = {'start': (0.436, 0.308, 0.631), 'mid': (0.865, 0.865, 0.865),\n                                   'end': (0.759, 0.334, 0.046)}\n    color_maps['green_purple'] = {'start': (0.085, 0.532, 0.201), 'mid': (0.865, 0.865, 0.865),\n                                  'end': (0.436, 0.308, 0.631)}\n    color_maps['blue_brown'] = {'start': (0.217, 0.525, 0.910), 'mid': (0.865, 0.865, 0.865),\n                                'end': (0.677, 0.492, 0.093)}\n    color_maps['green_red'] = {'start': (0.085, 0.532, 0.201), 'mid': (0.865, 0.865, 0.865),\n                               'end': (0.758, 0.214, 0.233)}\n\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    cm = color_maps[color_map]\n\n    ctf.AddRGBPoint(0.0, *cm['start'])\n    ctf.AddRGBPoint(0.5, *cm['mid'])\n    ctf.AddRGBPoint(1.0, *cm['end'])\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef get_diverging_lut1(start: str, mid: str, end: str, table_size: int = 256):\n    \"\"\"\n    Create a diverging lookup table from three named colors.\n\n    :param start: The start-point point color.\n    :param mid: The mid-point color.\n    :param end: The end-point color.\n    :param table_size:  The table size.\n    :return:\n    \"\"\"\n    colors = vtkNamedColors()\n    # Colour transfer function.\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    p1 = [0.0] + list(colors.GetColor3d(start))\n    p2 = [0.5] + list(colors.GetColor3d(mid))\n    p3 = [1.0] + list(colors.GetColor3d(end))\n    ctf.AddRGBPoint(*p1)\n    ctf.AddRGBPoint(*p2)\n    ctf.AddRGBPoint(*p3)\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/HDRReader/","title":"HDRReader","text":"

vtk-examples/Python/IO/HDRReader

"},{"location":"Python/IO/HDRReader/#description","title":"Description","text":"

Demonstrates how to read high-dynamic-range imaging files.

A callback is used to print out the color window (move the mouse horizontally over the image) and color level (move the mouse vertically over the image).

This is based on IO/Image/Testing/Cxx/TestHDRReader.cxx in the VTK source files.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/HDRReader/#code","title":"Code","text":"

HDRReader.py

##!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkIOImage import vtkHDRReader\nfrom vtkmodules.vtkInteractionImage import vtkImageViewer\nfrom vtkmodules.vtkRenderingCore import vtkRenderWindowInteractor\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrate the use of HDRReader'\n    epilogue = '''\nThis example shows how to read in an HDR file.\nA callback is used to print out the color window (move the mouse horizontally over the image)\n and color level (move the mouse vertically over the image).\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='Path to the hdr file e.g. Skyboxes/spiaggia_di_mondello_1k.hdr.')\n    args = parser.parse_args()\n    return args.file_name\n\n\ndef main():\n    file_name = get_program_parameters()\n\n    reader = vtkHDRReader()\n\n    # Check the image can be read\n    if not reader.CanReadFile(file_name):\n        print('CanReadFile failed for ', file_name)\n        return\n\n    reader.SetFileName(file_name)\n    reader.UpdateInformation()\n\n    # Whole extent\n    we = reader.GetDataExtent()\n    extents = [we[0], we[1], we[2], we[3], 0, 0]\n    reader.UpdateExtent(extents)\n    # Visualize\n    image_viewer = vtkImageViewer()\n    image_viewer.SetInputData(reader.GetOutput())\n\n    image_viewer.SetColorWindow(1)\n    image_viewer.SetColorLevel(1)\n    image_viewer.SetPosition(0, 100)\n\n    iren = vtkRenderWindowInteractor()\n    image_viewer.SetupInteractor(iren)\n    image_viewer.GetRenderWindow().SetWindowName('HDRReader')\n    image_viewer.Render()\n\n    iren.AddObserver('EndInteractionEvent', ColorCallback(image_viewer))\n\n    iren.Start()\n\n\nclass ColorCallback(object):\n    def __init__(self, image_viewer):\n        self.image_viewer = image_viewer\n\n    def __call__(self, caller, ev):\n        # Just do this to demonstrate who called callback and the event that triggered it.\n        # print(caller.GetClassName(), 'Event Id:', ev)\n\n        res = 'Color window: {} level: {}'.format(self.image_viewer.GetColorWindow(),\n                                                  self.image_viewer.GetColorLevel())\n        print(res)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ImageWriter/","title":"ImageWriter","text":"

vtk-examples/Python/IO/ImageWriter

"},{"location":"Python/IO/ImageWriter/#description","title":"Description","text":"

A generic function WriteImage() is provided that selects what image writer to use based on the file extension and then writes the render window to the file. The following formats are supported: BMP, JPEG, PNM, PNG, PostScript, TIFF.

If no file extension is specified, PNG is assumed.

The function WriteImage() is also available in the Snippets.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ImageWriter/#code","title":"Code","text":"

ImageWriter.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkBMPWriter,\n    vtkJPEGWriter,\n    vtkPNGWriter,\n    vtkPNMWriter,\n    vtkPostScriptWriter,\n    vtkTIFFWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create source\n    source = vtkSphereSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(5.0)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # color the actor\n    actor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n\n    renWin.SetWindowName('ImageWriter')\n    renWin.Render()\n\n    ext = ['', '.png', '.jpg', '.ps', '.tiff', '.bmp', '.pnm']\n    filenames = list(map(lambda x: 'ImageWriter' + x, ext))\n    filenames[0] = filenames[0] + '1'\n    for f in filenames:\n        WriteImage(f, renWin, rgba=False)\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef WriteImage(fileName, renWin, rgba=True):\n    '''\n    Write the render window view to an image file.\n\n    Image types supported are:\n     BMP, JPEG, PNM, PNG, PostScript, TIFF.\n    The default parameters are used for all writers, change as needed.\n\n    :param fileName: The file name, if no extension then PNG is assumed.\n    :param renWin: The render window.\n    :param rgba: Used to set the buffer type.\n    :return:\n    '''\n\n    import os\n\n    if fileName:\n        # Select the writer to use.\n        path, ext = os.path.splitext(fileName)\n        ext = ext.lower()\n        if not ext:\n            ext = '.png'\n            fileName = fileName + ext\n        if ext == '.bmp':\n            writer = vtkBMPWriter()\n        elif ext == '.jpg':\n            writer = vtkJPEGWriter()\n        elif ext == '.pnm':\n            writer = vtkPNMWriter()\n        elif ext == '.ps':\n            if rgba:\n                rgba = False\n            writer = vtkPostScriptWriter()\n        elif ext == '.tiff':\n            writer = vtkTIFFWriter()\n        else:\n            writer = vtkPNGWriter()\n\n        windowto_image_filter = vtkWindowToImageFilter()\n        windowto_image_filter.SetInput(renWin)\n        windowto_image_filter.SetScale(1)  # image quality\n        if rgba:\n            windowto_image_filter.SetInputBufferTypeToRGBA()\n        else:\n            windowto_image_filter.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            windowto_image_filter.ReadFrontBufferOff()\n            windowto_image_filter.Update()\n\n        writer.SetFileName(fileName)\n        writer.SetInputConnection(windowto_image_filter.GetOutputPort())\n        writer.Write()\n    else:\n        raise RuntimeError('Need a filename.')\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ReadDICOM/","title":"ReadDICOM","text":"

vtk-examples/Python/IO/ReadDICOM

"},{"location":"Python/IO/ReadDICOM/#description","title":"Description","text":"

This example reads a DICOM file and displays it on the screen. DICOM_Prostate is an example data set.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadDICOM/#code","title":"Code","text":"

ReadDICOM.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkDICOMImageReader\nfrom vtkmodules.vtkInteractionImage import vtkImageViewer2\nfrom vtkmodules.vtkRenderingCore import vtkRenderWindowInteractor\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read Dicom image data'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='prostate.img')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    input_filename = get_program_parameters()\n\n    # Read the DICOM file\n    reader = vtkDICOMImageReader()\n    reader.SetFileName(input_filename)\n    reader.Update()\n\n    # Visualize\n    image_viewer = vtkImageViewer2()\n    image_viewer.SetInputConnection(reader.GetOutputPort())\n    render_window_interactor = vtkRenderWindowInteractor()\n    image_viewer.SetupInteractor(render_window_interactor)\n    image_viewer.Render()\n    image_viewer.GetRenderer().SetBackground(colors.GetColor3d(\"SlateGray\"))\n    image_viewer.GetRenderWindow().SetWindowName(\"ReadDICOM\")\n    image_viewer.GetRenderer().ResetCamera()\n    image_viewer.Render()\n\n    render_window_interactor.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
"},{"location":"Python/IO/ReadDICOMSeries/","title":"ReadDICOMSeries","text":"

vtk-examples/Python/IO/ReadDICOMSeries

"},{"location":"Python/IO/ReadDICOMSeries/#description","title":"Description","text":"

This example demonstates how to read a series of DICOM images and how to scroll with the mousewheel or the up/down keys through all slices. Sample data are available as a zipped file (977 kB, 40 slices): DicomTestImages

Seealso

ReadDICOM.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadDICOMSeries/#code","title":"Code","text":"

ReadDICOMSeries.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkDICOMImageReader\nfrom vtkmodules.vtkInteractionImage import vtkImageViewer2\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor2D,\n    vtkRenderWindowInteractor,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\n# Helper class to format slice status message\nclass StatusMessage:\n    @staticmethod\n    def format(slice: int, max_slice: int):\n        return f'Slice Number {slice + 1}/{max_slice + 1}'\n\n\n# Define own interaction style\nclass MyVtkInteractorStyleImage(vtkInteractorStyleImage):\n    def __init__(self, parent=None):\n        super().__init__()\n        self.AddObserver('key_press_event', self.key_press_event)\n        self.AddObserver('mouse_wheel_forward_event', self.mouse_wheel_forward_event)\n        self.AddObserver('mouse_wheel_backward_event', self.mouse_wheel_backward_event)\n        self.image_viewer = None\n        self.status_mapper = None\n        self.slice = 0\n        self.min_slice = 0\n        self.max_slice = 0\n\n    def set_image_viewer(self, image_viewer):\n        self.image_viewer = image_viewer\n        self.min_slice = image_viewer.GetSliceMin()\n        self.max_slice = image_viewer.GetSliceMax()\n        self.slice = self.min_slice\n        print(f'Slicer: Min = {self.min_slice}, Max= {self.max_slice}')\n\n    def set_status_mapper(self, status_mapper):\n        self.status_mapper = status_mapper\n\n    def move_slice_forward(self):\n        if self.slice < self.max_slice:\n            self.slice += 1\n            print(f'MoveSliceForward::Slice = {self.slice}')\n            self.imageviewer.SetSlice(self.slice)\n            msg = StatusMessage.format(self.slice, self.max_slice)\n            self.status_mapper.SetInput(msg)\n            self.imageviewer.Render()\n\n    def move_slice_backward(self):\n        if self.slice > self.min_slice:\n            self.slice -= 1\n            print(f'MoveSliceBackward::Slice = {self.slice}')\n            self.imageviewer.SetSlice(self.slice)\n            msg = StatusMessage.format(self.slice, self.max_slice)\n            self.status_mapper.SetInput(msg)\n            self.imageviewer.Render()\n\n    def key_press_event(self, obj, event):\n        key = self.GetInteractor().GetKeySym()\n        if key == 'Up':\n            self.move_slice_forward()\n        elif key == 'Down':\n            self.move_slice_backward()\n\n    def mouse_wheel_forward_event(self, obj, event):\n        self.move_slice_forward()\n\n    def mouse_wheel_backward_event(self, obj, event):\n        self.move_slice_backward()\n\n\n# Read all the DICOM files in the specified directory.\ndef get_program_parameters():\n    import argparse\n    description = 'Read DICOM series data'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('dirname', help='DicomTestImages.zip')\n    args = parser.parse_args()\n    return args.dirname\n\n\ndef main():\n    colors = vtkNamedColors()\n    reader = vtkDICOMImageReader()\n    folder = get_program_parameters()\n    # Read DICOM files in the specified directory\n    reader.SetDirectoryName(folder)\n    reader.Update()\n\n    # Visualilze\n    image_viewer = vtkImageViewer2()\n    image_viewer.SetInputConnection(reader.GetOutputPort())\n    # Slice status message\n    slice_text_prop = vtkTextProperty()\n    slice_text_prop.SetFontFamilyToCourier()\n    slice_text_prop.SetFontSize(20)\n    slice_text_prop.SetVerticalJustificationToBottom()\n    slice_text_prop.SetJustificationToLeft()\n    # Slice status message\n    slice_text_mapper = vtkTextMapper()\n    msg = StatusMessage.format(image_viewer.GetSliceMin(), image_viewer.GetSliceMax())\n    slice_text_mapper.SetInput(msg)\n    slice_text_mapper.SetTextProperty(slice_text_prop)\n\n    slice_text_actor = vtkActor2D()\n    slice_text_actor.SetMapper(slice_text_mapper)\n    slice_text_actor.SetPosition(15, 10)\n\n    # Usage hint message\n    usage_text_prop = vtkTextProperty()\n    usage_text_prop.SetFontFamilyToCourier()\n    usage_text_prop.SetFontSize(14)\n    usage_text_prop.SetVerticalJustificationToTop()\n    usage_text_prop.SetJustificationToLeft()\n    usage_text_mapper = vtkTextMapper()\n    usage_text_mapper.SetInput(\n        'Slice with mouse wheel\\n  or Up/Down-Key\\n- Zoom with pressed right\\n '\n        ' mouse button while dragging'\n    )\n    usage_text_mapper.SetTextProperty(usage_text_prop)\n\n    usage_text_actor = vtkActor2D()\n    usage_text_actor.SetMapper(usage_text_mapper)\n    usage_text_actor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    usage_text_actor.GetPositionCoordinate().SetValue(0.05, 0.95)\n\n    # Create an interactor with our own style (inherit from\n    # vtkInteractorStyleImage in order to catch mousewheel and key events.\n    render_window_interactor = vtkRenderWindowInteractor()\n    my_interactor_style = MyVtkInteractorStyleImage()\n\n    # Make imageviewer2 and sliceTextMapper visible to our interactorstyle\n    # to enable slice status message updates when  scrolling through the slices.\n    my_interactor_style.set_image_viewer(image_viewer)\n    my_interactor_style.set_status_mapper(slice_text_mapper)\n\n    # Make the interactor use our own interactor style\n    # because SetupInteractor() is defining it's own default interator style\n    # this must be called after SetupInteractor().\n    # renderWindowInteractor.SetInteractorStyle(myInteractorStyle);\n    image_viewer.SetupInteractor(render_window_interactor)\n    render_window_interactor.SetInteractorStyle(my_interactor_style)\n    render_window_interactor.Render()\n\n    # Add slice status message and usage hint message to the renderer.\n    image_viewer.GetRenderer().AddActor2D(slice_text_actor)\n    image_viewer.GetRenderer().AddActor2D(usage_text_actor)\n\n    # Initialize rendering and interaction.\n    image_viewer.Render()\n    image_viewer.GetRenderer().ResetCamera()\n    image_viewer.GetRenderer().SetBackground(colors.GetColor3d('SlateGray'))\n    image_viewer.GetRenderWindow().SetSize(800, 800)\n    image_viewer.GetRenderWindow().SetWindowName('ReadDICOMSeries')\n    image_viewer.Render()\n    render_window_interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ReadExodusData/","title":"ReadExodusData","text":"

vtk-examples/Python/IO/ReadExodusData

"},{"location":"Python/IO/ReadExodusData/#description","title":"Description","text":"

The example uses vtkExodusIIReader to read an ExodusII file. The nodal variable to read is the second argument. The nodal variable is displayed with a color map.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadExodusData/#code","title":"Code","text":"

ReadExodusData.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeometry import vtkCompositeDataGeometryFilter\nfrom vtkmodules.vtkIOExodus import vtkExodusIIReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read and display ExodusII data.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required filename e.g mug.e.')\n    parser.add_argument('nodal_var', help='The nodal variable e,g, convected.')\n    args = parser.parse_args()\n    return args.filename, args.nodal_var\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Input file and variable\n    filename, nodal_var = get_program_parameters()\n\n    # Read Exodus Data\n    reader = vtkExodusIIReader()\n    reader.SetFileName(filename)\n    reader.UpdateInformation()\n    reader.SetTimeStep(10)\n    reader.SetAllArrayStatus(vtkExodusIIReader.NODAL, 1)  # enables all NODAL variables\n    reader.Update()\n    # print(reader)  # uncomment this to show the file information\n\n    # Create Geometry\n    geometry = vtkCompositeDataGeometryFilter()\n    geometry.SetInputConnection(0, reader.GetOutputPort(0))\n    geometry.Update()\n\n    # Mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(geometry.GetOutputPort())\n    mapper.SelectColorArray(nodal_var)\n    mapper.SetScalarModeToUsePointFieldData()\n    mapper.InterpolateScalarsBeforeMappingOn()\n\n    # Actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Renderer\n    renderer = vtkRenderer()\n    renderer.AddViewProp(actor)\n    renderer.SetBackground(colors.GetColor3d('DimGray'))\n\n    renderer.GetActiveCamera().SetPosition(9.0, 9.0, 7.0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0.2, -0.7, 0.7)\n    renderer.GetActiveCamera().SetDistance(14.5)\n\n    # Window and Interactor\n    window = vtkRenderWindow()\n    window.AddRenderer(renderer)\n    window.SetSize(600, 600)\n    window.SetWindowName('ReadExodusData')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(window)\n    interactor.Initialize()\n\n    # Show the result\n    window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ReadImageData/","title":"ReadImageData","text":"

vtk-examples/Python/IO/ReadImageData

"},{"location":"Python/IO/ReadImageData/#description","title":"Description","text":"

This example reads an image data (.vti) file.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadImageData/#code","title":"Code","text":"

ReadImageData.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOXML import vtkXMLImageDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a VTK image data file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='vase.vti')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    # Read the source file.\n    reader = vtkXMLImageDataReader()\n    reader.SetFileName(file_name)\n\n    # Create the mapper that creates graphics elements\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    # Create the Actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    # show the edges of the image grid\n    actor.GetProperty().SetRepresentationToWireframe()\n\n    # Create the Renderer\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.ResetCamera()\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # Create the RendererWindow\n    renderer_window = vtkRenderWindow()\n    renderer_window.AddRenderer(renderer)\n    renderer_window.SetWindowName('ReadImageData')\n\n    # Create the RendererWindowInteractor and display the vti file\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderer_window)\n    interactor.Initialize()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ReadLegacyUnstructuredGrid/","title":"ReadLegacyUnstructuredGrid","text":"

vtk-examples/Python/IO/ReadLegacyUnstructuredGrid

"},{"location":"Python/IO/ReadLegacyUnstructuredGrid/#description","title":"Description","text":"

This example displays a vtkUnstructuredGrid that contains eleven linear cells. We use a number of techniques to visualize the cells.

  1. vtkUnstructuredGridReader reads in the file src/Testing/Data/VTKCellTypes.vtk.
  2. vtkExtractEdges extracts the edges of the 2 and 3 dimensional cells. vtkTubeFilter wraps each edge with tubes.
  3. vtkGlyph3DMapper displays each point as a vtkSphere.
  4. vtkShrinkFilter highlights the cell faces by pulling them in towards their centroid.
  5. vtkLabeledDataMapper shows the point ids.
  6. vtkProperty::EdgeVisibilityOn() shows the edges of the cells after shrinking.
  7. vtkCellData colors each cell with a different color.

The example also shows how to add a vtkCategoryLegend to a visualization. The vtkCategoryLegend has a vtkLookupTable that must be Indexed for categorical data. Since the vtkDataSetMapper for the geometry uses the lookup table to color each cell, we use vtkLookupTable::DeepCopy to copy the input vtkLookupTable and apply vtkLookupTable::IndexedLookupOn().

The sample file is taken from the VTKFileFormats document.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadLegacyUnstructuredGrid/#code","title":"Code","text":"

ReadLegacyUnstructuredGrid.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkChartsCore import vtkCategoryLegend\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkVariantArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellTypes,\n    vtkGenericCell\n)\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\n\n# vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n# VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\ntry:\n    from vtkmodules.vtkFiltersCore import vtkExtractEdges\nexcept ImportError:\n    from vtkmodules.vtkFiltersExtraction import vtkExtractEdges\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOLegacy import vtkUnstructuredGridReader\nfrom vtkmodules.vtkRenderingContext2D import vtkContextTransform\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkGlyph3DMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindowInteractor\n)\nfrom vtkmodules.vtkRenderingLabel import vtkLabeledDataMapper\nfrom vtkmodules.vtkViewsContext2D import vtkContextView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    # Create the reader for the data.\n    print('Loading ', filename)\n    reader = vtkUnstructuredGridReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    extractEdges = vtkExtractEdges()\n    extractEdges.SetInputConnection(reader.GetOutputPort())\n\n    legendValues = vtkVariantArray()\n    it = reader.GetOutput().NewCellIterator()\n    it.InitTraversal()\n    while not it.IsDoneWithTraversal():\n        cell = vtkGenericCell()\n        it.GetCell(cell)\n        cellName = vtkCellTypes.GetClassNameFromTypeId(cell.GetCellType())\n        print(cellName, 'NumberOfPoints:', cell.GetNumberOfPoints(), 'CellDimension:', cell.GetCellDimension())\n        legendValues.InsertNextValue(cellName)\n        it.GoToNextCell()\n\n    # Tube the edges\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(extractEdges.GetOutputPort())\n    tubes.SetRadius(.05)\n    tubes.SetNumberOfSides(21)\n\n    edgeMapper = vtkPolyDataMapper()\n    edgeMapper.SetInputConnection(tubes.GetOutputPort())\n    edgeMapper.SetScalarRange(0, 26)\n\n    edgeActor = vtkActor()\n    edgeActor.SetMapper(edgeMapper)\n    edgeActor.GetProperty().SetSpecular(0.6)\n    edgeActor.GetProperty().SetSpecularPower(30)\n\n    # Glyph the points\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(21)\n    sphere.SetThetaResolution(21)\n    sphere.SetRadius(0.08)\n\n    pointMapper = vtkGlyph3DMapper()\n    pointMapper.SetInputConnection(reader.GetOutputPort())\n    pointMapper.SetSourceConnection(sphere.GetOutputPort())\n    pointMapper.ScalingOff()\n    pointMapper.ScalarVisibilityOff()\n\n    pointActor = vtkActor()\n    pointActor.SetMapper(pointMapper)\n    pointActor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n    pointActor.GetProperty().SetSpecular(0.6)\n    pointActor.GetProperty().SetSpecularColor(1.0, 1.0, 1.0)\n    pointActor.GetProperty().SetSpecularPower(100)\n\n    # Label the points\n    labelMapper = vtkLabeledDataMapper()\n    labelMapper.SetInputConnection(reader.GetOutputPort())\n    labelActor = vtkActor2D()\n    labelActor.SetMapper(labelMapper)\n\n    # The geometry\n    geometryShrink = vtkShrinkFilter()\n    geometryShrink.SetInputConnection(reader.GetOutputPort())\n    geometryShrink.SetShrinkFactor(0.8)\n\n    # NOTE: We must copy the originalLut because the CategoricalLegend\n    # needs an indexed lookup table, but the geometryMapper uses a\n    # non-index lookup table\n    categoricalLut = vtkLookupTable()\n    originalLut = reader.GetOutput().GetCellData().GetScalars().GetLookupTable()\n\n    categoricalLut.DeepCopy(originalLut)\n    categoricalLut.IndexedLookupOn()\n\n    geometryMapper = vtkDataSetMapper()\n    geometryMapper.SetInputConnection(geometryShrink.GetOutputPort())\n    geometryMapper.SetScalarModeToUseCellData()\n    geometryMapper.SetScalarRange(0, 11)\n\n    geometryActor = vtkActor()\n    geometryActor.SetMapper(geometryMapper)\n    geometryActor.GetProperty().SetLineWidth(3)\n    geometryActor.GetProperty().EdgeVisibilityOn()\n    geometryActor.GetProperty().SetEdgeColor(0, 0, 0)\n\n    # Legend\n    for v in range(0, legendValues.GetNumberOfTuples()):\n        categoricalLut.SetAnnotation(legendValues.GetValue(v), legendValues.GetValue(v).ToString())\n    legend = vtkCategoryLegend()\n    legend.SetScalarsToColors(categoricalLut)\n    legend.SetValues(legendValues)\n    legend.SetTitle('Cell Type')\n    legend.GetBrush().SetColor(colors.GetColor4ub('Silver'))\n\n    placeLegend = vtkContextTransform()\n    placeLegend.AddItem(legend)\n    placeLegend.Translate(640 - 20, 480 - 12 * 16)\n\n    contextView = vtkContextView()\n    contextView.GetScene().AddItem(placeLegend)\n\n    renderer = contextView.GetRenderer()\n\n    renderWindow = contextView.GetRenderWindow()\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(geometryActor)\n    renderer.AddActor(labelActor)\n    renderer.AddActor(edgeActor)\n    renderer.AddActor(pointActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    aCamera = vtkCamera()\n    aCamera.Azimuth(-40.0)\n    aCamera.Elevation(50.0)\n\n    renderer.SetActiveCamera(aCamera)\n    renderer.ResetCamera()\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('ReadLegacyUnstructuredGrid')\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Display a vtkUnstructuredGrid that contains eleven linear cells.'\n    epilogue = '''\n    This example also shows how to add a vtkCategoryLegend to a visualization.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='VTKCellTypes.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ReadPLOT3D/","title":"ReadPLOT3D","text":"

vtk-examples/Python/IO/ReadPLOT3D

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadPLOT3D/#code","title":"Code","text":"

ReadPLOT3D.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFile, qFile = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    reader = vtkMultiBlockPLOT3DReader()\n    reader.SetXYZFileName(xyzFile)\n    reader.SetQFileName(qFile)\n    reader.SetScalarFunctionNumber(100)\n    reader.SetVectorFunctionNumber(202)\n    reader.Update()\n\n    geometry = vtkStructuredGridGeometryFilter()\n    geometry.SetInputData(reader.GetOutput().GetBlock(0))\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(geometry.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    render = vtkRenderer()\n    render.AddActor(actor)\n    render.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    render_win = vtkRenderWindow()\n    render_win.AddRenderer(render)\n    render_win.SetSize(640, 480)\n    render_win.SetWindowName('ReadPLOT3D')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(render_win)\n\n    camera = render.GetActiveCamera()\n    camera.SetPosition(5.02611, -23.535, 50.3979)\n    camera.SetFocalPoint(9.33614, 0.0414149, 30.112)\n    camera.SetViewUp(-0.0676794, 0.657814, 0.750134)\n    camera.SetDistance(31.3997)\n    camera.SetClippingRange(12.1468, 55.8147)\n\n    render_win.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read PLOT3D data files'\n    epilogue = '''\n    vtkMultiBlockPLOT3DReader is a reader object that reads PLOT3D formatted files \n    and generates structured grid(s) on output.\n    PLOT3D is a computer graphics program designed to visualize the grids \n    and solutions of computational fluid dynamics.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ReadPolyData/","title":"ReadPolyData","text":"

vtk-examples/Python/IO/ReadPolyData

"},{"location":"Python/IO/ReadPolyData/#description","title":"Description","text":"

This example reads a polygonal data (.vtp) file, for example src/Testing/Data/Torso.vtp.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadPolyData/#code","title":"Code","text":"

ReadPolyData.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a polydata file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Torso.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    # Read all the data from the file\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    # Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('NavajoWhite'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkOliveGreen'))\n    renderer.GetActiveCamera().Pitch(90)\n    renderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    renderer.ResetCamera()\n\n    renderWindow.SetSize(600, 600)\n    renderWindow.Render()\n    renderWindow.SetWindowName('ReadPolyData')\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ReadSLC/","title":"ReadSLC","text":"

vtk-examples/Python/IO/ReadSLC

"},{"location":"Python/IO/ReadSLC/#description","title":"Description","text":"

In this example you will familiarize yourself with the stages required to read a .slc file and create a visualization pipeline in VTK. Following is the three step procedure:

  1. Read the data from .slc file using vtkSLCReader

  2. Implement Marching cubes Algorithm using vtkContourFilter

  3. Create Visualization pipeline to visualize data using an actor, mapper and rendering window

Cite

This example was provided by Bharatesh Chakravarthi from Virtual Environment Lab, Chung-Ang University, Seoul, South Korea

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadSLC/#code","title":"Code","text":"

ReadSLC.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkSLCReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    InputFilename, iso_value = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # vtkSLCReader to read.\n    reader = vtkSLCReader()\n    reader.SetFileName(InputFilename)\n    reader.Update()\n\n    # Create a mapper.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    # Implementing Marching Cubes Algorithm to create the surface using vtkContourFilter object.\n    contourFilter = vtkContourFilter()\n    contourFilter.SetInputConnection(reader.GetOutputPort())\n    # Change the range(2nd and 3rd Paramater) based on your\n    # requirement. recomended value for 1st parameter is above 1\n    # contourFilter.GenerateValues(5, 80.0, 100.0)\n    contourFilter.SetValue(0, iso_value)\n\n    outliner = vtkOutlineFilter()\n    outliner.SetInputConnection(reader.GetOutputPort())\n    outliner.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(contourFilter.GetOutputPort())\n    mapper.SetScalarVisibility(0)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuse(0.8)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Ivory'))\n    actor.GetProperty().SetSpecular(0.8)\n    actor.GetProperty().SetSpecularPower(120.0)\n\n    # Create a rendering window and renderer.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(500, 500)\n\n    # Create a renderwindowinteractor.\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Assign actor to the renderer.\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Pick a good view\n    cam1 = renderer.GetActiveCamera()\n    cam1.SetFocalPoint(0.0, 0.0, 0.0)\n    cam1.SetPosition(0.0, -1.0, 0.0)\n    cam1.SetViewUp(0.0, 0.0, -1.0)\n    cam1.Azimuth(-90.0)\n    renderer.ResetCamera()\n    renderer.ResetCameraClippingRange()\n\n    renderWindow.SetWindowName('ReadSLC')\n    renderWindow.SetSize(640, 512)\n    renderWindow.Render()\n\n    # Enable user interface interactor.\n    renderWindowInteractor.Initialize()\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a .slc file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='vw_knee.slc.')\n    parser.add_argument('iso_value', nargs='?', type=float, default=72.0, help='Defaullt 72.')\n    args = parser.parse_args()\n    return args.filename, args.iso_value\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ReadSTL/","title":"ReadSTL","text":"

vtk-examples/Python/IO/ReadSTL

"},{"location":"Python/IO/ReadSTL/#description","title":"Description","text":"

Read an STL file and create a PolyData output

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadSTL/#code","title":"Code","text":"

ReadSTL.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOGeometry import vtkSTLReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a .stl file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='42400-IDGH.stl')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    reader = vtkSTLReader()\n    reader.SetFileName(filename)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuse(0.8)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('LightSteelBlue'))\n    actor.GetProperty().SetSpecular(0.3)\n    actor.GetProperty().SetSpecularPower(60.0)\n\n    # Create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('ReadSTL')\n\n    # Create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('DarkOliveGreen'))\n\n    # Enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ReadUnstructuredGrid/","title":"ReadUnstructuredGrid","text":"

vtk-examples/Python/IO/ReadUnstructuredGrid

"},{"location":"Python/IO/ReadUnstructuredGrid/#description","title":"Description","text":"

This example demonstrates how to read an unstructured grid (VTU) file. The front facing faces are colored Misty Rose, while the back facing faces are colored Tomato.

An example file to use is src/Testing/Data/tetra.vtu.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadUnstructuredGrid/#code","title":"Code","text":"

ReadUnstructuredGrid.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport vtkmodules.all as vtk\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read an unstructured grid file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='tetra.vtu.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtk.vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    # Read the source file.\n    reader = vtk.vtkXMLUnstructuredGridReader()\n    reader.SetFileName(file_name)\n    reader.Update()  # Needed because of GetScalarRange\n    output = reader.GetOutput()\n    # scalar_range = output.GetScalarRange()\n\n    # Create the mapper that corresponds the objects of the vtk.vtk file\n    # into graphics elements\n    mapper = vtk.vtkDataSetMapper()\n    mapper.SetInputData(output)\n    # mapper.SetScalarRange(scalar_range)\n    mapper.ScalarVisibilityOff()\n\n    # Create the Actor\n    actor = vtk.vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetLineWidth(2.0)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"MistyRose\"))\n\n    backface = vtk.vtkProperty()\n    backface.SetColor(colors.GetColor3d('Tomato'))\n    actor.SetBackfaceProperty(backface)\n\n    # Create the Renderer\n    renderer = vtk.vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n\n    # Create the RendererWindow\n    renderer_window = vtk.vtkRenderWindow()\n    renderer_window.SetSize(640, 480)\n    renderer_window.AddRenderer(renderer)\n    renderer_window.SetWindowName('ReadUnstructuredGrid')\n\n    # Create the RendererWindowInteractor and display the vtk_file\n    interactor = vtk.vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderer_window)\n    interactor.Initialize()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/ReadVTP/","title":"ReadVTP","text":"

vtk-examples/Python/IO/ReadVTP

Other languages

See (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/ReadVTP/#code","title":"Code","text":"

ReadVTP.py

# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a VTK XML PolyData file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='horse.vtp.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Tan'))\n\n    # Create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('ReadVTP')\n\n    # Create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Assign actor to the renderer\n    ren.AddActor(actor)\n\n    # Enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n\n    ren.SetBackground(colors.GetColor3d('AliceBlue'))\n    ren.GetActiveCamera().SetPosition(-0.5, 0.1, 0.0)\n    ren.GetActiveCamera().SetViewUp(0.1, 0.0, 1.0)\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/TransientHDFReader/","title":"TransientHDFReader","text":"

vtk-examples/Python/IO/TransientHDFReader

"},{"location":"Python/IO/TransientHDFReader/#description","title":"Description","text":"

That example uses a feature of vtk_hdf5 that is only available in vtk/master and will be released with VTK 9.3. See this blog post for more information.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/TransientHDFReader/#code","title":"Code","text":"

TransientHDFReader.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOHDF import vtkHDFReader\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDiscretizableColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read transient data writen inside a vtkhdf file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='warping_spheres.vtkhdf')\n    args = parser.parse_args()\n    return args.file_name\n\n\ndef main():\n    fn = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Read the dataset.\n    reader = vtkHDFReader()\n    reader.SetFileName(fn)\n    reader.Update()\n    print('Number of steps: ', reader.GetNumberOfSteps())\n    polydata = reader.GetOutput()\n\n    # Render the dataset.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polydata)\n    mapper.SetLookupTable(get_ctf())\n    mapper.SetScalarModeToUsePointFieldData()\n    mapper.SelectColorArray('SpatioTemporalHarmonics')\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renderer.UseHiddenLineRemovalOn()\n    renderer.AddActor(actor)\n\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetWindowName('TransientHDFReader')\n    ren_win.SetSize(1024, 512)\n    ren_win.Render()\n\n    # Add the interactor.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Add the animation callback.\n    observer = AnimationObserver(iren, reader)\n\n    # You must initialize the vtkRenderWindowInteractor\n    # before adding the observer and setting the repeating timer.\n    iren.Initialize()\n    iren.AddObserver('TimerEvent', observer)\n    iren.CreateRepeatingTimer(50)\n\n    i_style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(i_style)\n\n    iren.Start()\n\n\ndef get_ctf():\n    ctf = vtkDiscretizableColorTransferFunction()\n    ctf.SetColorSpaceToLab()\n    ctf.SetScaleToLinear()\n\n    ctf.AddRGBPoint(-30.3399130649763, 0.0862745098039216, 0.00392156862745098, 0.298039215686275)\n    ctf.AddRGBPoint(-29.3502559661865, 0.113725, 0.0235294, 0.45098)\n    ctf.AddRGBPoint(-28.5283393859863, 0.105882, 0.0509804, 0.509804)\n    ctf.AddRGBPoint(-27.958028793335, 0.0392157, 0.0392157, 0.560784)\n    ctf.AddRGBPoint(-27.4044914245605, 0.0313725, 0.0980392, 0.6)\n    ctf.AddRGBPoint(-26.8677291870117, 0.0431373, 0.164706, 0.639216)\n    ctf.AddRGBPoint(-26.096134185791, 0.054902, 0.243137, 0.678431)\n    ctf.AddRGBPoint(-25.0729293823242, 0.054902, 0.317647, 0.709804)\n    ctf.AddRGBPoint(-23.8148933330084, 0.0509804, 0.396078, 0.741176)\n    ctf.AddRGBPoint(-22.9992658665124, 0.0392157, 0.466667, 0.768627)\n    ctf.AddRGBPoint(-22.1836384000164, 0.0313725, 0.537255, 0.788235)\n    ctf.AddRGBPoint(-21.3323650360107, 0.0313725, 0.615686, 0.811765)\n    ctf.AddRGBPoint(-20.4601268768311, 0.0235294, 0.709804, 0.831373)\n    ctf.AddRGBPoint(-19.5878868103027, 0.0509804, 0.8, 0.85098)\n    ctf.AddRGBPoint(-18.8666133880615, 0.0705882, 0.854902, 0.870588)\n    ctf.AddRGBPoint(-18.1956596374512, 0.262745, 0.901961, 0.862745)\n    ctf.AddRGBPoint(-17.6085758209229, 0.423529, 0.941176, 0.87451)\n    ctf.AddRGBPoint(-16.7027893066406, 0.572549, 0.964706, 0.835294)\n    ctf.AddRGBPoint(-16.0989303588867, 0.658824, 0.980392, 0.843137)\n    ctf.AddRGBPoint(-15.6628112792969, 0.764706, 0.980392, 0.866667)\n    ctf.AddRGBPoint(-15.1931447982788, 0.827451, 0.980392, 0.886275)\n    ctf.AddRGBPoint(-14.2705841064453, 0.913725, 0.988235, 0.937255)\n    ctf.AddRGBPoint(-13.9854288101196, 1, 1, 0.972549019607843)\n    ctf.AddRGBPoint(-13.7002735137939, 0.988235, 0.980392, 0.870588)\n    ctf.AddRGBPoint(-13.2809276580811, 0.992156862745098, 0.972549019607843, 0.803921568627451)\n    ctf.AddRGBPoint(-12.9622249603271, 0.992157, 0.964706, 0.713725)\n    ctf.AddRGBPoint(-12.4254627227783, 0.988235, 0.956863, 0.643137)\n    ctf.AddRGBPoint(-11.5699977874756, 0.980392, 0.917647, 0.509804)\n    ctf.AddRGBPoint(-10.8487224578857, 0.968627, 0.87451, 0.407843)\n    ctf.AddRGBPoint(-10.1106739044189, 0.94902, 0.823529, 0.321569)\n    ctf.AddRGBPoint(-9.57391166687012, 0.929412, 0.776471, 0.278431)\n    ctf.AddRGBPoint(-8.78554153442383, 0.909804, 0.717647, 0.235294)\n    ctf.AddRGBPoint(-8.08104133605957, 0.890196, 0.658824, 0.196078)\n    ctf.AddRGBPoint(-7.50234400308847, 0.878431, 0.619608, 0.168627)\n    ctf.AddRGBPoint(-6.68671653659248, 0.870588, 0.54902, 0.156863)\n    ctf.AddRGBPoint(-5.87108907009648, 0.85098, 0.47451, 0.145098)\n    ctf.AddRGBPoint(-5.05546160360049, 0.831373, 0.411765, 0.133333)\n    ctf.AddRGBPoint(-4.23983413710449, 0.811765, 0.345098, 0.113725)\n    ctf.AddRGBPoint(-3.4242066706085, 0.788235, 0.266667, 0.0941176)\n    ctf.AddRGBPoint(-2.6085792041125, 0.741176, 0.184314, 0.0745098)\n    ctf.AddRGBPoint(-1.79295173761651, 0.690196, 0.12549, 0.0627451)\n    ctf.AddRGBPoint(-0.977324271120517, 0.619608, 0.0627451, 0.0431373)\n    ctf.AddRGBPoint(-0.214114964008331, 0.54902, 0.027451, 0.0705882)\n    ctf.AddRGBPoint(0.456838220357895, 0.470588, 0.0156863, 0.0901961)\n    ctf.AddRGBPoint(1.21166050434113, 0.4, 0.00392157, 0.101961)\n    ctf.AddRGBPoint(2.28518559486346, 0.188235294117647, 0, 0.0705882352941176)\n\n    ctf.SetNumberOfValues(46)\n    ctf.DiscretizeOff()\n\n    return ctf\n\n\nclass AnimationObserver(object):\n    def __init__(self, interactor, reader):\n        self.interactor = interactor\n        self.reader = reader\n\n    def __call__(self, caller, ev):\n        step = 0 if (self.reader.GetStep() == self.reader.GetNumberOfSteps() - 1) else self.reader.GetStep() + 1\n        self.reader.SetStep(step)\n        print('Current step: ', self.reader.GetStep())\n        self.reader.Update()\n        self.interactor.Render()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/WriteLegacyLinearCells/","title":"WriteLegacyLinearCells","text":"

vtk-examples/Python/IO/WriteLegacyLinearCells

"},{"location":"Python/IO/WriteLegacyLinearCells/#description","title":"Description","text":"

This example uses vtkUnstructuredGridWriter to write each linear cell into a .vtk file. The files are written into the current directory.

Seealso

WriteXMLLinearCells writes the same files using the VTK XML format.

Cite

The VTK File Formats document discusses the XML file format.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/WriteLegacyLinearCells/#code","title":"Code","text":"

WriteLegacyLinearCells.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkHexagonalPrism,\n    vtkHexahedron,\n    vtkLine,\n    vtkPentagonalPrism,\n    vtkPixel,\n    vtkPolyLine,\n    vtkPolyVertex,\n    vtkPolygon,\n    vtkPyramid,\n    vtkQuad,\n    vtkTetra,\n    vtkTriangle,\n    vtkTriangleStrip,\n    vtkUnstructuredGrid,\n    vtkVertex,\n    vtkVoxel,\n    vtkWedge\n)\nfrom vtkmodules.vtkIOLegacy import vtkUnstructuredGridWriter\n\n\ndef main():\n    filenames = list()\n    uGrids = list()\n\n    uGrids.append(MakeUnstructuredGrid(vtkVertex()))\n    filenames.append('Vertex.vtk')\n\n    uGrids.append(MakePolyVertex())\n    filenames.append('PolyVertex.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkLine()))\n    filenames.append('Line.vtk')\n\n    uGrids.append(MakePolyLine())\n    filenames.append('PolyLine.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkTriangle()))\n    filenames.append('Triangle.vtk')\n\n    uGrids.append(MakeTriangleStrip())\n    filenames.append('TriangleStrip.vtk')\n\n    uGrids.append(MakePolygon())\n    filenames.append('Polygon.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPixel()))\n    filenames.append('Pixel.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkQuad()))\n    filenames.append('Quad.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkTetra()))\n    filenames.append('Tetra.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkVoxel()))\n    filenames.append('Voxel.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkHexahedron()))\n    filenames.append('Hexahedron.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkWedge()))\n    filenames.append('Wedge.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPyramid()))\n    filenames.append('Pyramid.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPentagonalPrism()))\n    filenames.append('PentagonalPrism.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkHexagonalPrism()))\n    filenames.append('HexagonalPrism.vtk')\n\n    # Write each grid into  a file\n    for i in range(0, len(uGrids)):\n        print('Writing: ', filenames[i])\n        writer = vtkUnstructuredGridWriter()\n        writer.SetFileName(filenames[i])\n        writer.SetInputData(uGrids[i])\n        writer.Write()\n\n\ndef MakeUnstructuredGrid(aCell):\n    pcoords = aCell.GetParametricCoords()\n    for i in range(0, aCell.GetNumberOfPoints()):\n        aCell.GetPointIds().SetId(i, i)\n        aCell.GetPoints().SetPoint(i, (pcoords[3 * i]), (pcoords[3 * i + 1]), (pcoords[3 * i + 2]))\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(aCell.GetPoints())\n    ug.InsertNextCell(aCell.GetCellType(), aCell.GetPointIds())\n    return ug\n\n\ndef MakePolyVertex():\n    # A polyvertex is a cell represents a set of 0D vertices\n    numberOfVertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, .4)\n    points.InsertNextPoint(0, 1, .6)\n\n    polyVertex = vtkPolyVertex()\n    polyVertex.GetPointIds().SetNumberOfIds(numberOfVertices)\n\n    for i in range(0, numberOfVertices):\n        polyVertex.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polyVertex.GetCellType(), polyVertex.GetPointIds())\n\n    return ug\n\n\ndef MakePolyLine():\n    # A polyline is a cell that represents a set of 1D lines\n    numberOfVertices = 5\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, .5, 0)\n    points.InsertNextPoint(.5, 0, 0)\n    points.InsertNextPoint(1, .3, 0)\n    points.InsertNextPoint(1.5, .4, 0)\n    points.InsertNextPoint(2.0, .4, 0)\n\n    polyline = vtkPolyLine()\n    polyline.GetPointIds().SetNumberOfIds(numberOfVertices)\n\n    for i in range(0, numberOfVertices):\n        polyline.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polyline.GetCellType(), polyline.GetPointIds())\n\n    return ug\n\n\ndef MakeTriangleStrip():\n    # A triangle is a cell that represents a triangle strip\n    numberOfVertices = 10\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(.5, 1, 0)\n    points.InsertNextPoint(1, -.1, 0)\n    points.InsertNextPoint(1.5, .8, 0)\n    points.InsertNextPoint(2.0, -.1, 0)\n    points.InsertNextPoint(2.5, .9, 0)\n    points.InsertNextPoint(3.0, 0, 0)\n    points.InsertNextPoint(3.5, .8, 0)\n    points.InsertNextPoint(4.0, -.2, 0)\n    points.InsertNextPoint(4.5, 1.1, 0)\n\n    trianglestrip = vtkTriangleStrip()\n    trianglestrip.GetPointIds().SetNumberOfIds(numberOfVertices)\n    for i in range(0, numberOfVertices):\n        trianglestrip.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(trianglestrip.GetCellType(), trianglestrip.GetPointIds())\n\n    return ug\n\n\ndef MakePolygon():\n    # A polygon is a cell that represents a polygon\n    numberOfVertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, -.1, 0)\n    points.InsertNextPoint(.8, .5, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(.6, 1.2, 0)\n    points.InsertNextPoint(0, .8, 0)\n\n    polygon = vtkPolygon()\n    polygon.GetPointIds().SetNumberOfIds(numberOfVertices)\n    for i in range(0, numberOfVertices):\n        polygon.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polygon.GetCellType(), polygon.GetPointIds())\n\n    return ug\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/WritePLY/","title":"WritePLY","text":"

vtk-examples/Python/IO/WritePLY

"},{"location":"Python/IO/WritePLY/#description","title":"Description","text":"

Note

Unlike vtkPolyDataXMLWriter and most other VTK writers, to write colors to the .ply file you must specify to the vtkPLYWriter:

plyWriter->SetArrayName(\"Colors\");

where your color array was created/named like this:

vtkNew<vtkUnsignedCharArray> colors; colors->SetNumberOfComponents(3); colors->SetName(\"Colors\");

(This was found in response to a user question on StackOverflow: http://stackoverflow.com/questions/17783612/save-mesh-with-rgb-in-vtk/19525938)

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/WritePLY/#code","title":"Code","text":"

WritePLY.py

# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOPLY import (\n    vtkPLYReader,\n    vtkPLYWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate image data, then write a .ply file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required ply filename.', nargs='?',\n                        const='TestWritePLY.ply',\n                        type=str, default='TestWritePLY.ply')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    plyWriter = vtkPLYWriter()\n    plyWriter.SetFileName(filename)\n    plyWriter.SetInputConnection(sphereSource.GetOutputPort())\n    plyWriter.Write()\n\n    # Read and display for verification\n    reader = vtkPLYReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('WritePLY')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('cobalt_green'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/WriteSTL/","title":"WriteSTL","text":"

vtk-examples/Python/IO/WriteSTL

"},{"location":"Python/IO/WriteSTL/#description","title":"Description","text":"

An STL file describes a triangulated three-dimensional surface by the unit normal and vertices (ordered by the right-hand rule) of the triangles. This example saves 3D geometric data stored in a vtkPolyData object to an STL file using vtkSTLWriter.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/WriteSTL/#code","title":"Code","text":"

WriteSTL.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOGeometry import (\n    vtkSTLReader,\n    vtkSTLWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate image data, then write a .stl file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required stl filename.', nargs='?',\n                        const='TestWriteSTL.ply',\n                        type=str, default='TestWriteSTL.ply')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    # Write the stl file to disk\n    stlWriter = vtkSTLWriter()\n    stlWriter.SetFileName(filename)\n    stlWriter.SetInputConnection(sphereSource.GetOutputPort())\n    stlWriter.Write()\n\n    # Read and display for verification\n    reader = vtkSTLReader()\n    reader.SetFileName(filename)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # Create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('WriteSTL')\n\n    # Create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('cobalt_green'))\n\n    # Enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/WriteTriangleToFile/","title":"WriteTriangleToFile","text":"

vtk-examples/Python/IO/WriteTriangleToFile

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/WriteTriangleToFile/#code","title":"Code","text":"

WriteTriangleToFile.py

# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangle\n)\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate image data, then write a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestWriteTriangleToFile.vtp',\n                        type=str, default='TestWriteTriangleToFile.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filename = get_program_parameters()\n\n    Points = vtkPoints()\n    Triangles = vtkCellArray()\n    Triangle = vtkTriangle()\n\n    Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    Triangle.GetPointIds().SetId(0, 0)\n    Triangle.GetPointIds().SetId(1, 1)\n    Triangle.GetPointIds().SetId(2, 2)\n    Triangles.InsertNextCell(Triangle)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.SetPolys(Triangles)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/IO/WriteXMLLinearCells/","title":"WriteXMLLinearCells","text":"

vtk-examples/Python/IO/WriteXMLLinearCells

"},{"location":"Python/IO/WriteXMLLinearCells/#description","title":"Description","text":"

This example uses vtkXMLDataSetWriter to write each linear cell into a .vtu file. The files are written into the current directory.

Seealso

WriteLegacyLinearCells writes the same files using the VTK legacy format.

Cite

The VTK File Formats document discusses the XML file format.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/IO/WriteXMLLinearCells/#code","title":"Code","text":"

WriteXMLLinearCells.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkHexagonalPrism,\n    vtkHexahedron,\n    vtkLine,\n    vtkPentagonalPrism,\n    vtkPixel,\n    vtkPolyLine,\n    vtkPolyVertex,\n    vtkPolygon,\n    vtkPyramid,\n    vtkQuad,\n    vtkTetra,\n    vtkTriangle,\n    vtkTriangleStrip,\n    vtkUnstructuredGrid,\n    vtkVertex,\n    vtkVoxel,\n    vtkWedge\n)\nfrom vtkmodules.vtkIOXML import vtkXMLDataSetWriter\n\n\ndef main():\n    filenames = list()\n    uGrids = list()\n\n    uGrids.append(MakeUnstructuredGrid(vtkVertex()))\n    filenames.append('Vertex.vtu')\n\n    uGrids.append(MakePolyVertex())\n    filenames.append('PolyVertex.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkLine()))\n    filenames.append('Line.vtu')\n\n    uGrids.append(MakePolyLine())\n    filenames.append('PolyLine.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkTriangle()))\n    filenames.append('Triangle.vtu')\n\n    uGrids.append(MakeTriangleStrip())\n    filenames.append('TriangleStrip.vtu')\n\n    uGrids.append(MakePolygon())\n    filenames.append('Polygon.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPixel()))\n    filenames.append('Pixel.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkQuad()))\n    filenames.append('Quad.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkTetra()))\n    filenames.append('Tetra.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkVoxel()))\n    filenames.append('Voxel.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkHexahedron()))\n    filenames.append('Hexahedron.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkWedge()))\n    filenames.append('Wedge.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPyramid()))\n    filenames.append('Pyramid.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPentagonalPrism()))\n    filenames.append('PentagonalPrism.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkHexagonalPrism()))\n    filenames.append('HexagonalPrism.vtu')\n\n    # Write each grid into  a file\n    for i in range(0, len(uGrids)):\n        print('Writing: ', filenames[i])\n        writer = vtkXMLDataSetWriter()\n        writer.SetFileName(filenames[i])\n        writer.SetInputData(uGrids[i])\n        writer.Write()\n\n\ndef MakeUnstructuredGrid(aCell):\n    pcoords = aCell.GetParametricCoords()\n    for i in range(0, aCell.GetNumberOfPoints()):\n        aCell.GetPointIds().SetId(i, i)\n        aCell.GetPoints().SetPoint(i, (pcoords[3 * i]), (pcoords[3 * i + 1]), (pcoords[3 * i + 2]))\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(aCell.GetPoints())\n    ug.InsertNextCell(aCell.GetCellType(), aCell.GetPointIds())\n    return ug\n\n\ndef MakePolyVertex():\n    # A polyvertex is a cell represents a set of 0D vertices\n    numberOfVertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, .4)\n    points.InsertNextPoint(0, 1, .6)\n\n    polyVertex = vtkPolyVertex()\n    polyVertex.GetPointIds().SetNumberOfIds(numberOfVertices)\n\n    for i in range(0, numberOfVertices):\n        polyVertex.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polyVertex.GetCellType(), polyVertex.GetPointIds())\n\n    return ug\n\n\ndef MakePolyLine():\n    # A polyline is a cell that represents a set of 1D lines\n    numberOfVertices = 5\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, .5, 0)\n    points.InsertNextPoint(.5, 0, 0)\n    points.InsertNextPoint(1, .3, 0)\n    points.InsertNextPoint(1.5, .4, 0)\n    points.InsertNextPoint(2.0, .4, 0)\n\n    polyline = vtkPolyLine()\n    polyline.GetPointIds().SetNumberOfIds(numberOfVertices)\n\n    for i in range(0, numberOfVertices):\n        polyline.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polyline.GetCellType(), polyline.GetPointIds())\n\n    return ug\n\n\ndef MakeTriangleStrip():\n    # A triangle is a cell that represents a triangle strip\n    numberOfVertices = 10\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(.5, 1, 0)\n    points.InsertNextPoint(1, -.1, 0)\n    points.InsertNextPoint(1.5, .8, 0)\n    points.InsertNextPoint(2.0, -.1, 0)\n    points.InsertNextPoint(2.5, .9, 0)\n    points.InsertNextPoint(3.0, 0, 0)\n    points.InsertNextPoint(3.5, .8, 0)\n    points.InsertNextPoint(4.0, -.2, 0)\n    points.InsertNextPoint(4.5, 1.1, 0)\n\n    trianglestrip = vtkTriangleStrip()\n    trianglestrip.GetPointIds().SetNumberOfIds(numberOfVertices)\n    for i in range(0, numberOfVertices):\n        trianglestrip.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(trianglestrip.GetCellType(), trianglestrip.GetPointIds())\n\n    return ug\n\n\ndef MakePolygon():\n    # A polygon is a cell that represents a polygon\n    numberOfVertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, -.1, 0)\n    points.InsertNextPoint(.8, .5, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(.6, 1.2, 0)\n    points.InsertNextPoint(0, .8, 0)\n\n    polygon = vtkPolygon()\n    polygon.GetPointIds().SetNumberOfIds(numberOfVertices)\n    for i in range(0, numberOfVertices):\n        polygon.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polygon.GetCellType(), polygon.GetPointIds())\n\n    return ug\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageData/ImageDataGeometryFilter/","title":"ImageDataGeometryFilter","text":"

vtk-examples/Python/ImageData/ImageDataGeometryFilter

"},{"location":"Python/ImageData/ImageDataGeometryFilter/#description","title":"Description","text":"

Convert a vtkImageData to a vtkPolyData.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageData/ImageDataGeometryFilter/#code","title":"Code","text":"

ImageDataGeometryFilter.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkImagingSources import vtkImageCanvasSource2D\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create an image\n    source1 = vtkImageCanvasSource2D()\n    source1.SetScalarTypeToUnsignedChar()\n    source1.SetNumberOfScalarComponents(3)\n    source1.SetExtent(0, 100, 0, 100, 0, 0)\n    source1.SetDrawColor(colors.GetColor4ub('SteelBlue'))\n    source1.FillBox(0, 100, 0, 100)\n    source1.SetDrawColor(colors.GetColor4ub('PaleGoldenrod'))\n    source1.FillBox(10, 20, 10, 20)\n    source1.FillBox(40, 50, 20, 30)\n    source1.Update()\n\n    # Convert the image to a polydata\n    imageDataGeometryFilter = vtkImageDataGeometryFilter()\n    imageDataGeometryFilter.SetInputConnection(source1.GetOutputPort())\n    imageDataGeometryFilter.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(imageDataGeometryFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Visualization\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('RosyBrown'))\n    renderWindow.SetWindowName('ImageDataGeometryFilter')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageData/ImageNormalize/","title":"ImageNormalize","text":"

vtk-examples/Python/ImageData/ImageNormalize

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageData/ImageNormalize/#code","title":"Code","text":"

ImageNormalize.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkImagingCore import vtkImageCast\nfrom vtkmodules.vtkImagingGeneral import vtkImageNormalize\nfrom vtkmodules.vtkImagingSources import vtkImageSinusoidSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create an image\n    source = vtkImageSinusoidSource()\n    source.Update()\n\n    normalizeFilter = vtkImageNormalize()\n\n    normalizeFilter.SetInputConnection(source.GetOutputPort())\n    normalizeFilter.Update()\n\n    inputCastFilter = vtkImageCast()\n    inputCastFilter.SetInputConnection(source.GetOutputPort())\n    inputCastFilter.SetOutputScalarTypeToUnsignedChar()\n    inputCastFilter.Update()\n\n    normalizeCastFilter = vtkImageCast()\n    normalizeCastFilter.SetInputConnection(normalizeFilter.GetOutputPort())\n    normalizeCastFilter.SetOutputScalarTypeToUnsignedChar()\n    normalizeCastFilter.Update()\n\n    # Create actors\n    inputActor = vtkImageActor()\n    inputActor.GetMapper().SetInputConnection(inputCastFilter.GetOutputPort())\n\n    normalizedActor = vtkImageActor()\n    normalizedActor.GetMapper().SetInputConnection(normalizeCastFilter.GetOutputPort())\n\n    # There will be one render window\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n\n    # And one interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Define viewport ranges\n    # (xmin, ymin, xmax, ymax)\n    leftViewport = [0.0, 0.0, 0.5, 1.0]\n    rightViewport = [0.5, 0.0, 1.0, 1.0]\n\n    # Setup both renderers\n    leftRenderer = vtkRenderer()\n    renderWindow.AddRenderer(leftRenderer)\n    leftRenderer.SetViewport(leftViewport)\n    leftRenderer.SetBackground(colors.GetColor3d('Sienna'))\n\n    rightRenderer = vtkRenderer()\n    renderWindow.AddRenderer(rightRenderer)\n    rightRenderer.SetViewport(rightViewport)\n    rightRenderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    leftRenderer.AddActor(inputActor)\n    rightRenderer.AddActor(normalizedActor)\n\n    leftRenderer.ResetCamera()\n\n    rightRenderer.ResetCamera()\n\n    renderWindow.SetWindowName('ImageNormalize')\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageData/ImageWeightedSum/","title":"ImageWeightedSum","text":"

vtk-examples/Python/ImageData/ImageWeightedSum

"},{"location":"Python/ImageData/ImageWeightedSum/#description","title":"Description","text":"

Sum multiple images. Images must be of the same size and type.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageData/ImageWeightedSum/#code","title":"Code","text":"

ImageWeightedSum.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkImagingCore import vtkImageCast\nfrom vtkmodules.vtkImagingMath import vtkImageWeightedSum\nfrom vtkmodules.vtkImagingSources import (\n    vtkImageMandelbrotSource,\n    vtkImageSinusoidSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create image 1\n    source1 = vtkImageMandelbrotSource()\n    source1.SetWholeExtent(0, 255, 0, 255, 0, 0)\n    source1.Update()\n\n    source1Double = vtkImageCast()\n    source1Double.SetInputConnection(0, source1.GetOutputPort())\n    source1Double.SetOutputScalarTypeToDouble()\n\n    # Create image 2\n    source2 = vtkImageSinusoidSource()\n    source2.SetWholeExtent(0, 255, 0, 255, 0, 0)\n    source2.Update()\n\n    # Do the sum\n    sumFilter = vtkImageWeightedSum()\n    sumFilter.SetWeight(0, 0.8)\n    sumFilter.SetWeight(1, 0.2)\n    sumFilter.AddInputConnection(source1Double.GetOutputPort())\n    sumFilter.AddInputConnection(source2.GetOutputPort())\n    sumFilter.Update()\n\n    # Display the images\n    source1CastFilter = vtkImageCast()\n    source1CastFilter.SetInputConnection(source1.GetOutputPort())\n    source1CastFilter.SetOutputScalarTypeToUnsignedChar()\n    source1CastFilter.Update()\n\n    source2CastFilter = vtkImageCast()\n    source2CastFilter.SetInputConnection(source2.GetOutputPort())\n    source2CastFilter.SetOutputScalarTypeToUnsignedChar()\n    source2CastFilter.Update()\n\n    summedCastFilter = vtkImageCast()\n    summedCastFilter.SetInputConnection(sumFilter.GetOutputPort())\n    summedCastFilter.SetOutputScalarTypeToUnsignedChar()\n    summedCastFilter.Update()\n\n    # Create actors\n    source1Actor = vtkImageActor()\n    source1Actor.GetMapper().SetInputConnection(source1CastFilter.GetOutputPort())\n\n    source2Actor = vtkImageActor()\n    source2Actor.GetMapper().SetInputConnection(source2CastFilter.GetOutputPort())\n\n    summedActor = vtkImageActor()\n    summedActor.GetMapper().SetInputConnection(summedCastFilter.GetOutputPort())\n\n    # There will be one render window\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n\n    # And one interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Define viewport ranges\n    # (xmin, ymin, xmax, ymax)\n    leftViewport = [0.0, 0.0, 0.33, 1.0]\n    centerViewport = [0.33, 0.0, .66, 1.0]\n    rightViewport = [0.66, 0.0, 1.0, 1.0]\n\n    # Setup renderers\n    leftRenderer = vtkRenderer()\n    renderWindow.AddRenderer(leftRenderer)\n    leftRenderer.SetViewport(leftViewport)\n    leftRenderer.SetBackground(colors.GetColor3d('Peru'))\n\n    centerRenderer = vtkRenderer()\n    renderWindow.AddRenderer(centerRenderer)\n    centerRenderer.SetViewport(centerViewport)\n    centerRenderer.SetBackground(colors.GetColor3d('DarkTurquoise'))\n\n    rightRenderer = vtkRenderer()\n    renderWindow.AddRenderer(rightRenderer)\n    rightRenderer.SetViewport(rightViewport)\n    rightRenderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    leftRenderer.AddActor(source1Actor)\n    centerRenderer.AddActor(source2Actor)\n    rightRenderer.AddActor(summedActor)\n\n    leftRenderer.ResetCamera()\n    centerRenderer.ResetCamera()\n    rightRenderer.ResetCamera()\n\n    renderWindow.SetWindowName('ImageWeightedSum')\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageData/SumVTKImages/","title":"SumVTKImages","text":"

vtk-examples/Python/ImageData/SumVTKImages

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageData/SumVTKImages/#code","title":"Code","text":"

SumVTKImages.py

#!/usr/bin/env python\n\nfrom vtkmodules.vtkImagingMath import vtkImageWeightedSum\n\n\n# ImageSets = List of Image sets\n# Weights  = List of weights e.g [1, 1, 1]\n\ndef SumVTKImages(ImageSets, Weights):\n    NumOfImages = len(ImageSets)\n    SumFilter = vtkImageWeightedSum()\n    for x in range(0, NumOfImages, 1):\n        SumFilter.AddInputConnection(ImageSets[x])\n        SumFilter.SetWeight(x, Weights[x])\n    SumFilter.Update()\n\n    # Return summed Image as vtkImageData\n    return SumFilter.GetOutput()\n
"},{"location":"Python/ImageData/WriteReadVtkImageData/","title":"WriteReadVtkImageData","text":"

vtk-examples/Python/ImageData/WriteReadVtkImageData

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageData/WriteReadVtkImageData/#code","title":"Code","text":"

WriteReadVtkImageData.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import VTK_DOUBLE\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkIOXML import (\n    vtkXMLImageDataReader,\n    vtkXMLImageDataWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate image data, edit data points, store and reload it.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtk filename, e.g. writeImageData.vti.', nargs='?',\n                        const='writeImageData.vti',\n                        type=str, default='writeImageData.vti')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    imageData = vtkImageData()\n    imageData.SetDimensions(3, 4, 5)\n    imageData.AllocateScalars(VTK_DOUBLE, 1)\n\n    dims = imageData.GetDimensions()\n\n    # Fill every entry of the image data with '2.0'\n    for z in range(dims[2]):\n        for y in range(dims[1]):\n            for x in range(dims[0]):\n                imageData.SetScalarComponentFromDouble(x, y, z, 0, 2.0)\n\n    writer = vtkXMLImageDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(imageData)\n    writer.Write()\n\n    # Read the file (to test that it was written correctly)\n    reader = vtkXMLImageDataReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    # Convert the image to a polydata\n    imageDataGeometryFilter = vtkImageDataGeometryFilter()\n    imageDataGeometryFilter.SetInputConnection(reader.GetOutputPort())\n    imageDataGeometryFilter.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(imageDataGeometryFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetPointSize(3)\n\n    # Setup rendering\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('White'))\n    renderer.ResetCamera()\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageProcessing/Attenuation/","title":"Attenuation","text":"

vtk-examples/Python/ImageProcessing/Attenuation

"},{"location":"Python/ImageProcessing/Attenuation/#description","title":"Description","text":"

This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. This histograms shows how the artifact hides information in the form of scalar value clusters.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageProcessing/Attenuation/#code","title":"Code","text":"

Attenuation.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkSphere\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageCast,\n    vtkImageShiftScale\n)\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToDouble()\n\n    # Get rid of the discrete scalars.\n    smooth = vtkImageGaussianSmooth()\n    smooth.SetInputConnection(cast.GetOutputPort())\n    smooth.SetStandardDeviations(0.8, 0.8, 0)\n\n    m1 = vtkSphere()\n    m1.SetCenter(310, 130, 0)\n    m1.SetRadius(0)\n\n    m2 = vtkSampleFunction()\n    m2.SetImplicitFunction(m1)\n    m2.SetModelBounds(0, 264, 0, 264, 0, 1)\n    m2.SetSampleDimensions(264, 264, 1)\n\n    m3 = vtkImageShiftScale()\n    m3.SetInputConnection(m2.GetOutputPort())\n    m3.SetScale(0.000095)\n\n    div = vtkImageMathematics()\n    div.SetInputConnection(0, smooth.GetOutputPort())\n    div.SetInputConnection(1, m3.GetOutputPort())\n    div.SetOperationToMultiply()\n\n    # Create the actors.\n    colorWindow = 256.0\n    colorLevel = 127.5\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputConnection(cast.GetOutputPort())\n    originalActor.GetProperty().SetColorWindow(colorWindow)\n    originalActor.GetProperty().SetColorLevel(colorLevel)\n\n    filteredActor = vtkImageActor()\n    filteredActor.GetMapper().SetInputConnection(div.GetOutputPort())\n\n    # Define the viewport ranges.\n    # (xmin, ymin, xmax, ymax)\n    originalViewport = [0.0, 0.0, 0.5, 1.0]\n    filteredViewport = [0.5, 0.0, 1.0, 1.0]\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.SetViewport(originalViewport)\n    originalRenderer.AddActor(originalActor)\n    originalRenderer.ResetCamera()\n    originalRenderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    filteredRenderer = vtkRenderer()\n    filteredRenderer.SetViewport(filteredViewport)\n    filteredRenderer.AddActor(filteredActor)\n    filteredRenderer.ResetCamera()\n    filteredRenderer.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.AddRenderer(originalRenderer)\n    renderWindow.AddRenderer(filteredRenderer)\n    renderWindow.SetWindowName('Attenuation')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindowInteractor.Initialize()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This MRI image illustrates attenuation that can occur due to sensor position.'\n    epilogue = '''\n    The artifact is removed by dividing by the attenuation profile determined manually.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='AttenuationArtifact.pgm.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageProcessing/EnhanceEdges/","title":"EnhanceEdges","text":"

vtk-examples/Python/ImageProcessing/EnhanceEdges

"},{"location":"Python/ImageProcessing/EnhanceEdges/#description","title":"Description","text":"

High-pass filters can also be used to compress the range of an image. Since low frequencies account for much of the dynamic range of an image but carry little information, a high-pass filter can significantly decrease an image\u2019s scalar range and emphasize hidden details. The Laplacian filter, which is a second derivative operation, is one implementation of a high-pass filter. It eliminates constant and low frequencies leaving only high-frequency edges. The output of the Laplacian can be subtracted from the original image to produce edge enhancement or sharpening of an image.

This example subtracts the Laplacian (middle) from the original image (left) resulting in edge enhancement or a sharpening operation (right).

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageProcessing/EnhanceEdges/#code","title":"Code","text":"

EnhanceEdges.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingColor import vtkImageMapToWindowLevelColors\nfrom vtkmodules.vtkImagingCore import vtkImageCast\nfrom vtkmodules.vtkImagingGeneral import vtkImageLaplacian\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    scalarRange = [0] * 2\n    scalarRange[0] = reader.GetOutput().GetPointData().GetScalars().GetRange()[0]\n    scalarRange[1] = reader.GetOutput().GetPointData().GetScalars().GetRange()[1]\n    print(\"Range:\", scalarRange)\n    middleSlice = 22\n\n    # Work with triple images.\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToDouble()\n    cast.Update()\n\n    laplacian = vtkImageLaplacian()\n    laplacian.SetInputConnection(cast.GetOutputPort())\n    laplacian.SetDimensionality(3)\n\n    enhance = vtkImageMathematics()\n    enhance.SetInputConnection(0, cast.GetOutputPort())\n    enhance.SetInputConnection(1, laplacian.GetOutputPort())\n    enhance.SetOperationToSubtract()\n\n    colorWindow = (scalarRange[1] - scalarRange[0])\n    colorLevel = colorWindow / 2\n\n    # Map the image through the lookup table.\n    originalColor = vtkImageMapToWindowLevelColors()\n    originalColor.SetWindow(colorWindow)\n    originalColor.SetLevel(colorLevel)\n    originalColor.SetInputConnection(reader.GetOutputPort())\n\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputConnection(originalColor.GetOutputPort())\n    originalActor.GetProperty().SetInterpolationTypeToNearest()\n    originalActor.SetDisplayExtent(\n        reader.GetDataExtent()[0], reader.GetDataExtent()[1],\n        reader.GetDataExtent()[2], reader.GetDataExtent()[3],\n        middleSlice, middleSlice)\n\n    laplacianColor = vtkImageMapToWindowLevelColors()\n    laplacianColor.SetWindow(1000)\n    laplacianColor.SetLevel(0)\n    laplacianColor.SetInputConnection(laplacian.GetOutputPort())\n\n    laplacianActor = vtkImageActor()\n    laplacianActor.GetMapper().SetInputConnection(laplacianColor.GetOutputPort())\n    laplacianActor.GetProperty().SetInterpolationTypeToNearest()\n    laplacianActor.SetDisplayExtent(originalActor.GetDisplayExtent())\n\n    enhancedColor = vtkImageMapToWindowLevelColors()\n    enhancedColor.SetWindow(colorWindow)\n    enhancedColor.SetLevel(colorLevel)\n    enhancedColor.SetInputConnection(enhance.GetOutputPort())\n\n    enhancedActor = vtkImageActor()\n    enhancedActor.GetMapper().SetInputConnection(enhancedColor.GetOutputPort())\n    enhancedActor.GetProperty().SetInterpolationTypeToNearest()\n    enhancedActor.SetDisplayExtent(originalActor.GetDisplayExtent())\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.AddActor(originalActor)\n    laplacianRenderer = vtkRenderer()\n    laplacianRenderer.AddActor(laplacianActor)\n    enhancedRenderer = vtkRenderer()\n    enhancedRenderer.AddActor(enhancedActor)\n\n    renderers = list()\n    renderers.append(originalRenderer)\n    renderers.append(laplacianRenderer)\n    renderers.append(enhancedRenderer)\n\n    # Setup viewports for the renderers.\n    rendererSize = 400\n    xGridDimensions = 3\n    yGridDimensions = 1\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(xGridDimensions):\n            index = row * xGridDimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions, float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions, float(yGridDimensions - row) / yGridDimensions]\n            renderers[index].SetViewport(viewport)\n            renderWindow.AddRenderer(renderers[index])\n    renderWindow.SetWindowName('EnhanceEdges')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Renderers share one camera.\n    renderWindow.Render()\n    renderers[0].GetActiveCamera().Dolly(1.5)\n    renderers[0].ResetCameraClippingRange()\n\n    for r in range(1, len(renderers)):\n        renderers[r].SetActiveCamera(renderers[0].GetActiveCamera())\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'High-pass filters can extract and enhance edges in an image.'\n    epilogue = '''\n    Subtraction of the Laplacian (middle) from the original image (left) results\n     in edge enhancement or a sharpening operation (right).\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageProcessing/GaussianSmooth/","title":"GaussianSmooth","text":"

vtk-examples/Python/ImageProcessing/GaussianSmooth

"},{"location":"Python/ImageProcessing/GaussianSmooth/#description","title":"Description","text":"

Low-pass filters can be implemented as convolution with a Gaussian kernel. The Gaussian kernel displayed on top has been magnified for this figure.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageProcessing/GaussianSmooth/#code","title":"Code","text":"

GaussianSmooth.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import vtkImageCast\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    # Process the image.\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToFloat()\n\n    smoothing_filter = vtkImageGaussianSmooth()\n    smoothing_filter.SetDimensionality(2)\n    smoothing_filter.SetInputConnection(cast.GetOutputPort())\n    smoothing_filter.SetStandardDeviations(4.0, 4.0)\n    smoothing_filter.SetRadiusFactors(2.0, 2.0)\n\n    # Create the actors.\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputConnection(\n        reader.GetOutputPort())\n\n    filteredActor = vtkImageActor()\n    filteredActor.GetMapper().SetInputConnection(\n        smoothing_filter.GetOutputPort())\n\n    # Define the viewport ranges.\n    # (xmin, ymin, xmax, ymax)\n    originalViewport = [0.0, 0.0, 0.5, 1.0]\n    filteredViewport = [0.5, 0.0, 1.0, 1.0]\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.SetViewport(originalViewport)\n    originalRenderer.AddActor(originalActor)\n    originalRenderer.ResetCamera()\n    originalRenderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    filteredRenderer = vtkRenderer()\n    filteredRenderer.SetViewport(filteredViewport)\n    filteredRenderer.AddActor(filteredActor)\n    filteredRenderer.ResetCamera()\n    filteredRenderer.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.SetWindowName('GaussianSmooth')\n    renderWindow.AddRenderer(originalRenderer)\n    renderWindow.AddRenderer(filteredRenderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindowInteractor.Initialize()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Low-pass filters can be implemented as convolution with a Gaussian kernel.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Gourds.png.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageProcessing/HybridMedianComparison/","title":"HybridMedianComparison","text":"

vtk-examples/Python/ImageProcessing/HybridMedianComparison

"},{"location":"Python/ImageProcessing/HybridMedianComparison/#description","title":"Description","text":"

Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. The lower patterns represent the three neighborhoods used to compute the hybrid median.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageProcessing/HybridMedianComparison/#code","title":"Code","text":"

HybridMedianComparison.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageCast,\n    vtkImageThreshold\n)\nfrom vtkmodules.vtkImagingGeneral import (\n    vtkImageHybridMedian2D,\n    vtkImageMedian3D\n)\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkImagingSources import vtkImageNoiseSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    scalarRange = [0] * 2\n    scalarRange[0] = reader.GetOutput().GetPointData().GetScalars().GetRange()[0]\n    scalarRange[1] = reader.GetOutput().GetPointData().GetScalars().GetRange()[1]\n    print(\"Range:\", scalarRange)\n    middleSlice = (reader.GetOutput().GetExtent()[5] - reader.GetOutput().GetExtent()[4]) // 2\n\n    # Work with double images.\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToDouble()\n    cast.Update()\n\n    originalData = vtkImageData()\n    originalData.DeepCopy(cast.GetOutput())\n\n    noisyData = vtkImageData()\n\n    AddShotNoise(originalData, noisyData, 2000.0, 0.1, reader.GetOutput().GetExtent())\n    median = vtkImageMedian3D()\n    median.SetInputData(noisyData)\n    median.SetKernelSize(5, 5, 1)\n\n    hybridMedian1 = vtkImageHybridMedian2D()\n    hybridMedian1.SetInputData(noisyData)\n    hybridMedian = vtkImageHybridMedian2D()\n    hybridMedian.SetInputConnection(hybridMedian1.GetOutputPort())\n\n    colorWindow = (scalarRange[1] - scalarRange[0]) * 0.8\n    colorLevel = colorWindow / 2\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputData(originalData)\n    originalActor.GetProperty().SetColorWindow(colorWindow)\n    originalActor.GetProperty().SetColorLevel(colorLevel)\n    originalActor.GetProperty().SetInterpolationTypeToNearest()\n    originalActor.SetDisplayExtent(reader.GetDataExtent()[0], reader.GetDataExtent()[1], reader.GetDataExtent()[2],\n                                   reader.GetDataExtent()[3], middleSlice, middleSlice)\n\n    noisyActor = vtkImageActor()\n    noisyActor.GetMapper().SetInputData(noisyData)\n    noisyActor.GetProperty().SetColorWindow(colorWindow)\n    noisyActor.GetProperty().SetColorLevel(colorLevel)\n    noisyActor.GetProperty().SetInterpolationTypeToNearest()\n    noisyActor.SetDisplayExtent(originalActor.GetDisplayExtent())\n\n    hybridMedianActor = vtkImageActor()\n    hybridMedianActor.GetMapper().SetInputConnection(hybridMedian.GetOutputPort())\n    hybridMedianActor.GetProperty().SetColorWindow(colorWindow)\n    hybridMedianActor.GetProperty().SetColorLevel(colorLevel)\n    hybridMedianActor.GetProperty().SetInterpolationTypeToNearest()\n    hybridMedianActor.SetDisplayExtent(originalActor.GetDisplayExtent())\n\n    medianActor = vtkImageActor()\n    medianActor.GetMapper().SetInputConnection(median.GetOutputPort())\n    medianActor.GetProperty().SetColorWindow(colorWindow)\n    medianActor.GetProperty().SetColorLevel(colorLevel)\n    medianActor.GetProperty().SetInterpolationTypeToNearest()\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.AddActor(originalActor)\n    noisyRenderer = vtkRenderer()\n    noisyRenderer.AddActor(noisyActor)\n    hybridRenderer = vtkRenderer()\n    hybridRenderer.AddActor(hybridMedianActor)\n    medianRenderer = vtkRenderer()\n    medianRenderer.AddActor(medianActor)\n\n    renderers = list()\n    renderers.append(originalRenderer)\n    renderers.append(noisyRenderer)\n    renderers.append(hybridRenderer)\n    renderers.append(medianRenderer)\n\n    # Setup viewports for the renderers.\n    rendererSize = 400\n    xGridDimensions = 2\n    yGridDimensions = 2\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(\n        rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(xGridDimensions):\n            index = row * xGridDimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions, float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions, float(yGridDimensions - row) / yGridDimensions]\n            renderers[index].SetViewport(viewport)\n            renderWindow.AddRenderer(renderers[index])\n    renderWindow.SetWindowName('HybridMedianComparison')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # The renderers share one camera.\n    renderWindow.Render()\n    renderers[0].GetActiveCamera().Dolly(1.5)\n    renderers[0].ResetCameraClippingRange()\n    for r in range(1, len(renderers)):\n        renderers[r].SetActiveCamera(renderers[0].GetActiveCamera())\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Comparison of median and hybrid-median filters.'\n    epilogue = '''\n    The hybrid filter preserves corners and thin lines, better than the median filter.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='TestPattern.png.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef AddShotNoise(inputImage, outputImage, noiseAmplitude, noiseFraction, extent):\n    shotNoiseSource = vtkImageNoiseSource()\n    shotNoiseSource.SetWholeExtent(extent)\n    shotNoiseSource.SetMinimum(0.0)\n    shotNoiseSource.SetMaximum(1.0)\n\n    shotNoiseThresh1 = vtkImageThreshold()\n    shotNoiseThresh1.SetInputConnection(shotNoiseSource.GetOutputPort())\n    shotNoiseThresh1.ThresholdByLower(1.0 - noiseFraction)\n    shotNoiseThresh1.SetInValue(0)\n    shotNoiseThresh1.SetOutValue(noiseAmplitude)\n    shotNoiseThresh2 = vtkImageThreshold()\n    shotNoiseThresh2.SetInputConnection(shotNoiseSource.GetOutputPort())\n    shotNoiseThresh2.ThresholdByLower(noiseFraction)\n    shotNoiseThresh2.SetInValue(1.0 - noiseAmplitude)\n    shotNoiseThresh2.SetOutValue(0.0)\n\n    shotNoise = vtkImageMathematics()\n    shotNoise.SetInputConnection(0, shotNoiseThresh1.GetOutputPort())\n    shotNoise.SetInputConnection(1, shotNoiseThresh2.GetOutputPort())\n    shotNoise.SetOperationToAdd()\n\n    add = vtkImageMathematics()\n    add.SetInputData(0, inputImage)\n    add.SetInputConnection(1, shotNoise.GetOutputPort())\n    add.SetOperationToAdd()\n    add.Update()\n    outputImage.DeepCopy(add.GetOutput())\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageProcessing/IdealHighPass/","title":"IdealHighPass","text":"

vtk-examples/Python/ImageProcessing/IdealHighPass

"},{"location":"Python/ImageProcessing/IdealHighPass/#description","title":"Description","text":"

Low-pass and high-pass filtering become trivial in the frequency domain. A portion of the pixels are simply masked or attenuated. This example shows a high pass Butterworth filter that attenuates the frequency domain image with the function out(i, j) = 1 / (1 + pow(CutOff/Freq(i,j), 2*Order)).

The gradual attenuation of the filter is important. The ideal high-pass filter, shown in the same exaample, simply masks a set of pixels in the frequency domain. The abrupt transition causes a ringing effect in the spatial domain.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageProcessing/IdealHighPass/#code","title":"Code","text":"

IdealHighPass.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingColor import vtkImageMapToWindowLevelColors\nfrom vtkmodules.vtkImagingCore import vtkImageExtractComponents\nfrom vtkmodules.vtkImagingFourier import (\n    vtkImageButterworthHighPass,\n    vtkImageFFT,\n    vtkImageIdealHighPass,\n    vtkImageRFFT\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    fft = vtkImageFFT()\n    fft.SetInputConnection(reader.GetOutputPort())\n\n    idealHighPass = vtkImageIdealHighPass()\n    idealHighPass.SetInputConnection(fft.GetOutputPort())\n    idealHighPass.SetXCutOff(0.1)\n    idealHighPass.SetYCutOff(0.1)\n\n    idealRfft = vtkImageRFFT()\n    idealRfft.SetInputConnection(idealHighPass.GetOutputPort())\n\n    idealReal = vtkImageExtractComponents()\n    idealReal.SetInputConnection(idealRfft.GetOutputPort())\n    idealReal.SetComponents(0)\n\n    butterworthHighPass = vtkImageButterworthHighPass()\n    butterworthHighPass.SetInputConnection(fft.GetOutputPort())\n    butterworthHighPass.SetXCutOff(0.1)\n    butterworthHighPass.SetYCutOff(0.1)\n\n    butterworthRfft = vtkImageRFFT()\n    butterworthRfft.SetInputConnection(butterworthHighPass.GetOutputPort())\n\n    butterworthReal = vtkImageExtractComponents()\n    butterworthReal.SetInputConnection(butterworthRfft.GetOutputPort())\n    butterworthReal.SetComponents(0)\n\n    # Create the actors.\n    idealColor = vtkImageMapToWindowLevelColors()\n    idealColor.SetWindow(500)\n    idealColor.SetLevel(0)\n    idealColor.SetInputConnection(idealReal.GetOutputPort())\n\n    idealActor = vtkImageActor()\n    idealActor.GetMapper().SetInputConnection(idealColor.GetOutputPort())\n    idealActor.GetProperty().SetInterpolationTypeToNearest()\n\n    butterworthColor = vtkImageMapToWindowLevelColors()\n    butterworthColor.SetWindow(500)\n    butterworthColor.SetLevel(0)\n    butterworthColor.SetInputConnection(butterworthReal.GetOutputPort())\n\n    butterworthActor = vtkImageActor()\n    butterworthActor.GetMapper().SetInputConnection(butterworthColor.GetOutputPort())\n    butterworthActor.GetProperty().SetInterpolationTypeToNearest()\n\n    # Setup the renderers.\n    idealRenderer = vtkRenderer()\n    idealRenderer.SetViewport(0.0, 0.0, 0.5, 1.0)\n    idealRenderer.AddActor(idealActor)\n    idealRenderer.ResetCamera()\n    idealRenderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    butterworthRenderer = vtkRenderer()\n    butterworthRenderer.SetViewport(0.5, 0.0, 1.0, 1.0)\n    butterworthRenderer.AddActor(butterworthActor)\n    butterworthRenderer.SetActiveCamera(idealRenderer.GetActiveCamera())\n    butterworthRenderer.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.SetWindowName('IdealHighPass')\n    renderWindow.AddRenderer(idealRenderer)\n    renderWindow.AddRenderer(butterworthRenderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    idealRenderer.GetActiveCamera().Dolly(1.4)\n    idealRenderer.ResetCameraClippingRange()\n    renderWindowInteractor.Initialize()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This figure shows two high-pass filters in the frequency domain.'\n    epilogue = '''\n    The Butterworth high-pass filter has a gradual attenuation that avoids ringing\n     produced by the ideal high-pass filter with an abrupt transition.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='fullhead15.png.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageProcessing/IsoSubsample/","title":"IsoSubsample","text":"

vtk-examples/Python/ImageProcessing/IsoSubsample

"},{"location":"Python/ImageProcessing/IsoSubsample/#description","title":"Description","text":"

An artifact called aliasing occurs when sub-sampling and is often associated with stair-stepping edges. Sampling theory proves that discrete sampled signals with spacing S, completely describe continuous functions composed of frequencies less than S/2. When a signal is sub-sampled, its capacity to hold high frequency information is reduced. However, the high frequency energy does not disappear. It wraps around the frequency spectrum appearing as a low frequency alias artifact. The solution, which eliminates this artifact, is to low-pass filter before sub-sampling.

Low-pass smoothing reduces the high frequency range of an image that would cause aliasing. The same aliasing phenomena occurs when acquiring data. If a signal from an analog source contains high frequencies, saving the analog data in a discrete form requires sub-sampling that will introduce alias artifacts. For this reason, it is common practice to acquire data at high resolutions,then smooth and subsample to reduce the image to a manageable size.

This example demonstrates aliasing that occurs when a high-frequency signal is sub-sampled. High frequencies appear as low frequency artifacts. The left image is an isosurface of a skull after sub-sampling. The right image used a low-pass filter before sub-sampling to reduce aliasing.

Info

See this figure in Chapter 10 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageProcessing/IsoSubsample/#code","title":"Code","text":"

IsoSubsample.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkImageMarchingCubes\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import vtkImageShrink3D\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    # Read the image.\n    reader_factory = vtkImageReader2Factory()\n    reader = reader_factory.CreateImageReader2(file_name)\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    # Smoothed pipeline.\n    smooth = vtkImageGaussianSmooth()\n    smooth.SetDimensionality(3)\n    smooth.SetInputConnection(reader.GetOutputPort())\n    smooth.SetStandardDeviations(1.75, 1.75, 0.0)\n    smooth.SetRadiusFactor(2)\n\n    subsample_smoothed = vtkImageShrink3D()\n    subsample_smoothed.SetInputConnection(smooth.GetOutputPort())\n    subsample_smoothed.SetShrinkFactors(4, 4, 1)\n\n    iso_smoothed = vtkImageMarchingCubes()\n    iso_smoothed.SetInputConnection(smooth.GetOutputPort())\n    iso_smoothed.SetValue(0, 1150)\n\n    iso_smoothed_mapper = vtkPolyDataMapper()\n    iso_smoothed_mapper.SetInputConnection(iso_smoothed.GetOutputPort())\n    iso_smoothed_mapper.ScalarVisibilityOff()\n\n    iso_smoothed_actor = vtkActor()\n    iso_smoothed_actor.SetMapper(iso_smoothed_mapper)\n    iso_smoothed_actor.GetProperty().SetColor(colors.GetColor3d(\"Ivory\"))\n\n    # Unsmoothed pipeline.\n    # Sub sample the data.\n    subsample = vtkImageShrink3D()\n    subsample.SetInputConnection(reader.GetOutputPort())\n    subsample.SetShrinkFactors(4, 4, 1)\n\n    iso = vtkImageMarchingCubes()\n    iso.SetInputConnection(subsample.GetOutputPort())\n    iso.SetValue(0, 1150)\n\n    iso_mapper = vtkPolyDataMapper()\n    iso_mapper.SetInputConnection(iso.GetOutputPort())\n    iso_mapper.ScalarVisibilityOff()\n\n    iso_actor = vtkActor()\n    iso_actor.SetMapper(iso_mapper)\n    iso_actor.GetProperty().SetColor(colors.GetColor3d(\"Ivory\"))\n\n    # The rendering Pipeline.\n\n    # Setup the render window, renderer, and interactor.\n    left_viewport = [0.0, 0.0, 0.5, 1.0]\n    right_viewport = [0.5, 0.0, 1.0, 1.0]\n\n    renderer_left = vtkRenderer()\n    renderer_left.SetViewport(left_viewport)\n\n    renderer_right = vtkRenderer()\n    renderer_right.SetViewport(right_viewport)\n\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer_left)\n    render_window.AddRenderer(renderer_right)\n\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    renderer_left.AddActor(iso_actor)\n    renderer_right.AddActor(iso_smoothed_actor)\n\n    renderer_left.GetActiveCamera().SetFocalPoint(0.0, 0.0, 0.0)\n    renderer_left.GetActiveCamera().SetPosition(0.0, -1.0, 0.0)\n    renderer_left.GetActiveCamera().SetViewUp(0.0, 0.0, -1.0)\n    renderer_left.ResetCamera()\n    renderer_left.GetActiveCamera().Azimuth(-20.0)\n    renderer_left.GetActiveCamera().Elevation(20.0)\n    renderer_left.ResetCameraClippingRange()\n\n    renderer_left.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    renderer_right.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n    renderer_right.SetActiveCamera(renderer_left.GetActiveCamera())\n\n    render_window.SetSize(640, 480)\n    render_window.SetWindowName('IsoSubsample')\n    render_window.Render()\n\n    render_window_interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This figure demonstrates aliasing that occurs when a high-frequency signal is subsampled.'\n    epilogue = '''\n    High frequencies appear as low frequency artifacts.\n    The left image is an isosurface of a skull after subsampling.\n    The right image used a low-pass filter before subsampling to reduce aliasing.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageProcessing/MedianComparison/","title":"MedianComparison","text":"

vtk-examples/Python/ImageProcessing/MedianComparison

"},{"location":"Python/ImageProcessing/MedianComparison/#description","title":"Description","text":"

Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageProcessing/MedianComparison/#code","title":"Code","text":"

MedianComparison.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageCast,\n    vtkImageThreshold\n)\nfrom vtkmodules.vtkImagingGeneral import (\n    vtkImageGaussianSmooth,\n    vtkImageMedian3D\n)\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkImagingSources import vtkImageNoiseSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    scalarRange = [0] * 2\n    scalarRange[0] = reader.GetOutput().GetPointData().GetScalars().GetRange()[0]\n    scalarRange[1] = reader.GetOutput().GetPointData().GetScalars().GetRange()[1]\n    print(\"Range:\", scalarRange)\n    middleSlice = (reader.GetOutput().GetExtent()[5] - reader.GetOutput().GetExtent()[4]) // 2\n\n    # Work with double images\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToDouble()\n    cast.Update()\n\n    originalData = vtkImageData()\n    originalData.DeepCopy(cast.GetOutput())\n\n    noisyData = vtkImageData()\n\n    AddShotNoise(originalData, noisyData, 2000.0, 0.1, reader.GetOutput().GetExtent())\n    median = vtkImageMedian3D()\n    median.SetInputData(noisyData)\n    median.SetKernelSize(5, 5, 1)\n\n    gaussian = vtkImageGaussianSmooth()\n    gaussian.SetDimensionality(2)\n    gaussian.SetInputData(noisyData)\n    gaussian.SetStandardDeviations(2.0, 2.0)\n    gaussian.SetRadiusFactors(2.0, 2.0)\n\n    colorWindow = (scalarRange[1] - scalarRange[0]) * 0.8\n    colorLevel = colorWindow / 2\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputData(originalData)\n    originalActor.GetProperty().SetColorWindow(colorWindow)\n    originalActor.GetProperty().SetColorLevel(colorLevel)\n    originalActor.GetProperty().SetInterpolationTypeToNearest()\n    originalActor.SetZSlice(middleSlice)\n\n    noisyActor = vtkImageActor()\n    noisyActor.GetMapper().SetInputData(noisyData)\n    noisyActor.GetProperty().SetColorWindow(colorWindow)\n    noisyActor.GetProperty().SetColorLevel(colorLevel)\n    noisyActor.GetProperty().SetInterpolationTypeToNearest()\n    noisyActor.SetZSlice(middleSlice)\n\n    gaussianActor = vtkImageActor()\n    gaussianActor.GetMapper().SetInputConnection(gaussian.GetOutputPort())\n    gaussianActor.GetProperty().SetColorWindow(colorWindow)\n    gaussianActor.GetProperty().SetColorLevel(colorLevel)\n    gaussianActor.GetProperty().SetInterpolationTypeToNearest()\n    gaussianActor.SetZSlice(middleSlice)\n\n    medianActor = vtkImageActor()\n    medianActor.GetMapper().SetInputConnection(median.GetOutputPort())\n    medianActor.GetProperty().SetColorWindow(colorWindow)\n    medianActor.GetProperty().SetColorLevel(colorLevel)\n    medianActor.GetProperty().SetInterpolationTypeToNearest()\n    medianActor.SetZSlice(middleSlice)\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.AddActor(originalActor)\n    noisyRenderer = vtkRenderer()\n    noisyRenderer.AddActor(noisyActor)\n    gaussRenderer = vtkRenderer()\n    gaussRenderer.AddActor(gaussianActor)\n    medianRenderer = vtkRenderer()\n    medianRenderer.AddActor(medianActor)\n\n    renderers = list()\n    renderers.append(originalRenderer)\n    renderers.append(noisyRenderer)\n    renderers.append(gaussRenderer)\n    renderers.append(medianRenderer)\n\n    # Setup viewports for the renderers.\n    rendererSize = 400\n    xGridDimensions = 2\n    yGridDimensions = 2\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(\n        rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(xGridDimensions):\n            index = row * xGridDimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions, float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions, float(yGridDimensions - row) / yGridDimensions]\n            renderers[index].SetViewport(viewport)\n            renderWindow.AddRenderer(renderers[index])\n    renderWindow.SetWindowName('MedianComparison')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # The renderers share one camera.\n    renderWindow.Render()\n    renderers[0].GetActiveCamera().Dolly(1.5)\n    renderers[0].ResetCameraClippingRange()\n    for r in range(1, len(renderers)):\n        renderers[r].SetActiveCamera(renderers[0].GetActiveCamera())\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef AddShotNoise(inputImage, outputImage, noiseAmplitude, noiseFraction, extent):\n    shotNoiseSource = vtkImageNoiseSource()\n    shotNoiseSource.SetWholeExtent(extent)\n    shotNoiseSource.SetMinimum(0.0)\n    shotNoiseSource.SetMaximum(1.0)\n\n    shotNoiseThresh1 = vtkImageThreshold()\n    shotNoiseThresh1.SetInputConnection(shotNoiseSource.GetOutputPort())\n    shotNoiseThresh1.ThresholdByLower(1.0 - noiseFraction)\n    shotNoiseThresh1.SetInValue(0)\n    shotNoiseThresh1.SetOutValue(noiseAmplitude)\n    shotNoiseThresh2 = vtkImageThreshold()\n    shotNoiseThresh2.SetInputConnection(shotNoiseSource.GetOutputPort())\n    shotNoiseThresh2.ThresholdByLower(noiseFraction)\n    shotNoiseThresh2.SetInValue(1.0 - noiseAmplitude)\n    shotNoiseThresh2.SetOutValue(0.0)\n\n    shotNoise = vtkImageMathematics()\n    shotNoise.SetInputConnection(0, shotNoiseThresh1.GetOutputPort())\n    shotNoise.SetInputConnection(1, shotNoiseThresh2.GetOutputPort())\n    shotNoise.SetOperationToAdd()\n\n    add = vtkImageMathematics()\n    add.SetInputData(0, inputImage)\n    add.SetInputConnection(1, shotNoise.GetOutputPort())\n    add.SetOperationToAdd()\n    add.Update()\n    outputImage.DeepCopy(add.GetOutput())\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageProcessing/MorphologyComparison/","title":"MorphologyComparison","text":"

vtk-examples/Python/ImageProcessing/MorphologyComparison

"},{"location":"Python/ImageProcessing/MorphologyComparison/#description","title":"Description","text":"

Although preprocessing can do a lot to improve segmentation results, postprocessing can also be useful. Morphological filters, which operate on binary or discrete images, can be useful for manipulating the shape of the segmented regions. In this brief discussion we will only consider operations that use circular footprints, even though these morphological filters can be defined much more generally.

Erosion is implemented by removing pixels within a specified distance of a border. For each pixel not in the segmented region, all the neighbors in a circular region around the pixels are turned off. This erosion filter shrinks the segmented region and small isolated regions disappear.

The opposite of erosion is dilation. This filter grows the area of segmented regions. Small holes in the segmented region are completely closed. Any pixel not in the segmented region but near the region is turned on.

Dilation and erosion are dual filters with nearly identical implementations. Dilating the \u201con\u201d pixels is equivalent to eroding \u201coff\u201d pixels in a binary image. Holes in the map disappear. However, dilation alone also grows the boundaries of the segmented regions. When dilation is followed by erosion in a closing operation, small holes are removed; however, the boundary of the segmented regions remain in the same general location.

Opening is the dual of closing. Opening removes small islands of pixels. It is implemented with an initial erosion, followed by a dilation.

Connectivity filters can also remove small regions without affecting the remaining boundaries of segmented regions. This set of filters separate the segmented pixels into equivalence classes based on a neighbor relation. Two pixels belong to the same class if they are touching. There are two common neighbor relations in two-dimensional images: four connectivity considers pixels neighbors if they are edge neighbors, and eight connectivity considers pixels neighbors if pixels share any vertex.

This example demonstrates various binary filters that can alter the shape of segmented regions. From left to right, top to bottom: original image, connectivity, erosion, dilation, opening, closing.

Info

See this figure in Chapter 10 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageProcessing/MorphologyComparison/#code","title":"Code","text":"

MorphologyComparison.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingMorphological import (\n    vtkImageDilateErode3D,\n    vtkImageSeedConnectivity\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    # Dilate\n    dilate = vtkImageDilateErode3D()\n    dilate.SetInputConnection(reader.GetOutputPort())\n    dilate.SetDilateValue(0)\n    dilate.SetErodeValue(255)\n    dilate.SetKernelSize(31, 31, 1)\n\n    # Erode\n    erode = vtkImageDilateErode3D()\n    erode.SetInputConnection(reader.GetOutputPort())\n    erode.SetDilateValue(255)\n    erode.SetErodeValue(0)\n    erode.SetKernelSize(31, 31, 1)\n\n    # Opening - dilate then erode.\n    dilate1 = vtkImageDilateErode3D()\n    dilate1.SetInputConnection(reader.GetOutputPort())\n    dilate1.SetDilateValue(0)\n    dilate1.SetErodeValue(255)\n    dilate1.SetKernelSize(31, 31, 1)\n\n    erode1 = vtkImageDilateErode3D()\n    erode1.SetInputConnection(dilate1.GetOutputPort())\n    erode1.SetDilateValue(255)\n    erode1.SetErodeValue(0)\n    erode1.SetKernelSize(31, 31, 1)\n\n    # Closing - erode then dilate.\n    erode2 = vtkImageDilateErode3D()\n    erode2.SetInputConnection(reader.GetOutputPort())\n    erode2.SetDilateValue(255)\n    erode2.SetErodeValue(0)\n    erode2.SetKernelSize(31, 31, 1)\n\n    dilate2 = vtkImageDilateErode3D()\n    dilate2.SetInputConnection(erode2.GetOutputPort())\n    dilate2.SetDilateValue(0)\n    dilate2.SetErodeValue(255)\n    dilate2.SetKernelSize(31, 31, 1)\n\n    # Connectivity\n    con = vtkImageSeedConnectivity()\n    con.SetInputConnection(reader.GetOutputPort())\n    con.AddSeed(300, 200)\n    con.SetInputConnectValue(0)\n    con.SetOutputConnectedValue(0)\n    con.SetOutputUnconnectedValue(255)\n\n    # Actors\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputConnection(reader.GetOutputPort())\n    originalActor.GetProperty().SetInterpolationTypeToNearest()\n\n    connectedActor = vtkImageActor()\n    connectedActor.GetMapper().SetInputConnection(con.GetOutputPort())\n    connectedActor.GetProperty().SetInterpolationTypeToNearest()\n\n    erodeActor = vtkImageActor()\n    erodeActor.GetMapper().SetInputConnection(erode.GetOutputPort())\n    erodeActor.GetProperty().SetInterpolationTypeToNearest()\n\n    dilateActor = vtkImageActor()\n    dilateActor.GetMapper().SetInputConnection(dilate.GetOutputPort())\n    dilateActor.GetProperty().SetInterpolationTypeToNearest()\n\n    openingActor = vtkImageActor()\n    openingActor.GetMapper().SetInputConnection(dilate2.GetOutputPort())\n    openingActor.GetProperty().SetInterpolationTypeToNearest()\n\n    closingActor = vtkImageActor()\n    closingActor.GetMapper().SetInputConnection(erode1.GetOutputPort())\n    closingActor.GetProperty().SetInterpolationTypeToNearest()\n\n    # Setup renderers\n    originalRenderer = vtkRenderer()\n    originalRenderer.AddActor(originalActor)\n    connectedRenderer = vtkRenderer()\n    connectedRenderer.AddActor(connectedActor)\n    dilateRenderer = vtkRenderer()\n    dilateRenderer.AddActor(dilateActor)\n    erodeRenderer = vtkRenderer()\n    erodeRenderer.AddActor(erodeActor)\n    closingRenderer = vtkRenderer()\n    closingRenderer.AddActor(closingActor)\n    openingRenderer = vtkRenderer()\n    openingRenderer.AddActor(openingActor)\n\n    renderers = list()\n    renderers.append(originalRenderer)\n    renderers.append(connectedRenderer)\n    renderers.append(erodeRenderer)\n    renderers.append(dilateRenderer)\n    renderers.append(openingRenderer)\n    renderers.append(closingRenderer)\n\n    # Setup viewports for the renderers\n    rendererSize = 300\n    xGridDimensions = 2\n    yGridDimensions = 3\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(\n        rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(xGridDimensions):\n            index = row * xGridDimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions, float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions, float(yGridDimensions - row) / yGridDimensions]\n            renderers[index].SetViewport(viewport)\n            renderWindow.AddRenderer(renderers[index])\n    renderWindow.SetWindowName('MorphologyComparison')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # The renderers share one camera.\n    renderWindow.Render()\n    renderers[0].GetActiveCamera().Dolly(1.5)\n    renderers[0].ResetCameraClippingRange()\n\n    for r in range(1, len(renderers)):\n        renderers[r].SetActiveCamera(renderers[0].GetActiveCamera())\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrate various binary filters that can alter the shape of segmented regions.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='binary.pgm.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageProcessing/Pad/","title":"Pad","text":"

vtk-examples/Python/ImageProcessing/Pad

"},{"location":"Python/ImageProcessing/Pad/#description","title":"Description","text":"

An important point about the discrete Fourier transform is that it treats the image as a periodic function. This means the pixels on the right border are adjacent to pixels on the left border. Since there is usually no physical relationship between these pixels, the artificial horizontal and vertical edges can distort the frequency spectrum and subsequent processing. To reduce these artifacts, the original image can be multiplied by a window function that becomes zero at the borders.

Another approach removes these artificial edges by smoothing only along the borders.

In both of these approaches, a portion of the original image is lost, so only the central portion of an image can be processed. If this is unacceptable, another solution is to double the dimensions of the original image with a mirror-padding filter. The intermediate image is periodic and continuous.

The lower-left image has been padded with a constant (800). On the right, mirror padding has been used to remove artificial edges introduced by borders.

Info

See Figure 10-12 in Chapter 10 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageProcessing/Pad/#code","title":"Code","text":"

Pad.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingColor import vtkImageMapToWindowLevelColors\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageConstantPad,\n    vtkImageMirrorPad\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    # Pipelines\n    constantPad = vtkImageConstantPad()\n    constantPad.SetInputConnection(reader.GetOutputPort())\n    constantPad.SetConstant(800)\n    constantPad.SetOutputWholeExtent(-127, 383, -127, 383, 22, 22)\n\n    mirrorPad = vtkImageMirrorPad()\n    mirrorPad.SetInputConnection(reader.GetOutputPort())\n    mirrorPad.SetOutputWholeExtent(constantPad.GetOutputWholeExtent())\n\n    # Create actors\n    constantPadColor = vtkImageMapToWindowLevelColors()\n    constantPadColor.SetWindow(2000)\n    constantPadColor.SetLevel(1000)\n    constantPadColor.SetInputConnection(constantPad.GetOutputPort())\n\n    constantPadActor = vtkImageActor()\n    constantPadActor.GetMapper().SetInputConnection(\n        constantPadColor.GetOutputPort())\n    constantPadActor.GetProperty().SetInterpolationTypeToNearest()\n\n    mirrorPadColor = vtkImageMapToWindowLevelColors()\n    mirrorPadColor.SetWindow(2000)\n    mirrorPadColor.SetLevel(1000)\n    mirrorPadColor.SetInputConnection(mirrorPad.GetOutputPort())\n\n    mirrorPadActor = vtkImageActor()\n    mirrorPadActor.GetMapper().SetInputConnection(\n        mirrorPadColor.GetOutputPort())\n    mirrorPadActor.GetProperty().SetInterpolationTypeToNearest()\n\n    # Setup the renderers.\n    constantPadRenderer = vtkRenderer()\n    constantPadRenderer.SetViewport(0.0, 0.0, 0.5, 1.0)\n    constantPadRenderer.AddActor(constantPadActor)\n    constantPadRenderer.ResetCamera()\n    constantPadRenderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    mirrorPadRenderer = vtkRenderer()\n    mirrorPadRenderer.SetViewport(0.5, 0.0, 1.0, 1.0)\n    mirrorPadRenderer.AddActor(mirrorPadActor)\n    mirrorPadRenderer.SetActiveCamera(constantPadRenderer.GetActiveCamera())\n    mirrorPadRenderer.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.SetWindowName('Pad')\n    renderWindow.AddRenderer(constantPadRenderer)\n    renderWindow.AddRenderer(mirrorPadRenderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    constantPadRenderer.GetActiveCamera().Dolly(1.2)\n    constantPadRenderer.ResetCameraClippingRange()\n    renderWindowInteractor.Initialize()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Convolution in frequency space treats the image as a periodic function.'\n    epilogue = '''\n     A large kernel can pick up features from both sides of the image.\n     The lower-left image has been padded with zeros to eliminate wraparound during convolution.\n     On the right, mirror padding has been used to remove artificial edges introduced by borders.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImageProcessing/VTKSpectrum/","title":"VTKSpectrum","text":"

vtk-examples/Python/ImageProcessing/VTKSpectrum

"},{"location":"Python/ImageProcessing/VTKSpectrum/#description","title":"Description","text":"

The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This example shows an image and its power spectrum displayed using a logarithmic transfer function.

Info

See Figure 10-10 in Chapter 10 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImageProcessing/VTKSpectrum/#code","title":"Code","text":"

VTKSpectrum.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import vtkImageMapToColors\nfrom vtkmodules.vtkImagingFourier import (\n    vtkImageFFT,\n    vtkImageFourierCenter\n)\nfrom vtkmodules.vtkImagingMath import (\n    vtkImageLogarithmicScale,\n    vtkImageMagnitude\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkWindowLevelLookupTable\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    fft = vtkImageFFT()\n    fft.SetInputConnection(reader.GetOutputPort())\n\n    mag = vtkImageMagnitude()\n    mag.SetInputConnection(fft.GetOutputPort())\n\n    center = vtkImageFourierCenter()\n    center.SetInputConnection(mag.GetOutputPort())\n\n    compress = vtkImageLogarithmicScale()\n    compress.SetInputConnection(center.GetOutputPort())\n    compress.SetConstant(15)\n    compress.Update()\n\n    # Create the actors.\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputConnection(reader.GetOutputPort())\n    originalActor.GetProperty().SetInterpolationTypeToNearest()\n\n    compressedActor = vtkImageActor()\n    compressedActor.GetMapper().SetInputConnection(compress.GetOutputPort())\n    compressedActor.GetProperty().SetInterpolationTypeToNearest()\n    CreateImageActor(compressedActor, 160, 120)\n\n    # Define the viewport ranges.\n    # (xmin, ymin, xmax, ymax)\n    originalViewport = [0.0, 0.0, 0.5, 1.0]\n    compressedViewport = [0.5, 0.0, 1.0, 1.0]\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.SetViewport(originalViewport)\n    originalRenderer.AddActor(originalActor)\n    originalRenderer.ResetCamera()\n    originalRenderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    compressedRenderer = vtkRenderer()\n    compressedRenderer.SetViewport(compressedViewport)\n    compressedRenderer.AddActor(compressedActor)\n    compressedRenderer.ResetCamera()\n    compressedRenderer.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.SetWindowName('VTKSpectrum')\n    renderWindow.AddRenderer(originalRenderer)\n    renderWindow.AddRenderer(compressedRenderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindowInteractor.Initialize()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The discrete Fourier transform.'\n    epilogue = '''\n    This changes an image from the spatial domain into the frequency domain,\n     where each pixel represents a sinusoidal function.\n    This figure shows an image and its power spectrum displayed using a logarithmic transfer function.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='vtks.pgm.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef CreateImageActor(actor, colorWindow, colorLevel):\n    wlut = vtkWindowLevelLookupTable()\n    wlut.SetWindow(colorWindow)\n    wlut.SetLevel(colorLevel)\n    wlut.Build()\n\n    # Map the image through the lookup table.\n    color = vtkImageMapToColors()\n    color.SetLookupTable(wlut)\n    color.SetInputData(actor.GetMapper().GetInput())\n\n    actor.GetMapper().SetInputConnection(color.GetOutputPort())\n    return\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Images/Actor2D/","title":"Actor2D","text":"

vtk-examples/Python/Images/Actor2D

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Images/Actor2D/#code","title":"Code","text":"

Actor2D.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersGeneral import vtkVertexGlyphFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor2D,\n    vtkPolyDataMapper2D,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    points = vtkPoints()\n    points.InsertNextPoint(10, 10, 0)\n    points.InsertNextPoint(100, 100, 0)\n    points.InsertNextPoint(200, 200, 0)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    glyphFilter = vtkVertexGlyphFilter()\n    glyphFilter.SetInputData(polydata)\n    glyphFilter.Update()\n\n    mapper = vtkPolyDataMapper2D()\n    mapper.SetInputConnection(glyphFilter.GetOutputPort())\n    mapper.Update()\n\n    actor = vtkActor2D()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n    actor.GetProperty().SetPointSize(8)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderWindow.SetSize(300, 300)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    renderWindow.SetWindowName('Actor2D')\n\n    # Render and interact\n    renderWindow.Render()\n    # w2if = vtkWindowToImageFilter()\n    # w2if.SetInput(renderWindow)\n    # w2if.Update()\n    #\n    # writer = vtkPNGWriter()\n    # writer.SetFileName('TestActor2D.png')\n    # writer.SetInputConnection(w2if.GetOutputPort())\n    # writer.Write()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Images/BackgroundImage/","title":"BackgroundImage","text":"

vtk-examples/Python/Images/BackgroundImage

"},{"location":"Python/Images/BackgroundImage/#description","title":"Description","text":"

This example displays an image as the \"background\" of a scene, and renders a superquadric in front of it.

The example accepts a jpeg file on the command line to use as a background image. If there is no file, it generates a simple background.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Images/BackgroundImage/#code","title":"Code","text":"

BackgroundImage.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSuperquadricSource\nfrom vtkmodules.vtkIOImage import vtkJPEGReader\nfrom vtkmodules.vtkImagingSources import vtkImageCanvasSource2D\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkImageActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Add a background image at a render window.'\n    epilogue = '''\n        Add a background image to a render window.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', default=None, type=str, nargs='?', help='A required filename.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    #  Verify input arguments\n    fn = get_program_parameters()\n    if fn:\n        # Read the image\n        jpeg_reader = vtkJPEGReader()\n        if not jpeg_reader.CanReadFile(fn):\n            print('Error reading file:', fn)\n            return\n\n        jpeg_reader.SetFileName(fn)\n        jpeg_reader.Update()\n        image_data = jpeg_reader.GetOutput()\n    else:\n        canvas_source = vtkImageCanvasSource2D()\n        canvas_source.SetExtent(0, 100, 0, 100, 0, 0)\n        canvas_source.SetScalarTypeToUnsignedChar()\n        canvas_source.SetNumberOfScalarComponents(3)\n        canvas_source.SetDrawColor(colors.GetColor4ub('warm_grey'))\n        canvas_source.FillBox(0, 100, 0, 100)\n        canvas_source.SetDrawColor(colors.GetColor4ub('DarkCyan'))\n        canvas_source.FillTriangle(10, 10, 25, 10, 25, 25)\n        canvas_source.SetDrawColor(colors.GetColor4ub('LightCoral'))\n        canvas_source.FillTube(75, 75, 0, 75, 5.0)\n        canvas_source.Update()\n        image_data = canvas_source.GetOutput()\n\n    # Create an image actor to display the image\n    image_actor = vtkImageActor()\n    image_actor.SetInputData(image_data)\n\n    # Create a renderer to display the image in the background\n    background_renderer = vtkRenderer()\n\n    # Create a superquadric\n    superquadric_source = vtkSuperquadricSource()\n    superquadric_source.SetPhiRoundness(1.1)\n    superquadric_source.SetThetaRoundness(.2)\n\n    # Create a mapper and actor\n    superquadric_mapper = vtkPolyDataMapper()\n    superquadric_mapper.SetInputConnection(superquadric_source.GetOutputPort())\n\n    superquadric_actor = vtkActor()\n    superquadric_actor.SetMapper(superquadric_mapper)\n    superquadric_actor.GetProperty().SetColor(colors.GetColor3d('NavajoWhite'))\n\n    scene_renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n\n    # Set up the render window and renderers such that there is\n    # a background layer and a foreground layer\n    background_renderer.SetLayer(0)\n    background_renderer.InteractiveOff()\n    scene_renderer.SetLayer(1)\n    render_window.SetNumberOfLayers(2)\n    render_window.AddRenderer(background_renderer)\n    render_window.AddRenderer(scene_renderer)\n    render_window.SetWindowName('BackgroundImage')\n\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    # Add actors to the renderers\n    scene_renderer.AddActor(superquadric_actor)\n    background_renderer.AddActor(image_actor)\n\n    # Render once to figure out where the background camera will be\n    render_window.Render()\n\n    # Set up the background camera to fill the renderer with the image\n    origin = image_data.GetOrigin()\n    spacing = image_data.GetSpacing()\n    extent = image_data.GetExtent()\n\n    camera = background_renderer.GetActiveCamera()\n    camera.ParallelProjectionOn()\n\n    xc = origin[0] + 0.5 * (extent[0] + extent[1]) * spacing[0]\n    yc = origin[1] + 0.5 * (extent[2] + extent[3]) * spacing[1]\n    # xd = (extent[1] - extent[0] + 1) * spacing[0]\n    yd = (extent[3] - extent[2] + 1) * spacing[1]\n    d = camera.GetDistance()\n    camera.SetParallelScale(0.5 * yd)\n    camera.SetFocalPoint(xc, yc, 0.0)\n    camera.SetPosition(xc, yc, d)\n\n    # Render again to set the correct view\n    render_window.Render()\n\n    # Interact with the window\n    render_window_interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Images/Cast/","title":"Cast","text":"

vtk-examples/Python/Images/Cast

"},{"location":"Python/Images/Cast/#description","title":"Description","text":"

Cast an image to a different type.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Images/Cast/#code","title":"Code","text":"

Cast.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkImagingCore import vtkImageCast\nfrom vtkmodules.vtkImagingSources import vtkImageMandelbrotSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a float image\n    source = vtkImageMandelbrotSource()\n    source.Update()\n\n    print(source.GetOutput().GetScalarTypeAsString())\n\n    castFilter = vtkImageCast()\n    castFilter.SetInputConnection(source.GetOutputPort())\n    castFilter.SetOutputScalarTypeToUnsignedChar()\n    castFilter.Update()\n\n    # Create an actor\n    actor = vtkImageActor()\n    actor.GetMapper().SetInputConnection(castFilter.GetOutputPort())\n\n    # Setup renderer\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renderer.ResetCamera()\n\n    # Setup render window\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('Cast')\n\n    # Setup render window interactor\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    # Render and start interaction\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindow.Render()\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Images/ImageWarp/","title":"ImageWarp","text":"

vtk-examples/Python/Images/ImageWarp

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Images/ImageWarp/#code","title":"Code","text":"

ImageWarp.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkMergeFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpScalar\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkIOImage import vtkBMPReader\nfrom vtkmodules.vtkImagingColor import vtkImageLuminance\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [60, 93, 144, 255])\n\n    # Read in an image and compute a luminance value. The image is extracted\n    # as a set of polygons (vtkImageDataGeometryFilter). We then will\n    # warp the plane using the scalar (luminance) values.\n    #\n    reader = vtkBMPReader()\n    reader.SetFileName(fileName)\n    # Convert the image to a grey scale.\n    luminance = vtkImageLuminance()\n    luminance.SetInputConnection(reader.GetOutputPort())\n    # Pass the data to the pipeline as polygons.\n    geometry = vtkImageDataGeometryFilter()\n    geometry.SetInputConnection(luminance.GetOutputPort())\n    # Warp the data in a direction perpendicular to the image plane.\n    warp = vtkWarpScalar()\n    warp.SetInputConnection(geometry.GetOutputPort())\n    warp.SetScaleFactor(-0.1)\n\n    # Use vtkMergeFilter to combine the original image with the warped geometry.\n    merge = vtkMergeFilter()\n    merge.SetGeometryConnection(warp.GetOutputPort())\n    merge.SetScalarsConnection(reader.GetOutputPort())\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(merge.GetOutputPort())\n    mapper.SetScalarRange(0, 255)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create the rendering window, renderer, and interactive renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(actor)\n    ren.ResetCamera()\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n    # ren.GetActiveCamera().Azimuth(20)\n    # ren.GetActiveCamera().Elevation(30)\n    # ren.ResetCameraClippingRange()\n    # ren.GetActiveCamera().Zoom(1.3)\n    ren.GetActiveCamera().SetPosition(-100, -130, 325)\n    ren.GetActiveCamera().SetFocalPoint(105, 114, -29)\n    ren.GetActiveCamera().SetViewUp(0.51, 0.54, 0.67)\n    ren.ResetCameraClippingRange()\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('ImageWarp')\n\n    # Render the image.\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'ImageWarp.'\n    epilogue = '''\nThis example shows how to combine data from both the imaging\n and graphics pipelines. The vtkMergeData filter is used to\n merge the data from each together.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filePrefix', help='Path to the masonry.bmp file.')\n    args = parser.parse_args()\n    return args.filePrefix\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImplicitFunctions/BooleanOperationImplicitFunctions/","title":"BooleanOperationImplicitFunctions","text":"

vtk-examples/Python/ImplicitFunctions/BooleanOperationImplicitFunctions

"},{"location":"Python/ImplicitFunctions/BooleanOperationImplicitFunctions/#description","title":"Description","text":"

Demonstration on how to perform boolean operations with implicit functions.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImplicitFunctions/BooleanOperationImplicitFunctions/#code","title":"Code","text":"

BooleanOperationImplicitFunctions.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkBox,\n    vtkImplicitBoolean,\n    vtkSphere\n)\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a sphere\n    sphere = vtkSphere()\n    sphere.SetRadius(1)\n    sphere.SetCenter(1, 0, 0)\n\n    # create a box\n    box = vtkBox()\n    box.SetBounds(-1, 1, -1, 1, -1, 1)\n\n    # combine the two implicit functions\n    boolean = vtkImplicitBoolean()\n    boolean.SetOperationTypeToDifference()\n    # boolean.SetOperationTypeToUnion()\n    # boolean.SetOperationTypeToIntersection()\n    boolean.AddFunction(box)\n    boolean.AddFunction(sphere)\n\n    # The sample function generates a distance function from the implicit\n    # function. This is then contoured to get a polygonal surface.\n    sample = vtkSampleFunction()\n    sample.SetImplicitFunction(boolean)\n    sample.SetModelBounds(-1, 2, -1, 1, -1, 1)\n    sample.SetSampleDimensions(40, 40, 40)\n    sample.ComputeNormalsOff()\n\n    # contour\n    surface = vtkContourFilter()\n    surface.SetInputConnection(sample.GetOutputPort())\n    surface.SetValue(0, 0.0)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d('AliceBlue'))\n    actor.GetProperty().SetEdgeColor(colors.GetColor3d('SteelBlue'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # add the actor\n    renderer.AddActor(actor)\n\n    # render window\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('BooleanOperationImplicitFunctions')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    # renderer.GetActiveCamera().AddObserver('ModifiedEvent', CameraModifiedCallback)\n    renderer.GetActiveCamera().SetPosition(5.0, -4.0, 1.6)\n    renderer.GetActiveCamera().SetViewUp(0.1, 0.5, 0.9)\n    renderer.GetActiveCamera().SetDistance(6.7)\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImplicitFunctions/ImplicitQuadric/","title":"ImplicitQuadric","text":"

vtk-examples/Python/ImplicitFunctions/ImplicitQuadric

"},{"location":"Python/ImplicitFunctions/ImplicitQuadric/#description","title":"Description","text":"

Create an ellipsoid by using the implicit quadric.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImplicitFunctions/ImplicitQuadric/#code","title":"Code","text":"

ImplicitQuadric.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create an ellipsoid using a implicit quadric\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0)\n\n    # The sample function generates a distance function from the implicit\n    # function. This is then contoured to get a polygonal surface.\n    sample = vtkSampleFunction()\n    sample.SetImplicitFunction(quadric)\n    sample.SetModelBounds(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5)\n    sample.SetSampleDimensions(40, 40, 40)\n    sample.ComputeNormalsOff()\n\n    # contour\n    surface = vtkContourFilter()\n    surface.SetInputConnection(sample.GetOutputPort())\n    surface.SetValue(0, 0.0)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d('AliceBlue'))\n    actor.GetProperty().SetEdgeColor(colors.GetColor3d('SteelBlue'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # add the actor\n    renderer.AddActor(actor)\n\n    # render window\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('ImplicitQuadric')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImplicitFunctions/ImplicitSphere/","title":"ImplicitSphere","text":"

vtk-examples/Python/ImplicitFunctions/ImplicitSphere

"},{"location":"Python/ImplicitFunctions/ImplicitSphere/#description","title":"Description","text":"

This example creates an isosurface of sampled sphere.

Info

See Figure 6-23b in Chapter 6 the VTK Textbook.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImplicitFunctions/ImplicitSphere/#code","title":"Code","text":"

ImplicitSphere.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkSphere\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor(\"BkgColor\", [51, 77, 102, 255])\n\n    sphere = vtkSphere()\n\n    # Sample the function\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(50, 50, 50)\n    sample.SetImplicitFunction(sphere)\n    value = 2.0\n    xmin = -value\n    xmax = value\n    ymin = -value\n    ymax = value\n    zmin = -value\n    zmax = value\n    sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax)\n\n    # Create the 0 isosurface\n    contours = vtkContourFilter()\n    contours.SetInputConnection(sample.GetOutputPort())\n    contours.GenerateValues(1, 1, 1)\n\n    # Map the contours to graphical primitives\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contours.GetOutputPort())\n    contourMapper.ScalarVisibilityOff()\n\n    # Create an actor for the contours\n    contourActor = vtkActor()\n    contourActor.SetMapper(contourMapper)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('ImplicitSphere')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(contourActor)\n    renderer.SetBackground(colors.GetColor3d(\"BkgColor\"))\n\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImplicitFunctions/ImplicitSphere1/","title":"ImplicitSphere1","text":"

vtk-examples/Python/ImplicitFunctions/ImplicitSphere1

"},{"location":"Python/ImplicitFunctions/ImplicitSphere1/#description","title":"Description","text":"

Shows how to create a surface representing a sphere by creating an implicit sphere, sampling the implicit function, and finally contouring the sampled data to produce the surface.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImplicitFunctions/ImplicitSphere1/#code","title":"Code","text":"

ImplicitSphere1.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkSphere\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphere = vtkSphere()\n    sphere.SetCenter(0, 0, 0)\n    sphere.SetRadius(0.5)\n\n    # The sample function generates a distance function from the implicit\n    # function. This is then contoured to get a polygonal surface.\n    sample = vtkSampleFunction()\n    sample.SetImplicitFunction(sphere)\n    sample.SetModelBounds(-.5, .5, -.5, .5, -.5, .5)\n    sample.SetSampleDimensions(20, 20, 20)\n    sample.ComputeNormalsOff()\n\n    # contour\n    surface = vtkContourFilter()\n    surface.SetInputConnection(sample.GetOutputPort())\n    surface.SetValue(0, 0.0)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d('AliceBlue'))\n    actor.GetProperty().SetEdgeColor(colors.GetColor3d('SteelBlue'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # add the actor\n    renderer.AddActor(actor)\n\n    # render window\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('ImplicitSphere1')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/ImplicitFunctions/SampleFunction/","title":"SampleFunction","text":"

vtk-examples/Python/ImplicitFunctions/SampleFunction

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/ImplicitFunctions/SampleFunction/#code","title":"Code","text":"

SampleFunction.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkSuperquadric\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    value = 2.0\n    colors = vtkNamedColors()\n\n    implicitFunction = vtkSuperquadric()\n    implicitFunction.SetPhiRoundness(2.5)\n    implicitFunction.SetThetaRoundness(.5)\n\n    # Sample the function.\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(50, 50, 50)\n    sample.SetImplicitFunction(implicitFunction)\n\n    xmin, xmax, ymin, ymax, zmin, zmax = -value, value, -value, value, -value, value\n    sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax)\n\n    # Create the 0 isosurface.\n    contours = vtkContourFilter()\n    contours.SetInputConnection(sample.GetOutputPort())\n    contours.GenerateValues(1, 2.0, 2.0)\n\n    # Map the contours to graphical primitives.\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contours.GetOutputPort())\n    contourMapper.SetScalarRange(0.0, 1.2)\n\n    # Create an actor for the contours.\n    contourActor = vtkActor()\n    contourActor.SetMapper(contourMapper)\n\n    # Create a box around the function to indicate the sampling volume. \n\n    # Create outline.\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(sample.GetOutputPort())\n\n    # Map it to graphics primitives.\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    # Create an actor.\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d(\"Black\"))\n\n    # Visualize.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('ImplicitSphere1')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(contourActor)\n    renderer.AddActor(outlineActor)\n    renderer.SetBackground(colors.GetColor3d(\"Tan\"))\n\n    # Enable user interface interactor\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/InfoVis/ParallelCoordinatesExtraction/","title":"ParallelCoordinatesExtraction","text":"

vtk-examples/Python/InfoVis/ParallelCoordinatesExtraction

"},{"location":"Python/InfoVis/ParallelCoordinatesExtraction/#description","title":"Description","text":"

Using Parallel Coordinates View to plot and compare data set attributes, and then using selections in the parallel coordinates view to extract and view data points associated with those selections.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/InfoVis/ParallelCoordinatesExtraction/#code","title":"Code","text":"

ParallelCoordinatesExtraction.py

#!/usr/bin/env python\n\n# Example of how to use Parallel Coordinates View to plot and compare\n# data set attributes, and then to use selections in the parallel coordinates\n# view to extract and view data points associated with those selections\n# Use the 'u' character to toggle between 'inspect modes' on the parallel\n# coordinates view (i.e. between selecting data and manipulating axes)\n# Note that no points will show up inside of the 3d box outline until you\n# select some lines/curves in the parallel coordinates view\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractSelection\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkAnnotationLink,\n    vtkBrownianPoints\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingCore import vtkRTAnalyticSource\nfrom vtkmodules.vtkImagingGeneral import vtkImageGradient\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkViewsInfovis import (\n    vtkParallelCoordinatesRepresentation,\n    vtkParallelCoordinatesView\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Generate an image data set with multiple attribute arrays to probe and view\n    rt = vtkRTAnalyticSource()\n    rt.SetWholeExtent(-3, 3, -3, 3, -3, 3)\n    grad = vtkImageGradient()\n    grad.SetDimensionality(3)\n    grad.SetInputConnection(rt.GetOutputPort())\n    brown = vtkBrownianPoints()\n    brown.SetMinimumSpeed(0.5)\n    brown.SetMaximumSpeed(1.0)\n    brown.SetInputConnection(grad.GetOutputPort())\n    elev = vtkElevationFilter()\n    elev.SetLowPoint(-3, -3, -3)\n    elev.SetHighPoint(3, 3, 3)\n    elev.SetInputConnection(brown.GetOutputPort())\n\n    # Updating here because I will need to probe scalar ranges before\n    # the render window updates the pipeline\n    elev.Update()\n\n    # Set up parallel coordinates representation to be used in View\n    rep = vtkParallelCoordinatesRepresentation()\n    rep.SetInputConnection(elev.GetOutputPort())\n    rep.SetInputArrayToProcess(0, 0, 0, 0, 'RTDataGradient')\n    rep.SetInputArrayToProcess(1, 0, 0, 0, 'RTData')\n    rep.SetInputArrayToProcess(2, 0, 0, 0, 'Elevation')\n    rep.SetInputArrayToProcess(3, 0, 0, 0, 'BrownianVectors')\n    rep.SetUseCurves(0)  # set to 1 to use smooth curves\n    rep.SetLineOpacity(0.5)\n    rep.SetAxisColor(colors.GetColor3d('Gold'))\n    rep.SetLineColor(colors.GetColor3d('MistyRose'))\n\n    # Set up the Parallel Coordinates View and hook in representation\n    view = vtkParallelCoordinatesView()\n    view.SetRepresentation(rep)\n    view.SetInspectMode(view.VTK_INSPECT_SELECT_DATA)\n    view.SetBrushOperatorToReplace()\n    view.SetBrushModeToLasso()\n\n    # Create a annotation link to access selection in parallel coordinates view\n    annotationLink = vtkAnnotationLink()\n    # If you don't set the FieldType explicitly it ends up as UNKNOWN\n    # (as of 21 Feb 2010)\n    # See vtkSelectionNode doc for field and content type enum values\n    annotationLink.GetCurrentSelection().GetNode(0).SetFieldType(1)  # Point\n    annotationLink.GetCurrentSelection().GetNode(0).SetContentType(4)  # Indices\n    # Update before passing annotationLink to vtkExtractSelection\n    annotationLink.Update()\n    # Connect the annotation link to the parallel coordinates representation\n    rep.SetAnnotationLink(annotationLink)\n\n    # Extract portion of data corresponding to parallel coordinates selection\n    extract = vtkExtractSelection()\n    extract.SetInputConnection(0, elev.GetOutputPort())\n    extract.SetInputConnection(1, annotationLink.GetOutputPort(2))\n\n    def update_render_windows(obj, event):\n        '''\n        Handle updating of RenderWindow since it's not a 'View'\n        and so not covered by vtkViewUpdater\n\n        :param obj:\n        :param event:\n        :return:\n        '''\n        # ren.ResetCamera()\n        renWin.Render()\n\n    # Set up callback to update 3d render window when selections are changed in\n    # parallel coordinates view\n    annotationLink.AddObserver('AnnotationChangedEvent', update_render_windows)\n\n    def toggle_inspectors(obj, event):\n\n        if view.GetInspectMode() == 0:\n            view.SetInspectMode(1)\n        else:\n            view.SetInspectMode(0)\n\n    # Set up callback to toggle between inspect modes (manip axes & select data)\n    view.GetInteractor().AddObserver('UserEvent', toggle_inspectors)\n\n    # 3D outline of image data bounds\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(elev.GetOutputPort())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Build the lookup table for the 3d data scalar colors (brown to white)\n    lut = vtkLookupTable()\n    lut.SetTableRange(0, 256)\n    lut.SetHueRange(0.1, 0.1)\n    lut.SetSaturationRange(1.0, 0.1)\n    lut.SetValueRange(0.4, 1.0)\n    lut.Build()\n\n    # Set up the 3d rendering parameters\n    # of the image data which is selected in parallel coordinates\n    coloring_by = 'Elevation'\n    dataMapper = vtkDataSetMapper()\n    dataMapper.SetInputConnection(extract.GetOutputPort())\n    dataMapper.SetScalarModeToUsePointFieldData()\n    dataMapper.SetColorModeToMapScalars()\n    data = elev.GetOutputDataObject(0).GetPointData()\n    dataMapper.ScalarVisibilityOn()\n    dataMapper.SetScalarRange(data.GetArray(coloring_by).GetRange())\n    dataMapper.SetLookupTable(lut)\n    dataMapper.SelectColorArray(coloring_by)\n    dataActor = vtkActor()\n    dataActor.SetMapper(dataMapper)\n    dataActor.GetProperty().SetRepresentationToPoints()\n    dataActor.GetProperty().SetPointSize(10)\n\n    # Set up the 3d render window and add both actors\n    ren = vtkRenderer()\n    ren.AddActor(outlineActor)\n    ren.AddActor(dataActor)\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('ParallelCoordinatesExtraction')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    ren.ResetCamera()\n    renWin.Render()\n\n    # Finalize parallel coordinates view and start interaction event loop\n    view.GetRenderWindow().SetSize(600, 300)\n    view.GetRenderWindow().SetWindowName('ParallelCoordinatesExtraction')\n    view.GetRenderer().GradientBackgroundOn()\n    view.GetRenderer().SetBackground2(colors.GetColor3d('DarkBlue'))\n    view.GetRenderer().SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    view.ResetCamera()\n    view.Render()\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/InfoVis/ParallelCoordinatesView/","title":"ParallelCoordinatesView","text":"

vtk-examples/Python/InfoVis/ParallelCoordinatesView

"},{"location":"Python/InfoVis/ParallelCoordinatesView/#description","title":"Description","text":"

Using Parallel Coordinates View to plot and compare data set attributes.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/InfoVis/ParallelCoordinatesView/#code","title":"Code","text":"

ParallelCoordinatesView.py

#!/usr/bin/env python\n\n# Example of how to use Parallel Coordinates View to plot and compare\n# data set attributes.\n# Use the 'u' character to toggle between 'inspect modes' on the parallel\n# coordinates view (i.e. between selecting data and manipulating axes).\n# Lines which are commented out show alternative options.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkBrownianPoints\nfrom vtkmodules.vtkImagingCore import vtkRTAnalyticSource\nfrom vtkmodules.vtkImagingGeneral import vtkImageGradient\nfrom vtkmodules.vtkViewsInfovis import (\n    vtkParallelCoordinatesRepresentation,\n    vtkParallelCoordinatesView\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Generate an example image data set with multiple attribute arrays to probe\n    # and view.\n    # This is where you would put your reader instead of this rt->elev pipeline...\n    rt = vtkRTAnalyticSource()\n    rt.SetWholeExtent(-3, 3, -3, 3, -3, 3)\n    grad = vtkImageGradient()\n    grad.SetDimensionality(3)\n    grad.SetInputConnection(rt.GetOutputPort())\n    brown = vtkBrownianPoints()\n    brown.SetMinimumSpeed(0.5)\n    brown.SetMaximumSpeed(1.0)\n    brown.SetInputConnection(grad.GetOutputPort())\n    elev = vtkElevationFilter()\n    elev.SetLowPoint(-3, -3, -3)\n    elev.SetHighPoint(3, 3, 3)\n    elev.SetInputConnection(brown.GetOutputPort())\n\n    # Set up the parallel coordinates Representation to be used in the View\n    rep = vtkParallelCoordinatesRepresentation()\n\n    # Plug your reader in here for your own data\n    rep.SetInputConnection(elev.GetOutputPort())\n\n    # List all of the attribute arrays you want plotted in parallel coordinates\n    rep.SetInputArrayToProcess(0, 0, 0, 0, 'RTDataGradient')\n    rep.SetInputArrayToProcess(1, 0, 0, 0, 'RTData')\n    rep.SetInputArrayToProcess(2, 0, 0, 0, 'Elevation')\n    rep.SetInputArrayToProcess(3, 0, 0, 0, 'BrownianVectors')\n\n    rep.SetUseCurves(0)  # set to 1 to use smooth curves\n    rep.SetLineOpacity(0.5)\n    rep.SetAxisColor(colors.GetColor3d('Gold'))\n    rep.SetLineColor(colors.GetColor3d('MistyRose'))\n\n    # Set up the Parallel Coordinates View and hook in the Representation\n    view = vtkParallelCoordinatesView()\n    view.SetRepresentation(rep)\n\n    # Inspect Mode determines whether your interactions manipulate the axes or\n    # select data\n    # view.SetInspectMode(view.VTK_INSPECT_MANIPULATE_AXES)    # VTK_INSPECT_MANIPULATE_AXES = 0,\n    view.SetInspectMode(view.VTK_INSPECT_SELECT_DATA)  # VTK_INSPECT_SELECT_DATA = 1\n\n    # Brush Mode determines the type of interaction you perform to select data\n    view.SetBrushModeToLasso()\n    # view.SetBrushModeToAngle()\n    # view.SetBrushModeToFunction()\n    # view.SetBrushModeToAxisThreshold()  # not implemented yet (as of 21 Feb 2010)\n\n    # Brush Operator determines how each new selection interaction changes\n    # selected lines\n    # view.SetBrushOperatorToAdd()\n    # view.SetBrushOperatorToSubtract()\n    # view.SetBrushOperatorToIntersect()\n    view.SetBrushOperatorToReplace()\n\n    def ToggleInspectors(obj, event):\n        # Define the callback routine which toggles between 'Inspect Modes'\n        if view.GetInspectMode() == 0:\n            view.SetInspectMode(1)\n        else:\n            view.SetInspectMode(0)\n\n    # Hook up the callback to toggle between inspect modes\n    # (manip axes & select data)\n    view.GetInteractor().AddObserver('UserEvent', ToggleInspectors)\n\n    # Set up render window\n    view.GetRenderWindow().SetSize(600, 300)\n    view.GetRenderWindow().SetWindowName('ParallelCoordinatesView')\n    view.GetRenderer().GradientBackgroundOn()\n    view.GetRenderer().SetBackground2(colors.GetColor3d('DarkBlue'))\n    view.GetRenderer().SetBackground(colors.GetColor3d('MidnightBlue'))\n    view.ResetCamera()\n    view.Render()\n\n    # Start interaction event loop\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/InfoVis/SelectedGraphIDs/","title":"SelectedGraphIDs","text":"

vtk-examples/Python/InfoVis/SelectedGraphIDs

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/InfoVis/SelectedGraphIDs/#code","title":"Code","text":"

SelectedGraphIDs.py

#!/usr/bin/env python\n\n# This is a variation on VTK/Examples/Infovis/Python/selection.py\n# which shows how to use a vtkAnnotationLink to view the contents\n# of a selection from a vtkGraphLayoutView\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkAnnotationLink\nfrom vtkmodules.vtkInfovisCore import vtkRandomGraphSource\nfrom vtkmodules.vtkInfovisLayout import vtkSimple2DLayoutStrategy\nfrom vtkmodules.vtkViewsCore import vtkViewTheme\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    source = vtkRandomGraphSource()\n    source.DirectedOff()\n    source.SetNumberOfVertices(100)\n    source.SetEdgeProbability(0)  # Basically generates a tree\n    source.SetUseEdgeProbability(True)\n    source.SetStartWithTree(True)\n    source.IncludeEdgeWeightsOn()\n\n    # Create force directed layout\n    strategy = vtkSimple2DLayoutStrategy()\n    strategy.SetInitialTemperature(5)\n\n    # Create a graph layout view\n    view = vtkGraphLayoutView()\n    view.AddRepresentationFromInputConnection(source.GetOutputPort())\n    view.SetVertexLabelArrayName('vertex id')\n    view.SetVertexLabelVisibility(True)\n    view.SetVertexColorArrayName('vertex id')\n    view.SetColorVertices(True)\n    view.SetEdgeColorArrayName('edge weight')\n    view.SetColorEdges(True)\n    view.SetLayoutStrategy(strategy)\n\n    # Make sure the views are using a pedigree id selection\n    view.GetRepresentation(0).SetSelectionType(2)\n\n    # Create a selection link and set both view to use it\n    annotationLink = vtkAnnotationLink()\n    view.GetRepresentation(0).SetAnnotationLink(annotationLink)\n\n    def select_callback(caller, event):\n        '''\n        In this particular data representation the current selection in the\n         annotation link should always contain two nodes: one for the edges and\n         one for the vertices. Which is which is not consistent, so you need to\n         check the FieldType of each SelectionNode\n\n        :param caller:\n        :param event:\n        :return:\n        '''\n\n        sel = caller.GetCurrentSelection()\n\n        for nn in range(sel.GetNumberOfNodes()):\n            sel_ids = sel.GetNode(nn).GetSelectionList()\n            field_type = sel.GetNode(nn).GetFieldType()\n            if field_type == 3:\n                print('Vertex selection Pedigree IDs')\n            if field_type == 4:\n                print('Edge selection Pedigree IDs')\n            if sel_ids.GetNumberOfTuples() > 0:\n                for ii in range(sel_ids.GetNumberOfTuples()):\n                    print(int(sel_ids.GetTuple1(ii)))\n            else:\n                print('-- empty')\n\n        print('')\n\n    # AnnotationChangedEvent will fire when the selection is changed\n    annotationLink.AddObserver('AnnotationChangedEvent', select_callback)\n\n    # Set the theme on the view\n    theme = vtkViewTheme.CreateMellowTheme()\n    theme.SetLineWidth(5)\n    theme.SetPointSize(10)\n    theme.SetCellOpacity(0.99)\n    theme.SetOutlineColor(colors.GetColor3d('Gray'))\n    # Vertices\n    theme.SetSelectedPointColor(colors.GetColor3d('DodgerBlue'))\n    theme.SetPointHueRange(1.0, 1.0)\n    theme.SetPointSaturationRange(1.0, 1.0)\n    theme.SetPointValueRange(0.0, 1.0)\n    # theme.SetPointAlphaRange(0.2, 0.8)\n    # Edges\n    theme.SetSelectedCellColor(colors.GetColor3d('LavenderBlush'))\n    theme.SetCellHueRange(0.1, 0.1)\n    theme.SetCellSaturationRange(0.2, 1.0)\n    theme.SetCellValueRange(0.5, 1.0)\n    # theme.SetPointAlphaRange(0.2, 0.8)\n    view.ApplyViewTheme(theme)\n    theme.FastDelete()\n\n    view.GetRenderWindow().SetSize(600, 600)\n    view.GetRenderWindow().SetWindowName('SelectedGraphIDs')\n    view.ResetCamera()\n    view.Render()\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Interaction/CallBack/","title":"CallBack","text":"

vtk-examples/Python/Interaction/CallBack

"},{"location":"Python/Interaction/CallBack/#description","title":"Description","text":""},{"location":"Python/Interaction/CallBack/#demonstrate-how-to-set-up-a-callback-with-client-data","title":"Demonstrate how to set up a callback with client data","text":"

Getting the camera orientation after interacting with the image is used as an example.

We define a callback passing the active camera as client data and linking the callback to the EndInteractionEvent of the vtkRenderWindowInteractor class. This allows us to get the camera orientation after we manipulate the image. We can then copy/paste this data as needed into our camera to set up a nice initial orientation as shown in the example.

To help orient the cone, we use a vtkOrientationMarkerWidget and a vtkOutlineFilter.

"},{"location":"Python/Interaction/CallBack/#c","title":"C++","text":"

There are two methodologies in C++.

  1. Create a class that inherits from vtkCallbackCommand reimplementing Execute( vtkObject *caller, unsigned long evId, void*) and setting pointers to a client and/or call data as needed. When the class is implemented, it becomes the callback function.
  2. Create a function with this signature: void f( vtkObject * caller, long unsigned int evId, void* clientData, void* callData) and, where needed, create a vtkCallbackCommand setting its callback to the function we have created.

The example demonstrates both approaches.

In the function PrintCameraOrientation note how we convert an array to a vector and get a comma-separated list.

"},{"location":"Python/Interaction/CallBack/#python","title":"Python","text":"

In Python the approach is even simpler. We simply define a function to use as the callback with this signature: def MyCallback(obj, ev):. Then, to pass client data to it, we simply do: MyCallback.myClientData = myClientData. This relies on the fact that Python functions are in fact objects and we are simply adding new attributes such as myClientData in this case.

An alternative method is to define a class passsing the needed variables in the __init__ function and then implement a _call__ function that does the work.

Both approaches are demonstrated in the example.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Interaction/CallBack/#code","title":"Code","text":"

CallBack.py

#!/usr/bin/env python\n\n'''\nDemonstrate the use of a callback.\n\nWe also add call data.\n'''\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    #  Decide what approach to use.\n    use_function_callback = True\n\n    colors = vtkNamedColors()\n\n    # Create the Renderer, RenderWindow and RenderWindowInteractor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Use a cone as a source.\n    source = vtkConeSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(1)\n    # Use the golden ratio for the height. Because we can!\n    source.SetHeight(1.6180339887498948482)\n    source.SetResolution(128)\n    source.Update()\n\n    # Pipeline\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('peacock'))\n    # Lighting\n    actor.GetProperty().SetAmbient(0.3)\n    actor.GetProperty().SetDiffuse(0.0)\n    actor.GetProperty().SetSpecular(1.0)\n    actor.GetProperty().SetSpecularPower(20.0)\n\n    # Get an outline of the data set for context.\n    outline = vtkOutlineFilter()\n    outline.SetInputData(source.GetOutput())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(actor)\n    ren.AddActor(outlineActor)\n    ren.SetBackground(colors.GetColor3d('AliceBlue'))\n    renWin.SetSize(512, 512)\n\n    # Set up a nice camera position.\n    camera = vtkCamera()\n    camera.SetPosition(4.6, -2.0, 3.8)\n    camera.SetFocalPoint(0.0, 0.0, 0.0)\n    camera.SetClippingRange(3.2, 10.2)\n    camera.SetViewUp(0.3, 1.0, 0.13)\n    ren.SetActiveCamera(camera)\n\n    renWin.Render()\n    renWin.SetWindowName('CallBack')\n\n    axes1 = MakeAxesActor()\n    om1 = vtkOrientationMarkerWidget()\n    om1.SetOrientationMarker(axes1)\n    # Position lower left in the viewport.\n    om1.SetViewport(0, 0, 0.2, 0.2)\n    om1.SetInteractor(iren)\n    om1.EnabledOn()\n    om1.InteractiveOn()\n\n    # Set up the callback.\n    if use_function_callback:\n        # We are going to output the camera position when the event is triggered\n        #  so we add the active camera as an attribute.\n        GetOrientation.cam = ren.GetActiveCamera()\n        # Register the callback with the object that is observing.\n        iren.AddObserver('EndInteractionEvent', GetOrientation)\n    else:\n        iren.AddObserver('EndInteractionEvent', OrientationObserver(ren.GetActiveCamera()))\n        # Or:\n        # observer = OrientationObserver(ren.GetActiveCamera())\n        # iren.AddObserver('EndInteractionEvent', observer)\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef GetOrientation(caller, ev):\n    '''\n    Print out the orientation.\n\n    We must do this before we register the callback in the calling function.\n        GetOrientation.cam = ren.GetActiveCamera()\n\n    :param caller:\n    :param ev: The event.\n    :return:\n    '''\n    # Just do this to demonstrate who called callback and the event that triggered it.\n    print(caller.GetClassName(), 'Event Id:', ev)\n    # Now print the camera orientation.\n    CameraOrientation(GetOrientation.cam)\n\n\nclass OrientationObserver(object):\n    def __init__(self, cam):\n        self.cam = cam\n\n    def __call__(self, caller, ev):\n        # Just do this to demonstrate who called callback and the event that triggered it.\n        print(caller.GetClassName(), 'Event Id:', ev)\n        # Now print the camera orientation.\n        CameraOrientation(self.cam)\n\n\ndef CameraOrientation(cam):\n    fmt1 = '{:>15s}'\n    fmt2 = '{:9.6g}'\n    print(fmt1.format('Position:'), ', '.join(map(fmt2.format, cam.GetPosition())))\n    print(fmt1.format('Focal point:'), ', '.join(map(fmt2.format, cam.GetFocalPoint())))\n    print(fmt1.format('Clipping range:'), ', '.join(map(fmt2.format, cam.GetClippingRange())))\n    print(fmt1.format('View up:'), ', '.join(map(fmt2.format, cam.GetViewUp())))\n    print(fmt1.format('Distance:'), fmt2.format(cam.GetDistance()))\n\n\ndef MakeAxesActor():\n    axes = vtkAxesActor()\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText('X')\n    axes.SetYAxisLabelText('Y')\n    axes.SetZAxisLabelText('Z')\n    axes.SetTotalLength(1.0, 1.0, 1.0)\n    axes.SetCylinderRadius(0.5 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.025 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.5 * axes.GetSphereRadius())\n    return axes\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Interaction/InteractorStyleTrackballActor/","title":"InteractorStyleTrackballActor","text":"

vtk-examples/Python/Interaction/InteractorStyleTrackballActor

"},{"location":"Python/Interaction/InteractorStyleTrackballActor/#description","title":"Description","text":"

Move, rotate, and scale an object in 3D.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Interaction/InteractorStyleTrackballActor/#code","title":"Code","text":"

InteractorStyleTrackballActor.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('InteractorStyleTrackballActor')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    style = vtkInteractorStyleTrackballActor()\n    iren.SetInteractorStyle(style)\n\n    # create source\n    sphereSource = vtkSphereSource()\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphereSource.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Chartreuse'))\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('PaleGoldenrod'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Interaction/InteractorStyleTrackballCamera/","title":"InteractorStyleTrackballCamera","text":"

vtk-examples/Python/Interaction/InteractorStyleTrackballCamera

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Interaction/InteractorStyleTrackballCamera/#code","title":"Code","text":"

InteractorStyleTrackballCamera.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersSources import (\n    vtkPointSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkGlyph3DMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('InteractorStyleTrackballCamera')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    # create source\n    src = vtkPointSource()\n    src.SetCenter(0, 0, 0)\n    src.SetNumberOfPoints(50)\n    src.SetRadius(5)\n    src.Update()\n\n    actor = point_to_glyph(src.GetOutput().GetPoints(), 0.05)\n    actor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('RoyalBLue'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef point_to_glyph(points, scale):\n    \"\"\"\n    Convert points to glyphs.\n    :param points: The points to glyph.\n    :param scale: The scale, used to determine the size of the\n                  glyph representing the point, expressed as a\n                  fraction of the largest side of the bounding\n                  box surrounding the points. e.g. 0.05\n    :return: The actor.\n    \"\"\"\n\n    bounds = points.GetBounds()\n    max_len = 0.0\n    for i in range(0, 3):\n        max_len = max(bounds[i + 1] - bounds[i], max_len)\n\n    sphere_source = vtkSphereSource()\n    sphere_source.SetRadius(scale * max_len)\n\n    pd = vtkPolyData()\n    pd.SetPoints(points)\n\n    mapper = vtkGlyph3DMapper()\n    mapper.SetInputData(pd)\n    mapper.SetSourceConnection(sphere_source.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    mapper.ScalingOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    return actor\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Interaction/MouseEvents/","title":"MouseEvents","text":"

vtk-examples/Python/Interaction/MouseEvents

"},{"location":"Python/Interaction/MouseEvents/#description","title":"Description","text":"

This example creates a new vtkInteractorStyle which can be used to implement custom reactions on user events. If you just want to disable single events you can also have a look at MouseEventsObserver. This specific example just prints a simple message and then calls the original eventhandler of the vtkInteractorStyleTrackballCamera.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Interaction/MouseEvents/#code","title":"Code","text":"

MouseEvents.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\nclass MyInteractorStyle(vtkInteractorStyleTrackballCamera):\n\n    def __init__(self, parent=None):\n        self.AddObserver('MiddleButtonPressEvent', self.middle_button_press_event)\n        self.AddObserver('MiddleButtonReleaseEvent', self.middle_button_release_event)\n\n    def middle_button_press_event(self, obj, event):\n        print('Middle Button pressed')\n        self.OnMiddleButtonDown()\n        return\n\n    def middle_button_release_event(self, obj, event):\n        print('Middle Button released')\n        self.OnMiddleButtonUp()\n        return\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    source = vtkSphereSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(1)\n    source.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderer.AddActor(actor)\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('MouseEvents')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetInteractorStyle(MyInteractorStyle())\n    interactor.SetRenderWindow(renwin)\n\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Interaction/MouseEventsObserver/","title":"MouseEventsObserver","text":"

vtk-examples/Python/Interaction/MouseEventsObserver

"},{"location":"Python/Interaction/MouseEventsObserver/#description","title":"Description","text":"

This example directly changes the observers of the vtkInteractor, which is an easy way to disable events or to add some simple callback functions. For a more general framework using vtkInteractorStyle see MouseEvents. This specific example just disables the left mouse button of the vtkInteractorStyleTrackballCamera and prints a simple message instead.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Interaction/MouseEventsObserver/#code","title":"Code","text":"

MouseEventsObserver.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    source = vtkSphereSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(1)\n    source.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderer.AddActor(actor)\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('MouseEventsObserver')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetInteractorStyle(vtkInteractorStyleTrackballCamera())\n    interactor.SetRenderWindow(renwin)\n\n    def DummyFunc1(obj, ev):\n        print('Before Event')\n\n    def DummyFunc2(obj, ev):\n        print('After Event')\n\n    # Print interator gives you a list of registered observers of the current\n    # interactor style\n    # print(interactor)\n\n    # adding priorities allow to control the order of observer execution\n    # (highest value first! if equal the first added observer is called first)\n    interactor.RemoveObservers('LeftButtonPressEvent')\n    interactor.AddObserver('LeftButtonPressEvent', DummyFunc1, 1.0)\n    interactor.AddObserver('LeftButtonPressEvent', DummyFunc2, -1.0)\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Medical/GenerateCubesFromLabels/","title":"GenerateCubesFromLabels","text":"

vtk-examples/Python/Medical/GenerateCubesFromLabels

"},{"location":"Python/Medical/GenerateCubesFromLabels/#description","title":"Description","text":"

Sometimes it is helpful to view the results of a segmentation without any post processing. This example converts the point data from a labeled volume into cell data. The surfaces are displayed as vtkPolydata. If you want to created smoothed polydata models from your segmented volumes, see the example GenerateModelsFromLabels. The input volume must be in MetaIO format.

 Usage: GenerateCubesFromLabels InputVolume.mhd StartLabel EndLabel\n      where\n        InputVolume is a meta file containing a 3 volume of discrete labels.\n        StartLabel is the first label to be processed\n        EndLabel is the last label to be processed\n        NOTE: There can be gaps in the labeling. If a label does not exist in the volume, it will be skipped.\n

Note

This original source code for this example is here.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Medical/GenerateCubesFromLabels/#code","title":"Code","text":"

GenerateCubesFromLabels.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkDataObject,\n    vtkDataSetAttributes\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkThreshold\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformFilter\nfrom vtkmodules.vtkFiltersGeometry import vtkGeometryFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkImageWrapPad\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    file_name, start_label, end_label = get_program_parameters()\n    if start_label > end_label:\n        end_label, start_label = start_label, end_label\n\n    # Generate cubes from labels\n    # 1) Read the meta file\n    # 2) Convert point data to cell data\n    # 3) Convert to geometry and display\n\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    # Pad the volume so that we can change the point data into cell\n    # data.\n    extent = reader.GetOutput().GetExtent()\n    pad = vtkImageWrapPad()\n    pad.SetInputConnection(reader.GetOutputPort())\n    pad.SetOutputWholeExtent(extent[0], extent[1] + 1, extent[2], extent[3] + 1, extent[4], extent[5] + 1)\n    pad.Update()\n\n    # Copy the scalar point data of the volume into the scalar cell data\n    pad.GetOutput().GetCellData().SetScalars(reader.GetOutput().GetPointData().GetScalars())\n\n    selector = vtkThreshold()\n    selector.SetInputArrayToProcess(0, 0, 0, vtkDataObject().FIELD_ASSOCIATION_CELLS,\n                                    vtkDataSetAttributes().SCALARS)\n    selector.SetInputConnection(pad.GetOutputPort())\n    selector.SetLowerThreshold(start_label)\n    selector.SetUpperThreshold(end_label)\n    selector.Update()\n\n    # Shift the geometry by 1/2\n    transform = vtkTransform()\n    transform.Translate(-0.5, -0.5, -0.5)\n\n    transform_model = vtkTransformFilter()\n    transform_model.SetTransform(transform)\n    transform_model.SetInputConnection(selector.GetOutputPort())\n\n    geometry = vtkGeometryFilter()\n    geometry.SetInputConnection(transform_model.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(geometry.GetOutputPort())\n    mapper.SetScalarRange(start_label, end_label)\n    mapper.SetScalarModeToUseCellData()\n    mapper.SetColorModeToMapScalars()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetSize(640, 480)\n    render_window.SetWindowName('GenerateCubesFromLabels')\n\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateBlue'))\n    render_window.Render()\n\n    camera = renderer.GetActiveCamera()\n    camera.SetPosition(42.301174, 939.893457, -124.005030)\n    camera.SetFocalPoint(224.697134, 221.301653, 146.823706)\n    camera.SetViewUp(0.262286, -0.281321, -0.923073)\n    camera.SetDistance(789.297581)\n    camera.SetClippingRange(168.744328, 1509.660206)\n\n    render_window_interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Convert the point data from a labeled volume into cell data.'\n    epilogue = '''\n The surfaces are displayed as vtkPolydata.\n     '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Input volume e.g. Frog/frogtissue.mhd.')\n    parser.add_argument('startlabel', type=int, help='The starting label in the input volume, e,g, 1.')\n    parser.add_argument('endlabel', type=int, help='The ending label in the input volume e.g. 29')\n    args = parser.parse_args()\n    return args.filename, args.startlabel, args.endlabel\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Medical/GenerateModelsFromLabels/","title":"GenerateModelsFromLabels","text":"

vtk-examples/Python/Medical/GenerateModelsFromLabels

"},{"location":"Python/Medical/GenerateModelsFromLabels/#description","title":"Description","text":"

This example uses vtkDiscreteFlyingEdges3D or vtkDiscreteMarchingCubes to create vtkPolyData models from a 3D volume that contains discrete labels. These volumes are normally the output of a segmentation algorithm. The polydata for each label will be output into a separate file.

You can load these files into ParaView, where they will appear as a series of time steps. You can then single step through displaying the polydate from each file making up the series.

If you want to see the segmentation results as cube models, see the example GenerateCubesFromLabels

The input volume must be in MetaIO format.

Once you generate the models, you can view them with Paraview

Note

This original source code for this example is here.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Medical/GenerateModelsFromLabels/#code","title":"Code","text":"

GenerateModelsFromLabels.py

#!/usr/bin/env python\n\nimport os\nimport sys\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkDataObject,\n    vtkDataSetAttributes\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkMaskFields,\n    vtkThreshold,\n    vtkWindowedSincPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkDiscreteFlyingEdges3D,\n    vtkDiscreteMarchingCubes\n)\nfrom vtkmodules.vtkFiltersGeometry import vtkGeometryFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\nfrom vtkmodules.vtkImagingStatistics import vtkImageAccumulate\n\n\ndef main():\n    # vtkDiscreteFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    file_name, start_label, end_label = get_program_parameters()\n    if start_label > end_label:\n        end_label, start_label = start_label, end_label\n\n    # Create all of the classes we will need\n    reader = vtkMetaImageReader()\n    histogram = vtkImageAccumulate()\n    if use_flying_edges:\n        try:\n            using_marching_cubes = False\n            discrete_cubes = vtkDiscreteFlyingEdges3D()\n        except AttributeError:\n            using_marching_cubes = True\n            discrete_cubes = vtkDiscreteMarchingCubes()\n    else:\n        using_marching_cubes = True\n        discrete_cubes = vtkDiscreteMarchingCubes()\n    smoother = vtkWindowedSincPolyDataFilter()\n    selector = vtkThreshold()\n    scalars_off = vtkMaskFields()\n    geometry = vtkGeometryFilter()\n    writer = vtkXMLPolyDataWriter()\n\n    # Define all of the variables\n    file_prefix = 'Label'\n    smoothing_iterations = 15\n    pass_band = 0.001\n    feature_angle = 120.0\n\n    # Generate models from labels\n    # 1) Read the meta file\n    # 2) Generate a histogram of the labels\n    # 3) Generate models from the labeled volume\n    # 4) Smooth the models\n    # 5) Output each model into a separate file\n\n    reader.SetFileName(file_name)\n\n    histogram.SetInputConnection(reader.GetOutputPort())\n    histogram.SetComponentExtent(0, end_label, 0, 0, 0, 0)\n    histogram.SetComponentOrigin(0, 0, 0)\n    histogram.SetComponentSpacing(1, 1, 1)\n    histogram.Update()\n\n    discrete_cubes.SetInputConnection(reader.GetOutputPort())\n    discrete_cubes.GenerateValues(end_label - start_label + 1, start_label, end_label)\n\n    smoother.SetInputConnection(discrete_cubes.GetOutputPort())\n    smoother.SetNumberOfIterations(smoothing_iterations)\n    smoother.BoundarySmoothingOff()\n    smoother.FeatureEdgeSmoothingOff()\n    smoother.SetFeatureAngle(feature_angle)\n    smoother.SetPassBand(pass_band)\n    smoother.NonManifoldSmoothingOn()\n    smoother.NormalizeCoordinatesOn()\n    smoother.Update()\n\n    selector.SetInputConnection(smoother.GetOutputPort())\n    if use_flying_edges:\n        if using_marching_cubes:\n            selector.SetInputArrayToProcess(0, 0, 0, vtkDataObject().FIELD_ASSOCIATION_CELLS,\n                                            vtkDataSetAttributes().SCALARS)\n        else:\n            selector.SetInputArrayToProcess(0, 0, 0, vtkDataObject().FIELD_ASSOCIATION_POINTS,\n                                            vtkDataSetAttributes().SCALARS)\n    else:\n        selector.SetInputArrayToProcess(0, 0, 0, vtkDataObject().FIELD_ASSOCIATION_CELLS,\n                                        vtkDataSetAttributes().SCALARS)\n\n    # Strip the scalars from the output\n    scalars_off.SetInputConnection(selector.GetOutputPort())\n    scalars_off.CopyAttributeOff(vtkMaskFields().POINT_DATA,\n                                 vtkDataSetAttributes().SCALARS)\n    scalars_off.CopyAttributeOff(vtkMaskFields().CELL_DATA,\n                                 vtkDataSetAttributes().SCALARS)\n\n    geometry.SetInputConnection(scalars_off.GetOutputPort())\n\n    writer.SetInputConnection(geometry.GetOutputPort())\n\n    for i in range(start_label, end_label + 1):\n        # see if the label exists, if not skip it\n        frequency = histogram.GetOutput().GetPointData().GetScalars().GetTuple1(i)\n        if frequency == 0.0:\n            continue\n\n        # select the cells for a given label\n        selector.SetLowerThreshold(i)\n        selector.SetUpperThreshold(i)\n\n        # output the polydata\n        output_fn = '{:s}{:d}.vtp'.format(file_prefix, i)\n        print('{:s} writing {:s}'.format(os.path.basename(sys.argv[0]), output_fn))\n\n        writer.SetFileName(output_fn)\n        writer.Write()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Creates vtkPolyData models from a 3D volume that contains discrete labels.'\n    epilogue = '''\nThese volumes are normally the output of a segmentation algorithm.\nThe polydata for each label will be output into a separate file.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Input volume e.g. Frog/frogtissue.mhd.')\n    parser.add_argument('startlabel', type=int, help='The starting label in the input volume, e,g, 1.')\n    parser.add_argument('endlabel', type=int, help='The ending label in the input volume e.g. 29')\n    args = parser.parse_args()\n    return args.filename, args.startlabel, args.endlabel\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Medical/MedicalDemo1/","title":"MedicalDemo1","text":"

vtk-examples/Python/Medical/MedicalDemo1

"},{"location":"Python/Medical/MedicalDemo1/#description","title":"Description","text":"

The skin extracted from a CT dataset of the head.

usage

MedicalDemo1 FullHead.mhd

Note

The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

Note

This original source code for this example is here.

Info

See Figure 12-2 in Chapter 12 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Medical/MedicalDemo1/#code","title":"Code","text":"

MedicalDemo1.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    colors.SetColor('SkinColor', [240, 184, 160, 255])\n    colors.SetColor('BackfaceColor', [255, 229, 200, 255])\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    # Create the renderer, the render window, and the interactor. The renderer\n    # draws into the render window, the interactor enables mouse- and\n    # keyboard-based interaction with the data within the render window.\n    #\n    a_renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(a_renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n\n    # An isosurface, or contour value of 500 is known to correspond to the\n    # skin of the patient.\n    if use_flying_edges:\n        try:\n            skin_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            skin_extractor = vtkMarchingCubes()\n    else:\n        skin_extractor = vtkMarchingCubes()\n    skin_extractor.SetInputConnection(reader.GetOutputPort())\n    skin_extractor.SetValue(0, 500)\n\n    skin_mapper = vtkPolyDataMapper()\n    skin_mapper.SetInputConnection(skin_extractor.GetOutputPort())\n    skin_mapper.ScalarVisibilityOff()\n\n    skin = vtkActor()\n    skin.SetMapper(skin_mapper)\n    skin.GetProperty().SetDiffuseColor(colors.GetColor3d('SkinColor'))\n\n    back_prop = vtkProperty()\n    back_prop.SetDiffuseColor(colors.GetColor3d('BackfaceColor'))\n    skin.SetBackfaceProperty(back_prop)\n\n    # An outline provides context around the data.\n    #\n    outline_data = vtkOutlineFilter()\n    outline_data.SetInputConnection(reader.GetOutputPort())\n\n    map_outline = vtkPolyDataMapper()\n    map_outline.SetInputConnection(outline_data.GetOutputPort())\n\n    outline = vtkActor()\n    outline.SetMapper(map_outline)\n    outline.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # It is convenient to create an initial view of the data. The FocalPoint\n    # and Position form a vector direction. Later on (ResetCamera() method)\n    # this vector is used to position the camera to look at the data in\n    # this direction.\n    a_camera = vtkCamera()\n    a_camera.SetViewUp(0, 0, -1)\n    a_camera.SetPosition(0, -1, 0)\n    a_camera.SetFocalPoint(0, 0, 0)\n    a_camera.ComputeViewPlaneNormal()\n    a_camera.Azimuth(30.0)\n    a_camera.Elevation(30.0)\n\n    # Actors are added to the renderer. An initial camera view is created.\n    # The Dolly() method moves the camera towards the FocalPoint,\n    # thereby enlarging the image.\n    a_renderer.AddActor(outline)\n    a_renderer.AddActor(skin)\n    a_renderer.SetActiveCamera(a_camera)\n    a_renderer.ResetCamera()\n    a_camera.Dolly(1.5)\n\n    # Set a background color for the renderer and set the size of the\n    # render window (expressed in pixels).\n    a_renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('MedicalDemo1')\n\n    # Note that when camera movement occurs (as it does in the Dolly()\n    # method), the clipping planes often need adjusting. Clipping planes\n    # consist of two planes: near and far along the view direction. The\n    # near plane clips out objects in front of the plane the far plane\n    # clips out objects behind the plane. This way only what is drawn\n    # between the planes is actually rendered.\n    a_renderer.ResetCameraClippingRange()\n\n    # Initialize the event loop and then start it.\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The skin extracted from a CT dataset of the head.'\n    epilogue = '''\n    Derived from VTK/Examples/Cxx/Medical1.cxx\n    This example reads a volume dataset, extracts an isosurface that\n     represents the skin and displays it.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Medical/MedicalDemo2/","title":"MedicalDemo2","text":"

vtk-examples/Python/Medical/MedicalDemo2

"},{"location":"Python/Medical/MedicalDemo2/#description","title":"Description","text":"

Skin and bone isosurfaces.

Usage

MedicalDemo2 FullHead.mhd

Note

The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

Note

This original source code for this example is here.

Info

See Figure 12-3 in Chapter 12 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Medical/MedicalDemo2/#code","title":"Code","text":"

MedicalDemo2.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    colors.SetColor('SkinColor', [240, 184, 160, 255])\n    colors.SetColor('BackfaceColor', [255, 229, 200, 255])\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    # Create the renderer, the render window, and the interactor. The renderer\n    # draws into the render window, the interactor enables mouse- and\n    # keyboard-based interaction with the data within the render window.\n    #\n    a_renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(a_renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # The following reader is used to read a series of 2D slices (images)\n    # that compose the volume. The slice dimensions are set, and the\n    # pixel spacing. The data Endianness must also be specified. The reader\n    # uses the FilePrefix in combination with the slice number to construct\n    # filenames using the format FilePrefix.%d. (In this case the FilePrefix\n    # is the root name of the file: quarter.)\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n\n    # An isosurface, or contour value of 500 is known to correspond to the\n    # skin of the patient.\n    # The triangle stripper is used to create triangle strips from the\n    # isosurface these render much faster on many systems.\n    if use_flying_edges:\n        try:\n            skin_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            skin_extractor = vtkMarchingCubes()\n    else:\n        skin_extractor = vtkMarchingCubes()\n    skin_extractor.SetInputConnection(reader.GetOutputPort())\n    skin_extractor.SetValue(0, 500)\n\n    skin_stripper = vtkStripper()\n    skin_stripper.SetInputConnection(skin_extractor.GetOutputPort())\n\n    skin_mapper = vtkPolyDataMapper()\n    skin_mapper.SetInputConnection(skin_stripper.GetOutputPort())\n    skin_mapper.ScalarVisibilityOff()\n\n    skin = vtkActor()\n    skin.SetMapper(skin_mapper)\n    skin.GetProperty().SetDiffuseColor(colors.GetColor3d('SkinColor'))\n    skin.GetProperty().SetSpecular(0.3)\n    skin.GetProperty().SetSpecularPower(20)\n    skin.GetProperty().SetOpacity(0.5)\n\n    back_prop = vtkProperty()\n    back_prop.SetDiffuseColor(colors.GetColor3d('BackfaceColor'))\n    skin.SetBackfaceProperty(back_prop)\n\n    # An isosurface, or contour value of 1150 is known to correspond to the\n    # bone of the patient.\n    # The triangle stripper is used to create triangle strips from the\n    # isosurface these render much faster on may systems.\n    if use_flying_edges:\n        try:\n            bone_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            bone_extractor = vtkMarchingCubes()\n    else:\n        bone_extractor = vtkMarchingCubes()\n    bone_extractor.SetInputConnection(reader.GetOutputPort())\n    bone_extractor.SetValue(0, 1150)\n\n    bone_stripper = vtkStripper()\n    bone_stripper.SetInputConnection(bone_extractor.GetOutputPort())\n\n    bone_mapper = vtkPolyDataMapper()\n    bone_mapper.SetInputConnection(bone_stripper.GetOutputPort())\n    bone_mapper.ScalarVisibilityOff()\n\n    bone = vtkActor()\n    bone.SetMapper(bone_mapper)\n    bone.GetProperty().SetDiffuseColor(colors.GetColor3d('Ivory'))\n\n    # An outline provides context around the data.\n    #\n    outline_data = vtkOutlineFilter()\n    outline_data.SetInputConnection(reader.GetOutputPort())\n\n    map_outline = vtkPolyDataMapper()\n    map_outline.SetInputConnection(outline_data.GetOutputPort())\n\n    outline = vtkActor()\n    outline.SetMapper(map_outline)\n    outline.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # It is convenient to create an initial view of the data. The FocalPoint\n    # and Position form a vector direction. Later on (ResetCamera() method)\n    # this vector is used to position the camera to look at the data in\n    # this direction.\n    a_camera = vtkCamera()\n    a_camera.SetViewUp(0, 0, -1)\n    a_camera.SetPosition(0, -1, 0)\n    a_camera.SetFocalPoint(0, 0, 0)\n    a_camera.ComputeViewPlaneNormal()\n    a_camera.Azimuth(30.0)\n    a_camera.Elevation(30.0)\n\n    # Actors are added to the renderer. An initial camera view is created.\n    # The Dolly() method moves the camera towards the FocalPoint,\n    # thereby enlarging the image.\n    a_renderer.AddActor(outline)\n    a_renderer.AddActor(skin)\n    a_renderer.AddActor(bone)\n    a_renderer.SetActiveCamera(a_camera)\n    a_renderer.ResetCamera()\n    a_camera.Dolly(1.5)\n\n    # Set a background color for the renderer and set the size of the\n    # render window (expressed in pixels).\n    a_renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('MedicalDemo2')\n\n    # Note that when camera movement occurs (as it does in the Dolly()\n    # method), the clipping planes often need adjusting. Clipping planes\n    # consist of two planes: near and far along the view direction. The\n    # near plane clips out objects in front of the plane the far plane\n    # clips out objects behind the plane. This way only what is drawn\n    # between the planes is actually rendered.\n    a_renderer.ResetCameraClippingRange()\n\n    # Initialize the event loop and then start it.\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The skin and bone is extracted from a CT dataset of the head.'\n    epilogue = '''\n    Derived from VTK/Examples/Cxx/Medical2.cxx\n    This example reads a volume dataset, extracts two isosurfaces that\n     represent the skin and bone, and then displays it.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Medical/MedicalDemo3/","title":"MedicalDemo3","text":"

vtk-examples/Python/Medical/MedicalDemo3

"},{"location":"Python/Medical/MedicalDemo3/#description","title":"Description","text":"

Composite image of three planes and translucent skin

Usage

MedicalDemo3 FullHead.mhd

Note

The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

Note

This original source code for this example is here.

Info

See Figure 12-4 in Chapter 12 the VTK Textbook.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Medical/MedicalDemo3/#code","title":"Code","text":"

MedicalDemo3.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkLookupTable,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkImageMapToColors\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkImageActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    colors.SetColor('SkinColor', [240, 184, 160, 255])\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    # Create the renderer, the render window, and the interactor. The\n    # renderer draws into the render window, the interactor enables\n    # mouse- and keyboard-based interaction with the data within the\n    # render window.\n    #\n    a_renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(a_renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Set a background color for the renderer and set the size of the\n    # render window (expressed in pixels).\n    a_renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    ren_win.SetSize(640, 480)\n\n    # The following reader is used to read a series of 2D slices (images)\n    # that compose the volume. The slice dimensions are set, and the\n    # pixel spacing. The data Endianness must also be specified. The\n    # reader uses the FilePrefix in combination with the slice number to\n    # construct filenames using the format FilePrefix.%d. (In this case\n    # the FilePrefix is the root name of the file: quarter.)\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    # An isosurface, or contour value of 500 is known to correspond to\n    # the skin of the patient.\n    # The triangle stripper is used to create triangle\n    # strips from the isosurface these render much faster on may\n    # systems.\n    if use_flying_edges:\n        try:\n            skin_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            skin_extractor = vtkMarchingCubes()\n    else:\n        skin_extractor = vtkMarchingCubes()\n    skin_extractor.SetInputConnection(reader.GetOutputPort())\n    skin_extractor.SetValue(0, 500)\n    skin_extractor.Update()\n\n    skin_stripper = vtkStripper()\n    skin_stripper.SetInputConnection(skin_extractor.GetOutputPort())\n    skin_stripper.Update()\n\n    skin_mapper = vtkPolyDataMapper()\n    skin_mapper.SetInputConnection(skin_stripper.GetOutputPort())\n    skin_mapper.ScalarVisibilityOff()\n\n    skin = vtkActor()\n    skin.SetMapper(skin_mapper)\n    skin.GetProperty().SetDiffuseColor(colors.GetColor3d('SkinColor'))\n    skin.GetProperty().SetSpecular(0.3)\n    skin.GetProperty().SetSpecularPower(20)\n\n    # An isosurface, or contour value of 1150 is known to correspond to\n    # the bone of the patient.\n    # The triangle stripper is used to create triangle\n    # strips from the isosurface these render much faster on may\n    # systems.\n    if use_flying_edges:\n        try:\n            bone_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            bone_extractor = vtkMarchingCubes()\n    else:\n        bone_extractor = vtkMarchingCubes()\n    bone_extractor.SetInputConnection(reader.GetOutputPort())\n    bone_extractor.SetValue(0, 1150)\n\n    bone_stripper = vtkStripper()\n    bone_stripper.SetInputConnection(bone_extractor.GetOutputPort())\n\n    bone_mapper = vtkPolyDataMapper()\n    bone_mapper.SetInputConnection(bone_stripper.GetOutputPort())\n    bone_mapper.ScalarVisibilityOff()\n\n    bone = vtkActor()\n    bone.SetMapper(bone_mapper)\n    bone.GetProperty().SetDiffuseColor(colors.GetColor3d('Ivory'))\n\n    # An outline provides context around the data.\n    #\n    outline_data = vtkOutlineFilter()\n    outline_data.SetInputConnection(reader.GetOutputPort())\n    outline_data.Update()\n\n    map_outline = vtkPolyDataMapper()\n    map_outline.SetInputConnection(outline_data.GetOutputPort())\n\n    outline = vtkActor()\n    outline.SetMapper(map_outline)\n    outline.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Now we are creating three orthogonal planes passing through the\n    # volume. Each plane uses a different texture map and therefore has\n    # different coloration.\n\n    # Start by creating a black/white lookup table.\n    bw_lut = vtkLookupTable()\n    bw_lut.SetTableRange(0, 2000)\n    bw_lut.SetSaturationRange(0, 0)\n    bw_lut.SetHueRange(0, 0)\n    bw_lut.SetValueRange(0, 1)\n    bw_lut.Build()  # effective built\n\n    # Now create a lookup table that consists of the full hue circle\n    # (from HSV).\n    hue_lut = vtkLookupTable()\n    hue_lut.SetTableRange(0, 2000)\n    hue_lut.SetHueRange(0, 1)\n    hue_lut.SetSaturationRange(1, 1)\n    hue_lut.SetValueRange(1, 1)\n    hue_lut.Build()  # effective built\n\n    # Finally, create a lookup table with a single hue but having a range\n    # in the saturation of the hue.\n    sat_lut = vtkLookupTable()\n    sat_lut.SetTableRange(0, 2000)\n    sat_lut.SetHueRange(0.6, 0.6)\n    sat_lut.SetSaturationRange(0, 1)\n    sat_lut.SetValueRange(1, 1)\n    sat_lut.Build()  # effective built\n\n    # Create the first of the three planes. The filter vtkImageMapToColors\n    # maps the data through the corresponding lookup table created above.  The\n    # vtkImageActor is a type of vtkProp and conveniently displays an image on\n    # a single quadrilateral plane. It does this using texture mapping and as\n    # a result is quite fast. (Note: the input image has to be unsigned char\n    # values, which the vtkImageMapToColors produces.) Note also that by\n    # specifying the DisplayExtent, the pipeline requests data of this extent\n    # and the vtkImageMapToColors only processes a slice of data.\n    sagittal_colors = vtkImageMapToColors()\n    sagittal_colors.SetInputConnection(reader.GetOutputPort())\n    sagittal_colors.SetLookupTable(bw_lut)\n    sagittal_colors.Update()\n\n    sagittal = vtkImageActor()\n    sagittal.GetMapper().SetInputConnection(sagittal_colors.GetOutputPort())\n    sagittal.SetDisplayExtent(128, 128, 0, 255, 0, 92)\n    sagittal.ForceOpaqueOn()\n\n    # Create the second (axial) plane of the three planes. We use the\n    # same approach as before except that the extent differs.\n    axial_colors = vtkImageMapToColors()\n    axial_colors.SetInputConnection(reader.GetOutputPort())\n    axial_colors.SetLookupTable(hue_lut)\n    axial_colors.Update()\n\n    axial = vtkImageActor()\n    axial.GetMapper().SetInputConnection(axial_colors.GetOutputPort())\n    axial.SetDisplayExtent(0, 255, 0, 255, 46, 46)\n    axial.ForceOpaqueOn()\n\n    # Create the third (coronal) plane of the three planes. We use\n    # the same approach as before except that the extent differs.\n    coronal_colors = vtkImageMapToColors()\n    coronal_colors.SetInputConnection(reader.GetOutputPort())\n    coronal_colors.SetLookupTable(sat_lut)\n    coronal_colors.Update()\n\n    coronal = vtkImageActor()\n    coronal.GetMapper().SetInputConnection(coronal_colors.GetOutputPort())\n    coronal.SetDisplayExtent(0, 255, 128, 128, 0, 92)\n    coronal.ForceOpaqueOn()\n\n    # It is convenient to create an initial view of the data. The\n    # FocalPoint and Position form a vector direction. Later on\n    # (ResetCamera() method) this vector is used to position the camera\n    # to look at the data in this direction.\n    a_camera = vtkCamera()\n    a_camera.SetViewUp(0, 0, -1)\n    a_camera.SetPosition(0, -1, 0)\n    a_camera.SetFocalPoint(0, 0, 0)\n    a_camera.ComputeViewPlaneNormal()\n    a_camera.Azimuth(30.0)\n    a_camera.Elevation(30.0)\n\n    # Actors are added to the renderer.\n    a_renderer.AddActor(outline)\n    a_renderer.AddActor(sagittal)\n    a_renderer.AddActor(axial)\n    a_renderer.AddActor(coronal)\n    a_renderer.AddActor(skin)\n    a_renderer.AddActor(bone)\n\n    # Turn off bone for this example.\n    bone.VisibilityOff()\n\n    # Set skin to semi-transparent.\n    skin.GetProperty().SetOpacity(0.5)\n\n    # An initial camera view is created.  The Dolly() method moves\n    # the camera towards the FocalPoint, thereby enlarging the image.\n    a_renderer.SetActiveCamera(a_camera)\n\n    # Calling Render() directly on a vtkRenderer is strictly forbidden.\n    # Only calling Render() on the vtkRenderWindow is a valid call.\n    ren_win.SetWindowName('MedicalDemo3')\n    ren_win.Render()\n\n    a_renderer.ResetCamera()\n    a_camera.Dolly(1.5)\n\n    # Note that when camera movement occurs (as it does in the Dolly()\n    # method), the clipping planes often need adjusting. Clipping planes\n    # consist of two planes: near and far along the view direction. The\n    # near plane clips out objects in front of the plane; the far plane\n    # clips out objects behind the plane. This way only what is drawn\n    # between the planes is actually rendered.\n    a_renderer.ResetCameraClippingRange()\n\n    # Interact with the data.\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The skin and bone is extracted from a CT dataset of the head.'\n    epilogue = '''\n    Derived from VTK/Examples/Cxx/Medical3.cxx\n    This example reads a volume dataset, extracts two isosurfaces that\n     represent the skin and bone, creates three orthogonal planes\n     (sagittal, axial, coronal), and displays them.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Medical/MedicalDemo4/","title":"MedicalDemo4","text":"

vtk-examples/Python/Medical/MedicalDemo4

"},{"location":"Python/Medical/MedicalDemo4/#description","title":"Description","text":"

Volume rendering of the dataset.

Usage

MedicalDemo4 FullHead.mhd

Note

This original source code for this example is here.

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Medical/MedicalDemo4/#code","title":"Code","text":"

MedicalDemo4.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingVolumeOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPiecewiseFunction\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkColorTransferFunction,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkVolume,\n    vtkVolumeProperty\n)\nfrom vtkmodules.vtkRenderingVolume import vtkFixedPointVolumeRayCastMapper\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    # Create the renderer, the render window, and the interactor. The renderer\n    # draws into the render window, the interactor enables mouse- and\n    # keyboard-based interaction with the scene.\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # The following reader is used to read a series of 2D slices (images)\n    # that compose the volume. The slice dimensions are set, and the\n    # pixel spacing. The data Endianness must also be specified. The reader\n    # uses the FilePrefix in combination with the slice number to construct\n    # filenames using the format FilePrefix.%d. (In this case the FilePrefix\n    # is the root name of the file: quarter.)\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n\n    # The volume will be displayed by ray-cast alpha compositing.\n    # A ray-cast mapper is needed to do the ray-casting.\n    volume_mapper = vtkFixedPointVolumeRayCastMapper()\n    volume_mapper.SetInputConnection(reader.GetOutputPort())\n\n    # The color transfer function maps voxel intensities to colors.\n    # It is modality-specific, and often anatomy-specific as well.\n    # The goal is to one color for flesh (between 500 and 1000)\n    # and another color for bone (1150 and over).\n    volume_color = vtkColorTransferFunction()\n    volume_color.AddRGBPoint(0, 0.0, 0.0, 0.0)\n    volume_color.AddRGBPoint(500, 240.0 / 255.0, 184.0 / 255.0, 160.0 / 255.0)\n    volume_color.AddRGBPoint(1000, 240.0 / 255.0, 184.0 / 255.0, 160.0 / 255.0)\n    volume_color.AddRGBPoint(1150, 1.0, 1.0, 240.0 / 255.0)  # Ivory\n\n    # The opacity transfer function is used to control the opacity\n    # of different tissue types.\n    volume_scalar_opacity = vtkPiecewiseFunction()\n    volume_scalar_opacity.AddPoint(0, 0.00)\n    volume_scalar_opacity.AddPoint(500, 0.15)\n    volume_scalar_opacity.AddPoint(1000, 0.15)\n    volume_scalar_opacity.AddPoint(1150, 0.85)\n\n    # The gradient opacity function is used to decrease the opacity\n    # in the 'flat' regions of the volume while maintaining the opacity\n    # at the boundaries between tissue types.  The gradient is measured\n    # as the amount by which the intensity changes over unit distance.\n    # For most medical data, the unit distance is 1mm.\n    volume_gradient_opacity = vtkPiecewiseFunction()\n    volume_gradient_opacity.AddPoint(0, 0.0)\n    volume_gradient_opacity.AddPoint(90, 0.5)\n    volume_gradient_opacity.AddPoint(100, 1.0)\n\n    # The VolumeProperty attaches the color and opacity functions to the\n    # volume, and sets other volume properties.  The interpolation should\n    # be set to linear to do a high-quality rendering.  The ShadeOn option\n    # turns on directional lighting, which will usually enhance the\n    # appearance of the volume and make it look more '3D'.  However,\n    # the quality of the shading depends on how accurately the gradient\n    # of the volume can be calculated, and for noisy data the gradient\n    # estimation will be very poor.  The impact of the shading can be\n    # decreased by increasing the Ambient coefficient while decreasing\n    # the Diffuse and Specular coefficient.  To increase the impact\n    # of shading, decrease the Ambient and increase the Diffuse and Specular.\n    volume_property = vtkVolumeProperty()\n    volume_property.SetColor(volume_color)\n    volume_property.SetScalarOpacity(volume_scalar_opacity)\n    volume_property.SetGradientOpacity(volume_gradient_opacity)\n    volume_property.SetInterpolationTypeToLinear()\n    volume_property.ShadeOn()\n    volume_property.SetAmbient(0.4)\n    volume_property.SetDiffuse(0.6)\n    volume_property.SetSpecular(0.2)\n\n    # The vtkVolume is a vtkProp3D (like a vtkActor) and controls the position\n    # and orientation of the volume in world coordinates.\n    volume = vtkVolume()\n    volume.SetMapper(volume_mapper)\n    volume.SetProperty(volume_property)\n\n    # Finally, add the volume to the renderer\n    ren.AddViewProp(volume)\n\n    # Set up an initial view of the volume.  The focal point will be the\n    # center of the volume, and the camera position will be 400mm to the\n    # patient's left (which is our right).\n    camera = ren.GetActiveCamera()\n    c = volume.GetCenter()\n    camera.SetViewUp(0, 0, -1)\n    camera.SetPosition(c[0], c[1] - 400, c[2])\n    camera.SetFocalPoint(c[0], c[1], c[2])\n    camera.Azimuth(30.0)\n    camera.Elevation(30.0)\n\n    # Set a background color for the renderer\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n\n    # Increase the size of the render window\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('MedicalDemo4')\n\n    # Interact with the data.\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a volume dataset and displays it via volume rendering.'\n    epilogue = '''\n    Derived from VTK/Examples/Cxx/Medical4.cxx\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Medical/TissueLens/","title":"TissueLens","text":"

vtk-examples/Python/Medical/TissueLens

"},{"location":"Python/Medical/TissueLens/#description","title":"Description","text":"

This example uses two vtkClipDataSet filters to achieve a \"tissue lens\" effect. First, a vtkSphere implicit function is used to clip a spherical hole in the isosurface extracted with vtkFlyingEdges3D or vtkMarchingCubes. Then a geometric [vtkSphere](https://www.vtk.org/doc/nightly/html/classvtkSphere.html#details)Source samples the original volume data using a vtkProbeFilter. vtkClipDataSet uses the resulting scalar point data to clip the sphere surface with the isosurface value.

Usage

TissueLens FullHead.mhd

Note

The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

Info

The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Medical/TissueLens/#code","title":"Code","text":"

TissueLens.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkLookupTable,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkSphere\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkProbeFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkClipDataSet\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    colors.SetColor('SkinColor', [240, 184, 160, 255])\n    colors.SetColor('BackfaceColor', [255, 229, 200, 255])\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    # Read the volume data\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    # An isosurface, or contour value of 500 is known to correspond to the\n    # skin of the patient.\n    if use_flying_edges:\n        try:\n            skin_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            skin_extractor = vtkMarchingCubes()\n    else:\n        skin_extractor = vtkMarchingCubes()\n    skin_extractor.SetInputConnection(reader.GetOutputPort())\n    skin_extractor.SetValue(0, 500)\n\n    # Define a spherical clip function to clip the isosurface\n    clip_function = vtkSphere()\n    clip_function.SetRadius(50)\n    clip_function.SetCenter(73, 52, 15)\n\n    # Clip the isosurface with a sphere\n    skin_clip = vtkClipDataSet()\n    skin_clip.SetInputConnection(skin_extractor.GetOutputPort())\n    skin_clip.SetClipFunction(clip_function)\n    skin_clip.SetValue(0)\n    skin_clip.GenerateClipScalarsOn()\n    skin_clip.Update()\n\n    skin_mapper = vtkDataSetMapper()\n    skin_mapper.SetInputConnection(skin_clip.GetOutputPort())\n    skin_mapper.ScalarVisibilityOff()\n\n    skin = vtkActor()\n    skin.SetMapper(skin_mapper)\n    skin.GetProperty().SetDiffuseColor(colors.GetColor3d('SkinColor'))\n\n    back_prop = vtkProperty()\n    back_prop.SetDiffuseColor(colors.GetColor3d('BackfaceColor'))\n    skin.SetBackfaceProperty(back_prop)\n\n    # Define a model for the \"lens\". Its geometry matches the implicit\n    # sphere used to clip the isosurface\n    lens_model = vtkSphereSource()\n    lens_model.SetRadius(50)\n    lens_model.SetCenter(73, 52, 15)\n    lens_model.SetPhiResolution(201)\n    lens_model.SetThetaResolution(101)\n\n    # Sample the input volume with the lens model geometry\n    lens_probe = vtkProbeFilter()\n    lens_probe.SetInputConnection(lens_model.GetOutputPort())\n    lens_probe.SetSourceConnection(reader.GetOutputPort())\n\n    # Clip the lens data with the isosurface value\n    lens_clip = vtkClipDataSet()\n    lens_clip.SetInputConnection(lens_probe.GetOutputPort())\n    lens_clip.SetValue(500)\n    lens_clip.GenerateClipScalarsOff()\n    lens_clip.Update()\n\n    # Define a suitable grayscale lut\n    bw_lut = vtkLookupTable()\n    bw_lut.SetTableRange(0, 2048)\n    bw_lut.SetSaturationRange(0, 0)\n    bw_lut.SetHueRange(0, 0)\n    bw_lut.SetValueRange(0.2, 1)\n    bw_lut.Build()\n\n    lens_mapper = vtkDataSetMapper()\n    lens_mapper.SetInputConnection(lens_clip.GetOutputPort())\n    lens_mapper.SetScalarRange(lens_clip.GetOutput().GetScalarRange())\n    lens_mapper.SetLookupTable(bw_lut)\n\n    lens = vtkActor()\n    lens.SetMapper(lens_mapper)\n\n    # It is convenient to create an initial view of the data. The FocalPoint\n    # and Position form a vector direction. Later on (ResetCamera() method)\n    # this vector is used to position the camera to look at the data in\n    # this direction.\n    a_camera = vtkCamera()\n    a_camera.SetViewUp(0, 0, -1)\n    a_camera.SetPosition(0, -1, 0)\n    a_camera.SetFocalPoint(0, 0, 0)\n    a_camera.ComputeViewPlaneNormal()\n    a_camera.Azimuth(30.0)\n    a_camera.Elevation(30.0)\n\n    # Create the renderer, the render window, and the interactor. The renderer\n    # draws into the render window, the interactor enables mouse- and\n    # keyboard-based interaction with the data within the render window.\n    #\n    a_renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(a_renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Actors are added to the renderer. An initial camera view is created.\n    # The Dolly() method moves the camera towards the FocalPoint,\n    # thereby enlarging the image.\n    a_renderer.AddActor(lens)\n    a_renderer.AddActor(skin)\n    a_renderer.SetActiveCamera(a_camera)\n    a_renderer.ResetCamera()\n    a_camera.Dolly(1.5)\n\n    # Set a background color for the renderer and set the size of the\n    # render window (expressed in pixels).\n    a_renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('TissueLens')\n\n    # Note that when camera movement occurs (as it does in the Dolly()\n    # method), the clipping planes often need adjusting. Clipping planes\n    # consist of two planes: near and far along the view direction. The\n    # near plane clips out objects in front of the plane the far plane\n    # clips out objects behind the plane. This way only what is drawn\n    # between the planes is actually rendered.\n    a_renderer.ResetCameraClippingRange()\n\n    # Initialize the event loop and then start it.\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The skin and bone is extracted from a CT dataset of the head and a \"tissue lens\" effect is applied.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Meshes/BoundaryEdges/","title":"BoundaryEdges","text":"

vtk-examples/Python/Meshes/BoundaryEdges

"},{"location":"Python/Meshes/BoundaryEdges/#description","title":"Description","text":"

This filter will extract the boundary edges of a mesh. The original mesh is shown with the feature edges shown in red.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Meshes/BoundaryEdges/#code","title":"Code","text":"

BoundaryEdges.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkFeatureEdges\nfrom vtkmodules.vtkFiltersSources import vtkDiskSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    diskSource = vtkDiskSource()\n    diskSource.Update()\n\n    featureEdges = vtkFeatureEdges()\n    featureEdges.SetInputConnection(diskSource.GetOutputPort())\n    featureEdges.BoundaryEdgesOn()\n    featureEdges.FeatureEdgesOff()\n    featureEdges.ManifoldEdgesOff()\n    featureEdges.NonManifoldEdgesOff()\n    featureEdges.ColoringOn()\n    featureEdges.Update()\n\n    # Visualize\n    edgeMapper = vtkPolyDataMapper()\n    edgeMapper.SetInputConnection(featureEdges.GetOutputPort())\n    edgeActor = vtkActor()\n    edgeActor.SetMapper(edgeMapper)\n\n    diskMapper = vtkPolyDataMapper()\n    diskMapper.SetInputConnection(diskSource.GetOutputPort())\n    diskActor = vtkActor()\n    diskActor.SetMapper(diskMapper)\n    diskActor.GetProperty().SetColor(colors.GetColor3d('Gray'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('BoundaryEdges')\n\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(edgeActor)\n    renderer.AddActor(diskActor)\n    renderer.SetBackground(colors.GetColor3d('DimGray'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Meshes/CapClip/","title":"CapClip","text":"

vtk-examples/Python/Meshes/CapClip

"},{"location":"Python/Meshes/CapClip/#description","title":"Description","text":"

This example shows how to generate a \"cap\" on a clipped vtkPolyData. After clipping with vtkClipPolyData, it uses a clever ''trick'' to convert polylines into polygons. If a polydata file is provided, it will cap it. Otherwise it caps a clipped sphere.

Warning

The clipping is done with a scalar field provided by vtkPlane and results may depend on the resolution of the input vtkPolyData.

Style

This example collects all of the color definition in the beginning of the example. This makes it easier to make changes to the colors without having to search the code.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Meshes/CapClip/#code","title":"Code","text":"

CapClip.py

#!/usr/bin/env python\n\nimport os.path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkPlane,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkClipPolyData,\n    vtkFeatureEdges,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Clip polydata using a plane.'\n    epilogue = '''\n    This is an example using vtkClipPolyData to clip input polydata, if provided, or a sphere otherwise.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', nargs='?', default=None, help='Optional input filename e.g cow.g.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filePath = get_program_parameters()\n\n    # Define colors\n    colors = vtkNamedColors()\n    backgroundColor = colors.GetColor3d('steel_blue')\n    boundaryColor = colors.GetColor3d('Banana')\n    clipColor = colors.GetColor3d('Tomato')\n\n    if filePath and os.path.isfile(filePath):\n        polyData = ReadPolyData(filePath)\n        if not polyData:\n            polyData = GetSpherePD()\n    else:\n        polyData = GetSpherePD()\n\n    plane = vtkPlane()\n    plane.SetOrigin(polyData.GetCenter())\n    plane.SetNormal(1.0, -1.0, -1.0)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputData(polyData)\n    clipper.SetClipFunction(plane)\n    clipper.SetValue(0)\n    clipper.Update()\n\n    polyData = clipper.GetOutput()\n\n    clipMapper = vtkDataSetMapper()\n    clipMapper.SetInputData(polyData)\n\n    clipActor = vtkActor()\n    clipActor.SetMapper(clipMapper)\n    clipActor.GetProperty().SetDiffuseColor(clipColor)\n    clipActor.GetProperty().SetInterpolationToFlat()\n    clipActor.GetProperty().EdgeVisibilityOn()\n\n    # Now extract feature edges\n    boundaryEdges = vtkFeatureEdges()\n    boundaryEdges.SetInputData(polyData)\n    boundaryEdges.BoundaryEdgesOn()\n    boundaryEdges.FeatureEdgesOff()\n    boundaryEdges.NonManifoldEdgesOff()\n    boundaryEdges.ManifoldEdgesOff()\n\n    boundaryStrips = vtkStripper()\n    boundaryStrips.SetInputConnection(boundaryEdges.GetOutputPort())\n    boundaryStrips.Update()\n\n    # Change the polylines into polygons\n    boundaryPoly = vtkPolyData()\n    boundaryPoly.SetPoints(boundaryStrips.GetOutput().GetPoints())\n    boundaryPoly.SetPolys(boundaryStrips.GetOutput().GetLines())\n\n    boundaryMapper = vtkPolyDataMapper()\n    boundaryMapper.SetInputData(boundaryPoly)\n\n    boundaryActor = vtkActor()\n    boundaryActor.SetMapper(boundaryMapper)\n    boundaryActor.GetProperty().SetDiffuseColor(boundaryColor)\n\n    # create renderer render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # set background color and size\n    renderer.SetBackground(backgroundColor)\n    renderWindow.SetSize(640, 480)\n\n    # add our actor to the renderer\n    renderer.AddActor(clipActor)\n    renderer.AddActor(boundaryActor)\n\n    # Generate an interesting view\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.GetActiveCamera().Dolly(1.2)\n    renderer.ResetCameraClippingRange()\n\n    renderWindow.Render()\n    renderWindow.SetWindowName('CapClip')\n    renderWindow.Render()\n\n    interactor.Start()\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef GetSpherePD():\n    '''\n    :return: The PolyData representation of a sphere.\n    '''\n    source = vtkSphereSource()\n    source.SetThetaResolution(20)\n    source.SetPhiResolution(11)\n    source.Update()\n    return source.GetOutput()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Meshes/ClipDataSetWithPolyData/","title":"ClipDataSetWithPolyData","text":"

vtk-examples/Python/Meshes/ClipDataSetWithPolyData

"},{"location":"Python/Meshes/ClipDataSetWithPolyData/#description","title":"Description","text":"

The example that shows how to use the vtkClipDataSet to clip a vtkRectilinearGrid with an arbitrary polydata. vtkImplicitPolyDataDistance is used to turn the polydata into an implicit function. Every point of the grid is evaluated before sending to vtkClipDataSet. This example uses a vtkConeSource to generate polydata to use, however any polydata could be used, including stl files.

The left part of the image shows the inside clip and the distance field on a center slice. The right side shows the outside clip. When the program exits using the \"e: key, the example will report the cell type for both the inside and outside clips.

Note

vtkClipDataSet tetrahedralizes the volume before clipping. Contrast this with the vtkTableBasedClipDataSet example: TableBasedClipDataSetWithPolyData.

Here is the summary reported when the example exits:

The clipped dataset(inside) contains a vtkUnstructuredGrid that has 49514 cells Cell type vtkTetra occurs 41034 times. Cell type vtkWedge occurs 8480 times.

The clipped dataset(outside) contains a vtkUnstructuredGrid that has 714434 cells Cell type vtkTetra occurs 705090 times. Cell type vtkWedge occurs 9344 times.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Meshes/ClipDataSetWithPolyData/#code","title":"Code","text":"

ClipDataSetWithPolyData.py

#!/usr/bin/env python\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellTypes,\n    vtkRectilinearGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkImplicitPolyDataDistance\nfrom vtkmodules.vtkFiltersGeneral import vtkClipDataSet\nfrom vtkmodules.vtkFiltersGeometry import vtkRectilinearGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create polydata to slice the grid with. In this case, use a cone. This\n    # could\n    # be any polydata including a stl file.\n    cone = vtkConeSource()\n    cone.SetResolution(50)\n    cone.SetDirection(0, 0, -1)\n    cone.SetHeight(3.0)\n    cone.CappingOn()\n    cone.Update()\n\n    # Implicit function that will be used to slice the mesh\n    implicitPolyDataDistance = vtkImplicitPolyDataDistance()\n    implicitPolyDataDistance.SetInput(cone.GetOutput())\n\n    # create a grid\n    dimension = 51\n    xCoords = vtkFloatArray()\n    for x, i in enumerate(np.linspace(-1.0, 1.0, dimension)):\n        xCoords.InsertNextValue(i)\n\n    yCoords = vtkFloatArray()\n    for y, i in enumerate(np.linspace(-1.0, 1.0, dimension)):\n        yCoords.InsertNextValue(i)\n\n    zCoords = vtkFloatArray()\n    for z, i in enumerate(np.linspace(-1.0, 1.0, dimension)):\n        zCoords.InsertNextValue(i)\n\n    # # create a grid - if not using numpy\n    # dimension = 51\n    # xCoords = vtkFloatArray()\n    # for i in range(0, dimension):\n    #     xCoords.InsertNextValue(-1.0 + i * 2.0 / (dimension - 1))\n    #\n    # yCoords = vtkFloatArray()\n    # for i in range(0, dimension):\n    #     yCoords.InsertNextValue(-1.0 + i * 2.0 / (dimension - 1))\n    #\n    # zCoords = vtkFloatArray()\n    # for i in range(0, dimension):\n    #     zCoords.InsertNextValue(-1.0 + i * 2.0 / (dimension - 1))\n\n    # The coordinates are assigned to the rectilinear grid. Make sure that\n    # the number of values in each of the XCoordinates, YCoordinates,\n    # and ZCoordinates is equal to what is defined in SetDimensions().\n    rgrid = vtkRectilinearGrid()\n    rgrid.SetDimensions(xCoords.GetNumberOfTuples(),\n                        yCoords.GetNumberOfTuples(),\n                        zCoords.GetNumberOfTuples())\n    rgrid.SetXCoordinates(xCoords)\n    rgrid.SetYCoordinates(yCoords)\n    rgrid.SetZCoordinates(zCoords)\n\n    # Create an array to hold distance information\n    signedDistances = vtkFloatArray()\n    signedDistances.SetNumberOfComponents(1)\n    signedDistances.SetName('SignedDistances')\n\n    # Evaluate the signed distance function at all of the grid points\n    for pointId in range(0, rgrid.GetNumberOfPoints()):\n        p = rgrid.GetPoint(pointId)\n        signedDistance = implicitPolyDataDistance.EvaluateFunction(p)\n        signedDistances.InsertNextValue(signedDistance)\n\n    # Add the SignedDistances to the grid\n    rgrid.GetPointData().SetScalars(signedDistances)\n\n    # Use vtkClipDataSet to slice the grid with the polydata\n    clipper = vtkClipDataSet()\n    clipper.SetInputData(rgrid)\n    clipper.InsideOutOn()\n    clipper.SetValue(0.0)\n    clipper.GenerateClippedOutputOn()\n    clipper.Update()\n\n    # --- mappers, actors, render, etc. ---\n    # mapper and actor to view the cone\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n\n    # geometry filter to view the background grid\n    geometryFilter = vtkRectilinearGridGeometryFilter()\n    geometryFilter.SetInputData(rgrid)\n    geometryFilter.SetExtent(0, dimension, 0, dimension, int(dimension / 2), int(dimension / 2))\n    geometryFilter.Update()\n\n    rgridMapper = vtkPolyDataMapper()\n    rgridMapper.SetInputConnection(geometryFilter.GetOutputPort())\n    rgridMapper.SetScalarRange(\n        rgrid.GetPointData().GetArray('SignedDistances').GetRange())\n\n    wireActor = vtkActor()\n    wireActor.SetMapper(rgridMapper)\n    wireActor.GetProperty().SetRepresentationToWireframe()\n\n    # mapper and actor to view the clipped mesh\n    clipperMapper = vtkDataSetMapper()\n    clipperMapper.SetInputConnection(clipper.GetOutputPort())\n    clipperMapper.ScalarVisibilityOff()\n\n    clipperOutsideMapper = vtkDataSetMapper()\n    clipperOutsideMapper.SetInputConnection(clipper.GetOutputPort(1))\n    clipperOutsideMapper.ScalarVisibilityOff()\n\n    clipperActor = vtkActor()\n    clipperActor.SetMapper(clipperMapper)\n    clipperActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n\n    clipperOutsideActor = vtkActor()\n    clipperOutsideActor.SetMapper(clipperOutsideMapper)\n    clipperOutsideActor.GetProperty().SetColor(\n        colors.GetColor3d('Banana'))\n\n    # A renderer and render window\n    # Create a renderer, render window, and interactor\n    leftViewport = [0.0, 0.0, 0.5, 1.0]\n    leftRenderer = vtkRenderer()\n    leftRenderer.SetViewport(leftViewport)\n    leftRenderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    rightViewport = [0.5, 0.0, 1.0, 1.0]\n    rightRenderer = vtkRenderer()\n    rightRenderer.SetViewport(rightViewport)\n    rightRenderer.SetBackground(colors.GetColor3d('CadetBlue'))\n\n    # add the actors\n    leftRenderer.AddActor(wireActor)\n    leftRenderer.AddActor(clipperActor)\n    rightRenderer.AddActor(clipperOutsideActor)\n\n    renwin = vtkRenderWindow()\n    renwin.SetSize(640, 480)\n    renwin.AddRenderer(leftRenderer)\n    renwin.AddRenderer(rightRenderer)\n    renwin.SetWindowName('ClipDataSetWithPolyData')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # Share the camera\n\n    leftRenderer.GetActiveCamera().SetPosition(0, -1, 0)\n    leftRenderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    leftRenderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    leftRenderer.GetActiveCamera().Azimuth(30)\n    leftRenderer.GetActiveCamera().Elevation(30)\n    leftRenderer.ResetCamera()\n    rightRenderer.SetActiveCamera(leftRenderer.GetActiveCamera())\n\n    renwin.Render()\n    interactor.Start()\n\n    # Generate a report\n    ct = vtkCellTypes()\n\n    numberOfCells = clipper.GetOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The clipped dataset(inside) contains a\\n', clipper.GetOutput().GetClassName(), 'that has', numberOfCells,\n          'cells')\n    cellMap = dict()\n    for i in range(0, numberOfCells):\n        cellMap[clipper.GetOutput().GetCellType(i)] = cellMap.get(clipper.GetOutput().GetCellType(i), 0) + 1\n\n    for k, v in cellMap.items():\n        print('\\tCell type ', ct.GetClassNameFromTypeId(k), 'occurs', v, 'times.')\n\n    numberOfCells = clipper.GetClippedOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The clipped dataset(outside) contains a\\n', clipper.GetClippedOutput().GetClassName(), 'that has',\n          numberOfCells, 'cells')\n    outsideCellMap = dict()\n    for i in range(0, numberOfCells):\n        outsideCellMap[clipper.GetClippedOutput().GetCellType(i)] = outsideCellMap.get(\n            clipper.GetClippedOutput().GetCellType(i), 0) + 1\n\n    for k, v in outsideCellMap.items():\n        print('\\tCell type ', ct.GetClassNameFromTypeId(k), 'occurs', v, 'times.')\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Meshes/ClipDataSetWithPolyData1/","title":"ClipDataSetWithPolyData1","text":"

vtk-examples/Python/Meshes/ClipDataSetWithPolyData1

"},{"location":"Python/Meshes/ClipDataSetWithPolyData1/#description","title":"Description","text":"

An example that shows how to use the vtkClipDataSet to clip a vtkRectilinearGrid with an arbitrary polydata. vtkImplicitPolyDataDistance is used to turn the polydata into an implicit function. Every point of the grid is evaluated before sending to vtkClipDataSet. This example uses a vtkConeSource to generate polydata to use, however any polydata could be used, including stl files.

Note

This was the original code used to make the C++ example ClipDataSetWithPolyData

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Meshes/ClipDataSetWithPolyData1/#code","title":"Code","text":"

ClipDataSetWithPolyData1.py

#!/usr/bin/env python\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import vtkRectilinearGrid\nfrom vtkmodules.vtkFiltersCore import vtkImplicitPolyDataDistance\nfrom vtkmodules.vtkFiltersGeneral import vtkClipDataSet\nfrom vtkmodules.vtkFiltersGeometry import vtkRectilinearGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create polydata to slice the grid with. In this case, use a cone. This could\n    # be any polydata including a stl file.\n    cone = vtkConeSource()\n    cone.SetResolution(20)\n    cone.Update()\n\n    # implicit function that will be used to slice the mesh\n    implicitPolyDataDistance = vtkImplicitPolyDataDistance()\n    implicitPolyDataDistance.SetInput(cone.GetOutput())\n\n    # create a grid\n    xCoords = vtkFloatArray()\n    for x, i in enumerate(np.linspace(-1.0, 1.0, 15)):\n        xCoords.InsertNextValue(i)\n\n    yCoords = vtkFloatArray()\n    for y, i in enumerate(np.linspace(-1.0, 1.0, 15)):\n        yCoords.InsertNextValue(i)\n\n    zCoords = vtkFloatArray()\n    for z, i in enumerate(np.linspace(-1.0, 1.0, 15)):\n        zCoords.InsertNextValue(i)\n\n    # The coordinates are assigned to the rectilinear grid. Make sure that\n    # the number of values in each of the XCoordinates, YCoordinates,\n    # and ZCoordinates is equal to what is defined in SetDimensions().\n    rgrid = vtkRectilinearGrid()\n    rgrid.SetDimensions(x + 1, y + 1, z + 1)\n    rgrid.SetXCoordinates(xCoords)\n    rgrid.SetYCoordinates(yCoords)\n    rgrid.SetZCoordinates(zCoords)\n\n    # Create an array to hold distance information\n    signedDistances = vtkFloatArray()\n    signedDistances.SetNumberOfComponents(1)\n    signedDistances.SetName('SignedDistances')\n\n    # Evaluate the signed distance function at all of the grid points\n    for pointId in range(rgrid.GetNumberOfPoints()):\n        p = rgrid.GetPoint(pointId)\n        signedDistance = implicitPolyDataDistance.EvaluateFunction(p)\n        signedDistances.InsertNextValue(signedDistance)\n\n    # add the SignedDistances to the grid\n    rgrid.GetPointData().SetScalars(signedDistances)\n\n    # use vtkClipDataSet to slice the grid with the polydata\n    clipper = vtkClipDataSet()\n    clipper.SetInputData(rgrid)\n    clipper.InsideOutOn()\n    clipper.SetValue(0.0)\n    clipper.Update()\n\n    # --- mappers, actors, render, etc. ---\n    # mapper and actor to view the cone\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n\n    # geometry filter to view the background grid\n    geometryFilter = vtkRectilinearGridGeometryFilter()\n    geometryFilter.SetInputData(rgrid)\n    geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2)\n    geometryFilter.Update()\n\n    rgridMapper = vtkPolyDataMapper()\n    rgridMapper.SetInputConnection(geometryFilter.GetOutputPort())\n\n    wireActor = vtkActor()\n    wireActor.SetMapper(rgridMapper)\n    wireActor.GetProperty().SetRepresentationToWireframe()\n    wireActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # mapper and actor to view the clipped mesh\n    clipperMapper = vtkDataSetMapper()\n    clipperMapper.SetInputConnection(clipper.GetOutputPort())\n\n    clipperActor = vtkActor()\n    clipperActor.SetMapper(clipperMapper)\n    clipperActor.GetProperty().SetRepresentationToWireframe()\n    clipperActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Snow'))\n\n    # add the actors\n    # renderer.AddActor(coneActor)\n    renderer.AddActor(wireActor)\n    renderer.AddActor(clipperActor)\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('ClipDataSetWithPolyData')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    renderer.GetActiveCamera().SetPosition(0, -1, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCamera()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Meshes/ColoredElevationMap/","title":"ColoredElevationMap","text":"

vtk-examples/Python/Meshes/ColoredElevationMap

"},{"location":"Python/Meshes/ColoredElevationMap/#description","title":"Description","text":"

This example creates a elevation map with different color based on height.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Meshes/ColoredElevationMap/#code","title":"Code","text":"

ColoredElevationMap.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkMinimalStandardRandomSequence,\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkDelaunay2D\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    named_colors = vtkNamedColors()\n\n    # Create a grid points\n    points = vtkPoints()\n    GridSize = 20;\n    xx = 0.0\n    yy = 0.0\n    zz = 0.0\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(8775586)  # For testing.\n    for x in range(0, GridSize):\n        for y in range(0, GridSize):\n            rng.Next()\n            xx = x + rng.GetRangeValue(-0.2, 0.2)\n            rng.Next()\n            yy = y + rng.GetRangeValue(-0.2, 0.2)\n            rng.Next()\n            zz = rng.GetRangeValue(-0.5, 0.5)\n            points.InsertNextPoint(xx, yy, zz)\n\n    # Add the grid points to a polydata object\n    inputPolyData = vtkPolyData()\n    inputPolyData.SetPoints(points)\n\n    # Triangulate the grid points\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(inputPolyData)\n    delaunay.Update()\n    outputPolyData = delaunay.GetOutput()\n\n    bounds = 6 * [0.0]\n    outputPolyData.GetBounds(bounds)\n\n    # Find min and max z\n    minz = bounds[4]\n    maxz = bounds[5]\n\n    print('minz: {:< 6.3}'.format(minz))\n    print('maxz: {:< 6.3}'.format(maxz))\n\n    # Create the color map\n    colorLookupTable = vtkLookupTable()\n    colorLookupTable.SetTableRange(minz, maxz)\n    colorLookupTable.Build()\n\n    # Generate the colors for each point based on the color map\n    colors = vtkUnsignedCharArray()\n    colors.SetNumberOfComponents(3)\n    colors.SetName('Colors')\n\n    print('There are ' + str(outputPolyData.GetNumberOfPoints()) + ' points.')\n\n    for i in range(0, outputPolyData.GetNumberOfPoints()):\n        p = 3 * [0.0]\n        outputPolyData.GetPoint(i, p)\n\n        dcolor = 3 * [0.0]\n        colorLookupTable.GetColor(p[2], dcolor);\n        # print( 'dcolor: {:<8.6} {:<8.6} {:<8.6}'.format(*dcolor))\n        color = 3 * [0.0]\n        for j in range(0, 3):\n            color[j] = int(255.0 * dcolor[j])\n        # print('color:  {:<8} {:<8} {:<8}'.format(*color))\n\n        try:\n            colors.InsertNextTupleValue(color)\n        except AttributeError:\n            # For compatibility with new VTK generic data arrays.\n            colors.InsertNextTypedTuple(color)\n\n    outputPolyData.GetPointData().SetScalars(colors)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(outputPolyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('ColoredElevationMap')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(named_colors.GetColor3d('DarkSlateGray'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Meshes/Decimation/","title":"Decimation","text":"

vtk-examples/Python/Meshes/Decimation

"},{"location":"Python/Meshes/Decimation/#description","title":"Description","text":"

This example decimates a mesh using progressive decimation. The SetTargetReduction function specifies how many triangles should reduced by specifying the percentage (0,1) of triangles to be removed. For example, if the mesh contains 100 triangles and SetTargetReduction(.90) is called, after the decimation there will be approximately 10 triangles - a 90% reduction.

The implementation of vtkDecimatePro is similar to the algorithm originally described in \"Decimation of Triangle Meshes\", Proc Siggraph `92, with three major differences. First, this algorithm does not necessarily preserve the topology of the mesh. Second, it is guaranteed to give the a mesh reduction factor specified by the user (as long as certain constraints are not set - see Caveats). Third, it is set up generate progressive meshes, that is a stream of operations that can be easily transmitted and incrementally updated (see Hugues Hoppe's Siggraph '96 paper on progressive meshes).

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Meshes/Decimation/#code","title":"Code","text":"

Decimation.py

#!/usr/bin/env python\n\nimport os.path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDecimatePro,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Decimate polydata.'\n    epilogue = '''\n    This is an example using vtkDecimatePro to decimate input polydata, if provided, or a sphere otherwise.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', nargs='?', default=None, help='Optional input filename e.g Torso.vtp.')\n    parser.add_argument('reduction', nargs='?', type=float, default=.9,\n                        help='Sets the decimation target reduction, (default is 0.9).')\n    args = parser.parse_args()\n    return args.filename, args.reduction\n\n\ndef main():\n    filePath, reduction = get_program_parameters()\n\n    # Define colors\n    colors = vtkNamedColors()\n    backFaceColor = colors.GetColor3d('Gold')\n    inputActorColor = colors.GetColor3d('NavajoWhite')\n    decimatedActorColor = colors.GetColor3d('NavajoWhite')\n    # colors.SetColor('leftBkg', [0.6, 0.5, 0.4, 1.0])\n    # colors.SetColor('rightBkg', [0.4, 0.5, 0.6, 1.0])\n\n    if filePath and os.path.isfile(filePath):\n        readerPD = ReadPolyData(filePath)\n        if not readerPD:\n            inputPolyData = GetSpherePD()\n        else:\n            triangles = vtkTriangleFilter()\n            triangles.SetInputData(readerPD)\n            triangles.Update()\n            inputPolyData = triangles.GetOutput()\n    else:\n        inputPolyData = GetSpherePD()\n\n    print('Before decimation')\n    print(f'There are {inputPolyData.GetNumberOfPoints()} points.')\n    print(f'There are {inputPolyData.GetNumberOfPolys()} polygons.')\n\n    decimate = vtkDecimatePro()\n    decimate.SetInputData(inputPolyData)\n    decimate.SetTargetReduction(reduction)\n    decimate.PreserveTopologyOn()\n    decimate.Update()\n\n    decimated = vtkPolyData()\n    decimated.ShallowCopy(decimate.GetOutput())\n\n    print('After decimation')\n    print(f'There are {decimated.GetNumberOfPoints()} points.')\n    print(f'There are {decimated.GetNumberOfPolys()} polygons.')\n    print(\n        f'Reduction: {(inputPolyData.GetNumberOfPolys() - decimated.GetNumberOfPolys()) / inputPolyData.GetNumberOfPolys()}')\n\n    inputMapper = vtkPolyDataMapper()\n    inputMapper.SetInputData(inputPolyData)\n\n    backFace = vtkProperty()\n    backFace.SetColor(backFaceColor)\n\n    inputActor = vtkActor()\n    inputActor.SetMapper(inputMapper)\n    inputActor.GetProperty().SetInterpolationToFlat()\n    inputActor.GetProperty().SetColor(inputActorColor)\n    inputActor.SetBackfaceProperty(backFace)\n\n    decimatedMapper = vtkPolyDataMapper()\n    decimatedMapper.SetInputData(decimated)\n\n    decimatedActor = vtkActor()\n    decimatedActor.SetMapper(decimatedMapper)\n    decimatedActor.GetProperty().SetColor(decimatedActorColor)\n    decimatedActor.GetProperty().SetInterpolationToFlat()\n    decimatedActor.SetBackfaceProperty(backFace)\n\n    # There will be one render window\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.SetWindowName('Decimation');\n\n    # And one interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Define viewport ranges\n    # (xmin, ymin, xmax, ymax)\n    leftViewport = [0.0, 0.0, 0.5, 1.0]\n    rightViewport = [0.5, 0.0, 1.0, 1.0]\n\n    # Setup both renderers\n    leftRenderer = vtkRenderer()\n    renderWindow.AddRenderer(leftRenderer)\n    leftRenderer.SetViewport(leftViewport)\n    # leftRenderer.SetBackground((colors.GetColor3d('leftBkg')))\n    leftRenderer.SetBackground((colors.GetColor3d('Peru')))\n\n    rightRenderer = vtkRenderer()\n    renderWindow.AddRenderer(rightRenderer)\n    rightRenderer.SetViewport(rightViewport)\n    # rightRenderer.SetBackground((colors.GetColor3d('rightBkg')))\n    rightRenderer.SetBackground((colors.GetColor3d('CornflowerBlue')))\n\n    # Add the sphere to the left and the cube to the right\n    leftRenderer.AddActor(inputActor)\n    rightRenderer.AddActor(decimatedActor)\n\n    # Shared camera\n    # Shared camera looking down the -y axis\n    camera = vtkCamera()\n    camera.SetPosition(0, -1, 0)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetViewUp(0, 0, 1)\n    camera.Elevation(30)\n    camera.Azimuth(30)\n\n    leftRenderer.SetActiveCamera(camera)\n    rightRenderer.SetActiveCamera(camera)\n\n    leftRenderer.ResetCamera()\n    leftRenderer.ResetCameraClippingRange()\n\n    renderWindow.Render()\n    renderWindow.SetWindowName('Decimation')\n\n    interactor.Start()\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef GetSpherePD():\n    '''\n    :return: The PolyData representation of a sphere.\n    '''\n    source = vtkSphereSource()\n    source.SetThetaResolution(30)\n    source.SetPhiResolution(15)\n    source.Update()\n    return source.GetOutput()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Meshes/DeformPointSet/","title":"DeformPointSet","text":"

vtk-examples/Python/Meshes/DeformPointSet

"},{"location":"Python/Meshes/DeformPointSet/#description","title":"Description","text":"

An example that shows how to use the vtkDeformPointSet filter to deform a sphere with arbitrary polydata. This example uses a vtkSphereSource to generate polydata to use, however any polydata could be used, including stl files.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Meshes/DeformPointSet/#code","title":"Code","text":"

DeformPointSet.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkDeformPointSet\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    # colors.SetColor('bkg', [0.2, 0.3, 0.4, 1.0])\n\n    # Create a sphere to deform\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(51)\n    sphere.SetPhiResolution(17)\n    sphere.Update()\n    bounds = sphere.GetOutput().GetBounds()\n\n    # Create a filter to color the sphere\n    ele = vtkElevationFilter()\n    ele.SetInputConnection(sphere.GetOutputPort())\n    ele.SetLowPoint(0, 0, -0.5);\n    ele.SetHighPoint(0, 0, 0.5);\n    ele.SetLowPoint((bounds[1] + bounds[0]) / 2.0,\n                    (bounds[3] + bounds[2]) / 2.0,\n                    -bounds[5]);\n    ele.SetHighPoint((bounds[1] + bounds[0]) / 2.0,\n                     (bounds[3] + bounds[2]) / 2.0,\n                     bounds[5]);\n    ele.Update()\n\n    # Create a mesh to deform the sphere\n    pts = vtkPoints()\n    pts.SetNumberOfPoints(6)\n    pts.SetPoint(0,\n                 bounds[0] - 0.1 * (bounds[1] - bounds[0]),\n                 (bounds[3] + bounds[2]) / 2.0,\n                 (bounds[5] + bounds[4]) / 2.0)\n    pts.SetPoint(1,\n                 bounds[1] + 0.1 * (bounds[1] - bounds[0]),\n                 (bounds[3] + bounds[2]) / 2.0,\n                 (bounds[5] + bounds[4]) / 2.0)\n    pts.SetPoint(2,\n                 (bounds[1] + bounds[0]) / 2.0,\n                 bounds[2] - 0.1 * (bounds[3] - bounds[2]),\n                 (bounds[5] + bounds[4]) / 2.0)\n    pts.SetPoint(3,\n                 (bounds[1] + bounds[0]) / 2.0,\n                 bounds[3] + 0.1 * (bounds[3] - bounds[2]),\n                 (bounds[5] + bounds[4]) / 2.0)\n    pts.SetPoint(4,\n                 (bounds[1] + bounds[0]) / 2.0,\n                 (bounds[3] + bounds[2]) / 2.0,\n                 bounds[4] - 0.1 * (bounds[5] - bounds[4]))\n    pts.SetPoint(5,\n                 (bounds[1] + bounds[0]) / 2.0,\n                 (bounds[3] + bounds[2]) / 2.0,\n                 bounds[5] + 0.1 * (bounds[5] - bounds[4]))\n    tris = vtkCellArray()\n\n    cells = [[2, 0, 4], [1, 2, 4], [3, 1, 4], [0, 3, 4], [0, 2, 5], [2, 1, 5], [1, 3, 5], [3, 0, 5]]\n\n    for cell in cells:\n        tris.InsertNextCell(3)\n        for c in cell:\n            tris.InsertCellPoint(c)\n\n    pd = vtkPolyData()\n    pd.SetPoints(pts)\n    pd.SetPolys(tris)\n\n    meshMapper = vtkPolyDataMapper()\n    meshMapper.SetInputData(pd)\n    meshActor = vtkActor()\n    meshActor.SetMapper(meshMapper)\n    meshActor.GetProperty().SetRepresentationToWireframe()\n    meshActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    deform = vtkDeformPointSet()\n    deform.SetInputData(ele.GetOutput())\n    deform.SetControlMeshData(pd)\n    deform.Update()\n\n    controlPoint = pts.GetPoint(5)\n    pts.SetPoint(5, controlPoint[0],\n                 controlPoint[1],\n                 bounds[5] + .8 * (bounds[5] - bounds[4]))\n    pts.Modified()\n\n    polyMapper = vtkPolyDataMapper()\n    polyMapper.SetInputConnection(deform.GetOutputPort())\n    polyActor = vtkActor()\n    polyActor.SetMapper(polyMapper)\n\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    renderer.AddActor(polyActor)\n    renderer.AddActor(meshActor)\n\n    renderer.GetActiveCamera().SetPosition(1, 1, 1)\n    renderer.ResetCamera()\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('DeformPointSet')\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Meshes/PointInterpolator/","title":"PointInterpolator","text":"

vtk-examples/Python/Meshes/PointInterpolator

"},{"location":"Python/Meshes/PointInterpolator/#description","title":"Description","text":"

This example uses vtkPointInterpolator with a Gaussian Kernel (or other kernel) to interpolate and extrapolate more smoothly the fields inside and outside the probed area.

Info

This C++ code is translated from the python code that Kenichiro Yoshimi wrote to respond to Hosam. See the discourse discussion.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Meshes/PointInterpolator/#code","title":"Code","text":"

PointInterpolator.py

#!/usr/bin/env python\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkFiltersCore import vtkResampleWithDataSet\nfrom vtkmodules.vtkFiltersGeneral import vtkTableToPolyData\nfrom vtkmodules.vtkFiltersPoints import (\n    vtkGaussianKernel,\n    vtkPointInterpolator\n)\nfrom vtkmodules.vtkIOGeometry import vtkSTLReader\nfrom vtkmodules.vtkIOInfovis import vtkDelimitedTextReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPointGaussianMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Plot the scalar field of points onto a PolyData surface.'\n    epilogue = '''\nThis example uses vtkPointInterpolator with a Gaussian Kernel (or other kernel)\n to interpolate and extrapolate more smoothly the fields inside and outside the probed area.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('points_fn', help='sparsePoints.txt.')\n    parser.add_argument('probe_fn', help='InterpolatingOnSTL_final.stl.')\n\n    args = parser.parse_args()\n    return args.points_fn, args.probe_fn\n\n\ndef main():\n    points_fn, probe_fn = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    points_reader = vtkDelimitedTextReader()\n    points_reader.SetFileName(points_fn)\n    points_reader.DetectNumericColumnsOn()\n    points_reader.SetFieldDelimiterCharacters('\\t')\n    points_reader.SetHaveHeaders(True)\n\n    table_points = vtkTableToPolyData()\n    table_points.SetInputConnection(points_reader.GetOutputPort())\n    table_points.SetXColumn('x')\n    table_points.SetYColumn('y')\n    table_points.SetZColumn('z')\n    table_points.Update()\n\n    points = table_points.GetOutput()\n    points.GetPointData().SetActiveScalars('val')\n    range = points.GetPointData().GetScalars().GetRange()\n\n    # Read a probe surface\n    stl_reader = vtkSTLReader()\n    stl_reader.SetFileName(probe_fn)\n    stl_reader.Update()\n\n    surface = stl_reader.GetOutput()\n    bounds = np.array(surface.GetBounds())\n\n    dims = np.array([101, 101, 101])\n    box = vtkImageData()\n    box.SetDimensions(dims)\n    box.SetSpacing((bounds[1::2] - bounds[:-1:2]) / (dims - 1))\n    box.SetOrigin(bounds[::2])\n\n    # Gaussian kernel\n    gaussian_kernel = vtkGaussianKernel()\n    gaussian_kernel.SetSharpness(2)\n    gaussian_kernel.SetRadius(12)\n\n    interpolator = vtkPointInterpolator()\n    interpolator.SetInputData(box)\n    interpolator.SetSourceData(points)\n    interpolator.SetKernel(gaussian_kernel)\n\n    resample = vtkResampleWithDataSet()\n    resample.SetInputData(surface)\n    resample.SetSourceConnection(interpolator.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(resample.GetOutputPort())\n    mapper.SetScalarRange(range)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    point_mapper = vtkPointGaussianMapper()\n    point_mapper.SetInputData(points)\n    point_mapper.SetScalarRange(range)\n    point_mapper.SetScaleFactor(0.6)\n    point_mapper.EmissiveOff();\n    point_mapper.SetSplatShaderCode(\n        \"//VTK::Color::Impl\\n\"\n        \"float dist = dot(offsetVCVSOutput.xy,offsetVCVSOutput.xy);\\n\"\n        \"if (dist > 1.0) {\\n\"\n        \"  discard;\\n\"\n        \"} else {\\n\"\n        \"  float scale = (1.0 - dist);\\n\"\n        \"  ambientColor *= scale;\\n\"\n        \"  diffuseColor *= scale;\\n\"\n        \"}\\n\"\n    )\n\n    point_actor = vtkActor()\n    point_actor.SetMapper(point_mapper)\n\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(point_actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('PointInterpolator')\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(-45)\n\n    iren.Initialize()\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Meshes/SolidClip/","title":"SolidClip","text":"

vtk-examples/Python/Meshes/SolidClip

"},{"location":"Python/Meshes/SolidClip/#description","title":"Description","text":"

This example clips a mesh and applies a backface property to that mesh so that it appears to have a solid interior.

The \"ghost\" of the part clipped away is also shown.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Meshes/SolidClip/#code","title":"Code","text":"

SolidClip.py

# !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import vtkClipPolyData\nfrom vtkmodules.vtkFiltersSources import vtkSuperquadricSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Create a superquadric\n    superquadric_source = vtkSuperquadricSource()\n    superquadric_source.SetPhiRoundness(3.1)\n    superquadric_source.SetThetaRoundness(2.2)\n\n    # Define a clipping plane\n    clip_plane = vtkPlane()\n    clip_plane.SetNormal(1.0, -1.0, -1.0)\n    clip_plane.SetOrigin(0.0, 0.0, 0.0)\n\n    # Clip the source with the plane\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(superquadric_source.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    # This will give us the polygonal data that is clipped away\n    clipper.GenerateClippedOutputOn()\n\n    # Create a mapper and actor\n    superquadric_mapper = vtkPolyDataMapper()\n    superquadric_mapper.SetInputConnection(clipper.GetOutputPort())\n\n    superquadric_actor = vtkActor()\n    superquadric_actor.SetMapper(superquadric_mapper)\n\n    colors = vtkNamedColors()\n\n    # Create a property to be used for the back faces. Turn off all\n    # shading by specifying 0 weights for specular and diffuse. Max the\n    # ambient.\n    back_faces = vtkProperty()\n    back_faces.SetSpecular(0.0)\n    back_faces.SetDiffuse(0.0)\n    back_faces.SetAmbient(1.0)\n    back_faces.SetAmbientColor(colors.GetColor3d('Tomato'))\n\n    superquadric_actor.SetBackfaceProperty(back_faces)\n\n    # Here we get the the polygonal data that is clipped away\n    clipped_away_mapper = vtkPolyDataMapper()\n    clipped_away_mapper.SetInputData(clipper.GetClippedOutput())\n    clipped_away_mapper.ScalarVisibilityOff()\n\n    # Let us display it as a faint object\n    clipped_away_actor = vtkActor()\n    clipped_away_actor.SetMapper(clipped_away_mapper)\n    clipped_away_actor.GetProperty().SetDiffuseColor(colors.GetColor3d(\"Silver\"))\n    clipped_away_actor.GetProperty().SetOpacity(0.1)\n\n    # Create a renderer\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    render_window = vtkRenderWindow()\n\n    render_window.AddRenderer(renderer)\n\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    # Add the actor to the renderer\n    renderer.AddActor(superquadric_actor)\n    renderer.AddActor(clipped_away_actor)\n    render_window.SetSize(600, 600)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Dolly(1.5)\n    renderer.ResetCameraClippingRange()\n    render_window.Render()\n    render_window.SetWindowName('SolidClip')\n\n    # Interact with the window\n    render_window_interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/Bottle/","title":"Bottle","text":"

vtk-examples/Python/Modelling/Bottle

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/Bottle/#code","title":"Code","text":"

Bottle.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkStripper,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkRotationalExtrusionFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the bottle profile.\n    #\n    points = vtkPoints()\n    points.InsertPoint(0, 0.01, 0.0, 0.0)\n    points.InsertPoint(1, 1.5, 0.0, 0.0)\n    points.InsertPoint(2, 1.5, 0.0, 3.5)\n    points.InsertPoint(3, 1.25, 0.0, 3.75)\n    points.InsertPoint(4, 0.75, 0.0, 4.00)\n    points.InsertPoint(5, 0.6, 0.0, 4.35)\n    points.InsertPoint(6, 0.7, 0.0, 4.65)\n    points.InsertPoint(7, 1.0, 0.0, 4.75)\n    points.InsertPoint(8, 1.0, 0.0, 5.0)\n    points.InsertPoint(9, 0.2, 0.0, 5.0)\n\n    lines = vtkCellArray()\n    lines.InsertNextCell(10)  # The number of points.\n    lines.InsertCellPoint(0)\n    lines.InsertCellPoint(1)\n    lines.InsertCellPoint(2)\n    lines.InsertCellPoint(3)\n    lines.InsertCellPoint(4)\n    lines.InsertCellPoint(5)\n    lines.InsertCellPoint(6)\n    lines.InsertCellPoint(7)\n    lines.InsertCellPoint(8)\n    lines.InsertCellPoint(9)\n\n    profile = vtkPolyData()\n    profile.SetPoints(points)\n    profile.SetLines(lines)\n\n    # Extrude the profile to make the bottle.\n    #\n    extrude = vtkRotationalExtrusionFilter()\n    extrude.SetInputData(profile)\n    extrude.SetResolution(60)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(extrude.GetOutputPort())\n\n    bottle = vtkActor()\n    bottle.SetMapper(mapper)\n    bottle.GetProperty().SetColor(colors.GetColor3d('Mint'))\n\n    # Sisplay the profile.\n    stripper = vtkStripper()\n    stripper.SetInputData(profile)\n\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(stripper.GetOutputPort())\n    tubes.SetNumberOfSides(11)\n    tubes.SetRadius(0.05)\n\n    profileMapper = vtkPolyDataMapper()\n    profileMapper.SetInputConnection(tubes.GetOutputPort())\n\n    profileActor = vtkActor()\n    profileActor.SetMapper(profileMapper)\n    profileActor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    renderer.AddActor(bottle)\n    renderer.AddActor(profileActor)\n    renderer.SetBackground(colors.GetColor3d('Burlywood'))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('Bottle');\n    renWin.Render()\n\n    renderer.GetActiveCamera().SetPosition(1, 0, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/CappedSphere/","title":"CappedSphere","text":"

vtk-examples/Python/Modelling/CappedSphere

"},{"location":"Python/Modelling/CappedSphere/#description","title":"Description","text":"

Demonstrates how to create a capped sphere.

Firstly a line is created in the x-z plane corresponding to an arc from +z to -z in the +x direction in the x-z plane, the length of the arc is specified in degrees.

Then the line is extended by dropping a perpendicular to the x-axis.

The points generated are then converted to a line and passed through to the vtkRotationalExtrusionFilter to generate the resultant 3D surface.

The parameters are:

  • angle - the arc length in degrees default 90\u00b0 (a hemisphere)
  • step -the step size of the arc in degrees, default 1\u00b0
  • radius - the radius of the arc default 1

Options are provided to:

  • Uncap the sphere (-u, --uncapped)
  • Display the line that was rotationally extruded (-s, --show_line)

Note

The coordinate system for specifying the arc is left-handed with 0\u00b0 aligned with the positive z-axis, 90\u00b0 aligned with the positive x-axis.

Note

You can substitute different parametric equations for x and z in the line generating function to get other shapes.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/CappedSphere/#code","title":"Code","text":"

CappedSphere.py

#!/usr/bin/env python\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersModeling import vtkRotationalExtrusionFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Display a capped sphere.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('angle', default=90, type=float, nargs='?',\n                        help='The length of the arc in degrees from +z to -z in the +x direction in the x-z plane.')\n    parser.add_argument('step', default=1, type=float, nargs='?', help='Step size in degrees.')\n    parser.add_argument('radius', default=1, type=float, nargs='?', help='Radius of the arc.')\n    parser.add_argument('-u', '--uncapped', action='store_true', help='Uncap the sphere.')\n    parser.add_argument('-s', '--show_line', action='store_true',\n                        help='Show the line that is rotationally extruded to make the surface.')\n    args = parser.parse_args()\n    return args.angle, args.step, args.radius, args.uncapped, args.show_line\n\n\ndef main():\n    angle, step, radius, uncapped, show_line = get_program_parameters()\n    angle = math.radians(abs(angle))\n    step = math.radians(abs(step))\n    radius = abs(radius)\n    # With default settings set this to 45 and you get a bowl with a flat bottom.\n    start = math.radians(90)\n\n    pts = get_line(angle, step, radius, uncapped, start)\n\n    # Setup points and lines\n    points = vtkPoints()\n    lines = vtkCellArray()\n    for pt in pts:\n        pt_id = points.InsertNextPoint(pt)\n        if pt_id < len(pts) - 1:\n            line = vtkLine()\n            line.GetPointIds().SetId(0, pt_id)\n            line.GetPointIds().SetId(1, pt_id + 1)\n            lines.InsertNextCell(line)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n    polydata.SetLines(lines)\n\n    # Extrude the profile to make the capped sphere\n    extrude = vtkRotationalExtrusionFilter()\n    extrude.SetInputData(polydata)\n    extrude.SetResolution(60)\n\n    #  Visualize\n    colors = vtkNamedColors()\n\n    # To see the line\n    lineMapper = vtkPolyDataMapper()\n    lineMapper.SetInputData(polydata)\n\n    lineActor = vtkActor()\n    lineActor.SetMapper(lineMapper)\n    lineActor.GetProperty().SetLineWidth(4)\n    lineActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    # To see the surface\n    surfaceMapper = vtkPolyDataMapper()\n    surfaceMapper.SetInputConnection(extrude.GetOutputPort())\n\n    surfaceActor = vtkActor()\n    surfaceActor.SetMapper(surfaceMapper)\n    surfaceActor.GetProperty().SetColor(colors.GetColor3d('Khaki'))\n\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    ren.AddActor(surfaceActor)\n    if show_line:\n        ren.AddActor(lineActor)\n    ren.SetBackground(colors.GetColor3d('LightSlateGray'))\n\n    ren.ResetCamera()\n    ren.GetActiveCamera().Azimuth(0)\n    ren.GetActiveCamera().Elevation(60)\n    ren.ResetCameraClippingRange()\n\n    renWin.SetSize(600, 600)\n    renWin.Render()\n    renWin.SetWindowName('CappedSphere')\n    iren.Start()\n\n\ndef get_line(angle, step, radius, uncapped, start):\n    '''\n    Get the points for a line.\n\n    :param angle: Length of the arc in degrees.\n    :param step: Step size in degrees.\n    :param radius: Radius of the arc.\n    :param uncapped: True if uncapped.\n    :param start: Starting angle.\n    :return: A vector of points.\n    '''\n    precision = 1.0e-6\n    pts = list()\n    # Do the curved line\n    theta = 0.0\n    while theta <= angle:\n        x = radius * math.cos(start - theta)\n        z = radius * math.sin(theta - start)\n        if x < 0:\n            x = 0\n            pts.append((x, 0, z))\n            break\n        if abs(x) < precision:\n            x = 0\n        if abs(z) < precision:\n            z = 0\n        pts.append((x, 0, z))\n        theta += step\n\n    if not uncapped:\n        # Drop a perpendicular from the last point to the x-axis\n        if len(pts) > 1:\n            if pts[-1][0] > 0:\n                last_point = pts[-1]\n                num_pts = 10\n                interval = float(num_pts) / radius\n                for i in range(1, num_pts):\n                    x = last_point[0] - i / interval\n                    z = last_point[2]\n                    if x < 0:\n                        x = 0\n                        pts.append((x, 0, z))\n                        break\n                    if abs(x) < precision:\n                        x = 0\n                    if abs(z) < precision:\n                        z = 0\n                    pts.append((x, 0, z))\n            if pts[-1][0] > precision:\n                pts.append((0, 0, pts[-1][2]))\n    return pts\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/ContourTriangulator/","title":"ContourTriangulator","text":"

vtk-examples/Python/Modelling/ContourTriangulator

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/ContourTriangulator/#code","title":"Code","text":"

ContourTriangulator.py

#!/usr/bin/env python3\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkMarchingSquares\nfrom vtkmodules.vtkFiltersGeneral import vtkContourTriangulator\nfrom vtkmodules.vtkIOImage import vtkPNGReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Create a contour from a structured point set (image) and triangulate it.'\n    epilogue = '''\n    Try with different iso values e.g. -i1000.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('file_name', help='The path to the image file to use e.g fullhead15.png.')\n    parser.add_argument('-i', '--iso_value', help='The contour value for generating the isoline.', default=500,\n                        type=int)\n    args = parser.parse_args()\n    return args.file_name, args.iso_value\n\n\ndef main():\n    file_name, iso_value = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    reader = vtkPNGReader()\n    if not reader.CanReadFile(file_name):\n        print('Error: Could not read', file_name)\n        return\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    iso = vtkMarchingSquares()\n    iso.SetInputConnection(reader.GetOutputPort())\n    iso.SetValue(0, iso_value)\n\n    iso_mapper = vtkDataSetMapper()\n    iso_mapper.SetInputConnection(iso.GetOutputPort())\n    iso_mapper.ScalarVisibilityOff()\n\n    iso_actor = vtkActor()\n    iso_actor.SetMapper(iso_mapper)\n    iso_actor.GetProperty().SetColor(\n        colors.GetColor3d('MediumOrchid'))\n\n    poly = vtkContourTriangulator()\n    poly.SetInputConnection(iso.GetOutputPort())\n\n    poly_mapper = vtkDataSetMapper()\n    poly_mapper.SetInputConnection(poly.GetOutputPort())\n    poly_mapper.ScalarVisibilityOff()\n\n    poly_actor = vtkActor()\n    poly_actor.SetMapper(poly_mapper)\n    poly_actor.GetProperty().SetColor(colors.GetColor3d('Gray'))\n\n    # Standard rendering classes.\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.SetMultiSamples(0)\n    ren_win.AddRenderer(renderer)\n    ren_win.SetWindowName('ContourTriangulator')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    renderer.AddActor(poly_actor)\n    renderer.AddActor(iso_actor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    ren_win.SetSize(300, 300)\n\n    camera = renderer.GetActiveCamera()\n    renderer.ResetCamera()\n    camera.Azimuth(180)\n\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/DelaunayMesh/","title":"DelaunayMesh","text":"

vtk-examples/Python/Modelling/DelaunayMesh

"},{"location":"Python/Modelling/DelaunayMesh/#description","title":"Description","text":"

This is two dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with spheres and tubes.

Info

See Figure 9-54 in Chapter 9 The VTK Textbook.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/DelaunayMesh/#code","title":"Code","text":"

DelaunayMesh.py

#!/usr/bin/env python\n\n\"\"\"\nThis code is based on the VTK file: Examples/Modelling/Tcl/DelMesh.py.\n\nThis example demonstrates how to use 2D Delaunay triangulation.\nWe create a fancy image of a 2D Delaunay triangulation. Points are\n randomly generated.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDelaunay2D,\n    vtkGlyph3D,\n    vtkTubeFilter\n)\n\n# vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n# VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\ntry:\n    from vtkmodules.vtkFiltersCore import vtkExtractEdges\nexcept ImportError:\n    from vtkmodules.vtkFiltersExtraction import vtkExtractEdges\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Generate some \"random\" points.\n    points = vtkPoints()\n    randomSequence = vtkMinimalStandardRandomSequence()\n    randomSequence.SetSeed(1)\n    for i in range(0, 50):\n        p1 = randomSequence.GetValue()\n        randomSequence.Next()\n        p2 = randomSequence.GetValue()\n        randomSequence.Next()\n        points.InsertPoint(i, p1, p2, 0.0)\n\n    # Create a polydata with the points we just created.\n    profile = vtkPolyData()\n    profile.SetPoints(points)\n\n    # Perform a 2D Delaunay triangulation on them.\n    delny = vtkDelaunay2D()\n    delny.SetInputData(profile)\n    delny.SetTolerance(0.001)\n    mapMesh = vtkPolyDataMapper()\n    mapMesh.SetInputConnection(delny.GetOutputPort())\n    meshActor = vtkActor()\n    meshActor.SetMapper(mapMesh)\n    meshActor.GetProperty().SetColor(colors.GetColor3d('MidnightBlue'))\n\n    # We will now create a nice looking mesh by wrapping the edges in tubes,\n    # and putting fat spheres at the points.\n    extract = vtkExtractEdges()\n    extract.SetInputConnection(delny.GetOutputPort())\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(extract.GetOutputPort())\n    tubes.SetRadius(0.01)\n    tubes.SetNumberOfSides(6)\n    mapEdges = vtkPolyDataMapper()\n    mapEdges.SetInputConnection(tubes.GetOutputPort())\n    edgeActor = vtkActor()\n    edgeActor.SetMapper(mapEdges)\n    edgeActor.GetProperty().SetColor(colors.GetColor3d('peacock'))\n    edgeActor.GetProperty().SetSpecularColor(1, 1, 1)\n    edgeActor.GetProperty().SetSpecular(0.3)\n    edgeActor.GetProperty().SetSpecularPower(20)\n    edgeActor.GetProperty().SetAmbient(0.2)\n    edgeActor.GetProperty().SetDiffuse(0.8)\n\n    ball = vtkSphereSource()\n    ball.SetRadius(0.025)\n    ball.SetThetaResolution(12)\n    ball.SetPhiResolution(12)\n    balls = vtkGlyph3D()\n    balls.SetInputConnection(delny.GetOutputPort())\n    balls.SetSourceConnection(ball.GetOutputPort())\n    mapBalls = vtkPolyDataMapper()\n    mapBalls.SetInputConnection(balls.GetOutputPort())\n    ballActor = vtkActor()\n    ballActor.SetMapper(mapBalls)\n    ballActor.GetProperty().SetColor(colors.GetColor3d('hot_pink'))\n    ballActor.GetProperty().SetSpecularColor(1, 1, 1)\n    ballActor.GetProperty().SetSpecular(0.3)\n    ballActor.GetProperty().SetSpecularPower(20)\n    ballActor.GetProperty().SetAmbient(0.2)\n    ballActor.GetProperty().SetDiffuse(0.8)\n\n    # Create the rendering window, renderer, and interactive renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(ballActor)\n    ren.AddActor(edgeActor)\n    ren.SetBackground(colors.GetColor3d('AliceBlue'))\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('DelaunayMesh')\n\n    ren.ResetCamera()\n    ren.GetActiveCamera().Zoom(1.3)\n\n    # Interact with the data.\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/DiscreteMarchingCubes/","title":"DiscreteMarchingCubes","text":"

vtk-examples/Python/Modelling/DiscreteMarchingCubes

"},{"location":"Python/Modelling/DiscreteMarchingCubes/#description","title":"Description","text":"

Creates surfaces from labeled data. Volume data does not always contain samples of continuous data. A volume may contain discrete integer values, often the result of segmentation. vtkDiscreteFlyingEdges3D or vtkDiscreteMarchingCubes create surfaces from these segmented volumes using a modified flying edges or marching cubes algorithm. The algorithm generates one or more models representing the boundaries between the specified label and the adjacent structures. One or more label values must be specified to generate the models. The boundary positions are always defined to be half-way between adjacent voxels.

Seealso

SmoothDiscreteMarchingCubes produces smooth models.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/DiscreteMarchingCubes/#code","title":"Code","text":"

DiscreteMarchingCubes.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkLookupTable,\n    vtkMinimalStandardRandomSequence,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkImageData,\n    vtkSphere\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkDiscreteFlyingEdges3D,\n    vtkDiscreteMarchingCubes\n)\nfrom vtkmodules.vtkImagingCore import vtkImageThreshold\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkDiscreteFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    n = 20\n    radius = 8\n    blob = make_blob(n, radius)\n\n    if use_flying_edges:\n        try:\n            discrete = vtkDiscreteFlyingEdges3D()\n        except AttributeError:\n            discrete = vtkDiscreteMarchingCubes()\n    else:\n        discrete = vtkDiscreteMarchingCubes()\n    discrete.SetInputData(blob)\n    discrete.GenerateValues(n, 1, n)\n\n    lut = make_colors(n)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(discrete.GetOutputPort())\n    mapper.SetLookupTable(lut)\n    mapper.SetScalarRange(0, lut.GetNumberOfColors())\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetWindowName('DiscreteMarchingCubes')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    ren.AddActor(actor)\n\n    colors = vtkNamedColors()\n    ren.SetBackground(colors.GetColor3d('Burlywood'))\n\n    ren_win.Render()\n\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef make_blob(n, radius):\n    blob_image = vtkImageData()\n\n    max_r = 50 - 2.0 * radius\n    random_sequence = vtkMinimalStandardRandomSequence()\n    random_sequence.SetSeed(5071)\n    for i in range(0, n):\n\n        sphere = vtkSphere()\n        sphere.SetRadius(radius)\n\n        x = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n        y = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n        z = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n\n        sphere.SetCenter(int(x), int(y), int(z))\n\n        sampler = vtkSampleFunction()\n        sampler.SetImplicitFunction(sphere)\n        sampler.SetOutputScalarTypeToFloat()\n        sampler.SetSampleDimensions(100, 100, 100)\n        sampler.SetModelBounds(-50, 50, -50, 50, -50, 50)\n\n        thres = vtkImageThreshold()\n        thres.SetInputConnection(sampler.GetOutputPort())\n        thres.ThresholdByLower(radius * radius)\n        thres.ReplaceInOn()\n        thres.ReplaceOutOn()\n        thres.SetInValue(i + 1)\n        thres.SetOutValue(0)\n        thres.Update()\n        if i == 0:\n            blob_image.DeepCopy(thres.GetOutput())\n\n        max_value = vtkImageMathematics()\n        max_value.SetInputData(0, blob_image)\n        max_value.SetInputData(1, thres.GetOutput())\n        max_value.SetOperationToMax()\n        max_value.Modified()\n        max_value.Update()\n\n        blob_image.DeepCopy(max_value.GetOutput())\n\n    return blob_image\n\n\ndef make_colors(n):\n    \"\"\"\n    Generate some random colors\n    :param n: The number of colors.\n    :return: The lookup table.\n    \"\"\"\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(n)\n    lut.SetTableRange(0, n - 1)\n    lut.SetScaleToLinear()\n    lut.Build()\n    lut.SetTableValue(0, 0, 0, 0, 1)\n\n    random_sequence = vtkMinimalStandardRandomSequence()\n    random_sequence.SetSeed(5071)\n    for i in range(1, n):\n        r = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        g = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        b = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        lut.SetTableValue(i, r, g, b, 1.0)\n\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/ExtractLargestIsosurface/","title":"ExtractLargestIsosurface","text":"

vtk-examples/Python/Modelling/ExtractLargestIsosurface

"},{"location":"Python/Modelling/ExtractLargestIsosurface/#description","title":"Description","text":"
  • Contributed by: Jinyoung Hwang

This example reads a structured points dataset stored in a .vtk file and constructs a 3D model using vtkFlyingEdges3D or vtkMarchingCubes, vtkPolyDataConnectivityFilter is used to extract the largest isosurface.

Data is available at:

  1. test.vtk: http://web.kaist.ac.kr/~hjy/test.vtk

  2. brainweb.img: http://web.kaist.ac.kr/~hjy/brainweb.img

  3. brainweb.hdr: http://web.kaist.ac.kr/~hjy/brainweb.hdr

Second and third datasets can be downloaded from BrainWeb, which is free of charge in use for a research. \"test.vtk\" was converted from \"brainweb.img\" using a program by Erik Vidholm (http://www.cb.uu.se/~erik/vtk/rawToVTK.cpp).

The examples expects 2 or 3 argments:

 ExtractLargestIsosurface InputFilename Threshold (ExtractLargest)\n

if ExtractLargest is omitted or 1, the largest isosurface is extracted

if ExtractLargest is 0 (or -a in Python), all of the isosurfaces are extracted

Try

ExtractLargestIsosurface test.vtk 50

and compare the results to

ExtractLargestIsosurface test.vtk 50 0

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/ExtractLargestIsosurface/#code","title":"Code","text":"

ExtractLargestIsosurface.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkPolyDataConnectivityFilter\n)\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    colors.SetColor('SkinColor', [240, 184, 160, 255])\n    colors.SetColor('BackfaceColor', [255, 229, 200, 255])\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    file_name, threshold, largest_surface = get_program_parameters()\n\n    # Load data\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(file_name)\n\n    # Create a 3D model using flying edges or marching cubes\n    if use_flying_edges:\n        try:\n            mc = vtkFlyingEdges3D()\n        except AttributeError:\n            mc = vtkMarchingCubes()\n    else:\n        mc = vtkMarchingCubes()\n\n    mc.SetInputConnection(reader.GetOutputPort())\n    mc.ComputeNormalsOn()\n    mc.ComputeGradientsOn()\n    mc.SetValue(0, threshold)  # second value acts as threshold\n\n    # To remain largest region\n    confilter = vtkPolyDataConnectivityFilter()\n    confilter.SetInputConnection(mc.GetOutputPort())\n    confilter.SetExtractionModeToLargestRegion()\n\n    # Create a mapper\n    mapper = vtkPolyDataMapper()\n    if largest_surface:\n        mapper.SetInputConnection(confilter.GetOutputPort())\n    else:\n        mapper.SetInputConnection(mc.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Visualize\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('SkinColor'))\n    back_prop = vtkProperty()\n    back_prop.SetDiffuseColor(colors.GetColor3d('BackfaceColor'))\n    actor.SetBackfaceProperty(back_prop)\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderer.GetActiveCamera().SetViewUp(0.0, 0.0, 1.0)\n    renderer.GetActiveCamera().SetPosition(0.0, 1.0, 0.0)\n    renderer.GetActiveCamera().SetFocalPoint(0.0, 0.0, 0.0)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.GetActiveCamera().Elevation(30.0)\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('ExtractLargestIsosurface')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Reads a structured points dataset stored in a .vtk file and constructs a 3D model.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='E.g. brain.vtk.')\n    parser.add_argument('threshold', type=int, help='The threshold, e.g. 50.')\n    parser.add_argument('-a', action='store_false', default=True, help='Extract all surfaces.')\n    args = parser.parse_args()\n    return args.filename, args.threshold, args.a\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/Finance/","title":"Finance","text":"

vtk-examples/Python/Modelling/Finance

"},{"location":"Python/Modelling/Finance/#description","title":"Description","text":"

The first step is to choose dependent and independent variables. This choice is essentially a mapping from multidimensional data into an unstructured point dataset. This example chooses MONTHLY_PAYMENT, INTEREST_RATE, and LOAN_AMOUNT as (x, y, z) point coordinates, and TIME_LATE as a scalar value. This maps four of six variables. For now we will ignore the other two variables.

The example uses vtkGaussianSplatter to perform the splatting operation (i.e., conversion from unstructured points to volume dataset). This is followed by an isosurface extraction. We splat the data two times. The first time we splat the entire population. This is to show context and appears as gray/ wireframe in the figure. The second time we splat the data and scale it by the value of TIME_LATE . As a result, only payments that are late contribute to the second isosurface. The results of this visualization are interesting. First, we see that there is a strong correlation between the two independent variables MONTHLY_PAYMENT and LOAN_AMOUNT . (This is more evident when viewing the data interactively.) We see that the data falls roughly on a plane at a 45 degree angle between these two axes. With a little reflection this is evident: the monthly payment is strongly a function of loan amount (as well as interest rate and payment period). Second, we see that there is a clustering of delinquent accounts within the total population. The cluster tends to grow with larger interest rates and shrink with smaller monthly payments and loan amounts. Although the relationship with interest rate is expected, the clustering towards smaller monthly payments is not. Thus our visualization has provided a clue into the data. Further exploration may reveal the reason(s), or we may perform additional data analysis and acquisition to understand the phenomena.

One important note about multidimensional visualization. Because we tend to combine variables in odd ways (e.g., the use of MONTHLY_PAYMENT , INTEREST_RATE , and LOAN_AMOUNT as (x, y, z) coordinates), normalization of the data is usually required. To normalize data we simply adjust data values to lie between (0,1). Otherwise our data can be badly skewed and result in poor visualizations.

Info

See Figure 9-50 in Chapter 9 The VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/Finance/#code","title":"Code","text":"

Finance.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkAxes\nfrom vtkmodules.vtkImagingHybrid import vtkGaussianSplatter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    colors.SetColor('PopColor', [230, 230, 230, 255])\n\n    fileName = get_program_parameters()\n\n    keys = ['NUMBER_POINTS', 'MONTHLY_PAYMENT', 'INTEREST_RATE', 'LOAN_AMOUNT', 'TIME_LATE']\n\n    # Read in the data and make an unstructured data set.\n    dataSet = make_dataset(fileName, keys)\n\n    # Construct the pipeline for the original population.\n    popSplatter = vtkGaussianSplatter()\n    popSplatter.SetInputData(dataSet)\n    popSplatter.SetSampleDimensions(100, 100, 100)\n    popSplatter.SetRadius(0.05)\n    popSplatter.ScalarWarpingOff()\n\n    popSurface = vtkContourFilter()\n    popSurface.SetInputConnection(popSplatter.GetOutputPort())\n    popSurface.SetValue(0, 0.01)\n\n    popMapper = vtkPolyDataMapper()\n    popMapper.SetInputConnection(popSurface.GetOutputPort())\n    popMapper.ScalarVisibilityOff()\n\n    popActor = vtkActor()\n    popActor.SetMapper(popMapper)\n    popActor.GetProperty().SetOpacity(0.3)\n    popActor.GetProperty().SetColor(colors.GetColor3d('PopColor'))\n\n    # Construct the pipeline for the delinquent population.\n    lateSplatter = vtkGaussianSplatter()\n    lateSplatter.SetInputData(dataSet)\n    lateSplatter.SetSampleDimensions(50, 50, 50)\n    lateSplatter.SetRadius(0.05)\n    lateSplatter.SetScaleFactor(0.005)\n\n    lateSurface = vtkContourFilter()\n    lateSurface.SetInputConnection(lateSplatter.GetOutputPort())\n    lateSurface.SetValue(0, 0.01)\n\n    lateMapper = vtkPolyDataMapper()\n    lateMapper.SetInputConnection(lateSurface.GetOutputPort())\n    lateMapper.ScalarVisibilityOff()\n\n    lateActor = vtkActor()\n    lateActor.SetMapper(lateMapper)\n    lateActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    # Create axes.\n    popSplatter.Update()\n    bounds = popSplatter.GetOutput().GetBounds()\n\n    axes = vtkAxes()\n    axes.SetOrigin(bounds[0], bounds[2], bounds[4])\n    axes.SetScaleFactor(popSplatter.GetOutput().GetLength() / 5)\n\n    axesTubes = vtkTubeFilter()\n    axesTubes.SetInputConnection(axes.GetOutputPort())\n    axesTubes.SetRadius(axes.GetScaleFactor() / 25.0)\n    axesTubes.SetNumberOfSides(6)\n\n    axesMapper = vtkPolyDataMapper()\n    axesMapper.SetInputConnection(axesTubes.GetOutputPort())\n\n    axesActor = vtkActor()\n    axesActor.SetMapper(axesMapper)\n\n    # Graphics stuff.\n    renderer = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renWin)\n\n    # Set up the renderer.\n    renderer.AddActor(lateActor)\n    renderer.AddActor(axesActor)\n    renderer.AddActor(popActor)\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('Finance')\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Dolly(1.3)\n    renderer.ResetCameraClippingRange()\n\n    # Interact with the data.\n    renWin.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Visualization of multidimensional financial data.'\n    epilogue = '''\n    The gray/wireframe surface represents the total data population.\n    The red surface represents data points delinquent on loan payment.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='financial.txt.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef normalise(maximum, minimum, x):\n    return minimum + x / (maximum - minimum)\n\n\ndef read_file(filename):\n    '''\n    Read in the data set.\n    :param filename:\n    :return:\n    '''\n    res = dict()\n\n    with open(filename) as ifn:\n        k = ''\n        v = list()\n        for line in ifn:\n            cl = ' '.join(line.split()).split()  # Clean the line.\n            if cl:\n                if len(cl) == 2 and cl[0] == 'NUMBER_POINTS':\n                    k = cl[0]\n                    v = [int(cl[1])]\n                    has_key = True\n                    continue\n                if len(cl) == 1 and not has_key:\n                    has_key = True\n                    k = cl[0]\n                    v = list()\n                else:\n                    v += map(float, cl)\n            else:\n                if has_key:\n                    # Normalise the data.\n                    minimum = min(v)\n                    maximum = max(v)\n                    # Emulate the bug in the C++ code.\n                    for i in v:\n                        if i > minimum:\n                            maximum = i\n                    if maximum != minimum:\n                        res[k] = list(map(lambda x: minimum + x / (maximum - minimum), v))\n                    else:\n                        res[k] = v\n                    has_key = False\n    return res\n\n\ndef make_dataset(filename, keys):\n    res = read_file(filename)\n    if res:\n        newPts = vtkPoints()\n        newScalars = vtkFloatArray()\n        xyz = list(zip(res[keys[1]], res[keys[2]], res[keys[3]]))\n        for i in range(0, res[keys[0]][0]):\n            # print(xyz[i])\n            newPts.InsertPoint(i, xyz[i])\n            newScalars.InsertValue(i, res[keys[4]][i])\n\n        dataset = vtkUnstructuredGrid()\n        dataset.SetPoints(newPts)\n        dataset.GetPointData().SetScalars(newScalars)\n        return dataset\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/FinanceFieldData/","title":"FinanceFieldData","text":"

vtk-examples/Python/Modelling/FinanceFieldData

"},{"location":"Python/Modelling/FinanceFieldData/#description","title":"Description","text":"

This example is similar to Finance, but here we read a .vtk file with vtkDataObjectReader. The file is: src/Testing/Data/financial.vtk.

The generated image is Figure 5 in VTKFileFormats.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/FinanceFieldData/#code","title":"Code","text":"

FinanceFieldData.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDataObjectToDataSetFilter,\n    vtkFieldDataToAttributeDataFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkAxes,\n    vtkMarchingContourFilter\n)\nfrom vtkmodules.vtkIOLegacy import vtkDataObjectReader\nfrom vtkmodules.vtkImagingHybrid import vtkGaussianSplatter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkFollower,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    ifn = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    reader = vtkDataObjectReader()\n    reader.SetFileName(ifn)\n\n    size = 3187  # maximum number possible\n\n    xAxis = 'INTEREST_RATE'\n    yAxis = 'MONTHLY_PAYMENT'\n    zAxis = 'MONTHLY_INCOME'\n    scalar = 'TIME_LATE'\n\n    # Extract data from field as a polydata (just points), then extract scalars.\n    do2ds = vtkDataObjectToDataSetFilter()\n    do2ds.SetInputConnection(reader.GetOutputPort())\n    do2ds.SetDataSetTypeToPolyData()\n    # format: component#, arrayname, arraycomp, minArrayId, maxArrayId, normalize\n    do2ds.DefaultNormalizeOn()\n    do2ds.SetPointComponent(0, xAxis, 0)\n    do2ds.SetPointComponent(1, yAxis, 0, 0, size, 1)\n    do2ds.SetPointComponent(2, zAxis, 0)\n    do2ds.Update()\n    fd2ad = vtkFieldDataToAttributeDataFilter()\n    fd2ad.SetInputConnection(do2ds.GetOutputPort())\n    fd2ad.SetInputFieldToDataObjectField()\n    fd2ad.SetOutputAttributeDataToPointData()\n    fd2ad.DefaultNormalizeOn()\n    fd2ad.SetScalarComponent(0, scalar, 0)\n\n    # Construct the pipeline for the original population.\n    popSplatter = vtkGaussianSplatter()\n    popSplatter.SetInputConnection(fd2ad.GetOutputPort())\n    popSplatter.SetSampleDimensions(150, 150, 150)\n    popSplatter.SetRadius(0.05)\n    popSplatter.ScalarWarpingOff()\n\n    popSurface = vtkMarchingContourFilter()\n    popSurface.SetInputConnection(popSplatter.GetOutputPort())\n    popSurface.SetValue(0, 0.01)\n    popMapper = vtkPolyDataMapper()\n    popMapper.SetInputConnection(popSurface.GetOutputPort())\n    popMapper.ScalarVisibilityOff()\n    popActor = vtkActor()\n    popActor.SetMapper(popMapper)\n    popActor.GetProperty().SetOpacity(0.3)\n    popActor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    # Construct the pipeline for the delinquent population.\n    lateSplatter = vtkGaussianSplatter()\n    lateSplatter.SetInputConnection(fd2ad.GetOutputPort())\n    lateSplatter.SetSampleDimensions(150, 150, 150)\n    lateSplatter.SetRadius(0.05)\n    lateSplatter.SetScaleFactor(0.05)\n\n    lateSurface = vtkMarchingContourFilter()\n    lateSurface.SetInputConnection(lateSplatter.GetOutputPort())\n    lateSurface.SetValue(0, 0.01)\n    lateMapper = vtkPolyDataMapper()\n    lateMapper.SetInputConnection(lateSurface.GetOutputPort())\n    lateMapper.ScalarVisibilityOff()\n    lateActor = vtkActor()\n    lateActor.SetMapper(lateMapper)\n    lateActor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n    # Create the axes.\n    popSplatter.Update()\n    bounds = popSplatter.GetOutput().GetBounds()\n    axes = vtkAxes()\n    axes.SetOrigin(bounds[0], bounds[2], bounds[4])\n    axes.SetScaleFactor(popSplatter.GetOutput().GetLength() / 5.0)\n    axesTubes = vtkTubeFilter()\n    axesTubes.SetInputConnection(axes.GetOutputPort())\n    axesTubes.SetRadius(axes.GetScaleFactor() / 25.0)\n    axesTubes.SetNumberOfSides(6)\n    axesMapper = vtkPolyDataMapper()\n    axesMapper.SetInputConnection(axesTubes.GetOutputPort())\n    axesActor = vtkActor()\n    axesActor.SetMapper(axesMapper)\n\n    # Label the axes.\n    XText = vtkVectorText()\n    XText.SetText(xAxis)\n    XTextMapper = vtkPolyDataMapper()\n    XTextMapper.SetInputConnection(XText.GetOutputPort())\n\n    XActor = vtkFollower()\n    XActor.SetMapper(XTextMapper)\n    XActor.SetScale(0.02, .02, .02)\n    XActor.SetPosition(0.35, -0.05, -0.05)\n    XActor.GetProperty().SetColor(0, 0, 0)\n\n    YText = vtkVectorText()\n    YText.SetText(yAxis)\n\n    YTextMapper = vtkPolyDataMapper()\n    YTextMapper.SetInputConnection(YText.GetOutputPort())\n    YActor = vtkFollower()\n    YActor.SetMapper(YTextMapper)\n    YActor.SetScale(0.02, .02, .02)\n    YActor.SetPosition(-0.05, 0.35, -0.05)\n    YActor.GetProperty().SetColor(0, 0, 0)\n\n    ZText = vtkVectorText()\n    ZText.SetText(zAxis)\n    ZTextMapper = vtkPolyDataMapper()\n    ZTextMapper.SetInputConnection(ZText.GetOutputPort())\n    ZActor = vtkFollower()\n    ZActor.SetMapper(ZTextMapper)\n    ZActor.SetScale(0.02, .02, .02)\n    ZActor.SetPosition(-0.05, -0.05, 0.35)\n    ZActor.GetProperty().SetColor(0, 0, 0)\n\n    # Graphics stuff.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('FinanceFieldData')\n\n    # Add the actors to the renderer, set the background and size.\n    renderer.AddActor(axesActor)\n    renderer.AddActor(lateActor)\n    renderer.AddActor(XActor)\n    renderer.AddActor(YActor)\n    renderer.AddActor(ZActor)\n    renderer.AddActor(popActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderWindow.SetSize(650, 480)\n\n    camera = vtkCamera()\n    camera.SetClippingRange(.274, 13.72)\n    camera.SetFocalPoint(0.433816, 0.333131, 0.449)\n    camera.SetPosition(-1.96987, 1.15145, 1.49053)\n    camera.SetViewUp(0.378927, 0.911821, 0.158107)\n    renderer.SetActiveCamera(camera)\n    XActor.SetCamera(camera)\n    YActor.SetCamera(camera)\n    ZActor.SetCamera(camera)\n\n    # Render and interact with the data.\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Visualization of multidimensional financial data.'\n    epilogue = '''\n    This example is similar to /Python/Modelling/Finance.py, but here we read a .vtk file with vtkDataObjectReader.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('filename', help='financial.')\n\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/MarchingCubes/","title":"MarchingCubes","text":"

vtk-examples/Python/Modelling/MarchingCubes

"},{"location":"Python/Modelling/MarchingCubes/#description","title":"Description","text":"

Creates a surface from a volume using Flying Edges or Marching Cubes.

Without arguments, the examples generates a voxelized sphere with vtkVoxelModeller.

Note

vtkVoxelModeller by default produces a VTK_BIT scalar image. Marching Cubes does not support this type. The scalar output is set to float for this example.

To generate a surface from a DICOM series, provide a folder containing the series and specify an isovalue for the surface.

This Midas Repository contains a number of DICOM datasets.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/MarchingCubes/#code","title":"Code","text":"

MarchingCubes.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import vtkDICOMImageReader\nfrom vtkmodules.vtkImagingHybrid import vtkVoxelModeller\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    dicom_dir, iso_value = get_program_parameters()\n    if iso_value is None and dicom_dir is not None:\n        print('An ISO value is needed.')\n        return ()\n\n    volume = vtkImageData()\n    if dicom_dir is None:\n        sphere_source = vtkSphereSource()\n        sphere_source.SetPhiResolution(20)\n        sphere_source.SetThetaResolution(20)\n        sphere_source.Update()\n\n        bounds = list(sphere_source.GetOutput().GetBounds())\n        for i in range(0, 6, 2):\n            dist = bounds[i + 1] - bounds[i]\n            bounds[i] = bounds[i] - 0.1 * dist\n            bounds[i + 1] = bounds[i + 1] + 0.1 * dist\n        voxel_modeller = vtkVoxelModeller()\n        voxel_modeller.SetSampleDimensions(50, 50, 50)\n        voxel_modeller.SetModelBounds(bounds)\n        voxel_modeller.SetScalarTypeToFloat()\n        voxel_modeller.SetMaximumDistance(0.1)\n\n        voxel_modeller.SetInputConnection(sphere_source.GetOutputPort())\n        voxel_modeller.Update()\n        iso_value = 0.5\n        volume.DeepCopy(voxel_modeller.GetOutput())\n    else:\n        reader = vtkDICOMImageReader()\n        reader.SetDirectoryName(dicom_dir)\n        reader.Update()\n        volume.DeepCopy(reader.GetOutput())\n\n    if use_flying_edges:\n        try:\n            surface = vtkFlyingEdges3D()\n        except AttributeError:\n            surface = vtkMarchingCubes()\n    else:\n        surface = vtkMarchingCubes()\n    surface.SetInputData(volume)\n    surface.ComputeNormalsOn()\n    surface.SetValue(0, iso_value)\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetWindowName('MarchingCubes')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    renderer.AddActor(actor)\n\n    render_window.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The skin extracted from a CT dataset of the head.'\n    epilogue = '''\n    Derived from VTK/Examples/Cxx/Medical1.cxx\n    This example reads a volume dataset, extracts an isosurface that\n     represents the skin and displays it.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-d', default=None, help='A DICOM Image directory.')\n    parser.add_argument('-i', type=float, default=None, help='The iso value to use.')\n    args = parser.parse_args()\n    return args.d, args.i\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/SmoothDiscreteMarchingCubes/","title":"SmoothDiscreteMarchingCubes","text":"

vtk-examples/Python/Modelling/SmoothDiscreteMarchingCubes

"},{"location":"Python/Modelling/SmoothDiscreteMarchingCubes/#description","title":"Description","text":"

Creates surfaces from labeled data. Volume data does not always contain samples of continuous data. A volume may contain discrete integer values, often the result of segmentation. This example smooths the discrete models generated by vtkDiscreteMarchingCubes with vtkWindowedSincPolyDataFilter.

Seealso

DiscreteMarchingCubes produces rough models.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/SmoothDiscreteMarchingCubes/#code","title":"Code","text":"

SmoothDiscreteMarchingCubes.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkMinimalStandardRandomSequence\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkImageData,\n    vtkSphere\n)\nfrom vtkmodules.vtkFiltersCore import vtkWindowedSincPolyDataFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkDiscreteMarchingCubes\nfrom vtkmodules.vtkImagingCore import vtkImageThreshold\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    n = 20\n    radius = 8\n    blob = make_blob(n, radius)\n\n    discrete = vtkDiscreteMarchingCubes()\n    discrete.SetInputData(blob)\n    discrete.GenerateValues(n, 1, n)\n\n    smoothing_iterations = 15\n    pass_band = 0.001\n    feature_angle = 120.0\n\n    smoother = vtkWindowedSincPolyDataFilter()\n    smoother.SetInputConnection(discrete.GetOutputPort())\n    smoother.SetNumberOfIterations(smoothing_iterations)\n    smoother.BoundarySmoothingOff()\n    smoother.FeatureEdgeSmoothingOff()\n    smoother.SetFeatureAngle(feature_angle)\n    smoother.SetPassBand(pass_band)\n    smoother.NonManifoldSmoothingOn()\n    smoother.NormalizeCoordinatesOn()\n    smoother.Update()\n\n    lut = make_colors(n)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(smoother.GetOutputPort())\n    mapper.SetLookupTable(lut)\n    mapper.SetScalarRange(0, lut.GetNumberOfColors())\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetWindowName('SmoothDiscreteMarchingCubes')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    ren.AddActor(actor)\n\n    colors = vtkNamedColors()\n    ren.SetBackground(colors.GetColor3d('Burlywood'))\n\n    ren_win.Render()\n\n    iren.Start()\n\n\ndef make_blob(n, radius):\n    blob_image = vtkImageData()\n\n    max_r = 50 - 2.0 * radius\n    random_sequence = vtkMinimalStandardRandomSequence()\n    random_sequence.SetSeed(5071)\n    for i in range(0, n):\n\n        sphere = vtkSphere()\n        sphere.SetRadius(radius)\n\n        x = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n        y = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n        z = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n\n        sphere.SetCenter(int(x), int(y), int(z))\n\n        sampler = vtkSampleFunction()\n        sampler.SetImplicitFunction(sphere)\n        sampler.SetOutputScalarTypeToFloat()\n        sampler.SetSampleDimensions(100, 100, 100)\n        sampler.SetModelBounds(-50, 50, -50, 50, -50, 50)\n\n        thres = vtkImageThreshold()\n        thres.SetInputConnection(sampler.GetOutputPort())\n        thres.ThresholdByLower(radius * radius)\n        thres.ReplaceInOn()\n        thres.ReplaceOutOn()\n        thres.SetInValue(i + 1)\n        thres.SetOutValue(0)\n        thres.Update()\n        if i == 0:\n            blob_image.DeepCopy(thres.GetOutput())\n\n        max_value = vtkImageMathematics()\n        max_value.SetInputData(0, blob_image)\n        max_value.SetInputData(1, thres.GetOutput())\n        max_value.SetOperationToMax()\n        max_value.Modified()\n        max_value.Update()\n\n        blob_image.DeepCopy(max_value.GetOutput())\n\n    return blob_image\n\n\ndef make_colors(n):\n    \"\"\"\n    Generate some random colors\n    :param n: The number of colors.\n    :return: The lookup table.\n    \"\"\"\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(n)\n    lut.SetTableRange(0, n - 1)\n    lut.SetScaleToLinear()\n    lut.Build()\n    lut.SetTableValue(0, 0, 0, 0, 1)\n\n    random_sequence = vtkMinimalStandardRandomSequence()\n    random_sequence.SetSeed(5071)\n    for i in range(1, n):\n        r = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        g = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        b = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        lut.SetTableValue(i, r, g, b, 1.0)\n\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Modelling/Spring/","title":"Spring","text":"

vtk-examples/Python/Modelling/Spring

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Modelling/Spring/#code","title":"Code","text":"

Spring.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkFiltersModeling import vtkRotationalExtrusionFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the spring profile (a circle).\n    #\n    points = vtkPoints()\n    points.InsertPoint(0, 1.0, 0.0, 0.0)\n    points.InsertPoint(1, 1.0732, 0.0, -0.1768)\n    points.InsertPoint(2, 1.25, 0.0, -0.25)\n    points.InsertPoint(3, 1.4268, 0.0, -0.1768)\n    points.InsertPoint(4, 1.5, 0.0, 0.00)\n    points.InsertPoint(5, 1.4268, 0.0, 0.1768)\n    points.InsertPoint(6, 1.25, 0.0, 0.25)\n    points.InsertPoint(7, 1.0732, 0.0, 0.1768)\n\n    poly = vtkCellArray()\n    poly.InsertNextCell(8)  # The number of points.\n    poly.InsertCellPoint(0)\n    poly.InsertCellPoint(1)\n    poly.InsertCellPoint(2)\n    poly.InsertCellPoint(3)\n    poly.InsertCellPoint(4)\n    poly.InsertCellPoint(5)\n    poly.InsertCellPoint(6)\n    poly.InsertCellPoint(7)\n\n    profile = vtkPolyData()\n    profile.SetPoints(points)\n    profile.SetPolys(poly)\n\n    # Extrude the profile to make a spring.\n    #\n    extrude = vtkRotationalExtrusionFilter()\n    extrude.SetInputData(profile)\n    extrude.SetResolution(360)\n    extrude.SetTranslation(6)\n    extrude.SetDeltaRadius(1.0)\n    extrude.SetAngle(2160.0)  # six revolutions\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(extrude.GetOutputPort())\n    normals.SetFeatureAngle(60)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(normals.GetOutputPort())\n\n    spring = vtkActor()\n    spring.SetMapper(mapper)\n    spring.GetProperty().SetColor(colors.GetColor3d(\"PowderBlue\"))\n    spring.GetProperty().SetDiffuse(0.7)\n    spring.GetProperty().SetSpecular(0.4)\n    spring.GetProperty().SetSpecularPower(20)\n    spring.GetProperty().BackfaceCullingOn()\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    renderer.AddActor(spring)\n    renderer.SetBackground(colors.GetColor3d(\"Burlywood\"))\n    renWin.SetSize(640, 512)\n    renWin.SetWindowName('Spring')\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(90)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Picking/CellPicking/","title":"CellPicking","text":"

vtk-examples/Python/Picking/CellPicking

"},{"location":"Python/Picking/CellPicking/#description","title":"Description","text":"

This example demonstrates how to get the coordinates of the point on an actor that is clicked with the left mouse button. It also indicates which cell the selected point belongs to by highlighting the edges of that cell.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Picking/CellPicking/#code","title":"Code","text":"

CellPicking.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdTypeArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkSelection,\n    vtkSelectionNode,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkTriangleFilter\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractSelection\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCellPicker,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\n# Catch mouse events\nclass MouseInteractorStyle(vtkInteractorStyleTrackballCamera):\n    def __init__(self, data):\n        self.AddObserver('LeftButtonPressEvent', self.left_button_press_event)\n        self.data = data\n        self.selected_mapper = vtkDataSetMapper()\n        self.selected_actor = vtkActor()\n\n    def left_button_press_event(self, obj, event):\n        colors = vtkNamedColors()\n\n        # Get the location of the click (in window coordinates)\n        pos = self.GetInteractor().GetEventPosition()\n\n        picker = vtkCellPicker()\n        picker.SetTolerance(0.0005)\n\n        # Pick from this location.\n        picker.Pick(pos[0], pos[1], 0, self.GetDefaultRenderer())\n\n        world_position = picker.GetPickPosition()\n        print(f'Cell id is: {picker.GetCellId()}')\n\n        if picker.GetCellId() != -1:\n            print(f'Pick position is: ({world_position[0]:.6g}, {world_position[1]:.6g}, {world_position[2]:.6g})')\n\n            ids = vtkIdTypeArray()\n            ids.SetNumberOfComponents(1)\n            ids.InsertNextValue(picker.GetCellId())\n\n            selection_node = vtkSelectionNode()\n            selection_node.SetFieldType(vtkSelectionNode.CELL)\n            selection_node.SetContentType(vtkSelectionNode.INDICES)\n            selection_node.SetSelectionList(ids)\n\n            selection = vtkSelection()\n            selection.AddNode(selection_node)\n\n            extract_selection = vtkExtractSelection()\n            extract_selection.SetInputData(0, self.data)\n            extract_selection.SetInputData(1, selection)\n            extract_selection.Update()\n\n            # In selection\n            selected = vtkUnstructuredGrid()\n            selected.ShallowCopy(extract_selection.GetOutput())\n\n            print(f'Number of points in the selection: {selected.GetNumberOfPoints()}')\n            print(f'Number of cells in the selection : {selected.GetNumberOfCells()}')\n\n            self.selected_mapper.SetInputData(selected)\n            self.selected_actor.SetMapper(self.selected_mapper)\n            self.selected_actor.GetProperty().EdgeVisibilityOn()\n            self.selected_actor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n            self.selected_actor.GetProperty().SetLineWidth(3)\n\n            self.GetInteractor().GetRenderWindow().GetRenderers().GetFirstRenderer().AddActor(self.selected_actor)\n\n        # Forward events\n        self.OnLeftButtonDown()\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    plane_source = vtkPlaneSource()\n    plane_source.Update()\n\n    triangle_filter = vtkTriangleFilter()\n    triangle_filter.SetInputConnection(plane_source.GetOutputPort())\n    triangle_filter.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(triangle_filter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetWindowName('CellPicking')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    renderer.AddActor(actor)\n    # renderer.ResetCamera()\n    renderer.SetBackground(colors.GetColor3d('PaleTurquoise'))\n\n    # Add the custom style.\n    style = MouseInteractorStyle(triangle_filter.GetOutput())\n    style.SetDefaultRenderer(renderer)\n    iren.SetInteractorStyle(style)\n\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Picking/HighlightPickedActor/","title":"HighlightPickedActor","text":"

vtk-examples/Python/Picking/HighlightPickedActor

"},{"location":"Python/Picking/HighlightPickedActor/#description","title":"Description","text":"

Click on a sphere to highlight it. The picked sphere color changes to red, and its EdgeVisibity is On. The example subclasses vtkInteractorStyleTrackballCamera with a local class called MouseInteractorHighLightActor. The new interactor overrides the OnLeftButtonDown of vtkInteractorStyleTrackballCamera.

Seealso

HighlightWithSilhouette generates a silhouette of the picked actor.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Picking/HighlightPickedActor/#code","title":"Code","text":"

HighlightPickedActor.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkMinimalStandardRandomSequence\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropPicker,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\ncolors = vtkNamedColors()\nNUMBER_OF_SPHERES = 10\n\n\nclass MouseInteractorHighLightActor(vtkInteractorStyleTrackballCamera):\n\n    def __init__(self, parent=None):\n        self.AddObserver(\"LeftButtonPressEvent\", self.leftButtonPressEvent)\n\n        self.LastPickedActor = None\n        self.LastPickedProperty = vtkProperty()\n\n    def leftButtonPressEvent(self, obj, event):\n        clickPos = self.GetInteractor().GetEventPosition()\n\n        picker = vtkPropPicker()\n        picker.Pick(clickPos[0], clickPos[1], 0, self.GetDefaultRenderer())\n\n        # get the new\n        self.NewPickedActor = picker.GetActor()\n\n        # If something was selected\n        if self.NewPickedActor:\n            # If we picked something before, reset its property\n            if self.LastPickedActor:\n                self.LastPickedActor.GetProperty().DeepCopy(self.LastPickedProperty)\n\n            # Save the property of the picked actor so that we can\n            # restore it next time\n            self.LastPickedProperty.DeepCopy(self.NewPickedActor.GetProperty())\n            # Highlight the picked actor by changing its properties\n            self.NewPickedActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n            self.NewPickedActor.GetProperty().SetDiffuse(1.0)\n            self.NewPickedActor.GetProperty().SetSpecular(0.0)\n            self.NewPickedActor.GetProperty().EdgeVisibilityOn()\n\n            # save the last picked actor\n            self.LastPickedActor = self.NewPickedActor\n\n        self.OnLeftButtonDown()\n        return\n\n\ndef main():\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetSize(640, 480)\n    renwin.SetWindowName('HighlightPickedActor')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # add the custom style\n    style = MouseInteractorHighLightActor()\n    style.SetDefaultRenderer(renderer)\n    interactor.SetInteractorStyle(style)\n\n    randomSequence = vtkMinimalStandardRandomSequence()\n    # randomSequence.SetSeed(1043618065)\n    # randomSequence.SetSeed(5170)\n    randomSequence.SetSeed(8775070)\n    # Add spheres to play with\n    for i in range(NUMBER_OF_SPHERES):\n        source = vtkSphereSource()\n\n        # random position and radius\n        x = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        y = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        z = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        radius = randomSequence.GetRangeValue(0.5, 1.0)\n        randomSequence.Next()\n\n        source.SetRadius(radius)\n        source.SetCenter(x, y, z)\n        source.SetPhiResolution(11)\n        source.SetThetaResolution(21)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(source.GetOutputPort())\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        r = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n        g = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n        b = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n\n        actor.GetProperty().SetDiffuseColor(r, g, b)\n        actor.GetProperty().SetDiffuse(.8)\n        actor.GetProperty().SetSpecular(.5)\n        actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n        actor.GetProperty().SetSpecularPower(30.0)\n\n        renderer.AddActor(actor)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Picking/HighlightWithSilhouette/","title":"HighlightWithSilhouette","text":"

vtk-examples/Python/Picking/HighlightWithSilhouette

"},{"location":"Python/Picking/HighlightWithSilhouette/#description","title":"Description","text":"

Click on a sphere to highlight it. vtkPolyDataSilhoutte creates a silhouette of the picked vtkActor. The example subclasses vtkInteractorStyleTrackballCamera with a local class called MouseInteractorHighLightActor. The new interactor overrides the OnLeftButtonDown of vtkInteractorStyleTrackballCamera.

Watch this video showing the picking of several spheres.

Seealso

HighlightPickedActor C++ or Python where the color and edge visibility of the picked actor is changed.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Picking/HighlightWithSilhouette/#code","title":"Code","text":"

HighlightWithSilhouette.py

# !/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkMinimalStandardRandomSequence\nfrom vtkmodules.vtkFiltersHybrid import vtkPolyDataSilhouette\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropPicker,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Highlighting a selected object with a silhouette.'\n    epilogue = '''\nClick on the object to highlight it.\nThe selected object is highlighted with a silhouette.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('numberOfSpheres', nargs='?', type=int, default=10,\n                        help='The number of spheres, default is 10.')\n    args = parser.parse_args()\n    return args.numberOfSpheres\n\n\nclass MouseInteractorHighLightActor(vtkInteractorStyleTrackballCamera):\n\n    def __init__(self, silhouette=None, silhouetteActor=None):\n        self.AddObserver(\"LeftButtonPressEvent\", self.onLeftButtonDown)\n        self.LastPickedActor = None\n        self.Silhouette = silhouette\n        self.SilhouetteActor = silhouetteActor\n\n    def onLeftButtonDown(self, obj, event):\n        clickPos = self.GetInteractor().GetEventPosition()\n\n        #  Pick from this location.\n        picker = vtkPropPicker()\n        picker.Pick(clickPos[0], clickPos[1], 0, self.GetDefaultRenderer())\n        self.LastPickedActor = picker.GetActor()\n\n        # If we picked something before, remove the silhouette actor and\n        # generate a new one.\n        if self.LastPickedActor:\n            self.GetDefaultRenderer().RemoveActor(self.SilhouetteActor)\n\n            # Highlight the picked actor by generating a silhouette\n            self.Silhouette.SetInputData(self.LastPickedActor.GetMapper().GetInput())\n            self.GetDefaultRenderer().AddActor(self.SilhouetteActor)\n\n        #  Forward events\n        self.OnLeftButtonDown()\n        return\n\n    def SetSilhouette(self, silhouette):\n        self.Silhouette = silhouette\n\n    def SetSilhouetteActor(self, silhouetteActor):\n        self.SilhouetteActor = silhouetteActor\n\n\ndef main():\n    numberOfSpheres = get_program_parameters()\n    colors = vtkNamedColors()\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(640, 480)\n    renderWindow.AddRenderer(renderer)\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    randomSequence = vtkMinimalStandardRandomSequence()\n    # randomSequence.SetSeed(1043618065)\n    # randomSequence.SetSeed(5170)\n    randomSequence.SetSeed(8775070)\n    # Add spheres to play with\n    for i in range(numberOfSpheres):\n        source = vtkSphereSource()\n\n        # random position and radius\n        x = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        y = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        z = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        radius = randomSequence.GetRangeValue(0.5, 1.0)\n        randomSequence.Next()\n\n        source.SetRadius(radius)\n        source.SetCenter(x, y, z)\n        source.SetPhiResolution(11)\n        source.SetThetaResolution(21)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(source.GetOutputPort())\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        r = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n        g = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n        b = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n\n        actor.GetProperty().SetDiffuseColor(r, g, b)\n        actor.GetProperty().SetDiffuse(0.8)\n        actor.GetProperty().SetSpecular(0.5)\n        actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n        actor.GetProperty().SetSpecularPower(30.0)\n\n        renderer.AddActor(actor)\n\n    # Render and interact\n    renderWindow.Render()\n\n    # Create the silhouette pipeline, the input data will be set in the\n    # interactor\n    silhouette = vtkPolyDataSilhouette()\n    silhouette.SetCamera(renderer.GetActiveCamera())\n\n    # Create mapper and actor for silhouette\n    silhouetteMapper = vtkPolyDataMapper()\n    silhouetteMapper.SetInputConnection(silhouette.GetOutputPort())\n\n    silhouetteActor = vtkActor()\n    silhouetteActor.SetMapper(silhouetteMapper)\n    silhouetteActor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n    silhouetteActor.GetProperty().SetLineWidth(5)\n\n    # Set the custom type to use for interaction.\n    style = MouseInteractorHighLightActor(silhouette, silhouetteActor)\n    style.SetDefaultRenderer(renderer)\n\n    # Start\n    interactor.Initialize()\n    interactor.SetInteractorStyle(style)\n    renderWindow.SetWindowName('HighlightWithSilhouette')\n    renderWindow.Render()\n\n    interactor.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
"},{"location":"Python/Plotting/MultiplePlots/","title":"MultiplePlots","text":"

vtk-examples/Python/Plotting/MultiplePlots

"},{"location":"Python/Plotting/MultiplePlots/#description","title":"Description","text":"

Display multiple plots by using viewports in a single render window.

In this case, we display two graphs side-by-side.

The difference between setting a background in the renderer and setting the chart background is shown.

Note

This example was prompted by this discussion vtk chart background shifted towards origin.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Plotting/MultiplePlots/#code","title":"Code","text":"

MultiplePlots.py

import math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkChartsCore import (\n    vtkAxis,\n    vtkChart,\n    vtkChartXY,\n    vtkPlotPoints\n)\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import vtkTable\nfrom vtkmodules.vtkRenderingContext2D import (\n    vtkContextActor,\n    vtkContextScene\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renwin = vtkRenderWindow()\n    renwin.SetWindowName('MultiplePlots')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renwin)\n\n    # Setup the viewports\n    grid_dimensions_x = 2\n    grid_dimensions_y = 1\n    renderer_sz_x = 320\n    renderer_sz_y = 240\n    renwin.SetSize(renderer_sz_x * grid_dimensions_x, renderer_sz_y * grid_dimensions_y)\n\n    viewports = list()\n    for row in range(0, grid_dimensions_y):\n        for col in range(0, grid_dimensions_x):\n            # index = row * grid_dimensions_x + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewports.append([float(col) / grid_dimensions_x,\n                              float(grid_dimensions_y - (row + 1)) / grid_dimensions_y,\n                              float(col + 1) / grid_dimensions_x,\n                              float(grid_dimensions_y - row) / grid_dimensions_y])\n\n    # Link the renderers to the viewports.\n    left_renderer = vtkRenderer()\n    left_renderer.SetBackground(colors.GetColor3d('AliceBlue'))\n    left_renderer.SetViewport(viewports[0])\n    renwin.AddRenderer(left_renderer)\n\n    right_renderer = vtkRenderer()\n    right_renderer.SetBackground(colors.GetColor3d('Lavender'))\n    right_renderer.SetViewport(viewports[1])\n    renwin.AddRenderer(right_renderer)\n\n    # Create the charts.\n    left_chart = vtkChartXY()\n    left_chart_scene = vtkContextScene()\n    left_chart_actor = vtkContextActor()\n\n    left_chart_scene.AddItem(left_chart)\n    left_chart_actor.SetScene(left_chart_scene)\n\n    left_renderer.AddActor(left_chart_actor)\n    left_chart_scene.SetRenderer(left_renderer)\n\n    x_axis = left_chart.GetAxis(vtkAxis.BOTTOM)\n    x_axis.GetGridPen().SetColor(colors.GetColor4ub(\"LightGrey\"))\n    x_axis.SetTitle('x')\n    y_axis = left_chart.GetAxis(vtkAxis.LEFT)\n    y_axis.GetGridPen().SetColor(colors.GetColor4ub(\"LightGrey\"))\n    y_axis.SetTitle('cos(x)')\n    left_chart.GetBackgroundBrush().SetColorF(*colors.GetColor4d('MistyRose'))\n    left_chart.GetBackgroundBrush().SetOpacityF(0.4)\n    left_chart.SetTitle('Cosine')\n\n    right_chart = vtkChartXY()\n    right_chart_scene = vtkContextScene()\n    right_chart_actor = vtkContextActor()\n\n    right_chart_scene.AddItem(right_chart)\n    right_chart_actor.SetScene(right_chart_scene)\n\n    right_renderer.AddActor(right_chart_actor)\n    right_chart_scene.SetRenderer(right_renderer)\n\n    x_axis = right_chart.GetAxis(vtkAxis.BOTTOM)\n    x_axis.GetGridPen().SetColor(colors.GetColor4ub(\"LightCyan\"))\n    x_axis.SetTitle('x')\n    y_axis = right_chart.GetAxis(vtkAxis.LEFT)\n    y_axis.GetGridPen().SetColor(colors.GetColor4ub(\"LightCyan\"))\n    y_axis.SetTitle('sin(x)')\n    right_chart.GetBackgroundBrush().SetColorF(*colors.GetColor4d('Thistle'))\n    right_chart.GetBackgroundBrush().SetOpacityF(0.4)\n    right_chart.SetTitle('Sine')\n\n    # Create the data.\n    table = vtkTable()\n    array_x = vtkFloatArray()\n    array_x.SetName('X Axis')\n    table.AddColumn(array_x)\n\n    array_cos = vtkFloatArray()\n    array_cos.SetName('Cosine')\n    table.AddColumn(array_cos)\n\n    array_sin = vtkFloatArray()\n    array_sin.SetName('Sine')\n    table.AddColumn(array_sin)\n\n    # Fill in the table with some example values.\n    num_points = 40\n    inc = 7.5 / (num_points - 1.0)\n    table.SetNumberOfRows(num_points)\n    for i in range(num_points):\n        table.SetValue(i, 0, i * inc)\n        table.SetValue(i, 1, math.cos(i * inc))\n        table.SetValue(i, 2, math.sin(i * inc))\n\n    points = left_chart.AddPlot(vtkChart.POINTS)\n    points.SetInputData(table, 0, 1)\n    points.SetColor(*colors.GetColor4ub('Black'))\n    points.SetWidth(1.0)\n    points.SetMarkerStyle(vtkPlotPoints.CROSS)\n\n    points = right_chart.AddPlot(vtkChart.POINTS)\n    points.SetInputData(table, 0, 2)\n    points.SetColor(*colors.GetColor4ub('Black'))\n    points.SetWidth(1.0)\n    points.SetMarkerStyle(vtkPlotPoints.PLUS)\n\n    renwin.Render()\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Plotting/ScatterPlot/","title":"ScatterPlot","text":"

vtk-examples/Python/Plotting/ScatterPlot

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Plotting/ScatterPlot/#code","title":"Code","text":"

ScatterPlot.py

#!/usr/bin/env python\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkChartsCore import (\n    vtkChart,\n    vtkChartXY,\n    vtkPlotPoints\n)\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import vtkTable\nfrom vtkmodules.vtkViewsContext2D import vtkContextView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    view = vtkContextView()\n    view.GetRenderer().SetBackground(colors.GetColor3d('SlateGray'))\n    view.GetRenderWindow().SetSize(400, 300)\n\n    chart = vtkChartXY()\n    view.GetScene().AddItem(chart)\n    chart.SetShowLegend(True)\n\n    table = vtkTable()\n\n    arrX = vtkFloatArray()\n    arrX.SetName('X Axis')\n\n    arrC = vtkFloatArray()\n    arrC.SetName('Cosine')\n\n    arrS = vtkFloatArray()\n    arrS.SetName('Sine')\n\n    arrT = vtkFloatArray()\n    arrT.SetName('Sine-Cosine')\n\n    table.AddColumn(arrC)\n    table.AddColumn(arrS)\n    table.AddColumn(arrX)\n    table.AddColumn(arrT)\n\n    numPoints = 40\n\n    inc = 7.5 / (numPoints - 1)\n    table.SetNumberOfRows(numPoints)\n    for i in range(numPoints):\n        table.SetValue(i, 0, i * inc)\n        table.SetValue(i, 1, math.cos(i * inc))\n        table.SetValue(i, 2, math.sin(i * inc))\n        table.SetValue(i, 3, math.sin(i * inc) - math.cos(i * inc))\n\n    points = chart.AddPlot(vtkChart.POINTS)\n    points.SetInputData(table, 0, 1)\n    points.SetColor(0, 0, 0, 255)\n    points.SetWidth(1.0)\n    points.SetMarkerStyle(vtkPlotPoints.CROSS)\n\n    points = chart.AddPlot(vtkChart.POINTS)\n    points.SetInputData(table, 0, 2)\n    points.SetColor(0, 0, 0, 255)\n    points.SetWidth(1.0)\n    points.SetMarkerStyle(vtkPlotPoints.PLUS)\n\n    points = chart.AddPlot(vtkChart.POINTS)\n    points.SetInputData(table, 0, 3)\n    points.SetColor(0, 0, 255, 255)\n    points.SetWidth(1.0)\n    points.SetMarkerStyle(vtkPlotPoints.CIRCLE)\n\n    view.GetRenderWindow().SetMultiSamples(0)\n    view.GetRenderWindow().SetWindowName('ScatterPlot')\n    view.GetInteractor().Initialize()\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Plotting/SpiderPlot/","title":"SpiderPlot","text":"

vtk-examples/Python/Plotting/SpiderPlot

"},{"location":"Python/Plotting/SpiderPlot/#description","title":"Description","text":"

A spider plot is used to display multivariate data. See this wikipedia article for more information.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Plotting/SpiderPlot/#code","title":"Code","text":"

SpiderPlot.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkMinimalStandardRandomSequence\n)\nfrom vtkmodules.vtkCommonDataModel import vtkDataObject\nfrom vtkmodules.vtkRenderingAnnotation import vtkSpiderPlotActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    numTuples = 12\n\n    bitter = vtkFloatArray()\n    bitter.SetNumberOfTuples(numTuples)\n\n    crispy = vtkFloatArray()\n    crispy.SetNumberOfTuples(numTuples)\n\n    crunchy = vtkFloatArray()\n    crunchy.SetNumberOfTuples(numTuples)\n\n    salty = vtkFloatArray()\n    salty.SetNumberOfTuples(numTuples)\n\n    oily = vtkFloatArray()\n    oily.SetNumberOfTuples(numTuples)\n\n    rand_seq = vtkMinimalStandardRandomSequence()\n    rand_seq.SetSeed(8775070)\n\n    for i in range(numTuples):\n        bitter.SetTuple1(i, rand_seq.GetRangeValue(1, 10))\n        rand_seq.Next()\n        crispy.SetTuple1(i, rand_seq.GetRangeValue(-1, 1))\n        rand_seq.Next()\n        crunchy.SetTuple1(i, rand_seq.GetRangeValue(1, 100))\n        rand_seq.Next()\n        salty.SetTuple1(i, rand_seq.GetRangeValue(0, 10))\n        rand_seq.Next()\n        oily.SetTuple1(i, rand_seq.GetRangeValue(5, 25))\n        rand_seq.Next()\n\n    dobj = vtkDataObject()\n    dobj.GetFieldData().AddArray(bitter)\n    dobj.GetFieldData().AddArray(crispy)\n    dobj.GetFieldData().AddArray(crunchy)\n    dobj.GetFieldData().AddArray(salty)\n    dobj.GetFieldData().AddArray(oily)\n\n    actor = vtkSpiderPlotActor()\n    actor.SetInputData(dobj)\n    actor.SetTitle(\"Spider Plot\")\n    actor.SetIndependentVariablesToColumns()\n    actor.GetPositionCoordinate().SetValue(0.05, 0.1, 0.0)\n    actor.GetPosition2Coordinate().SetValue(0.95, 0.85, 0.0)\n    actor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    actor.SetAxisLabel(0, \"Bitter\")\n    actor.SetAxisRange(0, 1, 10)\n\n    actor.SetAxisLabel(1, \"Crispy\")\n    actor.SetAxisRange(1, -1, 1)\n\n    actor.SetAxisLabel(2, \"Crunchy\")\n    actor.SetAxisRange(2, 1, 100)\n\n    actor.SetAxisLabel(3, \"Salty\")\n    actor.SetAxisRange(3, 0, 10)\n\n    actor.SetAxisLabel(4, \"Oily\")\n    actor.SetAxisRange(4, 5, 25)\n    actor.GetLegendActor().SetNumberOfEntries(numTuples)\n\n    for i in range(numTuples):\n        r = rand_seq.GetRangeValue(0.4, 1.0)\n        rand_seq.Next()\n        g = rand_seq.GetRangeValue(0.4, 1.0)\n        rand_seq.Next()\n        b = rand_seq.GetRangeValue(0.4, 1.0)\n        rand_seq.Next()\n        actor.SetPlotColor(i, r, g, b)\n\n    actor.LegendVisibilityOn()\n\n    actor.GetTitleTextProperty().SetColor(colors.GetColor3d('MistyRose'))\n    actor.GetLabelTextProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    ren1.AddActor(actor)\n    ren1.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renWin.SetSize(600, 500)\n    renWin.SetWindowName('SpiderPlot')\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Plotting/SurfacePlot/","title":"SurfacePlot","text":"

vtk-examples/Python/Plotting/SurfacePlot

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Plotting/SurfacePlot/#code","title":"Code","text":"

SurfacePlot.py

#!/usr/bin/env python\n\nfrom math import sin, sqrt\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkChartsCore import (\n    vtkChartXYZ,\n    vtkPlotSurface\n)\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkRectf,\n    vtkTable,\n    vtkVector2i\n)\nfrom vtkmodules.vtkRenderingContext2D import vtkContextMouseEvent\nfrom vtkmodules.vtkViewsContext2D import vtkContextView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    chart = vtkChartXYZ()\n    chart.SetGeometry(vtkRectf(10.0, 10.0, 630, 470))\n\n    plot = vtkPlotSurface()\n\n    view = vtkContextView()\n    view.GetRenderer().SetBackground(colors.GetColor3d(\"Silver\"))\n    view.GetRenderWindow().SetSize(640, 480)\n    view.GetScene().AddItem(chart)\n\n    # Create a surface\n    table = vtkTable()\n    numPoints = 70\n    inc = 9.424778 / (numPoints - 1)\n    for i in range(numPoints):\n        arr = vtkFloatArray()\n        table.AddColumn(arr)\n\n    table.SetNumberOfRows(numPoints)\n    for i in range(numPoints):\n        x = i * inc\n        for j in range(numPoints):\n            y = j * inc\n            table.SetValue(i, j, sin(sqrt(x * x + y * y)))\n\n    # Set up the surface plot we wish to visualize and add it to the chart\n    plot.SetXRange(0, 10.0)\n    plot.SetYRange(0, 10.0)\n    plot.SetInputData(table)\n    plot.GetPen().SetColorF(colors.GetColor3d(\"Tomato\"))\n    chart.AddPlot(plot)\n\n    view.GetRenderWindow().SetMultiSamples(0)\n    view.GetInteractor().Initialize()\n    view.GetRenderWindow().SetWindowName(\"SurfacePlot\")\n    view.GetRenderWindow().Render()\n\n    # Rotate\n    mouseEvent = vtkContextMouseEvent()\n    mouseEvent.SetInteractor(view.GetInteractor())\n\n    pos = vtkVector2i()\n\n    lastPos = vtkVector2i()\n    mouseEvent.SetButton(vtkContextMouseEvent.LEFT_BUTTON)\n    lastPos.Set(100, 50)\n    mouseEvent.SetLastScreenPos(lastPos)\n    pos.Set(150, 100)\n    mouseEvent.SetScreenPos(pos)\n\n    sP = [float(x) for x in pos]\n    lSP = [float(x) for x in lastPos]\n    screenPos = [float(x) for x in mouseEvent.GetScreenPos()]\n    lastScreenPos = [float(x) for x in mouseEvent.GetLastScreenPos()]\n\n    chart.MouseMoveEvent(mouseEvent)\n\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/AlignTwoPolyDatas/","title":"AlignTwoPolyDatas","text":"

vtk-examples/Python/PolyData/AlignTwoPolyDatas

"},{"location":"Python/PolyData/AlignTwoPolyDatas/#description","title":"Description","text":"

This example shows how to align two vtkPolyData's. Typically, the two datasets are related. For example, aligning a CT head isosurface with an MRI head isosurface of the same patient. Or two steps in a time series of an evolving surface. These cases usually reside in the same coordinate system, and the initial alignment is \"close\" to the desired results.

Another case is when the two datasets are from the \"same\" family of objects - for example, running the example with two types of sharks that exist in different coordinate systems.

The algorithm proceeds as follows:

  1. Read the two vtkPolyData's that exist in the example's command line. The first file contains the source vtkPolyData to be aligned with the second file's vtkPolyData called the target. Another naming convention is moving and fixed.

  2. Compute a measure of fit of the two original files. We use the recently added vtkHausdorffDistancePointSetFilter to compute the measure. See Hausdorff Distance.

  3. Align the bounding boxes of the two datasets. Here we use a vtkOBBTree locator to create oriented bounding boxes. See Oriented Bounding Boxes. Use the bounding box corner coordinates to create source and target vtkLandmarkTransform's. vtkTransformPolyData uses this transform to create a new source vtkPolyData. Since the orientations of the bounding boxes may differ, the AlignBoundingBoxes function tries ten different rotations. For each rotation, it computes the Hausdorff distance between the target's OBB corners and the transformed source's OBB corners. Finally, transform the original source using the smallest distance.

  4. Improve the alignment with vtkIterativeClosestPointTransform with a RigidBody transform. Compute the distance metric again.

  5. Display the source and target vtkPolyData's with the transform that has the best distance metric.

Info

The example is run with src/Testing/Data/thingiverse/Grey_Nurse_Shark.stl and src/Testing/Data/greatWhite.stl, in this case, we reorient the target using a rotation. vtkTransformPolyDataFilter is used to get a better fit in this case.

Info

If example is run with src/Testing/Data/thingiverse/Grey_Nurse_Shark.stl and src/Testing/Data/shark.ply the fit is really poor and the Iterative Closest Point algotithm fails. So we fallback and use oriented bounding boxes.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/AlignTwoPolyDatas/#code","title":"Code","text":"

AlignTwoPolyDatas.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport math\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_DOUBLE_MAX,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkIterativeClosestPointTransform,\n    vtkPolyData\n)\nfrom vtkmodules.vtkCommonTransforms import (\n    vtkLandmarkTransform,\n    vtkTransform\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkOBBTree,\n    vtkTransformPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkHausdorffDistancePointSetFilter\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import (\n    vtkPolyDataReader,\n    vtkPolyDataWriter\n    )\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'How to align two vtkPolyData\\'s.'\n    epilogue = '''\n\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('src_fn', help='The polydata source file name,e.g. thingiverse/Grey_Nurse_Shark.stl.')\n    parser.add_argument('tgt_fn', help='The polydata target file name, e.g. greatWhite.stl.')\n\n    args = parser.parse_args()\n\n    return args.src_fn, args.tgt_fn\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    src_fn, tgt_fn = get_program_parameters()\n    print('Loading source:', src_fn)\n    source_polydata = read_poly_data(src_fn)\n    # Save the source polydata in case the alignment process does not improve\n    # segmentation.\n    original_source_polydata = vtkPolyData()\n    original_source_polydata.DeepCopy(source_polydata)\n\n    print('Loading target:', tgt_fn)\n    target_polydata = read_poly_data(tgt_fn)\n\n    # If the target orientation is markedly different, you may need to apply a\n    # transform to orient the target with the source.\n    # For example, when using Grey_Nurse_Shark.stl as the source and\n    # greatWhite.stl as the target, you need to transform the target.\n    trnf = vtkTransform()\n    if Path(src_fn).name == 'Grey_Nurse_Shark.stl' and Path(tgt_fn).name == 'greatWhite.stl':\n        trnf.RotateY(90)\n\n    tpd = vtkTransformPolyDataFilter()\n    tpd.SetTransform(trnf)\n    tpd.SetInputData(target_polydata)\n    tpd.Update()\n\n    renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n\n    distance = vtkHausdorffDistancePointSetFilter()\n    distance.SetInputData(0, tpd.GetOutput())\n    distance.SetInputData(1, source_polydata)\n    distance.Update()\n\n    distance_before_align = distance.GetOutput(0).GetFieldData().GetArray('HausdorffDistance').GetComponent(0, 0)\n\n    # Get initial alignment using oriented bounding boxes.\n    align_bounding_boxes(source_polydata, tpd.GetOutput())\n\n    distance.SetInputData(0, tpd.GetOutput())\n    distance.SetInputData(1, source_polydata)\n    distance.Modified()\n    distance.Update()\n    distance_after_align = distance.GetOutput(0).GetFieldData().GetArray('HausdorffDistance').GetComponent(0, 0)\n\n    best_distance = min(distance_before_align, distance_after_align)\n\n    if distance_after_align > distance_before_align:\n        source_polydata.DeepCopy(original_source_polydata)\n\n    # Refine the alignment using IterativeClosestPoint.\n    icp = vtkIterativeClosestPointTransform()\n    icp.SetSource(source_polydata)\n    icp.SetTarget(tpd.GetOutput())\n    icp.GetLandmarkTransform().SetModeToRigidBody()\n    icp.SetMaximumNumberOfLandmarks(100)\n    icp.SetMaximumMeanDistance(.00001)\n    icp.SetMaximumNumberOfIterations(500)\n    icp.CheckMeanDistanceOn()\n    icp.StartByMatchingCentroidsOn()\n    icp.Update()\n    icp_mean_distance = icp.GetMeanDistance()\n\n    # print(icp)\n\n    lm_transform = icp.GetLandmarkTransform()\n    transform = vtkTransformPolyDataFilter()\n    transform.SetInputData(source_polydata)\n    transform.SetTransform(lm_transform)\n    transform.SetTransform(icp)\n    transform.Update()\n\n    distance.SetInputData(0, tpd.GetOutput())\n    distance.SetInputData(1, transform.GetOutput())\n    distance.Update()\n\n    # Note: If there is an error extracting eigenfunctions, then this will be zero.\n    distance_after_icp = distance.GetOutput(0).GetFieldData().GetArray('HausdorffDistance').GetComponent(0, 0)\n\n    # Check if ICP worked.\n    if not (math.isnan(icp_mean_distance) or math.isinf(icp_mean_distance)):\n        if distance_after_icp < best_distance:\n            best_distance = distance_after_icp\n\n    print('Distances:')\n    print('  Before aligning:                        {:0.5f}'.format(distance_before_align))\n    print('  Aligning using oriented bounding boxes: {:0.5f}'.format(distance_before_align))\n    print('  Aligning using IterativeClosestPoint:   {:0.5f}'.format(distance_after_icp))\n    print('  Best distance:                          {:0.5f}'.format(best_distance))\n\n    # Select the source to use.\n    source_mapper = vtkDataSetMapper()\n    if best_distance == distance_before_align:\n        source_mapper.SetInputData(original_source_polydata)\n        print('Using original alignment')\n    elif best_distance == distance_after_align:\n        source_mapper.SetInputData(source_polydata)\n        print('Using alignment by OBB')\n    else:\n        source_mapper.SetInputConnection(transform.GetOutputPort())\n        print('Using alignment by ICP')\n    source_mapper.ScalarVisibilityOff()\n\n\n    writer = vtkPolyDataWriter()\n    if best_distance == distance_before_align:\n        writer.SetInputData(original_source_polydata)\n    elif best_distance == distance_after_align:\n        writer.SetInputData(source_polydata)\n    else:\n        writer.SetInputData(transform.GetOutput())\n    writer.SetFileName('AlignedSource.vtk')\n    writer.Write()\n    writer.SetInputData(tpd.GetOutput())\n    writer.SetFileName('Target.vtk')\n    writer.Write()\n\n    source_actor = vtkActor()\n    source_actor.SetMapper(source_mapper)\n    source_actor.GetProperty().SetOpacity(0.6)\n    source_actor.GetProperty().SetDiffuseColor(\n        colors.GetColor3d('White'))\n    renderer.AddActor(source_actor)\n\n    target_mapper = vtkDataSetMapper()\n    target_mapper.SetInputData(tpd.GetOutput())\n    target_mapper.ScalarVisibilityOff()\n\n    target_actor = vtkActor()\n    target_actor.SetMapper(target_mapper)\n    target_actor.GetProperty().SetDiffuseColor(\n        colors.GetColor3d('Tomato'))\n    renderer.AddActor(target_actor)\n\n    render_window.AddRenderer(renderer)\n    renderer.SetBackground(colors.GetColor3d(\"sea_green_light\"))\n    renderer.UseHiddenLineRemovalOn()\n\n    if vtk_version_ok(9, 0, 20210718):\n        try:\n            cam_orient_manipulator = vtkCameraOrientationWidget()\n            cam_orient_manipulator.SetParentRenderer(renderer)\n            # Enable the widget.\n            cam_orient_manipulator.On()\n        except AttributeError:\n            pass\n    else:\n        axes = vtkAxesActor()\n        widget = vtkOrientationMarkerWidget()\n        rgba = [0.0, 0.0, 0.0, 0.0]\n        colors.GetColor(\"Carrot\", rgba)\n        widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n        widget.SetOrientationMarker(axes)\n        widget.SetInteractor(interactor)\n        widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n        widget.EnabledOn()\n        widget.InteractiveOn()\n\n    render_window.SetSize(640, 480)\n    render_window.Render()\n    render_window.SetWindowName('AlignTwoPolyDatas')\n\n    interactor.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef read_poly_data(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == \".ply\":\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".vtp\":\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".obj\":\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".stl\":\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".vtk\":\n        reader = vtkPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".g\":\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef align_bounding_boxes(source, target):\n    # Use OBBTree to create an oriented bounding box for target and source\n    source_obb_tree = vtkOBBTree()\n    source_obb_tree.SetDataSet(source)\n    source_obb_tree.SetMaxLevel(1)\n    source_obb_tree.BuildLocator()\n\n    target_obb_tree = vtkOBBTree()\n    target_obb_tree.SetDataSet(target)\n    target_obb_tree.SetMaxLevel(1)\n    target_obb_tree.BuildLocator()\n\n    source_landmarks = vtkPolyData()\n    source_obb_tree.GenerateRepresentation(0, source_landmarks)\n\n    target_landmarks = vtkPolyData()\n    target_obb_tree.GenerateRepresentation(0, target_landmarks)\n\n    lm_transform = vtkLandmarkTransform()\n    lm_transform.SetModeToSimilarity()\n    lm_transform.SetTargetLandmarks(target_landmarks.GetPoints())\n    best_distance = VTK_DOUBLE_MAX\n    best_points = vtkPoints()\n    best_distance = best_bounding_box(\n        \"X\",\n        target,\n        source,\n        target_landmarks,\n        source_landmarks,\n        best_distance,\n        best_points)\n    best_distance = best_bounding_box(\n        \"Y\",\n        target,\n        source,\n        target_landmarks,\n        source_landmarks,\n        best_distance,\n        best_points)\n    best_distance = best_bounding_box(\n        \"Z\",\n        target,\n        source,\n        target_landmarks,\n        source_landmarks,\n        best_distance,\n        best_points)\n\n    lm_transform.SetSourceLandmarks(best_points)\n    lm_transform.Modified()\n\n    lm_transform_pd = vtkTransformPolyDataFilter()\n    lm_transform_pd.SetInputData(source)\n    lm_transform_pd.SetTransform(lm_transform)\n    lm_transform_pd.Update()\n\n    source.DeepCopy(lm_transform_pd.GetOutput())\n\n    return\n\n\ndef best_bounding_box(axis, target, source, target_landmarks, source_landmarks, best_distance, best_points):\n    distance = vtkHausdorffDistancePointSetFilter()\n    test_transform = vtkTransform()\n    test_transform_pd = vtkTransformPolyDataFilter()\n    lm_transform = vtkLandmarkTransform()\n    lm_transform_pd = vtkTransformPolyDataFilter()\n\n    lm_transform.SetModeToSimilarity()\n    lm_transform.SetTargetLandmarks(target_landmarks.GetPoints())\n\n    source_center = source_landmarks.GetCenter()\n\n    delta = 90.0\n    for i in range(0, 4):\n        angle = delta * i\n        # Rotate about center\n        test_transform.Identity()\n        test_transform.Translate(source_center[0], source_center[1], source_center[2])\n        if axis == \"X\":\n            test_transform.RotateX(angle)\n        elif axis == \"Y\":\n            test_transform.RotateY(angle)\n        else:\n            test_transform.RotateZ(angle)\n        test_transform.Translate(-source_center[0], -source_center[1], -source_center[2])\n\n        test_transform_pd.SetTransform(test_transform)\n        test_transform_pd.SetInputData(source_landmarks)\n        test_transform_pd.Update()\n\n        lm_transform.SetSourceLandmarks(test_transform_pd.GetOutput().GetPoints())\n        lm_transform.Modified()\n\n        lm_transform_pd.SetInputData(source)\n        lm_transform_pd.SetTransform(lm_transform)\n        lm_transform_pd.Update()\n\n        distance.SetInputData(0, target)\n        distance.SetInputData(1, lm_transform_pd.GetOutput())\n        distance.Update()\n\n        test_distance = distance.GetOutput(0).GetFieldData().GetArray(\"HausdorffDistance\").GetComponent(0, 0)\n        if test_distance < best_distance:\n            best_distance = test_distance\n            best_points.DeepCopy(test_transform_pd.GetOutput().GetPoints())\n\n    return best_distance\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/BooleanOperationPolyDataFilter/","title":"BooleanOperationPolyDataFilter","text":"

vtk-examples/Python/PolyData/BooleanOperationPolyDataFilter

"},{"location":"Python/PolyData/BooleanOperationPolyDataFilter/#description","title":"Description","text":"

The vtkBooleanOperationPolyDataFilter works best with \"clean\" data, so this examples first runs vtkTriangleFilter and then vtkCleanPolyData.

This example can be run in three ways:

  1. BooleanOperationPolyDataFilter - Computes the intersection of two spheres
  2. BooleanOperationPolyDataFilter -o intersection|difference|union - Computes the intersection(difference or union) of two spheres
  3. BooleanOperationPolyDataFilter -o intersection|difference|union input1.vtk input2.vtk - Computes the intersection(difference or union) of two vtkPolyData's

Cite

See Boolean Operations on Surfaces in VTK Without External Libraries for details on the algorithm.

Seealso

LoopBooleanPolyDataFilter, it uses an alternative algorithm to do the boolean operations.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/BooleanOperationPolyDataFilter/#code","title":"Code","text":"

BooleanOperationPolyDataFilter.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkBooleanOperationPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'How to align two vtkPolyData\\'s.'\n    epilogue = '''\n\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('-o', '--operation', nargs='?', default='intersection', help='The type of  ')\n    parser.add_argument('fn1', nargs='?', default=None, help='The polydata source file name,e.g. Grey_Nurse_Shark.stl.')\n    parser.add_argument('fn2', nargs='?', default=None, help='The polydata target file name, e.g. shark.ply.')\n\n    args = parser.parse_args()\n\n    return args.operation, args.fn1, args.fn2\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    operation, fn1, fn2 = get_program_parameters()\n    if fn1 and fn2:\n        poly1 = ReadPolyData(fn1)\n        tri1 = vtkTriangleFilter()\n        tri1.SetInputData(poly1)\n        clean1 = vtkCleanPolyData()\n        clean1.SetInputConnection(tri1.GetOutputPort())\n        clean1.Update()\n        input1 = clean1.GetOutput()\n\n        poly2 = ReadPolyData(fn2)\n        tri2 = vtkTriangleFilter()\n        tri2.SetInputData(poly2)\n        tri2.Update()\n        clean2 = vtkCleanPolyData()\n        clean2.SetInputConnection(tri2.GetOutputPort())\n        clean2.Update()\n        input2 = clean2.GetOutput()\n    else:\n        sphereSource1 = vtkSphereSource()\n        sphereSource1.SetCenter(0.25, 0, 0)\n        sphereSource1.SetPhiResolution(21)\n        sphereSource1.SetThetaResolution(21)\n        sphereSource1.Update()\n        input1 = sphereSource1.GetOutput()\n\n        sphereSource2 = vtkSphereSource()\n        sphereSource2.Update()\n        input2 = sphereSource2.GetOutput()\n\n    input1Mapper = vtkPolyDataMapper()\n    input1Mapper.SetInputData(input1)\n    input1Mapper.ScalarVisibilityOff()\n    input1Actor = vtkActor()\n    input1Actor.SetMapper(input1Mapper)\n    input1Actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Tomato'))\n    input1Actor.GetProperty().SetSpecular(0.6)\n    input1Actor.GetProperty().SetSpecularPower(20)\n    input1Actor.SetPosition(input1.GetBounds()[1] - input1.GetBounds()[0], 0, 0)\n\n    input2Mapper = vtkPolyDataMapper()\n    input2Mapper.SetInputData(input2)\n    input2Mapper.ScalarVisibilityOff()\n    input2Actor = vtkActor()\n    input2Actor.SetMapper(input2Mapper)\n    input2Actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Mint'))\n    input2Actor.GetProperty().SetSpecular(0.6)\n    input2Actor.GetProperty().SetSpecularPower(20)\n    input2Actor.SetPosition(-(input1.GetBounds()[1] - input1.GetBounds()[0]), 0, 0)\n\n    booleanOperation = vtkBooleanOperationPolyDataFilter()\n    if operation.lower() == 'union':\n        booleanOperation.SetOperationToUnion()\n    elif operation.lower() == 'intersection':\n        booleanOperation.SetOperationToIntersection()\n    elif operation.lower() == 'difference':\n        booleanOperation.SetOperationToDifference()\n    else:\n        print('Unknown operation:', operation)\n        return\n\n    booleanOperation.SetInputData(0, input1)\n    booleanOperation.SetInputData(1, input2)\n\n    booleanOperationMapper = vtkPolyDataMapper()\n    booleanOperationMapper.SetInputConnection(booleanOperation.GetOutputPort())\n    booleanOperationMapper.ScalarVisibilityOff()\n\n    booleanOperationActor = vtkActor()\n    booleanOperationActor.SetMapper(booleanOperationMapper)\n    booleanOperationActor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n    booleanOperationActor.GetProperty().SetSpecular(0.6)\n    booleanOperationActor.GetProperty().SetSpecularPower(20)\n\n    renderer = vtkRenderer()\n    renderer.AddViewProp(input1Actor)\n    renderer.AddViewProp(input2Actor)\n    renderer.AddViewProp(booleanOperationActor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('BooleanOperationPolyDataFilter')\n\n    viewUp = [0.0, 0.0, 1.0]\n    position = [0.0, -1.0, 0.0]\n    PositionCamera(renderer, viewUp, position)\n    renderer.GetActiveCamera().Dolly(1.4)\n    renderer.ResetCameraClippingRange()\n\n    renWinInteractor = vtkRenderWindowInteractor()\n    renWinInteractor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    renWinInteractor.Start()\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef PositionCamera(renderer, viewUp, position):\n    renderer.GetActiveCamera().SetViewUp(viewUp)\n    renderer.GetActiveCamera().SetPosition(position)\n    renderer.ResetCamera()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/CellsInsideObject/","title":"CellsInsideObject","text":"

vtk-examples/Python/PolyData/CellsInsideObject

"},{"location":"Python/PolyData/CellsInsideObject/#description","title":"Description","text":"

This example illustrates how to extract the cells that exist inside a closed surface. It uses vtkSelectEnclosedPoints to mark points that are inside and outside the surface. vtkMultiThreshold is used to extract the three meshes into three vtkMultiBlockDataSet's. The cells completely outside are shown in crimson, completely inside are yellow and border cells are green. A translucent copy of the closed surface helps illustrate the selection process.

If two polydata datasets are provided, the example uses the second as the closed surface. If only one dataset is provided, the closed surface is generated by rotating the first dataset by 90 degrees around its Y axis.

Info

The example is run with src/Testing/Data/cow.g.

Warning

The surface that contains cells must be closed and manifold. The example does not check for this. Run ClosedSurface (C++) or (Python) to check your surface.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/CellsInsideObject/#code","title":"Code","text":"

CellsInsideObject.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkDataObject\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkMultiThreshold,\n    vtkTransformPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkSelectEnclosedPoints\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a polydata file of a surface and determine if it is a closed surface.'\n    epilogue = '''\nThis example illustrates how to extract the cells that exist inside a closed surface.\nIt uses vtkSelectEnclosedPoints to mark points that are inside and outside the surface.\nvtkMultiThreshold is used to extract the three meshes into three vtkMultiBlockDataSet's.\nThe cells completely outside are shown in crimson, completely inside are yellow and\n border cells are green.\nA translucent copy of the closed surface helps illustrate the selection process.\n\nIf two polydata datasets are provided, the example uses the second as the closed surface.\nIf only one dataset is provided, the closed surface is generated by rotating the\n first dataset by 90 degrees around its Y axis.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='Enter a polydata file e.g cow.g.')\n    parser.add_argument('filename2', default=None, nargs='?', help='Enter another polydata file e.g cow.g.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\ndef main():\n    fn1, fn2 = get_program_parameters()\n    polyData1 = ReadPolyData(fn1)\n    if fn2:\n        polyData2 = ReadPolyData(fn2)\n    else:\n        # If only one polydata is present, generate a second polydata by\n        # rotating the original about its center.\n        print('Generating modified polyData1')\n        center = polyData1.GetCenter()\n        transform = vtkTransform()\n        transform.Translate(center[0], center[1], center[2])\n        transform.RotateY(90.0)\n        transform.Translate(-center[0], -center[1], -center[2])\n        transformPD = vtkTransformPolyDataFilter()\n        transformPD.SetTransform(transform)\n        transformPD.SetInputData(polyData1)\n        transformPD.Update()\n        polyData2 = transformPD.GetOutput()\n\n    # Mark points inside with 1 and outside with a 0\n    select = vtkSelectEnclosedPoints()\n    select.SetInputData(polyData1)\n    select.SetSurfaceData(polyData2)\n\n    # Extract three meshes, one completely inside, one completely\n    # outside and on the border between the inside and outside.\n\n    threshold = vtkMultiThreshold()\n    # Outside points have a 0 value in ALL points of a cell\n    outsideId = threshold.AddBandpassIntervalSet(\n        0, 0,\n        vtkDataObject.FIELD_ASSOCIATION_POINTS, 'SelectedPoints',\n        0, 1)\n    # Inside points have a 1 value in ALL points of a cell\n    insideId = threshold.AddBandpassIntervalSet(\n        1, 1,\n        vtkDataObject.FIELD_ASSOCIATION_POINTS, 'SelectedPoints',\n        0, 1)\n    # Border points have a 0 or a 1 in at least one point of a cell\n    borderId = threshold.AddIntervalSet(\n        0, 1,\n        vtkMultiThreshold.OPEN, vtkMultiThreshold.OPEN,\n        vtkDataObject.FIELD_ASSOCIATION_POINTS, 'SelectedPoints',\n        0, 0)\n\n    threshold.SetInputConnection(select.GetOutputPort())\n\n    # Select the intervals to be output\n    threshold.OutputSet(outsideId)\n    threshold.OutputSet(insideId)\n    threshold.OutputSet(borderId)\n    threshold.Update()\n\n    # Visualize\n    colors = vtkNamedColors()\n    outsideColor = colors.GetColor3d('Crimson')\n    insideColor = colors.GetColor3d('Banana')\n    borderColor = colors.GetColor3d('Mint')\n    surfaceColor = colors.GetColor3d('Peacock')\n    backgroundColor = colors.GetColor3d('Silver')\n\n    # Outside\n    outsideMapper = vtkDataSetMapper()\n    outsideMapper.SetInputData(threshold.GetOutput().GetBlock(outsideId).GetBlock(0))\n    outsideMapper.ScalarVisibilityOff()\n\n    outsideActor = vtkActor()\n    outsideActor.SetMapper(outsideMapper)\n    outsideActor.GetProperty().SetDiffuseColor(outsideColor)\n    outsideActor.GetProperty().SetSpecular(.6)\n    outsideActor.GetProperty().SetSpecularPower(30)\n\n    # Inside\n    insideMapper = vtkDataSetMapper()\n    insideMapper.SetInputData(threshold.GetOutput().GetBlock(insideId).GetBlock(0))\n    insideMapper.ScalarVisibilityOff()\n\n    insideActor = vtkActor()\n    insideActor.SetMapper(insideMapper)\n    insideActor.GetProperty().SetDiffuseColor(insideColor)\n    insideActor.GetProperty().SetSpecular(.6)\n    insideActor.GetProperty().SetSpecularPower(30)\n    insideActor.GetProperty().EdgeVisibilityOn()\n\n    # Border\n    borderMapper = vtkDataSetMapper()\n    borderMapper.SetInputData(threshold.GetOutput().GetBlock(borderId).GetBlock(0))\n    borderMapper.ScalarVisibilityOff()\n\n    borderActor = vtkActor()\n    borderActor.SetMapper(borderMapper)\n    borderActor.GetProperty().SetDiffuseColor(borderColor)\n    borderActor.GetProperty().SetSpecular(.6)\n    borderActor.GetProperty().SetSpecularPower(30)\n    borderActor.GetProperty().EdgeVisibilityOn()\n\n    surfaceMapper = vtkDataSetMapper()\n    surfaceMapper.SetInputData(polyData2)\n    surfaceMapper.ScalarVisibilityOff()\n\n    # Surface of object containing cell\n    surfaceActor = vtkActor()\n    surfaceActor.SetMapper(surfaceMapper)\n    surfaceActor.GetProperty().SetDiffuseColor(surfaceColor)\n    surfaceActor.GetProperty().SetOpacity(.1)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.SetBackground(backgroundColor)\n    renderer.UseHiddenLineRemovalOn()\n\n    renderer.AddActor(surfaceActor)\n    renderer.AddActor(outsideActor)\n    renderer.AddActor(insideActor)\n    renderer.AddActor(borderActor)\n\n    renderWindow.SetWindowName('CellsInsideObject')\n    renderWindow.Render()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.GetActiveCamera().Dolly(1.25)\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/ClosedSurface/","title":"ClosedSurface","text":"

vtk-examples/Python/PolyData/ClosedSurface

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/ClosedSurface/#code","title":"Code","text":"

ClosedSurface.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkFiltersCore import vtkFeatureEdges\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a polydata file of a surface and determine if it is a closed surface.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Enter a polydata file e.g cow.g.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    fn = get_program_parameters()\n    polyData = ReadPolyData(fn)\n    featureEdges = vtkFeatureEdges()\n    featureEdges.FeatureEdgesOff()\n    featureEdges.BoundaryEdgesOn()\n    featureEdges.NonManifoldEdgesOn()\n    featureEdges.SetInputData(polyData)\n    featureEdges.Update()\n\n    numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfCells()\n\n    if numberOfOpenEdges > 0:\n        print(fn, ': Surface is not closed')\n    else:\n        print(fn, ': Surface is closed')\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/ColoredTriangle/","title":"ColoredTriangle","text":"

vtk-examples/Python/PolyData/ColoredTriangle

"},{"location":"Python/PolyData/ColoredTriangle/#decription","title":"Decription","text":"

Creates a file called TestTriangleColored.vtp.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/ColoredTriangle/#code","title":"Code","text":"

ColoredTriangle.py

#!/usr/bin/env python\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkPoints,\n    vtkUnsignedCharArray\n    )\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangle\n    )\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate a colored triangle, then write a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestColoredTriangle.vtp',\n                        type=str, default='TestColoredTriangle.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    # setup points and vertices\n    Points = vtkPoints()\n    Triangles = vtkCellArray()\n\n    Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    Triangle = vtkTriangle()\n    Triangle.GetPointIds().SetId(0, 0)\n    Triangle.GetPointIds().SetId(1, 1)\n    Triangle.GetPointIds().SetId(2, 2)\n    Triangles.InsertNextCell(Triangle)\n\n    # setup colors\n    Colors = vtkUnsignedCharArray()\n    Colors.SetNumberOfComponents(3)\n    Colors.SetName('Colors')\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Red'))\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Lime'))\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Blue'))\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.SetPolys(Triangles)\n\n    polydata.GetPointData().SetScalars(Colors)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/Curvatures/","title":"Curvatures","text":"

vtk-examples/Python/PolyData/Curvatures

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/Curvatures/#code","title":"Code","text":"

Curvatures.py

#!/usr/bin/env python\n\nfrom pathlib import Path\n\nimport numpy as np\nfrom vtkmodules.numpy_interface import dataset_adapter as dsa\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_DOUBLE,\n    vtkIdList,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFeatureEdges,\n    vtkIdFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkCurvatures\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkIOXML import (\n    vtkXMLPolyDataReader,\n    vtkXMLPolyDataWriter\n)\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtk.util import numpy_support\n\n\ndef get_program_parameters(argv):\n    import argparse\n    import textwrap\n\n    description = 'Calculate Gauss or Mean Curvature.'\n    epilogue = textwrap.dedent('''\n    ''')\n    parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=description,\n                                     epilog=epilogue)\n    parser.add_argument('file_name', help=' e.g. cowHead.vtp.')\n    parser.add_argument('-i', default=16, type=int, help='The color map index e.g. 16.')\n    parser.add_argument('-g', help='Use Gaussian Curvature.', action='store_true')\n\n    args = parser.parse_args()\n    return args.file_name, args.i, args.g\n\n\ndef main(argv):\n    file_name, color_map_idx, gaussian_curvature = get_program_parameters(argv)\n\n    if not Path(file_name).is_file():\n        print(f'The path: {file_name} does not exist.')\n        return\n    if gaussian_curvature:\n        curvature = 'Gauss_Curvature'\n    else:\n        curvature = 'Mean_Curvature'\n\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    source = reader.GetOutput()\n\n    cc = vtkCurvatures()\n    cc.SetInputData(source)\n    if gaussian_curvature:\n        cc.SetCurvatureTypeToGaussian()\n        cc.Update()\n    else:\n        cc.SetCurvatureTypeToMean()\n        cc.Update()\n    adjust_edge_curvatures(cc.GetOutput(), curvature)\n    source.GetPointData().AddArray(cc.GetOutput().GetPointData().GetAbstractArray(curvature))\n    scalar_range = source.GetPointData().GetScalars(curvature).GetRange()\n\n    # Uncomment the following lines if you want to write out the polydata.\n    # writer = vtkXMLPolyDataWriter()\n    # writer.SetFileName('Source.vtp')\n    # writer.SetInputData(source)\n    # writer.SetDataModeToAscii()\n    # writer.Write()\n\n    # Build a lookup table\n    color_series = vtkColorSeries()\n    color_series.SetColorScheme(color_map_idx)\n    print(f'Using color scheme #: {color_series.GetColorScheme()}, {color_series.GetColorSchemeName()}')\n\n    lut = vtkColorTransferFunction()\n    lut.SetColorSpaceToHSV()\n\n    # Use a color series to create a transfer function\n    for i in range(0, color_series.GetNumberOfColors()):\n        color = color_series.GetColor(i)\n        double_color = list(map(lambda x: x / 255.0, color))\n        t = scalar_range[0] + (scalar_range[1] - scalar_range[0]) / (color_series.GetNumberOfColors() - 1) * i\n        lut.AddRGBPoint(t, double_color[0], double_color[1], double_color[2])\n\n    colors = vtkNamedColors()\n\n    # Create a mapper and actor.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(source)\n    mapper.SetScalarModeToUsePointFieldData()\n    mapper.SelectColorArray(curvature)\n    mapper.SetScalarRange(scalar_range)\n    mapper.SetLookupTable(lut)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    window_width = 800\n    window_height = 800\n\n    # Create a scalar bar\n    scalar_bar = vtkScalarBarActor()\n    scalar_bar.SetLookupTable(mapper.GetLookupTable())\n    scalar_bar.SetTitle(curvature.replace('_', '\\n'))\n    scalar_bar.UnconstrainedFontSizeOn()\n    scalar_bar.SetNumberOfLabels(5)\n    scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar.SetMaximumHeightInPixels(window_height // 3)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(window_width, window_height)\n    ren_win.SetWindowName('Curvatures')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    # Important: The interactor must be set prior to enabling the widget.\n    iren.SetRenderWindow(ren_win)\n\n    if vtk_version_ok(9, 0, 20210718):\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        cam_orient_manipulator.SetParentRenderer(renderer)\n        # Enable the widget.\n        cam_orient_manipulator.On()\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor2D(scalar_bar)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    # Render and interact\n    ren_win.Render()\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\ndef adjust_edge_curvatures(source, curvature_name, epsilon=1.0e-08):\n    \"\"\"\n    This function adjusts curvatures along the edges of the surface by replacing\n     the value with the average value of the curvatures of points in the neighborhood.\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param epsilon: Absolute curvature values less than this will be set to zero.\n    :return:\n    \"\"\"\n\n    def point_neighbourhood(pt_id):\n        \"\"\"\n        Find the ids of the neighbours of pt_id.\n\n        :param pt_id: The point id.\n        :return: The neighbour ids.\n        \"\"\"\n        \"\"\"\n        Extract the topological neighbors for point pId. In two steps:\n        1) source.GetPointCells(pt_id, cell_ids)\n        2) source.GetCellPoints(cell_id, cell_point_ids) for all cell_id in cell_ids\n        \"\"\"\n        cell_ids = vtkIdList()\n        source.GetPointCells(pt_id, cell_ids)\n        neighbour = set()\n        for cell_idx in range(0, cell_ids.GetNumberOfIds()):\n            cell_id = cell_ids.GetId(cell_idx)\n            cell_point_ids = vtkIdList()\n            source.GetCellPoints(cell_id, cell_point_ids)\n            for cell_pt_idx in range(0, cell_point_ids.GetNumberOfIds()):\n                neighbour.add(cell_point_ids.GetId(cell_pt_idx))\n        return neighbour\n\n    def compute_distance(pt_id_a, pt_id_b):\n        \"\"\"\n        Compute the distance between two points given their ids.\n\n        :param pt_id_a:\n        :param pt_id_b:\n        :return:\n        \"\"\"\n        pt_a = np.array(source.GetPoint(pt_id_a))\n        pt_b = np.array(source.GetPoint(pt_id_b))\n        return np.linalg.norm(pt_a - pt_b)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    #  Get the boundary point IDs.\n    array_name = 'ids'\n    id_filter = vtkIdFilter()\n    id_filter.SetInputData(source)\n    id_filter.SetPointIds(True)\n    id_filter.SetCellIds(False)\n    id_filter.SetPointIdsArrayName(array_name)\n    id_filter.SetCellIdsArrayName(array_name)\n    id_filter.Update()\n\n    edges = vtkFeatureEdges()\n    edges.SetInputConnection(id_filter.GetOutputPort())\n    edges.BoundaryEdgesOn()\n    edges.ManifoldEdgesOff()\n    edges.NonManifoldEdgesOff()\n    edges.FeatureEdgesOff()\n    edges.Update()\n\n    edge_array = edges.GetOutput().GetPointData().GetArray(array_name)\n    boundary_ids = []\n    for i in range(edges.GetOutput().GetNumberOfPoints()):\n        boundary_ids.append(edge_array.GetValue(i))\n    # Remove duplicate Ids.\n    p_ids_set = set(boundary_ids)\n\n    # Iterate over the edge points and compute the curvature as the weighted\n    # average of the neighbours.\n    count_invalid = 0\n    for p_id in boundary_ids:\n        p_ids_neighbors = point_neighbourhood(p_id)\n        # Keep only interior points.\n        p_ids_neighbors -= p_ids_set\n        # Compute distances and extract curvature values.\n        curvs = [curvatures[p_id_n] for p_id_n in p_ids_neighbors]\n        dists = [compute_distance(p_id_n, p_id) for p_id_n in p_ids_neighbors]\n        curvs = np.array(curvs)\n        dists = np.array(dists)\n        curvs = curvs[dists > 0]\n        dists = dists[dists > 0]\n        if len(curvs) > 0:\n            weights = 1 / np.array(dists)\n            weights /= weights.sum()\n            new_curv = np.dot(curvs, weights)\n        else:\n            # Corner case.\n            count_invalid += 1\n            # Assuming the curvature of the point is planar.\n            new_curv = 0.0\n        # Set the new curvature value.\n        curvatures[p_id] = new_curv\n\n    #  Set small values to zero.\n    if epsilon != 0.0:\n        curvatures = np.where(abs(curvatures) < epsilon, 0, curvatures)\n        # Curvatures is now an ndarray\n        curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                          deep=True,\n                                          array_type=VTK_DOUBLE)\n        curv.SetName(curvature_name)\n        source.GetPointData().RemoveArray(curvature_name)\n        source.GetPointData().AddArray(curv)\n        source.GetPointData().SetActiveScalars(curvature_name)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/PolyData/CurvaturesAdjustEdges/","title":"CurvaturesAdjustEdges","text":"

vtk-examples/Python/PolyData/CurvaturesAdjustEdges

"},{"location":"Python/PolyData/CurvaturesAdjustEdges/#description","title":"Description","text":"

This example demonstrates how to calculate Gaussian and Mean curvatures for a vtkPolyData source. Since edges can produce large discrepancies to curvatures, edge adjustment can be applied. If we know the geometry of the surface we can also modify the curvatures.

Functions are provided to achieve these aims.

A histogram of the frequencies is also output to the console. This is useful if you want to get an idea of the distribution of the scalars in each band.

This example was inspired by these discussions:

  • vtkCurvatures yields unreasonably large values along borders
  • How to extract the ids of the boundary points of a surface?

Thanks to everyone involved in these discussions.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/CurvaturesAdjustEdges/#code","title":"Code","text":"

CurvaturesAdjustEdges.py

#!/usr/bin/env python\n\nimport math\n\nimport numpy as np\nfrom vtkmodules.numpy_interface import dataset_adapter as dsa\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBour,\n    vtkParametricEnneper,\n    vtkParametricMobius,\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_DOUBLE,\n    vtkDoubleArray,\n    vtkFloatArray,\n    vtkIdList,\n    vtkLookupTable,\n    vtkPoints,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDelaunay2D,\n    vtkFeatureEdges,\n    vtkIdFilter,\n    vtkPolyDataNormals,\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkCurvatures,\n    vtkTransformPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkLinearSubdivisionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkParametricFunctionSource,\n    vtkTexturedSphereSource\n)\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\nfrom vtk.util import numpy_support\n\n\ndef main(argv):\n    # desired_surface = 'Bour'\n    # desired_surface = 'Cube'\n    # desired_surface = 'Hills'\n    # desired_surface = 'Enneper'\n    # desired_surface = 'Mobius'\n    desired_surface = 'RandomHills'\n    # desired_surface = 'Sphere'\n    # desired_surface = 'Torus'\n    source = get_source(desired_surface)\n    if not source:\n        print('The surface is not available.')\n        return\n\n    gc = vtkCurvatures()\n    gc.SetInputData(source)\n    gc.SetCurvatureTypeToGaussian()\n    gc.Update()\n    if desired_surface in ['Bour', 'Enneper', 'Hills', 'RandomHills', 'Torus']:\n        adjust_edge_curvatures(gc.GetOutput(), 'Gauss_Curvature')\n    if desired_surface == 'Bour':\n        # Gaussian curvature is -1/(r(r+1)^4))\n        constrain_curvatures(gc.GetOutput(), 'Gauss_Curvature', -0.0625, -0.0625)\n    if desired_surface == 'Enneper':\n        # Gaussian curvature is -4/(1 + r^2)^4\n        constrain_curvatures(gc.GetOutput(), 'Gauss_Curvature', -0.25, -0.25)\n    if desired_surface == 'Cube':\n        constrain_curvatures(gc.GetOutput(), 'Gauss_Curvature', 0.0, 0.0)\n    if desired_surface == 'Mobius':\n        constrain_curvatures(gc.GetOutput(), 'Gauss_Curvature', 0.0, 0.0)\n    if desired_surface == 'Sphere':\n        # Gaussian curvature is 1/r^2\n        constrain_curvatures(gc.GetOutput(), 'Gauss_Curvature', 4.0, 4.0)\n    source.GetPointData().AddArray(\n        gc.GetOutput().GetPointData().GetAbstractArray('Gauss_Curvature'))\n\n    mc = vtkCurvatures()\n    mc.SetInputData(source)\n    mc.SetCurvatureTypeToMean()\n    mc.Update()\n    if desired_surface in ['Bour', 'Enneper', 'Hills', 'RandomHills', 'Torus']:\n        adjust_edge_curvatures(mc.GetOutput(), 'Mean_Curvature')\n    if desired_surface == 'Bour':\n        # Mean curvature is 0\n        constrain_curvatures(mc.GetOutput(), 'Mean_Curvature', 0.0, 0.0)\n    if desired_surface == 'Enneper':\n        # Mean curvature is 0\n        constrain_curvatures(mc.GetOutput(), 'Mean_Curvature', 0.0, 0.0)\n    if desired_surface == 'Sphere':\n        # Mean curvature is 1/r\n        constrain_curvatures(mc.GetOutput(), 'Mean_Curvature', 2.0, 2.0)\n    source.GetPointData().AddArray(\n        mc.GetOutput().GetPointData().GetAbstractArray('Mean_Curvature'))\n\n    # Uncomment the following lines if you want to write out the polydata.\n    # writer = vtkXMLPolyDataWriter()\n    # writer.SetFileName('Source.vtp')\n    # writer.SetInputData(source)\n    # writer.SetDataModeToBinary()\n    # writer.Write()\n\n    # Let's visualise what we have done.\n\n    colors = vtkNamedColors()\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    window_width = 1024\n    window_height = 512\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(window_width, window_height)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    # Create a common text property.\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(24)\n    text_property.SetJustificationToCentered()\n\n    lut = get_diverging_lut()\n    # lut = get_diverging_lut1()\n\n    # Define viewport ranges\n    xmins = [0, 0.5]\n    xmaxs = [0.5, 1]\n    ymins = [0, 0]\n    ymaxs = [1.0, 1.0]\n\n    camera = None\n\n    has_cow = False\n    if vtk_version_ok(9, 0, 20210718):\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        has_cow = True\n\n    curvature_types = ['Gauss_Curvature', 'Mean_Curvature']\n    for idx, curvature_name in enumerate(curvature_types):\n\n        curvature_title = curvature_name.replace('_', '\\n')\n\n        source.GetPointData().SetActiveScalars(curvature_name)\n        scalar_range = source.GetPointData().GetScalars(curvature_name).GetRange()\n\n        bands = get_bands(scalar_range, 10)\n        freq = get_frequencies(bands, source)\n        bands, freq = adjust_ranges(bands, freq)\n        print(curvature_name)\n        print_bands_frequencies(bands, freq)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputData(source)\n        mapper.SetScalarModeToUsePointFieldData()\n        mapper.SelectColorArray(curvature_name)\n        mapper.SetScalarRange(scalar_range)\n        mapper.SetLookupTable(lut)\n\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        # Create a scalar bar\n        scalar_bar = vtkScalarBarActor()\n        scalar_bar.SetLookupTable(mapper.GetLookupTable())\n        scalar_bar.SetTitle(curvature_title)\n        scalar_bar.UnconstrainedFontSizeOn()\n        scalar_bar.SetNumberOfLabels(min(5, len(freq)))\n        scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n        scalar_bar.SetMaximumHeightInPixels(window_height // 3)\n        scalar_bar.SetBarRatio(scalar_bar.GetBarRatio() * 0.5)\n        scalar_bar.SetPosition(0.85, 0.1)\n\n        text_mapper = vtkTextMapper()\n        text_mapper.SetInput(curvature_title)\n        text_mapper.SetTextProperty(text_property)\n\n        text_actor = vtkActor2D()\n        text_actor.SetMapper(text_mapper)\n        text_actor.SetPosition(250, 16)\n\n        renderer = vtkRenderer()\n        renderer.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n        renderer.AddActor(actor)\n        renderer.AddActor(text_actor)\n        renderer.AddActor(scalar_bar)\n\n        ren_win.AddRenderer(renderer)\n\n        if idx == 0:\n            if has_cow:\n                cam_orient_manipulator.SetParentRenderer(renderer)\n            camera = renderer.GetActiveCamera()\n            camera.Elevation(60)\n        else:\n            renderer.SetActiveCamera(camera)\n        renderer.SetViewport(xmins[idx], ymins[idx], xmaxs[idx], ymaxs[idx])\n        renderer.ResetCamera()\n\n    if has_cow:\n        # Enable the widget.\n        cam_orient_manipulator.On()\n\n    ren_win.Render()\n    ren_win.SetWindowName('CurvaturesAdjustEdges')\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\ndef adjust_edge_curvatures(source, curvature_name, epsilon=1.0e-08):\n    \"\"\"\n    This function adjusts curvatures along the edges of the surface by replacing\n     the value with the average value of the curvatures of points in the neighborhood.\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param epsilon: Absolute curvature values less than this will be set to zero.\n    :return:\n    \"\"\"\n\n    def point_neighbourhood(pt_id):\n        \"\"\"\n        Find the ids of the neighbours of pt_id.\n\n        :param pt_id: The point id.\n        :return: The neighbour ids.\n        \"\"\"\n        \"\"\"\n        Extract the topological neighbors for point pId. In two steps:\n        1) source.GetPointCells(pt_id, cell_ids)\n        2) source.GetCellPoints(cell_id, cell_point_ids) for all cell_id in cell_ids\n        \"\"\"\n        cell_ids = vtkIdList()\n        source.GetPointCells(pt_id, cell_ids)\n        neighbour = set()\n        for cell_idx in range(0, cell_ids.GetNumberOfIds()):\n            cell_id = cell_ids.GetId(cell_idx)\n            cell_point_ids = vtkIdList()\n            source.GetCellPoints(cell_id, cell_point_ids)\n            for cell_pt_idx in range(0, cell_point_ids.GetNumberOfIds()):\n                neighbour.add(cell_point_ids.GetId(cell_pt_idx))\n        return neighbour\n\n    def compute_distance(pt_id_a, pt_id_b):\n        \"\"\"\n        Compute the distance between two points given their ids.\n\n        :param pt_id_a:\n        :param pt_id_b:\n        :return:\n        \"\"\"\n        pt_a = np.array(source.GetPoint(pt_id_a))\n        pt_b = np.array(source.GetPoint(pt_id_b))\n        return np.linalg.norm(pt_a - pt_b)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    #  Get the boundary point IDs.\n    array_name = 'ids'\n    id_filter = vtkIdFilter()\n    id_filter.SetInputData(source)\n    id_filter.SetPointIds(True)\n    id_filter.SetCellIds(False)\n    id_filter.SetPointIdsArrayName(array_name)\n    id_filter.SetCellIdsArrayName(array_name)\n    id_filter.Update()\n\n    edges = vtkFeatureEdges()\n    edges.SetInputConnection(id_filter.GetOutputPort())\n    edges.BoundaryEdgesOn()\n    edges.ManifoldEdgesOff()\n    edges.NonManifoldEdgesOff()\n    edges.FeatureEdgesOff()\n    edges.Update()\n\n    edge_array = edges.GetOutput().GetPointData().GetArray(array_name)\n    boundary_ids = []\n    for i in range(edges.GetOutput().GetNumberOfPoints()):\n        boundary_ids.append(edge_array.GetValue(i))\n    # Remove duplicate Ids.\n    p_ids_set = set(boundary_ids)\n\n    # Iterate over the edge points and compute the curvature as the weighted\n    # average of the neighbours.\n    count_invalid = 0\n    for p_id in boundary_ids:\n        p_ids_neighbors = point_neighbourhood(p_id)\n        # Keep only interior points.\n        p_ids_neighbors -= p_ids_set\n        # Compute distances and extract curvature values.\n        curvs = [curvatures[p_id_n] for p_id_n in p_ids_neighbors]\n        dists = [compute_distance(p_id_n, p_id) for p_id_n in p_ids_neighbors]\n        curvs = np.array(curvs)\n        dists = np.array(dists)\n        curvs = curvs[dists > 0]\n        dists = dists[dists > 0]\n        if len(curvs) > 0:\n            weights = 1 / np.array(dists)\n            weights /= weights.sum()\n            new_curv = np.dot(curvs, weights)\n        else:\n            # Corner case.\n            count_invalid += 1\n            # Assuming the curvature of the point is planar.\n            new_curv = 0.0\n        # Set the new curvature value.\n        curvatures[p_id] = new_curv\n\n    #  Set small values to zero.\n    if epsilon != 0.0:\n        curvatures = np.where(abs(curvatures) < epsilon, 0, curvatures)\n        # Curvatures is now an ndarray\n        curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                          deep=True,\n                                          array_type=VTK_DOUBLE)\n        curv.SetName(curvature_name)\n        source.GetPointData().RemoveArray(curvature_name)\n        source.GetPointData().AddArray(curv)\n        source.GetPointData().SetActiveScalars(curvature_name)\n\n\ndef constrain_curvatures(source, curvature_name, lower_bound=0.0, upper_bound=0.0):\n    \"\"\"\n    This function constrains curvatures to the range [lower_bound ... upper_bound].\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param lower_bound: The lower bound.\n    :param upper_bound: The upper bound.\n    :return:\n    \"\"\"\n\n    bounds = list()\n    if lower_bound < upper_bound:\n        bounds.append(lower_bound)\n        bounds.append(upper_bound)\n    else:\n        bounds.append(upper_bound)\n        bounds.append(lower_bound)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    # Set upper and lower bounds.\n    curvatures = np.where(curvatures < bounds[0], bounds[0], curvatures)\n    curvatures = np.where(curvatures > bounds[1], bounds[1], curvatures)\n    # Curvatures is now an ndarray\n    curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                      deep=True,\n                                      array_type=VTK_DOUBLE)\n    curv.SetName(curvature_name)\n    source.GetPointData().RemoveArray(curvature_name)\n    source.GetPointData().AddArray(curv)\n    source.GetPointData().SetActiveScalars(curvature_name)\n\n\ndef get_diverging_lut():\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start point         midPoint            end point\n     cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n     purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n     green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n     blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n     green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n\n    :return:\n    \"\"\"\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    # Cool to warm.\n    ctf.AddRGBPoint(0.0, 0.230, 0.299, 0.754)\n    ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n    ctf.AddRGBPoint(1.0, 0.706, 0.016, 0.150)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef get_diverging_lut1():\n    colors = vtkNamedColors()\n    # Colour transfer function.\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    p1 = [0.0] + list(colors.GetColor3d('MidnightBlue'))\n    p2 = [0.5] + list(colors.GetColor3d('Gainsboro'))\n    p3 = [1.0] + list(colors.GetColor3d('DarkOrange'))\n    ctf.AddRGBPoint(*p1)\n    ctf.AddRGBPoint(*p2)\n    ctf.AddRGBPoint(*p3)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef get_bour():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricBour()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(0.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(3)\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(subdivide.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_hills():\n    # Create four hills on a plane.\n    # This will have regions of negative, zero and positive Gsaussian curvatures.\n\n    x_res = 50\n    y_res = 50\n    x_min = -5.0\n    x_max = 5.0\n    dx = (x_max - x_min) / (x_res - 1)\n    y_min = -5.0\n    y_max = 5.0\n    dy = (y_max - y_min) / (x_res - 1)\n\n    # Make a grid.\n    points = vtkPoints()\n    for i in range(0, x_res):\n        x = x_min + i * dx\n        for j in range(0, y_res):\n            y = y_min + j * dy\n            points.InsertNextPoint(x, y, 0)\n\n    # Add the grid points to a polydata object.\n    plane = vtkPolyData()\n    plane.SetPoints(points)\n\n    # Triangulate the grid.\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(plane)\n    delaunay.Update()\n\n    polydata = delaunay.GetOutput()\n\n    elevation = vtkDoubleArray()\n    elevation.SetNumberOfTuples(points.GetNumberOfPoints())\n\n    #  We define the parameters for the hills here.\n    # [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n    hd = [[-2.5, -2.5, 2.5, 6.5, 3.5], [2.5, 2.5, 2.5, 2.5, 2],\n          [5.0, -2.5, 1.5, 1.5, 2.5], [-5.0, 5, 2.5, 3.0, 3]]\n    xx = [0.0] * 2\n    for i in range(0, points.GetNumberOfPoints()):\n        x = list(polydata.GetPoint(i))\n        for j in range(0, len(hd)):\n            xx[0] = (x[0] - hd[j][0] / hd[j][2]) ** 2.0\n            xx[1] = (x[1] - hd[j][1] / hd[j][3]) ** 2.0\n            x[2] += hd[j][4] * math.exp(-(xx[0] + xx[1]) / 2.0)\n            polydata.GetPoints().SetPoint(i, x)\n            elevation.SetValue(i, x[2])\n\n    textures = vtkFloatArray()\n    textures.SetNumberOfComponents(2)\n    textures.SetNumberOfTuples(2 * polydata.GetNumberOfPoints())\n    textures.SetName(\"Textures\")\n\n    for i in range(0, x_res):\n        tc = [i / (x_res - 1.0), 0.0]\n        for j in range(0, y_res):\n            # tc[1] = 1.0 - j / (y_res - 1.0)\n            tc[1] = j / (y_res - 1.0)\n            textures.SetTuple(i * y_res + j, tc)\n\n    polydata.GetPointData().SetScalars(elevation)\n    polydata.GetPointData().GetScalars().SetName(\"Elevation\")\n    polydata.GetPointData().SetTCoords(textures)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputData(polydata)\n    normals.SetInputData(polydata)\n    normals.SetFeatureAngle(30)\n    normals.SplittingOff()\n\n    tr1 = vtkTransform()\n    tr1.RotateX(-90)\n\n    tf1 = vtkTransformPolyDataFilter()\n    tf1.SetInputConnection(normals.GetOutputPort())\n    tf1.SetTransform(tr1)\n    tf1.Update()\n\n    return tf1.GetOutput()\n\n\ndef get_enneper():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricEnneper()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(0.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_mobius():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricMobius()\n    surface.SetMinimumV(-0.25)\n    surface.SetMaximumV(0.25)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_random_hills():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricRandomHills()\n    surface.SetRandomSeed(1)\n    surface.SetNumberOfHills(30)\n    # If you want a plane\n    # surface.SetHillAmplitude(0)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(surface.GetOutputPort())\n    tangents.Update()\n\n    return tangents.GetOutput()\n\n\ndef get_torus():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricTorus()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_source(source):\n    surface = source.lower()\n    available_surfaces = ['bour', 'cube', 'enneper', 'hills', 'mobius', 'randomhills', 'sphere', 'torus']\n    if surface not in available_surfaces:\n        return None\n    elif surface == 'bour':\n        return get_bour()\n    elif surface == 'cube':\n        return get_cube()\n    elif surface == 'enneper':\n        return get_enneper()\n    elif surface == 'hills':\n        return get_hills()\n    elif surface == 'mobius':\n        return get_mobius()\n    elif surface == 'randomhills':\n        return get_random_hills()\n    elif surface == 'sphere':\n        return get_sphere()\n    elif surface == 'torus':\n        return get_torus()\n    return None\n\n\ndef get_frequencies(bands, src):\n    \"\"\"\n    Count the number of scalars in each band.\n    The scalars used are the active scalars in the polydata.\n\n    :param: bands - The bands.\n    :param: src - The vtkPolyData source.\n    :return: The frequencies of the scalars in each band.\n    \"\"\"\n    freq = dict()\n    for i in range(len(bands)):\n        freq[i] = 0\n    tuples = src.GetPointData().GetScalars().GetNumberOfTuples()\n    for i in range(tuples):\n        x = src.GetPointData().GetScalars().GetTuple1(i)\n        for j in range(len(bands)):\n            if x <= bands[j][2]:\n                freq[j] += 1\n                break\n    return freq\n\n\ndef adjust_ranges(bands, freq):\n    \"\"\"\n    The bands and frequencies are adjusted so that the first and last\n     frequencies in the range are non-zero.\n    :param bands: The bands dictionary.\n    :param freq: The frequency dictionary.\n    :return: Adjusted bands and frequencies.\n    \"\"\"\n    # Get the indices of the first and last non-zero elements.\n    first = 0\n    for k, v in freq.items():\n        if v != 0:\n            first = k\n            break\n    rev_keys = list(freq.keys())[::-1]\n    last = rev_keys[0]\n    for idx in list(freq.keys())[::-1]:\n        if freq[idx] != 0:\n            last = idx\n            break\n    # Now adjust the ranges.\n    min_key = min(freq.keys())\n    max_key = max(freq.keys())\n    for idx in range(min_key, first):\n        freq.pop(idx)\n        bands.pop(idx)\n    for idx in range(last + 1, max_key + 1):\n        freq.popitem()\n        bands.popitem()\n    old_keys = freq.keys()\n    adj_freq = dict()\n    adj_bands = dict()\n\n    for idx, k in enumerate(old_keys):\n        adj_freq[idx] = freq[k]\n        adj_bands[idx] = bands[k]\n\n    return adj_bands, adj_freq\n\n\ndef get_bands(d_r, number_of_bands, precision=2, nearest_integer=False):\n    \"\"\"\n    Divide a range into bands\n    :param: d_r - [min, max] the range that is to be covered by the bands.\n    :param: number_of_bands - The number of bands, a positive integer.\n    :param: precision - The decimal precision of the bounds.\n    :param: nearest_integer - If True then [floor(min), ceil(max)] is used.\n    :return: A dictionary consisting of the band number and [min, midpoint, max] for each band.\n    \"\"\"\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    bands = dict()\n    if (d_r[1] < d_r[0]) or (number_of_bands <= 0):\n        return bands\n    x = list(d_r)\n    if nearest_integer:\n        x[0] = math.floor(x[0])\n        x[1] = math.ceil(x[1])\n    dx = (x[1] - x[0]) / float(number_of_bands)\n    b = [x[0], x[0] + dx / 2.0, x[0] + dx]\n    i = 0\n    while i < number_of_bands:\n        b = list(map(lambda ele_b: round(ele_b, prec), b))\n        if i == 0:\n            b[0] = x[0]\n        bands[i] = b\n        b = [b[0] + dx, b[1] + dx, b[2] + dx]\n        i += 1\n    return bands\n\n\ndef print_bands_frequencies(bands, freq, precision=2):\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    if len(bands) != len(freq):\n        print('Bands and Frequencies must be the same size.')\n        return\n    s = f'Bands & Frequencies:\\n'\n    total = 0\n    width = prec + 6\n    for k, v in bands.items():\n        total += freq[k]\n        for j, q in enumerate(v):\n            if j == 0:\n                s += f'{k:4d} ['\n            if j == len(v) - 1:\n                s += f'{q:{width}.{prec}f}]: {freq[k]:8d}\\n'\n            else:\n                s += f'{q:{width}.{prec}f}, '\n    width = 3 * width + 13\n    s += f'{\"Total\":{width}s}{total:8d}\\n'\n    print(s)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/PolyData/CurvaturesDemo/","title":"CurvaturesDemo","text":"

vtk-examples/Python/PolyData/CurvaturesDemo

"},{"location":"Python/PolyData/CurvaturesDemo/#description","title":"Description","text":"

How to get the Gaussian and Mean curvatures of a surface.

Two different surfaces are used in this demonstration with each surface coloured according to its Gaussian and Mean curvatures.

  • The first surface is a superquadric surface, this demonstrates the use of extra filters that are needed to get a nice smooth surface.

  • The second surface is a parametric surface, in this case the surface has already been triangulated so no extra processing is necessary.

In order to get a nice coloured image, a vtkColorTransferFunction has been used to generate a set of colours for the vtkLookupTable tables. We have used a diverging colour space. Because of the symmetry of the ranges selected for the lookup tables, the white colouration represents a midpoint value whilst the blue represents values less than the midpoint value and orange represents colours greater than the midpoint value.

In the case of the Random Hills Gaussian curvature surface, this colouration shows the nature of the surface quite nicely. The blue areas are saddle points (negative Gaussian curvature) and the orange areas have a positive Gaussian curvature.

In the case of the mean curvature the blue colouration represents negative curvature perpendicular to one of the principal axes.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/CurvaturesDemo/#code","title":"Code","text":"

CurvaturesDemo.py

#!/usr/bin/env python\n\n\"\"\"\nThe purpose of this is to demonstrate how to get the Gaussian and Mean curvatures of a surface.\n\nTwo different surfaces are used in this demonstration with each surface coloured according\n to its Gaussian and Mean curvatures.\n\nThe first surface is a superquadric surface, this demonstrates the use of extra filters\n that are needed to get a nice smooth surface.\n\nThe second surface is a parametric surface, in this case the surface has already been triangulated\nso no extra processing is necessary.\n\nIn order to get a nice coloured image, a vtkColorTransferFunction has been used to generate\n a set of colours for the vtkLookUp tables. We have used a diverging colour space.\nBecause of the symmetry of the ranges selected for the lookup tables, the white colouration\n represents a midpoint value whilst the blue represents values less than the midopoint value\n and orange represents colours greater than the midpoint value.\n\nIn the case of the Random Hills Gaussian Curvature surface, this colouration shows the nature\n of the surface quite nicely. The blue areas are saddle points (negative Gaussian curvature)\n and the orange areas have a positive Gaussian curvature.\nIn the case of the mean curvature the blue colouration is representing negative curvature\n perpendicular to one of the principal axes.\n\nThis example also demonstrates the use of lists and the linking of the elements of the\n lists together to form a pipeline.\n\n\"\"\"\n\nimport numpy as np\nfrom vtkmodules.numpy_interface import dataset_adapter as dsa\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import vtkParametricRandomHills\nfrom vtkmodules.vtkCommonCore import (\n    VTK_DOUBLE,\n    vtkIdList,\n    vtkLookupTable,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkFeatureEdges,\n    vtkIdFilter,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkCurvatures,\n    vtkTransformFilter\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkParametricFunctionSource,\n    vtkSuperquadricSource\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\nfrom vtk.util import numpy_support\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    # We are going to handle two different sources.\n    # The first source is a superquadric source.\n    torus = vtkSuperquadricSource()\n    torus.SetCenter(0.0, 0.0, 0.0)\n    torus.SetScale(1.0, 1.0, 1.0)\n    torus.SetPhiResolution(64)\n    torus.SetThetaResolution(64)\n    torus.SetThetaRoundness(1)\n    torus.SetThickness(0.5)\n    torus.SetSize(0.5)\n    torus.SetToroidal(1)\n\n    # Rotate the torus towards the observer (around the x-axis)\n    toroid_transform = vtkTransform()\n    toroid_transform.RotateX(55)\n\n    toroid_transform_filter = vtkTransformFilter()\n    toroid_transform_filter.SetInputConnection(torus.GetOutputPort())\n    toroid_transform_filter.SetTransform(toroid_transform)\n\n    # The quadric is made of strips, so pass it through a triangle filter as\n    # the curvature filter only operates on polys\n    tri = vtkTriangleFilter()\n    tri.SetInputConnection(toroid_transform_filter.GetOutputPort())\n\n    # The quadric has nasty discontinuities from the way the edges are generated\n    # so let's pass it though a CleanPolyDataFilter and merge any points which\n    # are coincident, or very close\n\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(tri.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    # The next source will be a parametric function\n    rh = vtkParametricRandomHills()\n    rh_fn_src = vtkParametricFunctionSource()\n    rh_fn_src.SetParametricFunction(rh)\n    rh_fn_src.Update()\n\n    sources = list()\n    for i in range(0, 4):\n        cc = vtkCurvatures()\n        if i < 2:\n            cc.SetInputConnection(cleaner.GetOutputPort())\n        else:\n            cc.SetInputConnection(rh_fn_src.GetOutputPort())\n        if i % 2 == 0:\n            cc.SetCurvatureTypeToGaussian()\n            curvature_name = 'Gauss_Curvature'\n        else:\n            cc.SetCurvatureTypeToMean()\n            curvature_name = 'Mean_Curvature'\n        cc.Update()\n        adjust_edge_curvatures(cc.GetOutput(), curvature_name)\n        sources.append(cc.GetOutput())\n\n    curvatures = {\n        0: 'Gauss_Curvature',\n        1: 'Mean_Curvature',\n        2: 'Gauss_Curvature',\n        3: 'Mean_Curvature',\n    }\n\n    # lut = get_diverging_lut()\n    lut = get_diverging_lut1()\n\n    renderers = list()\n    mappers = list()\n    actors = list()\n    text_mappers = list()\n    text_actors = list()\n    scalar_bars = list()\n\n    # Create a common text property.\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(24)\n    text_property.SetJustificationToCentered()\n\n    # RenderWindow Dimensions\n    #\n    renderer_size = 512\n    grid_dimensions = 2\n    window_width = renderer_size * grid_dimensions\n    window_height = renderer_size * grid_dimensions\n\n    # Link the pipeline together.\n    for idx, source in enumerate(sources):\n        curvature_name = curvatures[idx].replace('_', '\\n')\n\n        source.GetPointData().SetActiveScalars(curvatures[idx])\n        scalar_range = source.GetPointData().GetScalars(curvatures[idx]).GetRange()\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[idx].SetInputData(source)\n        mappers[idx].SetScalarModeToUsePointFieldData()\n        mappers[idx].SelectColorArray(curvatures[idx])\n        mappers[idx].SetScalarRange(scalar_range)\n        mappers[idx].SetLookupTable(lut)\n\n        actors.append(vtkActor())\n        actors[idx].SetMapper(mappers[idx])\n\n        text_mappers.append(vtkTextMapper())\n        text_mappers[idx].SetInput(curvature_name)\n        text_mappers[idx].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[idx].SetMapper(text_mappers[idx])\n        text_actors[idx].SetPosition(250, 16)\n\n        # Create a scalar bar\n        scalar_bars.append(vtkScalarBarActor())\n        scalar_bars[idx].SetLookupTable(mappers[idx].GetLookupTable())\n        scalar_bars[idx].SetTitle(curvature_name)\n        scalar_bars[idx].UnconstrainedFontSizeOn()\n        scalar_bars[idx].SetNumberOfLabels(5)\n        scalar_bars[idx].SetMaximumWidthInPixels(window_width // 8)\n        scalar_bars[idx].SetMaximumHeightInPixels(window_height // 3)\n        scalar_bars[idx].SetBarRatio(scalar_bars[idx].GetBarRatio() * 0.5)\n        scalar_bars[idx].SetPosition(0.85, 0.1)\n\n        renderers.append(vtkRenderer())\n\n    for idx in range(len(sources)):\n        if idx < grid_dimensions * grid_dimensions:\n            renderers.append(vtkRenderer)\n\n    # Create the RenderWindow\n    #\n    render_window = vtkRenderWindow()\n    render_window.SetSize(renderer_size * grid_dimensions, renderer_size * grid_dimensions)\n    render_window.SetWindowName('CurvaturesDemo')\n\n    # Add and position the renders to the render window.\n    viewport = list()\n    for row in range(grid_dimensions):\n        for col in range(grid_dimensions):\n            idx = row * grid_dimensions + col\n\n            viewport[:] = []\n            viewport.append(float(col) / grid_dimensions)\n            viewport.append(float(grid_dimensions - (row + 1)) / grid_dimensions)\n            viewport.append(float(col + 1) / grid_dimensions)\n            viewport.append(float(grid_dimensions - row) / grid_dimensions)\n\n            if idx > (len(sources) - 1):\n                continue\n\n            renderers[idx].SetViewport(viewport)\n            render_window.AddRenderer(renderers[idx])\n\n            renderers[idx].AddActor(actors[idx])\n            renderers[idx].AddActor(text_actors[idx])\n            renderers[idx].AddActor(scalar_bars[idx])\n            renderers[idx].SetBackground(colors.GetColor3d('SlateGray'))\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n    style = vtkInteractorStyleTrackballCamera()\n    interactor.SetInteractorStyle(style)\n\n    render_window.Render()\n\n    interactor.Start()\n\n\ndef get_diverging_lut():\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start point         midPoint            end point\n     cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n     purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n     green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n     blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n     green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n\n    :return:\n    \"\"\"\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    # Cool to warm.\n    ctf.AddRGBPoint(0.0, 0.230, 0.299, 0.754)\n    ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n    ctf.AddRGBPoint(1.0, 0.706, 0.016, 0.150)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef get_diverging_lut1():\n    colors = vtkNamedColors()\n    # Colour transfer function.\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    p1 = [0.0] + list(colors.GetColor3d('MidnightBlue'))\n    p2 = [0.5] + list(colors.GetColor3d('Gainsboro'))\n    p3 = [1.0] + list(colors.GetColor3d('DarkOrange'))\n    ctf.AddRGBPoint(*p1)\n    ctf.AddRGBPoint(*p2)\n    ctf.AddRGBPoint(*p3)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\ndef adjust_edge_curvatures(source, curvature_name, epsilon=1.0e-08):\n    \"\"\"\n    This function adjusts curvatures along the edges of the surface by replacing\n     the value with the average value of the curvatures of points in the neighborhood.\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param epsilon: Absolute curvature values less than this will be set to zero.\n    :return:\n    \"\"\"\n\n    def point_neighbourhood(pt_id):\n        \"\"\"\n        Find the ids of the neighbours of pt_id.\n\n        :param pt_id: The point id.\n        :return: The neighbour ids.\n        \"\"\"\n        \"\"\"\n        Extract the topological neighbors for point pId. In two steps:\n        1) source.GetPointCells(pt_id, cell_ids)\n        2) source.GetCellPoints(cell_id, cell_point_ids) for all cell_id in cell_ids\n        \"\"\"\n        cell_ids = vtkIdList()\n        source.GetPointCells(pt_id, cell_ids)\n        neighbour = set()\n        for cell_idx in range(0, cell_ids.GetNumberOfIds()):\n            cell_id = cell_ids.GetId(cell_idx)\n            cell_point_ids = vtkIdList()\n            source.GetCellPoints(cell_id, cell_point_ids)\n            for cell_pt_idx in range(0, cell_point_ids.GetNumberOfIds()):\n                neighbour.add(cell_point_ids.GetId(cell_pt_idx))\n        return neighbour\n\n    def compute_distance(pt_id_a, pt_id_b):\n        \"\"\"\n        Compute the distance between two points given their ids.\n\n        :param pt_id_a:\n        :param pt_id_b:\n        :return:\n        \"\"\"\n        pt_a = np.array(source.GetPoint(pt_id_a))\n        pt_b = np.array(source.GetPoint(pt_id_b))\n        return np.linalg.norm(pt_a - pt_b)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    #  Get the boundary point IDs.\n    array_name = 'ids'\n    id_filter = vtkIdFilter()\n    id_filter.SetInputData(source)\n    id_filter.SetPointIds(True)\n    id_filter.SetCellIds(False)\n    id_filter.SetPointIdsArrayName(array_name)\n    id_filter.SetCellIdsArrayName(array_name)\n    id_filter.Update()\n\n    edges = vtkFeatureEdges()\n    edges.SetInputConnection(id_filter.GetOutputPort())\n    edges.BoundaryEdgesOn()\n    edges.ManifoldEdgesOff()\n    edges.NonManifoldEdgesOff()\n    edges.FeatureEdgesOff()\n    edges.Update()\n\n    edge_array = edges.GetOutput().GetPointData().GetArray(array_name)\n    boundary_ids = []\n    for i in range(edges.GetOutput().GetNumberOfPoints()):\n        boundary_ids.append(edge_array.GetValue(i))\n    # Remove duplicate Ids.\n    p_ids_set = set(boundary_ids)\n\n    # Iterate over the edge points and compute the curvature as the weighted\n    # average of the neighbours.\n    count_invalid = 0\n    for p_id in boundary_ids:\n        p_ids_neighbors = point_neighbourhood(p_id)\n        # Keep only interior points.\n        p_ids_neighbors -= p_ids_set\n        # Compute distances and extract curvature values.\n        curvs = [curvatures[p_id_n] for p_id_n in p_ids_neighbors]\n        dists = [compute_distance(p_id_n, p_id) for p_id_n in p_ids_neighbors]\n        curvs = np.array(curvs)\n        dists = np.array(dists)\n        curvs = curvs[dists > 0]\n        dists = dists[dists > 0]\n        if len(curvs) > 0:\n            weights = 1 / np.array(dists)\n            weights /= weights.sum()\n            new_curv = np.dot(curvs, weights)\n        else:\n            # Corner case.\n            count_invalid += 1\n            # Assuming the curvature of the point is planar.\n            new_curv = 0.0\n        # Set the new curvature value.\n        curvatures[p_id] = new_curv\n\n    #  Set small values to zero.\n    if epsilon != 0.0:\n        curvatures = np.where(abs(curvatures) < epsilon, 0, curvatures)\n        # Curvatures is now an ndarray\n        curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                          deep=True,\n                                          array_type=VTK_DOUBLE)\n        curv.SetName(curvature_name)\n        source.GetPointData().RemoveArray(curvature_name)\n        source.GetPointData().AddArray(curv)\n        source.GetPointData().SetActiveScalars(curvature_name)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/PolyData/ExtractPolyLinesFromPolyData/","title":"ExtractPolyLinesFromPolyData","text":"

vtk-examples/Python/PolyData/ExtractPolyLinesFromPolyData

"},{"location":"Python/PolyData/ExtractPolyLinesFromPolyData/#description","title":"Description","text":"

This example uses vtkCutter to create contour lines. It processes these lines with vtkStripper to create continuous poly lines. After exiting the example with the \"e\" key, the lines are printed.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/ExtractPolyLinesFromPolyData/#code","title":"Code","text":"

ExtractPolyLinesFromPolyData.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdList\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCutter,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    lineColor = colors.GetColor3d('peacock')\n    modelColor = colors.GetColor3d('silver')\n    backgroundColor = colors.GetColor3d('wheat')\n\n    modelSource = vtkSphereSource()\n\n    plane = vtkPlane()\n\n    cutter = vtkCutter()\n    cutter.SetInputConnection(modelSource.GetOutputPort())\n    cutter.SetCutFunction(plane)\n    cutter.GenerateValues(10, -0.5, 0.5)\n\n    modelMapper = vtkPolyDataMapper()\n    modelMapper.SetInputConnection(modelSource.GetOutputPort())\n\n    model = vtkActor()\n    model.SetMapper(modelMapper)\n    model.GetProperty().SetDiffuseColor(modelColor)\n    model.GetProperty().SetInterpolationToFlat()\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(cutter.GetOutputPort())\n    stripper.JoinContiguousSegmentsOn()\n\n    linesMapper = vtkPolyDataMapper()\n    linesMapper.SetInputConnection(stripper.GetOutputPort())\n\n    lines = vtkActor()\n    lines.SetMapper(linesMapper)\n    lines.GetProperty().SetDiffuseColor(lineColor)\n    lines.GetProperty().SetLineWidth(3.)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('ExtractPolyLinesFromPolyData')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the renderer.\n    renderer.AddActor(model)\n    renderer.AddActor(lines)\n    renderer.SetBackground(backgroundColor)\n    renderer.GetActiveCamera().Azimuth(-45)\n    renderer.GetActiveCamera().Elevation(-22.5)\n    renderer.ResetCamera()\n\n    # This starts the event loop and as a side effect causes an\n    # initial render.\n    renderWindow.Render()\n    interactor.Start()\n\n    # Extract the lines from the polydata.\n    numberOfLines = cutter.GetOutput().GetNumberOfLines()\n\n    print('-----------Lines without using vtkStripper')\n    print('There are {0} lines in the polydata'.format(numberOfLines))\n\n    numberOfLines = stripper.GetOutput().GetNumberOfLines()\n    points = stripper.GetOutput().GetPoints()\n    cells = stripper.GetOutput().GetLines()\n    cells.InitTraversal()\n\n    print('-----------Lines using vtkStripper')\n    print('There are {0} lines in the polydata'.format(numberOfLines))\n\n    indices = vtkIdList()\n    lineCount = 0\n\n    while cells.GetNextCell(indices):\n        print('Line {0}:'.format(lineCount))\n        for i in range(indices.GetNumberOfIds()):\n            point = points.GetPoint(indices.GetId(i))\n            print('\\t({0:0.6f} ,{1:0.6f}, {2:0.6f})'.format(point[0], point[1], point[2]))\n        lineCount += 1\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/ExtractSelection/","title":"ExtractSelection","text":"

vtk-examples/Python/PolyData/ExtractSelection

"},{"location":"Python/PolyData/ExtractSelection/#description","title":"Description","text":"

This example creates 50 random points and extracts 10 of them (the points with ids 10-19).

Also demonstrated is how to invert the selection.

The three actors in the render window display from left to right:

  • all the points
  • the selected points
  • the points not selected.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/ExtractSelection/#code","title":"Code","text":"

ExtractSelection.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdTypeArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkSelection,\n    vtkSelectionNode,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractSelection\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    point_source = vtkPointSource()\n\n    point_source.SetNumberOfPoints(50)\n    point_source.Update()\n\n    print('There are', point_source.GetOutput().GetNumberOfPoints(), 'input points.')\n\n    ids = vtkIdTypeArray()\n    ids.SetNumberOfComponents(1)\n\n    # Set values.\n    for i in range(10, 20):\n        ids.InsertNextValue(i)\n\n    selection_node = vtkSelectionNode()\n    selection_node.SetFieldType(vtkSelectionNode.POINT)\n    selection_node.SetContentType(vtkSelectionNode.INDICES)\n    selection_node.SetSelectionList(ids)\n\n    selection = vtkSelection()\n    selection.AddNode(selection_node)\n\n    extract_selection = vtkExtractSelection()\n    extract_selection.SetInputConnection(0, point_source.GetOutputPort())\n    extract_selection.SetInputData(1, selection)\n    extract_selection.Update()\n\n    # In selection.\n    selected = vtkUnstructuredGrid()\n    selected.ShallowCopy(extract_selection.GetOutput())\n\n    print('There are', selected.GetNumberOfPoints(), 'points and', selected.GetNumberOfCells(),\n          'cells in the selection.')\n\n    # Get points that are NOT in the selection.\n    selection_node.GetProperties().Set(vtkSelectionNode().INVERSE(), 1)  # invert the selection.\n    extract_selection.Update()\n\n    not_selected = vtkUnstructuredGrid()\n    not_selected.ShallowCopy(extract_selection.GetOutput())\n\n    print('There are', not_selected.GetNumberOfPoints(), 'points and', not_selected.GetNumberOfCells(),\n          'cells NOT in the selection.')\n\n    input_mapper = vtkDataSetMapper()\n    input_mapper.SetInputConnection(point_source.GetOutputPort())\n    input_actor = vtkActor()\n    input_actor.SetMapper(input_mapper)\n    input_actor.GetProperty().SetColor(colors.GetColor3d(\"MidnightBlue\"))\n    input_actor.GetProperty().SetPointSize(5)\n\n    selected_mapper = vtkDataSetMapper()\n    selected_mapper.SetInputData(selected)\n\n    selected_actor = vtkActor()\n    selected_actor.SetMapper(selected_mapper)\n    selected_actor.GetProperty().SetColor(colors.GetColor3d(\"MidnightBlue\"))\n    selected_actor.GetProperty().SetPointSize(5)\n\n    not_selected_mapper = vtkDataSetMapper()\n    not_selected_mapper.SetInputData(not_selected)\n\n    not_selected_actor = vtkActor()\n    not_selected_actor.SetMapper(not_selected_mapper)\n    not_selected_actor.GetProperty().SetColor(colors.GetColor3d(\"MidnightBlue\"))\n    not_selected_actor.GetProperty().SetPointSize(5)\n\n    # There will be one render window.\n    render_window = vtkRenderWindow()\n    render_window.SetSize(900, 300)\n    render_window.SetWindowName(\"ExtractSelectedIds\")\n\n    # And one interactor.\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n\n    # Define viewport ranges.\n    # (xmin, ymin, xmax, ymax)\n    left_viewport = [0.0, 0.0, 0.33, 1.0]\n    center_viewport = [0.33, 0.0, 0.66, 1.0]\n    right_viewport = [0.66, 0.0, 1.0, 1.0]\n\n    # Create a camera for all renderers.\n    camera = vtkCamera()\n\n    # Setup the renderers\n    left_renderer = vtkRenderer()\n    render_window.AddRenderer(left_renderer)\n    left_renderer.SetViewport(left_viewport)\n    left_renderer.SetBackground(colors.GetColor3d(\"BurlyWood\"))\n    left_renderer.SetActiveCamera(camera)\n\n    center_renderer = vtkRenderer()\n    render_window.AddRenderer(center_renderer)\n    center_renderer.SetViewport(center_viewport)\n    center_renderer.SetBackground(colors.GetColor3d(\"orchid_dark\"))\n    center_renderer.SetActiveCamera(camera)\n\n    right_renderer = vtkRenderer()\n    render_window.AddRenderer(right_renderer)\n    right_renderer.SetViewport(right_viewport)\n    right_renderer.SetBackground(colors.GetColor3d(\"CornflowerBlue\"))\n    right_renderer.SetActiveCamera(camera)\n\n    left_renderer.AddActor(input_actor)\n    center_renderer.AddActor(selected_actor)\n    right_renderer.AddActor(not_selected_actor)\n\n    left_renderer.ResetCamera()\n\n    render_window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/PolyData/ExtractSelectionCells/","title":"ExtractSelectionCells","text":"

vtk-examples/Python/PolyData/ExtractSelectionCells

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/ExtractSelectionCells/#code","title":"Code","text":"

ExtractSelectionCells.py

#!/usr/bin/env python\n\n'''\nconverted from:\n - http://www.org/Wiki/VTK/Examples/Cxx/PolyData/ExtractSelectionCells\n'''\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdTypeArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkSelection,\n    vtkSelectionNode,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractSelection\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('leftBkg', [0.6, 0.5, 0.4, 1.0])\n    # colors.SetColor('centreBkg', [0.3, 0.1, 0.4, 1.0])\n    # colors.SetColor('rightBkg', [0.4, 0.5, 0.6, 1.0])\n\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    print('There are %s input points' % sphereSource.GetOutput().GetNumberOfPoints())\n    print('There are %s input cells' % sphereSource.GetOutput().GetNumberOfCells())\n\n    ids = vtkIdTypeArray()\n    ids.SetNumberOfComponents(1)\n\n    # Specify that we want to extract cells 10 through 19\n    i = 10\n    while i < 20:\n        ids.InsertNextValue(i)\n        i += 1\n\n    selectionNode = vtkSelectionNode()\n    selectionNode.SetFieldType(vtkSelectionNode.CELL)\n    selectionNode.SetContentType(vtkSelectionNode.INDICES)\n    selectionNode.SetSelectionList(ids)\n\n    selection = vtkSelection()\n    selection.AddNode(selectionNode)\n\n    extractSelection = vtkExtractSelection()\n    extractSelection.SetInputConnection(0, sphereSource.GetOutputPort())\n    extractSelection.SetInputData(1, selection)\n    extractSelection.Update()\n\n    # In selection\n    selected = vtkUnstructuredGrid()\n    selected.ShallowCopy(extractSelection.GetOutput())\n\n    print('There are %s points in the selection' % selected.GetNumberOfPoints())\n    print('There are %s cells in the selection' % selected.GetNumberOfCells())\n\n    # Get points that are NOT in the selection\n    selectionNode.GetProperties().Set(vtkSelectionNode.INVERSE(), 1)  # invert the selection\n    extractSelection.Update()\n\n    notSelected = vtkUnstructuredGrid()\n    notSelected.ShallowCopy(extractSelection.GetOutput())\n\n    print('There are %s points NOT in the selection' % notSelected.GetNumberOfPoints())\n    print('There are %s cells NOT in the selection' % notSelected.GetNumberOfCells())\n\n    backfaces = vtkProperty()\n    backfaces.SetColor(colors.GetColor3d('Gold'))\n\n    inputMapper = vtkDataSetMapper()\n    inputMapper.SetInputConnection(sphereSource.GetOutputPort())\n    inputActor = vtkActor()\n    inputActor.SetMapper(inputMapper)\n    inputActor.SetBackfaceProperty(backfaces)\n    inputActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    selectedMapper = vtkDataSetMapper()\n    selectedMapper.SetInputData(selected)\n\n    selectedActor = vtkActor()\n    selectedActor.SetMapper(selectedMapper)\n    selectedActor.SetBackfaceProperty(backfaces)\n    selectedActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    notSelectedMapper = vtkDataSetMapper()\n    notSelectedMapper.SetInputData(notSelected)\n\n    notSelectedActor = vtkActor()\n    notSelectedActor.SetMapper(notSelectedMapper)\n    notSelectedActor.SetBackfaceProperty(backfaces)\n    notSelectedActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # There will be one render window\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(900, 300)\n    renderWindow.SetWindowName('ExtractSelectionCells')\n\n    # And one interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Define viewport ranges\n    # (xmin, ymin, xmax, ymax)\n    leftViewport = [0.0, 0.0, 0.33, 1.0]\n    centerViewport = [0.33, 0.0, 0.66, 1.0]\n    rightViewport = [0.66, 0.0, 1.0, 1.0]\n\n    # Create a camera for all renderers\n    camera = vtkCamera()\n\n    # Setup the renderers\n    leftRenderer = vtkRenderer()\n    renderWindow.AddRenderer(leftRenderer)\n    leftRenderer.SetViewport(leftViewport)\n    leftRenderer.SetBackground(colors.GetColor3d('BurlyWood'))\n    leftRenderer.SetActiveCamera(camera)\n\n    centerRenderer = vtkRenderer()\n    renderWindow.AddRenderer(centerRenderer)\n    centerRenderer.SetViewport(centerViewport)\n    centerRenderer.SetBackground(colors.GetColor3d('orchid_dark'))\n    centerRenderer.SetActiveCamera(camera)\n\n    rightRenderer = vtkRenderer()\n    renderWindow.AddRenderer(rightRenderer)\n    rightRenderer.SetViewport(rightViewport)\n    rightRenderer.SetBackground(colors.GetColor3d('CornflowerBlue'))\n    rightRenderer.SetActiveCamera(camera)\n\n    leftRenderer.AddActor(inputActor)\n    centerRenderer.AddActor(selectedActor)\n    rightRenderer.AddActor(notSelectedActor)\n\n    leftRenderer.ResetCamera()\n\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/FilledPolygon/","title":"FilledPolygon","text":"

vtk-examples/Python/PolyData/FilledPolygon

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/FilledPolygon/#code","title":"Code","text":"

FilledPolygon.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkPlane,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCutter,\n    vtkFeatureEdges,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a cube\n    cube = vtkSphereSource()\n    cube.SetRadius(50)\n    cube.SetThetaResolution(100)\n    cube.SetPhiResolution(100)\n\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputConnection(cube.GetOutputPort())\n\n    # create a plane to cut,here it cuts in the XZ direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0)\n    plane = vtkPlane()\n    plane.SetOrigin(20, 0, 0)\n    plane.SetNormal(1, 0, 0)\n\n    # create cutter\n    cutter = vtkCutter()\n    cutter.SetCutFunction(plane)\n    cutter.SetInputConnection(cube.GetOutputPort())\n    cutter.Update()\n\n    FeatureEdges = vtkFeatureEdges()\n    FeatureEdges.SetInputConnection(cutter.GetOutputPort())\n    FeatureEdges.BoundaryEdgesOn()\n    FeatureEdges.FeatureEdgesOff()\n    FeatureEdges.NonManifoldEdgesOff()\n    FeatureEdges.ManifoldEdgesOff()\n    FeatureEdges.Update()\n\n    cutStrips = vtkStripper()  # Forms loops (closed polylines) from cutter\n    cutStrips.SetInputConnection(cutter.GetOutputPort())\n    cutStrips.Update()\n    cutPoly = vtkPolyData()  # This trick defines polygons as polyline loop\n    cutPoly.SetPoints((cutStrips.GetOutput()).GetPoints())\n    cutPoly.SetPolys((cutStrips.GetOutput()).GetLines())\n\n    cutMapper = vtkPolyDataMapper()\n    # cutMapper.SetInput(FeatureEdges.GetOutput())\n    cutMapper.SetInputData(cutPoly)\n\n    backface = vtkProperty()\n    backface.SetColor(colors.GetColor3d('Gold'))\n\n    cutActor = vtkActor()\n    cutActor.SetMapper(cutMapper)\n    cutActor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n    cutActor.GetProperty().SetEdgeColor(colors.GetColor3d('Red'))\n    cutActor.GetProperty().SetLineWidth(2)\n    cutActor.GetProperty().EdgeVisibilityOn()\n    # cutActor.GetProperty().SetOpacity(0.7)\n    cutActor.SetBackfaceProperty(backface)\n\n    # create renderers and add actors of plane and cube\n    ren = vtkRenderer()\n    ren.AddActor(cutActor)\n\n    # Add renderer to renderwindow and render\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(600, 400)\n    renWin.SetWindowName('FilledPolygon')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    ren.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    ren.GetActiveCamera().SetPosition(223, -122, -91)\n    renWin.Render()\n\n    camera = ren.GetActiveCamera()\n    camera.SetPosition(151.519511, 12.795117, -223.586044)\n    camera.SetFocalPoint(12.518283, 1.963242, 7.618042)\n    camera.SetViewUp(0.740690, -0.523767, 0.420769)\n    camera.SetDistance(269.988889)\n    camera.SetClippingRange(175.347580, 366.490816)\n    camera.Zoom(1.5)\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/ImplicitPolyDataDistance/","title":"ImplicitPolyDataDistance","text":"

vtk-examples/Python/PolyData/ImplicitPolyDataDistance

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/ImplicitPolyDataDistance/#code","title":"Code","text":"

ImplicitPolyDataDistance.py

#!/usr/bin/env python\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkImplicitPolyDataDistance\nfrom vtkmodules.vtkFiltersGeneral import vtkVertexGlyphFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(1.0)\n    sphereSource.Update()\n\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphereSource.GetOutputPort())\n    sphereMapper.ScalarVisibilityOff()\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor.GetProperty().SetOpacity(0.3)\n    sphereActor.GetProperty().SetColor(1, 0, 0)\n\n    implicitPolyDataDistance = vtkImplicitPolyDataDistance()\n    implicitPolyDataDistance.SetInput(sphereSource.GetOutput())\n\n    # Setup a grid\n    points = vtkPoints()\n    step = 0.1\n    for x in np.arange(-2, 2, step):\n        for y in np.arange(-2, 2, step):\n            for z in np.arange(-2, 2, step):\n                points.InsertNextPoint(x, y, z)\n\n    # Add distances to each point\n    signedDistances = vtkFloatArray()\n    signedDistances.SetNumberOfComponents(1)\n    signedDistances.SetName('SignedDistances')\n\n    # Evaluate the signed distance function at all of the grid points\n    for pointId in range(points.GetNumberOfPoints()):\n        p = points.GetPoint(pointId)\n        signedDistance = implicitPolyDataDistance.EvaluateFunction(p)\n        signedDistances.InsertNextValue(signedDistance)\n\n    polyData = vtkPolyData()\n    polyData.SetPoints(points)\n    polyData.GetPointData().SetScalars(signedDistances)\n\n    vertexGlyphFilter = vtkVertexGlyphFilter()\n    vertexGlyphFilter.SetInputData(polyData)\n    vertexGlyphFilter.Update()\n\n    signedDistanceMapper = vtkPolyDataMapper()\n    signedDistanceMapper.SetInputConnection(vertexGlyphFilter.GetOutputPort())\n    signedDistanceMapper.ScalarVisibilityOn()\n\n    signedDistanceActor = vtkActor()\n    signedDistanceActor.SetMapper(signedDistanceMapper)\n\n    renderer = vtkRenderer()\n    renderer.AddViewProp(sphereActor)\n    renderer.AddViewProp(signedDistanceActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('ImplicitPolyDataDistance')\n\n    renWinInteractor = vtkRenderWindowInteractor()\n    renWinInteractor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    renWinInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/IterateOverLines/","title":"IterateOverLines","text":"

vtk-examples/Python/PolyData/IterateOverLines

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/IterateOverLines/#code","title":"Code","text":"

IterateOverLines.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import (\n    vtkIdList,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\n\n\ndef main():\n    origin = [0.0, 0.0, 0.0]\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [0.0, 1.0, 0.0]\n    p2 = [0.0, 1.0, 2.0]\n    p3 = [1.0, 2.0, 3.0]\n\n    # Create a vtkPoints object and store the points in it.\n    points = vtkPoints()\n    points.InsertNextPoint(origin)\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n\n    # Create a cell array to store the lines in and add the lines to it.\n    lines = vtkCellArray()\n\n    # Create four lines.\n    for i in range(4):\n        line = vtkLine()\n        line.GetPointIds().SetId(0, i)\n        line.GetPointIds().SetId(1, i + 1)\n        lines.InsertNextCell(line)\n\n    # Create a polydata to store everything in.\n    linesPolyData = vtkPolyData()\n\n    # Add the points to the dataset.\n    linesPolyData.SetPoints(points)\n\n    # Add the lines to the dataset.\n    linesPolyData.SetLines(lines)\n\n    print('There are {0} lines.'.format(linesPolyData.GetNumberOfLines()))\n\n    linesPolyData.GetLines().InitTraversal()\n    idList = vtkIdList()\n    while (linesPolyData.GetLines().GetNextCell(idList)):\n        print('Line has {0} points'.format(idList.GetNumberOfIds()))\n        for pointId in range(idList.GetNumberOfIds() - 1):\n            print('{0} {1}'.format(idList.GetId(pointId), idList.GetId(pointId + 1)))\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/Outline/","title":"Outline","text":"

vtk-examples/Python/PolyData/Outline

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/Outline/#code","title":"Code","text":"

Outline.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName('Outline')\n\n    renWin.AddRenderer(ren)\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create source\n    source = vtkConeSource()\n    source.SetCenter(0, 0, 0)\n    source.SetResolution(100)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    # actor\n    actor1 = vtkActor()\n    actor1.SetMapper(mapper)\n    actor1.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(source.GetOutputPort())\n    mapper2 = vtkPolyDataMapper()\n    mapper2.SetInputConnection(outline.GetOutputPort())\n\n    actor2 = vtkActor()\n    actor2.SetMapper(mapper2)\n    actor2.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    # assign actor to the renderer\n    ren.AddActor(actor1)\n    ren.AddActor(actor2)\n    ren.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/PointSource/","title":"PointSource","text":"

vtk-examples/Python/PolyData/PointSource

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/PointSource/#code","title":"Code","text":"

PointSource.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('PointSource')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create a point cloud\n    src = vtkPointSource()\n    src.SetCenter(0, 0, 0)\n    src.SetNumberOfPoints(50)\n    src.SetRadius(5)\n    src.Update()\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(src.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n    actor.GetProperty().SetPointSize(4)\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/PolyDataContourToImageData/","title":"PolyDataContourToImageData","text":"

vtk-examples/Python/PolyData/PolyDataContourToImageData

"},{"location":"Python/PolyData/PolyDataContourToImageData/#description","title":"Description","text":"
  • Contributed by: Lars Friedrich, Peter Gruber

This example generates a sphere, cuts it with a plane and, therefore, generates a circlular contour (vtkPolyData). Subsequently a binary image representation (vtkImageData) is extracted from it. Internally [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ToImageStencil and vtkLinearExtrusionFilter are utilized. Both the circular poly data (circle.vtp) and the resultant image (labelImage.mhd) are saved to disk.

Note

Similarily to example PolyDataToImageStencil, I am not really sure whether or not the image origin needs to be adjusted as the sphere-image-overlay shows some offset in paraview visualization (at least I think ...). Maybe someone could verify that. Thanks!

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/PolyDataContourToImageData/#code","title":"Code","text":"

PolyDataContourToImageData.py

#!/usr/bin/env python\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import VTK_UNSIGNED_CHAR\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkImageData,\n    vtkPlane\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCutter,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersModeling import vtkLinearExtrusionFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkMetaImageWriter,\n    vtkPNGWriter\n)\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\nfrom vtkmodules.vtkImagingStencil import (\n    vtkImageStencil,\n    vtkPolyDataToImageStencil\n)\n\n\ndef main():\n    # 3D source sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.SetPhiResolution(30)\n    sphereSource.SetThetaResolution(30)\n    sphereSource.SetCenter(40, 40, 0)\n    sphereSource.SetRadius(20)\n\n    # generate circle by cutting the sphere with an implicit plane\n    # (through its center, axis-aligned)\n    circleCutter = vtkCutter()\n    circleCutter.SetInputConnection(sphereSource.GetOutputPort())\n    cutPlane = vtkPlane()\n    cutPlane.SetOrigin(sphereSource.GetCenter())\n    cutPlane.SetNormal(0, 0, 1)\n    circleCutter.SetCutFunction(cutPlane)\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(circleCutter.GetOutputPort())  # valid circle\n    stripper.Update()\n\n    # that's our circle\n    circle = stripper.GetOutput()\n\n    # write circle out\n    polyDataWriter = vtkXMLPolyDataWriter()\n    polyDataWriter.SetInputData(circle)\n\n    polyDataWriter.SetFileName('circle.vtp')\n    polyDataWriter.SetCompressorTypeToNone()\n    polyDataWriter.SetDataModeToAscii()\n    polyDataWriter.Write()\n\n    # prepare the binary image's voxel grid\n    whiteImage = vtkImageData()\n    bounds = [0] * 6\n    circle.GetBounds(bounds)\n    spacing = [0] * 3  # desired volume spacing\n    spacing[0] = 0.5\n    spacing[1] = 0.5\n    spacing[2] = 0.5\n    whiteImage.SetSpacing(spacing)\n\n    # compute dimensions\n    dim = [0] * 3\n    for i in range(3):\n        dim[i] = int(math.ceil((bounds[i * 2 + 1] - bounds[i * 2]) / spacing[i])) + 1\n        if dim[i] < 1:\n            dim[i] = 1\n    whiteImage.SetDimensions(dim)\n    whiteImage.SetExtent(0, dim[0] - 1, 0, dim[1] - 1, 0, dim[2] - 1)\n    origin = [0] * 3\n    # NOTE: I am not sure whether or not we had to add some offset!\n    origin[0] = bounds[0]  # + spacing[0] / 2\n    origin[1] = bounds[2]  # + spacing[1] / 2\n    origin[2] = bounds[4]  # + spacing[2] / 2\n    whiteImage.SetOrigin(origin)\n    whiteImage.AllocateScalars(VTK_UNSIGNED_CHAR, 1)\n\n    # fill the image with foreground voxels:\n    inval = 255\n    outval = 0\n    count = whiteImage.GetNumberOfPoints()\n    # for (vtkIdType i = 0 i < count ++i)\n    for i in range(count):\n        whiteImage.GetPointData().GetScalars().SetTuple1(i, inval)\n\n    # sweep polygonal data (this is the important thing with contours!)\n    extruder = vtkLinearExtrusionFilter()\n    extruder.SetInputData(circle)\n    extruder.SetScaleFactor(1.0)\n    # extruder.SetExtrusionTypeToNormalExtrusion()\n    extruder.SetExtrusionTypeToVectorExtrusion()\n    extruder.SetVector(0, 0, 1)\n    extruder.Update()\n\n    # polygonal data -. image stencil:\n    pol2stenc = vtkPolyDataToImageStencil()\n    pol2stenc.SetTolerance(0)  # important if extruder.SetVector(0, 0, 1) !!!\n    pol2stenc.SetInputConnection(extruder.GetOutputPort())\n    pol2stenc.SetOutputOrigin(origin)\n    pol2stenc.SetOutputSpacing(spacing)\n    pol2stenc.SetOutputWholeExtent(whiteImage.GetExtent())\n    pol2stenc.Update()\n\n    # cut the corresponding white image and set the background:\n    imgstenc = vtkImageStencil()\n    imgstenc.SetInputData(whiteImage)\n    imgstenc.SetStencilConnection(pol2stenc.GetOutputPort())\n    imgstenc.ReverseStencilOff()\n    imgstenc.SetBackgroundValue(outval)\n    imgstenc.Update()\n\n    imageWriter = vtkMetaImageWriter()\n    imageWriter.SetFileName('labelImage.mhd')\n    imageWriter.SetInputConnection(imgstenc.GetOutputPort())\n    imageWriter.Write()\n\n    imageWriter = vtkPNGWriter()\n    imageWriter.SetFileName('labelImage.png')\n    imageWriter.SetInputConnection(imgstenc.GetOutputPort())\n    imageWriter.Write()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/PolyDataToImageDataStencil/","title":"PolyDataToImageDataStencil","text":"

vtk-examples/Python/PolyData/PolyDataToImageDataStencil

"},{"location":"Python/PolyData/PolyDataToImageDataStencil/#description","title":"Description","text":"

This is an example from the vtkPolyDataToImageStencil tests. It converts polydata to imagedata and masks the given imagedata.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/PolyDataToImageDataStencil/#code","title":"Code","text":"

PolyDataToImageDataStencil.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCutter,\n    vtkImageAppend,\n    vtkStripper,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import vtkPNGReader\nfrom vtkmodules.vtkImagingStencil import (\n    vtkImageStencil,\n    vtkPolyDataToImageStencil\n)\nfrom vtkmodules.vtkInteractionImage import vtkImageViewer\nfrom vtkmodules.vtkRenderingCore import vtkRenderWindowInteractor\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Converts the polydata to imagedata and masks the given imagedata.'\n    epilogue = '''\n        Contributed by: Peter Gruber\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A filename e.g. fullhead15.png.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    fn = get_program_parameters()\n    # A script to test the stencil filter with a polydata stencil.\n    # Image pipeline\n    reader = vtkPNGReader()\n    reader.SetDataSpacing(0.8, 0.8, 1.5)\n    reader.SetDataOrigin(0.0, 0.0, 0.0)\n    reader.SetFileName(fn)\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(12)\n    sphere.SetThetaResolution(12)\n    sphere.SetCenter(102, 102, 0)\n    sphere.SetRadius(60)\n    triangle = vtkTriangleFilter()\n    triangle.SetInputConnection(sphere.GetOutputPort())\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(triangle.GetOutputPort())\n    dataToStencil = vtkPolyDataToImageStencil()\n    dataToStencil.SetInputConnection(stripper.GetOutputPort())\n    dataToStencil.SetOutputSpacing(0.8, 0.8, 1.5)\n    dataToStencil.SetOutputOrigin(0.0, 0.0, 0.0)\n\n    stencil = vtkImageStencil()\n    stencil.SetInputConnection(reader.GetOutputPort())\n    stencil.SetStencilConnection(dataToStencil.GetOutputPort())\n    stencil.ReverseStencilOn()\n    stencil.SetBackgroundValue(500)\n\n    # test again with a contour\n    reader2 = vtkPNGReader()\n    reader2.SetDataSpacing(0.8, 0.8, 1.5)\n    reader2.SetDataOrigin(0.0, 0.0, 0.0)\n    reader2.SetFileName(fn)\n    plane = vtkPlane()\n    plane.SetOrigin(0, 0, 0)\n    plane.SetNormal(0, 0, 1)\n    cutter = vtkCutter()\n    cutter.SetInputConnection(sphere.GetOutputPort())\n    cutter.SetCutFunction(plane)\n    stripper2 = vtkStripper()\n    stripper2.SetInputConnection(cutter.GetOutputPort())\n    dataToStencil2 = vtkPolyDataToImageStencil()\n    dataToStencil2.SetInputConnection(stripper2.GetOutputPort())\n    dataToStencil2.SetOutputSpacing(0.8, 0.8, 1.5)\n    dataToStencil2.SetOutputOrigin(0.0, 0.0, 0.0)\n    stencil2 = vtkImageStencil()\n    stencil2.SetInputConnection(reader2.GetOutputPort())\n    stencil2.SetStencilConnection(dataToStencil2.GetOutputPort())\n    stencil2.SetBackgroundValue(500)\n\n    imageAppend = vtkImageAppend()\n    imageAppend.SetInputConnection(stencil.GetOutputPort())\n    imageAppend.AddInputConnection(stencil2.GetOutputPort())\n\n    viewer = vtkImageViewer()\n    interator = vtkRenderWindowInteractor()\n    viewer.SetInputConnection(imageAppend.GetOutputPort())\n    viewer.SetupInteractor(interator)\n    viewer.SetZSlice(0)\n    viewer.SetColorWindow(2000)\n    viewer.SetColorLevel(1000)\n    viewer.GetRenderWindow().SetWindowName('PolyDataToImageDataStencil')\n    viewer.Render()\n\n    interator.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/RotationAroundLine/","title":"RotationAroundLine","text":"

vtk-examples/Python/PolyData/RotationAroundLine

"},{"location":"Python/PolyData/RotationAroundLine/#description","title":"Description","text":"

NOTE: this example shows both the original and the rotated object using different colors. Not exactly equivalent to the C++ example with the same name.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/RotationAroundLine/#code","title":"Code","text":"

RotationAroundLine.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkArrowSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('RotationAroundLine')\n\n    # Create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create arrow\n    source = vtkArrowSource()\n\n    # Create a transform that rotates the arrow 45\u00b0 around the z-axis\n    transform = vtkTransform()\n    transform.RotateWXYZ(45, 0, 0, 1)\n    transformFilter = vtkTransformPolyDataFilter()\n    transformFilter.SetTransform(transform)\n    transformFilter.SetInputConnection(source.GetOutputPort())\n    transformFilter.Update()\n\n    # Mapper for the original arrow\n    coneMapper1 = vtkPolyDataMapper()\n    coneMapper1.SetInputConnection(source.GetOutputPort())\n\n    # Another mapper for the rotated arrow\n    coneMapper2 = vtkPolyDataMapper()\n    coneMapper2.SetInputConnection(transformFilter.GetOutputPort())\n\n    # Actor for original arrow\n    actor1 = vtkActor()\n    actor1.SetMapper(coneMapper1)\n\n    # Actor for rotated arrow\n    actor2 = vtkActor()\n    actor2.SetMapper(coneMapper2)\n\n    # Color the original arrow\n    actor1.GetProperty().SetColor(colors.GetColor3d('LightCoral'))\n    # Color rotated arrow\n    actor2.GetProperty().SetColor(colors.GetColor3d('PaleTurquoise'))\n\n    # Assign actor to the renderer\n    ren.AddActor(actor1)\n    ren.AddActor(actor2)\n    ren.SetBackground(colors.GetColor3d('SlateGray'));\n\n    # Enable the user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/RuledSurfaceFilter/","title":"RuledSurfaceFilter","text":"

vtk-examples/Python/PolyData/RuledSurfaceFilter

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/RuledSurfaceFilter/#code","title":"Code","text":"

RuledSurfaceFilter.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersModeling import vtkRuledSurfaceFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    # Create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the points fot the lines.\n    points = vtkPoints()\n    points.InsertPoint(0, 0, 0, 1)\n    points.InsertPoint(1, 1, 0, 0)\n    points.InsertPoint(2, 0, 1, 0)\n    points.InsertPoint(3, 1, 1, 1)\n\n    # Create line1\n    line1 = vtkLine()\n    line1.GetPointIds().SetId(0, 0)\n    line1.GetPointIds().SetId(1, 1)\n\n    # Create line2\n    line2 = vtkLine()\n    line2.GetPointIds().SetId(0, 2)\n    line2.GetPointIds().SetId(1, 3)\n\n    # Create a cellArray containing the lines\n    lines = vtkCellArray()\n    lines.InsertNextCell(line1)\n    lines.InsertNextCell(line2)\n\n    # Create the vtkPolyData to contain the points and cellArray with the lines\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n    polydata.SetLines(lines)\n\n    # Create the ruledSurfaceFilter from the polydata containing the lines\n    ruledSurfaceFilter = vtkRuledSurfaceFilter()\n    ruledSurfaceFilter.SetInputData(polydata)\n    ruledSurfaceFilter.SetResolution(21, 21)\n    ruledSurfaceFilter.SetRuledModeToResample()\n\n    # Create the mapper with the ruledSurfaceFilter as input\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(ruledSurfaceFilter.GetOutputPort())\n\n    # Create the actor with the mapper\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n    actor.GetProperty().SetSpecular(0.6)\n    actor.GetProperty().SetSpecularPower(30)\n\n    # Add the actor to the display\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d(\"SteelBlue\"))\n    renWin.SetWindowName('RuledSurfaceFilter')\n\n    # Enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    # ren.GetActiveCamera().SetPosition(3.7, -0.5, -0.5)\n    # ren.GetActiveCamera().SetFocalPoint(0.5, 0.5, 0.5)\n    # ren.GetActiveCamera().SetViewUp(-0.3, 0.1, -1.0)\n    ren.GetActiveCamera().Azimuth(60)\n    ren.GetActiveCamera().Elevation(60)\n    ren.ResetCamera()\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/SmoothMeshGrid/","title":"SmoothMeshGrid","text":"

vtk-examples/Python/PolyData/SmoothMeshGrid

"},{"location":"Python/PolyData/SmoothMeshGrid/#description","title":"Description","text":"

Create a terrain with regularly spaced points. The triangles are created manually. Then different types of smoothing filters are used to smooth the terrain.

Left : initial terrain, middle : vtkLoopSubdivisionFilter, right : vtkButterflySubdivisionFilter

  • Contributed by Michka Popoff, with the help of Bill Lorensen and madz (madaramh).

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/SmoothMeshGrid/#code","title":"Code","text":"

SmoothMeshGrid.py

#!/usr/bin/env python\n\nimport numpy\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangle\n)\nfrom vtkmodules.vtkFiltersCore import vtkCleanPolyData\nfrom vtkmodules.vtkFiltersModeling import (\n    vtkButterflySubdivisionFilter,\n    vtkLoopSubdivisionFilter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    nc = vtkNamedColors()\n\n    # Make a 32 x 32 grid\n    size = 32\n\n    rn = vtkMinimalStandardRandomSequence()\n    rn.SetSeed(1)\n\n    # Define z values for the topography (random height)\n    topography = numpy.zeros([size, size])\n    for i in range(size):\n        for j in range(size):\n            topography[i][j] = rn.GetRangeValue(0, 5)\n            rn.Next()\n\n    # Define points, triangles and colors\n    colors = vtkUnsignedCharArray()\n    colors.SetNumberOfComponents(3)\n    points = vtkPoints()\n    triangles = vtkCellArray()\n\n    # Build the meshgrid manually\n    count = 0\n    for i in range(size - 1):\n        for j in range(size - 1):\n            z1 = topography[i][j]\n            z2 = topography[i][j + 1]\n            z3 = topography[i + 1][j]\n\n            # Triangle 1\n            points.InsertNextPoint(i, j, z1)\n            points.InsertNextPoint(i, (j + 1), z2)\n            points.InsertNextPoint((i + 1), j, z3)\n\n            triangle = vtkTriangle()\n            triangle.GetPointIds().SetId(0, count)\n            triangle.GetPointIds().SetId(1, count + 1)\n            triangle.GetPointIds().SetId(2, count + 2)\n\n            triangles.InsertNextCell(triangle)\n\n            z1 = topography[i][j + 1]\n            z2 = topography[i + 1][j + 1]\n            z3 = topography[i + 1][j]\n\n            # Triangle 2\n            points.InsertNextPoint(i, (j + 1), z1)\n            points.InsertNextPoint((i + 1), (j + 1), z2)\n            points.InsertNextPoint((i + 1), j, z3)\n\n            triangle = vtkTriangle()\n            triangle.GetPointIds().SetId(0, count + 3)\n            triangle.GetPointIds().SetId(1, count + 4)\n            triangle.GetPointIds().SetId(2, count + 5)\n\n            count += 6\n\n            triangles.InsertNextCell(triangle)\n\n            # Add some color\n            r = [int(i / float(size) * 255), int(j / float(size) * 255), 0]\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n\n    # Create a polydata object\n    trianglePolyData = vtkPolyData()\n\n    # Add the geometry and topology to the polydata\n    trianglePolyData.SetPoints(points)\n    trianglePolyData.GetPointData().SetScalars(colors)\n    trianglePolyData.SetPolys(triangles)\n\n    # Clean the polydata so that the edges are shared !\n    cleanPolyData = vtkCleanPolyData()\n    cleanPolyData.SetInputData(trianglePolyData)\n\n    # Use a filter to smooth the data (will add triangles and smooth)\n    # Use two different filters to show the difference\n    smooth_loop = vtkLoopSubdivisionFilter()\n    smooth_loop.SetNumberOfSubdivisions(3)\n    smooth_loop.SetInputConnection(cleanPolyData.GetOutputPort())\n    smooth_butterfly = vtkButterflySubdivisionFilter()\n    smooth_butterfly.SetNumberOfSubdivisions(3)\n    smooth_butterfly.SetInputConnection(cleanPolyData.GetOutputPort())\n\n    # Create a mapper and actor for initial dataset\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(trianglePolyData)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create a mapper and actor for smoothed dataset (vtkLoopSubdivisionFilter)\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(smooth_loop.GetOutputPort())\n    actor_loop = vtkActor()\n    actor_loop.SetMapper(mapper)\n    actor_loop.SetPosition(32, 0, 0)\n\n    # Create a mapper and actor for smoothed dataset (vtkButterflySubdivisionFilter)\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(smooth_butterfly.GetOutputPort())\n    actor_butterfly = vtkActor()\n    actor_butterfly.SetMapper(mapper)\n    actor_butterfly.SetPosition(64, 0, 0)\n\n    # Visualise\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add actors and render\n    renderer.AddActor(actor)\n    renderer.AddActor(actor_loop)\n    renderer.AddActor(actor_butterfly)\n    renderer.SetBackground(nc.GetColor3d('AliceBlue'))\n\n    renderWindow.SetSize(900, 300)\n    renderWindow.Render()\n    renderer.GetActiveCamera().Elevation(-45)\n    renderer.GetActiveCamera().Zoom(3)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/SolidColoredTriangle/","title":"SolidColoredTriangle","text":"

vtk-examples/Python/PolyData/SolidColoredTriangle

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/SolidColoredTriangle/#code","title":"Code","text":"

SolidColoredTriangle.py

#!/usr/bin/env python\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangle\n)\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate a solid colored triangle and write it to a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestSolidColorTriangle.vtp',\n                        type=str, default='TestSolidColorTriangle.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    # setup points and vertices\n    Points = vtkPoints()\n    Triangles = vtkCellArray()\n\n    Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    Triangle = vtkTriangle()\n    Triangle.GetPointIds().SetId(0, 0)\n    Triangle.GetPointIds().SetId(1, 1)\n    Triangle.GetPointIds().SetId(2, 2)\n    Triangles.InsertNextCell(Triangle)\n\n    # Setup colors (setting the name to \"Colors\" is nice but not necessary)\n    Colors = vtkUnsignedCharArray()\n    Colors.SetNumberOfComponents(3)\n    Colors.SetName(\"Colors\")\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Red'))\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.SetPolys(Triangles)\n\n    polydata.GetCellData().SetScalars(Colors)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/TriangleColoredPoints/","title":"TriangleColoredPoints","text":"

vtk-examples/Python/PolyData/TriangleColoredPoints

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/TriangleColoredPoints/#code","title":"Code","text":"

TriangleColoredPoints.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate a triangle with colored points and write it to a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestTriangleColoredPoints.vtp',\n                        type=str, default='TestTriangleColoredPoints.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    # setup points and vertices\n    Points = vtkPoints()\n    Vertices = vtkCellArray()\n\n    id = Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n    id = Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n    id = Points.InsertNextPoint(0.0, 1.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n\n    # setup colors\n    Colors = vtkUnsignedCharArray()\n    Colors.SetNumberOfComponents(3)\n    Colors.SetName(\"Colors\")\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Red'))\n    Colors.InsertNextTuple3(*colors.GetColor3ub('LimeGreen'))\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Blue'))\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.SetVerts(Vertices)\n    polydata.GetPointData().SetScalars(Colors)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/TriangleCornerVertices/","title":"TriangleCornerVertices","text":"

vtk-examples/Python/PolyData/TriangleCornerVertices

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/TriangleCornerVertices/#code","title":"Code","text":"

TriangleCornerVertices.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate triangle polydata, then write a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestTriangleCornerVertices.vtp',\n                        type=str, default='TestTriangleCornerVertices.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filename = get_program_parameters()\n\n    Points = vtkPoints()\n    Vertices = vtkCellArray()\n\n    id = Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n    id = Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n    id = Points.InsertNextPoint(0.0, 1.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.SetVerts(Vertices)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/TriangleCorners/","title":"TriangleCorners","text":"

vtk-examples/Python/PolyData/TriangleCorners

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/TriangleCorners/#code","title":"Code","text":"

TriangleCorners.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate triangle points, then write a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestTriangleCorners.vtp',\n                        type=str, default='TestTriangleCorners.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filename = get_program_parameters()\n\n    Points = vtkPoints()\n    Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/TubeFilter/","title":"TubeFilter","text":"

vtk-examples/Python/PolyData/TubeFilter

"},{"location":"Python/PolyData/TubeFilter/#description","title":"Description","text":"

This example creates a tube around a line. This is helpful because when you zoom the camera, the thickness of a line remains constant, while the thickness of a tube varies.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/TubeFilter/#code","title":"Code","text":"

TubeFilter.py

#!/usr/bin/env python\n\n# This example creates a tube around a line.\n# This is helpful because when you zoom the camera, \n# the thickness of a line remains constant, \n# while the thickness of a tube varies.\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a line\n    lineSource = vtkLineSource()\n    lineSource.SetPoint1(1.0, 0.0, 0.0)\n    lineSource.SetPoint2(.0, 1.0, 0.0)\n\n    # Setup actor and mapper\n    lineMapper = vtkPolyDataMapper()\n    lineMapper.SetInputConnection(lineSource.GetOutputPort())\n\n    lineActor = vtkActor()\n    lineActor.SetMapper(lineMapper)\n    lineActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    # Create tube filter\n    tubeFilter = vtkTubeFilter()\n    tubeFilter.SetInputConnection(lineSource.GetOutputPort())\n    tubeFilter.SetRadius(0.025)\n    tubeFilter.SetNumberOfSides(50)\n    tubeFilter.Update()\n\n    # Setup actor and mapper\n    tubeMapper = vtkPolyDataMapper()\n    tubeMapper.SetInputConnection(tubeFilter.GetOutputPort())\n\n    tubeActor = vtkActor()\n    tubeActor.SetMapper(tubeMapper)\n    # Make the tube have some transparency.\n    tubeActor.GetProperty().SetOpacity(0.5)\n\n    # Setup render window, renderer, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('TubeFilter')\n    renderWindow.AddRenderer(renderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    # Visualise the arrow\n    renderer.AddActor(lineActor)\n    renderer.AddActor(tubeActor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renderer.ResetCamera()\n\n    renderWindow.SetSize(300, 300)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/PolyData/WarpVector/","title":"WarpVector","text":"

vtk-examples/Python/PolyData/WarpVector

"},{"location":"Python/PolyData/WarpVector/#description","title":"Description","text":"

This script creates a vtkLine and deflects it using a vtkWarpVector.

Other languages

See (Cxx), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/PolyData/WarpVector/#code","title":"Code","text":"

WarpVector.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpVector\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(2.0, 0.0, 0.0)\n    points.InsertNextPoint(3.0, 0.0, 0.0)\n    points.InsertNextPoint(4.0, 0.0, 0.0)\n\n    lines = vtkCellArray()\n    line = vtkLine()\n    line.GetPointIds().SetId(0, 0)\n    line.GetPointIds().SetId(1, 1)\n    lines.InsertNextCell(line)\n    line.GetPointIds().SetId(0, 1)\n    line.GetPointIds().SetId(1, 2)\n    lines.InsertNextCell(line)\n    line.GetPointIds().SetId(0, 2)\n    line.GetPointIds().SetId(1, 3)\n    lines.InsertNextCell(line)\n    line.GetPointIds().SetId(0, 3)\n    line.GetPointIds().SetId(1, 4)\n    lines.InsertNextCell(line)\n\n    warpData = vtkDoubleArray()\n    warpData.SetNumberOfComponents(3)\n    warpData.SetName(\"warpData\")\n    warp = [0.0, 0.0, 0.0]\n    warp[1] = 0.0\n    warpData.InsertNextTuple(warp)\n    warp[1] = 0.1\n    warpData.InsertNextTuple(warp)\n    warp[1] = 0.3\n    warpData.InsertNextTuple(warp)\n    warp[1] = 0.0\n    warpData.InsertNextTuple(warp)\n    warp[1] = 0.1\n    warpData.InsertNextTuple(warp)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n    polydata.SetLines(lines)\n    polydata.GetPointData().AddArray(warpData)\n    polydata.GetPointData().SetActiveVectors(warpData.GetName())\n\n    # WarpVector will use the array marked as active vector in polydata\n    # it has to be a 3 component array\n    # with the same number of tuples as points in polydata\n    warpVector = vtkWarpVector()\n    warpVector.SetInputData(polydata)\n    warpVector.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(warpVector.GetPolyDataOutput())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('cobalt_green'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('WarpVector')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/RectilinearGrid/RGrid/","title":"RGrid","text":"

vtk-examples/Python/RectilinearGrid/RGrid

"},{"location":"Python/RectilinearGrid/RGrid/#description","title":"Description","text":"

Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray.

Info

See Figure 5-20 in Chapter 5 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/RectilinearGrid/RGrid/#code","title":"Code","text":"

RGrid.py

#!/usr/bin/env python\n\n\"\"\"\nThis example shows how to create a rectilinear grid.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkRectilinearGrid\nfrom vtkmodules.vtkFiltersGeometry import vtkRectilinearGridGeometryFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    x = [-1.22396, -1.17188, -1.11979, -1.06771, -1.01562, -0.963542, -0.911458, -0.859375, -0.807292, -0.755208,\n         -0.703125, -0.651042, -0.598958, -0.546875, -0.494792, -0.442708, -0.390625, -0.338542, -0.286458, -0.234375,\n         -0.182292, -0.130209, -0.078125, -0.026042, 0.0260415, 0.078125, 0.130208, 0.182291, 0.234375, 0.286458,\n         0.338542, 0.390625, 0.442708, 0.494792, 0.546875, 0.598958, 0.651042, 0.703125, 0.755208, 0.807292, 0.859375,\n         0.911458, 0.963542, 1.01562, 1.06771, 1.11979, 1.17188]\n    y = [-1.25, -1.17188, -1.09375, -1.01562, -0.9375, -0.859375, -0.78125, -0.703125, -0.625, -0.546875, -0.46875,\n         -0.390625, -0.3125, -0.234375, -0.15625, -0.078125, 0, 0.078125, 0.15625, 0.234375, 0.3125, 0.390625, 0.46875,\n         0.546875, 0.625, 0.703125, 0.78125, 0.859375, 0.9375, 1.01562, 1.09375, 1.17188, 1.25]\n    z = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.75, 1.8, 1.9, 2,\n         2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.75, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.75, 3.8, 3.9]\n    print(len(x), len(y), len(z))\n\n    # Create a rectilinear grid by defining three arrays specifying the\n    # coordinates in the x-y-z directions.\n    xCoords = vtkDoubleArray()\n    for i in range(0, len(x)):\n        xCoords.InsertNextValue(x[i])\n    yCoords = vtkDoubleArray()\n    for i in range(0, len(y)):\n        yCoords.InsertNextValue(y[i])\n    zCoords = vtkDoubleArray()\n    for i in range(0, len(z)):\n        zCoords.InsertNextValue(z[i])\n\n    # The coordinates are assigned to the rectilinear grid. Make sure that\n    # the number of values in each of the XCoordinates, YCoordinates,\n    # and ZCoordinates is equal to what is defined in SetDimensions().\n    #\n    rgrid = vtkRectilinearGrid()\n    rgrid.SetDimensions(len(x), len(y), len(z))\n    rgrid.SetXCoordinates(xCoords)\n    rgrid.SetYCoordinates(yCoords)\n    rgrid.SetZCoordinates(zCoords)\n\n    # Extract a plane from the grid to see what we've got.\n    plane = vtkRectilinearGridGeometryFilter()\n    plane.SetInputData(rgrid)\n    plane.SetExtent(0, len(x) - 1, 16, 16, 0, len(z) - 1)\n\n    rgridMapper = vtkPolyDataMapper()\n    rgridMapper.SetInputConnection(plane.GetOutputPort())\n\n    wireActor = vtkActor()\n    wireActor.SetMapper(rgridMapper)\n    wireActor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n    wireActor.GetProperty().EdgeVisibilityOn()\n\n    # Create the usual rendering stuff.\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    renderer.AddActor(wireActor)\n    renderer.SetBackground(colors.GetColor3d(\"Beige\"))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(60.0)\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.GetActiveCamera().Zoom(1.0)\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('RGrid')\n\n    # Interact with the data.\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
"},{"location":"Python/RectilinearGrid/RectilinearGrid/","title":"RectilinearGrid","text":"

vtk-examples/Python/RectilinearGrid/RectilinearGrid

"},{"location":"Python/RectilinearGrid/RectilinearGrid/#description","title":"Description","text":"

Shows how to create a vtkRectilinearGrid.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/RectilinearGrid/RectilinearGrid/#code","title":"Code","text":"

RectilinearGrid.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkRectilinearGrid\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a grid\n    grid = vtkRectilinearGrid()\n    grid.SetDimensions(2, 3, 1)\n\n    xArray = vtkDoubleArray()\n    xArray.InsertNextValue(0.0)\n    xArray.InsertNextValue(2.0)\n\n    yArray = vtkDoubleArray()\n    yArray.InsertNextValue(0.0)\n    yArray.InsertNextValue(1.0)\n    yArray.InsertNextValue(2.0)\n\n    zArray = vtkDoubleArray()\n    zArray.InsertNextValue(0.0)\n\n    grid.SetXCoordinates(xArray)\n    grid.SetYCoordinates(yArray)\n    grid.SetZCoordinates(zArray)\n\n    print('There are', grid.GetNumberOfPoints(), 'points.')\n    print('There are', grid.GetNumberOfCells(), 'cells.')\n\n    for id in range(0, grid.GetNumberOfPoints()):\n        p = [0] * 3\n        p = grid.GetPoint(id)\n        print('Point', id, ':(', p[0], ',', p[1], ',', p[2], ')')\n\n    # Create a mapper and actor\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(grid)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('RectilinearGrid')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/RectilinearGrid/VisualizeRectilinearGrid/","title":"VisualizeRectilinearGrid","text":"

vtk-examples/Python/RectilinearGrid/VisualizeRectilinearGrid

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/RectilinearGrid/VisualizeRectilinearGrid/#code","title":"Code","text":"

VisualizeRectilinearGrid.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkRectilinearGrid\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a grid    \n    grid = vtkRectilinearGrid()\n\n    grid.SetDimensions(2, 3, 2)\n\n    xArray = vtkDoubleArray()\n    xArray.InsertNextValue(0.0)\n    xArray.InsertNextValue(2.0)\n\n    yArray = vtkDoubleArray()\n    yArray.InsertNextValue(0.0)\n    yArray.InsertNextValue(1.0)\n    yArray.InsertNextValue(2.0)\n\n    zArray = vtkDoubleArray()\n    zArray.InsertNextValue(0.0)\n    zArray.InsertNextValue(5.0)\n\n    grid.SetXCoordinates(xArray)\n    grid.SetYCoordinates(yArray)\n    grid.SetZCoordinates(zArray)\n\n    shrinkFilter = vtkShrinkFilter()\n    shrinkFilter.SetInputData(grid)\n    shrinkFilter.SetShrinkFactor(.8)\n\n    # Create a mapper and actor\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(shrinkFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('VisualizeRectilinearGrid')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderer.GetActiveCamera().Roll(10.0)\n    renderer.GetActiveCamera().Elevation(60.0)\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.ResetCamera()\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/AmbientSpheres/","title":"AmbientSpheres","text":"

vtk-examples/Python/Rendering/AmbientSpheres

"},{"location":"Python/Rendering/AmbientSpheres/#description","title":"Description","text":"

Note

This original source code for this example is here.

Info

Similar examples setting the diffuse and specular properties are: See DiffuseSpheres.cxx, DiffuseSpheres.py and SpecularSpheres.cxx, SpecularSpheres.py.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/AmbientSpheres/#code","title":"Code","text":"

AmbientSpheres.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('bkg', [26, 51, 102, 255])\n\n    # The following lines create a sphere represented by polygons.\n    #\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(100)\n    sphere.SetPhiResolution(50)\n\n    # The mapper is responsible for pushing the geometry into the graphics\n    # library. It may also do color mapping, if scalars or other attributes\n    # are defined.\n    #\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    # The actor is a grouping mechanism: besides the geometry (mapper), it\n    # also has a property, transformation matrix, and/or texture map.\n    # In this example we create eight different spheres (two rows of four\n    # spheres) and set the ambient lighting coefficients. A little ambient\n    # is turned on so the sphere is not completely black on the back side.\n    #\n    numberOfSpheres = 8\n    spheres = list()\n    ambient = 0.125\n    diffuse = 0.0\n    specular = 0.0\n    position = [0, 0, 0]\n    for i in range(0, numberOfSpheres):\n        spheres.append(vtkActor())\n        spheres[i].SetMapper(sphereMapper)\n        spheres[i].GetProperty().SetColor(colors.GetColor3d('Red'))\n        spheres[i].GetProperty().SetAmbient(ambient)\n        spheres[i].GetProperty().SetDiffuse(diffuse)\n        spheres[i].GetProperty().SetSpecular(specular)\n        spheres[i].AddPosition(position)\n        ambient += 0.125\n        position[0] += 1.25\n        if i == 3:\n            position[0] = 0\n            position[1] = 1.25\n\n    # Create the graphics structure. The renderer renders into the\n    # render window. The render window interactor captures mouse events\n    # and will perform appropriate camera or actor manipulation\n    # depending on the nature of the events.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    for i in range(0, numberOfSpheres):\n        ren.AddActor(spheres[i])\n\n    ren.SetBackground(colors.GetColor3d('bkg'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('AmbientSpheres')\n\n    # Set up the lighting.\n    #\n    light = vtkLight()\n    light.SetFocalPoint(1.875, 0.6125, 0)\n    light.SetPosition(0.875, 1.6125, 1)\n    ren.AddLight(light)\n\n    # We want to eliminate perspective effects on the apparent lighting.\n    # Parallel camera projection will be used. To zoom in parallel projection\n    # mode, the ParallelScale is set.\n    #\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    ren.GetActiveCamera().SetPosition(0, 0, 1)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.GetActiveCamera().ParallelProjectionOn()\n    ren.ResetCamera()\n    ren.GetActiveCamera().SetParallelScale(2.0)\n    # This starts the event loop and invokes an initial render.\n    #\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/CameraBlur/","title":"CameraBlur","text":"

vtk-examples/Python/Rendering/CameraBlur

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/CameraBlur/#code","title":"Code","text":"

CameraBlur.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('Bkg', [26, 51, 102, 255])\n\n    # Create the rendering objects.\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline, ball and spikes.\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(7)\n    sphere.SetThetaResolution(7)\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor2 = vtkActor()\n    sphereActor2.SetMapper(sphereMapper)\n\n    cone = vtkConeSource()\n    cone.SetResolution(5)\n    glyph = vtkGlyph3D()\n    glyph.SetInputConnection(sphere.GetOutputPort())\n    glyph.SetSourceConnection(cone.GetOutputPort())\n    glyph.SetVectorModeToUseNormal()\n    glyph.SetScaleModeToScaleByVector()\n    glyph.SetScaleFactor(0.25)\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(glyph.GetOutputPort())\n    spikeActor = vtkActor()\n    spikeActor.SetMapper(spikeMapper)\n    spikeActor2 = vtkActor()\n    spikeActor2.SetMapper(spikeMapper)\n\n    spikeActor.SetPosition(0, 0.7, 0)\n    sphereActor.SetPosition(0, 0.7, 0)\n    spikeActor2.SetPosition(0, -1.0, -10)\n    sphereActor2.SetPosition(0, -1.0, -10)\n    spikeActor2.SetScale(1.5, 1.5, 1.5)\n    sphereActor2.SetScale(1.5, 1.5, 1.5)\n\n    ren1.AddActor(sphereActor)\n    ren1.AddActor(spikeActor)\n    ren1.AddActor(sphereActor2)\n    ren1.AddActor(spikeActor2)\n    ren1.SetBackground(colors.GetColor3d('Bkg'))\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('CameraBlur')\n\n    # Do the first render and then zoom in a little.\n    renWin.Render()\n    ren1.GetActiveCamera().SetFocalPoint(0, 0, 0.0)\n    ren1.GetActiveCamera().Zoom(1.8)\n    ren1.GetActiveCamera().SetFocalDisk(0.05)\n\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/ColoredSphere/","title":"ColoredSphere","text":"

vtk-examples/Python/Rendering/ColoredSphere

"},{"location":"Python/Rendering/ColoredSphere/#description","title":"Description","text":"

This demonstrates a simple visualization pipeline. A polygonal representation of a sphere is created with the source object (vtkSphereSource). The sphere is passed through a filter (vtkElevationFilter) that computes the height of each point of the sphere above a plane. The plane is perpendicular to the z-axis, and passes through the point (0,0,-1). The data is finally mapped (vtkDataSetMapper) through a lookup table. The mapping process converts height value into colors, and interfaces the sphere geometry to the rendering library. The mapper is assigned to an actor, and then the actor is displayed.

The execution of the pipeline occurs implicitly when we render the actor. Each actor asks its mapper to update itself. The mapper in turn asks its input to update itself. This process continues until a source object is encountered. Then the source will execute if modified since the last render.

Info

See Figure 4-19 in Chapter 4 the VTK Textbook.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/ColoredSphere/#code","title":"Code","text":"

ColoredSphere.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(12)\n    sphere.SetThetaResolution(12)\n\n    colorIt = vtkElevationFilter()\n    colorIt.SetInputConnection(sphere.GetOutputPort())\n    colorIt.SetLowPoint(0, 0, -1)\n    colorIt.SetHighPoint(0, 0, 1)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(colorIt.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('ColoredSphere')\n\n    renWin.Render()\n\n    # Interact with the data.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/Cone3/","title":"Cone3","text":"

vtk-examples/Python/Rendering/Cone3

"},{"location":"Python/Rendering/Cone3/#description","title":"Description","text":"

Info

See Figure 3-27 in Chapter 3 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/Cone3/#code","title":"Code","text":"

Cone3.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#\n# This example demonstrates how to use multiple renderers within a\n# render window. It is a variation of the Cone1.py example. Please\n# refer to that example for additional documentation.\n#\n\nimport time\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource 'cone' is part of a visualization\n    # pipeline (it is a source process object); it produces data (output type is\n    # vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the cone. The actor orchestrates rendering of\n    # the mapper's graphics primitives. An actor also refers to properties via a\n    # vtkProperty instance, and includes an internal transformation matrix. We\n    # set this actor's mapper to be coneMapper which we created above.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n\n    #\n    # Create two renderers and assign actors to them. A renderer renders into a\n    # viewport within the vtkRenderWindow. It is part or all of a window on the\n    # screen and it is responsible for drawing the actors it has.  We also set\n    # the background color here. In this example we are adding the same actor\n    # to two different renderers; it is okay to add different actors to\n    # different renderers as well.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    ren2 = vtkRenderer()\n    ren2.AddActor(coneActor)\n    ren2.SetBackground(colors.GetColor3d('LightSlateGray'))\n    ren2.SetViewport(0.5, 0.0, 1.0, 1.0)\n\n    #\n    # Finally we create the render window which will show up on the screen.\n    # We add our two renderers into the render window using AddRenderer. We also\n    # set the size to be 600 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.AddRenderer(ren2)\n    renWin.SetSize(600, 300)\n    renWin.SetWindowName('Cone3')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # Make one camera view 90 degrees from the other.\n    #\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Azimuth(90)\n\n    #\n    # Now we loop over 60 degrees and render the cone each time.\n    #\n    for i in range(0, 60):\n        time.sleep(0.03)\n\n        renWin.Render()\n        ren1.GetActiveCamera().Azimuth(1)\n        ren2.GetActiveCamera().Azimuth(1)\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/Cone4/","title":"Cone4","text":"

vtk-examples/Python/Rendering/Cone4

"},{"location":"Python/Rendering/Cone4/#description","title":"Description","text":"

This example modifies vtkActor's properties and transformation matrix.

Info

See Figure 3-28 in Chapter 3 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/Cone4/#code","title":"Code","text":"

Cone4.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport time\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource 'cone' is part of a visualization\n    # pipeline (it is a source process object); it produces data (output type is\n    # vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the first cone. The actor's properties are\n    # modified to give it different surface properties. By default, an actor\n    # is create with a property so the GetProperty() method can be used.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n    coneActor.GetProperty().SetDiffuse(0.7)\n    coneActor.GetProperty().SetSpecular(0.4)\n    coneActor.GetProperty().SetSpecularPower(20)\n\n    #\n    # Create a property and directly manipulate it. Assign it to the\n    # second actor.\n    #\n    property = vtkProperty()\n    property.SetColor(colors.GetColor3d('Tomato'))\n    property.SetDiffuse(0.7)\n    property.SetSpecular(0.4)\n    property.SetSpecularPower(20)\n\n    #\n    # Create a second actor and a property. The property is directly\n    # manipulated and then assigned to the actor. In this way, a single\n    # property can be shared among many actors. Note also that we use the\n    # same mapper as the first actor did. This way we avoid duplicating\n    # geometry, which may save lots of memory if the geometry is large.\n    coneActor2 = vtkActor()\n    coneActor2.SetMapper(coneMapper)\n    # coneActor2.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n    coneActor2.SetProperty(property)\n    coneActor2.SetPosition(0, 2, 0)\n\n    #\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is responsible\n    # for drawing the actors it has.  We also set the background color here.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.AddActor(coneActor2)\n    ren1.SetBackground(colors.GetColor3d('LightSlateGray'))\n\n    #\n    # Finally we create the render window which will show up on the screen\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('Cone4')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # Now we loop over 60 degrees and render the cone each time.\n    #\n    ren1.GetActiveCamera().Elevation(30)\n    ren1.ResetCamera()\n    for i in range(0, 60):\n        time.sleep(0.03)\n\n        renWin.Render()\n        ren1.GetActiveCamera().Azimuth(1)\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/DiffuseSpheres/","title":"DiffuseSpheres","text":"

vtk-examples/Python/Rendering/DiffuseSpheres

"},{"location":"Python/Rendering/DiffuseSpheres/#description","title":"Description","text":"

Note

This original source code for this example is here.

Info

Similar examples setting the ambient and specular properties are: See AmbientSpheres.cxx, AmbientSpheres.py, AmbientSpheres.java and SpecularSpheres.cxx, SpecularSpheres.py.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/DiffuseSpheres/#code","title":"Code","text":"

DiffuseSpheres.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('bkg', [26, 51, 102, 255])\n\n    # The following lines create a sphere represented by polygons.\n    #\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(100)\n    sphere.SetPhiResolution(50)\n\n    # The mapper is responsible for pushing the geometry into the graphics\n    # library. It may also do color mapping, if scalars or other attributes\n    # are defined.\n    #\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    # The actor is a grouping mechanism: besides the geometry (mapper), it\n    # also has a property, transformation matrix, and/or texture map.\n    # In this example we create eight different spheres (two rows of four\n    # spheres) and set the diffuse lighting coefficients. A little ambient\n    # is turned on so the sphere is not completely black on the back side.\n    #\n    numberOfSpheres = 8\n    spheres = list()\n    ambient = 0.3\n    diffuse = 0.0\n    specular = 0.0\n    position = [0, 0, 0]\n    for i in range(0, numberOfSpheres):\n        spheres.append(vtkActor())\n        spheres[i].SetMapper(sphereMapper)\n        spheres[i].GetProperty().SetColor(colors.GetColor3d('Red'))\n        spheres[i].GetProperty().SetAmbient(ambient)\n        spheres[i].GetProperty().SetDiffuse(diffuse)\n        spheres[i].GetProperty().SetSpecular(specular)\n        spheres[i].AddPosition(position)\n        diffuse += 0.125\n        position[0] += 1.25\n        if i == 3:\n            position[0] = 0\n            position[1] = 1.25\n\n    # Create the graphics structure. The renderer renders into the\n    # render window. The render window interactor captures mouse events\n    # and will perform appropriate camera or actor manipulation\n    # depending on the nature of the events.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    for i in range(0, numberOfSpheres):\n        ren.AddActor(spheres[i])\n\n    ren.SetBackground(colors.GetColor3d('bkg'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('DiffuseSpheres')\n\n    # Set up the lighting.\n    #\n    light = vtkLight()\n    light.SetFocalPoint(1.875, 0.6125, 0)\n    light.SetPosition(0.875, 1.6125, 1)\n    ren.AddLight(light)\n\n    # We want to eliminate perspective effects on the apparent lighting.\n    # Parallel camera projection will be used. To zoom in parallel projection\n    # mode, the ParallelScale is set.\n    #\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    ren.GetActiveCamera().SetPosition(0, 0, 1)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.GetActiveCamera().ParallelProjectionOn()\n    ren.ResetCamera()\n    ren.GetActiveCamera().SetParallelScale(2.0)\n    # This starts the event loop and invokes an initial render.\n    #\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/FlatVersusGouraud/","title":"FlatVersusGouraud","text":"

vtk-examples/Python/Rendering/FlatVersusGouraud

"},{"location":"Python/Rendering/FlatVersusGouraud/#description","title":"Description","text":"

Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look.

In this example, the flat and gouraud images for each pair have linked cameras. Rotate and zoom a pair to get a better look at the differences.

Info

See Figure 3-7 in Chapter 3 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/FlatVersusGouraud/#code","title":"Code","text":"

FlatVersusGouraud.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom collections import OrderedDict\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCylinderSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkIOGeometry import vtkOBJReader\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Create the renderers.\n    renderers = OrderedDict()\n    renderers['flatSphereRenderer'] = CreateSphere(True)\n    renderers['flatCylinderRenderer'] = CreateCylinder(True)\n    renderers['flatIsoSurfaceRenderer'] = CreateIsoSurface(True)\n    renderers['flatModelRenderer'] = CreateModel(True, fileName)\n\n    renderers['smoothSphereRenderer'] = CreateSphere(False)\n    renderers['smoothCylinderRenderer'] = CreateCylinder(False)\n    renderers['smoothIsoSurfaceRenderer'] = CreateIsoSurface(False)\n    renderers['smoothModelRenderer'] = CreateModel(False, fileName)\n\n    # Get the keys\n    keys = list(renderers.keys())\n\n    renderWindow = vtkRenderWindow()\n\n    # Setup the viewports for the renderers.\n    rendererSize = 256\n    xGridDimensions = 4\n    yGridDimensions = 2\n\n    renderWindow.SetSize(rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    renderWindow.SetWindowName('FlatVersusGouraud')\n\n    for row in range(0, yGridDimensions):\n        for col in range(0, xGridDimensions):\n            # (xmin, ymin, xmax, ymax)\n            viewport = [0] * 4\n            viewport[0] = col / xGridDimensions\n            viewport[1] = (yGridDimensions - (row + 1)) / yGridDimensions\n            viewport[2] = (col + 1) / xGridDimensions\n            viewport[3] = (yGridDimensions - row) / yGridDimensions\n            index = row * xGridDimensions + col\n            renderers[keys[index]].SetViewport(viewport)\n\n    for r in range(0, len(renderers)):\n        renderers[keys[r]].SetBackground(colors.GetColor3d('SlateGray'))\n        renderers[keys[r]].GetActiveCamera().Azimuth(20)\n        renderers[keys[r]].GetActiveCamera().Elevation(30)\n        renderers[keys[r]].ResetCamera()\n        if r > 3:\n            renderers[keys[r]].SetActiveCamera(renderers[keys[r - 4]].GetActiveCamera())\n\n        renderWindow.AddRenderer(renderers[keys[r]])\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Flat and Gouraud shading.'\n    epilogue = '''\n    Flat and Gouraud shading.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='cow.obj.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef CreateSphere(flat):\n    '''\n\n    :param flat: The interpolation to use (flat or Gouraud).\n    :return: the renderer\n    '''\n    colors = vtkNamedColors()\n    sphere = vtkSphereSource()\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphere.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n    if flat:\n        actor.GetProperty().SetInterpolationToFlat()\n    else:\n        actor.GetProperty().SetInterpolationToGouraud()\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    return renderer\n\n\ndef CreateCylinder(flat):\n    '''\n\n    :param flat: The interpolation to use (flat or Gouraud).\n    :return: the renderer\n    '''\n    colors = vtkNamedColors()\n    cylinder = vtkCylinderSource()\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(cylinder.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n    if flat:\n        actor.GetProperty().SetInterpolationToFlat()\n    else:\n        actor.GetProperty().SetInterpolationToGouraud()\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    return renderer\n\n\ndef CreateIsoSurface(flat):\n    '''\n\n    :param flat: The interpolation to use (flat or Gouraud).\n    :return: the renderer\n    '''\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 2, 3, 0, 1, 0, 0, 0, 0, 0)\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(25, 25, 25)\n    sample.SetImplicitFunction(quadric)\n    # Generate the implicit surface.\n    contour = vtkContourFilter()\n    contour.SetInputConnection(sample.GetOutputPort())\n    range = [1.0, 6.0]\n    contour.GenerateValues(5, range)\n    # Map the contour.\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contour.GetOutputPort())\n    contourMapper.SetScalarRange(0, 7)\n    actor = vtkActor()\n    actor.SetMapper(contourMapper)\n    if flat:\n        actor.GetProperty().SetInterpolationToFlat()\n    else:\n        actor.GetProperty().SetInterpolationToGouraud()\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    return renderer\n\n\ndef CreateModel(flat, fileName):\n    '''\n\n    :param flat: The interpolation to use (flat or Gouraud).\n    :param fileName: The file name.\n    :return: the renderer\n    '''\n    colors = vtkNamedColors()\n    reader = vtkOBJReader()\n    reader.SetFileName(fileName)\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Tan'))\n    if flat:\n        actor.GetProperty().SetInterpolationToFlat()\n    else:\n        actor.GetProperty().SetInterpolationToGouraud()\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    return renderer\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/GradientBackground/","title":"GradientBackground","text":"

vtk-examples/Python/Rendering/GradientBackground

"},{"location":"Python/Rendering/GradientBackground/#description","title":"Description","text":"

Demonstrates the gradient backgrounds available in VTK.

The gradient background modes are:

  • Vertical
  • Horizontal
  • Radial Farthest Side
  • Radial Farthest Corner

The user can also edit the code to change the stop colors marking the beginning and end points in a gradient.

An option is provided for the user to read in a data file so that more interesting objects can be viewed.

The viewport border can also be set and colored.

For more information, see New in VTK 9.3: Radial Gradient Background

!!! note VTK 9.3 or later is required.

!!! note The C++ version requires C++ 17 or later as std::filesystem is used.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/GradientBackground/#code","title":"Code","text":"

GradientBackground.py

#!/usr/bin/env python\n\n# Based on:\n#  https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/Core/Testing/Cxx/TestGradientBackground.cxx?ref_type=heads\n# See:\n#  [New in VTK 9.3: Radial Gradient Background](https://www.kitware.com/new-in-vtk-9-3-radial-gradient-background/)\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkCoordinate,\n    vtkPolyDataMapper,\n    vtkPolyDataMapper2D,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty,\n    vtkViewport\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Demonstrates the background shading options.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-f', '--file_name', default=None,\n                        help='An optional file name, e.g. star-wars-vader-tie-fighter.obj.')\n    args = parser.parse_args()\n    return args.file_name\n\n\ndef main(fn):\n    if fn:\n        fp = Path(fn)\n        if not fp.is_file():\n            print(f'The path: {fp} does not exist.')\n            return\n    else:\n        fp = None\n\n    pd = read_polydata_(fp)\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetWindowName('GradientBackground')\n\n    iren = vtkRenderWindowInteractor()\n    renderers = []\n\n    # For each gradient specify the mode.\n    modes = [\n        vtkViewport.GradientModes.VTK_GRADIENT_VERTICAL,\n        vtkViewport.GradientModes.VTK_GRADIENT_HORIZONTAL,\n        vtkViewport.GradientModes.VTK_GRADIENT_RADIAL_VIEWPORT_FARTHEST_SIDE,\n        vtkViewport.GradientModes.VTK_GRADIENT_RADIAL_VIEWPORT_FARTHEST_CORNER,\n    ]\n\n    colors = vtkNamedColors()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(pd)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Honeydew'))\n    actor.GetProperty().SetSpecular(0.3)\n    actor.GetProperty().SetSpecularPower(60.0)\n\n    ren_width = 640\n    ren_height = 480\n\n    # The bounds for each view port.\n    xmins = [0.0, 0.5, 0.0, 0.5]\n    ymins = [0.0, 0.0, 0.5, 0.5]\n    xmaxs = [0.5, 1.0, 0.5, 1.0]\n    ymaxs = [0.5, 0.5, 1.0, 1.0]\n\n    # Here we select and name the colors.\n    # Feel free to change colors.\n    bottom_color = colors.GetColor3d('Gold')\n    top_color = colors.GetColor3d('OrangeRed')\n    left_color = colors.GetColor3d('Gold')\n    right_color = colors.GetColor3d('OrangeRed')\n    center_color = colors.GetColor3d('Gold')\n    side_color = colors.GetColor3d('OrangeRed')\n    corner_color = colors.GetColor3d('OrangeRed')\n\n    viewport_title = [\"Vertical\",\n                      \"Horizontal\",\n                      \"Radial Farthest Side\",\n                      \"Radial Farthest Corner\",\n                      ]\n\n    # Create one text property for all.\n    text_property = vtkTextProperty()\n    text_property.SetJustificationToCentered()\n    text_property.SetFontSize(ren_height // 12)\n    text_property.SetColor(colors.GetColor3d('MidnightBlue'))\n\n    text_mappers = []\n    text_actors = []\n\n    # Define borders for the viewports  = [top, left, bottom, right].\n    lb = [False, True, True, False]\n    lbr = [False, True, True, True]\n    tlb = [True, True, True, False]\n    tlbr = [True, True, True, True]\n    border_color = 'DarkGreen'\n    border_width = 4.0\n\n    for i in range(0, 4):\n        text_mappers.append(vtkTextMapper())\n        text_mappers[i].SetInput(viewport_title[i])\n        text_mappers[i].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[i].SetMapper(text_mappers[i])\n        text_actors[i].SetPosition(ren_width / 2, 8)\n\n        renderers.append(vtkRenderer())\n        renderers[i].AddActor(text_actors[i])\n        renderers[i].AddActor(actor)\n        renderers[i].GradientBackgroundOn()\n        renderers[i].SetGradientMode(modes[i])\n\n        renderers[i].SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i])\n\n        if i == 1:\n            # Horizontal\n            renderers[i].SetBackground(left_color)\n            renderers[i].SetBackground2(right_color)\n            viewport_border(renderers[i], lbr, border_color, border_width)\n        elif i == 2:\n            # Radial Farthest Side\n            renderers[i].SetBackground(center_color)\n            renderers[i].SetBackground2(side_color)\n            viewport_border(renderers[i], tlb, border_color, border_width)\n        elif i == 3:\n            # Radial Farthest Corner\n            renderers[i].SetBackground(center_color)\n            renderers[i].SetBackground2(corner_color)\n            viewport_border(renderers[i], tlbr, border_color, border_width)\n        else:\n            # Vertical\n            renderers[i].SetBackground(bottom_color)\n            renderers[i].SetBackground2(top_color)\n            viewport_border(renderers[i], lb, border_color, border_width)\n\n        ren_win.AddRenderer(renderers[i])\n\n    ren_win.SetInteractor(iren)\n    ren_win.Render()\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    iren.Initialize()\n    iren.UpdateSize(ren_width * 2, ren_height * 2)\n\n    iren.Start()\n\n\ndef read_polydata_(path):\n    \"\"\"\n    Read from a file containing vtkPolyData.\n\n    If the path is empty a cone is returned.\n    If the extension is unknown a sphere is returned.\n\n    :param path: The path to the file.\n    :return: The vtkPolyData.\n    \"\"\"\n\n    poly_data = vtkPolyData()\n\n    if path is None:\n        # Default to a cone if the path is empty.\n        source = vtkConeSource()\n        source.SetResolution(25)\n        source.SetDirection(0, 1, 0)\n        source.SetHeight(1)\n        source.Update()\n        poly_data.DeepCopy(source.GetOutput())\n        return poly_data\n\n    valid_suffixes = ['.g', '.obj', '.stl', '.ply', '.vtk', '.vtp']\n    ext = path.suffix.lower()\n    if path.suffix not in valid_suffixes:\n        print('Warning:', path, 'unknown extension, using a sphere instead.')\n        source = vtkSphereSource()\n        source.SetPhiResolution(50)\n        source.SetThetaResolution(50)\n        source.Update()\n        poly_data.DeepCopy(source.GetOutput())\n    else:\n        if ext == '.ply':\n            reader = vtkPLYReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n        elif ext == '.vtp':\n            reader = vtkXMLPolyDataReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n        elif ext == '.obj':\n            reader = vtkOBJReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n        elif ext == '.stl':\n            reader = vtkSTLReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n        elif ext == '.vtk':\n            reader = vtkPolyDataReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n        elif ext == '.g':\n            reader = vtkBYUReader()\n            reader.SetGeometryFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n\n    return poly_data\n\n\ndef viewport_border(renderer, sides, border_color, border_width):\n    \"\"\"\n    Set a border around a viewport.\n\n    :param renderer: The renderer corresponding to the viewport.\n    :param sides: An array of boolean corresponding to [top, left, bottom, right]\n    :param border_color: The color of the border.\n    :param border_width: The width of the border.\n    :return:\n    \"\"\"\n    colors = vtkNamedColors()\n\n    # Points start at upper right and proceed anti-clockwise.\n    points = vtkPoints()\n    points.SetNumberOfPoints(4)\n    points.InsertPoint(0, 1, 1, 0)\n    points.InsertPoint(1, 0, 1, 0)\n    points.InsertPoint(2, 0, 0, 0)\n    points.InsertPoint(3, 1, 0, 0)\n\n    cells = vtkCellArray()\n    cells.Initialize()\n\n    if sides[0]:\n        # Top\n        top = vtkPolyLine()\n        top.GetPointIds().SetNumberOfIds(2)\n        top.GetPointIds().SetId(0, 0)\n        top.GetPointIds().SetId(1, 1)\n        cells.InsertNextCell(top)\n    if sides[1]:\n        # Left\n        left = vtkPolyLine()\n        left.GetPointIds().SetNumberOfIds(2)\n        left.GetPointIds().SetId(0, 1)\n        left.GetPointIds().SetId(1, 2)\n        cells.InsertNextCell(left)\n    if sides[2]:\n        # Bottom\n        bottom = vtkPolyLine()\n        bottom.GetPointIds().SetNumberOfIds(2)\n        bottom.GetPointIds().SetId(0, 2)\n        bottom.GetPointIds().SetId(1, 3)\n        cells.InsertNextCell(bottom)\n    if sides[3]:\n        # Right\n        right = vtkPolyLine()\n        right.GetPointIds().SetNumberOfIds(2)\n        right.GetPointIds().SetId(0, 3)\n        right.GetPointIds().SetId(1, 0)\n        cells.InsertNextCell(right)\n\n    # Now make the polydata and display it.\n    poly = vtkPolyData()\n    poly.Initialize()\n    poly.SetPoints(points)\n    poly.SetLines(cells)\n\n    # Use normalized viewport coordinates since\n    # they are independent of window size.\n    coordinate = vtkCoordinate()\n    coordinate.SetCoordinateSystemToNormalizedViewport()\n\n    mapper = vtkPolyDataMapper2D()\n    mapper.SetInputData(poly)\n    mapper.SetTransformCoordinate(coordinate)\n\n    actor = vtkActor2D()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(border_color))\n\n    # Line width should be at least 2 to be visible at extremes.\n    actor.GetProperty().SetLineWidth(border_width)\n\n    renderer.AddViewProp(actor)\n\n\nif __name__ == '__main__':\n    import sys\n\n    file_name = get_program_parameters(sys.argv)\n    main(file_name)\n
"},{"location":"Python/Rendering/LayeredActors/","title":"LayeredActors","text":"

vtk-examples/Python/Rendering/LayeredActors

"},{"location":"Python/Rendering/LayeredActors/#description","title":"Description","text":"

Demonstrates the use of two renderers in a render window. Notice that the second (and subsequent) renderers will have a transparent background.

The first layer (layer 0) contains the base object, a slab in this case. The second layer (layer 1) contains an object (axes in this case). This axes object will always be in front of the base layer object. When the program runs, the top-most layer will be the active layer, layer 1 in this case.

Two callbacks are provided, the first callback selects which layer is active:

  • Pressing 0 on the keyboard will let you manipulate the objects in layer 0.
  • Pressing 1 on the keyboard will let you manipulate the objects in layer 1.

The second callback allows you to orient objects in all layers using the object in the active layer.

Note

Objects in the top-most layer will always be in front of any objects in other layers.

Info

This is an extension of the TransparentBackground.cxx and TransparentBackground.py examples, extended by adding an extra callback so that the non-active layer objects move in conjunction with the active layer objects.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/LayeredActors/#code","title":"Code","text":"

LayeredActors.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef generate_and_display_cube_and_axes():\n    colors = vtkNamedColors()\n\n    # Make the slab and axes actors.\n    cube_source = vtkCubeSource()\n    cube_source.SetXLength(4.0)\n    cube_source.SetYLength(9.0)\n    cube_source.SetZLength(1.0)\n    cube_source.SetCenter(0.0, 0.0, 0.0)\n\n    cube_mapper = vtkPolyDataMapper()\n    cube_mapper.SetInputConnection(cube_source.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d('Sienna'))\n\n    cube_actor = vtkActor()\n    cube_actor.GetProperty().SetDiffuseColor(colors.GetColor3d('BurlyWood'))\n    cube_actor.SetMapper(cube_mapper)\n    cube_actor.GetProperty().EdgeVisibilityOn()\n    cube_actor.GetProperty().SetLineWidth(2.0)\n    cube_actor.GetProperty().SetEdgeColor(colors.GetColor3d('PapayaWhip'))\n    cube_actor.SetBackfaceProperty(back)\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 0.0, 0.0)\n\n    axes = vtkAxesActor()\n    # The axes can be positioned with a user transform.\n    axes.SetUserTransform(transform)\n\n    # The renderers, render window and interactor.\n    renderers = list()\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(800, 800)\n    ren_win.SetWindowName('LayeredActors')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    # Define the renderers and allocate them to layers.\n    for i in range(0, 2):\n        renderers.append(vtkRenderer())\n        ren_win.AddRenderer(renderers[i])\n        renderers[i].SetLayer(i)\n\n    # Layer 0 - background not transparent.\n    renderers[0].SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renderers[0].AddActor(cube_actor)\n    renderers[0].SetLayer(0)\n    # Layer 1 - the background is transparent,\n    #           so we only see the layer 0 background color\n    renderers[1].AddActor(axes)\n    renderers[1].SetBackground(colors.GetColor3d('MidnightBlue'))\n    renderers[1].SetLayer(1)\n\n    # Set a common camera view for each layer.\n    for renderer in renderers:\n        camera = renderer.GetActiveCamera()\n        camera.Elevation(-30)\n        camera.Azimuth(-30)\n        renderer.ResetCamera()\n\n    #  We have two layers.\n    ren_win.SetNumberOfLayers(len(renderers))\n\n    ren_win.Render()\n\n    iren.AddObserver('KeyPressEvent', select_layer)\n    iren.AddObserver('EndInteractionEvent', orient_layer)\n\n    iren.Start()\n\n\ndef select_layer(caller, ev):\n    \"\"\"\n    Select the layer to manipulate.\n    :param caller:\n    :param ev:\n    :return:\n    \"\"\"\n    iren = caller\n    renderers = iren.GetRenderWindow().GetRenderers()\n    if renderers.GetNumberOfItems() < 2:\n        print('We need at least two renderers, we have only', renderers.GetNumberOfItems())\n        return\n    renderers.InitTraversal()\n    # Top item.\n    ren0 = renderers.GetNextItem()\n    # Bottom item.\n    ren1 = renderers.GetNextItem()\n\n    key = iren.GetKeySym()\n\n    if key == '0':\n        print('Selected layer:', key)\n        iren.GetRenderWindow().GetInteractor().GetInteractorStyle().SetDefaultRenderer(ren0)\n        ren0.InteractiveOn()\n        ren1.InteractiveOff()\n    if key == '1':\n        print('Selected layer:', key)\n        iren.GetRenderWindow().GetInteractor().GetInteractorStyle().SetDefaultRenderer(ren1)\n        ren0.InteractiveOff()\n        ren1.InteractiveOn()\n\n\ndef orient_layer(caller, ev):\n    \"\"\"\n    Orient layer 0 based on the camera orientation in layer 1 or vice versa.\n\n    :param caller:\n    :param ev:\n    :return:\n    \"\"\"\n\n    iren = caller\n    renderers = iren.GetRenderWindow().GetRenderers()\n    if renderers.GetNumberOfItems() < 2:\n        print('We need at least two renderers, we have only', renderers.GetNumberOfItems())\n        return\n    renderers.InitTraversal()\n    # Top item.\n    ren0 = renderers.GetNextItem()\n    # Bottom item.\n    ren1 = renderers.GetNextItem()\n\n    if ren1.GetInteractive():\n        orient1 = get_orientation(ren1)\n        set_orientation(ren0, orient1)\n        ren0.ResetCamera()\n    else:\n        orient0 = get_orientation(ren0)\n        set_orientation(ren1, orient0)\n        ren1.ResetCamera()\n\n\ndef get_orientation(ren):\n    \"\"\"\n    Get the camera orientation.\n    :param ren: The renderer.\n    :return: The orientation parameters.\n    \"\"\"\n    p = dict()\n    camera = ren.GetActiveCamera()\n    p['position'] = camera.GetPosition()\n    p['focal point'] = camera.GetFocalPoint()\n    p['view up'] = camera.GetViewUp()\n    p['distance'] = camera.GetDistance()\n    p['clipping range'] = camera.GetClippingRange()\n    p['orientation'] = camera.GetOrientation()\n    return p\n\n\ndef set_orientation(ren, p):\n    \"\"\"\n    Set the orientation of the camera.\n    :param ren: The renderer.\n    :param p: The orientation parameters.\n    :return:\n    \"\"\"\n    camera = ren.GetActiveCamera()\n    camera.SetPosition(p['position'])\n    camera.SetFocalPoint(p['focal point'])\n    camera.SetViewUp(p['view up'])\n    camera.SetDistance(p['distance'])\n    camera.SetClippingRange(p['clipping range'])\n\n\ndef main():\n    generate_and_display_cube_and_axes()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/Mace/","title":"Mace","text":"

vtk-examples/Python/Rendering/Mace

"},{"location":"Python/Rendering/Mace/#description","title":"Description","text":"

An example of multiple inputs and outputs.

Info

See Figure 4-21 in Chapter 4 the VTK Textbook.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/Mace/#code","title":"Code","text":"

Mace.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(8)\n    sphere.SetPhiResolution(8)\n\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    cone = vtkConeSource()\n    cone.SetResolution(6)\n\n    glyph = vtkGlyph3D()\n    glyph.SetInputConnection(sphere.GetOutputPort())\n    glyph.SetSourceConnection(cone.GetOutputPort())\n    glyph.SetVectorModeToUseNormal()\n    glyph.SetScaleModeToScaleByVector()\n    glyph.SetScaleFactor(0.25)\n\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(glyph.GetOutputPort())\n\n    spikeActor = vtkActor()\n    spikeActor.SetMapper(spikeMapper)\n    spikeActor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    renderer.AddActor(sphereActor)\n    renderer.AddActor(spikeActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('Mace')\n\n    # Interact with the data.\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/Model/","title":"Model","text":"

vtk-examples/Python/Rendering/Model

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/Model/#code","title":"Code","text":"

Model.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the colors.\n    colors.SetColor('CubeColor', [250, 128, 114, 255])\n    colors.SetColor('BkgColor', [230, 230, 230, 255])\n\n    # Create the rendering windows and three renderers.\n\n    ren1 = vtkRenderer()\n    ren2 = vtkRenderer()\n    renWindow1 = vtkRenderWindow()\n    renWindow1.AddRenderer(ren1)\n    renWindow1.AddRenderer(ren2)\n    renWindow1.SetWindowName('Model')\n\n    iren1 = vtkRenderWindowInteractor()\n    iren1.SetRenderWindow(renWindow1)\n    ren3 = vtkRenderer()\n    renWindow2 = vtkRenderWindow()\n    renWindow2.SetWindowName('Model')\n\n    renWindow2.AddRenderer(ren3)\n    iren2 = vtkRenderWindowInteractor()\n    iren2.SetRenderWindow(renWindow2)\n\n    # Create an actor and give it cone geometry.\n    cone = vtkConeSource()\n    cone.SetResolution(8)\n\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n\n    # Create an actor and give it cube geometry.\n    cube = vtkCubeSource()\n\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputConnection(cube.GetOutputPort())\n\n    cubeActor = vtkActor()\n    cubeActor.SetMapper(cubeMapper)\n    cubeActor.GetProperty().SetColor(colors.GetColor3d('CubeColor'))\n\n    # Create an actor and give it sphere geometry.\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(16)\n    sphere.SetPhiResolution(16)\n\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d('Melon'))\n\n    # Assign our actors to both renderers.\n    ren1.AddActor(coneActor)\n    ren2.AddActor(sphereActor)\n    ren3.AddActor(cubeActor)\n\n    # set the size of our window\n    renWindow1.SetSize(300, 150)\n    renWindow1.SetPosition(0, 50)\n    renWindow2.SetSize(300, 300)\n    renWindow2.SetPosition(0, 300)\n\n    # Set the viewports and backgrounds of the renderers.\n    ren1.SetViewport(0, 0, 0.5, 1)\n    ren1.SetBackground(colors.GetColor3d('BkgColor'))\n    ren2.SetViewport(0.5, 0, 1, 1)\n    ren2.SetBackground(colors.GetColor3d('Linen'))\n    ren3.SetBackground(colors.GetColor3d('Honeydew'))\n\n    # Draw the resulting scene.\n    renWindow1.Render()\n    renWindow2.Render()\n\n    iren1.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/MotionBlur/","title":"MotionBlur","text":"

vtk-examples/Python/Rendering/MotionBlur

"},{"location":"Python/Rendering/MotionBlur/#description","title":"Description","text":"

Example of motion blur.

Info

See Figure 7-36 in Chapter 7 in the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/MotionBlur/#code","title":"Code","text":"

MotionBlur.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkRenderStepsPass,\n    vtkSimpleMotionBlurPass\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    colors.SetColor('A1Diff', [255, 204, 77, 255])\n    colors.SetColor('A2Amb', [51, 51, 255, 255])\n    colors.SetColor('A2Diff', [51, 255, 204, 255])\n    colors.SetColor('A3Amb', [128, 166, 255, 255])\n    colors.SetColor('Bkg', [77, 102, 153, 255])\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Bkg'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(500, 500)\n    renderWindow.SetWindowName('MotionBlur')\n\n    renderWindow.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renderWindow)\n\n    reader = vtkPLYReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    # create three models\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetAmbientColor(colors.GetColor3d('Red'))\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('A1Diff'))\n    actor.GetProperty().SetSpecular(0.0)\n    actor.GetProperty().SetDiffuse(0.5)\n    actor.GetProperty().SetAmbient(0.3)\n    actor.SetPosition(-0.1, 0.0, -0.1)\n    renderer.AddActor(actor)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetAmbientColor(colors.GetColor3d('A2Amb'))\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('A2Diff'))\n    actor.GetProperty().SetSpecularColor(colors.GetColor3d('Black'))\n    actor.GetProperty().SetSpecular(0.2)\n    actor.GetProperty().SetDiffuse(0.9)\n    actor.GetProperty().SetAmbient(0.1)\n    actor.GetProperty().SetSpecularPower(10.0)\n    renderer.AddActor(actor)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('A3Amb'))\n    actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    actor.GetProperty().SetSpecular(0.7)\n    actor.GetProperty().SetDiffuse(0.4)\n    actor.GetProperty().SetSpecularPower(60.0)\n    actor.SetPosition(0.1, 0.0, 0.1)\n    renderer.AddActor(actor)\n\n    renderWindow.SetMultiSamples(0)\n\n    # create the basic VTK render steps\n    basicPasses = vtkRenderStepsPass()\n\n    motion = vtkSimpleMotionBlurPass()\n    motion.SetDelegatePass(basicPasses)\n\n    # Tell the renderer to use our render pass pipeline.\n    renderer.SetPass(motion)\n\n    numRenders = 30\n\n    renderer.GetActiveCamera().SetPosition(0, 0, -1)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 1, 0)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(15.0)\n    renderer.GetActiveCamera().Zoom(1.2)\n\n    renderWindow.Render()\n\n    for i in range(0, numRenders):\n        renderer.GetActiveCamera().Azimuth(10.0 / numRenders)\n        renderer.GetActiveCamera().Elevation(10.0 / numRenders)\n        renderWindow.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Example of motion blur.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Armadillo.ply.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/OutlineGlowPass/","title":"OutlineGlowPass","text":"

vtk-examples/Python/Rendering/OutlineGlowPass

"},{"location":"Python/Rendering/OutlineGlowPass/#description","title":"Description","text":"

Demonstrates how to render an object in a scene with a glowing outline.

The class vtkOutlineGlowPass is designed to highlight parts of a scene by applying the render pass to a layered renderer on top of the main scene. For optimal results, actors that form the outline should be brightly colored with lighting disabled. The outline will have the color of the actors. There is only one outline around all objects rendered by the delegate.

When combined with layered renderers, this creates a very visible highlight without altering the highlighted object.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/OutlineGlowPass/#code","title":"Code","text":"

OutlineGlowPass.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersSources import vtkArrowSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkOutlineGlowPass,\n    vtkRenderStepsPass\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'How to render an object in a scene with a glowing outline.'\n    epilogue = '''\nParts of a scene are highlighted by applying the render pass to a layered renderer\n on top of the main scene. For optimal results, actors that form the outline\n should be brightly colored with lighting disabled. The outline will have the\n color of the actors. There is only one outline around all objects rendered by the delegate.\n\nWhen combined with layered renderers, this creates a very visible highlight without\n altering the highlighted object.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.parse_args()\n    return\n\n\ndef main():\n    if not vtk_version_ok(9, 0, 20200909):\n        print('You need VTK version 9.0.20200909 or greater to run this program.')\n        return\n    get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    iren = vtkRenderWindowInteractor()\n    renWin = vtkRenderWindow()\n    renWin.SetMultiSamples(0)\n\n    iren.SetRenderWindow(renWin)\n\n    # Set up the renderers\n    # One for the object and the other for the outline\n    renderer = vtkRenderer()\n    rendererOutline = vtkRenderer()\n    rendererOutline.SetLayer(1)\n    renWin.SetNumberOfLayers(2)\n    renWin.AddRenderer(rendererOutline)\n    renWin.AddRenderer(renderer)\n\n    # Create an arrow.\n    arrowSource = vtkArrowSource()\n    # arrowSource.SetShaftRadius(1.0)\n    # arrowSource.SetTipLength(1.0)\n    arrowSource.Update()\n\n    # Create mapper and actor for the main renderer\n    coneMapperMain = vtkPolyDataMapper()\n    coneMapperMain.SetInputConnection(arrowSource.GetOutputPort())\n\n    coneActorMain = vtkActor()\n    coneActorMain.SetMapper(coneMapperMain)\n    coneActorMain.GetProperty().SetDiffuseColor(colors.GetColor3d(\"LimeGreen\"))\n\n    renderer.AddActor(coneActorMain)\n\n    # Lets make the outline glow!\n    # Create the render pass\n    basicPasses = vtkRenderStepsPass()\n    glowPass = vtkOutlineGlowPass()\n    glowPass.SetDelegatePass(basicPasses)\n\n    # Apply the render pass to the highlight renderer\n    rendererOutline.SetPass(glowPass)\n\n    # Create mapper and actor for the outline\n    coneMapperOutline = vtkPolyDataMapper()\n    coneMapperOutline.SetInputConnection(arrowSource.GetOutputPort())\n\n    coneActorOutline = vtkActor()\n    coneActorOutline.SetMapper(coneMapperOutline)\n    coneActorOutline.GetProperty().SetColor(colors.GetColor3d(\"Magenta\"))\n    coneActorOutline.GetProperty().LightingOff()\n\n    rendererOutline.AddActor(coneActorOutline)\n\n    renWin.SetSize(600, 600)\n\n    renderer.GradientBackgroundOn()\n    renderer.SetBackground(colors.GetColor3d(\"DarkSlateGray\"))\n    renderer.SetBackground2(colors.GetColor3d(\"DarkSlateBlue\"))\n\n    renderer.ResetCamera()\n    camera = renderer.GetActiveCamera()\n    camera.Roll(45.0)\n    camera.Azimuth(-30.0)\n    camera.Elevation(-15.0)\n    renderer.ResetCamera()\n    # Now set the active camera for the outline\n    rendererOutline.SetActiveCamera(camera)\n\n    renWin.SetWindowName('OutlineGlowPass')\n\n    renWin.Render()\n\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/PBR_Anisotropy/","title":"PBR Anisotropy","text":"

vtk-examples/Python/Rendering/PBR_Anisotropy

"},{"location":"Python/Rendering/PBR_Anisotropy/#description","title":"Description","text":"

This example is based on TestPBRAnisotropy.cxx and renders spheres with different anisotropy values.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Python/Rendering/PBR_Anisotropy/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/PBR_Anisotropy/#code","title":"Code","text":"

PBR_Anisotropy.py

#!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataTangents\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkFiltersTexture import vtkTextureMapToSphere\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkOpenGLRenderer,\n    vtkOpenGLSkybox\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Render spheres with different anisotropy values.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-e', '--use_equirectangular', action='store_true',\n                        help='Use the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_equirectangular\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    use_cubemap = not use_cubemap\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n    colors.SetColor('Brass', [184, 115, 51, 255])\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkOpenGLSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(75)\n    sphere.SetPhiResolution(75)\n\n    pd_sphere = vtkPolyDataMapper()\n    pd_sphere.SetInputConnection(sphere.GetOutputPort())\n\n    texture_map = vtkTextureMapToSphere()\n    texture_map.SetInputConnection(sphere.GetOutputPort())\n    texture_map.PreventSeamOff()\n\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(texture_map.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(tangents.GetOutputPort())\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 0.0, 0.0)\n        actor_sphere.RotateX(20)\n        actor_sphere.RotateY(20)\n        actor_sphere.SetMapper(mapper)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetAnisotropy(1.0)\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 1.0, 0.0)\n        actor_sphere.RotateX(20)\n        actor_sphere.RotateY(20)\n        actor_sphere.SetMapper(mapper)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(0.1)\n        actor_sphere.GetProperty().SetAnisotropy(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 2.0, 0.0)\n        actor_sphere.RotateX(20)\n        actor_sphere.RotateY(20)\n        actor_sphere.SetMapper(mapper)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(0.1)\n        actor_sphere.GetProperty().SetAnisotropy(1.0)\n        actor_sphere.GetProperty().SetAnisotropyRotation(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Anisotropy')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/PBR_Clear_Coat/","title":"PBR Clear Coat","text":"

vtk-examples/Python/Rendering/PBR_Clear_Coat

"},{"location":"Python/Rendering/PBR_Clear_Coat/#description","title":"Description","text":"

This example is based on TestPBRClearCoat.cxx and renders a cube with custom texture mapping and a coat normal texture.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Python/Rendering/PBR_Clear_Coat/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/PBR_Clear_Coat/#code","title":"Code","text":"

PBR_Clear_Coat.py

#!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory,\n    vtkPNGReader\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import vtkOpenGLRenderer\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Render a cube with custom texture mapping and a coat normal texture.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-e', '--use_equirectangular', action='store_true',\n                        help='Use the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_equirectangular\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    use_cubemap = not use_cubemap\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n    ren.AutomaticLightCreationOff()\n\n    light = vtkLight()\n    light.SetPosition(2.0, 0.0, 2.0)\n    light.SetFocalPoint(0.0, 0.0, 0.0)\n\n    ren.AddLight(light)\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    cube = vtkCubeSource()\n\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(cube.GetOutputPort())\n\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(triangulation.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(tangents.GetOutputPort())\n\n    material_reader = vtkPNGReader()\n    material_reader.SetFileName(parameters['material'])\n\n    material = vtkTexture()\n    material.InterpolateOn()\n    material.SetInputConnection(material_reader.GetOutputPort())\n\n    albedo_reader = vtkPNGReader()\n    albedo_reader.SetFileName(parameters['albedo'])\n\n    albedo = vtkTexture()\n    albedo.UseSRGBColorSpaceOn()\n    albedo.InterpolateOn()\n    albedo.SetInputConnection(albedo_reader.GetOutputPort())\n\n    normal_reader = vtkPNGReader()\n    normal_reader.SetFileName(parameters['normal'])\n\n    # Uncomment this if you want a similar image to the VTK test image.\n    # flip = vtkImageFlip()\n    # flip.SetInputConnection(normal_reader.GetOutputPort())\n    # flip.SetFilteredAxes(0)\n\n    normal = vtkTexture()\n    normal.InterpolateOn()\n    normal.SetInputConnection(normal_reader.GetOutputPort())\n\n    coat_normal = vtkTexture()\n    coat_normal.InterpolateOn()\n    coat_normal.SetInputConnection(normal_reader.GetOutputPort())\n    # Uncomment this if you want a similar image to the VTK test image.\n    # coat_normal.SetInputConnection(flip.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetOrientation(0.0, 25.0, 0.0)\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetInterpolationToPBR()\n\n    # Set metallic, roughness and coat strength to 1.0 as they act as multipliers\n    # with texture value.\n    actor.GetProperty().SetMetallic(1.0)\n    actor.GetProperty().SetRoughness(1.0)\n    actor.GetProperty().SetCoatStrength(1.0)\n    actor.GetProperty().SetCoatColor(colors.GetColor3d('Red'))\n\n    actor.GetProperty().SetBaseColorTexture(albedo)\n    actor.GetProperty().SetORMTexture(material)\n    actor.GetProperty().SetNormalTexture(normal)\n    actor.GetProperty().SetCoatNormalTexture(coat_normal)\n\n    ren.AddActor(actor)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Clear_Coat')\n\n    ren_win.Render()\n    ren.GetActiveCamera().Zoom(1.5)\n\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/PBR_Edge_Tint/","title":"PBR Edge Tint","text":"

vtk-examples/Python/Rendering/PBR_Edge_Tint

"},{"location":"Python/Rendering/PBR_Edge_Tint/#description","title":"Description","text":"

This example is based on TestPBREdgeTint.cxx and renders spheres with different edge colors using a skybox as image based lighting.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Python/Rendering/PBR_Edge_Tint/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/PBR_Edge_Tint/#code","title":"Code","text":"

PBR_Edge_Tint.py

#!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import vtkOpenGLRenderer\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Render spheres with different edge colors using a skybox as image based lighting.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-c', '--use_cubemap', action='store_true',\n                        help='Build the cubemap from the six cubemap files.'\n                             ' Overrides the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_cubemap\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(75)\n    sphere.SetPhiResolution(75)\n\n    pd_sphere = vtkPolyDataMapper()\n    pd_sphere.SetInputConnection(sphere.GetOutputPort())\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 0.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetEdgeTint(colors.GetColor3d('Black'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 1.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Black'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetEdgeTint(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 2.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Blue'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetEdgeTint(colors.GetColor3d('Red'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 3.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Red'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetEdgeTint(colors.GetColor3d('Blue'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 4.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Black'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetEdgeTint(colors.GetColor3d('Yellow'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Edge_Tint')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/PBR_HDR_Environment/","title":"PBR HDR Environment","text":"

vtk-examples/Python/Rendering/PBR_HDR_Environment

"},{"location":"Python/Rendering/PBR_HDR_Environment/#description","title":"Description","text":"

This example is based on TestPBRHdrEnvironment.cxx and renders spheres with different materials using a skybox as image based lighting.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Python/Rendering/PBR_HDR_Environment/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/PBR_HDR_Environment/#code","title":"Code","text":"

PBR_HDR_Environment.py

#!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import vtkOpenGLRenderer\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Renders spheres with different materials using a skybox as image based lighting.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-c', '--use_cubemap', action='store_true',\n                        help='Build the cubemap from the six cubemap files.'\n                             ' Overrides the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_cubemap\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(75)\n    sphere.SetPhiResolution(75)\n\n    pd_sphere = vtkPolyDataMapper()\n    pd_sphere.SetInputConnection(sphere.GetOutputPort())\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 0.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_HDR_Environment')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/PBR_Mapping/","title":"PBR Mapping","text":"

vtk-examples/Python/Rendering/PBR_Mapping

"},{"location":"Python/Rendering/PBR_Mapping/#description","title":"Description","text":"

This example is based on TestPBRMapping.cxx and renders spheres with different edge colors using a skybox as image based lighting.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Python/Rendering/PBR_Mapping/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/PBR_Mapping/#code","title":"Code","text":"

PBR_Mapping.py

#!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory,\n    vtkPNGReader\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import vtkOpenGLRenderer\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Render a cube with custom texture mapping.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-e', '--use_equirectangular', action='store_true',\n                        help='Use the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_equirectangular\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    use_cubemap = not use_cubemap\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n    ren.AutomaticLightCreationOff()\n\n    light = vtkLight()\n    light.SetPosition(2.0, 0.0, 2.0)\n    light.SetFocalPoint(0.0, 0.0, 0.0)\n\n    ren.AddLight(light)\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    cube = vtkCubeSource()\n\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(cube.GetOutputPort())\n\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(triangulation.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(tangents.GetOutputPort())\n\n    material_reader = vtkPNGReader()\n    material_reader.SetFileName(parameters['material'])\n\n    material = vtkTexture()\n    material.InterpolateOn()\n    material.SetInputConnection(material_reader.GetOutputPort())\n\n    albedo_reader = vtkPNGReader()\n    albedo_reader.SetFileName(parameters['albedo'])\n\n    albedo = vtkTexture()\n    albedo.UseSRGBColorSpaceOn()\n    albedo.InterpolateOn()\n    albedo.SetInputConnection(albedo_reader.GetOutputPort())\n\n    normal_reader = vtkPNGReader()\n    normal_reader.SetFileName(parameters['normal'])\n\n    normal = vtkTexture()\n    normal.InterpolateOn()\n    normal.SetInputConnection(normal_reader.GetOutputPort())\n\n    anisotropy_reader = vtkPNGReader()\n    anisotropy_reader.SetFileName(parameters['anisotropy'])\n\n    anisotropy = vtkTexture()\n    anisotropy.InterpolateOn()\n    anisotropy.SetInputConnection(anisotropy_reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetOrientation(0.0, 25.0, 0.0)\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetInterpolationToPBR()\n\n    # Set metallic, roughness, anisotropy and anisotropyRotation\n    #  to 1.0 as they act as multipliers with texture value.\n    actor.GetProperty().SetMetallic(1.0)\n    actor.GetProperty().SetRoughness(1.0)\n    actor.GetProperty().SetAnisotropy(1.0)\n    actor.GetProperty().SetAnisotropyRotation(1.0)\n    actor.GetProperty().SetColor(colors.GetColor3d('White'))\n\n    actor.GetProperty().SetBaseColorTexture(albedo)\n    actor.GetProperty().SetORMTexture(material)\n    actor.GetProperty().SetNormalTexture(normal)\n    actor.GetProperty().SetAnisotropyTexture(anisotropy)\n\n    ren.AddActor(actor)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Mapping')\n\n    ren_win.Render()\n    ren.GetActiveCamera().Zoom(1.5)\n\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/PBR_Materials/","title":"PBR Materials","text":"

vtk-examples/Python/Rendering/PBR_Materials

"},{"location":"Python/Rendering/PBR_Materials/#description","title":"Description","text":"

This example is based on TestPBRMaterials.cxx and renders spheres with different materials using a skybox as image based lighting. Red, cyan and black spheres are dielectric, brass and white spheres are metallic. Roughness ranges from 0 to 1 in steps of 0.2.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Python/Rendering/PBR_Materials/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/PBR_Materials/#code","title":"Code","text":"

PBR_Materials.py

#!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkOpenGLRenderer,\n    vtkOpenGLSkybox\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Renders spheres with different materials using a skybox as image based lighting.'\n    epilogue = '''\nRed, cyan and black spheres are dielectric, brass and white spheres are metallic.\nRoughness ranges from 0 to 1 in steps of 0.2.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-e', '--use_equirectangular', action='store_true',\n                        help='Use the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_equirectangular\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    use_cubemap = not use_cubemap\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n    colors.SetColor('Brass', [184, 115, 51, 255])\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkOpenGLSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(100)\n    sphere.SetPhiResolution(100)\n\n    pd_sphere = vtkPolyDataMapper()\n    pd_sphere.SetInputConnection(sphere.GetOutputPort())\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 0.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 1.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Brass'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 2.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Black'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 3.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Cyan'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 4.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Red'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Materials')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/PBR_Materials_Coat/","title":"PBR Materials Coat","text":"

vtk-examples/Python/Rendering/PBR_Materials_Coat

"},{"location":"Python/Rendering/PBR_Materials_Coat/#description","title":"Description","text":"

This example is based on TestPBRMaterialsCoat.cxx and renders spheres with different coat materials using a skybox as image based lighting.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

<DATA>/PBR_Examples.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Python/Rendering/PBR_Materials_Coat/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/PBR_Materials_Coat/#code","title":"Code","text":"

PBR_Materials_Coat.py

#!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkOpenGLRenderer,\n    vtkOpenGLSkybox\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Render spheres with different coat materials using a skybox as image based lighting.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-e', '--use_equirectangular', action='store_true',\n                        help='Use the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_equirectangular\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    use_cubemap = not use_cubemap\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n    colors.SetColor('Brass', [184, 115, 51, 255])\n    colors.SetColor('DarkTeal', [0, 128, 77, 255])\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkOpenGLSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(75)\n    sphere.SetPhiResolution(75)\n\n    pd_sphere = vtkPolyDataMapper()\n    pd_sphere.SetInputConnection(sphere.GetOutputPort())\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 0.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Brass'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(0.1)\n        actor_sphere.GetProperty().SetCoatStrength(1.0)\n        actor_sphere.GetProperty().SetCoatRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 1.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Brass'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(1.0)\n        actor_sphere.GetProperty().SetCoatStrength(1.0)\n        actor_sphere.GetProperty().SetCoatRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 2.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(0.1)\n        actor_sphere.GetProperty().SetCoatColor(colors.GetColor3d('Red'))\n        actor_sphere.GetProperty().SetCoatRoughness(0.1)\n        actor_sphere.GetProperty().SetCoatStrength(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 3.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetRoughness(0.1)\n        actor_sphere.GetProperty().SetCoatColor(colors.GetColor3d('Red'))\n        actor_sphere.GetProperty().SetCoatRoughness(1.0)\n        actor_sphere.GetProperty().SetCoatStrength(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 4.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('DarkTeal'))\n        actor_sphere.GetProperty().SetBaseIOR(1.0 + i / 3.0)\n        ren.AddActor(actor_sphere)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Materials_Coat')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/PBR_Skybox/","title":"PBR Skybox","text":"

vtk-examples/Python/Rendering/PBR_Skybox

"},{"location":"Python/Rendering/PBR_Skybox/#description","title":"Description","text":"

Demonstrates physically based rendering using image based lighting and a skybox.

Physically based rendering sets color, metallicity and roughness of the object, sliders are provided so that you can experiment with the various parameters.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

<DATA>/PBR_Skybox.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Python/Rendering/PBR_Skybox/#options","title":"Options","text":"
Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

Additionally, you can save a screenshot by pressing \"k\".

"},{"location":"Python/Rendering/PBR_Skybox/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Skybox.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/PBR_Skybox/#code","title":"Code","text":"

PBR_Skybox.py

#!/usr/bin/env python3\n\nimport json\nimport sys\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBoy,\n    vtkParametricMobius,\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkCommand,\n    vtkFloatArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkClipPolyData,\n    vtkPolyDataNormals,\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkLinearSubdivisionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkParametricFunctionSource,\n    vtkTexturedSphereSource\n)\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkJPEGWriter,\n    vtkImageReader2Factory,\n    vtkPNGWriter\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget,\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkCameraPass,\n    vtkLightsPass,\n    vtkOpaquePass,\n    vtkOverlayPass,\n    vtkRenderPassCollection,\n    vtkSequencePass,\n    vtkToneMappingPass\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrates physically based rendering, image based lighting and a skybox.'\n    epilogue = '''\nPhysically based rendering sets color, metallicity and roughness of the object.\nImage based lighting uses a cubemap texture to specify the environment.\nA Skybox is used to create the illusion of distant three-dimensional surroundings.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-s', '--surface', default='',\n                        help='The name of the surface. Overrides the surface entry in the json file.')\n    parser.add_argument('-c', '--use_cubemap', action='store_true',\n                        help='Build the cubemap from the six cubemap files.'\n                             ' Overrides the equirectangular entry in the json file.')\n    parser.add_argument('-t', '--use_tonemapping', action='store_true',\n                        help='Use tone mapping.')\n    args = parser.parse_args()\n    return args.file_name, args.surface, args.use_cubemap, args.use_tonemapping\n\n\ndef main():\n    if not vtk_version_ok(9, 0, 0):\n        print('You need VTK version 9.0 or greater to run this program.')\n        return\n\n    colors = vtkNamedColors()\n\n    # Default background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    fn, surface_name, use_cubemap, use_tonemapping = get_program_parameters()\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n\n    # Check for missing parameters.\n    if 'bkgcolor' not in parameters.keys():\n        parameters['bkgcolor'] = 'BkgColor'\n    if 'objcolor' not in parameters.keys():\n        parameters['objcolor'] = 'White'\n    if 'skybox' not in parameters.keys():\n        parameters['skybox'] = False\n    if surface_name:\n        parameters['object'] = surface_name\n\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    # Build the pipeline.\n    # ren1 is for the slider rendering,\n    # ren2 is for the object rendering.\n    ren1 = vtkRenderer()\n    # ren2 = vtkOpenGLRenderer()\n    ren2 = vtkRenderer()\n    ren1.SetBackground(colors.GetColor3d('Snow'))\n    ren2.SetBackground(colors.GetColor3d(parameters['bkgcolor']))\n\n    render_window = vtkRenderWindow()\n    # The order here is important.\n    # This ensures that the sliders will be in ren1.\n    render_window.AddRenderer(ren2)\n    render_window.AddRenderer(ren1)\n    ren1.SetViewport(0.0, 0.0, 0.2, 1.0)\n    ren2.SetViewport(0.2, 0.0, 1, 1)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n    style = vtkInteractorStyleTrackballCamera()\n    interactor.SetInteractorStyle(style)\n\n    # Set up tone mapping, so we can vary the exposure.\n    # Custom Passes.\n    camera_p = vtkCameraPass()\n    seq = vtkSequencePass()\n    opaque = vtkOpaquePass()\n    lights = vtkLightsPass()\n    overlay = vtkOverlayPass()\n\n    passes = vtkRenderPassCollection()\n    passes.AddItem(lights)\n    passes.AddItem(opaque)\n    passes.AddItem(overlay)\n    seq.SetPasses(passes)\n    camera_p.SetDelegatePass(seq)\n\n    tone_mapping_p = vtkToneMappingPass()\n    tone_mapping_p.SetDelegatePass(camera_p)\n\n    if use_tonemapping:\n        ren2.SetPass(tone_mapping_p)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren2.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    # Turn off the default lighting and use image based lighting.\n    ren2.AutomaticLightCreationOff()\n    ren2.UseImageBasedLightingOn()\n    if is_hdr:\n        ren2.UseSphericalHarmonicsOn()\n        ren2.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren2.UseSphericalHarmonicsOff()\n        ren2.SetEnvironmentTexture(env_texture, True)\n\n    # Get the surface.\n    surface = parameters['object'].lower()\n    available_surfaces = {'boy', 'mobius', 'randomhills', 'torus', 'sphere', 'clippedsphere', 'cube', 'clippedcube'}\n    if surface not in available_surfaces:\n        print(f'The requested surface: {parameters[\"object\"]} not found, reverting to Boys Surface.')\n        surface = 'boy'\n    if surface == 'mobius':\n        source = get_mobius()\n    elif surface == 'randomhills':\n        source = get_random_hills()\n    elif surface == 'torus':\n        source = get_torus()\n    elif surface == 'sphere':\n        source = get_sphere()\n    elif surface == 'clippedsphere':\n        source = get_clipped_sphere()\n    elif surface == 'cube':\n        source = get_cube()\n    elif surface == 'clippedcube':\n        source = get_clipped_cube()\n    else:\n        source = get_boy()\n\n    # Let's use a metallic surface\n    diffuse_coefficient = 1.0\n    roughness_coefficient = 0.0\n    metallic_coefficient = 1.0\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(source)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    # Enable PBR on the model.\n    actor.GetProperty().SetInterpolationToPBR()\n    # Configure the basic properties.\n    actor.GetProperty().SetColor(colors.GetColor3d(parameters['objcolor']))\n    actor.GetProperty().SetDiffuse(diffuse_coefficient)\n    actor.GetProperty().SetRoughness(roughness_coefficient)\n    actor.GetProperty().SetMetallic(metallic_coefficient)\n    ren2.AddActor(actor)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren2.AddActor(skybox)\n\n    # Create the slider callbacks to manipulate various parameters.\n    step_size = 1.0 / 3\n    pos_y = 0.1\n    pos_x0 = 0.02\n    pos_x1 = 0.18\n\n    sw_p = SliderProperties()\n\n    sw_p.initial_value = 1.0\n    sw_p.maximum_value = 5.0\n    sw_p.title = 'Exposure'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_exposure = make_slider_widget(sw_p)\n    sw_exposure.SetInteractor(interactor)\n    sw_exposure.SetAnimationModeToAnimate()\n    if use_tonemapping:\n        sw_exposure.EnabledOn()\n    else:\n        sw_exposure.EnabledOff()\n    sw_exposure.SetCurrentRenderer(ren1)\n    sw_exposure_cb = SliderCallbackExposure(tone_mapping_p)\n    sw_exposure.AddObserver(vtkCommand.InteractionEvent, sw_exposure_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = metallic_coefficient\n    sw_p.maximum_value = 1.0\n    sw_p.title = 'Metallicity'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_metallic = make_slider_widget(sw_p)\n    sw_metallic.SetInteractor(interactor)\n    sw_metallic.SetAnimationModeToAnimate()\n    sw_metallic.EnabledOn()\n    sw_metallic.SetCurrentRenderer(ren1)\n    sw_metallic_cb = SliderCallbackMetallic(actor.GetProperty())\n    sw_metallic.AddObserver(vtkCommand.InteractionEvent, sw_metallic_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = roughness_coefficient\n    sw_p.title = 'Roughness'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_roughnesss = make_slider_widget(sw_p)\n    sw_roughnesss.SetInteractor(interactor)\n    sw_roughnesss.SetAnimationModeToAnimate()\n    sw_roughnesss.EnabledOn()\n    sw_roughnesss.SetCurrentRenderer(ren1)\n    sw_roughnesss_cb = SliderCallbackRoughness(actor.GetProperty())\n    sw_roughnesss.AddObserver(vtkCommand.InteractionEvent, sw_roughnesss_cb)\n\n    name = Path(sys.argv[0]).stem\n    render_window.SetSize(1000, 625)\n    render_window.Render()\n    render_window.SetWindowName(name)\n\n    if vtk_version_ok(9, 0, 20210718):\n        try:\n            cam_orient_manipulator = vtkCameraOrientationWidget()\n            cam_orient_manipulator.SetParentRenderer(ren2)\n            # Enable the widget.\n            cam_orient_manipulator.On()\n        except AttributeError:\n            pass\n    else:\n        axes = vtkAxesActor()\n        widget = vtkOrientationMarkerWidget()\n        rgba = [0.0, 0.0, 0.0, 0.0]\n        colors.GetColor(\"Carrot\", rgba)\n        widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n        widget.SetOrientationMarker(axes)\n        widget.SetInteractor(interactor)\n        widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n        widget.EnabledOn()\n        widget.InteractiveOn()\n\n    print_callback = PrintCallback(interactor, name, 1, False)\n    # print_callback = PrintCallback(interactor, name + '.jpg', 1, False)\n    interactor.AddObserver('KeyPressEvent', print_callback)\n\n    interactor.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\ndef get_boy():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricBoy()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_mobius():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricMobius()\n    surface.SetMinimumV(-0.25)\n    surface.SetMaximumV(0.25)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_random_hills():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricRandomHills()\n    surface.SetRandomSeed(1)\n    surface.SetNumberOfHills(30)\n    # If you want a plane\n    # surface.SetHillAmplitude(0)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_torus():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricTorus()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(surface.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, 0)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(surface.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(clipper.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(3)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(subdivide.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(5)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, -1)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(subdivide.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(clipper.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(cleaner.GetOutputPort())\n    normals.FlipNormalsOn()\n    normals.SetFeatureAngle(60)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(normals.GetOutputPort())\n    tangents.ComputeCellTangentsOn()\n    tangents.ComputePointTangentsOn()\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef uv_tcoords(u_resolution, v_resolution, pd):\n    \"\"\"\n    Generate u, v texture coordinates on a parametric surface.\n    :param u_resolution: u resolution\n    :param v_resolution: v resolution\n    :param pd: The polydata representing the surface.\n    :return: The polydata with the texture coordinates added.\n    \"\"\"\n    u0 = 1.0\n    v0 = 0.0\n    du = 1.0 / (u_resolution - 1)\n    dv = 1.0 / (v_resolution - 1)\n    num_pts = pd.GetNumberOfPoints()\n    t_coords = vtkFloatArray()\n    t_coords.SetNumberOfComponents(2)\n    t_coords.SetNumberOfTuples(num_pts)\n    t_coords.SetName('Texture Coordinates')\n    pt_id = 0\n    u = u0\n    for i in range(0, u_resolution):\n        v = v0\n        for j in range(0, v_resolution):\n            tc = [u, v]\n            t_coords.SetTuple(pt_id, tc)\n            v += dv\n            pt_id += 1\n        u -= du\n    pd.GetPointData().SetTCoords(t_coords)\n    return pd\n\n\nclass SliderProperties:\n    tube_width = 0.008\n    slider_length = 0.075\n    slider_width = 0.025\n    end_cap_length = 0.025\n    end_cap_width = 0.025\n    title_height = 0.025\n    label_height = 0.020\n\n    minimum_value = 0.0\n    maximum_value = 1.0\n    initial_value = 0.0\n\n    p1 = [0.02, 0.1]\n    p2 = [0.18, 0.1]\n\n    title = None\n\n    title_color = 'Black'\n    label_color = 'Black'\n    value_color = 'DarkSlateGray'\n    slider_color = 'BurlyWood'\n    selected_color = 'Lime'\n    bar_color = 'Black'\n    bar_ends_color = 'Indigo'\n\n\ndef make_slider_widget(properties):\n    colors = vtkNamedColors()\n\n    slider = vtkSliderRepresentation2D()\n\n    slider.SetMinimumValue(properties.minimum_value)\n    slider.SetMaximumValue(properties.maximum_value)\n    slider.SetValue(properties.initial_value)\n    slider.SetTitleText(properties.title)\n\n    slider.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint1Coordinate().SetValue(properties.p1[0], properties.p1[1])\n    slider.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint2Coordinate().SetValue(properties.p2[0], properties.p2[1])\n\n    slider.SetTubeWidth(properties.tube_width)\n    slider.SetSliderLength(properties.slider_length)\n    slider.SetSliderWidth(properties.slider_width)\n    slider.SetEndCapLength(properties.end_cap_length)\n    slider.SetEndCapWidth(properties.end_cap_width)\n    slider.SetTitleHeight(properties.title_height)\n    slider.SetLabelHeight(properties.label_height)\n\n    # Set the color properties\n    # Change the color of the title.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.title_color))\n    # Change the color of the label.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.label_color))\n    # Change the color of the bar.\n    slider.GetTubeProperty().SetColor(colors.GetColor3d(properties.bar_color))\n    # Change the color of the ends of the bar.\n    slider.GetCapProperty().SetColor(colors.GetColor3d(properties.bar_ends_color))\n    # Change the color of the knob that slides.\n    slider.GetSliderProperty().SetColor(colors.GetColor3d(properties.slider_color))\n    # Change the color of the knob when the mouse is held on it.\n    slider.GetSelectedProperty().SetColor(colors.GetColor3d(properties.selected_color))\n    # Change the color of the text displaying the value.\n    slider.GetLabelProperty().SetColor(colors.GetColor3d(properties.value_color))\n\n    slider_widget = vtkSliderWidget()\n    slider_widget.SetRepresentation(slider)\n\n    return slider_widget\n\n\nclass SliderCallbackExposure:\n    def __init__(self, tone_mapping_property):\n        self.tone_mapping_property = tone_mapping_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.tone_mapping_property.SetExposure(value)\n\n\nclass SliderCallbackMetallic:\n    def __init__(self, actor_property):\n        self.actor_property = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actor_property.SetMetallic(value)\n\n\nclass SliderCallbackRoughness:\n    def __init__(self, actor_property):\n        self.actor_property = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actor_property.SetRoughness(value)\n\n\nclass PrintCallback:\n    def __init__(self, caller, file_name, image_quality=1, rgba=True):\n        \"\"\"\n        Set the parameters for writing the\n         render window view to an image file.\n\n        :param caller: The caller for the callback.\n        :param file_name: The image file name.\n        :param image_quality: The image quality.\n        :param rgba: The buffer type, (if true, there is no background in the screenshot).\n        \"\"\"\n        self.caller = caller\n        self.image_quality = image_quality\n        self.rgba = rgba\n        if not file_name:\n            self.path = None\n            print(\"A file name is required.\")\n            return\n        pth = Path(file_name).absolute()\n        valid_suffixes = ['.jpeg', '.jpg', '.png']\n        if pth.suffix:\n            ext = pth.suffix.lower()\n        else:\n            ext = '.png'\n        if ext not in valid_suffixes:\n            ext = '.png'\n        self.suffix = ext\n        self.path = Path(str(pth)).with_suffix(ext)\n\n    def __call__(self, caller, ev):\n        if not self.path:\n            print(\"A file name is required.\")\n            return\n        # Save the screenshot.\n        if caller.GetKeyCode() == \"k\":\n            w2if = vtkWindowToImageFilter()\n            w2if.SetInput(caller.GetRenderWindow())\n            w2if.SetScale(self.image_quality, self.image_quality)\n            if self.rgba:\n                w2if.SetInputBufferTypeToRGBA()\n            else:\n                w2if.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            w2if.ReadFrontBufferOn()\n            w2if.Update()\n            if self.suffix in ['.jpeg', '.jpg']:\n                writer = vtkJPEGWriter()\n            else:\n                writer = vtkPNGWriter()\n            writer.SetFileName(self.path)\n            writer.SetInputData(w2if.GetOutput())\n            writer.Write()\n            print('Screenshot saved to:', self.path)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/PBR_Skybox_Anisotropy/","title":"PBR Skybox Anisotropy","text":"

vtk-examples/Python/Rendering/PBR_Skybox_Anisotropy

"},{"location":"Python/Rendering/PBR_Skybox_Anisotropy/#description","title":"Description","text":"

Demonstrates physically based rendering (PBR) using image based lighting, anisotropic texturing and a skybox.

Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

<DATA>/PBR_Skybox_Anisotropy.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Python/Rendering/PBR_Skybox_Anisotropy/#options","title":"Options","text":"
Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

Additionally, you can save a screenshot by pressing \"k\".

"},{"location":"Python/Rendering/PBR_Skybox_Anisotropy/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Skybox_Anisotropy.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/PBR_Skybox_Anisotropy/#code","title":"Code","text":"

PBR_Skybox_Anisotropy.py

#!/usr/bin/env python3\n\nimport json\nimport sys\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBoy,\n    vtkParametricMobius,\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkCommand,\n    vtkFloatArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkClipPolyData,\n    vtkPolyDataNormals,\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkLinearSubdivisionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkParametricFunctionSource,\n    vtkTexturedSphereSource\n)\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkJPEGWriter,\n    vtkImageReader2Factory,\n    vtkPNGWriter\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget,\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkCameraPass,\n    vtkLightsPass,\n    vtkOpaquePass,\n    vtkOverlayPass,\n    vtkRenderPassCollection,\n    vtkSequencePass,\n    vtkToneMappingPass\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrates physically based rendering, image based lighting, anisotropic texturing and a skybox.'\n    epilogue = '''\nPhysically based rendering sets color, metallicity and roughness of the object.\nImage based lighting uses a cubemap texture to specify the environment.\nTexturing is used to generate lighting effects.\nA Skybox is used to create the illusion of distant three-dimensional surroundings.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-s', '--surface', default='',\n                        help='The name of the surface. Overrides the surface entry in the json file.')\n    parser.add_argument('-c', '--use_cubemap', action='store_true',\n                        help='Build the cubemap from the six cubemap files.'\n                             ' Overrides the equirectangular entry in the json file.')\n    parser.add_argument('-t', '--use_tonemapping', action='store_true',\n                        help='Use tone mapping.')\n    args = parser.parse_args()\n    return args.file_name, args.surface, args.use_cubemap, args.use_tonemapping\n\n\ndef main():\n    if not vtk_version_ok(9, 0, 0):\n        print('You need VTK version 9.0 or greater to run this program.')\n        return\n\n    colors = vtkNamedColors()\n\n    # Default background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    # Default background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    fn, surface_name, use_cubemap, use_tonemapping = get_program_parameters()\n\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n\n    # Check for missing parameters.\n    if 'bkgcolor' not in parameters.keys():\n        parameters['bkgcolor'] = 'BkgColor'\n    if 'objcolor' not in parameters.keys():\n        parameters['objcolor'] = 'White'\n    if 'skybox' not in parameters.keys():\n        parameters['skybox'] = False\n    if surface_name:\n        parameters['object'] = surface_name\n\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    if not check_for_missing_textures(parameters, ['albedo', 'normal', 'material', 'anisotropy']):\n        return\n\n    # Build the pipeline.\n    # ren1 is for the slider rendering,\n    # ren2 is for the object rendering.\n    ren1 = vtkRenderer()\n    # ren2 = vtkOpenGLRenderer()\n    ren2 = vtkRenderer()\n    ren1.SetBackground(colors.GetColor3d('Snow'))\n    ren2.SetBackground(colors.GetColor3d(parameters['bkgcolor']))\n\n    render_window = vtkRenderWindow()\n    # The order here is important.\n    # This ensures that the sliders will be in ren1.\n    render_window.AddRenderer(ren2)\n    render_window.AddRenderer(ren1)\n    ren1.SetViewport(0.0, 0.0, 0.2, 1.0)\n    ren2.SetViewport(0.2, 0.0, 1, 1)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n    style = vtkInteractorStyleTrackballCamera()\n    interactor.SetInteractorStyle(style)\n\n    # Set up tone mapping, so we can vary the exposure.\n    # Custom Passes.\n    camera_p = vtkCameraPass()\n    seq = vtkSequencePass()\n    opaque = vtkOpaquePass()\n    lights = vtkLightsPass()\n    overlay = vtkOverlayPass()\n\n    passes = vtkRenderPassCollection()\n    passes.AddItem(lights)\n    passes.AddItem(opaque)\n    passes.AddItem(overlay)\n    seq.SetPasses(passes)\n    camera_p.SetDelegatePass(seq)\n\n    tone_mapping_p = vtkToneMappingPass()\n    tone_mapping_p.SetDelegatePass(camera_p)\n\n    if use_tonemapping:\n        ren2.SetPass(tone_mapping_p)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren2.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    # Turn off the default lighting and use image based lighting.\n    ren2.AutomaticLightCreationOff()\n    ren2.UseImageBasedLightingOn()\n    if is_hdr:\n        ren2.UseSphericalHarmonicsOn()\n        ren2.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren2.UseSphericalHarmonicsOff()\n        ren2.SetEnvironmentTexture(env_texture, True)\n\n    # Get the textures\n    base_color = read_texture(parameters['albedo'])\n    base_color.SetColorModeToDirectScalars()\n    base_color.UseSRGBColorSpaceOn()\n    normal = read_texture(parameters['normal'])\n    normal.SetColorModeToDirectScalars()\n    material = read_texture(parameters['material'])\n    material.SetColorModeToDirectScalars()\n    anisotropy = read_texture(parameters['anisotropy'])\n    anisotropy.SetColorModeToDirectScalars()\n\n    # Get the surface.\n    surface = parameters['object'].lower()\n    available_surfaces = {'boy', 'mobius', 'randomhills', 'torus', 'sphere', 'clippedsphere', 'cube', 'clippedcube'}\n    if surface not in available_surfaces:\n        print(f'The requested surface: {parameters[\"object\"]} not found, reverting to Boys Surface.')\n        surface = 'boy'\n    if surface == 'mobius':\n        source = get_mobius()\n    elif surface == 'randomhills':\n        source = get_random_hills()\n    elif surface == 'torus':\n        source = get_torus()\n    elif surface == 'sphere':\n        source = get_sphere()\n    elif surface == 'clippedsphere':\n        source = get_clipped_sphere()\n    elif surface == 'cube':\n        source = get_cube()\n    elif surface == 'clippedcube':\n        source = get_clipped_cube()\n    else:\n        source = get_boy()\n\n    # Let's use a nonmetallic surface\n    diffuse_coefficient = 1.0\n    roughness_coefficient = 0.3\n    metallic_coefficient = 0.0\n    # Other parameters.\n    occlusion_strength = 1.0\n    normal_scale = 1.0\n    anisotropy_coefficient = 1.0\n    anisotropy_rotation = 0.0\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(source)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    # Enable PBR on the model.\n    actor.GetProperty().SetInterpolationToPBR()\n    # Configure the basic properties.\n    # Set the model colour.\n    actor.GetProperty().SetColor(colors.GetColor3d('White'))\n    actor.GetProperty().SetDiffuse(diffuse_coefficient)\n    actor.GetProperty().SetRoughness(roughness_coefficient)\n    actor.GetProperty().SetMetallic(metallic_coefficient)\n    # Configure textures (needs tcoords on the mesh).\n    actor.GetProperty().SetBaseColorTexture(base_color)\n    actor.GetProperty().SetORMTexture(material)\n    actor.GetProperty().SetOcclusionStrength(occlusion_strength)\n    # Needs tcoords, normals and tangents on the mesh.\n    actor.GetProperty().SetNormalTexture(normal)\n    actor.GetProperty().SetNormalScale(normal_scale)\n    actor.GetProperty().SetAnisotropyTexture(anisotropy)\n    actor.GetProperty().SetAnisotropy(anisotropy_coefficient)\n    actor.GetProperty().SetAnisotropyRotation(anisotropy_rotation)\n    ren2.AddActor(actor)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren2.AddActor(skybox)\n\n    # Create the slider callbacks to manipulate various parameters.\n    step_size = 1.0 / 7\n    pos_y = 0.1\n    pos_x0 = 0.02\n    pos_x1 = 0.18\n\n    sw_p = SliderProperties()\n\n    sw_p.initial_value = 1.0\n    sw_p.maximum_value = 5.0\n    sw_p.title = 'Exposure'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_exposure = make_slider_widget(sw_p)\n    sw_exposure.SetInteractor(interactor)\n    sw_exposure.SetAnimationModeToAnimate()\n    if use_tonemapping:\n        sw_exposure.EnabledOn()\n    else:\n        sw_exposure.EnabledOff()\n    sw_exposure.SetCurrentRenderer(ren1)\n    sw_exposure_cb = SliderCallbackExposure(tone_mapping_p)\n    sw_exposure.AddObserver(vtkCommand.InteractionEvent, sw_exposure_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = metallic_coefficient\n    sw_p.maximum_value = 1.0\n    sw_p.title = 'Metallicity'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_metallic = make_slider_widget(sw_p)\n    sw_metallic.SetInteractor(interactor)\n    sw_metallic.SetAnimationModeToAnimate()\n    sw_metallic.EnabledOn()\n    sw_metallic.SetCurrentRenderer(ren1)\n    sw_metallic_cb = SliderCallbackMetallic(actor.GetProperty())\n    sw_metallic.AddObserver(vtkCommand.InteractionEvent, sw_metallic_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = roughness_coefficient\n    sw_p.title = 'Roughness'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_roughnesss = make_slider_widget(sw_p)\n    sw_roughnesss.SetInteractor(interactor)\n    sw_roughnesss.SetAnimationModeToAnimate()\n    sw_roughnesss.EnabledOn()\n    sw_roughnesss.SetCurrentRenderer(ren1)\n    sw_roughnesss_cb = SliderCallbackRoughness(actor.GetProperty())\n    sw_roughnesss.AddObserver(vtkCommand.InteractionEvent, sw_roughnesss_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = occlusion_strength\n    sw_p.maximum_value = 5\n    sw_p.title = 'Occlusion'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_occlusion_strength = make_slider_widget(sw_p)\n    sw_occlusion_strength.SetInteractor(interactor)\n    sw_occlusion_strength.SetAnimationModeToAnimate()\n    sw_occlusion_strength.EnabledOn()\n    sw_occlusion_strength.SetCurrentRenderer(ren1)\n    sw_occlusion_strength_cb = SliderCallbackOcclusionStrength(actor.GetProperty())\n    sw_occlusion_strength.AddObserver(vtkCommand.InteractionEvent, sw_occlusion_strength_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = normal_scale\n    sw_p.maximum_value = 5\n    sw_p.title = 'Normal'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_normal = make_slider_widget(sw_p)\n    sw_normal.SetInteractor(interactor)\n    sw_normal.SetAnimationModeToAnimate()\n    sw_normal.EnabledOn()\n    sw_normal.SetCurrentRenderer(ren1)\n    sw_normal_cb = SliderCallbackNormalScale(actor.GetProperty())\n    sw_normal.AddObserver(vtkCommand.InteractionEvent, sw_normal_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = anisotropy_coefficient\n    sw_p.maximum_value = 1\n    sw_p.title = 'Anisotropy'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_anisotropy = make_slider_widget(sw_p)\n    sw_anisotropy.SetInteractor(interactor)\n    sw_anisotropy.SetAnimationModeToAnimate()\n    sw_anisotropy.EnabledOn()\n    sw_anisotropy.SetCurrentRenderer(ren1)\n    sw_anisotropy_cb = SliderCallbackAnisotropy(actor.GetProperty())\n    sw_anisotropy.AddObserver(vtkCommand.InteractionEvent, sw_anisotropy_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = anisotropy_rotation\n    sw_p.maximum_value = 1\n    sw_p.title = 'Anisotropy Rotation'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_anisotropy_rotation = make_slider_widget(sw_p)\n    sw_anisotropy_rotation.SetInteractor(interactor)\n    sw_anisotropy_rotation.SetAnimationModeToAnimate()\n    sw_anisotropy_rotation.EnabledOn()\n    sw_anisotropy_rotation.SetCurrentRenderer(ren1)\n    sw_anisotropy_rotation_cb = SliderCallbackAnisotropyRotation(actor.GetProperty())\n    sw_anisotropy_rotation.AddObserver(vtkCommand.InteractionEvent, sw_anisotropy_rotation_cb)\n\n    name = Path(sys.argv[0]).stem\n    render_window.SetSize(1000, 625)\n    render_window.Render()\n    render_window.SetWindowName(name)\n\n    if vtk_version_ok(9, 0, 20210718):\n        try:\n            cam_orient_manipulator = vtkCameraOrientationWidget()\n            cam_orient_manipulator.SetParentRenderer(ren2)\n            # Enable the widget.\n            cam_orient_manipulator.On()\n        except AttributeError:\n            pass\n    else:\n        axes = vtkAxesActor()\n        widget = vtkOrientationMarkerWidget()\n        rgba = [0.0, 0.0, 0.0, 0.0]\n        colors.GetColor(\"Carrot\", rgba)\n        widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n        widget.SetOrientationMarker(axes)\n        widget.SetInteractor(interactor)\n        widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n        widget.EnabledOn()\n        widget.InteractiveOn()\n\n    print_callback = PrintCallback(interactor, name, 1, False)\n    # print_callback = PrintCallback(interactor, name + '.jpg', 1, False)\n    interactor.AddObserver('KeyPressEvent', print_callback)\n\n    interactor.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\ndef read_texture(image_path):\n    \"\"\"\n    Read an image and convert it to a texture\n    :param image_path: The image path.\n    :return: The texture.\n    \"\"\"\n\n    suffix = image_path.suffix.lower()\n    valid_extensions = ['.jpg', '.png', '.bmp', '.tiff', '.pnm', '.pgm', '.ppm']\n    if suffix not in valid_extensions:\n        print('Unable to read the texture file (wrong extension):', image_path)\n        return None\n\n    # Read the images\n    reader_factory = vtkImageReader2Factory()\n    img_reader = reader_factory.CreateImageReader2(str(image_path))\n    img_reader.SetFileName(str(image_path))\n\n    texture = vtkTexture()\n    texture.InterpolateOn()\n    texture.SetInputConnection(img_reader.GetOutputPort())\n    texture.Update()\n\n    return texture\n\n\ndef check_for_missing_textures(parameters, wanted_textures):\n    \"\"\"\n    Check that the needed textures exist.\n\n    :param parameters: The parameters.\n    :param wanted_textures: The wanted textures.\n    :return: True if all the wanted textures are present.\n    \"\"\"\n    have_textures = True\n    for texture_name in wanted_textures:\n        if texture_name not in parameters:\n            print('Missing texture:', texture_name)\n            have_textures = False\n        elif not parameters[texture_name]:\n            print('No texture path for:', texture_name)\n            have_textures = False\n\n    return have_textures\n\n\ndef get_boy():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricBoy()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_mobius():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricMobius()\n    surface.SetMinimumV(-0.25)\n    surface.SetMaximumV(0.25)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_random_hills():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricRandomHills()\n    surface.SetRandomSeed(1)\n    surface.SetNumberOfHills(30)\n    # If you want a plane\n    # surface.SetHillAmplitude(0)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_torus():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricTorus()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(surface.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, 0)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(surface.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(clipper.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(3)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(subdivide.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(5)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, -1)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(subdivide.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(clipper.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(cleaner.GetOutputPort())\n    normals.FlipNormalsOn()\n    normals.SetFeatureAngle(60)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(normals.GetOutputPort())\n    tangents.ComputeCellTangentsOn()\n    tangents.ComputePointTangentsOn()\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef uv_tcoords(u_resolution, v_resolution, pd):\n    \"\"\"\n    Generate u, v texture coordinates on a parametric surface.\n    :param u_resolution: u resolution\n    :param v_resolution: v resolution\n    :param pd: The polydata representing the surface.\n    :return: The polydata with the texture coordinates added.\n    \"\"\"\n    u0 = 1.0\n    v0 = 0.0\n    du = 1.0 / (u_resolution - 1)\n    dv = 1.0 / (v_resolution - 1)\n    num_pts = pd.GetNumberOfPoints()\n    t_coords = vtkFloatArray()\n    t_coords.SetNumberOfComponents(2)\n    t_coords.SetNumberOfTuples(num_pts)\n    t_coords.SetName('Texture Coordinates')\n    pt_id = 0\n    u = u0\n    for i in range(0, u_resolution):\n        v = v0\n        for j in range(0, v_resolution):\n            tc = [u, v]\n            t_coords.SetTuple(pt_id, tc)\n            v += dv\n            pt_id += 1\n        u -= du\n    pd.GetPointData().SetTCoords(t_coords)\n    return pd\n\n\nclass SliderProperties:\n    tube_width = 0.008\n    slider_length = 0.075\n    slider_width = 0.025\n    end_cap_length = 0.025\n    end_cap_width = 0.025\n    title_height = 0.025\n    label_height = 0.020\n\n    minimum_value = 0.0\n    maximum_value = 1.0\n    initial_value = 0.0\n\n    p1 = [0.02, 0.1]\n    p2 = [0.18, 0.1]\n\n    title = None\n\n    title_color = 'Black'\n    label_color = 'Black'\n    value_color = 'DarkSlateGray'\n    slider_color = 'BurlyWood'\n    selected_color = 'Lime'\n    bar_color = 'Black'\n    bar_ends_color = 'Indigo'\n\n\ndef make_slider_widget(properties):\n    colors = vtkNamedColors()\n\n    slider = vtkSliderRepresentation2D()\n\n    slider.SetMinimumValue(properties.minimum_value)\n    slider.SetMaximumValue(properties.maximum_value)\n    slider.SetValue(properties.initial_value)\n    slider.SetTitleText(properties.title)\n\n    slider.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint1Coordinate().SetValue(properties.p1[0], properties.p1[1])\n    slider.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint2Coordinate().SetValue(properties.p2[0], properties.p2[1])\n\n    slider.SetTubeWidth(properties.tube_width)\n    slider.SetSliderLength(properties.slider_length)\n    slider.SetSliderWidth(properties.slider_width)\n    slider.SetEndCapLength(properties.end_cap_length)\n    slider.SetEndCapWidth(properties.end_cap_width)\n    slider.SetTitleHeight(properties.title_height)\n    slider.SetLabelHeight(properties.label_height)\n\n    # Set the color properties\n    # Change the color of the title.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.title_color))\n    # Change the color of the label.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.label_color))\n    # Change the color of the bar.\n    slider.GetTubeProperty().SetColor(colors.GetColor3d(properties.bar_color))\n    # Change the color of the ends of the bar.\n    slider.GetCapProperty().SetColor(colors.GetColor3d(properties.bar_ends_color))\n    # Change the color of the knob that slides.\n    slider.GetSliderProperty().SetColor(colors.GetColor3d(properties.slider_color))\n    # Change the color of the knob when the mouse is held on it.\n    slider.GetSelectedProperty().SetColor(colors.GetColor3d(properties.selected_color))\n    # Change the color of the text displaying the value.\n    slider.GetLabelProperty().SetColor(colors.GetColor3d(properties.value_color))\n\n    slider_widget = vtkSliderWidget()\n    slider_widget.SetRepresentation(slider)\n\n    return slider_widget\n\n\nclass SliderCallbackExposure:\n    def __init__(self, tone_mapping_property):\n        self.tone_mapping_property = tone_mapping_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.tone_mapping_property.SetExposure(value)\n\n\nclass SliderCallbackMetallic:\n    def __init__(self, actor_property):\n        self.actor_property = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actor_property.SetMetallic(value)\n\n\nclass SliderCallbackRoughness:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetRoughness(value)\n\n\nclass SliderCallbackOcclusionStrength:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetOcclusionStrength(value)\n\n\nclass SliderCallbackNormalScale:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetNormalScale(value)\n\n\nclass SliderCallbackAnisotropy:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetAnisotropy(value)\n\n\nclass SliderCallbackAnisotropyRotation:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetAnisotropyRotation(value)\n\n\nclass PrintCallback:\n    def __init__(self, caller, file_name, image_quality=1, rgba=True):\n        \"\"\"\n        Set the parameters for writing the\n         render window view to an image file.\n\n        :param caller: The caller for the callback.\n        :param file_name: The image file name.\n        :param image_quality: The image quality.\n        :param rgba: The buffer type, (if true, there is no background in the screenshot).\n        \"\"\"\n        self.caller = caller\n        self.image_quality = image_quality\n        self.rgba = rgba\n        if not file_name:\n            self.path = None\n            print(\"A file name is required.\")\n            return\n        pth = Path(file_name).absolute()\n        valid_suffixes = ['.jpeg', '.jpg', '.png']\n        if pth.suffix:\n            ext = pth.suffix.lower()\n        else:\n            ext = '.png'\n        if ext not in valid_suffixes:\n            ext = '.png'\n        self.suffix = ext\n        self.path = Path(str(pth)).with_suffix(ext)\n\n    def __call__(self, caller, ev):\n        if not self.path:\n            print(\"A file name is required.\")\n            return\n        # Save the screenshot.\n        if caller.GetKeyCode() == \"k\":\n            w2if = vtkWindowToImageFilter()\n            w2if.SetInput(caller.GetRenderWindow())\n            w2if.SetScale(self.image_quality, self.image_quality)\n            if self.rgba:\n                w2if.SetInputBufferTypeToRGBA()\n            else:\n                w2if.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            w2if.ReadFrontBufferOn()\n            w2if.Update()\n            if self.suffix in ['.jpeg', '.jpg']:\n                writer = vtkJPEGWriter()\n            else:\n                writer = vtkPNGWriter()\n            writer.SetFileName(self.path)\n            writer.SetInputData(w2if.GetOutput())\n            writer.Write()\n            print('Screenshot saved to:', self.path)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/PBR_Skybox_Texturing/","title":"PBR Skybox Texturing","text":"

vtk-examples/Python/Rendering/PBR_Skybox_Texturing

"},{"location":"Python/Rendering/PBR_Skybox_Texturing/#description","title":"Description","text":"

Demonstrates physically based rendering (PBR) using image based lighting, texturing and a skybox.

Physically based rendering sets metallicity, roughness, occlusion strength, the emissive factor and normal scaling of the object. Textures are used to set base color, ORM, emissivity and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

<DATA>/PBR_Skybox_Texturing.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

For information about the parameters in the JSON file, please see PBR_JSON_format.

"},{"location":"Python/Rendering/PBR_Skybox_Texturing/#options","title":"Options","text":"
Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

Additionally, you can save a screenshot by pressing \"k\".

"},{"location":"Python/Rendering/PBR_Skybox_Texturing/#further-reading","title":"Further Reading","text":"
  • Introducing Physically Based Rendering with VTK
  • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
  • PBR Journey Part 2 : Anisotropy model with VTK
  • PBR Journey Part 3 : Clear Coat Model with VTK
  • Object Shading Properties

Note

  • <DATA>/PBR_Skybox_Texturing.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
  • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

Note

  • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/PBR_Skybox_Texturing/#code","title":"Code","text":"

PBR_Skybox_Texturing.py

#!/usr/bin/env python3\n\nimport json\nimport sys\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBoy,\n    vtkParametricMobius,\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkCommand,\n    vtkFloatArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkClipPolyData,\n    vtkPolyDataNormals,\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkLinearSubdivisionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkParametricFunctionSource,\n    vtkTexturedSphereSource\n)\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkJPEGWriter,\n    vtkImageReader2Factory,\n    vtkPNGWriter\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget,\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkCameraPass,\n    vtkLightsPass,\n    vtkOpaquePass,\n    vtkOverlayPass,\n    vtkRenderPassCollection,\n    vtkSequencePass,\n    vtkToneMappingPass\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrates physically based rendering, image based lighting, texturing and a skybox.'\n    epilogue = '''\nPhysically based rendering sets color, metallicity and roughness of the object.\nImage based lighting uses a cubemap texture to specify the environment.\nTexturing is used to generate lighting effects.\nA Skybox is used to create the illusion of distant three-dimensional surroundings.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-s', '--surface', default='',\n                        help='The name of the surface. Overrides the surface entry in the json file.')\n    parser.add_argument('-c', '--use_cubemap', action='store_true',\n                        help='Build the cubemap from the six cubemap files.'\n                             ' Overrides the equirectangular entry in the json file.')\n    parser.add_argument('-t', '--use_tonemapping', action='store_true',\n                        help='Use tone mapping.')\n    args = parser.parse_args()\n    return args.file_name, args.surface, args.use_cubemap, args.use_tonemapping\n\n\ndef main():\n    if not vtk_version_ok(9, 0, 0):\n        print('You need VTK version 9.0 or greater to run this program.')\n        return\n\n    colors = vtkNamedColors()\n\n    # Default background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n    colors.SetColor('VTKBlue', [6, 79, 141, 255])\n    # Let's make a complementary colour to VTKBlue.\n    colors.SetColor('VTKBlueComp', [249, 176, 114, 255])\n\n    fn, surface_name, use_cubemap, use_tonemapping = get_program_parameters()\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n\n    # Check for missing parameters.\n    if 'bkgcolor' not in parameters.keys():\n        parameters['bkgcolor'] = 'BkgColor'\n    if 'objcolor' not in parameters.keys():\n        parameters['objcolor'] = 'White'\n    if 'skybox' not in parameters.keys():\n        parameters['skybox'] = False\n    if surface_name:\n        parameters['object'] = surface_name\n\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    if not check_for_missing_textures(parameters, ['albedo', 'normal', 'material', 'emissive']):\n        return\n\n    # Build the pipeline.\n    # ren1 is for the slider rendering,\n    # ren2 is for the object rendering.\n    ren1 = vtkRenderer()\n    # ren2 = vtkOpenGLRenderer()\n    ren2 = vtkRenderer()\n    ren1.SetBackground(colors.GetColor3d('Snow'))\n    ren2.SetBackground(colors.GetColor3d(parameters['bkgcolor']))\n\n    render_window = vtkRenderWindow()\n    # The order here is important.\n    # This ensures that the sliders will be in ren1.\n    render_window.AddRenderer(ren2)\n    render_window.AddRenderer(ren1)\n    ren1.SetViewport(0.0, 0.0, 0.2, 1.0)\n    ren2.SetViewport(0.2, 0.0, 1, 1)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n    style = vtkInteractorStyleTrackballCamera()\n    interactor.SetInteractorStyle(style)\n\n    # Set up tone mapping, so we can vary the exposure.\n    # Custom Passes.\n    camera_p = vtkCameraPass()\n    seq = vtkSequencePass()\n    opaque = vtkOpaquePass()\n    lights = vtkLightsPass()\n    overlay = vtkOverlayPass()\n\n    passes = vtkRenderPassCollection()\n    passes.AddItem(lights)\n    passes.AddItem(opaque)\n    passes.AddItem(overlay)\n    seq.SetPasses(passes)\n    camera_p.SetDelegatePass(seq)\n\n    tone_mapping_p = vtkToneMappingPass()\n    tone_mapping_p.SetDelegatePass(camera_p)\n\n    if use_tonemapping:\n        ren2.SetPass(tone_mapping_p)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren2.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    # Turn off the default lighting and use image based lighting.\n    ren2.AutomaticLightCreationOff()\n    ren2.UseImageBasedLightingOn()\n    if is_hdr:\n        ren2.UseSphericalHarmonicsOn()\n        ren2.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren2.UseSphericalHarmonicsOff()\n        ren2.SetEnvironmentTexture(env_texture, True)\n\n    # Get the textures\n    base_color = read_texture(parameters['albedo'])\n    base_color.UseSRGBColorSpaceOn()\n    normal = read_texture(parameters['normal'])\n    material = read_texture(parameters['material'])\n    emissive = read_texture(parameters['emissive'])\n    emissive.UseSRGBColorSpaceOn()\n\n    # Get the surface\n    surface = parameters['object'].lower()\n    available_surfaces = {'boy', 'mobius', 'randomhills', 'torus', 'sphere', 'clippedsphere', 'cube', 'clippedcube'}\n    if surface not in available_surfaces:\n        print(f'The requested surface: {parameters[\"object\"]} not found, reverting to Boys Surface.')\n        surface = 'boy'\n    if surface == 'mobius':\n        source = get_mobius()\n    elif surface == 'randomhills':\n        source = get_random_hills()\n    elif surface == 'torus':\n        source = get_torus()\n    elif surface == 'sphere':\n        source = get_sphere()\n    elif surface == 'clippedsphere':\n        source = get_clipped_sphere()\n    elif surface == 'cube':\n        source = get_cube()\n    elif surface == 'clippedcube':\n        source = get_clipped_cube()\n    else:\n        source = get_boy()\n\n    # Let's use a nonmetallic surface.\n    diffuse_coefficient = 1.0\n    roughness_coefficient = 0.3\n    metallic_coefficient = 0.0\n    # Other parameters.\n    occlusion_strength = 1.0\n    normal_scale = 1.0\n    # emissive_col = colors.GetColor3d('VTKBlueComp')\n    # emissive_factor = emissive_col\n    # Make VTK silvery in appearance.\n    emissive_factor = [1.0, 1.0, 1.0]\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(source)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    # Enable PBR on the model.\n    actor.GetProperty().SetInterpolationToPBR()\n    # Configure the basic properties.\n    actor.GetProperty().SetColor(colors.GetColor3d(parameters['objcolor']))\n    actor.GetProperty().SetDiffuse(diffuse_coefficient)\n    actor.GetProperty().SetRoughness(roughness_coefficient)\n    actor.GetProperty().SetMetallic(metallic_coefficient)\n    # Configure textures (needs tcoords on the mesh).\n    actor.GetProperty().SetBaseColorTexture(base_color)\n    actor.GetProperty().SetORMTexture(material)\n    actor.GetProperty().SetOcclusionStrength(occlusion_strength)\n    actor.GetProperty().SetEmissiveTexture(emissive)\n    actor.GetProperty().SetEmissiveFactor(emissive_factor)\n    # Needs tcoords, normals and tangents on the mesh.\n    actor.GetProperty().SetNormalTexture(normal)\n    actor.GetProperty().SetNormalScale(normal_scale)\n    ren2.AddActor(actor)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren2.AddActor(skybox)\n\n    # Create the slider callbacks to manipulate various parameters.\n    step_size = 1.0 / 5\n    pos_y = 0.1\n    pos_x0 = 0.02\n    pos_x1 = 0.18\n\n    sw_p = SliderProperties()\n\n    sw_p.initial_value = 1.0\n    sw_p.maximum_value = 5.0\n    sw_p.title = 'Exposure'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_exposure = make_slider_widget(sw_p)\n    sw_exposure.SetInteractor(interactor)\n    sw_exposure.SetAnimationModeToAnimate()\n    if use_tonemapping:\n        sw_exposure.EnabledOn()\n    else:\n        sw_exposure.EnabledOff()\n    sw_exposure.SetCurrentRenderer(ren1)\n    sw_exposure_cb = SliderCallbackExposure(tone_mapping_p)\n    sw_exposure.AddObserver(vtkCommand.InteractionEvent, sw_exposure_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = metallic_coefficient\n    sw_p.maximum_value = 1.0\n    sw_p.title = 'Metallicity'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_metallic = make_slider_widget(sw_p)\n    sw_metallic.SetInteractor(interactor)\n    sw_metallic.SetAnimationModeToAnimate()\n    sw_metallic.EnabledOn()\n    sw_metallic.SetCurrentRenderer(ren1)\n    sw_metallic_cb = SliderCallbackMetallic(actor.GetProperty())\n    sw_metallic.AddObserver(vtkCommand.InteractionEvent, sw_metallic_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = roughness_coefficient\n    sw_p.title = 'Roughness'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_roughnesss = make_slider_widget(sw_p)\n    sw_roughnesss.SetInteractor(interactor)\n    sw_roughnesss.SetAnimationModeToAnimate()\n    sw_roughnesss.EnabledOn()\n    sw_roughnesss.SetCurrentRenderer(ren1)\n    sw_roughnesss_cb = SliderCallbackRoughness(actor.GetProperty())\n    sw_roughnesss.AddObserver(vtkCommand.InteractionEvent, sw_roughnesss_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = occlusion_strength\n    sw_p.maximum_value = 1\n    sw_p.title = 'Occlusion'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_occlusion_strength = make_slider_widget(sw_p)\n    sw_occlusion_strength.SetInteractor(interactor)\n    sw_occlusion_strength.SetAnimationModeToAnimate()\n    sw_occlusion_strength.EnabledOn()\n    sw_occlusion_strength.SetCurrentRenderer(ren1)\n    sw_occlusion_strength_cb = SliderCallbackOcclusionStrength(actor.GetProperty())\n    sw_occlusion_strength.AddObserver(vtkCommand.InteractionEvent, sw_occlusion_strength_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = normal_scale\n    sw_p.maximum_value = 5\n    sw_p.title = 'Normal'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_normal = make_slider_widget(sw_p)\n    sw_normal.SetInteractor(interactor)\n    sw_normal.SetAnimationModeToAnimate()\n    sw_normal.EnabledOn()\n    sw_normal.SetCurrentRenderer(ren1)\n    sw_normal_cb = SliderCallbackNormalScale(actor.GetProperty())\n    sw_normal.AddObserver(vtkCommand.InteractionEvent, sw_normal_cb)\n\n    name = Path(sys.argv[0]).stem\n    render_window.SetSize(1000, 625)\n    render_window.Render()\n    render_window.SetWindowName(name)\n\n    if vtk_version_ok(9, 0, 20210718):\n        try:\n            cam_orient_manipulator = vtkCameraOrientationWidget()\n            cam_orient_manipulator.SetParentRenderer(ren2)\n            # Enable the widget.\n            cam_orient_manipulator.On()\n        except AttributeError:\n            pass\n    else:\n        axes = vtkAxesActor()\n        widget = vtkOrientationMarkerWidget()\n        rgba = [0.0, 0.0, 0.0, 0.0]\n        colors.GetColor(\"Carrot\", rgba)\n        widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n        widget.SetOrientationMarker(axes)\n        widget.SetInteractor(interactor)\n        widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n        widget.EnabledOn()\n        widget.InteractiveOn()\n\n    print_callback = PrintCallback(interactor, name, 1, False)\n    # print_callback = PrintCallback(interactor, name + '.jpg', 1, False)\n    interactor.AddObserver('KeyPressEvent', print_callback)\n\n    interactor.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\ndef read_texture(image_path):\n    \"\"\"\n    Read an image and convert it to a texture\n    :param image_path: The image path.\n    :return: The texture.\n    \"\"\"\n\n    suffix = image_path.suffix.lower()\n    valid_extensions = ['.jpg', '.png', '.bmp', '.tiff', '.pnm', '.pgm', '.ppm']\n    if suffix not in valid_extensions:\n        print('Unable to read the texture file (wrong extension):', image_path)\n        return None\n\n    # Read the images\n    reader_factory = vtkImageReader2Factory()\n    img_reader = reader_factory.CreateImageReader2(str(image_path))\n    img_reader.SetFileName(str(image_path))\n\n    texture = vtkTexture()\n    texture.InterpolateOn()\n    texture.SetInputConnection(img_reader.GetOutputPort(0))\n    texture.Update()\n\n    return texture\n\n\ndef check_for_missing_textures(parameters, wanted_textures):\n    \"\"\"\n    Check that the needed textures exist.\n\n    :param parameters: The parameters.\n    :param wanted_textures: The wanted textures.\n    :return: True if all the wanted textures are present.\n    \"\"\"\n    have_textures = True\n    for texture_name in wanted_textures:\n        if texture_name not in parameters:\n            print('Missing texture:', texture_name)\n            have_textures = False\n        elif not parameters[texture_name]:\n            print('No texture path for:', texture_name)\n            have_textures = False\n\n    return have_textures\n\n\ndef get_boy():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricBoy()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_mobius():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricMobius()\n    surface.SetMinimumV(-0.25)\n    surface.SetMaximumV(0.25)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_random_hills():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricRandomHills()\n    surface.SetRandomSeed(1)\n    surface.SetNumberOfHills(30)\n    # If you want a plane\n    # surface.SetHillAmplitude(0)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_torus():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricTorus()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(surface.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, 0)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(surface.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(clipper.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(3)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(subdivide.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(5)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, -1)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(subdivide.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(clipper.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(cleaner.GetOutputPort())\n    normals.FlipNormalsOn()\n    normals.SetFeatureAngle(60)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(normals.GetOutputPort())\n    tangents.ComputeCellTangentsOn()\n    tangents.ComputePointTangentsOff()\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef uv_tcoords(u_resolution, v_resolution, pd):\n    \"\"\"\n    Generate u, v texture coordinates on a parametric surface.\n    :param u_resolution: u resolution\n    :param v_resolution: v resolution\n    :param pd: The polydata representing the surface.\n    :return: The polydata with the texture coordinates added.\n    \"\"\"\n    u0 = 1.0\n    v0 = 0.0\n    du = 1.0 / (u_resolution - 1)\n    dv = 1.0 / (v_resolution - 1)\n    num_pts = pd.GetNumberOfPoints()\n    t_coords = vtkFloatArray()\n    t_coords.SetNumberOfComponents(2)\n    t_coords.SetNumberOfTuples(num_pts)\n    t_coords.SetName('Texture Coordinates')\n    pt_id = 0\n    u = u0\n    for i in range(0, u_resolution):\n        v = v0\n        for j in range(0, v_resolution):\n            tc = [u, v]\n            t_coords.SetTuple(pt_id, tc)\n            v += dv\n            pt_id += 1\n        u -= du\n    pd.GetPointData().SetTCoords(t_coords)\n    return pd\n\n\nclass SliderProperties:\n    tube_width = 0.008\n    slider_length = 0.075\n    slider_width = 0.025\n    end_cap_length = 0.025\n    end_cap_width = 0.025\n    title_height = 0.025\n    label_height = 0.020\n\n    minimum_value = 0.0\n    maximum_value = 1.0\n    initial_value = 0.0\n\n    p1 = [0.02, 0.1]\n    p2 = [0.18, 0.1]\n\n    title = None\n\n    title_color = 'Black'\n    label_color = 'Black'\n    value_color = 'DarkSlateGray'\n    slider_color = 'BurlyWood'\n    selected_color = 'Lime'\n    bar_color = 'Black'\n    bar_ends_color = 'Indigo'\n\n\ndef make_slider_widget(properties):\n    colors = vtkNamedColors()\n\n    slider = vtkSliderRepresentation2D()\n\n    slider.SetMinimumValue(properties.minimum_value)\n    slider.SetMaximumValue(properties.maximum_value)\n    slider.SetValue(properties.initial_value)\n    slider.SetTitleText(properties.title)\n\n    slider.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint1Coordinate().SetValue(properties.p1[0], properties.p1[1])\n    slider.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint2Coordinate().SetValue(properties.p2[0], properties.p2[1])\n\n    slider.SetTubeWidth(properties.tube_width)\n    slider.SetSliderLength(properties.slider_length)\n    slider.SetSliderWidth(properties.slider_width)\n    slider.SetEndCapLength(properties.end_cap_length)\n    slider.SetEndCapWidth(properties.end_cap_width)\n    slider.SetTitleHeight(properties.title_height)\n    slider.SetLabelHeight(properties.label_height)\n\n    # Set the color properties\n    # Change the color of the title.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.title_color))\n    # Change the color of the label.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.label_color))\n    # Change the color of the bar.\n    slider.GetTubeProperty().SetColor(colors.GetColor3d(properties.bar_color))\n    # Change the color of the ends of the bar.\n    slider.GetCapProperty().SetColor(colors.GetColor3d(properties.bar_ends_color))\n    # Change the color of the knob that slides.\n    slider.GetSliderProperty().SetColor(colors.GetColor3d(properties.slider_color))\n    # Change the color of the knob when the mouse is held on it.\n    slider.GetSelectedProperty().SetColor(colors.GetColor3d(properties.selected_color))\n    # Change the color of the text displaying the value.\n    slider.GetLabelProperty().SetColor(colors.GetColor3d(properties.value_color))\n\n    slider_widget = vtkSliderWidget()\n    slider_widget.SetRepresentation(slider)\n\n    return slider_widget\n\n\nclass SliderCallbackExposure:\n    def __init__(self, tone_mapping_property):\n        self.tone_mapping_property = tone_mapping_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.tone_mapping_property.SetExposure(value)\n\n\nclass SliderCallbackMetallic:\n    def __init__(self, actor_property):\n        self.actor_property = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actor_property.SetMetallic(value)\n\n\nclass SliderCallbackRoughness:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetRoughness(value)\n\n\nclass SliderCallbackOcclusionStrength:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetOcclusionStrength(value)\n\n\nclass SliderCallbackNormalScale:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetNormalScale(value)\n\n\nclass PrintCallback:\n    def __init__(self, caller, file_name, image_quality=1, rgba=True):\n        \"\"\"\n        Set the parameters for writing the\n         render window view to an image file.\n\n        :param caller: The caller for the callback.\n        :param file_name: The image file name.\n        :param image_quality: The image quality.\n        :param rgba: The buffer type, (if true, there is no background in the screenshot).\n        \"\"\"\n        self.caller = caller\n        self.image_quality = image_quality\n        self.rgba = rgba\n        if not file_name:\n            self.path = None\n            print(\"A file name is required.\")\n            return\n        pth = Path(file_name).absolute()\n        valid_suffixes = ['.jpeg', '.jpg', '.png']\n        if pth.suffix:\n            ext = pth.suffix.lower()\n        else:\n            ext = '.png'\n        if ext not in valid_suffixes:\n            ext = '.png'\n        self.suffix = ext\n        self.path = Path(str(pth)).with_suffix(ext)\n\n    def __call__(self, caller, ev):\n        if not self.path:\n            print(\"A file name is required.\")\n            return\n        # Save the screenshot.\n        if caller.GetKeyCode() == \"k\":\n            w2if = vtkWindowToImageFilter()\n            w2if.SetInput(caller.GetRenderWindow())\n            w2if.SetScale(self.image_quality, self.image_quality)\n            if self.rgba:\n                w2if.SetInputBufferTypeToRGBA()\n            else:\n                w2if.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            w2if.ReadFrontBufferOn()\n            w2if.Update()\n            if self.suffix in ['.jpeg', '.jpg']:\n                writer = vtkJPEGWriter()\n            else:\n                writer = vtkPNGWriter()\n            writer.SetFileName(self.path)\n            writer.SetInputData(w2if.GetOutput())\n            writer.Write()\n            print('Screenshot saved to:', self.path)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/Rainbow/","title":"Rainbow","text":"

vtk-examples/Python/Rendering/Rainbow

"},{"location":"Python/Rendering/Rainbow/#description","title":"Description","text":"

This example demonstrates the use and manipulation of vtkLookupTable's.

First a simple pipeline that reads a vtkStructuredGrid and then extracts a plane using vtkStructuredGeometryFilter from the grid. The plane will be colored differently by using different vtkLookupTable's.

Note

The Update method is manually invoked because it causes the reader to read; later on we use the output of the reader to set a range for the scalar values.

Note

This original tcl source code for this example is here.

Info

See Figure 6-3 in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/Rainbow/#code","title":"Code","text":"

Rainbow.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFn, qFn = get_program_parameters()\n    colors = vtkNamedColors()\n\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(xyzFn)\n    pl3d.SetQFileName(qFn)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    pl3dOutput = pl3d.GetOutput().GetBlock(0)\n\n    plane = vtkStructuredGridGeometryFilter()\n    plane.SetInputData(pl3dOutput)\n    plane.SetExtent(1, 100, 1, 100, 7, 7)\n\n    lut = vtkLookupTable()\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetLookupTable(lut)\n    planeMapper.SetInputConnection(plane.GetOutputPort())\n    planeMapper.SetScalarRange(pl3dOutput.GetScalarRange())\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n\n    # This creates an outline around the data.\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3dOutput)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Much of the following is commented out. To try different lookup tables,\n    # uncomment the appropriate portions.\n    #\n\n    # This creates a black to white lut.\n    # lut.SetHueRange(0, 0)\n    # lut.SetSaturationRange(0, 0)\n    # lut.SetValueRange(0.2, 1.0)\n\n    # This creates a red to blue lut.\n    # lut.SetHueRange(0.0, 0.667)\n\n    # This creates a blue to red lut.\n    # lut.SetHueRange(0.667, 0.0)\n\n    # This creates a weird effect. The Build() method causes the lookup table\n    # to allocate memory and create a table based on the correct hue, saturation,\n    # value, and alpha (transparency) range. Here we then manually overwrite the\n    # values generated by the Build() method.\n    lut.SetNumberOfColors(256)\n    lut.SetHueRange(0.0, 0.667)\n    lut.Build()\n\n    # Create the RenderWindow, Renderer and both Actors.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(planeActor)\n\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.TwoSidedLightingOff()\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('Rainbow')\n\n    iren.Initialize()\n\n    cam1 = ren1.GetActiveCamera()\n    cam1.SetClippingRange(3.95297, 50)\n    cam1.SetFocalPoint(8.88908, 0.595038, 29.3342)\n    cam1.SetPosition(-12.3332, 31.7479, 41.2387)\n    cam1.SetViewUp(0.060772, -0.319905, 0.945498)\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrates the use and manipulation of lookup tables.'\n    epilogue = '''\n    First create a simple pipeline that reads a structured grid\n    and then extracts a plane from the grid. The plane will be colored\n    differently by using different lookup tables.\n\n    Note: The Update method is manually invoked because it causes the\n    reader to read; later on we use the output of the reader to set\n    a range for the scalar values.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('xyzFilename', help='combxyz.bin.')\n    parser.add_argument('qFilename', help='combq.bin.')\n    args = parser.parse_args()\n    return args.xyzFilename, args.qFilename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/Rotations/","title":"Rotations","text":"

vtk-examples/Python/Rendering/Rotations

"},{"location":"Python/Rendering/Rotations/#description","title":"Description","text":"

Rotations of a cow about her axes. In this model, the x axis is from the left to right; the y axis is from bottom to top; and the z axis emerges from the image. The camera location is the same in all four images.

Info

See Figure 3-31 in Chapter 3 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/Rotations/#code","title":"Code","text":"

Rotations.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkAxes\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    \"\"\"\n        To match the illustrations in VTKTextbook.pdf, use BkgColor as the background and\n          Wheat as the cow colour.\n        Also comment out the lines:\n          modelActor->GetProperty()->SetSpecular(.6);\n          modelActor->GetProperty()->SetSpecularPower(30);\n        and use cow.g as the input data.\n\n    \"\"\"\n    file_name, figure, actor_color = get_program_parameters()\n    rotate(file_name, figure, actor_color)\n\n\ndef rotate(file_name, figure, actor_color):\n    \"\"\"\n    This is where we do the rotations.\n\n    \"\"\"\n    # Create renderer stuff\n    #\n    colors = vtkNamedColors()\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n    # colors.SetColor('BkgColor', [60, 93, 144, 255])\n\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    #\n    polyData = ReadPolyData(file_name)\n\n    modelMapper = vtkPolyDataMapper()\n    modelMapper.SetInputData(polyData)\n\n    modelActor = vtkActor()\n    modelActor.SetMapper(modelMapper)\n    modelActor.GetProperty().SetDiffuseColor(colors.GetColor3d(actor_color))\n    if actor_color != 'Wheat':\n        modelActor.GetProperty().SetSpecular(0.6)\n        modelActor.GetProperty().SetSpecularPower(30)\n\n    modelAxesSource = vtkAxes()\n    modelAxesSource.SetScaleFactor(10)\n    modelAxesSource.SetOrigin(0, 0, 0)\n\n    modelAxesMapper = vtkPolyDataMapper()\n    modelAxesMapper.SetInputConnection(modelAxesSource.GetOutputPort())\n\n    modelAxes = vtkActor()\n    modelAxes.SetMapper(modelAxesMapper)\n\n    ren1.AddActor(modelAxes)\n    modelAxes.VisibilityOff()\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(modelActor)\n    if actor_color == 'Wheat':\n        ren1.SetBackground(colors.GetColor3d('BkgColor'))\n    else:\n        ren1.SetBackground(colors.GetColor3d('Silver'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('Rotations')\n\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Azimuth(0)\n    ren1.GetActiveCamera().SetClippingRange(0.1, 1000.0)\n\n    modelAxes.VisibilityOn()\n\n    renWin.Render()\n    renWin.Render()\n\n    if figure == 1:\n        RotateX(renWin, modelActor)\n    elif figure == 2:\n        RotateY(renWin, modelActor)\n    elif figure == 3:\n        RotateZ(renWin, modelActor)\n    else:\n        RotateXY(renWin, modelActor)\n\n    renWin.EraseOff()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Perform rotations about the X, Y, Z and X then Y axes.'\n    epilogue = '''\n        Perform rotations about the X, Y, Z and X then Y axes.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='The file cow.obj.')\n    parser.add_argument('figure', default=0, type=int, nargs='?',\n                        help='The particular rotation that you want to view.')\n    parser.add_argument('actor_color', default='Wheat', type=str, nargs='?',\n                        help='If the color is Wheat then the vtk textbook colors are used.')\n    args = parser.parse_args()\n    return args.filename, args.figure, args.actor_color\n\n\ndef RotateX(renWin, actor):\n    actor.SetOrientation(0, 0, 0)\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n\n    for i in range(0, 6):\n        actor.RotateX(60)\n        renWin.Render()\n        renWin.Render()\n    renWin.EraseOn()\n\n\ndef RotateY(renWin, actor):\n    actor.SetOrientation(0, 0, 0)\n    renWin.Render()\n    renWin.EraseOff()\n\n    for i in range(0, 6):\n        actor.RotateY(60)\n        renWin.Render()\n        renWin.Render()\n    renWin.EraseOn()\n\n\ndef RotateZ(renWin, actor):\n    actor.SetOrientation(0, 0, 0)\n    renWin.Render()\n    renWin.EraseOff()\n\n    for i in range(0, 6):\n        actor.RotateZ(60)\n        renWin.Render()\n        renWin.Render()\n    renWin.EraseOn()\n\n\ndef RotateXY(renWin, actor):\n    actor.SetOrientation(0, 0, 0)\n    actor.RotateX(60)\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n\n    for i in range(0, 6):\n        actor.RotateY(60)\n        renWin.Render()\n        renWin.Render()\n    renWin.EraseOn()\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a sphere if the extension is unknown.\n        source = vtkSphereSource()\n        source.Update()\n        poly_data = source.GetOutput()\n    return poly_data\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/RotationsA/","title":"RotationsA","text":"

vtk-examples/Python/Rendering/RotationsA

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/RotationsA/#code","title":"Code","text":"

RotationsA.py

#!/usr/bin/env python\n\n\"\"\"\nRotations, VTK Textbook figure 3-31a.\n\nNote: Make sure Rotations.py is in the same directory as this program.\n\"\"\"\n\nimport Rotations\n\n\ndef main():\n    file_name, figure, book_color = Rotations.get_program_parameters()\n    # Set up for six rotations about the x-axis.\n    figure = 1\n    book_color = True\n    Rotations.rotate(file_name, figure, book_color)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/RotationsB/","title":"RotationsB","text":"

vtk-examples/Python/Rendering/RotationsB

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/RotationsB/#code","title":"Code","text":"

RotationsB.py

#!/usr/bin/env python\n\n\"\"\"\nRotations, VTK Textbook figure 3-31b.\n\nNote: Make sure Rotations.py is in the same directory as this program.\n\"\"\"\n\nimport Rotations\n\n\ndef main():\n    file_name, figure, book_color = Rotations.get_program_parameters()\n    # Set up for six rotations about the y-axis.\n    figure = 2\n    book_color = True\n    Rotations.rotate(file_name, figure, book_color)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/RotationsC/","title":"RotationsC","text":"

vtk-examples/Python/Rendering/RotationsC

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/RotationsC/#code","title":"Code","text":"

RotationsC.py

#!/usr/bin/env python\n\n\"\"\"\nRotations, VTK Textbook figure 3-31c.\n\nNote: Make sure Rotations.py is in the same directory as this program.\n\"\"\"\n\nimport Rotations\n\n\ndef main():\n    file_name, figure, book_color = Rotations.get_program_parameters()\n    # Set up for six rotations about the z-axis.\n    figure = 3\n    book_color = True\n    Rotations.rotate(file_name, figure, book_color)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/RotationsD/","title":"RotationsD","text":"

vtk-examples/Python/Rendering/RotationsD

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/RotationsD/#code","title":"Code","text":"

RotationsD.py

#!/usr/bin/env python\n\n\"\"\"\nRotations, VTK Textbook figure 3-31d.\n\nNote: Make sure Rotations.py is in the same directory as this program.\n\"\"\"\n\nimport Rotations\n\n\ndef main():\n    file_name, figure, book_color = Rotations.get_program_parameters()\n    # First a rotation about the x-axis, then six rotations about the y-axis.\n    figure = 4\n    book_color = True\n    Rotations.rotate(file_name, figure, book_color)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/Shadows/","title":"Shadows","text":"

vtk-examples/Python/Rendering/Shadows

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/Shadows/#code","title":"Code","text":"

Shadows.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkCameraPass,\n    vtkRenderPassCollection,\n    vtkSequencePass,\n    vtkShadowMapPass\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a polydata file of a surface and display it with shadows.'\n    epilogue = '''\nIf no file is entered a sphere is used.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', default=None, nargs='?', help='Enter a polydata file e.g cow.g.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef main():\n    fn = get_program_parameters()\n    if fn:\n        polyData = ReadPolyData(fn)\n    else:\n        # Use a sphere\n        source = vtkSphereSource()\n        source.SetThetaResolution(100)\n        source.SetPhiResolution(100)\n        source.Update()\n        polyData = source.GetOutput()\n\n    colors = vtkNamedColors()\n    colors.SetColor('HighNoonSun', [255, 255, 251, 255])  # Color temp. 5400\u00b0K\n    colors.SetColor('100W Tungsten', [255, 214, 170, 255])  # Color temp. 2850\u00b0K\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(640, 480)\n    renderWindow.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    light1 = vtkLight()\n    light1.SetFocalPoint(0, 0, 0)\n    light1.SetPosition(0, 1, 0.2)\n    light1.SetColor(colors.GetColor3d('HighNoonSun'))\n    light1.SetIntensity(0.3)\n    renderer.AddLight(light1)\n\n    light2 = vtkLight()\n    light2.SetFocalPoint(0, 0, 0)\n    light2.SetPosition(1.0, 1.0, 1.0)\n    light2.SetColor(colors.GetColor3d('100W Tungsten'))\n    light2.SetIntensity(0.8)\n    renderer.AddLight(light2)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetAmbientColor(colors.GetColor3d('SaddleBrown'))\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Sienna'))\n    actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    actor.GetProperty().SetSpecular(0.51)\n    actor.GetProperty().SetDiffuse(0.7)\n    actor.GetProperty().SetAmbient(0.7)\n    actor.GetProperty().SetSpecularPower(30.0)\n    actor.GetProperty().SetOpacity(1.0)\n    renderer.AddActor(actor)\n\n    # Add a plane\n    bounds = polyData.GetBounds()\n\n    rnge = [0] * 3\n    rnge[0] = bounds[1] - bounds[0]\n    rnge[1] = bounds[3] - bounds[2]\n    rnge[2] = bounds[5] - bounds[4]\n    print('range: ', ', '.join(['{0:0.6f}'.format(i) for i in rnge]))\n    expand = 1.0\n    thickness = rnge[2] * 0.1\n    plane = vtkCubeSource()\n    plane.SetCenter((bounds[1] + bounds[0]) / 2.0,\n                    bounds[2] - thickness / 2.0,\n                    (bounds[5] + bounds[4]) / 2.0)\n    plane.SetXLength(bounds[1] - bounds[0] + (rnge[0] * expand))\n    plane.SetYLength(thickness)\n    plane.SetZLength(bounds[5] - bounds[4] + (rnge[2] * expand))\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputConnection(plane.GetOutputPort())\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n    renderer.AddActor(planeActor)\n\n    renderWindow.SetMultiSamples(0)\n\n    shadows = vtkShadowMapPass()\n\n    seq = vtkSequencePass()\n\n    passes = vtkRenderPassCollection()\n    passes.AddItem(shadows.GetShadowMapBakerPass())\n    passes.AddItem(shadows)\n    seq.SetPasses(passes)\n\n    cameraP = vtkCameraPass()\n    cameraP.SetDelegatePass(seq)\n\n    # Tell the renderer to use our render pass pipeline\n    glrenderer = renderer\n    glrenderer.SetPass(cameraP)\n\n    renderer.GetActiveCamera().SetPosition(-0.2, 0.2, 1)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 1, 0)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Dolly(2.25)\n    renderer.ResetCameraClippingRange()\n    renderWindow.SetWindowName('Shadows')\n    renderWindow.Render()\n    renderWindow.SetWindowName('Shadows')\n\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/SpecularSpheres/","title":"SpecularSpheres","text":"

vtk-examples/Python/Rendering/SpecularSpheres

"},{"location":"Python/Rendering/SpecularSpheres/#description","title":"Description","text":"

Note

The original source code for this example is here.

Info

See Figure 3-10 in Chapter 3 the VTK Textbook.

Info

Similar examples setting the ambient and diffuse properties are: See AmbientSpheres.cxx, AmbientSpheres.py, AmbientSpheres.java and DiffuseSpheres.cxx, DiffuseSpheres.py.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/SpecularSpheres/#code","title":"Code","text":"

SpecularSpheres.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('bkg', [26, 51, 102, 255])\n\n    # The following lines create a sphere represented by polygons.\n    #\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(100)\n    sphere.SetPhiResolution(50)\n\n    # The mapper is responsible for pushing the geometry into the graphics\n    # library. It may also do color mapping, if scalars or other attributes\n    # are defined.\n    #\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    # The actor is a grouping mechanism: besides the geometry (mapper), it\n    # also has a property, transformation matrix, and/or texture map.\n    # In this example we create eight different spheres (two rows of four\n    # spheres) and set the specular lighting coefficients. A little ambient\n    # is turned on so the sphere is not completely black on the back side.\n    #\n    numberOfSpheres = 8\n    spheres = list()\n    ambient = 0.3\n    diffuse = 0.5\n    specular = 1.0\n    spBase = 5.0\n    spScale = 1.0\n    position = [0, 0, 0]\n    for i in range(0, numberOfSpheres):\n        specularPower = spBase * spScale\n        spheres.append(vtkActor())\n        spheres[i].SetMapper(sphereMapper)\n        spheres[i].GetProperty().SetColor(colors.GetColor3d('Red'))\n        spheres[i].GetProperty().SetAmbient(ambient)\n        spheres[i].GetProperty().SetDiffuse(diffuse)\n        spheres[i].GetProperty().SetSpecular(specular)\n        spheres[i].GetProperty().SetSpecularPower(specularPower)\n        spheres[i].GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n        spheres[i].AddPosition(position)\n        spScale = spScale * 2.0\n        position[0] += 1.25\n        if i == 3:\n            specular = 0.5\n            spScale = 1.0\n            position[0] = 0\n            position[1] = 1.25\n\n    # Create the graphics structure. The renderer renders into the\n    # render window. The render window interactor captures mouse events\n    # and will perform appropriate camera or actor manipulation\n    # depending on the nature of the events.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    for i in range(0, numberOfSpheres):\n        ren.AddActor(spheres[i])\n\n    ren.SetBackground(colors.GetColor3d('bkg'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('SpecularSpheres')\n\n    # Set up the lighting.\n    #\n    light = vtkLight()\n    light.SetFocalPoint(1.875, 0.6125, 0)\n    light.SetPosition(0.875, 1.6125, 1)\n    ren.AddLight(light)\n\n    # We want to eliminate perspective effects on the apparent lighting.\n    # Parallel camera projection will be used. To zoom in parallel projection\n    # mode, the ParallelScale is set.\n    #\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    ren.GetActiveCamera().SetPosition(0, 0, 1)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.GetActiveCamera().ParallelProjectionOn()\n    ren.ResetCamera()\n    ren.GetActiveCamera().SetParallelScale(2.0)\n    # This starts the event loop and invokes an initial render.\n    #\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/StippledLine/","title":"StippledLine","text":"

vtk-examples/Python/Rendering/StippledLine

"},{"location":"Python/Rendering/StippledLine/#description","title":"Description","text":"

VTK OpenGL2 no longer supports Stippled Lines. This example uses texture mapping to created stippled lines. Two parameters, StipplePattern and StippleRepeat, control the pattern of the stippled lines.

StipplePattern is a 16-bit binary pattern, 1 = pixel on, 0 = pixel off.

StippleRepeat is the stippling repeat factor of a Line, which specifies how many times each bit in the pattern is to be repeated.

It can be tricky to set the proper pattern and repeat, so experiment.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/StippledLine/#code","title":"Code","text":"

StippledLine.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_UNSIGNED_CHAR,\n    vtkDoubleArray\n)\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    lines = vtkLineSource()\n    # Create two points, P0 and P1\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [5.0, 0.0, 0.0]\n\n    lines.SetResolution(11)\n    lines.SetPoint1(p0)\n    lines.SetPoint2(p1)\n    lines.Update()\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(lines.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetLineWidth(5)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n\n    StippledLine(actor, 0xA1A1, 2)\n\n    ren1 = vtkRenderer()\n    ren1.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    renWin = vtkRenderWindow()\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('StippledLine')\n\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    ren1.AddActor(actor)\n    renWin.Render()\n    iren.Start()\n\n\ndef StippledLine(actor, lineStipplePattern, lineStippleRepeat):\n    tcoords = vtkDoubleArray()\n    image = vtkImageData()\n    texture = vtkTexture()\n\n    # Create texture\n    dimension = 16 * lineStippleRepeat\n\n    image.SetDimensions(dimension, 1, 1)\n    image.AllocateScalars(VTK_UNSIGNED_CHAR, 4)\n    image.SetExtent(0, dimension - 1, 0, 0, 0, 0)\n    on = 255\n    off = 0\n    i_dim = 0\n    while i_dim < dimension:\n        for i in range(0, 16):\n            mask = (1 << i)\n            bit = (lineStipplePattern & mask) >> i\n            value = bit\n            if value == 0:\n                for j in range(0, lineStippleRepeat):\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 0, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 1, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 2, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 3, off)\n                    i_dim += 1\n            else:\n                for j in range(0, lineStippleRepeat):\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 0, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 1, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 2, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 3, on)\n                    i_dim += 1\n    polyData = actor.GetMapper().GetInput()\n    # Create texture coordinates\n    tcoords.SetNumberOfComponents(1)\n    tcoords.SetNumberOfTuples(polyData.GetNumberOfPoints())\n    for i in range(0, polyData.GetNumberOfPoints()):\n        value = i * 0.5\n        tcoords.SetTypedTuple(i, [value])\n    polyData.GetPointData().SetTCoords(tcoords)\n    texture.SetInputData(image)\n    texture.InterpolateOff()\n    texture.RepeatOn()\n\n    actor.SetTexture(texture)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/StripFran/","title":"StripFran","text":"

vtk-examples/Python/Rendering/StripFran

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/StripFran/#code","title":"Code","text":"

StripFran.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDecimatePro,\n    vtkMaskPolyData,\n    vtkPolyDataNormals,\n    vtkStripper\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    renderer1 = vtkRenderer()\n    renderer1.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    renderer2 = vtkRenderer()\n    renderer2.SetViewport(0.5, 0.0, 1.0, 1.0)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer1)\n    renderWindow.AddRenderer(renderer2)\n    renderWindow.SetWindowName('StripFran')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Create a cyberware source.\n    #\n    cyber = vtkPolyDataReader()\n    cyber.SetFileName(fileName)\n\n    deci = vtkDecimatePro()\n    deci.SetInputConnection(cyber.GetOutputPort())\n    deci.SetTargetReduction(0.7)\n    deci.PreserveTopologyOn()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(deci.GetOutputPort())\n\n    mask = vtkMaskPolyData()\n    mask.SetInputConnection(deci.GetOutputPort())\n    mask.SetOnRatio(2)\n\n    cyberMapper = vtkPolyDataMapper()\n    cyberMapper.SetInputConnection(mask.GetOutputPort())\n\n    cyberActor = vtkActor()\n    cyberActor.SetMapper(cyberMapper)\n    cyberActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(cyber.GetOutputPort())\n\n    stripperMask = vtkMaskPolyData()\n    stripperMask.SetInputConnection(stripper.GetOutputPort())\n    stripperMask.SetOnRatio(2)\n\n    stripperMapper = vtkPolyDataMapper()\n    stripperMapper.SetInputConnection(stripperMask.GetOutputPort())\n\n    stripperActor = vtkActor()\n    stripperActor.SetMapper(stripperMapper)\n    stripperActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    renderer1.AddActor(stripperActor)\n    renderer2.AddActor(cyberActor)\n    renderer1.SetBackground(colors.GetColor3d('Wheat'))\n    renderer2.SetBackground(colors.GetColor3d('Papaya_Whip'))\n    renderWindow.SetSize(1024, 640)\n\n    # Render the image.\n    #\n    cam1 = vtkCamera()\n    cam1.SetFocalPoint(0, 0, 0)\n    cam1.SetPosition(1, 0, 0)\n    cam1.SetViewUp(0, 1, 0)\n    renderer1.SetActiveCamera(cam1)\n    renderer2.SetActiveCamera(cam1)\n    renderer1.ResetCamera()\n    cam1.Azimuth(30)\n    cam1.Elevation(30)\n    cam1.Dolly(1.4)\n    renderer1.ResetCameraClippingRange()\n\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Triangle strip examples.'\n    epilogue = '''\n    a) Structured triangle mesh consisting of 134 strips each of 390 triangles (stripF.tcl).\n\n    b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94,\n        longest strip 101 triangles.\n        Images are generated by displaying every other triangle strip (uStripeF.tcl).\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='fran_cut.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/TransformSphere/","title":"TransformSphere","text":"

vtk-examples/Python/Rendering/TransformSphere

"},{"location":"Python/Rendering/TransformSphere/#description","title":"Description","text":"

This example extends the pipeline of the ColoredSphere.py example and shows the effects of type checking on the connectivity of process objects. We add a transform filter (vtkTransformFilter) to nonuniformly scale the sphere in the x-y-z directions. The transform filter only operates on objects with explicit point coordinate representation (i.e., a subclass of vtkPointSet ). However, the elevation filter generates the more general form vtkDataSet as output. Hence we cannot connect the transform filter to the elevation filter. But we can connect the transform filter to the sphere source, and then the elevation filter to the transform filter. (Note: an alternative method is to use vtkCastToConcrete to perform run-time casting.)

Info

See Figure 4-20 in Chapter 4 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/TransformSphere/#code","title":"Code","text":"

TransformSphere.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(12)\n    sphere.SetPhiResolution(12)\n\n    aTransform = vtkTransform()\n    aTransform.Scale(1, 1.5, 2)\n\n    transFilter = vtkTransformFilter()\n    transFilter.SetInputConnection(sphere.GetOutputPort())\n    transFilter.SetTransform(aTransform)\n\n    colorIt = vtkElevationFilter()\n    colorIt.SetInputConnection(transFilter.GetOutputPort())\n    colorIt.SetLowPoint(0, 0, -1)\n    colorIt.SetHighPoint(0, 0, 1)\n\n    lut = vtkLookupTable()\n    lut.SetHueRange(0.667, 0)\n    lut.SetSaturationRange(1, 1)\n    lut.SetValueRange(1, 1)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetLookupTable(lut)\n    mapper.SetInputConnection(colorIt.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(60.0)\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('TransformSphere')\n\n    renWin.Render()\n\n    # Interact with the data.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/TransparentBackground/","title":"TransparentBackground","text":"

vtk-examples/Python/Rendering/TransparentBackground

"},{"location":"Python/Rendering/TransparentBackground/#description","title":"Description","text":"

Demonstrates the use of two renderers. Notice that the second (and subsequent) renderers will have a transparent background.

You can manipulate the object in the second layer/renderer whilst the objects in the first layer/renderer form the background.

  • Pressing 0 on the keyboard will let you manipulate the objects in layer 0.
  • Pressing 1 on the keyboard will let you manipulate the objects in layer 1.

Info

Also see the LayeredActors.cxx and LayeredActors.py examples, where we have added an extra callback so that the non-active layer objects move in conjunction with the active layer objects.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/TransparentBackground/#code","title":"Code","text":"

TransparentBackground.py

#!/usr/bin/env python\n\n\"\"\"\n    1. Create a cube and cone source.\n    2. Render it with the cube in layer 0 and the cone in layer 1 of the render window.\n    3. Interact with it.\n    4. Notice that the cube and the cone are both visible and the layer 1 background is transparent.\n    5. Pressing '0' on the keyboard will let you manipulate the objects in layer 0.\n    6. Pressing '1' on the keyboard will let you manipulate the objects in layer 1.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef GenerateAndDisplayCubeAndSphere():\n    colors = vtkNamedColors()\n\n    cubeSource = vtkCubeSource()\n    cubeSource.SetXLength(4.0)\n    cubeSource.SetYLength(9.0)\n    cubeSource.SetZLength(1.0)\n    cubeSource.SetCenter(0.0, 0.0, 0.0)\n\n    # Render the cube\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputConnection(cubeSource.GetOutputPort())\n\n    cubeActor = vtkActor()\n    cubeActor.GetProperty().SetDiffuseColor(colors.GetColor3d(\"DarkGreen\"))\n    cubeActor.SetMapper(cubeMapper)\n\n    coneSource = vtkConeSource()\n    coneSource.SetCenter(0.0, 0.0, 0.0)\n    coneSource.SetHeight(1.0)\n    coneSource.SetRadius(0.25)\n    coneSource.SetDirection(0.0, 1.0, 0.0)\n    coneSource.SetResolution(60)\n    coneSource.CappingOn()\n\n    # Render the cone\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(coneSource.GetOutputPort())\n\n    coneActor = vtkActor()\n    coneActor.GetProperty().SetDiffuseColor(colors.GetColor3d(\"DarkTurquoise\"))\n    # Make the cone slightly transparent for fun\n    coneActor.GetProperty().SetOpacity(0.75)\n    coneActor.SetMapper(coneMapper)\n\n    # The renderers, render window and interactor\n    renderers = list()\n    renWin = vtkRenderWindow()\n    for i in range(0, 2):\n        renderers.append(vtkRenderer())\n        renWin.AddRenderer(renderers[i])\n    renWin.SetSize(800, 800)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Layer 0 - background not transparent\n    renderers[0].SetBackground(colors.GetColor3d(\"Silver\"))\n    renderers[0].AddActor(cubeActor)\n    renderers[0].SetLayer(0)\n    # Layer 1 - the background is transparent\n    #           so we only see the layer 0 background color\n    renderers[1].AddActor(coneActor)\n    renderers[1].SetLayer(1)\n    renderers[1].SetBackground(colors.GetColor3d(\"MidnightBlue\"))\n\n    #  We have two layers\n    renWin.SetNumberOfLayers(2)\n    renWin.Render()\n    renWin.SetWindowName('TransparentBackground')\n\n    iren.AddObserver('KeyPressEvent', KeypressCallbackFunction)\n\n    iren.Start()\n\n\ndef KeypressCallbackFunction(caller, ev):\n    iren = caller\n    renderers = iren.GetRenderWindow().GetRenderers()\n    if renderers.GetNumberOfItems() < 2:\n        print('We need at least two renderers, we have only', renderers.GetNumberOfItems())\n        return\n    renderers.InitTraversal()\n    # Top item\n    ren0 = renderers.GetNextItem()\n    # Bottom item\n    ren1 = renderers.GetNextItem()\n\n    key = iren.GetKeySym()\n\n    if key == '0':\n        print('Pressed:', key)\n        iren.GetRenderWindow().GetInteractor().GetInteractorStyle().SetDefaultRenderer(ren0)\n        ren0.InteractiveOn()\n        ren1.InteractiveOff()\n    if key == '1':\n        print('Pressed:', key)\n        iren.GetRenderWindow().GetInteractor().GetInteractorStyle().SetDefaultRenderer(ren1)\n        ren0.InteractiveOff()\n        ren1.InteractiveOn()\n\n\ndef main():\n    GenerateAndDisplayCubeAndSphere()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/WalkCow/","title":"WalkCow","text":"

vtk-examples/Python/Rendering/WalkCow

"},{"location":"Python/Rendering/WalkCow/#description","title":"Description","text":"

This generates Fig. 3-32: The cow \"walking\" around the global origin; Fig. 3-33: The cow rotating about a vector passing through her nose. (a) With origin (0,0,0). (b) With origin at (6.1,1.3,.02). found in VTKTextbook.

The example allows an optional second argument that selects the figure to be generated. A 0 generates Fig 3-32, 1 generates Fig 3-33a and 2 generates Fig 3-33b.

Info

See Figure 3-32 in Chapter 3 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/WalkCow/#code","title":"Code","text":"

WalkCow.py

#!/usr/local/bin/python\n\n#  Translated from walkCow.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkAxes\nfrom vtkmodules.vtkIOGeometry import vtkBYUReader\nfrom vtkmodules.vtkIOImage import vtkPNGWriter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\n\n\ndef walk_cow(file_name, figure):\n    figure = abs(figure)\n    if figure > 2:\n        figure = 0\n\n    colors = vtkNamedColors()\n    # Set the background color.\n    colors.SetColor('BkgColor1', [60, 93, 144, 255])\n    colors.SetColor('BkgColor2', [26, 51, 102, 255])\n\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('WalkCow');\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # The cow pipeline.\n    cow = vtkBYUReader()\n    cow.SetGeometryFileName(file_name)\n    cow.Update()\n\n    cowMapper = vtkPolyDataMapper()\n    cowMapper.SetInputConnection(cow.GetOutputPort())\n    cowMapper.ScalarVisibilityOff()\n\n    cowActor = vtkActor()\n    cowActor.SetMapper(cowMapper)\n    cowActor.GetProperty().SetColor(colors.GetColor3d('Wheat'))\n\n    ren.AddActor(cowActor)\n\n    # Axes pipeline.\n    cowAxesSource = vtkAxes()\n    cowAxesSource.SetScaleFactor(10.0)\n    cowAxesSource.SetOrigin(0, 0, 0)\n\n    cowAxesMapper = vtkPolyDataMapper()\n    cowAxesMapper.SetInputConnection(cowAxesSource.GetOutputPort())\n\n    cowAxes = vtkActor()\n    cowAxes.SetMapper(cowAxesMapper)\n    cowAxes.VisibilityOff()\n\n    ren.AddActor(cowAxes)\n\n    ren.SetBackground(colors.GetColor3d('BkgColor1'))\n    renWin.SetSize(600, 480)\n\n    iren.Initialize()\n    cowAxes.VisibilityOn()\n    renWin.Render()\n\n    # Activate this if you want to see the Position and Focal point.\n    # ren.GetActiveCamera().AddObserver('ModifiedEvent', CameraModifiedCallback)\n\n    # These four walks use the same camera position.\n    Rotate_X(cowActor, ren, renWin)\n    Rotate_Y(cowActor, ren, renWin)\n    Rotate_Z(cowActor, ren, renWin)\n    Rotate_XY(cowActor, ren, renWin)\n\n    ren.SetBackground(colors.GetColor3d('BkgColor2'))\n    if figure == 1:\n        Rotate_V_0(cowActor, ren, renWin)\n    elif figure == 2:\n        Rotate_V_V(cowActor, ren, renWin)\n    else:\n        Rotate_V_0(cowActor, ren, renWin)\n        Rotate_V_V(cowActor, ren, renWin)\n        # Walk() needs to go after Rotate_V_0() or Rotate_V_V().\n        Walk(cowActor, ren, renWin)\n\n    # Interact with data.\n    renWin.EraseOff()\n    iren.Start()\n\n\ndef main():\n    file_name, figure = get_program_parameters()\n    walk_cow(file_name, figure)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce figures: 3-32, 3-33a, 3-33b from the VTK Textbook.'\n    epilogue = '''\n        It is a translation of the original WalkCow.tcl with a few additional enhancements.\n\n        If the parameter figure is 0, 1 or 2 then these correspond to\n        the VTK Textbook figures 3-32, 3-33a, 3-33b in that order.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='The file cow.g.')\n    parser.add_argument('figure', default=0, type=int, nargs='?', help='The particular rotation that you want to view.')\n    args = parser.parse_args()\n    return args.filename, args.figure\n\n\n'''\n  These Rotate* and Walk functions create a scene where multiple\n     views of the object exist.\n\n    They all operate in a similar manner, namely:\n    1) Accept vtkActor, vtkRenderer, vtkRenderWindow as parameters.\n    2) Position the object.\n    3) Position the observer with the focal point sent to the centre\n        of the object.\n    4) Render and set EraseOff() in the render window.\n       Note that:\n        EraseOff() has to be called after a Render() call\n         to work in the desired way.\n    5) Then rotate or Walk the object around the scene.\n    6) Optionally write out the scene using Screenshot().\n    6) Set EraseOff() in the render window.\n    7) Reset the object position.\n\n'''\n\n\ndef Rotate_X(cowActor, ren, renWin):\n    # Six rotations about the x axis.\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(2, 25, 0)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.GetActiveCamera().SetViewUp(0, 0, -1)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(0, 6):\n        cowActor.RotateX(60)\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-31a.png', renWin)\n    renWin.EraseOn()\n\n\ndef Rotate_Y(cowActor, ren, renWin):\n    # Six rotations about the y axis.\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(2, 0, 25)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(0, 6):\n        cowActor.RotateY(60)\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-31b.png', renWin)\n    renWin.EraseOn()\n\n\ndef Rotate_Z(cowActor, ren, renWin):\n    # Six rotations about the z axis.\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    # This closely matches the original illustration.\n    # ren.GetActiveCamera().SetPosition(2, 0, 25)\n    ren.GetActiveCamera().SetPosition(2, 0, 25)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(0, 6):\n        cowActor.RotateZ(60)\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-31c.png', renWin)\n    renWin.EraseOn()\n\n\ndef Rotate_XY(cowActor, ren, renWin):\n    # First a rotation about the x axis, then six rotations about the y axis.\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    # This closely matches the original illustration.\n    # ren.GetActiveCamera().SetPosition(2, 0, 24)\n    ren.GetActiveCamera().SetPosition(2, 0, 25)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    cowActor.RotateX(60)\n    for idx in range(0, 6):\n        cowActor.RotateY(60)\n        renWin.Render()\n        renWin.Render()\n    cowActor.RotateX(-60)\n    # Screenshot('Fig3-31d.png', renWin)\n    renWin.EraseOn()\n\n\ndef Rotate_V_0(cowActor, ren, renWin):\n    # The cow rotating about a vector passing through her nose.\n    # With the origin at (0, 0, 0).\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    cowPos = vtkTransform()\n    cowPos.Identity()\n    cowPos.SetMatrix(cowActor.GetMatrix())\n    cowTransform = vtkTransform()\n    cowTransform.Identity()\n    cowActor.SetUserMatrix(cowTransform.GetMatrix())\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(16, 9, -12)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(0, 6):\n        cowActor.RotateWXYZ(60, 2.19574, -1.42455, -0.0331036)\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-33a.png', renWin)\n    renWin.EraseOn()\n    # Put the cow back on the origin.\n    # for idx in range(0, 6):\n    #     cowActor.RotateWXYZ(-60, 2.19574, -1.42455, -0.0331036)\n    # cowActor.SetUserMatrix(cowPos.GetMatrix())\n    # ren.GetActiveCamera().SetPosition(0, 0, 1)\n    # ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    # ren.ResetCamera()\n\n\ndef Rotate_V_V(cowActor, ren, renWin):\n    # The cow rotating about a vector passing through her nose.\n    # With the origin at (6.11414, 1.27386, 0.015175).\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    cowPos = vtkTransform()\n    cowPos.Identity()\n    cowPos.SetMatrix(cowActor.GetMatrix())\n    cowActor.SetOrigin(6.11414, 1.27386, 0.015175)  # The cow's nose\n    cowTransform = vtkTransform()\n    cowTransform.Identity()\n    cowActor.SetUserMatrix(cowTransform.GetMatrix())\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(31, 23, -21)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(0, 6):\n        cowActor.RotateWXYZ(60, 2.19574, -1.42455, -0.0331036)\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-33b.png', renWin)\n    renWin.EraseOn()\n    # Put the cow back on the origin.\n    # for idx in range(0, 6):\n    #     cowActor.RotateWXYZ(-60, 2.19574, -1.42455, -0.0331036)\n    # cowActor.SetUserMatrix(cowPos.GetMatrix())\n\n\ndef Walk(cowActor, ren, renWin):\n    # The cow 'walking' around the global origin\n    cowPos = vtkTransform()\n    cowPos.Identity()\n    cowPos.SetMatrix(cowActor.GetMatrix())\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0.0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    cowTransform = vtkTransform()\n    cowTransform.Identity()\n    cowTransform.Translate(0, 0, 5)\n    cowActor.SetUserMatrix(cowTransform.GetMatrix())\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(1, 24, 16)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.GetActiveCamera().SetViewUp(0, 0, -1)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(1, 7):\n        cowTransform.Identity()\n        cowTransform.RotateY(idx * 60)\n        cowTransform.Translate(0, 0, 5)\n        cowActor.SetUserMatrix(cowTransform.GetMatrix())\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-32.png', renWin)\n    renWin.EraseOn()\n    # Walkies are over, put the cow back on the origin.\n    # cowActor.SetUserMatrix(cowPos.GetMatrix())\n\n\ndef CameraModifiedCallback(caller, ev):\n    '''\n     Used to estimate positions similar to the book illustrations.\n    :param caller:\n    :return:\n    '''\n    print(caller.GetClassName(), 'modified')\n    # Print the interesting stuff.\n    print('\\tPosition: ',\n          caller.GetPosition()[0], ', ',\n          caller.GetPosition()[1], ', ',\n          caller.GetPosition()[2])\n    print('\\tFocal point: ',\n          caller.GetFocalPoint()[0], ', ',\n          caller.GetFocalPoint()[1], ', ',\n          caller.GetFocalPoint()[2])\n\n\ndef Screenshot(fileName, renWin):\n    '''\n    Save a screenshot.\n    :param fileName:\n    :param renWin:\n    :return:\n    '''\n    windowToImageFilter = vtkWindowToImageFilter()\n    windowToImageFilter.SetInput(renWin)\n    windowToImageFilter.SetScale(1)  # image quality\n    # We are not recording the alpha (transparency) channel.\n    # windowToImageFilter.SetInputBufferTypeToRGBA()\n    windowToImageFilter.SetInputBufferTypeToRGB()\n    # Read from the front buffer.\n    windowToImageFilter.ReadFrontBufferOff()\n    windowToImageFilter.Update()\n\n    writer = vtkPNGWriter()\n    writer.SetFileName(fileName)\n    writer.SetInputConnection(windowToImageFilter.GetOutputPort())\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/WalkCowA/","title":"WalkCowA","text":"

vtk-examples/Python/Rendering/WalkCowA

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/WalkCowA/#code","title":"Code","text":"

WalkCowA.py

#!/usr/bin/env python\n\n\"\"\"\nWalkCow, VTK Textbook figure 3-33a.\n\nNote: Make sure WalkCow.py is in the same directory as this program.\n\"\"\"\n\nimport WalkCow\n\n\ndef main():\n    file_name, figure = WalkCow.get_program_parameters()\n    figure = 1\n    WalkCow.walk_cow(file_name, figure)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Rendering/WalkCowB/","title":"WalkCowB","text":"

vtk-examples/Python/Rendering/WalkCowB

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Rendering/WalkCowB/#code","title":"Code","text":"

WalkCowB.py

#!/usr/bin/env python\n\n\"\"\"\nWalkCow, VTK Textbook figure 3-33b.\n\nNote: Make sure WalkCow.py is in the same directory as this program.\n\"\"\"\n\nimport WalkCow\n\n\ndef main():\n    file_name, figure = WalkCow.get_program_parameters()\n    figure = 2\n    WalkCow.walk_cow(file_name, figure)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/SimpleOperations/DistanceBetweenPoints/","title":"DistanceBetweenPoints","text":"

vtk-examples/Python/SimpleOperations/DistanceBetweenPoints

"},{"location":"Python/SimpleOperations/DistanceBetweenPoints/#description","title":"Description","text":"

This example finds the squared distance and the Euclidean distance between two 3D points.

Other languages

See (Cxx), (Java), (CSharp)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/SimpleOperations/DistanceBetweenPoints/#code","title":"Code","text":"

DistanceBetweenPoints.py

# !/usr/bin/env python\n\nimport math\n\nfrom vtkmodules.vtkCommonCore import vtkMath\n\n\ndef main():\n    p0 = (0, 0, 0)\n    p1 = (1, 1, 1)\n\n    distSquared = vtkMath.Distance2BetweenPoints(p0, p1)\n\n    dist = math.sqrt(distSquared)\n\n    print('p0 = ', p0)\n    print('p1 = ', p1)\n    print('distance squared = ', distSquared)\n    print('distance = ', dist)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Snippets/CameraPosition/","title":"CameraPosition","text":""},{"location":"Python/Snippets/CameraPosition/#description","title":"Description","text":"

A callback that gives you the camera position and focal point.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Python/Snippets/CameraPosition/#implementation","title":"Implementation","text":"
def camera_modified_callback(caller, event):\n    \"\"\"\n     Used to estimate positions similar to the book illustrations.\n    :param caller:\n    :param event:\n    :return:\n    \"\"\"\n    print(caller.GetClassName(), \"modified\")\n    # Print the interesting stuff.\n    res = f'\\tcamera = renderer.GetActiveCamera()\\n'\n    res += f'\\tcamera.SetPosition({\", \".join(map(\"{0:0.6f}\".format, caller.GetPosition()))})\\n'\n    res += f'\\tcamera.SetFocalPoint({\", \".join(map(\"{0:0.6f}\".format, caller.GetFocalPoint()))})\\n'\n    res += f'\\tcamera.SetViewUp({\", \".join(map(\"{0:0.6f}\".format, caller.GetViewUp()))})\\n'\n    res += f'\\tcamera.SetDistance({\"{0:0.6f}\".format(caller.GetDistance())})\\n'\n    res += f'\\tcamera.SetClippingRange({\", \".join(map(\"{0:0.6f}\".format, caller.GetClippingRange()))})\\n'\n    print(res)\n
"},{"location":"Python/Snippets/CameraPosition/#usage","title":"Usage","text":"
    renWin.Render()\n    ren.GetActiveCamera().AddObserver('ModifiedEvent', camera_modified_callback)\n

Once you have the output, replace the ren.GetActiveCamera().AddObserver... line with the output data.

"},{"location":"Python/Snippets/CheckVTKVersion/","title":"CheckVTKVersion","text":""},{"location":"Python/Snippets/CheckVTKVersion/#description","title":"Description","text":"

This enables us to check the VTK version and provide alternatives for different VTK versions.

True is returned if the requested VTK version is >= the current version.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Python/Snippets/CheckVTKVersion/#implementation","title":"Implementation","text":"
from vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major)\\\n                     + 100000000 * int(minor)\\\n                     + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:\n        # Expand component-wise comparisons for VTK versions < 8.90.\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion()\\\n                             + 100000000 * ver.GetVTKMinorVersion()\\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n
"},{"location":"Python/Snippets/CheckVTKVersion/#typical-usage","title":"Typical usage","text":"
    if vtk_version_ok(*ver):\n        try:\n            print('Our newest version of the code.')\n        except AttributeError:\n            pass\n    else:\n        print('This is code for older versions of VTK.')\n    print('Rest of the code.')\n

See:

  • PBR_Skybox for a typical usage example. Here we are deciding to use vtkCameraOrientationWidget instead of vtkOrientationMarkerWidget if the VTK version is >= 9.0.20210718.
  • CheckVTKVersion for a test/example.
"},{"location":"Python/Snippets/GetProgramParameters/","title":"GetProgramParameters","text":""},{"location":"Python/Snippets/GetProgramParameters/#description","title":"Description","text":"

Get the program parameters.

This particular snippet requires a file name and an optional figure number.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Python/Snippets/GetProgramParameters/#implementation","title":"Implementation","text":"
def get_program_parameters():\n    import argparse\n    description = 'What the program does.'\n    epilogue = '''\n        An expanded description of what the program does.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required filename.')\n    parser.add_argument('figure', default=0, type=int, nargs='?', help='An optional figure number.')\n    args = parser.parse_args()\n    return args.filename, args.figure\n
"},{"location":"Python/Snippets/GetProgramParameters/#typical-usage","title":"Typical usage","text":"
file_name, figure = get_program_parameters()\n
"},{"location":"Python/Snippets/PointToGlyph/","title":"PointToGlyph","text":""},{"location":"Python/Snippets/PointToGlyph/#description","title":"Description","text":"

Represent points as glyphs. The point is represented as a sphere.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Python/Snippets/PointToGlyph/#implementation","title":"Implementation","text":"
# from vtkmodules.vtkCommonDataModel import vtkPolyData\n# from vtkmodules.vtkFiltersSources import vtkSphereSource\n# from vtkmodules.vtkRenderingCore import (\n#     vtkActor,\n#     vtkGlyph3DMapper\n# )\n\n\ndef point_to_glyph(points, scale):\n    \"\"\"\n    Convert points to glyphs.\n    :param points: The points to glyph.\n    :param scale: The scale, used to determine the size of the\n                  glyph representing the point, expressed as a\n                  fraction of the largest side of the bounding\n                  box surrounding the points. e.g. 0.05\n    :return: The actor.\n    \"\"\"\n\n    bounds = points.GetBounds()\n    max_len = 0.0\n    for i in range(0, 3):\n        max_len = max(bounds[i + 1] - bounds[i], max_len)\n\n    sphere_source = vtkSphereSource()\n    sphere_source.SetRadius(scale * max_len)\n\n    pd = vtkPolyData()\n    pd.SetPoints(points)\n\n    mapper = vtkGlyph3DMapper()\n    mapper.SetInputData(pd)\n    mapper.SetSourceConnection(sphere_source.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    mapper.ScalingOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    return actor\n
"},{"location":"Python/Snippets/PointToGlyph/#usage","title":"Usage","text":"
    # Map the points to spheres\n    sphereActor = point_to_glyph(someFilter.GetOutput().GetPoints(), 0.05)\n    # Set the actor color here\n
"},{"location":"Python/Snippets/ReadPolyData/","title":"ReadPolyData","text":""},{"location":"Python/Snippets/ReadPolyData/#description","title":"Description","text":"

Given a filename, uses the appropriate vtkPolyData reader to read any vtkPolyData file.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Python/Snippets/ReadPolyData/#implementation","title":"Implementation","text":"
# from pathlib import Path\n\n# from vtkmodules.vtkIOGeometry import (\n#     vtkBYUReader,\n#     vtkOBJReader,\n#     vtkSTLReader\n# )\n# from vtkmodules.vtkIOLegacy import vtkPolyDataReader\n# from vtkmodules.vtkIOPLY import vtkPLYReader\n# from vtkmodules.vtkIOXML import vtkXMLPolyDataReader\n\n\ndef ReadPolyData(file_name):\n    valid_suffixes = ['.g', '.obj', '.stl', '.ply', '.vtk', '.vtp']\n    path = Path(file_name)\n    if path.suffix:\n        ext = path.suffix.lower()\n    if path.suffix not in valid_suffixes:\n        print(f'No reader for this file suffix: {ext}')\n        return None\n    else:\n        if ext == \".ply\":\n            reader = vtkPLYReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n        elif ext == \".vtp\":\n            reader = vtkXMLPolyDataReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n        elif ext == \".obj\":\n            reader = vtkOBJReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n        elif ext == \".stl\":\n            reader = vtkSTLReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n        elif ext == \".vtk\":\n            reader = vtkPolyDataReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n        elif ext == \".g\":\n            reader = vtkBYUReader()\n            reader.SetGeometryFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n\n        return poly_data\n
"},{"location":"Python/Snippets/WriteImage/","title":"WriteImage","text":""},{"location":"Python/Snippets/WriteImage/#description","title":"Description","text":"

Given a filename, render window and optionally a rgba value, take a screenshot of the render window and write it to a file. The extension of the filename determines what writer to use.

To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

"},{"location":"Python/Snippets/WriteImage/#implementation","title":"Implementation","text":"
# from pathlib import Path\n# \n# from vtkmodules.vtkIOImage import (\n#     vtkBMPWriter,\n#     vtkJPEGWriter,\n#     vtkPNGWriter,\n#     vtkPNMWriter,\n#     vtkPostScriptWriter,\n#     vtkTIFFWriter\n# )\n# from vtkmodules.vtkRenderingCore import vtkWindowToImageFilter\n\n\ndef write_image(file_name, ren_win, rgba=True):\n    \"\"\"\n    Write the render window view to an image file.\n\n    Image types supported are:\n     BMP, JPEG, PNM, PNG, PostScript, TIFF.\n    The default parameters are used for all writers, change as needed.\n\n    :param file_name: The file name, if no extension then PNG is assumed.\n    :param ren_win: The render window.\n    :param rgba: Used to set the buffer type.\n    :return:\n    \"\"\"\n\n    if file_name:\n        valid_suffixes = ['.bmp', '.jpg', '.png', '.pnm', '.ps', '.tiff']\n        # Select the writer to use.\n        parent = Path(file_name).resolve().parent\n        path = Path(parent) / file_name\n        if path.suffix:\n            ext = path.suffix.lower()\n        else:\n            ext = '.png'\n            path = Path(str(path)).with_suffix(ext)\n        if path.suffix not in valid_suffixes:\n            print(f'No writer for this file suffix: {ext}')\n            return\n        if ext == '.bmp':\n            writer = vtkBMPWriter()\n        elif ext == '.jpg':\n            writer = vtkJPEGWriter()\n        elif ext == '.pnm':\n            writer = vtkPNMWriter()\n        elif ext == '.ps':\n            if rgba:\n                rgba = False\n            writer = vtkPostScriptWriter()\n        elif ext == '.tiff':\n            writer = vtkTIFFWriter()\n        else:\n            writer = vtkPNGWriter()\n\n        windowto_image_filter = vtkWindowToImageFilter()\n        windowto_image_filter.SetInput(ren_win)\n        windowto_image_filter.SetScale(1)  # image quality\n        if rgba:\n            windowto_image_filter.SetInputBufferTypeToRGBA()\n        else:\n            windowto_image_filter.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            windowto_image_filter.ReadFrontBufferOff()\n            windowto_image_filter.Update()\n\n        writer.SetFileName(path)\n        writer.SetInputConnection(windowto_image_filter.GetOutputPort())\n        writer.Write()\n    else:\n        raise RuntimeError('Need a filename.')\n
"},{"location":"Python/Snippets/WriteImage/#usage","title":"Usage","text":"
  write_image(file_name, ren_win, rgba=False)\n
"},{"location":"Python/StructuredGrid/BlankPoint/","title":"BlankPoint","text":"

vtk-examples/Python/StructuredGrid/BlankPoint

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/StructuredGrid/BlankPoint/#code","title":"Code","text":"

BlankPoint.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkStructuredGrid\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n\n    grid_size = 8\n    counter = 0\n    pt_idx = 0\n    # Create a 5x5 grid of points\n    for j in range(0, grid_size):\n        for i in range(0, grid_size):\n            if i == 3 and j == 3:  # Make one point higher than the rest.\n                points.InsertNextPoint(i, j, 2)\n                print(f'The different point is number {counter}.')\n                pt_idx = counter\n            else:\n                # Make most of the points the same height.\n                points.InsertNextPoint(i, j, 0)\n            counter += 1\n\n    structured_grid = vtkStructuredGrid()\n    # Specify the dimensions of the grid, set the points and blank one point.\n    structured_grid.SetDimensions(grid_size, grid_size, 1)\n    structured_grid.SetPoints(points)\n    structured_grid.BlankPoint(pt_idx)\n\n    # Check.\n    def is_visible(pt_num):\n        if structured_grid.IsPointVisible(pt_num):\n            return f'Point {pt_num:2d} is visible.'\n        else:\n            return f'Point {pt_num:2d} is not visible.'\n\n    # Should not be visible.\n    print(is_visible(pt_idx))\n    # Should be visible.\n    print(is_visible(7))\n\n    # We need the geometry filter to ensure that the\n    # blanked point and surrounding faces is missing.\n    geometry_filter = vtkStructuredGridGeometryFilter()\n    geometry_filter.SetInputData(structured_grid)\n\n    # Create a mapper and actor.\n    grid_mapper = vtkDataSetMapper()\n    grid_mapper.SetInputConnection(geometry_filter.GetOutputPort())\n\n    grid_actor = vtkActor()\n    grid_actor.SetMapper(grid_mapper)\n    grid_actor.GetProperty().EdgeVisibilityOn()\n    grid_actor.GetProperty().SetEdgeColor(colors.GetColor3d('Blue'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    renderer.AddActor(grid_actor)\n    renderer.SetBackground(colors.GetColor3d('ForestGreen'))\n\n    # ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('BlankPoint')\n    ren_win.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/StructuredGrid/SGrid/","title":"SGrid","text":"

vtk-examples/Python/StructuredGrid/SGrid

"},{"location":"Python/StructuredGrid/SGrid/#description","title":"Description","text":"

Creating a structured grid dataset of a semicylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction.

Info

See Figure 5-19 in Chapter 5 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/StructuredGrid/SGrid/#code","title":"Code","text":"

SGrid.py

#!/usr/bin/env python\n\n'''\nThis example shows how to manually create a structured grid.\nThe basic idea is to instantiate vtkStructuredGrid, set its dimensions,\n and then assign points defining the grid coordinate. The number of\n points must equal the number of points implicit in the dimensions\n (i.e., dimX*dimY*dimZ). Also, data attributes (either point or cell)\n can be added to the dataset.\n'''\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkMath,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkStructuredGrid\nfrom vtkmodules.vtkFiltersCore import vtkHedgeHog\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    rMin = 0.5\n    rMax = 1.0\n    dims = [13, 11, 11]\n\n    # Create the structured grid.\n    sgrid = vtkStructuredGrid()\n    sgrid.SetDimensions(dims)\n\n    # We also create the points and vectors. The points\n    # form a hemi-cylinder of data.\n    vectors = vtkDoubleArray()\n    vectors.SetNumberOfComponents(3)\n    vectors.SetNumberOfTuples(dims[0] * dims[1] * dims[2])\n    points = vtkPoints()\n    points.Allocate(dims[0] * dims[1] * dims[2])\n\n    deltaZ = 2.0 / (dims[2] - 1)\n    deltaRad = (rMax - rMin) / (dims[1] - 1)\n    x = [0.0] * 3\n    v = [0.0] * 3\n    for k in range(0, dims[2]):\n        x[2] = -1.0 + k * deltaZ\n        kOffset = k * dims[0] * dims[1]\n        for j in range(0, dims[1]):\n            radius = rMin + j * deltaRad\n            jOffset = j * dims[0]\n            for i in range(0, dims[0]):\n                theta = i * vtkMath.RadiansFromDegrees(15.0)\n                x[0] = radius * math.cos(theta)\n                x[1] = radius * math.sin(theta)\n                v[0] = -x[1]\n                v[1] = x[0]\n                offset = i + jOffset + kOffset\n                points.InsertPoint(offset, x)\n                vectors.InsertTuple(offset, v)\n    sgrid.SetPoints(points)\n    sgrid.GetPointData().SetVectors(vectors)\n\n    # We create a simple pipeline to display the data.\n    hedgehog = vtkHedgeHog()\n    hedgehog.SetInputData(sgrid)\n    hedgehog.SetScaleFactor(0.1)\n\n    sgridMapper = vtkPolyDataMapper()\n    sgridMapper.SetInputConnection(hedgehog.GetOutputPort())\n    sgridActor = vtkActor()\n    sgridActor.SetMapper(sgridMapper)\n    sgridActor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    # Create the usual rendering stuff\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    renWin.SetWindowName('SGrid')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    renderer.AddActor(sgridActor)\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(60.0)\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.GetActiveCamera().Dolly(1.0)\n    renWin.SetSize(640, 480)\n\n    # Interact with the data.\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/StructuredPoints/Vol/","title":"Vol","text":"

vtk-examples/Python/StructuredPoints/Vol

"},{"location":"Python/StructuredPoints/Vol/#description","title":"Description","text":"

Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26^3.

Info

See Figure 5-18 in Chapter 5 the VTK Textbook.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/StructuredPoints/Vol/#code","title":"Code","text":"

Vol.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkStructuredPoints\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    vol = vtkStructuredPoints()\n    vol.SetDimensions(26, 26, 26)\n    vol.SetOrigin(-0.5, -0.5, -0.5)\n    sp = 1.0 / 25.0\n    vol.SetSpacing(sp, sp, sp)\n\n    scalars = vtkDoubleArray()\n    scalars.SetNumberOfComponents(1)\n    scalars.SetNumberOfTuples(26 * 26 * 26)\n    for k in range(0, 26):\n        z = -0.5 + k * sp\n        kOffset = k * 26 * 26\n        for j in range(0, 26):\n            y = -0.5 + j * sp\n            jOffset = j * 26\n            for i in range(0, 26):\n                x = -0.5 + i * sp\n                s = x * x + y * y + z * z - (0.4 * 0.4)\n                offset = i + jOffset + kOffset\n                scalars.InsertTuple1(offset, s)\n    vol.GetPointData().SetScalars(scalars)\n\n    contour = vtkContourFilter()\n    contour.SetInputData(vol)\n    contour.SetValue(0, 0.0)\n\n    volMapper = vtkPolyDataMapper()\n    volMapper.SetInputConnection(contour.GetOutputPort())\n    volMapper.ScalarVisibilityOff()\n    volActor = vtkActor()\n    volActor.SetMapper(volMapper)\n    volActor.GetProperty().EdgeVisibilityOn()\n    volActor.GetProperty().SetColor(colors.GetColor3d('Salmon'))\n    renderer.AddActor(volActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('Vol')\n\n    # Interact with the data.\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Texture/AnimateVectors/","title":"AnimateVectors","text":"

vtk-examples/Python/Texture/AnimateVectors

"},{"location":"Python/Texture/AnimateVectors/#description","title":"Description","text":"

Texture maps can be animated as a function of time. By choosing a texture map whose intensity varies monotonically from dark to light, and then \u201cmoving\u201d the texture along an object,the object appears to crawl in the direction of the texture map motion. We can use this technique to add apparent motion to things like hedgehogs to show vector magnitude. This example uses texture map animation to simulate vector field motion.

Cite

See B. Yamrom and K. M. Martin. Vector Field Animation with Texture Maps. IEEE Computer Graphics and Applications. 15(2):22\u201324, 1995 for background.

Info

See Figure 7-3 in Chapter 7 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Texture/AnimateVectors/#code","title":"Code","text":"

AnimateVectors.py

#!/usr/bin/env python\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkGlyph3D,\n    vtkThresholdPoints\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    vec_anim_paths = [''] * 2\n    fn1, fn2 = get_program_parameters()\n    vec_anim_paths[0] = Path(fn1)\n    vec_anim_paths[1] = Path(fn2)\n\n    # Generate the other vecAnim file names. There are 8 of them.\n    tmp = str(vec_anim_paths[1])\n    old_stem = vec_anim_paths[1].stem\n    for i in range(2, 9):\n        new_stem = old_stem[:-1] + str(i)\n        vec_anim_paths.append(Path(tmp.replace(old_stem, new_stem)))\n\n    colors = vtkNamedColors()\n\n    # Setup the render window, renderer, and interactor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Read the data.\n\n    # Create the pipeline.\n\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(vec_anim_paths[0])\n\n    threshold = vtkThresholdPoints()\n    threshold.SetInputConnection(reader.GetOutputPort())\n    threshold.ThresholdByUpper(200)\n\n    line = vtkLineSource()\n    line.SetResolution(1)\n\n    lines = vtkGlyph3D()\n    lines.SetInputConnection(threshold.GetOutputPort())\n    lines.SetSourceConnection(line.GetOutputPort())\n    lines.SetScaleFactor(0.005)\n    lines.SetScaleModeToScaleByScalar()\n    lines.Update()\n\n    vectorMapper = vtkPolyDataMapper()\n    vectorMapper.SetInputConnection(lines.GetOutputPort())\n    vectorMapper.SetScalarRange(lines.GetOutput().GetScalarRange())\n\n    vectorActor = vtkActor()\n    vectorActor.SetMapper(vectorMapper)\n    vectorActor.GetProperty().SetOpacity(0.99)\n    vectorActor.GetProperty().SetLineWidth(1.5)\n\n    # Outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    #  Texture maps.\n    textureMaps = list()\n    for i in range(2, len(vec_anim_paths)):\n        tmap = vtkStructuredPointsReader()\n        tmap.SetFileName(vec_anim_paths[i])\n\n        texture = vtkTexture()\n        texture.SetInputConnection(tmap.GetOutputPort())\n        texture.InterpolateOff()\n        texture.RepeatOff()\n        textureMaps.append(texture)\n\n    vectorActor.SetTexture(textureMaps[0])\n\n    # Add the actors to the renderer, set the background and size.\n\n    renderer.AddActor(vectorActor)\n    renderer.AddActor(outlineActor)\n\n    cam1 = vtkCamera()\n    cam1.SetClippingRange(17.4043, 870.216)\n    cam1.SetFocalPoint(136.71, 104.025, 23)\n    cam1.SetPosition(204.747, 258.939, 63.7925)\n    cam1.SetViewUp(-0.102647, -0.210897, 0.972104)\n    cam1.Zoom(1.2)\n    renderer.SetActiveCamera(cam1)\n\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('AnimateVectors')\n\n    # Go into a loop.\n    for j in range(0, 100):\n        for i in range(0, len(textureMaps)):\n            vectorActor.SetTexture(textureMaps[i])\n            renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Texture maps can be animated as a function of time.'\n    epilogue = '''\n    This example uses texture map animation to simulate vector field motion.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='carotid.')\n    parser.add_argument('filename2', help='VectorAnimation/vecAnim1.vtk.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Texture/TextureCutQuadric/","title":"TextureCutQuadric","text":"

vtk-examples/Python/Texture/TextureCutQuadric

"},{"location":"Python/Texture/TextureCutQuadric/#description","title":"Description","text":"

Clip geometry using a 2D texture map and two implicit functions. The technique is described in : Geometric Clipping Using Boolean Textures.

Info

See Figure 9-45b in Chapter 9 The VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Texture/TextureCutQuadric/#code","title":"Code","text":"

TextureCutQuadric.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkFiltersTexture import vtkImplicitTextureCoords\nfrom vtkmodules.vtkImagingHybrid import vtkBooleanTexture\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\npositions = [\n    [-4, 4, 0], [-2, 4, 0], [0, 4, 0], [2, 4, 0],\n    [-4, 2, 0], [-2, 2, 0], [0, 2, 0], [2, 2, 0],\n    [-4, 0, 0], [-2, 0, 0], [0, 0, 0], [2, 0, 0],\n    [-4, -2, 0], [-2, -2, 0], [0, -2, 0], [2, -2, 0]\n]\n\nsolid = [255, 255]\nclear = [255, 0]\nedge = [0, 255]\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renWin = vtkRenderWindow()\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    aren = vtkRenderer()\n\n    # define two elliptical cylinders\n    quadric1 = vtkQuadric()\n    quadric1.SetCoefficients(1, 2, 0, 0, 0, 0, 0, 0, 0, -.07)\n\n    quadric2 = vtkQuadric()\n    quadric2.SetCoefficients(2, 1, 0, 0, 0, 0, 0, 0, 0, -.07)\n\n    # Create a sphere for all to use.\n    aSphere = vtkSphereSource()\n    aSphere.SetPhiResolution(21)\n    aSphere.SetThetaResolution(21)\n\n    # Create texture coordinates for all.\n    tcoords = vtkImplicitTextureCoords()\n    tcoords.SetInputConnection(aSphere.GetOutputPort())\n    tcoords.SetRFunction(quadric1)\n    tcoords.SetSFunction(quadric2)\n\n    aMapper = vtkDataSetMapper()\n    aMapper.SetInputConnection(tcoords.GetOutputPort())\n\n    # Create a mapper, sphere and texture map for each case.\n    for i in range(0, 16):\n        aBoolean = MakeBooleanTexture(i, 64, 0)\n\n        aTexture2 = vtkTexture()\n        aTexture2.SetInputConnection(aBoolean.GetOutputPort())\n        aTexture2.InterpolateOff()\n        aTexture2.RepeatOff()\n\n        anActor2 = vtkActor()\n\n        anActor2.SetMapper(aMapper)\n        anActor2.SetTexture(aTexture2)\n        anActor2.SetPosition(positions[i])\n        anActor2.SetScale(2.0, 2.0, 2.0)\n        anActor2.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n        aren.AddActor(anActor2)\n\n    aren.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(500, 500)\n    renWin.AddRenderer(aren)\n    renWin.SetWindowName('TextureCutQuadric')\n\n    # Interact with the data.\n    renWin.Render()\n\n    iren.Start()\n\n\ndef MakeBooleanTexture(caseNumber, resolution, thickness):\n    booleanTexture = vtkBooleanTexture()\n\n    booleanTexture.SetXSize(resolution)\n    booleanTexture.SetYSize(resolution)\n    booleanTexture.SetThickness(thickness)\n\n    if caseNumber == 0:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(solid)\n        booleanTexture.SetOnIn(solid)\n        booleanTexture.SetOnOut(solid)\n        booleanTexture.SetInOn(solid)\n        booleanTexture.SetOutOn(solid)\n    elif caseNumber == 1:  # cut inside 1\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(solid)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(solid)\n    elif caseNumber == 2:  # cut outside 1\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(solid)\n        booleanTexture.SetInOn(solid)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 3:  # cut all 1\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(clear)\n        booleanTexture.SetOnOut(solid)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 4:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(solid)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(solid)\n    elif caseNumber == 5:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(clear)\n        booleanTexture.SetOutOn(solid)\n    elif caseNumber == 6:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 7:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(clear)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(clear)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 8:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(solid)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(solid)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 9:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 10:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(solid)\n        booleanTexture.SetOutOn(clear)\n    elif caseNumber == 11:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(clear)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(clear)\n    elif caseNumber == 12:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(solid)\n        booleanTexture.SetOnOut(clear)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 13:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(clear)\n        booleanTexture.SetInOn(clear)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 14:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(clear)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(clear)\n    else:  # caseNumber ==  15:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(clear)\n        booleanTexture.SetOnIn(clear)\n        booleanTexture.SetOnOut(clear)\n        booleanTexture.SetInOn(clear)\n        booleanTexture.SetOutOn(clear)\n\n    return booleanTexture\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Texture/TextureCutSphere/","title":"TextureCutSphere","text":"

vtk-examples/Python/Texture/TextureCutSphere

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Texture/TextureCutSphere/#code","title":"Code","text":"

TextureCutSphere.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPlanes\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkFiltersTexture import vtkImplicitTextureCoords\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # hidden sphere\n    sphere1 = vtkSphereSource()\n    sphere1.SetRadius(0.5)\n\n    innerMapper = vtkPolyDataMapper()\n    innerMapper.SetInputConnection(sphere1.GetOutputPort())\n\n    innerSphere = vtkActor()\n    innerSphere.SetMapper(innerMapper)\n    innerSphere.GetProperty().SetColor(colors.GetColor3d('BlanchedAlmond'))\n\n    # sphere to texture\n    sphere2 = vtkSphereSource()\n    sphere2.SetRadius(1.0)\n    sphere2.SetPhiResolution(21)\n    sphere2.SetThetaResolution(21)\n\n    pts = [0.0] * 6\n    points = vtkPoints()\n    points.SetNumberOfPoints(2)\n    points.SetPoint(0, pts[:3])\n    points.SetPoint(1, pts[3:])\n\n    nrms = [0.0] * 6\n    nrms[0] = 1.0\n    nrms[4] = 1.0\n    normals = vtkDoubleArray()\n    normals.SetNumberOfComponents(3)\n    normals.SetNumberOfTuples(2)\n    normals.SetTuple(0, nrms[:3])\n    normals.SetTuple(1, nrms[3:])\n\n    planes = vtkPlanes()\n    planes.SetPoints(points)\n    planes.SetNormals(normals)\n\n    tcoords = vtkImplicitTextureCoords()\n    tcoords.SetInputConnection(sphere2.GetOutputPort())\n    tcoords.SetRFunction(planes)\n\n    outerMapper = vtkDataSetMapper()\n    outerMapper.SetInputConnection(tcoords.GetOutputPort())\n\n    tmap = vtkStructuredPointsReader()\n    tmap.SetFileName(fileName)\n\n    texture = vtkTexture()\n    texture.SetInputConnection(tmap.GetOutputPort())\n    texture.InterpolateOff()\n    texture.RepeatOff()\n\n    outerSphere = vtkActor()\n    outerSphere.SetMapper(outerMapper)\n    outerSphere.SetTexture(texture)\n    outerSphere.GetProperty().SetColor(colors.GetColor3d('LightSalmon'))\n\n    renWin = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    aren = vtkRenderer()\n    iren.SetRenderWindow(renWin)\n    renWin.AddRenderer(aren)\n\n    aren.AddActor(innerSphere)\n    aren.AddActor(outerSphere)\n    aren.SetBackground(colors.GetColor3d('SlateGray'))\n    aren.GetActiveCamera().Azimuth(-30)\n    aren.GetActiveCamera().Elevation(-30)\n    aren.ResetCamera()\n\n    renWin.SetSize(500, 500)\n    renWin.SetWindowName('TextureCutSphere')\n\n    # interact with data\n    renWin.Render()\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Cut an outer sphere to reveal an inner sphere.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='texThres.vtk.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Texture/TexturePlane/","title":"TexturePlane","text":"

vtk-examples/Python/Texture/TexturePlane

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Texture/TexturePlane/#code","title":"Code","text":"

TexturePlane.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Load in the texture map. A texture is any unsigned char image. If it\n    # is not of this type, you will have to map it through a lookup table\n    # or by using vtkImageShiftScale.\n    #\n    readerFactory = vtkImageReader2Factory()\n    textureFile = readerFactory.CreateImageReader2(fileName)\n    textureFile.SetFileName(fileName)\n    textureFile.Update()\n\n    atext = vtkTexture()\n    atext.SetInputConnection(textureFile.GetOutputPort())\n    atext.InterpolateOn()\n\n    # Create a plane source and actor. The vtkPlanesSource generates\n    # texture coordinates.\n    #\n    plane = vtkPlaneSource()\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputConnection(plane.GetOutputPort())\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n    planeActor.SetTexture(atext)\n\n    # Create the RenderWindow, Renderer and Interactor.\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    renderer.AddActor(planeActor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('TexturePlane')\n\n    # render the image\n    renWin.Render()\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Roll(-20)\n    renderer.ResetCameraClippingRange()\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'How to do basic texture mapping.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='masonry.bmp.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Texture/TextureThreshold/","title":"TextureThreshold","text":"

vtk-examples/Python/Texture/TextureThreshold

"},{"location":"Python/Texture/TextureThreshold/#description","title":"Description","text":"

Demonstrating texture thresholding applied to scalar data from a simulation of fluid flow.

There are three planes cutting the blunt fin with different thresholds set. From the left, the scalar threshold is set so that:

  1. Only data with a scalar value greater than or equal to 1.5 is shown.
  2. Only data with a scalar value less than or equal to 1.5 is shown.
  3. Only data with a scalar value between 1.5 and 1.8 inclusive is shown.

Info

See Figure 9-43a in Chapter 9 The VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Texture/TextureThreshold/#code","title":"Code","text":"

TextureThreshold.py

#!/usr/bin/env python\n\n# Modified from VTK/Filters/Texture/Testing/Python/textureThreshold.py.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersTexture import vtkThresholdTextureCoords\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    dataFn1, dataFn2, textureFn = get_program_parameters()\n    colors = vtkNamedColors()\n\n    # Read the data.\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(dataFn1)\n    pl3d.SetQFileName(dataFn2)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n    output = pl3d.GetOutput().GetBlock(0)\n\n    # Make the wall (floor).\n    wall = vtkStructuredGridGeometryFilter()\n    wall.SetInputData(output)\n    wall.SetExtent(0, 100, 0, 0, 0, 100)\n    wallMap = vtkPolyDataMapper()\n    wallMap.SetInputConnection(wall.GetOutputPort())\n    wallMap.ScalarVisibilityOff()\n    wallActor = vtkActor()\n    wallActor.SetMapper(wallMap)\n    wallActor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # Make the fin (rear wall)\n    fin = vtkStructuredGridGeometryFilter()\n    fin.SetInputData(output)\n    fin.SetExtent(0, 100, 0, 100, 0, 0)\n    finMap = vtkPolyDataMapper()\n    finMap.SetInputConnection(fin.GetOutputPort())\n    finMap.ScalarVisibilityOff()\n    finActor = vtkActor()\n    finActor.SetMapper(finMap)\n    finActor.GetProperty().SetColor(colors.GetColor3d('DarkSlateGray'))\n\n    # Get the texture.\n    tmap = vtkStructuredPointsReader()\n    tmap.SetFileName(textureFn)\n    texture = vtkTexture()\n    texture.SetInputConnection(tmap.GetOutputPort())\n    texture.InterpolateOff()\n    texture.RepeatOff()\n\n    # Create the rendering window, renderer, and interactive renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Make the planes to threshold and texture.\n    plane = list()\n    thresh = list()\n    planeMap = list()\n    planeActor = list()\n    # Define the extents of planes that we will use.\n    planeExtents = [[10, 10, 0, 100, 0, 100],\n                    [30, 30, 0, 100, 0, 100],\n                    [35, 35, 0, 100, 0, 100]]\n    # Now set up the pipeline.\n    for i in range(0, len(planeExtents)):\n        plane.append(vtkStructuredGridGeometryFilter())\n        plane[i].SetInputData(output)\n        plane[i].SetExtent(*planeExtents[i])\n        thresh.append(vtkThresholdTextureCoords())\n        thresh[i].SetInputConnection(plane[i].GetOutputPort())\n        thresh[i].SetInputConnection(plane[i].GetOutputPort())\n        # If you want an image similar to Fig 9-43(a) in the VTK textbook,\n        # set thresh[i].ThresholdByUpper(1.5) for all planes.\n        if i == 1:\n            thresh[i].ThresholdByLower(1.5)\n        elif i == 2:\n            thresh[i].ThresholdBetween(1.5, 1.8)\n        else:\n            thresh[i].ThresholdByUpper(1.5)\n        planeMap.append(vtkDataSetMapper())\n        planeMap[i].SetInputConnection(thresh[i].GetOutputPort())\n        planeMap[i].SetScalarRange(output.GetScalarRange())\n        planeActor.append(vtkActor())\n        planeActor[i].SetMapper(planeMap[i])\n        planeActor[i].SetTexture(texture)\n        #  The slight transparency gives a nice effect.\n        planeActor[i].GetProperty().SetOpacity(0.999)\n        ren.AddActor(planeActor[i])\n\n    # Get an outline of the data set for context.\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(output)\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineProp = outlineActor.GetProperty()\n    outlineProp.SetColor(colors.GetColor3d('Black'))\n\n    # Add the remaining actors to the renderer, set the background and size.\n    ren.AddActor(outlineActor)\n    ren.AddActor(wallActor)\n    ren.AddActor(finActor)\n    ren.SetBackground(colors.GetColor3d('MistyRose'))\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('TextureThreshold')\n\n    cam = vtkCamera()\n    cam.SetClippingRange(1.51176, 75.5879)\n    cam.SetFocalPoint(2.33749, 2.96739, 3.61023)\n    cam.SetPosition(10.8787, 5.27346, 15.8687)\n    cam.SetViewAngle(30)\n    cam.SetViewUp(-0.0610856, 0.987798, -0.143262)\n    ren.SetActiveCamera(cam)\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrating texture thresholding applied to scalar data from a simulation of fluid flow.'\n    epilogue = '''\n    There are three planes cutting the blunt fin with different thresholds set. \n     From the left, the scalar threshold is set so that:\n       1) Only data with a scalar value greater than or equal to 1.5 is shown.\n       2) Only data with a scalar value less than or equal to 1.5 is shown.\n       3) Only data with a scalar value between 1.5 and 1.8 inclusive is shown.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('dataFn1', help='bluntfinxyz.bin.')\n    parser.add_argument('dataFn2', help='bluntfinq.bin.')\n    parser.add_argument('textureFn', help='texThres2.bmp')\n    args = parser.parse_args()\n    return args.dataFn1, args.dataFn2, args.textureFn\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Tutorial/Tutorial_Step1/","title":"Tutorial Step1","text":"

vtk-examples/Python/Tutorial/Tutorial_Step1

"},{"location":"Python/Tutorial/Tutorial_Step1/#description","title":"Description","text":"

This example creates a polygonal model of a cone, and then renders it to the screen. It will rotate the cone 360 degrees and then exit. The basic setup of source -> mapper -> actor -> renderer -> renderwindow is typical of most VTK programs.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Tutorial/Tutorial_Step1/#code","title":"Code","text":"

Tutorial_Step1.py

#!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    #\n    # Next we create an instance of vtkNamedColors and we will use\n    # this to select colors for the object and background.\n    #\n    colors = vtkNamedColors()\n\n    #\n    # Now we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource \"cone\" is part of a\n    # visualization pipeline (it is a source process object) it produces data\n    # (output type is vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the cone. The actor orchestrates rendering\n    # of the mapper's graphics primitives. An actor also refers to properties\n    # via a vtkProperty instance, and includes an internal transformation\n    # matrix. We set this actor's mapper to be coneMapper which we created\n    # above.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    #\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is\n    # responsible for drawing the actors it has.  We also set the background\n    # color here.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    # Finally we create the render window which will show up on the screen.\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('Tutorial_Step1')\n\n    #\n    # Now we loop over 360 degrees and render the cone each time.\n    #\n    for i in range(0, 360):\n        # Render the image\n        renWin.Render()\n        # Rotate the active camera by one degree.\n        ren1.GetActiveCamera().Azimuth(1)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Tutorial/Tutorial_Step2/","title":"Tutorial Step2","text":"

vtk-examples/Python/Tutorial/Tutorial_Step2

"},{"location":"Python/Tutorial/Tutorial_Step2/#description","title":"Description","text":"

This example shows how to add an observer to a Python program. It extends the Tutorial_Step1 example (see that example for information on the basic setup).

VTK uses a command/observer design pattern. That is, observers watch for particular events that any vtkObject (or subclass) may invoke on itself. For example, the vtkRenderer invokes a \"StartEvent\" as it begins to render. Here we add an observer that invokes a command when this event is observed.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Tutorial/Tutorial_Step2/#code","title":"Code","text":"

Tutorial_Step2.py

#!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    #\n    # The pipeline creation is documented in Tutorial_Step1.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('MidnightBlue'))\n    ren1.ResetCamera()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('Tutorial_Step2')\n\n    # Here is where we setup the observer.\n    mo1 = vtkMyCallback(ren1)\n    ren1.AddObserver('StartEvent', mo1)\n\n    #\n    # Now we loop over 360 degrees and render the cone each time.\n    #\n    for i in range(0, 360):\n        # Render the image.\n        renWin.Render()\n        # Rotate the active camera by one degree.\n        ren1.GetActiveCamera().Azimuth(1)\n\n\nclass vtkMyCallback(object):\n    \"\"\"\n    Callback for the interaction.\n    \"\"\"\n\n    def __init__(self, renderer):\n        self.renderer = renderer\n\n    def __call__(self, caller, ev):\n        position = self.renderer.GetActiveCamera().GetPosition()\n        print('({:5.2f}, {:5.2f}, {:5.2f})'.format(*position))\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Tutorial/Tutorial_Step3/","title":"Tutorial Step3","text":"

vtk-examples/Python/Tutorial/Tutorial_Step3

"},{"location":"Python/Tutorial/Tutorial_Step3/#description","title":"Description","text":"

This example demonstrates how to use multiple renderers within a render window.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Tutorial/Tutorial_Step3/#code","title":"Code","text":"

Tutorial_Step3.py

#!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource 'cone' is part of a\n    # visualization pipeline (it is a source process object) it produces data\n    # (output type is vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the cone. The actor orchestrates rendering\n    # of the mapper's graphics primitives. An actor also refers to properties\n    # via a vtkProperty instance, and includes an internal transformation\n    # matrix. We set this actor's mapper to be coneMapper which we created\n    # above.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    #\n    # Create two renderers and assign actors to them. A renderer renders into\n    # a viewport within the vtkRenderWindow. It is part or all of a window on\n    # the screen and it is responsible for drawing the actors it has.  We also\n    # set the background color here. In this example we are adding the same\n    # actor to two different renderers it is okay to add different actors to\n    # different renderers as well.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('RoyalBlue'))\n\n    ren1.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    ren2 = vtkRenderer()\n    ren2.AddActor(coneActor)\n    ren2.SetBackground(colors.GetColor3d('DodgerBlue'))\n    ren2.SetViewport(0.5, 0.0, 1.0, 1.0)\n\n    #\n    # Finally we create the render window which will show up on the screen.\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.AddRenderer(ren2)\n    renWin.SetSize(600, 300)\n    renWin.SetWindowName('Tutorial_Step3')\n\n    #\n    # Make one view 90 degrees from other.\n    #\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Azimuth(90)\n\n    #\n    # Now we loop over 360 degrees and render the cones each time.\n    #\n    for i in range(0, 360):  # render the image\n        renWin.Render()\n        # rotate the active camera by one degree\n        ren1.GetActiveCamera().Azimuth(1)\n        ren2.GetActiveCamera().Azimuth(1)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Tutorial/Tutorial_Step4/","title":"Tutorial Step4","text":"

vtk-examples/Python/Tutorial/Tutorial_Step4

"},{"location":"Python/Tutorial/Tutorial_Step4/#description","title":"Description","text":"

This example demonstrates the creation of multiple actors and the manipulation of their properties and transformations.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Tutorial/Tutorial_Step4/#code","title":"Code","text":"

Tutorial_Step4.py

#!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource \"cone\" is part of a\n    # visualization pipeline (it is a source process object) it produces data\n    # (output type is vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the first cone. The actor's properties are\n    # modified to give it different surface properties. By default, an actor\n    # is create with a property so the GetProperty() method can be used.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(0.2, 0.63, 0.79)\n    coneActor.GetProperty().SetDiffuse(0.7)\n    coneActor.GetProperty().SetSpecular(0.4)\n    coneActor.GetProperty().SetSpecularPower(20)\n\n    #\n    # Create a property and directly manipulate it. Assign it to the\n    # second actor.\n    #\n    property = vtkProperty()\n    property.SetColor(colors.GetColor3d(\"Tomato\"))\n    property.SetDiffuse(0.7)\n    property.SetSpecular(0.4)\n    property.SetSpecularPower(20)\n\n    #\n    # Create a second actor and a property. The property is directly\n    # manipulated and then assigned to the actor. In this way, a single\n    # property can be shared among many actors. Note also that we use the\n    # same mapper as the first actor did. This way we avoid duplicating\n    # geometry, which may save lots of memory if the geometry is large.\n    coneActor2 = vtkActor()\n    coneActor2.SetMapper(coneMapper)\n    coneActor2.GetProperty().SetColor(colors.GetColor3d(\"LightSeaGreen\"))\n    coneActor2.SetProperty(property)\n    coneActor2.SetPosition(0, 2, 0)\n\n    #\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is\n    # responsible for drawing the actors it has.  We also set the background\n    # color here.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.AddActor(coneActor2)\n    ren1.SetBackground(colors.GetColor3d(\"CornflowerBlue\"))\n\n    #\n    # Finally we create the render window which will show up on the screen.\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName(\"Tutorial_Step4\")\n\n    #\n    # Now we loop over 360 degrees and render the cones each time.\n    #\n    for i in range(0, 360):  # render the image\n        # render the image\n        renWin.Render()\n        # rotate the active camera by one degree\n        ren1.GetActiveCamera().Azimuth(1)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Tutorial/Tutorial_Step5/","title":"Tutorial Step5","text":"

vtk-examples/Python/Tutorial/Tutorial_Step5

"},{"location":"Python/Tutorial/Tutorial_Step5/#description","title":"Description","text":"

This example introduces the concepts of interaction into the Python environment. A different interaction style (than the default) is defined.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Tutorial/Tutorial_Step5/#code","title":"Code","text":"

Tutorial_Step5.py

#!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource 'cone' is part of a\n    # visualization pipeline (it is a source process object) it produces data\n    # (output type is vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the cone. The actor orchestrates rendering\n    # of the mapper's graphics primitives. An actor also refers to properties\n    # via a vtkProperty instance, and includes an internal transformation\n    # matrix. We set this actor's mapper to be coneMapper which we created\n    # above.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Bisque'))\n\n    #\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is\n    # responsible for drawing the actors it has.  We also set the background\n    # color here.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    #\n    # Finally we create the render window which will show up on the screen.\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('Tutorial_Step5')\n\n    #\n    # The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n    # mouse) in the vtkRenderWindow. These events are translated into\n    # event invocations that VTK understands (see VTK/Common/vtkCommand.h\n    # for all events that VTK processes). Then observers of these VTK\n    # events can process them as appropriate.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # By default the vtkRenderWindowInteractor instantiates an instance\n    # of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n    # it observes into operations on the camera, actors, and/or properties\n    # in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n    # Here we specify a particular interactor style.\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    #\n    # Unlike the previous scripts where we performed some operations and then\n    # exited, here we leave an event loop running. The user can use the mouse\n    # and keyboard to perform the operations on the scene according to the\n    # current interaction style. When the user presses the 'e' key, by default\n    # an ExitEvent is invoked by the vtkRenderWindowInteractor which is caught\n    # and drops out of the event loop (triggered by the Start() method that\n    # follows.\n    #\n    iren.Initialize()\n    iren.Start()\n\n    #\n    # Final note: recall that observers can watch for particular events and\n    # take appropriate action. Pressing 'u' in the render window causes the\n    # vtkRenderWindowInteractor to invoke a UserEvent. This can be caught to\n    # popup a GUI, etc. See the Tcl Cone5.tcl example for an idea of how this\n    # works.\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Tutorial/Tutorial_Step6/","title":"Tutorial Step6","text":"

vtk-examples/Python/Tutorial/Tutorial_Step6

"},{"location":"Python/Tutorial/Tutorial_Step6/#description","title":"Description","text":"

This example introduces 3D widgets. 3D widgets take advantage of the event/observer design pattern introduced previously. They typically have a particular representation in the scene which can be interactively selected and manipulated using the mouse and keyboard. As the widgets are manipulated, they in turn invoke events such as StartInteractionEvent, InteractionEvent, and EndInteractionEvent which can be used to manipulate the scene that the widget is embedded in. 3D widgets work in the context of the event loop which was set up in the previous example.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Tutorial/Tutorial_Step6/#code","title":"Code","text":"

Tutorial_Step6.py

#!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkBoxWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource 'cone' is part of a\n    # visualization pipeline (it is a source process object) it produces data\n    # (output type is vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the cone. The actor orchestrates rendering\n    # of the mapper's graphics primitives. An actor also refers to properties\n    # via a vtkProperty instance, and includes an internal transformation\n    # matrix. We set this actor's mapper to be coneMapper which we created\n    # above.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Bisque'))\n\n    #\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is\n    # responsible for drawing the actors it has.  We also set the background\n    # color here.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    #\n    # Finally we create the render window which will show up on the screen.\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('Tutorial_Step6')\n\n    #\n    # The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n    # mouse) in the vtkRenderWindow. These events are translated into\n    # event invocations that VTK understands (see VTK/Common/vtkCommand.h\n    # for all events that VTK processes). Then observers of these VTK\n    # events can process them as appropriate.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # By default the vtkRenderWindowInteractor instantiates an instance\n    # of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n    # it observes into operations on the camera, actors, and/or properties\n    # in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n    # Here we specify a particular interactor style.\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    #\n    # Here we use a vtkBoxWidget to transform the underlying coneActor (by\n    # manipulating its transformation matrix). Many other types of widgets\n    # are available for use, see the documentation for more details.\n    #\n    # The SetInteractor method is how 3D widgets are associated with the render\n    # window interactor. Internally, SetInteractor sets up a bunch of callbacks\n    # using the Command/Observer mechanism (AddObserver()). The place factor\n    # controls the initial size of the widget with respect to the bounding box\n    # of the input to the widget.\n    boxWidget = vtkBoxWidget()\n    boxWidget.SetInteractor(iren)\n    boxWidget.SetPlaceFactor(1.25)\n    boxWidget.GetOutlineProperty().SetColor(colors.GetColor3d('Gold'))\n\n    #\n    # Place the interactor initially. The input to a 3D widget is used to\n    # initially position and scale the widget. The EndInteractionEvent is\n    # observed which invokes the SelectPolygons callback.\n    #\n    boxWidget.SetProp3D(coneActor)\n    boxWidget.PlaceWidget()\n    callback = vtkMyCallback()\n    boxWidget.AddObserver('InteractionEvent', callback)\n\n    #\n    # Normally the user presses the 'i' key to bring a 3D widget to life. Here\n    # we will manually enable it so it appears with the cone.\n    #\n    boxWidget.On()\n\n    #\n    # Start the event loop.\n    #\n    iren.Initialize()\n    iren.Start()\n\n\nclass vtkMyCallback(object):\n    \"\"\"\n    Callback for the interaction.\n    \"\"\"\n\n    def __call__(self, caller, ev):\n        t = vtkTransform()\n        widget = caller\n        widget.GetTransform(t)\n        widget.GetProp3D().SetUserTransform(t)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane/","title":"ClipUnstructuredGridWithPlane","text":"

vtk-examples/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane

"},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane/#description","title":"Description","text":"

The example uses vtkTableBasedClipDataSet to clip a vtkUnstructuredGrid. The resulting output and clipped output are presented in yellow and red respectively. To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each output about their centers.

Note that unlike other clipping filters (except for vtkClipPolyData), vtkTableBasedClipDataSet retains the original cells if they are not clipped.

After exiting, the example reports the number of each cell type for each output:

The inside dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 26116 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3751 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 17361 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 628 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 4376 times.\nThe clipped dataset contains a \n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 25655 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3715 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 16984 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 616 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 4340 times.\n

Compare these results with ClipUnstructuredGridWithPlane2 (C++), ClipUnstructuredGridWithPlane2 (Python). Also, the resulting vtkUnstructuredGrid's has 1/4 the number of cells.

usage

ClipUnstructuredGridWithPlane treemesh.vtk

thanks

Thanks to Bane Sullivan for sharing the treemesh.vtk unstructured grid dataset.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane/#code","title":"Code","text":"

ClipUnstructuredGridWithPlane.py

#!/usr/bin/env python\n\nimport collections\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellTypes,\n    vtkPlane\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTableBasedClipDataSet\nfrom vtkmodules.vtkIOLegacy import vtkUnstructuredGridReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Use a vtkTableBasedClipDataSet to clip a vtkUnstructuredGrid.'\n    epilogue = '''\n Use a vtkTableBasedClipDataSet to clip a vtkUnstructuredGrid.\n The resulting output and clipped output are presented in yellow and red respectively.\n To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each\n    output about their centers.\n Note: This clipping filter does retain the original cells if they are not clipped.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='treemesh.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filename = get_program_parameters()\n\n    # Create the reader for the data.\n    reader = vtkUnstructuredGridReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    bounds = reader.GetOutput().GetBounds()\n    center = reader.GetOutput().GetCenter()\n\n    colors = vtkNamedColors()\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renderer.UseHiddenLineRemovalOn()\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    xnorm = [-1.0, -1.0, 1.0]\n\n    clipPlane = vtkPlane()\n    clipPlane.SetOrigin(reader.GetOutput().GetCenter())\n    clipPlane.SetNormal(xnorm)\n\n    clipper = vtkTableBasedClipDataSet()\n    clipper.SetClipFunction(clipPlane)\n    clipper.SetInputData(reader.GetOutput())\n    clipper.SetValue(0.0)\n    clipper.GenerateClippedOutputOn()\n    clipper.Update()\n\n    insideMapper = vtkDataSetMapper()\n    insideMapper.SetInputData(clipper.GetOutput())\n    insideMapper.ScalarVisibilityOff()\n\n    insideActor = vtkActor()\n    insideActor.SetMapper(insideMapper)\n    insideActor.GetProperty().SetDiffuseColor(colors.GetColor3d('banana'))\n    insideActor.GetProperty().SetAmbient(.3)\n    insideActor.GetProperty().EdgeVisibilityOn()\n\n    clippedMapper = vtkDataSetMapper()\n    clippedMapper.SetInputData(clipper.GetClippedOutput())\n    clippedMapper.ScalarVisibilityOff()\n\n    clippedActor = vtkActor()\n    clippedActor.SetMapper(clippedMapper)\n    clippedActor.GetProperty().SetDiffuseColor(colors.GetColor3d('tomato'))\n    insideActor.GetProperty().SetAmbient(.3)\n    clippedActor.GetProperty().EdgeVisibilityOn()\n\n    # Create transforms to make a better visualization\n    insideTransform = vtkTransform()\n    insideTransform.Translate(-(bounds[1] - bounds[0]) * 0.75, 0, 0)\n    insideTransform.Translate(center[0], center[1], center[2])\n    insideTransform.RotateY(-120.0)\n    insideTransform.Translate(-center[0], -center[1], -center[2])\n    insideActor.SetUserTransform(insideTransform)\n\n    clippedTransform = vtkTransform()\n    clippedTransform.Translate((bounds[1] - bounds[0]) * 0.75, 0, 0)\n    clippedTransform.Translate(center[0], center[1], center[2])\n    clippedTransform.RotateY(60.0)\n    clippedTransform.Translate(-center[0], -center[1], -center[2])\n    clippedActor.SetUserTransform(clippedTransform)\n\n    renderer.AddViewProp(clippedActor)\n    renderer.AddViewProp(insideActor)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Dolly(1.4)\n    renderer.ResetCameraClippingRange()\n    renderWindow.Render()\n    renderWindow.SetWindowName('ClipUnstructuredGridWithPlane')\n    renderWindow.Render()\n\n    interactor.Start()\n\n    # Generate a report\n    numberOfCells = clipper.GetOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The inside dataset contains a \\n', clipper.GetOutput().GetClassName(), ' that has ', numberOfCells, ' cells')\n    cellMap = dict()\n    for i in range(0, numberOfCells):\n        cellMap.setdefault(clipper.GetOutput().GetCellType(i), 0)\n        cellMap[clipper.GetOutput().GetCellType(i)] += 1\n    # Sort by key and put into an OrderedDict.\n    # An OrderedDict remembers the order in which the keys have been inserted.\n    for k, v in collections.OrderedDict(sorted(cellMap.items())).items():\n        print('\\tCell type ', vtkCellTypes.GetClassNameFromTypeId(k), ' occurs ', v, ' times.')\n\n    numberOfCells = clipper.GetClippedOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The clipped dataset contains a \\n', clipper.GetClippedOutput().GetClassName(), ' that has ', numberOfCells,\n          ' cells')\n    outsideCellMap = dict()\n    for i in range(0, numberOfCells):\n        outsideCellMap.setdefault(clipper.GetClippedOutput().GetCellType(i), 0)\n        outsideCellMap[clipper.GetClippedOutput().GetCellType(i)] += 1\n    for k, v in collections.OrderedDict(sorted(outsideCellMap.items())).items():\n        print('\\tCell type ', vtkCellTypes.GetClassNameFromTypeId(k), ' occurs ', v, ' times.')\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2/","title":"ClipUnstructuredGridWithPlane2","text":"

vtk-examples/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2

"},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#description","title":"Description","text":"

The example uses vtkClipDataSet to clip a vtkUnstructuredGrid. The resulting output and clipped output are presented in yellow and red respectively. To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each output about their centers.

Note that this clipping filter does not retain the original cells if they are not clipped.

After exiting, the example reports the number of each cell type for each output:

The inside dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 110148 cells\n        Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 106998 times.\n        Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 3150 times.\nThe clipped dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 111824 cells\n        Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 107420 times.\n        Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 4404 times.\n

Compare these results with ClipUnstructuredGridWithPlane2 (C++), ClipUnstructuredGridWithPlane2 (Python). Notice that in this example, the original vtkHexahedron in the unclipped regions are converted to vtkTetra. Also, the resulting vtkUnstructuredGrid's have more than 4 times the number of cells.

usage

ClipUnstructuredGridWithPlane2 treemesh.vtk

thanks

Thanks to Bane Sullivan for sharing the treemesh.vtk unstructured grid dataset.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#code","title":"Code","text":"

ClipUnstructuredGridWithPlane2.py

#!/usr/bin/env python\n\nimport collections\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellTypes,\n    vtkPlane\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkClipDataSet\nfrom vtkmodules.vtkIOLegacy import vtkUnstructuredGridReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Use a vtkClipDataSet to clip a vtkUnstructuredGrid..'\n    epilogue = '''\n Use a vtkClipDataSet to clip a vtkUnstructuredGrid..\n The resulting output and clipped output are presented in yellow and red respectively.\n To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each\n    output about their centers.\n Note: This clipping filter does not retain the original cells if they are not clipped.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='treemesh.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filename = get_program_parameters()\n\n    # Create the reader for the data.\n    reader = vtkUnstructuredGridReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    bounds = reader.GetOutput().GetBounds()\n    center = reader.GetOutput().GetCenter()\n\n    colors = vtkNamedColors()\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renderer.UseHiddenLineRemovalOn()\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    xnorm = [-1.0, -1.0, 1.0]\n\n    clipPlane = vtkPlane()\n    clipPlane.SetOrigin(reader.GetOutput().GetCenter())\n    clipPlane.SetNormal(xnorm)\n\n    clipper = vtkClipDataSet()\n    clipper.SetClipFunction(clipPlane)\n    clipper.SetInputData(reader.GetOutput())\n    clipper.SetValue(0.0)\n    clipper.GenerateClippedOutputOn()\n    clipper.Update()\n\n    insideMapper = vtkDataSetMapper()\n    insideMapper.SetInputData(clipper.GetOutput())\n    insideMapper.ScalarVisibilityOff()\n\n    insideActor = vtkActor()\n    insideActor.SetMapper(insideMapper)\n    insideActor.GetProperty().SetDiffuseColor(colors.GetColor3d('banana'))\n    insideActor.GetProperty().SetAmbient(.3)\n    insideActor.GetProperty().EdgeVisibilityOn()\n\n    clippedMapper = vtkDataSetMapper()\n    clippedMapper.SetInputData(clipper.GetClippedOutput())\n    clippedMapper.ScalarVisibilityOff()\n\n    clippedActor = vtkActor()\n    clippedActor.SetMapper(clippedMapper)\n    clippedActor.GetProperty().SetDiffuseColor(colors.GetColor3d('tomato'))\n    insideActor.GetProperty().SetAmbient(.3)\n    clippedActor.GetProperty().EdgeVisibilityOn()\n\n    # Create transforms to make a better visualization\n    insideTransform = vtkTransform()\n    insideTransform.Translate(-(bounds[1] - bounds[0]) * 0.75, 0, 0)\n    insideTransform.Translate(center[0], center[1], center[2])\n    insideTransform.RotateY(-120.0)\n    insideTransform.Translate(-center[0], -center[1], -center[2])\n    insideActor.SetUserTransform(insideTransform)\n\n    clippedTransform = vtkTransform()\n    clippedTransform.Translate((bounds[1] - bounds[0]) * 0.75, 0, 0)\n    clippedTransform.Translate(center[0], center[1], center[2])\n    clippedTransform.RotateY(60.0)\n    clippedTransform.Translate(-center[0], -center[1], -center[2])\n    clippedActor.SetUserTransform(clippedTransform)\n\n    renderer.AddViewProp(clippedActor)\n    renderer.AddViewProp(insideActor)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Dolly(1.4)\n    renderer.ResetCameraClippingRange()\n    renderWindow.Render()\n    renderWindow.SetWindowName('ClipUnstructuredGridWithPlane2')\n    renderWindow.Render()\n\n    interactor.Start()\n\n    # Generate a report\n    numberOfCells = clipper.GetOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The inside dataset contains a \\n', clipper.GetOutput().GetClassName(), ' that has ', numberOfCells, ' cells')\n    cellMap = dict()\n    for i in range(0, numberOfCells):\n        cellMap.setdefault(clipper.GetOutput().GetCellType(i), 0)\n        cellMap[clipper.GetOutput().GetCellType(i)] += 1\n    # Sort by key and put into an OrderedDict.\n    # An OrderedDict remembers the order in which the keys have been inserted.\n    for k, v in collections.OrderedDict(sorted(cellMap.items())).items():\n        print('\\tCell type ', vtkCellTypes.GetClassNameFromTypeId(k), ' occurs ', v, ' times.')\n\n    numberOfCells = clipper.GetClippedOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The clipped dataset contains a \\n', clipper.GetClippedOutput().GetClassName(), ' that has ', numberOfCells,\n          ' cells')\n    outsideCellMap = dict()\n    for i in range(0, numberOfCells):\n        outsideCellMap.setdefault(clipper.GetClippedOutput().GetCellType(i), 0)\n        outsideCellMap[clipper.GetClippedOutput().GetCellType(i)] += 1\n    for k, v in collections.OrderedDict(sorted(outsideCellMap.items())).items():\n        print('\\tCell type ', vtkCellTypes.GetClassNameFromTypeId(k), ' occurs ', v, ' times.')\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/UnstructuredGrid/UGrid/","title":"UGrid","text":"

vtk-examples/Python/UnstructuredGrid/UGrid

"},{"location":"Python/UnstructuredGrid/UGrid/#description","title":"Description","text":"

Creation of an unstructured grid.

Info

See Figure 5-21 in Chapter 05 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/UnstructuredGrid/UGrid/#code","title":"Code","text":"

UGrid.py

#!/usr/bin/env python\n\n'''\nThis example shows how to create an unstructured grid.\n'''\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_HEXAHEDRON,\n    VTK_LINE,\n    VTK_POLYGON,\n    VTK_QUAD,\n    VTK_TETRA,\n    VTK_TRIANGLE,\n    VTK_TRIANGLE_STRIP,\n    VTK_VERTEX,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    x = [[0, 0, 0], [1, 0, 0], [2, 0, 0], [0, 1, 0], [1, 1, 0], [2, 1, 0], [0, 0, 1], [1, 0, 1], [2, 0, 1], [0, 1, 1],\n         [1, 1, 1], [2, 1, 1], [0, 1, 2], [1, 1, 2], [2, 1, 2], [0, 1, 3], [1, 1, 3], [2, 1, 3], [0, 1, 4], [1, 1, 4],\n         [2, 1, 4], [0, 1, 5], [1, 1, 5], [2, 1, 5], [0, 1, 6], [1, 1, 6], [2, 1, 6]]\n    # Here we have kept consistency with the Cxx example of the same name.\n    # This means we will use slicing in ugrid.InsertNextCell to ensure that the correct\n    #  number of points are used.\n    pts = [[0, 1, 4, 3, 6, 7, 10, 9], [1, 2, 5, 4, 7, 8, 11, 10], [6, 10, 9, 12, 0, 0, 0, 0],\n           [8, 11, 10, 14, 0, 0, 0, 0], [16, 17, 14, 13, 12, 15, 0, 0], [18, 15, 19, 16, 20, 17, 0, 0],\n           [22, 23, 20, 19, 0, 0, 0, 0], [21, 22, 18, 0, 0, 0, 0, 0], [22, 19, 18, 0, 0, 0, 0, 0],\n           [23, 26, 0, 0, 0, 0, 0, 0], [21, 24, 0, 0, 0, 0, 0, 0], [25, 0, 0, 0, 0, 0, 0, 0]]\n    print(len(x), len(pts))\n\n    renderer = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    points = vtkPoints()\n    for i in range(0, len(x)):\n        points.InsertPoint(i, x[i])\n\n    ugrid = vtkUnstructuredGrid()\n    ugrid.Allocate(100)\n    ugrid.InsertNextCell(VTK_HEXAHEDRON, 8, pts[0])\n    ugrid.InsertNextCell(VTK_HEXAHEDRON, 8, pts[1])\n    ugrid.InsertNextCell(VTK_TETRA, 4, pts[2][:4])\n    ugrid.InsertNextCell(VTK_TETRA, 4, pts[3][:4])\n    ugrid.InsertNextCell(VTK_POLYGON, 6, pts[4][:6])\n    ugrid.InsertNextCell(VTK_TRIANGLE_STRIP, 6, pts[5][:6])\n    ugrid.InsertNextCell(VTK_QUAD, 4, pts[6][:4])\n    ugrid.InsertNextCell(VTK_TRIANGLE, 3, pts[7][:3])\n    ugrid.InsertNextCell(VTK_TRIANGLE, 3, pts[8][:3])\n    ugrid.InsertNextCell(VTK_LINE, 2, pts[9][:2])\n    ugrid.InsertNextCell(VTK_LINE, 2, pts[10][:2])\n    ugrid.InsertNextCell(VTK_VERTEX, 1, pts[11][:1])\n\n    ugrid.SetPoints(points)\n\n    ugridMapper = vtkDataSetMapper()\n    ugridMapper.SetInputData(ugrid)\n\n    ugridActor = vtkActor()\n    ugridActor.SetMapper(ugridMapper)\n    ugridActor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n    ugridActor.GetProperty().EdgeVisibilityOn()\n\n    renderer.AddActor(ugridActor)\n    renderer.SetBackground(colors.GetColor3d('Beige'))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(60.0)\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.GetActiveCamera().Dolly(1.0)\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('UGrid')\n\n    # Interact with the data.\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/Animation/","title":"Animation","text":"

vtk-examples/Python/Utilities/Animation

"},{"location":"Python/Utilities/Animation/#description","title":"Description","text":"

This example demonstrates how to create a simple animation. A timer is used to move a sphere across a scene.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/Animation/#code","title":"Code","text":"

Animation.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\nclass vtkTimerCallback():\n    def __init__(self, steps, actor, iren):\n        self.timer_count = 0\n        self.steps = steps\n        self.actor = actor\n        self.iren = iren\n        self.timerId = None\n\n    def execute(self, obj, event):\n        step = 0\n        while step < self.steps:\n            print(self.timer_count)\n            self.actor.SetPosition(self.timer_count / 100.0, self.timer_count / 100.0, 0)\n            iren = obj\n            iren.GetRenderWindow().Render()\n            self.timer_count += 1\n            step += 1\n        if self.timerId:\n            iren.DestroyTimer(self.timerId)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(2)\n    sphereSource.SetPhiResolution(30)\n    sphereSource.SetThetaResolution(30)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphereSource.GetOutputPort())\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Peacock\"))\n    actor.GetProperty().SetSpecular(0.6)\n    actor.GetProperty().SetSpecularPower(30)\n    actor.SetMapper(mapper)\n    # actor.SetPosition(-5, -5, 0)\n\n    # Setup a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d(\"MistyRose\"))\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Animation\")\n    renderWindow.AddRenderer(renderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n\n    # Render and interact\n    renderWindow.Render()\n    renderer.GetActiveCamera().Zoom(0.8)\n    renderWindow.Render()\n\n    # Initialize must be called prior to creating timer events.\n    renderWindowInteractor.Initialize()\n\n    # Sign up to receive TimerEvent\n    cb = vtkTimerCallback(200, actor, renderWindowInteractor)\n    renderWindowInteractor.AddObserver('TimerEvent', cb.execute)\n    cb.timerId = renderWindowInteractor.CreateRepeatingTimer(500)\n\n    # start the interaction and timer\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/CheckVTKVersion/","title":"CheckVTKVersion","text":"

vtk-examples/Python/Utilities/CheckVTKVersion

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/CheckVTKVersion/#code","title":"Code","text":"

CheckVTKVersion.py

#!/usr/bin/env python3\n\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) \\\n                     + 100000000 * int(minor) \\\n                     + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:\n        # Expand component-wise comparisons for VTK versions < 8.90.\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() \\\n                             + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef main():\n    print('VTK Version:',vtkVersion.GetVTKVersion())\n    if not vtk_version_ok(9, 0, 0):\n        print('You need VTK version 9.0.0 or greater to run this program.')\n        return\n\n    test_versions = ((9, 2, 20220831), (9, 19, 0))\n    for ver in test_versions:\n        if vtk_version_ok(*ver):\n            print('This code works for VTK Versions >=', '.'.join(map(str, ver)))\n        else:\n            print('You need VTK Version', '.'.join(map(str, ver)), 'or greater.')\n    print()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/ColorMapToLUT/","title":"ColorMapToLUT","text":"

vtk-examples/Python/Utilities/ColorMapToLUT

"},{"location":"Python/Utilities/ColorMapToLUT/#description","title":"Description","text":"

Demonstrate a cone using the vtkDiscretizableColorTransferFunction to generate the colormap.

These two Python functions can be used to generate C++ and Python functions from a JSON or XML colormap. They can then be copied into ColorMapToLUT.cxx, ColorMapToLUT.py or into your own code.

  • ColorMapToLUT_XML
  • ColorMapToLUT_JSON

Feel free to use either of these programs to generate different colormaps until you find one you like.

A good initial source for color maps is: SciVisColor -- this will provide you with plenty of XML examples.

ColorMapToLUT_JSON will allow you to select colormaps by name from ParaView Default Colormaps.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/ColorMapToLUT/#code","title":"Code","text":"

ColorMapToLUT.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource, vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDiscretizableColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    colors.SetColor('ParaViewBkg', 82, 87, 110, 255)\n\n    ren = vtkRenderer()\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('ColorMapToLUT')\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(64)\n    sphere.SetPhiResolution(32)\n\n    cone = vtkConeSource()\n    cone.SetResolution(6)\n    cone.SetDirection(0, 1, 0)\n    cone.SetHeight(1)\n    cone.Update()\n    bounds = cone.GetOutput().GetBounds()\n\n    elevation_filter = vtkElevationFilter()\n    elevation_filter.SetLowPoint(0, bounds[2], 0)\n    elevation_filter.SetHighPoint(0, bounds[3], 0)\n    elevation_filter.SetInputConnection(cone.GetOutputPort())\n    # elevation_filter.SetInputConnection(sphere.GetOutputPort())\n\n    ctf = get_ctf()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(elevation_filter.GetOutputPort())\n    mapper.SetLookupTable(ctf)\n    mapper.SetColorModeToMapScalars()\n    mapper.InterpolateScalarsBeforeMappingOn()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    ren.AddActor(actor)\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_ctf():\n    # name: Fast, creator: Francesca Samsel and Alan W. Scott\n    # interpolationspace: RGB, space: rgb\n    # file name: Fast.json\n\n    ctf = vtkDiscretizableColorTransferFunction()\n\n    ctf.SetColorSpaceToRGB()\n    ctf.SetScaleToLinear()\n\n    ctf.SetNanColor(0.0, 0.0, 0.0)\n\n    ctf.AddRGBPoint(0, 0.05639999999999999, 0.05639999999999999, 0.47)\n    ctf.AddRGBPoint(0.17159223942480895, 0.24300000000000013, 0.4603500000000004, 0.81)\n    ctf.AddRGBPoint(0.2984914818394138, 0.3568143826543521, 0.7450246485363142, 0.954367702893722)\n    ctf.AddRGBPoint(0.4321287371255907, 0.6882, 0.93, 0.9179099999999999)\n    ctf.AddRGBPoint(0.5, 0.8994959551205902, 0.944646394975174, 0.7686567142818399)\n    ctf.AddRGBPoint(0.5882260353170073, 0.957107977357604, 0.8338185108985666, 0.5089156299842102)\n    ctf.AddRGBPoint(0.7061412605695164, 0.9275207599610714, 0.6214389091739178, 0.31535705838676426)\n    ctf.AddRGBPoint(0.8476395308725272, 0.8, 0.3520000000000001, 0.15999999999999998)\n    ctf.AddRGBPoint(1, 0.59, 0.07670000000000013, 0.11947499999999994)\n\n    ctf.SetNumberOfValues(9)\n    ctf.DiscretizeOff()\n\n    return ctf\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/ColorMapToLUT_JSON/","title":"ColorMapToLUT JSON","text":"

vtk-examples/Python/Utilities/ColorMapToLUT_JSON

"},{"location":"Python/Utilities/ColorMapToLUT_JSON/#description","title":"Description","text":"

Generate a VTK colormap from a ParaView JSON description of a colormap.

This script will let you choose a colormap by name from ParaView Default Colormaps.

A cone is rendered to demonstrate the resultant colormap.

C++ and Python functions can also be generated which implement the colormap. You can copy/paste these directly into your code. Or they can replace the existing function in:

  • ColorMapToLUT.py
  • ColorMapToLUT.cxx

This program was inspired by this discussion: Replacement default color map and background palette, the Fast colormap from this discussion is used as test data here.

A good initial source for color maps is: SciVisColor -- this will provide you with plenty of XML examples.

Further information:

  • VTK Examples - Some ColorMap to LookupTable tools
  • How to export ParaView colormap into a format that could be read by matplotlib
  • How to export ParaView colormap into a format that could be read by matplotlib?
  • Color map advice and resources

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/ColorMapToLUT_JSON/#code","title":"Code","text":"

ColorMapToLUT_JSON.py

#!/usr/bin/env python3\n\nimport json\nimport sys\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource, vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkDiscretizableColorTransferFunction\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Take a JSON description of a colormap and convert it to a VTK colormap.'\n    epilogue = '''\n    A color transfer function in C++ or Python can be optionally generated.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    parser.add_argument('file_name', help='The path to the JSONL file e.g Fast.xml.')\n    parser.add_argument('-d', action='store_true', dest='discretize', help='Discretize the colormap.')\n    parser.add_argument('-n', dest='name', default=None, type=str,\n                        help='Specify the name of the colormap,'\n                             ' needed if there is more than one colormap in the JSON file.')\n    parser.add_argument('-s', dest='size', default=None, type=int,\n                        help='Specify the size of the colormap.')\n    parser.add_argument('-g', dest='generate_function', default=None,\n                        help='Generate code for the color transfer function,'\n                             ' specify the desired language one of: Cxx, Python.')\n\n    args = parser.parse_args()\n    return args.file_name, args.discretize, args.name, args.size, args.generate_function\n\n\ndef main(file_name, discretize, colormap_name, table_size, generate_function):\n    if file_name:\n        fn_path = Path(file_name)\n        if not fn_path.suffix:\n            fn_path = fn_path.with_suffix(\".json\")\n        if not fn_path.is_file():\n            print('Unable to find: ', fn_path)\n            return\n    else:\n        print('Please enter a path to the JSON file.')\n        return\n    parameters = parse_json(fn_path)\n    if len(parameters) == 0:\n        print('No named colormaps found.')\n        return\n    if len(parameters) == 1:\n        colormap_name = list(parameters.keys())[0]\n    else:\n        names = list(parameters.keys())\n        if len(parameters) > 1 and colormap_name is None:\n            print(f'A colormap name is required, choose one of:\\n{layout(sorted(names), order=\"row\")}')\n            return\n        if colormap_name not in names:\n            print(f'Unknown colormap name {colormap_name}, choose one of:\\n{layout(sorted(names), order=\"row\")}')\n            return\n\n    if generate_function is not None:\n        generate_function = generate_function.lower()\n        available_languages = {k.lower(): k for k in ['Cxx', 'Python']}\n        available_languages.update({'cpp': 'Cxx', 'c++': 'Cxx', 'py': 'Python'})\n        if generate_function not in available_languages:\n            print(f'The language: {generate_function} is not available.')\n            tmp = ', '.join(sorted([lang for lang in set(available_languages.values())]))\n            print(f'Choose one of these: {tmp}.')\n            return\n        else:\n            language = available_languages[generate_function]\n    else:\n        language = None\n\n    ctf = make_ctf(parameters[colormap_name], discretize, table_size)\n\n    # Generate code for Python or C++ if needed.\n    if language is not None and language in ['Cxx', 'Python']:\n        if language == 'Python':\n            generate_ctf_python(parameters[colormap_name], discretize, table_size)\n        else:\n            generate_ctf_cpp(parameters[colormap_name], discretize, table_size)\n\n    colors = vtkNamedColors()\n    colors.SetColor('ParaViewBkg', 82, 87, 110, 255)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(64)\n    sphere.SetPhiResolution(32)\n    sphere.SetRadius(0.5)\n    sphere.Update()\n\n    cone = vtkConeSource()\n    cone.SetResolution(6)\n    cone.SetDirection(0, 1, 0)\n    cone.SetHeight(1)\n    cone.Update()\n\n    # bounds = sphere.GetOutput().GetBounds()\n    bounds = cone.GetOutput().GetBounds()\n\n    elevation_filter = vtkElevationFilter()\n    elevation_filter.SetLowPoint(0, bounds[2], 0)\n    elevation_filter.SetHighPoint(0, bounds[3], 0)\n    # elevation_filter.SetInputConnection(sphere.GetOutputPort())\n    elevation_filter.SetInputConnection(cone.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(elevation_filter.GetOutputPort())\n    mapper.SetLookupTable(ctf)\n    mapper.SetColorModeToMapScalars()\n    mapper.InterpolateScalarsBeforeMappingOn()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Visualize\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('ColorMapToLUT_JSON')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef parse_json(fn_path):\n    \"\"\"\n    Parse the exported ParaView JSON file of a colormap.\n    :param fn_path: The path to the JSON file.\n    :return: A dict of colormaps indexed by name.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n\n    def extract(d):\n        \"\"\"\n        Pull out the data we need.\n\n        :param d: The parsed JSON data.\n        :return: The extracted data.\n        \"\"\"\n        data_values = list()\n        color_values = list()\n        opacity_values = list()\n        color_map_details = dict()\n        nan = None\n        above = None\n        below = None\n        for k, v in d.items():\n            if 'Points' in k:\n                n = 4\n                data_color = [v[i * n:(i + 1) * n] for i in range((len(v) + n - 1) // n)]\n                for dc in data_color:\n                    if len(dc) == 4:\n                        data_values.append(dc[0])\n                        color_values.append(tuple(dc[1:]))\n                if 'hsv' in k.lower():\n                    color_map_details['space'] = 'hsv'\n                else:\n                    color_map_details['space'] = 'rgb'\n\n            if k == 'ColorSpace':\n                color_map_details['interpolationspace'] = v\n            if k == 'Creator':\n                color_map_details['creator'] = v\n            if k == 'Name':\n                color_map_details['name'] = v\n            if k == 'NanColor':\n                nan = tuple(v[0:3])\n        return {'color_map_details': color_map_details, 'data_values': data_values,\n                'color_values': color_values, 'opacity_values': opacity_values, 'NaN': nan, 'Above': above,\n                'Below': below}\n\n    res = dict()\n    for jd in json_data:\n        if 'ColorSpace' in jd:\n            parameters = extract(jd)\n            parameters['path'] = fn_path.name\n            cm_name = parameters['color_map_details']['name']\n            # Do some checks.\n            if cm_name is not None:\n                if len(parameters['data_values']) != len(parameters['color_values']):\n                    sys.exit(f'{parameters[\"path\"]}: The data values length must be the same as colors.')\n                if len(parameters['opacity_values']) > 0:\n                    if len(parameters['opacity_values']) != len(parameters['color_values']):\n                        sys.exit(f'{parameters[\"path\"]}: The opacity values length must be the same as colors.')\n                res[cm_name] = parameters\n    return res\n\n\ndef layout(targets, columns=None, width=120, order='column'):\n    \"\"\"\n    Layout a sorted list of targets into columns.\n\n    :param targets: A list of targets.\n    :param columns: The number of columns, if None, then the width is used.\n    :param width: Width of the page, used if the number of columns is zero or None.\n    :param order: Ordering either by row or column (default).\n    :return A list of lists of available targets.\n    \"\"\"\n\n    order = order.lower()\n    if order not in ['row', 'column']:\n        print('The order must be either row or column, row is the default.')\n        return\n\n    def fmt_v(v):\n        return f'{v:<{max_len}s}'\n\n    max_len = max(map(len, targets))\n    # Split into rows.\n    if columns:\n        number_of_columns = columns\n    else:\n        number_of_columns = width // max_len\n    step_size = divmod(len(targets), number_of_columns)\n    step = step_size[0]\n    if step_size[1] != 0:\n        step += 1\n    if order == 'row':\n        rows = [targets[i:i + number_of_columns] for i in range(0, len(targets), number_of_columns)]\n    else:\n        rows = list()\n        for i in range(step):\n            row = list()\n            for j in range(number_of_columns):\n                idx = j * step + i\n                if idx < len(targets):\n                    row.append(targets[idx])\n            rows.append(row)\n    res = list()\n    for row in rows:\n        res.append(' '.join(map(fmt_v, row)))\n    return '\\n'.join(res)\n\n\ndef make_ctf(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate the discretizable color transfer function\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n\n    ctf = vtkDiscretizableColorTransferFunction()\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            ctf.SetColorSpaceToHSV()\n        elif interp_space == 'lab':\n            ctf.SetColorSpaceToLab()\n        elif interp_space == 'cielab':\n            ctf.SetColorSpaceToLab()\n        elif interp_space == 'ciede2000':\n            ctf.SetColorSpaceToLabCIEDE2000()\n        elif interp_space == 'diverging':\n            ctf.SetColorSpaceToDiverging()\n        elif interp_space == 'step':\n            ctf.SetColorSpaceToStep()\n        else:\n            ctf.SetColorSpaceToRGB()\n    else:\n        ctf.SetColorSpaceToRGB()\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            ctf.SetScaleToLog10()\n        else:\n            ctf.SetScaleToLinear()\n    else:\n        ctf.SetScaleToLinear()\n\n    if parameters['NaN'] is not None:\n        ctf.SetNanColor(*parameters['NaN'])\n\n    if parameters['Above'] is not None:\n        ctf.SetAboveRangeColor(*parameters['Above'])\n        ctf.UseAboveRangeColorOn()\n\n    if parameters['Below'] is not None:\n        ctf.SetBelowRangeColor(*parameters['Below'])\n        ctf.UseBelowRangeColorOn()\n\n    space = parameters['color_map_details']['space'].lower()\n    ctf_sz = len(parameters[\"data_values\"])\n    for i in range(0, ctf_sz):\n        idx = parameters['data_values'][i]\n        rgb = parameters['color_values'][i]\n        if space == 'hsv':\n            ctf.AddHSVPoint(idx, *rgb)\n        else:\n            ctf.AddRGBPoint(idx, *rgb)\n\n    if table_size is not None:\n        ctf.SetNumberOfValues(max(table_size, ctf_sz))\n    else:\n        ctf.SetNumberOfValues(ctf_sz)\n\n    if discretize:\n        ctf.DiscretizeOn()\n    else:\n        ctf.DiscretizeOff()\n\n    return ctf\n\n\ndef generate_ctf_python(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate a function for the ctf.\n\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n    indent = ' ' * 4\n\n    comment = f'{indent}#'\n    if 'name' in parameters['color_map_details']:\n        comment += f' name: {parameters[\"color_map_details\"][\"name\"]},'\n    if 'creator' in parameters['color_map_details']:\n        comment += f' creator: {parameters[\"color_map_details\"][\"creator\"]}'\n    if 'interpolationspace' in parameters['color_map_details']:\n        comment += f'\\n{indent}# interpolationspace: {parameters[\"color_map_details\"][\"interpolationspace\"]},'\n    if 'interpolationtype' in parameters['color_map_details']:\n        comment += f' interpolationtype: {parameters[\"color_map_details\"][\"interpolationtype\"]},'\n    if 'space' in parameters['color_map_details']:\n        comment += f' space: {parameters[\"color_map_details\"][\"space\"]}'\n    comment += f'\\n{indent}# file name: {parameters[\"path\"]}\\n'\n\n    s = ['', f'def get_ctf():', comment, f'{indent}ctf = vtkDiscretizableColorTransferFunction()', '']\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            s.append(f'{indent}ctf.SetColorSpaceToHSV()')\n        elif interp_space == 'lab':\n            s.append(f'{indent}ctf.SetColorSpaceToLab()')\n        elif interp_space == 'cielab':\n            s.append(f'{indent}ctf.SetColorSpaceToLab()')\n        elif interp_space == 'ciede2000':\n            s.append(f'{indent}ctf.SetColorSpaceToLabCIEDE2000()')\n        elif interp_space == 'diverging':\n            s.append(f'{indent}ctf.SetColorSpaceToDiverging()')\n        elif interp_space == 'step':\n            s.append(f'{indent}ctf.SetColorSpaceToStep()')\n        else:\n            s.append(f'{indent}ctf.SetColorSpaceToRGB()')\n    else:\n        s.append(f'{indent}ctf.SetColorSpaceToRGB()')\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            s.append(f'{indent}ctf.SetScaleToLog10()')\n        else:\n            s.append(f'{indent}ctf.SetScaleToLinear()')\n    else:\n        s.append(f'{indent}ctf.SetScaleToLinear()')\n    s.append('')\n\n    if parameters['NaN'] is not None:\n        color = ', '.join(list(map(str, parameters['NaN'])))\n        s.append(f'{indent}ctf.SetNanColor({color})')\n\n    if parameters['Above'] is not None:\n        color = ', '.join(list(map(str, parameters['Above'])))\n        s.append(f'{indent}ctf.SetAboveRangeColor({color})')\n        s.append(f'{indent}ctf.UseAboveRangeColorOn()')\n\n    if parameters['Below'] is not None:\n        color = ', '.join(list(map(str, parameters['Below'])))\n        s.append(f'{indent}ctf.SetBelowRangeColor({color})')\n        s.append(f'{indent}ctf.UseBelowRangeColorOn()')\n    s.append('')\n\n    space = parameters['color_map_details']['space'].lower()\n    ctf_sz = len(parameters[\"data_values\"])\n    for i in range(0, ctf_sz):\n        rgb = ', '.join(list(map(str, parameters['color_values'][i])))\n        idx = parameters['data_values'][i]\n        if space == 'hsv':\n            s.append(f'{indent}ctf.AddHSVPoint({idx}, {rgb})')\n        else:\n            s.append(f'{indent}ctf.AddRGBPoint({idx}, {rgb})')\n    s.append('')\n\n    if table_size is not None:\n        s.append(f'{indent}ctf.SetNumberOfValues({max(table_size, ctf_sz)})')\n    else:\n        s.append(f'{indent}ctf.SetNumberOfValues({ctf_sz})')\n\n    if discretize:\n        s.append(f'{indent}ctf.DiscretizeOn()')\n    else:\n        s.append(f'{indent}ctf.DiscretizeOff()')\n    s.append('')\n\n    s.append(f'{indent}return ctf')\n    s.append('')\n\n    print('\\n'.join(s))\n\n\ndef generate_ctf_cpp(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate a function for the ctf.\n\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n    indent = ' ' * 2\n\n    comment = f'{indent}//'\n    if 'name' in parameters['color_map_details']:\n        comment += f' name: {parameters[\"color_map_details\"][\"name\"]},'\n    if 'creator' in parameters['color_map_details']:\n        comment += f' creator: {parameters[\"color_map_details\"][\"creator\"]}'\n    if 'interpolationspace' in parameters['color_map_details']:\n        comment += f'\\n{indent}// interpolationspace: {parameters[\"color_map_details\"][\"interpolationspace\"]},'\n    if 'interpolationtype' in parameters['color_map_details']:\n        comment += f' interpolationtype: {parameters[\"color_map_details\"][\"interpolationtype\"]},'\n    if 'space' in parameters['color_map_details']:\n        comment += f' space: {parameters[\"color_map_details\"][\"space\"]}'\n    comment += f'\\n{indent}// file name: {parameters[\"path\"]}\\n'\n\n    s = ['', f'vtkNew<vtkDiscretizableColorTransferFunction> GetCTF()', '{', comment,\n         f'{indent}vtkNew<vtkDiscretizableColorTransferFunction> ctf;', '']\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            s.append(f'{indent}ctf->SetColorSpaceToHSV();')\n        elif interp_space == 'lab':\n            s.append(f'{indent}ctf->SetColorSpaceToLab();')\n        elif interp_space == 'cielab':\n            s.append(f'{indent}ctf->SetColorSpaceToLab();')\n        elif interp_space == 'ciede2000':\n            s.append(f'{indent}ctf->SetColorSpaceToLabCIEDE2000();')\n        elif interp_space == 'diverging':\n            s.append(f'{indent}ctf->SetColorSpaceToDiverging();')\n        elif interp_space == 'step':\n            s.append(f'{indent}ctf->SetColorSpaceToStep();')\n        else:\n            s.append(f'{indent}ctf->SetColorSpaceToRGB();')\n    else:\n        s.append(f'{indent}ctf->SetColorSpaceToRGB();')\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            s.append(f'{indent}ctf->SetScaleToLog10();')\n        else:\n            s.append(f'{indent}ctf->SetScaleToLinear();')\n    else:\n        s.append(f'{indent}ctf->SetScaleToLinear();')\n    s.append('')\n\n    if parameters['NaN'] is not None:\n        color = ', '.join(list(map(str, parameters['NaN'])))\n        s.append(f'{indent}ctf->SetNanColor({color});')\n\n    if parameters['Above'] is not None:\n        color = ', '.join(list(map(str, parameters['Above'])))\n        s.append(f'{indent}ctf->SetAboveRangeColor({color});')\n        s.append(f'{indent}ctf->UseAboveRangeColorOn();')\n\n    if parameters['Below'] is not None:\n        color = ', '.join(list(map(str, parameters['Below'])))\n        s.append(f'{indent}ctf->SetBelowRangeColor({color});')\n        s.append(f'{indent}ctf->UseBelowRangeColorOn();')\n    s.append('')\n\n    space = parameters['color_map_details']['space'].lower()\n    ctf_sz = len(parameters[\"data_values\"])\n    for i in range(0, ctf_sz):\n        rgb = ', '.join(list(map(str, parameters['color_values'][i])))\n        idx = parameters['data_values'][i]\n        if space == 'hsv':\n            s.append(f'{indent}ctf->AddHSVPoint({idx}, {rgb});')\n        else:\n            s.append(f'{indent}ctf->AddRGBPoint({idx}, {rgb});')\n    s.append('')\n\n    if table_size is not None:\n        s.append(f'{indent}ctf->SetNumberOfValues({max(table_size, ctf_sz)});')\n    else:\n        s.append(f'{indent}ctf->SetNumberOfValues({ctf_sz});')\n\n    if discretize:\n        s.append(f'{indent}ctf->DiscretizeOn();')\n    else:\n        s.append(f'{indent}ctf->DiscretizeOff();')\n    s.append('')\n\n    s.append(f'{indent}return ctf;')\n    s.append('}')\n    s.append('')\n\n    print('\\n'.join(s))\n\n\nif __name__ == '__main__':\n    file, discretise, name, size, generate = get_program_parameters(sys.argv)\n    main(file, discretise, name, size, generate)\n
"},{"location":"Python/Utilities/ColorMapToLUT_XML/","title":"ColorMapToLUT XML","text":"

vtk-examples/Python/Utilities/ColorMapToLUT_XML

"},{"location":"Python/Utilities/ColorMapToLUT_XML/#description","title":"Description","text":"

Generate a VTK colormap from an XML description of a colormap.

A cone is rendered to demonstrate the resultant colormap.

C++ and Python functions can also be generated which implement the colormap. You can copy/paste these directly into your code. Or they can replace the existing function in:

  • ColorMapToLUT.py
  • ColorMapToLUT.cxx

This program was inspired by this discussion: Replacement default color map and background palette, and, the Fast colormap from this discussion is used as test data here.

A good initial source for color maps is: SciVisColor -- this will provide you with plenty of XML examples.

Note:

  • The XML parser is lxml
  • Currently, the parsing only works for XML colormaps with no Section key.

Further information:

  • VTK Examples - Some ColorMap to LookupTable tools
  • Color maps and transfer functions
  • How to export ParaView colormap into a format that could be read by matplotlib
  • How to export ParaView colormap into a format that could be read by matplotlib?
  • Color map advice and resources
  • ParaView Default Colormaps will provide you with lots of colormaps.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/ColorMapToLUT_XML/#code","title":"Code","text":"

ColorMapToLUT_XML.py

#!/usr/bin/env python3\n\nimport sys\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom lxml import etree\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource, vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkDiscretizableColorTransferFunction,\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Take an XML description of a colormap and convert it to a VTK colormap.'\n    epilogue = '''\n    A color transfer function in C++ or Python can be optionally generated.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    parser.add_argument('file_name', help='The path to the XML file e.g Fast.xml.')\n    parser.add_argument('-d', action='store_true', dest='discretize', help='Discretize the colormap.')\n    parser.add_argument('-s', dest='size', default=None, type=int,\n                        help='Specify the size of the colormap.')\n    parser.add_argument('-g', dest='generate_function', default=None,\n                        help='Generate code for the color transfer function,'\n                             ' specify the desired language one of: Cxx, Python.')\n\n    args = parser.parse_args()\n    return args.file_name, args.discretize, args.size, args.generate_function\n\n\ndef main(file_name, discretize, table_size, generate_function):\n    if file_name:\n        fn_path = Path(file_name)\n        if not fn_path.suffix:\n            fn_path = fn_path.with_suffix(\".xml\")\n        if not fn_path.is_file():\n            print('Unable to find: ', fn_path)\n            return\n    else:\n        print('Please enter a path to the XML file.')\n        return\n    parameters = parse_xml(fn_path)\n\n    if generate_function is not None:\n        generate_function = generate_function.lower()\n        available_languages = {k.lower(): k for k in ['Cxx', 'Python']}\n        available_languages.update({'cpp': 'Cxx', 'c++': 'Cxx', 'py': 'Python'})\n        if generate_function not in available_languages:\n            print(f'The language: {generate_function} is not available.')\n            tmp = ', '.join(sorted([lang for lang in set(available_languages.values())]))\n            print(f'Choose one of these: {tmp}.')\n            return\n        else:\n            language = available_languages[generate_function]\n    else:\n        language = None\n\n    # There is just one entry in the parameters dict.\n    colormap_name = list(parameters.keys())[0]\n    ctf = make_ctf(parameters[colormap_name], discretize, table_size)\n\n    if language is not None and language in ['Cxx', 'Python']:\n        if language == 'Python':\n            generate_ctf_python(parameters[colormap_name], discretize, table_size)\n        else:\n            generate_ctf_cpp(parameters[colormap_name], discretize, table_size)\n\n    colors = vtkNamedColors()\n    colors.SetColor('ParaViewBkg', 82, 87, 110, 255)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(64)\n    sphere.SetPhiResolution(32)\n\n    cone = vtkConeSource()\n    cone.SetResolution(6)\n    cone.SetDirection(0, 1, 0)\n    cone.SetHeight(1)\n    cone.Update()\n\n    # bounds = sphere.GetOutput().GetBounds()\n    bounds = cone.GetOutput().GetBounds()\n\n    elevation_filter = vtkElevationFilter()\n    elevation_filter.SetLowPoint(0, bounds[2], 0)\n    elevation_filter.SetHighPoint(0, bounds[3], 0)\n    # elevation_filter.SetInputConnection(sphere.GetOutputPort())\n    elevation_filter.SetInputConnection(cone.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(elevation_filter.GetOutputPort())\n    mapper.SetLookupTable(ctf)\n    mapper.SetColorModeToMapScalars()\n    mapper.InterpolateScalarsBeforeMappingOn()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Visualize\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('ColorMapToLUT_XML')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef parse_xml(fn_path):\n    \"\"\"\n    Parse the XML file of a colormap.\n\n    Check out: https://sciviscolor.org/colormaps/ for some good XML files.\n    :param fn_path: The path to the XML file.\n    :return: The parameters for the color map.\n    \"\"\"\n    with open(fn_path) as data_file:\n        xml_doc = etree.parse(data_file)\n\n    def extract(d):\n        \"\"\"\n        Pull out the data we need.\n\n        :param d: The parsed XML data.\n        :return: The extracted data.\n        \"\"\"\n        color_map_details = dict()\n        data_values = list()\n        color_values = list()\n        opacity_values = list()\n        nan = None\n        above = None\n        below = None\n        if d is not None:\n            color_map_details = dict(d.attrib)\n            if 'space' in color_map_details:\n                # Some XML files use space instead of interpolation space.\n                if color_map_details['space'].lower() not in ['rgb', 'hsv']:\n                    color_map_details['interpolationspace'] = color_map_details['space']\n                    # Assume RGB\n                    color_map_details['space'] = 'RGB'\n        for pt in d.findall('.//Point'):\n            # \"o\" is opacity it (along with \"cms\" and \"isMoT\") are ignored.\n            # \"x\" is the scalar value associated with the color (specified by \"r\", \"g\", and \"b\").\n            data_values.append(pt.attrib['x'])\n            color_values.append((pt.attrib['r'], pt.attrib['g'], pt.attrib['b']))\n            if pt.attrib['o']:\n                opacity_values.append(pt.attrib['o'])\n        val = d.find('.//NaN')\n        if val is not None:\n            nan = (val.attrib['r'], val.attrib['g'], val.attrib['b'])\n        val = d.find('.//Above')\n        if val is not None:\n            above = (val.attrib['r'], val.attrib['g'], val.attrib['b'])\n        val = d.find('.//Below')\n        if val is not None:\n            below = (val.attrib['r'], val.attrib['g'], val.attrib['b'])\n        return {'color_map_details': color_map_details, 'data_values': data_values,\n                'color_values': color_values, 'opacity_values': opacity_values, 'NaN': nan, 'Above': above,\n                'Below': below}\n\n    s = xml_doc.getroot().find('ColorMap')\n    if s is None:\n        sys.exit('The attribute \"ColorMap\" is not found.')\n    res = dict()\n    parameters = extract(s)\n    parameters['path'] = fn_path.name\n    cm_name = parameters['color_map_details']['name']\n    # Do some checks.\n    if cm_name is not None:\n        if len(parameters['data_values']) != len(parameters['color_values']):\n            sys.exit(f'{parameters[\"path\"]}: The data values length must be the same as colors.')\n        if len(parameters['opacity_values']) > 0:\n            if len(parameters['opacity_values']) != len(parameters['color_values']):\n                sys.exit(f'{parameters[\"path\"]}: The opacity values length must be the same as colors.')\n        res[cm_name] = parameters\n    return res\n\n\ndef make_ctf(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate the discretizable color transfer function\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n\n    ctf = vtkDiscretizableColorTransferFunction()\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            ctf.SetColorSpaceToHSV()\n        elif interp_space == 'lab':\n            ctf.SetColorSpaceToLab()\n        elif interp_space == 'cielab':\n            ctf.SetColorSpaceToLab()\n        elif interp_space == 'ciede2000':\n            ctf.SetColorSpaceToLabCIEDE2000()\n        elif interp_space == 'diverging':\n            ctf.SetColorSpaceToDiverging()\n        elif interp_space == 'step':\n            ctf.SetColorSpaceToStep()\n        else:\n            ctf.SetColorSpaceToRGB()\n    else:\n        ctf.SetColorSpaceToRGB()\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            ctf.SetScaleToLog10()\n        else:\n            ctf.SetScaleToLinear()\n    else:\n        ctf.SetScaleToLinear()\n\n    if parameters['NaN'] is not None:\n        color = list(map(float, parameters['NaN']))\n        ctf.SetNanColor(*color)\n\n    if parameters['Above'] is not None:\n        color = list(map(float, parameters['Above']))\n        ctf.SetAboveRangeColor(*color)\n        ctf.UseAboveRangeColorOn()\n\n    if parameters['Below'] is not None:\n        color = list(map(float, parameters['Below']))\n        ctf.SetBelowRangeColor(*color)\n        ctf.UseBelowRangeColorOn()\n\n    space = parameters['color_map_details'].get('space', None)\n    if space:\n        space = space.lower()\n        for i in range(0, len(parameters['data_values'])):\n            color = list(map(float, parameters['color_values'][i]))\n            idx = float(parameters['data_values'][i])\n            if space == 'hsv':\n                ctf.AddHSVPoint(idx, *color)\n            else:\n                ctf.AddRGBPoint(idx, *color)\n\n    if table_size is not None:\n        ctf.SetNumberOfValues(table_size)\n    else:\n        ctf.SetNumberOfValues(len(parameters[\"data_values\"]))\n\n    if discretize:\n        ctf.DiscretizeOn()\n    else:\n        ctf.DiscretizeOff()\n\n    return ctf\n\n\ndef generate_ctf_python(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate a function for the ctf.\n\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n    indent = ' ' * 4\n\n    comment = f'{indent}#'\n    if 'name' in parameters['color_map_details']:\n        comment += f' name: {parameters[\"color_map_details\"][\"name\"]},'\n    if 'creator' in parameters['color_map_details']:\n        comment += f' creator: {parameters[\"color_map_details\"][\"creator\"]}'\n    if 'interpolationspace' in parameters['color_map_details']:\n        comment += f'\\n{indent}# interpolationspace: {parameters[\"color_map_details\"][\"interpolationspace\"]},'\n    if 'interpolationtype' in parameters['color_map_details']:\n        comment += f' interpolationtype: {parameters[\"color_map_details\"][\"interpolationtype\"]},'\n    if 'space' in parameters['color_map_details']:\n        comment += f' space: {parameters[\"color_map_details\"][\"space\"]}'\n    comment += f'\\n{indent}# file name: {parameters[\"path\"]}\\n'\n\n    s = ['', f'def get_ctf():', comment, f'{indent}ctf = vtkDiscretizableColorTransferFunction()', '']\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            s.append(f'{indent}ctf.SetColorSpaceToHSV()')\n        elif interp_space == 'lab':\n            s.append(f'{indent}ctf.SetColorSpaceToLab()')\n        elif interp_space == 'cielab':\n            s.append(f'{indent}ctf.SetColorSpaceToLab()')\n        elif interp_space == 'ciede2000':\n            s.append(f'{indent}ctf.SetColorSpaceToLabCIEDE2000()')\n        elif interp_space == 'diverging':\n            s.append(f'{indent}ctf.SetColorSpaceToDiverging()')\n        elif interp_space == 'step':\n            s.append(f'{indent}ctf.SetColorSpaceToStep()')\n        else:\n            s.append(f'{indent}ctf.SetColorSpaceToRGB()')\n    else:\n        s.append(f'{indent}ctf.SetColorSpaceToRGB()')\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            s.append(f'{indent}ctf.SetScaleToLog10()')\n        else:\n            s.append(f'{indent}ctf.SetScaleToLinear()')\n    else:\n        s.append(f'{indent}ctf.SetScaleToLinear()')\n    s.append('')\n\n    if parameters['NaN'] is not None:\n        color = ', '.join(parameters['NaN'])\n        s.append(f'{indent}ctf.SetNanColor({color})')\n\n    if parameters['Above'] is not None:\n        color = ', '.join(parameters['Above'])\n        s.append(f'{indent}ctf.SetAboveRangeColor({color})')\n        s.append(f'{indent}ctf.UseAboveRangeColorOn()')\n\n    if parameters['Below'] is not None:\n        color = ', '.join(parameters['Below'])\n        s.append(f'{indent}ctf.SetBelowRangeColor({color})')\n        s.append(f'{indent}ctf.UseBelowRangeColorOn()')\n    s.append('')\n\n    space = parameters['color_map_details'].get('space', None)\n    if space:\n        space = space.lower()\n        for i in range(0, len(parameters['data_values'])):\n            color = ', '.join(parameters['color_values'][i])\n            idx = parameters['data_values'][i]\n            if space == 'hsv':\n                s.append(f'{indent}ctf.AddHSVPoint({idx}, {color})')\n            else:\n                s.append(f'{indent}ctf.AddRGBPoint({idx}, {color})')\n        s.append('')\n\n    if table_size is not None:\n        s.append(f'{indent}ctf.SetNumberOfValues({table_size})')\n    else:\n        s.append(f'{indent}ctf.SetNumberOfValues({len(parameters[\"data_values\"])})')\n\n    if discretize:\n        s.append(f'{indent}ctf.DiscretizeOn()')\n    else:\n        s.append(f'{indent}ctf.DiscretizeOff()')\n    s.append('')\n\n    s.append(f'{indent}return ctf')\n    s.append('')\n\n    print('\\n'.join(s))\n\n\ndef generate_ctf_cpp(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate a function for the ctf.\n\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n    indent = ' ' * 2\n\n    comment = f'{indent}//'\n    if 'name' in parameters['color_map_details']:\n        comment += f' name: {parameters[\"color_map_details\"][\"name\"]},'\n    if 'creator' in parameters['color_map_details']:\n        comment += f' creator: {parameters[\"color_map_details\"][\"creator\"]}'\n    if 'interpolationspace' in parameters['color_map_details']:\n        comment += f'\\n{indent}// interpolationspace: {parameters[\"color_map_details\"][\"interpolationspace\"]},'\n    if 'interpolationtype' in parameters['color_map_details']:\n        comment += f' interpolationtype: {parameters[\"color_map_details\"][\"interpolationtype\"]},'\n    if 'space' in parameters['color_map_details']:\n        comment += f' space: {parameters[\"color_map_details\"][\"space\"]}'\n    comment += f'\\n{indent}// file name: {parameters[\"path\"]}\\n'\n\n    s = ['', f'vtkNew<vtkDiscretizableColorTransferFunction> GetCTF()', '{', comment,\n         f'{indent}vtkNew<vtkDiscretizableColorTransferFunction> ctf;', '']\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            s.append(f'{indent}ctf->SetColorSpaceToHSV();')\n        elif interp_space == 'lab':\n            s.append(f'{indent}ctf->SetColorSpaceToLab();')\n        elif interp_space == 'cielab':\n            s.append(f'{indent}ctf->SetColorSpaceToLab();')\n        elif interp_space == 'ciede2000':\n            s.append(f'{indent}ctf->SetColorSpaceToLabCIEDE2000();')\n        elif interp_space == 'diverging':\n            s.append(f'{indent}ctf->SetColorSpaceToDiverging();')\n        elif interp_space == 'step':\n            s.append(f'{indent}ctf->SetColorSpaceToStep();')\n        else:\n            s.append(f'{indent}ctf->SetColorSpaceToRGB();')\n    else:\n        s.append(f'{indent}ctf->SetColorSpaceToRGB();')\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            s.append(f'{indent}ctf->SetScaleToLog10();')\n        else:\n            s.append(f'{indent}ctf->SetScaleToLinear();')\n    else:\n        s.append(f'{indent}ctf->SetScaleToLinear();')\n    s.append('')\n\n    if parameters['NaN'] is not None:\n        color = ', '.join(parameters['NaN'])\n        s.append(f'{indent}ctf->SetNanColor({color});')\n\n    if parameters['Above'] is not None:\n        color = ', '.join(parameters['Above'])\n        s.append(f'{indent}ctf->SetAboveRangeColor({color});')\n        s.append(f'{indent}ctf->UseAboveRangeColorOn();')\n\n    if parameters['Below'] is not None:\n        color = ', '.join(parameters['Below'])\n        s.append(f'{indent}ctf->SetBelowRangeColor({color});')\n        s.append(f'{indent}ctf->UseBelowRangeColorOn();')\n    s.append('')\n\n    space = parameters['color_map_details'].get('space', None)\n    if space:\n        space = space.lower()\n        for i in range(0, len(parameters['data_values'])):\n            color = ', '.join(parameters['color_values'][i])\n            idx = parameters['data_values'][i]\n            if space == 'hsv':\n                s.append(f'{indent}ctf->AddHSVPoint({idx}, {color});')\n            else:\n                s.append(f'{indent}ctf->AddRGBPoint({idx}, {color});')\n        s.append('')\n\n    if table_size is not None:\n        s.append(f'{indent}ctf->SetNumberOfValues({table_size});')\n    else:\n        s.append(f'{indent}ctf->SetNumberOfValues({len(parameters[\"data_values\"])});')\n\n    if discretize:\n        s.append(f'{indent}ctf->DiscretizeOn();')\n    else:\n        s.append(f'{indent}ctf->DiscretizeOff();')\n    s.append('')\n\n    s.append(f'{indent}return ctf;')\n    s.append('}')\n    s.append('')\n\n    print('\\n'.join(s))\n\n\nif __name__ == '__main__':\n    file, discretise, size, generate = get_program_parameters(sys.argv)\n    main(file, discretise, size, generate)\n
"},{"location":"Python/Utilities/LUTUtilities/","title":"LUTUtilities","text":"

vtk-examples/Python/Utilities/LUTUtilities

"},{"location":"Python/Utilities/LUTUtilities/#description","title":"Description","text":"

A class called LUTUtilities is demonstrated along with a test harness that shows you how to use the class.

This class allows you to:

  • Print the contents of the lookup table
  • Compare two lookup tables to see if they are the same.

The test harness is a function called: TestLookupTables that tests pairs of lookup tables against each other.

The program will not display any output if all tests are successful.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/LUTUtilities/#code","title":"Code","text":"

LUTUtilities.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport sys\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkColorSeries\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkVariant,\n    vtkVariantArray\n)\n\n\nclass LUTUtilities(object):\n    \"\"\"\n    Utilities for displaying and comparing lookup tables.\n    \"\"\"\n\n    def __init__(self):\n        pass\n\n    def DisplayLUTAsString(self, lut):\n        \"\"\"\n        Display the contents of the lookup table.\n        :param: lut - the lookup table.\n        :return: a string containing the table data.\n        \"\"\"\n        str = ''\n        tv = lut.GetNumberOfTableValues()\n        dR = lut.GetTableRange()\n        if lut.GetIndexedLookup():\n            av = lut.GetNumberOfAnnotatedValues()\n            str = \"Categorical Lookup Table\\n\" + \\\n                  \"Number of annotated values: {:d}\".format(av) + \\\n                  \" Number of table values: {:d}\".format(tv) + \\\n                  \"\\nTable Range: {:8.6f} to {:8.6f}\\n\".format(dR[0], dR[1])\n            if av > 0:\n                for i in range(av):\n                    rgba = [0.0, 0.0, 0.0, 0.0]\n                    lut.GetAnnotationColor(lut.GetAnnotatedValue(i), rgba)\n                    str += \"{:>5}: \".format(lut.GetAnnotation(i))\n                    str += self.AssembleRGBAString(rgba)\n            else:\n                for i in range(tv):\n                    rgba = [0.0, 0.0, 0.0, 0.0]\n                    rgba = lut.GetTableValue(i)\n                    str += \"{:5d}: \".format(i)\n                    str += self.AssembleRGBAString(rgba)\n        else:\n            str = \"Ordinal Lookup Table\\n\" + \\\n                  \" Number of table values: {:d}\".format(tv) + \\\n                  \"\\nTable Range: {:8.6f} to {:8.6f}\\n\".format(dR[0], dR[1])\n            indices = [(dR[1] - dR[0]) *\n                       float(x) / tv + dR[0] for x in range(0, tv)]\n            for i, v in enumerate(indices):\n                rgb = [0.0, 0.0, 0.0]\n                lut.GetColor(v, rgb)\n                rgba = rgb + [lut.GetOpacity(v)]\n                str += \"{:5.2f}: \".format(v)\n                str += self.AssembleRGBAString(rgba)\n        return str\n\n    def AssembleRGBAString(self, rgba):\n        \"\"\"\n        Display the contents of the rgba as a series of strings:\n        decimal [r g b a], integer [r g b a] where r,g ,b a are\n        in the range 0..255 and 0xrrggba .\n        :param: The rgba string.\n        :return: A string in the above format.\n        \"\"\"\n        s = '[' + ', '.join(['{:0.6f}'.format(x) for x in rgba]) + ']'\n        ucrgb = [int(x * 255) for x in rgba]\n        t = '[' + ', '.join(['{:3d}'.format(x) for x in ucrgb]) + ']'\n        # u = '0x'+''.join(map(lambda x: '{:02X}'.format(x),ucrgb[:3]))\n        u = '0x' + ''.join(['{:02x}'.format(x) for x in ucrgb])\n        res = '{:s} {:s} {:s}\\n'.format(s, t, u)\n        return res\n\n    def CompareLUTs(self, lut1, lut2):\n        \"\"\"\n        Compare two lookup tables.\n        :param: lut1 - the lookup table.\n        :param: lut2 - the lookup table.\n        :return: True if the tables are the same.\n        \"\"\"\n        res = [True, '']\n        if lut1.GetIndexedLookup() != lut2.GetIndexedLookup():\n            res[0] = False\n            res[1] = \"One table is ordinal and the other is categorical.\"\n            return res\n        if lut1.GetIndexedLookup() and \\\n                lut1.GetNumberOfAnnotatedValues() != \\\n                lut2.GetNumberOfAnnotatedValues():\n            res[0] = False\n            res[1] = \"The number of annotated values do not match.\"\n            return res\n        if lut1.GetNumberOfTableValues() != lut2.GetNumberOfTableValues():\n            res[0] = False\n            res[1] = \"Table values do not match.\"\n            return res\n        dR1 = lut1.GetTableRange()\n        dR2 = lut2.GetTableRange()\n        if dR1[0] != dR2[0] and dR1[1] != dR2[1]:\n            res[0] = False\n            res[1] = \"Table ranges do not match.\"\n            return res\n        if lut1.GetIndexedLookup():\n            av = lut1.GetNumberOfAnnotatedValues()\n            if av > 0:\n                for i in range(av):\n                    if lut1.GetAnnotation(i) != lut1.GetAnnotation(i):\n                        res[0] = False\n                        res[1] = \"Annotations do not match.\"\n                        return res\n                for i in range(av):\n                    rgba1 = [0.0, 0.0, 0.0, 0.0]\n                    lut1.GetAnnotationColor(lut1.GetAnnotatedValue(i), rgba1)\n                    rgba2 = [0.0, 0.0, 0.0, 0.0]\n                    lut2.GetAnnotationColor(lut2.GetAnnotatedValue(i), rgba2)\n                    if not self.CompareRGBA(rgba1, rgba2):\n                        res[0] = False\n                        res[1] = \"Colors do not match.\"\n                        return res\n            else:\n                tv = lut1.GetNumberOfTableValues()\n                for i in range(tv):\n                    rgba1 = lut1.GetTableValue(i)\n                    rgba2 = lut2.GetTableValue(i)\n                    if not self.CompareRGBA(rgba1, rgba2):\n                        res[0] = False\n                        res[1] = \"Colors do not match.\"\n                        return res\n        else:\n            tv = lut1.GetNumberOfTableValues()\n            indices = [(dR1[1] - dR1[0]) *\n                       float(x) / tv + dR1[0] for x in range(0, tv)]\n            for i, v in enumerate(indices):\n                rgb1 = [0.0, 0.0, 0.0]\n                lut1.GetColor(v, rgb1)\n                rgba1 = rgb1 + [lut1.GetOpacity(v)]\n                rgb2 = [0.0, 0.0, 0.0]\n                lut2.GetColor(v, rgb2)\n                rgba2 = rgb2 + [lut2.GetOpacity(v)]\n                if not self.CompareRGBA(rgba1, rgba2):\n                    res[0] = False\n                    res[1] = \"Colors do not match.\"\n                    return res\n\n        return res\n\n    def CompareRGBA(self, rgba1, rgba2):\n        \"\"\"\n        Compare two rgba lists.\n        rgba can be a hexadecimal string, or a\n        list of rgb or rgba colors.\n        :param: rgba1 - the color.\n        :param: rgba2 - the color.\n        :return: True if the colors are the same.\n        \"\"\"\n        if len(rgba1) != len(rgba2):\n            return False\n        if isinstance(rgba1, str):\n            return rgba1 == rgba2\n        if len(rgba1) == 3 or len(rgba1) == 4:\n            for i in range(0, len(rgba1)):\n                if rgba1[i] != rgba2[i]:\n                    return False\n            return True\n        return False\n\n\ndef GetAllColorSchemes():\n    \"\"\"\n    Get all the color scheme names.\n    :return: a map of the names keyed on their index.\n    \"\"\"\n    colorSchemes = dict()\n    colorSeries = vtkColorSeries()\n    for i in range(colorSeries.GetNumberOfColorSchemes()):\n        colorSeries.SetColorScheme(i)\n        colorSchemes[i] = colorSeries.GetColorSchemeName()\n    return colorSchemes\n\n\ndef AvailableColorSchemes(colorSchemes):\n    \"\"\"\n    The available color scheme indexes and names.\n    :param: colorSchemes - a map of the names keyed on their index.\n    :return:  a string if the indexes and names.\n    \"\"\"\n    str = ''\n    for k, v in colorSchemes.items():\n        str += '{:3d}\\t{:s}\\n'.format(k, v)\n    return str\n\n\ndef DisplayAvailableColorSchemes():\n    \"\"\"\n    Display the available color schemes.\n    \"\"\"\n    line = \"-----------------------------------------------------------------------------\\n\"\n    colorSchemes = GetAllColorSchemes()\n    print(line + AvailableColorSchemes(colorSchemes) + line)\n\n\ndef DisplayResults(reason, lut1, lut2):\n    \"\"\"\n    Display the lookup tables and reason for failure.\n    :param: reason - the reason.\n    :param: lut1 - the first lookup table.\n    :param: lut2 - the second lookup table.\n    \"\"\"\n    lutUtilities = LUTUtilities()\n    line = \"-----------------------------------------------------------------------------\\n\"\n    print(line + reason + \"\\n\")\n    print(lutUtilities.DisplayLUTAsString(lut1))\n    print(lutUtilities.DisplayLUTAsString(lut2))\n    print(line)\n\n\ndef TestTables(lut1, lut2, expected=True):\n    \"\"\"\n    Test pairs of lookup tables.\n    :param: lut1 - the first lookup table.\n    :param: lut2 - the second lookup table.\n    :param: expected - if False a fail is expected.\n    :return: True/False.\n    \"\"\"\n    lutUtilities = LUTUtilities()\n    comparison = lutUtilities.CompareLUTs(lut1, lut2)\n    if comparison[0] != expected:\n        DisplayResults(comparison[1], lut1, lut2)\n    if expected:\n        return comparison[0]\n    return not comparison[0]\n\n\ndef TestLookupTables(lutMode):\n    \"\"\"\n    Test various combinations of lookup tables.\n    :param: lutMode - if True the tables are ordinal, categorical otherwise.\n    :return: True if all tests passed.\n    \"\"\"\n    lut1 = vtkLookupTable()\n    lut2 = vtkLookupTable()\n    colorSeries = vtkColorSeries()\n    colorSeriesEnum = colorSeries.SPECTRUM\n    colorSeries.SetColorScheme(colorSeriesEnum)\n\n    colorSeries.BuildLookupTable(lut1)\n    colorSeries.BuildLookupTable(lut2)\n    if lutMode:\n        lut1.IndexedLookupOff()\n        lut2.IndexedLookupOff()\n    lut1.SetNanColor(1, 0, 0, 1)\n    lut2.SetNanColor(1, 0, 0, 1)\n    if not lutMode:\n        # For the annotation just use a letter of the alphabet.\n        values1 = vtkVariantArray()\n        values2 = vtkVariantArray()\n        str = \"abcdefghijklmnopqrstuvwxyz\"\n        for i in range(lut1.GetNumberOfTableValues()):\n            values1.InsertNextValue(vtkVariant(str[i]))\n        for i in range(lut2.GetNumberOfTableValues()):\n            values2.InsertNextValue(vtkVariant(str[i]))\n        for i in range(values1.GetNumberOfTuples()):\n            lut1.SetAnnotation(i, values1.GetValue(i).ToString())\n        for i in range(values2.GetNumberOfTuples()):\n            lut2.SetAnnotation(i, values2.GetValue(i).ToString())\n    # Are they the same?\n    res = True\n    res &= TestTables(lut1, lut2)\n\n    # Different size\n    lut2.SetNumberOfTableValues(5)\n    res &= TestTables(lut1, lut2, False)\n    lut2.SetNumberOfTableValues(lut1.GetNumberOfTableValues())\n    res &= TestTables(lut1, lut2)\n\n    if lutMode:\n        # Different range\n        lut2.SetTableRange(1, 2)\n        res &= TestTables(lut1, lut2, False)\n        tr = lut1.GetTableRange()\n        lut2.SetTableRange(tr)\n        res &= TestTables(lut1, lut2)\n\n        # Different color\n        colorSeriesEnum = colorSeries.COOL\n        colorSeries.SetColorScheme(colorSeriesEnum)\n        lut3 = vtkLookupTable()\n        colorSeries.BuildLookupTable(lut3)\n        lut3.IndexedLookupOff()\n        res &= TestTables(lut1, lut3, False)\n\n        # One indexed, the other ordinal.\n        lut1.IndexedLookupOn()\n        res &= TestTables(lut1, lut2, False)\n\n    else:\n        # Different color\n        colorSeriesEnum = colorSeries.COOL\n        colorSeries.SetColorScheme(colorSeriesEnum)\n        lut3 = vtkLookupTable()\n        colorSeries.BuildLookupTable(lut3)\n        values = vtkVariantArray()\n        str = \"abcdefghijklmnopqrstuvwxyz\"\n        for i in range(lut3.GetNumberOfTableValues()):\n            values.InsertNextValue(vtkVariant(str[i]))\n        for i in range(values.GetNumberOfTuples()):\n            lut3.SetAnnotation(i, values.GetValue(i).ToString())\n        colorSeries.BuildLookupTable(lut3)\n        res &= TestTables(lut1, lut3, False)\n\n        # Different annotations.\n        lut2.ResetAnnotations()\n        for i in range(values.GetNumberOfTuples()):\n            if i % 3 == 0:\n                continue\n            lut2.SetAnnotation(i, values.GetValue(i).ToString())\n        res &= TestTables(lut1, lut2, False)\n\n        # No annotations\n        lut1.ResetAnnotations()\n        lut2.ResetAnnotations()\n        res &= TestTables(lut1, lut2)\n\n        # One indexed, the other ordinal.\n        lut1.IndexedLookupOff()\n        res &= TestTables(lut1, lut2, False)\n\n    return res\n\n\ndef main():\n    # DisplayAvailableColorSchemes()\n    # Test ordinal LUTS.\n    res = TestLookupTables(True)\n    # Test categorical LUTs.\n    res &= TestLookupTables(False)\n    return res\n\n\nif __name__ == '__main__':\n    res = main()\n    if res:\n        sys.exit(0)\n    else:\n        print('Ordinal or Categorical LookupTable tests failed.')\n        sys.exit(1)\n
"},{"location":"Python/Utilities/RescaleReverseLUT/","title":"RescaleReverseLUT","text":"

vtk-examples/Python/Utilities/RescaleReverseLUT

"},{"location":"Python/Utilities/RescaleReverseLUT/#description","title":"Description","text":"

This example shows how to adjust a colormap so that the colormap scalar range matches the scalar range on the object. This is done by adjusting the colormap so that the colormap scalar range matches the scalar range of the object by rescaling the control points and, optionally, reversing the order of the colors.

Of course, if you are generating the scalars, it may be easier to just change the scalar range of your filter. However, this may not be possible in some cases.

Here, we generate the original Color Transfer Function (CTF) corresponding to the seven colors that Isaac Newton labeled when dividing the spectrum of visible light in 1672. There are seven colors and the scalar range is [-1, 1].

The cylinder has a vtkElevationFilter applied to it with a scalar range of [0, 1].

There are four images:

  • Original - The cylinder is colored by only the top four colors from the CTF. This is because the elevation scalar range on the cylinder is [0, 1] and the CTF scalar range is [-1, 1]. So the coloring is green->violet.
  • Reversed - We have reversed the colors from the original CTF and the lower four colors in the original CTF are now the top four colors used to color the cylinder. The coloring is now green->red.
  • Rescaled - The original CTF is rescaled to the range [0, 1] to match the scalar range of the elevation filter. The coloring is red->violet.
  • Rescaled and Reversed - The original CTF is rescaled to the range [0, 1] and the colors reversed. The coloring is violet->red.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/RescaleReverseLUT/#code","title":"Code","text":"

RescaleReverseLUT.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersSources import vtkCylinderSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDiscretizableColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    colors.SetColor('ParaViewBkg', 82, 87, 110, 255)\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(640 * 2, 480 * 2)\n    ren_win.SetWindowName('RescaleReverseLUT')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    ctf = list()\n    ctf.append(get_ctf(False))\n    ctf.append(rescale_ctf(ctf[0], 0, 1, False))\n    ctf.append(rescale_ctf(ctf[0], *ctf[0].GetRange(), True))\n    ctf.append(rescale_ctf(ctf[0], 0, 1, True))\n\n    # Define viewport ranges.\n    xmins = [0.0, 0.0, 0.5, 0.5]\n    xmaxs = [0.5, 0.5, 1.0, 1.0]\n    ymins = [0.5, 0.0, 0.5, 0.0]\n    ymaxs = [1.0, 0.5, 1.0, 0.5]\n\n    # Define titles.\n    titles = ['Original', 'Rescaled', 'Reversed', 'Rescaled and Reversed']\n\n    # Create a common text property.\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(36)\n    text_property.SetJustificationToCentered()\n    text_property.SetColor(colors.GetColor3d('LightGoldenrodYellow'))\n\n    sources = list()\n    elevation_filters = list()\n    mappers = list()\n    actors = list()\n    scalar_bars = list()\n    renderers = list()\n    text_mappers = list()\n    text_actors = list()\n\n    for i in range(0, 4):\n        cylinder = vtkCylinderSource()\n        cylinder.SetCenter(0.0, 0.0, 0.0)\n        cylinder.SetResolution(6)\n        cylinder.Update()\n        bounds = cylinder.GetOutput().GetBounds()\n        sources.append(cylinder)\n\n        elevation_filter = vtkElevationFilter()\n        elevation_filter.SetScalarRange(0, 1)\n        elevation_filter.SetLowPoint(0, bounds[2], 0)\n        elevation_filter.SetHighPoint(0, bounds[3], 0)\n        elevation_filter.SetInputConnection(sources[i].GetOutputPort())\n        elevation_filters.append(elevation_filter)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(elevation_filters[i].GetOutputPort())\n        mapper.SetLookupTable(ctf[i])\n        mapper.SetColorModeToMapScalars()\n        mapper.InterpolateScalarsBeforeMappingOn()\n        mappers.append(mapper)\n\n        actor = vtkActor()\n        actor.SetMapper(mappers[i])\n        actors.append(actor)\n\n        # Add a scalar bar.\n        scalar_bar = vtkScalarBarActor()\n        scalar_bar.SetLookupTable(ctf[i])\n        scalar_bars.append(scalar_bar)\n\n        text_mappers.append(vtkTextMapper())\n        text_mappers[i].SetInput(titles[i])\n        text_mappers[i].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[i].SetMapper(text_mappers[i])\n        # Note: The position of an Actor2D is specified in display coordinates.\n        text_actors[i].SetPosition(300, 16)\n\n        ren = vtkRenderer()\n        ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n        ren.AddActor(actors[i])\n        ren.AddActor(scalar_bars[i])\n        ren.AddActor(text_actors[i])\n        ren.SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i])\n        renderers.append(ren)\n\n        ren_win.AddRenderer(renderers[i])\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_ctf(modern=False):\n    \"\"\"\n    Generate the color transfer function.\n\n    The seven colors corresponding to the colors that Isaac Newton labelled\n        when dividing the spectrum of visible light in 1672 are used.\n\n    The modern variant of these colors can be selected and used instead.\n\n    See: [Rainbow](https://en.wikipedia.org/wiki/Rainbow)\n\n    :param modern: Selects either Newton's original seven colors or modern version.\n    :return: The color transfer function.\n    \"\"\"\n\n    # name: Rainbow, creator: Andrew Maclean\n    # interpolationspace: RGB, space: rgb\n    # file name:\n\n    ctf = vtkDiscretizableColorTransferFunction()\n\n    ctf.SetColorSpaceToRGB()\n    ctf.SetScaleToLinear()\n    ctf.SetNanColor(0.5, 0.5, 0.5)\n    ctf.SetBelowRangeColor(0.0, 0.0, 0.0)\n    ctf.UseBelowRangeColorOn()\n    ctf.SetAboveRangeColor(1.0, 1.0, 1.0)\n    ctf.UseAboveRangeColorOn()\n\n    if modern:\n        ctf.AddRGBPoint(-1.0, 1.0, 0.0, 0.0)  # Red\n        ctf.AddRGBPoint(-2.0 / 3.0, 1.0, 128.0 / 255.0, 0.0)  # Orange #ff8000\n        ctf.AddRGBPoint(-1.0 / 3.0, 1.0, 1.0, 0.0)  # Yellow\n        ctf.AddRGBPoint(0.0, 0.0, 1.0, 0.0)  # Green #00ff00\n        ctf.AddRGBPoint(1.0 / 3.0, 0.0, 1.0, 1.0)  # Cyan\n        ctf.AddRGBPoint(2.0 / 3.0, 0.0, 0.0, 1.0)  # Blue\n        ctf.AddRGBPoint(1.0, 128.0 / 255.0, 0.0, 1.0)  # Violet #8000ff\n    else:\n        ctf.AddRGBPoint(-1.0, 1.0, 0.0, 0.0)  # Red\n        ctf.AddRGBPoint(-2.0 / 3.0, 1.0, 165.0 / 255.0, 0.0)  # Orange #00a500\n        ctf.AddRGBPoint(-1.0 / 3.0, 1.0, 1.0, 0.0)  # Yellow\n        ctf.AddRGBPoint(0.0, 0.0, 125.0 / 255.0, 0.0)  # Green #008000\n        ctf.AddRGBPoint(1.0 / 3.0, 0.0, 153.0 / 255.0, 1.0)  # Blue #0099ff\n        ctf.AddRGBPoint(2.0 / 3.0, 68.0 / 255.0, 0, 153.0 / 255.0)  # Indigo #4400ff\n        ctf.AddRGBPoint(1.0, 153.0 / 255.0, 0.0, 1.0)  # Violet #9900ff\n\n    ctf.SetNumberOfValues(7)\n    ctf.DiscretizeOn()\n\n    return ctf\n\n\ndef generate_new_ctf(old_ctf, new_x, new_rgb, reverse=False):\n    \"\"\"\n    Generate a new color transfer function from the old one,\n    adding in the new x and rgb values.\n\n    :param old_ctf: The old color transfer function.\n    :param new_x: The new color x-values.\n    :param new_rgb: The color RGB values.\n    :param reverse: If true, reverse the colors.\n    :return: The new color transfer function.\n    \"\"\"\n    new_ctf = vtkDiscretizableColorTransferFunction()\n    new_ctf.SetScale(old_ctf.GetScale())\n    new_ctf.SetColorSpace(old_ctf.GetColorSpace())\n    new_ctf.SetNanColor(old_ctf.GetNanColor())\n    if not reverse:\n        new_ctf.SetBelowRangeColor(old_ctf.GetBelowRangeColor())\n        new_ctf.SetUseBelowRangeColor(old_ctf.GetUseBelowRangeColor())\n        new_ctf.SetAboveRangeColor(old_ctf.GetAboveRangeColor())\n        new_ctf.SetUseAboveRangeColor(old_ctf.GetUseAboveRangeColor())\n    else:\n        new_ctf.SetBelowRangeColor(old_ctf.GetAboveRangeColor())\n        new_ctf.SetUseBelowRangeColor(old_ctf.GetUseAboveRangeColor())\n        new_ctf.SetAboveRangeColor(old_ctf.GetBelowRangeColor())\n        new_ctf.SetUseAboveRangeColor(old_ctf.GetUseBelowRangeColor())\n    new_ctf.SetNumberOfValues(len(new_x))\n    new_ctf.SetDiscretize(old_ctf.GetDiscretize())\n    if not reverse:\n        for i in range(0, len(new_x)):\n            new_ctf.AddRGBPoint(new_x[i], *new_rgb[i])\n    else:\n        sz = len(new_x)\n        for i in range(0, sz):\n            j = sz - (i + 1)\n            new_ctf.AddRGBPoint(new_x[i], *new_rgb[j])\n    new_ctf.Build()\n    return new_ctf\n\n\ndef rescale(values, new_min=0, new_max=1):\n    \"\"\"\n    Rescale the values.\n\n    See: https://stats.stackexchange.com/questions/25894/changing-the-scale-of-a-variable-to-0-100\n\n    :param values: The values to be rescaled.\n    :param new_min: The new minimum value.\n    :param new_max: The new maximum value.\n    :return: The rescaled values.\n    \"\"\"\n    res = list()\n    old_min, old_max = min(values), max(values)\n    for v in values:\n        new_v = (new_max - new_min) / (old_max - old_min) * (v - old_min) + new_min\n        # new_v1 = (new_max - new_min) / (old_max - old_min) * (v - old_max) + new_max\n        res.append(new_v)\n    return res\n\n\ndef rescale_ctf(ctf, new_min=0, new_max=1, reverse=False):\n    \"\"\"\n    Rescale and, optionally, reverse the colors in the color transfer function.\n\n    :param ctf: The color transfer function to rescale.\n    :param new_min: The new minimum value.\n    :param new_max: The new maximum value.\n    :param reverse: If true, reverse the colors.\n    :return: The rescaled color transfer function.\n    \"\"\"\n    if new_min > new_max:\n        r0 = new_max\n        r1 = new_min\n    else:\n        r0 = new_min\n        r1 = new_max\n\n    xv = list()\n    rgbv = list()\n    nv = [0] * 6\n    for i in range(0, ctf.GetNumberOfValues()):\n        ctf.GetNodeValue(i, nv)\n        x = nv[0]\n        rgb = nv[1:4]\n        xv.append(x)\n        rgbv.append(rgb)\n    xvr = rescale(xv, r0, r1)\n\n    return generate_new_ctf(ctf, xvr, rgbv, reverse=reverse)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/ResetCameraOrientation/","title":"ResetCameraOrientation","text":"

vtk-examples/Python/Utilities/ResetCameraOrientation

"},{"location":"Python/Utilities/ResetCameraOrientation/#description","title":"Description","text":"

This example demonstrates how to reset the camera orientation.

In this case, the original orientation is stored, a new orientation calculated, and, finally the original orientation is restored. The original, new and restored orientations of the cone are displayed in one second intervals. After this you can interact with the scene.

To set the camera position, you can use:

  • SetPosition, SetFocalPoint, SetViewUp, SetDistance, SetClippingRange
  • Roll, Elevation, Azimuth
  • SetRoll, Pitch, Yaw

If you haven't used SetDistance or SetClippingRange remember to ren->ResetCamera(); or ren.ResetCamera().

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/ResetCameraOrientation/#code","title":"Code","text":"

ResetCameraOrientation.py

from time import sleep\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkInteractionStyle import (\n    vtkInteractorStyleTrackballCamera)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef comma_separated_list(v, precision=6, width=10):\n    \"\"\"\n    Produce a comma-separated string of numbers from a list.\n    :param v: The list of floats.\n    :param precision: Number of decimal places.\n    :param width: The width.\n    :return: A comma-separated string.\n    \"\"\"\n    res = list()\n    for p in v:\n        res.append(f'{p:{width}.{precision}f}')\n    return ','.join(res)\n\n\ndef get_orientation(ren):\n    \"\"\"\n    Get the camera orientation.\n    :param ren: The renderer.\n    :return: The orientation parameters.\n    \"\"\"\n    p = dict()\n    camera = ren.GetActiveCamera()\n    p['position'] = camera.GetPosition()\n    p['focal point'] = camera.GetFocalPoint()\n    p['view up'] = camera.GetViewUp()\n    p['distance'] = camera.GetDistance()\n    p['clipping range'] = camera.GetClippingRange()\n    p['orientation'] = camera.GetOrientation()\n    return p\n\n\ndef set_orientation(ren, p):\n    \"\"\"\n    Set the orientation of the camera.\n    :param ren: The renderer.\n    :param p: The orientation parameters.\n    :return:\n    \"\"\"\n    camera = ren.GetActiveCamera()\n    camera.SetPosition(p['position'])\n    camera.SetFocalPoint(p['focal point'])\n    camera.SetViewUp(p['view up'])\n    camera.SetDistance(p['distance'])\n    camera.SetClippingRange(p['clipping range'])\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    cone_mapper = vtkPolyDataMapper()\n    cone_mapper.SetInputConnection(cone.GetOutputPort())\n\n    cone_actor = vtkActor()\n    cone_actor.SetMapper(cone_mapper)\n    cone_actor.GetProperty().SetColor(colors.GetColor3d('Bisque'))\n\n    ren = vtkRenderer()\n    ren.AddActor(cone_actor)\n    ren.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetSize(600, 600)\n    ren_win.SetWindowName('ResetCameraOrientation')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    camera = ren.GetActiveCamera()\n    camera.SetRoll(15)\n    camera.Elevation(-15)\n    camera.Azimuth(30)\n    ren.ResetCamera()\n\n    ren_win.Render()\n    original_orient = get_orientation(ren)\n    s = f'{\"Original orientation:\":23s}'\n    s += comma_separated_list(original_orient[\"orientation\"])\n    print(s)\n    sleep(1)\n\n    camera.SetPosition(-3.568189, 5.220048, 2.352639)\n    camera.SetFocalPoint(-0.399044, -0.282865, 0.131438)\n    camera.SetViewUp(0.623411, 0.573532, -0.531431)\n    camera.SetDistance(6.727500)\n    camera.SetClippingRange(3.001430, 11.434082)\n    # No need to use ren.ResetCamera() as we have all the parameters.\n    ren_win.Render()\n    new_orient = get_orientation(ren)\n    s = f'{\"New orientation:\":23s}'\n    s += comma_separated_list(new_orient[\"orientation\"])\n    print(s)\n    sleep(1)\n\n    print('Reloading the original orientation.')\n    set_orientation(ren, original_orient)\n    ren_win.Render()\n    check = get_orientation(ren)\n    s = f'{\"Final orientation:\":23s}'\n    s += comma_separated_list(check[\"orientation\"])\n    print(s)\n    sleep(1)\n\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Utilities/SaveSceneToFieldData/","title":"SaveSceneToFieldData","text":"

vtk-examples/Python/Utilities/SaveSceneToFieldData

"},{"location":"Python/Utilities/SaveSceneToFieldData/#description","title":"Description","text":"

This example saves a vtkCamera's parameters in the vtkFieldData of a vkDataSet.

To see how the scene is saved and restored,

  1. Interact with the scene. Press the e key to exit the first iteractor. The current state of the scene's vtkCamera will be saved in the vtkDataSet's vtkFieldData.

  2. Interact with the scene again. Press the e key to exit the second interactor. The scene will be restored to the previous state.

  3. Press the e key to exit the example.

Info

This example uses snippets.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/SaveSceneToFieldData/#code","title":"Code","text":"

SaveSceneToFieldData.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkStringArray\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    pd_fn = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    polyData = ReadPolyData(pd_fn)\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Crimson'))\n    actor.GetProperty().SetSpecular(.6)\n    actor.GetProperty().SetSpecularPower(30)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('SaveSceneToFieldData')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # Interact to change camera.\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n    # After the interaction is done, save the scene.\n    SaveSceneToFieldData(polyData, actor, renderer.GetActiveCamera())\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n    # After interaction , restore the scene.\n    RestoreSceneFromFieldData(polyData, actor, renderer.GetActiveCamera())\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Saving a scene to field data.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('data_file', help='A polydata file e.g. Armadillo.ply.')\n    args = parser.parse_args()\n    return args.data_file\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef SaveSceneToFieldData(data, actor, camera):\n    # Actor\n    #   Position, orientation, origin, scale, usrmatrix, usertransform\n    # Camera\n    #   FocalPoint, Position, ViewUp, ViewAngle, ClippingRange\n\n    fp_format = '{0:.6f}'\n    res = dict()\n    res['Camera:FocalPoint'] = ', '.join(fp_format.format(n) for n in camera.GetFocalPoint())\n    res['Camera:Position'] = ', '.join(fp_format.format(n) for n in camera.GetPosition())\n    res['Camera:ViewUp'] = ', '.join(fp_format.format(n) for n in camera.GetViewUp())\n    res['Camera:ViewAngle'] = fp_format.format(camera.GetViewAngle())\n    res['Camera:ClippingRange'] = ', '.join(fp_format.format(n) for n in camera.GetClippingRange())\n    buffer = ''\n    for k, v in res.items():\n        buffer += k + ' ' + v + '\\n'\n    cameraArray = vtkStringArray()\n    cameraArray.SetNumberOfValues(1)\n    cameraArray.SetValue(0, buffer)\n    cameraArray.SetName('Camera')\n    data.GetFieldData().AddArray(cameraArray)\n\n\ndef RestoreSceneFromFieldData(data, actor, camera):\n    import re\n\n    # Some regular expressions.\n\n    reCP = re.compile(r'^Camera:Position')\n    reCFP = re.compile(r'^Camera:FocalPoint')\n    reCVU = re.compile(r'^Camera:ViewUp')\n    reCVA = re.compile(r'^Camera:ViewAngle')\n    reCCR = re.compile(r'^Camera:ClippingRange')\n    keys = [reCP, reCFP, reCVU, reCVA, reCCR]\n\n    # float_number = re.compile(r'[^0-9.\\-]*([0-9e.\\-]*[^,])[^0-9.\\-]*([0-9e.\\-]*[^,])[^0-9.\\-]*([0-9e.\\-]*[^,])')\n    # float_scalar = re.compile(r'[^0-9.\\-]*([0-9.\\-e]*[^,])')\n\n    buffer = data.GetFieldData().GetAbstractArray('Camera').GetValue(0).split('\\n')\n    res = dict()\n    for line in buffer:\n        if not line.strip():\n            continue\n        line = line.strip().replace(',', '').split()\n        for i in keys:\n            m = re.match(i, line[0])\n            if m:\n                k = m.group(0)\n                if m:\n                    #  Convert the rest of the line to floats.\n                    v = list(map(lambda x: float(x), line[1:]))\n                    if len(v) == 1:\n                        res[k] = v[0]\n                    else:\n                        res[k] = v\n    for k, v in res.items():\n        if re.match(reCP, k):\n            camera.SetPosition(v)\n        elif re.match(reCFP, k):\n            camera.SetFocalPoint(v)\n        elif re.match(reCVU, k):\n            camera.SetViewUp(v)\n        elif re.match(reCVA, k):\n            camera.SetViewAngle(v)\n        elif re.match(reCCR, k):\n            camera.SetClippingRange(v)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/SaveSceneToFile/","title":"SaveSceneToFile","text":"

vtk-examples/Python/Utilities/SaveSceneToFile

"},{"location":"Python/Utilities/SaveSceneToFile/#description","title":"Description","text":"

This example saves a vtkCamera's parameters in a file.

To see how the scene is saved and restored,

  1. Interact with the scene. Press the e key to exit the first iteractor. The current state of the scene's vtkCamera will be saved in the file.
  2. Interact with the scene again. Press the e key to exit the second interactor. The saved file is read and the scene will be restored to the previous state.
  3. Press the e key to exit the example.

Info

This example uses snippets.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/SaveSceneToFile/#code","title":"Code","text":"

SaveSceneToFile.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    pd_fn, scene_fn = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    polyData = ReadPolyData(pd_fn)\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Crimson'))\n    actor.GetProperty().SetSpecular(.6)\n    actor.GetProperty().SetSpecularPower(30)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('SaveSceneToFile')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # Interact to change camera.\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n    # After the interaction is done, save the scene.\n    SaveSceneToFile(scene_fn, actor, renderer.GetActiveCamera())\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n    # After interaction , restore the scene.\n    RestoreSceneFromFile(scene_fn, actor, renderer.GetActiveCamera())\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Saving a scene to a file.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('data_file', help='A polydata file e.g. Armadillo.ply.')\n    parser.add_argument('scene_file', help='The file to save the scene to.')\n    args = parser.parse_args()\n    return args.data_file, args.scene_file\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef SaveSceneToFile(file_name, actor, camera):\n    # Actor\n    #   Position, orientation, origin, scale, usrmatrix, usertransform\n    # Camera\n    #   FocalPoint, Position, ViewUp, ViewAngle, ClippingRange\n\n    fp_format = '{0:.6f}'\n    res = dict()\n    res['Camera:FocalPoint'] = ', '.join(fp_format.format(n) for n in camera.GetFocalPoint())\n    res['Camera:Position'] = ', '.join(fp_format.format(n) for n in camera.GetPosition())\n    res['Camera:ViewUp'] = ', '.join(fp_format.format(n) for n in camera.GetViewUp())\n    res['Camera:ViewAngle'] = fp_format.format(camera.GetViewAngle())\n    res['Camera:ClippingRange'] = ', '.join(fp_format.format(n) for n in camera.GetClippingRange())\n    with open(file_name, 'w') as f:\n        for k, v in res.items():\n            f.write(k + ' ' + v + '\\n')\n\n\ndef RestoreSceneFromFile(file_name, actor, camera):\n    import re\n\n    # Some regular expressions.\n\n    reCP = re.compile(r'^Camera:Position')\n    reCFP = re.compile(r'^Camera:FocalPoint')\n    reCVU = re.compile(r'^Camera:ViewUp')\n    reCVA = re.compile(r'^Camera:ViewAngle')\n    reCCR = re.compile(r'^Camera:ClippingRange')\n    keys = [reCP, reCFP, reCVU, reCVA, reCCR]\n\n    # float_number = re.compile(r'[^0-9.\\-]*([0-9e.\\-]*[^,])[^0-9.\\-]*([0-9e.\\-]*[^,])[^0-9.\\-]*([0-9e.\\-]*[^,])')\n    # float_scalar = re.compile(r'[^0-9.\\-]*([0-9.\\-e]*[^,])')\n\n    res = dict()\n    with open(file_name, 'r') as f:\n        for cnt, line in enumerate(f):\n            if not line.strip():\n                continue\n            line = line.strip().replace(',', '').split()\n            for i in keys:\n                m = re.match(i, line[0])\n                if m:\n                    k = m.group(0)\n                    if m:\n                        #  Convert the rest of the line to floats.\n                        v = list(map(lambda x: float(x), line[1:]))\n                        if len(v) == 1:\n                            res[k] = v[0]\n                        else:\n                            res[k] = v\n    for k, v in res.items():\n        if re.match(reCP, k):\n            camera.SetPosition(v)\n        elif re.match(reCFP, k):\n            camera.SetFocalPoint(v)\n        elif re.match(reCVU, k):\n            camera.SetViewUp(v)\n        elif re.match(reCVA, k):\n            camera.SetViewAngle(v)\n        elif re.match(reCCR, k):\n            camera.SetClippingRange(v)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/Screenshot/","title":"Screenshot","text":"

vtk-examples/Python/Utilities/Screenshot

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/Screenshot/#code","title":"Code","text":"

Screenshot.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import vtkPNGWriter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('Screenshot')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create source\n    source = vtkSphereSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(5.0)\n    source.SetPhiResolution(30)\n    source.SetThetaResolution(30)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('IndianRed'))\n    actor.GetProperty().SetSpecular(0.6)\n    actor.GetProperty().SetSpecularPower(30)\n    actor.SetMapper(mapper)\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('MistyRose'))\n\n    renWin.Render()\n\n    # screenshot code:\n    w2if = vtkWindowToImageFilter()\n    w2if.SetInput(renWin)\n    w2if.SetInputBufferTypeToRGB()\n    w2if.ReadFrontBufferOff()\n    w2if.Update()\n\n    writer = vtkPNGWriter()\n    writer.SetFileName('TestScreenshot.png')\n    writer.SetInputConnection(w2if.GetOutputPort())\n    writer.Write()\n\n    # enable user interface interactor\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/SelectExamples/","title":"SelectExamples","text":"

vtk-examples/Python/Utilities/SelectExamples

"},{"location":"Python/Utilities/SelectExamples/#description","title":"Description","text":"

This script allows you to obtain a list of examples corresponding to a particular VTK Class and a given language.

In order to do this, a JSON file listing the vtk examples by VTK class is obtained from the gh-pages branch of the vtk-examples GitHub site. When this script runs, it checks for the existence of this JSON file in your temporary folder, downloading it if it doesn't exist. If it already exists, then it is updated if the file is more than ten minutes old.

When you run this script by specifying the VTK Class and Language (one of: CSharp, Cxx, Java, Python, PythonicAPI), a list of links to the respective examples containing that class is returned. By default five or fewer examples are returned. If there are more than five examples for a class then five examples are randomly selected. You can override the maximum number of examples (e.g. -n20) or select all examples -a.

Note

Options are also provided to force an overwrite of downloaded the JSON file (-o) or to change the URL to the JSON file (-j)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/SelectExamples/#code","title":"Code","text":"

SelectExamples.py

#!/usr/bin/env python\n\nimport json\nimport os\nimport random\nimport tempfile\nfrom datetime import datetime\nfrom operator import itemgetter\nfrom pathlib import Path\nfrom urllib.error import HTTPError\nfrom urllib.request import urlretrieve\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Get examples that use a particular VTK class for a given language.'\n    epilogue = '''\nThe JSON file needed by this script is obtained from the gh-pages branch\n of the vtk-examples GitHub site.\nIt is stored in your tempfile directory.\nIf you change the URL to the JSON file, remember that there is a ten minute\nwait before you can overwrite the last downloaded file. To force the download\nspecify -o on the command line.\n\nHere is the URL for an alternative site for testing:\n\"https://raw.githubusercontent.com/ajpmaclean/web-test/gh-pages/src/Coverage/vtk_vtk-examples_xref.json\"\n\n'''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('vtk_class', help='The desired VTK class.')\n    parser.add_argument('language', help='The desired language, one of: CSharp, Cxx, Java, Python.')\n    parser.add_argument('-a', '--all_values', action=\"store_true\",\n                        help='All examples (Warning: Can be a very long list).')\n    parser.add_argument('-n', '--number', type=int, default=5, help='The maximum number of examples.')\n    parser.add_argument('-m', '--md', action=\"store_true\",\n                        help='Display links in markdown inline format e.g. [label](URL).')\n    parser.add_argument('-j', '--json_xref_url',\n                        default='https://raw.githubusercontent.com/Kitware/vtk-examples/gh-pages/src/Coverage/vtk_vtk-examples_xref.json',\n                        help='The URL for the JSON cross-reference file.')\n    parser.add_argument('-o', '--overwrite', action=\"store_true\",\n                        help='Force an initial download of the JSON cross-reference file.')\n\n    args = parser.parse_args()\n    return args.vtk_class, args.language, args.all_values, args.md, args.number, args.json_xref_url, args.overwrite\n\n\ndef download_file(dl_path, dl_url, overwrite=False):\n    \"\"\"\n    Use the URL to get a file.\n\n    :param dl_path: The path to download the file to.\n    :param dl_url: The URL of the file.\n    :param overwrite: If true, do a download even if the file exists.\n    :return: The path to the file as a pathlib Path.\n    \"\"\"\n    file_name = dl_url.split('/')[-1]\n\n    # Create necessary subdirectories in the dl_path\n    # (if they don't exist).\n    Path(dl_path).mkdir(parents=True, exist_ok=True)\n    # Download if it doesn't exist in the directory overriding if overwrite is True.\n    path = Path(dl_path, file_name)\n    if not path.is_file() or overwrite:\n        try:\n            urlretrieve(dl_url, path)\n        except HTTPError as e:\n            raise RuntimeError(f'Failed to download {dl_url}. {e.reason}')\n    return path\n\n\ndef get_examples(d, vtk_class, lang, all_values=False, number=5, md_fmt=False):\n    \"\"\"\n    For the VTK Class and language return the\n     total number of examples and a list of examples.\n\n    :param d: The dictionary.\n    :param vtk_class: The VTK Class e.g. vtkActor.\n    :param lang: The language, e.g. Cxx.\n    :param all_values: True if all examples are needed.\n    :param number: The number of values.\n    :param md_fmt: Use Markdown format with label and URL defined together.\n    :return: Total number of examples and a list of examples.\n    \"\"\"\n    try:\n        kv = d[vtk_class][lang].items()\n    except KeyError:\n        return None, None\n    if len(kv) > number:\n        if all_values:\n            samples = list(kv)\n        else:\n            samples = random.sample(list(kv), number)\n    else:\n        samples = kv\n    if md_fmt:\n        links = [f'[{s.rsplit(\"/\", 1)[1]}]({s})' for s in sorted(map(itemgetter(1), samples))]\n    else:\n        links = sorted(map(itemgetter(1), samples))\n    return len(links), links\n\n\ndef get_crossref_dict(ref_dir, xref_url, overwrite=False):\n    \"\"\"\n    Download and return the json cross-reference file.\n\n    This function ensures that the dictionary is recent.\n\n    :param ref_dir: The directory where the file will be downloaded.\n    :param xref_url: The URL for the JSON cross-reference file.\n    :param overwrite: If true, do a download even if the file exists.\n    :return: The dictionary cross-referencing vtk classes to examples.\n    \"\"\"\n    path = download_file(ref_dir, xref_url, overwrite=overwrite)\n    if not path.is_file():\n        print(f'The path: {str(path)} does not exist.')\n        return None\n    dt = datetime.today().timestamp() - os.path.getmtime(path)\n    # Force a new download if the time difference is > 10 minutes.\n    if dt > 600:\n        path = download_file(ref_dir, xref_url, overwrite=True)\n    with open(path) as json_file:\n        return json.load(json_file)\n\n\ndef main():\n    vtk_class, language, all_values, md, number, xref_url, overwrite = get_program_parameters()\n    language = language.lower()\n    available_languages = {k.lower(): k for k in ['CSharp', 'Cxx', 'Java', 'Python', 'PythonicAPI']}\n    available_languages.update({'cpp': 'Cxx', 'c++': 'Cxx', 'c#': 'CSharp'})\n    if language not in available_languages:\n        print(f'The language: {language} is not available.')\n        tmp = ', '.join(sorted([lang for lang in set(available_languages.values())]))\n        print(f'Choose one of these: {tmp}.')\n        return\n    else:\n        language = available_languages[language]\n    xref_dict = get_crossref_dict(tempfile.gettempdir(), xref_url, overwrite)\n    if xref_dict is None:\n        print('The dictionary cross-referencing vtk classes to examples was not downloaded.')\n        return\n\n    total_number, examples = get_examples(xref_dict, vtk_class, language, all_values=all_values, number=number,\n                                          md_fmt=md)\n    if examples:\n        if total_number <= number or all_values:\n            print(f'VTK Class: {vtk_class}, language: {language}\\n'\n                  f'Number of example(s): {total_number}.')\n        else:\n            print(f'VTK Class: {vtk_class}, language: {language}\\n'\n                  f'Number of example(s): {total_number} with {number} random sample(s) shown.')\n        print('\\n'.join(examples))\n    else:\n        print(f'No examples for the VTK Class: {vtk_class} and language: {language}')\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/ShareCamera/","title":"ShareCamera","text":"

vtk-examples/Python/Utilities/ShareCamera

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/ShareCamera/#code","title":"Code","text":"

ShareCamera.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkCylinderSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # We store background colors in a vector. Then we extract the red, green and\n    # blue components later when coloring the reneder background.\n    rendererColors = list()\n    colorSeries = vtkColorSeries()\n    colorSeries.SetColorSchemeByName('Brewer Qualitative Pastel2')\n    rendererColors.append(colorSeries.GetColor(0))\n    rendererColors.append(colorSeries.GetColor(1))\n    rendererColors.append(colorSeries.GetColor(2))\n    rendererColors.append(colorSeries.GetColor(3))\n\n    renderWindow = vtkRenderWindow()\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Define viewport ranges\n    xmins = [0, 0.5, 0, 0.5]\n    xmaxs = [0.5, 1, 0.5, 1]\n    ymins = [0, 0, 0.5, 0.5]\n    ymaxs = [0.5, 0.5, 1, 1]\n\n    # Using the superclass for the sources\n    sources = list()\n\n    for i in range(0, 4):\n        if i == 0:\n            # Create a sphere\n            sphereSource = vtkSphereSource()\n            sphereSource.SetCenter(0.0, 0.0, 0.0)\n            sphereSource.Update()\n            sources.append(sphereSource)\n        elif i == 1:\n            # Create a cone\n            coneSource = vtkConeSource()\n            coneSource.SetCenter(0.0, 0.0, 0.0)\n            coneSource.Update()\n            sources.append(coneSource)\n        elif i == 2:\n            # Create a cube\n            cubeSource = vtkCubeSource()\n            cubeSource.SetCenter(0.0, 0.0, 0.0)\n            cubeSource.Update()\n            sources.append(cubeSource)\n        else:\n            # Create a cylinder\n            cylinderSource = vtkCylinderSource()\n            cylinderSource.SetCenter(0.0, 0.0, 0.0)\n            cylinderSource.Update()\n            sources.append(cylinderSource)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(sources[i].GetOutputPort())\n\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n        actor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n        renderer = vtkRenderer()\n        renderer.AddActor(actor)\n        r = rendererColors[i].GetRed() / 255.0\n        g = rendererColors[i].GetGreen() / 255.0\n        b = rendererColors[i].GetBlue() / 255.0\n        renderer.SetBackground(r, g, b)\n\n        renderWindow.AddRenderer(renderer)\n\n        if i == 0:\n            camera = renderer.GetActiveCamera()\n            camera.Azimuth(30)\n            camera.Elevation(30)\n        else:\n            renderer.SetActiveCamera(camera)\n\n        renderer.SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i])\n\n        renderer.ResetCamera()\n\n    renderWindow.Render()\n    renderWindow.SetWindowName('ShareCamera')\n\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/VTKImportsForPython/","title":"VTKImportsForPython","text":"

vtk-examples/Python/Utilities/VTKImportsForPython

"},{"location":"Python/Utilities/VTKImportsForPython/#description","title":"Description","text":"

Use this to generate a series of import statements for your Python code.

The imports are generated using the VTK modules, along with the VTK classes and constants in your Python source file(s). For older versions of VTK, modules.json is required, this is found in your VTK build directory.

When this script is run against your code, a series of from ... import statements are generated, based on the classes you have used. The result will be output to the console, or, alternatively to a text file with extension .txt. The first line is the program name and subsequent lines are the import statements.

At the end of the list there is a series of commented out statements consisting of imports that you may need to enable. Only enable the ones you really need and include the statement # noinspection PyUnresolvedReferences for PyCharm users, as this will prevent the statement from being removed.

e.g The most common ones will be:

    # noinspection PyUnresolvedReferences\n    import vtkmodules.vtkInteractionStyle\n    # noinspection PyUnresolvedReferences\n    import vtkmodules.vtkRenderingOpenGL2\n

Make sure that any of these statements are placed after the last from ... import ... statement. Also remove any unused ones.

As an example, if you have used import vtk, you can replace it with with these statements. This means that only the relevant VTK modules are loaded when the Python program runs.

Of course after adding these statements you may need to edit your code e.g. changing x = vtk.vtkSomeClass() to x = vtkSomeClass().

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/VTKImportsForPython/#code","title":"Code","text":"

VTKImportsForPython.py

#!/usr/bin/env python\n\nimport collections\nimport importlib\nimport json\nimport re\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonCore import vtkVersion\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Generate import statements for the VTK classes in your Python code.'\n    epilogue = '''\nThe output will contain program name(s) followed by the import statements.\nYou can specify a folder for the Python sources or paths to several sources.\n\nNote: If there are spaces in the paths, enclose the path in quotes.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('-j', '--json',\n                        help='The path to the VTK JSON file (modules.json).')\n    parser.add_argument('sources', nargs='+', help='The path to a folder of Python files or to a Python file.')\n    parser.add_argument('-f', '--file', help='The file name to write the output too.')\n    args = parser.parse_args()\n    return args.json, args.sources, args.file\n\n\nclass Patterns:\n    vtk_patterns = [\n        # Class pattern.\n        re.compile(r'(vtk[a-zA-Z0-9]+)\\('),\n        # Constants pattern.\n        re.compile(r'(VTK_[A-Z_]+)'),\n        # Special patterns ...\n        re.compile(r'(mutable)\\('),\n        # Handle vtkClass.yyy\n        re.compile(r'(vtk[a-zA-Z0-9]+)\\.'),\n        # Handle class xx(vtkClass):\n        re.compile(r'\\( ?(vtk[a-zA-Z0-9]+) ?\\)'),\n    ]\n    skip_patterns = [\n        # Empty lines\n        re.compile(r'^ *$'),\n        # import ...\n        re.compile(r'^ *import'),\n        # from ... import ...\n        re.compile(r'^ *from[ \\S]+import'),\n        # Any vtk class on its own\n        re.compile(r'^ *vtk[a-zA-Z0-9]+,*$'),\n        # Single closing bracket\n        re.compile(r'^ *\\)+$'),\n    ]\n\n\ndef get_available_modules(jpath):\n    \"\"\"\n    From the parsed JSON data file make a list of the VTK modules.\n\n    :param jpath: The JSON file path.\n    :return: VTK Classes and modules.\n    \"\"\"\n    with open(jpath) as data_file:\n        json_data = json.load(data_file)\n\n    res = list()\n    for k in json_data['modules'].keys():\n        m = k.split('::')\n        if len(m) > 1:\n            res.append(f'vtk{m[1]}')\n    return sorted(res)\n\n\ndef get_classes_constants(paths):\n    \"\"\"\n    Extract the vtk class names and constants from the path.\n\n    :param paths: The path(s) to the Python file(s).\n    :return: The file name, the VTK classes and any VTK constants.\n    \"\"\"\n\n    res = collections.defaultdict(set)\n    for path in paths:\n        content = path.read_text().split('\\n')\n        for line in content:\n            for pattern in Patterns.skip_patterns:\n                m = pattern.search(line)\n                if m:\n                    continue\n            for pattern in Patterns.vtk_patterns:\n                m = pattern.search(line)\n                if m:\n                    for g in m.groups():\n                        res[str(path)].add(g)\n    return res\n\n\ndef format_imports(imports):\n    name_keys = sorted(imports.keys())\n    res = list()\n    for name in name_keys:\n        res.append(f'\\n{name}')\n        module_keys = sorted(imports[name].keys())\n        for module in module_keys:\n            classes = sorted(list(imports[name][module]))\n            if len(classes) == 1:\n                res.append(f'from vtkmodules.{module} import {classes[0]}')\n            else:\n                c_list = list()\n                for c in classes:\n                    c_list.append(f'    {c}')\n                s = '(\\n'\n                s += ',\\n'.join(c_list)\n                s += '\\n    )'\n                res.append(f'from vtkmodules.{module} import {s}')\n        additional_modules = ['vtkInteractionStyle', 'vtkRenderingFreeType',\n                              'vtkRenderingContextOpenGL2', 'vtkRenderingOpenGL2', 'vtkRenderingVolumeOpenGL2',\n                              'vtkRenderingUI']\n        comments = [\n            '',\n            '# You may need to uncomment one or more of the following imports.',\n            '# If vtkRenderWindow is used and you want to use OpenGL,',\n            '#   you also need the vtkRenderingOpenGL2 module.',\n            '# If vtkRenderWindowInteractor is used, uncomment vtkInteractionStyle',\n            '# If text rendering is used, uncomment vtkRenderingFreeType.',\n            '#',\n            '# If using PyCharm, preface each one you select with this line:',\n            '# noinspection PyUnresolvedReferences',\n            '#',\n        ]\n        res += comments\n        for module in sorted(additional_modules):\n            res.append(f'# import vtkmodules.{module}')\n        res.append('')\n    return res\n\n\ndef main(json_path, src_paths, ofn):\n    use_json = not vtk_version_ok(9, 0, 20210918)\n    if use_json:\n        if not json_path:\n            print('modules.json (from your VTK build directory) is needed.')\n            return\n        jpath = Path(json_path)\n        if jpath.is_dir():\n            jpath = jpath / 'modules.json'\n        if not jpath.is_file():\n            print(f'Non existent JSON file: {jpath}')\n    else:\n        jpath = None\n\n    paths = list()\n    for fn in src_paths:\n        path = Path(fn)\n        if path.is_file() and path.suffix == '.py':\n            paths.append(path)\n        elif path.is_dir():\n            path_list = list(Path(fn).rglob('*.py'))\n            program_path = Path(__file__)\n            for path in path_list:\n                if path.resolve() != program_path.resolve():\n                    paths.append(path)\n        else:\n            print(f'Non existent path: {path}')\n\n    classes_constants = get_classes_constants(paths)\n    if not classes_constants:\n        print('No classes or constants were present.')\n        return\n\n    if use_json:\n        vtk_modules = get_available_modules(jpath)\n    else:\n        vtklib = importlib.__import__('vtkmodules')\n        vtk_modules = sorted(vtklib.__all__)\n\n    name_to_module = dict()\n    for module in vtk_modules:\n        try:\n            module_dict = importlib.import_module('vtkmodules.' + module).__dict__\n            for name in module_dict:\n                name_to_module[name] = module\n        except ModuleNotFoundError:\n            # print(module, ' not found.')\n            continue\n\n    imports = collections.defaultdict(lambda: collections.defaultdict(set))\n    for name, classes_constants in classes_constants.items():\n        for vtk_class in classes_constants:\n            if vtk_class in name_to_module:\n                module = name_to_module[vtk_class]\n                imports[name][module].add(vtk_class)\n\n    res = format_imports(imports)\n    if ofn:\n        path = Path(ofn)\n        if path.suffix == '':\n            path = Path(ofn).with_suffix('.txt')\n        path.write_text('\\n'.join(res))\n    else:\n        print('\\n'.join(res))\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    import sys\n\n    json_path, src_paths, ofn = get_program_parameters(sys.argv)\n    main(json_path, src_paths, ofn)\n
"},{"location":"Python/Utilities/VTKModulesForCxx/","title":"VTKModulesForCxx","text":"

vtk-examples/Python/Utilities/VTKModulesForCxx

"},{"location":"Python/Utilities/VTKModulesForCxx/#description","title":"Description","text":"

Use this to generate a find_package(VTK COMPONENTS ...) command for CMake.

It requires modules.json, found in your VTK build folder, and your source files. After running, it will generate a find_package(VTK COMPONENTS ...) command listing all the vtk modules needed by the C++ source and header files in your code.

Paths for more than one source path can be specified. If there are spaces in the paths, enclose the path in quotes.

If it is unable to find modules for your headers then a list of these, along with the files they are in, is produced so you can manually add the corresponding modules or rebuild VTK to include the missing modules.

You will need to manually add any third-party modules (if used) to the find_package command.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/VTKModulesForCxx/#code","title":"Code","text":"

VTKModulesForCxx.py

#!/usr/bin/env python\n\nimport collections\nimport json\nimport os\nimport re\nfrom pathlib import Path\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Generate a find_package(VTK COMPONENTS ...) command for CMake.'\n    epilogue = '''\nUses modules.json and your source files to generate a\n  find_package(VTK COMPONENTS ...) command listing all the vtk modules\n  needed by the C++ source and header files in your code.\n\nPaths for more than one source path can be specified.\n\nNote than if there are spaces in the paths, enclose the path in quotes.\n\nIf it is unable to find modules for your headers then\n  a list of these, along with the files they are in, is produced\n  so you can manually add the corresponding modules or rebuild VTK\n  to include the missing modules.\n\nYou will need to manually add any third-party modules\n   (if used) to the find_package command.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('json', default=['modules.json'], help='The path to the VTK JSON file (modules.json).')\n    parser.add_argument('sources', nargs='+', help='The path to the source files.')\n    parser.add_argument('-f', '--file', help='The file name to write the output too.')\n    args = parser.parse_args()\n    return args.json, args.sources, args.file\n\n\nclass Patterns:\n    header_pattern = re.compile(r'^#include *[<\\\"](\\S+)[>\\\"]')\n    vtk_include_pattern = re.compile(r'^(vtk\\S+)')\n    vtk_qt_include_pattern = re.compile(r'^(QVTK\\S+)')\n\n\ndef get_headers_modules(json_data):\n    \"\"\"\n    From the parsed JSON data file make a dictionary whose key is the\n     header filename and value is the module.\n    :param json_data: The parsed JSON file modules.json.\n    :return:\n    \"\"\"\n\n    # The headers should be unique to a module, however we will not assume this.\n    res = collections.defaultdict(set)\n    for k, v in json_data['modules'].items():\n        if 'headers' in v:\n            for k1 in v['headers']:\n                res[k1].add(k)\n    return res\n\n\ndef get_vtk_components(jpath, paths):\n    \"\"\"\n    Get the VTK components\n    :param jpath: The path to the JSON file.\n    :param paths: The C++ file paths.\n    :return:\n    \"\"\"\n\n    with open(jpath) as data_file:\n        json_data = json.load(data_file)\n    vtk_headers_modules = get_headers_modules(json_data)\n\n    modules = set()\n    inc_no_mod = set()\n    inc_no_mod_headers = collections.defaultdict(set)\n    mod_implements = collections.defaultdict(set)\n    headers = collections.defaultdict(set)\n\n    for path in paths:\n        if path.is_file():\n            content = path.read_text().split('\\n')\n            for line in content:\n                m = Patterns.header_pattern.match(line.strip())\n                if m:\n                    # We have a header name, split it from its path (if the path exists).\n                    header_parts = os.path.split(m.group(1))\n                    m = Patterns.vtk_include_pattern.match(header_parts[1])\n                    if m:\n                        headers[m.group(1)].add(path)\n                        continue\n                    m = Patterns.vtk_qt_include_pattern.match(header_parts[1])\n                    if m:\n                        headers[m.group(1)].add(path)\n    for incl in headers:\n        if incl in vtk_headers_modules:\n            m = vtk_headers_modules[incl]\n            for v in m:\n                modules.add(v)\n        else:\n            inc_no_mod.add(incl)\n            inc_no_mod_headers[incl] = headers[incl]\n\n    if headers:\n        for m in modules:\n            if not json_data['modules'][m]['implementable']:\n                continue\n            for i in json_data['modules']:\n                if i in modules:\n                    continue\n                if m in json_data['modules'][i]['implements']:\n                    # Suggest module i since it implements m\n                    mod_implements[i].add(m)\n\n    return modules, mod_implements, inc_no_mod, inc_no_mod_headers\n\n\ndef disp_components(modules, module_implements):\n    \"\"\"\n    For the found modules display them in a form that the user can\n     copy/paste into their CMakeLists.txt file.\n    :param modules: The modules.\n    :param module_implements: Modules implementing other modules.\n    :return:\n    \"\"\"\n    res = ['find_package(VTK\\n COMPONENTS']\n    for m in sorted(modules):\n        res.append('    {:s}'.format(m.split('::')[1]))\n    if module_implements:\n        keys = sorted(module_implements)\n        max_width = len(max(keys, key=len).split('::')[1])\n        comments = [\n            '    #',\n            '    # These modules are suggested since they implement an existing module.',\n            '    # You may need to uncomment one or more of these.',\n            '    # If vtkRenderWindow is used and you want to use OpenGL,',\n            '    #   you also need the RenderingOpenGL2 module.',\n            '    # If vtkRenderWindowInteractor is used,',\n            '    #    uncomment RenderingUI and possibly InteractionStyle.',\n            '    # If text rendering is used, uncomment RenderingFreeType',\n            '    #'\n        ]\n        res.extend(comments)\n        for key in keys:\n            res.append(\n                f'    # {key.split(\"::\")[1]:<{max_width}} # implements {\", \".join(sorted(module_implements[key]))}')\n    res.append(')\\n')\n\n    return res\n\n\ndef disp_missing_components(inc_no_mod, inc_no_mod_headers):\n    \"\"\"\n    Display the headers along with the missing VTK modules.\n\n    :param inc_no_mod: Missing modules.\n    :param inc_no_mod_headers: Headers with missing modules.\n    :return:\n    \"\"\"\n    if inc_no_mod:\n        res = [''\n               '*' * 64,\n               'You will need to manually add the modules that',\n               '  use these headers to the find_package command.',\n               'These could be external modules not in the modules.json file.',\n               'Or you may need to rebuild VTK to include the missing modules.',\n               '',\n               'Here are the vtk headers and corresponding files:']\n        sinmd = sorted(inc_no_mod)\n        for i in sinmd:\n            sh = sorted(list(inc_no_mod_headers[i]))\n            res.append(f'in {i}:')\n            for j in sh:\n                res.append(f'   {j}')\n        res.append('*' * 64)\n\n        return res\n    else:\n        return None\n\n\ndef main(json_path, src_paths, ofn):\n    jpath = Path(json_path)\n    if jpath.is_dir():\n        jpath = jpath / 'modules.json'\n    if not jpath.is_file():\n        print(f'Non existent JSON file: {jpath}')\n        return\n\n    paths = list()\n    valid_ext = ['.h', '.hxx', '.cxx', '.cpp', '.txx']\n    path_list = list()\n    for fn in src_paths:\n        path = Path(fn)\n        if path.is_file() and path.suffix in valid_ext:\n            paths.append(path)\n        elif path.is_dir():\n            for e in valid_ext:\n                path_list += list(Path(fn).rglob(f'*{e}'))\n            program_path = Path(__file__)\n            for path in path_list:\n                if path.resolve() != program_path.resolve():\n                    paths.append(path)\n        else:\n            print(f'Non existent path: {path}')\n\n    modules, mod_implements, inc_no_mod, inc_no_mod_headers = get_vtk_components(jpath, paths)\n\n    res = '\\n'.join(disp_components(modules, mod_implements))\n    if inc_no_mod:\n        res += '\\n'.join(disp_missing_components(inc_no_mod, inc_no_mod_headers))\n\n    if ofn:\n        path = Path(ofn)\n        if path.suffix == '':\n            path = Path(ofn).with_suffix('.txt')\n        path.write_text(res)\n    else:\n        print(res)\n\n\nif __name__ == '__main__':\n    import sys\n\n    json_paths, src_paths, ofn = get_program_parameters(sys.argv)\n    main(json_paths, src_paths, ofn)\n
"},{"location":"Python/Utilities/VTKWithNumpy/","title":"VTKWithNumpy","text":"

vtk-examples/Python/Utilities/VTKWithNumpy

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/VTKWithNumpy/#code","title":"Code","text":"

VTKWithNumpy.py

# An example from scipy cookbook demonstrating the use of numpy arrays in vtk\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPiecewiseFunction\nfrom vtkmodules.vtkIOImage import vtkImageImport\nfrom vtkmodules.vtkRenderingCore import (\n    vtkColorTransferFunction,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkVolume,\n    vtkVolumeProperty\n)\nfrom vtkmodules.vtkRenderingVolume import vtkFixedPointVolumeRayCastMapper\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkRenderingVolumeOpenGL2 import vtkOpenGLRayCastImageDisplayHelper\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # We begin by creating the data we want to render.\n    # For this tutorial, we create a 3D-image containing three overlaping cubes.\n    # This data can of course easily be replaced by data from a medical CT-scan or anything else three dimensional.\n    # The only limit is that the data must be reduced to unsigned 8 bit or 16 bit integers.\n    data_matrix = np.zeros([75, 75, 75], dtype=np.uint8)\n    data_matrix[0:35, 0:35, 0:35] = 50\n    data_matrix[25:55, 25:55, 25:55] = 100\n    data_matrix[45:74, 45:74, 45:74] = 150\n\n    # For VTK to be able to use the data, it must be stored as a VTK-image.\n    #  This can be done by the vtkImageImport-class which\n    # imports raw data and stores it.\n    dataImporter = vtkImageImport()\n    # The previously created array is converted to a string of chars and imported.\n    data_string = data_matrix.tobytes()\n    dataImporter.CopyImportVoidPointer(data_string, len(data_string))\n    # The type of the newly imported data is set to unsigned char (uint8)\n    dataImporter.SetDataScalarTypeToUnsignedChar()\n    # Because the data that is imported only contains an intensity value\n    #  (it isnt RGB-coded or someting similar), the importer must be told this is the case.\n    dataImporter.SetNumberOfScalarComponents(1)\n    # The following two functions describe how the data is stored and the dimensions of the array it is stored in.\n    #  For this simple case, all axes are of length 75 and begins with the first element.\n    #  For other data, this is probably not the case.\n    # I have to admit however, that I honestly dont know the difference between SetDataExtent()\n    #  and SetWholeExtent() although VTK complains if not both are used.\n    dataImporter.SetDataExtent(0, 74, 0, 74, 0, 74)\n    dataImporter.SetWholeExtent(0, 74, 0, 74, 0, 74)\n\n    # The following class is used to store transparency-values for later retrival.\n    #  In our case, we want the value 0 to be\n    # completely opaque whereas the three different cubes are given different transparency-values to show how it works.\n    alphaChannelFunc = vtkPiecewiseFunction()\n    alphaChannelFunc.AddPoint(0, 0.0)\n    alphaChannelFunc.AddPoint(50, 0.05)\n    alphaChannelFunc.AddPoint(100, 0.1)\n    alphaChannelFunc.AddPoint(150, 0.2)\n\n    # This class stores color data and can create color tables from a few color points.\n    #  For this demo, we want the three cubes to be of the colors red green and blue.\n    colorFunc = vtkColorTransferFunction()\n    colorFunc.AddRGBPoint(50, 1.0, 0.0, 0.0)\n    colorFunc.AddRGBPoint(100, 0.0, 1.0, 0.0)\n    colorFunc.AddRGBPoint(150, 0.0, 0.0, 1.0)\n\n    # The previous two classes stored properties.\n    #  Because we want to apply these properties to the volume we want to render,\n    # we have to store them in a class that stores volume properties.\n    volumeProperty = vtkVolumeProperty()\n    volumeProperty.SetColor(colorFunc)\n    volumeProperty.SetScalarOpacity(alphaChannelFunc)\n\n    volumeMapper = vtkFixedPointVolumeRayCastMapper()\n    volumeMapper.SetInputConnection(dataImporter.GetOutputPort())\n\n    # The class vtkVolume is used to pair the previously declared volume as well as the properties\n    #  to be used when rendering that volume.\n    volume = vtkVolume()\n    volume.SetMapper(volumeMapper)\n    volume.SetProperty(volumeProperty)\n\n    # With almost everything else ready, its time to initialize the renderer and window, as well as\n    #  creating a method for exiting the application\n    renderer = vtkRenderer()\n    renderWin = vtkRenderWindow()\n    renderWin.AddRenderer(renderer)\n    renderInteractor = vtkRenderWindowInteractor()\n    renderInteractor.SetRenderWindow(renderWin)\n\n    # We add the volume to the renderer ...\n    renderer.AddVolume(volume)\n    renderer.SetBackground(colors.GetColor3d(\"MistyRose\"))\n\n    # ... and set window size.\n    renderWin.SetSize(400, 400)\n    renderWin.SetWindowName('VTKWithNumpy')\n\n    # A simple function to be called when the user decides to quit the application.\n    def exitCheck(obj, event):\n        if obj.GetEventPending() != 0:\n            obj.SetAbortRender(1)\n\n    # Tell the application to use the function as an exit check.\n    renderWin.AddObserver(\"AbortCheckEvent\", exitCheck)\n\n    renderInteractor.Initialize()\n    # Because nothing will be rendered without any input, we order the first render manually\n    #  before control is handed over to the main-loop.\n    renderWin.Render()\n    renderInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Utilities/Variant/","title":"Variant","text":"

vtk-examples/Python/Utilities/Variant

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Utilities/Variant/#code","title":"Code","text":"

Variant.py

from __future__ import print_function\n\nimport sys\n\nimport vtkmodules.all as vtk\n\n# Unicode string for demonstration (etre with circumflex)\nif sys.hexversion >= 0x03000000:\n    unicodeEtre = '\\xeatre'  # unicode in Python 3\nelse:\n    unicodeEtre = unicode('\\xeatre', 'latin1')  # noqa: F821\n\n#\n# Basic vtkVariant usage\n#\n\n# Default constructor\nv = vtk.vtkVariant()\nprint(\"Invalid variant: %r, '%s'\" % (v, v.GetTypeAsString()))\n\n# Copy constructor\nv = vtk.vtkVariant(vtk.vtkVariant(\"variant\"))\nprint(\"Copied variant: %r, '%s'\" % (v, v.GetTypeAsString()))\n\n# Conversion constructors\nv = vtk.vtkVariant(1)\nprint(\"Integer variant: %r, '%s'\" % (v, v.GetTypeAsString()))\nv = vtk.vtkVariant(1.0)\nprint(\"Float variant: %r, '%s'\" % (v, v.GetTypeAsString()))\nv = vtk.vtkVariant(\"hello\")\nprint(\"String variant: %r, '%s'\" % (v, v.GetTypeAsString()))\nv = vtk.vtkVariant(unicodeEtre)\nprint(\"Unicode variant: %r, '%s'\" % (v, v.GetTypeAsString()))\nv = vtk.vtkVariant(vtk.vtkStringArray())\nprint(\"Object variant: %r, '%s'\" % (v, v.GetTypeAsString()))\n\n# Explicit type constructor\nv1 = vtk.vtkVariant(1, vtk.VTK_UNSIGNED_SHORT)\nv2 = vtk.vtkVariant(2, v1.GetType())\nprint(\"UShort variant: %r, '%s'\" % (v2, v2.GetTypeAsString()))\n\n# Type checking\nif v2.IsUnsignedShort():\n    print(\"v2 is UnsignedShort\")\nelse:\n    print(\"v2 is not UnsignedShort, it is\", v2.GetTypeAsString())\n\n# Explicit value extraction\ns = v2.ToString()\nprint(\"String value: %s, %s\" % (s, type(s)))\ni = v2.ToInt()\nprint(\"Int value: %i, %s\" % (i, type(i)))\n\n# Automatic argument conversion\na = vtk.vtkVariantArray()\na.InsertNextValue(vtk.vtkVariant())\na.InsertNextValue(1)\na.InsertNextValue(2.0)\na.InsertNextValue(\"hello\")\na.InsertNextValue(unicodeEtre)\na.InsertNextValue(vtk.vtkVariantArray())\nprint(\"Variant array:\")\nfor i in range(a.GetNumberOfValues()):\n    v = a.GetValue(i)\n    print(\"%i: %r, '%s'\" % (i, v, v.GetTypeAsString()))\n\n# Comparison\nif v2 == vtk.vtkVariant(2):\n    print(\"v2 is equal to 2\")\nif v2 > vtk.vtkVariant(1):\n    print(\"v2 is greater than 1\")\nif v2 < vtk.vtkVariant(3):\n    print(\"v2 is less than 3\")\nif v2 == vtk.vtkVariant(\"2\"):\n    print(\"v2 is equal to '2'\")\n\n# Use as a dict key (hashed as a string)\nd = {}\nd[vtk.vtkVariant(1)] = 0\nd[vtk.vtkVariant('1')] = 1\nd[vtk.vtkVariant()] = 3\nprint(\"Index is %i\" % d[vtk.vtkVariant(1.0)])\n\n#\n# Extra functionality from vtk.util.vtkVariant\n#\n# These are templated functions in C++, but in Python\n# they take the template arg as a string instead,\n# e.g. vtkVariantCreate<unsigned int>(1) becomes\n#      vtkVariantCreate(1, 'unsigned int')\n\n# Creation\nv = vtk.vtkVariantCreate(1, 'unsigned int')\n\n# Value extraction\nv = vtk.vtkVariant(6.0)\nf = vtk.vtkVariantExtract(v)\n\n# Value extraction with type specified\nf = vtk.vtkVariantExtract(v, 'double')\n\n# Casting a variant\nv = vtk.vtkVariant(\"10\")\ni = vtk.vtkVariantCast(v, 'int')\nprint(\"Valid cast result: %r\" % i)\n\n# A failed cast returns None\nv = vtk.vtkVariant(\"hello\")\ni = vtk.vtkVariantCast(v, 'int')\nprint(\"Invalid cast result: %r\" % i)\n\n#\n# Comparisons and sorting: See VTK docs for more info\n#\n\n# Special function vtk.vtkVariantStrictWeakOrder:\n# Compare variants by type first, and then by value.  For Python 2, the\n# return values are -1, 0, 1 like the Python 2 \"cmp()\" method.  This is\n# in contrast with the Python 3 and C++ versions of this function, which\n# check if (v1 < v2) and return True or False.\nv1 = vtk.vtkVariant(10)\nv2 = vtk.vtkVariant(\"10\")\nr = vtk.vtkVariantStrictWeakOrder(v1, v2)\nprint(\"Strict weak order (10, '10') ->\", r)\n\n# Sorting by strict weak order, using a key function:\nunsorted = [1, 2.5, vtk.vtkVariant(), \"0\", unicodeEtre]\nl = [vtk.vtkVariant(x) for x in unsorted]\nl.sort(key=vtk.vtkVariantStrictWeakOrderKey)\nprint(\"Sort by weak order ->\", l)\n\n# Check two variants for strict equality of type and value.\nb = vtk.vtkVariantStrictEquality(v1, v2)\nprint(\"Strict equality (10, '10') -> %s\" % b)\n\n# Two special-purpose methods.\n# First is identical to (v1 < v2)\nb = vtk.vtkVariantLessThan(v1, v2)\n# Second is identical to (v1 == v2)\nb = vtk.vtkVariantEqual(v1, v2)\n
"},{"location":"Python/Visualization/AlphaFrequency/","title":"AlphaFrequency","text":"

vtk-examples/Python/Visualization/AlphaFrequency

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/AlphaFrequency/#code","title":"Code","text":"

AlphaFrequency.py

#!/usr/bin/env python\n\nimport re\nfrom collections import Counter\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersModeling import vtkLinearExtrusionFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Here we read the file keeping only the alpha characters\n    #  and calculate the frequency of each letter.\n    with open(fileName) as f:\n        freq = Counter()\n        for x in f:\n            remove_digits = re.sub('[\\d_]', '', x.strip().lower())\n            freq += Counter(re.findall('\\w', remove_digits, re.UNICODE))\n    maxFreq = max(list(freq.values()))\n    keys = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.lower())\n\n    #\n    # graphics stuff\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    #\n    # Setup letters\n    #\n    letters = list()\n    extrude = list()\n    mappers = list()\n    actors = list()\n    i = 0\n    for k in keys:\n        letters.append(vtkVectorText())\n        letters[i].SetText(k.upper())\n\n        extrude.append(vtkLinearExtrusionFilter())\n        extrude[i].SetInputConnection(letters[i].GetOutputPort())\n        extrude[i].SetExtrusionTypeToVectorExtrusion()\n        extrude[i].SetVector(0, 0, 1.0)\n        extrude[i].SetScaleFactor(float(freq[k]) / maxFreq * 2.50)\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[i].SetInputConnection(extrude[i].GetOutputPort())\n        mappers[i].ScalarVisibilityOff()\n\n        actors.append(vtkActor())\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('Peacock'))\n\n        if freq[k] <= 0:\n            actors[i].VisibilityOff()\n        ren.AddActor(actors[i])\n        i += 1\n\n    # Position the actors.\n    y = 0.0\n    for j in range(0, 2):\n        x = 0.0\n        for i in range(0, 13):\n            actors[j * 13 + i].SetPosition(x, y, 0.0)\n            x += 1.5\n        y += -3.0\n\n    ren.ResetCamera()\n    ren.SetBackground(colors.GetColor3d('Silver'))\n    ren.GetActiveCamera().Elevation(30.0)\n    ren.GetActiveCamera().Azimuth(-30.0)\n    ren.GetActiveCamera().Dolly(1.25)\n    ren.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('AlphaFrequency')\n\n    # Interact with the data.\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Linearly extruded fonts to show letter frequency in text.'\n    epilogue = '''\n    Any file containing text can be used. \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Gettysburg.txt.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/AnnotatedCubeActor/","title":"AnnotatedCubeActor","text":"

vtk-examples/Python/Visualization/AnnotatedCubeActor

"},{"location":"Python/Visualization/AnnotatedCubeActor/#description","title":"Description","text":"

The example demonstrates how to create and label an annotated cube actor.

To colour the individual cube faces, see: ColoredAnnotatedCube.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/AnnotatedCubeActor/#code","title":"Code","text":"

AnnotatedCubeActor.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkRenderingAnnotation import vtkAnnotatedCubeActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set up the renderer, window, and interactor.\n    #\n    ren = vtkRenderer()\n    ren.SetBackground(colors.GetColor3d('Wheat'))\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('AnnotatedCubeActor')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    cube = vtkAnnotatedCubeActor()\n    cube.SetFaceTextScale(2.0 / 3.0)\n\n    # Anatomic labelling.\n    #\n    cube.SetXPlusFaceText('A')\n    cube.SetXMinusFaceText('P')\n    cube.SetYPlusFaceText('L')\n    cube.SetYMinusFaceText('R')\n    cube.SetZPlusFaceText('S')\n    cube.SetZMinusFaceText('I')\n\n    # Change the vector text colors.\n    #\n    cube.GetTextEdgesProperty().SetColor(\n        colors.GetColor3d('Black'))\n    cube.GetTextEdgesProperty().SetLineWidth(4)\n\n    cube.GetXPlusFaceProperty().SetColor(\n        colors.GetColor3d('Turquoise'))\n    cube.GetXMinusFaceProperty().SetColor(\n        colors.GetColor3d('Turquoise'))\n    cube.GetYPlusFaceProperty().SetColor(\n        colors.GetColor3d('Mint'))\n    cube.GetYMinusFaceProperty().SetColor(\n        colors.GetColor3d('Mint'))\n    cube.GetZPlusFaceProperty().SetColor(\n        colors.GetColor3d('Tomato'))\n    cube.GetZMinusFaceProperty().SetColor(\n        colors.GetColor3d('Tomato'))\n\n    ren.AddActor(cube)\n\n    # Set up an interesting view.\n    #\n    camera = ren.GetActiveCamera()\n    camera.SetViewUp(0, 0, 1)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetPosition(4.5, 4.5, 2.5)\n    ren.ResetCamera()\n    camera.Dolly(1.0)\n    ren.ResetCameraClippingRange()\n\n    ren_win.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/AssignCellColorsFromLUT/","title":"AssignCellColorsFromLUT","text":"

vtk-examples/Python/Visualization/AssignCellColorsFromLUT

"},{"location":"Python/Visualization/AssignCellColorsFromLUT/#description","title":"Description","text":"

Demonstrates how to assign colors to cells in a vtkPolyData structure using lookup tables. Two techniques are demonstrated:

  1. Using a lookup table of predefined colors.
  2. Using a lookup table generated from a color transfer function.

The resultant display shows in the left-hand column, the cells in a plane colored by the two lookup tables and in the right-hand column, the same polydata that has been read in from a file demonstrating that the structures are identical.

The top row of the display uses the color transfer function to create a green to tan transition in a diverging color space. Note that the central square is white indicating the midpoint.

The bottom row of the display uses a lookup table of predefined colors.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/AssignCellColorsFromLUT/#code","title":"Code","text":"

AssignCellColorsFromLUT.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nDemonstrates how to assign colors to cells in a vtkPolyData structure using\n lookup tables.\nTwo techniques are demonstrated:\n1) Using a lookup table of predefined colors.\n2) Using a lookup table generated from a color transfer function.\n\nThe resultant display shows in the left-hand column, the cells in a plane\ncolored by the two lookup tables and in the right-hand column, the same\npolydata that has been read in from a file demonstrating that the structures\nare identical.\n\nThe top row of the display uses the color transfer function to create a\n green to tan transition in a diverging color space.\n Note that the central square is white indicating the midpoint.\nThe bottom row of the display uses a lookup table of predefined colors.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkUnsignedCharArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOXML import (\n    vtkXMLPolyDataReader,\n    vtkXMLPolyDataWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef MakeLUT(tableSize):\n    \"\"\"\n    Make a lookup table from a set of named colors.\n    :param: tableSize - The table size\n    :return: The lookup table.\n    \"\"\"\n    nc = vtkNamedColors()\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(tableSize)\n    lut.Build()\n\n    # Fill in a few known colors, the rest will be generated if needed\n    lut.SetTableValue(0, nc.GetColor4d(\"Black\"))\n    lut.SetTableValue(1, nc.GetColor4d(\"Banana\"))\n    lut.SetTableValue(2, nc.GetColor4d(\"Tomato\"))\n    lut.SetTableValue(3, nc.GetColor4d(\"Wheat\"))\n    lut.SetTableValue(4, nc.GetColor4d(\"Lavender\"))\n    lut.SetTableValue(5, nc.GetColor4d(\"Flesh\"))\n    lut.SetTableValue(6, nc.GetColor4d(\"Raspberry\"))\n    lut.SetTableValue(7, nc.GetColor4d(\"Salmon\"))\n    lut.SetTableValue(8, nc.GetColor4d(\"Mint\"))\n    lut.SetTableValue(9, nc.GetColor4d(\"Peacock\"))\n\n    return lut\n\n\ndef MakeLUTFromCTF(tableSize):\n    \"\"\"\n    Use a color transfer Function to generate the colors in the lookup table.\n    See: http://www.org/doc/nightly/html/classvtkColorTransferFunction.html\n    :param: tableSize - The table size\n    :return: The lookup table.\n    \"\"\"\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    # Green to tan.\n    ctf.AddRGBPoint(0.0, 0.085, 0.532, 0.201)\n    ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n    ctf.AddRGBPoint(1.0, 0.677, 0.492, 0.093)\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(tableSize)\n    lut.Build()\n\n    for i in range(0, tableSize):\n        rgb = list(ctf.GetColor(float(i) / tableSize)) + [1]\n        lut.SetTableValue(i, rgb)\n\n    return lut\n\n\ndef MakeCellData(tableSize, lut, colors):\n    \"\"\"\n    Create the cell data using the colors from the lookup table.\n    :param: tableSize - The table size\n    :param: lut - The lookup table.\n    :param: colors - A reference to a vtkUnsignedCharArray().\n    \"\"\"\n    for i in range(1, tableSize):\n        rgb = [0.0, 0.0, 0.0]\n        lut.GetColor(float(i) / (tableSize - 1), rgb)\n        ucrgb = list(map(int, [x * 255 for x in rgb]))\n        colors.InsertNextTuple3(ucrgb[0], ucrgb[1], ucrgb[2])\n        s = '[' + ', '.join(['{:0.6f}'.format(x) for x in rgb]) + ']'\n        print(s, ucrgb)\n\n\ndef main():\n    \"\"\"\n    :return: The render window interactor.\n    \"\"\"\n\n    nc = vtkNamedColors()\n\n    # Provide some geometry\n    resolution = 3\n\n    plane11 = vtkPlaneSource()\n    plane11.SetXResolution(resolution)\n    plane11.SetYResolution(resolution)\n\n    plane12 = vtkPlaneSource()\n    plane12.SetXResolution(resolution)\n    plane12.SetYResolution(resolution)\n\n    tableSize = max(resolution * resolution + 1, 10)\n\n    #  Force an update so we can set cell data\n    plane11.Update()\n    plane12.Update()\n\n    #  Get the lookup tables mapping cell data to colors\n    lut1 = MakeLUT(tableSize)\n    lut2 = MakeLUTFromCTF(tableSize)\n\n    colorData1 = vtkUnsignedCharArray()\n    colorData1.SetName('colors')  # Any name will work here.\n    colorData1.SetNumberOfComponents(3)\n    print('Using a lookup table from a set of named colors.')\n    MakeCellData(tableSize, lut1, colorData1)\n    # Then use SetScalars() to add it to the vtkPolyData structure,\n    # this will then be interpreted as a color table.\n    plane11.GetOutput().GetCellData().SetScalars(colorData1)\n\n    colorData2 = vtkUnsignedCharArray()\n    colorData2.SetName('colors')  # Any name will work here.\n    colorData2.SetNumberOfComponents(3)\n    print('Using a lookup table created from a color transfer function.')\n    MakeCellData(tableSize, lut2, colorData2)\n    plane12.GetOutput().GetCellData().SetScalars(colorData2)\n\n    # Set up actor and mapper\n    mapper11 = vtkPolyDataMapper()\n    mapper11.SetInputConnection(plane11.GetOutputPort())\n    # Now, instead of doing this:\n    # mapper11.SetScalarRange(0, tableSize - 1)\n    # mapper11.SetLookupTable(lut1)\n    # We can just use the color data that we created from the lookup table and\n    # assigned to the cells:\n    mapper11.SetScalarModeToUseCellData()\n    mapper11.Update()\n\n    mapper12 = vtkPolyDataMapper()\n    mapper12.SetInputConnection(plane12.GetOutputPort())\n    mapper12.SetScalarModeToUseCellData()\n    mapper12.Update()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName('pdlut.vtp')\n    writer.SetInputData(mapper11.GetInput())\n    # This is set so we can see the data in a text editor.\n    writer.SetDataModeToAscii()\n    writer.Write()\n    writer.SetFileName('pdctf.vtp')\n    writer.SetInputData(mapper12.GetInput())\n    writer.Write()\n\n    actor11 = vtkActor()\n    actor11.SetMapper(mapper11)\n    actor12 = vtkActor()\n    actor12.SetMapper(mapper12)\n\n    # Let's read in the data we wrote out.\n    reader1 = vtkXMLPolyDataReader()\n    reader1.SetFileName(\"pdlut.vtp\")\n\n    reader2 = vtkXMLPolyDataReader()\n    reader2.SetFileName(\"pdctf.vtp\")\n\n    mapper21 = vtkPolyDataMapper()\n    mapper21.SetInputConnection(reader1.GetOutputPort())\n    mapper21.SetScalarModeToUseCellData()\n    mapper21.Update()\n    actor21 = vtkActor()\n    actor21.SetMapper(mapper11)\n\n    mapper22 = vtkPolyDataMapper()\n    mapper22.SetInputConnection(reader2.GetOutputPort())\n    mapper22.SetScalarModeToUseCellData()\n    mapper22.Update()\n    actor22 = vtkActor()\n    actor22.SetMapper(mapper22)\n\n    # Define viewport ranges.\n    # (xmin, ymin, xmax, ymax)\n    viewport11 = [0.0, 0.0, 0.5, 0.5]\n    viewport12 = [0.0, 0.5, 0.5, 1.0]\n    viewport21 = [0.5, 0.0, 1.0, 0.5]\n    viewport22 = [0.5, 0.5, 1.0, 1.0]\n\n    # Set up the renderers.\n    ren11 = vtkRenderer()\n    ren12 = vtkRenderer()\n    ren21 = vtkRenderer()\n    ren22 = vtkRenderer()\n\n    # Setup the render windows\n    renWin = vtkRenderWindow()\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName('AssignCellColorsFromLUT');\n\n    renWin.AddRenderer(ren11)\n    renWin.AddRenderer(ren12)\n    renWin.AddRenderer(ren21)\n    renWin.AddRenderer(ren22)\n    ren11.SetViewport(viewport11)\n    ren12.SetViewport(viewport12)\n    ren21.SetViewport(viewport21)\n    ren22.SetViewport(viewport22)\n    ren11.SetBackground(nc.GetColor3d('MidnightBlue'))\n    ren12.SetBackground(nc.GetColor3d('MidnightBlue'))\n    ren21.SetBackground(nc.GetColor3d('MidnightBlue'))\n    ren22.SetBackground(nc.GetColor3d('MidnightBlue'))\n    ren11.AddActor(actor11)\n    ren12.AddActor(actor12)\n    ren21.AddActor(actor21)\n    ren22.AddActor(actor22)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    renWin.Render()\n\n    return iren\n\n\nif __name__ == '__main__':\n    requiredMajorVersion = 6\n    print(vtkVersion().GetVTKMajorVersion())\n    if vtkVersion().GetVTKMajorVersion() < requiredMajorVersion:\n        print(\"You need VTK Version 6 or greater.\")\n        print(\"The class vtkNamedColors is in VTK version 6 or greater.\")\n        exit(0)\n    iren = main()\n    iren.Start()\n
"},{"location":"Python/Visualization/BillboardTextActor3D/","title":"BillboardTextActor3D","text":"

vtk-examples/Python/Visualization/BillboardTextActor3D

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/BillboardTextActor3D/#code","title":"Code","text":"

BillboardTextActor3D.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkCommonCore import vtkCommand\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkBillboardTextActor3D,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # For testing\n    rng = vtkMinimalStandardRandomSequence()\n    # rng.SetSeed(8775070)\n    rng.SetSeed(5127)\n\n    # Create a renderer\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    # Create a render window\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetWindowName('BillboardTextActor3D')\n\n    # Create an interactor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(render_window)\n\n    # Create a sphere\n    sphere_source = vtkSphereSource()\n    sphere_source.SetCenter(0.0, 0.0, 0.0)\n    sphere_source.SetRadius(1.0)\n\n    min_r = -10.0\n    max_r = 10.0\n\n    for i in range(0, 10):\n        if i == 0:\n            # Create an actor representing the origin\n            mapper = vtkPolyDataMapper()\n            mapper.SetInputConnection(sphere_source.GetOutputPort())\n\n            actor = vtkActor()\n            actor.SetMapper(mapper)\n            actor.SetPosition(0, 0, 0)\n            actor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n\n            renderer.AddActor(actor)\n\n        # Create a mapper\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(sphere_source.GetOutputPort())\n\n        # Create an actor\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n        actor.SetPosition(0, 0, 0)\n        actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n        # Set up the text and add it to the renderer\n        text_actor = vtkBillboardTextActor3D()\n        text_actor.SetInput('')\n        text_actor.SetPosition(actor.GetPosition())\n        text_actor.GetTextProperty().SetFontSize(12)\n        text_actor.GetTextProperty().SetColor(colors.GetColor3d('Gold'))\n        text_actor.GetTextProperty().SetJustificationToCentered()\n\n        position = random_position(min_r, max_r, rng)\n        actor.SetPosition(position)\n        # If you want to use a callback, do this:\n        # observer = ActorCallback(text_actor)\n        # actor.AddObserver(vtkCommand.NoEvent, observer(actor))\n        # Otherwise do this:\n        label = f'{position[0]:0.3g}, {position[1]:0.3g}, {position[2]:0.3g}'\n        text_actor.SetPosition(position)\n        text_actor.SetInput(label)\n\n        renderer.AddActor(actor)\n        renderer.AddActor(text_actor)\n\n    render_window.Render()\n    render_window.SetWindowName('BillboardTextActor3D')\n    iren.Start()\n\n\nclass ActorCallback:\n    def __init__(self, text_actor):\n        self.text_actor = text_actor\n\n    def __call__(self, caller):\n        position = caller.GetPosition()\n        label = f'{position[0]:0.3g}, {position[1]:0.3g}, {position[2]:0.3g}'\n        self.text_actor.SetPosition(position)\n        self.text_actor.SetInput(label)\n\n\ndef random_position(min_r, max_r, rng):\n    p = list()\n    for i in range(0, 3):\n        p.append(rng.GetRangeValue(min_r, max_r))\n        rng.Next()\n    return p\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/BlobbyLogo/","title":"BlobbyLogo","text":"

vtk-examples/Python/Visualization/BlobbyLogo

"},{"location":"Python/Visualization/BlobbyLogo/#description","title":"Description","text":"

This is the blobby vtk logo described in chapter 12 of the VTK textbook. The example uses vtkAppendPolyData to combine three vtkPolyData. A vtkImplicitModeller creates a vtkImageData of the distnaces from the polydata triangles. vtkContourFilter extracts an isosurface representing an offset surface.

This examples uses the data src/Testing/Data/v.vtk, src/Testing/Data/t.vtk and src/Testing/Data/k.vtk.

Info

See Figure 12-13 in Chapter 12 the VTK Textbook.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/BlobbyLogo/#code","title":"Code","text":"

BlobbyLogo.py

#!/usr/bin/env python\n\n'''\n'''\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkContourFilter,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersHybrid import vtkImplicitModeller\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName1, fileName2, fileName3 = get_program_parameters()\n    aRenderer = vtkRenderer()\n    aRenderWindow = vtkRenderWindow()\n    aRenderWindow.AddRenderer(aRenderer)\n    anInteractor = vtkRenderWindowInteractor()\n    anInteractor.SetRenderWindow(aRenderWindow)\n    aRenderWindow.SetSize(300, 300)\n    aRenderWindow.SetWindowName('BlobbyLogo')\n\n    # Read the geometry file containing the letter v.\n    letterV = vtkPolyDataReader()\n    letterV.SetFileName(fileName1)\n\n    # Read the geometry file containing the letter t.\n    letterT = vtkPolyDataReader()\n    letterT.SetFileName(fileName2)\n\n    # Read the geometry file containing the letter k.\n    letterK = vtkPolyDataReader()\n    letterK.SetFileName(fileName3)\n\n    # Create a transform and transform filter for each letter.\n    VTransform = vtkTransform()\n    VTransformFilter = vtkTransformPolyDataFilter()\n    VTransformFilter.SetInputConnection(letterV.GetOutputPort())\n    VTransformFilter.SetTransform(VTransform)\n\n    TTransform = vtkTransform()\n    TTransformFilter = vtkTransformPolyDataFilter()\n    TTransformFilter.SetInputConnection(letterT.GetOutputPort())\n    TTransformFilter.SetTransform(TTransform)\n\n    KTransform = vtkTransform()\n    KTransformFilter = vtkTransformPolyDataFilter()\n    KTransformFilter.SetInputConnection(letterK.GetOutputPort())\n    KTransformFilter.SetTransform(KTransform)\n\n    # Now append them all.\n    appendAll = vtkAppendPolyData()\n    appendAll.AddInputConnection(VTransformFilter.GetOutputPort())\n    appendAll.AddInputConnection(TTransformFilter.GetOutputPort())\n    appendAll.AddInputConnection(KTransformFilter.GetOutputPort())\n\n    # Create normals.\n    logoNormals = vtkPolyDataNormals()\n    logoNormals.SetInputConnection(appendAll.GetOutputPort())\n    logoNormals.SetFeatureAngle(60)\n\n    # Map to rendering primitives.\n    logoMapper = vtkPolyDataMapper()\n    logoMapper.SetInputConnection(logoNormals.GetOutputPort())\n\n    # Now an actor.\n    logo = vtkActor()\n    logo.SetMapper(logoMapper)\n\n    # Now create an implicit model of the same letter.\n    blobbyLogoImp = vtkImplicitModeller()\n    blobbyLogoImp.SetInputConnection(appendAll.GetOutputPort())\n    blobbyLogoImp.SetMaximumDistance(.075)\n    blobbyLogoImp.SetSampleDimensions(64, 64, 64)\n    blobbyLogoImp.SetAdjustDistance(0.05)\n\n    # Extract an iso surface.\n    blobbyLogoIso = vtkContourFilter()\n    blobbyLogoIso.SetInputConnection(blobbyLogoImp.GetOutputPort())\n    blobbyLogoIso.SetValue(1, 1.5)\n\n    # Map to rendering primitives.\n    blobbyLogoMapper = vtkPolyDataMapper()\n    blobbyLogoMapper.SetInputConnection(blobbyLogoIso.GetOutputPort())\n    blobbyLogoMapper.ScalarVisibilityOff()\n\n    tomato = vtkProperty()\n    tomato.SetDiffuseColor(colors.GetColor3d('tomato'))\n    tomato.SetSpecular(.3)\n    tomato.SetSpecularPower(20)\n\n    banana = vtkProperty()\n    banana.SetDiffuseColor(colors.GetColor3d('banana'))\n    banana.SetDiffuse(.7)\n    banana.SetSpecular(.4)\n    banana.SetSpecularPower(20)\n\n    # Now an actor.\n    blobbyLogo = vtkActor()\n    blobbyLogo.SetMapper(blobbyLogoMapper)\n    blobbyLogo.SetProperty(banana)\n\n    # Position the letters.\n\n    VTransform.Translate(-16.0, 0.0, 12.5)\n    VTransform.RotateY(40)\n\n    KTransform.Translate(14.0, 0.0, 0.0)\n    KTransform.RotateY(-40)\n\n    # Move the polygonal letters to the front.\n    logo.SetProperty(tomato)\n    logo.SetPosition(0, 0, 6)\n\n    aRenderer.AddActor(logo)\n    aRenderer.AddActor(blobbyLogo)\n\n    aRenderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    aRenderWindow.Render()\n\n    # Interact with the data.\n    anInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Use implicit modeller to create the VTK logo.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename1', help='v.vtk')\n    parser.add_argument('filename2', help='t.vtk')\n    parser.add_argument('filename3', help='k.vtk')\n    args = parser.parse_args()\n    return args.filename1, args.filename2, args.filename3\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/Blow/","title":"Blow","text":"

vtk-examples/Python/Visualization/Blow

"},{"location":"Python/Visualization/Blow/#description","title":"Description","text":"

Extrusion blow molding process.

In the extrusion blow molding process, a material is extruded through an annular die to form a hollow cylinder. This cylinder is called a parison. Two mold halves are then closed on the parison, while at the same time the parison is inflated with air. Some of the parison material remains within the mold while some becomes waste material. The material is typically a polymer plastic softened with heat, but blow molding has been used to form metal parts. Plastic bottles are often manufactured using a blow molding process.

In this example the polymer was molded using an isothermal, nonlinear-elastic, incompressible (rubber-like) material. Triangular membrane finite elements were used to model the parison, while a combination of triangular and quadrilateral finite elements were used to model the mold. The mold surface is assumed to be rigid, and the parison is assumed to attach to the mold upon contact. Thus the thinning of the parison is controlled by its stretching during inflation and the sequence in which it contacts the mold.

Ten steps of the analysis are illustrated. The color of the parison indicates its thickness. Using a rainbow scale, red areas are thinnest while blue regions are thickest. Our visualization shows clearly one problem with the analysis technique we are using. Note that while the nodes (i.e., points) of the finite element mesh are prevented from passing through the mold, the interior of the triangular elements are not. This is apparent from the occlusion of the mold wireframe by the parison mesh.

You can also view the individual steps.

Info

See Figure 12-17 in Chapter 12 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/Blow/#code","title":"Code","text":"

Blow.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkConnectivityFilter,\n    vtkContourFilter,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpVector\nfrom vtkmodules.vtkFiltersGeometry import vtkGeometryFilter\nfrom vtkmodules.vtkIOLegacy import vtkDataSetReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName, dataPoint = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    thickness = list()\n    displacement = list()\n    for i in range(0, 10):\n        thickness.append('thickness' + str(i))\n        displacement.append('displacement' + str(i))\n\n    reader = list()\n    warp = list()\n    connect = list()\n    mold = list()\n    moldMapper = list()\n    moldActor = list()\n    connect2 = list()\n    parison = list()\n    normals2 = list()\n    parisonMapper = list()\n    parisonActor = list()\n    cf = list()\n    contourMapper = list()\n    contours = list()\n    ren = list()\n\n    lut = vtkLookupTable()\n    lut.SetHueRange(0.0, 0.66667)\n\n    for i in range(0, 10):\n        # Create the reader and warp the data vith vectors.\n        reader.append(vtkDataSetReader())\n        reader[i].SetFileName(fileName)\n        reader[i].SetScalarsName(thickness[i])\n        reader[i].SetVectorsName(displacement[i])\n        reader[i].Update()\n\n        warp.append(vtkWarpVector())\n        warp[i].SetInputData(reader[i].GetUnstructuredGridOutput())\n\n        # Extract the mold from the mesh using connectivity.\n        connect.append(vtkConnectivityFilter())\n        connect[i].SetInputConnection(warp[i].GetOutputPort())\n        connect[i].SetExtractionModeToSpecifiedRegions()\n        connect[i].AddSpecifiedRegion(0)\n        connect[i].AddSpecifiedRegion(1)\n        mold.append(vtkGeometryFilter())\n        mold[i].SetInputConnection(connect[i].GetOutputPort())\n        moldMapper.append(vtkDataSetMapper())\n        moldMapper[i].SetInputConnection(mold[i].GetOutputPort())\n        moldMapper[i].ScalarVisibilityOff()\n        moldActor.append(vtkActor())\n        moldActor[i].SetMapper(moldMapper[i])\n        moldActor[i].GetProperty().SetColor(colors.GetColor3d(\"ivory_black\"))\n        moldActor[i].GetProperty().SetRepresentationToWireframe()\n\n        # Extract the parison from the mesh using connectivity.\n        connect2.append(vtkConnectivityFilter())\n        connect2[i].SetInputConnection(warp[i].GetOutputPort())\n        connect2[i].SetExtractionModeToSpecifiedRegions()\n        connect2[i].AddSpecifiedRegion(2)\n        parison.append(vtkGeometryFilter())\n        parison[i].SetInputConnection(connect2[i].GetOutputPort())\n        normals2.append(vtkPolyDataNormals())\n        normals2[i].SetInputConnection(parison[i].GetOutputPort())\n        normals2[i].SetFeatureAngle(60)\n        parisonMapper.append(vtkPolyDataMapper())\n        parisonMapper[i].SetInputConnection(normals2[i].GetOutputPort())\n        parisonMapper[i].SetLookupTable(lut)\n        parisonMapper[i].SetScalarRange(0.12, 1.0)\n        parisonActor.append(vtkActor())\n        parisonActor[i].SetMapper(parisonMapper[i])\n\n        cf.append(vtkContourFilter())\n        cf[i].SetInputConnection(connect2[i].GetOutputPort())\n        cf[i].SetValue(0, 0.5)\n        contourMapper.append(vtkPolyDataMapper())\n        contourMapper[i].SetInputConnection(cf[i].GetOutputPort())\n        contours.append(vtkActor())\n        contours[i].SetMapper(contourMapper[i])\n\n        ren.append(vtkRenderer())\n        ren[i].AddActor(moldActor[i])\n        ren[i].AddActor(parisonActor[i])\n        ren[i].AddActor(contours[i])\n        ren[i].SetBackground(colors.GetColor3d(\"AliceBlue\"))\n        ren[i].GetActiveCamera().SetPosition(50.973277, 12.298821, 29.102547)\n        ren[i].GetActiveCamera().SetFocalPoint(0.141547, 12.298821, -0.245166)\n        ren[i].GetActiveCamera().SetViewUp(-0.500000, 0.000000, 0.866025)\n        ren[i].GetActiveCamera().SetClippingRange(36.640827, 78.614680)\n\n    # Create the RenderWindow and RenderWindowInteractor.\n    renWin = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    rendererSizeX = 750\n    rendererSizeY = 400\n    renWinScale = 0.5\n    renWin.SetWindowName(\"Blow\")\n    if 0 <= dataPoint < 10:\n        renWin.AddRenderer(ren[dataPoint])\n        renWin.SetSize(rendererSizeX, rendererSizeY)\n    else:\n        gridDimensionsX = 2\n        gridDimensionsY = 5\n        renWin.SetSize(int(rendererSizeX * gridDimensionsX * renWinScale),\n                       int(rendererSizeY * gridDimensionsY * renWinScale))\n        # Add and position the renders to the render window.\n        viewPort = list()\n        for row in range(0, gridDimensionsY):\n            for col in range(0, gridDimensionsX):\n                idx = row * gridDimensionsX + col\n                x0 = float(col) / gridDimensionsX\n                y0 = float(gridDimensionsY - row - 1) / gridDimensionsY\n                x1 = float(col + 1) / gridDimensionsX\n                y1 = float(gridDimensionsY - row) / gridDimensionsY\n                viewPort[:] = []\n                viewPort.append(x0)\n                viewPort.append(y0)\n                viewPort.append(x1)\n                viewPort.append(y1)\n                renWin.AddRenderer(ren[idx])\n                ren[idx].SetViewport(viewPort)\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce figure 12-17 from the VTK Textbook.'\n    epilogue = '''\n\n        It is a translation of the original blow.tcl.\n\n        data_point allows you to specify which frame is to be displayed.\n        If data_point < 0 or data_point > 9 all ten frames are then displayed.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='blow.vtk')\n    parser.add_argument('data_point', default=-1, type=int, nargs='?', help='The particular color scheme to use.')\n    args = parser.parse_args()\n    return args.filename, args.data_point\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/Camera/","title":"Camera","text":"

vtk-examples/Python/Visualization/Camera

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/Camera/#code","title":"Code","text":"

Camera.py

from vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(10)\n    sphereSource.SetPhiResolution(30)\n    sphereSource.SetThetaResolution(30)\n    sphereSource.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphereSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetSpecular(0.6)\n    actor.GetProperty().SetSpecularPower(30)\n    actor.GetProperty().SetColor(colors.GetColor3d('LightSkyBlue'))\n\n    camera = vtkCamera()\n    camera.SetPosition(0, 0, 100)\n    camera.SetFocalPoint(0, 0, 0)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderer.SetActiveCamera(camera)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('Camera')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('MistyRose'))\n\n    # Render and interact\n    renderWindowInteractor.Initialize()\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/CameraModel1/","title":"CameraModel1","text":"

vtk-examples/Python/Visualization/CameraModel1

"},{"location":"Python/Visualization/CameraModel1/#description","title":"Description","text":"

This example illustrates the camera movement around the focal point.

Note

For camera movement centered at the camera position see CameraModel2.

Note

This is an adaptation of the code written by Chung Kai Lun Pete.

Note

This example corresponds to Figure 3-12 in the VTK Text.

Info

See Figure 3-12 in Chapter 3 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/CameraModel1/#code","title":"Code","text":"

CameraModel1.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendFilter,\n    vtkContourFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkTransformFilter,\n    vtkTransformPolyDataFilter,\n    vtkWarpTo\n)\nfrom vtkmodules.vtkFiltersHybrid import vtkImplicitModeller\nfrom vtkmodules.vtkFiltersModeling import vtkRotationalExtrusionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextActor\n)\nfrom vtkmodules.vtkRenderingLOD import vtkLODActor\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the colors.\n    colors.SetColor('AzimuthArrowColor', [255, 77, 77, 255])\n    colors.SetColor('ElevationArrowColor', [77, 255, 77, 255])\n    colors.SetColor('RollArrowColor', [255, 255, 77, 255])\n    colors.SetColor('SpikeColor', [255, 77, 255, 255])\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    # Create a rendering window, renderer and interactor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create a camera model.\n    camCS = vtkConeSource()\n    camCS.SetHeight(1.5)\n    camCS.SetResolution(12)\n    camCS.SetRadius(0.4)\n\n    camCBS = vtkCubeSource()\n    camCBS.SetXLength(1.5)\n    camCBS.SetZLength(0.8)\n    camCBS.SetCenter(0.4, 0, 0)\n\n    camAPD = vtkAppendFilter()\n    camAPD.AddInputConnection(camCBS.GetOutputPort())\n    camAPD.AddInputConnection(camCS.GetOutputPort())\n\n    camMapper = vtkPolyDataMapper()\n    camMapper.SetInputConnection(camAPD.GetOutputPort())\n    camActor = vtkLODActor()\n    camActor.SetMapper(camMapper)\n    camActor.SetScale(2, 2, 2)\n\n    # Draw the arrows.\n    pd = vtkPolyData()\n    ca = vtkCellArray()\n    fp = vtkPoints()\n    fp.InsertNextPoint(0, 1, 0)\n    fp.InsertNextPoint(8, 1, 0)\n    fp.InsertNextPoint(8, 2, 0)\n    fp.InsertNextPoint(10, 0.01, 0)\n    fp.InsertNextPoint(8, -2, 0)\n    fp.InsertNextPoint(8, -1, 0)\n    fp.InsertNextPoint(0, -1, 0)\n    ca.InsertNextCell(7)\n    ca.InsertCellPoint(0)\n    ca.InsertCellPoint(1)\n    ca.InsertCellPoint(2)\n    ca.InsertCellPoint(3)\n    ca.InsertCellPoint(4)\n    ca.InsertCellPoint(5)\n    ca.InsertCellPoint(6)\n    pd.SetPoints(fp)\n    pd.SetPolys(ca)\n\n    pd2 = vtkPolyData()\n    ca2 = vtkCellArray()\n    fp2 = vtkPoints()\n    fp2.InsertNextPoint(0, 1, 0)\n    fp2.InsertNextPoint(8, 1, 0)\n    fp2.InsertNextPoint(8, 2, 0)\n    fp2.InsertNextPoint(10, 0.01, 0)\n    ca2.InsertNextCell(4)\n    ca2.InsertCellPoint(0)\n    ca2.InsertCellPoint(1)\n    ca2.InsertCellPoint(2)\n    ca2.InsertCellPoint(3)\n    pd2.SetPoints(fp2)\n    pd2.SetLines(ca2)\n\n    arrowIM = vtkImplicitModeller()\n    arrowIM.SetInputData(pd)\n    arrowIM.SetSampleDimensions(50, 20, 8)\n\n    arrowCF = vtkContourFilter()\n    arrowCF.SetInputConnection(arrowIM.GetOutputPort())\n    arrowCF.SetValue(0, 0.2)\n\n    arrowWT = vtkWarpTo()\n    arrowWT.SetInputConnection(arrowCF.GetOutputPort())\n    arrowWT.SetPosition(5, 0, 5)\n    arrowWT.SetScaleFactor(0.85)\n    arrowWT.AbsoluteOn()\n\n    arrowT = vtkTransform()\n    arrowT.RotateY(60)\n    arrowT.Translate(-1.33198, 0, -1.479)\n    arrowT.Scale(1, 0.5, 1)\n\n    arrowTF = vtkTransformFilter()\n    arrowTF.SetInputConnection(arrowWT.GetOutputPort())\n    arrowTF.SetTransform(arrowT)\n\n    arrowMapper = vtkDataSetMapper()\n    arrowMapper.SetInputConnection(arrowTF.GetOutputPort())\n    arrowMapper.ScalarVisibilityOff()\n\n    # Draw the azimuth arrows.\n    a1Actor = vtkLODActor()\n    a1Actor.SetMapper(arrowMapper)\n    a1Actor.RotateZ(180)\n    a1Actor.SetPosition(1, 0, -1)\n    a1Actor.GetProperty().SetColor(colors.GetColor3d('AzimuthArrowColor'))\n    a1Actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    a1Actor.GetProperty().SetSpecular(0.3)\n    a1Actor.GetProperty().SetSpecularPower(20)\n    a1Actor.GetProperty().SetAmbient(0.2)\n    a1Actor.GetProperty().SetDiffuse(0.8)\n\n    a2Actor = vtkLODActor()\n    a2Actor.SetMapper(arrowMapper)\n    a2Actor.RotateZ(180)\n    a2Actor.RotateX(180)\n    a2Actor.SetPosition(1, 0, 1)\n    a2Actor.GetProperty().SetColor(colors.GetColor3d('AzimuthArrowColor'))\n    a2Actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    a2Actor.GetProperty().SetSpecular(0.3)\n    a2Actor.GetProperty().SetSpecularPower(20)\n    a2Actor.GetProperty().SetAmbient(0.2)\n    a2Actor.GetProperty().SetDiffuse(0.8)\n\n    # Draw the elevation arrows.\n    a3Actor = vtkLODActor()\n    a3Actor.SetMapper(arrowMapper)\n    a3Actor.RotateZ(180)\n    a3Actor.RotateX(90)\n    a3Actor.SetPosition(1, -1, 0)\n    a3Actor.GetProperty().SetColor(colors.GetColor3d('ElevationArrowColor'))\n    a3Actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    a3Actor.GetProperty().SetSpecular(0.3)\n    a3Actor.GetProperty().SetSpecularPower(20)\n    a3Actor.GetProperty().SetAmbient(0.2)\n    a3Actor.GetProperty().SetDiffuse(0.8)\n\n    a4Actor = vtkLODActor()\n    a4Actor.SetMapper(arrowMapper)\n    a4Actor.RotateZ(180)\n    a4Actor.RotateX(-90)\n    a4Actor.SetPosition(1, 1, 0)\n    a4Actor.GetProperty().SetColor(colors.GetColor3d('ElevationArrowColor'))\n    a4Actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    a4Actor.GetProperty().SetSpecular(0.3)\n    a4Actor.GetProperty().SetSpecularPower(20)\n    a4Actor.GetProperty().SetAmbient(0.2)\n    a4Actor.GetProperty().SetDiffuse(0.8)\n\n    # Draw the DOP.\n    arrowT2 = vtkTransform()\n    arrowT2.Scale(1, 0.6, 1)\n    arrowT2.RotateY(90)\n\n    arrowTF2 = vtkTransformPolyDataFilter()\n    arrowTF2.SetInputData(pd2)\n    arrowTF2.SetTransform(arrowT2)\n\n    arrowREF = vtkRotationalExtrusionFilter()\n    arrowREF.SetInputConnection(arrowTF2.GetOutputPort())\n    arrowREF.CappingOff()\n    arrowREF.SetResolution(30)\n\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(arrowREF.GetOutputPort())\n\n    a5Actor = vtkLODActor()\n    a5Actor.SetMapper(spikeMapper)\n    a5Actor.SetScale(.3, .3, .6)\n    a5Actor.RotateY(90)\n    a5Actor.SetPosition(-2, 0, 0)\n    a5Actor.GetProperty().SetColor(colors.GetColor3d('SpikeColor'))\n    a5Actor.GetProperty().SetAmbient(0.2)\n    a5Actor.GetProperty().SetDiffuse(0.8)\n\n    # Focal point.\n    fps = vtkSphereSource()\n    fps.SetRadius(0.5)\n    fpMapper = vtkPolyDataMapper()\n    fpMapper.SetInputConnection(fps.GetOutputPort())\n    fpActor = vtkLODActor()\n    fpActor.SetMapper(fpMapper)\n    fpActor.SetPosition(-9, 0, 0)\n    fpActor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    fpActor.GetProperty().SetSpecular(0.3)\n    fpActor.GetProperty().SetAmbient(0.2)\n    fpActor.GetProperty().SetDiffuse(0.8)\n    fpActor.GetProperty().SetSpecularPower(20)\n\n    # Create the roll arrows.\n    arrowWT2 = vtkWarpTo()\n    arrowWT2.SetInputConnection(arrowCF.GetOutputPort())\n    arrowWT2.SetPosition(5, 0, 2.5)\n    arrowWT2.SetScaleFactor(0.95)\n    arrowWT2.AbsoluteOn()\n\n    arrowT3 = vtkTransform()\n    arrowT3.Translate(-2.50358, 0, -1.70408)\n    arrowT3.Scale(0.5, 0.3, 1)\n\n    arrowTF3 = vtkTransformFilter()\n    arrowTF3.SetInputConnection(arrowWT2.GetOutputPort())\n    arrowTF3.SetTransform(arrowT3)\n\n    arrowMapper2 = vtkDataSetMapper()\n    arrowMapper2.SetInputConnection(arrowTF3.GetOutputPort())\n    arrowMapper2.ScalarVisibilityOff()\n\n    # Draw the roll arrows.\n    a6Actor = vtkLODActor()\n    a6Actor.SetMapper(arrowMapper2)\n    a6Actor.RotateZ(90)\n    a6Actor.SetPosition(-4, 0, 0)\n    a6Actor.SetScale(1.5, 1.5, 1.5)\n    a6Actor.GetProperty().SetColor(colors.GetColor3d('RollArrowColor'))\n    a6Actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    a6Actor.GetProperty().SetSpecular(0.3)\n    a6Actor.GetProperty().SetSpecularPower(20)\n    a6Actor.GetProperty().SetAmbient(0.2)\n    a6Actor.GetProperty().SetDiffuse(0.8)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(camActor)\n    ren.AddActor(a1Actor)\n    ren.AddActor(a2Actor)\n    ren.AddActor(a3Actor)\n    ren.AddActor(a4Actor)\n    ren.AddActor(a5Actor)\n    ren.AddActor(a6Actor)\n    ren.AddActor(fpActor)\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CameraModel1')\n\n    # Render the image.\n\n    cam1 = (ren.GetActiveCamera())\n    ren.ResetCamera()\n    cam1.Azimuth(150)\n    cam1.Elevation(30)\n    cam1.Dolly(1.5)\n    ren.ResetCameraClippingRange()\n\n    # Create a TextActor for azimuth  (a1 and a2 actor's color).\n    text = vtkTextActor()\n    text.SetInput('Azimuth')\n    tprop = text.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a1Actor.GetProperty().GetColor())\n    text.SetDisplayPosition(20, 50)\n    ren.AddActor2D(text)\n\n    # Create a TextActor for elevation  (a3 and a4 actor's color).\n    text2 = vtkTextActor()\n    text2.SetInput('Elevation')\n    tprop = text2.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a3Actor.GetProperty().GetColor())\n    text2.SetDisplayPosition(20, 100)\n    ren.AddActor2D(text2)\n\n    # Create a TextActor for roll (a6 actor's color).\n    text3 = vtkTextActor()\n    text3.SetInput('Roll')\n    tprop = text3.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a6Actor.GetProperty().GetColor())\n    text3.SetDisplayPosition(20, 150)\n    ren.AddActor2D(text3)\n\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/CameraModel2/","title":"CameraModel2","text":"

vtk-examples/Python/Visualization/CameraModel2

"},{"location":"Python/Visualization/CameraModel2/#description","title":"Description","text":"

This example illustrates the camera movement centered at the camera position.

Note

For camera movement around the focal point see CameraModel1.

Note

This is an adaptation of the code written by Chung Kai Lun Pete.

Info

See Figure 3-13 in Chapter 3 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/CameraModel2/#code","title":"Code","text":"

CameraModel2.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkContourFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkTransformFilter,\n    vtkTransformPolyDataFilter,\n    vtkWarpTo\n)\nfrom vtkmodules.vtkFiltersHybrid import vtkImplicitModeller\nfrom vtkmodules.vtkFiltersModeling import vtkRotationalExtrusionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextActor\n)\nfrom vtkmodules.vtkRenderingLOD import vtkLODActor\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the colors.\n    colors.SetColor(\"AzimuthArrowColor\", [255, 77, 77, 255])\n    colors.SetColor(\"ElevationArrowColor\", [77, 255, 77, 255])\n    colors.SetColor(\"RollArrowColor\", [255, 255, 77, 255])\n    colors.SetColor(\"SpikeColor\", [255, 77, 255, 255])\n    colors.SetColor(\"UpSpikeColor\", [77, 255, 255, 255])\n\n    # Create a rendering window, renderer and interactor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create a camera model.\n    camCS = vtkConeSource()\n    camCS.SetHeight(1.5)\n    camCS.SetResolution(12)\n    camCS.SetRadius(0.4)\n\n    camCBS = vtkCubeSource()\n    camCBS.SetXLength(1.5)\n    camCBS.SetZLength(0.8)\n    camCBS.SetCenter(0.4, 0, 0)\n\n    camAPD = vtkAppendPolyData()\n    camAPD.AddInputConnection(camCBS.GetOutputPort())\n    camAPD.AddInputConnection(camCS.GetOutputPort())\n\n    camMapper = vtkPolyDataMapper()\n    camMapper.SetInputConnection(camAPD.GetOutputPort())\n    camActor = vtkLODActor()\n    camActor.SetMapper(camMapper)\n    camActor.SetScale(2, 2, 2)\n\n    # Draw the arrows.\n    pd = vtkPolyData()\n    ca = vtkCellArray()\n    pts = vtkPoints()\n    pts.InsertNextPoint(0, 1, 0)\n    pts.InsertNextPoint(8, 1, 0)\n    pts.InsertNextPoint(8, 2, 0)\n    pts.InsertNextPoint(10, 0, 0)\n    pts.InsertNextPoint(8, -2, 0)\n    pts.InsertNextPoint(8, -1, 0)\n    pts.InsertNextPoint(0, -1, 0)\n    ca.InsertNextCell(7)\n    ca.InsertCellPoint(0)\n    ca.InsertCellPoint(1)\n    ca.InsertCellPoint(2)\n    ca.InsertCellPoint(3)\n    ca.InsertCellPoint(4)\n    ca.InsertCellPoint(5)\n    ca.InsertCellPoint(6)\n    pd.SetPoints(pts)\n    pd.SetPolys(ca)\n\n    pd2 = vtkPolyData()\n    ca2 = vtkCellArray()\n    pts2 = vtkPoints()\n    pts2.InsertNextPoint(0, 1, 0)\n    pts2.InsertNextPoint(8, 1, 0)\n    pts2.InsertNextPoint(8, 2, 0)\n    pts2.InsertNextPoint(10, 0.01, 0)\n    ca2.InsertNextCell(4)\n    ca2.InsertCellPoint(0)\n    ca2.InsertCellPoint(1)\n    ca2.InsertCellPoint(2)\n    ca2.InsertCellPoint(3)\n    pd2.SetPoints(pts2)\n    pd2.SetLines(ca2)\n\n    arrowIM = vtkImplicitModeller()\n    arrowIM.SetInputData(pd)\n    arrowIM.SetSampleDimensions(50, 20, 8)\n\n    arrowCF = vtkContourFilter()\n    arrowCF.SetInputConnection(arrowIM.GetOutputPort())\n    arrowCF.SetValue(0, 0.2)\n\n    arrowWT = vtkWarpTo()\n    arrowWT.SetInputConnection(arrowCF.GetOutputPort())\n    arrowWT.SetPosition(5, 0, 5)\n    arrowWT.SetScaleFactor(0.85)\n    arrowWT.AbsoluteOn()\n\n    arrowT = vtkTransform()\n    arrowT.RotateY(60)\n    arrowT.Translate(-1.33198, 0, -1.479)\n    arrowT.Scale(1, 0.5, 1)\n\n    arrowTF = vtkTransformFilter()\n    arrowTF.SetInputConnection(arrowWT.GetOutputPort())\n    arrowTF.SetTransform(arrowT)\n\n    arrowMapper = vtkDataSetMapper()\n    arrowMapper.SetInputConnection(arrowTF.GetOutputPort())\n    arrowMapper.ScalarVisibilityOff()\n\n    # Draw the azimuth arrows.\n    a1Actor = vtkLODActor()\n    a1Actor.SetMapper(arrowMapper)\n    a1Actor.SetPosition(-9, 0, -1)\n    a1Actor.GetProperty().SetColor(colors.GetColor3d(\"AzimuthArrowColor\"))\n    a1Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a1Actor.GetProperty().SetSpecular(0.3)\n    a1Actor.GetProperty().SetSpecularPower(20)\n    a1Actor.GetProperty().SetAmbient(0.2)\n    a1Actor.GetProperty().SetDiffuse(0.8)\n\n    a2Actor = vtkLODActor()\n    a2Actor.SetMapper(arrowMapper)\n    a2Actor.RotateX(180)\n    a2Actor.SetPosition(-9, 0, 1)\n    a2Actor.GetProperty().SetColor(colors.GetColor3d(\"AzimuthArrowColor\"))\n    a2Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a2Actor.GetProperty().SetSpecular(0.3)\n    a2Actor.GetProperty().SetSpecularPower(20)\n    a2Actor.GetProperty().SetAmbient(0.2)\n    a2Actor.GetProperty().SetDiffuse(0.8)\n\n    # Draw the elevation arrows.\n    a3Actor = vtkLODActor()\n    a3Actor.SetMapper(arrowMapper)\n    a3Actor.RotateX(-90)\n    a3Actor.SetPosition(-9, -1, 0)\n    a3Actor.GetProperty().SetColor(colors.GetColor3d(\"ElevationArrowColor\"))\n    a3Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a3Actor.GetProperty().SetSpecular(0.3)\n    a3Actor.GetProperty().SetSpecularPower(20)\n    a3Actor.GetProperty().SetAmbient(0.2)\n    a3Actor.GetProperty().SetDiffuse(0.8)\n\n    a4Actor = vtkLODActor()\n    a4Actor.SetMapper(arrowMapper)\n    a4Actor.RotateX(90)\n    a4Actor.SetPosition(-9, 1, 0)\n    a4Actor.GetProperty().SetColor(colors.GetColor3d(\"ElevationArrowColor\"))\n    a4Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a4Actor.GetProperty().SetSpecular(0.3)\n    a4Actor.GetProperty().SetSpecularPower(20)\n    a4Actor.GetProperty().SetAmbient(0.2)\n    a4Actor.GetProperty().SetDiffuse(0.8)\n\n    # Draw the DOP.\n    arrowT2 = vtkTransform()\n    arrowT2.Scale(1, 0.6, 1)\n    arrowT2.RotateY(90)\n\n    arrowTF2 = vtkTransformPolyDataFilter()\n    arrowTF2.SetInputData(pd2)\n    arrowTF2.SetTransform(arrowT2)\n\n    arrowREF = vtkRotationalExtrusionFilter()\n    arrowREF.SetInputConnection(arrowTF2.GetOutputPort())\n    arrowREF.CappingOff()\n    arrowREF.SetResolution(30)\n\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(arrowREF.GetOutputPort())\n\n    a5Actor = vtkLODActor()\n    a5Actor.SetMapper(spikeMapper)\n    a5Actor.SetScale(0.3, 0.3, 0.6)\n    a5Actor.RotateY(-90)\n    a5Actor.SetPosition(-8, 0, 0)\n    a5Actor.GetProperty().SetColor(colors.GetColor3d(\"SpikeColor\"))\n    a5Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a5Actor.GetProperty().SetSpecular(0.3)\n    a5Actor.GetProperty().SetAmbient(0.2)\n    a5Actor.GetProperty().SetDiffuse(0.8)\n    a5Actor.GetProperty().SetSpecularPower(20)\n\n    a7Actor = vtkLODActor()\n    a7Actor.SetMapper(spikeMapper)\n    a7Actor.SetScale(0.2, 0.2, 0.7)\n    a7Actor.RotateZ(90)\n    a7Actor.RotateY(-90)\n    a7Actor.SetPosition(-9, 1, 0)\n    a7Actor.GetProperty().SetColor(colors.GetColor3d(\"UpSpikeColor\"))\n    a7Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a7Actor.GetProperty().SetSpecular(0.3)\n    a7Actor.GetProperty().SetAmbient(0.2)\n    a7Actor.GetProperty().SetDiffuse(0.8)\n    a7Actor.GetProperty().SetSpecularPower(20)\n\n    # Focal point.\n    ss = vtkSphereSource()\n    ss.SetRadius(0.5)\n    fpMapper = vtkPolyDataMapper()\n    fpMapper.SetInputConnection(ss.GetOutputPort())\n    fpActor = vtkLODActor()\n    fpActor.SetMapper(fpMapper)\n    fpActor.SetPosition(-9, 0, 0)\n    fpActor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    fpActor.GetProperty().SetSpecular(0.3)\n    fpActor.GetProperty().SetAmbient(0.2)\n    fpActor.GetProperty().SetDiffuse(0.8)\n    fpActor.GetProperty().SetSpecularPower(20)\n\n    # Create the roll arrows.\n    arrowWT2 = vtkWarpTo()\n    arrowWT2.SetInputConnection(arrowCF.GetOutputPort())\n    arrowWT2.SetPosition(5, 0, 2.5)\n    arrowWT2.SetScaleFactor(0.95)\n    arrowWT2.AbsoluteOn()\n\n    arrowT3 = vtkTransform()\n    arrowT3.Translate(-2.50358, 0, -1.70408)\n    arrowT3.Scale(0.5, 0.3, 1)\n\n    arrowTF3 = vtkTransformFilter()\n    arrowTF3.SetInputConnection(arrowWT2.GetOutputPort())\n    arrowTF3.SetTransform(arrowT3)\n\n    arrowMapper2 = vtkDataSetMapper()\n    arrowMapper2.SetInputConnection(arrowTF3.GetOutputPort())\n    arrowMapper2.ScalarVisibilityOff()\n\n    # Draw the roll arrows.\n    a6Actor = vtkLODActor()\n    a6Actor.SetMapper(arrowMapper2)\n    a6Actor.RotateZ(90)\n    a6Actor.SetPosition(-4, 0, 0)\n    a6Actor.SetScale(1.5, 1.5, 1.5)\n    a6Actor.GetProperty().SetColor(colors.GetColor3d(\"RollArrowColor\"))\n    a6Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a6Actor.GetProperty().SetSpecular(0.3)\n    a6Actor.GetProperty().SetSpecularPower(20)\n    a6Actor.GetProperty().SetAmbient(0.2)\n    a6Actor.GetProperty().SetDiffuse(0.8)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(camActor)\n    ren.AddActor(a1Actor)\n    ren.AddActor(a2Actor)\n    ren.AddActor(a3Actor)\n    ren.AddActor(a4Actor)\n    ren.AddActor(a5Actor)\n    ren.AddActor(a6Actor)\n    ren.AddActor(a7Actor)\n    ren.AddActor(fpActor)\n    ren.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CameraModel2')\n\n    # Render the image.\n\n    cam1 = (ren.GetActiveCamera())\n    ren.ResetCamera()\n    cam1.Azimuth(150)\n    cam1.Elevation(30)\n    cam1.Dolly(1.5)\n    ren.ResetCameraClippingRange()\n\n    # Create a TextActor for Yaw  (a1 and a2 actor's color).\n    text = vtkTextActor()\n    text.SetInput(\"Yaw\")\n    tprop = text.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a1Actor.GetProperty().GetColor())\n    text.SetDisplayPosition(20, 50)\n    ren.AddActor2D(text)\n\n    # Create a TextActor for Pitch  (a3 and a4 actor's color).\n    text2 = vtkTextActor()\n    text2.SetInput(\"Pitch\")\n    tprop = text2.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a3Actor.GetProperty().GetColor())\n    text2.SetDisplayPosition(20, 100)\n    ren.AddActor2D(text2)\n\n    # Create a TextActor for roll (a6 actor's color).\n    text3 = vtkTextActor()\n    text3.SetInput(\"Roll\")\n    tprop = text3.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a6Actor.GetProperty().GetColor())\n    text3.SetDisplayPosition(20, 150)\n    ren.AddActor2D(text3)\n\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
"},{"location":"Python/Visualization/ClampGlyphSizes/","title":"ClampGlyphSizes","text":"

vtk-examples/Python/Visualization/ClampGlyphSizes

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/ClampGlyphSizes/#code","title":"Code","text":"

ClampGlyphSizes.py

#!/usr/bin/env python\n\n# Example of how to use range clamping with vtkGlyph3D filter.\n#\n# Note that the internal algorithm does this to figure out the eventual scale\n# of your data (say, if you're scaling by a scalar or vector magnitude):\n#\n#   scale = (scalar value of that particular data index);\n#   denominator = Range[1] - Range[0];\n#   scale = (scale < Range[0] ? Range[0] : (scale > Range[1] ? Range[1] : scale));\n#   scale = (scale - Range[0]) / denominator;\n#   scale *= scaleFactor;\n#\n# So, step 4 is the unintuitive one. Say your data varies from [0, 1] and you set the\n# Range to [0.5, 1]. Everything below 0.5 will be mapped to 0. If you want to set a\n# minimum size to your glyphs, then you can set the Range as something like [-0.5, 1]\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkElevationFilter,\n    vtkGlyph3D\n)\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkImagingCore import vtkRTAnalyticSource\nfrom vtkmodules.vtkImagingGeneral import vtkImageGradient\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Generate an image data set with multiple attribute arrays to probe and view\n    # We will glyph these points with cones and scale/orient/color them with the\n    # various attributes\n\n    # The Wavelet Source is nice for generating a test vtkImageData set\n    rt = vtkRTAnalyticSource()\n    rt.SetWholeExtent(-2, 2, -2, 2, 0, 0)\n\n    # Take the gradient of the only scalar 'RTData' to get a vector attribute\n    grad = vtkImageGradient()\n    grad.SetDimensionality(3)\n    grad.SetInputConnection(rt.GetOutputPort())\n\n    # Elevation just to generate another scalar attribute that varies nicely over the data range\n    elev = vtkElevationFilter()\n    # Elevation values will range from 0 to 1 between the Low and High Points\n    elev.SetLowPoint(-2, 0, 0)\n    elev.SetHighPoint(2, 0, 0)\n    elev.SetInputConnection(grad.GetOutputPort())\n\n    # Generate the cone for the glyphs\n    sph = vtkConeSource()\n    sph.SetRadius(0.1)\n    sph.SetHeight(0.5)\n\n    # Set up the glyph filter\n    glyph = vtkGlyph3D()\n    glyph.SetInputConnection(elev.GetOutputPort())\n    glyph.SetSourceConnection(sph.GetOutputPort())\n    glyph.ScalingOn()\n    glyph.SetScaleModeToScaleByScalar()\n    glyph.SetVectorModeToUseVector()\n    glyph.OrientOn()\n\n    # Tell the filter to 'clamp' the scalar range\n    glyph.ClampingOn()\n\n    # Set the overall (multiplicative) scaling factor\n    glyph.SetScaleFactor(1)\n\n    # Set the Range to 'clamp' the data to\n    #   -- see equations above for nonintuitive definition of 'clamping'\n    # The fact that I'm setting the minimum value of the range below\n    #   the minimum of my data (real min=0.0) with the equations above\n    #   forces a minimum non-zero glyph size.\n\n    glyph.SetRange(-0.5, 1)  # Change these values to see effect on cone sizes\n\n    # Tell glyph which attribute arrays to use for what\n    glyph.SetInputArrayToProcess(0, 0, 0, 0, 'Elevation')  # scalars\n    glyph.SetInputArrayToProcess(1, 0, 0, 0, 'RTDataGradient')  # vectors\n    # glyph.SetInputArrayToProcess(2,0,0,0,'nothing')       # normals\n    glyph.SetInputArrayToProcess(3, 0, 0, 0, 'RTData')  # colors\n\n    # Calling update because I'm going to use the scalar range to set the color map range\n    glyph.Update()\n\n    coloring_by = 'RTData'\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph.GetOutputPort())\n    mapper.SetScalarModeToUsePointFieldData()\n    mapper.SetColorModeToMapScalars()\n    mapper.ScalarVisibilityOn()\n    mapper.SetScalarRange(glyph.GetOutputDataObject(0).GetPointData().GetArray(coloring_by).GetRange())\n    mapper.SelectColorArray(coloring_by)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    ren = vtkRenderer()\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('MidnightBlue'))\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('ClampGlyphSizes')\n\n    iren = vtkRenderWindowInteractor()\n    istyle = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(istyle)\n    iren.SetRenderWindow(renWin)\n    ren.ResetCamera()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/CollisionDetection/","title":"CollisionDetection","text":"

vtk-examples/Python/Visualization/CollisionDetection

"},{"location":"Python/Visualization/CollisionDetection/#description","title":"Description","text":"

This examples uses vtkCollisionDetectionFilter to find the intersection between a fixed (solid white) and moving (red wireframe) sphere. The animation places the moving sphere some distance from the fixed sphere and moves the moving sphere until it contacts the fixed sphere.

Three collision modes are available and can be set as the first argument on the command line.

  1. All contacts (0) finds all the contacting cell pairs with two points per collision.
  2. First contact (1) quickly find the first contact point.
  3. Half contacts (2) finds all the contacting cell pairs with one points per collision.

The animation pauses between each frame. The total animation should be 3 seconds.

Three videos on the VTK Examples Project youtube playlist show each of the collision modes.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/CollisionDetection/#code","title":"Code","text":"

CollisionDetection.py

#!/usr/bin/env python\n\nimport time\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersModeling import vtkCollisionDetectionFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextActor\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Collision detection.'\n    epilogue = '''\nThis examples uses vtkCollisionDetectionFilter to find the intersection between a\n fixed (solid white) and moving (red wireframe) sphere.\nThe animation places the moving sphere some distance from the fixed sphere and\n moves the moving sphere until it contacts the fixed sphere.\n\nThree collision modes are available and can be set as the first argument on the command line.\n\n1. All contacts (0) finds all the contacting cell pairs with two points per collision.\n2. First contact (1) quickly find the first contact point.\n3. Half contacts (2) finds all the contacting cell pairs with one points per collision.\n\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('contactMode', nargs='?', default=0, type=int, help='Contact mode 0 (default), 1, or 2.')\n    args = parser.parse_args()\n    return args.contactMode\n\n\ndef main():\n    contactMode = get_program_parameters()\n\n    # Define colors\n    colors = vtkNamedColors()\n\n    sphere0 = vtkSphereSource()\n    sphere0.SetRadius(0.29)\n    sphere0.SetPhiResolution(31)\n    sphere0.SetThetaResolution(31)\n    sphere0.SetCenter(0.0, 0, 0)\n\n    sphere1 = vtkSphereSource()\n    sphere1.SetPhiResolution(30)\n    sphere1.SetThetaResolution(30)\n    sphere1.SetRadius(0.3)\n\n    matrix1 = vtkMatrix4x4()\n    transform0 = vtkTransform()\n\n    collide = vtkCollisionDetectionFilter()\n    collide.SetInputConnection(0, sphere0.GetOutputPort())\n    collide.SetTransform(0, transform0)\n    collide.SetInputConnection(1, sphere1.GetOutputPort())\n    collide.SetMatrix(1, matrix1)\n    collide.SetBoxTolerance(0.0)\n    collide.SetCellTolerance(0.0)\n    collide.SetNumberOfCellsPerNode(2)\n    if contactMode == 0:\n        collide.SetCollisionModeToAllContacts()\n    elif contactMode == 1:\n        collide.SetCollisionModeToFirstContact()\n    else:\n        collide.SetCollisionModeToHalfContacts()\n    collide.GenerateScalarsOn()\n\n    # Visualize\n    mapper1 = vtkPolyDataMapper()\n    mapper1.SetInputConnection(collide.GetOutputPort(0))\n    mapper1.ScalarVisibilityOff()\n    actor1 = vtkActor()\n    actor1.SetMapper(mapper1)\n    actor1.GetProperty().BackfaceCullingOn()\n    actor1.SetUserTransform(transform0)\n    actor1.GetProperty().SetDiffuseColor(colors.GetColor3d(\"Tomato\"))\n    actor1.GetProperty().SetRepresentationToWireframe()\n\n    mapper2 = vtkPolyDataMapper()\n    mapper2.SetInputConnection(collide.GetOutputPort(1))\n\n    actor2 = vtkActor()\n    actor2.SetMapper(mapper2)\n    actor2.GetProperty().BackfaceCullingOn()\n    actor2.SetUserMatrix(matrix1)\n\n    mapper3 = vtkPolyDataMapper()\n    mapper3.SetInputConnection(collide.GetContactsOutputPort())\n    mapper3.SetResolveCoincidentTopologyToPolygonOffset()\n\n    actor3 = vtkActor()\n    actor3.SetMapper(mapper3)\n    actor3.GetProperty().SetColor(colors.GetColor3d(\"Black\"))\n    actor3.GetProperty().SetLineWidth(3.0)\n\n    txt = vtkTextActor()\n    txt.GetTextProperty().SetFontSize(18)\n\n    renderer = vtkRenderer()\n    renderer.UseHiddenLineRemovalOn()\n    renderer.AddActor(actor1)\n    renderer.AddActor(actor2)\n    renderer.AddActor(actor3)\n    renderer.AddActor(txt)\n    renderer.SetBackground(colors.GetColor3d(\"Gray\"))\n    renderer.UseHiddenLineRemovalOn()\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(640, 480)\n    renderWindow.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Move the first object\n    numSteps = 100\n    dx = 1.0 / float(numSteps) * 2.0\n    transform0.Translate(-numSteps * dx - .3, 0.0, 0.0)\n    renderWindow.Render()\n    renderer.GetActiveCamera().Azimuth(-60)\n    renderer.GetActiveCamera().Elevation(45)\n    renderer.GetActiveCamera().Dolly(1.2)\n\n    renderWindow.SetWindowName('CollisionDetection')\n    renderWindow.Render()\n\n    for i in range(0, numSteps):\n        transform0.Translate(dx, 0.0, 0.0)\n        renderer.ResetCameraClippingRange()\n        s = '{:s}: Number of contact cells is {:d}'.format(collide.GetCollisionModeAsString(),\n                                                           collide.GetNumberOfContacts())\n        txt.SetInput(s)\n        renderWindow.Render()\n        if collide.GetNumberOfContacts() > 0:\n            break\n        # The total animation time is 3 seconds\n        time.sleep(3.0 / numSteps)\n\n    renderer.ResetCamera()\n    renderWindow.Render()\n    renderWindow.Render()\n    interactor.Start()\n    # In Field Data there will be an array named \"ContactCells\".\n    # This array indexes contacting cells (e.g.) index 10 of array 0\n    #  points to a cell (triangle) which contacts/intersects a cell\n    #  at index 10 of array 1.\n    # You can directly obtain these, see GetContactCells(int i)\n    #  in the documentation.\n    # print(collide.GetOutput(0))\n    # print(collide.GetOutput(1))\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/ColorAnActor/","title":"ColorAnActor","text":"

vtk-examples/Python/Visualization/ColorAnActor

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/ColorAnActor/#code","title":"Code","text":"

ColorAnActor.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('ColorAnActor')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create source\n    source = vtkSphereSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(5.0)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Bisque'))\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('Navy'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/ColorSeriesPatches/","title":"ColorSeriesPatches","text":"

vtk-examples/Python/Visualization/ColorSeriesPatches

"},{"location":"Python/Visualization/ColorSeriesPatches/#description","title":"Description","text":"

This example shows how to produce a HTML page called VTKColorSeriesPatches showing the available colors series in vtkColorSeries.

It also shows how to select the text color based on luminance. In this case, Digital CCIR601 is used, which gives less weight to the red and blue components of a color.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/ColorSeriesPatches/#code","title":"Code","text":"

ColorSeriesPatches.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nProduce a HTML page called VTKColorSeriesPatches.html showing the available\n color series in vtkColorSeries.\n\nIt also shows how to select the text color based on luminance.\nIn this case Digital CCIR601 is used which gives less weight to the\n red and blue components of a color.\n\n\"\"\"\n\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\n\n\ndef main():\n    ncpt = HTMLTableMaker()\n    res = ncpt.MakeHTMLTable()\n    f = open(\"VTKColorSeriesPatches.html\", \"w\", newline=\"\\n\")\n    f.write(res)\n    f.close()\n\n\nclass HTMLToFromRGBAColor:\n\n    @staticmethod\n    def RGBToHTMLColor(rgb):\n        \"\"\"\n        Convert an [R, G, B] list to #RRGGBB.\n        :param: rgb - The elements of the array rgb are unsigned chars (0..255).\n        :return: The html color.\n        \"\"\"\n        hexcolor = \"#\" + ''.join(['{:02x}'.format(x) for x in rgb])\n        return hexcolor\n\n    @staticmethod\n    def HTMLColorToRGB(colorString):\n        \"\"\"\n        Convert #RRGGBB to a [R, G, B] list.\n        :param: colorString a string in the form: #RRGGBB where RR, GG, BB are hexadecimal.\n        The elements of the array rgb are unsigned chars (0..255).\n        :return: The red, green and blue components as a list.\n        \"\"\"\n        colorString = colorString.strip()\n        if colorString[0] == '#':\n            colorString = colorString[1:]\n        if len(colorString) != 6:\n            raise ValueError(\"Input #%s is not in #RRGGBB format\" % colorString)\n        r, g, b = colorString[:2], colorString[2:4], colorString[4:]\n        r, g, b = [int(n, 16) for n in (r, g, b)]\n        return [r, g, b]\n\n    @staticmethod\n    def RGBToLumaCCIR601(rgb):\n        \"\"\"\n        RGB -> Luma conversion\n        Digital CCIR601 (gives less weight to the R and B components)\n        :param: rgb - The elements of the array rgb are unsigned chars (0..255).\n        :return: The luminance.\n        \"\"\"\n        Y = 0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]\n        return Y\n\n\nclass ColorStructures:\n    \"\"\"\n    Holds the color series id, name and colors.\n    \"\"\"\n\n    cs_colors = dict()\n    max_colors = 0\n\n    def __init__(self):\n        cs = vtkColorSeries()\n        sizes = list()\n        for i in range(0, cs.GetNumberOfColorSchemes()):\n            cs.SetColorScheme(i)\n            sizes.append(cs.GetNumberOfColors())\n            vc = list()\n            for j in range(0, cs.GetNumberOfColors()):\n                vc.append(cs.GetColor(j))\n            self.cs_colors[i] = [cs.GetColorSchemeName(), vc]\n        self.max_colors = max(sizes)\n\n\nclass HTMLTableMaker:\n    \"\"\"\n      This class creates HTML Tables displaying all the colors in\n      the class vtkNamedColors grouped by various categories.\n    \"\"\"\n\n    def __init__(self):\n        self.cs = ColorStructures()\n        self.nc = vtkNamedColors()\n        self.htmlRGBA = HTMLToFromRGBAColor()\n\n    @staticmethod\n    def MakeHTMLStyle():\n        s = '  <style>\\n'\n        s += '\\n'\n        s += '  body {\\n'\n        s += '    background-color: snow\\n'\n        s += '  }\\n'\n        s += '  h1 {text-align:left;}\\n'\n        s += '  h2 {text-align:left;}\\n'\n        s += '  h3 {text-align:left;}\\n'\n        s += '  h4 {text-align:left;}\\n'\n        s += '  h5 {text-align:left;}\\n'\n        s += '  h6 {text-align:left;}\\n'\n        s += '\\n'\n        s += '  p {text-align:left;}\\n'\n        s += '\\n'\n        s += '  table {\\n'\n        s += '    font-family: arial, sans-serif;\\n'\n        s += '    border-collapse: collapse;\\n'\n        s += '    font-size: medium;\\n'\n        s += '    padding: 4px;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  th {\\n'\n        s += '    background: LightSteelBlue;\\n'\n        s += '    font-size: medium;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  th[colspan]:not([colspan=\"1\"]) {\\n'\n        s += '    background: LightSteelBlue;\\n'\n        s += '    font-size: medium;\\n'\n        s += '    text-align : center;\\n'\n        s += '    vertical-align : top;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  tr {\\n'\n        s += '    background: MintCream;\\n'\n        s += '    vertical-align : top;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  td {\\n'\n        s += '    background: MintCream;\\n'\n        s += '    border: 1px solid #dddddd;\\n'\n        s += '    text-align: left;\\n'\n        s += '    padding: 8px;\\n'\n        s += '    font-family: monospace;\\n'\n        s += '    font-size: medium;\\n'\n        s += '    font-weight: bold;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  td[colspan]:not([colspan=\"1\"]) {\\n'\n        s += '    text-align : center;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  .cour {\\n'\n        s += '    font-family: Courier;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  html, body {\\n'\n        s += '    height: 100%;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  html {\\n'\n        s += '    display: table;\\n'\n        s += '    margin: auto;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  body {\\n'\n        s += '    display: table-cell;\\n'\n        s += '    vertical-align: middle;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  thead {color: DarkGreen;}\\n'\n        s += '  tbody {color: MidnightBlue;}\\n'\n        s += '  tfoot {color: SaddleBrown;}\\n'\n        s += '\\n'\n        s += '  </style>\\n'\n        return s\n\n    def MakeHTMLHeader(self):\n        s = '<!DOCTYPE html>\\n'\n        s += '<html lang=\"en\">\\n'\n        s += '<head>\\n'\n        s += '<meta charset=\"UTF-8\" />\\n'\n        s += '<title>vtkColorSeries</title>\\n'\n        s += self.MakeHTMLStyle()\n        s += '</head>\\n'\n        return s\n\n    def MakeTableHeader(self):\n        s = '<tr>\\n'\n        s += '<th>Index</th>\\n'\n        s += '<th colspan=\"' + str(self.cs.max_colors) + '\">Name</th>\\n'\n        s += '</tr>\\n'\n        s += '<tr>\\n'\n        s += '<th></th>\\n'\n        s += '<th colspan=\"' + str(self.cs.max_colors) + '\">Colors in the Series</th>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def MakeTD1(self, idx, name):\n        s = '<tr>\\n'\n        s += '<td>'\n        s += '<b>' + str(idx) + '</b>'\n        s += '</td>\\n'\n        s += '<td colspan=\"' + str(self.cs.max_colors) + '\">'\n        s += '<b>' + name + '</b>'\n        s += '</td>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def MakeTD2(self, rgbs):\n        s = '<tr>\\n'\n        s += '<td></td>\\n'\n\n        cnt = 0\n        for p in rgbs:\n            ss = '{:3d}  '.format(cnt)\n            ss = ss.replace(' ', '&#160;')\n            y = self.htmlRGBA.RGBToLumaCCIR601(p)\n            textColor = '#000000'  # Black\n            if y < 255 / 2.0:\n                textColor = '#ffffff'  # White\n            s += '<td style=\"background:' + self.htmlRGBA.RGBToHTMLColor(p) + ';color:'\n            s += textColor + '\">' + ss + '</td>\\n'\n            cnt += 1\n        if cnt < self.cs.max_colors:\n            s += '<td colspan=\"' + str(self.cs.max_colors - cnt) + '\"> &#160; </td>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def MakeTable(self):\n        res = self.MakeTableHeader()\n        for idx, v in self.cs.cs_colors.items():\n            name = v[0]\n            res += self.MakeTD1(idx, name)\n            res += self.MakeTD2(v[1])\n\n        return res\n\n    def MakeHTMLTable(self):\n\n        res = self.MakeHTMLHeader()\n        res += '<body>\\n'\n        res += '<h1>Color series available in vtkColorSeries</h1>\\n'\n        res += '<table>\\n'\n        res += self.MakeTable()\n        res += '</table>\\n'\n        res += '</body>\\n'\n        return res\n\n\nif __name__ == \"__main__\":\n    main()\n
"},{"location":"Python/Visualization/ColoredAnnotatedCube/","title":"ColoredAnnotatedCube","text":"

vtk-examples/Python/Visualization/ColoredAnnotatedCube

"},{"location":"Python/Visualization/ColoredAnnotatedCube/#description","title":"Description","text":"

This example demonstrates how to color the individual faces of an annotated cube.

This is based on a very nice example by Rodrigo Figueiredo in this discussion.

The process is:

  • Create the annotated cube actor using vtkAnnotatedCubeActor.
  • Select the names on the faces, text colors and, if needed, any rotations of the text.
  • Make the annotated cube transparent.
  • Create a cube actor with colored faces.
  • Combine the annotated cube actor and cube actor into a prop assembly using vtkPropAssembly. Since the annotated cube and the cube are the same size you get an assembly with colored cube faces and the requisite text.
  • Create a vtkOrientationMarkerWidget and set the set the orientation marker to be the prop assembly.

The function MakeAnnotatedCubeActor generates the annotated cube with different colored faces which is then added to a vtkOrientationMarkerWidget.

The colored annotated cube is then placed in the lower left of the view (default). Additionally, a vtkOrientationMarkerWidget containing an axes actor has been added to the lower right of the view.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/ColoredAnnotatedCube/#code","title":"Code","text":"

ColoredAnnotatedCube.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkBandedPolyDataContourFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource\n)\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import (\n    vtkAnnotatedCubeActor,\n    vtkAxesActor\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropAssembly,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Basic stuff setup\n    # Set up the renderer, window, and interactor\n    colors = vtkNamedColors()\n\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(640, 480)\n    iRen = vtkRenderWindowInteractor()\n    iRen.SetRenderWindow(renWin)\n\n    # Create a cone with an elliptical base whose major axis is in the\n    # X-direction.\n    coneSource = vtkConeSource()\n    coneSource.SetCenter(0.0, 0.0, 0.0)\n    coneSource.SetRadius(5.0)\n    coneSource.SetHeight(15.0)\n    coneSource.SetDirection(0, 1, 0)\n    coneSource.SetResolution(60)\n    coneSource.Update()\n\n    transform = vtkTransform()\n    transform.Scale(1.0, 1.0, 0.75)\n\n    transF = vtkTransformPolyDataFilter()\n    transF.SetInputConnection(coneSource.GetOutputPort())\n    transF.SetTransform(transform)\n\n    bounds = transF.GetOutput().GetBounds()\n\n    elevation = vtkElevationFilter()\n    elevation.SetInputConnection(transF.GetOutputPort())\n    elevation.SetLowPoint(0, bounds[2], 0)\n    elevation.SetHighPoint(0, bounds[3], 0)\n\n    bandedContours = vtkBandedPolyDataContourFilter()\n    bandedContours.SetInputConnection(elevation.GetOutputPort())\n    bandedContours.SetScalarModeToValue()\n    bandedContours.GenerateContourEdgesOn()\n    bandedContours.GenerateValues(11, elevation.GetScalarRange())\n\n    # Make a lookup table using a color series.\n    colorSeries = vtkColorSeries()\n    colorSeries.SetColorScheme(vtkColorSeries.BREWER_DIVERGING_SPECTRAL_11)\n\n    lut = vtkLookupTable()\n    colorSeries.BuildLookupTable(lut, vtkColorSeries.ORDINAL)\n\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(bandedContours.GetOutputPort())\n    coneMapper.SetScalarRange(elevation.GetScalarRange())\n    coneMapper.SetLookupTable(lut)\n\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n\n    # Contouring\n    contourLineMapper = vtkPolyDataMapper()\n    contourLineMapper.SetInputData(bandedContours.GetContourEdgesOutput())\n    contourLineMapper.SetScalarRange(elevation.GetScalarRange())\n    contourLineMapper.SetResolveCoincidentTopologyToPolygonOffset()\n\n    contourLineActor = vtkActor()\n    contourLineActor.SetMapper(contourLineMapper)\n    contourLineActor.GetProperty().SetColor(\n        colors.GetColor3d('DimGray'))\n\n    # Set up the Orientation Marker Widget.\n    prop_assembly = MakeAnnotatedCubeActor(colors)\n    om1 = vtkOrientationMarkerWidget()\n    om1.SetOrientationMarker(prop_assembly)\n    om1.SetInteractor(iRen)\n    om1.SetDefaultRenderer(ren)\n    om1.On()\n    om1.InteractiveOn()\n\n    xyzLabels = ['X', 'Y', 'Z']\n    scale = [1.0, 1.0, 1.0]\n    axes = MakeAxesActor(scale, xyzLabels)\n\n    om2 = vtkOrientationMarkerWidget()\n    om2.SetOrientationMarker(axes)\n    # Position lower right in the viewport.\n    om2.SetViewport(0.8, 0, 1.0, 0.2)\n    om2.SetInteractor(iRen)\n    om2.EnabledOn()\n    om2.InteractiveOn()\n\n    ren.AddActor(coneActor)\n    ren.AddActor(contourLineActor)\n    ren.SetBackground2(colors.GetColor3d('RoyalBlue'))\n    ren.SetBackground(colors.GetColor3d('MistyRose'))\n    ren.GradientBackgroundOn()\n    ren.GetActiveCamera().Azimuth(45)\n    ren.GetActiveCamera().Pitch(-22.5)\n    ren.ResetCamera()\n\n    renWin.SetSize(600, 600)\n    renWin.Render()\n    renWin.SetWindowName('ColoredAnnotatedCube')\n    renWin.Render()\n    iRen.Start()\n\n\ndef MakeAnnotatedCubeActor(colors):\n    # Annotated Cube setup\n    annotated_cube = vtkAnnotatedCubeActor()\n    annotated_cube.SetFaceTextScale(0.366667)\n\n    # Anatomic labeling\n    annotated_cube.SetXPlusFaceText('X+')\n    annotated_cube.SetXMinusFaceText('X-')\n    annotated_cube.SetYPlusFaceText('Y+')\n    annotated_cube.SetYMinusFaceText('Y-')\n    annotated_cube.SetZPlusFaceText('Z+')\n    annotated_cube.SetZMinusFaceText('Z-')\n\n    # Change the vector text colors\n    annotated_cube.GetTextEdgesProperty().SetColor(\n        colors.GetColor3d('Black'))\n    annotated_cube.GetTextEdgesProperty().SetLineWidth(1)\n\n    annotated_cube.GetXPlusFaceProperty().SetColor(\n        colors.GetColor3d('Turquoise'))\n    annotated_cube.GetXMinusFaceProperty().SetColor(\n        colors.GetColor3d('Turquoise'))\n    annotated_cube.GetYPlusFaceProperty().SetColor(\n        colors.GetColor3d('Mint'))\n    annotated_cube.GetYMinusFaceProperty().SetColor(\n        colors.GetColor3d('Mint'))\n    annotated_cube.GetZPlusFaceProperty().SetColor(\n        colors.GetColor3d('Tomato'))\n    annotated_cube.GetZMinusFaceProperty().SetColor(\n        colors.GetColor3d('Tomato'))\n    annotated_cube.SetXFaceTextRotation(90)\n    annotated_cube.SetYFaceTextRotation(180)\n    annotated_cube.SetZFaceTextRotation(-90)\n    # Make the annotated cube transparent\n    annotated_cube.GetCubeProperty().SetOpacity(0)\n\n    # Colored faces cube setup\n    cube_source = vtkCubeSource()\n    cube_source.Update()\n\n    face_colors = vtkUnsignedCharArray()\n    face_colors.SetNumberOfComponents(3)\n    face_x_plus = colors.GetColor3ub('Red')\n    face_x_minus = colors.GetColor3ub('Green')\n    face_y_plus = colors.GetColor3ub('Blue')\n    face_y_minus = colors.GetColor3ub('Yellow')\n    face_z_plus = colors.GetColor3ub('Cyan')\n    face_z_minus = colors.GetColor3ub('Magenta')\n    face_colors.InsertNextTypedTuple(face_x_minus)\n    face_colors.InsertNextTypedTuple(face_x_plus)\n    face_colors.InsertNextTypedTuple(face_y_minus)\n    face_colors.InsertNextTypedTuple(face_y_plus)\n    face_colors.InsertNextTypedTuple(face_z_minus)\n    face_colors.InsertNextTypedTuple(face_z_plus)\n\n    cube_source.GetOutput().GetCellData().SetScalars(face_colors)\n    cube_source.Update()\n\n    cube_mapper = vtkPolyDataMapper()\n    cube_mapper.SetInputData(cube_source.GetOutput())\n    cube_mapper.Update()\n\n    cube_actor = vtkActor()\n    cube_actor.SetMapper(cube_mapper)\n\n    # Assemble the colored cube and annotated cube texts into a composite prop.\n    prop_assembly = vtkPropAssembly()\n    prop_assembly.AddPart(annotated_cube)\n    prop_assembly.AddPart(cube_actor)\n    return prop_assembly\n\n\ndef MakeAxesActor(scale, xyzLabels):\n    axes = vtkAxesActor()\n    axes.SetScale(scale[0], scale[1], scale[2])\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText(xyzLabels[0])\n    axes.SetYAxisLabelText(xyzLabels[1])\n    axes.SetZAxisLabelText(xyzLabels[2])\n    axes.SetCylinderRadius(0.5 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.025 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.5 * axes.GetSphereRadius())\n    tprop = axes.GetXAxisCaptionActor2D().GetCaptionTextProperty()\n    tprop.ItalicOn()\n    tprop.ShadowOn()\n    tprop.SetFontFamilyToTimes()\n    # Use the same text properties on the other two axes.\n    axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    return axes\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/ComplexV/","title":"ComplexV","text":"

vtk-examples/Python/Visualization/ComplexV

"},{"location":"Python/Visualization/ComplexV/#description","title":"Description","text":"

ComplexV from the VTK Textbook. The original example was written in TCL.

The example shows 167,000 3D vectors (using oriented and scaled lines) in the region of the human carotid artery. The larger vectors lie inside the arteries, the smaller vectors lie outside the arteries and are randomly oriented (measurement error) but small in magnitude. Clearly the details of the vector field are not discernible from this image.

Info

See Figure 6-13 in Chapter 6 the VTK Textbook.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/ComplexV/#code","title":"Code","text":"

ComplexV.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkHedgeHog\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(fileName)\n\n    hhog = vtkHedgeHog()\n    hhog.SetInputConnection(reader.GetOutputPort())\n    hhog.SetScaleFactor(0.3)\n\n    lut = vtkLookupTable()\n    # lut.SetHueRange(.667, 0.0)\n    lut.Build()\n\n    hhogMapper = vtkPolyDataMapper()\n    hhogMapper.SetInputConnection(hhog.GetOutputPort())\n    hhogMapper.SetScalarRange(50, 550)\n    hhogMapper.SetLookupTable(lut)\n\n    hhogActor = vtkActor()\n    hhogActor.SetMapper(hhogMapper)\n\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    aRenderer = vtkRenderer()\n    aRenderWindow = vtkRenderWindow()\n    aRenderWindow.AddRenderer(aRenderer)\n    anInteractor = vtkRenderWindowInteractor()\n    anInteractor.SetRenderWindow(aRenderWindow)\n    aRenderWindow.SetSize(640, 480)\n    aRenderWindow.SetWindowName('ComplexV')\n\n    aRenderer.AddActor(outlineActor)\n    aRenderer.AddActor(hhogActor)\n\n    aRenderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Generate an interesting view.\n\n    aRenderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    aRenderer.GetActiveCamera().SetPosition(1, 0, 0)\n    aRenderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    aRenderer.ResetCamera()\n\n    aRenderer.GetActiveCamera().Azimuth(60)\n    aRenderer.GetActiveCamera().Elevation(30)\n    aRenderer.GetActiveCamera().Dolly(1.1)\n    aRenderer.ResetCameraClippingRange()\n\n    aRenderWindow.Render()\n\n    # Interact with the data.\n    anInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Vector visualization techniques.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='carotid.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/CreateColorSeriesDemo/","title":"CreateColorSeriesDemo","text":"

vtk-examples/Python/Visualization/CreateColorSeriesDemo

"},{"location":"Python/Visualization/CreateColorSeriesDemo/#description","title":"Description","text":"

This example demonstrates how to create a custom vtkColorSeries. The examples produces a vtkLookupTable explicitly. The vtkLookupTable is populated with colors from the vtkColorSeries using GetColorRepeating, since the size of the vtkLookupTable may be larger than the colors in the vtkColorSeries.

A vtkPlaneSource generates the geometry. The vtkCellData is populated with increasing integers starting at 1.

Ten different color series are generated from VTK color names in vtkNamedColors. The first argument of the example is one of \"Blue\", \"Brown\", \"Red\", \"Orange\", \"White\", \"Grey\", \"Magenta\", \"Cyan\", \"Yellow\" and \"Green\".

The colors are added from left to right, row by row, from the bottom left-hand corner of the table.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/CreateColorSeriesDemo/#code","title":"Code","text":"

CreateColorSeriesDemo.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkLookupTable\n)\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'how to create a custom vtkColorSeries.'\n    epilogue = '''\nA vtkLookupTable is explicitly produced, it is populated with colors from the vtkColorSeries\n   using GetColorRepeating, since the size of the vtkLookupTable may be larger than the\n   colors in the vtkColorSeries.\n\nTen different color series are generated from VTK color names in vtkNamedColors.\nChoose from one of: Blue, Brown, Red, Orange, White, Grey, Magenta, Cyan, Yellow and Green.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('seriesName', default='Red', nargs='?',\n                        help='The name of the color series to use (default is Red).')\n    args = parser.parse_args()\n    return args.seriesName\n\n\ndef CreateLookupTableVTKBlue(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKBlueColors')\n\n    myColors.AddColor(nc.GetColor3ub('alice_blue'))\n    myColors.AddColor(nc.GetColor3ub('blue'))\n    myColors.AddColor(nc.GetColor3ub('blue_light'))\n    myColors.AddColor(nc.GetColor3ub('blue_medium'))\n    myColors.AddColor(nc.GetColor3ub('cadet'))\n    myColors.AddColor(nc.GetColor3ub('cobalt'))\n    myColors.AddColor(nc.GetColor3ub('cornflower'))\n    myColors.AddColor(nc.GetColor3ub('cerulean'))\n    myColors.AddColor(nc.GetColor3ub('dodger_blue'))\n    myColors.AddColor(nc.GetColor3ub('indigo'))\n    myColors.AddColor(nc.GetColor3ub('manganese_blue'))\n    myColors.AddColor(nc.GetColor3ub('midnight_blue'))\n    myColors.AddColor(nc.GetColor3ub('navy'))\n    myColors.AddColor(nc.GetColor3ub('peacock'))\n    myColors.AddColor(nc.GetColor3ub('powder_blue'))\n    myColors.AddColor(nc.GetColor3ub('royal_blue'))\n    myColors.AddColor(nc.GetColor3ub('slate_blue'))\n    myColors.AddColor(nc.GetColor3ub('slate_blue_dark'))\n    myColors.AddColor(nc.GetColor3ub('slate_blue_light'))\n    myColors.AddColor(nc.GetColor3ub('slate_blue_medium'))\n    myColors.AddColor(nc.GetColor3ub('sky_blue'))\n    myColors.AddColor(nc.GetColor3ub('sky_blue_deep'))\n    myColors.AddColor(nc.GetColor3ub('sky_blue_light'))\n    myColors.AddColor(nc.GetColor3ub('steel_blue'))\n    myColors.AddColor(nc.GetColor3ub('steel_blue_light'))\n    myColors.AddColor(nc.GetColor3ub('turquoise_blue'))\n    myColors.AddColor(nc.GetColor3ub('ultramarine'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKBrown(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKBrownColors')\n\n    myColors.AddColor(nc.GetColor3ub('beige'))\n    myColors.AddColor(nc.GetColor3ub('brown'))\n    myColors.AddColor(nc.GetColor3ub('brown_madder'))\n    myColors.AddColor(nc.GetColor3ub('brown_ochre'))\n    myColors.AddColor(nc.GetColor3ub('burlywood'))\n    myColors.AddColor(nc.GetColor3ub('burnt_sienna'))\n    myColors.AddColor(nc.GetColor3ub('burnt_umber'))\n    myColors.AddColor(nc.GetColor3ub('chocolate'))\n    myColors.AddColor(nc.GetColor3ub('deep_ochre'))\n    myColors.AddColor(nc.GetColor3ub('flesh'))\n    myColors.AddColor(nc.GetColor3ub('flesh_ochre'))\n    myColors.AddColor(nc.GetColor3ub('gold_ochre'))\n    myColors.AddColor(nc.GetColor3ub('greenish_umber'))\n    myColors.AddColor(nc.GetColor3ub('khaki'))\n    myColors.AddColor(nc.GetColor3ub('khaki_dark'))\n    myColors.AddColor(nc.GetColor3ub('light_beige'))\n    myColors.AddColor(nc.GetColor3ub('peru'))\n    myColors.AddColor(nc.GetColor3ub('rosy_brown'))\n    myColors.AddColor(nc.GetColor3ub('raw_sienna'))\n    myColors.AddColor(nc.GetColor3ub('raw_umber'))\n    myColors.AddColor(nc.GetColor3ub('sepia'))\n    myColors.AddColor(nc.GetColor3ub('sienna'))\n    myColors.AddColor(nc.GetColor3ub('saddle_brown'))\n    myColors.AddColor(nc.GetColor3ub('sandy_brown'))\n    myColors.AddColor(nc.GetColor3ub('tan'))\n    myColors.AddColor(nc.GetColor3ub('van_dyke_brown'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKRed(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKRedColors')\n\n    myColors.AddColor(nc.GetColor3ub('alizarin_crimson'))\n    myColors.AddColor(nc.GetColor3ub('brick'))\n    myColors.AddColor(nc.GetColor3ub('cadmium_red_deep'))\n    myColors.AddColor(nc.GetColor3ub('coral'))\n    myColors.AddColor(nc.GetColor3ub('coral_light'))\n    myColors.AddColor(nc.GetColor3ub('deep_pink'))\n    myColors.AddColor(nc.GetColor3ub('english_red'))\n    myColors.AddColor(nc.GetColor3ub('firebrick'))\n    myColors.AddColor(nc.GetColor3ub('geranium_lake'))\n    myColors.AddColor(nc.GetColor3ub('hot_pink'))\n    myColors.AddColor(nc.GetColor3ub('indian_red'))\n    myColors.AddColor(nc.GetColor3ub('light_salmon'))\n    myColors.AddColor(nc.GetColor3ub('madder_lake_deep'))\n    myColors.AddColor(nc.GetColor3ub('maroon'))\n    myColors.AddColor(nc.GetColor3ub('pink'))\n    myColors.AddColor(nc.GetColor3ub('pink_light'))\n    myColors.AddColor(nc.GetColor3ub('raspberry'))\n    myColors.AddColor(nc.GetColor3ub('red'))\n    myColors.AddColor(nc.GetColor3ub('rose_madder'))\n    myColors.AddColor(nc.GetColor3ub('salmon'))\n    myColors.AddColor(nc.GetColor3ub('tomato'))\n    myColors.AddColor(nc.GetColor3ub('venetian_red'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKOrange(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKOrangeColors')\n\n    myColors.AddColor(nc.GetColor3ub('cadmium_orange'))\n    myColors.AddColor(nc.GetColor3ub('cadmium_red_light'))\n    myColors.AddColor(nc.GetColor3ub('carrot'))\n    myColors.AddColor(nc.GetColor3ub('dark_orange'))\n    myColors.AddColor(nc.GetColor3ub('mars_orange'))\n    myColors.AddColor(nc.GetColor3ub('mars_yellow'))\n    myColors.AddColor(nc.GetColor3ub('orange'))\n    myColors.AddColor(nc.GetColor3ub('orange_red'))\n    myColors.AddColor(nc.GetColor3ub('yellow_ochre'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKWhite(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKWhiteColors')\n\n    myColors.AddColor(nc.GetColor3ub('antique_white'))\n    myColors.AddColor(nc.GetColor3ub('azure'))\n    myColors.AddColor(nc.GetColor3ub('bisque'))\n    myColors.AddColor(nc.GetColor3ub('blanched_almond'))\n    myColors.AddColor(nc.GetColor3ub('cornsilk'))\n    myColors.AddColor(nc.GetColor3ub('eggshell'))\n    myColors.AddColor(nc.GetColor3ub('floral_white'))\n    myColors.AddColor(nc.GetColor3ub('gainsboro'))\n    myColors.AddColor(nc.GetColor3ub('ghost_white'))\n    myColors.AddColor(nc.GetColor3ub('honeydew'))\n    myColors.AddColor(nc.GetColor3ub('ivory'))\n    myColors.AddColor(nc.GetColor3ub('lavender'))\n    myColors.AddColor(nc.GetColor3ub('lavender_blush'))\n    myColors.AddColor(nc.GetColor3ub('lemon_chiffon'))\n    myColors.AddColor(nc.GetColor3ub('linen'))\n    myColors.AddColor(nc.GetColor3ub('mint_cream'))\n    myColors.AddColor(nc.GetColor3ub('misty_rose'))\n    myColors.AddColor(nc.GetColor3ub('moccasin'))\n    myColors.AddColor(nc.GetColor3ub('navajo_white'))\n    myColors.AddColor(nc.GetColor3ub('old_lace'))\n    myColors.AddColor(nc.GetColor3ub('papaya_whip'))\n    myColors.AddColor(nc.GetColor3ub('peach_puff'))\n    myColors.AddColor(nc.GetColor3ub('seashell'))\n    myColors.AddColor(nc.GetColor3ub('snow'))\n    myColors.AddColor(nc.GetColor3ub('thistle'))\n    myColors.AddColor(nc.GetColor3ub('titanium_white'))\n    myColors.AddColor(nc.GetColor3ub('wheat'))\n    myColors.AddColor(nc.GetColor3ub('white'))\n    myColors.AddColor(nc.GetColor3ub('white_smoke'))\n    myColors.AddColor(nc.GetColor3ub('zinc_white'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKGrey(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKGreyColors')\n\n    myColors.AddColor(nc.GetColor3ub('cold_grey'))\n    myColors.AddColor(nc.GetColor3ub('dim_grey'))\n    myColors.AddColor(nc.GetColor3ub('grey'))\n    myColors.AddColor(nc.GetColor3ub('light_grey'))\n    myColors.AddColor(nc.GetColor3ub('slate_grey'))\n    myColors.AddColor(nc.GetColor3ub('slate_grey_dark'))\n    myColors.AddColor(nc.GetColor3ub('slate_grey_light'))\n    myColors.AddColor(nc.GetColor3ub('warm_grey'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKMagenta(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKMagentaColors')\n\n    myColors.AddColor(nc.GetColor3ub('blue_violet'))\n    myColors.AddColor(nc.GetColor3ub('cobalt_violet_deep'))\n    myColors.AddColor(nc.GetColor3ub('magenta'))\n    myColors.AddColor(nc.GetColor3ub('orchid'))\n    myColors.AddColor(nc.GetColor3ub('orchid_dark'))\n    myColors.AddColor(nc.GetColor3ub('orchid_medium'))\n    myColors.AddColor(nc.GetColor3ub('permanent_red_violet'))\n    myColors.AddColor(nc.GetColor3ub('plum'))\n    myColors.AddColor(nc.GetColor3ub('purple'))\n    myColors.AddColor(nc.GetColor3ub('purple_medium'))\n    myColors.AddColor(nc.GetColor3ub('ultramarine_violet'))\n    myColors.AddColor(nc.GetColor3ub('violet'))\n    myColors.AddColor(nc.GetColor3ub('violet_dark'))\n    myColors.AddColor(nc.GetColor3ub('violet_red'))\n    myColors.AddColor(nc.GetColor3ub('violet_red_medium'))\n    myColors.AddColor(nc.GetColor3ub('violet_red_pale'))\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKCyan(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKCyanColors')\n\n    myColors.AddColor(nc.GetColor3ub('aquamarine'))\n    myColors.AddColor(nc.GetColor3ub('aquamarine_medium'))\n    myColors.AddColor(nc.GetColor3ub('cyan'))\n    myColors.AddColor(nc.GetColor3ub('cyan_white'))\n    myColors.AddColor(nc.GetColor3ub('turquoise'))\n    myColors.AddColor(nc.GetColor3ub('turquoise_dark'))\n    myColors.AddColor(nc.GetColor3ub('turquoise_medium'))\n    myColors.AddColor(nc.GetColor3ub('turquoise_pale'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKYellow(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKYellowColors')\n\n    myColors.AddColor(nc.GetColor3ub('aureoline_yellow'))\n    myColors.AddColor(nc.GetColor3ub('banana'))\n    myColors.AddColor(nc.GetColor3ub('cadmium_lemon'))\n    myColors.AddColor(nc.GetColor3ub('cadmium_yellow'))\n    myColors.AddColor(nc.GetColor3ub('cadmium_yellow_light'))\n    myColors.AddColor(nc.GetColor3ub('gold'))\n    myColors.AddColor(nc.GetColor3ub('goldenrod'))\n    myColors.AddColor(nc.GetColor3ub('goldenrod_dark'))\n    myColors.AddColor(nc.GetColor3ub('goldenrod_light'))\n    myColors.AddColor(nc.GetColor3ub('goldenrod_pale'))\n    myColors.AddColor(nc.GetColor3ub('light_goldenrod'))\n    myColors.AddColor(nc.GetColor3ub('melon'))\n    myColors.AddColor(nc.GetColor3ub('naples_yellow_deep'))\n    myColors.AddColor(nc.GetColor3ub('yellow'))\n    myColors.AddColor(nc.GetColor3ub('yellow_light'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKGreen(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKGreenColors')\n\n    myColors.AddColor(nc.GetColor3ub('chartreuse'))\n    myColors.AddColor(nc.GetColor3ub('chrome_oxide_green'))\n    myColors.AddColor(nc.GetColor3ub('cinnabar_green'))\n    myColors.AddColor(nc.GetColor3ub('cobalt_green'))\n    myColors.AddColor(nc.GetColor3ub('emerald_green'))\n    myColors.AddColor(nc.GetColor3ub('forest_green'))\n    myColors.AddColor(nc.GetColor3ub('green'))\n    myColors.AddColor(nc.GetColor3ub('green_dark'))\n    myColors.AddColor(nc.GetColor3ub('green_pale'))\n    myColors.AddColor(nc.GetColor3ub('green_yellow'))\n    myColors.AddColor(nc.GetColor3ub('lawn_green'))\n    myColors.AddColor(nc.GetColor3ub('lime_green'))\n    myColors.AddColor(nc.GetColor3ub('mint'))\n    myColors.AddColor(nc.GetColor3ub('olive'))\n    myColors.AddColor(nc.GetColor3ub('olive_drab'))\n    myColors.AddColor(nc.GetColor3ub('olive_green_dark'))\n    myColors.AddColor(nc.GetColor3ub('permanent_green'))\n    myColors.AddColor(nc.GetColor3ub('sap_green'))\n    myColors.AddColor(nc.GetColor3ub('sea_green'))\n    myColors.AddColor(nc.GetColor3ub('sea_green_dark'))\n    myColors.AddColor(nc.GetColor3ub('sea_green_medium'))\n    myColors.AddColor(nc.GetColor3ub('sea_green_light'))\n    myColors.AddColor(nc.GetColor3ub('spring_green'))\n    myColors.AddColor(nc.GetColor3ub('spring_green_medium'))\n    myColors.AddColor(nc.GetColor3ub('terre_verte'))\n    myColors.AddColor(nc.GetColor3ub('viridian_light'))\n    myColors.AddColor(nc.GetColor3ub('yellow_green'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef main():\n    seriesName = get_program_parameters()\n    seriesName = seriesName.capitalize()\n    available_color_series = ['Blue', 'Brown', 'Red', 'Orange', 'White', 'Grey', 'Magenta', 'Cyan', 'Yellow', 'Green']\n    if seriesName not in available_color_series:\n        print('Available color maps are:', \", \".join(available_color_series))\n        return\n\n    colors = vtkNamedColors()\n\n    # Provide some geometry.\n    xResolution = 6\n    yResolution = 6\n    aPlane = vtkPlaneSource()\n    aPlane.SetXResolution(xResolution)\n    aPlane.SetYResolution(yResolution)\n    size = xResolution * yResolution + 1\n\n    # Create cell data.\n    cellData = vtkFloatArray()\n    for i in range(0, xResolution * yResolution):\n        cellData.InsertNextValue(i)\n    aPlane.Update()  # Force an update so we can set cell data.\n    aPlane.GetOutput().GetCellData().SetScalars(cellData)\n\n    # Get the lookup table.\n    lut = eval('CreateLookupTableVTK' + seriesName + '(size)')\n\n    # Set up the actor and mapper.\n    mapper = vtkPolyDataMapper()\n    mapper.SetLookupTable(lut)\n    mapper.SetInputConnection(aPlane.GetOutputPort())\n    mapper.SetScalarModeToUseCellData()\n    mapper.SetScalarRange(0, size)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n\n    # Setup render window, renderer, and interactor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('CreateColorSeriesDemo')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/CubeAxesActor/","title":"CubeAxesActor","text":"

vtk-examples/Python/Visualization/CubeAxesActor

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/CubeAxesActor/#code","title":"Code","text":"

CubeAxesActor.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSuperquadricSource\nfrom vtkmodules.vtkRenderingAnnotation import vtkCubeAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    backgroundColor = colors.GetColor3d(\"DarkSlateGray\")\n    actorColor = colors.GetColor3d(\"Tomato\")\n    axis1Color = colors.GetColor3d(\"Salmon\")\n    axis2Color = colors.GetColor3d(\"PaleGreen\")\n    axis3Color = colors.GetColor3d(\"LightSkyBlue\")\n\n    # Create a superquadric\n    superquadricSource = vtkSuperquadricSource()\n    superquadricSource.SetPhiRoundness(3.1)\n    superquadricSource.SetThetaRoundness(1.0)\n    superquadricSource.Update()  # needed to GetBounds later\n\n    renderer = vtkRenderer()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(superquadricSource.GetOutputPort())\n\n    superquadricActor = vtkActor()\n    superquadricActor.SetMapper(mapper)\n    superquadricActor.GetProperty().SetDiffuseColor(actorColor)\n    superquadricActor.GetProperty().SetDiffuse(.7)\n    superquadricActor.GetProperty().SetSpecular(.7)\n    superquadricActor.GetProperty().SetSpecularPower(50.0)\n\n    cubeAxesActor = vtkCubeAxesActor()\n    cubeAxesActor.SetUseTextActor3D(1)\n    cubeAxesActor.SetBounds(superquadricSource.GetOutput().GetBounds())\n    cubeAxesActor.SetCamera(renderer.GetActiveCamera())\n    cubeAxesActor.GetTitleTextProperty(0).SetColor(axis1Color)\n    cubeAxesActor.GetTitleTextProperty(0).SetFontSize(48)\n    cubeAxesActor.GetLabelTextProperty(0).SetColor(axis1Color)\n\n    cubeAxesActor.GetTitleTextProperty(1).SetColor(axis2Color)\n    cubeAxesActor.GetLabelTextProperty(1).SetColor(axis2Color)\n\n    cubeAxesActor.GetTitleTextProperty(2).SetColor(axis3Color)\n    cubeAxesActor.GetLabelTextProperty(2).SetColor(axis3Color)\n\n    cubeAxesActor.DrawXGridlinesOn()\n    cubeAxesActor.DrawYGridlinesOn()\n    cubeAxesActor.DrawZGridlinesOn()\n    cubeAxesActor.SetGridLineLocation(cubeAxesActor.VTK_GRID_LINES_FURTHEST)\n\n    cubeAxesActor.XAxisMinorTickVisibilityOff()\n    cubeAxesActor.YAxisMinorTickVisibilityOff()\n    cubeAxesActor.ZAxisMinorTickVisibilityOff()\n\n    cubeAxesActor.SetFlyModeToStaticEdges()\n    renderer.AddActor(cubeAxesActor)\n    renderer.AddActor(superquadricActor)\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    renderer.ResetCamera()\n    renderer.SetBackground(backgroundColor)\n\n    renderWindow = vtkRenderWindow()\n\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('CubeAxesActor')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    renderer.GetActiveCamera().Zoom(0.8)\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/CurvatureBandsWithGlyphs/","title":"CurvatureBandsWithGlyphs","text":"

vtk-examples/Python/Visualization/CurvatureBandsWithGlyphs

"},{"location":"Python/Visualization/CurvatureBandsWithGlyphs/#description","title":"Description","text":"

In this example we are coloring the surface by partitioning the gaussian curvature into bands and using arrows to display the normals on the surface.

Rather beautiful surfaces are generated.

The banded contour filter and an indexed lookup table are used to generate the curvature bands on the surface. To further enhance the surface, the surface normals are glyphed and colored by elevation using a diverging lookup table.

Note that:

  • If the regions on a surface have zero Gaussian curvature, then they can be flattened into a plane with no distortion, and the geometry of the region is Euclidean geometry.

  • If the regions on a surface have positive Gaussian curvature, then the geometry of the surface is spherical geometry.

  • If the regions on the surface have a negative Gaussian curvature, then the geometry of the surface is hyperbolic geometry.

In the above image you can see that the random hills incorporate all of these geometries.

The surface selected is the parametric random hills surface. The problem with the random hills surface is:

  • Most of the gaussian curvatures will lie in the range -1 to 0.2 (say) with a few large values say 20 to 40 at the peaks of the hills.
  • The edges of the random hills surface also have large irregular values so we need to handle these also. In order to fix this, a function is provided to adjust the edges.

So we need to manually generate custom bands to group the curvatures. The bands selected in the examples show that the surface is mostly planar with some hyperbolic regions (saddle points) and some spherical regions.

Feel free to experiment with different color schemes and/or the other sources from the parametric function group or the torus etc.

You will usually need to adjust the parameters for maskPts, arrow and glyph for a nice appearance.

A histogram of the frequencies is also output to the console. This is useful if you want to get an idea of the distribution of the scalars in each band.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/CurvatureBandsWithGlyphs/#code","title":"Code","text":"

CurvatureBandsWithGlyphs.py

#!/usr/bin/env python\n\nimport math\n\nimport numpy as np\nfrom vtkmodules.numpy_interface import dataset_adapter as dsa\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_DOUBLE,\n    vtkDoubleArray,\n    vtkFloatArray,\n    vtkIdList,\n    vtkLookupTable,\n    vtkPoints,\n    vtkVariant,\n    vtkVariantArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkDelaunay2D,\n    vtkElevationFilter,\n    vtkFeatureEdges,\n    vtkGlyph3D,\n    vtkIdFilter,\n    vtkMaskPoints,\n    vtkPolyDataNormals,\n    vtkReverseSense,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkCurvatures,\n    vtkTransformPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkBandedPolyDataContourFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkParametricFunctionSource,\n    vtkPlaneSource,\n    vtkSphereSource,\n    vtkSuperquadricSource\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtk.util import numpy_support\n\n\ndef main(argv):\n    # ------------------------------------------------------------\n    # Create the surface, lookup tables, contour filter etc.\n    # ------------------------------------------------------------\n    # desired_surface = 'Hills'\n    # desired_surface = 'ParametricTorus'\n    # desired_surface = 'Plane'\n    desired_surface = 'RandomHills'\n    # desired_surface = 'Sphere'\n    # desired_surface = 'Torus'\n    source = get_source(desired_surface)\n    if not source:\n        print('The surface is not available.')\n        return\n\n    # The length of the normal arrow glyphs.\n    scale_factor = 1.0\n    if desired_surface == 'Hills':\n        scale_factor = 0.5\n    elif desired_surface == 'Sphere':\n        scale_factor = 2.0\n    print(desired_surface)\n\n    gaussian_curvature = True\n    if gaussian_curvature:\n        curvature = 'Gauss_Curvature'\n    else:\n        curvature = 'Mean_Curvature'\n\n    cc = vtkCurvatures()\n    cc.SetInputData(source)\n    needs_adjusting = ['Hills', 'ParametricTorus', 'Plane', 'RandomHills', 'Torus']\n    if gaussian_curvature:\n        cc.SetCurvatureTypeToGaussian()\n        cc.Update()\n        if desired_surface in needs_adjusting:\n            adjust_edge_curvatures(cc.GetOutput(), curvature)\n        if desired_surface == 'Plane':\n            constrain_curvatures(cc.GetOutput(), curvature, 0.0, 0.0)\n        if desired_surface == 'Sphere':\n            # Gaussian curvature is 1/r^2\n            constrain_curvatures(cc.GetOutput(), curvature, 4.0, 4.0)\n    else:\n        cc.SetCurvatureTypeToMean()\n        cc.Update()\n        if desired_surface in needs_adjusting:\n            adjust_edge_curvatures(cc.GetOutput(), curvature)\n        if desired_surface == 'Plane':\n            constrain_curvatures(cc.GetOutput(), curvature, 0.0, 0.0)\n        if desired_surface == 'Sphere':\n            # Mean curvature is 1/r\n            constrain_curvatures(cc.GetOutput(), curvature, 2.0, 2.0)\n\n    cc.GetOutput().GetPointData().SetActiveScalars(curvature)\n    scalar_range_curvatures = cc.GetOutput().GetPointData().GetScalars(curvature).GetRange()\n    scalar_range_elevation = cc.GetOutput().GetPointData().GetScalars('Elevation').GetRange()\n\n    lut = get_categorical_lut()\n    lut1 = get_diverging_lut()\n    lut.SetTableRange(scalar_range_curvatures)\n    lut1.SetTableRange(scalar_range_elevation)\n    number_of_bands = lut.GetNumberOfTableValues()\n    bands = get_bands(scalar_range_curvatures, number_of_bands, 10)\n    if desired_surface == 'RandomHills':\n        # These are my custom bands.\n        # Generated by first running:\n        # bands = get_bands(scalar_range_curvatures, number_of_bands, False)\n        # then:\n        #  freq = frequencies(bands, src)\n        #  print_bands_frequencies(bands, freq)\n        # Finally using the output to create this table:\n        # my_bands = [\n        #     [-0.630, -0.190], [-0.190, -0.043], [-0.043, -0.0136],\n        #     [-0.0136, 0.0158], [0.0158, 0.0452], [0.0452, 0.0746],\n        #     [0.0746, 0.104], [0.104, 0.251], [0.251, 1.131]]\n        #  This demonstrates that the gaussian curvature of the surface\n        #   is mostly planar with some hyperbolic regions (saddle points)\n        #   and some spherical regions.\n        my_bands = [\n            [-0.630, -0.190], [-0.190, -0.043], [-0.043, 0.0452], [0.0452, 0.0746],\n            [0.0746, 0.104], [0.104, 0.251], [0.251, 1.131]]\n        # Comment this out if you want to see how allocating\n        # equally spaced bands works.\n        bands = get_custom_bands(scalar_range_curvatures, number_of_bands, my_bands)\n        # Adjust the number of table values\n        lut.SetNumberOfTableValues(len(bands))\n    elif desired_surface == 'Hills':\n        my_bands = [\n            [-2.104, -0.15], [-0.15, -0.1], [-0.1, -0.05],\n            [-0.05, -0.02], [-0.02, -0.005], [-0.005, -0.0005],\n            [-0.0005, 0.0005], [0.0005, 0.09], [0.09, 4.972]]\n        # Comment this out if you want to see how allocating\n        # equally spaced bands works.\n        bands = get_custom_bands(scalar_range_curvatures, number_of_bands, my_bands)\n        # Adjust the number of table values\n        lut.SetNumberOfTableValues(len(bands))\n\n    # Let's do a frequency table.\n    # The number of scalars in each band.\n    freq = get_frequencies(bands, cc.GetOutput())\n    bands, freq = adjust_ranges(bands, freq)\n    print_bands_frequencies(bands, freq)\n\n    lut.SetTableRange(scalar_range_curvatures)\n    lut.SetNumberOfTableValues(len(bands))\n\n    # We will use the midpoint of the band as the label.\n    labels = []\n    for k in bands:\n        labels.append('{:4.2f}'.format(bands[k][1]))\n\n    # Annotate\n    values = vtkVariantArray()\n    for i in range(len(labels)):\n        values.InsertNextValue(vtkVariant(labels[i]))\n    for i in range(values.GetNumberOfTuples()):\n        lut.SetAnnotation(i, values.GetValue(i).ToString())\n\n    # Create a lookup table with the colors reversed.\n    lutr = reverse_lut(lut)\n\n    # Create the contour bands.\n    bcf = vtkBandedPolyDataContourFilter()\n    bcf.SetInputData(cc.GetOutput())\n    # Use either the minimum or maximum value for each band.\n    for k in bands:\n        bcf.SetValue(k, bands[k][2])\n    # We will use an indexed lookup table.\n    bcf.SetScalarModeToIndex()\n    bcf.GenerateContourEdgesOn()\n\n    # Generate the glyphs on the original surface.\n    glyph = get_glyphs(cc.GetOutput(), scale_factor, False)\n\n    # ------------------------------------------------------------\n    # Create the mappers and actors\n    # ------------------------------------------------------------\n\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [179, 204, 255, 255])\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    src_mapper = vtkPolyDataMapper()\n    src_mapper.SetInputConnection(bcf.GetOutputPort())\n    src_mapper.SetScalarRange(scalar_range_curvatures)\n    src_mapper.SetLookupTable(lut)\n    src_mapper.SetScalarModeToUseCellData()\n\n    src_actor = vtkActor()\n    src_actor.SetMapper(src_mapper)\n\n    # Create contour edges\n    edge_mapper = vtkPolyDataMapper()\n    edge_mapper.SetInputData(bcf.GetContourEdgesOutput())\n    edge_mapper.SetResolveCoincidentTopologyToPolygonOffset()\n\n    edge_actor = vtkActor()\n    edge_actor.SetMapper(edge_mapper)\n    edge_actor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    glyph_mapper = vtkPolyDataMapper()\n    glyph_mapper.SetInputConnection(glyph.GetOutputPort())\n    glyph_mapper.SetScalarModeToUsePointFieldData()\n    glyph_mapper.SetColorModeToMapScalars()\n    glyph_mapper.ScalarVisibilityOn()\n    glyph_mapper.SelectColorArray('Elevation')\n    # Colour by scalars.\n    glyph_mapper.SetLookupTable(lut1)\n    glyph_mapper.SetScalarRange(scalar_range_elevation)\n\n    glyph_actor = vtkActor()\n    glyph_actor.SetMapper(glyph_mapper)\n\n    window_width = 800\n    window_height = 800\n\n    # Add scalar bars.\n    scalar_bar = vtkScalarBarActor()\n    # This LUT puts the lowest value at the top of the scalar bar.\n    # scalar_bar->SetLookupTable(lut);\n    # Use this LUT if you want the highest value at the top.\n    scalar_bar.SetLookupTable(lutr)\n    scalar_bar.SetTitle(curvature.replace('_', '\\n'))\n    scalar_bar.GetTitleTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.GetLabelTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.GetAnnotationTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.UnconstrainedFontSizeOn()\n    scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar.SetMaximumHeightInPixels(window_height // 3)\n    scalar_bar.SetPosition(0.85, 0.05)\n\n    scalar_bar_elev = vtkScalarBarActor()\n    # This LUT puts the lowest value at the top of the scalar bar.\n    # scalar_bar_elev->SetLookupTable(lut);\n    # Use this LUT if you want the highest value at the top.\n    scalar_bar_elev.SetLookupTable(lut1)\n    scalar_bar_elev.SetTitle('Elevation')\n    scalar_bar_elev.GetTitleTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar_elev.GetLabelTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar_elev.GetAnnotationTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar_elev.UnconstrainedFontSizeOn()\n    if desired_surface == 'Plane':\n        scalar_bar_elev.SetNumberOfLabels(1)\n    else:\n        scalar_bar_elev.SetNumberOfLabels(5)\n    scalar_bar_elev.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar_elev.SetMaximumHeightInPixels(window_height // 3)\n    # scalar_bar_elev.SetBarRatio(scalar_bar_elev.GetBarRatio() * 0.5)\n    scalar_bar_elev.SetPosition(0.85, 0.4)\n\n    # ------------------------------------------------------------\n    # Create the RenderWindow, Renderer and Interactor\n    # ------------------------------------------------------------\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    ren_win.AddRenderer(ren)\n    # Important: The interactor must be set prior to enabling the widget.\n    iren.SetRenderWindow(ren_win)\n    if vtk_version_ok(9, 0, 20210718):\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        cam_orient_manipulator.SetParentRenderer(ren)\n        # Enable the widget.\n        cam_orient_manipulator.On()\n\n    # add actors\n    ren.AddViewProp(src_actor)\n    ren.AddViewProp(edge_actor)\n    ren.AddViewProp(glyph_actor)\n    ren.AddActor2D(scalar_bar)\n    ren.AddActor2D(scalar_bar_elev)\n\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n    ren_win.SetSize(window_width, window_height)\n    ren_win.SetWindowName('CurvatureBandsWithGlyphs')\n\n    if desired_surface == \"RandomHills\":\n        camera = ren.GetActiveCamera()\n        camera.SetPosition(10.9299, 59.1505, 24.9823)\n        camera.SetFocalPoint(2.21692, 7.97545, 7.75135)\n        camera.SetViewUp(-0.230136, 0.345504, -0.909761)\n        camera.SetDistance(54.6966)\n        camera.SetClippingRange(36.3006, 77.9852)\n        ren_win.Render()\n\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\ndef adjust_edge_curvatures(source, curvature_name, epsilon=1.0e-08):\n    \"\"\"\n    This function adjusts curvatures along the edges of the surface by replacing\n     the value with the average value of the curvatures of points in the neighborhood.\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param epsilon: Absolute curvature values less than this will be set to zero.\n    :return:\n    \"\"\"\n\n    def point_neighbourhood(pt_id):\n        \"\"\"\n        Find the ids of the neighbours of pt_id.\n\n        :param pt_id: The point id.\n        :return: The neighbour ids.\n        \"\"\"\n        \"\"\"\n        Extract the topological neighbors for point pId. In two steps:\n        1) source.GetPointCells(pt_id, cell_ids)\n        2) source.GetCellPoints(cell_id, cell_point_ids) for all cell_id in cell_ids\n        \"\"\"\n        cell_ids = vtkIdList()\n        source.GetPointCells(pt_id, cell_ids)\n        neighbour = set()\n        for cell_idx in range(0, cell_ids.GetNumberOfIds()):\n            cell_id = cell_ids.GetId(cell_idx)\n            cell_point_ids = vtkIdList()\n            source.GetCellPoints(cell_id, cell_point_ids)\n            for cell_pt_idx in range(0, cell_point_ids.GetNumberOfIds()):\n                neighbour.add(cell_point_ids.GetId(cell_pt_idx))\n        return neighbour\n\n    def compute_distance(pt_id_a, pt_id_b):\n        \"\"\"\n        Compute the distance between two points given their ids.\n\n        :param pt_id_a:\n        :param pt_id_b:\n        :return:\n        \"\"\"\n        pt_a = np.array(source.GetPoint(pt_id_a))\n        pt_b = np.array(source.GetPoint(pt_id_b))\n        return np.linalg.norm(pt_a - pt_b)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    #  Get the boundary point IDs.\n    array_name = 'ids'\n    id_filter = vtkIdFilter()\n    id_filter.SetInputData(source)\n    id_filter.SetPointIds(True)\n    id_filter.SetCellIds(False)\n    id_filter.SetPointIdsArrayName(array_name)\n    id_filter.SetCellIdsArrayName(array_name)\n    id_filter.Update()\n\n    edges = vtkFeatureEdges()\n    edges.SetInputConnection(id_filter.GetOutputPort())\n    edges.BoundaryEdgesOn()\n    edges.ManifoldEdgesOff()\n    edges.NonManifoldEdgesOff()\n    edges.FeatureEdgesOff()\n    edges.Update()\n\n    edge_array = edges.GetOutput().GetPointData().GetArray(array_name)\n    boundary_ids = []\n    for i in range(edges.GetOutput().GetNumberOfPoints()):\n        boundary_ids.append(edge_array.GetValue(i))\n    # Remove duplicate Ids.\n    p_ids_set = set(boundary_ids)\n\n    # Iterate over the edge points and compute the curvature as the weighted\n    # average of the neighbours.\n    count_invalid = 0\n    for p_id in boundary_ids:\n        p_ids_neighbors = point_neighbourhood(p_id)\n        # Keep only interior points.\n        p_ids_neighbors -= p_ids_set\n        # Compute distances and extract curvature values.\n        curvs = [curvatures[p_id_n] for p_id_n in p_ids_neighbors]\n        dists = [compute_distance(p_id_n, p_id) for p_id_n in p_ids_neighbors]\n        curvs = np.array(curvs)\n        dists = np.array(dists)\n        curvs = curvs[dists > 0]\n        dists = dists[dists > 0]\n        if len(curvs) > 0:\n            weights = 1 / np.array(dists)\n            weights /= weights.sum()\n            new_curv = np.dot(curvs, weights)\n        else:\n            # Corner case.\n            count_invalid += 1\n            # Assuming the curvature of the point is planar.\n            new_curv = 0.0\n        # Set the new curvature value.\n        curvatures[p_id] = new_curv\n\n    #  Set small values to zero.\n    if epsilon != 0.0:\n        curvatures = np.where(abs(curvatures) < epsilon, 0, curvatures)\n        # Curvatures is now an ndarray\n        curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                          deep=True,\n                                          array_type=VTK_DOUBLE)\n        curv.SetName(curvature_name)\n        source.GetPointData().RemoveArray(curvature_name)\n        source.GetPointData().AddArray(curv)\n        source.GetPointData().SetActiveScalars(curvature_name)\n\n\ndef constrain_curvatures(source, curvature_name, lower_bound=0.0, upper_bound=0.0):\n    \"\"\"\n    This function constrains curvatures to the range [lower_bound ... upper_bound].\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param lower_bound: The lower bound.\n    :param upper_bound: The upper bound.\n    :return:\n    \"\"\"\n\n    bounds = list()\n    if lower_bound < upper_bound:\n        bounds.append(lower_bound)\n        bounds.append(upper_bound)\n    else:\n        bounds.append(upper_bound)\n        bounds.append(lower_bound)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    # Set upper and lower bounds.\n    curvatures = np.where(curvatures < bounds[0], bounds[0], curvatures)\n    curvatures = np.where(curvatures > bounds[1], bounds[1], curvatures)\n    # Curvatures is now an ndarray\n    curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                      deep=True,\n                                      array_type=VTK_DOUBLE)\n    curv.SetName(curvature_name)\n    source.GetPointData().RemoveArray(curvature_name)\n    source.GetPointData().AddArray(curv)\n    source.GetPointData().SetActiveScalars(curvature_name)\n\n\ndef get_elevations(src):\n    \"\"\"\n    Generate elevations over the surface.\n    :param: src - the vtkPolyData source.\n    :return: - vtkPolyData source with elevations.\n    \"\"\"\n    bounds = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]\n    src.GetBounds(bounds)\n    if abs(bounds[2]) < 1.0e-8 and abs(bounds[3]) < 1.0e-8:\n        bounds[3] = bounds[2] + 1\n    elev_filter = vtkElevationFilter()\n    elev_filter.SetInputData(src)\n    elev_filter.SetLowPoint(0, bounds[2], 0)\n    elev_filter.SetHighPoint(0, bounds[3], 0)\n    elev_filter.SetScalarRange(bounds[2], bounds[3])\n    elev_filter.Update()\n    return elev_filter.GetPolyDataOutput()\n\n\ndef get_hills():\n    # Create four hills on a plane.\n    # This will have regions of negative, zero and positive Gsaussian curvatures.\n\n    x_res = 50\n    y_res = 50\n    x_min = -5.0\n    x_max = 5.0\n    dx = (x_max - x_min) / (x_res - 1)\n    y_min = -5.0\n    y_max = 5.0\n    dy = (y_max - y_min) / (x_res - 1)\n\n    # Make a grid.\n    points = vtkPoints()\n    for i in range(0, x_res):\n        x = x_min + i * dx\n        for j in range(0, y_res):\n            y = y_min + j * dy\n            points.InsertNextPoint(x, y, 0)\n\n    # Add the grid points to a polydata object.\n    plane = vtkPolyData()\n    plane.SetPoints(points)\n\n    # Triangulate the grid.\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(plane)\n    delaunay.Update()\n\n    polydata = delaunay.GetOutput()\n\n    elevation = vtkDoubleArray()\n    elevation.SetNumberOfTuples(points.GetNumberOfPoints())\n\n    #  We define the parameters for the hills here.\n    # [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n    hd = [[-2.5, -2.5, 2.5, 6.5, 3.5], [2.5, 2.5, 2.5, 2.5, 2],\n          [5.0, -2.5, 1.5, 1.5, 2.5], [-5.0, 5, 2.5, 3.0, 3]]\n    xx = [0.0] * 2\n    for i in range(0, points.GetNumberOfPoints()):\n        x = list(polydata.GetPoint(i))\n        for j in range(0, len(hd)):\n            xx[0] = (x[0] - hd[j][0] / hd[j][2]) ** 2.0\n            xx[1] = (x[1] - hd[j][1] / hd[j][3]) ** 2.0\n            x[2] += hd[j][4] * math.exp(-(xx[0] + xx[1]) / 2.0)\n            polydata.GetPoints().SetPoint(i, x)\n            elevation.SetValue(i, x[2])\n\n    textures = vtkFloatArray()\n    textures.SetNumberOfComponents(2)\n    textures.SetNumberOfTuples(2 * polydata.GetNumberOfPoints())\n    textures.SetName(\"Textures\")\n\n    for i in range(0, x_res):\n        tc = [i / (x_res - 1.0), 0.0]\n        for j in range(0, y_res):\n            # tc[1] = 1.0 - j / (y_res - 1.0)\n            tc[1] = j / (y_res - 1.0)\n            textures.SetTuple(i * y_res + j, tc)\n\n    polydata.GetPointData().SetScalars(elevation)\n    polydata.GetPointData().GetScalars().SetName(\"Elevation\")\n    polydata.GetPointData().SetTCoords(textures)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputData(polydata)\n    normals.SetInputData(polydata)\n    normals.SetFeatureAngle(30)\n    normals.SplittingOff()\n\n    tr1 = vtkTransform()\n    tr1.RotateX(-90)\n\n    tf1 = vtkTransformPolyDataFilter()\n    tf1.SetInputConnection(normals.GetOutputPort())\n    tf1.SetTransform(tr1)\n    tf1.Update()\n\n    return tf1.GetOutput()\n\n\ndef get_parametric_hills():\n    \"\"\"\n    Make a parametric hills surface as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n    fn = vtkParametricRandomHills()\n    fn.AllowRandomGenerationOn()\n    fn.SetRandomSeed(1)\n    fn.SetNumberOfHills(30)\n    # Make the normals face out of the surface.\n    # Not needed with VTK 8.0 or later.\n    # if fn.GetClassName() == 'vtkParametricRandomHills':\n    #    fn.ClockwiseOrderingOff()\n\n    source = vtkParametricFunctionSource()\n    source.SetParametricFunction(fn)\n    source.SetUResolution(50)\n    source.SetVResolution(50)\n    source.SetScalarModeToZ()\n    source.Update()\n    # Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n    # source.GetOutput().GetPointData().GetNormals().SetName('Normals')\n    # source.GetOutput().GetPointData().GetScalars().SetName('Scalars')\n    # Rename the scalars to 'Elevation' since we are using the Z-scalars as elevations.\n    source.GetOutput().GetPointData().GetScalars().SetName('Elevation')\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_parametric_torus():\n    \"\"\"\n    Make a parametric torus as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n\n    fn = vtkParametricTorus()\n    fn.SetRingRadius(5)\n    fn.SetCrossSectionRadius(2)\n\n    source = vtkParametricFunctionSource()\n    source.SetParametricFunction(fn)\n    source.SetUResolution(50)\n    source.SetVResolution(50)\n    source.SetScalarModeToZ()\n    source.Update()\n\n    # Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n    # source.GetOutput().GetPointData().GetNormals().SetName('Normals')\n    # source.GetOutput().GetPointData().GetScalars().SetName('Scalars')\n    # Rename the scalars to 'Elevation' since we are using the Z-scalars as elevations.\n    source.GetOutput().GetPointData().GetScalars().SetName('Elevation')\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_plane():\n    \"\"\"\n    Make a plane as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n\n    source = vtkPlaneSource()\n    source.SetOrigin(-10.0, -10.0, 0.0)\n    source.SetPoint2(-10.0, 10.0, 0.0)\n    source.SetPoint1(10.0, -10.0, 0.0)\n    source.SetXResolution(20)\n    source.SetYResolution(20)\n    source.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 0.0, 0.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    # We have a m x n array of quadrilaterals arranged as a regular tiling in a\n    # plane. So pass it through a triangle filter since the curvature filter only\n    # operates on polys.\n    tri = vtkTriangleFilter()\n    tri.SetInputConnection(transform_filter.GetOutputPort())\n\n    # Pass it though a CleanPolyDataFilter and merge any points which\n    # are coincident, or very close\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(tri.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    return cleaner.GetOutput()\n\n\ndef get_sphere():\n    source = vtkSphereSource()\n    source.SetCenter(0.0, 0.0, 0.0)\n    source.SetRadius(10.0)\n    source.SetThetaResolution(32)\n    source.SetPhiResolution(32)\n    source.Update()\n\n    return source.GetOutput()\n\n\ndef get_torus():\n    \"\"\"\n    Make a torus as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n    source = vtkSuperquadricSource()\n    source.SetCenter(0.0, 0.0, 0.0)\n    source.SetScale(1.0, 1.0, 1.0)\n    source.SetPhiResolution(64)\n    source.SetThetaResolution(64)\n    source.SetThetaRoundness(1)\n    source.SetThickness(0.5)\n    source.SetSize(10)\n    source.SetToroidal(1)\n\n    # The quadric is made of strips, so pass it through a triangle filter as\n    # the curvature filter only operates on polys\n    tri = vtkTriangleFilter()\n    tri.SetInputConnection(source.GetOutputPort())\n\n    # The quadric has nasty discontinuities from the way the edges are generated\n    # so let's pass it though a CleanPolyDataFilter and merge any points which\n    # are coincident, or very close\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(tri.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    return cleaner.GetOutput()\n\n\ndef get_source(source):\n    surface = source.lower()\n    available_surfaces = ['hills', 'parametrictorus', 'plane', 'randomhills', 'sphere', 'torus']\n    if surface not in available_surfaces:\n        return None\n    elif surface == 'hills':\n        return get_hills()\n    elif surface == 'parametrictorus':\n        return get_parametric_torus()\n    elif surface == 'plane':\n        return get_elevations(get_plane())\n    elif surface == 'randomhills':\n        return get_parametric_hills()\n    elif surface == 'sphere':\n        return get_elevations(get_sphere())\n    elif surface == 'torus':\n        return get_elevations(get_torus())\n    return None\n\n\ndef get_color_series():\n    color_series = vtkColorSeries()\n    # Select a color scheme.\n    # color_series_enum = color_series.BREWER_DIVERGING_BROWN_BLUE_GREEN_9\n    # color_series_enum = color_series.BREWER_DIVERGING_SPECTRAL_10\n    # color_series_enum = color_series.BREWER_DIVERGING_SPECTRAL_3\n    # color_series_enum = color_series.BREWER_DIVERGING_PURPLE_ORANGE_9\n    # color_series_enum = color_series.BREWER_SEQUENTIAL_BLUE_PURPLE_9\n    # color_series_enum = color_series.BREWER_SEQUENTIAL_BLUE_GREEN_9\n    color_series_enum = color_series.BREWER_QUALITATIVE_SET3\n    # color_series_enum = color_series.CITRUS\n    color_series.SetColorScheme(color_series_enum)\n    return color_series\n\n\ndef get_categorical_lut():\n    \"\"\"\n    Make a lookup table using vtkColorSeries.\n    :return: An indexed (categorical) lookup table.\n    \"\"\"\n    color_series = get_color_series()\n    # Make the lookup table.\n    lut = vtkLookupTable()\n    color_series.BuildLookupTable(lut, color_series.CATEGORICAL)\n    lut.SetNanColor(0, 0, 0, 1)\n    return lut\n\n\ndef get_ordinal_lut():\n    \"\"\"\n    Make a lookup table using vtkColorSeries.\n    :return: An ordinal (not indexed) lookup table.\n    \"\"\"\n    color_series = get_color_series()\n    # Make the lookup table.\n    lut = vtkLookupTable()\n    color_series.BuildLookupTable(lut, color_series.ORDINAL)\n    lut.SetNanColor(0, 0, 0, 1)\n    return lut\n\n\ndef get_diverging_lut():\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start point         midPoint            end point\n     cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n     purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n     green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n     blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n     green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n\n    :return:\n    \"\"\"\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    # Cool to warm.\n    ctf.AddRGBPoint(0.0, 0.085, 0.532, 0.201)\n    ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n    ctf.AddRGBPoint(1.0, 0.758, 0.214, 0.233)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef reverse_lut(lut):\n    \"\"\"\n    Create a lookup table with the colors reversed.\n    :param: lut - An indexed lookup table.\n    :return: The reversed indexed lookup table.\n    \"\"\"\n    lutr = vtkLookupTable()\n    lutr.DeepCopy(lut)\n    t = lut.GetNumberOfTableValues() - 1\n    rev_range = reversed(list(range(t + 1)))\n    for i in rev_range:\n        rgba = [0.0] * 3\n        v = float(i)\n        lut.GetColor(v, rgba)\n        rgba.append(lut.GetOpacity(v))\n        lutr.SetTableValue(t - i, rgba)\n    t = lut.GetNumberOfAnnotatedValues() - 1\n    rev_range = reversed(list(range(t + 1)))\n    for i in rev_range:\n        lutr.SetAnnotation(t - i, lut.GetAnnotation(i))\n    return lutr\n\n\ndef get_glyphs(src, scale_factor=1.0, reverse_normals=False):\n    \"\"\"\n    Glyph the normals on the surface.\n\n    You may need to adjust the parameters for mask_pts, arrow and glyph for a\n    nice appearance.\n\n    :param: src - the surface to glyph.\n    :param: reverse_normals - if True the normals on the surface are reversed.\n    :return: The glyph object.\n\n    \"\"\"\n    # Sometimes the contouring algorithm can create a volume whose gradient\n    # vector and ordering of polygon (using the right hand rule) are\n    # inconsistent. vtkReverseSense cures this problem.\n    reverse = vtkReverseSense()\n\n    # Choose a random subset of points.\n    mask_pts = vtkMaskPoints()\n    mask_pts.SetOnRatio(5)\n    mask_pts.RandomModeOn()\n    if reverse_normals:\n        reverse.SetInputData(src)\n        reverse.ReverseCellsOn()\n        reverse.ReverseNormalsOn()\n        mask_pts.SetInputConnection(reverse.GetOutputPort())\n    else:\n        mask_pts.SetInputData(src)\n\n    # Source for the glyph filter\n    arrow = vtkArrowSource()\n    arrow.SetTipResolution(16)\n    arrow.SetTipLength(0.3)\n    arrow.SetTipRadius(0.1)\n\n    glyph = vtkGlyph3D()\n    glyph.SetSourceConnection(arrow.GetOutputPort())\n    glyph.SetInputConnection(mask_pts.GetOutputPort())\n    glyph.SetVectorModeToUseNormal()\n    glyph.SetScaleFactor(scale_factor)\n    glyph.SetColorModeToColorByVector()\n    glyph.SetScaleModeToScaleByVector()\n    glyph.OrientOn()\n    glyph.Update()\n    return glyph\n\n\ndef get_bands(d_r, number_of_bands, precision=2, nearest_integer=False):\n    \"\"\"\n    Divide a range into bands\n    :param: d_r - [min, max] the range that is to be covered by the bands.\n    :param: number_of_bands - The number of bands, a positive integer.\n    :param: precision - The decimal precision of the bounds.\n    :param: nearest_integer - If True then [floor(min), ceil(max)] is used.\n    :return: A dictionary consisting of the band number and [min, midpoint, max] for each band.\n    \"\"\"\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    bands = dict()\n    if (d_r[1] < d_r[0]) or (number_of_bands <= 0):\n        return bands\n    x = list(d_r)\n    if nearest_integer:\n        x[0] = math.floor(x[0])\n        x[1] = math.ceil(x[1])\n    dx = (x[1] - x[0]) / float(number_of_bands)\n    b = [x[0], x[0] + dx / 2.0, x[0] + dx]\n    i = 0\n    while i < number_of_bands:\n        b = list(map(lambda ele_b: round(ele_b, prec), b))\n        if i == 0:\n            b[0] = x[0]\n        bands[i] = b\n        b = [b[0] + dx, b[1] + dx, b[2] + dx]\n        i += 1\n    return bands\n\n\ndef get_custom_bands(d_r, number_of_bands, my_bands):\n    \"\"\"\n    Divide a range into custom bands.\n\n    You need to specify each band as an list [r1, r2] where r1 < r2 and\n    append these to a list.\n    The list should ultimately look\n    like this: [[r1, r2], [r2, r3], [r3, r4]...]\n\n    :param: d_r - [min, max] the range that is to be covered by the bands.\n    :param: number_of_bands - the number of bands, a positive integer.\n    :return: A dictionary consisting of band number and [min, midpoint, max] for each band.\n    \"\"\"\n    bands = dict()\n    if (d_r[1] < d_r[0]) or (number_of_bands <= 0):\n        return bands\n    x = my_bands\n    # Determine the index of the range minimum and range maximum.\n    idx_min = 0\n    for idx in range(0, len(my_bands)):\n        if my_bands[idx][1] > d_r[0] >= my_bands[idx][0]:\n            idx_min = idx\n            break\n\n    idx_max = len(my_bands) - 1\n    for idx in range(len(my_bands) - 1, -1, -1):\n        if my_bands[idx][1] > d_r[1] >= my_bands[idx][0]:\n            idx_max = idx\n            break\n\n    # Set the minimum to match the range minimum.\n    x[idx_min][0] = d_r[0]\n    x[idx_max][1] = d_r[1]\n    x = x[idx_min: idx_max + 1]\n    for idx, e in enumerate(x):\n        bands[idx] = [e[0], e[0] + (e[1] - e[0]) / 2, e[1]]\n    return bands\n\n\ndef get_frequencies(bands, src):\n    \"\"\"\n    Count the number of scalars in each band.\n    The scalars used are the active scalars in the polydata.\n\n    :param: bands - The bands.\n    :param: src - The vtkPolyData source.\n    :return: The frequencies of the scalars in each band.\n    \"\"\"\n    freq = dict()\n    for i in range(len(bands)):\n        freq[i] = 0\n    tuples = src.GetPointData().GetScalars().GetNumberOfTuples()\n    for i in range(tuples):\n        x = src.GetPointData().GetScalars().GetTuple1(i)\n        for j in range(len(bands)):\n            if x <= bands[j][2]:\n                freq[j] += 1\n                break\n    return freq\n\n\ndef adjust_ranges(bands, freq):\n    \"\"\"\n    The bands and frequencies are adjusted so that the first and last\n     frequencies in the range are non-zero.\n    :param bands: The bands dictionary.\n    :param freq: The frequency dictionary.\n    :return: Adjusted bands and frequencies.\n    \"\"\"\n    # Get the indices of the first and last non-zero elements.\n    first = 0\n    for k, v in freq.items():\n        if v != 0:\n            first = k\n            break\n    rev_keys = list(freq.keys())[::-1]\n    last = rev_keys[0]\n    for idx in list(freq.keys())[::-1]:\n        if freq[idx] != 0:\n            last = idx\n            break\n    # Now adjust the ranges.\n    min_key = min(freq.keys())\n    max_key = max(freq.keys())\n    for idx in range(min_key, first):\n        freq.pop(idx)\n        bands.pop(idx)\n    for idx in range(last + 1, max_key + 1):\n        freq.popitem()\n        bands.popitem()\n    old_keys = freq.keys()\n    adj_freq = dict()\n    adj_bands = dict()\n\n    for idx, k in enumerate(old_keys):\n        adj_freq[idx] = freq[k]\n        adj_bands[idx] = bands[k]\n\n    return adj_bands, adj_freq\n\n\ndef print_bands_frequencies(bands, freq, precision=2):\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    if len(bands) != len(freq):\n        print('Bands and Frequencies must be the same size.')\n        return\n    s = f'Bands & Frequencies:\\n'\n    total = 0\n    width = prec + 6\n    for k, v in bands.items():\n        total += freq[k]\n        for j, q in enumerate(v):\n            if j == 0:\n                s += f'{k:4d} ['\n            if j == len(v) - 1:\n                s += f'{q:{width}.{prec}f}]: {freq[k]:8d}\\n'\n            else:\n                s += f'{q:{width}.{prec}f}, '\n    width = 3 * width + 13\n    s += f'{\"Total\":{width}s}{total:8d}\\n'\n    print(s)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Visualization/DisplayCoordinateAxes/","title":"DisplayCoordinateAxes","text":"

vtk-examples/Python/Visualization/DisplayCoordinateAxes

"},{"location":"Python/Visualization/DisplayCoordinateAxes/#description","title":"Description","text":"

This example shows how to display the coordinate axes in the render window.

Seealso

Axes.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/DisplayCoordinateAxes/#code","title":"Code","text":"

DisplayCoordinateAxes.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(1.0)\n    sphereSource.Update()\n\n    polydata = sphereSource.GetOutput()\n\n    # Create a mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polydata)\n\n    # Create an actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('DisplayCoordinateAxes')\n    renderWindow.AddRenderer(renderer)\n\n    # An interactor\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    axes = vtkAxesActor()\n\n    widget = vtkOrientationMarkerWidget()\n    rgba = [0] * 4\n    colors.GetColor('Carrot', rgba)\n    widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n    widget.SetOrientationMarker(axes)\n    widget.SetInteractor(renderWindowInteractor)\n    widget.SetViewport(0.0, 0.0, 0.4, 0.4)\n    widget.SetEnabled(1)\n    widget.InteractiveOn()\n\n    renderer.GetActiveCamera().Azimuth(50)\n    renderer.GetActiveCamera().Elevation(-30)\n\n    renderer.ResetCamera()\n    renderWindow.Render()\n\n    # Begin mouse interaction\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/DisplayQuadricSurfaces/","title":"DisplayQuadricSurfaces","text":"

vtk-examples/Python/Visualization/DisplayQuadricSurfaces

"},{"location":"Python/Visualization/DisplayQuadricSurfaces/#description","title":"Description","text":"

This example demonstrates how to create and display a quadratic surface.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/DisplayQuadricSurfaces/#code","title":"Code","text":"

DisplayQuadricSurfaces.py

#!/usr/bin/python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef Sphere():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, 1, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2 + 1*z^2\n\n    PlotFunction(quadric, 1.0)\n\n\ndef EllipticParaboloid():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, 0, 0, 0, 0, 0, 0, -1, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2\n\n    PlotFunction(quadric, 10.0)\n\n\ndef HyperbolicParaboloid():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, -1, 0, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 - 1*y^2\n\n    PlotFunction(quadric, 10.0)\n\n\ndef Cylinder():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, 0, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2\n\n    PlotFunction(quadric, 1.0)\n\n\ndef HyperboloidOneSheet():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2\n\n    PlotFunction(quadric, 1.0)\n\n\ndef HyperboloidTwoSheets():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2\n\n    PlotFunction(quadric, -1.0)\n\n\ndef Ellipsoid():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, 2, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2 + 1*z^2\n\n    PlotFunction(quadric, 1.0)\n\n\ndef Cone():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2 - 1*z^2\n    PlotFunction(quadric, 0.0)\n\n\ndef Other():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 0.5*x^2 + 1*y^2 + 0.2*z^2 + 0*x*y + 0.1*y*z + 0*x*z + 0*x + 0.2*y + 0*z + 0\n    PlotFunction(quadric, 1.0)\n\n\ndef PlotFunction(quadric, value):\n    colors = vtkNamedColors()\n\n    # sample the quadric function\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(50, 50, 50)\n    sample.SetImplicitFunction(quadric)\n    # double xmin = 0, xmax=1, ymin=0, ymax=1, zmin=0, zmax=1\n    bounds = [-10, 11, -10, 10, -10, 10]\n    sample.SetModelBounds(bounds)\n\n    # create the 0 isosurface\n    contours = vtkContourFilter()\n    contours.SetInputConnection(sample.GetOutputPort())\n    contours.GenerateValues(1, value, value)\n\n    # map the contours to graphical primitives\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contours.GetOutputPort())\n    contourMapper.SetScalarRange(0.0, 1.2)\n\n    # create an actor for the contours\n    contourActor = vtkActor()\n    contourActor.SetMapper(contourMapper)\n\n    # -- create a box around the function to indicate the sampling volume --\n\n    # create outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(sample.GetOutputPort())\n\n    # map it to graphics primitives\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    # create an actor for it\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # setup the window\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetWindowName('DisplayQuadricSurfaces')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # add the actors to the scene\n    ren1.AddActor(contourActor)\n    ren1.AddActor(outlineActor)\n    ren1.SetBackground(colors.GetColor3d('AliceBlue'))\n\n    # render and interact\n    renWin.Render()\n    ren1.GetActiveCamera().Azimuth(-55)\n    ren1.GetActiveCamera().Elevation(15)\n\n    iren.Start()\n\n\ndef main():\n    #  Choose one!\n\n    # Other()\n    # Sphere()\n    # Cone()\n    # Ellipsoid()\n    # Cylinder()\n    # HyperboloidOneSheet()\n    # HyperboloidTwoSheets()\n    # HyperbolicParaboloid()\n    EllipticParaboloid()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/ElevationBandsWithGlyphs/","title":"ElevationBandsWithGlyphs","text":"

vtk-examples/Python/Visualization/ElevationBandsWithGlyphs

"},{"location":"Python/Visualization/ElevationBandsWithGlyphs/#description","title":"Description","text":"

In this example we are coloring the surface by partitioning the elevation into bands and using arrows to display the normals on the surface.

Rather beautiful surfaces are generated.

The banded contour filter and an indexed lookup table are used along with the elevation filter to generate the banding on the surface. To further enhance the surface, the surface normals are glyphed and colored by elevation using an ordinal lookup table.

Feel free to experiment with different color schemes and/or the other sources from the parametric function group or a cone etc.

You will usually need to adjust the parameters for mask_p_ts, arrow and glyph for a nice appearance. Do this in the function make_glyphs().

You may also need to add an elevation filter to generate the scalars as demonstrated in make_sphere().

print_bands_frequencies() allows you to inspect the bands and the number of scalars in each band. This are useful if you want to get an idea of the distribution of the scalars in each band.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/ElevationBandsWithGlyphs/#code","title":"Code","text":"

ElevationBandsWithGlyphs.py

#!/usr/bin/env python\n\nimport math\n\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkFloatArray,\n    vtkLookupTable,\n    vtkPoints,\n    vtkVariant,\n    vtkVariantArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkDelaunay2D,\n    vtkElevationFilter,\n    vtkGlyph3D,\n    vtkMaskPoints,\n    vtkPolyDataNormals,\n    vtkReverseSense,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkBandedPolyDataContourFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkParametricFunctionSource,\n    vtkPlaneSource,\n    vtkSphereSource,\n    vtkSuperquadricSource\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n\n\ndef main(argv):\n    # ------------------------------------------------------------\n    # Create the surface, lookup tables, contour filter etc.\n    # ------------------------------------------------------------\n    # desired_surface = 'Hills'\n    # desired_surface = 'ParametricTorus'\n    # desired_surface = 'Plane'\n    desired_surface = 'RandomHills'\n    # desired_surface = 'Sphere'\n    # desired_surface = 'Torus'\n    source = get_source(desired_surface)\n    if not source:\n        print('The surface is not available.')\n        return\n\n    # The length of the normal arrow glyphs.\n    scale_factor = 1.0\n    if desired_surface == 'Hills':\n        scale_factor = 0.5\n    elif desired_surface == 'Sphere':\n        scale_factor = 2.0\n    print(desired_surface)\n\n    source.GetPointData().SetActiveScalars('Elevation')\n    scalar_range = source.GetPointData().GetScalars('Elevation').GetRange()\n\n    lut = get_categorical_lut()\n    lut1 = get_ordinal_lut()\n    lut.SetTableRange(scalar_range)\n    lut1.SetTableRange(scalar_range)\n    number_of_bands = lut.GetNumberOfTableValues()\n    lut.SetNumberOfTableValues(number_of_bands)\n    precision = 10\n    bands = get_bands(scalar_range, number_of_bands, precision, False)\n\n    if desired_surface == 'RandomHills':\n        # These are my custom bands.\n        # Generated by first running:\n        # bands = get_bands(scalar_range, number_of_bands, precision, False)\n        # then:\n        #  freq = get_frequencies(bands, source)\n        #  print_bands_frequencies(bands, freq)\n        # Finally using the output to create this table:\n        my_bands = [\n            [0, 1.0], [1.0, 2.0], [2.0, 3.0],\n            [3.0, 4.0], [4.0, 5.0], [5.0, 6.0],\n            [6.0, 7.0], [7.0, 8.0]]\n        # Comment this out if you want to see how allocating\n        # equally spaced bands works.\n        bands = get_custom_bands(scalar_range, number_of_bands, my_bands)\n        # bands = get_bands(scalar_range, number_of_bands, precision, False)\n\n    # Let's do a frequency table.\n    # The number of scalars in each band.\n    freq = get_frequencies(bands, source)\n    bands, freq = adjust_ranges(bands, freq)\n    print_bands_frequencies(bands, freq)\n\n    scalar_range = (bands[0][0], bands[len(bands) - 1][2])\n    lut.SetTableRange(scalar_range)\n    lut.SetNumberOfTableValues(len(bands))\n    lut1.SetNumberOfTableValues(len(bands))\n\n    # We will use the midpoint of the band as the label.\n    labels = []\n    for k in bands:\n        labels.append('{:4.2f}'.format(bands[k][1]))\n\n    # Annotate\n    values = vtkVariantArray()\n    for i in range(len(labels)):\n        values.InsertNextValue(vtkVariant(labels[i]))\n    for i in range(values.GetNumberOfTuples()):\n        lut.SetAnnotation(i, values.GetValue(i).ToString())\n\n    # Create a lookup table with the colors reversed.\n    lutr = reverse_lut(lut)\n\n    # Create the contour bands.\n    bcf = vtkBandedPolyDataContourFilter()\n    bcf.SetInputData(source)\n    # Use either the minimum or maximum value for each band.\n    for i in range(len(bands)):\n        bcf.SetValue(i, bands[i][2])\n    # We will use an indexed lookup table.\n    bcf.SetScalarModeToIndex()\n    bcf.GenerateContourEdgesOn()\n\n    # Generate the glyphs on the original surface.\n    glyph = get_glyphs(source, scale_factor, False)\n\n    # ------------------------------------------------------------\n    # Create the mappers and actors\n    # ------------------------------------------------------------\n\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [179, 204, 255, 255])\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    src_mapper = vtkPolyDataMapper()\n    src_mapper.SetInputConnection(bcf.GetOutputPort())\n    src_mapper.SetScalarRange(scalar_range)\n    src_mapper.SetLookupTable(lut)\n    src_mapper.SetScalarModeToUseCellData()\n\n    src_actor = vtkActor()\n    src_actor.SetMapper(src_mapper)\n\n    # Create contour edges\n    edge_mapper = vtkPolyDataMapper()\n    edge_mapper.SetInputData(bcf.GetContourEdgesOutput())\n    edge_mapper.SetResolveCoincidentTopologyToPolygonOffset()\n\n    edge_actor = vtkActor()\n    edge_actor.SetMapper(edge_mapper)\n    edge_actor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    glyph_mapper = vtkPolyDataMapper()\n    glyph_mapper.SetInputConnection(glyph.GetOutputPort())\n    glyph_mapper.SetScalarModeToUsePointFieldData()\n    glyph_mapper.SetColorModeToMapScalars()\n    glyph_mapper.ScalarVisibilityOn()\n    glyph_mapper.SelectColorArray('Elevation')\n    # Colour by scalars.\n    glyph_mapper.SetLookupTable(lut1)\n    glyph_mapper.SetScalarRange(scalar_range)\n\n    glyph_actor = vtkActor()\n    glyph_actor.SetMapper(glyph_mapper)\n\n    window_width = 800\n    window_height = 800\n\n    # Add a scalar bar.\n    scalar_bar = vtkScalarBarActor()\n    # This LUT puts the lowest value at the top of the scalar bar.\n    # scalar_bar->SetLookupTable(lut);\n    # Use this LUT if you want the highest value at the top.\n    scalar_bar.SetLookupTable(lutr)\n    scalar_bar.SetTitle('Elevation')\n    scalar_bar.GetTitleTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.GetLabelTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.GetAnnotationTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.UnconstrainedFontSizeOn()\n    scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar.SetMaximumHeightInPixels(window_height // 3)\n    scalar_bar.SetPosition(0.85, 0.05)\n\n    # ------------------------------------------------------------\n    # Create the RenderWindow, Renderer and Interactor\n    # ------------------------------------------------------------\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    ren_win.AddRenderer(ren)\n    # Important: The interactor must be set prior to enabling the widget.\n    iren.SetRenderWindow(ren_win)\n    if vtk_version_ok(9, 0, 20210718):\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        cam_orient_manipulator.SetParentRenderer(ren)\n        # Enable the widget.\n        cam_orient_manipulator.On()\n\n    # add actors\n    ren.AddViewProp(src_actor)\n    ren.AddViewProp(edge_actor)\n    ren.AddViewProp(glyph_actor)\n    ren.AddActor2D(scalar_bar)\n\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n    ren_win.SetSize(window_width, window_height)\n    ren_win.SetWindowName('ElevationBandsWithGlyphs')\n\n    if desired_surface == \"RandomHills\":\n        camera = ren.GetActiveCamera()\n        camera.SetPosition(10.9299, 59.1505, 24.9823)\n        camera.SetFocalPoint(2.21692, 7.97545, 7.75135)\n        camera.SetViewUp(-0.230136, 0.345504, -0.909761)\n        camera.SetDistance(54.6966)\n        camera.SetClippingRange(36.3006, 77.9852)\n        ren_win.Render()\n\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\ndef get_elevations(src):\n    \"\"\"\n    Generate elevations over the surface.\n    :param: src - the vtkPolyData source.\n    :return: - vtkPolyData source with elevations.\n    \"\"\"\n    bounds = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]\n    src.GetBounds(bounds)\n    if abs(bounds[2]) < 1.0e-8 and abs(bounds[3]) < 1.0e-8:\n        bounds[3] = bounds[2] + 1\n    elev_filter = vtkElevationFilter()\n    elev_filter.SetInputData(src)\n    elev_filter.SetLowPoint(0, bounds[2], 0)\n    elev_filter.SetHighPoint(0, bounds[3], 0)\n    elev_filter.SetScalarRange(bounds[2], bounds[3])\n    elev_filter.Update()\n    return elev_filter.GetPolyDataOutput()\n\n\ndef get_hills():\n    # Create four hills on a plane.\n    # This will have regions of negative, zero and positive Gsaussian curvatures.\n\n    x_res = 50\n    y_res = 50\n    x_min = -5.0\n    x_max = 5.0\n    dx = (x_max - x_min) / (x_res - 1)\n    y_min = -5.0\n    y_max = 5.0\n    dy = (y_max - y_min) / (x_res - 1)\n\n    # Make a grid.\n    points = vtkPoints()\n    for i in range(0, x_res):\n        x = x_min + i * dx\n        for j in range(0, y_res):\n            y = y_min + j * dy\n            points.InsertNextPoint(x, y, 0)\n\n    # Add the grid points to a polydata object.\n    plane = vtkPolyData()\n    plane.SetPoints(points)\n\n    # Triangulate the grid.\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(plane)\n    delaunay.Update()\n\n    polydata = delaunay.GetOutput()\n\n    elevation = vtkDoubleArray()\n    elevation.SetNumberOfTuples(points.GetNumberOfPoints())\n\n    #  We define the parameters for the hills here.\n    # [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n    hd = [[-2.5, -2.5, 2.5, 6.5, 3.5], [2.5, 2.5, 2.5, 2.5, 2],\n          [5.0, -2.5, 1.5, 1.5, 2.5], [-5.0, 5, 2.5, 3.0, 3]]\n    xx = [0.0] * 2\n    for i in range(0, points.GetNumberOfPoints()):\n        x = list(polydata.GetPoint(i))\n        for j in range(0, len(hd)):\n            xx[0] = (x[0] - hd[j][0] / hd[j][2]) ** 2.0\n            xx[1] = (x[1] - hd[j][1] / hd[j][3]) ** 2.0\n            x[2] += hd[j][4] * math.exp(-(xx[0] + xx[1]) / 2.0)\n            polydata.GetPoints().SetPoint(i, x)\n            elevation.SetValue(i, x[2])\n\n    textures = vtkFloatArray()\n    textures.SetNumberOfComponents(2)\n    textures.SetNumberOfTuples(2 * polydata.GetNumberOfPoints())\n    textures.SetName(\"Textures\")\n\n    for i in range(0, x_res):\n        tc = [i / (x_res - 1.0), 0.0]\n        for j in range(0, y_res):\n            # tc[1] = 1.0 - j / (y_res - 1.0)\n            tc[1] = j / (y_res - 1.0)\n            textures.SetTuple(i * y_res + j, tc)\n\n    polydata.GetPointData().SetScalars(elevation)\n    polydata.GetPointData().GetScalars().SetName(\"Elevation\")\n    polydata.GetPointData().SetTCoords(textures)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputData(polydata)\n    normals.SetInputData(polydata)\n    normals.SetFeatureAngle(30)\n    normals.SplittingOff()\n\n    tr1 = vtkTransform()\n    tr1.RotateX(-90)\n\n    tf1 = vtkTransformPolyDataFilter()\n    tf1.SetInputConnection(normals.GetOutputPort())\n    tf1.SetTransform(tr1)\n    tf1.Update()\n\n    return tf1.GetOutput()\n\n\ndef get_parametric_hills():\n    \"\"\"\n    Make a parametric hills surface as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n    fn = vtkParametricRandomHills()\n    fn.AllowRandomGenerationOn()\n    fn.SetRandomSeed(1)\n    fn.SetNumberOfHills(30)\n    # Make the normals face out of the surface.\n    # Not needed with VTK 8.0 or later.\n    # if fn.GetClassName() == 'vtkParametricRandomHills':\n    #    fn.ClockwiseOrderingOff()\n\n    source = vtkParametricFunctionSource()\n    source.SetParametricFunction(fn)\n    source.SetUResolution(50)\n    source.SetVResolution(50)\n    source.SetScalarModeToZ()\n    source.Update()\n    # Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n    # source.GetOutput().GetPointData().GetNormals().SetName('Normals')\n    # source.GetOutput().GetPointData().GetScalars().SetName('Scalars')\n    # Rename the scalars to 'Elevation' since we are using the Z-scalars as elevations.\n    source.GetOutput().GetPointData().GetScalars().SetName('Elevation')\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_parametric_torus():\n    \"\"\"\n    Make a parametric torus as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n\n    fn = vtkParametricTorus()\n    fn.SetRingRadius(5)\n    fn.SetCrossSectionRadius(2)\n\n    source = vtkParametricFunctionSource()\n    source.SetParametricFunction(fn)\n    source.SetUResolution(50)\n    source.SetVResolution(50)\n    source.SetScalarModeToZ()\n    source.Update()\n\n    # Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n    # source.GetOutput().GetPointData().GetNormals().SetName('Normals')\n    # source.GetOutput().GetPointData().GetScalars().SetName('Scalars')\n    # Rename the scalars to 'Elevation' since we are using the Z-scalars as elevations.\n    source.GetOutput().GetPointData().GetScalars().SetName('Elevation')\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_plane():\n    \"\"\"\n    Make a plane as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n\n    source = vtkPlaneSource()\n    source.SetOrigin(-10.0, -10.0, 0.0)\n    source.SetPoint2(-10.0, 10.0, 0.0)\n    source.SetPoint1(10.0, -10.0, 0.0)\n    source.SetXResolution(20)\n    source.SetYResolution(20)\n    source.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 0.0, 0.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    # We have a m x n array of quadrilaterals arranged as a regular tiling in a\n    # plane. So pass it through a triangle filter since the curvature filter only\n    # operates on polys.\n    tri = vtkTriangleFilter()\n    tri.SetInputConnection(transform_filter.GetOutputPort())\n\n    # Pass it though a CleanPolyDataFilter and merge any points which\n    # are coincident, or very close\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(tri.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    return cleaner.GetOutput()\n\n\ndef get_sphere():\n    source = vtkSphereSource()\n    source.SetCenter(0.0, 0.0, 0.0)\n    source.SetRadius(10.0)\n    source.SetThetaResolution(32)\n    source.SetPhiResolution(32)\n    source.Update()\n\n    return source.GetOutput()\n\n\ndef get_torus():\n    \"\"\"\n    Make a torus as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n    source = vtkSuperquadricSource()\n    source.SetCenter(0.0, 0.0, 0.0)\n    source.SetScale(1.0, 1.0, 1.0)\n    source.SetPhiResolution(64)\n    source.SetThetaResolution(64)\n    source.SetThetaRoundness(1)\n    source.SetThickness(0.5)\n    source.SetSize(10)\n    source.SetToroidal(1)\n\n    # The quadric is made of strips, so pass it through a triangle filter as\n    # the curvature filter only operates on polys\n    tri = vtkTriangleFilter()\n    tri.SetInputConnection(source.GetOutputPort())\n\n    # The quadric has nasty discontinuities from the way the edges are generated\n    # so let's pass it though a CleanPolyDataFilter and merge any points which\n    # are coincident, or very close\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(tri.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    return cleaner.GetOutput()\n\n\ndef get_source(source):\n    surface = source.lower()\n    available_surfaces = ['hills', 'parametrictorus', 'plane', 'randomhills', 'sphere', 'torus']\n    if surface not in available_surfaces:\n        return None\n    elif surface == 'hills':\n        return get_hills()\n    elif surface == 'parametrictorus':\n        return get_parametric_torus()\n    elif surface == 'plane':\n        return get_elevations(get_plane())\n    elif surface == 'randomhills':\n        return get_parametric_hills()\n    elif surface == 'sphere':\n        return get_elevations(get_sphere())\n    elif surface == 'torus':\n        return get_elevations(get_torus())\n    return None\n\n\ndef get_color_series():\n    color_series = vtkColorSeries()\n    # Select a color scheme.\n    # color_series_enum = color_series.BREWER_DIVERGING_BROWN_BLUE_GREEN_9\n    # color_series_enum = color_series.BREWER_DIVERGING_SPECTRAL_10\n    # color_series_enum = color_series.BREWER_DIVERGING_SPECTRAL_3\n    # color_series_enum = color_series.BREWER_DIVERGING_PURPLE_ORANGE_9\n    # color_series_enum = color_series.BREWER_SEQUENTIAL_BLUE_PURPLE_9\n    # color_series_enum = color_series.BREWER_SEQUENTIAL_BLUE_GREEN_9\n    color_series_enum = color_series.BREWER_QUALITATIVE_SET3\n    # color_series_enum = color_series.CITRUS\n    color_series.SetColorScheme(color_series_enum)\n    return color_series\n\n\ndef get_categorical_lut():\n    \"\"\"\n    Make a lookup table using vtkColorSeries.\n    :return: An indexed (categorical) lookup table.\n    \"\"\"\n    color_series = get_color_series()\n    # Make the lookup table.\n    lut = vtkLookupTable()\n    color_series.BuildLookupTable(lut, color_series.CATEGORICAL)\n    lut.SetNanColor(0, 0, 0, 1)\n    return lut\n\n\ndef get_ordinal_lut():\n    \"\"\"\n    Make a lookup table using vtkColorSeries.\n    :return: An ordinal (not indexed) lookup table.\n    \"\"\"\n    color_series = get_color_series()\n    # Make the lookup table.\n    lut = vtkLookupTable()\n    color_series.BuildLookupTable(lut, color_series.ORDINAL)\n    lut.SetNanColor(0, 0, 0, 1)\n    return lut\n\n\ndef get_diverging_lut():\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start point         midPoint            end point\n     cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n     purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n     green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n     blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n     green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n\n    :return:\n    \"\"\"\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    # Cool to warm.\n    ctf.AddRGBPoint(0.0, 0.085, 0.532, 0.201)\n    ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n    ctf.AddRGBPoint(1.0, 0.758, 0.214, 0.233)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef reverse_lut(lut):\n    \"\"\"\n    Create a lookup table with the colors reversed.\n    :param: lut - An indexed lookup table.\n    :return: The reversed indexed lookup table.\n    \"\"\"\n    lutr = vtkLookupTable()\n    lutr.DeepCopy(lut)\n    t = lut.GetNumberOfTableValues() - 1\n    rev_range = reversed(list(range(t + 1)))\n    for i in rev_range:\n        rgba = [0.0] * 3\n        v = float(i)\n        lut.GetColor(v, rgba)\n        rgba.append(lut.GetOpacity(v))\n        lutr.SetTableValue(t - i, rgba)\n    t = lut.GetNumberOfAnnotatedValues() - 1\n    rev_range = reversed(list(range(t + 1)))\n    for i in rev_range:\n        lutr.SetAnnotation(t - i, lut.GetAnnotation(i))\n    return lutr\n\n\ndef get_glyphs(src, scale_factor=1.0, reverse_normals=False):\n    \"\"\"\n    Glyph the normals on the surface.\n\n    You may need to adjust the parameters for mask_pts, arrow and glyph for a\n    nice appearance.\n\n    :param: src - the surface to glyph.\n    :param: reverse_normals - if True the normals on the surface are reversed.\n    :return: The glyph object.\n\n    \"\"\"\n    # Sometimes the contouring algorithm can create a volume whose gradient\n    # vector and ordering of polygon (using the right hand rule) are\n    # inconsistent. vtkReverseSense cures this problem.\n    reverse = vtkReverseSense()\n\n    # Choose a random subset of points.\n    mask_pts = vtkMaskPoints()\n    mask_pts.SetOnRatio(5)\n    mask_pts.RandomModeOn()\n    if reverse_normals:\n        reverse.SetInputData(src)\n        reverse.ReverseCellsOn()\n        reverse.ReverseNormalsOn()\n        mask_pts.SetInputConnection(reverse.GetOutputPort())\n    else:\n        mask_pts.SetInputData(src)\n\n    # Source for the glyph filter\n    arrow = vtkArrowSource()\n    arrow.SetTipResolution(16)\n    arrow.SetTipLength(0.3)\n    arrow.SetTipRadius(0.1)\n\n    glyph = vtkGlyph3D()\n    glyph.SetSourceConnection(arrow.GetOutputPort())\n    glyph.SetInputConnection(mask_pts.GetOutputPort())\n    glyph.SetVectorModeToUseNormal()\n    glyph.SetScaleFactor(scale_factor)\n    glyph.SetColorModeToColorByVector()\n    glyph.SetScaleModeToScaleByVector()\n    glyph.OrientOn()\n    glyph.Update()\n    return glyph\n\n\ndef get_bands(d_r, number_of_bands, precision=2, nearest_integer=False):\n    \"\"\"\n    Divide a range into bands\n    :param: d_r - [min, max] the range that is to be covered by the bands.\n    :param: number_of_bands - The number of bands, a positive integer.\n    :param: precision - The decimal precision of the bounds.\n    :param: nearest_integer - If True then [floor(min), ceil(max)] is used.\n    :return: A dictionary consisting of the band number and [min, midpoint, max] for each band.\n    \"\"\"\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    bands = dict()\n    if (d_r[1] < d_r[0]) or (number_of_bands <= 0):\n        return bands\n    x = list(d_r)\n    if nearest_integer:\n        x[0] = math.floor(x[0])\n        x[1] = math.ceil(x[1])\n    dx = (x[1] - x[0]) / float(number_of_bands)\n    b = [x[0], x[0] + dx / 2.0, x[0] + dx]\n    i = 0\n    while i < number_of_bands:\n        b = list(map(lambda ele_b: round(ele_b, prec), b))\n        if i == 0:\n            b[0] = x[0]\n        bands[i] = b\n        b = [b[0] + dx, b[1] + dx, b[2] + dx]\n        i += 1\n    return bands\n\n\ndef get_custom_bands(d_r, number_of_bands, my_bands):\n    \"\"\"\n    Divide a range into custom bands.\n\n    You need to specify each band as an list [r1, r2] where r1 < r2 and\n    append these to a list.\n    The list should ultimately look\n    like this: [[r1, r2], [r2, r3], [r3, r4]...]\n\n    :param: d_r - [min, max] the range that is to be covered by the bands.\n    :param: number_of_bands - the number of bands, a positive integer.\n    :return: A dictionary consisting of band number and [min, midpoint, max] for each band.\n    \"\"\"\n    bands = dict()\n    if (d_r[1] < d_r[0]) or (number_of_bands <= 0):\n        return bands\n    x = my_bands\n    # Determine the index of the range minimum and range maximum.\n    idx_min = 0\n    for idx in range(0, len(my_bands)):\n        if my_bands[idx][1] > d_r[0] >= my_bands[idx][0]:\n            idx_min = idx\n            break\n\n    idx_max = len(my_bands) - 1\n    for idx in range(len(my_bands) - 1, -1, -1):\n        if my_bands[idx][1] > d_r[1] >= my_bands[idx][0]:\n            idx_max = idx\n            break\n\n    # Set the minimum to match the range minimum.\n    x[idx_min][0] = d_r[0]\n    x[idx_max][1] = d_r[1]\n    x = x[idx_min: idx_max + 1]\n    for idx, e in enumerate(x):\n        bands[idx] = [e[0], e[0] + (e[1] - e[0]) / 2, e[1]]\n    return bands\n\n\ndef get_frequencies(bands, src):\n    \"\"\"\n    Count the number of scalars in each band.\n    The scalars used are the active scalars in the polydata.\n\n    :param: bands - The bands.\n    :param: src - The vtkPolyData source.\n    :return: The frequencies of the scalars in each band.\n    \"\"\"\n    freq = dict()\n    for i in range(len(bands)):\n        freq[i] = 0\n    tuples = src.GetPointData().GetScalars().GetNumberOfTuples()\n    for i in range(tuples):\n        x = src.GetPointData().GetScalars().GetTuple1(i)\n        for j in range(len(bands)):\n            if x <= bands[j][2]:\n                freq[j] += 1\n                break\n    return freq\n\n\ndef adjust_ranges(bands, freq):\n    \"\"\"\n    The bands and frequencies are adjusted so that the first and last\n     frequencies in the range are non-zero.\n    :param bands: The bands dictionary.\n    :param freq: The frequency dictionary.\n    :return: Adjusted bands and frequencies.\n    \"\"\"\n    # Get the indices of the first and last non-zero elements.\n    first = 0\n    for k, v in freq.items():\n        if v != 0:\n            first = k\n            break\n    rev_keys = list(freq.keys())[::-1]\n    last = rev_keys[0]\n    for idx in list(freq.keys())[::-1]:\n        if freq[idx] != 0:\n            last = idx\n            break\n    # Now adjust the ranges.\n    min_key = min(freq.keys())\n    max_key = max(freq.keys())\n    for idx in range(min_key, first):\n        freq.pop(idx)\n        bands.pop(idx)\n    for idx in range(last + 1, max_key + 1):\n        freq.popitem()\n        bands.popitem()\n    old_keys = freq.keys()\n    adj_freq = dict()\n    adj_bands = dict()\n\n    for idx, k in enumerate(old_keys):\n        adj_freq[idx] = freq[k]\n        adj_bands[idx] = bands[k]\n\n    return adj_bands, adj_freq\n\n\ndef print_bands_frequencies(bands, freq, precision=2):\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    if len(bands) != len(freq):\n        print('Bands and Frequencies must be the same size.')\n        return\n    s = f'Bands & Frequencies:\\n'\n    total = 0\n    width = prec + 6\n    for k, v in bands.items():\n        total += freq[k]\n        for j, q in enumerate(v):\n            if j == 0:\n                s += f'{k:4d} ['\n            if j == len(v) - 1:\n                s += f'{q:{width}.{prec}f}]: {freq[k]:8d}\\n'\n            else:\n                s += f'{q:{width}.{prec}f}, '\n    width = 3 * width + 13\n    s += f'{\"Total\":{width}s}{total:8d}\\n'\n    print(s)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Visualization/FrogBrain/","title":"FrogBrain","text":"

vtk-examples/Python/Visualization/FrogBrain

"},{"location":"Python/Visualization/FrogBrain/#description","title":"Description","text":"

The frog's brain. Model extracted without smoothing (left) and with smoothing (right).

Info

See Figure 12-7 in Chapter 12 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/FrogBrain/#code","title":"Code","text":"

FrogBrain.py

#!/usr/bin/env python\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkLookupTable,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkPolyDataNormals,\n    vtkStripper,\n    vtkWindowedSincPolyDataFilter\n)\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkImageThreshold\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'The frog\\'s brain.'\n    epilogue = '''\n    Model extracted without smoothing (left) and with smoothing (right).\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('data_folder', help='The path to the file: frogtissue.mhd.')\n    parser.add_argument('tissue', default='brain', nargs='?', help='The tissue to use.')\n    args = parser.parse_args()\n    return args.data_folder, args.tissue\n\n\ndef main(data_folder, tissue):\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    path = Path(data_folder)\n    if path.is_dir():\n        s = ''\n        file_name = path.joinpath('frogtissue').with_suffix('.mhd')\n        if not file_name.is_file():\n            s += 'The file: {:s} does not exist.'.format(str(file_name))\n        if s:\n            print(s)\n            return\n    else:\n        print('Expected a path to frogtissue.mhd')\n        return\n\n    tissue_map = create_tissue_map()\n    lut = create_frog_lut(colors)\n\n    # Setup render window, renderer, and interactor.\n    renderer_left = vtkRenderer()\n    renderer_left.SetViewport(0, 0, 0.5, 1)\n    renderer_right = vtkRenderer()\n    renderer_right.SetViewport(0.5, 0, 1, 1)\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer_left)\n    render_window.AddRenderer(renderer_right)\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    actor = create_frog_actor(file_name, tissue_map[tissue], use_flying_edges)\n    actor.GetProperty().SetDiffuseColor(lut.GetTableValue(tissue_map[tissue])[:3])\n    renderer_left.AddActor(actor)\n\n    actor_smooth = create_smooth_frog_actor(file_name, tissue_map[tissue], use_flying_edges)\n    actor_smooth.GetProperty().SetDiffuseColor(lut.GetTableValue(tissue_map[tissue])[:3])\n    actor_smooth.GetProperty().SetDiffuse(1.0)\n    actor_smooth.GetProperty().SetSpecular(.5)\n    actor_smooth.GetProperty().SetSpecularPower(100)\n\n    renderer_right.AddActor(actor_smooth)\n\n    renderer_left.ResetCamera()\n    renderer_left.GetActiveCamera().SetViewUp(-1, 0, 0)\n    renderer_left.GetActiveCamera().Azimuth(180)\n    renderer_left.ResetCameraClippingRange()\n\n    renderer_left.SetBackground(colors.GetColor3d('LightSteelBlue'))\n    renderer_right.SetBackground(colors.GetColor3d('LightSteelBlue'))\n    renderer_right.SetActiveCamera(renderer_left.GetActiveCamera())\n\n    render_window.SetSize(640, 480)\n    render_window.SetWindowName('FrogBrain')\n    render_window.Render()\n\n    render_window_interactor.Start()\n\n\ndef create_smooth_frog_actor(file_name, tissue, use_flying_edges):\n    reader = vtkMetaImageReader()\n    reader.SetFileName(str(file_name))\n    reader.Update()\n\n    select_tissue = vtkImageThreshold()\n    select_tissue.ThresholdBetween(tissue, tissue)\n    select_tissue.SetInValue(255)\n    select_tissue.SetOutValue(0)\n    select_tissue.SetInputConnection(reader.GetOutputPort())\n\n    gaussian_radius = 1\n    gaussian_standard_deviation = 2.0\n    gaussian = vtkImageGaussianSmooth()\n    gaussian.SetStandardDeviations(gaussian_standard_deviation, gaussian_standard_deviation,\n                                   gaussian_standard_deviation)\n    gaussian.SetRadiusFactors(gaussian_radius, gaussian_radius, gaussian_radius)\n    gaussian.SetInputConnection(select_tissue.GetOutputPort())\n\n    # iso_value = 63.5\n    iso_value = 127.5\n    if use_flying_edges:\n        try:\n            iso_surface = vtkFlyingEdges3D()\n        except AttributeError:\n            iso_surface = vtkMarchingCubes()\n    else:\n        iso_surface = vtkMarchingCubes()\n    iso_surface.SetInputConnection(gaussian.GetOutputPort())\n    iso_surface.ComputeScalarsOff()\n    iso_surface.ComputeGradientsOff()\n    iso_surface.ComputeNormalsOff()\n    iso_surface.SetValue(0, iso_value)\n\n    smoothing_iterations = 20\n    pass_band = 0.001\n    feature_angle = 60.0\n    smoother = vtkWindowedSincPolyDataFilter()\n    smoother.SetInputConnection(iso_surface.GetOutputPort())\n    smoother.SetNumberOfIterations(smoothing_iterations)\n    smoother.BoundarySmoothingOff()\n    smoother.FeatureEdgeSmoothingOff()\n    smoother.SetFeatureAngle(feature_angle)\n    smoother.SetPassBand(pass_band)\n    smoother.NonManifoldSmoothingOn()\n    smoother.NormalizeCoordinatesOff()\n    smoother.Update()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(smoother.GetOutputPort())\n    normals.SetFeatureAngle(feature_angle)\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(normals.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(stripper.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    return actor\n\n\ndef create_frog_actor(file_name, tissue, use_flying_edges):\n    reader = vtkMetaImageReader()\n    reader.SetFileName(str(file_name))\n    reader.Update()\n\n    select_tissue = vtkImageThreshold()\n    select_tissue.ThresholdBetween(tissue, tissue)\n    select_tissue.SetInValue(255)\n    select_tissue.SetOutValue(0)\n    select_tissue.SetInputConnection(reader.GetOutputPort())\n\n    iso_value = 63.5\n    if use_flying_edges:\n        try:\n            iso_surface = vtkFlyingEdges3D()\n        except AttributeError:\n            iso_surface = vtkMarchingCubes()\n    else:\n        iso_surface = vtkMarchingCubes()\n    iso_surface.SetInputConnection(select_tissue.GetOutputPort())\n    iso_surface.ComputeScalarsOff()\n    iso_surface.ComputeGradientsOff()\n    iso_surface.ComputeNormalsOn()\n    iso_surface.SetValue(0, iso_value)\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(iso_surface.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(stripper.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    return actor\n\n\ndef create_frog_lut(colors):\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(16)\n    lut.SetTableRange(0, 15)\n    lut.Build()\n\n    lut.SetTableValue(0, colors.GetColor4d('Black'))\n    lut.SetTableValue(1, colors.GetColor4d('salmon'))  # blood\n    lut.SetTableValue(2, colors.GetColor4d('beige'))  # brain\n    lut.SetTableValue(3, colors.GetColor4d('orange'))  # duodenum\n    lut.SetTableValue(4, colors.GetColor4d('misty_rose'))  # eye_retina\n    lut.SetTableValue(5, colors.GetColor4d('white'))  # eye_white\n    lut.SetTableValue(6, colors.GetColor4d('tomato'))  # heart\n    lut.SetTableValue(7, colors.GetColor4d('raspberry'))  # ileum\n    lut.SetTableValue(8, colors.GetColor4d('banana'))  # kidney\n    lut.SetTableValue(9, colors.GetColor4d('peru'))  # l_intestine\n    lut.SetTableValue(10, colors.GetColor4d('pink'))  # liver\n    lut.SetTableValue(11, colors.GetColor4d('powder_blue'))  # lung\n    lut.SetTableValue(12, colors.GetColor4d('carrot'))  # nerve\n    lut.SetTableValue(13, colors.GetColor4d('wheat'))  # skeleton\n    lut.SetTableValue(14, colors.GetColor4d('violet'))  # spleen\n    lut.SetTableValue(15, colors.GetColor4d('plum'))  # stomach\n\n    return lut\n\n\ndef create_tissue_map():\n    tissue_map = dict()\n    tissue_map['blood'] = 1\n    tissue_map['brain'] = 2\n    tissue_map['duodenum'] = 3\n    tissue_map['eyeRetina'] = 4\n    tissue_map['eyeWhite'] = 5\n    tissue_map['heart'] = 6\n    tissue_map['ileum'] = 7\n    tissue_map['kidney'] = 8\n    tissue_map['intestine'] = 9\n    tissue_map['liver'] = 10\n    tissue_map['lung'] = 11\n    tissue_map['nerve'] = 12\n    tissue_map['skeleton'] = 13\n    tissue_map['spleen'] = 14\n    tissue_map['stomach'] = 15\n\n    return tissue_map\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    import sys\n\n    data_folder, tissue = get_program_parameters(sys.argv)\n\n    main(data_folder, tissue)\n
"},{"location":"Python/Visualization/FrogSlice/","title":"FrogSlice","text":"

vtk-examples/Python/Visualization/FrogSlice

"},{"location":"Python/Visualization/FrogSlice/#description","title":"Description","text":"

This example uses a dataset derived from a frog. This data was prepared at Lawrence Berkeley National Laboratories and is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels.

To accommodate the volume readers we have in VTK, we processed the mask files and combined them all into one vtkMetaImageReader .mhd file. Integer numbers 1\u201315 to represent the 15 tissues. A similar process was done for the frog skin.

This example shows a photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/FrogSlice/#code","title":"Code","text":"

FrogSlice.py

#!/usr/bin/env python\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkImageConstantPad\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture,\n    vtkWindowLevelLookupTable\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Visualization of a frog.'\n    epilogue = '''\nPhotographic slice of frog (upper left), segmented frog (upper right) and\n composite of photo and segmentation (bottom).\nThe purple color represents the stomach and the kidneys are yellow.\nIf slice = 39 it matches Figure 12-6 in the VTK Book.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('data_folder', help='The path to the files: frog.mhd and frogtissue.mhd.')\n    parser.add_argument('slice_number', default=39, type=int, nargs='?', help='Slice number.')\n    args = parser.parse_args()\n    return args.data_folder, args.slice_number\n\n\ndef main(data_folder, slice_number):\n    colors = vtkNamedColors()\n\n    path = Path(data_folder)\n    if path.is_dir():\n        s = ''\n        fn_1 = path.joinpath('frog').with_suffix('.mhd')\n        if not fn_1.is_file():\n            s += 'The file: {:s} does not exist.\\n'.format(str(fn_1))\n            print(s)\n        fn_2 = path.joinpath('frogtissue').with_suffix('.mhd')\n        if not fn_2.is_file():\n            s += 'The file: {:s} does not exist.'.format(str(fn_2))\n        if s:\n            print(s)\n            return\n    else:\n        print('Expected a path to frog.mhs and frogtissue.mhd')\n        return\n\n    so = SliceOrder()\n\n    # Now create the RenderWindow, Renderer and Interactor\n    #\n    ren1 = vtkRenderer()\n    ren2 = vtkRenderer()\n    ren3 = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren1)\n    ren_win.AddRenderer(ren2)\n    ren_win.AddRenderer(ren3)\n    ren_win.SetWindowName('FrogSlice')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    grey_reader = vtkMetaImageReader()\n    grey_reader.SetFileName(str(fn_1))\n    grey_reader.Update()\n\n    grey_padder = vtkImageConstantPad()\n    grey_padder.SetInputConnection(grey_reader.GetOutputPort())\n    grey_padder.SetOutputWholeExtent(0, 511, 0, 511, slice_number, slice_number)\n    grey_padder.SetConstant(0)\n\n    grey_plane = vtkPlaneSource()\n\n    grey_transform = vtkTransformPolyDataFilter()\n    grey_transform.SetTransform(so.get('hfsi'))\n    grey_transform.SetInputConnection(grey_plane.GetOutputPort())\n\n    grey_normals = vtkPolyDataNormals()\n    grey_normals.SetInputConnection(grey_transform.GetOutputPort())\n    grey_normals.FlipNormalsOff()\n\n    wllut = vtkWindowLevelLookupTable()\n    wllut.SetWindow(255)\n    wllut.SetLevel(128)\n    wllut.SetTableRange(0, 255)\n    wllut.Build()\n\n    grey_mapper = vtkPolyDataMapper()\n    grey_mapper.SetInputConnection(grey_plane.GetOutputPort())\n\n    grey_texture = vtkTexture()\n    grey_texture.SetInputConnection(grey_padder.GetOutputPort())\n    grey_texture.SetLookupTable(wllut)\n    grey_texture.SetColorModeToMapScalars()\n    grey_texture.InterpolateOn()\n\n    grey_actor = vtkActor()\n    grey_actor.SetMapper(grey_mapper)\n    grey_actor.SetTexture(grey_texture)\n\n    segment_reader = vtkMetaImageReader()\n    segment_reader.SetFileName(str(fn_2))\n    segment_reader.Update()\n\n    segment_padder = vtkImageConstantPad()\n    segment_padder.SetInputConnection(segment_reader.GetOutputPort())\n    segment_padder.SetOutputWholeExtent(0, 511, 0, 511, slice_number, slice_number)\n    segment_padder.SetConstant(0)\n\n    segment_plane = vtkPlaneSource()\n\n    segment_transform = vtkTransformPolyDataFilter()\n    segment_transform.SetTransform(so.get('hfsi'))\n    segment_transform.SetInputConnection(segment_plane.GetOutputPort())\n\n    segment_normals = vtkPolyDataNormals()\n    segment_normals.SetInputConnection(segment_transform.GetOutputPort())\n    segment_normals.FlipNormalsOn()\n\n    lut = create_frog_lut(colors)\n\n    segment_mapper = vtkPolyDataMapper()\n    segment_mapper.SetInputConnection(segment_plane.GetOutputPort())\n\n    segment_texture = vtkTexture()\n    segment_texture.SetInputConnection(segment_padder.GetOutputPort())\n    segment_texture.SetLookupTable(lut)\n    segment_texture.SetColorModeToMapScalars()\n    segment_texture.InterpolateOff()\n\n    segment_actor = vtkActor()\n    segment_actor.SetMapper(segment_mapper)\n    segment_actor.SetTexture(segment_texture)\n\n    segment_overlay_actor = vtkActor()\n    segment_overlay_actor.SetMapper(segment_mapper)\n    segment_overlay_actor.SetTexture(segment_texture)\n\n    segment_overlay_actor.GetProperty().SetOpacity(.5)\n    ren1.SetBackground(0, 0, 0)\n    ren1.SetViewport(0, 0.5, 0.5, 1)\n    ren_win.SetSize(640, 480)\n    ren1.AddActor(grey_actor)\n\n    ren2.SetBackground(0, 0, 0)\n    ren2.SetViewport(0.5, 0.5, 1, 1)\n    ren2.AddActor(segment_actor)\n\n    cam1 = vtkCamera()\n    cam1.SetViewUp(0, -1, 0)\n    cam1.SetPosition(0, 0, -1)\n    ren1.SetActiveCamera(cam1)\n    ren1.ResetCamera()\n    cam1.SetViewUp(0, -1, 0)\n    cam1.SetPosition(0.0554068, -0.0596001, -0.491383)\n    cam1.SetFocalPoint(0.0554068, -0.0596001, 0)\n    ren1.ResetCameraClippingRange()\n\n    ren3.AddActor(grey_actor)\n    ren3.AddActor(segment_overlay_actor)\n    segment_overlay_actor.SetPosition(0, 0, -0.01)\n\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren2.SetBackground(colors.GetColor3d('SlateGray'))\n    ren3.SetBackground(colors.GetColor3d('SlateGray'))\n\n    ren3.SetViewport(0, 0, 1, 0.5)\n\n    ren2.SetActiveCamera(ren1.GetActiveCamera())\n    ren3.SetActiveCamera(ren1.GetActiveCamera())\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef create_frog_lut(colors):\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(16)\n    lut.SetTableRange(0, 15)\n    lut.Build()\n\n    lut.SetTableValue(0, colors.GetColor4d('Black'))\n    lut.SetTableValue(1, colors.GetColor4d('salmon'))  # blood\n    lut.SetTableValue(2, colors.GetColor4d('beige'))  # brain\n    lut.SetTableValue(3, colors.GetColor4d('orange'))  # duodenum\n    lut.SetTableValue(4, colors.GetColor4d('misty_rose'))  # eye_retina\n    lut.SetTableValue(5, colors.GetColor4d('white'))  # eye_white\n    lut.SetTableValue(6, colors.GetColor4d('tomato'))  # heart\n    lut.SetTableValue(7, colors.GetColor4d('raspberry'))  # ileum\n    lut.SetTableValue(8, colors.GetColor4d('banana'))  # kidney\n    lut.SetTableValue(9, colors.GetColor4d('peru'))  # l_intestine\n    lut.SetTableValue(10, colors.GetColor4d('pink'))  # liver\n    lut.SetTableValue(11, colors.GetColor4d('powder_blue'))  # lung\n    lut.SetTableValue(12, colors.GetColor4d('carrot'))  # nerve\n    lut.SetTableValue(13, colors.GetColor4d('wheat'))  # skeleton\n    lut.SetTableValue(14, colors.GetColor4d('violet'))  # spleen\n    lut.SetTableValue(15, colors.GetColor4d('plum'))  # stomach\n\n    return lut\n\n\nclass SliceOrder:\n    \"\"\"\n    These transformations permute image and other geometric data to maintain proper\n     orientation regardless of the acquisition order. After applying these transforms with\n    vtkTransformFilter, a view up of 0,-1,0 will result in the body part\n    facing the viewer.\n    NOTE: some transformations have a -1 scale factor for one of the components.\n          To ensure proper polygon orientation and normal direction, you must\n          apply the vtkPolyDataNormals filter.\n\n    Naming (the nomenclature is medical):\n    si - superior to inferior (top to bottom)\n    is - inferior to superior (bottom to top)\n    ap - anterior to posterior (front to back)\n    pa - posterior to anterior (back to front)\n    lr - left to right\n    rl - right to left\n    \"\"\"\n\n    def __init__(self):\n        self.si_mat = vtkMatrix4x4()\n        self.si_mat.Zero()\n        self.si_mat.SetElement(0, 0, 1)\n        self.si_mat.SetElement(1, 2, 1)\n        self.si_mat.SetElement(2, 1, -1)\n        self.si_mat.SetElement(3, 3, 1)\n\n        self.is_mat = vtkMatrix4x4()\n        self.is_mat.Zero()\n        self.is_mat.SetElement(0, 0, 1)\n        self.is_mat.SetElement(1, 2, -1)\n        self.is_mat.SetElement(2, 1, -1)\n        self.is_mat.SetElement(3, 3, 1)\n\n        self.lr_mat = vtkMatrix4x4()\n        self.lr_mat.Zero()\n        self.lr_mat.SetElement(0, 2, -1)\n        self.lr_mat.SetElement(1, 1, -1)\n        self.lr_mat.SetElement(2, 0, 1)\n        self.lr_mat.SetElement(3, 3, 1)\n\n        self.rl_mat = vtkMatrix4x4()\n        self.rl_mat.Zero()\n        self.rl_mat.SetElement(0, 2, 1)\n        self.rl_mat.SetElement(1, 1, -1)\n        self.rl_mat.SetElement(2, 0, 1)\n        self.rl_mat.SetElement(3, 3, 1)\n\n        \"\"\"\n        The previous transforms assume radiological views of the slices (viewed from the feet). other\n        modalities such as physical sectioning may view from the head. These transforms modify the original\n        with a 180\u00b0 rotation about y\n        \"\"\"\n\n        self.hf_mat = vtkMatrix4x4()\n        self.hf_mat.Zero()\n        self.hf_mat.SetElement(0, 0, -1)\n        self.hf_mat.SetElement(1, 1, 1)\n        self.hf_mat.SetElement(2, 2, -1)\n        self.hf_mat.SetElement(3, 3, 1)\n\n    def s_i(self):\n        t = vtkTransform()\n        t.SetMatrix(self.si_mat)\n        return t\n\n    def i_s(self):\n        t = vtkTransform()\n        t.SetMatrix(self.is_mat)\n        return t\n\n    @staticmethod\n    def a_p():\n        t = vtkTransform()\n        return t.Scale(1, -1, 1)\n\n    @staticmethod\n    def p_a():\n        t = vtkTransform()\n        return t.Scale(1, -1, -1)\n\n    def l_r(self):\n        t = vtkTransform()\n        t.SetMatrix(self.lr_mat)\n        t.Update()\n        return t\n\n    def r_l(self):\n        t = vtkTransform()\n        t.SetMatrix(self.lr_mat)\n        return t\n\n    def h_f(self):\n        t = vtkTransform()\n        t.SetMatrix(self.hf_mat)\n        return t\n\n    def hf_si(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Concatenate(self.si_mat)\n        return t\n\n    def hf_is(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Concatenate(self.is_mat)\n        return t\n\n    def hf_ap(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Scale(1, -1, 1)\n        return t\n\n    def hf_pa(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Scale(1, -1, -1)\n        return t\n\n    def hf_lr(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Concatenate(self.lr_mat)\n        return t\n\n    def hf_rl(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Concatenate(self.rl_mat)\n        return t\n\n    def get(self, order):\n        \"\"\"\n        Returns the vtkTransform corresponding to the slice order.\n\n        :param order: The slice order\n        :return: The vtkTransform to use\n        \"\"\"\n        if order == 'si':\n            return self.s_i()\n        elif order == 'is':\n            return self.i_s()\n        elif order == 'ap':\n            return self.a_p()\n        elif order == 'pa':\n            return self.p_a()\n        elif order == 'lr':\n            return self.l_r()\n        elif order == 'rl':\n            return self.r_l()\n        elif order == 'hf':\n            return self.h_f()\n        elif order == 'hfsi':\n            return self.hf_si()\n        elif order == 'hfis':\n            return self.hf_is()\n        elif order == 'hfap':\n            return self.hf_ap()\n        elif order == 'hfpa':\n            return self.hf_pa()\n        elif order == 'hflr':\n            return self.hf_lr()\n        elif order == 'hfrl':\n            return self.hf_rl()\n        else:\n            s = 'No such transform \"{:s}\" exists.'.format(order)\n            raise Exception(s)\n\n\nif __name__ == '__main__':\n    import sys\n\n    data_folder, slice_number = get_program_parameters(sys.argv)\n    main(data_folder, slice_number)\n
"},{"location":"Python/Visualization/FroggieSurface/","title":"FroggieSurface","text":"

vtk-examples/Python/Visualization/FroggieSurface

"},{"location":"Python/Visualization/FroggieSurface/#description","title":"Description","text":"

Construct surfaces from a segmented frog dataset. Up to fifteen different surfaces may be extracted. The example, FroggieView is similar to this example and uses sliders to control the opacities of the tissues.

By default the frog is oriented so that we look down on the dorsal (posterior) surface and the superior surface faces the top of the screen. The frog is rendered with the skin being translucent so that you can see the internal organs.

In the lower left of the image there is a prop assembly with labelled XYZ axes and a cube labelled with anatomical orientations:

  • Sagittal plane
  • L - left
  • R - right
  • Coronal plane
  • A - anterior
  • P - posterior
  • Transverse plane
  • S - superior
  • I - inferior

This prop assembly can be moved and resized.

Individual tissues can be specified by using the \"-t\" option e.g. \"-t skin skeleton\".

We use vtkFlyingEdges3D to take the 3D structured point set and generate the iso-surfaces. However, if desired, you can specify vtkMarchingCubes instead, use the option \"-m\".

The parameters used to generate the example image are loaded from a JSON file containing the data needed to access and generate the actors for each tissue along with other supplementary data such as the data file names. This means that the user need only load this one file in order to generate the data for rendering. This file is called:

<DATA>/Frog_mhd.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see Frog_mhd_format.

The code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder.

The dataset was prepared at the Lawrence Berkeley National Laboratories and is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels.

To accommodate the volume readers in VTK, the mask files were processed and combined into one vtkMetaImageReader file, called frogtissue.mhd. Integer numbers 1-15 are used to represent the 15 tissues. A similar process was done for the frog skin with the result being stored in a file called frog.mhd.

Further information:

  • VTK Examples - FroggieSurface and FroggieView

Info

Mutually exclusive options \"-a, -b, -c, -d\" are provided to let you generate approximations to the following figures: Figure 12-9a, Figure 12-9b, Figure 12-9c, and Figure 12-9d in Chapter 12 of the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/FroggieSurface/#code","title":"Code","text":"

FroggieSurface.py

#!/usr/bin/env python3\n\nimport copy\nimport json\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDecimatePro,\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkPolyDataNormals,\n    vtkStripper,\n    vtkWindowedSincPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageShrink3D,\n    vtkImageThreshold\n)\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkImagingMorphological import vtkImageIslandRemoval2D\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import (\n    vtkAnnotatedCubeActor,\n    vtkAxesActor\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropAssembly,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Construct surfaces from a segmented frog dataset.'\n    epilogue = '''\nUp to fifteen different surfaces may be extracted.\n\nNote:\n   If you want to use brainbin (the brain with no gaussian smoothing),\n    instead of brain, then request it with -t brainbin\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    group = parser.add_mutually_exclusive_group()\n    group.add_argument('-a', action='store_const', dest='view', const='a',\n                       help='The view corresponds to Fig 12-9a in the VTK Textbook')\n    group.add_argument('-b', action='store_const', dest='view', const='b',\n                       help='The view corresponds to Fig 12-9b in the VTK Textbook')\n    group.add_argument('-c', action='store_const', dest='view', const='c',\n                       help='The view corresponds to Fig 12-9c in the VTK Textbook')\n    group.add_argument('-d', action='store_const', dest='view', const='d',\n                       help='The view corresponds to Fig 12-9d in the VTK Textbook')\n    group.add_argument('-l', action='store_const', dest='view', const='l',\n                       help='The view corresponds to looking down on the anterior surface')\n    group.add_argument('-p', action='store_const', dest='view', const='p',\n                       help='The view corresponds to looking down on the posterior surface (the default)')\n    parser.set_defaults(type=None)\n\n    parser.add_argument('file_name', help='The path to the JSON file e.g. Frog_mhd.json.')\n    parser.add_argument('-t', nargs='+', dest='tissues', action='append', help='Select one or more tissues.')\n    parser.add_argument('-m', action='store_false', dest='flying_edges',\n                        help='Use flying edges by default, marching cubes if set.')\n    # -o: obliterate a synonym for decimation.\n    parser.add_argument('-o', action='store_true', dest='decimation', help='Decimate if set.')\n    args = parser.parse_args()\n    return args.file_name, args.view, args.tissues, args.flying_edges, args.decimation\n\n\ndef main(fn, select_figure, chosen_tissues, flying_edges, decimate):\n    if not select_figure:\n        select_figure = 'p'\n\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    parsed_ok, parameters = parse_json(fn_path)\n    if not parsed_ok:\n        print('Unable to parse the JSON file.')\n        return\n\n    tissues = list()\n    indices = dict()\n    for n in parameters['names']:\n        if n != 'brainbin':\n            tissues.append(n)\n            indices[n] = parameters[n]['tissue']\n    color_lut = create_tissue_lut(indices, parameters['colors'])\n\n    if select_figure:\n        if select_figure == 'b':\n            # No skin.\n            tissues = parameters['fig12-9b']\n        if select_figure in ['c', 'd']:\n            # No skin, blood and skeleton.\n            tissues = parameters['fig12-9cd']\n\n    if chosen_tissues:\n        chosen_tissues = [x.lower() for x in chosen_tissues[0]]\n        res = list()\n        has_brainbin = False\n        if 'brainbin' in chosen_tissues:\n            print('Using brainbin instead of brain.')\n            res.append('brainbin')\n            indices.pop('brain', None)\n            indices['brainbin'] = 2\n            parameters['colors'].pop('brain', None)\n            parameters['colors']['brainbin'] = 'beige'\n            has_brainbin = True\n        for ct in chosen_tissues:\n            if has_brainbin and ct in ['brain', 'brainbin']:\n                continue\n            if ct in tissues:\n                res.append(ct)\n            else:\n                print(f'Tissue: {ct} is not available.')\n                print(f'Available tissues are: {\", \".join(tissues)} and brainbin')\n                return\n        if len(res) == 1 and 'skin' in res:\n            parameters['skin']['opacity'] = 1.0\n        tissues = res\n\n    colors = vtkNamedColors()\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    # Setup render window, renderer, and interactor.\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    color_size = len(max(parameters['colors'].values(), key=len))\n    name_size = len(max(parameters['names'], key=len))\n    int_size = 2\n    line = '-' * (7 + name_size + color_size)\n    res = [line,\n           f'{\"Tissue\":<{name_size}s}{\" Label \"}{\"Color\"}',\n           line]\n\n    so = SliceOrder()\n\n    for name in tissues:\n        actor = create_tissue_actor(name, parameters[name], parameters['mhd_files'], flying_edges, decimate,\n                                    color_lut, so)\n        ren.AddActor(actor)\n        res.append(f'{name:<{name_size}s} {indices[name]:{int_size + 3}d} {parameters[\"colors\"][name]:<{color_size}s}')\n\n    res.append(line)\n    print('\\n'.join(res))\n\n    ren_win.SetSize(1024, 1024)\n    ren_win.SetWindowName('FroggieSurface')\n\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    #  Final view.\n    camera = ren.GetActiveCamera()\n    # Superior Anterior Left\n    labels = 'sal'\n    if select_figure == 'a':\n        # Fig 12-9a in the VTK Textbook\n        camera.SetPosition(742.731237, -441.329635, -877.192015)\n        camera.SetFocalPoint(247.637687, 120.680880, -253.487473)\n        camera.SetViewUp(-0.323882, -0.816232, 0.478398)\n        camera.SetDistance(974.669585)\n        camera.SetClippingRange(311.646383, 1803.630763)\n    elif select_figure == 'b':\n        # Fig 12-9b in the VTK Textbook\n        camera.SetPosition(717.356065, -429.889054, -845.381584)\n        camera.SetFocalPoint(243.071719, 100.996487, -247.446340)\n        camera.SetViewUp(-0.320495, -0.820148, 0.473962)\n        camera.SetDistance(929.683631)\n        camera.SetClippingRange(293.464446, 1732.794957)\n    elif select_figure == 'c':\n        # Fig 12-9c in the VTK Textbook\n        camera.SetPosition(447.560023, -136.611491, -454.753689)\n        camera.SetFocalPoint(253.142277, 91.949451, -238.583973)\n        camera.SetViewUp(-0.425438, -0.786048, 0.448477)\n        camera.SetDistance(369.821187)\n        camera.SetClippingRange(0.829116, 829.115939)\n    elif select_figure == 'd':\n        # Fig 12-9d in the VTK Textbook\n        camera.SetPosition(347.826249, -469.633647, -236.234262)\n        camera.SetFocalPoint(296.893207, 89.307704, -225.156581)\n        camera.SetViewUp(-0.687345, -0.076948, 0.722244)\n        camera.SetDistance(561.366478)\n        camera.SetClippingRange(347.962064, 839.649856)\n    elif select_figure == 'l':\n        # Orient so that we look down on the anterior surface and\n        #   the superior surface faces the top of the screen.\n        #  Left Superior Anterior\n        labels = 'lsa'\n        transform = vtkTransform()\n        transform.SetMatrix(camera.GetModelTransformMatrix())\n        transform.RotateY(90)\n        transform.RotateZ(90)\n        camera.SetModelTransformMatrix(transform.GetMatrix())\n        ren.ResetCamera()\n    else:\n        # The default.\n        # Orient so that we look down on the posterior surface and\n        #   the superior surface faces the top of the screen.\n        # Right Superior Posterior\n        labels = 'rsp'\n        transform = vtkTransform()\n        transform.SetMatrix(camera.GetModelTransformMatrix())\n        transform.RotateY(-90)\n        transform.RotateZ(90)\n        camera.SetModelTransformMatrix(transform.GetMatrix())\n        ren.ResetCamera()\n\n    cow = vtkCameraOrientationWidget()\n    cow.SetParentRenderer(ren)\n    # Turn off if you do not want it.\n    cow.On()\n    cow.EnabledOn()\n\n    axes = make_cube_actor(labels, colors)\n    om = vtkOrientationMarkerWidget()\n    om.SetOrientationMarker(axes)\n    # Position upper left in the viewport.\n    # om.SetViewport(0.0, 0.8, 0.2, 1.0)\n    # Position lower left in the viewport.\n    om.SetViewport(0, 0, 0.2, 0.2)\n    om.SetInteractor(iren)\n    om.EnabledOn()\n    om.InteractiveOn()\n\n    ren_win.Render()\n\n    iren.Start()\n\n\ndef parse_json(fn_path):\n    \"\"\"\n    Parse the JSON file selecting the components that we want.\n\n    We also check that the file paths are valid.\n\n    :param fn_path: The path the JSON file.\n    :return: A dictionary of the parameters that we require.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    paths_ok = True\n    parameters = dict()\n    # The names of the tissues as a list.\n    parameters['names'] = list()\n    for k, v in json_data.items():\n        if k == 'files':\n            if 'root' in v:\n                root = Path(v['root'])\n                if not root.exists():\n                    print(f'Bad path: {root}')\n                    paths_ok = False\n                else:\n                    if 'mhd_files' not in v:\n                        print('Expected mhd files.')\n                        paths_ok = False\n                        continue\n                    for kk in v:\n                        if kk == 'mhd_files':\n                            if len(v[kk]) != 2:\n                                print(f'Expected two file names.')\n                                paths_ok = False\n                            # The stem of the file path becomes the key.\n                            path_map = dict()\n                            for p in list(map(lambda pp: root / pp, v[kk])):\n                                path_map[p.stem] = p\n                                if not p.is_file():\n                                    paths_ok = False\n                                    print(f'Not a file {p}')\n                            if paths_ok:\n                                parameters[kk] = path_map\n            else:\n                paths_ok = False\n                print('Missing the key \"root\" and/or the key \"files\" for the files.')\n        else:\n            if k in ['tissues', 'figures']:\n                for kk, vv in v.items():\n                    parameters[kk] = vv\n            if k == \"tissue_parameters\":\n                # Assemble the parameters for each tissue.\n                # Create the base parameters.\n                bp = dict()\n                for kk, vv in v['default'].items():\n                    bp[kk.lower()] = vv\n                frog = copy.deepcopy(bp)\n                for kk, vv in v['frog'].items():\n                    frog[kk.lower()] = vv\n                for kk, vv in v.items():\n                    if kk not in ['default', 'frog', 'parameter types']:\n                        if kk == 'skin':\n                            parameters[kk] = copy.deepcopy(bp)\n                        else:\n                            parameters[kk] = copy.deepcopy(frog)\n                        for kkk, vvv in vv.items():\n                            parameters[kk][kkk.lower()] = vvv\n                            if kkk == 'NAME':\n                                parameters['names'].append(vvv)\n    return paths_ok, parameters\n\n\ndef create_tissue_actor(name, tissue, files, flying_edges, decimate, lut, so):\n    \"\"\"\n    Create the actor for a specific tissue.\n\n    :param name: The tissue name.\n    :param tissue: The tissue parameters.\n    :param files: The path to the tissue files.\n    :param flying_edges: If true use flying edges.\n    :param decimate: If true decimate.\n    :param lut: The color lookup table for the tissues.\n    :param so: The transforms corresponding to the slice order.\n    :return: The actor.\n    \"\"\"\n\n    pixel_size = tissue['pixel_size']\n    spacing = tissue['spacing']\n    start_slice = tissue['start_slice']\n    data_spacing = [pixel_size, pixel_size, spacing]\n    columns = tissue['columns']\n    rows = tissue['rows']\n    data_origin = [-(columns / 2.0) * pixel_size, -(rows / 2.0) * pixel_size, start_slice * spacing]\n\n    voi = [\n        tissue['start_column'],\n        tissue['end_column'],\n        tissue['start_row'],\n        tissue['end_row'],\n        tissue['start_slice'],\n        tissue['end_slice'],\n    ]\n    # Adjust y bounds for PNM coordinate system.\n    tmp = voi[2]\n    voi[2] = rows - voi[3] - 1\n    voi[3] = rows - tmp - 1\n\n    if name == 'skin':\n        fn = files['frog']\n    else:\n        fn = files['frogtissue']\n\n    reader = vtkMetaImageReader()\n    reader.SetFileName(str(fn))\n    reader.SetDataSpacing(data_spacing)\n    reader.SetDataOrigin(data_origin)\n    reader.SetDataExtent(voi)\n    reader.Update()\n\n    last_connection = reader\n\n    if not name == 'skin':\n        if tissue['island_replace'] >= 0:\n            island_remover = vtkImageIslandRemoval2D()\n            island_remover.SetAreaThreshold(tissue['island_area'])\n            island_remover.SetIslandValue(tissue['island_replace'])\n            island_remover.SetReplaceValue(tissue['tissue'])\n            island_remover.SetInput(last_connection.GetOutput())\n            island_remover.Update()\n            last_connection = island_remover\n\n        select_tissue = vtkImageThreshold()\n        select_tissue.ThresholdBetween(tissue['tissue'], tissue['tissue'])\n        select_tissue.SetInValue(255)\n        select_tissue.SetOutValue(0)\n        select_tissue.SetInputConnection(last_connection.GetOutputPort())\n        last_connection = select_tissue\n\n    sample_rate = [\n        tissue['sample_rate_column'],\n        tissue['sample_rate_row'],\n        tissue['sample_rate_slice'],\n    ]\n\n    shrinker = vtkImageShrink3D()\n    shrinker.SetInputConnection(last_connection.GetOutputPort())\n    shrinker.SetShrinkFactors(sample_rate)\n    shrinker.AveragingOn()\n    last_connection = shrinker\n\n    gsd = [\n        tissue['gaussian_standard_deviation_column'],\n        tissue['gaussian_standard_deviation_row'],\n        tissue['gaussian_standard_deviation_slice'],\n    ]\n\n    if not all(v == 0 for v in gsd):\n        grf = [\n            tissue['gaussian_radius_factor_column'],\n            tissue['gaussian_radius_factor_row'],\n            tissue['gaussian_radius_factor_slice'],\n        ]\n\n        gaussian = vtkImageGaussianSmooth()\n        gaussian.SetStandardDeviation(*gsd)\n        gaussian.SetRadiusFactors(*grf)\n        gaussian.SetInputConnection(shrinker.GetOutputPort())\n        last_connection = gaussian\n\n    iso_value = tissue['value']\n    if flying_edges:\n        iso_surface = vtkFlyingEdges3D()\n        iso_surface.SetInputConnection(last_connection.GetOutputPort())\n        iso_surface.ComputeScalarsOff()\n        iso_surface.ComputeGradientsOff()\n        iso_surface.ComputeNormalsOff()\n        iso_surface.SetValue(0, iso_value)\n        iso_surface.Update()\n    else:\n        iso_surface = vtkMarchingCubes()\n        iso_surface.SetInputConnection(last_connection.GetOutputPort())\n        iso_surface.ComputeScalarsOff()\n        iso_surface.ComputeGradientsOff()\n        iso_surface.ComputeNormalsOff()\n        iso_surface.SetValue(0, iso_value)\n        iso_surface.Update()\n\n    transform = so.get(tissue['slice_order'])\n    tf = vtkTransformPolyDataFilter()\n    tf.SetTransform(transform)\n    tf.SetInputConnection(iso_surface.GetOutputPort())\n    last_connection = tf\n\n    if decimate:\n        decimator = vtkDecimatePro()\n        decimator.SetInputConnection(last_connection.GetOutputPort())\n        decimator.SetFeatureAngle(tissue['decimate_angle'])\n        decimator.PreserveTopologyOn()\n        decimator.SetErrorIsAbsolute(1)\n        decimator.SetAbsoluteError(tissue['decimate_error'])\n        decimator.SetTargetReduction(tissue['decimate_reduction'])\n        last_connection = decimator\n\n    smooth_iterations = tissue['smooth_iterations']\n    if smooth_iterations != 0:\n        smoother = vtkWindowedSincPolyDataFilter()\n        smoother.SetInputConnection(last_connection.GetOutputPort())\n        smoother.BoundarySmoothingOff()\n        smoother.FeatureEdgeSmoothingOff()\n        smoother.SetFeatureAngle(tissue['smooth_angle'])\n        smoother.SetPassBand(tissue['smooth_factor'])\n        smoother.NonManifoldSmoothingOn()\n        smoother.NormalizeCoordinatesOff()\n        last_connection = smoother\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(last_connection.GetOutputPort())\n    normals.SetFeatureAngle(tissue['feature_angle'])\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(normals.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(stripper.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetOpacity(tissue['opacity'])\n    actor.GetProperty().SetDiffuseColor(lut.GetTableValue(tissue['tissue'])[:3])\n    actor.GetProperty().SetSpecular(0.5)\n    actor.GetProperty().SetSpecularPower(10)\n\n    return actor\n\n\nclass SliceOrder:\n    \"\"\"\n    These transformations permute image and other geometric data to maintain proper\n     orientation regardless of the acquisition order. After applying these transforms with\n    vtkTransformFilter, a view up of 0, -1, 0 will result in the body part\n    facing the viewer.\n    NOTE: some transformations have a -1 scale factor for one of the components.\n          To ensure proper polygon orientation and normal direction, you must\n          apply the vtkPolyDataNormals filter.\n\n    Naming (the nomenclature is medical):\n    si - superior to inferior (top to bottom)\n    is - inferior to superior (bottom to top)\n    ap - anterior to posterior (front to back)\n    pa - posterior to anterior (back to front)\n    lr - left to right\n    rl - right to left\n    \"\"\"\n\n    def __init__(self):\n        self.si_mat = vtkMatrix4x4()\n        self.si_mat.Zero()\n        self.si_mat.SetElement(0, 0, 1)\n        self.si_mat.SetElement(1, 2, 1)\n        self.si_mat.SetElement(2, 1, -1)\n        self.si_mat.SetElement(3, 3, 1)\n\n        self.is_mat = vtkMatrix4x4()\n        self.is_mat.Zero()\n        self.is_mat.SetElement(0, 0, 1)\n        self.is_mat.SetElement(1, 2, -1)\n        self.is_mat.SetElement(2, 1, -1)\n        self.is_mat.SetElement(3, 3, 1)\n\n        self.lr_mat = vtkMatrix4x4()\n        self.lr_mat.Zero()\n        self.lr_mat.SetElement(0, 2, -1)\n        self.lr_mat.SetElement(1, 1, -1)\n        self.lr_mat.SetElement(2, 0, 1)\n        self.lr_mat.SetElement(3, 3, 1)\n\n        self.rl_mat = vtkMatrix4x4()\n        self.rl_mat.Zero()\n        self.rl_mat.SetElement(0, 2, 1)\n        self.rl_mat.SetElement(1, 1, -1)\n        self.rl_mat.SetElement(2, 0, 1)\n        self.rl_mat.SetElement(3, 3, 1)\n\n        \"\"\"\n        The previous transforms assume radiological views of the slices\n         (viewed from the feet).\n        Other modalities such as physical sectioning may view from the head.\n        The following transforms modify the original with a 180\u00b0 rotation about y\n        \"\"\"\n\n        self.hf_mat = vtkMatrix4x4()\n        self.hf_mat.Zero()\n        self.hf_mat.SetElement(0, 0, -1)\n        self.hf_mat.SetElement(1, 1, 1)\n        self.hf_mat.SetElement(2, 2, -1)\n        self.hf_mat.SetElement(3, 3, 1)\n\n        self.transform = dict()\n\n        si_trans = vtkTransform()\n        si_trans.SetMatrix(self.si_mat)\n        self.transform['si'] = si_trans\n\n        is_trans = vtkTransform()\n        is_trans.SetMatrix(self.is_mat)\n        self.transform['is'] = is_trans\n\n        ap_trans = vtkTransform()\n        ap_trans.Scale(1, -1, 1)\n        self.transform['ap'] = ap_trans\n\n        pa_trans = vtkTransform()\n        pa_trans.Scale(1, -1, -1)\n        self.transform['pa'] = pa_trans\n\n        lr_trans = vtkTransform()\n        lr_trans.SetMatrix(self.lr_mat)\n        self.transform['lr'] = lr_trans\n\n        rl_trans = vtkTransform()\n        rl_trans.SetMatrix(self.rl_mat)\n        self.transform['rl'] = rl_trans\n\n        hf_trans = vtkTransform()\n        hf_trans.SetMatrix(self.hf_mat)\n        self.transform['hf'] = hf_trans\n\n        hf_si_trans = vtkTransform()\n        hf_si_trans.SetMatrix(self.hf_mat)\n        hf_si_trans.Concatenate(self.si_mat)\n        self.transform['hfsi'] = hf_si_trans\n\n        hf_is_trans = vtkTransform()\n        hf_is_trans.SetMatrix(self.hf_mat)\n        hf_is_trans.Concatenate(self.is_mat)\n        self.transform['hfis'] = hf_is_trans\n\n        hf_ap_trans = vtkTransform()\n        hf_ap_trans.SetMatrix(self.hf_mat)\n        hf_ap_trans.Scale(1, -1, 1)\n        self.transform['hfap'] = hf_ap_trans\n\n        hf_pa_trans = vtkTransform()\n        hf_pa_trans.SetMatrix(self.hf_mat)\n        hf_pa_trans.Scale(1, -1, -1)\n        self.transform['hfpa'] = hf_pa_trans\n\n        hf_lr_trans = vtkTransform()\n        hf_lr_trans.SetMatrix(self.hf_mat)\n        hf_lr_trans.Concatenate(self.lr_mat)\n        self.transform['hflr'] = hf_lr_trans\n\n        hf_rl_trans = vtkTransform()\n        hf_rl_trans.SetMatrix(self.hf_mat)\n        hf_rl_trans.Concatenate(self.rl_mat)\n        self.transform['hfrl'] = hf_rl_trans\n\n    def print_transform(self, order):\n        \"\"\"\n        Print the homogenous matrix corresponding to the slice order.\n        :param order: The slice order.\n        :return:\n        \"\"\"\n        print(order)\n        m = self.transform[order].GetMatrix()\n        for i in range(0, 4):\n            row = list()\n            for j in range(0, 4):\n                row.append(f'{m.GetElement(i, j):6.2g}')\n            print(' '.join(row))\n\n    def print_all_transforms(self):\n        \"\"\"\n        Print all the homogenous matrices corresponding to the slice orders.\n        :return:\n        \"\"\"\n        for k in self.transform.keys():\n            self.print_transform(k)\n\n    def get(self, order):\n        \"\"\"\n        Returns the vtkTransform corresponding to the slice order.\n\n        :param order: The slice order.\n        :return: The vtkTransform to use.\n        \"\"\"\n        if order in self.transform.keys():\n            return self.transform[order]\n        else:\n            s = 'No such transform \"{:s}\" exists.'.format(order)\n            raise Exception(s)\n\n\ndef create_tissue_lut(indices, colors):\n    \"\"\"\n    Create the lookup table for the frog tissues.\n\n    Each table value corresponds the color of one of the frog tissues.\n\n    :param indices: The tissue name and index.\n    :param colors: The tissue name and color.\n    :return: The lookup table.\n    \"\"\"\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(len(colors))\n    lut.SetTableRange(0, len(colors) - 1)\n    lut.Build()\n\n    nc = vtkNamedColors()\n\n    for k in indices.keys():\n        lut.SetTableValue(indices[k], nc.GetColor4d(colors[k]))\n\n    return lut\n\n\ndef make_axes_actor(scale, xyz_labels):\n    \"\"\"\n    :param scale: Sets the scale and direction of the axes.\n    :param xyz_labels: Labels for the axes.\n    :return: The axes actor.\n    \"\"\"\n    axes = vtkAxesActor()\n    axes.SetScale(scale)\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText(xyz_labels[0])\n    axes.SetYAxisLabelText(xyz_labels[1])\n    axes.SetZAxisLabelText(xyz_labels[2])\n    axes.SetCylinderRadius(0.5 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.025 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.5 * axes.GetSphereRadius())\n    tprop = axes.GetXAxisCaptionActor2D().GetCaptionTextProperty()\n    tprop.ItalicOn()\n    tprop.ShadowOn()\n    tprop.SetFontFamilyToTimes()\n    # Use the same text properties on the other two axes.\n    axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    return axes\n\n\ndef make_annotated_cube_actor(cube_labels, colors):\n    \"\"\"\n    :param cube_labels: The labels for the cube faces.\n    :param colors: Used to determine the cube color.\n    :return: The annotated cube actor.\n    \"\"\"\n    # A cube with labeled faces.\n    cube = vtkAnnotatedCubeActor()\n    cube.SetXPlusFaceText(cube_labels[0])\n    cube.SetXMinusFaceText(cube_labels[1])\n    cube.SetYPlusFaceText(cube_labels[2])\n    cube.SetYMinusFaceText(cube_labels[3])\n    cube.SetZPlusFaceText(cube_labels[4])\n    cube.SetZMinusFaceText(cube_labels[5])\n    cube.SetFaceTextScale(0.5)\n    cube.GetCubeProperty().SetColor(colors.GetColor3d('Gainsboro'))\n\n    cube.GetTextEdgesProperty().SetColor(colors.GetColor3d('LightSlateGray'))\n\n    # Change the vector text colors.\n    cube.GetXPlusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetXMinusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetYPlusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetYMinusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetZPlusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    cube.GetZMinusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    return cube\n\n\ndef make_cube_actor(label_selector, colors):\n    \"\"\"\n    :param label_selector: The selector used to define labels for the axes and cube.\n    :param colors: Used to set the colors of the cube faces.\n    :return: The combined axes and annotated cube prop.\n    \"\"\"\n    if label_selector == 'sal':\n        # xyz_labels = ['S', 'A', 'L']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['S', 'I', 'A', 'P', 'L', 'R']\n        scale = [1.5, 1.5, 1.5]\n    elif label_selector == 'rsp':\n        # xyz_labels = ['R', 'S', 'P']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['R', 'L', 'S', 'I', 'P', 'A']\n        scale = [1.5, 1.5, 1.5]\n    elif label_selector == 'lsa':\n        # xyz_labels = ['L', 'S', 'A']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['L', 'R', 'S', 'I', 'A', 'P']\n        scale = [1.5, 1.5, 1.5]\n    else:\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['+X', '-X', '+Y', '-Y', '+Z', '-Z']\n        scale = [1.5, 1.5, 1.5]\n\n    # We are combining a vtkAxesActor and a vtkAnnotatedCubeActor\n    # into a vtkPropAssembly\n    cube = make_annotated_cube_actor(cube_labels, colors)\n    axes = make_axes_actor(scale, xyz_labels)\n\n    # Combine orientation markers into one with an assembly.\n    assembly = vtkPropAssembly()\n    assembly.AddPart(axes)\n    assembly.AddPart(cube)\n    return assembly\n\n\nif __name__ == '__main__':\n    import sys\n\n    data_folder, view, selected_tissues, use_flying_edges, use_decimate = get_program_parameters(sys.argv)\n    main(data_folder, view, selected_tissues, use_flying_edges, use_decimate)\n
"},{"location":"Python/Visualization/FroggieView/","title":"FroggieView","text":"

vtk-examples/Python/Visualization/FroggieView

"},{"location":"Python/Visualization/FroggieView/#description","title":"Description","text":"

View surfaces of a segmented frog dataset using preprocessed *.vtk tissue files. This means that loading and processing is much faster when comapred with FroggieSurface.

FroggieView provides the ability to turn on and off surfaces, control their opacity through the use of sliders and control the camera position.

By default the frog is oriented so that we look down on the dorsal (posterior) surface and the superior surface faces the top of the screen. The frog is rendered with the skin being translucent so that you can see the internal organs.

In the lower left of the image there is a prop assembly with labelled XYZ axes and a cube labelled with anatomical orientations:

  • Sagittal plane
  • L - left
  • R - right
  • Coronal plane
  • A - anterior
  • P - posterior
  • Transverse plane
  • S - superior
  • I - inferior

This prop assembly can be moved and resized.

The opacity of each tissue is controlled by a slider, additionally you can turn all the sliders on or off by pressing the \"n\" key.

If the option \"-n\" is selected, no sliders will displayed.

Individual tissues can be specified by using the \"-t\" option e.g. \"-t skin skeleton\".

The parameters used to generate the example image are loaded from a JSON file containing the data needed to access and generate the actors for each tissue along with other supplementary data such as the data file names. This means that the user need only load this one file in order to generate the data for rendering. This file is called:

<DATA>/Frog_vtk.json\n

Where <DATA> is the path to vtk-examples/src/Testing/Data.

For information about the parameters in the JSON file, please see Frog_vtk_format.

The code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder.

The dataset was prepared at the Lawrence Berkeley National Laboratories. It is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels.

Further information:

  • VTK Examples - FroggieSurface and FroggieView

Info

Mutually exclusive options \"-a -b -c -d\" are provided to let you generate approximations to the following figures: Figure 12-9a, Figure 12-9b, Figure 12-9c, and Figure 12-9d in Chapter 12 of the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/FroggieView/#code","title":"Code","text":"

FroggieView.py

#!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkLookupTable\n)\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget,\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import (\n    vtkAxesActor,\n    vtkAnnotatedCubeActor,\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropAssembly,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'View surfaces of a segmented frog dataset using preprocessed VTK tissue files.'\n    epilogue = '''\nSliders are provided to control the opacity of the displayed tissues.\nUp to fifteen different surfaces may be viewed.\n\nNote:\n   If you want to use brainbin (the brain with no gaussian smoothing),\n    instead of brain, then request it with -t brainbin\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    group = parser.add_mutually_exclusive_group()\n    group.add_argument('-a', action='store_const', dest='view', const='a',\n                       help='The view corresponds to Fig 12-9a in the VTK Textbook')\n    group.add_argument('-b', action='store_const', dest='view', const='b',\n                       help='The view corresponds to Fig 12-9b in the VTK Textbook')\n    group.add_argument('-c', action='store_const', dest='view', const='c',\n                       help='The view corresponds to Fig 12-9c in the VTK Textbook')\n    group.add_argument('-d', action='store_const', dest='view', const='d',\n                       help='The view corresponds to Fig 12-9d in the VTK Textbook')\n    group.add_argument('-l', action='store_const', dest='view', const='l',\n                       help='The view corresponds to looking down on the anterior surface')\n    group.add_argument('-p', action='store_const', dest='view', const='p',\n                       help='The view corresponds to looking down on the posterior surface (the default)')\n    parser.set_defaults(type=None)\n\n    parser.add_argument('file_name', help='The path to the JSON file e.g. Frog_vtk.json.')\n    parser.add_argument('-n', action='store_true', dest='omit_sliders', help='No sliders.')\n    parser.add_argument('-t', nargs='+', dest='tissues', action='append', help='Select one or more tissues.')\n    args = parser.parse_args()\n    return args.file_name, args.view, args.omit_sliders, args.tissues\n\n\ndef main(fn, select_figure, no_sliders, chosen_tissues):\n    if not select_figure:\n        select_figure = 'p'\n\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    parsed_ok, parameters = parse_json(fn_path)\n    if not parsed_ok:\n        print('Unable to parse the JSON file.')\n        return\n\n    color_lut = create_tissue_lut(parameters['indices'], parameters['colors'])\n\n    tissues = parameters['names']\n    if select_figure:\n        if select_figure == 'b':\n            # No skin.\n            tissues = parameters['fig12-9b']\n        if select_figure in ['c', 'd']:\n            # No skin, blood and skeleton.\n            tissues = parameters['fig12-9cd']\n\n    if chosen_tissues:\n        chosen_tissues = [x.lower() for x in chosen_tissues[0]]\n        res = list()\n        has_brainbin = False\n        if 'brainbin' in chosen_tissues:\n            print('Using brainbin instead of brain.')\n            res.append('brainbin')\n            parameters['indices'].pop('brain', None)\n            parameters['indices']['brainbin'] = 2\n            parameters['colors'].pop('brain', None)\n            parameters['colors']['brainbin'] = 'beige'\n            has_brainbin = True\n        for ct in chosen_tissues:\n            if has_brainbin and ct in ['brain', 'brainbin']:\n                continue\n            if ct in tissues:\n                res.append(ct)\n            else:\n                print(f'Tissue: {ct} is not available.')\n                print(f'Available tissues are: {\", \".join(tissues)} and brainbin')\n                return\n        if len(res) == 1 and 'skin' in res:\n            parameters['opacity']['skin'] = 1.0\n        tissues = res\n\n    colors = vtkNamedColors()\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    # Setup render window, renderers, and interactor.\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    sliders = dict()\n    left_step_size = 1.0 / 9\n    left_pos_y = 0.275\n    left_pos_x0 = 0.02\n    left_pos_x1 = 0.18\n    right_step_size = 1.0 / 9\n    right_pos_y = 0.05\n    right_pos_x0 = 0.8 + 0.02\n    right_pos_x1 = 0.8 + 0.18\n\n    slider_count = 0\n\n    color_size = len(max(parameters['colors'].values(), key=len))\n    name_size = len(max(parameters['names'], key=len))\n    int_size = 2\n    line = '-' * (7 + name_size + color_size)\n    res = [line,\n           f'{\"Tissue\":<{name_size}s}{\" Label \"}{\"Color\"}',\n           line]\n\n    for tissue in tissues:\n        reader = vtkPolyDataReader()\n        reader.SetFileName(parameters['vtk_files'][tissue])\n        reader.Update()\n\n        trans = SliceOrder().get(parameters['orientation'][tissue])\n        trans.Scale(1, -1, -1)\n\n        tf = vtkTransformPolyDataFilter()\n        tf.SetInputConnection(reader.GetOutputPort())\n        tf.SetTransform(trans)\n        tf.SetInputConnection(reader.GetOutputPort())\n\n        normals = vtkPolyDataNormals()\n        normals.SetInputConnection(tf.GetOutputPort())\n        normals.SetFeatureAngle(60.0)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(normals.GetOutputPort())\n\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        actor.GetProperty().SetOpacity(parameters['opacity'][tissue])\n        actor.GetProperty().SetDiffuseColor(color_lut.GetTableValue(parameters['indices'][tissue])[:3])\n        actor.GetProperty().SetSpecular(0.2)\n        actor.GetProperty().SetSpecularPower(10)\n\n        ren.AddActor(actor)\n\n        if not no_sliders:\n            slider_properties = SliderProperties()\n            slider_properties.value_initial = parameters['opacity'][tissue]\n            slider_properties.title = tissue\n\n            # Screen coordinates.\n            if slider_count < 7:\n                slider_properties.p1 = [left_pos_x0, left_pos_y]\n                slider_properties.p2 = [left_pos_x1, left_pos_y]\n                left_pos_y += left_step_size\n            else:\n                slider_properties.p1 = [right_pos_x0, right_pos_y]\n                slider_properties.p2 = [right_pos_x1, right_pos_y]\n                right_pos_y += right_step_size\n\n            slider_widget = make_slider_widget(slider_properties, color_lut, parameters['indices'][tissue])\n            slider_widget.SetInteractor(iren)\n            slider_widget.SetAnimationModeToAnimate()\n            slider_widget.EnabledOn()\n\n            cb = SliderCallback(actor.GetProperty())\n            slider_widget.AddObserver(vtkCommand.InteractionEvent, cb)\n            sliders[tissue] = slider_widget\n            slider_count += 1\n\n        res.append(\n            f'{tissue:<{name_size}s} {parameters[\"indices\"][tissue]:{int_size + 3}d}'\n            f' {parameters[\"colors\"][tissue]:<{color_size}s}')\n\n    res.append(line)\n    print('\\n'.join(res))\n\n    if no_sliders:\n        ren_win.SetSize(1024, 1024)\n    else:\n        ren_win.SetSize(1024 + 400, 1024)\n    ren_win.SetWindowName('FroggieView')\n\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    #  Final view.\n    camera = ren.GetActiveCamera()\n    # Superior Anterior Left\n    labels = 'sal'\n    if select_figure == 'a':\n        # Fig 12-9a in the VTK Textbook\n        camera.SetPosition(495.722368, -447.474954, -646.308030)\n        camera.SetFocalPoint(137.612066, -40.962376, -195.171023)\n        camera.SetViewUp(-0.323882, -0.816232, 0.478398)\n        camera.SetDistance(704.996499)\n        camera.SetClippingRange(319.797039, 1809.449285)\n    elif select_figure == 'b':\n        # Fig 12-9b in the VTK Textbook\n        camera.SetPosition(478.683494, -420.477744, -643.112038)\n        camera.SetFocalPoint(135.624874, -36.478435, -210.614440)\n        camera.SetViewUp(-0.320495, -0.820148, 0.473962)\n        camera.SetDistance(672.457328)\n        camera.SetClippingRange(307.326771, 1765.990822)\n    elif select_figure == 'c':\n        # Fig 12-9c in the VTK Textbook\n        camera.SetPosition(201.363313, -147.260834, -229.885066)\n        camera.SetFocalPoint(140.626206, -75.857216, -162.352531)\n        camera.SetViewUp(-0.425438, -0.786048, 0.448477)\n        camera.SetDistance(115.534047)\n        camera.SetClippingRange(7.109870, 854.091718)\n    elif select_figure == 'd':\n        # Fig 12-9d in the VTK Textbook\n        camera.SetPosition(115.361727, -484.656410, -6.193827)\n        camera.SetFocalPoint(49.126343, 98.501094, 1.323317)\n        camera.SetViewUp(-0.649127, -0.083475, 0.756086)\n        camera.SetDistance(586.955116)\n        camera.SetClippingRange(360.549218, 866.876230)\n    elif select_figure == 'l':\n        # Orient so that we look down on the anterior surface and\n        #   the superior surface faces the top of the screen.\n        #  Left Superior Anterior\n        labels = 'lsa'\n        transform = vtkTransform()\n        transform.SetMatrix(camera.GetModelTransformMatrix())\n        transform.RotateY(90)\n        transform.RotateZ(90)\n        camera.SetModelTransformMatrix(transform.GetMatrix())\n        ren.ResetCamera()\n    else:\n        # The default.\n        # Orient so that we look down on the posterior surface and\n        #   the superior surface faces the top of the screen.\n        # Right Superior Posterior\n        labels = 'rsp'\n        transform = vtkTransform()\n        transform.SetMatrix(camera.GetModelTransformMatrix())\n        transform.RotateY(-90)\n        transform.RotateZ(90)\n        camera.SetModelTransformMatrix(transform.GetMatrix())\n        ren.ResetCamera()\n\n    cow = vtkCameraOrientationWidget()\n    cow.SetParentRenderer(ren)\n    if no_sliders:\n        # Turn off if you do not want it.\n        cow.On()\n        cow.EnabledOn()\n    else:\n        cow.Off()\n        cow.EnabledOff()\n\n    axes = make_cube_actor(labels, colors)\n    om = vtkOrientationMarkerWidget()\n    om.SetOrientationMarker(axes)\n    # Position upper left in the viewport.\n    # om.SetViewport(0.0, 0.8, 0.2, 1.0)\n    # Position lower left in the viewport.\n    om.SetViewport(0, 0, 0.2, 0.2)\n    om.SetInteractor(iren)\n    om.EnabledOn()\n    om.InteractiveOn()\n\n    ren_win.Render()\n\n    slider_toggle = SliderToggleCallback(sliders)\n    iren.AddObserver('KeyPressEvent', slider_toggle)\n\n    iren.Start()\n\n\ndef parse_json(fn_path):\n    \"\"\"\n    Parse the JSON file selecting the components that we want.\n\n    We also check that the file paths are valid.\n\n    :param fn_path: The path the JSON file.\n    :return: A dictionary of the parameters that we require.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    paths_ok = True\n    parameters = dict()\n    for k, v in json_data.items():\n        if k == 'files':\n            if 'root' in v:\n                root = Path(v['root'])\n                if not root.exists():\n                    print(f'Bad path: {root}')\n                    paths_ok = False\n                else:\n                    if 'vtk_files' not in v:\n                        print('Expected vtk files.')\n                        paths_ok = False\n                        continue\n                    for kk in v:\n                        if kk == 'vtk_files':\n                            if len(v[kk]) != 17:\n                                print(f'Expected seventeen file names.')\n                                paths_ok = False\n                            # The stem of the file path becomes the key.\n                            path_map = dict()\n                            for p in list(map(lambda pp: root / pp, v[kk])):\n                                path_map[p.stem] = p\n                                if not p.is_file():\n                                    paths_ok = False\n                                    print(f'Not a file {p}')\n                            if paths_ok:\n                                parameters[kk] = path_map\n            else:\n                paths_ok = False\n                print('Missing the key \"root\" and/or the key \"files\" for the files.')\n        else:\n            if k in ['tissues', 'figures']:\n                for kk, vv in v.items():\n                    parameters[kk] = vv\n    return paths_ok, parameters\n\n\nclass SliceOrder:\n    \"\"\"\n    These transformations permute image and other geometric data to maintain proper\n     orientation regardless of the acquisition order. After applying these transforms with\n    vtkTransformFilter, a view up of 0, -1, 0 will result in the body part\n    facing the viewer.\n    NOTE: some transformations have a -1 scale factor for one of the components.\n          To ensure proper polygon orientation and normal direction, you must\n          apply the vtkPolyDataNormals filter.\n\n    Naming (the nomenclature is medical):\n    si - superior to inferior (top to bottom)\n    is - inferior to superior (bottom to top)\n    ap - anterior to posterior (front to back)\n    pa - posterior to anterior (back to front)\n    lr - left to right\n    rl - right to left\n    \"\"\"\n\n    def __init__(self):\n        self.si_mat = vtkMatrix4x4()\n        self.si_mat.Zero()\n        self.si_mat.SetElement(0, 0, 1)\n        self.si_mat.SetElement(1, 2, 1)\n        self.si_mat.SetElement(2, 1, -1)\n        self.si_mat.SetElement(3, 3, 1)\n\n        self.is_mat = vtkMatrix4x4()\n        self.is_mat.Zero()\n        self.is_mat.SetElement(0, 0, 1)\n        self.is_mat.SetElement(1, 2, -1)\n        self.is_mat.SetElement(2, 1, -1)\n        self.is_mat.SetElement(3, 3, 1)\n\n        self.lr_mat = vtkMatrix4x4()\n        self.lr_mat.Zero()\n        self.lr_mat.SetElement(0, 2, -1)\n        self.lr_mat.SetElement(1, 1, -1)\n        self.lr_mat.SetElement(2, 0, 1)\n        self.lr_mat.SetElement(3, 3, 1)\n\n        self.rl_mat = vtkMatrix4x4()\n        self.rl_mat.Zero()\n        self.rl_mat.SetElement(0, 2, 1)\n        self.rl_mat.SetElement(1, 1, -1)\n        self.rl_mat.SetElement(2, 0, 1)\n        self.rl_mat.SetElement(3, 3, 1)\n\n        \"\"\"\n        The previous transforms assume radiological views of the slices\n         (viewed from the feet).\n        Other modalities such as physical sectioning may view from the head.\n        The following transforms modify the original with a 180\u00b0 rotation about y\n        \"\"\"\n\n        self.hf_mat = vtkMatrix4x4()\n        self.hf_mat.Zero()\n        self.hf_mat.SetElement(0, 0, -1)\n        self.hf_mat.SetElement(1, 1, 1)\n        self.hf_mat.SetElement(2, 2, -1)\n        self.hf_mat.SetElement(3, 3, 1)\n\n        self.transform = dict()\n\n        si_trans = vtkTransform()\n        si_trans.SetMatrix(self.si_mat)\n        self.transform['si'] = si_trans\n\n        is_trans = vtkTransform()\n        is_trans.SetMatrix(self.is_mat)\n        self.transform['is'] = is_trans\n\n        ap_trans = vtkTransform()\n        ap_trans.Scale(1, -1, 1)\n        self.transform['ap'] = ap_trans\n\n        pa_trans = vtkTransform()\n        pa_trans.Scale(1, -1, -1)\n        self.transform['pa'] = pa_trans\n\n        lr_trans = vtkTransform()\n        lr_trans.SetMatrix(self.lr_mat)\n        self.transform['lr'] = lr_trans\n\n        rl_trans = vtkTransform()\n        rl_trans.SetMatrix(self.rl_mat)\n        self.transform['rl'] = rl_trans\n\n        hf_trans = vtkTransform()\n        hf_trans.SetMatrix(self.hf_mat)\n        self.transform['hf'] = hf_trans\n\n        hf_si_trans = vtkTransform()\n        hf_si_trans.SetMatrix(self.hf_mat)\n        hf_si_trans.Concatenate(self.si_mat)\n        self.transform['hfsi'] = hf_si_trans\n\n        hf_is_trans = vtkTransform()\n        hf_is_trans.SetMatrix(self.hf_mat)\n        hf_is_trans.Concatenate(self.is_mat)\n        self.transform['hfis'] = hf_is_trans\n\n        hf_ap_trans = vtkTransform()\n        hf_ap_trans.SetMatrix(self.hf_mat)\n        hf_ap_trans.Scale(1, -1, 1)\n        self.transform['hfap'] = hf_ap_trans\n\n        hf_pa_trans = vtkTransform()\n        hf_pa_trans.SetMatrix(self.hf_mat)\n        hf_pa_trans.Scale(1, -1, -1)\n        self.transform['hfpa'] = hf_pa_trans\n\n        hf_lr_trans = vtkTransform()\n        hf_lr_trans.SetMatrix(self.hf_mat)\n        hf_lr_trans.Concatenate(self.lr_mat)\n        self.transform['hflr'] = hf_lr_trans\n\n        hf_rl_trans = vtkTransform()\n        hf_rl_trans.SetMatrix(self.hf_mat)\n        hf_rl_trans.Concatenate(self.rl_mat)\n        self.transform['hfrl'] = hf_rl_trans\n\n        # Identity\n        self.transform['I'] = vtkTransform()\n\n        # Zero\n        z_trans = vtkTransform()\n        z_trans.Scale(0, 0, 0)\n        self.transform['Z'] = z_trans\n\n    def print_transform(self, order):\n        \"\"\"\n        Print the homogenous matrix corresponding to the slice order.\n        :param order: The slice order.\n        :return:\n        \"\"\"\n        print(order)\n        m = self.transform[order].GetMatrix()\n        for i in range(0, 4):\n            row = list()\n            for j in range(0, 4):\n                row.append(f'{m.GetElement(i, j):6.2g}')\n            print(' '.join(row))\n\n    def print_all_transforms(self):\n        \"\"\"\n        Print all the homogenous matrices corresponding to the slice orders.\n        :return:\n        \"\"\"\n        for k in self.transform.keys():\n            self.print_transform(k)\n\n    def get(self, order):\n        \"\"\"\n        Returns the vtkTransform corresponding to the slice order.\n\n        :param order: The slice order.\n        :return: The vtkTransform to use.\n        \"\"\"\n        if order in self.transform.keys():\n            return self.transform[order]\n        else:\n            s = 'No such transform \"{:s}\" exists.'.format(order)\n            raise Exception(s)\n\n\ndef create_tissue_lut(indices, colors):\n    \"\"\"\n    Create the lookup table for the frog tissues.\n\n    Each table value corresponds the color of one of the frog tissues.\n\n    :param indices: The tissue name and index.\n    :param colors: The tissue name and color.\n    :return: The lookup table.\n    \"\"\"\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(len(colors))\n    lut.SetTableRange(0, len(colors) - 1)\n    lut.Build()\n\n    nc = vtkNamedColors()\n\n    for k in indices.keys():\n        lut.SetTableValue(indices[k], nc.GetColor4d(colors[k]))\n\n    return lut\n\n\ndef make_axes_actor(scale, xyz_labels):\n    \"\"\"\n    :param scale: Sets the scale and direction of the axes.\n    :param xyz_labels: Labels for the axes.\n    :return: The axes actor.\n    \"\"\"\n    axes = vtkAxesActor()\n    axes.SetScale(scale)\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText(xyz_labels[0])\n    axes.SetYAxisLabelText(xyz_labels[1])\n    axes.SetZAxisLabelText(xyz_labels[2])\n    axes.SetCylinderRadius(0.5 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.025 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.5 * axes.GetSphereRadius())\n    tprop = axes.GetXAxisCaptionActor2D().GetCaptionTextProperty()\n    tprop.ItalicOn()\n    tprop.ShadowOn()\n    tprop.SetFontFamilyToTimes()\n    # Use the same text properties on the other two axes.\n    axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    return axes\n\n\ndef make_annotated_cube_actor(cube_labels, colors):\n    \"\"\"\n    :param cube_labels: The labels for the cube faces.\n    :param colors: Used to determine the cube color.\n    :return: The annotated cube actor.\n    \"\"\"\n    # A cube with labeled faces.\n    cube = vtkAnnotatedCubeActor()\n    cube.SetXPlusFaceText(cube_labels[0])\n    cube.SetXMinusFaceText(cube_labels[1])\n    cube.SetYPlusFaceText(cube_labels[2])\n    cube.SetYMinusFaceText(cube_labels[3])\n    cube.SetZPlusFaceText(cube_labels[4])\n    cube.SetZMinusFaceText(cube_labels[5])\n    cube.SetFaceTextScale(0.5)\n    cube.GetCubeProperty().SetColor(colors.GetColor3d('Gainsboro'))\n\n    cube.GetTextEdgesProperty().SetColor(colors.GetColor3d('LightSlateGray'))\n\n    # Change the vector text colors.\n    cube.GetXPlusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetXMinusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetYPlusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetYMinusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetZPlusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    cube.GetZMinusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    return cube\n\n\ndef make_cube_actor(label_selector, colors):\n    \"\"\"\n    :param label_selector: The selector used to define labels for the axes and cube.\n    :param colors: Used to set the colors of the cube faces.\n    :return: The combined axes and annotated cube prop.\n    \"\"\"\n    if label_selector == 'sal':\n        # xyz_labels = ['S', 'A', 'L']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['S', 'I', 'A', 'P', 'L', 'R']\n        scale = [1.5, 1.5, 1.5]\n    elif label_selector == 'rsp':\n        # xyz_labels = ['R', 'S', 'P']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['R', 'L', 'S', 'I', 'P', 'A']\n        scale = [1.5, 1.5, 1.5]\n    elif label_selector == 'lsa':\n        # xyz_labels = ['R', 'S', 'P']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['L', 'R', 'S', 'I', 'A', 'P']\n        scale = [1.5, 1.5, 1.5]\n    else:\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['+X', '-X', '+Y', '-Y', '+Z', '-Z']\n        scale = [1.5, 1.5, 1.5]\n\n    # We are combining a vtkAxesActor and a vtkAnnotatedCubeActor\n    # into a vtkPropAssembly\n    cube = make_annotated_cube_actor(cube_labels, colors)\n    axes = make_axes_actor(scale, xyz_labels)\n\n    # Combine orientation markers into one with an assembly.\n    assembly = vtkPropAssembly()\n    assembly.AddPart(axes)\n    assembly.AddPart(cube)\n    return assembly\n\n\nclass SliderProperties:\n    tube_width = 0.004\n    slider_length = 0.015\n    slider_width = 0.008\n    end_cap_length = 0.008\n    end_cap_width = 0.02\n    title_height = 0.02\n    label_height = 0.02\n\n    value_minimum = 0.0\n    value_maximum = 1.0\n    value_initial = 1.0\n\n    p1 = [0.02, 0.1]\n    p2 = [0.18, 0.1]\n\n    title = None\n\n    title_color = 'Black'\n    label_color = 'Black'\n    value_color = 'DarkSlateGray'\n    slider_color = 'BurlyWood'\n    selected_color = 'Lime'\n    bar_color = 'Black'\n    bar_ends_color = 'Indigo'\n\n\ndef make_slider_widget(properties, lut, idx):\n    \"\"\"\n    Make the slider widget.\n\n    :param properties: The slider properties.\n    :param lut: The color lookup table.\n    :param idx: The tissue index.\n    :return: The slider widget.\n    \"\"\"\n    slider = vtkSliderRepresentation2D()\n\n    slider.SetMinimumValue(properties.value_minimum)\n    slider.SetMaximumValue(properties.value_maximum)\n    slider.SetValue(properties.value_initial)\n    slider.SetTitleText(properties.title)\n\n    slider.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint1Coordinate().SetValue(properties.p1[0], properties.p1[1])\n    slider.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint2Coordinate().SetValue(properties.p2[0], properties.p2[1])\n\n    slider.SetTubeWidth(properties.tube_width)\n    slider.SetSliderLength(properties.slider_length)\n    slider.SetSliderWidth(properties.slider_width)\n    slider.SetEndCapLength(properties.end_cap_length)\n    slider.SetEndCapWidth(properties.end_cap_width)\n    slider.SetTitleHeight(properties.title_height)\n    slider.SetLabelHeight(properties.label_height)\n\n    colors = vtkNamedColors()\n    # Set the colors of the slider components.\n    # Change the color of the bar.\n    slider.GetTubeProperty().SetColor(colors.GetColor3d(properties.bar_color))\n    # Change the color of the ends of the bar.\n    slider.GetCapProperty().SetColor(colors.GetColor3d(properties.bar_ends_color))\n    # Change the color of the knob that slides.\n    slider.GetSliderProperty().SetColor(colors.GetColor3d(properties.slider_color))\n    # Change the color of the knob when the mouse is held on it.\n    slider.GetSelectedProperty().SetColor(colors.GetColor3d(properties.selected_color))\n    # Change the color of the text displaying the value.\n    slider.GetLabelProperty().SetColor(colors.GetColor3d(properties.value_color))\n    #  Use the one color for the labels.\n    # slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.label_color))\n    # Change the color of the text indicating what the slider controls\n    if idx in range(0, 16):\n        slider.GetTitleProperty().SetColor(lut.GetTableValue(idx)[:3])\n        slider.GetTitleProperty().ShadowOff()\n    else:\n        slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.title_color))\n\n    slider_widget = vtkSliderWidget()\n    slider_widget.SetRepresentation(slider)\n\n    return slider_widget\n\n\nclass SliderCallback:\n    def __init__(self, actor_property):\n        self.actor_property = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actor_property.SetOpacity(value)\n\n\nclass SliderToggleCallback:\n    def __init__(self, sliders):\n        self.sliders = sliders\n\n    def __call__(self, caller, ev):\n        if caller.GetKeyCode() == \"n\":\n            for k, v in self.sliders.items():\n                if v.GetEnabled():\n                    v.Off()\n                else:\n                    v.On()\n\n\nif __name__ == '__main__':\n    import sys\n\n    data_folder, view, omit_sliders, selected_tissues = get_program_parameters(sys.argv)\n    main(data_folder, view, omit_sliders, selected_tissues)\n
"},{"location":"Python/Visualization/GlyphTable/","title":"GlyphTable","text":"

vtk-examples/Python/Visualization/GlyphTable

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/GlyphTable/#code","title":"Code","text":"

GlyphTable.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkElevationFilter,\n    vtkGlyph3D\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkImagingCore import vtkRTAnalyticSource\nfrom vtkmodules.vtkImagingGeneral import vtkImageGradient\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\n# This example uses a \"glyph table\" to change the shape of the 3d glyphs\n# according to a scalar value.\n\n# NOTE: The vtkGlyph3D filter doesn't copy over scalars to the glyphs\n# generated by a table like this for some reason...\n\ndef main():\n    colors = vtkNamedColors()\n\n    # The Wavelet Source is nice for generating a test vtkImageData set\n    rt = vtkRTAnalyticSource()\n    rt.SetWholeExtent(-2, 2, -2, 2, 0, 0)\n\n    # Take the gradient of the only scalar 'RTData' to get a vector attribute\n    grad = vtkImageGradient()\n    grad.SetDimensionality(3)\n    grad.SetInputConnection(rt.GetOutputPort())\n\n    # Elevation just to generate another scalar attribute that varies nicely over the data range\n    elev = vtkElevationFilter()\n    # Elevation values will range from 0 to 1 between the Low and High Points\n    elev.SetLowPoint(-2, -2, 0)\n    elev.SetHighPoint(2, 2, 0)\n    elev.SetInputConnection(grad.GetOutputPort())\n\n    # Create simple PolyData for glyph table\n    cs = vtkCubeSource()\n    cs.SetXLength(0.5)\n    cs.SetYLength(1)\n    cs.SetZLength(2)\n    ss = vtkSphereSource()\n    ss.SetRadius(0.25)\n    cs2 = vtkConeSource()\n    cs2.SetRadius(0.25)\n    cs2.SetHeight(0.5)\n\n    # Set up the glyph filter\n    glyph = vtkGlyph3D()\n    glyph.SetInputConnection(elev.GetOutputPort())\n\n    # Here is where we build the glyph table\n    # that will be indexed into according to the IndexMode\n    glyph.SetSourceConnection(0, cs.GetOutputPort())\n    glyph.SetSourceConnection(1, ss.GetOutputPort())\n    glyph.SetSourceConnection(2, cs2.GetOutputPort())\n\n    glyph.ScalingOn()\n    glyph.SetScaleModeToScaleByScalar()\n    glyph.SetVectorModeToUseVector()\n    glyph.OrientOn()\n    glyph.SetScaleFactor(1)  # Overall scaling factor\n    glyph.SetRange(0, 1)  # Default is (0,1)\n\n    # Tell it to index into the glyph table according to scalars\n    glyph.SetIndexModeToScalar()\n\n    # Tell glyph which attribute arrays to use for what\n    glyph.SetInputArrayToProcess(0, 0, 0, 0, 'Elevation')  # scalars\n    glyph.SetInputArrayToProcess(1, 0, 0, 0, 'RTDataGradient')  # vectors\n\n    coloring_by = 'Elevation'\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph.GetOutputPort())\n    mapper.SetScalarModeToUsePointFieldData()\n    mapper.SetColorModeToMapScalars()\n    mapper.ScalarVisibilityOn()\n\n    # GetRange() call doesn't work because attributes weren't copied to glyphs\n    # as they should have been...\n    # mapper.SetScalarRange(glyph.GetOutputDataObject(0).GetPointData().GetArray(coloring_by).GetRange())\n\n    mapper.SelectColorArray(coloring_by)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    ren = vtkRenderer()\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d(\"DarkGray\"))\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('GlyphTable')\n\n    iren = vtkRenderWindowInteractor()\n    istyle = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(istyle)\n    iren.SetRenderWindow(renWin)\n    ren.ResetCamera()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/Hanoi/","title":"Hanoi","text":"

vtk-examples/Python/Visualization/Hanoi

"},{"location":"Python/Visualization/Hanoi/#description","title":"Description","text":"

This is three-dimensional implementation of the Towers of Hanoi.

Here we visualize the operation of the recursive Towers of Hanoi puzzle. In this puzzle there are three pegs. In the initial position there are one or more disks(or pucks) of varying diameter on the pegs. The disks are sorted according to disk diameter, so that the largest disk is on the bottom, followed by the next largest, and so on. The goal of the puzzle is to move the disks from one peg to another, moving the disks one at a time, and never placing a larger disk on top of a smaller disk.

Here we first set up the scene with the table, pegs and pucks. Then we use a function called Hanoi() to begin the recursion. A second function MovePuck() moves the puck from one peg to another.

To give a pleasing visual effect we move the disk in small, user-specified increments, flipping the disc over as it moves from one peg to the next. Option -s controls the user-defined increments. The option -c 2 freezes a disk in mid air moving from one peg to another.

Info

See Figure 12-20c in Chapter 12 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/Hanoi/#code","title":"Code","text":"

Hanoi.py

#!/usr/bin/env python\n\n#  Translated from Hanoi.cxx.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkMinimalStandardRandomSequence\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCylinderSource,\n    vtkPlaneSource\n)\nfrom vtkmodules.vtkIOImage import (\n    vtkBMPWriter,\n    vtkJPEGWriter,\n    vtkPNGWriter,\n    vtkPNMWriter,\n    vtkPostScriptWriter,\n    vtkTIFFWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\n\n\nclass GV(object):\n    \"\"\"\n    Used to store global variables.\n    \"\"\"\n\n    def __init__(self, numberOfPucks=5, numberOfSteps=5, puckResolution=48, configuration=0):\n        self.numberOfPucks = numberOfPucks\n        self.numberOfSteps = numberOfSteps\n        self.puckResolution = puckResolution\n        self.configuration = configuration\n        self.gotFigure2 = False  # Used to bail out of recursion if configuration == 2.\n        self.L = 1.0  # Puck height.\n        self.H = 1.1 * self.numberOfPucks * self.L  # Peg height.\n        self.R = 0.5  # Peg radius.\n        self.rMin = 4.0 * self.R  # The minimum allowable radius of disks.\n        self.rMax = 12.0 * self.R  # The maximum allowable radius of disks\n        self.D = 1.1 * 1.25 * self.rMax  # The distance between the pegs.\n        self.numberOfMoves = 0\n\n    def update(self, numberOfPucks, numberOfSteps, puckResolution, configuration):\n        self.numberOfPucks = numberOfPucks\n        self.numberOfSteps = numberOfSteps\n        self.puckResolution = puckResolution\n        self.configuration = configuration\n        self.H = 1.1 * self.numberOfPucks * self.L  # Peg height.\n\n\n# Globals\ngv = GV()\nrenWin = vtkRenderWindow()\n\"\"\"\n   For pegStack we use a list of lists where the sublists correspond to the\n      source, target and helper pegs.\n   Python lists can be used as a stack since they have append() (corresponding\n      to push()) and pop().\n\"\"\"\npegStack = [[], [], []]\n\n\ndef hanoi():\n    colors = vtkNamedColors()\n\n    # Create the renderer and render window interactor.\n    ren = vtkRenderer()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(1200, 750)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    ren.SetBackground(colors.GetColor3d('PapayaWhip'))\n\n    camera = vtkCamera()\n    camera.SetPosition(41.0433, 27.9637, 30.442)\n    camera.SetFocalPoint(11.5603, -1.51931, 0.95899)\n    camera.SetClippingRange(18.9599, 91.6042)\n    camera.SetViewUp(0, 1, 0)\n\n    ren.SetActiveCamera(camera)\n\n    # Create geometry: table, pegs, and pucks.\n    pegGeometry = vtkCylinderSource()\n    pegGeometry.SetResolution(8)\n    pegMapper = vtkPolyDataMapper()\n    pegMapper.SetInputConnection(pegGeometry.GetOutputPort())\n\n    puckGeometry = vtkCylinderSource()\n    puckGeometry.SetResolution(gv.puckResolution)\n    puckMapper = vtkPolyDataMapper()\n    puckMapper.SetInputConnection(puckGeometry.GetOutputPort())\n\n    tableGeometry = vtkPlaneSource()\n    tableGeometry.SetResolution(10, 10)\n    tableMapper = vtkPolyDataMapper()\n    tableMapper.SetInputConnection(tableGeometry.GetOutputPort())\n\n    # Create the actors: table top, pegs, and pucks\n    # The table\n    table = vtkActor()\n    ren.AddActor(table)\n    table.SetMapper(tableMapper)\n    # table.GetProperty().SetColor(0.9569, 0.6431, 0.3765)\n    table.GetProperty().SetColor(colors.GetColor3d('SaddleBrown'))\n    table.AddPosition(gv.D, 0, 0)\n    table.SetScale(4 * gv.D, 2 * gv.D, 3 * gv.D)\n    table.RotateX(90)\n\n    # The pegs (using cylinder geometry).  Note that the pegs have to translated\n    # in the  y-direction because the cylinder is centered about the origin.\n    gv.H = 1.1 * gv.numberOfPucks * gv.L\n    peg = list()\n    for i in range(0, 3):\n        peg.append(vtkActor())\n        ren.AddActor(peg[i])\n        peg[i].SetMapper(pegMapper)\n        # peg[i].GetProperty().SetColor(1, 1, 1)\n        peg[i].GetProperty().SetColor(colors.GetColor3d('Lavender'))\n        peg[i].AddPosition(i * gv.D, gv.H / 2, 0)\n        peg[i].SetScale(1, gv.H, 1)\n\n    # The pucks (using cylinder geometry). Always loaded on peg# 0.\n    puck = list()\n    randomSequence = vtkMinimalStandardRandomSequence()\n    randomSequence.SetSeed(1)\n    for i in range(0, gv.numberOfPucks):\n        puck.append(vtkActor())\n        puck[i].SetMapper(puckMapper)\n        color = [0, 0, 0]\n        for j in range(0, 3):\n            color[j] = randomSequence.GetValue()\n            randomSequence.Next()\n        puck[i].GetProperty().SetColor(*color)\n        puck[i].AddPosition(0, i * gv.L + gv.L / 2, 0)\n        scale = gv.rMax - i * (gv.rMax - gv.rMin) / (gv.numberOfPucks - 1)\n        puck[i].SetScale(scale, 1, scale)\n        ren.AddActor(puck[i])\n        pegStack[0].append(puck[i])\n\n    # Reset the camera to view all actors.\n    renWin.Render()\n    renWin.SetWindowName('Hanoi')\n\n    if gv.configuration == 3:\n        WriteImage('hanoi0.png', renWin, rgba=False)\n\n    if gv.configuration != 1:\n        # Begin recursion.\n        Hanoi(gv.numberOfPucks - 1, 0, 2, 1)\n        Hanoi(1, 0, 1, 2)\n        if not gv.gotFigure2:\n            Hanoi(gv.numberOfPucks - 1, 2, 1, 0)\n\n            renWin.Render()\n            if gv.configuration == 3:\n                WriteImage('hanoi2.png', renWin, rgba=False)\n        # Report output.\n        s = 'Number of moves: {:d}\\nPolygons rendered each frame: {:d}\\nTotal number of frames: {:d}'\n        print(s.format(gv.numberOfMoves, 3 * 8 + 1 + gv.numberOfPucks * (2 + gv.puckResolution),\n                       gv.numberOfMoves * 3 * gv.numberOfSteps))\n\n    iren.AddObserver('EndInteractionEvent', OrientationObserver(ren.GetActiveCamera()))\n\n    # Render the image.\n    iren.Initialize()\n    iren.Start()\n\n\ndef main():\n    maxPucks = 20\n    if not verify_parameters(maxPucks):\n        return\n    hanoi()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Towers of Hanoi. .'\n    epilogue = '''\nWhere:  -p specifies the number of pucks.\n        -s specifies the number of steps.\n        -r specifies the puck resolution.\n        -c specifies configuration.\n            0 final configuration.\n            1 initial configuration.\n            2 intermediate configuration.\n            3 final configuration and save images\nDefaults:  -p 5 -s 5 -r 48 -c 0\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('--numberOfPucks', '-p', default=5, type=int, nargs='?', help='The number of pucks.')\n    parser.add_argument('--numberOfSteps', '-s', default=5, type=int, nargs='?', help='The number of steps.')\n    parser.add_argument('--puckResolution', '-r', default=48, type=int, nargs='?', help='The puck resolution.')\n    parser.add_argument('--configuration', '-c', default=0, type=int, nargs='?', help='The configuration.')\n    args = parser.parse_args()\n    return args.numberOfPucks, args.numberOfSteps, args.puckResolution, args.configuration\n\n\ndef verify_parameters(maxPucks):\n    numberOfPucks, numberOfSteps, puckResolution, configuration = get_program_parameters()\n    numberOfPucks = abs(numberOfPucks)\n    numberOfSteps = abs(numberOfSteps)\n    puckResolution = abs(puckResolution)\n    configuration = abs(configuration)\n    check = True\n    if numberOfPucks < 2:\n        print('Please use more pucks!')\n        check = False\n    if numberOfPucks > maxPucks:\n        print('Too many pucks specified! Maximum is', maxPucks)\n        check = False\n    if numberOfSteps < 3:\n        print('Please use more steps!')\n        check = False\n    if configuration > 3:\n        print('0 >= configuration <= 3')\n        check = False\n    if check:\n        gv.update(numberOfPucks, numberOfSteps, puckResolution, configuration)\n    return check\n\n\ndef MovePuck(peg1, peg2):\n    \"\"\"\n    This routine is responsible for moving pucks from peg1 to peg2.\n    :param peg1: Initial peg.\n    :param peg2: Final peg.\n    :return:\n    \"\"\"\n    gv.numberOfMoves += 1\n\n    # Get the actor to move\n    movingActor = pegStack[peg1].pop()\n\n    # Get the distance to move up.\n    distance = (gv.H - (gv.L * (len(pegStack[peg1]) - 1)) + gv.rMax) / gv.numberOfSteps\n\n    for i in range(0, gv.numberOfSteps):\n        movingActor.AddPosition(0, distance, 0)\n        renWin.Render()\n\n    # Get the distance to move across\n    distance = (peg2 - peg1) * gv.D / gv.numberOfSteps\n    flipAngle = 180.0 / gv.numberOfSteps\n    for i in range(0, gv.numberOfSteps):\n        movingActor.AddPosition(distance, 0, 0)\n        movingActor.RotateX(flipAngle)\n        renWin.Render()\n        if gv.numberOfMoves == 13 and i == 3:  # for making book image\n            if gv.configuration == 3 or gv.configuration == 2:\n                cam = renWin.GetRenderers().GetFirstRenderer().GetActiveCamera()\n                camera1 = vtkCamera()\n                camera1.SetPosition(54.7263, 41.6467, 44.125)\n                camera1.SetFocalPoint(11.5603, -1.51931, 0.95899)\n                camera1.SetClippingRange(42.4226, 115.659)\n                camera1.SetViewUp(0, 1, 0)\n                renWin.GetRenderers().GetFirstRenderer().SetActiveCamera(camera1)\n                renWin.Render()\n                if gv.configuration == 3:\n                    WriteImage('hanoi1.png', renWin, rgba=False)\n                if gv.configuration == 2:\n                    gv.gotFigure2 = True\n                    break\n                renWin.GetRenderers().GetFirstRenderer().SetActiveCamera(cam)\n                renWin.Render()\n    if gv.gotFigure2:\n        pegStack[peg2].append(movingActor)\n        return\n\n    # Get the distance to move down.\n    distance = ((gv.L * (len(pegStack[peg2]) - 1)) - gv.H - gv.rMax) / gv.numberOfSteps\n\n    for i in range(0, gv.numberOfSteps):\n        movingActor.AddPosition(0, distance, 0)\n        renWin.Render()\n    pegStack[peg2].append(movingActor)\n\n\ndef Hanoi(n, peg1, peg2, peg3):\n    \"\"\"\n    Tower of Hanoi.\n    :param n: Number of disks.\n    :param peg1: Source\n    :param peg2: Target\n    :param peg3: Helper\n    :return:\n    \"\"\"\n    # If gotFigure2 is true, we break out of the recursion.\n    if gv.gotFigure2:\n        return\n    if n != 1:\n        Hanoi(n - 1, peg1, peg3, peg2)\n        if gv.gotFigure2:\n            return\n        Hanoi(1, peg1, peg2, peg3)\n        Hanoi(n - 1, peg3, peg2, peg1)\n    else:\n        MovePuck(peg1, peg2)\n\n\nclass OrientationObserver(object):\n    def __init__(self, cam):\n        self.cam = cam\n\n    def __call__(self, caller, ev):\n        # Just do this to demonstrate who called callback and the event that triggered it.\n        print(caller.GetClassName(), 'Event Id:', ev)\n        # Now print the camera orientation.\n        CameraOrientation(self.cam)\n\n\ndef CameraOrientation(cam):\n    fmt1 = '{:>15s}'\n    fmt2 = '{:9.6g}'\n    print(fmt1.format('Position:'), ', '.join(map(fmt2.format, cam.GetPosition())))\n    print(fmt1.format('Focal point:'), ', '.join(map(fmt2.format, cam.GetFocalPoint())))\n    print(fmt1.format('Clipping range:'), ', '.join(map(fmt2.format, cam.GetClippingRange())))\n    print(fmt1.format('View up:'), ', '.join(map(fmt2.format, cam.GetViewUp())))\n    print(fmt1.format('Distance:'), fmt2.format(cam.GetDistance()))\n\n\ndef WriteImage(fileName, renWin1, rgba=True):\n    \"\"\"\n    Write the render window view to an image file.\n\n    Image types supported are:\n     BMP, JPEG, PNM, PNG, PostScript, TIFF.\n    The default parameters are used for all writers, change as needed.\n\n    :param fileName: The file name, if no extension then PNG is assumed.\n    :param renWin1: The render window.\n    :param rgba: Used to set the buffer type.\n    :return:\n    \"\"\"\n\n    import os\n\n    if fileName:\n        # Select the writer to use.\n        path, ext = os.path.splitext(fileName)\n        ext = ext.lower()\n        if not ext:\n            ext = '.png'\n            fileName = fileName + ext\n        if ext == '.bmp':\n            writer = vtkBMPWriter()\n        elif ext == '.jpg':\n            writer = vtkJPEGWriter()\n        elif ext == '.pnm':\n            writer = vtkPNMWriter()\n        elif ext == '.ps':\n            if rgba:\n                rgba = False\n            writer = vtkPostScriptWriter()\n        elif ext == '.tiff':\n            writer = vtkTIFFWriter()\n        else:\n            writer = vtkPNGWriter()\n\n        windowto_image_filter = vtkWindowToImageFilter()\n        windowto_image_filter.SetInput(renWin1)\n        windowto_image_filter.SetScale(1)  # image quality\n        if rgba:\n            windowto_image_filter.SetInputBufferTypeToRGBA()\n        else:\n            windowto_image_filter.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            windowto_image_filter.ReadFrontBufferOff()\n            windowto_image_filter.Update()\n\n        writer.SetFileName(fileName)\n        writer.SetInputConnection(windowto_image_filter.GetOutputPort())\n        writer.Write()\n    else:\n        raise RuntimeError('Need a filename.')\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/HanoiInitial/","title":"HanoiInitial","text":"

vtk-examples/Python/Visualization/HanoiInitial

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/HanoiInitial/#code","title":"Code","text":"

HanoiInitial.py

#!/usr/bin/env python\n\n\"\"\"\nHanoiInitial\n\nNote: Make sure Hanoi.py is in the same directory as this program.\n\"\"\"\n\nimport Hanoi\n\n\ndef main():\n    Hanoi.gv.configuration = 1\n    Hanoi.hanoi()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/HanoiIntermediate/","title":"HanoiIntermediate","text":"

vtk-examples/Python/Visualization/HanoiIntermediate

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/HanoiIntermediate/#code","title":"Code","text":"

HanoiIntermediate.py

#!/usr/bin/env python\n\n\"\"\"\nHanoiIntermediate\n\nNote: Make sure Hanoi.py is in the same directory as this program.\n\"\"\"\n\nimport Hanoi\n\n\ndef main():\n    Hanoi.gv.configuration = 2\n    Hanoi.hanoi()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/HardwareSelector/","title":"HardwareSelector","text":"

vtk-examples/Python/Visualization/HardwareSelector

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/HardwareSelector/#code","title":"Code","text":"

HardwareSelector.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkDataObject\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkHardwareSelector,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n# Callback for when selection is changed\n\n# This is global - fix later.\nren1 = vtkRenderer()\n\n\ndef selectionCallback(caller, eventId):\n    hsel = vtkHardwareSelector()\n    hsel.SetFieldAssociation(vtkDataObject.FIELD_ASSOCIATION_CELLS)\n    hsel.SetRenderer(ren1)\n\n    x, y = caller.GetRenderWindow().GetSize()\n\n    # Create a small area around clicked point for selector area\n    hsel.SetArea(0, 0, x, y)\n    res = hsel.Select()\n\n    numNodes = res.GetNumberOfNodes()\n    if (numNodes < 1):\n        print(\"No visible cells\")\n    else:\n        sel_node = res.GetNode(0)\n        print('Visible cell IDs: ', VN.vtk_to_numpy(sel_node.GetSelectionList()).tolist())\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphere = vtkSphereSource()\n    sphere.SetCenter(0, 0, 0)\n    sphere.SetRadius(5.0)\n\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d('Bisque'))\n\n    ren1.AddActor(sphereActor)\n    ren1.GetActiveCamera().ParallelProjectionOn()\n    ren1.SetBackground(colors.GetColor3d('Navy'))\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('HardwareSelector')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    iren.AddObserver(\"UserEvent\", selectionCallback)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n    renWin.GetInteractor().SetInteractorStyle(style)\n\n    ren1.ResetCamera()\n    renWin.Render()\n\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/Hawaii/","title":"Hawaii","text":"

vtk-examples/Python/Visualization/Hawaii

"},{"location":"Python/Visualization/Hawaii/#description","title":"Description","text":"

Visualize elevations by coloring the scalar values with a lookup table.

This is a translation of the original hawaii.tcl with a few additional enhancements. The image is centered on Honolulu. Diamond Head is the crater lower left. Punchbowl is the crater in the centre.

Info

See Figure 6-12 in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/Hawaii/#code","title":"Code","text":"

Hawaii.py

#!/usr/bin/env python\n\n#  Translated from hawaii.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    file_name, color_scheme = get_program_parameters()\n\n    color_scheme = abs(color_scheme)\n    if color_scheme > 2:\n        color_scheme = 0;\n\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor(\"BkgColor\", [26, 51, 102, 255])\n\n    # Read a vtk file\n    #\n    hawaii = vtkPolyDataReader()\n    hawaii.SetFileName(file_name)\n    hawaii.Update()\n    bounds = [0.0] * 6\n    hawaii.GetOutput().GetBounds(bounds)\n\n    elevation = vtkElevationFilter()\n    elevation.SetInputConnection(hawaii.GetOutputPort())\n    elevation.SetLowPoint(0, 0, 0)\n    elevation.SetHighPoint(0, 0, 1000)\n    elevation.SetScalarRange(0, 1000)\n\n    lut = MakeLUT(color_scheme)\n\n    hawaiiMapper = vtkDataSetMapper()\n    hawaiiMapper.SetInputConnection(elevation.GetOutputPort())\n    hawaiiMapper.SetScalarRange(0, 1000)\n    hawaiiMapper.ScalarVisibilityOn()\n    hawaiiMapper.SetLookupTable(lut)\n\n    hawaiiActor = vtkActor()\n    hawaiiActor.SetMapper(hawaiiMapper)\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren.AddActor(hawaiiActor)\n    # Match the window shape to the object.\n    # renWin.SetSize(500, int(500 * bounds[1] / bounds[3]))\n    renWin.SetSize(500, 500)\n    renWin.SetWindowName('Hawaii')\n\n    iren.Initialize()\n\n    # Render the image.\n    # Centered on Honolulu.\n    # Diamond Head is the crater lower left.\n    # Punchbowl is the crater in the centre.\n    renWin.Render()\n    ren.SetBackground(colors.GetColor3d(\"BkgColor\"))\n    ren.GetActiveCamera().Zoom(1.5)\n    ren.GetActiveCamera().Roll(-90)\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce figure 6\u201312 from the VTK Textbook.'\n    epilogue = '''\n        Produce figure 6\u201312 from the VTK Textbook.\n        It is a translation of the original hawaii.tcl with a few additional enhancements.\n        The image is centered on Honolulu, O'ahu.\n        Diamond Head is the crater lower left. Punchbowl is the crater in the centre.\n\n        The color_scheme option allows you to select a series of colour schemes.\n        0: The default, a lookup using a \"Brewer\" palette.\n        1: The original: A lookup table of 256 colours ranging from deep blue (water) to yellow-white (mountain top).\n        2: A lookup table with a preset number of colours.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='honolulu.vtk')\n    parser.add_argument('color_scheme', default=0, type=int, nargs='?', help='The particular color scheme to use.')\n    args = parser.parse_args()\n    return args.filename, args.color_scheme\n\n\ndef MakeLUT(color_scheme=0):\n    \"\"\"\n    Make a lookup table.\n    :param color_scheme: Select the type of lookup table.\n    :return: The lookup table.\n    \"\"\"\n    colors = vtkNamedColors()\n    if color_scheme == 1:\n        # A lookup table of 256 colours ranging from\n        #  deep blue (water) to yellow-white (mountain top)\n        #  is used to color map this figure.\n        lut = vtkLookupTable()\n        lut.SetHueRange(0.7, 0)\n        lut.SetSaturationRange(1.0, 0)\n        lut.SetValueRange(0.5, 1.0)\n    elif color_scheme == 2:\n        # Make the lookup table with a preset number of colours.\n        colorSeries = vtkColorSeries()\n        colorSeries.SetNumberOfColors(8)\n        colorSeries.SetColorSchemeName('Hawaii')\n        colorSeries.SetColor(0, colors.GetColor3ub(\"turquoise_blue\"))\n        colorSeries.SetColor(1, colors.GetColor3ub(\"sea_green_medium\"))\n        colorSeries.SetColor(2, colors.GetColor3ub(\"sap_green\"))\n        colorSeries.SetColor(3, colors.GetColor3ub(\"green_dark\"))\n        colorSeries.SetColor(4, colors.GetColor3ub(\"tan\"))\n        colorSeries.SetColor(5, colors.GetColor3ub(\"beige\"))\n        colorSeries.SetColor(6, colors.GetColor3ub(\"light_beige\"))\n        colorSeries.SetColor(7, colors.GetColor3ub(\"bisque\"))\n        lut = vtkLookupTable()\n        colorSeries.BuildLookupTable(lut, colorSeries.ORDINAL)\n        lut.SetNanColor(1, 0, 0, 1)\n    else:\n        # Make the lookup using a Brewer palette.\n        colorSeries = vtkColorSeries()\n        colorSeries.SetNumberOfColors(8)\n        colorSeriesEnum = colorSeries.BREWER_DIVERGING_BROWN_BLUE_GREEN_8\n        colorSeries.SetColorScheme(colorSeriesEnum)\n        lut = vtkLookupTable()\n        colorSeries.BuildLookupTable(lut, colorSeries.ORDINAL)\n        lut.SetNanColor(1, 0, 0, 1)\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/IsosurfaceSampling/","title":"IsosurfaceSampling","text":"

vtk-examples/Python/Visualization/IsosurfaceSampling

"},{"location":"Python/Visualization/IsosurfaceSampling/#description","title":"Description","text":"

This example illustrates how to create an isosurface and create point data on that isosurface that is sampled from another dataset. This example creates an isosurface of a sphere and then uses the vtkProbeFilter to compute point data from a sampled cylinder.

Note

All point data is sampled, even the normals. This example restores the original isosurface normals after the probe. The example has one optional command line argument that controls the sample resolution of the sphere and cylinder. The default is 50.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/IsosurfaceSampling/#code","title":"Code","text":"

IsosurfaceSampling.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCylinder,\n    vtkSphere\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkProbeFilter\n)\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    sample_resolution = get_program_parameters()\n\n    # Create a sampled sphere\n    implicit_sphere = vtkSphere()\n    radius = 1.0\n    implicit_sphere.SetRadius(radius)\n\n    sampled_sphere = vtkSampleFunction()\n    sampled_sphere.SetSampleDimensions(sample_resolution, sample_resolution, sample_resolution)\n    x_min = -radius * 2.0\n    x_max = radius * 2.0\n    sampled_sphere.SetModelBounds(x_min, x_max, x_min, x_max, x_min, x_max)\n    sampled_sphere.SetImplicitFunction(implicit_sphere)\n\n    if use_flying_edges:\n        try:\n            iso_sphere = vtkFlyingEdges3D()\n        except AttributeError:\n            iso_sphere = vtkMarchingCubes()\n    else:\n        iso_sphere = vtkMarchingCubes()\n    iso_sphere.SetValue(0, 1.0)\n    iso_sphere.SetInputConnection(sampled_sphere.GetOutputPort())\n\n    # Create a sampled cylinder\n    implicit_cylinder = vtkCylinder()\n    implicit_cylinder.SetRadius(radius / 2.0)\n    sampled_cylinder = vtkSampleFunction()\n    sampled_cylinder.SetSampleDimensions(sample_resolution, sample_resolution, sample_resolution)\n    sampled_cylinder.SetModelBounds(x_min, x_max, x_min, x_max, x_min, x_max)\n    sampled_cylinder.SetImplicitFunction(implicit_cylinder)\n\n    # Probe cylinder with the sphere isosurface\n    probe_cylinder = vtkProbeFilter()\n    probe_cylinder.SetInputConnection(0, iso_sphere.GetOutputPort())\n    probe_cylinder.SetInputConnection(1, sampled_cylinder.GetOutputPort())\n    probe_cylinder.Update()\n\n    # Restore the original normals\n    probe_cylinder.GetOutput().GetPointData().SetNormals(\n        iso_sphere.GetOutput().GetPointData().GetNormals())\n\n    print('Scalar range: {:6.3f}, {:6.3f}'.format(probe_cylinder.GetOutput().GetScalarRange()[0],\n                                                  probe_cylinder.GetOutput().GetScalarRange()[1]))\n\n    # Create a mapper and actor\n    map_sphere = vtkPolyDataMapper()\n    map_sphere.SetInputConnection(probe_cylinder.GetOutputPort())\n    map_sphere.SetScalarRange(probe_cylinder.GetOutput().GetScalarRange())\n\n    sphere = vtkActor()\n    sphere.SetMapper(map_sphere)\n\n    # Visualize\n    renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetWindowName('IsosurfaceSampling')\n\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    renderer.AddActor(sphere)\n    renderer.SetBackground(colors.GetColor3d('AliceBlue'))\n\n    render_window.Render()\n    render_window_interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Create an isosurface and create point data on that isosurface that is sampled from another dataset.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-r', '--resolution', type=int, default=50,\n                        help='The sample resolution of the sphere and cylinder')\n    args = parser.parse_args()\n    return args.resolution\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/Kitchen/","title":"Kitchen","text":"

vtk-examples/Python/Visualization/Kitchen

"},{"location":"Python/Visualization/Kitchen/#description","title":"Description","text":"

The example shows forty streamlines in a small kitchen. The room has two windows, a door(with air leakage), and a cooking area with a hot stove. The air leakage and temperature variation combine to produce air convection currents throughout the kitchen. The starting positions of the streamlines were defined by creating a rake, or curve (and its associated points). Here the rake was a straight line modeled with a vtkLineSource. These streamlines clearly show features of the flow field. By releasing many streamlines simultaneously we obtain even more information, as the eye tends to assemble nearby streamlines into a \u201cglobal\u201d understanding of flow field features.

Info

See Figure 6-18 in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/Kitchen/#code","title":"Code","text":"

Kitchen.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkIOLegacy import vtkStructuredGridReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Set the furniture colors.\n    colors.SetColor('Furniture', [204, 204, 153, 255])\n\n    scalarRange = [0.0, 0.0]\n    maxTime = 0\n\n    aren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(aren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # Read the data.\n    #\n    reader = vtkStructuredGridReader()\n    reader.SetFileName(fileName)\n    reader.Update()  # Force a read to occur.\n    reader.GetOutput().GetLength()\n\n    if reader.GetOutput().GetPointData().GetScalars():\n        reader.GetOutput().GetPointData().GetScalars().GetRange(scalarRange)\n\n    if reader.GetOutput().GetPointData().GetVectors():\n        maxVelocity = reader.GetOutput().GetPointData().GetVectors().GetMaxNorm()\n        maxTime = 4.0 * reader.GetOutput().GetLength() / maxVelocity\n\n    #\n    # Outline around the data.\n    #\n    outlineF = vtkStructuredGridOutlineFilter()\n    outlineF.SetInputConnection(reader.GetOutputPort())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outlineF.GetOutputPort())\n    outline = vtkActor()\n    outline.SetMapper(outlineMapper)\n    outline.GetProperty().SetColor(colors.GetColor3d('LampBlack'))\n\n    #\n    # Set up shaded surfaces (i.e., supporting geometry).\n    #\n    doorGeom = vtkStructuredGridGeometryFilter()\n    doorGeom.SetInputConnection(reader.GetOutputPort())\n    doorGeom.SetExtent(27, 27, 14, 18, 0, 11)\n    mapDoor = vtkPolyDataMapper()\n    mapDoor.SetInputConnection(doorGeom.GetOutputPort())\n    mapDoor.ScalarVisibilityOff()\n    door = vtkActor()\n    door.SetMapper(mapDoor)\n    door.GetProperty().SetColor(colors.GetColor3d('Burlywood'))\n\n    window1Geom = vtkStructuredGridGeometryFilter()\n    window1Geom.SetInputConnection(reader.GetOutputPort())\n    window1Geom.SetExtent(0, 0, 9, 18, 6, 12)\n    mapWindow1 = vtkPolyDataMapper()\n    mapWindow1.SetInputConnection(window1Geom.GetOutputPort())\n    mapWindow1.ScalarVisibilityOff()\n    window1 = vtkActor()\n    window1.SetMapper(mapWindow1)\n    window1.GetProperty().SetColor(colors.GetColor3d('SkyBlue'))\n    window1.GetProperty().SetOpacity(.6)\n\n    window2Geom = vtkStructuredGridGeometryFilter()\n    window2Geom.SetInputConnection(reader.GetOutputPort())\n    window2Geom.SetExtent(5, 12, 23, 23, 6, 12)\n    mapWindow2 = vtkPolyDataMapper()\n    mapWindow2.SetInputConnection(window2Geom.GetOutputPort())\n    mapWindow2.ScalarVisibilityOff()\n    window2 = vtkActor()\n    window2.SetMapper(mapWindow2)\n    window2.GetProperty().SetColor(colors.GetColor3d('SkyBlue'))\n    window2.GetProperty().SetOpacity(.6)\n\n    klower1Geom = vtkStructuredGridGeometryFilter()\n    klower1Geom.SetInputConnection(reader.GetOutputPort())\n    klower1Geom.SetExtent(17, 17, 0, 11, 0, 6)\n    mapKlower1 = vtkPolyDataMapper()\n    mapKlower1.SetInputConnection(klower1Geom.GetOutputPort())\n    mapKlower1.ScalarVisibilityOff()\n    klower1 = vtkActor()\n    klower1.SetMapper(mapKlower1)\n    klower1.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower2Geom = vtkStructuredGridGeometryFilter()\n    klower2Geom.SetInputConnection(reader.GetOutputPort())\n    klower2Geom.SetExtent(19, 19, 0, 11, 0, 6)\n    mapKlower2 = vtkPolyDataMapper()\n    mapKlower2.SetInputConnection(klower2Geom.GetOutputPort())\n    mapKlower2.ScalarVisibilityOff()\n    klower2 = vtkActor()\n    klower2.SetMapper(mapKlower2)\n    klower2.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower3Geom = vtkStructuredGridGeometryFilter()\n    klower3Geom.SetInputConnection(reader.GetOutputPort())\n    klower3Geom.SetExtent(17, 19, 0, 0, 0, 6)\n    mapKlower3 = vtkPolyDataMapper()\n    mapKlower3.SetInputConnection(klower3Geom.GetOutputPort())\n    mapKlower3.ScalarVisibilityOff()\n    klower3 = vtkActor()\n    klower3.SetMapper(mapKlower3)\n    klower3.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower4Geom = vtkStructuredGridGeometryFilter()\n    klower4Geom.SetInputConnection(reader.GetOutputPort())\n    klower4Geom.SetExtent(17, 19, 11, 11, 0, 6)\n    mapKlower4 = vtkPolyDataMapper()\n    mapKlower4.SetInputConnection(klower4Geom.GetOutputPort())\n    mapKlower4.ScalarVisibilityOff()\n    klower4 = vtkActor()\n    klower4.SetMapper(mapKlower4)\n    klower4.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower5Geom = vtkStructuredGridGeometryFilter()\n    klower5Geom.SetInputConnection(reader.GetOutputPort())\n    klower5Geom.SetExtent(17, 19, 0, 11, 0, 0)\n    mapKlower5 = vtkPolyDataMapper()\n    mapKlower5.SetInputConnection(klower5Geom.GetOutputPort())\n    mapKlower5.ScalarVisibilityOff()\n    klower5 = vtkActor()\n    klower5.SetMapper(mapKlower5)\n    klower5.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower6Geom = vtkStructuredGridGeometryFilter()\n    klower6Geom.SetInputConnection(reader.GetOutputPort())\n    klower6Geom.SetExtent(17, 19, 0, 7, 6, 6)\n    mapKlower6 = vtkPolyDataMapper()\n    mapKlower6.SetInputConnection(klower6Geom.GetOutputPort())\n    mapKlower6.ScalarVisibilityOff()\n    klower6 = vtkActor()\n    klower6.SetMapper(mapKlower6)\n    klower6.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower7Geom = vtkStructuredGridGeometryFilter()\n    klower7Geom.SetInputConnection(reader.GetOutputPort())\n    klower7Geom.SetExtent(17, 19, 9, 11, 6, 6)\n    mapKlower7 = vtkPolyDataMapper()\n    mapKlower7.SetInputConnection(klower7Geom.GetOutputPort())\n    mapKlower7.ScalarVisibilityOff()\n    klower7 = vtkActor()\n    klower7.SetMapper(mapKlower7)\n    klower7.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    hood1Geom = vtkStructuredGridGeometryFilter()\n    hood1Geom.SetInputConnection(reader.GetOutputPort())\n    hood1Geom.SetExtent(17, 17, 0, 11, 11, 16)\n    mapHood1 = vtkPolyDataMapper()\n    mapHood1.SetInputConnection(hood1Geom.GetOutputPort())\n    mapHood1.ScalarVisibilityOff()\n    hood1 = vtkActor()\n    hood1.SetMapper(mapHood1)\n    hood1.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    hood2Geom = vtkStructuredGridGeometryFilter()\n    hood2Geom.SetInputConnection(reader.GetOutputPort())\n    hood2Geom.SetExtent(19, 19, 0, 11, 11, 16)\n    mapHood2 = vtkPolyDataMapper()\n    mapHood2.SetInputConnection(hood2Geom.GetOutputPort())\n    mapHood2.ScalarVisibilityOff()\n    hood2 = vtkActor()\n    hood2.SetMapper(mapHood2)\n    hood2.GetProperty().SetColor(colors.GetColor3d('Furniture'))\n\n    hood3Geom = vtkStructuredGridGeometryFilter()\n    hood3Geom.SetInputConnection(reader.GetOutputPort())\n    hood3Geom.SetExtent(17, 19, 0, 0, 11, 16)\n    mapHood3 = vtkPolyDataMapper()\n    mapHood3.SetInputConnection(hood3Geom.GetOutputPort())\n    mapHood3.ScalarVisibilityOff()\n    hood3 = vtkActor()\n    hood3.SetMapper(mapHood3)\n    hood3.GetProperty().SetColor(colors.GetColor3d('Furniture'))\n\n    hood4Geom = vtkStructuredGridGeometryFilter()\n    hood4Geom.SetInputConnection(reader.GetOutputPort())\n    hood4Geom.SetExtent(17, 19, 11, 11, 11, 16)\n    mapHood4 = vtkPolyDataMapper()\n    mapHood4.SetInputConnection(hood4Geom.GetOutputPort())\n    mapHood4.ScalarVisibilityOff()\n    hood4 = vtkActor()\n    hood4.SetMapper(mapHood4)\n    hood4.GetProperty().SetColor(colors.GetColor3d('Furniture'))\n\n    hood6Geom = vtkStructuredGridGeometryFilter()\n    hood6Geom.SetInputConnection(reader.GetOutputPort())\n    hood6Geom.SetExtent(17, 19, 0, 11, 16, 16)\n    mapHood6 = vtkPolyDataMapper()\n    mapHood6.SetInputConnection(hood6Geom.GetOutputPort())\n    mapHood6.ScalarVisibilityOff()\n    hood6 = vtkActor()\n    hood6.SetMapper(mapHood6)\n    hood6.GetProperty().SetColor(colors.GetColor3d('Furniture'))\n\n    cookingPlateGeom = vtkStructuredGridGeometryFilter()\n    cookingPlateGeom.SetInputConnection(reader.GetOutputPort())\n    cookingPlateGeom.SetExtent(17, 19, 7, 9, 6, 6)\n    mapCookingPlate = vtkPolyDataMapper()\n    mapCookingPlate.SetInputConnection(cookingPlateGeom.GetOutputPort())\n    mapCookingPlate.ScalarVisibilityOff()\n    cookingPlate = vtkActor()\n    cookingPlate.SetMapper(mapCookingPlate)\n    cookingPlate.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n    filterGeom = vtkStructuredGridGeometryFilter()\n    filterGeom.SetInputConnection(reader.GetOutputPort())\n    filterGeom.SetExtent(17, 19, 7, 9, 11, 11)\n    mapFilter = vtkPolyDataMapper()\n    mapFilter.SetInputConnection(filterGeom.GetOutputPort())\n    mapFilter.ScalarVisibilityOff()\n    sgfilter = vtkActor()\n    sgfilter.SetMapper(mapFilter)\n    sgfilter.GetProperty().SetColor(colors.GetColor3d('Furniture'))\n    #\n    # regular streamlines\n    #\n    line = vtkLineSource()\n    line.SetResolution(39)\n    line.SetPoint1(0.08, 2.50, 0.71)\n    line.SetPoint2(0.08, 4.50, 0.71)\n    rakeMapper = vtkPolyDataMapper()\n    rakeMapper.SetInputConnection(line.GetOutputPort())\n    rake = vtkActor()\n    rake.SetMapper(rakeMapper)\n\n    streamers = vtkStreamTracer()\n    # streamers.DebugOn()\n    streamers.SetInputConnection(reader.GetOutputPort())\n    streamers.SetSourceConnection(line.GetOutputPort())\n    streamers.SetMaximumPropagation(maxTime)\n    streamers.SetInitialIntegrationStep(.5)\n    streamers.SetMinimumIntegrationStep(.1)\n    streamers.SetIntegratorType(2)\n    streamers.Update()\n\n    streamersMapper = vtkPolyDataMapper()\n    streamersMapper.SetInputConnection(streamers.GetOutputPort())\n    streamersMapper.SetScalarRange(scalarRange)\n\n    lines = vtkActor()\n    lines.SetMapper(streamersMapper)\n    lines.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    aren.TwoSidedLightingOn()\n\n    aren.AddActor(outline)\n    aren.AddActor(door)\n    aren.AddActor(window1)\n    aren.AddActor(window2)\n    aren.AddActor(klower1)\n    aren.AddActor(klower2)\n    aren.AddActor(klower3)\n    aren.AddActor(klower4)\n    aren.AddActor(klower5)\n    aren.AddActor(klower6)\n    aren.AddActor(klower7)\n    aren.AddActor(hood1)\n    aren.AddActor(hood2)\n    aren.AddActor(hood3)\n    aren.AddActor(hood4)\n    aren.AddActor(hood6)\n    aren.AddActor(cookingPlate)\n    aren.AddActor(sgfilter)\n    aren.AddActor(lines)\n    aren.AddActor(rake)\n\n    aren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    aCamera = vtkCamera()\n    aren.SetActiveCamera(aCamera)\n    aren.ResetCamera()\n\n    aCamera.SetFocalPoint(3.505, 2.505, 1.255)\n    aCamera.SetPosition(3.505, 24.6196, 1.255)\n    aCamera.SetViewUp(0, 0, 1)\n    aCamera.Azimuth(60)\n    aCamera.Elevation(30)\n    aCamera.Dolly(1.4)\n    aren.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 512)\n    renWin.Render()\n    renWin.SetWindowName('Kitchen')\n\n    # interact with data\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Flow velocity computed for a small kitchen (top and side view).'\n    epilogue = '''\n    Forty streamlines start along the rake positioned under the window.\n    Some eventually travel over the hot stove and are convected upwards.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='kitchen.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/KochSnowflake/","title":"KochSnowflake","text":"

vtk-examples/Python/Visualization/KochSnowflake

"},{"location":"Python/Visualization/KochSnowflake/#description","title":"Description","text":"

This demo uses recursion to represent a Koch snowflake fractal. For more information about this fractal, there are many resources on the web: http://en.wikipedia.org/wiki/Koch_snowflake, http://mathworld.wolfram.com/KochSnowflake.html.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/KochSnowflake/#code","title":"Code","text":"

KochSnowflake.py

#!/usr/bin/env python\n\nfrom math import pi, cos, sin, sqrt\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkIntArray,\n    vtkLookupTable,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine,\n    vtkTriangle\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\nLEVEL = 6\n\n\ndef as_polyline(points, level):\n    '''\n    Koch Snowflake as a vtkPolyLine\n    '''\n    # Use the points from the previous iteration to create the points of the next\n    # level. There is an assumption on my part that the curve is traversed in a\n    # counterclockwise fashion. If the initial triangle above is written to\n    # describe clockwise motion, the points will face inward instead of outward.\n    for i in range(level):\n        temp = vtkPoints()\n        # The first point of the previous vtkPoints is the first point of the next vtkPoints.\n        temp.InsertNextPoint(*points.GetPoint(0))\n\n        # Iterate over 'edges' in the vtkPoints\n        for i in range(1, points.GetNumberOfPoints()):\n            x0, y0, z0 = points.GetPoint(i - 1)\n            x1, y1, z1 = points.GetPoint(i)\n            t = sqrt((x1 - x0) ** 2 + (y1 - y0) ** 2)\n            nx = (x1 - x0) / t  # x-component of edge unit tangent\n            ny = (y1 - y0) / t  # y-component of edge unit tangent\n\n            # the points describing the Koch snowflake edge\n            temp.InsertNextPoint(x0 + nx * t / 3, y0 + ny * t / 3, 0.)\n            temp.InsertNextPoint(x0 + nx * t / 2 + ny * t * sqrt(3) / 6, y0 + ny * t / 2 - nx * t * sqrt(3) / 6, 0.)\n            temp.InsertNextPoint(x0 + nx * 2 * t / 3, y0 + ny * 2 * t / 3, 0.)\n            temp.InsertNextPoint(x0 + nx * t, y0 + ny * t, 0.)\n\n        points = temp\n\n    # draw the outline\n    lines = vtkCellArray()\n    pl = vtkPolyLine()\n    pl.GetPointIds().SetNumberOfIds(points.GetNumberOfPoints())\n    for i in range(points.GetNumberOfPoints()):\n        pl.GetPointIds().SetId(i, i)\n    lines.InsertNextCell(pl)\n\n    # complete the polydata\n    polydata = vtkPolyData()\n    polydata.SetLines(lines)\n    polydata.SetPoints(points)\n\n    return polydata\n\n\ndef as_triangles(indices, cellarray, level, data):\n    '''\n    Koch Snowflake as a collection of vtkTriangles\n    '''\n    if len(indices) >= 3:\n        stride = len(indices) // 4\n        indices.append(indices[-1] + 1)\n\n        triangle = vtkTriangle()\n        triangle.GetPointIds().SetId(0, indices[stride])\n        triangle.GetPointIds().SetId(1, indices[2 * stride])\n        triangle.GetPointIds().SetId(2, indices[3 * stride])\n\n        cellarray.InsertNextCell(triangle)\n        data.InsertNextValue(level)\n\n        as_triangles(indices[0: stride], cellarray, level + 1, data)\n        as_triangles(indices[stride: 2 * stride], cellarray, level + 1, data)\n        as_triangles(indices[2 * stride: 3 * stride], cellarray, level + 1, data)\n        as_triangles(indices[3 * stride: -1], cellarray, level + 1, data)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Initially, set up the points to be an equilateral triangle. Note that the\n    # first point is the same as the last point to make this a closed curve when\n    # I create the vtkPolyLine.\n    points = vtkPoints()\n    for i in range(4):\n        points.InsertNextPoint(cos(2.0 * pi * i / 3), sin(2 * pi * i / 3.0), 0.0)\n\n    outline_pd = as_polyline(points, LEVEL)\n    # You have already gone through the trouble of putting the points in the\n    # right places - so 'all' you need to do now is to create polygons from the\n    # points that are in the vtkPoints.\n\n    # The points that are passed in, have an overlap of the beginning and the\n    # end. For this next trick, I will need a list of the indices in the\n    # vtkPoints. They're consecutive, so thats pretty straightforward.\n\n    indices = [i for i in range(outline_pd.GetPoints().GetNumberOfPoints() + 1)]\n    triangles = vtkCellArray()\n\n    # Set this up for each of the initial sides, then call the recursive function.\n    stride = (len(indices) - 1) // 3\n\n    # The cell data will allow us to color the triangles based on the level of\n    # the iteration of the Koch snowflake.\n    data = vtkIntArray()\n    data.SetNumberOfComponents(0)\n    data.SetName('Iteration Level')\n\n    # This is the starting triangle.\n    t = vtkTriangle()\n    t.GetPointIds().SetId(0, 0)\n    t.GetPointIds().SetId(1, stride)\n    t.GetPointIds().SetId(2, 2 * stride)\n    triangles.InsertNextCell(t)\n    data.InsertNextValue(0)\n\n    as_triangles(indices[0: stride + 1], triangles, 1, data)\n    as_triangles(indices[stride: 2 * stride + 1], triangles, 1, data)\n    as_triangles(indices[2 * stride: -1], triangles, 1, data)\n\n    triangle_pd = vtkPolyData()\n    triangle_pd.SetPoints(outline_pd.GetPoints())\n    triangle_pd.SetPolys(triangles)\n    triangle_pd.GetCellData().SetScalars(data)\n\n    # ---------------- #\n    # rendering stuff  #\n    # ---------------- #\n    outline_mapper = vtkPolyDataMapper()\n    outline_mapper.SetInputData(outline_pd)\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(256)\n    lut.SetHueRange(0.6, 0.6)\n    lut.SetSaturationRange(0.0, 1.0)\n    lut.Build()\n\n    triangle_mapper = vtkPolyDataMapper()\n    triangle_mapper.SetInputData(triangle_pd)\n    triangle_mapper.SetScalarRange(0.0, LEVEL)\n    triangle_mapper.SetLookupTable(lut)\n\n    outline_actor = vtkActor()\n    outline_actor.SetMapper(outline_mapper)\n\n    triangle_actor = vtkActor()\n    triangle_actor.SetMapper(triangle_mapper)\n\n    outline_ren = vtkRenderer()\n    outline_ren.AddActor(outline_actor)\n    outline_ren.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    triangle_ren = vtkRenderer()\n    triangle_ren.AddActor(triangle_actor)\n    triangle_ren.SetViewport(0.5, 0.0, 1.0, 1.0)\n    triangle_ren.SetActiveCamera(outline_ren.GetActiveCamera())\n\n    renw = vtkRenderWindow()\n    renw.AddRenderer(outline_ren)\n    renw.AddRenderer(triangle_ren)\n    renw.SetSize(800, 400)\n    renw.SetWindowName('KochSnowflake')\n\n    outline_ren.SetBackground(colors.GetColor3d('CornFlowerBLue'))\n    triangle_ren.SetBackground(colors.GetColor3d('MistyRose'))\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renw)\n\n    outline_ren.ResetCamera()\n    renw.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/LoopShrink/","title":"LoopShrink","text":"

vtk-examples/Python/Visualization/LoopShrink

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/LoopShrink/#code","title":"Code","text":"

LoopShrink.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n    renderer.GetCullers().RemoveAllItems()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(12)\n    sphere.SetPhiResolution(12)\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(sphere.GetOutputPort())\n    shrink.SetShrinkFactor(0.9)\n\n    colorIt = vtkElevationFilter()\n    colorIt.SetInputConnection(shrink.GetOutputPort())\n    colorIt.SetLowPoint(0, 0, -.5)\n    colorIt.SetHighPoint(0, 0, .5)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(colorIt.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('LavenderBlush'))\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName('LoopShrink')\n\n    renWin.Render()\n\n    renderer.GetActiveCamera().Zoom(1.5)\n\n    #  Interact with the data.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/Lorenz/","title":"Lorenz","text":"

vtk-examples/Python/Visualization/Lorenz

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/Lorenz/#code","title":"Code","text":"

Lorenz.py

#!/usr/bin/env python\n\n\"\"\"\nCreate an iso-surface of the Lorenz attractor.\n\nHere we visualize a Lorenz strange attractor by integrating the Lorenz equations in a volume.\nThe number of visits in each voxel is recorded as a scalar function.\nThe surface is extracted via marching cubes using a visit value of 50.\nThe number of integration steps is 10 million, in a volume of dimensions 200 x 200 x 200.\nThe surface roughness is caused by the discrete nature of the evaluation function.\n\n\"\"\"\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkShortArray\n)\nfrom vtkmodules.vtkCommonDataModel import vtkStructuredPoints\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    Pr = 10.0  # The Lorenz parameters\n    b = 2.667\n    r = 28.0\n    # x = 0.0\n    # y = 0.0\n    # z = 0.0  # starting (and current) x, y, z\n    h = 0.01  # integration step size\n    resolution = 200  # slice resolution\n    iterations = 10000000  # number of iterations\n    xmin = -30.0  # x, y, z range for voxels\n    xmax = 30.0\n    ymin = -30.0\n    ymax = 30.0\n    zmin = -10.0\n    zmax = 60.0\n\n    # Take a stab at an integration step size.\n    xIncr = resolution / (xmax - xmin)\n    yIncr = resolution / (ymax - ymin)\n    zIncr = resolution / (zmax - zmin)\n\n    print('The Lorenz Attractor\\n')\n    print(' Pr =', Pr)\n    print(' b =', b)\n    print(' r =', r)\n    print(' integration step size =', h)\n    print(' slice resolution =', resolution)\n    print(' # of iterations =', iter)\n    print(' specified range:')\n    print('     x: {:f}, {:f}'.format(xmin, xmax))\n    print('     y: {:f}, {:f}'.format(ymin, ymax))\n    print('     z: {:f}, {:f}'.format(zmin, zmax))\n\n    randomSequence = vtkMinimalStandardRandomSequence()\n    randomSequence.SetSeed(8775070)\n    x = randomSequence.GetRangeValue(xmin, xmax)\n    randomSequence.Next()\n    y = randomSequence.GetRangeValue(ymin, ymax)\n    randomSequence.Next()\n    z = randomSequence.GetRangeValue(zmin, zmax)\n    randomSequence.Next()\n    print(' starting at {:f}, {:f}, {:f}'.format(x, y, z))\n    # allocate memory for the slices\n    sliceSize = resolution * resolution\n    numPts = sliceSize * resolution\n    scalars = vtkShortArray()\n    for i in range(0, numPts):\n        scalars.InsertTuple1(i, 0)\n    for j in range(0, iterations):\n        # Integrate to the next time step.\n        xx = x + h * Pr * (y - x)\n        yy = y + h * (x * (r - z) - y)\n        zz = z + h * (x * y - (b * z))\n\n        x = xx\n        y = yy\n        z = zz\n\n        # Calculate the voxel index.\n        if xmax > x > xmin and ymax > y > ymin and zmax > z > zmin:\n            xxx = int(float(xx - xmin) * xIncr)\n            yyy = int(float(yy - ymin) * yIncr)\n            zzz = int(float(zz - zmin) * zIncr)\n            index = xxx + yyy * resolution + zzz * sliceSize\n            scalars.SetTuple1(index, scalars.GetTuple1(index) + 1)\n\n    volume = vtkStructuredPoints()\n    volume.GetPointData().SetScalars(scalars)\n    volume.SetDimensions(resolution, resolution, resolution)\n    volume.SetOrigin(xmin, ymin, zmin)\n    volume.SetSpacing((xmax - xmin) / resolution, (ymax - ymin) / resolution, (zmax - zmin) / resolution)\n\n    print(' contouring...')\n    # Do the graphics dance.\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create iso-surface\n    contour = vtkContourFilter()\n    contour.SetInputData(volume)\n    contour.SetValue(0, 50)\n\n    # Create mapper.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(contour.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Create actor.\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('DodgerBlue'))\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('PaleGoldenrod'))\n\n    renWin.SetSize(640, 480)\n\n    # interact with data\n    renWin.Render()\n    renWin.SetWindowName('Lorenz')\n\n    camera = renderer.GetActiveCamera()\n    camera.SetPosition(-67.645167, -25.714343, 63.483516)\n    camera.SetFocalPoint(3.224902, -4.398594, 29.552112)\n    camera.SetViewUp(-0.232264, 0.965078, 0.121151)\n    camera.SetDistance(81.414176)\n    camera.SetClippingRange(18.428905, 160.896031)\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/MultipleRenderWindows/","title":"MultipleRenderWindows","text":"

vtk-examples/Python/Visualization/MultipleRenderWindows

"},{"location":"Python/Visualization/MultipleRenderWindows/#description","title":"Description","text":"

This example creates four render windows. Three of the windows will close individually and closing one window will close all the others. Guess which one!

You can also press 'q' or 'e' to close a window.

If the parameter 's' (C++) or '-s (Python) is specified, then updating the camera position in one window will also update the position in the other windows. Pressing 'q' or 'e' closes all windows. Note that in this mode you must use 'q' or 'e' to close the windows.

Note

The image you see here is the test image. When you run this program you will see an image similar to MultipleViewports however each object will be in a separate window.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/MultipleRenderWindows/#code","title":"Code","text":"

MultipleRenderWindows.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkCylinderSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Display multiple render windows.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-s', default=False, action='store_true',\n                        help='Simultaneous camera position updating.')\n    args = parser.parse_args()\n    return args.s\n\n\ndef main():\n    simultaneous_update = get_program_parameters()\n\n    colors = vtkNamedColors()\n    # Have some fun with colors\n    ren_bkg = ['AliceBlue', 'GhostWhite', 'WhiteSmoke', 'Seashell']\n    actor_color = ['Bisque', 'RosyBrown', 'Goldenrod', 'Chocolate']\n\n    # Window sizes and spacing.\n    width = 300\n    height = 300\n    # Add extra space around each window.\n    dx = 20\n    dy = 40\n    w = width + dx\n    h = height + dy\n\n    interactors = list()\n    running = [True, True, True, True]\n\n    camera = None\n    sources = get_sources()\n\n    kpis = list()\n    for i in range(0, 4):\n        ren_win = vtkRenderWindow()\n        ren_win.SetSize(width, height)\n\n        renderer = vtkRenderer()\n\n        # Share the camera between viewports.\n        if i == 0:\n            camera = renderer.GetActiveCamera()\n            camera.Azimuth(30)\n            camera.Elevation(30)\n        else:\n            renderer.SetActiveCamera(camera)\n\n        ren_win.AddRenderer(renderer)\n\n        iren = vtkRenderWindowInteractor()\n\n        interactors.append(iren)\n\n        iren.SetRenderWindow(ren_win)\n        ren_win.Render()\n        ren_win.SetWindowName('MultipleRenderWindows {:d}'.format(i))\n        ren_win.SetPosition((i % 2) * w, h - (i // 2) * h)\n\n        # Create a mapper and actor.\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(sources[i].GetOutputPort())\n\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n        actor.GetProperty().SetColor(colors.GetColor3d(actor_color[i]))\n\n        renderer.AddActor(actor)\n        renderer.SetBackground(colors.GetColor3d(ren_bkg[i]))\n\n        renderer.ResetCamera()\n\n        running[i] = True\n        kpis.append(KeyPressInteractorStyle(parent=iren))\n        interactors[i].SetInteractorStyle(kpis[i])\n        kpis[i].status = running[i]\n\n    if simultaneous_update:\n        interactors[0].Initialize()\n        while all(x is True for x in running):\n            for i in range(0, 4):\n                running[i] = kpis[i].status\n                if running[i]:\n                    interactors[i].ProcessEvents()\n                    interactors[i].Render()\n                else:\n                    interactors[i].TerminateApp()\n                    print('Window', i, 'has stopped running.')\n    else:\n        interactors[0].Start()\n\n\ndef get_sources():\n    sources = list()\n\n    # Create a sphere\n    sphere = vtkSphereSource()\n    sphere.SetCenter(0.0, 0.0, 0.0)\n    sphere.Update()\n    sources.append(sphere)\n    # Create a cone\n    cone = vtkConeSource()\n    cone.SetCenter(0.0, 0.0, 0.0)\n    cone.SetDirection(0, 1, 0)\n    cone.Update()\n    sources.append(cone)\n    # Create a cube\n    cube = vtkCubeSource()\n    cube.SetCenter(0.0, 0.0, 0.0)\n    cube.Update()\n    sources.append(cube)\n    # Create a cylinder\n    cylinder = vtkCylinderSource()\n    cylinder.SetCenter(0.0, 0.0, 0.0)\n    cylinder.Update()\n    sources.append(cylinder)\n\n    return sources\n\n\nclass KeyPressInteractorStyle(vtkInteractorStyleTrackballCamera):\n\n    def __init__(self, parent=None, status=True):\n        self.parent = vtkRenderWindowInteractor()\n        self.status = status\n        if parent is not None:\n            self.parent = parent\n\n        self.AddObserver('KeyPressEvent', self.key_press_event)\n\n    def key_press_event(self, obj, event):\n        key = self.parent.GetKeySym().lower()\n        if key == 'e' or key == 'q':\n            self.status = False\n        return\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/MultipleViewports/","title":"MultipleViewports","text":"

vtk-examples/Python/Visualization/MultipleViewports

"},{"location":"Python/Visualization/MultipleViewports/#description","title":"Description","text":"

This example creates a window with 4 viewports. Updating the camera position in one viewport will also update the position in the other viewports.

See MultipleRenderWindows for an example using multiple windows.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/MultipleViewports/#code","title":"Code","text":"

MultipleViewports.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkCylinderSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # One render window, multiple viewports.\n    rw = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(rw)\n\n    # Define viewport ranges.\n    xmins = [0, .5, 0, .5]\n    xmaxs = [0.5, 1, 0.5, 1]\n    ymins = [0, 0, .5, .5]\n    ymaxs = [0.5, 0.5, 1, 1]\n\n    # Have some fun with colors.\n    ren_bkg = ['AliceBlue', 'GhostWhite', 'WhiteSmoke', 'Seashell']\n    actor_color = ['Bisque', 'RosyBrown', 'Goldenrod', 'Chocolate']\n\n    sources = get_sources()\n    for i in range(4):\n        ren = vtkRenderer()\n        rw.AddRenderer(ren)\n        ren.SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i])\n\n        # Share the camera between viewports.\n        if i == 0:\n            camera = ren.GetActiveCamera()\n            camera.Azimuth(30)\n            camera.Elevation(30)\n        else:\n            ren.SetActiveCamera(camera)\n\n        # Create a mapper and actor\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(sources[i].GetOutputPort())\n        actor = vtkActor()\n        actor.GetProperty().SetColor(colors.GetColor3d(actor_color[i]))\n        actor.SetMapper(mapper)\n        ren.AddActor(actor)\n        ren.SetBackground(colors.GetColor3d(ren_bkg[i]))\n\n        ren.ResetCamera()\n\n    rw.Render()\n    rw.SetWindowName('MultipleViewPorts')\n    rw.SetSize(600, 600)\n    iren.Start()\n\n\ndef get_sources():\n    sources = list()\n\n    # Create a sphere\n    sphere = vtkSphereSource()\n    sphere.SetCenter(0.0, 0.0, 0.0)\n    sphere.Update()\n    sources.append(sphere)\n    # Create a cone\n    cone = vtkConeSource()\n    cone.SetCenter(0.0, 0.0, 0.0)\n    cone.SetDirection(0, 1, 0)\n    cone.Update()\n    sources.append(cone)\n    # Create a cube\n    cube = vtkCubeSource()\n    cube.SetCenter(0.0, 0.0, 0.0)\n    cube.Update()\n    sources.append(cube)\n    # Create a cylinder\n    cylinder = vtkCylinderSource()\n    cylinder.SetCenter(0.0, 0.0, 0.0)\n    cylinder.Update()\n    sources.append(cylinder)\n\n    return sources\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/NamedColorPatches/","title":"NamedColorPatches","text":"

vtk-examples/Python/Visualization/NamedColorPatches

"},{"location":"Python/Visualization/NamedColorPatches/#description","title":"Description","text":"

This example shows how to produce a HTML page called VTKNamedColorPatches showing the available colors in vtkNamedColors.

It also shows how to select the text color based on luminance. In this case, Digital CCIR601 is used, which gives less weight to the red and blue components of a color.

In the class HTMLTableMaker there are four methods for generating HTML pages:

  • MakeCombinedColorPage() -- Makes an indexed page with all the colors and names in the class vtkNamedColors (the default).
  • MakeWebColorPage() -- Makes a page of just the colors and names known to Web Browsers.
  • MakeVTKColorPage() -- Makes a page of colors and names corresponding to to additional colors commonly used in VTK.
  • MakeSynonymColorPage() -- Makes a page of color names and their synonyms.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/NamedColorPatches/#code","title":"Code","text":"

NamedColorPatches.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nProduce a HTML page called VTKNamedColorPatches.html showing the available\n colors in vtkNamedColors.\n\nIt also shows how to select the text color based on luminance.\nIn this case Digital CCIR601 is used which gives less weight to the\n red and blue components of a color.\n\n\"\"\"\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\n\n\ndef main():\n    ncp = HTMLTableMaker()\n    res = ncp.MakeCombinedColorPage()\n    # res = ncp.MakeWebColorPage()\n    # res = ncp.MakeVTKColorPage()\n    # res = ncp.MakeSynonymColorPage()\n    f = open(\"VTKNamedColorPatches.html\", \"w\", newline=\"\\n\")\n    f.write(res)\n    f.close()\n\n\nclass HTMLToFromRGBAColor:\n\n    @staticmethod\n    def RGBToHTMLColor(rgb):\n        \"\"\"\n        Convert an [R, G, B] list to #RRGGBB.\n        :param: rgb - The elements of the array rgb are unsigned chars (0..255).\n        :return: The html color.\n        \"\"\"\n        hexcolor = \"#\" + ''.join(['{:02x}'.format(x) for x in rgb])\n        return hexcolor\n\n    @staticmethod\n    def HTMLColorToRGB(colorString):\n        \"\"\"\n        Convert #RRGGBB to a [R, G, B] list.\n        :param: colorString a string in the form: #RRGGBB where RR, GG, BB are hexadecimal.\n        The elements of the array rgb are unsigned chars (0..255).\n        :return: The red, green and blue components as a list.\n        \"\"\"\n        colorString = colorString.strip()\n        if colorString[0] == '#':\n            colorString = colorString[1:]\n        if len(colorString) != 6:\n            raise ValueError(\"Input #%s is not in #RRGGBB format\" % colorString)\n        r, g, b = colorString[:2], colorString[2:4], colorString[4:]\n        r, g, b = [int(n, 16) for n in (r, g, b)]\n        return [r, g, b]\n\n    @staticmethod\n    def RGBToLumaCCIR601(rgb):\n        \"\"\"\n        RGB -> Luma conversion\n        Digital CCIR601 (gives less weight to the R and B components)\n        :param: rgb - The elements of the array rgb are unsigned chars (0..255).\n        :return: The luminance.\n        \"\"\"\n        Y = 0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]\n        return Y\n\n    @staticmethod\n    def FormatRGBForHTML(rgb):\n        \"\"\"\n        Format the rgb colors for display on a html table.\n        :param: rgb - The elements of the array rgb are unsigned chars (0..255).\n        :return: A formatted string for the html table.\n        \"\"\"\n        s = ','.join(['{:3d}'.format(x) for x in rgb])\n        s = s.replace(' ', '&#160;')\n        s = s.replace(',', '&#160;&#160;')\n        return s\n\n\nclass ColorStructures:\n    \"\"\"\n    Holds the color names, grouped by color class, and information about table\n    layout and ordering.\n    \"\"\"\n\n    def __init__(self):\n        self.cn = {\n            'Red': ['IndianRed', 'LightCoral', 'Salmon', 'DarkSalmon',\n                    'LightSalmon', 'Red', 'Crimson', 'FireBrick', 'DarkRed'],\n            'Pink': ['Pink', 'LightPink', 'HotPink', 'DeepPink',\n                     'MediumVioletRed', 'PaleVioletRed'],\n            'Orange': ['LightSalmon', 'Coral', 'Tomato', 'OrangeRed',\n                       'DarkOrange', 'Orange'],\n            'Yellow': ['Gold', 'Yellow', 'LightYellow', 'LemonChiffon',\n                       'LightGoldenrodYellow', 'PapayaWhip', 'Moccasin',\n                       'PeachPuff', 'PaleGoldenrod', 'Khaki', 'DarkKhaki'],\n            'Purple': ['Lavender', 'Thistle', 'Plum', 'Violet', 'Orchid',\n                       'Fuchsia', 'Magenta', 'MediumOrchid', 'MediumPurple',\n                       'BlueViolet', 'DarkViolet', 'DarkOrchid', 'DarkMagenta',\n                       'Purple', 'Indigo', 'DarkSlateBlue', 'SlateBlue',\n                       'MediumSlateBlue'],\n            'Green': ['GreenYellow', 'Chartreuse', 'LawnGreen', 'Lime',\n                      'LimeGreen', 'PaleGreen', 'LightGreen',\n                      'MediumSpringGreen', 'SpringGreen', 'MediumSeaGreen',\n                      'SeaGreen', 'ForestGreen', 'Green', 'DarkGreen',\n                      'YellowGreen', 'OliveDrab', 'Olive', 'DarkOliveGreen',\n                      'MediumAquamarine', 'DarkSeaGreen', 'LightSeaGreen',\n                      'DarkCyan', 'Teal'],\n            'Blue/Cyan': ['Aqua', 'Cyan', 'LightCyan', 'PaleTurquoise',\n                          'Aquamarine', 'Turquoise', 'MediumTurquoise',\n                          'DarkTurquoise', 'CadetBlue', 'SteelBlue',\n                          'LightSteelBlue', 'PowderBlue', 'LightBlue',\n                          'SkyBlue', 'LightSkyBlue', 'DeepSkyBlue',\n                          'DodgerBlue', 'CornflowerBlue', 'RoyalBlue', 'Blue',\n                          'MediumBlue', 'DarkBlue', 'Navy', 'MidnightBlue'],\n            'Brown': ['Cornsilk', 'BlanchedAlmond', 'Bisque', 'NavajoWhite',\n                      'Wheat', 'BurlyWood', 'Tan', 'RosyBrown', 'SandyBrown',\n                      'Goldenrod', 'DarkGoldenrod', 'Peru', 'Chocolate',\n                      'SaddleBrown', 'Sienna', 'Brown', 'Maroon'],\n            'White': ['White', 'Snow', 'Honeydew', 'MintCream', 'Azure',\n                      'AliceBlue', 'GhostWhite', 'WhiteSmoke', 'Seashell',\n                      'Beige', 'OldLace', 'FloralWhite', 'Ivory',\n                      'AntiqueWhite', 'Linen',\n                      'LavenderBlush', 'MistyRose'],\n            'Gray': ['Gainsboro', 'LightGrey', 'Silver', 'DarkGray', 'Gray',\n                     'DimGray', 'LightSlateGray', 'SlateGray', 'DarkSlateGray',\n                     'Black']\n        }\n        # Ordering of the tables and when to start and end a column of tables\n        # in the layout.\n        self.cnOrder = ['Red', 'Pink', 'Orange', 'Yellow', 'Purple', 'Green',\n                        'Blue/Cyan', 'Brown', 'White', 'Gray']\n        self.cnStartTable = ['Red', 'Green', 'Brown']\n        self.cnEndTable = ['Purple', 'Blue/Cyan', 'Gray']\n\n        self.vtkcn = {\n            'Whites': ['antique_white', 'azure', 'bisque', 'blanched_almond',\n                       'cornsilk', 'eggshell', 'floral_white', 'gainsboro',\n                       'ghost_white', 'honeydew', 'ivory', 'lavender',\n                       'lavender_blush', 'lemon_chiffon', 'linen', 'mint_cream',\n                       'misty_rose', 'moccasin', 'navajo_white', 'old_lace',\n                       'papaya_whip', 'peach_puff', 'seashell', 'snow',\n                       'thistle', 'titanium_white', 'wheat', 'white',\n                       'white_smoke', 'zinc_white'],\n            'Greys': ['cold_grey', 'dim_grey', 'grey', 'light_grey',\n                      'slate_grey', 'slate_grey_dark', 'slate_grey_light',\n                      'warm_grey'],\n            'Blacks': ['black', 'ivory_black', 'lamp_black'],\n            'Reds': ['alizarin_crimson', 'brick', 'cadmium_red_deep', 'coral',\n                     'coral_light', 'deep_pink', 'english_red', 'firebrick',\n                     'geranium_lake', 'hot_pink', 'indian_red', 'light_salmon',\n                     'madder_lake_deep', 'maroon', 'pink', 'pink_light',\n                     'raspberry', 'red', 'rose_madder', 'salmon', 'tomato',\n                     'venetian_red'],\n            'Browns': ['beige', 'brown', 'brown_madder', 'brown_ochre',\n                       'burlywood', 'burnt_sienna', 'burnt_umber', 'chocolate',\n                       'deep_ochre', 'flesh', 'flesh_ochre', 'gold_ochre',\n                       'greenish_umber', 'khaki', 'khaki_dark', 'light_beige',\n                       'peru', 'rosy_brown', 'raw_sienna', 'raw_umber', 'sepia',\n                       'sienna', 'saddle_brown', 'sandy_brown', 'tan',\n                       'van_dyke_brown'],\n            'Oranges': ['cadmium_orange', 'cadmium_red_light', 'carrot',\n                        'dark_orange', 'mars_orange', 'mars_yellow', 'orange',\n                        'orange_red', 'yellow_ochre'],\n            'Yellows': ['aureoline_yellow', 'banana', 'cadmium_lemon',\n                        'cadmium_yellow', 'cadmium_yellow_light', 'gold',\n                        'goldenrod', 'goldenrod_dark', 'goldenrod_light',\n                        'goldenrod_pale', 'light_goldenrod', 'melon',\n                        'naples_yellow_deep', 'yellow', 'yellow_light'],\n            'Greens': ['chartreuse', 'chrome_oxide_green', 'cinnabar_green',\n                       'cobalt_green', 'emerald_green', 'forest_green', 'green',\n                       'green_dark', 'green_pale', 'green_yellow', 'lawn_green',\n                       'lime_green', 'mint', 'olive', 'olive_drab',\n                       'olive_green_dark', 'permanent_green', 'sap_green',\n                       'sea_green', 'sea_green_dark', 'sea_green_medium',\n                       'sea_green_light', 'spring_green', 'spring_green_medium',\n                       'terre_verte', 'viridian_light', 'yellow_green'],\n            'Cyans': ['aquamarine', 'aquamarine_medium', 'cyan', 'cyan_white',\n                      'turquoise', 'turquoise_dark', 'turquoise_medium',\n                      'turquoise_pale'],\n            'Blues': ['alice_blue', 'blue', 'blue_light', 'blue_medium',\n                      'cadet', 'cobalt', 'cornflower', 'cerulean', 'dodger_blue',\n                      'indigo', 'manganese_blue', 'midnight_blue', 'navy',\n                      'peacock', 'powder_blue', 'royal_blue', 'slate_blue',\n                      'slate_blue_dark', 'slate_blue_light',\n                      'slate_blue_medium', 'sky_blue', 'sky_blue_deep',\n                      'sky_blue_light', 'steel_blue', 'steel_blue_light',\n                      'turquoise_blue', 'ultramarine'],\n            'Magentas': ['blue_violet', 'cobalt_violet_deep', 'magenta',\n                         'orchid', 'orchid_dark', 'orchid_medium',\n                         'permanent_red_violet', 'plum', 'purple',\n                         'purple_medium', 'ultramarine_violet', 'violet',\n                         'violet_dark', 'violet_red', 'violet_red_medium',\n                         'violet_red_pale']\n        }\n        # Ordering of the tables and when to start and end a column of tables\n        # in the layout.\n        self.vtkcnOrder = ['Whites', 'Greys', 'Blacks', 'Reds', 'Oranges', 'Browns', 'Yellows', 'Greens', 'Cyans',\n                           'Blues',\n                           'Magentas']\n        self.vtkcnStartTable = ['Whites', 'Browns', 'Cyans']\n        self.vtkcnEndTable = ['Oranges', 'Greens', 'Magentas']\n\n\nclass HTMLTableMaker:\n    \"\"\"\n      This class creates HTML Tables displaying all the colors in\n      the class vtkNamedColors grouped by various categories.\n    \"\"\"\n\n    def __init__(self):\n        self.cs = ColorStructures()\n        self.nc = vtkNamedColors()\n        self.htmlRGBA = HTMLToFromRGBAColor()\n\n    @staticmethod\n    def MakeHTMLStyle():\n        s = '  <style>\\n'\n        s += '  \\n'\n        s += '  body {\\n'\n        s += '    background-color: snow\\n'\n        s += '  }\\n'\n        s += '  h1 {text-align:left;}\\n'\n        s += '  h2 {text-align:left;}\\n'\n        s += '  h3 {text-align:left;}\\n'\n        s += '  h4 {text-align:left;}\\n'\n        s += '  h5 {text-align:left;}\\n'\n        s += '  h6 {text-align:left;}\\n'\n        s += '  \\n'\n        s += '  p {text-align:left;}\\n'\n        s += '  \\n'\n        s += '  table {\\n'\n        s += '    font-family: arial, sans-serif;\\n'\n        s += '    border-collapse: collapse;\\n'\n        s += '    font-size: medium;\\n'\n        s += '    padding: 4px;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  th[colspan]:not([colspan=\"1\"]) {\\n'\n        s += '    background: LightSteelBlue;\\n'\n        s += '    font-size: x-large;\\n'\n        s += '    text-align : center;'\n        s += '    vertical-align : top;\\n'\n        s += '  }\\n'\n        s += '  th {\\n'\n        s += '    background: LightSteelBlue;\\n'\n        s += '  }\\n'\n        s += '  td, th {\\n'\n        s += '    border: 1px solid #dddddd;\\n'\n        s += '    text-align: left;\\n'\n        s += '    padding: 8px;\\n'\n        s += '    font-family: monospace;\\n'\n        s += '    font-size: medium;\\n'\n        s += '    font-weight: bold;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  tr {\\n'\n        s += '    background: WhiteSmoke;\\n'\n        s += '    vertical-align : top;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  td[colspan]:not([colspan=\"1\"]) {\\n'\n        s += '    background: MintCream;\\n'\n        s += '    font-size: large;\\n'\n        s += '    text-align : center;'\n        s += '    vertical-align : top;\\n'\n        s += '  }\\n'\n        s += '  td {\\n'\n        s += '    background: WhiteSmoke;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  .cour {\\n'\n        s += '    font-family: Courier;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  html, body {\\n'\n        s += '    height: 100%;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  html {\\n'\n        s += '    display: table;\\n'\n        s += '    margin: auto;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  body {\\n'\n        s += '    display: table-cell;\\n'\n        s += '    vertical-align: middle;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  thead {color: DarkGreen;}\\n'\n        s += '  tbody {color: MidnightBlue;}\\n'\n        s += '  tfoot {color: SaddleBrown;}\\n'\n        s += '\\n'\n        s += '  </style>\\n'\n        return s\n\n    @staticmethod\n    def MakeHTMLHeader():\n        s = '<!DOCTYPE html>\\n'\n        s += '<html lang=\"en\">\\n'\n        s += '<head>\\n'\n        s += '<meta charset=\"UTF-8\" />\\n'\n        s += '<title>vtkNamedColors</title>\\n'\n        s += HTMLTableMaker.MakeHTMLStyle()\n        s += '</head>\\n'\n        return s\n\n    @staticmethod\n    def MakeHTMLIndex():\n        s = '<h2>Index</h2>\\n'\n        s += '<ul>\\n'\n        s += '\\t<li><a href=\"#WebColorNames\">Web color Names</a>'\n        s += ' These colors correspond to those in'\n        s += ' <a href=\"http://en.wikipedia.org/wiki/Web_colors\"'\n        s += ' title=\"Web Colors\">Web Colors</a>.\\n'\n        s += '</li>\\n'\n        s += '\\t<li><a href=\"#VTKColorNames\">VTK color Names</a>\\n'\n        s += ' The colors correspond to additional colors commonly used in VTK.\\n'\n        s += '<br>The web colors take precedence over colors with\\n'\n        s += ' the same name (case insensitive) here.\\n'\n        s += '</li>\\n'\n        s += '\\t<li><a href=\"#Synonyms\">Synonyms</a></li>\\n'\n        s += '</ul>\\n'\n        return s\n\n    @staticmethod\n    def MakeTableHeader(title):\n        s = '<tr>\\n'\n        s += '<th>'\n        s += title\n        s += '</th>\\n'\n        s += '<th>Decimal code<br>\\n'\n        s += '&#160;&#160;R'\n        s += '&#160;&#160;&#160;&#160;G'\n        s += '&#160;&#160;&#160;&#160;B</th>\\n'\n        s += '</tr>\\n'\n        return s\n\n    @staticmethod\n    def MakeTD(name):\n        s = '<tr>\\n'\n        s += '<td colspan=\"2\">'\n        s += '<b>' + name + '</b>'\n        s += '</td>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def MakeTR(self, name, rgb, textColor):\n        \"\"\"\n          Use when the name is a color name known to the web browser.\n        \"\"\"\n        s = '<tr>\\n'\n        s += '<td style=\"background:' + name + ';color:' + textColor\n        s += '\">' + name + '</td>\\n'\n        s += '<td style=\"background:' + name + ';color:' + textColor\n        s += '\">' + self.htmlRGBA.FormatRGBForHTML(rgb) + '</td>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def MakeTR_HTML(self, name, htmlColor, rgb, textColor):\n        \"\"\"\n          Use when the name is not a color name known to the web browser.\n        \"\"\"\n        s = '<tr>\\n'\n        s += '<td style=\"background:' + htmlColor + ';color:'\n        s += textColor + '\">' + name + '</td>\\n'\n        s += '<td style=\"background:' + htmlColor + ';color:'\n        s += textColor + '\">' + self.htmlRGBA.FormatRGBForHTML(rgb) + '</td>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def FindLongestColorName(self):\n        \"\"\" Find the longest color name. \"\"\"\n        maxLength = -1\n        for key, value in self.cs.cn.items():\n            for val in value:\n                if len(val) > maxLength:\n                    maxLength = len(val)\n        for key, value in self.cs.vtkcn.items():\n            for val in value:\n                if len(val) > maxLength:\n                    maxLength = len(val)\n        return maxLength\n\n    def MakeWebColorTables(self):\n        res = ''\n        for key in self.cs.cnOrder:\n            if key in self.cs.cnStartTable:\n                res += '<td>\\n'\n                res += '<table>\\n'\n                res += self.MakeTableHeader('HTML name')\n            # Add in the name of the group in the color table.\n            res += self.MakeTD(key + ' colors')\n            values = self.cs.cn[key]\n            for name in values:\n                rgb = self.nc.GetColor3ub(name)\n                Y = self.htmlRGBA.RGBToLumaCCIR601(rgb)\n                textColor = '#000000'  # Black\n                if Y < 255 / 2.0:\n                    textColor = '#ffffff'  # White\n                # Make the row for each color in the group.\n                # Here we use the name to set the background color\n                #  as it is known to the web browser.\n                res += self.MakeTR(name, rgb, textColor)\n            if key in self.cs.cnEndTable:\n                res += '</table>\\n'\n                res += '</td>\\n'\n        return res\n\n    def MakeVTKColorTables(self):\n        res = ''\n        for key in self.cs.vtkcnOrder:\n            if key in self.cs.vtkcnStartTable:\n                res += '<td>\\n'\n                res += '<table>\\n'\n                res += self.MakeTableHeader('HTML name')\n            # Add in the name of the group in the color table.\n            res += self.MakeTD(key)\n            values = self.cs.vtkcn[key]\n            for name in values:\n                rgb = self.nc.GetColor3ub(name)\n                Y = self.htmlRGBA.RGBToLumaCCIR601(rgb)\n                textColor = '#000000'  # Black\n                if Y < 255 / 2.0:\n                    textColor = '#ffffff'  # White\n                # We must set the background color to a specific\n                # HTML color as the color name may not be a standard\n                # name known to the web browser.\n                htmlColor = self.htmlRGBA.RGBToHTMLColor(rgb)\n                # Make the row for each color in the group.\n                res += self.MakeTR_HTML(name, htmlColor, rgb, textColor)\n            if key in self.cs.vtkcnEndTable:\n                res += '</table>\\n'\n                res += '</td>\\n'\n        return res\n\n    def MakeSynonymColorTable(self):\n        syn = self.nc.GetSynonyms()\n        # Convert to a list where each element is a list of the\n        #  color and its synonyms.\n        syn = syn.split('\\n\\n')\n        synonyms = []\n        for ele in syn:\n            synonyms.append(ele.split('\\n'))\n        cn = list()\n        for key, value in self.cs.cn.items():\n            cn = cn + value\n        # Create a dictionary where the key is the lowercase name.\n        d = dict()\n        for n in cn:\n            d.update({n.lower(): n})\n        #  End point of first table.\n        end1 = len(synonyms) // 2\n        if end1 * 2 < len(synonyms):\n            end1 += 1\n        res = '<td>\\n'\n        res += '<table>\\n'\n        res += self.MakeTableHeader('Synonyms')\n        count = 0\n        for colorNames in synonyms:\n            if count == end1:\n                res += '</table>\\n'\n                res += '</td>\\n'\n                res += '<td>\\n'\n                res += '<table>\\n'\n                res += self.MakeTableHeader('Synonyms')\n            for idx, name in enumerate(colorNames):\n                if name in d:\n                    colorNames[idx] = d[name]\n            colorNames.sort()\n            name = \", \".join(colorNames)\n            rgb = self.nc.GetColor3ub(colorNames[0])\n            Y = self.htmlRGBA.RGBToLumaCCIR601(rgb)\n            textColor = '#000000'  # Black\n            if Y < 255 / 2.0:\n                textColor = '#ffffff'  # White\n            # We must set the background color to a specific\n            # HTML color  names is just a list of\n            # synonyms for that particular color.\n            htmlColor = self.htmlRGBA.RGBToHTMLColor(rgb)\n            # Make the row for each color in the group.\n            res += self.MakeTR_HTML(name, htmlColor, rgb, textColor)\n            count += 1\n        res += '</table>\\n'\n        res += '</td>\\n'\n        return res\n\n    def MakeWebColorPage(self):\n        res = self.MakeHTMLHeader()\n        res += '<body>\\n'\n        res += '<h1>Colors available in vtkNamedColors</h1>\\n'\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"3\">Web Color Names</th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeWebColorTables()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '</body>\\n'\n        return res\n\n    def MakeVTKColorPage(self):\n        res = self.MakeHTMLHeader()\n        res += '<body>\\n'\n        res += '<h1>Colors available in vtkNamedColors</h1>\\n'\n        res += 'The web colors take precedence over colors of the same'\n        res += ' name in VTK Color Names.\\n'\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"3\">VTK Color Names</th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeVTKColorTables()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '</body>\\n'\n        return res\n\n    def MakeSynonymColorPage(self):\n        res = self.MakeHTMLHeader()\n        res += '<body>\\n'\n        res += '<h1>Synonyms in vtkNamedColors</h1>\\n'\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"2\">Synonyms</th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeSynonymColorTable()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '</body>\\n'\n        return res\n\n    def MakeCombinedColorPage(self):\n        res = self.MakeHTMLHeader()\n        res += '<body>\\n'\n        res += '<h1>Colors available in vtkNamedColors</h1>\\n'\n        res += 'The class vtkNamedColors provides color names and their'\n        res += ' values for the convenience of the user.\\n'\n        res += '<br>The following tables show the available colors along with'\n        res += ' their red, green and blue values.\\n'\n        res += self.MakeHTMLIndex()\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"3\"><a id=\"WebColorNames\">Web color Names</a></th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeWebColorTables()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '<br>\\n'\n\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"3\"><a id=\"VTKColorNames\">VTK color Names</a></th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeVTKColorTables()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '<br>\\n'\n\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"2\"><a id=\"Synonyms\">Synonyms</a></th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeSynonymColorTable()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '</body>\\n'\n        return res\n\n\nif __name__ == \"__main__\":\n    main()\n
"},{"location":"Python/Visualization/NamedColors/","title":"NamedColors","text":"

vtk-examples/Python/Visualization/NamedColors

"},{"location":"Python/Visualization/NamedColors/#description","title":"Description","text":"

This example demonstrates the usage of the vtkNamedColors class. Some helper functions are also implemented.

A cone is created and contoured using the BandedPolyDataContourFilter, it is then colored using a LookupTable where the colors have been assigned using color names.

A list of available color names and any synonyms are also output.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/NamedColors/#code","title":"Code","text":"

NamedColors.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\n    This example demonstrates the usage of the vtNamedColor class.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersModeling import vtkBandedPolyDataContourFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    nc = vtkNamedColors()\n    # We can print out the variables.\n    # The color name and RGBA values are displayed.\n    print(nc)\n\n    # Here we just print out the colors and any\n    # synonyms.\n    PrintColors(nc)\n    PrintSynonyms(nc)\n\n    \"\"\"\n    Create a cone, contour it using the banded contour filter and\n        color it with the primary additive and subtractive colors.\n    \"\"\"\n    # Create a cone\n    coneSource = vtkConeSource()\n    coneSource.SetCenter(0.0, 0.0, 0.0)\n    coneSource.SetRadius(5.0)\n    coneSource.SetHeight(10)\n    coneSource.SetDirection(0, 1, 0)\n    coneSource.SetResolution(6)\n    coneSource.Update()\n\n    bounds = [1.0, -1.0, 1.0, -1.0, 1.0, -1.0]\n    coneSource.GetOutput().GetBounds(bounds)\n\n    elevation = vtkElevationFilter()\n    elevation.SetInputConnection(coneSource.GetOutputPort())\n    elevation.SetLowPoint(0, bounds[2], 0)\n    elevation.SetHighPoint(0, bounds[3], 0)\n\n    bcf = vtkBandedPolyDataContourFilter()\n    bcf.SetInputConnection(elevation.GetOutputPort())\n    bcf.SetScalarModeToValue()\n    bcf.GenerateContourEdgesOn()\n    bcf.GenerateValues(7, elevation.GetScalarRange())\n\n    # Test setting and getting a color here.\n    # We are also modifying alpha.\n    # Convert to a list so that\n    # SetColor(name,rgba) works.\n    rgba = list(nc.GetColor4d(\"Red\"))\n    rgba[3] = 0.5\n    nc.SetColor(\"My Red\", rgba)\n    # Does \"My Red\" match anything?\n    match = FindSynonyms(nc, \"My Red\")\n    print(\"Matching colors to My Red:\", ', '.join(match))\n    # Build a simple lookup table of\n    # primary additive and subtractive colors.\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(7)\n    lut.SetTableValue(0, nc.GetColor4d(\"My Red\"))\n    # Let's make the dark green one partially transparent.\n    rgba = nc.GetColor4d(\"Lime\")\n    rgba[3] = 0.3\n    lut.SetTableValue(1, rgba)\n    lut.SetTableValue(2, nc.GetColor4d(\"Blue\"))\n    lut.SetTableValue(3, nc.GetColor4d(\"Cyan\"))\n    lut.SetTableValue(4, nc.GetColor4d(\"Magenta\"))\n    lut.SetTableValue(5, nc.GetColor4d(\"Yellow\"))\n    lut.SetTableValue(6, nc.GetColor4d(\"White\"))\n    lut.SetTableRange(elevation.GetScalarRange())\n    lut.Build()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(bcf.GetOutputPort())\n    mapper.SetLookupTable(lut)\n    mapper.SetScalarModeToUseCellData()\n\n    contourLineMapper = vtkPolyDataMapper()\n    contourLineMapper.SetInputData(bcf.GetContourEdgesOutput())\n    contourLineMapper.SetScalarRange(elevation.GetScalarRange())\n    contourLineMapper.SetResolveCoincidentTopologyToPolygonOffset()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    contourLineActor = vtkActor()\n    actor.SetMapper(mapper)\n    contourLineActor.SetMapper(contourLineMapper)\n    contourLineActor.GetProperty().SetColor(\n        nc.GetColor3d(\"black\"))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(contourLineActor)\n    renderer.SetBackground2(nc.GetColor3d('RoyalBlue'))\n    renderer.SetBackground(nc.GetColor3d('MistyRose'))\n    renderer.GradientBackgroundOn()\n    renderWindow.SetSize(600, 600)\n    renderWindow.Render()\n    renderWindow.SetWindowName('NamedColors')\n    renderWindow.Render()\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\ndef FindSynonyms(nc, colorName):\n    \"\"\"\n    Find any synonyms for a specified color.\n    :param: nc: The vtkNamedColor class\n    :param: colorName: the name of the color to find the synonyms for.\n    :return: The synonyms for colorName.\n    \"\"\"\n    availableColors = nc.GetColorNames()\n    # Make a list\n    availableColors = availableColors.split('\\n')\n    synonyms = []\n    # We use lower case for comparison and\n    # just the red, green, and blue components\n    # of the color.\n    myColor = nc.GetColor3ub(colorName)\n    for color in availableColors:\n        rgb = nc.GetColor3ub(color)\n        if list(myColor) == list(rgb):\n            synonyms.append(color)\n    return synonyms\n\n\ndef PrintColors(nc):\n    colorNames = nc.GetColorNames().split('\\n')\n    print(\"There are\", len(colorNames), \"colors:\")\n    max_str_len = len(max(colorNames, key=len))\n    n = 0\n    s = ''\n    for p in colorNames:\n        n += 1\n        if n % 5 == 0:\n            s += '{:s}\\n'.format(p)\n        else:\n            s += '{:s} '.format(p.ljust(max_str_len))\n    s = s.strip() + '\\n'\n    print(s)\n\n\ndef PrintSynonyms(nc):\n    syn = nc.GetSynonyms().split('\\n\\n')\n    print(\"There are\", len(syn), \"synonyms:\")\n    synonyms = []\n    for ele in syn:\n        synonyms.append(ele.split('\\n'))\n    max_str_len = 0\n    for p in synonyms:\n        max_len = len(max(p, key=len))\n        if max_len > max_str_len:\n            max_str_len = max_len\n    s = ''\n    for p in synonyms:\n        n = 0\n        for q in p:\n            n += 1\n            if n < len(p):\n                s += '{:s} '.format(q.ljust(max_str_len))\n            else:\n                s += '{:s}\\n'.format(q)\n    s = s.strip() + '\\n'\n    print(s)\n\n\nif __name__ == \"__main__\":\n    main()\n
"},{"location":"Python/Visualization/NormalsDemo/","title":"NormalsDemo","text":"

vtk-examples/Python/Visualization/NormalsDemo

"},{"location":"Python/Visualization/NormalsDemo/#description","title":"Description","text":"

This example demonstrates the generation of normals. The left image shows the orignal faceted model. The center image shows the model with generated normals, but no consideration for sharp features. The third image shows the model with a 30 degree feature angle and splitting on.

Theis example uses the src/Testing/Data/42400-IDGH.stl dataset.

Info

See Figure 9-24 in Chapter 9 The VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/NormalsDemo/#code","title":"Code","text":"

NormalsDemo.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    polyData = ReadPolyData(fileName)\n\n    # A renderer.\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d(\"White\"))\n\n    # Create background colors for each viewport.\n    backgroundColors = list()\n    backgroundColors.append(colors.GetColor3d(\"Cornsilk\"))\n    backgroundColors.append(colors.GetColor3d(\"NavajoWhite\"))\n    backgroundColors.append(colors.GetColor3d(\"Tan\"))\n\n    # Create a renderer for each view port.\n    ren = list()\n    ren.append(vtkRenderer())\n    ren.append(vtkRenderer())\n    ren.append(vtkRenderer())\n    ren[0].SetViewport(0, 0, 1.0 / 3.0, 1)  # Input\n    ren[1].SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1)  # Normals (no split)\n    ren[2].SetViewport(2.0 / 3.0, 0, 1, 1)  # Normals (split)\n\n    # Shared camera.\n    camera = vtkCamera()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputData(polyData)\n    normals.SetFeatureAngle(30.0)\n    for i in range(0, 3):\n        if i == 0:\n            normals.ComputePointNormalsOff()\n        elif i == 1:\n            normals.ComputePointNormalsOn()\n            normals.SplittingOff()\n        else:\n            normals.ComputePointNormalsOn()\n            normals.SplittingOn()\n\n        normals.Update()\n\n        normalsPolyData = vtkPolyData()\n        normalsPolyData.DeepCopy(normals.GetOutput())\n\n        # mapper\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputData(normalsPolyData)\n        mapper.ScalarVisibilityOff()\n\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n        actor.GetProperty().SetDiffuseColor(colors.GetColor3d(\"Peacock\"))\n        actor.GetProperty().SetDiffuse(.7)\n        actor.GetProperty().SetSpecularPower(20)\n        actor.GetProperty().SetSpecular(.5)\n\n        # add the actor\n        ren[i].SetBackground(backgroundColors[i])\n        ren[i].SetActiveCamera(camera)\n        ren[i].AddActor(actor)\n\n    # Render window.\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(ren[0])\n    renwin.AddRenderer(ren[1])\n    renwin.AddRenderer(ren[2])\n    renwin.SetWindowName('NormalsDemo')\n\n    # An interactor.\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    renwin.SetSize(900, 300)\n    ren[0].GetActiveCamera().SetFocalPoint(0, 0, 0)\n    ren[0].GetActiveCamera().SetPosition(1, 0, 0)\n    ren[0].GetActiveCamera().SetViewUp(0, 0, -1)\n    ren[0].ResetCamera()\n\n    ren[0].GetActiveCamera().Azimuth(120)\n    ren[0].GetActiveCamera().Elevation(30)\n    ren[0].GetActiveCamera().Dolly(1.1)\n    ren[0].ResetCameraClippingRange()\n\n    renwin.Render()\n    ren[0].ResetCamera()\n    renwin.Render()\n\n    # Start.\n    interactor.Initialize()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Surface normal generation.'\n    epilogue = '''\n    (a) Faceted model without normals.\n    (b) Polygons must be consistently oriented to accurately compute normals.\n    (c) Sharp edges are poorly represented using shared normals as shown on the corners of this model.\n    (d) Normal generation with sharp edges split.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='42400-IDGH.stl.')\n    args = parser.parse_args()\n    return args.filename1\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == \".ply\":\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".vtp\":\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".obj\":\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".stl\":\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".vtk\":\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".g\":\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/OrientedGlyphs/","title":"OrientedGlyphs","text":"

vtk-examples/Python/Visualization/OrientedGlyphs

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/OrientedGlyphs/#code","title":"Code","text":"

OrientedGlyphs.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    input_data = vtkPolyData()\n    input_data.ShallowCopy(sphereSource.GetOutput())\n\n    arrowSource = vtkArrowSource()\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetSourceConnection(arrowSource.GetOutputPort())\n    glyph3D.SetVectorModeToUseNormal()\n    glyph3D.SetInputData(input_data)\n    glyph3D.SetScaleFactor(.2)\n    glyph3D.Update()\n\n    # Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph3D.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('OrientedGlyphs')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    renderWindow.Render()\n\n    camera = renderer.GetActiveCamera()\n    camera.SetPosition(-0.399941, -1.070475, 2.931458)\n    camera.SetFocalPoint(-0.000000, -0.000000, 0.000000)\n    camera.SetViewUp(-0.028450, 0.940195, 0.339448)\n    camera.SetDistance(3.146318)\n    camera.SetClippingRange(1.182293, 5.626211)\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/PointDataSubdivision/","title":"PointDataSubdivision","text":"

vtk-examples/Python/Visualization/PointDataSubdivision

"},{"location":"Python/Visualization/PointDataSubdivision/#description","title":"Description","text":""},{"location":"Python/Visualization/PointDataSubdivision/#introduction","title":"Introduction","text":"

This example demonstrates the use of the vtkLinearSubdivisionFilter and vtkButterflySubdivisionFilter.

In order to see the effects of these filters a triptych is created that demonstrates the effect of applying the filter.

The user can select from a list of sources to render, specify whether normals are displayed, what type of shading to use and the number of normals to glyph.

A representative set of sources to render are provided in the class called Sources. The user is encouraged to experiment with different sources to see the effect of the filters.

"},{"location":"Python/Visualization/PointDataSubdivision/#adding-more-sources","title":"Adding more sources.","text":"

If you add more sources, you may need to provide one or all of these filters:

  • A vtkTriangleFilter
  • A vtkPolyDataNormals filter
  • A vtkElevationFilter.
  • A vtkCleanPolyData filter.
  • For parametric sources, you may need to apply one of both of JoinUOff() or JoinVOff().

The representative sources provided in the class Sources should provide good templates.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/PointDataSubdivision/#code","title":"Code","text":"

PointDataSubdivision.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBoy,\n    vtkParametricEllipsoid,\n    vtkParametricMobius,\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import vtkVersion\nfrom vtkmodules.vtkCommonDataModel import vtkColor3ub\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkElevationFilter,\n    vtkGlyph3D,\n    vtkMaskPoints,\n    vtkPolyDataNormals,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersHybrid import vtkRenderLargeImage\nfrom vtkmodules.vtkFiltersModeling import (\n    vtkButterflySubdivisionFilter,\n    vtkLinearSubdivisionFilter\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkConeSource,\n    vtkParametricFunctionSource,\n    vtkSphereSource,\n    vtkSuperquadricSource\n)\nfrom vtkmodules.vtkIOImage import vtkPNGWriter\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkColorTransferFunction,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\nnc = vtkNamedColors()\n\n\ndef GetProgramParameters():\n    import argparse\n    description = 'Demonstrates point data subdivision with the glyphing of normals on the surface.'\n    epilogue = '''\n        This program takes a surface and displays three surfaces.\n\n        The first surface is the original surface and the second and third surfaces have\n         had linear and butterfly interpolation applied respectively.\n        The user can control the object to use, normal generation, type of shading\n         and number of points to use for the normals.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('sourceToUse', help='The surface to use.', nargs='?', default='Boy')\n    parser.add_argument('-g', '--glyphPoints', help='Number of points to be used for glyphing.', nargs='?', default=50,\n                        type=int)\n    parser.add_argument('--no-normals', help='Do not display normals.', dest='displayNormals', action='store_false')\n    parser.add_argument('--no-gouraud', help='Use flat interpolation. Gouraud interpolation is used by default.',\n                        dest='gouraudInterpolation', action='store_false')\n    parser.set_defaults(displayNormals=True)\n    parser.set_defaults(gouraudInterpolation=True)\n    args = parser.parse_args()\n    return args.sourceToUse, args.displayNormals, args.gouraudInterpolation, args.glyphPoints\n\n\nclass Sources(object):\n    \"\"\"\n    This class acts as a storage vehicle for the various sources.\n\n    If you add more sources, you may need to provide one or all of these filters:\n     - A Triangle filter\n     - A Normal filter\n     - An elevation filter.\n     - A CleanPolyData filter.\n     - For parametric sources, we may need to apply one of both of JoinUOff() or JoinVOff().\n\n    Use the representative sources provided here as templates.\n    \"\"\"\n\n    def __init__(self):\n        # If you add more sources update this dictionary.\n        self.sources = {'ParametricTorus': self.ParametricTorusSource(), 'ParametricEllipsoid': self.EllipsoidSource(),\n                        'Boy': self.BoySource(), 'Sphere': self.SphereSource(), 'Mobius': self.MobiusSource(),\n                        'Cone': self.ConeSource(), 'RandomHills': self.ParametricRandomHills(),\n                        'Superquadric': self.SuperquadricSource()}\n\n    @staticmethod\n    def ParametricTorusSource():\n        torus = vtkParametricTorus()\n        torus.JoinUOff()\n        torus.JoinVOff()\n        torusSource = vtkParametricFunctionSource()\n        torusSource.SetParametricFunction(torus)\n        torusSource.SetScalarModeToZ()\n        return torusSource\n\n    @staticmethod\n    def EllipsoidSource():\n        ellipsoid = vtkParametricEllipsoid()\n        ellipsoid.SetXRadius(0.5)\n        ellipsoid.SetYRadius(1.0)\n        ellipsoid.SetZRadius(2.0)\n        ellipsoid.JoinUOff()\n        # ellipsoid.JoinVOff()\n        ellipsoidSource = vtkParametricFunctionSource()\n        ellipsoidSource.SetParametricFunction(ellipsoid)\n        ellipsoidSource.SetScalarModeToZ()\n        return ellipsoidSource\n\n    @staticmethod\n    def BoySource():\n        boy = vtkParametricBoy()\n        boy.JoinUOff()\n        # boy.JoinVOff()\n        boySource = vtkParametricFunctionSource()\n        boySource.SetParametricFunction(boy)\n        boySource.SetScalarModeToZ()\n        return boySource\n\n    @staticmethod\n    def MobiusSource():\n        mobius = vtkParametricMobius()\n        mobius.SetRadius(2)\n        mobius.SetMinimumV(-0.5)\n        mobius.SetMaximumV(0.5)\n        mobius.JoinUOff()\n        mobiusSource = vtkParametricFunctionSource()\n        mobiusSource.SetParametricFunction(mobius)\n        mobiusSource.SetScalarModeToX()\n        return mobiusSource\n\n    @staticmethod\n    def ParametricRandomHills():\n        randomHills = vtkParametricRandomHills()\n        # randomHills.AllowRandomGenerationOff()\n        randomHills.SetRandomSeed(1)\n        randomHills.SetNumberOfHills(30)\n        randomHillsSource = vtkParametricFunctionSource()\n        randomHillsSource.SetParametricFunction(randomHills)\n        randomHillsSource.SetScalarModeToZ()\n        randomHillsSource.SetUResolution(10)\n        randomHillsSource.SetVResolution(10)\n        return randomHillsSource\n\n    @staticmethod\n    def SphereSource():\n        sphere = vtkSphereSource()\n        sphere.SetPhiResolution(11)\n        sphere.SetThetaResolution(11)\n        sphere.Update()\n        sphereBounds = sphere.GetOutput().GetBounds()\n\n        elev = vtkElevationFilter()\n        elev.SetInputConnection(sphere.GetOutputPort())\n        elev.SetLowPoint(0, sphereBounds[2], 0)\n        elev.SetHighPoint(0, sphereBounds[3], 0)\n        elev.Update()\n        return elev\n\n    @staticmethod\n    def SuperquadricSource():\n        \"\"\"\n        Make a torus as the source.\n        \"\"\"\n        source = vtkSuperquadricSource()\n        source.SetCenter(0.0, 0.0, 0.0)\n        source.SetScale(1.0, 1.0, 1.0)\n        source.SetPhiResolution(64)\n        source.SetThetaResolution(64)\n        source.SetThetaRoundness(1)\n        source.SetThickness(0.5)\n        source.SetSize(10)\n        source.SetToroidal(1)\n\n        # The quadric is made of strips, so pass it through a triangle filter as\n        # the curvature filter only operates on polys\n        tri = vtkTriangleFilter()\n        tri.SetInputConnection(source.GetOutputPort())\n\n        # The quadric has nasty discontinuities from the way the edges are generated\n        # so let's pass it though a CleanPolyDataFilter and merge any points which\n        # are coincident, or very close\n        cleaner = vtkCleanPolyData()\n        cleaner.SetInputConnection(tri.GetOutputPort())\n        cleaner.SetTolerance(0.005)\n        cleaner.Update()\n        cleanerBounds = cleaner.GetOutput().GetBounds()\n\n        elev = vtkElevationFilter()\n        elev.SetInputConnection(cleaner.GetOutputPort())\n        elev.SetLowPoint(0, cleanerBounds[2], 0)\n        elev.SetHighPoint(0, cleanerBounds[3], 0)\n        elev.Update()\n        return elev\n\n    @staticmethod\n    def ConeSource():\n        cone = vtkConeSource()\n        cone.SetResolution(6)\n        cone.CappingOn()\n        cone.Update()\n        coneBounds = cone.GetOutput().GetBounds()\n\n        coneNormals = vtkPolyDataNormals()\n        coneNormals.SetInputConnection(cone.GetOutputPort())\n\n        elev = vtkElevationFilter()\n        elev.SetInputConnection(coneNormals.GetOutputPort())\n        elev.SetLowPoint(coneBounds[0], 0, 0)\n        elev.SetHighPoint(coneBounds[1], 0, 0)\n\n        # vtkButterflySubdivisionFilter and vtkLinearSubdivisionFilter operate on triangles.\n        tf = vtkTriangleFilter()\n        tf.SetInputConnection(elev.GetOutputPort())\n        tf.Update()\n        return tf\n\n\ndef MakeLUT(scalarRange):\n    \"\"\"\n    Make a lookup table using a predefined color series.\n\n    :param scalarRange: The range of the scalars to be coloured.\n    :return:  A lookup table.\n    \"\"\"\n    colorSeries = vtkColorSeries()\n    # Select a color scheme.\n    # for i in range(0,62):\n    #     colorSeries.SetColorScheme(i)\n    #     print('Colour scheme {:2d}: {:s}'.format(colorSeries.GetColorScheme(), colorSeries.GetColorSchemeName()))\n\n    # Colour scheme 61: Brewer Qualitative Set3\n    colorSeries.SetColorScheme(61)\n    # We use this colour series to create the transfer function.\n    lut = vtkColorTransferFunction()\n    lut.SetColorSpaceToHSV()\n    numColors = colorSeries.GetNumberOfColors()\n    for i in range(0, numColors):\n        color = vtkColor3ub(colorSeries.GetColor(i))\n        c = list()\n        for j in range(0, 3):\n            c.append(color[j] / 255.0)\n        t = scalarRange[0] + (scalarRange[1] - scalarRange[0]) / (numColors - 1) * i\n        lut.AddRGBPoint(t, *c)\n    return lut\n\n\ndef GlyphActor(source, glyphPoints, scalarRange, scaleFactor, lut):\n    \"\"\"\n    Create the actor for glyphing the normals.\n\n    :param: source: the surface.\n    :param: glyphPoints: The number of points used by the mask filter.\n    :param: scalarRange: The range in terms of scalar minimum and maximum.\n    :param: scaleFactor: The scaling factor for the glyph.\n    :param: lut: The lookup table to use.\n\n    :return: The glyph actor.\n    \"\"\"\n    arrowSource = vtkArrowSource()\n    # Subsample the dataset.\n    maskPts = vtkMaskPoints()\n    maskPts.SetInputConnection(source.GetOutputPort())\n    maskPts.SetOnRatio(source.GetOutput().GetNumberOfPoints() // glyphPoints)\n    maskPts.SetRandomMode(1)\n\n    arrowGlyph = vtkGlyph3D()\n    arrowGlyph.SetScaleFactor(scaleFactor)\n    arrowGlyph.SetVectorModeToUseNormal()\n    arrowGlyph.SetColorModeToColorByScalar()\n    arrowGlyph.SetScaleModeToScaleByVector()\n    arrowGlyph.OrientOn()\n    arrowGlyph.SetSourceConnection(arrowSource.GetOutputPort())\n    arrowGlyph.SetInputConnection(maskPts.GetOutputPort())\n    arrowGlyph.Update()\n\n    arrowGlyphMapper = vtkDataSetMapper()\n    # Colour by scalars.\n    arrowGlyphMapper.SetScalarRange(scalarRange)\n    arrowGlyphMapper.SetColorModeToMapScalars()\n    arrowGlyphMapper.ScalarVisibilityOn()\n    arrowGlyphMapper.SetLookupTable(lut)\n    arrowGlyphMapper.SetInputConnection(arrowGlyph.GetOutputPort())\n\n    glyphActor = vtkActor()\n    glyphActor.SetMapper(arrowGlyphMapper)\n    return glyphActor\n\n\ndef MakeSurfaceActor(surface, scalarRange, lut):\n    \"\"\"\n    Create the actor for a surface.\n\n    :param: surface: The surface.\n    :param: scalarRange: The range in terms of scalar minimum and maximum.\n    :param: lut: The lookup table to use.\n\n    :return: The actor for the surface.\n    \"\"\"\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.SetLookupTable(lut)\n    mapper.SetScalarRange(scalarRange)\n    mapper.SetColorModeToMapScalars()\n    mapper.ScalarVisibilityOn()\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    return actor\n\n\ndef MakeLabel(textLabel, renWinSize):\n    \"\"\"\n    Create a label.\n\n    :param textLabel: The label.\n    :param renWinSize: The size of the render window. Used to set the font size.\n\n    :return: The actor for the text label.\n    \"\"\"\n    # Create one text property for all\n    textProperty = vtkTextProperty()\n    textProperty.SetJustificationToCentered()\n    textProperty.SetFontSize(int(renWinSize / 20))\n\n    mapper = vtkTextMapper()\n    mapper.SetInput(textLabel)\n    mapper.SetTextProperty(textProperty)\n\n    actor = vtkActor2D()\n    actor.SetMapper(mapper)\n    actor.SetPosition(renWinSize / 2.0, 16)\n    actor.GetProperty().SetColor(nc.GetColor3d(\"Gold\"))\n    return actor\n\n\ndef MakeAxesActor():\n    \"\"\"\n    Make an axis actor.\n\n    :return: The axis actor.\n    \"\"\"\n    axes = vtkAxesActor()\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText('X')\n    axes.SetYAxisLabelText('Y')\n    axes.SetZAxisLabelText('Z')\n    axes.SetTotalLength(1.0, 1.0, 1.0)\n    axes.SetCylinderRadius(1.0 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.75 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.0 * axes.GetSphereRadius())\n    axes.GetXAxisCaptionActor2D().GetTextActor().GetScaledTextProperty()\n    axes.GetXAxisCaptionActor2D().GetTextActor().SetTextScaleModeToNone()\n    axes.GetYAxisCaptionActor2D().GetTextActor().GetScaledTextProperty()\n    axes.GetYAxisCaptionActor2D().GetTextActor().SetTextScaleModeToNone()\n    axes.GetZAxisCaptionActor2D().GetTextActor().GetScaledTextProperty()\n    axes.GetZAxisCaptionActor2D().GetTextActor().SetTextScaleModeToNone()\n    return axes\n\n\ndef MakeOrientationMarker(renderer, iren):\n    \"\"\"\n    Create an orientation marker for a given renderer.\n\n    :param renderer: The renderer.\n    :param iren: The interactor.\n\n    :return: The orientation marker.\n    \"\"\"\n    om = vtkOrientationMarkerWidget()\n    om.SetOrientationMarker(MakeAxesActor())\n    # Position lower left in the viewport.\n    om.SetViewport(0, 0, 0.2, 0.2)\n    om.SetInteractor(iren)\n    om.SetDefaultRenderer(renderer)\n    om.EnabledOn()\n    om.InteractiveOn()\n    renderer.ResetCamera()\n    return om\n\n\ndef WritePNG(ren, fn, magnification=1):\n    \"\"\"\n    Save the image as a PNG\n    :param: ren - the renderer.\n    :param: fn - the file name.\n    :param: magnification - the magnification, usually 1.\n    \"\"\"\n    renLgeIm = vtkRenderLargeImage()\n    renLgeIm.SetInput(ren)\n    renLgeIm.SetMagnification(magnification)\n    imgWriter = vtkPNGWriter()\n    imgWriter.SetInputConnection(renLgeIm.GetOutputPort())\n    imgWriter.SetFileName(fn)\n    imgWriter.Write()\n\n\ndef main():\n    def FlatInterpolation():\n        for actor in actors:\n            actor.GetProperty().SetInterpolationToFlat()\n        renWin.Render()\n\n    def GouraudInterpolation():\n        for actor in actors:\n            actor.GetProperty().SetInterpolationToGouraud()\n        renWin.Render()\n\n    sourceToUse, displayNormals, gouraudInterpolation, glyphPoints = GetProgramParameters()\n\n    if sourceToUse in Sources().sources:\n        src = Sources().sources[sourceToUse]\n    else:\n        print('The source {:s} is not available.'.format(sourceToUse))\n        print('Available sources are:\\n', ', '.join(sorted(list(Sources().sources.keys()))))\n        return\n\n    src.Update()\n\n    # The size of the render window.\n    renWinXSize = 1200\n    renWinYSize = renWinXSize // 3\n    minRenWinDim = min(renWinXSize, renWinYSize)\n\n    # [xMin, xMax, yMin, yMax, zMin, zMax]\n    bounds = src.GetOutput().GetBounds()\n    # Use this to scale the normal glyph.\n    scaleFactor = min(map(lambda x, y: x - y, bounds[1::2], bounds[::2])) * 0.2\n    src.GetOutput().GetPointData().GetScalars().SetName(\"Elevation\")\n    scalarRange = src.GetOutput().GetScalarRange()\n\n    butterfly = vtkButterflySubdivisionFilter()\n    butterfly.SetInputConnection(src.GetOutputPort())\n    butterfly.SetNumberOfSubdivisions(3)\n    butterfly.Update()\n\n    linear = vtkLinearSubdivisionFilter()\n    linear.SetInputConnection(src.GetOutputPort())\n    linear.SetNumberOfSubdivisions(3)\n    linear.Update()\n\n    lut = MakeLUT(scalarRange)\n\n    actors = list()\n    actors.append(MakeSurfaceActor(butterfly, scalarRange, lut))\n    actors.append(MakeSurfaceActor(linear, scalarRange, lut))\n    actors.append(MakeSurfaceActor(src, scalarRange, lut))\n\n    # Let's visualise the normals.\n    glyphActors = list()\n    if displayNormals:\n        glyphActors.append(GlyphActor(butterfly, glyphPoints, scalarRange, scaleFactor, lut))\n        glyphActors.append(GlyphActor(linear, glyphPoints, scalarRange, scaleFactor, lut))\n        glyphActors.append(GlyphActor(src, glyphPoints, scalarRange, scaleFactor, lut))\n\n    labelActors = list()\n    labelActors.append(MakeLabel('Butterfly Subdivision', minRenWinDim))\n    labelActors.append(MakeLabel('Linear Subdivision', minRenWinDim))\n    labelActors.append(MakeLabel('Original', minRenWinDim))\n\n    ren = list()\n    ren.append(vtkRenderer())\n    ren.append(vtkRenderer())\n    ren.append(vtkRenderer())\n    ren[2].SetViewport(0, 0, 1.0 / 3.0, 1)  # Original\n    ren[1].SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1)  # Linear\n    ren[0].SetViewport(2.0 / 3.0, 0, 1, 1)  # Butterfly\n\n    renWin = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Orientation markers.\n    om = list()\n    # Make the imaging pipelines.\n    for i in range(0, len(ren)):\n        renWin.AddRenderer(ren[i])\n\n        ren[i].AddActor(actors[i])\n        ren[i].AddActor(labelActors[i])\n        ren[i].SetBackground(nc.GetColor3d('SlateGray'))\n\n        if displayNormals:\n            ren[i].AddActor(glyphActors[i])\n\n        om.append(MakeOrientationMarker(ren[i], iren))\n\n    if gouraudInterpolation:\n        GouraudInterpolation()\n    else:\n        FlatInterpolation()\n\n    renWin.SetSize(renWinXSize, renWinYSize)\n    renWin.Render()\n    # renWin.SetWindowName() needs to be called after renWin.Render()\n    renWin.SetWindowName('PointDataSubdivision')\n\n    iren.Initialize()\n    # WritePNG(iren.GetRenderWindow().GetRenderers().GetFirstRenderer(), \"TestPointDataSubdivision.png\")\n    iren.Start()\n\n\nif __name__ == '__main__':\n    requiredMajorVersion = 6\n    # print(vtkVersion().GetVTKMajorVersion())\n    if vtkVersion().GetVTKMajorVersion() < requiredMajorVersion:\n        print(\"You need VTK Version 6 or greater.\")\n        print(\"The class vtkNamedColors is in VTK version 6 or greater.\")\n        exit(0)\n\n    main()\n
"},{"location":"Python/Visualization/PointSize/","title":"PointSize","text":"

vtk-examples/Python/Visualization/PointSize

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/PointSize/#code","title":"Code","text":"

PointSize.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('PointSize')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create source\n    src = vtkPointSource()\n    src.SetCenter(0, 0, 0)\n    src.SetNumberOfPoints(10)\n    src.SetRadius(5)\n    src.Update()\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(src.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n\n    actor.GetProperty().SetPointSize(5)\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('RoyalBLue'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/ProgrammableGlyphFilter/","title":"ProgrammableGlyphFilter","text":"

vtk-examples/Python/Visualization/ProgrammableGlyphFilter

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/ProgrammableGlyphFilter/#code","title":"Code","text":"

ProgrammableGlyphFilter.py

#!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersProgrammable import vtkProgrammableGlyphFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    # Create points.\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(5, 0, 0)\n    points.InsertNextPoint(10, 0, 0)\n\n    # Combine into a polydata.\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    glyph_filter = vtkProgrammableGlyphFilter()\n    glyph_filter.SetInputData(polydata)\n    # Create the observer.\n    observer = CalcGlyph(glyph_filter)\n    glyph_filter.SetGlyphMethod(observer)\n    # It needs a default glyph, but this should not be used.\n    cone_source = vtkConeSource()\n    glyph_filter.SetSourceConnection(cone_source.GetOutputPort())\n\n    # Create a mapper and actor.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph_filter.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    # Create a renderer, render window, and interactor.\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetWindowName('ProgrammableGlyphFilter')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Add the actor to the scene.\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Render and interact.\n    ren_win.Render()\n    renderer.GetActiveCamera().Zoom(0.9)\n    iren.Start()\n\n\nclass CalcGlyph(object):\n    def __init__(self, glyph_filter):\n        self.glyph_filter = glyph_filter\n\n    def __call__(self):\n        point_coords = self.glyph_filter.GetPoint()\n\n        print('Calling CalcGlyph for point ', self.glyph_filter.GetPointId())\n        print('Point coords are: ', point_coords[0], point_coords[1], point_coords[2])\n        if self.glyph_filter.GetPointId() == 0:\n            cone_source = vtkConeSource()\n            cone_source.SetCenter(point_coords)\n            self.glyph_filter.SetSourceConnection(cone_source.GetOutputPort())\n        elif self.glyph_filter.GetPointId() == 1:\n            cube_source = vtkCubeSource()\n            cube_source.SetCenter(point_coords)\n            self.glyph_filter.SetSourceConnection(cube_source.GetOutputPort())\n        elif self.glyph_filter.GetPointId() == 2:\n            sphere_source = vtkSphereSource()\n            sphere_source.SetCenter(point_coords)\n            self.glyph_filter.SetSourceConnection(sphere_source.GetOutputPort())\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Visualization/ProgrammableGlyphs/","title":"ProgrammableGlyphs","text":"

vtk-examples/Python/Visualization/ProgrammableGlyphs

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/ProgrammableGlyphs/#code","title":"Code","text":"

ProgrammableGlyphs.py

#!/usr/bin/env python\n\n# Python example translated directly from Tcl test\n# [vtk_source]/Graphics/Testing/Tcl/progGlyphs.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersProgrammable import vtkProgrammableGlyphFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkPlaneSource,\n    vtkSuperquadricSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    res = 6\n    plane = vtkPlaneSource()\n    plane.SetResolution(res, res)\n    colors = vtkElevationFilter()\n    colors.SetInputConnection(plane.GetOutputPort())\n    colors.SetLowPoint(-0.25, -0.25, -0.25)\n    colors.SetHighPoint(0.25, 0.25, 0.25)\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputData(colors.GetPolyDataOutput())\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n    planeActor.GetProperty().SetRepresentationToWireframe()\n\n    # create simple poly data so we can apply glyph\n    squad = vtkSuperquadricSource()\n\n    def Glyph():\n        \"\"\"\n        # procedure for generating glyphs\n        :return:\n        \"\"\"\n        xyz = glypher.GetPoint()\n        x = xyz[0]\n        y = xyz[1]\n        length = glypher.GetInput(0).GetLength()\n        scale = length / (2.0 * res)\n\n        squad.SetScale(scale, scale, scale)\n        squad.SetCenter(xyz)\n        squad.SetPhiRoundness(abs(x) * 5.0)\n        squad.SetThetaRoundness(abs(y) * 5.0)\n\n    glypher = vtkProgrammableGlyphFilter()\n    glypher.SetInputConnection(colors.GetOutputPort())\n    glypher.SetSourceConnection(squad.GetOutputPort())\n    glypher.SetGlyphMethod(Glyph)\n    glyphMapper = vtkPolyDataMapper()\n    glyphMapper.SetInputConnection(glypher.GetOutputPort())\n    glyphActor = vtkActor()\n    glyphActor.SetMapper(glyphMapper)\n\n    colors = vtkNamedColors()\n\n    # Create the rendering stuff\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.SetMultiSamples(0)\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    ren1.AddActor(planeActor)\n    ren1.AddActor(glyphActor)\n    ren1.SetBackground(colors.GetColor3d('Silver'))\n\n    renWin.SetSize(450, 450)\n    renWin.SetWindowName('ProgrammableGlyphs')\n    renWin.Render()\n\n    ren1.GetActiveCamera().Zoom(1.3)\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/QuadricVisualization/","title":"QuadricVisualization","text":"

vtk-examples/Python/Visualization/QuadricVisualization

"},{"location":"Python/Visualization/QuadricVisualization/#description","title":"Description","text":"

Visualizing a quadric function F(x,y,z) = c

This example is inspired by the Figure 4-1, page 83, in the VTK Book.

Info

See Figure 4-1 in Chapter 4 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/QuadricVisualization/#code","title":"Code","text":"

QuadricVisualization.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendFilter,\n    vtkContourFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingCore import vtkExtractVOI\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n    renderWindow.SetSize(640, 480)\n\n    #\n    # Create surface of implicit function.\n    #\n\n    # Sample quadric function.\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 2, 3, 0, 1, 0, 0, 0, 0, 0)\n\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(25, 25, 25)\n    sample.SetImplicitFunction(quadric)\n\n    isoActor = vtkActor()\n    CreateIsosurface(sample, isoActor)\n    outlineIsoActor = vtkActor()\n    CreateOutline(sample, outlineIsoActor)\n\n    planesActor = vtkActor()\n    CreatePlanes(sample, planesActor, 3)\n    outlinePlanesActor = vtkActor()\n    CreateOutline(sample, outlinePlanesActor)\n    planesActor.AddPosition(isoActor.GetBounds()[0] * 2.0, 0, 0)\n    outlinePlanesActor.AddPosition(isoActor.GetBounds()[0] * 2.0, 0, 0)\n\n    contourActor = vtkActor()\n    CreateContours(sample, contourActor, 3, 15)\n    outlineContourActor = vtkActor()\n    CreateOutline(sample, outlineContourActor)\n    contourActor.AddPosition(isoActor.GetBounds()[0] * 4.0, 0, 0)\n    outlineContourActor.AddPosition(isoActor.GetBounds()[0] * 4.0, 0, 0)\n\n    renderer.AddActor(planesActor)\n    renderer.AddActor(outlinePlanesActor)\n    renderer.AddActor(contourActor)\n    renderer.AddActor(outlineContourActor)\n    renderer.AddActor(isoActor)\n    renderer.AddActor(outlineIsoActor)\n\n    renderer.TwoSidedLightingOn()\n\n    renderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    # Try to set camera to match figure on book\n    renderer.GetActiveCamera().SetPosition(0, -1, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 0, -1)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(20)\n    renderer.GetActiveCamera().Azimuth(10)\n    renderer.GetActiveCamera().Dolly(1.2)\n    renderer.ResetCameraClippingRange()\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('QuadricVisualization');\n\n    renderWindow.Render()\n\n    # interact with data\n    interactor.Start()\n\n\ndef CreateIsosurface(func, actor, numberOfContours=5):\n    # Generate implicit surface.\n    contour = vtkContourFilter()\n    contour.SetInputConnection(func.GetOutputPort())\n    ranges = [1.0, 6.0]\n    contour.GenerateValues(numberOfContours, ranges)\n\n    # Map contour\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contour.GetOutputPort())\n    contourMapper.SetScalarRange(0, 7)\n\n    actor.SetMapper(contourMapper)\n    return\n\n\ndef CreatePlanes(func, actor, numberOfPlanes):\n    #\n    # Extract planes from implicit function.\n    #\n\n    append = vtkAppendFilter()\n\n    dims = func.GetSampleDimensions()\n    sliceIncr = (dims[2] - 1) // (numberOfPlanes + 1)\n    sliceNum = -4\n    for i in range(0, numberOfPlanes):\n        extract = vtkExtractVOI()\n        extract.SetInputConnection(func.GetOutputPort())\n        extract.SetVOI(0, dims[0] - 1,\n                       0, dims[1] - 1,\n                       sliceNum + sliceIncr, sliceNum + sliceIncr)\n        append.AddInputConnection(extract.GetOutputPort())\n        sliceNum += sliceIncr\n    append.Update()\n\n    # Map planes\n    planesMapper = vtkDataSetMapper()\n    planesMapper.SetInputConnection(append.GetOutputPort())\n    planesMapper.SetScalarRange(0, 7)\n\n    actor.SetMapper(planesMapper)\n    actor.GetProperty().SetAmbient(1.)\n    return\n\n\ndef CreateContours(func, actor, numberOfPlanes, numberOfContours):\n    #\n    # Extract planes from implicit function\n    #\n\n    append = vtkAppendFilter()\n\n    dims = func.GetSampleDimensions()\n    sliceIncr = (dims[2] - 1) // (numberOfPlanes + 1)\n\n    sliceNum = -4\n    for i in range(0, numberOfPlanes):\n        extract = vtkExtractVOI()\n        extract.SetInputConnection(func.GetOutputPort())\n        extract.SetVOI(0, dims[0] - 1,\n                       0, dims[1] - 1,\n                       sliceNum + sliceIncr, sliceNum + sliceIncr)\n        ranges = [1.0, 6.0]\n        contour = vtkContourFilter()\n        contour.SetInputConnection(extract.GetOutputPort())\n        contour.GenerateValues(numberOfContours, ranges)\n        append.AddInputConnection(contour.GetOutputPort())\n        sliceNum += sliceIncr\n    append.Update()\n\n    # Map planes\n    planesMapper = vtkDataSetMapper()\n    planesMapper.SetInputConnection(append.GetOutputPort())\n    planesMapper.SetScalarRange(0, 7)\n\n    actor.SetMapper(planesMapper)\n    actor.GetProperty().SetAmbient(1.)\n    return\n\n\ndef CreateOutline(source, actor):\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(source.GetOutputPort())\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(outline.GetOutputPort())\n    actor.SetMapper(mapper)\n    return\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/ShadowsLightsDemo/","title":"ShadowsLightsDemo","text":"

vtk-examples/Python/Visualization/ShadowsLightsDemo

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/ShadowsLightsDemo/#code","title":"Code","text":"

ShadowsLightsDemo.py

#!/usr/bin/env python3\n\n\"\"\"\nThe scene consists of:\n1) four actors: a rectangle, a box, a cone and a sphere.\n   The box, the cone and the sphere are above the rectangle.\n2) Two spotlights, one in the direction of the box, another one in the\n   direction of the sphere.\n   Both lights are above the box, the cone and  the sphere.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkPlaneSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkLightActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkCameraPass,\n    vtkOpaquePass,\n    vtkOpenGLRenderer,\n    vtkRenderPassCollection,\n    vtkSequencePass,\n    vtkShadowMapPass\n)\n\n\ndef main():\n    iren = vtkRenderWindowInteractor()\n\n    renwin = vtkRenderWindow()\n    renwin.SetSize(400, 400)\n    renwin.SetMultiSamples(0)\n\n    renwin.SetAlphaBitPlanes(1)\n    iren.SetRenderWindow(renwin)\n\n    renderer = vtkOpenGLRenderer()\n    renwin.AddRenderer(renderer)\n    renwin.SetSize(640, 480)\n\n    seq = vtkSequencePass()\n\n    passes = vtkRenderPassCollection()\n\n    shadows = vtkShadowMapPass()\n    passes.AddItem(shadows.GetShadowMapBakerPass())\n    passes.AddItem(shadows)\n\n    opaque = vtkOpaquePass()\n    passes.AddItem(opaque)\n\n    seq.SetPasses(passes)\n\n    camera_p = vtkCameraPass()\n    camera_p.SetDelegatePass(seq)\n\n    # Tell the renderer to use our render pass pipeline.\n    renderer.SetPass(camera_p)\n\n    colors = vtkNamedColors()\n    box_color = colors.GetColor3d('Tomato')\n    rectangle_color = colors.GetColor3d('Beige')\n    cone_color = colors.GetColor3d('Peacock')\n    sphere_color = colors.GetColor3d('Banana')\n\n    rectangle_source = vtkPlaneSource()\n    rectangle_source.SetOrigin(-5.0, 0.0, 5.0)\n    rectangle_source.SetPoint1(5.0, 0.0, 5.0)\n    rectangle_source.SetPoint2(-5.0, 0.0, -5.0)\n    rectangle_source.SetResolution(100, 100)\n\n    rectangle_mapper = vtkPolyDataMapper()\n    rectangle_mapper.SetInputConnection(rectangle_source.GetOutputPort())\n\n    rectangle_mapper.SetScalarVisibility(0)\n\n    rectangle_actor = vtkActor()\n    rectangle_actor.SetMapper(rectangle_mapper)\n    rectangle_actor.VisibilityOn()\n    rectangle_actor.GetProperty().SetColor(rectangle_color)\n\n    box_source = vtkCubeSource()\n    box_source.SetXLength(2.0)\n\n    box_normals = vtkPolyDataNormals()\n    box_normals.SetInputConnection(box_source.GetOutputPort())\n    box_normals.ComputePointNormalsOff()\n    box_normals.ComputeCellNormalsOn()\n    box_normals.Update()\n    box_normals.GetOutput().GetPointData().SetNormals(None)\n\n    box_mapper = vtkPolyDataMapper()\n    box_mapper.SetInputConnection(box_normals.GetOutputPort())\n    box_mapper.ScalarVisibilityOff()\n\n    box_actor = vtkActor()\n    box_actor.SetMapper(box_mapper)\n    box_actor.VisibilityOn()\n    box_actor.SetPosition(-2.0, 2.0, 0.0)\n    box_actor.GetProperty().SetColor(box_color)\n\n    cone_source = vtkConeSource()\n    cone_source.SetResolution(24)\n    cone_source.SetDirection(1.0, 1.0, 1.0)\n\n    cone_mapper = vtkPolyDataMapper()\n    cone_mapper.SetInputConnection(cone_source.GetOutputPort())\n    cone_mapper.SetScalarVisibility(0)\n\n    cone_actor = vtkActor()\n    cone_actor.SetMapper(cone_mapper)\n    cone_actor.VisibilityOn()\n    cone_actor.SetPosition(0.0, 1.0, 1.0)\n    cone_actor.GetProperty().SetColor(cone_color)\n\n    sphere_source = vtkSphereSource()\n    sphere_source.SetThetaResolution(32)\n    sphere_source.SetPhiResolution(32)\n\n    sphere_mapper = vtkPolyDataMapper()\n    sphere_mapper.SetInputConnection(sphere_source.GetOutputPort())\n    sphere_mapper.ScalarVisibilityOff()\n\n    sphere_actor = vtkActor()\n    sphere_actor.SetMapper(sphere_mapper)\n\n    sphere_actor.VisibilityOn()\n    sphere_actor.SetPosition(2.0, 2.0, -1.0)\n    sphere_actor.GetProperty().SetColor(sphere_color)\n\n    renderer.AddViewProp(rectangle_actor)\n    renderer.AddViewProp(box_actor)\n    renderer.AddViewProp(cone_actor)\n    renderer.AddViewProp(sphere_actor)\n\n    # Spotlights.\n\n    # Lighting the box.\n    l1 = vtkLight()\n    l1.SetPosition(-4.0, 4.0, -1.0)\n    l1.SetFocalPoint(box_actor.GetPosition())\n    l1.SetColor(colors.GetColor3d('White'))\n    l1.PositionalOn()\n    renderer.AddLight(l1)\n    l1.SwitchOn()\n\n    # Lighting the sphere.\n    l2 = vtkLight()\n    l2.SetPosition(4.0, 5.0, 1.0)\n    l2.SetFocalPoint(sphere_actor.GetPosition())\n    l2.SetColor(colors.GetColor3d('Magenta'))\n    l2.PositionalOn()\n    renderer.AddLight(l2)\n    l2.SwitchOn()\n\n    # For each spotlight, add a light frustum wireframe representation and a cone\n    # wireframe representation, colored with the light color.\n    angle = l1.GetConeAngle()\n    if l1.LightTypeIsSceneLight() and l1.GetPositional() and angle < 180.0:  # spotlight\n        la = vtkLightActor()\n        la.SetLight(l1)\n        renderer.AddViewProp(la)\n    angle = l2.GetConeAngle()\n    if l2.LightTypeIsSceneLight() and l2.GetPositional() and angle < 180.0:  # spotlight\n        la = vtkLightActor()\n        la.SetLight(l2)\n        renderer.AddViewProp(la)\n\n    renderer.SetBackground2(colors.GetColor3d('Black'))\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n    renderer.SetGradientBackground(True)\n\n    renwin.Render()\n    renwin.SetWindowName('ShadowsLightsDemo')\n\n    renderer.ResetCamera()\n\n    camera = renderer.GetActiveCamera()\n    camera.Azimuth(40.0)\n    camera.Elevation(10.0)\n\n    renwin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/SphereTexture/","title":"SphereTexture","text":"

vtk-examples/Python/Visualization/SphereTexture

"},{"location":"Python/Visualization/SphereTexture/#description","title":"Description","text":"

This example shows how to apply an vtkImageData texture to an sphere vtkPolyData object. There is a sample data file src/Testing/Data/masonry-wide.jpg.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/SphereTexture/#code","title":"Code","text":"

SphereTexture.py

#!/usr/bin/env python\n\n##\n# This example shows how to apply an vtkImageData texture to an sphere\n# vtkPolyData object.\n# Note: Input jpg file can be located in the VTKData repository.\n#\n# @author JBallesteros\n##\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkFiltersTexture import vtkTextureMapToSphere\nfrom vtkmodules.vtkIOImage import vtkJPEGReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Texture an object with an image.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='masonry-wide.jpg.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    jpegfile = get_program_parameters()\n\n    # Create a render window\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(480, 480)\n    renWin.SetWindowName('SphereTexture')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Generate an sphere polydata\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(12)\n    sphere.SetPhiResolution(12)\n\n    # Read the image data from a file\n    reader = vtkJPEGReader()\n    reader.SetFileName(jpegfile)\n\n    # Create texture object\n    texture = vtkTexture()\n    texture.SetInputConnection(reader.GetOutputPort())\n\n    # Map texture coordinates\n    map_to_sphere = vtkTextureMapToSphere()\n    map_to_sphere.SetInputConnection(sphere.GetOutputPort())\n    map_to_sphere.PreventSeamOn()\n\n    # Create mapper and set the mapped texture as input\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(map_to_sphere.GetOutputPort())\n\n    # Create actor and set the mapper and the texture\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.SetTexture(texture)\n\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('RosyBrown'))\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/StreamLines/","title":"StreamLines","text":"

vtk-examples/Python/Visualization/StreamLines

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/StreamLines/#code","title":"Code","text":"

StreamLines.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Streamlines.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('xyz_file', help='combxyz.bin.')\n    parser.add_argument('q_file', help='combq.bin.')\n    args = parser.parse_args()\n    return args.xyz_file, args.q_file\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])\n\n    xyz_file, q_file = get_program_parameters()\n\n    # Read the data.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(xyz_file)\n    pl3d.SetQFileName(q_file)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    seeds = vtkPlaneSource()\n    seeds.SetXResolution(4)\n    seeds.SetYResolution(4)\n    seeds.SetOrigin(2, -2, 26)\n    seeds.SetPoint1(2, 2, 26)\n    seeds.SetPoint2(2, -2, 32)\n\n    streamline = vtkStreamTracer()\n    streamline.SetInputData(pl3d.GetOutput().GetBlock(0))\n    streamline.SetSourceConnection(seeds.GetOutputPort())\n    streamline.SetMaximumPropagation(200)\n    streamline.SetInitialIntegrationStep(.2)\n    streamline.SetIntegrationDirectionToForward()\n\n    streamline_mapper = vtkPolyDataMapper()\n    streamline_mapper.SetInputConnection(streamline.GetOutputPort())\n    streamline_actor = vtkActor()\n    streamline_actor.SetMapper(streamline_mapper)\n    streamline_actor.VisibilityOn()\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3d.GetOutput().GetBlock(0))\n    outline_mapper = vtkPolyDataMapper()\n    outline_mapper.SetInputConnection(outline.GetOutputPort())\n    outline_actor = vtkActor()\n    outline_actor.SetMapper(outline_mapper)\n    outline_actor.GetProperty().SetColor(colors.GetColor3d('White'))\n\n    renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetWindowName('StreamLines')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetInteractorStyle(vtkInteractorStyleTrackballCamera())\n    render_window.SetInteractor(interactor)\n\n    renderer.AddActor(streamline_actor)\n    renderer.AddActor(outline_actor)\n\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n    interactor.Initialize()\n    render_window.Render()\n    renderer.GetActiveCamera().SetPosition(-32.8, -12.3, 46.3)\n    renderer.GetActiveCamera().SetFocalPoint(8.3, 0.03, 29.8)\n    renderer.GetActiveCamera().SetViewUp(0.2, 0.5, 0.9)\n    render_window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/TextSource/","title":"TextSource","text":"

vtk-examples/Python/Visualization/TextSource

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/TextSource/#code","title":"Code","text":"

TextSource.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkTextSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    textSource = vtkTextSource()\n    textSource.SetText(\"Hello\")\n    textSource.SetForegroundColor(colors.GetColor3d('DarkSlateGray'))\n    textSource.SetBackgroundColor(colors.GetColor3d('NavajoWhite'))\n    # Turn off if you don't want the background drawn with the text.\n    textSource.BackingOn()\n    textSource.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(textSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('TextSource')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Bisque'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/VectorText/","title":"VectorText","text":"

vtk-examples/Python/Visualization/VectorText

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/VectorText/#code","title":"Code","text":"

VectorText.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    textSource = vtkVectorText()\n    textSource.SetText('Hello')\n    textSource.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(textSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('DarkSlateGray'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('VectorText')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Bisque'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Visualization/WindowTitle/","title":"WindowTitle","text":"

vtk-examples/Python/Visualization/WindowTitle

"},{"location":"Python/Visualization/WindowTitle/#description","title":"Description","text":"

This example demonstrates how to change the title of a render window.

  • Contributed by Bryan P. Conrad

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Visualization/WindowTitle/#code","title":"Code","text":"

WindowTitle.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(5)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphereSource.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # Setup a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    # renderWindow.SetWindowName('Test')\n\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Render and interact\n    renderWindow.Render()\n    # *** SetWindowName after renderWindow.Render() is called ***\n    renderWindow.SetWindowName('WindowTitle')\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/AnatomicalOrientation/","title":"AnatomicalOrientation","text":"

vtk-examples/Python/VisualizationAlgorithms/AnatomicalOrientation

"},{"location":"Python/VisualizationAlgorithms/AnatomicalOrientation/#description","title":"Description","text":"

This depicts a human figure transected by the three commonly used anatomical planes:

  • Sagittal plane \u2013 is perpendicular to the ground divides the body into a left section and a right section.
  • Coronal plane \u2013 is perpendicular to the ground and divides the body into a front (anterior) section and back (posterior) section.
  • Transverse plane \u2013 or axial plane is parallel to the ground divides the body into an upper (superior) section and a bottom (inferior) section.

Four annotated cube actors are also provided demonstrating different coordinate systems. The annotations on the faces of the cube actors are:

  • Sagittal plane
    • L - left.
    • R - right.
  • Coronal plane
    • A - anterior.
    • P - posterior.
  • Transverse plane
    • S - superior.
    • I - inferior.

The annotated cube actors demonstrate the various coordinate systems: - The anatomical coordinate system forming a 3D basis is defined along the anatomical axes of anterior-posterior, inferior-superior, and left-right. These are the positive directions. In a Cartesian system this is RPS (Right, Posterior, Superior). The top-left annotated cube actor shows this basis, this is a left-handed system. - RAS (Right, Anterior, Superior), left-right, posterior-anterior, and inferior-superior. This is the usual right-handed system used by VTK and Slicer. The bottom left annotated cube actor shows this basis. - LPS (Left, Posterior, Superior), right-left, anterior-posterior, and inferior-superior. This is used in DICOM images and by the ITK toolkit. The bottom right annotated cube actor shows this basis. - The upper right cube actor has no axes and simply shows the planes.

RPS is a left-handed system whilst RAS and LPS are right-handed.

Note that the text for the planes is carefully placed to avoid obstructing the figure and it also sits slightly above the plane.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/AnatomicalOrientation/#code","title":"Code","text":"

AnatomicalOrientation.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nThe human data file is taken from:\n  https://github.com/Slicer/Slicer/blob/master/Base/Logic/Resources/OrientationMarkers/Human.vtp\n  Thanks to the Slicer people for providing this.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import (\n    vtkAnnotatedCubeActor,\n    vtkAxesActor\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropAssembly,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Create a rendering window, renderer and interactor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.SetSize(780, 780)\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Make an annotated cube actor with axes and then add it into an orientation marker widget.\n    # Three of these need to be made.\n\n    # Right Posterior Superior\n    xyzLabels = ['X', 'Y', 'Z']\n    scale = [1.5, -1.5, 1.5]\n    axes = MakeCubeActor(scale, xyzLabels, colors)\n    om = vtkOrientationMarkerWidget()\n    om.SetOrientationMarker(axes)\n    # Position upper left in the viewport.\n    om.SetViewport(0.0, 0.8, 0.2, 1.0)\n    om.SetInteractor(iren)\n    om.EnabledOn()\n    om.InteractiveOn()\n\n    # Right, Anterior, Superior.\n    scale = [1.5, 1.5, 1.5]\n    axes1 = MakeCubeActor(scale, xyzLabels, colors)\n    om1 = vtkOrientationMarkerWidget()\n    om1.SetOrientationMarker(axes1)\n    # Position lower left in the viewport.\n    om1.SetViewport(0, 0, 0.2, 0.2)\n    om1.SetInteractor(iren)\n    om1.EnabledOn()\n    om1.InteractiveOn()\n\n    # Left, Posterior, Superior.\n    scale = (-1.5, -1.5, 1.5)\n    axes2 = MakeCubeActor(scale, xyzLabels, colors)\n    om2 = vtkOrientationMarkerWidget()\n    om2.SetOrientationMarker(axes2)\n    # Position lower right in the viewport.\n    om2.SetViewport(0.8, 0, 1.0, 0.2)\n    om2.SetInteractor(iren)\n    om2.EnabledOn()\n    om2.InteractiveOn()\n\n    # Finally create an annotated cube actor adding it into an orientation marker widget.\n    axes3 = MakeAnnotatedCubeActor(colors)\n    om3 = vtkOrientationMarkerWidget()\n    om3.SetOrientationMarker(axes3)\n    # Position upper right in the viewport.\n    om3.SetViewport(0.8, 0.8, 1.0, 1.0)\n    om3.SetInteractor(iren)\n    om3.EnabledOn()\n    om3.InteractiveOn()\n\n    # Read in the model.\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    humanMapper = vtkPolyDataMapper()\n    humanMapper.SetInputConnection(reader.GetOutputPort())\n    humanMapper.SetScalarModeToUsePointFieldData()\n    humanMapper.SelectColorArray('Color')\n    humanMapper.SetColorModeToDirectScalars()\n\n    humanActor = vtkActor()\n    humanActor.SetMapper(humanMapper)\n    bounds = humanActor.GetBounds()\n    # Scale the actor\n    humanActor.SetScale(1.0 / max(bounds))\n    ren.AddActor(humanActor)\n\n    # Make the planes.\n    actors = MakePlanesActors(colors)\n    for actor in actors:\n        ren.AddViewProp(actor)\n    # Label them.\n    textActors = AddTextToPlanes()\n    for actor in textActors:\n        ren.AddViewProp(actor)\n\n    # Interact\n    ren.SetBackground2(colors.GetColor3d('OldLace'))\n    ren.SetBackground(colors.GetColor3d('MistyRose'))\n    ren.GradientBackgroundOn()\n    ren.ResetCamera()\n    ren.GetActiveCamera().Zoom(1.6)\n    ren.GetActiveCamera().SetPosition(-2.3, 4.1, 4.2)\n    # ren.GetActiveCamera().SetPosition(-3.4, 5.5, 0.0)\n    ren.GetActiveCamera().SetViewUp(0.0, 0.0, 1.0)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    # Call SetWindowName after renWin.Render() is called.\n    renWin.SetWindowName('AnatomicalOrientation')\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Show a labelled set of anatomical planes transecting a human figure.'\n    epilogue = '''\n    Show a labelled set of anatomical planes transecting a human figure.\n    Annotated cube actors and axes for the various coordinate systems are also shown.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Human.vtp.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef MakeAxesActor(scale, xyzLabels):\n    \"\"\"\n    :param scale: Sets the scale and direction of the axes.\n    :param xyzLabels: Labels for the axes.\n    :return: The axes actor.\n    \"\"\"\n    axes = vtkAxesActor()\n    axes.SetScale(scale)\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText(xyzLabels[0])\n    axes.SetYAxisLabelText(xyzLabels[1])\n    axes.SetZAxisLabelText(xyzLabels[2])\n    axes.SetCylinderRadius(0.5 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.025 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.5 * axes.GetSphereRadius())\n    tprop = axes.GetXAxisCaptionActor2D().GetCaptionTextProperty()\n    tprop.ItalicOn()\n    tprop.ShadowOn()\n    tprop.SetFontFamilyToTimes()\n    # Use the same text properties on the other two axes.\n    axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    return axes\n\n\ndef MakeAnnotatedCubeActor(colors):\n    \"\"\"\n    :param colors: Used to determine the cube color.\n    :return: The annotated cube actor.\n    \"\"\"\n    # A cube with labeled faces.\n    cube = vtkAnnotatedCubeActor()\n    cube.SetXPlusFaceText('R')  # Right\n    cube.SetXMinusFaceText('L')  # Left\n    cube.SetYPlusFaceText('A')  # Anterior\n    cube.SetYMinusFaceText('P')  # Posterior\n    cube.SetZPlusFaceText('S')  # Superior/Cranial\n    cube.SetZMinusFaceText('I')  # Inferior/Caudal\n    cube.SetFaceTextScale(0.5)\n    cube.GetCubeProperty().SetColor(colors.GetColor3d('Gainsboro'))\n\n    cube.GetTextEdgesProperty().SetColor(colors.GetColor3d('LightSlateGray'))\n\n    # Change the vector text colors.\n    cube.GetXPlusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetXMinusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetYPlusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetYMinusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetZPlusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    cube.GetZMinusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    return cube\n\n\ndef MakeCubeActor(scale, xyzLabels, colors):\n    \"\"\"\n    :param scale: Sets the scale and direction of the axes.\n    :param xyzLabels: Labels for the axes.\n    :param colors: Used to set the colors of the cube faces.\n    :return: The combined axes and annotated cube prop.\n    \"\"\"\n    # We are combining a vtkAxesActor and a vtkAnnotatedCubeActor\n    # into a vtkPropAssembly\n    cube = MakeAnnotatedCubeActor(colors)\n    axes = MakeAxesActor(scale, xyzLabels)\n\n    # Combine orientation markers into one with an assembly.\n    assembly = vtkPropAssembly()\n    assembly.AddPart(axes)\n    assembly.AddPart(cube)\n    return assembly\n\n\ndef MakePlane(resolution, origin, point1, point2, wxyz, translate):\n    plane = vtkPlaneSource()\n    plane.SetResolution(*resolution)\n    plane.SetOrigin(origin)\n    plane.SetPoint1(point1)\n    plane.SetPoint2(point2)\n    trnf = vtkTransform()\n    trnf.RotateWXYZ(*wxyz)\n    trnf.Translate(translate)\n    tpdPlane = vtkTransformPolyDataFilter()\n    tpdPlane.SetTransform(trnf)\n    tpdPlane.SetInputConnection(plane.GetOutputPort())\n    return tpdPlane\n\n\ndef MakePlanesActors(colors):\n    \"\"\"\n    Make the traverse, coronal and saggital planes.\n    :param colors: Used to set the color of the planes.\n    :return: The planes actors.\n    \"\"\"\n    planes = list()\n    mappers = list()\n    actors = list()\n\n    # Parameters for a plane lying in the x-y plane.\n    resolution = [10, 10]\n    origin = [0.0, 0.0, 0.0]\n    point1 = [1, 0, 0]\n    point2 = [0, 1, 0]\n\n    planes.append(MakePlane(resolution, origin, point1, point2, [0, 0, 0, 0], [-0.5, -0.5, 0]))  # x-y plane\n    planes.append(MakePlane(resolution, origin, point1, point2, [-90, 1, 0, 0], [-0.5, -0.5, 0.0]))  # x-z plane\n    planes.append(MakePlane(resolution, origin, point1, point2, [-90, 0, 1, 0], [-0.5, -0.5, 0.0]))  # y-z plane\n    for plane in planes:\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(plane.GetOutputPort())\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n        mappers.append(mapper)\n        actors.append(actor)\n    actors[0].GetProperty().SetColor(colors.GetColor3d('SeaGreen'))  # Transverse plane\n    actors[1].GetProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))  # Coronal plane\n    actors[2].GetProperty().SetColor(colors.GetColor3d('Tomato'))  # Saggital plane\n    return actors\n\n\ndef AddTextToPlanes():\n    \"\"\"\n    Generate text to place on the planes.\n    Careful placement is needed here.\n    :return: The text actors.\n    \"\"\"\n    textActors = list()\n    scale = [0.04, 0.04, 0.04]\n\n    text1 = vtkVectorText()\n    text1.SetText('Transverse\\nPlane\\n\\nSuperior\\nCranial')\n    trnf1 = vtkTransform()\n    trnf1.RotateZ(-90)\n    tpdPlane1 = vtkTransformPolyDataFilter()\n    tpdPlane1.SetTransform(trnf1)\n    tpdPlane1.SetInputConnection(text1.GetOutputPort())\n    textMapper1 = vtkPolyDataMapper()\n    textMapper1.SetInputConnection(tpdPlane1.GetOutputPort())\n    textActor1 = vtkActor()\n    textActor1.SetMapper(textMapper1)\n    textActor1.SetScale(scale)\n    textActor1.AddPosition(0.4, 0.49, 0.01)\n    textActors.append(textActor1)\n\n    text2 = vtkVectorText()\n    text2.SetText('Transverse\\nPlane\\n\\nInferior\\n(Caudal)')\n    trnf2 = vtkTransform()\n    trnf2.RotateZ(270)\n    trnf2.RotateWXYZ(*[180, 0, 1, 0])\n    tpdPlane2 = vtkTransformPolyDataFilter()\n    tpdPlane2.SetTransform(trnf2)\n    tpdPlane2.SetInputConnection(text2.GetOutputPort())\n    textMapper2 = vtkPolyDataMapper()\n    textMapper2.SetInputConnection(tpdPlane2.GetOutputPort())\n    textActor2 = vtkActor()\n    textActor2.SetMapper(textMapper2)\n    textActor2.SetScale(scale)\n    textActor2.AddPosition(0.4, -0.49, -0.01)\n    textActors.append(textActor2)\n\n    text3 = vtkVectorText()\n    text3.SetText('Sagittal\\nPlane\\n\\nLeft')\n    trnf3 = vtkTransform()\n    trnf3.RotateX(90)\n    trnf3.RotateWXYZ(*[-90, 0, 1, 0])\n    tpdPlane3 = vtkTransformPolyDataFilter()\n    tpdPlane3.SetTransform(trnf3)\n    tpdPlane3.SetInputConnection(text3.GetOutputPort())\n    textMapper3 = vtkPolyDataMapper()\n    textMapper3.SetInputConnection(tpdPlane3.GetOutputPort())\n    textActor3 = vtkActor()\n    textActor3.SetMapper(textMapper3)\n    textActor3.SetScale(scale)\n    textActor3.AddPosition(-0.01, 0.49, 0.4)\n    textActors.append(textActor3)\n\n    text4 = vtkVectorText()\n    text4.SetText('Sagittal\\nPlane\\n\\nRight')\n    trnf4 = vtkTransform()\n    trnf4.RotateX(90)\n    trnf4.RotateWXYZ(*[-270, 0, 1, 0])\n    tpdPlane4 = vtkTransformPolyDataFilter()\n    tpdPlane4.SetTransform(trnf4)\n    tpdPlane4.SetInputConnection(text4.GetOutputPort())\n    textMapper4 = vtkPolyDataMapper()\n    textMapper4.SetInputConnection(tpdPlane4.GetOutputPort())\n    textActor4 = vtkActor()\n    textActor4.SetMapper(textMapper4)\n    textActor4.SetScale(scale)\n    textActor4.AddPosition(0.01, -0.49, 0.4)\n    textActors.append(textActor4)\n\n    text5 = vtkVectorText()\n    text5.SetText('Coronal\\nPlane\\n\\nAnterior')\n    trnf5 = vtkTransform()\n    trnf5.RotateY(-180)\n    trnf5.RotateWXYZ(*[-90, 1, 0, 0])\n    tpdPlane5 = vtkTransformPolyDataFilter()\n    tpdPlane5.SetTransform(trnf5)\n    tpdPlane5.SetInputConnection(text5.GetOutputPort())\n    textMapper5 = vtkPolyDataMapper()\n    textMapper5.SetInputConnection(tpdPlane5.GetOutputPort())\n    textActor5 = vtkActor()\n    textActor5.SetMapper(textMapper5)\n    textActor5.SetScale(scale)\n    textActor5.AddPosition(0.49, 0.01, 0.20)\n    textActors.append(textActor5)\n\n    text6 = vtkVectorText()\n    text6.SetText('Coronal\\nPlane\\n\\nPosterior')\n    trnf6 = vtkTransform()\n    trnf6.RotateWXYZ(*[90, 1, 0, 0])\n    tpdPlane6 = vtkTransformPolyDataFilter()\n    tpdPlane6.SetTransform(trnf6)\n    tpdPlane6.SetInputConnection(text6.GetOutputPort())\n    textMapper6 = vtkPolyDataMapper()\n    textMapper6.SetInputConnection(tpdPlane6.GetOutputPort())\n    textActor6 = vtkActor()\n    textActor6.SetMapper(textMapper6)\n    textActor6.SetScale(scale)\n    textActor6.AddPosition(-0.49, -0.01, 0.3)\n    textActors.append(textActor6)\n    return textActors\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/BluntStreamlines/","title":"BluntStreamlines","text":"

vtk-examples/Python/VisualizationAlgorithms/BluntStreamlines

"},{"location":"Python/VisualizationAlgorithms/BluntStreamlines/#description","title":"Description","text":"

This example shows airflow around a blunt fin. This example consists of a wall with half a rounded fin projecting into the fluid flow. (Using arguments of symmetry, only half of the domain was modeled.) Twenty-five streamlines are released upstream of the fin. The boundary layer effects near the junction of the fin and wall are clearly evident from the streamlines. In this area, flow recirculation is apparent, as well as the reduced flow speed.

Info

See Figure 6-19 in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/BluntStreamlines/#code","title":"Code","text":"

BluntStreamlines.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFilename, qFilename = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    aren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(aren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    scalarRange = [0.0] * 2\n    c = [0.0] * 3\n    maxTime = 0.0\n\n    reader = vtkMultiBlockPLOT3DReader()\n    reader.SetXYZFileName(xyzFilename)\n    reader.SetQFileName(qFilename)\n    reader.Update()  # Force a read to occur.\n\n    pd = reader.GetOutput().GetBlock(0)\n    pd.GetCenter(c)\n    if pd.GetPointData().GetScalars():\n        pd.GetPointData().GetScalars().GetRange(scalarRange)\n    if pd.GetPointData().GetVectors():\n        maxVelocity = pd.GetPointData().GetVectors().GetMaxNorm()\n        maxTime = 20.0 * pd.GetLength() / maxVelocity\n\n    outlineF = vtkStructuredGridOutlineFilter()\n    outlineF.SetInputData(pd)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outlineF.GetOutputPort())\n\n    outline = vtkActor()\n    outline.SetMapper(outlineMapper)\n    outline.GetProperty().SetColor(colors.GetColor3d('Moccasin'))\n    outline.GetProperty().SetLineWidth(2.0)\n\n    #\n    # Some geometry for context\n    #\n    wall = vtkStructuredGridGeometryFilter()\n    wall.SetInputData(pd)\n    wall.SetExtent(0, 100, 0, 100, 0, 0)\n\n    wallMap = vtkPolyDataMapper()\n    wallMap.SetInputConnection(wall.GetOutputPort())\n    wallMap.ScalarVisibilityOff()\n\n    wallActor = vtkActor()\n    wallActor.SetMapper(wallMap)\n    wallActor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    fin = vtkStructuredGridGeometryFilter()\n    fin.SetInputData(pd)\n    fin.SetExtent(0, 100, 0, 0, 0, 100)\n\n    finMap = vtkPolyDataMapper()\n    finMap.SetInputConnection(fin.GetOutputPort())\n    finMap.ScalarVisibilityOff()\n\n    finActor = vtkActor()\n    finActor.SetMapper(finMap)\n    finActor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n    #\n    # regular streamlines\n    #\n    line1 = vtkLineSource()\n    line1.SetResolution(25)\n    line1.SetPoint1(-6.36, 0.25, 0.06)\n    line1.SetPoint2(-6.36, 0.25, 5.37)\n\n    rakeMapper = vtkPolyDataMapper()\n    rakeMapper.SetInputConnection(line1.GetOutputPort())\n\n    rake1 = vtkActor()\n    rake1.SetMapper(rakeMapper)\n    rake1.GetProperty().SetColor(colors.GetColor3d('Black'))\n    rake1.GetProperty().SetLineWidth(5)\n\n    streamers = vtkStreamTracer()\n    # streamers.DebugOn()\n    streamers.SetInputConnection(reader.GetOutputPort())\n    streamers.SetSourceConnection(line1.GetOutputPort())\n    streamers.SetMaximumPropagation(maxTime)\n    streamers.SetInitialIntegrationStep(0.2)\n    streamers.SetMinimumIntegrationStep(0.01)\n    streamers.SetIntegratorType(2)\n    streamers.Update()\n\n    streamersMapper = vtkPolyDataMapper()\n    streamersMapper.SetInputConnection(streamers.GetOutputPort())\n    streamersMapper.SetScalarRange(scalarRange)\n\n    lines = vtkActor()\n    lines.SetMapper(streamersMapper)\n\n    aren.AddActor(outline)\n    aren.AddActor(wallActor)\n    aren.AddActor(finActor)\n    aren.AddActor(rake1)\n    aren.AddActor(lines)\n    aren.SetBackground(colors.GetColor3d('Gray'))\n\n    aren.ResetCamera()\n    aren.GetActiveCamera().Elevation(30.0)\n    aren.GetActiveCamera().Azimuth(30.0)\n    aren.GetActiveCamera().Dolly(1.2)\n    aren.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('BluntStreamlines')\n    renWin.Render()\n\n    # Interact with the data.\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This example shows airflow around a blunt fin.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='bluntfinxyz.bin.')\n    parser.add_argument('filename2', help='bluntfinq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/CarotidFlow/","title":"CarotidFlow","text":"

vtk-examples/Python/VisualizationAlgorithms/CarotidFlow

"},{"location":"Python/VisualizationAlgorithms/CarotidFlow/#description","title":"Description","text":"

This example generates streamtubes of blood velocity. an isosurface of speed provides context. The starting positions for the streamtubes were determined by experimenting with the data. Because of the way the data was measured and the resolution of the velocity field, many streamers travel outside the artery. This is because the boundary layer of the blood flow is not captured due to limitations in data resolution. Consequently, as the blood flows around curves, there is a component of the velocity field that directs the streamtube outside the artery. As a result it is hard to find starting positions for the streamtubes that yield interesting results. The examples uses the source object vtkPointSource in combination with vtkThresholdPoints to work around this problem. vtkPointSource generates random points centered around a sphere of a specified radius. We need only find an approximate position for the starting points of the streamtubes and then generate a cloud of random seed points. vtkThresholdPoints is used to cull points that may be generated outside the regions of high flow velocity.

Cite

See 3D Phase Contrast MRI of Cerebral Blood Flow and Surface Anatomy for background.

Info

See Figure 6-44 in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/CarotidFlow/#code","title":"Code","text":"

CarotidFlow.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkThresholdPoints,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    #\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(fileName)\n\n    psource = vtkPointSource()\n    psource.SetNumberOfPoints(25)\n    psource.SetCenter(133.1, 116.3, 5.0)\n    psource.SetRadius(2.0)\n\n    threshold = vtkThresholdPoints()\n    threshold.SetInputConnection(reader.GetOutputPort())\n    threshold.ThresholdByUpper(275)\n\n    streamers = vtkStreamTracer()\n    streamers.SetInputConnection(reader.GetOutputPort())\n    streamers.SetSourceConnection(psource.GetOutputPort())\n    # streamers.SetMaximumPropagationUnitToTimeUnit()\n    streamers.SetMaximumPropagation(100.0)\n    # streamers.SetInitialIntegrationStepUnitToCellLengthUnit()\n    streamers.SetInitialIntegrationStep(0.2)\n    streamers.SetTerminalSpeed(.01)\n    streamers.Update()\n    scalarRange = [0] * 2\n    scalarRange[0] = streamers.GetOutput().GetPointData().GetScalars().GetRange()[0]\n    scalarRange[1] = streamers.GetOutput().GetPointData().GetScalars().GetRange()[1]\n    print(\"range: \", scalarRange[0], \", \", scalarRange[1])\n\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(streamers.GetOutputPort())\n    tubes.SetRadius(0.3)\n    tubes.SetNumberOfSides(6)\n    tubes.SetVaryRadius(0)\n\n    lut = vtkLookupTable()\n    lut.SetHueRange(.667, 0.0)\n    lut.Build()\n\n    streamerMapper = vtkPolyDataMapper()\n    streamerMapper.SetInputConnection(tubes.GetOutputPort())\n    streamerMapper.SetScalarRange(scalarRange[0], scalarRange[1])\n    streamerMapper.SetLookupTable(lut)\n\n    streamerActor = vtkActor()\n    streamerActor.SetMapper(streamerMapper)\n\n    # Speed contours.\n    iso = vtkContourFilter()\n    iso.SetInputConnection(reader.GetOutputPort())\n    iso.SetValue(0, 175)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(iso.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetRepresentationToWireframe()\n    isoActor.GetProperty().SetOpacity(0.25)\n\n    # Outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d(\"Black\"))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(streamerActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d(\"Wheat\"))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CarotidFlow')\n\n    cam1 = vtkCamera()\n    cam1.SetClippingRange(17.4043, 870.216)\n    cam1.SetFocalPoint(136.71, 104.025, 23)\n    cam1.SetPosition(204.747, 258.939, 63.7925)\n    cam1.SetViewUp(-0.102647, -0.210897, 0.972104)\n    cam1.Zoom(1.2)\n    ren1.SetActiveCamera(cam1)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Visualizing blood flow in human carotid arteries.'\n    epilogue = '''\n    Streamtubes of blood velocity are generated. \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='carotid.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/CarotidFlowGlyphs/","title":"CarotidFlowGlyphs","text":"

vtk-examples/Python/VisualizationAlgorithms/CarotidFlowGlyphs

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/CarotidFlowGlyphs/#code","title":"Code","text":"

CarotidFlowGlyphs.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkGlyph3D,\n    vtkMaskPoints,\n    vtkThresholdPoints\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    #\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(fileName)\n\n    threshold = vtkThresholdPoints()\n    threshold.SetInputConnection(reader.GetOutputPort())\n    threshold.ThresholdByUpper(200)\n\n    mask = vtkMaskPoints()\n    mask.SetInputConnection(threshold.GetOutputPort())\n    mask.SetOnRatio(5)\n\n    cone = vtkConeSource()\n    cone.SetResolution(11)\n    cone.SetHeight(1)\n    cone.SetRadius(0.25)\n\n    cones = vtkGlyph3D()\n    cones.SetInputConnection(mask.GetOutputPort())\n    cones.SetSourceConnection(cone.GetOutputPort())\n    cones.SetScaleFactor(0.4)\n    cones.SetScaleModeToScaleByVector()\n\n    lut = vtkLookupTable()\n    lut.SetHueRange(.667, 0.0)\n    lut.Build()\n\n    scalarRange = [0] * 2\n    cones.Update()\n    scalarRange[0] = cones.GetOutput().GetPointData().GetScalars().GetRange()[0]\n    scalarRange[1] = cones.GetOutput().GetPointData().GetScalars().GetRange()[1]\n    print(\"range: \", scalarRange[0], \", \", scalarRange[1])\n\n    vectorMapper = vtkPolyDataMapper()\n    vectorMapper.SetInputConnection(cones.GetOutputPort())\n    vectorMapper.SetScalarRange(scalarRange[0], scalarRange[1])\n    vectorMapper.SetLookupTable(lut)\n\n    vectorActor = vtkActor()\n    vectorActor.SetMapper(vectorMapper)\n\n    # Speed contours.\n    iso = vtkContourFilter()\n    iso.SetInputConnection(reader.GetOutputPort())\n    iso.SetValue(0, 175)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(iso.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetRepresentationToWireframe()\n    isoActor.GetProperty().SetOpacity(0.25)\n\n    # Outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d(\"Black\"))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(vectorActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d(\"Wheat\"))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CarotidFlowGlyphs')\n\n    cam1 = vtkCamera()\n    cam1.SetClippingRange(17.4043, 870.216)\n    cam1.SetFocalPoint(136.71, 104.025, 23)\n    cam1.SetPosition(204.747, 258.939, 63.7925)\n    cam1.SetViewUp(-0.102647, -0.210897, 0.972104)\n    cam1.Zoom(1.2)\n    ren1.SetActiveCamera(cam1)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Visualizing blood flow in human carotid arteries.'\n    epilogue = '''\n    Cone glyphs indicate flow direction and magnitude. \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='carotid.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/ClipSphereCylinder/","title":"ClipSphereCylinder","text":"

vtk-examples/Python/VisualizationAlgorithms/ClipSphereCylinder

"},{"location":"Python/VisualizationAlgorithms/ClipSphereCylinder/#description","title":"Description","text":"

Clipping is implemented in vtkClipPolyData . Each polygonal data primitive implements the operation in its Clip() method using case tables. vtkClipPolyData has methods to control whether an implicit function provides the scalar data or whether the dataset\u2019s scalar data will be used. ComputeScalarDataOn() uses the implicit function and ComputeScalarDataOff() uses the dataset\u2019s scalar data. Two output polygonal datasets are produced. These are accessed with GetOutput() and GetClippedOutput() methods. GetOutput() returns the polygonal data that is \u201cinside\u201d the clipping region while GetClippedOutput() returns polygonal data that is \u201coutside\u201d the region. (Note that GenerateClippedOutputOn() must be enabled if you are to get the clipped output.) The meaning of inside and outside can be reversed using the InsideOutOn().

This example shows a plane of quadrilaterals clipped with a boolean implicit function.

Info

See Figure 9-48 in Chapter 9 The VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/ClipSphereCylinder/#code","title":"Code","text":"

ClipSphereCylinder.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCylinder,\n    vtkImplicitBoolean,\n    vtkSphere\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkClipPolyData\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Demonstrate the use of clipping on polygonal data\n    #\n\n    # create pipeline\n    #\n    plane = vtkPlaneSource()\n    plane.SetXResolution(25)\n    plane.SetYResolution(25)\n    plane.SetOrigin(-1, -1, 0)\n    plane.SetPoint1(1, -1, 0)\n    plane.SetPoint2(-1, 1, 0)\n\n    transformSphere = vtkTransform()\n    transformSphere.Identity()\n    transformSphere.Translate(0.4, -0.4, 0)\n    transformSphere.Inverse()\n\n    sphere = vtkSphere()\n    sphere.SetTransform(transformSphere)\n    sphere.SetRadius(.5)\n\n    transformCylinder = vtkTransform()\n    transformCylinder.Identity()\n    transformCylinder.Translate(-0.4, 0.4, 0)\n    transformCylinder.RotateZ(30)\n    transformCylinder.RotateY(60)\n    transformCylinder.RotateX(90)\n    transformCylinder.Inverse()\n\n    cylinder = vtkCylinder()\n    cylinder.SetTransform(transformCylinder)\n    cylinder.SetRadius(.3)\n\n    boolean = vtkImplicitBoolean()\n    boolean.AddFunction(cylinder)\n    boolean.AddFunction(sphere)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(plane.GetOutputPort())\n    clipper.SetClipFunction(boolean)\n    clipper.GenerateClippedOutputOn()\n    clipper.GenerateClipScalarsOn()\n    clipper.SetValue(0)\n\n    clipMapper = vtkPolyDataMapper()\n    clipMapper.SetInputConnection(clipper.GetOutputPort())\n    clipMapper.ScalarVisibilityOff()\n\n    clipActor = vtkActor()\n    clipActor.SetMapper(clipMapper)\n    clipActor.GetProperty().SetDiffuseColor(colors.GetColor3d('MidnightBlue'))\n    clipActor.GetProperty().SetRepresentationToWireframe()\n\n    clipInsideMapper = vtkPolyDataMapper()\n    clipInsideMapper.SetInputData(clipper.GetClippedOutput())\n    clipInsideMapper.ScalarVisibilityOff()\n\n    clipInsideActor = vtkActor()\n    clipInsideActor.SetMapper(clipInsideMapper)\n    clipInsideActor.GetProperty().SetDiffuseColor(colors.GetColor3d('LightBlue'))\n\n    # Create graphics stuff\n    #\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetWindowName('ClipSphereCylinder')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren1.AddActor(clipActor)\n\n    ren1.AddActor(clipInsideActor)\n    ren1.SetBackground(colors.GetColor3d('Wheat'))\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Dolly(1.4)\n    ren1.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 480)\n\n    # render the image\n    #\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/CombustorIsosurface/","title":"CombustorIsosurface","text":"

vtk-examples/Python/VisualizationAlgorithms/CombustorIsosurface

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/CombustorIsosurface/#code","title":"Code","text":"

CombustorIsosurface.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkPolyDataNormals,\n    vtkStructuredGridOutlineFilter\n)\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFile, qFile = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    #\n\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(xyzFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    iso = vtkContourFilter()\n    iso.SetInputData(pl3d.GetOutput().GetBlock(0))\n    iso.SetValue(0, 0.38)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(iso.GetOutputPort())\n    normals.SetFeatureAngle(45)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(normals.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d('WhiteSmoke'))\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputConnection(pl3d.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CombustorIsosurface')\n\n    ren1.GetActiveCamera().SetFocalPoint(9.71821, 0.458166, 29.3999)\n    ren1.GetActiveCamera().SetPosition(2.7439, -37.3196, 38.7167)\n    ren1.GetActiveCamera().SetViewUp(-0.16123, 0.264271, 0.950876)\n    ren1.GetActiveCamera().Zoom(1.3)\n    ren1.ResetCameraClippingRange()\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Marching cubes surface of flow density.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/ContourQuadric/","title":"ContourQuadric","text":"

vtk-examples/Python/VisualizationAlgorithms/ContourQuadric

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/ContourQuadric/#code","title":"Code","text":"

ContourQuadric.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    aren = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(aren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # Create surfaces F(x,y,z) = constant\n    #\n    # Sample quadric function\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0)\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(50, 50, 50)\n    sample.SetImplicitFunction(quadric)\n\n    contour = vtkContourFilter()\n    contour.SetInputConnection(sample.GetOutputPort())\n    contour.GenerateValues(5, 0, 1.2)\n\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contour.GetOutputPort())\n    contourMapper.SetScalarRange(0, 1.2)\n\n    contourActor = vtkActor()\n    contourActor.SetMapper(contourMapper)\n\n    # Create outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(sample.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d(\"Brown\"))\n    outlineActor.GetProperty().SetLineWidth(3.0)\n\n    #\n    # Rendering stuff\n    #\n    aren.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    aren.AddActor(contourActor)\n    aren.AddActor(outlineActor)\n\n    aren.ResetCamera()\n    aren.GetActiveCamera().Azimuth(30)\n    aren.GetActiveCamera().Elevation(30)\n\n    renWin.SetSize(640, 512)\n    renWin.SetWindowName('ContourQuadric')\n    renWin.Render()\n\n    # interact with data\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/CreateBFont/","title":"CreateBFont","text":"

vtk-examples/Python/VisualizationAlgorithms/CreateBFont

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/CreateBFont/#code","title":"Code","text":"

CreateBFont.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkClipPolyData\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkIOImage import vtkPNMReader\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Now create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    imageIn = vtkPNMReader()\n    imageIn.SetFileName(fileName)\n\n    gaussian = vtkImageGaussianSmooth()\n    gaussian.SetStandardDeviations(2, 2)\n    gaussian.SetDimensionality(2)\n    gaussian.SetRadiusFactors(1, 1)\n    gaussian.SetInputConnection(imageIn.GetOutputPort())\n\n    geometry = vtkImageDataGeometryFilter()\n    geometry.SetInputConnection(gaussian.GetOutputPort())\n\n    aClipper = vtkClipPolyData()\n    aClipper.SetInputConnection(geometry.GetOutputPort())\n    aClipper.SetValue(127.5)\n    aClipper.GenerateClipScalarsOff()\n    aClipper.InsideOutOn()\n    aClipper.GetOutput().GetPointData().CopyScalarsOff()\n    aClipper.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(aClipper.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    letter = vtkActor()\n    letter.SetMapper(mapper)\n\n    ren1.AddActor(letter)\n    letter.GetProperty().SetDiffuseColor(colors.GetColor3d(\"LampBlack\"))\n    letter.GetProperty().SetRepresentationToWireframe()\n\n    ren1.SetBackground(colors.GetColor3d(\"WhiteSmoke\"))\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Dolly(1.2)\n    ren1.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CreateBFont')\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'A scanned image clipped with a scalar value.'\n    epilogue = '''\n    A scanned image clipped with a scalar value of 1/2 its maximum intensity\n     produces a mixture of quadrilaterals and triangles.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='B.pgm.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/CutStructuredGrid/","title":"CutStructuredGrid","text":"

vtk-examples/Python/VisualizationAlgorithms/CutStructuredGrid

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/CutStructuredGrid/#code","title":"Code","text":"

CutStructuredGrid.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCutter,\n    vtkStructuredGridOutlineFilter\n)\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFile, qFile = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # The cut data.\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(xyzFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    sg = pl3d.GetOutput().GetBlock(0)\n\n    plane = vtkPlane()\n    plane.SetOrigin(sg.GetCenter())\n    plane.SetNormal(-0.287, 0, 0.9579)\n\n    planeCut = vtkCutter()\n    planeCut.SetInputData(pl3d.GetOutput().GetBlock(0))\n    planeCut.SetCutFunction(plane)\n\n    cutMapper = vtkDataSetMapper()\n    cutMapper.SetInputConnection(planeCut.GetOutputPort())\n    cutMapper.SetScalarRange(sg.GetPointData().GetScalars().GetRange())\n\n    cutActor = vtkActor()\n    cutActor.SetMapper(cutMapper)\n\n    # Extract the plane.\n    compPlane = vtkStructuredGridGeometryFilter()\n    compPlane.SetInputData(sg)\n    compPlane.SetExtent(0, 100, 0, 100, 9, 9)\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputConnection(compPlane.GetOutputPort())\n    planeMapper.ScalarVisibilityOff()\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n    planeActor.GetProperty().SetRepresentationToWireframe()\n    planeActor.GetProperty().SetColor(colors.GetColor3d('Wheat'))\n\n    # Outline.\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3d.GetOutput().GetBlock(0))\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Wheat'))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(planeActor)\n    ren1.AddActor(cutActor)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CutStructuredGrid')\n\n    camera = ren1.GetActiveCamera()\n    camera.SetPosition(5.02611, -23.535, 50.3979)\n    camera.SetFocalPoint(9.33614, 0.0414149, 30.112)\n    camera.SetViewUp(-0.0676794, 0.657814, 0.750134)\n    camera.SetDistance(31.3997)\n    camera.SetClippingRange(12.1468, 55.8147)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Cut through structured grid with plane.'\n    epilogue = '''\n    The cut plane is shown solid shaded.\n    A computational plane of constant k value is shown in wireframe for comparison.\n    The colors correspond to flow density.\n    Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders,\n     and quadrics can also be used.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/CutWithCutFunction/","title":"CutWithCutFunction","text":"

vtk-examples/Python/VisualizationAlgorithms/CutWithCutFunction

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/CutWithCutFunction/#code","title":"Code","text":"

CutWithCutFunction.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import vtkCutter\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName, numberOfCuts = get_program_parameters()\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    bounds = reader.GetOutput().GetBounds()\n    print('Bounds:', ', '.join(['{:.3f}'.format(f) for f in bounds]))\n\n    plane = vtkPlane()\n    plane.SetOrigin((bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0, bounds[4])\n    plane.SetNormal(0, 0, 1)\n\n    # Create cutter\n    high = plane.EvaluateFunction((bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0, bounds[5])\n\n    cutter = vtkCutter()\n    cutter.SetInputConnection(reader.GetOutputPort())\n    cutter.SetCutFunction(plane)\n    cutter.GenerateValues(numberOfCuts, 0.99, 0.99 * high)\n\n    cutterMapper = vtkPolyDataMapper()\n    cutterMapper.SetInputConnection(cutter.GetOutputPort())\n    cutterMapper.ScalarVisibilityOff()\n\n    # Create cut actor\n    cutterActor = vtkActor()\n    cutterActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    cutterActor.GetProperty().SetLineWidth(2)\n    cutterActor.SetMapper(cutterMapper)\n\n    # Create model actor\n    modelMapper = vtkPolyDataMapper()\n    modelMapper.SetInputConnection(reader.GetOutputPort())\n    modelMapper.ScalarVisibilityOff()\n\n    modelActor = vtkActor()\n    modelActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n    modelActor.SetMapper(modelMapper)\n\n    # Create renderers and add actors of plane and model\n    renderer = vtkRenderer()\n    renderer.AddActor(cutterActor)\n    renderer.AddActor(modelActor)\n\n    # Add renderer to renderwindow and render\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(600, 600)\n    renderWindow.SetWindowName('CutWithCutFunction')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.SetBackground(colors.GetColor3d('Burlywood'))\n    renderer.GetActiveCamera().SetPosition(0, -1, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    renderer.ResetCamera()\n    renderWindow.Render()\n\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Cut with a cut function.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Torso.vtp')\n    parser.add_argument('numberOfCuts', default=10, type=int, nargs='?', help='The number of cuts e.g 10.')\n    args = parser.parse_args()\n    return args.filename, args.numberOfCuts\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/CutWithScalars/","title":"CutWithScalars","text":"

vtk-examples/Python/VisualizationAlgorithms/CutWithScalars

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/CutWithScalars/#code","title":"Code","text":"

CutWithScalars.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    inputFilename, numberOfCuts = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(inputFilename)\n    reader.Update()\n\n    bounds = reader.GetOutput().GetBounds()\n    print(bounds)\n\n    plane = vtkPlane()\n    plane.SetOrigin((bounds[1] + bounds[0]) / 2.0,\n                    (bounds[3] + bounds[2]) / 2.0,\n                    (bounds[5] + bounds[4]) / 2.0)\n    plane.SetNormal(0, 0, 1)\n\n    # Create Scalars.\n    scalars = vtkDoubleArray()\n    numberOfPoints = reader.GetOutput().GetNumberOfPoints()\n    scalars.SetNumberOfTuples(numberOfPoints)\n    pts = reader.GetOutput().GetPoints()\n    for i in range(0, numberOfPoints):\n        point = pts.GetPoint(i)\n        scalars.SetTuple1(i, plane.EvaluateFunction(point))\n    reader.GetOutput().GetPointData().SetScalars(scalars)\n    reader.GetOutput().GetPointData().GetScalars().GetRange()\n\n    # Create the cutter.\n    cutter = vtkContourFilter()\n    cutter.SetInputConnection(reader.GetOutputPort())\n    cutter.ComputeScalarsOff()\n    cutter.ComputeNormalsOff()\n    cutter.GenerateValues(\n        numberOfCuts,\n        0.99 * reader.GetOutput().GetPointData().GetScalars().GetRange()[0],\n        0.99 * reader.GetOutput().GetPointData().GetScalars().GetRange()[1])\n\n    cutterMapper = vtkPolyDataMapper()\n    cutterMapper.SetInputConnection(cutter.GetOutputPort())\n    cutterMapper.ScalarVisibilityOff()\n\n    # Create the cut actor.\n    cutterActor = vtkActor()\n    cutterActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    cutterActor.GetProperty().SetLineWidth(2)\n    cutterActor.SetMapper(cutterMapper)\n\n    # Create the model actor\n    modelMapper = vtkPolyDataMapper()\n    modelMapper.SetInputConnection(reader.GetOutputPort())\n    modelMapper.ScalarVisibilityOff()\n\n    modelActor = vtkActor()\n    modelActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n    modelActor.SetMapper(modelMapper)\n\n    # Create renderers and add the plane and model actors.\n    renderer = vtkRenderer()\n    renderer.AddActor(cutterActor)\n    renderer.AddActor(modelActor)\n\n    # Add renderer to renderwindow and render\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(600, 600)\n    renderWindow.SetWindowName('CutWithCutScalars')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.SetBackground(colors.GetColor3d('Burlywood'))\n    renderer.GetActiveCamera().SetPosition(0, -1, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    renderer.ResetCamera()\n    renderWindow.Render()\n\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Cutting a surface model of the skin with a series of planes produces contour lines.'\n    epilogue = '''\n    Lines are wrapped with tubes for visual clarity.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='Torso.vtp.')\n    parser.add_argument('-n', type=int, default=20, help='Number of cuts.')\n    args = parser.parse_args()\n    return args.filename1, args.n\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/Cutter/","title":"Cutter","text":"

vtk-examples/Python/VisualizationAlgorithms/Cutter

"},{"location":"Python/VisualizationAlgorithms/Cutter/#description","title":"Description","text":"

This example demonstrates how to use vtkCutter by cutting through a cube.

  • Contributed by Jothy

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/Cutter/#code","title":"Code","text":"

Cutter.py

#!/usr/bin/env python\n\n# A simple script to demonstrate the vtkCutter function\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import vtkCutter\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a cube\n    cube = vtkCubeSource()\n    cube.SetXLength(40)\n    cube.SetYLength(30)\n    cube.SetZLength(20)\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputConnection(cube.GetOutputPort())\n\n    # create a plane to cut,here it cuts in the XZ direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0)\n    plane = vtkPlane()\n    plane.SetOrigin(10, 0, 0)\n    plane.SetNormal(1, 0, 0)\n\n    # create cutter\n    cutter = vtkCutter()\n    cutter.SetCutFunction(plane)\n    cutter.SetInputConnection(cube.GetOutputPort())\n    cutter.Update()\n    cutterMapper = vtkPolyDataMapper()\n    cutterMapper.SetInputConnection(cutter.GetOutputPort())\n\n    # create plane actor\n    planeActor = vtkActor()\n    planeActor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n    planeActor.GetProperty().SetLineWidth(2)\n    planeActor.GetProperty().SetAmbient(1.0)\n    planeActor.GetProperty().SetDiffuse(0.0)\n    planeActor.SetMapper(cutterMapper)\n\n    # create cube actor\n    cubeActor = vtkActor()\n    cubeActor.GetProperty().SetColor(colors.GetColor3d('Aquamarine'))\n    cubeActor.GetProperty().SetOpacity(0.5)\n    cubeActor.SetMapper(cubeMapper)\n\n    # create renderers and add actors of plane and cube\n    ren = vtkRenderer()\n    ren.AddActor(planeActor)\n    ren.AddActor(cubeActor)\n    ren.SetBackground(colors.GetColor3d('Silver'))\n\n    # Add renderer to renderwindow and render\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName('Cutter')\n    renWin.Render()\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    camera = ren.GetActiveCamera()\n    camera.SetPosition(-37.2611, -86.2155, 44.841)\n    camera.SetFocalPoint(0.569422, -1.65124, -2.49482)\n    camera.SetViewUp(0.160129, 0.42663, 0.890138)\n    camera.SetDistance(104.033)\n    camera.SetClippingRange(55.2019, 165.753)\n\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/DataSetSurface/","title":"DataSetSurface","text":"

vtk-examples/Python/VisualizationAlgorithms/DataSetSurface

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/DataSetSurface/#code","title":"Code","text":"

DataSetSurface.py

#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkHexahedron,\n    vtkPlane,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkCutter\nfrom vtkmodules.vtkFiltersGeometry import vtkDataSetSurfaceFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Setup the coordinates of eight points\n    # (the two faces must be in counter clockwise order as viewed from the\n    # outside)\n    pointCoords = [\n        [0.0, 0.0, 0.0],\n        [1.0, 0.0, 0.0],\n        [1.0, 1.0, 0.0],\n        [0.0, 1.0, 0.0],\n        [0.0, 0.0, 1.0],\n        [1.0, 0.0, 1.0],\n        [1.0, 1.0, 1.0],\n        [0.0, 1.0, 1.0]\n    ]\n\n    # Create the points and a hexahedron from the points.\n    points = vtkPoints()\n    hexa = vtkHexahedron()\n    for i, pointCoord in enumerate(pointCoords):\n        points.InsertNextPoint(pointCoord)\n        hexa.GetPointIds().SetId(i, i)\n\n    # Add the hexahedron to a cell array.\n    hexs = vtkCellArray()\n    hexs.InsertNextCell(hexa)\n\n    # Add the points and hexahedron to an unstructured grid.\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(hexa.GetCellType(), hexa.GetPointIds())\n\n    # Extract the outer (polygonal) surface.\n    surface = vtkDataSetSurfaceFilter()\n    surface.SetInputData(uGrid)\n    surface.Update()\n\n    aBeamMapper = vtkDataSetMapper()\n    aBeamMapper.SetInputConnection(surface.GetOutputPort())\n    aBeamActor = vtkActor()\n    aBeamActor.SetMapper(aBeamMapper)\n    aBeamActor.AddPosition(0, 0, 0)\n    aBeamActor.GetProperty().SetColor(\n        colors.GetColor3d('Yellow'))\n    aBeamActor.GetProperty().SetOpacity(0.60)\n    aBeamActor.GetProperty().EdgeVisibilityOn()\n    aBeamActor.GetProperty().SetEdgeColor(\n        colors.GetColor3d('Black'))\n    aBeamActor.GetProperty().SetLineWidth(1.5)\n\n    # Create a plane to cut, here it cuts in the XZ direction\n    # (xz normal=(1,0,0) XY =(0,0,1), YZ =(0,1,0)\n    plane = vtkPlane()\n    plane.SetOrigin(0.5, 0, 0)\n    plane.SetNormal(1, 0, 0)\n\n    # Create cutter\n    cutter = vtkCutter()\n    cutter.SetCutFunction(plane)\n    cutter.SetInputData(aBeamActor.GetMapper().GetInput())\n    cutter.Update()\n    cutterMapper = vtkPolyDataMapper()\n    cutterMapper.SetInputConnection(cutter.GetOutputPort())\n\n    # Create plane actor\n    planeActor = vtkActor()\n    planeActor.GetProperty().SetColor(\n        colors.GetColor3d('Red'))\n    planeActor.GetProperty().SetLineWidth(2)\n    planeActor.SetMapper(cutterMapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('DatasetSurface')\n    renderWindow.AddRenderer(renderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(aBeamActor)\n    renderer.AddActor(planeActor)\n    renderer.SetBackground(\n        colors.GetColor3d('Seashell'))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(-25)\n    renderer.GetActiveCamera().Elevation(30)\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/DecimateFran/","title":"DecimateFran","text":"

vtk-examples/Python/VisualizationAlgorithms/DecimateFran

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/DecimateFran/#code","title":"Code","text":"

DecimateFran.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDecimatePro,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkIOImage import vtkPNGReader\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName1, fileName2 = get_program_parameters()\n\n    # This example shows how to use decimation to reduce a polygonal mesh. We also\n    # use mesh smoothing and generate surface normals to give a pleasing result.\n    #\n\n    # We start by reading some data that was originally captured from\n    # a Cyberware laser digitizing system.\n    #\n    fran = vtkPolyDataReader()\n    fran.SetFileName(fileName1)\n\n    # Read the corresponding texture.\n    textureReader = vtkPNGReader()\n    textureReader.SetFileName(fileName2)\n\n    texture = vtkTexture()\n    texture.InterpolateOn()\n    texture.SetInputConnection(textureReader.GetOutputPort())\n\n    # We want to preserve topology (not let any cracks form). This may limit\n    # the total reduction possible, which we have specified at 90%.\n    #\n    deci = vtkDecimatePro()\n    deci.SetInputConnection(fran.GetOutputPort())\n    deci.SetTargetReduction(0.9)\n    deci.PreserveTopologyOn()\n\n    decimatedNormals = vtkPolyDataNormals()\n    decimatedNormals.SetInputConnection(deci.GetOutputPort())\n    decimatedNormals.FlipNormalsOn()\n    decimatedNormals.SetFeatureAngle(60)\n\n    originalNormals = vtkPolyDataNormals()\n    originalNormals.SetInputConnection(fran.GetOutputPort())\n    originalNormals.FlipNormalsOn()\n    originalNormals.SetFeatureAngle(60)\n\n    decimatedMapper = vtkPolyDataMapper()\n    decimatedMapper.SetInputConnection(decimatedNormals.GetOutputPort())\n\n    decimatedActor = vtkActor()\n    decimatedActor.SetMapper(decimatedMapper)\n    decimatedActor.GetProperty().SetAmbient(.5)\n    decimatedActor.GetProperty().SetDiffuse(.5)\n    decimatedActor.SetTexture(texture)\n\n    originalMapper = vtkPolyDataMapper()\n    originalMapper.SetInputConnection(originalNormals.GetOutputPort())\n\n    originalActor = vtkActor()\n    originalActor.SetMapper(originalMapper)\n    originalActor.GetProperty().SetAmbient(.5)\n    originalActor.GetProperty().SetDiffuse(.5)\n    originalActor.SetTexture(texture)\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    renderer1 = vtkRenderer()\n    renderer1.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    renderer2 = vtkRenderer()\n    renderer2.SetViewport(0.5, 0.0, 1.0, 1.0)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer1)\n    renderWindow.AddRenderer(renderer2)\n    renderWindow.SetWindowName('DecimateFran')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    renderer1.AddActor(originalActor)\n    renderer2.AddActor(decimatedActor)\n    renderer1.SetBackground(colors.GetColor3d(\"Wheat\"))\n    renderer2.SetBackground(colors.GetColor3d(\"Papaya_Whip\"))\n    renderWindow.SetSize(800, 400)\n\n    # Render the image.\n    #\n    cam1 = vtkCamera()\n    cam1.SetClippingRange(0.0475572, 2.37786)\n    cam1.SetFocalPoint(0.052665, -0.129454, -0.0573973)\n    cam1.SetPosition(0.327637, -0.116299, -0.256418)\n    cam1.SetViewUp(-0.0225386, 0.999137, 0.034901)\n    renderer1.SetActiveCamera(cam1)\n    renderer2.SetActiveCamera(cam1)\n\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Examples of the decimation algorithm.'\n    epilogue = '''\n    (a) Decimation of laser digitizer.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='fran_cut.vtk')\n    parser.add_argument('filename2', help='fran_cut.png.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/DecimateHawaii/","title":"DecimateHawaii","text":"

vtk-examples/Python/VisualizationAlgorithms/DecimateHawaii

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/DecimateHawaii/#code","title":"Code","text":"

DecimateHawaii.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDecimatePro,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # This example shows how to use decimation to reduce a polygonal mesh. We also\n    # use mesh smoothing and generate surface normals to give a pleasing result.\n    #\n\n    hawaii = vtkPolyDataReader()\n    hawaii.SetFileName(fileName)\n\n    # We want to preserve topology (not let any cracks form). This may limit\n    # the total reduction possible, which we have specified at 90%.\n    #\n    deci = vtkDecimatePro()\n    deci.SetInputConnection(hawaii.GetOutputPort())\n    deci.SetTargetReduction(0.9)\n    deci.PreserveTopologyOn()\n\n    decimatedNormals = vtkPolyDataNormals()\n    decimatedNormals.SetInputConnection(deci.GetOutputPort())\n    decimatedNormals.FlipNormalsOn()\n    decimatedNormals.SetFeatureAngle(60)\n\n    decimatedMapper = vtkPolyDataMapper()\n    decimatedMapper.SetInputConnection(decimatedNormals.GetOutputPort())\n\n    decimatedActor = vtkActor()\n    decimatedActor.SetMapper(decimatedMapper)\n    decimatedActor.GetProperty().SetColor(colors.GetColor3d('Sienna'))\n    decimatedActor.GetProperty().SetRepresentationToWireframe()\n\n    originalMapper = vtkPolyDataMapper()\n    originalMapper.SetInputConnection(decimatedNormals.GetOutputPort())\n\n    originalActor = vtkActor()\n    originalActor.SetMapper(originalMapper)\n    originalActor.GetProperty().SetColor(colors.GetColor3d('Sienna'))\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    renderer1 = vtkRenderer()\n    renderer1.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    renderer2 = vtkRenderer()\n    renderer2.SetViewport(0.5, 0.0, 1.0, 1.0)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer1)\n    renderWindow.AddRenderer(renderer2)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    renderer1.AddActor(originalActor)\n    renderer2.AddActor(decimatedActor)\n    renderer1.SetBackground(colors.GetColor3d('Wheat'))\n    renderer2.SetBackground(colors.GetColor3d('Papaya_Whip'))\n    renderWindow.SetSize(800, 400)\n    renderWindow.SetWindowName('DecimateHawaii')\n\n    # Render the image.\n    #\n    cam1 = vtkCamera()\n    renderer1.SetActiveCamera(cam1)\n    renderer2.SetActiveCamera(cam1)\n    renderer1.ResetCamera()\n    cam1.Elevation(-30)\n    cam1.Dolly(1.2)\n    renderer1.ResetCameraClippingRange()\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Examples of decimation algorithm.'\n    epilogue = '''\n    Decimation of terrain data.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='honolulu.vtk')\n    args = parser.parse_args()\n    return args.filename1\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/DisplacementPlot/","title":"DisplacementPlot","text":"

vtk-examples/Python/VisualizationAlgorithms/DisplacementPlot

"},{"location":"Python/VisualizationAlgorithms/DisplacementPlot/#description","title":"Description","text":"

This example shows modal lines for a vibrating rectangular beam. The vibration mode in this figure is the second torsional mode, clearly indicated by the crossing modal lines.

The default color scheme shows cool color for maximum negative motion, warm color maximum positive motion, with white at the nodes.

For other possible color maps see: Diverging Color Maps for Scientific Visualization.

Info

See Figure 6-15 in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/DisplacementPlot/#code","title":"Code","text":"

DisplacementPlot.py

#!/usr/bin/env python\n\n# Translated from dispPlot.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataNormals,\n    vtkVectorDot\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpVector\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    file_name, color_scheme = get_program_parameters()\n\n    color_scheme = abs(color_scheme)\n    if color_scheme > 2:\n        color_scheme = 0\n\n    colors = vtkNamedColors()\n\n    # Read a vtk file\n    #\n    plate = vtkPolyDataReader()\n    plate.SetFileName(file_name)\n    plate.SetVectorsName(\"mode8\")\n    plate.Update()\n\n    warp = vtkWarpVector()\n    warp.SetInputConnection(plate.GetOutputPort())\n    warp.SetScaleFactor(0.5)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(warp.GetOutputPort())\n\n    color = vtkVectorDot()\n    color.SetInputConnection(normals.GetOutputPort())\n\n    lut = vtkLookupTable()\n    MakeLUT(color_scheme, lut)\n\n    plateMapper = vtkDataSetMapper()\n    plateMapper.SetInputConnection(color.GetOutputPort())\n    plateMapper.SetLookupTable(lut)\n    plateMapper.SetScalarRange(-1, 1)\n\n    plateActor = vtkActor()\n    plateActor.SetMapper(plateMapper)\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren.AddActor(plateActor)\n    ren.SetBackground(colors.GetColor3d(\"Wheat\"))\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('DisplacementPlot')\n\n    ren.GetActiveCamera().SetPosition(13.3991, 14.0764, 9.97787)\n    ren.GetActiveCamera().SetFocalPoint(1.50437, 0.481517, 4.52992)\n    ren.GetActiveCamera().SetViewAngle(30)\n    ren.GetActiveCamera().SetViewUp(- 0.120861, 0.458556, - 0.880408)\n    ren.GetActiveCamera().SetClippingRange(12.5724, 26.8374)\n    # Render the image.\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce figure 6\u201315(b) from the VTK Textbook.'\n    epilogue = '''\n        Produce figure 6\u201315(b) from the VTK Textbook.\n        Surface plot of a vibrating plane.\n\n        The color_scheme option allows you to select a series of colour schemes.\n        0: The default:- cool maximum negative motion, warm maximum positive motion, white at the nodes.\n        1: An alternative:- green maximum negative motion, purple maximum positive motion, white at the nodes.\n        2: The original:- white at maximum motion, black at the nodes.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='plate.vtk')\n    parser.add_argument('color_scheme', default=0, type=int, nargs='?', help='The particular color scheme to use.')\n    args = parser.parse_args()\n    return args.filename, args.color_scheme\n\n\ndef MakeLUT(colorScheme, lut):\n    # See: [Diverging Color Maps for Scientific Visualization]\n    #      (http:#www.kennethmoreland.com/color-maps/)\n    nc = 256\n    ctf = vtkColorTransferFunction()\n\n    if colorScheme == 1:\n        # Green to purple diverging.\n        ctf.SetColorSpaceToDiverging()\n        ctf.AddRGBPoint(0.0, 0.085, 0.532, 0.201)\n        ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n        ctf.AddRGBPoint(1.0, 0.436, 0.308, 0.631)\n        lut.SetNumberOfTableValues(nc)\n        lut.Build()\n        for i in range(0, nc):\n            rgb = list(ctf.GetColor(float(i) / nc))\n            rgb.append(1.0)\n            lut.SetTableValue(i, *rgb)\n    elif colorScheme == 2:\n        # Make a lookup table, black in the centre with bright areas\n        #   at the beginning and end of the table.\n        # This is from the original code.\n        nc2 = nc / 2.0\n        lut.SetNumberOfColors(nc)\n        lut.Build()\n        for i in range(0, int(nc2)):\n            # White to black.\n            v = (nc2 - i) / nc2\n            lut.SetTableValue(i, v, v, v, 1)\n        for i in range(int(nc2), nc):\n            # Black to white.\n            v = (i - nc2) / nc2\n            lut.SetTableValue(i, v, v, v, 1)\n    else:\n        # Cool to warm diverging.\n        ctf.SetColorSpaceToDiverging()\n        ctf.AddRGBPoint(0.0, 0.230, 0.299, 0.754)\n        ctf.AddRGBPoint(1.0, 0.706, 0.016, 0.150)\n        lut.SetNumberOfTableValues(nc)\n        lut.Build()\n        for i in range(0, nc):\n            rgb = list(ctf.GetColor(float(i) / nc))\n            rgb.append(1.0)\n            lut.SetTableValue(i, *rgb)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/ExponentialCosine/","title":"ExponentialCosine","text":"

vtk-examples/Python/VisualizationAlgorithms/ExponentialCosine

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/ExponentialCosine/#code","title":"Code","text":"

ExponentialCosine.py

#!/usr/bin/env python\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkTransformPolyDataFilter,\n    vtkWarpScalar\n)\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create plane to warp\n    plane = vtkPlaneSource()\n    plane.SetResolution(300, 300)\n\n    transform = vtkTransform()\n    transform.Scale(10.0, 10.0, 1.0)\n\n    transF = vtkTransformPolyDataFilter()\n    transF.SetInputConnection(plane.GetOutputPort())\n    transF.SetTransform(transform)\n    transF.Update()\n\n    # Compute the Bessel function and derivatives. This portion could be\n    # encapsulated into source or filter object.\n    #\n    inputPd = transF.GetOutput()\n    numPts = inputPd.GetNumberOfPoints()\n\n    newPts = vtkPoints()\n    newPts.SetNumberOfPoints(numPts)\n\n    derivs = vtkDoubleArray()\n    derivs.SetNumberOfTuples(numPts)\n\n    bessel = vtkPolyData()\n    bessel.CopyStructure(inputPd)\n    bessel.SetPoints(newPts)\n    bessel.GetPointData().SetScalars(derivs)\n\n    x = [0.0] * 3\n    for i in range(0, numPts):\n        inputPd.GetPoint(i, x)\n        r = math.sqrt(float(x[0] * x[0]) + x[1] * x[1])\n        x[2] = math.exp(-r) * math.cos(10.0 * r)\n        newPts.SetPoint(i, x)\n        deriv = -math.exp(-r) * (math.cos(10.0 * r) + 10.0 * math.sin(10.0 * r))\n        derivs.SetValue(i, deriv)\n\n    # Warp the plane.\n    warp = vtkWarpScalar()\n    warp.SetInputData(bessel)\n    warp.XYPlaneOn()\n    warp.SetScaleFactor(0.5)\n\n    # Mapper and actor.\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(warp.GetOutputPort())\n    tmp = bessel.GetScalarRange()\n    mapper.SetScalarRange(tmp[0], tmp[1])\n\n    carpet = vtkActor()\n    carpet.SetMapper(mapper)\n\n    # Assign our actor to the renderer.\n    ren.AddActor(carpet)\n    ren.SetBackground(colors.GetColor3d('Beige'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('ExponentialCosine')\n\n    # draw the resulting scene\n    ren.ResetCamera()\n    ren.GetActiveCamera().Zoom(1.35)\n    ren.GetActiveCamera().Elevation(-55)\n    ren.GetActiveCamera().Azimuth(25)\n    ren.ResetCameraClippingRange()\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/ExtractData/","title":"ExtractData","text":"

vtk-examples/Python/VisualizationAlgorithms/ExtractData

"},{"location":"Python/VisualizationAlgorithms/ExtractData/#description","title":"Description","text":"

This example takes advantage of the properties of implicit functions to select and cut data. In particular it uses the region separation property to select data. Selecting or extracting data with an implicit function means choosing cells and points (and associated attribute data) that lie within a particular region of the function. To determine whether a point x-y-z lies within a region, we simply evaluate the point and examine the sign of the result. A cell lies in a region if all its points lie in the region. Here, two ellipses are used in combination to select voxels within a volume dataset. Note that extracting data often changes the structure of the dataset. In this example the input type is a image data dataset, while the output type is an unstructured grid dataset.

Info

See Figure 6-24 in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/ExtractData/#code","title":"Code","text":"

ExtractData.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkImplicitBoolean,\n    vtkQuadric,\n    vtkSphere\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractGeometry\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0)\n\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(50, 50, 50)\n    sample.SetImplicitFunction(quadric)\n    sample.ComputeNormalsOff()\n\n    trans = vtkTransform()\n    trans.Scale(1, 0.5, 0.333)\n\n    sphere = vtkSphere()\n    sphere.SetRadius(0.25)\n    sphere.SetTransform(trans)\n\n    trans2 = vtkTransform()\n    trans2.Scale(0.25, 0.5, 1.0)\n\n    sphere2 = vtkSphere()\n    sphere2.SetRadius(0.25)\n    sphere2.SetTransform(trans2)\n\n    booleanUnion = vtkImplicitBoolean()\n    booleanUnion.AddFunction(sphere)\n    booleanUnion.AddFunction(sphere2)\n    booleanUnion.SetOperationType(0)  # boolean Union\n\n    extract = vtkExtractGeometry()\n    extract.SetInputConnection(sample.GetOutputPort())\n    extract.SetImplicitFunction(booleanUnion)\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(extract.GetOutputPort())\n    shrink.SetShrinkFactor(0.5)\n\n    dataMapper = vtkDataSetMapper()\n    dataMapper.SetInputConnection(shrink.GetOutputPort())\n    dataActor = vtkActor()\n    dataActor.SetMapper(dataMapper)\n\n    # outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(sample.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(0, 0, 0)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(dataActor)\n    ren1.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('ExtractData')\n\n    renWin.Render()\n    ren1.GetActiveCamera().Azimuth(30)\n    ren1.GetActiveCamera().Elevation(30)\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/FlyingHeadSlice/","title":"FlyingHeadSlice","text":"

vtk-examples/Python/VisualizationAlgorithms/FlyingHeadSlice

"},{"location":"Python/VisualizationAlgorithms/FlyingHeadSlice/#description","title":"Description","text":"

This example generates 2D contour lines on one CT slice through the head. The contours correspond to density values of the tissues and are colored according to density value.

This example is a modification of HeadSlice using vtkFlyingEdges2D for contouring. However there is an option to use vtkContourFilter instead.

Info

See Figure 6-11a in Chapter 6 of the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/FlyingHeadSlice/#code","title":"Code","text":"

FlyingHeadSlice.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkFlyingEdges2D\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkExtractVOI\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName, useContouring = get_program_parameters()\n    if useContouring:\n        print('Using vtkContourFilter.')\n    else:\n        print('Using vtkFlyingEdges2D.')\n\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    reader = vtkMetaImageReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    extractVOI = vtkExtractVOI()\n    extractVOI.SetInputConnection(reader.GetOutputPort())\n    extractVOI.SetVOI(0, 255, 0, 255, 45, 45)\n    # scalarRange = extractVOI.GetOutput().GetScalarRange()\n    scalarRange = [500, 1150]\n    # print(scalarRange)\n\n    contour = vtkContourFilter()\n    flyingEdges = vtkFlyingEdges2D()\n    isoMapper = vtkPolyDataMapper()\n    if useContouring:\n        contour.SetInputConnection(extractVOI.GetOutputPort())\n        contour.GenerateValues(12, scalarRange)\n        isoMapper.SetInputConnection(contour.GetOutputPort())\n    else:\n        flyingEdges.SetInputConnection(extractVOI.GetOutputPort())\n        flyingEdges.GenerateValues(12, scalarRange)\n        isoMapper.SetInputConnection(flyingEdges.GetOutputPort())\n\n    isoMapper.ScalarVisibilityOn()\n    isoMapper.SetScalarRange(scalarRange)\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d('Wheat'))\n\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(extractVOI.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Dolly(1.5)\n    ren1.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 640)\n    renWin.SetWindowName('FlyingHeadSlice')\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Either vtkFlyingEdges2D or vtkContourFilter is used to generate contour lines.'\n    epilogue = '''\n    Generate 2D contour lines, corresponding to tissue density, on one CT slice through the head.\n    The contour lines are colored by the tissue density.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    parser.add_argument('-useContouring', '--useContouring', action='store_true',\n                        help='Use vtkContourFilter instead of vtkFlyingEdges2D.')\n    args = parser.parse_args()\n    return args.filename, args.useContouring\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/HeadBone/","title":"HeadBone","text":"

vtk-examples/Python/VisualizationAlgorithms/HeadBone

"},{"location":"Python/VisualizationAlgorithms/HeadBone/#description","title":"Description","text":"

This example generates an isosurface of human bone.

Info

See Figure 6-11b in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/HeadBone/#code","title":"Code","text":"

HeadBone.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkMergePoints\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    file_name = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Create the pipeline.\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    locator = vtkMergePoints()\n    locator.SetDivisions(64, 64, 92)\n    locator.SetNumberOfPointsPerBucket(2)\n    locator.AutomaticOff()\n\n    if use_flying_edges:\n        try:\n            using_marching_cubes = False\n            iso = vtkFlyingEdges3D()\n        except AttributeError:\n            using_marching_cubes = True\n            iso = vtkMarchingCubes()\n    else:\n        using_marching_cubes = True\n        iso = vtkMarchingCubes()\n    iso.SetInputConnection(reader.GetOutputPort())\n    iso.ComputeGradientsOn()\n    iso.ComputeScalarsOff()\n    iso.SetValue(0, 1150)\n    if using_marching_cubes:\n        iso.SetLocator(locator)\n\n    iso_mapper = vtkPolyDataMapper()\n    iso_mapper.SetInputConnection(iso.GetOutputPort())\n    iso_mapper.ScalarVisibilityOff()\n\n    iso_actor = vtkActor()\n    iso_actor.SetMapper(iso_mapper)\n    iso_actor.GetProperty().SetColor(colors.GetColor3d('Ivory'))\n\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outline_mapper = vtkPolyDataMapper()\n    outline_mapper.SetInputConnection(outline.GetOutputPort())\n\n    outline_actor = vtkActor()\n    outline_actor.SetMapper(outline_mapper)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren.AddActor(outline_actor)\n    ren.AddActor(iso_actor)\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    ren.GetActiveCamera().SetPosition(0, -1, 0)\n    ren.GetActiveCamera().SetViewUp(0, 0, -1)\n    ren.ResetCamera()\n    ren.GetActiveCamera().Dolly(1.5)\n    ren.ResetCameraClippingRange()\n\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('HeadBone')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Marching cubes surface of human bone.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/HeadSlice/","title":"HeadSlice","text":"

vtk-examples/Python/VisualizationAlgorithms/HeadSlice

"},{"location":"Python/VisualizationAlgorithms/HeadSlice/#description","title":"Description","text":"

This example generates contours on one CT slice through the head,

Info

See Figure 6-11a in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/HeadSlice/#code","title":"Code","text":"

HeadSlice.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkExtractVOI\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    #\n\n    reader = vtkMetaImageReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    extractVOI = vtkExtractVOI()\n    extractVOI.SetInputConnection(reader.GetOutputPort())\n    extractVOI.SetVOI(0, 255, 0, 255, 45, 45)\n\n    iso = vtkContourFilter()\n    iso.SetInputConnection(extractVOI.GetOutputPort())\n    iso.GenerateValues(12, 500, 1150)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(iso.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d('Wheat'))\n\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(extractVOI.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Dolly(1.5)\n    ren1.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 640)\n    renWin.SetWindowName('HeadSlice')\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Marching squares are used to generate contour lines.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/Hello/","title":"Hello","text":"

vtk-examples/Python/VisualizationAlgorithms/Hello

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/Hello/#code","title":"Code","text":"

Hello.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersHybrid import vtkImplicitModeller\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create lines which serve as the 'seed' geometry. The lines spell the\n    # word 'hello'.\n    #\n    reader = vtkPolyDataReader()\n    reader.SetFileName(fileName)\n\n    lineMapper = vtkPolyDataMapper()\n    lineMapper.SetInputConnection(reader.GetOutputPort())\n\n    lineActor = vtkActor()\n    lineActor.SetMapper(lineMapper)\n    lineActor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n    lineActor.GetProperty().SetLineWidth(3.0)\n\n    # Create implicit model with vtkImplicitModeller. This computes a scalar\n    # field which is the distance from the generating geometry. The contour\n    # filter then extracts the geometry at the distance value 0.25 from the\n    # generating geometry.\n    #\n    imp = vtkImplicitModeller()\n    imp.SetInputConnection(reader.GetOutputPort())\n    imp.SetSampleDimensions(110, 40, 20)\n    imp.SetMaximumDistance(0.25)\n    imp.SetModelBounds(-1.0, 10.0, -1.0, 3.0, -1.0, 1.0)\n\n    contour = vtkContourFilter()\n    contour.SetInputConnection(imp.GetOutputPort())\n    contour.SetValue(0, 0.25)\n\n    impMapper = vtkPolyDataMapper()\n    impMapper.SetInputConnection(contour.GetOutputPort())\n    impMapper.ScalarVisibilityOff()\n\n    impActor = vtkActor()\n    impActor.SetMapper(impMapper)\n    impActor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n    impActor.GetProperty().SetOpacity(0.5)\n\n    # Create the usual graphics stuff.\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetWindowName('Hello')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren1.AddActor(lineActor)\n    ren1.AddActor(impActor)\n    ren1.SetBackground(colors.GetColor3d('Wheat'))\n    renWin.SetSize(640, 480)\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(4.5, 1, 0)\n    camera.SetPosition(4.5, 1.0, 6.73257)\n    camera.SetViewUp(0, 1, 0)\n\n    ren1.SetActiveCamera(camera)\n    ren1.ResetCamera()\n    camera.Dolly(1.3)\n    camera.SetClippingRange(1.81325, 90.6627)\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Implicit modelling is used to thicken a stroked font.'\n    epilogue = '''\n    Implicit modelling is used to thicken a stroked font.\n     The original lines can be seen within the translucent implicit surface. \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='hello.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/HyperStreamline/","title":"HyperStreamline","text":"

vtk-examples/Python/VisualizationAlgorithms/HyperStreamline

"},{"location":"Python/VisualizationAlgorithms/HyperStreamline/#description","title":"Description","text":"

This is an example of hyperstreamlines. The data is from a point load applied to semi-infinite domain. Compare this image to TensorEllipsoids that used tensor ellipsoids to visualize the same data. Notice that there is less clutter and more information available from the hyperstreamline visualization.

Info

See Figure 9-15 in Chapter 9 The VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/HyperStreamline/#code","title":"Code","text":"

HyperStreamline.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkHyperStreamline\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkImagingHybrid import vtkPointLoad\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkLogLookupTable,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Generate the tensors.\n    ptLoad = vtkPointLoad()\n    ptLoad.SetLoadValue(100.0)\n    ptLoad.SetSampleDimensions(20, 20, 20)\n    ptLoad.ComputeEffectiveStressOn()\n    ptLoad.SetModelBounds(-10, 10, -10, 10, -10, 10)\n    ptLoad.Update()\n\n    # Generate the hyperstreamlines.\n    s1 = vtkHyperStreamline()\n    s1.SetInputData(ptLoad.GetOutput())\n    s1.SetStartPosition(9, 9, -9)\n    s1.IntegrateMinorEigenvector()\n    s1.SetMaximumPropagationDistance(18.0)\n    s1.SetIntegrationStepLength(0.1)\n    s1.SetStepLength(0.01)\n    s1.SetRadius(0.25)\n    s1.SetNumberOfSides(18)\n    s1.SetIntegrationDirectionToIntegrateBothDirections()\n    s1.Update()\n\n    # Map the hyperstreamlines.\n    lut = vtkLogLookupTable()\n    lut.SetHueRange(.6667, 0.0)\n\n    s1Mapper = vtkPolyDataMapper()\n    s1Mapper.SetInputConnection(s1.GetOutputPort())\n    s1Mapper.SetLookupTable(lut)\n    s1Mapper.SetScalarRange(ptLoad.GetOutput().GetScalarRange())\n\n    s1Actor = vtkActor()\n    s1Actor.SetMapper(s1Mapper)\n\n    s2 = vtkHyperStreamline()\n    s2.SetInputData(ptLoad.GetOutput())\n    s2.SetStartPosition(-9, -9, -9)\n    s2.IntegrateMinorEigenvector()\n    s2.SetMaximumPropagationDistance(18.0)\n    s2.SetIntegrationStepLength(0.1)\n    s2.SetStepLength(0.01)\n    s2.SetRadius(0.25)\n    s2.SetNumberOfSides(18)\n    s2.SetIntegrationDirectionToIntegrateBothDirections()\n    s2.Update()\n\n    s2Mapper = vtkPolyDataMapper()\n    s2Mapper.SetInputConnection(s2.GetOutputPort())\n    s2Mapper.SetLookupTable(lut)\n    s2Mapper.SetScalarRange(ptLoad.GetOutput().GetScalarRange())\n\n    s2Actor = vtkActor()\n    s2Actor.SetMapper(s2Mapper)\n\n    s3 = vtkHyperStreamline()\n    s3.SetInputData(ptLoad.GetOutput())\n    s3.SetStartPosition(9, -9, -9)\n    s3.IntegrateMinorEigenvector()\n    s3.SetMaximumPropagationDistance(18.0)\n    s3.SetIntegrationStepLength(0.1)\n    s3.SetStepLength(0.01)\n    s3.SetRadius(0.25)\n    s3.SetNumberOfSides(18)\n    s3.SetIntegrationDirectionToIntegrateBothDirections()\n    s3.Update()\n\n    s3Mapper = vtkPolyDataMapper()\n    s3Mapper.SetInputConnection(s3.GetOutputPort())\n    s3Mapper.SetLookupTable(lut)\n    s3Mapper.SetScalarRange(ptLoad.GetOutput().GetScalarRange())\n\n    s3Actor = vtkActor()\n    s3Actor.SetMapper(s3Mapper)\n\n    s4 = vtkHyperStreamline()\n    s4.SetInputData(ptLoad.GetOutput())\n    s4.SetStartPosition(-9, 9, -9)\n    s4.IntegrateMinorEigenvector()\n    s4.SetMaximumPropagationDistance(18.0)\n    s4.SetIntegrationStepLength(0.1)\n    s4.SetStepLength(0.01)\n    s4.SetRadius(0.25)\n    s4.SetNumberOfSides(18)\n    s4.SetIntegrationDirectionToIntegrateBothDirections()\n    s4.Update()\n\n    s4Mapper = vtkPolyDataMapper()\n    s4Mapper.SetInputConnection(s4.GetOutputPort())\n    s4Mapper.SetLookupTable(lut)\n    s4Mapper.SetScalarRange(ptLoad.GetOutput().GetScalarRange())\n\n    s4Actor = vtkActor()\n    s4Actor.SetMapper(s4Mapper)\n\n    # A plane for context.\n    #\n    g = vtkImageDataGeometryFilter()\n    g.SetInputData(ptLoad.GetOutput())\n    g.SetExtent(0, 100, 0, 100, 0, 0)\n    g.Update()  # for scalar range\n\n    gm = vtkPolyDataMapper()\n    gm.SetInputConnection(g.GetOutputPort())\n    gm.SetScalarRange(g.GetOutput().GetScalarRange())\n\n    ga = vtkActor()\n    ga.SetMapper(gm)\n\n    # Create an outline around the data.\n    #\n    outline = vtkOutlineFilter()\n    outline.SetInputData(ptLoad.GetOutput())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create a cone indicating the application of the load.\n    #\n    coneSrc = vtkConeSource()\n    coneSrc.SetRadius(0.5)\n    coneSrc.SetHeight(2)\n\n    coneMap = vtkPolyDataMapper()\n    coneMap.SetInputConnection(coneSrc.GetOutputPort())\n\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMap)\n    coneActor.SetPosition(0, 0, 11)\n    coneActor.RotateY(90)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(0.113766, -1.13665, -1.01919)\n    camera.SetPosition(-29.4886, -63.1488, 26.5807)\n    camera.SetViewAngle(24.4617)\n    camera.SetViewUp(0.17138, 0.331163, 0.927879)\n    camera.SetClippingRange(1, 100)\n\n    ren1.AddActor(s1Actor)\n    ren1.AddActor(s2Actor)\n    ren1.AddActor(s3Actor)\n    ren1.AddActor(s4Actor)\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(coneActor)\n    ren1.AddActor(ga)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.SetActiveCamera(camera)\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('HyperStreamline')\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/IceCream/","title":"IceCream","text":"

vtk-examples/Python/VisualizationAlgorithms/IceCream

"},{"location":"Python/VisualizationAlgorithms/IceCream/#description","title":"Description","text":"

This example demonstrates how to use boolean combinations of implicit functions to create a model of an ice cream cone.

Info

See Figure 6-23c in Chapter 6 the VTK Textbook.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/IceCream/#code","title":"Code","text":"

IceCream.py

#!/usr/bin/env python\n\n\"\"\"\nThis example demonstrates how to use boolean combinations of implicit\n functions to create a model of an ice cream cone.\n\n\"\"\"\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCone,\n    vtkImplicitBoolean,\n    vtkPlane,\n    vtkSphere\n)\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create implicit function primitives. These have been carefully placed to\n    # give the effect that we want. We are going to use various combinations of\n    # these functions to create the shape we want for example, we use planes\n    # intersected with a cone (which is infinite in extent) to get a finite\n    # cone.\n    #\n    cone = vtkCone()\n    cone.SetAngle(20)\n\n    vertPlane = vtkPlane()\n    vertPlane.SetOrigin(.1, 0, 0)\n    vertPlane.SetNormal(-1, 0, 0)\n\n    basePlane = vtkPlane()\n    basePlane.SetOrigin(1.2, 0, 0)\n    basePlane.SetNormal(1, 0, 0)\n\n    iceCream = vtkSphere()\n    iceCream.SetCenter(1.333, 0, 0)\n    iceCream.SetRadius(0.5)\n\n    bite = vtkSphere()\n    bite.SetCenter(1.5, 0, 0.5)\n    bite.SetRadius(0.25)\n\n    # Combine primitives to build ice-cream cone. Clip the cone with planes.\n    theCone = vtkImplicitBoolean()\n    theCone.SetOperationTypeToIntersection()\n    theCone.AddFunction(cone)\n    theCone.AddFunction(vertPlane)\n    theCone.AddFunction(basePlane)\n\n    # Take a bite out of the ice cream.\n    theCream = vtkImplicitBoolean()\n    theCream.SetOperationTypeToDifference()\n    theCream.AddFunction(iceCream)\n    theCream.AddFunction(bite)\n\n    # The sample function generates a distance function from the\n    # implicit function (which in this case is the cone). This is\n    # then contoured to get a polygonal surface.\n    #\n    theConeSample = vtkSampleFunction()\n    theConeSample.SetImplicitFunction(theCone)\n    theConeSample.SetModelBounds(-1, 1.5, -1.25, 1.25, -1.25, 1.25)\n    theConeSample.SetSampleDimensions(128, 128, 128)\n    theConeSample.ComputeNormalsOff()\n\n    theConeSurface = vtkContourFilter()\n    theConeSurface.SetInputConnection(theConeSample.GetOutputPort())\n    theConeSurface.SetValue(0, 0.0)\n\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(theConeSurface.GetOutputPort())\n    coneMapper.ScalarVisibilityOff()\n\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Chocolate'))\n\n    # The same here for the ice cream.\n    #\n    theCreamSample = vtkSampleFunction()\n    theCreamSample.SetImplicitFunction(theCream)\n    theCreamSample.SetModelBounds(0, 2.5, -1.25, 1.25, -1.25, 1.25)\n    theCreamSample.SetSampleDimensions(128, 128, 128)\n    theCreamSample.ComputeNormalsOff()\n\n    theCreamSurface = vtkContourFilter()\n    theCreamSurface.SetInputConnection(theCreamSample.GetOutputPort())\n    theCreamSurface.SetValue(0, 0.0)\n\n    creamMapper = vtkPolyDataMapper()\n    creamMapper.SetInputConnection(theCreamSurface.GetOutputPort())\n    creamMapper.ScalarVisibilityOff()\n\n    creamActor = vtkActor()\n    creamActor.SetMapper(creamMapper)\n    creamActor.GetProperty().SetDiffuseColor(colors.GetColor3d('Mint'))\n    creamActor.GetProperty().SetSpecular(.6)\n    creamActor.GetProperty().SetSpecularPower(50)\n\n    # Create the usual rendering stuff.\n    #\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(coneActor)\n    ren1.AddActor(creamActor)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('IceCream')\n\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Roll(90)\n    ren1.GetActiveCamera().Dolly(1.25)\n    ren1.ResetCameraClippingRange()\n    iren.Initialize()\n\n    # render the image\n    #\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/ImageGradient/","title":"ImageGradient","text":"

vtk-examples/Python/VisualizationAlgorithms/ImageGradient

"},{"location":"Python/VisualizationAlgorithms/ImageGradient/#description","title":"Description","text":"

We create an imaging pipeline to visualize gradient information.

The gradient direction is mapped into color hue value while the gradient magnitude is mapped into the color saturation.

Info

See Figure 10-16 in Chapter 10 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/ImageGradient/#code","title":"Code","text":"

ImageGradient.py

#!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingColor import vtkImageHSVToRGB\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageCast,\n    vtkImageConstantPad,\n    vtkImageExtractComponents,\n    vtkImageMagnify\n)\nfrom vtkmodules.vtkImagingGeneral import (\n    vtkImageEuclideanToPolar,\n    vtkImageGaussianSmooth,\n    vtkImageGradient\n)\nfrom vtkmodules.vtkInteractionImage import vtkImageViewer\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindowInteractor\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n    colors = vtkNamedColors()\n\n    # Read the CT data of the human head.\n    reader = vtkMetaImageReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToFloat()\n\n    # Magnify the image.\n    magnify = vtkImageMagnify()\n    magnify.SetInputConnection(cast.GetOutputPort())\n    magnify.SetMagnificationFactors(2, 2, 1)\n    magnify.InterpolateOn()\n\n    # Smooth the data.\n    # Remove high frequency artifacts due to linear interpolation.\n    smooth = vtkImageGaussianSmooth()\n    smooth.SetInputConnection(magnify.GetOutputPort())\n    smooth.SetDimensionality(2)\n    smooth.SetStandardDeviations(1.5, 1.5, 0.0)\n    smooth.SetRadiusFactors(2.01, 2.01, 0.0)\n\n    # Compute the 2D gradient.\n    gradient = vtkImageGradient()\n    gradient.SetInputConnection(smooth.GetOutputPort())\n    gradient.SetDimensionality(2)\n\n    # Convert the data to polar coordinates.\n    # The image magnitude is mapped into saturation value,\n    # whilst the gradient direction is mapped into hue value.\n    polar = vtkImageEuclideanToPolar()\n    polar.SetInputConnection(gradient.GetOutputPort())\n    polar.SetThetaMaximum(255.0)\n\n    # Add a third component to the data.\n    # This is needed since the gradient filter only generates two components,\n    #  and we need three components to represent color.\n    pad = vtkImageConstantPad()\n    pad.SetInputConnection(polar.GetOutputPort())\n    pad.SetOutputNumberOfScalarComponents(3)\n    pad.SetConstant(200.0)\n\n    # At this point we have Hue, Value, Saturation.\n    # Permute components so saturation will be constant.\n    # Re-arrange components into HSV order.\n    permute = vtkImageExtractComponents()\n    permute.SetInputConnection(pad.GetOutputPort())\n    permute.SetComponents(0, 2, 1)\n\n    # Convert back into RGB values.\n    rgb = vtkImageHSVToRGB()\n    rgb.SetInputConnection(permute.GetOutputPort())\n    rgb.SetMaximum(255.0)\n\n    # Set up a viewer for the image.\n    # Note that vtkImageViewer and vtkImageViewer2 are convenience wrappers around\n    # vtkActor2D, vtkImageMapper, vtkRenderer, and vtkRenderWindow.\n    # So all that needs to be supplied is the interactor.\n    viewer = vtkImageViewer()\n    viewer.SetInputConnection(rgb.GetOutputPort())\n    viewer.SetZSlice(22)\n    viewer.SetColorWindow(255.0)\n    viewer.SetColorLevel(127.0)\n    viewer.GetRenderWindow().SetSize(512, 512)\n    viewer.GetRenderer().SetBackground(colors.GetColor3d('Silver'))\n    viewer.GetRenderWindow().SetWindowName('ImageGradient')\n\n    # Create the RenderWindowInteractor.\n    iren = vtkRenderWindowInteractor()\n    viewer.SetupInteractor(iren)\n    viewer.Render()\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'ImageGradient.'\n    epilogue = '''\nVisualization of gradient information.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('fileName',\n                        help='The file FullHead.mhd. Note: file FullHead.raw.gz must also be present in the same folder.')\n    args = parser.parse_args()\n    return args.fileName\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/IronIsoSurface/","title":"IronIsoSurface","text":"

vtk-examples/Python/VisualizationAlgorithms/IronIsoSurface

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/IronIsoSurface/#code","title":"Code","text":"

IronIsoSurface.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(fileName)\n\n    iso = vtkContourFilter()\n    iso.SetInputConnection(reader.GetOutputPort())\n    iso.SetValue(0, 128)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(iso.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    renWin.SetSize(640, 640)\n    renWin.SetWindowName('IronIsoSurface')\n\n    # Render the image.\n    #\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Azimuth(30)\n    ren1.GetActiveCamera().Elevation(30)\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Marching cubes surface of iron-protein.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='ironProt.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/LOx/","title":"LOx","text":"

vtk-examples/Python/VisualizationAlgorithms/LOx

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/LOx/#code","title":"Code","text":"

LOx.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkStructuredGridOutlineFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    xyxFile, qFile = get_program_parameters()\n\n    # Read the data.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.AutoDetectFormatOn()\n    pl3d.SetXYZFileName(xyxFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(153)\n    pl3d.SetVectorFunctionNumber(200)\n    pl3d.Update()\n\n    sg = pl3d.GetOutput().GetBlock(0)\n\n    # blue to red lut\n    #\n    lut = vtkLookupTable()\n    lut.SetHueRange(0.667, 0.0)\n\n    # Computational planes.\n    floorComp = vtkStructuredGridGeometryFilter()\n    floorComp.SetExtent(0, 37, 0, 75, 0, 0)\n    floorComp.SetInputData(sg)\n    floorComp.Update()\n\n    floorMapper = vtkPolyDataMapper()\n    floorMapper.SetInputConnection(floorComp.GetOutputPort())\n    floorMapper.ScalarVisibilityOff()\n    floorMapper.SetLookupTable(lut)\n\n    floorActor = vtkActor()\n    floorActor.SetMapper(floorMapper)\n    floorActor.GetProperty().SetRepresentationToWireframe()\n    floorActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n    floorActor.GetProperty().SetLineWidth(2)\n\n    subFloorComp = vtkStructuredGridGeometryFilter()\n\n    subFloorComp.SetExtent(0, 37, 0, 15, 22, 22)\n    subFloorComp.SetInputData(sg)\n\n    subFloorMapper = vtkPolyDataMapper()\n    subFloorMapper.SetInputConnection(subFloorComp.GetOutputPort())\n    subFloorMapper.SetLookupTable(lut)\n    subFloorMapper.SetScalarRange(sg.GetScalarRange())\n\n    subFloorActor = vtkActor()\n\n    subFloorActor.SetMapper(subFloorMapper)\n\n    subFloor2Comp = vtkStructuredGridGeometryFilter()\n    subFloor2Comp.SetExtent(0, 37, 60, 75, 22, 22)\n    subFloor2Comp.SetInputData(sg)\n\n    subFloor2Mapper = vtkPolyDataMapper()\n    subFloor2Mapper.SetInputConnection(subFloor2Comp.GetOutputPort())\n    subFloor2Mapper.SetLookupTable(lut)\n    subFloor2Mapper.SetScalarRange(sg.GetScalarRange())\n\n    subFloor2Actor = vtkActor()\n\n    subFloor2Actor.SetMapper(subFloor2Mapper)\n\n    postComp = vtkStructuredGridGeometryFilter()\n    postComp.SetExtent(10, 10, 0, 75, 0, 37)\n    postComp.SetInputData(sg)\n\n    postMapper = vtkPolyDataMapper()\n    postMapper.SetInputConnection(postComp.GetOutputPort())\n    postMapper.SetLookupTable(lut)\n    postMapper.SetScalarRange(sg.GetScalarRange())\n\n    postActor = vtkActor()\n    postActor.SetMapper(postMapper)\n    postActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    fanComp = vtkStructuredGridGeometryFilter()\n    fanComp.SetExtent(0, 37, 38, 38, 0, 37)\n    fanComp.SetInputData(sg)\n\n    fanMapper = vtkPolyDataMapper()\n    fanMapper.SetInputConnection(fanComp.GetOutputPort())\n    fanMapper.SetLookupTable(lut)\n    fanMapper.SetScalarRange(sg.GetScalarRange())\n\n    fanActor = vtkActor()\n\n    fanActor.SetMapper(fanMapper)\n    fanActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    # streamers\n    #\n    # spherical seed points\n    rake = vtkPointSource()\n    rake.SetCenter(-0.74, 0, 0.3)\n    rake.SetNumberOfPoints(10)\n\n    # a line of seed points\n    seedsComp = vtkStructuredGridGeometryFilter()\n    seedsComp.SetExtent(10, 10, 37, 39, 1, 27)\n    seedsComp.SetInputData(sg)\n\n    streamers = vtkStreamTracer()\n    streamers.SetInputConnection(pl3d.GetOutputPort())\n\n    # streamers SetSource [rake GetOutput]\n    streamers.SetSourceConnection(seedsComp.GetOutputPort())\n    streamers.SetMaximumPropagation(250)\n    streamers.SetInitialIntegrationStep(.2)\n    streamers.SetMinimumIntegrationStep(.01)\n    streamers.SetIntegratorType(2)\n    streamers.Update()\n\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(streamers.GetOutputPort())\n    tubes.SetNumberOfSides(8)\n    tubes.SetRadius(0.08)\n    tubes.SetVaryRadius(0)\n\n    mapTubes = vtkPolyDataMapper()\n\n    mapTubes.SetInputConnection(tubes.GetOutputPort())\n    mapTubes.SetScalarRange(sg.GetScalarRange())\n\n    tubesActor = vtkActor()\n    tubesActor.SetMapper(mapTubes)\n\n    # outline\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(sg)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    # Create graphics stuff.\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(floorActor)\n    # ren1.AddActor(subFloorActor)\n    # ren1.AddActor(subFloor2Actor)\n    ren1.AddActor(postActor)\n    # ren1.AddActor(fanActor)\n    ren1.AddActor(tubesActor)\n\n    aCam = vtkCamera()\n    aCam.SetFocalPoint(2.47736, -0.150024, 2.42361)\n    aCam.SetPosition(1.57547, -13.4601, 5.47872)\n    aCam.SetViewUp(0.00197003, 0.223588, 0.974682)\n    #  aCam.Dolly(4.0)\n    aCam.SetClippingRange(1, 100)\n\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.SetActiveCamera(aCam)\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('LOx')\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Streamtubes created by using the computational grid just in front of the post as a source for seeds.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('xyz_file', help='postxyz.bin.')\n    parser.add_argument('q_file', help='postq.bin.')\n    args = parser.parse_args()\n    return args.xyz_file, args.q_file\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/LOxGrid/","title":"LOxGrid","text":"

vtk-examples/Python/VisualizationAlgorithms/LOxGrid

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/LOxGrid/#code","title":"Code","text":"

LOxGrid.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkStructuredGridOutlineFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    xyxFile, qFile = get_program_parameters()\n\n    # Read the data.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.AutoDetectFormatOn()\n    pl3d.SetXYZFileName(xyxFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(153)\n    pl3d.SetVectorFunctionNumber(200)\n    pl3d.Update()\n\n    sg = pl3d.GetOutput().GetBlock(0)\n\n    # blue to red lut\n    #\n    lut = vtkLookupTable()\n    lut.SetHueRange(0.667, 0.0)\n\n    # Computational planes.\n    floorComp = vtkStructuredGridGeometryFilter()\n    floorComp.SetExtent(0, 37, 0, 75, 0, 0)\n    floorComp.SetInputData(sg)\n    floorComp.Update()\n\n    floorMapper = vtkPolyDataMapper()\n    floorMapper.SetInputConnection(floorComp.GetOutputPort())\n    floorMapper.ScalarVisibilityOff()\n    floorMapper.SetLookupTable(lut)\n\n    floorActor = vtkActor()\n    floorActor.SetMapper(floorMapper)\n    floorActor.GetProperty().SetRepresentationToWireframe()\n    floorActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n    floorActor.GetProperty().SetLineWidth(2)\n\n    subFloorComp = vtkStructuredGridGeometryFilter()\n\n    subFloorComp.SetExtent(0, 37, 0, 15, 22, 22)\n    subFloorComp.SetInputData(sg)\n\n    subFloorMapper = vtkPolyDataMapper()\n    subFloorMapper.SetInputConnection(subFloorComp.GetOutputPort())\n    subFloorMapper.SetLookupTable(lut)\n    subFloorMapper.SetScalarRange(sg.GetScalarRange())\n\n    subFloorActor = vtkActor()\n\n    subFloorActor.SetMapper(subFloorMapper)\n\n    subFloor2Comp = vtkStructuredGridGeometryFilter()\n    subFloor2Comp.SetExtent(0, 37, 60, 75, 22, 22)\n    subFloor2Comp.SetInputData(sg)\n\n    subFloor2Mapper = vtkPolyDataMapper()\n    subFloor2Mapper.SetInputConnection(subFloor2Comp.GetOutputPort())\n    subFloor2Mapper.SetLookupTable(lut)\n    subFloor2Mapper.SetScalarRange(sg.GetScalarRange())\n\n    subFloor2Actor = vtkActor()\n\n    subFloor2Actor.SetMapper(subFloor2Mapper)\n\n    postComp = vtkStructuredGridGeometryFilter()\n\n    postComp.SetExtent(10, 10, 0, 75, 0, 37)\n    postComp.SetInputData(sg)\n\n    postMapper = vtkPolyDataMapper()\n    postMapper.SetInputConnection(postComp.GetOutputPort())\n    postMapper.SetLookupTable(lut)\n    postMapper.SetScalarRange(sg.GetScalarRange())\n\n    postActor = vtkActor()\n    postActor.SetMapper(postMapper)\n    postActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    fanComp = vtkStructuredGridGeometryFilter()\n    fanComp.SetExtent(0, 37, 38, 38, 0, 37)\n    fanComp.SetInputData(sg)\n\n    fanMapper = vtkPolyDataMapper()\n    fanMapper.SetInputConnection(fanComp.GetOutputPort())\n    fanMapper.SetLookupTable(lut)\n    fanMapper.SetScalarRange(sg.GetScalarRange())\n\n    fanActor = vtkActor()\n\n    fanActor.SetMapper(fanMapper)\n    fanActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    # streamers\n    #\n    # spherical seed points\n    rake = vtkPointSource()\n    rake.SetCenter(-0.74, 0, 0.3)\n    rake.SetNumberOfPoints(10)\n\n    # a line of seed points\n    seedsComp = vtkStructuredGridGeometryFilter()\n    seedsComp.SetExtent(10, 10, 37, 39, 1, 35)\n    seedsComp.SetInputData(sg)\n\n    streamers = vtkStreamTracer()\n    streamers.SetInputConnection(pl3d.GetOutputPort())\n\n    # streamers SetSource [rake GetOutput]\n    streamers.SetSourceConnection(seedsComp.GetOutputPort())\n    streamers.SetMaximumPropagation(250)\n    streamers.SetInitialIntegrationStep(.2)\n    streamers.SetMinimumIntegrationStep(.01)\n    streamers.SetIntegratorType(2)\n    streamers.Update()\n\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(streamers.GetOutputPort())\n    tubes.SetNumberOfSides(8)\n    tubes.SetRadius(0.08)\n    tubes.SetVaryRadius(0)\n\n    mapTubes = vtkPolyDataMapper()\n\n    mapTubes.SetInputConnection(tubes.GetOutputPort())\n    mapTubes.SetScalarRange(sg.GetScalarRange())\n\n    tubesActor = vtkActor()\n    tubesActor.SetMapper(mapTubes)\n\n    # outline\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(sg)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    # Create graphics stuff.\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(floorActor)\n    ren1.AddActor(subFloorActor)\n    ren1.AddActor(subFloor2Actor)\n    ren1.AddActor(postActor)\n    ren1.AddActor(fanActor)\n    ren1.AddActor(tubesActor)\n\n    aCam = vtkCamera()\n    aCam.SetFocalPoint(0.00657892, 0, 2.41026)\n    aCam.SetPosition(-1.94838, -47.1275, 39.4607)\n    aCam.SetViewUp(0.00653193, 0.617865, 0.786257)\n    ren1.ResetCamera()\n    aCam.Dolly(1.)\n    aCam.SetClippingRange(1, 100)\n\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.SetActiveCamera(aCam)\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('LOxGrid')\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'LOx post CFD case study.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('xyz_file', help='postxyz.bin.')\n    parser.add_argument('q_file', help='postq.bin.')\n    args = parser.parse_args()\n    return args.xyz_file, args.q_file\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/LOxSeeds/","title":"LOxSeeds","text":"

vtk-examples/Python/VisualizationAlgorithms/LOxSeeds

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/LOxSeeds/#code","title":"Code","text":"

LOxSeeds.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    xyxFile, qFile = get_program_parameters()\n\n    # Read the data.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.AutoDetectFormatOn()\n    pl3d.SetXYZFileName(xyxFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(153)\n    pl3d.SetVectorFunctionNumber(200)\n    pl3d.Update()\n\n    sg = pl3d.GetOutput().GetBlock(0)\n\n    # blue to red lut\n    #\n    lut = vtkLookupTable()\n    lut.SetHueRange(0.667, 0.0)\n\n    seeds = [[-0.74, 0.0, 0.3], [-0.74, 0.0, 1.0], [-0.74, 0.0, 2.0], [-0.74, 0.0, 3.0]]\n\n    renderers = list()\n\n    for s in range(0, len(seeds)):\n        # computational planes\n        floorComp = vtkStructuredGridGeometryFilter()\n        floorComp.SetExtent(0, 37, 0, 75, 0, 0)\n        floorComp.SetInputData(sg)\n        floorComp.Update()\n\n        floorMapper = vtkPolyDataMapper()\n        floorMapper.SetInputConnection(floorComp.GetOutputPort())\n        floorMapper.ScalarVisibilityOff()\n        floorMapper.SetLookupTable(lut)\n\n        floorActor = vtkActor()\n        floorActor.SetMapper(floorMapper)\n        floorActor.GetProperty().SetRepresentationToWireframe()\n        floorActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n        floorActor.GetProperty().SetLineWidth(2)\n\n        postComp = vtkStructuredGridGeometryFilter()\n        postComp.SetExtent(10, 10, 0, 75, 0, 37)\n        postComp.SetInputData(sg)\n\n        postMapper = vtkPolyDataMapper()\n        postMapper.SetInputConnection(postComp.GetOutputPort())\n        postMapper.SetLookupTable(lut)\n        postMapper.SetScalarRange(sg.GetScalarRange())\n\n        postActor = vtkActor()\n        postActor.SetMapper(postMapper)\n        postActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n        # streamers\n        #\n        # spherical seed points\n        rake = vtkPointSource()\n        rake.SetCenter(seeds[s])\n        rake.SetNumberOfPoints(10)\n\n        streamers = vtkStreamTracer()\n        streamers.SetInputConnection(pl3d.GetOutputPort())\n\n        # streamers SetSource [rake GetOutput]\n        streamers.SetSourceConnection(rake.GetOutputPort())\n        streamers.SetMaximumPropagation(250)\n        streamers.SetInitialIntegrationStep(.2)\n        streamers.SetMinimumIntegrationStep(.01)\n        streamers.SetIntegratorType(2)\n        streamers.Update()\n\n        tubes = vtkTubeFilter()\n        tubes.SetInputConnection(streamers.GetOutputPort())\n        tubes.SetNumberOfSides(8)\n        tubes.SetRadius(0.08)\n        tubes.SetVaryRadius(0)\n\n        mapTubes = vtkPolyDataMapper()\n\n        mapTubes.SetInputConnection(tubes.GetOutputPort())\n        mapTubes.SetScalarRange(sg.GetScalarRange())\n\n        tubesActor = vtkActor()\n        tubesActor.SetMapper(mapTubes)\n\n        renderer = vtkRenderer()\n\n        renderer.AddActor(floorActor)\n        renderer.AddActor(postActor)\n        renderer.AddActor(tubesActor)\n        renderer.SetBackground(colors.GetColor3d('SlateGray'))\n        renderers.append(renderer)\n\n    renderWindow = vtkRenderWindow()\n\n    # Setup viewports for the renderers\n    rendererSize = 256\n    xGridDimensions = 2\n    yGridDimensions = 2\n    renderWindow.SetSize(rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(xGridDimensions):\n            index = row * xGridDimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions, float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions, float(yGridDimensions - row) / yGridDimensions]\n            renderers[index].SetViewport(viewport)\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(0.918037, -0.0779233, 2.69513)\n    camera.SetPosition(0.840735, -23.6176, 8.50211)\n    camera.SetViewUp(0.00227904, 0.239501, 0.970893)\n    camera.SetClippingRange(1, 100)\n\n    renderers[0].SetActiveCamera(camera)\n    for r in range(0, len(renderers)):\n        renderWindow.AddRenderer(renderers[r])\n        if r > 0:\n            renderers[r].SetActiveCamera(camera)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderWindow.SetSize(512, 512)\n    renderWindow.SetWindowName('LOxSeeds')\n\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('xyz_file', help='postxyz.bin.')\n    parser.add_argument('q_file', help='postq.bin.')\n    args = parser.parse_args()\n    return args.xyz_file, args.q_file\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/MarchingCases/","title":"MarchingCases","text":"

vtk-examples/Python/VisualizationAlgorithms/MarchingCases

"},{"location":"Python/VisualizationAlgorithms/MarchingCases/#description","title":"Description","text":"

This example will help you understand the Marching Cubes Algorithm. The example takes one optional argument, a case number. There are 15 Marching Cubes cases, 0-14. There are also 15 complementary cases where the inside/outside value is flipped. To see a complementary case, supply a negative case number. For example, -7 is the complementary case of 7.

Note

According to the ACM Digital Library, the Marching Cubes paper is the most cited Siggraph paper.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/MarchingCases/#code","title":"Code","text":"

MarchingCases.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkIdList,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkGlyph3D,\n    vtkThresholdPoints,\n    vtkTubeFilter\n)\n\n# vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n# VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\ntry:\n    from vtkmodules.vtkFiltersCore import vtkExtractEdges\nexcept ImportError:\n    from vtkmodules.vtkFiltersExtraction import vtkExtractEdges\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkShrinkPolyData,\n    vtkTransformPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    mc_cases, rotation, label = get_program_parameters()\n    if not mc_cases:\n        mc_cases = [7]\n    else:\n        # Ensure that they are unique.\n        mc_cases = list(set(mc_cases))\n        # Check that they lie in the correct range.\n        badCases = []\n        for item in mc_cases:\n            if abs(int(item) > 14):\n                badCases.append(item)\n        if badCases:\n            print('Bad case number(s)', ','.join(map(str, badCases)))\n            for item in badCases:\n                mc_cases.remove(item)\n            if not mc_cases:\n                print('No cases.')\n                return\n    marching_cubes(mc_cases, rotation, label)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Marching cubes cases for 3D isosurface generation.'\n    epilogue = '''\n    Marching cubes cases for 3D isosurface generation.\n    The 256 possible cases have been reduced to 15 cases using symmetry.\n    Dark vertices are greater than the selected isosurface value.\n\n    For the cases, enter them as integers separated by a space e.g: 1 2 3  \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('cases', nargs='*', type=int, default=[],\n                        help='A list of integers i such that 0 <= abs(i) < 14,  corresponding to the cases desired.')\n    parser.add_argument('-r', '--rotation', type=int, default=0,\n                        help='Rotate camera around the cube, for i such that 0 <= abs(i) < 4,\\\n                          corresponding to 0, 90, 180, 270 degrees.')\n    # Use a mutually exclusive group.\n    label_parser = parser.add_mutually_exclusive_group(required=False)\n    label_parser.add_argument('-l', '--label', action='store_true', dest='label',\n                              help='Display a label, true by default.')\n    label_parser.add_argument('-n', '--no_label', action='store_false', dest='label',\n                              help='Supress diaplaying a label.')\n    parser.set_defaults(label=True)\n    args = parser.parse_args()\n    return args.cases, args.rotation, args.label\n\n\ndef marching_cubes(mcCases, rotation=0, label=True):\n    color = vtkNamedColors()\n\n    # Rotate the final figure 0, 90, 180, 270 degrees.\n    rotation = abs(int(rotation))\n    if rotation > 3:\n        rotation = 0\n\n    if len(mcCases) > 1:\n        print('Cases', ', '.join(map(str, mcCases)))\n    else:\n        print('Cases', ','.join(map(str, mcCases)))\n    print('Rotated', rotation * 90, 'degrees.')\n\n    renWin = vtkRenderWindow()\n    renWin.SetSize(640, 480)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Always use a grid of four columns unless number of cases < 4.\n    renderers = list()\n    gridSize = ((len(mcCases) + 3) // 4) * 4\n    if len(mcCases) < 4:\n        gridSize = len(mcCases)\n    for i in range(0, gridSize):\n        # Create the Renderer\n        renderer = vtkRenderer()\n        renderers.append(renderer)\n        # Set the background color.\n        renderers[i].SetBackground(color.GetColor3d('slate_grey'))\n        renWin.AddRenderer(renderer)\n\n    for i in range(0, len(mcCases)):\n        # Define a Single Cube\n        Scalars = vtkFloatArray()\n        Scalars.InsertNextValue(1.0)\n        Scalars.InsertNextValue(0.0)\n        Scalars.InsertNextValue(0.0)\n        Scalars.InsertNextValue(1.0)\n        Scalars.InsertNextValue(0.0)\n        Scalars.InsertNextValue(0.0)\n        Scalars.InsertNextValue(0.0)\n        Scalars.InsertNextValue(0.0)\n\n        Points = vtkPoints()\n        Points.InsertNextPoint(0, 0, 0)\n        Points.InsertNextPoint(1, 0, 0)\n        Points.InsertNextPoint(1, 1, 0)\n        Points.InsertNextPoint(0, 1, 0)\n        Points.InsertNextPoint(0, 0, 1)\n        Points.InsertNextPoint(1, 0, 1)\n        Points.InsertNextPoint(1, 1, 1)\n        Points.InsertNextPoint(0, 1, 1)\n\n        Ids = vtkIdList()\n        Ids.InsertNextId(0)\n        Ids.InsertNextId(1)\n        Ids.InsertNextId(2)\n        Ids.InsertNextId(3)\n        Ids.InsertNextId(4)\n        Ids.InsertNextId(5)\n        Ids.InsertNextId(6)\n        Ids.InsertNextId(7)\n\n        Grid = vtkUnstructuredGrid()\n        Grid.Allocate(10, 10)\n        Grid.InsertNextCell(12, Ids)\n        Grid.SetPoints(Points)\n        Grid.GetPointData().SetScalars(Scalars)\n\n        # Find the triangles that lie along the 0.5 contour in this cube.\n        Marching = vtkContourFilter()\n        Marching.SetInputData(Grid)\n        Marching.SetValue(0, 0.5)\n        Marching.Update()\n\n        # Extract the edges of the triangles just found.\n        triangleEdges = vtkExtractEdges()\n        triangleEdges.SetInputConnection(Marching.GetOutputPort())\n\n        # Draw the edges as tubes instead of lines.  Also create the associated\n        # mapper and actor to display the tubes.\n        triangleEdgeTubes = vtkTubeFilter()\n        triangleEdgeTubes.SetInputConnection(triangleEdges.GetOutputPort())\n        triangleEdgeTubes.SetRadius(.005)\n        triangleEdgeTubes.SetNumberOfSides(6)\n        triangleEdgeTubes.UseDefaultNormalOn()\n        triangleEdgeTubes.SetDefaultNormal(.577, .577, .577)\n\n        triangleEdgeMapper = vtkPolyDataMapper()\n        triangleEdgeMapper.SetInputConnection(triangleEdgeTubes.GetOutputPort())\n        triangleEdgeMapper.ScalarVisibilityOff()\n\n        triangleEdgeActor = vtkActor()\n        triangleEdgeActor.SetMapper(triangleEdgeMapper)\n        triangleEdgeActor.GetProperty().SetDiffuseColor(\n            color.GetColor3d('lamp_black'))\n        triangleEdgeActor.GetProperty().SetSpecular(.4)\n        triangleEdgeActor.GetProperty().SetSpecularPower(10)\n\n        # Shrink the triangles we found earlier.  Create the associated mapper\n        # and actor.  Set the opacity of the shrunken triangles.\n        aShrinker = vtkShrinkPolyData()\n        aShrinker.SetShrinkFactor(1)\n        aShrinker.SetInputConnection(Marching.GetOutputPort())\n\n        aMapper = vtkPolyDataMapper()\n        aMapper.ScalarVisibilityOff()\n        aMapper.SetInputConnection(aShrinker.GetOutputPort())\n\n        Triangles = vtkActor()\n        Triangles.SetMapper(aMapper)\n        Triangles.GetProperty().SetDiffuseColor(\n            color.GetColor3d('banana'))\n        Triangles.GetProperty().SetOpacity(.6)\n\n        # Draw a cube the same size and at the same position as the one\n        # created previously.  Extract the edges because we only want to see\n        # the outline of the cube.  Pass the edges through a vtkTubeFilter so\n        # they are displayed as tubes rather than lines.\n        CubeModel = vtkCubeSource()\n        CubeModel.SetCenter(.5, .5, .5)\n\n        Edges = vtkExtractEdges()\n        Edges.SetInputConnection(CubeModel.GetOutputPort())\n\n        Tubes = vtkTubeFilter()\n        Tubes.SetInputConnection(Edges.GetOutputPort())\n        Tubes.SetRadius(.01)\n        Tubes.SetNumberOfSides(6)\n        Tubes.UseDefaultNormalOn()\n        Tubes.SetDefaultNormal(.577, .577, .577)\n        # Create the mapper and actor to display the cube edges.\n        TubeMapper = vtkPolyDataMapper()\n        TubeMapper.SetInputConnection(Tubes.GetOutputPort())\n        CubeEdges = vtkActor()\n        CubeEdges.SetMapper(TubeMapper)\n        CubeEdges.GetProperty().SetDiffuseColor(\n            color.GetColor3d('khaki'))\n        CubeEdges.GetProperty().SetSpecular(.4)\n        CubeEdges.GetProperty().SetSpecularPower(10)\n\n        # Create a sphere to use as a glyph source for vtkGlyph3D.\n        Sphere = vtkSphereSource()\n        Sphere.SetRadius(0.04)\n        Sphere.SetPhiResolution(20)\n        Sphere.SetThetaResolution(20)\n        # Remove the part of the cube with data values below 0.5.\n        ThresholdIn = vtkThresholdPoints()\n        ThresholdIn.SetInputData(Grid)\n        ThresholdIn.ThresholdByUpper(.5)\n        # Display spheres at the vertices remaining in the cube data set after\n        # it was passed through vtkThresholdPoints.\n        Vertices = vtkGlyph3D()\n        Vertices.SetInputConnection(ThresholdIn.GetOutputPort())\n        Vertices.SetSourceConnection(Sphere.GetOutputPort())\n        # Create a mapper and actor to display the glyphs.\n        SphereMapper = vtkPolyDataMapper()\n        SphereMapper.SetInputConnection(Vertices.GetOutputPort())\n        SphereMapper.ScalarVisibilityOff()\n\n        CubeVertices = vtkActor()\n        CubeVertices.SetMapper(SphereMapper)\n        CubeVertices.GetProperty().SetDiffuseColor(\n            color.GetColor3d('tomato'))\n\n        # Define the text for the label\n        caseLabel = vtkVectorText()\n        caseLabel.SetText('Case 1')\n\n        if label:\n            # Set up a transform to move the label to a new position.\n            aLabelTransform = vtkTransform()\n            aLabelTransform.Identity()\n            # Position the label according to the rotation of the figure.\n            if rotation == 0:\n                aLabelTransform.Translate(-0.2, 0, 1.25)\n                aLabelTransform.Scale(.05, .05, .05)\n            elif rotation == 1:\n                aLabelTransform.RotateY(90)\n                aLabelTransform.Translate(-1.25, 0, 1.25)\n                aLabelTransform.Scale(.05, .05, .05)\n            elif rotation == 2:\n                aLabelTransform.RotateY(180)\n                aLabelTransform.Translate(-1.25, 0, 0.2)\n                aLabelTransform.Scale(.05, .05, .05)\n            else:\n                aLabelTransform.RotateY(270)\n                aLabelTransform.Translate(-0.2, 0, 0.2)\n                aLabelTransform.Scale(.05, .05, .05)\n\n            # Move the label to a new position.\n            labelTransform = vtkTransformPolyDataFilter()\n            labelTransform.SetTransform(aLabelTransform)\n            labelTransform.SetInputConnection(caseLabel.GetOutputPort())\n\n            # Create a mapper and actor to display the text.\n            labelMapper = vtkPolyDataMapper()\n            labelMapper.SetInputConnection(labelTransform.GetOutputPort())\n\n            labelActor = vtkActor()\n            labelActor.SetMapper(labelMapper)\n\n        # Define the base that the cube sits on.  Create its associated mapper\n        # and actor.  Set the position of the actor.\n        baseModel = vtkCubeSource()\n        baseModel.SetXLength(1.5)\n        baseModel.SetYLength(.01)\n        baseModel.SetZLength(1.5)\n\n        baseMapper = vtkPolyDataMapper()\n        baseMapper.SetInputConnection(baseModel.GetOutputPort())\n\n        base = vtkActor()\n        base.SetMapper(baseMapper)\n        base.SetPosition(.5, -0.09, .5)\n\n        # Set the scalar values for this case of marching cubes.\n        # A negative case number will generate a complementary case\n        mcCase = mcCases[i]\n        if mcCase < 0:\n            cases[-mcCase](Scalars, caseLabel, 0, 1)\n        else:\n            cases[mcCase](Scalars, caseLabel, 1, 0)\n        # Force the grid to update.\n        Grid.Modified()\n\n        # Add the actors to the renderer\n        renderers[i].AddActor(triangleEdgeActor)\n        renderers[i].AddActor(base)\n        if label:\n            renderers[i].AddActor(labelActor)\n        renderers[i].AddActor(CubeEdges)\n        renderers[i].AddActor(CubeVertices)\n        renderers[i].AddActor(Triangles)\n\n        # Position the camera.\n        renderers[i].GetActiveCamera().Dolly(1.2)\n        # Rotate the camera an extra 30 degrees so the cube is not face on.\n        if rotation == 0:\n            renderers[i].GetActiveCamera().Azimuth(30)\n        elif rotation == 1:\n            renderers[i].GetActiveCamera().Azimuth(30 + 90)\n        elif rotation == 2:\n            renderers[i].GetActiveCamera().Azimuth(30 + 180)\n        else:\n            renderers[i].GetActiveCamera().Azimuth(30 + 270)\n\n        renderers[i].GetActiveCamera().Elevation(20)\n        renderers[i].ResetCamera()\n        renderers[i].ResetCameraClippingRange()\n        if i > 0:\n            renderers[i].SetActiveCamera(renderers[0].GetActiveCamera())\n\n    # Setup viewports for the renderers\n    rendererSize = 300\n    xGridDimensions = 4\n    if len(mcCases) < 4:\n        xGridDimensions = len(mcCases)\n    yGridDimensions = (len(mcCases) - 1) // 4 + 1\n    print('Grid dimensions, (x, y): ({:d}, {:d})'.format(xGridDimensions, yGridDimensions))\n    renWin.SetSize(\n        rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    renWin.SetWindowName('MarchingCases')\n    for row in range(0, yGridDimensions):\n        for col in range(0, xGridDimensions):\n            index = row * xGridDimensions + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewport = [\n                float(col) / xGridDimensions,\n                float(yGridDimensions - (row + 1)) / yGridDimensions,\n                float(col + 1) / xGridDimensions,\n                float(yGridDimensions - row) / yGridDimensions]\n\n            renderers[index].SetViewport(viewport)\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef case0(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 0 - 00000000')\n    else:\n        caseLabel.SetText('Case 0c - 11111111')\n\n\ndef case1(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 1 - 00000001')\n    else:\n        caseLabel.SetText('Case 1c - 11111110')\n\n\ndef case2(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 2 - 00000011')\n    else:\n        caseLabel.SetText('Case 2c - 11111100')\n\n\ndef case3(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, IN)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 3 - 00000101')\n    else:\n        caseLabel.SetText('Case 3c - 11111010')\n\n\ndef case4(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 4 - 01000001')\n    else:\n        caseLabel.SetText('Case 4c - 10111110')\n\n\ndef case5(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 5 - 00110010')\n    else:\n        caseLabel.SetText('Case 5c - 11001101')\n\n\ndef case6(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 6 - 00011010')\n    else:\n        caseLabel.SetText('Case 6c - 11100101')\n\n\ndef case7(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 7 - 01000011')\n    else:\n        caseLabel.SetText('Case 7c - 10111100')\n\n\ndef case8(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 8 - 00110011')\n    else:\n        caseLabel.SetText('Case 8c - 11001100')\n\n\ndef case9(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, IN)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 9 - 01001110')\n    else:\n        caseLabel.SetText('Case 9c - 10110001')\n\n\ndef case10(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 10 - 01101001')\n    else:\n        caseLabel.SetText('Case 10c - 10010110')\n\n\ndef case11(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 11 - 01110001')\n    else:\n        caseLabel.SetText('Case 11c - 10001110')\n\n\ndef case12(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 12 - 00111010')\n    else:\n        caseLabel.SetText('Case 12c - 11000101')\n\n\ndef case13(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 13 - 01011010')\n    else:\n        caseLabel.SetText('Case 13c - 10100101')\n\n\ndef case14(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, IN)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, IN)\n    if IN == 1:\n        caseLabel.SetText('Case 14 - 11101101')\n    else:\n        caseLabel.SetText('Case 14c - 00010010')\n\n\ncases = [case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10, case11, case12, case13, case14]\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/MarchingCasesA/","title":"MarchingCasesA","text":"

vtk-examples/Python/VisualizationAlgorithms/MarchingCasesA

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/MarchingCasesA/#code","title":"Code","text":"

MarchingCasesA.py

#!/usr/bin/env python\n\n\"\"\"\nMarching cubes cases for 3D isosurface generation.\nThe 256 possible cases have been reduced to 15 cases using symmetry.\nDark vertices are greater than the selected isosurface value.\n\nNote: Make sure MarchingCases.py is in the same directory as this program.\n\"\"\"\n\nimport MarchingCases\n\n\ndef main():\n    mc_cases = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n    MarchingCases.marching_cubes(mc_cases)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/MarchingCasesB/","title":"MarchingCasesB","text":"

vtk-examples/Python/VisualizationAlgorithms/MarchingCasesB

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/MarchingCasesB/#code","title":"Code","text":"

MarchingCasesB.py

#!/usr/bin/env python\n\n\"\"\"\nMarching cubes complementary cases.\n\nCases 3c, 6c, 7c, 10c, 12c and 13c are displayed.\n\nNote: Make sure MarchingCases.py is in the same directory as this program.\n\"\"\"\n\nimport MarchingCases\n\n\ndef main():\n    mc_cases = [-3, -6, -7, -10, -12, -13]\n    MarchingCases.marching_cubes(mc_cases)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/MarchingCasesC/","title":"MarchingCasesC","text":"

vtk-examples/Python/VisualizationAlgorithms/MarchingCasesC

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/MarchingCasesC/#code","title":"Code","text":"

MarchingCasesC.py

#!/usr/bin/env python\n\n\"\"\"\nMarching cubes cases.\n\nCase 3 is rotated 90 degrees about the y-axis with no label.\n\nNote: Make sure MarchingCases.py is in the same directory as this program.\n\"\"\"\n\nimport MarchingCases\n\n\ndef main():\n    mc_cases = [3]\n    rotation = 1\n    label = False\n    MarchingCases.marching_cubes(mc_cases, rotation, label)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/MarchingCasesD/","title":"MarchingCasesD","text":"

vtk-examples/Python/VisualizationAlgorithms/MarchingCasesD

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/MarchingCasesD/#code","title":"Code","text":"

MarchingCasesD.py

#!/usr/bin/env python\n\n\"\"\"\nMarching cubes cases.\n\nCase 7 is rotated 180 degrees about the y-axis with no label.\n\nNote: Make sure MarchingCases.py is in the same directory as this program.\n\"\"\"\n\nimport MarchingCases\n\n\ndef main():\n    mc_cases = [7]\n    rotation = 2\n    label = False\n    MarchingCases.marching_cubes(mc_cases, rotation, label)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/Motor/","title":"Motor","text":"

vtk-examples/Python/VisualizationAlgorithms/Motor

"},{"location":"Python/VisualizationAlgorithms/Motor/#description","title":"Description","text":"

This is an example of texture clipping using a transparent texture map. The motor shown consists of five complex parts, some of which are hidden by the outer casing. To see the inside of the motor, we define an implicit clipping function. This function is simply the intersection of two planes to form a clipping \"corner\". The object vtkImplicitTextureCoords is used in combination with this implicit function to generate texture coordinates. These objects are then rendered with the appropriate texture map and the internal parts of the motor can be seen.

The texture map consists of three regions (as described previously in the chapter). The concealed region is transparent. The transition region is opaque but with a black (zero intensity) color. The highlighted region is full intensity and opaque. As can be seen from the result , the boundaries appear as black borders giving a nice visual effect.

Note the use of vectors in the C++ version and lists in the Python version to reduce repetitious code.

Info

See Figure 9-53 in Chapter 9 The VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/Motor/#code","title":"Code","text":"

Motor.py

#!/usr/bin/env python\n\n# This code is based on the VTK file: /IO/Geometry/Testing/Python/motor.py.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPlanes\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkFiltersTexture import vtkImplicitTextureCoords\nfrom vtkmodules.vtkIOGeometry import vtkBYUReader\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    textureFile, motorFile = get_program_parameters()\n\n    # Create the Renderer, RenderWindow and RenderWindowInteractor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the cutting planes.\n    planes = vtkPlanes()\n    points = vtkPoints()\n    norms = vtkFloatArray()\n\n    norms.SetNumberOfComponents(3)\n    points.InsertPoint(0, 0.0, 0.0, 0.0)\n    norms.InsertTuple3(0, 0.0, 0.0, 1.0)\n    points.InsertPoint(1, 0.0, 0.0, 0.0)\n    norms.InsertTuple3(1, -1.0, 0.0, 0.0)\n    planes.SetPoints(points)\n    planes.SetNormals(norms)\n\n    # Get the texture.\n    texReader = vtkStructuredPointsReader()\n    texReader.SetFileName(textureFile)\n    texture = vtkTexture()\n    texture.SetInputConnection(texReader.GetOutputPort())\n    texture.InterpolateOff()\n    texture.RepeatOff()\n\n    # Set up the pipelines for the parts of the motor.\n    # We will use lists of pipeline objects.\n    numberOfParts = 5\n    byu = list()\n    normals = list()\n    tex = list()\n    byuMapper = list()\n    byuActor = list()\n    partColours = ['cold_grey', 'peacock', 'raw_sienna', 'banana', 'peach_puff']\n    # Use this to control which parts to display.\n    displayParts = [True] * numberOfParts\n    # If displayParts[2] = False then an image like that in the VTK tests is produced.\n\n    # Build the pipelines.\n    for i in range(0, numberOfParts):\n        byu.append(vtkBYUReader())\n        byu[i].SetGeometryFileName(motorFile)\n        byu[i].SetPartNumber(i + 1)\n\n        normals.append(vtkPolyDataNormals())\n        normals[i].SetInputConnection(byu[i].GetOutputPort())\n\n        tex.append(vtkImplicitTextureCoords())\n        tex[i].SetInputConnection(normals[i].GetOutputPort())\n        tex[i].SetRFunction(planes)\n        # tex[i].FlipTextureOn()\n\n        byuMapper.append(vtkDataSetMapper())\n        byuMapper[i].SetInputConnection(tex[i].GetOutputPort())\n\n        byuActor.append(vtkActor())\n        byuActor[i].SetMapper(byuMapper[i])\n        byuActor[i].SetTexture(texture)\n        byuActor[i].GetProperty().SetColor(colors.GetColor3d(partColours[i]))\n\n        ren.AddActor(byuActor[i])\n        if displayParts[i]:\n            byuActor[i].VisibilityOn()\n        else:\n            byuActor[i].VisibilityOff()\n\n    ren.SetBackground(colors.GetColor3d('AliceBlue'))\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('Motor')\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(0.0286334, 0.0362996, 0.0379685)\n    camera.SetPosition(1.37067, 1.08629, -1.30349)\n    camera.SetViewAngle(17.673)\n    camera.SetClippingRange(1, 10)\n    camera.SetViewUp(-0.376306, -0.5085, -0.774482)\n    ren.SetActiveCamera(camera)\n\n    # Render the image.\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Texture clipping using a transparent texture map.'\n    epilogue = '''\n        Texture clipping using a transparent texture map.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('textureFile', help='The texture file: texThres2.vtk')\n    parser.add_argument('motorFile', help='The motor file: motor.g.')\n    args = parser.parse_args()\n    return args.textureFile, args.motorFile\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/Office/","title":"Office","text":"

vtk-examples/Python/VisualizationAlgorithms/Office

"},{"location":"Python/VisualizationAlgorithms/Office/#description","title":"Description","text":"

Using random point seeds to create streamlines.

This example demonstrates the use of vtkPointSource to generate streamlines. The dataset is a structured grid representation of a CFD simulation of flow in a small office with flow velocity and a scalar pressure field. As this picture shows, there are a couple of bookcases, desks, a window, and an inlet and outlet for the ventilation system. On one of the desks is a small, intense heat source (e.g., a cigarette).

We generate 25 streamlines that are started near the inlet using a vtkPointSource point generator. By adjusting a single parameter (e.g., the center of the point source) it is possible to quickly explore our simulation data.

This program provides you with an optional parameter to select from one of several point source centers. The figure was created using:

./Office office.vtk 3\n

Info

See Figure 9-47 in Chapter 9 in the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/Office/#code","title":"Code","text":"

Office.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOLegacy import vtkDataSetReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef office(fileName, center):\n    # These are the centers for the streamline seed.\n    seedCenters = [\n        [0.0, 2.1, 0.5],\n        [0.1, 2.1, 0.5],\n        [0.1, 2.7, 0.5],\n        [0.08, 2.7, 0.5]\n    ]\n    center = abs(center)\n    if center >= len(seedCenters):\n        center = len(seedCenters) - 1\n\n    colors = vtkNamedColors()\n    # Set the furniture colors, matching those in the VTKTextBook.\n    tableTopColor = [0.59, 0.427, 0.392]\n    filingCabinetColor = [0.8, 0.8, 0.6]\n    bookShelfColor = [0.8, 0.8, 0.6]\n    windowColor = [0.3, 0.3, 0.5]\n    colors.SetColor('TableTop', *tableTopColor)\n    colors.SetColor('FilingCabinet', *filingCabinetColor)\n    colors.SetColor('BookShelf', *bookShelfColor)\n    colors.SetColor('WindowColor', *windowColor)\n\n    # We read a data file that represents a CFD analysis of airflow in an office\n    # (with ventilation and a burning cigarette).\n    reader = vtkDataSetReader()\n    reader.SetFileName(fileName)\n\n    # Create the scene.\n    # We generate a whole bunch of planes which correspond to\n    # the geometry in the analysis; tables, bookshelves and so on.\n    table1 = vtkStructuredGridGeometryFilter()\n    table1.SetInputData(reader.GetStructuredGridOutput())\n    table1.SetExtent(11, 15, 7, 9, 8, 8)\n    mapTable1 = vtkPolyDataMapper()\n    mapTable1.SetInputConnection(table1.GetOutputPort())\n    mapTable1.ScalarVisibilityOff()\n    table1Actor = vtkActor()\n    table1Actor.SetMapper(mapTable1)\n    table1Actor.GetProperty().SetColor(colors.GetColor3d('TableTop'))\n\n    table2 = vtkStructuredGridGeometryFilter()\n    table2.SetInputData(reader.GetStructuredGridOutput())\n    table2.SetExtent(11, 15, 10, 12, 8, 8)\n    mapTable2 = vtkPolyDataMapper()\n    mapTable2.SetInputConnection(table2.GetOutputPort())\n    mapTable2.ScalarVisibilityOff()\n    table2Actor = vtkActor()\n    table2Actor.SetMapper(mapTable2)\n    table2Actor.GetProperty().SetColor(colors.GetColor3d('TableTop'))\n\n    FilingCabinet1 = vtkStructuredGridGeometryFilter()\n    FilingCabinet1.SetInputData(reader.GetStructuredGridOutput())\n    FilingCabinet1.SetExtent(15, 15, 7, 9, 0, 8)\n    mapFilingCabinet1 = vtkPolyDataMapper()\n    mapFilingCabinet1.SetInputConnection(FilingCabinet1.GetOutputPort())\n    mapFilingCabinet1.ScalarVisibilityOff()\n    FilingCabinet1Actor = vtkActor()\n    FilingCabinet1Actor.SetMapper(mapFilingCabinet1)\n    FilingCabinet1Actor.GetProperty().SetColor(colors.GetColor3d('FilingCabinet'))\n\n    FilingCabinet2 = vtkStructuredGridGeometryFilter()\n    FilingCabinet2.SetInputData(reader.GetStructuredGridOutput())\n    FilingCabinet2.SetExtent(15, 15, 10, 12, 0, 8)\n    mapFilingCabinet2 = vtkPolyDataMapper()\n    mapFilingCabinet2.SetInputConnection(FilingCabinet2.GetOutputPort())\n    mapFilingCabinet2.ScalarVisibilityOff()\n    FilingCabinet2Actor = vtkActor()\n    FilingCabinet2Actor.SetMapper(mapFilingCabinet2)\n    FilingCabinet2Actor.GetProperty().SetColor(colors.GetColor3d('FilingCabinet'))\n\n    bookshelf1Top = vtkStructuredGridGeometryFilter()\n    bookshelf1Top.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Top.SetExtent(13, 13, 0, 4, 0, 11)\n    mapBookshelf1Top = vtkPolyDataMapper()\n    mapBookshelf1Top.SetInputConnection(bookshelf1Top.GetOutputPort())\n    mapBookshelf1Top.ScalarVisibilityOff()\n    bookshelf1TopActor = vtkActor()\n    bookshelf1TopActor.SetMapper(mapBookshelf1Top)\n    bookshelf1TopActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Bottom = vtkStructuredGridGeometryFilter()\n    bookshelf1Bottom.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Bottom.SetExtent(20, 20, 0, 4, 0, 11)\n    mapBookshelf1Bottom = vtkPolyDataMapper()\n    mapBookshelf1Bottom.SetInputConnection(bookshelf1Bottom.GetOutputPort())\n    mapBookshelf1Bottom.ScalarVisibilityOff()\n    bookshelf1BottomActor = vtkActor()\n    bookshelf1BottomActor.SetMapper(mapBookshelf1Bottom)\n    bookshelf1BottomActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Front = vtkStructuredGridGeometryFilter()\n    bookshelf1Front.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Front.SetExtent(13, 20, 0, 0, 0, 11)\n    mapBookshelf1Front = vtkPolyDataMapper()\n    mapBookshelf1Front.SetInputConnection(bookshelf1Front.GetOutputPort())\n    mapBookshelf1Front.ScalarVisibilityOff()\n    bookshelf1FrontActor = vtkActor()\n    bookshelf1FrontActor.SetMapper(mapBookshelf1Front)\n    bookshelf1FrontActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Back = vtkStructuredGridGeometryFilter()\n    bookshelf1Back.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Back.SetExtent(13, 20, 4, 4, 0, 11)\n    mapBookshelf1Back = vtkPolyDataMapper()\n    mapBookshelf1Back.SetInputConnection(bookshelf1Back.GetOutputPort())\n    mapBookshelf1Back.ScalarVisibilityOff()\n    bookshelf1BackActor = vtkActor()\n    bookshelf1BackActor.SetMapper(mapBookshelf1Back)\n    bookshelf1BackActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1LHS = vtkStructuredGridGeometryFilter()\n    bookshelf1LHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1LHS.SetExtent(13, 20, 0, 4, 0, 0)\n    mapBookshelf1LHS = vtkPolyDataMapper()\n    mapBookshelf1LHS.SetInputConnection(bookshelf1LHS.GetOutputPort())\n    mapBookshelf1LHS.ScalarVisibilityOff()\n    bookshelf1LHSActor = vtkActor()\n    bookshelf1LHSActor.SetMapper(mapBookshelf1LHS)\n    bookshelf1LHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1RHS = vtkStructuredGridGeometryFilter()\n    bookshelf1RHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1RHS.SetExtent(13, 20, 0, 4, 11, 11)\n    mapBookshelf1RHS = vtkPolyDataMapper()\n    mapBookshelf1RHS.SetInputConnection(bookshelf1RHS.GetOutputPort())\n    mapBookshelf1RHS.ScalarVisibilityOff()\n    bookshelf1RHSActor = vtkActor()\n    bookshelf1RHSActor.SetMapper(mapBookshelf1RHS)\n    bookshelf1RHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Top = vtkStructuredGridGeometryFilter()\n    bookshelf2Top.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Top.SetExtent(13, 13, 15, 19, 0, 11)\n    mapBookshelf2Top = vtkPolyDataMapper()\n    mapBookshelf2Top.SetInputConnection(bookshelf2Top.GetOutputPort())\n    mapBookshelf2Top.ScalarVisibilityOff()\n    bookshelf2TopActor = vtkActor()\n    bookshelf2TopActor.SetMapper(mapBookshelf2Top)\n    bookshelf2TopActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Bottom = vtkStructuredGridGeometryFilter()\n    bookshelf2Bottom.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Bottom.SetExtent(20, 20, 15, 19, 0, 11)\n    mapBookshelf2Bottom = vtkPolyDataMapper()\n    mapBookshelf2Bottom.SetInputConnection(bookshelf2Bottom.GetOutputPort())\n    mapBookshelf2Bottom.ScalarVisibilityOff()\n    bookshelf2BottomActor = vtkActor()\n    bookshelf2BottomActor.SetMapper(mapBookshelf2Bottom)\n    bookshelf2BottomActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Front = vtkStructuredGridGeometryFilter()\n    bookshelf2Front.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Front.SetExtent(13, 20, 15, 15, 0, 11)\n    mapBookshelf2Front = vtkPolyDataMapper()\n    mapBookshelf2Front.SetInputConnection(bookshelf2Front.GetOutputPort())\n    mapBookshelf2Front.ScalarVisibilityOff()\n    bookshelf2FrontActor = vtkActor()\n    bookshelf2FrontActor.SetMapper(mapBookshelf2Front)\n    bookshelf2FrontActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Back = vtkStructuredGridGeometryFilter()\n    bookshelf2Back.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Back.SetExtent(13, 20, 19, 19, 0, 11)\n    mapBookshelf2Back = vtkPolyDataMapper()\n    mapBookshelf2Back.SetInputConnection(bookshelf2Back.GetOutputPort())\n    mapBookshelf2Back.ScalarVisibilityOff()\n    bookshelf2BackActor = vtkActor()\n    bookshelf2BackActor.SetMapper(mapBookshelf2Back)\n    bookshelf2BackActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2LHS = vtkStructuredGridGeometryFilter()\n    bookshelf2LHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2LHS.SetExtent(13, 20, 15, 19, 0, 0)\n    mapBookshelf2LHS = vtkPolyDataMapper()\n    mapBookshelf2LHS.SetInputConnection(bookshelf2LHS.GetOutputPort())\n    mapBookshelf2LHS.ScalarVisibilityOff()\n    bookshelf2LHSActor = vtkActor()\n    bookshelf2LHSActor.SetMapper(mapBookshelf2LHS)\n    bookshelf2LHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2RHS = vtkStructuredGridGeometryFilter()\n    bookshelf2RHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2RHS.SetExtent(13, 20, 15, 19, 11, 11)\n    mapBookshelf2RHS = vtkPolyDataMapper()\n    mapBookshelf2RHS.SetInputConnection(bookshelf2RHS.GetOutputPort())\n    mapBookshelf2RHS.ScalarVisibilityOff()\n    bookshelf2RHSActor = vtkActor()\n    bookshelf2RHSActor.SetMapper(mapBookshelf2RHS)\n    bookshelf2RHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    window = vtkStructuredGridGeometryFilter()\n    window.SetInputData(reader.GetStructuredGridOutput())\n    window.SetExtent(20, 20, 6, 13, 10, 13)\n    mapWindow = vtkPolyDataMapper()\n    mapWindow.SetInputConnection(window.GetOutputPort())\n    mapWindow.ScalarVisibilityOff()\n    windowActor = vtkActor()\n    windowActor.SetMapper(mapWindow)\n    windowActor.GetProperty().SetColor(colors.GetColor3d('WindowColor'))\n\n    outlet = vtkStructuredGridGeometryFilter()\n    outlet.SetInputData(reader.GetStructuredGridOutput())\n    outlet.SetExtent(0, 0, 9, 10, 14, 16)\n    mapOutlet = vtkPolyDataMapper()\n    mapOutlet.SetInputConnection(outlet.GetOutputPort())\n    mapOutlet.ScalarVisibilityOff()\n    outletActor = vtkActor()\n    outletActor.SetMapper(mapOutlet)\n    outletActor.GetProperty().SetColor(colors.GetColor3d('lamp_black'))\n\n    inlet = vtkStructuredGridGeometryFilter()\n    inlet.SetInputData(reader.GetStructuredGridOutput())\n    inlet.SetExtent(0, 0, 9, 10, 0, 6)\n    mapInlet = vtkPolyDataMapper()\n    mapInlet.SetInputConnection(inlet.GetOutputPort())\n    mapInlet.ScalarVisibilityOff()\n    inletActor = vtkActor()\n    inletActor.SetMapper(mapInlet)\n    inletActor.GetProperty().SetColor(colors.GetColor3d('lamp_black'))\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(reader.GetStructuredGridOutput())\n    mapOutline = vtkPolyDataMapper()\n    mapOutline.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(mapOutline)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create the source for the streamtubes.\n    seeds = vtkPointSource()\n    seeds.SetRadius(0.075)\n    seeds.SetCenter(seedCenters[center])\n    seeds.SetNumberOfPoints(25)\n    streamers = vtkStreamTracer()\n    streamers.SetInputConnection(reader.GetOutputPort())\n    streamers.SetSourceConnection(seeds.GetOutputPort())\n    streamers.SetMaximumPropagation(500)\n    streamers.SetMinimumIntegrationStep(0.1)\n    streamers.SetMaximumIntegrationStep(1.0)\n    streamers.SetInitialIntegrationStep(0.2)\n    streamers.SetIntegratorType(2)\n    streamers.Update()\n    mapStreamers = vtkPolyDataMapper()\n    mapStreamers.SetInputConnection(streamers.GetOutputPort())\n    mapStreamers.SetScalarRange(reader.GetOutput().GetPointData().GetScalars().GetRange())\n    streamersActor = vtkActor()\n    streamersActor.SetMapper(mapStreamers)\n\n    # Create the rendering window, renderer, and interactive renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('Office')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the remaining actors to the renderer, set the background and size.\n    ren.AddActor(table1Actor)\n    ren.AddActor(table2Actor)\n    ren.AddActor(FilingCabinet1Actor)\n    ren.AddActor(FilingCabinet2Actor)\n    ren.AddActor(bookshelf1TopActor)\n    ren.AddActor(bookshelf1BottomActor)\n    ren.AddActor(bookshelf1FrontActor)\n    ren.AddActor(bookshelf1BackActor)\n    ren.AddActor(bookshelf1LHSActor)\n    ren.AddActor(bookshelf1RHSActor)\n    ren.AddActor(bookshelf2TopActor)\n    ren.AddActor(bookshelf2BottomActor)\n    ren.AddActor(bookshelf2FrontActor)\n    ren.AddActor(bookshelf2BackActor)\n    ren.AddActor(bookshelf2LHSActor)\n    ren.AddActor(bookshelf2RHSActor)\n    ren.AddActor(windowActor)\n    ren.AddActor(outletActor)\n    ren.AddActor(inletActor)\n    ren.AddActor(outlineActor)\n    ren.AddActor(streamersActor)\n\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    aCamera = vtkCamera()\n    aCamera.SetClippingRange(0.726079, 36.3039)\n    aCamera.SetFocalPoint(2.43584, 2.15046, 1.11104)\n    aCamera.SetPosition(-4.76183, -10.4426, 3.17203)\n    aCamera.ComputeViewPlaneNormal()\n    aCamera.SetViewUp(0.0511273, 0.132773, 0.989827)\n    aCamera.SetViewAngle(18.604)\n    aCamera.Zoom(1.2)\n\n    ren.SetActiveCamera(aCamera)\n\n    renWin.SetSize(640, 400)\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrate the use of vtkPointSource to generate streamlines.'\n    epilogue = '''\n    center: An optional parameter choosing the center for the seeds.\n        0 - Corresponds to Fig 9-47(a) in the VTK textbook.\n        1 - A slight shift to the left.\n        2 - A slight shift to the upper left (from the original code).\n        3 - The default, a slight shift to the upper left.\n            Roughly corresponds to Fig 9-47(b) in the VTK textbook.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('fileName', help='office.binary.vtk')\n    parser.add_argument('center', default=3, type=int, nargs='?', help='seed center.')\n    args = parser.parse_args()\n    return args.fileName, args.center\n\n\ndef main():\n    fileName, center = get_program_parameters()\n    office(fileName, center)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/OfficeA/","title":"OfficeA","text":"

vtk-examples/Python/VisualizationAlgorithms/OfficeA

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/OfficeA/#code","title":"Code","text":"

OfficeA.py

#!/usr/bin/env python\n\n\"\"\"\nOfficeA.\n\nNote: Make sure Office.py is in the same directory as this program.\n\"\"\"\n\nimport Office\n\n\ndef main():\n    file_name, center = Office.get_program_parameters()\n    center = 0\n    Office.office(file_name, center)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/OfficeTube/","title":"OfficeTube","text":"

vtk-examples/Python/VisualizationAlgorithms/OfficeTube

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/OfficeTube/#code","title":"Code","text":"

OfficeTube.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkDataObject\nfrom vtkmodules.vtkCommonMath import vtkRungeKutta4\nfrom vtkmodules.vtkFiltersCore import (\n    vtkStructuredGridOutlineFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOLegacy import vtkDataSetReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n    # Set the furniture colors, matching those in the VTKTextBook.\n    tableTopColor = [0.59, 0.427, 0.392]\n    filingCabinetColor = [0.8, 0.8, 0.6]\n    bookShelfColor = [0.8, 0.8, 0.6]\n    windowColor = [0.3, 0.3, 0.5]\n    colors.SetColor('TableTop', *tableTopColor)\n    colors.SetColor('FilingCabinet', *filingCabinetColor)\n    colors.SetColor('BookShelf', *bookShelfColor)\n    colors.SetColor('WindowColor', *windowColor)\n\n    # We read a data file that represents a CFD analysis of airflow in an office\n    # (with ventilation and a burning cigarette). We force an update so that we\n    # can query the output for its length, i.e., the length of the diagonal\n    # of the bounding box. This is useful for normalizing the data.\n    reader = vtkDataSetReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    # Now we will generate a single streamline in the data. We select the\n    # integration order to use (RungeKutta order 4) and associate it with\n    # the streamer. The start position is the position in world space where\n    # we want to begin streamline integration; and we integrate in both\n    # directions. The step length is the length of the line segments that\n    # make up the streamline (i.e., related to display). The\n    # IntegrationStepLength specifies the integration step length as a\n    # fraction of the cell size that the streamline is in.\n    integ = vtkRungeKutta4()\n\n    streamer = vtkStreamTracer()\n    streamer.SetInputConnection(reader.GetOutputPort())\n    streamer.SetStartPosition(0.1, 2.1, 0.5)\n    streamer.SetMaximumPropagation(500)\n    streamer.SetInitialIntegrationStep(0.05)\n    streamer.SetIntegrationDirectionToBoth()\n    streamer.SetIntegrator(integ)\n\n    # The tube is wrapped around the generated streamline. By varying the radius\n    # by the inverse of vector magnitude, we are creating a tube whose radius is\n    # proportional to mass flux (in incompressible flow).\n    streamTube = vtkTubeFilter()\n    streamTube.SetInputConnection(streamer.GetOutputPort())\n    streamTube.SetInputArrayToProcess(1, 0, 0, vtkDataObject.FIELD_ASSOCIATION_POINTS, 'vectors')\n    streamTube.SetRadius(0.02)\n    streamTube.SetNumberOfSides(12)\n    streamTube.SetVaryRadiusToVaryRadiusByVector()\n\n    mapStreamTube = vtkPolyDataMapper()\n    mapStreamTube.SetInputConnection(streamTube.GetOutputPort())\n    mapStreamTube.SetScalarRange(reader.GetOutput().GetPointData().GetScalars().GetRange())\n\n    streamTubeActor = vtkActor()\n    streamTubeActor.SetMapper(mapStreamTube)\n    streamTubeActor.GetProperty().BackfaceCullingOn()\n\n    # Create the scene.\n    # We generate a whole bunch of planes which correspond to\n    # the geometry in the analysis; tables, bookshelves and so on.\n    table1 = vtkStructuredGridGeometryFilter()\n    table1.SetInputData(reader.GetStructuredGridOutput())\n    table1.SetExtent(11, 15, 7, 9, 8, 8)\n    mapTable1 = vtkPolyDataMapper()\n    mapTable1.SetInputConnection(table1.GetOutputPort())\n    mapTable1.ScalarVisibilityOff()\n    table1Actor = vtkActor()\n    table1Actor.SetMapper(mapTable1)\n    table1Actor.GetProperty().SetColor(colors.GetColor3d('TableTop'))\n\n    table2 = vtkStructuredGridGeometryFilter()\n    table2.SetInputData(reader.GetStructuredGridOutput())\n    table2.SetExtent(11, 15, 10, 12, 8, 8)\n    mapTable2 = vtkPolyDataMapper()\n    mapTable2.SetInputConnection(table2.GetOutputPort())\n    mapTable2.ScalarVisibilityOff()\n    table2Actor = vtkActor()\n    table2Actor.SetMapper(mapTable2)\n    table2Actor.GetProperty().SetColor(colors.GetColor3d('TableTop'))\n\n    FilingCabinet1 = vtkStructuredGridGeometryFilter()\n    FilingCabinet1.SetInputData(reader.GetStructuredGridOutput())\n    FilingCabinet1.SetExtent(15, 15, 7, 9, 0, 8)\n    mapFilingCabinet1 = vtkPolyDataMapper()\n    mapFilingCabinet1.SetInputConnection(FilingCabinet1.GetOutputPort())\n    mapFilingCabinet1.ScalarVisibilityOff()\n    FilingCabinet1Actor = vtkActor()\n    FilingCabinet1Actor.SetMapper(mapFilingCabinet1)\n    FilingCabinet1Actor.GetProperty().SetColor(colors.GetColor3d('FilingCabinet'))\n\n    FilingCabinet2 = vtkStructuredGridGeometryFilter()\n    FilingCabinet2.SetInputData(reader.GetStructuredGridOutput())\n    FilingCabinet2.SetExtent(15, 15, 10, 12, 0, 8)\n    mapFilingCabinet2 = vtkPolyDataMapper()\n    mapFilingCabinet2.SetInputConnection(FilingCabinet2.GetOutputPort())\n    mapFilingCabinet2.ScalarVisibilityOff()\n    FilingCabinet2Actor = vtkActor()\n    FilingCabinet2Actor.SetMapper(mapFilingCabinet2)\n    FilingCabinet2Actor.GetProperty().SetColor(colors.GetColor3d('FilingCabinet'))\n\n    bookshelf1Top = vtkStructuredGridGeometryFilter()\n    bookshelf1Top.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Top.SetExtent(13, 13, 0, 4, 0, 11)\n    mapBookshelf1Top = vtkPolyDataMapper()\n    mapBookshelf1Top.SetInputConnection(bookshelf1Top.GetOutputPort())\n    mapBookshelf1Top.ScalarVisibilityOff()\n    bookshelf1TopActor = vtkActor()\n    bookshelf1TopActor.SetMapper(mapBookshelf1Top)\n    bookshelf1TopActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Bottom = vtkStructuredGridGeometryFilter()\n    bookshelf1Bottom.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Bottom.SetExtent(20, 20, 0, 4, 0, 11)\n    mapBookshelf1Bottom = vtkPolyDataMapper()\n    mapBookshelf1Bottom.SetInputConnection(bookshelf1Bottom.GetOutputPort())\n    mapBookshelf1Bottom.ScalarVisibilityOff()\n    bookshelf1BottomActor = vtkActor()\n    bookshelf1BottomActor.SetMapper(mapBookshelf1Bottom)\n    bookshelf1BottomActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Front = vtkStructuredGridGeometryFilter()\n    bookshelf1Front.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Front.SetExtent(13, 20, 0, 0, 0, 11)\n    mapBookshelf1Front = vtkPolyDataMapper()\n    mapBookshelf1Front.SetInputConnection(bookshelf1Front.GetOutputPort())\n    mapBookshelf1Front.ScalarVisibilityOff()\n    bookshelf1FrontActor = vtkActor()\n    bookshelf1FrontActor.SetMapper(mapBookshelf1Front)\n    bookshelf1FrontActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Back = vtkStructuredGridGeometryFilter()\n    bookshelf1Back.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Back.SetExtent(13, 20, 4, 4, 0, 11)\n    mapBookshelf1Back = vtkPolyDataMapper()\n    mapBookshelf1Back.SetInputConnection(bookshelf1Back.GetOutputPort())\n    mapBookshelf1Back.ScalarVisibilityOff()\n    bookshelf1BackActor = vtkActor()\n    bookshelf1BackActor.SetMapper(mapBookshelf1Back)\n    bookshelf1BackActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1LHS = vtkStructuredGridGeometryFilter()\n    bookshelf1LHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1LHS.SetExtent(13, 20, 0, 4, 0, 0)\n    mapBookshelf1LHS = vtkPolyDataMapper()\n    mapBookshelf1LHS.SetInputConnection(bookshelf1LHS.GetOutputPort())\n    mapBookshelf1LHS.ScalarVisibilityOff()\n    bookshelf1LHSActor = vtkActor()\n    bookshelf1LHSActor.SetMapper(mapBookshelf1LHS)\n    bookshelf1LHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1RHS = vtkStructuredGridGeometryFilter()\n    bookshelf1RHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1RHS.SetExtent(13, 20, 0, 4, 11, 11)\n    mapBookshelf1RHS = vtkPolyDataMapper()\n    mapBookshelf1RHS.SetInputConnection(bookshelf1RHS.GetOutputPort())\n    mapBookshelf1RHS.ScalarVisibilityOff()\n    bookshelf1RHSActor = vtkActor()\n    bookshelf1RHSActor.SetMapper(mapBookshelf1RHS)\n    bookshelf1RHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Top = vtkStructuredGridGeometryFilter()\n    bookshelf2Top.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Top.SetExtent(13, 13, 15, 19, 0, 11)\n    mapBookshelf2Top = vtkPolyDataMapper()\n    mapBookshelf2Top.SetInputConnection(bookshelf2Top.GetOutputPort())\n    mapBookshelf2Top.ScalarVisibilityOff()\n    bookshelf2TopActor = vtkActor()\n    bookshelf2TopActor.SetMapper(mapBookshelf2Top)\n    bookshelf2TopActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Bottom = vtkStructuredGridGeometryFilter()\n    bookshelf2Bottom.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Bottom.SetExtent(20, 20, 15, 19, 0, 11)\n    mapBookshelf2Bottom = vtkPolyDataMapper()\n    mapBookshelf2Bottom.SetInputConnection(bookshelf2Bottom.GetOutputPort())\n    mapBookshelf2Bottom.ScalarVisibilityOff()\n    bookshelf2BottomActor = vtkActor()\n    bookshelf2BottomActor.SetMapper(mapBookshelf2Bottom)\n    bookshelf2BottomActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Front = vtkStructuredGridGeometryFilter()\n    bookshelf2Front.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Front.SetExtent(13, 20, 15, 15, 0, 11)\n    mapBookshelf2Front = vtkPolyDataMapper()\n    mapBookshelf2Front.SetInputConnection(bookshelf2Front.GetOutputPort())\n    mapBookshelf2Front.ScalarVisibilityOff()\n    bookshelf2FrontActor = vtkActor()\n    bookshelf2FrontActor.SetMapper(mapBookshelf2Front)\n    bookshelf2FrontActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Back = vtkStructuredGridGeometryFilter()\n    bookshelf2Back.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Back.SetExtent(13, 20, 19, 19, 0, 11)\n    mapBookshelf2Back = vtkPolyDataMapper()\n    mapBookshelf2Back.SetInputConnection(bookshelf2Back.GetOutputPort())\n    mapBookshelf2Back.ScalarVisibilityOff()\n    bookshelf2BackActor = vtkActor()\n    bookshelf2BackActor.SetMapper(mapBookshelf2Back)\n    bookshelf2BackActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2LHS = vtkStructuredGridGeometryFilter()\n    bookshelf2LHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2LHS.SetExtent(13, 20, 15, 19, 0, 0)\n    mapBookshelf2LHS = vtkPolyDataMapper()\n    mapBookshelf2LHS.SetInputConnection(bookshelf2LHS.GetOutputPort())\n    mapBookshelf2LHS.ScalarVisibilityOff()\n    bookshelf2LHSActor = vtkActor()\n    bookshelf2LHSActor.SetMapper(mapBookshelf2LHS)\n    bookshelf2LHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2RHS = vtkStructuredGridGeometryFilter()\n    bookshelf2RHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2RHS.SetExtent(13, 20, 15, 19, 11, 11)\n    mapBookshelf2RHS = vtkPolyDataMapper()\n    mapBookshelf2RHS.SetInputConnection(bookshelf2RHS.GetOutputPort())\n    mapBookshelf2RHS.ScalarVisibilityOff()\n    bookshelf2RHSActor = vtkActor()\n    bookshelf2RHSActor.SetMapper(mapBookshelf2RHS)\n    bookshelf2RHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    window = vtkStructuredGridGeometryFilter()\n    window.SetInputData(reader.GetStructuredGridOutput())\n    window.SetExtent(20, 20, 6, 13, 10, 13)\n    mapWindow = vtkPolyDataMapper()\n    mapWindow.SetInputConnection(window.GetOutputPort())\n    mapWindow.ScalarVisibilityOff()\n    windowActor = vtkActor()\n    windowActor.SetMapper(mapWindow)\n    windowActor.GetProperty().SetColor(colors.GetColor3d('WindowColor'))\n\n    outlet = vtkStructuredGridGeometryFilter()\n    outlet.SetInputData(reader.GetStructuredGridOutput())\n    outlet.SetExtent(0, 0, 9, 10, 14, 16)\n    mapOutlet = vtkPolyDataMapper()\n    mapOutlet.SetInputConnection(outlet.GetOutputPort())\n    mapOutlet.ScalarVisibilityOff()\n    outletActor = vtkActor()\n    outletActor.SetMapper(mapOutlet)\n    outletActor.GetProperty().SetColor(colors.GetColor3d('lamp_black'))\n\n    inlet = vtkStructuredGridGeometryFilter()\n    inlet.SetInputData(reader.GetStructuredGridOutput())\n    inlet.SetExtent(0, 0, 9, 10, 0, 6)\n    mapInlet = vtkPolyDataMapper()\n    mapInlet.SetInputConnection(inlet.GetOutputPort())\n    mapInlet.ScalarVisibilityOff()\n    inletActor = vtkActor()\n    inletActor.SetMapper(mapInlet)\n    inletActor.GetProperty().SetColor(colors.GetColor3d('lamp_black'))\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(reader.GetStructuredGridOutput())\n    mapOutline = vtkPolyDataMapper()\n    mapOutline.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(mapOutline)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create the rendering window, renderer, and interactive renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the remaining actors to the renderer, set the background and size.\n    ren.AddActor(table1Actor)\n    ren.AddActor(table2Actor)\n    ren.AddActor(FilingCabinet1Actor)\n    ren.AddActor(FilingCabinet2Actor)\n    ren.AddActor(bookshelf1TopActor)\n    ren.AddActor(bookshelf1BottomActor)\n    ren.AddActor(bookshelf1FrontActor)\n    ren.AddActor(bookshelf1BackActor)\n    ren.AddActor(bookshelf1LHSActor)\n    ren.AddActor(bookshelf1RHSActor)\n    ren.AddActor(bookshelf2TopActor)\n    ren.AddActor(bookshelf2BottomActor)\n    ren.AddActor(bookshelf2FrontActor)\n    ren.AddActor(bookshelf2BackActor)\n    ren.AddActor(bookshelf2LHSActor)\n    ren.AddActor(bookshelf2RHSActor)\n    ren.AddActor(windowActor)\n    ren.AddActor(outletActor)\n    ren.AddActor(inletActor)\n    ren.AddActor(outlineActor)\n    ren.AddActor(streamTubeActor)\n\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    aCamera = vtkCamera()\n    aCamera.SetClippingRange(0.726079, 36.3039)\n    aCamera.SetFocalPoint(2.43584, 2.15046, 1.11104)\n    aCamera.SetPosition(-4.76183, -10.4426, 3.17203)\n    aCamera.ComputeViewPlaneNormal()\n    aCamera.SetViewUp(0.0511273, 0.132773, 0.989827)\n    aCamera.SetViewAngle(18.604)\n    aCamera.Zoom(1.2)\n\n    ren.SetActiveCamera(aCamera)\n\n    renWin.SetSize(640, 400)\n    renWin.SetWindowName('OfficeTube')\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The stream polygon. Sweeping a polygon to form a tube..'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('fileName', help='office.binary.')\n    args = parser.parse_args()\n    return args.fileName\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/PineRootConnectivity/","title":"PineRootConnectivity","text":"

vtk-examples/Python/VisualizationAlgorithms/PineRootConnectivity

"},{"location":"Python/VisualizationAlgorithms/PineRootConnectivity/#description","title":"Description","text":"

Demonstrates how to apply the connectivity filter to remove noisy isosurfaces.

To illustrate the application of connectivity analysis, we will use an MRI dataset generated by Janet MacFall at the Center for In Vivo Microscopy at Duke University. The dataset is a volume of dimensions 256^3. The data is of the root system of a small pine tree. Using the class vtkSliceCubes , an implementation of marching cubes for large volumes, we generate an initial isosurface represented by 351,536 triangles. This is a faster way of manipulating this data. If you have a large enough computer you can process the volume directly with a vtk image reader and vtkMarchingCubes. The example on this other page shows the initial dataset. Notice that there are many small, disconnected isosurfaces due to noise and isolated moisture in the data. We use vtkConnectivityFilter to remove these small, disconnected surfaces. The example on this page shows the result of applying the filter. Over 50,000 triangles were removed, leaving 299,380 triangles. The vtkConnectivityFilter is a general filter taking datasets as input, and generating an unstructured grid as output. It functions by extracting cells that are connected at points (i.e., share common points). In this example the single largest surface is extracted. It is also possible to specify cell ids and point ids and extract surfaces connected to these.

Info

To count the number of triangles in the polydata we do the following:

Cite

Comparative Water Uptake by Roots of Different Ages in Seedlings of Loblolly Pine (Pinus taeda L.) December 1991. New Phytologist 119(4):551 - 560.

Info

See Figure 9-51 in Chapter 9 in the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/PineRootConnectivity/#c","title":"C++","text":"

We use a lambda function c++ auto NumberofTriangles = [](auto *pd)

"},{"location":"Python/VisualizationAlgorithms/PineRootConnectivity/#python","title":"Python","text":"

We just implement: python def NumberOfTriangles(pd): within the scope of the calling function.

"},{"location":"Python/VisualizationAlgorithms/PineRootConnectivity/#code","title":"Code","text":"

PineRootConnectivity.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdList\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataConnectivityFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOGeometry import vtkMCubesReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef pine_root_connectivity(fileName, noConnectivity):\n    def NumberOfTriangles(pd):\n        \"\"\"\n        Count the number of triangles.\n        :param pd: vtkPolyData.\n        :return: The number of triangles.\n        \"\"\"\n        cells = pd.GetPolys()\n        numOfTriangles = 0\n        idList = vtkIdList()\n        for i in range(0, cells.GetNumberOfCells()):\n            cells.GetNextCell(idList)\n            # If a cell has three points it is a triangle.\n            if idList.GetNumberOfIds() == 3:\n                numOfTriangles += 1\n        return numOfTriangles\n\n    colors = vtkNamedColors()\n\n    # Create the pipeline.\n    reader = vtkMCubesReader()\n    reader.SetFileName(fileName)\n    if not noConnectivity:\n        reader.Update()\n        print('Before Connectivity.')\n        print('There are: ', NumberOfTriangles(reader.GetOutput()), 'triangles')\n\n    connect = vtkPolyDataConnectivityFilter()\n    connect.SetInputConnection(reader.GetOutputPort())\n    connect.SetExtractionModeToLargestRegion()\n    if not noConnectivity:\n        connect.Update()\n        print('After Connectivity.')\n        print('There are: ', NumberOfTriangles(connect.GetOutput()), 'triangles')\n\n    isoMapper = vtkPolyDataMapper()\n    if noConnectivity:\n        isoMapper.SetInputConnection(reader.GetOutputPort())\n    else:\n        isoMapper.SetInputConnection(connect.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d('raw_sienna'))\n\n    #  Get an outline of the data set for context.\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create the Renderer, RenderWindow and RenderWindowInteractor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(outlineActor)\n    ren.AddActor(isoActor)\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('PineRootConnectivity')\n\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # render the image\n    #\n    # iren AddObserver UserEvent {wm deiconify .vtkInteract}\n    cam = ren.GetActiveCamera()\n    cam.SetFocalPoint(40.6018, 37.2813, 50.1953)\n    cam.SetPosition(40.6018, -280.533, 47.0172)\n    cam.ComputeViewPlaneNormal()\n    cam.SetClippingRange(26.1073, 1305.36)\n    cam.SetViewAngle(20.9219)\n    cam.SetViewUp(0.0, 0.0, 1.0)\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef main():\n    fileName, noConnectivity = get_program_parameters()\n    noConnectivity = noConnectivity != 0\n    pine_root_connectivity(fileName, noConnectivity)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Applying connectivity filter to remove noisy isosurfaces.'\n    epilogue = '''\n        Applying connectivity filter to remove noisy isosurfaces.\n\nThis example demonstrates how to use the vtkConnectivityFilter.\nIf the extra parameter 'noConnectivity' is non zero, the connectivity filter will not be used.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='pine_root.tri.')\n    parser.add_argument('noConnectivity', default=0, type=int, nargs='?',\n                        help='If non-zero do not use the connectivity filter.')\n    args = parser.parse_args()\n    return args.filename, args.noConnectivity\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/PineRootConnectivityA/","title":"PineRootConnectivityA","text":"

vtk-examples/Python/VisualizationAlgorithms/PineRootConnectivityA

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/PineRootConnectivityA/#code","title":"Code","text":"

PineRootConnectivityA.py

#!/usr/bin/env python\n\n\"\"\"\nPineRootConnectivityA\n\nNote: Make sure PineRootConnectivity.py is in the same directory as this program.\n\"\"\"\n\nimport PineRootConnectivity\n\n\ndef main():\n    fileName, noConnectivity = PineRootConnectivity.get_program_parameters()\n    noConnectivity = 1\n    PineRootConnectivity.pine_root_connectivity(fileName, noConnectivity)\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/PineRootDecimation/","title":"PineRootDecimation","text":"

vtk-examples/Python/VisualizationAlgorithms/PineRootDecimation

"},{"location":"Python/VisualizationAlgorithms/PineRootDecimation/#description","title":"Description","text":"

Demonstrates how to apply the decimation filter to get a reduced data size and then the connectivity filter to remove noisy isosurfaces. The data is from the root system of a pine tree.

To count the number of triangles in the polydata we do the following:

"},{"location":"Python/VisualizationAlgorithms/PineRootDecimation/#c","title":"C++","text":"

We use a lambda function

auto NumberofTriangles = [](auto *pd)\n
"},{"location":"Python/VisualizationAlgorithms/PineRootDecimation/#python","title":"Python","text":"

We just implement:

def NumberOfTriangles(pd):\n

within the scope of the calling function.

Info

See Figure 9-52 in Chapter 9 in the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/PineRootDecimation/#code","title":"Code","text":"

PineRootDecimation.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdList\nfrom vtkmodules.vtkFiltersCore import (\n    vtkConnectivityFilter,\n    vtkDecimatePro\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOGeometry import vtkMCubesReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    def NumberOfTriangles(pd):\n        \"\"\"\n        Count the number of triangles.\n        :param pd: vtkPolyData.\n        :return: The number of triangles.\n        \"\"\"\n        cells = pd.GetPolys()\n        numOfTriangles = 0\n        idList = vtkIdList()\n        for i in range(0, cells.GetNumberOfCells()):\n            cells.GetNextCell(idList)\n            # If a cell has three points it is a triangle.\n            if idList.GetNumberOfIds() == 3:\n                numOfTriangles += 1\n        return numOfTriangles\n\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Create the pipeline.\n    reader = vtkMCubesReader()\n    reader.SetFileName(fileName)\n    reader.FlipNormalsOff()\n    reader.Update()\n    print('Before Decimation.')\n    print('There are: ', NumberOfTriangles(reader.GetOutput()), 'triangles')\n\n    deci = vtkDecimatePro()\n    deci.SetInputConnection(reader.GetOutputPort())\n    deci.SetTargetReduction(0.9)\n    deci.SetAbsoluteError(0.0005)\n    deci.MaximumIterations = 6\n    deci.SetFeatureAngle(30)\n    deci.SetErrorIsAbsolute(1)\n    deci.AccumulateErrorOn()\n    # deci.SplittingOff()\n    deci.Update()\n    print('After Decimation.')\n    print('There are: ', NumberOfTriangles(deci.GetOutput()), 'triangles')\n\n    connect = vtkConnectivityFilter()\n    connect.SetInputConnection(deci.GetOutputPort())\n    connect.SetExtractionModeToLargestRegion()\n    connect.Update()\n    print('After Connectivity.')\n    print('There are: ', NumberOfTriangles(connect.GetOutput()), 'triangles')\n\n    isoMapper = vtkDataSetMapper()\n    isoMapper.SetInputConnection(connect.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d('raw_sienna'))\n\n    #  Get an outline of the data set for context.\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    #  Create the Renderer, RenderWindow and RenderWindowInteractor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(outlineActor)\n    ren.AddActor(isoActor)\n    ren.SetBackground(1, 1, 1)\n    # renWin.SetSize(750, 750)\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('PineRootDecimation')\n\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # render the image\n\n    cam = ren.GetActiveCamera()\n    cam.SetFocalPoint(40.6018, 37.2813, 50.1953)\n    cam.SetPosition(40.6018, -280.533, 47.0172)\n    cam.ComputeViewPlaneNormal()\n    cam.SetClippingRange(26.1073, 1305.36)\n    cam.SetViewAngle(20.9219)\n    cam.SetViewUp(0.0, 0.0, 1.0)\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Applying connectivity and decimation filters to remove noisy isosurfaces and reduce data size.'\n    epilogue = '''\n        Applying connectivity and decimation filters to remove noisy isosurfaces and reduce data size..\n\nThis example demonstrates how to use the vtkConnectivityFilter and vtkDecimate.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='pine_root.tri.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/PlateVibration/","title":"PlateVibration","text":"

vtk-examples/Python/VisualizationAlgorithms/PlateVibration

"},{"location":"Python/VisualizationAlgorithms/PlateVibration/#description","title":"Description","text":"

The motion of a vibrating beam is shown. The original undeformed outline is shown as a wireframe.

Info

See Figure 6-14a in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/PlateVibration/#code","title":"Code","text":"

PlateVibration.py

# Translated from vib.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataNormals,\n    vtkVectorDot\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpVector\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    file_name = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Set the colors.\n    colors.SetColor('PlateColor', [255, 160, 140, 255])\n    colors.SetColor('BkgColor', [65, 99, 149, 255])\n\n    # Read a vtk file\n    #\n    plate = vtkPolyDataReader()\n    plate.SetFileName(file_name)\n    plate.Update()\n    bounds = [0] * 6\n    plate.GetOutput().GetBounds(bounds)\n    plate.SetVectorsName('mode2')\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(plate.GetOutputPort())\n    warp = vtkWarpVector()\n    warp.SetInputConnection(normals.GetOutputPort())\n    warp.SetScaleFactor(0.5)\n    color = vtkVectorDot()\n    color.SetInputConnection(warp.GetOutputPort())\n    plateMapper = vtkDataSetMapper()\n    plateMapper.SetInputConnection(warp.GetOutputPort())\n    plateActor = vtkActor()\n    plateActor.SetMapper(plateMapper)\n    plateActor.GetProperty().SetColor(\n        colors.GetColor3d('PlateColor'))\n    plateActor.RotateX(-90)\n\n    # Create the outline.\n    #\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(plate.GetOutputPort())\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(spikeMapper)\n    outlineActor.RotateX(-90)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('White'))\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren.AddActor(plateActor)\n    ren.AddActor(outlineActor)\n    renWin.SetSize(500, 500)\n    renWin.SetWindowName('PlateVibration')\n\n    # Render the image.\n    renWin.Render()\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(-3.7, 13, 15.5)\n    ren.ResetCameraClippingRange()\n\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produces figure 6-14(a) Beam displacement from the VTK Textbook.'\n    epilogue = '''\n        Produce figure 6\u201314(a) Beam displacement from the VTK Textbook..\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='plate.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/ProbeCombustor/","title":"ProbeCombustor","text":"

vtk-examples/Python/VisualizationAlgorithms/ProbeCombustor

"},{"location":"Python/VisualizationAlgorithms/ProbeCombustor/#description","title":"Description","text":"

Probing obtains dataset attributes by sampling one dataset (the input) with a set of points (the probe). Probing is also called \u201cresampling.\u201d Examples include probing an input dataset with a sequence of points along a line, on a plane, or in a volume. The result of the probing is a new dataset (the output) with the topological and geometric structure of the probe dataset, and point attributes interpolated from the input dataset. Once the probing operation is completed, the output dataset can be visualized with any of the appropriate techniques in VTK.

This example illustrates the details of the probing process. For every point in the probe dataset, the location in the input dataset (i.e., cell, subcell, and parametric coordinates) and interpolation weights are determined. Then the data values from the cell are interpolated to the probe point. Probe points that are outside the input dataset are assigned a nil (or appropriate) value. This process repeats for all points in the probe dataset.

Info

See Figure 9-19 in Chapter 9 The VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/ProbeCombustor/#code","title":"Code","text":"

ProbeCombustor.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkContourFilter,\n    vtkProbeFilter,\n    vtkStructuredGridOutlineFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName1, fileName2 = get_program_parameters()\n\n    # Create the pipeline.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(fileName1)\n    pl3d.SetQFileName(fileName2)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    sg = pl3d.GetOutput().GetBlock(0)\n\n    # We create three planes and position them in the correct position\n    # using transform filters. They are then appended together and used as\n    # a probe.\n    plane = vtkPlaneSource()\n    plane.SetResolution(50, 50)\n\n    transP1 = vtkTransform()\n    transP1.Translate(3.7, 0.0, 28.37)\n    transP1.Scale(5, 5, 5)\n    transP1.RotateY(90)\n\n    tpd1 = vtkTransformPolyDataFilter()\n    tpd1.SetInputConnection(plane.GetOutputPort())\n    tpd1.SetTransform(transP1)\n\n    outTpd1 = vtkOutlineFilter()\n    outTpd1.SetInputConnection(tpd1.GetOutputPort())\n\n    mapTpd1 = vtkPolyDataMapper()\n    mapTpd1.SetInputConnection(outTpd1.GetOutputPort())\n\n    tpd1Actor = vtkActor()\n    tpd1Actor.SetMapper(mapTpd1)\n    tpd1Actor.GetProperty().SetColor(0, 0, 0)\n    tpd1Actor.GetProperty().SetLineWidth(2.0)\n\n    transP2 = vtkTransform()\n    transP2.Translate(9.2, 0.0, 31.20)\n    transP2.Scale(5, 5, 5)\n    transP2.RotateY(90)\n\n    tpd2 = vtkTransformPolyDataFilter()\n    tpd2.SetInputConnection(plane.GetOutputPort())\n    tpd2.SetTransform(transP2)\n\n    outTpd2 = vtkOutlineFilter()\n    outTpd2.SetInputConnection(tpd2.GetOutputPort())\n\n    mapTpd2 = vtkPolyDataMapper()\n    mapTpd2.SetInputConnection(outTpd2.GetOutputPort())\n\n    tpd2Actor = vtkActor()\n    tpd2Actor.SetMapper(mapTpd2)\n    tpd2Actor.GetProperty().SetColor(0, 0, 0)\n    tpd2Actor.GetProperty().SetLineWidth(2.0)\n\n    transP3 = vtkTransform()\n    transP3.Translate(13.27, 0.0, 33.30)\n    transP3.Scale(5, 5, 5)\n    transP3.RotateY(90)\n\n    tpd3 = vtkTransformPolyDataFilter()\n    tpd3.SetInputConnection(plane.GetOutputPort())\n    tpd3.SetTransform(transP3)\n\n    outTpd3 = vtkOutlineFilter()\n    outTpd3.SetInputConnection(tpd3.GetOutputPort())\n\n    mapTpd3 = vtkPolyDataMapper()\n    mapTpd3.SetInputConnection(outTpd3.GetOutputPort())\n\n    tpd3Actor = vtkActor()\n    tpd3Actor.SetMapper(mapTpd3)\n    tpd3Actor.GetProperty().SetColor(0, 0, 0)\n    tpd3Actor.GetProperty().SetLineWidth(2.0)\n\n    appendF = vtkAppendPolyData()\n    appendF.AddInputConnection(tpd1.GetOutputPort())\n    appendF.AddInputConnection(tpd2.GetOutputPort())\n    appendF.AddInputConnection(tpd3.GetOutputPort())\n\n    # The vtkProbeFilter takes two inputs. One is a dataset to use as the probe\n    # geometry (SetInputConnection) the other is the data to probe\n    # (SetSourceConnection). The output dataset structure (geometry and\n    # topology) of the probe is the same as the structure of the input. The\n    # probing process generates new data values resampled from the source.\n    probe = vtkProbeFilter()\n    probe.SetInputConnection(appendF.GetOutputPort())\n    probe.SetSourceData(sg)\n\n    contour = vtkContourFilter()\n    contour.SetInputConnection(probe.GetOutputPort())\n    contour.GenerateValues(50, sg.GetScalarRange())\n\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contour.GetOutputPort())\n    contourMapper.SetScalarRange(sg.GetScalarRange())\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(contourMapper)\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(sg)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(0, 0, 0)\n    outlineActor.GetProperty().SetLineWidth(2.0)\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(planeActor)\n    ren1.AddActor(tpd1Actor)\n    ren1.AddActor(tpd2Actor)\n    ren1.AddActor(tpd3Actor)\n    ren1.SetBackground(colors.GetColor3d('Gainsboro'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('ProbeCombustor')\n\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().SetClippingRange(3.95297, 50)\n    ren1.GetActiveCamera().SetFocalPoint(8.88908, 0.595038, 29.3342)\n    ren1.GetActiveCamera().SetPosition(-12.3332, 31.7479, 41.2387)\n    ren1.GetActiveCamera().SetViewUp(0.060772, -0.319905, 0.945498)\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This shows how to probe a dataset with a plane. The probed data is then contoured. '\n    epilogue = '''\n\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/SingleSplat/","title":"SingleSplat","text":"

vtk-examples/Python/VisualizationAlgorithms/SingleSplat

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/SingleSplat/#code","title":"Code","text":"

SingleSplat.py

#!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkImagingHybrid import vtkGaussianSplatter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    aren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(aren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create single splat point\n    pts = vtkPoints()\n    verts = vtkCellArray()\n    norms = vtkDoubleArray()\n    scalars = vtkDoubleArray()\n\n    x = [0.0] * 3\n    pts.InsertNextPoint(x)\n    norms.SetNumberOfTuples(1)\n    norms.SetNumberOfComponents(3)\n    n = [0] * 3\n    n[0] = 0.707\n    n[1] = 0.707\n    n[2] = 0.0\n    norms.InsertTuple(0, n)\n    scalars.SetNumberOfTuples(1)\n    scalars.SetNumberOfComponents(1)\n    scalars.InsertTuple1(0, 1.0)\n\n    verts.InsertNextCell(1)\n    verts.InsertCellPoint(0)\n\n    pData = vtkPolyData()\n    pData.SetPoints(pts)\n    pData.SetVerts(verts)\n    pData.GetPointData().SetNormals(norms)\n    pData.GetPointData().SetScalars(scalars)\n\n    # Splat point and generate isosurface.\n    splat = vtkGaussianSplatter()\n    splat.SetInputData(pData)\n    splat.SetModelBounds(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0)\n    splat.SetSampleDimensions(75, 75, 75)\n    splat.SetRadius(0.5)\n    splat.SetEccentricity(5.0)\n    splat.SetExponentFactor(-3.25)\n    contour = vtkContourFilter()\n    contour.SetInputConnection(splat.GetOutputPort())\n    contour.SetValue(0, 0.9)\n    splatMapper = vtkPolyDataMapper()\n    splatMapper.SetInputConnection(contour.GetOutputPort())\n    splatActor = vtkActor()\n    splatActor.SetMapper(splatMapper)\n\n    # Create outline.\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(splat.GetOutputPort())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Brown'))\n\n    # Create cone to indicate direction.\n    cone = vtkConeSource()\n    cone.SetResolution(24)\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.SetScale(0.75, 0.75, 0.75)\n    coneActor.RotateZ(45.0)\n    coneActor.AddPosition(0.50, 0.50, 0.0)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('DeepPink'))\n    #\n    # Rendering stuff.\n    #\n    aren.SetBackground(colors.GetColor3d('Beige'))\n    aren.AddActor(splatActor)\n    aren.AddActor(outlineActor)\n    aren.AddActor(coneActor)\n\n    renWin.SetSize(640, 640)\n    renWin.SetWindowName('SingleSplat')\n    renWin.Render()\n\n    # Interact with the data.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/SpikeFran/","title":"SpikeFran","text":"

vtk-examples/Python/VisualizationAlgorithms/SpikeFran

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/SpikeFran/#code","title":"Code","text":"

SpikeFran.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkGlyph3D,\n    vtkMaskPoints,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    fran = vtkPolyDataReader()\n    fran.SetFileName(fileName)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(fran.GetOutputPort())\n    normals.FlipNormalsOn()\n\n    franMapper = vtkPolyDataMapper()\n    franMapper.SetInputConnection(normals.GetOutputPort())\n\n    franActor = vtkActor()\n    franActor.SetMapper(franMapper)\n    franActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n\n    # We subsample the dataset because we want to glyph just a subset of\n    # the points. Otherwise the display is cluttered and cannot be easily\n    # read. The RandomModeOn and SetOnRatio combine to random select one out\n    # of every 10 points in the dataset.\n    #\n    ptMask = vtkMaskPoints()\n    ptMask.SetInputConnection(normals.GetOutputPort())\n    ptMask.SetOnRatio(10)\n    ptMask.RandomModeOn()\n\n    # In this case we are using a cone as a glyph. We transform the cone so\n    # its base is at 0,0,0. This is the point where glyph rotation occurs.\n    cone = vtkConeSource()\n    cone.SetResolution(6)\n\n    transform = vtkTransform()\n    transform.Translate(0.5, 0.0, 0.0)\n\n    transformF = vtkTransformPolyDataFilter()\n    transformF.SetInputConnection(cone.GetOutputPort())\n    transformF.SetTransform(transform)\n\n    # vtkGlyph3D takes two inputs: the input point set (SetInputConnection)\n    # which can be any vtkDataSet and the glyph (SetSourceConnection) which\n    # must be a vtkPolyData.  We are interested in orienting the glyphs by the\n    # surface normals that we previously generated.\n    glyph = vtkGlyph3D()\n    glyph.SetInputConnection(ptMask.GetOutputPort())\n    glyph.SetSourceConnection(transformF.GetOutputPort())\n    glyph.SetVectorModeToUseNormal()\n    glyph.SetScaleModeToScaleByVector()\n    glyph.SetScaleFactor(0.004)\n\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(glyph.GetOutputPort())\n\n    spikeActor = vtkActor()\n    spikeActor.SetMapper(spikeMapper)\n    spikeActor.GetProperty().SetColor(colors.GetColor3d('Emerald_Green'))\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(franActor)\n    ren1.AddActor(spikeActor)\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('SpikeFran')\n\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Render the image.\n    #\n    renWin.Render()\n\n    ren1.GetActiveCamera().Zoom(1.4)\n    ren1.GetActiveCamera().Azimuth(110)\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This example demonstrates the use of glyphing.'\n    epilogue = '''\n    We also use a mask filter to select a subset of points to glyph.\n\n    About the data file:\n      This originally was a Cyberware laser digitizer scan\n      of Fran J.'s face. Surface normals are generated based on local geometry\n      (i.e., the polygon normals surrounding each point are averaged). We flip\n      the normals because we want them to point out from Fran's face.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='fran_cut.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/SplatFace/","title":"SplatFace","text":"

vtk-examples/Python/VisualizationAlgorithms/SplatFace

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/SplatFace/#code","title":"Code","text":"

SplatFace.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkMaskPoints,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkImagingHybrid import vtkGaussianSplatter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Read cyberware file.\n    #\n    cyber = vtkPolyDataReader()\n    cyber.SetFileName(fileName)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(cyber.GetOutputPort())\n\n    mask = vtkMaskPoints()\n    mask.SetInputConnection(normals.GetOutputPort())\n    mask.SetOnRatio(8)\n    # mask.RandomModeOn()\n\n    splatter = vtkGaussianSplatter()\n    splatter.SetInputConnection(mask.GetOutputPort())\n    splatter.SetSampleDimensions(100, 100, 100)\n    splatter.SetEccentricity(2.5)\n    splatter.NormalWarpingOn()\n    splatter.SetScaleFactor(1.0)\n    splatter.SetRadius(0.025)\n\n    contour = vtkContourFilter()\n    contour.SetInputConnection(splatter.GetOutputPort())\n    contour.SetValue(0, 0.25)\n\n    splatMapper = vtkPolyDataMapper()\n    splatMapper.SetInputConnection(contour.GetOutputPort())\n    splatMapper.ScalarVisibilityOff()\n\n    splatActor = vtkActor()\n    splatActor.SetMapper(splatMapper)\n    splatActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n\n    cyberMapper = vtkPolyDataMapper()\n    cyberMapper.SetInputConnection(cyber.GetOutputPort())\n    cyberMapper.ScalarVisibilityOff()\n\n    cyberActor = vtkActor()\n    cyberActor.SetMapper(cyberMapper)\n    cyberActor.GetProperty().SetRepresentationToWireframe()\n    cyberActor.GetProperty().SetColor(colors.GetColor3d('Turquoise'))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(cyberActor)\n    ren1.AddActor(splatActor)\n    ren1.SetBackground(colors.GetColor3d('Wheat'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('SplatFace')\n\n    camera = vtkCamera()\n    camera.SetClippingRange(0.0332682, 1.66341)\n    camera.SetFocalPoint(0.0511519, -0.127555, -0.0554379)\n    camera.SetPosition(0.516567, -0.124763, -0.349538)\n    camera.SetViewAngle(18.1279)\n    camera.SetViewUp(-0.013125, 0.99985, -0.0112779)\n    ren1.SetActiveCamera(camera)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Elliptical splatting.'\n    epilogue = '''\n    b) Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction.\n       Points regularly subsampled and overlaid on original mesh.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='fran_cut.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/Stocks/","title":"Stocks","text":"

vtk-examples/Python/VisualizationAlgorithms/Stocks

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/Stocks/#code","title":"Code","text":"

Stocks.py

#!/usr/bin/env python\n\n\nimport os\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import (\n    vtkLinearExtrusionFilter,\n    vtkRibbonFilter\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkFollower,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileNames, useRibbons = get_program_parameters()\n    useTubes = not useRibbons\n\n    # Set up the stocks\n    renderers = list()\n    topRenderer = vtkRenderer()\n    bottomRenderer = vtkRenderer()\n    renderers.append(topRenderer)\n    renderers.append(bottomRenderer)\n\n    zPosition = 0.0\n    for fn in fileNames:\n        zPosition = AddStock(renderers, fn, os.path.basename((os.path.splitext(fn)[0])), zPosition, useTubes)\n\n    # Setup the render window and interactor.\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderers[0])\n    renderWindow.AddRenderer(renderers[1])\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderers[0].SetViewport(0.0, 0.4, 1.0, 1.0)\n    renderers[1].SetViewport(0.0, 0.0, 1.0, 0.4)\n\n    renderers[0].GetActiveCamera().SetViewAngle(5.0)\n    renderers[0].ResetCamera()\n    renderers[0].GetActiveCamera().Zoom(1.4)\n    renderers[0].ResetCameraClippingRange()\n    renderers[0].SetBackground(colors.GetColor3d(\"SteelBlue\"))\n\n    renderers[1].GetActiveCamera().SetViewUp(0, 0, -1)\n    renderers[1].GetActiveCamera().SetPosition(0, 1, 0)\n    renderers[1].GetActiveCamera().SetViewAngle(5.0)\n    renderers[1].ResetCamera()\n    renderers[1].GetActiveCamera().Zoom(2.2)\n    renderers[1].ResetCameraClippingRange()\n    renderers[1].SetBackground(colors.GetColor3d(\"LightSteelBlue\"))\n\n    renderWindow.SetSize(500, 800)\n    renderWindow.SetWindowName('Stocks')\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Two views from the stock visualization script.'\n    epilogue = '''\n    The top shows closing price over time; the bottom shows volume over time.  \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filenames', nargs='+',\n                        help='List of one or more filenames corresponding to stocks. e.g. GE.vtk GM.vtk IBM.vtk DEC.vtk')\n    parser.add_argument('-r', dest='useRibbons', action='store_true', help='Use ribbons instead of tubes.')\n\n    args = parser.parse_args()\n    return args.filenames, args.useRibbons\n\n\ndef AddStock(renderers, filename, name, zPosition, useTubes):\n    print(\"Adding\", name)\n\n    # Read the data\n    PolyDataRead = vtkPolyDataReader()\n    PolyDataRead.SetFileName(filename)\n    PolyDataRead.Update()\n\n    # Create the labels.\n    TextSrc = vtkVectorText()\n    TextSrc.SetText(name)\n\n    numberOfPoints = PolyDataRead.GetOutput().GetNumberOfPoints()\n\n    nameIndex = int((numberOfPoints - 1) * 0.8)\n\n    nameLocation = PolyDataRead.GetOutput().GetPoint(nameIndex)\n\n    x = nameLocation[0] * 0.15\n    y = nameLocation[1] + 5.0\n    z = zPosition\n\n    # Create a tube and ribbpn filter. One or the other will be used\n    TubeFilter = vtkTubeFilter()\n    TubeFilter.SetInputConnection(PolyDataRead.GetOutputPort())\n    TubeFilter.SetNumberOfSides(8)\n    TubeFilter.SetRadius(0.5)\n    TubeFilter.SetRadiusFactor(10000)\n\n    RibbonFilter = vtkRibbonFilter()\n    RibbonFilter.SetInputConnection(PolyDataRead.GetOutputPort())\n    RibbonFilter.VaryWidthOn()\n    RibbonFilter.SetWidthFactor(5)\n    RibbonFilter.SetDefaultNormal(0, 1, 0)\n    RibbonFilter.UseDefaultNormalOn()\n\n    Extrude = vtkLinearExtrusionFilter()\n    Extrude.SetInputConnection(RibbonFilter.GetOutputPort())\n    Extrude.SetVector(0, 1, 0)\n    Extrude.SetExtrusionType(1)\n    Extrude.SetScaleFactor(0.7)\n\n    Transform = vtkTransform()\n    Transform.Translate(0, 0, zPosition)\n    Transform.Scale(0.15, 1, 1)\n\n    TransformFilter = vtkTransformPolyDataFilter()\n    TransformFilter.SetInputConnection(Extrude.GetOutputPort())\n    TransformFilter.SetTransform(Transform)\n\n    # Select tubes or ribbons\n    if useTubes:\n        TransformFilter.SetInputConnection(TubeFilter.GetOutputPort())\n    else:\n        TransformFilter.SetInputConnection(Extrude.GetOutputPort())\n\n    for r in range(0, len(renderers)):\n        LabelMapper = vtkPolyDataMapper()\n        LabelMapper.SetInputConnection(TextSrc.GetOutputPort())\n\n        LabelActor = vtkFollower()\n        LabelActor.SetMapper(LabelMapper)\n        LabelActor.SetPosition(x, y, z)\n        LabelActor.SetScale(2, 2, 2)\n        LabelActor.SetOrigin(TextSrc.GetOutput().GetCenter())\n\n        # Increment zPosition.\n        zPosition += 8.0\n\n        StockMapper = vtkPolyDataMapper()\n        StockMapper.SetInputConnection(TransformFilter.GetOutputPort())\n        StockMapper.SetScalarRange(0, 8000)\n        StockActor = vtkActor()\n        StockActor.SetMapper(StockMapper)\n\n        renderers[r].AddActor(StockActor)\n        renderers[r].AddActor(LabelActor)\n        LabelActor.SetCamera(renderers[r].GetActiveCamera())\n    return zPosition\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/StreamlinesWithLineWidget/","title":"StreamlinesWithLineWidget","text":"

vtk-examples/Python/VisualizationAlgorithms/StreamlinesWithLineWidget

"},{"location":"Python/VisualizationAlgorithms/StreamlinesWithLineWidget/#description","title":"Description","text":""},{"location":"Python/VisualizationAlgorithms/StreamlinesWithLineWidget/#produce-streamlines-in-the-combustor-dataset","title":"Produce streamlines in the combustor dataset.","text":"

This example demonstrates how to use the vtkLineWidget to seed and manipulate streamlines. Two line widgets are created. The first is invoked by pressing 'i', the second by pressing 'L' (capital). Both can exist together.

If the fourth parameter is non-zero, it is used to generate an image with streamlines:

  1. The third parameter value is changed to 25.
  2. The camera position and first line widget are positioned differently.
  3. The streamlines are displayed running from the first line widget.
  4. The second line widget is still available.

In the C++ version, note how we handle callbacks by first implementing a class, then instantiating it and then passing references to the needed variables to it. Finally we add it as an observer.

For the Python version we define a class passing the needed variables in the __init__ function and then implementing a _call__ function that does the work.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/StreamlinesWithLineWidget/#code","title":"Code","text":"

StreamlinesWithLineWidget.py

#!/usr/bin/env python\n\n\"\"\"\nModified from VTK/Examples/GUI/Python/StreamlinesWithLineWidget.py.\nThis program encompasses the functionality of\n  StreamlinesWithLineWidget.tcl and LineWidget.tcl.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkCommonMath import vtkRungeKutta4\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersModeling import vtkRibbonFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkInteractionWidgets import vtkLineWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName1, fileName2, numOfStreamLines, illustration = get_program_parameters()\n    if illustration:\n        numOfStreamLines = 25\n\n    # Start by loading some data.\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(fileName1)\n    pl3d.SetQFileName(fileName2)\n    pl3d.SetScalarFunctionNumber(100)  # Density\n    pl3d.SetVectorFunctionNumber(202)  # Momentum\n    pl3d.Update()\n\n    pl3d_output = pl3d.GetOutput().GetBlock(0)\n\n    # Create the Renderer, RenderWindow and RenderWindowInteractor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Needed by: vtkStreamTracer and vtkLineWidget.\n    seeds = vtkPolyData()\n    streamline = vtkActor()\n    seeds2 = vtkPolyData()\n    streamline2 = vtkActor()\n\n    # The line widget is used seed the streamlines.\n    lineWidget = vtkLineWidget()\n    lineWidget.SetResolution(numOfStreamLines)\n    lineWidget.SetInputData(pl3d_output)\n    lineWidget.GetPolyData(seeds)\n    if illustration:\n        lineWidget.SetAlignToNone()\n        lineWidget.SetPoint1(0.974678, 5.073630, 31.217961)\n        lineWidget.SetPoint2(0.457544, -4.995921, 31.080175)\n    else:\n        lineWidget.SetAlignToYAxis()\n    lineWidget.ClampToBoundsOn()\n    lineWidget.PlaceWidget()\n    # Associate the line widget with the interactor and setup callbacks.\n    lineWidget.SetInteractor(iren)\n    lineWidget.AddObserver(\"StartInteractionEvent\", EnableActorCallback(streamline))\n    lineWidget.AddObserver(\"InteractionEvent\", GenerateStreamlinesCallback(seeds, renWin))\n\n    # The second line widget is used seed more streamlines.\n    lineWidget2 = vtkLineWidget()\n    lineWidget2.SetResolution(numOfStreamLines)\n    lineWidget2.SetInputData(pl3d_output)\n    lineWidget2.GetPolyData(seeds2)\n    lineWidget2.SetKeyPressActivationValue('L')\n    lineWidget2.SetAlignToZAxis()\n    lineWidget.ClampToBoundsOn()\n    lineWidget2.PlaceWidget()\n    # Associate the line widget with the interactor and setup callbacks.\n    lineWidget2.SetInteractor(iren)\n    lineWidget2.AddObserver(\"StartInteractionEvent\", EnableActorCallback(streamline2))\n    lineWidget2.AddObserver(\"InteractionEvent\", GenerateStreamlinesCallback(seeds2, renWin))\n\n    # Here we set up two streamlines.\n    rk4 = vtkRungeKutta4()\n    streamer = vtkStreamTracer()\n    streamer.SetInputData(pl3d_output)\n    streamer.SetSourceData(seeds)\n    streamer.SetMaximumPropagation(100)\n    streamer.SetInitialIntegrationStep(0.2)\n    streamer.SetIntegrationDirectionToForward()\n    streamer.SetComputeVorticity(1)\n    streamer.SetIntegrator(rk4)\n    rf = vtkRibbonFilter()\n    rf.SetInputConnection(streamer.GetOutputPort())\n    rf.SetWidth(0.1)\n    rf.SetWidthFactor(5)\n    streamMapper = vtkPolyDataMapper()\n    streamMapper.SetInputConnection(rf.GetOutputPort())\n    streamMapper.SetScalarRange(pl3d_output.GetScalarRange())\n    streamline.SetMapper(streamMapper)\n    streamline.VisibilityOff()\n\n    streamer2 = vtkStreamTracer()\n    streamer2.SetInputData(pl3d_output)\n    streamer2.SetSourceData(seeds2)\n    streamer2.SetMaximumPropagation(100)\n    streamer2.SetInitialIntegrationStep(0.2)\n    streamer2.SetIntegrationDirectionToForward()\n    streamer2.SetComputeVorticity(1)\n    streamer2.SetIntegrator(rk4)\n    rf2 = vtkRibbonFilter()\n    rf2.SetInputConnection(streamer2.GetOutputPort())\n    rf2.SetWidth(0.1)\n    rf2.SetWidthFactor(5)\n    streamMapper2 = vtkPolyDataMapper()\n    streamMapper2.SetInputConnection(rf2.GetOutputPort())\n    streamMapper2.SetScalarRange(pl3d_output.GetScalarRange())\n    streamline2.SetMapper(streamMapper2)\n    streamline2.VisibilityOff()\n\n    # Get an outline of the data set for context.\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3d_output)\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.GetProperty().SetColor(colors.GetColor3d(\"Black\"))\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(outlineActor)\n    ren.AddActor(streamline)\n    ren.AddActor(streamline2)\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('StreamlinesWithLineWidget')\n\n    cam = ren.GetActiveCamera()\n    if illustration:\n        # We need to directly display the streamlines in this case.\n        lineWidget.EnabledOn()\n        streamline.VisibilityOn()\n        lineWidget.GetPolyData(seeds)\n        renWin.Render()\n\n        cam.SetClippingRange(14.216207, 68.382915)\n        cam.SetFocalPoint(9.718210, 0.458166, 29.399900)\n        cam.SetPosition(-15.827551, -16.997463, 54.003120)\n        cam.SetViewUp(0.616076, 0.179428, 0.766979)\n        ren.SetBackground(colors.GetColor3d(\"Silver\"))\n    else:\n        cam.SetClippingRange(3.95297, 50)\n        cam.SetFocalPoint(9.71821, 0.458166, 29.3999)\n        cam.SetPosition(2.7439, -37.3196, 38.7167)\n        cam.SetViewUp(-0.16123, 0.264271, 0.950876)\n        ren.SetBackground(colors.GetColor3d(\"Silver\"))\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce streamlines in the combustor dataset.'\n    epilogue = '''\n        Produce streamlines in the combustor dataset.\n\nThis example demonstrates how to use the vtkLineWidget to seed and\nmanipulate streamlines. Two line widgets are created. The first is invoked\nby pressing 'i', the second by pressing 'L' (capital). Both can exist\ntogether.\n\nIf the fourth parameter is non-zero, it is used to generate\n an image with streamlines:\n 1) The third parameter value is changed to 25.\n 2) The camera position and first line widget are positioned differently.\n 3) The streamlines are displayed running from the first line widget.\n 4) The second line widget is still available.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    parser.add_argument('numOfStreamLines', default=25, type=int, nargs='?', help='The number of stream lines.')\n    parser.add_argument('illustration', default=0, type=int, nargs='?',\n                        help='If non-zero, reproduce Fig 7-39 of the VTK Textbook.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2, args.numOfStreamLines, args.illustration\n\n\nclass EnableActorCallback(object):\n    def __init__(self, actor):\n        self.actor = actor\n\n    def __call__(self, caller, ev):\n        self.actor.VisibilityOn()\n\n\nclass GenerateStreamlinesCallback(object):\n    def __init__(self, polyData, renWin):\n        self.polyData = polyData\n        self.renWin = renWin\n\n    def __call__(self, caller, ev):\n        caller.GetPolyData(self.polyData)\n        self.renWin.Render()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/TensorAxes/","title":"TensorAxes","text":"

vtk-examples/Python/VisualizationAlgorithms/TensorAxes

"},{"location":"Python/VisualizationAlgorithms/TensorAxes/#description","title":"Description","text":"

This example visualizes the analytical results of Boussinesq's problem from Saada. The figure shows the results by displaying the scaled and oriented principal axes of the stress tensor. (These are called tensor axes.)

Info

See Figure 6-22a in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/TensorAxes/#code","title":"Code","text":"

TensorAxes.py

#!/usr/bin/env python\n\n# Translated from TenAxes.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkTensorGlyph,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkAxes\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkImagingHybrid import vtkPointLoad\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and interactive renderer.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Generate the tensors.\n    ptLoad = vtkPointLoad()\n    ptLoad.SetLoadValue(100.0)\n    ptLoad.SetSampleDimensions(6, 6, 6)\n    ptLoad.ComputeEffectiveStressOn()\n    ptLoad.SetModelBounds(-10, 10, -10, 10, -10, 10)\n\n    # Extract a plane of data.\n    plane = vtkImageDataGeometryFilter()\n    plane.SetInputConnection(ptLoad.GetOutputPort())\n    plane.SetExtent(2, 2, 0, 99, 0, 99)\n\n    # Generate the tensor axes.\n    axes = vtkAxes()\n    axes.SetScaleFactor(0.5)\n\n    tubeAxes = vtkTubeFilter()\n    tubeAxes.SetInputConnection(axes.GetOutputPort())\n    tubeAxes.SetRadius(0.1)\n    tubeAxes.SetNumberOfSides(6)\n\n    tensorAxes = vtkTensorGlyph()\n    tensorAxes.SetInputConnection(ptLoad.GetOutputPort())\n    tensorAxes.SetSourceConnection(axes.GetOutputPort())\n    tensorAxes.SetScaleFactor(10)\n    tensorAxes.ClampScalingOn()\n\n    # Map contour\n    lut = vtkLookupTable()\n    MakeLogLUT(lut)\n    # lut.SetHueRange(.6667, 0.0)\n    tensorAxesMapper = vtkPolyDataMapper()\n    tensorAxesMapper.SetInputConnection(tensorAxes.GetOutputPort())\n    tensorAxesMapper.SetLookupTable(lut)\n    plane.Update()  # force update for scalar range\n    # This is deprecated from vtk 8.1 onwards.\n    # tensorAxesMapper.ImmediateModeRenderingOn()\n    tensorAxesMapper.SetScalarRange(plane.GetOutput().GetScalarRange())\n\n    tensorActor = vtkActor()\n    tensorActor.SetMapper(tensorAxesMapper)\n\n    # Create an outline around the data.\n    #\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(ptLoad.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    #\n    # Create a cone whose apex indicates the application of load.\n    #\n    coneSrc = vtkConeSource()\n    coneSrc.SetRadius(.5)\n    coneSrc.SetHeight(2)\n    coneMap = vtkPolyDataMapper()\n    coneMap.SetInputConnection(coneSrc.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMap)\n    coneActor.SetPosition(0, 0, 11)\n    coneActor.RotateY(90)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('BurlyWood'))\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(0.113766, -1.13665, -1.01919)\n    camera.SetPosition(-29.4886, -63.1488, 26.5807)\n    camera.SetViewAngle(24.4617)\n    camera.SetViewUp(0.17138, 0.331163, 0.927879)\n    camera.SetClippingRange(1, 100)\n\n    ren.AddActor(tensorActor)\n    ren.AddActor(outlineActor)\n    ren.AddActor(coneActor)\n    ren.SetBackground(colors.GetColor3d('WhiteSmoke'))\n    ren.SetActiveCamera(camera)\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('TensorAxes')\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef MakeLogLUT(lut):\n    # Original\n    lut.SetScaleToLog10()\n    lut.SetHueRange(.6667, 0.0)\n    lut.Build()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/TensorEllipsoids/","title":"TensorEllipsoids","text":"

vtk-examples/Python/VisualizationAlgorithms/TensorEllipsoids

"},{"location":"Python/VisualizationAlgorithms/TensorEllipsoids/#description","title":"Description","text":"

This example visualizes the analytical results of Boussinesq's problem from Saada. The figure shows the results by displaying the scaled and oriented principal axes as tensor ellipsoids representing the stress tensor. (These are called tensor axes.)

Info

See Figure 6-22b in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/TensorEllipsoids/#code","title":"Code","text":"

TensorEllipsoids.py

#!/usr/bin/env python\n\n# Translated from TenEllip.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataNormals,\n    vtkTensorGlyph\n)\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkImagingHybrid import vtkPointLoad\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and interactive renderer.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Generate the tensors.\n    ptLoad = vtkPointLoad()\n    ptLoad.SetLoadValue(100.0)\n    ptLoad.SetSampleDimensions(6, 6, 6)\n    ptLoad.ComputeEffectiveStressOn()\n    ptLoad.SetModelBounds(-10, 10, -10, 10, -10, 10)\n\n    # Extract a plane of data.\n    plane = vtkImageDataGeometryFilter()\n    plane.SetInputConnection(ptLoad.GetOutputPort())\n    plane.SetExtent(2, 2, 0, 99, 0, 99)\n\n    # Generate the ellipsoids.\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(8)\n    sphere.SetPhiResolution(8)\n    tensorEllipsoids = vtkTensorGlyph()\n    tensorEllipsoids.SetInputConnection(ptLoad.GetOutputPort())\n    tensorEllipsoids.SetSourceConnection(sphere.GetOutputPort())\n    tensorEllipsoids.SetScaleFactor(10)\n    tensorEllipsoids.ClampScalingOn()\n\n    ellipNormals = vtkPolyDataNormals()\n    ellipNormals.SetInputConnection(tensorEllipsoids.GetOutputPort())\n\n    # Map contour\n    lut = vtkLookupTable()\n    MakeLogLUT(lut)\n    # lut.SetHueRange(.6667, 0.0)\n    tensorEllipsoidsMapper = vtkPolyDataMapper()\n    tensorEllipsoidsMapper.SetInputConnection(ellipNormals.GetOutputPort())\n    tensorEllipsoidsMapper.SetLookupTable(lut)\n    plane.Update()  # force update for scalar range\n    tensorEllipsoidsMapper.SetScalarRange(plane.GetOutput().GetScalarRange())\n\n    tensorActor = vtkActor()\n    tensorActor.SetMapper(tensorEllipsoidsMapper)\n\n    # Create an outline around the data.\n    #\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(ptLoad.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create a cone whose apex indicates the application of load.\n    #\n    coneSrc = vtkConeSource()\n    coneSrc.SetRadius(.5)\n    coneSrc.SetHeight(2)\n    coneMap = vtkPolyDataMapper()\n    coneMap.SetInputConnection(coneSrc.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMap)\n    coneActor.SetPosition(0, 0, 11)\n    coneActor.RotateY(90)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(0.113766, -1.13665, -1.01919)\n    camera.SetPosition(-29.4886, -63.1488, 26.5807)\n    camera.SetViewAngle(24.4617)\n    camera.SetViewUp(0.17138, 0.331163, 0.927879)\n    camera.SetClippingRange(1, 100)\n\n    ren.AddActor(tensorActor)\n    ren.AddActor(outlineActor)\n    ren.AddActor(coneActor)\n    ren.SetBackground(colors.GetColor3d('WhiteSmoke'))\n    ren.SetActiveCamera(camera)\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('TensorEllipsoids')\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef MakeLogLUT(lut):\n    # Make the lookup using a Brewer palette.\n    colorSeries = vtkColorSeries()\n    colorSeries.SetNumberOfColors(8)\n    colorSeriesEnum = colorSeries.BREWER_DIVERGING_SPECTRAL_8\n    colorSeries.SetColorScheme(colorSeriesEnum)\n    lut.SetScaleToLog10()\n    colorSeries.BuildLookupTable(lut, colorSeries.ORDINAL)\n    lut.SetNanColor(1, 0, 0, 1)\n    # Original\n    # lut.SetScaleToLog10()\n    # lut.SetHueRange(.6667, 0.0)\n    # lut.Build()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/VelocityProfile/","title":"VelocityProfile","text":"

vtk-examples/Python/VisualizationAlgorithms/VelocityProfile

"},{"location":"Python/VisualizationAlgorithms/VelocityProfile/#description","title":"Description","text":"

This example shows shows warped planes in a structured grid dataset. The planes are warped according to flow momentum. The relative back and forward flow are clearly visible in the deformation of the planes.

Info

See Figure 6-14b in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/VelocityProfile/#code","title":"Code","text":"

VelocityProfile.py

#!/usr/bin/env python\n\n# Translated from velProf.tcl.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkPolyDataNormals,\n    vtkStructuredGridOutlineFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpVector\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName1, fileName2 = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [65, 99, 149, 255])\n\n    # Read a vtk file\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(fileName1)\n    pl3d.SetQFileName(fileName2)\n    pl3d.SetScalarFunctionNumber(100)  # Density\n    pl3d.SetVectorFunctionNumber(202)  # Momentum\n    pl3d.Update()\n\n    pl3dOutput = pl3d.GetOutput().GetBlock(0)\n\n    # What do we know about the data?\n    # Get the extent of the data: imin,imax, jmin,jmax, kmin,kmax\n    extent = pl3dOutput.GetExtent()\n    scalarRange = pl3dOutput.GetScalarRange()\n\n    # Planes are specified using a imin,imax, jmin,jmax, kmin,kmax coordinate\n    # specification. Min and max i,j,k values are clamped to 0 and maximum value.\n    # See the variable named extent for the values.\n    #\n    plane = vtkStructuredGridGeometryFilter()\n    plane.SetInputData(pl3dOutput)\n    plane.SetExtent(10, 10, 1, extent[3], 1, extent[5])\n\n    plane2 = vtkStructuredGridGeometryFilter()\n    plane2.SetInputData(pl3dOutput)\n    plane2.SetExtent(30, 30, 1, extent[3], 1, extent[5])\n\n    plane3 = vtkStructuredGridGeometryFilter()\n    plane3.SetInputData(pl3dOutput)\n    plane3.SetExtent(45, 45, 1, extent[3], 1, extent[5])\n\n    # We use an append filter because that way we can do the warping, etc. just\n    # using a single pipeline and actor.\n    #\n    appendF = vtkAppendPolyData()\n    appendF.AddInputConnection(plane.GetOutputPort())\n    appendF.AddInputConnection(plane2.GetOutputPort())\n    appendF.AddInputConnection(plane3.GetOutputPort())\n\n    # Warp\n    warp = vtkWarpVector()\n    warp.SetInputConnection(appendF.GetOutputPort())\n    warp.SetScaleFactor(0.005)\n    warp.Update()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputData(warp.GetPolyDataOutput())\n    normals.SetFeatureAngle(45)\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputConnection(normals.GetOutputPort())\n    planeMapper.SetScalarRange(scalarRange)\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n\n    # The outline provides context for the data and the planes.\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3dOutput)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren.AddActor(planeActor)\n    ren.AddActor(outlineActor)\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('VelocityProfile')\n\n    iren.Initialize()\n\n    renWin.Render()\n\n    ren.GetActiveCamera().SetPosition(19.8562, -31.8912, 47.0755)\n    ren.GetActiveCamera().SetFocalPoint(8.255, 0.147815, 29.7631)\n    ren.GetActiveCamera().SetViewUp(-0.0333325, 0.465756, 0.884285)\n    ren.GetActiveCamera().SetClippingRange(17.3078, 64.6375)\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce figure 6\u201314(b) Flow momentum from the VTK Textbook.'\n    epilogue = '''\n        Produce figure 6\u201314(b) Flow momentum from the VTK Textbook.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VisualizationAlgorithms/WarpCombustor/","title":"WarpCombustor","text":"

vtk-examples/Python/VisualizationAlgorithms/WarpCombustor

"},{"location":"Python/VisualizationAlgorithms/WarpCombustor/#description","title":"Description","text":"

This example demonstrates how to extract \"computational planes\" from a structured dataset. Structured data has a natural, logical coordinate system based on i-j-k indices. Specifying imin,imax, jmin,jmax, kmin,kmax pairs can indicate a point, line, plane, or volume of data.

In this example, we extract three planes and warp them using scalar values in the direction of the local normal at each point. This gives a sort of \"velocity profile\" that indicates the nature of the flow.

Info

See Figure 9-4b in Chapter 9 The VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VisualizationAlgorithms/WarpCombustor/#code","title":"Code","text":"

WarpCombustor.py

#!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkPolyDataNormals,\n    vtkStructuredGridOutlineFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpScalar\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName1, fileName2 = get_program_parameters()\n\n    # Here we read data from a annular combustor. A combustor burns fuel and air\n    # in a gas turbine (e.g., a jet engine) and the hot gas eventually makes its\n    # way to the turbine section.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(fileName1)\n    pl3d.SetQFileName(fileName2)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    pl3dOutput = pl3d.GetOutput().GetBlock(0)\n\n    # Planes are specified using a imin,imax, jmin,jmax, kmin,kmax coordinate\n    # specification. Min and max i,j,k values are clamped to 0 and maximum value.\n    #\n    plane = vtkStructuredGridGeometryFilter()\n    plane.SetInputData(pl3dOutput)\n    plane.SetExtent(10, 10, 1, 100, 1, 100)\n\n    plane2 = vtkStructuredGridGeometryFilter()\n    plane2.SetInputData(pl3dOutput)\n    plane2.SetExtent(30, 30, 1, 100, 1, 100)\n    plane3 = vtkStructuredGridGeometryFilter()\n    plane3.SetInputData(pl3dOutput)\n    plane3.SetExtent(45, 45, 1, 100, 1, 100)\n\n    # We use an append filter because that way we can do the warping, etc. just\n    # using a single pipeline and actor.\n    #\n    appendF = vtkAppendPolyData()\n    appendF.AddInputConnection(plane.GetOutputPort())\n    appendF.AddInputConnection(plane2.GetOutputPort())\n    appendF.AddInputConnection(plane3.GetOutputPort())\n\n    warp = vtkWarpScalar()\n    warp.SetInputConnection(appendF.GetOutputPort())\n    warp.UseNormalOn()\n    warp.SetNormal(1.0, 0.0, 0.0)\n    warp.SetScaleFactor(2.5)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(warp.GetOutputPort())\n    normals.SetFeatureAngle(60)\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputConnection(normals.GetOutputPort())\n    planeMapper.SetScalarRange(pl3dOutput.GetScalarRange())\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n\n    # The outline provides context for the data and the planes.\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3dOutput)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create the usual graphics stuff.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(planeActor)\n    ren1.SetBackground(colors.GetColor3d('Silver'))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('WarpCombustor')\n\n    # Create an initial view.\n    ren1.GetActiveCamera().SetClippingRange(3.95297, 50)\n    ren1.GetActiveCamera().SetFocalPoint(8.88908, 0.595038, 29.3342)\n    ren1.GetActiveCamera().SetPosition(-12.3332, 31.7479, 41.2387)\n    ren1.GetActiveCamera().SetViewUp(0.060772, -0.319905, 0.945498)\n    iren.Initialize()\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Extract \"computational planes\" from a structured dataset. '\n    epilogue = '''\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VolumeRendering/PseudoVolumeRendering/","title":"PseudoVolumeRendering","text":"

vtk-examples/Python/VolumeRendering/PseudoVolumeRendering

"},{"location":"Python/VolumeRendering/PseudoVolumeRendering/#description","title":"Description","text":"

This example uses 100 cut planes with opacity of 0.05. Rendered back-to-front to simulate volume rendering.

Info

See Figure 6-32 in Chapter 6 the VTK Textbook.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VolumeRendering/PseudoVolumeRendering/#code","title":"Code","text":"

PseudoVolumeRendering.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkCutter,\n    vtkPolyDataNormals,\n    vtkStripper,\n    vtkStructuredGridOutlineFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractGrid\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFile, qFile = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create pipeline. Read structured grid data.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(xyzFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    pl3dOutput = pl3d.GetOutput().GetBlock(0)\n\n    # A convenience, use this filter to limit data for experimentation.\n    extract = vtkExtractGrid()\n    extract.SetVOI(1, 55, -1000, 1000, -1000, 1000)\n    extract.SetInputData(pl3dOutput)\n\n    # The (implicit) plane is used to do the cutting\n    plane = vtkPlane()\n    plane.SetOrigin(0, 4, 2)\n    plane.SetNormal(0, 1, 0)\n\n    # The cutter is set up to process each contour value over all cells\n    # (SetSortByToSortByCell). This results in an ordered output of polygons\n    # which is key to the compositing.\n    cutter = vtkCutter()\n    cutter.SetInputConnection(extract.GetOutputPort())\n    cutter.SetCutFunction(plane)\n    cutter.GenerateCutScalarsOff()\n    cutter.SetSortByToSortByCell()\n\n    clut = vtkLookupTable()\n    clut.SetHueRange(0, 0.67)\n    clut.Build()\n\n    cutterMapper = vtkPolyDataMapper()\n    cutterMapper.SetInputConnection(cutter.GetOutputPort())\n    cutterMapper.SetScalarRange(0.18, 0.7)\n    cutterMapper.SetLookupTable(clut)\n\n    cut = vtkActor()\n    cut.SetMapper(cutterMapper)\n\n    # Add in some surface geometry for interest.\n    iso = vtkContourFilter()\n    iso.SetInputData(pl3dOutput)\n    iso.SetValue(0, .22)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(iso.GetOutputPort())\n    normals.SetFeatureAngle(60)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(normals.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetDiffuseColor(colors.GetColor3d('Tomato'))\n    isoActor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    isoActor.GetProperty().SetDiffuse(0.8)\n    isoActor.GetProperty().SetSpecular(0.5)\n    isoActor.GetProperty().SetSpecularPower(30)\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3dOutput)\n\n    outlineStrip = vtkStripper()\n    outlineStrip.SetInputConnection(outline.GetOutputPort())\n\n    outlineTubes = vtkTubeFilter()\n    outlineTubes.SetInputConnection(outline.GetOutputPort())\n    outlineTubes.SetInputConnection(outlineStrip.GetOutputPort())\n    outlineTubes.SetRadius(0.1)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outlineTubes.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    ren1.AddActor(isoActor)\n    isoActor.VisibilityOn()\n    ren1.AddActor(cut)\n\n    n = 20\n    opacity = 1.0 / float(n) * 5.0\n    cut.GetProperty().SetOpacity(1)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('PseudoVolumeRendering')\n\n    ren1.GetActiveCamera().SetClippingRange(3.95297, 50)\n    ren1.GetActiveCamera().SetFocalPoint(9.71821, 0.458166, 29.3999)\n    ren1.GetActiveCamera().SetPosition(2.7439, -37.3196, 38.7167)\n    ren1.GetActiveCamera().ComputeViewPlaneNormal()\n    ren1.GetActiveCamera().SetViewUp(-0.16123, 0.264271, 0.950876)\n\n    # Cut: generates n cut planes normal to camera's view plane.\n    #\n    plane.SetNormal(ren1.GetActiveCamera().GetViewPlaneNormal())\n    plane.SetOrigin(ren1.GetActiveCamera().GetFocalPoint())\n    cutter.GenerateValues(n, -5, 5)\n    clut.SetAlphaRange(opacity, opacity)\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Perform psuedo volume rendering in a structured grid by compositing translucent cut planes.'\n    epilogue = '''\n    This same trick can be used for unstructured grids.\n    Note that for better results, more planes can be created.\n    Also, if your data is vtkImageData, there are much faster\n     methods for volume rendering.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/VolumeRendering/SimpleRayCast/","title":"SimpleRayCast","text":"

vtk-examples/Python/VolumeRendering/SimpleRayCast

"},{"location":"Python/VolumeRendering/SimpleRayCast/#description","title":"Description","text":"

Volume rendering of a high potential iron protein.

Info

See Figure 7-34 in Chapter 7 the VTK Textbook.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/VolumeRendering/SimpleRayCast/#code","title":"Code","text":"

SimpleRayCast.py

#!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPiecewiseFunction\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkColorTransferFunction,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkVolume,\n    vtkVolumeProperty\n)\nfrom vtkmodules.vtkRenderingVolume import vtkFixedPointVolumeRayCastMapper\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkRenderingVolumeOpenGL2 import vtkOpenGLRayCastImageDisplayHelper\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # This is a simple volume rendering example that\n    # uses a vtkFixedPointVolumeRayCastMapper\n\n    # Create the standard renderer, render window\n    # and interactor.\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the reader for the data.\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(fileName)\n\n    # Create transfer mapping scalar value to opacity.\n    opacityTransferFunction = vtkPiecewiseFunction()\n    opacityTransferFunction.AddPoint(20, 0.0)\n    opacityTransferFunction.AddPoint(255, 0.2)\n\n    # Create transfer mapping scalar value to color.\n    colorTransferFunction = vtkColorTransferFunction()\n    colorTransferFunction.AddRGBPoint(0.0, 0.0, 0.0, 0.0)\n    colorTransferFunction.AddRGBPoint(64.0, 1.0, 0.0, 0.0)\n    colorTransferFunction.AddRGBPoint(128.0, 0.0, 0.0, 1.0)\n    colorTransferFunction.AddRGBPoint(192.0, 0.0, 1.0, 0.0)\n    colorTransferFunction.AddRGBPoint(255.0, 0.0, 0.2, 0.0)\n\n    # The property describes how the data will look.\n    volumeProperty = vtkVolumeProperty()\n    volumeProperty.SetColor(colorTransferFunction)\n    volumeProperty.SetScalarOpacity(opacityTransferFunction)\n    volumeProperty.ShadeOn()\n    volumeProperty.SetInterpolationTypeToLinear()\n\n    # The mapper / ray cast function know how to render the data.\n    volumeMapper = vtkFixedPointVolumeRayCastMapper()\n    volumeMapper.SetInputConnection(reader.GetOutputPort())\n\n    # The volume holds the mapper and the property and\n    # can be used to position/orient the volume.\n    volume = vtkVolume()\n    volume.SetMapper(volumeMapper)\n    volume.SetProperty(volumeProperty)\n\n    ren1.AddVolume(volume)\n    ren1.SetBackground(colors.GetColor3d('Wheat'))\n    ren1.GetActiveCamera().Azimuth(45)\n    ren1.GetActiveCamera().Elevation(30)\n    ren1.ResetCameraClippingRange()\n    ren1.ResetCamera()\n\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName('SimpleRayCast')\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Volume rendering of a high potential iron protein.'\n    epilogue = '''\n    This is a simple volume rendering example that uses a vtkFixedPointVolumeRayCastMapper.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='ironProt.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Widgets/BalloonWidget/","title":"BalloonWidget","text":"

vtk-examples/Python/Widgets/BalloonWidget

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/BalloonWidget/#code","title":"Code","text":"

BalloonWidget.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkRegularPolygonSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkBalloonRepresentation,\n    vtkBalloonWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Sphere.\n    sphere_source = vtkSphereSource()\n    sphere_source.SetCenter(-4.0, 0.0, 0.0)\n    sphere_source.SetRadius(4.0)\n\n    sphere_mapper = vtkPolyDataMapper()\n    sphere_mapper.SetInputConnection(sphere_source.GetOutputPort())\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphere_mapper)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # Regular Polygon.\n    regular_polygon_source = vtkRegularPolygonSource()\n    regular_polygon_source.SetCenter(4.0, 0.0, 0.0)\n    regular_polygon_source.SetRadius(4.0)\n\n    regular_polygon_mapper = vtkPolyDataMapper()\n    regular_polygon_mapper.SetInputConnection(regular_polygon_source.GetOutputPort())\n\n    regularPolygonActor = vtkActor()\n    regularPolygonActor.SetMapper(regular_polygon_mapper)\n    regularPolygonActor.GetProperty().SetColor(colors.GetColor3d('Cornsilk'))\n\n    # A renderer and render window.\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetWindowName('BalloonWidget')\n\n    # An interactor.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Create the widget.\n    balloonRep = vtkBalloonRepresentation()\n    balloonRep.SetBalloonLayoutToImageRight()\n\n    balloonWidget = vtkBalloonWidget()\n    balloonWidget.SetInteractor(iren)\n    balloonWidget.SetRepresentation(balloonRep)\n    balloonWidget.AddBalloon(sphereActor, 'This is a sphere')\n    balloonWidget.AddBalloon(regularPolygonActor, 'This is a regular polygon')\n\n    # Add the actors to the scene.\n    ren.AddActor(sphereActor)\n    ren.AddActor(regularPolygonActor)\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Render an image (lights and cameras are created automatically).\n    ren_win.Render()\n    balloonWidget.EnabledOn()\n\n    # Begin mouse interaction.\n    iren.Start()\n    iren.Initialize()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Widgets/BoxWidget/","title":"BoxWidget","text":"

vtk-examples/Python/Widgets/BoxWidget

"},{"location":"Python/Widgets/BoxWidget/#description","title":"Description","text":"

This example uses a vtkBoxWidget to manipulate an actor. The class includes geometry to draw a box around the object, which is bound to it via SetProp3D. The box is dimensioned using the SetPlaceFactor method, and positioned with the PlaceWidget method. After the initial setup, synchronizing the box with the object is done through a custom callback class, which is passed to the box widget through the AddObserver method.

For a widget that isn't tied to a specific vtkProp3D and has its geometric representation separate from the interaction logic, see the example BoxWidget2 - to be written.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/BoxWidget/#code","title":"Code","text":"

BoxWidget.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkInteractionWidgets import vtkBoxWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\n# Call back function to resize the cone\n\n\ndef boxCallback(obj, event):\n    t = vtkTransform()\n    obj.GetTransform(t)\n    obj.GetProp3D().SetUserTransform(t)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a Cone\n    cone = vtkConeSource()\n    cone.SetResolution(20)\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('BurlyWood'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Blue'))\n    renderer.AddActor(coneActor)\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('BoxWidget')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # A Box widget\n    boxWidget = vtkBoxWidget()\n    boxWidget.SetInteractor(interactor)\n    boxWidget.SetProp3D(coneActor)\n    boxWidget.SetPlaceFactor(1.25)  # Make the box 1.25x larger than the actor\n    boxWidget.PlaceWidget()\n    boxWidget.On()\n\n    # Connect the event to a function\n    boxWidget.AddObserver('InteractionEvent', boxCallback)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Widgets/CameraOrientationWidget/","title":"CameraOrientationWidget","text":"

vtk-examples/Python/Widgets/CameraOrientationWidget

"},{"location":"Python/Widgets/CameraOrientationWidget/#description","title":"Description","text":"

This example demonstrates a 3D camera orientation gizmo.

The widget representation has shafts and little spheres with text on them. The spheres always follow the camera.

The widget representation's orientation is synchronized with the camera of the parent renderer.

To look down on any particular axis, simply click on a handle.

To rotate the camera and get a feel of the camera orientation, either move mouse in the renderer or click on a handle and move it around.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/CameraOrientationWidget/#code","title":"Code","text":"

CameraOrientationWidget.py

#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# This example demonstrates how to use the vtkCameraOrientationWidget to control\n# a renderer's camera orientation.\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrates a 3D camera orientation widget.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('path', help='The path to the file to render e.g. cow.vtp.')\n    args = parser.parse_args()\n    return args.path\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    path = get_program_parameters()\n    if not Path(path).is_file():\n        print('Unable to find the file:', path)\n        return\n\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    interactor = vtkRenderWindowInteractor()\n\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(path)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n    actor.SetMapper(mapper)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DimGray'))\n\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(600, 600)\n    ren_win.SetWindowName('CameraOrientationWidget')\n\n    # Important: The interactor must be set prior to enabling the widget.\n    interactor.SetRenderWindow(ren_win)\n\n    cam_orient_manipulator = vtkCameraOrientationWidget()\n    cam_orient_manipulator.SetParentRenderer(renderer)\n    # Enable the widget.\n    cam_orient_manipulator.On()\n\n    ren_win.Render()\n    interactor.Initialize()\n    interactor.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
"},{"location":"Python/Widgets/CompassWidget/","title":"CompassWidget","text":"

vtk-examples/Python/Widgets/CompassWidget

"},{"location":"Python/Widgets/CompassWidget/#description","title":"Description","text":"

This example creates a compass widget in the top right corner of the window. The widget can be used to modify the camera position via its distance and tilt sliders and its heading compass wheel.

Note for this example to work correctly VTK with version >= 9.2.20220831 is required.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/CompassWidget/#code","title":"Code","text":"

CompassWidget.py

#!/usr/bin/env python3\n\nimport math\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkCommand,\n    vtkMath,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkRenderingAnnotation import vtkAnnotatedCubeActor\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\ntry:\n    from vtkmodules.vtkInteractionWidgets import (\n        vtkCompassRepresentation,\n        vtkCompassWidget\n    )\nexcept:\n    from vtkmodules.vtkGeovisCore import (\n        vtkCompassRepresentation,\n        vtkCompassWidget\n    )\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) \\\n                     + 100000000 * int(minor) \\\n                     + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:\n        # Expand component-wise comparisons for VTK versions < 8.90.\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() \\\n                             + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\ndef CompassWidgetValueChangedCallback(widget, event):\n    \"\"\"\n    Callback to set the camera position according to the position parameters given by the vtkCompassWidget.\n    \"\"\"\n    try:\n        camera = widget.GetCurrentRenderer().GetActiveCamera()\n    except AttributeError:\n        return\n\n    # calculate new camera position from compass widget parameters\n    distance = widget.GetDistance()\n    tilt = widget.GetTilt()\n    heading = widget.GetHeading()\n\n    x = distance * math.cos(vtkMath.RadiansFromDegrees(heading)) * math.cos(vtkMath.RadiansFromDegrees(tilt))\n    y = distance * math.sin(vtkMath.RadiansFromDegrees(heading)) * math.cos(vtkMath.RadiansFromDegrees(tilt))\n    z = distance * math.sin(vtkMath.RadiansFromDegrees(tilt))\n\n    camera.SetPosition(x, y, z)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetViewUp(0, 0, 1)\n    camera.SetClippingRange(0.1, distance + 1)\n\n    widget.GetCurrentRenderer().Render()\n\n\n\ndef main():\n    use_improved_compass_widget = vtk_version_ok(9, 2, 20220831)\n\n    colors = vtkNamedColors()\n\n    actor = vtkAnnotatedCubeActor()\n    actor.GetCubeProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # a renderer and render window\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n\n    # an interactor\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # create the widget and its representation\n    compassRepresentation = vtkCompassRepresentation()\n\n    compassWidget = vtkCompassWidget()\n    compassWidget.SetInteractor(renderWindowInteractor)\n    compassWidget.SetRepresentation(compassRepresentation)\n\n    # add a callback to update the camera position on vtkCommand::WidgetValueChangedEvent\n    compassWidget.AddObserver(vtkCommand.WidgetValueChangedEvent, CompassWidgetValueChangedCallback)\n\n    if use_improved_compass_widget:\n        compassRepresentation.SetMinimumDistance(2)\n        compassRepresentation.SetMaximumDistance(10)\n        compassWidget.SetDistance(5)\n        compassWidget.SetTiltSpeed(45)\n        compassWidget.SetDistanceSpeed(2)\n\n    # add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('CompassWidget')\n\n    renderWindow.Render()\n    compassWidget.EnabledOn()\n\n    if use_improved_compass_widget:\n        # no interactor style - camera is moved by widget callback\n        renderWindowInteractor.SetInteractorStyle(None)\n        # set camera to initial position\n        compassWidget.InvokeEvent(vtkCommand.WidgetValueChangedEvent)\n\n    # begin interaction\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Widgets/ContourWidget/","title":"ContourWidget","text":"

vtk-examples/Python/Widgets/ContourWidget

"},{"location":"Python/Widgets/ContourWidget/#description","title":"Description","text":"

This example generates a set of points which lie on a circle, and the contour through these points. This contour can be interactively warped/modified by dragging the control points.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/ContourWidget/#code","title":"Code","text":"

ContourWidget.py

#!/usr/bin/python3\n\nimport math\nimport sys\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkContourWidget,\n    vtkOrientedGlyphContourRepresentation,\n    vtkWidgetEvent\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])\n\n    # Create the RenderWindow, Renderer and both Actors\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('ContourWidget')\n    renderWindow.SetSize(600, 600)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    contourRep = vtkOrientedGlyphContourRepresentation()\n    contourRep.GetLinesProperty().SetColor(colors.GetColor3d('Red'))\n\n    contourWidget = vtkContourWidget()\n    contourWidget.SetInteractor(interactor)\n    contourWidget.SetRepresentation(contourRep)\n    contourWidget.On()\n\n    for arg in sys.argv:\n        if '-Shift' == arg:\n            contourWidget.GetEventTranslator().RemoveTranslation(\n                vtkCommand.LeftButtonPressEvent)\n            contourWidget.GetEventTranslator().SetTranslation(\n                vtkCommand.LeftButtonPressEvent,\n                vtkWidgetEvent.Translate)\n        elif '-Scale' == arg:\n            contourWidget.GetEventTranslator().RemoveTranslation(\n                vtkCommand.LeftButtonPressEvent)\n            contourWidget.GetEventTranslator().SetTranslation(\n                vtkCommand.LeftButtonPressEvent,\n                vtkWidgetEvent.Scale)\n\n    pd = vtkPolyData()\n\n    points = vtkPoints()\n\n    num_pts = 21\n    for i in range(0, num_pts):\n        angle = 2.0 * math.pi * i / 20.0\n        points.InsertPoint(i, 0.1 * math.cos(angle),\n                           0.1 * math.sin(angle), 0.0)\n        # lines.InsertNextCell(i)\n    vertex_indices = list(range(0, num_pts))\n    vertex_indices.append(0)\n    lines = vtkCellArray()\n    lines.InsertNextCell(num_pts + 1, vertex_indices)\n\n    pd.SetPoints(points)\n    pd.SetLines(lines)\n\n    # contourWidget.Initialize(pd, 1)\n    contourWidget.Initialize(pd, 1)\n    contourWidget.Render()\n    renderer.ResetCamera()\n    renderWindow.Render()\n\n    interactor.Initialize()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Widgets/EmbedInPyQt/","title":"EmbedInPyQt","text":"

vtk-examples/Python/Widgets/EmbedInPyQt

"},{"location":"Python/Widgets/EmbedInPyQt/#description","title":"Description","text":"

'''Minimal working example of vtk embedding in PyQt.'''

Contributed by Michka Popoff, inspired by the example from Eric E Monson See notes at the end for more details.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/EmbedInPyQt/#code","title":"Code","text":"

EmbedInPyQt.py

#!/usr/bin/env python3\n\nimport sys\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom PyQt4 import QtGui\nfrom qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderer\n)\n\n\nclass MainWindow(QtGui.QMainWindow):\n\n    def __init__(self, parent=None):\n        QtGui.QMainWindow.__init__(self, parent)\n\n        self.frame = QtGui.QFrame()\n\n        self.vl = QtGui.QVBoxLayout()\n        self.vtkWidget = QVTKRenderWindowInteractor(self.frame)\n        self.vl.addWidget(self.vtkWidget)\n\n        self.ren = vtkRenderer()\n        self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)\n        self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()\n\n        # Create source\n        source = vtkSphereSource()\n        source.SetCenter(0, 0, 0)\n        source.SetRadius(5.0)\n\n        # Create a mapper\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(source.GetOutputPort())\n\n        # Create an actor\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        self.ren.AddActor(actor)\n\n        self.ren.ResetCamera()\n\n        self.frame.setLayout(self.vl)\n        self.setCentralWidget(self.frame)\n\n        self.show()\n        self.iren.Initialize()\n\n\nif __name__ == \"__main__\":\n    app = QtGui.QApplication(sys.argv)\n\n    window = MainWindow()\n\n    sys.exit(app.exec_())\n
"},{"location":"Python/Widgets/EmbedInPyQt2/","title":"EmbedInPyQt2","text":"

vtk-examples/Python/Widgets/EmbedInPyQt2

"},{"location":"Python/Widgets/EmbedInPyQt2/#description","title":"Description","text":"

Another example on how to embed VTK in PyQT, with a QVTKRenderWindowInteractor

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/EmbedInPyQt2/#code","title":"Code","text":"

EmbedInPyQt2.py

#!/usr/bin/env python3\n# Contributed by Eric E Monson\n\nimport sys\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom PyQt4 import QtGui\nfrom PyQt4.QtGui import QApplication\nfrom qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderer\n)\n\n\nclass Ui_MainWindow(object):\n    def setupUi(self, MainWindow):\n        MainWindow.setObjectName(\"MainWindow\")\n        MainWindow.resize(603, 553)\n        self.centralWidget = QtGui.QWidget(MainWindow)\n        self.gridlayout = QtGui.QGridLayout(self.centralWidget)\n        self.vtkWidget = QVTKRenderWindowInteractor(self.centralWidget)\n        self.gridlayout.addWidget(self.vtkWidget, 0, 0, 1, 1)\n        MainWindow.setCentralWidget(self.centralWidget)\n\n\nclass SimpleView(QtGui.QMainWindow):\n\n    def __init__(self, parent=None):\n        QtGui.QMainWindow.__init__(self, parent)\n        self.ui = Ui_MainWindow()\n        self.ui.setupUi(self)\n        self.ren = vtkRenderer()\n        self.ui.vtkWidget.GetRenderWindow().AddRenderer(self.ren)\n        self.iren = self.ui.vtkWidget.GetRenderWindow().GetInteractor()\n\n        # Create source\n        source = vtkSphereSource()\n        source.SetCenter(0, 0, 0)\n        source.SetRadius(5.0)\n\n        # Create a mapper\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(source.GetOutputPort())\n\n        # Create an actor\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        self.ren.AddActor(actor)\n\n\nif __name__ == \"__main__\":\n    app = QApplication(sys.argv)\n    window = SimpleView()\n    window.show()\n    window.iren.Initialize()  # Need this line to actually show the render inside Qt\n    sys.exit(app.exec_())\n
"},{"location":"Python/Widgets/ImplicitPlaneWidget2/","title":"ImplicitPlaneWidget2","text":"

vtk-examples/Python/Widgets/ImplicitPlaneWidget2

"},{"location":"Python/Widgets/ImplicitPlaneWidget2/#description","title":"Description","text":"

This example shows how to use the second generation ImplicitPlaneWidget2 to interactively define the clipping plane for a polydata. If no arguments are specified, a vtkSphereSource generates the polydata. By specifying a .vtp file, the example can operate on arbitrary polydata.

For example, try VTKData/Data/cow.vtp.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/ImplicitPlaneWidget2/#code","title":"Code","text":"

ImplicitPlaneWidget2.py

#!/usr/bin/env python3\n\nfrom pathlib import Path\n\n# You may need to uncomment one or more of the following imports.\n# If vtkRenderWindow is used and you want to use OpenGL,\n#   you also need the vtkRenderingOpenGL2 module.\n# If vtkRenderWindowInteractor is used, uncomment vtkInteractionStyle\n# If text rendering is used, uncomment vtkRenderingFreeType.\n#\n# If using PyCharm, preface each one you select with this line:\n# noinspection PyUnresolvedReferences\n#\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\n# import vtkmodules.vtkRenderingContextOpenGL2\n# import vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingUI\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkCommand\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import (\n    vtkClipPolyData\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkImplicitPlaneRepresentation,\n    vtkImplicitPlaneWidget2\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(fn):\n    colors = vtkNamedColors()\n    sphere_source = vtkSphereSource()\n    sphere_source.SetRadius(10.0)\n\n    fp = None\n    if fn:\n        fp = Path(fn)\n        if not (fp.is_file() and fp.suffix == '.vtp'):\n            print('Expected an existing file name with extension .vtp:')\n            print('Got', fp)\n            return\n\n    # Setup a visualization pipeline.\n    plane = vtkPlane()\n    clipper = vtkClipPolyData()\n    clipper.SetClipFunction(plane)\n    clipper.InsideOutOn()\n    if fn:\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(fp)\n        clipper.SetInputConnection(reader.GetOutputPort())\n    else:\n        clipper.SetInputConnection(sphere_source.GetOutputPort())\n\n    # Create a mapper and actor.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(clipper.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    back_faces = vtkProperty()\n    back_faces.SetDiffuseColor(colors.GetColor3d('Gold'))\n\n    actor.SetBackfaceProperty(back_faces)\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetWindowName('ImplicitPlaneWidget2')\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # An interactor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # The callback will do the work.\n    my_callback = IPWCallback(plane)\n\n    rep = vtkImplicitPlaneRepresentation()\n    rep.SetPlaceFactor(1.25)  # This must be set prior to placing the widget\n    rep.PlaceWidget(actor.GetBounds())\n    rep.SetNormal(plane.GetNormal())\n\n    plane_widget = vtkImplicitPlaneWidget2()\n    plane_widget.SetInteractor(iren)\n    plane_widget.SetRepresentation(rep)\n    plane_widget.AddObserver(vtkCommand.InteractionEvent, my_callback)\n\n    renderer.GetActiveCamera().Azimuth(-60)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Zoom(0.75)\n\n    # Render and interact.\n    iren.Initialize()\n    ren_win.Render()\n    plane_widget.On()\n\n    # Begin mouse interaction.\n    iren.Start()\n\n\nclass IPWCallback:\n    def __init__(self, plane):\n        self.plane = plane\n\n    def __call__(self, caller, ev):\n        rep = caller.GetRepresentation()\n        rep.GetPlane(self.plane)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'How to use the second generation ImplicitPlaneWidget2 to interactively' \\\n                  ' define the clipping plane for a polydata.'\n    epilogue = '''\n    If no arguments are specified, a vtkSphereSource generates the polydata.\n    By specifying a .vtp file, the example can operate on arbitrary polydata.\n'''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('file_name', nargs='?', default=None, help='A VTK Poly Data file e.g. cow.vtp')\n\n    args = parser.parse_args()\n    return args.file_name\n\n\nif __name__ == '__main__':\n    file_name = get_program_parameters()\n    main(file_name)\n
"},{"location":"Python/Widgets/OrientationMarkerWidget/","title":"OrientationMarkerWidget","text":"

vtk-examples/Python/Widgets/OrientationMarkerWidget

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/OrientationMarkerWidget/#code","title":"Code","text":"

OrientationMarkerWidget.py

#!/usr/bin/env python3\n# Contributed by Eric E Monson\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAnnotatedCubeActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.2, 0.3, 0.7, 1.0])\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetWindowName('OrientationMarkerWidget')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    cube = vtkCubeSource()\n    cube.SetXLength(200)\n    cube.SetYLength(200)\n    cube.SetZLength(200)\n    cube.Update()\n    cm = vtkPolyDataMapper()\n    cm.SetInputConnection(cube.GetOutputPort())\n    ca = vtkActor()\n    ca.SetMapper(cm)\n    ca.GetProperty().SetColor(colors.GetColor3d(\"BurlyWood\"))\n    ca.GetProperty().EdgeVisibilityOn()\n    ca.GetProperty().SetEdgeColor(colors.GetColor3d(\"Red\"))\n\n    # assign actor to the renderer\n    ren.AddActor(ca)\n    ren.SetBackground(colors.GetColor3d('CornflowerBlue'))\n\n    axes_actor = vtkAnnotatedCubeActor()\n    axes_actor.SetXPlusFaceText('L')\n    axes_actor.SetXMinusFaceText('R')\n    axes_actor.SetYMinusFaceText('I')\n    axes_actor.SetYPlusFaceText('S')\n    axes_actor.SetZMinusFaceText('P')\n    axes_actor.SetZPlusFaceText('A')\n    axes_actor.GetTextEdgesProperty().SetColor(colors.GetColor3d(\"Yellow\"))\n    axes_actor.GetTextEdgesProperty().SetLineWidth(2)\n    axes_actor.GetCubeProperty().SetColor(colors.GetColor3d(\"Blue\"))\n    axes = vtkOrientationMarkerWidget()\n    axes.SetOrientationMarker(axes_actor)\n    axes.SetInteractor(iren)\n    axes.EnabledOn()\n    axes.InteractiveOn()\n    ren.ResetCamera()\n\n    # enable user interface interactor\n    iren.Initialize()\n    ren_win.Render()\n    ren.GetActiveCamera().Azimuth(45)\n    ren.GetActiveCamera().Elevation(30)\n    ren_win.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Widgets/OrientationMarkerWidget1/","title":"OrientationMarkerWidget1","text":"

vtk-examples/Python/Widgets/OrientationMarkerWidget1

"},{"location":"Python/Widgets/OrientationMarkerWidget1/#description","title":"Description","text":"

This example uses a polydata as an orientation icon. You can get the bunny data src/Testing/Data/Bunny.vtp.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/OrientationMarkerWidget1/#code","title":"Code","text":"

OrientationMarkerWidget1.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSuperquadricSource\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    # Read the polydata for the icon\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(file_name)\n\n    icon_mapper = vtkDataSetMapper()\n    icon_mapper.SetInputConnection(reader.GetOutputPort())\n\n    icon_actor = vtkActor()\n    icon_actor.SetMapper(icon_mapper)\n    icon_actor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    # Set up the renderer, window, and interactor\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(400, 400)\n    ren_win.SetWindowName('OrientationMarkerWidget1')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    rgb = [0.0, 0.0, 0.0]\n    colors.GetColorRGB('Wheat', rgb)\n    # Set up the widget\n    widget = vtkOrientationMarkerWidget()\n    widget.SetOrientationMarker(icon_actor)\n    widget.SetInteractor(iren)\n    widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n    widget.SetOutlineColor(*rgb)\n    widget.SetEnabled(1)\n    widget.InteractiveOn()\n\n    # Create a superquadric\n    superquadric_source = vtkSuperquadricSource()\n    superquadric_source.SetPhiRoundness(.2)\n    superquadric_source.SetThetaRoundness(.8)\n\n    # Create a mapper and actor\n    superquadric_mapper = vtkPolyDataMapper()\n    superquadric_mapper.SetInputConnection(superquadric_source.GetOutputPort())\n\n    superquadric_actor = vtkActor()\n    superquadric_actor.SetMapper(superquadric_mapper)\n    superquadric_actor.GetProperty().SetInterpolationToFlat()\n    superquadric_actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Carrot'))\n    superquadric_actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    superquadric_actor.GetProperty().SetDiffuse(0.6)\n    superquadric_actor.GetProperty().SetSpecular(0.5)\n    superquadric_actor.GetProperty().SetSpecularPower(5.0)\n\n    renderer.AddActor(superquadric_actor)\n    renderer.ResetCamera()\n\n    ren_win.Render()\n\n    iren.Initialize()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'OrientationMarkerWidget1'\n    epilogue = \"\"\"\n   \"\"\"\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='Bunny.vtp')\n    args = parser.parse_args()\n    return args.file_name\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Widgets/ScalarBarWidget/","title":"ScalarBarWidget","text":"

vtk-examples/Python/Widgets/ScalarBarWidget

"},{"location":"Python/Widgets/ScalarBarWidget/#description","title":"Description","text":"

Display a movable and resizable scalar bar.

An example input file is uGridEx.vtk (folder Data at VTKData).

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/ScalarBarWidget/#code","title":"Code","text":"

ScalarBarWidget.py

#!/usr/bin/env python3\n\n# by Panos Mavrogiorgos, email : pmav99 >a< gmail\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkIOLegacy import vtkUnstructuredGridReader\nfrom vtkmodules.vtkInteractionWidgets import vtkScalarBarWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Scalar bar widget.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='uGridEx.vtkp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])\n\n    # The source file\n    file_name = get_program_parameters()\n\n    # Create a custom lut. The lut is used for both at the mapper and at the\n    # scalar_bar\n    lut = vtkLookupTable()\n    lut.Build()\n\n    # Read the source file.\n    reader = vtkUnstructuredGridReader()\n    reader.SetFileName(file_name)\n    reader.Update()  # Needed because of GetScalarRange\n    output = reader.GetOutput()\n    scalar_range = output.GetScalarRange()\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(output)\n    mapper.SetScalarRange(scalar_range)\n    mapper.SetLookupTable(lut)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('MidnightBLue'))\n\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetSize(300, 300)\n    render_window.SetWindowName(\"ScalarBarWidget\")\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n\n    # create the scalar_bar\n    scalar_bar = vtkScalarBarActor()\n    scalar_bar.SetOrientationToHorizontal()\n    scalar_bar.SetLookupTable(lut)\n\n    # create the scalar_bar_widget\n    scalar_bar_widget = vtkScalarBarWidget()\n    scalar_bar_widget.SetInteractor(interactor)\n    scalar_bar_widget.SetScalarBarActor(scalar_bar)\n    scalar_bar_widget.On()\n\n    interactor.Initialize()\n    render_window.Render()\n    renderer.GetActiveCamera().SetPosition(-6.4, 10.3, 1.4)\n    renderer.GetActiveCamera().SetFocalPoint(1.0, 0.5, 3.0)\n    renderer.GetActiveCamera().SetViewUp(0.6, 0.4, -0.7)\n    render_window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Widgets/SphereWidget/","title":"SphereWidget","text":"

vtk-examples/Python/Widgets/SphereWidget

"},{"location":"Python/Widgets/SphereWidget/#description","title":"Description","text":"

This example shows how to use the SphereWidget.

Other languages

See (Cxx)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/SphereWidget/#code","title":"Code","text":"

SphereWidget.py

#!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkInteractionWidgets import vtkSphereWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\n# Call back function\n\n\ndef sphereCallback(obj, event):\n    print('Center: {}, {}, {}'.format(*obj.GetCenter()))\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName(\"SphereWidget\")\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # A Sphere widget\n    sphereWidget = vtkSphereWidget()\n    sphereWidget.SetInteractor(interactor)\n    sphereWidget.SetRepresentationToSurface()\n    sphereWidget.GetSphereProperty().SetColor(colors.GetColor3d(\"BurlyWood\"))\n\n    # Connect the event to a function\n    sphereWidget.AddObserver(\"InteractionEvent\", sphereCallback)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    sphereWidget.On()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Python/Widgets/SplineWidget/","title":"SplineWidget","text":"

vtk-examples/Python/Widgets/SplineWidget

"},{"location":"Python/Widgets/SplineWidget/#description","title":"Description","text":"

This example shows how to use vtkSplineWidget with a callback being used to get the length of the spline widget.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/SplineWidget/#code","title":"Code","text":"

SplineWidget.py

#!/usr/bin/python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersSources import vtkCylinderSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkSplineWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n    colors.SetColor('ParaViewBkg', [82, 87, 110, 255])\n\n    has_cow = False\n    if vtk_version_ok(9, 0, 20210718):\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        has_cow = True\n\n    window_width = 1024\n    window_height = 1024\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(window_width, window_height)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    # Create a cylinder.\n    cylinder = vtkCylinderSource()\n    cylinder.SetCenter(0.0, 0.0, 0.0)\n    cylinder.SetRadius(3.0)\n    cylinder.SetHeight(5.0)\n    cylinder.SetResolution(100)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(cylinder.GetOutputPort())\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('Cornsilk'))\n    actor.SetMapper(mapper)\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n\n    ren_win.AddRenderer(renderer)\n\n    # A spline widget\n    spline_widget = vtkSplineWidget()\n    spline_widget.SetInteractor(iren)\n    spline_widget.SetProp3D(actor)\n    spline_widget.PlaceWidget(-2.5, 2.5, 3.5, 3.5, 0, 0, )\n    spline_widget.On()\n\n    spline_widget.AddObserver(vtkCommand.EndInteractionEvent, SplineCallback(spline_widget))\n    # Important: The interactor must be set prior to enabling the widget.\n    iren.SetRenderWindow(ren_win)\n\n    if has_cow:\n        cam_orient_manipulator.SetParentRenderer(renderer)\n        # Enable the widget.\n        cam_orient_manipulator.On()\n\n    ren_win.Render()\n    ren_win.SetWindowName('SplineWidget')\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\nclass SplineCallback:\n    def __init__(self, spline_widget):\n        self.spline = spline_widget\n\n    def __call__(self, caller, ev):\n        spline_widget = caller\n        length = spline_widget.GetSummedLength()\n        print(f'Length: {length}')\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
"},{"location":"Python/Widgets/TextWidget/","title":"TextWidget","text":"

vtk-examples/Python/Widgets/TextWidget

"},{"location":"Python/Widgets/TextWidget/#description","title":"Description","text":"

A simple example of annotating a VTK image with movable and resizable text.

Other languages

See (Cxx), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Python/Widgets/TextWidget/#code","title":"Code","text":"

TextWidget.py

#!/usr/bin/env python3\n\n# by Panos Mavrogiorgos, email : pmav99 >a< gmail\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkTextRepresentation,\n    vtkTextWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextActor\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])\n\n    source = vtkSphereSource()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n\n    # Create the TextActor\n    text_actor = vtkTextActor()\n    text_actor.SetInput('This is a test')\n    text_actor.GetTextProperty().SetColor(colors.GetColor3d('Lime'))\n\n    # Create the text representation. Used for positioning the text_actor\n    text_representation = vtkTextRepresentation()\n    text_representation.GetPositionCoordinate().SetValue(0.15, 0.15)\n    text_representation.GetPosition2Coordinate().SetValue(0.7, 0.2)\n\n    # Create the TextWidget\n    # Note that the SelectableOff method MUST be invoked!\n    # According to the documentation :\n    #\n    # SelectableOn/Off indicates whether the interior region of the widget can be\n    # selected or not. If not, then events (such as left mouse down) allow the user\n    # to 'move' the widget, and no selection is possible. Otherwise the\n    # SelectRegion() method is invoked.\n    text_widget = vtkTextWidget()\n    text_widget.SetRepresentation(text_representation)\n\n    text_widget.SetInteractor(interactor)\n    text_widget.SetTextActor(text_actor)\n    text_widget.SelectableOff()\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('MidnightBLue'))\n    render_window.SetSize(300, 300)\n    render_window.SetWindowName('TextWidget')\n\n    interactor.Initialize()\n    render_window.Render()\n    text_widget.On()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesNotUsed/","title":"VTK Classes not used in the Examples","text":""},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesNotUsed/#pythonicapi","title":"PythonicAPI","text":"

Out of 3113 available VTK classes, 3106 have not been used.

VTK Class VTK Class VTK Class VTK Class VTK Class vtk2DHistogramItem vtk3DCursorRepresentation vtk3DCursorWidget vtk3DLinearGridCrinkleExtractor vtk3DLinearGridInternal vtk3DLinearGridPlaneCutter vtk3DSImporter vtk3DWidget vtkABI vtkADIOS2CoreImageReader vtkADIOS2VTXReader vtkAMRBaseParticlesReader vtkAMRBaseReader vtkAMRBox vtkAMRCutPlane vtkAMRDataInternals vtkAMRDataSetCache vtkAMREnzoParticlesReader vtkAMREnzoReader vtkAMREnzoReaderInternal vtkAMRFlashParticlesReader vtkAMRFlashReader vtkAMRFlashReaderInternal vtkAMRGaussianPulseSource vtkAMRInformation vtkAMRInterpolatedVelocityField vtkAMRResampleFilter vtkAMRSliceFilter vtkAMRToMultiBlockFilter vtkAMRUtilities vtkAMRVelodyneReader vtkAMRVelodyneReaderInternal vtkAMRVolumeMapper vtkAMReXGridHeader vtkAMReXGridLevelHeader vtkAMReXGridReader vtkAMReXGridReaderInternal vtkAMReXParticlesReader vtkAOSDataArrayTemplate vtkASCIITextCodec vtkAVIWriter vtkAVSucdReader vtkAbstractArray vtkAbstractCellArray vtkAbstractCellLinks vtkAbstractCellLocator vtkAbstractContextBufferId vtkAbstractContextItem vtkAbstractElectronicData vtkAbstractGridConnectivity vtkAbstractHyperTreeGridMapper vtkAbstractImageInterpolator vtkAbstractInteractionDevice vtkAbstractInterpolatedVelocityField vtkAbstractMapper vtkAbstractMapper3D vtkAbstractParticleWriter vtkAbstractPicker vtkAbstractPointLocator vtkAbstractPolyDataReader vtkAbstractPolygonalHandleRepresentation3D vtkAbstractPropPicker vtkAbstractRenderDevice vtkAbstractSplineRepresentation vtkAbstractTransform vtkAbstractVolumeMapper vtkAbstractWidget vtkActor2D vtkActor2DCollection vtkActorCollection vtkActorNode vtkAdaptiveDataSetSurfaceFilter vtkAdaptiveResampleToImage vtkAdaptiveSubdivisionFilter vtkAdaptiveTemporalInterpolator vtkAddMembershipArray vtkAdjacencyMatrixToEdgeTable vtkAdjacentVertexIterator vtkAffineRepresentation vtkAffineRepresentation2D vtkAffineWidget vtkAggregateDataSetFilter vtkAggregateToPartitionedDataSetCollection vtkAlembicExporter vtkAlgorithm vtkAlgorithmOutput vtkAlignImageDataSetFilter vtkAmoebaMinimizer vtkAnariActorNode vtkAnariCameraNode vtkAnariCompositePolyDataMapperNode vtkAnariFollowerNode vtkAnariLightNode vtkAnariPass vtkAnariPolyDataMapperNode vtkAnariProfiling vtkAnariRendererNode vtkAnariTestInteractor vtkAnariViewNodeFactory vtkAnariVolumeInterface vtkAnariVolumeMapper vtkAnariVolumeMapperNode vtkAnariVolumeNode vtkAnariWindowNode vtkAndroidOutputWindow vtkAndroidRenderWindowInteractor vtkAngleRepresentation vtkAngleRepresentation2D vtkAngleRepresentation3D vtkAngleWidget vtkAngularPeriodicDataArray vtkAngularPeriodicFilter vtkAnimateModes vtkAnimationCue vtkAnimationScene vtkAnnotatedCubeActor vtkAnnotation vtkAnnotationLayers vtkAnnotationLayersAlgorithm vtkAnnotationLink vtkAppendArcLength vtkAppendCompositeDataLeaves vtkAppendDataSets vtkAppendFilter vtkAppendLocationAttributes vtkAppendPartitionedDataSetCollection vtkAppendPoints vtkAppendPolyData vtkAppendSelection vtkApplyColors vtkApplyIcons vtkApproximatingSubdivisionFilter vtkArcGridActorPrivate vtkArcParallelEdgeStrategy vtkArcPlotter vtkArcSource vtkArchiver vtkAreaContourSpectrumFilter vtkAreaLayout vtkAreaLayoutStrategy vtkAreaPicker vtkArray vtkArrayCalculator vtkArrayCoordinates vtkArrayData vtkArrayDataAlgorithm vtkArrayDataReader vtkArrayDataWriter vtkArrayDispatch vtkArrayExtents vtkArrayExtentsList vtkArrayInterpolate vtkArrayIterator vtkArrayIteratorIncludes vtkArrayIteratorTemplate vtkArrayListTemplate vtkArrayNorm vtkArrayPrint vtkArrayRange vtkArrayReader vtkArrayRename vtkArrayRenderer vtkArraySort vtkArrayToTable vtkArrayWeights vtkArrayWriter vtkArrowSource vtkAssembly vtkAssemblyNode vtkAssemblyPath vtkAssemblyPaths vtkAssignAttribute vtkAssignCoordinates vtkAssignCoordinatesLayoutStrategy vtkAtom vtkAtomicMutex vtkAttributeClustering2DLayoutStrategy vtkAttributeDataToFieldDataFilter vtkAttributeDataToTableFilter vtkAttributeSmoothingFilter vtkAttributesErrorMetric vtkAutoCorrelativeStatistics vtkAvatar vtkAxes vtkAxesActor vtkAxesTransformRepresentation vtkAxesTransformWidget vtkAxis vtkAxisActor vtkAxisActor2D vtkAxisActor2DMock vtkAxisExtended vtkAxisFollower vtkAxisGridActorPrivate vtkBMPReader vtkBMPWriter vtkBSPCuts vtkBSPIntersections vtkBSplineTransform vtkBTSReader vtkBYUReader vtkBYUWriter vtkBackgroundColorMonitor vtkBalloonRepresentation vtkBalloonWidget vtkBandedPolyDataContourFilter vtkBarChartActor vtkBase64InputStream vtkBase64OutputStream vtkBase64Utilities vtkBatchedSurfaceLICMapper vtkBatches vtkBezierContourLineInterpolator vtkBezierCurve vtkBezierHexahedron vtkBezierInterpolation vtkBezierQuadrilateral vtkBezierTetra vtkBezierTriangle vtkBezierWedge vtkBiDimensionalRepresentation vtkBiDimensionalRepresentation2D vtkBiDimensionalWidget vtkBiQuadraticQuad vtkBiQuadraticQuadraticHexahedron vtkBiQuadraticQuadraticWedge vtkBiQuadraticTriangle vtkBilinearQuadIntersection vtkBillboardTextActor3D vtkBinCellDataFilter vtkBinnedDecimation vtkBiomTableReader vtkBitArray vtkBitArrayIterator vtkBivariateLinearTableThreshold vtkBlankStructuredGrid vtkBlankStructuredGridWithImage vtkBlockDistribution vtkBlockIdScalars vtkBlockItem vtkBlockSelector vtkBlueObeliskData vtkBlueObeliskDataParser vtkBond vtkBooleanOperationPolyDataFilter vtkBooleanTexture vtkBoostBetweennessClustering vtkBoostBiconnectedComponents vtkBoostBrandesCentrality vtkBoostBreadthFirstSearch vtkBoostBreadthFirstSearchTree vtkBoostConnectedComponents vtkBoostDividedEdgeBundling vtkBoostExtractLargestComponent vtkBoostKruskalMinimumSpanningTree vtkBoostLogWeighting vtkBoostPrimMinimumSpanningTree vtkBoostRandomSparseArraySource vtkBoostSplitTableField vtkBorderRepresentation vtkBorderWidget vtkBoundaryMeshQuality vtkBoundedPlanePointPlacer vtkBoundedPointSource vtkBoundingBox vtkBox vtkBoxClipDataSet vtkBoxLayoutStrategy vtkBoxMuellerRandomSequence vtkBoxRepresentation vtkBoxWidget vtkBoxWidget2 vtkBreakPoint vtkBrokenLineWidget vtkBrownianPoints vtkBrush vtkBuffer vtkBufferedArchiver vtkButterflySubdivisionFilter vtkButtonRepresentation vtkButtonSource vtkButtonWidget vtkByteSwap vtkCGMWriter vtkCGNSCache vtkCGNSFileSeriesReader vtkCGNSReader vtkCGNSReaderInternal vtkCMLMoleculeReader vtkCONVERGECFDCGNSReader vtkCONVERGECFDReader vtkCPExodusIIElementBlock vtkCPExodusIIElementBlockCellIterator vtkCPExodusIIElementBlockImpl vtkCPExodusIIInSituReader vtkCPExodusIINodalCoordinatesTemplate vtkCPExodusIIResultsArrayTemplate vtkCachedStreamingDemandDrivenPipeline vtkCallbackCommand vtkCamera vtkCamera3DRepresentation vtkCamera3DWidget vtkCameraActor vtkCameraHandleSource vtkCameraInterpolator vtkCameraNode vtkCameraOrientationRepresentation vtkCameraOrientationWidget vtkCameraPass vtkCameraPathRepresentation vtkCameraPathWidget vtkCameraRepresentation vtkCameraWidget vtkCapsuleSource vtkCaptionActor2D vtkCaptionRepresentation vtkCaptionWidget vtkCardinalSpline vtkCastToConcrete vtkCategoryLegend vtkCell vtkCell3D vtkCellArray vtkCellArrayIterator vtkCellAttribute vtkCellAttributeCalculator vtkCellAttributeInformation vtkCellCenterDepthSort vtkCellCenters vtkCellCentersPointPlacer vtkCellData vtkCellDataToPointData vtkCellDerivatives vtkCellDistanceSelector vtkCellGraphicsPrimitiveMap vtkCellGrid vtkCellGridAlgorithm vtkCellGridBoundsQuery vtkCellGridComputeSurface vtkCellGridElevation vtkCellGridElevationQuery vtkCellGridEvaluator vtkCellGridIOQuery vtkCellGridMapper vtkCellGridPointProbe vtkCellGridQuery vtkCellGridRangeQuery vtkCellGridReader vtkCellGridRenderRequest vtkCellGridResponder vtkCellGridResponderBase vtkCellGridResponders vtkCellGridSidesQuery vtkCellGridWriter vtkCellIterator vtkCellLinks vtkCellLocator vtkCellLocatorStrategy vtkCellMetadata vtkCellPicker vtkCellQuality vtkCellSizeFilter vtkCellTreeLocator vtkCellType vtkCellTypeSource vtkCellTypes vtkCellValidator vtkCenterOfMass vtkCenteredSliderRepresentation vtkCenteredSliderWidget vtkCesium3DTilesReader vtkCesium3DTilesWriter vtkCesiumB3DMReader vtkCesiumPointCloudWriter vtkChacoGraphReader vtkChacoReader vtkCharArray vtkChart vtkChart2DHistogram vtkChartBox vtkChartHistogram2D vtkChartLegend vtkChartMatrix vtkChartParallelCoordinates vtkChartPie vtkChartXY vtkChartXYZ vtkCheckerboardRepresentation vtkCheckerboardSplatter vtkCheckerboardWidget vtkCirclePackFrontChainLayoutStrategy vtkCirclePackLayout vtkCirclePackLayoutStrategy vtkCirclePackToPolyData vtkCircularLayoutStrategy vtkCityGMLReader vtkCleanPolyData vtkCleanUnstructuredGrid vtkCleanUnstructuredGridCells vtkClearRGBPass vtkClearZPass vtkClientServerCompositePass vtkClientServerSynchronizedRenderers vtkClientSocket vtkClipClosedSurface vtkClipConvexPolyData vtkClipDataSet vtkClipPolyData vtkClipVolume vtkClosedSurfacePointPlacer vtkClosestNPointsStrategy vtkClosestPointStrategy vtkClustering2DLayoutStrategy vtkCocoaMacOSXSDKCompatibility vtkCocoaRenderWindow vtkCocoaRenderWindowInteractor vtkCocoaTkUtilities vtkCoincidentPoints vtkCollapseGraph vtkCollapseVerticesByArray vtkCollectGraph vtkCollectPolyData vtkCollectTable vtkCollection vtkCollectionElement vtkCollectionIterator vtkCollisionDetectionFilter vtkColor vtkColor3 vtkColor3d vtkColor3f vtkColor3ub vtkColor4 vtkColor4d vtkColor4f vtkColor4ub vtkColorLegend vtkColorSeries vtkColorTransferControlPointsItem vtkColorTransferFunction vtkColorTransferFunctionItem vtkCommand vtkCommonInformationKeyManager vtkCommunicator vtkCommunity2DLayoutStrategy vtkCompassRepresentation vtkCompassWidget vtkCompositeCellGridMapper vtkCompositeCellGridReader vtkCompositeControlPointsItem vtkCompositeCutter vtkCompositeDataDisplayAttributes vtkCompositeDataDisplayAttributesLegacy vtkCompositeDataGeometryFilter vtkCompositeDataIterator vtkCompositeDataPipeline vtkCompositeDataProbeFilter vtkCompositeDataReader vtkCompositeDataSet vtkCompositeDataSetAlgorithm vtkCompositeDataWriter vtkCompositeImplicitBackend vtkCompositeInterpolatedVelocityField vtkCompositeMapperHelper2 vtkCompositeMapperHelperData vtkCompositePolyDataMapper vtkCompositePolyDataMapper2 vtkCompositePolyDataMapperDelegator vtkCompositeRGBAPass vtkCompositeRenderManager vtkCompositeSurfaceLICMapper vtkCompositeSurfaceLICMapperDelegator vtkCompositeTransferFunctionItem vtkCompositeZPass vtkCompositedSynchronizedRenderers vtkCompositer vtkCompressCompositer vtkComputeHistogram2DOutliers vtkComputeQuantiles vtkComputeQuartiles vtkConduitArrayUtilities vtkConduitSource vtkConduitToDataObject vtkCone vtkConeLayoutStrategy vtkConeSource vtkConnectedPointsFilter vtkConnectivityFilter vtkConstrained2DLayoutStrategy vtkConstrainedPointHandleRepresentation vtkConstrainedSmoothingFilter vtkConsumerDataFilter vtkContext2D vtkContext3D vtkContextActor vtkContextArea vtkContextClip vtkContextDevice2D vtkContextDevice3D vtkContextInteractorStyle vtkContextItem vtkContextKeyEvent vtkContextMapper2D vtkContextMouseEvent vtkContextPolygon vtkContextScene vtkContextScenePrivate vtkContextTransform vtkContextView vtkContingencyStatistics vtkContinuousScatterplot vtkContinuousValueWidget vtkContinuousValueWidgetRepresentation vtkContour3DLinearGrid vtkContourFilter vtkContourGrid vtkContourHelper vtkContourLineInterpolator vtkContourLoopExtraction vtkContourRepresentation vtkContourRepresentationInternals vtkContourRepresentationNode vtkContourRepresentationPoint vtkContourTriangulator vtkContourValues vtkContourWidget vtkControlPointsItem vtkConvertSelection vtkConvertSelectionDomain vtkConvertToMultiBlockDataSet vtkConvertToPartitionedDataSetCollection vtkConvertToPointCloud vtkConvertToPolyhedra vtkConvexHull2D vtkConvexPointSet vtkCookieCutter vtkCoordinate vtkCoordinateFrame vtkCoordinateFrameRepresentation vtkCoordinateFrameWidget vtkCornerAnnotation vtkCorrelativeStatistics vtkCosmicTreeLayoutStrategy vtkCountFaces vtkCountVertices vtkCubeAxesActor vtkCubeAxesActor2D vtkCubeSource vtkCubicLine vtkCuller vtkCullerCollection vtkCursor2D vtkCursor3D vtkCurvatures vtkCurveRepresentation vtkCutMaterial vtkCutter vtkCylinder vtkCylindricalTransform vtkDEMReader vtkDGAttributeInformation vtkDGBoundsResponder vtkDGCell vtkDGEdge vtkDGElevationResponder vtkDGEvaluator vtkDGHex vtkDGIOResponder vtkDGInterpolateCalculator vtkDGPyr vtkDGQuad vtkDGRangeResponder vtkDGRenderResponder vtkDGSidesResponder vtkDGTet vtkDGTranscribeUnstructuredCells vtkDGTri vtkDGVert vtkDGWdg vtkDICOMImageReader vtkDIMACSGraphReader vtkDIMACSGraphWriter vtkDIYAggregateDataSetFilter vtkDIYDataExchanger vtkDIYExplicitAssigner vtkDIYGhostUtilities vtkDIYKdTreeUtilities vtkDIYUtilities vtkDIYUtilitiesCleanup vtkDSPFilterDefinition vtkDSPFilterGroup vtkDataArray vtkDataArrayCollection vtkDataArrayCollectionIterator vtkDataArraySelection vtkDataAssembly vtkDataAssemblyUtilities vtkDataAssemblyVisitor vtkDataCompressor vtkDataEncoder vtkDataObject vtkDataObjectAlgorithm vtkDataObjectCollection vtkDataObjectGenerator vtkDataObjectMeshCache vtkDataObjectReader vtkDataObjectToConduit vtkDataObjectToDataSetFilter vtkDataObjectToTable vtkDataObjectTree vtkDataObjectTreeIndex vtkDataObjectTreeInternals vtkDataObjectTreeIterator vtkDataObjectTypes vtkDataObjectWriter vtkDataReader vtkDataRepresentation vtkDataSet vtkDataSetAlgorithm vtkDataSetAttributes vtkDataSetAttributesFieldList vtkDataSetCellIterator vtkDataSetCollection vtkDataSetEdgeSubdivisionCriterion vtkDataSetGradient vtkDataSetGradientPrecompute vtkDataSetMapper vtkDataSetReader vtkDataSetRegionSurfaceFilter vtkDataSetSurfaceFilter vtkDataSetToDataObjectFilter vtkDataSetTriangleFilter vtkDataSetWriter vtkDataTransferHelper vtkDataWriter vtkDatabaseToTableReader vtkDateToNumeric vtkDeRhamCell vtkDebugLeaks vtkDebugLeaksManager vtkDebugLeaksObserver vtkDecimatePolylineFilter vtkDecimatePro vtkDefaultPass vtkDeflectNormals vtkDeformPointSet vtkDelaunay2D vtkDelaunay3D vtkDelimitedTextReader vtkDelimitedTextWriter vtkDemandDrivenPipeline vtkDendrogramItem vtkDenseArray vtkDensifyPointCloudFilter vtkDensifyPolyData vtkDependentDimensionInfo vtkDepthImageProcessingPass vtkDepthImageToPointCloud vtkDepthOfFieldPass vtkDepthPeelingPass vtkDepthSortPolyData vtkDescriptiveStatistics vtkDeserializer vtkDiagonalMatrixSource vtkDicer vtkDijkstraGraphGeodesicPath vtkDijkstraGraphInternals vtkDijkstraImageContourLineInterpolator vtkDijkstraImageGeodesicPath vtkDimensionInfo vtkDirectedAcyclicGraph vtkDirectedGraph vtkDirectedGraphAlgorithm vtkDirectionEncoder vtkDirectory vtkDiscreteFlyingEdges2D vtkDiscreteFlyingEdges3D vtkDiscreteFlyingEdgesClipper2D vtkDiscreteMarchingCubes vtkDiscretizableColorTransferFunction vtkDiskSource vtkDisplaySizedImplicitPlaneRepresentation vtkDisplaySizedImplicitPlaneWidget vtkDistancePolyDataFilter vtkDistanceRepresentation vtkDistanceRepresentation2D vtkDistanceRepresentation3D vtkDistanceToCamera vtkDistanceWidget vtkDistributedDataFilter vtkDistributedGraphHelper vtkDistributedPointCloudFilter vtkDotProductSimilarity vtkDoubleArray vtkDrawTexturedElements vtkDualDepthPeelingPass vtkDummyCommunicator vtkDummyController vtkDummyGPUInfoList vtkDuplicatePolyData vtkDynamic2DLabelMapper vtkDynamicLoader vtkEDLShading vtkEGLRenderWindow vtkERFReader vtkEarthSource vtkEdgeCenters vtkEdgeLayout vtkEdgeLayoutStrategy vtkEdgeListIterator vtkEdgePoints vtkEdgeSubdivisionCriterion vtkEdgeTable vtkElevationFilter vtkEllipseArcSource vtkEllipsoidTensorProbeRepresentation vtkEllipsoidalGaussianKernel vtkEllipticalButtonSource vtkEmptyCell vtkEmptyRepresentation vtkEnSight6BinaryReader vtkEnSight6Reader vtkEnSightGoldBinaryReader vtkEnSightGoldReader vtkEnSightMasterServerReader vtkEnSightReader vtkEnSightWriter vtkEncodedGradientEstimator vtkEncodedGradientShader vtkEndFor vtkEnsembleSource vtkEnzoReaderBlock vtkEnzoReaderInternal vtkEqualizerContextItem vtkEqualizerFilter vtkEquirectangularToCubeMapTexture vtkErrorCode vtkEuclideanClusterExtraction vtkEvenlySpacedStreamlines2D vtkEvent vtkEventData vtkEventDataDevice3D vtkEventDataForDevice vtkEventForwarderCommand vtkEventQtSlotConnect vtkExecutableRunner vtkExecutionAggregator vtkExecutionRange vtkExecutionTimer vtkExecutive vtkExodusIICache vtkExodusIICacheEntry vtkExodusIICacheKey vtkExodusIIReader vtkExodusIIReaderIntPointCheck vtkExodusIIReaderParser vtkExodusIIReaderPrivate vtkExodusIIReaderScalarCheck vtkExodusIIReaderTensorCheck vtkExodusIIReaderVariableCheck vtkExodusIIReaderVectorCheck vtkExodusIIWriter vtkExpandMarkedElements vtkExpandSelectedGraph vtkExplicitStructuredGrid vtkExplicitStructuredGridAlgorithm vtkExplicitStructuredGridCrop vtkExplicitStructuredGridSurfaceFilter vtkExplicitStructuredGridToUnstructuredGrid vtkExporter vtkExprTkFunctionParser vtkExtentRCBPartitioner vtkExtentSplitter vtkExtentTranslator vtkExternalLight vtkExternalOpenGLCamera vtkExternalOpenGLRenderWindow vtkExternalOpenGLRenderer vtkExtractArray vtkExtractBlock vtkExtractBlockUsingDataAssembly vtkExtractCTHPart vtkExtractCells vtkExtractCellsAlongPolyLine vtkExtractCellsByType vtkExtractDataArraysOverTime vtkExtractDataOverTime vtkExtractDataSets vtkExtractEdges vtkExtractEnclosedPoints vtkExtractExodusGlobalTemporalVariables vtkExtractFunctionalBagPlot vtkExtractGeometry vtkExtractGhostCells vtkExtractGrid vtkExtractHierarchicalBins vtkExtractHistogram vtkExtractHistogram2D vtkExtractLevel vtkExtractParticlesOverTime vtkExtractPiece vtkExtractPointCloudPiece vtkExtractPoints vtkExtractPolyDataGeometry vtkExtractPolyDataPiece vtkExtractRectilinearGrid vtkExtractSelectedArraysOverTime vtkExtractSelectedFrustum vtkExtractSelectedGraph vtkExtractSelectedRows vtkExtractSelectedTree vtkExtractSelection vtkExtractSelectionBase vtkExtractStructuredGridHelper vtkExtractSubsetWithSeed vtkExtractSurface vtkExtractTensorComponents vtkExtractTimeSteps vtkExtractUnstructuredGrid vtkExtractUnstructuredGridPiece vtkExtractUserDefinedPiece vtkExtractVOI vtkExtractVectorComponents vtkFDSReader vtkFFMPEGVideoSource vtkFFMPEGWriter vtkFFT vtkFLUENTCFFReader vtkFLUENTReader vtkFXAAOptions vtkFacetReader vtkFacetWriter vtkFast2DLayoutStrategy vtkFastSplatter vtkFeatureEdges vtkFiberSurface vtkFidesReader vtkFieldData vtkFieldDataSerializer vtkFieldDataToAttributeDataFilter vtkFieldDataToDataSetAttribute vtkFileOutputWindow vtkFileResourceStream vtkFileSeriesHelper vtkFillHolesFilter vtkFilteringInformationKeyManager vtkFiltersCellGrid vtkFindCellStrategy vtkFiniteDifferenceGradientEstimator vtkFiniteElementFieldDistributor vtkFinitePlaneRepresentation vtkFinitePlaneWidget vtkFitImplicitFunction vtkFitToHeightMapFilter vtkFixedPointRayCastImage vtkFixedPointVolumeRayCastCompositeGOHelper vtkFixedPointVolumeRayCastCompositeGOShadeHelper vtkFixedPointVolumeRayCastCompositeHelper vtkFixedPointVolumeRayCastCompositeShadeHelper vtkFixedPointVolumeRayCastHelper vtkFixedPointVolumeRayCastMIPHelper vtkFixedPointVolumeRayCastMapper vtkFixedSizeHandleRepresentation vtkFixedSizeHandleRepresentation3D vtkFixedWidthTextReader vtkFlagpoleLabel vtkFlashReaderInternal vtkFloatArray vtkFloatingPointExceptions vtkFlyingEdges2D vtkFlyingEdges3D vtkFlyingEdgesPlaneCutter vtkFocalPlaneContourRepresentation vtkFocalPlanePointPlacer vtkFollower vtkFontConfigFreeTypeTools vtkForEach vtkForceDirectedLayoutStrategy vtkForceStaticMesh vtkForceTime vtkFrameBufferObjectBase vtkFramebufferPass vtkFreeTypeLabelRenderStrategy vtkFreeTypeStringToImage vtkFreeTypeTools vtkFreeTypeToolsCleanup vtkFrustumCoverageCuller vtkFrustumSelector vtkFrustumSource vtkFunctionParser vtkFunctionSet vtkGAMBITReader vtkGDAL vtkGDALRasterConverter vtkGDALRasterReader vtkGDALRasterReprojection vtkGDALVectorReader vtkGESignaReader vtkGL2PSExporter vtkGLSLModCamera vtkGLSLModCoincidentTopology vtkGLSLModLight vtkGLSLModPixelDebugger vtkGLSLModifierBase vtkGLSLModifierFactory vtkGLTFDocumentLoader vtkGLTFDocumentLoaderInternals vtkGLTFExporter vtkGLTFImporter vtkGLTFReader vtkGLTFTexture vtkGLTFWriter vtkGLTFWriterUtils vtkGPUInfo vtkGPUInfoList vtkGPUInfoListArray vtkGPUVolumeRayCastMapper vtkGarbageCollector vtkGarbageCollectorManager vtkGaussianBlurPass vtkGaussianCubeReader vtkGaussianCubeReader2 vtkGaussianKernel vtkGaussianRandomSequence vtkGaussianSplatter vtkGeneralTransform vtkGeneralizedKernel vtkGenerateGlobalIds vtkGenerateIndexArray vtkGenerateProcessIds vtkGenerateTimeSteps vtkGenericAdaptorCell vtkGenericAttribute vtkGenericAttributeCollection vtkGenericCell vtkGenericCellIterator vtkGenericCellTessellator vtkGenericClip vtkGenericContourFilter vtkGenericCutter vtkGenericDataArray vtkGenericDataArrayLookupHelper vtkGenericDataObjectReader vtkGenericDataObjectWriter vtkGenericDataSet vtkGenericDataSetTessellator vtkGenericEdgeTable vtkGenericEnSightReader vtkGenericGeometryFilter vtkGenericGlyph3DFilter vtkGenericImageInterpolator vtkGenericInterpolatedVelocityField vtkGenericMovieWriter vtkGenericOpenGLRenderWindow vtkGenericOpenGLResourceFreeCallback vtkGenericOutlineFilter vtkGenericPointIterator vtkGenericProbeFilter vtkGenericRenderWindowInteractor vtkGenericStreamTracer vtkGenericSubdivisionErrorMetric vtkGenericVertexAttributeMapping vtkGeoEdgeStrategy vtkGeoJSONFeature vtkGeoJSONReader vtkGeoJSONWriter vtkGeoMath vtkGeoProjection vtkGeoTransform vtkGeodesicPath vtkGeometricErrorMetric vtkGeometryFilter vtkGhostCellsGenerator vtkGlobFileNames vtkGlyph2D vtkGlyph3D vtkGlyph3DMapper vtkGlyphSource2D vtkGradientFilter vtkGraph vtkGraphAlgorithm vtkGraphAnnotationLayersFilter vtkGraphEdge vtkGraphGeodesicPath vtkGraphHierarchicalBundleEdges vtkGraphInternals vtkGraphItem vtkGraphLayout vtkGraphLayoutFilter vtkGraphLayoutStrategy vtkGraphLayoutView vtkGraphMapper vtkGraphReader vtkGraphToGlyphs vtkGraphToPoints vtkGraphToPolyData vtkGraphWeightEuclideanDistanceFilter vtkGraphWeightFilter vtkGraphWriter vtkGraphicsFactory vtkGreedyTerrainDecimation vtkGridSynchronizedTemplates3D vtkGridTransform vtkGroupDataSetsFilter vtkGroupLeafVertices vtkGroupTimeStepsFilter vtkH5PartReader vtkH5RageReader vtkHDF5Helper vtkHDFReader vtkHDFReaderImplementation vtkHDFVersion vtkHDFWriter vtkHDFWriterImplementation vtkHDRReader vtkHandleRepresentation vtkHandleSource vtkHandleWidget vtkHardwarePicker vtkHardwareSelector vtkHardwareWindow vtkHausdorffDistancePointSetFilter vtkHeap vtkHeatmapItem vtkHedgeHog vtkHexagonalPrism vtkHexahedron vtkHiddenLineRemovalPass vtkHierarchicalBinningFilter vtkHierarchicalBoxDataSet vtkHierarchicalBoxDataSetAlgorithm vtkHierarchicalDataExtractDataSets vtkHierarchicalDataExtractLevel vtkHierarchicalDataLevelFilter vtkHierarchicalDataSetGeometryFilter vtkHierarchicalGraphPipeline vtkHierarchicalGraphView vtkHierarchicalPolyDataMapper vtkHigherOrderCurve vtkHigherOrderHexahedron vtkHigherOrderInterpolation vtkHigherOrderQuadrilateral vtkHigherOrderTetra vtkHigherOrderTriangle vtkHigherOrderWedge vtkHighestDensityRegionsStatistics vtkHomogeneousTransform vtkHoudiniPolyDataWriter vtkHoverWidget vtkHull vtkHyperStreamline vtkHyperTree vtkHyperTreeGrid vtkHyperTreeGridAlgorithm vtkHyperTreeGridAxisClip vtkHyperTreeGridAxisCut vtkHyperTreeGridAxisReflection vtkHyperTreeGridCellCenters vtkHyperTreeGridContour vtkHyperTreeGridDepthLimiter vtkHyperTreeGridEntry vtkHyperTreeGridEvaluateCoarse vtkHyperTreeGridExtractGhostCells vtkHyperTreeGridFeatureEdges vtkHyperTreeGridGeometricLocator vtkHyperTreeGridGeometry vtkHyperTreeGridGeometry1DImpl vtkHyperTreeGridGeometry2DImpl vtkHyperTreeGridGeometry3DImpl vtkHyperTreeGridGeometryEntry vtkHyperTreeGridGeometryImpl vtkHyperTreeGridGeometryLevelEntry vtkHyperTreeGridGeometrySmallDimensionsImpl vtkHyperTreeGridGeometryUnlimitedEntry vtkHyperTreeGridGeometryUnlimitedLevelEntry vtkHyperTreeGridGhostCellsGenerator vtkHyperTreeGridGhostCellsGeneratorInternals vtkHyperTreeGridGradient vtkHyperTreeGridIterator vtkHyperTreeGridLevelEntry vtkHyperTreeGridLocator vtkHyperTreeGridMapper vtkHyperTreeGridNonOrientedCursor vtkHyperTreeGridNonOrientedGeometryCursor vtkHyperTreeGridNonOrientedMooreSuperCursor vtkHyperTreeGridNonOrientedMooreSuperCursorLight vtkHyperTreeGridNonOrientedSuperCursor vtkHyperTreeGridNonOrientedSuperCursorLight vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor vtkHyperTreeGridNonOrientedUnlimitedSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight vtkHyperTreeGridOrientedCursor vtkHyperTreeGridOrientedGeometryCursor vtkHyperTreeGridOutlineFilter vtkHyperTreeGridPlaneCutter vtkHyperTreeGridPreConfiguredSource vtkHyperTreeGridProbeFilter vtkHyperTreeGridScales vtkHyperTreeGridSource vtkHyperTreeGridThreshold vtkHyperTreeGridToDualGrid vtkHyperTreeGridToUnstructuredGrid vtkHyperTreeGridVisibleLeavesSize vtkIOCellGrid vtkIOSRenderWindow vtkIOSRenderWindowInteractor vtkIOSSFilesScanner vtkIOSSModel vtkIOSSReader vtkIOSSReaderInternal vtkIOSSWriter vtkIOStream vtkIOStreamFwd vtkISIReader vtkIVExporter vtkIVWriter vtkIcicleView vtkIconGlyphFilter vtkIdFilter vtkIdList vtkIdListCollection vtkIdTypeArray vtkIdentityTransform vtkImageAccumulate vtkImageActor vtkImageActorPointPlacer vtkImageAlgorithm vtkImageAnisotropicDiffusion2D vtkImageAnisotropicDiffusion3D vtkImageAppend vtkImageAppendComponents vtkImageBSplineCoefficients vtkImageBSplineInternals vtkImageBSplineInterpolator vtkImageBlend vtkImageButterworthHighPass vtkImageButterworthLowPass vtkImageCacheFilter vtkImageCanvasSource2D vtkImageCast vtkImageChangeInformation vtkImageCheckerboard vtkImageCityBlockDistance vtkImageClip vtkImageConnectivityFilter vtkImageConnector vtkImageConnectorSeed vtkImageConstantPad vtkImageContinuousDilate3D vtkImageContinuousErode3D vtkImageConvolve vtkImageCorrelation vtkImageCroppingRegionsWidget vtkImageCursor3D vtkImageData vtkImageDataGeometryFilter vtkImageDataLIC2D vtkImageDataOutlineFilter vtkImageDataStreamer vtkImageDataToExplicitStructuredGrid vtkImageDataToHyperTreeGrid vtkImageDataToPointSet vtkImageDataToUniformGrid vtkImageDecomposeFilter vtkImageDifference vtkImageDilateErode3D vtkImageDivergence vtkImageDotProduct vtkImageEllipsoidSource vtkImageEuclideanDistance vtkImageEuclideanToPolar vtkImageExport vtkImageExtractComponents vtkImageFFT vtkImageFlip vtkImageFourierCenter vtkImageFourierFilter vtkImageGaussianSmooth vtkImageGaussianSource vtkImageGradient vtkImageGradientMagnitude vtkImageGridSource vtkImageHSIToRGB vtkImageHSVToRGB vtkImageHistogram vtkImageHistogramStatistics vtkImageHybridMedian2D vtkImageIdealHighPass vtkImageIdealLowPass vtkImageImport vtkImageImportExecutive vtkImageInPlaceFilter vtkImageInterpolator vtkImageIslandRemoval2D vtkImageItem vtkImageIterateFilter vtkImageIterator vtkImageLaplacian vtkImageLogarithmicScale vtkImageLogic vtkImageLuminance vtkImageMagnify vtkImageMagnitude vtkImageMandelbrotSource vtkImageMapToColors vtkImageMapToRGBA vtkImageMapToWindowLevelColors vtkImageMapper vtkImageMapper3D vtkImageMarchingCubes vtkImageMask vtkImageMaskBits vtkImageMathematics vtkImageMedian3D vtkImageMirrorPad vtkImageNoiseSource vtkImageNonMaximumSuppression vtkImageNormalize vtkImageOpenClose3D vtkImageOrthoPlanes vtkImagePadFilter vtkImagePermute vtkImagePlaneWidget vtkImagePointDataIterator vtkImagePointIterator vtkImageProbeFilter vtkImageProcessingPass vtkImageProgressIterator vtkImageProperty vtkImageQuantizeRGBToIndex vtkImageRFFT vtkImageRGBToHSI vtkImageRGBToHSV vtkImageRGBToXYZ vtkImageRGBToYIQ vtkImageRange3D vtkImageReader vtkImageReader2 vtkImageReader2Collection vtkImageReader2Factory vtkImageRectilinearWipe vtkImageRenderManager vtkImageResample vtkImageResize vtkImageReslice vtkImageResliceMapper vtkImageResliceToColors vtkImageSSIM vtkImageSeedConnectivity vtkImageSeparableConvolution vtkImageShiftScale vtkImageShrink3D vtkImageSincInterpolator vtkImageSinusoidSource vtkImageSkeleton2D vtkImageSlab vtkImageSlabReslice vtkImageSlice vtkImageSliceCollection vtkImageSliceMapper vtkImageSobel2D vtkImageSobel3D vtkImageSpatialAlgorithm vtkImageStack vtkImageStencil vtkImageStencilAlgorithm vtkImageStencilData vtkImageStencilIterator vtkImageStencilRaster vtkImageStencilSource vtkImageStencilToImage vtkImageThreshold vtkImageThresholdConnectivity vtkImageToAMR vtkImageToImageStencil vtkImageToPoints vtkImageToPolyDataFilter vtkImageToStructuredGrid vtkImageToStructuredPoints vtkImageTracerWidget vtkImageTransform vtkImageTranslateExtent vtkImageVariance3D vtkImageViewer vtkImageViewer2 vtkImageWeightedSum vtkImageWrapPad vtkImageWriter vtkImageXYZToLAB vtkImageYIQToRGB vtkImplicitArray vtkImplicitBoolean vtkImplicitCylinderRepresentation vtkImplicitCylinderWidget vtkImplicitDataSet vtkImplicitFunction vtkImplicitFunctionCollection vtkImplicitFunctionToImageStencil vtkImplicitHalo vtkImplicitImageRepresentation vtkImplicitModeller vtkImplicitPlaneRepresentation vtkImplicitPlaneWidget vtkImplicitPlaneWidget2 vtkImplicitPolyDataDistance vtkImplicitProjectOnPlaneDistance vtkImplicitSelectionLoop vtkImplicitSum vtkImplicitTextureCoords vtkImplicitVolume vtkImplicitWindowFunction vtkImporter vtkImprintFilter vtkInEdgeIterator vtkIncrementalForceLayout vtkIncrementalOctreeNode vtkIncrementalOctreePointLocator vtkIncrementalPointLocator vtkIndent vtkIndexedImplicitBackend vtkInformation vtkInformationDataObjectKey vtkInformationDataObjectMetaDataKey vtkInformationDoubleKey vtkInformationDoubleVectorKey vtkInformationExecutivePortKey vtkInformationExecutivePortVectorKey vtkInformationIdTypeKey vtkInformationInformationKey vtkInformationInformationVectorKey vtkInformationIntegerKey vtkInformationIntegerPointerKey vtkInformationIntegerRequestKey vtkInformationIntegerVectorKey vtkInformationInternals vtkInformationIterator vtkInformationKey vtkInformationKeyLookup vtkInformationKeyVectorKey vtkInformationObjectBaseKey vtkInformationObjectBaseVectorKey vtkInformationQuadratureSchemeDefinitionVectorKey vtkInformationRequestKey vtkInformationStringKey vtkInformationStringVectorKey vtkInformationUnsignedLongKey vtkInformationVariantKey vtkInformationVariantVectorKey vtkInformationVector vtkInitialValueProblemSolver vtkInputStream vtkIntArray vtkIntegrateAttributes vtkInteractiveArea vtkInteractorEventRecorder vtkInteractorObserver vtkInteractorStyle vtkInteractorStyle3D vtkInteractorStyleAreaSelectHover vtkInteractorStyleDrawPolygon vtkInteractorStyleFlight vtkInteractorStyleImage vtkInteractorStyleJoystickActor vtkInteractorStyleJoystickCamera vtkInteractorStyleMultiTouchCamera vtkInteractorStyleRubberBand2D vtkInteractorStyleRubberBand3D vtkInteractorStyleRubberBandPick vtkInteractorStyleRubberBandZoom vtkInteractorStyleSwitch vtkInteractorStyleSwitchBase vtkInteractorStyleTerrain vtkInteractorStyleTrackball vtkInteractorStyleTrackballActor vtkInteractorStyleTrackballCamera vtkInteractorStyleTreeMapHover vtkInteractorStyleUnicam vtkInteractorStyleUser vtkInterpolateCalculator vtkInterpolateDataSetAttributes vtkInterpolatingSubdivisionFilter vtkInterpolationKernel vtkInterpolatorInternals vtkIntersectionCounter vtkIntersectionPolyDataFilter vtkIterativeClosestPointTransform vtkJPEGReader vtkJPEGWriter vtkJSONDataSetWriter vtkJSONImageWriter vtkJSONRenderWindowExporter vtkJSONSceneExporter vtkJavaScriptDataWriter vtkJoinTables vtkKCoreDecomposition vtkKCoreLayout vtkKMeansAssessFunctor vtkKMeansDistanceFunctor vtkKMeansDistanceFunctorCalculator vtkKMeansStatistics vtkKdNode vtkKdTree vtkKdTreePointLocator vtkKdTreeSelector vtkKochanekSpline vtkLASRasterReader vtkLASReader vtkLICNoiseHelper vtkLICRandomNoise2D vtkLICRandomNumberGeneratorInterface vtkLODActor vtkLODProp3D vtkLSDynaPart vtkLSDynaPartCollection vtkLSDynaReader vtkLSDynaSummaryParser vtkLZ4DataCompressor vtkLZMADataCompressor vtkLabelHierarchy vtkLabelHierarchyAlgorithm vtkLabelHierarchyCompositeIterator vtkLabelHierarchyIterator vtkLabelPlacementMapper vtkLabelPlacer vtkLabelRenderStrategy vtkLabelSizeCalculator vtkLabeledContourMapper vtkLabeledContourPolyDataItem vtkLabeledDataMapper vtkLabeledTreeMapDataMapper vtkLagrangeCurve vtkLagrangeHexahedron vtkLagrangeInterpolation vtkLagrangeQuadrilateral vtkLagrangeTetra vtkLagrangeTriangle vtkLagrangeWedge vtkLagrangianBasicIntegrationModel vtkLagrangianMatidaIntegrationModel vtkLagrangianParticle vtkLagrangianParticleTracker vtkLandmarkTransform vtkLargeInteger vtkLassoStencilSource vtkLeaderActor2D vtkLegacyReaderVersion vtkLegendBoxActor vtkLegendScaleActor vtkLengthDistribution vtkLevelIdScalars vtkLight vtkLightActor vtkLightCollection vtkLightKit vtkLightNode vtkLightRepresentation vtkLightWidget vtkLightingMapPass vtkLightsPass vtkLine vtkLineIntegralConvolution2D vtkLineRepresentation vtkLineSource vtkLineWidget vtkLineWidget2 vtkLinearCellExtrusionFilter vtkLinearContourLineInterpolator vtkLinearExtrusionFilter vtkLinearKernel vtkLinearSelector vtkLinearSubdivisionFilter vtkLinearToQuadraticCellsFilter vtkLinearTransform vtkLinearTransformCellLocator vtkLinkEdgels vtkLocationSelector vtkLocator vtkLogLookupTable vtkLogger vtkLogoRepresentation vtkLogoWidget vtkLongArray vtkLongLongArray vtkLookupTable vtkLookupTableItem vtkLookupTableWithEnabling vtkLoopBooleanPolyDataFilter vtkLoopSubdivisionFilter vtkMCubesReader vtkMCubesWriter vtkMFCWindow vtkMFIXReader vtkMINCImageAttributes vtkMINCImageReader vtkMINCImageWriter vtkMNIObjectReader vtkMNIObjectWriter vtkMNITagPointReader vtkMNITagPointWriter vtkMNITransformReader vtkMNITransformWriter vtkMP4Writer vtkMPASReader vtkMPI4PyCommunicator vtkMPICommunicator vtkMPIController vtkMPIEventLog vtkMPIImageReader vtkMPIMultiBlockPLOT3DReader vtkMPIPixelTT vtkMPIPixelView vtkMRCReader vtkMagnifierRepresentation vtkMagnifierWidget vtkMapArrayValues vtkMapMaskTextureId vtkMappedDataArray vtkMappedUnstructuredGrid vtkMappedUnstructuredGridCellIterator vtkMapper vtkMapper2D vtkMapperCollection vtkMapperNode vtkMarchingContourFilter vtkMarchingCubes vtkMarchingSquares vtkMarkBoundaryFilter vtkMarkerUtilities vtkMarshalContext vtkMaskFields vtkMaskPoints vtkMaskPointsFilter vtkMaskPolyData vtkMassProperties vtkMath vtkMathPrivate vtkMathTextFreeTypeTextRenderer vtkMathTextUtilities vtkMathTextUtilitiesCleanup vtkMathUtilities vtkMatplotlibMathTextUtilities vtkMatricizeArray vtkMatrix3x3 vtkMatrix4x4 vtkMatrixMathFilter vtkMatrixToHomogeneousTransform vtkMatrixToLinearTransform vtkMeanValueCoordinatesInterpolator vtkMeasurementCubeHandleRepresentation3D vtkMedicalImageProperties vtkMedicalImageReader2 vtkMemkindRAII vtkMemoryLimitImageDataStreamer vtkMemoryResourceStream vtkMergeArrays vtkMergeCells vtkMergeColumns vtkMergeDataObjectFilter vtkMergeFields vtkMergeFilter vtkMergeGraphs vtkMergePoints vtkMergeTables vtkMergeTimeFilter vtkMergeVectorComponents vtkMersenneTwister vtkMeshQuality vtkMetaImageReader vtkMetaImageWriter vtkMinimalStandardRandomSequence vtkModelMetadata vtkModifiedBSPTree vtkMolecule vtkMoleculeAlgorithm vtkMoleculeAppend vtkMoleculeMapper vtkMoleculeReaderBase vtkMoleculeToAtomBallFilter vtkMoleculeToBondStickFilter vtkMoleculeToLinesFilter vtkMoleculeToPolyDataFilter vtkMotionFXCFGReader vtkMultiBlockDataGroupFilter vtkMultiBlockDataSet vtkMultiBlockDataSetAlgorithm vtkMultiBlockMergeFilter vtkMultiBlockPLOT3DReader vtkMultiBlockPLOT3DReaderRecord vtkMultiBlockUnstructuredGridVolumeMapper vtkMultiBlockVolumeMapper vtkMultiCorrelativeAssessFunctor vtkMultiCorrelativeStatistics vtkMultiNewickTreeReader vtkMultiObjectMassProperties vtkMultiPieceDataSet vtkMultiProcessController vtkMultiProcessStream vtkMultiThreader vtkMultiThreshold vtkMultiTimeStepAlgorithm vtkMultiVolume vtkMutableDirectedGraph vtkMutableGraphHelper vtkMutableUndirectedGraph vtkMySQLDatabase vtkMySQLDatabasePrivate vtkMySQLQuery vtkMySQLToTableReader vtkNIFTIImageHeader vtkNIFTIImageReader vtkNIFTIImageWriter vtkNativePartitioningStrategy vtkNeighborCells vtkNek5000Reader vtkNetCDFCAMReader vtkNetCDFCFReader vtkNetCDFCFWriter vtkNetCDFPOPReader vtkNetCDFReader vtkNetCDFUGRIDReader vtkNetCDFUGRIDeader vtkNetworkHierarchy vtkNew vtkNewickTreeReader vtkNewickTreeWriter vtkNonLinearCell vtkNonMergingPointLocator vtkNonOverlappingAMR vtkNonOverlappingAMRAlgorithm vtkNonOverlappingAMRLevelIdScalars vtkNormalizeMatrixVectors vtkNrrdReader vtkNumberToString vtkOBBDicer vtkOBBNode vtkOBBTree vtkOBJExporter vtkOBJImporter vtkOBJPolyDataProcessor vtkOBJReader vtkOBJWriter vtkOCCTReader vtkODBCDatabase vtkODBCInternals vtkODBCQuery vtkOMETIFFReader vtkOMFReader vtkOOGLExporter vtkOSOpenGLRenderWindow vtkOSPRayAMRVolumeMapperNode vtkOSPRayActorNode vtkOSPRayCache vtkOSPRayCacheItemObject vtkOSPRayCameraNode vtkOSPRayCompositePolyDataMapper2Node vtkOSPRayCompositePolyDataMapperNode vtkOSPRayLightNode vtkOSPRayMaterialHelpers vtkOSPRayMaterialLibrary vtkOSPRayMoleculeMapperNode vtkOSPRayPass vtkOSPRayPointGaussianMapperNode vtkOSPRayPolyDataMapperNode vtkOSPRayRendererNode vtkOSPRayTestInteractor vtkOSPRayUnstructuredVolumeMapperNode vtkOSPRayViewNodeFactory vtkOSPRayVolumeInterface vtkOSPRayVolumeMapper vtkOSPRayVolumeMapperNode vtkOSPRayVolumeNode vtkOSPRayWindowNode vtkOStrStreamWrapper vtkOStreamWrapper vtkOTDensityMap vtkOTFilter vtkOTKernelSmoothing vtkOTScatterPlotMatrix vtkOTUtilities vtkObject vtkObjectBase vtkObjectFactory vtkObjectFactoryCollection vtkObjectFactoryRegistryCleanup vtkObjectIdMap vtkObserverMediator vtkOctreeImageToPointSetFilter vtkOctreePointLocator vtkOctreePointLocatorNode vtkOggTheoraWriter vtkOldStyleCallbackCommand vtkOpaquePass vtkOpenFOAMReader vtkOpenGL2ContextDevice2DCellArrayHelper vtkOpenGL2ContextDevice2DPrivate vtkOpenGLActor vtkOpenGLArrayTextureBufferAdapter vtkOpenGLAvatar vtkOpenGLBatchedPolyDataMapper vtkOpenGLBillboardTextActor3D vtkOpenGLBufferObject vtkOpenGLCamera vtkOpenGLCellGridMapper vtkOpenGLCellToVTKCellMap vtkOpenGLCompositePolyDataMapperDelegator vtkOpenGLContextActor vtkOpenGLContextBufferId vtkOpenGLContextDevice2D vtkOpenGLContextDevice3D vtkOpenGLContextDeviceBufferObjectBuilder vtkOpenGLES30PolyDataMapper2D vtkOpenGLFXAAFilter vtkOpenGLFXAAPass vtkOpenGLFluidMapper vtkOpenGLFramebufferObject vtkOpenGLGL2PSExporter vtkOpenGLGL2PSHelper vtkOpenGLGL2PSHelperImpl vtkOpenGLGPUVolumeRayCastMapper vtkOpenGLGlyph3DHelper vtkOpenGLGlyph3DMapper vtkOpenGLHardwareSelector vtkOpenGLHelper vtkOpenGLHyperTreeGridMapper vtkOpenGLImageAlgorithmCallback vtkOpenGLImageAlgorithmHelper vtkOpenGLImageGradient vtkOpenGLImageMapper vtkOpenGLImageSliceMapper vtkOpenGLIndexBufferObject vtkOpenGLInstanceCulling vtkOpenGLLabeledContourMapper vtkOpenGLLight vtkOpenGLLowMemoryBatchedPolyDataMapper vtkOpenGLLowMemoryCellTypeAgent vtkOpenGLLowMemoryLinesAgent vtkOpenGLLowMemoryPolyDataMapper vtkOpenGLLowMemoryPolygonsAgent vtkOpenGLLowMemoryStripsAgent vtkOpenGLLowMemoryVerticesAgent vtkOpenGLMoleculeMapper vtkOpenGLMovieSphere vtkOpenGLPointGaussianMapper vtkOpenGLPointGaussianMapperHelper vtkOpenGLPolyDataMapper vtkOpenGLPolyDataMapper2D vtkOpenGLProjectedTetrahedraMapper vtkOpenGLPropItem vtkOpenGLProperty vtkOpenGLQuadHelper vtkOpenGLRayCastImageDisplayHelper vtkOpenGLRenderPass vtkOpenGLRenderTimer vtkOpenGLRenderTimerLog vtkOpenGLRenderUtilities vtkOpenGLRenderWindow vtkOpenGLRenderer vtkOpenGLResourceFreeCallback vtkOpenGLShaderCache vtkOpenGLShaderDeclaration vtkOpenGLShaderProperty vtkOpenGLSkybox vtkOpenGLSphereMapper vtkOpenGLState vtkOpenGLStickMapper vtkOpenGLTextActor vtkOpenGLTextActor3D vtkOpenGLTextMapper vtkOpenGLTexture vtkOpenGLUniforms vtkOpenGLVertexArrayObject vtkOpenGLVertexBufferObject vtkOpenGLVertexBufferObjectCache vtkOpenGLVertexBufferObjectGroup vtkOpenGLVolumeGradientOpacityTable vtkOpenGLVolumeLookupTable vtkOpenGLVolumeLookupTables vtkOpenGLVolumeMaskGradientOpacityTransferFunction2D vtkOpenGLVolumeMaskTransferFunction2D vtkOpenGLVolumeOpacityTable vtkOpenGLVolumeRGBTable vtkOpenGLVolumeTransferFunction2D vtkOpenQubeElectronicData vtkOpenQubeMoleculeSource vtkOpenSlideReader vtkOpenVDBReader vtkOpenVDBWriter vtkOpenVRCamera vtkOpenVRCameraPose vtkOpenVRControlsHelper vtkOpenVRDefaultOverlay vtkOpenVRInteractorStyle vtkOpenVRModel vtkOpenVROverlay vtkOpenVROverlaySpot vtkOpenVRRenderWindow vtkOpenVRRenderWindowInteractor vtkOpenVRRenderer vtkOpenXRCamera vtkOpenXRControlsHelper vtkOpenXRInteractorStyle vtkOpenXRManager vtkOpenXRManagerConnection vtkOpenXRManagerD3DGraphics vtkOpenXRManagerGraphics vtkOpenXRManagerOpenGLGraphics vtkOpenXRManagerRemoteConnection vtkOpenXRModel vtkOpenXRRemotingRenderWindow vtkOpenXRRenderWindow vtkOpenXRRenderWindowInteractor vtkOpenXRRenderer vtkOpenXRUtilities vtkOrderIndependentTranslucentPass vtkOrderStatistics vtkOrderedTriangulator vtkOrientPolyData vtkOrientationMarkerWidget vtkOrientationRepresentation vtkOrientationWidget vtkOrientedGlyphContourRepresentation vtkOrientedGlyphFocalPlaneContourRepresentation vtkOrientedPolygonalHandleRepresentation3D vtkOutEdgeIterator vtkOutlineCornerFilter vtkOutlineCornerSource vtkOutlineFilter vtkOutlineGlowPass vtkOutlineSource vtkOutputStream vtkOutputWindow vtkOutputWindowCleanup vtkOverlappingAMR vtkOverlappingAMRAlgorithm vtkOverlappingAMRLevelIdScalars vtkOverlappingCellsDetector vtkOverlayPass vtkOverrideInformation vtkOverrideInformationCollection vtkPAutoCorrelativeStatistics vtkPBRIrradianceTexture vtkPBRLUTTexture vtkPBRPrefilterTexture vtkPBivariateLinearTableThreshold vtkPCAAnalysisFilter vtkPCACurvatureEstimation vtkPCANormalEstimation vtkPCAStatistics vtkPCellDataToPointData vtkPCellSizeFilter vtkPChacoReader vtkPComputeHistogram2DOutliers vtkPComputeQuantiles vtkPComputeQuartiles vtkPConnectivityFilter vtkPContingencyStatistics vtkPConvertToMultiBlockDataSet vtkPCorrelativeStatistics vtkPDALReader vtkPDBReader vtkPDFContextDevice2D vtkPDFExporter vtkPDataSetReader vtkPDataSetWriter vtkPDescriptiveStatistics vtkPDirectory vtkPDistributedDataFilter vtkPExodusIIReader vtkPExodusIIWriter vtkPExtractDataArraysOverTime vtkPExtractExodusGlobalTemporalVariables vtkPExtractGrid vtkPExtractHistogram2D vtkPExtractRectilinearGrid vtkPExtractSelectedArraysOverTime vtkPExtractVOI vtkPHardwareSelector vtkPHyperTreeGridProbeFilter vtkPIOReader vtkPImageWriter vtkPKMeansStatisitcs vtkPKMeansStatistics vtkPKdTree vtkPLSDynaReader vtkPLYReader vtkPLYWriter vtkPLagrangianParticleTracker vtkPLineIntegralConvolution2D vtkPLinearExtrusionFilter vtkPMaskPoints vtkPMergeArrays vtkPMultiCorrelativeStatistics vtkPNGReader vtkPNGWriter vtkPNMReader vtkPNMWriter vtkPNetCDFPOPReader vtkPNrrdReader vtkPOVExporter vtkPOpenFOAMReader vtkPOrderStatistics vtkPOutlineCornerFilter vtkPOutlineFilter vtkPOutlineFilterInternals vtkPPCAStatistics vtkPPainterCommunicator vtkPPairwiseExtractHistogram2D vtkPParticlePathFilter vtkPParticleTracer vtkPParticleTracerBase vtkPPixelTransfer vtkPPolyDataNormals vtkPProbeFilter vtkPProjectSphereFilter vtkPReflectionFilter vtkPResampleFilter vtkPResampleToImage vtkPResampleWithDataSet vtkPSLACReader vtkPSimpleBondPerceiver vtkPSphereSource vtkPStreaklineFilter vtkPStreamTracer vtkPStructuredGridConnectivity vtkPSurfaceLICComposite vtkPSurfaceLICInterface vtkPSystemTools vtkPTSReader vtkPTextureMapToSphere vtkPVWebGLExporter vtkPWindBladeReader vtkPXdmf3Writer vtkPYoungsMaterialInterface vtkPackLabels vtkPainterCommunicator vtkPairwiseExtractHistogram2D vtkPanoramicProjectionPass vtkParallelAMRUtilities vtkParallelCoordinatesActor vtkParallelCoordinatesHistogramRepresentation vtkParallelCoordinatesInteractorStyle vtkParallelCoordinatesRepresentation vtkParallelCoordinatesView vtkParallelReader vtkParallelRenderManager vtkParallelTimer vtkParallelVectors vtkParallelopipedRepresentation vtkParallelopipedWidget vtkParametricBohemianDome vtkParametricBour vtkParametricBoy vtkParametricCatalanMinimal vtkParametricConicSpiral vtkParametricCrossCap vtkParametricDini vtkParametricEllipsoid vtkParametricEnneper vtkParametricFigure8Klein vtkParametricFunction vtkParametricFunctionSource vtkParametricHenneberg vtkParametricKlein vtkParametricKuen vtkParametricMobius vtkParametricPluckerConoid vtkParametricPseudosphere vtkParametricRandomHills vtkParametricRoman vtkParametricSpline vtkParametricSuperEllipsoid vtkParametricSuperToroid vtkParametricTorus vtkParticlePathFilter vtkParticleReader vtkParticleTracer vtkParticleTracerBase vtkPartitionBalancer vtkPartitionedArchiver vtkPartitionedDataSet vtkPartitionedDataSetAlgorithm vtkPartitionedDataSetCollection vtkPartitionedDataSetCollectionAlgorithm vtkPartitionedDataSetCollectionSource vtkPartitionedDataSetSource vtkPartitioningStrategy vtkPassArrays vtkPassInputTypeAlgorithm vtkPassSelectedArrays vtkPassThrough vtkPassThroughEdgeStrategy vtkPassThroughLayoutStrategy vtkPath vtkPen vtkPentagonalPrism vtkPeriodicDataArray vtkPeriodicFilter vtkPeriodicTable vtkPerlinNoise vtkPerspectiveTransform vtkPerturbCoincidentVertices vtkPhyloXMLTreeReader vtkPhyloXMLTreeWriter vtkPicker vtkPickingManager vtkPieChartActor vtkPieceRequestFilter vtkPieceScalars vtkPiecewiseControlPointsItem vtkPiecewiseFunction vtkPiecewiseFunctionAlgorithm vtkPiecewiseFunctionItem vtkPiecewiseFunctionShiftScale vtkPiecewisePointHandleItem vtkPipelineGraphSource vtkPipelineSize vtkPixel vtkPixelBufferObject vtkPixelExtent vtkPixelExtentIO vtkPixelTransfer vtkPlane vtkPlaneCollection vtkPlaneCutter vtkPlaneSource vtkPlaneWidget vtkPlanes vtkPlanesIntersection vtkPlatonicSolidSource vtkPlaybackRepresentation vtkPlaybackWidget vtkPlot vtkPlot3D vtkPlot3DMetaReader vtkPlotArea vtkPlotBag vtkPlotBar vtkPlotBarRangeHandlesItem vtkPlotBox vtkPlotFunctionalBag vtkPlotGrid vtkPlotHistogram2D vtkPlotLine vtkPlotLine3D vtkPlotParallelCoordinates vtkPlotPie vtkPlotPoints vtkPlotPoints3D vtkPlotRangeHandlesItem vtkPlotStacked vtkPlotSurface vtkPointCloudFilter vtkPointCloudRepresentation vtkPointCloudWidget vtkPointConnectivityFilter vtkPointData vtkPointDataToCellData vtkPointDensityFilter vtkPointFillPass vtkPointGaussianMapper vtkPointHandleRepresentation2D vtkPointHandleRepresentation3D vtkPointHandleSource vtkPointInterpolator vtkPointInterpolator2D vtkPointLoad vtkPointLocator vtkPointOccupancyFilter vtkPointPicker vtkPointPlacer vtkPointSet vtkPointSetAlgorithm vtkPointSetCellIterator vtkPointSetStreamer vtkPointSetToLabelHierarchy vtkPointSetToMoleculeFilter vtkPointSetToOctreeImageFilter vtkPointSmoothingFilter vtkPointSource vtkPointWidget vtkPoints vtkPoints2D vtkPointsProjectedHull vtkPoissonDiskSampler vtkPolarAxesActor vtkPolarAxesActor2D vtkPolyData vtkPolyDataAlgorithm vtkPolyDataCollection vtkPolyDataConnectivityFilter vtkPolyDataContourLineInterpolator vtkPolyDataEdgeConnectivityFilter vtkPolyDataInternals vtkPolyDataItem vtkPolyDataMapper2D vtkPolyDataMapperNode vtkPolyDataNormals vtkPolyDataPlaneClipper vtkPolyDataPlaneCutter vtkPolyDataPointPlacer vtkPolyDataPointSampler vtkPolyDataReader vtkPolyDataSilhouette vtkPolyDataSourceWidget vtkPolyDataStreamer vtkPolyDataTangents vtkPolyDataToImageStencil vtkPolyDataToReebGraphFilter vtkPolyDataToUnstructuredGrid vtkPolyDataWriter vtkPolyLine vtkPolyLineRepresentation vtkPolyLineSource vtkPolyLineWidget vtkPolyPlane vtkPolyPointSource vtkPolyVertex vtkPolygon vtkPolygonBuilder vtkPolygonalHandleRepresentation3D vtkPolygonalSurfaceContourLineInterpolator vtkPolygonalSurfacePointPlacer vtkPolyhedron vtkPolyhedronUtilities vtkPolynomialSolversUnivariate vtkPostScriptWriter vtkPostgreSQLDatabase vtkPostgreSQLDatabasePrivate vtkPostgreSQLQuery vtkPostgreSQLToTableReader vtkPriorityQueue vtkProStarReader vtkProbabilisticVoronoiKernel vtkProbeFilter vtkProbeLineFilter vtkProbePolyhedron vtkProbeSelectedLocations vtkProcess vtkProcessGroup vtkProcessIdScalars vtkProcrustesAlignmentFilter vtkProgrammableAttributeDataFilter vtkProgrammableDataObjectSource vtkProgrammableElectronicData vtkProgrammableFilter vtkProgrammableGlyphFilter vtkProgrammableSource vtkProgressBarRepresentation vtkProgressBarWidget vtkProgressObserver vtkProjectPointsToPlane vtkProjectSphereFilter vtkProjectedTerrainPath vtkProjectedTetrahedraMapper vtkProjectedTexture vtkProp vtkProp3D vtkProp3DAxisFollower vtkProp3DButtonRepresentation vtkProp3DCollection vtkProp3DFollower vtkPropAssembly vtkPropCollection vtkPropItem vtkPropPicker vtkProperty vtkProperty2D vtkProteinRibbonFilter vtkPruneTreeFilter vtkPyramid vtkPythonAlgorithm vtkPythonArchiver vtkPythonItem vtkQImageToImageSource vtkQWidgetRepresentation vtkQWidgetTexture vtkQWidgetWidget vtkQtAbstractModelAdapter vtkQtAnnotationLayersModelAdapter vtkQtAnnotationView vtkQtConnection vtkQtDebugLeaksModel vtkQtDebugLeaksView vtkQtInitialization vtkQtLabelRenderStrategy vtkQtListView vtkQtRecordView vtkQtSQLDatabase vtkQtSQLQuery vtkQtStringToImage vtkQtTableModelAdapter vtkQtTableRepresentation vtkQtTableView vtkQtTimePointUtility vtkQtTreeModelAdapter vtkQtTreeRingLabelMapper vtkQtTreeView vtkQtView vtkQuad vtkQuadRotationalExtrusionFilter vtkQuadraticEdge vtkQuadraticHexahedron vtkQuadraticLinearQuad vtkQuadraticLinearWedge vtkQuadraticPolygon vtkQuadraticPyramid vtkQuadraticQuad vtkQuadraticTetra vtkQuadraticTriangle vtkQuadraticWedge vtkQuadraturePointInterpolator vtkQuadraturePointsGenerator vtkQuadratureSchemeDefinition vtkQuadratureSchemeDictionaryGenerator vtkQuadric vtkQuadricClustering vtkQuadricDecimation vtkQuadricLODActor vtkQuantizePolyDataPoints vtkQuaternion vtkQuaternionInterpolator vtkQuaterniond vtkQuaternionf vtkRIBExporter vtkRIBLight vtkRIBProperty vtkRISReader vtkROIStencilSource vtkRTAnalyticSource vtkRTXMLPolyDataReader vtkRadialGridActor2D vtkRadiusOutlierRemoval vtkRandomAttributeGenerator vtkRandomGraphSource vtkRandomHyperTreeGridSource vtkRandomLayoutStrategy vtkRandomPool vtkRandomSequence vtkRangeHandlesItem vtkRasterReprojectionFilter vtkRayCastImageDisplayHelper vtkRayCastStructures vtkReaderAlgorithm vtkRearrangeFields vtkRecoverGeometryWireframe vtkRect vtkRectangularButtonSource vtkRectd vtkRectf vtkRecti vtkRectilinearGrid vtkRectilinearGridAlgorithm vtkRectilinearGridClip vtkRectilinearGridGeometryFilter vtkRectilinearGridOutlineFilter vtkRectilinearGridPartitioner vtkRectilinearGridReader vtkRectilinearGridToPointSet vtkRectilinearGridToTetrahedra vtkRectilinearGridWriter vtkRectilinearSynchronizedTemplates vtkRectilinearWipeRepresentation vtkRectilinearWipeWidget vtkRecursiveDividingCubes vtkRecursiveSphereDirectionEncoder vtkRedistributeDataSetFilter vtkReduceTable vtkReebGraph vtkReebGraphSimplificationFilter vtkReebGraphSimplificationMetric vtkReebGraphSurfaceSkeletonFilter vtkReebGraphToJoinSplitTreeFilter vtkReebGraphVolumeSkeletonFilter vtkReferenceCount vtkReflectionFilter vtkRegularPolygonSource vtkRemoteInteractionAdapter vtkRemoveDuplicatePolys vtkRemoveGhosts vtkRemoveHiddenData vtkRemoveIsolatedVertices vtkRemovePolyData vtkRemoveUnusedPoints vtkRenderLargeImage vtkRenderPass vtkRenderPassCollection vtkRenderState vtkRenderStepsPass vtkRenderTimerLog vtkRenderView vtkRenderViewBase vtkRenderWidget vtkRenderWindowCollection vtkRenderWindowInteractor3D vtkRenderbuffer vtkRenderedAreaPicker vtkRenderedGraphRepresentation vtkRenderedHierarchyRepresentation vtkRenderedRepresentation vtkRenderedSurfaceRepresentation vtkRenderedTreeAreaRepresentation vtkRendererCollection vtkRendererDelegate vtkRendererNode vtkRendererSource vtkRenderingCellGrid vtkResampleToImage vtkResampleWithDataSet vtkReservoirSampler vtkReservoirSamplerBase vtkResizingWindowToImageFilter vtkResliceCursor vtkResliceCursorActor vtkResliceCursorLineRepresentation vtkResliceCursorPicker vtkResliceCursorPolyDataAlgorithm vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation vtkResliceCursorWidget vtkResliceImageViewer vtkResliceImageViewerMeasurements vtkResourceFileLocator vtkResourceParser vtkResourceStream vtkReverseSense vtkRibbonFilter vtkRotationFilter vtkRotationalExtrusionFilter vtkRowQuery vtkRowQueryToTable vtkRuledSurfaceFilter vtkRungeKutta2 vtkRungeKutta4 vtkRungeKutta45 vtkSCurveSpline vtkSDL2OpenGL2RenderWindow vtkSDL2OpenGLRenderWindow vtkSDL2RenderWindowInteractor vtkSDL2WebGPURenderWindow vtkSEPReader vtkSILBuilder vtkSLACParticleReader vtkSLACReader vtkSLCReader vtkSMPContourGrid vtkSMPMergePoints vtkSMPMergePolyDataHelper vtkSMPProgressObserver vtkSMPThreadLocal vtkSMPThreadLocalAPI vtkSMPThreadLocalImpl vtkSMPThreadLocalImplAbstract vtkSMPThreadLocalObject vtkSMPThreadPool vtkSMPTools vtkSMPToolsAPI vtkSMPToolsAPIInitialize vtkSMPToolsImpl vtkSOADataArrayTemplate vtkSPHCubicKernel vtkSPHInterpolator vtkSPHKernel vtkSPHQuarticKernel vtkSPHQuinticKernel vtkSQLDatabase vtkSQLDatabaseGraphSource vtkSQLDatabaseSchema vtkSQLDatabaseTableSource vtkSQLGraphReader vtkSQLQuery vtkSQLiteDatabase vtkSQLiteDatabaseInternals vtkSQLiteQuery vtkSQLiteToTableReader vtkSSAAPass vtkSSAOPass vtkSTLReader vtkSTLWriter vtkSVGContextDevice2D vtkSVGExporter vtkSampleFunction vtkSampleImplicitFunctionFilter vtkScalarBarActor vtkScalarBarActorInternal vtkScalarBarRepresentation vtkScalarBarWidget vtkScalarTree vtkScalarsToColors vtkScalarsToColorsItem vtkScalarsToTextureFilter vtkScaledSOADataArrayTemplate vtkScaledTextActor vtkScatterPlotMatrix vtkScenePicker vtkSectorSource vtkSeedRepresentation vtkSeedWidget vtkSegYBinaryHeaderBytesPositions vtkSegYIOUtils vtkSegYReader vtkSegYReaderInternal vtkSegYTrace vtkSegYTraceHeaderBytesPositions vtkSegYTraceReader vtkSelectEnclosedPoints vtkSelectPolyData vtkSelectVisiblePoints vtkSelection vtkSelectionAlgorithm vtkSelectionNode vtkSelectionSource vtkSelector vtkSequencePass vtkSerializer vtkServerSocket vtkShader vtkShaderProgram vtkShaderProperty vtkShadowMapBakerPass vtkShadowMapPass vtkSharedFuture vtkSharedFutureBase vtkShepardKernel vtkShepardMethod vtkShortArray vtkShrinkFilter vtkShrinkPolyData vtkSignedCharArray vtkSignedDistance vtkSimple2DLayoutStrategy vtkSimple3DCirclesStrategy vtkSimpleBondPerceiver vtkSimpleCellTessellator vtkSimpleElevationFilter vtkSimpleImageToImageFilter vtkSimpleMotionBlurPass vtkSimplePointsReader vtkSimplePointsWriter vtkSimpleReader vtkSimpleScalarTree vtkSingleVTPExporter vtkSkybox vtkSliceAndDiceLayoutStrategy vtkSliceCubes vtkSliderRepresentation vtkSliderRepresentation2D vtkSliderRepresentation3D vtkSliderWidget vtkSmartPointer vtkSmartPointerBase vtkSmartVector vtkSmartVolumeMapper vtkSmoothErrorMetric vtkSmoothPolyDataFilter vtkSobelGradientMagnitudePass vtkSocket vtkSocketCollection vtkSocketCommunicator vtkSocketController vtkSortDataArray vtkSortFieldData vtkSortFileNames vtkSpanSpace vtkSpanTreeLayoutStrategy vtkSparseArray vtkSparseArrayToTable vtkSpatialRepresentationFilter vtkSpatioTemporalHarmonicsAttribute vtkSpatioTemporalHarmonicsSource vtkSphere vtkSphereHandleRepresentation vtkSpherePuzzle vtkSpherePuzzleArrows vtkSphereRepresentation vtkSphereSource vtkSphereTree vtkSphereTreeFilter vtkSphereWidget vtkSphereWidget2 vtkSpheres vtkSphericalDirectionEncoder vtkSphericalHarmonics vtkSphericalPointIterator vtkSphericalTransform vtkSpiderPlotActor vtkSpline vtkSplineFilter vtkSplineGraphEdges vtkSplineRepresentation vtkSplineWidget vtkSplineWidget2 vtkSplitByCellScalarFilter vtkSplitColumnComponents vtkSplitField vtkSplitSharpEdgesPolyData vtkSquarifyLayoutStrategy vtkStackedTreeLayoutStrategy vtkStateStorage vtkStaticCellLinks vtkStaticCellLinksTemplate vtkStaticCellLocator vtkStaticCleanPolyData vtkStaticCleanUnstructuredGrid vtkStaticCompositeSource vtkStaticDataSource vtkStaticEdgeLocatorTemplate vtkStaticFaceHashLinksTemplate vtkStaticPointLocator vtkStaticPointLocator2D vtkStatisticalOutlierRemoval vtkStatisticsAlgorithm vtkStatisticsAlgorithmPrivate vtkStdString vtkStereoCompositor vtkStitchImageDataWithGhosts vtkStrahlerMetric vtkStreaklineFilter vtkStreamGraph vtkStreamSurface vtkStreamTracer vtkStreamerBase vtkStreamingDemandDrivenPipeline vtkStreamingStatistics vtkStreamingTessellator vtkStringArray vtkStringOutputWindow vtkStringToCategory vtkStringToImage vtkStringToNumeric vtkStringToken vtkStripper vtkStructuredAMRGridConnectivity vtkStructuredAMRNeighbor vtkStructuredCellArray vtkStructuredData vtkStructuredDataPlaneCutter vtkStructuredExtent vtkStructuredGrid vtkStructuredGridAlgorithm vtkStructuredGridAppend vtkStructuredGridClip vtkStructuredGridConnectivity vtkStructuredGridGeometryFilter vtkStructuredGridLIC2D vtkStructuredGridOutlineFilter vtkStructuredGridPartitioner vtkStructuredGridReader vtkStructuredGridWriter vtkStructuredImplicitConnectivity vtkStructuredNeighbor vtkStructuredPointArray vtkStructuredPointBackend vtkStructuredPoints vtkStructuredPointsCollection vtkStructuredPointsGeometryFilter vtkStructuredPointsReader vtkStructuredPointsWriter vtkStructuredTPointBackend vtkSubCommunicator vtkSubGroup vtkSubPixelPositionEdgels vtkSubdivideTetra vtkSubdivisionFilter vtkSuperquadric vtkSuperquadricSource vtkSurfaceLICComposite vtkSurfaceLICHelper vtkSurfaceLICInterface vtkSurfaceLICMapper vtkSurfaceNets2D vtkSurfaceNets3D vtkSurfaceReconstructionFilter vtkSynchronizeTimeFilter vtkSynchronizedRenderWindows vtkSynchronizedRenderers vtkSynchronizedTemplates2D vtkSynchronizedTemplates3D vtkSynchronizedTemplatesCutter3D vtkSystemIncludes vtkTDxInteractorStyle vtkTDxInteractorStyleCamera vtkTDxInteractorStyleSettings vtkTDxMotionEventInfo vtkTDxQtUnixDevices vtkTGAReader vtkTIFFReader vtkTIFFReaderInternal vtkTIFFWriter vtkTRUCHASReader vtkTable vtkTableAlgorithm vtkTableBasedClipCases vtkTableBasedClipDataSet vtkTableFFT vtkTableReader vtkTableToArray vtkTableToDatabaseWriter vtkTableToGraph vtkTableToMySQLWriter vtkTableToPolyData vtkTableToPostgreSQLWriter vtkTableToSQLiteWriter vtkTableToSparseArray vtkTableToStructuredGrid vtkTableToTreeFilter vtkTableWriter vtkTanglegramItem vtkTclCommand vtkTecplotReader vtkTecplotTableReader vtkTemplateAliasMacro vtkTemporalAlgorithm vtkTemporalArrayOperatorFilter vtkTemporalDataSetCache vtkTemporalDelimitedTextReader vtkTemporalFractal vtkTemporalInterpolatedVelocityField vtkTemporalInterpolator vtkTemporalPathLineFilter vtkTemporalShiftScale vtkTemporalSnapToTimeStep vtkTemporalStatistics vtkTensorGlyph vtkTensorPrincipalInvariants vtkTensorProbeRepresentation vtkTensorProbeWidget vtkTensorRepresentation vtkTensorWidget vtkTerrainContourLineInterpolator vtkTerrainDataPointPlacer vtkTessellatedBoxSource vtkTessellatorFilter vtkTestDataArray vtkTestNewVar vtkTetra vtkTextActor vtkTextActor3D vtkTextCodec vtkTextCodecFactory vtkTextMapper vtkTextProperty vtkTextPropertyCollection vtkTextRenderer vtkTextRendererCleanup vtkTextRendererStringToImage vtkTextRepresentation vtkTextSource vtkTextWidget vtkTexture vtkTextureIO vtkTextureImageCache vtkTextureMapToCylinder vtkTextureMapToPlane vtkTextureMapToSphere vtkTextureObject vtkTextureUnitManager vtkTexturedActor2D vtkTexturedButtonRepresentation vtkTexturedButtonRepresentation2D vtkTexturedSphereSource vtkThinPlateSplineTransform vtkThreadedCallbackQueue vtkThreadedCompositeDataPipeline vtkThreadedImageAlgorithm vtkThreadedImageWriter vtkThreadedTaskQueue vtkThreshold vtkThresholdGraph vtkThresholdPoints vtkThresholdTable vtkThresholdTextureCoords vtkTimeInformation vtkTimePointUtility vtkTimeRange vtkTimeSource vtkTimeSourceExample vtkTimeStamp vtkTimerLog vtkTimerLogCleanup vtkTimerLogScope vtkToAffineArrayStrategy vtkToConstantArrayStrategy vtkToImplicitArrayFilter vtkToImplicitRamerDouglasPeuckerStrategy vtkToImplicitStrategy vtkToImplicitTypeErasureStrategy vtkToneMappingPass vtkTooltipItem vtkTransferAttributes vtkTransform vtkTransform2D vtkTransformCollection vtkTransformConcatenation vtkTransformConcatenationStack vtkTransformCoordinateSystems vtkTransformFeedback vtkTransformFilter vtkTransformInterpolator vtkTransformPair vtkTransformPolyDataFilter vtkTransformTextureCoords vtkTransformToGrid vtkTranslucentPass vtkTransmitImageDataPiece vtkTransmitPolyDataPiece vtkTransmitRectilinearGridPiece vtkTransmitStructuredDataPiece vtkTransmitStructuredGridPiece vtkTransmitUnstructuredGridPiece vtkTransposeMatrix vtkTransposeTable vtkTree vtkTreeAlgorithm vtkTreeAreaView vtkTreeBFSIterator vtkTreeCompositer vtkTreeDFSIterator vtkTreeDifferenceFilter vtkTreeFieldAggregator vtkTreeHeatmapItem vtkTreeIterator vtkTreeLayoutStrategy vtkTreeLevelsFilter vtkTreeMapLayout vtkTreeMapLayoutStrategy vtkTreeMapToPolyData vtkTreeMapView vtkTreeOrbitLayoutStrategy vtkTreeReader vtkTreeRingToPolyData vtkTreeRingView vtkTreeWriter vtkTriQuadraticHexahedron vtkTriQuadraticPyramid vtkTriangle vtkTriangleFilter vtkTriangleMeshPointNormals vtkTriangleStrip vtkTriangularTCoords vtkTriangularTexture vtkTrimmedExtrusionFilter vtkTrivialConsumer vtkTrivialProducer vtkTryDowncastHelper1 vtkTryDowncastHelper2 vtkTryDowncastHelper3 vtkTubeBender vtkTubeFilter vtkTulipReader vtkTuple vtkTupleInterpolator vtkTypeList vtkTypedArray vtkTypedDataArray vtkTypedDataArrayIterator vtkURI vtkURIComponent vtkURILoader vtkUTF16TextCodec vtkUTF8TextCodec vtkUncertaintyTubeFilter vtkUndirectedGraph vtkUndirectedGraphAlgorithm vtkUniformGrid vtkUniformGridAMR vtkUniformGridAMRAlgorithm vtkUniformGridAMRDataIterator vtkUniformGridPartitioner vtkUniformHyperTreeGrid vtkUniformHyperTreeGridSource vtkUniforms vtkUnsignedCharArray vtkUnsignedDistance vtkUnsignedIntArray vtkUnsignedLongArray vtkUnsignedLongLongArray vtkUnsignedShortArray vtkUnstructuredGrid vtkUnstructuredGridAlgorithm vtkUnstructuredGridBase vtkUnstructuredGridBaseAlgorithm vtkUnstructuredGridBunykRayCastFunction vtkUnstructuredGridCellIterator vtkUnstructuredGridGeometryFilter vtkUnstructuredGridHomogeneousRayIntegrator vtkUnstructuredGridLinearRayIntegrator vtkUnstructuredGridPartialPreIntegration vtkUnstructuredGridPreIntegration vtkUnstructuredGridQuadricDecimation vtkUnstructuredGridReader vtkUnstructuredGridToCellGrid vtkUnstructuredGridToExplicitStructuredGrid vtkUnstructuredGridToReebGraphFilter vtkUnstructuredGridVolumeMapper vtkUnstructuredGridVolumeRayCastFunction vtkUnstructuredGridVolumeRayCastIterator vtkUnstructuredGridVolumeRayCastMapper vtkUnstructuredGridVolumeRayIntegrator vtkUnstructuredGridVolumeZSweepMapper vtkUnstructuredGridWriter vtkUpdateCellsV8toV9 vtkVASPAnimationReader vtkVASPTessellationReader vtkVPICReader vtkVRCamera vtkVRCollaborationClient vtkVRControlsHelper vtkVRFollower vtkVRHMDCamera vtkVRHardwarePicker vtkVRInteractorStyle vtkVRMLExporter vtkVRMLImporter vtkVRMLUseStruct vtkVRMLYaccData vtkVRMenuRepresentation vtkVRMenuWidget vtkVRModel vtkVRPanelRepresentation vtkVRPanelWidget vtkVRRay vtkVRRenderWindow vtkVRRenderWindowInteractor vtkVRRenderer vtkValuePass vtkValueSelector vtkVariant vtkVariantArray vtkVariantBoostSerialization vtkVariantCast vtkVariantCreate vtkVariantExtract vtkVector vtkVector2 vtkVector2d vtkVector2f vtkVector2i vtkVector3 vtkVector3d vtkVector3f vtkVector3i vtkVector4 vtkVector4d vtkVector4i vtkVectorDot vtkVectorFieldTopology vtkVectorNorm vtkVectorText vtkVeraOutReader vtkVersion vtkVertex vtkVertexAdjacencyList vtkVertexDegree vtkVertexGlyphFilter vtkVertexListIterator vtkVideoSource vtkView vtkViewDependentErrorMetric vtkViewNode vtkViewNodeFactory vtkViewTheme vtkViewUpdater vtkViewport vtkVisibilitySort vtkVoidArray vtkVolume vtkVolume16Reader vtkVolumeCollection vtkVolumeContourSpectrumFilter vtkVolumeInputHelper vtkVolumeMapper vtkVolumeMapperNode vtkVolumeMask vtkVolumeNode vtkVolumeOfRevolutionFilter vtkVolumeOutlineSource vtkVolumePicker vtkVolumeProperty vtkVolumeRayCastSpaceLeapingImageFilter vtkVolumeReader vtkVolumeStateRAII vtkVolumeTexture vtkVolumetricPass vtkVoronoi2D vtkVoronoiKernel vtkVortexCore vtkVoxel vtkVoxelContoursToSurfaceFilter vtkVoxelGrid vtkVoxelModeller vtkVtkJSSceneGraphSerializer vtkVtkJSViewNodeFactory vtkWGPUContext vtkWarpLens vtkWarpScalar vtkWarpTo vtkWarpTransform vtkWarpVector vtkWasmSceneManager vtkWeakPointer vtkWeakPointerBase vtkWeakReference vtkWebApplication vtkWebAssemblyRenderWindowInteractor vtkWebGLDataSet vtkWebGLExporter vtkWebGLObject vtkWebGLPolyData vtkWebGLWidget vtkWebGPUActor vtkWebGPUCamera vtkWebGPUClearPass vtkWebGPUHardwareSelector vtkWebGPUInternalsBindGroup vtkWebGPUInternalsBindGroupLayout vtkWebGPUInternalsBuffer vtkWebGPUInternalsPipelineLayout vtkWebGPUInternalsRenderPassCreateInfo vtkWebGPUInternalsRenderPassDescriptor vtkWebGPUInternalsRenderPipelineDescriptor vtkWebGPUInternalsShaderModule vtkWebGPULight vtkWebGPUPolyDataMapper vtkWebGPUProperty vtkWebGPURenderPass vtkWebGPURenderWindow vtkWebGPURenderer vtkWebInteractionEvent vtkWebUtilities vtkWedge vtkWeightedTransformFilter vtkWendlandQuinticKernel vtkWidgetCallbackMapper vtkWidgetEvent vtkWidgetEventTranslator vtkWidgetRepresentation vtkWidgetSet vtkWin32HardwareWindow vtkWin32Header vtkWin32OpenGL2RenderWindow vtkWin32OpenGLDXRenderWindow vtkWin32OpenGLRenderWindow vtkWin32OutputWindow vtkWin32ProcessOutputWindow vtkWin32RenderWindowInteractor vtkWin32VideoSource vtkWindBladeReader vtkWindow vtkWindowLevelLookupTable vtkWindowNode vtkWindowToImageFilter vtkWindowedSincPolyDataFilter vtkWordCloud vtkWorldPointPicker vtkWrappingHints vtkWriter vtkX3DExporter vtkX3DExporterFIWriter vtkX3DExporterFIWriterHelper vtkX3DExporterWriter vtkX3DExporterXMLWriter vtkXGMLReader vtkXMLCompositeDataReader vtkXMLCompositeDataSetWriterHelper vtkXMLCompositeDataWriter vtkXMLDataElement vtkXMLDataHeader vtkXMLDataHeaderImpl vtkXMLDataObjectWriter vtkXMLDataParser vtkXMLDataReader vtkXMLDataSetWriter vtkXMLDataWriterHelper vtkXMLFileOutputWindow vtkXMLFileReadTester vtkXMLGenericDataObjectReader vtkXMLHierarchicalBoxDataFileConverter vtkXMLHierarchicalBoxDataReader vtkXMLHierarchicalBoxDataWriter vtkXMLHierarchicalDataReader vtkXMLHyperTreeGridReader vtkXMLHyperTreeGridWriter vtkXMLImageDataReader vtkXMLImageDataWriter vtkXMLMultiBlockDataReader vtkXMLMultiBlockDataWriter vtkXMLMultiGroupDataReader vtkXMLPDataObjectReader vtkXMLPDataObjectWriter vtkXMLPDataReader vtkXMLPDataSetWriter vtkXMLPDataWriter vtkXMLPHierarchicalBoxDataWriter vtkXMLPHyperTreeGridReader vtkXMLPHyperTreeGridWriter vtkXMLPImageDataReader vtkXMLPImageDataWriter vtkXMLPMultiBlockDataWriter vtkXMLPPolyDataReader vtkXMLPPolyDataWriter vtkXMLPRectilinearGridReader vtkXMLPRectilinearGridWriter vtkXMLPStructuredDataReader vtkXMLPStructuredDataWriter vtkXMLPStructuredGridReader vtkXMLPStructuredGridWriter vtkXMLPTableReader vtkXMLPTableWriter vtkXMLPUniformGridAMRWriter vtkXMLPUnstructuredDataReader vtkXMLPUnstructuredDataWriter vtkXMLPUnstructuredGridReader vtkXMLPUnstructuredGridWriter vtkXMLParser vtkXMLPartitionedDataSetCollectionReader vtkXMLPartitionedDataSetCollectionWriter vtkXMLPartitionedDataSetReader vtkXMLPartitionedDataSetWriter vtkXMLPolyDataReader vtkXMLPolyDataWriter vtkXMLReader vtkXMLReaderVersion vtkXMLRectilinearGridReader vtkXMLRectilinearGridWriter vtkXMLStructuredDataReader vtkXMLStructuredDataWriter vtkXMLStructuredGridReader vtkXMLStructuredGridWriter vtkXMLTableReader vtkXMLTableWriter vtkXMLTreeReader vtkXMLUniformGridAMRReader vtkXMLUniformGridAMRWriter vtkXMLUnstructuredDataReader vtkXMLUnstructuredDataWriter vtkXMLUnstructuredGridReader vtkXMLUnstructuredGridWriter vtkXMLUtilities vtkXMLWriter vtkXMLWriter2 vtkXMLWriterBase vtkXOpenGLRenderWindow vtkXRenderWindowInteractor vtkXWebGPURenderWindow vtkXYPlotActor vtkXYPlotRepresentation vtkXYPlotWidget vtkXYZMolReader vtkXYZMolReader2 vtkXdmf3ArrayKeeper vtkXdmf3ArraySelection vtkXdmf3DataSet vtkXdmf3HeavyDataHandler vtkXdmf3LightDataHandler vtkXdmf3Reader vtkXdmf3SILBuilder vtkXdmf3Writer vtkXdmfArraySelection vtkXdmfDataArray vtkXdmfDocument vtkXdmfDomain vtkXdmfHeavyData vtkXdmfReader vtkXdmfReaderInternal vtkXdmfWriter vtkYieldCriteria vtkYoungsMaterialInterface vtkZLibDataCompressor vtkZSpaceCamera vtkZSpaceCoreCompatibilitySDKManager vtkZSpaceCoreSDKManager vtkZSpaceGenericRenderWindow vtkZSpaceHardwarePicker vtkZSpaceInteractorStyle vtkZSpaceRayActor vtkZSpaceRenderWindowInteractor vtkZSpaceRenderer vtkZSpaceSDKManager vtkZSpaceWin32RenderWindow vtkmAverageToCells vtkmAverageToPoints vtkmCleanGrid vtkmClip vtkmContour vtkmCoordinateSystemTransform vtkmDataArray vtkmDataSet vtkmExternalFaces vtkmExtractVOI vtkmFilterOverrides vtkmGradient vtkmHistogram vtkmImageConnectivity vtkmLevelOfDetail vtkmNDHistogram vtkmPointElevation vtkmPointTransform vtkmPolyDataNormals vtkmProbe vtkmSlice vtkmThreshold vtkmTriangleMeshPointNormals vtkmWarpScalar vtkmWarpVector"},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesUsed/","title":"VTK Classes used in the Examples","text":""},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesUsed/#pythonicapi","title":"PythonicAPI","text":"

Out of 3113 available VTK classes, 7 are demonstrated here.

"},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesUsed/#excluded-classes","title":"Excluded classes","text":"

These classes are excluded since they occur in the majority of the examples:

VTK Class VTK Class VTK Class vtkActor vtkCamera vtkNamedColors vtkPolyDataMapper vtkProperty vtkRenderer vtkRenderWindow vtkRenderWindowInteractor"},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesUsed/#classes-used","title":"Classes used","text":"VTK Class Examples vtkCylinderSource CylinderExample"},{"location":"PythonicAPI/GeometricObjects/CylinderExample/","title":"CylinderExample","text":"

vtk-examples/PythonicAPI/GeometricObjects/CylinderExample

"},{"location":"PythonicAPI/GeometricObjects/CylinderExample/#description","title":"Description","text":"

This example creates a minimal visualization program, demonstrating VTK's basic rendering and pipeline creation.

Note

This original C++ source code for this example is here.

Note

The code here has not been updated yet to use the new improved VTK Python Interface.

Other languages

See (Cxx), (Python), (Java)

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"PythonicAPI/GeometricObjects/CylinderExample/#code","title":"Code","text":"

CylinderExample.py

#!/usr/bin/env python\n\n# This simple example shows how to do basic rendering and pipeline\n# creation.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkCylinderSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Set the background color.\n    bkg = map(lambda x: x / 255.0, [26, 51, 102, 255])\n    colors.SetColor(\"BkgColor\", *bkg)\n\n    # This creates a polygonal cylinder model with eight circumferential\n    # facets.\n    cylinder = vtkCylinderSource()\n    cylinder.SetResolution(8)\n\n    # The mapper is responsible for pushing the geometry into the graphics\n    # library. It may also do color mapping, if scalars or other\n    # attributes are defined.\n    cylinderMapper = vtkPolyDataMapper()\n    cylinderMapper.SetInputConnection(cylinder.GetOutputPort())\n\n    # The actor is a grouping mechanism: besides the geometry (mapper), it\n    # also has a property, transformation matrix, and/or texture map.\n    # Here we set its color and rotate it -22.5 degrees.\n    cylinderActor = vtkActor()\n    cylinderActor.SetMapper(cylinderMapper)\n    cylinderActor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n    cylinderActor.RotateX(30.0)\n    cylinderActor.RotateY(-45.0)\n\n    # Create the graphics structure. The renderer renders into the render\n    # window. The render window interactor captures mouse events and will\n    # perform appropriate camera or actor manipulation depending on the\n    # nature of the events.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    ren.AddActor(cylinderActor)\n    ren.SetBackground(colors.GetColor3d(\"BkgColor\"))\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('CylinderExample')\n\n    # This allows the interactor to initalize itself. It has to be\n    # called before an event loop.\n    iren.Initialize()\n\n    # We'll zoom in a little by accessing the camera and invoking a \"Zoom\"\n    # method on it.\n    ren.ResetCamera()\n    ren.GetActiveCamera().Zoom(1.5)\n    renWin.Render()\n\n    # Start the event loop.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
"},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/","title":"FiniteElementAnalysis","text":"

vtk-examples/Trame/Applications/FiniteElementAnalysis

"},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#description","title":"Description","text":"

This example is a translation from a dash-vtk code described in that repository using trame.

In trame we are exposing 3 approaches:

  • client view: This application simulate what dash-vtk is doing by defining the 3D scene in plain HTML structure.
  • remote/local view: Those applications focus on the VTK/Python part by creating and configuring your vtkRenderWindow directly and letting the VtkRemoteView or VtkLocalView do their job of presenting it on the client side. In the case of the VtkRemoteView, the rendering is happening on the server side and images are sent to the client. For the VtkLocalView use case, the geometry is sent instead and the client is doing the rendering using vtk.js under the cover.

The data files can be found here in the original project.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#download-and-build-finiteelementanalysis","title":"Download and Build FiniteElementAnalysis","text":"

Click here to download FiniteElementAnalysis. Once the tarball FiniteElementAnalysis.tar has been downloaded and extracted,

cd FiniteElementAnalysis\n

and run the application.

See this trame tutorial for instructions on how to setup trame and run the application.

"},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#code","title":"Code","text":""},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#app_local_viewpy","title":"app_local_view.py","text":"
\"\"\"\nVersion for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/VTK/Applications/FiniteElementAnalysis/app_local_view.py\nDelta v1..v2          - https://github.com/Kitware/trame/commit/03f28bb0084490acabf218264b96a1dbb3a17f19\n\"\"\"\n\nimport os\nimport io\nimport numpy as np\nimport pandas as pd\n\nfrom vtkmodules.vtkCommonCore import vtkPoints, vtkIdList, vtkLookupTable\nfrom vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid, vtkCellArray\nfrom vtkmodules.vtkFiltersCore import vtkThreshold\n\nfrom vtkmodules.numpy_interface.dataset_adapter import numpyTovtkDataArray as np2da\nfrom vtkmodules.util import vtkConstants\n\n# Add import for the rendering\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch  # noqa\nimport vtkmodules.vtkRenderingOpenGL2  # noqa\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n)\n\nfrom trame.app import get_server\nfrom trame.ui.vuetify import SinglePageLayout\nfrom trame.widgets import vuetify, vtk\n\n# -----------------------------------------------------------------------------\n# Trame setup\n# -----------------------------------------------------------------------------\n\nserver = get_server()\nstate, ctrl = server.state, server.controller\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nvtk_idlist = vtkIdList()\nvtk_grid = vtkUnstructuredGrid()\nvtk_filter = vtkThreshold()\nvtk_filter.SetInputData(vtk_grid)\nfield_to_keep = \"my_array\"\n\nrenderer = vtkRenderer()\nrenderer.SetBackground(0.8, 0.8, 0.8)\nrenderWindow = vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n\nrenderWindowInteractor = vtkRenderWindowInteractor()\nrenderWindowInteractor.SetRenderWindow(renderWindow)\nrenderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\nfilter_mapper = vtkDataSetMapper()\nfilter_mapper.SetInputConnection(vtk_filter.GetOutputPort())\nfilter_actor = vtkActor()\nfilter_actor.SetMapper(filter_mapper)\nrenderer.AddActor(filter_actor)\n\nlut = vtkLookupTable()\nlut.SetHueRange(0.667, 0)\nlut.Build()\nfilter_mapper.SetLookupTable(lut)\n\nmesh_mapper = vtkDataSetMapper()\nmesh_mapper.SetInputData(vtk_grid)\nmesh_mapper.SetScalarVisibility(0)\nmesh_actor = vtkActor()\nmesh_actor.SetMapper(mesh_mapper)\nrenderer.AddActor(mesh_actor)\n\n\n@state.change(\"nodes_file\", \"elems_file\", \"field_file\")\ndef update_grid(nodes_file, elems_file, field_file, **kwargs):\n    if not nodes_file:\n        return\n\n    if not elems_file:\n        return\n\n    nodes_bytes = nodes_file.get(\"content\")\n    elems_bytes = elems_file.get(\"content\")\n\n    df_nodes = pd.read_csv(\n        io.StringIO(nodes_bytes.decode(\"utf-8\")),\n        delim_whitespace=True,\n        header=None,\n        skiprows=1,\n        names=[\"id\", \"x\", \"y\", \"z\"],\n    )\n\n    df_nodes[\"id\"] = df_nodes[\"id\"].astype(int)\n    df_nodes = df_nodes.set_index(\"id\", drop=True)\n    # fill missing ids in range as VTK uses position (index) to map cells to points\n    df_nodes = df_nodes.reindex(\n        np.arange(df_nodes.index.min(), df_nodes.index.max() + 1), fill_value=0\n    )\n\n    df_elems = pd.read_csv(\n        io.StringIO(elems_bytes.decode(\"utf-8\")),\n        skiprows=1,\n        header=None,\n        delim_whitespace=True,\n        engine=\"python\",\n        index_col=None,\n    ).sort_values(0)\n    # order: 0: eid, 1: eshape, 2+: nodes, iloc[:,0] is index\n    df_elems.iloc[:, 0] = df_elems.iloc[:, 0].astype(int)\n\n    n_nodes = df_elems.iloc[:, 1].map(\n        lambda x: int(\"\".join(i for i in x if i.isdigit()))\n    )\n    df_elems.insert(2, \"n_nodes\", n_nodes)\n    # fill missing ids in range as VTK uses position (index) to map data to cells\n    new_range = np.arange(df_elems.iloc[:, 0].min(), df_elems.iloc[:, 0].max() + 1)\n    df_elems = df_elems.set_index(0, drop=False).reindex(new_range, fill_value=0)\n\n    # mapping specific to Ansys Mechanical data\n    vtk_shape_id_map = {\n        \"Tet4\": vtkConstants.VTK_TETRA,\n        \"Tet10\": vtkConstants.VTK_QUADRATIC_TETRA,\n        \"Hex8\": vtkConstants.VTK_HEXAHEDRON,\n        \"Hex20\": vtkConstants.VTK_QUADRATIC_HEXAHEDRON,\n        \"Tri6\": vtkConstants.VTK_QUADRATIC_TRIANGLE,\n        \"Quad8\": vtkConstants.VTK_QUADRATIC_QUAD,\n        \"Tri3\": vtkConstants.VTK_TRIANGLE,\n        \"Quad4\": vtkConstants.VTK_QUAD,\n        \"Wed15\": vtkConstants.VTK_QUADRATIC_WEDGE,\n    }\n    df_elems[\"cell_types\"] = np.nan\n    df_elems.loc[df_elems.loc[:, 0] > 0, \"cell_types\"] = df_elems.loc[\n        df_elems.loc[:, 0] > 0, 1\n    ].map(\n        lambda x: vtk_shape_id_map[x.strip()]\n        if x.strip() in vtk_shape_id_map.keys()\n        else np.nan\n    )\n    df_elems = df_elems.dropna(subset=[\"cell_types\"], axis=0)\n\n    # convert dataframes to vtk-desired format\n    points = df_nodes[[\"x\", \"y\", \"z\"]].to_numpy()\n    cell_types = df_elems[\"cell_types\"].to_numpy()\n    n_nodes = df_elems.loc[:, \"n_nodes\"].to_numpy()\n    # subtract starting node id from all grid references in cells to avoid filling from 0 to first used node (in case mesh doesnt start at 1)\n    p = df_elems.iloc[:, 3:-1].to_numpy() - df_nodes.index.min()\n    # if you need to, re-order nodes here-ish\n    a = np.hstack((n_nodes.reshape((len(n_nodes), 1)), p))\n    # convert to flat numpy array\n    cells = a.ravel()\n    # remove nans (due to elements with different no. of nodes)\n    cells = cells[np.logical_not(np.isnan(cells))]\n    cells = cells.astype(int)\n\n    # update grid\n    vtk_pts = vtkPoints()\n    vtk_pts.SetData(np2da(points))\n    vtk_grid.SetPoints(vtk_pts)\n\n    vtk_cells = vtkCellArray()\n    vtk_cells.SetCells(\n        cell_types.shape[0], np2da(cells, array_type=vtkConstants.VTK_ID_TYPE)\n    )\n    vtk_grid.SetCells(\n        np2da(cell_types, array_type=vtkConstants.VTK_UNSIGNED_CHAR), vtk_cells\n    )\n    state.mesh_status = 1\n\n    # Add field if any\n    if field_file:\n        field_bytes = field_file.get(\"content\")\n        df_elem_data = pd.read_csv(\n            io.StringIO(field_bytes.decode(\"utf-8\")),\n            delim_whitespace=True,\n            header=None,\n            skiprows=1,\n            names=[\"id\", \"val\"],\n        )\n        df_elem_data = df_elem_data.sort_values(\"id\").set_index(\"id\", drop=True)\n        # fill missing ids in range as VTK uses position (index) to map data to cells\n        df_elem_data = df_elem_data.reindex(\n            np.arange(df_elems.index.min(), df_elems.index.max() + 1), fill_value=0.0\n        )\n        np_val = df_elem_data[\"val\"].to_numpy()\n        # assign data to grid with the name 'my_array'\n        vtk_array = np2da(np_val, name=field_to_keep)\n        vtk_grid.GetCellData().SetScalars(vtk_array)\n        full_min, full_max = vtk_array.GetRange()\n        state.full_min = full_min\n        state.full_max = full_max\n        state.threshold_range = list(vtk_array.GetRange())\n        state.mesh_status = 2\n\n        # Color handling in plain VTK\n        filter_mapper.SetScalarRange(full_min, full_max)\n\n    renderer.ResetCamera()\n    ctrl.view_update()\n\n\n@state.change(\"threshold_range\")\ndef update_filter(threshold_range, **kwargs):\n    filter_mapper.SetScalarRange(\n        threshold_range\n    )  # Comment if you want to have a fix color range\n    vtk_filter.SetLowerThreshold(threshold_range[0])\n    vtk_filter.SetUpperThreshold(threshold_range[1])\n    ctrl.view_update()\n\n\n@state.change(\"mesh_status\")\ndef update_mesh_representations(**kwargs):\n    # defaults\n    color = [1, 1, 1]\n    representation = 2\n    opacity = 1\n\n    if state.mesh_status == 2:\n        color = [0.3, 0.3, 0.3]\n        representation = 1\n        opacity = 0.2\n\n    property = mesh_actor.GetProperty()\n    property.SetRepresentation(representation)\n    property.SetColor(color)\n    property.SetOpacity(opacity)\n    ctrl.view_update()\n\n\ndef reset():\n    state.update(\n        {\n            \"nodes_file\": None,\n            \"elems_file\": None,\n            \"field_file\": None,\n            \"mesh_status\": 0,\n        }\n    )\n\n\n# -----------------------------------------------------------------------------\n# Web App setup\n# -----------------------------------------------------------------------------\n\nfile_style = {\n    \"dense\": True,\n    \"hide_details\": True,\n    \"style\": \"max-width: 200px\",\n    \"class\": \"mx-2\",\n    \"small_chips\": True,\n    \"clearable\": (\"false\",),\n    \"accept\": \".txt\",\n}\n\nstate.trame__title = \"FEA - Mesh viewer\"\n\nwith SinglePageLayout(server) as layout:\n    layout.icon.click = reset\n    layout.title.set_text(\"Mesh Viewer\")\n\n    # Toolbar ----------------------------------------\n    with layout.toolbar:\n        vuetify.VSpacer()\n        vuetify.VRangeSlider(\n            thumb_size=16,\n            thumb_label=True,\n            label=\"Threshold\",\n            v_if=(\"mesh_status > 1\",),\n            v_model=(\"threshold_range\", [0, 1]),\n            min=(\"full_min\", 0),\n            max=(\"full_max\", 1),\n            dense=True,\n            hide_details=True,\n            style=\"max-width: 400px\",\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 1\",),\n            prepend_icon=\"mdi-vector-triangle\",\n            v_model=(\"nodes_file\", None),\n            placeholder=\"Nodes\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 1\",),\n            prepend_icon=\"mdi-dots-triangle\",\n            v_model=(\"elems_file\", None),\n            placeholder=\"Elements\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 2\",),\n            prepend_icon=\"mdi-gradient\",\n            v_model=(\"field_file\", None),\n            placeholder=\"Field\",\n            **file_style,\n        )\n        with vuetify.VBtn(\n            v_if=(\"mesh_status\",), icon=True, click=ctrl.view_reset_camera\n        ):\n            vuetify.VIcon(\"mdi-crop-free\")\n\n        vuetify.VProgressLinear(\n            indeterminate=True, absolute=True, bottom=True, active=(\"trame__busy\",)\n        )\n\n    # Content ----------------------------------------\n    with layout.content:\n        with vuetify.VContainer(\n            fluid=True,\n            classes=\"pa-0 fill-height\",\n            style=\"position: relative\",\n        ):\n            html_view = vtk.VtkLocalView(renderWindow)\n            ctrl.view_update = html_view.update\n            ctrl.view_reset_camera = html_view.reset_camera\n\n\n# Variables not defined within HTML but used\nstate.mesh_status = 0  # 0: empty / 1: mesh / 2: mesh+filter\n\n# -----------------------------------------------------------------------------\n# Use --data to skip file upload\n# -----------------------------------------------------------------------------\n\nparser = server.cli\nparser.add_argument(\"--data\", help=\"Unstructured file path\", dest=\"data\")\nargs = parser.parse_args()\nif args.data:\n    from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\n\n    reader = vtkXMLUnstructuredGridReader()\n    reader.SetFileName(os.path.abspath(args.data))\n    reader.Update()\n    vtu = reader.GetOutput()\n    vtk_grid.ShallowCopy(vtu)\n\n    vtk_array = vtu.GetCellData().GetScalars()\n    full_min, full_max = vtk_array.GetRange()\n    state.full_min = full_min\n    state.full_max = full_max\n    state.threshold_range = [full_min, full_max]\n    state.mesh_status = 2\n    update_mesh_representations()\n\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    server.start()\n
"},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#code_1","title":"Code","text":""},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#app_remote_viewpy","title":"app_remote_view.py","text":"
\"\"\"\nVersion for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/VTK/Applications/FiniteElementAnalysis/app_remote_view.py\nDelta v1..v2          - https://github.com/Kitware/trame/commit/03f28bb0084490acabf218264b96a1dbb3a17f19\n\"\"\"\n\nimport os\nimport io\nimport numpy as np\nimport pandas as pd\n\nfrom vtkmodules.vtkCommonCore import vtkPoints, vtkIdList, vtkLookupTable\nfrom vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid, vtkCellArray\nfrom vtkmodules.vtkFiltersCore import vtkThreshold\nfrom vtkmodules.numpy_interface.dataset_adapter import numpyTovtkDataArray as np2da\nfrom vtkmodules.util import vtkConstants\n\n# Add import for the rendering\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch  # noqa\nimport vtkmodules.vtkRenderingOpenGL2  # noqa\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n)\n\nfrom trame.app import get_server\nfrom trame.ui.vuetify import SinglePageLayout\nfrom trame.widgets import vuetify, vtk\n\n# -----------------------------------------------------------------------------\n# Trame setup\n# -----------------------------------------------------------------------------\n\nserver = get_server()\nstate, ctrl = server.state, server.controller\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nvtk_idlist = vtkIdList()\nvtk_grid = vtkUnstructuredGrid()\nvtk_filter = vtkThreshold()\nvtk_filter.SetInputData(vtk_grid)\nfield_to_keep = \"my_array\"\n\nrenderer = vtkRenderer()\nrenderer.SetBackground(0.8, 0.8, 0.8)\nrenderWindow = vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n\nrenderWindowInteractor = vtkRenderWindowInteractor()\nrenderWindowInteractor.SetRenderWindow(renderWindow)\nrenderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\nfilter_mapper = vtkDataSetMapper()\nfilter_mapper.SetInputConnection(vtk_filter.GetOutputPort())\nfilter_actor = vtkActor()\nfilter_actor.SetMapper(filter_mapper)\nrenderer.AddActor(filter_actor)\n\nlut = vtkLookupTable()\nlut.SetHueRange(0.667, 0)\nlut.Build()\nfilter_mapper.SetLookupTable(lut)\n\nmesh_mapper = vtkDataSetMapper()\nmesh_mapper.SetInputData(vtk_grid)\nmesh_mapper.SetScalarVisibility(0)\nmesh_actor = vtkActor()\nmesh_actor.SetMapper(mesh_mapper)\nrenderer.AddActor(mesh_actor)\n\n\n@state.change(\"nodes_file\", \"elems_file\", \"field_file\")\ndef update_grid(nodes_file, elems_file, field_file, **kwargs):\n    if not nodes_file:\n        return\n\n    if not elems_file:\n        return\n\n    nodes_bytes = nodes_file.get(\"content\")\n    elems_bytes = elems_file.get(\"content\")\n\n    df_nodes = pd.read_csv(\n        io.StringIO(nodes_bytes.decode(\"utf-8\")),\n        delim_whitespace=True,\n        header=None,\n        skiprows=1,\n        names=[\"id\", \"x\", \"y\", \"z\"],\n    )\n\n    df_nodes[\"id\"] = df_nodes[\"id\"].astype(int)\n    df_nodes = df_nodes.set_index(\"id\", drop=True)\n    # fill missing ids in range as VTK uses position (index) to map cells to points\n    df_nodes = df_nodes.reindex(\n        np.arange(df_nodes.index.min(), df_nodes.index.max() + 1), fill_value=0\n    )\n\n    df_elems = pd.read_csv(\n        io.StringIO(elems_bytes.decode(\"utf-8\")),\n        skiprows=1,\n        header=None,\n        delim_whitespace=True,\n        engine=\"python\",\n        index_col=None,\n    ).sort_values(0)\n    # order: 0: eid, 1: eshape, 2+: nodes, iloc[:,0] is index\n    df_elems.iloc[:, 0] = df_elems.iloc[:, 0].astype(int)\n\n    n_nodes = df_elems.iloc[:, 1].map(\n        lambda x: int(\"\".join(i for i in x if i.isdigit()))\n    )\n    df_elems.insert(2, \"n_nodes\", n_nodes)\n    # fill missing ids in range as VTK uses position (index) to map data to cells\n    new_range = np.arange(df_elems.iloc[:, 0].min(), df_elems.iloc[:, 0].max() + 1)\n    df_elems = df_elems.set_index(0, drop=False).reindex(new_range, fill_value=0)\n\n    # mapping specific to Ansys Mechanical data\n    vtk_shape_id_map = {\n        \"Tet4\": vtkConstants.VTK_TETRA,\n        \"Tet10\": vtkConstants.VTK_QUADRATIC_TETRA,\n        \"Hex8\": vtkConstants.VTK_HEXAHEDRON,\n        \"Hex20\": vtkConstants.VTK_QUADRATIC_HEXAHEDRON,\n        \"Tri6\": vtkConstants.VTK_QUADRATIC_TRIANGLE,\n        \"Quad8\": vtkConstants.VTK_QUADRATIC_QUAD,\n        \"Tri3\": vtkConstants.VTK_TRIANGLE,\n        \"Quad4\": vtkConstants.VTK_QUAD,\n        \"Wed15\": vtkConstants.VTK_QUADRATIC_WEDGE,\n    }\n    df_elems[\"cell_types\"] = np.nan\n    df_elems.loc[df_elems.loc[:, 0] > 0, \"cell_types\"] = df_elems.loc[\n        df_elems.loc[:, 0] > 0, 1\n    ].map(\n        lambda x: vtk_shape_id_map[x.strip()]\n        if x.strip() in vtk_shape_id_map.keys()\n        else np.nan\n    )\n    df_elems = df_elems.dropna(subset=[\"cell_types\"], axis=0)\n\n    # convert dataframes to vtk-desired format\n    points = df_nodes[[\"x\", \"y\", \"z\"]].to_numpy()\n    cell_types = df_elems[\"cell_types\"].to_numpy()\n    n_nodes = df_elems.loc[:, \"n_nodes\"].to_numpy()\n    # subtract starting node id from all grid references in cells to avoid filling from 0 to first used node (in case mesh doesnt start at 1)\n    p = df_elems.iloc[:, 3:-1].to_numpy() - df_nodes.index.min()\n    # if you need to, re-order nodes here-ish\n    a = np.hstack((n_nodes.reshape((len(n_nodes), 1)), p))\n    # convert to flat numpy array\n    cells = a.ravel()\n    # remove nans (due to elements with different no. of nodes)\n    cells = cells[np.logical_not(np.isnan(cells))]\n    cells = cells.astype(int)\n\n    # update grid\n    vtk_pts = vtkPoints()\n    vtk_pts.SetData(np2da(points))\n    vtk_grid.SetPoints(vtk_pts)\n\n    vtk_cells = vtkCellArray()\n    vtk_cells.SetCells(\n        cell_types.shape[0], np2da(cells, array_type=vtkConstants.VTK_ID_TYPE)\n    )\n    vtk_grid.SetCells(\n        np2da(cell_types, array_type=vtkConstants.VTK_UNSIGNED_CHAR), vtk_cells\n    )\n    state.mesh_status = 1\n\n    # Add field if any\n    if field_file:\n        field_bytes = field_file.get(\"content\")\n        df_elem_data = pd.read_csv(\n            io.StringIO(field_bytes.decode(\"utf-8\")),\n            delim_whitespace=True,\n            header=None,\n            skiprows=1,\n            names=[\"id\", \"val\"],\n        )\n        df_elem_data = df_elem_data.sort_values(\"id\").set_index(\"id\", drop=True)\n        # fill missing ids in range as VTK uses position (index) to map data to cells\n        df_elem_data = df_elem_data.reindex(\n            np.arange(df_elems.index.min(), df_elems.index.max() + 1), fill_value=0.0\n        )\n        np_val = df_elem_data[\"val\"].to_numpy()\n        # assign data to grid with the name 'my_array'\n        vtk_array = np2da(np_val, name=field_to_keep)\n        vtk_grid.GetCellData().SetScalars(vtk_array)\n        full_min, full_max = vtk_array.GetRange()\n        state.full_min = full_min\n        state.full_max = full_max\n        state.threshold_range = [full_min, full_max]\n        state.mesh_status = 2\n\n        # Color handling in plain VTK\n        filter_mapper.SetScalarRange(full_min, full_max)\n\n        # Write dataset as VTU\n        # from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridWriter\n        # writer = vtkXMLUnstructuredGridWriter()\n        # writer.SetFileName(\"fea.vtu\")\n        # writer.SetInputData(vtk_grid)\n        # writer.SetCompressorTypeToZLib()\n        # writer.SetCompressionLevel(6)\n        # writer.SetDataModeToAppended()\n        # writer.Write()\n\n    renderer.ResetCamera()\n    ctrl.view_update()\n\n\n@state.change(\"threshold_range\")\ndef update_filter(threshold_range, **kwargs):\n    # Comment if you want to have a fix color range\n    filter_mapper.SetScalarRange(threshold_range)\n    vtk_filter.SetLowerThreshold(threshold_range[0])\n    vtk_filter.SetUpperThreshold(threshold_range[1])\n    ctrl.view_update()\n\n\n@state.change(\"mesh_status\")\ndef update_mesh_representations(**kwargs):\n    # defaults\n    color = [1, 1, 1]\n    representation = 2\n    opacity = 1\n\n    if state.mesh_status == 2:\n        color = [0.3, 0.3, 0.3]\n        representation = 1\n        opacity = 0.2\n\n    property = mesh_actor.GetProperty()\n    property.SetRepresentation(representation)\n    property.SetColor(color)\n    property.SetOpacity(opacity)\n    ctrl.view_update()\n\n\ndef reset():\n    state.update(\n        {\n            \"nodes_file\": None,\n            \"elems_file\": None,\n            \"field_file\": None,\n            \"mesh_status\": 0,\n        }\n    )\n\n\n# -----------------------------------------------------------------------------\n# Web App setup\n# -----------------------------------------------------------------------------\nfile_style = {\n    \"dense\": True,\n    \"hide_details\": True,\n    \"style\": \"max-width: 200px\",\n    \"class\": \"mx-2\",\n    \"small_chips\": True,\n    \"clearable\": (\"false\",),\n    \"accept\": \".txt\",\n}\n\nstate.trame__title = \"FEA - Mesh viewer\"\n\n\nwith SinglePageLayout(server) as layout:\n    layout.icon.click = reset\n    layout.title.set_text(\"Mesh Viewer\")\n\n    # Toolbar ----------------------------------------\n    with layout.toolbar:\n        vuetify.VSpacer()\n        vuetify.VRangeSlider(\n            thumb_size=16,\n            thumb_label=True,\n            label=\"Threshold\",\n            v_if=(\"mesh_status > 1\",),\n            v_model=(\"threshold_range\", [0, 1]),\n            min=(\"full_min\", 0),\n            max=(\"full_max\", 1),\n            dense=True,\n            hide_details=True,\n            style=\"max-width: 400px\",\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 1\",),\n            prepend_icon=\"mdi-vector-triangle\",\n            v_model=(\"nodes_file\", None),\n            placeholder=\"Nodes\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 1\",),\n            prepend_icon=\"mdi-dots-triangle\",\n            v_model=(\"elems_file\", None),\n            placeholder=\"Elements\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 2\",),\n            prepend_icon=\"mdi-gradient\",\n            v_model=(\"field_file\", None),\n            placeholder=\"Field\",\n            **file_style,\n        )\n        with vuetify.VBtn(\n            v_if=(\"mesh_status\",), icon=True, click=ctrl.view_reset_camera\n        ):\n            vuetify.VIcon(\"mdi-crop-free\")\n\n        vuetify.VProgressLinear(\n            indeterminate=True, absolute=True, bottom=True, active=(\"trame__busy\",)\n        )\n\n    # Content ----------------------------------------\n    with layout.content:\n        with vuetify.VContainer(\n            fluid=True,\n            classes=\"pa-0 fill-height\",\n            style=\"position: relative\",\n        ):\n            html_view = vtk.VtkRemoteView(renderWindow, interactive_ratio=(\"1\",))\n            ctrl.view_update = html_view.update\n            ctrl.view_reset_camera = html_view.reset_camera\n\n\n# Variables not defined within HTML but used\nstate.mesh_status = 0  # 0: empty / 1: mesh / 2: mesh+filter\n\n# -----------------------------------------------------------------------------\n# Use --data to skip file upload\n# -----------------------------------------------------------------------------\n\nparser = server.cli\nparser.add_argument(\"--data\", help=\"Unstructured file path\", dest=\"data\")\nargs = parser.parse_args()\nif args.data:\n    from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\n\n    reader = vtkXMLUnstructuredGridReader()\n    reader.SetFileName(os.path.abspath(args.data))\n    reader.Update()\n    vtu = reader.GetOutput()\n    vtk_grid.ShallowCopy(vtu)\n\n    vtk_array = vtu.GetCellData().GetScalars()\n    full_min, full_max = vtk_array.GetRange()\n    state.full_min = full_min\n    state.full_max = full_max\n    state.threshold_range = [full_min, full_max]\n    state.mesh_status = 2\n    update_mesh_representations()\n\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    server.start()\n
"},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#code_2","title":"Code","text":""},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#app_client_viewpy","title":"app_client_view.py","text":"
\"\"\"\nVersion for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/VTK/Applications/FiniteElementAnalysis/app_client_view.py\nDelta v1..v2          - https://github.com/Kitware/trame/commit/03f28bb0084490acabf218264b96a1dbb3a17f19\n\"\"\"\n\nimport os\nimport io\nimport numpy as np\nimport pandas as pd\n\nfrom vtkmodules.vtkCommonCore import vtkPoints, vtkIdList\nfrom vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid, vtkCellArray\nfrom vtkmodules.vtkFiltersCore import vtkThreshold\nfrom vtkmodules.numpy_interface.dataset_adapter import numpyTovtkDataArray as np2da\nfrom vtkmodules.util import vtkConstants\n\nfrom trame.app import get_server\nfrom trame.ui.vuetify import SinglePageLayout\nfrom trame.widgets import vuetify, vtk, trame\n\n# -----------------------------------------------------------------------------\n# Constants\n# -----------------------------------------------------------------------------\n\nVIEW_INTERACT = [\n    {\"button\": 1, \"action\": \"Rotate\"},\n    {\"button\": 2, \"action\": \"Pan\"},\n    {\"button\": 3, \"action\": \"Zoom\", \"scrollEnabled\": True},\n    {\"button\": 1, \"action\": \"Pan\", \"alt\": True},\n    {\"button\": 1, \"action\": \"Zoom\", \"control\": True},\n    {\"button\": 1, \"action\": \"Pan\", \"shift\": True},\n    {\"button\": 1, \"action\": \"Roll\", \"alt\": True, \"shift\": True},\n]\n\n# -----------------------------------------------------------------------------\n# Trame setup\n# -----------------------------------------------------------------------------\n\nserver = get_server()\nstate, ctrl = server.state, server.controller\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nvtk_idlist = vtkIdList()\nvtk_grid = vtkUnstructuredGrid()\nvtk_filter = vtkThreshold()\nvtk_filter.SetInputData(vtk_grid)\nfield_to_keep = \"my_array\"\n\n\n@state.change(\"nodes_file\", \"elems_file\", \"field_file\")\ndef update_grid(nodes_file, elems_file, field_file, **kwargs):\n    state.picking_modes = []\n    if not nodes_file:\n        return\n\n    if not elems_file:\n        return\n\n    nodes_bytes = nodes_file.get(\"content\")\n    elems_bytes = elems_file.get(\"content\")\n\n    df_nodes = pd.read_csv(\n        io.StringIO(nodes_bytes.decode(\"utf-8\")),\n        delim_whitespace=True,\n        header=None,\n        skiprows=1,\n        names=[\"id\", \"x\", \"y\", \"z\"],\n    )\n\n    df_nodes[\"id\"] = df_nodes[\"id\"].astype(int)\n    df_nodes = df_nodes.set_index(\"id\", drop=True)\n    # fill missing ids in range as VTK uses position (index) to map cells to points\n    df_nodes = df_nodes.reindex(\n        np.arange(df_nodes.index.min(), df_nodes.index.max() + 1), fill_value=0\n    )\n\n    df_elems = pd.read_csv(\n        io.StringIO(elems_bytes.decode(\"utf-8\")),\n        skiprows=1,\n        header=None,\n        delim_whitespace=True,\n        engine=\"python\",\n        index_col=None,\n    ).sort_values(0)\n    # order: 0: eid, 1: eshape, 2+: nodes, iloc[:,0] is index\n    df_elems.iloc[:, 0] = df_elems.iloc[:, 0].astype(int)\n\n    n_nodes = df_elems.iloc[:, 1].map(\n        lambda x: int(\"\".join(i for i in x if i.isdigit()))\n    )\n    df_elems.insert(2, \"n_nodes\", n_nodes)\n    # fill missing ids in range as VTK uses position (index) to map data to cells\n    new_range = np.arange(df_elems.iloc[:, 0].min(), df_elems.iloc[:, 0].max() + 1)\n    df_elems = df_elems.set_index(0, drop=False).reindex(new_range, fill_value=0)\n\n    # mapping specific to Ansys Mechanical data\n    vtk_shape_id_map = {\n        \"Tet4\": vtkConstants.VTK_TETRA,\n        \"Tet10\": vtkConstants.VTK_QUADRATIC_TETRA,\n        \"Hex8\": vtkConstants.VTK_HEXAHEDRON,\n        \"Hex20\": vtkConstants.VTK_QUADRATIC_HEXAHEDRON,\n        \"Tri6\": vtkConstants.VTK_QUADRATIC_TRIANGLE,\n        \"Quad8\": vtkConstants.VTK_QUADRATIC_QUAD,\n        \"Tri3\": vtkConstants.VTK_TRIANGLE,\n        \"Quad4\": vtkConstants.VTK_QUAD,\n        \"Wed15\": vtkConstants.VTK_QUADRATIC_WEDGE,\n    }\n    df_elems[\"cell_types\"] = np.nan\n    df_elems.loc[df_elems.loc[:, 0] > 0, \"cell_types\"] = df_elems.loc[\n        df_elems.loc[:, 0] > 0, 1\n    ].map(\n        lambda x: vtk_shape_id_map[x.strip()]\n        if x.strip() in vtk_shape_id_map.keys()\n        else np.nan\n    )\n    df_elems = df_elems.dropna(subset=[\"cell_types\"], axis=0)\n\n    # convert dataframes to vtk-desired format\n    points = df_nodes[[\"x\", \"y\", \"z\"]].to_numpy()\n    cell_types = df_elems[\"cell_types\"].to_numpy()\n    n_nodes = df_elems.loc[:, \"n_nodes\"].to_numpy()\n    # subtract starting node id from all grid references in cells to avoid filling from 0 to first used node (in case mesh doesnt start at 1)\n    p = df_elems.iloc[:, 3:-1].to_numpy() - df_nodes.index.min()\n    # if you need to, re-order nodes here-ish\n    a = np.hstack((n_nodes.reshape((len(n_nodes), 1)), p))\n    # convert to flat numpy array\n    cells = a.ravel()\n    # remove nans (due to elements with different no. of nodes)\n    cells = cells[np.logical_not(np.isnan(cells))]\n    cells = cells.astype(int)\n\n    # update grid\n    vtk_pts = vtkPoints()\n    vtk_pts.SetData(np2da(points))\n    vtk_grid.SetPoints(vtk_pts)\n\n    vtk_cells = vtkCellArray()\n    vtk_cells.SetCells(\n        cell_types.shape[0], np2da(cells, array_type=vtkConstants.VTK_ID_TYPE)\n    )\n    vtk_grid.SetCells(\n        np2da(cell_types, array_type=vtkConstants.VTK_UNSIGNED_CHAR), vtk_cells\n    )\n\n    # Add field if any\n    if field_file:\n        field_bytes = field_file.get(\"content\")\n        df_elem_data = pd.read_csv(\n            io.StringIO(field_bytes.decode(\"utf-8\")),\n            delim_whitespace=True,\n            header=None,\n            skiprows=1,\n            names=[\"id\", \"val\"],\n        )\n        df_elem_data = df_elem_data.sort_values(\"id\").set_index(\"id\", drop=True)\n        # fill missing ids in range as VTK uses position (index) to map data to cells\n        df_elem_data = df_elem_data.reindex(\n            np.arange(df_elems.index.min(), df_elems.index.max() + 1), fill_value=0.0\n        )\n        np_val = df_elem_data[\"val\"].to_numpy()\n        # assign data to grid with the name 'my_array'\n        vtk_array = np2da(np_val, name=field_to_keep)\n        vtk_grid.GetCellData().SetScalars(vtk_array)\n        state.full_range = vtk_array.GetRange()\n        state.threshold_range = list(vtk_array.GetRange())\n        state.picking_modes = [\"hover\"]\n\n    ctrl.mesh_update()\n\n\n@state.change(\"threshold_range\")\ndef update_filter(threshold_range, **kwargs):\n    vtk_filter.SetLowerThreshold(threshold_range[0])\n    vtk_filter.SetUpperThreshold(threshold_range[1])\n    ctrl.threshold_update()\n\n\ndef reset():\n    state.update(\n        {\n            \"mesh\": None,\n            \"threshold\": None,\n            \"nodes_file\": None,\n            \"elems_file\": None,\n            \"field_file\": None,\n        }\n    )\n\n\n@state.change(\"pick_data\")\ndef update_tooltip(pick_data, pixel_ratio, **kwargs):\n    state.tooltip = \"\"\n    state.tooltip_style = {\"display\": \"none\"}\n    data = pick_data\n\n    if data:\n        xyx = data[\"worldPosition\"]\n        idx = vtk_grid.FindPoint(xyx)\n        field = vtk_grid.GetCellData().GetArray(0)\n        if idx > -1 and field:\n            messages = []\n            vtk_grid.GetPointCells(idx, vtk_idlist)\n            for i in range(vtk_idlist.GetNumberOfIds()):\n                cell_idx = vtk_idlist.GetId(i)\n                value = field.GetValue(cell_idx)\n                value_str = f\"{value:.2f}\"\n                messages.append(f\"Scalar: {value_str}\")\n\n            if len(messages):\n                x, y, z = data[\"displayPosition\"]\n                state.tooltip = messages[0]\n                state.tooltip_style = {\n                    \"position\": \"absolute\",\n                    \"left\": f\"{(x / pixel_ratio) + 10}px\",\n                    \"bottom\": f\"{(y / pixel_ratio) + 10}px\",\n                    \"zIndex\": 10,\n                    \"pointerEvents\": \"none\",\n                }\n\n\n# -----------------------------------------------------------------------------\n# Web App setup\n# -----------------------------------------------------------------------------\n\nfile_style = {\n    \"dense\": True,\n    \"hide_details\": True,\n    \"style\": \"max-width: 200px\",\n    \"class\": \"mx-2\",\n    \"small_chips\": True,\n    \"clearable\": (\"false\",),\n    \"accept\": \".txt\",\n}\n\nstate.trame__title = \"FEA - Mesh viewer\"\n\nwith SinglePageLayout(server) as layout:\n    layout.title.set_text(\"Mesh Viewer\")\n    layout.icon.click = reset\n\n    # Let the server know the browser pixel ratio\n    trame.ClientTriggers(mounted=\"pixel_ratio = window.devicePixelRatio\")\n\n    # Toolbar ----------------------------------------\n    with layout.toolbar:\n        vuetify.VSpacer()\n        vuetify.VRangeSlider(\n            thumb_size=16,\n            thumb_label=True,\n            label=\"Threshold\",\n            v_if=(\"threshold\",),\n            v_model=(\"threshold_range\", [0, 1]),\n            min=(\"full_range[0]\",),\n            max=(\"full_range[1]\",),\n            dense=True,\n            hide_details=True,\n            style=\"max-width: 400px\",\n        )\n        vuetify.VFileInput(\n            v_show=(\"!mesh\",),\n            prepend_icon=\"mdi-vector-triangle\",\n            v_model=(\"nodes_file\", None),\n            placeholder=\"Nodes\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"!mesh\",),\n            prepend_icon=\"mdi-dots-triangle\",\n            v_model=(\"elems_file\", None),\n            placeholder=\"Elements\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"!threshold\",),\n            prepend_icon=\"mdi-gradient\",\n            v_model=(\"field_file\", None),\n            placeholder=\"Field\",\n            **file_style,\n        )\n        with vuetify.VBtn(v_if=(\"mesh\",), icon=True, click=ctrl.view_reset_camera):\n            vuetify.VIcon(\"mdi-crop-free\")\n\n        vuetify.VProgressLinear(\n            indeterminate=True, absolute=True, bottom=True, active=(\"trame__busy\",)\n        )\n\n        trame.ClientStateChange(value=\"mesh\", change=ctrl.view_reset_camera)\n\n    # Content ----------------------------------------\n    with layout.content:\n        with vuetify.VContainer(\n            fluid=True,\n            classes=\"pa-0 fill-height\",\n            style=\"position: relative\",\n        ):\n            with vtk.VtkView(\n                ref=\"view\",\n                background=(\"[0.8, 0.8, 0.8]\",),\n                hover=\"pick_data = $event\",\n                picking_modes=(\"picking_modes\", []),\n                interactor_settings=(\"interactor_settings\", VIEW_INTERACT),\n            ) as view:\n                ctrl.view_update = view.update\n                ctrl.view_reset_camera = view.reset_camera\n                with vtk.VtkGeometryRepresentation(\n                    v_if=(\"mesh\",),\n                    property=(\n                        \"\"\"{\n                            representation: threshold ? 1 : 2,\n                            color: threshold ? [0.3, 0.3, 0.3] : [1, 1, 1],\n                            opacity: threshold ? 0.2 : 1\n                            }\"\"\",\n                    ),\n                ):\n                    mesh = vtk.VtkMesh(\"mesh\", dataset=vtk_grid)\n                    ctrl.mesh_update = mesh.update\n\n                with vtk.VtkGeometryRepresentation(\n                    v_if=(\"threshold\",),\n                    color_data_range=(\"full_range\", [0, 1]),\n                ):\n                    threshold = vtk.VtkMesh(\n                        \"threshold\", dataset=vtk_filter, field_to_keep=field_to_keep\n                    )\n                    ctrl.threshold_update = threshold.update\n            with vuetify.VCard(\n                style=(\"tooltip_style\", {\"display\": \"none\"}),\n                elevation=2,\n                outlined=True,\n            ):\n                vuetify.VCardText(\"<pre>{{ tooltip }}</pre>\"),\n\n\n# Variables not defined within HTML but used\nstate.update(\n    {\n        \"pixel_ratio\": 1,\n        \"pick_data\": None,\n        \"tooltip\": \"\",\n    }\n)\n\n# -----------------------------------------------------------------------------\n# Use --data to skip file upload\n# -----------------------------------------------------------------------------\n\nparser = server.cli\nparser.add_argument(\"--data\", help=\"Unstructured file path\", dest=\"data\")\nargs = parser.parse_args()\nif args.data:\n    from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\n\n    reader = vtkXMLUnstructuredGridReader()\n    reader.SetFileName(os.path.abspath(args.data))\n    reader.Update()\n    vtu = reader.GetOutput()\n    vtk_grid.ShallowCopy(vtu)\n\n    vtk_array = vtu.GetCellData().GetScalars()\n    full_min, full_max = vtk_array.GetRange()\n    state.full_range = [full_min, full_max]\n    state.threshold_range = [full_min, full_max]\n    state.picking_modes = [\"hover\"]\n    ctrl.mesh_update()\n    ctrl.threshold_update()\n\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    server.start()\n
"},{"location":"Trame/Applications/MultiFilter/MultiFilter/","title":"MultiFilter","text":"

vtk-examples/Trame/Applications/MultiFilter

"},{"location":"Trame/Applications/MultiFilter/MultiFilter/#description","title":"Description","text":"

VTK Mutli Filter Example

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Trame/Applications/MultiFilter/MultiFilter/#download-and-build-multifilter","title":"Download and Build MultiFilter","text":"

Click here to download MultiFilter. Once the tarball MultiFilter.tar has been downloaded and extracted,

cd MultiFilter\n

and run the application.

See this trame tutorial for instructions on how to setup trame and run the application.

"},{"location":"Trame/Applications/MultiFilter/MultiFilter/#code","title":"Code","text":""},{"location":"Trame/Applications/MultiFilter/MultiFilter/#apppy","title":"app.py","text":"
\"\"\"\nVersion for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/VTK/Applications/MultiFilter/app.py\nDelta v1..v2          - https://github.com/Kitware/trame/commit/7b3cda7c45b8a60132892f762e16ed28cb709481\n\"\"\"\n\nfrom trame.app import get_server\nfrom trame.ui.vuetify import SinglePageWithDrawerLayout\nfrom trame.widgets import vtk, vuetify, trame\nfrom trame.assets.remote import HttpFile\n\nfrom vtkmodules.vtkCommonDataModel import vtkDataObject\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\nfrom vtkmodules.vtkRenderingAnnotation import vtkCubeAxesActor\n\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n)\n\n# Required for interactor initialization\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch  # noqa\n\n# Required for rendering initialization, not necessary for\n# local rendering, but doesn't hurt to include it\nimport vtkmodules.vtkRenderingOpenGL2  # noqa\n\n# -----------------------------------------------------------------------------\n# Data file information\n# -----------------------------------------------------------------------------\n\ndataset_file = HttpFile(\n    \"./data/disk_out_ref.vtu\",\n    \"https://github.com/Kitware/trame/raw/master/examples/data/disk_out_ref.vtu\",\n    __file__\n)\n\n# -----------------------------------------------------------------------------\n# Constants\n# -----------------------------------------------------------------------------\n\n\nclass Representation:\n    Points = 0\n    Wireframe = 1\n    Surface = 2\n    SurfaceWithEdges = 3\n\n\nclass LookupTable:\n    Rainbow = 0\n    Inverted_Rainbow = 1\n    Greyscale = 2\n    Inverted_Greyscale = 3\n\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nrenderer = vtkRenderer()\nrenderWindow = vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n\nrenderWindowInteractor = vtkRenderWindowInteractor()\nrenderWindowInteractor.SetRenderWindow(renderWindow)\nrenderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\n# Read Data\nreader = vtkXMLUnstructuredGridReader()\nreader.SetFileName(dataset_file.path)\nreader.Update()\n\n# Extract Array/Field information\ndataset_arrays = []\nfields = [\n    (reader.GetOutput().GetPointData(), vtkDataObject.FIELD_ASSOCIATION_POINTS),\n    (reader.GetOutput().GetCellData(), vtkDataObject.FIELD_ASSOCIATION_CELLS),\n]\nfor field in fields:\n    field_arrays, association = field\n    for i in range(field_arrays.GetNumberOfArrays()):\n        array = field_arrays.GetArray(i)\n        array_range = array.GetRange()\n        dataset_arrays.append(\n            {\n                \"text\": array.GetName(),\n                \"value\": i,\n                \"range\": list(array_range),\n                \"type\": association,\n            }\n        )\ndefault_array = dataset_arrays[0]\ndefault_min, default_max = default_array.get(\"range\")\n\n# Mesh\nmesh_mapper = vtkDataSetMapper()\nmesh_mapper.SetInputConnection(reader.GetOutputPort())\nmesh_actor = vtkActor()\nmesh_actor.SetMapper(mesh_mapper)\nrenderer.AddActor(mesh_actor)\n\n# Mesh: Setup default representation to surface\nmesh_actor.GetProperty().SetRepresentationToSurface()\nmesh_actor.GetProperty().SetPointSize(1)\nmesh_actor.GetProperty().EdgeVisibilityOff()\n\n# Mesh: Apply rainbow color map\nmesh_lut = mesh_mapper.GetLookupTable()\nmesh_lut.SetHueRange(0.666, 0.0)\nmesh_lut.SetSaturationRange(1.0, 1.0)\nmesh_lut.SetValueRange(1.0, 1.0)\nmesh_lut.Build()\n\n# Mesh: Color by default array\nmesh_mapper.SelectColorArray(default_array.get(\"text\"))\nmesh_mapper.GetLookupTable().SetRange(default_min, default_max)\nif default_array.get(\"type\") == vtkDataObject.FIELD_ASSOCIATION_POINTS:\n    mesh_mapper.SetScalarModeToUsePointFieldData()\nelse:\n    mesh_mapper.SetScalarModeToUseCellFieldData()\nmesh_mapper.SetScalarVisibility(True)\nmesh_mapper.SetUseLookupTableScalarRange(True)\n\n# Contour\ncontour = vtkContourFilter()\ncontour.SetInputConnection(reader.GetOutputPort())\ncontour_mapper = vtkDataSetMapper()\ncontour_mapper.SetInputConnection(contour.GetOutputPort())\ncontour_actor = vtkActor()\ncontour_actor.SetMapper(contour_mapper)\nrenderer.AddActor(contour_actor)\n\n# Contour: ContourBy default array\ncontour_value = 0.5 * (default_max + default_min)\ncontour.SetInputArrayToProcess(\n    0, 0, 0, default_array.get(\"type\"), default_array.get(\"text\")\n)\ncontour.SetValue(0, contour_value)\n\n# Contour: Setup default representation to surface\ncontour_actor.GetProperty().SetRepresentationToSurface()\ncontour_actor.GetProperty().SetPointSize(1)\ncontour_actor.GetProperty().EdgeVisibilityOff()\n\n# Contour: Apply rainbow color map\ncontour_lut = contour_mapper.GetLookupTable()\ncontour_lut.SetHueRange(0.666, 0.0)\ncontour_lut.SetSaturationRange(1.0, 1.0)\ncontour_lut.SetValueRange(1.0, 1.0)\ncontour_lut.Build()\n\n# Contour: Color by default array\ncontour_mapper.SelectColorArray(default_array.get(\"text\"))\ncontour_mapper.GetLookupTable().SetRange(default_min, default_max)\nif default_array.get(\"type\") == vtkDataObject.FIELD_ASSOCIATION_POINTS:\n    contour_mapper.SetScalarModeToUsePointFieldData()\nelse:\n    contour_mapper.SetScalarModeToUseCellFieldData()\ncontour_mapper.SetScalarVisibility(True)\ncontour_mapper.SetUseLookupTableScalarRange(True)\n\n# Cube Axes\ncube_axes = vtkCubeAxesActor()\nrenderer.AddActor(cube_axes)\n\n# Cube Axes: Boundaries, camera, and styling\ncube_axes.SetBounds(mesh_actor.GetBounds())\ncube_axes.SetCamera(renderer.GetActiveCamera())\ncube_axes.SetXLabelFormat(\"%6.1f\")\ncube_axes.SetYLabelFormat(\"%6.1f\")\ncube_axes.SetZLabelFormat(\"%6.1f\")\ncube_axes.SetFlyModeToOuterEdges()\n\nrenderer.ResetCamera()\n\n# -----------------------------------------------------------------------------\n# Trame setup\n# -----------------------------------------------------------------------------\n\nserver = get_server()\nstate, ctrl = server.state, server.controller\n\nstate.setdefault(\"active_ui\", None)\n\n# -----------------------------------------------------------------------------\n# Callbacks\n# -----------------------------------------------------------------------------\n\n\n@state.change(\"cube_axes_visibility\")\ndef update_cube_axes_visibility(cube_axes_visibility, **kwargs):\n    cube_axes.SetVisibility(cube_axes_visibility)\n    ctrl.view_update()\n\n\n# Selection Change\ndef actives_change(ids):\n    _id = ids[0]\n    if _id == \"1\":  # Mesh\n        state.active_ui = \"mesh\"\n    elif _id == \"2\":  # Contour\n        state.active_ui = \"contour\"\n    else:\n        state.active_ui = \"nothing\"\n\n\n# Visibility Change\ndef visibility_change(event):\n    _id = event[\"id\"]\n    _visibility = event[\"visible\"]\n\n    if _id == \"1\":  # Mesh\n        mesh_actor.SetVisibility(_visibility)\n    elif _id == \"2\":  # Contour\n        contour_actor.SetVisibility(_visibility)\n    ctrl.view_update()\n\n\n# Representation Callbacks\ndef update_representation(actor, mode):\n    property = actor.GetProperty()\n    if mode == Representation.Points:\n        property.SetRepresentationToPoints()\n        property.SetPointSize(5)\n        property.EdgeVisibilityOff()\n    elif mode == Representation.Wireframe:\n        property.SetRepresentationToWireframe()\n        property.SetPointSize(1)\n        property.EdgeVisibilityOff()\n    elif mode == Representation.Surface:\n        property.SetRepresentationToSurface()\n        property.SetPointSize(1)\n        property.EdgeVisibilityOff()\n    elif mode == Representation.SurfaceWithEdges:\n        property.SetRepresentationToSurface()\n        property.SetPointSize(1)\n        property.EdgeVisibilityOn()\n\n\n@state.change(\"mesh_representation\")\ndef update_mesh_representation(mesh_representation, **kwargs):\n    update_representation(mesh_actor, mesh_representation)\n    ctrl.view_update()\n\n\n@state.change(\"contour_representation\")\ndef update_contour_representation(contour_representation, **kwargs):\n    update_representation(contour_actor, contour_representation)\n    ctrl.view_update()\n\n\n# Color By Callbacks\ndef color_by_array(actor, array):\n    _min, _max = array.get(\"range\")\n    mapper = actor.GetMapper()\n    mapper.SelectColorArray(array.get(\"text\"))\n    mapper.GetLookupTable().SetRange(_min, _max)\n    if array.get(\"type\") == vtkDataObject.FIELD_ASSOCIATION_POINTS:\n        mesh_mapper.SetScalarModeToUsePointFieldData()\n    else:\n        mesh_mapper.SetScalarModeToUseCellFieldData()\n    mapper.SetScalarVisibility(True)\n    mapper.SetUseLookupTableScalarRange(True)\n\n\n@state.change(\"mesh_color_array_idx\")\ndef update_mesh_color_by_name(mesh_color_array_idx, **kwargs):\n    array = dataset_arrays[mesh_color_array_idx]\n    color_by_array(mesh_actor, array)\n    ctrl.view_update()\n\n\n@state.change(\"contour_color_array_idx\")\ndef update_contour_color_by_name(contour_color_array_idx, **kwargs):\n    array = dataset_arrays[contour_color_array_idx]\n    color_by_array(contour_actor, array)\n    ctrl.view_update()\n\n\n# Color Map Callbacks\ndef use_preset(actor, preset):\n    lut = actor.GetMapper().GetLookupTable()\n    if preset == LookupTable.Rainbow:\n        lut.SetHueRange(0.666, 0.0)\n        lut.SetSaturationRange(1.0, 1.0)\n        lut.SetValueRange(1.0, 1.0)\n    elif preset == LookupTable.Inverted_Rainbow:\n        lut.SetHueRange(0.0, 0.666)\n        lut.SetSaturationRange(1.0, 1.0)\n        lut.SetValueRange(1.0, 1.0)\n    elif preset == LookupTable.Greyscale:\n        lut.SetHueRange(0.0, 0.0)\n        lut.SetSaturationRange(0.0, 0.0)\n        lut.SetValueRange(0.0, 1.0)\n    elif preset == LookupTable.Inverted_Greyscale:\n        lut.SetHueRange(0.0, 0.666)\n        lut.SetSaturationRange(0.0, 0.0)\n        lut.SetValueRange(1.0, 0.0)\n    lut.Build()\n\n\n@state.change(\"mesh_color_preset\")\ndef update_mesh_color_preset(mesh_color_preset, **kwargs):\n    use_preset(mesh_actor, mesh_color_preset)\n    ctrl.view_update()\n\n\n@state.change(\"contour_color_preset\")\ndef update_contour_color_preset(contour_color_preset, **kwargs):\n    use_preset(contour_actor, contour_color_preset)\n    ctrl.view_update()\n\n\n# Opacity Callbacks\n@state.change(\"mesh_opacity\")\ndef update_mesh_opacity(mesh_opacity, **kwargs):\n    mesh_actor.GetProperty().SetOpacity(mesh_opacity)\n    ctrl.view_update()\n\n\n@state.change(\"contour_opacity\")\ndef update_contour_opacity(contour_opacity, **kwargs):\n    contour_actor.GetProperty().SetOpacity(contour_opacity)\n    ctrl.view_update()\n\n\n# Contour Callbacks\n@state.change(\"contour_by_array_idx\")\ndef update_contour_by(contour_by_array_idx, **kwargs):\n    array = dataset_arrays[contour_by_array_idx]\n    contour_min, contour_max = array.get(\"range\")\n    contour_step = 0.01 * (contour_max - contour_min)\n    contour_value = 0.5 * (contour_max + contour_min)\n    contour.SetInputArrayToProcess(0, 0, 0, array.get(\"type\"), array.get(\"text\"))\n    contour.SetValue(0, contour_value)\n\n    # Update UI\n    state.contour_min = contour_min\n    state.contour_max = contour_max\n    state.contour_value = contour_value\n    state.contour_step = contour_step\n\n    # Update View\n    ctrl.view_update()\n\n\n@state.change(\"contour_value\")\ndef update_contour_value(contour_value, **kwargs):\n    contour.SetValue(0, float(contour_value))\n    ctrl.view_update()\n\n\n# -----------------------------------------------------------------------------\n# GUI elements\n# -----------------------------------------------------------------------------\n\n\ndef standard_buttons():\n    vuetify.VCheckbox(\n        v_model=(\"cube_axes_visibility\", True),\n        on_icon=\"mdi-cube-outline\",\n        off_icon=\"mdi-cube-off-outline\",\n        classes=\"mx-1\",\n        hide_details=True,\n        dense=True,\n    )\n    vuetify.VCheckbox(\n        v_model=\"$vuetify.theme.dark\",\n        on_icon=\"mdi-lightbulb-off-outline\",\n        off_icon=\"mdi-lightbulb-outline\",\n        classes=\"mx-1\",\n        hide_details=True,\n        dense=True,\n    )\n    vuetify.VCheckbox(\n        v_model=(\"viewMode\", \"local\"),\n        on_icon=\"mdi-lan-disconnect\",\n        off_icon=\"mdi-lan-connect\",\n        true_value=\"local\",\n        false_value=\"remote\",\n        classes=\"mx-1\",\n        hide_details=True,\n        dense=True,\n    )\n    with vuetify.VBtn(icon=True, click=\"$refs.view.resetCamera()\"):\n        vuetify.VIcon(\"mdi-crop-free\")\n\n\ndef pipeline_widget():\n    trame.GitTree(\n        sources=(\n            \"pipeline\",\n            [\n                {\"id\": \"1\", \"parent\": \"0\", \"visible\": 1, \"name\": \"Mesh\"},\n                {\"id\": \"2\", \"parent\": \"1\", \"visible\": 1, \"name\": \"Contour\"},\n            ],\n        ),\n        actives_change=(actives_change, \"[$event]\"),\n        visibility_change=(visibility_change, \"[$event]\"),\n    )\n\n\ndef ui_card(title, ui_name):\n    with vuetify.VCard(v_show=f\"active_ui == '{ui_name}'\"):\n        vuetify.VCardTitle(\n            title,\n            classes=\"grey lighten-1 py-1 grey--text text--darken-3\",\n            style=\"user-select: none; cursor: pointer\",\n            hide_details=True,\n            dense=True,\n        )\n        content = vuetify.VCardText(classes=\"py-2\")\n    return content\n\n\ndef mesh_card():\n    with ui_card(title=\"Mesh\", ui_name=\"mesh\"):\n        vuetify.VSelect(\n            # Representation\n            v_model=(\"mesh_representation\", Representation.Surface),\n            items=(\n                \"representations\",\n                [\n                    {\"text\": \"Points\", \"value\": 0},\n                    {\"text\": \"Wireframe\", \"value\": 1},\n                    {\"text\": \"Surface\", \"value\": 2},\n                    {\"text\": \"SurfaceWithEdges\", \"value\": 3},\n                ],\n            ),\n            label=\"Representation\",\n            hide_details=True,\n            dense=True,\n            outlined=True,\n            classes=\"pt-1\",\n        )\n        with vuetify.VRow(classes=\"pt-2\", dense=True):\n            with vuetify.VCol(cols=\"6\"):\n                vuetify.VSelect(\n                    # Color By\n                    label=\"Color by\",\n                    v_model=(\"mesh_color_array_idx\", 0),\n                    items=(\"array_list\", dataset_arrays),\n                    hide_details=True,\n                    dense=True,\n                    outlined=True,\n                    classes=\"pt-1\",\n                )\n            with vuetify.VCol(cols=\"6\"):\n                vuetify.VSelect(\n                    # Color Map\n                    label=\"Colormap\",\n                    v_model=(\"mesh_color_preset\", LookupTable.Rainbow),\n                    items=(\n                        \"colormaps\",\n                        [\n                            {\"text\": \"Rainbow\", \"value\": 0},\n                            {\"text\": \"Inv Rainbow\", \"value\": 1},\n                            {\"text\": \"Greyscale\", \"value\": 2},\n                            {\"text\": \"Inv Greyscale\", \"value\": 3},\n                        ],\n                    ),\n                    hide_details=True,\n                    dense=True,\n                    outlined=True,\n                    classes=\"pt-1\",\n                )\n        vuetify.VSlider(\n            # Opacity\n            v_model=(\"mesh_opacity\", 1.0),\n            min=0,\n            max=1,\n            step=0.1,\n            label=\"Opacity\",\n            classes=\"mt-1\",\n            hide_details=True,\n            dense=True,\n        )\n\n\ndef contour_card():\n    with ui_card(title=\"Contour\", ui_name=\"contour\"):\n        vuetify.VSelect(\n            # Contour By\n            label=\"Contour by\",\n            v_model=(\"contour_by_array_idx\", 0),\n            items=(\"array_list\", dataset_arrays),\n            hide_details=True,\n            dense=True,\n            outlined=True,\n            classes=\"pt-1\",\n        )\n        vuetify.VSlider(\n            # Contour Value\n            v_model=(\"contour_value\", contour_value),\n            min=(\"contour_min\", default_min),\n            max=(\"contour_max\", default_max),\n            step=(\"contour_step\", 0.01 * (default_max - default_min)),\n            label=\"Value\",\n            classes=\"my-1\",\n            hide_details=True,\n            dense=True,\n        )\n        vuetify.VSelect(\n            # Representation\n            v_model=(\"contour_representation\", Representation.Surface),\n            items=(\n                \"representations\",\n                [\n                    {\"text\": \"Points\", \"value\": 0},\n                    {\"text\": \"Wireframe\", \"value\": 1},\n                    {\"text\": \"Surface\", \"value\": 2},\n                    {\"text\": \"SurfaceWithEdges\", \"value\": 3},\n                ],\n            ),\n            label=\"Representation\",\n            hide_details=True,\n            dense=True,\n            outlined=True,\n            classes=\"pt-1\",\n        )\n        with vuetify.VRow(classes=\"pt-2\", dense=True):\n            with vuetify.VCol(cols=\"6\"):\n                vuetify.VSelect(\n                    # Color By\n                    label=\"Color by\",\n                    v_model=(\"contour_color_array_idx\", 0),\n                    items=(\"array_list\", dataset_arrays),\n                    hide_details=True,\n                    dense=True,\n                    outlined=True,\n                    classes=\"pt-1\",\n                )\n            with vuetify.VCol(cols=\"6\"):\n                vuetify.VSelect(\n                    # Color Map\n                    label=\"Colormap\",\n                    v_model=(\"contour_color_preset\", LookupTable.Rainbow),\n                    items=(\n                        \"colormaps\",\n                        [\n                            {\"text\": \"Rainbow\", \"value\": 0},\n                            {\"text\": \"Inv Rainbow\", \"value\": 1},\n                            {\"text\": \"Greyscale\", \"value\": 2},\n                            {\"text\": \"Inv Greyscale\", \"value\": 3},\n                        ],\n                    ),\n                    hide_details=True,\n                    dense=True,\n                    outlined=True,\n                    classes=\"pt-1\",\n                )\n        vuetify.VSlider(\n            # Opacity\n            v_model=(\"contour_opacity\", 1.0),\n            min=0,\n            max=1,\n            step=0.1,\n            label=\"Opacity\",\n            classes=\"mt-1\",\n            hide_details=True,\n            dense=True,\n        )\n\n\n# -----------------------------------------------------------------------------\n# GUI\n# -----------------------------------------------------------------------------\n\nwith SinglePageWithDrawerLayout(server) as layout:\n    layout.title.set_text(\"Viewer\")\n\n    with layout.toolbar:\n        # toolbar components\n        vuetify.VSpacer()\n        vuetify.VDivider(vertical=True, classes=\"mx-2\")\n        standard_buttons()\n\n    with layout.drawer as drawer:\n        # drawer components\n        drawer.width = 325\n        pipeline_widget()\n        vuetify.VDivider(classes=\"mb-2\")\n        mesh_card()\n        contour_card()\n\n    with layout.content:\n        # content components\n        with vuetify.VContainer(\n            fluid=True,\n            classes=\"pa-0 fill-height\",\n        ):\n            # view = vtk.VtkRemoteView(renderWindow, interactive_ratio=1)\n            # view = vtk.VtkLocalView(renderWindow)\n            view = vtk.VtkRemoteLocalView(\n                renderWindow, namespace=\"view\", mode=\"local\", interactive_ratio=1\n            )\n            ctrl.view_update = view.update\n            ctrl.view_reset_camera = view.reset_camera\n            ctrl.on_server_ready.add(view.update)\n\n# -----------------------------------------------------------------------------\n# Main\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    server.start()\n
"},{"location":"Trame/Applications/RemoteSelection/RemoteSelection/","title":"RemoteSelection","text":"

vtk-examples/Trame/Applications/RemoteSelection

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Trame/Applications/RemoteSelection/RemoteSelection/#download-and-build-remoteselection","title":"Download and Build RemoteSelection","text":"

Click here to download RemoteSelection. Once the tarball RemoteSelection.tar has been downloaded and extracted,

cd RemoteSelection\n

and run the application.

See this trame tutorial for instructions on how to setup trame and run the application.

"},{"location":"Trame/Applications/RemoteSelection/RemoteSelection/#code","title":"Code","text":""},{"location":"Trame/Applications/RemoteSelection/RemoteSelection/#apppy","title":"app.py","text":"
\"\"\"\nVersion for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/VTK/Applications/RemoteSelection/app.py\nDelta v1..v2          - https://github.com/Kitware/trame/commit/03f28bb0084490acabf218264b96a1dbb3a17f19\n\"\"\"\n\nimport pandas as pd\n\n# Plotly/chart imports\nimport plotly.graph_objects as go\nimport plotly.express as px\n\n# Trame imports\nfrom trame.app import get_server\nfrom trame.assets.remote import HttpFile\nfrom trame.ui.vuetify import SinglePageLayout\nfrom trame.widgets import vuetify, plotly, vtk, trame\n\n# VTK imports\nfrom vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\nfrom vtkmodules.numpy_interface import dataset_adapter as dsa\nfrom vtkmodules.vtkCommonDataModel import vtkSelection, vtkSelectionNode, vtkDataObject\nfrom vtkmodules.vtkCommonCore import vtkIdTypeArray\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractSelection\nfrom vtkmodules.vtkFiltersGeometry import vtkGeometryFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkHardwareSelector,\n    vtkRenderedAreaPicker,\n)\n\nfrom vtkmodules.vtkInteractionStyle import (\n    vtkInteractorStyleRubberBandPick,\n    vtkInteractorStyleSwitch,\n)  # noqa\nimport vtkmodules.vtkRenderingOpenGL2  # noqa\n\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleRubberBandPick\n\n# -----------------------------------------------------------------------------\n# Data file information\n# -----------------------------------------------------------------------------\n\ndataset_file = HttpFile(\n    \"./data/disk_out_ref.vtu\",\n    \"https://github.com/Kitware/trame/raw/master/examples/data/disk_out_ref.vtu\",\n    __file__,\n)\n\n# -----------------------------------------------------------------------------\n# Trame setup\n# -----------------------------------------------------------------------------\n\nserver = get_server()\nstate, ctrl = server.state, server.controller\n\n\n# -----------------------------------------------------------------------------\n# VTK\n# -----------------------------------------------------------------------------\n\nreader = vtkXMLUnstructuredGridReader()\nreader.SetFileName(dataset_file.path)\nreader.Update()\ndataset = reader.GetOutput()\n\nrenderer = vtkRenderer()\nrenderer.SetBackground(1, 1, 1)\nrender_window = vtkRenderWindow()\nrender_window.AddRenderer(renderer)\n\nrw_interactor = vtkRenderWindowInteractor()\nrw_interactor.SetRenderWindow(render_window)\nrw_interactor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\ninteractor_trackball = rw_interactor.GetInteractorStyle()\ninteractor_selection = vtkInteractorStyleRubberBandPick()\narea_picker = vtkRenderedAreaPicker()\nrw_interactor.SetPicker(area_picker)\n\nsurface_filter = vtkGeometryFilter()\nsurface_filter.SetInputConnection(reader.GetOutputPort())\nsurface_filter.SetPassThroughPointIds(True)\n\nmapper = vtkDataSetMapper()\nmapper.SetInputConnection(surface_filter.GetOutputPort())\nactor = vtkActor()\nactor.GetProperty().SetOpacity(0.5)\nactor.SetMapper(mapper)\n\n# Selection\nselection_extract = vtkExtractSelection()\nselection_mapper = vtkDataSetMapper()\nselection_mapper.SetInputConnection(selection_extract.GetOutputPort())\nselection_actor = vtkActor()\nselection_actor.GetProperty().SetColor(1, 0, 1)\nselection_actor.GetProperty().SetPointSize(5)\nselection_actor.SetMapper(selection_mapper)\nselection_actor.SetVisibility(0)\n\nrenderer.AddActor(actor)\nrenderer.AddActor(selection_actor)\nrenderer.ResetCamera()\n\nselector = vtkHardwareSelector()\nselector.SetRenderer(renderer)\nselector.SetFieldAssociation(vtkDataObject.FIELD_ASSOCIATION_POINTS)\n\n# vtkDataSet to DataFrame\npy_ds = dsa.WrapDataObject(dataset)\npt_data = py_ds.PointData\ncols = {}\nfor name in pt_data.keys():\n    array = pt_data[name]\n    shp = array.shape\n    if len(shp) == 1:\n        cols[name] = array\n    else:\n        for i in range(shp[1]):\n            cols[name + \"_%d\" % i] = array[:, i]\nDATAFRAME = pd.DataFrame(cols)\nFIELD_NAMES = list(cols.keys())\nSELECTED_IDX = []\n\n# -----------------------------------------------------------------------------\n# Callbacks\n# -----------------------------------------------------------------------------\n\n\n@state.change(\"figure_size\", \"scatter_x\", \"scatter_y\")\ndef update_figure(figure_size, scatter_x, scatter_y, **kwargs):\n    if figure_size is None:\n        return\n\n    # Generate figure\n    bounds = figure_size.get(\"size\", {})\n    fig = px.scatter(\n        DATAFRAME,\n        x=scatter_x,\n        y=scatter_y,\n        width=bounds.get(\"width\", 200),\n        height=bounds.get(\"height\", 200),\n    )\n\n    # Update selection settings\n    fig.data[0].update(\n        selectedpoints=SELECTED_IDX,\n        selected={\"marker\": {\"color\": \"red\"}},\n        unselected={\"marker\": {\"opacity\": 0.5}},\n    )\n\n    # Update chart\n    ctrl.update_figure(fig)\n\n\n# -----------------------------------------------------------------------------\n\n\n@state.change(\"vtk_selection\")\ndef update_interactor(vtk_selection, **kwargs):\n    if vtk_selection:\n        rw_interactor.SetInteractorStyle(interactor_selection)\n        interactor_selection.StartSelect()\n    else:\n        rw_interactor.SetInteractorStyle(interactor_trackball)\n\n\n# -----------------------------------------------------------------------------\n\n\ndef on_chart_selection(selected_point_idxs):\n    global SELECTED_IDX\n    SELECTED_IDX = selected_point_idxs if selected_point_idxs else []\n    npts = len(SELECTED_IDX)\n\n    ids = vtkIdTypeArray()\n    ids.SetNumberOfTuples(npts)\n    for idx, p_id in enumerate(SELECTED_IDX):\n        ids.SetTuple1(idx, p_id)\n        idx += 1\n\n    sel_node = vtkSelectionNode()\n    sel_node.GetProperties().Set(\n        vtkSelectionNode.CONTENT_TYPE(), vtkSelectionNode.INDICES\n    )\n    sel_node.GetProperties().Set(vtkSelectionNode.FIELD_TYPE(), vtkSelectionNode.POINT)\n    sel_node.SetSelectionList(ids)\n    sel = vtkSelection()\n    sel.AddNode(sel_node)\n\n    selection_extract.SetInputDataObject(0, py_ds.VTKObject)\n    selection_extract.SetInputDataObject(1, sel)\n    selection_extract.Update()\n    selection_actor.SetVisibility(1)\n\n    # Update 3D view\n    ctrl.view_update()\n\n\ndef on_box_selection_change(selection):\n    global SELECTED_IDX\n\n    actor.GetProperty().SetOpacity(1)\n    selector.SetArea(\n        int(renderer.GetPickX1()),\n        int(renderer.GetPickY1()),\n        int(renderer.GetPickX2()),\n        int(renderer.GetPickY2()),\n    )\n    s = selector.Select()\n    n = s.GetNode(0)\n    ids = dsa.vtkDataArrayToVTKArray(n.GetSelectionData().GetArray(\"SelectedIds\"))\n    surface = dsa.WrapDataObject(surface_filter.GetOutput())\n    SELECTED_IDX = surface.PointData[\"vtkOriginalPointIds\"][ids].tolist()\n\n    selection_extract.SetInputConnection(surface_filter.GetOutputPort())\n    selection_extract.SetInputDataObject(1, s)\n    selection_extract.Update()\n    selection_actor.SetVisibility(1)\n\n    actor.GetProperty().SetOpacity(0.5)\n\n    # Update scatter plot with selection\n    update_figure(**state.to_dict())\n\n    # Update 3D view\n    ctrl.view_update()\n\n    # disable selection mode\n    state.vtk_selection = False\n\n\n# -----------------------------------------------------------------------------\n# Settings\n# -----------------------------------------------------------------------------\n\nDROPDOWN_STYLES = {\n    \"dense\": True,\n    \"hide_details\": True,\n    \"classes\": \"px-2\",\n    \"style\": \"max-width: calc(25vw - 10px);\",\n}\n\nCHART_STYLE = {\n    \"style\": \"position: absolute; left: 50%; transform: translateX(-50%);\",\n    \"display_mode_bar\": (\"true\",),\n    \"mode_bar_buttons_to_remove\": (\n        \"chart_buttons\",\n        [\n            \"toImage\",\n            \"resetScale2d\",\n            \"zoomIn2d\",\n            \"zoomOut2d\",\n            \"toggleSpikelines\",\n            \"hoverClosestCartesian\",\n            \"hoverCompareCartesian\",\n        ],\n    ),\n    \"display_logo\": (\"false\",),\n}\n\nVTK_VIEW_SETTINGS = {\n    \"interactive_ratio\": 1,\n    \"interactive_quality\": 80,\n}\n\n# -----------------------------------------------------------------------------\n# UI\n# -----------------------------------------------------------------------------\n\nstate.trame__title = \"VTK selection\"\nctrl.on_server_ready.add(ctrl.view_update)\n\nwith SinglePageLayout(server) as layout:\n    layout.title.set_text(\"VTK & plotly\")\n    layout.icon.click = ctrl.view_reset_camera\n\n    with layout.toolbar as tb:\n        tb.dense = True\n        vuetify.VSpacer()\n        vuetify.VSelect(\n            v_model=(\"scatter_y\", FIELD_NAMES[1]),\n            items=(\"fields\", FIELD_NAMES),\n            **DROPDOWN_STYLES,\n        )\n        vuetify.VSelect(\n            v_model=(\"scatter_x\", FIELD_NAMES[0]),\n            items=(\"fields\", FIELD_NAMES),\n            **DROPDOWN_STYLES,\n        )\n\n    with layout.content:\n        with vuetify.VContainer(fluid=True, classes=\"fill-height pa-0 ma-0\"):\n            with vuetify.VRow(dense=True, style=\"height: 100%;\"):\n                with vuetify.VCol(\n                    classes=\"pa-0\",\n                    style=\"border-right: 1px solid #ccc; position: relative;\",\n                ):\n                    view = vtk.VtkRemoteView(\n                        render_window,\n                        box_selection=(\"vtk_selection\",),\n                        box_selection_change=(on_box_selection_change, \"[$event]\"),\n                        **VTK_VIEW_SETTINGS,\n                    )\n                    # view = vtk.VtkLocalView(\n                    #     render_window,\n                    #     box_selection=(\"vtk_selection\",),\n                    #     box_selection_change=(on_box_selection_change, \"[$event]\"),\n                    #     **VTK_VIEW_SETTINGS,\n                    # )\n                    ctrl.view_update = view.update\n                    ctrl.view_reset_camera = view.reset_camera\n                    vuetify.VCheckbox(\n                        small=True,\n                        on_icon=\"mdi-selection-drag\",\n                        off_icon=\"mdi-rotate-3d\",\n                        v_model=(\"vtk_selection\", False),\n                        style=\"position: absolute; top: 0; right: 0; z-index: 1;\",\n                        dense=True,\n                        hide_details=True,\n                    )\n                with vuetify.VCol(classes=\"pa-0\"):\n                    with trame.SizeObserver(\"figure_size\"):\n                        html_plot = plotly.Figure(\n                            selected=(\n                                on_chart_selection,\n                                \"[$event?.points.map(({pointIndex}) => pointIndex)]\",\n                            ),\n                            **CHART_STYLE,\n                        )\n                        ctrl.update_figure = html_plot.update\n\n# -----------------------------------------------------------------------------\n# Main\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    server.start()\n
"},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/","title":"SimpleCone","text":"

vtk-examples/Trame/MiniApps/SimpleCone

"},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#description","title":"Description","text":"

This example illustrates basic usage of VTK with trame.

Things you can do:

  • Add some color using vtkNamedColors to the actor and background.
  • Use a different source e.g. vtkCylinderSource instead of vtkConeSource.

See: Cone for some ideas.

Question

If you have a question about this example, please use the VTK Discourse Forum

"},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#download-and-build-simplecone","title":"Download and Build SimpleCone","text":"

Click here to download SimpleCone. Once the tarball SimpleCone.tar has been downloaded and extracted,

cd SimpleCone\n

and run the application.

See this trame tutorial for instructions on how to setup trame and run the application.

"},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#code","title":"Code","text":""},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#remoterenderingpy","title":"RemoteRendering.py","text":"
from trame import state\nfrom trame.html import vuetify, vtk\nfrom trame.layouts import SinglePage\n\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkPolyDataMapper,\n    vtkActor,\n)\n\n# VTK factory initialization\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch  # noqa\nimport vtkmodules.vtkRenderingOpenGL2  # noqa\n\n# -----------------------------------------------------------------------------\n# VTK code\n# -----------------------------------------------------------------------------\n\nDEFAULT_RESOLUTION = 6\n\nrenderer = vtkRenderer()\nrenderWindow = vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n\nrenderWindowInteractor = vtkRenderWindowInteractor()\nrenderWindowInteractor.SetRenderWindow(renderWindow)\nrenderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\ncone_source = vtkConeSource()\nmapper = vtkPolyDataMapper()\nactor = vtkActor()\nmapper.SetInputConnection(cone_source.GetOutputPort())\nactor.SetMapper(mapper)\nrenderer.AddActor(actor)\nrenderer.ResetCamera()\nrenderWindow.Render()\n\n\n@state.change(\"resolution\")\ndef update_cone(resolution=DEFAULT_RESOLUTION, **kwargs):\n    cone_source.SetResolution(resolution)\n    html_view.update()\n\n\ndef update_reset_resolution():\n    state.resolution = DEFAULT_RESOLUTION\n\n\n# -----------------------------------------------------------------------------\n# GUI\n# -----------------------------------------------------------------------------\n\nhtml_view = vtk.VtkRemoteView(renderWindow, ref=\"view\")\n\nlayout = SinglePage(\"VTK Remote rendering\", on_ready=update_cone)\nlayout.logo.click = html_view.reset_camera\nlayout.title.set_text(\"Cone Application\")\n\nwith layout.toolbar:\n    vuetify.VSpacer()\n    vuetify.VSlider(\n        v_model=(\"resolution\", DEFAULT_RESOLUTION),\n        min=3,\n        max=60,\n        step=1,\n        hide_details=True,\n        dense=True,\n        style=\"max-width: 300px\",\n    )\n    vuetify.VDivider(vertical=True, classes=\"mx-2\")\n    with vuetify.VBtn(icon=True, click=update_reset_resolution):\n        vuetify.VIcon(\"mdi-undo-variant\")\n\nwith layout.content:\n    vuetify.VContainer(\n        fluid=True,\n        classes=\"pa-0 fill-height\",\n        children=[html_view],\n    )\n\n# Uncomment following line to hide footer\n# layout.footer.hide()\n\n# Uncomment following line to change logo to use mdi icon\n# layout.logo.children = [vuetify.VIcon('mdi-menu')]\n\n# -----------------------------------------------------------------------------\n# Main\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    layout.start()\n
"},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#code_1","title":"Code","text":""},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#localrenderingpy","title":"LocalRendering.py","text":"
from trame import state\nfrom trame.html import vuetify, vtk\nfrom trame.layouts import SinglePage\n\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkPolyDataMapper,\n    vtkActor,\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch  # noqa\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nDEFAULT_RESOLUTION = 6\n\nrenderer = vtkRenderer()\nrenderWindow = vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n\nrenderWindowInteractor = vtkRenderWindowInteractor()\nrenderWindowInteractor.SetRenderWindow(renderWindow)\nrenderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\ncone_source = vtkConeSource()\nmapper = vtkPolyDataMapper()\nactor = vtkActor()\nmapper.SetInputConnection(cone_source.GetOutputPort())\nactor.SetMapper(mapper)\nrenderer.AddActor(actor)\nrenderer.ResetCamera()\nrenderWindow.Render()\n\n# -----------------------------------------------------------------------------\n# Callbacks\n# -----------------------------------------------------------------------------\n\n\n@state.change(\"resolution\")\ndef update_cone(resolution=DEFAULT_RESOLUTION, **kwargs):\n    cone_source.SetResolution(resolution)\n    html_view.update()\n\n\ndef update_reset_resolution():\n    state.resolution = DEFAULT_RESOLUTION\n\n\n# -----------------------------------------------------------------------------\n# GUI\n# -----------------------------------------------------------------------------\n\nhtml_view = vtk.VtkLocalView(renderWindow, ref=\"view\")\n\nlayout = SinglePage(\"VTK Remote View - Local Rendering\", on_ready=update_cone)\nlayout.logo.click = html_view.reset_camera\nlayout.title.set_text(\"Cone Application\")\n\nwith layout.toolbar:\n    vuetify.VSpacer()\n    vuetify.VSlider(\n        v_model=(\"resolution\", DEFAULT_RESOLUTION),\n        min=3,\n        max=60,\n        step=1,\n        hide_details=True,\n        dense=True,\n        style=\"max-width: 300px\",\n    )\n    vuetify.VDivider(vertical=True, classes=\"mx-2\")\n    with vuetify.VBtn(icon=True, click=update_reset_resolution):\n        vuetify.VIcon(\"mdi-undo-variant\")\n\n\nwith layout.content:\n    vuetify.VContainer(\n        fluid=True,\n        classes=\"pa-0 fill-height\",\n        children=[html_view],\n    )\n\n\n# -----------------------------------------------------------------------------\n# Main\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    layout.start()\n
"},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#code_2","title":"Code","text":""},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#clientviewpy","title":"ClientView.py","text":"
from trame import state\nfrom trame.html import vuetify, vtk\nfrom trame.layouts import SinglePage\n\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nDEFAULT_RESOLUTION = 6\n\ncone_generator = vtkConeSource()\n\n# -----------------------------------------------------------------------------\n# Callbacks\n# -----------------------------------------------------------------------------\n\n\n@state.change(\"resolution\")\ndef update_cone(resolution=DEFAULT_RESOLUTION, **kwargs):\n    cone_generator.SetResolution(resolution)\n    html_polydata.update()\n\n\ndef update_reset_resolution():\n    state.resolution = DEFAULT_RESOLUTION\n\n\n# -----------------------------------------------------------------------------\n# GUI\n# -----------------------------------------------------------------------------\n\nhtml_polydata = vtk.VtkPolyData(\"cone\", dataset=cone_generator)\n\nlayout = SinglePage(\"VTK Local rendering\", on_ready=update_cone)\nlayout.logo.click = \"$refs.view.resetCamera()\"\nlayout.title.set_text(\"Cone Application\")\n\nwith layout.toolbar:\n    vuetify.VSpacer()\n    vuetify.VSlider(\n        v_model=(\"resolution\", DEFAULT_RESOLUTION),\n        min=3,\n        max=60,\n        step=1,\n        hide_details=True,\n        dense=True,\n        style=\"max-width: 300px\",\n    )\n    vuetify.VDivider(vertical=True, classes=\"mx-2\")\n\n    with vuetify.VBtn(icon=True, click=update_reset_resolution):\n        vuetify.VIcon(\"mdi-undo-variant\")\n\n\nwith layout.content:\n    with vuetify.VContainer(fluid=True, classes=\"pa-0 fill-height\"):\n        with vtk.VtkView():\n            vtk.VtkGeometryRepresentation(html_polydata)\n\n\n# -----------------------------------------------------------------------------\n# Main\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    layout.start()\n
"},{"location":"VTKBook/00Preface/","title":"Preface","text":"

Visualization is a great field to work in these days. Advances in computer hardware and software have brought this technology into the reach of nearly every computer system. Even the ubiquitous personal computer now offers specialized 3D graphics hardware at discount prices. And with recent releases of the Windows operating systems such as XP, OpenGL has become the de facto standard API for 3D graphics.

We view visualization and visual computing as nothing less than a new form of communication. All of us have long known the power of images to convey information, ideas, and feelings. Recent trends have brought us 2D images and graphics as evidenced by the variety of graphical user interfaces and business plotting software. But 3D images have been used sparingly, and often by specialists using specialized systems. Now this is changing. We believe we are entering a new era where 3D images, visualizations, and animations will begin to extend, and in some cases, replace the current communication paradigm based on words, mathematical symbols, and 2D images. Our hope is that along the way the human imagination will be freed like never before.

This text and companion software offers one view of visualization. The field is broad, including elements of computer graphics, imaging, computer science, computational geometry, numerical analysis, statistical methods, data analysis, and studies in human perception. We certainly do not pretend to cover the field in its entirety. However, we feel that this text does offer you a great opportunity to learn about the fundamentals of visualization. Not only can you learn from the written word and companion images, but the included software will allow you to practice visualization. You can start by using the sample data we have provided here, and then move on to your own data and applications. We believe that you will soon appreciate visualization as much as we do.

In this, the third edition of Visualization Toolkit textbook, we have added several new features since the first and second editions. Volume rendering is now extensively supported, including the ability to combine opaque surface graphics with volumes. We have added an extensive image processing pipeline that integrates conventional 3D visualization and graphics with imaging. Besides several new filters such as clipping, smoothing, 2D/3D Delaunay triangulation, and new decimation algorithms, we have added several readers and writers, and better support net-based tools such as Java and VRML. VTK now supports cell attributes, and attributes have been generalized into data arrays that are labeled as being scalars, vectors, and so on. Parallel processing, both shared-memory and distributed models, is a major addition. For example, VTK has been used on a large 1024-processor computer at the US National Labs to process nearly a pit-a-pat of data. A suite of 3D widgets is now available in VTK, enabling powerful data interaction techniques. Finally, VTK's cross-platform support has greatly improved with the addition of CMake---a very nice tool for managing the compile process ( http://www.cmake.org ).

The additions of these features required the support of three special contributors to the text: Lisa Sobierajski Avila, Rick Avila, and C. Charles Law. Rick and Lisa worked hard to create an object-oriented design for volume rendering, and to insure that the design and software is fully compatible with the surface-based rendering system. Charles is the principle architect and implementor for the imaging pipeline. We are proud of the streaming and caching capability of the architecture: It allows us to handle large data sets despite limited memory resources.

Especially satisfying has been the response from users of the text and software. Not only have we received a warm welcome from these wonderful people, but many of them have contributed code, bug fixes, data, and ideas that greatly improved the system. In fact, it would be best to categorize these people as co-developers rather than users of the system. We would like to encourage anyone else who is interested in sharing their ideas, code, or data to contact the VTK user community at http://www.vtk.org , or one of the authors. We would very much welcome any contributions you have to make. Contact us at http://www.kitware.com.

"},{"location":"VTKBook/00Preface/#acknowledgments","title":"Acknowledgments","text":"

During the creation of the Visualization Toolkit we were fortunate to have the help of many people. Without their aid this book and the associated software might never have existed. Their contributions included performing book reviews, discussing software ideas, creating a supportive environment, and providing key suggestions for some of our algorithms and software implementations.

We would like to first thank our management at the General Electric Corporate R&D Center who allowed us to pursue this project and utilize company facilities: Peter Meenan, Manager of the Computer Graphics and Systems Program, and Kirby Vosburgh, Manager of the Electronic Systems Laboratory. We would also like to thank management at GE Medical Systems who worked with us on the public versus proprietary software issues: John Lalonde, John Heinen, and Steve Roehm.

We thank our co-workers at the R&D Center who have all been supportive: Matt Turek, for proof reading much of the second edition; also Majeid Alyassin, Russell Blue, Jeanette Bruno, Shane Chang, Nelson Corby, Rich Hammond, Margaret Kelliher, Tim Kelliher, Joyce Langan, Paul Miller, Chris Nafis, Bob Tatar, Chris Volpe, Boris Yamrom, Bill Hoffman (now at Kitware), Harvey Cline and Siegwalt Ludke. We thank former co-workers Skip Montanaro (who created a FAQ for us), Dan McLachlan and Michelle Barry. We'd also like to thank our friends and co-workers at GE Medical Systems: Ted Hudacko (who managed the first VTK users mailing list), Darin Okerlund, and John Skinner. Many ideas, helpful hints, and suggestions to improve the system came from this delightful group of people.

The third edition is now published by Kitware, Inc. We very much appreciate the efforts of the many contributors at Kitware who have helped make VTK one of the leading visualization systems in the world today. S\u00e9bastien Barr\u00e9, Andy Cedilnik, Berk Geveci, Amy Henderson, and Brad King have each made significant contributions. Thank also to the folks at GE Global Research such as Jim Miller who continue to push the quality of the system, particularly with the creation of the DART system for regression testing. The US National Labs, led by Jim Ahrens of Los Alamos, has been instrumental in adding parallel processing support to VTK. An additional special thanks to Kitware for accepting the challenge of publishing this book.

Many of the bug fixes and improvements found in the second and third editions came from talented people located around the world. Some of these people are acknowledged in the software and elsewhere in the text, but most of them have contributed their time, knowledge, code, and data without regard for recognition and acknowledgment. It is this exchange of ideas and information with people like this that makes the Visualization Toolkit such a fun and exciting project to work on. In particular we would like to thank John Biddiscombe, Charl P. Botha, David Gobbi, Tim Hutton, Dean Inglis, and Prabhu Ramachandran. Thank you very much.

A special thanks to the software and text reviewers who spent their own time to track down some nasty bugs, provide examples, and offer suggestions and improvements. Thank you Tom Citriniti, Mark Miller, George Petras, Hansong Zhang, Penny Rheingans, Paul Hinker, Richard Ellson, and Roger Crawfis. We'd also like to mention that Tom Citriniti at Rensselaer, and Penny Rheingans at the University of Mississippi (now at the University of Maryland Baltimore County) were the first faculty members to teach from early versions of this text. Thank you Penny and Tom for your feedback and extra effort.

Most importantly we would like to thank our friends and loved ones who supported us patiently during this project. We know that you shouldered extra load for us. You certainly saw a lot less of us! But we're happy to say that we're back. Thank you.

"},{"location":"VTKBook/01Chapter1/","title":"Chapter 1 - Introduction","text":"

Visualization transforms numbers to images.

Visualization --- \"2: the act or process of interpreting in visual terms or of putting into visual form,\" Webster's Ninth New Collegiate Dictionary.

"},{"location":"VTKBook/01Chapter1/#11-what-is-visualization","title":"1.1 What Is Visualization?","text":"

Visualization is a part of our everyday life. From weather maps to the exciting computer graphics of the entertainment industry, examples of visualization abound. But what is visualization? Informally, visualization is the transformation of data or information into pictures. Visualization engages the primary human sensory apparatus, vision, as well as the processing power of the human mind. The result is a simple and effective medium for communicating complex and/or voluminous information.

"},{"location":"VTKBook/01Chapter1/#terminology","title":"Terminology","text":"

Different terminology is used to describe visualization. Scientific visualization is the formal name given to the field in computer science that encompasses user interface, data representation and processing algorithms, visual representations, and other sensory presentation such as sound or touch [McCormick87]. The term data visualization is another phrase used to describe visualization. Data visualization is generally interpreted to be more general than scientific visualization, since it implies treatment of data sources beyond the sciences and engineering. Such data sources include financial, marketing, or business data. In addition, the term data visualization is broad enough to include application of statistical methods and other standard data analysis techniques [Rosenblum94]. Another recently emerging term is information visualization. This field endeavors to visualize abstract information such as hypertext documents on the World Wide Web, directory/ file structures on a computer, or abstract data structures [InfoVis95]. A major challenge facing information visualization researchers is to develop coordinate systems, transformation methods, or structures that meaningfully organize and represent data.

Another way to classify visualization technology is to examine the context in which the data exists. If the data is spatial-temporal in nature (up to three spatial coordinates and the time dimension) then typically methods from scientific visualization are used. If the data exists in higher-dimensional spaces, or abstract spaces, then methods from information visualization are used. This distinction is important, because the human perceptual system is highly tuned to space-time relationships. Data expressed in this coordinate system is inherently understood with little need for explanation. Visualization of abstract data typically requires extensive explanations as to what is being viewed. This is not to say that there is no overlap between scientific and information visualization---often the first step in the information visualization process is to project abstract data into the spatial-temporal domain, and then use the methods of scientific visualization to view the results. The projection process can be quite complex, involving methods of statistical graphics, data mining, and other techniques, or it may be as simple as selecting a lower-dimensional subset of the original data.

In this text we use the term data visualization instead of the more specific terms scientific visualization or information visualization. We feel that scientific visualization is too narrow a description of the field, since visualization techniques have moved beyond the scientific domain and into areas of business, social science, demographics, and information management in general. We also feel that the term data visualization is broad enough to encompass the term information visualization.

"},{"location":"VTKBook/01Chapter1/#examples-of-visualization","title":"Examples of Visualization","text":"

Perhaps the best definition of visualization is offered by example. In many cases visualization is influencing peoples' lives and performing feats that a few years ago would have been unimaginable. A prime example of this is its application to modern medicine.

Computer imaging techniques have become an important diagnostic tool in the practice of modern medicine. These include techniques such as X-ray Computed Tomography (CT) and Magnetic Resonance Imaging (MRI). These techniques use a sampling or data acquisition process to capture information about the internal anatomy of a living patient. This information is in the form of slice-planes or cross-sectional images of a patient, similar to conventional photographic X-rays. CT imaging uses many pencil thin X-rays to acquire the data, while MRI combines large magnetic fields with pulsed radio waves. Sophisticated mathematical techniques are used to reconstruct the slice-planes. Typically, many such closely spaced slices are gathered together into a volume of data to complete the study.

As acquired from the imaging system, a slice is a series of numbers representing the attenuation of X-rays (CT) or the relaxation of nuclear spin magnetization (MRI) [Krestel90]. On any given slice these numbers are arranged in a matrix, or regular array. The amount of data is large, so large that it is not possible to understand the data in its raw form. However, by assigning to these numbers a gray scale value, and then displaying the data on a computer screen, structure emerges. This structure results from the interaction of the human visual system with the spatial organization of the data and the gray-scale values we have chosen. What the computer represents as a series of numbers, we see as a cross section through the human body: skin, bone, and muscle. Even more impressive results are possible when we extend these techniques into three dimensions. Image slices can be gathered into volumes and the volumes can be processed to reveal complete anatomical structures. Using modern techniques, we can view the entire brain, skeletal system, and vascular system on a living patient without interventional surgery. Such capability has revolutionized modern medical diagnostics, and will increase in importance as imaging and visualization technology matures.

Another everyday application of visualization is in the entertainment industry. Movie and television producers routinely use computer graphics and visualization to create entire worlds that we could never visit in our physical bodies. In these cases we are visualizing other worlds as we imagine them, or past worlds we suppose existed. It's hard to watch the movies such as Jurassic Park and Toy Story and not gain a deeper appreciation for the awesome Tyrannosaurus Rex, or to be charmed by Toy Story 's heroic Buzz Lightyear.

Morphing is another popular visualization technique widely used in the entertainment industry. Morphing is a smooth blending of one object into another. One common application is to morph between two faces. Morphing has also been used effectively to illustrate car design changes from one year to the next. While this may seem like an esoteric application, visualization techniques are used routinely to present the daily weather report. The use of isovalue, or contour, lines to display areas of constant temperature, rainfall, and barometric pressure has become a standard tool in the daily weather report.

Many early uses of visualization were in the engineering and scientific community. From its inception the computer has been used as a tool to simulate physical processes such as ballistic trajectories, fluid flow, and structural mechanics. As the size of the computer simulations grew, it became necessary to transform the resulting calculations into pictures. The amount of data overwhelmed the ability of the human to assimilate and understand it. In fact, pictures were so important that early visualizations were created by manually plotting data. Today, we can take advantage of advances in computer graphics and computer hardware. But, whatever the technology, the application of visualization is the same: to display the results of simulations, experiments, measured data, and fantasy; and to use these pictures to communicate, understand, and entertain.

"},{"location":"VTKBook/01Chapter1/#12-why-visualize","title":"1.2 Why Visualize?","text":"

Visualization is a necessary tool to make sense of the flood of information in today's world of computers. Satellites, supercomputers, laser digitizing systems, and digital data acquisition systems acquire, generate, and transmit data at prodigious rates. The Earth-Orbiting Satellite (EOS) transmits terabytes of data every day. Laser scanning systems generate over 500,000 points in a 15 second scan [Waters91]. Supercomputers model weather patterns over the entire earth [Chen93]. In the first four months of 1995, the New York Stock Exchange processed, on average, 333 million transactions per day [NYTimes]. Without visualization, most of this data would sit unseen on computer disks and tapes. Visualization offers some hope that we can extract the important information hidden within the data.

There is another important element to visualization: It takes advantage of the natural abilities of the human vision system. Our vision system is a complex and powerful part of our bodies. We use it and rely on it in almost everything we do. Given the environment in which our ancestors lived, it is not surprising that certain senses developed to help them survive. As we described earlier in the example of a 2D MRI scan, visual representations are easier to work with. Not only do we have strong 2D visual abilities, but also we are adept at integrating different viewpoints and other visual clues into a mental image of a 3D object or plot. This leads to interactive visualization, where we can manipulate our viewpoint. Rotating about the object helps to achieve a better understanding. Likewise, we have a talent for recognizing temporal changes in an image. Given an animation consisting of hundreds of frames, we have an uncanny ability to recognize trends and spot areas of rapid change.

With the introduction of computers and the ability to generate enormous amounts of data, visualization offers the technology to make the best use of our highly developed visual senses. Certainly other technologies such as statistical analysis, artificial intelligence, mathematical filtering, and sampling theory will play a role in large-scale data processing. However, because visualization directly engages the vision system and human brain, it remains an unequaled technology for understanding and communicating data.

Visualization offers significant financial advantages as well. In today's competitive markets, computer simulation teamed with visualization can reduce product cost and improve time to market. A large cost of product design has been the expense and time required to create and test design prototypes. Current design methods strive to eliminate these physical prototypes, and replace them with digital equivalents. This digital prototyping requires the ability to create and manipulate product geometry, simulate the design under a variety of operating conditions, develop manufacturing techniques, demonstrate product maintenance and service procedures, and even train operators on the proper use of the product before it is built. Visualization plays a role in each case. Already CAD systems are used routinely to model product geometry and design manufacturing procedures. Visualization enables us to view the geometry, and see special characteristics such as surface curvature. For instance, analysis techniques such as finite element, finite difference, and boundary element techniques are used to simulate product performance; and visualization is used to view the results. Recently, human ergonomics and anthropometry are being analyzed using computer techniques in combination with visualization [MDHMS]. Three-dimensional graphics and visualization are being used to create training sequences. Often these are incorporated into a hypertext document or World Wide Web (WWW) pages. Another practical use of graphics and visualization has been in-flight simulators. This has been shown to be a significant cost savings as compared to flying real airplanes and is an effective training method.

"},{"location":"VTKBook/01Chapter1/#13-imaging-computer-graphics-and-visualization","title":"1.3 Imaging, Computer Graphics, and Visualization","text":"

There is confusion surrounding the difference between imaging, computer graphics, and visualization. We offer these definitions.

  • Imaging, or image processing, is the study of 2D pictures, or images. This includes techniques to transform (e.g., rotate, scale, shear), extract information from, analyze, and enhance images.
Figure 1-1. The visualization process. Data from various sources is repeatedly transformed to extract, derive, and enhance information. The resulting data is mapped to a graphics system for display.
  • Computer graphics is the process of creating images using a computer. This includes both 2D paint-and-draw techniques as well as more sophisticated 3D drawing (or rendering) techniques.

  • Visualization is the process of exploring, transforming, and viewing data as images (or other sensory forms) to gain understanding and insight into the data.

Based on these definitions we see that there is overlap between these fields. The output of computer graphics is an image, while the output of visualization is often produced using computer graphics. Sometimes visualization data is in the form of an image, or we wish to visualize object geometry using realistic rendering techniques from computer graphics.

Generally speaking we distinguish visualization from computer graphics and image processing in three ways.

  1. The dimensionality of data is three dimensions or greater. Many well-known methods are available for data of two dimensions or less; visualization serves best when applied to data of higher dimension.

  2. Visualization concerns itself with data transformation. That is, information is repeatedly created and modified to enhance the meaning of the data.

  3. Visualization is naturally interactive, including the human directly in the process of creating, transforming, and viewing data.

Another perspective is that visualization is an activity that encompasses the process of exploring and understanding data. This includes both imaging and computer graphics as well as data processing and filtering, user interface methodology, computational techniques, and software design. Figure 1-1 depicts this process.

As this figure illustrates we see that the visualization process focuses on data. In the first step data is acquired from some source. Next, the data is transformed by various methods, and then mapped to a form appropriate for presentation to the user. Finally, the data is rendered or displayed, completing the process. Often, the process repeats as the data is better understood or new models are developed. Sometimes the results of the visualization can directly control the generation of the data. This is often referred to as analysis steering. Analysis steering is an important goal of visualization because it enhances the interactivity of the overall process.

"},{"location":"VTKBook/01Chapter1/#14-origins-of-data-visualization","title":"1.4 Origins of Data Visualization","text":"

The origin of visualization as a formal discipline dates to the 1987 NSF report Visualization in Scientific Computing [McCormick87]. That report coined the term scientific visualization. Since then the field has grown rapidly with major conferences, such as IEEE Visualization, becoming well established. Many large computer graphics conferences, for example ACM SIGGRAPH, devote large portions of their program to visualization technology.

Of course, data visualization technology had existed for many years before the 1987 report referenced [Tufte83]. The first practitioners recognized the value of presenting data as images. Early pictorial data representations were created during the eighteenth century with the arrival of statistical graphics. It was only with the arrival of the digital computer and the development of the field of computer graphics, that visualization became a practicable discipline.

The future of data visualization and graphics appears to be explosive. Just a few decades ago, the field of data visualization did not exist and computer graphics was viewed as an offshoot of the more formal discipline of computer science. As techniques were created and computer power increased, engineers, scientists, and other researchers began to use graphics to understand and communicate data. At the same time, user interface tools were being developed. These forces have now converged to the point where we expect computers to adapt to humans rather than the other way around. As such, computer graphics and data visualization serve as the window into the computer, and more importantly, into the data that computers manipulate. Now, with the visualization window, we can extract information from data and analyze, understand, and manage more complex systems than ever before.

Dr. Fred Brooks, Kenan Professor of Computer Science at the University of North Carolina at Chapel Hill and recipient of the John von Neumann Medal of the IEEE, puts it another way. At the award presentation at the ACM SIGGRAPH '94, Dr. Brooks stated that computer graphics and visualization offer \"intelligence amplification\" (IA) as compared to artificial intelligence (AI). Besides the deeper philosophical issues surrounding this issue (e.g., human before computer), it is a pragmatic observation. While the long-term goal of AI has been to develop computer systems that could replace humans in certain applications, the lack of real progress in this area has lead some researchers to view the role of computers as amplifiers and assistants to humans. In this view, computer graphics and visualization play a significant role, since arguably the most effective human/ computer interface is visual. Recent gains in computer power and memory are only accelerating this trend, since it is the interface between the human and the computer that often is the obstacle to the effective application of the computer.

"},{"location":"VTKBook/01Chapter1/#15-purpose-of-this-book","title":"1.5 Purpose of This Book","text":"

There currently exist texts that define and describe data visualization, many of them using case studies to illustrate techniques and typical applications. Some provide high-level descriptions of algorithms or visualization system architectures. Detailed descriptions are left to academic journals or conference proceedings. What these texts lack is a way to practice visualization. Our aim in this text is to go beyond descriptions and provide tools to learn about and apply visualization to your own application area. In short, the purpose of the book is fourfold.

  1. Describe visualization algorithms and architectures in detail.

  2. Demonstrate the application of data visualization to a broad selection of case studies.

  3. Provide a working architecture and software design for application of data visualization to real-world problems.

  4. Provide effective software tools packaged in a C++ class library. We also provide language bindings for the interpreted languages Tcl, Python, and Java.

Taken together, we refer to the text and software as the Visualization Toolkit, or VTK for short. Our hope is that you can use the text to learn about the fundamental concepts of visualization, and then adapt the computer code to your own applications and data.

"},{"location":"VTKBook/01Chapter1/#16-what-this-book-is-not","title":"1.6 What This Book Is Not","text":"

The purpose of this book is not to provide a rigorous academic treatise on data visualization. Nor do we intend to include an exhaustive survey of visualization technology. Our goal is to bridge the formal discipline of data visualization with practical application, and to provide a solid technical overview of this emerging technology. In many cases we refer you to the included software to understand implementation details. You may also wish to refer to the appropriate references for further information.

"},{"location":"VTKBook/01Chapter1/#17-intended-audience","title":"1.7 Intended Audience","text":"

Our primary audience is computer users who create, analyze, quantify, and/or process data. We assume a minimal level of programming skill. If you can write simple computer code to import data and know how to run a computer program, you can practice data visualization with the software accompanying this book.

As we wrote this book we also had in mind educators and students of introductory computer graphics and visualization courses. In more advanced courses this text may not be rigorous enough to serve as sole reference. In these instances, this book will serve well as a companion text, and the software is well suited as a foundation for programming projects and class exercises.

Educators and students in other disciplines may also find the text and software to be valuable tools for presenting results. Courses in numerical analysis, computer science, business simulation, chemistry, dynamic systems, and engineering simulations, to name a few, often require large-scale programming projects that create large amounts of data. The software tools provided here are easy to learn and readily adapted to different data sources. Students can incorporate this software into their work to display and analyze their results.

"},{"location":"VTKBook/01Chapter1/#18-how-to-use-this-book","title":"1.8 How to Use This Book","text":"

There are a number of approaches you can take to make effective use of this book. The particular approach depends on your skill level and goals. Three likely paths are as follows:

Novice. You're a novice if you lack basic knowledge of graphics, visualization, or object-oriented principles. Start by reading Chapter 2 if you are unfamiliar with object-oriented principles, Chapter 3 if you are unfamiliar with computer graphics, and Chapter 4 if you are unfamiliar with visualization. Continue by reading the application studies in Chapter 12. You can then move on to the CD-ROM and try out some programming examples. Leave the more detailed treatment of algorithms and data representation until you are familiar with the basics and plan to develop your own applications.

Hacker. You're a hacker if you are comfortable writing your own code and editing other's. Review the examples in Chapter 3, Chapter 4, and Chapter 12. At this point you will want to acquire the companion software guide to this text ( The VTK User's Guide ) or become familiar with the programming resources at http://www.vtk.org. Then retrieve the examples from the CD-ROM and start practicing.

Researcher/Educator. You're a researcher if you develop computer graphics and/or visualization algorithms or if you are actively involved in using and evaluating such systems. You're an educator if you cover aspects of computer graphics and/or visualization within your courses. Start by reading Chapter 2, Chapter 3, and Chapter 4. Select appropriate algorithms from the text and examine the associated source code. If you wish to extend the system, we recommend that you acquire the companion software guide to this text ( The VTK User's Guide ) or become familiar with the programming resources at http://www.vtk.org.

"},{"location":"VTKBook/01Chapter1/#19-software-considerations-and-example-code","title":"1.9 Software Considerations and Example Code","text":"

In writing this book we have attempted to strike a balance between practice and theory. We did not want the book to become a user manual, yet we did want a strong correspondence between algorithmic presentation and software implementation. (Note: The VTK User's Guide published by Kitware, Inc. http://www.kitware.com is recommended as a companion text to this book.) As a result of this philosophy, we have adopted the following approach:

Application versus Design. The book's focus is the application of visualization techniques to real-world problems. We devote less attention to software design issues. Some of these important design issues include: memory management, deriving new classes, shallow versus deep object copy, single versus multiple inheritance, and interfaces to other graphics libraries. Software issues are covered in the companion text The VTK User's Guide published by Kitware, Inc.

Theory versus Implementation. Whenever possible, we separate the theory of data visualization from our implementation of it. We felt that the book would serve best as a reference tool if the theory sections were independent of software issues and terminology. Toward the end of each chapter there are separate implementation or example sections that are implementation specific. Earlier sections are implementation free.

Documentation. This text contains documentation considered essential to understanding the software architecture, including object diagrams and condensed object descriptions. More extensive documentation of object methods and data members is embedded in the software (in the.h header files) and on CD-ROM or online at http://www.vtk.org. In particular, the Doxygen generated manual pages contain detailed descriptions of class relationships, methods, and other attributes.

We use a number of conventions in this text. Imported computer code is denoted with a typewriter font, as are external programs and computer files. To avoid conflict with other C++ class libraries, all class names in VTK begin with the \" vtk\" prefix. Methods are differentiated from variables with the addition of the \" ()\" postfix. (Other conventions are listed in VTK User's Guide.)

All images in this text have been created using the Visualization Toolkit software and data found on the included CD-ROM or from the Web site http://www.vtk.org. In addition, every image has source code (sometimes in C++ and sometimes a Tcl script). We decided against using images from other researchers because we wanted you to be able to practice visualization with every example we present. Each computer generated image indicates the originating file. Files ending in.cxx are C++ code, files ending in.tcl are Tcl scripts. Hopefully these examples can serve as a starting point for you to create your own applications.

To find the example code you will want to search in one of three areas. The standard VTK distribution includes an VTK/Examples directory where many well-documented examples are found. The VTK testing directories VTK/*/Testing, for example, VTK/Graphics/Testing/ Tcl, contain some of the example code used in this text. These examples use the data found in the VTKData distribution. Finally, a separate software distribution, the VTKTextbook distribution, contains examples and data that do not exist in the standard VTK distribution. The VTK, VTKData, and VTKTextbook distributions are found on the included CD-ROM and/or on the web site at http://www.vtk.org.

"},{"location":"VTKBook/01Chapter1/#110-chapter-by-chapter-overview","title":"1.10 Chapter-by-Chapter Overview","text":""},{"location":"VTKBook/01Chapter1/#chapter-2-object-oriented-design","title":"Chapter 2: Object-Oriented Design","text":"

This chapter discusses some of the problems with developing large and/or complex software systems and describes how object-oriented design addresses many of these problems. This chapter defines the key terms used in object-oriented modelling and design and works through a real-world example. The chapter concludes with a brief look at some object-oriented languages and some of the issues associated with object-oriented visualization.

"},{"location":"VTKBook/01Chapter1/#chapter-3-computer-graphics-primer","title":"Chapter 3: Computer Graphics Primer*","text":"

Computer graphics is the means by which our visualizations are created. This chapter covers the fundamental concepts of computer graphics from an application viewpoint. Common graphical entities such as cameras, lights, and geometric primitives are described along with some of the underlying physical equations that govern lighting and image generation. Issues related to currently available graphics hardware are presented, as they affect how and what we choose to render. Methods for interacting with data are introduced.

"},{"location":"VTKBook/01Chapter1/#chapter-4-the-visualization-pipeline","title":"Chapter 4: The Visualization Pipeline","text":"

This chapter explains our methodology for transforming raw data into a meaningful representation that can than be rendered by the graphics system. We introduce the notion of a visualization pipeline, which is similar to a data flow diagram from software engineering. The differences between process objects and data objects are covered, as well as how we resolved issues between performance and memory usage. We explain the advantages to a pipeline network topology regarding execution ordering, result caching, and reference counting.

"},{"location":"VTKBook/01Chapter1/#chapter-5-basic-data-representation","title":"Chapter 5: Basic Data Representation","text":"

There are many types of data produced by the variety of fields that apply visualization. This chapter describes the data objects that we use to represent and access such data. A flexible design is introduced where the programmer can interact with most any type of data using one consistent interface. The three high level components of data (structure, cells, and data attributes) are introduced, and their specific subclasses and components are discussed.

"},{"location":"VTKBook/01Chapter1/#chapter-6-fundamental-algorithms","title":"Chapter 6: Fundamental Algorithms","text":"

Where the preceding chapter deals with data objects, this one introduces process objects. These objects encompass the algorithms that transform and manipulate data. This chapter looks at commonly used techniques for isocontour extraction, scalar generation, color mapping, and vector field display, among others. The emphasis of this chapter is to provide the reader with a basic understanding of the more common and important visualization algorithms.

"},{"location":"VTKBook/01Chapter1/#chapter-7-advanced-computer-graphics","title":"Chapter 7: Advanced Computer Graphics","text":"

This chapter covers advanced topics in computer graphics. The chapter begins by introducing transparency and texture mapping, two topics important to the main thrust of the chapter: volume rendering. Volume rendering is a powerful technique to see inside of 3D objects, and is used to visualize volumetric data. We conclude the chapter with other advanced topics such as stereoscopic rendering, special camera effects, and 3D widgets.

"},{"location":"VTKBook/01Chapter1/#chapter-8-advanced-data-representation","title":"Chapter 8: Advanced Data Representation","text":"

Part of the function of a data object is to store the data. The first chapter on data representation discusses this aspect of data objects. This chapter focuses on basic geometric and topological access methods, and computational operations implemented by the various data objects. The chapter covers such methods as coordinate transformations for data sets, interpolation functions, derivative calculations, topological adjacency operations, and geometric operations such as line intersection and searching.

"},{"location":"VTKBook/01Chapter1/#chapter-9-advanced-algorithms","title":"Chapter 9: Advanced Algorithms","text":"

This chapter is a continuation of Fundamental Algorithms and covers algorithms that are either more complex or less widely used. Scalar algorithms such as dividing cubes are covered along with vector algorithms such as stream ribbons. A large collection of modelling algorithms is discussed, including triangle strip generation, polygon decimation, feature extraction, and implicit modelling. We conclude with a look at some visualization algorithms that utilize texture mapping.

"},{"location":"VTKBook/01Chapter1/#chapter-10-image-processing","title":"Chapter 10: Image Processing","text":"

While 3D graphics and visualization is the focus of the book, image processing is an important tool for preprocessing and manipulating data. In this chapter we focus on several important image processing algorithms, as well as describe how we use a streaming data representation to process large datasets.

"},{"location":"VTKBook/01Chapter1/#chapter-11-visualization-on-the-web","title":"Chapter 11: Visualization on the Web","text":"

The Web is one of the best places to share your visualizations. In this chapter we show you how to write Java-based visualization applications, and how to create VRML (Virtual Reality Modelling Language) data files for inclusion in your own Web content.

"},{"location":"VTKBook/01Chapter1/#chapter-12-application","title":"Chapter 12: Application","text":"

In this chapter we tie the previous chapters together by working through a series of case studies from a variety of application areas. For each case, we briefly describe the application and what information we expect to obtain through the use of visualization. Then, we walk through the design and resulting source code to demonstrate the use of the tools described earlier in the text.

"},{"location":"VTKBook/01Chapter1/#111-legal-considerations","title":"1.11 Legal Considerations","text":"

We make no warranties, expressly or implied, that the computer code contained in this text is free of error or will meet your requirements for any particular application. Do not use this code in any application where coding errors could result in injury to a person or loss of property. If you do use the code in this way, it is at your own risk. The authors and publisher disclaim all liability for direct or consequential damages resulting from your use of this code.

The computer code contained in this text is copyrighted. We grant permission for you to use, copy, and distribute this software for any purpose. However, you may not modify and then redistribute the software. Some of the algorithms presented here are implementations of patented software. If you plan to use this software for commercial purposes, please insure that applicable patent laws are observed.

Some of the data on the CD-ROM may be freely distributed or used (with appropriate acknowledgment). Refer to the local README files or other documentation for details.

Several registered trademarks are used in this text. UNIX is a trademark of UNIX System Laboratories. Sun Workstation and XGL are trademarks of Sun Microsystems, Inc. Microsoft, MS, MS-DOS, and Windows are trademarks of Microsoft Corporation. The X Window System is a trademark of the Massachusetts Institute of Technology. Starbase and HP are trademarks of Hewlett-Packard Inc. Silicon Graphics and OpenGL, are trademarks of Silicon Graphics, Inc. Macintosh is a trademark of Apple Computer. RenderMan is a trademark of Pixar.

"},{"location":"VTKBook/01Chapter1/#112-bibliographic-notes","title":"1.12 Bibliographic Notes","text":"

A number of visualization texts are available. The first six texts listed in the reference section are good general references ( [Nielson90], [Patrikalakis91], [Brodlie92], [Wolff93], [Rosenblum94], and [Gallagher95] ). Gallagher [Gallagher95] is particularly valuable if you are from a computational background. Wolff and Yaeger [Wolff93] contains many beautiful images and is oriented towards Apple Macintosh users. The text includes a CD-ROM with images and software.

You may also wish to learn more about computer graphics and imaging. Foley and van Dam [FoleyVanDam90] is the basic reference for computer graphics. Another recommended text is [BurgerGillies89]. Suggested reference books on computer imaging are [Pavlidis82] and [Wolberg90].

Two texts by Tufte [Tufte83] [Tufte90] are particularly impressive. Not only are the graphics superbly done, but the fundamental philosophy of data visualization is articulated. He also describes the essence of good and bad visualization techniques.

Another interesting text is available from Siemens, a large company offering medical imaging systems [Krestel90]. This text describes the basic concepts of imaging technology, including MRI and CT. This text is only for those users with a strong mathematical background. A less mathematical overview of MRI is available from [SmithRanallo89].

To learn more about programming with Visualization Toolkit, we recommend the text The VTK User's Guide [UsersGuide]. This text has an extensive example suite as well as descriptions of the internals of the software. Programming resources including a detailed description of API's, VTK file formats, and class descriptions are provided.

"},{"location":"VTKBook/01Chapter1/#113-references","title":"1.13 References","text":"

[Brodlie92]1 K. W. Brodlie et al. Scientific Visualization Techniques and Applications. Springer-Verlag, Berlin, 1992.

[BurgerGillies89] P. Burger and D. Gillies. Interactive Computer Graphics Functional, Procedural and Device-Level Methods. Addison-Wesley Publishing Company, Reading, MA, 1989.

[Chen93] P. C. Chen. \"A Climate Simulation Case Study.\" In Proceedings of Visualization '93. pp. 397--401, IEEE Computer Society Press, Los Alamitos, CA, 1993.

[FoleyVanDam90] J. D. Foley, A. van Dam, S. K. Feiner, and J. F. Hughes. Computer Graphics Principles and Practice (2d Ed). Addison-Wesley, Reading, MA, 1990.

[Gallagher95] R. S. Gallagher (ed). Computer Visualization Graphics Techniques for Scientific and Engineering Analysis. CRC Press, Boca Raton, FL, 1995.

[Krestel90] E. Krestel (ed). Imaging Systems for Medical Diagnostics. Siemens-Aktienges, Munich, 1990.

[InfoVis95] The First Information Visualization Symposium. IEEE Computer Society Press, Los Alamitos, CA, 1995.

[McCormick87] B. H. McCormick, T. A. DeFanti, and M. D. Brown. \"Visualization in Scientific Computing.\" Report of the NSF Advisory Panel on Graphics, Image Processing and Workstations , 1987.

[MDHMS] McDonnell Douglas Human Modeling System Reference Manual. Report MDC 93K0281. McDonnell Douglas Corporation, Human Factors Technology, Version 2.1, July 1993.

[Nielson90] G. M. Nielson and B. Shriver (eds). Visualization in Scientific Computing. IEEE Computer Society Press, Los Alamitos, CA, 1990.

[NYTimes] The New York Times Business Day, Tuesday, May 2, 1995.

[Patrikalakis91] N. M. Patrikalakis (ed). Scientific Visualization of Physical Phenomena. Springer-Verlag, Berlin, 1991.

[Pavlidis82] T. Pavlidis. Graphics and Image Processing. Computer Science Press, Rockville, MD, 1982.

[Rosenblum94] L. Rosenblum et al. Scientific Visualization Advances and Challenges. Harcourt Brace & Company, London, 1994.

[SmithRanallo89] H. J. Smith and F. N. Ranallo. A Non-Mathematical Approach to Basic MRI. Medical Physics Publishing Corporation, Madison, WI, 1989.

[Tufte83] E. R. Tufte. The Visual Display of Quantitative Information. Graphics Press, Cheshire, CT, 1990.

[Tufte90] E. R. Tufte. Envisioning Information. Graphics Press, Cheshire, CT, 1990.

[UsersGuide] W. Schroeder, ed. The VTK User's Guide. Kitware, Inc. http://www.kitware.com.

[Waters91] K. Waters and D. Terzopoulos. \"Modeling and Animating Faces Using Scanned Data.\" Visualization and Computer Animation. 2:123--128, 1991.

[Wolberg90] G. Wolberg. Digital Image Warping. IEEE Computer Society Press, Los Alamitos, CA, 1990.

[Wolff93] R. S. Wolff and L. Yaeger. Visualization of Natural Phenomena. TELOS, Springer-Verlag, Santa Clara, CA, 1993.

"},{"location":"VTKBook/02Chapter2/","title":"Chapter 2 - Object-Oriented Design","text":"

Object-oriented systems are becoming widespread in the computer industry for good reason. Object-oriented systems are more modular, easier to maintain, and easier to describe than traditional procedural systems. Since the Visualization Toolkit has been designed and implemented using object-oriented design, we devote this chapter to summarizing the concepts and practice of object-oriented design and implementation.

"},{"location":"VTKBook/02Chapter2/#21-introduction","title":"2.1 Introduction","text":"

Today's software systems try to solve complex, real-world problems. A rigorous software design and implementation methodology can ease the burden of this complexity. Without such a methodology, software developers can find it difficult to meet a system's specifications. Furthermore, as specifications change and grow, a software system that does not have a solid, underlying architecture and design will have difficulty adapting to these expanding requirements.

Our visualization system is a good example of complex software that needs to be designed with extensibility in mind. Data visualization is a rapidly expanding field, with visualization techniques being introduced each year. Any system that hopes to incorporate future innovations must have an underlying design that supports the addition of new material without a significant impact on the existing system.

Object-oriented design is a software engineering methodology that deals comfortably with complexity and provides a framework for later changes and additions. The object-oriented design process attempts to divide a complex task into small and simple pieces called objects. The objects are computer abstractions that model physical or abstract pieces of the system being simulated. Object-oriented design methodologies provide mechanisms to identify the abstractions that exist within a system and to model the behavior of the objects.

"},{"location":"VTKBook/02Chapter2/#22-goals-of-good-software-design","title":"2.2 Goals of Good Software Design","text":"

The quality of a software design is difficult to measure, but some qualitative aspects can guide us. A good software design should be robust, understandable, extensible, modular, maintainable, and reusable.

A robust system handles exceptional conditions gracefully and behaves consistently. Robustness gives software developers confidence that the underlying components of the system will behave as expected, even when the system is used under different circumstances than the original implementor intended.

An understandable system can be used by someone other than the original implementor. The use of the system should seem logical and sensible. The names of the components of the system should be derived from the problem domain.

Extendible systems accept new tasks while still doing the tasks they were originally intended to perform. A system should accept new forms of data and new algorithms without disrupting existing software. Adding a new primitive to the system should not cause large portions of the system to be modified. Experience shows that the more existing code that is modified in a system, the more likely errors will be introduced.

Modular software systems minimize the number of relationships that exist between components of a system. System components that are tightly coupled should be grouped together logically and obey common naming conventions and protocols.

Software maintenance is often ignored during system design. Nevertheless, the total cost of a system includes maintenance as well as the original development. A software system is maintainable if problems are easily isolated and the repair of one problem does not introduce problems in unrelated parts of the system.

Finally, the economics of software development require that we leverage as much of our past work as possible. In an ideal world, the implementation of a new technique in an existing system should be a simple task. This is seldom the case in software systems. Creation of reusable software components can reduce duplication of effort and promote consistent interfaces within a system. However, as we see throughout this book, creating software that can be reused often takes extra effort. A short-term view of productivity by one individual conflicts with the long-term view of the productivity of a software development organization.

"},{"location":"VTKBook/02Chapter2/#23-object-oriented-concepts","title":"2.3 Object-Oriented Concepts","text":"

Objects are the dominating concepts in object-oriented systems. Objects are abstractions that encapsulate the properties and behavior of the entities within a system. Each object has an identity that distinguishes it from other objects in the system. Often, the distinguishable aspects of an object are obvious. For example, a difference in color, location on a screen, size, or contents distinguishes one window from another on a computer desktop. But, appearances can be deceiving, and even two objects that share all the same characteristics may still have different identities. Two automobiles may have the same manufacturer, model, options and colors, but remain two different cars. The real world distinguishes the two cars by a vehicle identification number. Likewise, programming systems that deal with multiple entities need an identity mechanism. A pointer to allocated memory or a variable name in a system-managed symbol table are often used to distinguish objects in a system. In a database system, a set of identifier keys (called an n-tuple) identifies an entity in a system.

But, how do object-oriented systems differ from conventional, procedural programming systems? The major difference is in the way the two approaches treat data abstraction. Conventional systems limit abstraction to data typing, while object-oriented systems create abstractions for both the data and the operations that can be applied to the data. In fact, an object-oriented system keeps the data and operations together in one programming construct called an object. Together, the data and operations comprise an object's properties. When an operation is applied to an object, the programming language's dynamic-binding mechanism executes the procedure that is appropriate for that object. This is not the case in procedure-oriented systems. The programmer must supply logic to decide which procedure to call. Systems that handle multiple types are often littered with case statements to select the appropriate procedure for an operation. As new types are added to these systems, the code that dispatches operations based on data type must be extended to handle the new type. For example, in a program to display different types of primitives, the following pseudo code shows how a procedure-oriented system differs from an object-oriented system.

Procedure oriented (in C):

Primitive *aPrim;\n...\nDrawPrimitive (aPrim)\n...\nprocedure DrawPrimitive (aPrim)\n  {\n  if (aPrim->type == TRIANGLE) then DrawTriangle (aPrim)\n  else if (aPrim->type == SQUARE) then DrawSquare (aPrim)\n  else if (aPrim->type == CIRCLE) then DrawCircle (aPrim)\n  ...\n  }\n

Object-oriented (in C++):

...\naPrim->Draw ();\n...\n

Later in this project's existence, someone may want to add a new primitive, let's say a quadratic. The person assigned with such a formidable task must search the existing system for all occurrences of the if statements in the first example and add a test for the new quadratic type. Of course, a good programmer will have isolated the code in one location, as we have done here, so the task is easier. Nevertheless, that programmer must first realize that the original programmer was skilled enough to modularize the drawing code, then find the code (without necessarily knowing the procedure name) and modify the code. To complicate matters, a system built by more than one programmer will undoubtedly be under a configuration management system, requiring a check-out, edit, and check-in cycle.

The object-oriented programmer has an easier task. Consulting the design document that defines the object properties for a primitive, this programmer adds a draw operation to the quadratic object. The new primitive is available to the system without changing any existing code! Of course, this is an oversimplified example. But think about past programs you have written and remember how hard it was to add a new data type. Were your changes isolated to the new code you added? Did you have to edit code that you did not write and maybe did not understand? Keep this example in mind as you read our object-oriented implementation of a data visualization library.

Before describing object-oriented design and programming in more detail, we provide an observation and prediction. Over the several years that we have designed and implemented software using an object-oriented methodology, we have observed that newcomers to the technique will say, \"But this is how I already write programs. My systems are modular; they're robust; I can easily add to them.\" If you still feel that way after reading this book, do not fault the object-oriented approach. Rather, we have failed as authors. However, such a negative response is unlikely. In our experience, users become comfortable with this approach in a short time. Especially when they are introduced to objects through an existing, well-designed object-oriented system. You will reach the \"aha\" stage, after which it will be difficult to begin a software project without looking for the objects in the problem.

"},{"location":"VTKBook/02Chapter2/#24-object-oriented-terminology","title":"2.4 Object-Oriented Terminology","text":"

As with any software engineering design methodology, object-oriented design has its own terminology. Unfortunately, not everyone agrees on what that is. We adopt much of our terminology from Rumbaugh [Rumbaugh91] and, since the Visualization Toolkit is written in C++, from Stroustrup [Stroustrup84]. For the most part, Rumbaugh's terminology is independent of programming language, while Stroustrup is specific to implementation in C++. The transition from design to programming will be painless though, and the mappings between the two terminologies are mostly obvious. Where we think there might be confusion, we will point out the correspondences.

"},{"location":"VTKBook/02Chapter2/#what-is-an-object","title":"What Is an Object?","text":"

An object is an abstraction that models the state and behavior of entities in a system. Abstraction is a mental process that extracts the essential aspects of a situation for a particular purpose. Entities are things in the system that have identity. Chairs, airplanes, and cameras are objects that correspond to physical entities in the real world. Binary trees, symbol tables, and ordered collections are objects that exist only within the world of computer science.

Figure 2-1 is an example of the abstraction that occurs when we map the state and behavior of a system component to an object. Here, the object is a particular type of tree: a pin oak. In this application we desire to simulate the growth of various types of trees over the course of a season. For our purpose we have decided that the important state variables are the tree's age, trunk diameter, height, and habit (i.e., growing form). To capture the behavior of the pin oak we have methods to simulate growth and seasonal effects corresponding to spring, summer, fall, and winter. There are also methods (not shown) for setting and getting current state variables. Figure 2-1. Mapping a real-world object into an object abstraction. The real-world objects are various types of trees. One of these objects (a pin oak tree) is mapped into the computer object we call PinOak.

We call the state of an object its attributes (also called instance variables ) and define its behavior by the operations that can be applied to it. Attributes have a name, a data type, and a data value. The data type of an attribute may be a primitive type in the programming language (such as a char or float in C++), or another object. For example, the vtkTransform object in our visualization system has an attribute of type vtkMatrix4x4 , another object. vtkMatrix4x4 in turn has attributes that are an array of primitive values declared as float values in C++.

Operations are functions or transformations that can be applied to an object. Operations define the behavior of the object. The operations for a particular object are implemented in procedures we call methods.

Together, the attributes and operations of an object comprise its properties. A two-dimensional line graph could have attributes that include an x and y axis, a legend, and a connected set of points. This graph has methods that draw the graph in a window. It also has methods that let a user specify the axes, data to draw, and legend to use.

Objects that share the same properties can be grouped using the process of classification. An object class, usually just called a class, specifies the properties that all objects in the class have. The class only specifies the names of the properties, not their specific values. Different classes can (and usually do) have properties with names that exist in other classes. Many classes in our visualization system have an attribute named Position. Although both a camera and actor in our visualization system have this attribute, the effect on each is different because they are different classes. Attribute names are shared by all objects in a given class, but separate storage is allocated for each object's attribute values.

When an operation with the same name is applied to objects of different classes we call the operation polymorphic. For example, our visualization system has an operation named Render() that can be applied to many different objects. The implementation of an operation for a particular class is called a method. The print operation for a vtkMatrix4x4 object is implemented in its print method. That is, there exists code that knows how to print objects of class vtkMatrix4x4 and not objects of other classes. Objects know which method to use because they are kept within each object's data structure. In most systems the code for the methods is shared by all objects in the same class. Some programming languages, including C++, define a method by combining an operation name with its argument types. This process is called overloading an operation and is a powerful technique that permits the same name to be used for logically similar operations. For example, the class definition below defines three methods for calculating the square of a number. Even though these methods have the same operation name, they are unique because C++ uses both the operation name and the operations argument types.

class math\n{\n  float square(float x);\n  int square(int x);\n  double square(double x);\n}\n

To use a member of a class for some purpose, we create an instance of the class (the process of instantiation ). Instance creation establishes the identity of the instance including specifying its initial state. The instance's class serves as a template for the instance during creation, defining the names of each of its attributes and operations. Creation establishes the similarities and differences between this instance and other instances of the same class. The similarities are the names and type of its attributes and the methods that implement its operations. The differences are the specific values of the attributes. The details of how one creates an instance of a class vary from programming language to programming language. In C++, a program creates an instance using a declarative form such as

vtkActor aBall;\n

which creates an object from the program stack, or by applying the new operation

vtkActor *aBall = new vtkActor;\n

which creates the object from the program heap.

"},{"location":"VTKBook/02Chapter2/#inheritance","title":"Inheritance","text":"

Inheritance is a programming mechanism that simplifies adding new classes to a system when they differ in small ways from currently existing classes. The notion of inheritance is adopted from the observation that most systems can be specified using a hierarchical classification system. A fine example of a classification system is the phyla of life on earth.

Earlier we created an object corresponding to a pin oak tree. The properties of the tree can be more thoroughly described using inheritance ( Figure 2-2 ). The classification shown here is based on the five kingdom system of Margulis and Schwartz [Margulis88]. In this system, biota is classified as belonging to one of the five kingdoms Prokaryotae (bacteria), Protoctista (algae, protozoans and slime molds), Fungi (mushrooms, molds, lichens), Plantae (mosses, ferns, cone-bearing, and flowering plants), and Animalia (animals with and without backbones). Below this level we have the classifications division, class, order, family, genus, and species. The figure shows the kingdom, division, class, genus, and species of the pin oak.

Organizing objects into an inheritance hierarchy provides many benefits. Properties of a general classification are also properties of its sub-classification. For example, we know that all species of genus Quercus form acorns. From the software point of view this means any instance variables and methods of a superclass are automatically inherited by its subclass. This allows us to make changes to a number of objects simultaneously by modifying their superclass. Furthermore, if we desire to add a new class (say a red oak tree) to the hierarchy we can do so without duplicating existing functionality. We need only differentiate the new class from the others by adding new instance variables or overloading existing methods.

Figure 2-2. Inheritance hierarchy for pin oak tree.

The ability to quickly add new classes that are slightly different from currently existing classes promotes the extensibility of a system. Inheritance can be derived top-down using a process called specialization , or it can be created bottom-up, combining similar classes during a process called generalization. The use of inheritance implies a class hierarchy with one or more classes being the superclasses of one or more subclasses. A subclass inherits the operations and attributes of its superclasses. In C++, subclasses are called derived classes and superclasses are called base classes. A subclass can add additional operations and attributes that modify the properties it inherited from its superclasses. Through this inheritance, an object can exhibit its superclass's behavior plus any additional behavior it wishes. It can also restrict, or override, operations implemented by its superclass.

Classes that exist only to act as superclasses for their subclasses are called abstract classes. Instance creation of an abstract class is generally prohibited. Abstract classes are useful for gathering attributes and methods that all subclasses will use. They can also define protocols for behavior for their subclasses. This is a powerful use of inheritance that will show up in the design of our visualization system. Abstract classes can enforce complex sequence, control protocols, and ensure uniform behavior. They remove the responsibility of complex protocols from the individual sub-classes and isolate the protocol in the superclass.

An example of a simple plotting package illustrates the power of abstract classes. Consider a data presentation application that allows for a variety of two-dimensional plotting. This application must support line charts and horizontal and vertical bar charts. The design process identifies properties common to all plots including title, axes, and legend. We then create an abstract class called TwoDPlot to contain these common attributes. Common behavior can also be captured in TwoDPlot within its plot method:

Method Plot\n{\n  Draw the border\n  Scale the data\n  Draw the axes\n  Draw the data\n  Draw the title\n  Draw the legend\n}\n

An abstract class may or may not provide default behavior for each operation. In this example, default behavior for border and title drawing might be provided. Then subclasses of TwoDPlot would define their own functions for the other methods. The protocol specification explicitly spells out what methods a subclass of TwoDPlot should respond to. In the above example, subclasses will need to define their own methods for drawing the axis, data, and legend. Some subclasses might use TwoDPlot 's methods for drawing the border, others might require their own version of this method. The abstract interface defined in TwoDPlot makes it easier to add new classes of 2D plots and the resulting subclasses tend to be more uniform and consistent.

Another mechanism, delegation , is useful for isolating and reusing behavior. Using delegation, an object applies operations to one of its attributes that is an object. As an example, in the Visualization Toolkit the vtkTransform object delegates its Identity() operation to its vtkMatrix4x4 attribute. This instance of vtkMatrix4x4 then performs the operation. There are many more useful object-oriented concepts, but for the time being we have enough information to describe how we can use objects to design a system.

"},{"location":"VTKBook/02Chapter2/#25-object-oriented-modelling-and-design","title":"2.5 Object-Oriented Modelling and Design","text":"

The design of any large software system is a formidable task and the first steps in system design are often the most challenging. No matter what design technique we choose, we must have a thorough understanding of the system's application domain. It would be difficult to see how one could design a fly-by-wire airplane control system without a detailed knowledge of the underlying hardware control systems. Of course, all flight system software is not designed by aeronautical engineers, so some form of system specification must exist. The depth of information in the specifications varies from application to application.

Object-oriented system design begins with a modelling step that extracts objects and their relationships with other objects from a problem statement or software requirement specification. First, the designer must completely understand the problem being solved. This often requires an in-depth knowledge of the problem domain or access to detailed specifications of the problem being solved. Then, major abstractions must be identified within the system. The abstractions will become, at this high level of design, the first set of objects. For example, a system that keeps track of an investment portfolio will need objects such as stocks, bonds, and mutual funds. In a computer animation system we might need actors, cameras, and lights. A medical computed tomography system will have a table, X-ray source, detectors, and gantry. Our visualization system will have models, isosurfaces, streamlines, and cut planes. During this modelling step, we search the problem domain for objects, properties, and relationships. Later, during multiple passes through the design, the model will be expanded.

Modelling is a step in most design processes regardless of whether we are designing a ship, house, electronics system, or software. Each discipline follows a methodology that uses techniques specifically created to make the design process efficient and worthwhile. These techniques are so-called \"tools of the trade.\" An electrical engineer uses schematics and logic diagrams, an architect uses drawings and mock-ups, and a ship builder uses scale models. Likewise, software designers need tools that can help create a model of the system. The software tools should have enough expressive power to help the software designer evaluate a design against a specification and help communicate that design to others on the software team.

We use the Object Modeling Technique (OMT) developed at GE by Jim Rumbaugh and his colleagues [Rumbaugh91]. OMT uses three models to specify an object-oriented design: an object model, a dynamic model, and a functional model. Each model describes a different aspect of the system and each has a corresponding diagramming technique that helps us analyze, design, and implement software systems.

"},{"location":"VTKBook/02Chapter2/#the-object-model","title":"The Object Model","text":"

The object model identifies each object in the system, its properties, and its relationships to other objects in the system. For most software systems, the object model dominates the design. The OMT graphical technique uses rectangles to depict object classes, and a variety of connectors to depict inheritance and other object-object relations. Object classes are represented as solid rectangles. Instances are represented as dotted rectangles. The name of the class or instance occupies the top of the rectangle. A line separates the class name from the next section that contains the attributes; a third section describes the methods. Relationships between objects are shown with line segments connecting the two related objects. In OMT, relationships are called associations and they can have various cardinalities: one-to-one, one-to-many, and many-to-many. Special associations that represent containers of other objects are called aggregations. Associations can be labeled with roles. (Roles are names given to associations and are used to further describe the nature of the association.) OMT represents inheritance with a triangle, with the superclass attached to the apex, and sub-classes attached to the base of the triangle. Figure 2-3 shows an object model for locator devices in a virtual reality system.

The first object in the class hierarchy is locator. This abstract class specifies common attributes and methods for all locators. The subclasses of locator are locator2D and locator3D . In the current rendition of this object model, the locator only has one attribute, a device and two methods, open() and close(). The two subclasses of locator, locator2D and locator3D are also abstract classes, containing attributes and methods that distinguish them from each other based on their spatial dimensionality. For example, locator3D has an x, y, z position while locator2D has an x, y position. Both locators have a locate() method that updates the current position. In the 3D locator class, locate() also updates the orientation. The subclasses of locator3D include hardware from three different manufacturers: flock, pixsys, and logitek, as well as an articulated positioner abstract class. The three object classes for the hardware contain methods specific to each device. Each method knows how to convert the hardware specific codes returned by the device. They know that to be considered a locator3D subclass, they must implement a position and orientation operation that will provide x, y, z coordinates and three angular rotations that can be composed into a transformation matrix. The object model also shows us that the articulated locator has angles and linkages. Two specific articulated locators are immersion and phantom. An object model diagrammed in this fashion serves as a starting point for design and discussion. It reveals common methods and attributes as well as the distinguishing characteristics of each class.

Later, during implementation, we will convert these object models into software objects. The particular computer language we choose for implementation will dictate the details of the conversion.

Figure 2-3. Object model for locator devices."},{"location":"VTKBook/02Chapter2/#the-dynamic-model","title":"The Dynamic Model","text":"

The object model describes the static portion of a system while the dynamic model details the sequences of events and time dependencies of the system. OMT uses state diagrams to model system dynamics. Dynamic models are frequently used to design control systems and user interfaces. Our visualization system has limited sequence and control aspects, so we will not dwell on state diagrams. But, if we were designing a user-friendly interface for a digital wristwatch, the state diagram in Figure2-4 would be useful. Figure 2-4. State diagram for a wristwatch.

The ovals in the diagram show a state; the arrows show a transition from one state to another; and the labels on the arrows show an event that causes the state transition. This example shows three display states and multiple setting states. The event b1 means button one is pressed. This watch has three buttons. The diagram shows what happens in each state when any of the three buttons is pressed. The diagram clearly shows that b1 is used to move between display modes for time, date, and alarm. B2 changes from display mode into setting mode or selects the field to change in a given mode. B3 increments the selected field by one unit. The state diagram also shows what happens when illegal buttons are pressed. If the watch is displaying time and button 3 is pressed, nothing happens. If button 3 is pressed when the watch is displaying the alarm, the alarm on/off is toggled.

"},{"location":"VTKBook/02Chapter2/#the-functional-model","title":"The Functional Model","text":"

The functional model shows how data flows through the system and how processes and algorithms transform the data. It also shows functional dependencies between processes. Exposing these relationships will affect the associations in the object model. The major components of a data flow diagram (DFD) are data sources, data sinks, and processes. Data sources and sinks are represented as rectangles. Ellipses show processes. Data stores are shown within two horizontal lines. DFDs are useful to describe the overall flow in the system. They can also be used to describe any process that transforms one data representation into another. Processes identified in the DFD during function modelling may turn up as operations or objects in the object model.

Figure2-5 shows a data flow diagram for a 3D medical imaging system. The diagram shows the data acquisition on the computed tomography (CT) or magnetic resonance imaging (MRI) scanner. The series of cross-sectional slices provided by the scanner is first processed by image processing filters to enhance features in the gray scale slices. A segment process identifies tissues and produces labels for the various tissues present in the slices. These labeled slices are then passed through a surface extraction process to create triangles that lie on the surface of each tissue. The render process transforms the geometry into an image. Alternatively, the write process stores the triangles in a file. Later, the triangles can be read and rendered into an image. We defer the decision whether to make the processes objects or operations until later. Chapter 4 uses DFDs to model the visualization pipeline. Figure 2-5. Data flow diagram."},{"location":"VTKBook/02Chapter2/#26-object-oriented-programming-languages","title":"2.6 Object-Oriented Programming Languages","text":"

The choice of computer programming language is a religious issue. Every computer language has its evangelists and followers. Most of our experience in object-oriented languages is with C and C++. C itself does not have object-oriented facilities, but an object-oriented methodology and strict coding guidelines permit the development of object-oriented code. We chose C++ for the Visualization Toolkit because it has built-in support for the notion of classes, dynamic binding of methods to objects, and inheritance. C++ is also widely available on many UNIX platforms and personal computers.

Simula [Birtwistle79] is usually acknowledged as the first object-oriented language, but Smalltalk [Goldberg83] is probably the best-known language. Smalltalk was developed at the Xerox Palo Alto Research Center (PARC) in the seventies and eighties. Well before its time, Smalltalk provided not just a language, but also an operating system and programming environment built with objects. When you use Smalltalk, you live and breathe objects. For the object-oriented purist, there is no substitute. Smalltalk spin-offs include window systems, workstations, and the desktop paradigm. Both Apple Computer and Microsoft acknowledge the influence that Smalltalk and Xerox PARC had on the Macintosh and Windows. Smalltalk was probably conceived 10 years too early for widespread commercial acceptance. During Smalltalk's infancy and adolescence, the complexity of software was much lower than today's systems. FORTRAN served the scientific and engineering community, COBOL was the choice for business applications and the computer science community embraced C. The use of abstractions was limited to mathematicians and other abstract thinkers. Programming was considered an art form and programmers concentrated on clever implementations of algorithms. Each new task often required a new program. Technical programmers did use numerical libraries for common mathematical operations, but any notions of common abstractions at a higher level were relatively few.

"},{"location":"VTKBook/02Chapter2/#27-object-oriented-visualization","title":"2.7 Object-Oriented Visualization","text":"

Don't underestimate the investment required to design a system. Although object-oriented technologies have tremendous potential to produce good software designs, these techniques do not guarantee a good design. The visualization system we present in this text has its roots in an animation [Lorensen89] and visualization system [Schroeder92] that we developed over a 10-year period. The initial design, which identified 25 classes for computer animation of industrial applications, took four software professionals 10 months (almost 3.5 person years) to complete. During this design stage the developers produced zero (!) lines of code. The subsequent implementation took one month, or ten percent of the effort. This system still serves our visualization group even after 20 other software developers have added over 500 classes to the system. The original 25 classes still exist in the system today.

As a reader, we hope that you can benefit from our experience in visualization system design. We have tried to assist you by describing the properties (attributes and methods) of many of the Visualization Toolkit classes in each chapter's \"Putting It All Together \" section. There are also included a series of object diagrams generated by the Doxygen documentation system that will give you a quick overview of object relationships such as superclass and subclass. This documentation can be found on the CD-ROM or on-line at http://www.vtk.org. In the next chapter we will also explain the decisions we made to design the VTK object-oriented toolkit.

"},{"location":"VTKBook/02Chapter2/#28-chapter-summary","title":"2.8 Chapter Summary","text":"

This chapter introduced object-oriented concepts and terminology. The emphasis was on dealing with complexity and how object-oriented technology provides mechanisms to reduce the complexity of software.

Model building is an important part of any design methodology. We introduced three models and notations. The object model describes the objects in a system and their static relationships, attributes, and methods. Object diagrams succinctly present this static information. The dynamic model focuses on the time dependent aspects of the system. State transition diagrams are used to model the sequence and control portions of the system. The functional model shows how objects in the system transform data or other objects. The data flow diagram is a convenient notation for showing functional dependencies.

There are several choices available today for object-oriented implementations. Although it is possible to implement an object-oriented system in a non-object-oriented language such as C, the methodology is best served by an object-oriented language. We have chosen C++ to implement the Visualization Toolkit.

The emphasis in this book is on architecture, data structure design, and algorithms. The object-oriented aspects of the system are important, but what the system does is far more important.

"},{"location":"VTKBook/02Chapter2/#29-bibliographic-notes","title":"2.9 Bibliographic Notes","text":"

There are several excellent textbooks on object-oriented design. Both [Rumbaugh91] and [Birtwistle79] present language-independent design methodologies. Both books emphasize modelling and diagramming as key aspects of design. [Meyer88] also describes the OO design process in the context of Eiffel, an OO language. Another popular book has been authored by Booch [Booch91].

Anyone who wants to be a serious user of object-oriented design and implementation should read the books on Smalltalk [Goldberg83] [Goldberg84] by the developers of Smalltalk at Xerox Parc. In another early object-oriented programming book, [Cox86] describes OO techniques and the programming language Objective-C. Objective-C is a mix of C and Smalltalk and was used by Next Computer in the implementation of their operating system and user interface.

There are many texts on object-oriented languages. CLOS [Keene89] describes the Common List Object System. Eiffel, a strongly typed OO language is described by [Meyer88]. Objective-C [Cox86] is a weakly typed language.

Since C++ has become a popular programming language, there now many class libraries available for use in applications. [Gorlen90] describes an extensive class library for collections and arrays modeled after the Smalltalk classes described in [Goldberg83]. [Stepanov94] and [Musser94] describe the Standard Template Library, a framework of data structures and algorithms that is now a part of the ANSI C++ standard. Open Inventor [Inventor] is a C++ library supporting interactive 3D computer graphics. The Insight Segmentation and Registration Toolkit (ITK) is a relatively new class library often used in combination with VTK [ITK] for medical data processing. VXL is a C++ library for computer vision research and implementation [VXL]. Several mathematical libraries such as VNL (a part of VXL) and Blitz++ [Blitz] are also available. A wide variety of other C++ toolkits are available, Google searches [Google] are the best way to find them.

C++ texts abound. The original description by the author of C++ [Stroustrup84] is a must for any serious C++ programmer. Another book [Ellis90] describes standard extensions to the language. These days the UML book series of which [Booch98] and [Rumbaugh98] are quite popular and are highly recommended resources. Several books on generic programming [Austern99] and STL [Musser96] are also useful. Check with your colleagues for their favorite C++ book.

To keep in touch with new developments there are conferences, journals, and Web sites. The strongest technical conference on object-oriented topics is the annual Object-Oriented Programming Systems, Languages, and Applications ( OOPSLA ) conference. This is where researchers in the field describe, teach and debate the latest techniques in object-oriented technology. The bimonthly Journal of Object-Oriented Programming (JOOP) published by SIGS Publications, NY, presents technical papers, columns, and tutorials on the field. Resources on the World Wide Web include the Usenet newsgroups comp.object and comp.lang.c++.

"},{"location":"VTKBook/02Chapter2/#210-references","title":"2.10 References","text":"

[Austern99] M. H. Austern. Generic Programming and the STL. Addison-Wesley 1999. ISBN 0-2-1-30956-4.

[Birtwistle79] G. M. Birtwistle, O. Dahl, B. Myhrhaug, and K. Nygaard. Simula Begin. Chartwell-Bratt Ltd, England, 1979.

[Blitz] http://www.oonumerics.org/blitz/.

[Booch91] G. Booch. Object-Oriented Design with Applications. Benjamin/Cummings Publishing Co., Redwood City, CA, 1991.

[Booch98] G. Booch, I. Jacobson, J. Rumbaugh. The Unified Modeling Language User Guide. Addison-Wesley 1998, ISBN 0201571684.

[Cox86] B. J. Cox. Object-Oriented Programming: An Evolutionary Approach. Addison-Wesley, Reading, MA, 1986.

[Ellis90] M. Ellis and B. Stroustrup. The Annotated C++ Reference Manual. Addison-Wesley, Reading, MA, 1990.

[Goldberg83] A. Goldberg, D. Robson. Smalltalk-80: The Language and Its Implementation. Addison-Wesley, Reading, MA, 1983.

[Goldberg84] A. Goldberg. Smalltalk-80: The Interactive Programming Environment. Addison-Wesley, Reading, MA, 1984.

[Google] http://www.google.com.

[Gorlen90] K. Gorlen, S. Orlow, and P. Plexico. Data Abstraction and Object-Oriented Programming. John Wiley & Sons, Ltd., Chichester, England, 1990.

[Inventor] http://oss.sgi.com/projects/inventor/.

[ITK] The Insight Software Consortium. http://www.itk.org.

[Keene89] S. Keene. Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS. Addison-Wesley, Reading, MA, 1989.

[Lorensen89] W. E. Lorensen, B. Yamrom. \"Object-Oriented Computer Animation.\" Proceedings of IEEE NAE-CON, 2:588-595, Dayton, Ohio, May 1989.

[Margulis88] L. Margulis and K. V. Schwartz. Five Kingdoms an Illustrated Guide to the Phyla of Life on Earth. H. Freeman & Co., New York, 1988.

[Meyer88] B. Meyer. Object-Oriented Software Construction. Prentice Hall International, Hertfordshire, England, 1988.

[Musser94] D. Musser and A. Stepanov. \"Algorithm-Oriented Generic Libraries.\" Software Practice and Experience. 24(7):623--642, July 1994.

[Musser96] D. R. Musser and A. Saini. STL Tutorial and Reference Guide. Addison-Wesley 1996.ISBN 0-201-63398-1.

[Rumbaugh91] J. Rumbaugh, M. Blaha, W. Premerlani, F. Eddy, and W. Lorensen. Object-Oriented Modeling and Design. Prentice Hall, Englewood Cliffs, NJ, 1991.

[Rumbaugh98] J. Rumbaugh, G. Booch, and I. Jacobson. The Unified Modeling Language Reference Manual. Addison-Wesley 1998, ISBN: 020130998X.

[Schroeder92] W. J. Schroeder, W. E. Lorensen, G. Montanaro, and C. Volpe. \"Visage: An Object-Oriented Scientific Visualization System.\" In Proceedings of Visualization '92. pp. 219--226, IEEE Computer Society Press, Los Alamitos, CA, October 1992.

[Stepanov94] A. Stepanov and M. Lee. The Standard Template Library. ISO Programming Language C++ Project. Doc. No. X3J16/94-0095, WG21/N0482, May 1994.

[Stroustrup84] B. Stroustrup. The C++ Programming Language. Addison-Wesley, Reading, MA, 1986.

[VXL] http://vxl.sourceforge.net/.

"},{"location":"VTKBook/02Chapter2/#211-exercises","title":"2.11 Exercises","text":"

2.1 Answer the following questions about a program you have written.

a) How much time did you spend on design and implementation?

b) What methodology, if any, did you use?

c) Could you easily extend the system?

d) Could anyone extend the system?

2.2 Identify the major objects and operations for the following applications.

a) An airline reservation system.

b) An adventure game.

c) A 2D plotting package.

d) An automatic teller machine.

2.3 Draw an object diagram for each example in Exercise 2.2.

2.4 Computer animation uses concepts from graphics and movie making. Identify the major objects and operations in a computer animation system.

2.5 For the animation system in Exercise 2.4, design control and looping objects that will allow flexible control of the properties of the actors in the system. If we call these control and looping objects scenes and cues, how would you expect them to look?

2.6 Draw a state diagram for your wristwatch using Figure 2-4 as an example.

2.7 Draw a data flow diagram for calculating the surface area and volume of a sphere and cylinder.

LocalWords: Austern

"},{"location":"VTKBook/03Chapter3/","title":"Chapter 3 - Computer Graphics Primer","text":"

Computer graphics is the foundation of data visualization. Practically speaking, visualization is the process that transforms data into a set of graphics primitives. The methods of computer graphics are then used to convert these primitives into pictures or animations. This chapter discusses basic computer graphics principles. We begin by describing how lights and physical objects interact to form what we see. Next we examine how to simulate these interactions using computer graphics techniques. Hardware issues play an important role here since modern computers have built-in hardware support for graphics. The chapter concludes with a series of examples that illustrate our object-oriented model for 3D computer graphics.

"},{"location":"VTKBook/03Chapter3/#31-introduction","title":"3.1 Introduction","text":"

Computer graphics is the process of generating images using computers. We call this process rendering. There are many types of rendering processes, ranging from 2D paint programs to sophisticated 3D techniques. In this chapter we focus on basic 3D techniques for visualization.

We can view rendering as the process of converting graphical data into an image. In data visualization our goal is to transform data into graphical data, or graphics primitives, that are then rendered. The goal of our rendering is not so much photo realism as it is information content. We also strive for interactive graphical displays with which it is possible to directly manipulate the underlying data. This chapter explains the process of rendering an image from graphical data. We begin by looking at the way lights, cameras, and objects (or actors) interact in the world around us. From this foundation we explain how to simulate this process on a computer.

"},{"location":"VTKBook/03Chapter3/#a-physical-description-of-rendering","title":"A Physical Description of Rendering","text":"Figure 3-1. Physical generation of an image.

Figure 3-1 presents a simplified view of what happens when we look at an object, in this case a cube. Rays of light are emitted from a light source in all directions. (In this example we assume that the light source is the sun.) Some of these rays happen to strike the cube whose surface absorbs some of the incident light and reflects the rest of it. Some of this reflected light may head towards us and enter our eyes. If this happens, then we \"see\" the object. Likewise, some of the light from the sun will strike the ground and some small percentage of it will be reflected into our eyes.

As you can imagine, the chances of a ray of light traveling from the sun through space to hit a small object on a relatively small planet are low. This is compounded by the slim odds that the ray of light will reflect off the object and into our eyes. The only reason we can see is that the sun produces such an enormous amount of light that it overwhelms the odds. While this may work in real life, trying to simulate it with a computer can be difficult. Fortunately, there are other ways to look at this problem.

A common and effective technique for 3D computer graphics is called ray-tracing or ray-casting. Ray-tracing simulates the interaction of light with objects by following the path of each light ray. Typically, we follow the ray backwards from the viewer's eyes and into the world to determine what the ray strikes. The direction of the ray is in the direction we are looking (i.e., the view direction) including effects of perspective (if desired). When a ray intersects an object, we can determine if that point is being lit by our light source. This is done by tracing a ray from the point of intersection towards the light. If the ray intersects the light, then the point is being lit. If the ray intersects something else before it gets to the light, then that light will not contribute to illuminating the point. For multiple light sources we just repeat this process for each light source. The total contributions from all the light sources, plus any ambient scattered light, will determine the total lighting or shadow for that point. By following the light's path backwards, ray tracing only looks at rays that end up entering the viewer's eyes. This dramatically reduces the number of rays that must be computed by a simulation program.

Having described ray tracing as a rendering process, it may be surprising that many members of the graphics community do not use it. This is because ray tracing is a relatively slow image generation method since it is typically implemented in software. Other graphics techniques have been developed that generate images using dedicated computer hardware. To understand why this situation has emerged, it is instructive to briefly examine the taxonomy and history of computer graphics.

"},{"location":"VTKBook/03Chapter3/#image-order-and-object-order-methods","title":"Image-Order and Object-Order Methods","text":"

Rendering processes can be broken into two categories: image-order and object-order. Ray tracing is an image-order process. It works by determining what happens to each ray of light, one at a time. An object-order process works by rendering each object, one at a time. In the above example, an object-order technique would proceed by first rendering the ground and then the cube.

To look at it another way consider painting a picture of a barn. Using an image-order algorithm you would start at the upper left corner of the canvas and put down a drop of the correct color paint. (Each paint drop is called a picture element or pixel.) Then you would move a little to the right and put down another drop of paint. You would continue until you reached the right edge of the canvas, then you would move down a little and start on the next row. Each time you put down a drop of paint you make certain it is the correct color for each pixel on the canvas. When you are done you will have a painting of a barn.

An alternative approach is based on the more natural (at least for many people) object-order process. We work by painting the different objects in our scene, independent of where the objects actually are located on the scene. We may paint from back to front, front-to-back, or in arbitrary order. For example, we could start by painting the sky and then add in the ground. After these two objects were painted we would then add in the barn. In the image-order process we worked on the canvas in a very orderly fashion; left to right, top to bottom. With an object-order process we tend to jump from one part of the canvas to another, depending on what object we are drawing.

The field of computer graphics started out using object-order processes. Much of the early work was closely tied to the hardware display device, initially a vector display. This was little more than an oscilloscope, but it encouraged graphical data to be drawn as a series of line segments. As the original vector displays gave way to the currently ubiquitous raster displays, the notion of representing graphical data as a series of objects to be drawn was preserved. Much of the early work pioneered by Bresenham [Bresenham65] at IBM focused on how to properly convert line segments into a form that would be suitable for line plotters. The same work was applied to the task of rendering lines onto the raster displays that replaced the oscilloscope. Since then the hardware has become more powerful and capable of displaying much more complex primitives than lines.

It wasn't until the early 1980s that a paper by Turner Whitted [Whitted80] prompted many people to look at rendering from a more physical perspective. Eventually ray tracing became a serious competitor to the traditional object-order rendering techniques, due in part to the highly realistic images it can produce. Object-order rendering has maintained its popularity because there is a wealth of graphics hardware designed to quickly render objects. Ray tracing tends to be done without any specialized hardware and therefore is a time-consuming process.

"},{"location":"VTKBook/03Chapter3/#surface-versus-volume-rendering","title":"Surface versus Volume Rendering","text":"

The discussion to this point in the text has tacitly assumed that when we render an object, we are viewing the surfaces of objects and their interactions with light. However, common objects such as clouds, water, and fog, are translucent, or scatter light that passes through them. Such objects cannot be rendered using a model based exclusively on surface interactions. Instead, we need to consider the changing properties inside the object to properly render them. We refer to these two rendering models as surface rendering (i.e., render the surfaces of an object) and volume rendering (i.e., render the surface and interior of an object).

Generally speaking, when we render an object using surface rendering techniques, we mathematically model the object with a surface description such as points, lines, triangles, polygons, or 2D and 3D splines. The interior of the object is not described, or only implicitly represented from the surface representation (i.e., surface is the boundary of the volume). Although techniques do exist that allow us to make the surface transparent or translucent, there are still many phenomena that cannot be simulated using surface rendering techniques alone (e.g., scattering or light emission). This is particularly true if we are trying to render data interior to an object, such as X-ray intensity from a CT scan.

Volume rendering techniques allow us to see the inhomogeneity inside objects. In the prior CT example, we can realistically reproduce X-ray images by considering the intensity values from both the surface and interior of the data. Although it is premature to describe this process at this point in the text, you can imagine extending our ray tracing example from the previous section. Thus rays not only interact with the surface of an object, they also interact with the interior.

In this chapter we focus on surface rendering techniques. While not as powerful as volume rendering, surface rendering is widely used because it is relatively fast compared to volumetric techniques, and allows us to create images for a wide variety of data and objects. Chapter 7 - Advanced Computer Graphics describes volume rendering in more detail.

"},{"location":"VTKBook/03Chapter3/#visualization-not-graphics","title":"Visualization Not Graphics","text":"

Although the authors would enjoy providing a thorough treatise on computer graphics, such a discourse is beyond the scope of this text. Instead we make the distinction between visualization (exploring, transforming, and mapping data) and computer graphics (mapping and rendering). The focus will be on the principles and practice of visualization, and not on 3D computer graphics. In this chapter and Chapter 7 - Advanced Computer Graphics we introduce basic concepts and provide a working knowledge of 3D computer graphics. For those more interested in this field, we refer you to the texts recommended in the \"Bibliographic Notes\" at the end of this chapter.

One of the regrets we have regarding this posture is that certain rendering techniques are essentially visualization techniques. We see this hinted at in the previous paragraph, where we use the term \"mapping\" to describe both visualization and computer graphics. There is not currently and will likely never be a firm distinction between visualization and graphics. For example, many researchers consider volume rendering to be squarely in the field of visualization because it addresses one of the most important forms of visualization data. Our distinction is mostly for our own convenience, and offers us the opportunity to finish this text. We recommend that a serious student of visualization supplement the material presented here with deeper books on computer graphics and volume rendering.

In the next few pages we describe the rendering process in more detail. We start by describing several color models. Next we examine the primary components of the rendering process. There are sources of light such as the sun, objects we wish to render such as a cube or sphere (we refer to these objects as actors), and there is a camera that looks out into the world. These terms are taken from the movie industry and tend to be familiar to most people. Actors represent graphical data or objects, lights illuminate the actors, and the camera constructs a picture by projecting the actors onto a view plane. We call the combination of lights, camera, and actors the scene, and refer to the rendering process as rendering the scene.

"},{"location":"VTKBook/03Chapter3/#32-color","title":"3.2 Color","text":"

The electromagnetic spectrum visible to humans contains wavelengths ranging from about 400 to 700 nanometers. The light that enters our eyes consists of different intensities of these wavelengths, an example of which is shown in Figure 3-2. This intensity plot defines the color of the light, therefore a different plot results in a different color. Unfortunately, we may not notice the difference since the human eye throws out most of this information. There are three types of color receptors in the human eye called cones. Each type responds to a subset of the 400 to 700 nanometer wavelength range as shown in Figure 3-3. Any color we see is encoded by our eyes into these three overlapping responses. This is a great reduction from the amount of information that actually comes into our eyes. As a result, the human eye is incapable of recognizing differences in any colors whose intensity curves, when applied to the human eye's response curves, result in the same triplet of responses. This also implies that we can store and represent colors in a computer using a simplified form without the human eye being able to recognize the difference. Figure 3-2. Wavelength versus Intensity plot.

The two simplified component systems that we use to describe colors are RGB and HSV color systems. The RGB system represents colors based on their red, green, and blue intensities. This can be thought of as a three dimensional space with the axes being red, green, and blue. Some common colors and their RGB components are shown in Figure 3-4.

The HSV system represents colors based on their hue, saturation, and value. The value component is also known as the brightness or intensity component, and represents how much light is in the color. A value of 0.0 will always give you black and a value of 1.0 will give you something bright. The hue represents the dominant wavelength of the color and is often illustrated using a circle as in Figure 3-5. Each location on the circumference of this circle represents a different hue and can be specified using an angle. When we specify a hue we use the range from zero to one, where zero corresponds to zero degrees on the hue circle and one corresponds to 360 degrees. The saturation indicates how much of the hue is mixed into the color. For example, we can set the value to one, which gives us a bright color, and the hue to 0.66, to give us a dominant wavelength of blue. Now if we set the saturation to one, the color will be a bright primary blue. If we set the saturation to 0.5, the color will be sky blue, a blue with more white mixed in. If we set the saturation to zero, this indicates that there is no more of the dominant wavelength (hue) in the color than any other wavelength. As a result, the final color will be white (regardless of hue value). Figure 3-4 lists HSV values for some common colors. Figure 3-3. Relative absorbance of light by the three types of cones in the human retina. Color RGB HSV Black 0,0,0 ,,0 White 1,1,1 *,0,1 Red 1,0,0 0,1,1 Green 0,1,0 1/3,1,1 Blue 0,0,1 2/3,1,1 Yellow 1,1,0 1/6,1,1 Cyan 0,1,1 1/2,1,1 Magenta 1,0,1 5/6,1,1 Sky Blue 1/2,1/2,1 2/3,1/2,1 Figure 3-4. Common colors in RGB and HSV space. s Figure 3-5. On the top, circular representation of hue. The other two images on the bottom are slices through the HSV color space. The first slice has a value of 1.0, the other has a value of 0.5."},{"location":"VTKBook/03Chapter3/#33-lights","title":"3.3 Lights","text":"

One of the major factors controlling the rendering process is the interaction of light with the actors in the scene. If there are no lights, the resulting image will be black and rather uninformative. To a great extent it is the interaction between the emitted light and the surface (and in some cases the interior) of the actors in the scene that defines what we see. Once rays of light interact with the actors in a scene, we have something for our camera to view.

Of the many different types of lights used in computer graphics, we will discuss the simplest, the infinitely distant, point light source. This is a simplified model compared to the lights we use at home and work. The light sources that we are accustomed to typically radiate from a region in space (a filament in an incandescent bulb, or a light-emitting gas in a fluorescent light). The point source lighting model assumes that the light is emitted in all directions from a single point in space. For an infinite light source, we assume that it is positioned infinitely far away from what it is illuminating. This is significant because it implies that the incoming rays from such a source will be parallel to each other. The emissions of a local light source, such as a lamp in a room, are not parallel. Figure 3-6 illustrates the differences between a local light source with a finite volume, versus an infinite point light source. The intensity of the light emitted by our infinite light sources also remains constant as it travels, in contrast to the actual 1/ distance2 relationship physical lights obey. As you can see this is a great simplification, which later will allow us to use less complex lighting equations. Figure 3-6. Local light source with a finite volume versus an infinite point light source."},{"location":"VTKBook/03Chapter3/#34-surface-properties","title":"3.4 Surface Properties","text":"

As rays of light travel through space, some of them intersect our actors. When this happens, the rays of light interact with the surface of the actor to produce a color. Part of this resulting color is actually not due to direct light, but rather from ambient light that is being reflected or scattered from other objects. An ambient lighting model accounts for this and is a simple approximation of the complex scattering of light that occurs in the real world. It applies the intensity curve of the light source to the color of the object, also expressed as an intensity curve. The result is the color of the light we see when we look at that object. With such a model, it is important to realize that a white light shining on a blue ball is indistinguishable from a blue light shining on a white ball. The ambient lighting equation is

R_a = L_c \\cdot O_a \\bf\\tag{3-1}

where R_a is the resulting intensity curve due to ambient lighting, L_c is the intensity curve of the ambient light, and O_a is the color curve of the object. To help keep the equations simple we assume that all of the direction vectors are normalized (i.e., have a magnitude of one).

Two components of the resulting color depend on direct lighting. Diffuse lighting, which is also known as Lambertian reflection, takes into account the angle of incidence of the light onto an object. Figure 3-7 shows the image of a cylinder that becomes darker as you move laterally from its center. The cylinder's color is constant; the amount of light hitting the surface of the cylinder changes. At the center, where the incoming light is nearly perpendicular to the surface of the cylinder, it receives more rays of light per surface area. As we move towards the side, this drops until finally the incoming light is parallel to the side of the cylinder and the resulting intensity is zero. Figure 3-7. Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look. See FlatVersusGouraud.cxx and FlatVersusGouraud.py.

The contribution from diffuse lighting is expressed in Equation3-2 and illustrated in Figure 3-8. R_d = L_cO_d[\\overrightarrow{O}_n \\cdot (-\\overrightarrow{L}_n)] \\bf\\tag{3-2}

where R_d is the resulting intensity curve due to diffuse lighting, L_c is the intensity curve for the light, and O_c is the color curve for the object. Notice that the diffuse light is a function of the relative angle between incident light vector and the surface normal of the object. As a result diffuse lighting is independent of viewer position.

Specular lighting represents direct reflections of a light source off a shiny object. Figure 3-10 shows a diffusely lit ball with varying specular reflection. The specular intensity (which varies between the top and bottom rows) controls the intensity of the specular lighting. The specular power, O_{sp}, indicates how shiny an object is, more specifically it indicates how quickly specular sp reflections diminish as the reflection angles deviate from a perfect reflection. Higher values indicate a faster dropoff, and therefore a shinier surface. Referring to Figure 3-9, the equation for specular lighting is R_s . = L_cO_s[\\overrightarrow{S} \\cdot (-\\overrightarrow{C}_n)] ^{O_{sp}}\\\\ \\overrightarrow{S} = 2[\\overrightarrow{O}_n \\cdot (-\\overrightarrow{L}_n)]\\overrightarrow{O}_n + \\overrightarrow{L}_n \\bf\\tag{3-3}

where \\vec{C_n} is the direction of projection for the camera and is the \\vec{S} is the direction of specular reflection.

Figure 3-8. Diffuse lighting. Figure 3-9. Specular lighting.

We have presented the equations for the different lighting models independently. We can apply all lighting models simultaneously or in combination. Equation3-4 combines ambient, diffuse and specular lighting into one equation.

R_c = O_{ai}O_{ac}L_c - O_{di}O_{dc}L_c(\\overrightarrow{O}_n \\cdot \\overrightarrow{L}_n) + O_{si}O_{sc}L_c[\\overrightarrow{S} \\cdot(-\\overrightarrow{C}_n)]^{O_{sp}} \\bf\\tag{3-4}

The result is a color at a point on the surface of the object. The constants O_{ai}, O_{di}, and O_{si} control the relative amounts of ambient, diffuse and specular lighting for an object. The constants O_{ac}, O_{dc} and O_{sc} specify the colors to be used for each type of lighting. These six constants along with the specular power are part of the surface material properties. (Other properties such as transparency will be covered in later sections of the text.) Different combinations of these property values can simulate dull plastic and polished metal. The equation assumes an infinite point light source as described in \"Lights\". However the equation can be easily modified to incorporate other types of directional lighting.

Figure 3-10. Effects of specular coefficients. Specular coefficients control the apparent \"shininess\" of objects. The top row has a specular intensity value of 0.5; the bottom row 1.0. Along the horizontal direction the specular power changes. The values (from left to right) are 5, 10, 20, and 40. See SpecularSpheres.cxx and SpecularSpheres.py."},{"location":"VTKBook/03Chapter3/#35-cameras","title":"3.5 Cameras","text":"

We have light sources that are emitting rays of light and actors with surface properties. At every point on the surface of our actors this interaction results in some composite color (i.e., combined color from light, object surface, specular, and ambient effects). All we need now to render the scene is a camera. There are a number of important factors that determine how a 3D scene gets projected onto a plane to form a 2D image (see Figure 3-11). These are the position, orientation, and focal point of the camera, the method of camera projection, and the location of the camera clipping planes. Figure 3-11 Camera attributes..

The position and focal point of the camera define the location of the camera and where it points. The vector defined from the camera position to the focal point is called the direction of projection. The camera image plane is located at the focal point and is typically perpendicular to the projection vector. The camera orientation is controlled by the position and focal point plus the camera view-up vector. Together these completely define the camera view.

The method of projection controls how the actors are mapped to the image plane. Orthographic projection is a parallel mapping process. In orthographic projection (or parallel projection) all rays of light entering the camera are parallel to the projection vector. Perspective projection occurs when all light rays go through a common point (i.e., the viewpoint or center of projection). To apply perspective projection we must specify a perspective angle or camera view angle.

The front and back clipping planes intersect the projection vector, and are usually perpendicular to it. The clipping planes are used to eliminate data either too close to the camera or too far away. As a result only actors or portions of actors within the clipping planes are (potentially) visible. Clipping planes are typically perpendicular to the direction of projection. Their locations can be set using the camera's clipping range. The location of the planes are measured from the camera's position along the direction of projection. The front clipping plane is at the minimum range value, and the back clipping plane is at the maximum range value. Later on in Chapter 7 - Advanced Computer Graphics, when we discuss stereo rendering, we will see examples of clipping planes that are not perpendicular to the direction of projection.

Taken together these camera parameters define a rectangular pyramid, with its apex at the camera's position and extending along the direction of projection. The pyramid is truncated at the top with the front clipping plane and at the bottom by the back clipping plane. The resulting view frustum defines the region of 3D space visible to the camera.

While a camera can be manipulated by directly setting the attributes mentioned above, there are some common operations that make the job easier. Figure 3-12 and Figure 3-13 will help illustrate these operations. Changing the azimuth of a camera rotates its position around its view up vector, centered at the focal point. Think of this as moving the camera to the left or right while always keeping the distance to the focal point constant. Changing a camera's elevation rotates its position around the cross product of its direction of projection and view up centered at the focal point. This corresponds to moving the camera up and down. To roll the camera, we rotate the view up vector about the view plane normal. Roll is sometimes called twist.

The next two motions keep the camera's position constant and instead modify the focal point. Changing the yaw rotates the focal point about the view up centered at the camera's position. This is like an azimuth, except that the focal point moves instead of the position. Changes in pitch rotate the focal point about the cross product of the direction of projection and view up centered at the camera's position. Dollying in and out moves the camera's position along the direction of projection, either closer or farther from the focal point. This operation is specified as the ratio of its current distance to its new distance. A value greater than one will dolly in, while a value less than one will dolly out. Finally, zooming changes the camera's view angle, so that more or less of the scene falls within the view frustum.

Figure 3-12. Camera movements around focal point. See CameraModel1.cxx and CameraModel1.py. Figure 3-13. Camera movements around camera position. See CameraModel2.cxx and CameraModel2.py.

Once we have the camera situated, we can generate our 2D image. Some of the rays of light traveling through our 3D space will pass through the lens on the camera. These rays then strike a flat surface to produce an image. This effectively projects our 3D scene into a 2D image. The camera's position and other properties determine which rays of light get captured and projected. More specifically, only rays of light that intersect the camera's position, and are within its viewing frustum, will affect the resulting 2D image.

This concludes our brief rendering overview. The light has traveled from its sources to the actors, where it is reflected and scattered. Some of this light gets captured by the camera and produces a 2D image. Now we will look at some of the details of this process.

"},{"location":"VTKBook/03Chapter3/#36-coordinate-systems","title":"3.6 Coordinate Systems","text":"

There are four coordinate systems commonly used in computer graphics and two different ways of representing points within them (Figure 3-14). While this may seem excessive, each one serves a purpose. The four coordinate systems we use are: model, world, view, and display.

The model coordinate system is the coordinate system in which the model is defined, typically a local Cartesian coordinate system. If one of our actors represents a football, it will be based on a coordinate system natural to the football geometry (e.g., a cylindrical system). This model has an inherent coordinate system determined by the decisions of whoever generated it. They may have used inches or meters as their units, and the football may have been modeled with any arbitrary axis as its major axis.

The world coordinate system is the 3D space in which the actors are positioned. One of the actor's responsibilities is to convert from the model's coordinates into world coordinates. Each model may have its own coordinate system but there is only one world coordinate system. Each actor must scale, rotate, and translate its model into the world coordinate system. (It may also be necessary for the modeller to transform from its natural coordinate system into a local Cartesian system. This is because actors typically assume that the model coordinate system is a local Cartesian system.) The world coordinate system is also the system in which the position and orientation of cameras and lights are specified.

The view coordinate system represents what is visible to the camera. This consists of a pair of x and y values, ranging between (-1,1), and a z depth coordinate. The x, y values specify location in the image plane, while the z coordinate represents the distance, or range, from the camera. The camera's properties are represented by a four by four transformation matrix (to be described shortly), which is used to convert from world coordinates into view coordinates. This is where the perspective effects of a camera are introduced.

The display coordinate system uses the same basis as the view coordinate system, but instead of using negative one to one as the range, the coordinates are actual x, y pixel locations on the image plane. Factors such as the window's size on the display determine how the view coordinate range of (-1,1) is mapped into pixel locations. This is also where the viewport comes into effect.

Figure 3-14. Modelling, world, view and display coordinate system.

You may want to render two different scenes, but display them in the same window. This can be done by dividing the window into rectangular viewports. Then, each renderer can be told what portion of the window it should use for rendering. The viewport ranges from (0,1) in both the x and y axis. Similar to the view coordinate system, the z-value in the display coordinate system also represents depth into the window. The meaning of this z-value will be further described in the section titled \"Z-Buffer\".

"},{"location":"VTKBook/03Chapter3/#37-coordinate-transformation","title":"3.7 Coordinate Transformation","text":"

When we create images with computer graphics, we project objects defined in three dimensions onto a two-dimensional image plane. As we saw earlier, this projection naturally includes perspective. To include projection effects such as vanishing points we use a special coordinate system called homogeneous coordinates.

The usual way of representing a point in 3D is the three element Cartesian vector (x, y, z). Homogeneous coordinates are represented by a four element vector ( x_h, y_h, z_h, w_h). The conversion between Cartesian coordinates and homogeneous coordinates is given by:

x = \\frac{x_h}{w_h}\\ \\ \\ \\ y = \\frac{y_h}{w_h}\\ \\ \\ \\ z = \\frac{z_h}{w_h} \\bf\\tag{3-5}

Using homogeneous coordinates we can represent an infinite point by setting w h to zero. This capability is used by the camera for perspective transformations. The transformations are applied by using a 4x4 transformation matrix. Transformation matrices are widely used in computer graphics because they allow us to perform translation, scaling, and rotation of objects by repeated matrix multiplication. Not all of these operations can be performed using a 3x3 matrix.

For example, suppose we wanted to create a transformation matrix that translates a point (x, y, z) in Cartesian space by the vector (t_x, t_y, t_z). We need only construct the translation matrix given by

T_T = \\left[\\begin{array}{cccc} 1 & 0 & 0 & t_x \\\\ 0 & 1 & 0 & t_y \\\\ 0 & 0 & 1 & t_z \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-6}

and then postmultiply it with the homogeneous coordinate (x_h, y_h, z_h, w_h). To carry this example through, we construct the homogeneous coordinate from the Cartesian coordinate ( x, y, z) by setting w_h = 1 to yield (x, y, z, 1). Then to determine the translated point (x', y', z') we premultiply current position by the transformation matrix T_T to yield the translated coordinate. Substituting into Equation3-6 we have the result

\\left[\\begin{array}{c} x' \\\\ y' \\\\ z' \\\\ w' \\end{array}\\right] =\\left[\\begin{array}{cccc} 1 & 0 & 0 & t_x \\\\ 0 & 1 & 0 & t_y \\\\ 0 & 0 & 1 & t_z \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\cdot \\left[\\begin{array}{c} x \\\\ y \\\\ z \\\\ 1 \\end{array}\\right] \\bf\\tag{3-7}

Converting back to Cartesian coordinates via Equation3-5 we have the expected solution

x' = x + t_x \\\\ y' = y + t_y \\\\ z' = z + t_z \\bf\\tag{3-8}

The same procedure is used to scale or rotate an object. To scale an object we use the transformation matrix

T_s = \\left[\\begin{array}{cccc} s_x & 0 & 0 & 0 \\\\ 0 & s_y & 0 & 0 \\\\ 0 & 0 & s_z & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-9}

where the parameters s_x, s_y, and s_z are scale factors along the x, y, z axes. Similaryly we can rotate an object around the x axes by angle \\theta using the matrix

T_{R_x} = \\left[\\begin{array}{cccc} 1 & 0 & 0 & 0 \\\\ 0 & \\cos\\theta & -\\sin\\theta & 0 \\\\ 0 & \\sin\\theta & \\cos\\theta & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-10}

Around the y axis we use

TT_{R_y} = \\left[\\begin{array}{cccc} \\cos\\theta & 0 & \\sin\\theta0 & 0 \\\\ 0 & 1 & 0 & 0 \\\\ -\\sin\\theta & 0 & \\cos\\theta & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-11}

and around the z axis we use

T_{R_z} = \\left[\\begin{array}{cccc} \\cos\\theta & -\\sin\\theta & 0 & 0 \\\\ \\sin\\theta & \\cos\\theta & 0 & 0 \\\\ 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-12}

Another useful rotation matrix is used to transform one coordinate axes x-y-z to another coordinate axes x'-y'-z'. To derive the transformation matrix we assume that the unit x' axis make the angles (\\theta_{x'x},\\theta_{x'y},\\theta_{x'z}) around the x-y-z axes (these are called direction cosines). Similarly, the unit y' axis makes the angles (\\theta_{y'x},\\theta_{y'y},\\theta_{y'z}) and the unit z' axis makes the angles (\\theta_{z'x},\\theta_{z'y},\\theta_{z'z}). The resulting rotation matrix is formed by placing the direction cosines along the rows of the transformation matrix as follows

T_R = \\left[\\begin{array}{cccc} \\cos\\theta_{x'x} & \\cos\\theta_{x'y} & \\cos\\theta_{x'z} & 0 \\\\ \\cos\\theta_{y'x} & \\cos\\theta_{y'y} & \\cos\\theta_{y'z} & 0 \\\\ \\cos\\theta_{z'x} & \\cos\\theta_{z'y} & \\cos\\theta_{z'z} & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-13}

Rotations occur about the coordinate origin. It is often more convenient to rotate around the center of the object (or a user-specified point). Assume that we call this point the object's center. To rotate around O_c we must first translate the object from O_c to the origin, apply rotations, and then translate the object back to O_c.

Transformation matrices can be combined by matrix multiplication to achieve combinations of translation, rotation, and scaling. It is possible for a single transformation matrix to represent all types of transformation simultaneously. This matrix is the result of repeated matrix multiplications. A word of warning: The order of the multiplication is important. For example, multiplying a translation matrix by a rotation matrix will not yield the same result as multiplying the rotation matrix by the translation matrix.

"},{"location":"VTKBook/03Chapter3/#38-actor-geometry","title":"3.8 Actor Geometry","text":"

We have seen how lighting properties control the appearance of an actor, and how the camera in combination with transformation matrices is used to project an actor to the image plane. What is left to define is the geometry of the actor, and how we position it in the world coordinate system.

"},{"location":"VTKBook/03Chapter3/#modelling","title":"Modelling","text":"

A major topic in the study of computer graphics is modelling or representing the geometry of physical objects. Various mathematical techniques have been applied including combinations of points, lines, polygons, curves, and splines of various forms, and even implicit mathematical functions.

This topic is beyond the scope of the text. The important point here is that there is an underlying geometric model that specifies what the object's shape is and where it is located in the model coordinate system.

In data visualization, modelling takes a different role. Instead of directly creating geometry to represent an object, visualization algorithms compute these forms. Often the geometry is abstract (like a contour line) and has little relationship to real world geometry. We will see how these models are computed when we describe visualization algorithms in Chapter 6 - Fundamental Algorithms and Chapter 9 - Advanced Algorithms.

The representation of geometry for data visualization tends to be simple, even though computing the representations is not. These forms are most often primitives like points, lines, and polygons, or visualization data such as volume data. We use simple forms because we desire high performance and interactive systems. Thus we take advantage of computer hardware (to be covered in \"Graphics Hardware\") or special rendering techniques like volume rendering (see \"Volume Rendering\" in Chapter 7).

"},{"location":"VTKBook/03Chapter3/#actor-location-and-orientation","title":"Actor Location and Orientation","text":"

Every actor has a transformation matrix that controls its location and scaling in world space. The actor's geometry is defined by a model in model coordinates. We specify the actor's location using orientation, position, and scale factors along the coordinate axes. In addition, we can define an origin around which the actor rotates. This feature is useful because we can rotate the actor around its center or some other meaningful point.

The orientation of an actor is determined by rotations stored in an orientation vector (Ox,Roy,Oz). This vector defines a series of rotational transformation matrices. As we saw in the previous section on transformation matrices, the order of application of the transformations is not arbitrary. We have chosen a fixed order based on what we think is natural to users. The order of transformation is a rotation by O y around the y axis, then by around Ox the x axis, and finally by O z around the z axis. This ordering is arbitrary and is based on the standard camera operations. These operations (in order) are a camera azimuth, followed by an elevation, and then a roll (Figure 3-15).

All of these rotations take place around the origin of the actor. Typically this is set to the center of its bounding box, but it can be set to any convenient point. There are many different methods for changing an actor's orientation. RotateX(), RotateY(), and RotateZ() are common methods that rotate about their respective axes. Many systems also include a method to rotate about a userdefined axis. In the Visualization Toolkit the RotateXYZ() method is used to rotate around an arbitrary vector passing through the origin.

Figure 3-15. Actor coordinate system."},{"location":"VTKBook/03Chapter3/#39-graphics-hardware","title":"3.9 Graphics Hardware","text":"

Earlier we mentioned that advances in graphics hardware have had a large impact on how rendering is performed. Now that we have covered the fundamentals of rendering a scene, we look at some of the hardware issues. First, we discuss raster devices that have replaced vector displays as the primary output device. Then, we look at how our programs communicate to the graphics hardware. We also examine the different coordinate systems used in computer graphics, hidden line/surface removal, and z-buffering.

"},{"location":"VTKBook/03Chapter3/#raster-devices","title":"Raster Devices","text":"

The results of computer graphics is pervasive in today's world---digital images (generated with computer graphics) may be found on cell phones, displayed on computer monitors, broadcast on TV, shown at the movie theatre and presented on electronic billboards. All of these, and many more, display mediums are raster devices. A raster device represents an image using a two dimensional array of picture elements called pixels. For example, the word \"hello\" can be represented as an array of pixels. as shown in Figure 3-16. Here the word \"hello\" is written within a pixel array that is twenty-five pixels wide and ten pixels high. Each pixel stores one bit of information, whether it is black or white. This is how a black and white laser printer works, for each point on the paper it either prints a black dot or leaves it the color of the paper. Due to hardware limitations, raster devices such as laser printers and computer monitors do not actually draw accurate square pixels like those in Figure 3-16. Instead, they tend to be slightly blurred and overlapping. Another hardware limitation of raster devices is their resolution. This is what causes a 300 dpi (dots per inch) laser printer to produce more detailed output than a nine pin dot matrix printer. A 300 dpi laser printer has a resolution of 300 pixels per inch compared to roughly 50 dpi for the dot matrix printer. Figure 3-16. A pixel array for the word \"hello.\" Figure 3-17. Black and white dithering.

Color computer monitors typically have a resolution of about 80 pixels per inch, making the screen a pixel array roughly one thousand pixels in width and height. This results in over one million pixels, each with a value that indicates what color it should be. Since the hardware in color monitors uses the RGB system, it makes sense to use that to describe the colors in the pixels. Unfortunately, having over one million pixels, each with a red, green, and blue component, can take up a lot of memory. This is part of what differentiates the variety of graphics hardware on the market. Some companies use 24 bits of storage per pixel, others use eight, some advanced systems use more than 100 bits of storage per pixel. Typically, the more bits per pixel the more accurate the colors will be.

One way to work around color limitations in the graphics hardware is by using a technique called dithering. Say, for example, that you want to use some different shades of gray, but your graphics hardware only supports black and white. Dithering lets you approximate shades of gray by using a mixture of both black and white pixels. In Figure 3-17, seven gray squares are drawn using a mixture of black and white pixels. From a distance the seven squares look like different shades of gray even though up close, it's clear that they are just different mixtures of black and white pixels. This same technique works just as well for other colors. For example, if your graphics hardware supports primary blue, primary green, and white but not a pastel sea green, you can approximate this color by dithering the green, blue, and white that the hardware does support."},{"location":"VTKBook/03Chapter3/#interfacing-to-the-hardware","title":"Interfacing to the Hardware","text":"

Now that we have covered the basics of display hardware, the good news is that you rarely need to worry about them. Most graphics programming is done using higher-level primitives than individual pixels. Figure 3-18 shows a typical arrangement for a visualization program. At the bottom of the hierarchy is the display hardware that we already discussed; chances are your programs will not interact directly with it. The top three layers above the hardware are the layers you may need to be concerned with.

Many programs take advantage of application libraries as a high-level interface to the graphics capabilities of a system. The Visualization Toolkit accompanying this book is a prime example of this. It allows you to display a complex object or graph using just a few commands. It is also possible to interface to a number of different graphics libraries, since different libraries may be supported on different hardware platforms.

The graphics library and graphics hardware layers both perform similar functions. They are responsible for taking high-level commands from an application library or program, and executing them. This makes programming much easier by providing more complex primitives to work with. Instead of drawing pixels one at a time, we can draw primitives like polygons, triangles, and lines, without worrying about the details of which pixels are being set to which colors. Figure 3-19 illustrates some high-level primitives that all mainstream graphics libraries support.

This functionality is broken into two different layers because different machines may have vastly different graphics hardware. If you write a program that draws a red polygon, either the graphics library or the graphics hardware must be able to execute that command. On high-end systems, this may be done in the graphics hardware, on others it will be done by the graphics library in software. So the same commands can be used with a wide variety of machines, without worrying about the underlying graphics hardware.

The fundamental building block of the primitives in Figure 3-19 is a point (or vertex). A vertex has a position, normal, and color, each of which is a three element vector. The position specifies where the vertex is located, its normal specifies which direction the vertex is facing, and its color specifies the vertex's red, green, and blue components.

A polygon is built by connecting a series of points or vertices as shown in Figure 3-20. You may be wondering why each vertex has a normal, instead of having just one normal for the entire polygon. A planar polygon can only be facing one direction regardless of what the normals of its vertices indicate. The reason is that sometimes a polygon is used as an approximation of something else, like a curve. Figure 3-21 shows a top-down view of a cylinder. As you can see, it's not really a cylinder but rather a polygonal approximation of the cylinder drawn in gray. Each vertex is shared by two polygons and the correct normal for the vertex is not the same as the normal for the polygon. Similar logic explains why each vertex has a color instead of just having one color for an entire polygon. Figure 3-18. Typical graphics interface hierarchy. Figure 3-19. Graphics primitives.

When you limit yourself to the types of primitives described above, there are some additional properties that many graphics systems support. Edge color and edge visibility can be used to highlight the polygon primitives that make up an actor. Another way to do this is by adjusting the representation from surface to wireframe or points. This replaces surfaces such as polygons with either their boundary edges or points respectively. While this may not make much sense from a physical perspective, it can help in some illustrations. Using edge visibility when rendering a CAD model can help to show the different pieces that comprise the model.

"},{"location":"VTKBook/03Chapter3/#rasterization","title":"Rasterization","text":"

At this point in the text we have described how to represent graphics data using rendering primitives, and we have described how to represent images using raster display devices. The question remains, how do we convert graphics primitives into a raster image? This is the topic we address in this section. Although a thorough treatise on this topic is beyond the scope of this text, we will do our best to provide a high-level overview.

Figure 3-20. An example polygon. Figure 3-21. Vertex and polygon normals.

The process of converting a geometric representation into a raster image is called rasterization or scan conversion. In the description that follows we assume that the graphics primitives are triangle polygons. This is not as limiting as you might think, because any general polygon can be tessellated into a set of triangles. Moreover, other surface representations such as splines are usually tessellated by the graphics system into triangles or polygons. (The method described here is actually applicable to convex polygons.)

Most of today's hardware is based on object-order rasterization techniques. As we saw earlier in this chapter, this means processing our actors in order. And since our actors are represented by polygon primitives, we process polygons one at a time. So although we describe the processing of one polygon, bear in mind that many polygons and possibly many actors are processed.

The first step is to transform the polygon using the appropriate transformation matrix. We also project the polygon to the image plane using either parallel or orthographic projection. Part of this process involves clipping the polygons. Not only do we use the front and back clipping planes to clip polygons too close or too far, but we must also clip polygons crossing the boundaries of the image plane. Clipping polygons that cross the boundary of the view frustum means we have to generate new polygonal boundaries.

Figure 3-22. Rasterizing a convex polygon. Pixels are processed in horizontal spans (or scan-lines) in the image plane. Data values $d_i$ at point $p_i$ are interpolated along the edges and then along the scan-line using delta data values. Typical data values are RGB components of color.

With the polygon clipped and projected to the image plane, we can begin scan-line processing (Figure 3-22). The first step identifies the initial scan-line intersected by the projected polygon. This is found by sorting the vertices' y values. We then find the two edges joining the vertex on the left and right sides. Using the slopes of the edges along with the data values we compute delta data values. These data are typically the R, G, and B color components. Other data values include transparency values and z depth values. (The z values are necessary if we are using a z-buffer, described in the next section.) The row of pixels within the polygon (i.e., starting at the left and right edges) is called a span. Data values are interpolated from the edges on either side of the span to compute the internal pixel values. This process continues span-by-span, until the entire polygon is filled. Note that as new vertices are encountered, it is necessary to recompute the delta data values.

The shading of the polygon (i.e., color interpolation across the polygon) varies depending on the actor's interpolation attribute. There are three possibilities: flat, Gouraud, or Phong shading. Figure 3-7 illustrates the difference between flat and Gouraud interpolation. Flat shading calculates the color of a polygon by applying the lighting equations to just one normal (typically the surface normal) of the polygon. Gouraud shading calculates the color of a polygon at all of its vertices using the vertices' normals and the standard lighting equations. The interior and edges of the poly-gon are then filled in by applying the scan-line interpolation process. Phong shading is the most realistic of the three. It calculates a normal at every location on the polygon by interpolating the vertex normals. These are then used in the lighting equations to determine the resulting pixel colors. Both flat and Gouraud shading are commonly used methods. The complexity of Phong shading has prevented it from being widely supported in hardware."},{"location":"VTKBook/03Chapter3/#z-buffer","title":"Z-Buffer","text":"

In our earlier description of the rendering process, we followed rays of light from our eye through a pixel in the image plane to the actors and back to the light source. A nice side effect of ray tracing is that viewing rays strike the first actor they encounter and ignore any actors that are hidden behind it. When rendering actors using the polygonal methods described above, we have no such method of computing which polygons are hidden and which are not. We cannot generally count on the polygons being ordered correctly. Instead, we can use a number of hidden-surface methods for polygon rendering.

One method is to sort all of our polygons from back to front (along the camera's view vector) and then render them in that order. This is called the painter's algorithm or painter's sort, and has one major weakness illustrated in Figure 3-23. Regardless of the order in which we draw these three triangles, we cannot obtain the desired result, since each triangle is both in front of, and behind, another triangle. There are algorithms that sort and split polygons as necessary to treat such a situation [Carlson85]. This requires more initial processing to perform the sorting and splitting. If the geometric primitives change between images or the camera view changes, then this processing must be performed before each render. Figure 3-23. Problem with Painter's algorithm.

Another hidden surface algorithm, z-buffering, takes care of this problem and does not require sorting. Z-buffering takes advantage of the z-value (i.e., depth value along direction of projection) in the view coordinate system. Before a new pixel is drawn, its z-value is compared against the current z-value for that pixel location. If the new pixel would be in front of the current pixel, then it is drawn and the z-value for that pixel location is updated. Otherwise the current pixel remains and the new pixel is ignored. Z-buffering has been widely implemented in hardware because of its simplicity and robustness. The downside to z-buffering is that it requires a large amount of memory, called a z-buffer, to store a z-value of every pixel. Most systems use a z-buffer with a depth of 24 or 32 bits. For a 1000 by 1000 display that translates into three to four megabytes just for the z-buffer. Another problem with z-buffering is that its accuracy is limited depending on its depth. A 24-bit z-buffer yields a precision of one part in 16,777,216 over the height of the viewing frustum. This resolution is often insufficient if objects are close together. If you do run into situations with z-buffering accuracy, make sure that the front and back clipping planes are as close to the visible geometry as possible.

"},{"location":"VTKBook/03Chapter3/#310-putting-it-all-together","title":"3.10 Putting It All Together","text":"

This section provides an overview of the graphics objects and how to use them in VTK.

"},{"location":"VTKBook/03Chapter3/#the-graphics-model","title":"The Graphics Model","text":"Figure 3-24. Illustrative diagram of graphics objects. See Model.cxx and Model.py.

We have discussed many of the objects that play a part in the rendering of a scene. Now it's time to put them together into a comprehensive object model for graphics and visualization.

In the Visualization Toolkit there are seven basic objects that we use to render a scene. There are many more objects behind the scenes, but these seven are the ones we use most frequently. The objects are listed in the following and illustrated in Figure 3-24.

  1. vtkRenderWindow --- manages a window on the display device; one or more renderers draw into an instance of vtkRenderWindow.

  2. vtkRenderer --- coordinates the rendering process involving lights, cameras, and actors.

  3. vtkLight --- a source of light to illuminate the scene.

  4. vtkCamera --- defines the view position, focal point, and other viewing properties of the scene.

  5. vtkActor --- represents an object rendered in the scene, including its properties and position in the world coordinate system. (Note: vtkActor is a subclass of vtkProp. vtkProp is a more general form of actor that includes annotation and 2D drawing classes. See \"Assemblies and Other Types of vtkProp\" for more information.)

  6. vtkProperty --- defines the appearance properties of an actor including color, transparency, and lighting properties such as specular and diffuse. Also representational properties like wireframe and solid surface.

  7. vtkMapper --- the geometric representation for an actor. More than one actor may refer to the same mapper.

The class vtkRenderWindow ties the rendering process together. It is responsible for managing a window on the display device. For PCs running Windows, this will be a Microsoft display window, for Linux and UNIX systems this will be an X window, and on the Mac (OSX) a Quartz window. In VTK, instances of vtkRenderWindow are device independent. This means that you do not need to be concerned about what underlying graphics hardware or software is being used, the software automatically adapts to your computer as instances of vtkRenderWindow are created. (See \"Achieving Device Independence\" for more information.)

In addition to window management, vtkRenderWindow objects are used to manage renderers and store graphics specific characteristics of the display window such as size, position, window title, window depth, and the double buffering flag. The depth of a window indicates how many bits are allocated per pixel. Double buffering is a technique where a window is logically divided into two buffers. At any given time one buffer is currently visible to the user. Meanwhile, the second buffer can be used to draw the next image in an animation. Once the rendering is complete, the two buffers can be swapped so that the new image is visible. This common technique allows animations to be displayed without the user seeing the actual rendering of the primitives. High-end graphics systems perform double buffering in hardware. A typical system would have a rendering window with a depth of 72 bits. The first 24 bits are used to store the red, green, and blue (RGB) pixel components for the front buffer. The next 24 bits store the RGB values for the back buffer. The last 24 bits are used as a z-buffer.

The class vtkRenderer is responsible for coordinating its lights, camera, and actors to produce an image. Each instance maintains a list of the actors, lights, and an active camera in a particular scene. At least one actor must be defined, but if lights and a camera are not defined, they will be created automatically by the renderer. In such a case the actors are centered in the image and the default camera view is down the z-axis. Instances of the class vtkRenderer also provide methods to specify the background and ambient lighting colors. Methods are also available to convert to and from world, view, and display coordinate systems.

One important aspect of a renderer is that it must be associated with an instance of the vtkRenderWindow class into which it is to draw, and the area in the render window into which it draws must be defined by a rectangular viewport. The viewport is defined by normalized coordinates (0,1) in both the x and y image coordinate axes. By default, the renderer draws into the full extent of the rendering window (viewpoint coordinates (0,0,1,1)). It is possible to specify a smaller viewport. and to have more than one renderer draw into the same rendering window.

Instances of the class vtkLight illuminate the scene. Various instance variables for orienting and positioning the light are available. It is also possible to turn on/off lights as well as setting their color. Normally at least one light is \"on\" to illuminate the scene. If no lights are defined and turned on, the renderer constructs a light automatically. Lights in VTK can be either positional or infinite. Positional lights have an associated cone angle and attenuation factors. Infinite lights project light rays parallel to one another.

Cameras are constructed by the class vtkCamera. Important parameters include camera position, focal point, location of front and back clipping planes, view up vector, and field of view. Cameras also have special methods to simplify manipulation as described previously in this chapter.

These include elevation, azimuth, zoom, and roll. Similar to vtkLight, an instance of vtkCamera will be created automatically by the renderer if none is defined.

Instances of the class vtkActor represent objects in the scene. In particular, vtkActor combines object properties (color, shading type, etc.), geometric definition, and orientation in the world coordinate system. This is implemented behind the scenes by maintaining instance variables that refer to instances of vtkProperty, vtkMapper, and vtkTransform. Normally you need not create properties or transformations explicitly, since these are automatically created and manipulated using vtkActor 's methods. You do need to create an instance of vtkMapper (or one of its subclasses). The mapper ties the data visualization pipeline to the graphics device. (We will say more about the pipeline in the next chapter.)

In VTK, actors are actually subclasses of vtkProp (arbitrary props) and [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)3D (those that can be transformed in 3D space. (The word \"prop\" is derived from the stage, where a prop is an object in the scene.) There are other subclasses of props and actors with specialized behavior (see \"Assemblies and Other Types of vtkProp\" for more information). One example is vtkFollower. Instances of this class always face the active camera. This is useful when designing signs or text that must be readable from any camera position in the scene.

Instances of the class vtkProperty affect the rendered appearance of an actor. When actors are created, a property instance is automatically created with them. It is also possible to create property objects directly and then associate the property object with one or more actors. In this way actors can share common properties.

Finally, vtkMapper (and its subclasses) defines object geometry and, optionally, vertex colors. In addition, vtkMapper refers to a table of colors (i.e., vtkLookupTable) that are used to color the geometry. (We discuss mapping of data to colors in \"Color Mapping\" in Chapter 6.) We will examine the mapping process in more detail in \"Mapper Design\" in Chapter 6. For now assume that vtkMapper is an object that represents geometry and other types of visualization data.

There is another important object, vtkRenderWindowInteractor, that captures events (such as mouse clicks and mouse motion) for a renderer in the rendering window. vtkRenderWindowInteractor captures these events and then triggers certain operations like camera dolly, pan, and rotate, actor picking, into/out of stereo mode, and so on. Instances of this class are associated with a rendering window using the SetRenderWindow() method.

"},{"location":"VTKBook/03Chapter3/#achieving-device-independence","title":"Achieving Device Independence","text":"

A desirable property of applications built with VTK is that they are device independent. This means that computer code that runs on one operating system with a particular software/hardware configuration runs unchanged on a different operating system and software/hardware configuration. The advantage of this is that the programmer does not need to expend effort porting an application between different computer systems. Also, existing applications do not need to be rewritten to take advantage of new developments in hardware or software technology. Instead, VTK handles this transparently by a combination of inheritance and a technique known as object factories.

(a) Inheritance of device classes. (Note: in VTK 4.2 the Starbase and XGL graphics libraries are no longer supported.) (b) Code fragment from vtkActor::New() (c) Code fragment from vtkGraphicsFactory::CreateInstance(vtkclassname). Figure 3-25. Achieving device independence using (a) inheritance and object factories (b) and (c).

Figure 3-25a illustrates the use of inheritance to achieve device independence. Certain classes like vtkActor are broken into two parts: a device independent superclass and a device dependent subclass. The trick here is that the user creates a device dependent subclass by invoking the special constructor New() in the device independent superclass. For example we would use (in C++)

vtkActor *anActor = vtkActor::New()\n

to create a device dependent instance of vtkActor. The user sees no device dependent code, but in actuality anActor is a pointer to a device dependent subclass of vtkActor. Figure 3-25b is a code fragment of the constructor method New() which uses VTK's object factory mechanism. In turn, the vtkGraphicsFactory (used to instantiate graphical classes) produces the appropriate concrete subclass when requested to instantiate an actor as shown in Figure 3-25c.

The use of object factories as implemented using the New() method allows us to create device independent code that can move from computer to computer and adapt to changing technology. For example, if a new graphics library became available, we would only have to create a new device dependent subclass, and then modify the graphics factory to instantiate the appropriate sub-class based on environment variables or other system information. This extension would be localized and only done once, and all applications based on these object factories would be automatically ported without change.

"},{"location":"VTKBook/03Chapter3/#examples","title":"Examples","text":"

This section works through some simple applications implemented with VTK graphics objects. The focus is on the basics: how to create renderers, lights, cameras, and actors. Later chapters tie together these basic principles to create applications for data visualization.

. The following C++ code uses most of the objects introduced in this section to create an image of a cone. The vtkConeSource generates a polygonal representation of a cone and vtkPolyDataMapper maps the geometry (in conjunction with the actor) to the underlying graphics library. (The source code to this example can be found in Cone.cxx. The source code contains additional documentation as well.) 2

#include <vtkSmartPointer.h>\n#include <vtkConeSource.h>\n\n#include <vtkActor.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkNamedColors.h>\n\nint main(int, char *[])\n{\n  //Create a cone\n  auto coneSource =\n    vtkSmartPointer<vtkConeSource>::New();\n  coneSource->SetHeight( 3.0);\n  coneSource->SetRadius( 1.0);\n  coneSource->SetResolution( 10);\n  coneSource->Update();\n\n  //Create a mapper and actor\n  auto mapper =\n    vtkSmartPointer<vtkPolyDataMapper>::New();\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n\n  auto colors =\n    vtkSmartPointer<vtkNamedColors>::New();\n\n  auto actor =\n    vtkSmartPointer<vtkActor>::New();\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"bisque\").GetData());\n\n  //Create a renderer, render window, and interactor\n  auto renderer =\n    vtkSmartPointer<vtkRenderer>::New();\n  auto renderWindow =\n    vtkSmartPointer<vtkRenderWindow>::New();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  auto renderWindowInteractor =\n    vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  //Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n\n  //Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
Figure 3-26. Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source. Other polygonal source objects are available; check subclasses of vtkPolyDataAlgorithm. See SourceObjectsDemo.cxx and SourceObjectsDemo.py.

Some comments about this example. The include files vtk__.h include class definitions for the objects in VTK necessary to compile this example. We use the constructor New() to create the objects in this example, and the method Delete() to destroy the objects. In VTK the use of New() and Delete() is mandatory to insure device independence and properly manage reference counting. (See VTK User's Guide for details.) In this example the use of Delete() is really not necessary because the objects are automatically deleted upon program termination. But generally speaking, you should always use a Delete() for every invocation of New(). (Future examples will not show the Delete() methods in the scope of the main() program to conserve space, nor show the required #include statements.)

The data representing the cone (a set of polygons) in this example is created by linking together a series of objects into a pipeline (which is the topic of the next chapter). First a polygonal representation of the cone is created with a vtkConeSource and serves as input to the data mapper as specified with the SetInput() method. The SetMapper() method associates the mapper's data with the coneActor. The next line adds coneActor to the renderer's list of actors. The cone is rendered in a loop running over 360 o. Since there are no cameras or lights defined in the above example, VTK automatically generates a default light and camera as a convenience to the user. The camera is accessed through the GetActiveCamera() method, and a one degree azimuth is applied as shown. Each time a change is made to any objects a Render() method is invoked to produce the corresponding image. Once the loop is complete all allocated objects are destroyed and the program exits.

There are many different types of source objects in VTK similar to vtkConeSource as shown in Figure 3-26. In the next chapter we will learn more about source and other types of filters.

Events and Observers. A visualization toolkit like VTK is frequently used in interactive applications or may be required to provide status during operation. In addition, integration with other packages such as GUI toolkits is a common task. Supporting such features requires a mechanism for inserting user functionality into the software. In VTK, the command/observer design pattern [Gamma95] is used for this purpose.

Fundamental to this design pattern as implemented in VTK is the concept of events. An event signals that an important operation has occurred in the software. For example, if the user presses the left mouse button in the render window, VTK will invoke the LeftButtonPressEvent. Observers are objects that register their interest in a particular event or events. When one of these events is invoked, the observer receives notification and may perform any valid operation at that point; that is, execute the command associated with the observer. The benefit of the command/observer design pattern is that is simple in concept and implementation, yet provides significant power to the user. However it does require the software implementation to invoke events as it operates.

In the next example, an observer watches for the StartEvent invoked by the renderer just as it begins the rendering process. The observer in turn executes its associated command which simply prints out the camera's current position.

#include \"vtkCommand.h\"\n// Callback for the interaction\nclass vtkMyCallback : public vtkCommand\n{\npublic:\n  static vtkMyCallback *New()\n    { return new vtkMyCallback; }\n  virtual void Execute(vtkObject *caller, unsigned long, void*)\n    {\n      vtkRenderer *ren =\n               reinterpret_cast<vtkRenderer*>(caller);\n      cout << ren->GetActiveCamera()->GetPosition()[0] << \" \"\n      ren->GetActiveCamera()->GetPosition()[1] << \" \"\n      ren->GetActiveCamera()->GetPosition()[2] << \"n\";\n    }\n};\n\nint main( int argc, char *argv[] )\n{\n  vtkConeSource *cone = vtkConeSource::New();\n  cone->SetHeight( 3.0 );\n  cone->SetRadius( 1.0 );\n  cone->SetResolution( 10 );\n\n  vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();\n  coneMapper->SetInputConnection( cone->GetOutputPort() ); vtkActor\n  *coneActor = vtkActor::New(); coneActor->SetMapper( coneMapper );\n\n  vtkRenderer *ren1= vtkRenderer::New();\n  ren1->AddActor( coneActor );\n  ren1->SetBackground( 0.1, 0.2, 0.4 );\n\n  vtkRenderWindow *renWin = vtkRenderWindow::New();\n  renWin->AddRenderer( ren1 ); renWin->SetSize( 300, 300 );\n\n  vtkMyCallback *mo1 = vtkMyCallback::New();\n  ren1->AddObserver(vtkCommand::StartEvent,mo1); mo1->Delete();\n\n  int i;\n  for (i = 0; i < 360; ++i)\n  {\n  //   render the image\n    renWin->Render();\n  // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth( 1 );\n  }\n\n  cone->Delete();\n  coneMapper->Delete();\n  coneActor->Delete();\n  ren1->Delete();\n  renWin->Delete();\n  return 0;\n}\n

The observer is created by deriving from the class vtkCommand. The Execute() method is required to be implemented by any concrete subclass of vtkCommand (i.e., the method is pure virtual). The resulting subclass, vtkMyCommand, is instantiated and registered with the renderer instance ren1 using the AddObserver() method. In this case the StartEvent is the observed event.

This simple example does not demonstrate the true power of the command/observer design pattern. Later in this chapter ( \"Interpreted Code\") we will see how this functionality is used to integrate a simple GUI into VTK. In Chapter 7 - Advanced Computer Graphics three-dimensional interaction widgets will be introduced ( [\"3D Widgets and User Interaction\"]/VTKBook/07Chapter7/#718-3d-widgets-and-user-interaction).

Creating Multiple Renderers. The next example is a bit more complex and uses multiple renderers that share a single rendering window. We use viewports to define where the renderers should draw in the render window. (This C++ code can be found in Cone3.cxx.)

Figure 3-27. Four frames of output from Cone3.cxx. See Cone3.cxx and Cone3.py.
vtkRenderer *ren1= vtkRenderer::New();\nren1->AddActor( coneActor );\nren1->SetBackground( 0.1, 0.2, 0.4 );\nren1->SetViewport(0.0, 0.0, 0.5, 1.0);\n\nvtkRenderer *ren2= vtkRenderer::New();\nren2->AddActor( coneActor );\nren2->SetBackground( 0.2, 0.3, 0.5 );\nren2->SetViewport(0.5, 0.0, 1.0, 1.0);\n\nvtkRenderWindow *renWin = vtkRenderWindow::New();\nrenWin->AddRenderer( ren1 ); renWin->AddRenderer( ren2 );\nrenWin->SetSize( 600, 300 );\n\nren1->GetActiveCamera()->Azimuth(90);\n\nint i;\nfor (i = 0; i < 360; ++i)\n  {\n  // render the image renWin->Render();\n  // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth( 1 );\n    ren2->GetActiveCamera()->Azimuth( 1 );\n  }\n

As you can see, much of the code is the same as the previous example. The first difference is that we create two renderers instead of one. We assign the same actor to both renderers, but set each renderer's background to a different color. We set the viewport of the two renderers so that one is on the left half of the rendering window and the other is on the right. The rendering window's size is specified as 600 by 300 pixels, which results in each renderer drawing into a viewport of 300 by 300 pixels.

A good application of multiple renderers is to display different views of the same world as demonstrated in this example. Here we adjust the first renderer's camera with a 90 degree azimuth. We then start a loop that rotates the two cameras around the cone. Figure 3-27 shows four frames from this animation.

Properties and Transformations. The previous examples did not explicitly create property or transformation objects or apply actor methods that affect these objects. Instead, we accepted default instance variable values. This procedure is typical of VTK applications. Most instance variables have been preset to generate acceptable results, but methods are always available for you to overide the default values.

Figure 3-28. Modifying properties and transformation matrix. See Cone4.cxx and Cone4.py.

This example creates an image of two cones of different colors and specular properties. In addition, we transform one of the objects to lay next to the other. The C++ source code for this example can be found in Cone4.cxx.

vtkActor *coneActor = vtkActor::New();\nconeActor->SetMapper(coneMapper);\nconeActor->GetProperty()->SetColor(0.2, 0.63, 0.79);\nconeActor->GetProperty()->SetDiffuse(0.7);\nconeActor->GetProperty()->SetSpecular(0.4);\nconeActor->GetProperty()->SetSpecularPower(20);\n\nvtkProperty *property = vtkProperty::New();\nproperty->SetColor(1.0, 0.3882, 0.2784);\nproperty->SetDiffuse(0.7);\nproperty->SetSpecular(0.4);\nproperty->SetSpecularPower(20);\n\nvtkActor *coneActor2 = vtkActor::New();\nconeActor2->SetMapper(coneMapper);\nconeActor2->GetProperty()->SetColor(0.2, 0.63, 0.79);\nconeActor2->SetProperty(property); coneActor2->SetPosition(0, 2, 0);\n\nvtkRenderer *ren1= vtkRenderer::New();\nren1->AddActor( coneActor );\nren1->AddActor( coneActor2 );\nren1->SetBackground( 0.1, 0.2, 0.4 );\n

We set the actor coneActor properties by modifying the property object automatically created by the actor. This differs from actor coneActor2, where we create a property directly and then assign it to the actor. ConeActor2 is moved from its default position by applying the SetPosition() method. This method affects the transformation matrix that is an instance variable of the actor. The resulting image is shown in Figure 3-28.

Introducing vtkRenderWindowInteractor. The previous examples are not interactive. That is, it is not possible to directly interact with the data without modifying and recompiling the C++ code. One common type of interaction is to change camera position so that we can view our scene from different vantage points. In the Visualization Toolkit we have provided a suite of convenient objects to do this: vtkRenderWindowInteractor, vtkInteractorStyle and their derived classes.

Instances of the class vtkRenderWindowInteractor capture windowing system specific mouse and keyboard events in the rendering window, and then translate these events into VTK events. For example, mouse motion in an X11 or Windows application (occurring in a render window) would be translated by vtkRenderWindowInteractor into VTK's MouseMoveEvent. Any observers regis- tered for this event would be notified (see \"Events and Observers\"). Typically an instance of vtkInteractorStyle is used in combination with vtkRenderWindowInteractor to define a behavior associated with particular events. For example, we can perform camera dolly, pan, and rotation by using different mouse button and motion combinations. The following code fragment shows how to instantiate and use these objects. This example is the same as our first example with the addition of the interactor and interactor style. The complete example C++ code is in Cone5.cxx.

vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();\niren->SetRenderWindow(renWin);\n\nvtkInteractorStyleTrackballCamera *style =\n vtkInteractorStyleTrackballCamera::New();\n\niren->SetInteractorStyle(style);\niren->Initialize();\niren->Start();\n

After the interactor is created using its New() method, we must tell it what render window to capture events in using the SetRenderWindow() method. In order to use the interactor we have to initialize and start the event loop using the Initialize() and Start() methods, which works with the event loop of the windowing system to begin to catch events. Some of the more useful events include the \" w\" key, which draws all actors in wireframe; the \" s\" key, which draws the actors in surface form; the \" 3\" key, which toggles in and out of 3D stereo for those systems that support this; the \"r\" key, which resets camera view; and the \" e\" key, which exits the application. In addition, the mouse buttons rotate, pan, and dolly about the camera's focal point. Two advanced features are the \"u\" key, which executes a user-defined function; and the \" p\" key, which picks the actor under the mouse pointer.

Interpreted Code. In the previous example we saw how to create an interactor style object in conjunction with vtkRenderWindowInteractor to enable us to manipulate the camera by mousing in the render window. Although this provides flexibility and interactivity for a large number of applications, there are examples throughout this text where we want to modify other parameters. These parameters range from actor properties, such as color, to the name of an input file. Of course we can always write or modify C++ code to do this, but in many cases the turn-around time between making the change and seeing the result is too long. One way to improve the overall interactivity of the system is to use an interpreted interface. Interpreted systems allow us to modify objects and immediately see the result, without the need to recompile and relink source code. Interpreted languages also provide many tools, such as GUI (Graphical User Interface) tools, that simplify the creation of applications.

The Visualization Toolkit has built into its compilation process the ability to automatically generate language bindings to the [Ousterhout94]. This so-called wrapping process automatically creates a layer between the C++ VTK library and the interpreter as illustrated in Figure 3-29. There is a one-to-one mapping between C++ methods and Python C++ functions for most objects and methods in the system. To demonstrate this, the following example repeats the previous C++ example except that it is implemented with a Python script. (The script can be found in Cone5.py.) Figure 3-29. In VTK the C++ library is automatically wrapped with the interpreted languages Python and Java.

!/usr/bin/env python\nimport vtk\ncolors = vtk.vtkNamedColors ()\n\ncone = vtk.vtkConeSource ()\ncone.SetHeight ( 3.0 )\ncone.SetRadius ( 1.0 )\ncone.SetResolution ( 10 )\n\nconeMapper = vtk.vtkPolyDataMapper ()\nconeMapper.SetInputConnection (cone.GetOutputPort ())\n\nconeActor = vtk.vtkActor ()\nconeActor.SetMapper ( coneMapper )\n\nren1 = vtk.vtkRenderer ()\nren1.AddActor( coneActor )\nren1.SetBackground (colors.GetColor3d (\"MidnightBlue\"))\n\nrenWin = vtk.vtkRenderWindow ()\nrenWin.AddRenderer (ren1)\nrenWin.SetSize (300 , 300)\n\niren = vtk.vtkRenderWindowInteractor ()\niren.SetRenderWindow (renWin)\n\nstyle = vtk.vtkInteractorStyleTrackballCamera ()\niren.SetInteractorStyle (style)\n\niren.Initialize ()\niren.Start ()\n
Figure 3-30. Using Tcl and Tk to build an interpreted application.

The example begins by loading some shared libraries defining various VTK classes. Next the standard visualization pipeline is created from the vtkConeSource and vtkPolyDataMapper. The rendering classes are created exactly the same as with the C++ example. One major addition is an observer to watch for a UserEvent in the rendering window (by default a \"keypress-u\"). The observer triggers the invocation of a Tcl script to raise a Tk interactor GUI widget called.vtkInteract. This GUI, which allows the direct typing of Tcl statements, is shown in Figure 3-30 and is defined by the Tcl command package require vtkinteraction which was executed earlier in the script. (Note: Tk is a popular GUI toolkit for interpreted languages and is distributed as part of Tcl.)

As we can see from this example, the number of lines of code is less for the Tcl example than for equivalent C++ code. Also, many of the complexities of C++ are hidden using the interpreted language. Using this user-interface GUI we can create, modify, and delete objects, and modify their instance variables. The resulting changes appear as soon as a Render() method is applied or mouse events in the rendering window cause a render to occur. We encourage you to use Tcl (or one of the other interpreters) for rapid creation of graphics and visualization examples. C++ is best used when you desire higher performing applications.

"},{"location":"VTKBook/03Chapter3/#transform-matrices","title":"Transform Matrices","text":"

Transformation matrices are used throughout Visualization Toolkit. Actors (subclasses of vtkProp3D) see \"Assemblies and Other Types of vtkProp\" use them to position and orient themselves. Various filters, including vtkGlyph3D and vtkTransformFilter, use transformation matrices to implement their own functionality. As a user you may never use transformation matrices directly, but understanding them is important to successful use of many VTK classes.

The most important aspect to applying transformation matrices is to understand the order in which the transformations are applied. If you break down a complex series of transformations into simple combinations of translation, scaling, and rotation, and keep careful track of the order of application, you will have gone a long way to mastering their use.

A good demonstration example of transformation matrices is to examine how vtkActor uses its internal matrix. vtkActor has an internal instance variable Transform to which it delegates many of its methods or uses the matrix to implement its methods. For example, the RotateX(), RotateY(),and RotateZ() methods are all delegated to Transform. The method SetOrientation() uses Transform to orient the actor. The vtkActor class applies transformations in an order that we feel is natural to most users.

The vtkActor class applies transformations in an order that we feel is natural to most users. As a convenience, we have created instance variables that abstract the transformation matrices. The Origin (o_x,o_y,o_z) specifies the point that is the center of rotation and scaling. The Position (p_x, p_y, p_z) specifies a final translation of the object. Orientation (r_x, r_y, r_z) defines the rotation about the x, y and z axes. Scale (s_x, s_y, s_z) defines scale factors for the x, y, and z axes. Internally, the actor uses these instance variables to create the following sequence of transformations (see Equation3-6, Equation3-9, Equation3-13).

T = T_T(p_x + o_{x'}p_y + o_{y'}p_y + o_z)T_{R_z}T_{R_x}T_{R_z}T_ST_T(-o_x,-o_y,-o_z) \\bf\\tag{3-14}

The term T_T(x, y, z) denotes the translations in the x,y and z direction. Recall that we premultiply the transformation matrix times the position vector. This means the transformations are read from right to left. In other words, Equation3-14 proceeds as follows:

  1. Translate the actor to its origin. Scaling and rotation will occur about this point. The initial translation will be countered by a translation in the opposite direction after scaling and rotations are applied.

  2. Scale the geometry.

  3. Rotate the actor about the y, then x, and then z axes.

  4. Undo the translation of step 1 and move the actor to its final location.

The order of the transformations is important. In VTK the rotations are ordered to what is natural in most cases. We recommend that you spend some time with the software to learn how these transfor-mations work with your own data.

Probably the most confusing aspect of transformations are rotations and their effect on the Orientation instance variable. Generally orientations are not set directly by the user, and most users will prefer to specify rotations with the RotateX(), RotateY(), and RotateZ() methods. These methods perform rotations about the x, y, and z axes in an order specified by the user. New rotations are applied to the right of the rotation transformation. If you need to rotate your actor about a single axis, the actor will rotate exactly as you expect it will, and the resulting orientation vector will be as expected. For example, the operation RotateY(20) will produce an orientation of (0,20,0) and a RotateZ(20) will produce (0,0,20). However, a RotateY(20) followed by a RotateZ(20) will not produce (0,20,20) but produce an orientation of (6.71771, 18.8817, 18.8817)! This is because the rotation portion of Equation3-14 is built from the rotation order z, then x, and then y. To verify this, a RotateZ(20) followed by a RotateY(20) does produce an orientation of (0,20,20). Adding a third rotation can be even more confusing.

A good rule of thumb is to only use the SetOrientation() method to either reset the orientation to (0,0,0) or to set just one of the rotations. The RotateX(), RotateY(), and RotateZ() methods are preferred to SetOrientation() when multiple angles are needed. Remember that these rotations are applied in reverse order. Figure 3-31 illustrates the use of the rotation methods. We turn off the erase between frames using the render window's EraseOff() method so we can see the effects of the rotations. Note that in the fourth image the cow still rotates about her own y axis even though an x axis rotation preceded the y rotation. Figure 3-31. Rotations of a cow about her axes. In this model, the *x* axis is from the left to right; the *y* axis is from bottom to top; and the *z* axis emerges from the image. The camera location is the same in all four images. See Rotations.cxx and Rotations.py.

We have seen that VTK hides some of the complexities of matrix transformations by using instance variables that are more natural than a transformation matrix. But there will be times when the predefined order of transformations performed by the actor will not be sufficient. vtkActor has an instance variable UserMatrix that contains a 4 x 4 transformation matrix. This matrix is applied before the transformation composed by the actor. As you become more comfortable with 4 x 4 transformation matrices you may want to build your own matrix. The object vtkTransform creates and manipulates these matrices. Unlike an actor, an instance of vtkTransform does not have an instance variable for position, scale, origin, etc. You control the composition of the matrix directly.

The following statements create an identical 4 x 4 matrix that the actor creates:

vtkTransform *myTrans = vtkTransform::New ();\nmyTrans->Translate(position[0],position[1],position[2]);\nmyTrans->Translate(origin[0],origin[1],origin[2]);\nmyTrans->RotateZ(orientation[2]);\n\nmyTrans->RotateX (orientation[0]);\nmyTrans->RotateZ(orientation[1];\nmyTrans->Scale (scale[0],scale[1],scale[2]);\nmyTrans->Translate (-origin[0],-origin[1],-origin[2]);\n

Compare this sequence of transform operations with the transformation in Equation3-14.

Our final example shows how the transform built with vtkTransform compares with a transform built by vtkActor. In this example, we will transform our cow so that she rotates about the world coordinate origin (0,0,0). She will appear to be walking around the origin. We accomplish this in two ways: one using vtkTransform and the actor's UserMatrix, then using the actor's instance variables.

First, we will move the cow five feet along the z axis then rotate her about the origin. We always specify transformations in the reverse order of their application:

vtkTransform *walk = vtkTransform::New();\nwalk->RotateY(0,20,0);\nwalk->Translate(0,0,5);\n\nvtkActor *cow=vtkActor::New();\ncow->SetUserMatrix(walk->GetMatrix());\n

These operations produce the transformation sequence:

T=T_{R_y}T_ST_T(0, 0, 5) \\bf\\tag{3-15}

Now we do the same using the cow's instance variables:

vtkActor *cow=vtkActor::New();\ncow->SetOrigin(0,0,-5);\ncow->RotateY(20);\ncow->SetPosition(0,0,5);\n

When the actor builds its transform it will be:

T=T_T(0,0,5-(-5))T_{R_y}T_ST_T(0,0,-(-5)) \\bf\\tag{3-16}

Canceling the minus signs in the right-most translation matrix and combining the position and origin translation produce the equivalent transform that we built with vtkTranform. Figure 3-32 shows the cow rotating with the specified transformation order. Your preference is a matter of taste and how comfortable you are with matrix transformations. As you become more skilled (and your demands are greater) you may prefer to always build your transformations. VTK gives you the choice.

There is one final and powerful operation that affects an actor's orientation. You can rotate an actor about an arbitrary vector positioned at the actor's origin. This is done with the actor's (and transform's) RotateWXYZ() method. The first argument of the operation specifies the number of degrees to rotate about the vector specified by the next three arguments. Figure 3-33 shows how to rotate the cow about a vector passing through her nose. At first, we leave the origin at (0,0,0). This is obviously not what we wanted. The second figure shows the rotation when we change the cow's rotation origin to the tip of her nose. Figure 3-32. The cow \"walking\" around the global origin. See WalkCow.cxx and WalkCow.py. (a) (b) Figure 3-33. The cow rotating about a vector passing through her nose. (a) With origin (0,0,0). (b) With origin at (6.1,1.3,.02). See WalkCowA.cxx and WalkCowA.py.; (b). See WalkCowB.cxx and WalkCowB.py."},{"location":"VTKBook/03Chapter3/#assemblies-and-other-types-of-vtkprop","title":"Assemblies and Other Types of vtkProp","text":"

Often it is desirable to collect actors into a hierarchy of transform-dependent groups. For example, a robot arm may be represented by rigid links connected at joints such as the shoulder joint, upper arm, elbow, lower arm, wrist joint, and hand. In such a configuration, when the shoulder joint rotates, the expected behavior is that the entire arm rotates since the links are connected together. This is an example of what is referred to as an assembly in VTK. vtkAssembly is just one of many actor-like classes in VTK. As Figure 3-34 shows, these classes are arranged into a hierarchy of vtkProps. (In stage and film terminology, a prop is something that appears or is used on stage.) Assemblies are formed in VTK by instantiating a vtkAssembly and then adding parts to it. A part is any instance of vtkProp3D ---including other assemblies. This means that assemblies can be formed into hierarchies (as long as they do not contain self-referencing loops). Assemblies obey the rules of transformation concatenation illustrated in the previous section (see \"Transformation Matrices\"). Here is an example of how to create a simple assembly hierarchy (from assembly.tcl).

vtkSphereSource sphere\nvtkPolyDataMapper sphereMapper\n   sphereMapper SetInputConnection [sphere GetOutputPort]\nvtkActor sphereActor\n  sphereActor SetMapper sphereMapper\n  sphereActor SetOrigin 2 1 3\n  sphereActor RotateY 6\n  sphereActor SetPosition 2.25 0 0\n  [sphereActor GetProperty] SetColor 1 0 1\n\nvtkCubeSource cube\nvtkPolyDataMapper cubeMapper\n  cubeMapper SetInputConnection [cube GetOutputPort]\nvtkActor cubeActor\n  cubeActor SetMapper cubeMapper\n  cubeActor SetPosition 0.0 .25 0\n  [cubeActor GetProperty] SetColor 0 0 1\n\nvtkConeSource cone\nvtkPolyDataMapper coneMapper\n  coneMapper SetInputConnection [cone GetOutputPort]\nvtkActor coneActor\n  coneActor SetMapper coneMapper\n  coneActor SetPosition 0 0 .25\n  [coneActor GetProperty] SetColor 0 1 0\n\nvtkCylinderSource cylinder\nvtkPolyDataMapper cylinderMapper\n  cylinderMapper SetInputConnection [cylinder GetOutputPort]\n  cylinderMapper SetResolveCoincidentTopologyToPolygonOffset\n\nvtkActor cylinderActor\n  cylinderActor SetMapper cylinderMapper\n  [cylinderActor GetProperty] SetColor 1 0 0\n\nvtkAssembly assembly\n  assembly AddPart cylinderActor\n  assembly AddPart sphereActor\n  assembly AddPart cubeActor\n  assembly AddPart coneActor\n  assembly SetOrigin 5 10 15\n\n# allows faces a specified camera and is used for billboards.\n  assembly AddPosition 5 0 0\n  assembly RotateX 15\n\nren1 AddActor assembly\nren1 AddActor coneActor\n
Figure 3-34. Figure 3-34 The vtkProp hierarchy. Props that can be transformed in 3D space are a subclass of vtkProp3D. Images can be drawn effectively with vtkImageActor. Overlay text and graphics use vtkActor2D. Hierarchical groups of vtkProps are gathered into a vtkPropAssembly. Volume rendering uses vtkVolume. Collections of transformable props create a vtkAssembly. Level-of-detail rendering uses vtkLODProp3D and vtkLODActor. A vtkFollower allows faces a specified camera and is used for billboards.

Note that in this example various actors are added to the assembly with the AddPart() method. The top-level element of the assembly is the only prop in the hierarchy added to the renderer (with AddActor()). Note also that the coneActor appears twice: once as a part of the assembly, and once as a separate actor added to the renderer with AddActor(). As you might imagine, this means that the rendering of assemblies requires concatenation of transformation matrices to insure the correct positioning of each [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)3D. Furthermore, hierarchical assemblies require special treatment during picking (i.e., graphically selecting props) since a vtkProp can appear more than once in differ-ent assembly hierarchies. Picking issues are discussed in more detail in \"Picking\" in Chapter 8.

As Figure 3-34 indicates, there are other types of vtkProp as well. Most of these will be informally described in the many examples found in this book. In particular, extensive coverage is given to vtkVolume when we describe volume rendering (see \"Volume Rendering\" in Chapter 7)."},{"location":"VTKBook/03Chapter3/#311-chapter-summary","title":"3.11 Chapter Summary","text":"

Rendering is the process of generating an image using a computer. Computer graphics is the field of study that encompasses rendering techniques, and forms the foundation of data visualization.

Three-dimensional rendering techniques simulate the interaction of lights and cameras with objects, or actors, to generate images. A scene consists of a combination of lights, cameras, and actors. Object-order rendering techniques generate images by rendering actors in a scene in order. Image-order techniques render the image one pixel at a time. Polygonbased graphics hardware is based on object-order techniques. Ray tracing or ray-casting is an image-order technique.

Lighting models require a specification of color. We saw both the RGB (red-green-blue) and HSV (hue-saturation-value) color models. The HSV model is a more natural model than the RGB model for most users. Lighting models also include effects due to ambient, diffuse, and specular lighting.

There are four important coordinate systems in computer graphics. The model system is the 3D coordinate system where our geometry is defined. The world system is the global Cartesian system. All modeled data is eventually transformed into the world system. The view coordinate system represents what is visible to the camera. It is a 2D system scaled from (-1,1). The display coordinate system uses actual pixel locations on the computer display.

Homogeneous coordinates are a 4D coordinate system in which we can include the effects of perspective transformation. Transformation matrices are 4x4 matrices that operate on homogeneous coordinates. Transformation matrices can represent the effects of translation, scaling, and rotation of an actor. These matrices can be multiplied together to give combined transformations.

Graphics programming is usually implemented using higher-level graphics libraries and specialized hardware systems. These dedicated systems offer better performance and easier implemen-tation of graphics applications. Common techniques implemented in these systems include dithering and z-buffering. Dithering is a technique to simulate colors by mixing combinations of available colors . Z-buffering is a technique to perform hidden-line and hidden-surface removal.

The Visualization Toolkit uses a graphics model based on lights, cameras, actors, and render-ers. The renderers draw into rendering windows. Actor properties are represented by a property object and their geometry by a mapper object. Taken together, the instantiations of these various classes form a scene. Interaction with the objects in a scene is facilitated by the vtkRenderWindowInteractor and vtkInteractorStyle classes. These use the command/observer design pattern that triggers and responds to events. Users can observe particular events and write callbacks that can perform arbitrary tasks, easily extending the toolkit for a particular application.

"},{"location":"VTKBook/03Chapter3/#312-bibliographic-notes","title":"3.12 Bibliographic Notes","text":"

This chapter provides the reader with enough information to understand the basic issues and terms used in computer graphics. There are a number of good text books that cover computer graphics in more detail and are recommended to readers who would like a more thorough understanding. The bible of computer graphics is [FoleyVanDam90]. For those wishing for less intimidating books [BurgerGillies89] and [Watt93] are also useful references. You also may wish to peruse proceedings of the ACM SIGGRAPH conferences. These include papers and references to other papers for some of the most important work in computer graphics. [Carlson85] provides a good introduction for those who wish to learn more about the human vision system.

"},{"location":"VTKBook/03Chapter3/#313-references","title":"3.13 References","text":"

[Bresenham65] J. E. Bresenham.\"Algorithm for Computer Control of a Digital Plotter.\" IBM Systems Journal, 4(1): 25--30, January 1965.

[BurgerGillies89] P. Burger and D. Gillies. Interactive Compute Graphics Functional, Procedural and Device-Level Methods. Addison-Wesley, Reading, MA, 1989.

[Carlson85] N. R. Carlson. Physiology of Behaviour (3d Edition). Allyn and Bacon Inc., Newton, MA, 1985.

[Dartnall83] H. J. A. Dartnall, J. K. Bowmaker, and J. D. Mollon. \"Human Visual Pigments: Microspectropho-tometric Results from the Eyes of Seven Persons.\" Proceedings of the Royal Society, London, 1983.

[FoleyVanDam90] J. D. Foley, A. van Dam, S. K. Feiner, and J. F. Hughes. Computer Graphics Principles and Practice (2d Edition). Addison-Wesley, Reading, MA, 1990.

[Fuchs80] H. Fuchs, Z. M. Kedem, and B. F. Naylor. \"On Visible Surface Generation By A Priori Tree Structure.\" Computer Graphics (SIGGRAPH '80), 14(3):124--133, 1980.

[Gamma95] E. Gamma, R. Helm, R. Johnson, J. Vlissides. Design Patterns Elements of Reusable Object-Oriented Software. Addison-Wesley 1995. ISBN0-201-63361-2.

[Ousterhout94] J. K.Ousterhout. Tcl and the Tk Toolkit. Addison-Wesley Publishing Company, Reading, MA, 1994.

[Watt93] A. Watt. 3D Computer Graphics (2d Edition). Addison-Wesley, Reading, MA, 1993.

[Whitted80] T. Whitted. \"An Improved Illumination Model for Shaded Display.\" Communications of the ACM, 23(6):343-349, 1980.

"},{"location":"VTKBook/03Chapter3/#314-exercises","title":"3.14 Exercises","text":"

3.1 Estimate the odds of a ray of light being emitted from the sun, traveling to earth and hitting a one meter square picnic blanket. You can assume that the sun is a point light source that emits light uniformly in all directions. The approximate distance from the sun to the earth is 150,000,000 km.

a) What are the odds when the sun is directly overhead?

b) What are the odds when the sun is inclined 45 degrees relative to the surface normal of the picnic blanket?

c) What assumptions or approximations did you make?

3.2 Proceeding from your result of Exercise 3.1, what are the difficulties in determining the odds of a ray of light traveling from the sun to hit the picnic blanket and then entering a viewer's eye?

3.3 The color cyan can be represented in both the HSV and RGB color spaces as shown in Figure 3-4. These two representations for cyan do not yield the same wavelength intensity plots. How do they differ?

3.4 The vtkSphereSource class generates a polygonal model of a sphere. Using the examples at the end of this chapter as starting points, create a program to display a white sphere. Set the ambient and diffuse intensities to 0.5. Then add a for-loop to this program that adjusts the ambient and diffuse color of this sphere so that as the loop progresses, the diffuse color goes from red to blue, and the ambient color goes from blue to green. You might also try adjusting other lighting parameters such as specular color, ambient, diffuse, and specular intensity.

3.5 Using the vtkSphereSource as described in Exercise 3.4, create a program to display the sphere with a light source positioned at (1,1,1). Then extend this program by adding a forloop that will adjust the active camera's clipping range so that increasing portions of the interior of the sphere can be seen. By increasing the first value of the clipping range, you will be adjusting the position of the front clipping plane. Once the front clipping plane starts intersecting the sphere, you should be able to see inside of it. The default radius of the vtkSphereSource is 0.5, so make sure that you adjust the clipping range in increments less than 1.0.

3.6 Modify the program presented in \"Render a Cone\" so that the user can enter in a world coordinate in homogenous coordinates and the program will print out the resulting display coordinate. Refer to the reference page for vtkRenderer for some useful methods.

a) Are there any world coordinates that you would expect to be undefined in display coordinates?

b) What happens when the world coordinates are behind the camera?

3.7 Consider rasterizing a ten by ten pixel square. Contrast the approximate difference in the number of arithmetic operations that would need to be done for the cases where it is flat, Gouraud, or Phong shaded.

3.8 When using a z-buffer, we must also interpolate the z-values (or depth) when rasterizing a primitive. Working from Exercise 3.7, what is the additional burden of computing z-buffer values while rasterizing our square?

3.9 vtkTransform has a method GetOrientation() that looks at the resulting transformation matrix built from a series of rotations and provides the single x, y, and z rotations that will reproduce the matrix. Specify a series of rotations in a variety of orders and request the orientation with GetOrientation(). Then apply the rotations in the same order that vtkActor does and verify that the resulting 4 x 4 transformation matrix is the same.

3.10 vtkTransform, by default, applies new transformations at the right of the current transformation. The method PostMultiply() changes the behavior so that the transformations are applied to the left.

a) Use vtkTransform to create a transform using a variety of transformation operators including Scale(), RotateXYZ(), and Translate(). Then create the same matrix with PostMultiplyOn().

b) Applying rotations at the right of a series of transformations in effect rotates the object about its own coordinate system. Use the rotations.tcl script to verify this. Can you explain this?

c) Applying rotations at the left of a series of transformations in effect rotates the object about the world coordinate system. Modify the rotations.tcl script to illustrate this. (Hint: you will have to create an explicit transform with vtkTransform and set the actor's transform with SetUserMatrix().)

LocalWords: sp postmultiply premultiply Similaryly TT userdefined RotateXYZ LocalWords: theatre

"},{"location":"VTKBook/04Chapter4/","title":"Chapter 4 - The Visualization Pipeline","text":"

In the previous chapter we created graphical images using simple mathematical models for lighting, viewing, and geometry. The lighting model included ambient, diffuse, and specular effects. Viewing included the effects of perspective and projection. Geometry was defined as a static collection of graphics primitives such as points and polygons. In order to describe the process of visualization we need to extend our understanding of geometry to include more complex forms. We will see that the visualization process transforms data into graphics primitives. This chapter examines the process of data transformation and develops a model of data flow for visualization systems.

"},{"location":"VTKBook/04Chapter4/#41-overview","title":"4.1 Overview","text":"

Visualization transforms data into images that efficiently and accurately convey information about the data. Thus, visualization addresses the issues of transformation and representation.

Transformation is the process of converting data from its original form into graphics primitives, and eventually into computer images. This is our working definition of the visualization process. An example of such a transformation is the process of extracting stock prices and creating an x-y plot depicting stock price as a function of time.

Representation includes both the internal data structures used to depict the data and the graphics primitives used to display the data. For example, an array of stock prices and an array of times are the computational representation of the data, while the x-y plot is the graphical representation. Visualization transforms a computational form into a graphical form.

From an object-oriented viewpoint, transformations are processes in the functional model, while representations are the objects in the object model. Therefore, we characterize the visualization model with both functional models and object models.

"},{"location":"VTKBook/04Chapter4/#a-data-visualization-example","title":"A Data Visualization Example","text":"

A simple mathematical function for a quadric will clarify these concepts. The function

\\begin{equation*} F(x,y,z) = a_0 x^2 + a_1 y^2 + a_2 z^2 + a_3 x y + a_4 y z + a_5 x z + a_6 x + a_7 y + a_8 z + a_9 \\end{equation*} \\bf\\tag{4-1}

is the mathematical representation of a quadric. Figure 4-1a shows a visualization of Equation 4-1 in the region -1 \\leq x, y, z \\leq 1. The visualization process is as follows. We sample the data on a regular grid at a resolution of 50 \\times 50 \\times 50. Three different visualization techniques are then used. On the left, we generate 3D surfaces corresponding to the function F(x, y, z) = c where c is an arbitrary constant (i.e., the isosurface value). In the center, we show three different planes that cut through the data and are colored by function value. On the right we show the same three planes that have been contoured with constant valued lines. Around each we place a wireframe outline."},{"location":"VTKBook/04Chapter4/#the-functional-model","title":"The Functional Model","text":"

The functional model in Figure 4-1b illustrates the steps to create the visualization. The oval blocks indicate operations (processes) we performed on the data, and the rectangular blocks represent data stores (objects) that represent and provide access to data. Arrows indicate the direction of data movement. Arrows that point into a block are inputs; data flowing out of a block indicate outputs. The blocks also may have local parameters that serve as additional input. Processes that create data with no input are called data source objects, or simply sources. Processes that consume data with no output are called sinks (the are also called mappers because these processes map data to a final image or output). Processes with both an input and an output are called filters. The functional model shows how data flows through the system. It also describes the dependency of the various parts upon one another. For any given process to execute correctly, all the inputs must be up to date. This suggests that functional models require a synchronization mechanism to insure that the correct output will be generated.

The functional model shows how data flows through the system. It also describes the dependency of the various parts upon one another. For any given process to execute correctly, all the inputs must be up to date. This suggests that functional models require a synchronization mechanism to insure that the correct output will be generated.

"},{"location":"VTKBook/04Chapter4/#the-visualization-model","title":"The Visualization Model","text":"

In the examples that follow we will frequently use a simplified representation of the functional model to describe visualization processes ( Figure 4-1c). We will not explicitly distinguish between sources, sinks, data stores, and process objects. Sources and sinks are implied based on the number of inputs or outputs. Sources will be process objects with no input. Sinks will be process objects with no output. Filters will be process objects with at least one input and one output. Intermediate data stores will not be represented. Instead we will assume that they exist as necessary to support the data flow. Thus, as Figure 4-1c shows, the Lines data store that the Outline object generates ( Figure 4-1b are combined into the single object Outline. We use oval shapes to represent objects in the visualization model. (b) Functional model Sample F(x,y,z) See QuadricVisualization.cxx and QuadricVisualization.py. (b) Functional model (c) Visualization network Figure 4-1. Visualizing a quadric function F(x,y,z) = c.."},{"location":"VTKBook/04Chapter4/#the-object-model","title":"The Object Model","text":"

The functional model describes the flow of data in our visualization, the object model describes which modules operate on it. But what are the objects in the system? At first glance, we have two choices (Figure 4-2). Figure 4-2. Object model design choices. One basic choice is to combine processes and data stores into a single object. This is the usual object-oriented choice. Another choice creates separate data objects and process objects.

The first choice combines data stores (object attributes) with processes (object methods) into a single object. In the second choice we use separate objects for data stores and processes. There is actually a third alternative: a hybrid combination of these two choices.

The conventional object-oriented approach (our first choice above) combines data stores and processes into a single object. This view follows the standard definition that objects contain a data representation combined with procedures to operate on the data. One advantage of this approach is that the processes, which are the data visualization algorithms, have complete access to the data structures, resulting in good computational performance. But this choice suffers from several drawbacks.

  • From a user's perspective, processes are often viewed as independent of data representation. In other words, processes are naturally viewed as objects in the system. For example, we often say we want to \"contour\" data, meaning creating lines or surfaces corresponding to a constant data value. To the user it is convenient to have a single contour object to operate on different data representations.

  • We must duplicate algorithm implementation. As in the previous contouring example, if we bind data stores and processes into a single object, the contour operation must be recreated for each data type. This results in duplicating code even though the implementations of an algorithm may be functionally and structurally similar. Modifying such algorithms also means modifying a large amount of code, since they are implemented across many objects.

  • Binding data stores and algorithms together results in complex, data dependent code. Some algorithms may be much more complex than the data they operate on, with large numbers of instance variables and elaborate data structures. By combining many such algorithms with a data store, the complexity of the object greatly increases, and the simple meaning of the object becomes lost.

The second choice separates the data stores and processes. That is, one set of objects represents and provides access to the data, while another set of objects implements all operations on the data. Our experience shows that this is natural to users, although it may be considered unconventional to the object-oriented purist. We also have found that the resulting code is simple, modular, and easy for developers to understand, maintain, and extend.

One disadvantage to the second choice is that the interface between data representation and process is more formal. Thus the interface must be carefully designed to insure good performance and flexibility. Another disadvantage is that strong separation of data and process results in duplicate code. That is, we may implement operations that duplicate algorithms and that cannot be considered strictly data access methods. One example of such a situation is computing data derivatives. This operation is more than simple data access, so strictly speaking it doesn't belong in the data object methods. So to compute derivatives we would have to duplicate the code each time we needed derivatives computed. (Or create a procedural library of functions or macros!)

As a result of these concerns we use the hybrid approach in the Visualization Toolkit. Our approach is closest to the second choice described above, but we have selected a small set of critical operations that we implement within the data objects. These operations have been identified based on our experience implementing visualization algorithms. This effectively combines the first two choices to receive the maximum benefit and fewest disadvantages of each.

"},{"location":"VTKBook/04Chapter4/#42-the-visualization-pipeline","title":"4.2 The Visualization Pipeline","text":"

In the context of data visualization, the functional model of Figure 4-1c is referred to as the visualization pipeline or visualization network. The pipeline consists of objects to represent data (data objects), objects to operate on data (process objects), and an indicated direction of data flow (arrow connections between objects). In the text that follows, we will frequently use visualization networks to describe the implementation of a particular visualization technique."},{"location":"VTKBook/04Chapter4/#data-objects","title":"Data Objects","text":"

Data objects represent information. Data objects also provide methods to create, access, and delete this information. Direct modification of the data represented by the data objects is not allowed except through formal object methods. This capability is reserved for process objects. Additional methods are also available to obtain characteristic features of the data. This includes determining the minimum and maximum data values, or determining the size or the number of data values in the object.

Data objects differ depending upon their internal representation. The internal representation has significant impact on the access methods to the data, as well as on the storage efficiency or computational performance of process objects that interact with the data object. Hence, different data objects may be used to represent the same data depending on demands for efficiency and process generality.

"},{"location":"VTKBook/04Chapter4/#process-objects","title":"Process Objects","text":"

Process objects operate on input data to generate output data. A process object either derives new data from its inputs, or transforms the input data into a new form. For example, a process object might derive pressure gradient data from a pressure field or transform the pressure field into constant value pressure contours. The input to a process object includes both one or more data objects as well as local parameters to control its operation. Local parameters include both instance variables or associations and references to other objects. For example, the center and radius are local parameters to control the generation of sphere primitives.

Process objects are further characterized as source objects, filter objects, or mapper objects. This categorization is based on whether the objects initiate, maintain, or terminate visualization data flow.

Source objects interface to external data sources or generate data from local parameters. Source objects that generate data from local parameters are called procedural objects. The previous example of Figure 4-1 uses a procedural object to generate function values for the quadric function of Equation4-1. Source objects that interface to external data are called reader objects since the external file must be read and converted to an internal form. Source objects may also interface to external data communication ports and devices. Possible examples include simulation or modelling programs, or data acquisition systems to measure temperature, pressure, or other similar physical attributes.

Filter objects require one or more input data objects and generate one or more output data objects. Local parameters control the operation of the process object. Computing weekly stock market averages, representing a data value as a scaled icon, or performing union set operations on two input data sources are typical example processes of filter objects.

Mapper objects correspond to the sinks in the functional model. Mapper objects require one or more input data objects and terminate the visualization pipeline data flow. Usually mapper objects are used to convert data into graphical primitives, but they may write out data to a file or interface with another software system or devices. Mapper objects that write data to a computer file are termed writer objects.

"},{"location":"VTKBook/04Chapter4/#43-pipeline-topology","title":"4.3 Pipeline Topology","text":"

In this section we describe how to connect data and process objects to form visualization networks.

"},{"location":"VTKBook/04Chapter4/#pipeline-connections","title":"Pipeline Connections","text":"

The elements of the pipeline (sources, filters, and mappers) can be connected in a variety of ways to create visualization networks. However, there are two important issues that arise when we try to assemble these networks: type and multiplicity.

Type means the form or type of data that process objects take as input or generate as output. For example, a sphere source object may generate as output a polygonal or faceted representation, an implicit representation (e.g., parameters of a conic equation), or a set of occupancy values in a discretized representation of 3D space. Mapper objects might take as input polygonal, triangle strip, line, or point geometric representations. The input to a process object must be specified correctly for successful operation.

Figure 4-3. Maintaining compatible data type. (a) Single-type systems require no type checking. In multiple-type systems only compatible types can be connected together.

There are two general approaches to maintain proper input type. One approach is to design with type-less or single-type systems. That is, create a single type of data object and create filters that operate only on this one type ( Figure 4-3). For example, we could design a general DataSet that represents any form of data that we're interested in, and the process objects would only input DataSets and generate DataSets. This approach is simple and elegant, but inflexible. Often, particularly useful algorithms (i.e., process objects) will operate only on specific types of data and generalizing them results in large inefficiencies in representation or data access. A typical example is a data object that represents structured data such as pixmaps or 3D volumes. Because the data is structured it can easily be accessed as planes or lines. However, a general representation will not include this capability since typically data is not structured.

Another approach to maintain proper input type is to design typed systems. In typed systems only objects of compatible type are allowed to be connected together. That is, more than one type is designed, but type checking is performed on the input to insure proper connection. Depending on the particular computer language, type checking can be performed at compile, link, or run time. Although type checking does insure correct input type, this approach often suffers from an explosion of types. If not careful, the designers of a visualization system may create too many types, resulting in a fragmented, hard to use and understand system. In addition, the system may require a large number of type-converter filters. (Type-converter filters serve only to transform data from one form to another.) Carried to extremes, excessive type conversion results in computationally and memory wasteful systems.

The issue of multiplicity deals with the number of input data objects allowed, and the number of output data objects created during the operation of a process object (Figure 4-4). We know that all filter and mapper objects require at minimum one input data object, but in general these filters can operate sequentially across a list of input. Some filters may naturally require a specific number of inputs. A filter implementing boolean operations is one example. Boolean operations such as union or intersection are implemented on data values two at a time. However, even here more than two inputs may be defined as a recursive application of the operation to each input. Figure 4-4. Multiplicity of input and output. (a) Definition of source, filter, and mapper objects. (b) Various types of input and output..

We need to distinguish what is meant by multiplicity of output. Most sources and filters generate a single output. Multiple fan-out occurs when an object generates an output that is used for input by more than one object. This would occur, for example, when a source object is used to read a data file, and the resulting data is used to generate a wireframe outline of the data, plus contours of the data (e.g., Figure 4-1a). Multiple output occurs when an object generates two or more output data objects. An example of multiple output is generating x, y, and z components of a gradient function as distinct data objects. Combinations of multiple fan-out and multiple output are possible."},{"location":"VTKBook/04Chapter4/#loops","title":"Loops","text":"

In the examples described so far, the visualization networks have been free of cycles. In graph theory these are termed directed, acyclic graphs. However, in some cases it is desirable to introduce feedback loops into our visualization networks. Feedback loops in a visualization network allow us to direct the output of a process object upstream to affect its input.

Figure 4-5 shows an example of a feedback loop in a visualization network. We seed a velocity field with an initial set of random points. A probe filter is used to determine the velocity (and possibly other data) at each point. Each point is then repositioned in the direction of its associated vector value, possibly using a scale factor to control the magnitude of motion. The process continues until the points exit the data set or until a maximum iteration count is exceeded. Figure 4-5. Looping in a visualization network. This example implements linear integration. The sample points are created to initialize the looping process. The output of the integration filter is used in place of the sample points once the process begins.

We will discuss the control and execution of visualization networks in the next section. However, suffice it to say that loops can pose special problem in visualization networks depending on the design of the execution model. The design must insure that the loop does not enter an infinite loop or nonterminating recursive state. Typically, the number of executions of the loop is limited in order to view intermediate results. However, it is possible to execute the loop repeatedly to process data as required.

"},{"location":"VTKBook/04Chapter4/#44-executing-the-pipeline","title":"4.4 Executing the Pipeline","text":"

So far we have seen the basic elements of the visualization network and ways to connect these elements together. In this section we discuss how to control the execution of the network.

To be useful, a visualization network must process data to generate a desired result. The complete process of causing each process object to operate is called the execution of the network.

Most often the visualization network is executed more than once. For example, we may change the parameters of, or the input to, a process object. This is typically due to user interaction: The user may be exploring or methodically varying input to observe results. After one or more changes to the process object or its input, we must execute the network to generate up-to-date results.

For highest performance, the process objects in the visualization network must execute only if a change occurs to their input. In some networks, as shown in Figure 4-6, we may have parallel branches that need not execute if objects are modified local to a particular branch. In this figure, we see that object D and the downstream objects E and F must execute because D's input parameter is changed, and objects E and F depend on D for their input. The other objects need not execute because there is no change to their input.

We can control the execution of the network using either a demand-driven or event-driven approach. In the demand-driven approach, we execute the network only when output is requested, and only that portion of the network affecting the result. In the event-driven approach, every change to a process object or its input causes the network to re-execute. The advantage of the event driven approach is that the output is always up to date (except during short periods of computation). The advantage of the demand-driven approach is that large numbers of changes can be processed without intermediate computation (i.e., data is processed only after the request for data is received). The demand-driven approach minimizes computation and results in more interactive visualization networks.

Figure 4-6. Network execution. Parallel branches need not execute.

The execution of the network requires synchronization between process objects. We want to execute a process object only when all of its input objects are up to date. There are generally two ways to synchronize network execution: explicit or implicit control (Figure 4-7)."},{"location":"VTKBook/04Chapter4/#explicit-execution","title":"Explicit Execution","text":"

Explicit control means directly tracking the changes to the network, and then directly controlling the execution of the process objects based on an explicit dependency analysis. The major characteristic of this approach is that a centralized executive is used to coordinate network execution. This executive must track changes to the parameters and inputs of each object, including subsequent changes to the network topology (Figure 4-7a).

The advantage of this approach is that synchronization analysis and update methods are local to the single executive object. In addition, we can create dependency graphs and perform analysis of data flow each time output is requested. This capability is particularly important if we wish to decompose the network for parallel computing or to distribute execution across a network of computers.

The disadvantage of the explicit approach is that each process object becomes dependent upon the executive, since the executive must be notified of any change. Also, the executive cannot easily control execution if the network execution is conditional, since whether to execute or not depends on the local results of one or more process objects. Finally, a centralized executive can create non-scalable bottlenecks in parallel computing environments.

The explicit approach may be either demand-driven or event-driven. In the event-driven approach, the executive is notified whenever a change to an object occurs (typically in response to a user-interface event), and the network is immediately executed. In the demand-driven approach, the executive accumulates changes to object inputs and executes the network based on explicit user demand.

Figure 4-7. Explicit and implicit network execution.

The explicit approach with a central executive is typical of many commercial visualization systems such as AVS, Irix Explorer, and IBM Data Explorer. Typically these systems use a visual-programming interface to construct the visualization network. Often these systems are implemented on parallel computers, and the ability to distribute computation is essential.

"},{"location":"VTKBook/04Chapter4/#implicit-execution","title":"Implicit Execution","text":"

Implicit control means that a process object executes only if its local input or parameters change (Figure 4-7). Implicit control is implemented using a two-pass process. First, when output is requested from a particular object, that object requests input from its input objects. This process is recursively repeated until source objects are encountered. The source objects then execute if they have changed or their external inputs have changed. Then the recursion unwinds as each process object examines its inputs and determines whether to execute. This procedure repeats until the initial requesting object executes and terminates the process. These two steps are called the update and execution passes.

Implicit network execution is naturally implemented using demand-driven control. Here network execution occurs only when output data is requested. Implicit network execution may also be event-driven if we simply request output each time an appropriate event is encountered (such as change to object parameter).

Figure 4-8. Examples of conditional execution. Depending upon range, data is mapped through different color lookup tables.

The primary advantage of the implicit control scheme is its simplicity. Each object only need keep track of its internal modification time. When output is requested, the object compares its modification time with that of its inputs, and executes if out of date. Furthermore, process objects need only know about their direct input, so no global knowledge of other objects (such as a network executive) is required.

The disadvantage of implicit control is that it is harder to distribute network execution across computers or to implement sophisticated execution strategies. One simple approach is to create a queue that executes process objects in order of network execution (possibly in a distributed fashion). Of course, once a central object is introduced back into the system, the lines between implicit and explicit control are blurred.

"},{"location":"VTKBook/04Chapter4/#conditional-execution","title":"Conditional Execution","text":"

Another important capability of visualization networks is conditional execution. For example, we may wish to map data through different color lookup tables depending upon the variation of range in the data. Small variations can be amplified by assigning more colors within the data range, while we may compress our color display by assigning a small number of colors to the data range (Figure 4-8 ).

The conditional execution of visualization models (such as that shown Figure 4-1c) can be realized in principle. However, in practice we must supplement the visualization network with a conditional language to express the rules for network execution. Hence, conditional execution of visualization networks is a function of implementation language. Many visualization systems are programmed using the visual programming style. This approach is basically a visual editor to construct data flow diagrams directly. It is difficult to express conditional execution of networks using this approach. Alternatively, in a procedural programming language, conditional execution of networks is straightforward. We defer discussions of the topic until \"Putting It All Together\"."},{"location":"VTKBook/04Chapter4/#45-memory-and-computation-trade-off","title":"4.5 Memory and Computation Trade-off","text":"

Visualization is a demanding application, both in terms of computer memory and computational requirements. Data streams on the order of one megabyte to one gigabyte are not uncommon. Many visualization algorithms are computationally expensive, in part due to input size, but also due to the inherent algorithm complexity. In order to create applications that have reasonable performance, most visualization systems have various mechanisms to trade off memory and computation costs.

Figure 4-9. Comparison of static versus dynamic memory models for typical network. Execution begins when output is requested from objects *C* and *D*. In more complex dynamic models, we can prevent *B* from executing twice by performing a more thorough dependency analysis image."},{"location":"VTKBook/04Chapter4/#static-and-dynamic-memory-models","title":"Static and Dynamic Memory Models","text":"

Memory and computation trade-offs are important performance issues when executing visualization networks. In the networks presented thus far, the output of a process object is assumed to be available to downstream process objects at all times. Thus, network computation is minimized. However, the computer memory requirement to preserve filter output can be huge. Networks of only a few objects can tie up extensive computer memory resources.

An alternative approach is to save intermediate results only as long as they are needed by other objects. Once these objects finish processing, the intermediate result can be discarded. This approach results in extra computation each time output is requested. The memory resources required are greatly reduced at the expense of increased computation. Like all trade-offs, the proper solution depends upon the particular application and the nature of the computer system executing the visualization network.

We term these two approaches as static and dynamic memory models. In the static model intermediate data is saved to reduce overall computation. In the dynamic model intermediate data is discarded when it is no longer needed. The static model serves best when small, variable portions of the network re-execute, and when the data sizes are manageable by the computer system. The dynamic model serves best when the data flows are large, or the same part of the network executes each time. Often, it is desirable to combine both the static and dynamic models into the same network. If an entire leg of the network must execute each time, it makes no sense to store intermediate results, since they are never reused. On the other hand, we may wish to save an intermediate result at a branch point in the network, since the data will more likely be reused. A comparison of the static and dynamic memory model for a specific network is shown in Figure 4-9. Figure 4-10. Reference counting to conserve memory resource. Each filter A, B, and C shares a common point representation. Other data is local to each object.

As this figure shows, the static model executes each process object only once, storing intermediate results. In the dynamic model, each process object releases memory after downstream objects complete execution. Depending upon the implementation of the dynamic model, process object B may execute once or twice. If a thorough dependency analysis is performed, process B will release memory only after both objects C and D execute. In a simpler implementation, object B will release memory after C and subsequently, D executes.

"},{"location":"VTKBook/04Chapter4/#reference-counting-garbage-collection","title":"Reference Counting & Garbage Collection","text":"

Another valuable tool to minimize memory cost is to share storage using reference counting. To use reference counting, we allow more than one process object to refer to the same data object and keep track of the number of references. For example, assume that we have three objects A, B, and C that form a portion of a visualization network as shown in Figure 4-10. Also assume that these objects modify only part of their input data, leaving the data object that specifies x-y-z coordinate position unchanged. Then to conserve memory resources we can allow the output of each process object to refer to the single data object representing these points. Data that is changed remains local to each filter and is not shared. It is only when the reference count goes to zero that the object is deleted.

Garbage collection is an alternative memory management strategy that is not well suited to visualization applications. The garbage collection process is automatic; it attempts to reclaim memory used by objects that will never again be accessed by the running application. While convenient due to its automated nature, in general garbage collection introduces overhead that may inadvertently introduce pauses into software execution at inopportune times (during an interactive process). Of more concern, however, is that released, unused memory may not be reclaimed by the system until some time after the last reference to the memory is dropped, and in visualization pipelines this memory may be too large to leave around for any length of time. That is, in some applications if memory usage in a filter is not released immediately, downstream filters may not have enough memory resource available to them to successfully execute.

"},{"location":"VTKBook/04Chapter4/#46-advanced-visualization-pipeline-models","title":"4.6 Advanced Visualization Pipeline Models","text":"

The preceding sections have provided a general framework for the implementation of a useful visualization pipeline model. However, there are several advanced capabilities that complex applications often require. These capabilities are driven by deficiencies in the simpler design described previously. The principle drivers for developing advanced models include: processing unknown dataset types, managing complex execution strategies including processing pieces of data, and extending the visualization pipeline to propagate new information. These concerns are discussed in the following three sections.

"},{"location":"VTKBook/04Chapter4/#processing-unknown-dataset-types","title":"Processing Unknown Dataset Types","text":"

There exist data files and data sources where the type of dataset represented by the file or source is unknown until run-time. For example, consider a general purpose VTK reader that can read any type of VTK data file. Such a class is convenient because the user need not concern himself with the type of dataset, instead the user may want to set up a single pipeline that processes whatever type is found. As indicated by Figure 4-3, such an approach works well if the system is of a single dataset type, however in practice, and due to performance/efficiency concerns, there typically exist many different types of data in a visualization system. The other alternative shown in Figure 4-3 is enforced type checking. However, in situations like the reader example described above, it is not possible to enforce type checking at compile-time because the type is determined by the data. As a result, type checking must be performed at run-time.

Run-time type checking of a multiple dataset type visualization system requires that the data passed between filters is a generic dataset container (i.e., it appears like a single type but contains the actual data and methods to determine what type of data it is). Run-time type checking has the advantage of flexibility, but the trade-off is that a pipeline may not execute properly until the program executes. For example, a generic pipeline may be designed that can process structured data (see \"Types of Datasets\" in Chapter 5), but the data file may contain unstructured data. In this case, the pipeline will be unable to execute at run-time, producing empty output. Thus pipelines designed to process any type of data must be carefully assembled to create robust applications.

"},{"location":"VTKBook/04Chapter4/#extending-the-data-object-representation","title":"Extending the Data Object Representation","text":"

As described earlier in this chapter, a pipeline consists of data objects that are operated on by process objects. Further, because the process objects are separate from the data objects on which they operate, there is necessarily an expected interface through which these objects exchange information. Defining this interface has the side effect of cementing the data representation, implying that it is difficult to extend it without modifying the corresponding interface, and hence all the classes that depend on the interface (of which there are many). Fortunately what tends to change is not the basic data representations (these are generally well established), rather the metadata associated with the dataset itself changes. (In the context of visualization, metadata are data that describe datasets.) While it is feasible to represent new datasets by creating new classes (since the addition of new dataset types occurs infrequently); the diversity of metadata precludes creating new classes because the resulting explosion of data types, and the potential change to programming interfaces, would adversely affect the stability of the visualization system. Hence a general mechanism to support metadata is required. Packaging metadata into a generic container that contains both the dataset and metadata is a obvious design, and is compatible with the design described in the previous section.

Examples of metadata include time step information, data ranges or other data characteristics, acquisition protocols, patient names, and annotation. In an extensible visualization pipeline, a specific data reader (or other data source) may read such information and associate it with the output data that it produces. While many filters may ignore the metadata, they can be configured to pass the information along the pipeline. Alternatively, a pipeline sink (or mapper) may request that specific metadata be passed through the pipeline so it can be processed appropriately. For example, a mapper may request annotations, and if available, place them on the final image.

"},{"location":"VTKBook/04Chapter4/#managing-complex-execution-strategies","title":"Managing Complex Execution Strategies","text":"

In real-world applications the pipeline design described thus far may not adequately support complex execution strategies, or may fail to execute successfully when data sizes become large. In the next sections we address these issues by considering alternative design possibilities.

Large Data. Previous discussions relative to the visualization pipeline have assumed that the size of a particular dataset does not exceed the total memory resource of a computer system. However, with modern dataset sizes pushing into the terabyte and even petabyte range, a typical desktop computer system is incapable of processing such datasets. Thus alternative strategies must be adopted when processing large data. One such approach is based on breaking data into pieces, and then streaming the pieces through the visualization pipeline [Martin2001]. Figure 4-11 illustrates how a dataset can be divided into pieces. Figure 4-11. Dividing a sphere into a piece (red) with ghost level cells and points (blue and green).

Streaming data through a visualization pipeline offers two major benefits. The first is that visualization data that would not normally fit into memory can be processed. The second is that visualizations can be run with a smaller memory footprint resulting in higher cache hits, and little or no swapping to disk. To realize these benefits the visualization software must support breaking the dataset into pieces and correctly processing those pieces. This requires that the dataset and the algorithms that operate on it are separable, mappable, and result invariant as described in the following [Law99].

  1. Separable. The data must be separable. That is, the data can be broken into pieces. Ideally, each piece should be coherent in geometry, topology, and/or data structure. The separation of the data should be simple and efficient. In addition, the algorithms in this architecture must be able to correctly process pieces of data.

  2. Mappable. In order to control the streaming of the data through a pipeline, we must be able to determine what portion of the input data is required to generate a given portion of the output. This allows us to control the size of the data through the pipeline, and configure the algorithms.

  3. Result Invariant. The results should be independent of the number of pieces, and independent of the execution mode (i.e., single- or multi-threaded). This means proper handling of boundaries and developing algorithms that are multi-thread safe across pieces that may overlap on their boundaries.

Separating data into pieces is relatively straightforward if the data is structured, i.e., topologically regular ((see \"Types of Datasets\" in Chapter 5). Such datasets can be topological described by a rectangular extent in a regularly x-y-z subdivided cubical domain (see Figure5-7(a)-(c)). However, if the data is unstructured (e.g. a mesh of triangles or polygons), then specifying pieces is difficult. Generally an unstructured extent is defined by grouping adjacent data (e.g., cells) into pieces, and then addressing each piece using a N of M notation, where N is the n ^th^ piece out of a total of M pieces. The exact organizational structure of a piece is left unspecified and depends on the particular application and algorithm used to group the data.

To satisfy the third requirement of results invariance, processing pieces also requires the ability to generate boundary data, or ghost levels. Boundary information is necessary when information from the neighbors of a piece is needed to perform a computation. For example, gradient calculations or boundary analysis (e.g., do I have a cell face neighbor?) require one level of boundary information. In rare cases, two or more levels are required. Figure 4-11 illustrates boundary cells and points corresponding to the central red piece of the sphere.

Finally, it should be noted that the ability to divide data into pieces for streaming is exactly the same capability required for data parallel processing. In such methods, data is subdivided and sent to different processors to be operated on in parallel. Boundary information may also be required to perform certain computations. Parallel processing has the added complexity that the data must be communicated to processors (in the case of distributed computing) or mutual exclusion (i.e., mutexing) must be employed to avoid simultaneous write operations. Thus streaming and parallel processing are complementary technologies used in large data computing.

Complex Execution Strategies. In many cases the simple execution model of Figure 4-7 is not suitable for complex data processing tasks. For example, as discussed in the previous section, streaming data is a complex execution strategy required when a dataset becomes too large to fit into memory, or when parallel computing is used. In some cases event-driven (see \"Executing the Pipeline\") or \"push\" pipelines (i.e., those that receive data and push the data through the pipeline for processing) may be preferred. Finally, there exist hierarchical data structures such as multi-block or adaptive mesh refinement (AMR) [Berger84] grids. Processing such datasets in a pipeline requires hierarchical traversal as filters process each block in the grid (an advanced research topic in the visualization field and not covered in this edition of the book).

Addressing these requirements implies that the execution model must be extended. Thus we revisit the object-oriented design in the next section.

Object-Oriented Design Revisited. Figure 4-2 illustrates two choices relative to the design of the visualization object model. The first choice, which was discarded, was to combine data and operations on the data into a single object, a typical object-oriented design pattern. The second choice, which was advocated, was to create a design consisting of two classes---data objects and process objects---which were then combined into visualization pipelines. While this second strategy works well for simple pipelines, when complex execution strategies are introduced, this design begins to break down. This is because the execution strategy is necessarily, and implicitly, distributed across the data objects and process objects; there is no explicit mechanism to implement a particular strategy. Thus the design is problematic because new strategies cannot be introduced without modifying the interface to both the data and process objects. Good design demands that the execution strategy is separated from the data objects and process objects. The benefits of such a design include reducing the complexity of the data and process objects, encapsulating execution strategies, performing run-time type checking (see \"Processing Unknown Dataset Types\") and even managing metadata (see \"Extending the Data Object Representation\").

As the execution model becomes more complex, execution strategies are separated from the data and process objects as separate classes.

The advanced design re-introduces the notion of an executive (see \"Executing the Pipeline\"). However, the design differs from that of Figure 4-7. As that figure illustrated, a single, centralized executive introduces dependencies into the pipeline that will not scale as pipeline complexity increases, or in parallel processing applications. In the advanced design, we assume multiple executives, typically one per filter. In some cases the executive may control multiple filters. This is particularly useful if the filters are interdependent or complex execution strategies are required. Different classes of executive can implement different execution strategies, for example a demand-driven, streaming pipeline is one such strategy. Other important classes include executives that coordinate the execution of filters on composite datasets. Figure 4-12. As the execution model becomes more complex, execution strategies are separated from the data and process objects as separate classes.

Figure 4-12 is a high-level view of the executive and its relationship to data and process objects. In \"Pipeline Design and Implementation\" the design is explored in more detail."},{"location":"VTKBook/04Chapter4/#47-programming-models","title":"4.7 Programming Models","text":"

Visualization systems are by their very nature designed for human interaction. As a result they must be easy to use. On the other hand, visualization systems must readily adapt to new data, and must be flexible enough to allow rapid data exploration. To meet these demands, a variety of programming models have been developed.

"},{"location":"VTKBook/04Chapter4/#visualization-models","title":"Visualization Models","text":"

At the highest level are applications. Visualization applications have finely tailored user-interfaces that are specific to an application area, e.g., fluid flow visualization. Applications are the easiest to use, but are the least flexible. It is very difficult or impossible for the user to extend applications into a new domain because of inherent logistical issues. Commercial turn-key visualization software is generally considered to be application software.

At the opposite end of the spectrum are programming libraries. A conventional programming library is a collection of procedures that operate on a library-specific data structure. Often these libraries are written in conventional programming languages such as C or FORTRAN. These offer great flexibility and can be easily combined with other programming tools and techniques. Programming libraries can be extended or modified by the addition of user-written code. Unfortunately, the effective use of programming libraries requires skilled programmers. Furthermore, non graphics/visualization experts cannot easily use programming libraries because there is no notion of how to fit (or order) the procedures together correctly. These libraries also require extensive synchronization schemes to control execution as input parameters are varied.

Many visualization systems lie between these two extremes. These typically use a visual programming approach to construct visualization networks. The basic idea is to provide graphical tools and libraries of modules or process objects. Modules may be connected subject to input/output type constraints, using simple graphical layout tools. In addition, user interface tools allow association of interface widgets with object input parameters. System execution is generally transparent to the user by way of an internal execution executive.

"},{"location":"VTKBook/04Chapter4/#alternative-visual-programming-models","title":"Alternative Visual Programming Models","text":"

There are two other graphics and visualization programming models that bear mentioning. These are scene graphs and the spreadsheet model.

Scene graphs are typically found in 3D graphics systems such as Open Inventor [Wernecke94]. Scene graphs are acyclic tree-structures that represent objects, or nodes, in an order defined by the tree layout. The nodes may be geometry (called shape nodes), graphics properties, transformations, manipulators, lights, cameras, and so forth, that define a complete scene. The parent/child relationship controls how properties and transformations are applied to the nodes as they are rendered, or how the objects relate to other objects in the scene (e.g., which objects the lights shine on). Scene graphs are not used to control the execution of a visualization pipeline, rather they are used to control the rendering process. Scene graphs and visualization pipelines may be used together in the same application. In such a case the visualization pipeline is the generator of the shape nodes, and the scene graph controls the rendering of the scene including the shapes.

Scene graphs have found wide use in the graphics community because of their ability to compactly and graphically represent a scene. In addition, scene graphs have been popularized by their recent use in Web tools such as VRML and Java3D. See Chapter 11 - Visualization on the Web for more information.

Another recently introduced technique for visual programming is the spreadsheet technique of Levoy [Levoy94]. In the spreadsheet model, we arrange operations on a regular grid similar to the common electronic accounting spreadsheets. The grid consists of rows and columns of cells, where each cell is expressed as a computational combination of other cells. The combination is expressed for each cell by using a simple programming language to add, subtract, or perform other more complex operations. The result of the computation (i.e., a visual output) is displayed in the cell. A recent extension to the spreadsheet approach is exemplified by VisTrails [Bavoil2005], a system that enables interactive multiple-view visualizations by simplifying the creation and maintenance of visualization pipelines, and by optimizing the execution of the pipelines. VisTrails has the further benefit that it tracks changes to the visualization pipeline so that it is straightforward to create extensive design studies.

Although visual programming systems are widely successful, they suffer two drawbacks. First, they are not as tailored as an application and require extensive programming, albeit visual, to be so. Second, visual programming is too limited for detailed control, so constructing complex low-level algorithms and user-interfaces is not feasible. What is required is a visualization system that provides the \"modularity\" and automatic execution control of a visual system, and the low-level programming capability of a programming library. Object-oriented systems have the potential to provide these capabilities. Carefully crafted object libraries provide the ease of use of visual systems with the control of programming libraries. That is a major goal of the described in this text.

"},{"location":"VTKBook/04Chapter4/#48-data-interface-issues","title":"4.8 Data Interface Issues","text":"

At this point in the text you may be wondering how to apply a visualization pipeline towards your own data. The answer depends on the type of data you have, preferences in programming style, and required complexity. Although we have not yet described particular types of data (we will in the next chapter), there are two general approaches you may wish to consider when interfacing your data to a visualization system: a programming interface and an application interface.

"},{"location":"VTKBook/04Chapter4/#programming-interface","title":"Programming Interface","text":"

The most powerful and flexible approach is to directly program your application to read, write, and process data. There is almost no limit to what you can achieve using this approach. Unfortunately, in a complex system like VTK this requires a level of expertise that may be beyond your time budget to obtain. (If you are interested in this approach using VTK, you'll have to become familiar with the objects in the system. You will also want to refer to the Doxygen-generated manual pages ---on-line at http://www.vtk.org or CD-ROM. The companion text The VTK User's Guide is also helpful.)

Typical applications requiring a programming interface are interfacing to data files that are not currently supported by the system or generating synthetic data (e.g., from a mathematical relationship) where no data file is available. Also, sometimes it is useful to directly code your data in the form of a program, and then execute the program to visualize the results. (This is exactly what many of the VTK examples do.)

In general, programming a complex system such as VTK is a difficult undertaking because of the initial learning curve. There are, however, simpler ways to interface to data. While skilled developers may be required to create sophisticated applications, the points of an object-oriented toolkit like VTK is that it provides many of the pieces required to interface to common data forms. Thus focusing on those objects that import and export data is a good start towards interfacing with data. In VTK, these objects are known as readers, writers, importers and exporters.

File Interface (Readers / Writers). In this chapter we saw that readers are source objects, and writers are mappers. What this means from a practical point of view is that readers will ingest data from a file, create a data object, and then pass the object down the pipeline for processing. Similarly, writers ingest a data object and then write the data object to a file. Thus, readers and writers will interface to your data well if VTK supports your format, and you only need to read or write a single data object. If your data file format is not supported by the system, you will need to interface to your data via a general programming interface described above. Or, if you wish to interface to a collection of objects, you will probably want to see whether an exporter or importer object (described in the next section) exists to support your application.

Examples of readers include vtkSTLReader (read stereo-lithography files) and vtkBYUReader (read MOVIE.BYU format data files). Similarly the objects vtkSTLWriter and vtkBYUWriter can be used to write data files. To see which readers and writers are supported by VTK, see the VTK User's Guide or refer to the Web pages at http://www.vtk.org for the current Doxygen manual pages.

File Interface (Importers / Exporters). Importers and exporters are objects in the system that read or write data files consisting of more than one object. Typically importers and exporters are used to save or restore an entire scene (i.e., lights, cameras, actors, data, transformations, etc.). When an importer is executed, it reads one or more files and may create several objects. For example, in VTK the vtk3DSImporter imports a 3D Studio file and creates a rendering window, renderer, lights, cameras, and actors. Similarly, the vtkVRMLExporter creates a VRML file given a VTK render window. The VRML file contains cameras, lights, actors, geometry, transformations, and the like, indirectly referred to by the rendering window provided.

In the Visualization Toolkit, there are several importers and exporters. To see which importers and exporters are supported by VTK, see the VTK User's Guide. You may also want to check the Web pages at http://www.vtk.org for the current Doxygen manual pages. If the exporter you are looking for does not exist, you will have to develop your own using the programming interface.

Figure 4-13. Importing and exporting files in VTK. An importer creates a vtkRenderWindow that describes the scene. Exporters use an instance of vtkRenderWindow to obtain a description of the scene. See 3DSImporter.cxx and 3DSImporter.py.

Figure 4-13 shows an image created from a 3D Studio model and saved as a Renderman RIB file."},{"location":"VTKBook/04Chapter4/#application-interface","title":"Application Interface","text":"

The majority of users interface to their data by using an existing application. Rather than programming pipelines or writing their own readers and writers, users acquire an application that suits their particular visualization needs. Then to interface to their data, users simply identify the reader, writer, importer, and/or exporter that can successfully process it. In some cases, users may have to modify the program used to generate the data so that it exports it in a standard data format. The advantage of using existing applications is that the user interface and pipeline are pre-programmed, insuring that the user can focus on their data, rather than expending the significant resources required to write visualization programs. The disadvantage of using existing applications is that necessary features are often missing, and applications typically lack the flexibility that a general purpose tool can provide.

Selecting the right application is not always simple. The application must support the correct dataset types, and support suitable rendering devices, for example generating images on large displays [Humphreys99] or in a Cave [CruzNeira93] environment. In some cases user interaction is required, and demands on parallel processing or data handling capacities further complicates the selection. For example, while a general purpose tool like ParaView ( Figure 4-14a) can be used to visualize most types of data, including providing support for large data and parallel computing, a specialized tool such as VolView (Figure 4-14b)may be better suited for the a particular type task such as viewing medical data shown in the figure. It is imperative that users have a familiarity with the visualization process if they are to successfully choose the right application for their data."},{"location":"VTKBook/04Chapter4/#49-putting-it-all-together","title":"4.9 Putting It All Together","text":"

In the previous sections we have treated a variety of topics relating to the visualization model. In this section we describe the particular implementation details that we have adopted in the Visualization Toolkit.

#   import from 3d Studio vtk3DSImporter importer\nimporter ComputeNormalsOn\nimporter SetFileName \"$VTK_DATA_ROOT/Data/iflamigm.3ds\"\nimporter Read\n#   export to rib format\n\nvtkRIBExporter exporter\nexporter SetFilePrefix importExport\nexporter SetRenderWindow [importer GetRenderWindow]\nexporter BackgroundOn\nexporter Write\n
"},{"location":"VTKBook/04Chapter4/#procedural-language-implementation","title":"Procedural Language Implementation","text":"

The Visualization Toolkit is implemented in the procedural language C++. Automated wrapping technology creates language bindings to the Python, Tcl and Java interpretive programming languages [King03]. The class library contains data objects, filters (i.e., process objects) and executives to facilitate the construction of visualization applications. A variety of supporting abstract super-classes are available to derive new objects including data objects and filters. The visualization pipe-line is designed to connect directly to the graphics subsystem described in the previous chapter. This connection is via VTK's mappers, which are the sinks of the pipeline and interface to the VTK's actors.

A visual programming interface could be (and has been) implemented using the class library provided. However, for real-world applications the procedural language implementation provides several advantages. This includes straightforward implementation of conditional network execution and looping, ease of interface to other systems, and the ability to create custom applications with sophisticated graphical user interfaces. The VTK community has created several visual programming and visualization applications from the toolkit. Many of these are available as open-source software (e.g., ParaView at paraview.org) or as commercial applications (e.g., VolView at www.volview.com).

Figure 4-14a. ParaView parallel visualization application. Figure 4-14b. VolView volume rendering application. Figure 4-14. The choice of an appropriate visualization application depends on the type of dataset(s) it must support, required interaction techniques, rendering capabilities, and support for large data, including parallel processing. While both applications above are built using the VTK visualization toolkit, they provide very different user experiences. ParaView (paraview.org) is a general purpose visualization system that can process large data in a distributed, parallel environment (as well as on single processor systems), with the ability to display on a Cave or tiled display. VolView (volview.com) focuses on volumetric and image data and uses multi-threading and sophisticated level-of-detail methods to achieve interactive performance."},{"location":"VTKBook/04Chapter4/#pipeline-design-and-implementation","title":"Pipeline Design and Implementation","text":"

The Visualization Toolkit implements a general execution mechanism. Filters are divided into two basic parts: algorithm and executive objects. An algorithm object, whose class is derived from vtkAlgorithm, is responsible for processing information and data. An executive object, whose class is derived from vtkExecutive, is responsible for telling an algorithm when to execute and what information and data to process. The executive component of a filter may be created independently of the algorithm component allowing custom pipeline execution mechanisms without modifying core VTK classes.

Information and data produced by a filter are stored in one or more output ports. An output port corresponds to one logical output of the filter. For example, a filter producing a color image and a corresponding binary mask image would define two output ports, each holding one of the images. Pipeline-related information is stored in an instance of vtkInformation on each output port. The data for an output port is stored in an instance of a class derived from vtkDataObject.

Information and data consumed by a filter are retrieved through one or more input ports. An input port corresponds to one logical input of the filter. For example, a glyph filter would define one input port for the glyph itself and another input port defining the glyph positions. Input ports store input connections that reference the output ports of other filters; these output ports eventually provide information and data to the filter. Each input connection provides one data object and its corresponding information obtained from the output port to which the connection is made. Since connections are stored through logical ports and not in the data flowing through those ports, the data type need not be known when the connection is made. This is particularly useful when creating pipelines whose source is a reader that does not know its output data type until the file is read (see \"Pipeline Connections\" and \"Processing Unknown Dataset Types\").

Figure 4-15. Description of implicit execution process implemented in VTK. The Update() method is initiated via the Render() method from the actor. Data flows back to the mapper via the RequestData() method. Arrows connecting filter and data objects indicate direction of the Update() process.

To understand the execution of the VTK pipeline, it is useful to view the process from several different vantage points. Note that each of the following figures is not completely accurate, rather they are presented as depictions whose purpose is to describe the important features of the process.

Figure 4-15 shows a simplified description of VTK's execution process. Generally the execution of the pipeline is triggered by a mapper's Render() method invocation, typically in response to a Render() method invocation on an associated vtkActor (which in turn receives it from the render window). Next, the Update() method is called on the input to the mapper (resulting in a cascade of method invocations requesting information and data). Eventually, data must be computed and returned to the object initiating the request, in this case the mapper. The RequestData() method actually executes the filter(s) in the pipeline and produces output data. Note the direction of flow---here we define the direction of data flow as the downstream direction, and the direction of the Update() invocation the upstream direction. Figure 4-16. The logical relationship of the algorithm, executive and ports constituting a filter. The executive is responsible for managing the execution of the algorithm, and coordinating with information requests traveling through the pipeline. Ports correspond to logical, distinct inputs and outputs.

The next figure, Figure 4-16, shows the relationship between the executive and the algorithm, which are paired to form a filter. This view of the filter is independent of the pipeline and contains all the information about the interface of the algorithm, namely the number and availability of inputs and outputs. Finally Figure 4-17 shows the connections between filters. Notice that the output data object is not directly wired to the input connection. Rather the downstream filters's input connection is associated with the upstream filter's output port. This separation of data object from the input port means that data type checking can be deferred until run-time, when the consuming filter requests data from the producer of the data. Thus the producer can generate different types of data (e.g., it is a reader that produces different data types), and as long as the consumer supports these different data types, the pipeline will execute without error."},{"location":"VTKBook/04Chapter4/#connecting-pipeline-objects","title":"Connecting Pipeline Objects","text":"

This leads us to the method of making connections between filters and data objects to form a visualization pipeline. As is evident from the previous figures, the Visualization Toolkit pipeline architecture has been designed to support multiple inputs and outputs. In practice, you will find that most filters and sources actually generate a single output and filters accept a single input. This is because most algorithms tend to be single input/output in nature. There are exceptions and we will describe some of these shortly. However, first we would like to provide a brief history lesson relative to the evolution of VTK's pipeline architecture. This lesson is instructive because it sheds light on the evolution of the pipeline design in response to new requirements.

Prior to VTK 5.0. In earlier versions of VTK (i.e., prior to version 5.0), the visualization pipeline architecture was accurately depicted by Figure4-15. In this figure, which shows how filters and data objects were connected to form a visualization network, the input data was represented by the Input instance variable and was set using the SetInput() method. The output data was represented by the Output instance variable and was accessed using the GetOutput() method. To connect filters together, the C++ statement

filter2->SetInput(filter1->GetOutput()); //Prior to VTK5.0\n

was typically used with filter1 and filter2 filter objects of compatible type. In this design, compile time type checking was performed (i.e., the C++ compiler would enforce proper type.) Obviously, this meant that correcting filters together producing output of unknown type was problematic. Several other issues with this design remained as well, many of which have been alluded to earlier, but are summarized here to motivate the use of the newer pipeline architecture.

Figure 4-17. The logical relationship of ports and connections An input port may have more than one connection associated with it. Multiple connections are possible in certain filters such as the append filter, where a single logical input port represents all the data to be \"appended\" together, and each input is represented by a different connection.
  • The older design did not support deferred dataset type checking. It was difficult to support arbitrary reader types or filters that could produce different types of output.

  • The strategy for updating and managing the execution of the pipeline were implicitly embedded in the process objects and data objects. As the strategy became more complex, or needed to change, this required modifying data and/or process objects.

  • In the older design it was difficult to abort pipeline execution during an update pass. Further, it was not possible to centralize the error checking; each filter had to do some checking thereby duplicating code.

  • Introducing metadata into the pipeline required changing the API to the data and process objects. It was desirable to support the ability of a reader to add metadata to a data stream and have a filter in the pipeline retrieve it, without having to modify the API.

For this, and other reasons related to parallel processing, the original VTK pipeline design was reworked. While the transition was difficult, such changes are often necessary if a software system is to change and grow with advances in technology.

VTK 5.0 and Beyond. While VTK 5.0 still supports the use of SetInput()/GetOutput(), its use in Figure 4-16 and Figure 4-17 is discouraged. Rather, the newer pipeline architecture should be used. Referring to Figure 4-17, we use connections and ports to configure VTK's visualization pipeline:

filter2->SetInputConnection(filter1->GetOutputPort()); //VTK 5.0\n

You probably have already guessed how this approach can be extended to multiple inputs and multiple outputs. Let's look at some concrete examples. vtkGlyph3D is an example of a filter that accepts multiple inputs and generates a single output. The inputs to vtkGlyph3D are represented by the Input and Source instance variables. The purpose of vtkGlyph3D is to copy the geometry defined by the data in Source to each point defined by Input. The geometry is modified according to the Source data values (e.g., scalars and vectors). (For more information about glyphs see \"Glyphs\".) To use the vtkGlyph3D object in C++ code you would do the following:

glyph = vtkGlyph3D::New();\n glyph->SetInputConnection(foo->GetOutputPort());\n glyph->SetSourceConnection(bar->GetOutputPort());...\n

where foo and bar are filters returning the appropriate type of output. The class vtkExtractVectorComponents is an example of a filter with a single input and multiple outputs. This filter extracts the three components of a 3D vector into separate scalar components. Its three outputs are available on output ports 0, 1, and 2. An example use of the filter follows:

vz = vtkExtractVectorComponents::New();\nfoo = vtkDataSetMapper::New();\nfoo->SetInputConnection(vz->GetOutputPort(2));\n

Several other special objects having multiple inputs or outputs are also available. Some of the more notable classes are vtkMergeFilter, vtkAppendFilter, and vtkAppendPolyData. These filters combine multiple pipeline streams and generate a single output. Note, however, that while vtkMergeFilter has multiple input ports (i.e., different logical inputs), vtkAppendFilter has only one logical input, but presumes multiple connections are made to that one input. This is because in the case of vtkMergeFilter, each input has a distinct and separate purpose, while in vtkAppendFilter all the inputs have the same meaning (i.e., just one more input in a list to append together). Here are some code fragments:

merge = vtkMergeFilter::New();\nmerge->SetGeometryConnection(foo->GetOutputPort());\nmerge->SetScalarsConnection(bar->GetOutputPort());\n

and

append = vtkAppendFilter::New();\nappend->AddInputConnection(foo->GetOutputPort());\nappend->AddInputConnection(bar->GetOutputPort());\n

Notice the use of the method AddInputConnection(). This method adds to the list of connections, whereas SetInputConnection() clears the list and specifies the single connection to the port.

Another important filtering class is vtkProbeFilter. This filter takes two inputs. The first input is the data we wish to probe. The second input supplies a set of points that are used as probe points. Some process objects take a list of input data. Another interesting filter is the vtkBooleanStructuredPoints class which performs set operations on volume datasets. The first data item in the list is used to initialize the set operation. Each subsequent item in the list is combined with the result of previous operations using a boolean operation specified by the user.

For more details regarding the object design of filters and data objects, please see Chapter 5 - Data Representation and Chapter 6 - Fundamental Algorithms .

"},{"location":"VTKBook/04Chapter4/#pipeline-execution-and-information-objects","title":"Pipeline Execution and Information Objects","text":"

Until now, we have used the terms metadata and information objects rather informally. As described previously, in the context of VTK, these terms refer to data that describes datasets. In this section, we show how these objects, which are subclasses of vtkInformation, are used to facilitate the execution of the VTK pipeline.

Information Objects. Information objects are the basic containers used throughout the VTK pipeline to hold a wide variety of metadata. They are heterogeneous key-to-value maps in which the type of the key determines the type of the value. The following is an enumeration of the places information objects are used.

  • Pipeline information objects hold information for pipeline execution. They are stored in instances of vtkExecutive or subclasses and are accessible via the method vtkExecutive::GetOutputInformation(). There is one pipeline information object per output port. It contains an entry pointing to the output vtkDataObject on the corresponding port (if it has been created). The vtkDataObject contains a pointer back to its corresponding pipeline information object, accessible via vtkDataObject::GetPipelineInformation(). The pipeline information object also holds information about what will populate the data object when the filter executes and generates the output. The actual information contained is determined by the output data type and the execution model in use. Pipeline information objects for input connections are accessible via the method vtkExecutive::GetInputInformation(), and they are the pipeline information objects on the output ports to which the input ports are connected.

  • Port information objects hold information about the data types produced on output ports and consumed by input ports. They are stored by instances of vtkAlgorithm. There is one input port information object per input port and one output port information object per output port. They are accessible via the methods vtkAlgorithm::GetInputPortInformation() and vtkAlgorithm::GetOutputPortInformation(). Port information objects are usually created and populated by subclasses of vtkAlgorithm in order to specify the interface of the filter.

  • Request information objects hold information about a specific request being sent to an executive or algorithm. There is one entry indicating what request is being sent and possibly other entries giving additional details about the specific request. These information objects are not accessible via any public method but are passed to ProcessRequest() methods that implement the requests.

  • Data information objects hold information about what is currently stored in a vtkDataObject. There is one data information object in each data object, accessible via vtkDataObject::GetInformation(). The actual information contained is determined by the data object type.

  • Algorithm information objects hold information about an instance of vtkAlgorithm. There is one algorithm information object per algorithm object, accessible via vtkAlgorithm::GetInformation(). The actual information contained is determined by the algorithm object type.

The importance of the information objects in VTK is that they are flexible (e.g., new key-value pairs can be easily added) and extensible. That is, readers, filters and mappers can add new information to the containers without requiring the API of the pipeline-related classes to change.

** Pipeline Execution Models. In VTK, the fundamental pipeline update mechanism is based on the request. A request is the basic pipeline operation (or \"pipeline pass\") that generally asks for particular piece of information to be propagated through the pipeline. An execution model is a set of requests defined by a specific executive. Refer to Figure 4-18** in the following description of the execution process.

Figure 4-18. Path of a request sent through a pipeline. For example, assume the consumer (at the far right) needs only a single piece of this data (e.g., piece 1 of 4); also assume that the producer (on the far left) is a reader that can partition its data into pieces. The consumer passes this request upstream, and it continues upstream (via executives) until it reaches a producer that can fulfill the request. When the reader algorithm is asked for a piece of the data, it provides it, and passes the new data back (with the information that it is piece 1 of 4) down the pipeline. It stops when it reaches the consumer who made the request.

Requests are generated by the executive object of a filter that has been explicitly asked to update by its algorithm due to some user call. For example, when the Write() method of a writer is called, the algorithm object asks its executive to update the pipeline, and execute the writer, by calling this->GetExecutive()->Update(). Several requests may be sent through the pipeline in order to bring it up to date.

A request is implemented as an information object. There is one key of type vtkInformationRequestKey specifying the request itself. This key is typically defined by the executive's class. Additional information about the request may also be stored in the request information object.

Requests are propagated through the pipeline by the executives of each filter. The vtkExecutive::ProcessRequest() method is invoked on an executive given the request information object. This method is implemented by each executive and is responsible for fulfilling the request as it sees fit. Many requests may be fulfilled for a filter only after it has been fulfilled for the filters providing its inputs. For these requests the executive will pass the request on to the executives of these upstream filters and then handle the request itself.

An executive often asks its algorithm object for help in fulfilling a request. It sends the request to the algorithm object by invoking the vtkAlgorithm::ProcessRequest() method. This method is implemented by all algorithms and is responsible for handling the request. Input and output pipeline information objects are provided as arguments to the method. The algorithm must handle the request using only its own filter parameter settings and the pipeline information objects given. An algorithm is not allowed to ask its executive for any additional information. This insures that the algorithms are independent of the executives. Figure 4-18 shows a typical path taken by a request as it is sent through a pipeline. Typically the request originates in a consumer at the end of the pipeline. It is sent back through the pipeline by the executives. Each executive asks its algorithm to help handle the request."},{"location":"VTKBook/04Chapter4/#flexible-computation-memory-trade-off","title":"Flexible Computation / Memory Trade-off","text":"

By default, networks constructed using the Visualization Toolkit store intermediate computational results (i.e., favor computation). However, a single class variable can be set to discard intermediate data when they are no longer needed (i.e., favor memory). In addition, a local parameter can be set within each process object to control this trade-off at object level.

This global variable is set as follows. Given the data object O, (or the output of a filter obtained using O=filter->GetOutput()), invoke O->SetGlobalReleaseDataFlagOn() to enable data release. To enable data release for a particular object use O->SetReleaseDataFlagOn(). Appropriate methods exist to disable memory release as well.

"},{"location":"VTKBook/04Chapter4/#high-level-object-design","title":"High-Level Object Design","text":"

At this point in the text it is premature to describe design details of the various objects making up the visualization pipeline. However, there are two important classes that affect many of the objects in the text. These are the classes vtkObject and [vtkObject](https://www.vtk.org/doc/nightly/html/classvtkObject.html#details)Base.

vtkObjectBase is the base object for almost all inheritance hierarchies found in VTK. vtkObjectBase implements data object reference counting (see \"Reference Counting & Garbage Collection\"). Subclasses of vtkObjectBase may be shared by other objects, without duplicating memory. It also defines an API for objects to print information about themselves.

vtkObject is a subclass of [vtkObject](https://www.vtk.org/doc/nightly/html/classvtkObject.html#details)Base. It provides methods and instance variables to control run-time debugging and maintains internal object modification time. In particular, the method Modified() is used to update the modification time, and the method GetMTime() is used to retrieve it. vtkObject also provides a framework for the event callbacks that we saw in the previous chapter (see \"Events and Observers\" in Chapter 3).

Note that we do not always include vtkObject and [vtkObject](https://www.vtk.org/doc/nightly/html/classvtkObject.html#details)Base in object diagrams to conserve space. Refer to the source code for a definitive statement.

"},{"location":"VTKBook/04Chapter4/#examples","title":"Examples","text":"

We will now demonstrate some of the features of the visualization pipeline with four examples. Some of the objects used here will be unfamiliar to you. Please overlook missing details until we cover the information later in the book. The goal here is to provide a flavor and familiarity with the software architecture and its use.

** Simple Sphere. The first example demonstrates a simple visualization pipeline. A polygonal representation of a sphere is created with the source object (vtkSphereSource). The sphere is passed through a filter (vtkElevationFilter) that computes the height of each point of the sphere above a plane. The plane is perpendicular to the z-axis, and passes through the point (0,0,-1). The data is finally mapped (vtkDataSetMapper) through a lookup table. The mapping process converts height value into colors, and interfaces the sphere geometry to the rendering library. The mapper is assigned to an actor, and then the actor is displayed. The visualization network, a portion of code, and output image are shown in Figure 4-19**.

Figure 4-19. A simple sphere example. See ColoredSphere.cxx and ColoredSphere.py.

The execution of the pipeline occurs implicitly when we render the actor. Each actor asks its mapper to update itself. The mapper in turn asks its input to update itself. This process continues until a source object is encountered. Then the source will execute if modified since the last render.

Then the system walks through the network and executes each object if its input or instance variables are out of date. When completed, the actor's mapper is up to date and an image is generated.

Now let's reexamine the same process of pipeline execution by following method invocation. The process begins when the actor receives a Render() message from a renderer. The actor in turn sends a Render() message to its mapper. The mapper begins network execution by asking its input to update itself via the Update() operation. This causes a cascade of Update() methods as each filter in turn asks its input to update itself. If branching in the pipeline is present, the update method will branch as well. Finally, the cascade terminates when a source object is encountered. If the source object is out of date, it will send itself an RequestData() command. Each filter will send itself an RequestData() as necessary to bring itself up to date. Finally, the mapper will perform operations to transform its input into rendering primitives.

In the Visualization Toolkit, the Update() method is public while the RequestData() method is protected. Thus, you can manually cause network execution to occur by invoking the Update() operation. This can be useful when you want to set instance variables in the network based on the results of upstream execution, but do not want the whole network to update. The RequestData() method is protected because it requires a certain object state to exist. The Update() method insures that this state exists.

One final note. The indentation of the code serves to indicate where objects are instantiated and modified. The first line (i.e., the New() operator) is where the object is created. The indented lines that follow indicate that various operations are being performed on the object. We encourage you to use a similar indenting scheme in your own work.

Warped Sphere. This example extends the pipeline of the previous example and shows the effects of type checking on the connectivity of process objects. We add a transform filter (vtkTransformFilter) to non-uniformly scale the sphere in the x-y-z directions.

The transform filter only operates on objects with explicit point coordinate representation (i.e., a subclass of vtkPointSet). However, the elevation filter generates the more general form vtkDataSet as output. Hence we cannot connect the transform filter to the elevation filter. But we can connect the transform filter to the sphere source, and then the elevation filter to the transform filter. The result is shown in Figure 4-20. (Note: an alternative method is to use vtkCastToConcrete to perform run-time casting.) Figure 4-20. The addition of a transform filter to the previous example. See TransformSphere.cxx and TransformSphere.py.

The C++ compiler enforces the proper connections of sources, filters, and mappers. To decide which objects are compatible, we check the type specification of the SetInput() method. If the input object returns an output object or a subclass of that type, the two objects are compatible and may be connected.

Generating Oriented Glyphs. This example demonstrates the use of an object with multiple inputs. vtkGlyph3D places 3D icons or glyphs (i.e., any polygonal geometry) at every input point. The icon geometry is specified with the instance variable Source, and the input points are obtained from the Input instance variable. Each glyph may be oriented and scaled in a variety of ways, depending upon the input and instance variables. In our example we place cones oriented in the direction of the point normals (Figure 4-21). Figure 4-21. An example of multiple inputs and outputs. See Mace.cxx and Mace.py.

The visualization network branches at vtkGlyph3D. If either branch is modified, then this filter will re-execute. Network updates must branch in both directions, and both branches must be up to date when vtkGlyph3D executes. These requirements are enforced by the Update() method, and pose no problem to the implicit execution method.

Disappearing Sphere. In our last example we construct a visualization network with a feedback loop, and show how we can use procedural programming to change the topology of the network. The network consists of four objects: vtkSphereSource to create an initial polygonal geometry, vtkShrinkFilter to shrink the polygons and create a gap or space between neighbors, vtkElevationFilter to color the geometry according to height above the x-y plane, and vtkDataSetMapper to map the data through a lookup table and interface to the rendering library. The network topology, a portion of the C++ code, and output are shown in Figure 4-22. Figure 4-22. A network with a loop (LoopShrk.cxx). VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK. See LoopShrink.cxx and LoopShrink.py.

After vtkSphereSource generates an initial geometry (in response to a render request), the input of vtkShrinkFilter is changed to the output of the vtkElevationFilter. Because of the feedback loop, vtkShrinkFilter will always re-execute. Thus, the behavior of the network is to re-execute each time a render is performed. Because the shrink filter is reapplied to the same data, the polygons become smaller and smaller and eventually disappear.

"},{"location":"VTKBook/04Chapter4/#410-chapter-summary","title":"4.10 Chapter Summary","text":"

The visualization process is naturally modelled using a combination of functional and object models. The functional model can be simplified and used to describe visualization networks. The object model specifies the components of the visualization network. Visualization networks consist of process objects and data objects. Data objects represent information; process objects transform the data from one form to another. There are three types of process objects sources have no input and at least one output; filters have at least one input and output; sinks, or mappers, terminate the visualization network. The execution of the network can be controlled implicitly or explicitly. Implicit control means that each object must insure its input is up to date, thereby distributing the control mechanism. Explicit control means that there is a centralized executive to coordinate the execution of each object. Many techniques are available to program visualization networks. Direct visual programming is most common in commercial systems. At a higher level, applications provide tailored but more rigid interfaces to visualize information. At the lowest level, subroutine or object libraries provide the greatest flexibility. The Visualization Toolkit contains an object library implemented in C++ for constructing visualization networks.

"},{"location":"VTKBook/04Chapter4/#411-bibliographic-notes","title":"4.11 Bibliographic Notes","text":"

The practical way to learn about the visualization process is to study commercially available systems. These systems can be categorized as either direct visual programming environments or as applications. Common visual programming systems include AVS [AVS89], Iris Explorer [IrisExplorer], IBM Data Explorer [DataExplorer], aPE [aPE90], and Khoros [Rasure91]. Application systems generally provide less flexibility than visual programming systems, but are better tailored to a particular problem domain. PLOT3D [PLOT3D] is an early example of a tool for CFD visualization. This has since been superseded by FAST [FAST90]. FieldView is another popular CFD visualizer [FieldView91]. VISUAL3 [VISUAL3] is a general tool for unstructured or structured grid visualization. PV-WAVE [Charal90] can be considered a hybrid system, since it has both simple visual programming techniques to interface to data files as well as a more structured user-interface than the visual programming environments. Wavefront's DataVisualizer [DataVisualizer] is a general-purpose visualization tool. It is unique in that it is part of a powerful rendering and animation package. A nice system for visualizing 3D gridded data (such as that produced by numerical weather models) is VIS5D. Find out more at the VIS5D Web site.

Although many visualization systems claim to be object-oriented, this is often more in appearance than implementation. Little has been written on object-oriented design issues for visualization. VISAGE [VISAGE92] presents an architecture similar to that described in this chapter. Favre [Favre94] describes a more conventional object-oriented approach. His dataset classes are based on topological dimension and both data and methods are combined into classes.

"},{"location":"VTKBook/04Chapter4/#412-references","title":"4.12 References","text":"

[aPE90] D. S. Dyer. \"A Dataflow Toolkit For Visualization.\" IEEE Computer Graphics and Applications. 10(4):60-69, July 1990.

[AVS89] C. Upson, T. Faulhaber Jr., D. Kamins and others. \"The Application Visualization System: A Computational Environment for Scientific Visualization.\" IEEE Computer Graphics and Applications. 9(4):30-42, July 1989.

[Bavoil2005] L. Bavoil, S.P. Callahan, P.J. Crossno, J. Freire, C.E. Scheidegger, C.T. Silva and H.T. Vo. \"VisTrails: Enabling Interactive Multiple-View Visualizations.\" In Proceedings of IEEE Visualization 2005. IEEE Computer Society Press, 2005.

[Berger84] M. Berger and J. Oliger. Adaptive Mesh Refinement for Hyperbolic Partial Differential Equations. Journal of Computational Physics, 53:484-512, March 1984.

[Charal90] S. Charalamides. \"New Wave Technical Graphics Is Welcome.\" DEC USER , August 1990.

[CruzNeira93] C. CruzNeira, D.J. Sandin, and T. DeFanti. \"Surround-screen projection-based virtual reality: The design and implementation of the CAVE.\" In Proceedings of SIGGRAPH 93, pp. 135--142, August 1993.

[DataExplorer] Data Explorer Reference Manual. IBM Corp, Armonk, NY, 1991.

[DataVisualizer] Data Visualizer User Manual. Wavefront Technologies, Santa Barbara, CA, 1990.

[FAST90] G. V. Bancroft, F. J. Merritt, T. C. Plessell, P. G. Kelaita, R. K. McCabe, and A.Globus. \"FAST: A Multi-Processed Environment for Visualization.\" In Proceedings of Visualization '90. pp. 14-27, IEEE Computer Society Press, Los Alamitos, CA, 1990.

[Favre94] J. M. Favre and J. Hahn. \"An Object-Oriented Design for the Visualization of Multi-Variate Data Objects.\" In Proceedings of Visualization '94. pp. 319-325, IEEE Computer Society Press, Los Alamitos, CA, 1994.

[FieldView91] S. M. Legensky. \"Advanced Visualization on Desktop Workstations.\" In Proceedings of Visualization '91. pp. 372-378, IEEE Computer Society Press, Los Alamitos, CA, 1991.

[Haeberli88] P. E. Haeberli. \"ConMan: A Visual Programming Language for Interactive Graphics.\" Computer Graphics (SIGGRAPH '88). 22(4):103-11, 1988.

[Humphreys99] G. Humphreys and P. Hanrahan. \"A Distributed Graphics System for Large Tiled Displays.\" In Proc. IEEE Visualization '99, pp. 215-224, IEEE Computer Society Press, October 1999.

[IrisExplorer] Iris Explorer User's Guide. Silicon Graphics Inc., Mountain View, CA, 1991.

[King03] B. King and W. Schroeder. \"Automated Wrapping of Complex C++ Code.\" C/C++ Users Journal, January 2003.

[Law99] C. Charles Law, K. M. Martin, W. J. Schroeder, J. E. Temkin. \"A Multi-Threaded Streaming Pipe-line Architecture for Large Structured Data Sets.\" In Proc. of Visualization \\'99. IEEE Computer Society Press, 1999.

[Levoy94] M. Levoy. \"Spreadsheets for Images.\" In Proceedings of SIGGRAPH '94 . pp. 139--146, 1994.

[Martin2001] K.M. Martin, B. Geveci, J. Ahrens, C. Law. \"Large Scale Data Visualization Using Parallel Data Streaming.\" IEEE Computer Graphics & Applications, 21(4):34-41, July 2001.

[PLOT3D] P. P. Walatka and P. G. Buning. PLOT3D User's Manual. NASA Fluid Dynamics Division, 1988.

[Rasure91] J. Rasure, D. Argiro, T. Sauer, and C. Williams. \"A Visual Language and Software Development Environment for Image Processing.\" International Journal of Imaging Systems and Technology. 1991.

[VISAGE92] W. J. Schroeder, W. E. Lorensen, G. D. Montanaro, and C. R. Volpe. \"VISAGE: An Object-Oriented Visualization System.\" In Proceedings of Visualization '92. pp. 219-226, IEEE Computer Society Press, Los Alamitos, CA, 1992.

[VISUAL3] R. Haimes and M. Giles. \"VISUAL3: Interactive Unsteady Unstructured 3D Visualization.\" AIAA Report No. AIAA-91-0794. January 1991.

[Wernecke94] J. Wernecke. The Inventor Mentor. Addison-Wesley Publishing Company, ISBN 0-201-62495-8, 1994.

"},{"location":"VTKBook/04Chapter4/#413-exercises","title":"4.13 Exercises","text":"

4.1 Consider the following 2D visualization techniques: x-y plotting, bar charts, and pie charts.

For each technique:

a) Construct functional models.

b) Construct object models.

4.2 A height field is a regular array of 2D points where h = f(x,y), h is an altitude above the point (x,y). Height fields are often used to represent terrain data. Design an object-oriented system to visualize height fields.

a) How would you represent the height field?

b) What methods would you use to access this data?

c) Develop one process object (i.e., visualization technique) to visualize a height field. Describe the methods used by the object to access and manipulate the height field.

4.3 Describe how you would implement an explicit control mechanism for network execution.

a) How do process objects register their input data with the executive?

b) How is the executive notified of object modification?

c) By what method is the executive notified that network execution is necessary?

d) Describe an approach for network dependency analysis. How does the executive invoke execution of the process objects?

4.4 Visual programming environments enable the user to construct visualization applications by graphically connecting process objects.

a) Design a graphical notation to represent process objects, their input and output, and data flow direction.

b) How would you modify instance variables of process objects (using a graphical technique)?

c) By what mechanism would network execution be initiated?

d) How would you control conditional execution and looping in your network?

e) How would you take advantage of parallel computing?

f) How would you distribute network execution across two or more computers sharing a network connection?

4.5 Place oriented cylinders (instead of cones) on the mace in Figure 4-20. (Hint: use vtkCylinderSource.)

4.6 The implicit update method for the visualization network used by VTK is simple to implement and understand. However, it is prone to a common programming error. What is this error?

4.7 Experiment with the transformation object in Figure 4-20.

a) Translate the actor with vtkTransform's Translate() method.

b) Rotate the actor with the RotateX(), RotateY(), and RotateZ() methods.

c) Scale the actor with the Scale() method.

d) Try combinations of these methods. Does the actor transform in ways that you expect?

4.8 Visualize the following functions. (Hint: use vtkSampleFunction and refer to Figure 4.1.)

a) F(x,y,z)=x^2

b) F(x,y,z) = x_2 + 2 y + 3 z +1

c) F(x,y,z) = x+2 + y^2 - \\cos (z) + 1

"},{"location":"VTKBook/05Chapter5/","title":"Chapter 5 - Data Representation","text":"

In Chapter 4 - The Visualization Pipeline we developed a pragmatic definition of the visualization process: mapping information into graphics primitives. We saw how this mapping proceeds through one or more steps, each step transforming data from one form, or data representation, into another. In this chapter we examine common data forms for visualization. The goal is to familiarize you with these forms, so that you can visualize your own data using the tools and techniques provided in this text.

"},{"location":"VTKBook/05Chapter5/#51-introduction","title":"5.1 Introduction","text":"

To design representational schemes for data we need to know something about the data we might encounter. We also need to keep in mind design goals, so that we can design efficient data structures and access methods. The next two sections address these issues.

"},{"location":"VTKBook/05Chapter5/#characterizing-visualization-data","title":"Characterizing Visualization Data","text":"

Since our aim is to visualize data, clearly we need to know something about the character of the data. This knowledge will help us create useful data models and powerful visualization systems. Without a clear understanding of the data, we risk designing inflexible and limited visualization systems. In the following we describe important characteristics of data. These characteristics are the discrete nature of data, whether it is regular or irregular, and its topological dimension.

First, visualization data is discrete. This is because we use digital computers to acquire, analyze, and represent our data, and typically measure or sample information at a finite number of points. Hence, all information is necessarily represented in discrete form.

Consider visualizing the simple continuous function y = x^2. If we are using a conventional digital computer, we must discretize this equation to operate on the data it represents (we are ignoring symbolic/analog computers and methods). For example, to plot this equation we would sample the function in some interval, say (-1,1), and then compute the value y of the function at a series of discrete points x = x_i in this interval. The resulting points ((x_0,y_0), (x_1,y_1), (x_2,y_2), ... (x_n,y_n)) connect the points with straight line segments. Thus, our (continuous) data is represented by a discrete sampling.

Because of the discrete character of the data we do not know anything about regions in between data values. In our previous example, we know that data is generated from the function y = x^2, but, generally speaking, when we measure and even compute data, we cannot infer data values between points. This poses a serious problem, because an important visualization activity is to determine data values at arbitrary positions. For example, we might probe our data and desire data values even though the probe position does not fall on a known point.

There is an obvious solution to this problem: interpolation. We presume a relationship between neighboring data values. Often this is a linear function, but we can use quadratic, cubic, spline, or other interpolation functions. Chapter 8 - Advanced Data Representation discusses interpolation functions in greater detail, but for now suffice it to say that interpolation functions generate data values in between known points.

A second important characteristic of visualization data is that its structure may be regular or irregular (alternatively, structured or unstructured). Regular data has an inherent relationship between data points. For example, if we sample on an evenly spaced set of points, we do not need to store all the point coordinates, only the beginning position of the interval, the spacing between points, and the total number of points. The point positions are then known implicitly, which can be taken of advantage of to save computer memory.

Data that is not regular is irregular data. The advantage of irregular data is that we can represent information more densely where it changes quickly and less densely where the change is not so great. Thus, irregular data allows us to create adaptive representational forms, which can be beneficial given limited computing resources.

Characterizing data as regular or irregular allows us to make useful assumptions about the data. As we saw a moment ago, we can store regular data more compactly. Typically, we can also compute with regular data more efficiently relative to irregular data. On the other hand, irregular data gives us more freedom in representing data and can represent data that has no regular patterns.

Finally, data has a topological dimension. In our example y = x^2, the dimension of the data is one, since we have the single independent variable x. Data is potentially of any dimension from 0D points, to 1D curves, 2D surfaces, 3D volumes, and even higher dimensional regions.

The dimension of the data is important because it implies appropriate methods for visualization and data representation. For example, in 1D we naturally use x-y plots, bar charts, or pie charts, and store the data as a 1D list of values. For 2D data we might store the data in a matrix, and visualize it with a deformed surface plot (i.e., a height field - see Exercise 4.2).

In this chapter and Chapter 8 - Advanced Data Representation, we show how these characteristics: discrete, regular/irregular, and data dimension, shape our model of visualization data. Keep these features in mind as you read these chapters.

Figure 5-1. The architecture of a dataset. A dataset consists of an organizing structure, with both topological and geometric properties, and attribute data associated with the structure."},{"location":"VTKBook/05Chapter5/#design-criterion","title":"Design Criterion","text":"

Visualizing data involves interfacing to external data, mapping into internal form, processing the data, and generating images on a computer display device. We pose the question: What form or forms should we use to represent data? Certainly many choices are available to us. The choice of representation is important because it affects the ability to interface to external data and the performance of the overall visualization system. To decide this issue we use the following design criteria:

Compact. Visualization data tends to be large, so we need compact storage schemes to minimize computer memory requirements.

Efficient. Data must be computationally accessible. We want to retrieve and store data in constant time (i.e., independent of data size). This requirement offers us the opportunity to develop algorithms that are linear, or O(n), in time complexity.

Mappable. There are two types of mappings. First, data representations need to efficiently map into graphics primitives. This ensures fast, interactive display of our data. Second, we must be able to easily convert external data into internal visualization data structures. Otherwise, we suffer the burden of complex conversion processes or inflexible software

Minimal Coverage. A single data representation cannot efficiently describe all possible data types. Nor do we want different data representations for every data type we encounter. Therefore, we need a minimal set of data representations that balances efficiency against the number of data types.

Simple. A major lesson of applied computation is that simple designs are preferable to complex designs. Simple designs are easier to understand, and therefore, optimize. The value of simplicity cannot be overemphasized. Many of the algorithms and data representations in this text assign high priority to this design criterion.

The remainder of this chapter describes common visualization data forms based on these design criteria. Our basic abstraction is the data object, a general term for the various concrete visualization data types which are the subclasses of data object.

"},{"location":"VTKBook/05Chapter5/#52-the-data-object","title":"5.2 The Data Object","text":"

The most general form of data found in VTK is the data object. A data object can be thought of as a collection of data without any form. Data objects represent the data that is processed by the visualization pipeline (see the previous chapter and Figure 4-2). Taken by themselves, data objects carry little useful information. It is only when they are organized into some structure that they provide a form that we can operate on with visualization algorithms.

"},{"location":"VTKBook/05Chapter5/#53-the-dataset","title":"5.3 The Dataset","text":"

Data objects with an organizing structure and associated data attributes (Figure 5-11) form datasets. The dataset is an abstract form; we leave the representation and implementation of the structure to its concrete subclasses. Most algorithms (or process objects) in VTK operate on datasets.

The structure has two parts: topology and geometry. Topology is the set of properties invariant under certain geometric transformations [Weiler86]. Here we consider the transformations: rotation, translation, and nonuniform scaling. Geometry is the instantiation of the topology, the specification of position in 3D space. For example, saying that a polygon is a \"triangle,\" specifies topology. By providing point coordinates, we specify geometry.

Dataset attributes are supplemental information associated with geometry and/or topology. This information might be a temperature value at a point or the inertial mass of a cell.

Our model of a dataset assumes that the structure consists of cells and points. The cells specify the topology, while the points specify the geometry. Typical attributes include scalars, vectors, normals, texture coordinates, and tensors.

The definition of the structure of a dataset as a collection of cells and points is a direct consequence of the discrete nature of our data. Points are located where data is known and the cells allow us to interpolate between points. We give detailed descriptions of dataset structure and attributes in the following sections.

"},{"location":"VTKBook/05Chapter5/#54-cell-types","title":"5.4 Cell Types","text":"

A dataset consists of one or more cells (Figure 5-2 and Figure 5-4). Cells are the fundamental building blocks of visualization systems. Cells are defined by specifying a type in combination with an ordered list of points. The ordered list, often referred to as the connectivity list, combined with the type specification, implicitly defines the topology of the cell. The x-y-z point coordinates define the cell geometry.

Figure 5-3 shows one cell type, a hexahedron. The ordered list is a sequence of point ids that index into a point coordinate list. The topology of this cell is implicitly known: we know that (8,10) is one of the 12 edges of the hexahedron, and that (8,10,22,21) is one of its six faces.

Mathematically, we represent a cell by the symbol C_i. Then the cell is an ordered set of points C_1 = {p_1, p_2,..., p_n} with p_i \\in P is a set of n-dimensional points (here n=3). The number of points n using the cell is the size of the cell. U(p_i) is the collection of all cells using p_i:

U(p_i) = {C_i:p_i \\in C_i} Figure 5-2. Linear cell types found in VTK. Numbers define ordering of the defining points. Figure 5-3. Example of a hexahedron cell. The topology is implicitly defined by the ordering of the point list. Physical generation of an image.

The importance of \"uses\" and \"use sets\" will become evident in Chapter 8 - Advanced Data Representation when we explore the topology of datasets.

Although we define points in three dimensions, cells may vary in topological dimension. Vertices, lines, triangles, and tetrahedron are examples of topologically 0, 1, 2, and 3-D cells, respectively, embedded in three-dimensional geometric space. Cells can also be primary or composite. Composite cells consist of one or more primary cells, while primary cells cannot be decomposed into combinations of other primary cell types. A triangle strip, for example, consists of one or more triangles arranged in compact form. The triangle strip is a composite cell because it can be broken down into triangles, which are primary cells.

Certainly there are an infinite variety of possible cell types. In the Visualization Toolkit each cell type has been chosen based on application need. We have seen how some cell types: vertex, line, polygon, and triangle strip (Figure 3-19) are used to represent geometry to the graphics subsystem or library. Other cell types such as the tetrahedron and hexahedron are common in numerical simulation. The utility of each cell type will become evident through the practice of visualization throughout this book. A description of the cell types found in the Visualization Toolkit-including their classification as linear, nonlinear, or other-is given in the following sections.

"},{"location":"VTKBook/05Chapter5/#linear-cells","title":"Linear Cells","text":"

Linear cells are characterized by linear or constant interpolation functions (see \"Interpolation Functions\" in Chapter 8 for more information). As a result, cells of dimension one or greater are characterized by straight edges. Thus any edge may be characterized by two vertex id's (v_1,v_2). The following are the linear cells currently found in VTK.

Vertex. The vertex is a primary zero-dimensional cell. It is defined by a single point.

Polyvertex. The polyvertex is a composite zero-dimensional cell. The polyvertex is defined by an arbitrarily ordered list of points.

Line. The line is a primary one-dimensional cell. It is defined by two points. The direction along the line is from the first point to the second point.

Polyline. The polyline is a composite one-dimensional cell consisting of one or more connected lines. The polyline is defined by an ordered list of n+1 points, where n is the number of lines in the polyline. Each pair of points (i, i+1) defines a line.

Triangle. The triangle is a primary two-dimensional cell. The triangle is defined by a counterclockwise ordered list of three points. The order of the points specifies the direction of the surface normal using the right-hand rule.

Triangle Strip. The triangle strip is a composite two-dimensional cell consisting of one or more triangles. The points defining the triangle strip need not lie in a plane. The triangle strip is defined by an ordered list of n+2 points, where n is the number of triangles. The ordering of the points is such that each set of three points (i,i+1,i+2) with 0 \\leq i \\leq n defines a triangle.

Quadrilateral. The quadrilateral is a primary two-dimensional cell. It is defined by an ordered list of four points lying in a plane. The quadrilateral is convex and its edges must not intersect. The points are ordered counterclockwise around the quadrilateral, defining a surface normal using the right-hand rule.

Pixel. The pixel is a primary two-dimensional cell defined by an ordered list of four points. The cell is topologically equivalent to the quadrilateral with the addition of geometric constraints. Each edge of the pixel is perpendicular to its adjacent edges, and lies parallel to one of the coordinate axes x-y-z. Hence, the normal to the pixel is also parallel to one of the coordinate axes.

The ordering of the points defining the pixel is different from the quadrilateral cell. The points are ordered in the direction of increasing axis coordinate, starting with x, then y, then z. The pixel is a special case of the quadrilateral and is used to improve computational performance.

One important note is that the definition of the pixel cell given here is different from the usual definition for a pixel. Normally pixels are thought of as constant-valued \"picture-elements\" in an image (see [\"Graphics Hardware\"]/VTKBook/03Chapter3/#39-graphics-hardware) in Chapter 3). The definition given here implies that four picture elements form the four corner points of the pixel cell. We normally use the term pixel to describe a pixel cell, but the meaning of the term will vary depending on context.

Polygon. The polygon is a primary two-dimensional cell. The polygon is defined by an ordered list of three or more points lying in a plane. The polygon normal is implicitly defined by a counterclockwise ordering of its points using the right-hand rule.

The polygon may be non-convex, but may not have internal loops, and it cannot self-intersect. The polygon has n edges, where n is the number of points in the polygon.

Tetrahedron. The tetrahedron is a primary three-dimensional cell. The tetrahedron is defined by a list of four non-planar points. The tetrahedron has six edges and four triangular faces as shown in Figure 5-2.

Hexahedron. The hexahedron is a primary three-dimensional cell consisting of six quadrilateral faces, twelve edges, and eight vertices. The hexahedron is defined by an ordered list of eight points as shown in Figure 5-2. The faces and edges must not intersect any other faces and edges, and the hexahedron must be convex.

Voxel. The voxel is a primary three-dimensional cell. The voxel is topologically equivalent to the hexahedron with additional geometric constraints. Each face of the voxel is perpendicular to one of the coordinate x-y-z axes. The defining point list is ordered in the direction of increasing coordinate value as shown in Figure 5-2. The voxel is a special case of the hexahedron and is used to improve computational performance.

Similar to pixels, our definition of a voxel cell differs from the conventional definition of the term voxel. Typically, a voxel is referred to as a constant-valued \"volume element\". Using our definition, eight volume elements form the eight corner points of the voxel cell. We normally use the term voxel to describe a voxel cell, but the meaning of the term will vary depending on the context.

Wedge. The wedge is a primary three-dimensional cell consisting of three quadrilateral faces, two triangular faces, nine edges, and six vertices. The wedge is defined by an ordered list of six points as shown in Figure 5-2. The faces and edges must not intersect any other faces and edges, and the wedge must be convex.

Pyramid. The pyramid is a primary three-dimensional cell consisting of one quadrilateral face, four triangular faces, eight edges, and five vertices. The pyramid is defined by an ordered list of five points as shown in Figure 5-2. The four points defining the quadrilateral base plane must be convex; the fifth apex point must not be co-planar with the base points.

Pentagonal Prism. The pentagonal prism is a primary three-dimensional cell consisting of five quadrilateral faces, two pentagonal faces, fifteen edges, and ten vertices. The pentagonal prism is defined by an ordered list of ten points as shown in Figure 5-2. The faces and edges must not intersect any other faces and edges and the pentagon must be convex.

Hexagonal Prism. The hexagonal prism is a primary three-dimensional cell consisting of six quadrilateral faces, two hexagonal faces, eighteen edges, and twelve vertices. The hexagonal prism is defined by an ordered list of twelve points as shown in Figure 5-2. The faces and edges must not intersect any other faces and edges and the hexagon must be convex."},{"location":"VTKBook/05Chapter5/#nonlinear-types","title":"NonLinear Types","text":"

It is common in numerical analysis to use nonlinear cells, i.e., cell formulations that use nonlinear basis functions. These basis functions are generally formed by combinations of polynomials. Nonlinear cells provide more accurate interpolation functions (see \"Interpolation Functions\" in Chapter 8 for more information) and better approximate curved geometry. However, the number of possible nonlinear basis functions is unlimited, which poses a combinatorial problem to any visualization system (i.e., it is not possible to implement all non-linear cell types). To address this problem, VTK takes a dual approach. First, VTK directly supports nonlinear cell types with quadratic interpolation functions(see Figure 5-4). Such cells are constructed by adding mid-edge nodes, and occasionally mid-face and interior nodes, requiring extending the connectivity list to reflect the addition of these extra entries. Second, VTK has a sophisticated cell adaptor framework, enabling users to interface any basis function to VTK as long as the basis function can be uniquely characterized in an r-s-t parametric coordinates system. (Note: we will describe the cell adaptor framework in more detail in Chapter 8 - Advanced Data Representation.) Figure 5-4. Nonlinear cell types found in VTK.

One significant difference between linear and nonlinear cells is the way they are rendered and operated on by various visualization algorithms. Linear cells are readily converted to linear graphics primitives, which are then processed by the graphics library. Nonlinear cells, on the other hand, do not often have direct support in graphics libraries. (One exception are the family of non-uniform rational B-splines or NURBS. And even these are generally tessellated by the graphics library into linear primitives.) Therefore, nonlinear cells must be treated specially by the visualization system. Some possibilities include:

  1. Tessellating nonlinear cells into linear cells and then operating on the linear cells.

  2. Develop custom rendering and visualization algorithms to operate directly on nonlinear cells.

  3. Program custom rendering operations in the graphics library. These issues are active topics in visualization research [Schroeder05]. In VTK, tessellation methods are currently employed since once tessellated, a cell can be processed by existing linear algorithms. The difficulty with solutions 2) and 3) above is that the effort to create new rendering and visualization algorithms is significant, possibly requiring different solutions for each type of nonlinear cell. Furthermore, it is likely that the performance found in dedicated rendering hardware (e.g., processing linear cells) would far outstrip any software rendering solution for higher order cells. The difficulty with 1) above is that the tessellation must be performed carefully or unacceptable error can be introduced into visualization. Or, if the cell is over-tessellated, an excessive number of linear primitives will result. Future research points to developing adaptive methods that tessellate on a selected error metric (please see Chapter 8 - Advanced Data Representation for more information).

VTK tessellates nonlinear quadratic cells using a fixed subdivision as shown in Figure 5-5. This generally works well for quadratic cells due to the lower order of interpolation, and the few number of points defining the cell.

Quadratic Edge. The quadratic edge is a primary one-dimensional cell. It is defined by three points. The first two points define the endpoints of the edge; the third point is located in the center of the edge as shown in Figure 5-4. The direction along the line is from the first point to the second point.

Quadratic Triangle. The quadratic triangle is a primary two-dimensional cell. It is defined by six points. The first three points are located at the vertices of the triangle; the next three are located in the middle of each of the three edges as shown in Figure 5-4.

Quadratic Linear Quadrilateral. The quadratic linear quadrilateral is a primary two-dimensional cell. It is defined by six points. The first four points are located at the vertices of the quadrilateral; the next two are located in the middle of each of the first and third edge as shown in Figure 5-4. Figure 5-5. Decomposing quadratic nonlinear cells into linear cells. The quadratic tetrahedron is tessellated into six linear tetrahedron; the quadratic hexahedron is tessellated into eight linear hexahedra. Note that some tessellations require the addition of new points. In VTK, a cell adaptor framework is available for tessellating cells with basis functions of arbitrary complexity, see [Chapter 8 - Advanced Data Representation](../08Chapter8) for more information.

Quadratic Quadrilateral. The quadratic quadrilateral is a primary two-dimensional cell. It is defined by eight points. The first four points are located at the vertices of the quadrilateral; the next four are located in the middle of each of the four edges as shown in Figure 5-4.

Bi-Quadratic Quadrilateral. The bi-quadratic quadrilateral is a primary two-dimensional cell. It is defined by nine points. The first four points are located at the vertices of the quadrilateral; the next four are located in the middle of each of the four edges; and the last one is located at the center of the quadrilateral as shown in Figure 5-4.

Quadratic Tetrahedron. The quadratic tetrahedron is a primary three-dimensional cell. It is defined by ten points. The first four points are located at the vertices of the tetrahedron; the next six are located in the middle of each of the six edges as shown in Figure 5-4.

Quadratic Pyramid. The quadratic pyramid is a primary three-dimensional cell. It is defined by thirteen points. The first five points are located at the vertices of the pyramid; the next eight are located in the middle of each of the eight edges as shown in Figure 5-4.

Quadratic Linear Wedge. The quadratic linear wedge is a primary three-dimensional cell. It is defined by twelve points. The first six points are located at the vertices of the wedge; the next six are located in the middle of each of the six edges that belong to a triangle face as shown in Figure 5-4.

Quadratic Wedge. The quadratic wedge is a primary three-dimensional cell. It is defined by fifteen points. The first six points are located at the vertices of the wedge; the next nine are located in the middle of each of the nine edges as shown in Figure 5-4.

Bi-Quadratic Wedge. The bi-quadratic wedge is a primary three-dimensional cell. It is defined by eighteen points. The first six points are located at the vertices of the wedge; the next nine are located in the middle of each of the nine edges; and the next three are located in the center of each quadrilateral faces as shown in Figure 5-4.

Quadratic Hexahedron. The quadratic hexahedron is a primary three-dimensional cell. It is defined by twenty points. The first eight points are located at the vertices of the hexahedron; the next twelve are located in the middle of each of the twelve edges as shown in Figure 5-4.

Bi-Quadratic Hexahedron. The bi-quadratic hexahedron is a primary three-dimensional cell. It is defined by twenty-four points. The first eight points are located at the vertices of the hexahedron; the next twelve are located in the middle of each of the twelve edges; and the next four points are located in the center of the first four faces as shown in Figure 5-4.

Tri-Quadratic Hexahedron. The tri-quadratic hexahedron is a primary three-dimensional cell. It is defined by twenty-seven points. The first eight points are located at the vertices of the hexahedron; the next twelve are located in the middle of each of the twelves edges; the next six are located in the center of each faces; and the last one is located in the center of the hexahedron as shown in Figure 5-4."},{"location":"VTKBook/05Chapter5/#55-attribute-data","title":"5.5 Attribute Data","text":"

Attribute data is information associated with the structure of the dataset. This structure includes both the dataset geometry and topology. Most often, attribute data is associated with dataset points or cells, but sometimes attribute data may be assigned to cell components such as edges or faces. Attribute data may also be assigned across the entire dataset, or across a group of cells or points. We refer to this information as attribute data because it is an attribute to the structure of the dataset. Typical examples include temperature or velocity at a point, mass of a cell, or heat flux into and out of a cell face.

Figure 5-6. Attribute data.

Attribute data is often categorized into specific types of data. These categories have been created in response to common data forms. Visualization algorithms are also categorized according to the type of data they operate on.

Single-valued functions, such as temperature or pressure, are examples of scalar data, which is one attribute type. More generally, attribute data can be treated as n-dimensional data arrays. For example, the single-valued function temperature can be treated as a 1 x 1 array, while velocity can be treated as a 3 x 1 array of components in the x, y, and z directions. This abstract model for data attribute can be extended throughout the visualization system. Some systems extend this model to include the structure of the data. For example, a 3D image dataset (i.e., a volume) can be represented as a 3D array of l x m x n data values. Unstructured data can be represented as a 3D vector of position, plus an array of connectivity. We refer to this general approach as the hyperdata model for visualization data (see [\"Other Data Abstractions\"]VTKBook/05Chapter5/#57-other-data-abstractions)).

In the following sections we describe data attributes using the simpler type-specific model (Figure 5-6). We also limit ourselves to three-dimensional structure, since the dataset structure and graphics are assumed to be three-dimensional."},{"location":"VTKBook/05Chapter5/#scalars","title":"Scalars","text":"

Scalar data is data that is single valued at each location in a dataset. Examples of scalar data are temperature, pressure, density, elevation, and stock price. Scalar data is the simplest and most common form of visualization data.

"},{"location":"VTKBook/05Chapter5/#vectors","title":"Vectors","text":"

Vector data is data with a magnitude and direction. In three dimensions this is represented as a triplet of values (u, v, w). Examples of vector data include flow velocity, particle trajectory, wind motion, and gradient function.

"},{"location":"VTKBook/05Chapter5/#normals","title":"Normals","text":"

Normals are direction vectors: that is, they are vectors of magnitude |n|=1. Normals are often used by the graphics system to control the shading of objects. Normals also may be used by some algorithms to control the orientation or generation of cell primitives, such as creating ribbons from oriented lines.

"},{"location":"VTKBook/05Chapter5/#texture-coordinates","title":"Texture Coordinates","text":"

Texture coordinates are used to map a point from Cartesian space into a 1-, 2-, or 3-dimensional texture space. The texture space is usually referred to as a texture map. Texture maps are regular arrays of color, intensity, and/or transparency values that provide extra detail to rendered objects.

One application of texturing in two dimensions is to \"paste\" a photograph onto one or more polygons, yielding a detailed image without a large number of graphics primitives. (Texture mapping is covered in more detail in Chapter 7 - Advanced Computer Graphics.)

"},{"location":"VTKBook/05Chapter5/#tensors","title":"Tensors","text":"

Tensors are complex mathematical generalizations of vectors and matrices. A tensor of rank k can be considered a k-dimensional table. A tensor of rank 0 is a scalar, rank 1 is a vector, rank 2 is a matrix, and a tensor of rank 3 is a three-dimensional rectangular array. Tensors of higher rank are k-dimensional rectangular arrays.

General tensor visualization is an area of current research. Efforts thus far have been focused on two-dimensional, rank 2 tensors, which are 3 x 3 matrices. The most common form of such tensors are the stress and strain tensors, which represent the stress and strain at a point in an object under load. VTK only treats real-valued, symmetric 3 x 3 tensors.

"},{"location":"VTKBook/05Chapter5/#56-types-of-datasets","title":"5.6 Types of Datasets","text":"

A dataset consists of an organizing structure plus associated attribute data. The structure has both topological and geometric properties and is composed of one or more points and cells. The type of a dataset is derived from the organizing structure, and specifies the relationship that the cells and points have with one another. Common dataset types are shown in Figure 5-7. A dataset is characterized according to whether its structure is regular or irregular. A dataset is regular if there is a single mathematical relationship within the composing points and cells. If the points are regular, then the geometry of the dataset is regular. If the topological relationship of cells is regular, then the topology of the dataset is regular. Regular (or structured) data can be implicitly represented, at great savings in memory and computation. Irregular (or unstructured) data must be explicitly represented, since there is no inherent pattern that can be compactly described. Unstructured data tends to be more general, but requires greater memory and computational resources."},{"location":"VTKBook/05Chapter5/#polygonal-data","title":"Polygonal Data","text":"

We have already seen how graphics libraries are designed to render such geometric primitives as lines and polygons. These primitives also are frequently generated or consumed by computational geometry and visualization algorithms. In the Visualization Toolkit, we call this collection of graphics primitives polygonal data. The polygonal dataset consists of vertices, polyvertices, lines, polylines, polygons, and triangle strips. The topology and geometry of polygonal data is unstructured, and the cells that compose that dataset vary in topological dimension. The polygonal dataset forms a bridge between data, algorithms, and high-speed computer graphics.

Vertices, lines, and polygons form a minimal set of primitives to represent 0-, 1-, and 2-dimensional geometry. We have included polyvertex, polyline, and triangle strip cells for convenience, compactness, and performance. Triangle strips in particular are high-performing primitives. To represent n triangles with a triangle strip requires just n+2 points, compared to the 3n points for conventional representations. In addition, many graphics libraries can render triangle strips at higher speeds than triangle polygons.

Figure 5-7. Dataset types. The unstructured grid consists of all cell types.

Our minimal selection of cells is based on common application and performance, representing a subset of the cells available in some graphics libraries. Other types include quadrilateral meshes, Bezier curves and surfaces, and other spline types such as NURBS (Non-Uniform Rational B-Splines) [Mortenson85]. Spline surfaces are generally used to accurately model and visualize geometry. Few visualization algorithms (other than geometry visualization) have been developed that require spline surfaces.

"},{"location":"VTKBook/05Chapter5/#image-data","title":"Image Data","text":"

An image dataset is a collection of points and cells arranged on a regular, rectangular lattice. The rows, columns, and planes of the lattice are parallel to the global x-y-z coordinate system. If the points and cells are arranged on a plane (i.e., two-dimensional) the dataset is referred to as a pixmap, bitmap, or image. If the points and cells are arranged as stacked planes (i.e., three-dimensional) the dataset is referred to as a volume. Keep in mind that the term image data refers to images, volumes, or one-dimensional point arrays collectively. Note that some authors have referred to image data as uniform grids and structured points. (Structured points was the terminology used in earlier versions of VTK.)

Image data consist of line elements (1D), pixels (2D), or voxels (3D). Image data is regular in both geometry and topology and can be implicitly represented. The representational scheme requires only data dimensions, an origin point, and the data spacing. The dimension of the data is a 3-vector (n_x,n_y,n_z)), specifying the number of points in the x, y, and z directions. The origin point is the position in three-dimensional space of the minimum x-y-z point. Each pixel (2D) or voxel (3D) in a image dataset is identical in shape, the spacing specifying the length in the x-y-z directions.

The regular nature of the topology and geometry of the image dataset suggests a natural i-j-k coordinate system. The number of points in the dataset is n_x \\times n_y \\times n_z while the number of cells is (n_x - 1) \\times (n_y - 1) \\times (n_z - 1). A particular point or cell can be selected by specifying the three indices i-j-k. Similarly, a line is defined by specifying two out of three indices, and a plane by specifying a single index.

The simplicity and compactness of representation are desirable features of image data. It is an efficient structure to traverse and compute with. For this reason image data is rivaled only by polygonal data as the most common form of visualization dataset. The major disadvantage with image data is the so-called \"curse of dimensionality.\" To obtain greater data resolution we must increase the dimensions of the dataset. Increasing the dimensions of an image results in an O(n2) increase in memory requirement, while volumes require an O(n3) increase. Therefore, to resolve a small feature using image data may require more disk space or computer memory than is available.

Image datasets are often used in imaging and computer graphics. Volumes are frequently generated from medical imaging technologies such as Computed Tomography (CT) and Magnetic Resonance Imaging (MRI). Sometimes volumes are used to sample mathematical functions or numerical solutions.

"},{"location":"VTKBook/05Chapter5/#rectilinear-grid","title":"Rectilinear Grid","text":"

The rectilinear grid dataset is a collection of points and cells arranged on a regular lattice. The rows, columns, and planes of the lattice are parallel to the global x-y-z coordinate system. While the topology of the dataset is regular, the geometry is only partially regular. That is, the points are aligned along the coordinate axis, but the spacing between points may vary.

Like the image dataset, rectilinear grids consist of pixels (2D) or voxels (3D). The topology is represented implicitly by specifying grid dimensions. The geometry is represented by maintaining a list of separate x, y, and z coordinates. To obtain the coordinates of a particular point, values from each of the three lists must be appropriately combined.

"},{"location":"VTKBook/05Chapter5/#structured-grid","title":"Structured Grid","text":"

A structured grid is a dataset with regular topology and irregular geometry. The grid may be warped into any configuration in which the cells do not overlap or self-intersect.

The topology of the structured grid is represented implicitly by specifying a 3-vector of dimensions (n_x, n_y, n_z). The geometry is explicitly represented by maintaining an array of point coordinates. The composing cells of a structured grid are quadrilaterals (2D) or hexahedron (3D). Like image data, the structured grid has a natural coordinate system that allows us to refer to a particular point or cell using topological i-j-k coordinates.

Structured grids are commonly found in finite difference analysis. Finite difference is a numerical analysis technique to approximate the solution to partial differential equations. Typical applications include fluid flow, heat transfer, and combustion.

"},{"location":"VTKBook/05Chapter5/#unstructured-points","title":"Unstructured Points","text":"

Unstructured points are points irregularly located in space. There is no topology in an unstructured point dataset, and the geometry is completely unstructured. The vertex and polyvertex cells are used to represent unstructured points.

Unstructured points are a simple but important type of dataset. Often data has no inherent structure, and part of the visualization task is to discover or create it. For example, consider a piston in a car instrumented with temperature gauges. The number of gauges and their location is chosen at a finite set of points, resulting in temperature values at \"unrelated\" (at least in terms of visualization topology) positions on the surface of the piston. To visualize the surface temperature, we have to create an interpolation surface and scheme to fill in intermediate values.

Unstructured points serve to represent such unstructured data. Typically, this data form is transformed into another more structured form for the purposes of visualization. Algorithms for transforming unstructured points into other forms are described in \"Visualizing Unstructured Points\" in Chapter 9.

"},{"location":"VTKBook/05Chapter5/#unstructured-grid","title":"Unstructured Grid","text":"

The most general form of dataset is the unstructured grid. Both the topology and geometry are completely unstructured. Any cell type can be combined in arbitrary combinations in an unstructured grid. Hence the topology of the cells ranges from 0D (vertex, polyvertex) to 3D (tetrahedron, hexahedron, voxel). In the Visualization Toolkit any dataset type can be expressed as an unstructured grid. We typically use unstructured grids to represent data only when absolutely necessary, because this dataset type requires the most memory and computational resources to represent and operate on.

"},{"location":"VTKBook/05Chapter5/#57-other-data-abstractions","title":"5.7 Other Data Abstractions","text":"

Other data models have been proposed besides the dataset model presented here. We briefly examine two other models that have been applied successfully. These are the AVS field model and the model of Haber, Lucas, and Collins, adapted in modified form by the commercial IBM Data Explorer system. The section concludes with a brief comparison between these two models and VTK's data model.

"},{"location":"VTKBook/05Chapter5/#the-application-visualization-systems","title":"The Application Visualization Systems","text":"

AVS (the Application Visualization System) was the first large-scale, commercial visualization system [AVS89]. Much of the early growth, visibility, and successful application of visualization technology was achieved because of the direct application of AVS or the influence of AVS on other researchers. AVS is a data-flow visualization system with a crisp user interface to create, edit, and manipulate visualization networks. Using an explicit executive to control execution of networks, AVS can run distributed and parallel visualization applications. Since the AVS architecture is open, researchers and developers can and have donated filters for use by others.

The AVS data model consists of primitive data and aggregate data. Primitive data are fundamental representations of data such as byte, integer, real, and string. Aggregate types are complex organizations of primitive types and include fields, colormaps, geometries, and pixel maps. Fields can be considered AVS' fundamental data type, and will be described in detail shortly. Colormaps are used to map functional values (i.e., scalar values) into color and transparency values. Geometries consist of graphics primitives such as points, lines, and polygons, and are used by the geometric renderer to display objects. A pixel map is the rendered image, or output, of a visualization.

The field is the most interesting part of the AVS data model. In general, it is an n-dimensional array with scalar or vector data at each point. A scalar is a single value, while a vector is two or more values (not necessarily three). The field array can have any number of dimensions, and the dimensions can be of any size. There is no implicit structure to the field, instead, a mapping function is defined. That is, either an implicit or explicit relationship from data elements to coordinate points is specified. Thus a field is a mapping between two kinds of space: the computational space of the field data and the coordinate space, which is typically the global coordinate system. AVS supports three types of mappings: uniform (i.e., structured), rectilinear, and irregular (i.e., unstructured).

"},{"location":"VTKBook/05Chapter5/#the-data-explorer","title":"The Data Explorer","text":"

The data model of Haber, Lucas, and Collins [Haber91] is based on the mathematics of fiber bundles. The goal of their work is to create a general model for piecewise representations of fields on regular and irregular grids. They refer to their model as the field data model, but their definition of the word field is different from the AVS model. A field is an object composed of a base and dependent data. Informally, the base is a manifold whose coordinates are the independent variables for the field, and the dependent data relate the values of dependent variables to the independent variables of the base. Visualization data consists of field elements that describe the base and dependent variables over a local region.

"},{"location":"VTKBook/05Chapter5/#the-visualization-toolkit","title":"The Visualization Toolkit","text":"

There are similarities and differences between these data models and VTK's dataset model. The greatest difference is that these other models are more abstract. They are capable of representing a wider range of data and are more flexible. In particular, the AVS field model is capable of representing arbitrary streams of numbers in a simple and elegant manner. The field data model of Haber et al. is also powerful: The authors show how this data representation can be used to exploit regularity in data to obtain compact representations. On the other hand, all these models (including VTK's) share the notion of structure versus data. The AVS field model introduces structure by using a mapping function. The field data of the Haber et al. model resembles VTK's dataset model, in that the base is equivalent to VTK's cells, and the field data model's dependent data is analogous to VTK's attribute data.

The difference in abstraction level raises important issues in the design of visualization systems. In the following discussion we refer to data models as abstract or concrete, where the relative level of abstraction is lower in concrete models. Abstract and concrete classes compare as follows:

  • Abstract models are more flexible and capable of representing a wider range of data forms than concrete models.

  • Abstract models lend themselves to compact computer code.

  • Concrete models are easier to describe, interface, and implement than abstract models.

  • The level of abstraction influences the computer code and/or database interface to the data model. Abstract models result in abstract code and data representations; concrete models result in concrete code and data representations.

  • The complexity of abstract models can be hidden by creating simpler, application-specific interfaces. However, this requires extra effort. Concrete models, on the other hand, cannot be made more abstract by modifying interfaces.

The design of computer systems demands careful attention to the balance between abstract and concrete systems. Visualization systems, in particular, must be carefully designed because they interface to other systems and data models. Models that are too abstract can result in confusing computer code and interfaces, and can be misused because of user misunderstanding. On the other hand, concrete models are limited in flexibility and capability, but tend to be easier to learn and apply.

In the design of the Visualization Toolkit, we chose to use a more concrete data model relative to the AVS and field data models. Our decision was based on the premise that the system was to be informative as well as functional, and we wanted to clearly demonstrate basic concepts. On the other hand, VTK's data model is general enough to support our practice of visualization. Our experience with users also has shown us that VTK's data model is easier for the casual visualization user to understand than the more abstract models. If you decide to design your own system, we recommend that you examine other data models. However, we feel that the clarity of code manifested in the Visualization Toolkit is an example of a well-balanced trade-off between design abstraction and simplicity.

Figure 5-8. Implementation of contiguous array. This example is a fragment of the class definition vtkFloatArray."},{"location":"VTKBook/05Chapter5/#58-putting-it-all-together","title":"5.8 Putting It All Together","text":"

In this section we will describe the implementation details of the dataset types covered previously. We will also show you how to create these datasets through a variety of C++ examples.

"},{"location":"VTKBook/05Chapter5/#memory-allocation-and-data-arrays","title":"Memory Allocation and Data Arrays","text":"

Because of the size and scope of data, memory must be carefully managed to create efficient visualization systems. In the Visualization Toolkit, we use contiguous data arrays as the basis for most data structures. Contiguous arrays can be created, deleted, and traversed faster than alternative data structures, such as linked lists or arrays of pointers to structures. In VTK, we refer to these as data arrays, and represent them with the class vtkDataArray.

Contiguous arrays also can be easily transmitted across a network, particularly if the information in the array is independent of computer memory address. Memory independence avoids the overhead of mapping information from one memory location to another. Therefore, in VTK we access information based on an \"id\", an integer index into an array-like object. Data arrays are 0offset just like C++ arrays. That is, given n data values, we successively access these values using the ids (0, 1, 2, ..., n - 1).

An important design decision was to not represent data using arrays of objects (e.g., a separate class for cells and/or points). Our experience has shown that such designs severely impact performance due to the cost of construction and deletion. Instead, we focus on designing classes at a higher level of abstraction. From the perspective of performance, the object-oriented approach serves best at the application level, not at the level of implementation.

The class vtkFloatArray is an example of a contiguous array. We will use this class to describe how contiguous arrays are implemented in VTK. As shown in Figure 5-8, the instance variable Array is a pointer to memory of type float. The allocated length of the array is given by Size. The array is dynamic, so an attempt to insert data beyond the allocated size automatically generates a Resize() operation. When resized, the array approximately doubles in size each time. The MaxId field is an integer offset defining the end of inserted data. If no data has been inserted, then MaxId is equal to -1. Otherwise, MaxId is an integer value where 0 \\leq MaxId < Size."},{"location":"VTKBook/05Chapter5/#the-tuple-abstraction","title":"The Tuple Abstraction","text":"

Many visualization data are defined by multiple component values. An x-y-z coordinate triplet or RGBA color pixel value are two such examples. To represent such data in a contiguous data array, the tuple data abstraction is introduced. As Figure 5-8 illustrates, the contiguous array is grouped into smaller subarrays with NumberOfComponents components. These subarrays are called tuples, and for a given array the tuple size, or NumberOfComponents, is constant for all tuples as shown in Figure 5-9."},{"location":"VTKBook/05Chapter5/#representing-data-with-data-arrays","title":"Representing Data With Data Arrays","text":"

Attribute data and points, as well as several other data objects, are represented with data arrays in VTK. Certain attribute data, such as points, vectors, normals, and tensors, are required to have a tuple size consistent with their definition. For example, points, vectors and normals require a data array with a tuple size of three; tensors a tuple size of nine (i.e., a 3 x 3 matrix). Scalars do not place any requirement on the tuple size. Algorithms that process such scalar data generally operate on the first component of each tuple. (Filters exist in VTK to split multi-component data arrays into separate arrays, and to combine separate data arrays into a single array. See vtkSplitField and vtkMergeFields.)

Figure 5-9. Data array structure. In this example, each tuple has 3 components."},{"location":"VTKBook/05Chapter5/#abstractconcrete-data-array-objects","title":"Abstract/Concrete Data Array Objects","text":"

Visualization data comes in many forms-floating point, integer, byte, and double precision-to name just a few simple types. More complex types such as character strings or multidimensional identifiers also are possible. Given this variety of types, how do we represent and manipulate such data using data arrays? The answer is to provide run-time solutions via abstract data objects, and compile-time solutions using templated C++ code.

Abstract data objects are objects that provide uniform methods to create, manipulate, and delete data using dynamic binding. In C++ we use the virtual keyword to declare methods as dynamically bound. Dynamic binding allows us to execute a method belonging to a concrete object by manipulating that object's abstract superclass (see Figure 5-10).

Consider the abstract class vtkDataArray. We can access the data value at associated point id 129 by executing the method double s = GetTuple1(129). Since the virtual GetTuple1() method returns a floating-point data value, each subclass of vtkDataArray must also return a floating-point value. Although the subclass is free to represent data in any possible form, it must transform its data representation into a floating-point value. This process may be as simple as a cast from a built-in type to floating-point value, or it may be a complex mapping of data. For example, if our data consists of character strings, we could conceivably create an alphabetical list and map the string into a location in the list, and then cast the location into a double value.

Figure 5-10. Data array object diagram. vtkDataArray is an abstract base class. Subclasses of vtkDataArray implement type specific representation and operations. Note: not all concrete data array subclasses are shown in this diagram.

While this run-time oriented interface is convenient for writing general algorithms that do not depend on a particular data type, the conversion of native representation to double type is problematic. First, the conversion operation can affect performance adversely, since the data access methods are called frequently, virtual functions are slower than in-line or non-virtual invocations, and the cast operator is slow in many cases. Second, a complex type such as double loses precision during conversion to double. To remedy these problems, it is possible to access data in its native form and process it accordingly. In this approach C++ templates are used.

To use templates it is necessary to obtain raw, typed pointers to data, and to know the type of data. vtkDataArray and its associated subclasses provides this functionality. With this information it is possible to switch on the type of data into a function templated over that type. A typical code fragment using this functionality is found in most imaging filters, almost all of which are templated as follows:

switch (outData->GetScalarType())\n  {\n  case VTK_CHAR:\n  { typedef char VTK_TT;\n    func(arg1, arg2, arg3, VTK_TT* arg4, VTK_TT* arg5); }\n    break;\n  case VTK_UNSIGNED_CHAR:\n  { typedef unsigned char VTK_TT;\n    func(arg1, arg2, arg3, VTK_TT* arg4, VTK_TT* arg5); }\n    break;\n\n    ...for all types.....\n
Figure 5-11. Data object representation as field data. A field can be represented as an array of arrays. Each array has a specified type, length, tuple size, and name. The association of a data array with points or cells, and its labeling as a particular attribute type, forms point and cell attribute data.

In practice this code is simplified using macros, and the static_cast<> C++ operator is used to perform the cast. Note that the function func is a templated function. The compiler will instantiate the function for the appropriate type. In most cases all native types are represented in the switch statement, so func is expanded accordingly.

Using compile-time oriented methods such as templates avoids the need to cast each data access into a particular type (e.g., double). While it does complicate the code somewhat and result in larger object code, it is generally faster than run-time virtual methods. This approach becomes problematic as the number of types increases. For example, some filters such as vtkImageShiftScale use doubly nested templates to resolve the potential difference in input and output types. The code is more complex and much larger than the generic run-time approach.

"},{"location":"VTKBook/05Chapter5/#data-object-representation","title":"Data Object Representation","text":"

Data objects are implemented in VTK as an array of vtkDataArrays as shown in Figure 5-11. vtkDataObject is an general representation of visualization data. It serves to encapsulate instance variables and methods for visualization network execution (see previous chapter), as well as representing data. Internally, data is represented with an instance of the class vtkFieldData. Very few algorithms directly operate on data objects; rather most algorithms require the specification of an organizing structure in order to process the data. The dataset specifies that organizing structure as described in the following section."},{"location":"VTKBook/05Chapter5/#dataset-representation","title":"Dataset Representation","text":"

Five datasets are implemented in VTK: vtkPolyData, vtkImageData, vtkStructuredGrid, vtkRectilinearGrid, and vtkUnstructuredGrid. The unstructured points dataset is not implemented, but can be represented using either vtkPolyData or vtkUnstructuredGrid.

We use a different internal data representation for each dataset type. By using different representations we minimize data structure memory requirements and implement efficient access methods. It would have been possible to use vtkUnstructuredGrid to represent all dataset types, but the memory and computational overhead are unacceptable for large data. The following sections describe how we represent the dataset.

vtkImageData. The simplest and most compact representation is vtkImageData. Both the dataset points and cells are represented implicitly by specifying the dimensions, data spacing, and origin. The dimensions define the topology of the dataset, while the origin and spacing specify the geometry. The vtkImageData dataset type can represent 1D line samples, 2D images, and 3D volumes. (Note: in earlier versions of VTK, vtkImageData was known as vtkStructuredPoints. There are still remnants of this terminology in the code base.)

There is an implicit ordering of both the points and cells composing vtkImageData. Both the cells and points are numbered in the direction of increasing x, then y, then z. The total number of points is n_x \\times n_y \\times n_z where n_x, n_y, and n_zz are the dimensions of vtkImageData. The total number of cells is (n_x - 1) \\times (n_y - 1) \\times (n_z - 1).

vtkRectilinearGrid. While the topology of vtkRectilinearGrid is regular, the geometry can be described as \"semi-regular.\" The topology is implicitly represented by specifying data dimensions along the x, y, and z coordinate axes. The geometry is defined using three arrays of coordinate values along these axes. These three coordinate arrays can be combined to determine the coordinates of any point in the dataset. In VTK, we represent the arrays using three instances of vtkDataArray. The numbering of points and cells is implicit in exactly the same way as described for vtkImageData.

vtkStructuredGrid. Like vtkImageData, the topology of vtkStructuredGrid is regular and is defined by specifying dimensions in the topological i-j-k coordinate system. However, the geometry of vtkStructuredGrid is realized by specifying point coordinates in the global x-y-z coordinate system.

The abstract data class vtkPoints is used to represent the point coordinates. vtkPoints refers to an underlying instance of vtkDataArray which actually holds the representation of the points as a contiguous array of three-component tuples. A particular point coordinate may be retrieved or inserted by specifying a particular point id. The numbering of the points and cells is implicit in the same fashion as vtkImageData. Care must be taken to insure that the number of points in the data array is the same as that implied by the dimensions of the grid.

vtkPolyData. Unlike vtkImageData and vtkStructuredGrid, the topology of vtkPolyData is not regular, so both the topology and geometry of the dataset must be explicitly represented. The point data in vtkPolyData is represented using the vtkPoints class similar to vtkStructuredGrid.

The Visualization Toolkit uses the class vtkCellArray to explicitly represent cell topology. This class is a list of connectivity for each cell. The structure of the list is a sequence of integer numbers (Figure 5-12). The first number in the list is a count (the number of points in the cell connectivity), and the next series of numbers is the cell connectivity. (Each number in the connectivity list is an index into an instance of a point coordinate list.) Sequences of count followed by the connectivity list are repeated until each cell is enumerated. Additional information such as the number of cells in the list and current position in the list (for traversal purposes) is also maintained by vtkCellArray. Figure 5-12. vtkCellArray structure to represent cell topology.

Notice that type information is not directly represented in this structure. Instead, vtkPolyData maintains four separate lists to vertices, lines, polygons, and triangle strips. The vertex list represents cells of type vtkVertex and vtkPolyVertex. The lines list represents cells of type vtkLine and vtkPolyLine. The polygon list represents cells of type vtkTriangle, vtkQuad, and vtkPolygon. The triangle strip list represents cells of the single type vtkTriangleStrip. As a result, the cell type is known from the particular list the cell is defined in, plus the number of points that define the cell.

Our design of the vtkPolyData class is based on two important requirements. First, we want an efficient interface to external graphics libraries. Second, we wish to aggregate cells according to topology. The four separate lists provide efficient interface because graphics libraries have separate vertex, line, polygon, and triangle strip primitives. As a result, in VTK no run-time checking is required to match the different cell types with the appropriate \"load primitive\" function, since the type is known from the list in which the primitive resides. The four lists also separate cells into 0-, 1-, and 2-dimensional types. This is useful because visualization algorithms often treat data of varying topological order differently.

vtkUnstructuredGrid. The dataset type vtkUnstructuredGrid is the most general in terms of its ability to represent topological and geometric structure. Both points and cells are explicitly represented using derived classes of vtkPoints and vtkCellArray. The class vtkUnstructuredGrid is similar to vtkPolyData except that vtkUnstructuredGrid must be capable of representing all cell types, not just the limited graphics types (i.e., vertices, lines, polygons, and triangle strips) of vtkPolyData.

Another distinguishing characteristic of vtkUnstructuredGrid is that we represent type information differently. In vtkPolyData we categorized cells into four separate lists, thereby representing cell type indirectly. In vtkUnstructuredGrid we add the additional class vtkCellTypes to represent cell type explicitly.

The vtkCellTypes is an array of supplemental information. For each cell, an integer flag defines the cell type. Another variable is used to record the location of the cell definition in the corresponding vtkCellArray (Figure 5-13).

Besides representing cell type, this design also enables random access to cells. Because the length of a cell connectivity list varies, the vtkCellArray class cannot locate a particular cell without traversing its data structure from the origin. With the added class vtkCellTypes, however, it is possible to directly access a cell with a single dereference (i.e., using the offset value).

The vtkCellTypes may also be added to the vtkPolyData data representation - and indeed it has. However, our reasons for this addition are not to represent type explicitly, but rather to provide random access to the cells and enable many topological operations. We will expand on this idea in Chapter 8 - Advanced Data Representation.

Object Model. The five datasets are implemented as shown in Figure 5-14. As this object diagram illustrates, these concrete datasets are subclasses of the abstract class vtkDataSet. Two additional classes are introduced as well. The class vtkStructuredData contributes instance variables and methods for structured data. vtkStructuredData is not in an inheritance relationship with the datasets; rather the structured datasets shown delegate to it in order to implement some of their methods. (This was done to avoid multiple inheritance.) Subclasses of the class vtkPointSet represent their points explicitly, that is, through an instance of vtkPoints or its subclasses. vtkPointSet provides methods and instance variables to manipulate the point data, as well as a general searching capability to find points and cells. (See \"Searching\" in Chapter 8 for more information.) Figure 5-13. The data structure of the class vtkUnstructuredGrid. (This is a subset of the complete structure. See [Chapter 8 - Advanced Data Representation](../08Chapter8) for complete details.) Figure 5-14. Dataset object diagram. The five datasets (shaded) are implemented in VTK. Figure 5-15. Object diagram for twenty concrete cell types in VTK. vtkEmptyCell represents NULL cells. vtkGenericCell can represent any type of cell. Three-dimensional cells are subclasses of vtkCell3D. Higher order cells are subclasses of vtkNonLinearCell."},{"location":"VTKBook/05Chapter5/#cell-representation","title":"Cell Representation","text":"

In the Visualization Toolkit each cell type has been implemented by creating specific classes. Each cell is a subclass of the abstract type vtkCell. Cell topology is represented by a list of ordered point ids, and cell geometry is represented by a list of point coordinates. The object diagram for vtkCell and its subclasses is shown in Figure 5-15.

The abstract class vtkCell specifies methods that each cell must implement. These methods provide a defined interface to the cell's geometry and topology. Additional methods perform computation on the cell. These methods will be discussed in detail in Chapter 8 - Advanced Data Representation.

"},{"location":"VTKBook/05Chapter5/#data-attributes","title":"Data Attributes","text":"

Data attributes are associated with the structure of a dataset. The dataset model is built on points and cells, so it is natural to associate data attributes with points and cells as well. Intermediate structure features, such as cell edges or faces, are not explicitly represented so we cannot easily associate data attributes with them.

In VTK data attributes are associated with the points and cells of the dataset. There is no association of data attributes to intermediate topological features such as triangle edges or hexahedron faces. (Here we refer to data attributes associated with points as point attributes, and data attributes associated with cells as cell attributes.) Our design choice is based on the following rationale.

  • Data acquisition and numerical simulation systems typically measure and/or compute the results at point locations, or at the center of cells.

  • Boundary attribute information (e.g., on faces and edges) can be maintained as cell data ordered according to the topology of the cell.

  • The VTK data model is based on points and cells for reasons of compactness and efficiency. Representing attribute data on cell boundaries would require expanding this representation to support a small number of situations requiring direct support of attribute data on cell boundaries. If in the future a more complex data structure is required to represent boundary attribute data, this is best encapsulated into a single class rather than forcing the abstraction throughout the system.

One difficulty with maintaining both cell data and point data representations is that possible inconsistencies in the data may arise. For example, if a cell's scalar value is 0.5, and its points have scalar values other than 0.5, which is the correct value? Priority schemes can be devised to resolve such situations although the user must recognize that such inconsistencies may exist.

Figure 5-16.Inheritance hierarchy for representing dataset attributes.

To represent dataset attributes we use the organizing classes vtkPointData and vtkCellData, both of which are subclasses of the class vtkFieldData as shown in Figure 5-16. The class vtkDataSetAttributes serves to coordinate the movement of data from one process object to the next. It provides methods for copying, interpolating, and moving data between input and output.

Another important feature of vtkDataSetAttributes is that it provides the ability to assign a data array to represent a particular data attribute. For example, the method SetScalars() is used to specify which data array is to be treated as the scalars in the field.

There is a one-to-one correspondence between each dataset point and its attribute data. Point attributes are accessed by way of the point id. For example, to access the scalar value of point id 129 in the dataset instance aDataSet, we use aDataSet->GetPointData()->GetScalars()->GetTuple(129);

This statement assumes that the scalar data has been defined for this dataset and is non-NULL.

"},{"location":"VTKBook/05Chapter5/#examples","title":"Examples","text":"

In the examples that follow we show manual creation and manipulation of datasets. Typically, these operations are not performed directly by users of VTK. Instead, source objects are used to read data files or generate data. This is more convenient than the manual techniques shown here and should be used whenever possible.

Creation of datasets is a two step process. First the geometry and topology of the dataset must be defined. Depending on the type of dataset, the geometry and topology definition will proceed differently. Then the point and/or cell attribute data is created and associated with the dataset. Remember that there is a one-to-one relationship between the attribute data and the points and cells in the dataset.

Figure 5-17. Creation of polygonal cube. See Cube.cxx and Cube.py.

Create a Polygonal Dataset. In our first example we create a polygonal representation of a cube. The cube is defined by eight points and six quadrilateral faces. We also create eight scalar values associated with the eight vertices of the cube. Figure 5-17 shows the key C++ code fragments used to create the data, and the resulting image.

The geometry of the cube is defined using an instance of the class vtkPoints. By default, the underlying type of vtkPoints is a vtkFloatArray. The topology of the cube (i.e., polygons) is defined with an instance of the class vtkCellArray. These define the points and polygons of the cube, respectively. Scalar data is represented by an instance of the class vtkIntArray.

As this example shows, polygonal data is created by constructing pieces (e.g., points, cells, and point attribute data), and then assembling the pieces to form the complete dataset. If the name of the instance of vtkPolyData is cube, we can summarize these three steps as follows:

  1. Create instance of subclass of vtkPoints to define geometry(i.e.,point coordinates). Use the operator cube->SetPoints() to associate the points with the dataset.

  2. Create instances of vtkCellArray to define topology for vertices, lines, polygons, and triangle strips. Use the operators cube->SetVerts(), cube->SetLines(), cube->SetPolys(), and cube->SetStrips() to associate the cells with the dataset.

  3. Create point and/or attribute data. Every dataset has two fields representing vtkPointDataand vtkCellData. Use the operator pd=cube->GetPointData() to retrieve the pointer to the point attribute data. Use the operator pd=cube->GetCellData() to retrieve the pointer to the cell attribute data. Associate the attribute data with the dataset using the operators pd->SetScalars(), pd->SetVectors(), pd->SetNormals(), pd->SetTensors(), and pd->SetTCoords() (and similar for cell data).

Polygonal data supports the following cell types: vertices, polyvertices, lines, polylines, triangles, quadrilaterals, polygons, and triangle strips. Point and cell attribute data does not need to be defined - you can create none, some, or all of the point and cell attributes in any combination.

The most confusing aspect of this example is the Delete() method. To prevent memory leaks we must use a Delete() method (VTK's destructor) after every New() method. It is apparent from the example that the instance's points, polys, and scalars are referred to by another object (e.g., cube). So doesn't invocation of the Delete() method pose a problem?

The answer is no. Certain data objects in VTK are reference counted to conserve memory resources (i.e., subclasses of vtkObjectBase). That means they can be shared between objects. For most objects the Delete() will invoke the destructor. Reference counted objects act a little differently. The Delete() method simply decrements the reference count. This may or may not destroy the object depending on whether it is being used by another object. In this example the points, polys, and scalars are used by the polygonal dataset cube, so they are not deleted when Delete() is invoked. They will be freed once we free the dataset cube, that is, when their reference count drops to zero. (See the VTK User's Guide for more information about memory management.)

Create an Image Data Dataset. In this example, we create an image dataset (i.e., an instance of vtkImageData). The topology of the dataset is defined by specifying the data dimensions. The geometry is defined by the data spacing and origin. The spacing specifies the length, width, and height of each voxel. The origin specifies the position in 3D space of the \"lower-left\" corner of the data. In our example we set the origin and spacing of the dataset so that its center lies at the origin, and the bounds of the dataset are (-0.5,0.5, -0.5,0.5, -0.5,0.5).

Figure 5-18. Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26^3. See Vol.cxx and Vol.py.

In this example we create scalar data along with the image data dataset. The scalar values are computed from the implicit function for a sphere

\\begin{equation*} F(x,y,z) = (x^2 + y^2 + z^2)-R^2 \\end{equation*} \\bf\\tag{5-2}

with the radius R = 0.4. The scalar data is stored in an instance of vtkFloatArray and assigned to the point attribute data of the dataset.

To complete this example, a contour filter is used to generate a surface of scalar value F(x, y, z) = 0. Note that this functionality (in a more general form) is available from the source object vtkSampleFunction in combination with vtkSphere. Figure 5-18 shows the key C++ code fragment used to create the data and contour the scalar field, and the resulting image.

Image data datasets are easy to construct because both the geometry and topology are implicitly defined. If the name of the instance of vtkImageData is vol, we can summarize the steps to create the dataset as follows:

  1. Define the topology of the dataset using the operator vol->SetDimensions().

  2. Define the geometry of the dataset using the operators vol->SetOrigin()and vol->SetSpacing().

  3. Create point and/or attribute data and associate it with the dataset.

You do not need to specify origin and data spacing. By default the data spacing is (1,1,1) in the x-y-z directions, and the origin is (0,0,0). Thus if the dimensions of the dataset are (n_x \\times n_y \\times n_z), the default length, width, and height of the dataset will be (n_x - 1, n_y - 1, n_z - 1).

The topological dimension of the dataset is implicitly known from its instance variables. For example, if any of the dimensions (n_x, n_y, n_z) is equal to one (and the other two are greater than one), the topological dimension of the dataset is two.

Create a Structured Grid Dataset. In the next example we create a vtkStructuredGrid dataset. Topology is implicitly defined from the dimensions of the dataset. The geometry is explicitly defined by providing an object to represent the point coordinates. In this example we use an instance of vtkPoints and assume that the structured grid is warped according to the equation for a cylinder

\\begin{equation*} x = r_i \\cos\\theta, y = r_i \\sin\\theta, z = z_i \\end{equation*} \\bf\\tag{5-3} Figure 5-19. Creating a structured grid dataset of a semicylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction. See SGrid.cxx and SGrid.py.

We arbitrarily choose the number of points in the tangential direction to be thirteen, the number of points in the radial direction to be eleven, and the number of points in the axis direction to be eleven (i.e., dimensions are 13 \\times 11 \\times 11).

Vectors are generated tangential to the cylinder and of magnitude proportional to the radius. To display the data we draw small, oriented lines at each point as shown in Figure 5-19. (This technique is called a hedgehog. See \"Hedgehogs and Oriented Glyphs\" in Chapter 6 for more information.)

The creation of a structured grid dataset is partially explicit and partially implicit. Geometry is created explicitly be creating an instance of vtkPoints, while the topology is created implicitly by specifying dataset dimensions. If the name of the instance of vtkStructuredGrid is sgrid, the following three steps are used to create it.

  1. Specify the dataset geometry by creating an instance of vtkPoints.Use the operators grid->SetPoints() to associate the points with the dataset.

  2. The dataset topology is specified using the operators grid->SetDimensions(). Make sure the number of points created in item number 1 above is equal to the implied number of points nx \\cdot ny \\cdot nz.

  3. Create point and/or cell attribute data and associate it with the dataset.The topological dimension of the dataset is implied by the specified dimensions. For example, if any of the dimensions (n_x, n_y, n_z) is equal to one, the topological dimension of the dataset is two. If two of the three dimensions (nx, ny, nz) are equal to one, the topological dimension of the dataset is one.

Create a Rectilinear Grid Dataset. A rectilinear grid is regular in topology and semi-regular in geometry. Similar to a structured grid or image data dataset, topology is implicitly represented by specifying grid dimensions. Because the grid is axis-aligned but the point coordinates along each axis may vary, we need three data arrays to represent the geometry of the dataset, one array for each of the x-y-z axes. Note that the cell types of the rectilinear dataset are pixels and voxels.

Figure 5-20. Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray. See RGrid.cxx and RGrid.py.

For maximum flexibility when creating rectilinear grids, in VTK we use three vtkDataArray objects to define the axes arrays. This means that different native data type (e.g., unsigned char, int, float, and so on) can be used for each axes.

To summarize the process of creating an instance of vtkRectilinearGrid, we follow four steps. In this example (shown in Figure 5-20), we assume that the name of the vtkRectilinearGrid instance is rgrid.

  1. Create the dataset geometry by creating three instances of vtkDataArray, one for each of the x-y-z coordinate axes. We will assume that the number of values in each scalar is n_x, n_y, and n_z.

  2. Each of the three instances is assigned to the x, y,and z axes using ther grid->SetXCoordinates(), rgrid->SetYCoordinates(), and rgrid->SetZCoordinates() methods, respectively.

  3. The dataset topology is specified using the operatorr grid->SetDimensions(). Make sure the number of points created in item number 1 above is equal to the implied number of points n_x \\cdot n_y \\cdot n_z.

  4. Create point and/or cell attribute data and associate it with the dataset.

The topological dimension of the dataset is implied by the specified dimensions. For example, if any of the dimensions (n_x, n_y, n_z) is equal to one, the topological dimension of the dataset is two. If two of the three dimensions (n_x, n_y, n_z) are equal to one, the topological dimension of the dataset is one.

Create an Unstructured Grid Dataset. Unstructured grid datasets are the most general dataset type in both topology and geometry. In this example we \"artificially\" create an unstructured grid using an instance of vtkUnstructuredGrid (Figure 5-21). The grid contains examples of each cell type except for pixels and voxels. (Pixels and voxels are generally used internally to process image data datasets. They can be explicitly created and manipulated as long as the required relationship of point geometry is observed.) Creating the dataset structure requires creating points to define the geometry and various cells to define the topology. (Note that in the finite element world we would refer to these as nodes and elements.) Figure 5-21. Creating a structured grid dataset of a semicylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction. See UGrid.cxx and UGrid.py.

To summarize the process of creating an instance of vtkUnstructuredGrid, we follow five steps. We assume the name of vtkUnstructuredGrid instance is ugrid.

  1. Allocate memory for the dataset. Use the operator ugrid->Allocate(). This operator takes two optional parameters related to the size of the data. The first is the size of the connectivity list, and the second is the amount to extend storage (if necessary). As a rule of thumb, use the number of cells times the average number of points defining each cell for both parameters. Exact values for these parameters are not important, although the choice may affect performance. If you fail to execute this operation before inserting data, the software will break.

  2. Create an instance of a subclass of vtkPoints to define the dataset geometry. Use the operator ugrid->SetPoints() to associate the points with the dataset.

  3. Create the data set topology on a cell by cell basis by using the cell insertion operator ugrid->InsertNextCell(). There are various flavors of this operator, use the appropriate one.

  4. Create point and/or cell attribute data and associate it with the dataset.

  5. Complete the creation process by executing the ugrid->Squeeze() operator.This operator reclaims any extra memory consumed by the data structures. Although this step is not required, it will return memory resource back to the computer system.

The creation of unstructured grid datasets is somewhat different from the creation of the other dataset types. This is because of the unstructured nature of the data, and the complex nature of the internal data structures.

"},{"location":"VTKBook/05Chapter5/#59-chapter-summary","title":"5.9 Chapter Summary","text":"

A dataset represents visualization data. The dataset has an organizing structure, with topological and geometric components, and associated attribute data. The structure of a dataset consists of cells (topology) and points (geometry). An important characteristic of the structure is whether its geometry and topology are regular or irregular (or equivalently, structured or unstructured). Regular data is more compact and usually more computationally efficient than irregular data. However, irregular data is more flexible in representation capability than regular data.

Important dataset types include polygonal data, rectilinear grid, image data, structured grids, and unstructured grids. The polygonal dataset type is used to represent graphics data, as well as many kinds of visualization data. The unstructured grid is the most general type, consisting of arbitrary combinations of all possible cell types.

Attribute data consists of scalars, vectors, tensors, texture coordinates, and normals. Other arrays may also be includes as part of attribute data since it is a type of field data. In the Visualization Toolkit, attribute data is associated with both the dataset point and cells.

"},{"location":"VTKBook/05Chapter5/#510-bibliographic-notes","title":"5.10 Bibliographic Notes","text":"

A variety of representation schemes have been proposed for each dataset type described here. These schemes vary depending on design goals. For example, even the simple volume representation has been implemented with other more complex schemes such as run-length encoding and octrees [Bloomenthal88]. A description of more general representation schemes is available in [Haber91], the AVS field model [AVS89], and the compact cell structure [Schroeder94]. An overview of dataset types can be found in [Gelberg90]. Some structures for those mathematically oriented can be found in [Brisson90] and [Poluzzi93]. Haimes [VISUAL3] describes an efficient data structure for unstructured grid visualization.

If you are interested in more details on finite element methods see the classic Zienkiewicz [Zienkiewicz87] or [Gallagher75]. Information about both finite difference and finite element methods is available in [Lapidus82].

"},{"location":"VTKBook/05Chapter5/#511-references","title":"5.11 References","text":"

[AVS89] C. Upson, T. Faulhaber, Jr., D. Kamins, and others. \"The Application Visualization System: A Computational Environment for Scientific Visualization.\" IEEE Computer Graphics and Applications. 9(4):30-42, July 1989.

[Bloomenthal88] J. Bloomenthal. \"Polygonization of Implicit Surfaces.\" Computer Aided Geometric Design. 5(4):341-355, November 1988.

[Brisson90] E. Brisson. \"Representing Geometric Structures in d-Dimensions: Topology and Order.\" ACM Symposium on Computational Geometry. ACM Press, NY, 1989.

[Gallagher75] R. H. Gallagher. Finite Element Analysis: Fundamentals. Prentice Hall, Upper Saddle River, NJ, 1975.

[Gelberg90] L. Gelberg, D. Kamins, D. Parker, and J. Stacks. \"Visualization Techniques for Structured and Unstructured Scientific Data.\" SIGGRAPH '90 Course Notes for State of the Art Data Visualization. August 1990.

[Haber91] R. B. Haber, B. Lucas, N. Collins. \"A Data Model for Scientific Visualization with Provisions for Regular and Irregular Grids.\" In Proceedings of Visualization '91. pp. 298-395, IEEE Computer Society Press, Los Alamitos, CA, 1991.

[Lapidus82] L. Lapidus and G. F. Pinder. Numerical Solution of Partial Differential Equations in Science and Engineering. John Wiley and Sons, New York, 1987.

[Mortenson85] M. E. Mortenson. Geometric Modeling. John Wiley and Sons, New York, 1985.

[Poluzzi93] A. Paoluzzi, F. Bernardini, C. Cattani, and V. Ferrucci. \"Dimension-Independent Modeling with Simplicial Complexes.\" ACM Transactions on Graphics. 12(1):56-102, 1993.

[Schroeder94] W. J. Schroeder and B. Yamrom. \"A Compact Cell Structure for Scientific Visualization.\" SIGGRAPH '93 and '94 Course Notes for Advanced Techniques for Scientific Visualization.

[Schroeder05]W. J. Schroeder, F. Bertel, M. Malaterre, D. Thompson, P. P. Pe\u0301bay, R. O'Bara and S. Tendulkar. \"Framework for Visualizing Higher-Order Basis Functions.\" In Proceedings of IEEE Visualization 2005, pp. 43-50, Minneapolis, MN, IEEE Computer Society Press, October 2005.

[VISUAL3] R. Haimes and M. Giles. \"VISUAL3: Interactive Unsteady Unstructured 3D Visualization.\"AIAA Report No. AIAA-91-0794. January 1991.

[Weiler86] K. J. Weiler. Topological Structures for Geometric Modeling. PhD thesis, Rensselaer Polytechnic Institute, Troy, NY, May 1986.

[Zienkiewicz87] O. C. Zienkiewicz and R. L. Taylor. The Finite Element Method, vol. 1. McGraw-Hill Book Co., New York, 4th ed. 1987.

"},{"location":"VTKBook/05Chapter5/#512-exercises","title":"5.12 Exercises","text":"

5.1 Consider a pixmap of dimensions 1002. Compare the memory requirements to represent this data using:

a) an image dataset,

b) a structured grid dataset,

c) a polygonal mesh of quadrilaterals,

d) an unstructured grid of quadrilateral cells,

e) and a triangle strip mesh of 100 strips of 200 triangles each.

5.2 Consider a volume of dimensions 1003. Compare the memory requirements to represent this data using:

a) an image dataset,

b) a structured grid dataset,

c) and an unstructured grid of hexahedral cells.

5.3 Develop a representational scheme for a rectilinear grid. How does this compare (in memory requirement) to a structured grid?

5.4 Consider a volume of dimensions 1003. Compute the memory requirements for the following point attribute types:

a) unsigned character scalars (1 byte per scalar),

b) float scalars (4 bytes per scalar),

c) float vectors,

d) and double-precision tensors (3x3 tensors).

5.5 List three examples of scalar data.

5.6 List three examples of vector data.

5.7 List three examples of tensor data.

5.8 Is it possible to have more than one scalar field in a dataset? If so, how would this information be represented?

5.9 A common method to represent cell connectivity is to list point ids with the last id negated. For example, triangle (8,7,3) would be represented (8,7,-3). The negative index represents end of cell definition. What are the advantages and disadvantages of this scheme as compared to the VTK cell array structure?

5.10 How many different ways can a hexahedral cell be decomposed into tetrahedron? Are there compatibility issues between neighboring hexahedra?

5.11 Write a program to create and display a structured grid in the form of a hollow cylinder (i.e., cylinder with a hole through it).

5.12 Write a program to create and display an unstructured grid in the form of a hollow cylinder.

5.13 Write a program to create and display a polygonal octahedron.

"},{"location":"VTKBook/06Chapter6/","title":"Chapter 6 - Fundamental Algorithms","text":"

We have seen how to represent basic types of visualization data such as image data, structured grids, unstructured grids, and polygonal data. This chapter explores methods to transform this data to and from these various representations, eventually generating graphics primitives that we can render. These methods are called algorithms, and are of special interest to those working in the field of visualization. Algorithms are the verbs that allow us to express our data in visual form. By combining these verbs appropriately, we can reduce complex data into simple, readily comprehensible sentences that are the power of data visualization.

"},{"location":"VTKBook/06Chapter6/#61-introduction","title":"6.1 Introduction","text":"

The algorithms that transform data are the heart of data visualization. To describe the various transformations available, we need to categorize algorithms according to the structure and type of transformation. By structure we mean the effects that transformation has on the topology and geometry of the dataset. By type we mean the type of dataset that the algorithm operates on.

Structural transformations can be classified in four ways, depending on how they affect the geometry, topology, and attributes of a dataset.

  • Geometric transformations alter input geometry but do not changed the topology of the dataset. For example, if we translate, rotate, and/or scale the points of a polygonal dataset, the topology does not change, but the point coordinates, and therefore the geometry, does.

  • Topological transformations alter input topology but do not change geometry and attribute data. Converting a dataset type from polygonal data to unstructured grid data, or from image data to unstructured grid, changes the topology but not the geometry. More often, however, the geometry changes whenever the topology does, so topological transformation is uncommon.

  • Attribute transformations convert data attributes from one form to another, or create new attributes from the input data. The structure of the dataset remains unaffected. Computing vector magnitude or creating scalars based on elevation are data attribute transformations.

  • Combined transformations change both dataset structure and attribute data. For example, computing contour lines or surfaces is a combined transformation.

We also may classify algorithms according to the type of data they operate on, or the type of data they generate. By type, we most often mean the type of attribute data, such as scalars or vectors. Typical categories include:

  • Scalar algorithms operate on scalar data. For example, the generation of contour lines of temperature on a weather map.

  • Vector algorithms operate on vector data. Showing oriented arrows of airflow (direction and magnitude) is an example of vector visualization.

  • Tensor algorithms operate on tensor matrices. An example of a tensor algorithm is to show the components of stress or strain in a material using oriented icons.

  • Modelling algorithms generate dataset topology or geometry, or surface normals or texture data. Modelling algorithms tend to be the catch-all category for many algorithms, since some do not fit neatly into any single category mentioned above. For example, generating glyphs oriented according to the vector direction and then scaled according to the scalar value, is a combined scalar/vector algorithm. For convenience we classify such an algorithm as a modelling algorithm, because it does not fit squarely into any other category.

Algorithms also can be classified according to the type of data they process. This is the most common scheme found in the visualization literature. However, this scheme is not without its problems. Often the categories overlap, resulting in confusion. For example, a category (not mentioned above) is volume visualization, which refers to the visualization of volume data (or in our terminology, image data). This category was initially created to describe the visualization of scalar data arranged on a volume, but more recently, vector (and even tensor) data has been visualized on a volume. Hence, we have to qualify our techniques to volume vector visualization, or other potentially confusing combinations.

In the text that follows, we will use the attribute type classification scheme: scalar, vector, tensor, and modelling. In cases where the algorithms operate on a particular dataset type, we place them in the appropriate category according to our best judgment. Be forewarned, though, that alternative classification schemes do exist, and may be better suited to describing the true nature of the algorithm.

Figure 6-1 Mapping scalars to colors via a lookup table."},{"location":"VTKBook/06Chapter6/#generality-versus-efficiency","title":"Generality Versus Efficiency","text":"

Most algorithms can be written specifically for a particular dataset type, or more generally, treating any dataset type. The advantage of a specific algorithm is that it is usually faster than a comparable general algorithm. (See \"Other Data Abstractions\" in Chapter 5 where we discussed the tradeoff between abstract and concrete forms.) An implementation of a specific algorithm also may be more memory efficient and its implementation may better reflect the relationship between the algorithm and the dataset type it operates on.

One example of this is contour surface creation. Algorithms for extracting contour surfaces were originally developed for volume data, mainly for medical applications. The regularity of volumes lends itself to efficient algorithms. However, the specialization of volume-based algorithms precludes their use for more general datasets such as structured or unstructured grids. Although the contour algorithms can be adapted to these other dataset types, they are less efficient than those for volume datasets.

Our presentation of algorithms favors the more general implementations. In some special cases we will describe performance improving techniques for particular dataset types. Refer to the bibliography at the end of each chapter for detailed descriptions of specialized algorithms.

"},{"location":"VTKBook/06Chapter6/#62-scalar-algorithms","title":"6.2 Scalar Algorithms","text":"

Scalars are single data values associated with each point and/or cell of a dataset. (Recall that in the Visualization Toolkit we associate data with points.) Because scalar data is commonly found in real-world applications, and because scalar data is so easy to work with, there are many different algorithms to visualize it.

"},{"location":"VTKBook/06Chapter6/#color-mapping","title":"Color Mapping","text":"

Color mapping is a common scalar visualization technique that maps scalar data to colors, and displays the colors on the computer system. The scalar mapping is implemented by indexing into a color lookup table. Scalar values serve as indices into the lookup table.

The mapping proceeds as follows. The lookup table holds an array of colors (e.g., red, green, blue components or other comparable representations). Associated with the table is a minimum and maximum scalar range (min, max) into which the scalar values are mapped. Scalar values greater than the maximum range are clamped to the maximum color, scalar values less than the minimum range are clamped to the minimum color value. Then, for each scalar value x_i, the index i into the color table with n entries (and 0-offset) is given by Figure 6-1.

A more general form of the lookup table is called a transfer function. A transfer function is Figure 6-2 maps any expression that maps scalar value into a color specification. For example, scalar values into separate intensity values for the red, green, and blue color components. We can also use transfer functions to map scalar data into other information such as local transparency. (Transfer functions are discussed in more detail in \"Transparency and Alpha Values\" in Chapter 7. Figure 6-2 maps any expression that maps scalar value into a color specification. For example, scalar values into separate intensity values for the red, green, and blue color components. We can also use transfer functions to map scalar data into other information such as local transparency. (Transfer functions are discussed in more detail in \"Transparency and Alpha Values\" in Chapter 7 and \"Volume Rendering\" in Chapter 7.) A lookup table is a discrete sampling of a transfer function. We can create a lookup table from any transfer function by sampling the transfer function at a set of discrete points.

Color mapping is a one-dimensional visualization technique. It maps one piece of information (i.e., a scalar value) into a color specification. However, the display of color information is not limited to one-dimensional displays. Often we use color information mapped onto 1D, 2D, or 3D objects. This is a simple way to increase the information content of our visualizations.

The key to color mapping for scalar visualization is to choose the lookup table entries carefully. Figure 6-3 shows four different lookup tables used to visualize gas density as fluid flows through a combustion chamber. The first lookup table is gray-scale. Gray-scale tables often provide better structural detail to the eye. The other three images in Figure 6-3 use different color lookup tables. The second uses rainbow hues from blue to red. The third uses rainbow hues arranged from red to blue. The last table uses a table designed to enhance contrast. Careful use of colors can often enhance important features of a dataset. However, any type of lookup table can exaggerate unimportant details or create visual artifacts because of unforeseen interactions between data, color choice, and human physiology.

Designing lookup tables is as much art as it is science. From a practical point of view, tables should accentuate important features, while minimizing less important or extraneous details. It is also desirable to use palettes that inherently contain scaling information. For example, a color rainbow scale from blue to red is often used to represent temperature scale, since many people associate \"blue\" with cold temperatures, and \"red\" with hot temperatures. However, even this scale is problematic: a physicist would say that blue is hotter than red, since hotter objects emit more blue light (i.e., shorter wavelength) than red. Also, there is no need to limit ourselves to \"linear\" lookup tables. Even though the mapping of scalars into colors has been presented as a linear operation (Figure 6-1), the table itself need not be linear. That is, tables can be designed to enhance small variations in scalar value using logarithmic or other schemes, improving the comfort level and engaging the human observer more deeply in the presentation of data improves the effectiveness of communication. Figure 6-2. Transfer function for color components red, green and blue as a function of scalar value. Figure 6-3. Flow density colored with different lookup tables. Top-left: grayscale; Top-right rainbow (blue to red); lower-left rainbow (red to blue); lower-right large contrast. See Rainbow.cxx and Rainbow.py. Figure 6-4. Contouring a 2D structured grid with contour line value = 5."},{"location":"VTKBook/06Chapter6/#contouring","title":"Contouring","text":"

A natural extension to color mapping is contouring. When we see a surface colored with data values, the eye often separates similarly colored areas into distinct regions. When we contour data, we are effectively constructing the boundary between these regions. These boundaries correspond to contour lines (2D) or surfaces (3D) of constant scalar value.

Examples of 2D contour displays include weather maps annotated with lines of constant temperature (isotherms), or topological maps drawn with lines of constant elevation. Three-dimensional contours are called isosurfaces, and can be approximated by many polygonal primitives. Examples of isosurfaces include constant medical image intensity corresponding to body tissues such as skin, bone, or other organs. Other abstract isosurfaces such as surfaces of constant pressure or temperature in fluid flow also may be created.

Consider the 2D structured grid shown in Figure 6-4. Scalar values are shown next to the points that define the grid. Contouring always begins by selecting a scalar value, or contour value, that corresponds to the contour lines or surfaces generated. To generate the contours, some form of interpolation must be used. This is because we have scalar values at a finite set of points in the dataset, and our contour value may lie between the point values. Since the most common interpolation technique is linear, we generate points on the contour surface by linear interpolation along the edges. If an edge has scalar values 10 and 0 at its two endpoints, and if we are trying to generate a contour line of value 5, then edge interpolation computes that the contour passes through the midpoint of the edge.

Once the points on cell edges are generated, we can connect these points into contours using a few different approaches. One approach detects an edge intersection (i.e., the contour passes through an edge) and then \"tracks\" this contour as it moves across cell boundaries. We know that if a contour edge enters a cell, it must exit a cell as well. The contour is tracked until it closes back on itself, or exits a dataset boundary. If it is known that only a single contour exists, then the process stops. Otherwise, every edge in the dataset must be checked to see whether other contour lines exist. Another approach uses a divide and conquer technique, treating cells independently. This is the marching squares algorithm in 2D, and marching cubes [Lorensen87] in 3D. The basic assumption of these techniques is that a contour can only pass through a cell in a finite number of ways. A case table is constructed that enumerates all possible topological states of a cell, given combinations of scalar values at the cell points. The number of topological states depends on the number of cell vertices, and the number of inside / outside relationships a vertex can have with respect to the contour value. A vertex is considered inside a contour if its scalar value is larger than the scalar value of the contour line. Vertices with scalar values less than the contour value are said to be outside the contour. For example, if a cell has four vertices and each vertex can be either inside or outside the contour, there are 2^4 = 16 possible ways that the contour passes through the cell. In the case table we are not interested in where the contour passes through the cell (e.g., geometric intersection), just how it passes through the cell (i.e., topology of the contour in the cell).

Figure 6-5 shows the sixteen combinations for a square cell. An index into the case table can be computed by encoding the state of each vertex as a binary digit. For 2D data represented on a rectangular grid, we can represent the 16 cases with 4 bit index. Once the proper case is selected, the location of the contour line / cell edge intersection can be calculated using interpolation. The algorithm processes a cell and then moves, or marches t o the next cell. After all cells are visited, the contour will be completed. In summary, the marching algorithms proceed as follows:

  1. Select a cell.

  2. Calculate the inside / outside state of each vertex of the cell.

  3. Create an index by storing the binary state of each vertex in a separate bit.

  4. Use the index to look up the topological state of the cell in a case table.

  5. Calculate the contour location (via interpolation) for each edge in the case table.

This procedure will construct independent geometric primitives in each cell. At the cell boundaries duplicate vertices and edges may be created. These duplicates can be eliminated by using a special coincident point merging operation. Note that interpolation along each edge should be done in the same direction. If not, numerical roundoff will likely cause points to be generated that are not precisely coincident, and will not merge properly.

There are advantages and disadvantages to both the edge-tracking and marching cubes approaches. The marching squares algorithm is easy to implement. This is particularly important when we extend the technique into three dimensions, where isosurface tracking becomes much more difficult. On the other hand, the algorithm creates disconnected line segments and points, and the required merging operation requires extra computation resources. The tracking algorithm can be implemented to generate a single polyline per contour line, avoiding the need to merge coincident points.

Figure 6-5. Sixteen different marching squares cases. Dark vertices indicate scalar value is above contour value. Cases 5 and 10 are ambiguous. Figure 6-6. Marching Cubes cases for 3D isosurface generation. The 256 possible cases have been reduced to 15 cases using symmetry. Red vertices are greater than the selected isosurface value. See MarchingCasesA.cxx and See MarchingCasesA.py. Figure 6-7. Using marching triangles or marching tetrahedra to resolve ambiguous cases on rectangular lattice (only face of cube is shown). Choice of diagonal orientation may result in \"bumps\" in contour surface. In 2D, diagonal orientation can be chosen arbitrarily, but in 3D diagonal is constrained by neighbor.

As mentioned previously, the 3D analogy of marching squares is marching cubes. Here, there are 256 different combinations of scalar value, given that there are eight points in a cubical cell (i.e., 2^8 combinations). Figure 6-6 shows these combinations reduced to 15 cases by using arguments of symmetry. We use combinations of rotation and mirroring to produce topologically equivalent cases. Figure 6-10 Marching Cubes complementary cases. See MarchingCasesB.cxx and MarchingCasesB.py.

An important issue is contouring ambiguity. Careful observation of marching squares cases numbered 5 and 10 and marching cubes cases numbered 3, 6, 7, 10, 12, and 13 show that there are configurations where a cell can be contoured in more than one way. (This ambiguity also exists when using an edge tracking approach to contouring.) Contouring ambiguity arises on a 2D square or the face of a 3D cube when adjacent edge points are in different states, but diagonal vertices are in the same state.

In two dimensions, contour ambiguity is simple to treat: for each ambiguous case we implement one of the two possible cases. The choice for a particular case is independent of all other choices. Depending on the choice, the contour may either extend or break the current contour as illustrated in Figure 6-8. Either choice is acceptable since the resulting contour lines will be continuous and closed (or will end at the dataset boundary).

In three dimensions the problem is more complex. We cannot simply choose an ambiguous case independent of all other ambiguous cases. For example Figure 6-9 shows what happens if we carelessly implement two cases independent of one another. In this figure we have used the usual case 3 but replaced case 6 with its complementary case. Complementary cases are formed by exchanging the \"dark\" vertices with \"light\" vertices. (This is equivalent to swapping vertex scalar value from above the isosurface value to below the isosurface value, and vice versa.) The result of pairing these two cases is that a hole is left in the isosurface.

Several different approaches have been taken to remedy this problem. One approach tessellates the cubes with tetrahedron, and uses a marching tetrahedra technique . This works because the marching tetrahedra exhibit no ambiguous cases. Unfortunately, the marching tetrahedra algorithm generates isosurfaces consisting of more triangles, and the tessellation of a cube with tetrahedra requires making a choice regarding the orientation of the tetrahedra. This choice may result in artificial \"bumps\" in the isosurface because of interpolation along the face diagonals as shown in Figure 6-7. Another approach evaluates the asymptotic behavior of the surface, and then chooses the cases to either join or break the contour. Nielson and Hamann [Nielson91] have developed a technique based on this approach they call the asymptotic decider. It is based on an analysis of the variation of the scalar variable across an ambiguous face. The analysis determines how the edges of isosurface polygons should be connected. Figure 6-8. Choosing a particular contour case will break (a) or join (b) the current contour. Case shown is marching squares case 10. Figure 6-9. Arbitrarily choosing marching cubes cases leads to holes in the isosurface.

A simple and effective solution extends the original 15 marching cubes cases by adding additional complementary cases. These cases are designed to be compatible with neighboring cases and prevent the creation of holes in the isosurface. There are six complementary cases required, corresponding to the marching cubes cases 3, 6, 7, 10, 12, and 13. The complementary marching cubes cases are shown in Figure 6-10.

We can extend the general approach of marching squares and marching cubes to other topological types. In VTK we use marching lines, triangles, and tetrahedra to contour cells of these types (or composite cells that are composed of these types). In addition, although we speak of regular types such as squares and cubes, marching cubes can be applied to any cell type topologically equivalent to a cube (e.g., hexahedron or non-cubical voxel).

Figure 6-11 shows four applications of contouring. In Figure 6-11a (a) we see 2D contour lines of CT density value corresponding to different tissue types. These lines were generated using marching squares. Figure 6-11b (b) through Figure 6-11d (d) are isosurfaces created by marching cubes. Figure 6-11b (b) is a surface of constant image intensity from a computed tomography (CT) Xray imaging system. (Figure 6-11a (a) is a 2D subset of this data.) The intensity level corresponds to human bone. Figure 6-11c (c) is an isosurface of constant flow density. Figure 6-11d (d) is an isosurface of electron potential of an iron protein molecule. The image shown in Figure 6-11b (b) is immediately recognizable because of our familiarity with human anatomy. However, for those practitioners in the fields of computational fluid dynamics and molecular biology, Figure 6-11c (c) and Figure 6-11d (d) are equally familiar. As these examples show, methods for contouring are powerful yet general techniques for visualizing data from a variety of fields. (a) Marching squares used to generate contour lines. (b) Marching Cubes surface of human bone (c) Marching Cubes surface of flow density. (d) Marching Cubes surface of iron-protein Figure 6-11. Contouring examples. (a) Marching squares used to generate contour lines See HeadSlice.cxx and HeadSlice.py; (b) Marching Cubes surface of human bone. See HeadBone.cxx and HeadBone.py; (c) Marching Cubes surface of flow density See CombustorIsosurface.cxx and CombustorIsosurface.py; (d) Marching Cubes surface of ironprotein. See IronIsoSurface.cxx and IronIsoSurface.py."},{"location":"VTKBook/06Chapter6/#scalar-generation","title":"Scalar Generation","text":"

The two visualization techniques presented thus far, color mapping and contouring, are simple, effective methods to display scalar information. It is natural to turn to these techniques first when visualizing data. However, often our data is not in a form convenient to these techniques. The data may not be single-valued (i.e., a scalar), or it may be a mathematical or other complex relationship. That is part of the fun and creative challenge of visualization: We must tap our creative resources to convert data into a form we can visualize.

For example, consider terrain data. We assume that the data is xyz coordinates, where x and y represent the coordinates in the plane, and z represents the elevation above sea level. Our desired visualization is to color the terrain according to elevation. This requires creating a color map --- possibly using white for high altitudes, blue for sea level and below, and various shades of green and brown corresponding to elevation between sea level and high altitude. We also need scalars to index into the color map. The obvious choice here is to extract the z coordinate. That is, scalars are simply the z-coordinate value.

This example can be made more interesting by generalizing the problem. Although we could easily create a filter to extract the z-coordinate, we can create a filter that produces elevation scalar values where the elevation is measured along any axis. Given an oriented line starting at the (low) point p_l (e.g., sea level) and ending at the (high) point p_h (e.g., mountain top), we compute the elevation scalar s_i at point p_i = (x_i, y_i,z_i) using the dot product as shown in Figure 6-12. The scalar is normalized using the magnitude of the oriented line, and may be clamped between minimum and maximum scalar values (if necessary). The bottom half of this figure shows the results of applying this technique to a terrain model of Honolulu, Hawaii. A lookup table of 256 ranging from deep blue (water) to yellow-white (mountain top) is used to color map this figure. Figure 6-12. Computing scalars using normalized dot product. Bottom half of figure illustrates technique applied to terrain data from Honolulu, Hawaii. See Hawaii.cxx and Hawaii.py.

Part of the creative practice of visualization is selecting the best technique for given data from the palette of available techniques. Often this requires creative mapping by the user of the visualization system. In particular, to use scalar visualization techniques we need only to create a relationship to generate a unique scalar value. Other examples of scalar mapping include an index value into a list of data, computing vector magnitude or matrix determinate, evaluating surface curvature, or determining distance between points. Scalar generation, when coupled with color mapping or contouring, is a simple, yet effective, technique for visualizing many types of data.

"},{"location":"VTKBook/06Chapter6/#63-vector-algorithms","title":"6.3 Vector Algorithms","text":"

Vector data is a three-dimensional representation of direction and magnitude. Vector data often results from the study of fluid flow, or when examining derivatives (i.e., rate of change) of some quantity.

"},{"location":"VTKBook/06Chapter6/#hedgehogs-and-oriented-glyphs","title":"Hedgehogs and Oriented Glyphs","text":"

A natural vector visualization technique is to draw an oriented, scaled line for each vector (Figure 6-13 (a)). The line begins at the point with which the vector is associated and is oriented in the direction of the vector components (v_x, v_y, v_z). Typically, the resulting line must be scaled up or down to control the size of its visual representation. This technique is often referred to as a hedgehog because of the bristly result.

There are many variations of this technique (Figure 6-13 (b)). Arrows may be added to indicate the direction of the line. The lines may be colored according to vector magnitude, or some other scalar quantity (e.g., pressure or temperature). Also, instead of using a line, oriented \"glyphs\" can be used. By glyph we mean any 2D or 3D geometric representation such as an oriented triangle or cone. (c) Complex display. Figure 6-13. Vector visualization techniques: (a) oriented lines; (b) using oriented glyphs; (c) complex vector visualization. See ComplexV.cxx and ComplexV.py.

Care should be used in applying these techniques. In 3D it is often difficult to understand the position and orientation of a vector because of its projection into a 2D image. Also, using large numbers of vectors can clutter the display to the point where the visualization becomes meaningless. Figure 6-13 (c) shows 167,000 3D vectors (using oriented and scaled lines) in the region of the human carotid artery. The larger vectors lie inside the arteries, the smaller vectors lie outside the arteries and are randomly oriented (measurement error) but small in magnitude. Clearly the details of the vector field are not discernible from this image.

Scaling glyphs also poses interesting problems. In what Tufte has termed a \"visualization lie,\" [Tufte83] scaling a 2D or 3D glyph results in nonlinear differences in appearance. The surface area of an object increases with the square of its scale factor, so two vectors differing by a factor of two in magnitude may appear up to four times different based on surface area. Such scaling issues are common in data visualization, and great care must be taken to avoiding misleading viewers.

"},{"location":"VTKBook/06Chapter6/#warping","title":"Warping","text":"

Vector data is often associated with \"motion.\" The motion is in the form of velocity or displacement. An effective technique for displaying such vector data is to \"warp\" or deform geometry according to the vector field. For example, imagine representing the displacement of a structure under load by deforming the structure. Or if we are visualizing the flow of fluid, we can create a flow profile by distorting a straight line inserted perpendicular to the flow.

(a) Vibration of beam. (b) Momentum profiles. Figure 6-14. Warping geometry to show vector field. (a) Beam displacement See PlateVibration.cxx and PlateVibration.py.); (b) See VelocityProfile.cxx and VelocityProfile.py.

Figure 6-14 shows two examples of vector warping. In the first example the motion of a vibrating beam is shown. The original undeformed outline is shown in wireframe. The second example shows warped planes in a structured grid dataset. The planes are warped according to flow momentum. The relative back and forward flow are clearly visible in the deformation of the planes.

Typically, we must scale the vector field to control geometric distortion. Too small a distortion may not be visible, while too large a distortion can cause the structure to turn inside out or self-intersect. In such a case the viewer of the visualization is likely to lose context, and the visualization will become ineffective.

"},{"location":"VTKBook/06Chapter6/#displacement-plots","title":"Displacement Plots","text":"

Vector displacement on the surface of an object can be visualized with displacement plots. A displacement plot shows the motion of an object in the direction perpendicular to its surface. The object motion is caused by an applied vector field. In a typical application the vector field is a displacement or strain field.

Vector displacement plots draw on the ideas in \"Scalar Generation\". Vectors are converted to scalars by computing the dot product between the surface normal and vector at each point (Figure 6-15 (a)). If positive values result, the motion at the point is in the direction of the surface normal (i.e., positive displacement). Negative values indicate that the motion is opposite the surface normal (i.e., negative displacement).

A useful application of this technique is the study of vibration. In vibration analysis, we are interested in the eigenvalues (i.e., natural resonant frequencies) and eigenvectors (i.e., mode shapes) of a structure. To understand mode shapes we can use displacement plots to indicate regions of motion. There are special regions in the structure where positive displacement changes to negative displacement. These are regions of zero displacement. When plotted on the surface of the structure, these regions appear as the so-called modal lines of vibration. The study of modal lines has long been an important visualization tool for understanding mode shapes.

Figure 6-15. (a) Scalar Computation. Figure 6-15. Vector displacement plots. (a) Vector converted to scalar via dot product computation; (b) Surface plot of vibrating plate. Dark areas show nodal lines. Bright areas show maximum motion. See DisplacementPlot.cxx and DisplacementPlot.py.

Figure 6-15 (b) shows modal lines for a vibrating rectangular beam. The vibration mode in this figure is the second torsional mode, clearly indicated by the crossing modal lines. (The aliasing in the figure is because of the coarseness of the analysis mesh.) To create the figure we combined the procedure of Figure 6-15 (a) with a special lookup table. The lookup table was arranged with dark areas in the center (i.e., corresponds to zero dot product) and bright areas at the beginning and end of the table (corresponds to 1 or -1 dot product). As a result, regions of large normal displacement are bright and regions near the modal lines are dark."},{"location":"VTKBook/06Chapter6/#time-animation","title":"Time Animation","text":"

Some of the techniques described so far can be thought of as moving a point or object over a small time step. The hedgehog line is an approximation of a point's motion over a time period whose duration is given by the scale factor. In other words, if velocity \\vec{V} = dx/dt, then displacement of a point is

\\begin{equation*} \\text{d}\\vec{x} = \\vec{V} \\text{d}t \\end{equation*} \\bf\\tag{6-1}

This suggests an extension to our previous techniques: repeatedly displace points over many time steps. Figure 6-16 shows such an approach. Beginning with a sphere S centered about some point C, we move S repeatedly to generate the bubbles shown. The eye tends to trace out a path by connecting the bubbles, giving the observer a qualitative understanding of the fluid flow in that area. The bubbles may be displayed as an animation over time (giving the illusion of motion) or as a multiple exposure sequence (giving the appearance of a path). Figure 6-16. Time animation of a point C. Although the spacing between points varies, the time increment between each point is constant.

Such an approach can be misused. For one thing, the velocity at a point is instantaneous.

Once we move away from the point the velocity is likely to change. Using Equation6-1 above assumes that the velocity is constant over the entire step. By taking large steps we are likely to jump over changes in the velocity. Using smaller steps we will end in a different position. Thus the choice of step size is a critical parameter in constructing accurate visualization of particle paths in a vector field.

To evaluate Equation6-1 we can express it as an integral:

\\vec{x}(t) = \\int_{t}\\vec{V}dt \\bf\\tag{6-2}

Although this form cannot be solved analytically for most real world data, its solution can be approximated using numerical integration techniques. Accurate numerical integration is a topic beyond the scope of this book, but it is known that the accuracy of the integration is a function of the step size dt. Since the path is an integration throughout the dataset, the accuracy of the cell interpolation functions, as well as the accuracy of the original vector data, plays an important role in realizing accurate solutions. No definitive study is yet available that relates cell size or interpolation function characteristics to visualization error. But the lesson is clear: the result of numerical integration must be examined carefully, especially in regions of large vector field gradient. However, as with many other visualization algorithms, the insight gained by using vector integration techniques is qualitatively beneficial, despite the unavoidable numerical errors.

The simplest form of numerical integration is Euler's method,

\\vec{x}_{i+1} = \\vec{x}_i + \\vec{V}_i\\Delta{t} \\bf\\tag{6-3}

where the position at time is the \\vec{x}_{i+} vector sum of the previous position plus the instantaneous velocity times the incremental time step \\Delta{t}.

Euler's method has error on the order of O(\\Delta{t}^2), which is not accurate enough for some applications. One such example is shown in Figure 6-17. The velocity field describes perfect rotation about a central point. Using Euler's method we find that we will always diverge and, instead of generating circles, will generate spirals instead. Figure 6-17. Euler's integration (b) and RungeKutta integration of order 2 (c) applied to uniform rotational vector field (a). Euler's method will always diverge.

In this text we will use the RungeKutta technique of order 2 [Conte72]. This is given by the expression

\\vec{x}_{i+1} = \\vec{x}_i +\\frac{\\Delta t}{2}(\\vec{V}_i + \\vec{V}_{i+1}) \\bf\\tag{6-4}

where the velocity \\vec{V}_{i+1} is computed using Euler's method. The error of this method is O(\\Delta{t^3}). Compared to Euler's method, the RungeKutta technique allows us to take a larger integration step at the expense of one additional function evaluation. Generally this tradeoff is beneficial, but like any numerical technique, the best method to use depends on the particular nature of the data. Higherorder techniques are also available, but generally not necessary, because the higher accuracy is countered by error in interpolation function or inherent in the data values. If you are interested in other integration formulas, please check the references at the end of the chapter.

One final note about accuracy concerns. The errors involved in either perception or computation of visualizations is an open research area. The discussion in the preceding paragraph is a good example of this. There we characterized the error in streamline integration using conventional numerical integration arguments. But there is a problem with this argument. In visualization applications, we are integrating across cells whose function values are continuous, but whose derivatives are not. As the streamline crosses the cell boundary, subtle effects may occur that are not treated by the standard numerical analysis. Thus the standard arguments need to be extended for visualization applications.

Integration formulas require repeated transformation from global to local coordinates. Consider moving a point through a dataset under the influence of a vector field. The first step is to identify the cell that contains the point. This operation is a search (see \"Searching\" in Chapter 8), plus a conversion to local coordinates. Once the cell is found, then the next step is to compute the velocity at that point by interpolating the velocity from the cell points. The point is then incrementally repositioned (using the integration formula Equation6-4). The process is then repeated until the point exits the dataset or the distance or time traversed exceeds some specified value.

This process can be computationally demanding. There are two important steps we can take to improve performance.

  1. Improving search procedures. There are two distinct types of searches. Initially, the starting location of the particle must be determined by a global search procedure. Once the initial location of the point is determined in the dataset, an incremental search procedure can then be used. Incremental searching is efficient because the motion of the point is limited within a single cell, or at most across a cell boundary. Thus, the search space is greatly limited, and the incremental search is faster relative to the global search.

  2. Coordinate transformation. The cost of a coordinate transformation from global to local coordinates can be reduced if either of the following conditions are true: the local and global coordinate systems are identical with one another (or vary by xyz translation), or if the vector field is transformed from global space to local coordinate space. The image data coordinate system is an example of a local coordinates which are parallel to global coordinates, hence global to local coordinate transformation can be greatly accelerated. If the vector field is transformed into local coordinates (either as a preprocessing step or on a cellbycell basis), then the integration can proceed completely in local space. Once the integration path is computed, selected points along the path can be transformed into global space for the sake of visualization.

"},{"location":"VTKBook/06Chapter6/#streamlines","title":"Streamlines","text":"

A natural extension of the previous time animation techniques is to connect the point position over many time steps. The result is a numerical approximation to a particle trace represented as a line.

Borrowing terminology from the study of fluid flow, we can define three related line representation schemes for vector fields.

  • Particle traces are trajectories traced by fluid particles over time.

  • Streaklines are the set of particle traces at a particular time t_ithrough a specified point x_i.

  • Streamlines are integral curves along a curve s satisfying the equation

\\vec{s}(t) = \\int_{\\tau = t_0}^{t} \\vec{V}\\left(\\vec{s}\\left(\\tau\\right)\\right)\\text{d}\\tau \\bf\\tag{6-5}

for a particular time t.

Streamlines, streaklines, and particle traces are equivalent to one another if the flow is steady. In time varying flow, a given streamline exists only at one moment in time. Visualization systems generally provide facilities to compute particle traces. However, if time is fixed, the same facility can be used to compute streamlines. In general, we will use the term streamline to refer to the method of tracing trajectories in a vector field. Please bear in mind the differences in these representations if the flow is time varying.

Figure 6-18 shows forty streamlines in a small kitchen. The room has two windows, a door (with air leakage), and a cooking area with a hot stove. The air leakage and temperature variation combine to produce air convection currents throughout the kitchen. The starting positions of the streamlines were defined by creating a rake, or curve (and its associated points). Here the rake was a straight line. These streamlines clearly show features of the flow field. By releasing many streamlines simultaneously we obtain even more information, as the eye tends to assemble nearby streamlines into a \"global\" understanding of flow field features. Figure 6-18. Flow velocity computed for a small kitchen (top and side view). Forty streamlines start along the rake positioned under the window. Some eventually travel over the hot stove and are convected upwards. See Kitchen.cxx and Kitchen.py.

Many enhancements of streamline visualization exist. Lines can be colored according to velocity magnitude to indicate speed of flow. Other scalar quantities such as temperature or pressure also may be used to color the lines. We also may create constant time dashed lines. Each dash represents a constant time increment. Thus, in areas of high velocity, the length of the dash will be greater relative to regions of lower velocity. These techniques are illustrated in Figure 6-19 for airflow around a blunt fin. This example consists of a wall with half a rounded fin projecting into the fluid flow. (Using arguments of symmetry, only half of the domain was modeled.) Twenty five streamlines are released upstream of the fin. The boundary layer effects near the junction of the fin and wall are clearly evident from the streamlines. In this area, flow recirculation is apparent, as well as the reduced flow speed."},{"location":"VTKBook/06Chapter6/#64-tensor-algorithms","title":"6.4 Tensor Algorithms","text":"

As we mentioned earlier, tensor visualization is an active area of research. However there are a few simple techniques that we can use to visualize real 3 \\times 3 symmetric tensors. Such tensors are used to describe the state of displacement or stress in a 3D material. The stress and strain tensors for an elastic material are shown in Figure 6-20.

In these tensors the diagonal coefficients are the so-called normal stresses and strains, and the off diagonal terms are the shear stresses and strains. Normal stresses and strains act perpendicular to a specified surface, while shear stresses and strains act tangentially to the surface. Normal stress is either compression or tension, depending on the sign of the coefficient.

Figure 6-19. Vector visualization techniques. See BluntStreamlines.cxx and See BluntStreamlines.py.

A 3 \\times 3 real symmetric matrix can be characterized by three vectors in 3D called the eigenvectors, and three numbers called the eigenvalues of the matrix. The eigenvectors form a 3D coordinate system whose axes are mutually perpendicular. In some applications, particularly the study of materials, these axes also are referred to as the principle axes of the tensor and are physically significant. For example, if the tensor is a stress tensor, then the principle axes are the directions of normal stress and no shear stress. Associated with each eigenvector is an eigenvalue. The eigenvalues are often physically significant as well. In the study of vibration, eigenvalues correspond to the resonant frequencies of a structure, and the eigenvectors are the associated mode shapes.

Mathematically we can represent eigenvalues and eigenvectors as follows. Given a matrix the eigenvector and eigenvalue must satisfy the relation

A \\cdot \\vec{x} = \\lambda \\vec{x} \\bf\\tag{6-6}

For Equation6-6 to hold, the matrix determinate must satisfy

det |A-\\lambda I| = 0 \\bf\\tag{6-7}

Expanding this equation yields a n^{th} degree polynomial in \\lambda whose roots are the eigenvalues. Thus, there are always n eigenvalues, although they may not be distinct. In general, Equation6-7 is not solved using polynomial root searching because of poor computational performance. (For matrices of order 3 root searching is acceptable because we can solve for the eigenvalues analytically.) Once we determine the eigenvalues, we can substitute each into Equation6-7 to solve for the associated eigenvectors.

Figure 6-20. Stress and strain tensors. Normal stresses in the x-y-z coordinate directions indicated as *sigma*, shear stresses indicated as *tau*. Material displacement represented by (u, v, w) components.

We can express the eigenvectors of the 3 \\times 3 system as

\\vec{v_i} = \\lambda _i \\vec{e_i} \\ with\\ i = 1,2,3 \\bf\\tag{6-8}

\\vec{e_i} a unit vector in the direction of the eigenvalue, and \\lambda{_i} the eigenvalues of the system. If we order eigenvalues such that

\\lambda{_1} \\geq \\lambda{_2} \\geq \\lambda{_3} \\bf\\tag{6-9}

then we refer to the corresponding eigenvectors \\vec{v_1}, \\vec{v_2} and \\vec{v_1} as the major, medium and minor eigenvectors.

"},{"location":"VTKBook/06Chapter6/#tensor-ellipsoids","title":"Tensor Ellipsoids","text":"

This leads us to the tensor ellipsoid technique for the visualization of real, symmetric matrices. The first step is to extract eigenvalues and eigenvectors as described in the previous section. Since eigenvectors are known to be orthogonal, the eigenvectors form a local coordinate system. These axes can be taken as the minor, medium and major axes of an ellipsoid. Thus, the shape and orientation of the ellipsoid represent the relative size of the eigenvalues and the orientation of the eigenvectors.

To form the ellipsoid we begin by positioning a sphere at the tensor location. The sphere is then rotated around its origin using the eigenvectors, which in the form of Equation6-8 are direction cosines. The eigenvalues are used to scale the sphere. Using 4 x 4 transformation matrices and referring to Equation3-6, Equation3-9 and Equation3-13, we form the ellipsoid by transforming the sphere centered at the origin using the matrix T

T = T_T \\cdot T_R \\cdot T_S \\bf\\tag{6-10}

(remember to read right to left). The eigenvectors can be directly plugged in to create the rotation matrix, while the point coordinates x-y-z and eigenvalues \\lambda{_1} \\geq \\lambda{_2} \\geq \\lambda{_3} are inserted into the translation and scaling matrices. A concatenation of these matrices forms the final transformation matrix T.

Figure 6-21. Tensor ellipsoids. (a) Ellipsoid oriented along eigenvalues (i.e., principle axes) of tensor; (b) Pictorial description of Boussinesq's problem; (c) Analytic results according to Saada.

Figure 6-21 (a) depicts the tensor ellipsoid technique. In Figure 6-21 (b) we show this technique to visualize material stress near a point load on the surface of a semi-infinite domain. (This is the so-called Boussinesq's problem.) From Saada [Saada74] we have the analytic expression for the stress components in Cartesian coordinates shown in Figure 6-21 (c). Note that the z-direction is defined as the axis originating at the point of application of the force P. The variable \\rho is the distance from the point of load application to a point x-y-z. The orientation of the x and y axes are in the plane perpendicular to the z axis. (The rotation in the plane of these axes is unimportant since the solution is symmetric around the z axis.) (The parameter \\nu is Poisson's ratio which is a property of the material. Poisson's ratio relates the lateral contraction of a material to axial elongation under a uniaxial stress condition. See [Saada74] or [Timoshenko70] for more information.) (a) Tensor axes (b) Tensor ellipsoids Figure 6-22. Tensor visualization techniques; (a) Tensor axes. See TensorAxes.cxx and TensorAxes.py (b) Tensor ellipsoids. See TensorEllipsoids.cxx and TensorEllipsoids.py

In Figure 6-22 we visualize the analytical results of Boussinesq's problem from Saada. The top portion of the figure shows the results by displaying the scaled and oriented principal axes of the stress tensor. (These are called tensor axes.) In the bottom portion we use tensor ellipsoids to show the same result. Tensor ellipsoids and tensor axes are a form of glyph (see \"Glyphs\") specialized to tensor visualization.

A certain amount of care must be taken to visualize this result since there is a stress singularity at the point of contact of the load. In a real application loads are applied over a small area and not at a single point. Also, plastic behavior prevents stress levels from exceeding a certain point. The results of the visualization, as with any computer process, are only as good as the underlying model.

"},{"location":"VTKBook/06Chapter6/#65-modelling-algorithms","title":"6.5 Modelling Algorithms","text":"

Modelling algorithms are the catchall category for our taxonomy of visualization techniques. Modelling algorithms have one thing in common: They create or change dataset geometry or topology.

"},{"location":"VTKBook/06Chapter6/#source-objects","title":"Source Objects","text":"

As we have seen in previous examples, source objects begin the visualization pipeline. Source objects are used to create geometry such as spheres, cones, or cubes to support visualization context or are used to read in data files. Source objects also may be used to create dataset attributes. Some examples of source objects and their use are as follows.

Modelling Simple Geometry.

Spheres, cones, cubes, and other simple geometric objects can be used alone or in combination to model geometry. Often we visualize real-world applications such as air flow in a room and need to show real-world objects such as furniture, windows, or doors.

Real-world objects often can be represented using these simple geometric representations. These source objects generate their data procedurally. Alternatively, we may use reader objects to access geometric data defined in data files. These data files may contain more complex geometry such as that produced by a 3D CAD (ComputerAided Design) system.

Supporting Geometry.

During the visualization process we may use source objects to create supporting geometry. This may be as simple as three lines to represent a coordinate axis or as complex as tubes wrapped around line segments to thicken and enhance their appearance. Another common use is as supplemental input to objects such as streamlines or probe filters. These filters take a second input that defines a set of points. For streamlines, the points determine the initial positions for generating the streamlines. The probe filter uses the points as the position to compute attribute values such as scalars, vectors, or tensors.

Data Attribute Creation.

Source objects can be used as procedures to create data attributes. For example, we can procedurally create textures and texture coordinates. Another use is to create scalar values over a uniform grid. If the scalar values are generated from a mathematical function, then we can use the visualization techniques described here to visualize the function. In fact, this leads us to a very important class of source objects: implicit functions.

"},{"location":"VTKBook/06Chapter6/#implicit-functions","title":"Implicit Functions","text":"

Implicit functions are functions of the form

F(x,y,z) = c \\bf\\tag{6-11}

where c is an arbitrary constant. Implicit functions have three important properties.

  • Simple geometric description. Implicit functions are convenient tools to describe common geometric shapes. This includes planes, spheres, cylinders, cones, ellipsoids, and quadrics.

  • Region separation. Implicit functions separate 3D Euclidean space into three distinct regions. These regions are inside, on, and outside the implicit function. These regions are defined as F(x,y,z) < 0, F(x,y,z) = 0 and F(x,y,z) > 0, respectively.

  • Scalar generation. Implicit functions convert a position in space into a scalar value. That is, given an implicit function we can sample it at a point (x_i,y_i,z_i) to generate a scalar value c_i.

An example of an implicit function is the equation for a sphere of radius R.

F(x,y,z) = x^2 + y^2 + z^2 - R^2 \\bf\\tag{6-12}

This simple relationship defines the three regions (on F(x,y,z = 0)s onthe sphere), F(x,y,z) < 0 (inside the sphere), and F(x,y,z) (outside the sphere). Any point may be classified inside, on, or outside the sphere simply by evaluating Equation6-12.

Figure 6-23a. (a) Sphere sampling (b) Isosurface of Sphere (c) BooleanCombinations Figure 6-23. Sampling functions. (b) Isosurface of sampled sphere; See ImplicitSphere.cxx and ImplicitSphere.py; (c) Boolean combination of two spheres, a cone, and two planes. (One sphere intersects the other, the planes clip the cone. See IceCream.cxx and IceCream.py.

Modelling Objects.

Implicit functions can be used alone or in combination to model geometric objects. For example, to model a surface described by an implicit function, we sample F on a dataset and generate an isosurface at a contour value c_i. The result is a polygonal representation of the function. *Figure 6-23b shows an isosurface for a sphere of radius=1 sampled on a volume. Note that we can choose nonzero contour values to generate a family of offset surfaces. This is useful for creating blending functions and other special effects.

Implicit functions can be combined to create complex objects using the boolean operators union, intersection, and difference. The union operation between F\\cup G between two functions F(x,y,z) and G(x,y,z) is the minimum value

\\begin{equation*} F \\cup G = \\lbrace \\max\\left(F\\left(\\vec{x}\\right), G\\left(\\vec{x}\\right)\\right)\\, \\vert \\, \\vec{x} \\in \\mathbb{R}^n \\rbrace \\end{equation*} \\bf\\tag{6-13}

The intersection between two implicit functions is given by

\\begin{equation*} F \\cap G = \\lbrace \\min\\left(F\\left(\\vec{x}\\right), G\\left(\\vec{x}\\right)\\right)\\, \\vert \\, \\vec{x} \\in \\mathbb{R}^n \\rbrace \\end{equation*} \\bf\\tag{6-14}

The difference of two implicit functions is given by

\\begin{equation*} F - G = \\lbrace \\min\\left(F\\left(\\vec{x}\\right), -G\\left(\\vec{x}\\right)\\right)\\, \\vert \\, \\vec{x} \\in \\mathbb{R}^n \\rbrace \\end{equation*} \\bf\\tag{6-15}

Figure 6-23c shows a combination of simple implicit functions to create an ice-cream cone. The cone is created by clipping the (infinite) cone function with two planes. The ice cream is constructed by performing a difference operation on a larger sphere with a smaller offset sphere to create the \"bite.\" The resulting surface was extracted using surface contouring with isosurface value 0.0.

(a) Selecting data with implicit function (b) Selecting data with boolean combination

Figure 6-24. Implicit functions used to select data: (a) 2D cells lying in ellipse are selected; (b) Two ellipsoids combined using the union operation used to select voxels from a volume. Voxels shrunk 50 percent. See ExtractData.cxx and ExtractData.py.

Selecting Data.

We can take advantage of the properties of implicit functions to select and cut data. In particular we will use the region separation property to select data. (We defer the discussion on cutting to \"Cutting\".)

Selecting or extracting data with an implicit function means choosing cells and points (and associated attribute data) that lie within a particular region of the function. To determine whether a point xyz lies within a region, we simply evaluate the point and examine the sign of the result. A cell lies in a region if all its points lie in the region.

Figure 6-24 (a) shows a 2D implicit function, here an ellipse, used to select the data (i.e., points, cells, and data attributes) contained within it. Boolean combinations also can be used to create complex selection regions as illustrated in Figure 6-24 (b). Here, two ellipses are used in combination to select voxels within a volume dataset. Note that extracting data often changes the structure of the dataset. In Figure 6-24 the input type is a image data dataset, while the output type is an unstructured grid dataset.

Visualizing Mathematical Descriptions.

Some functions, often discrete or probabilistic in nature, cannot be cast into the form of Equation6-11. However, by applying some creative thinking we can often generate scalar values that can be visualized. An interesting example of this is the so-called strange attractor.

Strange attractors arise in the study of nonlinear dynamics and chaotic systems. In these systems, the usual types of dynamic motion --- equilibrium, periodic motion, or quasi-periodic motion --- are not present. Instead, the system exhibits chaotic motion. The resulting behavior of the system can change radically as a result of small perturbations in its initial conditions.

Figure 6-25. Visualizing a Lorenz strange attractor by integrating the Lorenz equations in a volume. The number of visits in each voxel is recorded as a scalar function. The surface is extracted via marching cubes using a visit value of 50. The number of integration steps is 10 million, in a volume of dimensions 200^3. The surface roughness is caused by the discrete nature of the evaluation function. See Lorenz.cxx and Lorenz.py.

A classical strange attractor was developed by Lorenz in 1963 [Lorenz63]. Lorenz developed a simple model for thermally induced fluid convection in the atmosphere. Convection causes rings of rotating fluid and can be developed from the general NavierStokes partial differential equations for fluid flow. The Lorenz equations can be expressed in nondimensional form as

\\begin{eqnarray*} \\frac{\\text{d}x}{\\text{d}t} &=& \\sigma (y - z) \\\\ \\frac{\\text{d}y}{\\text{d}t} &=& \\rho x - y - x z \\\\ \\frac{\\text{d}z}{\\text{d}t} &=& x y - \\beta z \\end{eqnarray*} \\bf\\tag{6-16}

where x is proportional to the fluid velocity in the fluid ring, y and zz measure the fluid temperature in the plane of the ring, the parameters \\sigma and \\rho are related to the Prandtl number and Raleigh number, respectively, and \\beta is a geometric factor.

Certainly these equations are not in the implicit form of Equation6-11, so how do we visualize them? Our solution is to treat the variables x, y, and z as the coordinates of a three-dimensional space, and integrate Equation6-16 to generate the system \"trajectory\", that is, the state of the system through time. The integration is carried out within a volume and scalars are created by counting the number of times each voxel is visited. By integrating long enough, we can create a volume representing the \"surface\" of the strange attractor, Figure 6-25. The surface of the strange attractor is extracted by using marching cubes and a scalar value specifying the number of visits in a voxel. Figure 6-26. Distance functions to a point, line, and triangle."},{"location":"VTKBook/06Chapter6/#implicit-modelling","title":"Implicit Modelling","text":"

In the previous section we saw how implicit functions, or boolean combinations of implicit functions, could be used to model geometric objects. The basic approach is to evaluate these functions on a regular array of points, or volume, and then to generate scalar values at each point in the volume. Then either volume rendering (\"Volume Rendering\"), or isosurface generation in combination with surface rendering, is used to display the model.

An extension of this approach, called implicit modeling, is similar to modeling with implicit functions. The difference lies in the fact that scalars are generated using a distance function instead of the usual implicit function. The distance function is computed as a Euclidean distance to a set of generating primitives such as points, lines, or polygons. For example, Figure 6-26 shows the distance functions to a point, line, and triangle. Because distance functions are well-behaved monotonic functions, we can define a series of offset surfaces by specifying different isosurface values, where the value is the distance to the generating primitive. The isosurfaces form approximations to the true offset surfaces, but using high volume resolution we can achieve satisfactory results.

Used alone the generating primitives are limited in their ability to model complex geometry. By using boolean combinations of the primitives, however, complex geometry can be easily modeled. The boolean operations union, intersection, and difference (Equation6-13, Equation6-14, and Equation6-15, respectively) are illustrated in Figure 6-27. Figure 6-28 shows the application of implicit modeling to \"thicken\" the line segments in the text symbol \"HELLO\". The isosurface is generated on a volume 110 \\times 40 \\times 20 at a distance offset of 0.25 units. The generating primitives were combined using the boolean union operator. Although Euclidean distance is always a nonnegative value, it is possible to use a signed distance function for objects that have an outside and an inside. A negative distance is the negated distance of a point inside the object to the surface of the object. Using a signed distance function allows us to create offset surfaces that are contained within the actual surface. Another interesting feature of implicit modeling is that when isosurfaces are generated, more than one connected surface can result. These situations occur when the generating primitives form concave features. Figure 6-29 illustrates this situation. If desired, multiple surfaces can be separated by using the connectivity algorithm described in \"Connectivity\" in Chapter 9. Figure 6-27. Boolean operations using points and lines as generating primitives. Figure 6-28. Implicit modelling used to thicken a stroked font. Original lines can be seen within the translucent implicit surface. See Hello.cxx and Hello.py. Figure 6-29. Concave features can result in multiple contour lines/surfaces."},{"location":"VTKBook/06Chapter6/#glyphs","title":"Glyphs","text":"

Glyphs, sometimes referred to as icons, are a versatile technique to visualize data of every type. A glyph is an \"object\" that is affected by its input data. This object may be geometry, a dataset, or a graphical image. The glyph may orient, scale, translate, deform, or somehow alter the appearance of the object in response to data. We have already seen a simple form of glyph: hedgehogs are lines that are oriented, translated and scaled according to the position and vector value of a point. A variation of this is to use oriented cones or arrows. (See \"Hedgehogs and Oriented Glyphs\" in this Chapter for more information.)

More elaborate glyphs are possible. In one creative visualization technique Chernoff [Chernoff73] tied data values to an iconic representation of the human face. Eyebrows, nose, mouth, and other features were modified according to financial data values. This interesting technique built on the human capability to recognize facial expression. By tying appropriate data values to facial characteristics, rapid identification of important data points is possible.

Figure 6-30 Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected. See SpikeFran.cxx and SpikeFran.py.

In a sense, glyphs represent the fundamental result of the visualization process. Moreover, all the visualization techniques we present can be treated as concrete representations of an abstract glyph class. For example, while hedgehogs are an obvious manifestation of a vector glyph, isosurfaces can be considered a topologically two-dimensional glyph for scalar data. Delmarcelle and Hesselink [Delmarcelle95] have developed a unified framework for flow visualization based on types of glyphs. They classify glyphs according to one of three categories.

  • Elementary icons represent their data across the extent of their spatial domain. For example, an oriented arrow can be used to represent surface normal.

  • Local icons represent elementary information plus a local distribution of the values around the spatial domain. A surface normal vector colored by local curvature is one example of a local icon, since local data beyond the elementary information is encoded.

  • Global icons show the structure of the complete dataset. An isosurface is an example of a global icon.

This classification scheme can be extended to other visualization techniques such as vector and tensor data, or even to non-visual forms such as sound or tactile feedback. We have found this classification scheme to be helpful when designing visualizations or creating visualization techniques. Often it gives insight into ways of representing data that can be overlooked.

Figure 6-30 is an example of glyphing. Small 3D cones are oriented on a surface to indicate the direction of the surface normal. A similar approach could be used to show other surface properties such as curvature or anatomical keypoints."},{"location":"VTKBook/06Chapter6/#cutting","title":"Cutting","text":"

Often we want to cut through a dataset with a surface and then display the interpolated data values on the surface. We refer to this technique as data cutting or simply cutting. The data cutting operation requires two pieces of information: a definition for the surface and a dataset to cut. We will assume that the cutting surface is defined by an implicit function. A typical application of cutting is to slice through a dataset with a plane, and color map the scalar data and/or warp the plane according to vector value.

Figure 6-31. Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. See CutStructuredGrid.cxx and CutStructuredGrid.py.

A property of implicit functions is to convert a position into a scalar value (see \"Implicit Functions\" in this Chapter). We can use this property in combination with a contouring algorithm (e.g., marching cubes) to generate cut surfaces. The basic idea is to generate scalars for each point of each cell of a dataset (using the implicit cut function), and then contour the surface value F(x,y,z) = 0.

The cutting algorithm proceeds as follows. For each cell, function values are generated by evaluating F(x,y,z) for each cell point. If all the points evaluate positive or negative, then the surface does not cut the cell. However, if the points evaluate positive and negative, then the surface passes through the cell. We can use the cell contouring operation to generate the isosurface F(x,y,z) = 0. Data attribute values can then be computed by interpolating along cut edges.

Figure 6-31 illustrates a plane cut through a structured grid dataset. The plane passes through the center of the dataset with normal (--0.287, 0, 0.9579). For comparison purposes a portion of the grid geometry is also shown. The grid geometry is the grid surface k=9 (shown in wireframe). A benefit of cut surfaces is that we can view data on (nearly) arbitrary surfaces. Thus, the structure of the dataset does not constrain how we view the data.

We can easily make multiple planar cuts through a structured grid dataset by specifying multiple isovalues for the cutting algorithm. Figure 6-32 shows 100 cut planes generated perpendicular to the camera's view plane normal. Rendering the planes from back to front with an opacity of 0.05 produces a simulation of volume rendering (see \"Volume Rendering\" in Chapter 7). Figure 6-32. 100 cut planes with opacity of 0.05. Rendered back-to-front to simulate volume rendering. See PseudoVolumeRendering.cxx and PseudoVolumeRendering.py.

This example illustrates that cutting the volumetric data in a structured grid dataset produced polygonal cells. Similarly, cutting polygonal data produces lines. Using a single plane equation, we can extract \"contour lines\" from a surface model defined with polygons. Figure 6-33 shows contours extracted from a surface model of the skin. At each vertex in the surface model we evaluate the equation of the plane and F(x.y.z) = c and store the value c of the function as a scalar value. Cutting the data with 46 isovalues from 1.5 to 136.5 produces contour lines that are 3 units apart. Figure 6-33. Cutting a surface model of the skin with a series of planes produces contour lines. Lines are wrapped with tubes for clarity. See CutWithScalars.cxx and CutWithScalars.py."},{"location":"VTKBook/06Chapter6/#66-putting-it-all-together","title":"6.6 Putting It All Together","text":""},{"location":"VTKBook/06Chapter6/#process-object-design","title":"Process Object Design","text":"

Algorithms are implemented in the Visualization Toolkit as process objects. These objects may be either sources, filters, or mappers (see \"The Visualization Pipeline\" in Chapter 4). In this section we will describe how these objects are implemented.

Source Design.

(a) Functional Model (b) Object Models Figure 6-34. Source object design. Example shown is a source object that creates a polygonal representation of a sphere.

Source objects have no visualization data for input and one or more outputs, Figure 6-34. To create a source object, inheritance is used to specify the type of dataset that the process object creates for output. vtkSphereSource. This class inherits from vtkPolyDataAlgorithm, indicating that it creates polygonal data on output.

Filter Design

Filter objects have one or more inputs and one or more outputs as shown in Figure 6-35. (You may also refer to \"Pipeline Design and Implementation\" in Chapter 4.) To create Figure 6-35 a filter object, inheritance is used to specify the type of input and output data objects. illustrates this for the concrete source object vtkContourFilter (which implements marching cubes and other contouring techniques). It is worth examining this object diagram in detail since it is the basis for the architecture of the visualization pipeline. (a) Functional Model (b) Object Models Figure 6-35. Filter object design. The example shown is for an object that receives a general dataset as input and creates polygonal data on output.

The superclasses of vtkContourFilter are vtkAlgorithm and vtkPolyDataAlgorithm. The class vtkPolyDataAlgorithm specifies the type of data vtkContourFilter produces on output (i.e., a vtkPolyData). Because this filter should take any subclass of vtkDataSet as input, it must override its superclasses implementation of the FillInputPortInformation() method to specify this. Note that inheritance from vtkPolyDataAlgorithm is optional---this functionality could be implemented directly in vtkContourFilter. This optional superclass is simply a convenience object to make class derivation a little easier.

What is left for vtkContourFilter to implement is its RequestData() method (as well as constructor, print method, and any other methods special to this class). Thus the primary difference between classes with equivalent inheritance hierarchies is the implementation of the RequestData() method.

Subclasses of vtkAlgorithm enforce filter input and output type by use of the FillInputPortInformation() and FillOutputPortInformation() methods. By default, its subclass [vtkDataSet](https://www.vtk.org/doc/nightly/html/classvtkDataSet.html#details)Algorithm accepts input type vtkDataSet (or subclasses) and produces a vtkDataSet on output. (The type of the output is determined by the type of the input.) Since vtkDataSet is a base class for all data types, subclasses of [vtkDataSet](https://www.vtk.org/doc/nightly/html/classvtkDataSet.html#details)Algorithm will accept any type as input. Specialized filters are derived from other classes. For example, filters that accept polygonal data might be derived from vtkPolyDataAlgorithm, and filters that accept unstructured grid datasets might be derived from vtkUnstructuredGridAlgorithm.

We encourage you to examine the source code carefully for a few filter and source objects.

The architecture is simple enough that you can grasp it quickly.

"},{"location":"VTKBook/06Chapter6/#mapper-design","title":"Mapper Design","text":"(a) Functional Models (b) Object Models Figure 6-36. Mapper object design. Graphics mapper shown (e.g., vtkPolyDataMapper) maps polygonal data through graphics library primitives. Writer shown (e.g., vtkSTLWriter) writes polygonal data to stereo lithography format.

Mapper objects have one or more inputs and no visualization data output, Figure 6-36. Two different types of mappers are available in the Visualization Toolkit : graphics mappers and writers. Graphics mappers interface geometric structure and data attributes to the graphics library; writers write datasets to disk or other I/O devices.

Since mappers take datasets as input, type enforcement is required. Each mapper implements this functionality directly. For example, both classes [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)Mapper and vtkSTLWriter implement a SetInput() method to enforce the input to be of type vtkPolyData. Other mappers and writers enforce input type as appropriate.

Although writers and mappers do not create visualization data, they both have methods similar to the RequestData() method of the sources and filters. Each subclass of vtkMapper must implement the Render() method. This method is exchanged by the graphics system actors and its associated mappers during the rendering process. The effect of the method is to map its input dataset to the appropriate rendering library/system. Subclasses of the class vtkWriter must implement the WriteData() method. This method causes the writer to write its input dataset to disk (or other I/O device).

"},{"location":"VTKBook/06Chapter6/#color-maps","title":"Color Maps","text":"

Color maps are created in the Visualization Toolkit using instances of the class vtkLookupTable. This class allows you to create a lookup table using HSVA (e.g., hue, saturation, value, and alpha opacity value) specification. Although we discussed the HSV color system in Chapter 3 - Computer Graphics Primer, we haven't yet defined alpha opacity. We shall do so in Chapter 7 - Advanced Computer Graphics, but until then consider the alpha value to be the opacity of an object. Alpha values of one indicate that the object is opaque, while alpha values of zero indicate that the object is transparent.

The procedure for generating lookup table entries is to define pairs of values for HSVA. These pairs define a linear ramp for hue, saturation, value, and opacity. When the Build() method is invoked, these linear ramps are used to generate a table with the number of table entries requested. Alternatively, vtkLookupTable also enables you to load colors directly into the table. Thus, you build custom tables that cannot be simply expressed as linear ramps of HSVA values. To demonstrate this procedure, we specify a starting and ending value for each of the components of HSVA, then we will create a rainbow lookup table from blue to red by using the following C++ code.

vtkLookupTable *lut = vtkLookupTable::New();\n  lut->SetHueRange(0.6667, 0.0);\n  lut->SetSaturationRange(1.0, 1.0);\n  lut->SetValueRange(1.0, 1.0);\n  lut->SetAlphaRange(1.0, 1.0);\n  lut->SetNumberOfColors(256);\n  lut->Build();\n

Since the default values for SaturationRange, ValueRange, AlphaRange, and the number of lookup table colors are (1,1), (1,1), (1,1), and 256, respectively, we can simplify this process to the following

vtkLookupTable *lut = vtkLookupTable::New();\n  lut->SetHueRange(0.6667, 0.0);\n  lut->Build();\n

(The default values for HueRange are (0.0, 0.6667) --- a red to blue color table.)

To build a black and white lookup table of 256 entries we use

vtkLookupTable *lut = vtkLookupTable::New();\n  lut->SetHueRange(0.0, 0.0);\n  lut->SetSaturationRange(0.0, 0.0);\n  lut->SetValueRange(0.0, 1.0)\n

In some cases you may want to specify colors directly. You can do this by specifying the number of colors, building the table, and then inserting new colors. When you insert colors, the RGBA color description system is used. For example, to create a lookup table of the three colors red, green, and blue, use the following C++ code.

vtkLookupTable *lut = vtkLookupTable::New();\n  lut->SetNumberOfColors(3);\n  lut->Build();\n  lut->SetTableValue(0, 1.0, 0.0, 0.0, 1.0);\n  lut->SetTableValue(0, 0.0, 1.0, 0.0, 1.0);\n  lut->SetTableValue(0, 0.0, 0.0, 1.0, 1.0);\n

Lookup tables in the Visualization Toolkit are associated with the graphics mappers. Mappers will automatically create a red to blue lookup table if no table is specified, but if you want to create your own, use the mapper->SetLookupTable(lut) operation where mapper is an instance of vtkMapper or its subclasses.

A few final notes on using lookup tables.

  • Mappers use their lookup table to map scalar values to colors. If no scalars are present, the mappers and their lookup tables do not control the color of the object. Instead the vtkProperty object associated with the vtkActor class does. Use vtkProperty's method actor->GetProperty()->SetColor(r,g,b) where r, g, and b are floating point values specifying color.

  • If you want to prevent scalars from coloring your object, use vtkMapper's method mapper->ScalarVisibilityOff() to turn off color mapping. Then the actor's color will control the color of the object.

  • The scalar range (i.e., the range into which the colors are mapped) is specified with the mapper. Use the method mapper->SetScalarRange(min, max).

You can also derive your own lookup table types. Look at vtkLogLookupTable for an example. This particular lookup table inherits from vtkLookupTable. It performs logarithmic mapping of scalar value to table entry, a useful capability when scalar values span many orders of magnitude.

"},{"location":"VTKBook/06Chapter6/#implicit-functions_1","title":"Implicit Functions","text":"Figure 6-37. Inheritance hierarchy of vtkImplicitFunction and subclasses.

As we have seen, implicit functions can be used for visualizing functions, creating geometry, and cutting or selecting datasets. VTK includes several implicit functions including a single plane (vtkPlane), multiple convex planes ([vtkPlane](https://www.vtk.org/doc/nightly/html/classvtkPlane.html#details)s), spheres (vtkSphere), cones (vtkCone), cylinders (vtkCylinder), and the general quadric (vtkQuadric). The class vtkImplicitBoolean allows you to create boolean combinations of these implicit function primitives. Other implicit functions can be added to VTK by deriving from the abstract base class vtkImplicitFunction.

The existing inheritance hierarchy for implicit functions is shown in Figure 6-37. Subclasses of vtkImplicitFunction must implement the two methods Evaluate() and Gradient(x). The method Evaluate() returns the value of the function at point (x,y,z), while the method Gradient() returns the gradient vector to the function at point (x,y,z)."},{"location":"VTKBook/06Chapter6/#contouring_1","title":"Contouring","text":"

Scalar contouring is implemented in the Visualization Toolkit with vtkContourFilter. This filter object accepts as input any dataset type. Thus, vtkContourFilter treats every cell type and each cell type must provide a method for contouring itself.

Contouring in VTK is implemented using variations of the marching cubes algorithm presented earlier. That is, a contour case table is associated with each cell type, so each cell will generate contouring primitives as appropriate. For example, the tetrahedron cell type implements \"marching tetrahedron\" and creates triangle primitives, while the triangle cell type implements \"marching triangles\" and generates lines segments.

The implication of this arrangement is that vtkContourFilter will generate point, line, and surface contouring primitives depending on the combination of input cell types. Thus vtkContourFilter is completely general. We have created another contour filter, vtkMarchingCubes, that is specific to the dataset type image data (in particular, 3D volumes). These two filters allow us to compare (at least for this one algorithm) the cost of generality.

Recall from \"Generality Versus Efficiency\" the issues regarding the trade-offs between general and specific algorithms. Figure 6-38 shows a comparison of CPU times for a volume dataset at, 64 \\times 64 \\times 93, and resolution 128 \\times 128 \\times 93. The volume is a CT dataset of a human head. Three cases were run. In the first case the vtkMarchingCubes object was used. The output of this filter is triangles plus point normals. In the second case, vtkContourFilter was run. The output of this filter is just triangles. In the last case, vtkContourFilter was combined with vtkPolyDataNormals (to generate point normals). The output of the combined filters is also triangles plus point normals.

The execution times are normalized to the smallest dataset using the vtkMarchingCubes object. The results are clear: The specific object outperforms the general object by a factor of 1.4 to 7, depending on data size and whether normals are computed. The larger differences occur on the smaller datasets. This is because the ratio of voxel cells containing the isosurface to the total number of voxels is larger for smaller datasets. (Generally the total number of voxels increases as the resolution cubed, while the voxels containing the isosurface increase as the resolution squared.) As a result, more voxels are processed in the smaller datasets relative to the total number of voxels than in the larger datasets. When the datasets become larger, more voxels are \"empty\" and are not processed.

Although these results do not represent all implementations or the behavior of other algorithms, they do point to the cost of generality. Of course, there is a cost to specialization as well. This cost is typically in programmer time, since the programmer must rewrite code to adapt to new circumstances and data. Like all trade-offs, resolution of this issue requires knowledge of the application.

Figure 6-38. The cost of generality. Isosurface generation of three volumes of different sizes are compared. The results show normalized execution times for two different implementations of the marching cubes isosurface algorithm. The specialized filter is vtkMarchingCubes. The general algorithms are first vtkContourFilter and then in combination with vtkPolyDataNormals.

An example use of vtkContourFilter is shown in Figure 6-39. This example is taken from Figure4-1, which is a visualization of a quadric function. The class vtkSampleFunction samples the implicit quadric function using the vtkQuadric class. Although vtkQuadric does not participate in the pipeline in terms of data flow, it is used to define and evaluate the quadric function. It is possible to generate one or more isolines/isosurfaces simultaneously using vtkContourFilter. As Figure 6-39 shows, we use the GenerateValues() method to specify a scalar range, and the number of contours within this range (including the initial and final scalar values). vtkContourFilter generates duplicate vertices, so we can use vtkCleanPolyData to remove them. To improve the rendered appearance of the isosurface, we use vtkPolyDataNormals to create surface normals. (We describe normal generation in Chapter 9 - Advanced Algorithms.)

// Define implicit function\nvtkQuadric *quadric = vtkQuadric::New();\n  quadric->SetCoefficients(.5,1,.2,0,.1,0,0,.2,0,0);\nvtkSampleFunction *sample = vtkSampleFunction::New();\n  sample->SetSampleDimensions(50,50,50);\n  sample->SetImplicitFunction(quadric);\nvtkContourFilter *contour = vtkContourFilter::New();\n  contour->SetInputConnection(sample->GetOutputPort());\n  contour->GenerateValues(5,0,1.2);\nvtkPolyDataMapper *contourMapper = vtkPolyDataMapper::New();\n  contourMapper->SetInputConnection( contour->GetOutputPort());\n  contourMapper->SetScalarRange(0,1.2);\nvtkActor *contourActor = vtkActor::New();\n  contourActor->SetMapper(contourMapper);\n// Create outline\nvtkOutlineFilter *outline = vtkOutlineFilter::New();\n  outline->SetInputConnection(sample->GetOutputPort());\nvtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\nvtkActor *outlineActor = vtkActor::New();\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(0,0,0);\n
Figure 6-39. Contouring quadric function. Pipeline topology, C++ code, and resulting image are shown. See ContourQuadric.cxx and ContourQuadric.py. Figure 6-40. Data flow into and out of the vtkGlyph3D class."},{"location":"VTKBook/06Chapter6/#cutting_1","title":"Cutting","text":"

vtkCutter performs cutting of all VTK cell types. The SetValue() and GenerateValues() methods permit the user to specify which multiple scalar values to use for the cutting. vtkCutter requires an implicit function that will be evaluated at each point in the dataset. Then each cell is cut using the cell's Contour method. Any point attributes are interpolated to the resulting cut vertices. The sorting order for the generated polygonal data can be controlled with the SortBy method. The default sorting order, SortByValue(), processes cells in the inner loop for each contour value. SortByCell() processes the cutting value in the inner loop and produces polygonal data that is suitable for back to front rendering (see Figure 6-32). (The sorting order is useful when rendering with opacity as discussed in Chapter 7 - Advanced Computer Graphics.) Notice the similarity of this filter to the vtkContourFilter. Both of these objects contour datasets with multiple isovalues. vtkCutter uses an implicit function to calculate scalar values while vtkContourFilter uses the scalar data associated with the dataset's point data."},{"location":"VTKBook/06Chapter6/#glyphs_1","title":"Glyphs","text":"

The vtkGlyph3D class provides a simple, yet powerful glyph capability in the Visualization Toolkit. vtkGlyph3D is an example of an object that takes multiple inputs (Figure 6-40). One input, specified with the SetInputConnection() method, defines a set of points and possible attribute data at those points. The second input, specified with the SetSourceConnection() method, defines a geometry to be copied to every point in the input dataset. The source is of type vtkPolyData. Hence, any filter, sequence of filters creating polygonal data, or a polygonal dataset may be used to describe the glyph's geometry.

The behavior of an instance of vtkGlyph3D depends on the nature of the input data and the value of its instance variables. Generally, the input Source geometry will be copied to each point of the Input dataset. The geometry will be aligned along the input vector data and scaled according to the magnitude of the vector or the scalar value. In some cases, the point normal is used rather than the vector. Also, scaling can be turned on or off.

We saw how to use vtkGlyph3D in the example given in Figure4--20. Cones were used as the glyph and were located at each point on the sphere, oriented along the sphere's surface normal.

Figure 6-41. Inheritance hierarchy for vtkStreamer and subclasses."},{"location":"VTKBook/06Chapter6/#streamlines_1","title":"Streamlines","text":"

Streamlines and particle motion require numerical integration to guide a point through the vector field. Vector visualization algorithms that we will see in later chapters also require numerical integration. As a result, we designed an object hierarchy that isolates the numerical integration process into a single base class. The base class is vtkStreamer and it is responsible for generating a particle path through a vector field of specified length (expressed as elapsed time). Each derived class of vtkStreamer takes advantage of this capability to move through the vector field but implements its own particular representational technique to depict particle motion. Streamlines (vtkStreamLine) draw connected lines while particle motion is shown by combining the output of vtkStreamPoints with the vtkGlyph3D object. Using vtkGlyph3D we can place spheres or oriented objects such as cones or arrows at points on the particle path created by vtkStreamPoints. The inheritance hierarchy for vtkStreamer and subclasses is shown in Figure 6-41.

The integration method in vtkStreamer is implemented as a virtual function. Thus it can be overloaded as necessary. Possible reasons for overloading include implementing an integration technique of higher or lower accuracy, or creating a technique specialized to a particular dataset type. For example, the search process in a volume is much faster than it is for other dataset types, therefore, highly efficient vector integration techniques can be constructed.

The vector integration technique in VTK will accommodate any cell type. Thus, integration through cells of any topological dimension is possible. If the cells are of topological dimension 2 or less, the integration process constrains particle motion to the surface (2D) or line (1D). The particle may only leave a cell by passing through the cell boundary, and traveling to a neighboring cell, or exiting the dataset.

"},{"location":"VTKBook/06Chapter6/#abstract-filters","title":"Abstract Filters","text":"

Attribute transformations create or modify data attributes without changing the topology or geometry of a dataset. Hence filters that implement attribute transformation (e.g., vtkElevationFilter) can accept any dataset type as input, and may generate any dataset type on output. Unfortunately, because filters must specialize the particular type of data they output, at first glance it appears that filters that create general dataset types on output are not feasible. This is because the type vtkDataSet is an abstract type and must be specialized to allow instantiation.

Fortunately, there is a a solution to this dilemma. The solution is to use the \"virtual constructor\" NewInstance(). Although C++ does not allow virtual constructors, we can simulate it by creating a special virtual function that constructs a copy of the object that it is invoked on. For example, if this function is applied to a dataset instance of type vtkPolyData, the result will be a copy of that instance (Figure 6-42). (Note that we use reference counting to make copies and avoid duplicating memory.) The virtual constructor function NewInstance() is implemented in a number of VTK classes including datasets and cells. Figure 6-42. Depiction of data flow for abstract filter output. The output object type is the same as the input type.

Using the virtual constructor we can construct filters that output abstract data types like vtkDataSet. We simply apply NewInstance() to the input of the filter. This will then return a pointer to a concrete object that is the output of the filter. The result is a general filter object that can accept any dataset type for input and creates the general vtkDataSet type as output. In VTK, this functionality has been implemented in the abstract class vtkDataSetAlgorithm.

There are other filters that implement variations of this delegation technique. The class vtkPointSetAlgorithm is similar to vtkDataSetAlgorithm. This class takes as input any dataset whose geometry is explicitly defined via an instance of vtkPoints (or subclass), and generates on output an object of the same type (i.e., vtkPointSet). The class vtkMergeFilter combines dataset structure and point attributes from one or more input datasets. For example, you can read multiple files and combine the geometry/topology from one file with different scalars, vectors, and normals from other files.

One difficulty using abstract filter types is that the output type may not match with the input type of a downstream filter. For example, the output of vtkElevationFilter is specified as vtkDataSet even though the input may be of type vtkPolyData, and we know from the previous discussion that the actual output type will be vtkPolyData. This difficulty is removed by using the filter vtkCastToConcrete, which allows you to runtime cast to the appropriate output type. In this case we would use the GetPolyDataOutput() from vtkCastToConcrete. After checking the validity of the cast, this method returns a dataset cast to vtkPolyData. Of course, this process requires that the input to vtkCastToConcrete be set before the output is requested.

"},{"location":"VTKBook/06Chapter6/#visualizing-blood-flow","title":"Visualizing Blood Flow","text":"

In this example we'll combine a few different techniques to visualize blood flow in the human carotid arteries. Our data contains both vectors that represent the velocity of blood and scalars that are proportional to the magnitude of the velocity (i.e., speed).

We can provide context for the visualization by creating an isosurface of speed. This isosurface shows regions of fastest blood flow, and is similar to, but not the same as, the actual surface of the arteries. However, it provides us with a visual cue to the structure of the arteries. The first vector visualization technique we'll use is to generate vector glyphs (Unfortunately, we cannot just create glyphs at each point because of the number of points (over 167,000 points). To do so would result in a confusing mess, and the interactive speed would be poor. Instead, we'll use two filters to select a subset of the available points. These filters are vtkThresholdPoints and vtkMaskPoints.

vtkThresholdPoints allows us to extract points that satisfy a certain threshold criterion. In our example, we choose points whose speed is greater than a specified value. This eliminates a large number of points, since most points lie outside the arteries and have a small speed value.

The filter vtkMaskPoints allows us to select a subset of the available points. We specify the subset with the OnRatio instance variable. This instance variable indicates that every OnRatio point is to be selected. Thus, if the OnRatio is equal to one, all points will be selected, and if the OnRatio is equal to ten, every tenth point will be selected. This selection can be either uniform or random. Random point selection is set using the RandomModeOn() and RandomModeOff() methods.

After selecting a subset of the original points, we can use the vtkGlyph3D filter in the usual way. A cone's orientation indicates blood flow direction, and its size and color correspond to the velocity magnitude. Figure 6-43 shows the pipeline, sample code, and a resulting image from this visualization. Note that we've implemented the example using the interpreted language Tcl. See Chapter 11 - Visualization on the Web if you want more information about Tcl.

In the next part of this example we'll generate streamtubes of blood velocity. Again we use an isosurface of speed to provide us with context. The starting positions for the streamtubes were determined by experimenting with the data. Because of the way the data was measured and the resolution of the velocity field, many streamers travel outside the artery. This is because the boundary layer of the blood flow is not captured due to limitations in data resolution. Consequently, as the blood flows around curves, there is a component of the velocity field that directs the streamtube outside the artery. As a result it is hard to find starting positions for the streamtubes that yield interesting results. We use the source object vtkPointSource in combination with vtkThresholdPoints to work around this problem. vtkPointSource generates random points centered around a sphere of a specified radius. We need only find an approximate position for the starting points of the streamtubes and then generate a cloud of random seed points. vtkThresholdPoints is used to cull points that may be generated outside the regions of high flow velocity.

Figure 6-44 shows the pipeline, sample Tcl code, and a resulting image from the visualization. Notice that the isosurface is shown in wireframe. This provides context, yet allows us to see the streamtubes within the isosurface.

vtkStructuredPointsReader reader\n reader SetFileName \"$env(VTK_TEXTBOOK_DATA)/carotid.vtk\"\nvtkThresholdPoints threshold\n  threshold SetInputConnection [reader GetOutputPort]\n  threshold ThresholdByUpper 200\nvtkMaskPoints mask\n  mask SetInputConnection [Threshold GetOutputPort]\n  mask SetOnRatio 10\nvtkConeSource cone\n  cone SetResolution 3\n  cone SetHeight 1\n  cone SetRadius 0.25\nvtkGlyph3D cones\n  cones SetInputConnection [mask GetOutputPort]\n  cones SetSourceConnection [cone GetOutputPort]\n  cones SetScaleFactor 0.5\n  cones SetScaleModeToScaleByVector\nvtkLookupTable lut\n  lut SetHueRange.667 0.0\n  lut Build\nvtkPolyDataMapper vecMapper\n  vecMapper SetInputConnection [cones GetOutputPort]\n  vecMapper SetScalarRange 2 10\n  vecMapaper SetLookupTable lut\n
Figure 6-43. Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude. See CarotidFlowGlyphs.cxx and CarotidFlowGlyphs.py. Figure 6-44. Visualizing blood flow in the human carotid arteries. Streamtubes of flow vectors (streamV.tcl). See CarotidFlow.cxx and CarotidFlow.py."},{"location":"VTKBook/06Chapter6/#67-chapter-summary","title":"6.7 Chapter Summary","text":"

Visualization algorithms transform data from one form to another. These transformations can change or create new structure and/or attributes of a dataset. Structural transformations change either the topology or geometry of a dataset. Attribute transformations change dataset attributes such as scalars, vectors, normals, or texture coordinates.

Algorithms are classified according to the type of data they operate on. Scalar, vector, and tensor algorithms operate on scalar, vector, and tensor data, respectively. Modelling algorithms operate on dataset geometry or topology, texture coordinates, or normals. Modelling algorithms also may include complex techniques that may represent combinations of different data types.

Algorithms can be designed and implemented for general types of data or specialized for a specific type. General algorithms are typically less efficient than their specialized counterparts. Conversely, general algorithms are more flexible and do not require rewriting as new dataset types are introduced.

Important scalar algorithms include color mapping and contouring. Color maps are used to map scalar values to color values. Contouring algorithms create isosurfaces or isolines to indicate areas of constant scalar value.

Glyphs such as hedgehogs are useful for visualizing vector data. These techniques are limited by the number of glyphs that can be displayed at one time. Particle traces or streamlines are another important algorithm for vector field visualization. Collections of particle traces can convey something of the structure of a vector field.

Real, symmetric tensors 3 \\times 3 can be characterized by their eigenvalues and eigenvectors.

Tensors can be visualized using tensor ellipsoids or oriented axes.

Implicit functions and sampling techniques can be used to make geometry, cut data, and visualize complex mathematical descriptions. Glyphs are objects whose appearance is associated with a particular data value. Glyphs are flexible and can be created to visualize a variety of data.

"},{"location":"VTKBook/06Chapter6/#68-bibliographic-notes","title":"6.8 Bibliographic Notes","text":"

Color mapping is a widely studied topic in imaging, computer graphics, visualization, and human factors. References [Durrett87] [Ware88] [Rheingans92] provide samples of the available literature. You also may want to learn about the physiological and psychological effects of color on perception. The text by Wyszecki and Stiles [Wyszecki82] serves as an introductory reference.

Contouring is a widely studied technique in visualization because of its importance and popularity. Early techniques were developed for 2D data [Watson92]. Three-dimensional techniques were developed initially as contour connecting methods [Fuchs77] --- that is, given a series of 2D contours on evenly spaced planes, connect the contours to create a closed surface. Since the introduction of marching cubes [Lorensen87], many other techniques have been implemented. (A few of these include [Nielson91] [Montani94] and [Durst88]). A particularly interesting reference is given by Livnat et al. [Livnat96]. They show a contouring method with the addition of a preprocessing step that generates isocontours in near optimal time.

Although we barely touched the topic, the study of chaos and chaotic vibrations is a delightfully interesting topic. Besides the original paper by Lorenz [Lorenz63], the book by Moon [Moon87] is a good place to start.

Two- and three-dimensional vector plots have been used by computer analysts for many years [Fuller80]. Streamlines and streamribbons also have been applied to the visualization of complex flows [Volpe89]. Good general references on vector visualization techniques are given in [Helman90] and [Richter90].

Tensor visualization techniques are relatively few in number. Most techniques are glyph oriented [Haber90] [deLeeuw93]. We will see a few more techniques in Chapter 9 - Advanced Algorithms.

Blinn [Blinn82], Bloomental [Bloomenthal88] [Bloomenthal97] and Wyvill [Wyvill86] have been important contributors to implicit modeling. Implicit modeling is currently popular in computer graphics for modeling \"soft\" or \"blobby\" objects. These techniques are simple, powerful, and are becoming widely used for advanced computer graphics modeling.

"},{"location":"VTKBook/06Chapter6/#69-references","title":"6.9 References","text":"

[Abraham85] R. H. Abraham and Christopher D. Shaw. Dynamics The Geometry of Behavior. Aerial Press, Santa Cruz, CA, 1985.

[Blinn82] J. F. Blinn. \"A Generalization of Algebraic Surface Drawing.\" ACM Transactions on Graphics. 1(3):235--256, July 1982.

[Bloomenthal88] J. Bloomenthal. \"Polygonization of Implicit Surfaces.\" Computer Aided Geometric Design . 5(4):341--355, November 1982.

[Bloomenthal97] J. Bloomenthal, editor. Introduction to Implicit Surfaces. Morgan Kaufmann Publishers, Inc., San Francisco, CA., 1997.

[Chernoff73] H. Chernoff. \"Using Faces to Represent Points in K-Dimensional Space Graphically.\" J. American Statistical Association. 68:361--368, 1973.

[Cline93] H. Cline, W. Lorensen, and W. Schroeder. \"3D Phase Contrast MRI of Cerebral Blood Flow and Surface Anatomy.\" Journal of Computer Assisted Tomography. 17(2):173--177, March/April 1993.

[Conte72] S. D. Conte and C. de Boor. Elementary Numerical Analysis. McGrawHill Book Company, 1972.

[deLeeuw93]. W. C. de Leeuw and J. J. van Wijk. \"A Probe for Local Flow Field Visualization.\" In Proceedings of Visualization '93. pp. 39--45, IEEE Computer Society Press, Los Alamitos, CA, 1993.

[Delmarcelle95] T. Delmarcelle and L. Hesselink. \"A Unified Framework for Flow Visualization.\" In Computer Visualization Graphics Techniques for Scientific and Engineering Analysis*. R. S. Gallagher, ed. CRC Press, Boca Raton, FL, 1995.

[Durrett87] H. J. Durrett, ed. Color and the Computer. Academic Press, Boston, MA, 1987.

[Durst88] M. J. Durst. \"Additional Reference to Marching Cubes.\" Computer Graphics. 22(2):72--73, 1988.

[Fuchs77] H. Fuchs, Z. M. Kedem, and S. P. Uselton. \"Optimal Surface Reconstruction from Planar Contours.\" Communications of the ACM. 20(10):693--702, 1977.

[Fuller80]cA. J. Fuller and M.L.X. dosSantos. \"Computer Generated Display of 3D Vector Fields.\" Computer Aided Design. 12(2):61--66, 1980.

[Haber90] R. B. Haber and D. A. McNabb. \"Visualization Idioms: A Conceptual Model to Scientific Visualization Systems.\" Visualization in Scientific Computing, G. M. Nielson, B. Shriver, L. J. Rosenblum, ed. IEEE Computer Society Press, pp. 61--73, 1990.

[Helman90] J. Helman and L. Hesselink. \"Representation and Display of Vector Field Topology in Fluid Flow Data Sets.\" Visualization in Scientific Computing. G. M. Nielson, B. Shriver, L. J. Rosenblum, eds. IEEE Computer Society Press, pp. 61--73, 1990.

[Livnat96] Y. Livnat, H. W. Shen, C. R. Johnson. \"A Near Optimal Isosurface Extraction Algorithm for Structured and Unstructured Grids.\" IEEE Transactions on Visualization and Computer Graphics. Vol. 2, No. 1, March 1996.

[Lorensen87] W. E. Lorensen and H. E. Cline. \"Marching Cubes: A High Resolution 3D Surface Construction Algorithm.\" Computer Graphics. 21(3):163--169, July 1987.

[Lorenz63] E. N. Lorenz. \"Deterministic NonPeriodic Flow.\" Journal of Atmospheric Science. 20:130--141, 1963.

[Montani94]cC. Montani, R. Scateni, and R. Scopigno. \"A Modified LookUp Table for Implicit Disambiguation of Marching Cubes.\" Visual Computer . (10):353--355, 1994.

[Moon87] F. C. Moon. Chaotic Vibrations . WileyInterscience, New York, NY, 1987.

[Nielson91] G. M. Nielson and B. Hamann. \"The Asymptotic Decider: Resolving the Ambiguity in Marching Cubes.\" In Proceedings of Visualization '91. pp. 83--91, IEEE Computer Society Press, Los Alamitos, CA, 1991.

[Rheingans92] P. Rheingans. \"Color, Change, and Control for Quantitative Data Display.\" In Proceedings of Visualization '92. pp. 252--259, IEEE Computer Society Press, Los Alamitos, CA, 1992.

[Richter90] R. Richter, J. B. Vos, A. Bottaro, and S. Gavrilakis. \"Visualization of Flow Simulations.\" Scientific Visualization and Graphics Simulation. D. Thalmann editor, pp. 161--171, John Wiley and Sons, 1990.

[Saada74] A. S. Saada. Elasticity Theory and Applications. Pergamon Press, Inc., New York, NY, 1974.

[Timoshenko70] S. P. Timoshenko and J. N. Goodier. Theory of Elasticity, 3d Edition. McGrawHill Book Company, New York, NY, 1970.

[Tufte83] E. R. Tufte. The Visual Display of Quantitative Information. Graphics Press, Cheshire, CT, 1990.

[Volpe89] G. Volpe. \"Streamlines and Streamribbons in Aerodynamics.\" Technical Report AIAA-89-0140, 27th Aerospace Sciences Meeting, 1989.

[Ware88] C. Ware. \"Color Sequences for Univariate Maps: Theory, Experiments and Principles.\" IEEE Computer Graphics and Applications. 8(5):41--49, 1988.

[Watson92] D. F. Watson. Contouring: A Guide to the Analysis and Display of Spatial Data. Pergamon Press, 1992.

[Wyszecki82] G. Wyszecki and W. Stiles. Color Science: Concepts and Methods, Quantitative Data and Formulae. John Wiley and Sons, 1982.

[Wyvill86] G. Wyvill, C. McPheeters, B. Wyvill. \"Data Structure for Soft Objects.\" Visual Computer. 2(4):227--234, 1986.

"},{"location":"VTKBook/06Chapter6/#610-exercises","title":"6.10 Exercises","text":"

6.1 Sketch contour cases for marching triangles. How many cases are there?

6.2 Sketch contour cases for marching tetrahedron. How many cases are there?

6.3 A common visualization technique is to animate isosurface value. The procedure is to smoothly vary isosurface value over a specified range.

a) Create an animation sequence for the quadric example (Figure4--1).

b) Create an animation sequence for the head sequence (Figure 6-11 (b)).

6.4 Marching Cubes visits each cell during algorithm execution. Many of these cells do not contain the isosurface. Describe a technique to improve the performance of isosurface extraction by eliminating visits to cells not containing isosurface. (Hint: use a preprocessing step to analyze data. Assume that many isosurfaces will be extracted and that the preprocessing step will not count against execution time.)

6.5 Scanline rasterization proceeds along horizontal spans in graphics hardware (see \"Rasterization\" in Chapter 3). Interpolation of color occurs along horizontal spans as well.

a) Show how the orientation of a polygon affects interpolated color.

b) Discuss potential problems caused by orientation dependent viewing of visualizations.

6.6 Write a program to simulate beam vibration. Use the code associated with Figure 6-14 (a) as your starting point.

6.7 Using the filters vtkStreamLine, vtkMaskPoints, and vtkGlyph3D, create a visualization consisting of oriented glyphs along a streamline.

6.8 Visualize the following functions.

a) Scalar S(x,y,z)=sin(xy) for x,y, between 0 and \\pi.

b) The effective stress field (a scalar field) from Figure 6-21.

c) The vector field described in the combustor data (i.e., combq.bin and combxyz.bin).

6.9 Tensor ellipsoids are based on an ellipsoidal glyph. Describe two other glyphs that you might use.

6.10 Write a source object to generate a polygonal representation of a torus.

6.11 Design a glyph to convey airplane heading, speed, and altitude, and proximity (i.e., distance) to other planes.

6.12 Morphing is a process to smoothly blend images (2D) or geometry (3D) between two known images or geometry. Using an implicit modeling approach, how would you morph a torus into a cube?

6.13 Describe a technique to visualize vector information by animating a color map. ( Hint: By choosing a map carefully, you can give the illusion of motion across a surface.)

6.14 Isoline contours of different values are typically shown together in one image.

a) Describe the advantages and disadvantages of displaying isosurfaces simultaneously.

b) What two graphics properties might you adjust to improve the display of multiple isosurefaces?

6.15 Describe a parallel algorithm for marching cubes. Use a parallel architecture of your choice.

6.16 Decomposition can greatly increase the speed of an operation.

a) Prove that 3D Gaussian smoothing can be decomposed into three 1D operations.

b) Give the complexity of the decomposed filter and the same filter implemented as a 3D convolution.

c) Under what conditions can constant smoothing be decomposed into 1D operations.

LocalWords: TensorAxes TensorEllipsoids catchall tkMarchingCubes dosSantos LocalWords: tkContourFilter

"},{"location":"VTKBook/07Chapter7/","title":"Chapter 7 - Advanced Computer Graphics","text":"

Chapter 3 introduced fundamental concepts of computer graphics. A major topic in that chapter was how to represent and render geometry using surface primitives such as points, lines, and polygons. In this chapter our primary focus is on volume graphics. Compared to surface graphics, volume graphics has a greater expressive range in its ability to render inhomogeneous materials, and is a dominant technique for visualizing 3D image (volume) datasets.

We begin the chapter by describing two techniques that are important to both surface and volume graphics. These are simulating object transparency using simple blending functions, and using texture maps to add realism without excessive computational cost. We also describe various problems and challenges inherent to these techniques. We then follow with a focused discussion on volume graphics, including both object-order and image-order techniques, illumination models, approaches to mixing surface and volume graphics, and methods to improve performance. Finally, the chapter concludes with an assortment of important techniques for creating more realistic visualizations. These techniques include stereo viewing, anti-aliasing, and advanced camera techniques such as motion blur, focal blur, and camera motion.

"},{"location":"VTKBook/07Chapter7/#71-transparency-and-alpha-values","title":"7.1 Transparency and Alpha Values","text":"

Up to this point in the text we have focused on rendering opaque objects --- that is, we have assumed that objects reflect, scatter, or absorb light at their surface, and no light is transmitted through to their interior. Although rendering opaque objects is certainly useful, there are many applications that can benefit from the ability to render objects that transmit light. One important application of transparency is volume rendering, which we will explore in greater detail later in the chapter. Another simple example makes objects translucent so that we can see inside of the region bounded by the surface, as shown in Figure 12-4). As demonstrated in this example, by making the skin semi-transparent, it becomes possible to see the internal organs.

Transparency and its complement, opacity, are often referred to as alpha in computer graphics. For example, a polygon that is 50 percent opaque will have an alpha value of 0.5 on a scale from zero to one. An alpha value of one represents an opaque object and zero represents a completely transparent object. Frequently, alpha is specified as a property for the entire actor, but it also can be done on a vertex basis just like colors. In such cases, the RGB specification of a color is extended to RGBA where A represents the alpha component. On many graphics cards the frame buffer can store the alpha value along with the RGB values. More typically, an application will request storage for only red, green, and blue on the graphics card and use back-to-front blending to avoid the need for storing alpha.

Unfortunately, having transparent actors introduces some complications into the rendering process. If you think back to the process of ray tracing, viewing rays are projected from the camera out into the world, where they intersect the first actor they come to. With an opaque actor, the lighting equations are applied and the resulting color is drawn to the screen. With a semi-transparent actor we must solve the lighting equations for this actor, and then continue projecting the ray farther to see if it intersects any other actors. The resulting color is a composite of all the actors it has intersected. For each surface intersection this can be expressed as Equation7-1.

\\begin{eqnarray*} R &=& (1 - A_s) R_b + A_s R_s \\\\ G &=& (1 - A_s) G_b + A_s G_s \\\\ B &=& (1 - A_s) B_b + A_s B_s \\\\ A &=& (1 - A_s) A_b + A_s \\end{eqnarray*} \\bf\\tag{7-1}

In this equation subscript s refers to the surface of the actor, while subscript b refers to what is behind the actor. The term is called-- the transmissivity, and represents the amount of light that is transmitted through the actor. As an example, consider starting with three polygons colored red, green, and blue each with a transparency of 0.5. If the red polygon is in the front and the background is black, the resulting RGBA color will be (0.4, 0.2, 0.1, 0.875) on a scale from zero to one (Figure 7-1).

It is important to note that if we switch the ordering of the polygons, the resulting color will change. This underlies a major technical problem in using transparency. If we ray-trace a scene, we will intersect the surfaces in a well-defined manner --- from front to back. Using this knowledge we can trace a ray back to the last surface it intersects, and then composite the color by applying Equation7-1 to all the surfaces in reverse order (i.e., from back to front). In object order rendering methods, this compositing is commonly supported in hardware, but unfortunately we are not guaranteed to render the polygons in any specific order. Even though our polygons are situated as in Figure 7-1, the order in which the polygons are rendered might be the blue polygon, followed by the red, and finally the green polygon. Consequently, the resulting color is incorrect.

If we look at the RGBA value for one pixel we can see the problem. When the blue polygon is rendered, the frame buffer and z-buffer are empty, so the RGBA quad (0,0,0.8,0.5) is stored along with the its z-buffer value. When the red polygon is rendered, a comparison of its z-value and the current z-buffer indicates that it is in front of the previous pixel entry. So Equation 7-1 is applied using the frame buffer's RGBA value. This results in the RGBA value (0.4,0,0.2,0.75) being written to the buffer. Now, the green polygon is rendered and the z comparison indicates that it is behind the current pixel's value. Again this equation is applied, this time using the frame buffer's RGBA value for the surface and the polygon's values from behind. This results in a final pixel color of (0.3,0.2, 0.175,0.875), which is different from what we previously calculated. Once the red and blue polygons have been composited and written to the frame buffer, there is no way to insert the final green polygon into the middle where it belongs.

Figure7-1. Physical generation of an image.

One solution to this problem is to sort the polygons from back to front and then render them in this order. Typically, this must be done in software requiring additional computational overhead. Sorting also interferes with actor properties (such as specular power), which are typically sent to the graphics engine just before rendering the actor's polygons. Once we start mixing up the polygons of different actors, we must make sure that the correct actor properties are set for each polygon rendered.

Another solution is to store more than one set of RGBAZ values in the frame buffer. This is costly because of the additional memory requirements, and is still limited by the number of RGBAZ values you can store. Some new techniques use a combination of multiple RGBAZ value storage and multi-pass rendering to yield correct results with a minimum performance hit [Hodges92].

The second technical problem with rendering transparent objects occurs less frequently, but can still have disastrous effects. In certain applications, such as volume rendering, it is desirable to have thousands of polygons with small alpha values. If the RGBA quad is stored in the frame buffer as four eight-bit values, then the round-off can accumulate over many polygons, resulting in gross errors in the output image. This may be less of a problem in the future if graphics hardware begins to store 16 or more bits per component for texture and the frame buffer.

"},{"location":"VTKBook/07Chapter7/#72-texture-mapping","title":"7.2 Texture Mapping","text":"

Texture mapping is a technique to add detail to an image without requiring modelling detail. Texture mapping can be thought of as pasting a picture to the surface of an object. The use of texture mapping requires two pieces of information: a texture map and texture coordinates. The texture map is the picture we paste, and the texture coordinates specify the location where the picture is pasted. More generally, texture mapping is a table lookup for color, intensity, and/or transparency that is applied to an object as it is rendered. Textures maps and coordinates are most often two-dimensional, but three-dimensional texture maps and coordinates are supported by most new graphics hardware.

The value of texture mapping can be shown through the simple example of rendering a wooden table. The basic geometry of a table can be easily created, but achieving the wood grain details is difficult. Coloring the table brown is a good start, but the image is still unrealistic. To simulate the wood grain we need to have many small color changes across the surface of the table. Using vertex colors would require us to have millions of extra vertices just to get the small color changes. The solution to this is to apply a wood grain texture map to the original polygons. This is like applying an oak veneer onto inexpensive particle board, and this is the strategy used by video games to provide realistic scenes with low numbers of polygons for interactivity.

There are several ways in which we can apply texture data. For each pixel in the texture map (commonly called a texel for texture element), there may be one to four components that affect how the texture map is pasted onto the surface of the underlying geometry. A texture map with one component is called an intensity map. Applying an intensity map results in changes to the intensity (or value in HSV) of the resulting pixels. If we took a gray scale image of wood grain, and then texture-mapped it onto a brown polygon, we would have a reasonable looking table. The hue and saturation of the polygon would still be determined by the brown color, but the intensity would be determined from the texture map. A better looking table could be obtained by using a color image of the wood. This is a three component texture map, where each texel is represented as a RGB trip-let. Using an RGB map allows us to obtain more realistic images, since we would have more than just the intensity changes of the wood.

By adding alpha values to an intensity map we get two components. We can do the same to an RGB texture map to get a four component RGBA texture map. In these cases, the alpha value can be used to make parts of the underlying geometry transparent. A common trick in computer graphics is to use RGBA textures to render trees. Instead of trying to model the complex geometry of a tree, we just render a rectangle with an RGBA texture map applied to it. Where there are leaves or branches, the alpha is one, where there are gaps and open space, the alpha is zero. As a result, we can see through portions of the rectangle, giving the illusion of viewing through the branches and leaves of a tree.

Besides the different ways in which a texture map can be defined, there are options in how it interacts with the original color of the object. A common option for RGB and RGBA maps is to ignore the original color; that is, just apply the texture color as specified. Another option is to modulate the original color by the texture map color (or intensity) to produce the final color.

While we have been focusing on 2D texture maps, they can be of any dimension, though the most common are 2D and 3D. Three-dimensional texture maps are used for textures that are a function of 3D space, such as wood grain, stone, or X-ray intensity (i.e., CT scan). In fact, a volumetric dataset is essentially a 3D texture. We can perform high-speed volume rendering by passing planes through a 3D texture and compositing them using translucent alpha values in the correct order.

Figure7-2. Vertex texture coordinates.

Techniques for performing volume rendering using texture mapping hardware will be discussed later in this chapter.

A fundamental step in the texture mapping process is determining how to map the texture onto the geometry. To accomplish this, each vertex has an associated texture coordinate in addition to its position, surface normal, color, and other point attributes. The texture coordinate maps the vertex into the texture map as shown in Figure 7-2. The texture coordinate system uses the parameters (u,v) and (u,v,t) or equivalently (r,s) or (r,s,t) for specifying 2D and 3D texture values. Points between the vertices are linearly interpolated to determine texture map values.

Another approach to texture mapping uses procedural texture definitions instead of a texture map. In this approach, as geometry is rendered, a procedure is called for each pixel to calculate a texel value. Instead of using the (u,v,t) texture coordinates to index into an image, they are passed as arguments to the procedural texture that uses them to calculate its result. This method provides almost limitless flexibility in the design of a texture; therefore, it is almost impossible to implement in dedicated hardware. Most commonly, procedural textures are used with software rendering systems that do not make heavy use of existing graphics hardware.

While texture maps are generally used to add detail to rendered images, there are important visualization applications.

  • Texture maps can be generated procedurally as a function of data. One example is to change the appearance of a surface based on local data value.

  • Texture coordinates can be generated procedurally as a function of data. For example, we can threshold geometry by creating a special texture map and then setting texture coordinates based on local data value. The texture map consists of two entries: fully transparent (\\alpha = 0 ) and fully opaque (\\alpha = 1). The texture coordinate is then set to index into the transparent portion of the map if the scalar value is less than some threshold, or into the opaque portion otherwise.

  • Texture maps can be animated as a function of time. By choosing a texture map whose intensity varies monotonically from dark to light, and then \"moving\" the texture along an object, the object appears to crawl in the direction of the texture map motion. We can use this technique to add apparent motion to things like hedgehogs to show vector magnitude. Figure 7-3 is an example of a texture map animation used to simulate vector field motion. Figure 7-3. One frame from a vector field animation using texture. See AnimateVectors.cxx and AnimateVectors.py.

    These techniques will be covered in greater detail in Chapter 9. (See \"Texture Algorithms\" for more information.)

    "},{"location":"VTKBook/07Chapter7/#73-volume-rendering","title":"7.3 Volume Rendering","text":"

    Until now we have concentrated on the visualization of data through the use of geometric primitives such as points, lines, and polygons. For many applications such as architectural walk-throughs or terrain visualization, this is obviously the most efficient and effective representation for the data. In contrast, some applications require us to visualize data that is inherently volumetric (which we refer to as 3D image or volume datasets). For example, in biomedical imaging we may need to visualize data obtained from an MR or CT scanner, a confocal microscope, or an ultrasound study. Weather analysis and other simulations also produce large quantities of volumetric data in three or more dimensions that require effective visualization techniques. As a result of the popularity and usefulness of volume data over the last several decades, a broad class of rendering techniques known as volume rendering has emerged. The purpose of volume rendering is to effectively convey information within volumetric data.

    In the past, researchers have attempted to define volume rendering as a process that operates directly on the dataset to produce an image without generating an intermediate geometric representation. With recent advances in graphics hardware and clever implementations, developers have been able to use geometric primitives to produce images that are identical to those generated by direct volume rendering techniques. Due to these new techniques, it is nearly impossible to define volume rendering in a manner that is clearly distinct from geometric rendering. Therefore, we choose a broad definition of volume rendering as any method that operates on volumetric data to produce an image.

    The next several sections cover a variety of volume rendering methods that use direct rendering techniques, geometric primitive rendering techniques, or a combination of these two methods, to produce an image. Some of the direct volume rendering techniques discussed in this chapter generate images that are nearly identical to those produced by geometric rendering techniques discussed in earlier chapters. For example, using a ray casting method to produce an isosurface image is similar, though not truly equivalent, to rendering geometric primitives that were extracted with the marching cubes contouring technique described in Chapter 6.

    The two basic surface rendering approaches described in Chapter 3, image-order and object-order, apply to volume rendering techniques as well. In an image-order method, rays are cast for each pixel in the image plane through the volume to compute pixel values, while in an object-order method the volume is traversed, typically in a front-to-back or back-to-front order, with each voxel processed to determine its contribution to the image. In addition, there are other volume rendering techniques that cannot easily be classified as image-order or object-order. For example, a volume rendering technique may traverse both the image and the volume simultaneously, or the image may be computed in the frequency domain rather than the spatial domain.

    Since volume rendering is typically used to generate images that represent an entire 3D dataset in a 2D image, several new challenges are introduced. Classification must be performed to assign color and opacity to regions within the volume, and volumetric illumination models must be defined to support shading. Furthermore, efficiency and compactness are of great importance due to the complexity of volume rendering methods and the size of typical volumetric datasets. A geometric model that consists of one million primitives is generally considered large, while a volumetric dataset with one million voxels is quite small. Typical volumes contain between ten and several hundred million voxels, with datasets of a billion or more voxels becoming more common. Clearly care must be taken when deciding to store auxiliary information at each voxel or to increase the time required to process each voxel.

    "},{"location":"VTKBook/07Chapter7/#74-image-order-volume-rendering","title":"7.4 Image-Order Volume Rendering","text":"

    Image-order volume rendering is often referred to as ray casting or ray tracing. The basic idea is that we determine the value of each pixel in the image by sending a ray through the pixel into the scene according to the current camera parameters. We then evaluate the data encountered along the ray using some specified function in order to compute the pixel value. As we will demonstrate throughout this chapter, ray casting is a flexible technique that can be used to render any 3D image dataset, and can produce a variety images. Also, it is relatively easy to extend a basic ray casting technique designed for volumetric data sets that have uniform voxels to work on rectilinear or structured grids. Unfortunately, basic ray casting is also fairly slow; therefore, later in this chapter we will discuss a number of acceleration methods that can be used to improve performance, though often with some additional memory requirements or loss in flexibility.

    The ray casting process is illustrated in Figure 7-4. This example uses a standard orthographic camera projection; consequently, all rays are parallel to each other and perpendicular to the view plane. The data values along each ray are processed according to the ray function, which in this case determines the maximum value along the ray and converts it to a gray scale pixel value where the minimum scalar value in the volume maps to transparent black, and the maximum scalar value maps to opaque white.

    The two main steps of ray casting are determining the values encountered along the ray, and then processing these values according to a ray function. Although in implementation these two steps are typically combined, we will treat them independently for the moment. Since the specific ray function often determines the method used to extract values along the ray, we will begin by considering some of the basic ray function types.

    Figure 7-4 Image-order volume rendering. High potential iron protein data courtesy of Scripps Clinic, La Jolla, CA..

    Figure 7-5 shows the data value profile of a ray as it passes through 8 bit volumetric data where the data values can range between 0 and 255. The x-axis of the profile indicates distance from the view plane while the y-axis represents data value. The results obtained from four different simple ray functions are shown below the profile. For display purposes we convert the raw result values to gray scale values using a method similar to the one in the previous example.

    The first two ray functions, maximum value and average value, are basic operations on the scalar values themselves. The third ray function computes the distance along the ray at which a scalar value at or above 30 is first encountered, while the fourth uses an alpha compositing technique, treating the values along the ray as samples of opacity accumulated per unit distance. Unlike the first three ray functions, the result of the compositing technique is not a scalar value or distance that can be represented on the ray profile.

    The maximum intensity projection, or MIP, is probably the simplest way to visualize volumetric data. This technique is fairly forgiving when it comes to noisy data, and produces images that provide an intuitive understanding of the underlying data. One problem with this method is that it is not possible to tell from a still image where the maximum value occurred along the ray. For example, consider the image of a carotid artery shown in Figure 7-6. We are unable to fully understand the structure of the blood vessels from this still image since we cannot determine whether some vessel is in front of or behind some other vessel. This problem can be solved by generating a small sequence of images showing the data rotating, although for parallel camera projections even this animation will be ambiguous. This is due to the fact that two images generated from cameras that view the data from opposite directions will be identical except for a reflection about the Y axis of the image. Figure 7-5. A ray profile and four example ray functions. MRI head data courtesy of Siemens Medical Systems, Inc., Iselin, NJ. Figure 7-6. A maximum intensity projection created with a ray casting technique. Intensity values are mapped through the color lookup table shown at the bottom of the image before display.

    Later in this chapter, during the classification and illumination discussions, we will consider more complex ray functions. Although the colorful, shaded images produced by the new methods may contain more information, they may also be more difficult to interpret, and often easier to misinterpret, than the simple images of the previous examples. For that reason, it is beneficial to use multiple techniques to visualize your volumetric data.

    A volume is represented as a 3D image dataset where scalar values are defined at the points of the regular grid, yet in ray casting we often need to sample the volume at arbitrary locations. To do this we must define an interpolation function that can return a scalar value for any location between grid points. The simplest interpolation function, which is called zero-order, constant, or nearest neighbor interpolation, returns the value of the closest grid point. This function defines a grid of identical rectangular boxes of uniform value centered on grid points, as illustrated in 2D on the left side of Figure 7-7. In the image on the right we see an example of trilinear interpolation where the value at some location is defined by using linear interpolation based on distance along each of the three axes. In general, we refer to the region defined by eight neighboring grid points as a voxel. In the special case where a discrete algorithm is used in conjunction with nearest neighbor interpolation, we may instead refer to the constant-valued regions as voxels.

    To traverse the data along a ray, we could sample the volume at uniform intervals or we could traverse a discrete representation of the ray through the volume, examining each voxel encountered, as illustrated in Figure 7-8. The selection of a method depends upon factors such as the interpolation technique, the ray function, and the desired trade-off between image accuracy and speed.

    The ray is typically represented in parametric form as

    \\begin{equation*} \\left(x, y, z\\right) = \\left(x_0, y_0, z_0\\right) + \\left(a, b, c\\right) t \\end{equation*} \\bf\\tag{7-2}

    where x_0,y_0,z_0) is the origin of the ray (either the camera position for perspective viewing transformations or a pixel on the view plane for parallel viewing transformations), and (a, b, c) is the normalized ray direction vector. If t1 and t2 represent the distances where the ray enters and exits the volume respectively, and delta_t indicates the step size, then we can use the following code fragment to perform uniform distance sampling:

    t = t1;\nv = undefined;\nwhile ( t < t2 )\n  {\n  x = x0 + a * t;\n  y = y0 + b * t;\n  z = z0 + c * t;\n  v = EvaluateRayFunction( v, t );\n  t = t + delta_t;\n}\n
    Figure 7-7. A 2D example of nearest neighbor interpolation (left) and a 3D example of trilinear interpolation (right). Figure 7-8. Two basic ray traversal methods for volume rendering. Figure 7-9. Images generated using a ray casting method with three different step sizes.Vase data courtesy of SUNY Stony Brook.

    One difficulty with the uniform distance sampling method is selecting the step size. If the step size is too large, then our sampling might miss features in the data, yet if we select a small step size, we will significantly increase the amount of time required to render the image. This problem is illustrated in Figure 7-9 using a volumetric dataset with grid points that are one unit apart along the X, Y, and Z axes. The images were generated using step sizes of 2.0, 1.0, and 0.1 units, where the 0.1 step-size image took nearly 10 times as long to generate as the 1.0 step-size image, which in turn took twice as long to render as the 2.0 step-size image. A compositing method was used to generate the images, where the scalar values within the dataset transition sharply from transparent black to opaque white. If the step size is too large, a banding effect appears in the image highlighting regions of the volume equidistant from the ray origin along the viewing rays. To reduce this effect when a larger step size is desired for performance reasons, the origin of each ray can be bumped forward along the viewing direction by some small random offset, which will produce a more pleasing image by eliminating the regular pattern of the aliasing.

    In some cases it may make more sense to examine each voxel along the ray rather than taking samples. For example, if we are visualizing our data using a nearest neighbor interpolation method, then we may be able to implement a more efficient algorithm using discrete ray traversal and integer arithmetic. Another reason for examining voxels may be to obtain better accuracy on certain ray functions. We can compute the exact maximum value encountered along a ray within each voxel when using trilinear interpolation by taking the first derivative of the interpolation function along the ray and solving the resulting equation to compute the extrema. Similarly, we can find the exact location along the ray where a selected value is first encountered to produce better images of isovalue surfaces within the volume.

    Figure 7-10. Discrete ray classification. Figure 7-11. Ray casting with templated discrete rays. If the rays originate from the image plane (left) then voxels are missed in the volume. If instead the rays originate from a base plane of the volume (right), each voxel is visited exactly once.

    A 3D scan conversion technique, such as a modified Bresenham method, can be used to transform the continuous ray into a discrete representation. The discrete ray is an ordered sequence of voxels v_1, v_2,... v_n and can be classified as 6-connected, 18-connected, or 26-connected as shown in Figure 7-10. Each voxel contains 6 faces, 12 edges, and 8 vertices. If each pair of voxels v_i, v_{i+1} along the ray share a face then the ray is 6-connected, if they share a face or an edge the ray is 18-connected, and if they share a face, an edge, or a vertex the ray is 26-connected. Scan converting and traversing a 26-connected ray requires less time than a 6-connected ray but is more likely to miss small features in the volume dataset.

    If we are using a parallel viewing transformation and our ray function can be efficiently computed using a voxel by voxel traversal method, then we can employ a templated ray casting technique [Yagel92b] with 26-connected rays to generate the image. All rays are identical in direction; therefore, we only need to scan convert once, using this \"template\" for every ray. When these rays are cast from pixels on the image plane, as shown in the left image of Figure 7-11, then some voxels in the dataset will not contribute to the image. If instead we cast the rays from the voxels in the base plane of the volume that is most parallel to the image plane, as shown in the right image, then the rays fit together snugly such that every voxel in the dataset is visited exactly once. The image will appear warped because it is generated from the base plane, so a final resampling step is required to project this image back onto the image plane."},{"location":"VTKBook/07Chapter7/#75-object-order-volume-rendering","title":"7.5 Object-Order Volume Rendering","text":"

    Object-order volume rendering methods process samples in the volume based on the organization of the voxels in the dataset and the current camera parameters. When an alpha compositing method is used, the voxels must be traversed in either a front-to-back or back-to-front order to obtain correct results. This process is analogous to sorting translucent polygons before each projection in order to ensure correct blending. When graphics hardware is employed for compositing, a back-to-front ordering is typically preferred since it is then possible to perform alpha blending without the need for alpha bit planes in the frame buffer. If a software compositing method is used, a front-to-back ordering is more common since partial image results are more visually meaningful, and can be used to avoid additional processing when a pixel reaches full opacity. Voxel ordering based on distance to the view plane is not always necessary since some volume rendering operations, such as MIP or average, can be processed in any order and still yield correct results.

    Figure 7-12. Object-order, back-to-front volume rendering.

    Figure 7-12 illustrates a simple object-order, back-to-front approach to projecting the voxels in a volume for an orthographic projection. Voxel traversal starts at the voxel that is furthest from the view plane and then continues progressively to closer voxels until all voxels have been visited. This is done within a triple nested loop where, from the outer to the inner loop, the planes in the volume are traversed, the rows in a plane are processed, and finally the voxels along a row are visited. Figure 7-12 shows an ordered labeling of the first seven voxels as the volume is projected. Processing voxels in this manner does not yield a strict ordering from the furthest to the closest voxel. However, it is sufficient for orthographic projections since it does ensure that the voxels that project to a single pixel are processed in the correct order. Figure7-13. A Gaussian kernel is projected onto the view plane to produce a splat footprint.

    When a voxel is processed, its projected position on the view plane is determined and an operation is performed at that pixel location using the voxel and image information. This operator is similar to the ray function used in image-order ray casting techniques. Although this approach to projecting voxels is both fast and efficient, it often yields image artifacts due to the discrete selection of the projected image pixel. For instance, as we move the camera closer to the volume in a perspective projection, neighboring voxels will project to increasingly distant pixels on the view plane, resulting in distracting \"holes\" in the image.

    A volume rendering technique, called splatting, addresses this problem by distributing the energy of a voxel across many pixels. Splatting is an object-order volume rendering technique proposed by Westover [Westover90] and, as its name implies, it projects the energy of a voxel onto the image plane one splat, or footprint, at a time. A kernel with finite extent is placed around each data sample. The footprint is the projected contribution of this sample onto the image plane, and is computed by integrating the kernel along the viewing direction and storing the results in a 2D footprint table. Figure 7-13 illustrates the projection of a Gaussian kernel onto the image plane that may then be used as a splatting footprint. For a parallel viewing transform and a spherically symmetric kernel, the footprint of every voxel is identical except for an image space offset. Therefore, the evaluation of the footprint table and the image space extent of a sample can be performed once as a preprocessing step to volume rendering. Splatting is more difficult for perspective volume rendering since the image space extent is not identical for all samples. Accurately correcting for perspective effects in a splatting approach would make the algorithm far less efficient. However, with a small loss of accuracy we can still use the generic footprint table if we approximate the image plane extent of an ellipsoid with an ellipse.

    There are several important considerations when utilizing a splatting approach for volume rendering. The type of kernel, the radius of the kernel, and the resolution of the footprint table will all impact the appearance of the final image. For example, a kernel radius that is smaller than the distance between neighboring samples may lead to gaps in the image, while a larger radius will lead to a blurry image. Also, a low resolution footprint table is faster to precompute, but a high resolution table allows us to use nearest neighbor sampling for faster rendering times without a significant loss in image accuracy.

    Figure 7-14. Volume rendering using a 2D (left) and 3D (right) texture mapping technique.

    Texture mapping as described earlier in this chapter was originally developed to provide the appearance of high surface complexity when rendering geometric surfaces. As texture mapping methods matured and found their way into standard graphics hardware, researchers began utilizing these new capabilities to perform volume rendering [Cabral94]. There are two main texture-mapped volume rendering techniques based on the two main types of texture hardware currently available. Two-dimensional texture-mapped volume rendering makes use of 2D texture mapping hardware whereas 3D texture-mapped volume rendering makes use less commonly available 3D texture mapping graphics hardware.

    We can decompose texture-mapped volume rendering into two basic steps. The first is a sampling step where the data samples are extracted from the volume using some form of interpolation. Depending on the type of texture hardware available, this may be nearest neighbor, bilinear, or tri-linear interpolation and may be performed exclusively in hardware or through a combination of both software and hardware techniques. The second step is a blending step where the sampled values are combined with the current image in the frame buffer. This may be a simple maximum operator or it may be a more complex alpha compositing operator.

    Texture-mapped volume renderers sample and blend a volume to produce an image by projecting a set of texture-mapped polygons that span the entire volume. In 2D texture-mapped volume rendering the dataset is decomposed into a set of orthographic slices along the axis of the volume most parallel to the viewing direction. The basic rendering algorithm consists of a loop over the orthogonal slices in a back-to-front order, where for each slice, a 2D texture is downloaded into texture memory. Each slice, which is a rectangular polygon, is projected to show the entire 2D texture. If neighboring slices are far apart relative to the image size, then it may be necessary to use a software bilinear interpolation method to extract additional slices from the volume in order to achieve a desired image accuracy. The image on the left side of Figure 7-14 illustrates the orthogonal slices that are rendered using a 2D texture mapping approach. Several example images generated using 2D texture-mapped volume rendering are shown in Figure 7-15. Figure 7-15. 2D texture-mapped volume rendering. The images were generated using three different mappings of scalar value to opacity. CT data (256x256x225) courtesy of North Carolina Memorial Hospital.

    The performance of this algorithm can be decomposed into the software sampling rate, the texture download rate, and the texture-mapped polygon scan conversion rate. The software sampling step is required to create the texture image, and is typically dependent on view direction due to cache locality when accessing volumetric data stored in a linear array. Some implementations minimize the software sampling cost at the expense of memory by precomputing and saving images for the three major volume orientations. The texture download rate is the rate at which this image can be transferred from main memory to texture mapping memory. The scan conversion of the polygon is usually limited by the rate at which the graphics hardware can process pixels in the image, or the pixel fill rate. For a given hardware implementation, the download time for a volume is fixed and will not change based on viewing parameters. However, reducing the relative size of the projected volume will reduce the number of samples processed by the graphics hardware that, in turn, will increase volume rendering rates at the expense of image quality.

    Unlike 2D hardware, 3D texture hardware is capable of loading and interpolating between multiple slices in a volume by utilizing 3D interpolation techniques such as trilinear interpolation. If the texture memory is large enough to hold the entire volume, then the rendering algorithm is simple. The entire volume is downloaded into texture memory once as a preprocessing step. To render an image, a set of equally spaced planes along the viewing direction and parallel to the image plane is clipped against the volume. The resulting polygons, illustrated in the image on the right side of Figure 7-14, are then projected in back-to-front order with the appropriate 3D texture coordinates.

    For large volumes it may not be possible to load the entire volume into 3D texture memory. The solution to this problem is to break the dataset into small enough subvolumes, or bricks, so that each brick will fit in texture memory. The bricks must then be processed in back-to-front order while computing the appropriately clipped polygon vertices inside the bricks. Special care must be taken to ensure that boundaries between bricks do not result in image artifacts.

    Figure 7-16. On the left, orthographic rays are cast from the base plane of the volume. In the right image the volume is sheared such that these rays become perpendicular to the base plane.

    Similar to a 2D texture mapping method, the 3D algorithm is limited by both the texture download and pixel fill rates of the machine. However, 3D texture mapping is superior to the 2D version in its ability to sample the volume, generally yielding higher quality images with fewer artifacts. Since it is capable of performing trilinear interpolation, we are able to sample at any location within the volume. For instance, a 3D texture mapping algorithm can sample along polygons representing concentric spheres rather than the more common view-aligned planes.

    In theory, a 3D texture-mapped volume renderer and a ray casting volume renderer perform the same computations, have the same complexity O^{n_3}, and produce identical images. Both sample the entire volume using either nearest neighbor or trilinear interpolation, and combine the samples to form a pixel value using, for example, a maximum value or compositing function. Therefore, we can view 3D texture mapping and standard ray casting methods as functionally equivalent. The main advantage to using a texture mapping approach is the ability to utilize relatively fast graphics hardware to perform the sampling and blending operations. However, there are currently several drawbacks to using graphics hardware for volume rendering. Hardware texture-mapped volume renderings tend to have more artifacts than software ray casting techniques due to limited precision within the frame buffer for storing partial results at each pixel during blending. In addition, only a few ray functions are supported by the hardware, and advanced techniques such as shading are more difficult to achieve. However, these limitations are beginning to disappear as texture mapping hardware evolves. Through the use of extensions to the OpenGL standard, per pixel vectors can be defined allowing for hardware shaded volume texture mapping. Other extensions have allowed for maximum intensity projections, and deeper frame buffers eliminate artifacts.

    "},{"location":"VTKBook/07Chapter7/#76-other-volume-rendering-methods","title":"7.6 Other Volume Rendering Methods","text":"

    Not all volume rendering methods fall cleanly into the image-order or object-order categories. For example, the shear-warp method [Lacroute94] of volume rendering traverses both image and object space at the same time. The basic idea behind this method is similar to that of templated ray casting. If we cast rays from the base plane of the volume for an orthographic projection, then it is possible to shear the volume such that the rays become perpendicular to the base plane, as shown in Figure 7-16. Looking at the problem this way, it is clear to see that if all rays originate from the same place within the voxels on the base plane, then these rays intersect the voxels on each subsequent plane of the volume at consistent locations. Using bilinear interpolation on the 2D planes of the dataset, we can precompute one set of interpolation weights for each plane. Instead of traversing the volume by evaluating samples along each ray, an object-order traversal method can be used to visit voxels along each row in each plane in a front-to-back order through the volume. There is a one-to-one correspondence between samples in a plane of the volume and pixels on the image plane, making it possible to traverse both the samples and the pixels simultaneously. As in templated ray casting, a final resampling (warping) operation must be performed to transform the image from sheared space on the base plane to Cartesian space on the image plane.

    Shear-warp volume rendering is essentially an efficient variant of ray casting. The correspondence between samples and pixels allows us to take advantage of a standard ray casting technique known as early ray termination. When we have determined that a pixel has reached full opacity during compositing, we no longer need to consider the remaining samples that project onto this pixel since they do not contribute to the final pixel value. The biggest efficiency improvement in shear-warp volume rendering comes from run-length encoding the volume. This compression method removes all empty voxels from the dataset, leaving only voxels that can potentially contribute to the image. Depending on the classification of the data, it is possible to achieve a greater than 10:1 reduction in voxels. As we step through the compressed volume, the number of voxels skipped due to run-length encoding also indicates the number of pixels to skip in the image. One drawback to this method is that it requires three copies of the compressed volume to allow for front-to-back traversal from all view directions. In addition, if we wish to use a perspective viewing transformation then we may need to traverse all three compressed copies of the volume in order to achieve the correct traversal order.

    Volume rendering can also be performed using the Fourier slice projection theorem [Totsuka92] that states that if we extract a slice of the volume in the frequency domain that contains the center and is parallel to the image plane, then the 2D spectrum of that slice is equivalent to the 2D image obtained by taking line integrals through the volume from the pixels on the image plane. Therefore we can volume render the dataset by extracting the appropriate slice from the 3D Fourier volume, then computing the 2D inverse Fourier transform of this slice. This allows us to render the image in O(n^2 \\log n) time as opposed to the O(n^3) complexity required by most other volume rendering algorithms.

    Two problems that must be addressed when implementing a frequency domain volume renderer are the high cost of interpolation when extracting a slice from the Fourier volume, and the high memory requirements (usually two double precision floating-point values per sample) required to store the Fourier volume. Although some shading and depth cues can be provided with this method, occlusion is not possible.

    "},{"location":"VTKBook/07Chapter7/#77-volume-classification","title":"7.7 Volume Classification","text":"

    Classifying the relevant objects of interest within a dataset is a critical step in producing a volume rendered image. This information is used to determine the contribution of an object to the image as well as the object's material properties and appearance. For example, a simple binary classification of whether a data sample corresponds to bone within a CT dataset is often performed by specifying a density threshold. When the scalar value at a voxel is greater than this threshold, it is classified as bone, otherwise it is considered air. This essentially specifies an isosurface in the volume at the transition between air and bone. If we plot this operation over all possible scalar values we will get the binary step function shown on the left in Figure 7-17. In volume rendering we refer to this function as a transfer function. A transfer function is responsible for mapping the information at a voxel location into different values such as material, color, or opacity. The strength of volume rendering is that it can handle transfer functions of much greater complexity than a binary step function. This is often necessary since datasets contain multiple materials and classification methods cannot always assign a single material to a sample with 100 percent probability. Using advanced image segmentation and classification techniques, the single component volume can be processed into multiple material percentage volumes [Drebin88]. Referring back to our CT example, we can now specify a material percentage transfer function that defines a gradual transition from air to muscle, then from muscle to bone, as shown on the right in Figure 7-17. Figure 7-17. Transfer functions that classify CT densities into material percentages. A simple binary classification used to define a bone isosurface (left) and a gradual transition from air to muscle to bone (right) is shown.

    In addition to material percentage transfer functions, we can define four independent transfer functions that map scalar values into red, green, blue, and opacity values for each material in the dataset. For simplicity, these sets of transfer functions are typically pre-processed into one function each for red, green, blue and opacity at the end of the classification phase. During rendering we must decide how to perform interpolation to compute the opacity and color at an arbitrary location in the volume. We could interpolate scalar value then evaluate the transfer functions, or we could evaluate the transfer functions at the grid points then interpolate the resulting opacities and colors. These two methods will produce different image results. It is generally considered more accurate to classify at the grid points then interpolate to obtain color and opacity; although if we interpolate then classify, the image often appears more pleasing since high frequencies may be removed by the interpolation.

    Classifying a volume based on scalar value alone is often not capable of isolating an object of interest. A technique introduced by Levoy [Levoy88] adds a gradient magnitude dimension to the specification of a transfer function. With this technique we can specify an object in the volume based on a combination of scalar value and the gradient magnitude. This allows us to define an opacity transfer function that can target voxels with scalar values in a range of densities and gradients within a range of gradient magnitudes. This is useful for avoiding the selection of homogeneous regions in a volume and highlighting fast-changing regions. Figure 7-18 shows a CT scan of a human foot. The sharp changes in the volume, such as the transition from air to skin and flesh to bone, are shown. However, the homogeneous regions, such as the internal muscle, are mostly transparent. Figure 7-18. Volume rendering using a gradient magnitude opacity transfer function. Rendering performed with Kitware's VolView volume rendering system. The Visible Man CT data is courtesy of The National Library of Medicine.

    If we are using a higher-order interpolation function such as tri-cubic interpolation then we can analytically compute the gradient vector at any location in the dataset by evaluating the first derivative of the interpolation function. Although we can use this approach for trilinear interpolation, it may produce undesirable artifacts since trilinear interpolation is not continuous in its first derivative across voxel boundaries. An alternative approach is to employ a finite differences technique to approximate the gradient vector:

    \\begin{eqnarray*} g_x &=& \\frac{f(x + \\Delta x, y, z) - f(x - \\Delta x, y, z)}{2 \\Delta x} \\\\ g_y &=& \\frac{f(x, y + \\Delta y, z) - f(x, y - \\Delta y, z)}{2 \\Delta y} \\\\ g_z &=& \\frac{f(x, y, z + \\Delta z) - f(x, y, z - \\Delta z)}{2 \\Delta z} \\end{eqnarray*} \\bf\\tag{7-3}

    where f(x,y,z) represents the scalar value at (x,y,z) location in the dataset according to the interpolation function, and g_x, g_y and g_z are the partial derivatives of this function along the x, y, and z axes respectively. The magnitude of the gradient at (x,y,z) is the length of the resulting vector (g_x, g_y, g_z). This vector can also be normalized to produce a unit normal vector. The $\\Delta x, \\Delta y, $ and \\Delta z are critical as shown in Figure 7-19. If these values are too small, then the gradient vector field derived from Equation7-3 may contain high frequencies, yet if these values are too large we will lose small features in the dataset.

    It is often the case that transfer functions based on scalar value and even gradient magnitude are not capable of fully classifying a volume. Ultrasound data is an example of particularly difficult data that does not perform well with simple segmentation techniques. While no one technique exists that is universally applicable, there exists a wide variety of techniques that produce classification information at each sample. For instance, [Kikinis96] provides techniques for classifying the human brain. In order to properly handle this information a volume renderer must access the original volume and a classification volume. The classification volume usually contains material percentages for each sample, with a set of color and opacity transfer functions for each material used to define appearance.

    Figure 7-19. A comparison of shaded images with two different step sizes used during normal estimation. Confocal microscopy data courtesy of Howard Hughes Medical Institute, SUNY Stony Brook."},{"location":"VTKBook/07Chapter7/#78-volumetric-illumination","title":"7.8 Volumetric Illumination","text":"

    The volume rendered images that we have shown so far in this chapter do not include any lighting effects. Scientist sometimes prefer to visualize their volumes using these simpler methods because they fear that adding lighting effects to the image will interfere with their interpretation. For example, in a maximum intensity projection, a dark region in the image clearly indicates the lack of high opacity values in the corresponding region of the volume, while a dark feature in a shaded image may indicate either low opacity values or values with gradient directions that point away from the light source.

    There are several advantages to lighting that can often justify the additional complexity in the image. First, consider the fact that volume rendering is a process of creating a 2D image from 3D data. The person viewing that data would like to be able to understand the 3D structure of the volume from that image. Of course, if you were to look at a photograph of a skeleton it would be easy to understand its structure from the 2D representation. The two main clues that you received from the picture are occlusion and lighting effects. If you were to view a video of the skeleton, you would receive the additional clue of motion parallax. A static image showing a maximum intensity projection does not include occlusion or lighting effects, making it difficult to understand structure. An image generated with a compositing technique does include occlusion, and the compositing ray function can be modified to include shading as well. A comparison of these three methods is shown in Figure 7-20 for a CT scan of a human foot. Figure 7-20. A comparison of three volume rendering techniques. A maximum intensity projection does not include occlusion or shading. A composite image includes occlusion and can include shading.

    To accurately capture lighting effects, we could use a transport theory illumination model [Krueger91] that describes the intensity of light I arriving at a pixel by the path integral along the ray:

    \\begin{equation*} I\\left(t_0, \\vec{\\omega}\\right) = \\int_{t_0}^{\\infty} Q\\left(\\tau\\right) e^{\\left(-\\int_{t_0}^{t} \\sigma_\\text{a}\\left(\\tau\\right) + \\sigma_\\text{sc}\\left(\\tau\\right) \\, \\text{d} \\tau\\right)} \\, \\text{d}\\tau \\end{equation*} \\bf\\tag{7-4}

    If we are using camera clipping planes, then t_0 and \\infty would be replaced by the distance to the near clip plane t_{near} and the distance to the far clip plane t_{far} respectively. The contribution Q(t) from each sample at a distance t along the ray is attenuated according to how much intensity is lost on the way from t to t_0 due to absorption \\sigma_a(t') and scattering \\sigma_{sc}(t'). The contributions at t can be defined as:

    \\begin{equation*} Q(t) = E(t) + \\sigma_\\text{sc}(t) \\int_{\\Omega} \\rho_{sc}(\\omega' \\to \\omega) I(t, \\omega') \\, \\text{d}\\omega' \\end{equation*} \\bf\\tag{7-5}

    The contribution consists of the amount of light directly emitted by the sample E(t), plus the amount of light coming from all directions that is scattered by this sample back along the ray. The fraction of light arriving from the \\vec{\\omega'} direction that is scattered into the direction \\vec{\\omega} is defined by the scattering function \\rho_{sc}(\\vec{\\omega'}\\rightarrow \\vec{\\omega}). To compute the light arriving from all directions due to multiple bounce scattering, we must recursively compute the illumination function.

    If scattering is accurately modelled, then basing the ray function on the transport theory illumination model will produce images with realistic lighting effects. Unfortunately, this illumination model is too complex to evaluate, therefore approximations are necessary for a practical implementation. One of the simplest approximations is to ignore scattering completely, yielding the following intensity equation:

    \\begin{equation*} I\\left(t_0, \\vec{\\omega}\\right) = \\int_{t_0}^{\\infty} E\\left(\\tau\\right) e^\\left(-\\int_{t_0}^{t} \\sigma_\\text{a}\\left(\\tau\\right) \\, \\text{d} \\tau \\right) \\, \\text{d}\\tau \\end{equation*} \\bf\\tag{7-6}

    We can further simplify this equation by allowing $\\alpha (t) to represent both the amount of light emitted per unit length and the amount of light absorbed per unit length along the ray. The outer integral can be replaced by a summation over samples along the ray within some clipping range, while the inner integral can be approximated using an over operator:

    \\begin{equation*} I(t_\\text{near}, \\vec{\\omega}) = \\sum_{t = t_\\text{near}}^{t \\leq t_\\text{far}} \\alpha(t) \\prod_{t' = t_\\text{near}}^{t' < t_\\text{far}}\\left(1 - a(t') \\right) \\end{equation*} \\bf\\tag{7-7}

    This equation is typically expressed in its recursive form:

    \\begin{equation*} I(t_n, \\vec{\\omega}) = \\alpha(t_n) + \\left(1 - \\alpha(t_n) \\right) I(t_{n + 1}, \\vec{\\omega}) \\end{equation*} \\bf\\tag{7-8}

    which is equivalent to the simple compositing method using the over operator that was described previously. Clearly in this case we have simplified the illumination model to the point that this ray function does not produce images that appear to be realistic.

    If we are visualizing an isosurface within the volumetric data, then we can employ the surface illumination model described in Chapter 3 to capture ambient and diffuse lighting as well as specular highlights. There are a variety of techniques for estimating the surface normal needed to evaluate the shading equation. If the image that is produced as a result of volume rendering contains the distance from the view plane to the surface for every pixel, then we can post-process the image with a 2D gradient estimator to obtain surface normals. The gradient at some pixel x_p, y_p can be estimated with a central difference technique by:

    \\begin{eqnarray*} \\frac{\\partial Z}{\\partial x} &\\simeq& \\frac{Z\\left(x_p + \\Delta x, y_p\\right) - Z\\left(x_p - \\Delta x, y_p\\right)}{2 \\Delta x} \\\\ \\frac{\\partial Z}{\\partial y} &\\simeq& \\frac{Z\\left(x_p, y_p + \\Delta y\\right) - Z\\left(x_p, y_p - \\Delta y\\right)}{2 \\Delta y} \\\\ \\frac{\\partial Z}{\\partial z} &\\simeq& 1 \\end{eqnarray*} \\bf\\tag{7-9} Disjoint volumetric objects Corresponding depth image Figure 7-21. A scene (left) and the corresponding depth image (right) used in 2D gradient estimation.

    The results are normalized to produce a unit normal vector. As with the 3D finite differences gradient estimator given in Equation7-3 care must be taken when selecting $\\delta x and \\delta y Typically, these values are simply the pixel spacing in x and y so that neighboring pixel values are used to estimate the gradient, although larger values can be used to smooth the image.

    One problem with the 2D gradient estimation technique described above is that normals are computed from depth values that may represent disjoint regions in the volume, as shown in Figure 7-21. This may lead to a blurring of sharp features on the edges of objects. To reduce this effect, we can locate regions of continuous curvature in the depth image, then estimate the normal for a pixel using only other pixel values that fall within the same curvature region [Yagel92a]. This may require reducing our \\Delta x and \\Delta y values, or using an off-centered differences technique to estimate the components of the gradient. For example, the x component of the gradient could be computed with a forward difference: \\begin{equation*} \\frac{\\partial Z}{\\partial x} \\simeq \\frac{Z(x_p + \\Delta x, y_p) - Z(x_p, y_p)}{\\Delta x} \\end{equation*} \\bf\\tag{7-10}

    or a backward difference

    \\begin{equation*} \\frac{\\partial Z}{\\partial x} \\simeq \\frac{Z(x_p, y_p) - Z(x_p - \\Delta x, y_p)}{\\Delta x} \\end{equation*} \\bf\\tag{7-11}

    Although 2D gradient estimation is not as accurate as the 3D version, it is generally faster and allows for quick lighting and surface property changes without requiring us to recompute the depth image. However, if we wish to include shading effects in an image computed with a compositing technique, we need to estimate gradients at many locations within the volume for each pixel. A 3D gradient estimation technique is more suitable for this purpose. An illumination equation for compositing could be written as:

    \\begin{equation*} I(t_\\text{near}, \\vec{\\omega}) = \\sum_{t = t_\\text{near}}^{t \\leq t_\\text{far}} \\alpha(t)\\left(I_\\text{a} + I_\\text{d} + I_\\text{s}\\right) \\prod_{t' = t_\\text{near}}^{t' < t_\\text{far}}\\left(1 - a(t') \\right) \\end{equation*} \\bf\\tag{7-12}

    where the ambient illumination I_a, the diffuse illumination I_d, and the specular illumination I_s are computed as in surface shading using the estimated volume gradient in place of the surface normal. In this equation, \\alpha(t) represents the amount of light reflected per unit length along the ray, with 1 - \\alpha*(t) indicating the fraction of light transmitted per unit length.

    As in classification, we have to make a decision about whether to directly compute illumination at an arbitrary location in the volume, or to compute illumination at the grid points and then interpolate. This is not a difficult decision to make on the basis of accuracy since it is clearly better to estimate the gradient at the desired location rather than interpolate from neighboring estimations. On the other hand, if we do interpolate from the grid points then we can precompute the gradients for the entire dataset once, and use this to increase rendering performance for both classification and illumination. The main problem is the amount of memory required to store the precomputed gradients. A naive implementation would store a floating-point value (typically four bytes) per component of the gradient per scalar value. For a dataset with one 256^3 one-byte scalars, this would increase the storage requirement from 16 Mbytes to 218 Mbytes.

    In order to reduce the storage requirements, we could quantize the precomputed gradients by using some number of bits to represent the magnitude of the vector, and some other number of bits to encode the direction of the vector. Quantization works well for storing the magnitude of the gradient, but does not provide a good distribution of directions if we simply divide the bits among the three components of the vector. A better solution is to use the uniform fractal subdivision of an octahedron into a sphere as the basis of the direction encoding, as shown in Figure 7-22. The top left image shows the results obtained after the recursive replacement of each triangle with four new triangles, with a recursion depth of two. The vector directions encoded in this representation are all directions formed by creating a ray originating at the sphere's center and passing through a vertex of the sphere. The remaining images in this figure illustrate how these directions are mapped into an index. First we push all vertices back onto the original faces of the octahedron, then we flatten this sphere onto the plane z=0. Finally, we rotate the resulting grid by 45^\\circ. We label the vertices in the grid with indices starting at 0 at the top left vertex and continue across the rows then down the columns to index 40 at the lower right vertex. These indices represent only half of the encoded normals because when we flattened the octahedron, we placed two vertices on top of each other on all but the edge locations. Thus, we can use indices 41 through 81 to represent vectors with a negative z component. Vertices on the edges represent vectors with out a z component, and although we could represent them with a single index, using two keeps the indexing scheme more consistent and, therefore, easier to implement.

    The simple example above requires only 82 values to encode the 66 unique vector directions. If we use an unsigned short to store the encoded direction, then we can use a recursion depth of 6 when generating the vertices. This leads to 16,642 indices representing 16,386 unique directions.

    Once the gradients have been encoded for our volume, we need only compute the illumination once for each possible index and store the results in a table. Since data samples with the same encoded gradient direction may have different colors, this illumination value represents the portion of the shading equation that is independent of color. Each scalar value may have separate colors defined for ambient, diffuse, and specular illumination; therefore, the precomputed illumination is typically an array of values.

    Although using a shading table leads to faster rendering times, there are some limitations to this method. Only infinite light sources can be supported accurately since positional light sources would result in different light vectors for data samples with the same gradient due to their different positions in the volume. In addition, specular highlights are only captured accurately for orthographic viewing directions where the view vector does not vary based on sample position. In practice, positional light sources are often approximated by infinite light sources, and a single view direction is used for computing specular highlights since the need for fast rendering often outweighs the need for accurate illumination.

    Figure 7-22. Gradient direction encoding."},{"location":"VTKBook/07Chapter7/#79-regions-of-interest","title":"7.9 Regions of Interest","text":"

    One difficulty in visualizing volumetric data with the methods presented thus far is that in order to study some feature in the center of the volume we must look through other features in the dataset. For example, if we are visualizing a tomato dataset, then we will be unable to see the seeds within the tomato using a maximum intensity projection because the seeds have lower intensity than the surrounding pulp. Even using a compositing technique, it is difficult to visualize the seeds since full opacity may be obtained before reaching this area of the dataset.

    We can solve the problem of visualizing internal features by defining a region of interest within our volume, and rendering only this portion of the dataset as shown in Figure 7-23. There are many techniques for defining a region of interest. We could use the near and far clipping planes of the camera to exclude portions of the volume. Alternatively, we could use six orthographic clipping planes that would define a rectangular subvolume; we could use a set of arbitrarily oriented half-space clipping planes; or we could define the region of interest as the portion of the volume contained within some set of closed geometric objects. Another approach would be to create an auxiliary volume with binary scalar values that define a mask indicating which values in the volume should be considered during rendering. Figure 7-24. Two volumes rendered with both geometric and volumetric techniques. The Visible Woman CT data is courtesy of The National Library of Medicine.

    All of these region of interest methods are fairly simple to implement using an image-order ray casting approach. As a preprocessing step to ray casting, the ray is clipped against all geometric region definitions. The ray function is then evaluated only along segments of the ray that are within the region of interest. The mask values are consulted at each sample to determine if its contribution should be included or excluded.

    For object-order methods we must determine for each sample whether or not it is within the region of interest before incorporating its contribution into the image. If the underlying graphics hardware is being utilized for the object-order volume rendering as is the case with a texture mapping approach, hardware clipping planes may be available to help support regions of interest.

    "},{"location":"VTKBook/07Chapter7/#710-intermixing-volumes-and-geometry","title":"7.10 Intermixing Volumes and Geometry","text":"

    Although the volume is typically the focus of the image in volume visualization, it is often helpful to add geometric objects to the scene. For example, showing the bounding box of the dataset or the position and orientation of cut planes can improve the viewer's understanding of the volumetric data. Also, it can be useful to visualize volumetric data using both geometric and volumetric methods within the same image. The left image in Figure 7-24 shows a CT scan of a human knee where a contouring method is used to extract the skin isosurface. This isosurface is rendered as triangles using standard graphics hardware. The upper-right portion of the skin is cut to reveal the bone beneath, which is rendered using a software ray casting technique with a compositing ray function. In the right image, the wave function values of an iron protein are visualized using both geometric isosurface and volume rendering techniques.

    When using graphics hardware to perform volume rendering, as is the case with a texture mapping approach, intermixing opaque geometry in the scene is trivial. All opaque geometry is rendered first, then the semi-transparent texture-mapped polygons are blended in a back-to-front order into the image. If we wish to include semi-transparent geometry in the scene, then this geometry and the texture-mapped polygons must be sorted before rendering. Similar to a purely geometric scene, this may involve splitting polygons to obtain a sorted order.

    If a software volume rendering approach is used, such as an object-order splatting method or an image-order ray casting method, opaque geometry can be incorporated into the image by rendering the geometry, capturing the results stored in the hardware depth buffer, and then using these results during the volume rendering phase. For ray casting, we would simply convert the depth value for a pixel into a distance along the view ray and use this to bound the segment of the ray that we consider during volume rendering. The final color computed for a pixel during volume rendering is then blended with the color produced by geometric rendering using the over operator. In an object-order method, we must consider the depth of every sample and compare this to the value stored in the depth buffer at each pixel within the image extent of this sample. We accumulate this sample's contribution to the volume rendered image at each pixel only if the sample is in front of the geometry for that pixel. Finally, the volume rendered image is blended over the geometric image.

    "},{"location":"VTKBook/07Chapter7/#711-efficient-volume-rendering","title":"7.11 Efficient Volume Rendering","text":"

    Rendering a volumetric dataset is a computationally intensive task. If n is the size of the volume on all three dimensions and we visit every voxel once during a projection, the complexity of volume rendering is O(n^3). Even a highly optimized software algorithm will have great difficulty projecting a moderately sized volume of or 512 \\times 512 \\times 512 approximately 134 million voxels at interactive rates. If every voxel in the volume contributes in some way to the final image and we are unwilling to compromise image quality, our options for efficiency improvements are limited. However, it has been observed that many volumetric datasets contain large regions of empty or uninteresting data that are assigned opacity values of during 0 classification. In addition, those areas that contain interesting data may be occupied by coherent or nearly homogeneous regions. There have been many techniques developed that take advantage of these observations.

    Space leaping refers to a general class of efficiency improvement techniques that attempt to avoid processing regions of a volume that will not contribute to the final image. One technique often used is to build an octree data structure which hierarchically contains all of the important regions in the volume. The root node of the octree contains the entire volume and has eight child nodes, each of which represents 1/8 of the volume. These eight subregions are created by dividing the volume in half along the x, y, and z axes. This subdivision continues recursively until a node in the octree represents a homogeneous region of the volume. With an object-order rendering technique, only the nonempty leaf nodes of the octree would be traversed during rendering thereby avoiding all empty regions while efficiently processing all contributing homogeneous regions. Similarly, an image-order ray casting technique would cast rays through the leaf nodes, with the regular structure of the octree allowing us to quickly step over empty nodes.

    A hybrid space leaping technique [Sobierajski95] makes use of graphics hardware to skip some of the empty regions of the volume during software ray casting. First, a polygonal representation is created that completely contains or encloses all important regions in the volume. This polygonal representation is then projected twice -- first using the usual less than operator on the depth buffer and the second time using a greater than operator on the depth buffer. This produces two depth images that contain the closest and farthest distance to relevant data for every pixel in the image. These distances are then used to clip the rays during ray casting.

    An alternate space-leaping technique for ray casting involves the use of an auxiliary distance volume [Zuiderveld92], with each value indicating the closest distance to a non-transparent sample in the dataset. These distance values are used to take larger steps in empty regions of the volume while ensuring that we do not step over any non-transparent features in the volume. Unfortunately, the distance volume is computationally expensive to compute accurately, requires additional storage, and must be recomputed every time the classification of the volume is modified.

    One difficulty with these space-leaping techniques is that they are highly data dependent. On a largely empty volume with a small amount of coherent data we can speed up volume rendering by a substantial amount. However, when a dataset is encountered that is entirely made up of high-frequency information such as a typical ultrasound dataset, these techniques break down and will usually cause rendering times to increase rather than decrease.

    "},{"location":"VTKBook/07Chapter7/#712-interactive-volume-rendering","title":"7.12 Interactive Volume Rendering","text":"

    Generating a volume rendered image may take anywhere from a fraction of a second to tens of minutes depending on a variety of factors including the hardware platform, image size, data size, and rendering technique. If we are generating the image for the purpose of medical diagnostics we clearly would like to produce a high quality image. On the other hand, if the image is produced during an interactive session then it may be more important to achieve a desired rendering update rate. Therefore, it is clear that we need to be able to tradevoff quality for speed as necessary based on application. As opposed to our discussion on efficiency improvements, the techniques described here do not preserve image quality. Instead, they allow a controlled degradation in quality in order to achieve speed.

    Since the time required for image-order ray casting depends mostly on the size of the image in pixels and the number of samples taken along the ray, we can adjust these two values to achieve a desired update rate. The full-size image can be generated from the reduced resolution image using either a nearest neighbor or bilinear interpolation method. If bilinear interpolation is used, the number of rays cast can often be reduced by a factor of two along each image dimension during interaction, resulting in a four-times speed-up, without a noticeable decrease in image quality. Further speed-ups can be achieved with larger reductions, but at the cost of blurry, less detailed images.

    We can implement a progressive refinement method for ray casting if we do not reduce the number of samples taken along each ray. During interaction we can compute only every ray n^{th} along each image dimension and use interpolation to fill in the remaining pixels. When the user stops interacting with the scene the interpolated pixels are progressively filled in with their actual values.

    There are several object-order techniques available for achieving interactive rendering rates at the expense of image quality. If a splatting algorithm is used, then the rendering speed is dependent on the number of voxels in the dataset. Reduced resolution versions of the data can be precomputed, and a level of resolution can be selected during interaction based on the desired frame rate. If we use a splatting method based on an octree representation, then we can include an approximate scalar value and an error value in each parent node where the error value indicates how much the scalar values in the child nodes deviate from the approximate value in the parent node. Hierarchical splatting [Laur91] can be performed by descending the octree only until a node with less than a given error tolerance is encountered. The contribution of this region of the volume on the image can be approximated by rendering geometric primitives for the splat [Shirley90], [Wilhelms91]. Increasing the allowed error will decrease the time required to render the data by allowing larger regions to be approximated at a higher level in the octree.

    When using a texture mapping approach for volume rendering, faster rendering speeds can be achieved by reducing the number of texture-mapped polygons used to represent the volume. This is essentially equivalent to reducing the number of samples taken along the ray in an image-order ray casting method. Also, if texture download rates are a bottleneck, then a reduced resolution version of the volume can be loaded into texture memory for interaction. This is similar to reducing both the number of rays cast and the number of samples taken along a ray in an image-order method.

    "},{"location":"VTKBook/07Chapter7/#713-volume-rendering-future","title":"7.13 Volume Rendering Future","text":"

    In the past two decades, volume rendering has evolved from a research topic with algorithms that required many minutes to generate an image on a high-end workstation to an area of active development with commercial software available for home computers. Yet as the demand for volume rendering increases, so do the challenges. The number of voxels in a typical dataset is growing, both due to advances in acquisition hardware and increased popularity of volume rendering in areas such as simulation and volume graphics [Kaufman93]. New methods are needed in order to satisfy the conflicting needs of high quality images and interactivity on these large datasets. In addition, time dependent datasets that contain volumetric data sampled at discrete time intervals present new challenges for interpolation, image accuracy, and interactivity while providing new opportunities in classification and interpolation methods.

    Most of the volume rendering discussion in this chapter focused on regular volumetric datasets. Although it is clearly possible to extend most ray casting and object-order methods to visualize rectilinear grid, structured grid, and even irregular data, in practice it is difficult to provide both high quality images and interactivity with these methods. Rendering techniques for these data types continues to be an area of active research in volume visualization [Cignoni96], [Silva96], [Wilhelms96].

    "},{"location":"VTKBook/07Chapter7/#714-stereo-rendering","title":"7.14 Stereo Rendering","text":"

    In our practice of computer graphics so far, we have used a number of techniques to simulate 3D graphics on a 2D display device. These techniques include the use of perspective and scale, shading to confer depth, and motion/animation to see all sides of an object. However, one of the most effective techniques to simulate 3D viewing is binocular parallax.

    Binocular parallax is a result of viewing 3D objects with our two eyes. Since each eye sees a slightly different picture, our mind interprets these differences to determine the depth of objects in our view. There have been a number of \"3D\" movies produced that take advantage of our binocular parallax. Typically, these involve wearing a set of special glasses while watching the movie.

    This effect can be valuable in our efforts to visualize complex datasets and CAD models. The additional depth cues provided by stereo viewing aid us in determining the relative positions of scene geometry as well as forming a mental image of the scene. There are several different methods for introducing binocular parallax into renderings. We will refer to the overall process as stereo rendering, since at some point in the process a stereo pair of images is involved.

    Figure 7-25. Stereo rendering and binocular parallax.

    To generate correct left and right eye images, we need information beyond the camera parameters that we introduced in Chapter 3. The first piece of information we need is the separation distance between the eyes. The amount of parallax generated can be controlled by adjusting this distance. We also need to know if the resulting images will be viewed on one or two displays. For systems that use two displays (and hence two view planes), the parallax can be correctly produced by performing camera azimuths to reach the left and right eye positions. Head mounted displays and booms are examples of two display systems. Unfortunately, this doesn't work as well for systems that have only one view plane. If you try to display both the left and right views on a single display, they are forced to share the same view plane as in Figure 7-25. Our earlier camera model assumed that the view plane was perpendicular to the direction of projection. To handle this non-perpendicular case, we must translate and shear the camera's viewing frustum. Hodges provides some of the details of this operation as well as a good overview on stereo rendering [Hodges92].

    Now let's look at some of the different methods for presenting stereoscopic images to the user. Most methods are based on one of two main categories: time multiplexed and time parallel techniques. Time multiplexed methods work by alternating between the left and right eye images. Time parallel methods display both images at once in combination with a process to extract left and right eye views. Some methods can be implemented as either a time multiplexed or a time parallel technique.

    Time multiplexed techniques are most commonly found in single display systems, since they rely on alternating images. Typically this is combined with a method for also alternating which eye views the image. One cost-effective time multiplexed technique takes advantage of existing television standards such as NTSC and PAL. Both of these standards use interlacing, which means that first the even lines are drawn on the screen and then the odd. By rendering the left eye image to the even lines of the screen and the right eye image to the odd, we can generate a stereo video stream that is suitable for display on a standard television. When this is viewed with both eyes, it appears as one image that keeps jumping from left to right. A special set of glasses must be worn so that when the left eye image is being displayed, the user's left eye can see and similarly for the right eye. The glasses are designed so that each lens consists of a liquid crystal shutter that can either be transparent or opaque, depending on what voltage is applied to it. By shuttering the glasses at the same rate as the television is interlacing, we can assure that the correct eye is viewing the correct image.

    There are a couple of disadvantages to this system. The resolutions of NTSC and PAL are both low compared to a computer monitor. The refresh rate of NTSC (60 Hz) and PAL (50 Hz) produces a fair amount of flicker, especially when you consider that each eye is updated at half this rate. Also, this method requires viewing your images on a television, not the monitor connected to your computer.

    To overcome these difficulties, some computer manufacturers offer stereo ready graphics cards. These systems use liquid crystal shuttered glasses to directly view the computer monitor. To obtain the alternating stereo images, the left eye image is rendered to the top half of the screen and the right eye image to the bottom. Then the graphics card enters a special stereo mode where it doubles the refresh rate of the monitor. So a monitor that initially displays both images at 60Hz begins to alternate between the left and right eye at a rate of 120Hz. This results in each eye getting updated at 60Hz, with its original horizontal resolution and half of its original vertical resolution. For this process to work, your application must take up the entire screen while rendering.

    Some more recent graphics cards have a left image buffer and a right image buffer for stereo rendering. While this requires either more memory or a lower resolution, it does provide for stereo rendering without having to take over the entire screen. For such a card, double buffering combined with stereo rendering results in quad buffering, which can result in a large number of bits per pixel. For example: 24 bits for an RGB color, another 24 bits for the back buffer's color, plus 24 bits for the z-buffer results in 72 bits per pixel. Now double that for the two different views and you have 144 bits per pixel or 18 megabytes for a 1K by 1K display.

    Time parallel techniques display both images at the same time. Head-mounted displays and booms have two separate screens, one for each eye. To generate the two video streams requires either two graphics cards or one that can generate two separate outputs. The rendering process then involves just rendering each eye to the correct graphics card or output. Currently, the biggest disadvantage to this approach is the cost of the hardware required.

    In contrast, SIRDS (Single Image Random Dot Stereograms) require no special hardware. Both views are displayed in a single image, as in Figure 7-26. To view such an image the user must focus either in front of, or behind, the image. When the user's focal point is correct, the two triangular cutouts in the top of the image will appear as one and the image should appear focused. This works because dot patterns repeat at certain intervals. Here, only the depth information is present in the resulting image. This is incorporated by changing the interval between patterns just as our ocular disparity changes with depth.

    The next two techniques for stereo rendering can be implemented using either the time parallel or time multiplexed methods. The distinction is slightly blurred because most of the time parallel methods can be multiplexed, though typically there is no advantage to it. Both of these methods have been used by the movie industry to produce \"3D\" movies. The first is commonly called red-blue (or red-green or red-cyan) stereo and requires the user to wear a pair of glasses that filter entering light. The left eye can only see the image through a red filter, the right through a blue filter. The rendering process typically involves generating images for the two views, converting their RGB values into intensity, and then creating a resulting image. This image's red values are taken from the left eye image intensities. Likewise the blue values (a mixture of blue and green) are taken from the right eye image intensities. The resulting image has none of the original hue or saturation, but it does contain both original images' intensities. (An additional note: red-green methods are also used because the human eye is more sensitive to green than blue.) The benefits of this technique are that the resulting images can be displayed on a monitor, paper, or film, and all one needs to view them is an inexpensive pair of glasses.

    Figure 7-26. Single image random dot stereogram of a tetrahedron.

    The second technique is similar to the first but it preserves all the color information from the original images. It separates the different views by using polarized light. Normally, the light we see has a mixture of polarization angles, but there are lenses that can filter out a subset of these angles. If we project a color image through a vertical polarizing filter, and then view it through another vertical filter, we will see the original image, just slightly dimmer because we've filtered out all the horizontally polarized light. If we place a horizontal filter and a vertical filter together, all the light is blocked. Polarized stereo rendering typically projects one eye's image through a vertical filter and the other through a horizontal filter. The user wears a pair of glasses containing a vertical filter over one eye and a horizontal filter over the other. This way each eye views the correct image.

    Figure 7-27. Wireframe image and anti-aliased equivalent.

    All the methods we have discussed for stereo rendering have their advantages and disadvantages, typically revolving around cost and image quality. At the end of this chapter we will look at an example program that renders stereo images using the red-blue technique.

    "},{"location":"VTKBook/07Chapter7/#715-aliasing","title":"7.15 Aliasing","text":"

    At one point or another most computer users have run into aliasing problems. This \"stair-stepping\" occurs because we represent continuous surface geometry with discrete pixels. In computer graphics the most common aliasing problem is jagged edges when rendering lines or surface boundaries, as in Figure 7-27.

    The aliasing problem stems from the rasterization process as the graphics system converts primitives, such as line segments, into pixels on the screen. For example, the quickest way to rasterize a line is to use an all or nothing strategy. If the line passes through the pixel, then the pixel is set to the line's color; otherwise, it is not altered. As can be seen in Figure 7-28, this results in the stair-stepped appearance.

    There are several techniques for handling aliasing problems, and they are collectively known as anti-aliasing techniques. One approach to anti-aliasing is to change how the graphics system rasterizes primitives. Instead of rasterizing a line using an all or nothing approach, we look at how much of the pixel the line occupies. The resulting color for that pixel is a mixture of its original color and the line's color. The ratio of these two colors is determined by the line's occupancy. This works especially well when working primarily with wireframe models. A similar approach breaks each pixel down into smaller sub-pixels. Primitives are rendered using an all or nothing strategy, but at sub-pixel resolutions. Then the sub-pixels are averaged to determine the resulting pixel's color. This tends to require much more memory.

    A good result can be obtained by breaking each pixel into 10 sub-pixels, which requires about 10 times the memory and rendering time. If you don't have access to hardware sub-pixel rendering, you can approximate it by rendering a large image and then scaling it down. Using a program such as pnmscale, which does bilinear interpolation, you can take a 1000 by 1000 pixel image and scale it down to a 500 by 500 anti-aliased image. If you have a graphics library that can render into memory instead of the screen, large images such as 6000 by 6000 pixels can be scaled down into high quality results, still at high resolutions such as 2000 by 2000. This may seem like overkill, but on a standard 600dpi color printer this would result in a picture just over three inches on a side.

    Figure 7-28. A one pixel wide line (outlined in gray) draw using a winner take all approach (left) and a coverage approach (right).

    The last method of anti-aliasing we will look at uses an accumulation buffer to average a few possibly aliased images together to produce one anti-aliased result. An accumulation buffer is just a segment of memory that is set aside for performing image operations and storage. The following fragment of C++ code illustrates this process.

    for (imageNum = 0; imageNum < imageTotal; imageNum++)\n  {\n  //   Jitter the camera and focal point by less than one pixel\n  //   Render an image\n  //   add the image to the accumulation buffer\n  }\n//   Divide the accumulation buffer by imageTotal\n//   Display the resulting anti-aliased image\n

    Instead of using one image with eight sub-pixels per pixel, we can use eight images without sub-pixels. The anti-aliasing is achieved by slightly translating the camera's position and focal point between each image. The amount of translation should be within one pixel of magnitude and perpendicular to the direction of projection. Of course, the camera's position is specified in world coordinates not pixels, but Equation7-13 will do the trick. We calculate the new camera position and focal point (i.e., p~new~ and f~new~) from the offset to avoid difficulties surrounding the transformation matrix at the camera's position.

    \\begin{eqnarray*} \\vec{f}_\\text{new} &=& \\left(\\vec{f}\\cdot \\textbf{M}_\\text{WD} + \\vec{O}_\\text{p}\\right)\\cdot \\textbf{M}_\\text{DW} \\\\ \\vec{O}_\\text{w} &=& \\vec{f}_\\text{new} - \\vec{f} \\\\ \\vec{p}_\\text{new} &=& \\vec{p} + \\vec{O}_\\text{w} \\end{eqnarray*} \\bf\\tag{7-13} Figure 7-29. Three images showing focal depth. The first has no focal depth, the second is focused on the center object, the third image is focused on the farthest object.

    In this equation is O_p the offset in pixel coordinates, O_w is the offset in world coordinates, f camera focal point, p is the camera position, and the transformation matrices M_{WD} and $M_(DW} transform from world coordinates to display coordinates and from display coordinates to world coordinates, respectively.

    "},{"location":"VTKBook/07Chapter7/#716-camera-tricks","title":"7.16 Camera Tricks","text":"

    In the previous section we saw how to combine an accumulation buffer and small camera translations to produce an anti-aliased image. In this section we will cover a few other camera techniques of interest. You may have noticed that with computer generated images all actors are in focus. With a real camera you have to set the focal depth to match the distance of the object you are photographing. Anything that is closer or farther than your focal depth will appear out of focus. This is because a real camera has a lens that lets light pass through a finite area. The camera model we have introduced has a point lens, where all the light travels through at exactly the same point. (See Figure 7-29 for a comparison.)

    We can simulate a finite camera lens by rendering many images, each with a slightly different camera position but the same focal point. Then we accumulate these images and take the average. The resulting image simulates a camera lens with focal depth. The different camera positions are determined by selecting random points from the lens you are trying to simulate. Larger diameter lenses will produce more distortion and vice versa. Increasing the number of random points will improve the precision of your result. Typically 10 to 30 samples is desirable. The images in Figure 7-29 were created using 30 sample points.

    Another difference between a real camera and a computer camera is in the shutter speed. Our model generates an image for a single moment in time; in contrast, a photograph captures what the camera views while its shutter is open. Fast moving objects appear blurred because of changes in their position during the small time that the shutter is open. This effect, known as motion blur, can also be simulated with our camera model ( Figure 7-30 ). Instead of rendering one image and displaying it, we render a few sub-frames that are accumulated, averaged, and finally displayed. This is similar to the anti-aliasing and focal depth techniques that we just discussed. In both of those techniques, the camera is jittered while the actors remain fixed in time. To implement motion blur we don't jitter the camera; we increment the scene's time between each sub-frame. Moving objects or camera movements will result in differences between each sub-frame. The resulting image approximates the effects of photographing moving objects over a finite time. Figure7-30. Motion blur. Rapidly moving objects appear blurry when recorded on film or videotape. To simulate motion blur with a computer camera, multiple images (or sub-frames) can be accumulated and averaged. This figure was generated by accumulating 21 sub-frames."},{"location":"VTKBook/07Chapter7/#717-mouse-based-interaction","title":"7.17 Mouse-Based Interaction","text":"

    There's no doubt that being able to interactively view an object aids in understanding and recognizing its important features. Using a pointing device (e.g., a mouse or trackball) is certainly the most common method for controlling such movements. The software that accompanies this book contains the vtkRenderWindowInteractor object that translates mouse and keyboard events into modifications to the camera and actors. For example, while the user holds the left mouse button down, the vtkRenderWindowInteractor rotates the camera towards the current pointer position. The farther the pointer is from the center of the window, the faster the camera rotates.

    Most of these interactions are straightforward, but there are a few issues associated with rotations. When rotating around an object, one must decide what to do with the view-up vector. We can keep it perpendicular to the direction of projection as we rotate, or we can leave it unchanged. This results in two different types of rotations. If we keep our view-up vector orthogonal to the direction of projection, we will rotate all around the object much like a plane flying around the globe. This is shown in the left half of Figure 7-31. If we leave the view-up vector unchanged, our plane will start flying backwards at the north and south poles, as shown in the right half of Figure 7-31.

    The advantage of a constant view-up vector is that some objects have a natural sense of up and down (e.g., terrain). Elevation and azimuth operations remain consistent as we move around the object. On the other hand, there are singular points where the view-up vector and direction of projection become parallel. In these cases the camera viewing transformation matrix is undefined. Then we have to modify the view-up vector or use the perpendicular view-up / direction of projection method to handle this situation. If the data you are working with has a well-defined up and down, then it probably makes sense to leave the view-up constant during rotations; otherwise, it makes sense to keep it orthogonal to the direction of projection.

    Figure 7-31. Rotations using an orthogonalized view-up vector (left) and a constant view-up vector (right)."},{"location":"VTKBook/07Chapter7/#718-3d-widgets-and-user-interaction","title":"7.18 3D Widgets and User Interaction","text":"

    Chapter 3 provided an introduction to interaction techniques for graphics (see \"RenderWindowInteractor\"). In the context of visualization, interaction is an essential feature of systems that provide methods for data exploration and query. The classes vtkRenderWindowInteractor and vtkInteractorStyle are core constructs used in VTK to capture windowing-system specific events in the render window, translate them into VTK events, and then take action as appropriate to that event invocation. In Chapter 3 we saw how these classes could be used to manipulate the camera and actors to interactively produce a desired view. This functionality, however, is relatively limited in its ability to interact with data. For example, users often wish to interactively control the positioning of streamline starting points, control the orientation of a clipping plane, or transform an actor. While using interpreted languages (see \"Interpreted Code\") can go a long way to provide this interaction, in some situations the ability to see what you are doing when placing objects is essential. Therefore, it is apparent that a variety of user interaction techniques is required by the visualization system if it is to successfully support real-world applications.

    3D widgets are a logical extension of the pervasive 2D widgets found on most computer systems, providing interactive capabilities similar to their 2D counterparts except that they function in the richer 3D space. 3D widgets are capable of providing the variety of user interaction techniques required by a visualization system. Unlike 2D widgets, however, 3D widgets are relatively new technology, and because their application is in the context of a richer space, there is no consensus as to what widgets might constitute a complete set of functionality. Several popular 3D widget sets, and the University of Utah's SCIRUN 3D widgets [Purciful95], have distinctly different components in their widget toolbox. The widget sets vary according to the perceived purpose of the graphical environment in which they exist for example Open Inventor [Wernecke94], the Brown University 3D Widgets Library [Zeleznik93],

    3D widgets are a recent addition (see Figure 7-32 ) to VTK. In principal, the core functionality is simple: events captured by the vtkRenderWindow are in turn translated into VTK events. Observers which have registered themselves with the vtkRenderWindow receive these VTK events, take the appropriate action, and then may either pass the event along to the next observer in the list, or abort further processing of the event. (Note: observers can be prioritized according to the order in which they wish to receive events.)

    It is the implementation of 3D widgets, that is, what they can do with the events, that makes them so powerful. As Figure 7-32 shows, widgets typically provide a representation in the scene that can be selected and manipulated. For example, a vtkLineWidget can be used to position a rake of streamline seed points and represents itself with a thick line (tube) and two spherical end points. Widgets also may directly manipulate an underlying class---the vtkScalarBarWidget enables the user to interactively size, orient (horizontal or vertical), and position a vtkScalarBar. Widgets also provide additional functionality such as managing an internal implicit function or transformation matrix (e.g., vtkBoxWidget). The following is a list of widgets currently found in VTK and a brief description of their capabilities.

    • vtkScalarBarWidget --- manage a vtkScalarBar including positioning, scaling, and orienting it.

    • vtkPointWidget --- position a point x-y-z location in 3D space. The widget produces a polygonal output.

    • vtkLineWidget --- place a straight line with a specified subdivision resolution. The widget produces a polygonal output.

    • vtkPlaneWidget --- orient and position a finite plane. The plane resolution is variable and the widget produces an implicit function and a polygonal output.

    • vtkImplicitPlaneWidget --- orient and position an unbounded plane. The widget produces an implicit function and a polygonal output. The polygonal output is created by clipping the plane with a bounding box.

    • vtkBoxWidget --- orient and position a bounding box. The widget produces an implicit function and a transformation matrix.

    • vtkImagePlaneWidget --- manipulate three orthogonal planes within a 3D volumetric data set. Probing of the planes to obtain data position, pixel value, and window-level is possible.

    • vtkSphereWidget --- manipulate a sphere of variable resolution. The widget produces an implicit function, a transformation matrix, and enables the control of focal point and position to support such classes as vtkCamera and vtkLight.

    • vtkSplineWidget --- manipulate an interpolating 3D spline. The widget produces a polygonal data represented by a series of line segments of specified resolution. The widget also directly manages underlying splines for each of the x-y-z coordinate values.

    The key to widget design is careful implementation of intuitive, simple user interaction techniques. For example, the end points on the vtkLineWidget (represented as small spheres) can be selected and dragged to a new position. The vtkLineWidget supports the modifier \"Shift\" key to lock motion of the end points along the coordinate x-y-z axes. The initial direction of motion is used to determine which of the axes the user is moving the end point along. Such attention to detail is essential to successful widget design and will continue to change as the technology evolves in the future.

    vtkScalarBarWidget vtkPointWidget vtkLineWidget vtkPlaneWidget vtkImplicitPlaneWidget vtkBoxWidget vtkImagePlaneWidget vtkSphereWidget vtkSplineWidget Figure 7-32. Application of some 3D widgets found in VTK."},{"location":"VTKBook/07Chapter7/#719-putting-it-all-together","title":"7.19 Putting It All Together","text":"

    This chapter has covered a wide variety of topics. In this section we demonstrate applications of each topic to some simple problems.

    "},{"location":"VTKBook/07Chapter7/#texture-mapping","title":"Texture Mapping","text":"

    Figure 7-33 shows the complete source code for a simple texture mapping example. You will notice that most of the code is similar to what we used in the preceding examples. The key step here is the creation of a vtkTexture object. This object interfaces between its data input and the texture mapping functions of the graphics library. The vtkTexture instance is associated with an actor. More than one texture instance may be shared between multiple actors. For texture mapping to function properly, texture coordinates must be defined by the actor's modeller.

    One interesting note regarding the vtkTexture object. Instances of this class are mappers that have an Input instance variable that is updated during each render. The input type is a vtkImageData dataset type. Thus, a visualization pipeline can be constructed to read, process, and/or generate the texture map. This includes using the object vtkRendererSource , which converts the renderer's image into an image data dataset. The input texture map can be either 2D (a pixmap) or 3D (a volume).

    A few words of warning when using textures. Some renderers only support 2D texture, or may not support alpha textures. Also, many rendering systems require that each dimension of the image dataset is an exact power of two. In VTK, non-power of two textures are automatically converted to power of two at the expense of extra computation.

    "},{"location":"VTKBook/07Chapter7/#volume-rendering","title":"Volume Rendering","text":"

    This example focuses on volume rendering. The source code shown in example Figure 7-34 begins by creating the usual objects. Then we use a vtkStructuredPointsReader to read in a volume dataset for a high potential iron protein. We create a vtkPiecewiseFunction object to map the scalar values in the volume dataset to opacity, and a vtkColorTransferFunction object to map the scalar values to color. These two transfer functions are referenced from the [vtkVolume](https://www.vtk.org/doc/nightly/html/classvtkVolume.html#details)Property object. In addition, we use the ShadeOn() method of [vtkVolume](https://www.vtk.org/doc/nightly/html/classvtkVolume.html#details)Property to enable shading for this volume, and the SetInterpolationTypeToLinear() method to request trilinear interpolation. Since we are using a ray casting approach, we need to create a ray function. In this example we use a vtkVolumeRayCastCompositeFunction object for this purpose. The output of the reader is given to the vtkVolumeRayCastMapper as the scalar input, and the SetVolumeRayCastFunction() method is used to assign the ray function. The vtkVolume object is quite similar to a vtkActor, and the SetVolumeMapper() and SetVolumeProperty() methods are used just like the SetMapper() and SetProperty() methods of vtkActor. Finally, we add this volume to the renderer, adjust the camera, set the desired image update rate and start the interactor.

    To produce a maximum intensity projection in Figure 7-34, we would simply change the type of the ray function to a vtkVolumeRayCastMIPFunction. We could also produce a surface image using a vtkVolumeRayCastIsosurfaceFunction where the IsoValue instance variable would be set to define the surface.

    vtkBMPReader bmpReader\n  bmpReader SetFileName \"$VTK_DATA_ROOT/Data/masonry.bmp\"\nvtkTexture atext\n atext SetInputConnection [bmpReader GetOutputPort]\n atext InterpolateOn\n\nvtkPlaneSource plane\nvtkPolyDataMapper planeMapper\n  planeMapper SetInputConnection [plane GetOutputPort]\nvtkActor planeActor\n  planeActor SetMapper planeMapper\n  planeActor SetTexture atext\n\nvtkRenderer ren1\nvtkRenderWindow renWin\n renWin AddRenderer ren1\nvtkRenderWindowInteractor iren\n  iren SetRenderWindow renWin\n\n#   Add the actors to the renderer ]\nren1 AddActor planeActor\n
    Figure 7-33. Example of texture mapping. See TexturePlane.cxx and TexturePlane.py."},{"location":"VTKBook/07Chapter7/#red-blue-stereo","title":"Red-Blue Stereo","text":"

    In our first example, we will be looking at using red-blue stereo rendering. We start off with the example shown in Figure 7-35, which renders something akin to a mace. Then, in Figure 7-35 we add in red-blue stereo rendering by adding two lines near the bottom that invoke the StereoRenderOn() and SetStereoType() methods. Once these two methods have been invoked, further rendering will be done in stereo. The picture in the upper right corner displays a grayscale version of the resulting image."},{"location":"VTKBook/07Chapter7/#motion-blur","title":"Motion Blur","text":"

    In our second example, we show how to simulate motion blur using the Visualization Toolkit. As shown in Figure 7-36, we begin with our previous example. We then remove the two lines controlling stereo rendering and add a few lines to create another mace. We position the first mace in the top of the rendering window and the second mace at the bottom. We then use the SetSubFrames() method to start performing subframe accumulation. Here, we will perform 21 renders to produce the final image. For motion blur to be noticeable, something must be moving, so we set up a loop to rotate the bottom mace by two degrees between each subframe. Over the 21 sub frames it will rotate 40 degrees from its initial position. It is important to remember that the resulting image is not displayed until the required number of sub frames have been rendered.

    #  Create the standard renderer, render window and interactor\nvtkRenderer ren1\nvtkRenderWindow renWin\n  renWin AddRenderer ren1\nvtkRenderWindowInteractor iren\n   iren SetRenderWindow renWin\n\n#  Create the reader for the data\nvtkStructuredPointsReader reader\n  reader SetFileName \"$VTK_DATA_ROOT/Data/ironProt.vtk\"\n\n#  Create transfer mapping scalar value to opacity\nvtkPiecewiseFunction opacityTransferFunction\n  opacityTransferFunction AddPoint 20 0.0\n  opacityTransferFunction AddPoint 255 0.2\n\n# Create transfer mapping scalar value to color\nvtkColorTransferFunction colorTransferFunction\n  colorTransferFunction AddRGBPoint 0.0 0.0 0.0 0.0\n  colorTransferFunction AddRGBPoint 64.0 1.0 0.0 0.0\n  colorTransferFunction AddRGBPoint 128.0 0.0 0.0 1.0\n  colorTransferFunction AddRGBPoint 192.0 0.0 1.0 0.0\n  colorTransferFunction AddRGBPoint 255.0 0.0 0.2 0.0\n\n#   The property describes how the data will look\nvtkVolumeProperty volumeProperty\n  volumeProperty SetColor colorTransferFunction\n  volumeProperty SetScalarOpacity opacityTransferFunction\n  volumeProperty ShadeOn\n  volumeProperty SetInterpolationTypeToLinear\n\n#  The mapper / ray cast function know how to render the data\nvtkVolumeRayCastCompositeFunction compositeFunction\nvtkVolumeRayCastMapper volumeMapper\n  volumeMapper SetVolumeRayCastFunction compositeFunction\n  volumeMapper SetInputConnection [reader GetOutputPort]\n\n# Set the mapper and the property and\nvtkVolume volume\n  volume SetMapper volumeMapper\n  volume SetProperty volumeProperty\n\nren1 AddVolume volume\nrenWin Render\n
    Figure 7-34. Volume rendering of a high potential iron protein. See SimpleRayCast.cxx and SimpleRayCast.py.
    vtkRenderer *ren1 = vtkRenderer::New();\nvtkRenderWindow *renWin =\n      vtkRenderWindow::New();\n  renWin->AddRenderer(ren1);\nvtkRenderWindowInteractor *iren =\n       vtkRenderWindowInteractor::New();\n  iren->SetRenderWindow(renWin);\n\n//   create the pipline, ball and spikes\nvtkSphereSource *sphere =\n      vtkSphereSource::New();\n  sphere->SetThetaResolution(7);\n  sphere->SetPhiResolution(7);\nvtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\nvtkActor*sphereActor = vtkActor::New();\n  sphereActor->SetMapper(sphereMapper);\n\nvtkConeSource *cone = vtkConeSource::New();\n  cone->SetResolution(5);\nvtkGlyph3D *glyph = vtkGlyph3D::New();\n  glyph->SetInputConnection(sphere->GetOutputPort());\n  glyph->SetSourceConnection(cone->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleModeToScaleByVector(); glyph->SetScaleFactor(0.25);\nvtkPolyDataMapper *spikeMapper = vtkPolyDataMapper::New();\n  spikeMapper->SetInputConnection(glyph->GetOutputPort());\nvtkActor *spikeActor = vtkActor::New();\n  spikeActor->SetMapper(spikeMapper);\n\nren1->AddActor(sphereActor);\nren1->AddActor(spikeActor);\nren1->SetBackground(0.2,0.3,0.4);\nrenWin->SetSize(300,300);\n\nrenWin->Render();\nren1->GetActiveCamera()->Zoom(1.4);\nrenWin->StereoRenderOn();\nrenWin->SetStereoTypeToRedBlue();\nrenWin->Render();\n
    Figure 7-35. An example of red-blue stereo rendering.
    //changes and additions to the\n// preceding example's source\nvtkActor *spikeActor2 = vtkActor::New();\n  spikeActor2->SetMapper(spikeMapper);\n\nspikeActor2->SetPosition(0,-0.7,0);\nsphereActor2->SetPosition(0,-0.7,0);\n\nren1->AddActor(sphereActor2);\nren1->AddActor(spikeActor2);\n\n// zoom in a little ren1->GetActiveCamera()->Zoom(1.5);\nrenWin->SetSubFrames(21);\n\nfor (i = 0; i <= 1.0; i = i + 0.05)\n  {\n  spikeActor2->RotateY(2);\n  sphereActor2->RotateY(2);\n  renWin->Render();\n}\n\niren->Start();\n
    Figure 7-36. Example of motion blur. See MotionBlur.cxx and MotionBlur.py."},{"location":"VTKBook/07Chapter7/#focal-depth","title":"Focal Depth","text":"

    Now we will change the previous example to illustrate focal depth. First, we change the position of the bottom mace, moving it farther away from us. Since it is farther away it will appear smaller, so we scale it by a factor of two to maintain reasonable image size. We then remove the code for rendering the sub frames and instead set the number of frames for focal depth rendering. We also set the camera's focal point and focal disk to appropriate values. The resulting image and the required changes to the source code are shown in Figure 7-37. Figure 7-37. Contouring examples. See CameraBlur.cxx and CameraBlur.py."},{"location":"VTKBook/07Chapter7/#vtklinewidget","title":"vtkLineWidget","text":"

    There are a variety of 3D widgets in VTK all of which function in a similar fashion. 3D widgets are a subclass of vtkInteractorObserver meaning that they are associated with a vtkRenderWindow and observe events in the render window (). (Note: vtkInteractorStyle---see \"RenderWindowInteractor\") ---is also a subclass of vtkInteractorObserver. The interactor style differs from a 3D widget in that it does not have a representation in the scene.) The following example shows the general approach to using a 3D widget using vtkLineWidget as an example (Figure 7-39). First the widget is instantiated and then placed. Placing means positioning, scaling, and orienting the widget consistent with the object on which they operate. By default, widgets are enabled with a \"keypress-i\" event, but the specific event to enable the widget can be modified.

    Figure 7-38. Partial class hierarchy for 3D widgets. Each 3D widget observes a particular vtkRenderWindow similar to vtkInteractorStyle. Unlike the vtkInteractorStyle which is used to manipulate the camera, 3D widgets have a representation in the scene that can be directly manipulated. More than one vtkInteractorObserver can watch a vtkRenderWindow at a given time, so classes like vtkInteractorEventRecorder can record an event and pass them on to the next vtkInteractorObserver observing the vtkRenderWindow.

    The widget interfaces with the application through the command/observer event handling mechanism (see \"Events and Observers\". 3D widgets invoke several events, the most important being the StartInteractionEvent, InteractionEvent, and EndInteractionEvent. These events are typically invoked, for example, on mouse down, mouse move, and mouse up, respectively. In the example shown here, Tcl procedures are tied to the StartInteractionEvent and InteractionEvent using the AddObserver() method to produce streamlines as the widget is manipulated. Note that the streamline is seeded with a polygonal dataset each time an InteractionEvent is invoked using the GetPolyData() method. The pipeline update mechanism then automatically executes on the next render since the input to the streamline is modified.

    Figure 7-39 Using the vtkLineWidget to produce streamtubes in the combustor dataset. The StartInteractionEvent turns the visibility of the streamlines on; the InteractionEvent causes the streamlines to regenerate themselves ( LineWidget.tcl ).

    "},{"location":"VTKBook/07Chapter7/#720-chapter-summary","title":"7.20 Chapter Summary","text":"

    Alpha opacity is a graphics method to simulate transparent objects. Compositing is the process of blending translucent samples in order. Alpha compositing requires the data to be ordered properly.

    Texture mapping is a powerful technique to introduce additional detail into an image without extensive geometric modelling. Applying 2D texture maps to the surface of an object is analogous to pasting a picture. The location of the texture map is specified via texture coordinates.

    Volume rendering is a powerful rendering technique to view the interior of inhomogeneous objects. Most volume rendering techniques can be classified as image-order or object-order, although some are a combination of the two while others do not fall into either category. Object-order techniques generally composite voxels in front-to-back or back-to-front order. Image-order techniques cast rays through pixels in the image plane to sample the volume. Other methods may traverse both the image and the volume at the same time or may operate in the frequency domain. For effective visualization of volumetric data, classification and shading are important considerations. Regions of interest may be used to reduce the amount of data visible in an image. Due to the complexity of volume rendering algorithms, efficiency and methods that allow for interactivity are critical.

    Stereo rendering techniques create two separate views for the right and left eyes. This simulates binocular parallax and allows us to see depth in the image. Time multiplexed techniques alternate left and right eye views in rapid succession. Time parallel techniques display both images at the same time.

    Raster devices often suffer from aliasing effects. Anti-aliasing techniques are used to minimize the effects of aliasing. These techniques create blended images that soften the boundary of hard edges.

    By using an accumulation buffer we can create interesting effects, including motion blur and focal blur. In motion blurring we accumulate multiple renders as the actors move. To simulate focal blur, we jitter the camera position and hold its focal point constant.

    Effective visualizations are inherently interactive. Not only are camera manipulation models required for different types of data, but methods to interact, query, and modify data are essential. 3D widgets are important contributions to this end. They provide intuitive graphical interface to the data through a representation in the scene that can be easily manipulated. 3D widgets also generate supplemental information such as implicit functions, output polygonal data, and transformation matrices that may be applied to objects in the scene.

    "},{"location":"VTKBook/07Chapter7/#721-bibliographic-notes","title":"7.21 Bibliographic Notes","text":"

    An overview of volume rendering and volume visualization techniques can be found in a tutorial by Kaufman [Kaufman91]. Many of the volume rendering techniques discussed in this chapter are also accessible from research institutions as source code. The shear-warp algorithm is provided within the VolPack rendering library and is available on the Web at graphics.stanford.edu/software/volpack/. SUNY Stony Brook offers a turnkey volume visualization system called VolVis to nonprofit and government organizations. Source code and executable versions are available at http://www.cs.sunysb.edu/\\~volvis. In addition, an application called Vis5D is available that applies volume visualization techniques to time varying atmospheric weather data. Vis5D may be obtained from the Web location http://vis5d.sourceforge.net. A commercial volume rendering application, VolView, developed on top of The Visualization Toolkit, is available from Kitware for a 30-day trial at http://www.kitware.com/products/volview.html

    "},{"location":"VTKBook/07Chapter7/#722-references","title":"7.22 References","text":"

    [Cabral94] B. Cabral, N. Cam, J. Foran. \"Accelerated Volume Rendering and Tomographic Reconstruction Using Texture Mapping Hardware.\" In Proceedings of 1994 Symposium on Volume Visualization. pp. 91--98, October 1994.

    [Cignoni96] P. Cignoni, C. Montani, E. Puppo, R. Scopigno. \"Optimal Isosurface Extraction from Irregular Volume Data.\" In Proceedings of 1996 Symposium on Volume Visualization. pp. 31--38, IEEE Computer Society Press, Los Alamitos, CA, October 1996.

    [Drebin88] R. A. Drebin, L. Carpenter, P. Hanrahan. \"Volume Rendering.\" Computer Graphics. 22(4):64--75 (Siggraph 1988).

    [Hodges92] L. F. Hodges. \"Tutorial: Time-Multiplexed Stereoscopic Computer Graphics.\" IEEE Computer Graphics & Applications. March 1992.

    [Kaufman91] A. Kaufman (ed.). Volume Visualization. IEEE Computer Society Press, Los Alamitos, CA, 1991.

    [Kaufman93] A. Kaufman, R. Yagel, D. Cohen. \"Volume Graphics.\" IEEE Computer. 26(7):51--64, July 1993.

    [Kelly94] M. Kelly, K. Gould, S. Winner, A. Yen. \"Hardware Accelerated Rendering of CSG and Transparency.\" Computer Graphics (SIGGRAPH '94 ). pp. 177-184.

    [Kikinis96] R. Kikinis, M. Shenton, D. Iosifescu, R. McCarley, P. Saiviroonporn, H. Hokama, A. Robatino, D. Metcalf, C. Wible, C. Portas, R. Donnino, F. Jolesz. \"A Digital Brain Atlas for Surgical Planning, Model Driven Segmentation and Teaching.\" IEEE Transactions on Visualization and Computer Graphics. 2(3), September 1996.

    [Krueger91] W. Krueger. \"The Application of Transport Theory to Visualization of 3D Scalar Data Fields.\" Computers in Physics. pp. 397-406, July/August 1994.

    [Lacroute94] P. Lacroute and M. Levoy. \"Fast Volume Rendering Using a Shear-Warp Factorization of the Viewing Transformation.\" In Proceedings of SIGGRAPH '94. pp. 451-458, Addison-Wesley, Reading, MA, 1994.

    [Laur91] D. Laur and P. Hanrahan. \"Hierarchical Splatting: A Progressive Refinement Algorithm for Vol-ume Rendering.\" In Proceedings of SIGGRAPH '91. 25:285--288, 1991.

    [Levoy88] M. Levoy. \"Display of Surfaces from Volumetric Data.\" IEEE Computer Graphics & Applica-lions. 8(3), pp. 29--37, May 1988.

    [Purciful95] J.T. Purciful. \\\"Three-Dimensional Widgets for Scientific Visualization and Animation.\\\" Masters Thesis, Dept. of Computer Science, UN iv. of Utah, 1995.

    [Shirley90] P. Shirley and A. Tuchman. \"A Polygonal Approximation to Direct Volume Rendering.\" Comput-er Graphics. 24(5):63--70, 1990.

    [Silva96] C. Silva, J. S. B. Mitchell, A. E. Kaufman. \"Fast Rendering of Irregular Grids.\" In Proceedings of 1996 Symposium on Volume Visualization. pp. 15--22, IEEE Computer Society Press, Los Alamitos, CA, October 1996.

    [Sobierajski95] L. Sobierajski and R. Avila. \"A Hardware Acceleration Method for Volumetric Ray Tracing.\" In Proceedings of Visualization '95. pp. 27-34, IEEE Computer Society Press, Los Alamitos, CA, October 1995.

    [Totsuka92] T. Totsuka and M. Levoy. \"Frequency Domain Volume Rendering.\" Computer Graphics (SIG-GRAPH '93). pp. 271--278, August 1993.

    [Wernecke94] J. Wernecke. The Inventor Mentor. Addison-Wesley, Reading MA,1994.

    [Westover90] L. Westover. \"Footprint Evaluation for Volume Rendering.\" Computer Graphics (SIGGRAPH '90). 24(4):36, 1990.

    [Wilhelms91] J. Wilhelms and A. Van Gelder. \"A Coherent Projection Approach for Direct Volume Rendering.\" Computer Graphics (SIGGRAPH '91). 25(4):275--284, 1991.

    [Wilhelms96] J. P. Wilhelms, A. Van Gelder, P. Tarantino, J. Gibbs. \"Hierarchical and Parallelizable Direct Vol-ume Rendering for Irregular and Multiple Grids.\" In Proceedings of Visualization '96. pp. 73-80, IEEE Computer Society Press, Los Alamitos, CA, October 1996.

    [Yagel92a] R. Yagel, D. Cohen, and A. Kaufman. \"Normal Estimation in 3D Discrete Space.\" The Visual Computer. pp. 278--291, 1992.

    [Yagel92b] R. Yagel and A. Kaufman. \"Template-based Volume Viewing.\" In Proceedings of Eurographics '92. pp. 153--167, September 1992.

    [Zeleznik93] R. C. Zeleznik, K. P. Herndon, D. C. Robbins, N. Huang, T. Meyer, N. Parker, J. F. Hughes. \"An Interactive Toolkit for Constructing 3D Interfaces.\" Computer Graphics (Proceedings of Siggraph '93). 27(4):81--84. July 1993.

    [Zuiderveld92] K. J. Zuiderveld, A. h. j. Koning, and M. A. Viergever. \"Acceleration of Ray-Casting Using 3D Distance Transforms.\" In Proceedings of Visualization and Biomedical Computing, pp. 324--335, October 1992.

    "},{"location":"VTKBook/07Chapter7/#723-exercises","title":"7.23 Exercises","text":"

    7.1 In astronomy, photographs can be taken that show the movements of the stars over a period of time by keeping the camera's shutter open. Without accounting for the rotation of the earth, these photographs display a swirl of circular arcs all centered about a common point. Such time lapse photography is essentially capturing motion blur. If we tried to simulate these images using the motion blur technique described in this chapter, they would look different from the photographs. Why is this? How could you change the simple motion blur algorithm to correct this?

    7.2 In Figure 7-25 we show the difference between stereo rendering with two or one view planes. If you were viewing a rectangle head-on (its surface normal parallel to your direction), what artifacts would be introduced by rendering onto one view plane while using the equations for two planes?

    7.3 On some graphics systems transparent objects are rendered using a technique called screen door transparency. Basically, every pixel is either completely opaque or completely transparent. Any value in between is approximated using dithering. So a polygon that was 50 percent opaque would be rendered by drawing only half of the pixels. What visual artifacts does this introduce? What blending problems can arise in using such a technique?

    7.4 In this chapter we describe a few different techniques for anti-aliased rendering. One technique involved rendering a large image and then scaling it down to the desired size using bilinear interpolation. Another technique involved rendering multiple images at the desired size using small camera movements and then accumulating them into a final image. When rendering a model with a surface representation, these two techniques will produce roughly the same result. When rendering a model with a wireframe representation there will be significant differences. Why is this?

    7.5 You need to create a small image of a volume dataset to include on your web page. The dataset contains voxels,512 and the desired image size is pixels.You100can use a software object-order method that projects each voxel onto the image, or a software ray casting method that casts one ray for each pixel. Assuming that identical images are created, which method would you select, and why? 7.6 Two software developers implement volume rendering methods. The first developer uses a software ray casting approach, while the second uses a graphics hardware texture mapping approach. The grayscale images are generated and displayed on a workstation with an 8 bit frame buffer (256 levels of gray). They both use the same interpolation method and the same compositing scheme, yet the two methods produce different images even though the same number of samples from identical locations were used to generate the images. Why is this?

    7.7 In the classification of some medical dataset, scalar values from 100 to 200 represent skin, 200 to 300 represent muscle and 300 to 400 represent bone. The color transfer functions define skin as tan, muscle as red, and bone as white. If we interpolate scalar value and then perform classification, what classification artifacts may appear in the image?

    7.8 The normal encoding example illustrated in Figure 7-22 produced 82 indices at a recursion depth of two, which would require seven bits of storage. If we instead use a recursion depth of three, how many indices are there? How many unique vector directions does this represent? How many bits of storage does this require?

    7.9 Writing an object-order back-to-front projection algorithm is more difficult for a perspective viewing transformation than a parallel viewing transformation. Explain why this is and draw a 2D diagram of the volume and the viewing frustum that illustrates the issues.

    "},{"location":"VTKBook/08Chapter8/","title":"Chapter 8 - Advanced Data Representation","text":"

    This chapter examines advanced topics in data representation. Topics include topological and geometric relationships and computational methods for cells and datasets.

    "},{"location":"VTKBook/08Chapter8/#81-coordinate-systems","title":"8.1 Coordinate Systems","text":"

    We will examine three different coordinate systems: the global, dataset, and structured coordinate systems. Figure 8-1 shows the relationship between the global and dataset coordinate systems, and depicts the structured coordinate system. Figure 8-1. Local and global coordinate systems."},{"location":"VTKBook/08Chapter8/#global-coordinate-system","title":"Global Coordinate System","text":"

    The global coordinate system is a Cartesian, three-dimensional space. Each point is expressed as a triplet of values (x,y,z) along the x, y, and z axes. This is the same system that was described in \"Coordinate Systems\" in Chapter 3 - Computer Graphics Primer).

    The global coordinate system is always used to specify dataset geometry (i.e., the point coordinates), and data attributes such as normals and vectors. We will use the word \"position\" to indicate that we are using global coordinates.

    "},{"location":"VTKBook/08Chapter8/#dataset-coordinate-system","title":"Dataset Coordinate System","text":"

    The dataset, or local, coordinate system is based on combined topological and geometric coordinates. The topological coordinate is used to identify a particular cell (or possibly a subcell), and the geometric coordinate is used to identify a particular location within the cell. Together they uniquely specify a location in the dataset. Here we will use the word \"location\" to refer to local or dataset coordinates.

    The topological coordinate is an \"id\": a unique, nonnegative integer number referring to either a dataset point or cell. For a composite cell, we use an additional \"sub-id\" to refer to a particular primary cell that composes the composite cell. The sub-id is also unique and nonnegative. The id and sub-id together select a particular primary cell.

    To specify a location within the primary cell, we use geometric coordinates. These geometric coordinates, or parametric coordinates, are coordinates \"natural\" or canonical to the particular topology and dimension of a cell.

    We can best explain local coordinates by referring to an example. If we consider the polyline cell type shown in Figure 8-2, we can specify the position of a point by indicating 1) the polyline cell id, 2) the primary cell (i.e., line) sub-id and 3) the parametric coordinate of the line. Because the line is one-dimensional, the natural or parametric coordinate is based on the one-dimensional parameter r. Then any point along the line is given by a linear combination of the two end points of the line x_i and x_{i+1} \\begin{equation*} x(r) = (1 - r) x_i + r x_{i + 1} \\end{equation*} \\bf\\tag{8-1}

    where the parametric coordinate r is constrained between (0,1). In this equation we are assuming that the sub-id is equal to i.

    The number of parametric coordinates corresponds to the topological dimension of the cell. Three-dimensional cells will be characterized by the three parametric coordinates (r, s, t). For cells of topological order less than three, we will ignore the last (3 - n) parametric coordinates, where n is the topological order of the cell. For convenience and consistency, we also will constrain each parametric coordinate to range between (0,1).

    Every cell type will have its own parametric coordinate system. Later in this chapter we will describe the parametric coordinate systems in detail. But first we will examine another coordinate system, the structured coordinate system.

    "},{"location":"VTKBook/08Chapter8/#structured-coordinate-system","title":"Structured Coordinate System","text":"

    Many dataset types are structured. This includes image data and structured grids. Because of their inherent structure, they have their own natural coordinate system. This coordinate system is based on the i-j-k indexing scheme that we touched on in \"Image Data\" in Chapter 5.

    The structured coordinate system is a natural way to describe components of a structured dataset. By fixing some indices, and allowing the others to vary within a limited range, we can specify points, lines, surfaces, and volumes. For example, by fixing the i index i = i_0, and allowing the j and k indices to range between their minimum and maximum values, we specify a surface. If we fix three indices, we specify a point, if we fix two indices, we specify a line, and if we allow three indices to vary, we specify a volume (or sub-volume). The structured coordinate system is generally used to specify a region of interest (or ROI). The region of interest is an area that we want to visualize, or to operate on.

    There is a simple relationship between the point and cell id of the dataset coordinate system and the structured coordinate system. To obtain a point id pid given the indices (i_p, j_p, k_p) and dimensions (n_x, n_y, n_z) we use

    \\begin{equation*} \\frac{\\partial}{\\partial r_i} = \\sum_{j} J_{ij} \\frac{\\partial}{\\partial x_j} \\end{equation*} \\bf\\tag{8-2}

    with 0 \\leq i_p \\leq n_x, 0 \\leq j_p \\leq n_y, 0 \\leq k_p \\leq n_z. (We can use this id to index into an array of points or point attribute data.) This equation implicitly assumes an ordering of the points in topological space. Points along the i axis vary fastest, followed by the j and then the $$k axes. A similar relationship exists for cell id's

    \\begin{equation*} \\text{cell}_\\text{id} = i_p + j_p (n_x - 1) + k_p (n_x - 1)(n_y - 1) \\end{equation*} \\bf\\tag{8-2}

    Here we have taken into account that there are one fewer cells along each topological axes than there are points.

    "},{"location":"VTKBook/08Chapter8/#82-interpolation-functions","title":"8.2 Interpolation Functions","text":"

    Computer visualization deals with discrete data. The data is either supplied at a finite number of points or created by sampling continuous data at a finite number of points. But we often need information at positions other than these discrete point locations. This may be for rendering or for sub-sampling the data during algorithm execution. We need to interpolate data from known points to some intermediate point using interpolation functions.

    Interpolation functions relate the values at cell points to the interior of the cell. Thus, we assume that information is defined at cell points, and that we must interpolate from these points. We can express the result as a weighted average of the data values at each cell point.

    Figure 8-2. Interpolation is a linear combination of local interpolation functions. Interpolation functions are scaled by data values at cell points."},{"location":"VTKBook/08Chapter8/#general-form","title":"General Form","text":"

    To interpolate data from the cell points p_i to a point p that is inside the cell, we need three pieces of information:

    1. the data values at each cell point,

    2. the parametric coordinates of the point p within the cell, and

    3. the cell type including interpolation functions.

    Given this information, the interpolation functions are a linear combination of the data values at the cell points

    \\begin{equation*} d = \\sum_{i = 0}^{n - 1}W_i\\, d_i \\end{equation*} \\bf\\tag{8-4}

    where d is the data value at the interior cell location (r,s,t), d_i is the data value at the i^{th} cell point, and W_i is a weight at the i^{th} cell point. The interpolation weights are functions of the parametric coordinates W_i = W(r,s,t). In addition, because we want d = d_i when the interior point coincides with a cell point, we can place additional constraints on the weights

    \\begin{equation*} W_i = 1, W_{j \\neq i} = 0 \\quad \\text{when} \\quad p = p_i \\end{equation*} \\bf\\tag{8-5}

    We also desire the interpolated data value d to be no smaller than the minimum d_i and no larger than the maximum d_i. Thus the weights should also satisfy

    \\begin{equation*} \\sum W_i = 1, \\quad 0 \\leq W_i \\leq 1 \\end{equation*} \\bf\\tag{8-6}

    The interpolation functions are of a characteristic shape. They reach their maximum value W_i = 1 at cell point p_i, and are zero at all other points. Examining Equation 8-1, we draw Figure 8-2 and see that each interpolation function has the shape of a peaked \"hat,\" and that interpolation is a linear combination of these hat functions, scaled by the data value at each point.

    Equation 8-4 is the general form for cell interpolation. It is used to interpolate any data value defined at the cell points to any other point within the cell. We have only to define the specific interpolation functions W_i for each cell type.

    "},{"location":"VTKBook/08Chapter8/#specific-forms","title":"Specific Forms","text":"

    Each cell type has its own interpolation functions. The weights W_i are functions of the parametric coordinates r, s, and t. In this section we will define the parametric coordinate system and interpolation function for each primary cell type. Composite cells use the interpolation functions and parametric coordinates of their composing primary cells. The only difference in coordinate system specification between primary and composite cells is that composite cells use the additional sub-id to specify a particular primary cell.

    Vertex. Vertex cells do not require parametric coordinates or interpolation functions since they are zero-dimensional. The single weighting function is W_0 = 1.

    Line. Figure 8-3 shows the parametric coordinate system and interpolation functions for a line.The line is described using the single parametric coordinate r. Figure 8-3. Parametric coordinate system and interpolation functions for a line.

    Pixel. Figure 8-4 shows the parametric coordinate system and interpolation functions for a pixel cell type. The pixel is described using the two parametric coordinates (r,s). Note that the pixel edges are constrained to lie parallel to the global coordinate axes. These are often referred to as bilinear interpolation functions. Figure 8-4. Parametric coordinate system and interpolation functions for a pixel.

    Quadrilateral. Figure 8-5 shows the parametric coordinate system and interpolation functions for a quadrilateral cell type. The quadrilateral is described using the two parametric coordinates (r,s). Figure 8-5. Parametric coordinate system and interpolation functions for a quadrilateral

    Triangle. Figure 8-6 shows the parametric coordinate system and interpolation functions for a triangle cell type. The triangle is characterized using the two parametric coordinates (r,s). Figure 8-6. Parametric coordinate system and interpolation functions for a triangle.

    Polygon. Figure 8-7 shows the parametric coordinate system and interpolation functions for a polygon cell type. The polygon is characterized using the two parametric coordinates (r,s). The parametric coordinate system is defined by creating a rectangle oriented along the first edge of the polygon. The rectangle also must bound the polygon.

    The polygon poses a special problem since we do not know how many vertices define the polygon. As a result, it is not possible to create general interpolation functions in the fashion of the previous functions we have seen. Instead, we use a function based on weighted distance squared from each polygon vertex.

    The weighted distance squared interpolation functions work well in practice. However, there are certain rare cases where points topologically distant from the interior of a polygon have an undue effect on the polygon interior (Figure 8-8). These situations occur only if the polygon is concave and wraps around on itself. Figure 8-7. Parametric coordinate system and interpolation functions for a polygon. Figure 8-8. Potential problem with distance-based interpolation functions.

    Tetrahedron. Figure 8-9 shows the parametric coordinate system and interpolation functions for a tetrahedron cell type. The tetrahedron is described using the three parametric coordinates (r,s,t). Figure 8-9. Parametric coordinate system and interpolation functions for a tetrahedron.

    Voxel. Figure 8-10 shows the parametric coordinate system and interpolation functions for a voxel cell type. The voxel is described using the three parametric coordinates (r,s,t). Note that the voxel edges are constrained to lie parallel to the global coordinate axes. These are often referred to as tri-linear interpolation functions. Figure 8-10. Parametric coordinate system and interpolation functions for a voxel.

    ** Hexahedron. Figure 8-11** shows the parametric coordinate system and interpolation functions for a hexahedron cell type. The hexahedron is described using the three parametric coordinates (r,s,t).

    Figure 8-11. Parametric coordinate system and interpolation functions for a hexahedron.

    Wedge. Figure 8-12 shows the parametric coordinate system and interpolation functions for a wedge cell type. The wedge is described using the three parametric coordinates (r,s,t). Figure 8-12. Parametric coordinate system and interpolation functions for a wedge.

    Pyramid. Figure 8-13 shows the parametric coordinate system and interpolation functions for a pyramid cell type. The pyramid is described using the three parametric coordinates (r,s,t). Figure 8-13. Parametric coordinate system and interpolation functions for a pyramid.

    Pentagonal Prism. Figure 8-14 shows the parametric coordinate system and interpolation functions for a pentagonal prism cell type. The pentagonal prism is described using the three parametric coordinates (r,s,t). Figure 8-14 Parametric coordinate system and interpolation functions for a pentagonal prism.

    Hexagonal Prism. Figure 8-15 shows the parametric coordinate system and interpolation functions for a hexagonal prism cell type. The hexagonal prism is described using the three parametric coordinates (r,s,t). Figure 8-15. Parametric coordinate system and interpolation functions for a hexagonal prism.

    Quadratic Edge. Figure 8-16 shows the parametric coordinate system and interpolation functions for a quadratic edge cell type. The quadratic edge is described using the single parametric coordinate r. Figure 8-16. Parametric coordinate system and interpolation functions for a quadratic edge.

    Quadratic Triangle. Figure 8-17 shows the parametric coordinate system and interpolation functions for a quadratic triangle cell type. The quadratic triangle is described using the two parametric coordinates (r,s). Figure 8-17 Parametric coordinate system and interpolation functions for a quadratic triangle.

    Quadratic Quadrilateral. Figure 8-18 shows the parametric coordinate system and interpolation functions for a quadratic quadrilateral cell type. The quadratic quadrilateral is described using the two parametric coordinates (r,s). Note that because the interpolation functions are most easily expressed in the interval (-1,1), a coordinate shift is performed to the $(\\xi, \\eta) coordinates defined in this range. Also, the notation \\xi_i and \\eta_i is introduced. These are the parametric coordinates at the i^{th} point. Figure 8-18. Parametric coordinate system and interpolation functions for a quadratic quadrilateral. In VTK parametric coordinates (r,s) run between (0,1), hence the coordinate system shift into the (\u03be, \u03b7) parametric system ranging from (-1,1). Note that \u03bei, \u03b7i and \u03b6i refer to the parametric coordinates of the ith point.

    Quadratic Tetrahedron. Figure 8-19 shows the parametric coordinate system and interpolation functions for a quadratic tetrahedron cell type. The quadratic tetrahedron is described using the three parametric coordinates (r,s,t). Figure 8-19. Parametric coordinate system and interpolation functions for a quadratic tetrahedron. In VTK parametric coordinates (r,s,t) run between (0,1), hence the coordinate system shift into the (\u03be, \u03b7 and \u03b6) parametric system ranging from (-1,1).

    Quadratic Hexahedron. Figure 8-20 shows the parametric coordinate system and interpolation functions for a quadratic hexahedron cell type. The quadratic hexahedron is described using the three parametric coordinates (r,s,t). Note that because the interpolation functions are most easily expressed in the interval (-1,1), a coordinate shift is performed to the (\\xi, \\eta, \\zeta) coordinates defined in this range. Also, the notation \\xi_i, \\eta_i and \\zeta_i is introduced. These are the parametric coordinates at the i^{th} point. Figure 8-20. Parametric coordinate system and interpolation functions for a quadratic hexahedron. In VTK parametric coordinates (r,s,t) run between (0,1), hence the coordinate system shift into the (\u03be, \u03b7 and \u03b6) parametric system ranging from (-1,1). Note that \u03bei, \u03b7i amd \u03b6i refer to the parametric coordinates of the ith x point.

    Quadratic Wedge. Figure 8-21 shows the parametric coordinate system and interpolation functions for a quadratic wedge cell type. The quadratic wedge is described using the three parametric coordinate (r,s,t). Figure 8-21. Parametric coordinate system and interpolation functions for a quadratic wedge.

    Quadratic Pyramid. Figure 8-22 shows the parametric coordinate system and interpolation functions for a quadratic pyramid cell type. The quadratic pyramid is described using the three parametric coordinates (r,s,t). Note that because the interpolation functions are most easily expressed in the interval (-1,1), a coordinate shift is performed to the (\\xi, \\eta, \\zeta) coordinates system defined in this range. Also, the notation \\xi_i, \\eta_i$ and \\zeta_i is introduced, these are the parametric coordinate at the i^{th} point. (The shape functions and derivatives were implemented thanks to the Center For Aerospace Structures http://www.colorado.edu/engineering/CAS.) Figure 8-22. Parametric coordinate system and interpolation functions for a quadratic pyramid. In VTK parametric coordinates (r,s,t) run between (0,1), hence the coordinate system shift into the (\u03be,\u03b7,\u03b6) parametric system ranging from (-1,1). Note that \u03bei, \u03b7i and \u03b6i refer to the parametric coordinates of the ith x point.."},{"location":"VTKBook/08Chapter8/#83-cell-tessellation","title":"8.3 Cell Tessellation","text":"

    As briefly introduced in Chapter 5 - Data Representation, nonlinear cells are often used in various numerical techniques such as the finite element method. While some visualization systems support nonlinear cells directly, typically only quadratic and occasionally cubic formulations are supported (for example, VTK supports quadratic cells). This represents only a small subset of the formulations currently available in numerical packages, and ignores the unlimited potential cell formulations. To address this important problem, visualization systems may provide an adaptor framework (see Figure 8-23) that enables users to interface their own simulation system to the visualization system [Schroeder06]. Such a framework requires writing adaptor classes that are derived from visualization dataset and cell base classes (in the figure these are labeled GenericDataSet and GenericAdaptorCell). These adaptors act like translators, converting data and method invocations to and from the forms expected by the visualization system and the numerical system. Like any other data objects, such adaptor cells and datasets can be processed directly by visualization algorithms. However, processing such general data objects is a difficult problem, since most visualization algorithms described in the scientific literature to date adopt the fundamental assumptions that cell geometry is linear. Removing this assumption may require introducing significant complexity into the algorithm, or may even require a new algorithm. For example, the marching cubes isocontouring algorithm assumes that the cells are ortho-rectilinear hexahedra; without this assumption elaborate transformations to and from parametric and global coordinate systems are required, and even then in highly curved nonlinear cells, degenerate or self-intersection isocontours may be generated without extensive topological and geometric checks. Thus the adaptor framework typically includes methods for tessellating nonlinear cells into the familiar linear cells, which can then be readily processed by conventional visualization algorithms. In the following section, we briefly described a simple method for tessellating higher order, nonlinear cells to produce linear cells. Figure 8-23. Cell adaptor framework."},{"location":"VTKBook/08Chapter8/#basic-approach","title":"Basic Approach","text":"

    The basic approach is to dynamically tessellate the cells of the GenericDataSet, and then operate on the resulting linear tessellation. As expressed in pseudo-code, a typical algorithm looks like this:

    for each cell c to be processed\n  {\n  if cell c meets selection criteria\n    {\n    linearDataSet = TessellateCell(c)\n    for each linear cell cl in linearDataSet\n      {\n      OperateOn(cl)\n      }\n    }\n }\n

    It is important not to tessellate the entire dataset all at once, since this may produce excessive demands on memory resources, and many algorithms visit only a subset of a dataset's cells. Thus the pseudo-code above refers to a selection criterion, which varies depending on the nature of the algorithm. For example, an isocontouring algorithm may check to see whether the cell's scalar values span the current isocontour value.

    While many tessellation algorithms are possible, those based on edge subdivision are particularly simple. The idea behind the algorithm is simple: each cell edge e is evaluated via an error metric E and may be marked for subdivision if any error measure \\epsilon_i exceeds a corresponding error threshold $\\epsilon epsilon{^i}

    \\begin{equation*} \\text{split edge if} (\\epsilon_i > \\epsilon_i^{\\text{T}}), \\quad \\text{for all} \\quad \\epsilon_i \\in E \\end{equation*} \\bf\\tag{8-6}

    Based on the cell topology, and the particular edges requiring subdivision, templates are used to subdivide the cell. This process continues recursively until the error metric is satisfied on all edges. One advantage of this algorithm is that cells can be tessellated independently. This is because edge subdivision is a function of one or more error measures that consider only information along the edge, and does not need to take into account cell information. Therefore no communication across cell boundaries is required, and the algorithm is well suited for parallel processing and on the fly tessellation as cells are visited during traversal.

    Some templates for cell subdivision are shown in Figure 8-24. Note that in some cases a choice must be made in terms of which diagonal to select for tessellation (for example, the dashed line in Figure 8-24(b)). In 2D, this choice can be made arbitrarily, however in 3D the choice must be consistent with the cell's face neighbor. In order to preserve the simplicity of the algorithm, including avoiding inter-cell communication, simple tie-breaking rules for selecting the diagonal on the faces of 3D cells are adopted. These rules include using the shortest diagonal (measured in the global coordinate system), or using a topological decider based on selecting the diagonal with the smallest point id. (A topological decider is necessary when the geometric distance measure is inconclusive.) Figure 8-24. Three cases from the subdivision table for a triangle. Filled circles indicate that the edge is marked for subdivision."},{"location":"VTKBook/08Chapter8/#error-measures","title":"Error Measures","text":"

    The algorithm described above is adaptive because edge splitting is controlled by local mesh properties and/or its relation to the view position. Since the goal is to insure that the quality of the tessellation is consistent with the particular requirements of the visualization, we expect the adapted tessellation to be of better quality as compared to a fixed subdivision with the same number of simplices, or have fewer simplices for tessellations of equal quality.

    Our design allows for the definition of multiple error measures. As indicated in Equation 8-7, the error metric consists of several error measures, each of which evaluates local properties of the edge against the linear approximation, and compares the measure against a user-specified threshold. If any measure exceeds the threshold, then the edge is subdivided. These error measures may evaluate geometric properties, approximation to solution attributes, or error related to the current view, among other possibilities. Error measures based on geometry or attributes are independent of view and the mesh requires only one initial tessellation.

    The following paragraphs describes several error measures that have been found to be useful in practice. Since the tessellator is designed to process a list of error measures, it is straightforward to add new ones (by deriving from the GenericSubdivisionErrorMetric class) and/or combine it with existing error measures.

    Figure 8-25. Definition of the geometric and attribute error measures.
    • Object-Based Geometric Error Measure. Referring to Figure8-25(left), this error measure is the perpendicular distance, d, from the edge center point C to the straight line passing through the cell edge vertices (A and B). Note that d is computed in world coordinates, but C is computed by evaluation at the parametric center of the edge. The perpendicular distance is used rather than the distance between C and D4 because if C lies on (AB) but is not coincident with D the error is non-zero, resulting in many useless edge subdivisions.

    • Object-Based Flatness Error Measure. This error measure is the angle \\alpha between the chords (AC) and (CB) passing through the real mid-point C. As the angle approaches 180\\circ the edge becomes flat. The threshold is the angle over which the edge is viewed as flat.

    • Attribute-Based Error Measure. Referring to Figure 8-25(right), this error measure is the distance between a^i the linearly interpolated value of an attribute at the midpoint and the actual value of this attribute at the edge midpoint a^m.

    • Image-Based Geometric Error Measure. This error measure is the distance, in pixels, between the line (AB) projected in image space to the midpoint C also projected in image space. Because the computation involves projection through the current camera matrix, this error measure is view-dependent. As a result, the tessellation may be crude in portions of the mesh away from the camera. Note that one of the disadvantages of this approach is that tessellation may be required each time the camera is repositioned relative to the mesh.

    • "},{"location":"VTKBook/08Chapter8/#advanced-methods","title":"Advanced Methods","text":"

      Attentive readers will have noticed that the subdivision scheme described previously may fail to capture all the features of the higher-order basis. For example, imagine a scalar function across a triangle where the peak value of the function occurs in the center of the triangle, and the variation across the edges is zero. The edge subdivision algorithm described previously will not capture the peak, hence an algorithm such as isocontouring will produce inaccurate results. Linear isocontouring algorithms require that the following conditions are met in order to produce topologically correct results.

      • each mesh edge intersects an isocontour of a particular value at most once,

      • no isocontour intersects a mesh face without intersecting at least two edges of the face, and

      • no isocontour is completely contained within a single element.

      By definition, these conditions are directly related to critical points, since an extremum of a differentiable function over an open domain is necessarily a critical point. Linear meshes assume that all extrema of the scalar field occur at element vertices, but in general when using a higher-order basis this is not the case, and extrema can be found interior to a cell.

      To address this problem, a pre-triangulation of the basis must be performed. The pre-triangulation must identify all critical points in the interior, on the faces, or on the edge of a cell, and then insert these points into the triangulation. For example, an initial triangulation based on the vertices of the higher-order cell can be performed first, followed by insertion into the triangulation using a method such as Delaunay triangulation or equivalent (see \"Triangulation Techniques\" in Chapter 9). The pre-triangulation can then be followed by the standard edge-based algorithm presented previously.

      "},{"location":"VTKBook/08Chapter8/#84-coordinate-transformation","title":"8.4 Coordinate Transformation","text":"

      Coordinate transformation is a common visualization operation. This may be either transformation from dataset coordinates to global coordinates, or global coordinates to dataset coordinates.

      "},{"location":"VTKBook/08Chapter8/#dataset-to-global-coordinates","title":"Dataset to Global Coordinates","text":"

      Transforming between dataset coordinates and global coordinates is straightforward. We start by identifying a primary cell using the cell id and sub-id. Then the global coordinates are generated from the parametric coordinates by using the interpolation functions of Equation 8-4. Given cell points p_i = p_i(x_i, y_i, z_i) the global coordinate p is simply

      \\begin{equation*} p = \\sum_{i = 0}^{n - 1} W_i(r_0, s_0, t_0)\\, p_i \\end{equation*} \\bf\\tag{8-8}

      where the interpolation weights W_ii are evaluated at the parametric coordinate (r_0, s_0, t_0).

      In the formulation presented here, we have used the same order interpolation functions for both data and cell geometry. (By order we mean the polynomial degree of the interpolating polynomials.) This is termed iso-parametric interpolation. It is possible to use different interpolation functions for geometry and data. Super-parametric interpolation is used when the order of the interpolation functions for geometry is greater than those used for data. Sub-parametric interpolation is used when the order of the interpolation functions for geometry is less than those used for data. Using different interpolation functions is commonly used in numerical analysis techniques such as the finite element method. We will always use the iso-parametric interpolation for visualization applications.

      "},{"location":"VTKBook/08Chapter8/#global-to-dataset-coordinates","title":"Global to Dataset Coordinates","text":"

      Global to dataset coordinate transformations are expensive compared to dataset to global transformations. There are two reasons for this. First, we must identify the particular cell C_i that contains the global point p. Second, we must solve Equation 8-4 for the parametric coordinates of p.

      To identify the cell C_i means doing some form of searching. A simple but inefficient approach is to visit every cell in a dataset and determine whether p lies inside any cell. If so, then we have found the correct cell and stop the search. Otherwise, we check the next cell in the list.

      This simple technique is not fast enough for large data. Instead, we use accelerated search techniques. These are based on spatially organizing structures such as an octree or three-dimensional hash table. The idea is as follows: we create a number of \"buckets,\" or data place holders, that are accessed by their location in global space. Inside each bucket we tag all the points or cells that are partially or completely inside the bucket. Then, to find a particular cell that contains point p, we find the bucket that contains p, and obtain all the cells associated with the bucket. We then evaluate inside/outside for this abbreviated cell list to find the single cell containing p. (See \"Searching\" in Chapter 8 for a more detailed description.)

      The second reason that global to dataset coordinate transformation is expensive is because we must solve the interpolation function for the parametric coordinates of p. Sometimes we can do this analytically, but in other cases we must solve for the parametric coordinates using numerical techniques.

      Consider the interpolation functions for a line (Figure 8-2). We can solve this equation exactly and find that \\begin{equation*} r = \\frac{x - x_0}{x_1 - x_0} = \\frac{y - y_0}{y_1 - y_0} = \\frac{z - z_0}{z_1 - z_0} \\bf\\tag{8-9} \\end{equation*}

      Similar relations exist for any cell whose interpolation functions are linear combinations of parametric coordinates. This includes vertices, lines, triangles, and tetrahedra. The quadrilateral and hexahedron interpolation functions are nonlinear because they are products of linear expressions for the parametric coordinates. As a result, we must resort to numerical techniques to compute global to dataset coordinate transformations. The interpolation functions for pixels and voxels are nonlinear as well, but because of their special orientation with respect to the x, y, and z coordinate axes, we can solve them exactly. (We will treat pixel and voxel types in greater depth in \"Special Techniques for Image Data\" in Chapter 8.)

      To solve the interpolation functions for parametric coordinates we must use nonlinear techniques for the solution of a system of equations. A simple and effective technique is Newton's method [Conte72].

      To use Newton's method we begin by defining three functions for the known global coordinate p = p(x,y,z) in terms of the interpolation functions W_i = W_i(r,s,t)

      \\begin{eqnarray*} f(r, s, t) &=& x - \\sum W_i \\, x_i = 0 \\\\ g(r, s, t) &=& y - \\sum W_i \\, y_i = 0 \\\\ h(r, s, t) &=& z - \\sum W_i \\, z_i = 0 \\end{eqnarray*} \\bf\\tag{8-10}

      and then, expanding the functions using a Taylor's series approximation,

      \\begin{eqnarray*} f(r, s, t) &\\simeq& f_0 + \\frac{\\partial f}{\\partial r}(r - r_0) + \\frac{\\partial f}{\\partial s}(s - s_0) + \\frac{\\partial f}{\\partial t}(t - t_0) + \\ldots \\\\ g(r, s, t) &\\simeq& g_0 + \\frac{\\partial g}{\\partial r}(r - r_0) + \\frac{\\partial g}{\\partial s}(s - s_0) + \\frac{\\partial g}{\\partial t}(t - t_0) + \\ldots \\\\ h(r, s, t) &\\simeq& h_0 + \\frac{\\partial h}{\\partial r}(r - r_0) + \\frac{\\partial h}{\\partial s}(s - s_0) + \\frac{\\partial h}{\\partial t}(t - t_0) + \\ldots \\\\ \\end{eqnarray*} \\bf\\tag{8-11}

      we can develop an iterative procedure to solve for the parametric coordinates. This yields the general form

      \\begin{equation*} \\left( \\begin{array}{c} r_{i + 1} \\\\ s_{i + 1} \\\\ t_{i + 1} \\end{array} \\right) = \\left( \\begin{array}{c} r_i \\\\ s_i \\\\ t_i \\end{array} \\right) - \\left( \\begin{array}{c c c} \\frac{\\partial f}{\\partial r} & \\frac{\\partial f}{\\partial s} & \\frac{\\partial f}{\\partial t} \\\\ \\frac{\\partial g}{\\partial r} & \\frac{\\partial g}{\\partial s} & \\frac{\\partial g}{\\partial t} \\\\ \\frac{\\partial h}{\\partial r} & \\frac{\\partial h}{\\partial s} & \\frac{\\partial h}{\\partial t} \\end{array} \\right)^{-1} \\left( \\begin{array}{c} f_i \\\\ g_i \\\\ h_i \\end{array} \\right) \\end{equation*} \\bf\\tag{8-10}

      Fortunately, Newton's method converges quadratically (if it converges) and the interpolation functions that we have presented here are well behaved. In practice, Equation 8-12 converges in just a few iterations.

      "},{"location":"VTKBook/08Chapter8/#85-computing-derivatives","title":"8.5 Computing Derivatives","text":"

      Interpolation functions enable us to compute data values at arbitrary locations within a cell. They also allow us to compute the rate of change, or derivatives, of data values. For example, given displacements at cell points we can compute cell strains and stresses or, given pressure values, we can compute the pressure gradient at a specified location.

      Figure 8-26. Computing derivatives in an 1D line cell.

      To introduce this process, we will begin by examining the simplest case: computing derivatives in a 1D line (Figure 8-26). Using geometric arguments, we can compute the derivatives in the r parametric space according to \\begin{equation*} \\frac{d s}{d r} = \\frac{s_1 - s_0}{1} = (s_1 - s_0) \\end{equation*} \\bf\\tag{8-13}

      where s_i is the data value at point i. In the local coordinate system x', which is parallel to the r coordinate system (that is, it lies along the \\vec{t} or \\vec{x_1} - \\vec{x_0}), the derivative is

      \\begin{equation*} \\frac{d s}{d x'} = \\frac{s_1 - s_0}{l} \\bf\\tag{8-14} \\end{equation*}

      where l is the length of the line.

      Another way to derive Equation 8-14 is to use the interpolation functions of Figure 8-3 and the chain rule for derivatives. The chain rule \\begin{equation*} \\frac{d}{d r} = \\frac{d}{dx'} \\frac{dx'}{dr} \\end{equation*} \\bf\\tag{8-15}

      allows us to compute the derivative \\frac{d}{d x'} using

      \\begin{equation*} \\frac{d}{d x'} = \\frac{d}{dr}/ \\frac{dx'}{dr} \\bf\\tag{8-16} \\end{equation*}

      With the interpolation functions we can compute the x' derivatives with respect to r as

      \\begin{equation*} \\frac{d x'}{d r} = \\frac{d}{dr} \\left(\\sum_{i}W_i \\, x_i' \\right) = -x_0' + x_1' = 1 \\end{equation*} \\bf\\tag{8-17}

      which, when combined with Equation 8-16 and Equation 8-13 for the s derivatives, yields Equation 8-14.

      One final step remains. The derivatives in the \\vec{x} coordinate system must be converted to the global x-y-z system. We can do this by creating a unit vector \\vec{v} as

      \\begin{equation*} \\vec{v} = \\frac{\\vec{x}_1 - \\vec{x}_0}{\\vert\\vec{x}_1 - \\vec{x}_0 \\vert} \\end{equation*} \\bf\\tag{8-18}

      where \\vec{x_0} and \\vec{x_1} are the locations of the two end points of the line. Then the derivatives in the x, y, and z directions can be computed by taking the dot products along the axes.

      \\begin{eqnarray*} \\frac{ds}{dx} &=& \\left(\\frac{s_1 - s_0}{1}\\right) \\vec{v} \\cdot (1, 0, 0) \\\\ \\frac{ds}{dy} &=& \\left(\\frac{s_1 - s_0}{1}\\right) \\vec{v} \\cdot (0, 1, 0) \\\\ \\frac{ds}{dz} &=& \\left(\\frac{s_1 - s_0}{1}\\right) \\vec{v} \\cdot (0, 0, 1) \\end{eqnarray*} \\bf\\tag{8-19}

      To summarize this process, derivatives are computed in the local r-s-t parametric space using cell interpolation. These are then transformed into a local x'-y'-z' Cartesian system. Then, if the x'-y'-z' system is not aligned with the global x-y-z coordinate system, another transformation is required to generate the result.

      We can generalize this process to three dimensions. From the chain rule for partial derivatives

      \\begin{eqnarray*} \\frac{\\partial}{\\partial x} &=& \\frac{\\partial}{\\partial r} \\frac{\\partial r}{\\partial x} \\ + \\frac{\\partial}{\\partial s} \\frac{\\partial s}{\\partial x} \\ + \\frac{\\partial}{\\partial t} \\frac{\\partial t}{\\partial x} \\\\ \\frac{\\partial}{\\partial y} &=& \\frac{\\partial}{\\partial r} \\frac{\\partial r}{\\partial y} \\ + \\frac{\\partial}{\\partial s} \\frac{\\partial s}{\\partial y} \\ + \\frac{\\partial}{\\partial t} \\frac{\\partial t}{\\partial y} \\\\ \\frac{\\partial}{\\partial z} &=& \\frac{\\partial}{\\partial r} \\frac{\\partial r}{\\partial z} \\ + \\frac{\\partial}{\\partial s} \\frac{\\partial s}{\\partial z} \\ + \\frac{\\partial}{\\partial t} \\frac{\\partial t}{\\partial z} \\end{eqnarray*} \\bf\\tag{8-20}

      or after rearranging

      \\begin{equation*} \\left( \\begin{array}{c} \\frac{\\partial}{\\partial r} \\\\ \\frac{\\partial}{\\partial s} \\\\ \\frac{\\partial}{\\partial t} \\end{array} \\right) = \\left( \\begin{array}{c c c} \\frac{\\partial x}{\\partial r} & \\frac{\\partial y}{\\partial r} & \\frac{\\partial z}{\\partial r} \\\\ \\frac{\\partial x}{\\partial s} & \\frac{\\partial y}{\\partial s} & \\frac{\\partial z}{\\partial s} \\\\ \\frac{\\partial x}{\\partial t} & \\frac{\\partial y}{\\partial t} & \\frac{\\partial z}{\\partial t} \\end{array} \\right) \\left( \\begin{array}{c} \\frac{\\partial}{\\partial x} \\\\ \\frac{\\partial}{\\partial y} \\\\ \\frac{\\partial}{\\partial z} \\end{array} \\right) = \\mathbf{J}\\left( \\begin{array}{c} \\frac{\\partial}{\\partial x} \\\\ \\frac{\\partial}{\\partial y} \\\\ \\frac{\\partial}{\\partial z} \\end{array} \\right) \\end{equation*} \\bf\\tag{8-21}

      The 3 \\times 3 matrix J is called the Jacobian matrix, and it relates the parametric coordinate derivatives to the global coordinate derivatives. We can rewrite Equation 8-21 into more compact form

      \\begin{equation*} \\frac{\\partial}{\\partial r_i} = \\sum_{j} J_{ij} \\frac{\\partial}{\\partial x_j} \\end{equation*} \\bf\\tag{8-21}

      and solve for the global derivatives by taking the inverse of the Jacobian matrix

      \\begin{equation*} \\frac{\\partial}{\\partial x_i} = \\sum_{j} J_{ij}^{-1} \\frac{\\partial}{\\partial r_j} \\end{equation*} \\bf\\tag{8-22}

      The inverse of the Jacobian always exists as long as there is a one-to-one correspondence between the parametric and global coordinate systems. This means that for any (r, s, t) coordinate, there corresponds only one (x, y, z) coordinate. This holds true for any of the parametric coordinate systems presented here, as long as pathological conditions such as cell self-intersection or a cell folding in on itself are avoided. (An example of cell folding is when a quadrilateral becomes non-convex.)

      In our one-dimensional example, the derivatives along the line were constant. However, other interpolation functions (e.g., Figure 8-5) may yield non-constant derivatives. Here, the Jacobian is a function of position in the cell and must be evaluated at a particular (r, s, t) coordinate value."},{"location":"VTKBook/08Chapter8/#86-topological-operations","title":"8.6 Topological Operations","text":"

      Many visualization algorithms require information about the topology of a cell or dataset. Operations that provide such information are called topological operations. Examples of these operations include obtaining the topological dimension of a cell, or accessing neighboring cells that share common edges or faces. We might use these operations to decide whether to render a cell (e.g., render only one-dimensional lines) or to propagate particles through a flow field (e.g., traversing cells across common boundaries).

      Before proceeding we need to define some terms from topology. Manifold topology describes a region surrounding a point that is topologically connected. That is, a region around the point is topologically equivalent to a small \"disk\" (in two-dimensions) or \"ball\" (in three-dimensions). Topology that is not manifold is termed non-manifold. Examples of manifold and non-manifold geometry are shown in Figure 8-27.

      There are some simple rules we can use to decide whether a surface or region approximated with cells is manifold or non-manifold. In two dimensions, if every edge of a two-dimensional cell is used by exactly one other cell, than the surface is locally manifold. In three dimensions, if every face of a three-dimensional cell is used by exactly one other cell, than the region is locally manifold.

      We also will use the term simplex on some occasions. A simplex of dimension n is the convex region defined by a set of n+1 independent points. A vertex, line, triangle, and tetrahedron are simplices of dimension 0, 1, 2, and 3, respectively as shown in Figure 8-28. \\begin{equation*} \\frac{\\partial}{\\partial x_i} = \\sum_{j} J_{ij}^{-1} \\frac{\\partial}{\\partial r_j} \\end{equation*} \\bf\\tag{8-23} Figure 8-27. Manifold and non-manifold surface topology. If the local neighborhood around a vertex is topologically a 2D disk (i.e., a small disk can be placed on the surface without tearing or overlapping), then the surface is manifold at that vertex. Figure 8-28. Simplices of dimension three and lower."},{"location":"VTKBook/08Chapter8/#cell-operation","title":"Cell Operation","text":"

      Cell operations return information about the topology of a cell. Typically, we want to know the topological order of the cell or the topology of the cell boundary.

      Given a cell C_i of topological dimension d, the cell is (implicitly) composed of boundary cells of topological order d-1 and lower. For example, a tetrahedron is composed of four two-dimensional triangles, six one-dimensional edges, and four zero-dimensional vertices. Cell operations return information about the number of boundary cells of a particular topological dimension, as well as the ordered list of points that define each bounding cell.

      Another useful cell operation returns the closest boundary cell of dimension d-1 given the parametric coordinates of the cell. This operation ties the geometry to the topology of the cell, as compared to the parametric coordinate system, which ties the topology to the geometry. The closest boundary cell operation is implemented by partitioning each cell into various regions, as illustrated in Figure 8-29. To determine the closest boundary cell we need only to identify the parametric region that the point lies in, and then return the appropriate boundary cell.

      Another useful cell operation is cell decomposition into simplices. Every cell can be decomposed into a collection of simplices. By doing so, and by operating on the simplex decomposition rather than the cell itself, we can create algorithms that are independent of cell type. For example, if we want to intersect two datasets of varied cell type, without simplex decomposition we would have to create methods to intersect every possible combination of cells. With simplex decomposition, we can create a single intersection operation that operates on only the limited set of simplices. The significant advantage of this approach is that as new cells are added to the visualization system, only the cell object (including its method for simplex decomposition) must be implemented, and no other objects need be modified.

      Figure 8-29. Closest boundary cell operation for quadrilateral cell."},{"location":"VTKBook/08Chapter8/#dataset-operations","title":"Dataset Operations","text":"

      Dataset operations return information about the topology of a dataset or topological information about the adjacency of cells. Typical operations include determining the neighbors of a cell or returning a list of all cells that use a particular point.

      We can formalize the adjacency operations by continuing the discussion of \"Cell Types\" in Chapter 5. Adjacency methods are used to obtain information about the neighbors of a cell. A neighbor of a particular cell C_i is simply a cell that shares one or more points in common with C_i. A vertex neighbor is a neighbor that shares one or more vertices. An edge neighbor is a neighbor that shares one or more edges. A face neighbor is a cell that shares vertices that define one of the faces of the cell. Note that a face neighbor is also an edge neighbor, and an edge neighbor is also a vertex neighbor.

      The adjacency operators are simple set operations. For a particular cell C_i defined by points and a point list \\vec{P} = (\\vec{p_1}, \\vec{p_2}, ..., \\vec{p_n}) with P \\subset P, where P typically corresponds to the points defining a boundary cell of C_i; the neighbors of C_i are the adjacency set A(C, P).

      The adjacency set is simply the intersection of the use sets for each point, excluding the cell C_i.

      \\begin{equation*} C_i = \\lbrace p_1, p_2, \\ldots, p_n \\rbrace = P \\end{equation*} \\bf\\tag{8-24}

      and a point list \\vec{P} = (\\vec{p}_1, \\vec{p}_2, ..., \\vec{p}_n) with \\vec{P}\\subset P , where P typically corresponds to the points defining a boundary cell of C_i; the neighbors of C_i are the adjacency set A(\\vec{C}, \\vec{P}) . The adjacency set is simply the intersection of the use sets for each point, excluding the cell C_ii.

      The adjacency set represents a variety of useful information. In a manifold object represented by a polyhedra, for example, each polygon must have exactly one edge neighbor for each of its edges. Edges that have no neighbors are boundary edges; edges that have more than one edge neighbor represent non-manifold topology. Datasets that consist of three-dimensional cells (e.g., unstructured grids) are topologically consistent only if, for each cell, there is exactly one face neighbor for each face. Faces that have no neighbors are on the boundary of the dataset. More than one face neighbor implies that the neighbors are self-intersecting (in 3D space).

      \\begin{equation*} A(C_i, \\overline{P}) = \\left(\\bigcap_{i} U(\\overline{p}_i)\\right) - C_i \\end{equation*} \\bf\\tag{8-25}"},{"location":"VTKBook/08Chapter8/#87-searching","title":"8.7 Searching","text":"

      Searching is an operation to find the cell containing a specified point p, or to locate cells or points in a region surrounding p. Algorithms requiring this operation include streamline generation, where we need to find the starting location within a cell; probing, where the data values at a point are interpolated from the containing cell; or collision detection, where cells in a certain region must be evaluated for intersection. Sometimes (e.g., image datasets), searching is a simple operation because of the regularity of data. However, in less structured data, the searching operation is more complex.

      To find the cell containing p, we can use the following naive search procedure. Traverse all cells in the dataset, finding the one (if any) that contains p. To determine whether a cell contains a point, the cell interpolation functions are evaluated for the parametric coordinates (r,s,t). If these coordinates lie within the cell, then p lies in the cell. The basic assumption here is that cells do not overlap, so that at most a single cell contains the given point p. To determine cells or points lying in the region surrounding p, we can traverse cells or points to see whether they lie within the region around p. For example, we can choose to define the region as a sphere centered at p. Then, if a point or the points composing a cell lie in the sphere, the point or cell is considered to be in the region surrounding p.

      These naive procedures are unacceptable for all but the smallest datasets, since they are of order O(n), where n is the number of cells or points. To improve the performance of searching, we need to introduce supplemental data structures to support spatial searching. Such structures are well-known and include MIP maps, octrees, kd-trees, and binary sphere trees (see \"Bibliographic Notes\" at the end of this chapter).

      The basic idea behind these spatial search structures is that the search space is subdivided into smaller parts, or buckets. Each bucket contains a list of the points or cells that lie within it. Buckets are organized in structured fashion so that constant or logarithmic time access to any bucket is possible. For example, if we assign a portion of 2D Euclidean space into a grid of n by m buckets, the location of p in a particular bucket can be determined with two subtractions and two divisions: a constant time access. Similarly, the location of p in a non-uniformly subdivided octree is determined in logarithmic time, since recursive insertion into octant children is required. Once the bucket is found, the search is then limited to the points or cells contained within it. In a properly designed spatial search structure, the number of points or cells in a bucket is a small portion of the total number of cells and less than a fixed value. Thus, the time to search within a bucket can be bounded by a fixed constant. The result is that introducing spatial search structures reduces search times to a maximum O(log n), or better yet O(n).

      We have two options when applying spatial search structures. We may insert points into the search structure, or we may insert cells, depending on the application. There are advantages and disadvantages to both approaches. Inserting cells into buckets is not a trivial operation. In general, cells are arbitrarily oriented and shaped, and will not fit completely into a single bucket. As a result, cells often span multiple buckets. To reliably determine whether a cell is in a bucket requires geometric intersection tests, a costly operation. Another approach is to use the bounding box of a cell to decide which bucket(s) a cell belongs in. We only need to intersect the bounding box with a bucket to determine whether the cell may belong in the bucket. Unfortunately, even though this operation is generally fast, often cells are associated with buckets even though they may not actually lie inside them, wasting (in large models) memory resources and extra processing time.

      Figure 8-30. Using search structure (containing points) to find cells. (a) Points are associated with appropriate bucket. Point $p$ is used to index into bucket, and closest point(s) pi is found. Cells using pi are evaluated for the cell containing p. (b) Sometimes closest points pi are not used by cells containing p.

      Inserting points into a search structure is easier because points can be uniquely placed into a bucket. Inserting points also allows us to search for both points and cells. Cells can be found by using p to index into the appropriate bucket. The closest point(s) p_i to p are then located. Using the topological adjacency operator to retrieve the cells using points pi, we can then search these cells for the cell containing p. This procedure must be used with caution, however, since the closest points may not be used by the cells containing p (Figure 8-30)."},{"location":"VTKBook/08Chapter8/#88-cell-line-intersection","title":"8.8 Cell / Line Intersection","text":"

      An important geometric operation is intersection of a line with a cell. This operation can be used to interactively select a cell from the rendering window, to perform ray-casting for rendering, or to geometrically query data.

      In the Visualization Toolkit each cell must be capable of intersecting itself against a line. Figure 8-31 summarizes these operations for the nine linear primary cell types supported by VTK. (Intersections on composite cells are implemented by intersecting each primitive cell in turn.) Note that the procedure for intersecting higher order cells is the same.

      Line/cell intersection for 0D, 1D, and 2D cells follows standard approaches. Intersection against 3D cells is difficult. This is because the surfaces of these cells are described parametrically and are not necessarily planar. For example, to intersect a line with a tetrahedron, we can intersect the line against the four triangular faces of the tetrahedron. Hexahedron, however, may have non-planar faces. Thus, we cannot intersect the line against six quadrilateral, planar faces. Instead, we use line/face intersection as an initial guess, and project the intersection point onto the surface of the cell. This produces an approximate result, but is accurate enough for most applications.

      Figure 8-31. Summary of line/cell intersection operations for nine primitive cell types. Line is assumed normalized in parametric coordinate t with $0 \\leq t \\leq 1$."},{"location":"VTKBook/08Chapter8/#89-scalars-and-colors","title":"8.9 Scalars and Colors","text":"

      There is a close correspondence between scalar data and colors. We touched on this in \"Color Mapping\" in Chapter 6, where we saw how to use a color table to map scalar values into a color specification (i.e., red, green, blue, and alpha, or RGBA). There are cases, however, when we want to circumvent this mapping process. Such cases occur when color data is supplied instead of scalar data.

      A common example occurs in imaging. Recall that an image is a regular, two-dimensional array of points. The points define pixels, which in turn form a two-dimensional image dataset. Images are frequently stored as a pair of dimensions along with data values. The data values may be one of black and white (e.g., a bitmap), grayscale, or color (e.g., a pixmap). Bitmaps and gray-scale images can be directly cast into the form of single-values scalar data, and we can use our earlier approach. Pixmaps, however, consist of (at a minimum) three values per pixel of red, green, and blue. (Sometimes, a fourth alpha opacity value may also be included.) Thus, pixmaps cannot be directly cast into scalar form.

      To accommodate color data, conversions between multicomponent color data and single-valued scalars must be defined. Each class must act as if it were a scalar: that is, a request for data at a particular point must return a single scalar value. This allows us to use standard scalar visualization techniques such as contouring or warping. Thus a mapping from RGB or RGBA color coordinates to a single scalar value is required.

      The simplest conversion is to select one of n components in a color tuple and use that as the scalar value. Another common mapping returns the luminance Y of a color. Given three components, RGB, the luminance is

      \\begin{equation*} Y = 0.30 R + 0.59 G + 0.11 B \\end{equation*} \\bf\\tag{8-26}

      If the color includes transparency, RGBA, the luminance is

      \\begin{equation*} Y = A(0.30 R + 0.59 G + 0.11 B) \\end{equation*} \\bf\\tag{8-27}

      Using this abstraction allows us to treat single-valued scalars and scalars consisting of multi-valued colors the same. The end result is that we can mix both types of scalar data into our visualization networks.

      "},{"location":"VTKBook/08Chapter8/#810-special-techniques-for-image-data","title":"8.10 Special Techniques for Image Data","text":"

      A significant attraction of using 2and 3-dimensional image data is the speed and simplicity of computation. In this section, we will explore specific techniques that exploit the special regular topology and geometry of image data.

      "},{"location":"VTKBook/08Chapter8/#coordinate-transformation","title":"Coordinate Transformation","text":"

      Given a point p we can find the structured coordinates by performing three division operations (Figure 8-32). Taking the integer floor function yields the structured coordinates. Taking the fractional part of the result yields the parametric coordinates of the cell. We can then use Equation 8-3 to convert to dataset coordinates. Figure 8-32. Image data coordinate transformation."},{"location":"VTKBook/08Chapter8/#derivative-computation","title":"Derivative Computation","text":"

      Because the image dataset is oriented parallel to the coordinate x, y, and z axes, and because the spacing of points in each of these directions is regular, finite difference schemes can be used to compute partial derivatives at the cell points. Referring to Figure 8-33, we see that central differences can be used in each of the three directions according to the equation: \\begin{eqnarray*} g_x &=& \\frac{d(x_0 + \\Delta x_0, y_0, z_0) - d(x_0 - \\Delta x_0, y_0, z_0)}{2 \\Delta x_0} \\\\ g_y &=& \\frac{d(x_0, y_0 + \\Delta y_0, z_0) - d(x_0, y_0 - \\Delta y_0, z_0)}{2 \\Delta y_0} \\\\ g_z &=& \\frac{d(x_0, y_0, z_0 + \\Delta z_0) - d(x_0, y_0, z_0 - \\Delta z_0)}{2 \\Delta z_0} \\end{eqnarray*} \\bf\\tag{8-28}

      (Note that at the boundary of the dataset, one-sided differences may be used.) We can use these equations to compute derivatives within the cell as well. We simply compute the derivatives at each cell point from Equation 8-28, and then use the cell interpolation functions to compute the derivative at the point inside the cell.

      Figure 8-33. Using finite differences to compute derivatives on image data."},{"location":"VTKBook/08Chapter8/#topology","title":"Topology","text":"

      Structured datasets lend themselves to efficient topological operations (i.e., both image data and structured grids). Given a cell id, it is possible to determine vertex, edge, or face neighbors using simple constant time operations. First, given the cell id in a three-dimensional structured dataset, we use a combination of division and modulo arithmetic to compute the structured coordinates

      \\begin{eqnarray*} i &=& \\text{id} \\mod (n_x - 1) \\\\ j &=& \\frac{\\text{id}}{n_x - 1} \\mod (n_y - 1) \\\\ k &=& \\frac{\\text{id}}{(n_x - 1)(n_y - 1)} \\end{eqnarray*} \\bf\\tag{8-29}

      Face neighbors are determined by incrementing one of the i, j, or k indices. Edge neighbors are determined by incrementing any two indices, while vertex neighbors are found by incrementing all three indices. Care must be taken while incrementing to insure that the indices fall in the range

      \\begin{eqnarray*} 0 \\leq i < n_x - 1 \\\\ 0 \\leq j < n_y - 1 \\\\ 0 \\leq k < n_z - 1 \\bf\\tag{8-30} \\end{eqnarray*}

      An attempt to index outside these ranges indicates that the neighbor in question does not exist.

      "},{"location":"VTKBook/08Chapter8/#searching","title":"Searching","text":"

      Given a point p = (x, y, z) we can determine the cell containing p by using the equations given in Figure 8-32. These equations generate the structured coordinates (i, j, k), which can then be converted to cell id (i.e., dataset coordinates) using Equation 8-3.

      To find the closest point to p, we compute the structured coordinates by rounding to the nearest integer value (instead of using the floor function). Thus,

      \\begin{eqnarray*} i = \\text{int}\\left( \\frac{x-x_0}{x_1 - x_0} \\right) \\\\ j = \\text{int}\\left( \\frac{y-y_0}{y_1 - y_0} \\right) \\\\ k = \\text{int}\\left( \\frac{z-z_0}{z_1 - z_0} \\right) \\end{eqnarray*} \\bf\\tag{8-30}"},{"location":"VTKBook/08Chapter8/#811-putting-it-all-together","title":"8.11 Putting It All Together","text":"

      In this section we will finish our earlier description of an implementation for unstructured data. We also define a high-level, abstract interface for cells and datasets. This interface allows us to implement the general (i.e., dataset specific) algorithms in the Visualization Toolkit. We also describe implementations for color scalars, searching and picking, and conclude with a series of examples to demonstrate some of these concepts.

      "},{"location":"VTKBook/08Chapter8/#unstructured-topology","title":"Unstructured Topology","text":"

      In Chapter 5 - Data Representation we described data representations for the unstructured dataset types vtkPolyData and vtkUnstructuredGrid. Close examination of this data structure reveals that operations to retrieve topological adjacency are inefficient. In fact, to implement any operation to retrieve vertex, edge, or face neighbors requires a search of the cell array, resulting in O(n) time complexity. This is unacceptable for all but the smallest applications, since any algorithm traversing the cell array and retrieving adjacency information is at a minimum O(n2).

      The reason for this inefficiency is that the data representation is a \"downward\" hierarchy (Figure 8-34(b)). That is, given a cell we can quickly determine the topological features lower in the topological hierarchy such as faces, edges, and points. However, given a face, edge, or point we must search the cell array to determine the owning cells. To improve the efficiency of this data representation, we must introduce additional information into the hierarchy that allows \"upward\" hierarchy traversal (similar to that shown in Figure 8-34(a)). Figure 8-34. Enhancing hierarchical unstructured data representation. (a) Conventional topological hierarchy for geometric model. (b) Basic unstructured data hierarchy. (c) Full unstructured data hierarchy. By introducing upward references from points to cells, the unstructured data hierarchy may be efficiently traversed in both directions, and is more compact than conventional topological hierarchies. Figure 8-35. Complete unstructured data representation including link lists. There are m cells and n points. The n structures in the link list are lists of cells that use each vertex. Each link list is variable in length.

      The solution to this problem is to extend the unstructured data structure with cell links. The cell links array is a list of lists of cells that use each point and corresponds to the upward links of Figure 8-34(c). The cell links array transforms the hierarchical structure of Figure 5-13 into a ring structure. Cells reference their composing points, and points in turn reference the cells that use them. The full unstructured data structure is shown in Figure 8-35.The cell links array is in fact an implementation of the use sets of Equation 5-1. We can use this equation to compute adjacency operation in constant time, if the maximum number of cells using a point is much smaller than the number of points in a dataset. To see this, we refer to Equation 8-25 and see that the adjacency operations consist of a finite number of set intersections. Each operation is an intersection of the link lists for each point. If the number of cells in each link list is \"small,\" then the intersection operation can be bounded by a fixed constant in time, and the total operation can be considered a constant time operation.

      There are several important characteristics of this data representation.

      • The cell links array is an extension of the basic unstructured data representation. As a result, we can defer the construction of the cell links until they are required. Often the cell links are never needed and require no computer resources to compute or store.

      • Building the cell links is a linear O(n) operation. Each cell is traversed and for every point that the cell uses, the list of using cells for that point is extended to include the current cell. Building the cell links is only needed once as an initialization step.

      • The data representation is compact relative to other topology representation schemes (e.g., the winged-edge structure and the radial-edge structures [Baumgart74] [Weiler88]). These other data structures contain explicit representation of intermediate topology such as edges, loops, faces, or special adjacency information such as adjacent edges (winged-edge structure) or extensive \"use\" descriptions (radial-edge structure). The compactness of representation is particularly important for visualization, since the data size is typically large.

      The unstructured data structure in the Visualization Toolkit is implemented using the four classes vtkPoints (and subclasses), vtkCellArray, vtkCellTypes, and vtkCellLinks. The building of this data structure is incremental. At a minimum, the points and cells are represented using vtkPoints and vtkCellArray. If random access or extra type information is required, then the object vtkCellTypes is used. If adjacency information is required, an instance of the class vtkCellLinks is created. These operations are carried out behind the scenes, and generally do not require extra knowledge by the application programmer.

      "},{"location":"VTKBook/08Chapter8/#abstract-interfaces","title":"Abstract Interfaces","text":"

      With the completion of Chapters 5 and 8, we can summarize the abstract interface for cells, datasets, and the point data attributes. These pseudo-code descriptions encapsulate the core functionality of the classes vtkDataSet, vtkCell, and vtkPointData, and their subclasses. All algorithms presented in this text can be implemented using combinations of these methods.

      Dataset Abstraction. The dataset is the central data representation in VTK. Datasets are composed of one or more cells and points. Associated with the points are attribute data consisting of scalars, vectors, normals, texture coordinates, and tensors.

           type = GetDataObjectType()\n          Return the type of dataset (e.g., vtkPolyData, vtkImageData, vtkStructuredGrid, vtkRectilinearGrid, or vtkUnstructuredGrid).\n\n     numPoints = GetNumberOfPoints()\n          Return the number of points in the dataset.\n\n     numCells = GetNumberOfCells()\n          Return the number of cells in the dataset.\n\n     GetPoint(ptId,x)\n          Given a point id, return the (x,y,z) coordinates of the point.\n\n     cell = GetCell(cellId)\n          Given a cell id, return a pointer to a cell object.\n\n     type = GetCellType(cellId)\n          Return the type of the cell given by cell id.\n\n     GetCellTypes(types)\n          Return a list of types of cells that compose the dataset.\n\n     cells = GetPointCells(ptId)\n          Given a point id, return the cells that use this point.\n\n     GetCellPoints(cellId, ptIds)\n          Given a cell id, return the point ids (e.g., connectivity list) defining the cell.\n\n     GetCellNeighbors(cellId, ptIds, neighbors)\n          Given a cell id and a list of points composing a boundary face of the cell, return the neighbors of that cell sharing the points.\n\n     cellId = FindCell(x, cell, cellId, tol2, subId, pcoords, weights)\n          Given a coordinate value x, an initial search cell defined by cell and cellId, and a tolerance measure (squared), return the cell id and sub-id of the cell containing the  point and its interpolation function weights. The initial search cell is used to speed up the search process when the position x is known to be near the cell. If no cell is found, cellId < 0 is returned.\n\n     pointData = GetPointData()\n         Return a pointer to the object maintaining point attribute data. This includes scalars, vectors, normals, tensors, and texture coordinates, as well as any other data arrays that the field carries.\n\n     cellData = GetCellData()\n          Return a pointer to the object maintaining cell attribute data. This includes scalars,a vectors, normals, tensors, and texture coordinates, as well as any other data arrays that the field carries.\n\n     bounds = GetBounds()\n          Get the bounding box of the dataset.\n\n     length = GetLength()\n          Return the length of the diagonal of the bounding box of the dataset.\n\n     center = GetCenter()\n          Get the center of the bounding box of the dataset.\n\n     range = GetScalarRange()\n          A convenience method to return the (minimum, maximum) range of the scalar attribute data associated with the dataset.\n\n     dataSet = NewInstance()\n          Make a copy of the current dataset. A \"virtual\" constructor. (Typically, reference counting methods are used to copy data.)\n\n     CopyStructure(dataSet)\n          Update the current structure definition (i.e., geometry and topology) with the supplied dataset.\n

      Cell Abstraction. Cells are the atomic structures of VTK. Cells consist of a topology, defined by a sequence of ordered point ids, and a geometry, defined by point coordinates. The cell coordinate consists of a cell id, a subcell id, and a parametric coordinate. The subid specifies a primary cell that lies within a composite cell such as a triangle strip. Cell edges and faces are defined implicitly from the topology of the cell.

          type = GetCellType()\n          Return the type of the cell. Must be one of the twelve VTK cell types (or the empty cell\n          type).\n\n     dim = GetCellDimension()\n          Return the topological definition of the cell.\n\n     order = GetInterpolationOrder()\n          Return the degree of the interpolating polynomial of the cell. (The twelve cell types are\n          all degree 1; cells added in the future may be of higher-order.)\n\n     numberPoints = GetNumberOfPoints()\n          Return the number of points that define the cell.\n\n     points = GetPoints()\n          Return a list of point ids defining the cell.\n\n     numberEdges = GetNumberOfEdges()\n          Return the number of edges in the cell.\n\n     edge = GetEdge(i)\n          Given an edge id ( $0 \\leq i < numberEdges$ ) return a pointer to a cell that represents an\n          edge of the cell.\n\n     numberFaces = GetNumberOfFaces()\n          Return the number of faces in a cell.\n\n     face = GetFace(i)\n          Given an face id ( $0 \\leq i < numberFaces$ ) return a pointer to a cell that represents a face\n          of the cell.\n\n     inOutStatus = CellBoundary(subId, pcoords, poindIds)\n          Given a cell subid and parametric coordinates, return a list of point ids that define the closest boundary face of the cell. Also return whether the point is actually in the cell.\n\n     inOutStatus = EvaluatePosition(x, closestPoint, subId, pcoords, weights, dist2)\n          Given a point coordinate x, return the sub-id, parametric coordinates, and interpolation\n          weights of the cell if x lies inside the cell. The position closestPoint is the closest point\n          on the cell to x (may be the same) and dist2 is the squared distance between them. The\n          method returns an inOutStatus indicating whether x is topologically inside or outside\n          the cell. That is, the point may satisfy parametric coordinate conditions but may lie off\n          the surface of the cell (e.g., point lies above polygon). Use both inOutStatus and dist2\n          to determine whether point is both topologically and geometrically in the cell.\n\n     EvaluateLocation(subId, pcoords, x, weights)\n          Given a point location (i.e., sub-id and parametric coordinates), return the position x of\n          the point and the interpolation weights.\n\n     Contour(value, cellScalars, locator, verts, lines, polys, inputPointData, outputPointData)\n          Given a contour value and scalar values at the cell points, generate contour primitives\n          (vertices, lines, or polygons with associated points and attribute data values). The\n          points are placed in a locator object (see [\"Searching\"](/VTKBook/08Chapter8/#searching_1) in this Chapter) which merges\n          coincident points, and the attribute data values are interpolated (along the cell edge) from\n          the inputPointData to the outputPointData.\n\n     Clip(value, cellScalars, locator, cells, inputPointData, outputPointData, insideOut)\n          Given a contour value and scalar values at the cell points, clip the cell to generate new\n          cells of the same topological dimension as the original cell. The points are placed in a\n          locator object (see [\"Searching\"](/VTKBook/08Chapter8/#87-searching) in [Chapter 8](/VTKBook/08Chapter8)) which merges coincident points, and the\n          attribute data values are interpolated (or copied) from the inputPointData to the\n          outputPointData. The clipped cells are placed in the cells list.\n\n     Derivatives(subId, pcoords, values, dim, derivs)\n          Given a cell location (i.e., subid and parametric coordinates) and data values at the cell\n          points, return dim*3 derivatives (i.e., corresponds to the x, y, and z directions times\n          dimension of data).\n\n     inOutStatus = IntersectWithLine(p1, p2, tol, t, x, pcoords, subId)\n          Given a finite line defined by the two points p1 and p2 and an intersection tolerance,\n          return the point of intersection x. The parametric coordinate t along the line and cell\n          location at the point of intersection is also returned. Returns a nonzero if intersection\n           occurs.\n\n     Triangulate(index, ptIds, points)\n          Decompose the cell into simplices of dimension equal to the topological cell dimension.\n          The index is an integer that controls the triangulation if more than one triangulation\n          is possible. The simplices are defined by an ordered list of point ids and their\n          corresponding coordinates.\n\n     bounds = GetBounds()\n          Return the bounding box of the cell.\n

      Point and Cell Attribute Abstraction. Point and cell attribute data is information associated with the points and cells of a dataset. This information consists of scalars, vectors, normals, tensors, and texture coordinates. There is a one-to-one relationship between the points and cells in a dataset and its corresponding point and cell attribute data. For example, a point scalar value at location 100 is associated with point id 100.

      Many of the methods described below deal with moving data from the input to the output of a filter. Since the possibility exists that new types of attribute data could be added in the future, the details of moving data is hidden as much as possible (i.e., minimize the knowledge that the filter has about specific attribute types). Thus, generic functions like CopyData() allow for copying data from the input to the output without knowing what this data is.

           CopyScalarsOn() / CopyScalarsOff()\n          Turn on/off boolean flag controlling copying of scalar data from input to output of\n          filter.\n     CopyVectorsOn() / CopyVectorsOff()\n          Turn on/off boolean flag controlling copying of vector data from input to output of\n          filter.\n\n     CopyNormalsOn() / CopyNormalsOff()\n          Turn on/off boolean flag controlling copying of normal data from input to output of\n          filter.\n\n     CopyTensorsOn() / CopyTensorsOff()\n          Turn on/off boolean flag controlling copying of tensor data from input to output of\n          filter.\n\n     CopyTextureCoordsOn() / CopyTextureCoordsOff()\n          Turn on/off boolean flag controlling copying of texture coordinates data from input to\n          output of filter.\n\n     CopyAllOn() / CopyAllOff()\n           Turn on/off all boolean flags controlling copying of all attribute data from input to\n            output of filter.\n\n     PassData(pointData)\n          Transfer all point attribute data (pointData) to the output according to the copy flags\n          listed previously.\n\n     CopyAllocate(pointData)\n          Initialize and allocate storage for point-by-point copy process.\n\n     CopyData(pointData, fromId, toId)\n          Given point data and a specific point id, copy the point attribute data (pointData) to the\n          output point.\n\n     InterpolateAllocate(pointData)\n          Initialize and allocate storage for point-by-point interpolation process.\n\n     InterpolatePoint(pointData, toId, ptIds, weights)\n          Given input point data (pointData) and a list of points and their interpolation weights,\n          interpolate data to the specified output point.\n\n     InterpolateEdge(pointData, toId, p1, p2, t)\n          From an edge defined by the two points p1 and p2, interpolate the pointData at the edge\n          parametric coordinate t and copy the interpolated attribute data to the output point ptId.\n\n     NullPoint(int ptId)\n          Set the data value(s) of the specified output point id to a null value.\n\n     SetScalars() / GetScalars()\n          Set / return scalar data. The GetScalars() method may return a NULL value, in which\n          case the scalars are not defined.\n\n     SetVectors() / GetVectors()\n          Set / return vector data. The GetVectors() method may return a NULL value, in which\n          case the vectors are not defined.\n\n     SetNormals() / GetNormals()\n          Set / return normal data. The GetNormals() method may return a NULL value, in which\n          case the normals are not defined.\n\n     SetTensors() / GetTensors()\n          Set / return tensor data. The GetTensors() method may return a NULL value, in which\n          case the tensors are not defined.\n\n     SetTextureCoords() / GetTextureCoords()\n          Set / return texture coordinate data. The GetTextureCoords() method may return a\n          NULL value, in which case the texture coordinates are not defined.\n
      "},{"location":"VTKBook/08Chapter8/#traversing-intermediate-topology","title":"Traversing Intermediate Topology","text":"

      The dataset abstraction implemented by VTK provides simple techniques to traverse points and cells. Sometimes we want to traverse intermediate topology such as edges or faces. For example, to identify boundary edges in a triangular mesh we must traverse each edge, counting the number of triangles that use each edge. (Recall that boundary edges are used by just one triangle.) Unfortunately, there is no obvious way to traverse edges. The same problem holds true if we want to traverse the faces of a dataset containing 3D cells.

      A simple solution is to traverse each cell and then obtain the edges (or faces) that compose the cell. The problem with this approach is that edges and faces are generally used by more than one cell, resulting in multiple visits to the same face or edge. This may be acceptable in some algorithms, but usually we count on visiting each edge or face only once.

      A better solution to this problem is to traverse each cell as before, but only process intermediate topology if the current cell has the smallest cell id. (The current cell is the cell being visited in the traversal process.) To determine whether the current cell has the smallest cell id, we obtain all cells using the intermediate topology. This information can be obtained using the topological adjacency operators described earlier (e.g., Equation 8-25).

      To illustrate this process consider visiting the edges of a triangle mesh. We begin by visiting the first triangle, t, and then its edges. For each edge we determine the adjacent triangle(s) (if any) that use the edge. If the id of the adjacent triangle(s) is greater than triangle t's id, or there are no adjacent triangles, then we know to process the current edge. (Of course the first triangle will always have the smallest id but this will change as the traversal proceeds.) We then continue traversing the triangle list for new t's. In this way all the edges of the mesh will be visited.

      "},{"location":"VTKBook/08Chapter8/#color-scalar-data","title":"Color Scalar Data","text":"

      Multi-valued scalar data, or scalars represented by various color representations, are treated specially by the Visualization Toolkit. These data arise, for example, when using a color specification to directly control the color of objects rather than mapping a scalar value through a lookup table. (See \"Color Mapping\" in Chapter 6 for more information.)

      By default, the mapping of scalars into colors proceeds as follows (vtkMapper and subclasses are responsible for implementing this behavior):

      • If the scalar type is unsigned char with the tuple size ranging between one and four components, the data is considered to be color data.

      • Four component data is assumed to be a RGBA (red-green-blue-alpha transparency) color specification. Three component data is assumed to be a RGB color specification. Two component data is assumed to be a IA (intensity-alpha) representation. Single component data is assumed to be a I (intensity) value.

      • Any other data type, or data with more than four components, is assumed to represent a scalar value. In that case the scalars are mapped through a lookup table to produce colors during the rendering process.

      It is possible to force unsigned char data to be mapped through a lookup table. The vtkMapper method SetColorModeToMapScalars() forces all data regardless of type to be mapped through the lookup table.

      "},{"location":"VTKBook/08Chapter8/#searching_1","title":"Searching","text":"

      The Visualization Toolkit provides two classes to perform searches for dataset points and cells. These are vtkPointLocator and vtkCellLocator. (Both of these classes are subclasses of vtkLocator, which is an abstract base class for spatial search objects.) vtkPointLocator is used to search for points and, if used with the topological dataset operator GetPointCells(), to search for cells as well. vtkCellLocator is used to search for cells.

      vtkPointLocator is implemented as a regular grid of buckets (i.e., same topology and geometry as an image dataset). The number of buckets can be user-specified, or more conveniently, automatically computed based on the number of dataset points. On average, vtkPointLocator provides constant time access to points. However, in cases where the point distribution is not uniform, the number of points in a bucket may vary widely, giving O(n) worst-case behavior. In practice this is rarely a problem, but adaptive spatial search structures (e.g., an octree) may sometimes be a better choice.

      Determining closest point to a point p using vtkPointLocator (as well as other spatial search structures) is a three-step process. In the first step, the bucket containing p is found using the appropriate insertion scheme. (For vtkPointLocator this is three divisions to determine bucket indices (i, j, k).) Next, the list of points in this bucket is searched to determine the closest point. However, as Figure 8-36 shows, this may not be the true closest point, since points in neighboring buckets may be closer. Consequently, a final search of neighboring buckets is necessary. The search distance is a function of the distance to the current closest point. Once all neighbors within this distance are searched, the closest point is returned. Figure 8-36. Determining closest point to $p$ in vtkPointLocator. Initial search in bucket results in point a. Search must extend beyond local bucket as a function of search radius R, resulting in point b. Figure 8-37. Structure of spatial search structure vtkCellLocator. The data structure represents a uniformly subdivided octree.

      vtkCellLocator is implemented as a uniformly subdivided octree with some peculiar characteristics (Figure 8-37). Conventional octree representations use upward parent and downward children pointers to track parent and children octants. Besides the required list of entities (i.e., points or cells) in each octant, additional information about octant level, center, and size may also be maintained. This results in a flexible structure with significant overhead. The overhead is the memory resources to maintain pointers, plus the cost to allocate and delete memory.

      In contrast, vtkCellLocator uses a single array to represent the octree. The array is divided into two parts. The first part contains a list of parent octants, ordered according to level and octant child number. In the second part are the terminal, or leaf octants. The terminal octants are ordered on a regular array of buckets, just the same as vtkLocator. The terminal octants contain a list of the entities inside the octant. The parent octants maintain a value indicating whether the octant is empty, or whether something is inside it. (Both types of information are represented in the same portion of the octant structure.) Because the octree is uniformly subdivided, parent-child relationships, as well as octant locations, can be computed quickly using simple division operations.

      Figure 8-38. The picking hierarchy in VTK. All subclasses of vtkAbstractPropPicker return the picked instance of vtkProp. The information is returned as a vtkAssemblyPath. The assembly path is necessary because some props may exist in an assembly hierarchy. The classes vtkWorldPointPicker and vtkPropPicker are hardware accelerated picking classes. All others use software ray casting.

      The advantage of this structure is that memory can be allocated and deleted quickly. In addition, insertion into the octree is exactly the same as with vtkLocator, and is simpler than conventional octrees. The parent octants provide quick culling capability, since their status (empty or nonempty) allows us to stop certain types of search operations. On the downside, because the octree is uniformly subdivided, this structure is wasteful of memory resources if the data is non-uniformly distributed.

      Our experience with the search structures described here is that they work well for many types of visualization data. However, if your data is non-uniform, you may want to implement your own special search classes.

      "},{"location":"VTKBook/08Chapter8/#picking","title":"Picking","text":"

      The Visualization Toolkit provides a variety of classes to perform actor (or vtkProp), point, cell, and world point picking (Figure 8-38). Depending on which picker is used, either software-based geometric intersection or hardware picking is used. The following describes each of the picker types in detail.

      All pickers are subclasses of vtkAbstractPicker which defines the basic pick interface. The user must specify a selection point in display coordinates for a specified instance of vtkRenderWindow and invoke the Pick() method. At a minimum, the class must return an x-y-z pick position in world coordinates. It is possible to limit the pick candidates to a list of vtkProps (the PickList). The class also invokes the StartPickEvent, PickEvent, and EndPickEvent events that are invoked prior to picking, during picking, and after picking, respectively.

      Classes that can return information indicating which vtkProp they have picked are subclasses of vtkAbstractPropPicker. After the pick operation, vtkAbstractPropPicker returns a vtkAssemblyPath. The assembly path is an ordered list of instances of vtkProp and possibly associated 4x4 transformation matrices. The path represents a concatenated hierarchy of assembly nodes if an assembly has been defined (see \"Assemblies and Other Types of [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)\" in Chapter 3) for more information about props and assemblies).

      The object vtkPicker intersects a ray defined from camera position to a screen (i.e., pixel) coordinate against the bounding box of all pickable and nontransparent [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)3D's. (A vtkProp is pickable if its Pickable instance variable is true.) The result of the vtkPicker pick operation is to return a list of the [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)3D's whose bounding box is intersected. The prop closest to the camera position is also returned.

      The object vtkPointPicker intersects the ray against the points defining each vtkProp3D, and returns the point coordinate closest to the camera position, as well as the vtkProp3D that the point belongs to. Since screen resolution prevents precise selection of a point, a tolerance around the ray must be specified. The tolerance is expressed as a fraction of the rendering window size. (Rendering window size is measured across the window diagonal.) Points must lie within this tolerance to be picked.

      The object vtkCellPicker intersects the ray with the cells defining each vtkProp3D, and returns the point of intersection, as well as the vtkProp3D that the cell belongs to. If you are trying to select a cell belonging to a particular vtkProp3D, vtkCellPicker is the object to use because it performs surface (or cell) intersection. Unfortunately, vtkCellPicker is the slowest of the pickers because of greater computational requirements.

      The class vtkWorldPointPicker returns the (x,y,z) coordinate value of a pick in the rendering window. To determine this information, it combines the display (x,y) values with the z-buffer depth values. Of all the pickers this is the fastest, but it cannot determine the actual cell, point or vtkProp that is selected since it is not a subclass of vtkAbstractPropPicker. (Note: on some systems z-buffer operations are inoperative and this object will not function properly.)

      By default picking is performed with the class vtkPropPicker. This class uses hardware-accelerated picking so it is generally faster than software based picking. Unlike the other hardware accelerated class (vtkWorldPointPicker), it returns the instance of vtkProp that was picked as well as the (x,y,z) world coordinate value

      Figure8-39 summarizes the five concrete picking classes. Picking is built into the vtkRenderWindowInteractor class using the \"p\" key (see \"RenderWindowInteractor\" in Chapter 3). By default a vtkPropPicker is created and used, but you are free to specify your own picker type.

      "},{"location":"VTKBook/08Chapter8/#examples","title":"Examples","text":"

      To conclude this section, we will examine how some of the dataset, cell, and point attribute operations are used. These operations tend to be used by class developers. You will not need to use them if you build applications by constructing visualization pipelines with existing filters.

      Find Free Edges. In our first example we will take a peek inside the filter vtkLinearExtrusionFilter. This filter implements the following modelling operation. Given a polygonal mesh, extrude the mesh in a given direction, constructing a \"skirt\" or \"walls\" from the free edges. If the polygonal example is a single square, the result of this operation is a cube. Or, if the polygonal data consists of a single line, the result of the operation is a quadrilateral. A point will generate a line as shown in Figure 8-40(a). Figure 8-39. Summary of picking operations. The top three pick classes (a)-(c) use software ray casting. The bottom two pick classes (d)-(e) use hardware acceleration. Figure 8-40. Depiction of linear and rotational extrusion.

      Recall that free edges are edges used by only one polygon. We can determine this information using the dataset topology operation GetCellEdgeNeigbors(). We use Equation 8-25 and the two points defining the edge of the polygon to determine the adjacency set (i.e., the polygons sharing this edge). If no other polygon uses this edge, then the edge is extruded to generate a triangle strip. The C++ pseudo code is as follows.

      for (cellId=0; cellId < numCells; cellId++) {\n  cell = mesh->GetCell(cellId);\n  if ((dim=cell->GetCellDimension()) == 0)\n  //create lines from points\n  else if ( dim == 1 )\n  // create strips from lines\n  else if ( dim == 2 ) // create strips from boundary edges\n    {\n    numEdges = cell->GetNumberOfEdges(); for (i=0; i<numEdges; i++)\n    {\n  edge = cell->GetEdge(i);\n  for (j=0; j<(edge->GetNumberOfPoints()-1); j++)\n    {\n    p1 = edge->PointIds->GetId(j);\n    p2 = edge->PointIds->GetId(j+1);\n    mesh.GetCellEdgeNeighbors(cellId, p1, p2, cellIds);\n    if ( cellIds->GetNumberOfIds() < 1 )\n      {\n      //generate triangle strip\n      }\n    } //for each subedge\n  } //for each edge\n} //for each polygon or triangle strip } //for each cell\n

      This same approach is used in the vtkRotationalExtrusionFilter (Figure 8-40(b)). The difference between these two functions is that the type of motion is rotational as compared to linear (vtkLinearExtrusionFilter). These two filters can be used to perform some nifty modelling operations. Linear extrusion can be used to create bar charts with arbitrary cross sections, or to sweep out three-dimensional fonts. The rotational extrusion filter can be used to create rotationally symmetric objects such as bottles or wine glasses. Examples of these techniques are shown in Figure 8-41.

      Find Cells. In this example we combine picking and a topological operation to select cells sharing a common point. Specifically, we use vtkPointPicker and the topological dataset operation GetPointCells(). Figure 8-42 depicts this operation. We have also included a fragment of C++ code implementing this procedure. Note that this procedure will work for any dataset type, even if the geometry is implicitly defined (e.g., vtkImageData).

      The most difficult part of this procedure is the picking process. The selection point must be specified in pixel coordinates. The vtkPointPicker converts these coordinates into world and then dataset coordinates using the renderer in which the pick occurred. (The renderer uses the transformation matrix of its active camera to perform coordinate transformation.)

      The picking process is conveniently managed in vtkRenderWindowInteractor. This object allows the specification of functions to execute just before picking and just after picking (i.e., \"AddObserver StartPickEvent\" and \"AddObserver EndPickEvent\"). Using this facility we can define a post-picking function to retrieve the point id and then execute the GetPointCells() operation. This process is shown in Figure 8-42. (a) Linearly extruded fonts to show letter frequency in text. (b) Rotationally symmetric objects. (c) Rotation in combination with linear displacement and radius variation. Figure 8-41. Models created using linear and rotational extrusion. (a) See AlphaFrequency.cxx and AlphaFrequency.py.; (b). See Bottle.cxx and Bottle.py.; (c) See Spring.cxx and Spring.py.

      Point Probe. In this example we will show how to build a point probe using the dataset and cell operations described in this chapter. A point probe is defined as follows. Given a (x,y,z) point coordinate, find the cell coordinates (i.e., cell id, subcell id, and parametric coordinates) and the interpolation weights. Once the interpolation weights are found, we can then compute local data values at (x,y,z).

      The point probe is implemented using the dataset operation FindCell(). This method requires a point specified in global coordinates (our (x,y,z) value) and a tolerance. The tolerance is often necessary because of numerical precision or when picking near the surface of 3D cells, or on 0D, 1D, and 2D cells. The FindCell() operation returns the information we require, plus the interpolation weights of the cell containing our point probe. To determine the data value at our probe point, we need to retrieve the data values on the cell points. We can then use the interpolation functions of Equation 8-4 to determine the probe scalar value.

      Figure 8-42. Selecting group of cells sharing a common point. (a) Original data. (b) Selected cells sharing point on corner. Cells shrunk for clarity. The small sphere indicates the selected point. (c) C++ code fragment in pick routine.

      Figure 8-43 depicts this process and includes C++ code. In the example we use the combustor dataset with the objects vtkCursor3D, vtkProbeFilter, and vtkGlyph3D. The purpose of the cursor is to control the position of the probe point. The class vtkProbeFilter performs the probing operation just described. (This filter has been generalized so that it can handle more than one input point.) vtkGlyph3D is used to place an oriented, scaled cone at the cursor focal point. This gives us visual feedback about the scalar and vector quantities at the probe. Of course, we can extract numeric values and display them to the user if this is important. Figure 8-43. Creating a point probe. Visualization network shown in diagram above. C++ code shows inner loop of vtkProbeFilter and resulting image for combustor data (probe.cxx)."},{"location":"VTKBook/08Chapter8/#812-chapter-summary","title":"8.12 Chapter Summary","text":"

      Three important visualization coordinate systems are the world, dataset, and structured coordinate systems. The world coordinate system is an x-y-z Cartesian three-dimensional space. The dataset coordinate system consists of a cell id, subcell id, and parametric coordinates. The structured coordinate system consists of (i,j,k) integer indices into a rectangular topological domain.

      Visualization data is generally in discrete form. Interpolation functions are used to obtain data at points between the known data values. Interpolation functions vary depending on the particular cell type. The form of the interpolation functions are weighting values located at each of the cells points. The interpolations functions form the basis for conversion from dataset to global coordinates and vice versa. The interpolation functions also are used to compute data derivatives.

      Topological operators provide information about the topology of a cell or dataset. Obtaining neighboring cells to a particular cell is an important visualization operation. This operation can be used to determine whether cell boundaries are on the boundary of a dataset or to traverse datasets on a cell-by-cell basis.

      Because of the inherent regularity of image datasets, operations can be efficiently implemented compared to other dataset types. These operations include coordinate transformation, derivative computation, topological query, and searching.

      "},{"location":"VTKBook/08Chapter8/#813-bibliographic-notes","title":"8.13 Bibliographic Notes","text":"

      Interpolation functions are employed in a number of numerical techniques. The finite element method, in particular, depends on interpolation functions. If you want more information about interpolation functions refer to the finite element references suggested below [Cook89] [Gallagher75] [Zienkiewicz87]. These texts also discuss derivative computation in the context of interpolation functions.

      Visualizing higher-order datasets is an open research issue. While [Schroeder06] describes one approach, methods based on GPU programs are emerging. Other approaches include tailored algorithms for a particular cell type.

      Basic topology references are available from a number of sources. Two good descriptions of topological data structures are available from Weiler [Weiler86] [Weiler88] and Baumgart [Baumgart74]. Weiler describes the radial-edge structure. This data structure can represent manifold and non-manifold geometry. The winged-edge structure described by Baumgart is widely known. It is used to represent manifold geometry. Shephard [Shephard88] describes general finite element data structures these are similar to visualization structures but with extra information related to analysis and geometric modelling.

      There are extensive references regarding spatial search structures. Samet [Samet90] provides a general overview of some. Octrees were originally developed by Meagher [Meagher82] for 3D imaging. See [Williams83], [Bentley75], and [Quinlan94] for information about MIP maps, kd-trees, and binary sphere trees, respectively.

      "},{"location":"VTKBook/08Chapter8/#814-references","title":"8.14 References","text":"

      [Baumgart74] B. G. Baumgart. \"Geometric Modeling for Computer Vision.\" Ph.D. thesis, Stanford University, Palo Alto, CA, 1974.

      [Bentley75] J. L. Bentley. \"Multidimensional Binary Search Trees Used for Associative Search.\" Communications of the ACM. 18(9):509-516, 1975.

      [Conte72] S. D. Conte and C. de Boor. Elementary Numerical Analysis. McGraw-Hill Book Company, 1972.

      [Cook89] R. D. Cook, D. S. Malkus, and M. E. Plesha. Concepts and Applications of Finite Element Analysis. John Wiley and Sons, New York, 1989.

      [Gallagher75]R. H. Gallagher. Finite Element Analysis: Fundamentals. Prentice Hall, Upper Saddle River, NJ, 1975.

      [Meagher82] D. J. Meagher. \"Efficient Synthetic Image Generation of Arbitrary 3D Objects.\" In Proceedings of the IEEE Conference on Pattern Recognition and Image Processing. pp. 473-478, 1982.

      [Quinlan94] S. Quinlan. \"Efficient Distance Computation Between Non-Convex Objects.\" In Proceedings of IEEE International Conference on Robotics and Automation. 1994.

      [Samet90] H. Samet. Design and Analysis of Spatial Data Structures. Addison-Wesley, Reading, MA, 1990.

      [Schroeder06] W. J. Schroeder, F. Bertel, M. Malaterre, D. Thompson, P. P. Pe\u0301bay, R. O'Bara and S. Tendulkar. \"Methods and Framework for Visualizing Higher-Order Finite Elements.\" IEEE Transactions on Visualization and Computer Graphics, 12(4):446-460, July/August 2006.

      [Shephard88] M. S. Shephard and P. M. Finnigan. \"Toward Automatic Model Generation.\" State-of-the-Art Surveys on Computational Mechanics. A. K. Noor and J. T. Oden, eds., ASME, pp. 335-366, 1989.

      [Weiler86] K. J. Weiler. Topological Structures for Geometric Modeling. Ph.D. thesis, Rensselaer Polytechnic Institute, Troy, NY, May 1986.

      [Weiler88] K. J. Weiler. \"The Radial-Edge Structure: A Topological Representation for Non-Manifold Geometric Boundary Representations.\" In M. J. Wozny, H. W. McLaughlin, and J. L. Encarnacao, eds., Geometric Modeling for CAD Applications. pp. 3-36, North Holland, 1988.

      [Williams83] L. Williams. \"Pyramidal Parametrics.\" Computer Graphics (SIGGRAPH 83). 17(3):1-11, 1983.

      [Zienkiewicz87] O. C. Zienkiewicz and R. L. Taylor. The Finite Element Method Vol. 1. McGraw Hill Book Co., NY, 4th ed., 1987.

      "},{"location":"VTKBook/08Chapter8/#815-exercises","title":"8.15 Exercises","text":"Figure 8-44. Exercise figures.

      8.1 Given a volume of dimensions 5 \\times 10 \\times 15 with origin (1.0, 2.0,3.0) and voxel spacing (0.5, 0.5, 1.0).

      a) Compute minimum point position.

      b) Compute maximum point position.

      c) For cell id 342, compute cell minimum point position and maximum point

      d) What points (list ids) define cell id 342?

      e) Given point specified in structured coordinates as i, j, k = (3, 6, 4) ;r, s, t = (0.1, 0.2, 0.5), compute global coordinates.

      f) Given point id 342; compute global coordinates.

      8.2 Compute global coordinates and interpolation weights for the points specified in dataset coordinates (refer to Figure 8-44(a-d)).

      a) Line with r = 0.5.

      b) Triangle with r, s = (0.25, 0.33).

      c) Voxel with r, s, t = (0.25, 0.33, 0.5).

      8.3 Compute parametric coordinates for cells shown in Figure 8-44(a-d).

      a) Line with x, y, z = (0.3, 0.6, 0.9).

      b) Triangle with x, y, z = (0.5, 0.25, 0.0). c) Voxel with x, y, z = (0.5, 0.4, 2.0).

      8.4 Given the line shown in Figure 8-44(a), if scalar data values are (s0, s1) = (0.0, 0.25), what are the derivatives in the x, y, z directions?

      8.5 Refer to Figure 8-44(d) and let the numbers indicate cell ids and the letters indicate point ids. a) List the cells using point A.

      b) List the cells using point B.

      c) List cells using edge (A, B). How does this list correspond to your answers in parts a) and b) above?

      8.6 Refer to Figure 8-44(e).

      a) How many boundary faces are there?

      b) How many \"internal\" faces?

      8.7 Describe a procedure to intersect two finite lines. How does tolerance value come into play?

      8.8 Describe a procedure to intersect a line and triangle. Are there special characteristics of a triangle that can be used to speed this operation?

      8.9 Compare memory requirements for the three unstructured grid data structures shown in Figure 8-34. Assume that two cells use each face, four faces use each edge, and six edges use each vertex (i.e., a structured dataset).

      8.10 Using the abstract cell and dataset interface, write a program to compute

      a) number of points in a dataset,

      b) number of cells in a dataset,

      c) number of edges in a dataset,

      d) number of faces in a dataset.

      8.11 Given a volume of dimensions 5 \\times 10 \\times 15.

      a) How many internal faces are there (i.e. used by two voxels)?

      b) How many boundary faces are there (i.e., used by one voxel)?

      8.12 Write a general extrusion filter that sweeps an object along a path to construct a new surface. Assume that the path is defined by a sequence of transformation matrices. Can you think of a way to prevent self-intersection?

      "},{"location":"VTKBook/09Chapter9/","title":"Chapter 9 - Advanced Algorithms","text":"

      We return again to visualization algorithms. This chapter describes algorithms that are either more complex to implement, or less widely used for 3D visualization applications. We retain the classification of algorithms as either scalar, vector, tensor, or modelling algorithms.

      "},{"location":"VTKBook/09Chapter9/#91-scalar-algorithms","title":"9.1 Scalar Algorithms","text":"

      As we have seen, scalar algorithms often involve mapping scalar values through a lookup table, or creating contour lines or surfaces. In this section, we examine another contouring algorithm, dividing cubes, which generates contour surfaces using dense point clouds. We also describe carpet plots. Carpet plots are not true 3D visualization techniques, but are widely used to visualize many types of scalar data. Finally, clipping is another important algorithm related to contouring, where cells are cut into pieces as a function of scalar value.

      "},{"location":"VTKBook/09Chapter9/#dividing-cubes","title":"Dividing Cubes","text":"

      Dividing cubes is a contouring algorithm similar to marching cubes [Cline88]. Unlike marching cubes, dividing cubes generates point primitives as compared to triangles (3D) or lines (2D). If the number of points on the contour surface is large, the rendered appearance of the contour surface appears \"solid.\"q To achieve this solid appearance, the density of the points must be at or greater than screen resolution. (Also, the points must be rendered using the standard lighting and shading equations used in surface rendering.)

      The motivation for dividing cubes is that rendering points is much faster than rendering polygons. This varies depending upon rendering hardware/software. Special purpose hardware has been developed to render shaded points at high speed. In other systems, greater attention has been placed on polygon rendering, and the rendering speed differences are not so great. Also, certain geometric operations such as clipping and merging data are simple operations with points. Comparable operations with polygons are much more difficult to implement.

      One disadvantage of creating contours with dense point clouds is that magnification of the surface (via camera zooming, for example) reveals the disconnected nature of the surface. Thus, the point set must be constructed for maximum zoom, or constructed dynamically based on the relative relationship between the camera and contour.

      Although dividing cubes was originally developed for volume datasets, it is possible to adapt the algorithm to other dataset types by subdividing in parametric coordinates. Our presentation assumes that we are working with volumes.

      Figure 9-1 provides an overview of the dividing cubes algorithm. Like other contouring algorithms, we first choose a contour value. We begin by visiting each voxel and select those through which the isosurface passes. (The isosurface passes through a voxel when there are scalar values both above and below the contour value.) We also compute the gradient at each voxel point for use in computing point normals. Figure 9-1. Overview of the dividing cubes algorithm. Voxels through which the contour passes are subdivided into subvoxels at less than screen resolution. If the contour passes through a subvoxel, a center point is generated. Figure 9-2. Recursive dividing cubes algorithm. Top half of figure shows algorithm depicted in two dimensions. Lower half depicts algorithm in three dimensions.

      After selecting a voxel that the isosurface passes through, the voxel is subdivided into a regular grid of n1 \\times n2 \\times n3 subvoxels. The number of divisions is controlled by the width of a voxel w_i in combination with screen resolution R. The screen resolution is defined as the distance between adjacent pixels in world coordinates. We can express the number of divisions ni along the coordinate axes x_i as w_i

      \\begin{equation*} n_i = \\frac{w_i}{R} \\end{equation*} \\bf\\tag{9-1}

      where the quotient is rounded up to the nearest integer. The scalar values at the subpoints are generated using the interpolation functions for a voxel (see Figure 8-10). Then we determine whether the contour passes through each subvoxel. If it does, we simply generate a point at the center of the subvoxel and compute its normal using the standard interpolation functions.

      An interesting variation on this algorithm is a recursive implementation as shown in Figure 9-2. Instead of subdividing the voxel directly (i.e., procedurally) into a regular grid we recursively divide the voxel (similar to octree decomposition). The voxel is subdivided regularly creating eight subvoxels and 19 new points (12 midedge points, 6 midface points, and 1 midvoxel point). The scalar values at the new points are interpolated from the original voxel using the trilinear interpolation functions. The process repeats for each subvoxel if the isosurface passes through it. This process continues until the size of the subvoxel is less than or equal to screen resolution. In this case, a point is generated at the center of the subvoxel. The collection of all such points composes the dividing cubes isosurface.

      The advantage of the recursive implementation is that the subdivision process terminates prematurely in those regions of the voxel where the contour cannot pass. On the other hand, the recursive subdivision requires that the voxel subdivision occurs in powers of two. This can generate far more points than the procedural implementation.

      Figure 9-3 shows two examples of dividing cubes isosurfaces. The contour surface on the left consists of 50,078 points. Because the points are not generated at display resolution, it is possible to see through the contour surface. The second contour surface on the right is composed of 2,506,989 points. The points are generated at display resolution, and as a result the contour surface appears solid.

      As Figure 9-1 and Figure 9-2 show, the points generated by dividing cubes do not lie exactly on the contour surface. We can determine the maximum error by examining the size of the terminal subvoxels. Assume that a terminal subvoxel is a cube, and that the length of the side of the cube is given by l. Then the maximum error is half the length of the cube diagonal, or l 3 / 2. Figure 9-3. Examples of dividing cubes isosurface. The left image consists of 50,078 points, and the right image consists of 2,506,989 points."},{"location":"VTKBook/09Chapter9/#carpet-plots","title":"Carpet Plots","text":"

      A common data form is a 2D image dataset with associated scalar data. Carpet plots can visualize data in this form. A carpet plot is created by warping a 2D surface in the direction of the surface normal (or possibly some user-defined direction). The amount of warping is controlled by the scalar value, possibly in combination with a scale factor. Carpet plots are similar to the vector displacement plots (see \"Displacement Plots\" in Chapter 4).

      Although carpet plots are typically applied to image data, they can be used to visualize datasets composed of 2D structured grids or 2D unstructured grids. In their basic form carpet plots can be used to visualize only three variables: two surface position coordinates and a scalar value. However, it is common to introduce another variable by using color mapping on the surface.

      (a) Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values. (b) Carpet plot of combustor flow energy in a structured grid. Colors and plane displacement represent energy values Figure 9-4. Contouring examples. (a) See ExponentialCosine.cxx and ExponentialCosine.py.; (b). See WarpCombustor.cxx and WarpCombustor.py. \\begin{equation*} F(r) = e^{-r}\\cos(10\\, r) \\end{equation*} \\bf\\tag{9-2}

      The function values are used to warp the surface while the function derivatives are used to color it. Figure 9-4(b) shows a carpet plot that visualizes flow energy in a structured grid. Both displacement and color are used to show the energy values. Although this figure is similar to Figure 6-14(b) there are some important differences. Figure 6-14(b) displays vector data whereas Figure 9-4(b) displays scalar data. Figure 9-4(b) deforms the surface in the direction of surface normal (or possibly a user-defined direction). The vector data (i.e., vector orientation) controls the direction of deformation in Figure 6-14(b)."},{"location":"VTKBook/09Chapter9/#clipping-with-scalar-fields","title":"Clipping With Scalar Fields","text":"

      Clipping is a common graphics operation that limits the extent of a polygon so that it does not lie outside the view frustrum (see \"Cameras\" in Chapter 3). Figure 9-5 shows a triangle before and after clipping with an infinite plane. The clip operation transforms a polygon into a polygon. Clipping can also be a powerful modeling tool. Clipping part of a structure can reveal internal details of the surface or other parts contained within the surface. Objects can be split into pieces and the pieces can be individually moved and controlled.

      We can do clipping with arbitrary implicit functions using a variation of the \"marching\" primitives discussed in \"Contouring\" in Chapter 6. We illustrate the technique for triangles.

      Recall that marching triangles transforms triangles into lines that approximate a scalar value called the isovalue. This is accomplished using the inside/outside relationship that each vertex has with respect to some scalar value. For our purposes here, we use a scalar value that represents the signed distance of the triangle vertex to a plane. This infinite plane, described by an implicit function of the form F(x, y, z) = n_{xx} + n_{yy} + n_{zz} - d = 0, partitions space into two infinite half spaces. All points with negative scalar values lie on one side of the plane and all with positive values lie on the other side. Figure 9-6 shows a finite plane represented by a grid of triangles. The thick line shows the infinite plane defined by F(x,y,z) = x + y + z - c = 0. The cut algorithm described in \"Cutting\" in Chapter 6 creates a set of lines using the contour operations specific to each cell primitive. In this example, the triangle's contour operator extracts lines that lie on the intersection of the infinite plane and the triangles that comprise the finite plane. The contour operation for a triangle uses the eight cases shown in Figure 9-7 to contour or \"cut\" each triangle appropriately. ` Figure 9-5. Clipping a triangle produces a polygon. The dark line represents an infinite plane. Figure 9-6. Cutting polygons produces lines (cutPlane.tcl).

      Clipping transforms polygons into polygons. We do clipping with a modified case table for the triangle that outputs polygons shown in Figure 9-8. In VTK, each polygonal data cell has a different case table to define the clip operation. Applying the clip algorithm to the polygonal data in Figure 9-9 using the same scalar field generated with a plane equation produces a new set of triangles.

      Formulating clipping using scalar fields permits more sophisticated operations. Clipping can use scalar data that is computed or scalar data that is part of a polygonal dataset's point attributes.

      Figure 9-7. The eight cases for cutting (contouring) a triangle. Black dots show triangle vertices that are \"inside\" the scalar cutting region. Solid lines show the output of the cutting operation. Figure 9-8. The eight cases for clipping a triangle. Black dots show triangle vertices that are \"inside\" the scalar clipping region. Shaded regions show the output of the clip operation. Figure 9-9. A plane of triangles clipped with a plane function (clipPlane.tcl).

      Figure 9-10 shows a scanned image that is first converted to a quadrilateral mesh with vertex scalar values set to the scanned image intensity. Clipping this quadrilateral mesh with a value equal to 1/2 the maximum intensity of the scanned image produces a polygonal model show in Figure 9-10. Figure 9-10. A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles. See CreateBFont.cxx and CreateBFont.py."},{"location":"VTKBook/09Chapter9/#92-vector-algorithms","title":"9.2 Vector Algorithms","text":"

      In Chapter 6 - Fundamental Algorithms we showed how to create simple vector glyphs and how to integrate particles through a vector field to create streamlines. In this section we extend these concepts to create streamribbons and streampolygons. In addition, we introduce the concept of vector field topology, and show how to characterize a vector field using topological constructs.

      "},{"location":"VTKBook/09Chapter9/#streamribbons-and-streamsurfaces","title":"Streamribbons and Streamsurfaces","text":"

      Streamlines depict particle paths in a vector field. By coloring these lines, or creating local glyphs (such as dashed lines or oriented cones), we can represent additional scalar and temporal information. However, these techniques can convey only elementary information about the vector field. Local information (e.g., flow rotation or derivatives) and global information (e.g., structure of a field such as vortex tubes) is not represented. Streamribbons and streamsurfaces are two techniques used to represent local and global information.

      A natural extension of the streamline technique widens the line to create a ribbon. The ribbon can be constructed by generating two adjacent streamlines and then bridging the lines with a polygonal mesh. This technique works well as long as the streamlines remain relatively close to one another. If separation occurs, so that the streamlines diverge, the resulting ribbon will not accurately represent the flow, because we expect the surface of the ribbon to be everywhere tangent to the vector field (i.e., definition of streamline). The ruled surface connecting two widely separated streamlines does not generally satisfy this requirement.

      The streamribbon provides information about important flow parameters: the vector vorticity and flow divergence. Vorticity \\Omega is the measure of rotation of the vector field, expressed as a vector quantity: a direction (axis of rotation) and magnitude (amount of rotation). Streamwise vorticity \\Omega is the projection of \\vec{\\omega} along the instantaneous velocity vector, \\vec{v}. Said another way, streamwise vorticity is the rotation of the vector field around the streamline defined as follows.

      \\begin{equation*} \\Omega = \\frac{\\vec{v} \\cdot \\vec{\\omega}}{\\vert \\vec{v} \\vert \\vert \\vec{\\omega} \\vert} \\end{equation*} \\bf\\tag{9-3}

      The amount of twisting of the streamribbon approximates the streamwise vorticity. Flow divergence is a measure of the \"spread\" of the flow. The changing width of the streamribbon is proportional to the cross-flow divergence of the flow.

      A streamsurface is a collection of an infinite number of streamlines passing through a base curve. The base curve, or rake, defines the starting points for the streamlines. If the base curve is closed (e.g., a circle) the surface is closed and a streamtube results. Thus, streamribbons are specialized types of streamsurfaces with a narrow width compared to length.

      Compared to vector icons or streamlines, streamsurfaces provide additional information about the structure of the vector field. Any point on the streamsurface is tangent to the velocity vector. Consequently, taking an example from fluid flow, no fluid can pass through the surface. Streamtubes are then representations of constant mass flux. Streamsurfaces show vector field structure better than streamlines or vector glyphs because they do not require visual interpolation across icons.

      Streamsurfaces can be computed by generating a set of streamlines from a user-specified rake. A polygonal mesh is then constructed by connecting adjacent streamlines. One difficulty with this approach is that local vector field divergence can cause streamlines to separate. Separation can introduce large errors into the surface, or possibly cause self-intersection, which is not physically possible.

      Another approach to computing streamsurfaces has been taken by Hultquist [Hultquist92]. The streamsurface is a collection of streamribbons connected along their edges. In this approach, the computation of the streamlines and tiling of the streamsurface is carried out concurrently. This allows streamlines to be added or removed as the flow separates or converges. The tiling can also be controlled to prevent the generation of long, skinny triangles. The surface may also be \"torn\", i.e., ribbons separated, if the divergence of the flow becomes too high.

      "},{"location":"VTKBook/09Chapter9/#stream-polygon","title":"Stream Polygon","text":"

      The techniques described so far provide approximate measures of vector field quantities such as streamwise vorticity and divergence. However, vector fields contain more information than these techniques can convey. As a result, other techniques have been devised to visualize this information. One such technique is the stream polygon [Schroeder91], which serves as the basis for a number of advanced vector and tensor visualization methods. The stream polygon is used to visualize local properties of strain, displacement, and rotation. We begin by describing the effects of a vector field on the local state of strain.

      Nonuniform vector fields give rise to local deformation in the region where they occur. If the vector field is displacement in a physical medium such as a fluid or a solid, the deformation consists of local strain (i.e., local distortion) and rigid body motion. To mathematically describe the deformation, we examine a 3D vector \\vec{v} = (u, v, w) at a specified point x = (x, y, z). Using a first order Taylor's series expansion about x, we can express the local deformation eij as

      \\begin{equation*} e_{ij} = \\epsilon_{ij} + \\omega_{ij} \\end{equation*} \\bf\\tag{9-4}

      where \\epsilon_{ij} is the local strain and \\omega_{ij} is the local rotation. Note that these variables are expressed as 3 \\times 3 tensors. (Compare this equation to that given in Figure 6-20. Note that this equation and the following Equation 9-5 differ in their off-diagonal terms by a factor of 1/2. This is because Figure6-20 expresses engineering shear strain which is used in the study of elasticity. Equation 9-5 expresses a tensor quantity and is mathematically consistent.)

      The local strain is expressed as a combination of the partial derivatives at x as follows.

      \\begin{equation*} \\epsilon = \\left( \\begin{array}{c c c} \\frac{\\partial u}{\\partial x} & \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial y} + \\frac{\\partial v}{\\partial x}\\right) & \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial z} + \\frac{\\partial w}{\\partial x}\\right) \\\\ \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial y} + \\frac{\\partial v}{\\partial x}\\right) & \\frac{\\partial v}{\\partial y} & \\frac{1}{2}\\left(\\frac{\\partial v}{\\partial z} + \\frac{\\partial w}{\\partial y}\\right) \\\\ \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial z} + \\frac{\\partial w}{\\partial x}\\right) & \\frac{1}{2}\\left(\\frac{\\partial v}{\\partial z} + \\frac{\\partial w}{\\partial y}\\right) & \\frac{\\partial w}{\\partial z} \\end{array}\\right) \\end{equation*} \\bf\\tag{9-5}

      The terms on the diagonal of \\epsilon_{ij} are the normal components of strain. The off-diagonal terms are the shear strain. The local rigid-body rotation is given by Equation 9-6 can also be represented using tensor notation as

      \\begin{equation*} \\omega = \\left( \\begin{array}{c c c} 0 & \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial y} - \\frac{\\partial v}{\\partial x}\\right) & \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial z} - \\frac{\\partial w}{\\partial x}\\right) \\\\ \\frac{1}{2}\\left(\\frac{\\partial v}{\\partial x} - \\frac{\\partial u}{\\partial y}\\right) & 0 & \\frac{1}{2}\\left(\\frac{\\partial v}{\\partial z} - \\frac{\\partial w}{\\partial y}\\right) \\\\ \\frac{1}{2}\\left(\\frac{\\partial w}{\\partial x} - \\frac{\\partial u}{\\partial z}\\right) & \\frac{1}{2}\\left(\\frac{\\partial w}{\\partial y} - \\frac{\\partial v}{\\partial z}\\right) & 0 \\end{array}\\right) \\end{equation*} \\bf\\tag{9-6}

      where \\omega is the vorticity vector referred to in the previous section. The vorticity, or local rigid body rotation is then

      \\begin{equation*} \\omega_{ij} = -\\frac{1}{2}\\sum_{k} \\epsilon_{ijk}\\, \\omega_{k} \\end{equation*} \\bf\\tag{9-7} \\begin{equation*} \\vec{\\omega} = \\left( \\begin{array}{c} \\frac{\\partial w}{\\partial y} - \\frac{\\partial v}{\\partial z} \\\\ \\frac{\\partial u}{\\partial z} - \\frac{\\partial w}{\\partial x} \\\\ \\frac{\\partial v}{\\partial x} - \\frac{\\partial u}{\\partial y} \\end{array} \\right) \\end{equation*} \\bf\\tag{9-8}

      For the reader unfamiliar with tensor notation, this presentation is certainly less than complete. However, the matrices in Equation 9-5 and Equation 9-6 directly translate into visual form, which will help clarify the concepts presented here. Referring to Figure 9-11, the normal strain, shear strain, and rigid body motion create distinct deformation modes. These modes combine to produce the total deformation. Modes of normal strain cause compression or extension in the direction perpendicular to a surface, while shear strains cause angular distortions. These strains combined with rigid body rotation around an axis yield the total strain at a point. Figure 9-11. Components of local deformation due to vector field. Dotted line shows initially undeformed object.

      The essence of the stream polygon technique is to show these modes of deformation. A regular n-sided polygon (Figure 9-12) is placed into a vector field at a specified point and then deformed according to the local strain. The components of strain may be shown separately or in combination. The orientation of the normal of the polygon is arbitrary. However, it is convenient to align the normal with the local vector. Then the rigid body rotation about the vector is the streamwise vorticity, and the effects of normal and shear strain are in the plane perpendicular to a streamline passing through the point.

      The stream polygon offers other interesting possibilities. The stream polygon may be swept along a trajectory, typically a streamline, to generate tubes. The radius of the tube r can be modified according to some scalar function. One application is to visualize fluid flow. In incompressible flow with no shear, the radius of the tube can vary according to the scalar function vector magnitude. Then the equation

      \\begin{equation*} r(\\vec{v}) = r_\\text{max} \\sqrt{\\frac{\\vert\\vec{v}_\\text{min}\\vert}{\\vert\\vec{v}\\vert}} \\end{equation*} \\bf\\tag{9-9}

      represents an area of constant mass flow. As a result, the tube will thicken as the flow slows and narrow as the velocity increases. Each of the n sides of the tube can be colored with a different scalar function, although for visual clarity, at most, one or two functions should be used.

      Figure 9-12. The stream polygon. (a) Planar view. (b) Aligned with vector. (c) Aligned along streamline. (d) Sweeping polygon to form tube. See OfficeTube.cxx and OfficeTube.py.

      The streamtubes generated by the streampolygon and the streamtubes we described in the previous section are not the same. The streampolygon does not necessarily lie along a streamline. If it does, the streampolygon represents information at a point, while the streamtube is an approximation constructed from multiple streamlines. Also, the radial variation in the tubes constructed from streampolygon sweeps do not necessarily relate to mass flow since the radius in a streampolygon can be tied to an arbitrary scalar variable.

      "},{"location":"VTKBook/09Chapter9/#vector-field-topology","title":"Vector Field Topology","text":"

      Vector fields have a complex structure characterized by special features called critical points [Globus91] [Helman91]. Critical points are locations in the vector field where the local vector magnitude goes to zero and the vector direction becomes undefined. At these points the vector field either converges or diverges, and/or local circulation around the point occurs.

      Critical points lie in dataset cells where the u, v, and w components of the vector field each pass through zero. These points are located using an iterative search procedure such as the bi-section technique. Each iteration evaluates the cell interpolation function until the zero vector is found. Once a critical point is found, its local behavior is determined from the matrix of partial derivatives.

      This is because at the critical point the velocity is zero, and the vector field can be approximated by a first-order expansion of partial derivatives [Helman91]

      \\begin{eqnarray*} u &\\simeq& \\frac{\\partial u}{\\partial x}\\text{d}x + \\frac{\\partial u}{\\partial y}\\text{d}y + \\frac{\\partial u}{\\partial z}\\text{d}z \\\\ v &\\simeq& \\frac{\\partial v}{\\partial x}\\text{d}x + \\frac{\\partial v}{\\partial y}\\text{d}y + \\frac{\\partial v}{\\partial z}\\text{d}z \\\\ w &\\simeq& \\frac{\\partial w}{\\partial x}\\text{d}x + \\frac{\\partial w}{\\partial y}\\text{d}y + \\frac{\\partial w}{\\partial z}\\text{d}z \\end{eqnarray*} \\bf\\tag{9-10}

      The matrix of partial derivatives J can be written in vector notation as \\partial u \\partial v \\partial w

      \\begin{equation*} \\vec{u} = J\\cdot\\text{d}\\vec{x},\\quad \\text{where} \\quad J = \\left( \\begin{array}{c c c} \\frac{\\partial u}{\\partial x} & \\frac{\\partial u}{\\partial y} & \\frac{\\partial u}{\\partial z} \\\\ \\frac{\\partial v}{\\partial x} & \\frac{\\partial v}{\\partial y} & \\frac{\\partial v}{\\partial z} \\\\ \\frac{\\partial w}{\\partial x} & \\frac{\\partial w}{\\partial y} & \\frac{\\partial w}{\\partial z} \\end{array} \\right) \\end{equation*} \\bf\\tag{9-11}

      and is referred to as the Jacobian. The behavior of the vector field in the vicinity of a critical point is characterized by the eigenvalues of J. The eigenvalues consist of an imaginary and real component. The imaginary component describes the rotation of the vector field around the critical point, while the real part describes the relative attraction or repulsion of the vector field to the critical point. In two dimensions the critical points are as shown in Figure 9-13.

      A number of visualization techniques have been developed to construct vector field topology from an analysis of critical points. These techniques provide a global understanding of the field, including points of attachment and detachment and field vortices. Using a fluid flow analogy, points of attachment and detachment occur on the surface of an object where the tangential component of the vector field goes to zero, and the flow is perpendicular to the surface. Thus, streamlines will begin or end at these points. There is no common definition for a vortex, but generally speaking, vortices are regions of relatively concentrated vorticity (e.g., flow rotation). The study of vortices is important because they represent areas of energy loss, or can have significant impact on downstream flow conditions (e.g., trailing vortices behind large aircraft).

      One useful visualization technique creates vector field skeletons that divide the vector field into separate regions. Within each region, the vector field is topologically equivalent to uniform flow. These skeletons are created by locating critical points, and then connecting the critical points with streamlines. In 3D vector field analysis this technique can be applied to the surface of objects to locate lines of flow separation and attachment and other important flow features. Also, in general 3D flow, the regions of uniform flow are separated by surfaces, and creation of 3D flow skeletons is a current research topic.

      Vortex visualization is another area of current research. One technique computes the helicitydensity

      Figure 9-13. Critical points in two dimensions. The real part of the eigenvalues (R1, R2) of the matrix of first derivatives control the attraction or repulsion of the vector field. The imaginary part of the eigenvalues (I1, I2) controls the rotation. \\begin{equation*} H_d = \\vec{v} \\cdot \\vec{w} = \\vert \\vec{v} \\vert \\vert \\vec{w} \\vert \\cos(\\phi) \\end{equation*} \\bf\\tag{9-12}

      This is a scalar function of the vector dot product between the vorticity and the local vector. Large positive values of H_d result in right-handed vortices, while large negative values indicate lefthanded vortices. Helicity-density can be conveniently shown using isosurfaces, which gives an indication for the location and structure of a vortex.

      "},{"location":"VTKBook/09Chapter9/#93-tensor-algorithms","title":"9.3 Tensor Algorithms","text":"

      In Chapter 6 - Fundamental Algorithms we saw that 3 \\times 3 real symmetric tensors can be characterized by the eigenvalues and eigenvectors of the tensor. Recall that we can express the eigenvectors of the system as

      \\begin{equation*} \\vec{v} = \\sum_i \\lambda_i \\vec{e}_i \\end{equation*} \\bf\\tag{9-13}

      where \\vec{e}_i is a unit vector in the direction of the eigenvalue, and \\lambda_i are the eigenvalues. Thus, we can decompose a 3 \\times 3 real symmetric tensor field into three vector fields, each field defined by one of the three eigenvectors described in Equation 9-13. We call these vector fields eigenfields, since they are derived from the eigenvectors of the tensor field.

      Figure 9-14. Creation of hyperstreamlines. An ellipse is swept along a streamline of the eigenfield. Major/minor axes of the ellipse are controlled by the other two eigenvectors.

      Decomposition of the tensor field in this fashion provides additional insight into visualizing 3 \\times 3 real symmetric tensors. We can directly use the vector field visualization techniques presented previously or use variations of them. One such technique is a novel extension of the streampolygon technique, the method of hyperstreamlines.

      "},{"location":"VTKBook/09Chapter9/#hyperstreamlines","title":"Hyperstreamlines","text":"

      Hyperstreamlines are constructed by creating a streamline through one of the three eigenfields, and then sweeping a geometric primitive along the streamline [Delmarcelle93]. Typically, an ellipse is used as the geometric primitive, where the remaining two eigenvectors define the major and minor axes of the ellipse (Figure 9-14). Sweeping the ellipse along the eigenfield streamline results in a tubular shape. Another useful generating geometric primitive is a cross. The length and orientation of the arms of the cross are controlled by two of the eigenvectors. Sweeping the cross results in a helical shape since the eigenvectors (and therefore cross arms) will rotate in some tensor fields.

      Figure 9-15 shows an example of hyperstreamlines. The data is from a point load applied to a semi-infinite domain. Compare this figure to Figure 6-22 that used tensor ellipsoids tov visualize the same data. Notice that there is less clutter and more information available from the hyperstreamline visualization. Figure 9-15. The four hyperstreamlines shown are integrated along the minor principle stress axis. A plane (colored with a different lookup table) is also shown. See HyperStreamline.cxx and HyperStreamline.py."},{"location":"VTKBook/09Chapter9/#94-modelling-algorithms","title":"9.4 Modelling Algorithms","text":""},{"location":"VTKBook/09Chapter9/#visualizing-geometry","title":"Visualizing Geometry","text":"

      One of the most common applications of visualization is to view geometry. We may have a geometric representation of a part or complex assembly (perhaps designed on a CAD system) and want to view the part or assembly before it is manufactured. While viewing geometry is better addressed in text on computer graphics, often there is dataset structure we wish to view in the same way. For example, we may want to see data mapped on a particular portion of the dataset, or view the structure of the dataset itself (e.g., view a finite element mesh).

      Three-dimensional datasets have a surface and interior. Typically we want to visualize the surface of the dataset or perhaps a portion of the interior. (Note: volume rendering is a different matter - see \"Volume Rendering\" in Chapter 7. To visualize the dataset we must extract a portion of the dataset topology/geometry (and associated data) as some form of surface primitives such as polygons. If the surface of the dataset is opaque, we may also wish to eliminate occluded interior detail.

      We have already seen how structured datasets, such as image data or structured grids, have a natural i-j-k coordinate system that allow extraction of points, lines, and planes from the interior of the dataset (see \"Structured Coordinate System\" in Chapter 8). For example, to extract the fifth -iplane from a structured grid of dimensions (i_m, j_m, k_m), we specify the data extents using (4, 4, 0, (j_m - 1), 0, (k_m 1)) (assuming zero-offset addressing).

      More generally, we can extract boundary edges and faces from a dataset. A boundary edge isan 1D cell type (e.g., line or polyline), or the edge of a 2D cell used by only that single cell. Similarly, a boundary face is a 2D cell type (e.g., polygon, triangle strip) or the face of a 3D cell used by only that single cell (Figure 9-16). We can obtain this information using the topological operators of the previous chapter. Cells of dimensions two or less are extracted as is, while boundary edges and faces are determined by counting the number of cell neighbors for a particular topological boundary (i.e., edge or face neighbors). If there are no neighbors, the edge or face is a boundary edge or face, and is extracted.

      Using these techniques we can view the structure of our dataset. However, there are also situations where we want more control in the selection of the data. We call this data extraction.

      "},{"location":"VTKBook/09Chapter9/#data-extraction","title":"Data Extraction","text":"

      Often we want to extract portions of data from a dataset. This may be because we want to reduce the size of the data, or because we are interested in visualizing only a portion of it.

      Figure 9-16. Boundary edges and faces. (a) Subsampling structured data (b) Subsampling unstructured data. Figure 9-17. Subsampling data. (a) Structured data can be subsampled by choosing every nth point. (b) Subsampling unstructured data requires local retriangulation.

      Reducing dataset size is an important practical capability, because visualization data size can be huge. By reducing data size, reductions in computation and memory requirements can be realized. This results in better interactive response.

      We also may need to reduce data size in order to visualize the important features of a large dataset. This can be used to reduce image clutter and improve the effectiveness of the visualization. Smaller data size also enables the visualization user to navigate through and inspect data more quickly relative to larger datasets. Next we describe two techniques to extract data. One is based on geometry extraction, and the other is based on data thresholding, or thresholding.

      Geometry Extraction. Geometry extraction selects data based on geometric or topological characteristics. A common extraction technique selects a set of points and cells that lie within a specified range of ids. A typical example is selecting all cells having ids between 0-100, or all cells using point ids 250-500. Finite element analysts use this method frequently to isolate the visualization to just a few key regions.

      Another useful technique called spatial extraction, selects dataset structure and associated data attributes lying within a specified region in space. For example, a point and radius can be used to select (or deselect) data within an enclosing sphere. Implicit functions are particularly useful tools for describing these regions. Points that evaluate negative are inside the region, while points outside the region evaluate positive; thus, cells whose points are all positive are outside the region, and cells whose points are all negative are inside the region.

      Subsampling (Figure 9-17) is a method that reduces data size by selecting a subset of the original data. The subset is specified by choosing a parameter n, specifying that every nth data point is to be extracted. For example, in structured datasets such as image data and structured grids, selecting every nth point produces the results shown in Figure 9-17(a).

      Subsampling modifies the topology of a dataset. When points or cells are not selected, this leaves a topological \"hole.\" Dataset topology must be modified to fill the hole. In structured data, this is simply a uniform selection across the structured i-j-k coordinates. In unstructured data (Figure 9-17(b)), the hole must be filled in by using triangulation or other complex tessellation schemes. Subsampling is not typically performed on unstructured data because of its inherent complexity.

      A related technique is data masking. In data masking we select every nth cell that at a minimum leaves one or more topological \"holes\" in the dataset. Masking also may change the topology of the dataset, since partial selections of cells from structured datasets can only be represented using unstructured grids. Masking is typically used to improve interactive performance or to quickly process portions of data.

      Thresholding. Thresholding extracts portions of a dataset data based on attribute values. For example, we may select all cells having a point with scalar value between (0,1) or all points having a velocity magnitude greater than 1.0.

      Scalar thresholding is easily implemented. The threshold is either a single value that scalar values are greater than or less than, or a range of values. Cells or points whose associated scalar values satisfy the threshold criteria can be extracted. Other dataset attribute types such as vectors, normals, or tensors can be extracted in similar fashion by converting the type to a single scalar value. For example, vectors can be extracted using vector magnitude, and tensors using matrix determinate.

      A problem with both geometry extraction and thresholding is that the approaches presented thus far extract \"atomic\" pieces of data, that is, a complete cell. Sometimes the cell may lie across the boundary of the threshold. In this case the cell must be clipped (see \"Clipping With Scalar Fields\" in this Chapter) and only a portion of the cell is extracted.

      "},{"location":"VTKBook/09Chapter9/#probing","title":"Probing","text":"

      Probing obtains dataset attributes by sampling one dataset (the input) with a set of points (the probe) as shown in Figure 9-18(a). Probing is also called \"resampling.\" Examples include probing an input dataset with a sequence of points along a line, on a plane, or in a volume. The result of the probing is a new dataset (the output) with the topological and geometric structure of the probe dataset, and point attributes interpolated from the input dataset. Once the probing operation is completed, the output dataset can be visualized with any of the appropriate techniques described in this text.

      Figure 9-18(b) illustrates the details of the probing process. For every point in the probe dataset, the location in the input dataset (i.e., cell, subcell, and parametric coordinates) and interpolation weights are determined. Then the data values from the cell are interpolated to the probe point. Probe points that are outside the input dataset are assigned a nil (or appropriate) value. This process repeats for all points in the probe dataset. Figure 9-18. Probing. The geometry of one dataset (Probe is used to extract dataset attributes from anther dataset (Input). Figure 9-19. Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. See ProbeCombustor.cxx and ProbeCombustor.py.

      Probing can be used to reduce data or to view data in a particular fashion.

      • Data is reduced when the probe operation is limited to a subregion of the input dataset, or the number of probe points is less than the number of input points.

      • Data can be viewed in a particular fashion by sampling on specially selected datasets. Using a probe dataset consisting of a line enables x-y plotting along a line, or using a plane allows surface color mapping or line contouring.

      Probing must be used carefully or errors may be introduced. Under-sampling data in a region can miss important high-frequency information or localized data variations. Oversampling data, while not creating error, can give false confidence in the accuracy of the data. Thus the sampling frequency should have a similar density as the input dataset, or if higher density, the visualization should be carefully annotated as to the original data frequency.

      One important application of probing converts irregular or unstructured data to structured form using a volume of appropriate resolution as a probe to sample the unstructured data. This is useful if we use volume rendering or other volume visualization techniques to view our data.

      Figure 9-19 shows an example of three probes. The probes sample flow density in a structured grid. The output of the probes is passed through a contour filter to generate contour lines. As this figure illustrates, we can be selective with the location and extent of the probe, allowing us to focus on important regions in the data."},{"location":"VTKBook/09Chapter9/#triangle-strip-generation","title":"Triangle Strip Generation","text":"

      Triangle strips are compact representations of triangle polygons as described in \"Triangle Strip\" in Chapter 5. Many rendering libraries include triangle strips as graphics primitives because they are a high-performance alternative to general polygon rendering.

      Visualization and graphics data is often represented with triangles. Marching cubes, for example, generates thousands and potentially millions of triangles to represent an isosurface. To achieve greater performance in our visualizations, we can convert triangle polygons into triangle strips. Or, if data is represented using polygons, we can first triangulate the polygons and then create triangle strips.

      A simple method to generate triangle strips uses greedy gathering of triangles into a strip (Figure 9-20). The method proceeds as follows. An \"unmarked\" triangle is found to initialize the strip - unmarked triangles are triangles that have not yet been gathered into a triangle strip. Starting with the initial triangle, the strip may grow in one of three directions, corresponding to the three edges of the triangle. We choose to grow the strip in the direction of the first unmarked neighbor triangle we encounter. If there are no unmarked neighbors the triangle strip is complete; otherwise, the strip is extended by adding triangles to the list that satisfy triangle strip topology. The strip is grown until no unmarked neighbor can be found. Additional strips are then created using the same procedure until every triangle is marked.

      The length of the triangle strips varies greatly depending on the structure of the triangle mesh.

      Figure 9-21(a) shows triangle strips each of 390 triangles in length from a dataset that was originally structured. Such a case is an exception: unstructured triangle meshes typically average about 5-6 triangles per strip (Figure 9-21(b)). Even so, the memory savings are impressive. A triangle strip of length 6 requires 8 points to represent, while 8 triangles require 24 points, for a memory savings of 66.7 percent. Rendering speed may be greatly affected, too, depending upon the capabilities of the rendering system. Figure 9-20. Creating triangle strips."},{"location":"VTKBook/09Chapter9/#connectivity","title":"Connectivity","text":"

      Intercell connectivity is a topological property of datasets. Cells are topologically connected when they share boundary features such as points, edges, or faces (Figure 9-22). Connectivity is useful in a number of modeling applications, particularly when we want to separate out \"parts\" of a dataset.

      One application of connectivity extracts a meaningful portion of an isosurface. If the isosurface is generated from measured data such as an MRI or CT scan, it likely contains \"noise\" or unimportant anatomical structure. Using connectivity algorithms, we can separate out the part of the isosurface that we desire, either by eliminating noise or undesirable anatomical structure. Figure 9-23 is an example where a 2D surface of interest (e.g., an isocontour) is extracted from a noisy signal. Figure 9-21. Triangle strip examples. (a) Structured triangle mesh consisting of 134 strips each of 390 triangles. (b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip. See StripFran.cxx and StripFran.py. Figure 9-22. Connected cells. Figure 9-23. Extracting portion of isosurface of interest using connectivity.

      Connectivity algorithms can be implemented using a recursive visit method. We begin by choosing an arbitrary cell and mark it \"visited\". Then, depending upon the type of connectivity desired (i.e., point, edge, face), we gather the appropriate neighbors and mark them visited. This process repeats recursively until all connected cells are visited. We generally refer to such a set of connected cells as a connected \"surface\" even though the cells may be of a topological dimension other than two.

      To identify additional connected surfaces we locate another unvisited cell and repeat the processes described previously. We continue to identify connected surfaces until every cell in the dataset is visited. As each connected surface is identified, it is assigned a surface number. We can use this number to specify the surfaces to extract or we can specify \"seed\" points or cells and extract the surfaces connected to them.

      In some cases the recursion depth of the connectivity algorithm becomes larger than the computer system can manage. In this case, we can specify a maximum recursion depth. When this depth is exceeded, recursion is terminated and the current cells in the recursion are used as seeds to restart the recursion.

      Polygon Normal Generation

      Gouraud and Phong shading (see Chapter 3 - Computer Graphics Primer) can improve the appearance of rendered polygons. Both techniques require point normals. Unfortunately polygonal meshes do not always contain point normals, or data file formats may not support point normals. Examples include the marching cubes algorithm for general datasets (which typically will not generate surface normals) and the stereo lithography file format (does not support point normals). Figure 9-24(a) shows a model defined from stereo-lithography format. The faceting of the model is clearly evident.

      To address this situation we can compute surface normals from the polygonal mesh. A simple approach follows. First, polygon normals are computed around a common point. These normals are then averaged at the point, and the normal is renormalized (i.e., n = 1 ) and associated with the point. This approach works well under two conditions.

      1. The orientation of all polygons surrounding the point are consistent as shown in Figure 9-24(b). A polygon is oriented consistently if the order of defining polygon points is consistent with its edge neighbors. That is, if polygon p is defined by points (1,2,3), then the polygon edge neighbor p23 must use the edge (2,3) in the direction (3,2). If not consistent, then the average point normal may be zero or not accurately represent the orientation of the surface. This is because the polygon normal is computed from a cross product of the edges formed by its defining points.

      2. The angular difference in surface normals between adjacent polygons is small. Otherwise, sharp corners or edges will have a washed out appearance when rendered, resulting in an unsatisfactory image (Figure 9-24(c)).

        To avoid these problems we adopt a more complex polygon normal generation algorithm. This approach includes steps to insure that polygons are oriented consistently, and an edge-splitting scheme that duplicates points across sharp edges.

        To orient edges consistently we use a recursive neighbor traversal. An initial polygon is selected and marked \"consistent.\" For each edge neighbor of the initial polygon, the ordering of the neighbor polygon points is checked - if not consistent, the ordering is reversed. The neighbor polygon is then marked \"consistent.\" This process repeats recursively for each edge neighbor until all neighbors are marked \"consistent\". In some cases there may be more than one connected surface, so that the process may have to be repeated until all polygons are visited.

        A similar traversal method splits sharp edges. A sharp edge is an edge shared by two polygons whose normals vary by a user-specified feature angle. The feature angle between two polygons is the angle between their normals (Figure 9-25(a)). When sharp edges are encountered during the recursive traversal, the points along the edge are duplicated, effectively disconnecting the mesh along that edge (Figure 9-25(b)). Then, when shared polygon normals are computed later in the process, contributions to the average normal across sharp edges is prevented.

        On some computers limitations on recursion depth may become a problem. Polygonal surfaces can consist of millions of polygons, resulting in large recursion depth. As a result, the depth of recursion can be specified by the user. If recursion depth exceeds the specified value, the recursion halts and the polygons on the boundary of the recursion become seeds to begin the process again.

        Figure 9-24(d) shows the result of the advanced normal generation technique with a feature angle of 60 degrees. Sharp edges are well defined and curved areas lack the faceting evident in the original model. The figure is shown with Gouraud shading. Figure 9-24. Surface normal generation. (a) Faceted model without normals. (b) Polygons must be consistently oriented to accurately compute normals. (c) Sharp edges are poorly represented using shared normals as shown on the corners of this model. (d) Normal generation with sharp edges split (Normals.cxx). See NormalsDemo.cxx and NormalsDemo.py."},{"location":"VTKBook/09Chapter9/#decimation","title":"Decimation","text":"

        Various data compression techniques have been developed in response to large data size. The UNIX utilities compress/uncompress and the PC utility zip compress data files. The MPEG compression algorithm compresses video sequences. These techniques may be loss-less, meaning that no data is lost between the compression/decompression steps, or lossy, meaning that data is lost during compression. The utilities compress/uncompress and zip are loss-less, while MPEG is lossy.

        Figure 9-25. Computing feature angles (a) and splitting edges (b).

        In graphics, data compression techniques have been developed as well. The subsampling methods we saw earlier in this chapter are an example of simple data compression techniques for visualization data. Another emerging area of graphics data compression is polygon reduction techniques.

        Polygon reduction techniques reduce the number of polygons required to model an object. The size of models, in terms of polygon count, has grown tremendously over the last few years. This is because many models are created using digital measuring devices such as laser scanners or satellites. These devices can generate data at tremendous rates. For example, a laser digitizer can generate on the order of 500,000 triangles in a 15-second scan. Visualization algorithms such as marching cubes also generate large numbers of polygons: one to three million triangles from a 5123 volume is typical.

        One polygon reduction technique is the decimation algorithm [Schroeder92a]. The goal of the decimation algorithm is to reduce the total number of triangles in a triangle mesh, preserving the original topology and forming a good approximation to the original geometry. A triangle mesh is a special form of a polygonal mesh, where each polygon is a triangle. If need be, a polygon mesh can be converted to a triangle mesh using standard polygon triangulation methods.

        Decimation is related to the subsampling technique for unstructured meshes described in Figure 9-17(b). The differences are that

        • decimation treats only triangle meshes not arbitrary unstructured grids;

        • the choice of which points to delete is a function of a decimation criterion, a measure of the local error introduced by deleting a point; and

        • the triangulation of the hole created by deleting the point is carried out in a way as to preserve edges or other important features.

        Decimation proceeds by iteratively visiting each point in a triangle mesh. For each point, three basic steps are carried out (Figure 9-26). The first step classifies the local geometry and topology in the neighborhood of the point. The classification yields one of the five categories shown in the figure: simple, boundary, complex, edge, and corner point. Based on this classification, the second step uses a local error measure (i.e., the decimation criterion) to determine whether the point can be deleted. If the criterion is satisfied, the third step deletes the point (along with associated triangles), and triangulates the resulting hole. A more detailed description of each of these steps and example applications follow. Figure 9-26. Overview of decimation algorithm.

        Point Classification. The first step of the decimation algorithm characterizes the local geometry and topology for a given point. The outcome of classification determines whether the vertex is a potential candidate for deletion, and if it is, which criteria to use.

        Each point may be assigned one of five possible classifications: simple, complex, boundary, interior edge, or corner vertex. Examples of each type are shown in Figure 9-26.

        A simple point is surrounded by a complete cycle of triangles, and each edge that uses the point is used by exactly two triangles. If the edge is not used by two triangles, or if the point is used by a triangle not in the cycle of triangles, then the point is complex. These are nonmanifold cases.

        A point that is on the boundary of a mesh, that is, within a semicycle of triangles, is a boundary point.

        A simple point can be further classified as an interior edge or corner point. These classifications are based on the local mesh geometry. If the surface normal angle between two adjacent triangles is greater than a specified feature angle, then a feature edge exists (see Figure 9-25(a)). When a point is used by two feature edges, the point is an interior edge point. If one, three, or more feature edges use the point, the point is a corner point.

        Complex and corner vertices are not deleted from the triangle mesh; all other vertices become candidates for deletion.

        Decimation Criterion. Once we have a candidate point for deletion, we estimate the error that would result by deleting the point and then replacing it (and its associated triangles) with another triangulation. There are a number of possible error measures; but the simplest are based on distance measures of local planarity or local colinearity (Figure 9-26).

        In the local region surrounding a simple point, the mesh is considered nearly \"flat,\" since there are by definition no feature edges. Hence, simple points use an error measure based on distance to plane. The plane passing through the local region can be computed either using a leastsquares plane or by computing an area-averaged plane.

        Points classified as boundary or interior edge are considered to lay on an edge, and use a distance to edge error measure. That is, we compute the distance that the candidate point is from the new edge formed during the triangulation process.

        A point satisfies the decimation criterion d if its distance measure is less than d. The point can then be deleted. All triangles using the point are deleted as well, leaving a \"hole\" in the mesh. This hole is patched using a local triangulation process.

        Triangulation. After deleting a point, the resulting hole must be retriangulated. Although the hole, defined by a loop of edges, is topologically two dimensional, it is generally non-planar, and therefore general purpose 2D triangulation techniques cannot be used. Instead, we use a special recursive 3D divide-and-conquer technique to triangulate the loop.

        Triangulation proceeds as follows. An initial split plane is chosen to divide the loop in half and create two subloops. If all the points in each subloop lie on opposite sides of the plane, then the split is a valid one. In addition, an aspect ratio check insures that the loop is not too long and skinny, thereby resulting in needle-like triangles. The aspect ratio is the ratio between the length of the split line to the minimum distance of a point in the subloop to the split plane. If the candidate split plane is not valid or does not satisfy the aspect ratio criterion, then another candidate split plane is evaluated. Once a split plane is found, then the subdivision of each subloop continues recursively until a subloop consists of three edges. In this case, the subloop generates a triangle and halts the recursion.

        Occasionally, triangulation fails because no split plane can be found. In this case, the candidate point is not deleted and the mesh is left in its original state. This poses no problem to the algorithm and decimation continues by visiting the next point in the dataset.

        Results. Typical compression rates for the decimation algorithm range from 2:1 to 100:1, with 10:1 a nominal figure for \"large\" (i.e., 105 triangles) datasets. The results vary greatly depending upon the type of data. CAD models typically reduce the least because these models have many sharp edges and other detailed features, and the CAD modellers usually produce minimal triangulations. Terrain data, especially if relatively flat regions are present, may reduce at rates of 100:1.

        (a) (b) Figure 9-27. Examples of decimation algorithm. Triangle meshes are shown in wireframe. See DecimateFran.cxx and DecimateFran.py.; (b). See DecimateHawaii.cxx and DecimateHawaii.py.

        Figure 9-27 shows two applications of decimation to laser digitized data and to a terrain model of Honolulu, Hawaii. In both cases the reduction was on the order of 90 percent for a 10:1 compression ratio. Wireframe images are shown to accentuate the density of the polygonal meshes. The left-hand image in each pair is the original data; the right-hand image is the decimated mesh.

        Notice the gradations in the decimated mesh around features of high curvature. The advantage of decimation, as compared to subsampling techniques, is that the mesh is adaptively modified to retain more details in areas of high curvature.

        Advanced Techniques. Polygon reduction is an active field of research. Many powerful algorithms beyond the decimation algorithm have been presented (see \"Bibliographic Notes\" in this Chapter). Although we cannot cover the field in its entirety in this section, there are two notable trends worth addressing. First, progressive schemes [Hoppe96] allow incremental transmission and reconstruction of triangle meshes - this is especially important for Web-based geometry visualization. Second, recent algorithms modify the topology of the mesh [He96] [Popovic97] [Schroeder97]. This feature is essential towards obtaining arbitrary levels of mesh reduction.

        A progressive mesh is a series of triangle meshes M_ii related by the operations

        \\begin{equation*} \\left(\\hat{M} = M^n \\right) \\to M^{n - 1} \\to \\ldots \\to M^1 \\to M^0 \\end{equation*} \\bf\\tag{9-14}

        where \\vec{M} and M^n represent the mesh at full resolution, and M^0 is a simplified base mesh. The critical characteristic of progressive meshes is that is possible to choose the mesh operations in such a way to make them invertible. Then the operations can be applied in reverse order (starting with the base mesh M^0)

        \\begin{equation*} M^0 \\to M^1 \\to \\ldots \\to M^{n - 1} \\to M^n \\end{equation*} \\bf\\tag{9-15}

        to obtain a mesh of desired reduction level (assuming that the reduction level is less than the base mesh M^0).

        One such invertible operator is an edge collapse and its inverse is the edge split shown in Figure 9-28(a). Each collapse of an interior mesh edge results in the elimination of two triangles (or one triangle if the collapsed vertex is on a boundary). The operation is represented by five values \\begin{equation*} \\text{Edge Collapse/Split}(v_s, v_t, v_\\ell, v_r, A) ``\\end{equation*} \\bf\\tag{9-16}

        where v_s is the vertex to collapse/split, v_t is the vertex being collapsed to / split from, and v_l and v_r are two additional vertices to the left and right of the split edge. These two vertices in conjunction with v_s and v_t define the two triangles deleted or added. A represents vertex attribute information, which at a minimum contains the coordinates x of the collapsed / split vertex v_s. (Note: in the context of the decimation algorithm, the edge collapse operator replaces the recursive triangulation process.)

        While progressive meshes allow us to compactly store and transmit triangle meshes, the problem remains that the size of the base mesh is often larger than desired reduction level. Since in some applications we wish to realize any given level, we want the base mesh to contain no triangles

        \\begin{equation*} \\left(\\hat{M} = M^n \\right) \\to M^{n - 1} \\to \\ldots \\to M^1 \\to \\left(M^0 = M(V, \\varnothing)\\right) \\end{equation*} \\bf\\tag{9-17}

        (some vertices are necessary to initiate the edge split operations). To address this problem, the invertible edge collapse/split operator - which is topology preserving - is extended with a vertex split/merge operator. The vertex split/merge operator modifies the topology of the mesh and allows arbitrary levels of reduction.

        Figure 9-28. Progressive mesh operators edge collapse/split and vertex split/merge.

        A mesh split occurs when we replace vertex vs with vertex vt in the connectivity list of one or more triangles that originally used vertex vs (Figure 9-28(b)). The new vertex vt is given exactly the same coordinate value as vs. Splits introduce a \"crack\" or \"hole\" into the mesh. We prefer not to split the mesh, but at high decimation rates this relieves topological constraint and enables further decimation. Splitting is only invoked when a valid edge collapse is not available, or when a vertex cannot be triangulated (e.g., a nonmanifold vertex). Once the split operation occurs, the vertices vs and vt are re-inserted into the priority queue.

        Different splitting strategies are used depending on the classification of the vertex (Figure 9-28(c)). Interior edge vertices are split along the feature edges, as are corner vertices.

        Nonmanifold vertices are split into separate manifold pieces. In any other type of vertex splitting occurs by arbitrarily separating the loop into two pieces. For example, if a simple vertex cannot be deleted because a valid edge collapse is not available, the loop of triangles will be arbitrarily divided in half (possibly in a recursive process).

        Like the edge collapse/split, the vertex split/merge can also be represented as a compact operation. A vertex split/merge operation can be represented with four values

        \\begin{equation*} \\text{vertex split/merge}(v_s, v_t, v_l, v_r) \\end{equation*} \\bf\\tag{9-18}

        The vertices v_l and v_r define a sweep of triangles (from v_r to v_l ) that are to be separated from the original vertex vs (we adopt a counter-clockwise ordering convention to uniquely define the sweep of triangles).

        Figure 9-29. Results of topology modifying progressive mesh algorithm.

        Figure 9-29 shows the results of applying the topology modifying progressive mesh algorithm to two sets of data. In Figure 9-29(a-c), a thin plate with holes is decimated (the darker lines show split edges). The middle image in the sequence shows the limits of topology on the algorithm. It is only when the topology of the mesh is allowed to be modified that the final level of reduction is possible. Figure 9-29(d-f) shows the same algorithm applied to CAD data."},{"location":"VTKBook/09Chapter9/#mesh-smoothing","title":"Mesh Smoothing","text":"

        Mesh smoothing is a technique that adjusts the point coordinates of a dataset. The purpose of mesh smoothing is to improve the appearance of a mesh, and/or improve the shape of dataset cells. During smoothing the topology of the dataset is not modified, only the geometry. Applications of mesh smoothing include improving the appearance of isosurfaces, or as a modelling tool to remove surface noise. The appearance of models can be dramatically improved by applying mesh smoothing. Figure 9-30 is an example of smoothing applied to analytic surface (a semicylinder) with a random surface distortion (smoothCyl.tcl). Figure 9-30. Mesh smoothing. (a) Motion of point. (b) Smoothing a point on an edge. Bold lines indicate connectivity. Figure 9-31. Mesh smoothing. (a) Motion of point. (b) Smoothing a point on an edge. Bold lines indicate connectivity.

        A simple, yet effective technique is Laplacian smoothing. The Laplacian smoothing equation for a point p_i at position x_i is given by

        \\begin{equation*} \\vec{x}_{i+1} = \\vec{x}_i + \\lambda \\vec{V}(i, j) = \\vec{x}_i + \\lambda \\sum_{j = 0}^{n}\\vec{x}_j - \\vec{x}_i \\end{equation*} \\bf\\tag{9-19}

        where x_i + 1 is the new coordinate position, and x_j are the positions of points p_j \"connected\" to p_i, and \\lambda is a user-specified weight. Geometrically this relation is depicted in Figure 9-31(a). Here the vertex p_i is connected to the surrounding points p_j via edges. The equation expresses that the new position x_i + 1 is offset from the original position x_i plus the average vector \\vec{V}_{ij} multiplied by \\lambda. Typically, the factor \\lambda is a small number (e.g., 0.01), and the process is executed repeatedly (e.g., 50-100 iterations). Notice that the overall effect of smoothing is to reduce the high frequency surface information. The algorithm will reduce surface curvature and tend to flatten thesurface.

        Besides adjusting the number of iterations and smoothing factor, smoothing can be controlled by modifying the connections between p_i and its surrounding points pj. For example, if p_i lies along a fold or sharp edge in the mesh, we may want to only use the two edge end points to compute the smoothing vector \\vec{V}_ij, limiting the motion of p_i along the edge (Figure 9-31(b)). We can also anchor p_i to prevent any motion. Anchoring is useful for points that are located on \"corners\" or other special features such as nonmanifold attachments. One benefit of anchoring and controlling point connectivity is that we can limit the amount of shrinkage in the mesh. It also tends to produce better overall results. (In Figure 9-30 the boundary points of the surface are constrained to move along the boundary, while the points at sharp corners are anchored.)

        Although Laplacian smoothing works well in most cases, there are applications of Laplacian smoothing that can badly damage the mesh. Large numbers of smoothing iterations, or large smoothing factors, can cause excessive shrinkage and surface distortion. Some objects, like spheres or the cylinder shown in Figure 9-30, will lose volume with each iteration, and can even shrink to a point. In rare cases it is possible for the mesh to pull itself \"inside-out.\" Situations like this occur when the average vector moves pi across a mesh boundary, causing some of the attached triangles to overlap or intersect.

        Mesh smoothing is particularly useful when creating models that do not require high accuracy. As we have seen, smoothing modifies point coordinates and, therefore, surface geometry. Use smoothing to improve the appearance of models, but characterize error carefully if you are going to measure from a smoothed surface. Alternatively, you may want to design your own smoothing algorithms that better fit the underlying data.

        "},{"location":"VTKBook/09Chapter9/#swept-volumes-and-surfaces","title":"Swept Volumes and Surfaces","text":"

        Consider moving an object (e.g., your hand) over some path (e.g., raise your hand). How can we visualize this motion? The obvious answer is to form a time-animation sequence as the hand is moved. But what if we wish to statically represent the motion as well as the space that is traversed by the hand? Then we can use swept surfaces and swept volumes.

        A swept volume is the volume of space occupied by an object as it moves through space along an arbitrary trajectory. A swept surface is the surface of the swept volume. Together, swept volumes and swept surfaces can statically represent the motion of objects.

        Past efforts at creating swept surfaces and volumes have focused on analytical techniques. The mathematical representation of various 3D geometric primitives (e.g., lines, polygons, splines) was extended to include a fourth dimension of time (the path). Unfortunately, these approaches have never been practically successful, partly due to mathematical complexity and partly due to problem degeneracies.

        Degeneracies occur when an n-dimensional object moves in such a way that its representation becomes (n-1)-dimensional. For example, moving a plane in the direction of its normal, sweeps out a 3D \"cubical\" volume. Sweeping the plane in a direction perpendicular to its normal, however, results in a degenerate condition, since the plane sweeps out a 2D \"rectangle.\"

        Instead of creating swept surfaces analytically, numerical approximation techniques can be used [Schroeder94]. Implicit modeling provides the basis for an effective technique to visualize object motion via swept surfaces and volumes. The technique is immune to degeneracies and can treat any geometric representation for which a distance function can be computed, such as the VTK cell types.

        The technique to generate swept surfaces and volumes using an implicit modeling approach proceeds as follows. The geometric model, or part, and a path describing the parts motion, or sweep trajectory ST, must be defined. Then we use the following steps as depicted in Figure 9-32.

        1. Generate an implicit model from the part. This results in an implicit representation in the form of a volume. We call this the implicit model V_I.

        2. Construct another volume, the workspace volume V_W, that strictly bounds V_I as it moves along the path ST. Then sweep V_I through V_W by moving in small steps, \\delta x, along ST. At each step, s, sample V_I with the workspace volume V_W. We use a boolean union operation to perform the sampling.

        3. Extract isosurface, or offset surface(s) from V_W using a contouring algorithm such as marching cubes.

        4. Step3 may create multiple connected surfaces. If a single surface is desired, use connectivity to extract the single \"largest\" surface (in terms of number of triangles). This surface is an approximation to the swept surface, and the volume it encloses is an approximation to the swept volume.

        Figure 9-32. Overview of swept surface technique. Figure 9-33. Generating workspace volume by sampling implicit volume.

        There are a few points that require additional explanation. This algorithm uses two volumes, the implicit model and the workspace volume. Both are implicit models, but the workspace volume is used to accumulate the part as it moves along the sweep trajectory. In theory, the part could be sampled directly into the workspace volume to create the implicit model of the swept surface. Performance issues dictate that the implicit model is sampled into the workspace volume. This is because it is much faster to sample the implicit model of the part rather than the part itself, since computing the distance function from a part that may consist of tens of thousands of cells is relatively timeconsuming, compared to sampling the implicit model V_I.

        Sampling V_I is depicted in Figure 9-33. The sweep trajectory is defined by a series of transformation matrices ST = {t_1, t_2,..., t_m}. As the part moves along ST, interpolation is used to compute an inbetween transformation matrix t. Sampling is achieved by inverse transforming VW into the local space of V_I using t. Then, similar to the probe operation described in \"Probing\" in this Chapter, the points of V_W are transformed by the inverse of the transformation matrix t-1, and used to interpolate the distance values from the implicit model V_I. Figure 9-34. Computing sampling and stepping error.

        Because we are dealing with an implicit modeling technique, parts with concave features can generate multiple surfaces. As discussed in \"Connectivity\" in this Chapter, the connectivity algorithm is used to separate out the swept surface. This final surface is an approximation to the actual swept surface, since we are sampling the actual geometric representation on an array of points (i.e., the implicit model), and then sampling the implicit model on another volume (i.e., the workspace volume). Also, stepping along the sweep trajectory generates errors proportional to the step size \\deltax.

        These errors can be characterized as follows (Figure 9-34). Given a voxel size L/D, where L is the edge length of the volume, and D is the dimension of the volume (assumed uniform for convenience), the maximum sampling error is \\begin{equation*} e \\leq \\frac{\\sqrt{3}}{2} \\frac{L}{D} \\end{equation*} \\bf\\tag{9-20}

        The error due to stepping, which includes both translation and rotational components, is bounded by \\delta x / 2, where \\delta x is the maximum displacement of any point on the implicit model at any given translational step. Combining these terms for sampling both volumes and the error due to stepping, the total error is

        \\begin{equation*} e_\\text{tot} \\leq \\frac{\\sqrt{3}}{2}\\left( \\frac{L_\\text{I}}{D_\\text{I}} + \\frac{L_\\text{W}}{D_\\text{W}}\\right) + \\frac{\\Delta x}{2} \\end{equation*} \\bf\\tag{9-21}

        where the subscripts I and W refer to the implicit model and workspace volume, respectively.

        Figure 9-35. Swept surfaces. (a) Swept mace sampled at 25 locations. (b) Swept vtk sampled at 21 locations.

        To show the application of this algorithm, we have generated swept surfaces for the letters \"VTK\" and the \"mace\" model as shown in Figure 9-35.

        We have purposely chosen a step size to exaggerate the stepping error. Using more steps would smooth out the surface \"bumps\" due to stepping. Also, the appearance of the surface varies greatly with the selected isosurface value. Larger values give rounder, smoother surfaces. If you use small values near zero (assuming positive distance function) the surface may break up. To correct this you need to use a higher resolution work-space or compute negative distances. Negative distances are computed during the implicit modeling step by negating all points inside the original geometry. Negative distances allow us to use a zero isosurface value or to generate internal offset surfaces. Negative distances can only be computed for closed (i.e., manifold) objects.

        "},{"location":"VTKBook/09Chapter9/#visualizing-unstructured-points","title":"Visualizing Unstructured Points","text":"

        Unstructured point datasets consist of points at irregular positions in 3D space. The relationship between points is arbitrary. Examples of unstructured point datasets are visualizing temperature distribution from an array of (arbitrarily) placed thermocouples, or rainfall level measured at scattered positions over a geographic region.

        Unlike image data and structured grids, or even unstructured grids, unstructured point dataset have no topological component relating one point to another. For these reasons unstructured points are simple to represent but difficult to visualize. They are difficult to visualize because there is no inherent \"structure\" to which we can apply our library of visualization techniques. Beyond just displaying points (possibly colored with scalar value, or using oriented vector glyphs) none of the techniques discussed thus far can be used. Thus, to visualize unstructured points we have to build structure to which we can apply our visualization techniques.

        There are several approaches available to build topological structure given a random set of points. One common approach samples unstructured points into an image dataset, and then visualizes the data using standard volume or surface-based rendering techniques. Another approach creates n-dimensional triangulations from the unstructured points, thereby creating topological structure. These and other common techniques are described in the following sections.

        Splatting Techniques. Splatting techniques build topological structure by sampling unstructured points into a image dataset (Figure 9-36). The sampling is performed by creating special influence, or splatting, functions SF(x,y,z) that distribute the data value of each unstructured point over the surrounding region. To sample the unstructured points, each point is inserted into a image dataset SP, and the data values are distributed through SP using the splatting functions SF(x,y,z). Once the topological structure is built, any image-based visualization technique can be used (including volume rendering).

        A common splatting function is a uniform Gaussian distribution centered at a point pi. The function is conveniently cast into the form

        \\begin{equation*} \\text{SF}(x, y, z) = s\\, \\exp\\left( -f(r/R)^2 \\right) \\end{equation*} \\bf\\tag{9-22}

        where s is a scale factor that multiplies the exponential, ff is the exponent scale factor f \\geq 0, r is the distance between any point and the Gaussian center point (i.e., the splat point) r = \\|p - p_ii|, and R is the radius of influence of the Gaussian, where r \\leq R.

        The Gaussian function (Figure 9-37(a)) becomes a circle in cross section in two dimensions (Figure 9-37(b)) and a sphere in three dimensions. Since the value of the function is maximum when r = 0, the maximum value is given by the scale factor s. The parameter f controls the rate of decay of the splat. Scalar values can be used to set the value of s, so that relatively large scalar values create bigger splats than smaller values.

        Splats may be accumulated using the standard implicit modeling boolean operations (Equation 6-13, Equation 6-14, and Equation 6-15). That is, we may choose to form a union, intersection, or difference of the splats. The union and intersection operators are used most frequently.

        Another interesting variation modifies the shape of the splat according to a vector quantity such as surface normal or vector data. Figure 9-37(c) shows an example where the splat shape is elongated in the direction parallel to a vector. Thus, if we have a set of points and normals, we can create a polygonal surface by combining splatting with isosurface extraction. Figure 9-36. Splatting techniques depicted in 2D. (a) Injecting points into the image dataset (circular splats). (b) Visualizing the image dataset via contouring. Any image-based visualization technique could be used. Figure 9-37. Gaussian splatting functions. (a) one-dimensional, (b) 2D spherical, and (c) 2D elliptical.

        To generate oriented splats, we modify Equation 9-22 by introducing an eccentricity factor E and the vector \\vec{v}.

        \\begin{equation*} \\text{SF}(x, y, z) = s\\, \\exp\\left( -f\\left(\\frac{(r_{xy}/E)^2 + z^2}{R^2}\\right) \\right) \\end{equation*}` \\bf\\tag{9-23}

        where z and r_{xy} are computed from

        \\begin{eqnarray*} z &=& \\vec{v}\\cdot(\\vec{p} - \\vec{p}_i), \\quad \\text{where} \\quad \\vert \\vec{v} \\vert = 1 \\\\ r_{xy} &=& r^2 - z^2 \\end{eqnarray*} \\bf\\tag{9-24}

        The parameter z is the distance along the vector \\vec{v}, and the parameter r_{xy} is the distance perpendicular to \\vec{v} to the point p. The eccentricity factor controls the shape of the splat. A value E = 1 results in spherical splats, whereas E > 1 yields flattened splats and E < 1 yields elongated splats in the direction of the vector \\vec{v}.

        Figure 9-38(a) shows an elliptical splat with E = 10. (The splat surface is created by using isosurface extraction.) As expected, the splat is an ellipsoid. Figure 9-38(b) is an application of elliptical splatting used to reconstruct a surface from an unstructured set of points. The advantage of using an elliptical splat is that we can flatten the splat in the plane perpendicular to the point normal. This tends to bridge the space between the point samples. The surface itself is extracted using a standard isosurface extraction algorithm.

        Interpolation Techniques. Interpolation techniques construct a function to smoothly interpolate a set of unstructured points. That is, given a set of n points p_i = (x_i, y_i, z_i) and function values F_i(p_i), a new function F(p) is created that interpolates the points p_i. Once the interpolation function is constructed, we can build topological structure from the unstructured points by sampling F(p) over an image dataset. We can then visualize the image data using any of the various techniques presented throughout the text.

        (a) Single elliptical splat (b) Surface Reconstruction Figure 9-38. Elliptical splatting. (a) Single elliptical splat with eccentricity E=10. Cone shows orientation of vector. (b) Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction. Points regularly subsampled and overlayed on original mesh. See SingleSplat.cxx and SingleSplat.py.; (b). See SplatFace.cxx and SplatFace.py.

        Shepard's method is an inverse distance weighted interpolation technique [Wixom78]. The interpolation functions can be written

        \\begin{equation*} F(p) = \\frac{\\sum_i^n \\frac{F_i}{\\vert p - p_i\\vert^2}}{\\sum_i^n \\frac{1}{\\vert p - p_i \\vert^2}} \\end{equation*} \\bf\\tag{9-25}

        where F(p_i) = F_i. Shepard's method is easy to implement, but has the undesirable property that limits its usefulness for most practical applications. The interpolation functions generate a local \"flat spot\" at each point pi since the derivatives are zero

        \\begin{equation*} \\frac{\\partial F}{\\partial x} = \\frac{\\partial F}{\\partial y} = \\frac{\\partial F}{\\partial z} = 0 \\end{equation*} \\bf\\tag{9-26}

        As a result, Shepard's method is overly constrained in the region around each point.

        Shepard's method is an example of a basis function method. That is, the interpolation function F(p) consists of a sum of functions centered at each data point, pi. Other basis function methods have been developed as described by Nielson [Nielson91]. They vary in localization of the basis functions and the sophistication of the interpolation function. Localization of basis functions means that their effect is isolated to a small region. Examples of more sophisticated basis functions include quadratic polynomials and cubic splines. Please see the references for more information.

        Triangulation techniques build topology directly from unstructured points. The points are triangulated to create a topological structure consisting of n-dimensional simplices that completely bound the points and linear combinations of the points (the so-called convex hull). The result of triangulation is a set of triangles (2D) or tetrahedra (3D), depending upon the dimension of the input data [Lawson86].

        Figure 9-39. The Delaunay triangulation (a) and Dirichlet tessellation (b). The circumcircle of each triangle in a Delaunay triangulation contains no other points but the three vertices of the triangle. The region surrounding each point pi in a Dirichlet tessellation is the set of points closest to p_i.

        An n-dimensional triangulation of a point set P = (p_1, p_2, p_3, ..., p_n) is a collection of n-dimensional simplices whose defining points lie in P. The simplices do not intersect one another and share only boundary features such as edges or faces. The Delaunay triangulation is a particularly important form [Bowyer81] [Watson81]. It has the property that the circumsphere of any n-dimensional simplex contains no other points of P except the n+1 defining points of the simplex (Figure 9-39(a)).

        The Delaunay triangulation has many interesting properties. In two dimensions, the Delaunay triangulation has been shown to be the optimal triangulation. That is, the minimum interior angle of a triangle in a Delaunay triangulation is greater than or equal to the minimum interior angle of any other possible triangulation. The Delaunay triangulation is the dual of the Dirichlet tessellation (Figure 9-39(b)), another important construction in computational geometry. The Dirichlet tessellation, also known as the Voronoi tessellation, is a tiling of space where each tile represents the space closest to a point pi. (The tiles are called Voronoi cells.) An n-dimensional Delaunay triangulation can be constructed from the Dirichlet tessellation by creating edges between Voronoi cells that share common n-1 boundaries (e.g., faces in 3D and edges in 2D). Conversely, the vertices of the Dirichlet tessellation are located at the circumcenters of the Delaunay circumcircles. Figure 9-40. Computing the Delaunay triangulation using technique of Watson and Boyer. Points are injected into triangulation forming new Delaunay triangulations. In the final step, the initial bounding points are removed to reveal final triangulation.

        The Delaunay triangulation can be computed using a variety of techniques. We describe a particularly elegant technique introduced independently by Watson [Watson81] and Bowyer [Bowyer81] (Figure 9-40). The algorithm begins by constructing an initial Delaunay triangulation that strictly bounds the point set P, the so-called bounding triangulation. This bounding triangulation can be as simple as a single triangle (2D) or tetrahedron (3D). Then, each point of P is injected one by one into the current triangulation. If the injected point lies within the circumcircle of any simplex, then the simplex is deleted, leaving a \"hole\" in the triangulation. After deleting all simplices, the n-1 dimensional faces on the boundary of the hole, along with the injected point, are used to construct a modified triangulation. This is a Delaunay triangulation, and the process continues until all points are injected into the triangulation. The last step removes the simplices connecting the points forming the initial bounding triangulation to reveal the completed Delaunay triangulation.

        This simplistic presentation of triangulation techniques has shown how to create topological structure from a set of unstructured points. We have ignored some difficult issues such as degeneracies and numerical problems. Degeneracies occur when points in a Delaunay triangulation lie in such a way that the triangulation is not unique. For example, the points lying at the vertices of a square, rectangle, or hexagon are degenerate because they can be triangulated in more than one way, where each triangulation is equivalent (in terms of Delaunay criterion) to the other. Numerical problems occur when we attempt to compute circumcenters, especially in higher-dimensional triangulations, or when simplices of poor aspect ratio are present.

        Despite these problems, triangulation methods are a powerful tool for visualizing unstructured points. Once we convert the data into a triangulation (or in our terminology, an unstructured grid), we can directly visualize our data using standard unstructured grid techniques.

        Hybrid Techniques. Recent work has focused on combining triangulation and basis function techniques for interpolating 2D bivariate data. The basic idea is as follows. A triangulation of P is constructed. Then an interpolating network of curves is defined over the edges of the triangulation. These curves are constructed with certain minimization properties of interpolating splines. Finally, the curve network is used to construct a series of triangular basis functions, or surface patches, that exhibit continuity in function value, and possibly higher order derivatives. (See [Nielson91] for more information.)

        "},{"location":"VTKBook/09Chapter9/#multidimensional-visualization","title":"Multidimensional Visualization","text":"

        The treatment of multidimensional datasets is an important data visualization issue. Each point in a dataset is described by an n-dimensional coordinate, where $n geq 3. Here we assume that each coordinate is an independent variable, and that we wish to visualize a single dependent variable. (Multi- dimensional visualization of vectors and tensors is an open research area.) An application of multidimensional data is financial visualization, where we might want to visualize return on investment as a function of interest rate, initial investment, investment period, and income, to name just a few possibilities.

        There are two fundamental problems that we must address when applying multidimensional visualization. These are the problems of projection and understanding.

        The problem of projection is that in using computer graphics we have two dimensions in which to present our data, or possibly three or four if we use specialized methods. Using 3D graphics we can give the illusion of three dimensions, or we can use stereo viewing techniques to achieve three dimensions. We can also use time as a fourth dimension by animating images. However, except for these limited situations, general n-dimensional data cannot be represented on a 2D computer screen.

        The problem of understanding is that humans do not easily comprehend more than three dimensions, or possibly three dimensions plus time. Thus, even if we could create a technique to display data of many dimensions, the difficulty in understanding the data would impair the usefulness of the technique.

        Most multidimensional visualization techniques work with some form of dimension mapping, where n dimensions are mapped to three dimensions and then displayed with 3D computer graphics techniques. The mapping is achieved by fixing all variables except three, and then applying the visualization techniques described throughout the text to the resulting data. For maximum benefit, the process of fixing independent variables, mapping to three dimensions, and then generating visualization must be interactive. This improves the effectiveness of the visualization process, allowing the user to build an internal model of the data by manipulating different parts of the data.

        One novel approach to multidimensional visualization has been proposed by Inselberg and Dimsdale [Inselberg87]. This approach uses parallel coordinate systems. Instead of plotting points on orthogonal axes, the ith dimensional coordinate of each point is plotted along separate, parallel axes. This is shown in Figure 9-41 for a five-dimensional point. In parallel coordinate plots, points appear as lines. As a result, plots of n-dimensional points appear as sequences of line segments that may intersect or group to form complex fan patterns. In so doing, the human pattern recognition capability is engaged. Unfortunately, if the number of points becomes large, and the data is not strongly correlated, the resulting plots can become a solid mass of black, and any data trends are drowned in the visual display.

        Another useful multivariable technique uses glyphs. This technique associates a portion of the glyph with each variable. Although glyphs cannot generally be designed for arbitrary n-dimensional data, in many applications we can create glyphs to convey the information we are interested in. Refer to \"Glyphs\" in Chapter 6 for more information about glyphs.

        Figure 9-41. Plotting a five-dimensional point using parallel coordinates. (a) plot of single point, (b) plot of many points."},{"location":"VTKBook/09Chapter9/#texture-algorithms","title":"Texture Algorithms","text":"

        Texturing is a common tool in computer graphics used to introduce detail without the high cost of graphics primitives. As we suggested in Chapter 7 - Advanced Computer Graphics, texture mapping can also be used to visualize data. We explore a few techniques in the following sections.

        Texture Thresholding. We saw earlier how to threshold data based on scalar values (see \"Thresholding\" in this Chapter). We refer to this approach as geometric thresholding because structural components of a dataset (e.g., points and cells) are extracted based on data value. In contrast, we can use texture mapping techniques to achieve similar results. We call this technique texture thresholding.

        Texture thresholding conceals features we do not want to see and accentuates features that we want to see. There are many variations on this theme. A feature can be concealed by making it transparent or translucent, by reducing its intensity, or using muted colors. A feature can be accentuated by making it opaque, increasing its intensity, or adding bright color. In the following paragraphs we describe a technique that combines intensity and transparency.

        Texture thresholding requires two pieces of information: a texture map and an index into the map, or texture coordinate. In the simplest case we can devise a texture map that consists of two distinct regions as shown in Figure 9-42(a). The first region is alternatively referred to as \"conceal,\" \"off,\" or \"outside.\" The second region is referred to as \"accentuate,\" \"on,\" or \"inside.\" (These different labels are used depending upon the particular application.) With this texture map in hand we can texture threshold by computing an appropriate texture coordinate. Areas that we wish to accentuate are assigned a coordinate to map into the \"accentuate\" portion of the texture map. Areas that we want to conceal are assigned a coordinate to map into the \"conceal\" portion of the texture map.

        One texture threshold technique uses transparency. We can conceal a region by setting its alpha opacity value to zero (transparent), and accentuate it by setting the alpha value to one (opaque). Thus, the texture map consists of two regions: a concealed region with \\alpha = 0 and an accentuated region with \\alpha = 1. Of course, the effect can be softened by using intermediate alpha values to create translucent images.

        An extension of this technique introduces a third region into the texture map: a transition region (Figure 9-42(b)). The transition region is the region between the concealed and accentuated regions. We can use the transition region to draw a border around the accentuated region, further highlighting the region. Figure 9-42. 1D texture map. (a) In/out map. (b) Addition of transition region to in/out map.

        To construct the texture map we use intensity-alpha, or I\\alpha values. The intensity modulates the underlying color, while the alpha value controls transparency (as described previously). In the accentuated region, the intensity and opacity values are set high. In the concealed region, the intensity value can be set to any value (if \\alpha = 0) or to a lower value (if \\alpha \\ne 0).The transition reg ion can use various combinations of \\alpha and intensity. A nice combination produces a black, opaque transition region (i.e., I = 0 and \\alpha = 1 ).

        To visualize information with the thresholding technique, we must map data to texture coordinates. As we saw previously, we can use scalar values in combination with a threshold specification to map data into the concealed, transition, and accentuated regions of the texture map. Figure 9-43a shows an example of texture thresholding applied to scalar data from a simulation of fluid flow. A scalar threshold sT is set to show only data with scalar value greater than or equal to sT.

        Another useful texture thresholding application uses implicit functions to map point position to texture coordinate. This is similar in effect to geometric clipping (see \"Clipping With Scalar Fields\" in this Chapter). As we saw in \"Implicit Functions\" in Chapter 6, implicit functions naturally map a (x, y, z) coordinate value into three regions: F(x, y, z) < 0, F(x, y, z) = 0, and F(x, y, z) > 0 ; or equivalently, the concealed, transition, and accentuated regions of the texture map. Using boolean combinations of implicit functions, we can create complex cuts of our data as illustrated in Figure 9-43b. This figure shows two nested spheres. The outer sphere is cut by a boolean combination of two planes to show the inner sphere.

        Boolean Textures. Texture thresholding can be extended into higher dimensions. That is, 2D or 3D texture coordinates can be used to map two or three data variables into a texture map. One such technique is boolean textures, a method to clip geometry using a 2D texture map and two implicit functions [Lorensen93].

        Boolean textures extend texture thresholding for geometric clipping from 1D to 2D. Instead of using a single implicit function to label regions \"in\" or \"out\", two implicit functions are used. This results in four different regions corresponding to all possible combinations of \"in\" and \"out.\"

        (a) Thresholding data with texture (b) Sphere cut with transparent texture Figure 9-43. Examples of texture thresholding. (a) Using scalar threshold to show values of flow density on plane above value of 1.5. (b) Boolean combination of two planes to cut nested spheres. See TextureThreshold.cxx and TextureThreshold.py.; (b). See TextureCutSphere.cxx and TextureCutSphere.py. Figure 9-44. 2D Boolean texture.

        The boolean texture map is modified to reflect this as shown in Figure 9-44. As with 1D texture thresholding, transition regions can be created to separate the four regions.

        The boolean texture map can be created with combinations of intensity and transparency values to achieve a variety of effects. By combining the four combinations of in/out (i.e., four regions of Figure 9-44) with the two combinations of \"conceal\" and \"accentuate,\" sixteen different boolean textures are possible. Figure 9-45a illustrates these combinations expressed as boolean combinations of two implicit functions A and B. The \"inside\" of the implicit functions is indicated with subscript i, while the outside is indicated with subscript o. The boolean expressions indicate the regions that we wish to conceal, as shown by open circles. The darkened circles are the regions that are accentuated. We can see in Figure 9-45b the effects of applying these different boolean textures to a sphere. The implicit functions in this figure are two elliptical cylinders sharing a common axis, and rotated 90 degrees from one another. In addition, transition regions have been defined with I = 0 to generate the dark cut edges shown. All 16 spheres share the same texture coordinates; only the texture map changes. (a) Combination of 2D in/out textures (b) Sixteen boolean textures (from above) applied to sphere Figure 9-45. Sixteen boolean textures. (a) Sixteen combinations of in/out. (b) Textures applied to sphere using two elliptical cylinder implicit functions. See TextureCutQuadric.cxx and TextureCutQuadric.py.

        Texture Animation. Time-based animation techniques can illustrate motion or temporal data variations. This process often requires relatively large amounts of computer resource to read, process, and display the data. Thus, techniques to reduce computer resources are desirable when animating data.

        Texture mapping can be used to animate certain types of data. In these techniques, the data is not regenerated frame by frame, instead a time-varying texture map is used to change the visual appearance of the data. An example of this approach is texture animation of vector fields [Yamrom95].

        Figure 9-46. Texture maps for vector animation. Sixteen textures applied in succession create effect of motion along a vector. (a) Simple map. (b) Varying intensity \"feathers\" effect of motion.

        As we saw in \"Hedgehogs and Oriented Glyphs\" in Chapter 6, vector fields can be represented as oriented and scaled lines. Texture animation can transform this static representational scheme into a dynamic representation. The key is to construct a series of 1D texture maps that when applied rapidly in sequence create the illusion of motion. Figure 9-46(a) shows a series of sixteen such texture maps. The maps consist of intensity-alpha (I \\alpha ) values, A portion of the texture map is set fully opaque with full intensity (I = 1, \\alpha = 1 ). This is shown as the \"dark\" pattern in Figure 9-46(a). The remainder of the map is set fully transparent with arbitrary intensity ( I = 1, \\alpha = 0 ) shown as the \"white\" portion. As is evidenced by the figure, the sequence of 16 texture maps scanned top to bottom generate the appearance of motion from left to right. Notice also how the texture maps are designed to wrap around to form a continuous pattern.

        Along with the 1D texture map, the texture coordinate s must also be generated - on a line this is straightforward. The line origin receives texture coordinate s = 0, while the line terminus receives texture coordinate value s = 1. Any intermediate points (if the vector is a polyline) are parameterized in monotonic fashion in the interval (0,1). Texture coordinates need only be generated once. Only the texture map is varied to generate the vector animation.

        Other effects are possible by modifying the texture map. Figure 9-46(b) shows a texture map with a repeating sequence of opaque/transparent regions. In each opaque region the intensity is gradually reduced from left to right. The result is that this tends to \"feather\" the appearance of the vector motion. The resulting image is more pleasing to the eye."},{"location":"VTKBook/09Chapter9/#95-putting-it-all-together","title":"9.5 Putting It All Together","text":"

        With the conclusion of this chapter we have provided an overview of the basics of data visualization. In this section we show you how to use some of the advanced algorithms as implemented in the Visualization Toolkit.

        "},{"location":"VTKBook/09Chapter9/#dividing-cubes-point-generation","title":"Dividing Cubes / Point Generation","text":"

        Dividing cubes is implemented in VTK with the class vtkDividingCubes. It has been specialized to operate with image datasets. Besides specifying the contour value, you must specify a separation distance between points (using the method SetDistance()). If you desire a solid appearance, pick a distance that is less than or equal to display resolution.

        The separation distance controls the accuracy of point generation. It is possible to generate points that appear to form a solid surface when rendered, but are not accurately located on the contour surface. Although this usually is not an issue when viewing contour surfaces, if the accuracy of the point positions is important, the distance value must be set smaller. However, this can result in huge numbers of points. To reduce the number of points, you can use the SetIncrement() method, which specifies that every nth point is to be generated. Using this approach, you can obtain good accuracy and control the total number of points. An example where point positions are important is when the points are used to locate glyphs or as seed points for streamline generation.

        The Visualization Toolkit provides other point generation techniques. The source object vtkPointSource generates a user-specified number of points within a spherical region. The point positions are random within the sphere. (Note that there is a natural tendency for higher point density near the center of the sphere because the points are randomly generated along the radius and spherical angles \\phi and \\theta.)

        Figure 9-47 is an example use of vtkPointSource to generate streamlines. The dataset is a structured grid of dimensions 21 \\times 20 \\times 20 with flow velocity and a scalar pressure field. The dataset is a CFD simulation of flow in a small office. As this picture shows, there are a couple of bookcases, desks, a window, and an inlet and outlet for the ventilation system. On one of the desks is a small, intense heat source (e.g., a cigarette). In the left image 25 streamlines are started near the inlet using a vtkPointSource point generator. The second image shows what happens when we move the point source slightly to the left. By adjusting a single parameter (e.g., the center of the point source) it is possible to quickly explore our simulation data. Figure 9-47. Using random point seeds to create streamlines. See OfficeA.cxx and OfficeA.py.; (b). See Office.cxx and Office.py.

        Another convenient object for point generation is the class vtkEdgePoints. vtkEdgePoints generates points on an isosurface. The points are generated by locating cell edges whose points are both above and below the isosurface value. Linear interpolation is used to generate the point. Since vtkEdgePoints operates on any cell type, this filter's input type is any dataset type (e.g.,vtkDataSet). Unlike vtkDividingCubes this filter will not typically generate dense point clouds that appear solid.

        "},{"location":"VTKBook/09Chapter9/#clipping-with-scalar-fields_1","title":"Clipping with Scalar Fields","text":"

        Clipping is implemented in vtkClipPolyData. Each polygonal data primitive implements the operation in its Clip() method using cases tables derived in a manner similar to that of triangles described here.. vtkClipPolyData has methods to control whether an implicit function provides the scalar data or whether the dataset's scalar data will be used. ComputeScalarDataOn() uses the implicit function and ComputeScalarDataOff() uses the dataset's scalar data. Two output polygonal datasets are produced. These are accessed with GetOutput() and GetClippedOutput() methods. GetOutput() returns the polygonal data that is \"inside' the clipping region while GetClippedOutput() returns polygonal data that is \"outside\" the region. (Note that GenerateClippedOutputOn() must be enabled if you are to get the clipped output.) The meaning of inside and outside can be reversed using the InsideOutOn() method. Figure 9-48 shows a plane of quadrilaterals clipped with a boolean implicit function. (b) Figure 9-48. A plane clipped with a sphere and an ellipse. The two transforms place each implicit function into the appropriate position. Two outputs are generated by the clipper. See ClipSphereCylinder.cxx and ClipSphereCylinder.py.

        Until recently, VTK supported clipping only for polygonal data cell types (vertices, polyvertices, line, polylines, polygons and triangle strips). Recent additions since VTK version 4.0 support clipping of 3D cells using an ordered Delaunay triangulation approach.

        "},{"location":"VTKBook/09Chapter9/#swept-volumes-and-surfaces_1","title":"Swept Volumes and Surfaces","text":"

        Swept surfaces can be applied in two interesting ways. First, they can be used as a modelling tool to create unusual shapes and forms. In this sense, swept surfaces are an advanced implicit modelling technique. Second, swept surfaces can be used to statically represent object motion. This is an important visualization technique in itself and has many important applications. One of these applications is design for maintainability.

        When a complex mechanical system like a car engine is designed, it is important to design proper access to critical engine components. These components, like spark plugs, require higher levels of service and maintenance. It is important that these components can be easily reached by a mechanic. We've read horror stories of how it is necessary to remove an engine to change a spark plug. Insuring ready access to critical engine parts prevents situations like this from occurring.

        Swept surface can assist in the design of part access. We simply define a path to remove the part (early in the design process), and then generate a swept surface. This surface (sometimes referred to as a maintenance access solid or MAS) is then placed back into the CAD system. From this point on, the design of surrounding components such as fuel lines or wiring harnesses must avoid the MAS. As long as the MAS is not violated, the part can be removed. If the MAS is violated, a reevaluation of the removal path or redesign of the part or surrounding components is necessary.

        Figure 9-49 shows how to create a swept surface from a simple geometric representation. The geometry is simply a line-stroked VTK. The next step is to define a motion path. This path is defined by creating a list of transformation matrices. Linear interpolation is used to generate intermediate points along the path if necessary.

        In Figure 9-49 we also see the basic procedure to construct the swept surface. First, we must construct an implicit representation of the part by using vtkImplictModeller. This is then provided as input to vtkSweptSurface. It is important that the resolution of the implicit model is greater than or equal to that of vtkSweptSurface. This will minimize errors when we construct the surface. A bounding box surrounding the part and its motion can be defined, or it will be computed automatically. For proper results, this box must strictly contain the part as its moves. We also can set the number of interpolation steps, or allow this to be computed automatically as well. In the figure, we have chosen a small number to better illustrate the stepping of the algorithm.

        Once vtkSweptSurface executes, we extract the swept surface using an isosurfacing algorithm. The isosurface value is an offset distance; thus we can create surfaces that take into account geometry tolerance. (This is particularly important if we are designing mechanical systems.) The implementation of the implicit modeller in VTK uses a positive distance function; so the isosurface value should always be positive. To create swept surfaces of zero and negative value requires a modification to the implicit modeller.

        Figure 9-49. Generating swept surface from line-stroked \"vtk\". The class vtkSweptSurface was in the Patented directory in VTK 4.4. This directory was removed in VTK 5.0, and this class is not available in that release."},{"location":"VTKBook/09Chapter9/#multidimensional-visualization_1","title":"Multidimensional Visualization","text":"

        An important characteristic of multidimensional datasets is that they cannot be categorized according to any of the types defined in the Visualization Toolkit. This implies that source objects interfacing with multidimensional data are responsible for converting the data they interface with into one of the types defined in VTK. This can be a difficult process, requiring you to write interface code.

        Other visualization systems treat this problem differently. In these systems a dataset type is defined that can represent multidimensional data. This dataset type is essentially an n-dimensional matrix. Additional filters are defined that allow the user to extract pieces of the dataset and assemble them into a more conventional dataset type, such as a volume or structured grid. After mapping the data from multidimensional form to conventional form, standard visualization techniques can be applied. (Future implementations of VTK may include this functionality. At the current time you must map multidimensional data into a known VTK form.)

        To demonstrate these ideas we will refer to Figure 9-50. This is an example of multidimensional financial data. The data reflects parameters associated with monetary loans. In the file financial.txt there are six different variables: TIME_LATE, MONTHLY_PAYMENT, UNPAID_PRINCIPLE, LOAN_AMOUNT, INTEREST_RATE, and MONTHLY_INCOME. (Note: this is simulated data, don't make financial decisions based upon this!)

        We will use Gaussian splatting to visualize this data (see \"Splatting Techniques\" in this Chapter).

        (a) Visualization network Figure 9-50. Visualization of multidimensional financial data. Visualization network, output image, and sample C++ code are shown (finance.cxx). The gray/wireframe surface represents the total data population. The dark surface represents data points delinquent on loan payment. See Finance.cxx and Finance.py.

        Our first step is to choose dependent and independent variables. This choice is essentially a mapping from multidimensional data into an unstructured point dataset. In this example we will choose MONTHLY_PAYMENT, INTEREST_RATE, and LOAN_AMOUNT as our (x, y, z) point coordinates, and TIME_LATE as a scalar value. This maps four of six variables. For now we will ignore the other two variables.

        We use vtkGaussianSplatter to perform the splatting operation (i.e., conversion from unstructured points to volume dataset). This is followed by an isosurface extraction. We splat the data two times. The first time we splat the entire population. This is to show context and appears as gray/ wireframe in the figure. The second time we splat the data and scale it by the value of TIME_LATE. As a result, only payments that are late contribute to the second isosurface.

        The results of this visualization are interesting. First, we see that there is a strong correlation between the two independent variables MONTHLY_PAYMENT and LOAN_AMOUNT. (This is more evident when viewing the data interactively.) We see that the data falls roughly on a plane at a 45 degree angle between these two axes. With a little reflection this is evident: the monthly payment is strongly a function of loan amount (as well as interest rate and payment period). Second, we see that there is a clustering of delinquent accounts within the total population. The cluster tends to grow with larger interest rates and shrink with smaller monthly payments and loan amounts. Although the relationship with interest rate is expected, the clustering towards smaller monthly payments is not. Thus our visualization has provided a clue into the data. Further exploration may reveal the reason(s), or we may perform additional data analysis and acquisition to understand the phenomena.

        One important note about multidimensional visualization. Because we tend to combine variables in odd ways (e.g., the use of MONTHLY_PAYMENT, INTEREST_RATE, and LOAN_AMOUNT as (x, y, z) coordinates), normalization of the data is usually required. To normalize data we simply adjust data values to lie between (0,1). Otherwise our data can be badly skewed and result in poor visualizations.

        "},{"location":"VTKBook/09Chapter9/#connectivity_1","title":"Connectivity","text":"

        Many useful visualization algorithms often borrow from other fields. Topological connectivity analysis is one such technique. This technique is best categorized as a method in computational geometry, but serves many useful purposes in computer graphics and visualization.

        To illustrate the application of connectivity analysis, we will use an MRI dataset generated by Janet MacFall at the Center for In Vivo Microscopy at Duke University. The dataset is a volume of dimensions 2563 and is included on the CD-ROM. The data is of the root system of a small pine tree. Using the class vtkSliceCubes, an implementation of marching cubes for large volumes, we generate an initial isosurface represented by 351,118 triangles. (We have placed the file pine_root.tri on CD-ROM. This is a faster way of manipulating this data. If you have a large enough computer you can process the volume directly with vtkVolume16Reader and vtkMarchingCubes.)

        (a) isosurface (b) largest connected surface Figure 9-51.Applying connectivity filter to remove noisy isosurface. Data is from 256^3 volume data of the root system of a pine tree. See PineRootConnectivityA.cxx and PineRootConnectivityA.py.; (b). See PineRootConnectivity.cxx and PineRootConnectivity.py.

        The vtkConnectivityFilter is a general filter taking datasets as input, and generating an unstructured grid as output. It functions by extracting cells that are connected at points (i.e., share common points). In this example the single largest surface is extracted. It is also possible to specify cell ids and point ids and extract surfaces connected to these.

        "},{"location":"VTKBook/09Chapter9/#decimation_1","title":"Decimation","text":"

        Decimation is a 3D data compression technique for surfaces represented as triangle meshes. We use it most often to improve rendering interactive response for large models.

        Figure 9-52 shows the application of decimation to the data from the pine root example. The original model of 351,118 triangles is reduced to 81,111 triangles using a combination of decimation and connectivity. The decimation parameters are fairly conservative. Here we see a reduction of approximately 55 percent. (a) Connected isosurface (b)Decimated connected isosurface Figure 9-52. Applying connectivity and decimation filters to remove noisy isosurfaces and reduce data size). Data is from 2563 volume data of the root system of a pine tree. See PineRootConnectivity.cxx and PineRootConnectivity.py.; (b). See PineRootDecimation.cxx and PineRootDecimation.py.

        The most common parameters to adjust in the vtkDecimate filter are the TargetReduction, InitialError, ErrorIncrement, MaximumIterations, and InitialFeatureAngle. TargetReduction specifies the compression factor (numbers closer to one represent higher compression). Because of topological, decimation criterion, aspect ratio, and feature angle constraints this reduction may not be realized (i.e., TargetReduction is a desired goal, not a guaranteed output). The InitialError and ErrorIncrement control the decimation criterion. As the filter starts, the decimation criterion is set to InitialError. Then, for each iteration the decimation criterion is incremented by ErrorIncrement. The algorithm terminates when either the target reduction is achieved, or the number of iterations reaches MaximumIterations. The InitialFeatureAngle is used to compute feature edges. Smaller angles force the algorithm to retain more surface detail.

        Other important parameters are the AspectRatio and MaximumSubIterations. AspectRatio controls the triangulation process. All triangles must satisfy this criterion or the vertex will not be deleted during decimation. A sub-iteration is an iteration where the decimation criterion is not incremented. This can be used to coalesce triangles during rapid rates of decimation. MaximumSubIterations controls the number of sub-iterations. This parameter is typically set to two.

        "},{"location":"VTKBook/09Chapter9/#texture-clipping","title":"Texture Clipping","text":"

        Texture mapping is a powerful visualization technique. Besides adding detail to images with minimal effort, we can perform important viewing and modelling operations. One of these operations is clipping data to view internal structure.

        Figure 9-53 is an example of texture clipping using a transparent texture map. The motor show consists of five complex parts, some of which are hidden by the outer casing. To see the inside of the motor, we define an implicit clipping function. This function is simply the intersection of two planes to form a clipping \"corner.\" The object vtkImplicitTextureCoords is used in combination with this implicit function to generate texture coordinates. These objects are then rendered with the appropriate texture map and the internal parts of the motor can be seen.

        The texture map consists of three regions (as described previously in the chapter). The concealed region is transparent. The transition region is opaque but with a black (zero intensity) color. The highlighted region is full intensity and opaque. As can be seen from Figure 9-53, the boundaries appear as black borders giving a nice visual effect. Figure 9-53. Texture cut used to reveal internal structure of a motor. Two cut planes are used in combination with transparent texture. See Motor.cxx and Motor.py.

        The importance of texture techniques is that we can change the appearance of objects and even perform modelling operations like clipping with little effort. We need only change the texture map. This process is much faster relative to the alternative approach of geometric modelling. Also, hardware support of texture is becoming common. Thus the rendering rate remains high despite the apparent increase in visual complexity.

        "},{"location":"VTKBook/09Chapter9/#delaunay-triangulation","title":"Delaunay Triangulation","text":"

        Delaunay triangulation is used to construct topology from unstructured point data. In two dimensions we generate triangles (i.e., an unstructured grid or polygonal dataset) while in three dimensions we generate tetrahedra (i.e., an unstructured grid). Typical examples of image data include points measured in space, or a dimensional subset of multidimensional data.

        In the example of Figure 9-54 we show how to create a 2D Delaunay triangulation from a field of points. The points are created by generating random x and y coordinate values in the interval [0, 1], and setting the z-value to a constant value (i.e., the points lie in an x-y plane). The points are then triangulated, and tubes and sphere glyphs are used to highlight the resulting points and edges of the triangulation. Figure 9-54.Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes. Only the pipeline to generate triangulation is shown. See DelaunayMesh.cxx and DelaunayMesh.py.

        One important concern regarding Delaunay triangulations is that the process is numerically sensitive. Creating triangles with poor aspect ratio (e.g., slivers) can cause the algorithm to break down. If you have a large number of points to triangulate, you may want to consider randomizing the point order. This approach tends to generate triangles with better aspect ratio and give better results. You may also want to consider other implementations of Delaunay triangulation that are more numerically robust. See [Edelsbrunner94] for an example.

        "},{"location":"VTKBook/09Chapter9/#96-chapter-summary","title":"9.6 Chapter Summary","text":"

        Dividing cubes is a scalar contouring operation that generates points rather than surface primitives such as lines or polygons. Dense point clouds appear solid because of the limited resolution of computer images.

        Vector fields have a complex structure. This structure can be visualized using streamribbons, streamsurfaces, and streampolygons. The topology of a vector field can be characterized by connecting critical points with streamlines.

        Tensor fields consist of three orthogonal vector fields. The vector fields are the major, medium, and minor eigenvectors of the tensor field. Hyperstreamlines can be used to visualize tensor fields.

        Dataset topology operations generate triangle strips, extract connected surfaces, and compute surface normals. Decimation is a polygon reduction algorithm that reduces the number of triangles in a triangle mesh. Implicit modelling techniques can be used to construct swept surfaces and volumes. Unstructured points are easy to represent but difficult to visualize. Splatting, interpolation, and triangulation techniques are available to construct structure for unstructured points. Multivariate visualization is required for data of dimension four and higher. Data must be mapped to three dimensions before standard visualization techniques can be used. Parallel coordinates techniques are also available to visualize multivariate data.

        Modelling algorithms extract geometric structure from data, reduce the complexity of the data or create geometry. Spatial extraction selects dataset structure and associated data attributes lying within a specified region in space. Subsampling reduces data by selecting every nth data point. A related technique, data masking, selects every nth cell. Subsets of a dataset can also be selected using thresholding, which selects cells or points that lie within a range of scalar values. Probing resamples data at a set of points. The probe produces a dataset that has the topology of the probe with data values from the probed dataset. Generating triangle strips can reduce storage requirements and improve rendering speeds on some systems. If a dataset has multiple disjoint structures, a connectivity algorithm can uniquely identify the separate structures. For polygonal data that does not have vertex normals defined, normal generation algorithms can compute these values that are suitable for interpolation by Gouraud or Phong shading. Decimation, another data reduction technique, removes triangles in \"flat\" regions and fills the resulting gaps with new triangles. Unstructured points present a challenge because the data does not have topology. Splatting represents each point in the data with a uniform sampling and accumulates these splats using implicit modelling techniques. Triangulation techniques build topology directly from the unstructured points.

        Multidimensional visualization techniques focus on data that has many scalar data values for each point. Parallel coordinates is an interesting approach that plots the scalar values for a data point along a parallel axis. The observer looks for trends and relationships between the lines that represent each point's data.

        Texture algorithms use texture coordinates and texture maps to select or highlight portions of a dataset. Texture thresholding assigns texture coordinates based on a scalar value. The scalar value and texture map determine how a cell or portion of a cell is rendered. Boolean textures extend this concept to 2D and 3D. Careful design of a boolean texture map permits the \"clipping\" of geometry with combinations of implicit surfaces. Texture can also be used to animate vector fields.

        "},{"location":"VTKBook/09Chapter9/#97-bibliographic-notes","title":"9.7 Bibliographic Notes","text":"

        Dividing cubes is an interesting algorithm because of the possibilities it suggests [Cline88]. Point primitives are extremely simple to render and manipulate. This simplicity can be used to advantage to build accelerated graphics boards, perform 3D editing, or build parallel visualization algorithms.

        Many plotting and visualization systems use carpet plots extensively. Carpet plots are relatively easy to represent and render. Often 2D plotting techniques are used (i.e., lighting and perspective effects ignored). Check [Wang90] for additional information on rendering carpet plots.

        In recent years a number of powerful vector visualization techniques have emerged. These techniques include streamsurfaces [Hultquist92], streampolygons [Schroeder91], vector field topology [Helman91] [Globus91], streamballs [Brill94], and vorticity visualization [Banks94]. The streamballs technique is a recent technique that combines techniques from implicit modeling. You may also wish to see references [Crawfis92] [vanWijk93] and [Max94]. These describe volume rendering and other advanced techniques for vector visualization, topics not well covered in this text.

        Some abstract yet beautiful visualization images are due to Delmarcelle and Hesselink [Delmarcelle93]. Their rendering of hyperstreamlines reflect the underlying beauty and complexity of tensor fields.

        Polygon reduction is a relatively new field of study. SIGGRAPH '92 marked a flurry of interest with the publication of two papers on this topic [Schroeder92a] [Turk92]. Since then a number of valuable techniques have been published. One of the best techniques, in terms of quality of results, is given by [Hoppe93], although it is limited in time and space because it is based on formal optimization techniques. Other interesting methods include [Hinker93] and [Rossignac93]. A promising area of research is multiresolution analysis, where wavelet decomposition is used to build multiple levels of detail in a model [Eck95]. The most recent work in this field stresses progressive transmission of 3D triangle meshes [Hoppe96], improved error measures [Garland97], and algorithms that modify mesh topology [Popovic97] [Schroeder97]. Most recently an extensive book on the technology is available including specialized methods for terrain simplification [Luebke02].

        Triangle strip generation is an effective technique for achieving dramatic improvements in rendering speed and reductions in data handling. The reference by [Evans96] describes other triangle strip generation algorithms as well as presenting some of the most effective tvechniques to date.

        The use of texture for visualization is relatively unexploited. This has been due in part to lack of texture support in most graphics software and hardware. This is now changing, as more vendors support texture and software systems (such as OpenGL) that provide an API for texture. Important references here include the boolean textures [Lorensen93] and surface convolution techniques [Cabral93] [Stalling95].

        Unstructured or unorganized point visualization is likely to play a prominent role in visualization as the field matures and more complex data is encountered. Nielson et al. have presented important work in this field [Nielson91].

        Multidimensional visualization is another important focus of visualization research [Bergeron89] [Mihalisin90]. Much real-world data is both unstructured and multidimensional. This includes financial databases, marketing statistics, and multidimensional optimization. Addressing this type of data is important to achieve future advances in understanding and application. Feiner [Feiner90] has presented a simple projection method combined with virtual reality techniques. [Inselberg87] has introduced parallel coordinates. These techniques have been shown to be powerful for many types of visual analysis.

        "},{"location":"VTKBook/09Chapter9/#98-references","title":"9.8 References","text":"

        [Banks94] D. C. Banks and B. A. Singer. \"Vortex Tubes in Turbulent Flows: Identification, Representation, Reconstruction.\" In Proceedings of Visualization '94. pp. 132-139, IEEE Computer Society Press, Los Alamitos, CA, 1994.

        [Bergeron89] R. D. Bergeron and G. Grinstein. \"A Reference Model for the Visualization of Multidimensional Data.' In Proceedings Eurographics \"89. pp. 393-399, North Holland, Amsterdam, 1989.

        [Bowyer81] A. Bowyer. \"Computing Dirichlet Tessellations.' The Computer Journal. 24(2):162-166, 1981.

        [Brill94] M. Brill, H. Hagen, H-C. Rodrian, W. Djatschin, S. V. Klimenko. \"Streamball Techniques for Flow Visualization.\" In Proceedings of Visualization '94. pp. 225-231, IEEE Computer Society Press, Los Alamitos, CA, 1994.

        [Cabral93] B. Cabral and L. Leedom. \"Imaging Vector Fields Using Line Integral Convolution.\" In Proceedings of SIGGRAPH '93, pp. 263-270, Addison-Wesley, Reading, MA, 1993.

        [Cline88] H. E. Cline, W. E. Lorensen, S. Ludke, C. R. Crawford, and B. C. Teeter, \"Two Algorithms for the Three-Dimensional Construction of Tomograms.\" Medical Physics. 15(3):320-327, June 1988.

        [Crawfis92] R, Crawfis and N. Max. \"Direct Volume Visualization of Three Dimensional Vector Fields.\" In Proceedings 1992 Workshop on Volume Visualization. pp. 55-60, ACM Siggraph, New York, 1992.

        [Delmarcelle93] T. Delmarcelle and L. Hesselink. \"Visualizing Second-Order Tensor Fields with Hyperstreamlines.\" IEEE Computer Graphics and Applications. 13(4):25-33, 1993.

        [Eck95] M. Eck, T. DeRose, T. Duchamp, H. Hoppe, M. Lounsbery, W. Stuetzle. \"Multiresolution Analysis of Arbitrary Meshes.\" In Proceedings SIGGRAPH '95. pp. 173-182, Addison-Wesley, Reading, MA, August 1995.

        [Edelsbrunner94] H. Edelsbrunner and E. P. Mucke. \"Three-dimensional alpha shapes.\" ACM Transactions on Graphics. 13:43-72, 1994.

        [Evans96] F. Evans, S. Skiena, A. Varshney. \"Optimizing Triangle Strips for Fast Rendering.\" In Proceedings of Visualization '96. pp. 319-326, IEEE Computer Society Press, Los Alamitos, CA, 1996.

        [Feiner90] S. Feiner and C. Beshers. \"Worlds within Worlds: Metaphors for Exploring n-Dimensional Virtual Worlds.\" In Proceedings UIST '90 (ACM Symp. on User Interface Software). pp. 76-83, October, 1990.

        [Garland97] M. Garland and P. Heckbert. \"Surface Simplification Using Quadric Error Metrics.\" In Proceedings SIGGRAPH '97. pp. 209-216, The Association for Computing Machinery, New York, August 1997.

        [Globus91] A. Globus, C. Levit, and T. Lasinski. \"A Tool for Visualizing the Topology of Three-Dimensional Vector Fields.\" In Proceedings of Visualization '91. pp. 33-40, IEEE Computer Society Press, Los Alamitos, CA, 1991.

        [He96] T. He, L. Hong, A. Varshney, S. Wang. \"Controlled Topology Simplification.\" IEEE Transactions on Visualization and Computer Graphics. 2(2):171-184, June 1996.

        [Helman91] J. L. Helman and L. Hesselink. \"Visualization of Vector Field Topology in Fluid Flows.' IEEE Computer Graphics and Applications. 11(3):36-46, 1991.

        [Hinker93] P. Hinker and C. Hansen. \"Geometric Optimization.\" In Proceedings of Visualization '93. pp. 189-195, IEEE Computer Society Press, Los Alamitos, CA, October 1993.

        [Hoppe93] H. Hoppe, T. DeRose, T. Duchamp, J. McDonald, W. Stuetzle. \"Mesh Optimization.\" In Proceedings of SIGGRAPH '93. pp. 19-26, August 1993.

        [Hoppe96] H. Hoppe. \"Progressive Meshes.\" In Proceedings SIGGRAPH '96. pp. 96-108, The Association for Computing Machinery, New York, August 1996.

        [Hultquist92] J. P. M. Hultquist. \"Constructing Stream Surfaces in Steady 3-D Vector Fields.\" In Proceedings of Visualization '92. pp. 171-178, IEEE Computer Society Press, Los Alamitos, CA, 1992.

        [Inselberg87] A. Inselberg and B. Dimsdale. \"Parallel Coordinates for Visualizing Multi-Dimensional Geometry.\" In Computer Graphics 1987 (Proceedings of CG International '87). pp. 25-44, SpringerVerlag, 1987.

        [Lawson86] C. L. Lawson. \"Properties of n-Dimensional Triangulations.\" Computer-Aided Geometric Design. 3:231-246, 1986.

        [Lorensen93] W. Lorensen. \"Geometric Clipping with Boolean Textures.\" in Proceedings of Visualization '93. pp. 268-274, IEEE Computer Society Press, Los Alamitos, CA, Press, October 1993.

        [Luebke02] D. Luebke, M. Reddy, J. Cohen, A. Varshney, B. Watson, R. Huebner. Level of Detail for 3D Graphics. Morgan Kaufmann 2002. ISBN 1-55860-838-9.

        [Max94] N. Max, R. Crawfis, C. Grant. \"Visualizing 3D Vector Fields Near Contour Surfaces.\" In Proceedings of Visualization '94. pp. 248-255, IEEE Computer Society Press, Los Alamitos, CA, 1994.

        [Mihalisin90] T. Mihalisin, E. Gawlinski, J. Timlin, and J. Schwegler. \"Visualizing a Scalar Field on an n-Dimensional Lattice.\" In Proceedings of Visualization '90. pp. 255-262, IEEE Computer Society Press, Los Alamitos, CA, October 1990.

        [Nielson91] G. M. Nielson, T. A. Foley, B. Hamann, D. Lane. \"Visualizing and Modeling Scattered Multivariate Data.\" IEEE Computer Graphics and Applications. 11(3):47-55, 1991.

        [Popovic97] J. Popovic and H. Hoppe. \"Progressive Simplicial Complexes.\" In Proceedings SIGGRAPH '97. pp. 217-224, The Association. for Computing Machinery, New York, August 1997.

        [Rossignac93] J. Rossignac and P. Borrel. \"Multi-Resolution 3D Approximations for Rendering Complex Scenes.\" In Modeling in Computer Graphics: Methods and Applications. B. Falcidieno and T. Kunii, eds., pp. 455-465, Springer-Verlag Berlin, 1993.

        [Schroeder91] W. Schroeder, C. Volpe, and W. Lorensen. \"The Stream Polygon: A Technique for 3D Vector Field Visualization.\" In Proceedings of Visualization '91. pp. 126-132, IEEE Computer Society Press, Los Alamitos, CA, October 1991.

        [Schroeder92a] W. Schroeder, J. Zarge, and W. Lorensen. \"Decimation of Triangle Meshes.\" Computer Graphics (SIGGRAPH \"92). 26(2):65-70, August 1992.

        [Schroeder92b] W. Schroeder, W. Lorensen, G. Montanaro, and C. Volpe. \"Visage: An Object-Oriented Scientific Visualization System.' In Proceedings of Visualization \"92. pp. 219-226, IEEE Computer Society Press, Los Alamitos, CA, October 1992.

        [Schroeder94] W. Schroeder, W. Lorensen, and S. Linthicum, \"Implicit Modeling of Swept Surfaces and Volumes.\" In Proceedings of Visualization '94. pp. 40-45, IEEE Computer Society Press, Los Alamitos, CA, October 1994.

        [Schroeder97] W. Schroeder. \"A Topology Modifying Progressive Decimation Algorithm.\" In Proceedings of Visualization '97. IEEE Computer Society Press, Los Alamitos, CA, October 1997.

        [Stalling95] D. Stalling and H-C. Hege. \"Fast and Independent Line Integral Convolution.\" In Proceedings of SIGGRAPH '95. pp. 249-256, Addison-Wesley, Reading, MA, 1995.

        [Turk92] G. Turk. \"Re-Tiling of Polygonal Surfaces.\" Computer Graphics (SIGGRAPH '92). 26(2):55-64, July 1992.

        [vanWijk93] J. J. van Wijk. \"Flow Visualization with Surface Particles.\" IEEE Computer Graphics and Applications. 13(4):18-24, 1993.

        [Wang90] S-L C. Wang and J. Staudhammer. \"Visibility Determination on Projected Grid Surfaces.\" IEEE Computer Graphics and Applications. 10(4):36-43, 1990.

        [Watson81] D. F. Watson. \"Computing the n-Dimensional Delaunay Tessellation with Application to Voronoi Polytopes.\" The Computer Journal. 24(2):167-172, 1981.

        [Wixom78] J. Wixom and W. J. Gordon. \"On Shepard's Method of Metric Interpolation to Scattered Bivariate and Multivariate Data.\" Math. Comp. 32:253-264, 1978.

        [Yamrom95] B. Yamrom and K. M. Martin. \"Vector Field Animation with Texture Maps.\" IEEE Computer Graphics and Applications. 15(2):22-24, 1995.

        "},{"location":"VTKBook/09Chapter9/#99-exercises","title":"9.9 Exercises","text":"

        9.1 Describe an approach to adapt dividing cubes to other 3D cell types. Can your method be adapted to 1D and 2D cells?

        9.2 Discuss the advantages and disadvantages of representing surfaces with points versus polygons.

        9.3 Streamribbons can be constructed by either i) connecting two adjacent streamlines with a surface, or ii) placing a ribbon on the streamline and orienting the surface according to streamwise vorticity vector. Discuss the differences in the resulting visualization.

        9.4 Write the following programs to visualize velocity flow in the combustor. a) Use vtkProbeFilter and vtkHedgeHog.

        b) Use vtkProbeFilter and vtkStreamLine.

        c) Use vtkProbeFilter and vtkWarpVector.

        d) Use vtkProbeFilter and vtkVectorNorm.

        e) Use vtkProbeFilter and vtkVectorDot.

        9.5 Describe a method to extract geometry using an arbitrary dataset. (That is, extract geometry that lies within the culling dataset.) (Hint: how would you evaluate in/out of points?)

        9.6 The filter vtkPolyDataNormals is often used in combination with the filters vtkSmoothPolyData and vtkContourFilter to generate smooth isosurfaces.

        a) Write a class to combine these three filters into one filter. Can you eliminate intermediate storage?

        b) How much error does vtkSmoothPolyData introduce into the isosurface? Can you think of a way to limit the error?

        c) What is the difference between the surface normals created by vtkMarchingCubes and vtkPolyDataNormals?

        9.7 Assume that we have a database consisting of interest rate R, monthly payment P, monthly income I, and days payment is late L.

        a) If R, P, I are all sampled regularly, how would you visualize this data?

        b) If all data is irregularly sampled, list three methods to visualize it.

        9.8 Why do you think triangle strips are often faster to render than general polygons?

        9.9 The normal generation technique described in this chapter creates consistently oriented surface normals.

        a) Do the normals point inside or outside of a closed surface?

        b) Describe a technique to orient normals so that they point out of a closed surface. c) Can surface normals be used to eliminate visible triangles prior to rendering? (Hint: what is the relationship between camera view and surface normal?)

        9.10 Describe a technique to partially threshold a cell (i.e., to cut a cell as necessary to satisfy threshold criterion). Can an approach similar to marching cubes be used?

        9.11 The class vtkRendererSource allows us to use the rendered image as a texture map (or image data dataset). Write a program to construct iterated textures, that is textures that consist of repeated images. Can the same image be generated using texture coordinates?

        9.12 Describe how you would modify the decimation algorithm to treat general polygons.

        9.13 Several examples in the text (e.g., deciFran.tcl and deciHawa.tcl) use the class vtkDecimate. Modify these examples to use the topology modifying progressive decimation algorithm (implemented in vtkDecimatePro). How much greater reduction can you achieve?

        "},{"location":"VTKBook/10Chapter10/","title":"Chapter 10 - Image Processing","text":"

        In this chapter we describe the image processing components of the Visualization Toolkit. The focus is on key representational ideas, pipeline issues such as data streaming, and useful algorithms for improving the appearance and effectiveness of image data visualizations.

        "},{"location":"VTKBook/10Chapter10/#101-introduction","title":"10.1 Introduction","text":"

        Image processing has been a mainstay of computing since the advent of the digital computer. Early efforts focused on improving image content for human interpretation. More recently image processing has been utilized by practitioners of computer vision, the goal being the processing of image data for autonomous machine perception [Gonzalez92]. From the perspective of data visualization, image processing is used to manipulate image content to improve the results of subsequent processing and interpretation. For example, a CT or MRI scan may generate spurious signal noise or require image segmentation. Using the techniques of image processing, noise can be removed and automatic and semi-automatic segmentation can be performed on a slice by slice (i.e., image by image basis). As a result, isosurface generation, volume rendering, and other 3D techniques can be improved in appearance, accuracy, and effectiveness by applying techniques from image processing.

        Since the focus of this text is on 3D graphics and visualization, this chapter treats image processing in a limited way. However, we would like to emphasize the interrelationship of image processing, computer graphics, and visualization. Often texts and courses treat these as distinctly separate disciplines, when in fact they are closely related (see \"Imaging, Computer Graphics, and Visualization\" in Chapter 1).

        The material presented here was selected to demonstrate a number of important points. First, the data flow or pipeline approach presented earlier is directly applicable to image processing, with the added benefit that we can easily implement data streaming and caching due to the regular nature of image data. Second, image processing algorithms can improve the results of visualization. We will show this through a number of useful examples. And finally, from a practical point of view, we wanted to demonstrate a system architecture that includes imaging, graphics, and visualization.

        "},{"location":"VTKBook/10Chapter10/#102-data-representation","title":"10.2 Data Representation","text":"

        In this section we will briefly describe the data representation behind the imaging pipeline. As we saw earlier (in \"The Dataset\" in Chapter 5), a dataset consists of both a structure (topology and geometry) and data attributes. Although in principle an image can be represented as a image data dataset, the special nature of image processing suggests a more complex representation, as we will soon see.

        An image is typically used to refer to a 2D structured point dataset. More generally, in this chapter we will define an image as consisting of up to four dimensions: three spatial dimensions x, y, and z, and time t. The reason we add the time dimension is that images are frequently generated as a time series, and we often wish to access the data along the time axis. For example, we may plot the value at a point as a function of time.

        As described in \"Image Data\" in Chapter 5, an image has both regular topology and geometry. The regularity of the data lends itself to many special operations. In particular, we can support data caching and streaming, and operating on regions of interest in the data.

        "},{"location":"VTKBook/10Chapter10/#regions-of-interest","title":"Regions of Interest","text":"

        When data has a regular spatial organization, it is possible to request the data in pieces or regions of interest. For example, a mapper may need only a region of the data for its display, so loading or processing the whole dataset would be inefficient. An example of this is a two-dimensional viewer that displays only one slice of a large structured volume. By loading slices only as they are needed, disk access can be reduced, and memory conserved.

        Although regions of interest can have arbitrary shapes, the regular structure of the data samples determines optimal region configurations. An image stored in a Cartesian coordinate system easily divides into smaller rectangular regions, while data sampled on a polar coordinate grid is best divided into pie-shaped regions (Figure 10-1). Therefore, operating on regions of data means that we process \"windows\" of data specified by (min,max) ranges of each dimension, or axis. For example, a region in a 2D image of dimensions 100 x 100 might be specified as (25,49, 0,49), meaning that we would operate on a (25 x 50) window. Figure 10-1. Axis aligned matrices naturally lend themselves to rectangular regions, and polar coordinate grids to pie-shaped regions."},{"location":"VTKBook/10Chapter10/#streaming-and-caching","title":"Streaming and Caching","text":"

        The disadvantage of processing regions of interest is that the same data may be read and processed multiple times. If the viewer described above needs to cine (i.e., loop) through the slices, or interactively pan around a large image, it would be beneficial to have all the data loaded at once.

        A compromise between the two extreme approaches of maintaining all data in memory or operating on small pieces is to update regions larger than requested, but not as large as the whole image. This is referred to as a data cache. Data caching anticipates future requests and works well in most cases. However, it breaks down when there is little or no coherence between subsequent requests.

        With the region-processing model, the data objects can be thought of as caches that hold any number of regions. There are numerous caching strategies for saving and releasing regions that can be quite complex. The simplest strategy saves only a single region at any one time. If subsequent requests are completely contained in the cached region, no further processing is required. An alternative strategy might divide an image into tiled regions of all the same size. When a region larger than the tile is requested, multiple tiles are updated to cover the region. When designing a caching strategy, it is important to consider the overhead of copying data to change its format. Some of the advantages of complex strategies are lost when all the factors are considered.

        Given the ability to operate on regions of data, it is a small step to stream operations on a whole dataset. Streaming is the process of pulling regions of data in a continual flow through the pipeline. For instance, a pixel histogram mapper could request single pixels as it accumulates values in its bins. Large datasets can be processed in this manner without ever having to load more than a few pixels at a time. If multiple processors are available, region processing can also be used to split a task into multiple pieces for load balancing and faster execution.

        "},{"location":"VTKBook/10Chapter10/#attribute-data-and-components","title":"Attribute Data and Components","text":"

        Unlike visualization algorithms that may generate normals, vectors, tensors, and texture coordinates, image processing algorithms generally process attribute data consisting of scalar data. Often the data is a single component (e.g., a gray-scale image), but frequently color images (three components of RGB, for example) may also be processed.

        In the Visualization Toolkit imaging pipeline, attribute data is represented as n-dimensional component data. Refer to \"Putting It All Together\" to see the implementation details for component data, regions of interest, streaming, and caching.

        "},{"location":"VTKBook/10Chapter10/#103-algorithms","title":"10.3 Algorithms","text":"

        This section provides an overview and examples for important image processing algorithms. The importance of the algorithms is measured on their relevance to 3D data visualization. Topics include: removing noise, smoothing, reducing sampling artifacts, image enhancement, segmentation, and morphological operators such as erosion and dilation.

        "},{"location":"VTKBook/10Chapter10/#image-restoration","title":"Image Restoration","text":"

        Noise and other artifacts are inherent in all methods of data acquisition. Since artifacts can degrade the visual appearance and analysis of images, the first step of image processing is often restoration. Knowledge of the statistical properties of artifacts allows filters to selectively remove them with minimal impact on the underlying data. For example, most of the power of typical images lie in low frequencies, while white noise is evenly distributed across the frequency spectrum. In this situation, low-pass filters eliminate much of the noise, but leave most of the image intact.

        A simple implementation of a low-pass smoothing filter is convolution with a kernel with all positive values. The typical kernels used for smoothing are either constant across a circular neighborhood, or have a Gaussian profile (see Figure 10-2). Gaussian smoothing results in better-looking images than smoothing with constant kernels, but can be more computationally expensive because of the large kernel size necessary to capture the Gaussian profile. Smoothing becomes even more expensive when it is generalized to three-dimensional datasets, and three-dimensional kernels.

        One way to speed Gaussian smoothing is to decompose the filter into two 1D convolutions. Since the 2D Gaussian function is separable,

        \\begin{equation*} g(i, j) = \\frac{1}{2\\pi \\sigma^2} \\exp\\left(-\\frac{i^2 + j^2}{2\\sigma^2} \\right) = \\frac{1}{\\sqrt{2\\pi}\\sigma} \\exp\\left(-\\frac{i^2}{2\\sigma^2} \\right) \\frac{1}{\\sqrt{2\\pi}\\sigma} \\exp\\left(-\\frac{j^2}{2\\sigma^2} \\right) \\end{equation*} \\bf\\tag{10-1}

        smoothing along the x axis and then along the y axis with 1D Gaussian kernels is equivalent to convolving with a 2D Gaussian kernel. It is also possible to approximate Gaussian smoothing by convolving with a constant binary kernel multiple times.

        Figure 10-2. Low-pass filters can be implemented as convolution with a Gaussian kernel. The Gaussian kernel displayed on top has been magnified for this figure. See GaussianSmooth.cxx and GaussianSmooth.py."},{"location":"VTKBook/10Chapter10/#nonlinear-smoothing","title":"Nonlinear Smoothing","text":"

        One problem with simple smoothing to remove noise is that edges are blurred. Although high frequencies make up a small part of images, the human visual system is acutely sensitive to high frequencies in the spatial form of edges. In fact, most of the low frequencies in an image are discarded by the visual system before it even leaves the retina. One approach to smoothing that preserves edges is anisotropic diffusion. This filter smoothes relatively flat regions of an image, but does not diffuse across abrupt transitions. The diffusion is iterated until the desired level of noise reduction is reached. Two possible diffusion criteria are: Diffuse only when the gradient magnitude is below a specified value, or diffuse two pixels only when the difference between the pixels is lower than a specified constant. A median filter also smoothes while preserving edges. This filter replaces each pixel with the median value of the scalar values in a neighborhood centered on the pixel. Median filters are most effective on high amplitude noise that has a low probability of occurring (see Figure 10-3). There are two ways to control the amount and scale of noise removed: The size of the neighborhood can be varied, or the filter can be applied multiple times. This median filter preserves edges; however, it does round corners and remove thin lines. The hybrid median filter was developed to address this behavior. It operates on a 5 x 5 neighborhood around each pixel. The algorithm consists of two steps: first the median values of an \"x\"-shaped and \"+\"-shaped neighborhoods are computed, then the median of these two values and the center-pixel value is computed to give the final result. The hybrid median has a fixed size neighborhood, but can be applied multiple times to further reduce noise (Figure 10-4). Figure 10-3. Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise. See MedianComparison.cxx and MedianComparison.py."},{"location":"VTKBook/10Chapter10/#low-frequency-artifacts","title":"Low Frequency Artifacts","text":"

        An artifact called aliasing occurs when sub-sampling and is often associated with stair-stepping edges. Sampling theory proves that discrete sampled signals with spacing S, completely describe continuous functions composed of frequencies less than S/2. When a signal is subsamples, its capacity to hold high frequency information is reduced. However, the high frequency energy does not disappear. It wraps around the frequency spectrum appearing as a low frequency alias artifact (Figure 10-5). The solution, which eliminates this artifact, is to low-pass filter before sub-sampling. Low-pass smoothing reduces the high frequency range of an image that would cause aliasing.

        The same aliasing phenomena occurs when acquiring data. If a signal from an analog source contains high frequencies, saving the analog data in a discrete form requires sub-sampling that will introduce alias artifacts. For this reason, it is common practice to acquire data at high resolutions, then smooth and subsample to reduce the image to a manageable size.

        Figure 10-4. Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. The lower patterns represent the three neighborhoods used to compute the hybrid median. See HybridMedianComparison.cxx and HybridMedianComparison.py.

        Low-frequency artifacts, other than aliasing, can also occur when acquiring data. One example is base-line drift. As data is acquired over time, the average value (base line) of the signal can slowly change. This drift can be removed with a high-pass filter after data acquisition. It is also possible to acquire a second dataset that isolates the baseline. Subtracting the baseline from the primary signal removes the drift artifact. In general, it is better to measure the artifact than risk making wrong assumptions that might adversely affect the actual data.

        Figure 10-5. This figure demonstrates aliasing that occurs when a high-frequency signal is subsamples. High frequencies appear as low frequency artifacts. The lower left image is an isosurface of a skull after sub-sampling. The right image used a low-pass filter before sub-sampling to reduce aliasing. See IsoSubsample.cxx and IsoSubsample.py.

        Another gradual change across an image is caused by sensor position. The amplitude of a measured signal usually attenuates as the source moves away from the sensor. An example of this attenuation artifact is seen in surface-coil-MRI images as shown in Figure 10-6. If the attenuation profile is known, then the artifact can be removed by dividing the original data with the profile. Since this artifact can be characterized by a small set of parameters like sensor position and range, it is possible to automatically determine the attenuation profile from the data. Like most artifacts, nonuniform attenuation tends to hide the information in an image. Given a function that measures the amount of information in an image, gradient descent and other search strategies can find the optimal attenuation parameters."},{"location":"VTKBook/10Chapter10/#image-enhancement","title":"Image Enhancement","text":"

        Often datasets contain information or have dynamic range that cannot be completely displayed in a single image. X-Ray Computed Tomography (CT) datasets, for example, can have 10 times the scalar resolution of the typical computer monitor capable of displaying 256 shades of gray. One method used for conveying information buried in the large dynamic range of these medical datasets is to allow a user to interactively set the color map with a window-level transfer function. The user can then choose to display the range of data they find most important as shown in Figure 10-7. The slope of the transfer function determines the amount of contrast in the final image. Slopes greater than one increase contrast, and slopes less than one decrease contrast. All contrast and information is lost in the scalar ranges where the transfer function is constant and has zero slope. Figure 10-6. This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. This histograms shows how the artifact hides information in the form of scalar value clusters. See Attenuation.cxx and Attenuation.py.

        The short fall of simple window-level transfer functions are their limited shape. More general nonlinear transfer functions can be more appropriate for certain datasets. One example is the logarithmic transfer function, f(x) = K log ( 1 + x ) , which can be used to display image power spectrums (Figure 10-10). Most of the pixels in the power spectrum represent high frequencies, and have small values. However the smaller population of low-frequency pixels often have large values. The logarithmic function has the largest slope near zero, and therefore leaves the most contrast for pixels with small values. However, when the constant K is chosen correctly, none of the large pixel values become completely saturated.

        To take advantage of all the available display contrast, images should have a uniform distribution of intensities. For continuous images, this intensity distribution is called the probability density function (PDF). For discretely-sampled images with discrete scalar values, the image histogram has the same information as the PDF (Figure 10-7). A histogram breaks the scalar range of an image into discrete non-overlapping bins. Each bin has a pixel count that represents the number of pixels whose scalar value falls in that bin's range.

        To achieve the goal of a uniform scalar histogram, transfer functions can be used to spread out clusters in the histogram and compress scalar ranges that are under-represented in the image. To maintain the general appearance of the image, the transfer function should be monotonically increasing so that the brightness relation is maintained. To spread out clusters in the histogram, the slope of the transfer function should be large where the scalar densities are the highest, and the slope should be small in empty regions of the histogram.

        Figure 10-7. The top charts show two window-level transfer functions. The resulting images are displayed in the middle row. The bottom row shows image histograms of the images.

        Histogram equalization is an algorithm that automatically generates a tailored transfer function to increase contrast in an image. For continuous images, the transfer function is simply the cumulative distribution function (CDF) which is defined as the integral of the PDF. By definition, the CDF function has a large slope where the PDF has the largest value, and therefore gives the greatest contrast to scalar ranges that occur most frequently in an image. The result of using the CDF as a transfer function is an image with an ideal constant scalar distribution. For discrete images and image histograms, a discrete version of the CDF function can be used. However, because of the discrete approximation, the resulting image is not guaranteed to have a constant histogram (Figure 10-8). Figure 10-8. Histogram equalization automatically computes a transfer function that produces an image with a nearly constant scalar histogram.

        High-pass filters can also be used to compress the range of an image. Since low frequencies account for much of the dynamic range of an image but carry little information, a high-pass filter can significantly decrease an image's scalar range and emphasize hidden details. The Laplacian filter, which is a second derivative operation, is one implementation of a high-pass filter. It eliminates constant and low frequencies leaving only high-frequency edges. The output of the Laplacian can be subtracted from the original image to produce edge enhancement or sharpening of an image (Figure 10-9)."},{"location":"VTKBook/10Chapter10/#frequency-domain","title":"Frequency Domain","text":"

        The Fourier transform belongs to a class of filters that fundamentally change the representation of an image without changing its information. The output of the Fourier transform is in the frequency domain. Each pixel is a complex number describing the contribution of a sinusoidal function to the original image. The magnitude of the pixel encodes the amplitude of the sinusoid, and the orientation of the complex pixel encodes the sinusoid's phase. Each pixel represents a sinusoid with different orientation and frequency. The reverse Fourier transform converts a frequency domain image back to the original spatial domain (Figure 10-10).

        Low-pass and high-pass filtering become trivial in the frequency domain. A portion of the pixels are simply masked or attenuated. Figure 10-11 shows a high pass Butterworth filter that attenuates the frequency domain image with the function H \\begin{equation*} H(u, v) = \\frac{1}{1 + \\left(\\frac{C^2}{u^2 + v^2}\\right)^n} \\end{equation*} \\bf\\tag{10-2} Figure 10-9. High-pass filters can extract and enhance edges in an image. Subtraction of the Laplacian (middle) from the original image (left) results in edge enhancement or a sharpening operation (right). See EnhanceEdges.cxx and EnhanceEdges.py.

        The gradual attenuation of the filter is important. The ideal high-pass filter, shown in the same figure, simply masks a set of pixels in the frequency domain. The abrupt transition causes a ringing effect in the spatial domain (as the figure illustrates).

        Although any filter that operates in the frequency domain can also be implemented in the spatial domain, some operations are less computationally expensive and easier to implement in the frequency domain. To perform similar filtering of Figure 10-11 in the spatial domain would require convolution with a large kernel and would be slow. In general, convolution with large kernels is more efficient when performed in the frequency domain. Multiplication, \\alpha \\beta, in the frequency domain, is equivalent to convolution, a * b , in the spatial domain (and vice versa). In these equations, \\alpha is the Fourier transform of a, and \\beta is the Fourier transform of b. Figure 10-10. The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This figure show an image and its power spectrum displayed using a logarithmic transfer function. See VTKSpectrum.cxx and VTKSpectrum.py.

        In order to make frequency-domain processing feasible, it is first necessary to minimize the cost of transforming from the spatial to frequency domain and back. There exist fast algorithms that implement the Fourier transform and its inverse. First, the Fourier transform is decomposable, so a 2D transform can be implemented by first taking the 1D Fourier transform of all the rows, and then taking the Fourier transform of all the columns of an image. Second, the complexity of one-dimensional Fourier transforms can be reduced with an algorithm called the fast Fourier transform (FFT). It works by recursively factoring the number samples, N, into its prime components. If N is prime and not factorable, then the transform is completed in one step that is order O(N^2) complexity. If N is divisible by two, the array of numbers is divided into two parts that are transformed separately and then combined. If N is a power of two, then the algorithm executes in order O(N \\log N) time.

        Figure 10-11. This figure shows two high-pass filters in the frequency domain. The Butterworth high-pass filter has a gradual attenuation that avoids ringing produced by the ideal high-pass filter with an abrupt transition. See IdealHighPass.cxx and IdealHighPass.py.

        For this reason, it is more efficient to process images with sizes that are powers of two (e.g., 512 x 512) than other sized images. For non-power of two images it may be faster to pad the image to a size that is a power of two size before processing.

        An important point about the discrete Fourier transform is that it treats the image as a periodic function. This means the pixels on the right border are adjacent to pixels on the left border. Since there is usually no physical relationship between these pixels, the artificial horizontal and vertical edges can distort the frequency spectrum and subsequent processing. To reduce these artifacts, the original image can be multiplied by a window function that becomes zero at the borders. Another approach removes these artificial edges by smoothing only along the borders.

        In both of these approaches, a portion of the original image is lost, so only the central portion of an image can be processed. If this is unacceptable, another solution is to double the dimensions of the original image with a mirror-padding filter. The intermediate image is periodic and continuous (Figure 10-12)."},{"location":"VTKBook/10Chapter10/#image-segmentation","title":"Image Segmentation","text":"

        Segmentation is the process of classifying pixels in an image or volume. It can be one of the most difficult tasks in the visualization process. One form of segmentation takes an image as input, and outputs a map that contains a classification for each pixel. The output of such a segmentation filter usually has binary or discrete values for each pixel; however, it is also possible to output a fuzzy classification where the pixel's scalar value represents a measure of confidence in the classification.

        A simple example of a one-parameter segmentation is a threshold filter used to mark bone in a CT dataset. Since bone has the largest scalar value, it is easy to select a threshold that separates bone from the rest of the image.

        Figure 10-12. Convolution in frequency space treats the image as a periodic function. A large kernel can pick up features from both sides of the image. The lower-left image has been padded with zeros to eliminate wraparound during convolution. On the right, mirror padding has been used to remove artificial edges introduced by borders. See Pad.cxx and Pad.py.

        For other tissues and other imaging modalities, segmentation is usually more difficult. Noise in the image and overlapping scalar values of tissues can decrease the effectiveness of simple threshold segmentation. By using two parameters, the threshold can segment pixels with a range of scalar values. The extra parameter allows more control over the resulting segmentation, but also doubles the complexity of selecting the parameters.

        Images can be pre-processed to segment images based on more complex features such as textures. Sometimes textures in tissues add information useful for segmentation. Texture sensitive filters like Laplacian and gradient magnitude can discriminate between different textures. Additional filters that can be used for texture segmentation are the range, variance, and correlation filters. The range filter simply reports the difference between the maximum and minimum values in a neighborhood around each pixel, and the variance filter computes the variance of the neighborhood pixels relative to the **center pixel.

        Figure 10-13 shows an example of how a correlation filter can be used for segmentation. A correlation filter is similar to convolution. The kernel is shifted across the image, and for each location the dot product between the image and the kernel gives a measure of correlation between the two. The output of the correlation filter is large everywhere the pattern occurs in the image, but small at other locations. Because the resulting map is sparse, additional post-processing is required to find a uniform, segmented region. In this example, dilation followed by erosion was used to close the gaps between the patterns. (Dilations and erosion are discussed in the next section.)"},{"location":"VTKBook/10Chapter10/#post-processing","title":"Post-processing","text":"

        Although preprocessing can do a lot to improve segmentation results, post-processing can also be useful. Morphological filters, which operate on binary or discrete images, can be useful for manipulating the shape of the segmented regions. In this brief discussion we will only consider operations that use circular footprints, even though these morphological filters can be defined much more generally. Erosion is implemented by removing pixels within a specified distance of a border. For each pixel not in the segmented region, all the neighbors in a circular region around the pixels are turned off. This erosion filter shrinks the segmented region and small isolated regions disappear.

        Figure 10-13. A pipeline containing correlation, thresholding, dilation, and erosion is used here to segment a region composed of \"C\"s. The left image shows the original image. The right image shows the segmented region superimposed on the original image. Figure 10-14. This figure demonstrates various binary filters that can alter the shape of segmented regions. See MorphologyComparison.cxx and MorphologyComparison.py.

        The opposite of erosion is dilation. This filter grows the area of segmented regions. Small holes in the segmented region are completely closed. Any pixel not in the segmented region but near the region is turned on. Dilation and erosion are dual filters with nearly identical implementations. Dilating the \"on\" pixels is equivalent to eroding \"off\" pixels in a binary image (see Figure 10-14).

        Closing is the serial application of first dilation and then erosion. When an image is dilated small holes in the map disappear. However, dilation alone also grows the boundaries of the segmented regions. When dilation is followed by erosion in a closing operation, small holes are removed; however, the boundary of the segmented regions remain in the same general location. Opening is the dual of closing. Opening removes small islands of pixels. It is implemented with an initial erosion, followed by a dilation.

        Connectivity filters can also remove small regions without affecting the remaining boundaries of segmented regions. This set of filters separate the segmented pixels into equivalence classes based on a neighbor relation. Two pixels belong to the same class if they are touching. There are two common neighbor relations in two-dimensional images: four connectivity considers pixels neighbors if they are edge neighbors, and eight connectivity considers pixels neighbors if pixels share any vertex.

        After the pixels have been assigned an equivalence class, various methods are used to determine which groups of pixels will pass through the filter, and which classes will be eliminated. The island-removal filter is a connectivity filter that removes groups that have too few pixels. Seed connectivity allows the user to explicitly specify which groups will pass through the filter. The user or application specifies a set of seeds. Any group that includes a seed makes it through the filter. Groups that do not contain seeds are removed. This filter is similar to the seed-connectivity filter; however, the seeds are supplied in a second image. First the intersection between the segmented image and the seed image is taken. Each remaining pixel is then added to a set of seeds.

        "},{"location":"VTKBook/10Chapter10/#multispectral-segmentation","title":"Multispectral Segmentation","text":"

        From everyday experience we know that it is easier to see structure and information in color images than in gray-scale images. This is because each pixel contains more information in the red, blue, and green components than a single component gray-scale pixel. One way to segment multispectral images is to separate the components and threshold them individually and then combine the resulting binary images with logic filters. This allows selection of rectangular patched areas in the color/ component space of the pixels.

        By using multiple thresholds combined with multiple levels of logic filters, it is possible to specify arbitrary areas in the component's space for segmentation. However, it can be easier and more efficient to transform the components into a different coordinate system before the threshold operation. The simplest example of this is to threshold a projection of the components. This is equivalent to a threshold after performing a dot product between the components of a pixel and a constant-direction vector. This divides the component space into two areas separated by a hyperplane.

        Another example of a coordinate transformation is conversion from red, green, blue (RGB) color component to hue, saturation, value (HSV) representation (see \"Color\" in Chapter 3. Segmentation of images based on hue and color saturation is difficult in RGB space, but trivial in HSV space.

        Color is not the only multispectral information that can be used for segmentation. It is possible to take advantage of multispectral segmentation even if the original dataset has only one component. Additional images can be created from spatial information of the images using spatial filters. These multiple images can then be combined into one multicomponent image, then multicomponent segmentation can proceed.

        Typically, the number of free parameters in a filter is directly correlated to the dimensionality of the pixels; and although additional parameters make a filter more powerful, it also makes it more difficult to find an appropriate set of parameter values. There are supervised and unsupervised algorithms that can be used to automatically select the best set of segmentation parameters, but discussion of these is outside the scope of this book.

        "},{"location":"VTKBook/10Chapter10/#104-putting-it-all-together","title":"10.4 Putting It All Together","text":"

        We suggest that you review the code accompanying the images in this chapter to see how to use the VTK imaging pipeline. In this section we will explain some of the implementation details of image data. We will also show how to mix the imaging and visualization pipelines, and how to use imaging filters to perform regression testing.

        "},{"location":"VTKBook/10Chapter10/#data-representation","title":"Data Representation","text":"

        In the imaging pipeline, the class for representing and manipulating data is vtkImageData (\"Types of Datasets\" in Chapter 5 for more information). In addition, the data extent (topological extent specification) plays a vital role in controlling how images are processed.

        vtkImageData actually represents the image data. Internally, it refers to an instance of vtkDataArray. Therefore, its native representation data type may be any one of unsigned char, char, unsigned short, short, int, float, or any concrete type of vtkDataArray. Please remember that vtkImageData can represent 1D, 2D (image), and 3D (volume) data.

        There are three types of data extents in the imaging pipeline. In general, any rectangular piece of image data can be described by the extent six-vector (imin,imax, jmin,jmax, kmin,kmax). The WholeExtent refers to the original data size of an image and is derived from the image dimensions. The UpdateExtent is the extent that is processed by a particular filter during execution.

        Extents are used to manage the streaming of data through the visualization pipeline, as well as to coordinate the multi-threaded parallel processing that the imaging pipeline uses throughout. By controlling the extents, it is possible to greatly reduce the amount of memory used by the pipeline. For more information, see The VTK User's Guide sold by Kitware.

        In the VTK imaging pipeline, point attribute data is represented differently than in the visualization pipeline. In the imaging pipeline point attribute data is represented as n components per data point. Typically n is one for gray-scale data, or three for color data but, in general, can be any positive number.

        "},{"location":"VTKBook/10Chapter10/#create-an-image","title":"Create an Image","text":"

        This example demonstrates how to directly create an image using C++ code. Typically, you will use an image reader or procedurally create an image from a source object. The example shown here creates an vtkImageData and then fills it with an image of interfering sinusoidal grids

        \\begin{equation*} F(x, y) = \\sin\\left(\\frac{x}{10}\\right) + \\sin\\left(\\frac{y}{10}\\right) \\end{equation*} \\bf\\tag{10-3}
        Image Processing\n         int x, y;\n vtkImageData *image;\nimage = vtkImageData::New(); image->SetDimensions(256, 256, 1); image->SetScalarTypeToFloat(); image->AllocateScalars();\nfloat *ptr = static_cast<float*>(image->GetScalarPointer());\nfor (y = 0; y < 256; ++y) {\nfor (x = 0; x < 256; ++x) {\n*ptr++ = 10.0 * sin(0.1 * x) * sin(0.1 * y);\n} }\nvtkImageViewer *viewer = vtkImageViewer::New(); viewer->SetInput(image); viewer->SetColorWindow(20.0); viewer->SetColorLevel(0.0);\nviewer->Render();\n
        Figure 10-15. Creating an image of two interfering sinusoidal gratings in an image dataset. The resulting image has dimensions 256^2.

        Note that direct pointer access is used to fill the image. The AllocateScalars() method allocates enough memory for the dimensions provided.

        "},{"location":"VTKBook/10Chapter10/#gradient-magnitude","title":"Gradient Magnitude","text":"

        In this example we demonstrate a lengthy imaging pipeline. The basic purpose of the pipeline is to visualize information about the image gradient. The gradient direction and magnitude are mapped into the hue and saturation components of the color HSV space, respectively. The pipeline, resulting image, and a portion of the code are shown in Figure 10-16.

        The pipeline demonstrates some interesting tricks. The first three filters read CT data of the human head (i.e., using vtkImageReader), magnify the image by a factor of four (vtkImageMagnify), and then smooth the data (since magnification uses linear interpolation, introducing some sharp edges). The next filter actually computes the 2D gradient (vtkImageGradient), placing the x-y gradient components into its output.

        The next series of filters is where the fun begins. First, the data is converted to polar coordinates (vtkImageEuclideanToPolar). We use this filter because we want to operate in color HSV space (see \"Color\" in Chapter 3). The image magnitude is to be mapped into saturation value, while the gradient direction is mapped into hue value (remember hue is represented as an angle on the HSV color wheel). The filter vtkImageConstantPad is used to add a third component to the data, since the gradient filter only generated two components, and we need three components to represent color. The vtkImageExtractComponents is used to rearrange the components into HSV order. Finally, the data is converted back into RGB color space with vtkImageHSVToRGB. (This is necessary because the image viewer expects RGB values.)

        "},{"location":"VTKBook/10Chapter10/#image-warping","title":"Image Warping","text":"

        In this example we combine the imaging and visualization pipelines. Imaging filters are used to read in an image (vtkBMPReader) and then convert it to grayscale (vtkImageLuminance). The data, which is a image data dataset, is then passed down the visualization pipeline as polygons using vtkImageDataGeometryFilter. Next we warp the data in the direction perpendicular to the image plane using the visualization filter vtkWarpScalar. The vtkMergeFilter is used to combine the warped geometry (now vtkPolyData) with the original image data from the reader. (Note that in this example the vtkMergeFilter takes two inputs.) The pipeline, example output, and sample code are shown in Figure 10-17."},{"location":"VTKBook/10Chapter10/#regression-testing","title":"Regression Testing","text":"

        In our work with VTK, we often need to perform software testing. The testing may be necessary because we have added new classes or features to the system, modified old code, or are simply testing a graphics library or new piece of hardware. We use a powerful testing procedure based on processing the output of the system, which is typically an image. We refer to the testing process as regression testing.

        Regression testing is based on the following procedure. A test program (typically a Tcl/Tk script) is written that exercises a portion of the code. In our example, we will assume that we are testing a feature of implicit modelling. The output of the script is an image with a fixed view, as shown in Figure 10-18(a). To perform the test, we compare the output of the test program with a previously stored image, or \"valid\" image (Figure 10-18(b)). The valid image was generated when we initially created the object or objects to be tested, and is assumed to be the correct output. Then, we use a the filter vtkImageDifference to compare the test image with the valid image. This filter takes into account dithering and anti-aliasing effects, and creates an output image representing the difference between the test image and valid image (Figure 10-18(c)). It also reports the difference in the images in terms of a pixel count. To determine whether the test is passed, we compare the pixel count with a threshold value (for example, 10 pixels).

        Our regression testing procedure cannot test the original implementation of an object or objects. The developer must verify that the valid image is indeed correct. However, the process is invaluable for finding and correcting problems due to incremental code changes (e.g., bug fixes, enhancements, etc.) Furthermore, the test can be run as a batch process, with a simple pass/fail output, and an image to show the differences.

        Figure 10-16. An imaging pipeline to visualize gradient information. The gradient direction is mapped into color hue value while the gradient magnitude is mapped into the color saturation. See ImageGradient.cxx and ImageGradient.py. Figure 10-17. Combining the imaging and visualization pipelines to deform an image in the z-direction. The vtkMergeFilter is used to combine the warped surface with the original color data. See ImageWarp.cxx and ImageWarp.py. Figure 10-18. Software regression testing using image processing. A test image is taken from the renderer and compared with a valid image stored on disk. (a) shows the valid image. (b) shows the test image (artificially modified by slight camera rotation). (c) shows the image difference. The code fragment above is extracted from the regression testing procedure."},{"location":"VTKBook/10Chapter10/#105-chapter-summary","title":"10.5 Chapter Summary","text":"

        Image processing can be used to improve 3D visualizations of structured point datasets (images and volumes). Important techniques include smoothing, filtering, morphological operators such as erosion and dilation, and segmentation.

        Because of the regular topology and geometry of images, it is possible to design caching and streaming pipelines to reduce memory requirements. In the Visualization Toolkit, the imaging pipeline is integrated with the visualization pipeline. This capability enables the creation of applications that combine computer graphics, imaging, and visualization.

        "},{"location":"VTKBook/10Chapter10/#106-bibliographic-notes","title":"10.6 Bibliographic Notes","text":"

        Many books are available describing imaging algorithms. Several are listed below including [Gonzalez92] and [Russ95]. The texts [Pavlidis82] and [Wolberg90] are imaging books with somewhat of a computer graphics and/or visualization slant. The text [Robb95] is an outstanding reference for medical imaging and visualization.

        If image processing, segmentation, and/or registration are important to you, we highly recommend the Insight Segmentation and Registration Toolkit (ITK). Like VTK, ITK is open source and includes extensive documentation resources and examples. Visit www.itk.org for more information. Also, [Ibanez03] is a good reference.

        Technical references describing VTK's unique streaming visualization pipeline are available [Law99] [Martin01]. Using this approach, data sizes of approximately a petabyte in size have been processed.

        "},{"location":"VTKBook/10Chapter10/#107-references","title":"10.7 References","text":"

        [Ballard82] D. H. Ballard, C. M. Brown. Compute Vision. Prentice Hall, Inc., Englewood Cliffs, NJ, 1982.

        [Davies97] E. R. Davies. Machine Vision Theory Algorithms Practicalities 2d ed. Academic Press, San Diego, CA, 1997.

        [Gonzalez92] R. C. Gonzalez, R. E. Woods. Digital Imaging Processing. Addison-Wesley Publishing Co., Reading, MA, 1992.

        [Ibanez03] L. Ibanez, W. Schroeder, L. Ng, J. Cates. The ITK Software Guide. Kitware, Inc. ISBN 1-93093410-6.

        [Law99] C. Charles Law, K. M. Martin, W. J. Schroeder, J. E. Temkin. A Multi-Threaded Streaming Pipeline Architecture for Large Structured Data Sets. In Proceedings. of Visualization '99, IEEE, October 1999.

        [Martin01] K. M. Martin, B. Geveci, J. Ahrens, C. Law. Large Scale Data Visualization Using Parallel Data Streaming. IEEE Computer Graphics & Applications, July 2001.

        Figure 10-19. Sample image for segmentation exercise

        [Niblack86] W. Niblack. An Introduction to Digital Image Processing. Prentice Hall, Inc., London, 1986.

        [Pavlidis82] T. Pavlidis. Algorithms for Graphics and Image Processing. Computer Science Press, Rockville, MD, 1982.

        [Robb95] R. Robb. Three-Dimensional Biomedical Imaging Principles and Practice. VCH Publishers, New York, NY, 1995.

        [Russ95] J. C. Russ. The Image Processing Handbook 2d ed. CRC Press, Inc, Boca Raton, FL, 1995.

        [Wolberg90] G. Wolberg. Digital Image Warping. IEEE Computer Society Press, Los Alamitos, CA, 1990.

        "},{"location":"VTKBook/10Chapter10/#108-exercises","title":"10.8 Exercises","text":"

        10.1 Create an image pipeline that will segment the area with vertical lines in Figure 10-19.

        10.2 Decomposition can increase the speed of an operation.

        a) Prove that 3D Gaussian smoothing can be decomposed into three 1D operations.

        b) Determine the complexity of the decomposed filter and the same filter implemented as a 3D convolution.

        c) Under what conditions can constant smoothing be decomposed into 1D operations?10.3 Create an image pipeline that shows the spectrum of a Gaussian image. What effect does increasing or decreasing the standard deviation have on the spectrum?

        "},{"location":"VTKBook/11Chapter11/","title":"Chapter 11 - Visualization on the Web","text":"

        The early 1990s established the widespread use and accessibility of the World Wide Web. Once a network used primarily by researchers and universities, the Web has become something that is used by people throughout the world. The effects of this transformation have been significant, ranging from personal home pages with static images and text, to professional Web pages embedding animation and virtual reality. This chapter discusses some of those changes and describes how the World Wide Web can be used to make visualization more accessible, interactive, and powerful. Topics covered include the advantages and disadvantages of client-side versus server-side visualization, VRML, and Java3D, interwoven with demonstration examples.

        "},{"location":"VTKBook/11Chapter11/#111-motivation","title":"11.1 Motivation","text":"

        Before describing in detail how to perform visualization over the Web, it is important to understand what we expect to gain. Clearly people have been visualizing data prior to the invention of the Web, but what the Web adds is the ability for people throughout the world to share information quickly and efficiently. Like all successful communication systems, the Web enables people to interact and share information more efficiently compared to other methods. In many ways the Web shares the characteristic of computer visualization in its ability to communicate large amounts of data. For that reason, computer graphics and visualization are now vital parts of the Web, and are becoming widespread in their application.

        To demonstrate these concepts we provide a simple example that illustrates the usefulness of the Web, and leads us into our first important topic: client-side versus server-side visualization.

        One common problem for researchers has been how to share or publish results. Typically, this involved having one site perform the research, interact with the data, form conclusions, and then publish the results as a report. The report might include a few pictures and possibly even a short animation. Obtaining access to the report might be through a journal or conference. Subsequently, co-workers at other sites would read the report and respond via verbal communication or formal articles.

        While certainly a viable means of sharing information, there are two important shortcomings in such a scenario. First, the report does not allow another researcher to interact with the visualizations. They are static pictures or pre-recorded animations. There is no opportunity to look from a different angle or change the parameters of the visualization. Second, access to the report may be limited or untimely. For example, some journals require as much as two years to accept, review, and publish an article. This time delay is too long for many technology-driven fields such as medicine, computers, or business. Such delays in receiving information can result in fruitless research or a failed business.

        Using the Web this scenario changes significantly. It is now possible to create reports so that other researchers can interact directly with the data, including visualizing the results in an alternative form. The Web also provides the opportunity to publish results immediately so that anyone with Web access can view them. Additionally, results can be modified as your work progresses so that they are always up to date.

        Another motivation for visualization over the Web is collaboration. If a researcher is performing a visualization of a dataset at one site, there are a number of hurdles preventing someone at another site from doing the same. For starters, the data, which could be sizable, must be copied, or sent from one site to the other. Then the software being used must be available at both sites which may not even be possible depending on the hardware available. The popularity of cross-platform systems such as AVS, IBM's Data Explorer, and VTK have helped this situation, but even then the software and data reside at both locations. This is frequently referred to as client-side visualization because all steps of the visualization are performed at the collaboration (or client) sites. In contrast, server-side visualization occurs when all of the visualization is done at one centralized location called the server. The results of the server-side visualization are then sent to collaboration sites.

        The Web opens up the opportunity to perform mixed client/server visualization that has a number of benefits. First, let's consider the drawbacks to client-side only visualization. As mentioned in the preceding discussion, client-side visualization requires both the data and the software at the client. If the datasets are very large it may be impractical to transfer the data over the Web. Since the server doesn't know what the client is going to do with the data, all of the data must be sent. Additionally, the client may not have sufficient memory or performance to perform the visualization. The advantages of client-side visualization are that the user has complete control over the visualization and can interact with or modify it at will.

        With server-side visualization the most significant loss is in interaction. A server-side only visualization is much like publishing a report. The clients have very little control over the images and animations it produces. The advantage is that the results are easily viewed from any client without requiring special hardware or software. As we will see in the remaining sections, the advantage of using recently developed Web technology is that we can mix server-, and client-side visualization much more readily than before, providing the benefits of both.

        "},{"location":"VTKBook/11Chapter11/#112-early-web-visualization","title":"11.2 Early Web Visualization","text":"

        While the World Wide Web received most of its attention in the early 1990s, its foundations date back decades earlier to the Internet and ARPAnet. What made the 1990s so significant was the development of some standardized visual tools for exchanging information. The most common of these are the Web browsers such as Mosaic, Netscape Navigator, and Microsoft Internet Explorer. These browsers provide a unified interface supporting many data (or content) types. The first content type to gain wide acceptance was HyperText Markup Language or HTML. HTML provides a way to format text and images in a document that can be shared across the Web. HTML also includes the ability to provide active links in one document that point to other documents on the Web. This helps to solve the problem of sharing results but it still limits the user to static images.

        This problem was quickly solved as Web browsers started to support other content types including animation formats such as MPEG, AVI, and QuickTime. Now a link in a HTML document can load an animation sequence for the user to view and interact with. The next step was to allow the client to control the generation of the animation sequence on the server. To facilitate this process, a mechanism for the client to send general information to the server was introduced. The Common Gateway Interface (CGI) along with HTML forms serves this purpose. In this two-pronged approach, an HTML form collects information from the client, passes it to the server that executes a CGI-BIN script, and then finally produces a result for the client to view.

        Figure 11-1. MPEG visualization example.

        For example, consider a situation where you would like to perform an isosurface extraction from volume data and then generate a short animation rotating the camera around the isosurface. There are a number of ways to generate such an animation and create an MPEG file, which can then be linked into an HTML document. Figure 11-1 shows one example generated from the following HTML code:

        <HEAD><TITLE>Sample MPEG Animation Page</TITLE></HEAD>\n\nIn this page we show an MPEG animation of a visualization of the visible woman dataset. The MPEG is stored in a file tissue.mpg. We also have taken one frame from the animation and stored it as a static JPEG image tissue.jpg. We display the JPEG image so that someone visiting the site will have an idea of what the mpeg animation will contain.\n\n<br>\n<A HREF=\"issue.mpg\"><IMG SRC=\"tissue.jpg\"> <br>Click here for an MPEG Animation</A>\n

        The title and text description are followed by <A HREF=\"tissue.mpg\"> which associates the MPEG file, tissue.mpg, with whatever comes between the first <A> and the closing </A>. In this example there is a JPEG image and a line of text. Clicking on either of these will play the MPEG animation. Now let's use CGI and an HTML form to enable the client to change the isosurface value. The first step is to obtain the desired isosurface value from the client using an HTML form such as Figure 11-2. The form was generated by the following HTML code: Figure 11-2. Example HTML form.

        <HEAD><TITLE>Sample MPEG Animation Page</TITLE></HEAD>\n<FORM METHOD=\"POST\" ACTION=\"/cgi-bin/makempg.csh\">\n\nIn this page we show the use of HTML forms to allow the client (or viewer) to send information to the server. In this example the user can select to show the bones, make them transparent and select the isosurface value to use. These parameters then get passed to the CGI-BIN script _makempg.csh_\n\n<P>Bone Isosurface:\n  <SELECT NAME=iso>\n    <OPTION SELECTED>Off\n    <OPTION>On\n    <OPTION>Transparent\n  </SELECT><BR>\n  Isosurface Value:\n  <SELECT NAME=isoval>\n    <OPTION>1400\n    <OPTION>1200\n    <OPTION SELECTED>1100 <OPTION>1000 <OPTION>900\n   </SELECT><BR>\n<P><INPUT TYPE=\"submit\"\nVALUE=\"Generate an MPEG Animation\"></FORM></P>\n

        The FORM keyword starts the definition of the HTML form. The ACTION keyword indicates what should happen when the form is submitted. In this example the server will run a CGI-BIN script called makempg.csh when a client submits this form. Next the two pull-down menus are declared with the SELECT keyword. The NAME keyword sets up an association between a string name and the value for this menu. This will be used by the script makempg.csh to access the values from the form. The OPTION and SELECTED keywords provide a mechanism to specify the values for the menu and what value the default should be. Finally, the last two lines create the button that will submit the form when pressed.

        Once the client has submitted the form, the server will execute the CGI-BIN script and pass it the arguments from the form. The script will then generate a new MPEG animation based on the client's request and return it to the client.

        While these examples demonstrate a closed loop of interaction between the client and server, there are two remaining problems. First, this approach places the entire computational load on the server. While this may be viable for some applications, some servers literally receive millions of client requests a day, severely straining server resources. Second, while the process is interactive, the lag time between making a change and seeing the result can be considerable, depending on the length of the animation and the communication bandwidth. Better solutions are now available to improve interactivity.

        Figure 11-3. A simple scene graph."},{"location":"VTKBook/11Chapter11/#113-virtual-reality-modeling-language-vrml","title":"11.3 Virtual Reality Modeling Language (VRML)","text":"

        HTML is a powerful tool for creating hypertext documents; however, it does not directly support 3D content. This limitation can be severe if we are interested in exploring 3D data, and do not know exactly what we wish to see, or what we wish to present to a user. As a result, an important development has been to create 3D worlds that the user can freely navigate. One application of this technology is Web content that allows customers to preview a hotel, resort, or vacation area by moving through a model representing the site. Such an application allows customers to preview a prospective business and directly experience what is available without relying on preconstructed views of the site.

        As a result of this need for greater interactivity, a new content type appeared referred to as the Virtual Reality Modeling Language (VRML). The idea behind VRML was to create a standard definition for transmitting 3D content over the Web. Having its origins in an early system called Labyrinth, which is in turn based on Reality Lab from Rendermorphics, it quickly evolved to the VRML 1.0 specification based on Open Inventor from Silicon Graphics.

        A VRML 1.0 file (typically with a .wrl extension, abbreviated from world) contains a scene graph representation of a 3D world (e.g., a scene). Consider Figure 11-3 which shows a simple scene. It is a directed graph that is traversed depth first from top to bottom with the content of the graph in its nodes (the circles). In this figure the top node is a group node that collects child nodes together. The light is a directional light node and the second group node represents an isosurface. The isosurface group node is represented by three children nodes: one to control the material properties, a general transformation, and finally the 3D geometry. VRML and Open Inventor support Geometry (e.g., isosurface) many different types of nodes including some support for animation. (See also \"Alternative Visual Programming Models\" in Chapter 4 for more information.)

        The basic idea behind VRML 1.0 is that the 3D content can be downloaded from the server and then interacted with the client. There are many Web browsers that support VRML and most take advantage of client-side graphics hardware if available. This helps address both the server-load problem and the interaction lag time associated with the earlier approach of server-generated MPEG animations. Like HTML, VRML supports active links so that navigating through a door in one VRML world can send you to new VRML (or HTML) sites.

        To address many of the limitations in VRML 1.0, significant changes were made resulting in the VRML 2.0 standard. Where VRML 1.0 was primarily a static scene description with some very limited behaviors, VRML 2.0 adds audio, video, and integration with Web scripting languages and more. It is still essentially a data file, but with the capabilities of simulating much more realistic and immersive environments. Many visualization systems, including VTK, support exporting scenes as VRML files. Consider the following example:

        vtkRenderer ren1\nvtkRenderWindow renWin\n  renWin AddRenderer ren1\n\n# create pipeline\n#\nvtkPLOT3DReader pl3d\n  pl3d SetXYZFileName \"$VTK_DATA_ROOT/Data/combxyz.bin\"\n  pl3d SetQFileName \"$VTK_DATA_ROOT/Data/combq.bin\"\n  pl3d SetScalarFunctionNumber 100\n  pl3d SetVectorFunctionNumber 202\nvtkContourFilter iso\n  iso SetInputConnection [pl3d GetOutputPort]\n  iso SetValue 0 .38\nvtkPolyDataNormals normals\n  normals SetInputConnection [iso GetOutputPort]\n  normals SetFeatureAngle 45\nvtkPolyDataMapper isoMapper\n  isoMapper SetInputConnection [normals GetOutputPort]\n   isoMapper ScalarVisibilityOff\nvtkActor isoActor\n  isoActor SetMapper isoMapper\n  eval [isoActor GetProperty] SetColor 0.3 0.4 0.5\n\nvtkStructuredGridOutlineFilter outline\n  outline SetInputConnection [pl3d GetOutputPort]\nvtkPolyDataMapper outlineMapper\n  outlineMapper SetInputConnection [outline GetOutputPort]\nvtkActor outlineActor\n  outlineActor SetMapper outlineMapper\n\n# Add the actors to the renderer, set the background and size #\nren1 AddActor outlineActor ren1 AddActor isoActor\nrenWin SetSize 500 500\nren1 SetBackground 0.1 0.2 0.4\n

        This is a typical program within VTK that extracts an isosurface and bounding outline from a structured grid dataset. To export this result to a VRML data file we can use the vtkVRMLExporter as shown below:

        vtkVRMLExporter exp\n  exp SetRenderWindow renWin\n  exp SetFileName Combustor.wrl\n  exp Write\n

        These four lines create an instance of vtkVRMLExporter, set its input to renWin (an instance of vtkRenderWindow), set a file name, and finally write out the result. This is different from previous examples where data was written out using vtkPolyDataWriter or other subclasses of vtkWriter. vtkVRMLExporter is a subclass of vtkExporter, not vtkWriter. The significant difference is that a writer takes a vtkDataSet as input and is responsible for writing out a single dataset. An exporter takes a vtkRenderWindow as input and is responsible for writing out an entire scene, possibly containing multiple actors, lights, textures, and material properties, in addition to any datasets.

        If you consider a continuum from a static data file to a fully interactive visualization program, vtkWriter would be at one end, vtkExporter in the middle, and a VTK program at the other. VRML 1.0 would fall at the same place as vtkExporter and VRML 2.0 would fall between vtkExporter and an actual program due to its added support for behavior and script interaction. What VRML lacks from a visualization perspective is algorithms. VRML is a 3D multimedia content format and lacks direct support for applying visualization techniques or algorithms.

        "},{"location":"VTKBook/11Chapter11/#114-a-vrml-visualization-server","title":"11.4 A VRML Visualization Server","text":"

        We can improve on the earlier MPEG visualization server example by creating a VRML visualization server. The primary limitations of the MPEG approach were that the processing burden was on the server, and the client-side interaction was limited to requesting that a different MPEG animation be generated. In our improved example, the basic idea is the same as before. That is, we use a HTML form to define parameters for a visualization, which then spawns off a CGI-BIN script. The difference is that in this example the server will generate a VRML data file that is returned to the client. The client can then control the viewpoint and rendering of the VRML result. The data and visualization software still reside on the server, so the client is only required to have a VRML compatible Web browser.

        The HTML form is essentially the same as the one used to generate Figure 11-2. What changes is that the CGI-BIN script now needs to produce a VRML file instead of an MPEG. So instead of the form invoking makempg.csh, it will invoke a C++ executable named VRMLServer. This executable will parse the inputs from the form and then write out a VRML file to its standard output. The first part of the program parses the arguments from the form. The server passes these arguments as a single string to the program's standard input. At the same time an environment variable named CONTENT_LENGTH is set to the length of this input. In this example there are two values passed from the form: iso and isoval. According to convention they are separated by a \"&\" when passed to the CGI-BIN script. The following C++ code extracts these values from the input string and performs some quick error checking.

        // first get the form data\nenv = getenv(\"CONTENT_LENGTH\");\nif (!env) return -1;\nint inputLength = atoi(env);\n// a quick sanity check on the input\nif ((inputLength > 40)||(inputLength < 17)) return -1;\ncin >> arg1;\n\nif (strncmp(arg1,\"isoval=\",7) == 0)\n  {\n  isoval = atof(arg1 + 7);\n  strcpy(isoType,arg1 + 11);\n  }\nelse\n  {\n  isoval = atof(arg1 + inputLength - 4);\n  strncpy(isoType,arg1 + 4,inputLength - 16);\n  isoType[inputLength - 16] = '\\0';\n  }\n

        This code is specific to the parameters in this example, but generic argument extraction routines such as cgic (see http://www.boutell.com/cgic/) can be used. Once the form data has been obtained, it can be used to set up the visualization pipeline as usual. In the following code, an isosurface is added to the renderer based on the isoType input from the form. Likewise if isoType is set to \"Transparent\" then that actor's opacity is set to 0.5.

        // should we do the isosurface\nif (strcmp(isoType,\"Off\"))\n  {\n  ren1->AddActor( isoActor );\n  }\nif (strcmp(isoType,\"Transparent\") == 0)\n  {\n  isoActor->GetProperty()->SetOpacity( 0.5 );\n  }\n

        Once the pipeline is set up, the last step is to generate the proper headers and VRML output. The header is the keyword Content-type: followed by the keyword x-world/x-vrml that is the specification for VRML content. This is often followed by a pragma indicating that the client browser should not cache the data, typically because of the memory it would consume.

        // Send out vrml header stuff\nfprintf(stdout,\"Content-type: x-world/x-vrml\\n\");\n fprintf(stdout,\"Pragma: no-cache\\n\\n\");\n// write out VRML 2.0 file\nvtkVRMLExporter *writer = vtkVRMLExporter::New();\n  writer->SetInput( renWin );\n  writer->SetFilePointer( stdout );\n  writer->Write();\n

        Finally an instance of vtkVRMLExporter is created, assigned an instance of vtkRenderWindow as input, and set to write to standard output. When the Write() method is applied, the exporter updates the visualization pipeline and produces the VRML output. The vtkRenderWindow is never rendered and no windows appear on the server. There is no need for an interactor because the interaction will be handled by the client's VRML browser. This program simply reads in a string of input (the parameters from the form) and then produces a string of output (the VRML data). It is also important to remember that CGI-BIN scripts are typically run from a different user id and environment than your own; file names and paths should be fully specified.

        "},{"location":"VTKBook/11Chapter11/#115-visualization-with-java","title":"11.5 Visualization with Java","text":"

        The examples discussed so far have addressed Web-based visualization in a number of ways. We have seen how to present preconstructed content such as images and animations using HTML, as well as creating interactive worlds with VRML. Each technique has its benefits but lacks the flexibility found in a custom-developed program. This is where Java stands out. Java's origins trace back to an embedded control language for small appliances and personal digital assistants. As such it was designed to work on a wide variety of hardware without recompilation and with high reliability. These same qualities are valuable to Web programming where a single program must run on many different machines without fail.

        Since Java is a full programming language, any visualization application written in Java will run on any Java-compliant system. In addition, Java provides the flexibility to perform the visualization on the server, on the client, or even a mixture of both. A number of early Java programs (a.k.a., applets) have emerged that render simple geometry or play back image sequences. Unfortunately Java provides no direct support for using accelerated 3D hardware and this limits the types of visualizations that can be done.

        There are two common approaches to utilizing graphics hardware from Java. The first approach is to access an existing toolkits capabilities from within Java. Fortunately, the Visualization Toolkit has been interfaced with Java so that it can be used from Java in a manner similar to its use in Tcl/Tk. The second is to use Java3D which is a native 3D extension to Java that supports hardware rendering and a rich scene graph based API.

        While Java is a portable byte-compiled language, its designers realized it was important to have a mechanism for developers to make calls to C or C++ routines. This mechanism is called the Java Native Interface, or JNI for short. The JNI provides a clean, well-defined way for native code such as C and C++ to work with Java. This allows a visualization system such as VTK to be used, which in turn provides a mechanism to access 3D graphics hardware (if available). Native code also allows performance critical functions to be handled in optimized C or C++ code instead of Java.

        The downside to using Java3D or native code is that it sacrifices Java's portability somewhat. Where a pure Java program can be byte-compiled and run on any machine that supports Java, a program that relies on Java3D or native code requires that the compiled Java3D or native code support be installed on the client. For each type of machine you want to support, you will need a compiled version of the native code. For a toolkit like VTK this means that the client would have to download the native VTK support (e.g., an object library) before being able to run VTK-Java applications. Once that is done, most applications described in this book can be made into a Web-based visualization. Depending on the needs of the application, the data can be left on the server and the results sent to the client, or the data could be sent to the client for both processing and viewing.

        The following example outlines how to use Java and VTK to display vibrational modes of a rectangular plate. In the preceding examples an HTML form was used to obtain input from the client. With Java we can construct a customized client-side user interface to obtain the required information.

        The first step in this example creates the HTML code that in turn launches the Java applet.

        <title>Vibrational Modes of a Rectangular Plate</title>\n  <h2>Vibrational Modes of a Rectangular Plate</h2>\n\nThis Java applet downloads a VTK data file into a Java String. It then uses the InputString method of the VTK data reader to use this string as its data. Then it creates a filter pipeline that takes the original geometry and warps it according to the vector data. There are four sets of vector data in this example. They correspond to the first, second, fourth and eighth vibrational modes. The geometry is color based on the amount of displacement.\n\n``` html\n<hr>\n<applet code=App2.class width=400 height=500>\n<param name=model value=plate.vtk>\n</applet>\n<hr>\n

        The key lines are near the end where the applet keyword is used to start the App2 Java applet with a default window size of 400 by 500. Parameters are passed to the applet using the param keyword followed by key-value pairs. When the client encounters the applet keyword, it then requests that Java applet from the server and starts executing it. We will consider the Java code in App2 from a visualization perspective. A more complete introduction to Java programming can be found in numerous books (see \"Bibliographic Notes\" in his Chapter).

        The applet will have a standard structure starting by importing other classes that this application will use.

        import vtk.*;\nimport java.awt.*;\nimport java.applet.*;\netc...\n

        Next comes the class definition for App2. As with most Java applets, this class extends the Applet class. It has a number of instance variables including many VTK objects that will be used to set up the visualization pipeline.

        public class App2 extends Applet\n  {\n  [vtkPolyDataReader](https://www.vtk.org/doc/nightly/html/classvtkPolyDataReader.html#details) pr = null;\n  [vtkWarpVector](https://www.vtk.org/doc/nightly/html/classvtkWarpVector.html#details) warp = null;\n  [vtkGeometryFilter](https://www.vtk.org/doc/nightly/html/classvtkGeometryFilter.html#details) ds2poly = null;\n  [vtkCleanPolyData](https://www.vtk.org/doc/nightly/html/classvtkCleanPolyData.html#details) clean = null;\n  [vtkPolyDataNormals](https://www.vtk.org/doc/nightly/html/classvtkPolyDataNormals.html#details) normals = null;\n  [vtkVectorDot](https://www.vtk.org/doc/nightly/html/classvtkVectorDot.html#details) color = null;\n  [vtkDataSetMapper](https://www.vtk.org/doc/nightly/html/classvtkDataSetMapper.html#details) plateMapper = null;\n  vtkPanel panel = null;\n  etc...\n

        The init() method handles applet initialization. This is where parameters from the HTML page will be processed and the visualization pipeline and user interface will be set up. To place the rendering window within the user interface, we use the vtkPanel class that is a subclass of the Java Canvas class. This way the rendering window can be treated as if it were just another piece of the user interface.

        public void init()\n  {\n  GridBagLayout grid = new GridBagLayout();\n\n  this.setLayout(grid);\n  panel = new vtkPanel();\n  panel.resize(400,400);\n  constrain(this,panel,0,0,8,8);\n

        Next, this method checks to see if the model parameter is set, and opens a stream connection to the server that is used to download the data file into a Java string. This is then passed to a vtkPolyDataReader at which point the data is now available to the native VTK code on the client. The rest of the pipeline is set up as usual with the exception that a Java syntax is used instead of C++ or Tcl. (Due to VTK's object-oriented design the variations from one language to another are minor.) At this point in the init() method the rest of the pipeline is set up along with some check boxes and event handlers for the user interface. The vtkPanel has a method that returns the RenderWindow that can then be acted on as usual. For example:

        panel.GetRenderer().AddActor(a);\n

        The resulting applet is shown in Figure 11-4.

        This demonstrates one of the advantages of using Java for Web visualization. VRML would require that the geometry of each vibrational mode be sent to the client for viewing. With Java and VTK the geometry can be sent once along with a set of scalar displacements for each vibrational mode. Then as the client switches between modes, the geometry can be modified quickly by the client without any additional network traffic. In fact the client could mix vibrational modes or perform an animation showing the vibration of the plate all without having to go back to the server, and without requiring much more data than a single VRML model of the plate. If the client decided to examine another geometry, say the vibrational modes of a disc, then it would likely return to the server for the new data. This is the flexibility that Java provides.

        Figure 11-4. Two images from a Java (JNI) applet."},{"location":"VTKBook/11Chapter11/#116-java3d","title":"11.6 Java3D","text":"

        Similar to a native code implementation (such as a VTK implementation) Java3D provides access to hardware accelerated 3D graphics. Java3D provides both scene graph rendering similar to VRML, and high-level immediate mode rendering. The immediate mode rendering support is not as complete as libraries like OpenGL or DirectX, but it does provide a good subset of its functionality. Java3D does share some of the limitations of native code implementations in that the client must have a version of Java3D for their operating system installed for it to work. There are also some limitations in how both Java3D and native interfaces interact with lightweight GUI components such as swing.

        To better understand the Java3D API, we'll walk through an example applet distributed with the original 1.0 specification. In this example, a colored cube is rendered as it rotates at a fixed rate.

        First, let's consider the definition of the cube. Some of the details have been left out for brevity. The complete description of the cube is stored in a Java class we'll call ColorCube. It contains two class variables (verts and colors) that store the vertex positions and RGB colors. It has an instance of the Shape3D class that will be used by Java3D and a method, getShape(), to access it.

        Finally, ColorCube has a constructor that creates a QuadArray, inserts the verts and colors into it, and assigns it to the Shape3D instance variable.

        public class ColorCube extends Object\n  {\n  private static final float[] verts =\n    {\n    // front face\n    1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f,\n    -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.\n...\n    // bottom face\n    -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f,\n    1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f,\n    };\n  private static final float[] colors =\n    { // front face (red)\n    1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n    1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n...\n    // bottom face (cyan)\n    0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n    0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n    };\n    private Shape3D shape;\n    public ColorCube() {\n      QuadArray cube = new QuadArray(24,\n                          QuadArray.COORDINATES | QuadArray.COLOR_3);\n      cube.setCoordinates(0, verts);\n      cube.setColors(0, colors);\n      shape = new Shape3D(cube, new Appearance());\n      }\n    public Shape3D getShape() {\n      return shape;\n      }\n  }\n

        Having defined the geometry, the entry point for a Java3D application is the applet. The HelloUniverse class extends the Applet class and provides the initialization code for this application. The constructor for this applet creates a Canvas3D object that is where the 3D information will be rendered. It then calls the createSceneGraph() method that performs the detailed setup of the scene graph including creating an instance of ColorCube. Then the constructor creates an instance of a UniverseBuilder given the Canvas3D and attaches the scene graph to the Universe. The UniverseBuilder is mostly boiler-plate code that handles setting up the view location (or platform) and attaching it to the Canvas3D.

        public class HelloUniverse extends Applet\n  {\n  public HelloUniverse()\n    {\n    setLayout(new BorderLayout());\n    Canvas3D c = new Canvas3D(graphicsConfig);\n    add(\"Center\", c);\n    // Create a simple scene and attach it to the virtual universe\n    BranchGroup scene = createSceneGraph();\n    UniverseBuilder u = new UniverseBuilder(c);\n    u.addBranchGraph(scene);\n    }\n}\n

        It is worth noting that in the createSceneGraph() method, the use of the previously defined ColorCube class and its insertion into the scene graph via the BranchGroup class. The setCapability() method is used to enable the cube's transform to be modified and underlies an important concept. To achieve the highest rendering rate, Java3D performs a number of optimizations on the scene graph. Many of these optimizations only work if certain properties of the nodes are guaranteed to not change. So by default most properties of a node are set to be \"read only.\" To modify them after creation requires the specific call shown below.

        public BranchGroup createSceneGraph()\n  {\n  // Create the root of the branch graph\n  BranchGroup objRoot = new BranchGroup();\n  // Create the transform group node and initialize it to the\n  // identity. Enable the TRANSFORM_WRITE capability so that\n  // our behavior code can\n  // root of the subgraph.\n  TransformGroup objTran = new TransformGroup;\n  objTran.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);\n   objRoot.addChild(objTran);\n  // Create a simple shape leaf node, add it to the scene graph.\n  objTran.addChild(new ColorCube().getShape());\n  // Create a new Behavior object that will perform the desired\n  // operation on the specified transform object and add it into\n  // the scene graph.\n  Transform3D yAxis = new Transform3D;\n  Alpha rotationAlpha = new Alpha (\n    -1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0);\n  RotationInterpolator rotator =\n  new RotationInterpolator(rotationAlpha, objTran, yAxis,\n      0.0f, (float) Math.PI*2.0f);\n  BoundingSphere bounds =\n    new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);\n  rotator.setSchedulingBounds(bounds); objTran.addChild(rotator);\n  objTran.addChild(rotator);\n  return objRoot;\n}\n\npublic void addBranchGraph(BranchGroup bg) {\n  locale.addBranchGraph(bg);\n   }\n
        "},{"location":"VTKBook/11Chapter11/#117-vrml-java-and-the-eai","title":"11.7 VRML, Java, and the EAI","text":"

        The External Authoring Interface (EAI) provides VRML with the same combination of power and flexibility that Java3D has. The EAI provides a communication interface that allows Java and VRML to interact with each other. This is particularly powerful in that a Java applet can create a VRML world, add and delete nodes from the scene graph, and a VRML scene graph can invoke Java code or Java Script in response to an event. In many ways this is similar to the Java3D solution with the exception that VRML is being used for the rendering instead of the Java3D rendering engine. Both solutions have the benefit of Java as a general purpose language for handling programmatic and user-interface issues.

        There are a number of ways to organize a visualization that uses the EAI. We will consider the most general method that starts with an HTML page that loads both a VRML world file and a Java applet in the traditional way. This example is loosely derived from work by David Brown. The Java applet starts by importing a number of classes including some VRML specific ones and then defining the instance variables that it will be using.

        import java.awt.*;\nimport java.applet.*;\nimport java.lang.*;\nimport vrml.external.field.*;\nimport vrml.external.Node;\nimport vrml.external.Browser;\nimport vrml.external.exception.*;\n\npublic class visApplet extends Applet\n    {\n    // The Browser\n    Browser browser = null;\n    // Various UI widgets\n    Button grow_button, shrink_button;\n\n    // Various stuff in the VRML scene we hang on to\n    Node root_node, sphere_node;\n    EventInSFVec3f setScale = null;\n    float currentScale = (float)1.0;\n

        Next, the applet defines the init() method that will request a reference to the browser, invoke initScene() to build the VRML interface, and create the user interface. In this case the user interface is just two buttons on a white background.

        /** Initialize the Applet */\npublic void init()\n  {\n  // Connect to the browser\n  browser = Browser.getBrowser(this);\n  if (browser == null) {\n    die(\"init: NULL browser!\");\n  }\n  System.out.println(\"Got the browser: \"+browser);\n\n  // Initialize some VRML stuff\n  initScene();\n\n  // Build a simple UI\n  grow_button = new Button(\"Grow Sphere\");\n   add(grow_button);\n  shrink_button = new Button(\"Shrink Sphere\");\n   add(shrink_button);\n  // Misc other UI setup\n  Color c = Color.white;\n  System.out.println(\"Setting bg color to: \" + c);\n   setBackground(c);\n}\n

        There is a simple error handling routine defined.

        /** Handle a fatal error condition */\npublic void die(String s)\n   {\n   System.out.println(\"visApplet: FATAL ERROR!\");\n   System.out.println(\"--> \" + s);\n   System.out.println(\"visApplet: Aborting...\\n\");\n}\n

        The initScene() method sets up the VRML scene and relies heavily on the EAI. For synchronization reasons, this method starts off by waiting a few seconds to assure that the VRML browser has time to initialize and read the VRML file specified by the HTML. Then it uses the browser.getNode(\"aName\") method to obtain nodes from the scene graph. These nodes must be named using the DEF keyword in the VRML file. The first node it gets is the SPHERE node that happens to be a VRML transform. It uses the getEventIn() method to obtain a handle to the scale instance variable of this transform which will be used later.

        /** Set up some stuff in the VRML scene */\n    public void initScene()\n      {\n      System.out.println(\"initScene()...\");\n\n     // wait a couple seconds\n     try {\n       Thread.currentThread().sleep(5000);\n       }\n     catch(InterruptedException e) {}\n     // Get the \"SPHERE\" node\n      try {\n       sphere_node = browser.getNode(\"SPHERE\");\n       }\n      catch(InvalidNodeException e) {\n        System.out.println(\"InvalidNodeException: \" + e);\n        die(\"initScene: SPHERE node not found!\");\n        return;\n        }\n      System.out.println(\"- Got the SPHERE node: \" + sphere_node);\n      try {\n        setScale = (EventInSFVec3f)\n        sphere_node.getEventIn(\"set_scale\");\n        }\n      catch (InvalidEventInException e) {\n        die(\"initScene: InvalidEventInException \" + e);\n        return;\n        }\n

        Then the same techniques are used to obtain the ROOT node of the scene graph. If you scan the VRML file that follows this example, you will see that the ROOT node is just an empty Group. After obtaining the node we request handles to its addChildren() and removeChildren() methods.

            // Get the \"ROOT\" node (a Group which we add to)\n    try {\n      root_node = browser.getNode(\"ROOT\");\n      }\n    catch(InvalidNodeException e) {\n      System.out.println(\"InvalidNodeException: \" + e);\n      die(\"initScene: ROOT node not found!\");\n    return;\n    }\n  System.out.println(\"- Got the ROOT node: \" + root_node);\n\n  // Get the ROOT node's add/removeChildren\n  EventIns EventInMFNode addChildren;\n  EventInMFNode removeChildren;\n  try {\n    addChildren = (EventInMFNode)\n    root_node.getEventIn(\"addChildren\");\n    removeChildren = (EventInMFNode)\n    root_node.getEventIn(\"removeChildren\");\n    }\n  catch (InvalidEventInException e) {\n    die(\"initScene: InvalidEventInException \" + e);\n    return;\n    }\n

        Using the EAI, VRML can be created from a Java string as shown in the following code. This allows us to create geometry on the fly and add it to the scene graph using the addChildren() handle obtained above. The handles support matching setValue() and getValue() methods that modify and interrogate the scene graph respectively.

        // Create the VRML for a purple sphere\nNode[] shape;\nString purple_sphere =\n  \"#VRML V2.0 utf8\\n\" +\n  \"Transform {\\n\" +\n  \"  children Shape {\\n\" +\n  \"     appearance Appearance {\\n\" +\n  \"       material Material {\\n\" +\n  \"         diffuseColor 0.8 0.2 0.8\\n\" +\n  \"     }\\n\" +\n  \"   }\\n\" +\n  \"   geometry Sphere {}\\n\" +\n  \" }\\n\n  \" translation 0 3 0\" +\n  \"}\\n\";\n  try {\n    shape = browser.createVrmlFromString(purple_sphere);\n    }\n  catch (InvalidVrmlException e) {\n    die(\"initScene: InvalidVrmlException: \" + e);\n    return;\n    }\n  // Add the sphere to the ROOT group\n  addChildren.setValue(shape);\n  System.out.println(\"initScene: done.\");\n  }\n

        The events for the two buttons are processed in the action() method. One increases the scale of the sphere and the other decreases it. This is done using the handle to the SPHERE node's scale that was obtained in the initScene() method, and invoking the setValue() method with the appropriate arguments.

        /** Handle actions from AWT widgets */\n    public boolean action(Event event, Object what)\n      {\n      if (event.target instanceof Button) {\n      Button b = (Button) event.target;\n      if (b == grow_button) {\n        currentScale = currentScale * (float)1.2;\n        float ascale[] = new float[3];\n        ascale[0] = currentScale;\n        ascale[1] = currentScale;\n        ascale[2] = currentScale;\n        setScale.setValue(ascale);\n        }\n      else if (b == shrink_button) {\n        currentScale = currentScale / (float)1.2;\n        float ascale[] = new float[3];\n        ascale[0] = currentScale;\n        ascale[1] = currentScale;\n        ascale[2] = currentScale;\n        setScale.setValue(ascale);\n        }\n      } // event.target instanceof Button\n      return true;\n}\n

        The last method in the applet draws a border around the two buttons when the applet needs to be repainted.

        /** Override paint() to get more control over how we're drawn */\n public void paint(Graphics g)\n   {\n   int w = size().width;\n   int h = size().height;\n\n   // Draw a simple border\n   g.drawRect(0, 0, w-1, h-1);\n   g.drawRect(1, 1, w-3, h-3);\n   super.paint(g);\n   }\n}\n

        An excerpt from the VRML file has been included below. Note the use of the DEF keyword to name nodes that can then be accessed from Java. The resulting Java/VRML example can be seen in Figure 11-5.

        Figure 11-5. Java and VRML combined using the EAI.
        #VRML V2.0 utf8\n#\nGroup {\n  children [\n    #\n    # Some objects\n    #\n    DEF ROOT Group {}\n    DEF SPHERE Transform {\n      childrenShape {\n        appearanceAppearance {\n          materialMaterial {\n            ambientIntensity 0.283774\n            diffuseColor 0.0846193 0.56383 0.0595097\n            specularColor 0.13092 0.87234 0.0920716\n            emissiveColor 0 0 0\n            shininess 0.2\n            transparency 0\n          }\n       }\n       geometrySphere {}\n     }\n     translation-4 0 0\n   }\n  ]\n}\n
        "},{"location":"VTKBook/11Chapter11/#118-the-future-of-web-visualization","title":"11.8 The Future of Web Visualization","text":"

        In the previous sections we provided an overview of some of the technologies important to applying visualization on the World Wide Web. Since Web-based technologies, computer graphics, and visualization are all rapidly growing fields, the likelihood of new development and change is high. However, we are confident that these technologies will remain important to the future. Eventually we expect 3D graphics and data visualization to become as pervasive as 2D graphical user interfaces and presentations are today. The main barriers to this development is the limited bandwidth of the Web, lack of familiarity (and difficulty of use) of 3D graphics and visualization, and limitations in computer hardware and software. We believe that technological advances will eventually minimize bandwidth and computer hardware limitations, while systems like VTK will make 3D graphics and visualizations easier to use.

        One of the benefits of systems like VTK is that they are driven by their algorithmic content. The systems we have seen earlier such as OpenGL, HTML, VRML and Java, are implementations of a system or information protocol. Algorithmic systems, on the other hand, implement mathematical, logical, and design relationships that change much more slowly than system implementations. As a result, systems like VTK will remain vital for years to come, although the underlying implementation language and interface may change. To track future changes to VTK visit our Web pages at http://www.vtk.org.

        "},{"location":"VTKBook/11Chapter11/#119-chapter-summary","title":"11.9 Chapter Summary","text":"

        Visualization over the Web opens up many forms of collaborative development, entertainment, and publishing that were previously restricted to a few individuals with access to custom software. There are many ways to perform visualization over the Web ranging from simple HTML pages with pictures, to complete Java-based applications. Deciding on the correct solution for Web visualization depends on three key factors: 1) the amount of interaction and control you want to provide to the user or client, 2) performance issues related to data size and client/server load balancing, 3) how much complexity you are willing to deal with. While the Java-based solutions can provide interaction, control, and load balancing, this involves added complexity. It may be that producing a static VRML file for your Web page is sufficient. Either way there are a host of tools available and more are on the way. The greatest challenge will likely be to create a future standard for the Web that includes not just 3D viewing but also visualization.

        "},{"location":"VTKBook/11Chapter11/#1110-bibliographic-notes","title":"11.10 Bibliographic Notes","text":"

        For a general introduction to HTML and CGI consider [Morris95] or [Graham95]. Both books provide a good introduction and include coverage for both UNIX and MS Windows-based systems. For more detailed coverage of CGI programming consider [Gundavaram96]. Mark Pesce [Pesce95] provides a n excellent introduction to VRML including its early genesis. [Ames96] is also a great VRML resource. The Inventor Mentor by Josie Wernecke [Wernecke94] is an excellent book for learning about Open Inventor and scene graphs. Java in a Nutshell [Flanagan96] is a good reference for Java and for someone who already knows how to program in another language For documentation on the Java Native Interface or Java3D, visit Sun's Web site at http://java.sun.com.

        "},{"location":"VTKBook/11Chapter11/#1111-references","title":"11.11 References","text":"

        [Ames96] A. Ames, D. Nadeau, and J. Moreland. The VRML Sourcebook. John Wiley & Sons, Inc., New York, NY, 1996.

        [Flanagan96] David Flanagan. Java in a Nutshell. O'Reilly & Associates, Inc., Sebastopol, CA, 1996.

        [Graham95] I. S. Graham. The HTML Sourcebook. John Wiley & Sons, Inc., New York, NY, 1995.

        [Gundavaram96] S. Gundavaram. CGI Programming on the World Wide Web. O'Reilly & Associates, Inc., Sebastopol, CA, 1996.

        [Morris95] M. E. S. Morris. HTML for Fun and Profit. SunSoft Press, Prentice Hall PTR, Englewood Cliffs, NJ, 1995.

        [Pesce95] M. Pesce. VRML - Browsing and Building Cyberspace. New Riders Publishing, Indianapolis, IN, 1995.

        [Wernecke94] J. Wernecke. The Inventor Mentor. Addison-Wesley, Reading MA,1994.

        "},{"location":"VTKBook/12Chapter12/","title":"Chapter 12 - Applications","text":"

        We have described the design and implementation of an extensive toolkit of visualization techniques. In this chapter we examine several case studies to show how to use these tools to gain insight into important application areas. These areas are medical imaging, financial visualization, modelling, computational fluid dynamics, finite element analysis, and algorithm visualization. For each case, we briefly describe the problem domain and what information we expect to obtain through visualization. Then we craft an approach to show the results. Many times we will extend the functionality of the Visualization Toolkit with application-specific tools. Finally, we present a sample program and show resulting images.

        The visualization design process we go through is similar in each case. First, we read or generate application-specific data and transform it into one of the data representation types in the Visualization Toolkit. Often this first step is the most difficult one because we have to write custom computer code, and decide what form of visualization data to use. In the next step, we choose visualizations for the relevant data within the application. Sometimes this means choosing or creating models corresponding to the physical structure. Examples include spheres for atoms, polygonal surfaces to model physical objects, or computational surfaces to model flow boundaries. Other times we generate more abstract models, such as isosurfaces or glyphs, corresponding to important application data. In the last step we combine the physical components with the abstract components to create a visualization that aids the user in understanding the data.

        "},{"location":"VTKBook/12Chapter12/#121-3d-medical-imaging","title":"12.1 3D Medical Imaging","text":"

        Radiology is a medical discipline that deals with images of human anatomy. These images come from a variety of medical imaging devices, including X-ray, X-ray Computed Tomography (CT), Magnetic Resonance Imaging (MRI), and ultrasound. Each imaging technique, called an imaging modality, has particular diagnostic strengths. The choice of modality is the job of the radiologist and the referring physician. For the most part, radiologists deal with two-dimensional images, but there are situations when three-dimensional models can assist the radiologist's diagnosis. Radiologists have special training to interpret the two dimensional images and understand the complex anatomical relationships in these two-dimensional representations. However, in dealing with referring physicians and surgeons, the radiologist sometimes has difficulty communicating these relationships. After all, a surgeon works in three-dimensions during the planning and execution of an operation; moreover, they are much more comfortable looking at and working with three-dimensional models.

        Figure 12-1. A CT slice through a human head.

        This case study deals with CT data. Computed tomography measures the attenuation of X-rays as they pass through the body. A CT image consists of levels of gray that vary from black (for air), to gray (for soft tissue), to white (for bone). Figure 12-1 shows a CT cross section through a head. This slice is taken perpendicular to the spine approximately through the middle of the ears. The gray boundary around the head clearly shows the ears and bridge of the nose. The dark regions on the interior of the slice are the nasal passages and ear canals. The bright areas are bone. This study contains 93 such slices, spaced 1.5 mm apart. Each slice has 256*^2 pixels spaced 0.8 mm apart with 12 bits of gray level.

        Our challenge is to take this gray scale data (over 12 megabytes) and convert it into information that will aid the surgeon. Fortunately, our visualization toolkit has just the right techniques. We will use isocontouring techniques to extract the skin and bone surfaces and display orthogonal cross-sections to put the isosurface in context. From experience we know that a density value of 500 will define the air/skin boundary, and a value of 1150 will define the soft tissue/bone boundary. In VTK terminology, medical imaging slice data is image data. Recall from Chapter 5 that for image data, the topology and geometry of the data is implicitly known, requiring only dimensions, an origin, and the data spacing.

        The steps we follow in this case study are common to many three-dimensional medical studies.

        1. Read the input.

        2. For each anatomical feature of interest, create an isosurface.

        3. Transform the models from patient space to world space.

        4. Render the models.

        This case study describes in detail how to read input data and extract anatomical features using iso-contouring. Orthogonal planes will be shown using a texture-based technique. Along the way we will also show you how to render the data. We finish with a brief discussion of medical data transformations. This complete source code for the examples shown in this section are available from Medical1.cxx, Medical2.cxx, and Medical3.cxx.

        Read the Input

        Medical images come in many flavors of file formats. This study is stored as flat files without header information. Each 16-bit pixel is stored with little-endian byte order. Also, as is often the case, each slice is stored in a separate file with the file suffix being the slice number of the form prefix.1, prefix.2 , and so on. Medical imaging files often have a header of a certain size before the image data starts. The size of the header varies from file format to file format. Finally, another complication is that sometimes one or more bits in each 16-bit pixel is used to mark connectivity between voxels. It is important to be able to mask out bits as they are read.

        VTK provides several image readers including one that can read raw formats of the type described above [vtkVolume16Reader](https://www.vtk.org/doc/nightly/html/classvtkVolume16Reader.html#details). To read this data we instantiate the class and set the appropriate instance variables as follows.

        vtkVolume16Reader *v16 = vtkVolume16Reader::New();\n  v16->SetDataDimensions (64,64); v16->SetImageRange (1,93);\n  v16->SetDataByteOrderToLittleEndian();\n  v16->SetFilePrefix (\"headsq/quarter\");\n  v16->SetDataSpacing (3.2, 3.2, 1.5);\n

        The FilePrefix and FilePattern instance variable work together to produce the name of files in a series of slices. The FilePattern which by default is %s.%d generates the filename to read by performing a C-language sprintf() of the FilePrefix and the current file number into the FilePattern format specifier.

        Create an Isosurface

        We can choose from three techniques for isosurface visualization: volume rendering, marching cubes, and dividing cubes. We assume that we want to interact with our data at the highest possible speed, so we will not use volume rendering. We prefer marching cubes if we have polygonal rendering hardware available, or if we need to move up close to or inside the extracted surfaces. Even with hardware assisted rendering, we may have to reduce the polygon count to get reasonable rendering speeds. Dividing cubes is appropriate for software rendering. For this application we'll use marching cubes.

        For medical volumes, marching cubes generates a large number of triangles. To be practical, we'll do this case study with a reduced resolution dataset. We took the original 256^2 data and reduced it to 64^2 slices by averaging neighboring pixels twice in the slice plane. We call the resulting dataset quarter since it has 1/4 the resolution of the original data. We adjust the DataSpacing for the reduced resolution dataset to 3.2 mm per pixel. Our first program will generate an isosurface for the skin.

        The flow in the program is similar to most VTK applications.

        1. Generate some data.

        2. Process it with filters.

        3. Create a mapper to generate rendering primitives.

        4. Create actors for all mappers.

        5. Render the results.

        The filter we have chosen to use is vtkMarchingCubes. We could also use vtkContourFilter since it will automatically create an instance of vtkMarchingCubes as it delegates to the fastest subclass for a particular dataset type. The class vtkPolyDataNormals is used to generate nice surface normals for the data. vtkMarchingCubes can also generate normals, but sometimes better results are achieved when the normals are directly from the surface (vtkPolyDataNormals ) versus from the data (vtkMarchingCubes ). To complete this example, we take the output from the isosurface generator vtkMarchingCubes and connect it to a mapper and actor via vtkPolyDataMapper and vtkActor. The C++ code follows.

        vtkContourFilter *skinExtractor = vtkContourFilter::New();\n  skinExtractor->SetInputConnection(v16->GetOutputPort());\n  skinExtractor->SetValue(0, 500);\n\nvtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();\n  skinNormals->SetInputConnection(skinExtractor->GetOutputPort());\n  skinNormals->SetFeatureAngle(60.0);\n\nvtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();\n  skinMapper->SetInputConnection(skinNormals->GetOutputPort());\n  skinMapper->ScalarVisibilityOff();\n\nvtkActor *skin = vtkActor::New();\n  skin->SetMapper(skinMapper);\n\nvtkOutlineFilter *outlineData = vtkOutlineFilter::New();\n  outlineData->SetInputConnection(v16->GetOutputPort());\nvtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();\n  mapOutline->SetInputConnection(outlineData->GetOutputPort());\n\nvtkActor *outline = vtkActor::New();\n  outline->SetMapper(mapOutline);\n  outline->GetProperty()->SetColor(0,0,0);\n\nvtkCamera *aCamera = vtkCamera::New();\n  aCamera->SetViewUp (0, 0, -1);\n  aCamera->SetPosition (0, 1, 0);\n  aCamera->SetFocalPoint (0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n\naRenderer->AddActor(outline);\naRenderer->AddActor(skin);\naRenderer->SetActiveCamera(aCamera);\naRenderer->ResetCamera ();\n\naCamera->Dolly(1.5);\n\naRenderer->SetBackground(1,1,1);\n\nrenWin->SetSize(640, 480);\n\naRenderer->ResetCameraClippingRange ();\n\n// Initialize the event loop and then start it.\niren->Initialize();\niren->Start();\n
        Figure 12-2. The skin extracted from a CT dataset of the head. See MedicalDemo1.cxx and MedicalDemo1.py.

        To provide context for the isosurface an outline is created around the data. An initial view is set up in a window size of 640 \\times 480 pixels. Since the dolly command moves the camera towards the data, the clipping planes are reset to insure that the isosurface is completely visible. Figure 12-2 shows the resulting image of the patient's skin.

        We can improve this visualization in a number of ways. First, we can choose a more appropriate color (and other surface properties) for the skin. We use the vtkProperty method SetDiffuseColor() to set the skin color to a fleshy tone. We also add a specular component to the skin surface. Next, we can add additional isosurfaces corresponding to various anatomical features. Here we choose to extract the bone surface by adding an additional pipeline segment. This consists of the filters vtkMarchingCubes, vtkPolyDataMapper, and vtkActor, just as we did with the skin. Finally, to improve rendering performance on our system, we create triangle strips from the output of the contouring process. This requires adding vtkStripper.

        Figure 12-3. Skin and bone isosurfaces. See MedicalDemo2.cxx and MedicalDemo2.py.

        Figure 12-3 shows the resulting image, and the following is the C++ code for the pipeline.

        vtkActor *skin = vtkActor::New();\n  skin->SetMapper(skinMapper);\n  skin->GetProperty()->SetDiffuseColor(1, .49, .25);\n  skin->GetProperty()->SetSpecular(.3);\n  skin->GetProperty()->SetSpecularPower(20);\n  skin->GetProperty()->SetOpacity(1.0);\n\nvtkContourFilter *boneExtractor = vtkContourFilter::New();\n  boneExtractor->SetInputConnection(v16->GetOutputPort());\n  boneExtractor->SetValue(0, 1150);\n\nvtkPolyDataNormals *boneNormals = vtkPolyDataNormals::New();\n  boneNormals->SetInputConnection(boneExtractor->GetOutputPort());\n  boneNormals->SetFeatureAngle(60.0);\n\nvtkStripper *boneStripper = vtkStripper::New();\n  boneStripper->SetInputConnection(boneNormals->GetOutputPort());\n\nvtkPolyDataMapper *boneMapper = vtkPolyDataMapper::New();\n  boneMapper->SetInputConnection(boneStripper->GetOutputPort());\n  boneMapper->ScalarVisibilityOff();\n\nvtkActor *bone = vtkActor::New(); bone->SetMapper(boneMapper);\n  bone->GetProperty()->SetDiffuseColor(1, 1, .9412);\n

        The Visualization Toolkit provides other useful techniques besides isocontouring for exploring volume data. One popular technique used in medical imaging is to view orthogonal slices, or planes, through the data. Because computer graphics hardware supports texture mapping, an approach using texture mapping gives the best result in terms or interactive performance.

        We will extract three orthogonal planes corresponding to the axial, sagittal, and coronal cross sections that are familiar to radiologists. The axial plane is perpendicular to the patient's neck, sagittal passes from left to right, and coronal passes from front to back. For illustrative purposes, we render each of these planes with a different color lookup table. For the sagittal plane, we use a gray scale. The coronal and axial planes vary the saturation and hue table, respectively. We combine this with a translucent rendering of the skin (we turn off the bone with the C++ statement bone->VisibilityOff() ). The following VTK code creates the three lookup tables that is used in the texture mapping process.

        vtkLookupTable *bwLut = vtkLookupTable::New();\n  bwLut->SetTableRange (0, 2000);\n  bwLut->SetSaturationRange (0, 0);\n  bwLut->SetHueRange (0, 0);\n  bwLut->SetValueRange (0, 1);\n\nvtkLookupTable *hueLut = vtkLookupTable::New();\n  hueLut->SetTableRange (0, 2000);\n  hueLut->SetHueRange (0, 1);\n  hueLut->SetSaturationRange (1, 1);\n  hueLut->SetValueRange (1, 1);\n\nvtkLookupTable *satLut = vtkLookupTable::New();\n  satLut->SetTableRange (0, 2000);\n  satLut->SetHueRange (.6, .6);\n  satLut->SetSaturationRange (0, 1);\n  satLut->SetValueRange (1, 1);\n
        Figure 12-4. Composite image of three planes and translucent skin. See MedicalDemo3.cxx and MedicalDemo3.py.

        The image data is mapped to colors using the filter vtkImageMapToColors in combination with the lookup tables created above. The actual display of the slice is performed with vtkImageActor (see \"Assemblies and Other Types of vtkProp\" in Chapter 3 for more information). This class conveniently combines a quadrilateral, polygon plane with a texture map. vtkImageActor requires image data of type unsigned char, which the class vtkImageMapToColors conveniently provides. To avoid copying the data and to specify the 2D texture to use, the DisplayExtent of each vtkImageActor is set appropriately. The C++ code is as follows:

        // saggital\nvtkImageMapToColors *saggitalColors = vtkImageMapToColors::New();\n  saggitalColors->SetInputConnection(v16->GetOutputPort());\n  saggitalColors->SetLookupTable(bwLut);\n\nvtkImageActor *saggital = vtkImageActor::New();\n  saggital->SetInputConnection(saggitalColors->GetOutputPort());\n  saggital->SetDisplayExtent(32,32, 0,63, 0,92);\n\n// axial\nvtkImageMapToColors *axialColors = vtkImageMapToColors::New();\n  axialColors->SetInputConnection(v16->GetOutputPort());\n  axialColors->SetLookupTable(hueLut);\n\nvtkImageActor *axial = vtkImageActor::New();\n  axial->SetInputConnection(axialColors->GetOutputPort());\n  axial->SetDisplayExtent(0,63, 0,63, 46,46);\n\n// coronal\nvtkImageMapToColors *coronalColors = vtkImageMapToColors::New();\n  coronalColors->SetInputConnection(v16->GetOutputPort());\n  coronalColors->SetLookupTable(satLut);\n\nvtkImageActor *coronal = vtkImageActor::New();\n  coronal->SetInputConnection(coronalColors->GetOutputPort());\n  coronal->SetDisplayExtent(0,63, 32,32, 0,92);\n\naRenderer->AddActor(outline);\naRenderer->AddActor(saggital);\naRenderer->AddActor(axial);\naRenderer->AddActor(coronal);\naRenderer->AddActor(bone);\naRenderer->AddActor(skin);\n

        Figure 12-4 shows the resulting composite image.

        In this example, the actor named skin is rendered last because we are using a translucent surface. Recall from \"Transparency and Alpha Values\" in Chapter 7 that we must order the polygons composing transparent surfaces for proper results. We render the skin last by adding it to aRenderer's actor list last.

        We need to make one last point about processing medical imaging data. Medical images can be acquired in a variety of orders that refer to the relationship of consecutive slices to the patient. Radiologists view an image as though they were looking at the patient's feet. This means that on the display, the patient's left appears on the right. For CT there are two standard orders: top to bottom or bottom to top. In a top to bottom acquisition, slice i is farther from the patient's feet than slice i - 1. Why do we worry about this order? It is imperative in medical applications that we retain the left / right relationship. Ignoring the slice acquisition order can result in a flipping of left and right. To correct this, we need to transform either the original dataset or the geometry we have extracted. (See \"Exercises\" in this Chapter for more information.) Also, you may wish to examine the implementation of the classes vtkVolume16Reader and vtkVolumeReader (the superclass of vtkVolume16Reader). These classes have special methods that deal with transforming image data.

        "},{"location":"VTKBook/12Chapter12/#122-creating-models-from-segmented-volume-data","title":"12.2 Creating Models from Segmented Volume Data","text":"

        The previous example described how to create models from gray-scale medical imaging data. The techniques for extracting bone and skin models is straightforward compared to the task of generating models of other soft tissue. The reason is that magnetic resonance and, to some extent, computed tomography, generates similar gray-scale values for different tissue types. For example, the liver and kidney in a medical computed tomography volume often have overlapping intensities. Likewise, many different tissues in the brain have overlapping intensities when viewed with magnetic resonance imaging. To deal with these problems researchers apply a process called segmentation to identify different tissues. These processes vary in sophistication from almost completely automatic methods to manual tracing of images. Segmentation continues to be a hot research area. Although the segmentation process itself is beyond the scope of this text, in this case study we show how to process segmented medical data.

        For our purposes we assume that someone (or many graduate students) have laboriously labeled each pixel in each slice of a volume of data with a tissue identifier. This identifier is an integer number that describes which tissue class each pixel belongs to. For example, we may be given a series of MRI slices of the knee with tissue numbers defining the meniscus, femur, muscles, and so forth. Figure 12-5 shows two representations of a slice from a volume acquired from a patient's knee. The image on the left is the original MRI slice; the image on the right contains tissue labels for a number of important organs. The bottom image is a composite of the two images. Figure 12-5. Magnetic Resonance Image of a knee(left); segmented tissue(right); composite (bottom).(Data and segmentation courtesy of Brigham and Women's Hospital Surgical Planning Lab.)

        Notice the difference in the information presented by each representation. The original slice shows gradual changes at organ borders, while the segmented slice has abrupt changes. The images we processed in the previous CT example used marching cubes isocontouring algorithm and an intensity threshold to extract the isosurfaces. The segmented study we present has integer labels that have a somewhat arbitrary numeric value. Our goal in this example is to somehow take the tissue labels and create grayscale slices that we can process with the same techniques we used previously. Another goal is to show how image processing and visualization can work together in an application.

        The Virtual Frog

        To demonstrate the processing of segmented data we will use a dataset derived from a frog. This data was prepared at Lawrence Berkeley National Laboratories and is included with their permission on the CD-ROM accompanying this book. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels. (To accommodate the volume readers we have in VTK, we processed the mask files and combined them all in one file for each slice.) We used integer numbers 1-15 to represent the 15 tissues. Figure 12-6 shows an original slice, a labeled slice, and a composite of the two representations. Figure 12-6. Photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow. See FrogSlice.py.

        Before we describe the process to go from binary labeled tissues to gray-scale data suitable for isosurface extraction, compare the two images of the frog's brain shown in Figure 12-7. On the left is a surface extracted using a binary labeling of the brain. The right image was created using the visualization pipeline that we will develop in this example.

        Developing a Strategy

        In the last example, we used C++ and created a program that was tailored to extract two surfaces: one of the skin and one of the bone. All the parameters for the surface extraction were hard-coded in the source. Since our frog has 15 different tissues; we seek a more general solution to this problem. We may have to experiment with a number of different parameters for a number of visualization and imaging filters. Our goal is to develop a general pipeline that will work not only our 15 tissues but on other medical datasets as well. We'll design the program to work with a set of user-specified parameters to control the elements of the pipeline. A reasonable description might look like:

        STUDY = 'frogTissue'\nSLICE_ORDER = 'hfsi'\nROWS = 470\nCOLUMNS = 500\nPIXEL_SIZE = 1\nSPACING = 1.5\n

        plus possibly many more parameters to control decimation, smoothing, and so forth. Working in C++, we would have to design the format of the file and write code to interpret the statements.

        We make the job easier here by using Python. Another decision is to separate the modelling from the rendering. However, in order to simplify things we will be using one Python script, FrogReconstruction.py.

        In the real world, our script would be modified to generate models in a \"batch\" mode. If this is done, we would run run one VTK Python script for each tissue. That script will create a .vtk output file containing the polygonal representation of each tissue. Later, we would render the models with a separate script.

        Overview of the Pipeline

        Figure 12-8 shows the design of the pipeline. This generic pipeline has been developed over the years in our laboratory and in the Brigham and Women's Hospital Surgical Planning Lab. We find that it produces reasonable models from segmented datasets. Do not be intimidated by the number of filters (twelve in all). Before we developed VTK, we did similar processing with a hodgepodge of programs all written with different interfaces. We used intermediate files to pass data from one filter to the next. The new pipeline, implemented in VTK, is more efficient in time and computing resources.

        We use the convention that user-specified variables are in capital letters. First we show the elements of the pipeline and subsequently show sample functions that extract 3D models of the frog's tissues.

        Figure 12-7. The frog's brain. Model extracted without smoothing (left) and with smoothing (right). See FrogBrain.py.

        Read the Segmented Volume Data

        We assume here that all the data to be processed was acquired with a constant center landmark. In VTK, the origin of the data applies to the lower left of an image volume. In this pipeline, we calculate the origin such that the x,y center of the volume will be (0,0). The DataSpacing describes the size of each pixel and the distance between slices. DataVOI selects a volume of interest (VOI). A VOI lets us select areas of interest, sometimes eliminating extraneous structures like the CT table bed. For the frog, we have written a small C program that reads the tissue label file and finds the volume of interest for each tissue.

        The SetTransform() method defines how to arrange the data in memory. Medical images can be acquired in a variety of orders. For example, in CT, the data can be gathered from top to bottom (superior to inferior), or bottom to top (inferior to superior). In addition, MRI data can be acquired from left to right, right to left, front-to-back (anterior to posterior) or back-to-front. This filter transforms triangle vertices such that the resulting models will all \"face\" the viewer with a view up of (0,-1,0), looking down the positive z axis. Also, proper left-right correspondence will be maintained. That means the patient's left will always be left on the generated models. Look in SliceOrder.tcl to see the permutations and rotations for each order.

        In the example, we have created a class called \\texttt{SliceOrder} which handles the permutations and rotations for each order.

        We will be using a [vtkMetaImageReader](https://www.vtk.org/doc/nightly/html/classvtkMetaImageReader.html#details)() instead of the [vtkPNMReader](https://www.vtk.org/doc/nightly/html/classvtkPNMReader.html#details)() since the data has been collected into metaa-image files. This means that we will apply the transform later in the pipeline.

        All the other parameters are self-explanatory.

        Figure 12-8. The segmented volume to triangle pipeline. Volume passes through image pipeline before isosurface extraction..
            reader = vtk.vtkMetaImageReader()\n    reader.SetFileName(str(fn))\n    reader.SetDataSpacing(data_spacing)\n    reader.SetDataOrigin(data_origin)\n    reader.SetDataExtent(voi)\n    reader.Update()\n

        Remove Islands

        Some segmentation techniques, especially those that are automatic, may generate islands of misclassified voxels. This filter looks for connected pixels with the ISLAND_REPLACE label, and if the number of connected pixels is less than ISLAND_AREA, it replaces them with the label TISSUE. Note that this filter is only executed if ISLAND_REPLACE is positive.

            last_connection = reader\n    if tissue['ISLAND_REPLACE'] >= 0:\n        island_remover = vtk.vtkImageIslandRemoval2D()\n        island_remover.SetAreaThreshold(tissue['ISLAND_AREA'])\n        island_remover.SetIslandValue(tissue['ISLAND_REPLACE'])\n        island_remover.SetReplaceValue(tissue['TISSUE'])\n        island_remover.SetInput(last_connection.GetOutput())\n        island_remover.Update()\n        last_connection = island_remover\n

        Select a Tissue

        The rest of the pipeline requires gray-scale data. To convert the volume that now contains integer tissue labels to a gray-scale volume containing only one tissue, we use the threshold filter to set all pixels with the value TISSUE (the tissue of choice for this pipeline) to 255 and all other pixels to 0. The choice of 255 is somewhat arbitrary.

            select_tissue = vtk.vtkImageThreshold()\n    select_tissue.ThresholdBetween(tissue['TISSUE'], tissue['TISSUE'])\n    select_tissue.SetInValue(255)\n    select_tissue.SetOutValue(0)\n    select_tissue.SetInputConnection(last_connection.GetOutputPort())\n

        Resample the Volume

        Lower resolution volumes produce fewer polygons. For experimentation we often reduce the resolution of the data with this filter. However, details can be lost during this process. Averaging creates new pixels in the resampled volume by averaging neighboring pixels. If averaging is turned off, every SAMPLE_RATE pixel will be passed through to the output.

            shrinker = vtk.vtkImageShrink3D()\n    shrinker.SetInputConnection(select_tissue.GetOutputPort())\n    shrinker.SetShrinkFactors(tissue['SAMPLE_RATE'])\n    shrinker.AveragingOn()\n    last_connection = shrinker\n

        Smooth the Volume Data

        To this point, unless we have resampled the data, the volume is labeled with a value of 255 in pixels of the selected tissue and 0 elsewhere. This \"binary\" volume would produce stepped surfaces if we did not blur it. The Gaussian kernel specified in this filter accomplishes the smoothing we require to extract surfaces. The amount of smoothing is controlled by GAUSSIAN_STANDARD_DEVIATION that can be independently specified for each axis of the volume data. We only run this filter if some smoothing is requested,

            if not all(v == 0 for v in tissue['GAUSSIAN_STANDARD_DEVIATION']):\n        gaussian = vtk.vtkImageGaussianSmooth()\n        gaussian.SetStandardDeviation(*tissue['GAUSSIAN_STANDARD_DEVIATION'])\n        gaussian.SetRadiusFactors(*tissue['GAUSSIAN_RADIUS_FACTORS'])\n        gaussian.SetInputConnection(shrinker.GetOutputPort())\n        last_connection = gaussian\n

        Generate Triangles

        Now we can process the volume with an iso-surface generator just as though we had obtained gray-scale data from a scanner. We added a few more bells and whistles to the pipeline. The filter runs faster if we turn off gradient and normal calculations. The generator normally calculates vertex normals from the gradient of the volume data. In our pipeline, we have concocted a gray-scale representation and will subsequently decimate the triangle mesh and smooth the resulting vertices. This processing invalidates the normals that are calculated by the generator.

            if flying_edges:\n        iso_surface = vtk.vtkFlyingEdges3D()\n        iso_surface.SetInputConnection(last_connection.GetOutputPort())\n        iso_surface.ComputeScalarsOff()\n        iso_surface.ComputeGradientsOff()\n        iso_surface.ComputeNormalsOff()\n        iso_surface.SetValue(0, iso_value)\n

        Transform the Data We need to transform the data so the appropriate orientation is displayed.

            so = SliceOrder()\n    transform = so.get('hfap')\n    transform.Scale(1, -1, 1)\n    tf = vtk.vtkTransformPolyDataFilter()\n    tf.SetTransform(transform)\n    tf.SetInputConnection(iso_surface.GetOutputPort())\n

        Reduce the Number of Triangles

        There are often many more triangles generated by the isosurfacing algorithm than we need for rendering. Here we reduce the triangle count by eliminating triangle vertices that lie within a user-specified distance to the plane formed by neighboring vertices. We preserve any edges of triangles that are considered \"features.\"

            decimator = vtk.vtkDecimatePro()\n    decimator.SetInputConnection(tf.GetOutputPort())\n    decimator.SetFeatureAngle(tissue['DECIMATE_ANGLE'])\n    decimator.MaximumIterations = tissue['DECIMATE_ITERATIONS']\n    decimator.PreserveTopologyOn()\n    decimator.SetErrorIsAbsolute(1)\n    decimator.SetAbsoluteError(tissue['DECIMATE_ERROR'])\n    decimator.SetTargetReduction(tissue['DECIMATE_REDUCTION'])\n

        Smooth the Triangle Vertices

        This filter uses Laplacian smoothing described in \"Mesh Smoothing\" in Chapter 9 to adjust triangle vertices as an \"average\" of neighboring vertices. Typically, the movement will be less than a voxel.

        Of course we have already smoothed the image data with a Gaussian kernel so this step may not give much improvement; however, models that are heavily decimated can sometimes be improved with additional polygonal smoothing.

            smoother = vtk.vtkSmoothPolyDataFilter()\n    smoother.SetInputConnection(decimator.GetOutputPort())\n    smoother.SetNumberOfIterations(tissue['SMOOTH_ITERATIONS'])\n    smoother.SetRelaxationFactor(tissue['SMOOTH_FACTOR'])\n    smoother.SetFeatureAngle(tissue['SMOOTH_ANGLE'])\n    smoother.FeatureEdgeSmoothingOff()\n    smoother.BoundarySmoothingOff()\n    smoother.SetConvergence(0)\n

        Generate Normals

        To generate smooth shaded models during rendering, we need normals at each vertex. As in decimation, sharp edges can be retained by setting the feature angle.

            normals = vtk.vtkPolyDataNormals()\n    normals.SetInputConnection(smoother.GetOutputPort())\n    normals.SetFeatureAngle(tissue['FEATURE_ANGLE'])\n

        Generate Triangle Strips

        Triangle strips are a compact representation of large numbers of triangles. This filter processes our independent triangles before we write them to a file.

            stripper = vtk.vtkStripper()\n    stripper.SetInputConnection(normals.GetOutputPort())\n

        Write the Triangles to a File

        Finally, if we were writing the triangle strips to a file, the last component of the pipeline would be:

            writer = vtk.vtkPolyDataWriter()\n    writer.SetInputConnection(stripper.GetOutputPort())\n    writer.SetFileName(NAME + '.vtk')\n

        Execute the Pipeline

        If you have gotten this far in the book, you know that the Visualization Toolkit uses a demand-driven pipeline architecture and so far we have not demanded anything. We have just specified the pipeline topology and the parameters for each pipeline element. So we need to trigger the updating of the pipeline.

        If you are displaying the image then:

            render_window.Render()\n

        If you are just writing to a file:

            writer.Update()\n

        causes the pipeline to execute. In practice we do a bit more than just Update the last element of the pipeline. We explicitly Update each element so that we can time the individual steps.

        Specifying Parameters for the Pipeline

        All of the variables mentioned above must be defined for each tissue to be processed. The parameters fall into two general categories. Some are specific to the particular study while some are specific to each tissue. For the frog, we collected the study-specific parameters in a function that contains:

        def frog():\n    p = default_parameters()\n    p['ROWS'] = 470\n    p['COLUMNS'] = 500\n    p['STUDY'] = 'frogTissue'\n    p['SLICE_ORDER'] = 'si'\n    p['PIXEL_SIZE'] = 1\n    p['SPACING'] = 1.5\n    p['VALUE'] = 127.5\n    p['SAMPLE_RATE'] = [1, 1, 1]\n    p['GAUSSIAN_STANDARD_DEVIATION'] = [2, 2, 2]\n    p['DECIMATE_REDUCTION'] = 0.95\n    p['DECIMATE_ITERATIONS'] = 5\n    p['DECIMATE_ERROR'] = 0.0002\n    p['DECIMATE_ERROR_INCREMENT'] = 0.0002\n    p['SMOOTH_ITERATIONS'] = 0\n    p['SMOOTH_FACTOR'] = 0.1\n    return p\n

        There is a specific function for each tissue type. This tissue-specific function reads in the frog-specific parameters, sets the tissue-specific parameters. For example, liver()) contains:

        def liver():\n    p = frog()\n    p['NAME'] = 'liver'\n    p['TISSUE'] = 10\n    p['START_SLICE'] = 25\n    p['END_SLICE'] = 126\n    p['VOI'] = [167, 297, 154, 304, p['START_SLICE'], p['END_SLICE']]\n    return p\n

        Parameters in the function frog() can also be overridden. For example, skeleton() overrides the standard deviation for the Gaussian filter.

        def skeleton():\n    p = frog()\n    p['STUDY'] = 'frogTissue'\n    p['NAME'] = 'skeleton'\n    p['TISSUE'] = 13\n    p['VALUE'] = 64.5\n    p['START_SLICE'] = 1\n    p['END_SLICE'] = 136\n    p['VOI'] = [23, 479, 8, 469, p['START_SLICE'], p['END_SLICE']]\n    p['GAUSSIAN_STANDARD_DEVIATION'] = [1.5, 1.5, 1]\n    return p\n

        Note that both of these examples specify a volume of interest. This improves performance of the imaging and visualization algorithms by eliminating empty space.

        Another function, skin(), uses similar parameters, it is used to extract the skin. Island removal or threshold pipeline elements are not needed since the data is already has gray-scale information.

        After the usual code to create required rendering objects, a single statement for each part creates an actor that we can add to the renderer:

                t, actor = create_frog_actor(frog_fn, frog_tissue_fn, tissue, flying_edges, lut)\n        ict[name] = t\n        renderer.AddActor(actor)\n

        The rest of the script defines a standard view.

            # Initial view (looking down on the dorsal surface).\n    renderer.GetActiveCamera().Roll(-90)\n    renderer.ResetCamera()\n

        Conclusion

        This lengthy example shows the power of a comprehensive visualization system like VTK.

        • We mixed image processing and computer graphics algorithms to process data created by an external segmentation process.
        • We developed a generic approach that allows users to control the elements of the pipeline with a familiar scripting language, Python.
        • We can easily separate this script into a \"batch\" portion and an \"interactive\" portion.

        If .vtk files have been created we can use an alternative Python script called Frog.py. This takes the vtk models corresponding to the .vtk file and renders them.

        These programs:

        • FrogReconstruction.py
        • Frog.py

        allow the user specify what tissues to display and also provide some pre-defined views.

        Figure12-9 shows four views of the frog.

        (a) All frog parts and translucent skin. (b) The complete frog without skin. (c) No skin or skeleton. (d) A view from the top. How good is your biology? Figure 12-9. Various frog images. See Frog.py.

        Other Frog-Related Information

        The folks at Lawrence Berkeley National Laboratory have an impressive Web site that features the frog used in this example. The site describes how the frog data was obtained and also permits users to create mpeg movies of the frog. There are also other datasets available. Further details on \"The Whole Frog Project\" can be found at http://www-itg.lbl.gov/Frog. Also, the Stanford University Medical Media and Information Technologies (SUMMIT) group has on-going work using the Berkeley frog. They are early VTK users.

        "},{"location":"VTKBook/12Chapter12/#123-financial-visualization","title":"12.3 Financial Visualization","text":"

        The application of 3D visualization techniques to financial data is relatively new. Historically, financial data has been represented using 2D plotting techniques such as line, scatter plots, bar charts, and pie charts. These techniques are especially well suited for the display of price and volume information for stocks, bonds, and mutual funds. Three-dimensional techniques are becoming more important due to the increased volume of information in recent years, and 3D graphics and visualization techniques are becoming interactive. Interactive rates mean that visualization can be applied to the day-to-day processing of data. Our belief is that this will allow deeper understanding of today's complex financial data and other more timely decisions.

        In this example we go through the process of obtaining data, converting it to a form that we can use, and then using visualization techniques to view it. Some of the external software tools used in this example may be unfamiliar to you. This should not be a large concern. We have simply chosen the tools with which we are familiar. Where we have used an Awk script, you might choose to write a small C program to do the same thing. The value of the example lies in illustrating the high-level process of solving a visualization problem.

        The first step is to obtain the data. We obtained our data from a public site on the World Wide Web (WWW) that archives stock prices and volumes for many publicly traded stocks. (This Web site has closed down since publication of the first edition. The data for this example are available on the CD-ROM.)

        Once we have obtained the data, we convert it to a format that can be read into VTK. While VTK can read in a variety of data formats, frequently your data will not be in one of those. The data files we obtained are stored in the following format:

        930830 49.375 48.812 49.250 1139.2 56.1056 930831 49.375 48.938 49.125\n1360.4 66.8297 930902 49.188 48.688 48.750 1247.2 60.801 ...\n

        Each line stores the data for one day of trading. The first number is the date, stored as the last two digits of the year, followed by a two-digit month and finally the day of the month. The next three values represent the high, low, and closing price of the stock for that day. The next value is the volume of trading in thousands of shares. The final value is the volume of trading in millions of dollars.

        We used an Awk script to convert the original data format into a VTK data file. (See the VTK User's Guide for information on VTK file formats; or see VTK File Formats.) This conversion could be done using many other approaches, such as writing a C program or a Tcl script.

        BEGIN {print \"# vtk DataFile Version 2.0\\n\nData values for stocknASCII\\\\n\\\\nDATASET POLYDATA\"}\n{count += 1}\n{ d = $1%100}\n{ m = int(($1%10000)/100)}\n{ if (m == 2) d += 31}\n{ if (m == 3) d += 59}\n{ if (m == 4) d += 90}\n{ if (m == 5) d += 120}\n{ if (m == 6) d += 151}\n{ if (m == 7) d += 181}\n{ if (m == 8) d += 212}\n{ if (m == 9) d += 243}\n{ if (m == 10) d += 273}\n{ if (m == 11) d+= 304}\n{ if (m == 12) d += 334}\n{ d = d + (int($1/10000) - 93)*365}\n{dates[count] = d; prices[count] = $4; volumes[count] = $5}\nEND {\n    print \"POINTS \" count \" float\";\n    for (i = 1; i <= count; i++) print dates[i] \" \" prices[i] \" 0 \";\n    print \"\\nLINES 1 \" (count + 1) \" \" count;\n    for (i = 0; i \\< count; i++) print i;\n    print \"\\nPOINT_DATA \" count \"\\nSCALARS volume float\";\n    print \"LOOKUP\\_TABLE default\";\n    for (i = 1; i \\<= count; i++) print volumes\\[i\\];\n}\n

        The above Awk script performs the conversion. Its first line outputs the required header information indicating that the file is a VTK data file containing polygonal data. It also includes a comment indicating that the data represents stock values. There are a few different VTK data formats that we could have selected. It is up to you to decide which format best suits the data you are visualizing. We have judged the polygonal format ( vtkPolyData ) as best suited for this particular stock visualization.

        The next line of the Awk script creates a variable named count that keeps track of how many days worth of information is in the file. This is equivalent to the number of lines in the original data file.

        The next fourteen lines convert the six digit date into a more useful format, since the original format has a number of problems. If we were to blindly use the original format and plot the data using the date as the independent variable, there would be large gaps in our plot. For example, 931231 is the last day of 1993 and 940101 is the first day of 1994. Chronologically, these two dates are sequential, but mathematically there are (940101-931231=8870 values between them. A simple solution would be to use the line number as our independent variable. This would work as long as we knew that every trading day was recorded in the data file. It would not properly handle the situation where the market was open, but for some reason data was not recorded. A better solution is to convert the dates into numerically ordered days. The preceding Awk script sets January 1, 1993, as day number one, and then numbers all the following days from there. At the end of these 14 lines the variable, d, will contain the resulting value.

        The next line in our Awk script stores the converted date, closing price, and dollar volume into arrays indexed by the line number stored in the variable count. Once all the lines have been read and stored into the arrays, we write out the rest of the VTK data file. We have selected the date as our independent variable and x coordinate. The closing price we store as the y coordinate, and the z coordinate we set to zero. After indicating the number and type of points to be stored, the Awk script loops through all the points and writes them out to the VTK data file. It then writes out the line connectivity list. In this case we just connect one point to the next to form a polyline for each stock. Finally, we write out the volume information as scalar data associated with the points. Portions of the resulting VTK data file are shown below.

        # vtk DataFile Version 2.0\nData values for stock\nASCII\n\nDATASET POLYDATA\nPOINTS 348 float\n242 49.250 0\n243 49.125 0\n245 48.750 0\n246 48.625 0\n...\n\nLINES 1 349 348\n0\n1\n2\n3\n...\n\nPOINT_DATA 348\nSCALARS volume float\nLOOKUP_TABLE default\n1139.2\n1360.4\n1247.2\n1745.4\n

        Now that we have generated the VTK data file, we can start the process of creating a visualization for the stock data. To do this, we wrote a Tcl script to be used with the Tcl-based VTK executable. At a high level the script reads in the stock data, sends it through a tube filter, creates a label for it, and then creates an outline around the resulting dataset. Ideally, we would like to display multiple stocks in the same window. To facilitate this, we designed the Tcl script to use a procedure to perform operations on a per stock basis. The resulting script is listed below.

        #!/usr/bin/env python\nimport os\nimport vtk\n\ndef main():\n    colors = vtk.vtkNamedColors()\n    fileNames = ['GE.vtk', 'GM.vtk', 'IBM.vtk', 'DEC.vtk']\n    # Set up the stocks\n    renderers = list()\n    topRenderer = vtk.vtkRenderer()\n    bottomRenderer = vtk.vtkRenderer()\n    renderers.append(topRenderer)\n    renderers.append(bottomRenderer)\n\n    # create the outline\n    apf = vtk.vtkAppendPolyData()$\\index{vtkAppendPolyData!application}$\n    olf = vtk.vtkOutlineFilter()$\\index{vtkOutlineFilter!application}$\n    olf.SetInputConnection(apf.GetOutputPort())\n    outlineMapper = vtk.vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(olf.GetOutputPort())\n    outlineActor = vtk.vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    zPosition = 0.0\n    for fn in fileNames:\n        zPosition = AddStock(renderers, apf, fn,\n            os.path.basename((os.path.splitext(fn)[0])), zPosition)\n\n    # Setup the render window and interactor.\n    renderWindow = vtk.vtkRenderWindow()\n    renderWindow.AddRenderer(renderers[0])\n    renderWindow.AddRenderer(renderers[1])\n    renderWindowInteractor = vtk.vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderers[0].SetViewport(0.0, 0.4, 1.0, 1.0)\n    renderers[1].SetViewport(0.0, 0.0, 1.0, 0.4)\n    renderers[0].GetActiveCamera().SetViewAngle(5.0)\n    renderers[0].ResetCamera()\n    renderers[0].GetActiveCamera().Zoom(1.4)\n    renderers[0].ResetCameraClippingRange()\n    renderers[0].SetBackground(colors.GetColor3d(\"SteelBlue\"))\n    renderers[1].GetActiveCamera().SetViewUp(0, 0, -1)\n    renderers[1].GetActiveCamera().SetPosition(0, 1, 0)\n    renderers[1].GetActiveCamera().SetViewAngle(5.0)\n    renderers[1].ResetCamera()\n    renderers[1].GetActiveCamera().Zoom(2.2)\n    renderers[1].ResetCameraClippingRange()\n    renderers[1].SetBackground(colors.GetColor3d(\"LightSteelBlue\"))\n    renderers[0].AddActor(outlineActor)\n    renderers[1].AddActor(outlineActor)\n\n    renderWindow.SetSize(500, 800)\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\ndef AddStock(renderers, apf, filename, name, zPosition):\n    # Read the data\n    PolyDataRead = vtk.vtkPolyDataReader()\n    PolyDataRead.SetFileName(filename)\n    PolyDataRead.Update()\n    TubeFilter = vtk.vtkTubeFilter()$\\index{vtkTubeFilter!application}$\n    TubeFilter.SetInputConnection(PolyDataRead.GetOutputPort())\n    TubeFilter.SetNumberOfSides(8)\n    TubeFilter.SetRadius(0.5)\n    TubeFilter.SetRadiusFactor(10000)\n    Transform = vtk.vtkTransform()$\\index{vtkTransform!application}$\n    Transform.Translate(0, 0, zPosition)\n    Transform.Scale(0.15, 1, 1)\n    TransformFilter = vtk.vtkTransformPolyDataFilter()\n    TransformFilter.SetInputConnection(TubeFilter.GetOutputPort())\n    TransformFilter.SetTransform(Transform)\n    # Create the labels.\n    TextSrc = vtk.vtkVectorText()$\\index{vtkVectorText!application}$\n    TextSrc.SetText(name)\n    numberOfPoints = PolyDataRead.GetOutput().GetNumberOfPoints()\n    nameIndex = int((numberOfPoints - 1) * 0.8)\n    nameLocation = PolyDataRead.GetOutput().GetPoint(nameIndex)\n    x = nameLocation[0] * 0.15\n    y = nameLocation[1] + 5.0\n    z = zPosition\n    apf.AddInputData(TransformFilter.GetOutput())\n    for r in range(0, len(renderers)):\n        LabelMapper = vtk.vtkPolyDataMapper()\n        LabelMapper.SetInputConnection(TextSrc.GetOutputPort())\n        LabelActor = vtk.vtkFollower()$\\index{vtkFollower!example}$\n        LabelActor.SetMapper(LabelMapper)\n        LabelActor.SetPosition(x, y, z)\n        LabelActor.SetScale(2, 2, 2)\n        LabelActor.SetOrigin(TextSrc.GetOutput().GetCenter())\n        # Increment zPosition.\n        zPosition += 8.0\n        StockMapper = vtk.vtkPolyDataMapper()\n        StockMapper.SetInputConnection(TransformFilter.GetOutputPort())\n        StockMapper.SetScalarRange(0, 8000)\n        StockActor = vtk.vtkActor()\n        StockActor.SetMapper(StockMapper)\n        renderers[r].AddActor(StockActor)\n        renderers[r].AddActor(LabelActor)\n        LabelActor.SetCamera(renderers[r].GetActiveCamera())\n    return zPosition\n\nif __name__ == '__main__':\n    main()\n

        The first part of this script consists of the standard procedure for renderer and interactor creation that can be found in almost all of the VTK Tcl scripts. The next section creates the objects necessary for drawing an outline around all of the stock data. A vtkAppendPolyData filter is used to append all of the stock data together. This is then sent through a vtkOutlineFilter to create a bounding box around the data. A mapper and actor are created to display the rIn the next part of this script, we define the procedure to add stock data to this visualization. The procedure takes five arguments: the name of the stock, the label we want displayed, and the x, y, z coordinates defining where to position the label. The first line of the procedure indicates that the variable ren1 should be visible to this procedure. By default the procedure can only access its own local variables. Next, we create the label using a vtkTextSource, vtkPolyDataMapper, and vtkFollower. The names of these objects are all prepended with the variable \" $prefix. \" so that the instance names will be unique. An instance of vtkFollower is used instead of the usual vtkActor, because we always want the text to be right-side up and facing the camera. The vtkFollower class provides this functionality. The remaining lines position and scale the label appropriately. We set the origin of the label to the center of its data. This insures that the follower will rotate about its center point.

        The next group of lines creates the required objects to read in the data, pass it through a tube filter and a transform filter, and finally display the result. The tube filter uses the scalar data (stock volume in this example) to determine the radius of the tube. The mapper also uses the scalar data to determine the coloring of the tube. The transform filter uses a transform object to set the stock's position based on the value of the variable zpos. For each stock, we will increment zpos by 10, effectively shifting the next stock over 10 units from the current stock. This prevents the stocks from being stacked on top of each other. We also use the transform to compress the x-axis to make the data easier to view. Next, we add this stock as an input to the append filter and add the actors and followers to the renderer. The last line of the procedure sets the follower's camera to be the active camera of the renderer.

        Back in the main body of the Tcl script, we invoke the AddStock procedure four times with four different stocks. Finally, we add the outline actor and customize the renderer and camera to four different stocks. Finally, we add the outline actor and customize the renderer and camera to produce a nice initial view. Two different views of the result are displayed in Figure 12-10. The top image shows a history of stock closing prices for our four stocks. The color and width of these lines correspond to the volume of the stock on that day. The lower image more clearly illustrates the changes in stock volume by looking at the data from above.

        Figure 12-10 Two views from the stock visualization script. The top shows closing price over time; the bottom shows volume over time ( stocks.tcl ).

        A legitimate complaint with Figure 12-10 is that the changing width of the tube makes it more difficult to see the true shape of the price verses the time curve. We can solve this problem by using a ribbon filter followed by a linear extrusion filter, instead of the tube filter. The ribbon filter will create a ribbon whose width will vary in proportion to the scalar value of the data. We then use the linear extrusion filter to extrude this ribbon along the y-axis so that it has a constant thickness. The resulting views are shown in Figure 12-11. Figure 12-11. Two more views of the stock case study. Here the tube filter has been replaced by a ribbon filter followed with a linear extrusion filter. See Stocks.cxx and Stocks.py."},{"location":"VTKBook/12Chapter12/#124-implicit-modelling","title":"12.4 Implicit Modelling","text":"

        The Visualization Toolkit has some useful geometric modelling capabilities. One of the most powerful features is implicit modelling. In this example we show how to use polygonal descriptions of objects and create \"blobby\" models of them using the implicit modelling objects in VTK. This example generates a logo for the Visualization Toolkit from polygonal representations of the letters v, t, and k.

        Figure 12-12. The visualization pipeline for the VTK blobby logo.

        We create three separate visualization pipelines, one for each letter. Figure 12-12 shows the visualization pipeline. As is common in VTK applications, we design a pipeline and fill in the details of the instance variables just before we render. We pass the letters through a vtkTransformPolyDataFilter to position them relative to each other. Then we combine all of the polygons from the transformed letters into one polygon dataset using the vtkAppendPolyData filter. The vtkImplicitModeller creates a volume dataset of dimension 643 with each voxel containing a scalar value that is the distance to the nearest polygon. Recall from \"Implicit Modelling\" in Chapter 6 that the implicit modelling algorithm lets us specify the region of influence of each polygon. Here we specify this using the SetMaximumDistance() method of the vtkImplicitModeller. By restricting the region of influence, we can significantly improve performance of the implicit modelling algorithm. Then we use vtkContourFilter to extract an isosurface that approximates a distance of 1.0 from each polygon. We create two actors: one for the blobby logo and one for the original polygon letters. Notice that both actors share the polygon data created by vtkAppendPolyData. Because of the nature of the VTK visualization pipeline (see \"Implicit Execution\" in Chapter 4), the appended data will only be created once by the portion of the pipeline that is executed first. As a final touch, we move the polygonal logo in front of the blobby logo. Now we will go through the example in detail.

        First, we read the geometry files that contain polygonal models of each letter in the logo. The data is in VTK polygonal format, so we use vtkPolyDataReader .

        vtkPolyDataReader *letterV = vtkPolyDataReader::New();\n  letterV->SetFileName (\"v.vtk\");\n\nvtkPolyDataReader *letterT = vtkPolyDataReader::New();\n  letterT->SetFileName (\"t.vtk\");\n\nvtkPolyDataReader *letterK = vtkPolyDataReader::New();\n  letterK->SetFileName (\"k.vtk\");\n

        We want to transform each letter into its appropriate location and orientation within the logo. We create the transform filters here, but defer specifying the location and orientation until later in the program.

        vtkTransform *VTransform = vtkTransform::New();\nvtkTransformPolyDataFilter *VTransformFilter =\n    vtkTransformPolyDataFilter::New();\n  VTransformFilter->SetInputConnection (letterV->GetOutputPort());\n  VTransformFilter->SetTransform (VTransform);\n\nvtkTransform *TTransform = vtkTransform::New();\nvtkTransformPolyDataFilter *TTransformFilter =\n    vtkTransformPolyDataFilter::New();\n  TTransformFilter->SetInputConnection (letterT->GetOutputPort());\n  TTransformFilter->SetTransform (TTransform);\n\nvtkTransform *KTransform = vtkTransform::New();\n  vtkTransformPolyDataFilter *KTransformFilter =\n    vtkTransformPolyDataFilter::New();\n  KTransformFilter->SetInputConnection (letterK->GetOutputPort());\n  KTransformFilter->SetTransform (KTransform);\n

        We collect all of the transformed letters into one set of polygons by using an instance of the class vtkAppendPolyData.

        vtkAppendPolyData *appendAll = vtkAppendPolyData::New();\n  appendAll->AddInputConnection (VTransformFilter->GetOutputPort());\n  appendAll->AddInputConnection (TTransformFilter->GetOutputPort());\n  appendAll->AddInputConnection (KTransformFilter->GetOutputPort());\n

        Since the geometry for each letter did not have surface normals, we add them here. We use vtkPolyDataNormals. Then we complete this portion of the pipeline by creating a mapper and an actor.

        // create normals\nvtkPolyDataNormals *logoNormals = vtkPolyDataNormals::New();\n  logoNormals->SetInputConnection (appendAll->GetOutputPort());\n  logoNormals->SetFeatureAngle (60);\n\n// map to rendering primitives\nvtkPolyDataMapper *logoMapper = vtkPolyDataMapper::New();\n  logoMapper->SetInputConnection (logoNormals->GetOutputPort());\n\n// now an actor\nvtkActor *logo = vtkActor::New();\n  logo->SetMapper (logoMapper);\n

        We create the blobby logo with the implicit modeller, and then extract the logo with vtkContourFilter. The pipeline is completed by creating a mapper and an actor.

        //  now create an implicit model of the letters vtkImplicitModeller\n*blobbyLogoImp = vtkImplicitModeller::New();\n  blobbyLogoImp->SetInputConnection (appendAll->GetOutputPort());\n  blobbyLogoImp->SetMaximumDistance (.075);\n  blobbyLogoImp->SetSampleDimensions (64,64,64);\n  blobbyLogoImp->SetAdjustDistance (0.05);\n\n//  extract an iso surface\nvtkContourFilter *blobbyLogoIso = vtkContourFilter::New();\n  blobbyLogoIso->SetInputConnection (blobbyLogoImp->GetOutputPort());\n  blobbyLogoIso->SetValue (1, 1.5);\n\n// map to rendering primitives\nvtkPolyDataMapper *blobbyLogoMapper = vtkPolyDataMapper::New();\n  blobbyLogoMapper->SetInputConnection (\n  blobbyLogoIso->GetOutputPort());\n  blobbyLogoMapper->ScalarVisibilityOff ();\n\n// now an actor\n\nvtkActor *blobbyLogo = vtkActor::New();\nblobbyLogo->SetMapper(blobbyLogoMapper);\nblobbyLogo->SetProperty (banana);\n

        To improve the look of our resulting visualization, we define a couple of organic colors. Softer colors show up better on some electronic media (e.g., VHS video tape) and are pleasing to the eye.

        vtkProperty *tomato = vtkProperty::New();\n tomato->SetDiffuseColor(1,.3882, .2784);\n tomato->SetSpecular(.3);\n tomato->SetSpecularPower(20);\n\nvtkProperty *banana = vtkProperty::New();\n banana->SetDiffuseColor(.89, .81, .34);\n banana->SetDiffuse (.7);\n banana->SetSpecular(.4);\n banana->SetSpecularPower(20);\n

        These colors are then assigned to the appropriate actors.

        Figure 12-13. A logo created with vtkImplicitModeller. See BlobbyLogo.cxx and BlobbyLogo.py.
        logo->SetProperty(tomato);\nblobbyLogo->SetProperty(banana);\n

        And finally, we position the letters in the logo and move the polygonal logo out in front of the blobby logo by modifying the actor's position.

        VTransform->Translate (-16,0,12.5);\nVTransform->RotateY (40);\n\nKTransform->Translate (14, 0, 0);\nKTransform->RotateY (-40);\n\n// move the polygonal letters to the front\nlogo->SetPosition(0,0,6);\n

        An image made from the techniques described in this section is shown in Figure 12-13 Note that the image on the left has been augmented with a texture map."},{"location":"VTKBook/12Chapter12/#125-computational-fluid-dynamics","title":"12.5 Computational Fluid Dynamics","text":"

        Computational Fluid Dynamics (CFD) visualization poses a challenge to any visualization toolkit. CFD studies the flow of fluids in and around complex structures. Often, large amounts of super-computer time is used to derive scalar and vector data in the flow field. Since CFD computations produce multiple scalar and vector data types, we will apply many of the tools described in this book. The challenge is to combine multiple representations into meaningful visualizations that extract information without overwhelming the user.

        There are a number of techniques we can use when we first look at the complex data presented by CFD applications. Since we need to apply several algorithms to the data, and since there will be many parameter changes for these algorithms, we suggest using the Tcl interpreter rather than C++ code. Our strategy for visualizing this CFD data includes the following:

        1. Display the computational grid. The analyst carefully constructed the finite difference grid to have a higher density in regions where rapid changes occur in the flow variables. We will display the grid in wireframe so we can see the computational cells.

        2. Display the scalar fields on the computational grid. This will give us an overview of where the scalar data is changing. We will experiment with the extents of the grid extraction to focus on interesting areas.

        3. Explore the vector field by seeding streamlines with a spherical cloud of points. Move the sphere through areas of rapidly changing velocity.

        4. Try using the computational grid itself as seeds for the streamlines. Of course we will have to restrict the extent of the grid you use for this purpose. Using the grid, we will be able to place more seeds in regions where the analyst expected more action.

        For this case study, we use a dataset from NASA called the LOx Post. It simulates the flow of liquid oxygen across a flat plate with a cylindrical post perpendicular to the flow [Rogers86]. This analysis models the flow in a rocket engine. The post promotes mixing of the liquid oxygen.

        We start by exploring the scalar and vector fields in the data. By calculating the magnitude of the velocity vectors, we derive a scalar field. This study has a particularly interesting vector field around the post. We seed the field with multiple starting points (using points arranged along a curve, referred to as a rake) and experiment with parameters for the streamlines. Streampolygons are particularly appropriate here and do a nice job of showing the flow downstream from the post. We animate the streamline creation by moving the seeding line or rake back and forth behind the post.

        Following our own advice, we first display the computational grid. The following Tcl code produced the right image of Figure 12-14.

        # read data\nvtkPLOT3DReader pl3d\n  pl3d SetXYZFileName \"$env(VTK_TEXTBOOK_DATA)/postxyz.bin\"\n  pl3d SetQFileName \"$env(VTK_TEXTBOOK_DATA)/postq.bin\"\n  pl3d IBlankingOn\n  pl3d Update\n# computational planes: the floor\nvtkStructuredGridGeometryFilter floorComp\n  floorComp SetExtent 0 37 0 75 0 0\n  floorComp SetInputConnection [pl3d GetOutputPort]\nvtkPolyDataMapper floorMapper\n  floorMapper SetInputConnection [floorComp GetOutputPort]\n  floorMapper ScalarVisibilityOff\nvtkActor floorActor\n  floorActor SetMapper floorMapper\n  [floorActor GetProperty] SetColor 0 0 0\n  [floorActor GetProperty] SetRepresentationToWireframe\n\n##   the post\nvtkStructuredGridGeometryFilter postComp\n  postComp SetExtent 10 10 0 75 0 37\n  postComp SetInputConnection [pl3d GetOutputPort]\nvtkPolyDataMapper postMapper\n  postMapper SetInputConnection [postComp GetOutputPort]\n  postMapper ScalarVisibilityOff\nvtkActor postActor\n  postActor SetMapper postMapper\n  [postActor GetProperty] SetColor 0 0 0\n  [postActor GetProperty] SetRepresentationToWireframe\n\n#   plane upstream of the flow\nvtkStructuredGridGeometryFilter fanComp\n  fanComp SetExtent 0 37 38 38 0 37\n  fanComp SetInputConnection [pl3d GetOutputPort]\nvtkPolyDataMapper fanMapper\n  fanMapper SetInputConnection [fanComp GetOutputPort]\n  fanMapper ScalarVisibilityOff\nvtkActor fanActor\n  fanActor SetMapper fanMapper\n  [fanActor GetProperty] SetColor 0 0 0\n  [fanActor GetProperty] SetRepresentationToWireframe\n\n#   outline\nvtkStructuredGridOutlineFilter outline\n  outline SetInputConnection [pl3d GetOutputPor]\nvtkPolyDataMapper outlineMapper\n  outlineMapper SetInputConnection [outline GetOutputPort]\nvtkActor outlineActor\n  outlineActor SetMapper outlineMapper\n  [outlineActor GetProperty] SetColor 0 0 0\n\n#   Create graphics stuff\nvtkRenderer ren1\nvtkRenderWindow renWin\n  renWin AddRenderer ren1\nvtkRenderWindowInteractor iren\n  iren SetRenderWindow renWin\n\n#   Add the actors to the renderer, set the background and size\n#\nren1 AddActor outlineActor\nren1 AddActor floorActor\nren1 AddActor postActor\nren1 AddActor fanActor\n
        Figure 12-14. Portion of computational grid for the LOx post. See LOxGrid.cxx and LOxGrid.py.

        To display the scalar field using color mapping, we must change the actor's representation from wireframe to surface, turn on scalar visibility for each vtkPolyDataMapper, set each mapper's scalar range, and render again, producing the right image of Figure 12-14.

        postActor SetRepresentationToSurface\nfanActor SetRepresentationToSurface\nfloorActor SetRepresentationToSurface\n\npostMapper ScalarVisibilityOn\npostMapper SetScalarRange [[pl3d GetOutput] GetScalarRange]\nfanMapper ScalarVisibilityOn\nfanMapper SetScalarRange [[pl3d GetOutput] GetScalarRange]\nfloorMapper ScalarVisibilityOn\nfloorMapper SetScalarRange [[pl3d GetOutput] GetScalarRange]\n

        Now, we explore the vector field using vtkPointSource. Recall that this object generates a random cloud of points around a spherical center point. We will use this cloud of points to generate stream-lines. We place the center of the cloud near the post since this is where the velocity seems to be changing most rapidly. During this exploration, we use streamlines rather than streamtubes for reasons of efficiency. The Tcl code is as follows.

        #   spherical seed points\nvtkPointSource rake\n  rake SetCenter -0.74 0 0.3\n  rake SetNumberOfPoints 10\nvtkStreamLine streamers\n  streamers SetInputConnection [pl3d GetOutputPort]\n  streamers SetSourceConnection [rake GetOutputPort]\n  streamers SetMaximumPropagationTime 250\n  streamers SpeedScalarsOn\n  streamers SetIntegrationStepLength .2\n  streamers SetStepLength .25\nvtkPolyDataMapper mapTubes\n  mapTubes SetInputConnection [streamers GetOutputPort]\n  eval mapTubes SetScalarRange [[pl3d GetOutput] GetScalarRange]\nvtkActor tubesActor\n  tubesActor SetMapper mapTubes\n
        Figure 12-15. Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown. See LOxSeeds.cxx and LOxSeeds.py.

        Figure 12-15 shows streamlines seeded from four locations along the post. Notice how the structure of the flow begins to emerge as the starting positions for the streamlines are moved up and down in front of the post. This is particularly true if we do this interactively; the mind assembles the behavior of the streamlines into a global understanding of the flow field. Figure 12-16. Streamtubes created by using the computational grid just in front of the post as a source for seeds. See LOx.cxx and LOx.py.

        For a final example, we use the computational grid to seed streamlines and then generate streamtubes as is shown in Figure 12-16. A nice feature of this approach is that we generate more streamlines in regions where the analyst constructed a denser grid. The only change we need to make is to replace the rake from the sphere source with a portion of the grid geometry.

        vtkStructuredGridGeometryFilter seedsComp\n  seedsComp SetExtent 10 10 37 39 1 35\n  seedsComp SetInput [pl3d GetOutput]\nstreamers SetSourceConnection [seedsComp GetOutputPort]\n\n#   create tubes\nvtkTubeFilter tubes\n  tubes SetInputConnection [streamers GetOutputPort]\n  tubes SetNumberOfSides 8\n  tubes SetRadius .08\n  tubes SetVaryRadiusOff\n#   change input to streamtubes\nmapTubes SetInputConnection [tubes GetOutputPort]\n

        There are a number of other methods we could use to visualize this data. A 3D widget such as the vtkLineWidget could be used to seed the streamlines interactively (see \"3D Widgets and User Interaction\" in Chapter 7). As we saw in \"Point Probe\" in Chapter 8, probing the data for numerical values is a valuable technique. In particular, if the probe is a line we can use it in combination with vtkXYPlotActor to graph the variation of data value along the line. Another useful visualization would be to identify regions of vorticity. We could use Equation9-12 in conjunction with an isocontouring algorithm (e.g., vtkContourFilter ) to creates isosurfaces of large helical-density.

        "},{"location":"VTKBook/12Chapter12/#126-finite-element-analysis","title":"12.6 Finite Element Analysis","text":"

        Finite element analysis is a widely used numerical technique for finding solutions of partial differential equations. Applications of finite element analysis include linear and nonlinear structural, thermal, dynamic, electromagnetic, and flow analysis. In this application we will visualize the results of a blow molding process.

        In the extrusion blow molding process, a material is extruded through an annular die to form a hollow cylinder. This cylinder is called a parison. Two mold halves are then closed on the parison, while at the same time the parison is inflated with air. Some of the parison material remains within the mold while some becomes waste material. The material is typically a polymer plastic softened with heat, but blow molding has been used to form metal parts. Plastic bottles are often manufactured using a blow molding process.

        Designing the parison die and molds is not easy. Improper design results in large variations in the wall thickness. In some cases the part may fail in thin-walled regions. As a result, analysis tools based on finite element techniques have been developed to assist in the design of molds and dies.

        The results of one such analysis are shown in Figure 12-17. The polymer was molded using an isothermal, nonlinear-elastic, incompressible (rubber-like) material. Triangular membrane finite elements were used to model the parison, while a combination of triangular and quadrilateral finite elements were used to model the mold. The mold surface is assumed to be rigid, and the parison is assumed to attach to the mold upon contact. Thus the thinning of the parison is controlled by its stretching during inflation and the sequence in which it contacts the mold.

        Figure 12-17 illustrates 10 steps of one analysis. The color of the parison indicates its thickness. Using a rainbow scale, red areas are thinnest while blue regions are thickest. Our visualization shows clearly one problem with the analysis technique we are using. Note that while the nodes (i.e., points) of the finite element mesh are prevented from passing through the mold, the interior of the triangular elements are not. This is apparent from the occlusion of the mold wireframe by the parison mesh. Figure 12-17. Ten frames from a blow molding finite element analysis. Mold halves (shown in wireframe) are closed around a parison as the parison is inflated. Coloring indicates thickness-red areas are thinner than blue. See Blow.cxx and Blow.py.

        To generate these images, we used a Tcl script shown in Figure 12-18 and Figure 12-19. The input data is in VTK format, so a vtkUnstructuredGridReader was used as a source object. The mesh displacement is accomplished using an instance of vtkWarpVector. At this point the pipeline splits. We wish to treat the mold and parison differently (different properties such as wireframe versus surface), but the data for both mold and parison is combined. Fortunately, we can easily separate the data using two instances of class vtkConnectivityFilter. One filter extracts the parison, while the other extracts both parts of the mold. Finally, to achieve a smooth surface appearance on the parison, we use a vtkPolyDataNormals filter. In order to use this filter, we have to convert the data type from vtkUnstructuredGrid (output of vtkConnectivityFilter ) to type vtkPolyData. The filter vtkGeometryFilter does this nicely."},{"location":"VTKBook/12Chapter12/#127-algorithm-visualization","title":"12.7 Algorithm Visualization","text":"

        Visualization can be used to display algorithms and data structures. Representing this information often requires creative work on the part of the application programmer. For example, Robertson et al. [Robertson91] have shown 3D techniques for visualizing directory structures and navigating through them. Their approach involves building three dimensional models (the so-called \"cone trees\") to represent files, directories, and associations between files and directories. Similar approaches can be used to visualize stacks, queues, linked lists, trees, and other data structures.

        Figure 12-18. Tcl script to generate blow molding image. Network topology and initial portion of script are shown (Part one of two)

        In this example we will visualize the operation of the recursive Towers of Hanoi puzzle. In this puzzle there are three pegs ( Figure 12-20 ). In the initial position there are one or more disks (or pucks) of varying diameter on the pegs. The disks are sorted according to disk diameter, so that the largest disk is on the bottom, followed by the next largest, and so on. The goal of the puzzle is to extract mold from mesh using connectivity vtkConnectivityFilter move the disks from one peg to another, moving the disks one at a time, and never placing a larger disk on top of a smaller disk. Figure 12-19. Tcl script to generate blow molding image (Part two of two). (a) Initial (b) Intermediate (c) Final Figure 12-20. Towers of Hanoi. (a) Initial configuration. (b) Intermediate configuration. (c) Final configuration. (a) See HanoiInitial.cxx and HanoiInitial.py.; (b). See HanoiIntermediate.cxx and HanoiIntermediate.py.; (c) See Hanoi.cxx and Hanoi.py. Figure 12-21. C++ code for recursive solution of Towers of Hanoi. Figure 12-22. Function to move disks from one peg to another in the Towers of Hanoi example. The resulting motion is in small steps with an additional flip of the disk.

        The classical solution to this puzzle is based on a divide-and-conquer approach [AhoHopUll83]. The problem of moving n disks from the initial peg to the second peg can be thought of as solving two subproblems of size n--1. First move n--1 disks from the initial peg to the third peg. Then move the nth disk to the second peg. Finally, move the n--1 disks on the third peg back to the second peg.

        The solution to this problem can be elegantly implemented using recursion. We have shown portions of the C++ code in Figure 12-21 and Figure 12-22. In the first part of the solution (which is not shown in Figure 12-21 ) the table top, pegs, and disks are created using the two classes vtkPlaneSource and vtkCylinderSource. The function Hanoi() is then called to begin the recursion. The routine MovePuck() is responsible for moving a disk from one peg to another. It has been jazzed up to move the disk in small, user-specified increments, and to flip the disc over as it moves from one peg to the next. This gives a pleasing visual effect and adds the element of fun to the visualization.

        Because of the clear relationship between algorithm and physical reality, the Towers of Hanoi puzzle is relatively easy to visualize. A major challenge facing visualization researchers is to visualize more abstract information, such as information on the Internet, the structure of documents, or the effectiveness of advertising/entertainment in large market segments. This type of visualization, known as information visualization, is likely to emerge in the future as an important research challenge.

        "},{"location":"VTKBook/12Chapter12/#128-chapter-summary","title":"12.8 Chapter Summary","text":"

        This chapter presented several case studies covering a variety of visualization techniques. The examples used different data representations including polygonal data, volumes, structured grids, and unstructured grids. Both C++ and Tcl code was used to implement the case studies.

        Medical imaging is a demanding application area due to the size of the input data. Three-dimensional visualization of anatomy is generally regarded by radiologists as a communication tool for referring physicians and surgeons. Medical datasets are typically image data---volumes or layered stacks of 2D images that form volumes. Common visualization tools for medical imaging include isosurfaces, cut planes, and image display on volume slices.

        Next, we presented an example that applied 3D visualization techniques to financial data. In this case study, we began by showing how to import data from an external source. We applied tube filters to the data and varied the width of the tube to show the volume of stock trading. We saw how different views can be used to present different pieces of information. In this case, we saw that by viewing the visualization from the front, we saw a conventional price display. Then, by viewing the visualization from above, we saw trade volume.

        In the modelling case study we showed how to use polygonal models and the implicit modelling facilities in VTK to create a stylistic logo. The final model was created by extracting an isosurface at a user-selected offset.

        Computational fluid dynamics analysts frequently employ structured grid data. We examined some strategies for exploring the scalar and vector fields. The computational grid created by the analyst serves as a starting point for analyzing the data. We displayed geometry extracted from the finite difference grid, scalar color mapping, and streamlines and streamtubes to investigate the data.

        In the finite element case study, we looked at unstructured grids used in a simulation of a blow molding process. We displayed the deformation of the geometry using displacement plots, and represented the material thickness using color mapping. We saw how we can create simple animations by generating a sequence of images.

        We concluded the case studies by visualizing the Towers of Hanoi algorithm. Here we showed how to combine the procedural power of C++ with the visualization capabilities in VTK. We saw how visualization often requires our creative resources to cast data structures and information into visual form.

        "},{"location":"VTKBook/12Chapter12/#129-bibliographic-notes","title":"12.9 Bibliographic Notes","text":"

        The case studies presented in the chapter rely on having interesting data to visualize. Sometimes the hardest part of practicing visualizing is finding relevant data. The Internet is a tremendous resource for this task. Paul Gilster [Gilster94] has written an excellent introduction to many of the tools for accessing information on the Internet. There are many more books available on this subject in the local bookstore.

        In the stock case study we used a programming tool called AWK to convert our data into a form suitable for VTK. More information on AWK can be found in The AWK Programming Language [Aho88]. Another popular text processing languages is Perl [Perl95].

        If you would like to know more about information visualization you can start with the references listed here [Becker95] [Ding90] [Eick93] [Feiner88] [Johnson91] [Robertson91]. This is a relatively new field but will certainly grow in the near future.

        "},{"location":"VTKBook/12Chapter12/#1210-references","title":"12.10 References","text":"

        [Aho88] A. V. Aho, B. W. Kernighan, and P. J. Weinberger. The AWK Programming Language. AddisonWesley, Reading, MA, 1988.

        [AhoHopUll83] A. V. Aho, J. E. Hopcroft, and J. D. Ullman. Data Structures and Algorithm s. AddisonWesley, Reading, MA, 1983.

        [Becker95] R. A. Becker, S. G. Eick, and A. R. Wilks. \"Visualizing Network Data.\" IEEE Transactions on Visualization and Graphics. 1(1):16-28,1995.

        [deLorenzi93] H. G. deLorenzi and C. A. Taylor. \"The Role of Process Parameters in Blow Molding and Correlation of 3-D Finite Element Analysis with Experiment.\" International Polymer Processing. 3(4):365-374, 1993.

        [Ding90] C. Ding and P. Mateti. \"A Framework for the Automated Drawing of Data Structure Diagrams.\" IEEE Transactions on Software Engineering. 16(5):543-557, May 1990.

        [Eick93] S. G. Eick and G. J. Wills. \"Navigating Large Networks with Hierarchies.\" In Proceedings of Visualization '93. pp. 204-210, IEEE Computer Society Press, Los Alamitos, CA, October 1993.

        [Feiner88] S. Feiner. \"Seeing the Forest for the Trees: Hierarchical Displays of Hypertext Structures.\" In Conference on Office Information Systems. Palo Alto, CA, 1988.

        [Gilster94] P. Gilster. Finding It on the Internet: The Essential Guide to Archie, Veronica, Gopher, WAIS, WWW (including Mosaic), and Other Search and Browsing Tools. John Wiley & Sons, Inc., 1994.

        [Johnson91] B. Johnson and B. Shneiderman. \"Tree-Maps: A Space-Filling Approach to the Visualization of Hierarchical Information Structure s.\" In Proceedings of Visualization '91. pp. 284-291, IEEE Computer Society Press, Los Alamitos, CA, October 1991.

        [Perl95] D. Till. Teach Yourself Perl in 21 Days. Sams Publishing, Indianapolis, Indiana, 1995.

        [Robertson91] G. G. Robertson, J. D. Mackinlay, and S. K. Card. \"Cone Trees: Animated 3D Visualizations of Hierarchical Information.\" In Proceedings of ACM CHI '91 Conference on Human Factors in Computing Systems. pp. 189-194, 1991.

        [Rogers86] S. E. Rogers, D. Kwak, and U. K. Kaul, \"A Numerical Study of Three-Dimensional Incompressible Flow Around Multiple Post.\" in Proceedings of AIAA Aerospace Sciences Conference. vol. AIAA Paper 86-0353. Reno, Nevada, 1986.

        "},{"location":"VTKBook/12Chapter12/#1211-exercises","title":"12.11 Exercises","text":"

        12.1 The medical example did nothing to transform the original data into a standard coordinate system. Many medical systems use RAS coordinates. R is right/left, A is anterior/posterior and S is Superior/Inferior. This is the patient coordinate system. Discuss and compare the following alternatives for transforming volume data into RAS coordinates.

        a) vtkActor transformation methods.

        b) vtkTransformFilter.

        c) Reader transformations.

        12.2 Modify the last example found in the medical application ( Medical3.cxx ) to use vtkImageDataGeometryFilter instead of vtkImageActor. Compare the performance of using geometry with using texture. How does the performance change as the resolution of the volume data changes?

        12.3 Modify the last medical example ( Medical3.cxx ) to use v tkTexture and vtkPlaneSource instead of vtkImageActor.

        12.4 Change the medical case study to use dividing cubes for the skin surface.

        12.5 Combine the two scripts frogSegmentation.tcl and marchingFrog.tcl into one script that will handle either segmented or grayscale files. What other parameters and pipeline components might be useful in general for this application?

        12.6 Create polygonal / line stroked models of your initials and build your own logo. Experiment with different transformations.

        12.7 Enhance the appearance of Towers of Hanoi visualization.

        a) Texture map the disks, base plane, and pegs.

        b) Create disks with central holes.

        12.8 Use the blow molding example as a starting point for the following.

        a) Create an animation of the blow molding sequence. Is it possible to interpolate between time steps? How would you do this?

        b) Create the second half of the parison using symmetry. What transformation matrix do you need to use?

        12.9 Start with the stock visualization example presented in this chapter.

        a) Modify the example code to use a ribbon filter and linear extrusion filter as described in the text. Be careful of the width of the generated ribbons.

        b) Can you think of a way to present high/low trade values for each day?

        "},{"location":"VTKBook/13Glossary/","title":"Glossary","text":"

        3D Widget. An interaction paradigm enabling manipulation of scene objects (e.g., lights, camera, actors, and so on). The 3D widget typically provides a visible representation that can be intuitively and interactively manipulated.

        API. An acronym for application programmer's interface.

        Abstract Class. A class that provides methods and data members for the express purpose of deriving subclasses. Such objects are used to define a common interface and attributes for their subclasses.

        Abstraction. A mental process that extracts the essential form or unifying properties of a concept.

        Alpha. A specification of opacity (or transparency). An alpha value of one indicates that the object is opaque. An alpha value of zero indicates that the object is completely transparent.

        Ambient Lighting. The background lighting of unlit surfaces.

        Animation. A sequence of images displayed in rapid succession. The images may vary due to changes in geometry, color, lighting, camera position, or other graphics parameters. Animations are used to display the variation of one or more variables.

        Antialiasing. The process of reducing aliasing artifacts. These artifacts typically result from undersampling the data. A common use of antialiasing is to draw straight lines that don't have the jagged edges found in many systems without antialiasing.

        Azimuth. A rotation of a camera about the vertical (or view up) axis.

        Attribute. A named member of a class that captures some characteristic of the class. Attributes have a name, a data type, and a data value. This is the same as a data member or instance variable.

        Base Class. A superclass in C++.

        Binocular Parallax. The effect of viewing the same object with two slightly different viewpoints to develop depth information.

        Boolean Texture. A texture map consisting of distinct regions used to \"cut\" or accentuate features of data. For example, a texture map may consist of regions of zero opacity. When such a texture is mapped onto the surface of an object, portions of its interior becomes visible. Generally used in conjunction with a quadric (or other implicit function) to generate texture coordinates.

        C++. A compiled programming language with roots in the C programming language. C++ is an extension of C that incorporates objectoriented principles.

        CT (Computed Tomography). A data acquisition technique based on Xrays. Data is acquired in a 3D volume as a series of slice planes (i.e., a stack of n^2^ points).

        Cell. The atoms of visualization datasets. Cells define a topology (e.g., polygon, triangle) in terms of a list of point coordinates.

        Cell Attributes. Dataset attributes associated with a cell. See also point attributes .

        Class. An object that defines the characteristics of a subset of objects. Typically, it defines methods and data members. All objects instantiated from a class share that class's methods and data members.

        Clipping Plane. A plane that restricts the rendering or processing of data. Front and back clipping planes are commonly used to restrict the rendering of primitives to those lying between the two planes.

        Color Mapping. A scalar visualization technique that maps scalar values into color. Generally used to display the variation of data on a surface or through a volume.

        Compiled System. A compiled system requires that a program be compiled (or translated into a lower level language) before it is executed. Contrast with interpreted systems .

        Composite Cell. A cell consisting of one or more primary cells.

        Concrete Class. A class that can be instantiated. Typically, abstract classes are not instantiated but concrete classes are.

        Connectivity. A technique to extract connected cells. Cells are connected when they share common features such as points, edges, or faces.

        Contouring. A scalar visualization technique that creates lines (in 2D) or surfaces (in 3D) representing a constant scalar value across a scalar field. Contour lines are called isovalue lines or iso-lines. Contour surfaces are called isovalue surfaces or isosurfaces.

        Constructor. A class method that is invoked when an instance of that class is created. Typically the constructor sets any default values and allocates any memory that the instance needs. See also destructor .

        Critical Points. Locations in a vector field where the local vector magnitude goes to zero and the direction becomes undefined.

        Cutting. A visualization technique to slice through or cut data. The cutting surface is typically described with an implicit function, and data attributes are mapped onto the cut surface. See also boolean texture .

        Dataset. The general term used to describe visualization data. Datasets consist of structure (geometry and topology) and dataset attributes (scalars, vectors, tensors, etc.). Dataset Attributes. The information associated with the structure of a dataset. This can be scalars, vectors, tensors, normals, and texture coordinates, or arbitrary data arrays that may be contained in the field.

        Data Extraction. The process of selecting a portion of data based on characteristics of the data. These characteristics may be based on geometric or topological constraints or constraints on data attribute values.

        Data Flow Diagram. A diagram that shows the information flow and operations on that information as it moves throughout a program or process.

        Data Object. An object that is an abstraction of data. For example, a patient's file in a hospital could be a data object. Typical visualization objects include structured grids and volumes. See also process object .

        Data Member. A named member of a class that captures some characteristic of the class. Data members have a name, a data type, and a data value. This is the same as an attribute or instance variable.

        Data Visualization. The process of transforming data into sensory stimuli, usually visual images. Data visualization is a general term, encompassing data from engineering and science, as well as information from business, finance, sociology, geography, information management, and other fields. Data visualization also includes elements of data analysis, such as statistical analysis. Contrast with scientific visualization and information visualization .

        Decimation. A type of polygon reduction technique that deletes points in a polygonal mesh that satisfies a co-planar or co-linear condition and replaces the resulting hole with a new triangulation.

        Delaunay Triangulation. A triangulation that satisfies the Delaunay circumsphere criterion. This criterion states that a circumsphere of each simplex in the triangulation contains only the points defining the simplex.

        Delegation. The process of assigning an object to handle the execution of another object's methods. Sometimes it is said that one object forwards certain methods to another object for execution.

        Demand-driven. A method of visualization pipeline update where the update occurs only when data is requested and occurs only in the portion of the network required to generate the data.

        Derived Class. A class that is more specific or complete than its superclass. The derived class, which is also known as the subclass, inherits all the members of its superclass. Usually a derived class adds new functionality or fills in what was defined by its superclass. See also subclass .

        Destructor. A class method that is invoked when an instance of that class is deleted. Typically the destructor frees memory that the instance was using. See also constructor .

        Device Mapper. A mapper that interfaces data to a graphics library or subsystem.

        Diffuse Lighting. Reflected light from a matte surface. Diffuse lighting is a function of the relative angle between the incoming light and surface normal of the object.

        Displacement Plots. A vector visualization technique that shows the displacement of the surface of an object. The method generates scalar values by computing the dot product between the surface normal and vector displacement of the surface. The scalars are visualized using color mapping.

        Display Coordinate System. A coordinate system that is the result of mapping the view coordinate system onto the display hardware.

        Divergence. In numerical computation: the tendency of computation to move away from the solution. In fluid flow: the rapid motion of fluid particles away from one another.

        Dividing Cubes. A contour algorithm that represents isosurfaces as a dense cloud of points.

        Dolly. A camera operation that moves the camera position towards (

        from the camera focal point.

        dolly in ) or away (

        dolly out )

        Double Buffering. A display technique that is used to display animations more smoothly. It consists of using two buffers in the rendering process. While one buffer is being displayed, the next frame in the animation is being drawn on the other buffer. Once the drawing is complete the two buffers are swapped and the new image is displayed.

        Dynamic Memory Model. A data flow network that does not retain intermediate results as it executes. Each time the network executes, it must recompute any data required as input to another process object. A dynamic memory model reduces system memory requirements but places greater demands on computational requirements.

        Dynamic Model. A description of a system concerned with synchronizing events and objects.

        Effective Stress. A mathematical combination of the normal and shear stress components that provide a measure of the stress at a point. Effective stress is a scalar value, while stress is represented with a tensor value. See stress .

        Eigenfields. Vector fields defined by the eigenvectors of a tensor.

        Eigenvalue. A characteristic value of a matrix. Eigenvalues often correspond to physical phenomena, such as frequency of vibration or magnitude of principal components of stress.

        Eigenvector. A vector associated with each eigenvalue. The eigenvector spans the space of the matrix. Eigenvectors are orthogonal to one another. Eigenvectors often correspond to physical phenomena such as mode shapes of vibration.

        Elevation. A rotation of a camera about the horizontal axis.

        Entity. Something within a system that has identity. Chairs, airplanes, and cameras are things that correspond to physical entities in the real world. A database and isosurface algorithm are examples of nonphysical entities.

        Event-driven. A method of visualization pipeline update where updates occur when an event

        affects the pipeline, e.g., when an object instance variable is set or modified. See also demand-driven.

        Execution. The process of updating a visualization network.

        Explicit Execution. Controlling network updates by performing explicit dependency analysis.

        Exporter. An object that saves a VTK scene definition to a file or other program. (A scene consists of lights, cameras, actors, geometry, properties, texture, and other pertinent data.) See also importer .

        Fan-in. The flow of multiple pieces of data into a single filter.

        Fan-out. The flow of data from a filter's output to other objects.

        Feature Angle. The angle between surface normal vectors, e.g., the angle between the normal vectors on two adjacent polygons.

        Filter. A process object that takes at least one input and generates at least one output.

        Finite Element Method (FEM). A numerical technique for the solution of partial differential equations. FEM is based on discretizing a domain into elements (and nodes) and constructing basis (or interpolation) functions across the elements. From these functions a system of linear equations is generated and solved on the computer. Typical applications include stress, heat transfer, and vibration analysis.

        Finite Difference Method. A numerical technique for the solution of partial differential equations (PDEs). Finite difference methods replace the PDEs with truncated Taylor series approximations. This results in a system of equations that is solved on a computer. Typical applications include fluid flow, combustion, and heat transfer.

        Flat Shading. A shading technique where the lighting equation for a geometric primitive is calculated once, and then used to fill in the entire area of the primitive. This is also known as faceted shading. See also gouraud shading and phong shading .

        Functional Model. The description of a system based on what it does.

        Generalization. The abstraction of a subset of classes to a common superclass. Generalization extracts the common members or methods from a group of classes to create a common superclass. See also specialization and inheritance .

        Geometry. Used generally to mean the characteristic position, shape, and topology of an object.

        Used specifically (in tandem with topology) to mean the position and shape of an object.

        Glyph. A general visualization technique used to represent data using a meaningful shape or pictorial representation. Each glyph is generally a function of its input data and may change size, orientation, and shape; or modify graphics properties in response to changes in input.

        Gouraud Shading. A shading technique that applies the lighting equations for a geometric primitive at each vertex. The resulting colors are then interpolated over the areas between the vertices. See also flat shading and Phong shading .

        Hedgehog. A vector visualization technique that represents vector direction and magnitude with oriented lines.

        Height Field. A set of altitude or height samples in a rectangular grid. Height fields are typically used to represent terrain.

        Hexahedron. A type of primary 3D cell. The hexahedron looks like a \"brick.\" It has six faces, 12 edges, and eight vertices. The faces of the hexahedron are not necessarily planar.

        Homogeneous Coordinates. An alternate coordinate representation that provides more flexibility than traditional Cartesian coordinates. This includes perspective transformation and combined translation, scaling, and rotation.

        Hyperstreamline. A tensor visualization technique. Hyperstreamlines are created by treating the eigenvectors as three separate vectors. The maximum eigenvalue/eigenvector is used as a vector field in which particle integration is performed (like streamlines). The other two vectors control the cross-sectional shape of an ellipse that is swept along the integration path. See also streampolygon .

        Image Data. A dataset whose structure is both geometrically and topologically regular. Both geometry and topology are implicit. A 3D image dataset is known as a volume. A 2D image dataset is known as a pixmap.

        Image-Order Techniques. Rendering techniques that determine for each pixel in the image plane which data samples contribute to it. Image-order techniques are implemented using ray casting. Contrast with object-order techniques .

        Implicit Execution. Controlling network updates by distributing network dependency throughout the visualization process objects. Each process object requests that its input be updated before it executes. This results in a recursive update/execution process throughout the network.

        Implicit Function. A mathematical function of the form , whereFxyz(),, c is a constant=.

        Implicit Modelling. A modelling technique that represents geometry as a scalar field. Usually the scalar is a distance function or implicit function distributed through a volume.

        Importer. An object that interfaces to external data or programs to define a complete scene in VTK. (The scene consists of lights, cameras, actors, geometry, properties, texture, and other pertinent data.) See also exporter .

        Information Visualization. The process of transforming information into sensory stimuli, usually visual images. Information visualization is used to describe the process of visualizing data without structure, such as information on the World Wide Web; or abstract data structures, like computer file systems or documents. Contrast with scientific visualization and data visualization .

        Inheritance. A process where the attributes and methods of a superclass are bestowed upon all sub-classes derived from that superclass. It is said that the subclasses inherit their superclasses' methods and attributes.

        Instance. An object that is defined by a class and used by a program or application. There may be many instances of a specific class.

        Instance Variable. A named member of a class that captures a characteristic of the class. Instance variables have a name, a data type, and a data value. The phrase, instance variable, is often abbreviated as ivar. This is the same as an attribute or data member.

        Intensity. The light energy transferred per unit time across a unit plane perpendicular to the light rays.

        Interpolate.

        that bracket

        Estimate a value of a function at a point p.

        p, given known function values and points

        Interpolation Functions. Functions continuous in value and derivatives used to interpolate data from known points and function values. Cells use interpolation functions to compute data values interior to or on the boundary of the cell.

        Interpreted System. An interpreted system can execute programs without going through a separate compilation stage. Interpreted systems often allow the user to interact and modify the program as it is running. Contrast with compiled systems .

        Irregular Data. Data in which the relationship of one data item to the other data items in the dataset is arbitrary. Irregular data is also known as unstructured data.

        Iso-parametric. A form of interpolation in which interpolation for data values is the same as for the local geometry. Compare with sub-parametric and super-parametric .

        Isosurface. A surface representing a constant valued scalar function. See contouring .

        Isovalue. The scalar value used to generate an isosurface.

        Jacobian. A matrix that relates one coordinate system to another.

        Line. A cell defined by two points.

        MRI (Magnetic Resonance Imaging). A data acquisition technique based on measuring variation in magnetic field in response to radio-wave pulses. The data is acquired in a 3D region as a series of slice planes (i.e., a stack of n^2 points).

        Mapper. A process object that terminates the visualization network. It maps input data into graphics libraries (or other devices) or writes data to disk (or a communication device).

        Manifold Topology. A domain is manifold at a point p in a topological space of dimension n if the

        neighborhood around p is homeomorphic to an n-dimensional sphere. Homeomorphic means that the mapping is one to one without tearing (i.e., like mapping a rubber sheet from a square to a disk). We generally refer to an object's topology as manifold if every point in the object is manifold. Contrast with nonmanifold topology .

        Marching Cubes. A contouring algorithm to create surfaces of constant scalar value in 3D. Marching cubes is described for volume datasets, but has been extended to datasets consisting of other cell types.

        Member Function. A member function is a function or transformation that can be applied to an object. It is the functional equivalent to a data member. Member functions define the behavior of an object. Methods, operations, and member functions are essentially the same.

        Method. A function or transformation that can be applied to an object. Methods define the behavior of an object. Methods, operations, and member functions are essentially the same.

        Modal Lines. Lines on the surface of a vibrating object that separate regions of positive and negative displacement.

        Mode Shape. The motion of an object vibrating at a natural frequency. See also eigenvalues and

        eigenvectors .

        Model Coordinate System. The coordinate system that a model or geometric entity is defined in.

        There may be many different model coordinate systems defined for one scene.

        Motion Blur. An artifact of the shutter speed of a camera. Since the camera's shutter stays open for a finite amount of time, changes in the scene that occur during that time can result in blurring of the resulting image.

        Morph. A progressive transformation of one object into another. Generally used to transform images (2D morphing) and in some cases geometry (3D morphing).

        Multiple Input. Process objects that accept more than one input.

        Multiple Output. Process objects that generate more than one output.

        Multidimensional Visualization. Visualizing data of four or more variables. Generally requires a mapping of many dimensions into three or fewer dimensions so that standard visualization techniques can be applied.

        Nonmanifold Topology. Topology that is not manifold. Examples include polygonal meshes, where an edge is used by more than two polygons, or polygons connected to each other at their vertices (i.e., do not share an edge). Contrast with manifold topology .

        Normal. A unit vector that indicates perpendicular direction to a surface. Normals are a common type of data attribute.

        Object. An abstraction that models the state and behavior of entities in a system. Instances and classes are both objects.

        Object Model. The description of a system in terms of the components that make up the system, including the relationship of the components one to another.

        Object-Order Techniques. Rendering techniques that project object data (e.g., polygons or voxels) onto the image plane. Example techniques include ordered compositing and splatting.

        Object-Oriented. A software development technique that uses objects to represent the state and behavior of entities in a system.

        Octree Decomposition. A technique to decompose a cubical region of three-dimensional space into smaller cubes. The cubes, or octants, are related in tree fashion. The root octant is the cubical region. Each octant may have eight children created by dividing the parent in half in the x, y, and z directions.

        Object Factory. An object used to construct or instantiate other objects. In VTK, object factories are implemented using the class method New().

        OMT. Object Modelling Technique . An object-oriented design technique that models software systems with object, dynamic, and functional diagrams.

        Operation. A function or transformation that can be applied to an object. Operations define the behavior of an object. Methods and member functions implement operations.

        Overloading. Having multiple methods with the same name. Some methods are overloaded because there are different versions of the same method. These differences are based on argument types, while the underlying algorithm remains the same. Contrast with polymorphic .

        Painter's Algorithm. An object-order rendering technique that sorts rendering primitives from back to front and then draws them.

        Parametric Coordinates. A coordinate system natural to the geometry of a geometric object. For example, a line may be described by the single coordinate s even though the line may lie in three or higher dimensions.

        Parallel Projection. A mapping of world coordinates into view coordinates that preserves all parallel lines. In a parallel projection an object will appear the same size regardless of how far away it is from the viewer. This is equivalent to having a center of projection that is infinitely far away. Contrast with perspective projection .

        Particle Trace. The trajectory that particles trace over time in fluid flow. Particle traces are everywhere tangent to the velocity field. Unlike streamlines, particle lines are time-dependent.

        Pathline. The trajectory that a particle follows in fluid flow.

        Perspective Projection. A mapping of world coordinates into view coordinates that roughly approximates a camera lens. Specifically, the center of projection must be a finite distance from the

        view plane. As a result closer, objects will appear larger than distant objects. Contrast with parallel projection .

        Phong Shading. A shading technique that applies the lighting equations for a geometric primitive at each pixel. See also flat shading and Gouraud shading .

        Pitch. A rotation of a camera's position about the horizontal axis, centered at its viewpoint. See also yaw and roll. Contrast with elevation .

        Pixel. Short for picture element. Constant valued elements in an image. In VTK, a two-dimensional cell defined by an ordered list of four points.

        Point. A geometric specification of position in 3D space.

        Point Attributes. Data attributes associates with the points of a dataset.

        Polygon. A cell consisting of three or more co-planar points defining a polygon. The polygon can be concave but without imbedded loops.

        Polygonal Data. A dataset type consisting of arbitrary combinations of vertices, polyvertices, lines, polylines, polygons, and triangle strips. Polygonal data is an intermediate data form that can be easily rendered by graphics libraries, and yet can represent many types of visualization data.

        Polygon Reduction. A family of techniques to reduce the size of large polygonal meshes. The goal is to reduce the number of polygons, while preserving a \"good\" approximation to the original geometry. In most techniques topology is preserved as well.

        Polyline.

        A composite cell consisting of one or more lines.

        Polymorphic. Having many forms. Some methods are polymorphic because the same method in

        different classes may implement a different algorithm. The semantics of the method are typically

        the same, even though the implementation may differ. Contrast with overloading .

        Polyvertex.

        A composite cell consisting of one or more vertices.

        Primary Cell.

        A cell that is not defined in terms of other cells.

        Probing. Also known as sampling or resampling. A data selection technique that selects data at a

        set of points.

        Process Object. A visualization object that is an abstraction of a process or algorithm. For example, the isosurfacing algorithm marching cubes is implemented as a process object. See also data object.

        Progressive Mesh. A representation of a triangle mesh that enables incremental refinement and

        derefinement. The data representation is compact and is useful for transmission of 3D triangle

        meshes across a network. See also polygon reduction .

        Properties. A general term used to describe the rendered properties of an actor. This includes lighting terms such as ambient, diffuse, and specular coefficients; color and opacity; shading techniques such as flat and Gouraud; and the actor's geometric representation (wireframe, points, or surface).

        Pyramid. A type of primary 3D cell. The pyramid has a quadrilateral base connected to a single apex point. It has five faces, eight edges, and five vertices. The base face of the pyramid is not necessarily planar.

        Quadric. A function of the form

        f(x,y,z) = a_0x^2 + a_1y^2 + a_2z^2 + a_3xy + a_4yz + a_5xz + a_6 x + a_7 y + a_8 z + a_9

        The quadric equation can represent many useful 3D objects such as spheres, ellipsoids, cylinders, and cones.

        Quadratic Edge. A type of primary 1D cell with a quadratic interpolation function. The quadratic edge is defined by three points: two end points and a mid-edge node.

        Quadratic Triangle. A type of primary 2D cell with quadratic interpolation functions. The quadratic triangle is defined by six points: three corner points and three mid-edge nodes.

        Quadratic Quadrilateral. A type of primary 2D cell with quadratic interpolation functions. The quadratic quadrilateral is defined by eight points: four corner points and four mid-edge nodes.

        Quadratic Tetrahedron. A type of primary 3D cell with quadratic interpolation functions. The quadratic tetrahedron is defined by ten points: four corner points and six mid-edge nodes.

        Quadratic Hexahedron. A type of primary 3D cell with quadratic interpolation functions. The quadratic edge is defined by twenty points: eight corner points and twelve mid-edge nodes.

        Quadrilateral (Quad). A type of primary 2D cell. The quadrilateral is four sided with four vertices. The quadrilateral must be convex.

        Reader. A source object that reads a file or files and produces a data object.

        Reference Counting. A memory management technique used to reduce memory requirements. Portions of memory (in this case objects) may be referenced by more than one other object. The referenced object keeps a count of references to it. If the count returns to zero, the object deletes itself, returning memory back to the system. This technique avoids making copies of memory.

        Region of Interest. A portion of a dataset that the user is interested in visualizing. Sometimes abbreviated ROI.

        Regular Data. Data in which one data item is related (either geometrically or topologically) to other data items. Also referred to as structured data.

        Rendering. The process of converting object geometry (i.e., geometric primitives), object properties, and a specification of lights and camera into an image. The primitives may take many forms including surface primitives (points, lines, polygons, splines), implicit functions, or volumes.

        Resonant Frequency. A frequency at which an object vibrates.

        Roll. A rotation of a camera about its direction of projection. See also azimuth , elevation , pitch, and yaw.

        Sampling. Selective acquisition or sampling of data, usually at a regular interval. See also probing .

        Scalar. A single value or function value. May also be used to represent a field of such values.

        Scalar Range. The minimum and maximum scalar values of a scalar field.

        Scalar Generation. Creating scalar values from other data such as vectors or tensors. One example is computing vector norm.

        Scene. A complete representation of the components required to generate an image or animation including lights, cameras, actors. properties, transformations, geometry, texture, and other pertinent information.

        Scene Graph. A hierarchical, acyclic, directed tree representation of a scene. The graph order (depth first) controls when objects are processed by the graphics system.

        Scientific Visualization. The process of transforming data into sensory stimuli, usually visual images. Generally used to denote the application of visualization to the sciences and engineering. Contrast with data visualization and information visualization .

        Searching. The process of locating data. Usually the search is based on spatial criteria such as position or being inside a cell.

        Segmentation. Identification and demarcation of tissue types. Segmentation is generally applied to CT and MRI data to associate soft tissue with a particular body organ or anatomical structure.

        Simplex. The convex combination of n independent vectors in n-space forms an n-dimensional simplex. Points, lines, triangles, and tetrahedra are examples of simplices in 0D, 1D, 2D, and 3D.

        Source. A process object that produces at least one output. Contrast with filter .

        Specialization. The creation of subclasses that are more refined or specialized than their super-class. See also generalization and inheritance .

        Specular Lighting. Reflected lighting from a shiny surface. Specular lighting is a function of the relative angle between the incoming light, the surface normal of the object, and the view angle of the observer.

        Splatting. A method to distribute data values across a region. The distribution functions are often based on Gaussian functions.

        State Diagram. A diagram that relates states and events. Used to describe behavior in a software system.

        Static Memory Model. A data flow network that retains intermediate results as it executes. A static memory model minimizes computational requirements, but places greater demands on memory requirements.

        Strain. A nondimensional quantity expressed as the ratio of the displacement of an object to its length (normal strain), or angular displacement (shear strain). Strain is a tensor quantity. See also stress .

        Stress. A measure of force per unit area. Normal stress is stress normal to a given surface, and is either compressive (a negative value) or tensile (a positive value). Shear stress acts tangentially to a given surface. Stress is related to strain through the linear proportionality constants (theE modulus of elasticity), (Poisson's ratio), and (modulusG of elasticity in shear). Stress is a tensor quantity. See also strain .

        Streakline. The set of particles that have previously passed through a particular point.

        Streamline. Curves that are everywhere tangent to the velocity field. A streamline satisfies the integral curve \\frac{\\text{d}\\overrightarrow{x}}{\\text{d}s} = \\overrightarrow{v}(x,t') at sonme time t'.

        Streampolygon. A vector and tensor visualization technique that represents flow with tubes that have polygonal cross sections. The method is based on integrating through the vector field and then sweeping a regular polygon along the streamline. The radius, number of sides, shape, and rotation of the polygon are allowed to change in response to data values. See also hyperstreamline .

        Streamribbon. A vector visualization technique that represents vectors with ribbons that are everywhere tangent to the vector field

        Streamsurface . A surface that is everywhere tangent to a vector field. Can be approximated by generating a series of streamlines along a curve and connecting the lines with a surface.

        Streamwise Vorticity. A measure of the rotation of flow around a streamline.

        Structured Data. Data in which one data item is related (either geometrically or topologically) to other data items. Also referred to as regular data.

        Structured Grid. A dataset whose structure is topologically regular but whose geometry is irregular. Geometry is explicit and topology is implicit. Typically, structured grids consist of hexahedral cells.

        Structured Points. Preferred term is Image Data . A dataset whose structure is both geometrically and topologically regular. Both geometry and topology are implicit. A 3D structured point dataset is known as a volume. A 2D structured point dataset is known as a pixmap.

        Subclass. A class that is more specific or complete than its superclass. The subclass, which is also known as the derived class, inherits all the members of its superclass. Usually a subclass will add some new functionality or fill in what was defined by its superclass. See also derived class .

        Sub-parametric. A form of interpolation in which interpolation for data values is of higher order than that for the local geometry. Compare with iso-parametric and super-parametric .

        Subsampling. Sampling data at a resolution at less than final display resolution.

        Superclass. A class from which other classes are derived. See also base class .

        Super-parametric. A form of interpolation in which interpolation for data values is of lower order than that for the local geometry. Compare with iso-parametric and sub-parametric .

        Surface Rendering. Rendering techniques based on geometric surface primitives such as points, lines, polygons, and splines. Contrast with volume rendering .

        Swept Surface.

        The surface that an object creates as it is swept through space.

        Swept Volume.

        The volume enclosed by a swept surface.

        Tcl.

        An interpreted language developed by John Ousterhout in the early 1980s.

        Tk.

        A graphical user-interface toolkit based on Tcl.

        Tensor. A mathematical generalization of vectors and matrices. A tensor of rank k can be considered a k-dimensional table. Tensor visualization algorithms treat 3 x 3 real symmetric matrix tensors (rank 2 tensors).

        Tensor Ellipsoid. A type of glyph used to visualize tensors. The major, medium, and minor eigenvalues of a tensor define an ellipsoid. The eigenvalues are used to scale along the axes.

        Tetrahedron. A 3D primary cell that is a simplex with four triangular faces, six edges, and four vertices.

        Texture Animation. Rapid application of texture maps to visualize data. A useful example maps a 1D texture map of varying intensity along a set of lines to simulate particle flow.

        Texture Coordinate. Specification of position within texture map. Texture coordinates are used to map data from Cartesian system into 2D or 3D texture map.

        Texture Map. A specification of object properties in a canonical region. These properties are most often intensity, color, and alpha, or combinations of these. The region is typically a structured array of data in a pixmap (2D) or in a volume (3D).

        Texture Mapping. A rendering technique to add detail to objects without requiring extensive geometric modelling. One common example is to paste a picture on the surface of an object.

        Texture Thresholding. Using texture mapping to display selected data. Often makes use of alpha opacity to conceal regions of minimal interest.

        Thresholding. A data selection technique that selects data that lies within a range of data. Typically scalar thresholding selects data whose scalar values meet a scalar criterion.

        Topology. A subset of the information about the structure of a dataset. Topology is a set of properties invariant under certain geometric transformation such as scaling, rotation, and translation.

        Topological Dimension. The dimension or number of parametric coordinates required to address the domain of an object. For example, a line in 3D space is of topological dimension one because the line can be parametrized with a single parameter.

        Transformation Matrix. A matrix of values used to control the position, orientation, and scale of objects.

        Triangle Strip. A composite 2D cell consisting of triangles. The triangle strip is an efficient representation scheme for triangles where points n + 2 can represent n triangles.

        Triangle. A primary 2D cell. The triangle is a simplex with three edges and three vertices.

        Triangular Irregular Network (TIN). An unstructured triangulation consisting of triangles. Often used to represent terrain data.

        Triangulation. A set of nonintersecting simplices sharing common vertices, edges, and/or faces.

        Type Converter . A type of filter used to convert from one dataset type to another.

        Type Checking. The process of enforcing compatibility between objects.

        Uniform Grid. A synonym for image data.

        Unstructured Data. Data in which one data item is unrelated (either geometrically or topologically) to other data items. Also referred to as irregular data.

        Unstructured Grid. A general dataset form consisting of arbitrary combinations of cells and points. Both the geometry and topology are explicitly defined.

        Unstructured Points. A dataset consisting of vertex cells that are positioned irregularly in space, with no implicit or explicit topology.

        Visualization. The process of converting data to images (or other sensory stimuli). Alternatively, the end result of the visualization process.

        Vector. A specification of direction and magnitude. Vectors can be used to describe fluid velocity, structural displacement, or object motion.

        Vector Field Topology. Vector fields are characterized by regions flow diverges, converges, and/or rotates. The relationship of these regions one to another is the topology of the flow.

        Vertex. A primary 0D cell. Is sometimes used synonymously with point or node.

        View Coordinate System. The projection of the world coordinate system into the camera's viewing frustrum.

        View Frustrum. The viewing region of a camera defined by six planes: the front and back clipping planes, and the four sides of a pyramid defined by the camera position, focal point, and view angle (or image viewport if viewing in parallel projection).

        Visual Programming. A programming model that enables the construction and manipulation of visualization applications. A typical implementation is the construction of a visualization pipeline by connecting execution modules into a network.

        Visualization Network. A series of process objects and data objects joined together into a dataflow network.

        Volume. A regular array of points in 3D space. Volumes are often defined as a series of 2D images arranged along the z-axis.

        Volume Rendering. The process of directly viewing volume data without converting the data to intermediate surface primitives. Contrast with surface rendering .

        Vorticity. A measure of the rotation of fluid flow.

        Voxel. Short for volume element. In VTK, a primary three-dimensional cell with six faces. Each face is perpendicular to one of the coordinate axes.

        Warping. A scalar and vector visualization technique that distorts an object to magnify the effects of data value. Warping may be used on vector data to display displacement or velocity, or on scalar data to show relative scalar values.

        Wedge. A type of primary 3D cell. The wedge has two triangular faces connected with three quadrilateral faces. It has five faces, nine edges, and six vertices. The quadrilateral faces of the wedge are not necessarily planar.

        World Coordinate System. A three-dimensional Cartesian coordinate system in which the main elements of a rendering scene are positioned.

        Writer. A type of mapper object that writes data to disk or other I/O device.

        Yaw. A rotation of a camera's position about the vertical axis, centered at its viewpoint. See also pitch and roll. Contrast with azimuth .

        Z-Buffer. Memory that contains the depth (along the view plane normal) of a corresponding element in a frame buffer.

        Z-Buffering. A technique for performing hidden line (point, surface) removal by keeping track of the current depth, or z value for each pixel. These values are stored in the z-buffer.

        Zoom. A camera operation that changes the field of view of the camera. Contrast with dolly.

        "},{"location":"VTKBookLaTeX/VTKTextBook/","title":"VTK Textbook - PDF Version","text":"

        Note

        For Developers: The files for the LaTeX version have been moved to the VTK repository textbook, if you wish to contribute, please fork a branch from textbook.

        "},{"location":"VTKBookLaTeX/VTKTextBook/#introduction","title":"Introduction","text":"

        This is a PDF version of the VTK Textbook. It has updated equations and figures and is fully cross-referenced and indexed. As further development occurs this text book will be updated on a rolling basis.

        You can view/download it from here: VTKTextBook

        "},{"location":"WASM/1_WASM/","title":"Interactive examples (only available for Cxx examples)","text":""},{"location":"WASM/1_WASM/#what-is-webassembly","title":"What is WebAssembly ?","text":"

        WebAssembly (WASM for short) is a technology which allows a C/C++ code to be executed by the web browser as if it was a JS script.

        It allows integration of small bits of code inside a web page, and even full size web apps that are derived from a desktop app.

        For more examples of what WASM is able to do, take a look at Made with WebAssembly.

        "},{"location":"WASM/1_WASM/#vtk-wasm","title":"VTK-WASM","text":"

        By making VTK able to use WebGL instead of the usual OpenGL, we have been able to build VTK for WebAssembly. Not all modules are available but we keep on improving VTK-WASM, and this website is a display of what is working, and what is not.

        If you want to build your own VTK project in WebAssembly, take a look here.

        If your browser is having issues loading or running WASM examples, ensure Hardware Acceleration is enabled, and if you have a GPU, that it's in use. Be aware that some examples can be highly resource intensive and therefore not run well in small hardware configurations (thus provoke instability for your browser). VTK-WASM is still experimental so it could have issues. Feel free to report these to VTK Gitlab so we can keep on improving stability and support for VTK-Examples-WASM.

        "},{"location":"WASM/2_NoWASMIntegration/","title":"Examples excluded from WASM","text":"

        Some examples do not implement a live preview feature in WebAssembly. There are the reasons:

        "},{"location":"WASM/2_NoWASMIntegration/#no-render","title":"No render","text":"

        A lot of examples are here to show pipelines, algorithms, or utils that does not always have a render (or whose render is not important), so we chose not to display a live preview of those that would only show you text.

        "},{"location":"WASM/2_NoWASMIntegration/#incompatible-dependencies","title":"Incompatible dependencies","text":"

        Some examples use external dependencies that either could not be built in WebAssembly (Qt) or are not Open Source (RenderMan).

        Some VTK modules aren't WASM-compatible or not fully working, like RenderingContextOpenGL2 or RenderingGL2PSOpenGL2. Those can break some examples that are then removed from VTK-Examples-WASM:

        • Images/CombineImages

        • Plotting/ChartMatrix, ChartOn3DScene, Diagram, MultiplePlots, ScatterPlot, SurfacePlot

        "},{"location":"WASM/2_NoWASMIntegration/#irrelevant-features","title":"Irrelevant features","text":"

        A few examples use features that aren't relevant with WebAssembly usage (FullScreen, OpenVR).

        There are examples which are just here to show different arguments for the same code (Rotations{A,B,C,D}, WalkCow{A,B}...). Those are also removed for practical reasons.

        "},{"location":"WASM/2_NoWASMIntegration/#technical-considerations","title":"Technical considerations","text":"

        In order to improve build times, stability and bandwidth, vtk-examples-wasm does not use Boost Library features even though it is provided by Emscripten Ports. This forces us to remove a few examples:

        • Graphs/AdjacentVertexIterator, BoostBreadthFirstSearchTree

        • InfoVis/MutableGraphHelper

        Second issue: VTK is initially writen for OpenGL2. As VTK-WASM uses WebGL2 (OpenGL ES3), a lot of features need to be rewritten to comply with WebGL standards. It takes a lot of time, and a few examples will have to wait to be fully integrated:

        • Shaders/BozoShader, BozoShaderDemo, CubeMap, MarbleShader, MarbleShaderDemo, SpatterShader

        • Visualization/CorrectlyRenderTranslucentGeometry

        • VolumeRendering/RayCastIsosurface

        At last, the fact that WebAssembly runs within the browser implies that resources are limited for the programs. We cannot give too much memory or workload to a single-threaded program running inside a browser tab.

        • Meshes/SubdivisionDemo requires ~1GB of memory to run a sufficient number of passes

        • Visualization/FroggieSurface needs to allocate a single array of 2GB.

        "},{"location":"WASM/2_NoWASMIntegration/#full-list-of-excludedunstable-examples","title":"Full list of excluded/unstable examples:","text":""},{"location":"WASM/2_NoWASMIntegration/#animation","title":"Animation","text":"
        • AnimateActors: No animation
        "},{"location":"WASM/2_NoWASMIntegration/#datastructures","title":"DataStructures","text":"
        • VisualizeKDTree: Works but error: Built-in Dual Depth Peeling is not supported on ES3
        "},{"location":"WASM/2_NoWASMIntegration/#explicitstructuredgrid","title":"ExplicitStructuredGrid","text":"
        • CreateESGrid: ESGrid isn't rendered
        "},{"location":"WASM/2_NoWASMIntegration/#io","title":"IO:","text":"
        • ReadCML: vtkShaderProgram: Links failed: Varying vertexVCGSOutput has static-use in the frag shader, but is undeclared in the vert shader
        "},{"location":"WASM/2_NoWASMIntegration/#imagedata","title":"ImageData:","text":"
        • ImageDataGeometryFilter, ImageNormalize, ImageWeightedSum: no error but render inaccurate with the screenshot
        "},{"location":"WASM/2_NoWASMIntegration/#images","title":"Images:","text":"
        • BackgroundImage: Background render broken

        • CombineImages: Error: GLctx is undefined

        • CombiningRGBChannels, ImageContinuousDilate3D, ImageContinuousErode3D, ImageCorrelation, ImageDifference, ImageMapper, ImageSobel2D, ImageText, ResizeImage: no error but render inaccurate with the screenshot

        • RGBToYIQ: error YIQ color space requires negative numbers

        "},{"location":"WASM/2_NoWASMIntegration/#infovis","title":"InfoVis:","text":"
        • DelimitedTextReader: uncaught exception
        "},{"location":"WASM/2_NoWASMIntegration/#interaction","title":"Interaction:","text":"
        • UserEvent: does not compile: vtkTestFilter.h file not found
        "},{"location":"WASM/2_NoWASMIntegration/#lighting","title":"Lighting:","text":"
        • Light, LightActor: No render of lights
        "},{"location":"WASM/2_NoWASMIntegration/#medical","title":"Medical:","text":"
        • MedicalDemo4: vtkTextureObject: failed to determine texture parameters
        "},{"location":"WASM/2_NoWASMIntegration/#meshes","title":"Meshes:","text":"
        • PointInterpolator: uncaught exception 1584136
        "},{"location":"WASM/2_NoWASMIntegration/#modelling","title":"Modelling:","text":"
        • Delaunay3DDemo: no slider

        • MarchingCubes: no error but render inaccurate with the screenshot

        "},{"location":"WASM/2_NoWASMIntegration/#picking","title":"Picking:","text":"
        • HighlightSelectedPoints: selection is \"all or nothing\", unable to select a portion of the points
        "},{"location":"WASM/2_NoWASMIntegration/#plotting","title":"Plotting:","text":"
        • ChartMatrix, ChartOn3DScene, MultiplePlots, ScatterPlot: points size too small

        • Diagram: default view shows only half the image, full tab images works well

        • PlotLine3D, SurfacePlot: Shader does not compile: Uniform numClipPlanes is not linkable between attached shaders

        "},{"location":"WASM/2_NoWASMIntegration/#points","title":"Points:","text":"
        • CompareExtractSurface, PoissonExtractSurface: does not compile: vtkPoissonReconstruction.h file not found

        • ExtractEnclosedPoints: works but error in console: vtkMultiThreader unable to create a thread

        • PowercrustExtractSurface: does not compile: vtkPowerCrustSurfaceReconstruction.h file not found

        "},{"location":"WASM/2_NoWASMIntegration/#polydata","title":"PolyData:","text":"
        • ExternalContour: no render of the left element

        • HighlightBadCells: doesn't highlight

        "},{"location":"WASM/2_NoWASMIntegration/#rendering","title":"Rendering:","text":"
        • OutlineGlowPass: No outline

        • PBR_HDR_Environment: No mipmap generation

        "},{"location":"WASM/2_NoWASMIntegration/#shaders","title":"Shaders:","text":"
        • BozoShader, BozoShaderDemo, CubeMap, MarbleShader, MarbleShaderDemo, SpatterShader: could not compile vtkShaderProgram
        "},{"location":"WASM/2_NoWASMIntegration/#structuredgrid","title":"StructuredGrid:","text":"
        • BlankPoint: result unaccurate with screenshot
        "},{"location":"WASM/2_NoWASMIntegration/#texture","title":"Texture:","text":"
        • AnimateVectors: Animation not working
        "},{"location":"WASM/2_NoWASMIntegration/#utilities","title":"Utilities:","text":"
        • RenderScalarToFloatBuffer: warning: readPixels: Format and type RED/FLOAT incompatible with this RGBA32F attachment
        "},{"location":"WASM/2_NoWASMIntegration/#visualization","title":"Visualization:","text":"
        • ChooseTextColorDemo: no text shown

        • CorrectlyRenderTranslucentGeometry: works but Error: Built in Dual Depth Peeling is not supported on ES3

        • EdgePoints: doesn't show the model

        • ExtrudePolyDataAlongLine: does not compile: vtkFrenetSerretFrame.h not found

        • FroggieSurface: WebGL2RenderingContext.bufferData: Argument 2 can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB

        • RandomProbe: Error: indirect call to null

        • LabeledMesh: Labels display at random positions

        • TextureMapImageData: no texture

        "},{"location":"WASM/2_NoWASMIntegration/#volumerendering","title":"VolumeRendering:","text":"
        • FixedPointVolumeRayCastMapperCT, MinIntensityRendering, SimpleRayCast: Failed to determine texture parameters

        • RayCastIsosurface: shader failed to compile

        "},{"location":"WASM/2_NoWASMIntegration/#widgets","title":"Widgets:","text":"
        • CameraOrientationWidget: Widget not showing

        • SeedWidgetImage: image rendering broken

        "},{"location":"WASM/3_BuildingWASM/","title":"Building an example in WASM","text":"

        To build an example you downloaded from VTK Examples in WebAssembly, you are going to need to download the tarball of the example and extract it.

        tar xf example.tar.gz\ncd example\n

        Then, remove the CMakeLists.txt file from the extracted tarball. Now follow the instructions from the contribution guidelines to create the new CMakeLists.txt and index.html.

        "},{"location":"WASM/3_BuildingWASM/#building-vtk","title":"Building VTK","text":"

        To build an example using WebAssembly, you can use the kitware/vtk-wasm docker image but some modules are disabled in that version that may be needed for many examples.

        To build VTK by yourself, you will need to download VTK source code and then follow the instructions in this documentation article, except that at the first step of the build, you will have to change the configuration command to:

        emcmake cmake \\\n        -S /work/src \\\n        -B /work/build-vtk-wasm \\\n        -GNinja \\\n        -DBUILD_SHARED_LIBS:BOOL=OFF \\\n        -DCMAKE_BUILD_TYPE:STRING=Release \\\n        -DVTK_ENABLE_LOGGING:BOOL=OFF \\\n        -DVTK_ENABLE_WRAPPING:BOOL=OFF \\\n        -DVTK_MODULE_ENABLE_VTK_cli11:STRING=YES \\\n        -DVTK_MODULE_ENABLE_VTK_RenderingLICOpenGL2:STRING=DONT_WANT \\\n        -DVTK_BUILD_TESTING=ON \\\n        -DCMAKE_INSTALL_PREFIX=/install\n
        "},{"location":"WASM/3_BuildingWASM/#building-the-example","title":"Building the example","text":"

        To build your example, simply run:

        emcmake cmake -DVTK_DIR=/work/build-vtk-wasm -S path_to_source -B path_to_build\ncmake --build path_to_build\n

        Then the only thing you have to do is to run the example:

        cd path_to_build\npython3 -m http.server 8000\n

        Open your browser to http://localhost:8000 and enjoy !

        "},{"location":"WASM/4_ContributingWASM/","title":"Adding WASM preview to an example","text":""},{"location":"WASM/4_ContributingWASM/#configure-your-example-if-it-needs-to-be-executed-with-arguments","title":"Configure your example if it needs to be executed with arguments","text":"

        First, if it requires files, you will need to ensure those files are stored in vtk-examples/src/Testing/Data or vtk-examples/src/SupplementaryData/Cxx.

        If you have to add a file for your example to work you will also have to add instructions about the file package that will need to be linked to the WASM file by editing vtk-examples/src/Admin/WASM/packaged_files.json

        Then, you will need to edit vtk-examples/src/Admin/WASM/ArgsNeeded.json. Remember everything under the package name in packaged_files.json will be mapped to \"/\" in the WebAssembly virtual filesystem (e.g. DicomTestImage/brain_001.dcm will become /DicomTestImage/brain_001.dcm). ArgsNeeded.json needs two variables for each example: the args in the same order you would put them when running your example from bash and the names of the file packages your are going to need. Leave the list empty if there's none.

        "},{"location":"WASM/4_ContributingWASM/#test-your-example","title":"test your example","text":"

        You will need to download VTK source code.

        Run the script to generate the CMakeLists and the index.html you need:

        cd vtk-examples/src/Admin\npython3 ./GenerateHtmlCMake.py path/to/example path/to/vtk/source\ncd path/to/example\n

        Then build and run your example as explained here. If it works well, then you are finished here. If it doesn't because of an error in VTK pipeline, then revert the changes you made to ArgsNeeded.json and add the example to the exclusion list. You are welcome to add an issue to VTK Gitlab if you think it's relevant.

        "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"About the Examples","text":"

        The VTK source distribution includes a sizeable number of examples. The goal of the VTK examples is to illustrate specific VTK concepts in a consistent and simple format. Some have been there since the inception of the toolkit. These examples have been subject to peer review and revision over the years. However, these examples only cover a small part of the capabilities of VTK.

        Hundreds of tests are distributed with the toolkit source. The tests reside in ''Kit''/Testing directories (for example, Filters/Points/Testing) in the source distribution. However, these tests are meant to exercise the toolkit rather than illustrate how to use it. For the most part, the tests are not good educational resources.

        We are now using github pages to provide examples that will help both new and experienced VTK users. The examples can be used to find examples that answer questions like, \"How do I extract normals from a filter's output?\", \"How do I generate models from segmented data?\", and \"How do I compute the area of a triangle?\", just to name a few.

        Over time we hope that the examples will answer many of the users' questions. Some questions won't have a solution in the current example repertoire. For those questions, we encourage the user to create a simple example that illustrates either a dilemma or a new solution.

        "},{"location":"#examples-are-available-for-the-following-programming-languages","title":"Examples are available for the following programming languages:","text":"
        • C++
        • Python
        • Java
        • C#
        • js

        The above examples demonstrate how to use VTK functionalities. There are also examples specifically to demonstrate how to write code as a VTK filter using VTK techniques. This is helpful so that your custom code can be called in a fashion that other people are already familiar with. It is also necessary if you plan to contribute your classes to VTK.

        "},{"location":"#examples-for-visualising","title":"Examples for visualising:","text":"
        • Trame

        These examples consist of tarfiles that you download, set up and run.

        "},{"location":"#information-about-the-vtk-examples","title":"Information about the VTK Examples","text":"
        • Users: If you just want to use the VTK Examples, this is the place for you. You will learn how to search for examples, build a few examples and build all of the examples.
        • Developers: If you want to contribute examples, this section explains everything you need to know. You will learn how to add a new example and the guidelines for writing an example.
        • Adminstrators: This section is for a VTK Example Administrators or people want to learn more about the process. You will learn how the VTK Examples repository is organized, how the repository is synced to the repository and how to add new topics, tests and regression baselines.
        "},{"location":"#how-can-i-help","title":"How can I help?","text":"

        This project has grown to be very large. We are always looking for people to help the cause. You can help by:

        • Adding new examples (see procedure here)
        • Proof reading existing examples, for correctness, style, and clarity.
        • Add comments to existing examples where they are unclear.
        "},{"location":"CSharp/","title":"CSharp Examples","text":""},{"location":"CSharp/#vtk-classes-summary","title":"VTK Classes Summary","text":"

        This Python script, SelectExamples, will let you select examples based on a VTK Class and language. It requires Python 3.7 or later. The following tables will produce similar information.

        • VTK Classes with Examples, this table is really useful when searching for example(s) using a particular class.

        • VTK Classes with No Examples, please add examples in your area of expertise!

        "},{"location":"CSharp/#simple-operations","title":"Simple Operations","text":"Example Name Description Image DistanceBetweenPoints Computes the distance between two point Distance between two points DistancePointToLine Distance between a point and a line GaussianRandomNumber Generates Gaussian random number Random number (Gaussian distribution) PerspectiveTransform Apply a perspective transformation to a point ProjectPointPlane Project a point onto a plan Project a point onto a plane RandomSequence This is the preferred way to generate random numbers Random sequence UniformRandomNumber Generates uniform random number Random number (uniform distribution)"},{"location":"CSharp/#input-and-output","title":"Input and Output","text":""},{"location":"CSharp/#graph-formats","title":"Graph Formats","text":""},{"location":"CSharp/#3d-file-formats","title":"3D File Formats","text":"Example Name Description Image ConvertFile Convert a file from one type to another XGMLReader Read a .gml file"},{"location":"CSharp/#standard-formats","title":"Standard Formats","text":""},{"location":"CSharp/#input","title":"Input","text":"Example Name Description Image DEMReader Read DEM (elevation map) files ReadDICOMSeries This example demonstates how to read a series of DICOM images and scroll through slice Convert a series of DICOM files into a VTI File ReadPDB Read Protein Data Bank Files Read Protein Data Bank files (.pdb) files ReadPLOT3D Read CFD (computational fluid dynamics) data produced by PLOT3D Read PLOT3D (.bin) files ReadPLY Read PLY (.ply) files ReadSTL Read stereo lithography STL (.stl) files SimplePointsReader Read a simple \"xyz\" file of points VRML Read a VRML (WRL) file"},{"location":"CSharp/#vtk-formats","title":"VTK Formats","text":""},{"location":"CSharp/#input_1","title":"Input","text":"Example Name Description Image ParticleReader Read an ASCII file ReadImageData Read a image data (.vti) file ReadOBJ Read a Wavefront OBJ file ReadPlainText Read a plain text file ReadPolyData Read a polygonal data (.vtp) file ReadRectilinearGrid Read a rectilinear grid (.vtr) file ReadStructuredGrid Read a structured grid (.vts) file ReadUnknownTypeXMLFile Read an XML file and later decide what kind it is ReadUnstructuredGrid Demonstrates how to read a .vtu fil Read an unstructured grid (.vtu) file"},{"location":"CSharp/#output","title":"Output","text":"Example Name Description Image WriteVTI VTI is an \"ImageData\" Write a .vti file WriteVTP VTP is a \"PolyData\". This format allows for the most complex geometric objects to be stored Write a .vtp file WriteVTU VTU is an \"Unstructured Grid\". This format allows for 3D data to be stored Write a .vtu file XMLStructuredGridWriter Write a .vts file from a vtkStructuredGrid"},{"location":"CSharp/#image-formats","title":"Image Formats","text":""},{"location":"CSharp/#input_2","title":"Input","text":"Example Name Description Image ImageReader2Factory This class tries to find an appropriate reader. It is very convenient to use this when you don't know what kind of file to expect Read most standard image formats. JPEGReader Read a JPG image MetaImageReader Read .mha files PNGReader Read a PNG image ReadBMP Read BMP (.bmp) files ReadPNM Read PNM (.pnm) files ReadTIFF Read TIFF (.tif) files"},{"location":"CSharp/#output_1","title":"Output","text":"Example Name Description Image JPEGWriter Write a JPEG (.jpg) file MetaImageWriter Write a .mha/.mhd + .raw file WriteBMP Write a BMP (.bmp) file WritePNG Write a PNG (.png) file WritePNM Write a PNM (.pnm) file WriteTIFF Write a TIFF (.tif) file"},{"location":"CSharp/#geometric-objects","title":"Geometric Objects","text":"Example Name Description Image Arrow Arrow Axes Axes ColoredLines Colored Lines Cone Cone Cube Cube Cylinder Cylinder Disk A circle with a hole in it Disk Frustum Frustum GeometricObjectsDemo A demonstration of all geometric objects that work the same way Hexahedron Hexahedron Line Line LongLine Manually create a polyline OrientedArrow Oriented Arrow Plane Plane Planes Planes PlanesIntersection PlanesIntersection PlatonicSolid PlatonicSolid Point Point PolyLine PolyLine Polygon Polygon PolygonIntersection IntersectWithLine( Compute the intersection of a line segment with a polygon Pyramid Pyramid Quad Quad RegularPolygonSource Regular Polygon Sphere Sphere Tetrahedron Tetrahedron Triangle Triangle TriangleStrip Triangle strip Vertex Vertex"},{"location":"CSharp/#parametric-objects","title":"Parametric Objects","text":"

        These examples demonstrate how to create an display one of the many vtkParametric* objects. All of the classes listed can be used in an identical fashion.

        Example Name Description Image ParametricObjects Create and display a parametric object ParametricObjectsDemo Demonstration of all of the vtkParametric* classes"},{"location":"CSharp/#implicit-functions-and-iso-surfaces","title":"Implicit Functions and Iso-surfaces","text":"Example Name Description Image BandedPolyDataContourFilter BandedPolyDataContourFilter ExtractLargestIsosurface Extract largest isosurface FilledContours Create filled contours (vtkClipPolyData) ImplicitSphere An implicit representation of a sphere IsoContours Visualize different isocontours using a slider MarchingCubes Create a voxelized spher Marching cubes MarchingSquares Create a contour from a structured point set (image Marching squares) SampleFunction Sample and visualize an implicit function"},{"location":"CSharp/#working-with-3d-data","title":"Working with 3D Data","text":"Example Name Description Image AlignFrames Align coordinate frames ContoursFromPolyData Create contours from PolyData FindAllArrayNames Get the names of all of the data arrays ImplicitBoolean Operations include intersection and union. IterateOverLines Iterate through the lines of a PolyData MultiBlockMergeFilter Combine MultiBlockDataSets NullPoint Set everything in PointData at a specified index to NUL NullPoint PolyDataGetPoint Get point locations/coordinates from a vtkPolyData ShrinkPolyData Move all items in a PolyData towards their centroid VectorFieldNonZeroExtraction This example shows how to create an imagedata object, associate scalar data with some points and visualize only nonzero scalar value Extract non-zero vectors from a vtkImageData WarpVector vtkWarpVector"},{"location":"CSharp/#working-with-meshes","title":"Working with Meshes","text":"Example Name Description Image BoundaryEdges Find the edges that are used by only one face Finding Boundary Edges CapClip Cap a clipped polydata with a polygon CellEdges Get edges of cells ClosedSurface Check if a surface is closed ColorDisconnectedRegions Color each disconnected region of a vtkPolyData a different color ColoredElevationMap Colormap, color ma Color a mesh by height Curvature Compute Gaussian, Mean, Min, and Max Curvatures Decimate Reduce the number of triangles in a mesh Decimation DijkstraGraphGeodesicPath Find the shortest path between two points on a mesh ElevationFilter Color a mesh by height ExtractEdges Extract Edges FillHoles Close holes in a mesh Fill Holes GreedyTerrainDecimation Create a mesh from an ImageData HighlightBadCells Highlight Bad Cells LargestRegion Extract the largest connected region in a polydata MatrixMathFilter Compute various quantities on cell and points in a mesh Matrix math filter OBBDicer Breakup a mesh into pieces OBBDicer PolygonalSurfaceContourLineInterpolator Interactively find the shortest path between two points on a mesh QuadricClustering Reduce the number of triangles in a mesh Decimation (quadric clustering) QuadricDecimation Reduce the number of triangles in a mesh Decimation (quadric decimation) SelectPolyData Select a region of a mesh SimpleElevationFilter Color a mesh by dotting a vector from the origin to each point with a specified vector SolidClip Create a \"solid\" clip SpecifiedRegion Extract a specific (specified) connected region in a polydata Subdivision Increase the number of triangles in a mesh Subdivision Triangulate Convert all polygons in a mesh to triangles Triangulate a mesh WeightedTransformFilter vtkWeightedTransformFilter WindowedSincPolyDataFilter Smooth a mesh."},{"location":"CSharp/#working-with-structured-3d-data","title":"Working with Structured 3D Data","text":"

        This section includes vtkImageData, vtkStructuredGrid, and vtkRectilinearGrid.

        \"ImageData\" is not the traditional \"flat, 2D image\" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Here is an overview of these data structures: [http://vtk.org/Wiki/VTK/Tutorials/3DDataTypes]. Image data can represent at typical 2D image, but also, a 3D volume.

        "},{"location":"CSharpHowTo/","title":"CSharp How To","text":"

        Often you just need a \"pointer\" to an example that shows you how to do something.

        Here are some snippets or examples that highlight interesting features that may help you:

        "},{"location":"CSharpHowTo/#no-examples-or-snippets-yet","title":"No examples or snippets yet","text":"Example Name Comments Image"},{"location":"Cxx/","title":"C++ Examples","text":"

        These are fully independent, compilable examples. There is significant overlap in the examples, but they are each intended to illustrate a different concept and be fully stand alone compilable.

        "},{"location":"Cxx/#vtk-classes-summary","title":"VTK Classes Summary","text":"

        This Python script, SelectExamples, will let you select examples based on a VTK Class and language. It requires Python 3.7 or later. The following tables will produce similar information.

        • VTK Classes with Examples, this table is really useful when searching for example(s) using a particular class.

        • VTK Classes with No Examples, please add examples in your area of expertise!

        "},{"location":"Cxx/#tutorials","title":"Tutorials","text":"

        If you are new to VTK then these tutorials will help to get you started.

        "},{"location":"Cxx/#hello-world","title":"Hello World","text":"Example Name Description Image A hello world example Cylinder example from the VTK Textbook and source code. A hello world example."},{"location":"Cxx/#simple-operations","title":"Simple Operations","text":"Example Name Description Image DistanceBetweenPoints Distance between two points. DistancePointToLine Distance between a point and a line. FloatingPointExceptions Floating Point Exceptions GaussianRandomNumber Generates Gaussian random numbers. PerspectiveTransform Apply a perspective transformation to a point. ProjectPointPlane Project a point onto a plane. RandomSequence This is the preferred way to generate random numbers. UniformRandomNumber Generates uniform random numbers."},{"location":"Cxx/#input-and-output","title":"Input and Output","text":""},{"location":"Cxx/#graph-formats","title":"Graph Formats","text":""},{"location":"Cxx/#3d-file-formats","title":"3D File Formats","text":"Example Name Description Image ConvertFile Convert a file from one type to another XGMLReader Read a .gml file"},{"location":"Cxx/#standard-formats","title":"Standard Formats","text":""},{"location":"Cxx/#input","title":"Input","text":"Example Name Description Image DEMReader Read DEM (elevation map) files DelimitedTextReader Read a delimited file into a polydata. DumpXMLFile Report the contents of a VTK XML or legacy file IndividualVRML This example is used to get each actor and object from a scene and verify axes correspondence ParticleReader This example reads ASCII files where each line consists of points with its position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file format. ReadAllPolyDataTypes Read any VTK polydata file. ReadAllPolyDataTypesDemo Read all VTK polydata file types. ReadAllUnstructuredGridTypes Read any VTK unstructuredgrid file. ReadCML Read Chemistry Markup Language files. ReadExodusData Read and view ExodusII data. ReadOBJ Read an OBJ (.obj) file. ReadPDB Read Protein Data Bank Files. ReadPLOT3D Read CFD (computational fluid dynamics) data produced by PLOT3D. ReadPLY Read PLY (.ply) files ReadPlainTextTriangles Read a plain text file into a polydata. ReadSLC Read VolVis file. ReadSTL Read stereo lithography STL (.stl) files ReadTextFile Read a plain text file into a polydata. SimplePointsReader Read a simple \"xyz\" file of points. TransientHDFReader Read transient data written inside a vtkhdf file."},{"location":"Cxx/#importers","title":"Importers","text":"Example Name Description Image 3DSImporter Import a 3D Studio scene that includes multiple actors. GLTFImporter Import a glTF scene. ImportPolyDataScene Import a polydata scene using multiblock datasets. OBJImporter Import an OBJ scene that includes actors, materials and textures. VRMLImporter Import a VRML 2.0 (WRL) file. VRMLImporterDemo Import a VRML 2.0 (WRL) file and add normals if necessary."},{"location":"Cxx/#output","title":"Output","text":"Example Name Description Image DelimitedTextWriter Write data to a delimited file SimplePointsWriter Write a simple \".xyz\" file WritePLY Write PLY (.ply) files WriteSTL Write stereo lithography STL (.stl) files"},{"location":"Cxx/#exporters","title":"Exporters","text":"Example Name Description Image ExportPolyDataScene Export a polydata scene using multiblock datasets."},{"location":"Cxx/#vtk-formats","title":"VTK Formats","text":""},{"location":"Cxx/#input_1","title":"Input","text":"Example Name Description Image ReadImageData Read a image data (.vti) file ReadPolyData Read a polygonal data (.vtp) file ReadRectilinearGrid Read a rectilinear grid (.vtr) file ReadStructuredGrid Read a structured grid (.vts) file ReadUnknownTypeXMLFile Read an XML file and later decide what kind it is ReadUnstructuredGrid Read an unstructured grid (.vtu) file"},{"location":"Cxx/#output_1","title":"Output","text":"Example Name Description Image ExodusIIWriter Write a time varying ExodusII file. WriteVTI Write a .vti file. VTI is an \"ImageData\". WriteVTP Write a .vtp file. VTP is a \"PolyData\". This format allows for the most complex geometric objects to be stored. WriteVTU Write a .vtu file. VTU is an \"Unstructured Grid\". This format allows for 3D data to be stored. XMLPImageDataWriter Write a .pvti file with 4 .vti pieces. XMLPUnstructuredGridWriter Write a .pvtu with 4 .vtu pieces. XMLStructuredGridWriter Write a .vts file from a vtkStructuredGrid."},{"location":"Cxx/#legacy-vtk-formats","title":"Legacy VTK Formats","text":"Example Name Description Image GenericDataObjectReader Read any type of legacy .vtk file. ReadLegacyUnstructuredGrid Read an unstructured grid that contains 11 linear cells. StructuredGridReader Read a structured grid (.vtk) file. StructuredPointsReader Read a structured points (.vtk) file. WriteLegacyLinearCells Write each linear cell into a legacy UnstructuredGrid file. WriteXMLLinearCells Write each linear cell into an XML UnstructuredGrid file (.vtu)."},{"location":"Cxx/#image-format","title":"Image Format","text":""},{"location":"Cxx/#input_2","title":"Input","text":"Example Name Description Image HDRReader Read a high-dynamic-range imaging file. ImageReader2Factory This class tries to find an appropriate reader. It is very convenient to use this when you don't know what kind of file to expect. JPEGReader Read a JPEG image. MetaImageReader Read .mha files. PNGReader Read a PNG image. ReadBMP Read BMP (.bmp) files. ReadDICOM Read DICOM file ReadDICOMSeries This example demonstrates how to read a series of DICOM images and scroll through slices ReadPNM Read PNM (.pnm) files. ReadTIFF Read TIFF (.tif) files."},{"location":"Cxx/#output_2","title":"Output","text":"Example Name Description Image ImageWriter Write an imagefile based on the file extension. JPEGWriter Write a JPEG (.jpg) file. MetaImageWriter Write a .mha/.mhd + .raw file. PNGWriter Write a PNG (.png) file. WriteBMP Write a BMP (.bmp) file. WritePNM Write a PNM (.pnm) file. WriteTIFF Write a TIFF (.tif) file."},{"location":"Cxx/#geometric-objects","title":"Geometric Objects","text":"Example Name Description Image Axes ColoredLines Cube Manually build a polygonal cube. Cube1 A nice simple example that demonstrates the operation of the VTK pipeline. Dodecahedron Create a dodecahedron using vtkPolyhedron. EllipticalCylinder Create an elliptical cylinder using extrusion. EllipticalCylinderDemo Show the base and extrusion vector. GeometricObjectsDemo A demonstration of all geometric objects that work the same way. OpenVRFrustum VTK + OpenVR Example. OpenVROrientedArrow VTK + OpenVR Example. OpenVROrientedCylinder VTK + OpenVR Example. OpenVRTessellatedBoxSource VTK + OpenVR Example. PlaneSourceDemo Display the instance variables that define a vtkPlaneSource. Planes PlanesIntersection PolygonIntersection Compute the intersection of a line segment with a polygon. ShrinkCube Applying shrink filter to an object. SourceObjectsDemo Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source. Other polygonal source objects are available; check subclasses of vtkPolyDataAlgorithm."},{"location":"Cxx/#cells","title":"Cells","text":"Example Name Description Image Cell3DDemonstration Demonstrate the use of vtkCell3D to construct geometric objects. Sample objects are generated from the classes derived from vtkCell3D and displayed. CellTypeSource Generate tessellated cells. ConvexPointSet Generate a ConvexPointSetCell. Hexahedron LinearCellDemo Linear cell types found in VTK. Numbers define ordering of the defining points. LongLine Manually create a polyline. Point PolyLine Polygon Polyhedron Create an unstructured grid representation of a polyhedron (cube) and write it out to a file. Pyramid Quad Tetrahedron Triangle Triangle strip Vertex"},{"location":"Cxx/#sources","title":"Sources","text":"Example Name Description Image Arrow Cone Display a cone ConeDemo Disolay four different resolution cones. Cylinder Disk A circle with a hole in it. EarthSource Create the Earth. Frustum Line OrientedArrow Orient an arrow along an arbitrary vector. OrientedCylinder Orient a cylinder along an arbitrary vector. Plane PlatonicSolids PolyLine1 This example demonstrates how to create a polygon through several ordered points. RegularPolygonSource Sphere TessellatedBoxSource Generate a box with tessellated sides. TextActor 2D \"HUD-type\" text"},{"location":"Cxx/#non-linear","title":"Non Linear","text":"Example Name Description Image IsoparametricCellsDemo Nonlinear isoparametric cell types in VTK. QuadraticHexahedron Create and tessellate a nonlinear cell. QuadraticHexahedronDemo Interactively adjust chord error. QuadraticTetra Create and tessellate a nonlinear cell. QuadraticTetraDemo Interactively adjust chord error."},{"location":"Cxx/#parametric-objects","title":"Parametric Objects","text":"

        These examples demonstrate how to create an display one of the many vtkParametric objects. All of the classes listed can be used in an identical fashion.

        Example Name Description Image ParametricKuenDemo Interactively change the parameters for a Kuen Surface. ParametricObjectsDemo Demonstrates the Parametric classes added by Andrew Maclean and additional classes added by Tim Meehan. The parametric spline is also included. Options are provided to display single objects, add backface, add normals and print out an image. ParametricSuperEllipsoidDemo Interactively change the parameters for a SuperEllipsoid Surface. ParametricSuperToroidDemo Interactively change the parameters for a SuperToroid Surface."},{"location":"Cxx/#implicit-functions-and-iso-surfaces","title":"Implicit Functions and Iso-surfaces","text":"Example Name Description Image BandedPolyDataContourFilter Create filled contours. BooleanOperationImplicitFunctions Demonstrate booleans of two different implicit functions ContourTriangulator Create a contour from a structured point set (image) and triangulate it. CutWithCutFunction Cut a surface with an implicit plane using vtkCutter. CutWithScalars Cut a surface with scalars. DiscreteMarchingCubes Generate surfaces from labeled data. ExtractData Implicit functions used to select data: Two ellipsoids are combined using the union operation used to select voxels from a volume. Voxels are shrunk 50 percent. ExtractLargestIsosurface Extract largest isosurface. FilledContours Create filled contours (using vtkClipPolyData). Hello Implicit modelling used to thicken a stroked font. IceCream How to use boolean combinations of implicit functions to create a model of an ice cream cone. ImplicitDataSet Convert an imagedata to an implicit function. ImplicitQuadric Create an ellipsoid using an implicit quadric. ImplicitSphere An implicit representation of a sphere. ImplicitSphere1 Demonstrate sampling of a sphere implicit function. IsoContours Visualize different isocontours using a slider. Lorenz Visualizing a Lorenz strange attractor by integrating the Lorenz equations in a volume. MarchingCases Explore the Marching Cubes cases. MarchingCasesA The 256 possible cases have been reduced to 15 cases using symmetry. MarchingCasesB Marching cubes complementary cases. Cases 3c, 6c, 7c, 10c, 12c and 13c are displayed. MarchingCasesC Marching cubes, case 3 is rotated 90 degrees about the y-axis with no label. MarchingCasesD Marching cubes. Case 7 is rotated 180 degrees about the y-axis with no label. MarchingCubes Create a voxelized sphere. MarchingSquares Create a contour from a structured point set (image). SampleFunction Sample and visualize an implicit function. ShepardInterpolation Interpolate scalar data. SmoothDiscreteMarchingCubes Generate smooth surfaces from labeled data."},{"location":"Cxx/#working-with-3d-data","title":"Working with 3D Data","text":"Example Name Description Image AlignFrames Align coordinate frames. AlignTwoPolyDatas Align two vtkPolyData's. AppendFilter Append different types of data, BooleanOperationPolyDataFilter Perform boolean operations on two vtkPolyData objects. Bottle Rotationally symmetric objects. CappedSphere Rotate an arc to create a capped sphere. CellCenters Compute points at the center of every cell. CellCentersDemo Visualize points at the center of every cell. CellEdgeNeighbors Determine which cells share an edge with a specific cell. CellPointNeighbors Determine which cells share a single point with a specific cell. CellsInsideObject Extract cells inside a closed surface. CenterOfMass Compute the center of mass of the points. Circle Create a circle by cutting through a sphere. CleanPolyData Remove coincident points. ColorCells Color individual cells of a polydata with scalar index. ColorCellsWithRGB Color individual cells of a polydata with rgb colors. ColoredPoints Add three points to a polydata and associate a color with each of them. CombinePolyData Combine/Append PolyData. ConnectivityFilter Color any dataset type based on connectivity. ConnectivityFilterDemo Color any dataset type based on connectivity. ContoursFromPolyData Create contours from PolyData. ContoursToSurface Convert contours to a surface. ConvexHull Convex hull using vtkHull. ConvexHullShrinkWrap Convex hull using shrink wrapping. CopyAllArrays Copy all arrays from one vtkPolyData to another. CurvaturesAdjustEdges Get the Gaussian and Mean curvatures of a surface with adjustments for edge effects. CurvaturesDemo Demonstrates how to get the Gaussian and Mean curvatures of a surface. DataBounds Get the minimum and maximum value in each dimension. (Axis aligned bounding box) DataSetSurfaceFilter Convert vtkUnstructuredGrid to vtkPolyData. DecimatePolyline Decimate polyline. DeleteCells Delete a cell from a vtkPolyData DeletePoint DetermineArrayDataTypes Determine data types of arrays. DistancePolyDataFilter Compute the distance function from one vtkPolyData to another. EmbedPointsIntoVolume Embed points into a volume. ExternalContour Get the External Contour from Polydata. ExtractCellsUsingPoints Extract points but bring cells that are still complete with them. ExtractOutsideSurface Extract the outer surface of a multiple surface polydata. ExtractPolyLinesFromPolyData Extract polylines from polydata. ExtractSelection Extract selected points. ExtractSelectionCells Extract cell, select cell. ExtractSelectionOriginalId Extract selection and find correspondence between new and original Id. ExtractVisibleCells Extract and highlight visible cells. FieldData Add Global Miscellaneous Data (FieldData) to a Polydata. Finance Visualization of multidimensional financial data. The gray/wireframe surface represents the total data population. The red surface represents data points delinquent on loan payment. FinanceFieldData Visualization of multidimensional financial data. The yellow surface represents the total data population. The red surface represents data points delinquent on loan payment. FindAllArrayNames Get the names of all of the data arrays. FitSplineToCutterOutput Fit a spline to cutter output. GeometryFilter Convert vtkUnstructuredGrid to vtkPolyData (another way). GetMiscCellData Get Miscellaneous Data from Cells in a Polydata. GetMiscPointData Get Miscellaneous Data from Points in a Polydata. GradientFilter Compute the gradient of a scalar field on a data set. ImplicitBoolean Operations include intersection and union. ImplicitBooleanDemo Demo Union, Difference and Intersection. ImplicitModeller Compute the distance from an object to every point on a uniform grid. ImplicitPolyDataDistance Compute the distance function in a space around a vtkPolyData. InterpolateMeshOnGrid Interpolate a mesh over a grid. InterpolateTerrain vtkProbeFilter Interpolate terrain. IntersectionPolyDataFilter Compute the intersection of two vtkPolyData objects. IterateOverLines Iterate through the lines of a PolyData. KMeansClustering KMeans Clustering KochanekSpline Create an Kochanek spline on a set of points. KochanekSplineDemo Interactively change the parameters of the Kochanek spline. LinearExtrusion Extrude a shape. LoopBooleanPolyDataFilter Perform boolean operations on two vtkPolyData objects. MaskPoints Select a subset (mask) of a point set. MergePoints Remove duplicate (merge) points. MergeSelections Merge selected points. MiscCellData Add Miscellaneous Data to Cells in a Polydata. MiscPointData Add Miscellaneous Data to Points in a Polydata. MultiBlockMergeFilter Combine MultiBlockDataSets. NullPoint Set everything in PointData at a specified index to NULL Outline Draw the bounding box of the data PKMeansClustering Parallel KMeans Clustering. ParametricSpline Create a Cardinal spline on a set of points. PerlinNoise PointCellIds Generate point and cell id arrays. PointInsideObject Check if a point is inside an object. PointInsideObject2 This uses a Delaunay triangulation to compute a volume. This gives more of an \"is inside convex hull\" effect than an \"is inside object\". PointsProjectedHull Convex hull of points projected onto the coordinate planes. PolyDataCellNormals Add/Get Normals to/from cells in a Polydata. PolyDataContourToImageData Generate a binarized image from a closed contour. PolyDataExtractNormals Extract Normals from a Polydata. PolyDataGetPoint Get point locations/coordinates from a vtkPolyData. PolyDataIsoLines Iso lines on the surface of a polydata PolyDataPointNormals Add/Get Normals to/from points in a Polydata. PolyDataPointSampler Sample the edges or surfaces of a polydata. PolyDataToImageData Generate a binarized volume from a closed surface. ProcrustesAlignmentFilter Align point sets. ProgrammableFilter Create a custom filter without subclassing. ProgrammableSource Create points using a programmable source. Generates points for a strange attractor. ProjectSphere Unroll a sphere or spherical-like model. QuantizePolyDataPoints Snap (quantize) points to a grid. Reflection Mirror a DataSet. RemoveOutsideSurface Remove the outer surface of a multiple surface polydata. RemoveVertices ResampleAppendedPolyData Resample a flat terrain containing multiple objects. ResamplePolyLine ReverseSense Flip normals. RibbonFilter RotationAroundLine Rotation around a line. RuledSurfaceFilter Create a surface between lines. SCurveSpline Create an SCurve spline on a set of points. SelectVisiblePoints Select visible points. SelectionSource Specify a selection. ShrinkPolyData Move all items in a PolyData towards their centroid. Silhouette Spring Rotation in combination with linear displacement and radius variation. Stripper Convert triangles to triangle strips. ThinPlateSplineTransform ThresholdCells Thresholding Cells. ThresholdPoints Thresholding Points. TransformFilter Transform a data set. TransformOrderDemo Demonstrate how the order of applying transforms affects the result. TransformPipeline Combining the transformation, in order to manipulate a group of vtkActor. Shown in the example robot arm motion. TransformPolyData Apply a Transformation to a PolyData. TriangleArea Compute the area of all triangles in a polydata. TriangleColoredPoints Set the color of each point of a triangle. You will be able to interpolate the colors across the triangle. TriangleSolidColor Create a solid colored triangle. TubeFilter Give lines a thickness (produce a cylinder around lines. VectorFieldNonZeroExtraction Extract non-zero vectors from a vtkImageData. VertexConnectivity Get a list of vertices attached (through an edge) to a vertex. WarpScalar Move vertices along normals. WarpSurface Warp a surface along its normal. WarpTo Bend an object. WarpVector"},{"location":"Cxx/#data-types","title":"Data Types","text":"Example Name Description Image CompositePolyDataMapper Generate2DAMRDataSetWithPulse Generates sample 2-D AMR dataset. Generate3DAMRDataSetWithPulse Generates sample 3-D AMR dataset. MultiBlockDataSet Demonstrates how to make and use VTK's MultiBlock type data OverlappingAMR Demonstrates how to create and populate a VTK's Overlapping AMR Grid type Data"},{"location":"Cxx/#data-type-conversions","title":"Data Type Conversions","text":"Example Name Description Image PolyDataToUnstructuredGrid Convert a vtkPolyData to a vtkUnstructuredGrid."},{"location":"Cxx/#point-cloud-operations","title":"Point Cloud Operations","text":"Example Name Description Image ColorIsosurface Color an isosurface with a data array. CompareExtractSurface Compare three extract surface algorithms. DensifyPoints Add points to a point cloud. DownsamplePointCloud Down sample a point cloud. Remove points so that there are no points within a tolerance of any point. ExtractClusters From a set of randomly distributed spheres, extract connected clusters. ExtractEnclosedPoints Extract points inside a vtkPolyData surface. ExtractPointsDemo Extract points inside an implicit function. ExtractSurface Create a surface from Unorganized Points using Point filters. ExtractSurfaceDemo Create a surface from Unorganized Points using Point filters (DEMO). FitImplicitFunction Extract points within a distance to an implicit function. MaskPointsFilter Extract points within an image mask. NormalEstimation Estimate the normals of a random points that lie on a sphere. PointOccupancy Show which voxels contain points. PointSource Generate a random point cloud. PoissonExtractSurface Create a surface from Unorganized Points using the PoissonReconstruction algorithm. PowercrustExtractSurface Create a surface from Unorganized Points using the Powercrust algorithm. RadiusOutlierRemoval Remove outliers. SignedDistance Compute signed distance to a point cloud. UnsignedDistance Compute unsigned distance to a point cloud."},{"location":"Cxx/#working-with-meshes","title":"Working with Meshes","text":"Example Name Description Image AddCell Add a cell to an existing mesh. BoundaryEdges Find the edges that are used by only one face. CellEdges Get edges of cells. ClosedSurface Check if a surface is closed. ColorDisconnectedRegions Color each disconnected region of a vtkPolyData a different color. ColorDisconnectedRegionsDemo Color each disconnected region of a vtkPolyData a different color for any vtkPolyData. ColoredElevationMap Color a mesh by height. Curvatures Compute Gaussian and Mean Curvatures. Decimation Reduce the number of triangles in a mesh. DeformPointSet Deform a point set with a control polyhedra. DelaunayMesh Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes. DijkstraGraphGeodesicPath Find the shortest path between two points on a mesh. ElevationFilter Color a mesh by height. ExtractEdges FillHoles Close holes in a mesh. FitToHeightMap Drape a polydata over an elevation map. GreedyTerrainDecimation Create a mesh from an ImageData HighlightBadCells IdentifyHoles Close holes in a mesh and identify the holes. ImplicitSelectionLoop Select a region of a mesh with an implicit function. InterpolateFieldDataDemo Resample a fine grid and interpolate field data. LargestRegion Extract the largest connected region in a polydata. MatrixMathFilter Compute various quantities on cell and points in a mesh. MeshQuality OBBDicer Breakup a mesh into pieces. PointInterpolator Plot a scalar field of points onto a PolyData surface. PolygonalSurfaceContourLineInterpolator Interactively find the shortest path between two points on a mesh. QuadricClustering Reduce the number of triangles in a mesh. QuadricDecimation Reduce the number of triangles in a mesh. SelectPolyData Select a region of a mesh. SimpleElevationFilter Color a mesh by dotting a vector from the origin to each point with a specified vector. SmoothPolyDataFilter Laplacian smoothing. SpecifiedRegion Extract a specific (specified) connected region in a polydata. SplitPolyData Breakup a mesh into pieces and save the pieces into files Subdivision Increase the number of triangles in a mesh. SubdivisionDemo Subdivision of any vtkPolyData Triangulate Convert all polygons in a mesh to triangles. WeightedTransformFilter WindowedSincPolyDataFilter Smooth a mesh (windowed sinc filter)."},{"location":"Cxx/#clipping","title":"Clipping","text":"Example Name Description Image BoxClipStructuredPoints Clip vtkStructuredPoints with a box. The results are unstructured grids with tetrahedra. BoxClipUnstructuredGrid Clip a vtkUnstructuredGrid with a box. The results are unstructured grids with tetrahedra. CapClip Cap a clipped polydata with a polygon. ClipClosedSurface Clip a surface with multiple planes. ClipDataSetWithPolyData Clip a vtkRectilinearGrid with arbitrary polydata. In this example, use a vtkConeSource to generate polydata to slice the grid, resulting in an unstructured grid. Contrast this with the next example. ClipFrustum Clip a vtkPolyData with the vtkCamera's view frustum. GenericClip ImplicitDataSetClipping Clip using an implicit data set. SolidClip Create a \"solid\" clip. The \"ghost\" of the part clipped away is also shown. TableBasedClipDataSetWithPolyData Clip a vtkRectilinearGrid with arbitrary polydata. In this example, use a vtkConeSource to generate polydata to slice the grid, resulting in an unstructured grid. Contrast this with the previous example. TableBasedClipDataSetWithPolyData2 Clip a vtkRectilinearGrid with a checkerboard pattern."},{"location":"Cxx/#working-with-structured-3d-data","title":"Working with Structured 3D Data","text":"

        This section includes vtkImageData vtkStructuredGrid and vtkRectilinearGrid.

        \"ImageData\" is not the traditional \"flat, 2D image\" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Here is an overview of these data structures. Image data can represent at typical 2D image, but also, a 3D volume.

        • Demonstration of structured data types
        • Get the linear point id of a point in a grid
        "},{"location":"Cxx/#vtkimagedata","title":"vtkImageData","text":"Example Name Description Image CellIdFromGridCoordinates Get the id of a cell from its grid coordinates. ClipVolume Clip a volumeand produce a vtkUnhstructuredGrid. ExtractVOI Extract a volume of interest (subvolume). GetCellCenter Get the coordinates of the center of a cell. ImageIterator ImageIteratorDemo Demonstrate using an iterator to access pixels in a region. ImageNormalize Normalize an image. ImageReslice Resize a vtkImageData. ImageTranslateExtent Change the extent of a vtkImageData. ImageWeightedSum Add two or more images. IntersectLine Intersect a line with all cells of a vtkImageData. IterateImageData Iterating over a vtkImageData."},{"location":"Cxx/#conversions","title":"Conversions","text":"Example Name Description Image ImageDataGeometryFilter Convert a vtkImageData to a vtkPolyData ImageDataToPointSet Convert a vtkImageData to a vtkStructuredGrid."},{"location":"Cxx/#vtkexplicitstructuredgrid","title":"vtkExplicitStructuredGrid","text":"Example Name Description Image CreateESGrid Create an explicit structured grid and convert this to an unstructured grid or vice versa. LoadESGrid Load a VTU file and convert the dataset to an explicit structured grid."},{"location":"Cxx/#vtkstructuredgrid","title":"vtkStructuredGrid","text":"Example Name Description Image BlankPoint Blank a point of a vtkStructuredGrid. GetLinearPointId Get the linear point id of a point in a grid. SGrid Creating a structured grid dataset of a semi-cylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction. StructuredGrid Reads and writes points into a structured grid. The grid is also colored by point data and how to iterate through the structured grid is demonstrated. StructuredGridOutline Visualize the outline of a structured grid. VisualizeStructuredGrid Visualize the points of a structured grid. VisualizeStructuredGridCells Visualize the cells of a structured grid."},{"location":"Cxx/#vtkstructuredpoints","title":"vtkStructuredPoints","text":"Example Name Description Image StructuredPointsToUnstructuredGrid Convert a vtkStructuredPoints to a vtkUnstructuredGrid. Vol Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26 x 26 x 26."},{"location":"Cxx/#vtkrectilineargrid","title":"vtkRectilinearGrid","text":"Example Name Description Image RGrid Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray. RectilinearGrid Create a rectilinear grid. RectilinearGridToTetrahedra Convert a vtkRectilinearGrid to a vtkUnstructuredGrid mesh. VisualizeRectilinearGrid Visualize the cells of a rectilinear grid."},{"location":"Cxx/#working-with-unstructured-3d-data","title":"Working with Unstructured 3D Data","text":"

        This section includes vtkUnstructuredGrid.

        "},{"location":"Cxx/#vtkunstructuredgrid","title":"vtkUnstructuredGrid","text":"Example Name Description Image ClipUnstructuredGridWithPlane Clip a UGrid with a plane. ClipUnstructuredGridWithPlane2 Clip a UGrid with a plane. UGrid Creation of an unstructured grid."},{"location":"Cxx/#registration","title":"Registration","text":"Example Name Description Image IterativeClosestPointsTransform Iterative Closest Points (ICP) Transform. LandmarkTransform Landmark Transform."},{"location":"Cxx/#medical","title":"Medical","text":"Example Name Description Image GenerateCubesFromLabels Create cubes from labeled volume data. GenerateModelsFromLabels Create models from labeled volume data. MedicalDemo1 Create a skin surface from volume data. MedicalDemo2 Create a skin and bone surface from volume data. MedicalDemo3 Create skin, bone and slices from volume data. MedicalDemo4 Create a volume rendering. TissueLens Cut a volume with a sphere."},{"location":"Cxx/#surface-reconstruction","title":"Surface reconstruction","text":"Example Name Description Image Delaunay3D Create a solid mesh from Unorganized Points. Delaunay3DDemo Interactively adjust Alpha for Delaunay3D. ExtractSurface Create a surface from Unorganized Points using Point filters. ExtractSurfaceDemo Create a surface from Unorganized Points using Point filters (DEMO). GaussianSplat Create a surface from Unorganized Points (Gaussian Splat). SurfaceFromUnorganizedPoints Create a surface from Unorganized Points. SurfaceFromUnorganizedPointsWithPostProc Create a surface from Unorganized Points (with post processing). TriangulateTerrainMap Generate heights (z values) on a 10x10 grid (a terrain map) and then triangulate the points to form a surface."},{"location":"Cxx/#utilities","title":"Utilities","text":"Example Name Description Image BoundingBox Bounding Box construction. BoundingBoxIntersection Box intersection and Inside tests. Box Intersect a box with a ray. BrownianPoints Produce a random vector at each point in a dataset. CardinalSpline Cardinal spline Interpolation. Casting Casting VTK objects. CheckVTKVersion Check VTK Version and provide alternatives for different VTK versions ColorLookupTable Color Lookup Table. ColorMapToLUT Use vtkDiscretizableColorTransferFunction to generate a VTK colormap. ColorTransferFunction Color Transfer Function. CommandSubclass Instead of using a callback function, it is more powerful to subclass vtkCommand. ConstrainedDelaunay2D Perform a 2D Delaunay triangulation on a point set respecting a specified boundary. Coordinate Coordinate system conversions. DeepCopy Deep copy a VTK object. Delaunay2D Perform a 2D Delaunay triangulation on a point set. DetermineActorType Determine the type of an actor. DiscretizableColorTransferFunction Discretizable Color Transfer Function. ExtractFaces Extract faces froam vtkUnstructuredGrid. FileOutputWindow Write errors to a log file instead of the screen. FilenameFunctions Do things like get the file extension, strip the file extension, etc. FilterSelfProgress Monitor a filters progress. ForLoop Demonstrating various ways of implementing a for loop in VTK. FrameRate Get the frame rate of the rendering. FullScreen Maximize/full screen a vtkRenderWindow. FunctionParser String function parser. GetClassName Determine the type of a VTK variable. GetDataRoot Find the path of VTK_DATA_ROOT. LUTUtilities A utility class for vtkLookupTable allowing you to output the table contents or to compare tables. MassProperties Compute volume and surface area of a closed, triangulated mesh. MultipleRenderWindows Multiple Render Windows. MultipleViewports Multiple Viewports. OffScreenRendering Off Screen Rendering. PCADemo Project 2D points onto the best 1D subspace (PCA Demo). PCAStatistics Compute Principal Component Analysis (PCA) values. PassThrough Pass input along to outpu. PiecewiseFunction Interpolation using a piecewise function. PointInPolygon Point inside polygon test. RenderScalarToFloatBuffer Demonstrates how to render scalars in a vtkPolyData object into a vtkFloatArray buffer for further processing. RescaleReverseLUT Demonstrate how to adjust a colormap so that the colormap scalar range matches the scalar range on the object. You can optionally reverse the colors. ResetCameraOrientation Reset camera orientation to a previously saved orientation. ReportRenderWindowCapabilities Report the capabilities of a render window. SaveSceneToFieldData Save a vtkCamera's state in a vtkDataSet's vtkFieldData and restore it. SaveSceneToFile Save a vtkCamera's state in a file and restore it. Screenshot ShallowCopy Shallow copy a VTK object. ShareCamera Share a camera between multiple renderers. ShepardMethod Shepard method interpolation. SideBySideViewports Side by side viewports. TimeStamp Time stamp. Timer TimerLog Timer log. Variant Convert between data types. Vector Mathematical vector class. ViewportBorders Draw a border around each viewport. VisualDebugging Update the screen from inside an algorithm. ZBuffer zbuffer."},{"location":"Cxx/#arrays","title":"Arrays","text":"Example Name Description Image 2DArray 2D Array. 3DArray 3D Array. ArrayCalculator Perform in-place operations on arrays. ArrayLookup Find the location of a value in a vtkDataArray. ArrayRange Get the bounds (min,max) of a vtk array. ArrayToTable Convert a vtkDenseArray to a vtkTable. ArrayWriter Write a DenseArray or SparseArray to a file. ConstructTable A table is a 2D array of any type of elements. They do not all have to be the same type. This is achieved using vtkVariant. CustomDenseArray Custom type Dense (2D) Array. DenseArrayRange Get the bounds of a vtkDenseArray. ExtractArrayComponent Extract a component of an array. KnownLengthArray Known Length Array. SortDataArray Reorder array values based on an ordering (key) array. SparseArray Sparse Array. UnknownLengthArray Unknown Length Array. VectorArrayKnownLength Array of Vectors (Known Length). VectorArrayUnknownLength Array of Vectors (Unknown Length)."},{"location":"Cxx/#events","title":"Events","text":"Example Name Description Image CameraModifiedEvent Catch the camera modified event. ObserveError Catch errors and warnings. WindowModifiedEvent Catch the window modified event."},{"location":"Cxx/#cmake-techniques","title":"CMake Techniques","text":"Example Name Description Image Check if a specific module is present"},{"location":"Cxx/#math-operations","title":"Math Operations","text":"Example Name Description Image 1DTupleInterpolation A simple example demonstrating how functions defined by sparsely distributed supporting points can be interpolated at arbitrary positions. EigenSymmetric Compute eigenvalues and eigenvectors of a symmetric matrix. HomogeneousLeastSquares Homogeneous Least Squares. LUFactorization LU Factorization. LeastSquares Least Squares. MatrixInverse Matrix inverse. MatrixTranspose Matrix transpose. NormalizeVector Normalize a vector. PerpendicularVector Get a vector perpendicular to another vector. VectorDot VectorNorm Get the lengths of an array of vectors."},{"location":"Cxx/#graphs","title":"Graphs","text":"Example Name Description Image AdjacencyMatrixToEdgeTable Convert an adjacency matrix to an edge table. AdjacentVertexIterator Get all vertices connected to a specified vertex. BoostBreadthFirstSearchTree Breadth first search tree. Can also be used to convert a graph to a tree. BreadthFirstDistance Distance from origin. ColorEdges Color edges. ColorVertexLabels Set the color of vertex labels. ColorVerticesLookupTable Color vertices. ConnectedComponents Find connected components of a graph. ConstructGraph Construct a graph. ConstructTree Construct a tree. CreateTree Create a tree and label the vertices and edges. DepthFirstSearchAnimation Depth First Search Animation. DepthFirstSearchIterator Depth First Search iterator. EdgeListIterator Iterate over edges of a graph. EdgeWeights Edge weights. GraphPoints Manually set coordinates of vertices in a graph. GraphToPolyData Convert a graph to a PolyData. InEdgeIterator Iterate over edges incoming to a vertex. LabelVerticesAndEdges Label vertices and edges. MinimumSpanningTree Minimum spanning tree of a graph. MutableGraphHelper Create either a vtkMutableDirectedGraph or vtkMutableUndirectedGraph. NOVCAGraph Create a graph & visualize it in ParaView/VisIt. OutEdgeIterator Iterate over edges outgoing from a vertex. RandomGraphSource Create a random graph. RemoveIsolatedVertices Remove vertices of degree 0 from a vtkGraph. ScaleVertices Size/scale vertices based on a data array. SelectedVerticesAndEdges Get a list of selected vertices and edges. SelectedVerticesAndEdgesObserver Get a list of selected vertices and edges using an observer of AnnotationChangedEvent. ShortestPath Find the shortest path on a graph. SideBySideGraphs Display two graphs side by side. TreeBFSIterator Breadth First Search iterator. VertexSize Set the size of vertices. VisualizeDirectedGraph Visualize a directed graph. VisualizeGraph Visualize a graph."},{"location":"Cxx/#graph-conversions","title":"Graph Conversions","text":"Example Name Description Image DirectedGraphToMutableDirectedGraph vtkDirectedGraph to vtkMutableDirectedGraph. MutableDirectedGraphToDirectedGraph vtkMutableDirectedGraph to vtkDirectedGraph. TreeToMutableDirectedGraph vtkTree to vtkMutableDirectedGraph"},{"location":"Cxx/#data-structures","title":"Data Structures","text":"Example Name Description Image AttachAttributes Attach attributes to a VTK array CellLocator Project a point onto a mesh. Closest point on a mesh.Efficient 3D cell query. CellLocatorVisualization Visualization of the tree of a vtkCellLocator. CellTreeLocator Points inside an object using vtkCellTreeLocator. PointLocator Efficient 3D point query. PointLocatorRadius Find all points within a radius of a specified point. PointLocatorVisualization Visualization of the tree of a vtkPointLocator."},{"location":"Cxx/#timing-demonstrations","title":"Timing Demonstrations","text":"Example Name Description Image KDTreeTimingDemo Plot the runtime vs MaxLevel (doesn't seem correct) ModifiedBSPTreeTimingDemo Plot the runtime vs MaxLevel OBBTreeTimingDemo Plot the runtime vs MaxLevel OctreeTimingDemo Plot the runtime vs MaxPointsPerRegionOctree timing demo."},{"location":"Cxx/#kd-tree","title":"KD-Tree","text":"Example Name Description Image BuildLocatorFromKClosestPoints ClosestNPoints Find the closest N points to a query point. DataStructureComparison Illustrates, side by side, the differences between several spatial data structures KDTreeAccessPoints Access the points of a KDTree. KDTreeFindPointsWithinRadius Find points within a specified radius of a query point. KDTreeFindPointsWithinRadiusDemo Find points within a range of radii. KdTree KdTreePointLocatorClosestPoint Find the closest point to a query point. OctreeFindPointsWithinRadiusDemo Find points within a range of radii. PointLocatorFindPointsWithinRadiusDemo Find points within a range of radii. StaticLocatorFindPointsWithinRadiusDemo Find points within a range of radii. VisualizeKDTree Visualize levels of the tree."},{"location":"Cxx/#oriented-bounding-box-obb-tree","title":"Oriented Bounding Box (OBB) Tree","text":"Example Name Description Image OBBTreeExtractCells Intersect a line with an OBB Tree and display all intersected cells. OBBTreeIntersectWithLine Intersect a line with a vtkOBBTree. VisualizeOBBTree Visualize levels of the tree."},{"location":"Cxx/#octree","title":"Octree","text":"Example Name Description Image BuildOctree Create an octree. IncrementalOctreePointLocator Insert points into an octree without rebuilding it. OctreeClosestPoint Find the closest point to a query point. OctreeFindPointsWithinRadius Find the points within a sphere of specified radius to a query point. OctreeKClosestPoints Find the K closest points to a query point. OctreeVisualize Visualize levels of the tree."},{"location":"Cxx/#modified-bsp-tree","title":"Modified BSP Tree","text":"Example Name Description Image ModifiedBSPTreeExtractCells Intersect a line with a modified BSP Tree and display all intersected cells. ModifiedBSPTreeIntersectWithLine Intersect a line with a modified BSP Tree. VisualizeModifiedBSPTree Visualize levels of the tree."},{"location":"Cxx/#hypertreegrid","title":"HyperTreeGrid","text":"Example Name Description Image HyperTreeGridSource Create a vtkHyperTreeGrid."},{"location":"Cxx/#vtk-concepts","title":"VTK Concepts","text":"Example Name Description Image Scalars Attach a scalar value to each point (PointData) or cell (CellData) in a data set."},{"location":"Cxx/#rendering","title":"Rendering","text":"Example Name Description Image AmbientSpheres Demonstrates the effect of ambient lighting on spheres. CameraBlur Example of a scene rendered with focal depth. ColoredSphere A simple sphere. Cone3 Four frames of output, based on the VTK example Cone3.cxx. Cone4 Modifying properties and transformation matrix based on the VTK example Cone4.cxx. DiffuseSpheres Demonstrates the effect of diffuse lighting on spheres. FlatVersusGouraud Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look. GradientBackground Demonstrates the background shading options. HiddenLineRemoval Hidden lines removed. LayeredActors Demonstrates the use of two linked renderers. The orientation of objects in the non active layer is linked to those in the active layer. Mace An example of multiple inputs and outputs. Model Illustrative diagram of graphics objects. MotionBlur Example of motion blur. OutlineGlowPass Demonstrates how to render a object in a scene with a glowing outline. PBR_Anisotropy Render spheres with different anisotropy values. PBR_Clear_Coat Render a cube with custom texture mapping and a coat normal texture. PBR_Edge_Tint Render spheres with different edge colors using a skybox as image based lighting. PBR_HDR_Environment Renders spheres with different materials using a skybox as image based lighting. PBR_Mapping Render a cube with custom texture mapping. PBR_Materials Renders spheres with different materials using a skybox as image based lighting. PBR_Materials_Coat Render spheres with different coat materials using a skybox as image based lighting. PBR_Skybox Demonstrates physically based rendering, a skybox and image based lighting. PBR_Skybox_Texturing Demonstrates physically based rendering, a skybox, image based lighting and texturing. PBR_Skybox_Anisotropy Demonstrates physically based rendering, a skybox, image based lighting, and anisotropic texturing. Rainbow Use and manipulation of vtkLookupTables. Rotations Rotations of a cow about her axes. RotationsA Perform six rotations of a cow about her x-axis (Figure 3-31a). RotationsB Perform six rotations of a cow about her y-axis (Figure 3-31b). RotationsC Perform six rotations of a cow about her z-axis (Figure 3-31c). RotationsD First a rotation of a cow about her x-axis, then six rotations about her y-axis (Figure 3-31d). Shadows Draw model with shadows. SpecularSpheres Demonstrates the effect of specular lighting on spheres. StippledLine Draw a stippled line. StringToImageDemo Demonstrates how to generate images from strings. StripFran Triangle strip examples. (a) Structured triangle mesh consisting of 134 strips each of 390 triangles. (b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip. TransformSphere The addition of a transform filter to ColoredSphere. TransparentBackground Demonstrates the use of two renderers. Notice that the second (and subsequent) renderers will have a transparent background. WalkCow This generates Figs. 3-32, 3-33 found in VTKTextbook.pdf. WalkCowA This generates Fig. 3-33a found in VTKTextbook.pdf. WalkCowB This generates Fig. 3-33b found in VTKTextbook.pdf."},{"location":"Cxx/#lighting","title":"Lighting","text":"Example Name Description Image Light Add a directional light to a scene. LightActor Display the location and direction of a light. ShadowsLightsDemo Show lights casting shadows. SpotLights Create two positional(spot) lights."},{"location":"Cxx/#shaders","title":"Shaders","text":"Example Name Description Image BozoShader Modify the shader to load and use noise functions for color selection. BozoShaderDemo Show the bozo shader on a variety of polydata models. ColorByNormal Modify the shader to color based on model normal. CubeMap Modify the Vertex and Frament shaders to apply a 6-sided cube map. MarbleShader Modify the shader to load and use noise functions for color selection. MarbleShaderDemo Explore parameter space with sliders. SpatterShader Modify the shader to load and use noise functions for color selection. SphereMap Modify the Vertex and Frament shaders to apply a spherical map."},{"location":"Cxx/#annotation","title":"Annotation","text":"Example Name Description Image MultiLineText Display multiline text. TextOrigin The 3D text always faces the active camera. XYPlot Display line probes."},{"location":"Cxx/#texture-mapping","title":"Texture Mapping","text":"Example Name Description Image AnimateVectors One frame from a vector field animation using texture maps (animVectors.tcl). BackgroundTexture Use a texture for the background of a vtkRenderer. ClipArt Generate 3D clip art from an image. ProjectedTexture Project a texture onto ovtkPolyData. TextureCutQuadric Cut a quadric with boolean textures. TextureCutSphere Cut a sphere using texture coordinates. TextureMapImageData Texture map an ImageData. TextureMapPlane Texture map a plane. TextureMapQuad Texture map a quad. TexturePlane Example of texture mapping. TextureThreshold Demonstrate the use of scalar thresholds to show values of flow density on three planes. TexturedSphere Texture a sphere."},{"location":"Cxx/#tutorial","title":"Tutorial","text":"

        If you are new to VTK then these tutorials will help to get you started.

        Tutorial Description Image Step 1 Create a cone, render it and rotate it through 360\u00b0. Step 2 Adding an observer. Step 3 Using multiple renderers within a render window. Step 4 The creation of multiple actors and the manipulation of their properties and transformations. Step 5 Introducing the concept of interaction. Step 6 Using a 3D widget."},{"location":"Cxx/#visualization","title":"Visualization","text":"

        See this tutorial for a brief explanation of the VTK terminology of mappers, actors, etc.

        Example Name Description Image AlphaFrequency Linearly extrude fonts to show letter frequencies in text. AnatomicalOrientation Show a labelled set of anatomical planes transecting a human figure. AnnotatedCubeActor Annotated cube. Arbitrary3DCursor Track a 3D cursor. AssignCellColorsFromLUT Demonstrates how to assign colors to cells in a vtkPolyData structure using lookup tables. AxisActor Generate a single axis. BackfaceCulling Backface culling. BackgroundColor Background color. BackgroundGradient Background gradient. BillboardTextActor3D Label points with billboards. BlobbyLogo Blobby logo from VTK textbook. Blow Ten frames from a blow molding finite element analysis. BluntStreamlines Demonstrates airflow around a blunt fin using streamlines. Camera Positioning and aiming the camera. CameraActor Visualize a camera (frustum) in a scene. CameraModel1 Illustrate camera movement around the focal point. CameraModel2 Illustrate camera movement centered at the camera position. CaptionActor2D Draw a caption/bubble pointing to a particular point. CarotidFlow Visualizing blood flow in the human carotid arteries. Streamtubes of flow velocity are generated. CarotidFlowGlyphs Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude. ChooseTextColor Choose a text color that contrasts with a background color. ChooseTextColorDemo Create a grid of random colored viewpports and pick a good text color. ClipSphereCylinder A plane clipped with a sphere and an ellipse. The two transforms place each implicit function into the appropriate position. Two outputs are generated by the clipper. CloseWindow Close a render window. CollisionDetection Collison between two spheres. ColorActorEdges Color the edges of an Actor. ColorAnActor Color an Actor. ColorGlyphs Color glyphs. ColorSeriesPatches Creates a HTML file called VTKColorSeriesPatches ColoredAnnotatedCube How to color the individual faces of an annotated cube. CombustorIsosurface Generate an isosurface of constant flow density. ComplexV ComplexV from the VTK Textbook. ContourQuadric Contouring a quadric function. CornerAnnotation Write text in the corners of a window. CorrectlyRenderTranslucentGeometry Correctly Rendering Translucent Geometry. CreateBFont A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles. CreateColorSeriesDemo Create a custom vtkColorSeries. CubeAxesActor Display three orthogonal axes with labels. CubeAxesActor2D This example uses the vtkCubeAxesActor2D to show your scene with axes to indicate the spatial extent of your data. Cursor3D CursorShape Change the shape of the cursor. CurvatureBandsWithGlyphs Demonstrates the coloring of a surface by partitioning the gaussian curvature of a surface into bands and using arrows to display the normals on the surface. CurvedReformation Sample a volume with a curved surface. In medical imaging, this is often called curved multi planar reformation. CutStructuredGrid Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. Cutter How to use vtkCutter by cutting through a cube. DataSetSurface Cutting a hexahedron with a plane. The red line on the surface shows the cut. DecimateFran Examples of decimation algorithm. (a) Decimation of laser digitizer data. DecimateHawaii Examples of decimation algorithm. (b) Decimation of terrain data. DepthSortPolyData Poly Data Depth Sorting. DisplacementPlot Show modal lines for a vibrating beam. DisplayCoordinateAxes Display coordinate axes. DisplayQuadricSurfaces Display Quadric Surfaces. DistanceToCamera DrawText Display Text. EdgePoints Generate points along an edge. ElevationBandsWithGlyphs Demonstrates the coloring of a surface by partitioning the elevation into bands and using arrows to display the normals on the surface. ExponentialCosine Carpet plots. Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values. ExtrudePolyDataAlongLine Extrude a 2D polydata along a line in 3D space. FastSplatter Convolve a splat image with every point in an input image. FindCellIntersections Find the intersection of a line and the cells in an unstructured dataset FireFlow Combine geometry from a VRML file and a solution from a vtkUnstructuredGrid file. FireFlowDemo Combine geometry from a VRML file and a solution from a vtkUnstructuredGrid file (interactive). FlatShading FlyingHeadSlice Flying edges used to generate contour lines. Follower Draw text that stays right side up. FontFile Use an external font. FrogBrain The frog\u2019s brain. Model extracted without smoothing (left) and with smoothing (right). FroggieSurface Construct surfaces from a segmented frog dataset. Up to fifteen different surfaces may be extracted. You can turn on and off surfaces and control the camera position. FroggieView View surfaces of a segmented frog dataset using preprocessed *.vtk tissue files. You can turn on and off surfaces, control their opacity through the use of sliders and control the camera position. FrogSlice Photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow. Glyph2D Glyph3D Glyph3DImage Glyph the points in a vtkImageData. Glyph3DMapper Hanoi Towers of Hanoi. HanoiInitial Towers of Hanoi - Initial configuration. HanoiIntermediate Towers of Hanoi - Intermediate configuration. Hawaii Visualize elevations by coloring the scalar values with a lookup table. HeadBone Marching cubes surface of human bone. HeadSlice Marching squares used to generate contour lines. HedgeHog Create oriented lines (hedgehogs) from vector data. HideActor visible HideAllActors Hide all actors. HyperStreamline Example of hyperstreamlines, the four hyperstreamlines shown are integrated along the minor principle stress axis. A plane (colored with a different lookup table) is also shown. IronIsoSurface Marching cubes surface of iron-protein. IsosurfaceSampling Demonstrates how to create point data on an isosurface. Kitchen Demonstrates stream tracing in a kitchen. KochSnowflake Use recursion to represent a Koch snowflake fractal. LODProp3D Level of detail rendering. LOx Streamtubes created by using the computational grid just in front of the post as a source for seeds. LOxGrid Portion of computational grid for the LOx post. LOxSeeds Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown. LabelContours Label Contours. LabelPlacementMapper Display a non-overlapping text label at each point. LabeledDataMapper Display the point ID at each point. LabeledMesh Label Mesh. Legend LegendScaleActor Display the scale of a scene. LineWidth Change the width/thickness of lines in an actor. LoopShrink A network with a loop. VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK. Morph3D Interpolate between datasets. Motor Texture cut used to reveal internal structure of a motor. Two cut planes are used in combination with transparent texture. MovableAxes Movable axes. MoveActor Moving an Actor. MoveCamera Moving the Camera. MultipleActors Multiple Actors. NamedColorPatches Creates a HTML file called VTKNamedColorPatches NamedColors Demonstrate the use of the vtkNamedColors class. NoShading NormalsDemo Demo different options to generate normals. Office Using random point seeds to create streamlines. OfficeA Corresponds to Fig 9-47(a) in the VTK textbook. OfficeTube The stream polygon. Sweeping a polygon to form a tube. Opacity Transparency, transparent. OrientedGlyphs Create oriented glyphs from vector data. PineRootConnectivity Applying the connectivity filter to remove noisy isosurfaces. PineRootConnectivityA The isosurface, with no connectivity filter applied. PineRootDecimation Applying the decimation and connectivity filters to remove noisy isosurfaces and reduce data size. PlateVibration Demonstrates the motion of a vibrating beam. PointDataSubdivision Demonstrates the effect of applying these filters on various sources. PointSize ProbeCombustor Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. ProgrammableGlyphFilter Generate a custom glyph at each point. ProteinRibbons Display pdb ribbons. PseudoVolumeRendering Here we use 100 cut planes, each with an opacity of 0.05. They are then rendered back-to-front to simulate volume rendering. QuadraticSurface Display a quadratic surface. QuadricLODActor Level of detail adjustment. QuadricVisualization Visualizing a quadric function. RandomProbe Demonstrates how to probe a dataset with random points and select points inside the data set. RenderLargeImage Render a large image, larger than a window. RenderView A little bit easier rendering. ReverseAccess Demonstrates how to access the source (e.g. vtkSphereSource) of an actor reversely. RotateActor Rotate an Actor. ScalarBarActor Display a color bar. ScalarBarActorColorSeries Display a color bar with a color series lookup table. ScalarVisibility Switch between coloring the actor and coloring the data. ScaleGlyphs Scale glyphs. SceneBounds Get the bounds of the whole scene. SelectWindowRegion Select a region of a window. SingleSplat Elliptical splatting. (a) Single elliptical splat with eccentricity E=10. Cone shows orientation of vector. SpikeFran Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected. SplatFace Elliptical splatting. (b) Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction. Points regularly subsampled and overlaid on original mesh. Stocks Two views from the stock visualization script. The top shows closing price over time; the bottom shows volume over time. StreamLines Seed streamlines with vectors from a structured grid. StreamlinesWithLineWidget Using the vtkLineWidget to produce streamlines in the combustor dataset. The StartInteractionEvent turns the visibility of the streamlines on; the InteractionEvent causes the streamlines to regenerate themselves. StructuredDataTypes Demonstration of structured data types. TensorAxes Display the scaled and oriented principal axes of the stress tensor. TensorEllipsoids Display the scaled and oriented principal axes as tensor ellipsoids representing the stress tensor. TensorGlyph Draw a rotated/scaled glyph at each point. TextSource Display text. TransformActor Transform an Actor. TransformActorCollection Transform an actor collection. TubesFromSplines Create tubes from interpolated points and scalars. TubesWithVaryingRadiusAndColors Create tubes with varying radius and colors. VectorField VectorOfActors Multiple Actors in a Vector. VectorText Display high resolution text. VelocityProfile Warping the geometry of three planes to show flow momentum. VertexGlyphFilter Add a vertex to each point. Visualize2DPoints Visualize a 2D Set of Points. VisualizeImageData Visualize the points of an ImageData. VisualizeVTP Visualize a VTP File. VoxelsOnBoundary Extract voxels on the border of an isosurface. WarpCombustor Carpet plots of combustor flow energy in a structured grid. Colors and plane displacement represent energy values. WindowSize Change the size of a window. WindowTitle Change the title of a window. Wireframe"},{"location":"Cxx/#volume-rendering","title":"Volume Rendering","text":"Example Name Description Image FixedPointVolumeRayCastMapperCT Volume render DICOM or Meta volumes with various vtkColorTransferFunction's. HAVS IntermixedUnstructuredGrid mix of poly data and unstructured grid volume mapper. MinIntensityRendering Min intensity rendering. RayCastIsosurface Isosufaces produced by volume rendering. SimpleRayCast Volume rendering of a high potential iron protein. SmartVolumeMapper Smart volume mapper."},{"location":"Cxx/#user-interaction","title":"User Interaction","text":"Example Name Description Image AreaPicking Area Picking. Assembly Combine/group actors into an assembly. CallBack Setting up a callback with client data. Two different methods are demonstrated. CallData Pass an observer a value (via CallData). CellPicking Cell Picking. ClientData Give an observer access to an object (via ClientData). DoubleClick Catch a double click. EllipticalButton Create an elliptical button. Game Move a cube into a sphere. HighlightPickedActor Highlight a picked actor by changing its color. HighlightSelectedPoints Highlight Selected Points. HighlightSelection Highlight selection. HighlightWithSilhouette Highlight a picked actor by adding a silhouette. ImageClip Demonstrates how to interactively select and display a region of an image. ImageRegion Select a region of an image. InteractorStyleTerrain Terrain mode. InteractorStyleUser Create a completely custom interactor style (no default functionality is provided) KeypressEvents Handle keypress events. KeypressObserver This uses a callback function rather than a derived interactor class. Handle keypress events (lightweight). MouseEvents Subclass the interactor style. Handle mouse events. MouseEventsObserver Use an observer. Handle mouse events (light weight). MoveAGlyph Drag a glyph around. MoveAVertexUnstructuredGrid Click and drag a vertex of a vtkUnstructuredGrid. ObserverMemberFunction Set observers to be class member functions. PickableOff Disallow interaction with a specific actor. Picking Get the world coordinate of the mouse click (if you clicked an actor) PointPicker Get the coordinates of the closest point in the data set to the mouse click. RubberBand2D RubberBand2DObserver RubberBand2D Observer. RubberBand3D RubberBandPick RubberBandZoom SelectAVertex Click and drag a vertex of a vtkPolyData. SelectAnActor Select an actor. ShiftAndControl Hold/holding down a key. Check if shift or control is being held. StyleSwitch Choose between multiple interaction modes. TrackballActor Trackball actor mode. TrackballCamera Trackball camera mode. UserEvent Simple observer. Create, invoke, and handle a custom event. WorldPointPicker Get world coordinates of mouse click."},{"location":"Cxx/#working-with-images","title":"Working with Images","text":"Example Name Description Image Actor2D 2D actor and mapper. BackgroundImage Display an image as the background of a scene. BorderPixelSize Set the size of border pixels. CannyEdgeDetector Perform Canny edge detection on an image. Cast Cast an image to a different type. DotProduct Compute the pixel-wise dot product of two vector images. DrawOnAnImage Drawing on an image. DrawShapes Drawing shapes in an image. ExtractComponents Extract components of an image. This can be used to get, for example, the red channel of an image. FillWindow Fit imageSetup the camera to fill the window with an image. ImageAccumulateGreyscale Display a grey scale histogram. ImageCheckerboard Visually Compare Two Images. ImageCityBlockDistance Compute the Manhattan distance from every point to every black point in a binary image. ImageDilateErode3D Dilate or erode an image. ImageExport Export an image to a C array. ImageGridSource Create a image of a grid. ImageHistogram Compute the histogram of an image. ImageHybridMedian2D Median filter an image. ImageIdealHighPass High pass filter an image. ImageImport Import an image from a C array. ImageIslandRemoval2D Remove small patches from an image. ImageMagnify Supersample and stretch an image. ImageMandelbrotSource Create a Mandelbrot image. ImageMapper Display an image in 2D. ImageMask Mask a region of an image. ImageMathematics Perform mathematical operations on an image. ImageMedian3D Median filter a 3d or 2d image. ImageMirrorPad Pad the edges of an extended image by mirror existing pixels. ImageNonMaximumSuppression Find peaks in an image using non maximum suppression. ImageOpenClose3D Open or close (morphologically) an image. ImageOrder Determine the display order of a stack of images. ImageOrientation Orientation of the view of an image. ImageRFFT Inverse FFT. ImageRange3D Replace every pixel with the range of its neighbors according to a kernel. ImageRotate Rotate a 2D image. This is even more powerful than vtkImageSliceMapper. It can also do oblique slices. ImageSeparableConvolution Convolve a separable kernel with an image. ImageShiftScale Shift and scale an image. ImageSinusoidSource Create a sinusoidal image. ImageSlice Visualize and interact with an image. This is even more powerful than vtkImageSliceMapper. It can also do oblique slices. ImageSliceMapper Visualize and interact with an image. This is the new way to do this. It is much more powerful. ImageStack Display layers of images. ImageStencil Copy one image into another image. ImageText Draw text in an image. ImageThreshold Threshold an image. ImageToPolyDataFilter Convert a vtkImageData to a vtkPolyData. ImageToStructuredPoints Convert a vtkImageData to a vtkStructuredPoints. ImageTransparency Set transparency of image pixels. InteractWithImage Visualize and interact with an image. Interpolation Set the interpolation type for the display of an image. If pixels look blurry instead of sharp when zoomed in, change this. MarkKeypoints Mark keypoints in an image. NegativeIndices A very powerful feature of vtkImageData is that you can use negative indices. PickPixel Picking a pixel. PickPixel2 Picking a pixel 2 - modified version for exact pixel values. RTAnalyticSource An image source that can be used for regression testing StaticImage This will display the image, but not allow you to interact with it. Transparency Make part of an image transparent."},{"location":"Cxx/#image-processing","title":"Image Processing","text":"Example Name Description Image Attenuation This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. CenterAnImage Center an image. Colored2DImageFusion Blending 2D images with different color maps. CombineImages Combine two images. CombiningRGBChannels Combine layers into an RGB image. EnhanceEdges High-pass filters can extract and enhance edges in an image. Subtraction of the Laplacian (middle) from the original image (left) results in edge enhancement or a sharpening operation (right). Flip Flip an image. GaussianSmooth Low-pass filters can be implemented as convolution with a Gaussian kernel. Gradient Compute the gradient vector at every pixel. HybridMedianComparison Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. IdealHighPass This figure shows two high-pass filters in the frequency domain. The Butterworth high-pass filter has a gradual attenuation that avoids ringing produced by the ideal high-pass filter with an abrupt transition. ImageAccumulate Histogram ImageAnisotropicDiffusion2D Anisotropic diffusion (2D). ImageContinuousDilate3D Dilate an image. ImageContinuousErode3D Erode an image. ImageConvolve Convolve an image with a kernel. ImageCorrelation Correlate two images. ImageDifference Compute the difference image of two images. ImageDivergence Divergence of a vector field. ImageEllipsoidSource Create an image of an ellipsoid. ImageFFT Compute the FFT of an image. ImageGaussianSmooth Smooth an image. ImageGradient Create an imaging pipeline to visualize gradient information. ImageGradientMagnitude Compute the magnitude of the gradient at each pixel of an image. ImageLaplacian Compute the Laplacian of an image. ImageLuminance Convert RGB image to greyscale (luminance). ImageMagnitude grayscaleConvert RGB image to grey scale. ImageMapToColors Use a lookup table to map scalar (gray scale) values to colorsConvert grey scale image to RGB. ImageNoiseSource Create an image of noise. ImagePermute Switch axes of an image. ImageShrink3D Resample an image. ImageSobel2D Sobel edge detection 2D. ImageValueRange Get the range of image pixel values (min/max). ImageVariance3D Construct a new image consisting of the variance of the input image at each pixel. ImageWarp Combine the imaging and visualization pipelines to deform an image in the z-direction. The vtkMergeFilter is used to combine the warped surface with the original color data. IsoSubsample This figure demonstrates aliasing that occurs when a high-frequency signal is subsampled. High frequencies appear as low frequency artifacts. The left image is an isosurface of a skull after subsampling. The right image used a low-pass filter before subsampling to reduce aliasing. MedianComparison Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise. MorphologyComparison This figure demonstrates various binary filters that can alter the shape of segmented regions. Pad Convolution in frequency space treats the image as a periodic function. A large kernel can pick up features from both sides of the image. The lower-left image has been padded with zeros to eliminate wraparound during convolution. On the right, mirror padding has been used to remove artificial edges introduced by borders. RGBToHSI Convert RGB to HSI. RGBToHSV Convert RGB to HSV. RGBToYIQ Convert RGB to YIQ. RescaleAnImage Rescale an image ResizeImage Resize an image using a sinc interpolator. ResizeImageDemo Demonstrate allsinc interpolators to resize an image. VTKSpectrum The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This figure shows an image and its power spectrum displayed using a logarithmic transfer function."},{"location":"Cxx/#widgets","title":"Widgets","text":"Example Name Description Image AffineWidget Apply an affine transformation interactively. AngleWidget AngleWidget2D vtkAngleWidget + vtkAngleRepresentation2D. BalloonWidget BiDimensionalWidget When would you use this? BorderWidget 2D selection, 2D box. BoxWidget BoxWidget2 CameraOrientationWidget Demonstrates a 3D camera orientation widget. CaptionWidget CheckerboardWidget Compare two images using a checkerboard. CompassWidget Draws an interactive compass. ContourWidget Create a contour from a set of points and dynamically change the contour using the points as control points. Cursor2D DistanceWidget HoverWidget How to detect a hover? ImagePlaneWidget ImageTracerWidget Scribble on an image. ImageTracerWidgetInsideContour Highlight pixels inside a non-regular region scribbled on an image. ImageTracerWidgetNonPlanar Draw on a non-planar surface. ImplicitPlaneWidget2 Clip polydata with an implicit plane. LineWidget2 LogoWidget Logo widget. OrientationMarkerWidget Draws two cubes. One of them can be clicked to be rotated, and will rotate the second one. The second one has annotations on it, and can also be moved. OrientationMarkerWidget1 Display a polydata as an orientation icon. PlaneWidget Interact with a plane. PolygonalSurfacePointPlacer Used in conjunction with vtkContourWidget to draw curves on a surface. RectilinearWipeWidget Compare two images. ScalarBarWidget The ScalarBarWidget displays a scalar bar that is movable and changes orientation automatically when close to the borders of the image. It needs a ScalarBarActor SeedWidget Seed widget. SeedWidgetImage How to start the interaction? SeedWidgetWithCustomCallback How to place points in a scene using a custom callback. Slider 3D Slider. Slider2D 2D Slider. SphereWidget Sphere widget. SphereWidget2 SphereWidgetEvents Sphere widget events. SplineWidget TextWidget Draw movable text. TexturedButtonWidget Create a textured 2D button."},{"location":"Cxx/#plotting","title":"Plotting","text":"Example Name Description Image AreaPlot Plot area between two curves. BarChart Bar chart. BoxChart Box plot. ChartMatrix Create a marix of plots. ChartsOn3DScene Draw a chart in a 3D scene. CompareRandomGeneratorsCxx Compare STL random number generators. Diagram Draw a custom diagram. FunctionalBagPlot Functional Bag Plot. Histogram2D 2D Histogram of a vtkImageData. HistogramBarChart Histogram using bar chart. LinePlot Line plot. LinePlot3D Line plot of 3d data. MultiplePlots Display multiple plots by using viewports in a single render window. ParallelCoordinates Parallel coordinates. PieChart Pie chart. PieChartActor Pie chart. ScatterPlot Scatter plot. SpiderPlot Spider plot. StackedBar Stacked bar. StackedPlot Stacked plot. SurfacePlot SurfacePlot."},{"location":"Cxx/#animation","title":"Animation","text":"Example Name Description Image AnimateActors Animate actors. Animation Move a sphere across a scene. AnimationScene Animation (the right way). Zoom in on a sphere. DataAnimation Data Animation. Update points in a dataset every specified interval. DataAnimationSubclass Update points in a dataset every specified interval (using a vtkCommand subclass instead of a callback function. RotatingSphere A rotating sphere."},{"location":"Cxx/#infovis","title":"InfoVis","text":"Example Name Description Image ParallelCoordinatesView Parallel coordinates. TreeMapView Tree map. WordCloud Create a word cloud."},{"location":"Cxx/#qt","title":"Qt","text":"

        Click here for a tutorial on how to setup Qt.

        Example Name Description Image BarChartQt Bar chart. BorderWidgetQt 2D selection, 2D box. EventQtSlotConnect Connect a VTK event to a Qt slot. ImageDataToQImage Convert a vtkImageData to a QImage. MinimalQtVTKApp A minimal Qt/VTK application. QImageToImageSource Convert a QImage to a vtkImageData. RenderWindowNoUiFile This is a very basic example that shows how to create a Qt window. Typically, one would want to design a form in the QtDesigner (this is shown in RenderWindowUISingleInheritance). RenderWindowUISingleInheritance Using a QVTKOpenGLWidget with the Qt Single Inheritance model. ShareCameraQt Share the camera between QVTKOpenGLWidgets. ShowEvent Use QMainWindow::showEvent event to do things that you might want to do in the constructor SideBySideRenderWindowsQt Side by side render windows."},{"location":"Cxx/#matlab","title":"Matlab","text":"

        You must turn on VTK_USE_MATLAB_MEX to use these.

        Example Name Description Image MatlabEngineFilter"},{"location":"Cxx/#databases","title":"Databases","text":""},{"location":"Cxx/#sql","title":"SQL","text":"

        If you have any trouble or errors with the following examples, please troubleshoot using these instructions.

        Example Name Description Image ConnectAndRead Connect to and read a MySQL database. CreateDatabase Create a MySQL database. WriteToDatabase Write to a MySQL database."},{"location":"Cxx/#renderman","title":"RenderMan","text":"

        RenderMan is a high quality rendering system created by Pixar. VTK can export RenderMan RIB files for rendering by prman. In the spring of 2015, Pixar released a non-commercial version of its RenderMan products.

        Example Name Description Image PolyDataRIB Apply a RenderMan Shader to a PolyData."},{"location":"CxxHowTo/","title":"C++ How To","text":"

        Often you just need a \"pointer\" to an example that shows you how to do something.

        Here are some snippets and examples that highlight interesting features that may help you:

        "},{"location":"CxxHowTo/#callback","title":"Callback","text":"Example Name Comments Image CallBack Setting up a callback with client data. Two different methods are demonstrated."},{"location":"CxxHowTo/#camera","title":"Camera","text":"Example Name Comments Image CameraModel1 Illustrate camera movement around the focal point. CameraModel2 camera movement centered at the camera position. CameraOrientationWidget This 3D camera orientation widget can be used in conjunction with CameraPosition to get a nice camera position. CameraPosition Get the camera position while moving the image. MergeSelections Use the same camera for all renderers. ResetCameraOrientation Reset camera orientation to a previously saved orientation. ShareCamera Use the same camera for all renderers."},{"location":"CxxHowTo/#check-the-vtk-version","title":"Check the VTK Version","text":"Example Name Comments Image CheckVTKVersion-Snippet Check the VTK version returning true if the requested VTK version is >= the current version. CheckVTKVersion-Example Check the VTK version and provide alternatives for different VTK versions."},{"location":"CxxHowTo/#coloring","title":"Coloring","text":"Example Name Comments Image BackgroundGradient Background gradient. KochanekSplineDemo How to color the slider components. MergeSelections A nifty way to get a \"harmonious\" set of window colors, using vtkNamedColors and vtkColorSeries. ShareCamera Store background colors in a vector for later extraction of the red, green and blue components."},{"location":"CxxHowTo/#glyphing","title":"Glyphing","text":"Example Name Comments Image PointToGlyph How to represent points as glyphs. QuantizePolyDataPoints Represent a point by a glyph."},{"location":"CxxHowTo/#image","title":"Image","text":"Example Name Comments Image WriteImage Write out an image of various types."},{"location":"CxxHowTo/#multiple-view-ports-and-render-windows","title":"Multiple view ports and render windows","text":"Example Name Comments Image MultipleRenderWindows Multiple Render Windows. MultipleViewports Multiple Viewports."},{"location":"CxxHowTo/#physically-based-rendering","title":"Physically Based Rendering","text":"

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings.

        The results can be quite spectacular, it is hoped that these examples will help you to get started.

        Example Name Comments Image PBR_Anisotropy Render spheres with different anisotropy values. PBR_Clear_Coat Render a cube with custom texture mapping and a coat normal texture. PBR_Edge_Tint Render spheres with different edge colors using a skybox as image based lighting. PBR_HDR_Environment Renders spheres with different materials using a skybox as image based lighting. PBR_Mapping Render a cube with custom texture mapping. PBR_Materials Renders spheres with different materials using a skybox as image based lighting. PBR_Materials_Coat Render spheres with different coat materials using a skybox as image based lighting. PBR_Skybox Demonstrates physically based rendering, a skybox and image based lighting. PBR_Skybox_Texturing Demonstrates physically based rendering, a skybox, image based lighting and texturing. PBR_Skybox_Anisotropy Demonstrates physically based rendering, a skybox, image based lighting, and anisotropic texturing."},{"location":"CxxHowTo/#polydata","title":"Polydata","text":"Example Name Comments Image ReadPolyData This snippet works for most PolyData."},{"location":"CxxHowTo/#random","title":"Random","text":"

        If you want to ensure that the same random points/colors are used in C++ and other languages then it is best to use vtkMinimalStandardRandomSequence.

        Example Name Comments Image ColorDisconnectedRegionsDemo A vtkLookupTable is filled with random colors. HighlightWithSilhouette Here we use randomly positioned spheres with random colors. A vtkLookupTable is filled with random colors."},{"location":"CxxHowTo/#render-windows","title":"Render Windows","text":"Example Name Comments Image Model Multiple render windows."},{"location":"CxxHowTo/#structureddataset","title":"StructuredDataset","text":"

        How to visualise the information in a structured dataset. All these examples use the combustor dataset.

        Example Name Comments Image ColorIsosurface Color an isosurface with a data array. CombustorIsosurface Generate an isosurface of constant flow density. CutStructuredGrid Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. ProbeCombustor Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. PseudoVolumeRendering Here we use 100 cut planes, each with an opacity of 0.05. They are then rendered back-to-front to simulate volume rendering. Rainbow Using different vtkLookupTables. StreamLines Seed streamlines with vectors from a structured grid. StreamlinesWithLineWidget Interact with the streamlines in the combustor dataset. VelocityProfile Warping the geometry of three planes to show flow momentum. WarpCombustor Carpet plots of combustor flow energy in a structured grid. Colors and plane displacement represent energy values. XYPlot Display line probes."},{"location":"Java/","title":"Java Examples","text":"

        Click here for a tutorial on setting up your Java environment.

        It would be appreciated if there are any Java VTK experts who could convert any of the c++ examples to Java!

        "},{"location":"Java/#vtk-classes-summary","title":"VTK Classes Summary","text":"

        This Python script, SelectExamples, will let you select examples based on a VTK Class and language. It requires Python 3.7 or later. The following tables will produce similar information.

        • VTK Classes with Examples, this table is really useful when searching for example(s) using a particular class.

        • VTK Classes with No Examples, please add examples in your area of expertise!

        "},{"location":"Java/#hello-world","title":"Hello World","text":"Example Name Description Image A hello world example Cylinder example from the VTK Textbook and source code. A hello world example."},{"location":"Java/#input-and-output","title":"Input and Output","text":""},{"location":"Java/#graph-formats","title":"Graph Formats","text":""},{"location":"Java/#3d-file-formats","title":"3D File Formats","text":"Example Name Description Image ConvertFile Convert a file from one type to another"},{"location":"Java/#standard-formats","title":"Standard Formats","text":""},{"location":"Java/#input","title":"Input","text":"Example Name Description Image DEMReader Read DEM (elevation map) files ParticleReader This example reads ASCII files where each line consists of points with its position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file format. ReadCML Read Chemistry Markup Language files. ReadOBJ Read an OBJ (.obj) file. ReadPLOT3D Read PLOT3D data files. ReadPLY Read PLY (.ply) files ReadSLC Read an SLC volume file. ReadSTL Read stereo lithography STL (.stl) files. SimplePointsReader Read a simple \"xyz\" file of points."},{"location":"Java/#importers","title":"Importers","text":"Example Name Description Image ThreeDSImporter Import a 3D Studio scene that includes multiple actors. VRMLImporter Import a VRML 2.0 (WRL) file."},{"location":"Java/#output","title":"Output","text":"Example Name Description Image SimplePointsWriter Write a simple \".xyz\" file WritePLY Write PLY (.ply) files. WriteSTL Write stereo lithography STL (.stl) files."},{"location":"Java/#vtk-formats","title":"VTK Formats","text":""},{"location":"Java/#input_1","title":"Input","text":"Example Name Description Image ReadPolyData Read VTK XML PolyData files. ReadRectilinearGrid Read VTK XML RectilinearGrid files. ReadStructuredGrid Read VTK XML StructuredGrid files. ReadVTP Read a VTK XML PolyData file."},{"location":"Java/#output_1","title":"Output","text":"Example Name Description Image WriteVTP Write a VTK XML PolyData file. WriteVTU Write a .vtu file. VTU is an \"Unstructured Grid\". This format allows for 3D data to be stored. XMLPImageDataWriter Write a .pvti file with 4 .vti pieces. XMLPUnstructuredGridWriter Write a .pvtu with 4 .vtu pieces. XMLStructuredGridWriter Write a .vts file from a vtkStructuredGrid."},{"location":"Java/#legacy-vtk-formats","title":"Legacy VTK Formats","text":"Example Name Description Image StructuredPointsReader Read a structured points (.vtk) file."},{"location":"Java/#image-format","title":"Image Format","text":""},{"location":"Java/#input_2","title":"Input","text":"Example Name Description Image JPEGReader Read a JPEG image. ReadBMP Read Windows BMP files. ReadDICOM Read DICOM images. ReadPNM Read PNM (.pnm) files. ReadTIFF Read TIFF (.tif) files."},{"location":"Java/#output_2","title":"Output","text":"Example Name Description Image JPEGWriter Write a JPEG file. PNGReader Read a PNG image. WritePNM Write a PNM (.pnm) file. WriteTIFF Write a TIFF (.tif) file."},{"location":"Java/#annotation","title":"Annotation","text":"Example Name Description Image MultiLineText MultiLineText TextOrigin TextOrigin"},{"location":"Java/#compositedata","title":"CompositeData","text":"Example Name Description Image CompositePolyDataMapper CompositePolyDataMapper"},{"location":"Java/#filtering","title":"Filtering","text":"Example Name Description Image Delaunay2D An example to generate set of points and to triangulate using Delaunay2D Glyph2D Example to copy a polydata to everypoint in the input set. Glyph3D This example applies an object at every point using vtkGlyph3D PerlinNoise An implicit function that implements Perlin noise. TransformPolyData Transforms points, associated normals and vectors for polygonal dataset VertexGlyphFilter Creates a set of points and adds a vertex at each point. WarpTo Deform geometry by warping towards a point"},{"location":"Java/#geometricobjects","title":"GeometricObjects","text":"Example Name Description Image Arrow Arrow Visualization Circle Circle Visualization Cone Cone Visualization ConvexPointSet ConvexPointSet Visualization Disk Disk Visualization EllipticalCylinder EllipticalCylinder Frustum Frustum Visualization Line Line Visualization LongLine A visualization of a long line OrientedArrow Oriented Arrow visualization. OrientedCylinder Oriented Cylinder visualization ParametricObjects ParametricObjects Visualization PlanesIntersection PlanesIntersection Polygon Polygon Visualization Pyramid Pyramid Visualization Quad Quad Visualization RegularPolygonSource RegularPolygon Visualization ShrinkCube Applying shrink filter to an object. TextActor TextActor Demonstration Triangle Triangle Visualization TriangleStrip Triangle Strip Visualization Vertex Vertex Visualization"},{"location":"Java/#hypertreegrid","title":"HyperTreeGrid","text":"Example Name Description Image HyperTreeGridSource Demonstration of a hyper-tree grid source."},{"location":"Java/#geographic-visualization-geovis","title":"Geographic Visualization (Geovis)","text":"Example Name Description Image CompassWidget CompassWidget Visualization EarthSource Earth Source Visualization GeoAssignCoordinates Convert latitude and longitude coordinates to world coordinates."},{"location":"Java/#graphs","title":"Graphs","text":"Example Name Description Image GraphPoints Manually set the coordinates of vertices in a graph. RandomGraphSource A graph with random edges. VisualizeGraph An example to construct a graph and visualize it."},{"location":"Java/#working-with-images","title":"Working with Images","text":"Example Name Description Image Actor2D A actor that draws 2D data Cast Image Data type Casting Filter. ImageSinusoidSource Creates an image with sinusoidal pixel values. RTAnalyticSource Creates an image for regression testing StaticImage Displays a 2D image"},{"location":"Java/#image-processing","title":"Image Processing","text":"Example Name Description Image Flip Flips an image. ImageFFT Compute the Fast Fourier Transform of an image. ImageTest Use Java file dialog to select an image file to display. ShotNoise Create an image using vtkImageCanvasSource2D and write it to a file."},{"location":"Java/#implicit-functions-and-iso-surfaces","title":"Implicit Functions and Iso-surfaces","text":"Example Name Description Image IceCream How to use boolean combinations of implicit functions to create a model of an ice cream cone. ImplicitDataSet Implicit functions, implicit data set. ImplicitSphere ImplicitFunctions, Append poly data, tube filter, sphere SampleFunction Sample an implicit function over a structured point set."},{"location":"Java/#user-interaction","title":"User Interaction","text":"Example Name Description Image Assembly Combine/group actors into an assembly. InteractorStyleTerrain Manipulate camera in scene with natural view up. PickableOff Disallow interaction with a specific actor. RubberBandPick Pick props underneath a rubber band selection rectangle. RubberBandZoom Zoom in by amount indicated by rubber band box. StyleSwitch Choose between multiple interaction modes. TrackballActor Trackball actor mode. TrackballCamera Trackball camera mode."},{"location":"Java/#working-with-meshes","title":"Working with Meshes","text":"Example Name Description Image AddCell Add a cell to an existing mesh. BoundaryEdges Find the edges that are used by only one face. DelaunayMesh Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes."},{"location":"Java/#working-with-3d-data","title":"Working with 3D Data","text":"Example Name Description Image Bottle Sweeps polygonal data creating \"skirt\" from free edges and lines, and lines from vertices CellCenters Compute points at the center of every cell. CenterOfMass Compute the center of mass of the points. ProjectSphere Unroll a sphere or spherical-like model. Spring Rotation in combination with linear displacement and radius variation."},{"location":"Java/#working-with-structured-3d-data","title":"Working with Structured 3D Data","text":"

        This section includes vtkImageData vtkStructuredGrid and vtkRectilinearGrid.

        \"ImageData\" is not the traditional \"flat, 2D image\" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Here is an overview of these data structures. Image data can represent at typical 2D image, but also, a 3D volume.

        "},{"location":"Java/#vtkimagedata","title":"vtkImageData","text":"Example Name Description Image ImageNormalize Normalizes the scalar components for each point. ImageWeightedSum Add two or more images."},{"location":"Java/#vtkstructuredpoints","title":"vtkStructuredPoints","text":"Example Name Description Image StructuredPointsToUnstructuredGrid Convert a vtkStructuredPoints to a vtkUnstructuredGrid. Vol Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26 x 26 x 26."},{"location":"Java/#vtkstructuredgrid","title":"vtkStructuredGrid","text":"Example Name Description Image BlankPoint Blank a point of a vtkStructuredGrid. StructuredGridOutline Creates a wireframe outline for structured grid.

        This section includes vtkImageData, vtkStructuredGrid and vtkRectilinearGrid.

        \"ImageData\" is not the traditional \"flat, 2D image\" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Here is an overview of these data structures. Image data can represent at typical 2D image, but also, a 3D volume.

        "},{"location":"Java/#vtkrectilineargrid","title":"vtkRectilinearGrid","text":"Example Name Description Image RectilinearGrid A dataset that is topologically regular with variable spacing in the three coordinate directions RectilinearGridToTetrahedra Convert a vtkRectilinearGrid to a vtkUnstructuredGrid mesh. VisualizeRectilinearGrid Visualize the cells of a rectilinear grid."},{"location":"Java/#point-cloud-operations","title":"Point Cloud Operations","text":"Example Name Description Image FitImplicitFunction Extract points within a distance to an implicit function."},{"location":"Java/#data-structures","title":"Data Structures","text":""},{"location":"Java/#kd-tree","title":"KD-Tree","text":"Example Name Description Image VisualizeKDTree Show the levels of a KD Tree."},{"location":"Java/#octree","title":"Octree","text":"Example Name Description Image BuildOctree Create an octree."},{"location":"Java/#rendering","title":"Rendering","text":"Example Name Description Image AmbientSpheres Demonstrates the effect of ambient lighting on spheres. ColoredSphere A simple sphere. Cone6 This example introduces 3D widgets. 3D widgets take advantage of the event/observer design pattern. Corresponds to the missing Step 6 Java example from VTK/Examples/Tutorial. Mace An example of multiple inputs and outputs. SpecularSpheres Demonstrates the effect of specular lighting on spheres."},{"location":"Java/#lighting","title":"Lighting","text":"Example Name Description Image LightActor vtkLightActor Demonstration SpotLight vtkSpotLight Demonstration"},{"location":"Java/#math-operations","title":"Math Operations","text":"Example Name Description Image MatrixInverse Represents and manipulates 3x3 transformation matrices. MatrixTranspose The transpose of a matrix is a new matrix whose rows are the columns of the original. NormalizeVector Normalize a vector."},{"location":"Java/#parallel","title":"Parallel","text":"Example Name Description Image ExodusIIWriter Example Program to demonstrates how to use vtkExodusIIWriter"},{"location":"Java/#polydata","title":"PolyData","text":"Example Name Description Image ColorCells ColorCells ColorCellsWithRGB ColorCellsWithRGB ColorDisconnectedRegions ColorDisconnectedRegions ColoredPoints Example to visualize Colored Points. ConvexHullShrinkWrap ConvexHullShrinkWrap KochanekSpline KochanekSpline MeshQuality MeshQuality Outline Outline Reflection Reflection RibbonFilter RibbonFilter RotationAroundLine Rotation around a line. RuledSurfaceFilter Create a surface between lines. Stripper Stripper ThinPlateSplineTransform A nonlinear warp transformation. TransformFilter Transforms points, associated normals and vectors TransformPipeline Combining the transformation, in order to manipulate a group of vtkActor. Shown in the example robot arm motion. TriangleColoredPoints Adding color to each vertex of a triangle TubeFilter TubeFilter Example Name Description Image AVI An example to demonstrate how to make an AVI video using vtkAVIWriter Example Name Description Image RenderView An easier way to make objects appear on the screen using RenderView"},{"location":"Java/#texture-mapping","title":"Texture Mapping","text":"Example Name Description Image TexturePlane Example of texture mapping. TexturedSphere Texture a sphere."},{"location":"Java/#utilities","title":"Utilities","text":"Example Name Description Image BrownianPoints Produce a random vector at each point in a dataset. ColorLookupTable Color Lookup Table. DiscretizableColorTransferFunction Discretizable Color Transfer Function. FullScreen Example to Display Actors in a Full Screen Render Window. FunctionParser String function parser. GetDataRoot Find the path of VTK_DATA_ROOT. PassThrough Shallow copies the input into the output. PiecewiseFunction Interpolation using a piecewise function. ReportRenderWindowCapabilities Report the capabilities of a render window. Screenshot Use a vtkWindow as input to image pipeline. TimerLog Example to Demonstrate Timer support and logging."},{"location":"Java/#arrays","title":"Arrays","text":"Example Name Description Image KnownLengthArray Known Length Array UnknownLengthArray UnKnown Length Array"},{"location":"Java/#video","title":"Video","text":"Example Name Description Image OggTheora Uses the ogg and theora libraries to write video files."},{"location":"Java/#visualization","title":"Visualization","text":"Example Name Description Image AnimDataCone Animate a cone by modifying the polydata points - uses Interaction M key (Motion) to toggle animation. Animation Move a sphere across a scene AnnotatedCubeActor A 3D cube with face labels. BackfaceCulling Turn on/off fast culling of polygons based on orientation of normal with respect to camera. BackgroundColor Example program to set the background color of the render window BackgroundGradient viewport having gradient background using the Background (bottom) and Background2 (top) colors. BlobbyLogo Blobby logo from VTK textbook. Camera A virtual camera for 3D rendering. CameraActor A frustum to represent a camera. ColorActorEdges Color the edges of an Actor. ColorAnActor Switch style interaction adds C and A key actions for selecting Camera or Actor interaction, and T and J key actions for Trackball or Joystick interaction mode. Adds charEvent observer callback to restore the missing E and Q events to quit. ComplexV ComplexV from the VTK Textbook. CornerAnnotation Write text in the corners of a window. CubeAxesActor Display three orthogonal axes with labels. CubeAxesActor2D This example uses the vtkCubeAxesActor2D to show your scene with axes to indicate the spatial extent of your data. Cursor2D Generates a 2D Cursor Representation. Cursor3D Generates a 3D Cursor Representation CursorShape Change the shape of the cursor. Cutter How to use vtkCutter by cutting through a cube. DisplayCoordinateAxes Display coordinate axes. DistanceToCamera Calculate distance from points to the camera. DrawText Display Text. Follower Draw text that stays right side up. ImageOrientation Orientation of the view of an image. Legend Draw symbols with text. LegendScaleActor Display the scale of a scene. LineWidth Change the width/thickness of lines in an actor. LoopShrink A network with a loop. MoveActor Moving an Actor. MoveCamera Moving the Camera. MultipleActors Multiple Actors. MultipleViewports Multiple Viewports. NoShading Opacity Transparency, transparent. OrientedGlyphs Copies oriented and scaled glyph geometry to every input point ProteinRibbons Display pdb ribbons. RandomProbe Demonstrates how to probe a dataset with random points and select points inside the data set. ScalarBarActor Display a color bar. ScalarBarActorColorSeries Display a color bar with a color series lookup table. ScalarVisibility Switch between coloring the actor and coloring the data. SideBySideViewports Side by side viewports. SpikeFran Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected. VectorFieldExample A vector field visualisation. VisualizeImageData Visualize the points of an ImageData. VisualizeVTP Visualize a VTP File. WindowSize Change the size of a window. WireframeSphere A Wireframe Sphere Visualization."},{"location":"Java/#volume-rendering","title":"Volume Rendering","text":"Example Name Description Image SimpleRayCast Volume rendering of a high potential iron protein."},{"location":"Java/#graphs_1","title":"Graphs","text":"Example Name Description Image SelectGraphVertices Select Edges and vertices in a graph"},{"location":"Java/#simpleoperations","title":"SimpleOperations","text":"Example Name Description Image DistanceBetweenPoints Example Program to find squared distance and the Euclidean distance between two 3D points. PerspectiveTransform It is used to describe the full range of homogeneous transformations. It was designed in particular to describe a camera-view of a scene ProjectPointPlane Performs various plane computations. RandomSequence Park and Miller Sequence of pseudo random numbers."},{"location":"Java/#swing-integration","title":"Swing Integration","text":"Example Name Description Image JFrameRender Render a scene in a JFrame using a vtkRenderWindowPanel SwingHandleMouseEvent Display in a JLabel the point the mouse is hovering over using a mouse listener"},{"location":"Java/#widgets","title":"Widgets","text":"Example Name Description Image AngleWidget AngleWidget Demonstration AngleWidget2D AngleWidget2D Demonstration BalloonWidget The balloon text describes each object when you hover it. CaptionWidget Widget for placing a caption (text plus leader) DistanceWidget Measures the distance between two points. ImagePlaneWidget 3D widget for reslicing image data. ImageTracerWidgetNonPlanar 3D widget for tracing on planar props. LogoWidget 2D widget for placing and manipulating a logo OrientationMarkerWidget Display a polydata as an orientation icon. PlaneWidget A finite (bounded) plane that can be interactively placed in a scene. SeedWidget Places multiple seed points, where a user moves the cursor to and clicks it. SplineWidget SplineWidget Demonstration TextWidget Widget for placing text on overlay plane."},{"location":"JavaHowTo/","title":"Java How To","text":"

        Often you just need a \"pointer\" to an example that shows you how to do something.

        Here are some snippets or examples that highlight interesting features that may help you:

        "},{"location":"JavaHowTo/#no-examples-or-snippets-yet","title":"No examples or snippets yet","text":"Example Name Comments Image"},{"location":"JavaScript/","title":"JavaScript","text":"

        The vtk.js project is an exciting new way to use VTK. vtk.js let's you run much of VTK from a browser. Rather than repeat those examples here, please visit the vtk.js examples.

        Info

        This is a very active project. Be sure to visit the project frequently.

        "},{"location":"Python/","title":"Python Examples","text":"

        Please see this page to learn how to setup your environment to use VTK in Python.

        It would be appreciated if there are any Python VTK experts who could convert any of the c++ examples to Python!

        "},{"location":"Python/#vtk-classes-summary","title":"VTK Classes Summary","text":"

        This Python script, SelectExamples, will let you select examples based on a VTK Class and language. It requires Python 3.7 or later. The following tables will produce similar information.

        • VTK Classes with Examples, this table is really useful when searching for example(s) using a particular class.

        • VTK Classes with No Examples, please add examples in your area of expertise!

        "},{"location":"Python/#tutorials","title":"Tutorials","text":"

        If you are new to VTK then these tutorials will help to get you started.

        "},{"location":"Python/#hello-world","title":"Hello World","text":"Example Name Description Image A hello world example Cylinder example from the VTK Textbook and source code. A hello world example."},{"location":"Python/#simple-operations","title":"Simple Operations","text":"Example Name Description Image DistanceBetweenPoints"},{"location":"Python/#input-and-output","title":"Input and Output","text":""},{"location":"Python/#graph-formats","title":"Graph Formats","text":""},{"location":"Python/#3d-file-formats","title":"3D File Formats","text":""},{"location":"Python/#standard-formats","title":"Standard Formats","text":""},{"location":"Python/#input","title":"Input","text":"Example Name Description Image CSVReadEdit Read and edit a CSV file using pandas and numpy. CSVReadEdit1 Read and edit a CSV file using pandas and vtkDelimitedTextReader. ReadExodusData A simple script for reading and viewing ExodusII data interactively. ReadPLOT3D Read CFD (computational fluid dynamics) data produced by PLOT3D. ReadSLC Read an SLC file. ReadSTL Read an STL file. ReadUnstructuredGrid Using vtkUnstructuredGridReader to read a (legacy) *.vtk file ReadVTP Read a VTK XML PolyData file. TransientHDFReader Read transient data written inside a vtkhdf file."},{"location":"Python/#importers","title":"Importers","text":"Example Name Description Image 3DSImporter Import a 3D Studio scene that includes multiple actors."},{"location":"Python/#output","title":"Output","text":"Example Name Description Image WritePLY WriteSTL"},{"location":"Python/#vtk-formats","title":"VTK Formats","text":""},{"location":"Python/#input_1","title":"Input","text":"Example Name Description Image ReadImageData Read an image data (.vti) file ReadPolyData Read a polygonal data (.vtp) file"},{"location":"Python/#output_1","title":"Output","text":""},{"location":"Python/#legacy-vtk-formats","title":"Legacy VTK Formats","text":"Example Name Description Image ReadLegacyUnstructuredGrid Read an unstructured grid that contains 11 linear cells. WriteLegacyLinearCells Write each linear cell into a legacy UnstructuredGrid file. WriteXMLLinearCells Write each linear cell into an XML UnstructuredGrid file (.vtu)."},{"location":"Python/#image-format","title":"Image Format","text":""},{"location":"Python/#input_2","title":"Input","text":"Example Name Description Image HDRReader Read a high-dynamic-range imaging file. ReadDICOM Read DICOM file. ReadDICOMSeries This example demonstrates how to read a series of DICOM images and scroll through slices"},{"location":"Python/#output_2","title":"Output","text":"Example Name Description Image ImageWriter Write an imagefile based on the file extension."},{"location":"Python/#geometric-objects","title":"Geometric Objects","text":"Example Name Description Image Axes Circle A disk is shown however this can be modified to show a circle. ColoredLines Dodecahedron Create a dodecahedron using vtkPolyhedron. EllipticalCylinder Create an elliptical cylinder using extrusion. EllipticalCylinderDemo Show the base and extrusion vector. GeometricObjectsDemo Planes We create a convex hull of the planes for display purposes. PlanesIntersection PolygonIntersection IntersectWithLine() SourceObjectsDemo Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source. Other polygonal source objects are available; check subclasses of vtkPolyDataAlgorithm."},{"location":"Python/#cells","title":"Cells","text":"Example Name Description Image Cell3DDemonstration Sample objects are generated from the classes derived from vtkCell3D and displayed. CellTypeSource Generate tessellated cells. ConvexPointSet Generate a ConvexPointSetCell. Hexahedron LinearCellDemo Linear cell types found in VTK. Numbers define ordering of the defining points. LongLine Manually create a polyline. Point PolyLine Polygon Polyhedron Create an unstructured grid representation of a polyhedron (cube) and write it out to a file. Pyramid Quad Tetrahedron Triangle TriangleStrip Vertex"},{"location":"Python/#sources","title":"Sources","text":"Example Name Description Image Arrow Cone Cube Manually build a polygonal cube. Cube1 A nice simple example that demonstrates the operation of the VTK pipeline. Cylinder Disk A circle with a hole in it. EarthSource Create the Earth. Frustum Line OrientedArrow Orient an arrow along an arbitrary vector. OrientedCylinder Orient a cylinder along an arbitrary vector. Plane PlatonicSolids All five platonic solids are displayed. PolyLine1 This example demonstrates how to create a polygon through several ordered points. RegularPolygonSource ShrinkCube Applying shrink filter to an object. Sphere TessellatedBoxSource Generate a box with tessellated sides. TextActor 2D \"HUD-type\" text"},{"location":"Python/#non-linear","title":"Non Linear","text":"Example Name Description Image IsoparametricCellsDemo Nonlinear isoparametric cell types in VTK. QuadraticHexahedron Create and tessellate a nonlinear cell. QuadraticHexahedronDemo Interactively adjust chord error. QuadraticTetra Create and tessellate a nonlinear cell. QuadraticTetraDemo Interactively adjust chord error."},{"location":"Python/#parametric-objects","title":"Parametric Objects","text":"Example Name Description Image ParametricKuenDemo Interactively change the parameters for a Kuen Surface. ParametricObjectsDemo Demonstrates the Parametric classes added by Andrew Maclean and additional classes added by Tim Meehan. The parametric spline is also included. Options are provided to display single objects, add backface, add normals and print out an image. ParametricSuperEllipsoidDemo Interactively change the parameters for a SuperEllipsoid Surface. ParametricSuperToroidDemo Interactively change the parameters for a SuperToroid Surface."},{"location":"Python/#implicit-functions-and-iso-surfaces","title":"Implicit Functions and Iso-surfaces","text":"Example Name Description Image BooleanOperationImplicitFunctions Demonstrate booleans of two different implicit functions ContourTriangulator Create a contour from a structured point set (image) and triangulate it. CutWithScalars Cut a surface with scalars. DiscreteMarchingCubes Generate surfaces from labeled data. ExtractData Implicit functions used to select data: Two ellipsoids are combined using the union operation used to select voxels from a volume. Voxels are shrunk 50 percent. ExtractLargestIsosurface Extract largest isosurface. Hello Implicit modelling used to thicken a stroked font. IceCream How to use boolean combinations of implicit functions to create a model of an ice cream cone. ImplicitQuadric Create an ellipsoid using an implicit quadric ImplicitSphere Demonstrate sampling of a sphere implicit function ImplicitSphere1 Demonstrate sampling of a sphere implicit function Lorenz Visualizing a Lorenz strange attractor by integrating the Lorenz equations in a volume. MarchingCases Explore the Marching Cubes cases. MarchingCasesA The 256 possible cases have been reduced to 15 cases using symmetry. MarchingCasesB Marching cubes complementary cases. Cases 3c, 6c, 7c, 10c, 12c and 13c are displayed. MarchingCasesC Marching cubes, case 3 is rotated 90 degrees about the y-axis with no label. MarchingCasesD Marching cubes, case 7 is rotated 180 degrees about the y-axis with no label. MarchingCubes Create a voxelized sphere. SampleFunction Sample and visualize an implicit function. SmoothDiscreteMarchingCubes Generate smooth surfaces from labeled data."},{"location":"Python/#working-with-3d-data","title":"Working with 3D Data","text":"Example Name Description Image AlignTwoPolyDatas Align two vtkPolyData's. AppendFilter Append different types of data, BooleanOperationPolyDataFilter This example performs a boolean operation (Intersection, Union, Difference) of two PolyData Bottle Rotationally symmetric objects. CappedSphere Rotate an arc to create a capped sphere. CellsInsideObject Extract cells inside a closed surface. ColoredTriangle Creates a file TriangleColored.vtp. CombinePolyData This example combines Polydata objects, and displays the result to the screen. ConnectivityFilter Color any dataset type based on connectivity. CurvaturesAdjustEdges Get the Gaussian and Mean curvatures of a surface with adjustments for edge effects. CurvaturesDemo Demonstrates how to get the Gaussian and Mean curvatures of a surface. ExtractPolyLinesFromPolyData Extract polylines from polydata. ExtractSelection Extract selected points. ExtractSelectionCells Extract cell, select cell. FilledPolygon Finance Visualization of multidimensional financial data. The gray/wireframe surface represents the total data population. The red surface represents data points delinquent on loan payment. FinanceFieldData Visualization of multidimensional financial data. The yellow surface represents the total data population. The red surface represents data points delinquent on loan payment. Glyph2D Glyph3D ImplicitPolyDataDistance IterateOverLines Iterate through the lines of a PolyData. IterativeClosestPoints LineOnMesh MeshLabelImageColor Outline PerlinNoise PolyDataContourToImageData PolyDataToImageDataStencil RotationAroundLine RuledSurfaceFilter SmoothMeshGrid SolidColoredTriangle Writes out a file TriangleSolidColor.vtp. Spring Rotation in combination with linear displacement and radius variation. TransformPolyData Apply a Transformation to a PolyData. TriangleColoredPoints TriangleCornerVertices TriangleCorners TriangulateTerrainMap Generate heights (z values) on a 10x10 grid (a terrain map) and then triangulate the points to form a surface. TubeFilter Give lines a thickness (produce a cylinder around lines). VertexGlyphFilter Add a vertex to each point. WarpTo Deform geometry by warping towards a point. WarpVector This example warps/deflects a line. WriteTriangleToFile"},{"location":"Python/#data-types","title":"Data Types","text":"Example Name Description Image CompositePolyDataMapper MultiBlockDataSet Demonstrates how to make and use VTK's MultiBlock type data OverlappingAMR Demonstrates how to create and populate a VTK's Overlapping AMR Grid type Data"},{"location":"Python/#data-type-conversions","title":"Data Type Conversions","text":""},{"location":"Python/#point-cloud-operations","title":"Point Cloud Operations","text":"Example Name Description Image PointSource Generate a random point cloud."},{"location":"Python/#working-with-meshes","title":"Working with Meshes","text":"

        This section includes examples of manipulating meshes.

        Example Name Description Image BoundaryEdges Find the edges that are used by only one face. ClosedSurface Check if a surface is closed. ColoredElevationMap Color a mesh by height. Curvatures Compute Gaussian, and Mean Curvatures. Decimation Reduce the number of triangles in a mesh. DeformPointSet Use the vtkDeformPointSet filter to deform a vtkSphereSource with arbitrary polydata. DelaunayMesh Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes. PointInterpolator Plot a scalar field of points onto a PolyData surface."},{"location":"Python/#clipping","title":"Clipping","text":"Example Name Description Image CapClip Cap a clipped polydata with a polygon. ClipDataSetWithPolyData Clip a vtkRectilinearGrid with arbitrary polydata. In this example, use a vtkConeSource to generate polydata to slice the grid, resulting in an unstructured grid. ClipDataSetWithPolyData1 Clip a vtkRectilinearGrid with arbitrary polydata. In this example, use a vtkConeSource to generate polydata to slice the grid, resulting in an unstructured grid. SolidClip Create a \"solid\" clip. The \"ghost\" of the part clipped away is also shown."},{"location":"Python/#working-with-structured-3d-data","title":"Working with Structured 3D Data","text":"

        This section includes vtkImageData, vtkExplicitStructuredGrid, vtkStructuredGrid, vtkStructuredPoints and vtkRectilinearGrid.

        \"ImageData\" is not the traditional \"flat, 2D image\" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Image data can represent at typical 2D image, but also, a 3D volume.

        "},{"location":"Python/#vtkimagedata","title":"vtkImageData","text":"Example Name Description Image ImageWeightedSum Add two or more images."},{"location":"Python/#vtkexplicitstructuredgrid","title":"vtkExplicitStructuredGrid","text":"Example Name Description Image CreateESGrid Create an explicit structured grid and convert this to an unstructured grid or vice versa. LoadESGrid Load a VTU file and convert the dataset to an explicit structured grid."},{"location":"Python/#vtkstructuredgrid","title":"vtkStructuredGrid","text":"Example Name Description Image BlankPoint Blank a point of a vtkStructuredGrid. SGrid Creating a structured grid dataset of a semi-cylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction."},{"location":"Python/#vtkstructuredpoints","title":"vtkStructuredPoints","text":"Example Name Description Image Vol Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26 x 26 x 26."},{"location":"Python/#vtkrectilineargrid","title":"vtkRectilinearGrid","text":"Example Name Description Image RGrid Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray. RectilinearGrid Create a rectilinear grid. VisualizeRectilinearGrid Visualize the cells of a rectilinear grid."},{"location":"Python/#working-with-unstructured-3d-data","title":"Working with Unstructured 3D Data","text":"

        This section includes vtkUnstructuredGrid.

        "},{"location":"Python/#vtkunstructuredgrid","title":"vtkUnstructuredGrid","text":"Example Name Description Image ClipUnstructuredGridWithPlane Clip a UGrid with a plane. ClipUnstructuredGridWithPlane2 Clip a UGrid with a plane. UGrid Creation of an unstructured grid."},{"location":"Python/#registration","title":"Registration","text":""},{"location":"Python/#medical","title":"Medical","text":"Example Name Description Image GenerateCubesFromLabels Create cubes from labeled volume data. GenerateModelsFromLabels Create models from labeled volume data. MedicalDemo1 Create a skin surface from volume data. MedicalDemo2 Create a skin and bone surface from volume data. MedicalDemo3 Create skin, bone and slices from volume data. MedicalDemo4 Create a volume rendering. TissueLens Cut a volume with a sphere."},{"location":"Python/#surface-reconstruction","title":"Surface reconstruction","text":"Example Name Description Image GaussianSplat Create a surface from Unorganized Points (Gaussian Splat)."},{"location":"Python/#utilities","title":"Utilities","text":"Example Name Description Image CheckVTKVersion Check the VTK version and provide alternatives for different VTK versions. ColorMapToLUT_JSON Take an JSON description of a colormap and convert it to a VTK colormap. ColorMapToLUT_XML Take an XML description of a colormap and convert it to a VTK colormap. ColorMapToLUT Use vtkDiscretizableColorTransferFunction to generate a VTK colormap. ConstrainedDelaunay2D Perform a 2D Delaunay triangulation on a point set respecting a specified boundary. Delaunay2D LUTUtilities A utility class for vtkLookupTable allowing you to output the table contents or to compare tables. MultipleRenderWindows Multiple Render Windows. MultipleViewports Multiple Viewports. RescaleReverseLUT Demonstrate how to adjust a colormap so that the colormap scalar range matches the scalar range on the object. You can optionally reverse the colors. ResetCameraOrientation Reset camera orientation to a previously saved orientation. SaveSceneToFieldData Save a vtkCamera's state in a vtkDataSet's vtkFieldData and restore it. SaveSceneToFile Save a vtkCamera's state in a file and restore it. SelectExamples Given a VTK Class and a language, select the matching examples. Screenshot ShareCamera Share a camera between multiple renderers. VTKImportsForPython Generate import statements for the VTK classes in your Python code. VTKModulesForCxx Generate a find_package(VTK COMPONENTS ...) command for CMake. VTKWithNumpy Variant"},{"location":"Python/#arrays","title":"Arrays","text":"Example Name Description Image GetValues RenameArray"},{"location":"Python/#events","title":"Events","text":""},{"location":"Python/#math-operations","title":"Math Operations","text":""},{"location":"Python/#graphs","title":"Graphs","text":"Example Name Description Image ColorEdges Color edges. ColorVertexLabels Set the color of vertex labels. ColorVerticesLookupTable Color vertices. ConstructGraph Construct a graph. ConstructTree Construct a tree. CreateTree Create a tree and label the vertices and edges. EdgeWeights GraphToPolyData Convert a graph to a PolyData. LabelVerticesAndEdges Label vertices and edges. NOVCAGraph RandomGraphSource Create a random graph. ScaleVertices Size/scale vertices based on a data array. SelectedVerticesAndEdges SideBySideGraphs Display two graphs side by side. VisualizeDirectedGraph Visualize a directed graph. VisualizeGraph"},{"location":"Python/#graph-conversions","title":"Graph Conversions","text":""},{"location":"Python/#data-structures","title":"Data Structures","text":""},{"location":"Python/#timing-demonstrations","title":"Timing Demonstrations","text":""},{"location":"Python/#kd-tree","title":"KD-Tree","text":""},{"location":"Python/#oriented-bounding-box-obb-tree","title":"Oriented Bounding Box (OBB) Tree","text":""},{"location":"Python/#octree","title":"Octree","text":""},{"location":"Python/#modified-bsp-tree","title":"Modified BSP Tree","text":""},{"location":"Python/#hypertreegrid","title":"HyperTreeGrid","text":"Example Name Description Image HyperTreeGridSource Create a vtkHyperTreeGrid."},{"location":"Python/#vtk-concepts","title":"VTK Concepts","text":""},{"location":"Python/#rendering","title":"Rendering","text":"Example Name Description Image AmbientSpheres Demonstrates the effect of ambient lighting on spheres. CameraBlur Example of a scene rendered with focal depth. ColoredSphere A simple sphere. Cone3 Four frames of output, based on the VTK example Cone3.py. Cone4 Modifying properties and transformation matrix based on the VTK example Cone4.py. DiffuseSpheres Demonstrates the effect of diffuse lighting on spheres. FlatVersusGouraud Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look. GradientBackground Demonstrates the background shading options. LayeredActors Demonstrates the use of two linked renderers. The orientation of objects in the non active layer is linked to those in the active layer. Mace An example of multiple inputs and outputs. Model Illustrative diagram of graphics objects. MotionBlur Example of motion blur. OutlineGlowPass Demonstrates how to render a object in a scene with a glowing outline. PBR_Anisotropy Render spheres with different anisotropy values. PBR_Clear_Coat Render a cube with custom texture mapping and a coat normal texture. PBR_Edge_Tint Render spheres with different edge colors using a skybox as image based lighting. PBR_HDR_Environment Renders spheres with different materials using a skybox as image based lighting. PBR_Mapping Render a cube with custom texture mapping. PBR_Materials Renders spheres with different materials using a skybox as image based lighting. PBR_Materials_Coat Render spheres with different coat materials using a skybox as image based lighting. PBR_Skybox Demonstrates physically based rendering, a skybox and image based lighting. PBR_Skybox_Texturing Demonstrates physically based rendering, a skybox, image based lighting and texturing. PBR_Skybox_Anisotropy Demonstrates physically based rendering, a skybox, image based lighting, and anisotropic texturing. Rainbow Use and manipulation of vtkLookupTables. Rotations Rotations of a cow about her axes. RotationsA Perform six rotations of a cow about her x-axis (Figure 3-31a). RotationsB Perform six rotations of a cow about her y-axis (Figure 3-31b). RotationsC Perform six rotations of a cow about her z-axis (Figure 3-31c). RotationsD First a rotation of a cow about her x-axis, then six rotations about her y-axis (Figure 3-31d). Shadows Draw model with shadows. SpecularSpheres Demonstrates the effect of specular lighting on spheres. StippledLine Draw a stippled line. StripFran Triangle strip examples. (a) Structured triangle mesh consisting of 134 strips each of 390 triangles. (b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip. TransformSphere The addition of a transform filter to ColoredSphere. TransparentBackground Demonstrates the use of two renderers. Notice that the second (and subsequent) renderers will have a transparent background. WalkCow This generates Figs. 3-32, 3-33 found in VTKTextbook.pdf. WalkCowA This generates Fig. 3-33a found in VTKTextbook.pdf. WalkCowB This generates Fig. 3-33b found in VTKTextbook.pdf."},{"location":"Python/#lighting","title":"Lighting","text":"Example Name Description Image ShadowsLightsDemo Show lights casting shadows."},{"location":"Python/#texture-mapping","title":"Texture Mapping","text":"Example Name Description Image AnimateVectors One frame from a vector field animation using texture maps. TextureCutQuadric Cut a quadric with boolean textures. TextureCutSphere Examples of texture thresholding. (b) Boolean combination of two planes to cut nested spheres. TexturePlane Example of texture mapping. TextureThreshold Demonstrate the use of scalar thresholds to show values of flow density on three planes."},{"location":"Python/#tutorial","title":"Tutorial","text":"

        If you are new to VTK then these tutorials will help to get you started.

        Tutorial Description Image Step 1 Create a cone, render it and rotate it through 360\u00b0. Step 2 Adding an observer. Step 3 Using multiple renderers within a render window. Step 4 The creation of multiple actors and the manipulation of their properties and transformations. Step 5 Introducing the concept of interaction. Step 6 Using a 3D widget."},{"location":"Python/#visualization","title":"Visualization","text":"

        See this tutorial for a brief explanation of the VTK terminology of mappers, actors, etc.

        Example Name Description Image AlphaFrequency Linearly extrude fonts to show letter frequencies in text. AnatomicalOrientation Show a labelled set of anatomical planes transecting a human figure. AnnotatedCubeActor Annotated cube. AssignCellColorsFromLUT Demonstrates how to assign colors to cells in a vtkPolyData structure using lookup tables. BillboardTextActor3D Label points with billboards. BlobbyLogo A logo created with vtkImplicitModeller. Blow Ten frames from a blow molding finite element analysis. BluntStreamlines Demonstrates airflow around a blunt fin using streamlines. Camera Positioning and aiming the camera. CameraModel1 Illustrate camera movement around the focal point. CameraModel2 camera movement centered at the camera position. CarotidFlow Visualizing blood flow in the human carotid arteries. Streamtubes of flow velocity are generated. CarotidFlowGlyphs Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude. ClampGlyphSizes Use vtkGlyph3D with ClampingOn to limit glyph sizes ClipSphereCylinder A plane clipped with a sphere and an ellipse. The two transforms place each implicit function into the appropriate position. Two outputs are generated by the clipper. CollisionDetection Collison between two spheres. ColorAnActor Colour the actor. ColorSeriesPatches Creates a HTML file called VTKColorSeriesPatches ColoredAnnotatedCube How to color the individual faces of an annotated cube. CombustorIsosurface Generate an isosurface of constant flow density. ComplexV ComplexV from the VTK Textbook. ContourQuadric Contouring a quadric function. CreateBFont A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles. CreateColorSeriesDemo Create a custom vtkColorSeries. CubeAxesActor Display three orthogonal axes with labels.FWorking with 3D CurvatureBandsWithGlyphs Demonstrates the coloring of a surface by partitioning the gaussian curvature of a surface into bands and using arrows to display the normals on the surface. CutStructuredGrid Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. Cutter How to use vtkCutter by cutting through a cube. DataSetSurface Cutting a hexahedron with a plane. The red line on the surface shows the cut. DecimateFran Examples of decimation algorithm. (a) Decimation of laser digitizer data. DecimateHawaii Examples of decimation algorithm. (b) Decimation of terrain data. DisplacementPlot Show modal lines for a vibrating beam. DisplayCoordinateAxes Display coordinate axes. DisplayQuadricSurfaces Create and display a quadratic surface. ElevationBandsWithGlyphs Demonstrates the coloring of a surface by partitioning the elevation into bands and using arrows to display the normals on the surface. ExponentialCosine Carpet plots. Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values. FlyingHeadSlice Flying edges used to generate contour lines. FrogBrain The frog's brain. Model extracted without smoothing (left) and with smoothing (right). FroggieSurface Construct surfaces from a segmented frog dataset. Up to fifteen different surfaces may be extracted. You can turn on and off surfaces and control the camera position. FroggieView View surfaces of a segmented frog dataset using preprocessed *.vtk tissue files. You can turn on and off surfaces, control their opacity through the use of sliders and control the camera position. FrogSlice Photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow. GlyphTable Vary the shapes of glyphed points using a glyph table Hanoi Towers of Hanoi. HanoiInitial Towers of Hanoi - Initial configuration. HanoiIntermediate Towers of Hanoi - Intermediate configuration. HardwareSelector Hawaii Visualize elevations by coloring the scalar values with a lookup table. HeadBone Marching cubes surface of human bone. HeadSlice Marching squares used to generate contour lines. HyperStreamline Example of hyperstreamlines, the four hyperstreamlines shown are integrated along the minor principle stress axis. A plane (colored with a different lookup table) is also shown. IronIsoSurface Marching cubes surface of iron-protein. IsosurfaceSampling Demonstrates how to create point data on an isosurface. Kitchen Demonstrates stream tracing in a kitchen. KochSnowflake This example draws a Koch snowflake fractal using recursive functions and some of the convenient tools in the toolkit. LOx Streamtubes created by using the computational grid just in front of the post as a source for seeds. LOxGrid Portion of computational grid for the LOx post. LOxSeeds Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown. LoopShrink A network with a loop. VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK. Motor Texture cut used to reveal internal structure of a motor. Two cut planes are used in combination with transparent texture. NamedColorPatches Creates a HTML file called VTKNamedColorPatches NamedColors Demonstrates how to use the vtkNamedColors class. NormalsDemo Demo different options to generate normals. Office Using random point seeds to create streamlines. OfficeA Corresponds to Fig 9-47(a) in the VTK textbook. OfficeTube The stream polygon. Sweeping a polygon to form a tube. OrientedGlyphs Create oriented glyphs from vector data. PineRootConnectivity Applying the connectivity filter to remove noisy isosurfaces. PineRootConnectivityA The isosurface, with no connectivity filter applied. PineRootDecimation Applying the decimation and connectivity filters to remove noisy isosurfaces and reduce data size. PlateVibration Demonstrates the motion of a vibrating beam. PointDataSubdivision Vary the shapes of glyphed points using a programmable glyph filter PointSize ProbeCombustor Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. ProgrammableGlyphFilter Generate a custom glyph at each point. ProgrammableGlyphs Generate programmable glyphs. PseudoVolumeRendering Here we use 100 cut planes, each with an opacity of 0.05. They are then rendered back-to-front to simulate volume rendering. QuadricVisualization Visualizing a quadric function. SingleSplat Elliptical splatting. (a) Single elliptical splat with eccentricity E=10. Cone shows orientation of vector. SphereTexture Apply an ImageData texture to an sphere SpikeFran Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected. SplatFace Elliptical splatting. (b) Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction. Points regularly subsampled and overlaid on original mesh. Stocks Two views from the stock visualization script. The top shows closing price over time; the bottom shows volume over time. StreamLines Seed streamlines with vectors from a structured grid. StreamlinesWithLineWidget Using the vtkLineWidget to produce streamlines in the combustor dataset. The StartInteractionEvent turns the visibility of the streamlines on; the InteractionEvent causes the streamlines to regenerate themselves. TensorAxes Display the scaled and oriented principal axes of the stress tensor. TensorEllipsoids Display the scaled and oriented principal axes as tensor ellipsoids representing the stress tensor. TextSource VectorText Display high resolution text. VelocityProfile Warping the geometry of three planes to show flow momentum. WarpCombustor Carpet plots of combustor flow energy in a structured grid. Colors and plane displacement represent energy values. WindowTitle"},{"location":"Python/#working-with-vtkimagedata","title":"Working with vtkImageData","text":"Example Name Description Image ImageDataGeometryFilter Convert a vtkImageData to a vtkPolyData. ImageNormalize Normalize an image. SumVTKImages A function to simplify the summing of images, where you can pass a list of images and weights. WriteReadVtkImageData Generate, edit and read out vtk image data."},{"location":"Python/#volume-rendering","title":"Volume Rendering","text":"Example Name Description Image SimpleRayCast Volume rendering of a high potential iron protein."},{"location":"Python/#user-interaction","title":"User Interaction","text":"Example Name Description Image CallBack Setting up a callback with client data. Two different methods are demonstrated. CellPicking Cell Picking. HighlightPickedActor Pick and highlight an actor based on mouse clicks. HighlightWithSilhouette Highlight a picked actor by adding a silhouette. InteractorStyleTrackballActor InteractorStyleTrackballCamera MouseEvents Subclass the interactor style. MouseEventsObserver Use an observer."},{"location":"Python/#working-with-images","title":"Working with Images","text":"Example Name Description Image Actor2D 2D actor and mapper. BackgroundImage Display an image as the \"background\" of a scene, and render a superquadric in front of it. Cast Cast an image to a different type."},{"location":"Python/#image-processing","title":"Image Processing","text":"Example Name Description Image Attenuation This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. EnhanceEdges High-pass filters can extract and enhance edges in an image. Subtraction of the Laplacian (middle) from the original image (left) results in edge enhancement or a sharpening operation (right). GaussianSmooth Low-pass filters can be implemented as convolution with a Gaussian kernel. HybridMedianComparison Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. IdealHighPass This figure shows two high-pass filters in the frequency domain. The Butterworth high-pass filter has a gradual attenuation that avoids ringing produced by the ideal high-pass filter with an abrupt transition. ImageGradient Create an imaging pipeline to visualize gradient information. ImageWarp Combine the imaging and visualization pipelines to deform an image in the z-direction. The vtkMergeFilter is used to combine the warped surface with the original color data. IsoSubsample This figure demonstrates aliasing that occurs when a high-frequency signal is subsampled. High frequencies appear as low frequency artifacts. The left image is an isosurface of a skull after subsampling. The right image used a low-pass filter before subsampling to reduce aliasing. MedianComparison Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise. MorphologyComparison This figure demonstrates various binary filters that can alter the shape of segmented regions. Pad Convolution in frequency space treats the image as a periodic function. A large kernel can pick up features from both sides of the image. The lower-left image has been padded with zeros to eliminate wraparound during convolution. On the right, mirror padding has been used to remove artificial edges introduced by borders. VTKSpectrum The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This figure shows an image and its power spectrum displayed using a logarithmic transfer function."},{"location":"Python/#widgets","title":"Widgets","text":"Example Name Description Image BalloonWidget Uses a vtkBalloonWidget to draw labels when the mouse stays above an actor. BoxWidget This 3D widget defines a region of interest that is represented by an arbitrarily oriented hexahedron with interior face angles of 90 degrees (orthogonal faces). The object creates 7 handles that can be moused on and manipulated. CameraOrientationWidget Demonstrates a 3D camera orientation widget. CompassWidget Draws an interactive compass. ContourWidget Draw a contour (line) which can be deformed by the user ImplicitPlaneWidget2 Clip polydata with an implicit plane. OrientationMarkerWidget Draws two cubes. One of them can be clicked to be rotated, and will rotate the second one. The second one has annotations on it, and can also be moved. OrientationMarkerWidget1 Display a polydata as an orientation icon. ScalarBarWidget The ScalarBarWidget displays a scalar bar that is movable and changes orientation automatically when close to the borders of the image. It needs a ScalarBarActor SphereWidget This 3D widget defines a sphere that can be interactively placed in a scene. SplineWidget This example shows how to use vtkSplineWidget with a callback being used to get the length of the spline widget. TextWidget Annotate a VTK image with movable text"},{"location":"Python/#plotting","title":"Plotting","text":"Example Name Description Image MultiplePlots Display multiple plots by using viewports in a single render window. ScatterPlot Scatter plot. SpiderPlot Spider plot. SurfacePlot Surface plot."},{"location":"Python/#animation","title":"Animation","text":"Example Name Description Image Animation Move a sphere across a scene."},{"location":"Python/#annotation","title":"Annotation","text":"Example Name Description Image MultiLineText Display multiline text. TextOrigin This example demonstrates the use of vtkVectorText and vtkFollower. vtkVectorText is used to create 3D annotation."},{"location":"Python/#infovis","title":"InfoVis","text":"Example Name Description Image ParallelCoordinatesExtraction Extract data based on a selection in a Parallel Coordinates View SelectedGraphIDs Callback on vtkAnnotationLink in a Graph Layout View when selection is changed"},{"location":"Python/#pyqt","title":"PyQt","text":"Example Name Description Image EmbedInPyQt Shows how to easily embed VTK in PyQt with QVTKRenderWindowInteractor, first example EmbedInPyQt2 Shows how to embed VTK in PyQt with QVTKRenderWindowInteractor, second example"},{"location":"PythonHowTo/","title":"Python How To","text":"

        Often you just need a \"pointer\" to an example that shows you how to do something.

        Here are some snippets and examples that highlight interesting features that may help you:

        "},{"location":"PythonHowTo/#callback","title":"Callback","text":"Example Name Comments Image CallBack Setting up a callback with client data. Two different methods are demonstrated."},{"location":"PythonHowTo/#camera","title":"Camera","text":"Example Name Comments Image CameraModel1 Illustrate camera movement around the focal point. CameraModel2 camera movement centered at the camera position. CameraOrientationWidget This 3D camera orientation widget can be used in conjunction with CameraPosition to get a nice camera position. CameraPosition Get the camera position while moving the image. ResetCameraOrientation Reset camera orientation to a previously saved orientation. ShareCamera Use the same camera for all renderers."},{"location":"PythonHowTo/#check-the-vtk-version","title":"Check the VTK Version","text":"Example Name Comments Image CheckVTKVersion-Snippet Check the VTK version returning True if the requested VTK version is >= the current version. CheckVTKVersion-Example Check the VTK version and provide alternatives for different VTK versions."},{"location":"PythonHowTo/#coloring","title":"Coloring","text":"Example Name Comments Image ShareCamera Store background colors in a vector for later extraction of the red, green and blue components."},{"location":"PythonHowTo/#glyphing","title":"Glyphing","text":"Example Name Comments Image InteractorStyleTrackballCamera Here points are represented as glyphs. PointToGlyph How to represent points as glyphs."},{"location":"PythonHowTo/#image","title":"Image","text":"Example Name Comments Image WriteImage Write out an image of various types."},{"location":"PythonHowTo/#multiple-view-ports-and-render-windows","title":"Multiple view ports and render windows","text":"Example Name Comments Image MultipleRenderWindows Multiple Render Windows. MultipleViewports Multiple Viewports."},{"location":"PythonHowTo/#physically-based-rendering","title":"Physically Based Rendering","text":"

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings.

        The results can be quite spectacular, it is hoped that these examples will help you to get started.

        Example Name Comments Image PBR_Anisotropy Render spheres with different anisotropy values. PBR_Clear_Coat Render a cube with custom texture mapping and a coat normal texture. PBR_Edge_Tint Render spheres with different edge colors using a skybox as image based lighting. PBR_HDR_Environment Renders spheres with different materials using a skybox as image based lighting. PBR_Mapping Render a cube with custom texture mapping. PBR_Materials Renders spheres with different materials using a skybox as image based lighting. PBR_Materials_Coat Render spheres with different coat materials using a skybox as image based lighting. PBR_Skybox Demonstrates physically based rendering, a skybox and image based lighting. PBR_Skybox_Texturing Demonstrates physically based rendering, a skybox, image based lighting and texturing. PBR_Skybox_Anisotropy Demonstrates physically based rendering, a skybox, image based lighting, and anisotropic texturing."},{"location":"PythonHowTo/#polydata","title":"Polydata","text":"Example Name Comments Image ReadPolyData This snippet works for most PolyData."},{"location":"PythonHowTo/#random","title":"Random","text":"

        If you want to ensure that the same random points/colors are used in C++ and other languages then it is best to use vtkMinimalStandardRandomSequence.

        Example Name Comments Image HighlightWithSilhouette Here we use randomly positioned spheres with random colors. A vtkLookupTable is filled with random colors."},{"location":"PythonHowTo/#render-windows","title":"Render Windows","text":"Example Name Comments Image Model Multiple render windows."},{"location":"PythonHowTo/#searching-for-relevant-examples","title":"Searching for relevant examples?","text":"Example Name Comments Image SelectExamples Given a VTK Class and a language, select the matching examples."},{"location":"PythonHowTo/#structureddataset","title":"StructuredDataset","text":"

        How to visualise the information in a structured dataset. All these examples use the combustor dataset.

        Example Name Comments Image CombustorIsosurface Generate an isosurface of constant flow density. CutStructuredGrid Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. ProbeCombustor Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. PseudoVolumeRendering Here we use 100 cut planes, each with an opacity of 0.05. They are then rendered back-to-front to simulate volume rendering. Rainbow Using different vtkLookupTables. StreamLines Seed streamlines with vectors from a structured grid. StreamlinesWithLineWidget Interact with the streamlines in the combustor dataset. VelocityProfile Warping the geometry of three planes to show flow momentum. WarpCombustor Carpet plots of combustor flow energy in a structured grid. Colors and plane displacement represent energy values."},{"location":"PythonHowTo/#transforms","title":"Transforms","text":"Example Name Comments Image Frog This code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder."},{"location":"PythonicAPI/","title":"PythonicAPI Examples","text":"

        These examples use the improved VTK Python interface.

        The examples here are either newly crafted ones or upgraded existing Python examples using the improved VTK Python interface.

        See More Pythonic VTK wrapping for the VTK Discourse discussion and Wrap VTK properties to pythonic properties with snake_case names for the merge request.

        "},{"location":"PythonicAPI/#upgrading-an-existing-example-to-use-the-improved-vtk-python-interface","title":"Upgrading an existing example to use the improved VTK Python interface","text":"
        1. Copy the example from the src/Python folder into the src/PythonicAPI folder maintaining the same path structure. If there is a corresponding markdown file, copy it.
        2. Copy the corresponding test image from src/Testing/Baseline/Python/ into src/Testing/Baseline/PythonicAPI/
        3. Edit src/PythonicAPI.md, possibly creating a table and headings to match the original example in src/Python.
        4. Upgrade the Python example.
        5. The associated markdown file (if any) may need checking to ensure any links in the document remain valid.
        6. Check everything is working and do a Merge Request.
        "},{"location":"PythonicAPI/#adding-a-new-example","title":"Adding a new example","text":"

        Follow the documented procedure ForDevelopers remembering that the folder to use is PythonicAPI.

        "},{"location":"PythonicAPI/#vtk-classes-summary","title":"VTK Classes Summary","text":"

        This Python script, SelectExamples, will let you select examples based on a VTK Class and language. It requires Python 3.7 or later. The following tables will produce similar information.

        • VTK Classes with Examples, this table is really useful when searching for example(s) using a particular class.

        • VTK Classes with No Examples, please add examples in your area of expertise!

        "},{"location":"PythonicAPI/#hello-world","title":"Hello World","text":"Example Name Description Image A hello world example Cylinder example from the VTK Textbook and source code. A hello world example."},{"location":"Trame/","title":"Trame Examples","text":"

        Trame is a web framework that weaves together open source components into customized visual analytics easily. It uses the VTK and ParaView platforms as its core, trame provides complete control of 3D visualizations and data movements.

        To familiarize yourself, this tutorial, will teach you

        • how to setup virtual environments in Python for trame
        • how to run an application
        • how to build applications.

        The example applications here are available as tarballs that you download and open on your computer. Once this is done, you will be able to interact with, and also modify, the application.

        "},{"location":"Trame/#vtk-examples","title":"VTK Examples","text":""},{"location":"Trame/#applications","title":"Applications","text":"Example Name Description Image FiniteElementAnalysis Finite element analysis. Multi Filter A multi filter example using VTK. RemoteSelection How to select a data file remotely."},{"location":"Trame/#miniapps","title":"MiniApps","text":"Example Name Description Image SimpleCone Demonstrate basic usage of trame with VTK."},{"location":"Trame/#advanced","title":"Advanced","text":""},{"location":"Trame/#paraview-examples","title":"ParaView Examples","text":""},{"location":"Trame/#applications_1","title":"Applications","text":""},{"location":"Trame/#miniapps_1","title":"MiniApps","text":""},{"location":"Trame/#advanced_1","title":"Advanced","text":""},{"location":"VTKBook/","title":"VTK Textbook Updates","text":"

        Warning

        This is a work in progress.

        We are pleased to provide an update on efforts to update the online resources for the fourth edition of the VTK textbook

        "},{"location":"VTKBook/#the-three-efforts","title":"The Three Efforts","text":"

        There are three coordinated efforts ongoing each with a different goal. Currently, none of the efforts will rewrite sections of the fourth edition. These are the first steps to a possible fifth edition, but that effort will require significant resources.

        • The printed and free online PDF of the VTK textbook is the gold standard for this edition. The online PDF is a low-resolution version that exhibits some difficulty converting equations. It is available as one, down-loadable PDF with no active links. FrameMaker produces the PDF from FrameMaker files capable of producing different PDF resolutions. Editing the FrameMaker files requires a license from Adobe. It is unlikely the VTK community will have access to these proprietary files. Major contributors include Will Schroeder and other Kitware employees. See the PDF here.

        • A VTK LaTeX version of the VTK textbook is a work-in-progress effort. The goal is to produce a version populated with links to figures, references, equations, examples, etc. The PDF version is down-loadable as a single file. The figures that exist as VTK Examples are linked to the nightly output of the regression testing. Once this work is stable, the user community will be able to push merge requests to fix problems with the Latex. The major contributor is Andrew Maclean. You can follow the progress here.

        • A markdown version of the VTK textbook is also a work-in-progress. The goal is to produce an interactive, platform friendly version of the book. The entire text is available on as a Chapter by Chapter web site. The figures that exist as VTK Examples are linked to the nightly output of the regression testing. Once this work is stable, the user community will be able to push merge requests to fix problems with the markdown. The major contributors are Bill Lorensen and Bernhard Meehan. Bernhard has produced Latex for all 100 equations in the text. You can follow the progress here and other chapters.

        "},{"location":"VTKBook/#the-markdown-effort","title":"The Markdown Effort","text":"

        The markdown chapters started with the textbook PDF. We used a PDF to HTML Converter followed by an HTML to Markdown converter. The resulting Markdown file requires lots of hand editing, but much of this editing is repetitive. For the most part we did not edit the text. This means that Tcl in-line code still remains. Also API changes and new features in VTK are not included. A rewrite of the text is a much larger effort and may happen in the future.

        We did add code to link figure references to the figures. We used a set of standard templates to caption the figures. We also link all references to VTK classes to their Doxygen documentation.

        We handle two special cases:

        1) Equations - Berhdard Meehan encoded all of the 100 equations in the text into Latex equations.

        2) Figures - We used the VTKBookFigures to populate all of the figures generated by C++ or Tcl examples. Since Tcl is no longer supported, We translated the Tcl to C++ and Python. Also, Andrew Maclean created Python examples for all of the VTKBookFigures. Some figures do not have associated code, so we captured those figures from the PDF using screen captures.

        "},{"location":"VTKBookFigures/","title":"VTK Book Figure Examples","text":"

        The Visualization Toolkit Text Book was first published in 1995. At that time, the book was unique. It presented the theory behind computer graphics and visualization algorithms. It also provided a free C++ toolkit called VTK. Each theory chapter of the book wrapped up with a section called Putting It All Together. These sections provided examples using the VTK software. The examples were written in C++ or Tcl. As VTK matured, the Application Programming Interface (API) also matured. For example, today, C++ and Python are the preferred languages, although Java is still available. Tcl is no longer supported. Although the VTK software has always been free, until recently the VTK Book was only available commercially. Now, the book, like the software, is also free. View or download the book here.

        Even though the book is over 20 years old, the concepts in the book are still relevant. The dozens of examples in the book are also still valuable for learning and using VTK. We have begun an effort to convert all of the examples in the book into C++ and present them Chapter by Chapter. These examples supplement the hundreds of examples on the VTK Examples web site.

        Since some of the API's have changed, the new implementations may differ from those in the book. Also, since Tcl used less frequently, the examples have been converted to C++. The examples are also enhanced by newer VTK features, like vtkNamedColors and vtkSmartPointer.

        Each Figure example

        1. links to the source code of the new implementation,

        2. links to the doxygen documentation for classes demonstrated,

        3. shows the original figure caption and,

        4. if the example produces an image, links to the full resolution image. If the caption includes a source file reference, e.g. bluntStr.cxx or rotations.tcl, that reference links to the original source code.

        5. if there is a corresponding Python example, a link to that example follows the figure line.

        Please enjoy this new effort to revive and maintain the VTK Figure examples.

        "},{"location":"VTKBookFigures/#chapter-3-computer-graphics","title":"Chapter 3 - Computer Graphics","text":"Figure Caption Image Figure 3-7 Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look. Figure 3-10 Effects of specular coefficients. Specular coefficients control the apparent \u201cshininess\u201d of objects. The top row has a specular intensity value of 0.5; the bottom row 1.0. Along the horizontal direction the specular power changes. The values (from left to right) are 5, 10, 20, and 40 (SpecularSpheres.cxx). Figure 3-12 Camera movements around focal point (camera.tcl). Figure 3-13 Camera movements centered at camera position (camera2.tcl). Figure 3-24 Illustrative diagram of graphics objects (Model.cxx). Figure 3-26 Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source. Other polygonal source objects are available; check subclasses of vtkPolyDataAlgorithm. Figure 3-27 Four frames of output from Cone3.cxx. Figure 3-28 Modifying properties and transformation matrix (Cone4.cxx) Figure 3-31 Rotations of a cow about her axes. In this model, the x axis is from the left to right; the y axis is from bottom to top; and the z axis emerges from the image. The camera location is the same in this and the following four images (rotations.tcl). Figure 3-31a Perform six rotations of a cow about her x-axis. Figure 3-31b Perform six rotations of a cow about her y-axis. Figure 3-31c Perform six rotations of a cow about her z-axis. Figure 3-31d First a rotation of a cow about her x-axis, then six rotations about her y-axis. Figure 3-32 The cow \"walking\" around the global origin (walkCow.tcl). Figure 3-33a The cow rotating about a vector passing through her nose. (a) With origin (0,0,0). (walkCow.tcl). Figure 3-33b The cow rotating about a vector passing through her nose. (b) With origin at (6.1,1.3,.02). (walkCow.tcl)."},{"location":"VTKBookFigures/#chapter-4-the-visualization-pipeline","title":"Chapter 4 - The Visualization Pipeline","text":"Figure Caption Image Figure 4\u20131 Visualizing a quadric function (Sample.cxx) Figure 4-13 Importing and exporting files in VTK. An importer creates a vtkRenderWindow that describes the scene. Exporters use an instance of vtkRenderWindow to obtain a description of the scene (3dsToRIB.tcl) and (flamingo.tcl). Figure 4-19 A simple sphere (ColorSph.cxx). Figure 4-20 The addition of a transform filter to the previous example. (StrSph.cxx). Figure 4-21 An example of multiple inputs and outputs (Mace.cxx). Figure 4-22 A network with a loop. VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK. (LoopShrk.cxx)."},{"location":"VTKBookFigures/#chapter-5-basic-data-representation","title":"Chapter 5 - Basic Data Representation","text":"Figure Caption Image Figure 5-17 Creation of polygonal cube (Cube.cxx). Figure 5-18 Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26 x 26 x 26 (Vol.cxx). Figure 5-19 Creating a structured grid dataset of a semi-cylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction (SGrid.cxx). Figure 5-20 Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray (RGrid.cxx). Figure 5-21 Creation of an unstructured grid (UGrid.cxx)."},{"location":"VTKBookFigures/#chapter-6-fundamental-algorithms","title":"Chapter 6 - Fundamental Algorithms","text":"Figure Caption Image Figure 6-6 Marching cubes cases for 3D isosurface generation. The 256 possible cases have been reduced to 15 cases using symmetry. Dark vertices are greater than the selected isosurface value. Figure 6-9a Marching cubes, case 3 is rotated 90 degrees about the y-axis with no label. Figure 6-9b Marching cubes, case 7 is rotated 180 degrees about the y-axis with no label. Figure 6-10 Marching cubes complementary cases. Cases 3c, 6c, 7c, 10c, 12c and 13c are displayed. Figure 6-11a Contouring examples. (a) Marching squares used to generate contour lines (headSlic.tcl). Also see FlyingHeadSlice (cxx) and FlyingHeadSlice (Python) Figure 6-11b Contouring examples. (b) Marching cubes surface of human bone (headBone.tcl). Figure 6-11c Contouring examples. (c) Marching cubes surface of flow density (combIso.tcl). Figure 6-11d Contouring examples. (d) Marching cubes surface of iron-protein (ironPIso.tcl). Figure 6-12 Computing scalars using normalized dot product. Bottom half of figure illustrates technique applied to terrain data from Honolulu, Hawaii (hawaii.tcl). Figure 6-13 Vector visualization techniques: (a) oriented lines; (b) using oriented glyphs; (c) complex vector visualization (complexV.tcl). Figure 6-14a Warping geometry to show vector field: (a) Beam displacement (vib.tcl). Figure 6-14b Warping geometry to show vector field: (b) Flow momentum (velProf.tcl). Figure 6-15b Vector displacement plots. (b) Surface plot of vibrating plate. Dark areas show nodal lines. Bright areas show maximum motion (dispPlot.tcl). Figure 6-18 Flow velocity computed for a small kitchen (top and side view). Forty streamlines start along the rake positioned under the window. Some eventually travel over the hot stove and are convected upwards (Kitchen.cxx). Figure 6-19 Dashed streamlines around a blunt fin. Each dash is a constant time increment. Fast moving particles create longer dashes than slower moving particles. The streamlines also are colored by flow density scalar (bluntStr.cxx). Figure 6-22a Tensor visualization techniques; (a) Tensor axes TenAxes.tcl Figure 6-22b Tensor visualization techniques; (b) Tensor ellipsoids TenEllip.tcl Figure 6-23b Sampling functions: (b) Isosurface of sampled sphere (sphere.tcl). Figure 6-23c Sampling functions: (b) Isosurface of sampled sphere; (c) Boolean combination of two spheres, a cone, and two planes. (One sphere intersects the other, the planes clip the cone.) (iceCream.tcl). Figure 6-24b Implicit functions used to select data: (b) Two ellipsoids combined using the union operation used to select voxels from a volume. Voxels shrunk 50 percent (extractD.tcl). Figure 6-25 Visualizing a Lorenz strange attractor by integrating the Lorenz equations in a volume. The number of visits in each voxel is recorded as a scalar function. The surface is extracted via marching cubes using a visit value of 50. The number of integration steps is 10 million, in a volume of dimensions 200 3 . The surface roughness is caused by the discrete nature of the evaluation function (Lorenz.cxx) Figure 6-28 Implicit modelling used to thicken a stroked font. Original lines can be seen within the translucent implicit surface ((hello.tcl). Figure 6-3 Flow density colored with different lookup tables. Top-left: grayscale; Top-right rainbow (blue to red); lower-left rainbow (red to blue); lower-right large contrast (rainbow.tcl). Figure 6-30 Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected (spikeF.tcl). Figure 6-31 Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison (cut.tcl). The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. Figure 6-32 100 cut planes with opacity of 0.05. Rendered back-to-front to simulate volume rendering (PseudoVolumeRendering.tcl). Figure 6-33 Cutting a surface model of the skin with a series of planes produces contour lines (cutModel.tcl). Lines are wrapped with tubes for visual clarity. Figure 6-39 Contouring quadric function. Pipeline topology, C++ code, and resulting image are shown (contQuad.cxx). Figure 6-43 Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude. The code fragment shown is from the Tcl script thrshldV.tcl and shows creation of vector glyphs. Figure 6-44 Visualizing blood flow in the human carotid arteries. Streamtubes of flow vectors (streamV.tcl)."},{"location":"VTKBookFigures/#chapter-7-advanced-computer-graphics","title":"Chapter 7 - Advanced Computer Graphics","text":"Figure Caption Image Figure 7-3 One frame from a vector field animation using texture maps (animVectors.tcl). Figure 7-33 Example of texture mapping (TPlane.tcl). Figure 7-34 Volume rendering of a high potential iron protein (SimpleRayCast.tcl). Figure 7-36 Example of motion blur (MotBlur.cxx). Figure 7-37 Example of a scene rendered with focal depth (CamBlur.cxx). Figure 7-39 Using the vtkLineWidget to produce streamlines in the combustor dataset. The StartInteractionEvent turns the visibility of the streamlines on; the InteractionEvent causes the streamlines to regenerate themselves (LineWidget.tcl)."},{"location":"VTKBookFigures/#chapter-8-advanced-data-representation","title":"Chapter 8 - Advanced Data Representation","text":"Figure Caption Image Figure 8-41a (a) Linearly extruded fonts to show letter frequency in text (alphaFreq.cxx). Figure 8-41b (b) Rotationally symmetric objects(bottle.tcl). Figure 8-41c (c) Rotation in combination with linear displacement and radius variation (spring.tcl)."},{"location":"VTKBookFigures/#chapter-9-advanced-algorithms","title":"Chapter 9 - Advanced Algorithms","text":"Figure Caption Image Figure 9-4a Carpet plots. (a) Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values (expCos.cxx). Figure 9-4b Carpet plots. (b) Carpet plot of combustor flow energy in a structured grid. Colors and plane displacement represent energy values (warpComb.tcl). Figure 9-10 A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles (createBFont.tcl). Figure 9-12d The stream polygon. (d) Sweeping polygon to form tube (officeTube.tcl) . Figure 9-15 Example of hyperstreamlines (Hyper.tcl). The four hyperstreamlines shown are integrated along the minor principle stress axis. A plane (colored with a different lookup table) is also shown. Figure 9-19 Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter (probeComb.tcl). Figure 9-21 Triangle strip examples. (a) Structured triangle mesh consisting of 134 strips each of 390 triangles (stripF.tcl). (b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip (uStripeF.tcl). Figure 9-24 Surface normal generation. (a) Faceted model without normals. (b)Polygons must be consistently oriented to accurately compute normals. (c)Sharp edges are poorly represented using shared normals as shown on the corners of this model. (d) Normal generation with sharp edges split (Normals.cxx). Figure 9-27a Examples of decimation algorithm. (a) Decimation of laser digitizer data (deciFran.tcl). Figure 9-27b Examples of decimation algorithm. (b) Decimation of terrain data (deciHawa.tcl). Figure 9-38a Elliptical splatting. (a) Single elliptical splat with eccentricity E=10. Cone shows orientation of vector (singleSplat.cxx). Figure 9-38b Elliptical splatting. (b) Surface reconstructed using elliptical splats into 100 3 volume followed by isosurface extraction. Points regularly subsampled and overlaid on original mesh (splatFace.tcl). Figure 9-43a Examples of texture thresholding. (a) Using scalar threshold to show values of flow density on planes for various values (texThresh.tcl). Figure 9-43b Examples of texture thresholding. (b) Boolean combination of two planes to cut nested spheres (tcutSph.cxx). Figure 9-45b (b) Sixteen boolean textures applied to sphere (quadricCut.cxx). Figure 9-47a Using random point seeds to create streamlines (office.tcl). Figure 9-47b Using random point seeds to create streamlines (office.tcl). Figure 9-48 A plane clipped with a sphere and an ellipse. The two transforms place each implicit function into the appropriate position. Two outputs are generated by the clipper. (clipSphCyl.tcl). Figure 9-50 Visualization of multidimensional financial data. (finance.cxx). The gray/wireframe surface represents the total data population. The red surface represents data points delinquent on loan payment. Figure 9-51a The isosurface, with no connectivity filter applied connPineRoot.tcl. Data is from 256^3 volume data of the root system of a pine tree. Figure 9-51b The isosurface after applying the connectivity filter to remove noisy isosurfaces connPineRoot.tcl. Data is from 256^3 volume data of the root system of a pine tree. Figure 9-52a The isosurface after applying the connectivity filter to remove noisy isosurfaces and reduce data size connPineRoot.tcl. Data is from 256^3 volume data of the root system of a pine tree. Figure 9-52b The isosurface after applying the decimation and connectivity filters to remove noisy isosurfaces and reduce data size deciPineRoot.tcl. Data is from 256^3 volume data of the root system of a pine tree. Figure 9-53 Texture cut used to reveal internal structure of a motor. Two cut planes are used in combination with transparent texture (motor.tcl). Figure 9-54 Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes (DelMesh.tcl) . Only the pipeline to generate triangulation is shown."},{"location":"VTKBookFigures/#chapter-10-image-processing","title":"Chapter 10 - Image Processing","text":"Figure Caption Image Figure 10-3 Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise (MedianComparison..tcl) Figure 10-4 Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. hybrid median (HybridMedianComparison.tcl. Figure 10-5 This figure demonstrates aliasing that occurs when a high-frequency signal is subsampled. High frequencies appear as low frequency artifacts. The lower left image is an isosurface of a skull after subsampling. The right image used a low-pass filter before subsampling to reduce aliasing (IsoSubsample.tcl). Figure 10-6 This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. (Attenuation.tcl).. Figure 10-9 High-pass filters can extract and enhance edges in an image. Subtraction of the Laplacian (middle) from the original image (left) results in edge enhancement or a sharpening operation (right) (EnhanceEdges.tcl). Figure 10-10 The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This figure show an image and its power spectrum displayed using a logarithmic transfer function (VTKSpectrum.tcl). Figure 10-11 This figure shows two high-pass filters in the frequency domain. The Butterworth high-pass filter has a gradual attenuation that avoids ringing produced by the ideal high-pass filter with an abrupt transition (IdealHighPass.tcl). Figure 10-12 Convolution in frequency space treats the image as a periodic function. A large kernel can pick up features from both sides of the image. The lower-left image has been padded with zeros to eliminate wraparound during convolution. On the right, mirror padding has been used to remove artificial edges introduced by borders (Pad.tcl). Figure 10-14 This figure demonstrates various binary filters that can alter the shape of segmented regions (MorphComparison.tcl). Figure 10-16 An imaging pipeline to visualize gradient information. The gradient direction is mapped into color hue value while the gradient magnitude is mapped into the color saturation (ImageGradient.tcl). Figure 10-17 Combining the imaging and visualization pipelines to deform an image in the z-direction (imageWarp.tcl). The vtkMergeFilter is used to combine the warped surface with the original color data. Figure 10-2 Low-pass filters can be implemented as convolution with a Gaussian kernel. (GaussianSmooth.tcl)."},{"location":"VTKBookFigures/#chapter-12-applications","title":"Chapter 12 - Applications","text":"Figure Caption Image Figure 12-2 The skin extracted from a CT dataset of the head (Medical1.cxx). Figure 12-3 Skin and bone isosurfaces (Medical2.cxx). Figure 12-4 Composite image of three planes and translucent skin Medical3.cxx. Figure 12-6 Photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow (frogSlice.tcl). Figure 12-7 The frog\u2019s brain. Model extracted without smoothing (left) and with smoothing (right). Figure 12-9a-d All frog parts and translucent skin. This script generates all four images. Figure 12-11 Two views from the stock visualization script. The top shows closing price over time; the bottom shows volume over time (stocks.tcl). Figure 12-13 A logo created with vtkImplicitModeller (vtkLogo.cxx). Figure 12-14 Portion of computational grid for the LOx post (LOxGrid.tcl). Figure 12-15 Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown. Figure 12-16 Streamtubes created by using the computational grid just in front of the post as a source for seeds (LOx.tcl). Figure 12-17 Ten frames from a blow molding finite element analysis. Mold halves (shown in wireframe) are closed around a parison as the parison is inflated. Coloring indicates thickness\u2014red areas are thinner than blue (blow.tcl) Figure 12-20a Towers of Hanoi. (a) Initial configuration. Figure 12-20b Towers of Hanoi. (b) Intermediate configuration. Figure 12-20c Towers of Hanoi. (c) Final configuration Hanoi.cxx."},{"location":"VTKFileFormats/","title":"VTK File Formats","text":"

        For the latest information relating to the VTK File formats, please refer to this link: VTK File Formats.

        "},{"location":"CSharp/Coverage/CSharpVTKClassesNotUsed/","title":"VTK Classes not used in the Examples","text":""},{"location":"CSharp/Coverage/CSharpVTKClassesNotUsed/#csharp","title":"CSharp","text":"

        Out of 3113 available VTK classes, 2923 have not been used.

        VTK Class VTK Class VTK Class VTK Class VTK Class vtk2DHistogramItem vtk3DCursorRepresentation vtk3DCursorWidget vtk3DLinearGridCrinkleExtractor vtk3DLinearGridInternal vtk3DLinearGridPlaneCutter vtk3DSImporter vtk3DWidget vtkABI vtkADIOS2CoreImageReader vtkADIOS2VTXReader vtkAMRBaseParticlesReader vtkAMRBaseReader vtkAMRBox vtkAMRCutPlane vtkAMRDataInternals vtkAMRDataSetCache vtkAMREnzoParticlesReader vtkAMREnzoReader vtkAMREnzoReaderInternal vtkAMRFlashParticlesReader vtkAMRFlashReader vtkAMRFlashReaderInternal vtkAMRGaussianPulseSource vtkAMRInformation vtkAMRInterpolatedVelocityField vtkAMRResampleFilter vtkAMRSliceFilter vtkAMRToMultiBlockFilter vtkAMRUtilities vtkAMRVelodyneReader vtkAMRVelodyneReaderInternal vtkAMRVolumeMapper vtkAMReXGridHeader vtkAMReXGridLevelHeader vtkAMReXGridReader vtkAMReXGridReaderInternal vtkAMReXParticlesReader vtkAOSDataArrayTemplate vtkASCIITextCodec vtkAVIWriter vtkAVSucdReader vtkAbstractArray vtkAbstractCellArray vtkAbstractCellLinks vtkAbstractCellLocator vtkAbstractContextBufferId vtkAbstractContextItem vtkAbstractElectronicData vtkAbstractGridConnectivity vtkAbstractHyperTreeGridMapper vtkAbstractImageInterpolator vtkAbstractInteractionDevice vtkAbstractInterpolatedVelocityField vtkAbstractMapper vtkAbstractMapper3D vtkAbstractParticleWriter vtkAbstractPicker vtkAbstractPointLocator vtkAbstractPolyDataReader vtkAbstractPolygonalHandleRepresentation3D vtkAbstractPropPicker vtkAbstractRenderDevice vtkAbstractSplineRepresentation vtkAbstractTransform vtkAbstractVolumeMapper vtkAbstractWidget vtkActor2DCollection vtkActorCollection vtkActorNode vtkAdaptiveDataSetSurfaceFilter vtkAdaptiveResampleToImage vtkAdaptiveSubdivisionFilter vtkAdaptiveTemporalInterpolator vtkAddMembershipArray vtkAdjacencyMatrixToEdgeTable vtkAdjacentVertexIterator vtkAffineRepresentation vtkAffineRepresentation2D vtkAffineWidget vtkAggregateDataSetFilter vtkAggregateToPartitionedDataSetCollection vtkAlembicExporter vtkAlgorithm vtkAlgorithmOutput vtkAlignImageDataSetFilter vtkAmoebaMinimizer vtkAnariActorNode vtkAnariCameraNode vtkAnariCompositePolyDataMapperNode vtkAnariFollowerNode vtkAnariLightNode vtkAnariPass vtkAnariPolyDataMapperNode vtkAnariProfiling vtkAnariRendererNode vtkAnariTestInteractor vtkAnariViewNodeFactory vtkAnariVolumeInterface vtkAnariVolumeMapper vtkAnariVolumeMapperNode vtkAnariVolumeNode vtkAnariWindowNode vtkAndroidOutputWindow vtkAndroidRenderWindowInteractor vtkAngleRepresentation vtkAngleRepresentation2D vtkAngleRepresentation3D vtkAngleWidget vtkAngularPeriodicDataArray vtkAngularPeriodicFilter vtkAnimateModes vtkAnimationCue vtkAnimationScene vtkAnnotatedCubeActor vtkAnnotation vtkAnnotationLayers vtkAnnotationLayersAlgorithm vtkAnnotationLink vtkAppendArcLength vtkAppendCompositeDataLeaves vtkAppendDataSets vtkAppendFilter vtkAppendLocationAttributes vtkAppendPartitionedDataSetCollection vtkAppendPoints vtkAppendSelection vtkApplyColors vtkApplyIcons vtkApproximatingSubdivisionFilter vtkArcGridActorPrivate vtkArcParallelEdgeStrategy vtkArcPlotter vtkArcSource vtkArchiver vtkAreaContourSpectrumFilter vtkAreaLayout vtkAreaLayoutStrategy vtkAreaPicker vtkArray vtkArrayCalculator vtkArrayCoordinates vtkArrayData vtkArrayDataAlgorithm vtkArrayDataReader vtkArrayDataWriter vtkArrayDispatch vtkArrayExtents vtkArrayExtentsList vtkArrayInterpolate vtkArrayIterator vtkArrayIteratorIncludes vtkArrayIteratorTemplate vtkArrayListTemplate vtkArrayNorm vtkArrayPrint vtkArrayRange vtkArrayReader vtkArrayRename vtkArrayRenderer vtkArraySort vtkArrayToTable vtkArrayWeights vtkArrayWriter vtkAssembly vtkAssemblyNode vtkAssemblyPath vtkAssemblyPaths vtkAssignAttribute vtkAssignCoordinates vtkAssignCoordinatesLayoutStrategy vtkAtom vtkAtomicMutex vtkAttributeClustering2DLayoutStrategy vtkAttributeDataToFieldDataFilter vtkAttributeDataToTableFilter vtkAttributeSmoothingFilter vtkAttributesErrorMetric vtkAutoCorrelativeStatistics vtkAvatar vtkAxes vtkAxesTransformRepresentation vtkAxesTransformWidget vtkAxis vtkAxisActor vtkAxisActor2D vtkAxisActor2DMock vtkAxisExtended vtkAxisFollower vtkAxisGridActorPrivate vtkBSPCuts vtkBSPIntersections vtkBSplineTransform vtkBTSReader vtkBYUReader vtkBYUWriter vtkBackgroundColorMonitor vtkBalloonRepresentation vtkBalloonWidget vtkBarChartActor vtkBase64InputStream vtkBase64OutputStream vtkBase64Utilities vtkBatchedSurfaceLICMapper vtkBatches vtkBezierContourLineInterpolator vtkBezierCurve vtkBezierHexahedron vtkBezierInterpolation vtkBezierQuadrilateral vtkBezierTetra vtkBezierTriangle vtkBezierWedge vtkBiDimensionalRepresentation vtkBiDimensionalRepresentation2D vtkBiDimensionalWidget vtkBiQuadraticQuad vtkBiQuadraticQuadraticHexahedron vtkBiQuadraticQuadraticWedge vtkBiQuadraticTriangle vtkBilinearQuadIntersection vtkBillboardTextActor3D vtkBinCellDataFilter vtkBinnedDecimation vtkBiomTableReader vtkBitArray vtkBitArrayIterator vtkBivariateLinearTableThreshold vtkBlankStructuredGrid vtkBlankStructuredGridWithImage vtkBlockDistribution vtkBlockIdScalars vtkBlockItem vtkBlockSelector vtkBlueObeliskData vtkBlueObeliskDataParser vtkBond vtkBooleanOperationPolyDataFilter vtkBooleanTexture vtkBoostBetweennessClustering vtkBoostBiconnectedComponents vtkBoostBrandesCentrality vtkBoostBreadthFirstSearch vtkBoostBreadthFirstSearchTree vtkBoostConnectedComponents vtkBoostDividedEdgeBundling vtkBoostExtractLargestComponent vtkBoostKruskalMinimumSpanningTree vtkBoostLogWeighting vtkBoostPrimMinimumSpanningTree vtkBoostRandomSparseArraySource vtkBoostSplitTableField vtkBorderRepresentation vtkBorderWidget vtkBoundaryMeshQuality vtkBoundedPlanePointPlacer vtkBoundedPointSource vtkBoundingBox vtkBox vtkBoxClipDataSet vtkBoxLayoutStrategy vtkBoxMuellerRandomSequence vtkBoxRepresentation vtkBoxWidget vtkBoxWidget2 vtkBreakPoint vtkBrokenLineWidget vtkBrownianPoints vtkBrush vtkBuffer vtkBufferedArchiver vtkButtonRepresentation vtkButtonSource vtkButtonWidget vtkByteSwap vtkCGMWriter vtkCGNSCache vtkCGNSFileSeriesReader vtkCGNSReader vtkCGNSReaderInternal vtkCMLMoleculeReader vtkCONVERGECFDCGNSReader vtkCONVERGECFDReader vtkCPExodusIIElementBlock vtkCPExodusIIElementBlockCellIterator vtkCPExodusIIElementBlockImpl vtkCPExodusIIInSituReader vtkCPExodusIINodalCoordinatesTemplate vtkCPExodusIIResultsArrayTemplate vtkCachedStreamingDemandDrivenPipeline vtkCallbackCommand vtkCamera3DRepresentation vtkCamera3DWidget vtkCameraActor vtkCameraHandleSource vtkCameraInterpolator vtkCameraNode vtkCameraOrientationRepresentation vtkCameraOrientationWidget vtkCameraPass vtkCameraPathRepresentation vtkCameraPathWidget vtkCameraRepresentation vtkCameraWidget vtkCapsuleSource vtkCaptionActor2D vtkCaptionRepresentation vtkCaptionWidget vtkCardinalSpline vtkCastToConcrete vtkCategoryLegend vtkCell3D vtkCellArrayIterator vtkCellAttribute vtkCellAttributeCalculator vtkCellAttributeInformation vtkCellCenterDepthSort vtkCellCenters vtkCellCentersPointPlacer vtkCellData vtkCellDataToPointData vtkCellDerivatives vtkCellDistanceSelector vtkCellGraphicsPrimitiveMap vtkCellGrid vtkCellGridAlgorithm vtkCellGridBoundsQuery vtkCellGridComputeSurface vtkCellGridElevation vtkCellGridElevationQuery vtkCellGridEvaluator vtkCellGridIOQuery vtkCellGridMapper vtkCellGridPointProbe vtkCellGridQuery vtkCellGridRangeQuery vtkCellGridReader vtkCellGridRenderRequest vtkCellGridResponder vtkCellGridResponderBase vtkCellGridResponders vtkCellGridSidesQuery vtkCellGridWriter vtkCellIterator vtkCellLinks vtkCellLocator vtkCellLocatorStrategy vtkCellMetadata vtkCellPicker vtkCellQuality vtkCellSizeFilter vtkCellTreeLocator vtkCellType vtkCellTypeSource vtkCellTypes vtkCellValidator vtkCenterOfMass vtkCenteredSliderRepresentation vtkCenteredSliderWidget vtkCesium3DTilesReader vtkCesium3DTilesWriter vtkCesiumB3DMReader vtkCesiumPointCloudWriter vtkChacoGraphReader vtkChacoReader vtkCharArray vtkChart vtkChart2DHistogram vtkChartBox vtkChartHistogram2D vtkChartLegend vtkChartMatrix vtkChartParallelCoordinates vtkChartPie vtkChartXY vtkChartXYZ vtkCheckerboardRepresentation vtkCheckerboardSplatter vtkCheckerboardWidget vtkCirclePackFrontChainLayoutStrategy vtkCirclePackLayout vtkCirclePackLayoutStrategy vtkCirclePackToPolyData vtkCircularLayoutStrategy vtkCityGMLReader vtkCleanUnstructuredGrid vtkCleanUnstructuredGridCells vtkClearRGBPass vtkClearZPass vtkClientServerCompositePass vtkClientServerSynchronizedRenderers vtkClientSocket vtkClipClosedSurface vtkClipConvexPolyData vtkClipDataSet vtkClipVolume vtkClosedSurfacePointPlacer vtkClosestNPointsStrategy vtkClosestPointStrategy vtkClustering2DLayoutStrategy vtkCocoaMacOSXSDKCompatibility vtkCocoaRenderWindow vtkCocoaRenderWindowInteractor vtkCocoaTkUtilities vtkCoincidentPoints vtkCollapseGraph vtkCollapseVerticesByArray vtkCollectGraph vtkCollectPolyData vtkCollectTable vtkCollection vtkCollectionElement vtkCollectionIterator vtkCollisionDetectionFilter vtkColor vtkColor3 vtkColor3d vtkColor3f vtkColor3ub vtkColor4 vtkColor4d vtkColor4f vtkColor4ub vtkColorLegend vtkColorSeries vtkColorTransferControlPointsItem vtkColorTransferFunction vtkColorTransferFunctionItem vtkCommand vtkCommonInformationKeyManager vtkCommunicator vtkCommunity2DLayoutStrategy vtkCompassRepresentation vtkCompassWidget vtkCompositeCellGridMapper vtkCompositeCellGridReader vtkCompositeControlPointsItem vtkCompositeCutter vtkCompositeDataDisplayAttributes vtkCompositeDataDisplayAttributesLegacy vtkCompositeDataGeometryFilter vtkCompositeDataIterator vtkCompositeDataPipeline vtkCompositeDataProbeFilter vtkCompositeDataReader vtkCompositeDataSet vtkCompositeDataSetAlgorithm vtkCompositeDataWriter vtkCompositeImplicitBackend vtkCompositeInterpolatedVelocityField vtkCompositeMapperHelper2 vtkCompositeMapperHelperData vtkCompositePolyDataMapper vtkCompositePolyDataMapper2 vtkCompositePolyDataMapperDelegator vtkCompositeRGBAPass vtkCompositeRenderManager vtkCompositeSurfaceLICMapper vtkCompositeSurfaceLICMapperDelegator vtkCompositeTransferFunctionItem vtkCompositeZPass vtkCompositedSynchronizedRenderers vtkCompositer vtkCompressCompositer vtkComputeHistogram2DOutliers vtkComputeQuantiles vtkComputeQuartiles vtkConduitArrayUtilities vtkConduitSource vtkConduitToDataObject vtkCone vtkConeLayoutStrategy vtkConnectedPointsFilter vtkConnectivityFilter vtkConstrained2DLayoutStrategy vtkConstrainedPointHandleRepresentation vtkConstrainedSmoothingFilter vtkConsumerDataFilter vtkContext2D vtkContext3D vtkContextActor vtkContextArea vtkContextClip vtkContextDevice2D vtkContextDevice3D vtkContextInteractorStyle vtkContextItem vtkContextKeyEvent vtkContextMapper2D vtkContextMouseEvent vtkContextPolygon vtkContextScene vtkContextScenePrivate vtkContextTransform vtkContextView vtkContingencyStatistics vtkContinuousScatterplot vtkContinuousValueWidget vtkContinuousValueWidgetRepresentation vtkContour3DLinearGrid vtkContourGrid vtkContourHelper vtkContourLineInterpolator vtkContourLoopExtraction vtkContourRepresentation vtkContourRepresentationInternals vtkContourRepresentationNode vtkContourRepresentationPoint vtkContourTriangulator vtkContourValues vtkControlPointsItem vtkConvertSelection vtkConvertSelectionDomain vtkConvertToMultiBlockDataSet vtkConvertToPartitionedDataSetCollection vtkConvertToPointCloud vtkConvertToPolyhedra vtkConvexHull2D vtkConvexPointSet vtkCookieCutter vtkCoordinate vtkCoordinateFrame vtkCoordinateFrameRepresentation vtkCoordinateFrameWidget vtkCornerAnnotation vtkCorrelativeStatistics vtkCosmicTreeLayoutStrategy vtkCountFaces vtkCountVertices vtkCubeAxesActor vtkCubeAxesActor2D vtkCubicLine vtkCuller vtkCullerCollection vtkCursor2D vtkCursor3D vtkCurveRepresentation vtkCutMaterial vtkCylinder vtkCylindricalTransform vtkDGAttributeInformation vtkDGBoundsResponder vtkDGCell vtkDGEdge vtkDGElevationResponder vtkDGEvaluator vtkDGHex vtkDGIOResponder vtkDGInterpolateCalculator vtkDGPyr vtkDGQuad vtkDGRangeResponder vtkDGRenderResponder vtkDGSidesResponder vtkDGTet vtkDGTranscribeUnstructuredCells vtkDGTri vtkDGVert vtkDGWdg vtkDIMACSGraphReader vtkDIMACSGraphWriter vtkDIYAggregateDataSetFilter vtkDIYDataExchanger vtkDIYExplicitAssigner vtkDIYGhostUtilities vtkDIYKdTreeUtilities vtkDIYUtilities vtkDIYUtilitiesCleanup vtkDSPFilterDefinition vtkDSPFilterGroup vtkDataArray vtkDataArrayCollection vtkDataArrayCollectionIterator vtkDataArraySelection vtkDataAssembly vtkDataAssemblyUtilities vtkDataAssemblyVisitor vtkDataCompressor vtkDataEncoder vtkDataObjectAlgorithm vtkDataObjectCollection vtkDataObjectGenerator vtkDataObjectMeshCache vtkDataObjectReader vtkDataObjectToConduit vtkDataObjectToDataSetFilter vtkDataObjectToTable vtkDataObjectTree vtkDataObjectTreeIndex vtkDataObjectTreeInternals vtkDataObjectTreeIterator vtkDataObjectTypes vtkDataObjectWriter vtkDataReader vtkDataRepresentation vtkDataSetAlgorithm vtkDataSetAttributesFieldList vtkDataSetCellIterator vtkDataSetCollection vtkDataSetEdgeSubdivisionCriterion vtkDataSetGradient vtkDataSetGradientPrecompute vtkDataSetReader vtkDataSetRegionSurfaceFilter vtkDataSetToDataObjectFilter vtkDataSetTriangleFilter vtkDataSetWriter vtkDataTransferHelper vtkDataWriter vtkDatabaseToTableReader vtkDateToNumeric vtkDeRhamCell vtkDebugLeaks vtkDebugLeaksManager vtkDebugLeaksObserver vtkDecimatePolylineFilter vtkDefaultPass vtkDeflectNormals vtkDeformPointSet vtkDelaunay3D vtkDelimitedTextReader vtkDelimitedTextWriter vtkDemandDrivenPipeline vtkDendrogramItem vtkDenseArray vtkDensifyPointCloudFilter vtkDensifyPolyData vtkDependentDimensionInfo vtkDepthImageProcessingPass vtkDepthImageToPointCloud vtkDepthOfFieldPass vtkDepthPeelingPass vtkDepthSortPolyData vtkDescriptiveStatistics vtkDeserializer vtkDiagonalMatrixSource vtkDicer vtkDijkstraGraphInternals vtkDijkstraImageContourLineInterpolator vtkDijkstraImageGeodesicPath vtkDimensionInfo vtkDirectedAcyclicGraph vtkDirectedGraph vtkDirectedGraphAlgorithm vtkDirectionEncoder vtkDirectory vtkDiscreteFlyingEdges2D vtkDiscreteFlyingEdges3D vtkDiscreteFlyingEdgesClipper2D vtkDiscreteMarchingCubes vtkDiscretizableColorTransferFunction vtkDisplaySizedImplicitPlaneRepresentation vtkDisplaySizedImplicitPlaneWidget vtkDistancePolyDataFilter vtkDistanceRepresentation vtkDistanceRepresentation2D vtkDistanceRepresentation3D vtkDistanceToCamera vtkDistanceWidget vtkDistributedDataFilter vtkDistributedGraphHelper vtkDistributedPointCloudFilter vtkDotProductSimilarity vtkDrawTexturedElements vtkDualDepthPeelingPass vtkDummyCommunicator vtkDummyController vtkDummyGPUInfoList vtkDuplicatePolyData vtkDynamic2DLabelMapper vtkDynamicLoader vtkEDLShading vtkEGLRenderWindow vtkERFReader vtkEdgeCenters vtkEdgeLayout vtkEdgeLayoutStrategy vtkEdgeListIterator vtkEdgePoints vtkEdgeSubdivisionCriterion vtkEdgeTable vtkEllipseArcSource vtkEllipsoidTensorProbeRepresentation vtkEllipsoidalGaussianKernel vtkEllipticalButtonSource vtkEmptyCell vtkEmptyRepresentation vtkEnSight6BinaryReader vtkEnSight6Reader vtkEnSightGoldBinaryReader vtkEnSightGoldReader vtkEnSightMasterServerReader vtkEnSightReader vtkEnSightWriter vtkEncodedGradientEstimator vtkEncodedGradientShader vtkEndFor vtkEnsembleSource vtkEnzoReaderBlock vtkEnzoReaderInternal vtkEqualizerContextItem vtkEqualizerFilter vtkEquirectangularToCubeMapTexture vtkErrorCode vtkEuclideanClusterExtraction vtkEvenlySpacedStreamlines2D vtkEvent vtkEventData vtkEventDataDevice3D vtkEventDataForDevice vtkEventForwarderCommand vtkEventQtSlotConnect vtkExecutableRunner vtkExecutionAggregator vtkExecutionRange vtkExecutionTimer vtkExecutive vtkExodusIICache vtkExodusIICacheEntry vtkExodusIICacheKey vtkExodusIIReader vtkExodusIIReaderIntPointCheck vtkExodusIIReaderParser vtkExodusIIReaderPrivate vtkExodusIIReaderScalarCheck vtkExodusIIReaderTensorCheck vtkExodusIIReaderVariableCheck vtkExodusIIReaderVectorCheck vtkExodusIIWriter vtkExpandMarkedElements vtkExpandSelectedGraph vtkExplicitStructuredGrid vtkExplicitStructuredGridAlgorithm vtkExplicitStructuredGridCrop vtkExplicitStructuredGridSurfaceFilter vtkExplicitStructuredGridToUnstructuredGrid vtkExporter vtkExprTkFunctionParser vtkExtentRCBPartitioner vtkExtentSplitter vtkExtentTranslator vtkExternalLight vtkExternalOpenGLCamera vtkExternalOpenGLRenderWindow vtkExternalOpenGLRenderer vtkExtractArray vtkExtractBlock vtkExtractBlockUsingDataAssembly vtkExtractCTHPart vtkExtractCells vtkExtractCellsAlongPolyLine vtkExtractCellsByType vtkExtractDataArraysOverTime vtkExtractDataOverTime vtkExtractDataSets vtkExtractEnclosedPoints vtkExtractExodusGlobalTemporalVariables vtkExtractFunctionalBagPlot vtkExtractGeometry vtkExtractGhostCells vtkExtractGrid vtkExtractHierarchicalBins vtkExtractHistogram vtkExtractHistogram2D vtkExtractLevel vtkExtractParticlesOverTime vtkExtractPiece vtkExtractPointCloudPiece vtkExtractPoints vtkExtractPolyDataGeometry vtkExtractPolyDataPiece vtkExtractRectilinearGrid vtkExtractSelectedArraysOverTime vtkExtractSelectedFrustum vtkExtractSelectedGraph vtkExtractSelectedRows vtkExtractSelectedTree vtkExtractSelectionBase vtkExtractStructuredGridHelper vtkExtractSubsetWithSeed vtkExtractSurface vtkExtractTensorComponents vtkExtractTimeSteps vtkExtractUnstructuredGrid vtkExtractUnstructuredGridPiece vtkExtractUserDefinedPiece vtkExtractVOI vtkExtractVectorComponents vtkFDSReader vtkFFMPEGVideoSource vtkFFMPEGWriter vtkFFT vtkFLUENTCFFReader vtkFLUENTReader vtkFXAAOptions vtkFacetReader vtkFacetWriter vtkFast2DLayoutStrategy vtkFastSplatter vtkFiberSurface vtkFidesReader vtkFieldDataSerializer vtkFieldDataToAttributeDataFilter vtkFieldDataToDataSetAttribute vtkFileOutputWindow vtkFileResourceStream vtkFileSeriesHelper vtkFilteringInformationKeyManager vtkFiltersCellGrid vtkFindCellStrategy vtkFiniteDifferenceGradientEstimator vtkFiniteElementFieldDistributor vtkFinitePlaneRepresentation vtkFinitePlaneWidget vtkFitImplicitFunction vtkFitToHeightMapFilter vtkFixedPointRayCastImage vtkFixedPointVolumeRayCastCompositeGOHelper vtkFixedPointVolumeRayCastCompositeGOShadeHelper vtkFixedPointVolumeRayCastCompositeHelper vtkFixedPointVolumeRayCastCompositeShadeHelper vtkFixedPointVolumeRayCastHelper vtkFixedPointVolumeRayCastMIPHelper vtkFixedPointVolumeRayCastMapper vtkFixedSizeHandleRepresentation vtkFixedSizeHandleRepresentation3D vtkFixedWidthTextReader vtkFlagpoleLabel vtkFlashReaderInternal vtkFloatingPointExceptions vtkFlyingEdges2D vtkFlyingEdges3D vtkFlyingEdgesPlaneCutter vtkFocalPlaneContourRepresentation vtkFocalPlanePointPlacer vtkFollower vtkFontConfigFreeTypeTools vtkForEach vtkForceDirectedLayoutStrategy vtkForceStaticMesh vtkForceTime vtkFrameBufferObjectBase vtkFramebufferPass vtkFreeTypeLabelRenderStrategy vtkFreeTypeStringToImage vtkFreeTypeTools vtkFreeTypeToolsCleanup vtkFrustumCoverageCuller vtkFrustumSelector vtkFunctionParser vtkFunctionSet vtkGAMBITReader vtkGDAL vtkGDALRasterConverter vtkGDALRasterReader vtkGDALRasterReprojection vtkGDALVectorReader vtkGESignaReader vtkGL2PSExporter vtkGLSLModCamera vtkGLSLModCoincidentTopology vtkGLSLModLight vtkGLSLModPixelDebugger vtkGLSLModifierBase vtkGLSLModifierFactory vtkGLTFDocumentLoader vtkGLTFDocumentLoaderInternals vtkGLTFExporter vtkGLTFImporter vtkGLTFReader vtkGLTFTexture vtkGLTFWriter vtkGLTFWriterUtils vtkGPUInfo vtkGPUInfoList vtkGPUInfoListArray vtkGPUVolumeRayCastMapper vtkGarbageCollector vtkGarbageCollectorManager vtkGaussianBlurPass vtkGaussianCubeReader vtkGaussianCubeReader2 vtkGaussianKernel vtkGaussianRandomSequence vtkGaussianSplatter vtkGeneralTransform vtkGeneralizedKernel vtkGenerateGlobalIds vtkGenerateIndexArray vtkGenerateProcessIds vtkGenerateTimeSteps vtkGenericAdaptorCell vtkGenericAttribute vtkGenericAttributeCollection vtkGenericCell vtkGenericCellIterator vtkGenericCellTessellator vtkGenericClip vtkGenericContourFilter vtkGenericCutter vtkGenericDataArray vtkGenericDataArrayLookupHelper vtkGenericDataObjectReader vtkGenericDataObjectWriter vtkGenericDataSet vtkGenericDataSetTessellator vtkGenericEdgeTable vtkGenericEnSightReader vtkGenericGeometryFilter vtkGenericGlyph3DFilter vtkGenericImageInterpolator vtkGenericInterpolatedVelocityField vtkGenericMovieWriter vtkGenericOpenGLRenderWindow vtkGenericOpenGLResourceFreeCallback vtkGenericOutlineFilter vtkGenericPointIterator vtkGenericProbeFilter vtkGenericRenderWindowInteractor vtkGenericStreamTracer vtkGenericSubdivisionErrorMetric vtkGenericVertexAttributeMapping vtkGeoEdgeStrategy vtkGeoJSONFeature vtkGeoJSONReader vtkGeoJSONWriter vtkGeoMath vtkGeoProjection vtkGeoTransform vtkGeodesicPath vtkGeometricErrorMetric vtkGeometryFilter vtkGhostCellsGenerator vtkGlobFileNames vtkGlyph2D vtkGlyph3DMapper vtkGlyphSource2D vtkGradientFilter vtkGraph vtkGraphAlgorithm vtkGraphAnnotationLayersFilter vtkGraphEdge vtkGraphGeodesicPath vtkGraphHierarchicalBundleEdges vtkGraphInternals vtkGraphItem vtkGraphLayout vtkGraphLayoutFilter vtkGraphLayoutStrategy vtkGraphMapper vtkGraphReader vtkGraphToGlyphs vtkGraphToPoints vtkGraphToPolyData vtkGraphWeightEuclideanDistanceFilter vtkGraphWeightFilter vtkGraphWriter vtkGraphicsFactory vtkGridSynchronizedTemplates3D vtkGridTransform vtkGroupDataSetsFilter vtkGroupLeafVertices vtkGroupTimeStepsFilter vtkH5PartReader vtkH5RageReader vtkHDF5Helper vtkHDFReader vtkHDFReaderImplementation vtkHDFVersion vtkHDFWriter vtkHDFWriterImplementation vtkHDRReader vtkHandleRepresentation vtkHandleSource vtkHandleWidget vtkHardwarePicker vtkHardwareSelector vtkHardwareWindow vtkHausdorffDistancePointSetFilter vtkHeap vtkHeatmapItem vtkHedgeHog vtkHexagonalPrism vtkHiddenLineRemovalPass vtkHierarchicalBinningFilter vtkHierarchicalBoxDataSet vtkHierarchicalBoxDataSetAlgorithm vtkHierarchicalDataExtractDataSets vtkHierarchicalDataExtractLevel vtkHierarchicalDataLevelFilter vtkHierarchicalDataSetGeometryFilter vtkHierarchicalGraphPipeline vtkHierarchicalGraphView vtkHierarchicalPolyDataMapper vtkHigherOrderCurve vtkHigherOrderHexahedron vtkHigherOrderInterpolation vtkHigherOrderQuadrilateral vtkHigherOrderTetra vtkHigherOrderTriangle vtkHigherOrderWedge vtkHighestDensityRegionsStatistics vtkHomogeneousTransform vtkHoudiniPolyDataWriter vtkHoverWidget vtkHull vtkHyperStreamline vtkHyperTree vtkHyperTreeGrid vtkHyperTreeGridAlgorithm vtkHyperTreeGridAxisClip vtkHyperTreeGridAxisCut vtkHyperTreeGridAxisReflection vtkHyperTreeGridCellCenters vtkHyperTreeGridContour vtkHyperTreeGridDepthLimiter vtkHyperTreeGridEntry vtkHyperTreeGridEvaluateCoarse vtkHyperTreeGridExtractGhostCells vtkHyperTreeGridFeatureEdges vtkHyperTreeGridGeometricLocator vtkHyperTreeGridGeometry vtkHyperTreeGridGeometry1DImpl vtkHyperTreeGridGeometry2DImpl vtkHyperTreeGridGeometry3DImpl vtkHyperTreeGridGeometryEntry vtkHyperTreeGridGeometryImpl vtkHyperTreeGridGeometryLevelEntry vtkHyperTreeGridGeometrySmallDimensionsImpl vtkHyperTreeGridGeometryUnlimitedEntry vtkHyperTreeGridGeometryUnlimitedLevelEntry vtkHyperTreeGridGhostCellsGenerator vtkHyperTreeGridGhostCellsGeneratorInternals vtkHyperTreeGridGradient vtkHyperTreeGridIterator vtkHyperTreeGridLevelEntry vtkHyperTreeGridLocator vtkHyperTreeGridMapper vtkHyperTreeGridNonOrientedCursor vtkHyperTreeGridNonOrientedGeometryCursor vtkHyperTreeGridNonOrientedMooreSuperCursor vtkHyperTreeGridNonOrientedMooreSuperCursorLight vtkHyperTreeGridNonOrientedSuperCursor vtkHyperTreeGridNonOrientedSuperCursorLight vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor vtkHyperTreeGridNonOrientedUnlimitedSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight vtkHyperTreeGridOrientedCursor vtkHyperTreeGridOrientedGeometryCursor vtkHyperTreeGridOutlineFilter vtkHyperTreeGridPlaneCutter vtkHyperTreeGridPreConfiguredSource vtkHyperTreeGridProbeFilter vtkHyperTreeGridScales vtkHyperTreeGridSource vtkHyperTreeGridThreshold vtkHyperTreeGridToDualGrid vtkHyperTreeGridToUnstructuredGrid vtkHyperTreeGridVisibleLeavesSize vtkIOCellGrid vtkIOSRenderWindow vtkIOSRenderWindowInteractor vtkIOSSFilesScanner vtkIOSSModel vtkIOSSReader vtkIOSSReaderInternal vtkIOSSWriter vtkIOStream vtkIOStreamFwd vtkISIReader vtkIVExporter vtkIVWriter vtkIcicleView vtkIconGlyphFilter vtkIdFilter vtkIdListCollection vtkIdentityTransform vtkImageAccumulate vtkImageActorPointPlacer vtkImageAlgorithm vtkImageAnisotropicDiffusion2D vtkImageAnisotropicDiffusion3D vtkImageAppend vtkImageAppendComponents vtkImageBSplineCoefficients vtkImageBSplineInternals vtkImageBSplineInterpolator vtkImageBlend vtkImageButterworthHighPass vtkImageButterworthLowPass vtkImageCacheFilter vtkImageChangeInformation vtkImageCheckerboard vtkImageCityBlockDistance vtkImageClip vtkImageConnectivityFilter vtkImageConnector vtkImageConnectorSeed vtkImageConstantPad vtkImageContinuousDilate3D vtkImageContinuousErode3D vtkImageConvolve vtkImageCorrelation vtkImageCroppingRegionsWidget vtkImageCursor3D vtkImageDataLIC2D vtkImageDataOutlineFilter vtkImageDataStreamer vtkImageDataToExplicitStructuredGrid vtkImageDataToHyperTreeGrid vtkImageDataToPointSet vtkImageDataToUniformGrid vtkImageDecomposeFilter vtkImageDifference vtkImageDilateErode3D vtkImageDivergence vtkImageDotProduct vtkImageEllipsoidSource vtkImageEuclideanDistance vtkImageEuclideanToPolar vtkImageExport vtkImageExtractComponents vtkImageFFT vtkImageFlip vtkImageFourierCenter vtkImageFourierFilter vtkImageGaussianSmooth vtkImageGaussianSource vtkImageGradient vtkImageGradientMagnitude vtkImageGridSource vtkImageHSIToRGB vtkImageHSVToRGB vtkImageHistogram vtkImageHistogramStatistics vtkImageHybridMedian2D vtkImageIdealHighPass vtkImageIdealLowPass vtkImageImport vtkImageImportExecutive vtkImageInPlaceFilter vtkImageInterpolator vtkImageIslandRemoval2D vtkImageItem vtkImageIterateFilter vtkImageIterator vtkImageLaplacian vtkImageLogarithmicScale vtkImageLogic vtkImageLuminance vtkImageMagnify vtkImageMapToRGBA vtkImageMapToWindowLevelColors vtkImageMapper vtkImageMapper3D vtkImageMarchingCubes vtkImageMask vtkImageMaskBits vtkImageMathematics vtkImageMedian3D vtkImageMirrorPad vtkImageNoiseSource vtkImageNonMaximumSuppression vtkImageNormalize vtkImageOpenClose3D vtkImageOrthoPlanes vtkImagePadFilter vtkImagePermute vtkImagePlaneWidget vtkImagePointDataIterator vtkImagePointIterator vtkImageProbeFilter vtkImageProcessingPass vtkImageProgressIterator vtkImageProperty vtkImageQuantizeRGBToIndex vtkImageRFFT vtkImageRGBToHSI vtkImageRGBToHSV vtkImageRGBToXYZ vtkImageRGBToYIQ vtkImageRange3D vtkImageReader vtkImageReader2Collection vtkImageRectilinearWipe vtkImageRenderManager vtkImageResample vtkImageResize vtkImageReslice vtkImageResliceMapper vtkImageResliceToColors vtkImageSSIM vtkImageSeedConnectivity vtkImageSeparableConvolution vtkImageShiftScale vtkImageShrink3D vtkImageSincInterpolator vtkImageSinusoidSource vtkImageSkeleton2D vtkImageSlab vtkImageSlabReslice vtkImageSlice vtkImageSliceCollection vtkImageSliceMapper vtkImageSobel2D vtkImageSobel3D vtkImageSpatialAlgorithm vtkImageStack vtkImageStencil vtkImageStencilAlgorithm vtkImageStencilData vtkImageStencilIterator vtkImageStencilRaster vtkImageStencilSource vtkImageStencilToImage vtkImageThreshold vtkImageThresholdConnectivity vtkImageToAMR vtkImageToImageStencil vtkImageToPoints vtkImageToPolyDataFilter vtkImageToStructuredGrid vtkImageToStructuredPoints vtkImageTracerWidget vtkImageTransform vtkImageTranslateExtent vtkImageVariance3D vtkImageViewer vtkImageWeightedSum vtkImageWrapPad vtkImageWriter vtkImageXYZToLAB vtkImageYIQToRGB vtkImplicitArray vtkImplicitCylinderRepresentation vtkImplicitCylinderWidget vtkImplicitDataSet vtkImplicitFunction vtkImplicitFunctionCollection vtkImplicitFunctionToImageStencil vtkImplicitHalo vtkImplicitImageRepresentation vtkImplicitModeller vtkImplicitPlaneRepresentation vtkImplicitPlaneWidget vtkImplicitPlaneWidget2 vtkImplicitPolyDataDistance vtkImplicitProjectOnPlaneDistance vtkImplicitSelectionLoop vtkImplicitSum vtkImplicitTextureCoords vtkImplicitVolume vtkImplicitWindowFunction vtkImporter vtkImprintFilter vtkInEdgeIterator vtkIncrementalForceLayout vtkIncrementalOctreeNode vtkIncrementalOctreePointLocator vtkIncrementalPointLocator vtkIndent vtkIndexedImplicitBackend vtkInformation vtkInformationDataObjectKey vtkInformationDataObjectMetaDataKey vtkInformationDoubleKey vtkInformationDoubleVectorKey vtkInformationExecutivePortKey vtkInformationExecutivePortVectorKey vtkInformationIdTypeKey vtkInformationInformationKey vtkInformationInformationVectorKey vtkInformationIntegerKey vtkInformationIntegerPointerKey vtkInformationIntegerRequestKey vtkInformationIntegerVectorKey vtkInformationInternals vtkInformationIterator vtkInformationKey vtkInformationKeyLookup vtkInformationKeyVectorKey vtkInformationObjectBaseKey vtkInformationObjectBaseVectorKey vtkInformationQuadratureSchemeDefinitionVectorKey vtkInformationRequestKey vtkInformationStringKey vtkInformationStringVectorKey vtkInformationUnsignedLongKey vtkInformationVariantKey vtkInformationVariantVectorKey vtkInformationVector vtkInitialValueProblemSolver vtkInputStream vtkIntegrateAttributes vtkInteractiveArea vtkInteractorEventRecorder vtkInteractorObserver vtkInteractorStyle vtkInteractorStyle3D vtkInteractorStyleAreaSelectHover vtkInteractorStyleDrawPolygon vtkInteractorStyleFlight vtkInteractorStyleJoystickActor vtkInteractorStyleJoystickCamera vtkInteractorStyleMultiTouchCamera vtkInteractorStyleRubberBand2D vtkInteractorStyleRubberBand3D vtkInteractorStyleRubberBandPick vtkInteractorStyleRubberBandZoom vtkInteractorStyleSwitch vtkInteractorStyleSwitchBase vtkInteractorStyleTerrain vtkInteractorStyleTrackball vtkInteractorStyleTrackballActor vtkInteractorStyleTrackballCamera vtkInteractorStyleTreeMapHover vtkInteractorStyleUnicam vtkInteractorStyleUser vtkInterpolateCalculator vtkInterpolateDataSetAttributes vtkInterpolatingSubdivisionFilter vtkInterpolationKernel vtkInterpolatorInternals vtkIntersectionCounter vtkIntersectionPolyDataFilter vtkIterativeClosestPointTransform vtkJSONDataSetWriter vtkJSONImageWriter vtkJSONRenderWindowExporter vtkJSONSceneExporter vtkJavaScriptDataWriter vtkJoinTables vtkKCoreDecomposition vtkKCoreLayout vtkKMeansAssessFunctor vtkKMeansDistanceFunctor vtkKMeansDistanceFunctorCalculator vtkKMeansStatistics vtkKdNode vtkKdTree vtkKdTreePointLocator vtkKdTreeSelector vtkKochanekSpline vtkLASRasterReader vtkLASReader vtkLICNoiseHelper vtkLICRandomNoise2D vtkLICRandomNumberGeneratorInterface vtkLODProp3D vtkLSDynaPart vtkLSDynaPartCollection vtkLSDynaReader vtkLSDynaSummaryParser vtkLZ4DataCompressor vtkLZMADataCompressor vtkLabelHierarchy vtkLabelHierarchyAlgorithm vtkLabelHierarchyCompositeIterator vtkLabelHierarchyIterator vtkLabelPlacementMapper vtkLabelPlacer vtkLabelRenderStrategy vtkLabelSizeCalculator vtkLabeledContourMapper vtkLabeledContourPolyDataItem vtkLabeledDataMapper vtkLabeledTreeMapDataMapper vtkLagrangeCurve vtkLagrangeHexahedron vtkLagrangeInterpolation vtkLagrangeQuadrilateral vtkLagrangeTetra vtkLagrangeTriangle vtkLagrangeWedge vtkLagrangianBasicIntegrationModel vtkLagrangianMatidaIntegrationModel vtkLagrangianParticle vtkLagrangianParticleTracker vtkLargeInteger vtkLassoStencilSource vtkLeaderActor2D vtkLegacyReaderVersion vtkLegendBoxActor vtkLegendScaleActor vtkLengthDistribution vtkLevelIdScalars vtkLight vtkLightActor vtkLightCollection vtkLightKit vtkLightNode vtkLightRepresentation vtkLightWidget vtkLightingMapPass vtkLightsPass vtkLineIntegralConvolution2D vtkLineRepresentation vtkLineWidget vtkLineWidget2 vtkLinearCellExtrusionFilter vtkLinearContourLineInterpolator vtkLinearExtrusionFilter vtkLinearKernel vtkLinearSelector vtkLinearToQuadraticCellsFilter vtkLinearTransform vtkLinearTransformCellLocator vtkLinkEdgels vtkLocationSelector vtkLocator vtkLogLookupTable vtkLogger vtkLogoRepresentation vtkLogoWidget vtkLongArray vtkLongLongArray vtkLookupTableItem vtkLookupTableWithEnabling vtkLoopBooleanPolyDataFilter vtkMCubesReader vtkMCubesWriter vtkMFCWindow vtkMFIXReader vtkMINCImageAttributes vtkMINCImageReader vtkMINCImageWriter vtkMNIObjectReader vtkMNIObjectWriter vtkMNITagPointReader vtkMNITagPointWriter vtkMNITransformReader vtkMNITransformWriter vtkMP4Writer vtkMPASReader vtkMPI4PyCommunicator vtkMPICommunicator vtkMPIController vtkMPIEventLog vtkMPIImageReader vtkMPIMultiBlockPLOT3DReader vtkMPIPixelTT vtkMPIPixelView vtkMRCReader vtkMagnifierRepresentation vtkMagnifierWidget vtkMapArrayValues vtkMapMaskTextureId vtkMappedDataArray vtkMappedUnstructuredGrid vtkMappedUnstructuredGridCellIterator vtkMapper vtkMapper2D vtkMapperCollection vtkMapperNode vtkMarchingContourFilter vtkMarkBoundaryFilter vtkMarkerUtilities vtkMarshalContext vtkMaskFields vtkMaskPoints vtkMaskPointsFilter vtkMaskPolyData vtkMassProperties vtkMathPrivate vtkMathTextFreeTypeTextRenderer vtkMathTextUtilities vtkMathTextUtilitiesCleanup vtkMathUtilities vtkMatplotlibMathTextUtilities vtkMatricizeArray vtkMatrix3x3 vtkMatrixToHomogeneousTransform vtkMatrixToLinearTransform vtkMeanValueCoordinatesInterpolator vtkMeasurementCubeHandleRepresentation3D vtkMedicalImageProperties vtkMedicalImageReader2 vtkMemkindRAII vtkMemoryLimitImageDataStreamer vtkMemoryResourceStream vtkMergeArrays vtkMergeCells vtkMergeColumns vtkMergeDataObjectFilter vtkMergeFields vtkMergeFilter vtkMergeGraphs vtkMergeTables vtkMergeTimeFilter vtkMergeVectorComponents vtkMersenneTwister vtkModelMetadata vtkModifiedBSPTree vtkMolecule vtkMoleculeAlgorithm vtkMoleculeAppend vtkMoleculeMapper vtkMoleculeReaderBase vtkMoleculeToAtomBallFilter vtkMoleculeToBondStickFilter vtkMoleculeToLinesFilter vtkMoleculeToPolyDataFilter vtkMotionFXCFGReader vtkMultiBlockDataGroupFilter vtkMultiBlockDataSetAlgorithm vtkMultiBlockPLOT3DReaderRecord vtkMultiBlockUnstructuredGridVolumeMapper vtkMultiBlockVolumeMapper vtkMultiCorrelativeAssessFunctor vtkMultiCorrelativeStatistics vtkMultiNewickTreeReader vtkMultiObjectMassProperties vtkMultiPieceDataSet vtkMultiProcessController vtkMultiProcessStream vtkMultiThreader vtkMultiThreshold vtkMultiTimeStepAlgorithm vtkMultiVolume vtkMutableDirectedGraph vtkMutableGraphHelper vtkMutableUndirectedGraph vtkMySQLDatabase vtkMySQLDatabasePrivate vtkMySQLQuery vtkMySQLToTableReader vtkNIFTIImageHeader vtkNIFTIImageReader vtkNIFTIImageWriter vtkNamedColors vtkNativePartitioningStrategy vtkNeighborCells vtkNek5000Reader vtkNetCDFCAMReader vtkNetCDFCFReader vtkNetCDFCFWriter vtkNetCDFPOPReader vtkNetCDFReader vtkNetCDFUGRIDReader vtkNetCDFUGRIDeader vtkNetworkHierarchy vtkNew vtkNewickTreeReader vtkNewickTreeWriter vtkNonLinearCell vtkNonMergingPointLocator vtkNonOverlappingAMR vtkNonOverlappingAMRAlgorithm vtkNonOverlappingAMRLevelIdScalars vtkNormalizeMatrixVectors vtkNrrdReader vtkNumberToString vtkOBBNode vtkOBBTree vtkOBJExporter vtkOBJImporter vtkOBJPolyDataProcessor vtkOBJWriter vtkOCCTReader vtkODBCDatabase vtkODBCInternals vtkODBCQuery vtkOMETIFFReader vtkOMFReader vtkOOGLExporter vtkOSOpenGLRenderWindow vtkOSPRayAMRVolumeMapperNode vtkOSPRayActorNode vtkOSPRayCache vtkOSPRayCacheItemObject vtkOSPRayCameraNode vtkOSPRayCompositePolyDataMapper2Node vtkOSPRayCompositePolyDataMapperNode vtkOSPRayLightNode vtkOSPRayMaterialHelpers vtkOSPRayMaterialLibrary vtkOSPRayMoleculeMapperNode vtkOSPRayPass vtkOSPRayPointGaussianMapperNode vtkOSPRayPolyDataMapperNode vtkOSPRayRendererNode vtkOSPRayTestInteractor vtkOSPRayUnstructuredVolumeMapperNode vtkOSPRayViewNodeFactory vtkOSPRayVolumeInterface vtkOSPRayVolumeMapper vtkOSPRayVolumeMapperNode vtkOSPRayVolumeNode vtkOSPRayWindowNode vtkOStrStreamWrapper vtkOStreamWrapper vtkOTDensityMap vtkOTFilter vtkOTKernelSmoothing vtkOTScatterPlotMatrix vtkOTUtilities vtkObjectBase vtkObjectFactory vtkObjectFactoryCollection vtkObjectFactoryRegistryCleanup vtkObjectIdMap vtkObserverMediator vtkOctreeImageToPointSetFilter vtkOctreePointLocator vtkOctreePointLocatorNode vtkOggTheoraWriter vtkOldStyleCallbackCommand vtkOpaquePass vtkOpenFOAMReader vtkOpenGL2ContextDevice2DCellArrayHelper vtkOpenGL2ContextDevice2DPrivate vtkOpenGLActor vtkOpenGLArrayTextureBufferAdapter vtkOpenGLAvatar vtkOpenGLBatchedPolyDataMapper vtkOpenGLBillboardTextActor3D vtkOpenGLBufferObject vtkOpenGLCamera vtkOpenGLCellGridMapper vtkOpenGLCellToVTKCellMap vtkOpenGLCompositePolyDataMapperDelegator vtkOpenGLContextActor vtkOpenGLContextBufferId vtkOpenGLContextDevice2D vtkOpenGLContextDevice3D vtkOpenGLContextDeviceBufferObjectBuilder vtkOpenGLES30PolyDataMapper2D vtkOpenGLFXAAFilter vtkOpenGLFXAAPass vtkOpenGLFluidMapper vtkOpenGLFramebufferObject vtkOpenGLGL2PSExporter vtkOpenGLGL2PSHelper vtkOpenGLGL2PSHelperImpl vtkOpenGLGPUVolumeRayCastMapper vtkOpenGLGlyph3DHelper vtkOpenGLGlyph3DMapper vtkOpenGLHardwareSelector vtkOpenGLHelper vtkOpenGLHyperTreeGridMapper vtkOpenGLImageAlgorithmCallback vtkOpenGLImageAlgorithmHelper vtkOpenGLImageGradient vtkOpenGLImageMapper vtkOpenGLImageSliceMapper vtkOpenGLIndexBufferObject vtkOpenGLInstanceCulling vtkOpenGLLabeledContourMapper vtkOpenGLLight vtkOpenGLLowMemoryBatchedPolyDataMapper vtkOpenGLLowMemoryCellTypeAgent vtkOpenGLLowMemoryLinesAgent vtkOpenGLLowMemoryPolyDataMapper vtkOpenGLLowMemoryPolygonsAgent vtkOpenGLLowMemoryStripsAgent vtkOpenGLLowMemoryVerticesAgent vtkOpenGLMoleculeMapper vtkOpenGLMovieSphere vtkOpenGLPointGaussianMapper vtkOpenGLPointGaussianMapperHelper vtkOpenGLPolyDataMapper vtkOpenGLPolyDataMapper2D vtkOpenGLProjectedTetrahedraMapper vtkOpenGLPropItem vtkOpenGLProperty vtkOpenGLQuadHelper vtkOpenGLRayCastImageDisplayHelper vtkOpenGLRenderPass vtkOpenGLRenderTimer vtkOpenGLRenderTimerLog vtkOpenGLRenderUtilities vtkOpenGLRenderWindow vtkOpenGLRenderer vtkOpenGLResourceFreeCallback vtkOpenGLShaderCache vtkOpenGLShaderDeclaration vtkOpenGLShaderProperty vtkOpenGLSkybox vtkOpenGLSphereMapper vtkOpenGLState vtkOpenGLStickMapper vtkOpenGLTextActor vtkOpenGLTextActor3D vtkOpenGLTextMapper vtkOpenGLTexture vtkOpenGLUniforms vtkOpenGLVertexArrayObject vtkOpenGLVertexBufferObject vtkOpenGLVertexBufferObjectCache vtkOpenGLVertexBufferObjectGroup vtkOpenGLVolumeGradientOpacityTable vtkOpenGLVolumeLookupTable vtkOpenGLVolumeLookupTables vtkOpenGLVolumeMaskGradientOpacityTransferFunction2D vtkOpenGLVolumeMaskTransferFunction2D vtkOpenGLVolumeOpacityTable vtkOpenGLVolumeRGBTable vtkOpenGLVolumeTransferFunction2D vtkOpenQubeElectronicData vtkOpenQubeMoleculeSource vtkOpenSlideReader vtkOpenVDBReader vtkOpenVDBWriter vtkOpenVRCamera vtkOpenVRCameraPose vtkOpenVRControlsHelper vtkOpenVRDefaultOverlay vtkOpenVRInteractorStyle vtkOpenVRModel vtkOpenVROverlay vtkOpenVROverlaySpot vtkOpenVRRenderWindow vtkOpenVRRenderWindowInteractor vtkOpenVRRenderer vtkOpenXRCamera vtkOpenXRControlsHelper vtkOpenXRInteractorStyle vtkOpenXRManager vtkOpenXRManagerConnection vtkOpenXRManagerD3DGraphics vtkOpenXRManagerGraphics vtkOpenXRManagerOpenGLGraphics vtkOpenXRManagerRemoteConnection vtkOpenXRModel vtkOpenXRRemotingRenderWindow vtkOpenXRRenderWindow vtkOpenXRRenderWindowInteractor vtkOpenXRRenderer vtkOpenXRUtilities vtkOrderIndependentTranslucentPass vtkOrderStatistics vtkOrderedTriangulator vtkOrientPolyData vtkOrientationMarkerWidget vtkOrientationRepresentation vtkOrientationWidget vtkOrientedGlyphFocalPlaneContourRepresentation vtkOrientedPolygonalHandleRepresentation3D vtkOutEdgeIterator vtkOutlineCornerSource vtkOutlineGlowPass vtkOutlineSource vtkOutputStream vtkOutputWindow vtkOutputWindowCleanup vtkOverlappingAMR vtkOverlappingAMRAlgorithm vtkOverlappingAMRLevelIdScalars vtkOverlappingCellsDetector vtkOverlayPass vtkOverrideInformation vtkOverrideInformationCollection vtkPAutoCorrelativeStatistics vtkPBRIrradianceTexture vtkPBRLUTTexture vtkPBRPrefilterTexture vtkPBivariateLinearTableThreshold vtkPCAAnalysisFilter vtkPCACurvatureEstimation vtkPCANormalEstimation vtkPCAStatistics vtkPCellDataToPointData vtkPCellSizeFilter vtkPChacoReader vtkPComputeHistogram2DOutliers vtkPComputeQuantiles vtkPComputeQuartiles vtkPConnectivityFilter vtkPContingencyStatistics vtkPConvertToMultiBlockDataSet vtkPCorrelativeStatistics vtkPDALReader vtkPDFContextDevice2D vtkPDFExporter vtkPDataSetReader vtkPDataSetWriter vtkPDescriptiveStatistics vtkPDirectory vtkPDistributedDataFilter vtkPExodusIIReader vtkPExodusIIWriter vtkPExtractDataArraysOverTime vtkPExtractExodusGlobalTemporalVariables vtkPExtractGrid vtkPExtractHistogram2D vtkPExtractRectilinearGrid vtkPExtractSelectedArraysOverTime vtkPExtractVOI vtkPHardwareSelector vtkPHyperTreeGridProbeFilter vtkPIOReader vtkPImageWriter vtkPKMeansStatisitcs vtkPKMeansStatistics vtkPKdTree vtkPLSDynaReader vtkPLagrangianParticleTracker vtkPLineIntegralConvolution2D vtkPLinearExtrusionFilter vtkPMaskPoints vtkPMergeArrays vtkPMultiCorrelativeStatistics vtkPNetCDFPOPReader vtkPNrrdReader vtkPOVExporter vtkPOpenFOAMReader vtkPOrderStatistics vtkPOutlineCornerFilter vtkPOutlineFilter vtkPOutlineFilterInternals vtkPPCAStatistics vtkPPainterCommunicator vtkPPairwiseExtractHistogram2D vtkPParticlePathFilter vtkPParticleTracer vtkPParticleTracerBase vtkPPixelTransfer vtkPPolyDataNormals vtkPProbeFilter vtkPProjectSphereFilter vtkPReflectionFilter vtkPResampleFilter vtkPResampleToImage vtkPResampleWithDataSet vtkPSLACReader vtkPSimpleBondPerceiver vtkPSphereSource vtkPStreaklineFilter vtkPStreamTracer vtkPStructuredGridConnectivity vtkPSurfaceLICComposite vtkPSurfaceLICInterface vtkPSystemTools vtkPTSReader vtkPTextureMapToSphere vtkPVWebGLExporter vtkPWindBladeReader vtkPXdmf3Writer vtkPYoungsMaterialInterface vtkPackLabels vtkPainterCommunicator vtkPairwiseExtractHistogram2D vtkPanoramicProjectionPass vtkParallelAMRUtilities vtkParallelCoordinatesActor vtkParallelCoordinatesHistogramRepresentation vtkParallelCoordinatesInteractorStyle vtkParallelCoordinatesRepresentation vtkParallelCoordinatesView vtkParallelReader vtkParallelRenderManager vtkParallelTimer vtkParallelVectors vtkParallelopipedRepresentation vtkParallelopipedWidget vtkParametricBohemianDome vtkParametricBour vtkParametricCatalanMinimal vtkParametricHenneberg vtkParametricKuen vtkParametricPluckerConoid vtkParametricPseudosphere vtkParticlePathFilter vtkParticleTracer vtkParticleTracerBase vtkPartitionBalancer vtkPartitionedArchiver vtkPartitionedDataSet vtkPartitionedDataSetAlgorithm vtkPartitionedDataSetCollection vtkPartitionedDataSetCollectionAlgorithm vtkPartitionedDataSetCollectionSource vtkPartitionedDataSetSource vtkPartitioningStrategy vtkPassArrays vtkPassInputTypeAlgorithm vtkPassSelectedArrays vtkPassThrough vtkPassThroughEdgeStrategy vtkPassThroughLayoutStrategy vtkPath vtkPen vtkPentagonalPrism vtkPeriodicDataArray vtkPeriodicFilter vtkPeriodicTable vtkPerlinNoise vtkPerturbCoincidentVertices vtkPhyloXMLTreeReader vtkPhyloXMLTreeWriter vtkPicker vtkPickingManager vtkPieChartActor vtkPieceRequestFilter vtkPieceScalars vtkPiecewiseControlPointsItem vtkPiecewiseFunction vtkPiecewiseFunctionAlgorithm vtkPiecewiseFunctionItem vtkPiecewiseFunctionShiftScale vtkPiecewisePointHandleItem vtkPipelineGraphSource vtkPipelineSize vtkPixel vtkPixelBufferObject vtkPixelExtent vtkPixelExtentIO vtkPixelTransfer vtkPlaneCollection vtkPlaneCutter vtkPlaneWidget vtkPlaybackRepresentation vtkPlaybackWidget vtkPlot vtkPlot3D vtkPlot3DMetaReader vtkPlotArea vtkPlotBag vtkPlotBar vtkPlotBarRangeHandlesItem vtkPlotBox vtkPlotFunctionalBag vtkPlotGrid vtkPlotHistogram2D vtkPlotLine vtkPlotLine3D vtkPlotParallelCoordinates vtkPlotPie vtkPlotPoints vtkPlotPoints3D vtkPlotRangeHandlesItem vtkPlotStacked vtkPlotSurface vtkPointCloudFilter vtkPointCloudRepresentation vtkPointCloudWidget vtkPointConnectivityFilter vtkPointData vtkPointDataToCellData vtkPointDensityFilter vtkPointFillPass vtkPointGaussianMapper vtkPointHandleRepresentation2D vtkPointHandleRepresentation3D vtkPointHandleSource vtkPointInterpolator vtkPointInterpolator2D vtkPointLoad vtkPointLocator vtkPointOccupancyFilter vtkPointPicker vtkPointPlacer vtkPointSet vtkPointSetAlgorithm vtkPointSetCellIterator vtkPointSetStreamer vtkPointSetToLabelHierarchy vtkPointSetToMoleculeFilter vtkPointSetToOctreeImageFilter vtkPointSmoothingFilter vtkPointSource vtkPointWidget vtkPoints2D vtkPointsProjectedHull vtkPoissonDiskSampler vtkPolarAxesActor vtkPolarAxesActor2D vtkPolyDataCollection vtkPolyDataContourLineInterpolator vtkPolyDataEdgeConnectivityFilter vtkPolyDataInternals vtkPolyDataItem vtkPolyDataMapper2D vtkPolyDataMapperNode vtkPolyDataNormals vtkPolyDataPlaneClipper vtkPolyDataPlaneCutter vtkPolyDataPointPlacer vtkPolyDataPointSampler vtkPolyDataReader vtkPolyDataSilhouette vtkPolyDataSourceWidget vtkPolyDataStreamer vtkPolyDataTangents vtkPolyDataToImageStencil vtkPolyDataToReebGraphFilter vtkPolyDataToUnstructuredGrid vtkPolyDataWriter vtkPolyLineRepresentation vtkPolyLineSource vtkPolyLineWidget vtkPolyPlane vtkPolyPointSource vtkPolyVertex vtkPolygonBuilder vtkPolygonalHandleRepresentation3D vtkPolyhedron vtkPolyhedronUtilities vtkPolynomialSolversUnivariate vtkPostScriptWriter vtkPostgreSQLDatabase vtkPostgreSQLDatabasePrivate vtkPostgreSQLQuery vtkPostgreSQLToTableReader vtkPriorityQueue vtkProStarReader vtkProbabilisticVoronoiKernel vtkProbeFilter vtkProbeLineFilter vtkProbePolyhedron vtkProbeSelectedLocations vtkProcess vtkProcessGroup vtkProcessIdScalars vtkProcrustesAlignmentFilter vtkProgrammableAttributeDataFilter vtkProgrammableDataObjectSource vtkProgrammableElectronicData vtkProgrammableFilter vtkProgrammableGlyphFilter vtkProgrammableSource vtkProgressBarRepresentation vtkProgressBarWidget vtkProgressObserver vtkProjectPointsToPlane vtkProjectSphereFilter vtkProjectedTerrainPath vtkProjectedTetrahedraMapper vtkProjectedTexture vtkProp vtkProp3D vtkProp3DAxisFollower vtkProp3DButtonRepresentation vtkProp3DCollection vtkProp3DFollower vtkPropAssembly vtkPropCollection vtkPropItem vtkPropPicker vtkProperty2D vtkProteinRibbonFilter vtkPruneTreeFilter vtkPythonAlgorithm vtkPythonArchiver vtkPythonItem vtkQImageToImageSource vtkQWidgetRepresentation vtkQWidgetTexture vtkQWidgetWidget vtkQtAbstractModelAdapter vtkQtAnnotationLayersModelAdapter vtkQtAnnotationView vtkQtConnection vtkQtDebugLeaksModel vtkQtDebugLeaksView vtkQtInitialization vtkQtLabelRenderStrategy vtkQtListView vtkQtRecordView vtkQtSQLDatabase vtkQtSQLQuery vtkQtStringToImage vtkQtTableModelAdapter vtkQtTableRepresentation vtkQtTableView vtkQtTimePointUtility vtkQtTreeModelAdapter vtkQtTreeRingLabelMapper vtkQtTreeView vtkQtView vtkQuadRotationalExtrusionFilter vtkQuadraticEdge vtkQuadraticHexahedron vtkQuadraticLinearQuad vtkQuadraticLinearWedge vtkQuadraticPolygon vtkQuadraticPyramid vtkQuadraticQuad vtkQuadraticTetra vtkQuadraticTriangle vtkQuadraticWedge vtkQuadraturePointInterpolator vtkQuadraturePointsGenerator vtkQuadratureSchemeDefinition vtkQuadratureSchemeDictionaryGenerator vtkQuadric vtkQuadricLODActor vtkQuantizePolyDataPoints vtkQuaternion vtkQuaternionInterpolator vtkQuaterniond vtkQuaternionf vtkRIBExporter vtkRIBLight vtkRIBProperty vtkRISReader vtkROIStencilSource vtkRTAnalyticSource vtkRTXMLPolyDataReader vtkRadialGridActor2D vtkRadiusOutlierRemoval vtkRandomAttributeGenerator vtkRandomGraphSource vtkRandomHyperTreeGridSource vtkRandomLayoutStrategy vtkRandomPool vtkRandomSequence vtkRangeHandlesItem vtkRasterReprojectionFilter vtkRayCastImageDisplayHelper vtkRayCastStructures vtkReaderAlgorithm vtkRearrangeFields vtkRecoverGeometryWireframe vtkRect vtkRectangularButtonSource vtkRectd vtkRectf vtkRecti vtkRectilinearGrid vtkRectilinearGridAlgorithm vtkRectilinearGridClip vtkRectilinearGridGeometryFilter vtkRectilinearGridOutlineFilter vtkRectilinearGridPartitioner vtkRectilinearGridReader vtkRectilinearGridToPointSet vtkRectilinearGridToTetrahedra vtkRectilinearGridWriter vtkRectilinearSynchronizedTemplates vtkRectilinearWipeRepresentation vtkRectilinearWipeWidget vtkRecursiveDividingCubes vtkRecursiveSphereDirectionEncoder vtkRedistributeDataSetFilter vtkReduceTable vtkReebGraph vtkReebGraphSimplificationFilter vtkReebGraphSimplificationMetric vtkReebGraphSurfaceSkeletonFilter vtkReebGraphToJoinSplitTreeFilter vtkReebGraphVolumeSkeletonFilter vtkReferenceCount vtkReflectionFilter vtkRemoteInteractionAdapter vtkRemoveDuplicatePolys vtkRemoveGhosts vtkRemoveHiddenData vtkRemoveIsolatedVertices vtkRemovePolyData vtkRemoveUnusedPoints vtkRenderLargeImage vtkRenderPass vtkRenderPassCollection vtkRenderState vtkRenderStepsPass vtkRenderTimerLog vtkRenderView vtkRenderViewBase vtkRenderWidget vtkRenderWindowCollection vtkRenderWindowInteractor vtkRenderWindowInteractor3D vtkRenderbuffer vtkRenderedAreaPicker vtkRenderedGraphRepresentation vtkRenderedHierarchyRepresentation vtkRenderedRepresentation vtkRenderedSurfaceRepresentation vtkRenderedTreeAreaRepresentation vtkRendererCollection vtkRendererDelegate vtkRendererNode vtkRendererSource vtkRenderingCellGrid vtkResampleToImage vtkResampleWithDataSet vtkReservoirSampler vtkReservoirSamplerBase vtkResizingWindowToImageFilter vtkResliceCursor vtkResliceCursorActor vtkResliceCursorLineRepresentation vtkResliceCursorPicker vtkResliceCursorPolyDataAlgorithm vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation vtkResliceCursorWidget vtkResliceImageViewer vtkResliceImageViewerMeasurements vtkResourceFileLocator vtkResourceParser vtkResourceStream vtkReverseSense vtkRibbonFilter vtkRotationFilter vtkRotationalExtrusionFilter vtkRowQuery vtkRowQueryToTable vtkRuledSurfaceFilter vtkRungeKutta2 vtkRungeKutta4 vtkRungeKutta45 vtkSCurveSpline vtkSDL2OpenGL2RenderWindow vtkSDL2OpenGLRenderWindow vtkSDL2RenderWindowInteractor vtkSDL2WebGPURenderWindow vtkSEPReader vtkSILBuilder vtkSLACParticleReader vtkSLACReader vtkSLCReader vtkSMPContourGrid vtkSMPMergePoints vtkSMPMergePolyDataHelper vtkSMPProgressObserver vtkSMPThreadLocal vtkSMPThreadLocalAPI vtkSMPThreadLocalImpl vtkSMPThreadLocalImplAbstract vtkSMPThreadLocalObject vtkSMPThreadPool vtkSMPTools vtkSMPToolsAPI vtkSMPToolsAPIInitialize vtkSMPToolsImpl vtkSOADataArrayTemplate vtkSPHCubicKernel vtkSPHInterpolator vtkSPHKernel vtkSPHQuarticKernel vtkSPHQuinticKernel vtkSQLDatabase vtkSQLDatabaseGraphSource vtkSQLDatabaseSchema vtkSQLDatabaseTableSource vtkSQLGraphReader vtkSQLQuery vtkSQLiteDatabase vtkSQLiteDatabaseInternals vtkSQLiteQuery vtkSQLiteToTableReader vtkSSAAPass vtkSSAOPass vtkSTLWriter vtkSVGContextDevice2D vtkSVGExporter vtkSampleImplicitFunctionFilter vtkScalarBarActor vtkScalarBarActorInternal vtkScalarBarRepresentation vtkScalarBarWidget vtkScalarTree vtkScalarsToColors vtkScalarsToColorsItem vtkScalarsToTextureFilter vtkScaledSOADataArrayTemplate vtkScaledTextActor vtkScatterPlotMatrix vtkScenePicker vtkSectorSource vtkSeedRepresentation vtkSeedWidget vtkSegYBinaryHeaderBytesPositions vtkSegYIOUtils vtkSegYReader vtkSegYReaderInternal vtkSegYTrace vtkSegYTraceHeaderBytesPositions vtkSegYTraceReader vtkSelectEnclosedPoints vtkSelectVisiblePoints vtkSelectionAlgorithm vtkSelectionSource vtkSelector vtkSequencePass vtkSerializer vtkServerSocket vtkShader vtkShaderProgram vtkShaderProperty vtkShadowMapBakerPass vtkShadowMapPass vtkSharedFuture vtkSharedFutureBase vtkShepardKernel vtkShepardMethod vtkShortArray vtkShrinkFilter vtkSignedCharArray vtkSignedDistance vtkSimple2DLayoutStrategy vtkSimple3DCirclesStrategy vtkSimpleBondPerceiver vtkSimpleCellTessellator vtkSimpleImageToImageFilter vtkSimpleMotionBlurPass vtkSimplePointsWriter vtkSimpleReader vtkSimpleScalarTree vtkSingleVTPExporter vtkSkybox vtkSliceAndDiceLayoutStrategy vtkSliceCubes vtkSliderRepresentation vtkSliderRepresentation2D vtkSliderRepresentation3D vtkSliderWidget vtkSmartPointer vtkSmartPointerBase vtkSmartVector vtkSmartVolumeMapper vtkSmoothErrorMetric vtkSmoothPolyDataFilter vtkSobelGradientMagnitudePass vtkSocket vtkSocketCollection vtkSocketCommunicator vtkSocketController vtkSortDataArray vtkSortFieldData vtkSortFileNames vtkSpanSpace vtkSpanTreeLayoutStrategy vtkSparseArray vtkSparseArrayToTable vtkSpatialRepresentationFilter vtkSpatioTemporalHarmonicsAttribute vtkSpatioTemporalHarmonicsSource vtkSphereHandleRepresentation vtkSpherePuzzle vtkSpherePuzzleArrows vtkSphereRepresentation vtkSphereTree vtkSphereTreeFilter vtkSphereWidget vtkSphereWidget2 vtkSpheres vtkSphericalDirectionEncoder vtkSphericalHarmonics vtkSphericalPointIterator vtkSphericalTransform vtkSpiderPlotActor vtkSpline vtkSplineFilter vtkSplineGraphEdges vtkSplineRepresentation vtkSplineWidget vtkSplineWidget2 vtkSplitByCellScalarFilter vtkSplitColumnComponents vtkSplitField vtkSplitSharpEdgesPolyData vtkSquarifyLayoutStrategy vtkStackedTreeLayoutStrategy vtkStateStorage vtkStaticCellLinks vtkStaticCellLinksTemplate vtkStaticCellLocator vtkStaticCleanPolyData vtkStaticCleanUnstructuredGrid vtkStaticCompositeSource vtkStaticDataSource vtkStaticEdgeLocatorTemplate vtkStaticFaceHashLinksTemplate vtkStaticPointLocator vtkStaticPointLocator2D vtkStatisticalOutlierRemoval vtkStatisticsAlgorithm vtkStatisticsAlgorithmPrivate vtkStdString vtkStereoCompositor vtkStitchImageDataWithGhosts vtkStrahlerMetric vtkStreaklineFilter vtkStreamGraph vtkStreamSurface vtkStreamTracer vtkStreamerBase vtkStreamingDemandDrivenPipeline vtkStreamingStatistics vtkStreamingTessellator vtkStringArray vtkStringOutputWindow vtkStringToCategory vtkStringToImage vtkStringToNumeric vtkStringToken vtkStructuredAMRGridConnectivity vtkStructuredAMRNeighbor vtkStructuredCellArray vtkStructuredData vtkStructuredDataPlaneCutter vtkStructuredExtent vtkStructuredGridAlgorithm vtkStructuredGridAppend vtkStructuredGridClip vtkStructuredGridConnectivity vtkStructuredGridLIC2D vtkStructuredGridOutlineFilter vtkStructuredGridPartitioner vtkStructuredGridReader vtkStructuredGridWriter vtkStructuredImplicitConnectivity vtkStructuredNeighbor vtkStructuredPointArray vtkStructuredPointBackend vtkStructuredPoints vtkStructuredPointsCollection vtkStructuredPointsGeometryFilter vtkStructuredPointsWriter vtkStructuredTPointBackend vtkSubCommunicator vtkSubGroup vtkSubPixelPositionEdgels vtkSubdivideTetra vtkSubdivisionFilter vtkSuperquadric vtkSurfaceLICComposite vtkSurfaceLICHelper vtkSurfaceLICInterface vtkSurfaceLICMapper vtkSurfaceNets2D vtkSurfaceNets3D vtkSurfaceReconstructionFilter vtkSynchronizeTimeFilter vtkSynchronizedRenderWindows vtkSynchronizedRenderers vtkSynchronizedTemplates2D vtkSynchronizedTemplates3D vtkSynchronizedTemplatesCutter3D vtkSystemIncludes vtkTDxInteractorStyle vtkTDxInteractorStyleCamera vtkTDxInteractorStyleSettings vtkTDxMotionEventInfo vtkTDxQtUnixDevices vtkTGAReader vtkTIFFReaderInternal vtkTRUCHASReader vtkTable vtkTableAlgorithm vtkTableBasedClipCases vtkTableBasedClipDataSet vtkTableFFT vtkTableReader vtkTableToArray vtkTableToDatabaseWriter vtkTableToGraph vtkTableToMySQLWriter vtkTableToPolyData vtkTableToPostgreSQLWriter vtkTableToSQLiteWriter vtkTableToSparseArray vtkTableToStructuredGrid vtkTableToTreeFilter vtkTableWriter vtkTanglegramItem vtkTclCommand vtkTecplotReader vtkTecplotTableReader vtkTemplateAliasMacro vtkTemporalAlgorithm vtkTemporalArrayOperatorFilter vtkTemporalDataSetCache vtkTemporalDelimitedTextReader vtkTemporalFractal vtkTemporalInterpolatedVelocityField vtkTemporalInterpolator vtkTemporalPathLineFilter vtkTemporalShiftScale vtkTemporalSnapToTimeStep vtkTemporalStatistics vtkTensorGlyph vtkTensorPrincipalInvariants vtkTensorProbeRepresentation vtkTensorProbeWidget vtkTensorRepresentation vtkTensorWidget vtkTerrainContourLineInterpolator vtkTerrainDataPointPlacer vtkTessellatedBoxSource vtkTessellatorFilter vtkTestDataArray vtkTestNewVar vtkTextActor vtkTextActor3D vtkTextCodec vtkTextCodecFactory vtkTextPropertyCollection vtkTextRenderer vtkTextRendererCleanup vtkTextRendererStringToImage vtkTextRepresentation vtkTextSource vtkTextWidget vtkTexture vtkTextureIO vtkTextureImageCache vtkTextureMapToCylinder vtkTextureMapToPlane vtkTextureMapToSphere vtkTextureObject vtkTextureUnitManager vtkTexturedActor2D vtkTexturedButtonRepresentation vtkTexturedButtonRepresentation2D vtkTexturedSphereSource vtkThinPlateSplineTransform vtkThreadedCallbackQueue vtkThreadedCompositeDataPipeline vtkThreadedImageAlgorithm vtkThreadedImageWriter vtkThreadedTaskQueue vtkThresholdGraph vtkThresholdTable vtkThresholdTextureCoords vtkTimeInformation vtkTimePointUtility vtkTimeRange vtkTimeSource vtkTimeSourceExample vtkTimeStamp vtkTimerLog vtkTimerLogCleanup vtkTimerLogScope vtkToAffineArrayStrategy vtkToConstantArrayStrategy vtkToImplicitArrayFilter vtkToImplicitRamerDouglasPeuckerStrategy vtkToImplicitStrategy vtkToImplicitTypeErasureStrategy vtkToneMappingPass vtkTooltipItem vtkTransferAttributes vtkTransform2D vtkTransformCollection vtkTransformConcatenation vtkTransformConcatenationStack vtkTransformCoordinateSystems vtkTransformFeedback vtkTransformInterpolator vtkTransformPair vtkTransformTextureCoords vtkTransformToGrid vtkTranslucentPass vtkTransmitImageDataPiece vtkTransmitPolyDataPiece vtkTransmitRectilinearGridPiece vtkTransmitStructuredDataPiece vtkTransmitStructuredGridPiece vtkTransmitUnstructuredGridPiece vtkTransposeMatrix vtkTransposeTable vtkTree vtkTreeAlgorithm vtkTreeAreaView vtkTreeBFSIterator vtkTreeCompositer vtkTreeDFSIterator vtkTreeDifferenceFilter vtkTreeFieldAggregator vtkTreeHeatmapItem vtkTreeIterator vtkTreeLayoutStrategy vtkTreeLevelsFilter vtkTreeMapLayout vtkTreeMapLayoutStrategy vtkTreeMapToPolyData vtkTreeMapView vtkTreeOrbitLayoutStrategy vtkTreeReader vtkTreeRingToPolyData vtkTreeRingView vtkTreeWriter vtkTriQuadraticHexahedron vtkTriQuadraticPyramid vtkTriangleMeshPointNormals vtkTriangularTCoords vtkTriangularTexture vtkTrimmedExtrusionFilter vtkTrivialConsumer vtkTrivialProducer vtkTryDowncastHelper1 vtkTryDowncastHelper2 vtkTryDowncastHelper3 vtkTubeBender vtkTulipReader vtkTuple vtkTupleInterpolator vtkTypeList vtkTypedArray vtkTypedDataArray vtkTypedDataArrayIterator vtkURI vtkURIComponent vtkURILoader vtkUTF16TextCodec vtkUTF8TextCodec vtkUncertaintyTubeFilter vtkUndirectedGraphAlgorithm vtkUniformGrid vtkUniformGridAMR vtkUniformGridAMRAlgorithm vtkUniformGridAMRDataIterator vtkUniformGridPartitioner vtkUniformHyperTreeGrid vtkUniformHyperTreeGridSource vtkUniforms vtkUnsignedDistance vtkUnsignedIntArray vtkUnsignedLongArray vtkUnsignedLongLongArray vtkUnsignedShortArray vtkUnstructuredGridAlgorithm vtkUnstructuredGridBase vtkUnstructuredGridBaseAlgorithm vtkUnstructuredGridBunykRayCastFunction vtkUnstructuredGridCellIterator vtkUnstructuredGridGeometryFilter vtkUnstructuredGridHomogeneousRayIntegrator vtkUnstructuredGridLinearRayIntegrator vtkUnstructuredGridPartialPreIntegration vtkUnstructuredGridPreIntegration vtkUnstructuredGridQuadricDecimation vtkUnstructuredGridToCellGrid vtkUnstructuredGridToExplicitStructuredGrid vtkUnstructuredGridToReebGraphFilter vtkUnstructuredGridVolumeMapper vtkUnstructuredGridVolumeRayCastFunction vtkUnstructuredGridVolumeRayCastIterator vtkUnstructuredGridVolumeRayCastMapper vtkUnstructuredGridVolumeRayIntegrator vtkUnstructuredGridVolumeZSweepMapper vtkUnstructuredGridWriter vtkUpdateCellsV8toV9 vtkVASPAnimationReader vtkVASPTessellationReader vtkVPICReader vtkVRCamera vtkVRCollaborationClient vtkVRControlsHelper vtkVRFollower vtkVRHMDCamera vtkVRHardwarePicker vtkVRInteractorStyle vtkVRMLExporter vtkVRMLUseStruct vtkVRMLYaccData vtkVRMenuRepresentation vtkVRMenuWidget vtkVRModel vtkVRPanelRepresentation vtkVRPanelWidget vtkVRRay vtkVRRenderWindow vtkVRRenderWindowInteractor vtkVRRenderer vtkValuePass vtkValueSelector vtkVariant vtkVariantArray vtkVariantBoostSerialization vtkVariantCast vtkVariantCreate vtkVariantExtract vtkVector vtkVector2 vtkVector2d vtkVector2f vtkVector2i vtkVector3 vtkVector3d vtkVector3f vtkVector3i vtkVector4 vtkVector4d vtkVector4i vtkVectorDot vtkVectorFieldTopology vtkVectorNorm vtkVectorText vtkVeraOutReader vtkVersion vtkVertexAdjacencyList vtkVertexDegree vtkVertexListIterator vtkVideoSource vtkView vtkViewDependentErrorMetric vtkViewNode vtkViewNodeFactory vtkViewTheme vtkViewUpdater vtkViewport vtkVisibilitySort vtkVoidArray vtkVolume vtkVolumeCollection vtkVolumeContourSpectrumFilter vtkVolumeInputHelper vtkVolumeMapper vtkVolumeMapperNode vtkVolumeMask vtkVolumeNode vtkVolumeOfRevolutionFilter vtkVolumeOutlineSource vtkVolumePicker vtkVolumeProperty vtkVolumeRayCastSpaceLeapingImageFilter vtkVolumeReader vtkVolumeStateRAII vtkVolumeTexture vtkVolumetricPass vtkVoronoi2D vtkVoronoiKernel vtkVortexCore vtkVoxel vtkVoxelContoursToSurfaceFilter vtkVoxelGrid vtkVtkJSSceneGraphSerializer vtkVtkJSViewNodeFactory vtkWGPUContext vtkWarpLens vtkWarpScalar vtkWarpTo vtkWarpTransform vtkWasmSceneManager vtkWeakPointer vtkWeakPointerBase vtkWeakReference vtkWebApplication vtkWebAssemblyRenderWindowInteractor vtkWebGLDataSet vtkWebGLExporter vtkWebGLObject vtkWebGLPolyData vtkWebGLWidget vtkWebGPUActor vtkWebGPUCamera vtkWebGPUClearPass vtkWebGPUHardwareSelector vtkWebGPUInternalsBindGroup vtkWebGPUInternalsBindGroupLayout vtkWebGPUInternalsBuffer vtkWebGPUInternalsPipelineLayout vtkWebGPUInternalsRenderPassCreateInfo vtkWebGPUInternalsRenderPassDescriptor vtkWebGPUInternalsRenderPipelineDescriptor vtkWebGPUInternalsShaderModule vtkWebGPULight vtkWebGPUPolyDataMapper vtkWebGPUProperty vtkWebGPURenderPass vtkWebGPURenderWindow vtkWebGPURenderer vtkWebInteractionEvent vtkWebUtilities vtkWedge vtkWendlandQuinticKernel vtkWidgetCallbackMapper vtkWidgetEvent vtkWidgetEventTranslator vtkWidgetRepresentation vtkWidgetSet vtkWin32HardwareWindow vtkWin32Header vtkWin32OpenGL2RenderWindow vtkWin32OpenGLDXRenderWindow vtkWin32OpenGLRenderWindow vtkWin32OutputWindow vtkWin32ProcessOutputWindow vtkWin32RenderWindowInteractor vtkWin32VideoSource vtkWindBladeReader vtkWindow vtkWindowLevelLookupTable vtkWindowNode vtkWindowToImageFilter vtkWordCloud vtkWorldPointPicker vtkWrappingHints vtkWriter vtkX3DExporter vtkX3DExporterFIWriter vtkX3DExporterFIWriterHelper vtkX3DExporterWriter vtkX3DExporterXMLWriter vtkXMLCompositeDataReader vtkXMLCompositeDataSetWriterHelper vtkXMLCompositeDataWriter vtkXMLDataElement vtkXMLDataHeader vtkXMLDataHeaderImpl vtkXMLDataObjectWriter vtkXMLDataParser vtkXMLDataReader vtkXMLDataSetWriter vtkXMLDataWriterHelper vtkXMLFileOutputWindow vtkXMLFileReadTester vtkXMLHierarchicalBoxDataFileConverter vtkXMLHierarchicalBoxDataReader vtkXMLHierarchicalBoxDataWriter vtkXMLHierarchicalDataReader vtkXMLHyperTreeGridReader vtkXMLHyperTreeGridWriter vtkXMLMultiBlockDataReader vtkXMLMultiBlockDataWriter vtkXMLMultiGroupDataReader vtkXMLPDataObjectReader vtkXMLPDataObjectWriter vtkXMLPDataReader vtkXMLPDataSetWriter vtkXMLPDataWriter vtkXMLPHierarchicalBoxDataWriter vtkXMLPHyperTreeGridReader vtkXMLPHyperTreeGridWriter vtkXMLPImageDataReader vtkXMLPImageDataWriter vtkXMLPMultiBlockDataWriter vtkXMLPPolyDataReader vtkXMLPPolyDataWriter vtkXMLPRectilinearGridReader vtkXMLPRectilinearGridWriter vtkXMLPStructuredDataReader vtkXMLPStructuredDataWriter vtkXMLPStructuredGridReader vtkXMLPStructuredGridWriter vtkXMLPTableReader vtkXMLPTableWriter vtkXMLPUniformGridAMRWriter vtkXMLPUnstructuredDataReader vtkXMLPUnstructuredDataWriter vtkXMLPUnstructuredGridReader vtkXMLPUnstructuredGridWriter vtkXMLParser vtkXMLPartitionedDataSetCollectionReader vtkXMLPartitionedDataSetCollectionWriter vtkXMLPartitionedDataSetReader vtkXMLPartitionedDataSetWriter vtkXMLReader vtkXMLReaderVersion vtkXMLRectilinearGridWriter vtkXMLStructuredDataReader vtkXMLStructuredDataWriter vtkXMLTableReader vtkXMLTableWriter vtkXMLTreeReader vtkXMLUniformGridAMRReader vtkXMLUniformGridAMRWriter vtkXMLUnstructuredDataReader vtkXMLUnstructuredDataWriter vtkXMLUtilities vtkXMLWriter vtkXMLWriter2 vtkXMLWriterBase vtkXOpenGLRenderWindow vtkXRenderWindowInteractor vtkXWebGPURenderWindow vtkXYPlotActor vtkXYPlotRepresentation vtkXYPlotWidget vtkXYZMolReader vtkXYZMolReader2 vtkXdmf3ArrayKeeper vtkXdmf3ArraySelection vtkXdmf3DataSet vtkXdmf3HeavyDataHandler vtkXdmf3LightDataHandler vtkXdmf3Reader vtkXdmf3SILBuilder vtkXdmf3Writer vtkXdmfArraySelection vtkXdmfDataArray vtkXdmfDocument vtkXdmfDomain vtkXdmfHeavyData vtkXdmfReader vtkXdmfReaderInternal vtkXdmfWriter vtkYieldCriteria vtkYoungsMaterialInterface vtkZLibDataCompressor vtkZSpaceCamera vtkZSpaceCoreCompatibilitySDKManager vtkZSpaceCoreSDKManager vtkZSpaceGenericRenderWindow vtkZSpaceHardwarePicker vtkZSpaceInteractorStyle vtkZSpaceRayActor vtkZSpaceRenderWindowInteractor vtkZSpaceRenderer vtkZSpaceSDKManager vtkZSpaceWin32RenderWindow vtkmAverageToCells vtkmAverageToPoints vtkmCleanGrid vtkmClip vtkmContour vtkmCoordinateSystemTransform vtkmDataArray vtkmDataSet vtkmExternalFaces vtkmExtractVOI vtkmFilterOverrides vtkmGradient vtkmHistogram vtkmImageConnectivity vtkmLevelOfDetail vtkmNDHistogram vtkmPointElevation vtkmPointTransform vtkmPolyDataNormals vtkmProbe vtkmSlice vtkmThreshold vtkmTriangleMeshPointNormals vtkmWarpScalar vtkmWarpVector"},{"location":"CSharp/Coverage/CSharpVTKClassesUsed/","title":"VTK Classes used in the Examples","text":""},{"location":"CSharp/Coverage/CSharpVTKClassesUsed/#csharp","title":"CSharp","text":"

        Out of 3113 available VTK classes, 190 are demonstrated here.

        "},{"location":"CSharp/Coverage/CSharpVTKClassesUsed/#excluded-classes","title":"Excluded classes","text":"

        These classes are excluded since they occur in the majority of the examples:

        VTK Class VTK Class VTK Class vtkActor vtkCamera vtkNamedColors vtkPolyDataMapper vtkProperty vtkRenderer vtkRenderWindow vtkRenderWindowInteractor"},{"location":"CSharp/Coverage/CSharpVTKClassesUsed/#classes-used","title":"Classes used","text":"VTK Class Examples vtkActor2D GeometricObjectsDemo ParametricObjectsDemo ReadDICOMSeries Subdivision vtkAppendPolyData ColorDisconnectedRegions FilledContours PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion vtkArrowSource Arrow GeometricObjectsDemo OrientedArrow VectorFieldNonZeroExtraction vtkAxesActor Axes vtkBandedPolyDataContourFilter BandedPolyDataContourFilter vtkBMPReader ReadBMP WriteBMP vtkBMPWriter WriteBMP vtkButterflySubdivisionFilter Subdivision vtkCell CellEdges vtkCellArray BandedPolyDataContourFilter ColoredLines ExtractEdges Hexahedron IterateOverLines LongLine Point Polygon PolyLine Pyramid Quad Tetrahedron Triangle TriangleStrip Vertex WarpVector WriteVTP WriteVTU vtkCleanPolyData FilledContours vtkClipPolyData CapClip FilledContours SelectPolyData SolidClip vtkConeSource Cone GeometricObjectsDemo vtkContourFilter FilledContours ImplicitBoolean ImplicitSphere IsoContours SampleFunction vtkContourWidget PolygonalSurfaceContourLineInterpolator vtkCubeSource Cube GeometricObjectsDemo VectorFieldNonZeroExtraction vtkCurvatures Curvature vtkCutter ContoursFromPolyData vtkCylinderSource Cylinder GeometricObjectsDemo vtkDataObject VectorFieldNonZeroExtraction vtkDataSet HighlightBadCells vtkDataSetAttributes VectorFieldNonZeroExtraction vtkDataSetMapper CapClip Hexahedron HighlightBadCells Pyramid ReadImageData ReadPolyData ReadRectilinearGrid ReadUnknownTypeXMLFile ReadUnstructuredGrid Tetrahedron TriangleStrip WriteVTI WriteVTP WriteVTU vtkDataSetSurfaceFilter FillHoles MatrixMathFilter vtkDecimatePro Decimate vtkDelaunay2D ColoredElevationMap ElevationFilter SimpleElevationFilter vtkDEMReader DEMReader vtkDICOMImageReader ReadDICOMSeries vtkDijkstraGraphGeodesicPath DijkstraGraphGeodesicPath vtkDiskSource BoundaryEdges Disk GeometricObjectsDemo vtkDoubleArray HighlightBadCells WarpVector vtkEarthSource GeometricObjectsDemo vtkElevationFilter ElevationFilter vtkExtractEdges ExtractEdges vtkExtractSelection FillHoles vtkFeatureEdges BoundaryEdges CapClip ClosedSurface vtkFieldData WeightedTransformFilter vtkFillHolesFilter FillHoles vtkFloatArray BandedPolyDataContourFilter ElevationFilter FilledContours NullPoint SimpleElevationFilter WeightedTransformFilter vtkFrustumSource Frustum vtkGlyph3D ReadPDB VectorFieldNonZeroExtraction vtkGraphLayoutView XGMLReader vtkGreedyTerrainDecimation GreedyTerrainDecimation vtkHexahedron Hexahedron vtkIdList CellEdges IterateOverLines vtkIdTypeArray FillHoles vtkImageActor DEMReader ImageReader2Factory MetaImageReader MetaImageWriter vtkImageCanvasSource2D JPEGWriter WriteBMP WritePNG WritePNM WriteTIFF vtkImageCast JPEGWriter MetaImageWriter WritePNG vtkImageData GreedyTerrainDecimation IsoContours VectorFieldNonZeroExtraction WriteVTI vtkImageDataGeometryFilter WriteVTI vtkImageMagnitude VectorFieldNonZeroExtraction vtkImageMandelbrotSource MetaImageWriter vtkImageMapToColors DEMReader vtkImageReader2 ImageReader2Factory vtkImageReader2Factory ImageReader2Factory vtkImageViewer2 JPEGReader JPEGWriter PNGReader ReadBMP ReadDICOMSeries ReadPNM ReadTIFF WriteBMP WritePNG WritePNM WriteTIFF vtkImplicitBoolean ImplicitBoolean vtkIntArray NullPoint vtkInteractorStyleImage ReadDICOMSeries vtkJPEGReader JPEGReader JPEGWriter vtkJPEGWriter JPEGWriter vtkLandmarkTransform AlignFrames vtkLine ColoredLines DistancePointToLine ExtractEdges IterateOverLines LongLine WarpVector vtkLinearSubdivisionFilter Subdivision vtkLineSource GeometricObjectsDemo Line vtkLODActor ReadPDB SelectPolyData vtkLookupTable ColoredElevationMap DEMReader ElevationFilter FilledContours PlatonicSolid SimpleElevationFilter vtkLoopSubdivisionFilter Subdivision vtkMarchingCubes ExtractLargestIsosurface MarchingCubes vtkMarchingSquares MarchingSquares vtkMath AlignFrames ColoredElevationMap ContoursFromPolyData DistanceBetweenPoints GaussianRandomNumber GreedyTerrainDecimation OrientedArrow ParametricObjectsDemo UniformRandomNumber vtkMatrix4x4 AlignFrames OrientedArrow PerspectiveTransform vtkMatrixMathFilter MatrixMathFilter vtkMergePoints MarchingSquares vtkMeshQuality HighlightBadCells vtkMetaImageReader MetaImageReader MetaImageWriter vtkMetaImageWriter MetaImageWriter vtkMinimalStandardRandomSequence RandomSequence vtkMultiBlockDataSet MultiBlockMergeFilter vtkMultiBlockMergeFilter MultiBlockMergeFilter vtkMultiBlockPLOT3DReader ReadPLOT3D vtkOBBDicer OBBDicer vtkObject ReadDICOMSeries vtkOBJReader ReadOBJ vtkOrientedGlyphContourRepresentation PolygonalSurfaceContourLineInterpolator vtkOutlineCornerFilter OBBDicer vtkOutlineFilter IsoContours MarchingSquares SampleFunction vtkParametricBoy ParametricObjectsDemo vtkParametricConicSpiral ParametricObjectsDemo vtkParametricCrossCap ParametricObjectsDemo vtkParametricDini ParametricObjectsDemo vtkParametricEllipsoid ParametricObjectsDemo vtkParametricEnneper ParametricObjectsDemo vtkParametricFigure8Klein ParametricObjectsDemo vtkParametricFunction ParametricObjectsDemo vtkParametricFunctionSource ParametricObjects ParametricObjectsDemo vtkParametricKlein ParametricObjectsDemo vtkParametricMobius ParametricObjectsDemo vtkParametricRandomHills ParametricObjectsDemo vtkParametricRoman ParametricObjectsDemo vtkParametricSpline ParametricObjectsDemo vtkParametricSuperEllipsoid ParametricObjectsDemo vtkParametricSuperToroid ParametricObjectsDemo vtkParametricTorus ParametricObjects ParametricObjectsDemo vtkParticleReader ParticleReader vtkPDBReader ReadPDB vtkPerspectiveTransform PerspectiveTransform vtkPlane CapClip ContoursFromPolyData ProjectPointPlane SolidClip vtkPlanes Frustum Planes vtkPlanesIntersection PlanesIntersection vtkPlaneSource Plane vtkPlatonicSolidSource PlatonicSolid vtkPLYReader ReadPLY vtkPLYWriter ConvertFile vtkPNGReader PNGReader WritePNG vtkPNGWriter WritePNG vtkPNMReader ReadPNM WritePNM vtkPNMWriter WritePNM vtkPoints AlignFrames BandedPolyDataContourFilter ColoredElevationMap ColoredLines ElevationFilter ExtractEdges Hexahedron IterateOverLines LongLine NullPoint ParametricObjectsDemo PlanesIntersection Point Polygon PolygonIntersection PolyLine Pyramid Quad ReadPlainText SelectPolyData SimpleElevationFilter Tetrahedron Triangle TriangleStrip Vertex WarpVector WriteVTP WriteVTU XMLStructuredGridWriter vtkPolyData AlignFrames BandedPolyDataContourFilter CapClip ColoredElevationMap ColoredLines ContoursFromPolyData Decimate ElevationFilter FillHoles FindAllArrayNames Frustum HighlightBadCells IterateOverLines LongLine NullPoint OBBDicer Point PolyDataGetPoint Polygon PolygonalSurfaceContourLineInterpolator PolyLine Quad QuadricClustering QuadricDecimation ReadPlainText ReadUnknownTypeXMLFile SimpleElevationFilter Subdivision Triangle TriangleStrip VectorFieldNonZeroExtraction Vertex WarpVector WeightedTransformFilter WriteVTP vtkPolyDataAlgorithm GeometricObjectsDemo Subdivision vtkPolyDataConnectivityFilter ColorDisconnectedRegions ExtractLargestIsosurface PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion vtkPolygon Polygon PolygonIntersection vtkPolygonalSurfaceContourLineInterpolator PolygonalSurfaceContourLineInterpolator vtkPolygonalSurfacePointPlacer PolygonalSurfaceContourLineInterpolator vtkPolyLine PolyLine vtkPyramid Pyramid vtkQuad Quad vtkQuadricClustering QuadricClustering vtkQuadricDecimation QuadricDecimation vtkRegularPolygonSource GeometricObjectsDemo RegularPolygonSource Triangulate vtkSampleFunction ImplicitBoolean ImplicitSphere SampleFunction vtkSelection FillHoles vtkSelectionNode FillHoles vtkSelectPolyData SelectPolyData vtkShrinkPolyData ShrinkPolyData vtkSimpleElevationFilter SimpleElevationFilter vtkSimplePointsReader SimplePointsReader vtkSphere ImplicitBoolean ImplicitSphere SampleFunction vtkSphereSource Axes CapClip ClosedSurface ColorDisconnectedRegions ContoursFromPolyData Decimate DijkstraGraphGeodesicPath ExtractEdges FillHoles FindAllArrayNames GeometricObjectsDemo HighlightBadCells MarchingCubes MultiBlockMergeFilter OBBDicer OrientedArrow Planes PlanesIntersection PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion PolyDataGetPoint PolygonalSurfaceContourLineInterpolator QuadricClustering QuadricDecimation ReadPDB SelectPolyData ShrinkPolyData Sphere Subdivision WeightedTransformFilter WindowedSincPolyDataFilter vtkSTLReader ReadSTL vtkStripper CapClip vtkStructuredGrid XMLStructuredGridWriter vtkStructuredGridGeometryFilter ReadPLOT3D ReadStructuredGrid XMLStructuredGridWriter vtkStructuredPointsReader ExtractLargestIsosurface vtkSuperquadricSource SolidClip vtkTetra Tetrahedron WriteVTU vtkTextMapper GeometricObjectsDemo ParametricObjectsDemo ReadDICOMSeries Subdivision vtkTextProperty GeometricObjectsDemo ParametricObjectsDemo ReadDICOMSeries Subdivision vtkThreshold HighlightBadCells vtkThresholdPoints VectorFieldNonZeroExtraction vtkTIFFReader ReadTIFF WriteTIFF vtkTIFFWriter WriteTIFF vtkTransform AlignFrames Axes OrientedArrow PerspectiveTransform WeightedTransformFilter vtkTransformFilter AlignFrames WeightedTransformFilter vtkTransformPolyDataFilter OrientedArrow vtkTriangle CellEdges Triangle WriteVTP vtkTriangleFilter HighlightBadCells PolygonalSurfaceContourLineInterpolator Subdivision Triangulate vtkTriangleStrip TriangleStrip vtkTubeFilter ReadPDB vtkUndirectedGraph XGMLReader vtkUnsignedCharArray ColoredElevationMap ColoredLines ElevationFilter SimpleElevationFilter vtkUnstructuredGrid Hexahedron HighlightBadCells Pyramid ReadUnknownTypeXMLFile Tetrahedron WriteVTU vtkUnstructuredGridReader MatrixMathFilter vtkVertex Vertex vtkVertexGlyphFilter AlignFrames ReadPlainText vtkVolume16Reader MarchingSquares vtkVoxelModeller MarchingCubes vtkVRMLImporter VRML vtkWarpVector WarpVector vtkWeightedTransformFilter WeightedTransformFilter vtkWindowedSincPolyDataFilter WindowedSincPolyDataFilter vtkXGMLReader XGMLReader vtkXMLGenericDataObjectReader ReadUnknownTypeXMLFile vtkXMLImageDataReader ReadImageData WriteVTI vtkXMLImageDataWriter IsoContours WriteVTI vtkXMLPolyDataReader CapClip ContoursFromPolyData ConvertFile Curvature FilledContours FillHoles FindAllArrayNames OBBDicer ReadPolyData Subdivision WriteVTP vtkXMLPolyDataWriter AlignFrames Curvature FindAllArrayNames MatrixMathFilter WriteVTP vtkXMLRectilinearGridReader ReadRectilinearGrid vtkXMLStructuredGridReader ReadStructuredGrid XMLStructuredGridWriter vtkXMLStructuredGridWriter XMLStructuredGridWriter vtkXMLUnstructuredGridReader ReadUnstructuredGrid WriteVTU vtkXMLUnstructuredGridWriter WriteVTU"},{"location":"CSharp/Filtering/ContoursFromPolyData/","title":"ContoursFromPolyData","text":"

        vtk-examples/CSharp/Filtering/ContoursFromPolyData

        "},{"location":"CSharp/Filtering/ContoursFromPolyData/#description","title":"Description","text":"

        This example uses [vtkCutter](https://www.vtk.org/doc/nightly/html/classvtkCutter.html#details) to generate contours from a PolyData. A [vtkPlane](https://www.vtk.org/doc/nightly/html/classvtkPlane.html#details) is set at the center of the PolyData and several contours are generated by specifying contour values that are distances to the center plane. The example works with a filename if provided. Otherwise is uses a [vtkSphereSource](https://www.vtk.org/doc/nightly/html/classvtkSphereSource.html#details).

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Filtering/ContoursFromPolyData/#code","title":"Code","text":"

        ContoursFromPolyData.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ContoursFromPolyData(null);\n            //ContoursFromPolyData(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\bunny.vtp\");\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n      private void ContoursFromPolyData(string filePath) {\n         vtkPolyData inputPolyData;\n         if(filePath != null) {\n            vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n            reader.SetFileName(filePath);\n            reader.Update();\n            inputPolyData = reader.GetOutput();\n         }\n         else {\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.SetThetaResolution(30);\n            sphereSource.SetPhiResolution(15);\n            sphereSource.Update();\n            inputPolyData = sphereSource.GetOutput();\n         }\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInput(inputPolyData);\n#else\n         inputMapper.SetInputData(inputPolyData);\n#endif\n\n         // Create a plane to cut\n         vtkPlane plane = vtkPlane.New();\n         double[] center = inputPolyData.GetCenter();\n         double[] bounds = inputPolyData.GetBounds();\n         plane.SetOrigin(center[0], center[1], center[2]);\n         plane.SetNormal(1, 1, 1);\n\n\n         float[] centerf = new float[] { (float)center[0], (float)center[1], (float)center[2] };\n         float[] minBoundf = new float[] { (float)bounds[0], (float)bounds[2], (float)bounds[4] };\n         float[] maxBoundf = new float[] { (float)bounds[1], (float)bounds[3], (float)bounds[5] };\n         IntPtr pCenter = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * 3);\n         IntPtr pMinBound = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * 3);\n         IntPtr pMaxBound = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * 3);\n         Marshal.Copy(centerf, 0, pCenter, 3);\n         Marshal.Copy(minBoundf, 0, pMinBound, 3);\n         Marshal.Copy(maxBoundf, 0, pMaxBound, 3);\n\n         // vtkMath.Distance2BetweenPoints accepts floats only\n         double distanceMin = Math.Sqrt(vtkMath.Distance2BetweenPoints(pMinBound, pCenter));\n         double distanceMax = Math.Sqrt(vtkMath.Distance2BetweenPoints(pMaxBound, pCenter));\n\n         Marshal.FreeHGlobal(pCenter);\n         Marshal.FreeHGlobal(pMinBound);\n         Marshal.FreeHGlobal(pMaxBound);\n         // Create cutter\n         vtkCutter cutter = vtkCutter.New();\n         cutter.SetCutFunction(plane);\n#if VTK_MAJOR_VERSION_5\n         cutter.SetInput(inputPolyData);\n#else\n         cutter.SetInputData(inputPolyData);\n#endif\n         cutter.GenerateValues(20, -distanceMin, distanceMax);\n         vtkPolyDataMapper cutterMapper = vtkPolyDataMapper.New();\n         cutterMapper.SetInputConnection(cutter.GetOutputPort());\n         cutterMapper.ScalarVisibilityOff();\n\n         // Create plane actor\n         vtkActor planeActor = vtkActor.New();\n         planeActor.GetProperty().SetColor(1.0, 0.0, 0.0);\n         planeActor.GetProperty().SetLineWidth(3);\n         planeActor.SetMapper(cutterMapper);\n\n         // Create input actor\n         vtkActor inputActor = vtkActor.New();\n         inputActor.GetProperty().SetColor(1.0, 0.8941, 0.7686); // bisque\n         inputActor.SetMapper(inputMapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         renderer.AddActor(inputActor); \n         renderer.AddActor(planeActor); //display the contour lines\n      }\n   }\n}\n
        "},{"location":"CSharp/Filters/ImplicitBoolean/","title":"ImplicitBoolean","text":"

        vtk-examples/CSharp/Filters/ImplicitBoolean

        "},{"location":"CSharp/Filters/ImplicitBoolean/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Note

        As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Filters/ImplicitBoolean/#code","title":"Code","text":"

        ImplicitBoolean.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ImplicitBoolean();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ImplicitBoolean() {\n         vtkSphere sphere1 = vtkSphere.New();\n         sphere1.SetCenter(.9, 0, 0);\n         vtkSphere sphere2 = vtkSphere.New();\n         sphere2.SetCenter(-.9, 0, 0);\n\n         vtkImplicitBoolean implicitBoolean = vtkImplicitBoolean.New();\n         implicitBoolean.AddFunction(sphere1);\n         implicitBoolean.AddFunction(sphere2);\n         implicitBoolean.SetOperationTypeToUnion();\n         //implicitBoolean.SetOperationTypeToIntersection();\n\n         // Sample the function\n         vtkSampleFunction sample = vtkSampleFunction.New();\n         sample.SetSampleDimensions(50, 50, 50);\n         sample.SetImplicitFunction(implicitBoolean);\n         double value = 3.0;\n         double xmin = -value, xmax = value,\n                ymin = -value, ymax = value,\n                zmin = -value, zmax = value;\n         sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n         // Create the 0 isosurface\n         vtkContourFilter contours = vtkContourFilter.New();\n#if VTK_MAJOR_VERSION_5\n         contours.SetInputConnection(sample.GetOutputPort());\n#else\n         contours.SetInputData(sample);\n#endif\n         contours.GenerateValues(1, 1, 1);\n\n         // Map the contours to graphical primitives\n         vtkPolyDataMapper contourMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         contourMapper.SetInputConnection(contours.GetOutputPort());\n#else\n         contourMapper.SetInputData(contours);\n#endif\n         contourMapper.ScalarVisibilityOff();\n\n         // Create an actor for the contours\n         vtkActor contourActor = vtkActor.New();\n         contourActor.SetMapper(contourMapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         renderer.AddActor(contourActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Arrow/","title":"Arrow","text":"

        vtk-examples/CSharp/GeometricObjects/Arrow

        "},{"location":"CSharp/GeometricObjects/Arrow/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Arrow/#code","title":"Code","text":"

        Arrow.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Arrow();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Arrow() {\n         // Create two arrows.  \n         vtkArrowSource arrowSource01 = vtkArrowSource.New();\n         vtkArrowSource arrowSource02 = vtkArrowSource.New();\n         arrowSource02.SetShaftResolution(24);   // default = 6\n         arrowSource02.SetTipResolution(36);     // default = 6\n\n         // Visualize\n         vtkPolyDataMapper mapper01 = vtkPolyDataMapper.New();\n         vtkPolyDataMapper mapper02 = vtkPolyDataMapper.New();\n         mapper01.SetInputConnection(arrowSource01.GetOutputPort());\n         mapper02.SetInputConnection(arrowSource02.GetOutputPort());\n         vtkActor actor01= vtkActor.New();\n         vtkActor actor02 = vtkActor.New();\n         actor01.SetMapper(mapper01);\n         actor02.SetMapper(mapper02);\n         actor01.SetPosition(0.0,  0.25, 0.0);\n         actor02.SetPosition(0.0, -0.25, 0.0);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor01);\n         renderer.AddActor(actor02);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Axes/","title":"Axes","text":"

        vtk-examples/CSharp/GeometricObjects/Axes

        "},{"location":"CSharp/GeometricObjects/Axes/#description","title":"Description","text":"

        This example shows how to position an AxesActor in 3D. Notice that position and orientation of the AxesActor is done with a user transform. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Axes/#code","title":"Code","text":"

        Axes.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Axes();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Axes() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.SetCenter(0.0, 0.0, 0.0);\n         sphereSource.SetRadius(0.5);\n\n         //create a mapper\n         vtkPolyDataMapper sphereMapper = vtkPolyDataMapper.New();\n         sphereMapper.SetInputConnection(sphereSource.GetOutputPort());\n\n         // create an actor\n         vtkActor sphereActor = vtkActor.New();\n         sphereActor.SetMapper(sphereMapper);\n\n         // a renderer and render window\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n\n         // add the actors to the scene\n         renderer.AddActor(sphereActor);\n\n         vtkAxesActor axes = vtkAxesActor.New();\n         // The axes are positioned with a user transform\n         vtkTransform transform = vtkTransform.New();\n         transform.Translate(0.75, 0.0, 0.0);\n         axes.SetUserTransform(transform);\n         // properties of the axes labels can be set as follows\n         // this sets the x axis label to red\n         // axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetColor(1,0,0);\n\n         // the actual text of the axis label can be changed:\n         // axes.SetXAxisLabelText(\"test\");\n\n         renderer.AddActor(axes);\n         // we need to call Render() for the whole renderWindow, \n         // because vtkAxesActor uses an overlayed renderer for the axes label\n         // in total we have now two renderer\n         renderWindow.Render();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/ColoredLines/","title":"ColoredLines","text":"

        vtk-examples/CSharp/GeometricObjects/ColoredLines

        "},{"location":"CSharp/GeometricObjects/ColoredLines/#description","title":"Description","text":"

        Displays two lines, each with a different color. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/ColoredLines/#code","title":"Code","text":"

        ColoredLines.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ColoredLines();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ColoredLines() {\n         // Create three points. Join (Origin and P0) with a red line and\n         // (Origin and P1) with a green line\n         double[] origin = new double[] { 0.0, 0.0, 0.0 };\n         double[] p0 = new double[] { 1.0, 0.0, 0.0 };\n         double[] p1 = new double[] { 0.0, 1.0, 0.0 };\n\n         // Create a vtkPoints object and store the points in it\n         vtkPoints pts = vtkPoints.New();\n         pts.InsertNextPoint(origin[0], origin[1], origin[2]);\n         pts.InsertNextPoint(p0[0], p0[1], p0[2]);\n         pts.InsertNextPoint(p1[0], p1[1], p1[2]);\n\n         // Setup two colors - one for each line\n         byte[] red = new byte[] { 255, 0, 0 };\n         byte[] green = new byte[] { 0, 255, 0 };\n\n         // Setup the colors array\n         vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();\n         colors.SetNumberOfComponents(3);\n         colors.SetName(\"Colors\");\n\n         // Add the colors we created to the colors array\n         colors.InsertNextValue(red[0]);\n         colors.InsertNextValue(red[1]);\n         colors.InsertNextValue(red[2]);\n\n         colors.InsertNextValue(green[0]);\n         colors.InsertNextValue(green[1]);\n         colors.InsertNextValue(green[2]);\n\n         // Create the first line (between Origin and P0)\n         vtkLine line0 = vtkLine.New();\n         line0.GetPointIds().SetId(0, 0); //the second 0 is the index of the Origin in the vtkPoints\n         line0.GetPointIds().SetId(1, 1); //the second 1 is the index of P0 in the vtkPoints\n\n         // Create the second line (between Origin and P1)\n         vtkLine line1 = vtkLine.New();\n         line1.GetPointIds().SetId(0, 0); //the second 0 is the index of the Origin in the vtkPoints\n         line1.GetPointIds().SetId(1, 2); //2 is the index of P1 in the vtkPoints\n\n         // Create a cell array to store the lines in and add the lines to it\n         vtkCellArray lines = vtkCellArray.New();\n         lines.InsertNextCell(line0);\n         lines.InsertNextCell(line1);\n\n         // Create a polydata to store everything in\n         vtkPolyData linesPolyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         linesPolyData.SetPoints(pts);\n\n         // Add the lines to the dataset\n         linesPolyData.SetLines(lines);\n\n         // Color the lines - associate the first component (red) of the\n         // colors array with the first component of the cell array (line 0)\n         // and the second component (green) of the colors array with the\n         // second component of the cell array (line 1)\n         linesPolyData.GetCellData().SetScalars(colors);\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(linesPolyData);\n         // create an actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // a renderer and render window\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n\n         // add the actors to the scene\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Cone/","title":"Cone","text":"

        vtk-examples/CSharp/GeometricObjects/Cone

        "},{"location":"CSharp/GeometricObjects/Cone/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Cone/#code","title":"Code","text":"

        Cone.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Cone();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Cone() {\n         // Create a cone.  \n         vtkConeSource coneSource = vtkConeSource.New();\n         // coneSource.SetCapping(1);\n         // coneSource.SetRadius(0.5);\n         // coneSource.SetResolution(32);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(coneSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.3, 0.2, 0.1);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Cube/","title":"Cube","text":"

        vtk-examples/CSharp/GeometricObjects/Cube

        "},{"location":"CSharp/GeometricObjects/Cube/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Cube/#code","title":"Code","text":"

        Cube.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Cube();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Cube() {\n         // Create a cube.  \n         vtkCubeSource cubeSource = vtkCubeSource.New();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(cubeSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.3, 0.2, 0.1);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Cylinder/","title":"Cylinder","text":"

        vtk-examples/CSharp/GeometricObjects/Cylinder

        "},{"location":"CSharp/GeometricObjects/Cylinder/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Cylinder/#code","title":"Code","text":"

        Cylinder.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Cylinder();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Cylinder() {\n         // Create a cylinder.  \n         vtkCylinderSource cylinderSource = vtkCylinderSource.New();\n         cylinderSource.SetCenter(0.0, 0.0, 0.0);\n         cylinderSource.SetRadius(5.0);\n         cylinderSource.SetHeight(7.0);\n         cylinderSource.SetResolution(36);\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(cylinderSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.1, 0.3, 0.2);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Disk/","title":"Disk","text":"

        vtk-examples/CSharp/GeometricObjects/Disk

        "},{"location":"CSharp/GeometricObjects/Disk/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Disk/#code","title":"Code","text":"

        Disk.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Disk();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Disk() {\n         // Create a disk.  \n         vtkDiskSource diskSource = vtkDiskSource.New();\n         //diskSource.SetCircumferentialResolution(16);\n         //diskSource.SetRadialResolution(16);\n         //diskSource.SetInnerRadius(0.25);\n         //diskSource.SetOuterRadius(1.25);\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(diskSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Frustum/","title":"Frustum","text":"

        vtk-examples/CSharp/GeometricObjects/Frustum

        "},{"location":"CSharp/GeometricObjects/Frustum/#description","title":"Description","text":"

        This example gets the frustum from a camera and displays it on the screen. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Frustum/#code","title":"Code","text":"

        Frustum.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Frustum();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Frustum() {\n         // Create a frustum.  \n         // in this example we need the renderer first to retrieve the active camera\n         // in order to get camera's frustum planes\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         vtkCamera camera = renderer.GetActiveCamera();\n         double[] aspect = renderer.GetAspect();\n         double aspectRatio = aspect[0] / aspect[1];\n\n         // allocate memory for 24 unmanaged doubles\n         int size = Marshal.SizeOf(typeof(double)) * 24;\n         IntPtr ptr = Marshal.AllocHGlobal(size);\n         camera.GetFrustumPlanes(aspectRatio, ptr);\n         // in case we would need this values directly we could copy \n         // the unmanaged double array to a managed array like so:\n\n         // double[] planesArray = new double[24];\n         // Marshal.Copy(ptr, planesArray, 0, 24);\n\n         // but fortunately we can forward the IntPtr directly to the function \n         // SetFrustumPlanes()\n         vtkPlanes planes = vtkPlanes.New();\n         planes.SetFrustumPlanes(ptr);\n         // free unmanaged memory\n         Marshal.FreeHGlobal(ptr);\n\n         vtkFrustumSource frustumSource = vtkFrustumSource.New();\n         frustumSource.SetPlanes(planes);\n         frustumSource.Update();\n\n         vtkPolyData frustum = frustumSource.GetOutput();\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(frustum);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         renderer.SetBackground(.2, .1, .3); // Background color dark purple\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/GeometricObjectsDemo/","title":"GeometricObjectsDemo","text":"

        vtk-examples/CSharp/GeometricObjects/GeometricObjectsDemo

        "},{"location":"CSharp/GeometricObjects/GeometricObjectsDemo/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/GeometricObjectsDemo/#code","title":"Code","text":"

        GeometricObjectsDemo.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.Runtime.InteropServices;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            GeometricObjectsDemo();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void GeometricObjectsDemo() {\n         // we create a matrix of 3x3 renderer in our renderwindow\n         // each renderer can be interacted with independently from one another\n         int rendererSize = 234; // width per renderer\n         int gridDimensions = 3;\n         this.Size = new System.Drawing.Size(756, 756);\n         Random rnd = new Random(2); // for background color variation\n\n         List<vtkPolyDataAlgorithm>  geometricObjectSources = new List<vtkPolyDataAlgorithm>();\n         geometricObjectSources.Add(vtkArrowSource.New());\n         geometricObjectSources.Add(vtkConeSource.New());\n         geometricObjectSources.Add(vtkCubeSource.New());\n         geometricObjectSources.Add(vtkCylinderSource.New());\n         geometricObjectSources.Add(vtkDiskSource.New());\n         geometricObjectSources.Add(vtkLineSource.New());\n         geometricObjectSources.Add(vtkRegularPolygonSource.New());\n         geometricObjectSources.Add(vtkSphereSource.New());\n         geometricObjectSources.Add(vtkEarthSource.New());\n\n         List<vtkRenderer> renderers = new List<vtkRenderer>();\n         List<vtkPolyDataMapper> mappers = new List<vtkPolyDataMapper>();\n         List<vtkActor> actors = new List<vtkActor>();\n         List<vtkTextMapper> textMappers = new List<vtkTextMapper>();\n         List<vtkActor2D> textActors = new List<vtkActor2D>();\n\n         // Create one text property for all\n         vtkTextProperty textProperty = vtkTextProperty.New();\n         textProperty.SetFontSize(18);\n         textProperty.SetJustificationToCentered();\n\n         // Create a source, renderer, mapper, and actor\n         // for each object \n         for(int i = 0; i < geometricObjectSources.Count; i++) {\n            geometricObjectSources[i].Update();\n            mappers.Add(vtkPolyDataMapper.New());\n            mappers[i].SetInputConnection(geometricObjectSources[i].GetOutputPort());\n\n            actors.Add(vtkActor.New());\n            actors[i].SetMapper(mappers[i]);\n\n            textMappers.Add(vtkTextMapper.New());\n            textMappers[i].SetInput(geometricObjectSources[i].GetClassName());\n            textMappers[i].SetTextProperty(textProperty);\n\n            textActors.Add(vtkActor2D.New());\n            textActors[i].SetMapper(textMappers[i]);\n            textActors[i].SetPosition(rendererSize/2, 16);\n\n            renderers.Add(vtkRenderer.New());\n         }\n\n         // Need a renderer even if there is no actor\n         for(int i = geometricObjectSources.Count; i < gridDimensions * gridDimensions; i++) {\n            renderers.Add(vtkRenderer.New());\n         }\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         renderWindow.SetSize(rendererSize*gridDimensions, rendererSize*gridDimensions);\n\n         for(int row = 0; row < gridDimensions; row++) {\n            for(int col = 0; col < gridDimensions; col++) {\n               int index = row * gridDimensions + col;\n\n               // (xmin, ymin, xmax, ymax)\n               double[] viewport = new double[] {\n                  (col) * rendererSize / (double)(gridDimensions * rendererSize),\n                  (gridDimensions - (row+1)) * rendererSize / (double)(gridDimensions * rendererSize),\n                  (col+1)*rendererSize / (double)(gridDimensions * rendererSize),\n                  (gridDimensions - row) * rendererSize / (double)(gridDimensions * rendererSize)};\n\n               Debug.WriteLine(viewport[0] + \" \" + viewport[1] + \" \" + viewport[2] + \" \" + viewport[3]);\n               renderWindow.AddRenderer(renderers[index]);\n               IntPtr pViewport = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double))*4);\n               Marshal.Copy(viewport, 0, pViewport, 4);\n               renderers[index].SetViewport(pViewport);\n               Marshal.FreeHGlobal(pViewport);\n               if(index > geometricObjectSources.Count - 1)\n                  continue;\n\n               renderers[index].AddActor(actors[index]);\n               renderers[index].AddActor(textActors[index]);\n               renderers[index].SetBackground(.2 + rnd.NextDouble() / 8, .3 + rnd.NextDouble() / 8, .4 + rnd.NextDouble() / 8);\n            }\n         }\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Hexahedron/","title":"Hexahedron","text":"

        vtk-examples/CSharp/GeometricObjects/Hexahedron

        "},{"location":"CSharp/GeometricObjects/Hexahedron/#description","title":"Description","text":"

        This example creates eight points and creates a hexahedron from the points. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Hexahedron/#code","title":"Code","text":"

        Hexahedron.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Hexahedron();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Hexahedron() {\n         // Setup the coordinates of eight points \n         // (faces must be in counter clockwise order as viewed from the outside)\n         double[,] p = new double[,] { \n            { 0.0, 0.0, 0.0 }, \n            { 1.0, 0.0, 0.0 },\n            { 1.0, 1.0, 0.0 },\n            { 0.0, 1.0, 0.0 },\n            { 0.0, 0.0, 1.0 },\n            { 1.0, 0.0, 1.0 },\n            { 1.0, 1.0, 1.0 },\n            { 0.0, 1.0, 1.0 }\n         };\n\n         // Create the points\n         vtkPoints points = vtkPoints.New();\n         for(int i = 0; i < 8; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n         // Create a hexahedron from the points\n         vtkHexahedron hex = vtkHexahedron.New();\n         for(int i = 0; i < 8; i++)\n            hex.GetPointIds().SetId(i, i);\n\n         // Add the hexahedron to a cell array\n         vtkCellArray hexs = vtkCellArray.New();\n         hexs.InsertNextCell(hex);\n\n         // Add the points and hexahedron to an unstructured grid\n         vtkUnstructuredGrid uGrid = vtkUnstructuredGrid.New();\n         uGrid.SetPoints(points);\n         uGrid.InsertNextCell(hex.GetCellType(), hex.GetPointIds());\n\n         // Visualize\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInput(uGrid);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetLineWidth(4);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Line/","title":"Line","text":"

        vtk-examples/CSharp/GeometricObjects/Line

        "},{"location":"CSharp/GeometricObjects/Line/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Line/#code","title":"Code","text":"

        Line.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Line();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Line() {\n         // Create a line.  \n         vtkLineSource lineSource = vtkLineSource.New();\n         // Create two points, P0 and P1\n         double[] p0 = new double[] { 1.0, 0.0, 0.0 };\n         double[] p1 = new double[] { 0.0, 1.0, 0.0 };\n\n         lineSource.SetPoint1(p0[0], p0[1], p0[2]);\n         lineSource.SetPoint2(p1[0], p1[1], p1[2]);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(lineSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetLineWidth(4);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/LongLine/","title":"LongLine","text":"

        vtk-examples/CSharp/GeometricObjects/LongLine

        "},{"location":"CSharp/GeometricObjects/LongLine/#description","title":"Description","text":"

        Connect several points with a line. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/LongLine/#code","title":"Code","text":"

        LongLine.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            LongLine();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void LongLine() {\n         // Create five points \n         double[,] p = new double[,] { \n            { 0.0, 0.0, 0.0 }, \n            { 1.0, 0.0, 0.0 },\n            { 0.0, 1.0, 0.0 },\n            { 0.0, 1.0, 2.0 },\n            { 1.0, 2.0, 3.0 }\n         };\n\n         // Create a vtkPoints object and store the points in it\n         vtkPoints points = vtkPoints.New();\n         for(int i = 0; i < 5; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n         // Create a cell array to store the lines in and add the lines to it\n         vtkCellArray lines = vtkCellArray.New();\n\n         for(int i = 0; i < 4; i++) {\n            vtkLine line = vtkLine.New();\n            line.GetPointIds().SetId(0, i);\n            line.GetPointIds().SetId(1, i + 1);\n            lines.InsertNextCell(line);\n         }\n\n         // Create a polydata to store everything in\n         vtkPolyData linesPolyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         linesPolyData.SetPoints(points);\n\n         // Add the lines to the dataset\n         linesPolyData.SetLines(lines);\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(linesPolyData);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetLineWidth(4);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/OrientedArrow/","title":"OrientedArrow","text":"

        vtk-examples/CSharp/GeometricObjects/OrientedArrow

        "},{"location":"CSharp/GeometricObjects/OrientedArrow/#description","title":"Description","text":"

        This example illustrates how to create and display an arrow that passes through two points.

        It demonstrates two different ways to apply the transform:

        "},{"location":"CSharp/GeometricObjects/OrientedArrow/#use-vtktransformpolydatafilterhttpswwwvtkorgdocnightlyhtmlclassvtktransformpolydatafilterhtmldetails-to-create-a-new-transformed-polydata-this-method-is-useful-if-the-transformed-polydata-is-needed-later-in-the-pipeline-eg-vtkglyph3dfilter","title":"Use [vtkTransformPolyDataFilter](https://www.vtk.org/doc/nightly/html/classvtkTransformPolyDataFilter.html#details) to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter.","text":""},{"location":"CSharp/GeometricObjects/OrientedArrow/#apply-the-transform-directly-to-the-actor-using-vtkprop3dhttpswwwvtkorgdocnightlyhtmlclassvtkprop3dhtmldetailss-setusermatrix-no-new-data-is-produced","title":"Apply the transform directly to the actor using [vtkProp3D](https://www.vtk.org/doc/nightly/html/classvtkProp3D.html#details)'s SetUserMatrix. No new data is produced.","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/OrientedArrow/#code","title":"Code","text":"

        OrientedArrow.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            OrientedArrow();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void OrientedArrow() {\n         //Create an arrow.\n         vtkArrowSource arrowSource = vtkArrowSource.New();\n\n         // Generate a random start and end point\n         vtkMath.RandomSeed(8775070);\n         double[] startPoint = new double[]{\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10)\n         };\n\n         double[] endPoint = new double[]{\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10)\n         };\n\n         // Compute a basis\n         double[] normalizedX = new double[3];\n         double[] normalizedY = new double[3];\n         double[] normalizedZ = new double[3];\n\n         // The X axis is a vector from start to end\n         myMath.Subtract(endPoint, startPoint, ref normalizedX);\n         double length = myMath.Norm(normalizedX);\n         myMath.Normalize(ref normalizedX);\n\n         // The Z axis is an arbitrary vector cross X\n         double[] arbitrary = new double[]{\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10),\n            vtkMath.Random(-10,10)\n         };\n         myMath.Cross(normalizedX, arbitrary, ref normalizedZ);\n         myMath.Normalize(ref normalizedZ);\n         // The Y axis is Z cross X\n         myMath.Cross(normalizedZ, normalizedX, ref normalizedY);\n         vtkMatrix4x4 matrix = vtkMatrix4x4.New();\n\n         // Create the direction cosine matrix\n         matrix.Identity();\n         for(int i = 0; i < 3; i++) {\n            matrix.SetElement(i, 0, normalizedX[i]);\n            matrix.SetElement(i, 1, normalizedY[i]);\n            matrix.SetElement(i, 2, normalizedZ[i]);\n         }\n\n         // Apply the transforms\n         vtkTransform transform = vtkTransform.New();\n         transform.Translate(startPoint[0], startPoint[1], startPoint[2]);\n         transform.Concatenate(matrix);\n         transform.Scale(length, length, length);\n\n\n         //Create a mapper and actor for the arrow\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         vtkActor actor = vtkActor.New();\n#if USER_MATRIX\n         mapper.SetInputConnection(arrowSource.GetOutputPort());\n         actor.SetUserMatrix(transform.GetMatrix());\n#else\n         // Transform the polydata\n         vtkTransformPolyDataFilter transformPD = vtkTransformPolyDataFilter.New();\n         transformPD.SetTransform(transform);\n         transformPD.SetInputConnection(arrowSource.GetOutputPort());\n         mapper.SetInputConnection(transformPD.GetOutputPort());\n#endif\n         actor.SetMapper(mapper);\n\n         // Create spheres for start and end point\n         vtkSphereSource sphereStartSource = vtkSphereSource.New();\n         sphereStartSource.SetCenter(startPoint[0], startPoint[1], startPoint[2]);\n         vtkPolyDataMapper sphereStartMapper = vtkPolyDataMapper.New();\n         sphereStartMapper.SetInputConnection(sphereStartSource.GetOutputPort());\n         vtkActor sphereStart = vtkActor.New();\n         sphereStart.SetMapper(sphereStartMapper);\n         sphereStart.GetProperty().SetColor(1.0, 1.0, .3);\n\n         vtkSphereSource sphereEndSource = vtkSphereSource.New();\n         sphereEndSource.SetCenter(endPoint[0], endPoint[1], endPoint[2]);\n         vtkPolyDataMapper sphereEndMapper = vtkPolyDataMapper.New();\n         sphereEndMapper.SetInputConnection(sphereEndSource.GetOutputPort());\n         vtkActor sphereEnd = vtkActor.New();\n         sphereEnd.SetMapper(sphereEndMapper);\n         sphereEnd.GetProperty().SetColor(1.0, .3, .3);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.AddActor(sphereStart);\n         renderer.AddActor(sphereEnd);\n         renderer.ResetCamera();\n      }\n   }\n\n\n   // I'm using my own math class\n   // reason: due to the fact that ActiViz wraps native, unmanaged functions in class vtkMath\n   // many of the arguments like double arrays (for vector definition) has to be passed by an IntPtr.\n   //\n   // But there do exist some managed open source math libraries of professional quality, that it\n   // should be not a problem at all using another math library for vector algebra.\n   //   \n   // vtkmath could be used for vetor algebra, no doubt, but then functions which heavily relies on \n   // vector algebra like dot or cross product, etc. would be full of Marshaling code.\n\n   public class myMath {\n      public static void Subtract(double[] a, double[] b, ref double[] c) {\n         c[0] = a[0] - b[0];\n         c[1] = a[1] - b[1];\n         c[2] = a[2] - b[2];\n      }\n\n\n      public static double Norm(double[] x) {\n         return Math.Sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);\n      }\n\n\n      public static void Normalize(ref double[] x) {\n         double length = Norm(x);\n         x[0] /= length;\n         x[1] /= length;\n         x[2] /= length;\n      }\n\n      public static void Cross(double[] x, double[] y, ref double[] z) {\n         z[0] = ( x[1] * y[2] ) - ( x[2] * y[1] );\n         z[1] = ( x[2] * y[0] ) - ( x[0] * y[2] );\n         z[2] = ( x[0] * y[1] ) - ( x[1] * y[0] );\n      }\n   }\n\n}\n
        "},{"location":"CSharp/GeometricObjects/ParametricObjects/","title":"ParametricObjects","text":"

        vtk-examples/CSharp/GeometricObjects/ParametricObjects

        "},{"location":"CSharp/GeometricObjects/ParametricObjects/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/ParametricObjects/#code","title":"Code","text":"

        ParametricObjects.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ParametricObjects();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ParametricObjects() {\n         // Select one of the following (matching the selection above)\n         vtkParametricTorus parametricObject = vtkParametricTorus.New();\n         //vtkParametricBoy parametricObject = vtkParametricBoy.New();\n         //vtkParametricConicSpiral parametricObject = vtkParametricConicSpiral.New();\n         //vtkParametricCrossCap parametricObject = vtkParametricCrossCap.New();\n         //vtkParametricDini parametricObject = vtkParametricDini.New();\n         //vtkParametricEllipsoid parametricObject = vtkParametricEllipsoid.New();\n         //vtkParametricEnneper parametricObject = vtkParametricEnneper.New();\n         //vtkParametricFigure8Klein parametricObject = vtkParametricFigure8Klein.New();\n         //vtkParametricKlein parametricObject = vtkParametricKlein.New();\n         //vtkParametricMobius parametricObject = vtkParametricMobius.New();\n         //vtkParametricRandomHills parametricObject = vtkParametricRandomHills.New();\n         //vtkParametricRoman parametricObject = vtkParametricRoman.New();\n         //vtkParametricSpline parametricObject = vtkParametricSpline.New();\n         //vtkParametricSuperEllipsoid parametricObject = vtkParametricSuperEllipsoid.New();\n         //vtkParametricSuperToroid parametricObject = vtkParametricSuperToroid.New();\n         //vtkParametricTorus parametricObject = vtkParametricTorus.New();\n\n\n         vtkParametricFunctionSource parametricFunctionSource = vtkParametricFunctionSource.New();\n         parametricFunctionSource.SetParametricFunction(parametricObject);\n         parametricFunctionSource.Update();\n\n         // Setup mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(parametricFunctionSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // Visualize\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/ParametricObjectsDemo/","title":"ParametricObjectsDemo","text":"

        vtk-examples/CSharp/GeometricObjects/ParametricObjectsDemo

        "},{"location":"CSharp/GeometricObjects/ParametricObjectsDemo/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/ParametricObjectsDemo/#code","title":"Code","text":"

        ParametricObjectsDemo.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ParametricObjectsDemo();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ParametricObjectsDemo() {\n         // we create a matrix of 4x4 renderer in our renderwindow\n         // each renderer can be interacted with independently from one another\n         int rendererSize = 189; // width per renderer\n         int gridDimensions = 4;\n         this.Size = new System.Drawing.Size(756, 756);\n         Random rnd = new Random(2);\n         List<vtkParametricFunction>  parametricObjects = new List<vtkParametricFunction>();\n         parametricObjects.Add(vtkParametricBoy.New());\n         parametricObjects.Add(vtkParametricConicSpiral.New());\n         parametricObjects.Add(vtkParametricCrossCap.New());\n         parametricObjects.Add(vtkParametricDini.New());\n         vtkParametricEllipsoid ellipsoid = vtkParametricEllipsoid.New();\n         ellipsoid.SetXRadius(0.5);\n         ellipsoid.SetYRadius(2.0);\n         parametricObjects.Add(ellipsoid);\n         parametricObjects.Add(vtkParametricEnneper.New());\n         parametricObjects.Add(vtkParametricFigure8Klein.New());\n         parametricObjects.Add(vtkParametricKlein.New());\n         parametricObjects.Add(vtkParametricMobius.New());\n         vtkParametricRandomHills randomHills = vtkParametricRandomHills.New();\n         randomHills.AllowRandomGenerationOff();\n         parametricObjects.Add(randomHills);\n         parametricObjects.Add(vtkParametricRoman.New());\n         vtkParametricSuperEllipsoid superEllipsoid = vtkParametricSuperEllipsoid.New();\n         superEllipsoid.SetN1(.50);\n         superEllipsoid.SetN2(.1);\n         parametricObjects.Add(superEllipsoid);\n         vtkParametricSuperToroid superToroid = vtkParametricSuperToroid.New();\n         superToroid.SetN1(0.2);\n         superToroid.SetN2(3.0);\n         parametricObjects.Add(superToroid);\n         parametricObjects.Add(vtkParametricTorus.New());\n\n         vtkParametricSpline spline = vtkParametricSpline.New();\n         vtkPoints inputPoints = vtkPoints.New();\n         vtkMath.RandomSeed(8775070);\n         for(int p = 0; p < 10; p++) {\n            double x = vtkMath.Random(0.0, 1.0);\n            double y = vtkMath.Random(0.0, 1.0);\n            double z = vtkMath.Random(0.0, 1.0);\n            inputPoints.InsertNextPoint(x, y, z);\n         }\n         spline.SetPoints(inputPoints);\n\n         parametricObjects.Add(spline);\n\n\n         List<vtkParametricFunctionSource> parametricFunctionSources = new List<vtkParametricFunctionSource>();\n         List<vtkRenderer> renderers = new List<vtkRenderer>();\n         List<vtkPolyDataMapper> mappers = new List<vtkPolyDataMapper>();\n         List<vtkActor> actors = new List<vtkActor>();\n         List<vtkTextMapper> textMappers = new List<vtkTextMapper>();\n         List<vtkActor2D> textActors = new List<vtkActor2D>();\n\n         // Create one text property for all\n         vtkTextProperty textProperty = vtkTextProperty.New();\n         textProperty.SetFontSize(12);\n         textProperty.SetJustificationToCentered();\n\n         // Create a source, renderer, mapper, and actor\n         // for each object \n         for(int i = 0; i < parametricObjects.Count; i++) {\n            parametricFunctionSources.Add(vtkParametricFunctionSource.New());\n            parametricFunctionSources[i].SetParametricFunction(parametricObjects[i]);\n            parametricFunctionSources[i].Update();\n            mappers.Add(vtkPolyDataMapper.New());\n            mappers[i].SetInputConnection(parametricFunctionSources[i].GetOutputPort());\n\n            actors.Add(vtkActor.New());\n            actors[i].SetMapper(mappers[i]);\n\n            textMappers.Add(vtkTextMapper.New());\n            textMappers[i].SetInput(parametricObjects[i].GetClassName());\n            textMappers[i].SetTextProperty(textProperty);\n\n            textActors.Add(vtkActor2D.New());\n            textActors[i].SetMapper(textMappers[i]);\n            textActors[i].SetPosition(rendererSize / 2, 16);\n\n            renderers.Add(vtkRenderer.New());\n         }\n\n         // Need a renderer even if there is no actor\n         for(int i = parametricObjects.Count; i < gridDimensions * gridDimensions; i++) {\n            renderers.Add(vtkRenderer.New());\n         }\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         renderWindow.SetSize(rendererSize * gridDimensions, rendererSize * gridDimensions);\n\n         for(int row = 0; row < gridDimensions; row++) {\n            for(int col = 0; col < gridDimensions; col++) {\n               int index = row * gridDimensions + col;\n\n               // (xmin, ymin, xmax, ymax)\n               double[] viewport = new double[] {\n                  (col) * rendererSize / (double)(gridDimensions * rendererSize),\n                  (gridDimensions - (row+1)) * rendererSize / (double)(gridDimensions * rendererSize),\n                  (col+1)*rendererSize / (double)(gridDimensions * rendererSize),\n                  (gridDimensions - row) * rendererSize / (double)(gridDimensions * rendererSize)};\n\n               //Debug.WriteLine(viewport[0] + \" \" + viewport[1] + \" \" + viewport[2] + \" \" + viewport[3]);\n               renderWindow.AddRenderer(renderers[index]);\n               IntPtr pViewport = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 4);\n               Marshal.Copy(viewport, 0, pViewport, 4);\n               renderers[index].SetViewport(pViewport);\n               Marshal.FreeHGlobal(pViewport);\n               if(index > parametricObjects.Count - 1)\n                  continue;\n\n               renderers[index].AddActor(actors[index]);\n               renderers[index].AddActor(textActors[index]);\n               renderers[index].SetBackground(.2 + rnd.NextDouble() / 8, .3 + rnd.NextDouble() / 8, .4 + rnd.NextDouble() / 8);\n               renderers[index].ResetCamera();\n               renderers[index].GetActiveCamera().Azimuth(30);\n               renderers[index].GetActiveCamera().Elevation(-50);\n               renderers[index].GetActiveCamera().Pitch(-2);\n               renderers[index].ResetCameraClippingRange();\n            }\n         }\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Plane/","title":"Plane","text":"

        vtk-examples/CSharp/GeometricObjects/Plane

        "},{"location":"CSharp/GeometricObjects/Plane/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Plane/#code","title":"Code","text":"

        Plane.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Plane();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Plane() {\n         // Create a plane\n         vtkPlaneSource planeSource = vtkPlaneSource.New();\n         planeSource.SetCenter(1.0, 0.0, 0.0);\n         planeSource.SetNormal(1.0, 0.0, 1.0);\n         planeSource.Update();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(planeSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetLineWidth(4);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Planes/","title":"Planes","text":"

        vtk-examples/CSharp/GeometricObjects/Planes

        "},{"location":"CSharp/GeometricObjects/Planes/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Planes/#code","title":"Code","text":"

        Planes.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Planes();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Planes() {\n         // in this example we need the renderer first to retrieve the active camera\n         // in order to get camera's frustum planes and renderer's aspectratio\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = vtkRenderer.New();\n         renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         vtkCamera camera = renderer.GetActiveCamera();\n         double[] aspect = renderer.GetAspect();\n         double aspectRatio = aspect[0] / aspect[1];\n\n         vtkPlanes planes = vtkPlanes.New();\n         // one way\n         {\n            // allocate memory for 24 unmanaged doubles\n            int size = Marshal.SizeOf(typeof(double)) * 24;\n            IntPtr ptr = Marshal.AllocHGlobal(size);\n            camera.GetFrustumPlanes(aspectRatio, ptr);\n            // in case we would need this values diectly we could copy \n            // the unmanaged double array to a managed array like so:\n\n            // double[] planesArray = new double[24];\n            // Marshal.Copy(ptr, planesArray, 0, 24);\n\n            // but fortunately we can forward the IntPtr directly to the function \n            // SetFrustumPlanes()\n            planes.SetFrustumPlanes(ptr);\n            // free unmanaged memory\n            Marshal.FreeHGlobal(ptr);\n         }\n         // another way\n         {\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.Update();\n            double[] bounds = new double[6];\n            bounds = sphereSource.GetOutput().GetBounds();\n            planes.SetBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);\n         }\n         // nothing to visualize\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/PlanesIntersection/","title":"PlanesIntersection","text":"

        vtk-examples/CSharp/GeometricObjects/PlanesIntersection

        "},{"location":"CSharp/GeometricObjects/PlanesIntersection/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/PlanesIntersection/#code","title":"Code","text":"

        PlanesIntersection.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            PlanesIntersection();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void PlanesIntersection() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         double[] bounds = new double[6];\n         bounds = sphereSource.GetOutput().GetBounds();\n\n         vtkPoints box = vtkPoints.New();\n\n         box.SetNumberOfPoints(8);\n\n         double xMin, xMax, yMin, yMax, zMin, zMax;\n         xMin = bounds[0]; xMax = bounds[1];\n         yMin = bounds[2]; yMax = bounds[3];\n         zMin = bounds[4]; zMax = bounds[5];\n\n         box.SetPoint(0, xMax, yMin, zMax);\n         box.SetPoint(1, xMax, yMin, zMin);\n         box.SetPoint(2, xMax, yMax, zMin);\n         box.SetPoint(3, xMax, yMax, zMax);\n         box.SetPoint(4, xMin, yMin, zMax);\n         box.SetPoint(5, xMin, yMin, zMin);\n         box.SetPoint(6, xMin, yMax, zMin);\n         box.SetPoint(7, xMin, yMax, zMax);\n\n         vtkPlanesIntersection planesIntersection = vtkPlanesIntersection.New();\n         planesIntersection.SetBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);\n         int intersects = planesIntersection.IntersectsRegion(box);\n         Debug.WriteLine(\"Intersects? \" + ( ( intersects == 1 ) ? true : false ).ToString());\n         // nothing to visualize\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/PlatonicSolid/","title":"PlatonicSolid","text":"

        vtk-examples/CSharp/GeometricObjects/PlatonicSolid

        "},{"location":"CSharp/GeometricObjects/PlatonicSolid/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/PlatonicSolid/#code","title":"Code","text":"

        PlatonicSolid.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            PlatonicSolid();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void PlatonicSolid() {\n         vtkPlatonicSolidSource platonicSolidSource = vtkPlatonicSolidSource.New();\n         platonicSolidSource.SetSolidTypeToOctahedron();\n\n         // Each face has a different cell scalar\n         vtkLookupTable lut = vtkLookupTable.New();\n         lut.SetNumberOfTableValues(8);\n         lut.SetTableRange(0.0, 7.0);\n         lut.Build();\n         lut.SetTableValue(0, 0, 0, 0, 1);\n         lut.SetTableValue(1, 0, 0, 1, 1);\n         lut.SetTableValue(2, 0, 1, 0, 1);\n         lut.SetTableValue(3, 0, 1, 1, 1);\n         lut.SetTableValue(4, 1, 0, 0, 1);\n         lut.SetTableValue(5, 1, 0, 1, 1);\n         lut.SetTableValue(6, 1, 1, 0, 1);\n         lut.SetTableValue(7, 1, 1, 1, 1);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(platonicSolidSource.GetOutputPort());\n         mapper.SetLookupTable(lut);\n         mapper.SetScalarRange(0, 7);\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Point/","title":"Point","text":"

        vtk-examples/CSharp/GeometricObjects/Point

        "},{"location":"CSharp/GeometricObjects/Point/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Point/#code","title":"Code","text":"

        Point.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Point();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Point() {\n         // Create the geometry of the points (the coordinate)\n         vtkPoints points = vtkPoints.New();\n         double[,] p = new double[,] {\n            {1.0, 2.0, 3.0}, \n            {3.0, 1.0, 2.0}, \n            {2.0, 3.0, 1.0}\n         };\n\n         // Create topology of the points (a vertex per point)\n         vtkCellArray vertices = vtkCellArray.New();\n         int nPts = 3;\n\n         int[] ids = new int[nPts];\n         for(int i = 0; i < nPts; i++)\n            ids[i] = points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n         int size = Marshal.SizeOf(typeof(int)) * nPts;\n         IntPtr pIds = Marshal.AllocHGlobal(size);\n         Marshal.Copy(ids, 0, pIds, nPts);\n         vertices.InsertNextCell(nPts, pIds);\n         Marshal.FreeHGlobal(pIds);\n\n         // Create a polydata object\n         vtkPolyData pointPoly = vtkPolyData.New();\n\n         // Set the points and vertices we created as the geometry and topology of the polydata\n         pointPoly.SetPoints(points);\n         pointPoly.SetVerts(vertices);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(pointPoly);\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetPointSize(20);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.3, 0.2, 0.1);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/PolyLine/","title":"PolyLine","text":"

        vtk-examples/CSharp/GeometricObjects/PolyLine

        "},{"location":"CSharp/GeometricObjects/PolyLine/#description","title":"Description","text":"

        This example demonstrates how to make a line through several ordered points. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/PolyLine/#code","title":"Code","text":"

        PolyLine.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            PolyLine();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void PolyLine() {\n         // Create five points\n         double[,] p = new double[,] { \n            { 0.0, 0.0, 0.0 }, \n            { 1.0, 0.0, 0.0 },\n            { 0.0, 1.0, 0.0 },\n            { 0.0, 1.0, 2.0 },\n            { 0.0, 3.0, 3.0 }\n         };\n\n         // Create the points\n         vtkPoints points = vtkPoints.New();\n         for(int i = 0; i < 5; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n\n         vtkPolyLine polyLine = vtkPolyLine.New();\n         polyLine.GetPointIds().SetNumberOfIds(5);\n         for(int i = 0; i < 5; i++)\n            polyLine.GetPointIds().SetId(i, i);\n\n         // Create a cell array to store the lines in and add the lines to it\n         vtkCellArray cells = vtkCellArray.New();\n         cells.InsertNextCell(polyLine);\n\n         // Create a polydata to store everything in\n         vtkPolyData polyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         polyData.SetPoints(points);\n\n         // Add the lines to the dataset\n         polyData.SetLines(cells);\n         //Create an actor and mapper\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(polyData);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Polygon/","title":"Polygon","text":"

        vtk-examples/CSharp/GeometricObjects/Polygon

        "},{"location":"CSharp/GeometricObjects/Polygon/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Polygon/#code","title":"Code","text":"

        Polygon.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Polygon();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Polygon() {\n         // Setup four points\n         vtkPoints points = vtkPoints.New();\n         double c = Math.Cos(Math.PI / 6); // helper variable\n\n         points.InsertNextPoint(0.0, -1.0, 0.0);\n         points.InsertNextPoint(c, -0.5, 0.0);\n         points.InsertNextPoint(c, 0.5, 0.0);\n         points.InsertNextPoint(0.0, 1.0, 0.0);\n         points.InsertNextPoint(-c, 0.5, 0.0);\n         points.InsertNextPoint(-c, -0.5, 0.0);\n\n         // Create the polygon\n         vtkPolygon polygon = vtkPolygon.New();\n         polygon.GetPointIds().SetNumberOfIds(6); //make a six-sided figure\n         polygon.GetPointIds().SetId(0, 0);\n         polygon.GetPointIds().SetId(1, 1);\n         polygon.GetPointIds().SetId(2, 2);\n         polygon.GetPointIds().SetId(3, 3);\n         polygon.GetPointIds().SetId(4, 4);\n         polygon.GetPointIds().SetId(5, 5);\n\n         // Add the polygon to a list of polygons\n         vtkCellArray polygons = vtkCellArray.New();\n         polygons.InsertNextCell(polygon);\n\n         // Create a PolyData\n         vtkPolyData polygonPolyData = vtkPolyData.New();\n         polygonPolyData.SetPoints(points);\n         polygonPolyData.SetPolys(polygons);\n\n         // Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(polygonPolyData);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/PolygonIntersection/","title":"PolygonIntersection","text":"

        vtk-examples/CSharp/GeometricObjects/PolygonIntersection

        "},{"location":"CSharp/GeometricObjects/PolygonIntersection/#description","title":"Description","text":"

        Calculates the intersection of a polygon and a line. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/PolygonIntersection/#code","title":"Code","text":"

        PolygonIntersection.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            PolygonIntersection();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void PolygonIntersection() {\n         // Create a square in the XY plane\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0.0, 0.0, 0.0);\n         points.InsertNextPoint(1.0, 0.0, 0.0);\n         points.InsertNextPoint(1.0, 1.0, 0.0);\n         points.InsertNextPoint(0.0, 1.0, 0.0);\n\n         // Create the polygon\n         vtkPolygon polygon = vtkPolygon.New();\n         polygon.GetPoints().DeepCopy(points);\n         polygon.GetPointIds().SetNumberOfIds(4); // 4 corners of the square\n         polygon.GetPointIds().SetId(0, 0);\n         polygon.GetPointIds().SetId(1, 1);\n         polygon.GetPointIds().SetId(2, 2);\n         polygon.GetPointIds().SetId(3, 3);\n\n         // our line to intersect the polygon with\n         double[] p1 = new double[] { 0.1, 0, -1.0 };\n         double[] p2 = new double[] { 0.1, 0, 1.0 };\n         double tolerance = 0.001;\n         // Outputs\n         // t must be initalized cause it is passed by reference (that's a c# convention)\n         double t = 0.0; // Parametric coordinate of intersection (0 (corresponding to p1) to 1 (corresponding to p2))\n         double[] x = new double[] { 0.0, 0.0, 0.0 };\n         double[] coords = new double[] { 0.0, 0.0, 0.0 };\n         // subId must be initialized cause it is passed by reference (that's a c# convention)\n         int subId = 0;\n\n         IntPtr pP1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n         IntPtr pP2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n         IntPtr pX = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n         IntPtr pCoords = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n         Marshal.Copy(p1, 0, pP1, 3);\n         Marshal.Copy(p2, 0, pP2, 3);\n         // next two lines are not necessarely needed, but I prefer to initialize ref parameter (in those a result is passed back)\n         Marshal.Copy(x, 0, pX, 3);\n         Marshal.Copy(coords, 0, pCoords, 3);\n         // see vtkCell API for a detailed description of this function\n         int iD = polygon.IntersectWithLine(pP1, pP2, tolerance, ref t, pX, pCoords, ref subId);\n         // Copy result back to our managed arrays\n         Marshal.Copy(pX, x, 0, 3);\n         Marshal.Copy(pCoords, coords, 0, 3);\n         Console.WriteLine(\"intersected? \" + iD); ;\n         Console.WriteLine(\"intersection: \" + x[0] + \" \" + x[1] + \" \" + x[2]);\n         Marshal.FreeHGlobal(pP1);\n         Marshal.FreeHGlobal(pP2);\n         Marshal.FreeHGlobal(pX);\n         Marshal.FreeHGlobal(pCoords);\n         // nothing to visualize\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Pyramid/","title":"Pyramid","text":"

        vtk-examples/CSharp/GeometricObjects/Pyramid

        "},{"location":"CSharp/GeometricObjects/Pyramid/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Pyramid/#code","title":"Code","text":"

        Pyramid.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Pyramid();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Pyramid() {\n         vtkPoints points = vtkPoints.New();\n         double[,] p = new double[,] {\n            { 1.0,  1.0, 1.0 },\n            {-1.0,  1.0, 1.0 },\n            {-1.0, -1.0, 1.0 },\n            { 1.0, -1.0, 1.0 },\n            { 0.0,  0.0, 0.0 }};\n\n         for(int i = 0; i < 5; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n         vtkPyramid pyramid = vtkPyramid.New();\n         for(int i = 0; i < 5; i++)\n            pyramid.GetPointIds().SetId(i, i);\n\n         vtkCellArray cells = vtkCellArray.New();\n         cells.InsertNextCell(pyramid);\n\n         vtkUnstructuredGrid ug = vtkUnstructuredGrid.New();\n         ug.SetPoints(points);\n         ug.InsertNextCell(pyramid.GetCellType(), pyramid.GetPointIds());\n\n         //Create an actor and mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInput(ug);\n         vtkActor actor = vtkActor.New();\n         actor.RotateX(105.0);\n         actor.RotateZ(-36.0);\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Quad/","title":"Quad","text":"

        vtk-examples/CSharp/GeometricObjects/Quad

        "},{"location":"CSharp/GeometricObjects/Quad/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Quad/#code","title":"Code","text":"

        Quad.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Quad();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Quad() {\n         double[,] p = new double[,] { \n            { 0.0, 0.0, 0.0 }, \n            { 1.0, 0.0, 0.0 },\n            { 1.0, 1.0, 0.0 },\n            { 0.0, 1.0, 0.0 }\n         };\n\n         // Create the points\n         vtkPoints points = vtkPoints.New();\n         for(int i = 0; i < 4; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n\n         vtkQuad quad = vtkQuad.New();\n         quad.GetPointIds().SetNumberOfIds(4);\n         for(int i = 0; i < 4; i++)\n            quad.GetPointIds().SetId(i, i);\n\n         // Create a cell array to store the quad in and add the quad to it\n         vtkCellArray cells = vtkCellArray.New();\n         cells.InsertNextCell(quad);\n\n         // Create a polydata to store everything in\n         vtkPolyData polyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         polyData.SetPoints(points);\n\n         // Add the quad to the dataset\n         polyData.SetPolys(cells);\n\n         //Create an actor and mapper\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(polyData);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/RegularPolygonSource/","title":"RegularPolygonSource","text":"

        vtk-examples/CSharp/GeometricObjects/RegularPolygonSource

        "},{"location":"CSharp/GeometricObjects/RegularPolygonSource/#description","title":"Description","text":"

        This example creates a pentagon. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/RegularPolygonSource/#code","title":"Code","text":"

        RegularPolygonSource.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            RegularPolygon();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void RegularPolygon() {\n         // Create a pentagon\n         vtkRegularPolygonSource polygonSource = vtkRegularPolygonSource.New();\n\n         //polygonSource.GeneratePolygonOff();\n         polygonSource.SetNumberOfSides(5);\n         polygonSource.SetRadius(5);\n         polygonSource.SetCenter(0, 0, 0);\n         //polygonSource.Update(); // not necessary\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(polygonSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.GetProperty().SetLineWidth(4);\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Sphere/","title":"Sphere","text":"

        vtk-examples/CSharp/GeometricObjects/Sphere

        "},{"location":"CSharp/GeometricObjects/Sphere/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Sphere/#code","title":"Code","text":"

        Sphere.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Sphere();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Sphere() {\n         // Create a sphere.  \n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.SetRadius(0.5);\n         // a more smoother sphere\n         //sphereSource.SetPhiResolution(36);\n         //sphereSource.SetThetaResolution(36);\n\n         //not a complete sphere, only a spherical shell\n         //sphereSource.SetEndPhi(120);\n         //sphereSource.SetEndTheta(90);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(sphereSource.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.3, 0.2, 0.1);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Tetrahedron/","title":"Tetrahedron","text":"

        vtk-examples/CSharp/GeometricObjects/Tetrahedron

        "},{"location":"CSharp/GeometricObjects/Tetrahedron/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Tetrahedron/#code","title":"Code","text":"

        Tetrahedron.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Tetrahedron();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Tetrahedron() {\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0, 0, 0);\n         points.InsertNextPoint(1, 0, 0);\n         points.InsertNextPoint(1, 1, 0);\n         points.InsertNextPoint(0, 1, 1);\n         points.InsertNextPoint(5, 5, 5);\n         points.InsertNextPoint(6, 5, 5);\n         points.InsertNextPoint(6, 6, 5);\n         points.InsertNextPoint(5, 6, 6);\n\n         // Method 1\n         vtkUnstructuredGrid unstructuredGrid1 = vtkUnstructuredGrid.New();\n         unstructuredGrid1.SetPoints(points);\n\n         int[] ptIds = new int[] { 0, 1, 2, 3 };\n         IntPtr ptIdsPointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * 4);\n         Marshal.Copy(ptIds, 0, ptIdsPointer, 4);\n         unstructuredGrid1.InsertNextCell(10, 4, ptIdsPointer);\n         Marshal.FreeHGlobal(ptIdsPointer);\n\n         // Method 2\n         vtkUnstructuredGrid unstructuredGrid2 = vtkUnstructuredGrid.New();\n         unstructuredGrid2.SetPoints(points);\n\n         vtkTetra tetra = vtkTetra.New();\n\n         tetra.GetPointIds().SetId(0, 4);\n         tetra.GetPointIds().SetId(1, 5);\n         tetra.GetPointIds().SetId(2, 6);\n         tetra.GetPointIds().SetId(3, 7);\n\n         vtkCellArray cellArray = vtkCellArray.New();\n         cellArray.InsertNextCell(tetra);\n         unstructuredGrid2.SetCells(10, cellArray);\n\n         // Create a mapper and actor\n         vtkDataSetMapper mapper1 = vtkDataSetMapper.New();\n         mapper1.SetInputConnection(unstructuredGrid1.GetProducerPort());\n\n         vtkActor actor1 = vtkActor.New();\n         actor1.SetMapper(mapper1);\n\n         // Create a mapper and actor\n         vtkDataSetMapper mapper2 = vtkDataSetMapper.New();\n         mapper2.SetInputConnection(unstructuredGrid2.GetProducerPort());\n\n         vtkActor actor2 = vtkActor.New();\n         actor2.SetMapper(mapper2);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // Add the actor to the scene\n         renderer.AddActor(actor1);\n         renderer.AddActor(actor2);\n         renderer.SetBackground(.3, .6, .3); // Background color green\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Triangle/","title":"Triangle","text":"

        vtk-examples/CSharp/GeometricObjects/Triangle

        "},{"location":"CSharp/GeometricObjects/Triangle/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Triangle/#code","title":"Code","text":"

        Triangle.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Triangle();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Triangle() {\n         // Create a triangle\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(1.0, 0.0, 0.0);\n         points.InsertNextPoint(0.0, 0.0, 0.0);\n         points.InsertNextPoint(0.0, 1.0, 0.0);\n\n         vtkTriangle triangle = vtkTriangle.New();\n         triangle.GetPointIds().SetId(0, 0);\n         triangle.GetPointIds().SetId(1, 1);\n         triangle.GetPointIds().SetId(2, 2);\n\n         // Create a cell array to store the triangle in and add the triangle to it\n         vtkCellArray cells = vtkCellArray.New();\n         cells.InsertNextCell(triangle);\n\n         // Create a polydata to store everything in\n         vtkPolyData polyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         polyData.SetPoints(points);\n\n         // Add the quad to the dataset\n         polyData.SetPolys(cells);\n\n         //Create an actor and mapper\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInput(polyData);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/TriangleStrip/","title":"TriangleStrip","text":"

        vtk-examples/CSharp/GeometricObjects/TriangleStrip

        "},{"location":"CSharp/GeometricObjects/TriangleStrip/#description","title":"Description","text":"

        A triangle strip is a compact representation of a series of triangles. See this wikipedia article for an explanation. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/TriangleStrip/#code","title":"Code","text":"

        TriangleStrip.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            TriangleStrip();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void TriangleStrip() {\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0, 0, 0);\n         points.InsertNextPoint(0, 1, 0);\n         points.InsertNextPoint(1, 0, 0);\n         points.InsertNextPoint(1.5, 1, 0);\n\n         vtkTriangleStrip triangleStrip = vtkTriangleStrip.New();\n         triangleStrip.GetPointIds().SetNumberOfIds(4);\n         triangleStrip.GetPointIds().SetId(0, 0);\n         triangleStrip.GetPointIds().SetId(1, 1);\n         triangleStrip.GetPointIds().SetId(2, 2);\n         triangleStrip.GetPointIds().SetId(3, 3);\n\n         vtkCellArray cells = vtkCellArray.New();\n         cells.InsertNextCell(triangleStrip);\n         // Create a polydata to store everything in\n         vtkPolyData polyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         polyData.SetPoints(points);\n         // Add the strip to the dataset\n         polyData.SetStrips(cells);\n\n         //Create an actor and mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInput(polyData);\n         vtkActor actor = vtkActor.New();\n         actor.GetProperty().SetRepresentationToWireframe();\n\n         actor.SetMapper(mapper);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/GeometricObjects/Vertex/","title":"Vertex","text":"

        vtk-examples/CSharp/GeometricObjects/Vertex

        "},{"location":"CSharp/GeometricObjects/Vertex/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/GeometricObjects/Vertex/#code","title":"Code","text":"

        Vertex.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Vertex();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Vertex() {\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0, 0, 0);\n\n         vtkVertex vertex = vtkVertex.New();\n         vertex.GetPointIds().SetId(0, 0);\n\n         vtkCellArray vertices = vtkCellArray.New();\n         vertices.InsertNextCell(vertex);\n\n         vtkPolyData polydata = vtkPolyData.New();\n         polydata.SetPoints(points);\n         polydata.SetVerts(vertices);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(polydata.GetProducerPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetPointSize(10);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // Add the actor to the scene\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ConvertFile/","title":"ConvertFile","text":"

        vtk-examples/CSharp/IO/ConvertFile

        "},{"location":"CSharp/IO/ConvertFile/#description","title":"Description","text":"

        This example demonstrates how to read a file and then write it to a different type of file. In this example, we read a vtp file and write a ply file, but simply by changing the reader/writer classes instantiated, different behavior can be achieved.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ConvertFile/#code","title":"Code","text":"

        ConvertFile.cs

        using System;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid ConvertFile() {\n   string inputFileName = \"test.vtu\";\n   string outputFileName = \"test.ply\";\n\n   vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n   reader.SetFileName(inputFileName);\n   reader.Update();\n\n   vtkPLYWriter writer = vtkPLYWriter.New();\n   writer.SetFileName(outputFileName);\n   writer.SetInputConnection(reader.GetOutputPort());\n   writer.Update();\n}\n
        "},{"location":"CSharp/IO/DEMReader/","title":"DEMReader","text":"

        vtk-examples/CSharp/IO/DEMReader

        "},{"location":"CSharp/IO/DEMReader/#description","title":"Description","text":"

        Read DEM (elevation map) files A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/DEMReader/#code","title":"Code","text":"

        DEMReader.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadDEM();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadDEM() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\SainteHelens.dem\");\n\n         vtkDEMReader reader = vtkDEMReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         vtkLookupTable lut = vtkLookupTable.New();\n         lut.SetHueRange(0.6, 0);\n         lut.SetSaturationRange(1.0, 0);\n         lut.SetValueRange(0.5, 1.0);\n         double[] range = reader.GetOutput().GetScalarRange();\n         lut.SetTableRange(range[0], range[1]);\n\n         // Visualize\n         vtkImageMapToColors mapColors = vtkImageMapToColors.New();\n         mapColors.SetLookupTable(lut);\n         mapColors.SetInputConnection(reader.GetOutputPort());\n\n         // Create an actor\n         vtkImageActor actor = vtkImageActor.New();\n         actor.SetInput(mapColors.GetOutput());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/FindAllArrayNames/","title":"FindAllArrayNames","text":"

        vtk-examples/CSharp/IO/FindAllArrayNames

        "},{"location":"CSharp/IO/FindAllArrayNames/#description","title":"Description","text":"

        A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/FindAllArrayNames/#code","title":"Code","text":"

        FindAllArrayNames.cs

        using System;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         FindAllArrayNames(null);\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n     private static void FindAllArrayNames(string filePath) {\n         vtkPolyData polydata = vtkPolyData.New();\n\n         if(filePath == null) {\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.Update();\n            vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n            writer.SetFileName(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\testFindAllArrayNames.vtp\");\n            writer.SetInputConnection(sphereSource.GetOutputPort());\n            writer.Write();\n            polydata = sphereSource.GetOutput();\n         }\n         else {\n            vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n            reader.SetFileName(filePath);\n            reader.Update();\n            polydata = reader.GetOutput();\n         }\n         FindAllData(ref polydata);\n      }\n\n\n      private static void FindAllData(ref vtkPolyData polydata) {\n         Console.WriteLine(\"Normals: \" + polydata.GetPointData().GetNormals());\n\n         int numberOfPointArrays = polydata.GetPointData().GetNumberOfArrays();\n         Console.WriteLine(\"Number of PointData arrays: \" + numberOfPointArrays);\n\n         int numberOfCellArrays = polydata.GetCellData().GetNumberOfArrays();\n         Console.WriteLine(\"Number of CellData arrays: \" + numberOfCellArrays);\n\n         Console.WriteLine(\n            Environment.NewLine + \n            \"Type table/key: \" + \n            Environment.NewLine + \n            \"-------------------------\");\n         //more values can be found in <VTK_DIR>/Common/vtkSetGet.h\n\n         Console.WriteLine(3 + \" unsigned char\");\n         Console.WriteLine(7 + \" unsigned int\");\n         Console.WriteLine(10 + \" float\");\n         Console.WriteLine(11 + \" double\" + Environment.NewLine);\n\n         for(int i = 0; i < numberOfPointArrays; i++) {\n            // The following two lines are equivalent\n            //arrayNames.push_back(polydata.GetPointData().GetArray(i).GetName());\n            //arrayNames.push_back(polydata.GetPointData().GetArrayName(i));\n            int dataTypeID = polydata.GetPointData().GetArray(i).GetDataType();\n            string dataTypeAsString = polydata.GetPointData().GetArray(i).GetDataTypeAsString();\n            Console.WriteLine(\"Array \" + i + \": \" \n               + polydata.GetPointData().GetArrayName(i)\n               + \" (type: \" + dataTypeID + \")\"\n               + \" (type as string: \" + dataTypeAsString + \")\" + Environment.NewLine);\n         }\n\n         for(int i = 0; i < numberOfCellArrays; i++) {\n            // The following two lines are equivalent\n            //polydata.GetPointData().GetArray(i).GetName();\n            //polydata.GetPointData().GetArrayName(i);\n            int dataTypeID = polydata.GetCellData().GetArray(i).GetDataType();\n            string dataTypeAsString = polydata.GetPointData().GetArray(i).GetDataTypeAsString();\n            Console.WriteLine(\"Array \" + i + \": \"\n               + polydata.GetCellData().GetArrayName(i)\n               + \" (type: \" + dataTypeID + \")\"\n               + \" (type as string: \" + dataTypeAsString + \")\");\n         }\n      }\n    }\n}\n
        "},{"location":"CSharp/IO/ImageReader2Factory/","title":"ImageReader2Factory","text":"

        vtk-examples/CSharp/IO/ImageReader2Factory

        "},{"location":"CSharp/IO/ImageReader2Factory/#description","title":"Description","text":"

        This class tries to find an appropriate reader. It is very convenient to use this when you don't know what kind of file to expect. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ImageReader2Factory/#code","title":"Code","text":"

        ImageReader2Factory.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ImageReader2Factory();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ImageReader2Factory() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\foot\\foot.mha\");\n\n         vtkImageReader2 reader = vtkImageReader2Factory.CreateImageReader2(filePath);\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n         vtkImageActor actor = vtkImageActor.New();\n         actor.SetInputData(reader.GetOutput());\n\n         // Visualize\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/JPEGReader/","title":"JPEGReader","text":"

        vtk-examples/CSharp/IO/JPEGReader

        "},{"location":"CSharp/IO/JPEGReader/#description","title":"Description","text":"

        This example shows how to read a JPG image file. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/JPEGReader/#code","title":"Code","text":"

        JPEGReader.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadJPEG();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadJPEG() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\beach.jpg\");\n         //Read the image\n         vtkJPEGReader reader = vtkJPEGReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/JPEGWriter/","title":"JPEGWriter","text":"

        vtk-examples/CSharp/IO/JPEGWriter

        "},{"location":"CSharp/IO/JPEGWriter/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/JPEGWriter/#code","title":"Code","text":"

        JPEGWriter.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteJPEG();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteJPEG() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_jpeg.jpg\");\n         int[] extent = new int[] { 0, 99, 0, 99, 0, 0 };\n         vtkImageCanvasSource2D imageSource = vtkImageCanvasSource2D.New();\n         imageSource.SetExtent(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5]);\n         imageSource.SetScalarTypeToUnsignedChar();\n         imageSource.SetNumberOfScalarComponents(3);\n         imageSource.SetDrawColor(127, 45, 255);\n         imageSource.FillBox(0, 99, 0, 99);\n         imageSource.SetDrawColor(255, 255, 255);\n         imageSource.FillBox(40, 70, 20, 50);\n         imageSource.Update();\n\n         vtkImageCast castFilter = vtkImageCast.New();\n         castFilter.SetOutputScalarTypeToUnsignedChar();\n         castFilter.SetInputConnection(imageSource.GetOutputPort());\n         castFilter.Update();\n\n         vtkJPEGWriter writer = vtkJPEGWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInputConnection(castFilter.GetOutputPort());\n         writer.Write();\n         // Read and display file for verification that it was written correctly\n         vtkJPEGReader reader = vtkJPEGReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/MetaImageReader/","title":"MetaImageReader","text":"

        vtk-examples/CSharp/IO/MetaImageReader

        "},{"location":"CSharp/IO/MetaImageReader/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/MetaImageReader/#code","title":"Code","text":"

        MetaImageReader.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadMetaImage();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadMetaImage() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\foot\\foot.mha\");\n\n         vtkMetaImageReader reader = vtkMetaImageReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n         vtkImageActor actor = vtkImageActor.New();\n         actor.SetInput(reader.GetOutput());\n\n         // Visualize\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/MetaImageWriter/","title":"MetaImageWriter","text":"

        vtk-examples/CSharp/IO/MetaImageWriter

        "},{"location":"CSharp/IO/MetaImageWriter/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/MetaImageWriter/#code","title":"Code","text":"

        MetaImageWriter.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteMetaImage();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteMetaImage() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_mha.mhd\");\n         string filePathRaw = System.IO.Path.Combine(root, @\"Data\\test_mha.raw\");\n         // Create an image\n         vtkImageMandelbrotSource source = vtkImageMandelbrotSource.New();\n         source.Update();\n\n         vtkImageCast castFilter = vtkImageCast.New();\n         castFilter.SetOutputScalarTypeToUnsignedChar();\n         castFilter.SetInputConnection(source.GetOutputPort());\n         castFilter.Update();\n\n         vtkMetaImageWriter writer = vtkMetaImageWriter.New();\n         writer.SetInputConnection(castFilter.GetOutputPort());\n         writer.SetFileName(filePath);\n         writer.SetRAWFileName(filePathRaw);\n         writer.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkMetaImageReader reader = vtkMetaImageReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n         vtkImageActor actor = vtkImageActor.New();\n         actor.SetInput(reader.GetOutput());\n\n         // Visualize\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/PNGReader/","title":"PNGReader","text":"

        vtk-examples/CSharp/IO/PNGReader

        "},{"location":"CSharp/IO/PNGReader/#description","title":"Description","text":"

        This example demonstrates how to read a PNG image file. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/PNGReader/#code","title":"Code","text":"

        PNGReader.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPNG();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPNG() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\camscene.png\");\n         //Read the image\n         vtkPNGReader reader = vtkPNGReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ParticleReader/","title":"ParticleReader","text":"

        vtk-examples/CSharp/IO/ParticleReader

        "},{"location":"CSharp/IO/ParticleReader/#description","title":"Description","text":"

        This example reads ascii files where each line consists of points with its position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file format. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ParticleReader/#code","title":"Code","text":"

        ParticleReader.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ParticleReader();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ParticleReader() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\Particles.raw\");\n\n         // Read the file\n         vtkParticleReader reader = vtkParticleReader.New();\n         reader.SetFileName(filePath);\n         reader.SetDataByteOrderToBigEndian();\n         reader.Update();\n         Debug.WriteLine(\"NumberOfPieces: \" + reader.GetOutput().GetNumberOfPieces());\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n         mapper.SetScalarRange(4, 9);\n         mapper.SetPiece(1);\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetPointSize(4);\n         actor.GetProperty().SetColor(1, 0, 0);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadBMP/","title":"ReadBMP","text":"

        vtk-examples/CSharp/IO/ReadBMP

        "},{"location":"CSharp/IO/ReadBMP/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadBMP/#code","title":"Code","text":"

        ReadBMP.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadBMP();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadBMP() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\masonry.bmp\");\n         //Read the image\n         vtkBMPReader reader = vtkBMPReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadDICOMSeries/","title":"ReadDICOMSeries","text":"

        vtk-examples/CSharp/IO/ReadDICOMSeries

        "},{"location":"CSharp/IO/ReadDICOMSeries/#description","title":"Description","text":"

        This example demonstates how to read a series of DICOM images and how to scroll with the mousewheel or the up/down keys through all slices. Sample data are available as a zipped file (977 kB, 40 slices) here

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadDICOMSeries/#code","title":"Code","text":"

        ReadDICOMSeries.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n\n      // module wide accessible variables\n      vtkImageViewer2 _ImageViewer;\n      vtkTextMapper _SliceStatusMapper;\n      int _Slice;\n      int _MinSlice;\n      int _MaxSlice;\n\n\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadDICOMSeries();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n       private void ReadDICOMSeries() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         // Read all the DICOM files in the specified directory.\n         // Caution: folder \"DicomTestImages\" don't exists by default in the standard vtk data folder\n         // sample data are available at http://www.vtk.org/Wiki/images/1/12/VTK_Examples_StandardFormats_Input_DicomTestImages.zip\n         string folder = Path.Combine(root, @\"Data\\DicomTestImages\");\n         vtkDICOMImageReader reader = vtkDICOMImageReader.New();\n         reader.SetDirectoryName(folder);\n         reader.Update();\n         // Visualize\n         _ImageViewer = vtkImageViewer2.New();\n         _ImageViewer.SetInputConnection(reader.GetOutputPort());\n         // get range of slices (min is the first index, max is the last index)\n         _ImageViewer.GetSliceRange(ref _MinSlice, ref _MaxSlice);\n         Debug.WriteLine(\"slices range from : \" + _MinSlice.ToString() + \" to \" + _MaxSlice.ToString());\n\n         // slice status message\n         vtkTextProperty sliceTextProp = vtkTextProperty.New();\n         sliceTextProp.SetFontFamilyToCourier();\n         sliceTextProp.SetFontSize(20);\n         sliceTextProp.SetVerticalJustificationToBottom();\n         sliceTextProp.SetJustificationToLeft();\n\n         _SliceStatusMapper = vtkTextMapper.New();\n         _SliceStatusMapper.SetInput(\"Slice No \" + ( _Slice + 1 ).ToString() + \"/\" + ( _MaxSlice + 1 ).ToString());\n         _SliceStatusMapper.SetTextProperty(sliceTextProp);\n\n         vtkActor2D sliceStatusActor = vtkActor2D.New();\n         sliceStatusActor.SetMapper(_SliceStatusMapper);\n         sliceStatusActor.SetPosition(15, 10);\n\n         // usage hint message\n         vtkTextProperty usageTextProp = vtkTextProperty.New();\n         usageTextProp.SetFontFamilyToCourier();\n         usageTextProp.SetFontSize(14);\n         usageTextProp.SetVerticalJustificationToTop();\n         usageTextProp.SetJustificationToLeft();\n\n         vtkTextMapper usageTextMapper = vtkTextMapper.New();\n         usageTextMapper.SetInput(\"Slice with mouse wheel\\nor Up/Down-Key\");\n         usageTextMapper.SetTextProperty(usageTextProp);\n\n         vtkActor2D usageTextActor = vtkActor2D.New();\n         usageTextActor.SetMapper(usageTextMapper);\n         usageTextActor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n         usageTextActor.GetPositionCoordinate().SetValue(0.05, 0.95);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n\n         vtkInteractorStyleImage interactorStyle = vtkInteractorStyleImage.New();\n         interactorStyle.MouseWheelForwardEvt += new vtkObject.vtkObjectEventHandler(interactor_MouseWheelForwardEvt);\n         interactorStyle.MouseWheelBackwardEvt += new vtkObject.vtkObjectEventHandler(interactor_MouseWheelBackwardEvt);\n\n         renderWindow.GetInteractor().SetInteractorStyle(interactorStyle);\n         renderWindow.GetRenderers().InitTraversal();\n         vtkRenderer ren;\n         while(( ren = renderWindow.GetRenderers().GetNextItem() ) != null)\n            ren.SetBackground(0.0, 0.0, 0.0);\n\n         _ImageViewer.SetRenderWindow(renderWindow);\n         _ImageViewer.GetRenderer().AddActor2D(sliceStatusActor);\n         _ImageViewer.GetRenderer().AddActor2D(usageTextActor);\n         _ImageViewer.SetSlice(_MinSlice);\n         _ImageViewer.Render();\n      }\n\n\n      /// <summary>\n      /// move forward to next slice\n      /// </summary>\n      private void MoveForwardSlice() {\n         Debug.WriteLine(_Slice.ToString());\n         if(_Slice < _MaxSlice) {\n            _Slice += 1;\n            _ImageViewer.SetSlice(_Slice);\n            _SliceStatusMapper.SetInput(\"Slice No \" + ( _Slice + 1 ).ToString() + \"/\" + ( _MaxSlice + 1 ).ToString());\n            _ImageViewer.Render();\n         }\n      }\n\n\n      /// <summary>\n      /// move backward to next slice\n      /// </summary>\n      private void MoveBackwardSlice() {\n         Debug.WriteLine(_Slice.ToString());\n         if(_Slice > _MinSlice) {\n            _Slice -= 1;\n            _ImageViewer.SetSlice(_Slice);\n            _SliceStatusMapper.SetInput(\"Slice No \" + ( _Slice + 1 ).ToString() + \"/\" + ( _MaxSlice + 1 ).ToString());\n            _ImageViewer.Render();\n         }\n      }\n\n\n      /// <summary>\n      /// eventhanndler to process keyboard input\n      /// </summary>\n      /// <param name=\"msg\"></param>\n      /// <param name=\"keyData\"></param>\n      /// <returns></returns>\n      protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) {\n         //Debug.WriteLine(DateTime.Now + \":\" + msg.Msg + \", \" + keyData);\n         if(keyData == System.Windows.Forms.Keys.Up) {\n            MoveForwardSlice();\n            return true;\n         }\n         else if(keyData == System.Windows.Forms.Keys.Down) {\n            MoveBackwardSlice();\n            return true;\n         }\n         // don't forward the following keys\n         // add all keys which are not supposed to get forwarded\n         else if(\n               keyData == System.Windows.Forms.Keys.F\n            || keyData == System.Windows.Forms.Keys.L\n         ) {\n            return true;\n         }\n         return false;\n      }\n\n      /// <summary>\n      /// event handler for mousewheel forward event\n      /// </summary>\n      /// <param name=\"sender\"></param>\n      /// <param name=\"e\"></param>\n      void interactor_MouseWheelForwardEvt(vtkObject sender, vtkObjectEventArgs e) {\n         MoveForwardSlice();\n      }\n\n\n      /// <summary>\n      /// event handler for mousewheel backward event\n      /// </summary>\n      /// <param name=\"sender\"></param>\n      /// <param name=\"e\"></param>\n      void interactor_MouseWheelBackwardEvt(vtkObject sender, vtkObjectEventArgs e) {\n         MoveBackwardSlice();\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadImageData/","title":"ReadImageData","text":"

        vtk-examples/CSharp/IO/ReadImageData

        "},{"location":"CSharp/IO/ReadImageData/#description","title":"Description","text":"

        This example reads an image data (.vti) file. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadImageData/#code","title":"Code","text":"

        ReadImageData.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadImageData();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n       private void ReadImageData() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\vase_1comp.vti\");\n\n         // reader\n         // Read all the data from the file\n         vtkXMLImageDataReader reader = vtkXMLImageDataReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         // mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetRepresentationToWireframe();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n  }\n}\n
        "},{"location":"CSharp/IO/ReadOBJ/","title":"ReadOBJ","text":"

        vtk-examples/CSharp/IO/ReadOBJ

        "},{"location":"CSharp/IO/ReadOBJ/#description","title":"Description","text":"

        This example demonstrates how to read a Wavefront OBJ file. The result is displayed.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadOBJ/#code","title":"Code","text":"

        ReadOBJ.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadOBJ();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadOBJ() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         // caution: vtkdata-5.8.0\\Data\\mni-surface-mesh.obj is no valid obj file!\n         //string filePath = System.IO.Path.Combine(root, @\"Data\\mni-surface-mesh.obj\");\n         string filePath = System.IO.Path.Combine(root, @\"Data\\ViewPoint\\cow.obj\");\n\n         vtkOBJReader reader = vtkOBJReader.New();\n         if(!File.Exists(filePath)) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.3, 0.6, 0.3);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n         renderWindow.Render();\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadPDB/","title":"ReadPDB","text":"

        vtk-examples/CSharp/IO/ReadPDB

        "},{"location":"CSharp/IO/ReadPDB/#description","title":"Description","text":"

        This example reads Protein Data Bank files. The example expects a file in .pdb format.

        This is a suitable sample file: src/Testing/Data/lys.pdb.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadPDB/#code","title":"Code","text":"

        ReadPDB.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPDB();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPDB() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\caffeine.pdb\");\n\n         vtkPDBReader pdb = vtkPDBReader.New();\n         pdb.SetFileName(filePath);\n         pdb.SetHBScale(1.0);\n         pdb.SetBScale(1.0);\n         pdb.Update();\n         Debug.WriteLine(\"# of atoms is: \" + pdb.GetNumberOfAtoms());\n         // if molecule contains a lot of atoms, reduce the resolution of the sphere (represents an atom) for faster rendering\n         int resolution = (int)Math.Floor(Math.Sqrt(300000.0 / pdb.GetNumberOfAtoms())); // 300000.0 is an empriric value\n         if(resolution > 20)\n            resolution = 20;\n         else if(resolution < 4)\n            resolution = 4;\n\n         Debug.WriteLine(\"Resolution is: \" + resolution);\n         vtkSphereSource sphere = vtkSphereSource.New();\n         sphere.SetCenter(0, 0, 0);\n         sphere.SetRadius(1);\n         sphere.SetThetaResolution(resolution);\n         sphere.SetPhiResolution(resolution);\n\n         vtkGlyph3D glyph = vtkGlyph3D.New();\n         glyph.SetInputConnection(pdb.GetOutputPort());\n         glyph.SetOrient(1);\n         glyph.SetColorMode(1);\n         // glyph.ScalingOn();\n         glyph.SetScaleMode(2);\n         glyph.SetScaleFactor(.25);\n         glyph.SetSourceConnection(sphere.GetOutputPort());\n\n         vtkPolyDataMapper atomMapper = vtkPolyDataMapper.New();\n         atomMapper.SetInputConnection(glyph.GetOutputPort());\n         atomMapper.UseLookupTableScalarRangeOff();\n         atomMapper.ScalarVisibilityOn();\n         atomMapper.SetScalarModeToDefault();\n\n         vtkLODActor atom = vtkLODActor.New();\n         atom.SetMapper(atomMapper);\n         atom.GetProperty().SetRepresentationToSurface();\n         atom.GetProperty().SetInterpolationToGouraud();\n         atom.GetProperty().SetAmbient(0.15);\n         atom.GetProperty().SetDiffuse(0.85);\n         atom.GetProperty().SetSpecular(0.1);\n         atom.GetProperty().SetSpecularPower(30);\n         atom.GetProperty().SetSpecularColor(1, 1, 1);\n         atom.SetNumberOfCloudPoints(30000);\n\n\n         vtkTubeFilter tube = vtkTubeFilter.New();\n         tube.SetInputConnection(pdb.GetOutputPort());\n         tube.SetNumberOfSides(resolution);\n         tube.CappingOff();\n         tube.SetRadius(0.2);\n         // turn off variation of tube radius with scalar values\n         tube.SetVaryRadius(0);\n         tube.SetRadiusFactor(10);\n\n         vtkPolyDataMapper bondMapper = vtkPolyDataMapper.New();\n         bondMapper.SetInputConnection(tube.GetOutputPort());\n         bondMapper.UseLookupTableScalarRangeOff();\n         bondMapper.ScalarVisibilityOff();\n         bondMapper.SetScalarModeToDefault();\n\n         vtkLODActor bond = vtkLODActor.New();\n         bond.SetMapper(bondMapper);\n         bond.GetProperty().SetRepresentationToSurface();\n         bond.GetProperty().SetInterpolationToGouraud();\n         bond.GetProperty().SetAmbient(0.15);\n         bond.GetProperty().SetDiffuse(0.85);\n         bond.GetProperty().SetSpecular(0.1);\n         bond.GetProperty().SetSpecularPower(30);\n         bond.GetProperty().SetSpecularColor(1, 1, 1);\n         bond.GetProperty().SetDiffuseColor(1.0000, 0.8941, 0.70981);\n\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(atom);\n         renderer.AddActor(bond);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadPLOT3D/","title":"ReadPLOT3D","text":"

        vtk-examples/CSharp/IO/ReadPLOT3D

        "},{"location":"CSharp/IO/ReadPLOT3D/#description","title":"Description","text":"

        Reads PLOT3D files A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadPLOT3D/#code","title":"Code","text":"

        ReadPLOT3D.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPLOT3D();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n     private void ReadPLOT3D() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePathXYZ = System.IO.Path.Combine(root, @\"Data\\bluntfinxyz.bin\");\n         string filePathQ = System.IO.Path.Combine(root, @\"Data\\bluntfinq.bin\");\n         //string filePathXYZ = System.IO.Path.Combine(root, @\"Data\\combxyz.bin\");\n         //string filePathQ = System.IO.Path.Combine(root, @\"Data\\combq.bin\");\n\n         vtkMultiBlockPLOT3DReader reader = vtkMultiBlockPLOT3DReader.New();\n         reader.SetXYZFileName(filePathXYZ);\n         reader.SetQFileName(filePathQ);\n\n         // Specify the scalar function to extract. If ==(-1), then no scalar function is extracted. \n         int scalarFctNo = reader.GetScalarFunctionNumber();\n         int vectorFctNo = reader.GetVectorFunctionNumber();\n         if(scalarFctNo != -1)\n            reader.SetScalarFunctionNumber(scalarFctNo);\n         // Specify the vector function to extract. If ==(-1), then no vector function is extracted. \n         if(vectorFctNo != -1)\n            reader.SetVectorFunctionNumber(vectorFctNo);\n         reader.Update();\n\n         //// geometry filter\n         //// This filter is multi-block aware and will request blocks from the\n         //// input. These blocks will be processed by simple processes as if they\n         //// are the whole dataset\n         //vtkCompositeDataGeometryFilter geom1 = vtkCompositeDataGeometryFilter.New();\n         //geom1.SetInputConnection(0, reader.GetOutputPort(0));\n\n         vtkStructuredGridGeometryFilter geometryFilter = vtkStructuredGridGeometryFilter.New();\n         geometryFilter.SetInput(reader.GetOutput().GetBlock(0));\n         //geometryFilter.SetInputConnection(geom1.GetOutputPort(0));\n         geometryFilter.Update();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(geometryFilter.GetOutputPort());\n         //mapper.SetInputConnection(geom1.GetOutputPort());\n         mapper.ScalarVisibilityOn();\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadPLY/","title":"ReadPLY","text":"

        vtk-examples/CSharp/IO/ReadPLY

        "},{"location":"CSharp/IO/ReadPLY/#description","title":"Description","text":"

        Reads a PLY file A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadPLY/#code","title":"Code","text":"

        ReadPLY.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPLY();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPLY() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\bunny.ply\");\n         vtkPLYReader reader = vtkPLYReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadPNM/","title":"ReadPNM","text":"

        vtk-examples/CSharp/IO/ReadPNM

        "},{"location":"CSharp/IO/ReadPNM/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadPNM/#code","title":"Code","text":"

        ReadPNM.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPNM();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPNM() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\earth.ppm\");\n         //Read the image\n         vtkPNMReader reader = vtkPNMReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadPlainText/","title":"ReadPlainText","text":"

        vtk-examples/CSharp/IO/ReadPlainText

        "},{"location":"CSharp/IO/ReadPlainText/#description","title":"Description","text":"

        This example takes a plain text file of coordinates and reads them into a vtkPoints, which is then put into a vtkPolyData and displayed on the screen using a vtkVertexGlyphFilter.

        An example file may look like:

         1 2 3\n 4 5 6 \n 7 8 9\n

        Sample data are available as a zipped file (16 KB): SampleData.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadPlainText/#code","title":"Code","text":"

        ReadPlainText.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPlainText();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPlainText() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\teapot.xyz\");\n\n         FileStream fs = null;\n         StreamReader sr = null;\n         String sLineBuffer;\n         String[] sXYZ;\n         char[] chDelimiter = new char[] { ' ', '\\t', ';' };\n         double[] xyz = new double[3];\n         vtkPoints points = vtkPoints.New();\n         int cnt = 0;\n\n         try {\n            // in case file must be open in another application too use \"FileShare.ReadWrite\"\n            fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);\n            sr = new StreamReader(fs);\n            while(!sr.EndOfStream) {\n               sLineBuffer = sr.ReadLine();\n               cnt++;\n               sXYZ = sLineBuffer.Split(chDelimiter, StringSplitOptions.RemoveEmptyEntries);\n               if(sXYZ == null || sXYZ.Length != 3) {\n                  MessageBox.Show(\"data seems to be in wrong format at line \" + cnt, \"Format Exception\", MessageBoxButtons.OK);\n                  return;\n               }\n               xyz[0] = double.Parse(sXYZ[0], CultureInfo.InvariantCulture);\n               xyz[1] = double.Parse(sXYZ[1], CultureInfo.InvariantCulture);\n               xyz[2] = double.Parse(sXYZ[2], CultureInfo.InvariantCulture);\n               points.InsertNextPoint(xyz[0], xyz[1], xyz[2]);\n            }\n            vtkPolyData polydata = vtkPolyData.New();\n            polydata.SetPoints(points);\n            vtkVertexGlyphFilter glyphFilter = vtkVertexGlyphFilter.New();\n            glyphFilter.SetInputConnection(polydata.GetProducerPort());\n\n            // Visualize\n            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n            mapper.SetInputConnection(glyphFilter.GetOutputPort());\n\n            vtkActor actor = vtkActor.New();\n            actor.SetMapper(mapper);\n            actor.GetProperty().SetPointSize(4);\n            actor.GetProperty().SetColor(1, 0.5, 0);\n            // get a reference to the renderwindow of our renderWindowControl1\n            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n            // renderer\n            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n            // set background color\n            renderer.SetBackground(0.2, 0.3, 0.4);\n            // add our actor to the renderer\n            renderer.AddActor(actor);\n         }\n         catch(IOException ex) {\n            MessageBox.Show(ex.Message, \"IOException\", MessageBoxButtons.OK);\n         }\n         finally {\n            if(sr != null) {\n               sr.Close();\n               sr.Dispose();\n               sr = null;\n            }\n         }\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadPolyData/","title":"ReadPolyData","text":"

        vtk-examples/CSharp/IO/ReadPolyData

        "},{"location":"CSharp/IO/ReadPolyData/#description","title":"Description","text":"

        This example reads a polygonal data (.vtp) file. An example data set can be found at VTKData/Data/SyntheticPolyline.vtp A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadPolyData/#code","title":"Code","text":"

        ReadPolyData.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadPolyData();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadPolyData() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         // string filePath = System.IO.Path.Combine(root, @\"Data\\SyntheticPolyline.vtp\");\n         // string filePath = System.IO.Path.Combine(root, @\"Data\\uniform-001371-5x5x5.vtp\");\n         // string filePath = System.IO.Path.Combine(root, @\"Data\\political.vtp\");\n         // string filePath = System.IO.Path.Combine(root, @\"Data\\filledContours.vtp\");\n         // string filePath = System.IO.Path.Combine(root, @\"Data\\disk_out_ref_surface.vtp\");\n         string filePath = System.IO.Path.Combine(root, @\"Data\\cow.vtp\");\n         // reader\n         // Read all the data from the file\n         vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         // mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadRectilinearGrid/","title":"ReadRectilinearGrid","text":"

        vtk-examples/CSharp/IO/ReadRectilinearGrid

        "},{"location":"CSharp/IO/ReadRectilinearGrid/#description","title":"Description","text":"

        This example reads a rectilinear grid (.vtr) file. An example file can be found at VTKData/Data/cth.vtr A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadRectilinearGrid/#code","title":"Code","text":"

        ReadRectilinearGrid.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadRectilinearGrid();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadRectilinearGrid() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\cth.vtr\");\n         // reader\n         vtkXMLRectilinearGridReader reader = vtkXMLRectilinearGridReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         //vtkRectilinearGridGeometryFilter geometryFilter = vtkRectilinearGridGeometryFilter.New();\n         //geometryFilter.SetInputConnection(reader.GetOutputPort());\n         //geometryFilter.Update();\n\n\n         // Visualize\n         // mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         //mapper.SetInputConnection(geometryFilter.GetOutputPort());\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetRepresentationToWireframe();\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadSTL/","title":"ReadSTL","text":"

        vtk-examples/CSharp/IO/ReadSTL

        "},{"location":"CSharp/IO/ReadSTL/#description","title":"Description","text":"

        Reads an stl file A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadSTL/#code","title":"Code","text":"

        ReadSTL.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadSTL();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadSTL() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\42400-IDGH.stl\");\n         vtkSTLReader reader = vtkSTLReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadStructuredGrid/","title":"ReadStructuredGrid","text":"

        vtk-examples/CSharp/IO/ReadStructuredGrid

        "},{"location":"CSharp/IO/ReadStructuredGrid/#description","title":"Description","text":"

        This example reads a structured grid (.vts) file. An example file can be found at VTKData/Data/multicomb_0.vts A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadStructuredGrid/#code","title":"Code","text":"

        ReadStructuredGrid.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadStructuredGrid();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadStructuredGrid() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\multicomb_0.vts\");\n\n         // reader\n         vtkXMLStructuredGridReader reader = vtkXMLStructuredGridReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         vtkStructuredGridGeometryFilter geometryFilter = vtkStructuredGridGeometryFilter.New();\n         geometryFilter.SetInputConnection(reader.GetOutputPort());\n         geometryFilter.Update();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(geometryFilter.GetOutputPort());\n\n         //// mapper\n         //vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         //mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadTIFF/","title":"ReadTIFF","text":"

        vtk-examples/CSharp/IO/ReadTIFF

        "},{"location":"CSharp/IO/ReadTIFF/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadTIFF/#code","title":"Code","text":"

        ReadTIFF.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadTIFF();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadTIFF() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\beach.tif\");\n         //Read the image\n         vtkTIFFReader reader = vtkTIFFReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadUnknownTypeXMLFile/","title":"ReadUnknownTypeXMLFile","text":"

        vtk-examples/CSharp/IO/ReadUnknownTypeXMLFile

        "},{"location":"CSharp/IO/ReadUnknownTypeXMLFile/#description","title":"Description","text":"

        This examples reads either a vtu (unstructured grid) or vtp (polydata) file and displays it to the screen. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadUnknownTypeXMLFile/#code","title":"Code","text":"

        ReadUnknownTypeXMLFile.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ReadUnknownTypeXMLFile();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ReadUnknownTypeXMLFile() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\quadraticTetra01.vtu\");\n         //string filePath = System.IO.Path.Combine(root, @\"Data\\SyntheticPolyline.vtp\");\n\n         // reader\n         // Read all the data from the file\n         vtkXMLGenericDataObjectReader reader = vtkXMLGenericDataObjectReader.New();\n         // caution: you cannot use CanReadFile with the generic reader\n         //if(reader.CanReadFile(filePath) == 0) {\n         //   MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n         //   return;\n         //}\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         // All of the standard data types can be checked and obtained like this:\n         if(vtkPolyData.SafeDownCast(reader.GetOutput()) != null) {\n            Debug.WriteLine(\"File is a polydata\");\n         }\n         else if(vtkUnstructuredGrid.SafeDownCast(reader.GetOutput()) != null) {\n            Debug.WriteLine(\"File is an unstructured grid\");\n         }\n\n         // mapper\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         //actor.GetProperty().SetRepresentationToWireframe();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/ReadUnstructuredGrid/","title":"ReadUnstructuredGrid","text":"

        vtk-examples/CSharp/IO/ReadUnstructuredGrid

        "},{"location":"CSharp/IO/ReadUnstructuredGrid/#description","title":"Description","text":"

        This examples demonstrates how to read an unstructured grid (VTU) file.

        An example data file (.vtu) for testing can be found in VTKData/Data/quadraticTetra01.vtu.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/ReadUnstructuredGrid/#code","title":"Code","text":"

        ReadUnstructuredGrid.cs

        using System;\nusing System.ComponentModel;\nusing System.Windows.Forms;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            string filePath = @\"C:\\VTK\\vtkdata-5.8.0\\Data\\quadraticTetra01.vtu\";\n\n            // reader\n            vtkXMLUnstructuredGridReader reader = vtkXMLUnstructuredGridReader.New();\n            if(reader.CanReadFile(filePath) == 0) {\n               MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n               return;\n            }\n            reader.SetFileName(filePath);\n            reader.Update(); // here we read the file actually\n\n            // mapper\n            vtkDataSetMapper gridMapper = vtkDataSetMapper.New();\n            gridMapper.SetInputConnection(reader.GetOutputPort());\n\n            // actor\n            vtkActor gridActor = vtkActor.New();\n            gridActor.SetMapper(gridMapper);\n\n            // get a reference to the renderwindow of our renderWindowControl1\n            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n\n            // renderer\n            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n            // set background color\n            renderer.SetBackground(0.2, 0.3, 0.4);\n\n            // add our actor to the renderer\n            renderer.AddActor(gridActor);\n\n            // reposition the camera, so that actor can be fully seen\n            renderer.ResetCamera();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/SimplePointsReader/","title":"SimplePointsReader","text":"

        vtk-examples/CSharp/IO/SimplePointsReader

        "},{"location":"CSharp/IO/SimplePointsReader/#description","title":"Description","text":"

        A file of XYZ coordinates is a very easy format that can be used for simple storage from many applications. This example demonstrates how to read this type of file into a polydata object. An example file of three points would look like this:

        0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/SimplePointsReader/#code","title":"Code","text":"

        SimplePointsReader.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            SimplePointsReader();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void SimplePointsReader() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\points.txt\");\n\n         vtkSimplePointsReader reader = vtkSimplePointsReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetPointSize(4);\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         renderer.AddActor(actor);\n         //renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/VRML/","title":"VRML","text":"

        vtk-examples/CSharp/IO/VRML

        "},{"location":"CSharp/IO/VRML/#description","title":"Description","text":"

        This example loads a wrl file and displays it on the screen. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/VRML/#code","title":"Code","text":"

        VRML.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            VRML();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void VRML() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\bot2.wrl\");\n         // reader\n         vtkVRMLImporter importer = vtkVRMLImporter.New();\n         importer.SetFileName(filePath);\n         importer.Update();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         renderWindow.AddRenderer(importer.GetRenderer());\n         renderWindow.Render();\n\n         //vtkActorCollection actors = importer.GetRenderer().GetActors();\n         //actors.InitTraversal();\n         //vtkActor tmp;\n         //while(( tmp = actors.GetNextActor()) != null) {\n         //}\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/WriteBMP/","title":"WriteBMP","text":"

        vtk-examples/CSharp/IO/WriteBMP

        "},{"location":"CSharp/IO/WriteBMP/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/WriteBMP/#code","title":"Code","text":"

        WriteBMP.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteBMP();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteBMP() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_bmp.bmp\");\n         int[] extent = new int[] { 1, 10, 1, 10, 1, 10 };\n         vtkImageCanvasSource2D imageSource = vtkImageCanvasSource2D.New();\n         imageSource.SetScalarTypeToUnsignedChar();\n         imageSource.SetExtent(0, 9, 0, 9, 0, 0);\n         imageSource.SetNumberOfScalarComponents(3);\n         imageSource.SetDrawColor(0, 0, 0, 0);\n         imageSource.FillBox(0, 9, 0, 9);\n         imageSource.SetDrawColor(255, 0, 0, 0);\n         imageSource.FillBox(5, 7, 5, 7);\n         imageSource.Update();\n\n         vtkBMPWriter bmpWriter = vtkBMPWriter.New();\n         bmpWriter.SetFileName(filePath);\n         bmpWriter.SetInputConnection(imageSource.GetOutputPort());\n         bmpWriter.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkBMPReader reader = vtkBMPReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/WritePNG/","title":"WritePNG","text":"

        vtk-examples/CSharp/IO/WritePNG

        "},{"location":"CSharp/IO/WritePNG/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/WritePNG/#code","title":"Code","text":"

        WritePNG.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WritePNG();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WritePNG() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_png.png\");\n         int[] extent = new int[] { 0, 99, 0, 99, 0, 0 };\n         vtkImageCanvasSource2D imageSource = vtkImageCanvasSource2D.New();\n         imageSource.SetExtent(extent[0], extent[1], extent[2], extent[3], extent[4], extent[5]);\n         imageSource.SetScalarTypeToUnsignedChar();\n         imageSource.SetNumberOfScalarComponents(3);\n         imageSource.SetDrawColor(127, 45, 255);\n         imageSource.FillBox(0, 99, 0, 99);\n         imageSource.SetDrawColor(255, 255, 255);\n         imageSource.FillBox(40, 70, 20, 50);\n         imageSource.Update();\n\n         vtkImageCast castFilter = vtkImageCast.New();\n         castFilter.SetOutputScalarTypeToUnsignedChar();\n         castFilter.SetInputConnection(imageSource.GetOutputPort());\n         castFilter.Update();\n\n         vtkPNGWriter writer = vtkPNGWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInputConnection(castFilter.GetOutputPort());\n         writer.Write();\n         // Read and display file for verification that it was written correctly\n         vtkPNGReader reader = vtkPNGReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/WritePNM/","title":"WritePNM","text":"

        vtk-examples/CSharp/IO/WritePNM

        "},{"location":"CSharp/IO/WritePNM/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/WritePNM/#code","title":"Code","text":"

        WritePNM.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WritePNM();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WritePNM() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_pnm.ppm\");\n         vtkImageCanvasSource2D imageSource = vtkImageCanvasSource2D.New();\n         imageSource.SetScalarTypeToUnsignedChar();\n         imageSource.SetExtent(0, 9, 0, 9, 0, 0);\n         imageSource.SetNumberOfScalarComponents(3);\n         imageSource.SetDrawColor(0, 0, 0, 0);\n         imageSource.FillBox(0, 9, 0, 9);\n         imageSource.SetDrawColor(255, 0, 0, 0);\n         imageSource.FillBox(5, 7, 5, 7);\n         imageSource.Update();\n\n         vtkPNMWriter pnmWriter = vtkPNMWriter.New();\n         pnmWriter.SetFileName(filePath);\n         pnmWriter.SetInputConnection(imageSource.GetOutputPort());\n         pnmWriter.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkPNMReader reader = vtkPNMReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/WriteTIFF/","title":"WriteTIFF","text":"

        vtk-examples/CSharp/IO/WriteTIFF

        "},{"location":"CSharp/IO/WriteTIFF/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/WriteTIFF/#code","title":"Code","text":"

        WriteTIFF.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteTIFF();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteTIFF() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_tiff.tif\");\n\n         vtkImageCanvasSource2D imageSource = vtkImageCanvasSource2D.New();\n         imageSource.SetScalarTypeToUnsignedChar();\n         imageSource.SetExtent(0, 9, 0, 9, 0, 0);\n         imageSource.SetNumberOfScalarComponents(3);\n         imageSource.SetDrawColor(0, 0, 0, 0);\n         imageSource.FillBox(0, 9, 0, 9);\n         imageSource.SetDrawColor(255, 0, 0, 0);\n         imageSource.FillBox(5, 7, 5, 7);\n         imageSource.Update();\n\n         vtkTIFFWriter tiffWriter = vtkTIFFWriter.New();\n         tiffWriter.SetFileName(filePath);\n         tiffWriter.SetInputConnection(imageSource.GetOutputPort());\n         tiffWriter.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkTIFFReader reader = vtkTIFFReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Visualize\n         vtkImageViewer2 imageViewer = vtkImageViewer2.New();\n         imageViewer.SetInputConnection(reader.GetOutputPort());\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         imageViewer.SetRenderer(renderer);\n         renderer.ResetCamera();\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/WriteVTI/","title":"WriteVTI","text":"

        vtk-examples/CSharp/IO/WriteVTI

        "},{"location":"CSharp/IO/WriteVTI/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/WriteVTI/#code","title":"Code","text":"

        WriteVTI.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteVTI();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteVTI() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\test_vti.vti\");\n         vtkImageData imageData = vtkImageData.New();\n         imageData.SetDimensions(3, 4, 5);\n         imageData.SetNumberOfScalarComponents(1);\n         imageData.SetScalarTypeToDouble();\n         int[] dims = imageData.GetDimensions();\n\n         // Fill every entry of the image data with \"2.0\"\n         /* we can do this in unsafe mode which looks pretty similar to the c++ version \n           but then you must declare at the very top of your file the \"preprocessor\" directive \n\n          #define UNSAFE\n\n          * or whatever name you choose for the following preprocessor #if statement\n          */\n#if UNSAFE\n         unsafe {\n            for(int z = 0; z < dims[2]; z++) {\n               for(int y = 0; y < dims[1]; y++) {\n                  for(int x = 0; x < dims[0]; x++) {\n                     double* pixel = (double*)imageData.GetScalarPointer(x, y, z).ToPointer();\n                     // c++ version:\n                     // double* pixel = static_cast<double*>(imageData->GetScalarPointer(x,y,z));\n                     pixel[0] = 2.0;\n                  }\n               }\n            }\n         }\n#else\n         /* or we can do it in managed mode */\n         int size = imageData.GetScalarSize();\n         IntPtr ptr = Marshal.AllocHGlobal(size);\n\n         for(int z = 0; z < dims[2]; z++) {\n            for(int y = 0; y < dims[1]; y++) {\n               for(int x = 0; x < dims[0]; x++) {\n                  ptr = imageData.GetScalarPointer(x, y, z);\n                  Marshal.Copy(new double[] { 2.0 }, 0, ptr, 1);\n               }\n            }\n         }\n         Marshal.FreeHGlobal(ptr);\n#endif\n\n         vtkXMLImageDataWriter writer = vtkXMLImageDataWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInputConnection(imageData.GetProducerPort());\n         writer.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkXMLImageDataReader reader = vtkXMLImageDataReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         // Convert the image to a polydata\n         vtkImageDataGeometryFilter imageDataGeometryFilter = vtkImageDataGeometryFilter.New();\n         imageDataGeometryFilter.SetInputConnection(reader.GetOutputPort());\n         imageDataGeometryFilter.Update();\n\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(imageDataGeometryFilter.GetOutputPort());\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetPointSize(4);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/WriteVTP/","title":"WriteVTP","text":"

        vtk-examples/CSharp/IO/WriteVTP

        "},{"location":"CSharp/IO/WriteVTP/#description","title":"Description","text":"

        In this example, we add 4 points to a polygonal data (polydata) object and write the result to a VTP file. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/WriteVTP/#code","title":"Code","text":"

        WriteVTP.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WritePolyData();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WritePolyData() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\poly_test.vtp\");\n         // Create 4 points for a tetrahedron\n         vtkPoints points = vtkPoints.New();\n\n         points.InsertNextPoint(0, 0, 0);\n         points.InsertNextPoint(0, 0, 1);\n         points.InsertNextPoint(1, 0, 0);\n         points.InsertNextPoint(0, 1, 0);\n\n         // Create a polydata object and add the points to it.\n         vtkPolyData polydata = vtkPolyData.New();\n         polydata.SetPoints(points);\n\n         // it's not enough only to define points\n         // we need to define faces too\n         // (must be defined in counter clockwise order as viewed from the outside)\n         vtkTriangle face0 = vtkTriangle.New();\n         face0.GetPointIds().SetId(0, 0);\n         face0.GetPointIds().SetId(1, 2);\n         face0.GetPointIds().SetId(2, 1);\n         vtkTriangle face1 = vtkTriangle.New();\n         face1.GetPointIds().SetId(0, 0);\n         face1.GetPointIds().SetId(1, 3);\n         face1.GetPointIds().SetId(2, 2);\n         vtkTriangle face2 = vtkTriangle.New();\n         face2.GetPointIds().SetId(0, 0);\n         face2.GetPointIds().SetId(1, 1);\n         face2.GetPointIds().SetId(2, 3);\n         vtkTriangle face3 = vtkTriangle.New();\n         face3.GetPointIds().SetId(0, 1);\n         face3.GetPointIds().SetId(1, 2);\n         face3.GetPointIds().SetId(2, 3);\n\n         vtkCellArray faces = vtkCellArray.New();\n         faces.InsertNextCell(face0);\n         faces.InsertNextCell(face1);\n         faces.InsertNextCell(face2);\n         faces.InsertNextCell(face3);\n\n         polydata.SetPolys(faces);\n\n         // Write the file\n         vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInput(polydata);\n\n         // Optional - set the mode. The default is binary.\n         //writer.SetDataModeToBinary();\n         writer.SetDataModeToAscii();\n         writer.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/WriteVTU/","title":"WriteVTU","text":"

        vtk-examples/CSharp/IO/WriteVTU

        "},{"location":"CSharp/IO/WriteVTU/#description","title":"Description","text":"

        This example writes a VTU file. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/WriteVTU/#code","title":"Code","text":"

        WriteVTU.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WriteVTUFile();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WriteVTUFile() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\tetra_test.vtu\");\n\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0, 0, 0);\n         points.InsertNextPoint(1, 0, 0);\n         points.InsertNextPoint(1, 1, 0);\n         points.InsertNextPoint(0, 1, 1);\n\n         vtkTetra tetra = vtkTetra.New();\n\n         tetra.GetPointIds().SetId(0, 0);\n         tetra.GetPointIds().SetId(1, 1);\n         tetra.GetPointIds().SetId(2, 2);\n         tetra.GetPointIds().SetId(3, 3);\n\n         vtkCellArray cellArray = vtkCellArray.New();\n         cellArray.InsertNextCell(tetra);\n\n         vtkUnstructuredGrid unstructuredGrid = vtkUnstructuredGrid.New();\n         unstructuredGrid.SetPoints(points);\n         const int VTK_TETRA = 10;\n         unstructuredGrid.SetCells(VTK_TETRA, cellArray);\n\n         // Write file\n         vtkXMLUnstructuredGridWriter writer = vtkXMLUnstructuredGridWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInput(unstructuredGrid);\n         writer.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkXMLUnstructuredGridReader reader = vtkXMLUnstructuredGridReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n         mapper.SetInputConnection(reader.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/IO/XMLStructuredGridWriter/","title":"XMLStructuredGridWriter","text":"

        vtk-examples/CSharp/IO/XMLStructuredGridWriter

        "},{"location":"CSharp/IO/XMLStructuredGridWriter/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/IO/XMLStructuredGridWriter/#code","title":"Code","text":"

        XMLStructuredGridWriter.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            XMLStructuredGridWriter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void XMLStructuredGridWriter() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\structuredgrid_test.vts\");\n         // Create a grid\n         vtkStructuredGrid structuredGrid = vtkStructuredGrid.New();\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0, 0, 0);\n         points.InsertNextPoint(1, 0, 0);\n         points.InsertNextPoint(0, 1, 0);\n         points.InsertNextPoint(1, 1, 0);\n         points.InsertNextPoint(0, 2, 0);\n         points.InsertNextPoint(1, 2, 1);\n\n         // Specify the dimensions of the grid\n         structuredGrid.SetDimensions(2, 3, 1);\n         structuredGrid.SetPoints(points);\n\n         // Write file\n         vtkXMLStructuredGridWriter writer = vtkXMLStructuredGridWriter.New();\n         writer.SetFileName(filePath);\n         writer.SetInput(structuredGrid);\n         writer.Write();\n\n         // Read and display file for verification that it was written correctly\n         vtkXMLStructuredGridReader reader = vtkXMLStructuredGridReader.New();\n         if(reader.CanReadFile(filePath) == 0) {\n            MessageBox.Show(\"Cannot read file \\\"\" + filePath + \"\\\"\", \"Error\", MessageBoxButtons.OK);\n            return;\n         }\n         reader.SetFileName(filePath);\n         reader.Update(); // here we read the file actually\n\n         vtkStructuredGridGeometryFilter geometryFilter = vtkStructuredGridGeometryFilter.New();\n         geometryFilter.SetInputConnection(reader.GetOutputPort());\n         geometryFilter.Update();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(geometryFilter.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/ImplicitFunctions/ImplicitSphere/","title":"ImplicitSphere","text":"

        vtk-examples/CSharp/ImplicitFunctions/ImplicitSphere

        "},{"location":"CSharp/ImplicitFunctions/ImplicitSphere/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Note

        As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/ImplicitFunctions/ImplicitSphere/#code","title":"Code","text":"

        ImplicitSphere.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ImplicitSphere();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ImplicitSphere() {\n         vtkSphere sphere = vtkSphere.New();\n\n         // Sample the function\n         vtkSampleFunction sample = vtkSampleFunction.New();\n         sample.SetSampleDimensions(50, 50, 50);\n         sample.SetImplicitFunction(sphere);\n         double value = 2.0;\n         double xmin = -value, xmax = value,\n                ymin = -value, ymax = value,\n                zmin = -value, zmax = value;\n         sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n         // Create the 0 isosurface\n         vtkContourFilter contours = vtkContourFilter.New();\n#if VTK_MAJOR_VERSION_5\n         contours.SetInputConnection(sample.GetOutputPort());\n#else\n         contours.SetInputData(sample);\n#endif\n         contours.GenerateValues(1, 1, 1);\n\n         // Map the contours to graphical primitives\n         vtkPolyDataMapper contourMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         contourMapper.SetInputConnection(contours.GetOutputPort());\n#else\n         contourMapper.SetInputData(contours);\n#endif\n         contourMapper.ScalarVisibilityOff();\n\n         // Create an actor for the contours\n         vtkActor contourActor = vtkActor.New();\n         contourActor.SetMapper(contourMapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(contourActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/ImplicitFunctions/IsoContours/","title":"IsoContours","text":"

        vtk-examples/CSharp/ImplicitFunctions/IsoContours

        "},{"location":"CSharp/ImplicitFunctions/IsoContours/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Note

        As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Note

        To use this example create a Windows Forms Application, delete Form1.Designer.cs and replace the content of Form1.cs with this:

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/ImplicitFunctions/IsoContours/#code","title":"Code","text":"

        IsoContours.cs

        using System;\nusing System.ComponentModel;\nusing System.Drawing;\nusing System.Windows.Forms;\nusing System.Runtime.InteropServices;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public class Form1 : Form {\n      private System.ComponentModel.IContainer components = null;\n      private vtkContourFilter _ContourFilter;\n      private vtkRenderWindow _RenderWindow;\n\n\n      public Form1() {\n         InitializeComponent();\n         this.Size = new Size(620, 400);\n      }\n\n\n      private void Form1_Load(object sender, EventArgs e) {\n         try {\n            IsoContours();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void sliderContourValue_Scroll(object sender, EventArgs e) {\n         TrackBar slider = sender as TrackBar;\n         if(slider != null) {\n            _ContourFilter.GenerateValues(1, slider.Value, slider.Value);\n            _RenderWindow.Render();\n         }\n      }\n\n\n      private void IsoContours() {\n         vtkImageData data = vtkImageData.New();\n         CreateData(ref data);\n\n         // Create an isosurface\n         _ContourFilter = vtkContourFilter.New();\n#if VTK_MAJOR_VERSION_5\n         _ContourFilter.SetInput(data);\n#else\n         contourFilter.SetInputData(data);\n#endif\n         _ContourFilter.GenerateValues(1, 10, 10); // (numContours, rangeStart, rangeEnd)\n\n         // Map the contours to graphical primitives\n         vtkPolyDataMapper contourMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         contourMapper.SetInputConnection(_ContourFilter.GetOutputPort());\n#else\n         contourMapper.SetInputData(contourFilter);\n#endif\n         // Create an actor for the contours\n         vtkActor contourActor = vtkActor.New();\n         contourActor.SetMapper(contourMapper);\n\n         // Create the outline\n         vtkOutlineFilter outlineFilter = vtkOutlineFilter.New();\n         vtkPolyDataMapper outlineMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         outlineFilter.SetInput(data);\n         outlineMapper.SetInputConnection(outlineFilter.GetOutputPort());\n#else\n         outlineFilter.SetInputData(data);\n         outlineMapper.SetInputData(outlineFilter);\n#endif\n         vtkActor outlineActor = vtkActor.New();\n         outlineActor.SetMapper(outlineMapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         _RenderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = _RenderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(contourActor);\n         renderer.AddActor(outlineActor);\n      }\n\n\n      void CreateData(ref vtkImageData data) {\n         data.SetExtent(-25, 25, -25, 25, 0, 0);\n#if VTK_MAJOR_VERSION_5\n         data.SetNumberOfScalarComponents(1);\n         data.SetScalarTypeToDouble();\n#else\n         data.AllocateScalars(VTK_DOUBLE,1);\n#endif\n         int[] extent = data.GetExtent();\n\n         for(int y = extent[2]; y <= extent[3]; y++) {\n            for(int x = extent[0]; x <= extent[1]; x++) {\n               IntPtr ptr = data.GetScalarPointer(x, y, 0);\n               double[] pixel = new double[] { Math.Sqrt(Math.Pow(x, 2.0) + Math.Pow(y, 2.0)) };\n               Marshal.Copy(pixel, 0, ptr, 1);\n            }\n         }\n\n         vtkXMLImageDataWriter writer = vtkXMLImageDataWriter.New();\n         writer.SetFileName(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\testIsoContours.vti\");\n#if VTK_MAJOR_VERSION_5\n         writer.SetInputConnection(data.GetProducerPort());\n#else\n         writer.SetInputData(data);\n#endif\n         writer.Write();\n      }\n\n\n\n      /// <summary>\n      /// Clean up any resources being used.\n      /// </summary>\n      /// <param name=\"disposing\">true if managed resources should be disposed; otherwise, false.</param>\n      protected override void Dispose(bool disposing) {\n         if(disposing && ( components != null )) {\n            components.Dispose();\n         }\n         base.Dispose(disposing);\n      }\n\n      #region Windows Form Designer generated code\n\n      /// <summary>\n      /// Required method for Designer support - do not modify\n      /// the contents of this method with the code editor.\n      /// </summary>\n      private void InitializeComponent() {\n         this.splitContainer1 = new System.Windows.Forms.SplitContainer();\n         this.lblSliderMaxValue = new System.Windows.Forms.Label();\n         this.lblSliderMinValue = new System.Windows.Forms.Label();\n         this.lblSliderTitle = new System.Windows.Forms.Label();\n         this.sliderContourValue = new System.Windows.Forms.TrackBar();\n         this.renderWindowControl1 = new Kitware.VTK.RenderWindowControl();\n         this.splitContainer1.Panel1.SuspendLayout();\n         this.splitContainer1.Panel2.SuspendLayout();\n         this.splitContainer1.SuspendLayout();\n         ((System.ComponentModel.ISupportInitialize)(this.sliderContourValue)).BeginInit();\n         this.SuspendLayout();\n         // \n         // splitContainer1\n         // \n         this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;\n         this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;\n         this.splitContainer1.IsSplitterFixed = true;\n         this.splitContainer1.Location = new System.Drawing.Point(0, 0);\n         this.splitContainer1.Name = \"splitContainer1\";\n         // \n         // splitContainer1.Panel1\n         // \n         this.splitContainer1.Panel1.Controls.Add(this.lblSliderMaxValue);\n         this.splitContainer1.Panel1.Controls.Add(this.lblSliderMinValue);\n         this.splitContainer1.Panel1.Controls.Add(this.lblSliderTitle);\n         this.splitContainer1.Panel1.Controls.Add(this.sliderContourValue);\n         // \n         // splitContainer1.Panel2\n         // \n         this.splitContainer1.Panel2.Controls.Add(this.renderWindowControl1);\n         this.splitContainer1.Size = new System.Drawing.Size(604, 362);\n         this.splitContainer1.SplitterDistance = 213;\n         this.splitContainer1.SplitterWidth = 1;\n         this.splitContainer1.TabIndex = 0;\n         // \n         // lblSliderMaxValue\n         // \n         this.lblSliderMaxValue.AutoSize = true;\n         this.lblSliderMaxValue.Location = new System.Drawing.Point(176, 69);\n         this.lblSliderMaxValue.Name = \"lblSliderMaxValue\";\n         this.lblSliderMaxValue.Size = new System.Drawing.Size(19, 13);\n         this.lblSliderMaxValue.TabIndex = 1;\n         this.lblSliderMaxValue.Text = \"30\";\n         // \n         // lblSliderMinValue\n         // \n         this.lblSliderMinValue.AutoSize = true;\n         this.lblSliderMinValue.Location = new System.Drawing.Point(21, 69);\n         this.lblSliderMinValue.Name = \"lblSliderMinValue\";\n         this.lblSliderMinValue.Size = new System.Drawing.Size(13, 13);\n         this.lblSliderMinValue.TabIndex = 1;\n         this.lblSliderMinValue.Text = \"1\";\n         // \n         // lblSliderTitle\n         // \n         this.lblSliderTitle.AutoSize = true;\n         this.lblSliderTitle.Location = new System.Drawing.Point(18, 11);\n         this.lblSliderTitle.Name = \"lblSliderTitle\";\n         this.lblSliderTitle.Size = new System.Drawing.Size(74, 13);\n         this.lblSliderTitle.TabIndex = 1;\n         this.lblSliderTitle.Text = \"Contour Value\";\n         // \n         // sliderContourValue\n         // \n         this.sliderContourValue.Location = new System.Drawing.Point(12, 37);\n         this.sliderContourValue.Maximum = 30;\n         this.sliderContourValue.Minimum = 1;\n         this.sliderContourValue.Name = \"sliderContourValue\";\n         this.sliderContourValue.Size = new System.Drawing.Size(186, 45);\n         this.sliderContourValue.TabIndex = 0;\n         this.sliderContourValue.TickFrequency = 5;\n         this.sliderContourValue.Value = 10;\n         this.sliderContourValue.Scroll += new System.EventHandler(this.sliderContourValue_Scroll);\n         // \n         // renderWindowControl1\n         // \n         this.renderWindowControl1.AddTestActors = false;\n         this.renderWindowControl1.Dock = System.Windows.Forms.DockStyle.Fill;\n         this.renderWindowControl1.Location = new System.Drawing.Point(0, 0);\n         this.renderWindowControl1.Name = \"renderWindowControl1\";\n         this.renderWindowControl1.Size = new System.Drawing.Size(390, 362);\n         this.renderWindowControl1.TabIndex = 0;\n         this.renderWindowControl1.TestText = null;\n         // \n         // Form1\n         // \n         this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\n         this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\n         this.ClientSize = new System.Drawing.Size(604, 362);\n         this.Controls.Add(this.splitContainer1);\n         this.Name = \"Form1\";\n         this.Text = \"IsoContours\";\n         this.Load += new System.EventHandler(this.Form1_Load);\n         this.splitContainer1.Panel1.ResumeLayout(false);\n         this.splitContainer1.Panel1.PerformLayout();\n         this.splitContainer1.Panel2.ResumeLayout(false);\n         this.splitContainer1.ResumeLayout(false);\n         ((System.ComponentModel.ISupportInitialize)(this.sliderContourValue)).EndInit();\n         this.ResumeLayout(false);\n\n      }\n\n      #endregion\n\n      private System.Windows.Forms.SplitContainer splitContainer1;\n      private System.Windows.Forms.Label lblSliderTitle;\n      private System.Windows.Forms.TrackBar sliderContourValue;\n      private Kitware.VTK.RenderWindowControl renderWindowControl1;\n      private System.Windows.Forms.Label lblSliderMaxValue;\n      private System.Windows.Forms.Label lblSliderMinValue;\n   }\n}\n
        "},{"location":"CSharp/ImplicitFunctions/SampleFunction/","title":"SampleFunction","text":"

        vtk-examples/CSharp/ImplicitFunctions/SampleFunction

        "},{"location":"CSharp/ImplicitFunctions/SampleFunction/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/ImplicitFunctions/SampleFunction/#code","title":"Code","text":"

        SampleFunction.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            SampleFunction();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void SampleFunction() {\n         vtkSphere sphere = vtkSphere.New();\n\n         // Sample the function\n         vtkSampleFunction sample = vtkSampleFunction.New();\n         sample.SetSampleDimensions(50, 50, 50);\n         sample.SetImplicitFunction(sphere);\n         double value = 2.0;\n         double xmin = -value, xmax = value, ymin = -value, ymax = value, zmin = -value, zmax = value;\n         sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n         // Create the 0 isosurface\n         vtkContourFilter contours = vtkContourFilter.New();\n#if VTK_MAJOR_VERSION_5\n         contours.SetInputConnection(sample.GetOutputPort());\n#else\n         contours.SetInputData(sample);\n#endif\n         contours.GenerateValues(1, 1, 1);\n\n         // Map the contours to graphical primitives\n         vtkPolyDataMapper contourMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         contourMapper.SetInputConnection(contours.GetOutputPort());\n#else\n         contourMapper.SetInputData(contours);\n#endif\n         contourMapper.SetScalarRange(0.0, 1.2);\n\n         // Create an actor for the contours\n         vtkActor contourActor = vtkActor.New();\n         contourActor.SetMapper(contourMapper);\n\n         // -- create a box around the function to indicate the sampling volume --\n\n         // Create outline\n         vtkOutlineFilter outline = vtkOutlineFilter.New();\n#if VTK_MAJOR_VERSION_5\n         outline.SetInputConnection(sample.GetOutputPort());\n#else\n         outline.SetInputData(sample);\n#endif\n\n         // Map it to graphics primitives\n         vtkPolyDataMapper outlineMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         outlineMapper.SetInputConnection(outline.GetOutputPort());\n#else\n         outlineMapper.SetInputData(outline);\n#endif\n\n         // Create an actor for it\n         vtkActor outlineActor = vtkActor.New();\n\n         outlineActor.SetMapper(outlineMapper);\n         outlineActor.GetProperty().SetColor(0, 0, 0);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(1.0, 1.0, 1.0);\n         // add our actor to the renderer\n         renderer.AddActor(contourActor);\n         renderer.AddActor(outlineActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/InfoVis/XGMLReader/","title":"XGMLReader","text":"

        vtk-examples/CSharp/InfoVis/XGMLReader

        "},{"location":"CSharp/InfoVis/XGMLReader/#description","title":"Description","text":"

        This example reads and displays the graph from a gml file. You can test this with VTKData/Data/Infovis/fsm.gml. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/InfoVis/XGMLReader/#code","title":"Code","text":"

        XGMLReader.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\nusing System.IO;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            XGMLReader();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void XGMLReader() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\Infovis\\fsm.gml\");\n\n         vtkXGMLReader reader = vtkXGMLReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         vtkUndirectedGraph g = reader.GetOutput();\n\n         vtkGraphLayoutView graphLayoutView = vtkGraphLayoutView.New();\n         graphLayoutView.SetRenderWindow(renderWindowControl1.RenderWindow);\n         graphLayoutView.AddRepresentationFromInput(g);\n         graphLayoutView.SetLayoutStrategy(\"Simple 2D\");\n         graphLayoutView.ResetCamera();\n         graphLayoutView.Render();\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/BoundaryEdges/","title":"BoundaryEdges","text":"

        vtk-examples/CSharp/Meshes/BoundaryEdges

        "},{"location":"CSharp/Meshes/BoundaryEdges/#description","title":"Description","text":"

        This filter will extract the boundary edges of a mesh. The original mesh is shown with the feature edges shown in red.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/BoundaryEdges/#code","title":"Code","text":"

        BoundaryEdges.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            BoundaryEdges();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void BoundaryEdges() {\n         vtkDiskSource diskSource = vtkDiskSource.New();\n         diskSource.Update();\n\n         vtkFeatureEdges featureEdges = vtkFeatureEdges.New();\n#if VTK_MAJOR_VERSION_5\n         featureEdges.SetInputConnection(diskSource.GetOutputPort());\n#else\n         featureEdges.SetInputData(diskSource);\n#endif\n         featureEdges.BoundaryEdgesOn();\n         featureEdges.FeatureEdgesOff();\n         featureEdges.ManifoldEdgesOff();\n         featureEdges.NonManifoldEdgesOff();\n         featureEdges.Update();\n\n         // Visualize\n         vtkPolyDataMapper edgeMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         edgeMapper.SetInputConnection(featureEdges.GetOutputPort());\n#else\n         edgeMapper.SetInputData(featureEdges);\n#endif\n         vtkActor edgeActor = vtkActor.New();\n         edgeActor.GetProperty().SetLineWidth(3);\n         edgeActor.SetMapper(edgeMapper);\n\n         vtkPolyDataMapper diskMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         diskMapper.SetInputConnection(diskSource.GetOutputPort());\n#else\n         diskMapper.SetInputData(diskSource);\n#endif\n         vtkActor diskActor = vtkActor.New();\n         diskActor.SetMapper(diskMapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.3, 0.6, 0.3);\n         // add our actor to the renderer\n         renderer.AddActor(diskActor);\n         renderer.AddActor(edgeActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/CapClip/","title":"CapClip","text":"

        vtk-examples/CSharp/Meshes/CapClip

        "},{"location":"CSharp/Meshes/CapClip/#description","title":"Description","text":"

        This example shows how to generate a \"cap\" on a clipped polydata. It uses a clever trick to convert polylines into polygons. If a polydata file (.vtp) is provided, it will cap it. Otherwise it caps a clipped sphere.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you have to define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/CapClip/#code","title":"Code","text":"

        CapClip.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            CapClip(null);\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void CapClip(string filePath) {\n         // PolyData to process\n         vtkPolyData polyData;\n\n         if(filePath != null) {\n            vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n            reader.SetFileName(filePath);\n            reader.Update();\n            polyData = reader.GetOutput();\n         }\n         else {\n            // Create a sphere\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.SetThetaResolution(20);\n            sphereSource.SetPhiResolution(11);\n\n            vtkPlane plane = vtkPlane.New();\n            plane.SetOrigin(0, 0, 0);\n            plane.SetNormal(1.0, -1.0, -1.0);\n\n            vtkClipPolyData clipper = vtkClipPolyData.New();\n            clipper.SetInputConnection(sphereSource.GetOutputPort());\n            clipper.SetClipFunction(plane);\n            clipper.SetValue(0);\n            clipper.Update();\n\n            polyData = clipper.GetOutput();\n         }\n\n         vtkDataSetMapper clipMapper = vtkDataSetMapper.New();\n#if VTK_MAJOR_VERSION_5\n         clipMapper.SetInput(polyData);\n#else\n         clipMapper.SetInputData(polyData);\n#endif\n\n         vtkActor clipActor = vtkActor.New();\n         clipActor.SetMapper(clipMapper);\n         clipActor.GetProperty().SetColor(1.0000, 0.3882, 0.2784);\n         clipActor.GetProperty().SetInterpolationToFlat();\n\n         // Now extract feature edges\n         vtkFeatureEdges boundaryEdges = vtkFeatureEdges.New();\n#if VTK_MAJOR_VERSION_5\n         boundaryEdges.SetInput(polyData);\n#else\n         boundaryEdges.SetInputData(polyData);\n#endif\n         boundaryEdges.BoundaryEdgesOn();\n         boundaryEdges.FeatureEdgesOff();\n         boundaryEdges.NonManifoldEdgesOff();\n         boundaryEdges.ManifoldEdgesOff();\n\n         vtkStripper boundaryStrips = vtkStripper.New();\n         boundaryStrips.SetInputConnection(boundaryEdges.GetOutputPort());\n         boundaryStrips.Update();\n\n         // Change the polylines into polygons\n         vtkPolyData boundaryPoly = vtkPolyData.New();\n         boundaryPoly.SetPoints(boundaryStrips.GetOutput().GetPoints());\n         boundaryPoly.SetPolys(boundaryStrips.GetOutput().GetLines());\n\n         vtkPolyDataMapper boundaryMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         boundaryMapper.SetInput(boundaryPoly);\n#else\n         boundaryMapper.SetInputData(boundaryPoly);\n#endif\n\n         vtkActor boundaryActor = vtkActor.New();\n         boundaryActor.SetMapper(boundaryMapper);\n         boundaryActor.GetProperty().SetColor(0.8900, 0.8100, 0.3400);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(clipActor);\n         renderer.AddActor(boundaryActor);\n         // Generate an interesting view\n         //\n         renderer.ResetCamera();\n         renderer.GetActiveCamera().Azimuth(30);\n         renderer.GetActiveCamera().Elevation(30);\n         renderer.GetActiveCamera().Dolly(1.2);\n         renderer.ResetCameraClippingRange();\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/CellEdges/","title":"CellEdges","text":"

        vtk-examples/CSharp/Meshes/CellEdges

        "},{"location":"CSharp/Meshes/CellEdges/#description","title":"Description","text":"

        A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/CellEdges/#code","title":"Code","text":"

        CellEdges.cs

        using System;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         CellEdges();\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      private static void CellEdges() {\n         vtkTriangle triangle = vtkTriangle.New();\n         triangle.GetPoints().SetPoint(0, 1.0, 0.0, 0.0);\n         triangle.GetPoints().SetPoint(1, 0.0, 0.0, 0.0);\n         triangle.GetPoints().SetPoint(2, 0.0, 1.0, 0.0);\n         triangle.GetPointIds().SetId(0, 0);\n         triangle.GetPointIds().SetId(1, 1);\n         triangle.GetPointIds().SetId(2, 2);\n\n         Console.WriteLine(\"The cell has \" + triangle.GetNumberOfEdges() + \" edges.\");\n\n         for(int i = 0; i < triangle.GetNumberOfEdges(); i++) {\n            vtkCell edge = triangle.GetEdge(i);\n\n            vtkIdList pointIdList = edge.GetPointIds();\n            Console.WriteLine(\"Edge \" + i + \" has \" + pointIdList.GetNumberOfIds() + \" points.\");\n\n            for(int p = 0; p < pointIdList.GetNumberOfIds(); p++) {\n               Console.WriteLine(\"Edge \" + i + \" uses point \" + pointIdList.GetId(p));\n            }\n         }\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/ColoredElevationMap/","title":"ColoredElevationMap","text":"

        vtk-examples/CSharp/Meshes/ColoredElevationMap

        "},{"location":"CSharp/Meshes/ColoredElevationMap/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/ColoredElevationMap/#code","title":"Code","text":"

        ColoredElevationMap.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ColoredElevationMap();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ColoredElevationMap() {\n         // Create a grid of points (height/terrian map)\n         vtkPoints points = vtkPoints.New();\n\n         uint GridSize = 20;\n         double xx, yy, zz;\n         for(uint x = 0; x < GridSize; x++) {\n            for(uint y = 0; y < GridSize; y++) {\n               xx = x + vtkMath.Random(-.2, .2);\n               yy = y + vtkMath.Random(-.2, .2);\n               zz = vtkMath.Random(-.5, .5);\n               points.InsertNextPoint(xx, yy, zz);\n            }\n         }\n\n         // Add the grid points to a polydata object\n         vtkPolyData inputPolyData = vtkPolyData.New();\n         inputPolyData.SetPoints(points);\n\n         // Triangulate the grid points\n         vtkDelaunay2D delaunay = vtkDelaunay2D.New();\n#if VTK_MAJOR_VERSION_5\n         delaunay.SetInput(inputPolyData);\n#else\n         delaunay.SetInputData(inputPolyData);\n#endif\n         delaunay.Update();\n         vtkPolyData outputPolyData = delaunay.GetOutput();\n\n         double[] bounds = outputPolyData.GetBounds();\n\n         // Find min and max z\n         double minz = bounds[4];\n         double maxz = bounds[5];\n\n         Debug.WriteLine(\"minz: \" + minz);\n         Debug.WriteLine(\"maxz: \" + maxz);\n\n         // Create the color map\n         vtkLookupTable colorLookupTable = vtkLookupTable.New();\n         colorLookupTable.SetTableRange(minz, maxz);\n         colorLookupTable.Build();\n\n         // Generate the colors for each point based on the color map\n         vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();\n         colors.SetNumberOfComponents(3);\n         colors.SetName(\"Colors\");\n\n         Debug.WriteLine(\"There are \" + outputPolyData.GetNumberOfPoints()\n                   + \" points.\");\n\n\n#if UNSAFE // fastest way to fill color array\n         colors.SetNumberOfTuples(outputPolyData.GetNumberOfPoints());\n         unsafe {\n            byte* pColor = (byte*)colors.GetPointer(0).ToPointer();\n\n            for(int i = 0; i < outputPolyData.GetNumberOfPoints(); i++) {\n               double[] p = outputPolyData.GetPoint(i);\n\n               double[] dcolor = colorLookupTable.GetColor(p[2]);\n               Debug.WriteLine(\"dcolor: \"\n                         + dcolor[0] + \" \"\n                         + dcolor[1] + \" \"\n                         + dcolor[2]);\n\n               byte[] color = new byte[3];\n               for(uint j = 0; j < 3; j++) {\n                  color[j] = (byte)( 255 * dcolor[j] );\n               }\n               Debug.WriteLine(\"color: \"\n                         + color[0] + \" \"\n                         + color[1] + \" \"\n                         + color[2]);\n\n               *( pColor + 3 * i ) = color[0];\n               *( pColor + 3 * i + 1 ) = color[1];\n               *( pColor + 3 * i + 2 ) = color[2];\n            }\n         }\n#else\n         for(int i = 0; i < outputPolyData.GetNumberOfPoints(); i++) {\n            double[] p = outputPolyData.GetPoint(i);\n\n            double[] dcolor = colorLookupTable.GetColor(p[2]);\n            Debug.WriteLine(\"dcolor: \"\n                      + dcolor[0] + \" \"\n                      + dcolor[1] + \" \"\n                      + dcolor[2]);\n\n            byte[] color = new byte[3];\n            for(uint j = 0; j < 3; j++) {\n               color[j] = (byte)( 255 * dcolor[j] );\n            }\n            Debug.WriteLine(\"color: \"\n                      + color[0] + \" \"\n                      + color[1] + \" \"\n                      + color[2]);\n            colors.InsertNextTuple3(color[0], color[1], color[2] );\n            //IntPtr pColor = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(byte)) * 3);\n            //Marshal.Copy(color, 0, pColor, 3);\n            //colors.InsertNextTupleValue(pColor);\n            //Marshal.FreeHGlobal(pColor);\n         }\n#endif\n\n         outputPolyData.GetPointData().SetScalars(colors);\n\n         // Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInputConnection(outputPolyData.GetProducerPort());\n#else\n         mapper.SetInputData(outputPolyData);\n#endif\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/Decimate/","title":"Decimate","text":"

        vtk-examples/CSharp/Meshes/Decimate

        "},{"location":"CSharp/Meshes/Decimate/#description","title":"Description","text":"

        This example decimates a mesh. The SetTargetReduction function specifies how many triangles should reduced by specifying the percentage ([of triangles to be removed. For example, if the mesh contains 100 triangles and SetTargetReduction(.90) is called, after the decimation there will be approximately 10 triangles - a 90% reduction.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/Decimate/#code","title":"Code","text":"

        Decimate.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Decimate();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Decimation() { \n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkPolyData input = vtkPolyData.New();\n         input.ShallowCopy(sphereSource.GetOutput());\n\n         Debug.WriteLine(\"Before decimation\" + Environment.NewLine + \"------------\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkDecimatePro decimate = vtkDecimatePro.New();\n#if VTK_MAJOR_VERSION_5\n         decimate.SetInputConnection(input.GetProducerPort());\n#else\n         decimate.SetInputData(input);\n#endif\n         //decimate.SetTargetReduction(.99); //99% reduction (if there was 100 triangles, now there will be 1)\n         decimate.SetTargetReduction(.10); //10% reduction (if there was 100 triangles, now there will be 90)\n         decimate.Update();\n\n         vtkPolyData decimated = vtkPolyData.New();\n         decimated.ShallowCopy(decimate.GetOutput());\n\n         Debug.WriteLine(\"After decimation\" + Environment.NewLine + \"------------\" );\n\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInputConnection(input.GetProducerPort());\n#else\n         inputMapper.SetInputData(input);\n#endif\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n\n         vtkPolyDataMapper decimatedMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         decimatedMapper.SetInputConnection(decimated.GetProducerPort());\n#else\n         decimatedMapper.SetInputData(decimated);\n#endif\n         vtkActor decimatedActor = vtkActor.New();\n         decimatedActor.SetMapper(decimatedMapper);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(inputActor);\n         rightRenderer.AddActor(decimatedActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/ElevationFilter/","title":"ElevationFilter","text":"

        vtk-examples/CSharp/Meshes/ElevationFilter

        "},{"location":"CSharp/Meshes/ElevationFilter/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/ElevationFilter/#code","title":"Code","text":"

        ElevationFilter.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ElevationFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ElevationFilter() {\n         // Created a grid of points (heigh/terrian map)\n         vtkPoints points = vtkPoints.New();\n\n         uint GridSize = 10;\n         for(uint x = 0; x < GridSize; x++) {\n            for(uint y = 0; y < GridSize; y++) {\n               points.InsertNextPoint(x, y, ( x + y ) / ( y + 1 ));\n            }\n         }\n         double[] bounds = points.GetBounds();\n\n         // Add the grid points to a polydata object\n         vtkPolyData inputPolyData = vtkPolyData.New();\n         inputPolyData.SetPoints(points);\n\n         // Triangulate the grid points\n         vtkDelaunay2D delaunay = vtkDelaunay2D.New();\n#if VTK_MAJOR_VERSION_5\n         delaunay.SetInput(inputPolyData);\n#else\n         delaunay.SetInputData(inputPolyData);\n#endif\n         delaunay.Update();\n\n         vtkElevationFilter elevationFilter = vtkElevationFilter.New();\n         elevationFilter.SetInputConnection(delaunay.GetOutputPort());\n         elevationFilter.SetLowPoint(0.0, 0.0, bounds[4]);\n         elevationFilter.SetHighPoint(0.0, 0.0, bounds[5]);\n         elevationFilter.Update();\n\n         vtkPolyData output = vtkPolyData.New();\n         output.ShallowCopy(vtkPolyData.SafeDownCast(elevationFilter.GetOutput()));\n\n         vtkFloatArray elevation = \n            vtkFloatArray.SafeDownCast(output.GetPointData().GetArray(\"Elevation\"));\n\n         // Create the color map\n         vtkLookupTable colorLookupTable = vtkLookupTable.New();\n         colorLookupTable.SetTableRange(bounds[4], bounds[5]);\n         colorLookupTable.Build();\n\n         // Generate the colors for each point based on the color map\n         vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();\n         colors.SetNumberOfComponents(3);\n         colors.SetName(\"Colors\");\n\n         for(int i = 0; i < output.GetNumberOfPoints(); i++) {\n            double val = elevation.GetValue(i);\n            Debug.WriteLine(\"val: \" + val);\n\n            double[] dcolor = colorLookupTable.GetColor(val);\n            //Debug.WriteLine(\"dcolor: \"\n            //          + dcolor[0] + \" \"\n            //          + dcolor[1] + \" \"\n            //          + dcolor[2]);\n            byte[] color = new byte[3];\n            for(int j = 0; j < 3; j++) {\n               color[j] = (byte)( 255 * dcolor[j]);\n            }\n            //Debug.WriteLine(\"color: \"\n            //          + color[0] + \" \"\n            //          + color[1] + \" \"\n            //          + color[2]);\n\n            colors.InsertNextTuple3(color[0], color[1], color[2]);\n         }\n\n         output.GetPointData().AddArray(colors);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInputConnection(output.GetProducerPort());\n#else\n         mapper.SetInputData(output);\n#endif\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/ExtractEdges/","title":"ExtractEdges","text":"

        vtk-examples/CSharp/Meshes/ExtractEdges

        "},{"location":"CSharp/Meshes/ExtractEdges/#description","title":"Description","text":"

        This example shows how to extract the edges from a PolyData. In this case, we convert a sphere into a wireframe sphere. We demonstrate how to traverse the resulting edges.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/ExtractEdges/#code","title":"Code","text":"

        ExtractEdges.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ExtractEdges();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ExtractEdges() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         Debug.WriteLine(\"Sphere\" + Environment.NewLine + \"----------\");\n         Debug.WriteLine(\"There are \" + sphereSource.GetOutput().GetNumberOfCells() + \" cells.\");\n         Debug.WriteLine(\"There are \" + sphereSource.GetOutput().GetNumberOfPoints() + \" points.\");\n\n         vtkExtractEdges extractEdges = vtkExtractEdges.New();\n#if VTK_MAJOR_VERSION_5\n         extractEdges.SetInputConnection(sphereSource.GetOutputPort());\n#else\n         extractEdges.SetInputData(sphereSource);\n#endif\n         extractEdges.Update();\n\n         vtkCellArray lines = extractEdges.GetOutput().GetLines();\n         vtkPoints points = extractEdges.GetOutput().GetPoints();\n\n         Debug.WriteLine(Environment.NewLine + \"Edges\" + Environment.NewLine + \"----------\" );\n         Debug.WriteLine(\"There are \" + lines.GetNumberOfCells() + \" cells.\" );\n         Debug.WriteLine(\"There are \" + points.GetNumberOfPoints() + \" points.\" );\n\n         // Traverse all of the edges\n         for(int i = 0; i < extractEdges.GetOutput().GetNumberOfCells(); i++) {\n            //Debug.WriteLine(\"Type: \" + extractEdges.GetOutput().GetCell(i).GetClassName() );\n            vtkLine line = vtkLine.SafeDownCast(extractEdges.GetOutput().GetCell(i));\n            Debug.WriteLine(\"Line \" + i + \" : \" + line );\n         }\n\n         // Visualize the edges\n\n         // Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInputConnection(extractEdges.GetOutputPort());\n#else\n         mapper.SetInputData(extractEdges);\n#endif\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(1, 1, 1);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/FillHoles/","title":"FillHoles","text":"

        vtk-examples/CSharp/Meshes/FillHoles

        "},{"location":"CSharp/Meshes/FillHoles/#description","title":"Description","text":"

        This filter finds holes in a mesh and closes them.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/FillHoles/#code","title":"Code","text":"

        FillHoles.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            FillHoles(null);\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void FillHoles(string filePath) {\n         vtkPolyData input = vtkPolyData.New();\n         if(filePath == null) {\n            GenerateData(ref input);\n         }\n         else {\n         vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         input.ShallowCopy(reader.GetOutput());\n         }\n\n         vtkFillHolesFilter fillHolesFilter = vtkFillHolesFilter.New();\n#if VTK_MAJOR_VERSION_5\n         fillHolesFilter.SetInputConnection(input.GetProducerPort());\n#else\n         fillHolesFilter.SetInputData(input);\n#endif\n\n         fillHolesFilter.Update();\n\n         // Create a mapper and actor\n         vtkPolyDataMapper originalMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         originalMapper.SetInputConnection(input.GetProducerPort());\n#else\n         originalMapper.SetInputData(input);\n#endif\n\n         vtkActor originalActor = vtkActor.New();\n         originalActor.SetMapper(originalMapper);\n\n         vtkPolyDataMapper filledMapper = vtkPolyDataMapper.New();\n         filledMapper.SetInputConnection(fillHolesFilter.GetOutputPort());\n\n         vtkActor filledActor = vtkActor.New();\n         filledActor.SetMapper(filledMapper);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(originalActor);\n         rightRenderer.AddActor(filledActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n\n\n      void GenerateData(ref vtkPolyData input)\n      {\n        // Create a sphere\n        vtkSphereSource sphereSource = vtkSphereSource.New();\n        sphereSource.Update();\n\n        // Remove some cells\n        vtkIdTypeArray ids = vtkIdTypeArray.New();\n        ids.SetNumberOfComponents(1);\n\n        // Set values\n        ids.InsertNextValue(2);\n        ids.InsertNextValue(10);\n\n        vtkSelectionNode selectionNode = vtkSelectionNode.New();\n\n        selectionNode.SetFieldType((int)vtkSelectionNode.SelectionField.CELL);\n        selectionNode.SetContentType((int)vtkSelectionNode.SelectionContent.INDICES);\n        selectionNode.SetSelectionList(ids);\n        selectionNode.GetProperties().Set(vtkSelectionNode.INVERSE(), 1); //invert the selection\n\n        vtkSelection selection = vtkSelection.New();\n        selection.AddNode(selectionNode);\n\n        vtkExtractSelection extractSelection = vtkExtractSelection.New();\n        extractSelection.SetInputConnection(0, sphereSource.GetOutputPort());\n#if VTK_MAJOR_VERSION_5\n        extractSelection.SetInput(1, selection);\n#else\n        extractSelection.SetInputData(1, selection);\n#endif\n        extractSelection.Update();\n\n        // In selection\n        vtkDataSetSurfaceFilter surfaceFilter = vtkDataSetSurfaceFilter.New();\n        surfaceFilter.SetInputConnection(extractSelection.GetOutputPort());\n        surfaceFilter.Update();\n\n        input.ShallowCopy(surfaceFilter.GetOutput());\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/MatrixMathFilter/","title":"MatrixMathFilter","text":"

        vtk-examples/CSharp/Meshes/MatrixMathFilter

        "},{"location":"CSharp/Meshes/MatrixMathFilter/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/MatrixMathFilter/#code","title":"Code","text":"

        MatrixMathFilter.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            MatrixMathFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void MatrixMathFilter() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         string filePath = System.IO.Path.Combine(root, @\"Data\\tensors.vtk\");\n         vtkUnstructuredGridReader reader = vtkUnstructuredGridReader.New();\n         reader.SetFileName(filePath);\n         reader.Update();\n\n         vtkDataSetSurfaceFilter surfaceFilter = vtkDataSetSurfaceFilter.New();\n         surfaceFilter.SetInputConnection(reader.GetOutputPort());\n         surfaceFilter.Update();\n\n         vtkMatrixMathFilter matrixMathFilter = vtkMatrixMathFilter.New();\n         //matrixMathFilter.SetOperationToDeterminant();\n         matrixMathFilter.SetOperationToEigenvalue();\n         matrixMathFilter.SetInputConnection(surfaceFilter.GetOutputPort());\n         matrixMathFilter.Update();\n         matrixMathFilter.GetOutput().GetPointData().SetActiveScalars(\"Eigenvalue\");\n\n         vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n         writer.SetInputConnection(matrixMathFilter.GetOutputPort());\n         writer.SetFileName(System.IO.Path.Combine(root, @\"Data\\output.vtp\"));\n         writer.Write();\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(matrixMathFilter.GetOutputPort());\n\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/OBBDicer/","title":"OBBDicer","text":"

        vtk-examples/CSharp/Meshes/OBBDicer

        "},{"location":"CSharp/Meshes/OBBDicer/#description","title":"Description","text":"

        The [vtkOBBDicer](https://www.vtk.org/doc/nightly/html/classvtkOBBDicer.html#details) filter breaks up an input mesh into a number of pieces. The resulting mesh contains scalar point data that can be used to extract the individual pieces with a filter like vtkThresholdFilter. This examples displays the output of [vtkOBBDicer](https://www.vtk.org/doc/nightly/html/classvtkOBBDicer.html#details) with a different color for each piece.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/OBBDicer/#code","title":"Code","text":"

        OBBDicer.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            OBBDicer(null);\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void OBBDicer(string filePath) {\n         vtkPolyData inputPolyData;\n         if(filePath != null) {\n            vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n            reader.SetFileName(filePath);\n            reader.Update();\n            inputPolyData = reader.GetOutput();\n         }\n         else {\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.SetThetaResolution(30);\n            sphereSource.SetPhiResolution(15);\n            sphereSource.Update();\n            inputPolyData = sphereSource.GetOutput();\n         }\n\n         // Create pipeline\n         vtkOBBDicer dicer = vtkOBBDicer.New();\n#if VTK_MAJOR_VERSION_5\n         dicer.SetInput(inputPolyData);\n#else\n         dicer.SetInputData(inputPolyData);\n#endif\n         dicer.SetNumberOfPieces(4);\n         dicer.SetDiceModeToSpecifiedNumberOfPieces();\n         dicer.Update();\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n         inputMapper.SetInputConnection(dicer.GetOutputPort());\n         inputMapper.SetScalarRange(0, dicer.GetNumberOfActualPieces());\n\n         Debug.WriteLine(\"Asked for: \"\n                   + dicer.GetNumberOfPieces() + \" pieces, got: \"\n                   + dicer.GetNumberOfActualPieces());\n\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n         inputActor.GetProperty().SetInterpolationToFlat();\n\n         vtkOutlineCornerFilter outline = vtkOutlineCornerFilter.New();\n#if VTK_MAJOR_VERSION_5\n         outline.SetInput(inputPolyData);\n#else\n         outline.SetInputData(inputPolyData);\n#endif\n\n         vtkPolyDataMapper outlineMapper = vtkPolyDataMapper.New();\n         outlineMapper.SetInputConnection(outline.GetOutputPort());\n\n         vtkActor outlineActor = vtkActor.New();\n         outlineActor.SetMapper(outlineMapper);\n         outlineActor.GetProperty().SetColor(0, 0, 0);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(inputActor);\n         renderer.AddActor(outlineActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/QuadricClustering/","title":"QuadricClustering","text":"

        vtk-examples/CSharp/Meshes/QuadricClustering

        "},{"location":"CSharp/Meshes/QuadricClustering/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/QuadricClustering/#code","title":"Code","text":"

        QuadricClustering.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            QuadricClustering();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void QuadricClustering() { \n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkPolyData input = vtkPolyData.New();\n         input.ShallowCopy(sphereSource.GetOutput());\n\n         Debug.WriteLine(\"Before decimation\" + Environment.NewLine + \"------------\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkQuadricClustering decimate = vtkQuadricClustering.New();\n#if VTK_MAJOR_VERSION_5\n         decimate.SetInputConnection(input.GetProducerPort());\n#else\n         decimate.SetInputData(input);\n#endif\n         decimate.Update();\n\n         vtkPolyData decimated = vtkPolyData.New();\n         decimated.ShallowCopy(decimate.GetOutput());\n\n         Debug.WriteLine(\"After decimation\" + Environment.NewLine + \"------------\" );\n\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInputConnection(input.GetProducerPort());\n#else\n         inputMapper.SetInputData(input);\n#endif\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n\n         vtkPolyDataMapper decimatedMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         decimatedMapper.SetInputConnection(decimated.GetProducerPort());\n#else\n         decimatedMapper.SetInputData(decimated);\n#endif\n         vtkActor decimatedActor = vtkActor.New();\n         decimatedActor.SetMapper(decimatedMapper);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(inputActor);\n         rightRenderer.AddActor(decimatedActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/QuadricDecimation/","title":"QuadricDecimation","text":"

        vtk-examples/CSharp/Meshes/QuadricDecimation

        "},{"location":"CSharp/Meshes/QuadricDecimation/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/QuadricDecimation/#code","title":"Code","text":"

        QuadricDecimation.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            QuadricDecimation();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void QuadricDecimation() { \n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkPolyData input = vtkPolyData.New();\n         input.ShallowCopy(sphereSource.GetOutput());\n\n         Debug.WriteLine(\"Before decimation\" + Environment.NewLine + \"------------\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + input.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkQuadricDecimation decimate = vtkQuadricDecimation.New();\n#if VTK_MAJOR_VERSION_5\n         decimate.SetInputConnection(input.GetProducerPort());\n#else\n         decimate.SetInputData(input);\n#endif\n         decimate.Update();\n\n         vtkPolyData decimated = vtkPolyData.New();\n         decimated.ShallowCopy(decimate.GetOutput());\n\n         Debug.WriteLine(\"After decimation\" + Environment.NewLine + \"------------\" );\n\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPoints() + \" points.\" );\n         Debug.WriteLine(\"There are \" + decimated.GetNumberOfPolys() + \" polygons.\" );\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInputConnection(input.GetProducerPort());\n#else\n         inputMapper.SetInputData(input);\n#endif\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n\n         vtkPolyDataMapper decimatedMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         decimatedMapper.SetInputConnection(decimated.GetProducerPort());\n#else\n         decimatedMapper.SetInputData(decimated);\n#endif\n         vtkActor decimatedActor = vtkActor.New();\n         decimatedActor.SetMapper(decimatedMapper);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(inputActor);\n         rightRenderer.AddActor(decimatedActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/SimpleElevationFilter/","title":"SimpleElevationFilter","text":"

        vtk-examples/CSharp/Meshes/SimpleElevationFilter

        "},{"location":"CSharp/Meshes/SimpleElevationFilter/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/SimpleElevationFilter/#code","title":"Code","text":"

        SimpleElevationFilter.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            SimpleElevationFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void SimpleElevationFilter() {\n         // Created a grid of points (heigh/terrian map)\n         vtkPoints points = vtkPoints.New();\n\n         uint GridSize = 10;\n         for(uint x = 0; x < GridSize; x++) {\n            for(uint y = 0; y < GridSize; y++) {\n               points.InsertNextPoint(x, y, ( x + y ) / ( y + 1 ));\n            }\n         }\n         double[] bounds = points.GetBounds();\n\n         // Add the grid points to a polydata object\n         vtkPolyData inputPolyData = vtkPolyData.New();\n         inputPolyData.SetPoints(points);\n\n         // Triangulate the grid points\n         vtkDelaunay2D delaunay = vtkDelaunay2D.New();\n#if VTK_MAJOR_VERSION_5\n         delaunay.SetInput(inputPolyData);\n#else\n         delaunay.SetInputData(inputPolyData);\n#endif\n         delaunay.Update();\n\n         vtkSimpleElevationFilter elevationFilter = vtkSimpleElevationFilter.New();\n         elevationFilter.SetInputConnection(delaunay.GetOutputPort());\n         elevationFilter.SetVector(0.0, 0.0, 1.0);\n         elevationFilter.Update();\n\n         vtkPolyData output = vtkPolyData.New();\n         output.ShallowCopy(vtkPolyData.SafeDownCast(elevationFilter.GetOutput()));\n\n         vtkFloatArray elevation = \n            vtkFloatArray.SafeDownCast(output.GetPointData().GetArray(\"Elevation\"));\n\n         // Create the color map\n         vtkLookupTable colorLookupTable = vtkLookupTable.New();\n         colorLookupTable.SetTableRange(bounds[4], bounds[5]);\n         colorLookupTable.Build();\n\n         // Generate the colors for each point based on the color map\n         vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();\n         colors.SetNumberOfComponents(3);\n         colors.SetName(\"Colors\");\n\n         for(int i = 0; i < output.GetNumberOfPoints(); i++) {\n            double val = elevation.GetValue(i);\n            Debug.WriteLine(\"val: \" + val);\n\n            double[] dcolor = colorLookupTable.GetColor(val);\n            //Debug.WriteLine(\"dcolor: \"\n            //          + dcolor[0] + \" \"\n            //          + dcolor[1] + \" \"\n            //          + dcolor[2]);\n            byte[] color = new byte[3];\n            for(int j = 0; j < 3; j++) {\n               color[j] = (byte)( 255 * dcolor[j] );\n            }\n            //Debug.WriteLine(\"color: \"\n            //          + color[0] + \" \"\n            //          + color[1] + \" \"\n            //          + color[2]);\n\n            colors.InsertNextTuple3(color[0], color[1], color[2]);\n         }\n\n         output.GetPointData().AddArray(colors);\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInputConnection(output.GetProducerPort());\n#else\n         mapper.SetInputData(output);\n#endif\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/SolidClip/","title":"SolidClip","text":"

        vtk-examples/CSharp/Meshes/SolidClip

        "},{"location":"CSharp/Meshes/SolidClip/#description","title":"Description","text":"

        This example clips a mesh and applies a backface property to that mesh that appears to have a solid interior.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/SolidClip/#code","title":"Code","text":"

        SolidClip.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            SolidClip();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void SolidClip() {\n         // Create a superquadric\n         vtkSuperquadricSource superquadricSource = vtkSuperquadricSource.New();\n         superquadricSource.SetPhiRoundness(3.1);\n         superquadricSource.SetThetaRoundness(2.2);\n\n         // Define a clipping plane\n         vtkPlane clipPlane = vtkPlane.New();\n         clipPlane.SetNormal(1.0, -1.0, -1.0);\n         clipPlane.SetOrigin(0.0, 0.0, 0.0);\n\n         // Clip the source with the plane\n         vtkClipPolyData clipper = vtkClipPolyData.New();\n#if VTK_MAJOR_VERSION_5\n         clipper.SetInputConnection(superquadricSource.GetOutputPort());\n#else\n         clipper.SetInputData(superquadricSource);\n#endif\n         clipper.SetClipFunction(clipPlane);\n\n         //Create a mapper and actor\n         vtkPolyDataMapper superquadricMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         superquadricMapper.SetInputConnection(clipper.GetOutputPort());\n#else\n         superquadricMapper.SetInputData(clipper);\n#endif\n         vtkActor superquadricActor = vtkActor.New();\n         superquadricActor.SetMapper(superquadricMapper);\n\n         // Create a property to be used for the back faces. Turn off all\n         // shading by specifying 0 weights for specular and diffuse. Max the\n         // ambient.\n         vtkProperty backFaces = vtkProperty.New();\n         backFaces.SetSpecular(0.0);\n         backFaces.SetDiffuse(0.0);\n         backFaces.SetAmbient(1.0);\n         backFaces.SetAmbientColor(1.0000, 0.3882, 0.2784);\n\n         superquadricActor.SetBackfaceProperty(backFaces);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // add our actor to the renderer\n         renderer.AddActor(superquadricActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/Subdivision/","title":"Subdivision","text":"

        vtk-examples/CSharp/Meshes/Subdivision

        "},{"location":"CSharp/Meshes/Subdivision/#description","title":"Description","text":"

        In this example a mesh is read from a file and then subdivided using linear subdivision. The SetNumberOfSubdivisions(n) function controls how many times the mesh is subdivided. For each n, the number of triangles will increase by approximately a factor of 4. For example, if n=2, the number of triangles in the resulting mesh will be 16x the number of triangles in the original mesh. Different types of subdivisions can be obtained by replacing [vtkLinearSubdivisionFilter](https://www.vtk.org/doc/nightly/html/classvtkLinearSubdivisionFilter.html#details) with either [vtkLoopSubdivisionFilter](https://www.vtk.org/doc/nightly/html/classvtkLoopSubdivisionFilter.html#details) or [vtkButterflySubdivisionFilter](https://www.vtk.org/doc/nightly/html/classvtkButterflySubdivisionFilter.html#details).

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/Subdivision/#code","title":"Code","text":"

        Subdivision.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Subdivision(null); // you may provide a full path to a *.vtu file\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Subdivision(string filePath) {\n         vtkPolyData originalMesh;\n         if(filePath != null) {\n            vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n            reader.SetFileName(filePath);\n            // Subdivision filters only work on triangles\n            vtkTriangleFilter triangles = vtkTriangleFilter.New();\n            triangles.SetInputConnection(reader.GetOutputPort());\n            triangles.Update();\n            originalMesh = triangles.GetOutput();\n         }\n         else {\n            vtkSphereSource sphereSource = vtkSphereSource.New();\n            sphereSource.Update();\n            originalMesh = sphereSource.GetOutput();\n         }\n         Debug.WriteLine(\"Before subdivision\");\n         Debug.WriteLine(\"    There are \" + originalMesh.GetNumberOfPoints()\n            + \" points.\");\n         Debug.WriteLine(\"    There are \" + originalMesh.GetNumberOfPolys()\n            + \" triangles.\");\n\n         int numberOfViewports = 3;\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(200 * numberOfViewports + 12, 252);\n         this.Text += \" - Subdivision\";\n         Random rnd = new Random(2);\n         int numberOfSubdivisions = 2;\n\n         // Create one text property for all\n         vtkTextProperty textProperty = vtkTextProperty.New();\n         textProperty.SetFontSize(14);\n         textProperty.SetJustificationToCentered();\n\n         for(int i = 0; i < numberOfViewports; i++) {\n            // Note: Here we create a superclass pointer (vtkPolyDataAlgorithm) so that we can easily instantiate different\n            // types of subdivision filters. Typically you would not want to do this, but rather create the pointer to be the type\n            // filter you will actually use, e.g. \n            // <vtkLinearSubdivisionFilter>  subdivisionFilter = <vtkLinearSubdivisionFilter>.New();\n            vtkPolyDataAlgorithm subdivisionFilter;\n            switch(i) {\n               case 0:\n                  subdivisionFilter = vtkLinearSubdivisionFilter.New();\n                  ( (vtkLinearSubdivisionFilter)subdivisionFilter ).SetNumberOfSubdivisions(numberOfSubdivisions);\n                  break;\n               case 1:\n                  subdivisionFilter = vtkLoopSubdivisionFilter.New();\n                  ( (vtkLoopSubdivisionFilter)subdivisionFilter ).SetNumberOfSubdivisions(numberOfSubdivisions);\n                  break;\n               case 2:\n                  subdivisionFilter = vtkButterflySubdivisionFilter.New();\n                  ( (vtkButterflySubdivisionFilter)subdivisionFilter ).SetNumberOfSubdivisions(numberOfSubdivisions);\n                  break;\n               default:\n                  subdivisionFilter = vtkLinearSubdivisionFilter.New();\n                  ( (vtkLinearSubdivisionFilter)subdivisionFilter ).SetNumberOfSubdivisions(numberOfSubdivisions);\n                  break;\n            }\n#if VTK_MAJOR_VERSION_5\n            subdivisionFilter.SetInputConnection(originalMesh.GetProducerPort());\n#else\n            subdivisionFilter.SetInputData(originalMesh);\n#endif\n            subdivisionFilter.Update();\n            vtkRenderer renderer = vtkRenderer.New();\n            renderWindow.AddRenderer(renderer);\n            renderer.SetViewport((float)i / numberOfViewports, 0, (float)( i + 1 ) / numberOfViewports, 1);\n            renderer.SetBackground(.2 + rnd.NextDouble() / 8, .3 + rnd.NextDouble() / 8, .4 + rnd.NextDouble() / 8);\n\n            vtkTextMapper textMapper = vtkTextMapper.New();\n            vtkActor2D textActor = vtkActor2D.New();\n            textMapper.SetInput(subdivisionFilter.GetClassName());\n            textMapper.SetTextProperty(textProperty);\n\n            textActor.SetMapper(textMapper);\n            textActor.SetPosition(100, 16);\n\n            //Create a mapper and actor\n            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n            mapper.SetInputConnection(subdivisionFilter.GetOutputPort());\n            vtkActor actor = vtkActor.New();\n            actor.SetMapper(mapper);\n            renderer.AddActor(actor);\n            renderer.AddActor(textActor);\n            renderer.ResetCamera();\n         }\n         renderWindow.Render();\n      }\n   }\n}\n

        "},{"location":"CSharp/Meshes/Triangulate/","title":"Triangulate","text":"

        vtk-examples/CSharp/Meshes/Triangulate

        "},{"location":"CSharp/Meshes/Triangulate/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/Triangulate/#code","title":"Code","text":"

        Triangulate.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Triangulate();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Triangulate() {\n         vtkRegularPolygonSource polygonSource = vtkRegularPolygonSource.New();\n         polygonSource.Update();\n\n         vtkTriangleFilter triangleFilter = vtkTriangleFilter.New();\n#if VTK_MAJOR_VERSION_5\n         triangleFilter.SetInputConnection(polygonSource.GetOutputPort());\n#else\n         triangleFilter.SetInputData(polygonSource);\n#endif\n         triangleFilter.Update();\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInputConnection(polygonSource.GetOutputPort());\n#else\n         inputMapper.SetInputData(polygonSource);\n#endif\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n         inputActor.GetProperty().SetRepresentationToWireframe();\n\n         vtkPolyDataMapper triangleMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         triangleMapper.SetInputConnection(triangleFilter.GetOutputPort());\n#else\n         triangleMapper.SetInputData(triangleFilter);\n#endif\n         vtkActor triangleActor = vtkActor.New();\n         triangleActor.SetMapper(triangleMapper);\n         triangleActor.GetProperty().SetRepresentationToWireframe();\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(inputActor);\n         rightRenderer.AddActor(triangleActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n   }\n}\n
        "},{"location":"CSharp/Meshes/WindowedSincPolyDataFilter/","title":"WindowedSincPolyDataFilter","text":"

        vtk-examples/CSharp/Meshes/WindowedSincPolyDataFilter

        "},{"location":"CSharp/Meshes/WindowedSincPolyDataFilter/#description","title":"Description","text":"

        This example demonstrates how to smooth a mesh.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Meshes/WindowedSincPolyDataFilter/#code","title":"Code","text":"

        WindowedSincPolyDataFilter.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WindowedSincPolyDataFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WindowedSincPolyDataFilter() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkWindowedSincPolyDataFilter smoother = vtkWindowedSincPolyDataFilter.New();\n         smoother.SetInputConnection(sphereSource.GetOutputPort());\n         smoother.SetNumberOfIterations(15);\n         smoother.BoundarySmoothingOff();\n         smoother.FeatureEdgeSmoothingOff();\n         smoother.SetFeatureAngle(120.0);\n         smoother.SetPassBand(.001);\n         smoother.NonManifoldSmoothingOn();\n         smoother.NormalizeCoordinatesOn();\n         smoother.Update();\n\n         vtkPolyDataMapper smoothedMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         smoothedMapper.SetInputConnection(smoother.GetOutputPort());\n#else\n         smoothedMapper.SetInputData(smoother);\n#endif\n         vtkActor smoothedActor = vtkActor.New();\n         smoothedActor.SetMapper(smoothedMapper);\n\n         vtkPolyDataMapper inputMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         inputMapper.SetInputConnection(sphereSource.GetOutputPort());\n#else\n         inputMapper.SetInputData(sphereSource);\n#endif\n         vtkActor inputActor = vtkActor.New();\n         inputActor.SetMapper(inputMapper);\n\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         this.Size = new System.Drawing.Size(612, 352);\n\n         // Define viewport ranges\n         // (xmin, ymin, xmax, ymax)\n         double[] leftViewport = new double[] { 0.0, 0.0, 0.5, 1.0 };\n         double[] rightViewport = new double[] { 0.5, 0.0, 1.0, 1.0 };\n\n         // Setup both renderers\n         vtkRenderer leftRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(leftRenderer);\n         leftRenderer.SetViewport(leftViewport[0], leftViewport[1], leftViewport[2], leftViewport[3]);\n         leftRenderer.SetBackground(.6, .5, .4);\n\n         vtkRenderer rightRenderer = vtkRenderer.New();\n         renderWindow.AddRenderer(rightRenderer);\n         rightRenderer.SetViewport(rightViewport[0], rightViewport[1], rightViewport[2], rightViewport[3]);\n         rightRenderer.SetBackground(.4, .5, .6);\n\n         // Add the sphere to the left and the cube to the right\n         leftRenderer.AddActor(inputActor);\n         rightRenderer.AddActor(smoothedActor);\n         leftRenderer.ResetCamera();\n         rightRenderer.ResetCamera();\n         renderWindow.Render();\n      }\n   }\n}\n
        "},{"location":"CSharp/Modelling/ExtractLargestIsosurface/","title":"ExtractLargestIsosurface","text":"

        vtk-examples/CSharp/Modelling/ExtractLargestIsosurface

        "},{"location":"CSharp/Modelling/ExtractLargestIsosurface/#description","title":"Description","text":"
        • Contributed by: Jinyoung Hwang

        This example reads a structured points dataset stored in a .vtk file and constructs a 3D model using vtkMarchingCubes. vtkPolyDataConnectivityFilter is used to extract the largest isosurface.

        Data is available at:

        1. test.vtk: http://web.kaist.ac.kr/~hjy/test.vtk

        2. brainweb.img: http://web.kaist.ac.kr/~hjy/brainweb.img

        3. brainweb.hdr: http://web.kaist.ac.kr/~hjy/brainweb.hdr

        Second and third datasets can be downloaded from BrainWeb, which is free of charge in use for a research. \"test.vtk\" was converted from \"brainweb.img\" using a program by Erik Vidholm (http://www.cb.uu.se/~erik/vtk/rawToVTK.cpp).

        The examples expects 2 or 3 argments:

         ExtractLargestIsosurface InputFilename Threshold ExtractLargest\n  if ExtractLargest is omitted or 1, the largest isosurface is extracted\n  if ExtractLargest is 0, all of the isosurfaces are extracted\n

        Try

        ExtractLargestIsosurface test.vtk 50 1\n

        and compare the results to

         ExtractLargestIsosurface test.vtk 50 0\n

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Modelling/ExtractLargestIsosurface/#code","title":"Code","text":"

        ExtractLargestIsosurface.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            // don't forget to adapt the file path\n            ExtractLargestIsoSurface(\"test.vtk\", 50, true);\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ExtractLargestIsoSurface(string filePath, double threshold, bool extractLargest) { \n         // Load data\n         vtkStructuredPointsReader reader = vtkStructuredPointsReader.New();\n         reader.SetFileName(filePath);\n\n         // Create a 3D model using marching cubes\n         vtkMarchingCubes mc = vtkMarchingCubes.New();\n         mc.SetInputConnection(reader.GetOutputPort());\n         mc.ComputeNormalsOn();\n         mc.ComputeGradientsOn();\n         mc.SetValue(0, threshold);  // second value acts as threshold\n\n         // To remain largest region\n         vtkPolyDataConnectivityFilter confilter = vtkPolyDataConnectivityFilter.New();\n         confilter.SetInputConnection(mc.GetOutputPort());\n         confilter.SetExtractionModeToLargestRegion();\n\n         // Create a mapper\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         if(extractLargest) {\n            mapper.SetInputConnection(confilter.GetOutputPort());\n         }\n         else {\n            mapper.SetInputConnection(mc.GetOutputPort());\n         }\n\n         mapper.ScalarVisibilityOff();    // utilize actor's property I set\n\n         // Visualize\n         vtkActor actor = vtkActor.New();\n         actor.GetProperty().SetColor(1, 1, 1);\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/Modelling/MarchingCubes/","title":"MarchingCubes","text":"

        vtk-examples/CSharp/Modelling/MarchingCubes

        "},{"location":"CSharp/Modelling/MarchingCubes/#description","title":"Description","text":"

        Voxelizes a sphere and creates a model with Marching Cubes. '''NOTE:''' [vtkVoxelModeller](https://www.vtk.org/doc/nightly/html/classvtkVoxelModeller.html#details) by default produces a VTK_BIT scalar image. Marching Cubes does not support this type. The scalar output is set to float for this example.

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Modelling/MarchingCubes/#code","title":"Code","text":"

        MarchingCubes.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            MarchingCubes();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void MarchingCubes() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.SetPhiResolution(20);\n         sphereSource.SetThetaResolution(20);\n         sphereSource.Update();\n\n         double[] bounds = sphereSource.GetOutput().GetBounds();\n         for(int i = 0; i < 6; i += 2) {\n            double range = bounds[i + 1] - bounds[i];\n            bounds[i] = bounds[i] - .1 * range;\n            bounds[i + 1] = bounds[i + 1] + .1 * range;\n         }\n         vtkVoxelModeller voxelModeller = vtkVoxelModeller.New();\n         voxelModeller.SetSampleDimensions(50, 50, 50);\n         voxelModeller.SetModelBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);\n         voxelModeller.SetScalarTypeToFloat();\n         voxelModeller.SetMaximumDistance(.1);\n\n#if VTK_MAJOR_VERSION_5\n         voxelModeller.SetInputConnection(sphereSource.GetOutputPort());\n#else\n         voxelModeller.SetInputData(sphereSource);\n#endif\n         vtkMarchingCubes surface = vtkMarchingCubes.New();\n\n#if VTK_MAJOR_VERSION_5\n         surface.SetInputConnection(voxelModeller.GetOutputPort());\n#else\n         surface.SetInputData(voxelModeller);\n#endif\n         surface.ComputeNormalsOn();\n         surface.SetValue(0, 0.5);\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInputConnection(surface.GetOutputPort());\n#else\n         mapper.SetInputData(surface);\n#endif\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/Modelling/MarchingSquares/","title":"MarchingSquares","text":"

        vtk-examples/CSharp/Modelling/MarchingSquares

        "},{"location":"CSharp/Modelling/MarchingSquares/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/Modelling/MarchingSquares/#code","title":"Code","text":"

        MarchingSquares.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            MarchingSquares();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void MarchingSquares() { \n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n\n         vtkVolume16Reader v16 = vtkVolume16Reader.New();\n         v16.SetDataDimensions(64, 64); \n\n         v16.GetOutput().SetOrigin(0.0, 0.0, 0.0);\n         v16.SetDataByteOrderToLittleEndian();\n         v16.SetFilePrefix(System.IO.Path.Combine(root, @\"Data\\headsq\\quarter\"));\n         v16.SetImageRange(1, 93);\n         v16.SetDataSpacing(3.2, 3.2, 1.5);\n         v16.Update();\n\n         vtkMergePoints myLocator = vtkMergePoints.New();\n\n         vtkMarchingSquares isoXY = vtkMarchingSquares.New();\n\n#if VTK_MAJOR_VERSION_5\n         isoXY.SetInputConnection(v16.GetOutputPort());\n#else\n         isoXY.SetInputData(v16);\n#endif\n         isoXY.GenerateValues(2, 600, 1200);\n         isoXY.SetImageRange(0, 32, 32, 63, 45, 45);\n         isoXY.SetLocator(myLocator);\n\n         vtkPolyDataMapper isoXYMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         isoXYMapper.SetInputConnection(isoXY.GetOutputPort());\n#else\n         isoXYMapper.SetInputData(isoXY);\n#endif\n         isoXYMapper.SetScalarRange(600, 1200);\n\n         vtkActor isoXYActor = vtkActor.New();\n         isoXYActor.SetMapper(isoXYMapper);\n\n         vtkMarchingSquares isoYZ = vtkMarchingSquares.New();\n#if VTK_MAJOR_VERSION_5\n         isoYZ.SetInputConnection(v16.GetOutputPort());\n#else\n         isoYZ.SetInputData(v16);\n#endif\n         isoYZ.GenerateValues(2, 600, 1200);\n         isoYZ.SetImageRange(32, 32, 32, 63, 46, 92);\n\n         vtkPolyDataMapper isoYZMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         isoYZMapper.SetInputConnection(isoYZ.GetOutputPort());\n#else\n         isoYZMapper.SetInputData(isoYZ);\n#endif\n         isoYZMapper.SetScalarRange(600, 1200);\n\n         vtkActor isoYZActor = vtkActor.New();\n         isoYZActor.SetMapper(isoYZMapper);\n\n         vtkMarchingSquares isoXZ  = vtkMarchingSquares.New();\n#if VTK_MAJOR_VERSION_5\n         isoXZ.SetInputConnection(v16.GetOutputPort());\n#else\n         isoXZ.SetInputData(v16);\n#endif\n         isoXZ.GenerateValues(2, 600, 1200);\n         isoXZ.SetImageRange(0, 32, 32, 32, 0, 46);\n\n         vtkPolyDataMapper isoXZMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         isoXZMapper.SetInputConnection(isoXZ.GetOutputPort());\n#else\n         isoXZMapper.SetInputData(isoXZ);\n#endif\n         isoXZMapper.SetScalarRange(600, 1200);\n\n         vtkActor isoXZActor = vtkActor.New();\n         isoXZActor.SetMapper(isoXZMapper);\n\n         vtkOutlineFilter outline  = vtkOutlineFilter.New();\n#if VTK_MAJOR_VERSION_5\n         outline.SetInputConnection(v16.GetOutputPort());\n#else\n         outline.SetInputData(v16);\n#endif\n         vtkPolyDataMapper outlineMapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         outlineMapper.SetInputConnection(outline.GetOutputPort());\n#else\n         outlineMapper.SetInputData(outline);\n#endif\n         vtkActor outlineActor = vtkActor.New();\n         outlineActor.SetMapper(outlineMapper);\n         outlineActor.VisibilityOff();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(1.0, 1.0, 1.0);\n         //Add the actors to the renderer, set the background and size \n         renderer.AddActor(outlineActor);\n         renderer.AddActor(isoXYActor);\n         renderer.AddActor(isoYZActor);\n         renderer.AddActor(isoXZActor);\n         renderer.GetActiveCamera().SetPosition(324.368, 284.266, -19.3293);\n         renderer.GetActiveCamera().SetFocalPoint(73.5683, 120.903, 70.7309);\n         renderer.GetActiveCamera().SetViewAngle(30);\n         renderer.GetActiveCamera().SetViewUp(-0.304692, -0.0563843, -0.950781);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/AlignFrames/","title":"AlignFrames","text":"

        vtk-examples/CSharp/PolyData/AlignFrames

        "},{"location":"CSharp/PolyData/AlignFrames/#description","title":"Description","text":"

        This function takes two frames and finds the matrix M between them.

        A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/AlignFrames/#code","title":"Code","text":"

        AlignFrames.cs

        using System;\nusing System.Runtime.InteropServices;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n\n      struct Frame {\n         private float[] origin;\n         private float[] xDirection;\n         private float[] yDirection;\n         private float[] zDirection;\n\n         internal float[] Origin {\n            get { return origin; }\n         }\n\n         internal float[] XDirection {\n            get { return xDirection; }\n         }\n\n         internal float[] YDirection {\n            get { return yDirection; }\n         }\n\n         internal float[] ZDirection {\n            get { return zDirection; }\n         }\n\n         internal Frame(float[] origin, float[] xDirection, float[] yDirection, float[] zDirection) {\n            this.origin = new float[3];\n            this.xDirection = new float[3];\n            this.yDirection = new float[3];\n            this.zDirection = new float[3];\n            origin.CopyTo(this.origin, 0);\n            xDirection.CopyTo(this.xDirection, 0);\n            yDirection.CopyTo(this.yDirection, 0);\n            zDirection.CopyTo(this.zDirection, 0);\n\n            Normalize(ref xDirection);\n            Normalize(ref yDirection);\n            Normalize(ref zDirection);\n\n            Console.WriteLine(\"Origin: \" + \n               this.origin[0] + \" \" + \n               this.origin[1] + \" \" + \n               this.origin[2]);\n            Console.WriteLine(\"xDirection: \" + \n               this.xDirection[0] + \" \" + \n               this.xDirection[1] + \" \" + \n               this.xDirection[2]);\n            Console.WriteLine(\"yDirection: \" + \n               this.yDirection[0] + \" \" + \n               this.yDirection[1] + \" \" + \n               this.yDirection[2]);\n            Console.WriteLine(\"zDirection: \" + \n               this.zDirection[0] + \" \" + \n               this.zDirection[1] + \" \" + \n               this.zDirection[2]);\n         }\n\n\n         private void Normalize(ref float[] vector) {\n            IntPtr pDirection = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * 3);\n            Marshal.Copy(vector, 0, pDirection, 3);\n            vtkMath.Normalize(pDirection);\n            Marshal.FreeHGlobal(pDirection);\n         }\n\n\n         internal void ApplyTransform(ref vtkTransform transform, string filename) {\n            vtkPolyData polydata = vtkPolyData.New();\n            CreatePolydata(ref polydata);\n\n            vtkTransformFilter transformFilter = vtkTransformFilter.New();\n#if VTK_MAJOR_VERSION_5\n            transformFilter.SetInputConnection(polydata.GetProducerPort());\n#else\n            transformFilter.SetInputData(polydata);\n#endif\n            transformFilter.SetTransform(transform);\n            transformFilter.Update();\n\n            vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n            writer.SetFileName(filename);\n#if VTK_MAJOR_VERSION_5\n            writer.SetInputConnection(transformFilter.GetOutputPort());\n#else\n            writer.SetInputData(transformFilter);\n#endif\n            writer.Write();\n         }\n\n\n         internal void CreatePolydata(ref vtkPolyData polydata) {\n            vtkPoints points = vtkPoints.New();\n\n            points.InsertNextPoint(this.origin[0], this.origin[1], this.origin[2]);\n\n            float[] x = new float[3];\n            float[] y = new float[3];\n            float[] z = new float[3];\n\n            Add(this.origin, this.xDirection, ref x);\n            Add(this.origin, this.yDirection, ref y);\n            Add(this.origin, this.zDirection, ref z);\n\n            points.InsertNextPoint(x[0], x[1], x[2]);\n            points.InsertNextPoint(y[0], y[1], y[2]);\n            points.InsertNextPoint(z[0], z[1], z[2]);\n\n            polydata.SetPoints(points);\n\n            vtkVertexGlyphFilter vertexGlyphFilter = vtkVertexGlyphFilter.New();\n#if VTK_MAJOR_VERSION_5\n            vertexGlyphFilter.AddInput(polydata);\n#else\n            vertexGlyphFilter.AddInputData(polydata);\n#endif\n            vertexGlyphFilter.Update();\n            polydata.ShallowCopy(vertexGlyphFilter.GetOutput());\n         }\n\n\n         internal void Write(string filename) {\n            vtkPolyData polydata = vtkPolyData.New();\n            CreatePolydata(ref polydata);\n\n            vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n            writer.SetFileName(filename);\n#if VTK_MAJOR_VERSION_5\n            writer.SetInputConnection(polydata.GetProducerPort());\n#else\n            writer.SetInputData(polydata);\n#endif\n            writer.Write();\n         }\n      }\n\n\n      static void Main(string[] args) {\n         float[] frame1origin = new float[] { 0, 0, 0 };\n         float[] frame1XDirection = new float[] { 1, 0, 0 };\n         float[] frame1YDirection = new float[] { 0, 1, 0 };\n         Console.WriteLine(frame1YDirection[0] + \" \" + frame1YDirection[1] + \" \" + frame1YDirection[2]);\n         float[] frame1ZDirection = new float[] { 0, 0, 1 };\n         Frame frame1 = new Frame(frame1origin, frame1XDirection, frame1YDirection, frame1ZDirection);\n         Console.WriteLine(\"\\nWriting frame1.vtp...\");\n         // adjust path\n         frame1.Write(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\frame1.vtp\");\n\n         float[] frame2origin = new float[] { 0, 0, 0 };\n         float[] frame2XDirection = new float[] { .707f, .707f, 0 };\n         float[] frame2YDirection = new float[] { -.707f, .707f, 0 };\n         float[] frame2ZDirection = new float[] { 0, 0, 1 };\n         Frame frame2 = new Frame(frame2origin, frame2XDirection, frame2YDirection, frame2ZDirection);\n         Console.WriteLine(\"\\nWriting frame2.vtp...\");\n         // adjust path\n         frame2.Write(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\frame2.vtp\");\n\n         vtkTransform transform = vtkTransform.New();\n         AlignFrames(frame2, frame1, ref transform); // Brings frame2 to frame1\n\n         Console.WriteLine(\"\\nWriting transformed.vtp...\");\n         // adjust path\n         frame2.ApplyTransform(ref transform, @\"c:\\vtk\\vtkdata-5.8.0\\Data\\transformed.vtp\");\n\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      static void AlignFrames(Frame sourceFrame, Frame targetFrame, ref vtkTransform transform) {\n         // This function takes two frames and finds the matrix M between them.\n         vtkLandmarkTransform landmarkTransform = vtkLandmarkTransform.New();\n\n         // Setup source points\n         vtkPoints sourcePoints = vtkPoints.New();\n\n         sourcePoints.InsertNextPoint(\n            sourceFrame.Origin[0], \n            sourceFrame.Origin[1], \n            sourceFrame.Origin[2]);\n\n         float[] sourceX = new float[3];\n         float[] sourceY = new float[3];\n         float[] sourceZ = new float[3];\n\n         Add(sourceFrame.Origin, sourceFrame.XDirection, ref sourceX);\n         Add(sourceFrame.Origin, sourceFrame.YDirection, ref sourceY);\n         Add(sourceFrame.Origin, sourceFrame.ZDirection, ref sourceZ);\n\n         sourcePoints.InsertNextPoint(sourceX[0], sourceX[1], sourceX[2]);\n         sourcePoints.InsertNextPoint(sourceY[0], sourceY[1], sourceY[2]);\n         sourcePoints.InsertNextPoint(sourceZ[0], sourceZ[1], sourceZ[2]);\n\n         // Setup target points\n         vtkPoints targetPoints = vtkPoints.New();\n         targetPoints.InsertNextPoint(targetFrame.Origin[0], targetFrame.Origin[1], targetFrame.Origin[2]);\n\n         float[] targetX = new float[3];\n         float[] targetY = new float[3];\n         float[] targetZ = new float[3];\n\n         Add(targetFrame.Origin, targetFrame.XDirection, ref targetX);\n         Add(targetFrame.Origin, targetFrame.YDirection, ref targetY);\n         Add(targetFrame.Origin, targetFrame.ZDirection, ref targetZ);\n\n         targetPoints.InsertNextPoint(targetX[0], targetX[1], targetX[2]);\n         targetPoints.InsertNextPoint(targetY[0], targetY[1], targetY[2]);\n         targetPoints.InsertNextPoint(targetZ[0], targetZ[1], targetZ[2]);\n\n         landmarkTransform.SetSourceLandmarks(sourcePoints);\n         landmarkTransform.SetTargetLandmarks(targetPoints);\n         landmarkTransform.SetModeToRigidBody();\n         landmarkTransform.Update();\n\n         vtkMatrix4x4 M = landmarkTransform.GetMatrix();\n         transform.SetMatrix(M);\n      }\n\n      // helper function\n      static void Add(float[] vec1, float[] vec2, ref float[] vec) {\n         vec[0] = vec1[0] + vec2[0];\n         vec[1] = vec1[1] + vec2[1];\n         vec[2] = vec1[2] + vec2[2];\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/ClosedSurface/","title":"ClosedSurface","text":"

        vtk-examples/CSharp/PolyData/ClosedSurface

        "},{"location":"CSharp/PolyData/ClosedSurface/#description","title":"Description","text":"

        A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/ClosedSurface/#code","title":"Code","text":"

        ClosedSurface.cs

        using System;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         ClosedSurface();\n      }\n\n\n      private static void ClosedSurface() {\n         // Create a sphere\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkFeatureEdges featureEdges = vtkFeatureEdges.New();\n         featureEdges.FeatureEdgesOff();\n         featureEdges.BoundaryEdgesOn();\n         featureEdges.NonManifoldEdgesOn();\n         featureEdges.SetInputConnection(sphereSource.GetOutputPort());\n         featureEdges.Update();\n\n         int numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfCells();\n\n         if(numberOfOpenEdges > 0) {\n            Console.WriteLine(\"Surface is not closed\");\n         }\n         else {\n            Console.WriteLine(\"Surface is closed\");\n         }\n         // nothing to show graphically\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/ColorDisconnectedRegions/","title":"ColorDisconnectedRegions","text":"

        vtk-examples/CSharp/PolyData/ColorDisconnectedRegions

        "},{"location":"CSharp/PolyData/ColorDisconnectedRegions/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/ColorDisconnectedRegions/#code","title":"Code","text":"

        ColorDisconnectedRegions.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ColorDisconnectedRegions();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ColorDisconnectedRegions() {\n         // Create some spheres\n         vtkSphereSource sphereSource1 = vtkSphereSource.New();\n         sphereSource1.Update();\n\n         vtkSphereSource sphereSource2 = vtkSphereSource.New();\n         sphereSource2.SetCenter(5, 0, 0);\n         sphereSource2.Update();\n\n         vtkSphereSource sphereSource3 = vtkSphereSource.New();\n         sphereSource3.SetCenter(10, 0, 0);\n         sphereSource3.Update();\n\n         vtkAppendPolyData appendFilter = vtkAppendPolyData.New();\n         appendFilter.AddInputConnection(sphereSource1.GetOutputPort());\n         appendFilter.AddInputConnection(sphereSource2.GetOutputPort());\n         appendFilter.AddInputConnection(sphereSource3.GetOutputPort());\n\n         vtkPolyDataConnectivityFilter connectivityFilter = vtkPolyDataConnectivityFilter.New();\n         connectivityFilter.SetInputConnection(appendFilter.GetOutputPort());\n         connectivityFilter.SetExtractionModeToAllRegions();\n         connectivityFilter.ColorRegionsOn();\n         connectivityFilter.Update();\n\n         // Visualize\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(connectivityFilter.GetOutputPort());\n         double[] range = connectivityFilter.GetOutput().GetPointData().GetArray(\"RegionId\").GetRange();\n         mapper.SetScalarRange(range[0], range[1] );\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.0, 0.0, 0.0);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/Curvature/","title":"Curvature","text":"

        vtk-examples/CSharp/PolyData/Curvature

        "},{"location":"CSharp/PolyData/Curvature/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/Curvature/#code","title":"Code","text":"

        Curvature.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            Curvature();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void Curvature() {\n         // Path to vtk data must be set as an environment variable\n         // VTK_DATA_ROOT = \"C:\\VTK\\vtkdata-5.8.0\"\n         vtkTesting test = vtkTesting.New();\n         string root = test.GetDataRoot();\n         // note: one should use a coarse surface mesh to achieve a good visual effect\n         string filePath = System.IO.Path.Combine(root, @\"Data\\bunny.vtp\");\n         // Create a polydata\n         vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n         reader.SetFileName(filePath);\n\n         vtkCurvatures curvaturesFilter = vtkCurvatures.New();\n         curvaturesFilter.SetInputConnection(reader.GetOutputPort());\n         //curvaturesFilter.SetCurvatureTypeToGaussian();\n         //curvaturesFilter.SetCurvatureTypeToMean();\n         //curvaturesFilter.SetCurvatureTypeToMaximum();\n         curvaturesFilter.SetCurvatureTypeToMinimum();\n\n         // To inspect more closely, if required\n         vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n         writer.SetInputConnection(curvaturesFilter.GetOutputPort());\n         writer.SetFileName(System.IO.Path.Combine(root, @\"Data\\gauss.vtp\"));\n         writer.Write();\n\n         // Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(curvaturesFilter.GetOutputPort());\n         double[] range = curvaturesFilter.GetOutput().GetScalarRange();\n         mapper.SetScalarRange(range[0], range[1]);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.0, 0.0, 0.0);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/DijkstraGraphGeodesicPath/","title":"DijkstraGraphGeodesicPath","text":"

        vtk-examples/CSharp/PolyData/DijkstraGraphGeodesicPath

        "},{"location":"CSharp/PolyData/DijkstraGraphGeodesicPath/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/DijkstraGraphGeodesicPath/#code","title":"Code","text":"

        DijkstraGraphGeodesicPath.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            DijkstraGraphGeodesicPath();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void DijkstraGraphGeodesicPath() {\n         // Create a sphere\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkDijkstraGraphGeodesicPath dijkstra = vtkDijkstraGraphGeodesicPath.New();\n         dijkstra.SetInputConnection(sphereSource.GetOutputPort());\n         dijkstra.SetStartVertex(0);\n         dijkstra.SetEndVertex(10);\n         dijkstra.Update();\n\n         // Create a mapper and actor\n         vtkPolyDataMapper pathMapper = vtkPolyDataMapper.New();\n         pathMapper.SetInputConnection(dijkstra.GetOutputPort());\n\n         vtkActor pathActor = vtkActor.New();\n         pathActor.SetMapper(pathMapper);\n         pathActor.GetProperty().SetColor(1, 0, 0); // Red\n         pathActor.GetProperty().SetLineWidth(4);\n\n         // Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.3, 0.6, 0.3);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n         renderer.AddActor(pathActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/GreedyTerrainDecimation/","title":"GreedyTerrainDecimation","text":"

        vtk-examples/CSharp/PolyData/GreedyTerrainDecimation

        "},{"location":"CSharp/PolyData/GreedyTerrainDecimation/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/GreedyTerrainDecimation/#code","title":"Code","text":"

        GreedyTerrainDecimation.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            GreedyTerrainDecimation();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void GreedyTerrainDecimation() {\n         // Create an image\n         vtkImageData image = vtkImageData.New();\n         image.SetDimensions(3, 3, 1);\n         image.SetNumberOfScalarComponents(1);\n         image.SetScalarTypeToUnsignedChar();\n         int[] dims = image.GetDimensions();\n         unsafe {\n            for(int i = 0; i < dims[0]; i++) {\n               for(int j = 0; j < dims[1]; j++) {\n                  byte* ptr = (byte*)image.GetScalarPointer(i, j, 0);\n                  *ptr = (byte)vtkMath.Round(vtkMath.Random(0, 1));\n               }\n            }\n         }\n         vtkGreedyTerrainDecimation decimation = vtkGreedyTerrainDecimation.New();\n         decimation.SetInputConnection(image.GetProducerPort());\n         decimation.Update();\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(decimation.GetOutputPort());\n         // actor\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetInterpolationToFlat();\n         actor.GetProperty().EdgeVisibilityOn();\n         actor.GetProperty().SetEdgeColor(1, 0, 0);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/HighlightBadCells/","title":"HighlightBadCells","text":"

        vtk-examples/CSharp/PolyData/HighlightBadCells

        "},{"location":"CSharp/PolyData/HighlightBadCells/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/HighlightBadCells/#code","title":"Code","text":"

        HighlightBadCells.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            HighLightBadCells();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void HighLightBadCells() { \n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkTriangleFilter triangleFilter = vtkTriangleFilter.New();\n         triangleFilter.SetInputConnection(sphereSource.GetOutputPort());\n         triangleFilter.Update();\n\n         //Create a mapper and actor\n         vtkDataSetMapper sphereMapper = vtkDataSetMapper.New();\n         sphereMapper.SetInputConnection(triangleFilter.GetOutputPort());\n         vtkActor sphereActor = vtkActor.New();\n         sphereActor.SetMapper(sphereMapper);\n\n         vtkPolyData mesh = triangleFilter.GetOutput();\n         Debug.WriteLine(\"There are \" + mesh.GetNumberOfCells() + \" cells.\");\n\n         vtkMeshQuality qualityFilter = vtkMeshQuality.New();\n#if VTK_MAJOR_VERSION_5\n         qualityFilter.SetInput(mesh);\n#else\n         qualityFilter.SetInputData(mesh);\n#endif\n         qualityFilter.SetTriangleQualityMeasureToArea();\n         qualityFilter.Update();\n\n         vtkDataSet qualityMesh = qualityFilter.GetOutput();\n         vtkDoubleArray qualityArray = vtkDoubleArray.SafeDownCast(qualityMesh.GetCellData().GetArray(\"Quality\"));\n         Debug.WriteLine(\"There are \" + qualityArray.GetNumberOfTuples() + \" values.\");\n\n         for(int i = 0; i < qualityArray.GetNumberOfTuples(); i++) {\n            double val = qualityArray.GetValue(i);\n            Debug.WriteLine(\"value \" +  i + \": \" + val);\n         }\n\n         vtkThreshold selectCells = vtkThreshold.New();\n         selectCells.ThresholdByLower(.02);\n         selectCells.SetInputArrayToProcess( \n            0, \n            0, \n            0,\n            1, // POINTS = 0, CELLS = 1, NONE = 2, POINTS_THEN_CELLS = 3, VERTICES = 4, EDGES = 5, ROWS = 6\n            0  // SCALARS = 0, VECTORS = 1, NORMALS = 2, TCOORDS = 3, TENSORS = 4, GLOBALIDS = 5, PEDIGREEIDS = 6, EDGEFLAG = 7\n            );\n\n#if VTK_MAJOR_VERSION_5\n         selectCells.SetInput(qualityMesh);\n#else\n         selectCells.SetInputData(qualityMesh);\n#endif\n         selectCells.Update();\n         vtkUnstructuredGrid ug = selectCells.GetOutput();\n\n         // Create a mapper and actor\n         vtkDataSetMapper mapper = vtkDataSetMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInput(ug);\n#else\n         mapper.SetInputData(ug);\n#endif\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetColor(1.0, 0.0, 0.0);\n         actor.GetProperty().SetRepresentationToWireframe();\n         actor.GetProperty().SetLineWidth(5);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(1.0, 1.0, 1.0);\n         // add our actors to the renderer\n         renderer.AddActor(actor);\n         renderer.AddActor(sphereActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/IterateOverLines/","title":"IterateOverLines","text":"

        vtk-examples/CSharp/PolyData/IterateOverLines

        "},{"location":"CSharp/PolyData/IterateOverLines/#description","title":"Description","text":"

        A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/IterateOverLines/#code","title":"Code","text":"

        IterateOverLines.cs

        using System;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         IterateOverLines();\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      private static void IterateOverLines() {\n         double[] origin = new double[] { 0.0, 0.0, 0.0 };\n         double[,] p = new double[,] {\n            {1.0, 0.0, 0.0},\n            {0.0, 1.0, 0.0},\n            {0.0, 1.0, 2.0},\n            {1.0, 2.0, 3.0}};\n\n         // Create a vtkPoints object and store the points in it\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(origin[0], origin[1], origin[2]);\n         for(int i = 0; i < 4; i++)\n            points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);\n\n         // Create a cell array to store the lines in and add the lines to it\n         vtkCellArray lines = vtkCellArray.New();\n\n         // Create four lines\n         for(int i = 0; i < 4; i++) {\n            vtkLine line = vtkLine.New();\n            line.GetPointIds().SetId(0, i);\n            line.GetPointIds().SetId(1, i + 1);\n            lines.InsertNextCell(line);\n         }\n\n         // Create a polydata to store everything in\n         vtkPolyData linesPolyData = vtkPolyData.New();\n\n         // Add the points to the dataset\n         linesPolyData.SetPoints(points);\n\n         // Add the lines to the dataset\n         linesPolyData.SetLines(lines);\n\n         Console.WriteLine(\"There are \" + linesPolyData.GetNumberOfLines() + \" lines.\");\n         linesPolyData.GetLines().InitTraversal();\n         vtkIdList idList = vtkIdList.New();\n         while(linesPolyData.GetLines().GetNextCell(idList) != 0) {\n            Console.WriteLine(\"Line has \" + idList.GetNumberOfIds() + \" points.\");\n\n            for(int pointId = 0; pointId < idList.GetNumberOfIds(); pointId++) {\n               Console.Write(idList.GetId(pointId) + \" \");\n            }\n            Console.Write(Environment.NewLine);\n         }\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/MultiBlockMergeFilter/","title":"MultiBlockMergeFilter","text":"

        vtk-examples/CSharp/PolyData/MultiBlockMergeFilter

        "},{"location":"CSharp/PolyData/MultiBlockMergeFilter/#description","title":"Description","text":"

        A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/MultiBlockMergeFilter/#code","title":"Code","text":"

        MultiBlockMergeFilter.cs

        using System;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         MultiBlockMergeFilter();\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      private static void MultiBlockMergeFilter() {\n         vtkSphereSource sphereSource1 = vtkSphereSource.New();\n         sphereSource1.Update();\n\n         vtkSphereSource sphereSource2 = vtkSphereSource.New();\n         sphereSource2.SetCenter(10, 10, 10);\n         sphereSource2.Update();\n\n         vtkMultiBlockDataSet multiBlockDataSet1 = vtkMultiBlockDataSet.New();\n         multiBlockDataSet1.SetNumberOfBlocks(1);\n         multiBlockDataSet1.SetBlock(0, sphereSource1.GetOutput());\n#if VTK_MAJOR_VERSION_5\n         multiBlockDataSet1.Update();\n#endif\n\n         vtkMultiBlockDataSet multiBlockDataSet2 = vtkMultiBlockDataSet.New();\n         multiBlockDataSet2.SetNumberOfBlocks(1);\n         multiBlockDataSet2.SetBlock(0, sphereSource2.GetOutput());\n#if VTK_MAJOR_VERSION_5\n         multiBlockDataSet2.Update();\n#endif\n\n         vtkMultiBlockMergeFilter multiBlockMergeFilter = vtkMultiBlockMergeFilter.New();\n#if VTK_MAJOR_VERSION_5\n         multiBlockMergeFilter.AddInput(multiBlockDataSet1);\n         multiBlockMergeFilter.AddInput(multiBlockDataSet2);\n#else\n         multiBlockMergeFilter.AddInputData(multiBlockDataSet1);\n         multiBlockMergeFilter.AddInputData(multiBlockDataSet2);\n#endif\n         multiBlockMergeFilter.Update();\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/NullPoint/","title":"NullPoint","text":"

        vtk-examples/CSharp/PolyData/NullPoint

        "},{"location":"CSharp/PolyData/NullPoint/#description","title":"Description","text":"

        Set value of all associated arrays to zero all at once

        A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/NullPoint/#code","title":"Code","text":"

        NullPoint.cs

        using System;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         NullPoint();\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      private static void NullPoint() {\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(1, 1, 1);\n         points.InsertNextPoint(2, 2, 2);\n         points.InsertNextPoint(3, 3, 3);\n\n         vtkPolyData polydata = vtkPolyData.New();\n         polydata.SetPoints(points);\n\n         vtkFloatArray floatArray = vtkFloatArray.New();\n         floatArray.SetNumberOfValues(3);\n         floatArray.SetNumberOfComponents(1);\n         floatArray.SetName(\"FloatArray\");\n         for(int i = 0; i < 3; i++) {\n            floatArray.SetValue(i, 2);\n         }\n         polydata.GetPointData().AddArray(floatArray);\n\n         vtkIntArray intArray = vtkIntArray.New();\n         intArray.SetNumberOfValues(3);\n         intArray.SetNumberOfComponents(1);\n         intArray.SetName(\"IntArray\");\n         for(int i = 0; i < 3; i++) {\n            intArray.SetValue(i, 2);\n         }\n\n         polydata.GetPointData().AddArray(intArray);\n\n         Console.WriteLine(\"PointIdx   x y z \" + \"floatArray\" + \" \" + \"intArray\");\n         Console.WriteLine(\"----------------------------------------\");\n         for(int i = 0; i < 3; i++) {\n            double[] p = polydata.GetPoint(i);\n            vtkFloatArray pointsFloatArray = vtkFloatArray.SafeDownCast(polydata.GetPointData().GetArray(\"FloatArray\"));\n            vtkIntArray pointsIntArray = vtkIntArray.SafeDownCast(polydata.GetPointData().GetArray(\"IntArray\"));\n            Console.WriteLine(\"   \" + i + \"       \" + p[0] + \" \" + p[1] + \" \" + p[2] + \"    \"\n                      + pointsFloatArray.GetValue(i) + \"          \" + pointsIntArray.GetValue(i));\n         }\n\n         polydata.GetPointData().NullPoint(1);\n         polydata.Modified();\n         Console.WriteLine(\"\");\n\n         for(int i = 0; i < 3; i++) {\n            double[] p = polydata.GetPoint(i);\n            vtkFloatArray pointsFloatArray = vtkFloatArray.SafeDownCast(polydata.GetPointData().GetArray(\"FloatArray\"));\n            vtkIntArray pointsIntArray = vtkIntArray.SafeDownCast(polydata.GetPointData().GetArray(\"IntArray\"));\n            Console.WriteLine(\"   \" + i + \"       \" + p[0] + \" \" + p[1] + \" \" + p[2] + \"    \"\n                      + pointsFloatArray.GetValue(i) + \"          \" + pointsIntArray.GetValue(i));\n\n         }\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion/","title":"PolyDataConnectivityFilter LargestRegion","text":"

        vtk-examples/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion

        "},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion/#description","title":"Description","text":"

        This example extracts the largest connected region of a mesh. Note that this is based on the number of points, not the actual area of the region.

        • Contributed by: Jinyoung Hwang

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion/#code","title":"Code","text":"

        PolyDataConnectivityFilter_LargestRegion.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            vtkPolyDataConnectivityFilter_LargestRegion();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void vtkPolyDataConnectivityFilter_LargestRegion() {\n         // Small sphere\n         vtkSphereSource sphereSource1 = vtkSphereSource.New();\n         sphereSource1.Update();\n\n         // Large sphere\n         vtkSphereSource sphereSource2 = vtkSphereSource.New();\n         sphereSource2.SetRadius(10);\n         sphereSource2.SetCenter(25, 0, 0);\n         sphereSource2.SetThetaResolution(10);\n         sphereSource2.SetPhiResolution(10);\n         sphereSource2.Update();\n\n         vtkAppendPolyData appendFilter = vtkAppendPolyData.New();\n         appendFilter.AddInputConnection(sphereSource1.GetOutputPort());\n         appendFilter.AddInputConnection(sphereSource2.GetOutputPort());\n         appendFilter.Update();\n\n         vtkPolyDataConnectivityFilter connectivityFilter = vtkPolyDataConnectivityFilter.New();\n         connectivityFilter.SetInputConnection(appendFilter.GetOutputPort());\n         connectivityFilter.SetExtractionModeToLargestRegion();\n         connectivityFilter.Update();\n\n         // Create a mapper and actor for original data\n         vtkPolyDataMapper originalMapper = vtkPolyDataMapper.New();\n         originalMapper.SetInputConnection(appendFilter.GetOutputPort());\n         originalMapper.Update();\n\n         vtkActor originalActor = vtkActor.New();\n         originalActor.SetMapper(originalMapper);\n\n         // Create a mapper and actor for extracted data\n         vtkPolyDataMapper extractedMapper = vtkPolyDataMapper.New();\n         extractedMapper.SetInputConnection(connectivityFilter.GetOutputPort());\n         extractedMapper.Update();\n\n         vtkActor extractedActor = vtkActor.New();\n         extractedActor.GetProperty().SetColor(1, 0, 0);\n         extractedActor.SetMapper(extractedMapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(originalActor);\n         renderer.AddActor(extractedActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/","title":"PolyDataConnectivityFilter SpecifiedRegion","text":"

        vtk-examples/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion

        "},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#description","title":"Description","text":"

        This example creates two spheres and combines them together into one polydata. The vtkPolyDataConnectivityFilter is used to find the two spheres as they are separate regions (disconnected). If region 0 is selected, the small sphere is extracted. If region 1 is selected, the large sphere is extracted. A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#code","title":"Code","text":"

        PolyDataConnectivityFilter_SpecifiedRegion.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            vtkPolyDataConnectivityFilter_SpecifiedRegion();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void vtkPolyDataConnectivityFilter_SpecifiedRegion() {\n         // Small sphere (first region)\n         vtkSphereSource sphereSource1 = vtkSphereSource.New();\n         sphereSource1.Update();\n\n         // Large sphere (second region)\n         vtkSphereSource sphereSource2 = vtkSphereSource.New();\n         sphereSource2.SetRadius(10);\n         sphereSource2.SetCenter(25, 0, 0);\n         sphereSource2.Update();\n\n         vtkAppendPolyData appendFilter = vtkAppendPolyData.New();\n         appendFilter.AddInputConnection(sphereSource1.GetOutputPort());\n         appendFilter.AddInputConnection(sphereSource2.GetOutputPort());\n         appendFilter.Update();\n\n         vtkPolyDataConnectivityFilter connectivityFilter = vtkPolyDataConnectivityFilter.New();\n         connectivityFilter.SetInputConnection(appendFilter.GetOutputPort());\n         connectivityFilter.SetExtractionModeToSpecifiedRegions();\n         connectivityFilter.AddSpecifiedRegion(1); //select the region to extract here\n         connectivityFilter.Update();\n\n         // Create a mapper and actor for original data\n         vtkPolyDataMapper originalMapper = vtkPolyDataMapper.New();\n         originalMapper.SetInputConnection(appendFilter.GetOutputPort());\n         originalMapper.Update();\n\n         vtkActor originalActor = vtkActor.New();\n         originalActor.SetMapper(originalMapper);\n\n         // Create a mapper and actor for extracted data\n         vtkPolyDataMapper extractedMapper = vtkPolyDataMapper.New();\n         extractedMapper.SetInputConnection(connectivityFilter.GetOutputPort());\n         extractedMapper.Update();\n\n         vtkActor extractedActor = vtkActor.New();\n         extractedActor.GetProperty().SetColor(1, 0, 0);\n         extractedActor.SetMapper(extractedMapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(originalActor);\n         renderer.AddActor(extractedActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/PolyDataGetPoint/","title":"PolyDataGetPoint","text":"

        vtk-examples/CSharp/PolyData/PolyDataGetPoint

        "},{"location":"CSharp/PolyData/PolyDataGetPoint/#description","title":"Description","text":"

        This example demonstrates how to obtain the coordinates of a point in a [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details) object. * Suggested by Sara Rolfe

        A tutorial on how to setup a Console Application utilizing Kitware.VTK.dll can be found here: Setup a Console Application to use Kitware.VTK.dll

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/PolyDataGetPoint/#code","title":"Code","text":"

        PolyDataGetPoint.cs

        using System;\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   class Program {\n      static void Main(string[] args) {\n         PolyDataGetPoint();\n         Console.WriteLine(\"\\nPress any key to continue...\");\n         Console.ReadKey();\n      }\n\n\n      private void PolyDataGetPoint() {\n         // Create a sphere\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n         vtkPolyData polydata = sphereSource.GetOutput();\n\n         // Write all of the coordinates of the points in the vtkPolyData to the console.\n         for(int i = 0; i < polydata.GetNumberOfPoints(); i++) {\n            double[] p = polydata.GetPoint(i);\n            // This is identical to:\n            // double[] p = polydata.GetPoints().GetPoint(i);\n            Console.WriteLine(\"Point \" + i + \" : (\" + p[0] + \" \" + p[1] + \" \" + p[2] + \")\");\n         }\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/PolygonalSurfaceContourLineInterpolator/","title":"PolygonalSurfaceContourLineInterpolator","text":"

        vtk-examples/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator

        "},{"location":"CSharp/PolyData/PolygonalSurfaceContourLineInterpolator/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/PolygonalSurfaceContourLineInterpolator/#code","title":"Code","text":"

        PolygonalSurfaceContourLineInterpolator.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            PolygonalSurfaceContourLineInterpolator();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void PolygonalSurfaceContourLineInterpolator() { \n         vtkPolyData polyData;\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.SetThetaResolution(40);\n         sphereSource.SetPhiResolution(20);\n         sphereSource.Update();\n\n         polyData = sphereSource.GetOutput();\n         // The Dijkstra interpolator will not accept cells that aren't triangles\n         vtkTriangleFilter triangleFilter = vtkTriangleFilter.New();\n#if VTK_MAJOR_VERSION_5\n         triangleFilter.SetInput( polyData );\n#else\n         triangleFilter.SetInputData( polyData );\n#endif\n         triangleFilter.Update();\n\n         vtkPolyData pd = triangleFilter.GetOutput();\n\n         //Create a mapper and actor\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(triangleFilter.GetOutputPort());\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         actor.GetProperty().SetInterpolationToFlat();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.3, 0.4, 0.5);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n\n         // Here comes the contour widget stuff.....\n         vtkContourWidget contourWidget = vtkContourWidget.New();\n         contourWidget.SetInteractor(renderWindow.GetInteractor());\n         vtkOrientedGlyphContourRepresentation rep = \n            vtkOrientedGlyphContourRepresentation.SafeDownCast(\n               contourWidget.GetRepresentation());\n         rep.GetLinesProperty().SetColor(1, 0.2, 0);\n         rep.GetLinesProperty().SetLineWidth(3.0f);\n\n         vtkPolygonalSurfacePointPlacer pointPlacer = \n            vtkPolygonalSurfacePointPlacer.New();\n         pointPlacer.AddProp(actor);\n         pointPlacer.GetPolys().AddItem(pd);\n         rep.SetPointPlacer(pointPlacer);\n\n         vtkPolygonalSurfaceContourLineInterpolator interpolator = \n            vtkPolygonalSurfaceContourLineInterpolator.New();\n         interpolator.GetPolys().AddItem(pd);\n         rep.SetLineInterpolator(interpolator);\n\n         renderWindow.Render();\n         contourWidget.EnabledOn();\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/SelectPolyData/","title":"SelectPolyData","text":"

        vtk-examples/CSharp/PolyData/SelectPolyData

        "},{"location":"CSharp/PolyData/SelectPolyData/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/SelectPolyData/#code","title":"Code","text":"

        SelectPolyData.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            SelectPolyData();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void SelectPolyData() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.Update();\n\n         vtkPoints selectionPoints = vtkPoints.New();\n\n         selectionPoints.InsertPoint(0, -0.16553, 0.135971, 0.451972);\n         selectionPoints.InsertPoint(1, -0.0880123, -0.134952, 0.4747);\n         selectionPoints.InsertPoint(2, 0.00292618, -0.134604, 0.482459);\n         selectionPoints.InsertPoint(3, 0.0641941, 0.067112, 0.490947);\n         selectionPoints.InsertPoint(4, 0.15577, 0.0734765, 0.469245);\n         selectionPoints.InsertPoint(5, 0.166667, -0.129217, 0.454622);\n         selectionPoints.InsertPoint(6, 0.241259, -0.123363, 0.420581);\n         selectionPoints.InsertPoint(7, 0.240334, 0.0727106, 0.432555);\n         selectionPoints.InsertPoint(8, 0.308529, 0.0844311, 0.384357);\n         selectionPoints.InsertPoint(9, 0.32672, -0.121674, 0.359187);\n         selectionPoints.InsertPoint(10, 0.380721, -0.117342, 0.302527);\n         selectionPoints.InsertPoint(11, 0.387804, 0.0455074, 0.312375);\n         selectionPoints.InsertPoint(12, 0.43943, -0.111673, 0.211707);\n         selectionPoints.InsertPoint(13, 0.470984, -0.0801913, 0.147919);\n         selectionPoints.InsertPoint(14, 0.436777, 0.0688872, 0.233021);\n         selectionPoints.InsertPoint(15, 0.44874, 0.188852, 0.109882);\n         selectionPoints.InsertPoint(16, 0.391352, 0.254285, 0.176943);\n         selectionPoints.InsertPoint(17, 0.373274, 0.154162, 0.294296);\n         selectionPoints.InsertPoint(18, 0.274659, 0.311654, 0.276609);\n         selectionPoints.InsertPoint(19, 0.206068, 0.31396, 0.329702);\n         selectionPoints.InsertPoint(20, 0.263789, 0.174982, 0.387308);\n         selectionPoints.InsertPoint(21, 0.213034, 0.175485, 0.417142);\n         selectionPoints.InsertPoint(22, 0.169113, 0.261974, 0.390286);\n         selectionPoints.InsertPoint(23, 0.102552, 0.25997, 0.414814);\n         selectionPoints.InsertPoint(24, 0.131512, 0.161254, 0.454705);\n         selectionPoints.InsertPoint(25, 0.000192443, 0.156264, 0.475307);\n         selectionPoints.InsertPoint(26, -0.0392091, 0.000251724, 0.499943);\n         selectionPoints.InsertPoint(27, -0.096161, 0.159646, 0.46438);\n\n         vtkSelectPolyData loop = vtkSelectPolyData.New();\n         loop.SetInputConnection(sphereSource.GetOutputPort());\n         loop.SetLoop(selectionPoints);\n         loop.GenerateSelectionScalarsOn();\n         loop.SetSelectionModeToSmallestRegion(); //negative scalars inside\n\n         vtkClipPolyData clip = //clips out positive region\n         vtkClipPolyData.New();\n         clip.SetInputConnection(loop.GetOutputPort());\n\n         vtkPolyDataMapper clipMapper = vtkPolyDataMapper.New();\n         clipMapper.SetInputConnection(clip.GetOutputPort());\n\n         vtkLODActor clipActor = vtkLODActor.New();\n         clipActor.SetMapper(clipMapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.1, .2, .4);\n         renderWindow.SetSize(500, 250);\n         // add our actor to the renderer\n         renderer.AddActor(clipActor);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/ShrinkPolyData/","title":"ShrinkPolyData","text":"

        vtk-examples/CSharp/PolyData/ShrinkPolyData

        "},{"location":"CSharp/PolyData/ShrinkPolyData/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/ShrinkPolyData/#code","title":"Code","text":"

        ShrinkPolyData.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            ShrinkPolyData();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void ShrinkPolyData() {\n         vtkSphereSource sphereSource = vtkSphereSource.New();\n         sphereSource.SetRadius(10);\n         sphereSource.SetPhiResolution(12);\n         sphereSource.SetThetaResolution(12);\n         sphereSource.Update();\n\n         vtkShrinkPolyData shrinkFilter = vtkShrinkPolyData.New();\n         shrinkFilter.SetInputConnection(sphereSource.GetOutputPort());\n         shrinkFilter.Update();\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(shrinkFilter.GetOutputPort());\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         //Add the actors to the renderer, set the background and size \n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/VectorFieldNonZeroExtraction/","title":"VectorFieldNonZeroExtraction","text":"

        vtk-examples/CSharp/PolyData/VectorFieldNonZeroExtraction

        "},{"location":"CSharp/PolyData/VectorFieldNonZeroExtraction/#description","title":"Description","text":"

        This example shows how to create an imagedata object, associate scalar data with some points and visualize only nonzero scalar values

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/VectorFieldNonZeroExtraction/#code","title":"Code","text":"

        VectorFieldNonZeroExtraction.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            VectorFieldNonZeroExtraction();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void VectorFieldNonZeroExtraction() { \n         // Create an image\n         vtkImageData image = vtkImageData.New();\n         CreateVectorField(ref image);\n\n         // This filter produces a vtkImageData with an array named \"Magnitude\"\n         vtkImageMagnitude magnitudeFilter = vtkImageMagnitude.New();\n         magnitudeFilter.SetInputConnection(image.GetProducerPort());\n         magnitudeFilter.Update(); \n\n         image.GetPointData().AddArray(magnitudeFilter.GetOutput().GetPointData().GetScalars());\n         image.GetPointData().SetActiveScalars(\"Magnitude\");\n\n         vtkThresholdPoints thresholdVector = vtkThresholdPoints.New();\n         thresholdVector.SetInput(image);\n         thresholdVector.SetInputArrayToProcess(\n            0, \n            0, \n            (int)vtkDataObject.FieldAssociations.FIELD_ASSOCIATION_POINTS, \n            (int)vtkDataSetAttributes.AttributeTypes.SCALARS,\n            \"Magnitude\");\n         thresholdVector.ThresholdByUpper(0.00001);\n         thresholdVector.Update();\n\n         // in case you want to save imageData\n         //vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();\n         //writer.SetFileName(\"output.vtp\");\n         //writer.SetInputConnection(thresholdPoints.GetOutputPort());\n         //writer.Write();\n\n         // repesents the pixels\n         vtkCubeSource cubeSource = vtkCubeSource.New();\n         cubeSource.SetXLength(2.0);\n         cubeSource.SetYLength(2.0);\n         cubeSource.SetZLength(2.0);\n         vtkGlyph3D glyph = vtkGlyph3D.New();\n         glyph.SetInput(image);\n         glyph.SetSourceConnection(cubeSource.GetOutputPort());\n         // don't scale glyphs according to any scalar data\n         glyph.SetScaleModeToDataScalingOff();\n\n         vtkPolyDataMapper glyphMapper = vtkPolyDataMapper.New();\n         glyphMapper.SetInputConnection(glyph.GetOutputPort());\n         // don't color glyphs according to scalar data\n         glyphMapper.ScalarVisibilityOff();\n         glyphMapper.SetScalarModeToDefault();\n\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(glyphMapper);\n\n         // represent vector field\n         vtkGlyph3D vectorGlyph = vtkGlyph3D.New();\n         vtkArrowSource arrowSource = vtkArrowSource.New();\n         vtkPolyDataMapper vectorGlyphMapper = vtkPolyDataMapper.New();\n\n         int n = image.GetPointData().GetNumberOfArrays();\n         for(int i = 0; i < n; i++) {\n            Debug.WriteLine(\"name of array[\"+ i + \"]: \" + image.GetPointData().GetArrayName(i));\n         }\n\n         vtkPolyData tmp = thresholdVector.GetOutput();\n         Debug.WriteLine(\"number of thresholded points: \" + tmp.GetNumberOfPoints());\n         vectorGlyph.SetInputConnection(thresholdVector.GetOutputPort());\n\n         // in case you want the point glyphs to be oriented according to \n         // scalar values in array \"ImageScalars\" uncomment the following line\n         image.GetPointData().SetActiveVectors(\"ImageScalars\");\n\n         vectorGlyph.SetSourceConnection(arrowSource.GetOutputPort());\n         vectorGlyph.SetScaleModeToScaleByVector();\n         vectorGlyph.SetVectorModeToUseVector();\n         vectorGlyph.ScalingOn();\n         vectorGlyph.OrientOn();\n         vectorGlyph.SetInputArrayToProcess(\n            1,\n            0,\n            (int)vtkDataObject.FieldAssociations.FIELD_ASSOCIATION_POINTS,\n            (int)vtkDataSetAttributes.AttributeTypes.SCALARS,\n            \"ImageScalars\");\n\n         vectorGlyph.Update();\n\n         vectorGlyphMapper.SetInputConnection(vectorGlyph.GetOutputPort());\n         vectorGlyphMapper.Update();\n\n         vtkActor vectorActor = vtkActor.New();\n         vectorActor.SetMapper(vectorGlyphMapper);\n\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .6, .3);\n         //Add the actors to the renderer, set the background and size \n         renderer.AddActor(actor);\n         renderer.AddActor(vectorActor);\n      }\n\n\n      void CreateVectorField(ref vtkImageData image) {\n         // Specify the size of the image data\n         image.SetDimensions(3, 3, 3);\n         image.SetNumberOfScalarComponents(3);\n         image.SetScalarTypeToFloat();\n         image.AllocateScalars();\n         image.SetSpacing(10.0, 10.0, 10.0);\n         int[]  dims = image.GetDimensions();\n\n         float[] pixel = new float[] {0.0f, 0.0f, 0.0f};\n         IntPtr pPixel;\n\n         // Zero the vectors\n         for(int z = 0; z < dims[2]; z++) {\n            for(int y = 0; y < dims[1]; y++) {\n               for(int x = 0; x < dims[0]; x++) {\n                  pPixel = image.GetScalarPointer(x, y, 0);\n                  Marshal.Copy(pixel, 0, pPixel, 3);\n               }\n            }\n         }\n\n         // Set two of the pixels to non zero values\n         pixel[0] = 8.0f;\n         pixel[1] = 8.0f;\n         pixel[2] = -8.0f;\n         pPixel = image.GetScalarPointer(0, 2, 0);\n         Marshal.Copy(pixel, 0, pPixel, 3);\n\n         pixel[0] = 8.0f;\n         pixel[1] = -8.0f;\n         pixel[2] = 8.0f;\n         pPixel = image.GetScalarPointer(2, 0, 2);\n         Marshal.Copy(pixel, 0, pPixel, 3);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/WarpVector/","title":"WarpVector","text":"

        vtk-examples/CSharp/PolyData/WarpVector

        "},{"location":"CSharp/PolyData/WarpVector/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/WarpVector/#code","title":"Code","text":"

        WarpVector.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WarpVector();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WarpVector() {\n         vtkPoints points = vtkPoints.New();\n         points.InsertNextPoint(0.0, 0.0, 0.0);\n         points.InsertNextPoint(1.0, 0.0, 0.0);\n         points.InsertNextPoint(2.0, 0.0, 0.0);\n         points.InsertNextPoint(3.0, 0.0, 0.0);\n         points.InsertNextPoint(4.0, 0.0, 0.0);\n\n         vtkCellArray lines = vtkCellArray.New();\n         vtkLine line = vtkLine.New();\n         line.GetPointIds().SetId(0, 0);\n         line.GetPointIds().SetId(1, 1);\n         lines.InsertNextCell(line);\n         line.GetPointIds().SetId(0, 1);\n         line.GetPointIds().SetId(1, 2);\n         lines.InsertNextCell(line);\n         line.GetPointIds().SetId(0, 2);\n         line.GetPointIds().SetId(1, 3);\n         lines.InsertNextCell(line);\n         line.GetPointIds().SetId(0, 3);\n         line.GetPointIds().SetId(1, 4);\n         lines.InsertNextCell(line);\n\n         vtkDoubleArray warpData = vtkDoubleArray.New();\n         warpData.SetNumberOfComponents(3);\n         warpData.SetName(\"warpData\");\n         double[] warp = new double[] { 0.0, 0.0, 0.0 };\n         warp[1] = 0.0;\n         warpData.InsertNextTuple3(warp[0], warp[1], warp[2]);\n         warp[1] = 0.1;\n         warpData.InsertNextTuple3(warp[0], warp[1], warp[2]);\n         warp[1] = 0.3;\n         warpData.InsertNextTuple3(warp[0], warp[1], warp[2]);\n         warp[1] = 0.0;\n         warpData.InsertNextTuple3(warp[0], warp[1], warp[2]);\n         warp[1] = 0.1;\n         warpData.InsertNextTuple3(warp[0], warp[1], warp[2]);\n\n         vtkPolyData polydata = vtkPolyData.New();\n         polydata.SetPoints(points);\n         polydata.SetLines(lines);\n         polydata.GetPointData().AddArray(warpData);\n         polydata.GetPointData().SetActiveVectors(warpData.GetName());\n\n         //WarpVector will use the array marked as active vector in polydata\n         //it has to be a 3 component array\n         //with the same number of tuples as points in polydata\n         vtkWarpVector warpVector = vtkWarpVector.New();\n#if VTK_MAJOR_VERSION_5\n         warpVector.SetInput(polydata);\n#else\n         warpVector.SetInputData(polydata);\n#endif\n         warpVector.Update();\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n#if VTK_MAJOR_VERSION_5\n         mapper.SetInput(warpVector.GetPolyDataOutput());\n#else\n         mapper.SetInputData(warpVector.GetPolyDataOutput());\n#endif\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .6, .3);\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/PolyData/WeightedTransformFilter/","title":"WeightedTransformFilter","text":"

        vtk-examples/CSharp/PolyData/WeightedTransformFilter

        "},{"location":"CSharp/PolyData/WeightedTransformFilter/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/PolyData/WeightedTransformFilter/#code","title":"Code","text":"

        WeightedTransformFilter.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            WeightedTransformFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void WeightedTransformFilter() { \n         // Use a sphere as a basis of the shape\n         vtkSphereSource sphere = vtkSphereSource.New();\n         sphere.SetPhiResolution(40);\n         sphere.SetThetaResolution(40);\n         sphere.Update();\n\n         vtkPolyData sphereData = sphere.GetOutput();\n\n         // Create a data array to hold the weighting coefficients\n         vtkFloatArray tfarray = vtkFloatArray.New();\n         int npoints = sphereData.GetNumberOfPoints();\n         tfarray.SetNumberOfComponents(2);\n         tfarray.SetNumberOfTuples(npoints);\n\n         // Parameterize the sphere along the z axis, and fill the weights\n         // with (1.0-a, a) to linearly interpolate across the shape\n         IntPtr pPoint = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n         double[] point = new double[3];\n         for(int i = 0; i < npoints; i++) {\n            sphereData.GetPoint(i, pPoint);\n            Marshal.Copy(pPoint, point, 0, 3);\n            double x = point[0];\n            double y = point[1];\n            double z = point[2];\n\n            double zn = z + 0.5;\n            double zn1 = 1.0 - zn;\n            if(zn > 1.0)\n               zn = 1.0;\n            if(zn1 < 0.0)\n               zn1 = 0.0;\n\n            tfarray.SetComponent(i, 0, zn1);\n            tfarray.SetComponent(i, 1, zn);\n         }\n         Marshal.FreeHGlobal(pPoint);\n\n         // Create field data to hold the array, and bind it to the sphere\n         vtkFieldData fd = vtkFieldData.New();\n         tfarray.SetName(\"weights\");\n         sphereData.GetPointData().AddArray(tfarray);\n\n         // Use an ordinary transform to stretch the shape\n         vtkTransform stretch = vtkTransform.New();\n         stretch.Scale(1, 1, 3.2);\n\n         vtkTransformFilter stretchFilter = vtkTransformFilter.New();\n         stretchFilter.SetInputConnection(sphereData.GetProducerPort());\n         stretchFilter.SetTransform(stretch);\n\n         // Now, for the weighted transform stuff\n         vtkWeightedTransformFilter weightedTrans = vtkWeightedTransformFilter.New();\n\n         // Create two transforms to interpolate between\n         vtkTransform identity = vtkTransform.New();\n         identity.Identity();\n\n         vtkTransform rotated = vtkTransform.New();\n         double rotatedAngle = 45;\n         rotated.RotateX(rotatedAngle);\n\n         weightedTrans.SetNumberOfTransforms(2);\n         weightedTrans.SetTransform(identity, 0);\n         weightedTrans.SetTransform(rotated, 1);\n         // which data array should the filter use ?\n         weightedTrans.SetWeightArray(\"weights\");\n\n         weightedTrans.SetInputConnection(stretchFilter.GetOutputPort());\n\n         vtkPolyDataMapper weightedTransMapper = vtkPolyDataMapper.New();\n         weightedTransMapper.SetInputConnection(weightedTrans.GetOutputPort());\n         vtkActor weightedTransActor = vtkActor.New();\n         weightedTransActor.SetMapper(weightedTransMapper);\n         weightedTransActor.GetProperty().SetDiffuseColor(0.8, 0.8, 0.1);\n         weightedTransActor.GetProperty().SetRepresentationToSurface();\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(0.2, 0.3, 0.4);\n         // add our actor to the renderer\n         renderer.AddActor(weightedTransActor);\n\n         renderer.ResetCamera();\n         renderer.GetActiveCamera().Azimuth(90);\n         renderer.GetActiveCamera().Dolly(1);\n      }\n   }\n}\n
        "},{"location":"CSharp/SimpleOperations/DistanceBetweenPoints/","title":"DistanceBetweenPoints","text":"

        vtk-examples/CSharp/SimpleOperations/DistanceBetweenPoints

        "},{"location":"CSharp/SimpleOperations/DistanceBetweenPoints/#description","title":"Description","text":"

        This example finds the squared distance and the Euclidean distance between two 3D points.

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/SimpleOperations/DistanceBetweenPoints/#code","title":"Code","text":"

        DistanceBetweenPoints.cs

        using System;\nusing System.Runtime.InteropServices;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid DistanceBetweenPoints() {\n   // Create two points.\n   double[] p0 = new double[] { 0.0, 0.0, 0.0 };\n   double[] p1 = new double[] { 1.0, 1.0, 1.0 };\n\n   IntPtr pP0 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   IntPtr pP1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   Marshal.Copy(p0, 0, pP0, 3);\n   Marshal.Copy(p1, 0, pP1, 3);\n\n   // Find the squared distance between the points.\n   double squaredDistance = vtkMath.Distance2BetweenPoints(pP0, pP1);\n\n   // Take the square root to get the Euclidean distance between the points.\n   double distance = Math.Sqrt(squaredDistance);\n\n   // Output the results.\n   Console.WriteLine(\"SquaredDistance = \" + squaredDistance);\n   Console.WriteLine(\"Distance = \" + distance);\n   Marshal.FreeHGlobal(pP0);\n   Marshal.FreeHGlobal(pP1);\n}\n
        "},{"location":"CSharp/SimpleOperations/DistancePointToLine/","title":"DistancePointToLine","text":"

        vtk-examples/CSharp/SimpleOperations/DistancePointToLine

        "},{"location":"CSharp/SimpleOperations/DistancePointToLine/#description","title":"Description","text":"

        This example computes the distance from a point to a line.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/SimpleOperations/DistancePointToLine/#code","title":"Code","text":"

        DistancePointToLine.cs

        using System;\nusing System.Runtime.InteropServices;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid DistancePointToLine() {\n   double[] lineP0 = new double[] { 0.0, 0.0, 0.0 };\n   double[] lineP1 = new double[] { 2.0, 0.0, 0.0 };\n\n   double[] p0 = new double[] { 1.0, 0, 0 };\n   double[] p1 = new double[] { 1.0, 2.0, 0 };\n\n   // Don't worry, fortunately only a few functions in ActiViz.NET need \n   // Marshaling between Managed and Unmanaged Code\n   IntPtr pP0 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   IntPtr pP1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   IntPtr pLineP0 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   IntPtr pLineP1 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   Marshal.Copy(p0, 0, pP0, 3);\n   Marshal.Copy(p1, 0, pP1, 3);\n   Marshal.Copy(lineP0, 0, pLineP0, 3);\n   Marshal.Copy(lineP1, 0, pLineP1, 3);\n\n   double dist0 = vtkLine.DistanceToLine(pP0, pLineP0, pLineP1);\n   Console.WriteLine(\"Dist0: \" + dist0);\n\n   double dist1 = vtkLine.DistanceToLine(pP1, pLineP0, pLineP1);\n   Console.WriteLine(\"Dist1: \" + dist1);\n\n   double parametricCoord = 0.0; // must be initialized because this var is passed by reference\n   double[] closest = new double[3];\n   IntPtr pClosest = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   Marshal.Copy(closest, 0, pClosest, 3);\n\n   dist0 = vtkLine.DistanceToLine(pP0, pLineP0, pLineP1, ref parametricCoord, pClosest);\n   Marshal.Copy(pClosest, closest, 0, 3);\n   Console.WriteLine(\n      \"Dist0: \" + dist0 \n      + \" closest point: \" + closest[0] + \" \" + closest[1] + \" \" + closest[2] \n      + \" parametricCoord: \" + parametricCoord);\n\n   dist1 = vtkLine.DistanceToLine(pP1, pLineP0, pLineP1, ref parametricCoord, pClosest);\n   Marshal.Copy(pClosest, closest, 0, 3);\n   Console.WriteLine(\n      \"Dist1: \" + dist1 \n      + \" closest point: \" + closest[0] + \" \" + closest[1] + \" \" + closest[2]\n      + \" parametricCoord: \" + parametricCoord);\n\n   Marshal.FreeHGlobal(pP0);\n   Marshal.FreeHGlobal(pP1);\n   Marshal.FreeHGlobal(pLineP0);\n   Marshal.FreeHGlobal(pLineP1);\n   Marshal.FreeHGlobal(pClosest);\n}\n
        "},{"location":"CSharp/SimpleOperations/GaussianRandomNumber/","title":"GaussianRandomNumber","text":"

        vtk-examples/CSharp/SimpleOperations/GaussianRandomNumber

        "},{"location":"CSharp/SimpleOperations/GaussianRandomNumber/#description","title":"Description","text":"

        This example generates 3 random numbers from a Gaussian distribution with mean 0.0 and standard deviation 2.0.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/SimpleOperations/GaussianRandomNumber/#code","title":"Code","text":"

        GaussianRandomNumber.cs

        using System;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid GaussianRandomNumber() {\n   // Set the number of random numbers we wish to produce to 3.\n   uint numRand = 3;\n   // Without this line, the random numbers will be the same every iteration.\n   vtkMath.RandomSeed((int)( DateTime.Now.Ticks & 0x0000FFFF ));\n\n   // Generate numRand random numbers from a Gaussian distribution with mean 0.0 and standard deviation 2.0\n   for(uint i = 0; i < numRand; i++) {\n      double a = vtkMath.Gaussian(0.0, 2.0);\n      Console.WriteLine(a);\n   }\n}\n
        "},{"location":"CSharp/SimpleOperations/PerspectiveTransform/","title":"PerspectiveTransform","text":"

        vtk-examples/CSharp/SimpleOperations/PerspectiveTransform

        "},{"location":"CSharp/SimpleOperations/PerspectiveTransform/#description","title":"Description","text":"

        The perspective transform automatically appends the \"homogeneous 1\" to the point before it is multiplied by the matrix. It then divides the first 3 coordinates of the result by the 4th coordinate of the result. For comparison, the standard projection (vtkTransform) is also performed with the same matrix and the same point. Note that the results are much different.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/SimpleOperations/PerspectiveTransform/#code","title":"Code","text":"

        PerspectiveTransform.cs

        using System;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid PerspectiveTransform() {\n   vtkMatrix4x4 m = vtkMatrix4x4.New();\n   m.SetElement(0, 0, 1);\n   m.SetElement(0, 1, 2);\n   m.SetElement(0, 2, 3);\n   m.SetElement(0, 3, 4);\n   m.SetElement(1, 0, 2);\n   m.SetElement(1, 1, 2);\n   m.SetElement(1, 2, 3);\n   m.SetElement(1, 3, 4);\n   m.SetElement(2, 0, 3);\n   m.SetElement(2, 1, 2);\n   m.SetElement(2, 2, 3);\n   m.SetElement(2, 3, 4);\n   m.SetElement(3, 0, 4);\n   m.SetElement(3, 1, 2);\n   m.SetElement(3, 2, 3);\n   m.SetElement(3, 3, 4);\n\n   vtkPerspectiveTransform perspectiveTransform = vtkPerspectiveTransform.New();\n   perspectiveTransform.SetMatrix(m);\n\n   vtkTransform transform = vtkTransform.New();\n   transform.SetMatrix(m);\n\n   double[] p = new double[]{1.0, 2.0, 3.0};\n\n   double[] normalProjection = transform.TransformPoint(p[0], p[1], p[2]);\n\n   Console.WriteLine(\"Standard projection: \"\n      + normalProjection[0] + \" \"\n      + normalProjection[1] + \" \"\n      + normalProjection[2]);\n\n   double[] perspectiveProjection = perspectiveTransform.TransformPoint(p[0], p[1], p[2]);\n\n   Console.WriteLine(\"Perspective  projection: \"\n      + perspectiveProjection[0] + \" \"\n      + perspectiveProjection[1] + \" \"\n      + perspectiveProjection[2]);\n}\n
        "},{"location":"CSharp/SimpleOperations/ProjectPointPlane/","title":"ProjectPointPlane","text":"

        vtk-examples/CSharp/SimpleOperations/ProjectPointPlane

        "},{"location":"CSharp/SimpleOperations/ProjectPointPlane/#description","title":"Description","text":"

        This example projects a point onto a plane

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/SimpleOperations/ProjectPointPlane/#code","title":"Code","text":"

        ProjectPointPlane.cs

        using System;\nusing System.Runtime.InteropServices;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid ProjectPointPlane() {\n   vtkPlane plane = vtkPlane.New();\n   plane.SetOrigin(0.0, 0.0, 0.0);\n   plane.SetNormal(0.0, 0.0, 1.0);\n\n   double[] p = new double[] { 23.1, 54.6, 9.2 };\n   double[] projected = new double[3];\n\n   IntPtr pP = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   IntPtr pProjected = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(double)) * 3);\n   Marshal.Copy(p, 0, pP, 3);\n   Marshal.Copy(projected, 0, pProjected, 3);\n\n   // NOTE: normal assumed to have magnitude 1\n   plane.ProjectPoint(pP, pProjected);\n   Marshal.Copy(pProjected, projected, 0, 3);\n   Marshal.FreeHGlobal(pP);\n   Marshal.FreeHGlobal(pProjected);\n\n   Console.WriteLine(\"Projected: \"\n      + projected[0] + \" \"\n      + projected[1] + \" \"\n      + projected[2]);\n}\n
        "},{"location":"CSharp/SimpleOperations/RandomSequence/","title":"RandomSequence","text":"

        vtk-examples/CSharp/SimpleOperations/RandomSequence

        "},{"location":"CSharp/SimpleOperations/RandomSequence/#description","title":"Description","text":"

        This is the \"new\" (December, 2009) VTK way to produce random numbers. It is actually a random sequence generator.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/SimpleOperations/RandomSequence/#code","title":"Code","text":"

        RandomSequence.cs

        using System;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid RandomSequence() {\n   //Create a random sequence generator.\n   vtkMinimalStandardRandomSequence sequence = \n      vtkMinimalStandardRandomSequence.New();\n\n   // initialize the sequence\n   sequence.SetSeed((int)(DateTime.Now.Ticks & 0x0000FFFF));\n   //Get 3 random numbers.\n   double x = sequence.GetValue();\n   sequence.Next();\n   double y = sequence.GetValue();\n   sequence.Next();\n   double z = sequence.GetValue();\n\n   // You can also use sequence.GetRangeValue(-1.0, 1.0); \n   // to set a range on the random values.\n\n   // Output the resulting random numbers\n   Console.WriteLine(\"x: \" + x + \" y: \" + y + \" z: \" + z);\n}\n
        "},{"location":"CSharp/SimpleOperations/UniformRandomNumber/","title":"UniformRandomNumber","text":"

        vtk-examples/CSharp/SimpleOperations/UniformRandomNumber

        "},{"location":"CSharp/SimpleOperations/UniformRandomNumber/#description","title":"Description","text":"

        This example generates 3 random numbers between 0 and 2 from a uniform distribution.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/SimpleOperations/UniformRandomNumber/#code","title":"Code","text":"

        UniformRandomNumber.cs

        using System;\nusing System.Diagnostics;\nusing Kitware.VTK;\n\nvoid UniformRandomNumber() {\n   // Set the number of random numbers we wish to produce to 3.\n   uint numRand = 3;\n   // Without this line, the random numbers will be the same every iteration.\n   vtkMath.RandomSeed((int)( DateTime.Now.Ticks & 0x0000FFFF ));\n\n   // Generate numRand random numbers from a uniform distribution between 0.0 and 2.0\n   for(uint i = 0; i < numRand; i++) {\n      double a = vtkMath.Random(0.0, 2.0);\n      Console.WriteLine(a);\n   }\n}\n
        "},{"location":"CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter/","title":"BandedPolyDataContourFilter","text":"

        vtk-examples/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter

        "},{"location":"CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter/#description","title":"Description","text":"

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter/#code","title":"Code","text":"

        BandedPolyDataContourFilter.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            BandedPolyDataContourFilter();\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void BandedPolyDataContourFilter() {\n         vtkPoints pts = vtkPoints.New();\n         pts.InsertPoint(0, 0, 0, 0);\n         pts.InsertPoint(1, 0, 1, 0);\n         pts.InsertPoint(2, 0, 2, 0);\n         pts.InsertPoint(3, 1, 0, 0);\n         pts.InsertPoint(4, 1, 1, 0);\n         pts.InsertPoint(5, 1, 2, 0);\n         pts.InsertPoint(6, 2, 0, 0);\n         pts.InsertPoint(7, 2, 2, 0);\n         pts.InsertPoint(8, 3, 0, 0);\n         pts.InsertPoint(9, 3, 1, 0);\n         pts.InsertPoint(10, 3, 2, 0);\n         pts.InsertPoint(11, 4, 0, 0);\n         pts.InsertPoint(12, 6, 0, 0);\n         pts.InsertPoint(13, 5, 2, 0);\n         pts.InsertPoint(14, 7, 0, 0);\n         pts.InsertPoint(15, 9, 0, 0);\n         pts.InsertPoint(16, 7, 2, 0);\n         pts.InsertPoint(17, 9, 2, 0);\n         pts.InsertPoint(18, 10, 0, 0);\n         pts.InsertPoint(19, 12, 0, 0);\n         pts.InsertPoint(20, 10, 1, 0);\n         pts.InsertPoint(21, 12, 1, 0);\n         pts.InsertPoint(22, 10, 2, 0);\n         pts.InsertPoint(23, 12, 2, 0);\n         pts.InsertPoint(24, 10, 3, 0);\n         pts.InsertPoint(25, 12, 3, 0);\n\n         vtkCellArray polys = vtkCellArray.New();\n         polys.InsertNextCell(4);\n         polys.InsertCellPoint(14);\n         polys.InsertCellPoint(15);\n         polys.InsertCellPoint(17);\n         polys.InsertCellPoint(16);\n         polys.InsertNextCell(3);\n         polys.InsertCellPoint(11);\n         polys.InsertCellPoint(12);\n         polys.InsertCellPoint(13);\n\n         vtkFloatArray scalars = vtkFloatArray.New();\n         scalars.SetNumberOfTuples(26);\n         scalars.SetTuple1(0, 0);\n         scalars.SetTuple1(1, 50);\n         scalars.SetTuple1(2, 100);\n         scalars.SetTuple1(3, 0);\n         scalars.SetTuple1(4, 50);\n         scalars.SetTuple1(5, 100);\n         scalars.SetTuple1(6, 10);\n         scalars.SetTuple1(7, 90);\n         scalars.SetTuple1(8, 10);\n         scalars.SetTuple1(9, 50);\n         scalars.SetTuple1(10, 90);\n         scalars.SetTuple1(11, 10);\n         scalars.SetTuple1(12, 40);\n         scalars.SetTuple1(13, 100);\n         scalars.SetTuple1(14, 0);\n         scalars.SetTuple1(15, 60);\n         scalars.SetTuple1(16, 40);\n         scalars.SetTuple1(17, 100);\n         scalars.SetTuple1(18, 0);\n         scalars.SetTuple1(19, 25);\n         scalars.SetTuple1(20, 25);\n         scalars.SetTuple1(21, 50);\n         scalars.SetTuple1(22, 50);\n         scalars.SetTuple1(23, 75);\n         scalars.SetTuple1(24, 75);\n         scalars.SetTuple1(25, 100);\n\n         vtkPolyData polyData = vtkPolyData.New();\n         polyData.SetPoints(pts);\n         polyData.SetPolys(polys);\n         polyData.GetPointData().SetScalars(scalars);\n\n         vtkBandedPolyDataContourFilter bf = vtkBandedPolyDataContourFilter.New();\n#if VTK_MAJOR_VERSION_5\n         bf.SetInput(polyData);\n#else\n         bf.SetInputData (polyData);\n#endif\n         bf.GenerateValues(3, 25, 75);\n\n         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();\n         mapper.SetInputConnection(bf.GetOutputPort());\n         mapper.SetScalarModeToUseCellData();\n         mapper.SetScalarRange(0, 4);\n         vtkActor actor = vtkActor.New();\n         actor.SetMapper(mapper);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(actor);\n      }\n   }\n}\n
        "},{"location":"CSharp/VisualizationAlgorithms/FilledContours/","title":"FilledContours","text":"

        vtk-examples/CSharp/VisualizationAlgorithms/FilledContours

        "},{"location":"CSharp/VisualizationAlgorithms/FilledContours/#description","title":"Description","text":"

        This example produces filled contours using the [vtkClipPolyData](https://www.vtk.org/doc/nightly/html/classvtkClipPolyData.html#details) filter. There is a sample data file [here](http://public.kitware.com/cgi-bin/viewcvs.cgi/Data/filledContours.vtp?root=VTKData&view=log)

        A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET Note: As long as ActiViz.NET is not build with VTK version 6.0 or higher you must define the preprocessor directive VTK_MAJOR_VERSION_5.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"CSharp/VisualizationAlgorithms/FilledContours/#code","title":"Code","text":"

        FilledContours.cs

        using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Windows.Forms;\nusing System.Diagnostics;\n\nusing Kitware.VTK;\n\nnamespace ActiViz.Examples {\n   public partial class Form1 : Form {\n      public Form1() {\n         InitializeComponent();\n      }\n\n\n      private void renderWindowControl1_Load(object sender, EventArgs e) {\n         try {\n            FilledContours(@\"c:\\vtk\\vtkdata-5.8.0\\Data\\filledContours.vtp\", 10);\n         }\n         catch(Exception ex) {\n            MessageBox.Show(ex.Message, \"Exception\", MessageBoxButtons.OK);\n         }\n      }\n\n\n      private void FilledContours(string filePath, int numberOfContours) {\n         // Read the file\n         vtkXMLPolyDataReader reader = vtkXMLPolyDataReader.New();\n\n         reader.SetFileName(filePath);\n         reader.Update(); // Update so that we can get the scalar range\n\n         double[] scalarRange = reader.GetOutput().GetPointData().GetScalars().GetRange();\n\n         vtkAppendPolyData appendFilledContours = vtkAppendPolyData.New();\n\n         double delta = ( scalarRange[1] - scalarRange[0] ) / ( numberOfContours - 1 );\n\n         // Keep the clippers alive\n         List<vtkClipPolyData>  clippersLo = new List<vtkClipPolyData>();\n         List<vtkClipPolyData>  clippersHi = new List<vtkClipPolyData>();\n\n         for(int i = 0; i < numberOfContours; i++) {\n            double valueLo = scalarRange[0] + i * delta;\n            double valueHi = scalarRange[0] + ( i + 1 ) * delta;\n\n            clippersLo.Add(vtkClipPolyData.New());\n            clippersLo[i].SetValue(valueLo);\n            if(i == 0) {\n               clippersLo[i].SetInputConnection(reader.GetOutputPort());\n            }\n            else {\n               clippersLo[i].SetInputConnection(clippersHi[i - 1].GetOutputPort(1));\n            }\n            clippersLo[i].InsideOutOff();\n            clippersLo[i].Update();\n\n            clippersHi.Add(vtkClipPolyData.New());\n            clippersHi[i].SetValue(valueHi);\n            clippersHi[i].SetInputConnection(clippersLo[i].GetOutputPort());\n            clippersHi[i].GenerateClippedOutputOn();\n            clippersHi[i].InsideOutOn();\n            clippersHi[i].Update();\n            if(clippersHi[i].GetOutput().GetNumberOfCells() == 0) {\n               continue;\n            }\n\n            vtkFloatArray cd = vtkFloatArray.New();\n            cd.SetNumberOfComponents(1);\n            cd.SetNumberOfTuples(clippersHi[i].GetOutput().GetNumberOfCells());\n            cd.FillComponent(0, valueLo);\n\n            clippersHi[i].GetOutput().GetCellData().SetScalars(cd);\n            appendFilledContours.AddInputConnection(clippersHi[i].GetOutputPort());\n         }\n\n         vtkCleanPolyData filledContours = vtkCleanPolyData.New();\n         filledContours.SetInputConnection(appendFilledContours.GetOutputPort());\n\n         vtkLookupTable lut = vtkLookupTable.New();\n         lut.SetNumberOfTableValues(numberOfContours + 1);\n         lut.Build();\n         vtkPolyDataMapper contourMapper = vtkPolyDataMapper.New();\n         contourMapper.SetInputConnection(filledContours.GetOutputPort());\n         contourMapper.SetScalarRange(scalarRange[0], scalarRange[1]);\n         contourMapper.SetScalarModeToUseCellData();\n         contourMapper.SetLookupTable(lut);\n\n         vtkActor contourActor = vtkActor.New();\n         contourActor.SetMapper(contourMapper);\n         contourActor.GetProperty().SetInterpolationToFlat();\n\n         vtkContourFilter contours = vtkContourFilter.New();\n         contours.SetInputConnection(filledContours.GetOutputPort());\n         contours.GenerateValues(numberOfContours, scalarRange[0], scalarRange[1]);\n\n         vtkPolyDataMapper contourLineMapperer = vtkPolyDataMapper.New();\n         contourLineMapperer.SetInputConnection(contours.GetOutputPort());\n         contourLineMapperer.SetScalarRange(scalarRange[0], scalarRange[1]);\n         contourLineMapperer.ScalarVisibilityOff();\n\n         vtkActor contourLineActor = vtkActor.New();\n         contourLineActor.SetMapper(contourLineMapperer);\n         contourLineActor.GetProperty().SetLineWidth(2);\n\n         // get a reference to the renderwindow of our renderWindowControl1\n         vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;\n         // renderer\n         vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();\n         // set background color\n         renderer.SetBackground(.2, .3, .4);\n         // add our actor to the renderer\n         renderer.AddActor(contourActor);\n         renderer.AddActor(contourLineActor);\n      }\n   }\n}\n
        "},{"location":"Cxx/Snippets/","title":"Snippets","text":""},{"location":"Cxx/Snippets/#description","title":"Description","text":"

        Snippets are chunks of code that can be cut (snipped) and pasted into examples. We want each example to be stand-alone, so we do not keep the snippet code in a library.

        "},{"location":"Cxx/Snippets/#available-snippets","title":"Available snippets","text":""},{"location":"Cxx/Snippets/#cameraposition","title":"CameraPosition","text":"

        Output the camera position while moving the image.

        "},{"location":"Cxx/Snippets/#checkvtkversion","title":"CheckVTKVersion","text":"

        Check the VTK version returning true if the requested VTK version is >= the current version.

        "},{"location":"Cxx/Snippets/#pointtoglyph","title":"PointToGlyph","text":"

        Represent points as glyphs.

        "},{"location":"Cxx/Snippets/#readpolydata","title":"ReadPolyData","text":"

        Uses the appropriate vtkPolyData reader to read any vtkPolyData file.

        "},{"location":"Cxx/Snippets/#savescenetofielddata","title":"SaveSceneToFieldData","text":"

        Stores the current vtkCamera location in a vtkDataSet's vtkFieldData.

        "},{"location":"Cxx/Snippets/#restorescenefromfielddata","title":"RestoreSceneFromFieldData","text":"

        Restores the saved vtkCamera view from a vtkDataSet's vtkFieldData.

        "},{"location":"Cxx/Snippets/#savescenetofile","title":"SaveSceneToFile","text":"

        Stores the current vtkCamera location in a file.

        "},{"location":"Cxx/Snippets/#restorescenefromfile","title":"RestoreSceneFromFile","text":"

        Restores the saved vtkCamera view from a file.

        "},{"location":"Cxx/Snippets/#choosecontrastingcolor","title":"ChooseContrastingColor","text":"

        Given a color, find a contrasting color. If the given color is \"light\", use the lightColor otherwise use the darkColor

        "},{"location":"Cxx/Snippets/#viewportborders","title":"ViewportBorders","text":"

        Draw the borders of a vtkRenderer's viewports.

        "},{"location":"Cxx/Snippets/#writeimage","title":"WriteImage","text":"

        Take a screen shot and save it to a file.

        "},{"location":"Cxx/Animation/AnimateActors/","title":"AnimateActors","text":"

        vtk-examples/Cxx/Animation/AnimateActors

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Animation/AnimateActors/#code","title":"Code","text":"

        AnimateActors.cxx

        #include \"AnimateActors.h\"\n\n#include <vtkAnimationCue.h>\n#include <vtkAnimationScene.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkLogger.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int argc, char* argv[])\n{\n  vtkLogger::Init(argc, argv);\n\n  // Colors\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d coneColor = colors->GetColor3d(\"Tomato\");\n  vtkColor3d sphereColor = colors->GetColor3d(\"Banana\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Peacock\");\n\n  // Create the graphics structure. The renderer renders into the\n  // render window.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(backgroundColor.GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  iren->SetRenderWindow(renWin);\n  renWin->AddRenderer(ren1);\n\n  // Generate a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphere;\n  sphere->SetMapper(sphereMapper);\n  sphere->GetProperty()->SetDiffuseColor(sphereColor.GetData());\n  sphere->GetProperty()->SetDiffuse(.7);\n  sphere->GetProperty()->SetSpecular(.3);\n  sphere->GetProperty()->SetSpecularPower(30.0);\n\n  ren1->AddActor(sphere);\n\n  // Generate a cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetResolution(31);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n  // auto cone = vtkSmartPointer<vtkActor>::New();\n  vtkNew<vtkActor> cone;\n  cone->SetMapper(coneMapper);\n  cone->GetProperty()->SetDiffuseColor(coneColor.GetData());\n\n  ren1->AddActor(cone);\n\n  // Create an Animation Scene\n  vtkNew<vtkAnimationScene> scene;\n  if (argc >= 2 && strcmp(argv[1], \"-real\") == 0)\n  {\n    vtkLogF(INFO, \"real-time mode\");\n    scene->SetModeToRealTime();\n  }\n  else\n  {\n    vtkLogF(INFO, \"sequence mode\");\n    scene->SetModeToSequence();\n  }\n  scene->SetLoop(0);\n  scene->SetFrameRate(5);\n  scene->SetStartTime(0);\n  scene->SetEndTime(20);\n  scene->AddObserver(vtkCommand::AnimationCueTickEvent, renWin.GetPointer(),\n                     &vtkWindow::Render);\n\n  // Create an Animation Cue for each actor\n  vtkNew<vtkAnimationCue> cue1;\n  cue1->SetStartTime(5);\n  cue1->SetEndTime(23);\n  scene->AddCue(cue1);\n\n  vtkNew<vtkAnimationCue> cue2;\n  cue2->SetStartTime(1);\n  cue2->SetEndTime(10);\n  scene->AddCue(cue2);\n\n  // Create an ActorAnimator for each actor;\n  ActorAnimator animateSphere;\n  animateSphere.SetActor(sphere);\n  animateSphere.AddObserversToCue(cue1);\n\n  ActorAnimator animateCone;\n  animateCone.SetEndPosition(vtkVector3d(-1, -1, -1));\n  animateCone.SetActor(cone);\n  animateCone.AddObserversToCue(cue2);\n\n  renWin->SetWindowName(\"AnimateActors\");\n\n  renWin->Render();\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(.5);\n  ren1->ResetCameraClippingRange();\n\n  // Create Cue observer.\n  scene->Play();\n  scene->Stop();\n\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n

        AnimateActors.h

        #ifndef __AnimateActors_h\n#define __AnimateActors_h\n\n#include <vtkActor.h>\n#include <vtkAnimationCue.h>\n#include <vtkCommand.h>\n#include <vtkVectorOperators.h>\n\nclass ActorAnimator\n{\npublic:\n  ActorAnimator(vtkActor* Actor, const vtkVector3d& StartPosition,\n                const vtkVector3d& EndPosition)\n    : Actor(Actor), StartPosition(StartPosition), EndPosition(EndPosition)\n  {\n  }\n\n  ActorAnimator()\n    : Actor(nullptr), StartPosition(0, 0, 0), EndPosition(0.5, 0.5, 0.5)\n  {\n  }\n\n  ~ActorAnimator() = default;\n\n  void SetActor(vtkActor* actor)\n  {\n    this->Actor = actor;\n  }\n\n  void SetStartPosition(const vtkVector3d& position)\n  {\n    this->StartPosition = position;\n  }\n  void SetEndPosition(const vtkVector3d& position)\n  {\n    this->EndPosition = position;\n  }\n\n  void AddObserversToCue(vtkAnimationCue* cue)\n  {\n    cue->AddObserver(vtkCommand::StartAnimationCueEvent, this,\n                     &ActorAnimator::Start);\n    cue->AddObserver(vtkCommand::EndAnimationCueEvent, this,\n                     &ActorAnimator::End);\n    cue->AddObserver(vtkCommand::AnimationCueTickEvent, this,\n                     &ActorAnimator::Tick);\n  }\n\nprivate:\n  //@{\n  /**\n   * These are callbacks that called when corresponding events are fired by the\n   * cue (see AddObserversToCue)\n   */\n  void Start()\n  {\n    this->Actor->SetPosition(this->StartPosition.GetData());\n  }\n\n  void Tick(vtkObject* vtkNotUsed(caller), unsigned long vtkNotUsed(event),\n            void* calldata)\n  {\n    vtkAnimationCue::AnimationCueInfo* info =\n        reinterpret_cast<vtkAnimationCue::AnimationCueInfo*>(calldata);\n    const double t = (info->AnimationTime - info->StartTime) /\n        (info->EndTime - info->StartTime);\n    vtkVector3d position =\n        this->StartPosition + (this->EndPosition - this->StartPosition) * t;\n    this->Actor->SetPosition(position.GetData());\n  }\n\n  void End()\n  {\n    this->Actor->SetPosition(this->EndPosition.GetData());\n  }\n  //@}\n\n  vtkActor* Actor;\n  vtkVector3d StartPosition;\n  vtkVector3d EndPosition;\n};\n\n#endif // __AnimateActors_h\n
        "},{"location":"Cxx/Animation/AnimateActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AnimateActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AnimateActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AnimateActors MACOSX_BUNDLE AnimateActors.cxx )\n  target_link_libraries(AnimateActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AnimateActors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Animation/AnimateActors/#download-and-build-animateactors","title":"Download and Build AnimateActors","text":"

        Click here to download AnimateActors and its CMakeLists.txt file. Once the tarball AnimateActors.tar has been downloaded and extracted,

        cd AnimateActors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AnimateActors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Animation/RotatingSphere/","title":"RotatingSphere","text":"

        vtk-examples/Cxx/Animation/RotatingSphere

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Animation/RotatingSphere/#description","title":"Description","text":"

        This example demonstrates how to create a rotating sphere. A timer is used to rotate a sphere along z-axis.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Animation/RotatingSphere/#code","title":"Code","text":"

        RotatingSphere.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nclass vtkTimerCallback2 : public vtkCommand\n{\npublic:\n  vtkTimerCallback2() = default;\n  ~vtkTimerCallback2() = default;\n\n  int timerId = 0;\n  static vtkTimerCallback2* New()\n  {\n    vtkTimerCallback2* cb = new vtkTimerCallback2;\n    cb->TimerCount = 0;\n    return cb;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long eventId,\n                       void* vtkNotUsed(callData))\n  {\n    vtkRenderWindowInteractor* iren =\n        dynamic_cast<vtkRenderWindowInteractor*>(caller);\n    if (vtkCommand::TimerEvent == eventId)\n    {\n      ++this->TimerCount;\n    }\n    if (TimerCount < 36)\n    {\n      actor->RotateZ(5);\n      iren->GetRenderWindow()->Render();\n    }\n    else\n    {\n      iren->DestroyTimer();\n    }\n  }\n\nprivate:\n  int TimerCount = 0;\n\npublic:\n  vtkActor* actor;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n  sphereSource->SetThetaResolution(15);\n  sphereSource->SetPhiResolution(15);\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->RotateX(90);\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n\n  renderer->SetBackground(colors->GetColor3d(\"Seashell\").GetData());\n  // Render and interact\n  renderWindow->SetWindowName(\"RotatingSphere\");\n  renderWindow->Render();\n\n  // Initialize must be called prior to creating timer events.\n  renderWindowInteractor->Initialize();\n\n  // Sign up to receive TimerEvent\n  vtkNew<vtkTimerCallback2> cb;\n  cb->actor = actor;\n\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, cb);\n  int timerId = renderWindowInteractor->CreateRepeatingTimer(100);\n  cb->timerId = timerId;\n\n  // Start the interaction and timer\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Animation/RotatingSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotatingSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotatingSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotatingSphere MACOSX_BUNDLE RotatingSphere.cxx )\n  target_link_libraries(RotatingSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotatingSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Animation/RotatingSphere/#download-and-build-rotatingsphere","title":"Download and Build RotatingSphere","text":"

        Click here to download RotatingSphere and its CMakeLists.txt file. Once the tarball RotatingSphere.tar has been downloaded and extracted,

        cd RotatingSphere/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RotatingSphere\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Annotation/MultiLineText/","title":"MultiLineText","text":"

        vtk-examples/Cxx/Annotation/MultiLineText

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Annotation/MultiLineText/#description","title":"Description","text":"

        This example demonstrates the use of multiline 2D text using vtkTextMapper. It shows several justifications as well as single-line and multiple-line text inputs.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Annotation/MultiLineText/#code","title":"Code","text":"

        MultiLineText.cxx

        // This example demonstrates the use of multiline 2D text using\n// vtkTextMappers.  It shows several justifications as well as\n// single-line and multiple-line text inputs.\n\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkCoordinate.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  int font_size = 24;\n\n  // Create the text mappers and the associated Actor2Ds.\n\n  // The font and text properties (except justification) are the same for\n  // each single line mapper. Let's create a common text property object\n  vtkNew<vtkTextProperty> singleLineTextProp;\n\n  singleLineTextProp->SetFontSize(font_size);\n  singleLineTextProp->SetFontFamilyToArial();\n  singleLineTextProp->BoldOff();\n  singleLineTextProp->ItalicOff();\n  singleLineTextProp->ShadowOff();\n\n  // The font and text properties (except justification) are the same for\n  // each multi line mapper. Let's create a common text property object\n  vtkNew<vtkTextProperty> multiLineTextProp;\n\n  multiLineTextProp->ShallowCopy(singleLineTextProp);\n  multiLineTextProp->BoldOn();\n  multiLineTextProp->ItalicOn();\n  multiLineTextProp->ShadowOn();\n  multiLineTextProp->SetLineSpacing(0.8);\n\n  vtkNew<vtkNamedColors> colors;\n\n  // The text is on a single line and bottom-justified.\n  vtkNew<vtkTextMapper> singleLineTextB;\n  singleLineTextB->SetInput(\"Single line (bottom)\");\n  auto tprop = singleLineTextB->GetTextProperty();\n  tprop->ShallowCopy(singleLineTextProp);\n\n  tprop->SetVerticalJustificationToBottom();\n  tprop->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor2D> singleLineTextActorB;\n  singleLineTextActorB->SetMapper(singleLineTextB);\n  singleLineTextActorB->GetPositionCoordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  singleLineTextActorB->GetPositionCoordinate()->SetValue(0.05, 0.85);\n\n  // The text is on a single line and center-justified (vertical\n  // justification).\n  vtkNew<vtkTextMapper> singleLineTextC;\n  singleLineTextC->SetInput(\"Single line (centered)\");\n  tprop = singleLineTextC->GetTextProperty();\n  tprop->ShallowCopy(singleLineTextProp);\n  tprop->SetVerticalJustificationToCentered();\n  tprop->SetColor(colors->GetColor3d(\"DarkGreen\").GetData());\n  vtkNew<vtkActor2D> singleLineTextActorC;\n\n  singleLineTextActorC->SetMapper(singleLineTextC);\n  singleLineTextActorC->GetPositionCoordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  singleLineTextActorC->GetPositionCoordinate()->SetValue(0.05, 0.75);\n\n  // The text is on a single line and top-justified.\n  vtkNew<vtkTextMapper> singleLineTextT;\n  singleLineTextT->SetInput(\"Single line (top)\");\n  tprop = singleLineTextT->GetTextProperty();\n  tprop->ShallowCopy(singleLineTextProp);\n  tprop->SetVerticalJustificationToTop();\n  tprop->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkActor2D> singleLineTextActorT;\n  singleLineTextActorT->SetMapper(singleLineTextT);\n  singleLineTextActorT->GetPositionCoordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  singleLineTextActorT->GetPositionCoordinate()->SetValue(0.05, 0.65);\n\n  // The text is on multiple lines and left- and top-justified.\n  vtkNew<vtkTextMapper> textMapperL;\n  textMapperL->SetInput(\"This is\\nmulti-line\\ntext output\\n(left-top)\");\n  tprop = textMapperL->GetTextProperty();\n  tprop->ShallowCopy(multiLineTextProp);\n  tprop->SetJustificationToLeft();\n  tprop->SetVerticalJustificationToTop();\n  tprop->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor2D> textActorL;\n  textActorL->SetMapper(textMapperL);\n  textActorL->GetPositionCoordinate()->SetCoordinateSystemToNormalizedDisplay();\n  textActorL->GetPositionCoordinate()->SetValue(0.05, 0.5);\n\n  // The text is on multiple lines and center-justified (both horizontal and\n  // vertical).\n  vtkNew<vtkTextMapper> textMapperC;\n  textMapperC->SetInput(\"This is\\nmulti-line\\ntext output\\n(centered)\");\n  tprop = textMapperC->GetTextProperty();\n  tprop->ShallowCopy(multiLineTextProp);\n  tprop->SetJustificationToCentered();\n  tprop->SetVerticalJustificationToCentered();\n  tprop->SetColor(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  vtkNew<vtkActor2D> textActorC;\n  textActorC->SetMapper(textMapperC);\n  textActorC->GetPositionCoordinate()->SetCoordinateSystemToNormalizedDisplay();\n  textActorC->GetPositionCoordinate()->SetValue(0.5, 0.5);\n\n  // The text is on multiple lines and right- and bottom-justified.\n  vtkNew<vtkTextMapper> textMapperR;\n  textMapperR->SetInput(\"This is\\nmulti-line\\ntext output\\n(right-bottom)\");\n  tprop = textMapperR->GetTextProperty();\n  tprop->ShallowCopy(multiLineTextProp);\n  tprop->SetJustificationToRight();\n  tprop->SetVerticalJustificationToBottom();\n  tprop->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkActor2D> textActorR;\n  textActorR->SetMapper(textMapperR);\n  textActorR->GetPositionCoordinate()->SetCoordinateSystemToNormalizedDisplay();\n  textActorR->GetPositionCoordinate()->SetValue(0.95, 0.5);\n\n  // Draw the grid to demonstrate the placement of the text.\n\n  // Set up the necessary points.\n  vtkNew<vtkPoints> Pts;\n  Pts->InsertNextPoint(0.05, 0.0, 0.0);\n  Pts->InsertNextPoint(0.05, 1.0, 0.0);\n  Pts->InsertNextPoint(0.5, 0.0, 0.0);\n  Pts->InsertNextPoint(0.5, 1.0, 0.0);\n  Pts->InsertNextPoint(0.95, 0.0, 0.0);\n  Pts->InsertNextPoint(0.95, 1.0, 0.0);\n  Pts->InsertNextPoint(0.0, 0.5, 0.0);\n  Pts->InsertNextPoint(1.0, 0.5, 0.0);\n  Pts->InsertNextPoint(0.00, 0.85, 0.0);\n  Pts->InsertNextPoint(0.50, 0.85, 0.0);\n  Pts->InsertNextPoint(0.00, 0.75, 0.0);\n  Pts->InsertNextPoint(0.50, 0.75, 0.0);\n  Pts->InsertNextPoint(0.00, 0.65, 0.0);\n  Pts->InsertNextPoint(0.50, 0.65, 0.0);\n\n  // Set up the lines that use these points.\n  vtkNew<vtkCellArray> Lines;\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(0);\n  Lines->InsertCellPoint(1);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(2);\n  Lines->InsertCellPoint(3);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(4);\n  Lines->InsertCellPoint(5);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(6);\n  Lines->InsertCellPoint(7);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(8);\n  Lines->InsertCellPoint(9);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(10);\n  Lines->InsertCellPoint(11);\n  Lines->InsertNextCell(2);\n  Lines->InsertCellPoint(12);\n  Lines->InsertCellPoint(13);\n\n  // Create a grid that uses these points and lines.\n  vtkNew<vtkPolyData> Grid;\n  Grid->SetPoints(Pts);\n  Grid->SetLines(Lines);\n  // Set up the coordinate system.\n  vtkNew<vtkCoordinate> normCoords;\n  normCoords->SetCoordinateSystemToNormalizedViewport();\n\n  // Set up the mapper and actor (2D) for the grid.\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(Grid);\n  mapper->SetTransformCoordinate(normCoords);\n  vtkNew<vtkActor2D> gridActor;\n  gridActor->SetMapper(mapper);\n  gridActor->GetProperty()->SetColor(colors->GetColor3d(\"DimGray\").GetData());\n\n  // Create the Renderer, RenderWindow, and RenderWindowInteractor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer; set the background and size; zoom in\n  // closer to the image; render\n  renderer->AddActor2D(textActorL);\n  renderer->AddActor2D(textActorC);\n  renderer->AddActor2D(textActorR);\n  renderer->AddActor2D(singleLineTextActorB);\n  renderer->AddActor2D(singleLineTextActorC);\n  renderer->AddActor2D(singleLineTextActorT);\n  renderer->AddActor2D(gridActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderer->GetActiveCamera()->Zoom(1.5);\n\n  interactor->Initialize();\n  renderWindow->SetWindowName(\"MultiLineText\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Annotation/MultiLineText/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultiLineText)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultiLineText: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultiLineText MACOSX_BUNDLE MultiLineText.cxx )\n  target_link_libraries(MultiLineText PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultiLineText\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Annotation/MultiLineText/#download-and-build-multilinetext","title":"Download and Build MultiLineText","text":"

        Click here to download MultiLineText and its CMakeLists.txt file. Once the tarball MultiLineText.tar has been downloaded and extracted,

        cd MultiLineText/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MultiLineText\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Annotation/TextOrigin/","title":"TextOrigin","text":"

        vtk-examples/Cxx/Annotation/TextOrigin

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Annotation/TextOrigin/#description","title":"Description","text":"

        This example demonstrates the use of vtkVectorText and vtkFollower. vtkVectorText is used to create 3D annotation. vtkFollower is used to position the 3D text and to ensure that the text always faces the renderer's active camera (i.e., the text is always readable).

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Annotation/TextOrigin/#code","title":"Code","text":"

        TextOrigin.cxx

        // This example demonstrates the use of vtkVectorText and vtkFollower.\n// vtkVectorText is used to create 3D annotation.  vtkFollower is used to\n// position the 3D text and to ensure that the text always faces the\n// renderer's active camera (i.e., the text is always readable).\n\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkFollower.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorText.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the axes and the associated mapper and actor.\n  vtkNew<vtkAxes> axes;\n  axes->SetOrigin(0, 0, 0);\n  vtkNew<vtkPolyDataMapper> axesMapper;\n  axesMapper->SetInputConnection(axes->GetOutputPort());\n  vtkNew<vtkActor> axesActor;\n  axesActor->SetMapper(axesMapper);\n\n  // Create the 3D text and the associated mapper and follower (a type of\n  // actor).  Position the text so it is displayed over the origin of the\n  // axes.\n  vtkNew<vtkVectorText> atext;\n  atext->SetText(\"Origin\");\n  vtkNew<vtkPolyDataMapper> textMapper;\n  textMapper->SetInputConnection(atext->GetOutputPort());\n  vtkNew<vtkFollower> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetScale(0.2, 0.2, 0.2);\n  textActor->AddPosition(0, -0.1, 0);\n  textActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create the Renderer, RenderWindow, and RenderWindowInteractor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  // Add the actors to the renderer.\n  renderer->AddActor(axesActor);\n  renderer->AddActor(textActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  // Zoom in closer.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.6);\n\n  // Reset the clipping range of the camera; set the camera of the\n  // follower; render.\n  renderer->ResetCameraClippingRange();\n  textActor->SetCamera(renderer->GetActiveCamera());\n\n  interactor->Initialize();\n  renderWindow->SetWindowName(\"TextOrigin\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Annotation/TextOrigin/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextOrigin)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextOrigin: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextOrigin MACOSX_BUNDLE TextOrigin.cxx )\n  target_link_libraries(TextOrigin PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextOrigin\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Annotation/TextOrigin/#download-and-build-textorigin","title":"Download and Build TextOrigin","text":"

        Click here to download TextOrigin and its CMakeLists.txt file. Once the tarball TextOrigin.tar has been downloaded and extracted,

        cd TextOrigin/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TextOrigin\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Annotation/XYPlot/","title":"XYPlot","text":"

        vtk-examples/Cxx/Annotation/XYPlot

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Annotation/XYPlot/#description","title":"Description","text":"

        This example demonstrates the use of vtkXYPlotActor to display three probe lines using three different techniques. In this example, we are loading data using the vtkPLOT3DReader. We are using the vtkProbeFilter to extract the underlying point data along three probe lines.

        Note

        The image was generated with this volume data: src/Testing/Data/combxyz.bin and src/Testing/Data/combq.bin?raw=true.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Annotation/XYPlot/#code","title":"Code","text":"

        XYPlot.cxx

        // This example demonstrates the use of vtkXYPlotActor to display three\n// probe lines using three different techniques.  In this example, we\n// are loading data using the vtkPLOT3DReader.  We are using the\n// vtkProbeFilter to extract the underlying point data along three\n// probe lines.\n\n#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkLineSource.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkXYPlotActor.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create a PLOT3D reader and load the data.\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  auto pl3d_output =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // Create three line sources to use for the probe lines.\n  vtkNew<vtkLineSource> line;\n  line->SetResolution(30);\n\n  // Move the line into place and create the probe filter. For\n  // vtkProbeFilter, the probe line is the input, and the underlying data\n  // set is the source.\n  vtkNew<vtkTransform> transL1;\n  transL1->Translate(3.7, 0.0, 28.37);\n  transL1->Scale(5, 5, 5);\n  transL1->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> tf;\n  tf->SetInputConnection(line->GetOutputPort());\n  tf->SetTransform(transL1);\n\n  vtkNew<vtkProbeFilter> probe;\n  probe->SetInputConnection(tf->GetOutputPort());\n  probe->SetSourceData(pl3d_output);\n\n  // Move the line again and create another probe filter.\n  vtkNew<vtkTransform> transL2;\n  transL2->Translate(9.2, 0.0, 31.20);\n  transL2->Scale(5, 5, 5);\n  transL2->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> tf2;\n  tf2->SetInputConnection(line->GetOutputPort());\n  tf2->SetTransform(transL2);\n  vtkNew<vtkProbeFilter> probe2;\n  probe2->SetInputConnection(tf2->GetOutputPort());\n  probe2->SetSourceData(pl3d_output);\n\n  // Move the line again and create a third probe filter.\n  vtkNew<vtkTransform> transL3;\n  transL3->Translate(13.27, 0.0, 33.40);\n  transL3->Scale(4.5, 4.5, 4.5);\n  transL3->RotateY(90);\n  vtkNew<vtkTransformPolyDataFilter> tf3;\n  tf3->SetInputConnection(line->GetOutputPort());\n  tf3->SetTransform(transL3);\n  vtkNew<vtkProbeFilter> probe3;\n  probe3->SetInputConnection(tf3->GetOutputPort());\n  probe3->SetSourceData(pl3d_output);\n\n  // Create a vtkAppendPolyData to merge the output of the three probe\n  // filters into one data set.\n  vtkNew<vtkAppendPolyData> appendF;\n  appendF->AddInputConnection(probe->GetOutputPort());\n  appendF->AddInputConnection(probe2->GetOutputPort());\n  appendF->AddInputConnection(probe3->GetOutputPort());\n\n  // Create a tube filter to represent the lines as tubes.  Set up the\n  // associated mapper and actor.\n  vtkNew<vtkTubeFilter> tuber;\n  tuber->SetInputConnection(appendF->GetOutputPort());\n  tuber->SetRadius(0.1);\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(tuber->GetOutputPort());\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n\n  // Create an xy-plot using the output of the 3 probe filters as input.\n  // The x-values we are plotting are arc length.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXYPlotActor> xyplot;\n  xyplot->AddDataSetInputConnection(probe->GetOutputPort());\n  xyplot->AddDataSetInputConnection(probe2->GetOutputPort());\n  xyplot->AddDataSetInputConnection(probe3->GetOutputPort());\n  xyplot->GetPositionCoordinate()->SetValue(0.0, 0.67, 0);\n  xyplot->GetPosition2Coordinate()->SetValue(1.0, 0.33,\n                                             0); // relative to Position;\n  xyplot->SetXValuesToArcLength();\n  xyplot->SetNumberOfXLabels(6);\n  xyplot->SetTitle(\"Pressure vs. Arc Length (Zoomed View)\");\n  xyplot->SetXTitle(\"\");\n  xyplot->SetYTitle(\"P\");\n  xyplot->SetXRange(.1, .35);\n  xyplot->SetYRange(.2, .4);\n  xyplot->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  xyplot->GetProperty()->SetLineWidth(2);\n  // Set text prop color\n  // Assign same object to all text props\n  vtkTextProperty* tprop = xyplot->GetTitleTextProperty();\n  tprop->SetColor(xyplot->GetProperty()->GetColor());\n  xyplot->SetAxisTitleTextProperty(tprop);\n  xyplot->SetAxisLabelTextProperty(tprop);\n\n  // Create an xy-plot using the output of the 3 probe filters as input.\n  // The x-values we are plotting are normalized arc length.\n  vtkNew<vtkXYPlotActor> xyplot2;\n  xyplot2->AddDataSetInputConnection(probe->GetOutputPort());\n  xyplot2->AddDataSetInputConnection(probe2->GetOutputPort());\n  xyplot2->AddDataSetInputConnection(probe3->GetOutputPort());\n  xyplot2->GetPositionCoordinate()->SetValue(0.00, 0.33, 0);\n  xyplot2->GetPosition2Coordinate()->SetValue(1.0, 0.33,\n                                              0); // relative to Position;\n  xyplot2->SetXValuesToNormalizedArcLength();\n  xyplot2->SetNumberOfXLabels(6);\n  xyplot2->SetTitle(\"Pressure vs. Normalized Arc Length\");\n  xyplot2->SetXTitle(\"\");\n  xyplot2->SetYTitle(\"P\");\n  xyplot2->PlotPointsOn();\n  xyplot2->PlotLinesOff();\n  xyplot2->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  xyplot2->GetProperty()->SetPointSize(5);\n  // Set text prop color\n  // Assign same object to all text props\n  tprop = xyplot2->GetTitleTextProperty();\n  tprop->SetColor(xyplot2->GetProperty()->GetColor());\n  xyplot2->SetAxisTitleTextProperty(tprop);\n  xyplot2->SetAxisLabelTextProperty(tprop);\n\n  // Create an xy-plot using the output of the 3 probe filters as input.\n  // The x-values we are plotting are the underlying point data values.\n  vtkNew<vtkXYPlotActor> xyplot3;\n  xyplot3->AddDataSetInputConnection(probe->GetOutputPort());\n  xyplot3->AddDataSetInputConnection(probe2->GetOutputPort());\n  xyplot3->AddDataSetInputConnection(probe3->GetOutputPort());\n  xyplot3->GetPositionCoordinate()->SetValue(0.0, 0.0, 0);\n  xyplot3->GetPosition2Coordinate()->SetValue(1.0, 0.33,\n                                              0); // relative to Position;\n  xyplot3->SetXValuesToIndex();\n  xyplot3->SetNumberOfXLabels(6);\n  xyplot3->SetTitle(\"Pressure vs. Point Id\");\n  xyplot3->SetXTitle(\"Probe Length\");\n  xyplot3->SetYTitle(\"P\");\n  xyplot3->PlotPointsOn();\n  xyplot3->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  xyplot3->GetProperty()->SetPointSize(3);\n  // Set text prop color\n  // Assign same object to all text props\n  tprop = xyplot3->GetTitleTextProperty();\n  tprop->SetColor(xyplot3->GetProperty()->GetColor());\n  xyplot3->SetAxisTitleTextProperty(tprop);\n  xyplot3->SetAxisLabelTextProperty(tprop);\n\n  // Draw an outline of the PLOT3D data set.\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3d_output);\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the Renderers, RenderWindow, and RenderWindowInteractor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderer> renderer2;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->AddRenderer(renderer2);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Set the background, viewport (necessary because we want to have the\n  // renderers draw to different parts of the render window) of the first\n  // renderer.  Add the outline and line actors to the renderer.\n  renderer->SetBackground(colors->GetColor3d(\"blue_light\").GetData());\n  renderer->SetViewport(0, 0, .5, 1);\n  renderer->AddActor(outlineActor);\n  renderer->AddActor(lineActor);\n\n  // Set the background and viewport of the second renderer.  Add the\n  // xy-plot actors to the renderer.  Set the size of the render window.\n  renderer2->SetBackground(colors->GetColor3d(\"silver\").GetData());\n  renderer2->SetViewport(0.5, 0.0, 1.0, 1.0);\n  renderer2->AddActor2D(xyplot);\n  renderer2->AddActor2D(xyplot2);\n  renderer2->AddActor2D(xyplot3);\n  renderWindow->SetSize(800, 600);\n\n  // Set up the camera parameters.\n  vtkCamera* cam1 = renderer->GetActiveCamera();\n  cam1->SetClippingRange(3.95297, 100);\n  cam1->SetFocalPoint(8.88908, 0.595038, 29.3342);\n  cam1->SetPosition(-12.3332, 31.7479, 41.2387);\n  cam1->SetViewUp(0.060772, -0.319905, 0.945498);\n\n  interactor->Initialize();\n  renderWindow->SetWindowName(\"XYPlot\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Annotation/XYPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(XYPlot)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"XYPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(XYPlot MACOSX_BUNDLE XYPlot.cxx )\n  target_link_libraries(XYPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS XYPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Annotation/XYPlot/#download-and-build-xyplot","title":"Download and Build XYPlot","text":"

        Click here to download XYPlot and its CMakeLists.txt file. Once the tarball XYPlot.tar has been downloaded and extracted,

        cd XYPlot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./XYPlot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/CMakeTechniques/CheckForModule/","title":"CheckForModule","text":"

        vtk-examples/Cxx/CMakeTechniques/CheckForModule

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/CMakeTechniques/CheckForModule/#code","title":"Code","text":"

        CheckForModule.cxx

        #include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n\n  return EXIT_SUCCESS;\n}\n
        cmake_minimum_required(VERSION 2.6)\n\nproject(CheckForModule)\n\nfind_package(VTK REQUIRED)\ninclude(${VTK_USE_FILE})\n\nfind_package(VTK REQUIRED)\nif(NOT vtkIOParallel_LOADED)\n  message(FATAL_ERROR \"vtkIOParallel is required but not available.\")\nendif()\n\nadd_executable(CheckForModule CheckForModule.cxx)\ntarget_link_libraries(CheckForModule ${VTK_LIBRARIES})\n
        "},{"location":"Cxx/CompositeData/CompositePolyDataMapper/","title":"CompositePolyDataMapper","text":"

        vtk-examples/Cxx/CompositeData/CompositePolyDataMapper

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/CompositeData/CompositePolyDataMapper/#code","title":"Code","text":"

        CompositePolyDataMapper.cxx

        #include <vtkActor.h>\n#include <vtkCompositeDataDisplayAttributes.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n\n#ifdef VTK_VERSION_NUMBER\n#if VTK_VERSION_NUMBER >= 90020230516ULL\n#define VTK_USE_CPD 1\n#include <vtkCompositePolyDataMapper.h>\n#else\n#include <vtkCompositePolyDataMapper2.h>\n#endif\n#endif\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphere1;\n  sphere1->SetRadius(3);\n  sphere1->SetCenter(0, 0, 0);\n  sphere1->Update();\n  vtkNew<vtkSphereSource> sphere2;\n  sphere2->SetRadius(2);\n  sphere2->SetCenter(2, 0, 0);\n  sphere2->Update();\n\n  vtkNew<vtkMultiBlockDataSet> mbds;\n  mbds->SetNumberOfBlocks(3);\n  mbds->SetBlock(0, sphere1->GetOutput());\n  // Leave block 1 NULL.  NULL blocks are valid and should be handled by\n  // algorithms that process multiblock datasets.  Especially when\n  // running in parallel where the blocks owned by other processes are\n  // NULL in this process.\n  mbds->SetBlock(2, sphere2->GetOutput());\n\n#ifdef VTK_USE_CPD\n  vtkNew<vtkCompositePolyDataMapper> mapper;\n#else\n  vtkNew<vtkCompositePolyDataMapper2> mapper;\n#endif\n  mapper->SetInputDataObject(mbds.GetPointer());\n  vtkNew<vtkCompositeDataDisplayAttributes> cdsa;\n  mapper->SetCompositeDataDisplayAttributes(cdsa.Get());\n\n  // You can use the vtkCompositeDataDisplayAttributes to set the color,\n  // opacity and visibiliy of individual blocks of the multiblock dataset.\n  // Attributes are mapped by block pointers (vtkDataObject*), so these can\n  // be queried by their flat index through a convenience function in the\n  // attribute class (vtkCompositeDataDisplayAttributes::DataObjectFromIndex).\n  // Alternatively, one can set attributes directly through the mapper using\n  // flat indices.\n  //\n  // This sets the block at flat index 2 red\n  // Note that the index is the flat index in the tree, so the whole multiblock\n  // is index 0 and the blocks are flat indexes 1, 2 and 3.  This affects\n  // the block returned by mbds->GetBlock(2).\n  mapper->SetBlockColor(2, colors->GetColor3d(\"Red\").GetData());\n  // Color the spheres.\n  mapper->SetBlockColor(1, colors->GetColor3d(\"LavenderBlush\").GetData());\n  mapper->SetBlockColor(3, colors->GetColor3d(\"Lavender\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper.Get());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer.Get());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow.Get());\n\n  renderer->AddActor(actor.Get());\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->SetWindowName(\"CompositePolyDataMapper\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/CompositeData/CompositePolyDataMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CompositePolyDataMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CompositePolyDataMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CompositePolyDataMapper MACOSX_BUNDLE CompositePolyDataMapper.cxx )\n  target_link_libraries(CompositePolyDataMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CompositePolyDataMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/CompositeData/CompositePolyDataMapper/#download-and-build-compositepolydatamapper","title":"Download and Build CompositePolyDataMapper","text":"

        Click here to download CompositePolyDataMapper and its CMakeLists.txt file. Once the tarball CompositePolyDataMapper.tar has been downloaded and extracted,

        cd CompositePolyDataMapper/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CompositePolyDataMapper\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/CompositeData/Generate2DAMRDataSetWithPulse/","title":"Generate2DAMRDataSetWithPulse","text":"

        vtk-examples/Cxx/CompositeData/Generate2DAMRDataSetWithPulse

        "},{"location":"Cxx/CompositeData/Generate2DAMRDataSetWithPulse/#description","title":"Description","text":"

        This utility code generates a simple 2D AMR dataset with a Gaussian pulse at the center. The resulting AMR dataset is written using the vtkXMLHierarchicalBoxDataSetWriter.

        Note

        This original source code for this example is here.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/CompositeData/Generate2DAMRDataSetWithPulse/#code","title":"Code","text":"

        Generate2DAMRDataSetWithPulse.cxx

        // .NAME Generate2DAMRDataSetWithPulse.cxx -- Generates sample 2-D AMR dataset\n//\n// .SECTION Description\n//  This utility code generates a simple 2D AMR dataset with a gaussian\n//  pulse at the center. The resulting AMR dataset is written using the\n//  vtkXMLHierarchicalBoxDataSetWriter.\n\n#include <cmath>\n#include <iostream>\n#include <sstream>\n\n#include <vtkAMRBox.h>\n#include <vtkAMRUtilities.h>\n#include <vtkCell.h>\n#include <vtkCellData.h>\n#include <vtkCompositeDataWriter.h>\n#include <vtkDoubleArray.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNew.h>\n#include <vtkOverlappingAMR.h>\n#include <vtkSmartPointer.h>\n#include <vtkUniformGrid.h>\n#include <vtkXMLImageDataWriter.h>\n#include <vtkXMLMultiBlockDataWriter.h>\n\nnamespace AMRCommon {\nvoid WriteUniformGrid(vtkUniformGrid* g, const std::string& prefix);\nvoid WriteAMRData(vtkOverlappingAMR* amrData, const std::string& prefix);\nvoid WriteMultiBlockData(vtkMultiBlockDataSet* mbds, const std::string& prefix);\nvtkSmartPointer<vtkUniformGrid> GetGrid(double* origin, double* h, int* ndim);\nvoid ComputeCellCenter(vtkUniformGrid* grid, const int cellIdx, double c[3]);\n} // namespace AMRCommon\n\nnamespace {\nstruct PulseAttributes\n{\n  double origin[3]; // xyz for the center of the pulse\n  double width[3];  // the width of the pulse\n  double amplitude; // the amplitude of the pulse\n} Pulse;\n//\n// Function prototype declarations\n//\n\n// Description:\n// Sets the pulse attributes\nvoid SetPulse();\n\n// Description:\n// Constructs the vtkOverlappingAMR.\nvtkSmartPointer<vtkOverlappingAMR> GetAMRDataSet();\n\n// Description:\n// Attaches the pulse to the given grid.\nvoid AttachPulseToGrid(vtkUniformGrid* grid);\n} // namespace\n\n//\n// Program main\n//\nint main(int, char*[])\n{\n  // STEP 0: Initialize gaussian pulse parameters\n  SetPulse();\n\n  // STEP 1: Get the AMR dataset\n  auto amrDataSet = GetAMRDataSet();\n  AMRCommon::WriteAMRData(amrDataSet, \"Gaussian2D\");\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n//=============================================================================\n//                    Function Prototype Implementation\n//=============================================================================\n\nvoid SetPulse()\n{\n  Pulse.origin[0] = Pulse.origin[1] = Pulse.origin[2] = -1.0;\n  Pulse.width[0] = Pulse.width[1] = Pulse.width[2] = 6.0;\n  Pulse.amplitude = 0.0001;\n}\n\n//------------------------------------------------------------------------------\nvoid AttachPulseToGrid(vtkUniformGrid* grid)\n{\n  vtkNew<vtkDoubleArray> xyz;\n  xyz->SetName(\"GaussianPulse\");\n  xyz->SetNumberOfComponents(1);\n  xyz->SetNumberOfTuples(grid->GetNumberOfCells());\n\n  for (int cellIdx = 0; cellIdx < grid->GetNumberOfCells(); ++cellIdx)\n  {\n    double center[3];\n    AMRCommon::ComputeCellCenter(grid, cellIdx, center);\n\n    auto r = 0.0;\n    for (auto i = 0; i < 2; ++i)\n    {\n      auto dx = center[i] - Pulse.origin[i];\n      r += (dx * dx) / (Pulse.width[i] * Pulse.width[i]);\n    }\n    auto f = Pulse.amplitude * std::exp(-r);\n\n    xyz->SetTuple1(cellIdx, f);\n  } // END for all cells\n\n  grid->GetCellData()->AddArray(xyz);\n}\n\n//------------------------------------------------------------------------------\nvtkSmartPointer<vtkOverlappingAMR> GetAMRDataSet()\n{\n  int NumLevels = 2;\n  int BlocksPerLevel[2] = {1, 2};\n  double origin[3] = {-2.0, -2.0, 0.0};\n\n  vtkNew<vtkOverlappingAMR> data;\n  data->Initialize(NumLevels, BlocksPerLevel);\n  data->SetOrigin(origin);\n  data->SetGridDescription(VTK_XY_PLANE);\n\n  double h[3] = {1.0, 1.0, 1.0};\n  int ndim[3] = {6, 5, 1};\n\n  // Root Block -- Block 0,0\n  auto blockId = 0;\n  auto level = 0;\n  auto root = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box(origin, ndim, h, data->GetOrigin(), data->GetGridDescription());\n  AttachPulseToGrid(root);\n\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box);\n  data->SetDataSet(level, blockId, root);\n\n  // Block 1,0\n  ndim[0] = ndim[1] = 9;\n  ndim[2] = 1;\n  h[0] = h[1] = h[2] = 0.25;\n  origin[0] = origin[1] = -2.0;\n  origin[2] = 0.0;\n  blockId = 0;\n  level = 1;\n  auto grid1 = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box1(origin, ndim, h, data->GetOrigin(),\n                 data->GetGridDescription());\n  AttachPulseToGrid(grid1);\n\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box1);\n  data->SetDataSet(level, blockId, grid1);\n\n  // Block 1,1\n  ndim[0] = ndim[1] = 9;\n  ndim[2] = 1;\n  h[0] = h[1] = h[2] = 0.25;\n  origin[0] = 1.0;\n  origin[1] = origin[2] = 0.0;\n  blockId = 1;\n  level = 1;\n  auto grid3 = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box3(origin, ndim, h, data->GetOrigin(),\n                 data->GetGridDescription());\n\n  AttachPulseToGrid(grid3);\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box3);\n  data->SetDataSet(level, blockId, grid3);\n\n  vtkAMRUtilities::BlankCells(data);\n  data->Audit();\n  return (data);\n}\n} // namespace\n\nnamespace AMRCommon {\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes a uniform grid as a structure grid\nvoid WriteUniformGrid(vtkUniformGrid* g, const std::string& prefix)\n{\n  vtkNew<vtkXMLImageDataWriter> imgWriter;\n\n  std::ostringstream oss;\n  oss << prefix << \".\" << imgWriter->GetDefaultFileExtension();\n  imgWriter->SetFileName(oss.str().c_str());\n  imgWriter->SetInputData(g);\n  imgWriter->Write();\n}\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes the given AMR dataset to a *.vth file with the given prefix.\nvoid WriteAMRData(vtkOverlappingAMR* amrData, const std::string& prefix)\n{\n  vtkNew<vtkCompositeDataWriter> writer;\n\n  std::ostringstream oss;\n  oss << prefix << \".vthb\";\n  writer->SetFileName(oss.str().c_str());\n  writer->SetInputData(amrData);\n  writer->Write();\n}\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes the given multi-block data to an XML file with the prescribed prefix\nvoid WriteMultiBlockData(vtkMultiBlockDataSet* mbds, const std::string& prefix)\n{\n  // Sanity check\n  vtkNew<vtkXMLMultiBlockDataWriter> writer;\n\n  std::ostringstream oss;\n  oss.str(\"\");\n  oss.clear();\n  oss << prefix << \".\" << writer->GetDefaultFileExtension();\n  writer->SetFileName(oss.str().c_str());\n  writer->SetInputData(mbds);\n  writer->Write();\n}\n\n//------------------------------------------------------------------------------\n// Constructs a uniform grid instance given the prescribed\n// origin, grid spacing and dimensions.\nvtkSmartPointer<vtkUniformGrid> GetGrid(double* origin, double* h, int* ndim)\n{\n  vtkNew<vtkUniformGrid> grd;\n  grd->Initialize();\n  grd->SetOrigin(origin);\n  grd->SetSpacing(h);\n  grd->SetDimensions(ndim);\n  return grd;\n}\n\n//------------------------------------------------------------------------------\n// Computes the cell center for the cell corresponding to cellIdx w.r.t.\n// the given grid. The cell center is stored in the supplied buffer c.\nvoid ComputeCellCenter(vtkUniformGrid* grid, const int cellIdx, double c[3])\n{\n  vtkCell* myCell = grid->GetCell(cellIdx);\n\n  double pCenter[3];\n  double* weights = new double[myCell->GetNumberOfPoints()];\n  int subId = myCell->GetParametricCenter(pCenter);\n  myCell->EvaluateLocation(subId, pCenter, c, weights);\n  delete[] weights;\n}\n\n} // namespace AMRCommon\n
        "},{"location":"Cxx/CompositeData/Generate2DAMRDataSetWithPulse/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Generate2DAMRDataSetWithPulse)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOLegacy\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Generate2DAMRDataSetWithPulse: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Generate2DAMRDataSetWithPulse MACOSX_BUNDLE Generate2DAMRDataSetWithPulse.cxx )\n  target_link_libraries(Generate2DAMRDataSetWithPulse PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Generate2DAMRDataSetWithPulse\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/CompositeData/Generate2DAMRDataSetWithPulse/#download-and-build-generate2damrdatasetwithpulse","title":"Download and Build Generate2DAMRDataSetWithPulse","text":"

        Click here to download Generate2DAMRDataSetWithPulse and its CMakeLists.txt file. Once the tarball Generate2DAMRDataSetWithPulse.tar has been downloaded and extracted,

        cd Generate2DAMRDataSetWithPulse/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Generate2DAMRDataSetWithPulse\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/CompositeData/Generate3DAMRDataSetWithPulse/","title":"Generate3DAMRDataSetWithPulse","text":"

        vtk-examples/Cxx/CompositeData/Generate3DAMRDataSetWithPulse

        "},{"location":"Cxx/CompositeData/Generate3DAMRDataSetWithPulse/#description","title":"Description","text":"

        This utility code generates a simple 3D AMR dataset with a Gaussian pulse at the center. The resulting AMR dataset is written using the vtkXMLHierarchicalBoxDataSetWriter.

        Note

        The original source code for this example is here.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/CompositeData/Generate3DAMRDataSetWithPulse/#code","title":"Code","text":"

        Generate3DAMRDataSetWithPulse.cxx

        // .NAME Generate3DAMRDataSetWithPulse.cxx -- Generated sample 3D AMR dataset\n//\n// .SECTION Description\n//  This utility code generates a simple 3D AMR dataset with a gaussian\n//  pulse at the center. The resulting AMR dataset is written using the\n//  vtkXMLHierarchicalBoxDataSetWriter.\n\n#include <cmath>\n#include <iostream>\n#include <sstream>\n\n#include <vtkAMRBox.h>\n#include <vtkAMRUtilities.h>\n#include <vtkCell.h>\n#include <vtkCellData.h>\n#include <vtkCompositeDataWriter.h>\n#include <vtkDoubleArray.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNew.h>\n#include <vtkOverlappingAMR.h>\n#include <vtkUniformGrid.h>\n#include <vtkXMLImageDataWriter.h>\n#include <vtkXMLMultiBlockDataWriter.h>\n#include <vtkXMLUniformGridAMRReader.h>\n\nnamespace {\nnamespace AMRCommon {\nvoid WriteUniformGrid(vtkUniformGrid* g, const std::string& prefix);\nvoid WriteAMRData(vtkOverlappingAMR* amrData, const std::string& prefix);\nvtkSmartPointer<vtkOverlappingAMR> ReadAMRData(const std::string& file);\nvoid WriteMultiBlockData(vtkMultiBlockDataSet* mbds, const std::string& prefix);\nvtkSmartPointer<vtkUniformGrid> GetGrid(double* origin, double* h, int* ndim);\nvoid ComputeCellCenter(vtkUniformGrid* grid, const int cellIdx, double c[3]);\n} // namespace AMRCommon\n} // namespace\n\nnamespace {\nstatic struct PulseAttributes\n{\n  double origin[3]; // xyz for the center of the pulse\n  double width[3];  // the width of the pulse\n  double amplitude; // the amplitude of the pulse\n} Pulse;\n\n//\n// Function prototype declarations\n//\n\n// Description:\n// Sets the pulse attributes\nvoid SetPulse();\n\n// Description:\n// Constructs the vtkOverlappingAMR.\nvtkSmartPointer<vtkOverlappingAMR> GetAMRDataSet();\n\n// Description:\n// Attaches the pulse to the given grid.\nvoid AttachPulseToGrid(vtkUniformGrid* grid);\n} // namespace\n\n//\n// Program main\n//\nint main(int, char*[])\n{\n  // STEP 0: Initialize gaussian pulse parameters\n  SetPulse();\n\n  // STEP 1: Get the AMR dataset\n  auto amrDataSet = GetAMRDataSet();\n  AMRCommon::WriteAMRData(amrDataSet, \"Gaussian3D\");\n  return EXIT_SUCCESS;\n}\nnamespace {\n//=============================================================================\n//                    Function Prototype Implementation\n//=============================================================================\n\nvoid SetPulse()\n{\n  Pulse.origin[0] = Pulse.origin[1] = Pulse.origin[2] = -1.0;\n  Pulse.width[0] = Pulse.width[1] = Pulse.width[2] = 6.0;\n  Pulse.amplitude = 0.0001;\n}\n\n//------------------------------------------------------------------------------\nvoid AttachPulseToGrid(vtkUniformGrid* grid)\n{\n  vtkNew<vtkDoubleArray> xyz;\n  xyz->SetName(\"GaussianPulse\");\n  xyz->SetNumberOfComponents(1);\n  xyz->SetNumberOfTuples(grid->GetNumberOfCells());\n\n  for (int cellIdx = 0; cellIdx < grid->GetNumberOfCells(); ++cellIdx)\n  {\n    double center[3];\n    AMRCommon::ComputeCellCenter(grid, cellIdx, center);\n\n    auto r = 0.0;\n    for (auto i = 0; i < 3; ++i)\n    {\n      auto dx = center[i] - Pulse.origin[i];\n      r += (dx * dx) / (Pulse.width[i] * Pulse.width[i]);\n    }\n    auto f = Pulse.amplitude * std::exp(-r);\n\n    xyz->SetTuple1(cellIdx, f);\n  } // END for all cells\n\n  grid->GetCellData()->AddArray(xyz);\n}\n//------------------------------------------------------------------------------\nvtkSmartPointer<vtkOverlappingAMR> GetAMRDataSet()\n{\n  vtkNew<vtkOverlappingAMR> data;\n  int blocksPerLevel[2] = {1, 3};\n  double globalOrigin[3] = {-2.0, -2.0, -2.0};\n  data->Initialize(2, blocksPerLevel);\n  data->SetOrigin(globalOrigin);\n  data->SetGridDescription(VTK_XYZ_GRID);\n\n  // Root Block -- Block 0\n  double origin[3] = {-2.0, -2.0, -2.0};\n  double h[3] = {1.0, 1.0, 1.0};\n  int ndim[3] = {6, 5, 5};\n\n  auto blockId{0};\n  auto level{0};\n  auto root = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box(origin, ndim, h, data->GetOrigin(), data->GetGridDescription());\n  AttachPulseToGrid(root);\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box);\n  data->SetDataSet(level, blockId, root);\n\n  // Block 1\n  ndim[0] = 3;\n  ndim[1] = ndim[2] = 5;\n  h[0] = h[1] = h[2] = 0.5;\n  origin[0] = origin[1] = origin[2] = -2.0;\n  blockId = 0;\n  level = 1;\n  auto grid1 = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box1(origin, ndim, h, data->GetOrigin(),\n                 data->GetGridDescription());\n  AttachPulseToGrid(grid1);\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box1);\n  data->SetDataSet(level, blockId, grid1);\n\n  // Block 2\n  ndim[0] = 3;\n  ndim[1] = ndim[2] = 5;\n  h[0] = h[1] = h[2] = 0.5;\n  origin[0] = 0.0;\n  origin[1] = origin[2] = -1.0;\n  blockId = 1;\n  level = 1;\n  auto grid2 = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box2(origin, ndim, h, data->GetOrigin(),\n                 data->GetGridDescription());\n  AttachPulseToGrid(grid2);\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box2);\n  data->SetDataSet(level, blockId, grid2);\n\n  // Block 3\n  ndim[0] = 3;\n  ndim[1] = ndim[2] = 7;\n  h[0] = h[1] = h[2] = 0.5;\n  origin[0] = 2.0;\n  origin[1] = origin[2] = -1.0;\n  blockId = 2;\n  level = 1;\n  auto grid3 = AMRCommon::GetGrid(origin, h, ndim);\n  vtkAMRBox box3(origin, ndim, h, data->GetOrigin(),\n                 data->GetGridDescription());\n  AttachPulseToGrid(grid3);\n  data->SetSpacing(level, h);\n  data->SetAMRBox(level, blockId, box3);\n  data->SetDataSet(level, blockId, grid3);\n\n  vtkAMRUtilities::BlankCells(data);\n  return (data);\n}\n} // namespace\nnamespace {\nnamespace AMRCommon {\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes a uniform grid as a structure grid\nvoid WriteUniformGrid(vtkUniformGrid* g, const std::string& prefix)\n{\n  vtkNew<vtkXMLImageDataWriter> imgWriter;\n  std::ostringstream oss;\n  oss << prefix << \".\" << imgWriter->GetDefaultFileExtension();\n  imgWriter->SetFileName(oss.str().c_str());\n  imgWriter->SetInputData(g);\n  imgWriter->Write();\n}\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes the given AMR dataset to a *.vth file with the given prefix.\nvoid WriteAMRData(vtkOverlappingAMR* amrData, const std::string& prefix)\n{\n  vtkNew<vtkCompositeDataWriter> writer;\n  std::ostringstream oss;\n  oss << prefix << \".vthb\";\n  writer->SetFileName(oss.str().c_str());\n  writer->SetInputData(amrData);\n  writer->Write();\n}\n\n//------------------------------------------------------------------------------\n// Description:\n// Reads AMR data to the given data-structure from the prescribed file.\nvtkSmartPointer<vtkOverlappingAMR> ReadAMRData(const std::string& file)\n{\n  vtkNew<vtkXMLUniformGridAMRReader> myAMRReader;\n\n  std::ostringstream oss;\n  oss << file << \".vthb\";\n\n  std::cout << \"Reading AMR Data from: \" << oss.str() << std::endl;\n\n  myAMRReader->SetFileName(oss.str().c_str());\n  myAMRReader->Update();\n  return vtkOverlappingAMR::SafeDownCast(myAMRReader->GetOutput());\n}\n\n//------------------------------------------------------------------------------\n// Description:\n// Writes the given multi-block data to an XML file with the prescribed prefix\nvoid WriteMultiBlockData(vtkMultiBlockDataSet* mbds, const std::string& prefix)\n{\n  // Sanity check\n  vtkNew<vtkXMLMultiBlockDataWriter> writer;\n  std::ostringstream oss;\n  oss << prefix << \".\" << writer->GetDefaultFileExtension();\n  writer->SetFileName(oss.str().c_str());\n  writer->SetInputData(mbds);\n  writer->Write();\n}\n\n//------------------------------------------------------------------------------\n// Constructs a uniform grid instance given the prescribed\n// origin, grid spacing and dimensions.\nvtkSmartPointer<vtkUniformGrid> GetGrid(double* origin, double* h, int* ndim)\n{\n  vtkNew<vtkUniformGrid> grd;\n  grd->Initialize();\n  grd->SetOrigin(origin);\n  grd->SetSpacing(h);\n  grd->SetDimensions(ndim);\n  return grd;\n}\n\n//------------------------------------------------------------------------------\n// Computes the cell center for the cell corresponding to cellIdx w.r.t.\n// the given grid. The cell center is stored in the supplied buffer c.\nvoid ComputeCellCenter(vtkUniformGrid* grid, const int cellIdx, double c[3])\n{\n  vtkCell* myCell = grid->GetCell(cellIdx);\n\n  double pCenter[3];\n  double* weights = new double[myCell->GetNumberOfPoints()];\n  int subId = myCell->GetParametricCenter(pCenter);\n  myCell->EvaluateLocation(subId, pCenter, c, weights);\n  delete[] weights;\n}\n} // namespace AMRCommon\n} // namespace\n
        "},{"location":"Cxx/CompositeData/Generate3DAMRDataSetWithPulse/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Generate3DAMRDataSetWithPulse)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOLegacy\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Generate3DAMRDataSetWithPulse: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Generate3DAMRDataSetWithPulse MACOSX_BUNDLE Generate3DAMRDataSetWithPulse.cxx )\n  target_link_libraries(Generate3DAMRDataSetWithPulse PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Generate3DAMRDataSetWithPulse\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/CompositeData/Generate3DAMRDataSetWithPulse/#download-and-build-generate3damrdatasetwithpulse","title":"Download and Build Generate3DAMRDataSetWithPulse","text":"

        Click here to download Generate3DAMRDataSetWithPulse and its CMakeLists.txt file. Once the tarball Generate3DAMRDataSetWithPulse.tar has been downloaded and extracted,

        cd Generate3DAMRDataSetWithPulse/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Generate3DAMRDataSetWithPulse\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/CompositeData/MultiBlockDataSet/","title":"MultiBlockDataSet","text":"

        vtk-examples/Cxx/CompositeData/MultiBlockDataSet

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/CompositeData/MultiBlockDataSet/#code","title":"Code","text":"

        MultiBlockDataSet.cxx

        // Demonstrates how to make and use VTK's MultiBlock type data\n\n#include <vtkActor.h>\n#include <vtkCompositeDataGeometryFilter.h>\n#include <vtkExtractEdges.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkVector.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nnamespace {\nvtkSmartPointer<vtkDataSet> CreateSphereDataSet(const vtkVector3d& center,\n                                                double radius = 0.5);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // PART 1 Make some Data.\n  // Make a tree.\n  vtkNew<vtkMultiBlockDataSet> root;\n\n  vtkNew<vtkMultiBlockDataSet> branch;\n  root->SetBlock(0, branch);\n\n  // Make some leaves.\n  branch->SetBlock(0, CreateSphereDataSet({0, 0, 0}));\n  branch->SetBlock(1, CreateSphereDataSet({1.75, 2.5, 0.0}, 1.5));\n  root->SetBlock(1, CreateSphereDataSet({4, 0, 0}, 2.0));\n\n  // Uncomment to inspect.\n  // std::cerr << root->GetClassName() << std::endl;\n  // root->PrintSelf(std::cerr, vtkIndent(0));\n\n  // PART 2 Do something with the data\n  // a non composite aware filter, the pipeline will iterate\n  vtkNew<vtkExtractEdges> edges;\n  edges->SetInputData(root);\n\n  // Uncomment to inspect.\n  // edges->Update();\n  // cerr << edges->GetOutputDataObject(0)->GetClassName() << endl;\n  // edges->GetOutputDataObject(0)->PrintSelf(std::cerr, vtkIndent(0));\n\n  // PART 3 Show the data.\n  // also demonstrate a composite aware filter\n  // this filter aggregates all blocks into one polydata\n  // this is handy for display, although fairly limited.\n  vtkNew<vtkCompositeDataGeometryFilter> polydata;\n  polydata->SetInputConnection(edges->GetOutputPort());\n\n  // Uncomment to inspect.\n  // polydata->Update();\n  // std::cerr << polydata->GetOutput()->GetClassName() << std::endl;\n  // polydata->GetOutput()->PrintSelf(std::cerr, vtkIndent(0));\n\n  // Display the data.\n  vtkNew<vtkRenderer> aren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(0, polydata->GetOutputPort(0));\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  actor->GetProperty()->SetLineWidth(2);\n\n  aren->AddActor(actor);\n  aren->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  renWin->SetWindowName(\"MultiBLockDataSet\");\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkDataSet> CreateSphereDataSet(const vtkVector3d& center,\n                                                double radius)\n{\n  vtkNew<vtkSphereSource> leaf;\n  leaf->SetCenter(center.GetData());\n  leaf->SetRadius(radius);\n  leaf->Update();\n  return leaf->GetOutput();\n}\n\n} // namespace\n
        "},{"location":"Cxx/CompositeData/MultiBlockDataSet/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultiBlockDataSet)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultiBlockDataSet: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultiBlockDataSet MACOSX_BUNDLE MultiBlockDataSet.cxx )\n  target_link_libraries(MultiBlockDataSet PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultiBlockDataSet\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/CompositeData/MultiBlockDataSet/#download-and-build-multiblockdataset","title":"Download and Build MultiBlockDataSet","text":"

        Click here to download MultiBlockDataSet and its CMakeLists.txt file. Once the tarball MultiBlockDataSet.tar has been downloaded and extracted,

        cd MultiBlockDataSet/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MultiBlockDataSet\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/CompositeData/OverlappingAMR/","title":"OverlappingAMR","text":"

        vtk-examples/Cxx/CompositeData/OverlappingAMR

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/CompositeData/OverlappingAMR/#code","title":"Code","text":"

        OverlappingAMR.cxx

        // Demonstrates how to create and populate a VTK's Overlapping AMR Grid\n// type Data\n\n#include <vtkAMRBox.h>\n#include <vtkAMRUtilities.h>\n#include <vtkCompositeDataGeometryFilter.h>\n#include <vtkContourFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkOverlappingAMR.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphere.h>\n#include <vtkUniformGrid.h>\n\nnamespace {\nvoid MakeScalars(int dims[3], double origin[3], double spacing[3],\n                 vtkFloatArray* scalars);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create and populate the AMR dataset.\n  // The dataset should look like\n  // Level 0\n  //   uniform grid, dimensions 11, 11, 11, AMR box (0, 0, 0) - (9, 9, 9)\n  // Level 1 - refinement ratio : 2\n  //   uniform grid, dimensions 11, 11, 11, AMR box (0, 0, 0) - (9, 9, 9)\n  //   uniform grid, dimensions 11, 11, 11, AMR box (10, 10, 10) - (19, 19, 19)\n  // Use MakeScalars() above to fill the scalar arrays.\n\n  vtkNew<vtkOverlappingAMR> amr;\n  int blocksPerLevel[] = {1, 2};\n  amr->Initialize(2, blocksPerLevel);\n\n  double origin[3] = {0.0, 0.0, 0.0};\n  double spacing[3] = {1.0, 1.0, 1.0};\n  int dims[3] = {11, 11, 11};\n\n  vtkNew<vtkUniformGrid> ug1;\n  // Geometry\n  ug1->SetOrigin(origin);\n  ug1->SetSpacing(spacing);\n  ug1->SetDimensions(dims);\n\n  // Data\n  vtkNew<vtkFloatArray> scalars;\n  ug1->GetPointData()->SetScalars(scalars);\n  MakeScalars(dims, origin, spacing, scalars);\n\n  int lo[3] = {0, 0, 0};\n  int hi[3] = {9, 9, 9};\n  vtkAMRBox box1(lo, hi);\n  amr->SetAMRBox(0, 0, box1);\n  amr->SetDataSet(0, 0, ug1);\n\n  double spacing2[3] = {0.5, 0.5, 0.5};\n\n  vtkNew<vtkUniformGrid> ug2;\n  // Geometry\n  ug2->SetOrigin(origin);\n  ug2->SetSpacing(spacing2);\n  ug2->SetDimensions(dims);\n\n  // Data\n  vtkNew<vtkFloatArray> scalars2;\n  ug2->GetPointData()->SetScalars(scalars2);\n  MakeScalars(dims, origin, spacing2, scalars2);\n\n  int lo2[3] = {0, 0, 0};\n  int hi2[3] = {9, 9, 9};\n  vtkAMRBox box2(lo2, hi2);\n  amr->SetAMRBox(1, 0, box2);\n  amr->SetDataSet(1, 0, ug2);\n\n  double origin3[3] = {5, 5, 5};\n\n  vtkNew<vtkUniformGrid> ug3;\n  // Geometry\n  ug3->SetOrigin(origin3);\n  ug3->SetSpacing(spacing2);\n  ug3->SetDimensions(dims);\n\n  // Data\n  vtkNew<vtkFloatArray> scalars3;\n  ug3->GetPointData()->SetScalars(scalars3);\n  MakeScalars(dims, origin3, spacing2, scalars3);\n\n  int lo3[3] = {10, 10, 10};\n  int hi3[3] = {19, 19, 19};\n  vtkAMRBox box3(lo3, hi3);\n  amr->SetAMRBox(1, 1, box3);\n  amr->SetDataSet(1, 1, ug3);\n\n  amr->SetRefinementRatio(0, 2);\n\n  vtkAMRUtilities::BlankCells(amr);\n\n  vtkNew<vtkOutlineFilter> of;\n  of->SetInputData(amr);\n\n  vtkNew<vtkCompositeDataGeometryFilter> geomFilter;\n  geomFilter->SetInputConnection(of->GetOutputPort());\n\n  // Create an iso-surface - at 10.\n  vtkNew<vtkContourFilter> cf;\n  cf->SetInputData(amr);\n  cf->SetNumberOfContours(1);\n  cf->SetValue(0, 10.0);\n\n  vtkNew<vtkCompositeDataGeometryFilter> geomFilter2;\n  geomFilter2->SetInputConnection(cf->GetOutputPort());\n\n  // Create the render window, renderer, and interactor.\n  vtkNew<vtkRenderer> aren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Associate the geometry with a mapper and the mapper to an actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(of->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  actor1->SetMapper(mapper);\n\n  // Vssociate the geometry with a mapper and the mapper to an actor.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(geomFilter2->GetOutputPort());\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n\n  // Add the actor to the renderer and start handling events.\n  aren->AddActor(actor1);\n  aren->AddActor(actor2);\n\n  aren->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  renWin->SetWindowName(\"OverlappingAMR\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeScalars(int dims[3], double origin[3], double spacing[3],\n                 vtkFloatArray* scalars)\n{\n  // Implicit function used to compute scalars.\n  vtkNew<vtkSphere> sphere;\n  sphere->SetRadius(3);\n  sphere->SetCenter(5, 5, 5);\n\n  scalars->SetNumberOfTuples(dims[0] * dims[1] * dims[2]);\n  for (int k = 0; k < dims[2]; k++)\n  {\n    auto z = origin[2] + spacing[2] * k;\n    for (int j = 0; j < dims[1]; j++)\n    {\n      auto y = origin[1] + spacing[1] * j;\n      for (int i = 0; i < dims[0]; i++)\n      {\n        auto x = origin[0] + spacing[0] * i;\n        scalars->SetValue(k * dims[0] * dims[1] + j * dims[0] + i,\n                          sphere->EvaluateFunction(x, y, z));\n      }\n    }\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/CompositeData/OverlappingAMR/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OverlappingAMR)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OverlappingAMR: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OverlappingAMR MACOSX_BUNDLE OverlappingAMR.cxx )\n  target_link_libraries(OverlappingAMR PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OverlappingAMR\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/CompositeData/OverlappingAMR/#download-and-build-overlappingamr","title":"Download and Build OverlappingAMR","text":"

        Click here to download OverlappingAMR and its CMakeLists.txt file. Once the tarball OverlappingAMR.tar has been downloaded and extracted,

        cd OverlappingAMR/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OverlappingAMR\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Coverage/CxxVTKClassesNotUsed/","title":"VTK Classes not used in the Examples","text":""},{"location":"Cxx/Coverage/CxxVTKClassesNotUsed/#cxx","title":"Cxx","text":"

        Out of 3113 available VTK classes, 2260 have not been used.

        VTK Class VTK Class VTK Class VTK Class VTK Class vtk2DHistogramItem vtk3DCursorRepresentation vtk3DCursorWidget vtk3DLinearGridCrinkleExtractor vtk3DLinearGridInternal vtk3DLinearGridPlaneCutter vtk3DWidget vtkABI vtkADIOS2CoreImageReader vtkADIOS2VTXReader vtkAMRBaseParticlesReader vtkAMRBaseReader vtkAMRCutPlane vtkAMRDataInternals vtkAMRDataSetCache vtkAMREnzoParticlesReader vtkAMREnzoReader vtkAMREnzoReaderInternal vtkAMRFlashParticlesReader vtkAMRFlashReader vtkAMRFlashReaderInternal vtkAMRGaussianPulseSource vtkAMRInformation vtkAMRInterpolatedVelocityField vtkAMRResampleFilter vtkAMRSliceFilter vtkAMRToMultiBlockFilter vtkAMRVelodyneReader vtkAMRVelodyneReaderInternal vtkAMRVolumeMapper vtkAMReXGridHeader vtkAMReXGridLevelHeader vtkAMReXGridReader vtkAMReXGridReaderInternal vtkAMReXParticlesReader vtkAOSDataArrayTemplate vtkASCIITextCodec vtkAVIWriter vtkAVSucdReader vtkAbstractArray vtkAbstractCellArray vtkAbstractCellLinks vtkAbstractCellLocator vtkAbstractContextBufferId vtkAbstractContextItem vtkAbstractElectronicData vtkAbstractGridConnectivity vtkAbstractHyperTreeGridMapper vtkAbstractImageInterpolator vtkAbstractInteractionDevice vtkAbstractInterpolatedVelocityField vtkAbstractMapper vtkAbstractMapper3D vtkAbstractParticleWriter vtkAbstractPointLocator vtkAbstractPolyDataReader vtkAbstractPolygonalHandleRepresentation3D vtkAbstractPropPicker vtkAbstractRenderDevice vtkAbstractSplineRepresentation vtkAbstractTransform vtkAbstractVolumeMapper vtkActor2DCollection vtkActorNode vtkAdaptiveDataSetSurfaceFilter vtkAdaptiveResampleToImage vtkAdaptiveSubdivisionFilter vtkAdaptiveTemporalInterpolator vtkAddMembershipArray vtkAffineRepresentation vtkAggregateDataSetFilter vtkAggregateToPartitionedDataSetCollection vtkAlembicExporter vtkAlignImageDataSetFilter vtkAmoebaMinimizer vtkAnariActorNode vtkAnariCameraNode vtkAnariCompositePolyDataMapperNode vtkAnariFollowerNode vtkAnariLightNode vtkAnariPass vtkAnariPolyDataMapperNode vtkAnariProfiling vtkAnariRendererNode vtkAnariTestInteractor vtkAnariViewNodeFactory vtkAnariVolumeInterface vtkAnariVolumeMapper vtkAnariVolumeMapperNode vtkAnariVolumeNode vtkAnariWindowNode vtkAndroidOutputWindow vtkAndroidRenderWindowInteractor vtkAngleRepresentation vtkAngleRepresentation3D vtkAngularPeriodicDataArray vtkAngularPeriodicFilter vtkAnimateModes vtkAnnotation vtkAnnotationLayers vtkAnnotationLayersAlgorithm vtkAppendArcLength vtkAppendCompositeDataLeaves vtkAppendDataSets vtkAppendLocationAttributes vtkAppendPartitionedDataSetCollection vtkAppendPoints vtkAppendSelection vtkApplyColors vtkApplyIcons vtkApproximatingSubdivisionFilter vtkArcGridActorPrivate vtkArcParallelEdgeStrategy vtkArcPlotter vtkArcSource vtkArchiver vtkAreaContourSpectrumFilter vtkAreaLayout vtkAreaLayoutStrategy vtkArray vtkArrayCoordinates vtkArrayDataAlgorithm vtkArrayDataReader vtkArrayDataWriter vtkArrayExtents vtkArrayExtentsList vtkArrayInterpolate vtkArrayIterator vtkArrayIteratorIncludes vtkArrayIteratorTemplate vtkArrayListTemplate vtkArrayNorm vtkArrayRange vtkArrayReader vtkArrayRename vtkArrayRenderer vtkArraySort vtkArrayWeights vtkAssemblyPaths vtkAssignCoordinates vtkAssignCoordinatesLayoutStrategy vtkAtom vtkAtomicMutex vtkAttributeClustering2DLayoutStrategy vtkAttributeDataToFieldDataFilter vtkAttributeDataToTableFilter vtkAttributeSmoothingFilter vtkAttributesErrorMetric vtkAutoCorrelativeStatistics vtkAvatar vtkAxesTransformRepresentation vtkAxesTransformWidget vtkAxisActor2D vtkAxisActor2DMock vtkAxisExtended vtkAxisFollower vtkAxisGridActorPrivate vtkBSPCuts vtkBSPIntersections vtkBSplineTransform vtkBTSReader vtkBYUWriter vtkBackgroundColorMonitor vtkBase64InputStream vtkBase64OutputStream vtkBase64Utilities vtkBatchedSurfaceLICMapper vtkBatches vtkBezierContourLineInterpolator vtkBezierCurve vtkBezierHexahedron vtkBezierInterpolation vtkBezierQuadrilateral vtkBezierTetra vtkBezierTriangle vtkBezierWedge vtkBiDimensionalRepresentation vtkBilinearQuadIntersection vtkBinCellDataFilter vtkBinnedDecimation vtkBiomTableReader vtkBitArray vtkBitArrayIterator vtkBivariateLinearTableThreshold vtkBlankStructuredGrid vtkBlankStructuredGridWithImage vtkBlockDistribution vtkBlockIdScalars vtkBlockItem vtkBlockSelector vtkBlueObeliskData vtkBlueObeliskDataParser vtkBond vtkBoostBetweennessClustering vtkBoostBiconnectedComponents vtkBoostBrandesCentrality vtkBoostDividedEdgeBundling vtkBoostExtractLargestComponent vtkBoostKruskalMinimumSpanningTree vtkBoostLogWeighting vtkBoostRandomSparseArraySource vtkBoostSplitTableField vtkBoundaryMeshQuality vtkBoundedPlanePointPlacer vtkBoxLayoutStrategy vtkBreakPoint vtkBrokenLineWidget vtkBuffer vtkBufferedArchiver vtkButtonRepresentation vtkButtonSource vtkByteSwap vtkCGMWriter vtkCGNSCache vtkCGNSFileSeriesReader vtkCGNSReader vtkCGNSReaderInternal vtkCONVERGECFDCGNSReader vtkCONVERGECFDReader vtkCPExodusIIElementBlock vtkCPExodusIIElementBlockCellIterator vtkCPExodusIIElementBlockImpl vtkCPExodusIIInSituReader vtkCPExodusIINodalCoordinatesTemplate vtkCPExodusIIResultsArrayTemplate vtkCachedStreamingDemandDrivenPipeline vtkCamera3DRepresentation vtkCamera3DWidget vtkCameraHandleSource vtkCameraNode vtkCameraOrientationRepresentation vtkCameraPathRepresentation vtkCameraPathWidget vtkCameraRepresentation vtkCameraWidget vtkCapsuleSource vtkCastToConcrete vtkCell3D vtkCellAttribute vtkCellAttributeCalculator vtkCellAttributeInformation vtkCellCenterDepthSort vtkCellCentersPointPlacer vtkCellDataToPointData vtkCellDerivatives vtkCellDistanceSelector vtkCellGraphicsPrimitiveMap vtkCellGrid vtkCellGridAlgorithm vtkCellGridBoundsQuery vtkCellGridComputeSurface vtkCellGridElevation vtkCellGridElevationQuery vtkCellGridEvaluator vtkCellGridIOQuery vtkCellGridMapper vtkCellGridPointProbe vtkCellGridQuery vtkCellGridRangeQuery vtkCellGridReader vtkCellGridRenderRequest vtkCellGridResponder vtkCellGridResponderBase vtkCellGridResponders vtkCellGridSidesQuery vtkCellGridWriter vtkCellLinks vtkCellLocatorStrategy vtkCellMetadata vtkCellQuality vtkCellSizeFilter vtkCellValidator vtkCenteredSliderRepresentation vtkCenteredSliderWidget vtkCesium3DTilesReader vtkCesium3DTilesWriter vtkCesiumB3DMReader vtkCesiumPointCloudWriter vtkChacoGraphReader vtkChacoReader vtkChart2DHistogram vtkCheckerboardSplatter vtkCirclePackFrontChainLayoutStrategy vtkCirclePackLayout vtkCirclePackLayoutStrategy vtkCirclePackToPolyData vtkCityGMLReader vtkCleanUnstructuredGrid vtkCleanUnstructuredGridCells vtkClearRGBPass vtkClearZPass vtkClientServerCompositePass vtkClientServerSynchronizedRenderers vtkClientSocket vtkClipConvexPolyData vtkClosedSurfacePointPlacer vtkClosestNPointsStrategy vtkClosestPointStrategy vtkClustering2DLayoutStrategy vtkCocoaMacOSXSDKCompatibility vtkCocoaRenderWindow vtkCocoaRenderWindowInteractor vtkCocoaTkUtilities vtkCoincidentPoints vtkCollapseGraph vtkCollapseVerticesByArray vtkCollectGraph vtkCollectPolyData vtkCollectTable vtkCollection vtkCollectionElement vtkCollectionIterator vtkColor3 vtkColor3f vtkColor4 vtkColor4d vtkColor4f vtkColorTransferControlPointsItem vtkColorTransferFunctionItem vtkCommonInformationKeyManager vtkCommunicator vtkCommunity2DLayoutStrategy vtkCompositeCellGridMapper vtkCompositeCellGridReader vtkCompositeControlPointsItem vtkCompositeCutter vtkCompositeDataDisplayAttributesLegacy vtkCompositeDataIterator vtkCompositeDataPipeline vtkCompositeDataProbeFilter vtkCompositeDataReader vtkCompositeDataSetAlgorithm vtkCompositeImplicitBackend vtkCompositeInterpolatedVelocityField vtkCompositeMapperHelper2 vtkCompositeMapperHelperData vtkCompositePolyDataMapperDelegator vtkCompositeRGBAPass vtkCompositeRenderManager vtkCompositeSurfaceLICMapper vtkCompositeSurfaceLICMapperDelegator vtkCompositeTransferFunctionItem vtkCompositeZPass vtkCompositedSynchronizedRenderers vtkCompositer vtkCompressCompositer vtkComputeHistogram2DOutliers vtkComputeQuantiles vtkConduitArrayUtilities vtkConduitSource vtkConduitToDataObject vtkConeLayoutStrategy vtkConnectedPointsFilter vtkConstrained2DLayoutStrategy vtkConstrainedPointHandleRepresentation vtkConstrainedSmoothingFilter vtkConsumerDataFilter vtkContextArea vtkContextClip vtkContextDevice2D vtkContextDevice3D vtkContextInteractorStyle vtkContextKeyEvent vtkContextMapper2D vtkContextPolygon vtkContextScenePrivate vtkContingencyStatistics vtkContinuousScatterplot vtkContinuousValueWidget vtkContinuousValueWidgetRepresentation vtkContour3DLinearGrid vtkContourGrid vtkContourHelper vtkContourLineInterpolator vtkContourLoopExtraction vtkContourRepresentationInternals vtkContourRepresentationNode vtkContourRepresentationPoint vtkControlPointsItem vtkConvertSelection vtkConvertSelectionDomain vtkConvertToMultiBlockDataSet vtkConvertToPartitionedDataSetCollection vtkConvertToPointCloud vtkConvertToPolyhedra vtkConvexHull2D vtkCookieCutter vtkCoordinateFrame vtkCoordinateFrameRepresentation vtkCoordinateFrameWidget vtkCorrelativeStatistics vtkCosmicTreeLayoutStrategy vtkCountFaces vtkCountVertices vtkCuller vtkCurveRepresentation vtkCutMaterial vtkCylindricalTransform vtkDGAttributeInformation vtkDGBoundsResponder vtkDGCell vtkDGEdge vtkDGElevationResponder vtkDGEvaluator vtkDGHex vtkDGIOResponder vtkDGInterpolateCalculator vtkDGPyr vtkDGQuad vtkDGRangeResponder vtkDGRenderResponder vtkDGSidesResponder vtkDGTet vtkDGTranscribeUnstructuredCells vtkDGTri vtkDGVert vtkDGWdg vtkDIMACSGraphReader vtkDIMACSGraphWriter vtkDIYAggregateDataSetFilter vtkDIYDataExchanger vtkDIYExplicitAssigner vtkDIYGhostUtilities vtkDIYKdTreeUtilities vtkDIYUtilities vtkDIYUtilitiesCleanup vtkDSPFilterDefinition vtkDSPFilterGroup vtkDataArrayCollection vtkDataArrayCollectionIterator vtkDataArraySelection vtkDataAssembly vtkDataAssemblyUtilities vtkDataAssemblyVisitor vtkDataCompressor vtkDataEncoder vtkDataObjectAlgorithm vtkDataObjectCollection vtkDataObjectGenerator vtkDataObjectMeshCache vtkDataObjectToConduit vtkDataObjectToTable vtkDataObjectTreeIndex vtkDataObjectTreeInternals vtkDataObjectTypes vtkDataObjectWriter vtkDataReader vtkDataRepresentation vtkDataSetAlgorithm vtkDataSetAttributesFieldList vtkDataSetCellIterator vtkDataSetEdgeSubdivisionCriterion vtkDataSetGradient vtkDataSetGradientPrecompute vtkDataSetRegionSurfaceFilter vtkDataSetToDataObjectFilter vtkDataTransferHelper vtkDataWriter vtkDatabaseToTableReader vtkDateToNumeric vtkDeRhamCell vtkDebugLeaks vtkDebugLeaksManager vtkDebugLeaksObserver vtkDefaultPass vtkDeflectNormals vtkDendrogramItem vtkDensifyPolyData vtkDependentDimensionInfo vtkDepthImageProcessingPass vtkDepthImageToPointCloud vtkDepthOfFieldPass vtkDepthPeelingPass vtkDescriptiveStatistics vtkDeserializer vtkDiagonalMatrixSource vtkDicer vtkDijkstraGraphInternals vtkDijkstraImageContourLineInterpolator vtkDijkstraImageGeodesicPath vtkDimensionInfo vtkDirectedAcyclicGraph vtkDirectedGraphAlgorithm vtkDirectionEncoder vtkDiscreteFlyingEdges2D vtkDiscreteFlyingEdgesClipper2D vtkDisplaySizedImplicitPlaneRepresentation vtkDisplaySizedImplicitPlaneWidget vtkDistanceRepresentation2D vtkDistanceRepresentation3D vtkDistributedDataFilter vtkDistributedGraphHelper vtkDistributedPointCloudFilter vtkDotProductSimilarity vtkDrawTexturedElements vtkDualDepthPeelingPass vtkDummyCommunicator vtkDummyController vtkDummyGPUInfoList vtkDuplicatePolyData vtkDynamic2DLabelMapper vtkDynamicLoader vtkEDLShading vtkEGLRenderWindow vtkERFReader vtkEdgeCenters vtkEdgeLayout vtkEdgeLayoutStrategy vtkEdgeSubdivisionCriterion vtkEdgeTable vtkEllipseArcSource vtkEllipsoidTensorProbeRepresentation vtkEllipsoidalGaussianKernel vtkEmptyCell vtkEmptyRepresentation vtkEnSight6BinaryReader vtkEnSight6Reader vtkEnSightGoldBinaryReader vtkEnSightGoldReader vtkEnSightMasterServerReader vtkEnSightReader vtkEnSightWriter vtkEncodedGradientEstimator vtkEncodedGradientShader vtkEndFor vtkEnsembleSource vtkEnzoReaderBlock vtkEnzoReaderInternal vtkEqualizerContextItem vtkEqualizerFilter vtkEquirectangularToCubeMapTexture vtkErrorCode vtkEvenlySpacedStreamlines2D vtkEvent vtkEventData vtkEventDataDevice3D vtkEventDataForDevice vtkEventForwarderCommand vtkExecutableRunner vtkExecutionAggregator vtkExecutionRange vtkExecutionTimer vtkExodusIICache vtkExodusIICacheEntry vtkExodusIICacheKey vtkExodusIIReaderIntPointCheck vtkExodusIIReaderParser vtkExodusIIReaderPrivate vtkExodusIIReaderScalarCheck vtkExodusIIReaderTensorCheck vtkExodusIIReaderVariableCheck vtkExodusIIReaderVectorCheck vtkExpandMarkedElements vtkExpandSelectedGraph vtkExplicitStructuredGridAlgorithm vtkExplicitStructuredGridCrop vtkExplicitStructuredGridSurfaceFilter vtkExporter vtkExprTkFunctionParser vtkExtentRCBPartitioner vtkExtentSplitter vtkExtentTranslator vtkExternalLight vtkExternalOpenGLCamera vtkExternalOpenGLRenderWindow vtkExternalOpenGLRenderer vtkExtractArray vtkExtractBlock vtkExtractBlockUsingDataAssembly vtkExtractCTHPart vtkExtractCellsAlongPolyLine vtkExtractCellsByType vtkExtractDataArraysOverTime vtkExtractDataOverTime vtkExtractDataSets vtkExtractExodusGlobalTemporalVariables vtkExtractFunctionalBagPlot vtkExtractGhostCells vtkExtractHierarchicalBins vtkExtractHistogram vtkExtractHistogram2D vtkExtractLevel vtkExtractParticlesOverTime vtkExtractPiece vtkExtractPointCloudPiece vtkExtractPolyDataPiece vtkExtractRectilinearGrid vtkExtractSelectedArraysOverTime vtkExtractSelectedFrustum vtkExtractSelectedGraph vtkExtractSelectedRows vtkExtractSelectedTree vtkExtractSelectionBase vtkExtractStructuredGridHelper vtkExtractSubsetWithSeed vtkExtractTensorComponents vtkExtractTimeSteps vtkExtractUnstructuredGrid vtkExtractUnstructuredGridPiece vtkExtractUserDefinedPiece vtkExtractVectorComponents vtkFDSReader vtkFFMPEGVideoSource vtkFFT vtkFLUENTCFFReader vtkFLUENTReader vtkFXAAOptions vtkFacetReader vtkFacetWriter vtkFast2DLayoutStrategy vtkFiberSurface vtkFidesReader vtkFieldDataSerializer vtkFieldDataToDataSetAttribute vtkFileResourceStream vtkFileSeriesHelper vtkFilteringInformationKeyManager vtkFiltersCellGrid vtkFindCellStrategy vtkFiniteDifferenceGradientEstimator vtkFiniteElementFieldDistributor vtkFinitePlaneRepresentation vtkFinitePlaneWidget vtkFixedPointRayCastImage vtkFixedPointVolumeRayCastCompositeGOHelper vtkFixedPointVolumeRayCastCompositeGOShadeHelper vtkFixedPointVolumeRayCastCompositeHelper vtkFixedPointVolumeRayCastCompositeShadeHelper vtkFixedPointVolumeRayCastHelper vtkFixedPointVolumeRayCastMIPHelper vtkFixedSizeHandleRepresentation vtkFixedSizeHandleRepresentation3D vtkFixedWidthTextReader vtkFlagpoleLabel vtkFlashReaderInternal vtkFlyingEdgesPlaneCutter vtkFocalPlaneContourRepresentation vtkFocalPlanePointPlacer vtkFontConfigFreeTypeTools vtkForEach vtkForceStaticMesh vtkForceTime vtkFrameBufferObjectBase vtkFramebufferPass vtkFreeTypeLabelRenderStrategy vtkFreeTypeStringToImage vtkFreeTypeToolsCleanup vtkFrustumCoverageCuller vtkFrustumSelector vtkFunctionSet vtkGAMBITReader vtkGDAL vtkGDALRasterConverter vtkGDALRasterReader vtkGDALRasterReprojection vtkGDALVectorReader vtkGESignaReader vtkGL2PSExporter vtkGLSLModCamera vtkGLSLModCoincidentTopology vtkGLSLModLight vtkGLSLModPixelDebugger vtkGLSLModifierBase vtkGLSLModifierFactory vtkGLTFDocumentLoader vtkGLTFDocumentLoaderInternals vtkGLTFReader vtkGLTFTexture vtkGLTFWriter vtkGLTFWriterUtils vtkGPUInfo vtkGPUInfoList vtkGPUInfoListArray vtkGPUVolumeRayCastMapper vtkGarbageCollector vtkGarbageCollectorManager vtkGaussianBlurPass vtkGaussianCubeReader vtkGaussianCubeReader2 vtkGaussianRandomSequence vtkGeneralTransform vtkGeneralizedKernel vtkGenerateGlobalIds vtkGenerateIndexArray vtkGenerateProcessIds vtkGenerateTimeSteps vtkGenericAdaptorCell vtkGenericAttribute vtkGenericAttributeCollection vtkGenericCellIterator vtkGenericCellTessellator vtkGenericContourFilter vtkGenericCutter vtkGenericDataArrayLookupHelper vtkGenericDataObjectWriter vtkGenericDataSet vtkGenericDataSetTessellator vtkGenericEdgeTable vtkGenericEnSightReader vtkGenericGeometryFilter vtkGenericGlyph3DFilter vtkGenericImageInterpolator vtkGenericInterpolatedVelocityField vtkGenericMovieWriter vtkGenericOpenGLResourceFreeCallback vtkGenericPointIterator vtkGenericProbeFilter vtkGenericRenderWindowInteractor vtkGenericStreamTracer vtkGenericSubdivisionErrorMetric vtkGenericVertexAttributeMapping vtkGeoEdgeStrategy vtkGeoJSONFeature vtkGeoJSONReader vtkGeoJSONWriter vtkGeoMath vtkGeoProjection vtkGeoTransform vtkGeodesicPath vtkGeometricErrorMetric vtkGhostCellsGenerator vtkGlobFileNames vtkGraphAnnotationLayersFilter vtkGraphEdge vtkGraphGeodesicPath vtkGraphHierarchicalBundleEdges vtkGraphInternals vtkGraphItem vtkGraphLayoutFilter vtkGraphMapper vtkGraphReader vtkGraphToPoints vtkGraphWeightEuclideanDistanceFilter vtkGraphWeightFilter vtkGraphWriter vtkGridSynchronizedTemplates3D vtkGridTransform vtkGroupDataSetsFilter vtkGroupLeafVertices vtkGroupTimeStepsFilter vtkH5PartReader vtkH5RageReader vtkHDF5Helper vtkHDFReaderImplementation vtkHDFVersion vtkHDFWriter vtkHDFWriterImplementation vtkHandleRepresentation vtkHandleSource vtkHandleWidget vtkHardwarePicker vtkHardwareWindow vtkHeap vtkHeatmapItem vtkHiddenLineRemovalPass vtkHierarchicalBinningFilter vtkHierarchicalBoxDataSet vtkHierarchicalBoxDataSetAlgorithm vtkHierarchicalDataExtractDataSets vtkHierarchicalDataExtractLevel vtkHierarchicalDataLevelFilter vtkHierarchicalDataSetGeometryFilter vtkHierarchicalGraphPipeline vtkHierarchicalGraphView vtkHierarchicalPolyDataMapper vtkHigherOrderCurve vtkHigherOrderHexahedron vtkHigherOrderInterpolation vtkHigherOrderQuadrilateral vtkHigherOrderTetra vtkHigherOrderTriangle vtkHigherOrderWedge vtkHighestDensityRegionsStatistics vtkHomogeneousTransform vtkHoudiniPolyDataWriter vtkHyperTree vtkHyperTreeGrid vtkHyperTreeGridAlgorithm vtkHyperTreeGridAxisClip vtkHyperTreeGridAxisCut vtkHyperTreeGridAxisReflection vtkHyperTreeGridCellCenters vtkHyperTreeGridContour vtkHyperTreeGridDepthLimiter vtkHyperTreeGridEntry vtkHyperTreeGridEvaluateCoarse vtkHyperTreeGridExtractGhostCells vtkHyperTreeGridFeatureEdges vtkHyperTreeGridGeometricLocator vtkHyperTreeGridGeometry vtkHyperTreeGridGeometry1DImpl vtkHyperTreeGridGeometry2DImpl vtkHyperTreeGridGeometry3DImpl vtkHyperTreeGridGeometryEntry vtkHyperTreeGridGeometryImpl vtkHyperTreeGridGeometryLevelEntry vtkHyperTreeGridGeometrySmallDimensionsImpl vtkHyperTreeGridGeometryUnlimitedEntry vtkHyperTreeGridGeometryUnlimitedLevelEntry vtkHyperTreeGridGhostCellsGenerator vtkHyperTreeGridGhostCellsGeneratorInternals vtkHyperTreeGridGradient vtkHyperTreeGridIterator vtkHyperTreeGridLevelEntry vtkHyperTreeGridLocator vtkHyperTreeGridMapper vtkHyperTreeGridNonOrientedCursor vtkHyperTreeGridNonOrientedGeometryCursor vtkHyperTreeGridNonOrientedMooreSuperCursor vtkHyperTreeGridNonOrientedMooreSuperCursorLight vtkHyperTreeGridNonOrientedSuperCursor vtkHyperTreeGridNonOrientedSuperCursorLight vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor vtkHyperTreeGridNonOrientedUnlimitedSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight vtkHyperTreeGridOrientedCursor vtkHyperTreeGridOrientedGeometryCursor vtkHyperTreeGridOutlineFilter vtkHyperTreeGridPlaneCutter vtkHyperTreeGridPreConfiguredSource vtkHyperTreeGridProbeFilter vtkHyperTreeGridScales vtkHyperTreeGridThreshold vtkHyperTreeGridToDualGrid vtkHyperTreeGridVisibleLeavesSize vtkIOCellGrid vtkIOSRenderWindow vtkIOSRenderWindowInteractor vtkIOSSFilesScanner vtkIOSSModel vtkIOSSReader vtkIOSSReaderInternal vtkIOSSWriter vtkIOStream vtkIOStreamFwd vtkISIReader vtkIVExporter vtkIVWriter vtkIcicleView vtkIconGlyphFilter vtkIdListCollection vtkIdentityTransform vtkImageActorPointPlacer vtkImageAnisotropicDiffusion3D vtkImageAppend vtkImageBSplineCoefficients vtkImageBSplineInternals vtkImageBSplineInterpolator vtkImageButterworthLowPass vtkImageCacheFilter vtkImageConnectivityFilter vtkImageConnector vtkImageConnectorSeed vtkImageCroppingRegionsWidget vtkImageCursor3D vtkImageDataLIC2D vtkImageDataOutlineFilter vtkImageDataStreamer vtkImageDataToExplicitStructuredGrid vtkImageDataToHyperTreeGrid vtkImageDataToUniformGrid vtkImageDecomposeFilter vtkImageEuclideanDistance vtkImageFourierFilter vtkImageGaussianSource vtkImageHSIToRGB vtkImageHistogramStatistics vtkImageIdealLowPass vtkImageImportExecutive vtkImageInPlaceFilter vtkImageInterpolator vtkImageItem vtkImageIterateFilter vtkImageLogic vtkImageMapToRGBA vtkImageMaskBits vtkImageOrthoPlanes vtkImagePadFilter vtkImagePointDataIterator vtkImagePointIterator vtkImageProbeFilter vtkImageProcessingPass vtkImageProgressIterator vtkImageRGBToXYZ vtkImageReader2Collection vtkImageRenderManager vtkImageResliceToColors vtkImageSSIM vtkImageSkeleton2D vtkImageSlab vtkImageSlabReslice vtkImageSliceCollection vtkImageSobel3D vtkImageSpatialAlgorithm vtkImageStencilAlgorithm vtkImageStencilData vtkImageStencilIterator vtkImageStencilRaster vtkImageStencilSource vtkImageThresholdConnectivity vtkImageToAMR vtkImageToPoints vtkImageToStructuredGrid vtkImageTransform vtkImageXYZToLAB vtkImageYIQToRGB vtkImplicitArray vtkImplicitCylinderRepresentation vtkImplicitCylinderWidget vtkImplicitFunctionCollection vtkImplicitFunctionToImageStencil vtkImplicitHalo vtkImplicitImageRepresentation vtkImplicitPlaneWidget vtkImplicitProjectOnPlaneDistance vtkImplicitSum vtkImplicitVolume vtkImplicitWindowFunction vtkImporter vtkImprintFilter vtkIncrementalForceLayout vtkIncrementalOctreeNode vtkIncrementalPointLocator vtkIndexedImplicitBackend vtkInformationDataObjectKey vtkInformationDataObjectMetaDataKey vtkInformationDoubleKey vtkInformationExecutivePortKey vtkInformationExecutivePortVectorKey vtkInformationIdTypeKey vtkInformationInformationKey vtkInformationInformationVectorKey vtkInformationIntegerKey vtkInformationIntegerPointerKey vtkInformationIntegerRequestKey vtkInformationIntegerVectorKey vtkInformationInternals vtkInformationIterator vtkInformationKey vtkInformationKeyLookup vtkInformationKeyVectorKey vtkInformationObjectBaseKey vtkInformationObjectBaseVectorKey vtkInformationQuadratureSchemeDefinitionVectorKey vtkInformationRequestKey vtkInformationStringKey vtkInformationStringVectorKey vtkInformationUnsignedLongKey vtkInformationVariantKey vtkInformationVariantVectorKey vtkInitialValueProblemSolver vtkInputStream vtkIntegrateAttributes vtkInteractiveArea vtkInteractorEventRecorder vtkInteractorStyle3D vtkInteractorStyleAreaSelectHover vtkInteractorStyleDrawPolygon vtkInteractorStyleFlight vtkInteractorStyleJoystickActor vtkInteractorStyleJoystickCamera vtkInteractorStyleMultiTouchCamera vtkInteractorStyleSwitchBase vtkInteractorStyleTreeMapHover vtkInteractorStyleUnicam vtkInterpolateCalculator vtkInterpolatingSubdivisionFilter vtkInterpolationKernel vtkInterpolatorInternals vtkIntersectionCounter vtkJSONDataSetWriter vtkJSONImageWriter vtkJSONRenderWindowExporter vtkJSONSceneExporter vtkJavaScriptDataWriter vtkJoinTables vtkKCoreDecomposition vtkKCoreLayout vtkKMeansAssessFunctor vtkKMeansDistanceFunctor vtkKMeansDistanceFunctorCalculator vtkKdNode vtkKdTreeSelector vtkLASRasterReader vtkLASReader vtkLICNoiseHelper vtkLICRandomNoise2D vtkLICRandomNumberGeneratorInterface vtkLSDynaPart vtkLSDynaPartCollection vtkLSDynaReader vtkLSDynaSummaryParser vtkLZ4DataCompressor vtkLZMADataCompressor vtkLabelHierarchy vtkLabelHierarchyAlgorithm vtkLabelHierarchyCompositeIterator vtkLabelHierarchyIterator vtkLabelPlacer vtkLabelRenderStrategy vtkLabelSizeCalculator vtkLabeledContourMapper vtkLabeledContourPolyDataItem vtkLabeledTreeMapDataMapper vtkLagrangeCurve vtkLagrangeHexahedron vtkLagrangeInterpolation vtkLagrangeQuadrilateral vtkLagrangeTetra vtkLagrangeTriangle vtkLagrangeWedge vtkLagrangianBasicIntegrationModel vtkLagrangianMatidaIntegrationModel vtkLagrangianParticle vtkLagrangianParticleTracker vtkLargeInteger vtkLassoStencilSource vtkLeaderActor2D vtkLegacyReaderVersion vtkLengthDistribution vtkLevelIdScalars vtkLightKit vtkLightNode vtkLightRepresentation vtkLightWidget vtkLightingMapPass vtkLineIntegralConvolution2D vtkLinearCellExtrusionFilter vtkLinearContourLineInterpolator vtkLinearKernel vtkLinearSelector vtkLinearToQuadraticCellsFilter vtkLinearTransformCellLocator vtkLocationSelector vtkLongArray vtkLongLongArray vtkLookupTableItem vtkLookupTableWithEnabling vtkMCubesWriter vtkMFCWindow vtkMFIXReader vtkMINCImageAttributes vtkMINCImageReader vtkMINCImageWriter vtkMNIObjectReader vtkMNIObjectWriter vtkMNITagPointReader vtkMNITagPointWriter vtkMNITransformReader vtkMNITransformWriter vtkMP4Writer vtkMPASReader vtkMPI4PyCommunicator vtkMPICommunicator vtkMPIController vtkMPIEventLog vtkMPIImageReader vtkMPIMultiBlockPLOT3DReader vtkMPIPixelTT vtkMPIPixelView vtkMRCReader vtkMagnifierRepresentation vtkMagnifierWidget vtkMapArrayValues vtkMapMaskTextureId vtkMappedDataArray vtkMappedUnstructuredGrid vtkMappedUnstructuredGridCellIterator vtkMapper2D vtkMapperCollection vtkMapperNode vtkMarkBoundaryFilter vtkMarkerUtilities vtkMarshalContext vtkMathPrivate vtkMathTextFreeTypeTextRenderer vtkMathTextUtilities vtkMathTextUtilitiesCleanup vtkMathUtilities vtkMatplotlibMathTextUtilities vtkMatricizeArray vtkMatrixToHomogeneousTransform vtkMatrixToLinearTransform vtkMeanValueCoordinatesInterpolator vtkMeasurementCubeHandleRepresentation3D vtkMedicalImageProperties vtkMedicalImageReader2 vtkMemkindRAII vtkMemoryLimitImageDataStreamer vtkMemoryResourceStream vtkMergeArrays vtkMergeCells vtkMergeColumns vtkMergeDataObjectFilter vtkMergeFields vtkMergeGraphs vtkMergeTables vtkMergeTimeFilter vtkMergeVectorComponents vtkMersenneTwister vtkModelMetadata vtkMolecule vtkMoleculeAlgorithm vtkMoleculeAppend vtkMoleculeReaderBase vtkMoleculeToAtomBallFilter vtkMoleculeToBondStickFilter vtkMoleculeToLinesFilter vtkMoleculeToPolyDataFilter vtkMotionFXCFGReader vtkMultiBlockDataSetAlgorithm vtkMultiBlockPLOT3DReaderRecord vtkMultiBlockUnstructuredGridVolumeMapper vtkMultiBlockVolumeMapper vtkMultiCorrelativeAssessFunctor vtkMultiCorrelativeStatistics vtkMultiNewickTreeReader vtkMultiObjectMassProperties vtkMultiPieceDataSet vtkMultiProcessController vtkMultiProcessStream vtkMultiThreader vtkMultiTimeStepAlgorithm vtkMultiVolume vtkMySQLDatabase vtkMySQLDatabasePrivate vtkMySQLQuery vtkMySQLToTableReader vtkNIFTIImageHeader vtkNIFTIImageReader vtkNIFTIImageWriter vtkNativePartitioningStrategy vtkNeighborCells vtkNek5000Reader vtkNetCDFCAMReader vtkNetCDFCFReader vtkNetCDFCFWriter vtkNetCDFPOPReader vtkNetCDFReader vtkNetCDFUGRIDReader vtkNetCDFUGRIDeader vtkNetworkHierarchy vtkNewickTreeReader vtkNewickTreeWriter vtkNonLinearCell vtkNonMergingPointLocator vtkNonOverlappingAMR vtkNonOverlappingAMRAlgorithm vtkNonOverlappingAMRLevelIdScalars vtkNormalizeMatrixVectors vtkNrrdReader vtkNumberToString vtkOBBNode vtkOBJPolyDataProcessor vtkOBJWriter vtkOCCTReader vtkODBCDatabase vtkODBCInternals vtkODBCQuery vtkOMETIFFReader vtkOMFReader vtkOOGLExporter vtkOSOpenGLRenderWindow vtkOSPRayAMRVolumeMapperNode vtkOSPRayActorNode vtkOSPRayCache vtkOSPRayCacheItemObject vtkOSPRayCameraNode vtkOSPRayCompositePolyDataMapper2Node vtkOSPRayCompositePolyDataMapperNode vtkOSPRayLightNode vtkOSPRayMaterialHelpers vtkOSPRayMaterialLibrary vtkOSPRayMoleculeMapperNode vtkOSPRayPass vtkOSPRayPointGaussianMapperNode vtkOSPRayPolyDataMapperNode vtkOSPRayRendererNode vtkOSPRayTestInteractor vtkOSPRayUnstructuredVolumeMapperNode vtkOSPRayViewNodeFactory vtkOSPRayVolumeInterface vtkOSPRayVolumeMapper vtkOSPRayVolumeMapperNode vtkOSPRayVolumeNode vtkOSPRayWindowNode vtkOStrStreamWrapper vtkOStreamWrapper vtkOTDensityMap vtkOTFilter vtkOTKernelSmoothing vtkOTScatterPlotMatrix vtkOTUtilities vtkObjectFactoryCollection vtkObjectFactoryRegistryCleanup vtkObjectIdMap vtkObserverMediator vtkOctreeImageToPointSetFilter vtkOctreePointLocatorNode vtkOldStyleCallbackCommand vtkOpenFOAMReader vtkOpenGL2ContextDevice2DCellArrayHelper vtkOpenGL2ContextDevice2DPrivate vtkOpenGLActor vtkOpenGLArrayTextureBufferAdapter vtkOpenGLAvatar vtkOpenGLBatchedPolyDataMapper vtkOpenGLBillboardTextActor3D vtkOpenGLBufferObject vtkOpenGLCamera vtkOpenGLCellGridMapper vtkOpenGLCellToVTKCellMap vtkOpenGLCompositePolyDataMapperDelegator vtkOpenGLContextActor vtkOpenGLContextBufferId vtkOpenGLContextDevice2D vtkOpenGLContextDevice3D vtkOpenGLContextDeviceBufferObjectBuilder vtkOpenGLES30PolyDataMapper2D vtkOpenGLFXAAFilter vtkOpenGLFXAAPass vtkOpenGLFluidMapper vtkOpenGLFramebufferObject vtkOpenGLGL2PSExporter vtkOpenGLGL2PSHelper vtkOpenGLGL2PSHelperImpl vtkOpenGLGlyph3DHelper vtkOpenGLGlyph3DMapper vtkOpenGLHardwareSelector vtkOpenGLHelper vtkOpenGLHyperTreeGridMapper vtkOpenGLImageAlgorithmCallback vtkOpenGLImageAlgorithmHelper vtkOpenGLImageGradient vtkOpenGLImageMapper vtkOpenGLImageSliceMapper vtkOpenGLIndexBufferObject vtkOpenGLInstanceCulling vtkOpenGLLabeledContourMapper vtkOpenGLLight vtkOpenGLLowMemoryBatchedPolyDataMapper vtkOpenGLLowMemoryCellTypeAgent vtkOpenGLLowMemoryLinesAgent vtkOpenGLLowMemoryPolyDataMapper vtkOpenGLLowMemoryPolygonsAgent vtkOpenGLLowMemoryStripsAgent vtkOpenGLLowMemoryVerticesAgent vtkOpenGLMoleculeMapper vtkOpenGLMovieSphere vtkOpenGLPointGaussianMapper vtkOpenGLPointGaussianMapperHelper vtkOpenGLPolyDataMapper2D vtkOpenGLProjectedTetrahedraMapper vtkOpenGLPropItem vtkOpenGLProperty vtkOpenGLQuadHelper vtkOpenGLRayCastImageDisplayHelper vtkOpenGLRenderPass vtkOpenGLRenderTimer vtkOpenGLRenderTimerLog vtkOpenGLRenderUtilities vtkOpenGLResourceFreeCallback vtkOpenGLShaderCache vtkOpenGLShaderDeclaration vtkOpenGLShaderProperty vtkOpenGLSkybox vtkOpenGLSphereMapper vtkOpenGLState vtkOpenGLStickMapper vtkOpenGLTextActor vtkOpenGLTextActor3D vtkOpenGLTextMapper vtkOpenGLUniforms vtkOpenGLVertexArrayObject vtkOpenGLVertexBufferObject vtkOpenGLVertexBufferObjectCache vtkOpenGLVertexBufferObjectGroup vtkOpenGLVolumeGradientOpacityTable vtkOpenGLVolumeLookupTable vtkOpenGLVolumeLookupTables vtkOpenGLVolumeMaskGradientOpacityTransferFunction2D vtkOpenGLVolumeMaskTransferFunction2D vtkOpenGLVolumeOpacityTable vtkOpenGLVolumeRGBTable vtkOpenGLVolumeTransferFunction2D vtkOpenQubeElectronicData vtkOpenQubeMoleculeSource vtkOpenSlideReader vtkOpenVDBReader vtkOpenVDBWriter vtkOpenVRCamera vtkOpenVRCameraPose vtkOpenVRControlsHelper vtkOpenVRDefaultOverlay vtkOpenVRInteractorStyle vtkOpenVRModel vtkOpenVROverlay vtkOpenVROverlaySpot vtkOpenXRCamera vtkOpenXRControlsHelper vtkOpenXRInteractorStyle vtkOpenXRManager vtkOpenXRManagerConnection vtkOpenXRManagerD3DGraphics vtkOpenXRManagerGraphics vtkOpenXRManagerOpenGLGraphics vtkOpenXRManagerRemoteConnection vtkOpenXRModel vtkOpenXRRemotingRenderWindow vtkOpenXRRenderWindow vtkOpenXRRenderWindowInteractor vtkOpenXRRenderer vtkOpenXRUtilities vtkOrderIndependentTranslucentPass vtkOrderStatistics vtkOrderedTriangulator vtkOrientPolyData vtkOrientationRepresentation vtkOrientationWidget vtkOrientedGlyphFocalPlaneContourRepresentation vtkOrientedPolygonalHandleRepresentation3D vtkOutlineCornerSource vtkOutlineSource vtkOutputStream vtkOutputWindowCleanup vtkOverlappingAMRAlgorithm vtkOverlappingAMRLevelIdScalars vtkOverlappingCellsDetector vtkOverrideInformation vtkOverrideInformationCollection vtkPAutoCorrelativeStatistics vtkPBRLUTTexture vtkPBRPrefilterTexture vtkPBivariateLinearTableThreshold vtkPCAAnalysisFilter vtkPCACurvatureEstimation vtkPCellDataToPointData vtkPCellSizeFilter vtkPChacoReader vtkPComputeHistogram2DOutliers vtkPComputeQuantiles vtkPComputeQuartiles vtkPConnectivityFilter vtkPContingencyStatistics vtkPConvertToMultiBlockDataSet vtkPCorrelativeStatistics vtkPDALReader vtkPDFContextDevice2D vtkPDFExporter vtkPDataSetReader vtkPDataSetWriter vtkPDescriptiveStatistics vtkPDirectory vtkPDistributedDataFilter vtkPExodusIIReader vtkPExodusIIWriter vtkPExtractDataArraysOverTime vtkPExtractExodusGlobalTemporalVariables vtkPExtractGrid vtkPExtractHistogram2D vtkPExtractRectilinearGrid vtkPExtractSelectedArraysOverTime vtkPExtractVOI vtkPHardwareSelector vtkPHyperTreeGridProbeFilter vtkPIOReader vtkPImageWriter vtkPKMeansStatisitcs vtkPKdTree vtkPLSDynaReader vtkPLagrangianParticleTracker vtkPLineIntegralConvolution2D vtkPLinearExtrusionFilter vtkPMaskPoints vtkPMergeArrays vtkPMultiCorrelativeStatistics vtkPNetCDFPOPReader vtkPNrrdReader vtkPOVExporter vtkPOpenFOAMReader vtkPOrderStatistics vtkPOutlineCornerFilter vtkPOutlineFilter vtkPOutlineFilterInternals vtkPPCAStatistics vtkPPainterCommunicator vtkPPairwiseExtractHistogram2D vtkPParticlePathFilter vtkPParticleTracer vtkPParticleTracerBase vtkPPixelTransfer vtkPPolyDataNormals vtkPProbeFilter vtkPProjectSphereFilter vtkPReflectionFilter vtkPResampleFilter vtkPResampleToImage vtkPResampleWithDataSet vtkPSLACReader vtkPSimpleBondPerceiver vtkPSphereSource vtkPStreaklineFilter vtkPStreamTracer vtkPStructuredGridConnectivity vtkPSurfaceLICComposite vtkPSurfaceLICInterface vtkPSystemTools vtkPTSReader vtkPTextureMapToSphere vtkPVWebGLExporter vtkPWindBladeReader vtkPXdmf3Writer vtkPYoungsMaterialInterface vtkPackLabels vtkPainterCommunicator vtkPairwiseExtractHistogram2D vtkPanoramicProjectionPass vtkParallelAMRUtilities vtkParallelCoordinatesActor vtkParallelCoordinatesHistogramRepresentation vtkParallelCoordinatesInteractorStyle vtkParallelReader vtkParallelRenderManager vtkParallelTimer vtkParallelVectors vtkParallelopipedRepresentation vtkParallelopipedWidget vtkParticlePathFilter vtkParticleTracer vtkParticleTracerBase vtkPartitionBalancer vtkPartitionedArchiver vtkPartitionedDataSet vtkPartitionedDataSetAlgorithm vtkPartitionedDataSetCollection vtkPartitionedDataSetCollectionAlgorithm vtkPartitionedDataSetCollectionSource vtkPartitionedDataSetSource vtkPartitioningStrategy vtkPassArrays vtkPassInputTypeAlgorithm vtkPassSelectedArrays vtkPassThroughEdgeStrategy vtkPassThroughLayoutStrategy vtkPeriodicDataArray vtkPeriodicFilter vtkPeriodicTable vtkPerturbCoincidentVertices vtkPhyloXMLTreeReader vtkPhyloXMLTreeWriter vtkPicker vtkPickingManager vtkPieceRequestFilter vtkPieceScalars vtkPiecewiseControlPointsItem vtkPiecewiseFunctionAlgorithm vtkPiecewiseFunctionItem vtkPiecewiseFunctionShiftScale vtkPiecewisePointHandleItem vtkPipelineGraphSource vtkPipelineSize vtkPixelBufferObject vtkPixelExtent vtkPixelExtentIO vtkPixelTransfer vtkPlaneCutter vtkPlaybackRepresentation vtkPlaybackWidget vtkPlot3D vtkPlot3DMetaReader vtkPlotBag vtkPlotBarRangeHandlesItem vtkPlotGrid vtkPlotHistogram2D vtkPlotLine vtkPlotParallelCoordinates vtkPlotPoints3D vtkPlotRangeHandlesItem vtkPointCloudFilter vtkPointCloudRepresentation vtkPointCloudWidget vtkPointConnectivityFilter vtkPointDataToCellData vtkPointDensityFilter vtkPointFillPass vtkPointHandleRepresentation3D vtkPointHandleSource vtkPointInterpolator2D vtkPointPlacer vtkPointSetAlgorithm vtkPointSetCellIterator vtkPointSetStreamer vtkPointSetToMoleculeFilter vtkPointSetToOctreeImageFilter vtkPointSmoothingFilter vtkPoints2D vtkPoissonDiskSampler vtkPolarAxesActor vtkPolarAxesActor2D vtkPolyDataContourLineInterpolator vtkPolyDataEdgeConnectivityFilter vtkPolyDataInternals vtkPolyDataItem vtkPolyDataMapperNode vtkPolyDataPlaneClipper vtkPolyDataPlaneCutter vtkPolyDataPointPlacer vtkPolyDataSourceWidget vtkPolyDataStreamer vtkPolyDataToReebGraphFilter vtkPolyDataToUnstructuredGrid vtkPolyDataWriter vtkPolyLineRepresentation vtkPolyLineSource vtkPolyLineWidget vtkPolyPlane vtkPolyPointSource vtkPolygonBuilder vtkPolygonalHandleRepresentation3D vtkPolyhedronUtilities vtkPolynomialSolversUnivariate vtkPostgreSQLDatabase vtkPostgreSQLDatabasePrivate vtkPostgreSQLQuery vtkPostgreSQLToTableReader vtkPriorityQueue vtkProStarReader vtkProbabilisticVoronoiKernel vtkProbeLineFilter vtkProbePolyhedron vtkProbeSelectedLocations vtkProcess vtkProcessGroup vtkProcessIdScalars vtkProgrammableAttributeDataFilter vtkProgrammableDataObjectSource vtkProgrammableElectronicData vtkProgressBarRepresentation vtkProgressBarWidget vtkProgressObserver vtkProjectPointsToPlane vtkProjectedTerrainPath vtkProjectedTetrahedraMapper vtkProp3DAxisFollower vtkProp3DFollower vtkPropItem vtkPruneTreeFilter vtkPythonAlgorithm vtkPythonArchiver vtkPythonItem vtkQWidgetRepresentation vtkQWidgetTexture vtkQWidgetWidget vtkQtAbstractModelAdapter vtkQtAnnotationLayersModelAdapter vtkQtAnnotationView vtkQtConnection vtkQtDebugLeaksModel vtkQtDebugLeaksView vtkQtInitialization vtkQtLabelRenderStrategy vtkQtListView vtkQtRecordView vtkQtSQLDatabase vtkQtSQLQuery vtkQtStringToImage vtkQtTableModelAdapter vtkQtTableRepresentation vtkQtTableView vtkQtTimePointUtility vtkQtTreeModelAdapter vtkQtTreeRingLabelMapper vtkQtTreeView vtkQtView vtkQuadRotationalExtrusionFilter vtkQuadraturePointInterpolator vtkQuadraturePointsGenerator vtkQuadratureSchemeDefinition vtkQuadratureSchemeDictionaryGenerator vtkQuaternion vtkQuaternionInterpolator vtkQuaterniond vtkQuaternionf vtkRIBLight vtkRISReader vtkROIStencilSource vtkRTXMLPolyDataReader vtkRadialGridActor2D vtkRandomAttributeGenerator vtkRandomHyperTreeGridSource vtkRandomLayoutStrategy vtkRandomPool vtkRandomSequence vtkRangeHandlesItem vtkRasterReprojectionFilter vtkRayCastImageDisplayHelper vtkRayCastStructures vtkReaderAlgorithm vtkRearrangeFields vtkRecoverGeometryWireframe vtkRect vtkRectangularButtonSource vtkRectd vtkRecti vtkRectilinearGridAlgorithm vtkRectilinearGridClip vtkRectilinearGridOutlineFilter vtkRectilinearGridPartitioner vtkRectilinearGridReader vtkRectilinearGridToPointSet vtkRectilinearGridWriter vtkRectilinearSynchronizedTemplates vtkRecursiveDividingCubes vtkRecursiveSphereDirectionEncoder vtkRedistributeDataSetFilter vtkReduceTable vtkReebGraph vtkReebGraphSimplificationFilter vtkReebGraphSimplificationMetric vtkReebGraphSurfaceSkeletonFilter vtkReebGraphToJoinSplitTreeFilter vtkReebGraphVolumeSkeletonFilter vtkReferenceCount vtkRemoteInteractionAdapter vtkRemoveDuplicatePolys vtkRemoveGhosts vtkRemoveHiddenData vtkRemovePolyData vtkRemoveUnusedPoints vtkRenderPass vtkRenderState vtkRenderTimerLog vtkRenderViewBase vtkRenderWindowCollection vtkRenderWindowInteractor3D vtkRenderbuffer vtkRenderedAreaPicker vtkRenderedHierarchyRepresentation vtkRenderedRepresentation vtkRenderedSurfaceRepresentation vtkRenderedTreeAreaRepresentation vtkRendererDelegate vtkRendererNode vtkRendererSource vtkRenderingCellGrid vtkResampleToImage vtkResampleWithDataSet vtkReservoirSampler vtkReservoirSamplerBase vtkResizingWindowToImageFilter vtkResliceCursor vtkResliceCursorActor vtkResliceCursorLineRepresentation vtkResliceCursorPicker vtkResliceCursorPolyDataAlgorithm vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation vtkResliceCursorWidget vtkResliceImageViewer vtkResliceImageViewerMeasurements vtkResourceFileLocator vtkResourceParser vtkResourceStream vtkRotationFilter vtkRowQuery vtkRowQueryToTable vtkRungeKutta2 vtkRungeKutta45 vtkSDL2OpenGL2RenderWindow vtkSDL2OpenGLRenderWindow vtkSDL2RenderWindowInteractor vtkSDL2WebGPURenderWindow vtkSEPReader vtkSILBuilder vtkSLACParticleReader vtkSLACReader vtkSMPContourGrid vtkSMPMergePoints vtkSMPMergePolyDataHelper vtkSMPProgressObserver vtkSMPThreadLocal vtkSMPThreadLocalAPI vtkSMPThreadLocalImpl vtkSMPThreadLocalImplAbstract vtkSMPThreadLocalObject vtkSMPThreadPool vtkSMPTools vtkSMPToolsAPI vtkSMPToolsAPIInitialize vtkSMPToolsImpl vtkSOADataArrayTemplate vtkSPHCubicKernel vtkSPHInterpolator vtkSPHKernel vtkSPHQuarticKernel vtkSPHQuinticKernel vtkSQLDatabase vtkSQLDatabaseGraphSource vtkSQLDatabaseSchema vtkSQLDatabaseTableSource vtkSQLGraphReader vtkSQLQuery vtkSQLiteDatabase vtkSQLiteDatabaseInternals vtkSQLiteQuery vtkSQLiteToTableReader vtkSSAAPass vtkSSAOPass vtkSVGContextDevice2D vtkSVGExporter vtkScalarBarActorInternal vtkScalarBarRepresentation vtkScalarTree vtkScalarsToColorsItem vtkScalarsToTextureFilter vtkScaledSOADataArrayTemplate vtkScaledTextActor vtkScatterPlotMatrix vtkScenePicker vtkSectorSource vtkSegYBinaryHeaderBytesPositions vtkSegYIOUtils vtkSegYReader vtkSegYReaderInternal vtkSegYTrace vtkSegYTraceHeaderBytesPositions vtkSegYTraceReader vtkSelectionAlgorithm vtkSelector vtkSerializer vtkServerSocket vtkSharedFuture vtkSharedFutureBase vtkShepardKernel vtkSignedCharArray vtkSimple3DCirclesStrategy vtkSimpleBondPerceiver vtkSimpleCellTessellator vtkSimpleImageToImageFilter vtkSimpleReader vtkSimpleScalarTree vtkSingleVTPExporter vtkSliceAndDiceLayoutStrategy vtkSliceCubes vtkSmartPointerBase vtkSmartVector vtkSmoothErrorMetric vtkSobelGradientMagnitudePass vtkSocket vtkSocketCollection vtkSocketCommunicator vtkSocketController vtkSortFieldData vtkSortFileNames vtkSpanSpace vtkSpanTreeLayoutStrategy vtkSparseArrayToTable vtkSpatialRepresentationFilter vtkSpatioTemporalHarmonicsAttribute vtkSpatioTemporalHarmonicsSource vtkSphereHandleRepresentation vtkSpherePuzzle vtkSpherePuzzleArrows vtkSphereTree vtkSphereTreeFilter vtkSpheres vtkSphericalDirectionEncoder vtkSphericalHarmonics vtkSphericalPointIterator vtkSphericalTransform vtkSpline vtkSplineGraphEdges vtkSplineRepresentation vtkSplineWidget vtkSplitByCellScalarFilter vtkSplitColumnComponents vtkSplitField vtkSplitSharpEdgesPolyData vtkSquarifyLayoutStrategy vtkStackedTreeLayoutStrategy vtkStateStorage vtkStaticCellLinks vtkStaticCellLinksTemplate vtkStaticCellLocator vtkStaticCleanPolyData vtkStaticCleanUnstructuredGrid vtkStaticCompositeSource vtkStaticDataSource vtkStaticEdgeLocatorTemplate vtkStaticFaceHashLinksTemplate vtkStaticPointLocator2D vtkStatisticalOutlierRemoval vtkStatisticsAlgorithmPrivate vtkStereoCompositor vtkStitchImageDataWithGhosts vtkStrahlerMetric vtkStreaklineFilter vtkStreamGraph vtkStreamSurface vtkStreamerBase vtkStreamingStatistics vtkStreamingTessellator vtkStringOutputWindow vtkStringToCategory vtkStringToImage vtkStringToNumeric vtkStringToken vtkStructuredAMRGridConnectivity vtkStructuredAMRNeighbor vtkStructuredCellArray vtkStructuredDataPlaneCutter vtkStructuredExtent vtkStructuredGridAlgorithm vtkStructuredGridAppend vtkStructuredGridClip vtkStructuredGridConnectivity vtkStructuredGridLIC2D vtkStructuredGridPartitioner vtkStructuredGridWriter vtkStructuredImplicitConnectivity vtkStructuredNeighbor vtkStructuredPointArray vtkStructuredPointBackend vtkStructuredPointsCollection vtkStructuredPointsGeometryFilter vtkStructuredPointsWriter vtkStructuredTPointBackend vtkSubCommunicator vtkSubGroup vtkSubdivideTetra vtkSubdivisionFilter vtkSurfaceLICComposite vtkSurfaceLICHelper vtkSurfaceLICInterface vtkSurfaceLICMapper vtkSurfaceNets2D vtkSurfaceNets3D vtkSynchronizeTimeFilter vtkSynchronizedRenderWindows vtkSynchronizedRenderers vtkSynchronizedTemplates2D vtkSynchronizedTemplates3D vtkSynchronizedTemplatesCutter3D vtkSystemIncludes vtkTDxInteractorStyle vtkTDxInteractorStyleCamera vtkTDxInteractorStyleSettings vtkTDxMotionEventInfo vtkTDxQtUnixDevices vtkTGAReader vtkTIFFReaderInternal vtkTRUCHASReader vtkTableAlgorithm vtkTableBasedClipCases vtkTableFFT vtkTableReader vtkTableToArray vtkTableToDatabaseWriter vtkTableToGraph vtkTableToMySQLWriter vtkTableToPostgreSQLWriter vtkTableToSQLiteWriter vtkTableToSparseArray vtkTableToStructuredGrid vtkTableToTreeFilter vtkTableWriter vtkTanglegramItem vtkTclCommand vtkTecplotReader vtkTecplotTableReader vtkTemplateAliasMacro vtkTemporalAlgorithm vtkTemporalArrayOperatorFilter vtkTemporalDataSetCache vtkTemporalDelimitedTextReader vtkTemporalFractal vtkTemporalInterpolatedVelocityField vtkTemporalInterpolator vtkTemporalPathLineFilter vtkTemporalShiftScale vtkTemporalSnapToTimeStep vtkTemporalStatistics vtkTensorPrincipalInvariants vtkTensorProbeRepresentation vtkTensorProbeWidget vtkTensorRepresentation vtkTensorWidget vtkTerrainContourLineInterpolator vtkTerrainDataPointPlacer vtkTestDataArray vtkTestNewVar vtkTextActor3D vtkTextCodec vtkTextCodecFactory vtkTextPropertyCollection vtkTextRenderer vtkTextRendererCleanup vtkTextRendererStringToImage vtkTextureIO vtkTextureImageCache vtkTextureMapToCylinder vtkTextureObject vtkTextureUnitManager vtkTexturedActor2D vtkTexturedButtonRepresentation vtkThreadedCallbackQueue vtkThreadedCompositeDataPipeline vtkThreadedImageAlgorithm vtkThreadedImageWriter vtkThreadedTaskQueue vtkThresholdGraph vtkThresholdTable vtkTimeInformation vtkTimePointUtility vtkTimeRange vtkTimeSource vtkTimerLogCleanup vtkTimerLogScope vtkToAffineArrayStrategy vtkToConstantArrayStrategy vtkToImplicitArrayFilter vtkToImplicitRamerDouglasPeuckerStrategy vtkToImplicitStrategy vtkToImplicitTypeErasureStrategy vtkTooltipItem vtkTransferAttributes vtkTransform2D vtkTransformCollection vtkTransformConcatenation vtkTransformConcatenationStack vtkTransformCoordinateSystems vtkTransformFeedback vtkTransformInterpolator vtkTransformPair vtkTransformToGrid vtkTranslucentPass vtkTransmitImageDataPiece vtkTransmitPolyDataPiece vtkTransmitRectilinearGridPiece vtkTransmitStructuredDataPiece vtkTransmitStructuredGridPiece vtkTransmitUnstructuredGridPiece vtkTransposeMatrix vtkTransposeTable vtkTreeAlgorithm vtkTreeAreaView vtkTreeCompositer vtkTreeDifferenceFilter vtkTreeFieldAggregator vtkTreeHeatmapItem vtkTreeIterator vtkTreeLayoutStrategy vtkTreeLevelsFilter vtkTreeMapLayout vtkTreeMapLayoutStrategy vtkTreeMapToPolyData vtkTreeOrbitLayoutStrategy vtkTreeReader vtkTreeRingToPolyData vtkTreeRingView vtkTreeWriter vtkTriQuadraticPyramid vtkTriangularTCoords vtkTriangularTexture vtkTrimmedExtrusionFilter vtkTrivialConsumer vtkTrivialProducer vtkTryDowncastHelper1 vtkTryDowncastHelper2 vtkTryDowncastHelper3 vtkTubeBender vtkTulipReader vtkTuple vtkTypeList vtkTypedArray vtkTypedDataArray vtkTypedDataArrayIterator vtkURI vtkURIComponent vtkURILoader vtkUTF16TextCodec vtkUTF8TextCodec vtkUncertaintyTubeFilter vtkUndirectedGraphAlgorithm vtkUniformGridAMR vtkUniformGridAMRAlgorithm vtkUniformGridAMRDataIterator vtkUniformGridPartitioner vtkUniformHyperTreeGrid vtkUniformHyperTreeGridSource vtkUniforms vtkUnsignedIntArray vtkUnsignedLongArray vtkUnsignedLongLongArray vtkUnsignedShortArray vtkUnstructuredGridAlgorithm vtkUnstructuredGridBase vtkUnstructuredGridBaseAlgorithm vtkUnstructuredGridBunykRayCastFunction vtkUnstructuredGridCellIterator vtkUnstructuredGridGeometryFilter vtkUnstructuredGridHomogeneousRayIntegrator vtkUnstructuredGridLinearRayIntegrator vtkUnstructuredGridPartialPreIntegration vtkUnstructuredGridPreIntegration vtkUnstructuredGridQuadricDecimation vtkUnstructuredGridToCellGrid vtkUnstructuredGridToReebGraphFilter vtkUnstructuredGridVolumeMapper vtkUnstructuredGridVolumeRayCastFunction vtkUnstructuredGridVolumeRayCastIterator vtkUnstructuredGridVolumeRayIntegrator vtkUnstructuredGridVolumeZSweepMapper vtkUpdateCellsV8toV9 vtkVASPAnimationReader vtkVASPTessellationReader vtkVPICReader vtkVRCamera vtkVRCollaborationClient vtkVRControlsHelper vtkVRFollower vtkVRHMDCamera vtkVRHardwarePicker vtkVRInteractorStyle vtkVRMLUseStruct vtkVRMLYaccData vtkVRMenuRepresentation vtkVRMenuWidget vtkVRModel vtkVRPanelRepresentation vtkVRPanelWidget vtkVRRay vtkVRRenderWindow vtkVRRenderWindowInteractor vtkVRRenderer vtkValueSelector vtkVariantBoostSerialization vtkVariantCast vtkVariantCreate vtkVariantExtract vtkVector2 vtkVector3 vtkVector3f vtkVector3i vtkVector4 vtkVector4d vtkVector4i vtkVectorFieldTopology vtkVeraOutReader vtkVertexAdjacencyList vtkVertexDegree vtkVertexListIterator vtkVideoSource vtkView vtkViewDependentErrorMetric vtkViewNode vtkViewNodeFactory vtkViewUpdater vtkVisibilitySort vtkVoidArray vtkVolume16Reader vtkVolumeCollection vtkVolumeContourSpectrumFilter vtkVolumeInputHelper vtkVolumeMapper vtkVolumeMapperNode vtkVolumeMask vtkVolumeNode vtkVolumeOfRevolutionFilter vtkVolumeOutlineSource vtkVolumePicker vtkVolumeRayCastSpaceLeapingImageFilter vtkVolumeReader vtkVolumeStateRAII vtkVolumeTexture vtkVolumetricPass vtkVoronoi2D vtkVoronoiKernel vtkVortexCore vtkVoxelGrid vtkVtkJSSceneGraphSerializer vtkVtkJSViewNodeFactory vtkWGPUContext vtkWarpLens vtkWarpTransform vtkWasmSceneManager vtkWeakPointer vtkWeakPointerBase vtkWeakReference vtkWebApplication vtkWebAssemblyRenderWindowInteractor vtkWebGLDataSet vtkWebGLExporter vtkWebGLObject vtkWebGLPolyData vtkWebGLWidget vtkWebGPUActor vtkWebGPUCamera vtkWebGPUClearPass vtkWebGPUHardwareSelector vtkWebGPUInternalsBindGroup vtkWebGPUInternalsBindGroupLayout vtkWebGPUInternalsBuffer vtkWebGPUInternalsPipelineLayout vtkWebGPUInternalsRenderPassCreateInfo vtkWebGPUInternalsRenderPassDescriptor vtkWebGPUInternalsRenderPipelineDescriptor vtkWebGPUInternalsShaderModule vtkWebGPULight vtkWebGPUPolyDataMapper vtkWebGPUProperty vtkWebGPURenderPass vtkWebGPURenderWindow vtkWebGPURenderer vtkWebInteractionEvent vtkWebUtilities vtkWendlandQuinticKernel vtkWidgetEventTranslator vtkWidgetRepresentation vtkWidgetSet vtkWin32HardwareWindow vtkWin32Header vtkWin32OpenGL2RenderWindow vtkWin32OpenGLDXRenderWindow vtkWin32OpenGLRenderWindow vtkWin32OutputWindow vtkWin32ProcessOutputWindow vtkWin32RenderWindowInteractor vtkWin32VideoSource vtkWindBladeReader vtkWindowNode vtkWrappingHints vtkWriter vtkX3DExporterFIWriter vtkX3DExporterFIWriterHelper vtkX3DExporterWriter vtkX3DExporterXMLWriter vtkXMLCompositeDataSetWriterHelper vtkXMLCompositeDataWriter vtkXMLDataElement vtkXMLDataHeader vtkXMLDataHeaderImpl vtkXMLDataObjectWriter vtkXMLDataParser vtkXMLDataReader vtkXMLDataWriterHelper vtkXMLFileOutputWindow vtkXMLFileReadTester vtkXMLHierarchicalBoxDataFileConverter vtkXMLHierarchicalBoxDataReader vtkXMLHierarchicalBoxDataWriter vtkXMLHierarchicalDataReader vtkXMLHyperTreeGridReader vtkXMLHyperTreeGridWriter vtkXMLMultiGroupDataReader vtkXMLPDataObjectReader vtkXMLPDataObjectWriter vtkXMLPDataReader vtkXMLPDataSetWriter vtkXMLPDataWriter vtkXMLPHierarchicalBoxDataWriter vtkXMLPHyperTreeGridReader vtkXMLPHyperTreeGridWriter vtkXMLPImageDataReader vtkXMLPMultiBlockDataWriter vtkXMLPPolyDataReader vtkXMLPPolyDataWriter vtkXMLPRectilinearGridReader vtkXMLPRectilinearGridWriter vtkXMLPStructuredDataReader vtkXMLPStructuredDataWriter vtkXMLPStructuredGridReader vtkXMLPStructuredGridWriter vtkXMLPTableReader vtkXMLPTableWriter vtkXMLPUniformGridAMRWriter vtkXMLPUnstructuredDataReader vtkXMLPUnstructuredDataWriter vtkXMLPUnstructuredGridReader vtkXMLParser vtkXMLPartitionedDataSetCollectionReader vtkXMLPartitionedDataSetCollectionWriter vtkXMLPartitionedDataSetReader vtkXMLPartitionedDataSetWriter vtkXMLReaderVersion vtkXMLStructuredDataReader vtkXMLStructuredDataWriter vtkXMLTableReader vtkXMLTableWriter vtkXMLUniformGridAMRWriter vtkXMLUnstructuredDataReader vtkXMLUnstructuredDataWriter vtkXMLUtilities vtkXMLWriter vtkXMLWriter2 vtkXMLWriterBase vtkXOpenGLRenderWindow vtkXRenderWindowInteractor vtkXWebGPURenderWindow vtkXYPlotRepresentation vtkXYPlotWidget vtkXYZMolReader vtkXYZMolReader2 vtkXdmf3ArrayKeeper vtkXdmf3ArraySelection vtkXdmf3DataSet vtkXdmf3HeavyDataHandler vtkXdmf3LightDataHandler vtkXdmf3Reader vtkXdmf3SILBuilder vtkXdmf3Writer vtkXdmfArraySelection vtkXdmfDataArray vtkXdmfDocument vtkXdmfDomain vtkXdmfHeavyData vtkXdmfReader vtkXdmfReaderInternal vtkXdmfWriter vtkYieldCriteria vtkYoungsMaterialInterface vtkZLibDataCompressor vtkZSpaceCamera vtkZSpaceCoreCompatibilitySDKManager vtkZSpaceCoreSDKManager vtkZSpaceGenericRenderWindow vtkZSpaceHardwarePicker vtkZSpaceInteractorStyle vtkZSpaceRayActor vtkZSpaceRenderWindowInteractor vtkZSpaceRenderer vtkZSpaceSDKManager vtkZSpaceWin32RenderWindow vtkmAverageToCells vtkmAverageToPoints vtkmCleanGrid vtkmClip vtkmContour vtkmCoordinateSystemTransform vtkmDataArray vtkmDataSet vtkmExternalFaces vtkmExtractVOI vtkmFilterOverrides vtkmGradient vtkmHistogram vtkmImageConnectivity vtkmLevelOfDetail vtkmNDHistogram vtkmPointElevation vtkmPointTransform vtkmPolyDataNormals vtkmProbe vtkmSlice vtkmThreshold vtkmTriangleMeshPointNormals vtkmWarpScalar vtkmWarpVector"},{"location":"Cxx/Coverage/CxxVTKClassesUsed/","title":"VTK Classes used in the Examples","text":""},{"location":"Cxx/Coverage/CxxVTKClassesUsed/#cxx","title":"Cxx","text":"

        Out of 3113 available VTK classes, 853 are demonstrated here.

        "},{"location":"Cxx/Coverage/CxxVTKClassesUsed/#excluded-classes","title":"Excluded classes","text":"

        These classes are excluded since they occur in the majority of the examples:

        VTK Class VTK Class VTK Class vtkActor vtkCamera vtkNamedColors vtkNew vtkPolyDataMapper vtkProperty vtkRenderer vtkRenderWindow vtkRenderWindowInteractor vtkSmartPointer"},{"location":"Cxx/Coverage/CxxVTKClassesUsed/#classes-used","title":"Classes used","text":"VTK Class Examples vtk3DSImporter 3DSImporter CombineImportedActors ImportToExport vtkAbstractPicker CaptionActor2D MarkKeypoints vtkAbstractWidget BorderWidget BorderWidgetQt vtkActor2D Actor2D BozoShaderDemo CaptionActor2D Cell3DDemonstration CellTypeSource ChooseTextColorDemo CompareExtractSurface CompareRandomGeneratorsCxx CurvaturesAdjustEdges CurvaturesDemo Delaunay3D Delaunay3DDemo FontFile GeometricObjectsDemo GradientBackground ImageMapper IsoparametricCellsDemo KochanekSplineDemo LabelContours LabeledDataMapper LabeledMesh LabelPlacementMapper LinearCellDemo MarkKeypoints MultiLineText ParametricKuenDemo ParametricObjectsDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo Planes PlatonicSolids PointDataSubdivision QuadraticHexahedronDemo QuadraticTetraDemo ReadAllPolyDataTypesDemo ReadDICOMSeries ReadLegacyUnstructuredGrid RescaleReverseLUT ResizeImageDemo SourceObjectsDemo ThinPlateSplineTransform ViewportBorders Visualize2DPoints vtkActorCollection CombineImportedActors DetermineActorType TransformActorCollection vtkAdjacencyMatrixToEdgeTable AdjacencyMatrixToEdgeTable vtkAdjacentVertexIterator AdjacentVertexIterator vtkAffineRepresentation2D AffineWidget vtkAffineWidget AffineWidget vtkAlgorithm EllipticalButton FixedPointVolumeRayCastMapperCT OpenVRTessellatedBoxSource ReverseAccess TessellatedBoxSource vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestProgressReportFilter vtkAlgorithmOutput ReverseAccess vtkAMRBox Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse OverlappingAMR vtkAMRUtilities Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse OverlappingAMR vtkAngleRepresentation2D AngleWidget2D vtkAngleWidget AngleWidget AngleWidget2D vtkAnimationCue AnimateActors AnimationScene vtkAnimationScene AnimateActors AnimationScene vtkAnnotatedCubeActor AnatomicalOrientation AnnotatedCubeActor ColoredAnnotatedCube CompassWidget FroggieSurface FroggieView OrientationMarkerWidget vtkAnnotationLink SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver vtkAppendFilter AppendFilter CameraModel1 ConnectivityFilter PolyDataToUnstructuredGrid QuadricVisualization ReadAllUnstructuredGridTypes vtkAppendPolyData AffineWidget BlobbyLogo CameraModel2 ColorDisconnectedRegions CombineImportedActors CombinePolyData ContoursToSurface CorrectlyRenderTranslucentGeometry DepthSortPolyData ExtractClusters ExtractOutsideSurface ExtrudePolyDataAlongLine FilledContours PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion ProbeCombustor RemoveOutsideSurface ResampleAppendedPolyData VelocityProfile WarpCombustor XYPlot vtkAreaPicker AreaPicking HighlightSelectedPoints HighlightSelection vtkArrayCalculator ArrayCalculator ExtractArrayComponent vtkArrayData AdjacencyMatrixToEdgeTable ArrayToTable ArrayWriter vtkArrayDispatch ForLoop vtkArrayPrint AdjacencyMatrixToEdgeTable vtkArrayToTable ArrayToTable vtkArrayWriter ArrayWriter vtkArrowSource Arrow BrownianPoints CurvatureBandsWithGlyphs DistanceToCamera DotProduct ElevationBandsWithGlyphs EllipticalCylinderDemo ExtractSurfaceDemo GeometricObjectsDemo GLTFExporter Gradient GradientFilter ImageSobel2D NormalEstimation OpenVROrientedArrow OrientedArrow OrientedGlyphs OutlineGlowPass ParametricObjectsDemo PlaneSourceDemo PointDataSubdivision RotationAroundLine TransformFilter VectorField vtkAssembly Assembly MovableAxes vtkAssemblyNode ImageRegion vtkAssemblyPath ImageRegion MovableAxes PickPixel PickPixel2 vtkAssignAttribute GradientFilter vtkAxes Finance FinanceFieldData Rotations RotationsA RotationsB RotationsC RotationsD TensorAxes TextOrigin WalkCow WalkCowA WalkCowB vtkAxesActor AlignTwoPolyDatas AnatomicalOrientation Axes CallBack CheckVTKVersion ColoredAnnotatedCube DisplayCoordinateAxes FroggieSurface FroggieView IndividualVRML LayeredActors MovableAxes PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision TransformOrderDemo vtkAxis AreaPlot BarChart BarChartQt BoxChart ChartMatrix Histogram2D KDTreeTimingDemo ModifiedBSPTreeTimingDemo MultiplePlots OBBTreeTimingDemo OctreeTimingDemo StackedBar StackedPlot vtkAxisActor AxisActor vtkBalloonRepresentation BalloonWidget vtkBalloonWidget BalloonWidget vtkBandedPolyDataContourFilter BandedPolyDataContourFilter ColoredAnnotatedCube CurvatureBandsWithGlyphs ElevationBandsWithGlyphs NamedColors PolyDataIsoLines vtkBarChartActor CompareRandomGeneratorsCxx HistogramBarChart ImageAccumulateGreyscale vtkBiDimensionalRepresentation2D BiDimensionalWidget vtkBiDimensionalWidget BiDimensionalWidget vtkBillboardTextActor3D BillboardTextActor3D vtkBiQuadraticQuad IsoparametricCellsDemo vtkBiQuadraticQuadraticHexahedron IsoparametricCellsDemo vtkBiQuadraticQuadraticWedge IsoparametricCellsDemo vtkBiQuadraticTriangle IsoparametricCellsDemo vtkBMPReader ImageWarp ReadBMP ThinPlateSplineTransform WriteBMP vtkBMPWriter ImageWriter WriteBMP ZBuffer vtkBooleanOperationPolyDataFilter BooleanOperationPolyDataFilter vtkBooleanTexture TextureCutQuadric vtkBoostBreadthFirstSearch BreadthFirstDistance DepthFirstSearchIterator vtkBoostBreadthFirstSearchTree BoostBreadthFirstSearchTree vtkBoostConnectedComponents ConnectedComponents vtkBoostPrimMinimumSpanningTree DepthFirstSearchIterator MinimumSpanningTree vtkBorderRepresentation BorderWidget BorderWidgetQt CenterAnImage ImageClip ImageRegion vtkBorderWidget BorderWidget BorderWidgetQt CenterAnImage ImageClip ImageRegion vtkBoundedPointSource ExtractPointsDemo FitImplicitFunction MaskPointsFilter vtkBoundingBox BoundingBox BoundingBoxIntersection vtkBox BooleanOperationImplicitFunctions Box ImplicitBooleanDemo ImplicitDataSetClipping IntersectLine ModifiedBSPTreeTimingDemo OBBTreeTimingDemo vtkBoxClipDataSet BoxClipStructuredPoints BoxClipUnstructuredGrid vtkBoxMuellerRandomSequence GaussianRandomNumber PCADemo vtkBoxRepresentation BoxWidget2 vtkBoxWidget BoxWidget Tutorial_Step6 vtkBoxWidget2 BoxWidget2 vtkBrownianPoints BrownianPoints vtkBrush AreaPlot Diagram Histogram2D MultiplePlots ReadLegacyUnstructuredGrid vtkButterflySubdivisionFilter PointDataSubdivision Subdivision SubdivisionDemo vtkButtonWidget EllipticalButton TexturedButtonWidget vtkBYUReader AlignTwoPolyDatas BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CapClip CellCentersDemo CellsInsideObject ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CompareExtractSurface ConnectivityFilterDemo Delaunay3DDemo DensifyPoints ExportPolyDataScene ExtractEnclosedPoints ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FillHoles GradientBackground HiddenLineRemoval HighlightSelection ImplicitModeller InterpolateCamera KDTreeFindPointsWithinRadiusDemo LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties Motor NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientedBoundingCylinder PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface ProjectedTexture RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation SignedDistance SpatterShader SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Subdivision SubdivisionDemo UnsignedDistance VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree WalkCow WalkCowA WalkCowB vtkCallbackCommand AffineWidget Animation Arbitrary3DCursor AreaPicking CallBack CallData CameraModifiedEvent CellLocatorVisualization ClientData CloseWindow DataAnimation FilterProgress FilterSelfProgress FireFlowDemo FrameRate FroggieView Hanoi HanoiInitial HanoiIntermediate HDRReader ImageTracerWidget ImageTracerWidgetInsideContour InteractorStyleUser KeypressObserver LayeredActors LODProp3D MouseEventsObserver MovableAxes MultipleRenderWindows ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointLocatorVisualization PolygonalSurfacePointPlacer ProgressReport RubberBand2DObserver SeedWidgetImage SelectedVerticesAndEdgesObserver SelectWindowRegion Slider Slider2D SphereWidget SphereWidgetEvents StreamlinesWithLineWidget Timer TransientHDFReader TransparentBackground UserEvent vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter WalkCow WalkCowA WalkCowB WindowModifiedEvent vtkCameraActor CameraActor vtkCameraInterpolator InterpolateCamera vtkCameraOrientationWidget AlignTwoPolyDatas CameraOrientationWidget CheckVTKVersion CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges ElevationBandsWithGlyphs FroggieSurface FroggieView PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkCameraPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing RenderScalarToFloatBuffer Shadows ShadowsLightsDemo vtkCaptionActor2D AnatomicalOrientation Axes CaptionActor2D CaptionWidget ColoredAnnotatedCube FroggieSurface FroggieView PointDataSubdivision vtkCaptionRepresentation CaptionWidget vtkCaptionWidget CaptionWidget vtkCardinalSpline 1DTupleInterpolation CardinalSpline ResamplePolyLine vtkCategoryLegend ReadLegacyUnstructuredGrid vtkCell CellEdges Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse GetCellCenter PickPixel PickPixel2 TriangleArea vtkCellArray AddCell AreaPicking BandedPolyDataContourFilter Bottle CameraModel1 CameraModel2 CappedSphere Cell3DDemonstration ChooseTextColorDemo ColoredLines ColoredPoints CompareExtractSurface ConstrainedDelaunay2D ContoursToSurface ContourWidget CreateESGrid Cube CurvedReformation DataSetSurface DecimatePolyline DeformPointSet DeleteCells EllipticalCylinder EllipticalCylinderDemo ExtractEdges ExtractPolyLinesFromPolyData FitSplineToCutterOutput Glyph3DImage GradientBackground Hexahedron IterateOverLines IterativeClosestPointsTransform KochSnowflake LabelContours LabeledMesh LandmarkTransform LinearCellDemo LongLine MiscCellData MultiLineText NOVCAGraph PineRootConnectivity PineRootDecimation Point PointsProjectedHull PolyDataCellNormals PolyDataIsoLines PolyDataPointNormals Polygon PolyLine PolyLine1 Pyramid Quad ReadAllPolyDataTypesDemo ReadPlainTextTriangles RemoveVertices ResamplePolyLine RibbonFilter RuledSurfaceFilter ShepardMethod SingleSplat Spring Tetrahedron TextureMapQuad ThresholdCells Triangle TriangleArea TriangleColoredPoints TriangleSolidColor TriangleStrip TubesWithVaryingRadiusAndColors Vertex ViewportBorders Visualize2DPoints WarpVector WriteVTP WriteVTU vtkCellArrayIterator ExtractPolyLinesFromPolyData FitSplineToCutterOutput LabelContours PineRootConnectivity PineRootDecimation vtkCellCenters CellCenters CellCentersDemo LabeledMesh vtkCellData AssignCellColorsFromLUT CellTypeSource ColorCells ColorCellsWithRGB ColoredAnnotatedCube ColoredLines CombineImportedActors CreateColorSeriesDemo Delaunay3D Delaunay3DDemo DumpXMLFile FilledContours FindAllArrayNames FindCellIntersections Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse GenerateCubesFromLabels GenericClip GetMiscCellData HighlightBadCells IdentifyHoles ImplicitDataSetClipping IntersectLine IterativeClosestPointsTransform KochSnowflake LandmarkTransform LoadESGrid MeshQuality MiscCellData PointCellIds PolyDataCellNormals PolyDataExtractNormals ReadLegacyUnstructuredGrid RemoveOutsideSurface StructuredGrid TableBasedClipDataSetWithPolyData2 ThresholdCells TriangleSolidColor vtkCellIterator Delaunay3D Delaunay3DDemo ExtractFaces IdentifyHoles QuadraticHexahedronDemo QuadraticTetraDemo ReadLegacyUnstructuredGrid RemoveOutsideSurface StructuredGrid vtkCellLocator CellLocator CellLocatorVisualization ExtractOutsideSurface FindCellIntersections InterpolateTerrain RemoveOutsideSurface ResampleAppendedPolyData vtkCellPicker CellPicking MoveAGlyph vtkCellTreeLocator CellTreeLocator vtkCellType UGrid vtkCellTypes CellTypeSource ClipDataSetWithPolyData ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 DumpXMLFile ExtractFaces ReadLegacyUnstructuredGrid TableBasedClipDataSetWithPolyData vtkCellTypeSource CellTypeSource vtkCenterOfMass CenterOfMass vtkCharArray AreaPlot vtkChart AreaPlot BarChart BarChartQt ChartMatrix ChartsOn3DScene KDTreeTimingDemo LinePlot ModifiedBSPTreeTimingDemo MultiplePlots OBBTreeTimingDemo OctreeTimingDemo ScatterPlot StackedBar StackedPlot vtkChartBox BoxChart vtkChartHistogram2D Histogram2D vtkChartLegend FunctionalBagPlot StackedBar vtkChartMatrix ChartMatrix vtkChartParallelCoordinates ParallelCoordinates vtkChartPie PieChart vtkChartXY AreaPlot BarChart BarChartQt ChartMatrix ChartsOn3DScene FunctionalBagPlot KDTreeTimingDemo LinePlot ModifiedBSPTreeTimingDemo MultiplePlots OBBTreeTimingDemo OctreeTimingDemo ScatterPlot StackedBar StackedPlot vtkChartXYZ PlotLine3D SurfacePlot vtkCheckerboardRepresentation CheckerboardWidget vtkCheckerboardWidget CheckerboardWidget vtkCircularLayoutStrategy LabelVerticesAndEdges vtkCleanPolyData BooleanOperationPolyDataFilter CleanPolyData CombinePolyData CurvatureBandsWithGlyphs CurvaturesDemo Delaunay3D Delaunay3DDemo DistancePolyDataFilter DownsamplePointCloud ElevationBandsWithGlyphs ExtrudePolyDataAlongLine FilledContours LoopBooleanPolyDataFilter NormalsDemo OrientedBoundingCylinder PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision Silhouette SpatterShader WarpSurface vtkClipClosedSurface ClipClosedSurface vtkClipDataSet ClipDataSetWithPolyData ClipUnstructuredGridWithPlane2 TissueLens vtkClipPolyData CapClip ClipArt ClipFrustum ClipSphereCylinder CreateBFont FilledContours ImplicitDataSetClipping ImplicitPlaneWidget2 ImplicitSelectionLoop PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing SelectPolyData SolidClip vtkClipVolume ClipVolume vtkCMLMoleculeReader ReadCML vtkCollisionDetectionFilter CollisionDetection vtkColor GradientBackground vtkColor3d AnimateActors AreaPlot BarChart BarChartQt BooleanOperationImplicitFunctions BoxClipStructuredPoints BoxClipUnstructuredGrid CellCentersDemo CellsInsideObject ChartsOn3DScene ClipVolume ConeDemo CubeAxesActor ExtractPolyLinesFromPolyData FireFlow FireFlowDemo FunctionalBagPlot GLTFExporter GLTFImporter Histogram2D ImplicitQuadric ImplicitSphere1 NormalsDemo OrientedBoundingCylinder PlaneSourceDemo ReadOBJ ShadowsLightsDemo SubdivisionDemo VoxelsOnBoundary vtkColor3ub ColorSeriesPatches CreateColorSeriesDemo Curvatures FunctionalBagPlot NamedColorPatches PieChartActor PointDataSubdivision ShareCamera SplitPolyData WordCloud vtkColor4ub Histogram2D vtkColorLegend Histogram2D vtkColorSeries BarChart CellTypeSource ColoredAnnotatedCube ColorSeriesPatches CreateColorSeriesDemo CurvatureBandsWithGlyphs Curvatures Diagram ElevationBandsWithGlyphs FunctionalBagPlot Hawaii ImplicitBooleanDemo LUTUtilities MergeSelections MeshQuality OpenVRVolume PieChart PieChartActor PointDataSubdivision ScalarBarActorColorSeries ShareCamera SplitPolyData StackedBar StackedPlot TensorEllipsoids WordCloud vtkColorTransferFunction AssignCellColorsFromLUT BackgroundTexture ColorTransferFunction CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo DisplacementPlot ElevationBandsWithGlyphs FixedPointVolumeRayCastMapperCT Histogram2D IntermixedUnstructuredGrid MedicalDemo4 MinIntensityRendering OpenVRVolume PointDataSubdivision RayCastIsosurface ShepardMethod SimpleRayCast vtkCommand AffineWidget AnimateActors Animation AnimationScene Arbitrary3DCursor AreaPicking BiDimensionalWidget BorderWidget BorderWidgetQt BoxWidget BoxWidget2 BozoShader BozoShaderDemo CallBack CallData CameraModifiedEvent CellLocatorVisualization CenterAnImage ClientData CloseWindow CommandSubclass CompassWidget DataAnimation DataAnimationSubclass Delaunay3DDemo DepthFirstSearchAnimation EllipticalButton EventQtSlotConnect FilterProgress FilterSelfProgress FireFlowDemo FrameRate FroggieView Hanoi HDRReader HoverWidget ImageClip ImageRegion ImageTracerWidget ImageTracerWidgetInsideContour ImplicitPlaneWidget2 InteractorStyleUser IsoContours KeypressObserver KochanekSplineDemo LayeredActors LineWidget2 LODProp3D MarbleShader MarbleShaderDemo MouseEventsObserver MovableAxes ObserveError ObserverMemberFunction OctreeVisualize ParametricKuenDemo ParametricObjectsDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel PickPixel2 PointLocatorVisualization PolygonalSurfacePointPlacer ProgressReport QuadraticHexahedronDemo QuadraticTetraDemo RotatingSphere RubberBand2DObserver SeedWidgetImage SeedWidgetWithCustomCallback SelectWindowRegion ShareCameraQt Slider Slider2D SpatterShader SphereWidget SphereWidget2 SphereWidgetEvents StreamlinesWithLineWidget Timer TransientHDFReader TransparentBackground Tutorial_Step2 Tutorial_Step6 VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter WindowModifiedEvent vtkCompassRepresentation CompassWidget vtkCompassWidget CompassWidget vtkCompositeDataDisplayAttributes CompositePolyDataMapper vtkCompositeDataGeometryFilter InterpolateFieldDataDemo MultiBlockDataSet OverlappingAMR ReadExodusData vtkCompositeDataSet ImportPolyDataScene vtkCompositeDataWriter Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse vtkCompositePolyDataMapper CompositePolyDataMapper vtkCompositePolyDataMapper2 CompositePolyDataMapper vtkComputeQuartiles BoxChart vtkCone ExtractPointsDemo IceCream MaskPointsFilter RandomProbe vtkConeSource AnimateActors Arbitrary3DCursor BoxWidget BoxWidget2 CallBack CameraBlur CameraModel1 CameraModel2 CarotidFlowGlyphs ClipDataSetWithPolyData ColoredAnnotatedCube ColorMapToLUT CombinePolyData Cone Cone3 Cone4 ConeDemo GeometricObjectsDemo GradientBackground HyperStreamline Mace Model MovableAxes MultipleRenderWindows MultipleViewports NamedColors OpenVRCone Outline PickableOff PointDataSubdivision ProgrammableGlyphFilter Reflection ReportRenderWindowCapabilities ResetCameraOrientation RotateActor ShadowsLightsDemo ShareCamera ShareCameraQt SingleSplat SourceObjectsDemo SpikeFran TableBasedClipDataSetWithPolyData TensorAxes TensorEllipsoids TrackballActor TrackballCamera TransformActor TransformActorCollection TransparentBackground Tutorial_Step1 Tutorial_Step2 Tutorial_Step3 Tutorial_Step4 Tutorial_Step5 Tutorial_Step6 vtkConnectivityFilter Blow ConnectivityFilter IdentifyHoles PineRootDecimation RemoveOutsideSurface vtkContext2D Diagram vtkContext3D PlotLine3D vtkContextActor ChartsOn3DScene Diagram MultiplePlots vtkContextItem Diagram vtkContextMouseEvent SurfacePlot vtkContextScene ChartsOn3DScene Diagram MultiplePlots PlotLine3D ReadLegacyUnstructuredGrid SurfacePlot vtkContextTransform ReadLegacyUnstructuredGrid vtkContextView AreaPlot BarChart BarChartQt BoxChart ChartMatrix FunctionalBagPlot Histogram2D KDTreeTimingDemo LinePlot ModifiedBSPTreeTimingDemo OBBTreeTimingDemo OctreeTimingDemo ParallelCoordinates PieChart PlotLine3D ReadLegacyUnstructuredGrid ScatterPlot StackedBar StackedPlot SurfacePlot vtkContourFilter BackgroundTexture BlobbyLogo Blow BooleanOperationImplicitFunctions CameraModel1 CameraModel2 CarotidFlow CarotidFlowGlyphs ColorIsosurface CombustorIsosurface ContourQuadric CutWithScalars DisplayQuadricSurfaces EmbedPointsIntoVolume ExternalContour FilledContours Finance FireFlow FireFlowDemo FlatVersusGouraud FlyingHeadSlice GaussianSplat GenericClip HeadSlice Hello IceCream ImplicitBoolean ImplicitBooleanDemo ImplicitModeller ImplicitQuadric ImplicitSphere ImplicitSphere1 IntermixedUnstructuredGrid IronIsoSurface IsoContours LabelContours Lorenz MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD Morph3D OverlappingAMR PerlinNoise ProbeCombustor PseudoVolumeRendering QuadraticSurface QuadricVisualization ReadSLC SampleFunction ShepardInterpolation ShepardMethod SingleSplat SplatFace SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc Vol vtkContourRepresentation PolygonalSurfacePointPlacer vtkContourTriangulator ContourTriangulator vtkContourValues RayCastIsosurface vtkContourWidget ContourWidget PolygonalSurfaceContourLineInterpolator PolygonalSurfacePointPlacer vtkConvexPointSet ConvexPointSet vtkCoordinate CenterAnImage ChooseTextColorDemo CompareExtractSurface Coordinate GradientBackground ImageRegion MarkKeypoints MultiLineText ReadAllPolyDataTypesDemo TexturedButtonWidget ViewportBorders vtkCornerAnnotation CornerAnnotation PickPixel PickPixel2 vtkCubeAxesActor CubeAxesActor DetermineActorType vtkCubeAxesActor2D CubeAxesActor2D vtkCubeSource Assembly CameraModel1 CameraModel2 ChartsOn3DScene CleanPolyData CloseWindow ColoredAnnotatedCube ColorGlyphs Cube1 CurvaturesAdjustEdges Cutter Follower Game GeometricObjectsDemo Glyph3D Glyph3DMapper ImplicitDataSetClipping LayeredActors Legend MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD Model MultipleRenderWindows MultipleViewports Opacity OpenVRCube OrientationMarkerWidget PBR_Clear_Coat PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointInsideObject ProgrammableGlyphFilter ScaleGlyphs SceneBounds SelectAnActor Shadows ShadowsLightsDemo ShareCamera ShareCameraQt ShrinkCube SideBySideRenderWindowsQt SideBySideViewports SourceObjectsDemo TensorGlyph TransformActorCollection TransparentBackground vtkCubicLine IsoparametricCellsDemo vtkCullerCollection LoopShrink vtkCursor2D Cursor2D vtkCursor3D Cursor3D vtkCurvatures CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo vtkCutter ContoursFromPolyData CutStructuredGrid Cutter CutWithCutFunction DataSetSurface ExtractPolyLinesFromPolyData FitSplineToCutterOutput PolyDataContourToImageData PseudoVolumeRendering vtkCylinder ClipSphereCylinder ExtractPointsDemo IsosurfaceSampling vtkCylinderSource Cylinder CylinderExample FlatVersusGouraud GeometricObjectsDemo Hanoi HanoiInitial HanoiIntermediate MultipleRenderWindows MultipleViewports OpenVRCylinder OpenVROrientedCylinder OrientedCylinder RescaleReverseLUT ShareCamera SourceObjectsDemo TransformPipeline vtkDataArray ConnectedComponents EnhanceEdges ForLoop Game HybridMedianComparison ImageCorrelation InterpolateTerrain LabelContours MedianComparison MorphologyComparison PickPixel PointInsideObject PolyDataExtractNormals vtkDataObject CellsInsideObject CompareRandomGeneratorsCxx DistanceToCamera ExtractVisibleCells GenerateCubesFromLabels GenerateModelsFromLabels HighlightBadCells HistogramBarChart ImageAccumulateGreyscale ImportPolyDataScene IntersectLine OfficeTube PieChartActor SpiderPlot ThinPlateSplineTransform ThresholdCells ThresholdPoints VoxelsOnBoundary vtkImageAlgorithmFilter vtkTest vtkTest1 vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader Warnings WarpSurface vtkDataObjectReader FinanceFieldData vtkDataObjectToDataSetFilter FinanceFieldData vtkDataObjectTree ImportPolyDataScene vtkDataObjectTreeIterator ImportPolyDataScene vtkDataSet DumpXMLFile Finance HighlightBadCells ImplicitDataSetClipping MergeSelections MultiBlockDataSet ProcrustesAlignmentFilter SaveSceneToFieldData SelectionSource vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkDataSetAttributes AdjacentVertexIterator BoostBreadthFirstSearchTree BreadthFirstDistance ColorEdges ColorVertexLabels ColorVerticesLookupTable ConnectedComponents CreateTree DepthFirstSearchAnimation DepthFirstSearchIterator EdgeWeights GenerateCubesFromLabels GenerateModelsFromLabels GradientFilter HighlightBadCells LabelVerticesAndEdges MinimumSpanningTree ScaleVertices SideBySideGraphs VertexSize WarpSurface vtkDataSetCollection KdTree KDTreeAccessPoints vtkDataSetMapper AlignTwoPolyDatas AppendFilter BlankPoint Blow BoxClipStructuredPoints BoxClipUnstructuredGrid CameraModel1 CameraModel2 CapClip Cell3DDemonstration CellCenters CellEdgeNeighbors CellPicking CellPointNeighbors CellsInsideObject CellTypeSource ClipClosedSurface ClipDataSetWithPolyData ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ClipVolume Colored2DImageFusion ColoredSphere ConnectivityFilter ConnectivityFilterDemo ContourTriangulator ConvexHull ConvexHullShrinkWrap ConvexPointSet CreateESGrid CurvedReformation CutStructuredGrid DataSetSurface Delaunay3D Delaunay3DDemo DisplacementPlot ExponentialCosine ExtractCellsUsingPoints ExtractData ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId ExtractVisibleCells GenericClip Hawaii Hexahedron HighlightBadCells HighlightSelectedPoints HighlightSelection HyperTreeGridSource IdentifyHoles ImageContinuousDilate3D ImageContinuousErode3D ImageToStructuredPoints ImageWarp InterpolateFieldDataDemo InterpolateMeshOnGrid IntersectLine IsoparametricCellsDemo LinearCellDemo LinearExtrusion LoadESGrid LoopShrink MarchingSquares MergeSelections MinimalQtVTKApp ModifiedBSPTreeExtractCells Motor OBBTreeExtractCells OpenVRTessellatedBoxSource OrientationMarkerWidget1 PineRootConnectivity PineRootDecimation PlateVibration PointDataSubdivision PointOccupancy Polyhedron ProcrustesAlignmentFilter Pyramid QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo QuadricVisualization RandomProbe ReadAllUnstructuredGridTypes ReadImageData ReadLegacyUnstructuredGrid ReadRectilinearGrid ReadUnknownTypeXMLFile ReadUnstructuredGrid RectilinearGrid Reflection ScalarBarWidget ShrinkCube SplitPolyData StructuredDataTypes StructuredGrid TableBasedClipDataSetWithPolyData TableBasedClipDataSetWithPolyData2 TessellatedBoxSource Tetrahedron TextureCutQuadric TextureCutSphere TextureThreshold TissueLens TransformSphere TriangleStrip UGrid VertexConnectivity VisualizeImageData VisualizeRectilinearGrid VisualizeStructuredGridCells VoxelsOnBoundary WarpTo Wireframe WriteVTU vtkDataSetReader Blow DumpXMLFile RenderScalarToFloatBuffer vtkDataSetSurfaceFilter DataSetSurface DataSetSurfaceFilter FillHoles FindCellIntersections HighlightSelectedPoints HighlightSelection MatrixMathFilter RenderScalarToFloatBuffer vtkDataSetTriangleFilter IntermixedUnstructuredGrid vtkDataSetWriter ImplicitDataSetClipping vtkDecimatePolylineFilter DecimatePolyline vtkDecimatePro ClipArt DecimateFran DecimateHawaii Decimation FroggieSurface PineRootDecimation StripFran vtkDeformPointSet DeformPointSet vtkDelaunay2D ColoredElevationMap ConstrainedDelaunay2D CurvatureBandsWithGlyphs CurvaturesAdjustEdges Delaunay2D DelaunayMesh ElevationBandsWithGlyphs ElevationFilter InterpolateMeshOnGrid InterpolateTerrain SimpleElevationFilter SmoothPolyDataFilter TriangulateTerrainMap vtkDelaunay3D ConnectivityFilter Delaunay3D Delaunay3DDemo PointInsideObject2 XMLPUnstructuredGridWriter vtkDelimitedTextReader DelimitedTextReader ParallelCoordinatesView PointInterpolator vtkDelimitedTextWriter DelimitedTextWriter vtkDemandDrivenPipeline vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkDEMReader DEMReader FitToHeightMap vtkDenseArray 2DArray 3DArray AdjacencyMatrixToEdgeTable ArrayToTable ArrayWriter CustomDenseArray DenseArrayRange vtkDensifyPointCloudFilter DensifyPoints vtkDepthSortPolyData CorrectlyRenderTranslucentGeometry DepthSortPolyData vtkDICOMImageReader FixedPointVolumeRayCastMapperCT MarchingCubes ReadDICOM ReadDICOMSeries vtkDijkstraGraphGeodesicPath DijkstraGraphGeodesicPath ShortestPath vtkDirectedGraph DirectedGraphToMutableDirectedGraph MutableDirectedGraphToDirectedGraph vtkDirectory FilenameFunctions vtkDiscreteFlyingEdges3D DiscreteMarchingCubes GenerateModelsFromLabels vtkDiscreteMarchingCubes DiscreteMarchingCubes GenerateModelsFromLabels SmoothDiscreteMarchingCubes vtkDiscretizableColorTransferFunction ColorMapToLUT DiscretizableColorTransferFunction RescaleReverseLUT TransientHDFReader vtkDiskSource BoundaryEdges Disk ExtrudePolyDataAlongLine GeometricObjectsDemo SourceObjectsDemo vtkDistancePolyDataFilter DistancePolyDataFilter vtkDistanceRepresentation DistanceWidget vtkDistanceToCamera DistanceToCamera vtkDistanceWidget DistanceWidget vtkDoubleArray ArrayCalculator AttachAttributes BoostBreadthFirstSearchTree BreadthFirstDistance Casting ClipVolume CopyAllArrays CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo CutWithScalars DelimitedTextReader DepthFirstSearchIterator EdgeWeights ElevationBandsWithGlyphs ExponentialCosine ExportPolyDataScene ExtractArrayComponent FieldData FunctionalBagPlot Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse GetMiscPointData Gradient HighlightBadCells ImageValueRange InterpolateTerrain KDTreeFindPointsWithinRadiusDemo KMeansClustering LabelContours LabelVerticesAndEdges MeshQuality MinimalQtVTKApp MinimumSpanningTree MiscCellData OctreeFindPointsWithinRadiusDemo ParallelCoordinatesView PCADemo PCAStatistics PKMeansClustering PointLocatorFindPointsWithinRadiusDemo PolyDataCellNormals PolyDataExtractNormals PolyDataPointNormals RectilinearGrid RectilinearGridToTetrahedra RGrid SGrid SingleSplat SortDataArray StackedBar StackedPlot StaticLocatorFindPointsWithinRadiusDemo StippledLine StructuredDataTypes StructuredGrid TableBasedClipDataSetWithPolyData2 TensorGlyph TextureCutSphere TubesFromSplines TubesWithVaryingRadiusAndColors VisualizeRectilinearGrid Vol WarpScalar WarpVector vtkEarthSource EarthSource vtkEdgeListIterator EdgeListIterator vtkEdgePoints EdgePoints vtkElevationFilter ColoredAnnotatedCube ColoredSphere ColorMapToLUT CurvatureBandsWithGlyphs DeformPointSet ElevationBandsWithGlyphs ElevationFilter Hawaii LoopShrink NamedColors PointDataSubdivision ProjectSphere RescaleReverseLUT SideBySideRenderWindowsQt TransformSphere vtkEllipticalButtonSource EllipticalButton vtkEuclideanClusterExtraction ExtractClusters vtkEventQtSlotConnect EventQtSlotConnect vtkExecutive ClipVolume TableBasedClipDataSetWithPolyData2 vtkExodusIIReader InterpolateFieldDataDemo ReadExodusData vtkExodusIIWriter ExodusIIWriter vtkExplicitStructuredGrid CreateESGrid LoadESGrid vtkExplicitStructuredGridToUnstructuredGrid CreateESGrid vtkExtractCells ModifiedBSPTreeExtractCells OBBTreeExtractCells vtkExtractEdges DelaunayMesh ExtractEdges GradientFilter MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MultiBlockDataSet ReadLegacyUnstructuredGrid VertexConnectivity vtkExtractEnclosedPoints ExtractEnclosedPoints OrientedBoundingCylinder vtkExtractGeometry ExtractData HighlightSelectedPoints vtkExtractGrid PseudoVolumeRendering vtkExtractPoints ExtractPointsDemo vtkExtractPolyDataGeometry HighlightSelection vtkExtractSelection CellEdgeNeighbors CellPicking CellPointNeighbors ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId ExtractVisibleCells FillHoles MergeSelections SelectionSource VertexConnectivity vtkExtractSurface CompareExtractSurface ExtractSurface ExtractSurfaceDemo vtkExtractVOI ExtractVOI FlyingHeadSlice HeadSlice QuadricVisualization ReadSLC vtkFastSplatter FastSplatter vtkFeatureEdges BoundaryEdges CapClip ClosedSurface CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo ExtrudePolyDataAlongLine vtkFFMPEGWriter FFMPEG vtkFieldData AlignTwoPolyDatas CompareRandomGeneratorsCxx DumpXMLFile ExportPolyDataScene HistogramBarChart ImageAccumulateGreyscale ImportPolyDataScene PieChartActor SaveSceneToFieldData SpiderPlot vtkFieldDataToAttributeDataFilter FinanceFieldData Gradient vtkFileOutputWindow FileOutputWindow vtkFillHolesFilter FillHoles IdentifyHoles MassProperties vtkFitImplicitFunction FitImplicitFunction vtkFitToHeightMapFilter FitToHeightMap vtkFixedPointVolumeRayCastMapper FixedPointVolumeRayCastMapperCT MedicalDemo4 MinIntensityRendering SimpleRayCast vtkFloatArray AreaPlot ArrayLookup ArrayRange BackgroundTexture BandedPolyDataContourFilter CardinalSpline ChartMatrix ChartsOn3DScene ClipDataSetWithPolyData ColorCells CopyAllArrays CreateColorSeriesDemo Cube CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs ElevationFilter FilledContours Finance GetMiscCellData Glyph3DMapper HedgeHog ImageSeparableConvolution ImplicitPolyDataDistance InterpolateMeshOnGrid KDTreeTimingDemo KnownLengthArray LinePlot MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MiscPointData ModifiedBSPTreeTimingDemo Motor MultiplePlots NullPoint OBBTreeTimingDemo OctreeTimingDemo OverlappingAMR ParallelCoordinates ParallelCoordinatesView PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PieChartActor PlotLine3D PolyDataExtractNormals RenderScalarToFloatBuffer ReverseSense ScalarBarActor ScalarBarActorColorSeries ScaleGlyphs ScaleVertices ScatterPlot ShepardMethod SimpleElevationFilter SpiderPlot SurfacePlot TableBasedClipDataSetWithPolyData TextureMapQuad UnknownLengthArray VectorArrayKnownLength VectorArrayUnknownLength VectorDot VectorNorm WeightedTransformFilter vtkFloatingPointExceptions FloatingPointExceptions vtkFlyingEdges2D FlyingHeadSlice vtkFlyingEdges3D ExtractLargestIsosurface FrogBrain FroggieSurface HeadBone IsosurfaceSampling MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 TissueLens vtkFollower FinanceFieldData Follower MovableAxes Stocks TextOrigin vtkForceDirectedLayoutStrategy ConstructGraph EdgeWeights RandomGraphSource ScaleVertices SideBySideGraphs vtkFreeTypeTools ImageText StringToImageDemo WordCloud vtkFrustumSource ClipFrustum Frustum OpenVRFrustum ProjectedTexture vtkFunctionParser FunctionParser vtkGaussianKernel InterpolateFieldDataDemo PointInterpolator vtkGaussianSplatter EmbedPointsIntoVolume Finance FinanceFieldData GaussianSplat SingleSplat SplatFace vtkGenericCell CellTreeLocator ExtractFaces IdentifyHoles QuadraticHexahedronDemo QuadraticTetraDemo ReadLegacyUnstructuredGrid RemoveOutsideSurface vtkGenericClip GenericClip vtkGenericDataArray AdjacentVertexIterator BackgroundTexture ColoredElevationMap ColoredLines ColoredPoints ColorGlyphs ElevationFilter IterativeClosestPointsTransform LandmarkTransform ShepardMethod SimpleElevationFilter TriangleColoredPoints TriangleSolidColor VectorDot VectorNorm vtkGenericDataObjectReader GenericDataObjectReader vtkGenericOpenGLRenderWindow BarChartQt BorderWidgetQt EventQtSlotConnect MinimalQtVTKApp RenderWindowNoUiFile RenderWindowUISingleInheritance ShareCameraQt SideBySideRenderWindowsQt vtkGenericOutlineFilter FireFlow FireFlowDemo vtkGeometryFilter Blow CannyEdgeDetector GenerateCubesFromLabels GenerateModelsFromLabels GeometryFilter SplitPolyData vtkGLTFExporter GLTFExporter ImportToExport vtkGLTFImporter CombineImportedActors GLTFImporter ImportToExport vtkGlyph2D Glyph2D VectorField vtkGlyph3D AnimateVectors Arbitrary3DCursor BrownianPoints CameraBlur CarotidFlowGlyphs ColorGlyphs ConvexHullShrinkWrap CurvatureBandsWithGlyphs DelaunayMesh DistanceToCamera ElevationBandsWithGlyphs ExtractClusters ExtractSurfaceDemo FitImplicitFunction Glyph3D Gradient GradientFilter Mace MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MaskPointsFilter MoveAGlyph MoveAVertexUnstructuredGrid NormalEstimation OrientedGlyphs ParametricObjectsDemo PointDataSubdivision PolyDataPointSampler QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo RadiusOutlierRemoval RandomProbe ReadPDB ResamplePolyLine ScaleGlyphs SpikeFran VisualizeDirectedGraph vtkGlyph3DMapper AppendFilter CellCentersDemo ConvexPointSet DensifyPoints DotProduct ExtractEnclosedPoints ExtractPointsDemo Glyph3DImage Glyph3DMapper ImageSobel2D IsoparametricCellsDemo IterativeClosestPointsTransform KochanekSpline KochanekSplineDemo LabeledDataMapper LabelPlacementMapper LandmarkTransform LinearCellDemo ParametricSpline PCADemo PointsProjectedHull QuantizePolyDataPoints ReadLegacyUnstructuredGrid VisualizeStructuredGrid vtkGlyphSource2D VisualizeDirectedGraph vtkGradientFilter GradientFilter vtkGraph ConnectedComponents GraphAlgorithmFilter GraphAlgorithmSource vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkGraphAlgorithm vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkGraphicsFactory OffScreenRendering vtkGraphLayout VisualizeDirectedGraph vtkGraphLayoutStrategy XGMLReader vtkGraphLayoutView AdjacentVertexIterator BoostBreadthFirstSearchTree ColorEdges ColorVertexLabels ColorVerticesLookupTable ConstructGraph ConstructTree CreateTree DepthFirstSearchAnimation EdgeWeights GraphPoints LabelVerticesAndEdges MutableGraphHelper RandomGraphSource ScaleVertices SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver ShortestPath SideBySideGraphs VertexSize VisualizeDirectedGraph VisualizeGraph XGMLReader vtkGraphToGlyphs ScaleVertices VertexSize vtkGraphToPolyData GraphToPolyData ShortestPath SideBySideGraphs VisualizeDirectedGraph vtkGreedyTerrainDecimation GreedyTerrainDecimation vtkHardwareSelector ExtractVisibleCells vtkHausdorffDistancePointSetFilter AlignTwoPolyDatas vtkHDFReader TransientHDFReader vtkHDRReader HDRReader PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkHedgeHog ComplexV HedgeHog SGrid vtkHexagonalPrism Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkHexahedron Cell3DDemonstration DataSetSurface Hexahedron LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkHoverWidget HoverWidget vtkHull ConvexHull Planes vtkHyperStreamline HyperStreamline vtkHyperTreeGridSource HyperTreeGridSource vtkHyperTreeGridToUnstructuredGrid HyperTreeGridSource vtkIdFilter CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo GenericClip HighlightSelectedPoints HighlightSelection ImplicitDataSetClipping LabeledMesh PointCellIds vtkIdList ArrayLookup BuildLocatorFromKClosestPoints Cell3DDemonstration CellEdgeNeighbors CellEdges CellPointNeighbors ClosestNPoints CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo ExtractPolyLinesFromPolyData FindCellIntersections FitSplineToCutterOutput IntersectLine IterateOverLines KDTreeFindPointsWithinRadius KDTreeFindPointsWithinRadiusDemo LabelContours MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD ModifiedBSPTreeExtractCells OBBTreeExtractCells OctreeFindPointsWithinRadius OctreeFindPointsWithinRadiusDemo OctreeKClosestPoints PointLocatorFindPointsWithinRadiusDemo PointLocatorRadius Polyhedron StaticLocatorFindPointsWithinRadiusDemo StructuredGrid VertexConnectivity vtkIdTypeArray CellEdgeNeighbors CellPicking CellPointNeighbors ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId FillHoles GenericClip HighlightSelectedPoints ImplicitDataSetClipping MergeSelections MoveAGlyph PointCellIds RemoveOutsideSurface SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver VertexConnectivity vtkImageAccumulate GenerateModelsFromLabels HistogramBarChart ImageAccumulate ImageAccumulateGreyscale ImageTracerWidgetInsideContour vtkImageActor Attenuation BackgroundImage CannyEdgeDetector CaptionActor2D Cast CenterAnImage CheckerboardWidget CombiningRGBChannels DEMReader DotProduct EnhanceEdges ExtractComponents ExtractVOI Flip GaussianSmooth Gradient HybridMedianComparison IdealHighPass ImageAnisotropicDiffusion2D ImageCityBlockDistance ImageClip ImageConvolve ImageCorrelation ImageDifference ImageDilateErode3D ImageDivergence ImageEllipsoidSource ImageFFT ImageGaussianSmooth ImageGradientMagnitude ImageGridSource ImageHybridMedian2D ImageImport ImageIslandRemoval2D ImageIteratorDemo ImageLaplacian ImageLuminance ImageMagnify ImageMagnitude ImageMandelbrotSource ImageMapToColors ImageMask ImageMathematics ImageMedian3D ImageMirrorPad ImageNoiseSource ImageNonMaximumSuppression ImageNormalize ImageOpenClose3D ImageOrder ImageOrientation ImagePermute ImageRange3D ImageReader2Factory ImageRegion ImageRFFT ImageSeparableConvolution ImageShrink3D ImageSobel2D ImageStencil ImageText ImageThreshold ImageTracerWidget ImageTracerWidgetInsideContour ImageTransparency ImageVariance3D ImageWeightedSum InteractWithImage MarkKeypoints MedianComparison MedicalDemo3 MetaImageReader MetaImageWriter MorphologyComparison Pad PickPixel PickPixel2 RectilinearWipeWidget RenderScalarToFloatBuffer ResizeImage ResizeImageDemo RGBToHSI RGBToHSV RGBToYIQ RTAnalyticSource SeedWidgetImage SelectWindowRegion SignedDistance TransformOrderDemo Transparency UnsignedDistance VTKSpectrum WriteBMP WritePNM WriteTIFF vtkImageAlgorithm vtkImageAlgorithmFilter vtkImageAnisotropicDiffusion2D ImageAnisotropicDiffusion2D vtkImageAppendComponents CombiningRGBChannels WordCloud vtkImageBlend Colored2DImageFusion CombineImages DrawOnAnImage ImageText StringToImageDemo ThinPlateSplineTransform WordCloud vtkImageButterworthHighPass IdealHighPass vtkImageCanvasSource2D BackgroundImage CaptionActor2D CombiningRGBChannels DrawOnAnImage DrawShapes FFMPEG Gradient ImageContinuousDilate3D ImageContinuousErode3D ImageCorrelation ImageDataGeometryFilter ImageDifference ImageIslandRemoval2D ImageLuminance ImageMagnitude ImageMask ImageMathematics ImageMedian3D ImageMirrorPad ImageSobel2D ImageText ImageToStructuredPoints ImageTracerWidget ImageTracerWidgetInsideContour JPEGWriter LogoWidget MarkKeypoints MPEG2 OggTheora PNGWriter ResizeImage ResizeImageDemo SeedWidgetImage StringToImageDemo TextureMapImageData WordCloud WriteBMP WritePNM WriteTIFF XMLPImageDataWriter vtkImageCast Attenuation CannyEdgeDetector Cast DotProduct EnhanceEdges ExtractVOI FillWindow Flip GaussianSmooth HybridMedianComparison ImageCityBlockDistance ImageConvolve ImageCorrelation ImageDivergence ImageEllipsoidSource ImageFFT ImageGradient ImageGradientMagnitude ImageGridSource ImageIdealHighPass ImageIslandRemoval2D ImageLaplacian ImageMandelbrotSource ImageNoiseSource ImageNonMaximumSuppression ImageNormalize ImageRange3D ImageRFFT ImageSeparableConvolution ImageVariance3D ImageWeightedSum MedianComparison MetaImageWriter PickPixel2 PNGWriter TransformOrderDemo vtkImageChangeInformation CenterAnImage ImageMagnify vtkImageCheckerboard CheckerboardWidget ImageCheckerboard vtkImageCityBlockDistance ImageCityBlockDistance vtkImageClip ImageClip MinIntensityRendering vtkImageConstantPad CannyEdgeDetector FrogSlice ImageGradient Pad vtkImageContinuousDilate3D ImageContinuousDilate3D vtkImageContinuousErode3D ImageContinuousErode3D vtkImageConvolve ImageConvolve vtkImageCorrelation ImageCorrelation vtkImageData BackgroundImage BorderPixelSize BoxClipStructuredPoints Cast CellCenters CellIdFromGridCoordinates CenterAnImage ClipVolume CombineImages CurvedReformation DEMReader DiscreteMarchingCubes DotProduct DrawOnAnImage DumpXMLFile EllipticalButton EnhanceEdges ExtractVOI FastSplatter FillWindow Finance FinanceFieldData FitToHeightMap FixedPointVolumeRayCastMapperCT GaussianSmooth GenerateCubesFromLabels GenerateModelsFromLabels GetCellCenter Gradient GreedyTerrainDecimation HDRReader Histogram2D HistogramBarChart HybridMedianComparison HyperStreamline ImageAccumulate ImageAccumulateGreyscale ImageAlgorithmFilter ImageClip ImageContinuousDilate3D ImageContinuousErode3D ImageCorrelation ImageDataGeometryFilter ImageDataToPointSet ImageDataToQImage ImageDifference ImageExport ImageHistogram ImageIdealHighPass ImageImport ImageIslandRemoval2D ImageIterator ImageIteratorDemo ImageMapper ImageMapToColors ImageOrder ImageReslice ImageRotate ImageShiftScale ImageSlice ImageSliceMapper ImageSobel2D ImageStack ImageStencil ImageText ImageTracerWidgetInsideContour ImageTranslateExtent ImageTransparency ImageValueRange ImplicitDataSet InterpolateTerrain Interpolation IntersectLine IsoContours IterateImageData MarchingCubes MaskPointsFilter MedianComparison MorphologyComparison NegativeIndices ObserveError OpenVRVolume PickPixel PickPixel2 PolyDataContourToImageData PolyDataToImageData ProjectedTexture RenderScalarToFloatBuffer RescaleAnImage ResizeImage ResizeImageDemo ShepardInterpolation SignedDistance SmoothDiscreteMarchingCubes StippledLine StringToImageDemo StructuredDataTypes TableBasedClipDataSetWithPolyData2 TexturedButtonWidget TextureMapPlane TextureMapQuad Transparency UnsignedDistance VectorField VectorFieldNonZeroExtraction VisualizeImageData vtkImageAlgorithmFilter VTKSpectrum Wireframe WordCloud WriteVTI vtkImageDataGeometryFilter ClipArt CreateBFont FitToHeightMap HyperStreamline ImageDataGeometryFilter ImageWarp StructuredPointsReader TensorAxes TensorEllipsoids WriteVTI vtkImageDataToPointSet ImageDataToPointSet VoxelsOnBoundary vtkImageDifference ImageDifference vtkImageDilateErode3D ImageDilateErode3D MorphologyComparison vtkImageDivergence ImageDivergence vtkImageDotProduct DotProduct vtkImageEllipsoidSource ImageEllipsoidSource ImageFFT ImageGaussianSmooth ImageGradientMagnitude ImageIdealHighPass ImageIslandRemoval2D ImageOrientation ImagePermute ImageRFFT ImageShrink3D ImageVariance3D vtkImageEuclideanToPolar ImageGradient vtkImageExport ImageExport vtkImageExtractComponents ClipArt ExtractComponents Gradient HistogramBarChart IdealHighPass ImageGradient ImageIdealHighPass ImageRFFT ImageSobel2D RGBToHSI RGBToHSV RGBToYIQ WordCloud vtkImageFFT IdealHighPass ImageFFT ImageIdealHighPass ImageRFFT VTKSpectrum vtkImageFlip CubeMap Flip PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkImageFourierCenter VTKSpectrum vtkImageGaussianSmooth Attenuation CannyEdgeDetector ClipArt CreateBFont FrogBrain FroggieSurface GaussianSmooth ImageGaussianSmooth ImageGradient IsoSubsample MedianComparison vtkImageGradient CannyEdgeDetector Gradient ImageDivergence ImageGradient ImageNonMaximumSuppression vtkImageGradientMagnitude ImageGradientMagnitude ImageNonMaximumSuppression vtkImageGridSource ImageGridSource ThinPlateSplineTransform vtkImageHistogram ImageHistogram vtkImageHSVToRGB ImageGradient vtkImageHybridMedian2D HybridMedianComparison ImageHybridMedian2D vtkImageIdealHighPass IdealHighPass ImageIdealHighPass vtkImageImport ImageImport vtkImageIslandRemoval2D FroggieSurface ImageIslandRemoval2D vtkImageIterator ImageIterator ImageIteratorDemo StringToImageDemo WordCloud vtkImageLaplacian EnhanceEdges ImageLaplacian vtkImageLogarithmicScale VTKSpectrum vtkImageLuminance CannyEdgeDetector ImageLuminance ImageWarp vtkImageMagnify ImageGradient ImageMagnify vtkImageMagnitude CannyEdgeDetector ImageAccumulateGreyscale ImageMagnitude VectorFieldNonZeroExtraction VTKSpectrum vtkImageMandelbrotSource Cast ExtractVOI FillWindow Flip ImageConvolve ImageDivergence ImageIdealHighPass ImageLaplacian ImageMandelbrotSource ImageThreshold ImageWeightedSum MetaImageWriter TransformOrderDemo vtkImageMapper ImageMapper ImageSlice ImageSliceMapper ThinPlateSplineTransform vtkImageMapper3D Attenuation CaptionActor2D Cast CenterAnImage CheckerboardWidget CombiningRGBChannels DEMReader DotProduct EnhanceEdges ExtractComponents ExtractVOI FillWindow Flip GaussianSmooth Gradient HybridMedianComparison IdealHighPass ImageAnisotropicDiffusion2D ImageCityBlockDistance ImageClip ImageConvolve ImageCorrelation ImageDifference ImageDilateErode3D ImageDivergence ImageEllipsoidSource ImageFFT ImageGaussianSmooth ImageGradientMagnitude ImageGridSource ImageHybridMedian2D ImageIslandRemoval2D ImageLaplacian ImageLuminance ImageMagnify ImageMagnitude ImageMandelbrotSource ImageMapToColors ImageMask ImageMathematics ImageMedian3D ImageMirrorPad ImageNoiseSource ImageNonMaximumSuppression ImageNormalize ImageOpenClose3D ImageOrientation ImagePermute ImageRange3D ImageReader2Factory ImageRegion ImageRFFT ImageSeparableConvolution ImageShrink3D ImageSobel2D ImageStencil ImageText ImageThreshold ImageTracerWidget ImageTracerWidgetInsideContour ImageTransparency ImageVariance3D ImageWeightedSum InteractWithImage MarkKeypoints MedianComparison MedicalDemo3 MetaImageReader MetaImageWriter MorphologyComparison Pad RectilinearWipeWidget ResizeImage ResizeImageDemo RGBToHSI RGBToHSV RGBToYIQ RTAnalyticSource SelectWindowRegion SignedDistance TransformOrderDemo Transparency UnsignedDistance VTKSpectrum WriteBMP WritePNM WriteTIFF vtkImageMapToColors ClipVolume Colored2DImageFusion DEMReader ImageMapToColors MedicalDemo3 RenderScalarToFloatBuffer SignedDistance TableBasedClipDataSetWithPolyData2 ThinPlateSplineTransform Transparency UnsignedDistance VTKSpectrum vtkImageMapToWindowLevelColors EnhanceEdges IdealHighPass Pad vtkImageMarchingCubes IsoSubsample vtkImageMask ImageMask vtkImageMathematics Attenuation DiscreteMarchingCubes DotProduct EnhanceEdges Gradient HybridMedianComparison ImageMathematics ImageSobel2D MedianComparison SmoothDiscreteMarchingCubes vtkImageMedian3D HybridMedianComparison ImageMedian3D MedianComparison vtkImageMirrorPad ImageMirrorPad Pad vtkImageNoiseSource HybridMedianComparison ImageNoiseSource MedianComparison PickPixel2 vtkImageNonMaximumSuppression CannyEdgeDetector ImageNonMaximumSuppression vtkImageNormalize ImageNormalize vtkImageOpenClose3D ImageOpenClose3D vtkImagePermute ImageOrientation ImagePermute vtkImagePlaneWidget ImagePlaneWidget vtkImageProperty Attenuation BorderPixelSize EnhanceEdges HybridMedianComparison IdealHighPass ImageHistogram ImageMapToColors ImageShiftScale ImageStack Interpolation MedianComparison MorphologyComparison Pad VTKSpectrum vtkImageQuantizeRGBToIndex ImageToPolyDataFilter vtkImageRange3D ImageRange3D vtkImageReader TexturedSphere vtkImageReader2 Attenuation BackgroundImage CenterAnImage Colored2DImageFusion CombineImages CurvedReformation DrawOnAnImage EllipticalButton EnhanceEdges ExtractComponents GaussianSmooth Glyph3DImage Gradient HistogramBarChart HybridMedianComparison IdealHighPass ImageAccumulateGreyscale ImageAnisotropicDiffusion2D ImageCheckerboard ImageCityBlockDistance ImageHistogram ImageRange3D ImageReader2Factory ImageRotate InteractWithImage IsoSubsample MedianComparison MorphologyComparison Pad PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel ProjectedTexture RectilinearWipeWidget ResizeImage ResizeImageDemo RGBToHSI RGBToHSV RGBToYIQ StaticImage TexturedSphere TexturePlane Transparency VTKSpectrum WordCloud vtkImageReader2Factory Attenuation BackgroundImage CenterAnImage Colored2DImageFusion CombineImages CurvedReformation DrawOnAnImage EllipticalButton EnhanceEdges ExtractComponents GaussianSmooth Glyph3DImage Gradient HistogramBarChart HybridMedianComparison IdealHighPass ImageAccumulateGreyscale ImageAnisotropicDiffusion2D ImageCheckerboard ImageCityBlockDistance ImageHistogram ImageRange3D ImageReader2Factory ImageRotate InteractWithImage IsoSubsample MedianComparison MorphologyComparison Pad PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel ProjectedTexture RectilinearWipeWidget ResizeImage ResizeImageDemo RGBToHSI RGBToHSV RGBToYIQ StaticImage TexturedSphere TexturePlane Transparency VTKSpectrum WordCloud vtkImageRectilinearWipe RectilinearWipeWidget vtkImageResample FixedPointVolumeRayCastMapperCT vtkImageResize ResizeImage ResizeImageDemo WordCloud vtkImageReslice ImageReslice ImageRotate ThinPlateSplineTransform vtkImageResliceMapper ImageSlice Interpolation vtkImageRFFT IdealHighPass ImageIdealHighPass ImageRFFT vtkImageRGBToHSI RGBToHSI vtkImageRGBToHSV ClipArt Gradient RGBToHSV vtkImageRGBToYIQ RGBToYIQ vtkImageSeedConnectivity ClipArt MorphologyComparison vtkImageSeparableConvolution ImageSeparableConvolution vtkImageShiftScale Attenuation FastSplatter Gradient ImageCorrelation ImageIdealHighPass ImageShiftScale ImageSobel2D RescaleAnImage ZBuffer vtkImageShrink3D ClipArt FroggieSurface ImageShrink3D IsoSubsample VoxelsOnBoundary vtkImageSincInterpolator ResizeImage ResizeImageDemo vtkImageSinusoidSource ImageNonMaximumSuppression ImageNormalize ImageSinusoidSource ImageWeightedSum vtkImageSlice BorderPixelSize FillWindow ImageHistogram ImageIdealHighPass ImageShiftScale ImageSlice ImageSliceMapper ImageStack ImageTranslateExtent Interpolation VectorField vtkImageSliceMapper BorderPixelSize FillWindow ImageHistogram ImageIdealHighPass ImageShiftScale ImageSliceMapper ImageStack ImageTranslateExtent RenderScalarToFloatBuffer VectorField vtkImageSobel2D ImageSobel2D vtkImageStack ImageStack vtkImageStencil ImageStencil PolyDataContourToImageData PolyDataToImageData vtkImageStencilToImage ImageTracerWidgetInsideContour vtkImageThreshold ClipArt DiscreteMarchingCubes FrogBrain FroggieSurface HybridMedianComparison ImageThreshold MaskPointsFilter MedianComparison SmoothDiscreteMarchingCubes vtkImageToImageStencil ImageStencil vtkImageToPolyDataFilter ImageToPolyDataFilter vtkImageToStructuredPoints CannyEdgeDetector ImageToStructuredPoints vtkImageTracerWidget ImageTracerWidget ImageTracerWidgetInsideContour ImageTracerWidgetNonPlanar vtkImageTranslateExtent ImageTranslateExtent vtkImageVariance3D ImageVariance3D vtkImageViewer HDRReader ImageGradient vtkImageViewer2 CombineImages DrawOnAnImage DrawShapes FastSplatter ImageCheckerboard ImageIteratorDemo ImageRotate ImageSinusoidSource JPEGReader PickPixel PickPixel2 PNGReader ReadBMP ReadDICOM ReadDICOMSeries ReadPNM ReadTIFF StaticImage StringToImageDemo WordCloud WordCloudDemo vtkImageWeightedSum ImageWeightedSum vtkImageWrapPad GenerateCubesFromLabels vtkImageWriter ImageWriter PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkImplicitBoolean BooleanOperationImplicitFunctions ClipSphereCylinder ExtractData IceCream ImplicitBoolean ImplicitBooleanDemo vtkImplicitDataSet ImplicitDataSet vtkImplicitFunction ExtractPointsDemo vtkImplicitModeller BlobbyLogo CameraModel1 CameraModel2 Hello ImplicitModeller Morph3D vtkImplicitPlaneRepresentation ImplicitPlaneWidget2 vtkImplicitPlaneWidget2 ImplicitPlaneWidget2 vtkImplicitPolyDataDistance ClipDataSetWithPolyData ImplicitPolyDataDistance TableBasedClipDataSetWithPolyData vtkImplicitSelectionLoop ImplicitSelectionLoop vtkImplicitTextureCoords Motor TextureCutQuadric TextureCutSphere vtkIncrementalOctreePointLocator IncrementalOctreePointLocator vtkIndent vtkTest vtkTest1 vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestGraphAlgorithmSource vtkTestPolyDataFilter vtkTestReader vtkInEdgeIterator InEdgeIterator vtkInformation AttachAttributes CallData ClipArt ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells FillHoles ImageClip vtkImageAlgorithmFilter vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader vtkInformationDoubleVectorKey AttachAttributes vtkInformationVector CallData vtkImageAlgorithmFilter vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader vtkIntArray ArrayRange BarChart BarChartQt BoostBreadthFirstSearchTree BoxChart BreadthFirstDistance Casting CellTypeSource ColorEdges ColorVertexLabels ColorVerticesLookupTable CompareRandomGeneratorsCxx ConnectedComponents CopyAllArrays DepthFirstSearchAnimation ExportPolyDataScene FieldData HistogramBarChart ImageAccumulateGreyscale IntersectLine IterateImageData KMeansClustering KochSnowflake LabelPlacementMapper LabelVerticesAndEdges NullPoint ParallelCoordinatesView PieChart PKMeansClustering ScaleVertices SortDataArray StackedBar StackedPlot ThresholdCells ThresholdPoints vtkInteractorObserver FixedPointVolumeRayCastMapperCT LayeredActors TransparentBackground vtkInteractorStyle Follower ImageHistogram PickPixel PickPixel2 vtkInteractorStyleImage Attenuation BorderPixelSize CaptionActor2D Cast CenterAnImage CheckerboardWidget CombiningRGBChannels DEMReader EnhanceEdges ExtractComponents ExtractVOI FillWindow Flip GaussianSmooth Glyph2D HybridMedianComparison IdealHighPass ImageAnisotropicDiffusion2D ImageCityBlockDistance ImageClip ImageConvolve ImageCorrelation ImageDilateErode3D ImageDivergence ImageEllipsoidSource ImageFFT ImageGaussianSmooth ImageGradientMagnitude ImageGridSource ImageHistogram ImageHybridMedian2D ImageIdealHighPass ImageImport ImageIslandRemoval2D ImageIteratorDemo ImageLaplacian ImageLuminance ImageMagnify ImageMagnitude ImageMandelbrotSource ImageMapper ImageMapToColors ImageMask ImageMathematics ImageMedian3D ImageNoiseSource ImageNonMaximumSuppression ImageNormalize ImageOpenClose3D ImageOrder ImageOrientation ImagePermute ImageRange3D ImageReader2Factory ImageRegion ImageRFFT ImageSeparableConvolution ImageShiftScale ImageShrink3D ImageSlice ImageSliceMapper ImageSobel2D ImageStack ImageStencil ImageText ImageTracerWidget ImageTracerWidgetInsideContour ImageTranslateExtent ImageTransparency ImageVariance3D ImageWeightedSum InteractWithImage Interpolation MarkKeypoints MedianComparison MetaImageReader MorphologyComparison Pad PickPixel PickPixel2 ReadDICOMSeries RectilinearWipeWidget ResizeImage ResizeImageDemo RGBToHSI RGBToHSV RGBToYIQ RTAnalyticSource SeedWidgetImage Transparency VTKSpectrum WriteBMP WritePNM WriteTIFF vtkInteractorStyleRubberBand2D RubberBand2D RubberBand2DObserver SelectedVerticesAndEdges SelectWindowRegion vtkInteractorStyleRubberBand3D RubberBand3D vtkInteractorStyleRubberBandPick AreaPicking CreateESGrid HighlightSelectedPoints HighlightSelection LoadESGrid RubberBandPick vtkInteractorStyleRubberBandZoom RubberBandZoom vtkInteractorStyleSwitch AffineWidget ClipVolume HideActor HideAllActors ProteinRibbons StyleSwitch TableBasedClipDataSetWithPolyData2 vtkInteractorStyleTerrain InteractorStyleTerrain ThinPlateSplineTransform vtkInteractorStyleTrackball AreaPicking vtkInteractorStyleTrackballActor Game MovableAxes MoveActor MoveAGlyph MoveAVertexUnstructuredGrid PickableOff RotateActor SelectAnActor SelectAVertex ShiftAndControl TrackballActor vtkInteractorStyleTrackballCamera BoxWidget BoxWidget2 CellPicking ColorDisconnectedRegionsDemo ColorMapToLUT ConeDemo ContourWidget CubeMap CurvatureBandsWithGlyphs CurvaturesAdjustEdges DataStructureComparison DistanceToCamera DoubleClick ElevationBandsWithGlyphs EllipticalCylinder EllipticalCylinderDemo ExternalContour ExtractVisibleCells FireFlowDemo FroggieSurface FroggieView GLTFExporter GLTFImporter GradientBackground HighlightPickedActor HighlightWithSilhouette ImagePlaneWidget ImageTracerWidgetNonPlanar InterpolateMeshOnGrid KeypressEvents KMeansClustering LayeredActors MarbleShaderDemo MouseEvents MoveCamera MultipleActors MultipleRenderWindows ObserverMemberFunction PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Picking PKMeansClustering PointLocator PointPicker RayCastIsosurface ResampleAppendedPolyData RescaleReverseLUT ResetCameraOrientation SelectVisiblePoints SphereMap StreamLines TextOrigin TrackballCamera TransientHDFReader TubesWithVaryingRadiusAndColors Tutorial_Step5 Tutorial_Step6 VectorOfActors VisualizeModifiedBSPTree VisualizeOBBTree WorldPointPicker vtkInteractorStyleUser InteractorStyleUser IsoContours vtkInterpolateDataSetAttributes InterpolateFieldDataDemo Morph3D vtkIntersectionPolyDataFilter IntersectionPolyDataFilter vtkIterativeClosestPointTransform AlignTwoPolyDatas IterativeClosestPointsTransform vtkJPEGReader CheckerboardWidget ClipArt CubeMap ImageClip ImageRegion JPEGReader SelectWindowRegion SphereMap TextureMapPlane TextureMapQuad vtkJPEGWriter ImageWriter JPEGWriter PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkKdTree BuildLocatorFromKClosestPoints KdTree KDTreeAccessPoints VisualizeKDTree vtkKdTreePointLocator ClosestNPoints DataStructureComparison KDTreeFindPointsWithinRadius KDTreeFindPointsWithinRadiusDemo KdTreePointLocatorClosestPoint KDTreeTimingDemo vtkKMeansStatistics KMeansClustering vtkKochanekSpline 1DTupleInterpolation FitSplineToCutterOutput KochanekSpline KochanekSplineDemo vtkLabeledDataMapper IsoparametricCellsDemo LabelContours LabeledDataMapper LabeledMesh LinearCellDemo ReadLegacyUnstructuredGrid vtkLabelPlacementMapper LabelPlacementMapper vtkLandmarkTransform AlignFrames AlignTwoPolyDatas IterativeClosestPointsTransform LandmarkTransform ProcrustesAlignmentFilter vtkLegendBoxActor HistogramBarChart ImageAccumulateGreyscale Legend PieChartActor PlaneSourceDemo SpiderPlot SubdivisionDemo vtkLegendScaleActor LegendScaleActor vtkLight AmbientSpheres DiffuseSpheres GLTFImporter Light LightActor PBR_Clear_Coat PBR_Mapping Shadows ShadowsLightsDemo SpecularSpheres SphereMap SpotLights vtkLightActor Light LightActor ShadowsLightsDemo vtkLightCollection Light ShadowsLightsDemo vtkLightsPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkLine CappedSphere ColoredLines DeleteCells DistancePointToLine ExtractEdges IterateOverLines IterativeClosestPointsTransform LandmarkTransform LinearCellDemo LongLine PCADemo RuledSurfaceFilter WarpVector WriteLegacyLinearCells WriteXMLLinearCells vtkLinearExtrusionFilter AlphaFrequency ClipArt EllipticalCylinder EllipticalCylinderDemo LinearExtrusion PolyDataContourToImageData Stocks vtkLinearSubdivisionFilter CurvaturesAdjustEdges PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision Subdivision SubdivisionDemo vtkLinearTransform ExportPolyDataScene vtkLineRepresentation LineWidget2 vtkLineSource AnimateVectors BluntStreamlines ExtrudePolyDataAlongLine FindCellIntersections GeometricObjectsDemo Kitchen Line LineWidth ModifiedBSPTreeExtractCells OBBTreeExtractCells OrientedBoundingCylinder PCADemo SourceObjectsDemo StippledLine TubeFilter WarpTo XYPlot vtkLineWidget StreamlinesWithLineWidget vtkLineWidget2 LineWidget2 vtkLinkEdgels CannyEdgeDetector vtkLocator DataStructureComparison vtkLODActor CameraModel1 CameraModel2 ColorIsosurface CubeAxesActor2D ImplicitSelectionLoop ReadPDB SelectPolyData vtkLODProp3D LODProp3D vtkLogger AnimateActors vtkLogLookupTable HyperStreamline vtkLogoRepresentation LogoWidget vtkLogoWidget LogoWidget vtkLookupTable AdjacentVertexIterator AssignCellColorsFromLUT Blow BorderWidget BorderWidgetQt BoxChart BoxClipStructuredPoints BoxClipUnstructuredGrid CarotidFlow CarotidFlowGlyphs CellTypeSource ClipVolume ColorCells ColorDisconnectedRegionsDemo Colored2DImageFusion ColoredAnnotatedCube ColoredElevationMap ColorEdges ColorLookupTable ColorVerticesLookupTable ComplexV ConnectivityFilterDemo CreateColorSeriesDemo CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo DEMReader DepthFirstSearchAnimation DiscreteMarchingCubes DisplacementPlot Dodecahedron ElevationBandsWithGlyphs ElevationFilter EventQtSlotConnect ExportPolyDataScene ExtractClusters FilledContours FitToHeightMap FrogBrain FroggieSurface FroggieView FrogSlice FunctionalBagPlot Hawaii ImageMapToColors ImageToPolyDataFilter KDTreeFindPointsWithinRadiusDemo KochSnowflake LabelContours LOx LOxGrid LOxSeeds LUTUtilities MedicalDemo3 MeshQuality NamedColors OBBDicer OctreeFindPointsWithinRadiusDemo PlatonicSolids PointLocatorFindPointsWithinRadiusDemo PseudoVolumeRendering Rainbow ReadLegacyUnstructuredGrid RenderScalarToFloatBuffer RenderWindowNoUiFile RenderWindowUISingleInheritance ScalarBarActor ScalarBarActorColorSeries ScalarBarWidget ScaleVertices SignedDistance SimpleElevationFilter SmoothDiscreteMarchingCubes StaticLocatorFindPointsWithinRadiusDemo StructuredGrid TableBasedClipDataSetWithPolyData2 TensorAxes TensorEllipsoids ThinPlateSplineTransform TissueLens TransformSphere TransientHDFReader Transparency UnsignedDistance VRMLImporterDemo vtkLoopBooleanPolyDataFilter LoopBooleanPolyDataFilter vtkLoopSubdivisionFilter Subdivision SubdivisionDemo vtkMapper CameraActor ClipVolume MinimalQtVTKApp OpenVRFrustum TableBasedClipDataSetWithPolyData2 vtkMarchingContourFilter FinanceFieldData vtkMarchingCubes ExtractLargestIsosurface FrogBrain FroggieSurface HeadBone IsosurfaceSampling MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 TissueLens vtkMarchingSquares ContourTriangulator MarchingSquares vtkMaskFields GenerateModelsFromLabels vtkMaskPoints CarotidFlowGlyphs CurvatureBandsWithGlyphs ElevationBandsWithGlyphs ExtractSurfaceDemo Gradient MaskPoints ParametricObjectsDemo PointDataSubdivision SpikeFran SplatFace vtkMaskPointsFilter MaskPointsFilter vtkMaskPolyData StripFran vtkMassProperties MassProperties vtkMath AlignFrames BrownianPoints CellLocatorVisualization ChooseTextColor ChooseTextColorDemo CompassWidget ContoursFromPolyData ContoursToSurface ContourWidget DecimatePolyline DistanceBetweenPoints EigenSymmetric EllipticalCylinder EllipticalCylinderDemo ExtrudePolyDataAlongLine FunctionalBagPlot GLTFExporter GreedyTerrainDecimation HanoiInitial HanoiIntermediate HedgeHog Histogram2D HomogeneousLeastSquares ImageClip ImageCorrelation IncrementalOctreePointLocator InterpolateCamera IntersectLine KochanekSplineDemo KochSnowflake LeastSquares LUFactorization ModifiedBSPTreeTimingDemo NormalizeVector OBBTreeTimingDemo OctreeVisualize OpenVROrientedArrow OpenVROrientedCylinder OrientedArrow OrientedBoundingCylinder OrientedCylinder ParametricKuenDemo ParametricObjectsDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PCADemo PerpendicularVector PickPixel2 PlaneSourceDemo PointLocatorVisualization PoissonExtractSurface PolyLine1 PowercrustExtractSurface ReverseAccess RibbonFilter SGrid SphereWidget2 TubesWithVaryingRadiusAndColors Visualize2DPoints VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkMatrix3x3 MatrixInverse MatrixTranspose vtkMatrix4x4 AlignFrames CollisionDetection EllipticalCylinderDemo ExtrudePolyDataAlongLine FroggieSurface FroggieView GLTFExporter IterativeClosestPointsTransform LandmarkTransform OpenVROrientedArrow OpenVROrientedCylinder OrientedArrow OrientedCylinder PerspectiveTransform PlaneSourceDemo RotateActor vtkMatrixMathFilter MatrixMathFilter vtkMCubesReader PineRootConnectivity PineRootDecimation vtkMergeFilter ImageWarp vtkMergePoints HeadBone MergePoints vtkMeshQuality HighlightBadCells MeshQuality vtkMetaImageReader BoxClipStructuredPoints EdgePoints FixedPointVolumeRayCastMapperCT FlyingHeadSlice FrogBrain FroggieSurface FrogSlice GenerateCubesFromLabels GenerateModelsFromLabels HeadBone HeadSlice ImageGradient MaskPointsFilter MedicalDemo1 MedicalDemo2 MedicalDemo3 MedicalDemo4 MetaImageReader MetaImageWriter RayCastIsosurface TissueLens VoxelsOnBoundary vtkMetaImageWriter MetaImageWriter PolyDataContourToImageData PolyDataToImageData vtkMinimalStandardRandomSequence BillboardTextActor3D BorderPixelSize CellTypeSource ChooseTextColorDemo ColorCells ColorCellsWithRGB ColorDisconnectedRegionsDemo ColoredElevationMap ConstrainedDelaunay2D DelaunayMesh DensifyPoints DiscreteMarchingCubes EllipticalCylinderDemo ExtractClusters ExtractSurface ExtractSurfaceDemo GLTFExporter GreedyTerrainDecimation Hanoi HanoiInitial HanoiIntermediate HighlightPickedActor HighlightWithSilhouette InterpolateCamera InterpolateMeshOnGrid InterpolateTerrain KDTreeTimingDemo LabelContours Lorenz MergePoints MiscPointData ModifiedBSPTreeTimingDemo OBBTreeTimingDemo OctreeTimingDemo OpenVROrientedArrow OpenVROrientedCylinder OrientedArrow OrientedCylinder ParametricObjectsDemo PlaneSourceDemo PointOccupancy QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo RadiusOutlierRemoval RandomSequence RemoveOutsideSurface ResampleAppendedPolyData ResamplePolyLine RescaleAnImage SignedDistance SmoothDiscreteMarchingCubes SmoothPolyDataFilter SpiderPlot StringToImageDemo TriangulateTerrainMap UniformRandomNumber UnsignedDistance WarpScalar vtkModifiedBSPTree DataStructureComparison ModifiedBSPTreeExtractCells ModifiedBSPTreeIntersectWithLine ModifiedBSPTreeTimingDemo VisualizeModifiedBSPTree vtkMoleculeMapper ReadCML vtkMultiBlockDataGroupFilter ProcrustesAlignmentFilter vtkMultiBlockDataSet BluntStreamlines CellsInsideObject ColorIsosurface CombustorIsosurface CompositePolyDataMapper CutStructuredGrid ExportPolyDataScene Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse ImportPolyDataScene InterpolateFieldDataDemo KMeansClustering LOx LOxGrid LOxSeeds MultiBlockDataSet MultiBlockMergeFilter PKMeansClustering ProbeCombustor ProcrustesAlignmentFilter PseudoVolumeRendering Rainbow ReadPLOT3D StreamLines StreamlinesWithLineWidget TextureThreshold VelocityProfile VoxelsOnBoundary WarpCombustor XYPlot vtkMultiBlockMergeFilter MultiBlockMergeFilter vtkMultiBlockPLOT3DReader BluntStreamlines ColorIsosurface CombustorIsosurface CutStructuredGrid LOx LOxGrid LOxSeeds ProbeCombustor PseudoVolumeRendering Rainbow ReadPLOT3D StreamLines StreamlinesWithLineWidget TextureThreshold VelocityProfile WarpCombustor XYPlot vtkMultiThreshold CellsInsideObject VoxelsOnBoundary vtkMutableDirectedGraph AdjacentVertexIterator ColorEdges ColorVertexLabels ColorVerticesLookupTable ConstructTree CreateTree DepthFirstSearchAnimation DirectedGraphToMutableDirectedGraph GraphAlgorithmFilter InEdgeIterator MutableDirectedGraphToDirectedGraph MutableGraphHelper OutEdgeIterator ShortestPath TreeBFSIterator TreeToMutableDirectedGraph VisualizeDirectedGraph vtkTestGraphAlgorithmFilter vtkMutableGraphHelper MutableGraphHelper vtkTestGraphAlgorithmFilter vtkMutableUndirectedGraph AdjacentVertexIterator BoostBreadthFirstSearchTree BreadthFirstDistance ConnectedComponents ConstructGraph DepthFirstSearchIterator EdgeListIterator EdgeWeights GraphAlgorithmFilter GraphAlgorithmSource GraphPoints GraphToPolyData InEdgeIterator LabelVerticesAndEdges MinimumSpanningTree MutableGraphHelper OutEdgeIterator RemoveIsolatedVertices ScaleVertices SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver SideBySideGraphs VertexSize VisualizeGraph vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkOBBDicer OBBDicer SplitPolyData vtkOBBTree AlignTwoPolyDatas DataStructureComparison OBBTreeExtractCells OBBTreeIntersectWithLine OBBTreeTimingDemo OrientedBoundingCylinder VisualizeOBBTree vtkObject AffineWidget AnimateActors Animation AnimationScene Arbitrary3DCursor AreaPicking BiDimensionalWidget BillboardTextActor3D BoxWidget BoxWidget2 BozoShader BozoShaderDemo CallBack CallData CameraModifiedEvent CellLocatorVisualization CenterAnImage ClientData CloseWindow CommandSubclass CompassWidget DataAnimation DataAnimationSubclass Delaunay3DDemo DepthFirstSearchAnimation EllipticalButton EventQtSlotConnect FilterProgress FilterSelfProgress FireFlowDemo FrameRate FroggieView Hanoi HDRReader HoverWidget ImageClip ImageRegion ImageTracerWidget ImageTracerWidgetInsideContour ImplicitPlaneWidget2 IndividualVRML InteractorStyleUser IsoContours KeypressObserver KochanekSplineDemo LayeredActors LineWidget2 LODProp3D MarbleShader MarbleShaderDemo MouseEventsObserver MovableAxes ObserveError ObserverMemberFunction OctreeVisualize ParametricKuenDemo ParametricObjectsDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel PickPixel2 PointLocatorVisualization PolygonalSurfacePointPlacer ProgressReport QuadraticHexahedronDemo QuadraticTetraDemo RotatingSphere RubberBand2DObserver SeedWidgetImage SeedWidgetWithCustomCallback SelectedVerticesAndEdgesObserver SelectWindowRegion Slider Slider2D SpatterShader SphereWidget SphereWidget2 SphereWidgetEvents StreamlinesWithLineWidget Timer TransientHDFReader TransparentBackground Tutorial_Step2 Tutorial_Step6 UserEvent VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter WindowModifiedEvent vtkObjectBase TransientHDFReader vtkObjectFactory CaptionActor2D Diagram ExtractVisibleCells MultipleRenderWindows ReadDICOMSeries RectilinearWipeWidget vtkImageAlgorithmFilter vtkTest vtkTest1 vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader Warnings vtkOBJExporter ImportToExport vtkOBJImporter CombineImportedActors ImportToExport OBJImporter vtkOBJReader AlignTwoPolyDatas BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CapClip CellCentersDemo CellsInsideObject ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CompareExtractSurface ConnectivityFilterDemo Delaunay3DDemo DensifyPoints ExportPolyDataScene ExtractEnclosedPoints ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FillHoles FlatVersusGouraud GradientBackground HiddenLineRemoval HighlightSelection ImplicitModeller InterpolateCamera KDTreeFindPointsWithinRadiusDemo LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientedBoundingCylinder PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface ProjectedTexture RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadOBJ Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation SignedDistance SpatterShader SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Subdivision SubdivisionDemo UnsignedDistance VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkOctreePointLocator BuildOctree DataStructureComparison OctreeClosestPoint OctreeFindPointsWithinRadius OctreeFindPointsWithinRadiusDemo OctreeKClosestPoints OctreeTimingDemo OctreeVisualize vtkOggTheoraWriter OggTheora vtkOpaquePass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ShadowsLightsDemo vtkOpenGLGPUVolumeRayCastMapper RayCastIsosurface vtkOpenGLPolyDataMapper BozoShader BozoShaderDemo ColorByNormal CubeMap MarbleShader MarbleShaderDemo SpatterShader SphereMap vtkOpenGLRenderer MotionBlur OutlineGlowPass PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Shadows ShadowsLightsDemo vtkOpenGLRenderWindow PBR_Skybox vtkOpenGLTexture PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat vtkOpenVRRenderer OpenVRCone OpenVRCube OpenVRCylinder OpenVRFrustum OpenVROrientedArrow OpenVROrientedCylinder OpenVRSphere OpenVRTessellatedBoxSource OpenVRVolume vtkOpenVRRenderWindow OpenVRCone OpenVRCube OpenVRCylinder OpenVRFrustum OpenVROrientedArrow OpenVROrientedCylinder OpenVRSphere OpenVRTessellatedBoxSource OpenVRVolume vtkOpenVRRenderWindowInteractor OpenVRCone OpenVRCube OpenVRCylinder OpenVRFrustum OpenVROrientedArrow OpenVROrientedCylinder OpenVRSphere OpenVRTessellatedBoxSource OpenVRVolume vtkOrientationMarkerWidget AlignTwoPolyDatas AnatomicalOrientation CallBack ColoredAnnotatedCube DisplayCoordinateAxes FroggieSurface FroggieView OrientationMarkerWidget OrientationMarkerWidget1 PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkOrientedGlyphContourRepresentation ContourWidget PolygonalSurfaceContourLineInterpolator PolygonalSurfacePointPlacer vtkOutEdgeIterator OutEdgeIterator vtkOutlineCornerFilter OBBDicer vtkOutlineFilter AnimateVectors CallBack CarotidFlow CarotidFlowGlyphs ComplexV ContourQuadric CubeAxesActor2D DisplayQuadricSurfaces EdgePoints ExtractData FlyingHeadSlice HeadBone HeadSlice HyperStreamline IronIsoSurface IsoContours MedicalDemo1 MedicalDemo2 MedicalDemo3 Outline OverlappingAMR PineRootConnectivity PineRootDecimation PlateVibration ProbeCombustor QuadricVisualization ReadSLC SampleFunction SingleSplat TensorAxes TensorEllipsoids vtkOutlineGlowPass OutlineGlowPass vtkOutputWindow FileOutputWindow vtkOverlappingAMR Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse OverlappingAMR vtkOverlayPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkParallelCoordinatesRepresentation ParallelCoordinatesView vtkParallelCoordinatesView ParallelCoordinatesView vtkParametricBohemianDome ParametricObjectsDemo vtkParametricBour CurvaturesAdjustEdges ParametricObjectsDemo vtkParametricBoy ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricCatalanMinimal ParametricObjectsDemo vtkParametricConicSpiral ParametricObjectsDemo vtkParametricCrossCap ParametricObjectsDemo vtkParametricDini ParametricObjectsDemo vtkParametricEllipsoid ParametricObjectsDemo PointDataSubdivision vtkParametricEnneper CurvaturesAdjustEdges LegendScaleActor ParametricObjectsDemo vtkParametricFigure8Klein ParametricObjectsDemo vtkParametricFunction ParametricObjectsDemo vtkParametricFunctionSource CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs ExtrudePolyDataAlongLine KochanekSpline KochanekSplineDemo LegendScaleActor ParametricKuenDemo ParametricObjectsDemo ParametricSpline ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision ProjectSphere SCurveSpline TubesFromSplines vtkParametricHenneberg ParametricObjectsDemo vtkParametricKlein ParametricObjectsDemo vtkParametricKuen ParametricKuenDemo ParametricObjectsDemo vtkParametricMobius CurvaturesAdjustEdges ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricPluckerConoid ParametricObjectsDemo vtkParametricPseudosphere ParametricObjectsDemo vtkParametricRandomHills CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricRoman ParametricObjectsDemo vtkParametricSpline ExtrudePolyDataAlongLine KochanekSpline KochanekSplineDemo ParametricObjectsDemo ParametricSpline SCurveSpline TubesFromSplines vtkParametricSuperEllipsoid ParametricObjectsDemo ParametricSuperEllipsoidDemo ProjectSphere vtkParametricSuperToroid ParametricObjectsDemo ParametricSuperToroidDemo vtkParametricTorus CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParticleReader ParticleReader vtkPassThrough PassThrough vtkPath FroggieView vtkPBRIrradianceTexture PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkPCANormalEstimation CompareExtractSurface ExtractSurface ExtractSurfaceDemo NormalEstimation PoissonExtractSurface SignedDistance vtkPCAStatistics PCADemo PCAStatistics vtkPDBReader ProteinRibbons ReadPDB vtkPen Diagram FunctionalBagPlot PlotLine3D SurfacePlot vtkPentagonalPrism Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPerlinNoise PerlinNoise vtkPerspectiveTransform PerspectiveTransform vtkPiecewiseFunction FixedPointVolumeRayCastMapperCT IntermixedUnstructuredGrid MedicalDemo4 MinIntensityRendering OpenVRVolume PiecewiseFunction RayCastIsosurface SimpleRayCast vtkPieChartActor PieChartActor vtkPixel LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPKMeansStatistics PKMeansClustering vtkPlane CapClip ClipClosedSurface ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ContoursFromPolyData CutStructuredGrid Cutter CutWithCutFunction CutWithScalars DataSetSurface ExtractPolyLinesFromPolyData FitSplineToCutterOutput GenericClip IceCream ImplicitPlaneWidget2 PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PolyDataContourToImageData ProjectPointPlane PseudoVolumeRendering SolidClip VoxelsOnBoundary vtkPlaneCollection ClipClosedSurface vtkPlanes CameraActor ClipFrustum ClipVolume Frustum HighlightSelectedPoints HighlightSelection Motor OpenVRFrustum Planes ProjectedTexture TableBasedClipDataSetWithPolyData2 TextureCutSphere vtkPlanesIntersection PlanesIntersection vtkPlaneSource AffineWidget AnatomicalOrientation AssignCellColorsFromLUT CellPicking ClipSphereCylinder ColorCells ColorCellsWithRGB CreateColorSeriesDemo CurvatureBandsWithGlyphs ElevationBandsWithGlyphs ExponentialCosine FitToHeightMap FrogSlice Hanoi HanoiInitial HanoiIntermediate LabelContours Light Picking Plane PlaneSourceDemo ProbeCombustor ResampleAppendedPolyData ShadowsLightsDemo SourceObjectsDemo SpotLights StreamLines TextureMapImageData TextureMapPlane TexturePlane vtkPlaneWidget PlaneWidget vtkPlatonicSolidSource BorderWidget BorderWidgetQt CubeAxesActor2D EventQtSlotConnect PlatonicSolids RenderWindowNoUiFile RenderWindowUISingleInheritance ResampleAppendedPolyData vtkPlot BarChart BarChartQt ChartMatrix ChartsOn3DScene KDTreeTimingDemo LinePlot ModifiedBSPTreeTimingDemo OBBTreeTimingDemo OctreeTimingDemo ParallelCoordinates ScatterPlot vtkPlotArea AreaPlot vtkPlotBar StackedBar vtkPlotBox BoxChart vtkPlotFunctionalBag FunctionalBagPlot vtkPlotLine3D PlotLine3D vtkPlotPie PieChart vtkPlotPoints ChartMatrix ChartsOn3DScene MultiplePlots ScatterPlot vtkPlotStacked StackedPlot vtkPlotSurface SurfacePlot vtkPLYReader AlignTwoPolyDatas BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CapClip CellCentersDemo CellsInsideObject ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CompareExtractSurface ConnectivityFilterDemo CubeMap Delaunay3DDemo DensifyPoints ExportPolyDataScene ExtractEnclosedPoints ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FillHoles GradientBackground HiddenLineRemoval HighlightSelection ImplicitModeller InterpolateCamera KDTreeFindPointsWithinRadiusDemo LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties MotionBlur NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientedBoundingCylinder PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface ProjectedTexture RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadPLY Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation SignedDistance SpatterShader SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Subdivision SubdivisionDemo UnsignedDistance VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree WritePLY vtkPLYWriter ConvertFile WritePLY vtkPNGReader CannyEdgeDetector ContourTriangulator DecimateFran ImageContinuousDilate3D ImageContinuousErode3D ImageDilateErode3D ImageHybridMedian2D ImageMagnify ImageOpenClose3D ImageSeparableConvolution ImageToPolyDataFilter MarchingSquares PBR_Clear_Coat PBR_Mapping PNGReader vtkPNGWriter EarthSource Hanoi HanoiInitial HanoiIntermediate ImageWriter OffScreenRendering ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PNGWriter PointDataSubdivision RenderLargeImage Screenshot WalkCow WalkCowA WalkCowB vtkPNMReader CreateBFont ReadPNM WritePNM vtkPNMWriter ImageWriter WritePNM vtkPointData ArrayCalculator BackgroundTexture BandedPolyDataContourFilter BluntStreamlines CarotidFlow CarotidFlowGlyphs Casting ClipDataSetWithPolyData ClipVolume ColorDisconnectedRegions ColorDisconnectedRegionsDemo ColoredElevationMap ColoredPoints ColorGlyphs CompareExtractSurface CopyAllArrays CreateBFont Cube CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo CutStructuredGrid CutWithCutFunction CutWithScalars DelimitedTextReader DetermineArrayDataTypes DistancePolyDataFilter DotProduct DumpXMLFile ElevationBandsWithGlyphs ElevationFilter EnhanceEdges ExponentialCosine ExtractArrayComponent ExtractSelectionOriginalId ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FieldData FilledContours Finance FindAllArrayNames Game GenerateCubesFromLabels GenerateModelsFromLabels GetMiscPointData Glyph3DMapper Gradient HedgeHog HighlightSelectedPoints HybridMedianComparison IdentifyHoles ImageCorrelation ImageSobel2D ImageStencil ImageText ImageValueRange ImplicitPolyDataDistance InterpolateFieldDataDemo InterpolateMeshOnGrid InterpolateTerrain IsosurfaceSampling IterateImageData KDTreeFindPointsWithinRadiusDemo Kitchen KMeansClustering LabelContours LabelPlacementMapper Lorenz MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MatrixMathFilter MedianComparison MinimalQtVTKApp MiscPointData MorphologyComparison MoveAGlyph NullPoint OctreeFindPointsWithinRadiusDemo Office OfficeA OfficeTube OverlappingAMR ParallelCoordinatesView PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel PickPixel2 PineRootConnectivityA PKMeansClustering PointCellIds PointDataSubdivision PointInsideObject PointInterpolator PointLocatorFindPointsWithinRadiusDemo PoissonExtractSurface PolyDataCellNormals PolyDataContourToImageData PolyDataExtractNormals PolyDataIsoLines PolyDataPointNormals PolyDataToImageData ProjectedTexture ProjectSphere RandomProbe RenderScalarToFloatBuffer ResampleAppendedPolyData ReverseSense ScalarBarActor ScalarBarActorColorSeries ScaleGlyphs SGrid ShadowsLightsDemo ShepardMethod SimpleElevationFilter SingleSplat StaticLocatorFindPointsWithinRadiusDemo StippledLine StructuredGrid TableBasedClipDataSetWithPolyData TableBasedClipDataSetWithPolyData2 TensorGlyph TextureMapQuad ThresholdPoints TransientHDFReader Transparency TriangleColoredPoints TubesFromSplines TubesWithVaryingRadiusAndColors VectorDot VectorField VectorFieldNonZeroExtraction VectorNorm Vol VRMLImporterDemo WarpScalar WarpVector WeightedTransformFilter vtkPointGaussianMapper PointInterpolator vtkPointHandleRepresentation2D SeedWidget SeedWidgetImage SeedWidgetWithCustomCallback vtkPointInterpolator InterpolateFieldDataDemo PointInterpolator vtkPointLoad HyperStreamline TensorAxes TensorEllipsoids vtkPointLocator PointLocator PointLocatorFindPointsWithinRadiusDemo PointLocatorRadius PointLocatorVisualization vtkPointOccupancyFilter PointOccupancy vtkPointPicker MoveAVertexUnstructuredGrid PointPicker SelectAVertex vtkPoints Actor2D AddCell AlignFrames AlignTwoPolyDatas AppendFilter AreaPicking ArrayCalculator BackgroundTexture BandedPolyDataContourFilter BlankPoint Bottle BuildLocatorFromKClosestPoints BuildOctree CameraModel1 CameraModel2 CappedSphere Casting Cell3DDemonstration CellEdges CellPicking CellTypeSource CenterOfMass ChooseTextColorDemo ClipVolume ColoredElevationMap ColoredLines ColoredPoints ColorGlyphs ColorVerticesLookupTable CompareExtractSurface ConstrainedDelaunay2D ContoursToSurface ContourWidget ConvexPointSet CreateESGrid Cube CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvedReformation CutWithScalars DataAnimation DataAnimationSubclass DataSetSurface DecimatePolyline DeformPointSet Delaunay2D DelaunayMesh DeleteCells DeletePoint DelimitedTextReader DirectedGraphToMutableDirectedGraph Dodecahedron ElevationBandsWithGlyphs ElevationFilter EllipticalCylinder EllipticalCylinderDemo ExponentialCosine ExtractArrayComponent ExtractEdges ExtractEnclosedPoints ExtractPolyLinesFromPolyData ExtrudePolyDataAlongLine FastSplatter FilterProgress FilterSelfProgress Finance FitSplineToCutterOutput GetClassName Glyph2D Glyph3D Glyph3DImage Glyph3DMapper GradientBackground GraphPoints GraphToPolyData HedgeHog Hexahedron ImageDataToPointSet ImplicitPolyDataDistance ImplicitSelectionLoop IncrementalOctreePointLocator InterpolateCamera InterpolateMeshOnGrid InterpolateTerrain IterateOverLines IterativeClosestPointsTransform KdTree KDTreeAccessPoints KdTreePointLocatorClosestPoint KMeansClustering KochanekSpline KochanekSplineDemo KochSnowflake LabelContours LabeledDataMapper LabeledMesh LabelPlacementMapper LandmarkTransform LinearCellDemo LongLine MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MiscCellData MiscPointData ModifiedBSPTreeExtractCells Motor MoveAGlyph MoveAVertexUnstructuredGrid MultiLineText MutableDirectedGraphToDirectedGraph NOVCAGraph NullPoint OBBTreeExtractCells OBBTreeIntersectWithLine OctreeClosestPoint OrientedBoundingCylinder ParametricObjectsDemo ParametricSpline PCADemo PieChartActor PKMeansClustering PlanesIntersection Point PointInPolygon PointInsideObject PointInsideObject2 PointsProjectedHull PolyDataCellNormals PolyDataFilter PolyDataPointNormals Polygon PolygonIntersection Polyhedron PolyLine PolyLine1 ProgrammableFilter ProgrammableGlyphFilter ProgrammableSource ProgressReport Pyramid Quad QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo QuantizePolyDataPoints ReadAllPolyDataTypesDemo ReadPlainTextTriangles ReadTextFile ResampleAppendedPolyData ResamplePolyLine RibbonFilter RuledSurfaceFilter ScaleGlyphs SCurveSpline SelectAVertex SelectPolyData SGrid ShepardMethod ShortestPath SideBySideGraphs SimpleElevationFilter SingleSplat SmoothPolyDataFilter SourceObjectsDemo SpiderPlot Spring StructuredDataTypes StructuredGrid StructuredGridOutline StructuredPointsToUnstructuredGrid SurfaceFromUnorganizedPointsWithPostProc TableBasedClipDataSetWithPolyData2 TensorGlyph Tetrahedron TextureCutSphere TextureMapQuad ThinPlateSplineTransform ThresholdCells ThresholdPoints TreeToMutableDirectedGraph Triangle TriangleArea TriangleColoredPoints TriangleSolidColor TriangleStrip TriangulateTerrainMap TubesFromSplines TubesWithVaryingRadiusAndColors UGrid VectorDot VectorNorm Vertex VertexGlyphFilter VertexSize ViewportBorders VisualizeStructuredGrid VisualizeStructuredGridCells vtkTestReader WarpVector WriteLegacyLinearCells WriteVTP WriteVTU WriteXMLLinearCells XMLStructuredGridWriter vtkPointSet AlignTwoPolyDatas ExtractFaces ProcrustesAlignmentFilter vtkPointSetToLabelHierarchy LabelPlacementMapper vtkPointSource AppendFilter CarotidFlow ClosestNPoints ConvexHullShrinkWrap DataStructureComparison DensifyPoints DistanceToCamera DownsamplePointCloud ExtractClusters ExtractSelection ExtractSelectionOriginalId ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FireFlow FireFlowDemo HighlightSelectedPoints KDTreeFindPointsWithinRadius KochanekSpline LabeledDataMapper LabelPlacementMapper LOx LOxGrid LOxSeeds MaskPoints MergePoints MergeSelections NormalEstimation OctreeFindPointsWithinRadius OctreeKClosestPoints Office OfficeA PineRootConnectivityA PointInsideObject2 PointLocator PointLocatorRadius PointLocatorVisualization PointOccupancy PointSize PointSource PointsProjectedHull PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface QuantizePolyDataPoints RadiusOutlierRemoval RandomProbe ScalarVisibility SCurveSpline SelectionSource SelectVisiblePoints SignedDistance SourceObjectsDemo UnsignedDistance vtkPointsProjectedHull PointsProjectedHull vtkPointWidget Arbitrary3DCursor vtkPolyData Actor2D AddCell AlignFrames AlignTwoPolyDatas AppendFilter Arbitrary3DCursor AreaPicking ArrayCalculator BackgroundTexture BandedPolyDataContourFilter BooleanOperationPolyDataFilter Bottle BozoShader BozoShaderDemo BuildOctree CameraModel1 CameraModel2 CapClip CappedSphere Casting CellCentersDemo CellLocatorVisualization CellPicking CellsInsideObject CenterOfMass ChooseTextColorDemo ClipClosedSurface ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo ColoredElevationMap ColoredLines ColoredPoints ColorGlyphs CombineImportedActors CombinePolyData CompareExtractSurface ConnectivityFilterDemo ConstrainedDelaunay2D ContoursFromPolyData ContoursToSurface ContourWidget ConvexPointSet CopyAllArrays Cube CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo CurvedReformation CutWithScalars DataBounds DataSetSurfaceFilter DataStructureComparison DecimatePolyline Decimation DeepCopy DeformPointSet Delaunay2D Delaunay3DDemo DelaunayMesh DeleteCells DelimitedTextReader DensifyPoints DetermineArrayDataTypes DisplayCoordinateAxes DistancePolyDataFilter DumpXMLFile ElevationBandsWithGlyphs ElevationFilter EllipticalCylinder EllipticalCylinderDemo EmbedPointsIntoVolume ExodusIIWriter ExponentialCosine ExportPolyDataScene ExternalContour ExtractArrayComponent ExtractEnclosedPoints ExtractOutsideSurface ExtractSurface ExtractSurfaceDemo ExtractVisibleCells ExtrudePolyDataAlongLine FastSplatter FieldData FillHoles FilterProgress FilterSelfProgress FindAllArrayNames FitSplineToCutterOutput Frustum Game GaussianSplat GenericDataObjectReader GeometryFilter GetMiscCellData GetMiscPointData Glyph2D Glyph3D Glyph3DImage Glyph3DMapper GradientBackground Hawaii HiddenLineRemoval HighlightBadCells HighlightSelectedPoints HighlightSelection IdentifyHoles ImageTracerWidget ImageTracerWidgetInsideContour ImplicitBooleanDemo ImplicitDataSetClipping ImplicitModeller ImplicitPolyDataDistance ImportPolyDataScene IncrementalOctreePointLocator InterpolateCamera InterpolateMeshOnGrid InterpolateTerrain IterateOverLines IterativeClosestPointsTransform KDTreeAccessPoints KDTreeFindPointsWithinRadiusDemo KdTreePointLocatorClosestPoint KDTreeTimingDemo KMeansClustering KochanekSpline KochanekSplineDemo KochSnowflake LabelContours LabeledDataMapper LabeledMesh LabelPlacementMapper LandmarkTransform Legend LineWidget2 LongLine LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties MergePoints MeshQuality MinimalQtVTKApp MiscCellData MiscPointData ModifiedBSPTreeIntersectWithLine ModifiedBSPTreeTimingDemo MoveAGlyph MoveAVertexUnstructuredGrid MultiLineText MultipleRenderWindows NormalEstimation NormalsDemo NullPoint OBBDicer OBBTreeTimingDemo OBJImporter OctreeClosestPoint OctreeFindPointsWithinRadiusDemo OctreeTimingDemo OctreeVisualize OpenVRCone OpenVRCube OpenVRCylinder OpenVRFrustum OpenVROrientedArrow OpenVROrientedCylinder OpenVRSphere OrientedBoundingCylinder OrientedGlyphs ParallelCoordinatesView ParametricSpline PassThrough PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PCADemo Picking PineRootConnectivity PineRootDecimation PKMeansClustering Plane Planes PlaneSourceDemo Point PointDataSubdivision PointInsideObject PointInsideObject2 PointInterpolator PointLocator PointLocatorFindPointsWithinRadiusDemo PointLocatorVisualization PointOccupancy PointsProjectedHull PoissonExtractSurface PolyDataAlgorithmReader PolyDataCellNormals PolyDataContourToImageData PolyDataExtractNormals PolyDataFilter PolyDataGetPoint PolyDataPointNormals PolyDataPointSampler Polygon PolygonalSurfaceContourLineInterpolator PolyLine PolyLine1 PowercrustExtractSurface ProcrustesAlignmentFilter ProgrammableFilter ProgrammableGlyphFilter ProgrammableSource ProgressReport ProjectedTexture ProjectSphere Quad QuadricClustering QuadricDecimation QuantizePolyDataPoints RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadPlainTextTriangles ReadTextFile ReadUnknownTypeXMLFile RegularPolygonSource RemoveOutsideSurface RemoveVertices ResampleAppendedPolyData ResamplePolyLine RibbonFilter Rotations RotationsA RotationsB RotationsC RotationsD RuledSurfaceFilter SaveSceneToFieldData SaveSceneToFile ScalarBarActor ScalarBarActorColorSeries ScaleGlyphs SelectAVertex Shadows ShallowCopy ShepardInterpolation ShepardMethod ShrinkPolyData SignedDistance Silhouette SimpleElevationFilter SingleSplat SmoothPolyDataFilter SpatterShader Sphere SplitPolyData Spring StaticLocatorFindPointsWithinRadiusDemo StippledLine StreamlinesWithLineWidget Subdivision SubdivisionDemo SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc TensorGlyph TextureMapPlane TextureMapQuad ThresholdCells ThresholdPoints TransformActor TransientHDFReader Triangle TriangleArea TriangleColoredPoints TriangleSolidColor TriangleStrip TriangulateTerrainMap TubesWithVaryingRadiusAndColors UnsignedDistance VectorDot VectorFieldNonZeroExtraction VectorNorm Vertex VertexConnectivity VertexGlyphFilter ViewportBorders Visualize2DPoints VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree VisualizeStructuredGrid VRMLImporterDemo vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader WarpSurface WarpVector WeightedTransformFilter WindowModifiedEvent WriteVTP vtkPolyDataAlgorithm CallData CompareExtractSurface GeometricObjectsDemo MultipleRenderWindows MultipleViewports ShareCamera SourceObjectsDemo Subdivision SubdivisionDemo vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader vtkPolyDataCollection PolygonalSurfaceContourLineInterpolator PolygonalSurfacePointPlacer vtkPolyDataConnectivityFilter ColorDisconnectedRegions ColorDisconnectedRegionsDemo ConnectivityFilterDemo ExtractLargestIsosurface ExtractOutsideSurface ExtrudePolyDataAlongLine PineRootConnectivity PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion vtkPolyDataMapper2D Actor2D ChooseTextColorDemo CompareExtractSurface GradientBackground LabeledMesh MarkKeypoints MultiLineText ReadAllPolyDataTypesDemo ViewportBorders Visualize2DPoints vtkPolyDataNormals BlobbyLogo Blow ColorIsosurface CombustorIsosurface CubeAxesActor2D CubeMap CurvatureBandsWithGlyphs CurvaturesAdjustEdges DecimateFran DecimateHawaii DisplacementPlot ElevationBandsWithGlyphs ExtrudePolyDataAlongLine FillHoles FrogBrain FroggieSurface FroggieView FrogSlice IdentifyHoles MassProperties Motor NormalsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PlateVibration PointDataSubdivision PolyDataExtractNormals PolyDataRIB PseudoVolumeRendering ShadowsLightsDemo SmoothPolyDataFilter SpatterShader SphereMap SpikeFran SplatFace Spring StripFran TensorEllipsoids VelocityProfile VRMLImporterDemo WarpCombustor WarpSurface vtkPolyDataPointSampler PolyDataPointSampler vtkPolyDataReader AlignTwoPolyDatas BlobbyLogo BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CapClip CellCentersDemo CellsInsideObject ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CompareExtractSurface ConnectivityFilterDemo CurvedReformation DecimateFran DecimateHawaii Delaunay3DDemo DensifyPoints DisplacementPlot DistancePolyDataFilter ExportPolyDataScene ExtractEnclosedPoints ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FillHoles FroggieView GradientBackground Hawaii Hello HiddenLineRemoval HighlightSelection ImplicitModeller InterpolateCamera KDTreeFindPointsWithinRadiusDemo LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientedBoundingCylinder PlateVibration PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface ProjectedTexture RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation SignedDistance SpatterShader SpikeFran SplatFace SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Stocks StripFran Subdivision SubdivisionDemo UnsignedDistance ViewportBorders VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkPolyDataSilhouette HighlightWithSilhouette Silhouette vtkPolyDataTangents CurvaturesAdjustEdges PBR_Anisotropy PBR_Clear_Coat PBR_HDR_Environment PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkPolyDataToImageStencil ImageTracerWidgetInsideContour PolyDataContourToImageData PolyDataToImageData vtkPolygon ConstrainedDelaunay2D ImageTracerWidgetInsideContour LinearCellDemo PointInPolygon Polygon PolygonIntersection TextureMapQuad WriteLegacyLinearCells WriteXMLLinearCells vtkPolygonalSurfaceContourLineInterpolator PolygonalSurfaceContourLineInterpolator vtkPolygonalSurfacePointPlacer PolygonalSurfaceContourLineInterpolator PolygonalSurfacePointPlacer vtkPolyhedron Dodecahedron vtkPolyLine ChooseTextColorDemo CompareExtractSurface EllipticalCylinder EllipticalCylinderDemo GradientBackground KochSnowflake LinearCellDemo NOVCAGraph PointsProjectedHull PolyLine ReadAllPolyDataTypesDemo ViewportBorders WriteLegacyLinearCells WriteXMLLinearCells vtkPolyVertex LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPostScriptWriter ImageWriter vtkProbeFilter Arbitrary3DCursor CurvedReformation FitToHeightMap InterpolateMeshOnGrid InterpolateTerrain IsosurfaceSampling ProbeCombustor RandomProbe ShepardInterpolation TissueLens XYPlot vtkProcrustesAlignmentFilter ProcrustesAlignmentFilter vtkProgrammableFilter DataAnimation DataAnimationSubclass ProgrammableFilter vtkProgrammableGlyphFilter ProgrammableGlyphFilter vtkProgrammableSource ProgrammableSource vtkProjectedTexture ProjectedTexture vtkProjectSphereFilter ProjectSphere vtkProp ImageRegion vtkProp3D AreaPicking FroggieSurface FroggieView MovableAxes vtkProp3DButtonRepresentation EllipticalButton vtkProp3DCollection AreaPicking vtkPropAssembly AnatomicalOrientation ColoredAnnotatedCube FroggieSurface FroggieView vtkPropCollection Assembly Game HideActor MovableAxes vtkProperty2D Actor2D CellLocatorVisualization CenterAnImage ChooseTextColorDemo CompareExtractSurface CompareRandomGeneratorsCxx FireFlowDemo FroggieView GradientBackground HistogramBarChart ImageAccumulateGreyscale ImageClip ImageRegion KochanekSplineDemo LabeledMesh LabelPlacementMapper LinearCellDemo LogoWidget MarkKeypoints MultiLineText OctreeVisualize PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PieChartActor PointDataSubdivision PointLocatorVisualization ReadAllPolyDataTypesDemo RectilinearWipeWidget SeedWidget SeedWidgetImage SeedWidgetWithCustomCallback Slider2D SpiderPlot ViewportBorders Visualize2DPoints VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree XYPlot vtkPropPicker HighlightPickedActor HighlightWithSilhouette ImageRegion Picking PickPixel PickPixel2 vtkProteinRibbonFilter ProteinRibbons vtkPyramid Cell3DDemonstration LinearCellDemo Pyramid WriteLegacyLinearCells WriteXMLLinearCells vtkQImageToImageSource QImageToImageSource vtkQuad LinearCellDemo OrientedBoundingCylinder Quad WriteLegacyLinearCells WriteXMLLinearCells vtkQuadraticEdge IsoparametricCellsDemo vtkQuadraticHexahedron IsoparametricCellsDemo QuadraticHexahedron QuadraticHexahedronDemo vtkQuadraticLinearQuad IsoparametricCellsDemo vtkQuadraticLinearWedge IsoparametricCellsDemo vtkQuadraticPolygon IsoparametricCellsDemo vtkQuadraticPyramid IsoparametricCellsDemo vtkQuadraticQuad IsoparametricCellsDemo vtkQuadraticTetra IsoparametricCellsDemo QuadraticTetra QuadraticTetraDemo vtkQuadraticTriangle IsoparametricCellsDemo vtkQuadraticWedge IsoparametricCellsDemo vtkQuadric ContourQuadric DisplayQuadricSurfaces ExtractData FlatVersusGouraud ImplicitQuadric QuadraticSurface QuadricVisualization TextureCutQuadric vtkQuadricClustering QuadricClustering vtkQuadricDecimation QuadricDecimation vtkQuadricLODActor QuadricLODActor vtkQuantizePolyDataPoints QuantizePolyDataPoints vtkRadiusOutlierRemoval RadiusOutlierRemoval vtkRandomGraphSource RandomGraphSource vtkRectf ChartsOn3DScene PlotLine3D SurfacePlot vtkRectilinearGrid ClipDataSetWithPolyData DumpXMLFile RectilinearGrid RectilinearGridToTetrahedra RGrid StructuredDataTypes TableBasedClipDataSetWithPolyData TableBasedClipDataSetWithPolyData2 VisualizeRectilinearGrid vtkRectilinearGridGeometryFilter ClipDataSetWithPolyData RGrid TableBasedClipDataSetWithPolyData vtkRectilinearGridToTetrahedra RectilinearGridToTetrahedra vtkRectilinearWipeRepresentation RectilinearWipeWidget vtkRectilinearWipeWidget RectilinearWipeWidget vtkReflectionFilter Reflection vtkRegularPolygonSource BalloonWidget Circle GeometricObjectsDemo Glyph2D RegularPolygonSource Triangulate vtkRemoveIsolatedVertices RemoveIsolatedVertices vtkRenderedGraphRepresentation ColorVertexLabels LabelVerticesAndEdges ScaleVertices SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver VertexSize vtkRendererCollection CellPicking ExtractVisibleCells Game Hanoi HanoiInitial HanoiIntermediate HighlightSelectedPoints HighlightSelection LayeredActors MoveAVertexUnstructuredGrid Picking PointPicker SelectAVertex TransparentBackground WorldPointPicker vtkRenderLargeImage PointDataSubdivision RenderLargeImage vtkRenderPassCollection PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing RenderScalarToFloatBuffer Shadows ShadowsLightsDemo vtkRenderStepsPass MotionBlur OutlineGlowPass Shadows vtkRenderView RenderView vtkRenderWidget MinimalQtVTKApp vtkReverseSense CurvatureBandsWithGlyphs ElevationBandsWithGlyphs ReverseSense SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc vtkRibbonFilter RibbonFilter Stocks StreamlinesWithLineWidget vtkRIBExporter PolyDataRIB vtkRIBProperty PolyDataRIB vtkRotationalExtrusionFilter Bottle CameraModel1 CameraModel2 CappedSphere Spring vtkRTAnalyticSource ImplicitDataSet RTAnalyticSource vtkRuledSurfaceFilter ExtrudePolyDataAlongLine RuledSurfaceFilter vtkRungeKutta4 OfficeTube StreamlinesWithLineWidget vtkSampleFunction Attenuation BooleanOperationImplicitFunctions ContourQuadric DiscreteMarchingCubes DisplayQuadricSurfaces ExtractData FlatVersusGouraud GenericClip IceCream ImplicitBoolean ImplicitBooleanDemo ImplicitQuadric ImplicitSphere ImplicitSphere1 IsosurfaceSampling PerlinNoise QuadraticSurface QuadricVisualization RandomProbe SampleFunction SmoothDiscreteMarchingCubes vtkSampleImplicitFunctionFilter MaskPointsFilter vtkScalarBarActor CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo DistancePolyDataFilter ElevationBandsWithGlyphs RescaleReverseLUT ScalarBarActor ScalarBarActorColorSeries ScalarBarWidget SignedDistance UnsignedDistance vtkScalarBarWidget ScalarBarWidget vtkScalarsToColors ExportPolyDataScene vtkSCurveSpline SCurveSpline vtkSeedRepresentation SeedWidget SeedWidgetImage SeedWidgetWithCustomCallback vtkSeedWidget SeedWidget SeedWidgetImage SeedWidgetWithCustomCallback vtkSelectEnclosedPoints CellsInsideObject Game PointInsideObject vtkSelection CellEdgeNeighbors CellPicking CellPointNeighbors ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId ExtractVisibleCells FillHoles MergeSelections SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver VertexConnectivity vtkSelectionNode CellEdgeNeighbors CellPicking CellPointNeighbors ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId FillHoles MergeSelections SelectedVerticesAndEdges SelectedVerticesAndEdgesObserver SelectionSource VertexConnectivity vtkSelectionSource SelectionSource vtkSelectPolyData SelectPolyData vtkSelectVisiblePoints LabeledMesh SelectVisiblePoints vtkSequencePass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing RenderScalarToFloatBuffer Shadows ShadowsLightsDemo vtkShader BozoShader BozoShaderDemo ColorByNormal CubeMap MarbleShader MarbleShaderDemo SpatterShader SphereMap vtkShaderProgram BozoShader BozoShaderDemo MarbleShader MarbleShaderDemo SpatterShader vtkShaderProperty BozoShader BozoShaderDemo ColorByNormal CubeMap MarbleShader MarbleShaderDemo SpatterShader SphereMap vtkShadowMapBakerPass Shadows ShadowsLightsDemo vtkShadowMapPass Shadows ShadowsLightsDemo vtkShepardMethod BackgroundTexture ShepardInterpolation ShepardMethod vtkShortArray Lorenz vtkShrinkFilter CellTypeSource ExtractData FindCellIntersections HyperTreeGridSource IntersectLine LoopShrink OpenVRTessellatedBoxSource ReadLegacyUnstructuredGrid ShrinkCube TessellatedBoxSource VisualizeRectilinearGrid VisualizeStructuredGridCells vtkShrinkPolyData Frustum MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD OpenVRFrustum RegularPolygonSource ShrinkPolyData vtkSignedDistance CompareExtractSurface ExtractSurface ExtractSurfaceDemo SignedDistance vtkSimple2DLayoutStrategy VisualizeDirectedGraph VisualizeGraph XGMLReader vtkSimpleElevationFilter SimpleElevationFilter vtkSimpleMotionBlurPass MotionBlur vtkSimplePointsReader SimplePointsReader vtkSimplePointsWriter SimplePointsWriter vtkSkybox PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing SphereMap vtkSLCReader IntermixedUnstructuredGrid ReadSLC vtkSliderRepresentation CellLocatorVisualization IsoContours OctreeVisualize PointLocatorVisualization Slider Slider2D VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkSliderRepresentation2D CellLocatorVisualization Delaunay3DDemo FireFlowDemo FroggieView KochanekSplineDemo MarbleShaderDemo OctreeVisualize ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointLocatorVisualization QuadraticHexahedronDemo QuadraticTetraDemo Slider2D VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkSliderRepresentation3D IsoContours Slider vtkSliderWidget CellLocatorVisualization Delaunay3DDemo FireFlowDemo FroggieView IsoContours KochanekSplineDemo MarbleShaderDemo OctreeVisualize ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointLocatorVisualization QuadraticHexahedronDemo QuadraticTetraDemo Slider Slider2D VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree vtkSmartVolumeMapper OpenVRVolume vtkSmoothPolyDataFilter ConvexHullShrinkWrap PointInsideObject2 SmoothPolyDataFilter vtkSortDataArray SortDataArray vtkSparseArray SparseArray vtkSphere Attenuation BooleanOperationImplicitFunctions ClipSphereCylinder DiscreteMarchingCubes ExtractData ExtractPointsDemo FitImplicitFunction IceCream ImplicitBoolean ImplicitBooleanDemo ImplicitSphere ImplicitSphere1 IsosurfaceSampling OverlappingAMR SmoothDiscreteMarchingCubes SphereWidget2 TissueLens vtkSphereRepresentation SphereWidget2 vtkSphereSource AffineWidget AlignTwoPolyDatas AmbientSpheres AnimateActors Animation AnimationScene AppendFilter Arbitrary3DCursor Assembly Axes AxisActor BackfaceCulling BackgroundColor BackgroundGradient BalloonWidget BiDimensionalWidget BillboardTextActor3D BooleanOperationPolyDataFilter BozoShader BozoShaderDemo BrownianPoints CallData Camera CameraActor CameraBlur CameraModel1 CameraModel2 CameraModifiedEvent CapClip CaptionWidget CellCentersDemo CellEdgeNeighbors CellLocator CellLocatorVisualization CellPointNeighbors CellsInsideObject CellTreeLocator ClientData ClipClosedSurface ClipFrustum ClosedSurface CollisionDetection ColorActorEdges ColorAnActor ColorByNormal ColorDisconnectedRegions ColorDisconnectedRegionsDemo ColoredSphere CombinePolyData CommandSubclass CompareExtractSurface CompositePolyDataMapper ConnectivityFilter ConnectivityFilterDemo ContoursFromPolyData ConvexHullShrinkWrap ConvexPointSet CopyAllArrays CornerAnnotation CorrectlyRenderTranslucentGeometry Cursor2D Cursor3D CursorShape CurvatureBandsWithGlyphs DataAnimation DataAnimationSubclass DataBounds Decimation DeformPointSet Delaunay3DDemo DelaunayMesh DensifyPoints DepthSortPolyData DetermineActorType DiffuseSpheres DijkstraGraphGeodesicPath DisplayCoordinateAxes DistancePolyDataFilter DistanceToCamera DoubleClick DrawText EarthSource ElevationBandsWithGlyphs EmbedPointsIntoVolume ExportPolyDataScene ExternalContour ExtractCellsUsingPoints ExtractClusters ExtractEdges ExtractEnclosedPoints ExtractOutsideSurface ExtractPointsDemo ExtractPolyLinesFromPolyData ExtractSelection ExtractSelectionCells ExtractVisibleCells FieldData FillHoles FilterProgress FilterSelfProgress FindAllArrayNames FireFlow FireFlowDemo FitImplicitFunction FitSplineToCutterOutput FlatShading FlatVersusGouraud FrameRate FullScreen Game GaussianSplat GenericClip GeometricObjectsDemo GLTFExporter GradientBackground HiddenLineRemoval HideActor HideAllActors HighlightBadCells HighlightPickedActor HighlightSelection HighlightWithSilhouette HoverWidget ImageDataGeometryFilter ImagePlaneWidget ImageTracerWidgetNonPlanar ImageTranslateExtent ImageWriter ImplicitDataSetClipping ImplicitModeller ImplicitPlaneWidget2 ImplicitPolyDataDistance ImplicitSelectionLoop InteractorStyleTerrain InteractorStyleUser InterpolateCamera IntersectionPolyDataFilter IsoparametricCellsDemo IterativeClosestPointsTransform KDTreeFindPointsWithinRadiusDemo KDTreeTimingDemo KeypressEvents KeypressObserver KochanekSpline KochanekSplineDemo LabeledDataMapper LabeledMesh LabelPlacementMapper LandmarkTransform Legend Light LinearCellDemo LineWidget2 LODProp3D LogoWidget LoopBooleanPolyDataFilter LoopShrink Mace MarbleShader MarbleShaderDemo MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MarchingCubes MaskPointsFilter MassProperties MeshQuality MinimalQtVTKApp Model ModifiedBSPTreeExtractCells ModifiedBSPTreeIntersectWithLine ModifiedBSPTreeTimingDemo MouseEvents MouseEventsObserver MoveActor MoveAGlyph MoveCamera MultiBlockDataSet MultiBlockMergeFilter MultipleActors MultipleInputPorts MultipleRenderWindows MultipleViewports NormalEstimation NormalsDemo NoShading OBBDicer OBBTreeExtractCells OBBTreeIntersectWithLine OBBTreeTimingDemo ObserverMemberFunction OctreeFindPointsWithinRadiusDemo OctreeTimingDemo OctreeVisualize OffScreenRendering Opacity OpenVROrientedArrow OpenVROrientedCylinder OpenVRSphere OrientedArrow OrientedBoundingCylinder OrientedCylinder OrientedGlyphs ParametricSpline PassThrough PBR_Anisotropy PBR_Edge_Tint PBR_HDR_Environment PBR_Materials PBR_Materials_Coat PCADemo Picking Planes PlanesIntersection PlaneSourceDemo PointCellIds PointDataSubdivision PointInsideObject2 PointLocatorFindPointsWithinRadiusDemo PointLocatorVisualization PointPicker PointsProjectedHull PolyDataConnectivityFilter_LargestRegion PolyDataConnectivityFilter_SpecifiedRegion PolyDataContourToImageData PolyDataExtractNormals PolyDataGetPoint PolyDataPointSampler PolyDataToImageData PolyDataToUnstructuredGrid PolygonalSurfaceContourLineInterpolator PolygonalSurfacePointPlacer ProcrustesAlignmentFilter ProgrammableFilter ProgrammableGlyphFilter ProgressReport ProjectedTexture QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo QuadricClustering QuadricDecimation QuadricLODActor QuantizePolyDataPoints RadiusOutlierRemoval RandomProbe ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadAllUnstructuredGridTypes ReadLegacyUnstructuredGrid ReadPDB RemoveOutsideSurface RenderView ResamplePolyLine ReverseAccess ReverseSense RotatingSphere Rotations RotationsA RotationsB RotationsC RotationsD RubberBand2D RubberBand2DObserver RubberBand3D RubberBandPick RubberBandZoom SaveSceneToFieldData SaveSceneToFile ScalarBarActor ScalarBarActorColorSeries SceneBounds Screenshot SeedWidget SeedWidgetWithCustomCallback SelectAnActor SelectPolyData SelectVisiblePoints Shadows ShadowsLightsDemo ShareCamera ShepardInterpolation ShiftAndControl ShrinkPolyData SideBySideRenderWindowsQt SideBySideViewports Silhouette SimplePointsWriter Slider Slider2D SourceObjectsDemo SpatterShader SpecularSpheres Sphere SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Stripper StyleSwitch Subdivision SubdivisionDemo SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc TensorEllipsoids TextureCutQuadric TextureCutSphere TexturedButtonWidget TextWidget TissueLens TrackballActor TrackballCamera TransformActorCollection TransformPolyData TransformSphere UserEvent VectorOfActors VertexConnectivity Visualize2DPoints VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree VisualizeStructuredGrid WarpScalar WarpSurface WeightedTransformFilter WindowedSincPolyDataFilter WindowModifiedEvent WindowSize WindowTitle WorldPointPicker WritePLY WriteSTL XMLPUnstructuredGridWriter vtkSphereWidget SphereWidget SphereWidgetEvents vtkSphereWidget2 SphereWidget2 vtkSpiderPlotActor SpiderPlot vtkSplineFilter CurvedReformation FitSplineToCutterOutput ResamplePolyLine vtkSplineWidget2 SplineWidget vtkStaticPointLocator InterpolateFieldDataDemo StaticLocatorFindPointsWithinRadiusDemo vtkStatisticsAlgorithm BoxChart KMeansClustering PCADemo PCAStatistics PKMeansClustering vtkStdString ArrayWriter HistogramBarChart ImageText StringToImageDemo vtkSTLReader AlignTwoPolyDatas BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CapClip CellCentersDemo CellsInsideObject ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CompareExtractSurface ConnectivityFilterDemo Delaunay3DDemo DensifyPoints ExportPolyDataScene ExtractEnclosedPoints ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FillHoles GradientBackground HiddenLineRemoval HighlightSelection ImplicitModeller InterpolateCamera KDTreeFindPointsWithinRadiusDemo LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientedBoundingCylinder PointInterpolator PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataPointSampler PowercrustExtractSurface ProjectedTexture RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadSTL Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation SignedDistance SpatterShader SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Subdivision SubdivisionDemo UnsignedDistance VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree WriteSTL vtkSTLWriter WriteSTL vtkStreamingDemandDrivenPipeline ClipArt ImageClip vtkImageAlgorithmFilter vtkTestAlgorithmFilter vtkTestAlgorithmSource vtkTestFilterProgressFilter vtkTestFilterSelfProgressFilter vtkTestGraphAlgorithmFilter vtkTestGraphAlgorithmSource vtkTestMultipleInputPortsFilter vtkTestPolyDataFilter vtkTestProgressReportFilter vtkTestReader vtkStreamTracer BluntStreamlines CarotidFlow FireFlow FireFlowDemo Kitchen LOx LOxGrid LOxSeeds Office OfficeA OfficeTube PineRootConnectivityA StreamLines StreamlinesWithLineWidget vtkStringArray AxisActor BoxChart CreateTree ExportPolyDataScene LabelPlacementMapper ParallelCoordinatesView PieChart SaveSceneToFieldData StackedBar StackedPlot vtkStripper Bottle CannyEdgeDetector CapClip ExtractPolyLinesFromPolyData ExtrudePolyDataAlongLine FitSplineToCutterOutput FrogBrain FroggieSurface LabelContours MedicalDemo2 MedicalDemo3 PolyDataContourToImageData PseudoVolumeRendering StripFran Stripper vtkStructuredData CellIdFromGridCoordinates GetLinearPointId IntersectLine vtkStructuredGrid BlankPoint BluntStreamlines CutStructuredGrid DumpXMLFile GenericDataObjectReader GetLinearPointId HedgeHog Kitchen LOx LOxGrid LOxSeeds Office OfficeA OfficeTube PineRootConnectivityA ProbeCombustor PseudoVolumeRendering Rainbow SGrid StreamlinesWithLineWidget StructuredDataTypes StructuredGrid StructuredGridOutline TextureThreshold VelocityProfile VisualizeStructuredGrid VisualizeStructuredGridCells WarpCombustor XMLStructuredGridWriter XYPlot vtkStructuredGridGeometryFilter BlankPoint BluntStreamlines CutStructuredGrid Kitchen LOx LOxGrid LOxSeeds Office OfficeA OfficeTube PineRootConnectivityA Rainbow ReadPLOT3D ReadStructuredGrid StructuredGridReader TextureThreshold VelocityProfile VisualizeStructuredGrid WarpCombustor vtkStructuredGridOutlineFilter BluntStreamlines ColorIsosurface CombustorIsosurface CutStructuredGrid Kitchen LOx LOxGrid Office OfficeA OfficeTube PineRootConnectivityA ProbeCombustor PseudoVolumeRendering Rainbow StreamLines StreamlinesWithLineWidget StructuredGridOutline TextureThreshold VelocityProfile WarpCombustor XYPlot vtkStructuredGridReader Kitchen Office OfficeA OfficeTube PineRootConnectivityA StructuredGridReader vtkStructuredPoints CarotidFlowGlyphs Lorenz StructuredPointsToUnstructuredGrid Vol vtkStructuredPointsReader AnimateVectors CarotidFlow CarotidFlowGlyphs ComplexV ExtractLargestIsosurface IntermixedUnstructuredGrid IronIsoSurface MinIntensityRendering Motor SimpleRayCast StructuredPointsReader TextureCutSphere TextureThreshold vtkSubPixelPositionEdgels CannyEdgeDetector vtkSuperquadric ExtractPointsDemo SampleFunction vtkSuperquadricSource BackgroundImage CubeAxesActor CurvatureBandsWithGlyphs CurvaturesDemo ElevationBandsWithGlyphs EllipticalButton OrientationMarkerWidget1 PointDataSubdivision SolidClip vtkSurfaceReconstructionFilter SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc vtkTable AdjacencyMatrixToEdgeTable AreaPlot ArrayToTable BarChart BarChartQt BoxChart ChartMatrix ChartsOn3DScene ConstructTable DelimitedTextReader DelimitedTextWriter FunctionalBagPlot KDTreeTimingDemo KMeansClustering LinePlot ModifiedBSPTreeTimingDemo MultiplePlots OBBTreeTimingDemo OctreeTimingDemo ParallelCoordinates ParallelCoordinatesView PCADemo PCAStatistics PieChart PKMeansClustering PlotLine3D ScatterPlot StackedBar StackedPlot SurfacePlot vtkTableBasedClipDataSet ClipUnstructuredGridWithPlane TableBasedClipDataSetWithPolyData TableBasedClipDataSetWithPolyData2 vtkTableToPolyData PointInterpolator vtkTensorGlyph TensorAxes TensorEllipsoids TensorGlyph vtkTessellatedBoxSource OpenVRTessellatedBoxSource TessellatedBoxSource vtkTessellatorFilter CellTypeSource QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo vtkTetra Cell3DDemonstration CellTypeSource LinearCellDemo Tetrahedron WriteLegacyLinearCells WriteVTU WriteXMLLinearCells vtkTextActor Arbitrary3DCursor CameraModel1 CameraModel2 CaptionWidget ChooseTextColor ChooseTextColorDemo CollisionDetection DrawText MovableAxes PlatonicSolids PointDataSubdivision TextActor TextWidget vtkTextMapper BozoShaderDemo Cell3DDemonstration CellTypeSource CompareExtractSurface CompareRandomGeneratorsCxx CurvaturesAdjustEdges CurvaturesDemo Delaunay3D Delaunay3DDemo FontFile GeometricObjectsDemo GradientBackground IsoparametricCellsDemo KochanekSplineDemo LinearCellDemo MultiLineText ParametricObjectsDemo Planes PlatonicSolids PointDataSubdivision QuadraticHexahedronDemo QuadraticTetraDemo ReadAllPolyDataTypesDemo ReadDICOMSeries RescaleReverseLUT ResizeImageDemo SourceObjectsDemo vtkTextProperty AnatomicalOrientation Arbitrary3DCursor AreaPlot Axes AxisActor BarChart BarChartQt BillboardTextActor3D BoxChart BozoShaderDemo CameraModel1 CameraModel2 CaptionActor2D CaptionWidget Cell3DDemonstration CellLocatorVisualization CellTypeSource ChooseTextColor ChooseTextColorDemo CollisionDetection ColoredAnnotatedCube ColorVertexLabels CompareExtractSurface CompareRandomGeneratorsCxx CornerAnnotation CubeAxesActor CubeAxesActor2D CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo Delaunay3D Delaunay3DDemo Diagram DrawText ElevationBandsWithGlyphs FontFile FroggieSurface FroggieView GeometricObjectsDemo GradientBackground Histogram2D ImageText IsoparametricCellsDemo KochanekSplineDemo LabelContours LabeledDataMapper LabeledMesh LabelPlacementMapper LabelVerticesAndEdges LinearCellDemo MultiLineText OctreeVisualize ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PickPixel PickPixel2 PieChartActor Planes PlatonicSolids PointDataSubdivision PointLocatorVisualization QuadraticHexahedronDemo QuadraticTetraDemo ReadAllPolyDataTypesDemo ReadDICOMSeries RescaleReverseLUT ResizeImageDemo Slider2D SourceObjectsDemo SpiderPlot StackedBar StringToImageDemo TextActor TextWidget VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree WordCloud XYPlot vtkTextRepresentation TextWidget vtkTextSource SourceObjectsDemo TextSource vtkTexture AnimateVectors ClipArt CubeMap DecimateFran EllipticalButton FrogSlice Motor OBJImporter PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ProjectedTexture SphereMap StippledLine TextureCutQuadric TextureCutSphere TexturedSphere TextureMapImageData TextureMapPlane TextureMapQuad TexturePlane TextureThreshold vtkTexturedButtonRepresentation2D TexturedButtonWidget vtkTexturedSphereSource CurvaturesAdjustEdges PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing TexturedSphere vtkTextureMapToPlane ClipArt TextureMapPlane vtkTextureMapToSphere PBR_Anisotropy TexturedSphere vtkTextWidget TextWidget vtkThinPlateSplineTransform ThinPlateSplineTransform vtkThreshold CannyEdgeDetector GenerateCubesFromLabels GenerateModelsFromLabels HighlightBadCells IntermixedUnstructuredGrid IntersectLine PointOccupancy RandomProbe SplitPolyData ThresholdCells vtkThresholdPoints AnimateVectors CarotidFlow CarotidFlowGlyphs MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD RandomProbe ThresholdPoints VectorFieldNonZeroExtraction vtkThresholdTextureCoords TextureThreshold vtkTIFFReader PickPixel2 ReadTIFF WriteTIFF vtkTIFFWriter ImageWriter WriteTIFF vtkTimerLog CompareExtractSurface CorrectlyRenderTranslucentGeometry KDTreeTimingDemo ModifiedBSPTreeTimingDemo OBBTreeTimingDemo OctreeTimingDemo SaveSceneToFile TimerLog vtkTimeSourceExample ExodusIIWriter vtkTimeStamp TimeStamp vtkToneMappingPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkTransform AffineWidget AlignFrames AlignTwoPolyDatas AnatomicalOrientation Assembly Axes BlobbyLogo BoxWidget BoxWidget2 BozoShader BozoShaderDemo CameraModel1 CameraModel2 CellsInsideObject ClipSphereCylinder ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 CollisionDetection ColoredAnnotatedCube CombineImportedActors ContoursToSurface CorrectlyRenderTranslucentGeometry CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs EllipticalCylinderDemo ExponentialCosine ExportPolyDataScene ExternalContour ExtractData ExtrudePolyDataAlongLine FroggieSurface FroggieView FrogSlice Game GenerateCubesFromLabels GLTFExporter ImageRotate IndividualVRML IterativeClosestPointsTransform LayeredActors MarbleShader MarbleShaderDemo MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MarkKeypoints OpenVROrientedArrow OpenVROrientedCylinder OrientedArrow OrientedCylinder PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PCADemo PerspectiveTransform PlaneSourceDemo ProbeCombustor ProcrustesAlignmentFilter ResampleAppendedPolyData RotationAroundLine SpatterShader SpikeFran Stocks StructuredDataTypes SurfaceFromUnorganizedPointsWithPostProc TransformActor TransformActorCollection TransformFilter TransformOrderDemo TransformPipeline TransformPolyData TransformSphere Tutorial_Step6 WalkCow WalkCowA WalkCowB WeightedTransformFilter XYPlot vtkTransformFilter AlignFrames CameraModel1 CameraModel2 CurvaturesDemo GenerateCubesFromLabels TransformFilter TransformSphere WeightedTransformFilter vtkTransformPolyDataFilter AlignTwoPolyDatas AnatomicalOrientation BlobbyLogo BozoShader BozoShaderDemo CameraModel1 CameraModel2 CellsInsideObject ColoredAnnotatedCube CombineImportedActors ContoursToSurface CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs EllipticalCylinderDemo ExponentialCosine ExternalContour ExtrudePolyDataAlongLine FroggieSurface FroggieView FrogSlice Game GLTFExporter IterativeClosestPointsTransform LandmarkTransform MarbleShader MarbleShaderDemo MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MarkKeypoints OpenVROrientedArrow OpenVROrientedCylinder OrientedArrow OrientedCylinder PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PCADemo PlaneSourceDemo ProbeCombustor ProcrustesAlignmentFilter ResampleAppendedPolyData RotationAroundLine SpatterShader SpikeFran Stocks SurfaceFromUnorganizedPointsWithPostProc TransformPolyData XYPlot vtkTransformTextureCoords TexturedSphere vtkTree BoostBreadthFirstSearchTree BreadthFirstDistance ConstructTree CreateTree DepthFirstSearchAnimation DepthFirstSearchIterator MinimumSpanningTree TreeBFSIterator TreeToMutableDirectedGraph vtkTreeBFSIterator TreeBFSIterator vtkTreeDFSIterator DepthFirstSearchAnimation DepthFirstSearchIterator vtkTreeMapView TreeMapView vtkTriangle AddCell CellEdges KochSnowflake LinearCellDemo MiscCellData ThresholdCells Triangle TriangleArea TriangleColoredPoints TriangleSolidColor WriteLegacyLinearCells WriteXMLLinearCells vtkTriangleFilter BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CellEdgeNeighbors CellPicking CellPointNeighbors ClipArt CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo Decimation ElevationBandsWithGlyphs HighlightBadCells ImageToPolyDataFilter LinearExtrusion LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties MeshQuality PBR_Clear_Coat PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision PolygonalSurfaceContourLineInterpolator QuadricDecimation SpatterShader Subdivision SubdivisionDemo Triangulate VertexConnectivity vtkTriangleMeshPointNormals BozoShader BozoShaderDemo ColorByNormal MarbleShader MarbleShaderDemo vtkTriangleStrip LinearCellDemo TriangleStrip WriteLegacyLinearCells WriteXMLLinearCells vtkTriQuadraticHexahedron IsoparametricCellsDemo vtkTubeFilter Bottle CarotidFlow DelaunayMesh EllipticalCylinderDemo Finance FinanceFieldData FireFlow FireFlowDemo FitSplineToCutterOutput GradientFilter LOx LOxGrid LOxSeeds MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD OfficeTube OrientedBoundingCylinder PointsProjectedHull PseudoVolumeRendering ReadLegacyUnstructuredGrid ReadPDB Stocks TensorAxes TubeFilter TubesFromSplines TubesWithVaryingRadiusAndColors WarpTo XYPlot vtkTupleInterpolator 1DTupleInterpolation TubesFromSplines vtkUndirectedGraph vtkTestGraphAlgorithmSource XGMLReader vtkUniformGrid Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse OverlappingAMR vtkUnsignedCharArray AdjacentVertexIterator AssignCellColorsFromLUT BackgroundTexture ColorCellsWithRGB ColoredAnnotatedCube ColoredElevationMap ColoredLines ColoredPoints ColorGlyphs CombineImportedActors Delaunay3D Delaunay3DDemo DepthFirstSearchAnimation ElevationFilter ExportPolyDataScene FindCellIntersections Glyph3DMapper IterativeClosestPointsTransform LandmarkTransform ShepardMethod SimpleElevationFilter TriangleColoredPoints TriangleSolidColor TubesWithVaryingRadiusAndColors VRMLImporterDemo vtkUnsignedDistance UnsignedDistance vtkUnstructuredGrid AppendFilter Blow BoxClipUnstructuredGrid Cell3DDemonstration CellPicking CellsInsideObject CellTypeSource ClipDataSetWithPolyData ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ConvexPointSet CreateESGrid DataSetSurface DataSetSurfaceFilter Delaunay3D Delaunay3DDemo DumpXMLFile ExtractCellsUsingPoints ExtractSelection ExtractSelectionCells ExtractSelectionOriginalId Finance FindCellIntersections FireFlow FireFlowDemo GenericClip GenericDataObjectReader GeometryFilter Hexahedron HighlightBadCells InterpolateFieldDataDemo IntersectLine IsoparametricCellsDemo LinearCellDemo MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MoveAVertexUnstructuredGrid NOVCAGraph PointInsideObject2 PolyDataToUnstructuredGrid Polyhedron Pyramid QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo ReadAllUnstructuredGridTypes ReadLegacyUnstructuredGrid ReadUnknownTypeXMLFile RectilinearGridToTetrahedra ScalarBarWidget SelectAVertex StructuredPointsToUnstructuredGrid TableBasedClipDataSetWithPolyData Tetrahedron ThresholdCells TissueLens UGrid VisualizeStructuredGridCells VoxelsOnBoundary WriteLegacyLinearCells WriteVTU WriteXMLLinearCells vtkUnstructuredGridReader BoxClipUnstructuredGrid ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 DataSetSurfaceFilter GeometryFilter GradientFilter MatrixMathFilter ReadAllUnstructuredGridTypes ReadLegacyUnstructuredGrid ScalarBarWidget vtkUnstructuredGridToExplicitStructuredGrid CreateESGrid LoadESGrid vtkUnstructuredGridVolumeRayCastMapper IntermixedUnstructuredGrid vtkUnstructuredGridWriter WriteLegacyLinearCells vtkValuePass RenderScalarToFloatBuffer vtkVariant ConstructTable CurvatureBandsWithGlyphs CustomDenseArray DelimitedTextWriter ElevationBandsWithGlyphs KMeansClustering LUTUtilities PickPixel PickPixel2 PKMeansClustering ReadLegacyUnstructuredGrid Variant vtkVariantArray ConstructTable CurvatureBandsWithGlyphs DelimitedTextWriter ElevationBandsWithGlyphs LUTUtilities ReadLegacyUnstructuredGrid vtkVector MultiBlockDataSet Vector vtkVector2d SurfacePlot vtkVector2f ChartMatrix vtkVector2i ChartMatrix SurfacePlot vtkVector3d AnimateActors MultiBlockDataSet Vector vtkVectorDot DisplacementPlot PlateVibration VectorDot vtkVectorNorm VectorNorm vtkVectorText AlphaFrequency AnatomicalOrientation FinanceFieldData Follower LinearExtrusion MarchingCases MarchingCasesA MarchingCasesB MarchingCasesC MarchingCasesD MarkKeypoints Morph3D MovableAxes Stocks TextOrigin VectorText vtkVersion AlignTwoPolyDatas AreaPlot BarChart BarChartQt BorderWidgetQt BozoShader BozoShaderDemo ChartMatrix ChartsOn3DScene CheckVTKVersion ColorByNormal CompositePolyDataMapper CubeMap CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo DiscreteMarchingCubes ElevationBandsWithGlyphs EventQtSlotConnect ExternalContour ExtractLargestIsosurface FrogBrain FunctionalBagPlot GenerateModelsFromLabels Hanoi HeadBone HighlightSelectedPoints HighlightSelection HyperTreeGridSource ImplicitDataSetClipping ImportPolyDataScene IsosurfaceSampling MarbleShader MarbleShaderDemo MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 MultiplePlots NullPoint OutlineGlowPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PlotLine3D PointCellIds RenderScalarToFloatBuffer RenderWindowNoUiFile RenderWindowUISingleInheritance Screenshot ShareCameraQt SideBySideRenderWindowsQt SpatterShader SphereMap SurfacePlot TissueLens ZBuffer vtkVertex DataSetSurfaceFilter GeometryFilter LinearCellDemo Vertex WriteLegacyLinearCells WriteXMLLinearCells vtkVertexGlyphFilter Actor2D AlignFrames BackgroundTexture ColoredPoints Delaunay2D DelimitedTextReader HighlightSelectedPoints ImplicitPolyDataDistance IterativeClosestPointsTransform KDTreeAccessPoints KMeansClustering LandmarkTransform MaskPoints MoveAVertexUnstructuredGrid PCADemo PKMeansClustering PointInsideObject PointInsideObject2 ProgrammableSource ReadTextFile SelectAVertex ShepardMethod SideBySideViewports TriangulateTerrainMap VertexConnectivity VertexGlyphFilter vtkViewport GradientBackground vtkViewTheme AdjacentVertexIterator ColorEdges ColorVerticesLookupTable CreateTree DepthFirstSearchAnimation ScaleVertices TreeMapView XGMLReader vtkVolume FixedPointVolumeRayCastMapperCT IntermixedUnstructuredGrid MedicalDemo4 MinIntensityRendering OpenVRVolume RayCastIsosurface SimpleRayCast vtkVolumeProperty FixedPointVolumeRayCastMapperCT IntermixedUnstructuredGrid MedicalDemo4 MinIntensityRendering OpenVRVolume RayCastIsosurface SimpleRayCast vtkVoxel Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkVoxelContoursToSurfaceFilter ContoursToSurface vtkVoxelModeller MarchingCubes vtkVRMLExporter ImportToExport vtkVRMLImporter CombineImportedActors FireFlow FireFlowDemo ImportToExport IndividualVRML VRMLImporter VRMLImporterDemo vtkWarpScalar ExponentialCosine FitToHeightMap ImageWarp InterpolateMeshOnGrid WarpCombustor WarpScalar vtkWarpTo CameraModel1 CameraModel2 WarpTo vtkWarpVector Blow DisplacementPlot PlateVibration VelocityProfile WarpSurface WarpVector vtkWedge Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkWeightedTransformFilter WeightedTransformFilter vtkWidgetCallbackMapper BorderWidget BorderWidgetQt vtkWidgetEvent BorderWidget BorderWidgetQt vtkWindow AnimateActors vtkWindowedSincPolyDataFilter FrogBrain FroggieSurface GenerateModelsFromLabels SmoothDiscreteMarchingCubes WindowedSincPolyDataFilter vtkWindowLevelLookupTable CurvedReformation FrogSlice VTKSpectrum vtkWindowToImageFilter EarthSource ExternalContour Hanoi HanoiInitial HanoiIntermediate ImageWriter OffScreenRendering ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing RenderScalarToFloatBuffer Screenshot WalkCow WalkCowA WalkCowB ZBuffer vtkWordCloud WordCloudDemo vtkWorldPointPicker WorldPointPicker vtkX3DExporter ImportToExport vtkXGMLReader XGMLReader vtkXMLCompositeDataReader DumpXMLFile vtkXMLDataSetWriter WriteXMLLinearCells vtkXMLGenericDataObjectReader ExtractFaces ReadUnknownTypeXMLFile vtkXMLImageDataReader DumpXMLFile FixedPointVolumeRayCastMapperCT ReadImageData WriteVTI vtkXMLImageDataWriter Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse ImageImport IsoContours RenderScalarToFloatBuffer StructuredDataTypes VectorFieldNonZeroExtraction WriteVTI vtkXMLMultiBlockDataReader ImportPolyDataScene vtkXMLMultiBlockDataWriter ExportPolyDataScene Generate2DAMRDataSetWithPulse Generate3DAMRDataSetWithPulse vtkXMLPImageDataWriter XMLPImageDataWriter vtkXMLPolyDataReader AlignTwoPolyDatas AnatomicalOrientation Arbitrary3DCursor AssignCellColorsFromLUT BooleanOperationPolyDataFilter BozoShader BozoShaderDemo CameraOrientationWidget CapClip CellCentersDemo CellsInsideObject ClipClosedSurface ClipFrustum ClosedSurface ColorByNormal ColorDisconnectedRegionsDemo CombinePolyData CompareExtractSurface ConnectivityFilterDemo ContoursFromPolyData ConvertFile ConvexHull Curvatures CutWithCutFunction CutWithScalars DataBounds DataStructureComparison Decimation DeformPointSet Delaunay3D Delaunay3DDemo DensifyPoints DetermineArrayDataTypes DumpXMLFile EmbedPointsIntoVolume ExportPolyDataScene ExternalContour ExtractEnclosedPoints ExtractOutsideSurface ExtractSurface ExtractSurfaceDemo ExtrudePolyDataAlongLine FileOutputWindow FilledContours FillHoles FindAllArrayNames FitSplineToCutterOutput GetMiscCellData GetMiscPointData GradientBackground HiddenLineRemoval HighlightSelection IdentifyHoles ImplicitModeller ImplicitPlaneWidget2 InterpolateCamera IterativeClosestPointsTransform KDTreeFindPointsWithinRadiusDemo LabelContours LoopBooleanPolyDataFilter MarbleShader MarbleShaderDemo MassProperties MiscPointData NormalsDemo OBBDicer OctreeFindPointsWithinRadiusDemo OrientationMarkerWidget1 OrientedBoundingCylinder PointLocatorFindPointsWithinRadiusDemo PointOccupancy PoissonExtractSurface PolyDataExtractNormals PolyDataIsoLines PolyDataPointSampler PolyDataRIB PolygonalSurfaceContourLineInterpolator PowercrustExtractSurface ProjectedTexture QuadricClustering QuadricDecimation RadiusOutlierRemoval ReadAllPolyDataTypes ReadAllPolyDataTypesDemo ReadPolyData RemoveOutsideSurface RemoveVertices RenderLargeImage ResamplePolyLine Rotations RotationsA RotationsB RotationsC RotationsD SaveSceneToFieldData SaveSceneToFile Shadows ShepardInterpolation ShrinkPolyData SideBySideViewports SignedDistance Silhouette SpatterShader SphereMap SplitPolyData StaticLocatorFindPointsWithinRadiusDemo Subdivision SubdivisionDemo SurfaceFromUnorganizedPoints SurfaceFromUnorganizedPointsWithPostProc UnsignedDistance Visualize2DPoints VisualizeKDTree VisualizeModifiedBSPTree VisualizeOBBTree VisualizeVTP WarpSurface ZBuffer vtkXMLPolyDataWriter AlignFrames AssignCellColorsFromLUT ElevationFilter FindAllArrayNames GenerateModelsFromLabels ImplicitDataSetClipping InterpolateMeshOnGrid InterpolateTerrain KMeansClustering MatrixMathFilter MiscCellData PKMeansClustering PolyDataContourToImageData PolyDataIsoLines ReadPlainTextTriangles RemoveVertices SplitPolyData VectorFieldNonZeroExtraction WriteVTP vtkXMLPUnstructuredGridWriter XMLPUnstructuredGridWriter vtkXMLReader DumpXMLFile vtkXMLRectilinearGridReader DumpXMLFile ReadRectilinearGrid vtkXMLRectilinearGridWriter StructuredDataTypes vtkXMLStructuredGridReader DumpXMLFile ReadStructuredGrid vtkXMLStructuredGridWriter ImageDataToPointSet StructuredDataTypes XMLStructuredGridWriter vtkXMLTreeReader TreeMapView vtkXMLUniformGridAMRReader Generate3DAMRDataSetWithPulse vtkXMLUnstructuredGridReader DumpXMLFile FindCellIntersections FireFlow FireFlowDemo LoadESGrid ReadAllUnstructuredGridTypes ReadUnstructuredGrid WriteVTU vtkXMLUnstructuredGridWriter NOVCAGraph PolyDataToUnstructuredGrid Polyhedron RectilinearGridToTetrahedra StructuredPointsToUnstructuredGrid WriteVTU vtkXYPlotActor XYPlot"},{"location":"Cxx/DataStructures/BuildLocatorFromKClosestPoints/","title":"BuildLocatorFromKClosestPoints","text":"

        vtk-examples/Cxx/DataStructures/BuildLocatorFromKClosestPoints

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/BuildLocatorFromKClosestPoints/#code","title":"Code","text":"

        BuildLocatorFromKClosestPoints.cxx

        #include <vtkIdList.h>\n#include <vtkKdTree.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n\nint main(int, char*[])\n{\n  // Create some points\n  double origin[3] = {0.0, 0.0, 0.0};\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(origin);\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  // Create the tree\n  vtkNew<vtkKdTree> pointTree;\n  pointTree->BuildLocatorFromPoints(points);\n\n  // Find the 2 closest points to (0.5,0,0)\n  vtkIdType k = 2;\n  double testPoint[3] = {0.5, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n\n  pointTree->FindClosestNPoints(k, testPoint, result);\n\n  for (vtkIdType i = 0; i < k; i++)\n  {\n    vtkIdType point_ind = result->GetId(i);\n    double p[3];\n    points->GetPoint(point_ind, p);\n    std::cout << \"Closest point \" << i << \": Point \" << point_ind << \": (\"\n              << p[0] << \", \" << p[1] << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/BuildLocatorFromKClosestPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BuildLocatorFromKClosestPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BuildLocatorFromKClosestPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BuildLocatorFromKClosestPoints MACOSX_BUNDLE BuildLocatorFromKClosestPoints.cxx )\n  target_link_libraries(BuildLocatorFromKClosestPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BuildLocatorFromKClosestPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/BuildLocatorFromKClosestPoints/#download-and-build-buildlocatorfromkclosestpoints","title":"Download and Build BuildLocatorFromKClosestPoints","text":"

        Click here to download BuildLocatorFromKClosestPoints and its CMakeLists.txt file. Once the tarball BuildLocatorFromKClosestPoints.tar has been downloaded and extracted,

        cd BuildLocatorFromKClosestPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BuildLocatorFromKClosestPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/BuildOctree/","title":"BuildOctree","text":"

        vtk-examples/Cxx/DataStructures/BuildOctree

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/BuildOctree/#code","title":"Code","text":"

        BuildOctree.cxx

        #include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  // Setup point coordinates\n  double x[3]{1.0, 0.0, 0.0};\n  double y[3]{0.0, 1.0, 0.0};\n  double z[3]{0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n\n  for (unsigned int i = 0; i < 3; ++i)\n  {\n    points->InsertNextPoint(x[i], y[i], z[i]);\n  }\n\n  std::cout << \"There are \" << points->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetDataSet(polydata);\n  octree->BuildLocator();\n\n  std::cout << \"Number of points in tree: \"\n            << octree->GetDataSet()->GetNumberOfPoints() << std::endl;\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    octree->GetDataSet()->GetPoint(i, p);\n    std::cout << \"Point Id: \" << i << \": Point: (\" << p[0] << \", \" << p[1]\n              << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/BuildOctree/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BuildOctree)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BuildOctree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BuildOctree MACOSX_BUNDLE BuildOctree.cxx )\n  target_link_libraries(BuildOctree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BuildOctree\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/BuildOctree/#download-and-build-buildoctree","title":"Download and Build BuildOctree","text":"

        Click here to download BuildOctree and its CMakeLists.txt file. Once the tarball BuildOctree.tar has been downloaded and extracted,

        cd BuildOctree/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BuildOctree\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/ClosestNPoints/","title":"ClosestNPoints","text":"

        vtk-examples/Cxx/DataStructures/ClosestNPoints

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/ClosestNPoints/#code","title":"Code","text":"

        ClosestNPoints.cxx

        #include <vtkIdList.h>\n#include <vtkKdTreePointLocator.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n\nint main(int, char*[])\n{\n  // Create some random points\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(10);\n  pointSource->Update();\n\n  // Create the tree\n  vtkNew<vtkKdTreePointLocator> pointTree;\n  pointTree->SetDataSet(pointSource->GetOutput());\n  pointTree->BuildLocator();\n\n  // Find the k closest points to (0,0,0)\n  unsigned int k = 1;\n  double testPoint[3] = {0.0, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n\n  pointTree->FindClosestNPoints(k, testPoint, result);\n\n  for (vtkIdType i = 0; i < k; i++)\n  {\n    vtkIdType point_ind = result->GetId(i);\n    double p[3];\n    pointSource->GetOutput()->GetPoint(point_ind, p);\n    std::cout << \"Closest point \" << i << \": Point \" << point_ind << \": (\"\n              << p[0] << \", \" << p[1] << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  // Should return:\n  // Closest point 0: Point 2: (-0.136162, -0.0276359, 0.0369441)\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/ClosestNPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClosestNPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClosestNPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClosestNPoints MACOSX_BUNDLE ClosestNPoints.cxx )\n  target_link_libraries(ClosestNPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClosestNPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/ClosestNPoints/#download-and-build-closestnpoints","title":"Download and Build ClosestNPoints","text":"

        Click here to download ClosestNPoints and its CMakeLists.txt file. Once the tarball ClosestNPoints.tar has been downloaded and extracted,

        cd ClosestNPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClosestNPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/DataStructureComparison/","title":"DataStructureComparison","text":"

        vtk-examples/Cxx/DataStructures/DataStructureComparison

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/DataStructureComparison/#description","title":"Description","text":"

        Prior to August 20, 2010, the vtkModifiedBSPTree.cxx did not produce a proper data representation. To operate properly, update your vtk source tree.

        Use the 'n' key (for 'N'ext) and the 'p' key (for 'P'revious) to navigate the levels of the trees.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/DataStructureComparison/#code","title":"Code","text":"

        DataStructureComparison.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkKdTreePointLocator.h>\n#include <vtkModifiedBSPTree.h>\n#include <vtkOBBTree.h>\n#include <vtkOctreePointLocator.h>\n\n#include <vector>\n\nnamespace {\nclass KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static KeyPressInteractorStyle* New();\n  vtkSmartPointer<vtkPolyData> data;\n  std::vector<vtkRenderer*> renderers;\n  std::vector<vtkSmartPointer<vtkLocator>> trees;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n\n  vtkSmartPointer<vtkPolyDataMapper> meshMapper;\n  vtkSmartPointer<vtkActor> meshActor;\n\n  void Initialize()\n  {\n    this->meshMapper->SetInputData(this->data);\n    for (unsigned int i = 0; i < 4; i++)\n    {\n      vtkSmartPointer<vtkPolyDataMapper> mapper =\n          vtkSmartPointer<vtkPolyDataMapper>::New();\n      this->mappers.push_back(mapper);\n      vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();\n      actor->SetMapper(mapper);\n      actor->GetProperty()->SetRepresentationToWireframe();\n      this->actors.push_back(actor);\n      this->renderers[i]->AddActor(actor);\n\n      this->renderers[i]->AddActor(meshActor);\n    }\n    this->Level = 1;\n    std::cout << \"Level = \" << this->Level << std::endl;\n    this->ReDraw();\n  }\n\n  KeyPressInteractorStyle()\n  {\n    this->Level = 1;\n\n    vtkSmartPointer<vtkLocator> tree0 =\n        vtkSmartPointer<vtkKdTreePointLocator>::New();\n    this->trees.push_back(tree0);\n    vtkSmartPointer<vtkLocator> tree1 = vtkSmartPointer<vtkOBBTree>::New();\n    this->trees.push_back(tree1);\n    vtkSmartPointer<vtkLocator> tree2 =\n        vtkSmartPointer<vtkOctreePointLocator>::New();\n    this->trees.push_back(tree2);\n    vtkSmartPointer<vtkLocator> tree3 =\n        vtkSmartPointer<vtkModifiedBSPTree>::New();\n    this->trees.push_back(tree3);\n\n    this->meshMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n    this->meshActor = vtkSmartPointer<vtkActor>::New();\n    this->meshActor->SetMapper(this->meshMapper);\n  }\n\n  virtual void OnChar()\n  {\n    char ch = this->Interactor->GetKeyCode();\n\n    switch (ch)\n    {\n    case 'n':\n      this->Level++;\n      break;\n    case 'p':\n      if (this->Level > 1)\n      {\n        this->Level--;\n      }\n      break;\n    default:\n      std::cout << \"An unhandled key was pressed.\" << std::endl;\n      break;\n    }\n\n    this->ReDraw();\n\n    // Forward events.\n    if (ch != 'p') // Don't forward the \"pick\" command.\n    {\n      vtkInteractorStyleTrackballCamera::OnChar();\n    }\n  }\n\n  void ReDraw()\n  {\n\n    std::cout << \"Level \" << this->Level << std::endl;\n    for (unsigned i = 0; i < 4; i++)\n    {\n\n      vtkSmartPointer<vtkLocator> tree = this->trees[i];\n      // vtkRenderer* renderer = this->renderers[i];\n\n      tree->SetDataSet(data);\n      tree->BuildLocator();\n\n      vtkSmartPointer<vtkPolyData> polydata =\n          vtkSmartPointer<vtkPolyData>::New();\n      std::cout << \"Tree \" << i << \" has \" << tree->GetLevel() << \" levels.\"\n                << std::endl;\n\n      if (this->Level > tree->GetLevel())\n      {\n        tree->GenerateRepresentation(tree->GetLevel(), polydata);\n      }\n      else\n      {\n        tree->GenerateRepresentation(this->Level, polydata);\n      }\n\n      this->mappers[i]->SetInputData(polydata);\n    }\n\n    this->Interactor->GetRenderWindow()->Render();\n  }\n\nprivate:\n  int Level;\n};\n\nvtkStandardNewMacro(KeyPressInteractorStyle);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkPolyData> originalMesh;\n\n  if (argc > 1) // If a file name is specified, open and use the file.\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    originalMesh->ShallowCopy(reader->GetOutput());\n  }\n  else // If a file name is not specified, create a random cloud of points.\n  {\n    vtkNew<vtkPointSource> sphereSource;\n    sphereSource->SetNumberOfPoints(1000);\n\n    sphereSource->Update();\n    originalMesh->ShallowCopy(sphereSource->GetOutput());\n  }\n\n  double numberOfViewports = 4.;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(200 * numberOfViewports, 200); //(width, height)\n  renderWindow->SetWindowName(\"DataStructureComparison\");\n\n  vtkNew<KeyPressInteractorStyle> style;\n  style->data = originalMesh;\n\n  vtkNew<vtkCamera> camera;\n\n  for (unsigned int i = 0; i < 4; i++)\n  {\n    vtkNew<vtkRenderer> renderer;\n    renderWindow->AddRenderer(renderer);\n    style->renderers.push_back(renderer);\n    renderer->SetViewport(static_cast<double>(i) / numberOfViewports, 0,\n                          static_cast<double>(i + 1) / numberOfViewports, 1);\n    renderer->SetBackground(0.2, 0.3, 0.4);\n    renderer->SetActiveCamera(camera);\n  }\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->Initialize();\n  style->renderers[0]->ResetCamera();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/DataStructureComparison/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataStructureComparison)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersFlowPaths\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataStructureComparison: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataStructureComparison MACOSX_BUNDLE DataStructureComparison.cxx )\n  target_link_libraries(DataStructureComparison PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataStructureComparison\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/DataStructureComparison/#download-and-build-datastructurecomparison","title":"Download and Build DataStructureComparison","text":"

        Click here to download DataStructureComparison and its CMakeLists.txt file. Once the tarball DataStructureComparison.tar has been downloaded and extracted,

        cd DataStructureComparison/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DataStructureComparison\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/IncrementalOctreePointLocator/","title":"IncrementalOctreePointLocator","text":"

        vtk-examples/Cxx/DataStructures/IncrementalOctreePointLocator

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/IncrementalOctreePointLocator/#code","title":"Code","text":"

        IncrementalOctreePointLocator.cxx

        #include <vtkIncrementalOctreePointLocator.h>\n#include <vtkMath.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\n#include <cmath>\n\nint main(int, char*[])\n{\n  // Setup point coordinates.\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create the tree\n  vtkNew<vtkIncrementalOctreePointLocator> octree;\n  octree->SetDataSet(polydata);\n  octree->BuildLocator();\n\n  auto pointCoordinates = [](double* pt) {\n    std::cout << \"Coordinates: \" << pt[0] << \" \" << pt[1] << \" \" << pt[2]\n              << std::endl;\n  };\n  double testPoint[3] = {2.0, 0.0, 0.0};\n  std::cout << \"Test Point \";\n  pointCoordinates(testPoint);\n\n  auto closestPoint = [&octree, pointCoordinates](double* testPoint) {\n    // Find the closest points to TestPoint.\n    vtkIdType id = octree->FindClosestPoint(testPoint);\n    std::cout << \"The closest point is point \" << id << std::endl;\n\n    // Get the coordinates of the closest point.\n    double pt[3];\n    octree->GetDataSet()->GetPoint(id, pt);\n    pointCoordinates(pt);\n    std::cout << \"Distance: \"\n              << std::sqrt(vtkMath::Distance2BetweenPoints(testPoint, pt))\n              << std::endl;\n  };\n\n  closestPoint(testPoint);\n\n  // Insert another point.\n  double pnew[3] = {2.1, 0, 0};\n  octree->InsertNextPoint(pnew);\n\n  closestPoint(testPoint);\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/IncrementalOctreePointLocator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IncrementalOctreePointLocator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IncrementalOctreePointLocator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IncrementalOctreePointLocator MACOSX_BUNDLE IncrementalOctreePointLocator.cxx )\n  target_link_libraries(IncrementalOctreePointLocator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IncrementalOctreePointLocator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/IncrementalOctreePointLocator/#download-and-build-incrementaloctreepointlocator","title":"Download and Build IncrementalOctreePointLocator","text":"

        Click here to download IncrementalOctreePointLocator and its CMakeLists.txt file. Once the tarball IncrementalOctreePointLocator.tar has been downloaded and extracted,

        cd IncrementalOctreePointLocator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IncrementalOctreePointLocator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/KDTreeAccessPoints/","title":"KDTreeAccessPoints","text":"

        vtk-examples/Cxx/DataStructures/KDTreeAccessPoints

        "},{"location":"Cxx/DataStructures/KDTreeAccessPoints/#description","title":"Description","text":"

        This example demonstrates how to build a KDTree, get its number of points, and get a point by ID.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/KDTreeAccessPoints/#code","title":"Code","text":"

        KDTreeAccessPoints.cxx

        #include <vtkDataSetCollection.h>\n#include <vtkKdTree.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  // Setup point coordinates.\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // The tree needs cells, so add vertices to each point.\n  vtkNew<vtkVertexGlyphFilter> vertexFilter;\n  vertexFilter->SetInputData(polydata);\n  vertexFilter->Update();\n\n  // Create the tree.\n  vtkNew<vtkKdTree> kDTree;\n  kDTree->AddDataSet(vertexFilter->GetOutput());\n  kDTree->BuildLocator();\n\n  // Get the number of points in the tree like this:\n  kDTree->GetDataSets()->InitTraversal();\n  std::cout << \"Number of points in tree: \"\n            << kDTree->GetDataSets()->GetNextDataSet()->GetNumberOfPoints()\n            << std::endl;\n\n  // Or you can get the number of points in the tree like this:\n  std::cout << \"Number of points in tree: \"\n            << kDTree->GetDataSet(0)->GetNumberOfPoints() << std::endl;\n\n  // Get the 0th point in the tree.\n  double p[3];\n  kDTree->GetDataSet(0)->GetPoint(0, p);\n  std::cout << \"p: \" << p[0] << \" \" << p[1] << \" \" << p[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/KDTreeAccessPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KDTreeAccessPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KDTreeAccessPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KDTreeAccessPoints MACOSX_BUNDLE KDTreeAccessPoints.cxx )\n  target_link_libraries(KDTreeAccessPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KDTreeAccessPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/KDTreeAccessPoints/#download-and-build-kdtreeaccesspoints","title":"Download and Build KDTreeAccessPoints","text":"

        Click here to download KDTreeAccessPoints and its CMakeLists.txt file. Once the tarball KDTreeAccessPoints.tar has been downloaded and extracted,

        cd KDTreeAccessPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KDTreeAccessPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadius/","title":"KDTreeFindPointsWithinRadius","text":"

        vtk-examples/Cxx/DataStructures/KDTreeFindPointsWithinRadius

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadius/#code","title":"Code","text":"

        KDTreeFindPointsWithinRadius.cxx

        #include <vtkKdTreePointLocator.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n\nint main(int, char*[])\n{\n  // Create some random points.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(10);\n  pointSource->Update();\n\n  // Create the tree.\n  vtkNew<vtkKdTreePointLocator> pointTree;\n  pointTree->SetDataSet(pointSource->GetOutput());\n  pointTree->BuildLocator();\n\n  // Find the k closest points to (0,0,0).\n  vtkIdType k = 1;\n  double testPoint[3] = {0.0, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n\n  pointTree->FindPointsWithinRadius(1.0, testPoint, result);\n\n  for (vtkIdType i = 0; i < k; i++)\n  {\n    vtkIdType point_ind = result->GetId(i);\n    double p[3];\n    pointSource->GetOutput()->GetPoint(point_ind, p);\n    std::cout << \"Closest point \" << i << \": Point \" << point_ind << \": (\"\n              << p[0] << \", \" << p[1] << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadius/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KDTreeFindPointsWithinRadius)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KDTreeFindPointsWithinRadius: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KDTreeFindPointsWithinRadius MACOSX_BUNDLE KDTreeFindPointsWithinRadius.cxx )\n  target_link_libraries(KDTreeFindPointsWithinRadius PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KDTreeFindPointsWithinRadius\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadius/#download-and-build-kdtreefindpointswithinradius","title":"Download and Build KDTreeFindPointsWithinRadius","text":"

        Click here to download KDTreeFindPointsWithinRadius and its CMakeLists.txt file. Once the tarball KDTreeFindPointsWithinRadius.tar has been downloaded and extracted,

        cd KDTreeFindPointsWithinRadius/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KDTreeFindPointsWithinRadius\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/","title":"KDTreeFindPointsWithinRadiusDemo","text":"

        vtk-examples/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/#description","title":"Description","text":"

        This example uses vtkKdTreePointLocator to find all points within a given radius. The example generates \"n\" spheres and finds all the points within the radius of the spheres. The input vtkPolyData's vtkPointData is set the the radius value of each sphere.

        The example takes one or two arguments. The first argument specifies the input file that contains vtkPolyData. The second optional argument specifies the number of radii use. If the number is < 6, the vtkSphereSource will be displayed as concentric translucent spheres.

        The image was produced with this command:

        KDTreeFindPointsWithinRadius dragon.ply 10\n

        To see the translucent spheres run:

        KDTreeFindPointsWithinRadius dragon.ply\n

        Info

        See other locator demos: OctreeFindPointsWithinRadiusDemo, StaticLocatorFindPointsWithinRadiusDemo, PointLocatorFindPointsWithinRadiusDemo

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/#code","title":"Code","text":"

        KDTreeFindPointsWithinRadiusDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDoubleArray.h>\n#include <vtkIdList.h>\n#include <vtkKdTreePointLocator.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <algorithm> // For transform()\n#include <array>\n#include <cctype> // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\n// Templated join which can be used on any combination\n//  of streams, and a container of base types.\ntemplate <typename TStream, typename TContainer, typename TSeparator>\nTStream& join(TStream& stream, TContainer const& cont,\n              TSeparator const& separator)\n{\n  auto sep = false;\n  for (auto const& p : cont)\n  {\n    if (sep)\n      stream << separator;\n    else\n    {\n      sep = true;\n    }\n    stream << p;\n  }\n  // As a convenience, return a reference to the passed stream.\n  return stream;\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" dragon.ply [number of radii] \"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int numberOfRadii = 5;\n  if (argc > 2)\n  {\n    numberOfRadii = std::atoi(argv[2]);\n  }\n  // Read the polydata\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Compute bounds and range\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n  std::cout << \"Bounds: \";\n  join(std::cout, bounds, \", \") << std::endl;\n  std::array<double, 3> range;\n  range[0] = bounds[1] - bounds[0];\n  range[1] = bounds[3] - bounds[2];\n  range[2] = bounds[5] - bounds[4];\n  std::cout << \"Range: \";\n  join(std::cout, range, \", \") << std::endl;\n\n  // double maxRange = std::max({range[0], range[1], range[2]});\n  double minRange = std::min({range[0], range[1], range[2]});\n\n  // Define a sphere at one edge of bounding box\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(range[0] / 2.0 + bounds[0],\n                          range[1] / 2.0 + bounds[2], bounds[5]);\n  sphereSource->SetRadius(minRange);\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n  sphereSource->SetStartPhi(90.0);\n  sphereSource->Update();\n\n  // Initialize the locator\n  vtkNew<vtkKdTreePointLocator> pointTree;\n  pointTree->SetDataSet(polyData);\n  pointTree->BuildLocator();\n\n  // Compute the radius for each call to FindPointsWithinRadius\n  std::vector<double> radii;\n  double radiiStart = .25 * sphereSource->GetRadius();\n  double radiiEnd = 1.0 * sphereSource->GetRadius();\n  double radiiDelta = (radiiEnd - radiiStart) / (numberOfRadii - 1);\n\n  for (int r = 0; r < numberOfRadii; ++r)\n  {\n    radii.push_back(radiiStart + radiiDelta * r);\n  }\n\n  // Create an array to hold the scalar point data\n  vtkNew<vtkDoubleArray> scalars;\n  scalars->SetNumberOfComponents(1);\n  scalars->SetNumberOfTuples(polyData->GetNumberOfPoints());\n  scalars->FillComponent(0, 0.0);\n\n  // Process each radii from largest to smallest\n  for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n       rIter != radii.rend(); ++rIter)\n  {\n    vtkNew<vtkIdList> result;\n    pointTree->FindPointsWithinRadius(*rIter, sphereSource->GetCenter(),\n                                      result);\n    vtkIdType k = result->GetNumberOfIds();\n    std::cout << k << \" points within \" << *rIter << \" of \"\n              << sphereSource->GetCenter()[0] << \", \"\n              << sphereSource->GetCenter()[1] << \", \"\n              << sphereSource->GetCenter()[2] << std::endl;\n    // Store the distance in the points withnin the current radius\n    for (vtkIdType i = 0; i < k; i++)\n    {\n      vtkIdType point_ind = result->GetId(i);\n      scalars->SetTuple1(point_ind, *rIter);\n    }\n  }\n  polyData->GetPointData()->SetScalars(scalars);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(.667, 0.0);\n  lut->SetNumberOfTableValues(radii.size() + 1);\n  lut->SetRange(*radii.begin(), *radii.rbegin());\n  lut->Build();\n\n  // Create a transluscent sphere for each radii\n  if (radii.size() < 6)\n  {\n    for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n         rIter != radii.rend(); ++rIter)\n    {\n      vtkNew<vtkSphereSource> radiiSource;\n      radiiSource->SetPhiResolution(31);\n      radiiSource->SetThetaResolution(31);\n      radiiSource->SetStartPhi(90.0);\n      radiiSource->SetRadius(*rIter);\n      radiiSource->SetCenter(range[0] / 2.0 + bounds[0],\n                             range[1] / 2.0 + bounds[2], bounds[5]);\n\n      vtkNew<vtkPolyDataMapper> radiiMapper;\n      radiiMapper->SetInputConnection(radiiSource->GetOutputPort());\n\n      vtkNew<vtkProperty> backProp;\n      backProp->SetDiffuseColor(colors->GetColor3d(\"LightGrey\").GetData());\n\n      vtkNew<vtkActor> radiiActor;\n      radiiActor->SetMapper(radiiMapper);\n      radiiActor->GetProperty()->SetDiffuseColor(\n          colors->GetColor3d(\"White\").GetData());\n      radiiActor->GetProperty()->SetOpacity(.1);\n      radiiActor->SetBackfaceProperty(backProp);\n\n      renderer->AddActor(radiiActor);\n    }\n  }\n\n  // Display the original poly data\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(*radii.begin(), *radii.rbegin());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  renderWindow->SetWindowName(\"KDTreeFindPointsWithinRadiusDemo\");\n  renderWindow->Render();\n\n  // Pick a good view\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KDTreeFindPointsWithinRadiusDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KDTreeFindPointsWithinRadiusDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KDTreeFindPointsWithinRadiusDemo MACOSX_BUNDLE KDTreeFindPointsWithinRadiusDemo.cxx )\n  target_link_libraries(KDTreeFindPointsWithinRadiusDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KDTreeFindPointsWithinRadiusDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/#download-and-build-kdtreefindpointswithinradiusdemo","title":"Download and Build KDTreeFindPointsWithinRadiusDemo","text":"

        Click here to download KDTreeFindPointsWithinRadiusDemo and its CMakeLists.txt file. Once the tarball KDTreeFindPointsWithinRadiusDemo.tar has been downloaded and extracted,

        cd KDTreeFindPointsWithinRadiusDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KDTreeFindPointsWithinRadiusDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/KDTreeTimingDemo/","title":"KDTreeTimingDemo","text":"

        vtk-examples/Cxx/DataStructures/KDTreeTimingDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/KDTreeTimingDemo/#description","title":"Description","text":"

        Your timing graph will be different when compared to the above illustration.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/KDTreeTimingDemo/#code","title":"Code","text":"

        KDTreeTimingDemo.cxx

        #include <vtkAxis.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkKdTreePointLocator.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTable.h>\n#include <vtkTimerLog.h>\n\n#include <time.h>\n#include <vector>\n\nnamespace {\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng);\n\ndouble TimeKDTree(vtkPolyData* polydata, int maxPoints, int numberOfTrials,\n                  vtkMinimalStandardRandomSequence* rng);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> reader;\n  reader->SetThetaResolution(30);\n  reader->SetPhiResolution(30);\n  reader->Update();\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  std::cout << \"Timing KD tree...\" << std::endl;\n  std::vector<std::pair<int, double>> results;\n  int numberOfTrials = 1000;\n  for (int i = 1; i < 20; i++)\n  {\n    double t = TimeKDTree(reader->GetOutput(), i, numberOfTrials, rng);\n    std::pair<int, double> result(i, t);\n    results.push_back(result);\n  }\n\n  // Create a table with some points in it\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> maxPointsPerRegion;\n  maxPointsPerRegion->SetName(\"MaxPointsPerRegion\");\n  table->AddColumn(maxPointsPerRegion);\n\n  vtkNew<vtkFloatArray> runtime;\n  runtime->SetName(\"Run time\");\n  table->AddColumn(runtime);\n\n  // Fill in the table with some example values\n  size_t numPoints = results.size();\n  table->SetNumberOfRows(static_cast<vtkIdType>(numPoints));\n  for (size_t i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(static_cast<vtkIdType>(i), 0, results[i].first);\n    table->SetValue(static_cast<vtkIdType>(i), 1, results[i].second);\n    std::cout << \"Put \" << results[i].first << \" \" << results[i].second\n              << \" in the table.\" << std::endl;\n  }\n\n  // Set up the view\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"White\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"KDTreeTimingDemo\");\n\n  // Add multiple line plots, setting the colors etc\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  vtkPlot* line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 1);\n  auto lineColor = colors->HTMLColorToRGBA(\"Lime\").GetData();\n  line->SetColor(lineColor[0], lineColor[1], lineColor[2], lineColor[3]);\n  line->SetWidth(3.0);\n  line->GetXAxis()->SetTitle(\"Max Points Per Region\");\n  line->GetYAxis()->SetTitle(\"Run time\");\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n\n  // Start interactor\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  for (auto i = 0; i < 3; ++i)\n  {\n    p[i] = bounds[i * 2] +\n        (bounds[i * 2 + 1] - bounds[i * 2]) * rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n}\n\ndouble TimeKDTree(vtkPolyData* polydata, int maxLevel, int numberOfTrials,\n                  vtkMinimalStandardRandomSequence* rng)\n{\n  vtkNew<vtkTimerLog> timer;\n  timer->StartTimer();\n\n  // Create the tree\n  vtkNew<vtkKdTreePointLocator> kdtree;\n  kdtree->SetDataSet(polydata);\n  kdtree->AutomaticOff();\n  kdtree->SetMaxLevel(maxLevel);\n  kdtree->BuildLocator();\n\n  for (int i = 0; i < numberOfTrials; i++)\n  {\n    double p[3];\n    RandomPointInBounds(polydata, p, rng);\n    kdtree->FindClosestPoint(p);\n  }\n\n  timer->StopTimer();\n\n  std::cout << \"KDTree took \" << timer->GetElapsedTime() << std::endl;\n\n  return timer->GetElapsedTime();\n}\n} // namespace\n
        "},{"location":"Cxx/DataStructures/KDTreeTimingDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KDTreeTimingDemo)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonSystem\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KDTreeTimingDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KDTreeTimingDemo MACOSX_BUNDLE KDTreeTimingDemo.cxx )\n  target_link_libraries(KDTreeTimingDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KDTreeTimingDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/KDTreeTimingDemo/#download-and-build-kdtreetimingdemo","title":"Download and Build KDTreeTimingDemo","text":"

        Click here to download KDTreeTimingDemo and its CMakeLists.txt file. Once the tarball KDTreeTimingDemo.tar has been downloaded and extracted,

        cd KDTreeTimingDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KDTreeTimingDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/KdTree/","title":"KdTree","text":"

        vtk-examples/Cxx/DataStructures/KdTree

        "},{"location":"Cxx/DataStructures/KdTree/#description","title":"Description","text":"

        This example demonstrates how to use vtkKdTree to build a tree from a vtkPoints object. Note that since AddDataSet or SetDataSet were not called, you cannot use GetDataSet.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/KdTree/#code","title":"Code","text":"

        KdTree.cxx

        #include <vtkDataSetCollection.h>\n#include <vtkKdTree.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n\nint main(int, char*[])\n{\n  // Setup point coordinates.\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  // Create the tree\n  vtkNew<vtkKdTree> kDTree;\n  kDTree->BuildLocatorFromPoints(points);\n\n  double testPoint[3] = {2.0, 0.0, 0.0};\n\n  auto pointCoordinates = [](double* pt) {\n    std::cout << \"Coordinates: \" << pt[0] << \" \" << pt[1] << \" \" << pt[2]\n              << std::endl;\n  };\n\n  // Find the closest point to TestPoint.\n  double closestPointDist;\n  vtkIdType id = kDTree->FindClosestPoint(\n      testPoint, closestPointDist); // vtkKdTree::FindClosestPoint: must build\n                                    // locator first\n  std::cout << \"Test Point \";\n  pointCoordinates(testPoint);\n  std::cout << \"The closest point is point \" << id << std::endl;\n  // Get the closest point in the KD Tree from the point data.\n  std::cout << \"Closest point \";\n  pointCoordinates(points->GetPoint(id));\n  std::cout << \"Distance: \" << closestPointDist << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/KdTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KdTree)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KdTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KdTree MACOSX_BUNDLE KdTree.cxx )\n  target_link_libraries(KdTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KdTree\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/KdTree/#download-and-build-kdtree","title":"Download and Build KdTree","text":"

        Click here to download KdTree and its CMakeLists.txt file. Once the tarball KdTree.tar has been downloaded and extracted,

        cd KdTree/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KdTree\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/KdTreePointLocatorClosestPoint/","title":"KdTreePointLocatorClosestPoint","text":"

        vtk-examples/Cxx/DataStructures/KdTreePointLocatorClosestPoint

        "},{"location":"Cxx/DataStructures/KdTreePointLocatorClosestPoint/#description","title":"Description","text":"

        This example creates a set of three points, builds a KDTree from them, then demonstrates how to find the closest point to a query point.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/KdTreePointLocatorClosestPoint/#code","title":"Code","text":"

        KdTreePointLocatorClosestPoint.cxx

        #include <vtkKdTreePointLocator.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  // Setup point coordinates\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create the tree\n  vtkNew<vtkKdTreePointLocator> kDTree;\n  kDTree->SetDataSet(polydata);\n  kDTree->BuildLocator();\n\n  double testPoint[3] = {2.0, 0.0, 0.0};\n\n  // Find the closest points to TestPoint\n  vtkIdType iD = kDTree->FindClosestPoint(testPoint);\n  std::cout << \"The closest point is point \" << iD << std::endl;\n\n  // Get the coordinates of the closest point\n  double closestPoint[3];\n  kDTree->GetDataSet()->GetPoint(iD, closestPoint);\n  std::cout << \"Coordinates: \" << closestPoint[0] << \" \" << closestPoint[1]\n            << \" \" << closestPoint[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/KdTreePointLocatorClosestPoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KdTreePointLocatorClosestPoint)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KdTreePointLocatorClosestPoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KdTreePointLocatorClosestPoint MACOSX_BUNDLE KdTreePointLocatorClosestPoint.cxx )\n  target_link_libraries(KdTreePointLocatorClosestPoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KdTreePointLocatorClosestPoint\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/KdTreePointLocatorClosestPoint/#download-and-build-kdtreepointlocatorclosestpoint","title":"Download and Build KdTreePointLocatorClosestPoint","text":"

        Click here to download KdTreePointLocatorClosestPoint and its CMakeLists.txt file. Once the tarball KdTreePointLocatorClosestPoint.tar has been downloaded and extracted,

        cd KdTreePointLocatorClosestPoint/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KdTreePointLocatorClosestPoint\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeExtractCells/","title":"ModifiedBSPTreeExtractCells","text":"

        vtk-examples/Cxx/DataStructures/ModifiedBSPTreeExtractCells

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeExtractCells/#code","title":"Code","text":"

        ModifiedBSPTreeExtractCells.cxx

        #include <vtkExtractCells.h>\n#include <vtkIdList.h>\n#include <vtkLineSource.h>\n#include <vtkModifiedBSPTree.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkSphereSource.h>\n\n#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(7);\n  sphereSource->SetThetaResolution(15);\n  sphereSource->Update();\n\n  // Create the locator\n  vtkNew<vtkModifiedBSPTree> tree;\n  tree->SetDataSet(sphereSource->GetOutput());\n\n  // Intersect the locator with the line\n  double lineP0[3] = {-0.6, -0.6, -0.6};\n  double lineP1[3] = {0.6, 0.6, 0.6};\n  vtkNew<vtkPoints> intersectPoints;\n\n  vtkNew<vtkIdList> intersectCells;\n\n  double tol = 1.0e-8;\n  tree->IntersectWithLine(lineP0, lineP1, tol, intersectPoints, intersectCells);\n\n  std::cout << \"NumPoints: \" << intersectPoints->GetNumberOfPoints()\n            << std::endl;\n\n  // Display list of intersections\n  double intersection[3];\n  for (int i = 0; i < intersectPoints->GetNumberOfPoints(); i++)\n  {\n    intersectPoints->GetPoint(i, intersection);\n    std::cout << \"\\tPoint Intersection \" << i << \": \" << intersection[0] << \", \"\n              << intersection[1] << \", \" << intersection[2] << std::endl;\n  }\n\n  std::cout << \"NumCells: \" << intersectCells->GetNumberOfIds() << std::endl;\n\n  vtkIdType cellId;\n  for (int i = 0; i < intersectCells->GetNumberOfIds(); i++)\n  {\n    cellId = intersectCells->GetId(i);\n    std::cout << \"\\tCellId \" << i << \": \" << cellId << std::endl;\n  }\n\n  // Render the line, sphere and intersected cells\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(lineP0);\n  lineSource->SetPoint2(lineP1);\n\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(lineSource->GetOutputPort());\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetRepresentationToWireframe();\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkExtractCells> cellSource;\n  cellSource->SetInputConnection(sphereSource->GetOutputPort());\n  cellSource->SetCellList(intersectCells);\n\n  vtkNew<vtkDataSetMapper> cellMapper;\n  cellMapper->SetInputConnection(cellSource->GetOutputPort());\n  vtkNew<vtkActor> cellActor;\n  cellActor->SetMapper(cellMapper);\n  cellActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(lineActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(cellActor);\n  renderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  renderWindow->SetWindowName(\"ModifiedBSPTreeExtractCells\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeExtractCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ModifiedBSPTreeExtractCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersFlowPaths\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ModifiedBSPTreeExtractCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ModifiedBSPTreeExtractCells MACOSX_BUNDLE ModifiedBSPTreeExtractCells.cxx )\n  target_link_libraries(ModifiedBSPTreeExtractCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ModifiedBSPTreeExtractCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeExtractCells/#download-and-build-modifiedbsptreeextractcells","title":"Download and Build ModifiedBSPTreeExtractCells","text":"

        Click here to download ModifiedBSPTreeExtractCells and its CMakeLists.txt file. Once the tarball ModifiedBSPTreeExtractCells.tar has been downloaded and extracted,

        cd ModifiedBSPTreeExtractCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ModifiedBSPTreeExtractCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine/","title":"ModifiedBSPTreeIntersectWithLine","text":"

        vtk-examples/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine/#code","title":"Code","text":"

        ModifiedBSPTreeIntersectWithLine.cxx

        #include <vtkModifiedBSPTree.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create the tree\n  vtkNew<vtkModifiedBSPTree> bspTree;\n  bspTree->SetDataSet(sphereSource->GetOutput());\n  bspTree->BuildLocator();\n\n  // Inputs\n  double p1[3] = {-2, 0, 0};\n  double p2[3] = {2, 0, 0};\n  double tolerance = .001;\n\n  // Outputs\n  double t; // Parametric coordinate of intersection (0 (corresponding to p1) to\n            // 1 (corresponding to p2)).\n  double x[3]; // The coordinate of the intersection.\n  double pcoords[3];\n  int subId;\n\n  // Note: For a typical use case (ray-triangle intersection), pcoords and subId\n  // will not be used.\n  vtkIdType iD =\n      bspTree->IntersectWithLine(p1, p2, tolerance, t, x, pcoords, subId);\n\n  std::cout << \"iD: \" << iD << std::endl;\n  std::cout << \"t: \" << t << std::endl;\n  std::cout << \"x: \" << x[0] << \" \" << x[1] << \" \" << x[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ModifiedBSPTreeIntersectWithLine)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersFlowPaths\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ModifiedBSPTreeIntersectWithLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ModifiedBSPTreeIntersectWithLine MACOSX_BUNDLE ModifiedBSPTreeIntersectWithLine.cxx )\n  target_link_libraries(ModifiedBSPTreeIntersectWithLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ModifiedBSPTreeIntersectWithLine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine/#download-and-build-modifiedbsptreeintersectwithline","title":"Download and Build ModifiedBSPTreeIntersectWithLine","text":"

        Click here to download ModifiedBSPTreeIntersectWithLine and its CMakeLists.txt file. Once the tarball ModifiedBSPTreeIntersectWithLine.tar has been downloaded and extracted,

        cd ModifiedBSPTreeIntersectWithLine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ModifiedBSPTreeIntersectWithLine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeTimingDemo/","title":"ModifiedBSPTreeTimingDemo","text":"

        vtk-examples/Cxx/DataStructures/ModifiedBSPTreeTimingDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeTimingDemo/#description","title":"Description","text":"

        Your timing graph will be different when compared to the above illustration.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeTimingDemo/#code","title":"Code","text":"

        ModifiedBSPTreeTimingDemo.cxx

        #include <vtkAxis.h>\n#include <vtkBox.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkModifiedBSPTree.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTable.h>\n#include <vtkTimerLog.h>\n\n#include <time.h>\n#include <vector>\n\nnamespace {\n\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng);\nvoid RandomDirection(double v[3], vtkMinimalStandardRandomSequence* rng);\nvoid RandomLineThroughVolume(vtkPolyData* polydata, double p1[3], double p2[3],\n                             vtkMinimalStandardRandomSequence* rng);\n\ndouble TimeModifiedBSPTree(vtkPolyData* polydata, int maxPoints,\n                           int numberOfTrials,\n                           vtkMinimalStandardRandomSequence* rng);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> reader;\n  reader->SetThetaResolution(30);\n  reader->SetPhiResolution(30);\n  reader->Update();\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  std::cout << \"Timing ModifiedBSPTree...\" << std::endl;\n  std::vector<std::pair<int, double>> results;\n  int numberOfTrials = 1000;\n  for (int i = 1; i < 20; i++)\n  {\n    double t = TimeModifiedBSPTree(reader->GetOutput(), i, numberOfTrials, rng);\n    std::pair<int, double> result(i, t);\n    results.push_back(result);\n  }\n\n  // Create a table with some points in it.\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> maxPointsPerRegion;\n  maxPointsPerRegion->SetName(\"MaxPointsPerRegion\");\n  table->AddColumn(maxPointsPerRegion);\n\n  vtkNew<vtkFloatArray> runtime;\n  runtime->SetName(\"Run time\");\n  table->AddColumn(runtime);\n\n  // Fill in the table with some example values.\n  size_t numPoints = results.size();\n  table->SetNumberOfRows(static_cast<vtkIdType>(numPoints));\n  for (size_t i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(static_cast<vtkIdType>(i), 0, results[i].first);\n    table->SetValue(static_cast<vtkIdType>(i), 1, results[i].second);\n    std::cout << \"Put \" << results[i].first << \" \" << results[i].second\n              << \" in the table.\" << std::endl;\n  }\n\n  // Set up the view\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"White\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"ModifiedBSPTreeTimingDemo\");\n\n  // Add multiple line plots, setting the colors etc.\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  vtkPlot* line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 1);\n  auto lineColor = colors->HTMLColorToRGBA(\"Lime\").GetData();\n  line->SetColor(lineColor[0], lineColor[1], lineColor[2], lineColor[3]);\n  line->SetWidth(3.0);\n  line->GetXAxis()->SetTitle(\"Max Points Per Region\");\n  line->GetYAxis()->SetTitle(\"Run time\");\n  // line->GetYAxis()->AutoScale();\n  // line->GetYAxis()->SetRange(0,0.02);\n\n  // Start interactor\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  for (auto i = 0; i < 3; ++i)\n  {\n    p[i] = bounds[i * 2] +\n        (bounds[i * 2 + 1] - bounds[i * 2]) * rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n}\n\ndouble TimeModifiedBSPTree(vtkPolyData* polydata, int maxLevel,\n                           int numberOfTrials,\n                           vtkMinimalStandardRandomSequence* rng)\n{\n  vtkNew<vtkTimerLog> timer;\n  timer->StartTimer();\n\n  // Create the tree\n  vtkNew<vtkModifiedBSPTree> modifiedBSPTree;\n  modifiedBSPTree->SetDataSet(polydata);\n  modifiedBSPTree->AutomaticOff();\n  modifiedBSPTree->SetMaxLevel(maxLevel);\n  // modifiedBSPTree->SetNumberOfCellsPerNode(cellsPerNode);\n  modifiedBSPTree->BuildLocator();\n\n  for (int i = 0; i < numberOfTrials; i++)\n  {\n    double p1[3];\n    double p2[3];\n    RandomLineThroughVolume(polydata, p1, p2, rng);\n\n    double t;\n    double x[3];\n    double pcoords[3];\n    int subId;\n    modifiedBSPTree->IntersectWithLine(p1, p2, 0.001, t, x, pcoords, subId);\n  }\n\n  timer->StopTimer();\n\n  std::cout << \"ModifiedBSPTree took \" << timer->GetElapsedTime() << std::endl;\n\n  return timer->GetElapsedTime();\n}\n\nvoid RandomLineThroughVolume(vtkPolyData* polydata, double p1[3], double p2[3],\n                             vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  double p[3];\n  RandomPointInBounds(polydata, p, rng);\n\n  double v[3];\n  RandomDirection(v, rng);\n\n  double lineP1[3];\n  double lineP2[3];\n\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    p1[i] = p[i] + 1000 * v[i];\n    p2[i] = p[i] - 1000 * v[i];\n  }\n\n  double t1, t2;\n  int plane1, plane2;\n  vtkBox::IntersectWithLine(bounds, lineP1, lineP2, t1, t2, p1, p2, plane1,\n                            plane2);\n}\n\nvoid RandomDirection(double v[3], vtkMinimalStandardRandomSequence* rng)\n{\n  for (auto i = 0; i < 3; ++i)\n  {\n    v[i] = rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n  vtkMath::Normalize(v);\n}\n} // namespace\n
        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeTimingDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ModifiedBSPTreeTimingDemo)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonSystem\n  FiltersFlowPaths\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ModifiedBSPTreeTimingDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ModifiedBSPTreeTimingDemo MACOSX_BUNDLE ModifiedBSPTreeTimingDemo.cxx )\n  target_link_libraries(ModifiedBSPTreeTimingDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ModifiedBSPTreeTimingDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/ModifiedBSPTreeTimingDemo/#download-and-build-modifiedbsptreetimingdemo","title":"Download and Build ModifiedBSPTreeTimingDemo","text":"

        Click here to download ModifiedBSPTreeTimingDemo and its CMakeLists.txt file. Once the tarball ModifiedBSPTreeTimingDemo.tar has been downloaded and extracted,

        cd ModifiedBSPTreeTimingDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ModifiedBSPTreeTimingDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/OBBTreeExtractCells/","title":"OBBTreeExtractCells","text":"

        vtk-examples/Cxx/DataStructures/OBBTreeExtractCells

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/OBBTreeExtractCells/#code","title":"Code","text":"

        OBBTreeExtractCells.cxx

        #include <vtkExtractCells.h>\n#include <vtkIdList.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkPoints.h>\n#include <vtkSphereSource.h>\n\n#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(7);\n  sphereSource->SetThetaResolution(15);\n  sphereSource->Update();\n\n  // Create the locator\n  vtkNew<vtkOBBTree> tree;\n  tree->SetDataSet(sphereSource->GetOutput());\n  tree->BuildLocator();\n\n  // Intersect the locator with the line\n  double lineP0[3] = {-0.6, -0.6, -0.6};\n  double lineP1[3] = {.6, .6, .6};\n  vtkNew<vtkPoints> intersectPoints;\n\n  vtkNew<vtkIdList> intersectCells;\n\n  double tol = 1.e-8;\n  tree->SetTolerance(tol);\n  tree->IntersectWithLine(lineP0, lineP1, intersectPoints, intersectCells);\n\n  std::cout << \"NumPoints: \" << intersectPoints->GetNumberOfPoints()\n            << std::endl;\n\n  // Display list of intersections.\n  double intersection[3];\n  for (int i = 0; i < intersectPoints->GetNumberOfPoints(); i++)\n  {\n    intersectPoints->GetPoint(i, intersection);\n    std::cout << \"\\tPoint Intersection \" << i << \": \" << intersection[0] << \", \"\n              << intersection[1] << \", \" << intersection[2] << std::endl;\n  }\n\n  std::cout << \"NumCells: \" << intersectCells->GetNumberOfIds() << std::endl;\n\n  vtkIdType cellId;\n  for (int i = 0; i < intersectCells->GetNumberOfIds(); i++)\n  {\n    cellId = intersectCells->GetId(i);\n    std::cout << \"\\tCellId \" << i << \": \" << cellId << std::endl;\n  }\n\n  // Render the line, sphere and intersected cells.\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(lineP0);\n  lineSource->SetPoint2(lineP1);\n\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(lineSource->GetOutputPort());\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetRepresentationToWireframe();\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkExtractCells> cellSource;\n  cellSource->SetInputConnection(sphereSource->GetOutputPort());\n  cellSource->SetCellList(intersectCells);\n\n  vtkNew<vtkDataSetMapper> cellMapper;\n  cellMapper->SetInputConnection(cellSource->GetOutputPort());\n  vtkNew<vtkActor> cellActor;\n  cellActor->SetMapper(cellMapper);\n  cellActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(lineActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(cellActor);\n  renderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  renderWindow->SetWindowName(\"OBBTreeExtractCells\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/OBBTreeExtractCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OBBTreeExtractCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OBBTreeExtractCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OBBTreeExtractCells MACOSX_BUNDLE OBBTreeExtractCells.cxx )\n  target_link_libraries(OBBTreeExtractCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OBBTreeExtractCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/OBBTreeExtractCells/#download-and-build-obbtreeextractcells","title":"Download and Build OBBTreeExtractCells","text":"

        Click here to download OBBTreeExtractCells and its CMakeLists.txt file. Once the tarball OBBTreeExtractCells.tar has been downloaded and extracted,

        cd OBBTreeExtractCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OBBTreeExtractCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/OBBTreeIntersectWithLine/","title":"OBBTreeIntersectWithLine","text":"

        vtk-examples/Cxx/DataStructures/OBBTreeIntersectWithLine

        "},{"location":"Cxx/DataStructures/OBBTreeIntersectWithLine/#description","title":"Description","text":"

        vtkOBBTree returns ALL intersections with a line and the dataset. If you want the closest intersection, you must manually find it. In this example, we create a sphere and intersect a single line with it.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/OBBTreeIntersectWithLine/#code","title":"Code","text":"

        OBBTreeIntersectWithLine.cxx

        #include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkPoints.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create the locator\n  vtkNew<vtkOBBTree> tree;\n  tree->SetDataSet(sphereSource->GetOutput());\n  tree->BuildLocator();\n\n  // Intersect the locator with the line\n  double lineP0[3] = {0.0, 0.0, 0.0};\n  double lineP1[3] = {0.0, 0.0, 2.0};\n  vtkNew<vtkPoints> intersectPoints;\n\n  tree->IntersectWithLine(lineP0, lineP1, intersectPoints, NULL);\n\n  std::cout << \"NumPoints: \" << intersectPoints->GetNumberOfPoints()\n            << std::endl;\n\n  // Display list of intersections.\n  double intersection[3];\n  for (int i = 0; i < intersectPoints->GetNumberOfPoints(); i++)\n  {\n    intersectPoints->GetPoint(i, intersection);\n    std::cout << \"Intersection \" << i << \": \" << intersection[0] << \", \"\n              << intersection[1] << \", \" << intersection[2] << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/OBBTreeIntersectWithLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OBBTreeIntersectWithLine)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersGeneral\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OBBTreeIntersectWithLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OBBTreeIntersectWithLine MACOSX_BUNDLE OBBTreeIntersectWithLine.cxx )\n  target_link_libraries(OBBTreeIntersectWithLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OBBTreeIntersectWithLine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/OBBTreeIntersectWithLine/#download-and-build-obbtreeintersectwithline","title":"Download and Build OBBTreeIntersectWithLine","text":"

        Click here to download OBBTreeIntersectWithLine and its CMakeLists.txt file. Once the tarball OBBTreeIntersectWithLine.tar has been downloaded and extracted,

        cd OBBTreeIntersectWithLine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OBBTreeIntersectWithLine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/OBBTreeTimingDemo/","title":"OBBTreeTimingDemo","text":"

        vtk-examples/Cxx/DataStructures/OBBTreeTimingDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/OBBTreeTimingDemo/#description","title":"Description","text":"

        Your timing graph will be different when compared to the above illustration.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/OBBTreeTimingDemo/#code","title":"Code","text":"

        OBBTreeTimingDemo.cxx

        #include <vtkAxis.h>\n#include <vtkBox.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkPlot.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTable.h>\n#include <vtkTimerLog.h>\n\n#include <time.h>\n#include <vector>\n\nnamespace {\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng);\nvoid RandomDirection(double v[3], vtkMinimalStandardRandomSequence* rng);\nvoid RandomLineThroughVolume(vtkPolyData* polydata, double p1[3], double p2[3],\n                             vtkMinimalStandardRandomSequence* rng);\n\ndouble TimeOBBTree(vtkPolyData* polydata, int maxPoints, int numberOfTrials,\n                   vtkMinimalStandardRandomSequence* rng);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> reader;\n  reader->SetThetaResolution(30);\n  reader->SetPhiResolution(30);\n  reader->Update();\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  std::cout << \"Timing OBBTree...\" << std::endl;\n  std::vector<std::pair<int, double>> results;\n  int numberOfTrials = 100;\n  for (int i = 1; i < 20; i++)\n  {\n    double t = TimeOBBTree(reader->GetOutput(), i, numberOfTrials, rng);\n    std::pair<int, double> result(i, t);\n    results.push_back(result);\n  }\n\n  // Create a table with some points in it.\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> maxPointsPerRegion;\n  maxPointsPerRegion->SetName(\"MaxPointsPerRegion\");\n  table->AddColumn(maxPointsPerRegion);\n\n  vtkNew<vtkFloatArray> runtime;\n  runtime->SetName(\"Run time\");\n  table->AddColumn(runtime);\n\n  // Fill in the table with some example values.\n  size_t numPoints = results.size();\n  table->SetNumberOfRows(static_cast<vtkIdType>(numPoints));\n  for (size_t i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(static_cast<vtkIdType>(i), 0, results[i].first);\n    table->SetValue(static_cast<vtkIdType>(i), 1, results[i].second);\n    std::cout << \"Put \" << results[i].first << \" \" << results[i].second\n              << \" in the table.\" << std::endl;\n  }\n\n  // Set up the view\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"White\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"OBBTreeTimingDemo\");\n\n  // Add multiple line plots, setting the colors etc.\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  vtkPlot* line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 1);\n  auto lineColor = colors->HTMLColorToRGBA(\"Lime\").GetData();\n  line->SetColor(lineColor[0], lineColor[1], lineColor[2], lineColor[3]);\n  line->SetWidth(3.0);\n  line->GetXAxis()->SetTitle(\"Max Points Per Region\");\n  line->GetYAxis()->SetTitle(\"Run time\");\n  // line->GetYAxis()->AutoScale();\n  // line->GetYAxis()->SetRange(0,0.02);\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n\n  // Start interactor\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  for (auto i = 0; i < 3; ++i)\n  {\n    p[i] = bounds[i * 2] +\n        (bounds[i * 2 + 1] - bounds[i * 2]) * rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n}\n\ndouble TimeOBBTree(vtkPolyData* polydata, int maxLevel, int numberOfTrials,\n                   vtkMinimalStandardRandomSequence* rng)\n{\n  vtkNew<vtkTimerLog> timer;\n  timer->StartTimer();\n\n  // Create the tree\n  vtkNew<vtkOBBTree> obbTree;\n  obbTree->SetDataSet(polydata);\n  obbTree->AutomaticOff();\n  obbTree->SetMaxLevel(maxLevel);\n  obbTree->BuildLocator();\n\n  for (int i = 0; i < numberOfTrials; i++)\n  {\n    double p1[3];\n    double p2[3];\n    RandomLineThroughVolume(polydata, p1, p2, rng);\n\n    double t;\n    double x[3];\n    double pcoords[3];\n    int subId;\n    obbTree->IntersectWithLine(p1, p2, .001, t, x, pcoords, subId);\n  }\n\n  timer->StopTimer();\n\n  std::cout << \"OBBTree took \" << timer->GetElapsedTime() << std::endl;\n\n  return timer->GetElapsedTime();\n}\n\nvoid RandomLineThroughVolume(vtkPolyData* polydata, double p1[3], double p2[3],\n                             vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  double p[3];\n  RandomPointInBounds(polydata, p, rng);\n\n  double v[3];\n  RandomDirection(v, rng);\n\n  double lineP1[3];\n  double lineP2[3];\n\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    p1[i] = p[i] + 1000 * v[i];\n    p2[i] = p[i] - 1000 * v[i];\n  }\n\n  double t1, t2;\n  int plane1, plane2;\n  vtkBox::IntersectWithLine(bounds, lineP1, lineP2, t1, t2, p1, p2, plane1,\n                            plane2);\n}\n\nvoid RandomDirection(double v[3], vtkMinimalStandardRandomSequence* rng)\n{\n  for (auto i = 0; i < 3; ++i)\n  {\n    v[i] = rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n  vtkMath::Normalize(v);\n}\n\n} // namespace\n
        "},{"location":"Cxx/DataStructures/OBBTreeTimingDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OBBTreeTimingDemo)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonSystem\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OBBTreeTimingDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OBBTreeTimingDemo MACOSX_BUNDLE OBBTreeTimingDemo.cxx )\n  target_link_libraries(OBBTreeTimingDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OBBTreeTimingDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/OBBTreeTimingDemo/#download-and-build-obbtreetimingdemo","title":"Download and Build OBBTreeTimingDemo","text":"

        Click here to download OBBTreeTimingDemo and its CMakeLists.txt file. Once the tarball OBBTreeTimingDemo.tar has been downloaded and extracted,

        cd OBBTreeTimingDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OBBTreeTimingDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/OctreeClosestPoint/","title":"OctreeClosestPoint","text":"

        vtk-examples/Cxx/DataStructures/OctreeClosestPoint

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/OctreeClosestPoint/#code","title":"Code","text":"

        OctreeClosestPoint.cxx

        #include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  // Setup point coordinates.\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 1.0, 0.0};\n  double z[3] = {0.0, 0.0, 1.0};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(x);\n  points->InsertNextPoint(y);\n  points->InsertNextPoint(z);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetDataSet(polydata);\n  octree->BuildLocator();\n\n  double testPoint[3] = {2.0, 0.0, 0.0};\n\n  // Find the closest points to TestPoint.\n  vtkIdType iD = octree->FindClosestPoint(testPoint);\n  std::cout << \"The closest point is point \" << iD << std::endl;\n\n  // Get the coordinates of the closest point.\n  double closestPoint[3];\n  octree->GetDataSet()->GetPoint(iD, closestPoint);\n  std::cout << \"Coordinates: \" << closestPoint[0] << \" \" << closestPoint[1]\n            << \" \" << closestPoint[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/OctreeClosestPoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeClosestPoint)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeClosestPoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeClosestPoint MACOSX_BUNDLE OctreeClosestPoint.cxx )\n  target_link_libraries(OctreeClosestPoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeClosestPoint\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/OctreeClosestPoint/#download-and-build-octreeclosestpoint","title":"Download and Build OctreeClosestPoint","text":"

        Click here to download OctreeClosestPoint and its CMakeLists.txt file. Once the tarball OctreeClosestPoint.tar has been downloaded and extracted,

        cd OctreeClosestPoint/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OctreeClosestPoint\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadius/","title":"OctreeFindPointsWithinRadius","text":"

        vtk-examples/Cxx/DataStructures/OctreeFindPointsWithinRadius

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadius/#code","title":"Code","text":"

        OctreeFindPointsWithinRadius.cxx

        #include <vtkIdList.h>\n#include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPointSource.h>\n\nint main(int, char*[])\n{\n  // Create some random points.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(10);\n  pointSource->Update();\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetDataSet(pointSource->GetOutput());\n  octree->BuildLocator();\n\n  // Find the k closest points to (0,0,0).\n  vtkIdType k = 1;\n  double testPoint[3] = {0.0, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n\n  octree->FindPointsWithinRadius(1.0, testPoint, result);\n\n  for (vtkIdType i = 0; i < k; i++)\n  {\n    vtkIdType point_ind = result->GetId(i);\n    double p[3];\n    pointSource->GetOutput()->GetPoint(point_ind, p);\n    std::cout << \"Closest point \" << i << \": Point \" << point_ind << \": (\"\n              << p[0] << \", \" << p[1] << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadius/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeFindPointsWithinRadius)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeFindPointsWithinRadius: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeFindPointsWithinRadius MACOSX_BUNDLE OctreeFindPointsWithinRadius.cxx )\n  target_link_libraries(OctreeFindPointsWithinRadius PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeFindPointsWithinRadius\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadius/#download-and-build-octreefindpointswithinradius","title":"Download and Build OctreeFindPointsWithinRadius","text":"

        Click here to download OctreeFindPointsWithinRadius and its CMakeLists.txt file. Once the tarball OctreeFindPointsWithinRadius.tar has been downloaded and extracted,

        cd OctreeFindPointsWithinRadius/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OctreeFindPointsWithinRadius\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/","title":"OctreeFindPointsWithinRadiusDemo","text":"

        vtk-examples/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/#description","title":"Description","text":"

        This example uses vtkOctreePointLocator to find all points within a given radius. The example generates \"n\" spheres and finds all the points within the radius of the spheres. The input vtkPolyData's vtkPointData is set the the radius value of each sphere.

        The example takes one or two arguments. The first argument specifies the input file that contains vtkPolyData. The second optional argument specifies the number of radii use. If the number is < 6, the vtkSphereSource will be displayed as concentric translucent spheres.

        The image was produced with this command:

        OctreeFindPointsWithinRadius dragon.ply 10\n

        To see the translucent spheres run:

        OctreeFindPointsWithinRadius dragon.ply\n

        Info

        See other locator demos: KDTreeFindPointsWithinRadiusDemo, StaticLocatorFindPointsWithinRadiusDemo, PointLocatorFindPointsWithinRadiusDemo

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/#code","title":"Code","text":"

        OctreeFindPointsWithinRadiusDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkDoubleArray.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <array>\n#include <cctype> // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\n// Templated join which can be used on any combination\n//  of streams, and a container of base types.\ntemplate <typename TStream, typename TContainer, typename TSeparator>\nTStream& join(TStream& stream, TContainer const& cont,\n              TSeparator const& separator)\n{\n  auto sep = false;\n  for (auto const& p : cont)\n  {\n    if (sep)\n      stream << separator;\n    else\n    {\n      sep = true;\n    }\n    stream << p;\n  }\n  // As a convenience, return a reference to the passed stream.\n  return stream;\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" dragon.ply [number of radii] \"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int numberOfRadii = 5;\n  if (argc > 2)\n  {\n    numberOfRadii = std::atoi(argv[2]);\n  }\n  // Read the polydata\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Compute bounds and range\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n  polyData->GetBounds(bounds.data());\n  std::cout << \"Bounds: \";\n  join(std::cout, bounds, \", \") << std::endl;\n  std::array<double, 3> range;\n  range[0] = bounds[1] - bounds[0];\n  range[1] = bounds[3] - bounds[2];\n  range[2] = bounds[5] - bounds[4];\n  std::cout << \"Range: \";\n  join(std::cout, range, \", \") << std::endl;\n\n  // double maxRange = std::max({range[0], range[1], range[2]});\n  double minRange = std::min({range[0], range[1], range[2]});\n\n  // Define a sphere at one edge of bounding box\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(range[0] / 2.0 + bounds[0],\n                          range[1] / 2.0 + bounds[2], bounds[5]);\n  sphereSource->SetRadius(minRange);\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n  sphereSource->SetStartPhi(90.0);\n  sphereSource->Update();\n\n  // Initialize the locator\n  vtkNew<vtkOctreePointLocator> pointTree;\n  pointTree->SetDataSet(polyData);\n  pointTree->BuildLocator();\n\n  // Compute the radius for each call to FindPointsWithinRadius\n  std::vector<double> radii;\n  double radiiStart = .25 * sphereSource->GetRadius();\n  double radiiEnd = 1.0 * sphereSource->GetRadius();\n  double radiiDelta = (radiiEnd - radiiStart) / (numberOfRadii - 1);\n\n  for (int r = 0; r < numberOfRadii; ++r)\n  {\n    radii.push_back(radiiStart + radiiDelta * r);\n  }\n\n  // Create an array to hold the scalar point data\n  vtkNew<vtkDoubleArray> scalars;\n  scalars->SetNumberOfComponents(1);\n  scalars->SetNumberOfTuples(polyData->GetNumberOfPoints());\n  scalars->FillComponent(0, 0.0);\n\n  // Process each radii from largest to smallest\n  for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n       rIter != radii.rend(); ++rIter)\n  {\n    vtkNew<vtkIdList> result;\n    pointTree->FindPointsWithinRadius(*rIter, sphereSource->GetCenter(),\n                                      result);\n    vtkIdType k = result->GetNumberOfIds();\n    std::cout << k << \" points within \" << *rIter << \" of \"\n              << sphereSource->GetCenter()[0] << \", \"\n              << sphereSource->GetCenter()[1] << \", \"\n              << sphereSource->GetCenter()[2] << std::endl;\n    // Store the distance in the points withnin the current radius\n    for (vtkIdType i = 0; i < k; i++)\n    {\n      vtkIdType point_ind = result->GetId(i);\n      scalars->SetTuple1(point_ind, *rIter);\n    }\n  }\n  polyData->GetPointData()->SetScalars(scalars);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(.667, 0.0);\n  lut->SetNumberOfTableValues(radii.size() + 1);\n  lut->SetRange(*radii.begin(), *radii.rbegin());\n  lut->Build();\n\n  // Create a transluscent sphere for each radii\n  if (radii.size() < 6)\n  {\n    for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n         rIter != radii.rend(); ++rIter)\n    {\n      vtkNew<vtkSphereSource> radiiSource;\n      radiiSource->SetPhiResolution(31);\n      radiiSource->SetThetaResolution(31);\n      radiiSource->SetStartPhi(90.0);\n      radiiSource->SetRadius(*rIter);\n      radiiSource->SetCenter(range[0] / 2.0 + bounds[0],\n                             range[1] / 2.0 + bounds[2], bounds[5]);\n\n      vtkNew<vtkPolyDataMapper> radiiMapper;\n      radiiMapper->SetInputConnection(radiiSource->GetOutputPort());\n\n      vtkNew<vtkProperty> backProp;\n      backProp->SetDiffuseColor(colors->GetColor3d(\"LightGrey\").GetData());\n\n      vtkNew<vtkActor> radiiActor;\n      radiiActor->SetMapper(radiiMapper);\n      radiiActor->GetProperty()->SetDiffuseColor(\n          colors->GetColor3d(\"White\").GetData());\n      radiiActor->GetProperty()->SetOpacity(.1);\n      radiiActor->SetBackfaceProperty(backProp);\n\n      renderer->AddActor(radiiActor);\n    }\n  }\n\n  // Display the original poly data\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(*radii.begin(), *radii.rbegin());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n  renderWindow->SetWindowName(\"OctreeFindPointsWithinRadiusDemo\");\n\n  renderWindow->Render();\n\n  // Pick a good view\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeFindPointsWithinRadiusDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeFindPointsWithinRadiusDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeFindPointsWithinRadiusDemo MACOSX_BUNDLE OctreeFindPointsWithinRadiusDemo.cxx )\n  target_link_libraries(OctreeFindPointsWithinRadiusDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeFindPointsWithinRadiusDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/#download-and-build-octreefindpointswithinradiusdemo","title":"Download and Build OctreeFindPointsWithinRadiusDemo","text":"

        Click here to download OctreeFindPointsWithinRadiusDemo and its CMakeLists.txt file. Once the tarball OctreeFindPointsWithinRadiusDemo.tar has been downloaded and extracted,

        cd OctreeFindPointsWithinRadiusDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OctreeFindPointsWithinRadiusDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/OctreeKClosestPoints/","title":"OctreeKClosestPoints","text":"

        vtk-examples/Cxx/DataStructures/OctreeKClosestPoints

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/OctreeKClosestPoints/#code","title":"Code","text":"

        OctreeKClosestPoints.cxx

        #include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPointSource.h>\n\nint main(int, char*[])\n{\n  // Create some random points\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(10);\n  pointSource->Update();\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetDataSet(pointSource->GetOutput());\n  octree->BuildLocator();\n\n  // Find the k closest points to (0,0,0)\n  vtkIdType k = 1;\n  double testPoint[3] = {0.0, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n\n  octree->FindClosestNPoints(k, testPoint, result);\n\n  for (vtkIdType i = 0; i < k; i++)\n  {\n    vtkIdType point_ind = result->GetId(i);\n    double p[3];\n    pointSource->GetOutput()->GetPoint(point_ind, p);\n    std::cout << \"Closest point \" << i << \": Point \" << point_ind << \": (\"\n              << p[0] << \", \" << p[1] << \", \" << p[2] << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/OctreeKClosestPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeKClosestPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeKClosestPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeKClosestPoints MACOSX_BUNDLE OctreeKClosestPoints.cxx )\n  target_link_libraries(OctreeKClosestPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeKClosestPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/OctreeKClosestPoints/#download-and-build-octreekclosestpoints","title":"Download and Build OctreeKClosestPoints","text":"

        Click here to download OctreeKClosestPoints and its CMakeLists.txt file. Once the tarball OctreeKClosestPoints.tar has been downloaded and extracted,

        cd OctreeKClosestPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OctreeKClosestPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/OctreeTimingDemo/","title":"OctreeTimingDemo","text":"

        vtk-examples/Cxx/DataStructures/OctreeTimingDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/OctreeTimingDemo/#description","title":"Description","text":"

        This example runs several closest point queries on octrees with varying MaxPointsPerRegion and plots the result.

        Your timing graph will be different when compared to the above illustration.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/OctreeTimingDemo/#code","title":"Code","text":"

        OctreeTimingDemo.cxx

        #include <vtkAxis.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPlot.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTable.h>\n#include <vtkTimerLog.h>\n\n#include <time.h>\n#include <vector>\n\nnamespace {\n// void RandomPointInBounds(vtkPolyData* polydata, double p[3]);\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng);\n\ndouble TimeOctree(vtkPolyData* polydata, int maxPoints, int numberOfTrials,\n                  vtkMinimalStandardRandomSequence* rng);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> reader;\n  reader->SetThetaResolution(30);\n  reader->SetPhiResolution(30);\n  reader->Update();\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  std::cout << \"Timing octree...\" << std::endl;\n  std::vector<std::pair<int, double>> results;\n  int numberOfTrials = 1000;\n  for (int i = 1; i < 100; i++)\n  {\n    double t = TimeOctree(reader->GetOutput(), i, numberOfTrials, rng);\n    std::pair<int, double> result(i, t);\n    results.push_back(result);\n  }\n\n  // Create a table with some points in it\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> maxPointsPerRegion;\n  maxPointsPerRegion->SetName(\"MaxPointsPerRegion\");\n  table->AddColumn(maxPointsPerRegion);\n\n  vtkNew<vtkFloatArray> runtime;\n  runtime->SetName(\"Run time\");\n  table->AddColumn(runtime);\n\n  // Fill in the table with some example values\n  size_t numPoints = results.size();\n  table->SetNumberOfRows(static_cast<vtkIdType>(numPoints));\n  for (size_t i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(static_cast<vtkIdType>(i), 0, results[i].first);\n    table->SetValue(static_cast<vtkIdType>(i), 1, results[i].second);\n    std::cout << \"Put \" << results[i].first << \" \" << results[i].second\n              << \" in the table.\" << std::endl;\n  }\n\n  // Set up the view\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"White\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"OctreeTimingDemo\");\n\n  // Add multiple line plots, setting the colors etc\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  vtkPlot* line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 1);\n  auto lineColor = colors->HTMLColorToRGBA(\"Lime\").GetData();\n  line->SetColor(lineColor[0], lineColor[1], lineColor[2], lineColor[3]);\n  line->SetWidth(3.0);\n  line->GetXAxis()->SetTitle(\"Max Points Per Region\");\n  line->GetYAxis()->SetTitle(\"Run time\");\n\n  // Set up an interactor and start\n  view->Render();\n  view->GetInteractor()->SetRenderWindow(view->GetRenderWindow());\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid RandomPointInBounds(vtkPolyData* polydata, double p[3],\n                         vtkMinimalStandardRandomSequence* rng)\n{\n  double bounds[6];\n  polydata->GetBounds(bounds);\n\n  for (auto i = 0; i < 3; ++i)\n  {\n    p[i] = bounds[i * 2] +\n        (bounds[i * 2 + 1] - bounds[i * 2]) * rng->GetRangeValue(0.0, 1.0);\n    rng->Next();\n  }\n}\n\ndouble TimeOctree(vtkPolyData* polydata, int maxPoints, int numberOfTrials,\n                  vtkMinimalStandardRandomSequence* rng)\n{\n  vtkNew<vtkTimerLog> timer;\n  timer->StartTimer();\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetDataSet(polydata);\n  octree->SetMaximumPointsPerRegion(maxPoints);\n  octree->BuildLocator();\n\n  std::cout << \"With maxPoints = \" << maxPoints << \" there are \"\n            << octree->GetNumberOfLeafNodes() << \" leaf nodes.\" << std::endl;\n\n  for (int i = 0; i < numberOfTrials; i++)\n  {\n    double p[3];\n    RandomPointInBounds(polydata, p, rng);\n    // vtkIdType iD = octree->FindClosestPoint(p);\n    octree->FindClosestPoint(p);\n  }\n\n  timer->StopTimer();\n\n  std::cout << \"Octree took \" << timer->GetElapsedTime() << std::endl;\n\n  return timer->GetElapsedTime();\n}\n\n} // namespace\n
        "},{"location":"Cxx/DataStructures/OctreeTimingDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeTimingDemo)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonSystem\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeTimingDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeTimingDemo MACOSX_BUNDLE OctreeTimingDemo.cxx )\n  target_link_libraries(OctreeTimingDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeTimingDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/OctreeTimingDemo/#download-and-build-octreetimingdemo","title":"Download and Build OctreeTimingDemo","text":"

        Click here to download OctreeTimingDemo and its CMakeLists.txt file. Once the tarball OctreeTimingDemo.tar has been downloaded and extracted,

        cd OctreeTimingDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OctreeTimingDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/OctreeVisualize/","title":"OctreeVisualize","text":"

        vtk-examples/Cxx/DataStructures/OctreeVisualize

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/OctreeVisualize/#code","title":"Code","text":"

        OctreeVisualize.cxx

        #include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOctreePointLocator.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\n#include <cmath>\n\nnamespace {\nclass vtkSliderCallback : public vtkCommand\n{\npublic:\n  static vtkSliderCallback* New()\n\n  {\n    return new vtkSliderCallback;\n  }\n  vtkSliderCallback() : Octree(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n\n    this->Octree->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkOctreePointLocator* Octree;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a point cloud\n  vtkNew<vtkSphereSource> pointSource;\n  pointSource->SetPhiResolution(50);\n  pointSource->SetThetaResolution(50);\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(pointSource->GetOutputPort());\n  pointSource->Update();\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetRepresentationToPoints();\n  pointsActor->GetProperty()->SetColor(colors->GetColor4d(\"Yellow\").GetData());\n\n  // Create the tree\n  vtkNew<vtkOctreePointLocator> octree;\n  octree->SetMaximumPointsPerRegion(5);\n  octree->SetDataSet(pointSource->GetOutput());\n  octree->BuildLocator();\n\n  vtkNew<vtkPolyData> polydata;\n  octree->GenerateRepresentation(0, polydata);\n\n  vtkNew<vtkPolyDataMapper> octreeMapper;\n  octreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> octreeActor;\n  octreeActor->SetMapper(octreeMapper);\n  octreeActor->GetProperty()->SetInterpolationToFlat();\n  octreeActor->GetProperty()->SetRepresentationToWireframe();\n  octreeActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"SpringGreen\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(octreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->SetWindowName(\"OctreeVisualize\");\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(octree->GetLevel());\n  sliderRep->SetValue(0);\n  sliderRep->SetTitleText(\"Level\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(.2, .2);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(.8, .2);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  sliderRep->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"Beige\").GetData());\n  sliderRep->GetCapProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  sliderRep->GetSliderProperty()->SetColor(\n      colors->GetColor3d(\"LightBlue\").GetData());\n  sliderRep->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"Violet\").GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->Octree = octree;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/DataStructures/OctreeVisualize/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OctreeVisualize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OctreeVisualize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OctreeVisualize MACOSX_BUNDLE OctreeVisualize.cxx )\n  target_link_libraries(OctreeVisualize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OctreeVisualize\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/OctreeVisualize/#download-and-build-octreevisualize","title":"Download and Build OctreeVisualize","text":"

        Click here to download OctreeVisualize and its CMakeLists.txt file. Once the tarball OctreeVisualize.tar has been downloaded and extracted,

        cd OctreeVisualize/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OctreeVisualize\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/","title":"PointLocatorFindPointsWithinRadiusDemo","text":"

        vtk-examples/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/#description","title":"Description","text":"

        This example uses vtkPointLocator to find all points within a given radius. The example generates \"n\" spheres and finds all the points within the radius of the spheres. The input vtkPolyData's vtkPointData is set the the radius value of each sphere.

        The example takes one or two arguments. The first argument specifies the input file that contains vtkPolyData. The second optional argument specifies the number of radii use. If the number is < 6, the vtkSphereSource will be displayed as concentric translucent spheres.

        The image was produced with this command:

        PointLocatorFindPointsWithinRadius dragon.ply 10\n

        To see the translucent spheres run:

        PointLocatoFindPointsWithinRadius dragon.ply\n

        Info

        See other locator demos: KDTreeFindPointsWithinRadiusDemo, OctreeFindPointsWithinRadiusDemo, StaticLocatorFindPointsWithinRadiusDemo

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/#code","title":"Code","text":"

        PointLocatorFindPointsWithinRadiusDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <vtkDoubleArray.h>\n#include <vtkIdList.h>\n#include <vtkPointData.h>\n#include <vtkPointLocator.h>\n#include <vtkPolyData.h>\n\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtksys/SystemTools.hxx>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <array>\n#include <cctype> // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\n// Templated join which can be used on any combination\n//  of streams, and a container of base types.\ntemplate <typename TStream, typename TContainer, typename TSeparator>\nTStream& join(TStream& stream, TContainer const& cont,\n              TSeparator const& separator)\n{\n  auto sep = false;\n  for (auto const& p : cont)\n  {\n    if (sep)\n      stream << separator;\n    else\n    {\n      sep = true;\n    }\n    stream << p;\n  }\n  // As a convenience, return a reference to the passed stream.\n  return stream;\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" dragon.ply [number of radii] \"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int numberOfRadii = 5;\n  if (argc > 2)\n  {\n    numberOfRadii = std::atoi(argv[2]);\n  }\n  // Read the polydata\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Compute bounds and range\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n  std::cout << \"Bounds: \";\n  join(std::cout, bounds, \", \") << std::endl;\n  std::array<double, 3> range;\n  range[0] = bounds[1] - bounds[0];\n  range[1] = bounds[3] - bounds[2];\n  range[2] = bounds[5] - bounds[4];\n  std::cout << \"Range: \";\n  join(std::cout, range, \", \") << std::endl;\n\n  // double maxRange = std::max({range[0], range[1], range[2]});\n  double minRange = std::min({range[0], range[1], range[2]});\n\n  // Define a sphere at one edge of bounding box\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(range[0] / 2.0 + bounds[0],\n                          range[1] / 2.0 + bounds[2], bounds[5]);\n  sphereSource->SetRadius(minRange);\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n  sphereSource->SetStartPhi(90.0);\n  sphereSource->Update();\n\n  // Initialize the locator\n  vtkNew<vtkPointLocator> pointTree;\n  pointTree->SetDataSet(polyData);\n  pointTree->BuildLocator();\n\n  // Compute the radius for each call to FindPointsWithinRadius\n  std::vector<double> radii;\n  double radiiStart = .25 * sphereSource->GetRadius();\n  double radiiEnd = 1.0 * sphereSource->GetRadius();\n  double radiiDelta = (radiiEnd - radiiStart) / (numberOfRadii - 1);\n\n  for (int r = 0; r < numberOfRadii; ++r)\n  {\n    radii.push_back(radiiStart + radiiDelta * r);\n  }\n\n  // Create an array to hold the scalar point data\n  vtkNew<vtkDoubleArray> scalars;\n  scalars->SetNumberOfComponents(1);\n  scalars->SetNumberOfTuples(polyData->GetNumberOfPoints());\n  scalars->FillComponent(0, 0.0);\n\n  // Process each radii from largest to smallest\n  for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n       rIter != radii.rend(); ++rIter)\n  {\n    vtkNew<vtkIdList> result;\n    pointTree->FindPointsWithinRadius(*rIter, sphereSource->GetCenter(),\n                                      result);\n    vtkIdType k = result->GetNumberOfIds();\n    std::cout << k << \" points within \" << *rIter << \" of \"\n              << sphereSource->GetCenter()[0] << \", \"\n              << sphereSource->GetCenter()[1] << \", \"\n              << sphereSource->GetCenter()[2] << std::endl;\n    // Store the distance in the points withnin the current radius\n    for (vtkIdType i = 0; i < k; i++)\n    {\n      vtkIdType point_ind = result->GetId(i);\n      scalars->SetTuple1(point_ind, *rIter);\n    }\n  }\n  polyData->GetPointData()->SetScalars(scalars);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(.667, 0.0);\n  lut->SetNumberOfTableValues(radii.size() + 1);\n  lut->SetRange(*radii.begin(), *radii.rbegin());\n  lut->Build();\n\n  // Create a transluscent sphere for each radii\n  if (radii.size() < 6)\n  {\n    for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n         rIter != radii.rend(); ++rIter)\n    {\n      vtkNew<vtkSphereSource> radiiSource;\n      radiiSource->SetPhiResolution(31);\n      radiiSource->SetThetaResolution(31);\n      radiiSource->SetStartPhi(90.0);\n      radiiSource->SetRadius(*rIter);\n      radiiSource->SetCenter(range[0] / 2.0 + bounds[0],\n                             range[1] / 2.0 + bounds[2], bounds[5]);\n\n      vtkNew<vtkPolyDataMapper> radiiMapper;\n      radiiMapper->SetInputConnection(radiiSource->GetOutputPort());\n\n      vtkNew<vtkProperty> backProp;\n      backProp->SetDiffuseColor(colors->GetColor3d(\"LightGrey\").GetData());\n\n      vtkNew<vtkActor> radiiActor;\n      radiiActor->SetMapper(radiiMapper);\n      radiiActor->GetProperty()->SetDiffuseColor(\n          colors->GetColor3d(\"White\").GetData());\n      radiiActor->GetProperty()->SetOpacity(.1);\n      radiiActor->SetBackfaceProperty(backProp);\n\n      renderer->AddActor(radiiActor);\n    }\n  }\n\n  // Display the original poly data\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(*radii.begin(), *radii.rbegin());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n  renderWindow->SetWindowName(\"PointLocatorFindPointsWithinRadiusDemo\");\n\n  renderWindow->Render();\n\n  // Pick a good view\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointLocatorFindPointsWithinRadiusDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointLocatorFindPointsWithinRadiusDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointLocatorFindPointsWithinRadiusDemo MACOSX_BUNDLE PointLocatorFindPointsWithinRadiusDemo.cxx )\n  target_link_libraries(PointLocatorFindPointsWithinRadiusDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointLocatorFindPointsWithinRadiusDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/#download-and-build-pointlocatorfindpointswithinradiusdemo","title":"Download and Build PointLocatorFindPointsWithinRadiusDemo","text":"

        Click here to download PointLocatorFindPointsWithinRadiusDemo and its CMakeLists.txt file. Once the tarball PointLocatorFindPointsWithinRadiusDemo.tar has been downloaded and extracted,

        cd PointLocatorFindPointsWithinRadiusDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointLocatorFindPointsWithinRadiusDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/","title":"StaticLocatorFindPointsWithinRadiusDemo","text":"

        vtk-examples/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/#description","title":"Description","text":"

        This example uses vtkStaticPointLocator to find all points within a given radius. The example generates \"n\" spheres and finds all the points within the radius of the spheres. The input vtkPolyData's vtkPointData is set the the radius value of each sphere.

        The example takes one or two arguments. The first argument specifies the input file that contains vtkPolyData. The second optional argument specifies the number of radii use. If the number is < 6, the vtkSphereSource will be displayed as concentric translucent spheres.

        The image was produced with this command:

        StaticLocatorFindPointsWithinRadius dragon.ply 10\n

        To see the translucent spheres run:

        StaticLocatoFindPointsWithinRadius dragon.ply\n

        Info

        See other locator demos: KDTreeFindPointsWithinRadiusDemo, OctreeFindPointsWithinRadiusDemo, PointLocatorFindPointsWithinRadiusDemo

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/#code","title":"Code","text":"

        StaticLocatorFindPointsWithinRadiusDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkDoubleArray.h>\n#include <vtkIdList.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkStaticPointLocator.h>\n\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <array>\n#include <cctype> // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\n// Templated join which can be used on any combination\n//  of streams, and a container of base types.\ntemplate <typename TStream, typename TContainer, typename TSeparator>\nTStream& join(TStream& stream, TContainer const& cont,\n              TSeparator const& separator)\n{\n  auto sep = false;\n  for (auto const& p : cont)\n  {\n    if (sep)\n      stream << separator;\n    else\n    {\n      sep = true;\n    }\n    stream << p;\n  }\n  // As a convenience, return a reference to the passed stream.\n  return stream;\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" shark.ply [number of radii] \"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int numberOfRadii = 5;\n  if (argc > 2)\n  {\n    numberOfRadii = std::atoi(argv[2]);\n  }\n  // Read the polydata\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Compute bounds and range\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n  std::cout << \"Bounds: \";\n  join(std::cout, bounds, \", \") << std::endl;\n  std::array<double, 3> range;\n  range[0] = bounds[1] - bounds[0];\n  range[1] = bounds[3] - bounds[2];\n  range[2] = bounds[5] - bounds[4];\n  std::cout << \"Range: \";\n  join(std::cout, range, \", \") << std::endl;\n\n  // double maxRange = std::max({range[0], range[1], range[2]});\n  double minRange = std::min({range[0], range[1], range[2]});\n\n  // Define a sphere at one edge of bounding box\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(range[0] / 2.0 + bounds[0],\n                          range[1] / 2.0 + bounds[2], bounds[5]);\n  sphereSource->SetRadius(minRange);\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n  sphereSource->SetStartPhi(90.0);\n  sphereSource->Update();\n\n  // Initialize the locator\n  vtkNew<vtkStaticPointLocator> pointTree;\n  pointTree->SetDataSet(polyData);\n  pointTree->BuildLocator();\n\n  // Compute the radius for each call to FindPointsWithinRadius\n  std::vector<double> radii;\n  double radiiStart = .25 * sphereSource->GetRadius();\n  double radiiEnd = 1.0 * sphereSource->GetRadius();\n  double radiiDelta = (radiiEnd - radiiStart) / (numberOfRadii - 1);\n\n  for (int r = 0; r < numberOfRadii; ++r)\n  {\n    radii.push_back(radiiStart + radiiDelta * r);\n  }\n\n  // Create an array to hold the scalar point data\n  vtkNew<vtkDoubleArray> scalars;\n  scalars->SetNumberOfComponents(1);\n  scalars->SetNumberOfTuples(polyData->GetNumberOfPoints());\n  scalars->FillComponent(0, 0.0);\n\n  // Process each radii from largest to smallest\n  for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n       rIter != radii.rend(); ++rIter)\n  {\n    vtkNew<vtkIdList> result;\n    pointTree->FindPointsWithinRadius(*rIter, sphereSource->GetCenter(),\n                                      result);\n    vtkIdType k = result->GetNumberOfIds();\n    std::cout << k << \" points within \" << *rIter << \" of \"\n              << sphereSource->GetCenter()[0] << \", \"\n              << sphereSource->GetCenter()[1] << \", \"\n              << sphereSource->GetCenter()[2] << std::endl;\n    // Store the distance in the points withnin the current radius\n    for (vtkIdType i = 0; i < k; i++)\n    {\n      vtkIdType point_ind = result->GetId(i);\n      scalars->SetTuple1(point_ind, *rIter);\n    }\n  }\n  polyData->GetPointData()->SetScalars(scalars);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(.667, 0.0);\n  lut->SetNumberOfTableValues(radii.size() + 1);\n  lut->SetRange(*radii.begin(), *radii.rbegin());\n  lut->Build();\n\n  // Create a transluscent sphere for each radii\n  if (radii.size() < 6)\n  {\n    for (std::vector<double>::reverse_iterator rIter = radii.rbegin();\n         rIter != radii.rend(); ++rIter)\n    {\n      vtkNew<vtkSphereSource> radiiSource;\n      radiiSource->SetPhiResolution(31);\n      radiiSource->SetThetaResolution(31);\n      radiiSource->SetStartPhi(90.0);\n      radiiSource->SetRadius(*rIter);\n      radiiSource->SetCenter(range[0] / 2.0 + bounds[0],\n                             range[1] / 2.0 + bounds[2], bounds[5]);\n\n      vtkNew<vtkPolyDataMapper> radiiMapper;\n      radiiMapper->SetInputConnection(radiiSource->GetOutputPort());\n\n      vtkNew<vtkProperty> backProp;\n      backProp->SetDiffuseColor(colors->GetColor3d(\"LightGrey\").GetData());\n\n      vtkNew<vtkActor> radiiActor;\n      radiiActor->SetMapper(radiiMapper);\n      radiiActor->GetProperty()->SetDiffuseColor(\n          colors->GetColor3d(\"White\").GetData());\n      radiiActor->GetProperty()->SetOpacity(.1);\n      radiiActor->SetBackfaceProperty(backProp);\n\n      renderer->AddActor(radiiActor);\n    }\n  }\n\n  // Display the original poly data\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(*radii.begin(), *radii.rbegin());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n  renderWindow->SetWindowName(\"StaticLocatorFindPointsWithinRadiusDemo\");\n\n  renderWindow->Render();\n\n  // Pick a good view\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StaticLocatorFindPointsWithinRadiusDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StaticLocatorFindPointsWithinRadiusDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StaticLocatorFindPointsWithinRadiusDemo MACOSX_BUNDLE StaticLocatorFindPointsWithinRadiusDemo.cxx )\n  target_link_libraries(StaticLocatorFindPointsWithinRadiusDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StaticLocatorFindPointsWithinRadiusDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/#download-and-build-staticlocatorfindpointswithinradiusdemo","title":"Download and Build StaticLocatorFindPointsWithinRadiusDemo","text":"

        Click here to download StaticLocatorFindPointsWithinRadiusDemo and its CMakeLists.txt file. Once the tarball StaticLocatorFindPointsWithinRadiusDemo.tar has been downloaded and extracted,

        cd StaticLocatorFindPointsWithinRadiusDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StaticLocatorFindPointsWithinRadiusDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/VisualizeKDTree/","title":"VisualizeKDTree","text":"

        vtk-examples/Cxx/DataStructures/VisualizeKDTree

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/VisualizeKDTree/#description","title":"Description","text":"

        This demo displays the level of a vtkKdTree using a slider. A KdTree is an k-d tree. It is used in fast intersection tests, collision detection and point location.

        Here's the embedded video:

        a

        Seealso

        VisualizeOBBTree and VisualizeModifiedBSPTree.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/VisualizeKDTree/#code","title":"Code","text":"

        VisualizeKDTree.cxx

        #include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkKdTree.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\nclass vtkSliderCallback : public vtkCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  vtkSliderCallback() : KdTree(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->KdTree->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkKdTree* KdTree;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputData(polyData);\n  pointsMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetColor(colors->GetColor4d(\"Yellow\").GetData());\n\n  int maxLevel = 5;\n  // Create the tree.\n  vtkNew<vtkKdTree> kdTree;\n  kdTree->SetDataSet(polyData);\n  kdTree->SetMaxLevel(maxLevel);\n  kdTree->BuildLocator();\n\n  // Initialize the representation.\n  vtkNew<vtkPolyData> polydata;\n  kdTree->GenerateRepresentation(maxLevel / 2, polydata);\n\n  vtkNew<vtkPolyDataMapper> kdtreeMapper;\n  kdtreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> octreeActor;\n  octreeActor->SetMapper(kdtreeMapper);\n  octreeActor->GetProperty()->SetInterpolationToFlat();\n  octreeActor->GetProperty()->SetOpacity(.6);\n  octreeActor->GetProperty()->EdgeVisibilityOn();\n  octreeActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"SpringGreen\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(octreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->SetUseDepthPeeling(1);\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->SetWindowName(\"VisualizeKDTree\");\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(kdTree->GetLevel());\n  sliderRep->SetValue(kdTree->GetLevel() / 2);\n  sliderRep->SetTitleText(\"Level\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(.2, .2);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(.8, .2);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  sliderRep->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"Beige\").GetData());\n  sliderRep->GetCapProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  sliderRep->GetSliderProperty()->SetColor(\n      colors->GetColor3d(\"LightBlue\").GetData());\n  sliderRep->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"Violet\").GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->KdTree = kdTree;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n  callback->Execute(sliderWidget, 0, 0);\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  // Ensure the current level is set.\n  callback->Execute(sliderWidget, 0, 0);\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/DataStructures/VisualizeKDTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeKDTree)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeKDTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeKDTree MACOSX_BUNDLE VisualizeKDTree.cxx )\n  target_link_libraries(VisualizeKDTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeKDTree\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/VisualizeKDTree/#download-and-build-visualizekdtree","title":"Download and Build VisualizeKDTree","text":"

        Click here to download VisualizeKDTree and its CMakeLists.txt file. Once the tarball VisualizeKDTree.tar has been downloaded and extracted,

        cd VisualizeKDTree/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VisualizeKDTree\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/VisualizeModifiedBSPTree/","title":"VisualizeModifiedBSPTree","text":"

        vtk-examples/Cxx/DataStructures/VisualizeModifiedBSPTree

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/VisualizeModifiedBSPTree/#description","title":"Description","text":"

        This demo displays level of a vtkModifiedBSPTree using a slider. A Modified BSP Tree is a BSP Tree. It is used for rendering, collision detection, and point location.

        Here is the embedded video:

        Seealso

        VisualizeKDTree and VisualizeOBBTree.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/VisualizeModifiedBSPTree/#code","title":"Code","text":"

        VisualizeModifiedBSPTree.cxx

        #include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkModifiedBSPTree.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <cmath>\n\nnamespace {\nclass vtkSliderCallback : public vtkCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  vtkSliderCallback() : BSPTree(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->BSPTree->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkModifiedBSPTree* BSPTree;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n} // namespace\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputData(polyData);\n  pointsMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetOpacity(.3);\n  pointsActor->GetProperty()->SetColor(colors->GetColor4d(\"Yellow\").GetData());\n\n  // Create the tree\n  vtkNew<vtkModifiedBSPTree> bspTree;\n  bspTree->SetDataSet(polyData);\n  bspTree->BuildLocator();\n\n  int maxLevel = 5;\n  // Initialize the representation\n  vtkNew<vtkPolyData> polydata;\n  bspTree->SetMaxLevel(maxLevel);\n  bspTree->GenerateRepresentation(0, polydata);\n\n  vtkNew<vtkPolyDataMapper> bspTreeMapper;\n  bspTreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> bspTreeActor;\n  bspTreeActor->SetMapper(bspTreeMapper);\n  bspTreeActor->GetProperty()->SetInterpolationToFlat();\n  bspTreeActor->GetProperty()->SetOpacity(.5);\n  bspTreeActor->GetProperty()->EdgeVisibilityOn();\n  bspTreeActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"SpringGreen\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actors to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(bspTreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->SetWindowName(\"VisualizeModifiedBSPTree\");\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(bspTree->GetLevel());\n  sliderRep->SetValue(bspTree->GetLevel() / 2);\n  sliderRep->SetTitleText(\"Level\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(.2, .2);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(.8, .2);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  sliderRep->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"Beige\").GetData());\n  sliderRep->GetCapProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  sliderRep->GetSliderProperty()->SetColor(\n      colors->GetColor3d(\"LightBlue\").GetData());\n  sliderRep->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"Violet\").GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->BSPTree = bspTree;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n\n  callback->Execute(sliderWidget, 0, 0);\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkSmartPointer<vtkSphereSource> source =\n        vtkSmartPointer<vtkSphereSource>::New();\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/DataStructures/VisualizeModifiedBSPTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeModifiedBSPTree)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersFlowPaths\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeModifiedBSPTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeModifiedBSPTree MACOSX_BUNDLE VisualizeModifiedBSPTree.cxx )\n  target_link_libraries(VisualizeModifiedBSPTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeModifiedBSPTree\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/VisualizeModifiedBSPTree/#download-and-build-visualizemodifiedbsptree","title":"Download and Build VisualizeModifiedBSPTree","text":"

        Click here to download VisualizeModifiedBSPTree and its CMakeLists.txt file. Once the tarball VisualizeModifiedBSPTree.tar has been downloaded and extracted,

        cd VisualizeModifiedBSPTree/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VisualizeModifiedBSPTree\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/DataStructures/VisualizeOBBTree/","title":"VisualizeOBBTree","text":"

        vtk-examples/Cxx/DataStructures/VisualizeOBBTree

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/DataStructures/VisualizeOBBTree/#description","title":"Description","text":"

        This demo displays level of a vtkOBBTree using a slider. An OBBTree is an Oriented Bounding Box Tree. It is used in fast intersection tests, collision detection.

        Here's he embeded video:

        Seealso

        VisualizeKDTree and VisualizeModifiedBSPTree.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/DataStructures/VisualizeOBBTree/#code","title":"Code","text":"

        VisualizeOBBTree.cxx

        #include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nnamespace {\nclass vtkSliderCallback : public vtkCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n\n  vtkSliderCallback() : OBBTree(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->OBBTree->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkOBBTree* OBBTree;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n} // namespace\n\nint main(int argc, char* argv[])\n{\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputData(polyData);\n  pointsMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetColor(colors->GetColor4d(\"Yellow\").GetData());\n  pointsActor->GetProperty()->SetOpacity(.3);\n\n  int maxLevel = 5;\n  // Create the tree\n  vtkNew<vtkOBBTree> obbTree;\n  obbTree->SetDataSet(polyData);\n  obbTree->SetMaxLevel(maxLevel);\n  obbTree->BuildLocator();\n\n  double corner[3] = {0.0, 0.0, 0.0};\n  double max[3] = {0.0, 0.0, 0.0};\n  double mid[3] = {0.0, 0.0, 0.0};\n  double min[3] = {0.0, 0.0, 0.0};\n  double size[3] = {0.0, 0.0, 0.0};\n\n  obbTree->ComputeOBB(polyData, corner, max, mid, min, size);\n\n  std::cout << \"Corner:\\t\" << corner[0] << \", \" << corner[1] << \", \"\n            << corner[2] << std::endl\n            << \"Max:\\t\" << max[0] << \", \" << max[1] << \", \" << max[2]\n            << std::endl\n            << \"Mid:\\t\" << mid[0] << \", \" << mid[1] << \", \" << mid[2]\n            << std::endl\n            << \"Min:\\t\" << min[0] << \", \" << min[1] << \", \" << min[2]\n            << std::endl\n            << \"Size:\\t\" << size[0] << \", \" << size[1] << \", \" << size[2]\n            << std::endl;\n\n  // Initialize the representation\n  vtkNew<vtkPolyData> polydata;\n  obbTree->GenerateRepresentation(0, polydata);\n\n  vtkNew<vtkPolyDataMapper> obbtreeMapper;\n  obbtreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> obbtreeActor;\n  obbtreeActor->SetMapper(obbtreeMapper);\n  obbtreeActor->GetProperty()->SetInterpolationToFlat();\n  obbtreeActor->GetProperty()->SetOpacity(.5);\n  obbtreeActor->GetProperty()->EdgeVisibilityOn();\n  obbtreeActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"SpringGreen\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actors to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(obbtreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->SetWindowName(\"VisualizeOBBTree\");\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(obbTree->GetLevel());\n  sliderRep->SetValue(obbTree->GetLevel() / 2);\n  sliderRep->SetTitleText(\"Level\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(.2, .2);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(.8, .2);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  sliderRep->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"Beige\").GetData());\n  sliderRep->GetCapProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  sliderRep->GetSliderProperty()->SetColor(\n      colors->GetColor3d(\"LightBlue\").GetData());\n  sliderRep->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"Violet\").GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->OBBTree = obbTree;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n  callback->Execute(sliderWidget, 0, 0);\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/DataStructures/VisualizeOBBTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeOBBTree)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeOBBTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeOBBTree MACOSX_BUNDLE VisualizeOBBTree.cxx )\n  target_link_libraries(VisualizeOBBTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeOBBTree\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/DataStructures/VisualizeOBBTree/#download-and-build-visualizeobbtree","title":"Download and Build VisualizeOBBTree","text":"

        Click here to download VisualizeOBBTree and its CMakeLists.txt file. Once the tarball VisualizeOBBTree.tar has been downloaded and extracted,

        cd VisualizeOBBTree/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VisualizeOBBTree\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/AlgorithmFilter/","title":"AlgorithmFilter","text":"

        vtk-examples/Cxx/Developers/AlgorithmFilter

        "},{"location":"Cxx/Developers/AlgorithmFilter/#description","title":"Description","text":"

        This example demonstrates how to create a filter that accepts a custom class and returns a custom class. To test that it is working, the class vtkTest simply stores a double named 'Value' that is instantiated to the value of 4.5. Example.cxx instantiates a vtkTest and sets its value to 5.6. The filter adds 1.0 to this value, so the vtkTest that is the output of the vtkTestAlgorithmFilter should contain the value 6.6.

        You will need the following in your CMakeLists.txt file:

        find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/AlgorithmFilter/#code","title":"Code","text":"

        AlgorithmFilter.cxx

        #include <vtkNew.h>\n\n#include \"vtkTest.h\"\n#include \"vtkTestAlgorithmFilter.h\"\n\nint main(int, char*[])\n{\n  vtkNew<vtkTest> inputTest;\n  inputTest->SetValue(5.6);\n  std::cout << \"Input value: \" << inputTest->GetValue() << std::endl;\n\n  vtkNew<vtkTestAlgorithmFilter> filter;\n  filter->SetInput(inputTest);\n  filter->Update();\n\n  vtkTest* outputTest = filter->GetOutput();\n  std::cout << \"Output value: \" << outputTest->GetValue() << std::endl;\n  std::cout << \"Input value is still: \" << inputTest->GetValue() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n

        vtkTestAlgorithmFilter.cxx

        #include \"vtkTestAlgorithmFilter.h\"\n#include \"vtkTest.h\"\n\n#include <vtkCommand.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestAlgorithmFilter);\n\n//----------------------------------------------------------------------------\nvtkTestAlgorithmFilter::vtkTestAlgorithmFilter()\n{\n  this->SetNumberOfInputPorts(1);\n  this->SetNumberOfOutputPorts(1);\n}\n\n//----------------------------------------------------------------------------\nvtkTestAlgorithmFilter::~vtkTestAlgorithmFilter()\n{\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n\n//----------------------------------------------------------------------------\nvtkTest* vtkTestAlgorithmFilter::GetOutput()\n{\n  return this->GetOutput(0);\n}\n\n//----------------------------------------------------------------------------\nvtkTest* vtkTestAlgorithmFilter::GetOutput(int port)\n{\n  return dynamic_cast<vtkTest*>(this->GetOutputDataObject(port));\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::SetOutput(vtkDataObject* d)\n{\n  this->GetExecutive()->SetOutputData(0, d);\n}\n\n//----------------------------------------------------------------------------\nvtkDataObject* vtkTestAlgorithmFilter::GetInput()\n{\n  return this->GetInput(0);\n}\n\n//----------------------------------------------------------------------------\nvtkDataObject* vtkTestAlgorithmFilter::GetInput(int port)\n{\n  return this->GetExecutive()->GetInputData(port, 0);\n}\n\n//----------------------------------------------------------------------------\nvtkTest* vtkTestAlgorithmFilter::GetLabelHierarchyInput(int port)\n{\n  return dynamic_cast<vtkTest*>(this->GetInput(port));\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmFilter::ProcessRequest(vtkInformation* request,\n                                           vtkInformationVector** inputVector,\n                                           vtkInformationVector* outputVector)\n{\n  // Create an output object of the correct type.\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA_OBJECT()))\n  {\n    return this->RequestDataObject(request, inputVector, outputVector);\n  }\n  // generate the data\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))\n  {\n    return this->RequestData(request, inputVector, outputVector);\n  }\n\n  if (request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT()))\n  {\n    return this->RequestUpdateExtent(request, inputVector, outputVector);\n  }\n\n  // execute information\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))\n  {\n    return this->RequestInformation(request, inputVector, outputVector);\n  }\n\n  return this->Superclass::ProcessRequest(request, inputVector, outputVector);\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmFilter::FillOutputPortInformation(int vtkNotUsed(port),\n                                                      vtkInformation* info)\n{\n  // now add our info\n  info->Set(vtkDataObject::DATA_TYPE_NAME(), \"vtkTest\");\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmFilter::FillInputPortInformation(int vtkNotUsed(port),\n                                                     vtkInformation* info)\n{\n  info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), \"vtkTest\");\n  return 1;\n}\n\nint vtkTestAlgorithmFilter::RequestDataObject(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* outputVector)\n{\n  // RequestDataObject (RDO) is an earlier pipeline pass.\n  // During RDO, each filter is supposed to produce an empty data object of the\n  // proper type\n\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n  vtkTest* output =\n      dynamic_cast<vtkTest*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  if (!output)\n  {\n    output = vtkTest::New();\n    outInfo->Set(vtkDataObject::DATA_OBJECT(), output);\n    output->FastDelete();\n\n    this->GetOutputPortInformation(0)->Set(vtkDataObject::DATA_EXTENT_TYPE(),\n                                           output->GetExtentType());\n  }\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmFilter::RequestInformation(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* vtkNotUsed(outputVector))\n{\n  // do nothing let subclasses handle it\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmFilter::RequestUpdateExtent(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* vtkNotUsed(outputVector))\n{\n  int numInputPorts = this->GetNumberOfInputPorts();\n  for (int i = 0; i < numInputPorts; i++)\n  {\n    int numInputConnections = this->GetNumberOfInputConnections(i);\n    for (int j = 0; j < numInputConnections; j++)\n    {\n      vtkInformation* inputInfo = inputVector[i]->GetInformationObject(j);\n      inputInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1);\n    }\n  }\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n// This is the superclasses style of Execute method.  Convert it into\n// an imaging style Execute method.\nint vtkTestAlgorithmFilter::RequestData(vtkInformation* vtkNotUsed(request),\n                                        vtkInformationVector** inputVector,\n                                        vtkInformationVector* outputVector)\n{\n  // Later on RequestData (RD) happens.\n  // During RD each filter examines any inputs it has, then fills in that empty\n  // data object with real data.\n\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n  vtkTest* output =\n      dynamic_cast<vtkTest*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkTest* input =\n      dynamic_cast<vtkTest*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n  output->ShallowCopy(input);\n  output->SetValue(output->GetValue() + 1.0);\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::SetInput(vtkDataObject* input)\n{\n  this->SetInput(0, input);\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::SetInput(int index, vtkDataObject* input)\n{\n  if (input)\n  {\n    this->SetInputDataObject(index, input);\n  }\n  else\n  {\n    // Setting a NULL input removes the connection.\n    this->SetInputDataObject(index, 0);\n  }\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::AddInput(vtkDataObject* input)\n{\n  this->AddInput(0, input);\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmFilter::AddInput(int index, vtkDataObject* input)\n{\n  if (input)\n  {\n    this->AddInputDataObject(index, input);\n  }\n}\n

        vtkTest.cxx

        #include \"vtkTest.h\"\n\n#include <vtkObjectFactory.h>\n\nvtkStandardNewMacro(vtkTest);\n\nvtkTest::vtkTest()\n{\n  this->Value = 0.0;\n}\n\nvtkTest::~vtkTest()\n{\n}\n\nvoid vtkTest::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n\nvoid vtkTest::ShallowCopy(vtkDataObject* t)\n{\n  vtkTest* m = dynamic_cast<vtkTest*>(t);\n  this->Value = m->GetValue();\n}\n

        vtkTest.h

        #ifndef __vtkTest_h\n#define __vtkTest_h\n\n#include <vtkDataObject.h>\n\nclass vtkTest : public vtkDataObject\n{\npublic:\n  static vtkTest* New();\n  vtkTypeMacro(vtkTest, vtkDataObject);\n  void PrintSelf(ostream& os, vtkIndent indent) override;\n  void ShallowCopy(vtkDataObject* t) override;\n\n  vtkGetMacro(Value, double);\n  vtkSetMacro(Value, double);\n\nprotected:\n  vtkTest();\n  ~vtkTest();\n\nprivate:\n  vtkTest(const vtkTest&);        // Not implemented.\n  void operator=(const vtkTest&); // Not implemented.\n\n  double Value;\n};\n\n#endif\n

        vtkTestAlgorithmFilter.h

        #ifndef __vtkTestAlgorithmFilter_h\n#define __vtkTestAlgorithmFilter_h\n\n#include <vtkAlgorithm.h>\n\nclass vtkDataSet;\nclass vtkTest;\n\nclass vtkTestAlgorithmFilter : public vtkAlgorithm\n{\npublic:\n  static vtkTestAlgorithmFilter* New();\n  vtkTypeMacro(vtkTestAlgorithmFilter, vtkAlgorithm);\n  void PrintSelf(ostream& os, vtkIndent indent) override;\n\n  // Description:\n  // Get the output data object for a port on this algorithm.\n  vtkTest* GetOutput();\n  vtkTest* GetOutput(int);\n  virtual void SetOutput(vtkDataObject* d);\n\n  // Description:\n  // see vtkAlgorithm for details\n  virtual int ProcessRequest(vtkInformation*, vtkInformationVector**,\n                             vtkInformationVector*) override;\n\n  // this method is not recommended for use, but lots of old style filters use\n  // it\n  vtkDataObject* GetInput();\n  vtkDataObject* GetInput(int port);\n  vtkTest* GetLabelHierarchyInput(int port);\n\n  // Description:\n  // Set an input of this algorithm. You should not override these\n  // methods because they are not the only way to connect a pipeline.\n  // Note that these methods support old-style pipeline connections.\n  // When writing new code you should use the more general\n  // vtkAlgorithm::SetInputConnection().  These methods transform the\n  // input index to the input port index, not an index of a connection\n  // within a single port.\n  void SetInput(vtkDataObject*);\n  void SetInput(int, vtkDataObject*);\n\n  // Description:\n  // Add an input of this algorithm.  Note that these methods support\n  // old-style pipeline connections.  When writing new code you should\n  // use the more general vtkAlgorithm::AddInputConnection().  See\n  // SetInput() for details.\n  void AddInput(vtkDataObject*);\n  void AddInput(int, vtkDataObject*);\n\nprotected:\n  vtkTestAlgorithmFilter();\n  ~vtkTestAlgorithmFilter();\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestDataObject(vtkInformation* request,\n                                vtkInformationVector** inputVector,\n                                vtkInformationVector* outputVector);\n\n  // convenience method\n  virtual int RequestInformation(vtkInformation* request,\n                                 vtkInformationVector** inputVector,\n                                 vtkInformationVector* outputVector);\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestData(vtkInformation* request,\n                          vtkInformationVector** inputVector,\n                          vtkInformationVector* outputVector);\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestUpdateExtent(vtkInformation*, vtkInformationVector**,\n                                  vtkInformationVector*);\n\n  virtual int FillOutputPortInformation(int port,\n                                        vtkInformation* info) override;\n  virtual int FillInputPortInformation(int port, vtkInformation* info) override;\n\nprivate:\n  vtkTestAlgorithmFilter(const vtkTestAlgorithmFilter&); // Not implemented.\n  void operator=(const vtkTestAlgorithmFilter&);         // Not implemented.\n};\n\n#endif\n
        "},{"location":"Cxx/Developers/AlgorithmFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AlgorithmFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AlgorithmFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AlgorithmFilter MACOSX_BUNDLE AlgorithmFilter.cxx )\n  target_link_libraries(AlgorithmFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AlgorithmFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/AlgorithmFilter/#download-and-build-algorithmfilter","title":"Download and Build AlgorithmFilter","text":"

        Click here to download AlgorithmFilter and its CMakeLists.txt file. Once the tarball AlgorithmFilter.tar has been downloaded and extracted,

        cd AlgorithmFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AlgorithmFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/AlgorithmSource/","title":"AlgorithmSource","text":"

        vtk-examples/Cxx/Developers/AlgorithmSource

        "},{"location":"Cxx/Developers/AlgorithmSource/#description","title":"Description","text":"

        This example demonstrates how to create a source that returns a custom class. To test that it is working, the class vtkTest1 simply stores a double named 'Value' that is instantiated to the value of 4.5. Example.cxx instantiates a vtkTestSource which produces a vtkTest1.

        You will need the following in your CMakeLists.txt file:

        find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/AlgorithmSource/#code","title":"Code","text":"

        AlgorithmSource.cxx

        #include \"vtkTest1.h\"\n#include \"vtkTestAlgorithmSource.h\"\n\nint main(int, char*[])\n{\n  vtkTestAlgorithmSource* source = vtkTestAlgorithmSource::New();\n  source->Update();\n\n  vtkTest1* test = source->GetOutput();\n  std::cout << test->GetValue() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n

        vtkTest1.cxx

        #include \"vtkTest1.h\"\n\n#include <vtkObjectFactory.h>\n\nvtkStandardNewMacro(vtkTest1);\n\nvtkTest1::vtkTest1()\n{\n  this->Value = 4.5;\n}\n\nvtkTest1::~vtkTest1()\n{\n}\n\nvoid vtkTest1::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n

        vtkTestAlgorithmSource.cxx

        #include \"vtkTestAlgorithmSource.h\"\n#include \"vtkTest1.h\"\n\n#include <vtkCommand.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestAlgorithmSource);\n\n//----------------------------------------------------------------------------\nvtkTestAlgorithmSource::vtkTestAlgorithmSource()\n{\n  this->SetNumberOfInputPorts(0);\n  this->SetNumberOfOutputPorts(1);\n}\n\n//----------------------------------------------------------------------------\nvtkTestAlgorithmSource::~vtkTestAlgorithmSource()\n{\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmSource::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n\n//----------------------------------------------------------------------------\nvtkTest1* vtkTestAlgorithmSource::GetOutput()\n{\n  return this->GetOutput(0);\n}\n\n//----------------------------------------------------------------------------\nvtkTest1* vtkTestAlgorithmSource::GetOutput(int port)\n{\n  return dynamic_cast<vtkTest1*>(this->GetOutputDataObject(port));\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestAlgorithmSource::SetOutput(vtkDataObject* d)\n{\n  this->GetExecutive()->SetOutputData(0, d);\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmSource::ProcessRequest(vtkInformation* request,\n                                           vtkInformationVector** inputVector,\n                                           vtkInformationVector* outputVector)\n{\n  // Create an output object of the correct type.\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA_OBJECT()))\n  {\n    return this->RequestDataObject(request, inputVector, outputVector);\n  }\n  // generate the data\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))\n  {\n    return this->RequestData(request, inputVector, outputVector);\n  }\n\n  if (request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT()))\n  {\n    return this->RequestUpdateExtent(request, inputVector, outputVector);\n  }\n\n  // execute information\n  if (request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))\n  {\n    return this->RequestInformation(request, inputVector, outputVector);\n  }\n\n  return this->Superclass::ProcessRequest(request, inputVector, outputVector);\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmSource::FillOutputPortInformation(int vtkNotUsed(port),\n                                                      vtkInformation* info)\n{\n  // now add our info\n  info->Set(vtkDataObject::DATA_TYPE_NAME(), \"vtkTest1\");\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmSource::RequestDataObject(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* outputVector)\n{\n  for (int i = 0; i < this->GetNumberOfOutputPorts(); ++i)\n  {\n    vtkInformation* outInfo = outputVector->GetInformationObject(i);\n    vtkTest1* output =\n        dynamic_cast<vtkTest1*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n    if (!output)\n    {\n      output = vtkTest1::New();\n      outInfo->Set(vtkDataObject::DATA_OBJECT(), output);\n      output->FastDelete();\n      this->GetOutputPortInformation(i)->Set(vtkDataObject::DATA_EXTENT_TYPE(),\n                                             output->GetExtentType());\n    }\n  }\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmSource::RequestInformation(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* vtkNotUsed(outputVector))\n{\n  // do nothing let subclasses handle it\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nint vtkTestAlgorithmSource::RequestUpdateExtent(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* vtkNotUsed(outputVector))\n{\n  int numInputPorts = this->GetNumberOfInputPorts();\n  for (int i = 0; i < numInputPorts; i++)\n  {\n    int numInputConnections = this->GetNumberOfInputConnections(i);\n    for (int j = 0; j < numInputConnections; j++)\n    {\n      vtkInformation* inputInfo = inputVector[i]->GetInformationObject(j);\n      inputInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1);\n    }\n  }\n  return 1;\n}\n\n//----------------------------------------------------------------------------\n// This is the superclasses style of Execute method.  Convert it into\n// an imaging style Execute method.\nint vtkTestAlgorithmSource::RequestData(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* vtkNotUsed(outputVector))\n{\n  // do nothing let subclasses handle it\n  return 1;\n}\n

        vtkTestAlgorithmSource.h

        #ifndef __vtkTestAlgorithmSource_h\n#define __vtkTestAlgorithmSource_h\n\n#include <vtkAlgorithm.h>\n\nclass vtkDataSet;\nclass vtkTest1;\n\nclass vtkTestAlgorithmSource : public vtkAlgorithm\n{\npublic:\n  static vtkTestAlgorithmSource* New();\n  vtkTypeMacro(vtkTestAlgorithmSource, vtkAlgorithm);\n  void PrintSelf(ostream& os, vtkIndent indent) override;\n\n  // Description:\n  // Get the output data object for a port on this algorithm.\n  vtkTest1* GetOutput();\n  vtkTest1* GetOutput(int);\n  virtual void SetOutput(vtkDataObject* d);\n\n  // Description:\n  // see vtkAlgorithm for details\n  virtual int ProcessRequest(vtkInformation*, vtkInformationVector**,\n                             vtkInformationVector*) override;\n\nprotected:\n  vtkTestAlgorithmSource();\n  ~vtkTestAlgorithmSource();\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestDataObject(vtkInformation* request,\n                                vtkInformationVector** inputVector,\n                                vtkInformationVector* outputVector);\n\n  // convenience method\n  virtual int RequestInformation(vtkInformation* request,\n                                 vtkInformationVector** inputVector,\n                                 vtkInformationVector* outputVector);\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestData(vtkInformation* request,\n                          vtkInformationVector** inputVector,\n                          vtkInformationVector* outputVector);\n\n  // Description:\n  // This is called by the superclass.\n  // This is the method you should override.\n  virtual int RequestUpdateExtent(vtkInformation*, vtkInformationVector**,\n                                  vtkInformationVector*);\n\n  virtual int FillOutputPortInformation(int port,\n                                        vtkInformation* info) override;\n\nprivate:\n  vtkTestAlgorithmSource(const vtkTestAlgorithmSource&); // Not implemented.\n  void operator=(const vtkTestAlgorithmSource&);         // Not implemented.\n};\n\n#endif\n

        vtkTest1.h

        #ifndef __vtkTest1_h\n#define __vtkTest1_h\n\n#include <vtkDataObject.h>\n\nclass vtkTest1 : public vtkDataObject\n{\npublic:\n  static vtkTest1* New();\n  vtkTypeMacro(vtkTest1, vtkDataObject);\n  void PrintSelf(ostream& os, vtkIndent indent) override;\n\n  vtkGetMacro(Value, double);\n\nprotected:\n  vtkTest1();\n  ~vtkTest1();\n\nprivate:\n  vtkTest1(const vtkTest1&);       // Not implemented.\n  void operator=(const vtkTest1&); // Not implemented.\n\n  double Value;\n};\n\n#endif\n
        "},{"location":"Cxx/Developers/AlgorithmSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AlgorithmSource)\n\nfind_package(VTK COMPONENTS \n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AlgorithmSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AlgorithmSource MACOSX_BUNDLE AlgorithmSource.cxx )\n  target_link_libraries(AlgorithmSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AlgorithmSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/AlgorithmSource/#download-and-build-algorithmsource","title":"Download and Build AlgorithmSource","text":"

        Click here to download AlgorithmSource and its CMakeLists.txt file. Once the tarball AlgorithmSource.tar has been downloaded and extracted,

        cd AlgorithmSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AlgorithmSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/FilterProgress/","title":"FilterProgress","text":"

        vtk-examples/Cxx/Developers/FilterProgress

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/FilterProgress/#code","title":"Code","text":"

        FilterProgress.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkTestFilterProgressFilter.h>\n\nvoid ProgressFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\nint main(int, char*[])\n{\n  vtkSmartPointer<vtkSphereSource> sphereSource =\n      vtkSmartPointer<vtkSphereSource>::New();\n  sphereSource->Update();\n\n  vtkSmartPointer<vtkTestFilterProgressFilter> testFilter =\n      vtkSmartPointer<vtkTestFilterProgressFilter>::New();\n  testFilter->SetInputConnection(sphereSource->GetOutputPort());\n  testFilter->Update();\n\n  return EXIT_SUCCESS;\n}\n

        vtkTestFilterProgressFilter.cxx

        #include <vtkSmartPointer.h>\n\n#include <vtkCallbackCommand.h>\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\n#include \"vtkTestFilterProgressFilter.h\"\n\nvtkStandardNewMacro(vtkTestFilterProgressFilter);\n\nvtkTestFilterProgressFilter::vtkTestFilterProgressFilter()\n{\n  vtkSmartPointer<vtkCallbackCommand> progressCallback =\n      vtkSmartPointer<vtkCallbackCommand>::New();\n  progressCallback->SetCallback(this->ProgressFunction);\n\n  this->AddObserver(vtkCommand::ProgressEvent, progressCallback);\n}\n\nvoid vtkTestFilterProgressFilter::ProgressFunction(vtkObject* caller,\n                                                   long unsigned int eventId,\n                                                   void* clientData,\n                                                   void* callData)\n{\n  vtkTestFilterProgressFilterr* testFilter =\n      static_cast<vtkTestFilterProgressFilter*>(caller);\n  cout << \"Progress: \" << testFilter->GetProgress() << endl;\n}\n\nint vtkTestFilterProgressFilter::RequestData(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* outputVector)\n{\n\n  // get the info objects\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // get the input and ouptut\n  vtkPolyData* input =\n      dynamic_cast<vtkPolyData*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkPolyData* output =\n      dynamic_cast<vtkPolyData*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  for (vtkIdType i = 0; i < input->GetNumberOfPoints(); i++)\n  {\n    this->UpdateProgress(static_cast<double>(i) / input->GetNumberOfPoints());\n  }\n\n  output->ShallowCopy(input);\n\n  return 1;\n}\n

        vtkTestFilterProgressFilter.h

        #ifndef __vtkTestFilterProgressFilter_h\n#define __vtkTestFilterProgressFilter_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestFilterProgressFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  static vtkTestFilterProgressFilter* New();\n  vtkTypeMacro(vtkTestFilterProgressFilter, vtkAlgorithm);\n\nprotected:\n  vtkTestFilterProgressFilter();\n  ~vtkTestFilterProgressFilter() override;\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\n  static void ProgressFunction(vtkObject* caller, long unsigned int eventId,\n                               void* clientData, void* callData);\n\nprivate:\n  vtkTestFilterProgressFilter(const vtkTestFilterProgressFilter&) = delete;\n  void operator=(const vtkTestFilterProgressFilterr&) = delete;\n};\n\n#endif\n
        "},{"location":"Cxx/Developers/FilterProgress/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FilterProgress)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FilterProgress: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FilterProgress MACOSX_BUNDLE FilterProgress.cxx )\n  target_link_libraries(FilterProgress PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FilterProgress\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/FilterProgress/#download-and-build-filterprogress","title":"Download and Build FilterProgress","text":"

        Click here to download FilterProgress and its CMakeLists.txt file. Once the tarball FilterProgress.tar has been downloaded and extracted,

        cd FilterProgress/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FilterProgress\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/FilterSelfProgress/","title":"FilterSelfProgress","text":"

        vtk-examples/Cxx/Developers/FilterSelfProgress

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/FilterSelfProgress/#code","title":"Code","text":"

        FilterSelfProgress.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include \"vtkTestFilterSelfProgressFilter.h\"\n\nvoid ProgressFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\nint main(int /* argc */, char** /* argv */)\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTestFilterSelfProgressFilter> testFilter;\n  testFilter->SetInputConnection(sphereSource->GetOutputPort());\n  testFilter->Update();\n\n  return EXIT_SUCCESS;\n}\n

        vtkTestFilterSelfProgressFilter.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\n#include \"vtkTestFilterSelfProgressFilter.h\"\n\nvtkStandardNewMacro(vtkTestFilterSelfProgressFilter);\n\nvtkTestFilterSelfProgressFilter::vtkTestFilterSelfProgressFilter()\n{\n  vtkNew<vtkCallbackCommand> progressCallback;\n  progressCallback->SetCallback(this->ProgressFunction);\n\n  this->AddObserver(vtkCommand::ProgressEvent, progressCallback);\n}\n\nvoid vtkTestFilterSelfProgressFilter::ProgressFunction(\n    vtkObject* caller, long unsigned int /* eventId */, void* /* clientData */,\n    void* /* callData */)\n{\n  vtkTestFilterSelfProgressFilter* testFilter =\n      static_cast<vtkTestFilterSelfProgressFilter*>(caller);\n  cout << \"Progress: \" << testFilter->GetProgress() << endl;\n}\n\nint vtkTestFilterSelfProgressFilter::RequestData(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* outputVector)\n{\n\n  // get the info objects\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // get the input and ouptut\n  vtkPolyData* input =\n      dynamic_cast<vtkPolyData*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkPolyData* output =\n      dynamic_cast<vtkPolyData*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  for (vtkIdType i = 0; i < input->GetNumberOfPoints(); i++)\n  {\n    this->UpdateProgress(static_cast<double>(i) / input->GetNumberOfPoints());\n  }\n\n  output->ShallowCopy(input);\n\n  return 1;\n}\n

        vtkTestFilterSelfProgressFilter.h

        #ifndef __vtkTestFilterSelfProgressFilter_h\n#define __vtkTestFilterSelfProgressFilter_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestFilterSelfProgressFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkTestFilterSelfProgressFilter, vtkAlgorithm);\n\n  static vtkTestFilterSelfProgressFilter* New();\n\nprotected:\n  vtkTestFilterSelfProgressFilter();\n  ~vtkTestFilterSelfProgressFilter()\n  {\n  }\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\n  static void ProgressFunction(vtkObject* caller, long unsigned int eventId,\n                               void* clientData, void* callData);\n\nprivate:\n  vtkTestFilterSelfProgressFilter(const vtkTestFilterSelfProgressFilter&) =\n      delete;\n  void operator=(const vtkTestFilterSelfProgressFilter&) = delete;\n};\n\n#endif\n
        "},{"location":"Cxx/Developers/FilterSelfProgress/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FilterSelfProgress)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FilterSelfProgress: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FilterSelfProgress MACOSX_BUNDLE FilterSelfProgress.cxx )\n  target_link_libraries(FilterSelfProgress PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FilterSelfProgress\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/FilterSelfProgress/#download-and-build-filterselfprogress","title":"Download and Build FilterSelfProgress","text":"

        Click here to download FilterSelfProgress and its CMakeLists.txt file. Once the tarball FilterSelfProgress.tar has been downloaded and extracted,

        cd FilterSelfProgress/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FilterSelfProgress\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/GraphAlgorithmFilter/","title":"GraphAlgorithmFilter","text":"

        vtk-examples/Cxx/Developers/GraphAlgorithmFilter

        "},{"location":"Cxx/Developers/GraphAlgorithmFilter/#description","title":"Description","text":"

        This example demonstrates how to create a filter that takes a vtkGraph as input and produces a vtkGraph as output.

        You will need the following in your CMakeLists.txt file:

        find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/GraphAlgorithmFilter/#code","title":"Code","text":"

        GraphAlgorithmFilter.cxx

        #include <vtkGraph.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n\n#include \"vtkTestGraphAlgorithmFilter.h\"\n\nvoid TestDirected();\nvoid TestUndirected();\n\nint main(int, char*[])\n{\n  TestDirected();\n  TestUndirected();\n\n  return EXIT_SUCCESS;\n}\n\nvoid TestDirected()\n{\n\n  vtkNew<vtkMutableDirectedGraph> g;\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  std::cout << \"Input type: \" << g->GetClassName() << std::endl;\n\n  vtkNew<vtkTestGraphAlgorithmFilter> filter;\n  filter->SetInputData(g);\n  filter->Update();\n\n  std::cout << \"Output type: \" << filter->GetOutput()->GetClassName()\n            << std::endl;\n  std::cout << \"Output has \" << filter->GetOutput()->GetNumberOfVertices()\n            << \" vertices.\" << std::endl;\n  std::cout << std::endl;\n}\n\nvoid TestUndirected()\n{\n  std::cout << \"TestUndirected\" << std::endl;\n  vtkNew<vtkMutableUndirectedGraph> g;\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  std::cout << \"Input type: \" << g->GetClassName() << std::endl;\n\n  vtkNew<vtkTestGraphAlgorithmFilter> filter;\n  filter->SetInputData(g);\n  filter->Update();\n\n  std::cout << \"Output type: \" << filter->GetOutput()->GetClassName()\n            << std::endl;\n  std::cout << \"Output has \" << filter->GetOutput()->GetNumberOfVertices()\n            << \" vertices.\" << std::endl;\n}\n

        vtkTestGraphAlgorithmFilter.cxx

        #include \"vtkTestGraphAlgorithmFilter.h\"\n\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableGraphHelper.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestGraphAlgorithmFilter);\n\nint vtkTestGraphAlgorithmFilter::RequestData(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* outputVector)\n{\n\n  // get the info objects\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // get the input and ouptut\n  vtkGraph* input =\n      dynamic_cast<vtkGraph*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkGraph* output =\n      dynamic_cast<vtkGraph*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkNew<vtkMutableDirectedGraph> mdg;\n\n  vtkNew<vtkMutableUndirectedGraph> mug;\n\n  if (input->IsA(\"vtkMutableUndirectedGraph\"))\n  {\n    vtkNew<vtkMutableUndirectedGraph> ug;\n    ug->AddVertex();\n    output->ShallowCopy(ug);\n  }\n  else if (input->IsA(\"vtkMutableDirectedGraph\"))\n  {\n    vtkNew<vtkMutableDirectedGraph> dg;\n    dg->AddVertex();\n    output->ShallowCopy(dg);\n  }\n\n  std::cout << \"Output is type: \" << output->GetClassName() << std::endl;\n\n  return 1;\n}\n

        vtkTestGraphAlgorithmFilter.h

        #ifndef __vtkTestGraphAlgorithmFilter_h\n#define __vtkTestGraphAlgorithmFilter_h\n\n#include <vtkGraphAlgorithm.h>\n\nclass vtkTestGraphAlgorithmFilter : public vtkGraphAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkTestGraphAlgorithmFilter, vtkGraphAlgorithm);\n  static vtkTestGraphAlgorithmFilter* New();\n\nprotected:\n  vtkTestGraphAlgorithmFilter()\n  {\n  }\n  ~vtkTestGraphAlgorithmFilter()\n  {\n  }\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\nprivate:\n  vtkTestGraphAlgorithmFilter(\n      const vtkTestGraphAlgorithmFilter&);            // Not implemented.\n  void operator=(const vtkTestGraphAlgorithmFilter&); // Not implemented.\n};\n\n#endif\n
        "},{"location":"Cxx/Developers/GraphAlgorithmFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GraphAlgorithmFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GraphAlgorithmFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GraphAlgorithmFilter MACOSX_BUNDLE GraphAlgorithmFilter.cxx )\n  target_link_libraries(GraphAlgorithmFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GraphAlgorithmFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/GraphAlgorithmFilter/#download-and-build-graphalgorithmfilter","title":"Download and Build GraphAlgorithmFilter","text":"

        Click here to download GraphAlgorithmFilter and its CMakeLists.txt file. Once the tarball GraphAlgorithmFilter.tar has been downloaded and extracted,

        cd GraphAlgorithmFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GraphAlgorithmFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/GraphAlgorithmSource/","title":"GraphAlgorithmSource","text":"

        vtk-examples/Cxx/Developers/GraphAlgorithmSource

        "},{"location":"Cxx/Developers/GraphAlgorithmSource/#description","title":"Description","text":"

        This example produces a vtkGraph as output.

        You will need the following in your CMakeLists.txt file:

        find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/GraphAlgorithmSource/#code","title":"Code","text":"

        GraphAlgorithmSource.cxx

        #include <vtkGraph.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n\n#include \"vtkTestGraphAlgorithmSource.h\"\n\nint main(int, char*[])\n{\n  vtkNew<vtkTestGraphAlgorithmSource> source;\n  source->Update();\n\n  vtkGraph* outputGraph = source->GetOutput();\n\n  std::cout << \"Output number of vertices: \"\n            << outputGraph->GetNumberOfVertices() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n

        vtkTestGraphAlgorithmSource.cxx

        #include \"vtkTestGraphAlgorithmSource.h\"\n\n#include <vtkDataObject.h>\n#include <vtkGraph.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n#include <vtkUndirectedGraph.h>\n\nvtkStandardNewMacro(vtkTestGraphAlgorithmSource);\n\nvtkTestGraphAlgorithmSource::vtkTestGraphAlgorithmSource()\n{\n  this->SetNumberOfInputPorts(0);\n  this->SetNumberOfOutputPorts(1);\n}\n\nvtkTestGraphAlgorithmSource::~vtkTestGraphAlgorithmSource()\n{\n}\n\nint vtkTestGraphAlgorithmSource::RequestData(\n    vtkInformation* vtkNotUsed(request),\n    vtkInformationVector** vtkNotUsed(inputVector),\n    vtkInformationVector* outputVector)\n{\n\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  vtkGraph* output =\n      dynamic_cast<vtkGraph*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkNew<vtkMutableUndirectedGraph> NewGraph;\n\n  // add 3 vertices\n  NewGraph->AddVertex();\n  NewGraph->AddVertex();\n  NewGraph->AddVertex();\n\n  output->ShallowCopy(NewGraph);\n\n  return 1;\n}\n\nint vtkTestGraphAlgorithmSource::RequestDataObject(vtkInformation*,\n                                                   vtkInformationVector**,\n                                                   vtkInformationVector*)\n{\n\n  vtkNew<vtkUndirectedGraph> output;\n  this->GetExecutive()->SetOutputData(0, output);\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestGraphAlgorithmSource::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n

        vtkTestGraphAlgorithmSource.h

        #ifndef __vtkTestGraphAlgorithmSource_h\n#define __vtkTestGraphAlgorithmSource_h\n\n#include <vtkGraphAlgorithm.h>\n\nclass vtkTestGraphAlgorithmSource : public vtkGraphAlgorithm\n{\npublic:\n  static vtkTestGraphAlgorithmSource* New();\n  vtkTypeMacro(vtkTestGraphAlgorithmSource, vtkGraphAlgorithm);\n  void PrintSelf(ostream& os, vtkIndent indent) override;\n\nprotected:\n  vtkTestGraphAlgorithmSource();\n  ~vtkTestGraphAlgorithmSource();\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\n  int RequestDataObject(vtkInformation*, vtkInformationVector**,\n                        vtkInformationVector*) override;\n\nprivate:\n  vtkTestGraphAlgorithmSource(\n      const vtkTestGraphAlgorithmSource&);            // Not implemented.\n  void operator=(const vtkTestGraphAlgorithmSource&); // Not implemented.\n};\n\n#endif\n
        "},{"location":"Cxx/Developers/GraphAlgorithmSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GraphAlgorithmSource)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GraphAlgorithmSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GraphAlgorithmSource MACOSX_BUNDLE GraphAlgorithmSource.cxx )\n  target_link_libraries(GraphAlgorithmSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GraphAlgorithmSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/GraphAlgorithmSource/#download-and-build-graphalgorithmsource","title":"Download and Build GraphAlgorithmSource","text":"

        Click here to download GraphAlgorithmSource and its CMakeLists.txt file. Once the tarball GraphAlgorithmSource.tar has been downloaded and extracted,

        cd GraphAlgorithmSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GraphAlgorithmSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/ImageAlgorithmFilter/","title":"ImageAlgorithmFilter","text":"

        vtk-examples/Cxx/Developers/ImageAlgorithmFilter

        "},{"location":"Cxx/Developers/ImageAlgorithmFilter/#description","title":"Description","text":"

        This example demonstrates how to setup the pipeline for a {{class|vtkImageAlgorithm}} filter that takes a {{class|vtkImageData}} as input and produces another vtkImageData as output. This particular example creates a 2x2 image and fills it with \"2\"s. The filter changes the (0,0) element to a 5.

        You will need the following in your CMakeLists.txt file:

        find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/ImageAlgorithmFilter/#code","title":"Code","text":"

        ImageAlgorithmFilter.cxx

        #include <vtkImageData.h>\n#include <vtkNew.h>\n\n#include \"vtkImageAlgorithmFilter.h\"\n\nvoid PrintImage(vtkImageData* image);\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkImageData> input;\n  // Setup the image\n  input->SetDimensions(2, 2, 1);\n  input->AllocateScalars(VTK_DOUBLE, 1);\n\n  // Fill every entry of the image data with \"2.0\"\n  int* dims = input->GetDimensions();\n\n  for (int y = 0; y < dims[1]; y++)\n  {\n    for (int x = 0; x < dims[0]; x++)\n    {\n      input->SetScalarComponentFromDouble(x, y, 0, 0, 2.0);\n    }\n  }\n\n  std::cout << \"Input image: \" << std::endl;\n  PrintImage(input);\n\n  vtkNew<vtkImageAlgorithmFilter> filter;\n  filter->SetInputData(input);\n  filter->Update();\n\n  vtkImageData* output = filter->GetOutput();\n\n  std::cout << \"Output image: \" << std::endl;\n  PrintImage(output);\n\n  return 0;\n}\n\nvoid PrintImage(vtkImageData* image)\n{\n  int* dims = image->GetDimensions();\n\n  for (int y = 0; y < dims[1]; y++)\n  {\n    for (int x = 0; x < dims[0]; x++)\n    {\n      double v = image->GetScalarComponentAsDouble(x, y, 0, 0);\n      std::cout << v << \" \";\n    }\n    std::cout << std::endl;\n  }\n}\n

        vtkImageAlgorithmFilter.cxx

        #include \"vtkImageAlgorithmFilter.h\"\n\n#include <vtkDataObject.h>\n#include <vtkImageData.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkImageAlgorithmFilter);\n\nint vtkImageAlgorithmFilter::RequestData(vtkInformation* vtkNotUsed(request),\n                                         vtkInformationVector** inputVector,\n                                         vtkInformationVector* outputVector)\n{\n  // Get the info objects\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // Get the input and ouptut\n  vtkImageData* input =\n      dynamic_cast<vtkImageData*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkImageData* output =\n      dynamic_cast<vtkImageData*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkNew<vtkImageData> image;\n  image->ShallowCopy(input);\n\n  image->SetScalarComponentFromDouble(0, 0, 0, 0, 5.0);\n\n  output->ShallowCopy(image);\n\n  // Without these lines, the output will appear real but will not work as the\n  // input to any other filters\n  int extent[6];\n  input->GetExtent(extent);\n  output->SetExtent(extent);\n  outInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), extent, 6);\n  outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), extent, 6);\n  return 1;\n}\n

        vtkImageAlgorithmFilter.h

        #ifndef __vtkImageAlgorithmFilter_h\n#define __vtkImageAlgorithmFilter_h\n\n#include <vtkImageAlgorithm.h>\n\nclass vtkImageAlgorithmFilter : public vtkImageAlgorithm\n{\npublic:\n  static vtkImageAlgorithmFilter* New();\n  vtkTypeMacro(vtkImageAlgorithmFilter, vtkImageAlgorithm);\n\n  vtkImageAlgorithmFilter()\n  {\n  }\n\nprotected:\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\nprivate:\n  vtkImageAlgorithmFilter(const vtkImageAlgorithmFilter&); // Not implemented.\n  void operator=(const vtkImageAlgorithmFilter&);          // Not implemented.\n};\n\n#endif\n
        "},{"location":"Cxx/Developers/ImageAlgorithmFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageAlgorithmFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageAlgorithmFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageAlgorithmFilter MACOSX_BUNDLE ImageAlgorithmFilter.cxx )\n  target_link_libraries(ImageAlgorithmFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageAlgorithmFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/ImageAlgorithmFilter/#download-and-build-imagealgorithmfilter","title":"Download and Build ImageAlgorithmFilter","text":"

        Click here to download ImageAlgorithmFilter and its CMakeLists.txt file. Once the tarball ImageAlgorithmFilter.tar has been downloaded and extracted,

        cd ImageAlgorithmFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageAlgorithmFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/MultipleInputPorts/","title":"MultipleInputPorts","text":"

        vtk-examples/Cxx/Developers/MultipleInputPorts

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/MultipleInputPorts/#code","title":"Code","text":"

        MultipleInputPorts.cxx

        #include <vtkNew.h>\n#include <vtkSphereSource.h>\n\n#include \"vtkTestMultipleInputPortsFilter.h\"\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetThetaResolution(5);\n  sphereSource1->Update();\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetThetaResolution(10);\n  sphereSource2->Update();\n\n  vtkNew<vtkTestMultipleInputPortsFilter> filter;\n  filter->SetInputConnection(0, sphereSource1->GetOutputPort());\n  filter->SetInputConnection(1, sphereSource2->GetOutputPort());\n  filter->Update();\n\n  return EXIT_SUCCESS;\n}\n

        vtkTestMultipleInputPortsFilter.h

        // .NAME vtkTestMultipleInputPortsFilter\n// .SECTION Description\n// vtkTestMultipleInputPortsFilter\n\n#ifndef __vtkTestMultipleInputPortsFilter_h\n#define __vtkTestMultipleInputPortsFilter_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestMultipleInputPortsFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  static vtkTestMultipleInputPortsFilter* New();\n  vtkTypeMacro(vtkTestMultipleInputPortsFilter, vtkPolyDataAlgorithm);\n\nprotected:\n  vtkTestMultipleInputPortsFilter();\n  ~vtkTestMultipleInputPortsFilter()\n  {\n  }\n\n  int FillInputPortInformation(int port, vtkInformation* info) override;\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\nprivate:\n  vtkTestMultipleInputPortsFilter(const vtkTestMultipleInputPortsFilter&) =\n      delete;\n  void operator=(const vtkTestMultipleInputPortsFilter&) = delete;\n};\n\n#endif\n

        vtkTestMultipleInputPortsFilter.cxx

        #include \"vtkTestMultipleInputPortsFilter.h\"\n\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkSmartPointer.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestMultipleInputPortsFilter);\n\nvtkTestMultipleInputPortsFilter::vtkTestMultipleInputPortsFilter()\n{\n  this->SetNumberOfInputPorts(2);\n}\n\nint vtkTestMultipleInputPortsFilter::FillInputPortInformation(\n    int port, vtkInformation* info)\n{\n  if (port == 0)\n  {\n    info->Set(vtkDataObject::DATA_TYPE_NAME(), \"vtkPolyData\");\n    return 1;\n  }\n  else if (port == 1)\n  {\n    info->Set(vtkDataObject::DATA_TYPE_NAME(), \"vtkPolyData\");\n    return 1;\n  }\n\n  return 0;\n}\n\nint vtkTestMultipleInputPortsFilter::RequestData(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* outputVector)\n{\n\n  // get the info objects\n  vtkInformation* inInfo0 = inputVector[0]->GetInformationObject(0);\n  vtkInformation* inInfo1 = inputVector[1]->GetInformationObject(0);\n\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // get the input and ouptut\n  vtkPolyData* input0 =\n      dynamic_cast<vtkPolyData*>(inInfo0->Get(vtkDataObject::DATA_OBJECT()));\n\n  std::cout << \"input0 has \" << input0->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  vtkPolyData* input1 =\n      dynamic_cast<vtkPolyData*>(inInfo1->Get(vtkDataObject::DATA_OBJECT()));\n\n  std::cout << \"input1 has \" << input1->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  vtkPolyData* output =\n      dynamic_cast<vtkPolyData*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  output->ShallowCopy(input0);\n\n  return 1;\n}\n
        "},{"location":"Cxx/Developers/MultipleInputPorts/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultipleInputPorts)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultipleInputPorts: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultipleInputPorts MACOSX_BUNDLE MultipleInputPorts.cxx )\n  target_link_libraries(MultipleInputPorts PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultipleInputPorts\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/MultipleInputPorts/#download-and-build-multipleinputports","title":"Download and Build MultipleInputPorts","text":"

        Click here to download MultipleInputPorts and its CMakeLists.txt file. Once the tarball MultipleInputPorts.tar has been downloaded and extracted,

        cd MultipleInputPorts/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MultipleInputPorts\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/PolyDataAlgorithmReader/","title":"PolyDataAlgorithmReader","text":"

        vtk-examples/Cxx/Developers/PolyDataAlgorithmReader

        "},{"location":"Cxx/Developers/PolyDataAlgorithmReader/#description","title":"Description","text":"

        This example demonstrates a reader that takes nothing as input and produces a vtkPolyData as output.

        You will need the following in your CMakeLists.txt file:

        find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/PolyDataAlgorithmReader/#code","title":"Code","text":"

        PolyDataAlgorithmReader.cxx

        #include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkTestReader.h>\n\nint main(int, char*[])\n{\n  vtkSmartPointer<vtkTestReader> reader = vtkSmartPointer<vtkTestReader>::New();\n  reader->Update();\n\n  vtkPolyData* polydata = reader->GetOutput();\n  polydata->Print(std::cout);\n\n  return EXIT_SUCCESS;\n}\n

        vtkTestReader.cxx

        #include <vtkTestReader.h>\n\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestReader);\n\nvtkTestReader::vtkTestReader()\n{\n  this->FileName = NULL;\n  this->SetNumberOfInputPorts(0);\n  this->SetNumberOfOutputPorts(1);\n}\n\nvtkTestReader::~vtkTestReader()\n{\n}\n\n// This override is not needed as the FillOutputPortInformation on\n// vtkPolyDataAlgorithm does this.  Override this if you need something\n// different from one output that is a vtkPolyData\nint vtkTestReader::FillOutputPortInformation(int port, vtkInformation* info)\n{\n  if (port == 0)\n  {\n    info->Set(vtkDataObject::DATA_TYPE_NAME(), \"vtkPolyData\");\n\n    return 1;\n  }\n\n  return 0;\n}\n\nint vtkTestReader::RequestData(vtkInformation* vtkNotUsed(request),\n                               vtkInformationVector** vtkNotUsed(inputVector),\n                               vtkInformationVector* outputVector)\n{\n\n  // Get the output\n  vtkPolyData* output = vtkPolyData::GetData(outputVector, 0)\n\n      vtkNew<vtkPolyData>\n          polydata;\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  polydata->SetPoints(points.GetPointer());\n\n  // output = polydata.GetPointer(); //doesn't work\n  output->ShallowCopy(polydata.GetPointer());\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestReader::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n\n  os << indent << \"File Name: \" << (this->FileName ? this->FileName : \"(none)\")\n     << \"\\n\";\n}\n

        vtkTestReader.h

        #ifndef __vtkTestReader_h\n#define __vtkTestReader_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestReader : public vtkPolyDataAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkTestReader, vtkPolyDataAlgorithm);\n  void PrintSelf(ostream& os, vtkIndent indent);\n\n  static vtkTestReader* New();\n\nprotected:\n  vtkTestReader();\n  ~vtkTestReader();\n\n  int FillOutputPortInformation(int port, vtkInformation* info);\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*);\n\nprivate:\n  vtkTestReader(const vtkTestReader&);  // Not implemented.\n  void operator=(const vtkTestReader&); // Not implemented.\n\n  char* FileName;\n};\n\n#endif\n
        "},{"location":"Cxx/Developers/PolyDataAlgorithmReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataAlgorithmReader)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataAlgorithmReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataAlgorithmReader MACOSX_BUNDLE PolyDataAlgorithmReader.cxx )\n  target_link_libraries(PolyDataAlgorithmReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataAlgorithmReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/PolyDataAlgorithmReader/#download-and-build-polydataalgorithmreader","title":"Download and Build PolyDataAlgorithmReader","text":"

        Click here to download PolyDataAlgorithmReader and its CMakeLists.txt file. Once the tarball PolyDataAlgorithmReader.tar has been downloaded and extracted,

        cd PolyDataAlgorithmReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataAlgorithmReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/PolyDataFilter/","title":"PolyDataFilter","text":"

        vtk-examples/Cxx/Developers/PolyDataFilter

        "},{"location":"Cxx/Developers/PolyDataFilter/#description","title":"Description","text":"

        This example demonstrates a filter named vtkTestPolyDataFilter that takes a vtkPolyData as input and produces a vtkPolyData as output.

        You will need the following in your CMakeLists.txt file:

        find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/PolyDataFilter/#code","title":"Code","text":"

        PolyDataFilter.cxx

        #include <vtkSmartPointer.h>\n\n#include <vtkTestPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n\n  vtkSmartPointer<vtkPolyData> inputPolydata =\n      vtkSmartPointer<vtkPolyData>::New();\n  inputPolydata->SetPoints(points);\n\n  std::cout << \"Input points: \" << inputPolydata->GetNumberOfPoints()\n            << std::endl;\n\n  vtkSmartPointer<vtkTestPolyDataFilter> filter =\n      vtkSmartPointer<vtkTestPolyDataFilter>::New();\n  filter->SetInputData(inputPolydata);\n  filter->Update();\n\n  vtkPolyData* outputPolydata = filter->GetOutput();\n\n  std::cout << \"Output points: \" << outputPolydata->GetNumberOfPoints()\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n

        vtkTestPolyDataFilter.h

        #ifndef __vtkTestPolyDataFilter_h\n#define __vtkTestPolyDataFilter_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestPolyDataFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkTestPolyDataFilter, vtkPolyDataAlgorithm);\n  void PrintSelf(ostream& os, vtkIndent indent);\n\n  static vtkTestPolyDataFilter* New();\n\nprotected:\n  vtkTestPolyDataFilter();\n  ~vtkTestPolyDataFilter();\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*);\n\nprivate:\n  vtkTestPolyDataFilter(const vtkTestPolyDataFilter&); // Not implemented.\n  void operator=(const vtkTestPolyDataFilter&);        // Not implemented.\n};\n\n#endif\n

        vtkTestPolyDataFilter.cxx

        #include <vtkTestPolyDataFilter.h>\n\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkSmartPointer.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestPolyDataFilter);\n\nvtkTestPolyDataFilter::vtkTestPolyDataFilter()\n{\n  this->SetNumberOfInputPorts(1);\n  this->SetNumberOfOutputPorts(1);\n}\n\nvtkTestPolyDataFilter::~vtkTestPolyDataFilter()\n{\n}\n\nint vtkTestPolyDataFilter::RequestData(vtkInformation* vtkNotUsed(request),\n                                       vtkInformationVector** inputVector,\n                                       vtkInformationVector* outputVector)\n{\n\n  // get the input and output\n  vtkPolyData* input = vtkPolyData::GetData(inputVector[0], 0);\n  vtkPolyData* output = vtkPolyData::GetData(outputVector, 0);\n\n  input->GetPoints()->InsertNextPoint(1.0, 1.0, 1.0);\n\n  output->ShallowCopy(input);\n\n  return 1;\n}\n\n//----------------------------------------------------------------------------\nvoid vtkTestPolyDataFilter::PrintSelf(ostream& os, vtkIndent indent)\n{\n  this->Superclass::PrintSelf(os, indent);\n}\n
        "},{"location":"Cxx/Developers/PolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataFilter MACOSX_BUNDLE PolyDataFilter.cxx )\n  target_link_libraries(PolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/PolyDataFilter/#download-and-build-polydatafilter","title":"Download and Build PolyDataFilter","text":"

        Click here to download PolyDataFilter and its CMakeLists.txt file. Once the tarball PolyDataFilter.tar has been downloaded and extracted,

        cd PolyDataFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/ProgressReport/","title":"ProgressReport","text":"

        vtk-examples/Cxx/Developers/ProgressReport

        "},{"location":"Cxx/Developers/ProgressReport/#description","title":"Description","text":"

        This example demonstrates how to get the progress of a filter. This requires that the filter is updating its progress in a sensible way. A sample filter is provided which loops through the input points and updates its progress along the way.

        You will need the following in your CMakeLists.txt file:

        find_package(VTK\n COMPONENTS\n    CommonCore\n    CommonDataModel\n    CommonExecutionModel\n    FiltersSources\n    InfovisCore\n)\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/ProgressReport/#code","title":"Code","text":"

        ProgressReport.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include \"vtkTestProgressReportFilter.h\"\n\nvoid ProgressFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkCallbackCommand> progressCallback;\n  progressCallback->SetCallback(ProgressFunction);\n\n  vtkNew<vtkTestProgressReportFilter> testFilter;\n  testFilter->SetInputConnection(sphereSource->GetOutputPort());\n  testFilter->AddObserver(vtkCommand::ProgressEvent, progressCallback);\n  testFilter->Update();\n\n  return EXIT_SUCCESS;\n}\n\nvoid ProgressFunction(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                      void* vtkNotUsed(clientData), void* vtkNotUsed(callData))\n{\n  vtkTestProgressReportFilter* testFilter =\n      static_cast<vtkTestProgressReportFilter*>(caller);\n  std::cout << \"Progress: \" << testFilter->GetProgress() << std::endl;\n}\n

        vtkTestProgressReportFilter.h

        #ifndef __vtkTestProgressReportFilter_h\n#define __vtkTestProgressReportFilter_h\n\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestProgressReportFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  static vtkTestProgressReportFilter* New();\n  vtkTypeMacro(vtkTestProgressReportFilter, vtkAlgorithm);\n\nprotected:\n  vtkTestProgressReportFilter()\n  {\n  }\n  ~vtkTestProgressReportFilter()\n  {\n  }\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\nprivate:\n  vtkTestProgressReportFilter(const vtkTestProgressReportFilter&) = delete;\n  void operator=(const vtkTestProgressReportFilter&) = delete;\n};\n\n#endif\n

        vtkTestProgressReportFilter.cxx

        #include \"vtkTestProgressReportFilter.h\"\n\n#include <vtkDataObject.h>\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkObjectFactory.h>\n#include <vtkSmartPointer.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\nvtkStandardNewMacro(vtkTestProgressReportFilter);\n\nint vtkTestProgressReportFilter::RequestData(\n    vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,\n    vtkInformationVector* outputVector)\n{\n\n  // Get the info objects\n  vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);\n  vtkInformation* outInfo = outputVector->GetInformationObject(0);\n\n  // Get the input and ouptut\n  vtkPolyData* input =\n      dynamic_cast<vtkPolyData*>(inInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  vtkPolyData* output =\n      dynamic_cast<vtkPolyData*>(outInfo->Get(vtkDataObject::DATA_OBJECT()));\n\n  for (vtkIdType i = 0; i < input->GetNumberOfPoints(); i++)\n  {\n    this->UpdateProgress(static_cast<double>(i) / input->GetNumberOfPoints());\n  }\n\n  output->ShallowCopy(input);\n\n  return 1;\n}\n
        "},{"location":"Cxx/Developers/ProgressReport/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProgressReport)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProgressReport: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProgressReport MACOSX_BUNDLE ProgressReport.cxx )\n  target_link_libraries(ProgressReport PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProgressReport\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/ProgressReport/#download-and-build-progressreport","title":"Download and Build ProgressReport","text":"

        Click here to download ProgressReport and its CMakeLists.txt file. Once the tarball ProgressReport.tar has been downloaded and extracted,

        cd ProgressReport/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ProgressReport\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Developers/Warnings/","title":"Warnings","text":"

        vtk-examples/Cxx/Developers/Warnings

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Developers/Warnings/#code","title":"Code","text":"

        Warnings.cxx

        #include <vtkDataObject.h>\n#include <vtkObjectFactory.h>\n#include <vtkSmartPointer.h>\n\nclass TestClass : public vtkDataObject\n{\npublic:\n  static TestClass* New();\n  vtkTypeRevisionMacro(TestClass, vtkDataObject);\n  TestClass()\n  {\n    vtkWarningMacro(\"Test warning.\");\n  }\n};\n\nvtkStandardNewMacro(TestClass);\n\nint main(int, char*[])\n{\n\n  vtkSmartPointer<TestClass> test = vtkSmartPointer<TestClass>::New();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Developers/Warnings/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Warnings)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Warnings: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Warnings MACOSX_BUNDLE Warnings.cxx )\n  target_link_libraries(Warnings PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Warnings\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Developers/Warnings/#download-and-build-warnings","title":"Download and Build Warnings","text":"

        Click here to download Warnings and its CMakeLists.txt file. Once the tarball Warnings.tar has been downloaded and extracted,

        cd Warnings/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Warnings\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ExplicitStructuredGrid/CreateESGrid/","title":"CreateESGrid","text":"

        vtk-examples/Cxx/ExplicitStructuredGrid/CreateESGrid

        "},{"location":"Cxx/ExplicitStructuredGrid/CreateESGrid/#description","title":"Description","text":"

        This example demonstrates how (1) to create an explicit structured grid and (2) to convert an explicit structured grid into an unstructured grid or vice versa.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ExplicitStructuredGrid/CreateESGrid/#code","title":"Code","text":"

        CreateESGrid.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExplicitStructuredGrid.h>\n#include <vtkExplicitStructuredGridToUnstructuredGrid.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridToExplicitStructuredGrid.h>\n\n#include <array>\n#include <vector>\n\nnamespace {\n\nvtkNew<vtkExplicitStructuredGrid>\nCreateExplicitStructuredGrid(std::array<int, 3> const& dimensions,\n                             std::array<int, 3> const& spacing);\n\nvtkNew<vtkUnstructuredGrid>\nConvertToUnstructuredGrid(vtkExplicitStructuredGrid* grid);\n\nvtkNew<vtkExplicitStructuredGrid>\nConvertToExplicitStructuredGrid(vtkUnstructuredGrid* grid);\n} // namespace\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<int, 3> dimensions{0, 0, 0};\n  std::array<int, 3> spacing{1, 1, 1};\n  dimensions = {5, 6, 7};\n  spacing = {20, 10, 1};\n  auto grid = CreateExplicitStructuredGrid(dimensions, spacing);\n  auto ug = ConvertToUnstructuredGrid(grid);\n  auto esg = ConvertToExplicitStructuredGrid(ug);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(grid);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->LightingOff();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Seashell\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetWindowName(\"CreateESGrid\");\n  window->SetSize(1024, 768);\n  window->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(8.383354, -72.468670, 94.262605);\n  camera->SetFocalPoint(42.295234, 21.111537, -0.863606);\n  camera->SetViewUp(0.152863, 0.676710, 0.720206);\n  camera->SetDistance(137.681759);\n  camera->SetClippingRange(78.173985, 211.583658);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n  vtkNew<vtkInteractorStyleRubberBandPick> style;\n  interactor->SetInteractorStyle(style);\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkNew<vtkExplicitStructuredGrid>\nCreateExplicitStructuredGrid(std::array<int, 3> const& dimensions,\n                             std::array<int, 3> const& spacing)\n{\n  auto ni = dimensions[0];\n  auto nj = dimensions[1];\n  auto nk = dimensions[2];\n  auto si = spacing[0];\n  auto sj = spacing[1];\n  auto sk = spacing[2];\n  vtkNew<vtkPoints> points;\n  for (auto z = 0; z < nk * sk; z += sk)\n  {\n    for (auto y = 0; y < nj * sj; y += sj)\n    {\n      for (auto x = 0; x < ni * si; x += si)\n      {\n        points->InsertNextPoint(x, y, z);\n      }\n    }\n  }\n  // std::vector < std::vector<int> > cells;\n  vtkNew<vtkCellArray> cells;\n  for (vtkIdType k = 0; k < nk - 1; ++k)\n  {\n    for (vtkIdType j = 0; j < nj - 1; ++j)\n    {\n      for (vtkIdType i = 0; i < ni - 1; ++i)\n      {\n        // std::cout << \"(\" << i << \", \" << j << \", \" << k << \")\" << std::endl;\n        std::vector<std::array<vtkIdType, 8>> multiIndex;\n        multiIndex.push_back({i, i + 1, i + 1, i, i, i + 1, i + 1, i});\n        multiIndex.push_back({j, j, j + 1, j + 1, j, j, j + 1, j + 1});\n        multiIndex.push_back({k, k, k, k, k + 1, k + 1, k + 1, k + 1});\n        // Now let's emulate:\n        // pts = np.ravel_multi_index(multi_index, dimensions, order='F')\n        cells->InsertNextCell(8);\n        std::vector<vtkIdType> cell;\n        for (auto idx = 0; idx < 8; ++idx)\n        {\n          vtkIdType ii = multiIndex[0][idx];\n          vtkIdType jj = multiIndex[1][idx];\n          vtkIdType kk = multiIndex[2][idx];\n          cells->InsertCellPoint(ii + jj * ni + kk * nj * ni);\n        }\n      }\n    }\n  }\n\n  vtkNew<vtkExplicitStructuredGrid> grid;\n  grid->SetDimensions(ni, nj, nk);\n  grid->SetPoints(points);\n  grid->SetCells(cells);\n\n  return grid;\n}\n\nvtkNew<vtkUnstructuredGrid>\nConvertToUnstructuredGrid(vtkExplicitStructuredGrid* grid)\n{\n  vtkNew<vtkExplicitStructuredGridToUnstructuredGrid> converter;\n  converter->SetInputData(grid);\n  converter->Update();\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->DeepCopy(converter->GetOutput());\n  return ug;\n}\n\nvtkNew<vtkExplicitStructuredGrid>\nConvertToExplicitStructuredGrid(vtkUnstructuredGrid* grid)\n{\n  vtkNew<vtkUnstructuredGridToExplicitStructuredGrid> converter;\n  converter->SetInputData(grid);\n  // An explicit structured grid.\n  // The \"BLOCK_I\", \"BLOCK_J\" and\"BLOCK_K\" cell arrays are required.\n  converter->SetInputArrayToProcess(0, 0, 0, 1, \"BLOCK_I\");\n  converter->SetInputArrayToProcess(1, 0, 0, 1, \"BLOCK_J\");\n  converter->SetInputArrayToProcess(2, 0, 0, 1, \"BLOCK_K\");\n  converter->Update();\n  vtkNew<vtkExplicitStructuredGrid> esg;\n  esg->DeepCopy(converter->GetOutput());\n  return esg;\n}\n\n} // namespace\n
        "},{"location":"Cxx/ExplicitStructuredGrid/CreateESGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CreateESGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CreateESGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CreateESGrid MACOSX_BUNDLE CreateESGrid.cxx )\n  target_link_libraries(CreateESGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CreateESGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ExplicitStructuredGrid/CreateESGrid/#download-and-build-createesgrid","title":"Download and Build CreateESGrid","text":"

        Click here to download CreateESGrid and its CMakeLists.txt file. Once the tarball CreateESGrid.tar has been downloaded and extracted,

        cd CreateESGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CreateESGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ExplicitStructuredGrid/LoadESGrid/","title":"LoadESGrid","text":"

        vtk-examples/Cxx/ExplicitStructuredGrid/LoadESGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ExplicitStructuredGrid/LoadESGrid/#description","title":"Description","text":"

        This example displays the UNISIM-II-D reservoir model using the vtkExplicitStructuredGrid class.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ExplicitStructuredGrid/LoadESGrid/#code","title":"Code","text":"

        LoadESGrid.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExplicitStructuredGrid.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGridToExplicitStructuredGrid.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" filename.vtu e.g. The explicit structured grid file name: \"\n                 \"UNISIM-II-D.vtu.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLUnstructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkUnstructuredGridToExplicitStructuredGrid> converter;\n  converter->GlobalWarningDisplayOff(); // hide VTK errors\n  converter->SetInputConnection(reader->GetOutputPort());\n  converter->SetInputArrayToProcess(0, 0, 0, 1, \"BLOCK_I\");\n  converter->SetInputArrayToProcess(1, 0, 0, 1, \"BLOCK_J\");\n  converter->SetInputArrayToProcess(2, 0, 0, 1, \"BLOCK_K\");\n  converter->Update();\n\n  auto grid = converter->GetOutput();\n  grid->ComputeFacesConnectivityFlagsArray();\n  grid->GetCellData()->SetActiveScalars(\"ConnectivityFlags\");\n\n  auto scalars = grid->GetCellData()->GetArray(\"ConnectivityFlags\");\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(grid);\n  mapper->SetColorModeToMapScalars();\n  mapper->SetScalarRange(scalars->GetRange());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetWindowName(\"LoadESGrid\");\n  window->SetSize(1024, 768);\n  window->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(312452.407650, 7474760.406373, 3507.364723);\n  camera->SetFocalPoint(314388.388434, 7481520.509575, -2287.477388);\n  camera->SetViewUp(0.089920, 0.633216, 0.768734);\n  camera->SetDistance(9111.926908);\n  camera->SetClippingRange(595.217338, 19595.429475);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n  vtkNew<vtkInteractorStyleRubberBandPick> style;\n\n  interactor->SetInteractorStyle(style);\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ExplicitStructuredGrid/LoadESGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LoadESGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LoadESGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LoadESGrid MACOSX_BUNDLE LoadESGrid.cxx )\n  target_link_libraries(LoadESGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LoadESGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ExplicitStructuredGrid/LoadESGrid/#download-and-build-loadesgrid","title":"Download and Build LoadESGrid","text":"

        Click here to download LoadESGrid and its CMakeLists.txt file. Once the tarball LoadESGrid.tar has been downloaded and extracted,

        cd LoadESGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LoadESGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/AppendFilter/","title":"AppendFilter","text":"

        vtk-examples/Cxx/Filtering/AppendFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/AppendFilter/#description","title":"Description","text":"

        This example loads points into a polydata and an unstructured grid then combines them.

        The example should be extended to show cells being combined as well.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/AppendFilter/#code","title":"Code","text":"

        AppendFilter.cxx

        #include <vtkActor.h>\n#include <vtkAppendFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\nnamespace {\n\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\n\nint main(int, char*[])\n{\n  // Create 5 points (vtkPolyData)\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(5);\n  pointSource->Update();\n\n  auto polydata = pointSource->GetOutput();\n\n  std::cout << \"There are \" << polydata->GetNumberOfPoints()\n            << \" points in the polydata.\" << std::endl;\n\n  // Create 2 points in a vtkUnstructuredGrid\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0, 0, 1);\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n\n  std::cout << \"There are \" << ug->GetNumberOfPoints()\n            << \" points in the unstructured grid.\" << std::endl;\n\n  // Combine the two data sets\n  vtkNew<vtkAppendFilter> appendFilter;\n  appendFilter->AddInputData(polydata);\n  appendFilter->AddInputData(ug);\n  appendFilter->Update();\n\n  auto combined = appendFilter->GetOutput();\n  std::cout << \"There are \" << combined->GetNumberOfPoints()\n            << \" points combined.\" << std::endl;\n\n  // Create a mapper and actor\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(appendFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Map the points to spheres\n  auto sphereActor = PointToGlyph(appendFilter->GetOutput()->GetPoints(), 0.05);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"AppendFilter\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Filtering/AppendFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AppendFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AppendFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AppendFilter MACOSX_BUNDLE AppendFilter.cxx )\n  target_link_libraries(AppendFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AppendFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/AppendFilter/#download-and-build-appendfilter","title":"Download and Build AppendFilter","text":"

        Click here to download AppendFilter and its CMakeLists.txt file. Once the tarball AppendFilter.tar has been downloaded and extracted,

        cd AppendFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AppendFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/CombinePolyData/","title":"CombinePolyData","text":"

        vtk-examples/Cxx/Filtering/CombinePolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/CombinePolyData/#description","title":"Description","text":"

        This example reads two .vtp files (or produces them if not specified as command line arguments), combines them, and displays the result to the screen.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/CombinePolyData/#code","title":"Code","text":"

        CombinePolyData.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyData> input1;\n  vtkNew<vtkPolyData> input2;\n\n  if (argc == 1) // command line arguments not specified\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetCenter(5, 0, 0);\n    sphereSource->Update();\n\n    input1->ShallowCopy(sphereSource->GetOutput());\n\n    vtkNew<vtkConeSource> coneSource;\n    coneSource->Update();\n\n    input2->ShallowCopy(coneSource->GetOutput());\n  }\n  else\n  {\n    if (argc != 3)\n    {\n      std::cout << \"argc = \" << argc << std::endl;\n      std::cout << \"Required arguments: File1 File2\" << std::endl;\n      return EXIT_FAILURE;\n    }\n    std::string inputFilename1 = argv[1];\n    std::string inputFilename2 = argv[2];\n    vtkNew<vtkXMLPolyDataReader> reader1;\n    reader1->SetFileName(inputFilename1.c_str());\n    reader1->Update();\n    input1->ShallowCopy(reader1->GetOutput());\n\n    vtkNew<vtkXMLPolyDataReader> reader2;\n    reader2->SetFileName(inputFilename2.c_str());\n    reader2->Update();\n    input2->ShallowCopy(reader2->GetOutput());\n  }\n\n  // Append the two meshes\n  vtkNew<vtkAppendPolyData> appendFilter;\n  appendFilter->AddInputData(input1);\n  appendFilter->AddInputData(input2);\n\n  // Remove any duplicate points.\n  vtkNew<vtkCleanPolyData> cleanFilter;\n  cleanFilter->SetInputConnection(appendFilter->GetOutputPort());\n  cleanFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cleanFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n\n  // Render and interact\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  renderer->SetBackground(colors->GetColor3d(\"deep_ochre\").GetData());\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderWindow->SetWindowName(\"CombinePolyData\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/CombinePolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CombinePolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CombinePolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CombinePolyData MACOSX_BUNDLE CombinePolyData.cxx )\n  target_link_libraries(CombinePolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CombinePolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/CombinePolyData/#download-and-build-combinepolydata","title":"Download and Build CombinePolyData","text":"

        Click here to download CombinePolyData and its CMakeLists.txt file. Once the tarball CombinePolyData.tar has been downloaded and extracted,

        cd CombinePolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CombinePolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/ConnectivityFilter/","title":"ConnectivityFilter","text":"

        vtk-examples/Cxx/Filtering/ConnectivityFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/ConnectivityFilter/#code","title":"Code","text":"

        ConnectivityFilter.cxx

        #include <vtkActor.h>\n#include <vtkAppendFilter.h>\n#include <vtkCamera.h>\n#include <vtkConnectivityFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDelaunay3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->Update();\n\n  vtkNew<vtkDelaunay3D> delaunay1;\n  delaunay1->SetInputConnection(sphereSource1->GetOutputPort());\n  delaunay1->Update();\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(5, 0, 0);\n  sphereSource2->Update();\n\n  vtkNew<vtkDelaunay3D> delaunay2;\n  delaunay2->SetInputConnection(sphereSource2->GetOutputPort());\n  delaunay2->Update();\n\n  vtkNew<vtkAppendFilter> appendFilter;\n  appendFilter->AddInputConnection(delaunay1->GetOutputPort());\n  appendFilter->AddInputConnection(delaunay2->GetOutputPort());\n  appendFilter->Update();\n\n  vtkNew<vtkConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputConnection(appendFilter->GetOutputPort());\n  connectivityFilter->SetExtractionModeToAllRegions();\n  connectivityFilter->ColorRegionsOn();\n  connectivityFilter->Update();\n\n  // Visualize\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(connectivityFilter->GetOutputPort());\n  mapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(renderer);\n  renwin->Render();\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n\n  iren->Initialize();\n  renwin->Render();\n  renderer->SetBackground(colors->GetColor3d(\"deep_ochre\").GetData());\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renwin->SetWindowName(\"ConnectivityFilter\");\n  renwin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/ConnectivityFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConnectivityFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConnectivityFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConnectivityFilter MACOSX_BUNDLE ConnectivityFilter.cxx )\n  target_link_libraries(ConnectivityFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConnectivityFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/ConnectivityFilter/#download-and-build-connectivityfilter","title":"Download and Build ConnectivityFilter","text":"

        Click here to download ConnectivityFilter and its CMakeLists.txt file. Once the tarball ConnectivityFilter.tar has been downloaded and extracted,

        cd ConnectivityFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConnectivityFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/ConnectivityFilterDemo/","title":"ConnectivityFilterDemo","text":"

        vtk-examples/Cxx/Filtering/ConnectivityFilterDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/ConnectivityFilterDemo/#description","title":"Description","text":"

        This example uses vtkPolyDataConnectivity to separate an input vtkPolyData into disconnected regions. Each region is assigned a unique color. A number of vtkNamedColors are used to fill part of the vtkLookupTable. If the number of extracted regions is more that the number of specified colors, the remaining colors are generated with a random number generator.

        The default representation is surface. If the user types a \"w\" in the render window, the view will be rendered as a wireframe. The renderer will use hidden line removal.

        The example supports any vtkPolyData reader.

        Info

        ConnectivityFilter illustrates vtkConnectivityFilter on a simple 2 region dataset.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/ConnectivityFilterDemo/#code","title":"Code","text":"

        ConnectivityFilterDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\n#include <random>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputData(polyData);\n  connectivityFilter->SetExtractionModeToAllRegions();\n  connectivityFilter->ColorRegionsOn();\n  connectivityFilter->Update();\n\n  // Visualize\n  int numberOfRegions = connectivityFilter->GetNumberOfExtractedRegions();\n  if (argc > 1)\n  {\n    std::cout << argv[1] << \" contains \" << numberOfRegions << \" regions\"\n              << std::endl;\n  }\n  else\n  {\n    std::cout << \"Generated data\"\n              << \" contains \" << numberOfRegions << \" regions\" << std::endl;\n  }\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(std::max(numberOfRegions, 10));\n  lut->Build();\n\n  // Fill in a few known colors, the rest will be generated if needed.\n  vtkNew<vtkNamedColors> colors;\n  lut->SetTableValue(0, colors->GetColor4d(\"Gold\").GetData());\n  lut->SetTableValue(1, colors->GetColor4d(\"Banana\").GetData());\n  lut->SetTableValue(2, colors->GetColor4d(\"Tomato\").GetData());\n  lut->SetTableValue(3, colors->GetColor4d(\"Wheat\").GetData());\n  lut->SetTableValue(4, colors->GetColor4d(\"Lavender\").GetData());\n  lut->SetTableValue(5, colors->GetColor4d(\"Flesh\").GetData());\n  lut->SetTableValue(6, colors->GetColor4d(\"Raspberry\").GetData());\n  lut->SetTableValue(7, colors->GetColor4d(\"Salmon\").GetData());\n  lut->SetTableValue(8, colors->GetColor4d(\"Mint\").GetData());\n  lut->SetTableValue(9, colors->GetColor4d(\"Peacock\").GetData());\n\n  // If the number of regions os larger than the number of specified colors,\n  // generate some random colors.\n  if (numberOfRegions > 9)\n  {\n    std::mt19937 mt(4355412); // Standard mersenne_twister_engine.\n    std::uniform_real_distribution<double> distribution(.4, 1.0);\n    for (auto i = 10; i < numberOfRegions; ++i)\n    {\n      lut->SetTableValue(i, distribution(mt), distribution(mt),\n                         distribution(mt), 1.0);\n    }\n  }\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(connectivityFilter->GetOutputPort());\n  mapper->SetScalarRange(0,\n                         connectivityFilter->GetNumberOfExtractedRegions() - 1);\n  mapper->SetLookupTable(lut);\n  mapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->UseHiddenLineRemovalOn();\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  // Pick a good view\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  renderer->GetActiveCamera()->SetPosition(0.0, 1.0, 0.0);\n  renderer->GetActiveCamera()->SetViewUp(0.0, 0.0, 1.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Elevation(45.0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetWindowName(\"ConnectivityFilterDemo\");\n  renderWindow->Render();\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Filtering/ConnectivityFilterDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConnectivityFilterDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConnectivityFilterDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConnectivityFilterDemo MACOSX_BUNDLE ConnectivityFilterDemo.cxx )\n  target_link_libraries(ConnectivityFilterDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConnectivityFilterDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/ConnectivityFilterDemo/#download-and-build-connectivityfilterdemo","title":"Download and Build ConnectivityFilterDemo","text":"

        Click here to download ConnectivityFilterDemo and its CMakeLists.txt file. Once the tarball ConnectivityFilterDemo.tar has been downloaded and extracted,

        cd ConnectivityFilterDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConnectivityFilterDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/ConstrainedDelaunay2D/","title":"ConstrainedDelaunay2D","text":"

        vtk-examples/Cxx/Filtering/ConstrainedDelaunay2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/ConstrainedDelaunay2D/#description","title":"Description","text":"

        Perform a 2D Delaunay triangulation respecting a specified boundary. This examples constructs a 10x10 grid of points. It then defines a polygon that uses the points in the grid. We want to triangulate all of the points except the region inside the boundary of the polygon. We expect a rectangular hole of size 4x3 in the resulting triangulated plane.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/ConstrainedDelaunay2D/#code","title":"Code","text":"

        ConstrainedDelaunay2D.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkDelaunay2D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolygon.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Generate a 10 x 10 grid of points\n  vtkNew<vtkPoints> points;\n  unsigned int gridSize = 10;\n  unsigned int seed = 0;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->Initialize(seed);\n  for (unsigned int x = 0; x < gridSize; x++)\n  {\n    for (unsigned int y = 0; y < gridSize; y++)\n    {\n      auto d1 = randomSequence->GetValue() / 2.0 - 0.25;\n      randomSequence->Next();\n      auto d2 = randomSequence->GetValue() / 2.0 - 0.25;\n      randomSequence->Next();\n      points->InsertNextPoint(x + d1, y + d2, 0);\n    }\n  }\n\n  vtkNew<vtkPolyData> aPolyData;\n  aPolyData->SetPoints(points);\n\n  // Create a cell array to store the polygon in\n  vtkNew<vtkCellArray> aCellArray;\n\n  // Define a polygonal hole with a clockwise polygon\n  vtkNew<vtkPolygon> aPolygon;\n\n  aPolygon->GetPointIds()->InsertNextId(22);\n  aPolygon->GetPointIds()->InsertNextId(23);\n  aPolygon->GetPointIds()->InsertNextId(24);\n  aPolygon->GetPointIds()->InsertNextId(25);\n  aPolygon->GetPointIds()->InsertNextId(35);\n  aPolygon->GetPointIds()->InsertNextId(45);\n  aPolygon->GetPointIds()->InsertNextId(44);\n  aPolygon->GetPointIds()->InsertNextId(43);\n  aPolygon->GetPointIds()->InsertNextId(42);\n  aPolygon->GetPointIds()->InsertNextId(32);\n\n  aCellArray->InsertNextCell(aPolygon);\n\n  // Create a polydata to store the boundary. The points must be the\n  // same as the points we will triangulate.\n  vtkNew<vtkPolyData> boundary;\n  boundary->SetPoints(aPolyData->GetPoints());\n  boundary->SetPolys(aCellArray);\n\n  // Triangulate the grid points\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(aPolyData);\n  delaunay->SetSourceData(boundary);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> meshMapper;\n  meshMapper->SetInputConnection(delaunay->GetOutputPort());\n\n  vtkNew<vtkActor> meshActor;\n  meshActor->SetMapper(meshMapper);\n  meshActor->GetProperty()->EdgeVisibilityOn();\n  meshActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n  meshActor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkPolyDataMapper> boundaryMapper;\n  boundaryMapper->SetInputData(boundary);\n\n  vtkNew<vtkActor> boundaryActor;\n  boundaryActor->SetMapper(boundaryMapper);\n  boundaryActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Raspberry\").GetData());\n  boundaryActor->GetProperty()->SetLineWidth(3);\n  boundaryActor->GetProperty()->EdgeVisibilityOn();\n  boundaryActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"Red\").GetData());\n  boundaryActor->GetProperty()->SetRepresentationToWireframe();\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(meshActor);\n  renderer->AddActor(boundaryActor);\n  renderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  // Render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ConstrainedDelaunay2D\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/ConstrainedDelaunay2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConstrainedDelaunay2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConstrainedDelaunay2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConstrainedDelaunay2D MACOSX_BUNDLE ConstrainedDelaunay2D.cxx )\n  target_link_libraries(ConstrainedDelaunay2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConstrainedDelaunay2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/ConstrainedDelaunay2D/#download-and-build-constraineddelaunay2d","title":"Download and Build ConstrainedDelaunay2D","text":"

        Click here to download ConstrainedDelaunay2D and its CMakeLists.txt file. Once the tarball ConstrainedDelaunay2D.tar has been downloaded and extracted,

        cd ConstrainedDelaunay2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConstrainedDelaunay2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/ContoursFromPolyData/","title":"ContoursFromPolyData","text":"

        vtk-examples/Cxx/Filtering/ContoursFromPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/ContoursFromPolyData/#description","title":"Description","text":"

        This example uses vtkCutter to generate contours from a PolyData. A vtkPlane is set at the center of the PolyData and several contours are generated by specifying contour values that are distances to the center plane. The example works with a filename if provided. Otherwise is uses a vtkSphereSource.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/ContoursFromPolyData/#code","title":"Code","text":"

        ContoursFromPolyData.cxx

        #include <vtkActor.h>\n#include <vtkCutter.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    inputPolyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(30);\n    sphereSource->SetPhiResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputData(inputPolyData);\n\n  // Create a plane to cut\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(inputPolyData->GetCenter());\n  plane->SetNormal(1, 1, 1);\n\n  double minBound[3];\n  minBound[0] = inputPolyData->GetBounds()[0];\n  minBound[1] = inputPolyData->GetBounds()[2];\n  minBound[2] = inputPolyData->GetBounds()[4];\n\n  double maxBound[3];\n  maxBound[0] = inputPolyData->GetBounds()[1];\n  maxBound[1] = inputPolyData->GetBounds()[3];\n  maxBound[2] = inputPolyData->GetBounds()[5];\n\n  double center[3];\n  center[0] = inputPolyData->GetCenter()[0];\n  center[1] = inputPolyData->GetCenter()[1];\n  center[2] = inputPolyData->GetCenter()[2];\n\n  double distanceMin = sqrt(vtkMath::Distance2BetweenPoints(minBound, center));\n  double distanceMax = sqrt(vtkMath::Distance2BetweenPoints(maxBound, center));\n\n  // Create cutter.\n  vtkNew<vtkCutter> cutter;\n  cutter->SetCutFunction(plane);\n  cutter->SetInputData(inputPolyData);\n\n  cutter->GenerateValues(20, -distanceMin, distanceMax);\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n  cutterMapper->ScalarVisibilityOff();\n\n  // Create plane actor.\n  vtkNew<vtkActor> planeActor;\n  planeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Deep_pink\").GetData());\n  planeActor->GetProperty()->SetLineWidth(5);\n  planeActor->SetMapper(cutterMapper);\n\n  // Create input actor.\n  vtkNew<vtkActor> inputActor;\n  inputActor->GetProperty()->SetColor(colors->GetColor3d(\"Bisque\").GetData());\n  inputActor->SetMapper(inputMapper);\n\n  // Create renderers and add actors of plane and cube.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(planeActor); // Display the rectangle resulting from the\n                                  // cut.\n  renderer->AddActor(inputActor); // Display the cube.\n\n  // Add renderer to renderwindow and render\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ContoursFromPolyData\");\n  renderWindow->SetSize(600, 600);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderer->SetBackground(colors->GetColor3d(\"Slate_grey\").GetData());\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/ContoursFromPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ContoursFromPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ContoursFromPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ContoursFromPolyData MACOSX_BUNDLE ContoursFromPolyData.cxx )\n  target_link_libraries(ContoursFromPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ContoursFromPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/ContoursFromPolyData/#download-and-build-contoursfrompolydata","title":"Download and Build ContoursFromPolyData","text":"

        Click here to download ContoursFromPolyData and its CMakeLists.txt file. Once the tarball ContoursFromPolyData.tar has been downloaded and extracted,

        cd ContoursFromPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ContoursFromPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/Delaunay2D/","title":"Delaunay2D","text":"

        vtk-examples/Cxx/Filtering/Delaunay2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/Delaunay2D/#description","title":"Description","text":"

        This example generates a set of points aligned with an XY grid with random heights (z values). The Delaunay2D filter \"magically\" knows how to triangulate this type of point set because it projects the points by default onto the XY axis and then performs a 2D Delaunay triangulation. The result is a mesh on the input points.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/Delaunay2D/#code","title":"Code","text":"

        Delaunay2D.cxx

        #include <vtkActor.h>\n#include <vtkDelaunay2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a set of heights on a grid.\n  // This is often called a \"terrain map\".\n  vtkNew<vtkPoints> points;\n\n  unsigned int gridSize = 10;\n  for (unsigned int x = 0; x < gridSize; x++)\n  {\n    for (unsigned int y = 0; y < gridSize; y++)\n    {\n      points->InsertNextPoint(x, y, (x + y) / (y + 1));\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Triangulate the grid points\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(polydata);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> meshMapper;\n  meshMapper->SetInputConnection(delaunay->GetOutputPort());\n\n  vtkNew<vtkActor> meshActor;\n  meshActor->SetMapper(meshMapper);\n  meshActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  meshActor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n\n  vtkNew<vtkPolyDataMapper> pointMapper;\n  pointMapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  pointActor->GetProperty()->SetPointSize(5);\n  pointActor->SetMapper(pointMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(meshActor);\n  renderer->AddActor(pointActor);\n  renderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  renderWindow->SetWindowName(\"Delaunay2D\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/Delaunay2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Delaunay2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Delaunay2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Delaunay2D MACOSX_BUNDLE Delaunay2D.cxx )\n  target_link_libraries(Delaunay2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Delaunay2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/Delaunay2D/#download-and-build-delaunay2d","title":"Download and Build Delaunay2D","text":"

        Click here to download Delaunay2D and its CMakeLists.txt file. Once the tarball Delaunay2D.tar has been downloaded and extracted,

        cd Delaunay2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Delaunay2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/ExtractVisibleCells/","title":"ExtractVisibleCells","text":"

        vtk-examples/Cxx/Filtering/ExtractVisibleCells

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/ExtractVisibleCells/#code","title":"Code","text":"

        ExtractVisibleCells.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkHardwareSelector.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSelection.h>\n#include <vtkSphereSource.h>\n\n// Define interaction style\nclass KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  vtkNew<vtkNamedColors> colors;\n  static KeyPressInteractorStyle* New();\n  vtkTypeMacro(KeyPressInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnKeyPress() override\n  {\n    // Get the keypress\n    std::string key = this->Interactor->GetKeySym();\n\n    // \"s\" for \"s\"elect\n    if (key.compare(\"s\") == 0)\n    {\n      vtkNew<vtkHardwareSelector> selector;\n      selector->SetRenderer(this->Interactor->GetRenderWindow()\n                                ->GetRenderers()\n                                ->GetFirstRenderer());\n      int* temp = this->Interactor->GetRenderWindow()->GetSize();\n      unsigned int windowSize[4];\n      windowSize[0] = temp[2];\n      windowSize[1] = temp[3];\n      windowSize[2] = temp[0];\n      windowSize[3] = temp[1];\n      /*\n        for(unsigned int i = 0; i < 4; i++)\n          {\n          windowSize[i] = temp[i];\n          }\n        */\n      selector->SetArea(windowSize);\n      selector->SetFieldAssociation(vtkDataObject::FIELD_ASSOCIATION_CELLS);\n      vtkSelection* selection = selector->Select();\n      std::cout << \"Selection has \" << selection->GetNumberOfNodes()\n                << \" nodes.\" << std::endl;\n\n      vtkNew<vtkExtractSelection> extractSelection;\n      extractSelection->SetInputData(0, this->Data);\n      extractSelection->SetInputData(1, selection);\n      extractSelection->Update();\n\n      vtkNew<vtkDataSetMapper> mapper;\n      mapper->SetInputConnection(extractSelection->GetOutputPort());\n\n      vtkNew<vtkActor> actor;\n      actor->SetMapper(mapper);\n      actor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n      this->Renderer->AddActor(actor);\n    }\n\n    // Forward events\n    vtkInteractorStyleTrackballCamera::OnKeyPress();\n  }\n\n  vtkPolyData* Data;\n  vtkRenderer* Renderer;\n};\nvtkStandardNewMacro(KeyPressInteractorStyle);\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetMultiSamples(0); // Turn off anti-aliasing\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<KeyPressInteractorStyle> style;\n  style->Renderer = renderer;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->SetCurrentRenderer(renderer);\n  style->Data = sphereSource->GetOutput();\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"ExtractVisibleCells\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/ExtractVisibleCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractVisibleCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractVisibleCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractVisibleCells MACOSX_BUNDLE ExtractVisibleCells.cxx )\n  target_link_libraries(ExtractVisibleCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractVisibleCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/ExtractVisibleCells/#download-and-build-extractvisiblecells","title":"Download and Build ExtractVisibleCells","text":"

        Click here to download ExtractVisibleCells and its CMakeLists.txt file. Once the tarball ExtractVisibleCells.tar has been downloaded and extracted,

        cd ExtractVisibleCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractVisibleCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/GaussianSplat/","title":"GaussianSplat","text":"

        vtk-examples/Cxx/Filtering/GaussianSplat

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/GaussianSplat/#code","title":"Code","text":"

        GaussianSplat.cxx

        #include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create points on a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(sphereSource->GetOutput()->GetPoints());\n\n  vtkNew<vtkGaussianSplatter> splatter;\n  splatter->SetInputData(polydata);\n  splatter->SetSampleDimensions(50, 50, 50);\n  splatter->SetRadius(0.5);\n  splatter->ScalarWarpingOff();\n\n  vtkNew<vtkContourFilter> surface;\n  surface->SetInputConnection(splatter->GetOutputPort());\n  surface->SetValue(0, 0.01);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->SetWindowName(\"GaussianSplat\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/GaussianSplat/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GaussianSplat)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GaussianSplat: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GaussianSplat MACOSX_BUNDLE GaussianSplat.cxx )\n  target_link_libraries(GaussianSplat PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GaussianSplat\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/GaussianSplat/#download-and-build-gaussiansplat","title":"Download and Build GaussianSplat","text":"

        Click here to download GaussianSplat and its CMakeLists.txt file. Once the tarball GaussianSplat.tar has been downloaded and extracted,

        cd GaussianSplat/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GaussianSplat\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/GenericClip/","title":"GenericClip","text":"

        vtk-examples/Cxx/Filtering/GenericClip

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/GenericClip/#description","title":"Description","text":"

        Warning

        This example requires vtk 6.0 or greater.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/GenericClip/#code","title":"Code","text":"

        GenericClip.cxx

        #include <vtkActor.h>\n#include <vtkBridgeDataSet.h> // Must build VTK with BUILD_TESTING=ON\n#include <vtkCellData.h>\n#include <vtkContourFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGenericClip.h>\n#include <vtkIdFilter.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // If we try to use a PointSource with vtkBridgeDataSet, an error is produced:\n  //    vtkBridgeCell.cxx:141: virtual int vtkBridgeCell::GetType(): Assertion\n  //    `\"check: impossible case\" && 0' failed.\n  // There does not seem to be a case to handle VTK_VERTEX (which is what is\n  // produced by PointSource) in vtkBridgeDataSet.\n  //  vtkNew<vtkPointSource> pointSource;\n  //  pointSource->SetNumberOfPoints(100);\n  //  pointSource->SetRadius(1.0);\n  //  pointSource->Update();\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(5);\n  sphereSource->SetThetaResolution(10);\n  sphereSource->SetPhiResolution(10);\n  sphereSource->Update();\n\n  // Add ids to the points and cells of the sphere\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputConnection(sphereSource->GetOutputPort());\n  idFilter->Update();\n\n  // Create a plane to clip with\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(0, 0, 0);\n  plane->SetNormal(1, 1, 1);\n\n  // Convert the DataSet to a GenericDataSet\n  vtkNew<vtkBridgeDataSet> bridgeDataSet;\n  bridgeDataSet->SetDataSet(idFilter->GetOutput());\n\n  vtkNew<vtkGenericClip> clipper;\n  clipper->SetClipFunction(plane);\n  clipper->SetInputData(bridgeDataSet);\n  clipper->Update();\n\n  // Get the clipped cell ids\n  vtkUnstructuredGrid* clipped = clipper->GetOutput();\n  vtkIdTypeArray* originalIds = dynamic_cast<vtkIdTypeArray*>(\n      clipped->GetCellData()->GetArray(\"vtkIdFilter_Ids\"));\n  for (vtkIdType i = 0; i < originalIds->GetNumberOfTuples(); ++i)\n  {\n    std::cout << \"new id \" << i << \", original id \" << originalIds->GetValue(i)\n              << std::endl;\n  }\n\n  // Create a mapper and actor for clipped points\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(clipper->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a mapper and actor for clipping function\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(20, 20, 20);\n  sample->SetImplicitFunction(plane);\n  double value = 10.0;\n  double xmin = -value, xmax = value, ymin = -value, ymax = value,\n         zmin = -value, zmax = value;\n  sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n  // Create the 0 isosurface\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(1, 1, 1);\n\n  // Map the contours to graphical primitives\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contours->GetOutputPort());\n  contourMapper->SetScalarRange(0.0, 1.2);\n\n  // Create an actor for the sphere\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(contourMapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"Burlywood\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n  // Render and interact\n  renderWindow->SetWindowName(\"GenericClip\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/GenericClip/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GenericClip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneric\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  TestingGenericBridge\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GenericClip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GenericClip MACOSX_BUNDLE GenericClip.cxx )\n  target_link_libraries(GenericClip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GenericClip\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/GenericClip/#download-and-build-genericclip","title":"Download and Build GenericClip","text":"

        Click here to download GenericClip and its CMakeLists.txt file. Once the tarball GenericClip.tar has been downloaded and extracted,

        cd GenericClip/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GenericClip\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/Glyph2D/","title":"Glyph2D","text":"

        vtk-examples/Cxx/Filtering/Glyph2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/Glyph2D/#description","title":"Description","text":"

        Copy a polydata to every point in the input set. We use a hexagon for the demo.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/Glyph2D/#code","title":"Code","text":"

        Glyph2D.cxx

        #include <vtkActor.h>\n#include <vtkGlyph2D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRegularPolygonSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(2, 2, 0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create anything you want here, we will use a polygon for the demo.\n  vtkNew<vtkRegularPolygonSource> polygonSource; // default is 6 sides\n\n  vtkNew<vtkGlyph2D> glyph2D;\n  glyph2D->SetSourceConnection(polygonSource->GetOutputPort());\n  glyph2D->SetInputData(polydata);\n  glyph2D->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph2D->GetOutputPort());\n  mapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Salmon\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkInteractorStyleImage> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindow->SetWindowName(\"Glyph2D\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/Glyph2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Glyph2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Glyph2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Glyph2D MACOSX_BUNDLE Glyph2D.cxx )\n  target_link_libraries(Glyph2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Glyph2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/Glyph2D/#download-and-build-glyph2d","title":"Download and Build Glyph2D","text":"

        Click here to download Glyph2D and its CMakeLists.txt file. Once the tarball Glyph2D.tar has been downloaded and extracted,

        cd Glyph2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Glyph2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/Glyph3D/","title":"Glyph3D","text":"

        vtk-examples/Cxx/Filtering/Glyph3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/Glyph3D/#description","title":"Description","text":"

        This example applies an object at every point. We use a cube for the demo.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/Glyph3D/#code","title":"Code","text":"

        Glyph3D.cxx

        #include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(2, 2, 0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Create anything you want here, we will use a cube for the demo.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetSourceConnection(cubeSource->GetOutputPort());\n  glyph3D->SetInputData(polydata);\n  glyph3D->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Salmon\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetWindowName(\"Glyph3D\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/Glyph3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Glyph3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Glyph3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Glyph3D MACOSX_BUNDLE Glyph3D.cxx )\n  target_link_libraries(Glyph3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Glyph3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/Glyph3D/#download-and-build-glyph3d","title":"Download and Build Glyph3D","text":"

        Click here to download Glyph3D and its CMakeLists.txt file. Once the tarball Glyph3D.tar has been downloaded and extracted,

        cd Glyph3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Glyph3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/ImplicitBoolean/","title":"ImplicitBoolean","text":"

        vtk-examples/Cxx/Filtering/ImplicitBoolean

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/ImplicitBoolean/#code","title":"Code","text":"

        ImplicitBoolean.cxx

        #include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\nint main(int, char*[])\n{\n  // Define colors\n  vtkNew<vtkNamedColors> colors;\n  //  vtkColor3d background = colors->GetColor3d(\"SlateGray\");\n  //  vtkColor3d actorColor = colors->GetColor3d(\"hot_pink\");\n\n  vtkNew<vtkSphere> sphere1;\n  sphere1->SetCenter(0.9, 0, 0);\n  vtkNew<vtkSphere> sphere2;\n  sphere2->SetCenter(-0.9, 0, 0);\n\n  vtkNew<vtkImplicitBoolean> implicitBoolean;\n  implicitBoolean->AddFunction(sphere1);\n  implicitBoolean->AddFunction(sphere2);\n  implicitBoolean->SetOperationTypeToUnion();\n\n  //  implicitBoolean->SetOperationTypeToIntersection();\n  //  implicitBoolean->SetOperationTypeToDifference();\n\n  // Sample the function\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(implicitBoolean);\n  double value = 3.0;\n  double xmin = -value, xmax = value, ymin = -value, ymax = value,\n         zmin = -value, zmax = value;\n  sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n  // Create the 0 isosurface\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(1, 1, 1);\n\n  // Map the contours to graphical primitives\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contours->GetOutputPort());\n  contourMapper->ScalarVisibilityOff();\n\n  // Create an actor for the contours\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n  contourActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"hot_pink\").GetData());\n  contourActor->GetProperty()->SetDiffuse(.8);\n  contourActor->GetProperty()->SetSpecular(.2);\n  contourActor->GetProperty()->SetSpecularPower(60.0);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ImplicitBoolean\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(contourActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/ImplicitBoolean/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitBoolean)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitBoolean: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitBoolean MACOSX_BUNDLE ImplicitBoolean.cxx )\n  target_link_libraries(ImplicitBoolean PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitBoolean\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/ImplicitBoolean/#download-and-build-implicitboolean","title":"Download and Build ImplicitBoolean","text":"

        Click here to download ImplicitBoolean and its CMakeLists.txt file. Once the tarball ImplicitBoolean.tar has been downloaded and extracted,

        cd ImplicitBoolean/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitBoolean\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/ImplicitBooleanDemo/","title":"ImplicitBooleanDemo","text":"

        vtk-examples/Cxx/Filtering/ImplicitBooleanDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/ImplicitBooleanDemo/#code","title":"Code","text":"

        ImplicitBooleanDemo.cxx

        #include <vtkActor.h>\n#include <vtkBox.h>\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\nint main(int /* argc */, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // create a sphere\n  vtkNew<vtkSphere> sphere;\n  sphere->SetRadius(1);\n  sphere->SetCenter(1, 0, 0);\n\n  // create a box\n  vtkNew<vtkBox> box;\n  box->SetBounds(-1, 1, -1, 1, -1, 1);\n\n  // combine the two implicit functions\n  vtkNew<vtkImplicitBoolean> boolean;\n  boolean->AddFunction(box);\n  boolean->AddFunction(sphere);\n\n  std::vector<vtkNew<vtkRenderer>> ren;\n  ren.push_back(vtkNew<vtkRenderer>());\n  ren.push_back(vtkNew<vtkRenderer>());\n  ren.push_back(vtkNew<vtkRenderer>());\n  ren[0]->SetViewport(0, 0, 1.0 / 3.0, 1);         // Difference\n  ren[1]->SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1); // Union\n  ren[2]->SetViewport(2.0 / 3.0, 0, 1, 1);         // Intersection\n\n  // Shared camera\n  vtkNew<vtkCamera> camera;\n  camera->Azimuth(30.0);\n  camera->Elevation(30.0);\n\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_DIVERGING_SPECTRAL_3);\n\n  for (int i = 0; i < 3; ++i)\n  {\n    if (i == 0)\n    {\n      boolean->SetOperationTypeToDifference();\n    }\n    else if (i == 1)\n    {\n      boolean->SetOperationTypeToUnion();\n    }\n    else\n    {\n      boolean->SetOperationTypeToIntersection();\n    }\n\n    // The sample function generates a distance function from the implicit\n    // function. This is then contoured to get a polygonal surface.\n    vtkNew<vtkSampleFunction> sample;\n    sample->SetImplicitFunction(boolean);\n    sample->SetModelBounds(-1, 2, -1, 1, -1, 1);\n    sample->SetSampleDimensions(100, 100, 100);\n    sample->ComputeNormalsOff();\n\n    // contour\n    vtkNew<vtkContourFilter> surface;\n    surface->SetInputConnection(sample->GetOutputPort());\n    surface->SetValue(0, 0.0);\n    surface->Update();\n\n    vtkNew<vtkPolyData> polyData;\n    polyData->DeepCopy(surface->GetOutput());\n\n    // mapper\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(polyData);\n    mapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    //    actor->GetProperty()->EdgeVisibilityOn();\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"peacock\").GetData());\n\n    // add the actor\n    ren[i]->SetBackground(colorSeries->GetColor(i).GetRed() / 255.0,\n                          colorSeries->GetColor(i).GetGreen() / 255.0,\n                          colorSeries->GetColor(i).GetBlue() / 255.0);\n    ren[i]->SetActiveCamera(camera);\n    ren[i]->AddActor(actor);\n  }\n\n  // render window\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(ren[0]);\n  renwin->AddRenderer(ren[1]);\n  renwin->AddRenderer(ren[2]);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renwin);\n\n  renwin->SetSize(900, 300);\n  renwin->SetWindowName(\"ImplicitBooleanDemo\");\n  renwin->Render();\n  ren[1]->ResetCamera();\n  renwin->Render();\n\n  // Start\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/ImplicitBooleanDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitBooleanDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitBooleanDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitBooleanDemo MACOSX_BUNDLE ImplicitBooleanDemo.cxx )\n  target_link_libraries(ImplicitBooleanDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitBooleanDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/ImplicitBooleanDemo/#download-and-build-implicitbooleandemo","title":"Download and Build ImplicitBooleanDemo","text":"

        Click here to download ImplicitBooleanDemo and its CMakeLists.txt file. Once the tarball ImplicitBooleanDemo.tar has been downloaded and extracted,

        cd ImplicitBooleanDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitBooleanDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/IterativeClosestPointsTransform/","title":"IterativeClosestPointsTransform","text":"

        vtk-examples/Cxx/Filtering/IterativeClosestPointsTransform

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/IterativeClosestPointsTransform/#description","title":"Description","text":"

        This demo produces target points (green) which are at the origin and unit length along each axis. It then perturbs the points and shifts each of them 0.3 in +y direction - the resulting points are the \"source\" points (red). It then attempts to move the source points as close as possible to the target points. The resulting points are shown in blue. The noise is added to make the example more realistic. Also, the noise ensures nothing was done wrong (i.e. accidentally using the target points as the result and claiming it worked perfectly when in fact nothing happened!)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/IterativeClosestPointsTransform/#code","title":"Code","text":"

        IterativeClosestPointsTransform.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkIterativeClosestPointTransform.h>\n#include <vtkLandmarkTransform.h>\n#include <vtkLine.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVertexGlyphFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nnamespace {\nvoid CreatePolyData(vtkSmartPointer<vtkPolyData> polydata);\nvoid PerturbPolyData(vtkSmartPointer<vtkPolyData> polydata);\nvoid TranslatePolyData(vtkSmartPointer<vtkPolyData> polydata);\nvoid AxesLines(vtkSmartPointer<vtkPolyData> linesPolyData);\n\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph.\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05.\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyData> source;\n  vtkNew<vtkPolyData> target;\n  // An aid to orient the view of the created data.\n  vtkNew<vtkPolyData> linesPolyData;\n  auto createdData = false;\n\n  if (argc == 3)\n  {\n    std::cout << \"Reading data...\" << std::endl;\n    std::string strSource = argv[1];\n    std::string strTarget = argv[2];\n    vtkNew<vtkXMLPolyDataReader> sourceReader;\n    sourceReader->SetFileName(strSource.c_str());\n    sourceReader->Update();\n    source->ShallowCopy(sourceReader->GetOutput());\n\n    vtkNew<vtkXMLPolyDataReader> targetReader;\n    targetReader->SetFileName(strTarget.c_str());\n    targetReader->Update();\n    target->ShallowCopy(targetReader->GetOutput());\n  }\n  else\n  {\n    std::cout << \"Creating data...\" << std::endl;\n    CreatePolyData(source);\n    target->ShallowCopy(source);\n    TranslatePolyData(target);\n    PerturbPolyData(target);\n    AxesLines(linesPolyData);\n    createdData = true;\n  }\n\n  // Setup ICP transform\n  vtkNew<vtkIterativeClosestPointTransform> icp;\n  icp->SetSource(source);\n  icp->SetTarget(target);\n  icp->GetLandmarkTransform()->SetModeToRigidBody();\n  icp->SetMaximumNumberOfIterations(20);\n  // icp->StartByMatchingCentroidsOn();\n  icp->Modified();\n  icp->Update();\n\n  // Get the resulting transformation matrix (this matrix takes the source\n  // points to the target points)\n  vtkSmartPointer<vtkMatrix4x4> m = icp->GetMatrix();\n  std::cout << \"The resulting matrix is: \" << *m << std::endl;\n\n  // Transform the source points by the ICP solution\n  vtkNew<vtkTransformPolyDataFilter> icpTransformFilter;\n  icpTransformFilter->SetInputData(source);\n  icpTransformFilter->SetTransform(icp);\n  icpTransformFilter->Update();\n\n  /*\n  // If you need to take the target points to the source points, the matrix is:\n  icp->Inverse();\n  vtkSmartPointer<vtkMatrix4x4> minv = icp->GetMatrix();\n  std::cout << \"The resulting inverse matrix is: \" << *minv << std::cout;\n  */\n\n  // Visualize\n  // Map the points to spheres\n  auto sourceActor = PointToGlyph(source->GetPoints(), 0.03);\n  sourceActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  auto targetActor = PointToGlyph(target->GetPoints(), 0.03);\n  targetActor->GetProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n\n  auto solutionActor =\n      PointToGlyph(icpTransformFilter->GetOutput()->GetPoints(), 0.03);\n  solutionActor->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n\n  vtkNew<vtkPolyDataMapper> axesMapper;\n  vtkNew<vtkActor> axesActor;\n  if (createdData)\n  {\n    axesMapper->SetInputData(linesPolyData);\n\n    axesActor->SetMapper(axesMapper);\n    axesActor->GetProperty()->SetLineWidth(1);\n  }\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"IterativeClosestPointsTransform\");\n\n  // Add the actor to the scene\n  renderer->AddActor(sourceActor);\n  renderer->AddActor(targetActor);\n  renderer->AddActor(solutionActor);\n  if (createdData)\n  {\n    renderer->AddActor(axesActor);\n  }\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace // anonymous\n{\n\nvoid CreatePolyData(vtkSmartPointer<vtkPolyData> polydata)\n{\n  // This function creates a set of 4 points (the origin and a point unit\n  // distance along each axis)\n\n  vtkNew<vtkPoints> points;\n\n  // Create points\n  double origin[3] = {0.0, 0.0, 0.0};\n  points->InsertNextPoint(origin);\n  double p1[3] = {1.0, 0.0, 0.0};\n  points->InsertNextPoint(p1);\n  double p2[3] = {0.0, 1.0, 0.0};\n  points->InsertNextPoint(p2);\n  double p3[3] = {0.0, 0.0, 1.0};\n  points->InsertNextPoint(p3);\n\n  vtkNew<vtkPolyData> temp;\n  temp->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> vertexFilter;\n  vertexFilter->SetInputData(temp);\n  vertexFilter->Update();\n\n  polydata->ShallowCopy(vertexFilter->GetOutput());\n}\n\nvoid PerturbPolyData(vtkSmartPointer<vtkPolyData> polydata)\n{\n  vtkNew<vtkPoints> points;\n  points->ShallowCopy(polydata->GetPoints());\n\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    points->GetPoint(i, p);\n    double perturb[3];\n    if (i % 3 == 0)\n    {\n      perturb[0] = .1;\n      perturb[1] = 0;\n      perturb[2] = 0;\n    }\n    else if (i % 3 == 1)\n    {\n      perturb[0] = 0;\n      perturb[1] = .1;\n      perturb[2] = 0;\n    }\n    else\n    {\n      perturb[0] = 0;\n      perturb[1] = 0;\n      perturb[2] = .1;\n    }\n\n    for (unsigned int j = 0; j < 3; j++)\n    {\n      p[j] += perturb[j];\n    }\n    points->SetPoint(i, p);\n  }\n\n  polydata->SetPoints(points);\n}\n\nvoid TranslatePolyData(vtkSmartPointer<vtkPolyData> polydata)\n{\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0, .3, 0);\n\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputData(polydata);\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  polydata->ShallowCopy(transformFilter->GetOutput());\n}\n\nvoid AxesLines(vtkSmartPointer<vtkPolyData> linesPolyData)\n{\n  // Create four points\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.5, 0.0, 0.0};\n  double p1[3] = {0.0, 1.5, 0.0};\n  double p2[3] = {0.0, 0.0, 1.5};\n\n  // Create a vtkPoints container and store the points in it\n  vtkNew<vtkPoints> pts;\n  pts->InsertNextPoint(origin);\n  pts->InsertNextPoint(p0);\n  pts->InsertNextPoint(p1);\n  pts->InsertNextPoint(p2);\n\n  // Add the points to the polydata container\n  linesPolyData->SetPoints(pts);\n\n  // Create the lines (between Origin and p0, ,p1, p2)\n  vtkNew<vtkLine> line0;\n  line0->GetPointIds()->SetId(0, 0);\n  line0->GetPointIds()->SetId(1, 1);\n  vtkNew<vtkLine> line1;\n  line1->GetPointIds()->SetId(0, 0);\n  line1->GetPointIds()->SetId(1, 2);\n  vtkNew<vtkLine> line2;\n  line2->GetPointIds()->SetId(0, 0);\n  line2->GetPointIds()->SetId(1, 3);\n\n  // Create a vtkCellArray container and store the lines in it\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line0);\n  lines->InsertNextCell(line1);\n  lines->InsertNextCell(line2);\n\n  // Add the lines to the polydata container\n  linesPolyData->SetLines(lines);\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a vtkUnsignedCharArray container and store the colors in it\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"DarkRed\").GetData());\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"DarkGreen\").GetData());\n  colors->InsertNextTupleValue(\n      namedColors->GetColor3ub(\"MidnightBlue\").GetData());\n\n  // Color the lines.\n  linesPolyData->GetCellData()->SetScalars(colors);\n}\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // end anonymous namespace\n
        "},{"location":"Cxx/Filtering/IterativeClosestPointsTransform/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IterativeClosestPointsTransform)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonMath\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IterativeClosestPointsTransform: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IterativeClosestPointsTransform MACOSX_BUNDLE IterativeClosestPointsTransform.cxx )\n  target_link_libraries(IterativeClosestPointsTransform PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IterativeClosestPointsTransform\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/IterativeClosestPointsTransform/#download-and-build-iterativeclosestpointstransform","title":"Download and Build IterativeClosestPointsTransform","text":"

        Click here to download IterativeClosestPointsTransform and its CMakeLists.txt file. Once the tarball IterativeClosestPointsTransform.tar has been downloaded and extracted,

        cd IterativeClosestPointsTransform/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IterativeClosestPointsTransform\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/LandmarkTransform/","title":"LandmarkTransform","text":"

        vtk-examples/Cxx/Filtering/LandmarkTransform

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/LandmarkTransform/#description","title":"Description","text":"

        This example creates two point sets which it assumes are known, ordered correspondences. It then transforms Source to Target and displays the matrix used in the transformation.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/LandmarkTransform/#code","title":"Code","text":"

        LandmarkTransform.cxx

        #include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLandmarkTransform.h>\n#include <vtkLine.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVertexGlyphFilter.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nnamespace {\nvoid AxesLines(vtkSmartPointer<vtkPolyData> linesPolyData);\n\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\n\nint main(int, char*[])\n{\n  /*\n  This demo creates a coordinate frame (+x, +y, +z) of vectors and a rotated,\n  peturbed frame (+z, +y, -x) and aligns the rotated frame to the original as\n  best as possible.\n  */\n\n  vtkNew<vtkNamedColors> colors;\n\n  // An aid to orient the view of the created data.\n  vtkNew<vtkPolyData> linesPolyData;\n  AxesLines(linesPolyData);\n\n  vtkNew<vtkPoints> sourcePoints;\n  double sourcePoint1[3] = {1.0, 0.0, 0.0};\n  sourcePoints->InsertNextPoint(sourcePoint1);\n  double sourcePoint2[3] = {0.0, 1.0, 0.0};\n  sourcePoints->InsertNextPoint(sourcePoint2);\n  double sourcePoint3[3] = {0.0, 0.0, 1.0};\n  sourcePoints->InsertNextPoint(sourcePoint3);\n\n  vtkNew<vtkPoints> targetPoints;\n  double targetPoint1[3] = {0.0, 0.0, 1.1};\n  targetPoints->InsertNextPoint(targetPoint1);\n  double targetPoint2[3] = {0.0, 1.02, 0.0};\n  targetPoints->InsertNextPoint(targetPoint2);\n  double targetPoint3[3] = {-1.11, 0.0, 0.0};\n  targetPoints->InsertNextPoint(targetPoint3);\n\n  // Setup the transform\n  vtkNew<vtkLandmarkTransform> landmarkTransform;\n  landmarkTransform->SetSourceLandmarks(sourcePoints);\n  landmarkTransform->SetTargetLandmarks(targetPoints);\n  landmarkTransform->SetModeToRigidBody();\n  landmarkTransform->Update(); // should this be here?\n\n  vtkNew<vtkPolyData> source;\n  source->SetPoints(sourcePoints);\n\n  vtkNew<vtkPolyData> target;\n  target->SetPoints(targetPoints);\n\n  vtkNew<vtkVertexGlyphFilter> sourceGlyphFilter;\n  sourceGlyphFilter->SetInputData(source);\n  sourceGlyphFilter->Update();\n\n  vtkNew<vtkVertexGlyphFilter> targetGlyphFilter;\n  targetGlyphFilter->SetInputData(target);\n  targetGlyphFilter->Update();\n\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(sourceGlyphFilter->GetOutputPort());\n  transformFilter->SetTransform(landmarkTransform);\n  transformFilter->Update();\n\n  // Display the transformation matrix that was computed\n  vtkMatrix4x4* mat = landmarkTransform->GetMatrix();\n  std::cout << \"Matrix: \" << *mat << std::endl;\n\n  // Visualize\n  // Map the points to spheres\n  auto sourceActor =\n      PointToGlyph(sourceGlyphFilter->GetOutput()->GetPoints(), 0.03);\n  sourceActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  auto targetActor =\n      PointToGlyph(targetGlyphFilter->GetOutput()->GetPoints(), 0.03);\n  targetActor->GetProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n\n  auto solutionActor =\n      PointToGlyph(transformFilter->GetOutput()->GetPoints(), 0.03);\n  solutionActor->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n\n  vtkNew<vtkPolyDataMapper> axesMapper;\n  axesMapper->SetInputData(linesPolyData);\n\n  vtkNew<vtkActor> axesActor;\n  axesActor->SetMapper(axesMapper);\n  axesActor->GetProperty()->SetLineWidth(1);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"LandmarkTransform\");\n\n  // Add the actor to the scene\n  renderer->AddActor(sourceActor);\n  renderer->AddActor(targetActor);\n  renderer->AddActor(solutionActor);\n  renderer->AddActor(axesActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid AxesLines(vtkSmartPointer<vtkPolyData> linesPolyData)\n{\n  // Create four points\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.2, 0.0, 0.0};\n  double p1[3] = {0.0, 1.2, 0.0};\n  double p2[3] = {0.0, 0.0, 1.2};\n\n  // Create a vtkPoints container and store the points in it\n  vtkNew<vtkPoints> pts;\n  pts->InsertNextPoint(origin);\n  pts->InsertNextPoint(p0);\n  pts->InsertNextPoint(p1);\n  pts->InsertNextPoint(p2);\n\n  // Add the points to the polydata container\n  linesPolyData->SetPoints(pts);\n\n  // Create the lines (between Origin and p0, ,p1, p2)\n  vtkNew<vtkLine> line0;\n  line0->GetPointIds()->SetId(0, 0);\n  line0->GetPointIds()->SetId(1, 1);\n  vtkNew<vtkLine> line1;\n  line1->GetPointIds()->SetId(0, 0);\n  line1->GetPointIds()->SetId(1, 2);\n  vtkNew<vtkLine> line2;\n  line2->GetPointIds()->SetId(0, 0);\n  line2->GetPointIds()->SetId(1, 3);\n\n  // Create a vtkCellArray container and store the lines in it\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line0);\n  lines->InsertNextCell(line1);\n  lines->InsertNextCell(line2);\n\n  // Add the lines to the polydata container\n  linesPolyData->SetLines(lines);\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a vtkUnsignedCharArray container and store the colors in it\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"DarkRed\").GetData());\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"DarkGreen\").GetData());\n  colors->InsertNextTupleValue(\n      namedColors->GetColor3ub(\"MidnightBlue\").GetData());\n\n  // Color the lines.\n  linesPolyData->GetCellData()->SetScalars(colors);\n}\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Filtering/LandmarkTransform/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LandmarkTransform)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonMath\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LandmarkTransform: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LandmarkTransform MACOSX_BUNDLE LandmarkTransform.cxx )\n  target_link_libraries(LandmarkTransform PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LandmarkTransform\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/LandmarkTransform/#download-and-build-landmarktransform","title":"Download and Build LandmarkTransform","text":"

        Click here to download LandmarkTransform and its CMakeLists.txt file. Once the tarball LandmarkTransform.tar has been downloaded and extracted,

        cd LandmarkTransform/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LandmarkTransform\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/PerlinNoise/","title":"PerlinNoise","text":"

        vtk-examples/Cxx/Filtering/PerlinNoise

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/PerlinNoise/#code","title":"Code","text":"

        PerlinNoise.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPerlinNoise.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPerlinNoise> perlinNoise;\n  perlinNoise->SetFrequency(2, 1.25, 1.5);\n  perlinNoise->SetPhase(0, 0, 0);\n\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetImplicitFunction(perlinNoise);\n  sample->SetSampleDimensions(65, 65, 20);\n  sample->ComputeNormalsOff();\n\n  vtkNew<vtkContourFilter> surface;\n  surface->SetInputConnection(sample->GetOutputPort());\n  surface->SetValue(0, 0.0);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetWindowName(\"PerlinNoise\");\n  renderWindow->SetSize(300, 300);\n  renderer->ResetCamera();\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/PerlinNoise/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PerlinNoise)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PerlinNoise: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PerlinNoise MACOSX_BUNDLE PerlinNoise.cxx )\n  target_link_libraries(PerlinNoise PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PerlinNoise\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/PerlinNoise/#download-and-build-perlinnoise","title":"Download and Build PerlinNoise","text":"

        Click here to download PerlinNoise and its CMakeLists.txt file. Once the tarball PerlinNoise.tar has been downloaded and extracted,

        cd PerlinNoise/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PerlinNoise\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/ProgrammableFilter/","title":"ProgrammableFilter","text":"

        vtk-examples/Cxx/Filtering/ProgrammableFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/ProgrammableFilter/#code","title":"Code","text":"

        ProgrammableFilter.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProgrammableFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nstruct params\n{\n  vtkPolyData* data;\n  vtkProgrammableFilter* filter;\n};\n\nvoid AdjustPoints(void* arguments);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkProgrammableFilter> programmableFilter;\n  programmableFilter->SetInputConnection(sphereSource->GetOutputPort());\n\n  params myParams;\n  myParams.data = sphereSource->GetOutput();\n  myParams.filter = programmableFilter;\n\n  programmableFilter->SetExecuteMethod(AdjustPoints, &myParams);\n  programmableFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(programmableFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBLue\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"ProgrammableFilter\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid AdjustPoints(void* arguments)\n{\n  params* input = static_cast<params*>(arguments);\n\n  vtkPoints* inPts = input->data->GetPoints();\n  vtkIdType numPts = inPts->GetNumberOfPoints();\n  vtkNew<vtkPoints> newPts;\n  newPts->SetNumberOfPoints(numPts);\n\n  for (vtkIdType i = 0; i < numPts / 2; i++)\n  {\n    double p[3];\n    inPts->GetPoint(i, p);\n    p[0] = p[0] + .5;\n    p[1] = p[1] + .5;\n    p[2] = p[2] + .5;\n    newPts->SetPoint(i, p);\n  }\n\n  for (vtkIdType i = numPts / 2; i < numPts; i++)\n  {\n    double p[3];\n    inPts->GetPoint(i, p);\n    p[0] = p[0] - .5;\n    p[1] = p[1] - .5;\n    p[2] = p[2] - .5;\n    newPts->SetPoint(i, p);\n  }\n\n  input->filter->GetPolyDataOutput()->CopyStructure(input->data);\n  input->filter->GetPolyDataOutput()->SetPoints(newPts);\n}\n\n} // namespace\n
        "},{"location":"Cxx/Filtering/ProgrammableFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProgrammableFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersProgrammable\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProgrammableFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProgrammableFilter MACOSX_BUNDLE ProgrammableFilter.cxx )\n  target_link_libraries(ProgrammableFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProgrammableFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/ProgrammableFilter/#download-and-build-programmablefilter","title":"Download and Build ProgrammableFilter","text":"

        Click here to download ProgrammableFilter and its CMakeLists.txt file. Once the tarball ProgrammableFilter.tar has been downloaded and extracted,

        cd ProgrammableFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ProgrammableFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/ProgrammableSource/","title":"ProgrammableSource","text":"

        vtk-examples/Cxx/Filtering/ProgrammableSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/ProgrammableSource/#description","title":"Description","text":"

        Use a programmable source to generate the points for the Lorenz System

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/ProgrammableSource/#code","title":"Code","text":"

        ProgrammableSource.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProgrammableSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\n// https://en.wikipedia.org/wiki/Lorenz_system\nstatic void Lorenz(void* arg)\n{\n  double sigma = 10.0; /* The Lorenz paramaters */\n  double beta = 8.0 / 3.0;\n  double rho = 28.0;\n  double h = .001; /* Integration step size */\n\n  double x, y, z;\n  double xx, yy, zz;\n  x = 0.1;\n  y = 0.1;\n  z = 0.1;\n  vtkNew<vtkPoints> points;\n  // Get to a stable starting point\n  for (int i = 0; i < 1000; ++i)\n  {\n    xx = x + h * sigma * (y - x);\n    yy = y + h * (x * (rho - z) - y);\n    zz = z + h * (x * y - (beta * z));\n    x = xx;\n    y = yy;\n    z = zz;\n  }\n  for (int i = 0; i < 500000; ++i)\n  {\n    xx = x + h * sigma * (y - x);\n    yy = y + h * (x * (rho - z) - y);\n    zz = z + h * (x * y - (beta * z));\n    points->InsertNextPoint(xx, yy, zz);\n    x = xx;\n    y = yy;\n    z = zz;\n  }\n  vtkNew<vtkPolyData> pointsPolydata;\n  pointsPolydata->SetPoints(points);\n  vtkNew<vtkVertexGlyphFilter> vertexFilter;\n  vertexFilter->SetInputData(pointsPolydata);\n  vertexFilter->Update();\n  vtkProgrammableSource* ps = static_cast<vtkProgrammableSource*>(arg);\n  vtkPolyData* output = ps->GetPolyDataOutput();\n  output->DeepCopy(vertexFilter->GetOutput());\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkProgrammableSource> source;\n  source->SetExecuteMethod(Lorenz, source);\n  source->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(source->GetPolyDataOutput());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"RosyBrown\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->SetWindowName(\"ProgrammableSource\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/ProgrammableSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProgrammableSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProgrammableSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProgrammableSource MACOSX_BUNDLE ProgrammableSource.cxx )\n  target_link_libraries(ProgrammableSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProgrammableSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/ProgrammableSource/#download-and-build-programmablesource","title":"Download and Build ProgrammableSource","text":"

        Click here to download ProgrammableSource and its CMakeLists.txt file. Once the tarball ProgrammableSource.tar has been downloaded and extracted,

        cd ProgrammableSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ProgrammableSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/SelectionSource/","title":"SelectionSource","text":"

        vtk-examples/Cxx/Filtering/SelectionSource

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/SelectionSource/#code","title":"Code","text":"

        SelectionSource.cxx

        #include <vtkExtractSelection.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkSelectionNode.h> // for POINT and INDICES enum values\n#include <vtkSelectionSource.h>\n\nint main(int, char*[])\n{\n  // Note - this generates 50 points and a single poly-vertex cell.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(50);\n  pointSource->Update();\n\n  std::cout << \"There are \" << pointSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n\n  vtkNew<vtkSelectionSource> selectionSource;\n  selectionSource->SetFieldType(vtkSelectionNode::POINT);\n  selectionSource->SetContentType(vtkSelectionNode::INDICES);\n\n  // Without this line, all points are passed through because the 11 points\n  // we will select below are some of the points of the poly-vertex created\n  // by the PointSource, so the cell (by default) gets passed through since\n  // it contains some selected points, so therefore all of the points\n  // (the 50 belonging to the poly-vertex) also get passed through, which\n  // is not what we are trying to demonstrate.\n  selectionSource->SetContainingCells(false);\n\n  for (vtkIdType i = 10; i <= 20; i++)\n  {\n    selectionSource->AddID(0, i);\n  }\n\n  selectionSource->Update();\n\n  vtkNew<vtkExtractSelection> extractSelection;\n  extractSelection->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelection->SetInputConnection(1, selectionSource->GetOutputPort());\n  extractSelection->Update();\n\n  vtkDataSet* ds = dynamic_cast<vtkDataSet*>(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << ds->GetNumberOfPoints() << \" output points.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/SelectionSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectionSource)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectionSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectionSource MACOSX_BUNDLE SelectionSource.cxx )\n  target_link_libraries(SelectionSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectionSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/SelectionSource/#download-and-build-selectionsource","title":"Download and Build SelectionSource","text":"

        Click here to download SelectionSource and its CMakeLists.txt file. Once the tarball SelectionSource.tar has been downloaded and extracted,

        cd SelectionSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SelectionSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPoints/","title":"SurfaceFromUnorganizedPoints","text":"

        vtk-examples/Cxx/Filtering/SurfaceFromUnorganizedPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPoints/#description","title":"Description","text":"

        This example creates points on a sphere and then finds the surface through the points. If an optional polydata file is provided, the example operates on the points in that polydata.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPoints/#code","title":"Code","text":"

        SurfaceFromUnorganizedPoints.cxx

        #include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkReverseSense.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSurfaceReconstructionFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  auto input = vtkSmartPointer<vtkPolyData>::New();\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    input = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n    input = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(input->GetPoints());\n\n  // Construct the surface and create isosurface.\n  vtkNew<vtkSurfaceReconstructionFilter> surf;\n  surf->SetInputData(polydata);\n\n  vtkNew<vtkContourFilter> cf;\n  cf->SetInputConnection(surf->GetOutputPort());\n  cf->SetValue(0, 0.0);\n\n  // Sometimes the contouring algorithm can create a volume whose gradient\n  // vector and ordering of polygon (using the right hand rule) are\n  // inconsistent. vtkReverseSense cures this problem.\n  vtkNew<vtkReverseSense> reverse;\n  reverse->SetInputConnection(cf->GetOutputPort());\n  reverse->ReverseCellsOn();\n  reverse->ReverseNormalsOn();\n\n  vtkNew<vtkPolyDataMapper> map;\n  map->SetInputConnection(reverse->GetOutputPort());\n  map->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(map);\n  surfaceActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  surfaceActor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"Seashell\").GetData());\n  surfaceActor->GetProperty()->SetSpecular(.4);\n  surfaceActor->GetProperty()->SetSpecularPower(50);\n\n  // Create the RenderWindow, Renderer and both Actors\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size.\n  renderer->AddActor(surfaceActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  renderWindow->SetWindowName(\"SurfaceFromUnorganizedPoints\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SurfaceFromUnorganizedPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SurfaceFromUnorganizedPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SurfaceFromUnorganizedPoints MACOSX_BUNDLE SurfaceFromUnorganizedPoints.cxx )\n  target_link_libraries(SurfaceFromUnorganizedPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SurfaceFromUnorganizedPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPoints/#download-and-build-surfacefromunorganizedpoints","title":"Download and Build SurfaceFromUnorganizedPoints","text":"

        Click here to download SurfaceFromUnorganizedPoints and its CMakeLists.txt file. Once the tarball SurfaceFromUnorganizedPoints.tar has been downloaded and extracted,

        cd SurfaceFromUnorganizedPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SurfaceFromUnorganizedPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/","title":"SurfaceFromUnorganizedPointsWithPostProc","text":"

        vtk-examples/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/#description","title":"Description","text":"

        This example is an extension to the example previously posted at: Create a surface from Unorganized Points

        The objective is again to use vtkSurfaceReconstructionFilter to construct a surface from a set of points. However, the direct output of the vtkSurfaceReconstructionFilter does not match with the spatial position of the original point set. Instead, there is a scale change and translation in between. To cure this, in this example we added a post transformation to move the reconstructed surface back to the position of the original points, which in some cases might be more favorable.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/#code","title":"Code","text":"

        SurfaceFromUnorganizedPointsWithPostProc.cxx

        #include <cmath>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkReverseSense.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSurfaceReconstructionFilter.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\nstatic vtkSmartPointer<vtkPolyData>\ntransform_back(vtkSmartPointer<vtkPoints> pt, vtkSmartPointer<vtkPolyData> pd);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  auto input = vtkSmartPointer<vtkPolyData>::New();\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    input = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n    input = sphereSource->GetOutput();\n  }\n  // Read some points\n  // vtkNew<vtkPoints points;\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(input->GetPoints());\n\n  // Construct the surface and create isosurface.\n  vtkNew<vtkSurfaceReconstructionFilter> surf;\n  surf->SetInputData(polydata);\n\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetInputConnection(surf->GetOutputPort());\n  contourFilter->SetValue(0, 0.0);\n\n  // Sometimes the contouring algorithm can create a volume whose gradient\n  // vector and ordering of polygon (using the right hand rule) are\n  // inconsistent. vtkReverseSense cures this problem.\n  vtkNew<vtkReverseSense> reverse;\n  reverse->SetInputConnection(contourFilter->GetOutputPort());\n  reverse->ReverseCellsOn();\n  reverse->ReverseNormalsOn();\n  reverse->Update();\n\n  // auto newSurf = transform_back(points, reverse->GetOutput());\n\n  vtkNew<vtkPolyDataMapper> map;\n  map->SetInputConnection(reverse->GetOutputPort());\n  map->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(map);\n  surfaceActor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  surfaceActor->GetProperty()->SetSpecularColor(\n      namedColors->GetColor3d(\"Seashell\").GetData());\n  surfaceActor->GetProperty()->SetSpecular(.4);\n  surfaceActor->GetProperty()->SetSpecularPower(50);\n\n  // Create the RenderWindow, Renderer and both Actors\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(surfaceActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"Burlywood\").GetData());\n  renderWindow->SetSize(640, 480);\n\n  interactor->Initialize();\n  renderWindow->SetWindowName(\"SurfaceFromUnorganizedPointsWithPostProc\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> transform_back(vtkSmartPointer<vtkPoints> pt,\n                                            vtkSmartPointer<vtkPolyData> pd)\n{\n  // The reconstructed surface is transformed back to where the\n  // original points are. (Hopefully) it is only a similarity\n  // transformation.\n\n  // 1. Get bounding box of pt, get its minimum corner (left, bottom, least-z),\n  // at c0, pt_bounds\n\n  // 2. Get bounding box of surface pd, get its minimum corner (left, bottom,\n  // least-z), at c1, pd_bounds\n\n  // 3. compute scale as:\n  //       scale = (pt_bounds[1] - pt_bounds[0])/(pd_bounds[1] - pd_bounds[0]);\n\n  // 4. transform the surface by T := T(pt_bounds[0], [2],\n  // [4]).S(scale).T(-pd_bounds[0], -[2], -[4])\n\n  // 1.\n  double pt_bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax)\n  pt->GetBounds(pt_bounds);\n\n  // 2.\n  double pd_bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax)\n  pd->GetBounds(pd_bounds);\n\n  //   // test, make sure it is isotropic\n  //   std::cout<<(pt_bounds[1] - pt_bounds[0])/(pd_bounds[1] -\n  //   pd_bounds[0])<<std::endl; std::cout<<(pt_bounds[3] -\n  //   pt_bounds[2])/(pd_bounds[3] - pd_bounds[2])<<std::endl;\n  //   std::cout<<(pt_bounds[5] - pt_bounds[4])/(pd_bounds[5] -\n  //   pd_bounds[4])<<std::endl;\n  //   // TEST\n\n  // 3\n  double scale = (pt_bounds[1] - pt_bounds[0]) / (pd_bounds[1] - pd_bounds[0]);\n\n  // 4.\n  vtkSmartPointer<vtkTransform> transp;\n  transp->Translate(pt_bounds[0], pt_bounds[2], pt_bounds[4]);\n  transp->Scale(scale, scale, scale);\n  transp->Translate(-pd_bounds[0], -pd_bounds[2], -pd_bounds[4]);\n\n  auto tpd = vtkSmartPointer<vtkTransformPolyDataFilter>::New();\n\n  tpd->SetInputData(pd);\n  tpd->SetTransform(transp);\n  tpd->Update();\n\n  return tpd->GetOutput();\n}\n} // namespace\n
        "},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SurfaceFromUnorganizedPointsWithPostProc)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SurfaceFromUnorganizedPointsWithPostProc: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SurfaceFromUnorganizedPointsWithPostProc MACOSX_BUNDLE SurfaceFromUnorganizedPointsWithPostProc.cxx )\n  target_link_libraries(SurfaceFromUnorganizedPointsWithPostProc PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SurfaceFromUnorganizedPointsWithPostProc\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/#download-and-build-surfacefromunorganizedpointswithpostproc","title":"Download and Build SurfaceFromUnorganizedPointsWithPostProc","text":"

        Click here to download SurfaceFromUnorganizedPointsWithPostProc and its CMakeLists.txt file. Once the tarball SurfaceFromUnorganizedPointsWithPostProc.tar has been downloaded and extracted,

        cd SurfaceFromUnorganizedPointsWithPostProc/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SurfaceFromUnorganizedPointsWithPostProc\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/TransformPolyData/","title":"TransformPolyData","text":"

        vtk-examples/Cxx/Filtering/TransformPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/TransformPolyData/#description","title":"Description","text":"

        This example demonstrates how to apply a transform to a data set. It uses vtkTransformPolyDataFilter, but it can be replaced with vtkTransformFilter for different types of data sets, including vtkUnstructuredGrid and vtkStructuredGrid. vtkTransformFilter will work with vtkPolyData, too).

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/TransformPolyData/#code","title":"Code","text":"

        TransformPolyData.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the polydata geometry\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Set up the actor to display the untransformed polydata\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n\n  // Set up the transform filter\n\n  vtkNew<vtkTransform> translation;\n  translation->Translate(1.0, 2.0, 3.0);\n\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(sphereSource->GetOutputPort());\n  transformFilter->SetTransform(translation);\n  transformFilter->Update();\n\n  // Set up the actor to display the transformed polydata\n\n  vtkNew<vtkPolyDataMapper> transformedMapper;\n  transformedMapper->SetInputConnection(transformFilter->GetOutputPort());\n\n  vtkNew<vtkActor> transformedActor;\n  transformedActor->SetMapper(transformedMapper);\n  transformedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Red\").GetData());\n\n  // Set up the rest of the visualization pipeline\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(originalActor);\n  renderer->AddActor(transformedActor);\n  renderer->SetBackground(colors->GetColor3d(\"Green\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetWindowName(\"TransformPolyData\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/TransformPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformPolyData MACOSX_BUNDLE TransformPolyData.cxx )\n  target_link_libraries(TransformPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/TransformPolyData/#download-and-build-transformpolydata","title":"Download and Build TransformPolyData","text":"

        Click here to download TransformPolyData and its CMakeLists.txt file. Once the tarball TransformPolyData.tar has been downloaded and extracted,

        cd TransformPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TransformPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/TriangulateTerrainMap/","title":"TriangulateTerrainMap","text":"

        vtk-examples/Cxx/Filtering/TriangulateTerrainMap

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/TriangulateTerrainMap/#description","title":"Description","text":"

        This example generates heights (z-values) on a 10x10 grid (a terrain map) and triangulates the points.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/TriangulateTerrainMap/#code","title":"Code","text":"

        TriangulateTerrainMap.cxx

        #include <vtkActor.h>\n#include <vtkDelaunay2D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create points on an XY grid with random Z coordinate.\n  vtkNew<vtkPoints> points;\n\n  unsigned int gridSize = 10;\n  unsigned int seed = 0;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->Initialize(seed);\n  for (unsigned int x = 0; x < gridSize; x++)\n  {\n    for (unsigned int y = 0; y < gridSize; y++)\n    {\n      auto d = randomSequence->GetValue();\n      randomSequence->Next();\n      points->InsertNextPoint(x, y, d * 3.0);\n    }\n  }\n\n  // Add the grid points to a polydata object\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n  glyphFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetPointSize(3);\n  pointsActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  // Triangulate the grid points\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(polydata);\n  delaunay->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> triangulatedMapper;\n  triangulatedMapper->SetInputConnection(delaunay->GetOutputPort());\n\n  vtkNew<vtkActor> triangulatedActor;\n  triangulatedActor->SetMapper(triangulatedMapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(triangulatedActor);\n  renderer->SetBackground(colors->GetColor3d(\"Green\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"TriangulateTerrainMap\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/TriangulateTerrainMap/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TriangulateTerrainMap)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TriangulateTerrainMap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TriangulateTerrainMap MACOSX_BUNDLE TriangulateTerrainMap.cxx )\n  target_link_libraries(TriangulateTerrainMap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TriangulateTerrainMap\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/TriangulateTerrainMap/#download-and-build-triangulateterrainmap","title":"Download and Build TriangulateTerrainMap","text":"

        Click here to download TriangulateTerrainMap and its CMakeLists.txt file. Once the tarball TriangulateTerrainMap.tar has been downloaded and extracted,

        cd TriangulateTerrainMap/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TriangulateTerrainMap\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/VectorFieldNonZeroExtraction/","title":"VectorFieldNonZeroExtraction","text":"

        vtk-examples/Cxx/Filtering/VectorFieldNonZeroExtraction

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/VectorFieldNonZeroExtraction/#code","title":"Code","text":"

        VectorFieldNonZeroExtraction.cxx

        // #include <vtkDataArray.h>\n// #include <vtkFloatArray.h>\n#include <vtkImageData.h>\n#include <vtkImageMagnitude.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkThresholdPoints.h>\n#include <vtkXMLImageDataWriter.h>\n#include <vtkXMLPolyDataWriter.h>\n\nnamespace {\nvoid CreateVectorField(vtkImageData* image);\nvoid WriteImage(vtkImageData* image, const std::string& fileName);\nvoid WriteVectorField(vtkPolyData* vectorField, const std::string& fileName);\n} // namespace\n\nint main(int, char*[])\n{\n  // Create an image\n  vtkNew<vtkImageData> image;\n  CreateVectorField(image);\n\n  vtkNew<vtkImageMagnitude> magnitudeFilter;\n  magnitudeFilter->SetInputData(image);\n  magnitudeFilter->Update(); // This filter produces a vtkImageData with an\n                             // array named \"Magnitude\".\n\n  image->GetPointData()->AddArray(\n      magnitudeFilter->GetOutput()->GetPointData()->GetScalars());\n  image->GetPointData()->SetActiveScalars(\"Magnitude\");\n\n  vtkNew<vtkThresholdPoints> thresholdPoints;\n  // thresholdPoints->SetInputConnection(magnitudeFilter->GetOutputPort());\n  thresholdPoints->SetInputData(image);\n  thresholdPoints->ThresholdByUpper(.05);\n  thresholdPoints->Update();\n\n  WriteImage(image, \"input.vti\");\n  WriteVectorField(thresholdPoints->GetOutput(), \"output.vtp\");\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateVectorField(vtkImageData* image)\n{\n  // Specify the size of the image data\n  image->SetDimensions(50, 50, 1);\n  image->AllocateScalars(VTK_FLOAT, 3);\n\n  int* dims = image->GetDimensions();\n\n  // Zero the image\n  for (auto y = 0; y < dims[1]; y++)\n  {\n    for (auto x = 0; x < dims[0]; x++)\n    {\n      float* pixel = static_cast<float*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = 0.0;\n      pixel[1] = 0.0;\n      pixel[2] = 0.0;\n    }\n  }\n\n  // Set two of the pixels to non zero values\n  float* pixel = static_cast<float*>(image->GetScalarPointer(20, 20, 0));\n  pixel[0] = -10.0;\n  pixel[1] = 5.0;\n  pixel[2] = 0.0;\n\n  pixel = static_cast<float*>(image->GetScalarPointer(30, 30, 0));\n  pixel[0] = 10.0;\n  pixel[1] = 10.0;\n  pixel[2] = 0.0;\n\n  image->GetPointData()->SetActiveVectors(\"ImageScalars\");\n\n  image->Modified();\n}\n\nvoid WriteVectorField(vtkPolyData* vectorField, const std::string& fileName)\n{\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(fileName.c_str());\n  writer->SetInputData(vectorField);\n  writer->Write();\n}\n\nvoid WriteImage(vtkImageData* image, const std::string& fileName)\n{\n  vtkNew<vtkXMLImageDataWriter> writer;\n  writer->SetFileName(fileName.c_str());\n  writer->SetInputData(image);\n  writer->Write();\n}\n\n} // namespace\n
        "},{"location":"Cxx/Filtering/VectorFieldNonZeroExtraction/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorFieldNonZeroExtraction)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  ImagingMath\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorFieldNonZeroExtraction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorFieldNonZeroExtraction MACOSX_BUNDLE VectorFieldNonZeroExtraction.cxx )\n  target_link_libraries(VectorFieldNonZeroExtraction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorFieldNonZeroExtraction\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/VectorFieldNonZeroExtraction/#download-and-build-vectorfieldnonzeroextraction","title":"Download and Build VectorFieldNonZeroExtraction","text":"

        Click here to download VectorFieldNonZeroExtraction and its CMakeLists.txt file. Once the tarball VectorFieldNonZeroExtraction.tar has been downloaded and extracted,

        cd VectorFieldNonZeroExtraction/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VectorFieldNonZeroExtraction\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/VertexGlyphFilter/","title":"VertexGlyphFilter","text":"

        vtk-examples/Cxx/Filtering/VertexGlyphFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Filtering/VertexGlyphFilter/#description","title":"Description","text":"

        This example creates a set of points and adds a vertex at each point using vtkVertexGlyphFilter.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/VertexGlyphFilter/#code","title":"Code","text":"

        VertexGlyphFilter.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n  namedColors->SetColor(\"Bkg\", 0.3, 0.6, 0.3);\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(2, 2, 2);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->AddInputData(polydata);\n  vertexGlyphFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(10);\n  actor->GetProperty()->SetColor(namedColors->GetColor3d(\"Yellow\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"Green\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"VertexGlyphFilter\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/VertexGlyphFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VertexGlyphFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VertexGlyphFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VertexGlyphFilter MACOSX_BUNDLE VertexGlyphFilter.cxx )\n  target_link_libraries(VertexGlyphFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VertexGlyphFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/VertexGlyphFilter/#download-and-build-vertexglyphfilter","title":"Download and Build VertexGlyphFilter","text":"

        Click here to download VertexGlyphFilter and its CMakeLists.txt file. Once the tarball VertexGlyphFilter.tar has been downloaded and extracted,

        cd VertexGlyphFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VertexGlyphFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Filtering/WarpTo/","title":"WarpTo","text":"

        vtk-examples/Cxx/Filtering/WarpTo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Filtering/WarpTo/#code","title":"Code","text":"

        WarpTo.cxx

        #include <vtkDataSetMapper.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n#include <vtkWarpTo.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create the RenderWindow, Renderer and both Actors.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create a line\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(0.0, 0.0, 0.0);\n  lineSource->SetPoint2(0.0, 1.0, 0.0);\n  lineSource->SetResolution(20);\n  lineSource->Update();\n\n  // Create a tube (cylinder) around the line.\n  vtkNew<vtkTubeFilter> tubeFilter;\n  tubeFilter->SetInputConnection(lineSource->GetOutputPort());\n  tubeFilter->SetRadius(.01); // default is .5\n  tubeFilter->SetNumberOfSides(50);\n  tubeFilter->Update();\n\n  vtkNew<vtkWarpTo> warpTo;\n  warpTo->SetInputConnection(tubeFilter->GetOutputPort());\n  warpTo->SetPosition(10, 1, 0);\n  warpTo->SetScaleFactor(5);\n  warpTo->AbsoluteOn();\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(warpTo->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(namedColors->GetColor3d(\"Gold\").GetData());\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"Green\").GetData());\n\n  renderWindow->SetWindowName(\"WarpTo\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Filtering/WarpTo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WarpTo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WarpTo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WarpTo MACOSX_BUNDLE WarpTo.cxx )\n  target_link_libraries(WarpTo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WarpTo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Filtering/WarpTo/#download-and-build-warpto","title":"Download and Build WarpTo","text":"

        Click here to download WarpTo and its CMakeLists.txt file. Once the tarball WarpTo.tar has been downloaded and extracted,

        cd WarpTo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WarpTo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Arrow/","title":"Arrow","text":"

        vtk-examples/Cxx/GeometricObjects/Arrow

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Arrow/#description","title":"Description","text":"

        vtkArrowSource object appends a cylinder to a cone to form an arrow.

        The shaft base is always at (0,0,0). The arrow tip is always at (1,0,0). If \"Invert\" is true, then the ends are flipped i.e. tip is at (0,0,0) while base is at (1, 0, 0).

        The resolution of the cone and shaft can be set and default to 6.

        The radius of the cone and shaft can be set and default to 0.03 and 0.1. The length of the tip can also be set, and defaults to 0.35.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Arrow/#code","title":"Code","text":"

        Arrow.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n  // arrowSource->SetShaftRadius(1.0);\n  // arrowSource->SetTipLength(1.0);\n  arrowSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(arrowSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Arrow\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindow->SetWindowName(\"Arrow\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Arrow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Arrow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Arrow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Arrow MACOSX_BUNDLE Arrow.cxx )\n  target_link_libraries(Arrow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Arrow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Arrow/#download-and-build-arrow","title":"Download and Build Arrow","text":"

        Click here to download Arrow and its CMakeLists.txt file. Once the tarball Arrow.tar has been downloaded and extracted,

        cd Arrow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Arrow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Axes/","title":"Axes","text":"

        vtk-examples/Cxx/GeometricObjects/Axes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Axes/#description","title":"Description","text":"

        This example shows how to position an vtkAxesActor in 3D. Notice that position and orientation of the vtkAxesActor is done with a user transform.

        Seealso

        DisplayCoordinateAxes.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Axes/#code","title":"Code","text":"

        Axes.cxx

        #include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(0.5);\n\n  // create a mapper\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // create an actor\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n\n  // a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Axes\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(300, 300);\n\n  // an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // add the actors to the scene\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(1.0, 0.0, 0.0);\n\n  vtkNew<vtkAxesActor> axes;\n\n  // The axes are positioned with a user transform\n  axes->SetUserTransform(transform);\n\n  // properties of the axes labels can be set as follows\n  // this sets the x axis label to red\n  // axes->GetXAxisCaptionActor2D()->GetCaptionTextProperty()->SetColor(\n  //  colors->GetColor3d(\"Red\").GetData());\n\n  // the actual text of the axis label can be changed:\n  // axes->SetXAxisLabelText(\"test\");\n\n  renderer->AddActor(axes);\n\n  renderer->GetActiveCamera()->Azimuth(50);\n  renderer->GetActiveCamera()->Elevation(-30);\n\n  renderer->ResetCamera();\n  renderWindow->SetWindowName(\"Axes\");\n  renderWindow->Render();\n\n  // begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Axes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Axes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Axes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Axes MACOSX_BUNDLE Axes.cxx )\n  target_link_libraries(Axes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Axes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Axes/#download-and-build-axes","title":"Download and Build Axes","text":"

        Click here to download Axes and its CMakeLists.txt file. Once the tarball Axes.tar has been downloaded and extracted,

        cd Axes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Axes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Cell3DDemonstration/","title":"Cell3DDemonstration","text":"

        vtk-examples/Cxx/GeometricObjects/Cell3DDemonstration

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Cell3DDemonstration/#description","title":"Description","text":"

        This is a demonstration of how to construct and display geometric objects using the classes derived from vtkCell3D. For each object we specify the points and cell Ids.

        From this we create an unstructured grid. In some cases a vtkCellArray is used and the result is added to the unstructured grid, see: MakePolyhedron() and MakeTetrahedron().

        Also demonstrated is the use of vectors to hold the unstructured grids, mappers, actors and renderers.

        The resultant objects are then displayed in a grid.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Cell3DDemonstration/#code","title":"Code","text":"

        Cell3DDemonstration.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkHexagonalPrism.h>\n#include <vtkHexahedron.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPentagonalPrism.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkPyramid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTetra.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVoxel.h>\n#include <vtkWedge.h>\n\n#include <array>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\nnamespace {\n// These functions return a vtkUnstructured grid corresponding to the object.\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexagonalPrism();\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexahedron();\nvtkSmartPointer<vtkUnstructuredGrid> MakePentagonalPrism();\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyhedron();\nvtkSmartPointer<vtkUnstructuredGrid> MakePyramid();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTetrahedron();\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeVoxel();\nvtkSmartPointer<vtkUnstructuredGrid> MakeWedge();\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  std::vector<std::string> titles;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n\n  std::vector<vtkSmartPointer<vtkUnstructuredGrid>> uGrids;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  uGrids.push_back(MakeHexagonalPrism());\n  titles.push_back(\"Hexagonal Prism\");\n  uGrids.push_back(MakeHexahedron());\n  titles.push_back(\"Hexahedron\");\n  uGrids.push_back(MakePentagonalPrism());\n  titles.push_back(\"Pentagonal Prism\");\n\n  uGrids.push_back(MakePolyhedron());\n  titles.push_back(\"Polyhedron\");\n  uGrids.push_back(MakePyramid());\n  titles.push_back(\"Pyramid\");\n  uGrids.push_back(MakeTetrahedron());\n  titles.push_back(\"Tetrahedron\");\n\n  uGrids.push_back(MakeVoxel());\n  titles.push_back(\"Voxel\");\n  uGrids.push_back(MakeWedge());\n  titles.push_back(\"Wedge\");\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"Cell3D Demonstration\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // Create and link the mappers actors and renderers together.\n  for (unsigned int i = 0; i < uGrids.size(); ++i)\n  {\n    textMappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textActors.push_back(vtkSmartPointer<vtkActor2D>::New());\n\n    mappers.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    mappers[i]->SetInputData(uGrids[i]);\n\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(\n        colors->GetColor3d(\"PeachPuff\").GetData());\n\n    renderers[i]->AddViewProp(actors[i]);\n\n    textMappers[i]->SetInput(titles[i].c_str());\n    textMappers[i]->SetTextProperty(textProperty);\n\n    textActors[i]->SetMapper(textMappers[i]);\n    textActors[i]->SetPosition(120, 16);\n    renderers[i]->AddViewProp(textActors[i]);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  int gridDimensions = 3;\n  int rendererSize = 300;\n\n  renWin->SetSize(rendererSize * gridDimensions, rendererSize * gridDimensions);\n\n  for (int row = 0; row < gridDimensions; row++)\n  {\n    for (int col = 0; col < gridDimensions; col++)\n    {\n      int index = row * gridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (gridDimensions * rendererSize),\n                            static_cast<double>(gridDimensions - (row + 1)) *\n                                rendererSize / (gridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (gridDimensions * rendererSize),\n                            static_cast<double>(gridDimensions - row) *\n                                rendererSize / (gridDimensions * rendererSize)};\n\n      if (index > int(actors.size()) - 1)\n      {\n        // Add a renderer even if there is no actor.\n        // This makes the render window background all the same color.\n        vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();\n        ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n        ren->SetViewport(viewport);\n        renWin->AddRenderer(ren);\n        continue;\n      }\n\n      renderers[index]->SetViewport(viewport);\n      renderers[index]->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(-30);\n      renderers[index]->GetActiveCamera()->Zoom(0.85);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  iRen->Initialize();\n\n  renWin->SetWindowName(\"Cell3DDemonstration\");\n  renWin->Render();\n\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexagonalPrism()\n{\n  // 3D: hexagonal prism: a wedge with an hexagonal base.\n  // Be careful, the base face ordering is different from wedge.\n\n  int numberOfVertices = 12;\n\n  vtkNew<vtkPoints> points;\n\n  points->InsertNextPoint(0.0, 0.0, 1.0);\n  points->InsertNextPoint(1.0, 0.0, 1.0);\n  points->InsertNextPoint(1.5, 0.5, 1.0);\n  points->InsertNextPoint(1.0, 1.0, 1.0);\n  points->InsertNextPoint(0.0, 1.0, 1.0);\n  points->InsertNextPoint(-0.5, 0.5, 1.0);\n\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.5, 0.5, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(-0.5, 0.5, 0.0);\n\n  vtkNew<vtkHexagonalPrism> hexagonalPrism;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    hexagonalPrism->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->InsertNextCell(hexagonalPrism->GetCellType(),\n                     hexagonalPrism->GetPointIds());\n  ug->SetPoints(points);\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexahedron()\n{\n  // A regular hexagon (cube) with all faces square and three squares around\n  // each vertex is created below.\n\n  // Setup the coordinates of eight points\n  // (the two faces must be in counter clockwise\n  // order as viewed from the outside).\n\n  // As an exercise you can modify the coordinates of the points to create\n  // seven topologically distinct convex hexahedras.\n\n  int numberOfVertices = 8;\n\n  // Create the points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 1.0);\n  points->InsertNextPoint(1.0, 0.0, 1.0);\n  points->InsertNextPoint(1.0, 1.0, 1.0);\n  points->InsertNextPoint(0.0, 1.0, 1.0);\n\n  // Create a hexahedron from the points\n  vtkNew<vtkHexahedron> hex;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    hex->GetPointIds()->SetId(i, i);\n  }\n\n  // Add the points and hexahedron to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(hex->GetCellType(), hex->GetPointIds());\n\n  return uGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePentagonalPrism()\n{\n\n  int numberOfVertices = 10;\n\n  // Create the points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(11, 10, 10);\n  points->InsertNextPoint(13, 10, 10);\n  points->InsertNextPoint(14, 12, 10);\n  points->InsertNextPoint(12, 14, 10);\n  points->InsertNextPoint(10, 12, 10);\n  points->InsertNextPoint(11, 10, 14);\n  points->InsertNextPoint(13, 10, 14);\n  points->InsertNextPoint(14, 12, 14);\n  points->InsertNextPoint(12, 14, 14);\n  points->InsertNextPoint(10, 12, 14);\n\n  // Pentagonal Prism\n  vtkNew<vtkPentagonalPrism> pentagonalPrism;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    pentagonalPrism->GetPointIds()->SetId(i, i);\n  }\n\n  // Add the points and hexahedron to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(pentagonalPrism->GetCellType(),\n                        pentagonalPrism->GetPointIds());\n\n  return uGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyhedron()\n{\n\n  // Make a regular dodecahedron. It consists of twelve regular pentagonal\n  // faces with three faces meeting at each vertex.\n  int numberOfVertices = 20;\n  int numberOfFaces = 12;\n  int numberOfFaceVertices = 5;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.21412, 0, 1.58931);\n  points->InsertNextPoint(0.375185, 1.1547, 1.58931);\n  points->InsertNextPoint(-0.982247, 0.713644, 1.58931);\n  points->InsertNextPoint(-0.982247, -0.713644, 1.58931);\n  points->InsertNextPoint(0.375185, -1.1547, 1.58931);\n  points->InsertNextPoint(1.96449, 0, 0.375185);\n  points->InsertNextPoint(0.607062, 1.86835, 0.375185);\n  points->InsertNextPoint(-1.58931, 1.1547, 0.375185);\n  points->InsertNextPoint(-1.58931, -1.1547, 0.375185);\n  points->InsertNextPoint(0.607062, -1.86835, 0.375185);\n  points->InsertNextPoint(1.58931, 1.1547, -0.375185);\n  points->InsertNextPoint(-0.607062, 1.86835, -0.375185);\n  points->InsertNextPoint(-1.96449, 0, -0.375185);\n  points->InsertNextPoint(-0.607062, -1.86835, -0.375185);\n  points->InsertNextPoint(1.58931, -1.1547, -0.375185);\n  points->InsertNextPoint(0.982247, 0.713644, -1.58931);\n  points->InsertNextPoint(-0.375185, 1.1547, -1.58931);\n  points->InsertNextPoint(-1.21412, 0, -1.58931);\n  points->InsertNextPoint(-0.375185, -1.1547, -1.58931);\n  points->InsertNextPoint(0.982247, -0.713644, -1.58931);\n\n  vtkIdType dodechedronPointsIds[20] = {0,  1,  2,  3,  4,  5,  6,  7,  8,  9,\n                                        10, 11, 12, 13, 14, 15, 16, 17, 18, 19};\n\n  vtkIdType dodechedronFace[12][5] = {\n      {0, 1, 2, 3, 4},     {0, 5, 10, 6, 1},    {1, 6, 11, 7, 2},\n      {2, 7, 12, 8, 3},    {3, 8, 13, 9, 4},    {4, 9, 14, 5, 0},\n      {15, 10, 5, 14, 19}, {16, 11, 6, 10, 15}, {17, 12, 7, 11, 16},\n      {18, 13, 8, 12, 17}, {19, 14, 9, 13, 18}, {19, 18, 17, 16, 15}};\n\n  vtkNew<vtkIdList> dodechedronFaces;\n  for (int i = 0; i < numberOfFaces; i++)\n  {\n    dodechedronFaces->InsertNextId(numberOfFaceVertices);\n    for (int j = 0; j < numberOfFaceVertices; ++j)\n    {\n      dodechedronFaces->InsertNextId(dodechedronFace[i][j]);\n    }\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->InsertNextCell(VTK_POLYHEDRON, numberOfVertices, dodechedronPointsIds,\n                        numberOfFaces, dodechedronFaces->GetPointer(0));\n  uGrid->SetPoints(points);\n\n  return uGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePyramid()\n{\n  // Make a regular square pyramid.\n  int numberOfVertices = 5;\n\n  vtkNew<vtkPoints> points;\n  float p0[3] = {1.0, 1.0, 0.0};\n  float p1[3] = {-1.0, 1.0, 0.0};\n  float p2[3] = {-1.0, -1.0, 0.0};\n  float p3[3] = {1.0, -1.0, 0.0};\n  float p4[3] = {0.0, 0.0, 1.0};\n\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n  points->InsertNextPoint(p4);\n\n  vtkNew<vtkPyramid> pyramid;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    pyramid->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(pyramid->GetCellType(), pyramid->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTetrahedron()\n{\n  // Make a tetrahedron.\n  int numberOfVertices = 4;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 1);\n\n  vtkSmartPointer<vtkTetra> tetra = vtkSmartPointer<vtkTetra>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    tetra->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkCellArray> cellArray;\n  cellArray->InsertNextCell(tetra);\n\n  vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  unstructuredGrid->SetPoints(points);\n  unstructuredGrid->SetCells(VTK_TETRA, cellArray);\n\n  return unstructuredGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeVoxel()\n{\n  // A voxel is a representation of a regular grid in 3-D space.\n  int numberOfVertices = 8;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, 1);\n  points->InsertNextPoint(0, 1, 1);\n  points->InsertNextPoint(1, 1, 1);\n\n  vtkNew<vtkVoxel> voxel;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    voxel->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(voxel->GetCellType(), voxel->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeWedge()\n{\n\n  // A wedge consists of two triangular ends and three rectangular faces.\n\n  int numberOfVertices = 6;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0, .5, .5);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(1, 0.0, 0.0);\n  points->InsertNextPoint(1, .5, .5);\n\n  vtkNew<vtkWedge> wedge;\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    wedge->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(wedge->GetCellType(), wedge->GetPointIds());\n\n  return ug;\n}\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/Cell3DDemonstration/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cell3DDemonstration)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cell3DDemonstration: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cell3DDemonstration MACOSX_BUNDLE Cell3DDemonstration.cxx )\n  target_link_libraries(Cell3DDemonstration PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cell3DDemonstration\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Cell3DDemonstration/#download-and-build-cell3ddemonstration","title":"Download and Build Cell3DDemonstration","text":"

        Click here to download Cell3DDemonstration and its CMakeLists.txt file. Once the tarball Cell3DDemonstration.tar has been downloaded and extracted,

        cd Cell3DDemonstration/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cell3DDemonstration\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/CellTypeSource/","title":"CellTypeSource","text":"

        vtk-examples/Cxx/GeometricObjects/CellTypeSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/CellTypeSource/#description","title":"Description","text":"

        This example uses [vtkCell](https://www.vtk.org/doc/nightly/html/classvtkCell.html#details)TypeSource to generate a vtkUnstructuredGrid. If a cell does not fill a rectangular area or volume, then multiple cells will be generated. For example, a vtkTetra requires 12 cells to fill a cube. A vtkTriangle requires two cells to fill a square. [vtkCell](https://www.vtk.org/doc/nightly/html/classvtkCell.html#details)TypeSource generates a uniform set of coordinates. The example perturbs those coordinates to illustrate the results of the vtkTessellatorFilter. Also, each cell is passed through vtkShrinkFilter to help identify the cells. Each generated cell also has a unique color.

        The example takes an optional argument, a vtkCell name.

        For example, to generate vtkTriangles, run

        CellTypeSource [vtkTriangle](https://www.vtk.org/doc/nightly/html/classvtkTriangle.html#details)\n

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/CellTypeSource/#code","title":"Code","text":"

        CellTypeSource.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellTypeSource.h>\n#include <vtkCellTypes.h>\n#include <vtkColorSeries.h>\n#include <vtkDataSetMapper.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkTessellatorFilter.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <map>\n\nint main(int argc, char* argv[])\n{\n  std::string cellName = \"vtkTetra\";\n  if (argc > 1)\n  {\n    cellName = std::string(argv[1]);\n  }\n\n  // Store cell class names in a map\n  std::map<std::string, int> cellMap;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_LINE)] = VTK_LINE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_EDGE)] =\n      VTK_QUADRATIC_EDGE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_CUBIC_LINE)] =\n      VTK_CUBIC_LINE;\n\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_TRIANGLE)] = VTK_TRIANGLE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_TRIANGLE)] =\n      VTK_QUADRATIC_TRIANGLE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUAD)] = VTK_QUAD;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_QUAD)] =\n      VTK_QUADRATIC_QUAD;\n\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_TETRA)] = VTK_TETRA;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_HEXAHEDRON)] =\n      VTK_HEXAHEDRON;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_WEDGE)] = VTK_WEDGE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_PYRAMID)] = VTK_PYRAMID;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_WEDGE)] =\n      VTK_QUADRATIC_WEDGE;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_PYRAMID)] =\n      VTK_QUADRATIC_PYRAMID;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_HEXAHEDRON)] =\n      VTK_QUADRATIC_HEXAHEDRON;\n  cellMap[vtkCellTypes::GetClassNameFromTypeId(VTK_QUADRATIC_TETRA)] =\n      VTK_QUADRATIC_TETRA;\n\n  if (cellMap.find(std::string(cellName)) == cellMap.end())\n  {\n    std::cout << \"Cell type \" << cellName << \" is not supported.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkCellTypeSource> source;\n  source->SetCellType(cellMap[cellName]);\n  source->Update();\n  std::cout << \"Cell: \" << cellName << std::endl;\n\n  vtkPoints* originalPoints = source->GetOutput()->GetPoints();\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(source->GetOutput()->GetNumberOfPoints());\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(5070); // for testing\n  for (auto i = 0; i < points->GetNumberOfPoints(); ++i)\n  {\n    double perturbation[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rng->Next();\n      perturbation[j] = rng->GetRangeValue(-0.1, 0.1);\n    }\n    double currentPoint[3];\n    originalPoints->GetPoint(i, currentPoint);\n    points->SetPoint(i, currentPoint[0] + perturbation[0],\n                     currentPoint[1] + perturbation[1],\n                     currentPoint[2] + perturbation[2]);\n  }\n  source->GetOutput()->SetPoints(points);\n\n  int numCells = source->GetOutput()->GetNumberOfCells();\n  std::cout << \"Number of cells: \" << numCells << std::endl;\n  vtkNew<vtkIntArray> idArray;\n  idArray->SetNumberOfTuples(numCells);\n  for (auto i = 0; i < numCells; ++i)\n  {\n    idArray->InsertTuple1(i, i + 1);\n  }\n  idArray->SetName(\"Ids\");\n  source->GetOutput()->GetCellData()->AddArray(idArray);\n  source->GetOutput()->GetCellData()->SetActiveScalars(\"Ids\");\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(source->GetOutputPort());\n  shrink->SetShrinkFactor(.8);\n\n  vtkNew<vtkTessellatorFilter> tessellate;\n  tessellate->SetInputConnection(shrink->GetOutputPort());\n  tessellate->SetMaximumNumberOfSubdivisions(3);\n\n  // Create a lookup table to map cell data to colors\n  vtkNew<vtkLookupTable> lut;\n\n  vtkNew<vtkColorSeries> colorSeries;\n  int seriesEnum = colorSeries->BREWER_QUALITATIVE_SET3;\n  ;\n  colorSeries->SetColorScheme(seriesEnum);\n  colorSeries->BuildLookupTable(lut, colorSeries->ORDINAL);\n\n  // Fill in a few known colors, the rest will be generated if needed\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetInputConnection(shrink->GetOutputPort());\n  mapper->SetScalarRange(0, numCells + 1);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarModeToUseCellData();\n  mapper->SetResolveCoincidentTopologyToPolygonOffset();\n  if (source->GetCellType() == VTK_QUADRATIC_PYRAMID ||\n      source->GetCellType() == VTK_QUADRATIC_WEDGE)\n  {\n    mapper->SetInputConnection(shrink->GetOutputPort());\n  }\n  else\n  {\n    mapper->SetInputConnection(tessellate->GetOutputPort());\n  }\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  //  actor->GetProperty()->SetLineWidth(3);\n\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(20);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"Lamp_Black\").GetData());\n\n  vtkNew<vtkTextMapper> textMapper;\n  textMapper->SetInput(cellName.c_str());\n  textMapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetPosition(320, 20);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"CellTypeSource\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddViewProp(textActor);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/CellTypeSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellTypeSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellTypeSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellTypeSource MACOSX_BUNDLE CellTypeSource.cxx )\n  target_link_libraries(CellTypeSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellTypeSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/CellTypeSource/#download-and-build-celltypesource","title":"Download and Build CellTypeSource","text":"

        Click here to download CellTypeSource and its CMakeLists.txt file. Once the tarball CellTypeSource.tar has been downloaded and extracted,

        cd CellTypeSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellTypeSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Circle/","title":"Circle","text":"

        vtk-examples/Cxx/GeometricObjects/Circle

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Circle/#description","title":"Description","text":"

        A circle is simply the limiting case of a regular polygon. We use vtkRegularPolygonSource with a large number of Sides to approximate a circle.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Circle/#code","title":"Code","text":"

        Circle.cxx

        // Classes specific to this example.\n#include <vtkPolyDataMapper.h>\n#include <vtkRegularPolygonSource.h>\n// Generic VTK pipeline elements.\n#include <vtkActor.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n// Auxiliary classes.\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a circle\n  vtkNew<vtkRegularPolygonSource> polygonSource;\n  // Comment this line to generate a disk instead of a circle.\n  polygonSource->GeneratePolygonOff();\n  polygonSource->SetNumberOfSides(50);\n  polygonSource->SetRadius(5);\n  polygonSource->SetCenter(0, 0, 0);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(polygonSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetWindowName(\"Circle\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Circle/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Circle)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Circle: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Circle MACOSX_BUNDLE Circle.cxx )\n  target_link_libraries(Circle PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Circle\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Circle/#download-and-build-circle","title":"Download and Build Circle","text":"

        Click here to download Circle and its CMakeLists.txt file. Once the tarball Circle.tar has been downloaded and extracted,

        cd Circle/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Circle\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/ColoredLines/","title":"ColoredLines","text":"

        vtk-examples/Cxx/GeometricObjects/ColoredLines

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/ColoredLines/#description","title":"Description","text":"

        Displays two lines, each with a different color.

        Seealso

        LongLine.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/ColoredLines/#code","title":"Code","text":"

        ColoredLines.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  // Create the polydata where we will store all the geometric data\n  vtkNew<vtkPolyData> linesPolyData;\n\n  // Create three points\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n\n  // Create a vtkPoints container and store the points in it.\n  vtkNew<vtkPoints> pts;\n  pts->InsertNextPoint(origin);\n  pts->InsertNextPoint(p0);\n  pts->InsertNextPoint(p1);\n\n  // Add the points to the polydata container.\n  linesPolyData->SetPoints(pts);\n\n  // Create the first line (between Origin and P0).\n  vtkNew<vtkLine> line0;\n  line0->GetPointIds()->SetId(\n      0,\n      0); // the second 0 is the index of the Origin in linesPolyData's points.\n  line0->GetPointIds()->SetId(\n      1, 1); // the second 1 is the index of P0 in linesPolyData's points.\n\n  // Create the second line (between Origin and P1).\n  vtkNew<vtkLine> line1;\n  line1->GetPointIds()->SetId(\n      0,\n      0); // the second 0 is the index of the Origin in linesPolyData's points.\n  line1->GetPointIds()->SetId(\n      1, 2); // 2 is the index of P1 in linesPolyData's points.\n\n  // Create a vtkCellArray container and store the lines in it.\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line0);\n  lines->InsertNextCell(line1);\n\n  // Add the lines to the polydata container.\n  linesPolyData->SetLines(lines);\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a vtkUnsignedCharArray container and store the colors in it.\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"Tomato\").GetData());\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"Mint\").GetData());\n\n  // Color the lines.\n  // SetScalars() automatically associates the values in the data array passed\n  // as parameter to the elements in the same indices of the cell data array on\n  // which it is called. This means the first component (red) of the colors\n  // array is matched with the first component of the cell array (line 0) and\n  // the second component (green) of the colors array is matched with the second\n  // component of the cell array (line 1).\n  linesPolyData->GetCellData()->SetScalars(colors);\n\n  // Setup the visualization pipeline.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(linesPolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetLineWidth(4);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->SetWindowName(\"Colored Lines\");\n  window->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n\n  // Visualize\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/ColoredLines/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColoredLines)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColoredLines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColoredLines MACOSX_BUNDLE ColoredLines.cxx )\n  target_link_libraries(ColoredLines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColoredLines\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/ColoredLines/#download-and-build-coloredlines","title":"Download and Build ColoredLines","text":"

        Click here to download ColoredLines and its CMakeLists.txt file. Once the tarball ColoredLines.tar has been downloaded and extracted,

        cd ColoredLines/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColoredLines\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Cone/","title":"Cone","text":"

        vtk-examples/Cxx/GeometricObjects/Cone

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Cone/#description","title":"Description","text":"

        vtkConeSource object creates a cone centered at a specified point and pointing in a specified direction. (By default, the center is the origin and the direction is the x-axis.)

        Depending upon the resolution of this object, different representations are created. If resolution=0 a line is created; if resolution=1, a single triangle is created; if resolution=2, two crossed triangles are created.

        For resolution > 2, a 3D cone (with resolution number of sides) is created.

        It also is possible to control whether the bottom of the cone is capped with a (resolution-sided) polygon, and to specify the height and radius of the cone.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Cone/#code","title":"Code","text":"

        Cone.cxx

        #include <vtkConeSource.h>\n#include <vtkNew.h>\n\n#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"bisque\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n\n  // Render and interact.\n  renderWindow->SetWindowName(\"Cone\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Cone/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cone)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cone: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cone MACOSX_BUNDLE Cone.cxx )\n  target_link_libraries(Cone PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cone\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Cone/#download-and-build-cone","title":"Download and Build Cone","text":"

        Click here to download Cone and its CMakeLists.txt file. Once the tarball Cone.tar has been downloaded and extracted,

        cd Cone/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cone\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/ConeDemo/","title":"ConeDemo","text":"

        vtk-examples/Cxx/GeometricObjects/ConeDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/ConeDemo/#description","title":"Description","text":"

        vtkConeSource object creates a cone centered at a specified point and pointing in a specified direction. (By default, the center is the origin and the direction is the x-axis.)

        Depending upon the resolution of this object, different representations are created. If resolution=0 a line is created; if resolution=1, a single triangle is created; if resolution=2, two crossed triangles are created.

        For resolution > 2, a 3D cone (with resolution number of sides) is created.

        It also is possible to control whether the bottom of the cone is capped with a (resolution-sided) polygon, and to specify the height and radius of the cone.

        The example shows cones with resolutions 0, 1, 2, and 3.

        Style

        This example collects all of the color definition in the beginning of the example. This makes it easier to make changes to the colors without having to search the code.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/ConeDemo/#code","title":"Code","text":"

        ConeDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Define all of the colors used in the example.\n  vtkColor3d backgroundColor = colors->GetColor3d(\"tan\");\n  vtkColor3d actorColor = colors->GetColor3d(\"orchid\");\n  vtkColor3d actorBackfaceColor = colors->GetColor3d(\"PowderBlue\");\n  vtkColor3d coneLineColor = colors->GetColor3d(\"Black\");\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ConeDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Shared camera.\n  vtkNew<vtkCamera> camera;\n\n  // Define viewport ranges.\n  double xmins[4] = {0, .5, 0, .5};\n  double xmaxs[4] = {0.5, 1, 0.5, 1};\n  double ymins[4] = {0, 0, .5, .5};\n  double ymaxs[4] = {0.5, 0.5, 1, 1};\n\n  // Each viewport will contain a cone with an increasing resolution.\n  for (unsigned i = 0; i < 4; i++)\n  {\n    vtkNew<vtkRenderer> renderer;\n    renderer->SetBackground(backgroundColor.GetData());\n\n    renderWindow->AddRenderer(renderer);\n    renderer->SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i]);\n\n    // Create a cone with different resolutions.\n    vtkNew<vtkConeSource> coneSource;\n    coneSource->SetResolution(i);\n    coneSource->SetDirection(0, 1, 0);\n    if (i == 3)\n    {\n      coneSource->SetResolution(20);\n    }\n\n    // Create a mapper and actor\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(coneSource->GetOutputPort());\n\n    vtkNew<vtkProperty> backfaceProp;\n    backfaceProp->SetDiffuseColor(actorBackfaceColor.GetData());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    if (i > 0)\n    {\n      actor->GetProperty()->SetDiffuseColor(actorColor.GetData());\n    }\n    else\n    {\n      actor->GetProperty()->SetDiffuseColor(coneLineColor.GetData());\n    }\n    actor->GetProperty()->SetLineWidth(2);\n    actor->GetProperty()->EdgeVisibilityOn();\n    actor->SetBackfaceProperty(backfaceProp);\n    renderer->AddActor(actor);\n    renderer->SetActiveCamera(camera);\n    if (i == 3)\n    {\n      renderer->ResetCamera();\n    }\n  }\n  camera->Azimuth(120);\n  camera->Elevation(45);\n  camera->Dolly(1.1);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/ConeDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConeDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConeDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConeDemo MACOSX_BUNDLE ConeDemo.cxx )\n  target_link_libraries(ConeDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConeDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/ConeDemo/#download-and-build-conedemo","title":"Download and Build ConeDemo","text":"

        Click here to download ConeDemo and its CMakeLists.txt file. Once the tarball ConeDemo.tar has been downloaded and extracted,

        cd ConeDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConeDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/ConvexPointSet/","title":"ConvexPointSet","text":"

        vtk-examples/Cxx/GeometricObjects/ConvexPointSet

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/ConvexPointSet/#description","title":"Description","text":"

        vtkConvexPointSet object represents a 3D cell defined by a convex set of points. An example of such a cell is an octant (from an octree).

        vtkConvexPointSet uses the ordered triangulations approach (vtkOrderedTriangulator) to create triangulations guaranteed to be compatible across shared faces.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/ConvexPointSet/#code","title":"Code","text":"

        ConvexPointSet.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConvexPointSet.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkConvexPointSet> cps;\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, 1);\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(0, 1, 1);\n  points->InsertNextPoint(0.5, 0, 0);\n  points->InsertNextPoint(1, 0.5, 0);\n  points->InsertNextPoint(0.5, 1, 0);\n  points->InsertNextPoint(0, 0.5, 0);\n  points->InsertNextPoint(0.5, 0.5, 0);\n\n  for (int i = 0; i < 13; ++i)\n  {\n    cps->GetPointIds()->InsertId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->Allocate(1, 1);\n  ug->InsertNextCell(cps->GetCellType(), cps->GetPointIds());\n  ug->SetPoints(points);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(ug);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetLineWidth(3);\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  // Glyph the points\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.03);\n\n  // Create a polydata to store everything in\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputData(polyData);\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ConvexPointSet\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(pointActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(210);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/ConvexPointSet/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConvexPointSet)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConvexPointSet: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConvexPointSet MACOSX_BUNDLE ConvexPointSet.cxx )\n  target_link_libraries(ConvexPointSet PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConvexPointSet\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/ConvexPointSet/#download-and-build-convexpointset","title":"Download and Build ConvexPointSet","text":"

        Click here to download ConvexPointSet and its CMakeLists.txt file. Once the tarball ConvexPointSet.tar has been downloaded and extracted,

        cd ConvexPointSet/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConvexPointSet\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Cube/","title":"Cube","text":"

        vtk-examples/Cxx/GeometricObjects/Cube

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Cube/#description","title":"Description","text":"

        This is based on the C++ example Examples/DataManipulation/Cxx/Cube.cxx in the VTK source distribution.

        It illustrates the manual use of vtkPolyData to construct a cube and differs from the Wiki examples Cube1.cxx and Cube1.py, which use vtkCubeSource.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Cube/#code","title":"Code","text":"

        Cube.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<std::array<double, 3>, 8> pts = {{{{0, 0, 0}},\n                                               {{1, 0, 0}},\n                                               {{1, 1, 0}},\n                                               {{0, 1, 0}},\n                                               {{0, 0, 1}},\n                                               {{1, 0, 1}},\n                                               {{1, 1, 1}},\n                                               {{0, 1, 1}}}};\n  // The ordering of the corner points on each face.\n  std::array<std::array<vtkIdType, 4>, 6> ordering = {{{{0, 3, 2, 1}},\n                                                       {{4, 5, 6, 7}},\n                                                       {{0, 1, 5, 4}},\n                                                       {{1, 2, 6, 5}},\n                                                       {{2, 3, 7, 6}},\n                                                       {{3, 0, 4, 7}}}};\n\n  // We'll create the building blocks of polydata including data attributes.\n  vtkNew<vtkPolyData> cube;\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> polys;\n  vtkNew<vtkFloatArray> scalars;\n\n  // Load the point, cell, and data attributes.\n  for (auto i = 0ul; i < pts.size(); ++i)\n  {\n    points->InsertPoint(i, pts[i].data());\n    scalars->InsertTuple1(i, i);\n  }\n  for (auto&& i : ordering)\n  {\n    polys->InsertNextCell(vtkIdType(i.size()), i.data());\n  }\n\n  // We now assign the pieces to the vtkPolyData.\n  cube->SetPoints(points);\n  cube->SetPolys(polys);\n  cube->GetPointData()->SetScalars(scalars);\n\n  // Now we'll look at it.\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputData(cube);\n  cubeMapper->SetScalarRange(cube->GetScalarRange());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n\n  // The usual rendering stuff.\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(1, 1, 1);\n  camera->SetFocalPoint(0, 0, 0);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"Cube\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(cubeActor);\n  renderer->SetActiveCamera(camera);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  renWin->SetSize(600, 600);\n\n  // interact with data\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Cube/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cube)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cube: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cube MACOSX_BUNDLE Cube.cxx )\n  target_link_libraries(Cube PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cube\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Cube/#download-and-build-cube","title":"Download and Build Cube","text":"

        Click here to download Cube and its CMakeLists.txt file. Once the tarball Cube.tar has been downloaded and extracted,

        cd Cube/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cube\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Cube1/","title":"Cube1","text":"

        vtk-examples/Cxx/GeometricObjects/Cube1

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Cube1/#description","title":"Description","text":"

        Display a cube.

        A nice simple example that demonstrates the operation of the VTK pipeline.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Cube1/#code","title":"Code","text":"

        Cube1.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a rendering window and renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"Cube\");\n  renWin->AddRenderer(ren);\n  // Create a renderwindow interactor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create a cube.\n  vtkNew<vtkCubeSource> cube;\n  cube->Update();\n\n  // Mapper.\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputData(cube->GetOutput());\n\n  // Actor.\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // Assign actor to the renderer.\n  ren->AddActor(cubeActor);\n\n  ren->ResetCamera();\n  ren->GetActiveCamera()->Azimuth(30);\n  ren->GetActiveCamera()->Elevation(30);\n  ren->ResetCameraClippingRange();\n  ren->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Cube1\");\n\n  // Enable user interface interaction.\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Cube1/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cube1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cube1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cube1 MACOSX_BUNDLE Cube1.cxx )\n  target_link_libraries(Cube1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cube1\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Cube1/#download-and-build-cube1","title":"Download and Build Cube1","text":"

        Click here to download Cube1 and its CMakeLists.txt file. Once the tarball Cube1.tar has been downloaded and extracted,

        cd Cube1/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cube1\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Cylinder/","title":"Cylinder","text":"

        vtk-examples/Cxx/GeometricObjects/Cylinder

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Cylinder/#description","title":"Description","text":"

        vtkCylinderSource object creates a polygonal cylinder centered at Center.

        The axis of the cylinder is aligned along the global y-axis. The height and radius of the cylinder can be specified, as well as the number of sides.

        It is also possible to control whether the cylinder is open-ended or capped. If you have the end points of the cylinder, you should use a vtkLineSource followed by a vtkTubeFilter instead of the vtkCylinderSource.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Cylinder/#code","title":"Code","text":"

        Cylinder.cxx

        #include <vtkActor.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cylinder.\n  vtkNew<vtkCylinderSource> cylinderSource;\n  cylinderSource->SetCenter(0.0, 0.0, 0.0);\n  cylinderSource->SetRadius(5.0);\n  cylinderSource->SetHeight(7.0);\n  cylinderSource->SetResolution(100);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cylinderSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Cylinder\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Cylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cylinder MACOSX_BUNDLE Cylinder.cxx )\n  target_link_libraries(Cylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Cylinder/#download-and-build-cylinder","title":"Download and Build Cylinder","text":"

        Click here to download Cylinder and its CMakeLists.txt file. Once the tarball Cylinder.tar has been downloaded and extracted,

        cd Cylinder/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cylinder\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/CylinderExample/","title":"CylinderExample","text":"

        vtk-examples/Cxx/GeometricObjects/CylinderExample

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/CylinderExample/#description","title":"Description","text":"

        This example creates a minimal visualization program, demonstrating VTK's basic rendering and pipeline creation.

        Note

        This original C++ source code for this example is here.

        Other languages

        See (Python), (PythonicAPI), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/CylinderExample/#code","title":"Code","text":"

        CylinderExample.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // This creates a polygonal cylinder model with eight circumferential facets\n  // (i.e, in practice an octagonal prism).\n  vtkNew<vtkCylinderSource> cylinder;\n  cylinder->SetResolution(8);\n\n  // The mapper is responsible for pushing the geometry into the graphics\n  // library. It may also do color mapping, if scalars or other attributes are\n  // defined.\n  vtkNew<vtkPolyDataMapper> cylinderMapper;\n  cylinderMapper->SetInputConnection(cylinder->GetOutputPort());\n\n  // The actor is a grouping mechanism: besides the geometry (mapper), it\n  // also has a property, transformation matrix, and/or texture map.\n  // Here we set its color and rotate it around the X and Y axes.\n  vtkNew<vtkActor> cylinderActor;\n  cylinderActor->SetMapper(cylinderMapper);\n  cylinderActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"Tomato\").GetData());\n  cylinderActor->RotateX(30.0);\n  cylinderActor->RotateY(-45.0);\n\n  // The renderer generates the image\n  // which is then displayed on the render window.\n  // It can be thought of as a scene to which the actor is added\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(cylinderActor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  // Zoom in a little by accessing the camera and invoking its \"Zoom\" method.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.5);\n\n  // The render window is the actual GUI window\n  // that appears on the computer screen\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Cylinder\");\n\n  // The render window interactor captures mouse events\n  // and will perform appropriate camera or actor manipulation\n  // depending on the nature of the events.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // This starts the event loop and as a side effect causes an initial render.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/CylinderExample/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CylinderExample)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CylinderExample: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CylinderExample MACOSX_BUNDLE CylinderExample.cxx )\n  target_link_libraries(CylinderExample PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CylinderExample\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/CylinderExample/#download-and-build-cylinderexample","title":"Download and Build CylinderExample","text":"

        Click here to download CylinderExample and its CMakeLists.txt file. Once the tarball CylinderExample.tar has been downloaded and extracted,

        cd CylinderExample/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CylinderExample\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Disk/","title":"Disk","text":"

        vtk-examples/Cxx/GeometricObjects/Disk

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Disk/#description","title":"Description","text":"

        vtkDiskSource objects creates a polygonal disk with a hole in the center.

        The disk has zero height. The user can specify the inner and outer radius of the disk, and the radial and circumferential resolution of the polygonal representation.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Disk/#code","title":"Code","text":"

        Disk.cxx

        #include <vtkActor.h>\n#include <vtkDiskSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDiskSource> diskSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(diskSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Disk\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Disk/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Disk)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Disk: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Disk MACOSX_BUNDLE Disk.cxx )\n  target_link_libraries(Disk PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Disk\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Disk/#download-and-build-disk","title":"Download and Build Disk","text":"

        Click here to download Disk and its CMakeLists.txt file. Once the tarball Disk.tar has been downloaded and extracted,

        cd Disk/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Disk\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Dodecahedron/","title":"Dodecahedron","text":"

        vtk-examples/Cxx/GeometricObjects/Dodecahedron

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Dodecahedron/#code","title":"Code","text":"

        Dodecahedron.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyhedron.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nnamespace {\nvtkSmartPointer<vtkPolyhedron> MakeDodecahedron();\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto dodecahedron = MakeDodecahedron();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(dodecahedron->GetPolyData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PapayaWhip\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Dodecahedron\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkPolyhedron> MakeDodecahedron()\n{\n  vtkSmartPointer<vtkPolyhedron> aDodecahedron =\n      vtkSmartPointer<vtkPolyhedron>::New();\n\n  for (int i = 0; i < 20; ++i)\n  {\n    aDodecahedron->GetPointIds()->InsertNextId(i);\n  }\n\n  aDodecahedron->GetPoints()->InsertNextPoint(1.21412, 0, 1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.375185, 1.1547, 1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.982247, 0.713644, 1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.982247, -0.713644, 1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.375185, -1.1547, 1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(1.96449, 0, 0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.607062, 1.86835, 0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(-1.58931, 1.1547, 0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(-1.58931, -1.1547, 0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.607062, -1.86835, 0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(1.58931, 1.1547, -0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.607062, 1.86835, -0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(-1.96449, 0, -0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.607062, -1.86835, -0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(1.58931, -1.1547, -0.375185);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.982247, 0.713644, -1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.375185, 1.1547, -1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(-1.21412, 0, -1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(-0.375185, -1.1547, -1.58931);\n  aDodecahedron->GetPoints()->InsertNextPoint(0.982247, -0.713644, -1.58931);\n\n  vtkIdType faces[73] = {12,                    // number of faces\n                         5,  0,  1,  2,  3,  4, // number of ids on face, ids\n                         5,  0,  5,  10, 6,  1,  5,  1,  6,  11, 7,  2,  5,  2,\n                         7,  12, 8,  3,  5,  3,  8,  13, 9,  4,  5,  4,  9,  14,\n                         5,  0,  5,  15, 10, 5,  14, 19, 5,  16, 11, 6,  10, 15,\n                         5,  17, 12, 7,  11, 16, 5,  18, 13, 8,  12, 17, 5,  19,\n                         14, 9,  13, 18, 5,  19, 18, 17, 16, 15};\n\n  aDodecahedron->SetFaces(faces);\n  aDodecahedron->Initialize();\n\n  return aDodecahedron;\n}\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/Dodecahedron/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Dodecahedron)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Dodecahedron: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Dodecahedron MACOSX_BUNDLE Dodecahedron.cxx )\n  target_link_libraries(Dodecahedron PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Dodecahedron\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Dodecahedron/#download-and-build-dodecahedron","title":"Download and Build Dodecahedron","text":"

        Click here to download Dodecahedron and its CMakeLists.txt file. Once the tarball Dodecahedron.tar has been downloaded and extracted,

        cd Dodecahedron/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Dodecahedron\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/EarthSource/","title":"EarthSource","text":"

        vtk-examples/Cxx/GeometricObjects/EarthSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/EarthSource/#code","title":"Code","text":"

        EarthSource.cxx

        #include <vtkActor.h>\n#include <vtkEarthSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkWindowToImageFilter.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Earth source\n  vtkNew<vtkEarthSource> earthSource;\n  earthSource->OutlineOn();\n  earthSource->Update();\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(100);\n  sphere->SetRadius(earthSource->GetRadius());\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(earthSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"EarthSource\");\n\n  // Render and interact\n  renderWindow->Render();\n\n  /*\n  // screenshot code:\n  vtkNew<vtkWindowToImageFilter> w2if ;\n  w2if->SetInput(renderWindow);\n  w2if->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(\"TestEarthSource->png\");\n  writer->SetInputConnection(w2if->GetOutputPort());\n  writer->Write();\n  */\n\n  // begin interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/EarthSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EarthSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersHybrid\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EarthSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EarthSource MACOSX_BUNDLE EarthSource.cxx )\n  target_link_libraries(EarthSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EarthSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/EarthSource/#download-and-build-earthsource","title":"Download and Build EarthSource","text":"

        Click here to download EarthSource and its CMakeLists.txt file. Once the tarball EarthSource.tar has been downloaded and extracted,

        cd EarthSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./EarthSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/EllipticalCylinder/","title":"EllipticalCylinder","text":"

        vtk-examples/Cxx/GeometricObjects/EllipticalCylinder

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/EllipticalCylinder/#description","title":"Description","text":"

        The example creates an elliptical cross-section and stores it in a vtkPolyData. Then, the vtkLinearExtrusionFilter creates an elliptical cylinder by extruding the vtkPolyLine along a vector. The example sets the backface property of the vtkActor to show the front and back face of the cylinder.

        See also

        EllipticalCylinderDemo to see the vtkPolyLine and the vector represented as an oriented arrow.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/EllipticalCylinder/#code","title":"Code","text":"

        EllipticalCylinder.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n\n  double angle = 0;\n  double r1, r2;\n  double centerX, centerY;\n  r1 = 50;\n  r2 = 30;\n  centerX = 10.0;\n  centerY = 5.0;\n\n  vtkNew<vtkPoints> points;\n  int id = 0;\n  while (angle <= 2.0 * vtkMath::Pi() + (vtkMath::Pi() / 60.0))\n  {\n    points->InsertNextPoint(r1 * cos(angle) + centerX,\n                            r2 * sin(angle) + centerY, 0.0);\n    angle = angle + (vtkMath::Pi() / 60.0);\n    ++id;\n  }\n\n  vtkNew<vtkPolyLine> line;\n  line->GetPointIds()->SetNumberOfIds(id);\n  for (unsigned int i = 0; i < static_cast<unsigned int>(id); ++i)\n  {\n    line->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line);\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n  polyData->SetLines(lines);\n\n  vtkNew<vtkLinearExtrusionFilter> extrude;\n  extrude->SetInputData(polyData);\n  extrude->SetExtrusionTypeToNormalExtrusion();\n  extrude->SetVector(0, 0, 100.0);\n  extrude->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(extrude->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  vtkNew<vtkRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren->AddActor(actor);\n  ren->AddActor(lineActor);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"EllipticalCylinder\");\n  renWin->AddRenderer(ren);\n  renWin->SetSize(600, 600);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, 1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Azimuth(30);\n  camera->Elevation(30);\n\n  ren->SetActiveCamera(camera);\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/EllipticalCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EllipticalCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EllipticalCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EllipticalCylinder MACOSX_BUNDLE EllipticalCylinder.cxx )\n  target_link_libraries(EllipticalCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EllipticalCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/EllipticalCylinder/#download-and-build-ellipticalcylinder","title":"Download and Build EllipticalCylinder","text":"

        Click here to download EllipticalCylinder and its CMakeLists.txt file. Once the tarball EllipticalCylinder.tar has been downloaded and extracted,

        cd EllipticalCylinder/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./EllipticalCylinder\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/EllipticalCylinderDemo/","title":"EllipticalCylinderDemo","text":"

        vtk-examples/Cxx/GeometricObjects/EllipticalCylinderDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/EllipticalCylinderDemo/#description","title":"Description","text":"

        The example shows the vtkPolyLine that forms the base of the elliptical cylinder and an oriented arrow that represents the vector that vtkLinearExtrusionFilter uses to create the cylinder. The example takes an optional triple that defines the vector for the filter. The length of the vector is the height of the cylinder.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/EllipticalCylinderDemo/#code","title":"Code","text":"

        EllipticalCylinderDemo.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n\nint main(int argc, char* argv[])\n{\n  double nx = 0.0;\n  double ny = 0.0;\n  double nz = 100.0;\n\n  if (argc > 3)\n  {\n    nx = atof(argv[1]);\n    ny = atof(argv[2]);\n    nz = atof(argv[3]);\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  double angle = 0;\n  double r1, r2;\n  double centerX, centerY;\n  r1 = 50;\n  r2 = 30;\n  centerX = 10.0;\n  centerY = 5.0;\n\n  vtkNew<vtkPoints> points;\n  int id = 0;\n  while (angle <= 2.0 * vtkMath::Pi() + (vtkMath::Pi() / 60.0))\n  {\n    points->InsertNextPoint(r1 * cos(angle) + centerX,\n                            r2 * sin(angle) + centerY, 0.0);\n    angle = angle + (vtkMath::Pi() / 60.0);\n    ++id;\n  }\n\n  vtkNew<vtkPolyLine> line;\n  line->GetPointIds()->SetNumberOfIds(id);\n  for (unsigned int i = 0; i < static_cast<unsigned int>(id); ++i)\n  {\n    line->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line);\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n  polyData->SetLines(lines);\n\n  vtkNew<vtkLinearExtrusionFilter> extrude;\n  extrude->SetInputData(polyData);\n  extrude->SetExtrusionTypeToNormalExtrusion();\n  extrude->SetVector(nx, ny, nz);\n  extrude->Update();\n\n  // Create an oriented arrow\n  double startPoint[3], endPoint[3];\n  startPoint[0] = centerX;\n  startPoint[1] = centerY;\n  startPoint[2] = 0.0;\n  for (auto i = 0; i < 3; ++i)\n  {\n    endPoint[i] = startPoint[i] + extrude->GetVector()[i];\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  auto max_r = 10.0;\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    arbitrary[i] = rng->GetRangeValue(-max_r, max_r);\n    rng->Next();\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);\n  transform->Concatenate(matrix);\n  transform->Scale(length, length, length);\n\n  vtkNew<vtkArrowSource> arrowSource;\n  arrowSource->SetTipResolution(31);\n  arrowSource->SetShaftResolution(21);\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(arrowSource->GetOutputPort());\n\n  // Create a mapper and actor for the arrow\n  vtkNew<vtkPolyDataMapper> arrowMapper;\n  arrowMapper->SetInputConnection(transformPD->GetOutputPort());\n\n  vtkNew<vtkActor> arrowActor;\n  arrowActor->SetMapper(arrowMapper);\n  arrowActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputData(polyData);\n  tubes->SetRadius(2.0);\n  tubes->SetNumberOfSides(21);\n\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(tubes->GetOutputPort());\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(extrude->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->GetProperty()->SetOpacity(.7);\n\n  vtkNew<vtkRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren->AddActor(actor);\n  ren->AddActor(lineActor);\n  ren->AddActor(arrowActor);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"EllipticalCylinderDemo\");\n  renWin->AddRenderer(ren);\n  renWin->SetSize(600, 600);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, 1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Azimuth(30);\n  camera->Elevation(30);\n\n  ren->SetActiveCamera(camera);\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/EllipticalCylinderDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EllipticalCylinderDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EllipticalCylinderDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EllipticalCylinderDemo MACOSX_BUNDLE EllipticalCylinderDemo.cxx )\n  target_link_libraries(EllipticalCylinderDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EllipticalCylinderDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/EllipticalCylinderDemo/#download-and-build-ellipticalcylinderdemo","title":"Download and Build EllipticalCylinderDemo","text":"

        Click here to download EllipticalCylinderDemo and its CMakeLists.txt file. Once the tarball EllipticalCylinderDemo.tar has been downloaded and extracted,

        cd EllipticalCylinderDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./EllipticalCylinderDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Frustum/","title":"Frustum","text":"

        vtk-examples/Cxx/GeometricObjects/Frustum

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Frustum/#description","title":"Description","text":"

        This example gets the frustum from a camera and displays it on the screen.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Frustum/#code","title":"Code","text":"

        Frustum.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFrustumSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCamera> camera;\n  camera->SetClippingRange(.1, .4);\n  double planesArray[24];\n\n  camera->GetFrustumPlanes(1.0, planesArray);\n\n  vtkNew<vtkPlanes> planes;\n  planes->SetFrustumPlanes(planesArray);\n\n  vtkNew<vtkFrustumSource> frustumSource;\n  frustumSource->ShowLinesOff();\n  frustumSource->SetPlanes(planes);\n\n  vtkNew<vtkShrinkPolyData> shrink;\n  shrink->SetInputConnection(frustumSource->GetOutputPort());\n  shrink->SetShrinkFactor(.9);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  // a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Frustum\");\n  renderWindow->AddRenderer(renderer);\n\n  // an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  // Position the camera so that we can see the frustum\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  // render an image (lights and cameras are created automatically)\n  renderWindow->Render();\n\n  // begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Frustum/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Frustum)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Frustum: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Frustum MACOSX_BUNDLE Frustum.cxx )\n  target_link_libraries(Frustum PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Frustum\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Frustum/#download-and-build-frustum","title":"Download and Build Frustum","text":"

        Click here to download Frustum and its CMakeLists.txt file. Once the tarball Frustum.tar has been downloaded and extracted,

        cd Frustum/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Frustum\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/GeometricObjectsDemo/","title":"GeometricObjectsDemo","text":"

        vtk-examples/Cxx/GeometricObjects/GeometricObjectsDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/GeometricObjectsDemo/#code","title":"Code","text":"

        GeometricObjectsDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkArrowSource.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkCylinderSource.h>\n#include <vtkDiskSource.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRegularPolygonSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <array>\n#include <vector>\n#include <vtkCamera.h>\n\nint main(int, char*[])\n{\n  vtkSmartPointer<vtkNamedColors> colors =\n      vtkSmartPointer<vtkNamedColors>::New();\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create container to hold the 3D object generators (sources)\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> geometricObjectSources;\n\n  // Populate the container with the various object sources to be demonstrated\n  geometricObjectSources.push_back(vtkSmartPointer<vtkArrowSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkConeSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkCubeSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkCylinderSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkDiskSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkLineSource>::New());\n  geometricObjectSources.push_back(\n      vtkSmartPointer<vtkRegularPolygonSource>::New());\n  geometricObjectSources.push_back(vtkSmartPointer<vtkSphereSource>::New());\n\n  // Create containers for the remaining nodes of each pipeline\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textmappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textactors;\n\n  // Create a common text property.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // Create a mapper and actor for each object and the corresponding text label\n  for (unsigned int i = 0; i < geometricObjectSources.size(); i++)\n  {\n    geometricObjectSources[i]->Update();\n\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputConnection(geometricObjectSources[i]->GetOutputPort());\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(\n        colors->GetColor3d(\"PeachPuff\").GetData());\n\n    textmappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textmappers[i]->SetInput(\n        geometricObjectSources[i]->GetClassName()); // set text label to the\n                                                    // name of the object source\n    textmappers[i]->SetTextProperty(textProperty);\n\n    textactors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    textactors[i]->SetMapper(textmappers[i]);\n    textactors[i]->SetPosition(120, 16); // Note: the position of an Actor2D is\n                                         // specified in display coordinates\n  }\n\n  // Define size of the grid that will hold the objects\n  auto gridCols = 3;\n  auto gridRows = 3;\n  // Define side length (in pixels) of each renderer square\n  int rendererSize = 300;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"GeometricObjectsDemo\");\n  renderWindow->SetSize(rendererSize * gridCols, rendererSize * gridRows);\n\n  // Set up a grid of viewports for each renderer\n  for (auto row = 0; row < gridRows; row++)\n  {\n    for (auto col = 0; col < gridCols; col++)\n    {\n      auto index = row * gridCols + col;\n\n      // Create a renderer for this grid cell\n      vtkSmartPointer<vtkRenderer> renderer =\n          vtkSmartPointer<vtkRenderer>::New();\n      renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n      // Set the renderer's viewport dimensions (xmin, ymin, xmax, ymax) within\n      // the render window. Note that for the Y values, we need to subtract the\n      // row index from gridRows because the viewport Y axis points upwards, but\n      // we want to draw the grid from top to down\n      double viewport[4] = {static_cast<double>(col) / gridCols,\n                            static_cast<double>(gridRows - row - 1) / gridRows,\n                            static_cast<double>(col + 1) / gridCols,\n                            static_cast<double>(gridRows - row) / gridRows};\n      renderer->SetViewport(viewport);\n\n      // Add the corresponding actor and label for this grid cell, if they exist\n      if (index < geometricObjectSources.size())\n      {\n        renderer->AddActor(actors[index]);\n        renderer->AddActor(textactors[index]);\n        renderer->ResetCameraClippingRange();\n      }\n\n      renderWindow->AddRenderer(renderer);\n    }\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/GeometricObjectsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GeometricObjectsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GeometricObjectsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GeometricObjectsDemo MACOSX_BUNDLE GeometricObjectsDemo.cxx )\n  target_link_libraries(GeometricObjectsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GeometricObjectsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/GeometricObjectsDemo/#download-and-build-geometricobjectsdemo","title":"Download and Build GeometricObjectsDemo","text":"

        Click here to download GeometricObjectsDemo and its CMakeLists.txt file. Once the tarball GeometricObjectsDemo.tar has been downloaded and extracted,

        cd GeometricObjectsDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GeometricObjectsDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Hexahedron/","title":"Hexahedron","text":"

        vtk-examples/Cxx/GeometricObjects/Hexahedron

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Hexahedron/#description","title":"Description","text":"

        The hexahedron is a primary three-dimensional cell consisting of six quadrilateral faces, twelve edges, and eight vertices. The hexahedron is defined by an ordered list of eight points. The faces and edges must not intersect any other faces and edges, and the hexahedron must be convex.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Hexahedron/#code","title":"Code","text":"

        Hexahedron.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkHexahedron.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <array>\n#include <vector>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // For the hexahedron; setup the coordinates of eight points.\n  // The two faces must be in counter clockwise order as viewed from the\n  // outside.\n  std::vector<std::array<double, 3>> pointCoordinates;\n  pointCoordinates.push_back({{0.0, 0.0, 0.0}}); // Face 1\n  pointCoordinates.push_back({{1.0, 0.0, 0.0}});\n  pointCoordinates.push_back({{1.0, 1.0, 0.0}});\n  pointCoordinates.push_back({{0.0, 1.0, 0.0}});\n  pointCoordinates.push_back({{0.0, 0.0, 1.0}}); // Face 2\n  pointCoordinates.push_back({{1.0, 0.0, 1.0}});\n  pointCoordinates.push_back({{1.0, 1.0, 1.0}});\n  pointCoordinates.push_back({{0.0, 1.0, 1.0}});\n\n  // Create the points.\n  vtkNew<vtkPoints> points;\n\n  // Create a hexahedron from the points.\n  vtkNew<vtkHexahedron> hex;\n\n  for (auto i = 0; i < pointCoordinates.size(); ++i)\n  {\n    points->InsertNextPoint(pointCoordinates[i].data());\n    hex->GetPointIds()->SetId(i, i);\n  }\n\n  // Add the hexahedron to a cell array.\n  vtkNew<vtkCellArray> hexs;\n  hexs->InsertNextCell(hex);\n\n  // Add the points and hexahedron to an unstructured grid.\n  vtkNew<vtkUnstructuredGrid> uGrid;\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(hex->GetCellType(), hex->GetPointIds());\n\n  // Visualize.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(uGrid);\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Hexahedron\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Hexahedron/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Hexahedron)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Hexahedron: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Hexahedron MACOSX_BUNDLE Hexahedron.cxx )\n  target_link_libraries(Hexahedron PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Hexahedron\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Hexahedron/#download-and-build-hexahedron","title":"Download and Build Hexahedron","text":"

        Click here to download Hexahedron and its CMakeLists.txt file. Once the tarball Hexahedron.tar has been downloaded and extracted,

        cd Hexahedron/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Hexahedron\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/IsoparametricCellsDemo/","title":"IsoparametricCellsDemo","text":"

        vtk-examples/Cxx/GeometricObjects/IsoparametricCellsDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/IsoparametricCellsDemo/#description","title":"Description","text":"

        This example shows the isoparametric cells supported by the VTK. These cells are nonlinear and contain one or more mid-side vertices. Isoparametric elements are typically used in finite element analysis. The term isoparametric is derived from the use of the same shape functions (or interpolation functions) to define the element's geometric shape as are used to define the displacements within the element.

        This example illustrates each cell's representation using its parametric coordinates (pcoords) as the vertices of the cell. In practice, the vertices will correspond to physical points in a finite element model. Use vtkTessellatorFilter to better see the shape of the cell. See for example, QuadraticHexahedronDemo and QuadraticTetraDemo.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/IsoparametricCellsDemo/#code","title":"Code","text":"

        IsoparametricCellsDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <vtkBiQuadraticQuad.h>\n#include <vtkBiQuadraticQuadraticHexahedron.h>\n#include <vtkBiQuadraticQuadraticWedge.h>\n#include <vtkBiQuadraticTriangle.h>\n#include <vtkCubicLine.h>\n#include <vtkQuadraticEdge.h>\n#include <vtkQuadraticHexahedron.h>\n#include <vtkQuadraticLinearQuad.h>\n#include <vtkQuadraticLinearWedge.h>\n#include <vtkQuadraticPolygon.h>\n#include <vtkQuadraticPyramid.h>\n#include <vtkQuadraticQuad.h>\n#include <vtkQuadraticTetra.h>\n#include <vtkQuadraticTriangle.h>\n#include <vtkQuadraticWedge.h>\n#include <vtkTriQuadraticHexahedron.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n// These functions return a vtkUnstructured grid corresponding to the object.\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid> MakeUnstructuredGrid(vtkSmartPointer<T>);\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticPolygon();\n} // namespace\n\nint main(int, char*[])\n{\n  std::vector<std::string> titles;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n\n  std::vector<vtkSmartPointer<vtkUnstructuredGrid>> uGrids;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticEdge>::New()));\n  titles.push_back(\"VTK_QUADRATIC_EDGE (= 21)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticTriangle>::New()));\n  titles.push_back(\"VTK_QUADRATIC_TRIANGLE (= 22)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticQuad>::New()));\n  titles.push_back(\"VTK_QUADRATIC_QUAD (= 23)\");\n\n  uGrids.push_back(MakeQuadraticPolygon());\n  titles.push_back(\"VTK_QUADRATIC_POLYGON (= 36)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticTetra>::New()));\n  titles.push_back(\"VTK_QUADRATIC_TETRA (= 24)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticHexahedron>::New()));\n  titles.push_back(\"VTK_QUADRATIC_HEXAHEDRON (= 25)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticWedge>::New()));\n  titles.push_back(\"VTK_QUADRATIC_WEDGE (= 26)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticPyramid>::New()));\n  titles.push_back(\"VTK_QUADRATIC_PYRAMID (= 27)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkBiQuadraticQuad>::New()));\n  titles.push_back(\"VTK_BIQUADRATIC_QUAD (= 28)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkTriQuadraticHexahedron>::New()));\n  titles.push_back(\"VTK_TRIQUADRATIC_HEXAHEDRON (= 29)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticLinearQuad>::New()));\n  titles.push_back(\"VTK_QUADRATIC_LINEAR_QUAD (= 30)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkQuadraticLinearWedge>::New()));\n  titles.push_back(\"VTK_QUADRATIC_LINEAR_WEDGE (= 31)\");\n\n  uGrids.push_back(MakeUnstructuredGrid(\n      vtkSmartPointer<vtkBiQuadraticQuadraticWedge>::New()));\n  titles.push_back(\"VTK_BIQUADRATIC_QUADRATIC_WEDGE (= 32)\");\n\n  uGrids.push_back(MakeUnstructuredGrid(\n      vtkSmartPointer<vtkBiQuadraticQuadraticHexahedron>::New()));\n  titles.push_back(\"VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON (= 33)\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkBiQuadraticTriangle>::New()));\n  titles.push_back(\"VTK_BIQUADRATIC_TRIANGLE (= 34)\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkCubicLine>::New()));\n  titles.push_back(\"VTK_CUBIC_LINE (= 35)\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"Isoparametric Cell\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Create one sphere for all\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.08);\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(10);\n  textProperty->SetJustificationToCentered();\n\n  // Create and link the mappers actors and renderers together.\n  for (unsigned int i = 0; i < uGrids.size(); ++i)\n  {\n    std::cout << \"Creating: \" << titles[i] << std::endl;\n    textMappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textActors.push_back(vtkSmartPointer<vtkActor2D>::New());\n\n    textMappers[i]->GetTextProperty()->SetFontSize(10);\n    textMappers[i]->GetTextProperty()->ShadowOn();\n    mappers.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    mappers[i]->SetInputData(uGrids[i]);\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n    actors[i]->GetProperty()->EdgeVisibilityOn();\n    actors[i]->GetProperty()->SetLineWidth(3);\n    actors[i]->GetProperty()->SetOpacity(.5);\n    renderers[i]->AddViewProp(actors[i]);\n\n    textMappers[i]->SetInput(titles[i].c_str());\n    textActors[i]->SetMapper(textMappers[i]);\n    textActors[i]->SetPosition(50, 10);\n    renderers[i]->AddViewProp(textActors[i]);\n\n    // Label the points\n    vtkSmartPointer<vtkLabeledDataMapper> labelMapper =\n        vtkSmartPointer<vtkLabeledDataMapper>::New();\n    labelMapper->SetInputData(uGrids[i]);\n    vtkSmartPointer<vtkActor2D> labelActor = vtkSmartPointer<vtkActor2D>::New();\n    labelActor->SetMapper(labelMapper);\n    renderers[i]->AddViewProp(labelActor);\n\n    // Glyph the points\n    vtkSmartPointer<vtkGlyph3DMapper> pointMapper =\n        vtkSmartPointer<vtkGlyph3DMapper>::New();\n    pointMapper->SetInputData(uGrids[i]);\n    pointMapper->SetSourceConnection(sphere->GetOutputPort());\n    pointMapper->ScalingOff();\n    pointMapper->ScalarVisibilityOff();\n\n    vtkSmartPointer<vtkActor> pointActor = vtkSmartPointer<vtkActor>::New();\n    pointActor->SetMapper(pointMapper);\n    pointActor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"Banana\").GetData());\n    pointActor->GetProperty()->SetSpecular(.6);\n    pointActor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n    pointActor->GetProperty()->SetSpecularPower(100);\n    renderers[i]->AddViewProp(pointActor);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  // Setup the viewports\n  int xGridDimensions = 4;\n  int yGridDimensions = 4;\n  int rendererSize = 240;\n\n  renWin->SetSize(rendererSize * xGridDimensions,\n                  rendererSize * yGridDimensions);\n\n  for (int row = 0; row < yGridDimensions; row++)\n  {\n    for (int col = 0; col < xGridDimensions; col++)\n    {\n      int index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n\n      if (index > int(actors.size()) - 1)\n      {\n        // Add a renderer even if there is no actor.\n        // This makes the render window background all the same color.\n        vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();\n        ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n        ren->SetViewport(viewport);\n        renWin->AddRenderer(ren);\n        continue;\n      }\n\n      renderers[index]->SetViewport(viewport);\n      renderers[index]->SetBackground(\n          colors->GetColor3d(\"SlateGray\").GetData());\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(-30);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  iRen->Initialize();\n\n  renWin->Render();\n\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid>\nMakeUnstructuredGrid(vtkSmartPointer<T> aCell)\n{\n  double* pcoords = aCell->GetParametricCoords();\n  for (int i = 0; i < aCell->GetNumberOfPoints(); ++i)\n  {\n    aCell->GetPointIds()->SetId(i, i);\n    aCell->GetPoints()->SetPoint(i, *(pcoords + 3 * i), *(pcoords + 3 * i + 1),\n                                 *(pcoords + 3 * i + 2));\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(aCell->GetPoints());\n  ug->InsertNextCell(aCell->GetCellType(), aCell->GetPointIds());\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticPolygon()\n{\n  vtkNew<vtkQuadraticPolygon> quadraticPolygon;\n\n  quadraticPolygon->GetPointIds()->SetNumberOfIds(8);\n  quadraticPolygon->GetPointIds()->SetId(0, 0);\n  quadraticPolygon->GetPointIds()->SetId(1, 1);\n  quadraticPolygon->GetPointIds()->SetId(2, 2);\n  quadraticPolygon->GetPointIds()->SetId(3, 3);\n  quadraticPolygon->GetPointIds()->SetId(4, 4);\n  quadraticPolygon->GetPointIds()->SetId(5, 5);\n  quadraticPolygon->GetPointIds()->SetId(6, 6);\n  quadraticPolygon->GetPointIds()->SetId(7, 7);\n\n  quadraticPolygon->GetPoints()->SetNumberOfPoints(8);\n  quadraticPolygon->GetPoints()->SetPoint(0, 0.0, 0.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(1, 2.0, 0.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(2, 2.0, 2.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(3, 0.0, 2.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(4, 1.0, 0.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(5, 2.0, 1.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(6, 1.0, 2.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(7, 0.0, 1.0, 0.0);\n  quadraticPolygon->GetPoints()->SetPoint(5, 3.0, 1.0, 0.0);\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(quadraticPolygon->GetPoints());\n  ug->InsertNextCell(quadraticPolygon->GetCellType(),\n                     quadraticPolygon->GetPointIds());\n  return ug;\n}\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/IsoparametricCellsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IsoparametricCellsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IsoparametricCellsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IsoparametricCellsDemo MACOSX_BUNDLE IsoparametricCellsDemo.cxx )\n  target_link_libraries(IsoparametricCellsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IsoparametricCellsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/IsoparametricCellsDemo/#download-and-build-isoparametriccellsdemo","title":"Download and Build IsoparametricCellsDemo","text":"

        Click here to download IsoparametricCellsDemo and its CMakeLists.txt file. Once the tarball IsoparametricCellsDemo.tar has been downloaded and extracted,

        cd IsoparametricCellsDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IsoparametricCellsDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Line/","title":"Line","text":"

        vtk-examples/Cxx/GeometricObjects/Line

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Line/#description","title":"Description","text":"

        The line is a primary one-dimensional cell. It is defined by two points. The direction along the line is from the first point to the second point.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Line/#code","title":"Code","text":"

        Line.cxx

        #include <vtkActor.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  // Create two points, P0 and P1\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(p0);\n  lineSource->SetPoint2(p1);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(lineSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetLineWidth(4);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Line\");\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->AddActor(actor);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Line/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Line)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Line: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Line MACOSX_BUNDLE Line.cxx )\n  target_link_libraries(Line PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Line\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Line/#download-and-build-line","title":"Download and Build Line","text":"

        Click here to download Line and its CMakeLists.txt file. Once the tarball Line.tar has been downloaded and extracted,

        cd Line/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Line\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/LinearCellDemo/","title":"LinearCellDemo","text":"

        vtk-examples/Cxx/GeometricObjects/LinearCellDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/LinearCellDemo/#description","title":"Description","text":"

        Linear cell types found in VTK. Numbers define ordering of the defining points.

        Options are provided to show a wireframe (-w) or to colour the back face differently from the front face (-b).

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/LinearCellDemo/#code","title":"Code","text":"

        LinearCellDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <vtkHexagonalPrism.h>\n#include <vtkHexahedron.h>\n#include <vtkLine.h>\n#include <vtkPentagonalPrism.h>\n#include <vtkPixel.h>\n#include <vtkPolyLine.h>\n#include <vtkPolyVertex.h>\n#include <vtkPolygon.h>\n#include <vtkPyramid.h>\n#include <vtkQuad.h>\n#include <vtkTetra.h>\n#include <vtkTriangle.h>\n#include <vtkTriangleStrip.h>\n#include <vtkVertex.h>\n#include <vtkVoxel.h>\n#include <vtkWedge.h>\n\n#include <vtk_cli11.h>\n\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n// These functions return a vtkUnstructured grid corresponding to the object.\nnamespace {\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeVertex();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex();\nvtkSmartPointer<vtkUnstructuredGrid> MakeLine();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangle();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon();\nvtkSmartPointer<vtkUnstructuredGrid> MakePixel();\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuad();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTetra();\nvtkSmartPointer<vtkUnstructuredGrid> MakeVoxel();\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexahedron();\nvtkSmartPointer<vtkUnstructuredGrid> MakeWedge();\nvtkSmartPointer<vtkUnstructuredGrid> MakePyramid();\nvtkSmartPointer<vtkUnstructuredGrid> MakePentagonalPrism();\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexagonalPrism();\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Demonstrate the linear cell types found in VTK. Numbers define \"\n               \"ordering of the defining points.\"};\n\n  // Define options\n  std::string fileName;\n  auto wireframeOn{false};\n  app.add_flag(\"-w, --wireframe\", wireframeOn, \"Render a wireframe.\");\n  auto backfaceOn{false};\n  app.add_flag(\"-b, --backface\", backfaceOn,\n               \"Display the back face in a different colour.\");\n  CLI11_PARSE(app, argc, argv);\n  if (wireframeOn && backfaceOn)\n  {\n    std::cerr << \"error: argument -b/--backface: not allowed with argument \"\n                 \"-w/--wireframe\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::vector<std::string> titles;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n\n  std::vector<vtkSmartPointer<vtkUnstructuredGrid>> uGrids;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  uGrids.push_back(MakeVertex());\n  titles.push_back(\"VTK_VERTEX (=1)\");\n  uGrids.push_back(MakePolyVertex());\n  titles.push_back(\"VTK_POLY_VERTEX (=2)\");\n  uGrids.push_back(MakeLine());\n  titles.push_back(\"VTK_LINE (=3)\");\n  uGrids.push_back(MakePolyLine());\n  titles.push_back(\"VTK_POLY_LINE (=4)\");\n  uGrids.push_back(MakeTriangle());\n  titles.push_back(\"VTK_TRIANGLE (=5)\");\n  uGrids.push_back(MakeTriangleStrip());\n  titles.push_back(\"VTK_TRIANGLE_STRIP (=6)\");\n  uGrids.push_back(MakePolygon());\n  titles.push_back(\"VTK_POLYGON (=7)\");\n  uGrids.push_back(MakePixel());\n  titles.push_back(\"VTK_PIXEL (=8)\");\n  uGrids.push_back(MakeQuad());\n  titles.push_back(\"VTK_QUAD (=9)\");\n  uGrids.push_back(MakeTetra());\n  titles.push_back(\"VTK_TETRA (=10)\");\n  uGrids.push_back(MakeVoxel());\n  titles.push_back(\"VTK_VOXEL (=11)\");\n  uGrids.push_back(MakeHexahedron());\n  titles.push_back(\"VTK_HEXAHEDRON (=12)\");\n  uGrids.push_back(MakeWedge());\n  titles.push_back(\"VTK_WEDGE (=13)\");\n  uGrids.push_back(MakePyramid());\n  titles.push_back(\"VTK_PYRAMID (=14)\");\n  uGrids.push_back(MakePentagonalPrism());\n  titles.push_back(\"VTK_PENTAGONAL_PRISM (=15)\");\n  uGrids.push_back(MakeHexagonalPrism());\n  titles.push_back(\"VTK_HEXAGONAL_PRISM (=16)\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"LinearCellDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Create one sphere for all\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.08);\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(10);\n  textProperty->SetJustificationToCentered();\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"MediumSeaGreen\").GetData());\n\n  // Create and link the mappers actors and renderers together.\n  for (unsigned int i = 0; i < uGrids.size(); ++i)\n  {\n    std::cout << \"Creatng: \" << titles[i] << std::endl;\n    textMappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textActors.push_back(vtkSmartPointer<vtkActor2D>::New());\n\n    mappers.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    mappers[i]->SetInputData(uGrids[i]);\n    actors[i]->SetMapper(mappers[i]);\n    if (wireframeOn)\n    {\n      actors[i]->GetProperty()->SetRepresentationToWireframe();\n      actors[i]->GetProperty()->SetLineWidth(2);\n      actors[i]->GetProperty()->SetOpacity(1);\n      actors[i]->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n    }\n    else\n    {\n      actors[i]->GetProperty()->EdgeVisibilityOn();\n      actors[i]->GetProperty()->SetLineWidth(3);\n      actors[i]->GetProperty()->SetColor(\n          colors->GetColor3d(\"Tomato\").GetData());\n      if (backfaceOn)\n      {\n        actors[i]->SetBackfaceProperty(backProperty);\n        actors[i]->GetProperty()->SetOpacity(1);\n      }\n      else\n      {\n        actors[i]->GetProperty()->SetOpacity(0.5);\n      }\n    }\n    renderers[i]->AddViewProp(actors[i]);\n\n    textMappers[i]->SetInput(titles[i].c_str());\n    textActors[i]->SetMapper(textMappers[i]);\n    textActors[i]->SetPosition(50, 10);\n    if (wireframeOn)\n    {\n      textActors[i]->GetProperty()->SetColor(\n          colors->GetColor3d(\"Black\").GetData());\n    }\n\n    renderers[i]->AddViewProp(textActors[i]);\n\n    // Label the points\n    vtkSmartPointer<vtkLabeledDataMapper> labelMapper =\n        vtkSmartPointer<vtkLabeledDataMapper>::New();\n    labelMapper->SetInputData(uGrids[i]);\n    vtkSmartPointer<vtkActor2D> labelActor = vtkSmartPointer<vtkActor2D>::New();\n    labelActor->SetMapper(labelMapper);\n    if (wireframeOn)\n    {\n      textActors[i]->GetProperty()->SetColor(\n          colors->GetColor3d(\"Snow\").GetData());\n    }\n    renderers[i]->AddViewProp(labelActor);\n\n    // Glyph the points\n    vtkSmartPointer<vtkGlyph3DMapper> pointMapper =\n        vtkSmartPointer<vtkGlyph3DMapper>::New();\n    pointMapper->SetInputData(uGrids[i]);\n    pointMapper->SetSourceConnection(sphere->GetOutputPort());\n    pointMapper->ScalingOff();\n    pointMapper->ScalarVisibilityOff();\n\n    vtkSmartPointer<vtkActor> pointActor = vtkSmartPointer<vtkActor>::New();\n    pointActor->SetMapper(pointMapper);\n    if (wireframeOn)\n    {\n      pointActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"Banana\").GetData());\n    }\n    else\n    {\n      pointActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"Banana\").GetData());\n    }\n    pointActor->GetProperty()->SetSpecular(.6);\n    pointActor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n    pointActor->GetProperty()->SetSpecularPower(100);\n    renderers[i]->AddViewProp(pointActor);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  // Set up the viewports\n  int xGridDimensions = 4;\n  int yGridDimensions = 4;\n  int rendererSize = 300;\n\n  renWin->SetSize(rendererSize * xGridDimensions,\n                  rendererSize * yGridDimensions);\n\n  for (int row = 0; row < yGridDimensions; row++)\n  {\n    for (int col = 0; col < xGridDimensions; col++)\n    {\n      int index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      if (index > int(actors.size()) - 1)\n      {\n        // Add a renderer even if there is no actor.\n        // This makes the render window background all the same color.\n        vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();\n        if (wireframeOn)\n        {\n          ren->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n        }\n        else\n        {\n          ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n        }\n        ren->SetViewport(viewport);\n        renWin->AddRenderer(ren);\n        continue;\n      }\n\n      if (wireframeOn)\n      {\n        renderers[index]->SetBackground(\n            colors->GetColor3d(\"LightSlateGray\").GetData());\n      }\n      else\n      {\n        renderers[index]->SetBackground(\n            colors->GetColor3d(\"SlateGray\").GetData());\n      }\n      renderers[index]->SetViewport(viewport);\n      renderers[index]->ResetCamera();\n      switch (index)\n      {\n      case 0:\n        renderers[index]->GetActiveCamera()->Dolly(0.1);\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 1:\n        renderers[index]->GetActiveCamera()->Dolly(0.8);\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 2:\n        renderers[index]->GetActiveCamera()->Dolly(0.4);\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 4:\n        renderers[index]->GetActiveCamera()->Dolly(0.7);\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 5:\n        renderers[index]->GetActiveCamera()->Dolly(1.1);\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 6:\n        renderers[index]->GetActiveCamera()->Azimuth(0);\n        renderers[index]->GetActiveCamera()->Elevation(-45);\n        break;\n      case 7:\n        renderers[index]->GetActiveCamera()->Azimuth(0);\n        renderers[index]->GetActiveCamera()->Elevation(-45);\n        break;\n      case 8:\n        renderers[index]->GetActiveCamera()->Azimuth(0);\n        renderers[index]->GetActiveCamera()->Elevation(-45);\n        break;\n      case 9:\n        renderers[index]->GetActiveCamera()->Azimuth(0);\n        renderers[index]->GetActiveCamera()->Elevation(-22.5);\n        break;\n      case 10:\n        renderers[index]->GetActiveCamera()->Azimuth(-22.5);\n        renderers[index]->GetActiveCamera()->Elevation(15);\n        break;\n      case 11:\n        renderers[index]->GetActiveCamera()->Azimuth(-22.5);\n        renderers[index]->GetActiveCamera()->Elevation(15);\n        break;\n      case 12:\n        renderers[index]->GetActiveCamera()->Azimuth(-45);\n        renderers[index]->GetActiveCamera()->Elevation(15);\n        break;\n      case 13:\n        renderers[index]->GetActiveCamera()->Azimuth(0);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      case 14:\n        renderers[index]->GetActiveCamera()->Azimuth(-22.5);\n        renderers[index]->GetActiveCamera()->Elevation(10);\n        break;\n      case 15:\n        renderers[index]->GetActiveCamera()->Azimuth(-30);\n        renderers[index]->GetActiveCamera()->Elevation(15);\n        break;\n      default:\n        renderers[index]->GetActiveCamera()->Azimuth(30);\n        renderers[index]->GetActiveCamera()->Elevation(-30);\n        break;\n      }\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  iRen->Initialize();\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeVertex()\n{\n  // A vertex is a cell that represents a 3D point\n  int numberOfVertices = 1;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n\n  vtkSmartPointer<vtkVertex> vertex = vtkSmartPointer<vtkVertex>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    vertex->GetPointIds()->SetId(i, i);\n  }\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(vertex->GetCellType(), vertex->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex()\n{\n  // A polyvertex is a cell represents a set of 0D vertices\n  int numberOfVertices = 6;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, 0.4);\n  points->InsertNextPoint(0, 1, 0.6);\n\n  vtkSmartPointer<vtkPolyVertex> polyVertex =\n      vtkSmartPointer<vtkPolyVertex>::New();\n  polyVertex->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyVertex->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyVertex->GetCellType(), polyVertex->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeLine()\n{\n  // A line is a cell that represents a 1D point\n  int numberOfVertices = 2;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0.5, 0.5, 0);\n\n  vtkSmartPointer<vtkLine> line = vtkSmartPointer<vtkLine>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    line->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(line->GetCellType(), line->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine()\n{\n  // A polyline is a cell that represents a set of 1D lines\n  int numberOfVertices = 5;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0.5, 0);\n  points->InsertNextPoint(0.5, 0, 0);\n  points->InsertNextPoint(1, 0.3, 0);\n  points->InsertNextPoint(1.5, 0.4, 0);\n  points->InsertNextPoint(2.0, 0.4, 0);\n\n  vtkSmartPointer<vtkPolyLine> polyline = vtkSmartPointer<vtkPolyLine>::New();\n  polyline->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyline->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyline->GetCellType(), polyline->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangle()\n{\n  // A triangle is a cell that represents a 1D point\n  int numberOfVertices = 3;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0.5, 0.5, 0);\n  points->InsertNextPoint(0.2, 1, 0);\n\n  vtkSmartPointer<vtkTriangle> triangle = vtkSmartPointer<vtkTriangle>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    triangle->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(triangle->GetCellType(), triangle->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip()\n{\n  // A triangle is a cell that represents a triangle strip\n  int numberOfVertices = 10;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, -0.1, 0);\n  points->InsertNextPoint(0.5, 1, 0);\n  points->InsertNextPoint(2.0, -0.1, 0);\n  points->InsertNextPoint(1.5, 0.8, 0);\n  points->InsertNextPoint(3.0, 0, 0);\n  points->InsertNextPoint(2.5, 0.9, 0);\n  points->InsertNextPoint(4.0, -0.2, 0);\n  points->InsertNextPoint(3.5, 0.8, 0);\n  points->InsertNextPoint(4.5, 1.1, 0);\n\n  vtkSmartPointer<vtkTriangleStrip> trianglestrip =\n      vtkSmartPointer<vtkTriangleStrip>::New();\n  trianglestrip->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    trianglestrip->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(trianglestrip->GetCellType(),\n                     trianglestrip->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon()\n{\n  // A polygon is a cell that represents a polygon\n  int numberOfVertices = 6;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, -0.1, 0);\n  points->InsertNextPoint(0.8, 0.5, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0.6, 1.2, 0);\n  points->InsertNextPoint(0, 0.8, 0);\n\n  vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New();\n  polygon->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polygon->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(polygon->GetCellType(), polygon->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePixel()\n\n{\n  // A pixel is a cell that represents a pixel\n  vtkSmartPointer<vtkPixel> pixel = vtkSmartPointer<vtkPixel>::New();\n  pixel->GetPoints()->SetPoint(0, 0, 0, 0);\n  pixel->GetPoints()->SetPoint(1, 1, 0, 0);\n  pixel->GetPoints()->SetPoint(2, 0, 1, 0);\n  pixel->GetPoints()->SetPoint(3, 1, 1, 0);\n\n  pixel->GetPointIds()->SetId(0, 0);\n  pixel->GetPointIds()->SetId(1, 1);\n  pixel->GetPointIds()->SetId(2, 2);\n  pixel->GetPointIds()->SetId(3, 3);\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(pixel->GetPoints());\n  ug->InsertNextCell(pixel->GetCellType(), pixel->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuad()\n\n{\n  // A quad is a cell that represents a quad\n  vtkSmartPointer<vtkQuad> quad = vtkSmartPointer<vtkQuad>::New();\n  quad->GetPoints()->SetPoint(0, 0, 0, 0);\n  quad->GetPoints()->SetPoint(1, 1, 0, 0);\n  quad->GetPoints()->SetPoint(2, 1, 1, 0);\n  quad->GetPoints()->SetPoint(3, 0, 1, 0);\n\n  quad->GetPointIds()->SetId(0, 0);\n  quad->GetPointIds()->SetId(1, 1);\n  quad->GetPointIds()->SetId(2, 2);\n  quad->GetPointIds()->SetId(3, 3);\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(quad->GetPoints());\n  ug->InsertNextCell(quad->GetCellType(), quad->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTetra()\n{\n  // Make a tetrahedron.\n  int numberOfVertices = 4;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 1);\n\n  vtkSmartPointer<vtkTetra> tetra = vtkSmartPointer<vtkTetra>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    tetra->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkCellArray> cellArray =\n      vtkSmartPointer<vtkCellArray>::New();\n  cellArray->InsertNextCell(tetra);\n\n  vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  unstructuredGrid->SetPoints(points);\n  unstructuredGrid->SetCells(VTK_TETRA, cellArray);\n\n  return unstructuredGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeVoxel()\n{\n  // A voxel is a representation of a regular grid in 3-D space.\n  int numberOfVertices = 8;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, 1);\n  points->InsertNextPoint(0, 1, 1);\n  points->InsertNextPoint(1, 1, 1);\n\n  vtkSmartPointer<vtkVoxel> voxel = vtkSmartPointer<vtkVoxel>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    voxel->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(voxel->GetCellType(), voxel->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexahedron()\n{\n  // A regular hexagon (cube) with all faces square and three squares around\n  // each vertex is created below.\n\n  // Set up the coordinates of eight points\n  // (the two faces must be in counter-clockwise\n  // order as viewed from the outside).\n\n  int numberOfVertices = 8;\n\n  // Create the points\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 1.0);\n  points->InsertNextPoint(1.0, 0.0, 1.0);\n  points->InsertNextPoint(1.0, 1.0, 1.0);\n  points->InsertNextPoint(0.0, 1.0, 1.0);\n\n  // Create a hexahedron from the points\n  vtkSmartPointer<vtkHexahedron> hex = vtkSmartPointer<vtkHexahedron>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    hex->GetPointIds()->SetId(i, i);\n  }\n\n  // Add the points and hexahedron to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(hex->GetCellType(), hex->GetPointIds());\n\n  return uGrid;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeWedge()\n{\n\n  // A wedge consists of two triangular ends and three rectangular faces.\n\n  int numberOfVertices = 6;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0, 0.5, 0.5);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(1, 0.0, 0.0);\n  points->InsertNextPoint(1, 0.5, 0.5);\n\n  vtkSmartPointer<vtkWedge> wedge = vtkSmartPointer<vtkWedge>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    wedge->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(wedge->GetCellType(), wedge->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePyramid()\n{\n  // Make a regular square pyramid.\n  int numberOfVertices = 5;\n\n  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n\n  float p0[3] = {1.0, 1.0, 0.0};\n  float p1[3] = {-1.0, 1.0, 0.0};\n  float p2[3] = {-1.0, -1.0, 0.0};\n  float p3[3] = {1.0, -1.0, 0.0};\n  float p4[3] = {0.0, 0.0, 1.0};\n\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n  points->InsertNextPoint(p4);\n\n  vtkSmartPointer<vtkPyramid> pyramid = vtkSmartPointer<vtkPyramid>::New();\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    pyramid->GetPointIds()->SetId(i, i);\n  }\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(points);\n  ug->InsertNextCell(pyramid->GetCellType(), pyramid->GetPointIds());\n\n  return ug;\n}\nvtkSmartPointer<vtkUnstructuredGrid> MakePentagonalPrism()\n{\n  vtkSmartPointer<vtkPentagonalPrism> pentagonalPrism =\n      vtkSmartPointer<vtkPentagonalPrism>::New();\n\n  pentagonalPrism->GetPointIds()->SetId(0, 0);\n  pentagonalPrism->GetPointIds()->SetId(1, 1);\n  pentagonalPrism->GetPointIds()->SetId(2, 2);\n  pentagonalPrism->GetPointIds()->SetId(3, 3);\n  pentagonalPrism->GetPointIds()->SetId(4, 4);\n  pentagonalPrism->GetPointIds()->SetId(5, 5);\n  pentagonalPrism->GetPointIds()->SetId(6, 6);\n  pentagonalPrism->GetPointIds()->SetId(7, 7);\n  pentagonalPrism->GetPointIds()->SetId(8, 8);\n  pentagonalPrism->GetPointIds()->SetId(9, 9);\n\n  double scale = 2.0;\n  pentagonalPrism->GetPoints()->SetPoint(0, 11 / scale, 10 / scale, 10 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(1, 13 / scale, 10 / scale, 10 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(2, 14 / scale, 12 / scale, 10 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(3, 12 / scale, 14 / scale, 10 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(4, 10 / scale, 12 / scale, 10 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(5, 11 / scale, 10 / scale, 14 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(6, 13 / scale, 10 / scale, 14 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(7, 14 / scale, 12 / scale, 14 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(8, 12 / scale, 14 / scale, 14 / scale);\n  pentagonalPrism->GetPoints()->SetPoint(9, 10 / scale, 12 / scale, 14 / scale);\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(pentagonalPrism->GetPoints());\n  ug->InsertNextCell(pentagonalPrism->GetCellType(),\n                     pentagonalPrism->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeHexagonalPrism()\n{\n  vtkSmartPointer<vtkHexagonalPrism> hexagonalPrism =\n      vtkSmartPointer<vtkHexagonalPrism>::New();\n  hexagonalPrism->GetPointIds()->SetId(0, 0);\n  hexagonalPrism->GetPointIds()->SetId(1, 1);\n  hexagonalPrism->GetPointIds()->SetId(2, 2);\n  hexagonalPrism->GetPointIds()->SetId(3, 3);\n  hexagonalPrism->GetPointIds()->SetId(4, 4);\n  hexagonalPrism->GetPointIds()->SetId(5, 5);\n  hexagonalPrism->GetPointIds()->SetId(6, 6);\n  hexagonalPrism->GetPointIds()->SetId(7, 7);\n  hexagonalPrism->GetPointIds()->SetId(8, 8);\n  hexagonalPrism->GetPointIds()->SetId(9, 9);\n  hexagonalPrism->GetPointIds()->SetId(10, 10);\n  hexagonalPrism->GetPointIds()->SetId(11, 11);\n\n  double scale = 2.0;\n  hexagonalPrism->GetPoints()->SetPoint(0, 11 / scale, 10 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(1, 13 / scale, 10 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(2, 14 / scale, 12 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(3, 13 / scale, 14 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(4, 11 / scale, 14 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(5, 10 / scale, 12 / scale, 10 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(6, 11 / scale, 10 / scale, 14 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(7, 13 / scale, 10 / scale, 14 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(8, 14 / scale, 12 / scale, 14 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(9, 13 / scale, 14 / scale, 14 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(10, 11 / scale, 14 / scale, 14 / scale);\n  hexagonalPrism->GetPoints()->SetPoint(11, 10 / scale, 12 / scale, 14 / scale);\n\n  vtkSmartPointer<vtkUnstructuredGrid> ug =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  ug->SetPoints(hexagonalPrism->GetPoints());\n  ug->InsertNextCell(hexagonalPrism->GetCellType(),\n                     hexagonalPrism->GetPointIds());\n\n  return ug;\n}\n\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/LinearCellDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LinearCellDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n  cli11\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LinearCellDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LinearCellDemo MACOSX_BUNDLE LinearCellDemo.cxx )\n  target_link_libraries(LinearCellDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LinearCellDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/LinearCellDemo/#download-and-build-linearcelldemo","title":"Download and Build LinearCellDemo","text":"

        Click here to download LinearCellDemo and its CMakeLists.txt file. Once the tarball LinearCellDemo.tar has been downloaded and extracted,

        cd LinearCellDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LinearCellDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/LongLine/","title":"LongLine","text":"

        vtk-examples/Cxx/GeometricObjects/LongLine

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/LongLine/#description","title":"Description","text":"

        Connect several points with a line.

        Seealso

        ColoredLines.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/LongLine/#code","title":"Code","text":"

        LongLine.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  // Create five points.\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n  double p2[3] = {0.0, 1.0, 2.0};\n  double p3[3] = {1.0, 2.0, 3.0};\n\n  // Create a vtkPoints object and store the points in it\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(origin);\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n\n  // Create a cell array to store the lines in and add the lines to it\n  vtkNew<vtkCellArray> lines;\n\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    vtkNew<vtkLine> line;\n    line->GetPointIds()->SetId(0, i);\n    line->GetPointIds()->SetId(1, i + 1);\n    lines->InsertNextCell(line);\n  }\n\n  // Create a polydata to store everything in\n  vtkNew<vtkPolyData> linesPolyData;\n\n  // Add the points to the dataset\n  linesPolyData->SetPoints(points);\n\n  // Add the lines to the dataset\n  linesPolyData->SetLines(lines);\n\n  // Setup actor and mapper\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(linesPolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetLineWidth(4);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"LongLine\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/LongLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LongLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LongLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LongLine MACOSX_BUNDLE LongLine.cxx )\n  target_link_libraries(LongLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LongLine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/LongLine/#download-and-build-longline","title":"Download and Build LongLine","text":"

        Click here to download LongLine and its CMakeLists.txt file. Once the tarball LongLine.tar has been downloaded and extracted,

        cd LongLine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LongLine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/OpenVRCone/","title":"OpenVRCone","text":"

        vtk-examples/Cxx/GeometricObjects/OpenVRCone

        "},{"location":"Cxx/GeometricObjects/OpenVRCone/#description","title":"Description","text":"

        This example demonstrates rendering of a Cone in OpenVR.

        Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/OpenVRCone/#code","title":"Code","text":"

        OpenVRCone.cxx

        #include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n// Chethana B\n// Organisation: Virtual Environments Lab, Chung-Ang Univeristy, Seoul.\nint main(int, char*[])\n{\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/OpenVRCone/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRCone)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRCone: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRCone MACOSX_BUNDLE OpenVRCone.cxx )\n  target_link_libraries(OpenVRCone PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRCone\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/OpenVRCone/#download-and-build-openvrcone","title":"Download and Build OpenVRCone","text":"

        Click here to download OpenVRCone and its CMakeLists.txt file. Once the tarball OpenVRCone.tar has been downloaded and extracted,

        cd OpenVRCone/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OpenVRCone\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/OpenVRCube/","title":"OpenVRCube","text":"

        vtk-examples/Cxx/GeometricObjects/OpenVRCube

        "},{"location":"Cxx/GeometricObjects/OpenVRCube/#description","title":"Description","text":"

        This example demonstrates rendering of a Cube in OpenVR.

        Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/OpenVRCube/#code","title":"Code","text":"

        OpenVRCube.cxx

        #include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n\nint main(int, char*[])\n{\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVRCube\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/OpenVRCube/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRCube)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRCube: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRCube MACOSX_BUNDLE OpenVRCube.cxx )\n  target_link_libraries(OpenVRCube PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRCube\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/OpenVRCube/#download-and-build-openvrcube","title":"Download and Build OpenVRCube","text":"

        Click here to download OpenVRCube and its CMakeLists.txt file. Once the tarball OpenVRCube.tar has been downloaded and extracted,

        cd OpenVRCube/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OpenVRCube\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/OpenVRCylinder/","title":"OpenVRCylinder","text":"

        vtk-examples/Cxx/GeometricObjects/OpenVRCylinder

        "},{"location":"Cxx/GeometricObjects/OpenVRCylinder/#description","title":"Description","text":"

        This example demonstrates rendering of a Cylinder in OpenVR.

        Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/OpenVRCylinder/#code","title":"Code","text":"

        OpenVRCylinder.cxx

        #include <vtkActor.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n\nint main(int, char* argv[])\n{\n  // Create a sphere\n  vtkNew<vtkCylinderSource> cylinderSource;\n  cylinderSource->SetCenter(0.0, 0.0, 0.0);\n  cylinderSource->SetRadius(5.0);\n  cylinderSource->SetHeight(7.0);\n  cylinderSource->SetResolution(100);\n\n  // Create a mapper and actor\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cylinderSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVRCylinder\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/OpenVRCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRCylinder MACOSX_BUNDLE OpenVRCylinder.cxx )\n  target_link_libraries(OpenVRCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/OpenVRCylinder/#download-and-build-openvrcylinder","title":"Download and Build OpenVRCylinder","text":"

        Click here to download OpenVRCylinder and its CMakeLists.txt file. Once the tarball OpenVRCylinder.tar has been downloaded and extracted,

        cd OpenVRCylinder/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OpenVRCylinder\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/OpenVRFrustum/","title":"OpenVRFrustum","text":"

        vtk-examples/Cxx/GeometricObjects/OpenVRFrustum

        "},{"location":"Cxx/GeometricObjects/OpenVRFrustum/#description","title":"Description","text":"

        VTK + OpenVR Frustrum Example

        Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/OpenVRFrustum/#code","title":"Code","text":"

        OpenVRFrustum.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFrustumSource.h>\n#include <vtkMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPlanes.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkShrinkPolyData.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCamera> camera;\n  camera->SetClippingRange(.1, .4);\n  double planesArray[24];\n\n  camera->GetFrustumPlanes(1.0, planesArray);\n\n  vtkNew<vtkPlanes> planes;\n  planes->SetFrustumPlanes(planesArray);\n\n  vtkNew<vtkFrustumSource> frustumSource;\n  frustumSource->ShowLinesOff();\n  frustumSource->SetPlanes(planes);\n\n  vtkNew<vtkShrinkPolyData> shrink;\n  shrink->SetInputConnection(frustumSource->GetOutputPort());\n  shrink->SetShrinkFactor(.9);\n\n  // Create a mapper and actor\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVRFrustum\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  // Position the camera so that we can see the frustum\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/OpenVRFrustum/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRFrustum)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRFrustum: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRFrustum MACOSX_BUNDLE OpenVRFrustum.cxx )\n  target_link_libraries(OpenVRFrustum PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRFrustum\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/OpenVRFrustum/#download-and-build-openvrfrustum","title":"Download and Build OpenVRFrustum","text":"

        Click here to download OpenVRFrustum and its CMakeLists.txt file. Once the tarball OpenVRFrustum.tar has been downloaded and extracted,

        cd OpenVRFrustum/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OpenVRFrustum\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/OpenVROrientedArrow/","title":"OpenVROrientedArrow","text":"

        vtk-examples/Cxx/GeometricObjects/OpenVROrientedArrow

        "},{"location":"Cxx/GeometricObjects/OpenVROrientedArrow/#description","title":"Description","text":"

        VTK + OpenVR OrientedArrow example.

        Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/OpenVROrientedArrow/#code","title":"Code","text":"

        OpenVROrientedArrow.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\n#define USER_MATRIX\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 77, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n\n  // Generate a random start and end point\n  double startPoint[3];\n  double endPoint[3];\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    startPoint[i] = rng->GetRangeValue(-10, 10);\n    rng->Next();\n    endPoint[i] = rng->GetRangeValue(-10, 10);\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (auto i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);\n  transform->Concatenate(matrix);\n  transform->Scale(length, length, length);\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(arrowSource->GetOutputPort());\n\n  // Create a mapper and actor for the arrow\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n#ifdef USER_MATRIX\n  mapper->SetInputConnection(arrowSource->GetOutputPort());\n  actor->SetUserMatrix(transform->GetMatrix());\n#else\n  mapper->SetInputConnection(transformPD->GetOutputPort());\n#endif\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create spheres for start and end point\n  vtkNew<vtkSphereSource> sphereStartSource;\n  sphereStartSource->SetCenter(startPoint);\n  sphereStartSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereStartMapper;\n  sphereStartMapper->SetInputConnection(sphereStartSource->GetOutputPort());\n  vtkNew<vtkActor> sphereStart;\n  sphereStart->SetMapper(sphereStartMapper);\n  sphereStart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  vtkNew<vtkSphereSource> sphereEndSource;\n  sphereEndSource->SetCenter(endPoint);\n  sphereEndSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereEndMapper;\n  sphereEndMapper->SetInputConnection(sphereEndSource->GetOutputPort());\n  vtkNew<vtkActor> sphereEnd;\n  sphereEnd->SetMapper(sphereEndMapper);\n  sphereEnd->GetProperty()->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVROrientedArrow\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereStart);\n  renderer->AddActor(sphereEnd);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/OpenVROrientedArrow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVROrientedArrow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVROrientedArrow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVROrientedArrow MACOSX_BUNDLE OpenVROrientedArrow.cxx )\n  target_link_libraries(OpenVROrientedArrow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVROrientedArrow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/OpenVROrientedArrow/#download-and-build-openvrorientedarrow","title":"Download and Build OpenVROrientedArrow","text":"

        Click here to download OpenVROrientedArrow and its CMakeLists.txt file. Once the tarball OpenVROrientedArrow.tar has been downloaded and extracted,

        cd OpenVROrientedArrow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OpenVROrientedArrow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/OpenVROrientedCylinder/","title":"OpenVROrientedCylinder","text":"

        vtk-examples/Cxx/GeometricObjects/OpenVROrientedCylinder

        "},{"location":"Cxx/GeometricObjects/OpenVROrientedCylinder/#description","title":"Description","text":"

        VTK + OpenVR OrientedCylinder example.

        Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/OpenVROrientedCylinder/#code","title":"Code","text":"

        OpenVROrientedCylinder.cxx

        #include <vtkActor.h>\n#include <vtkCylinderSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\n#define USER_MATRIX\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 77, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create a cylinder.\n  // Cylinder height vector is (0,1,0).\n  // Cylinder center is in the middle of the cylinder\n  vtkNew<vtkCylinderSource> cylinderSource;\n  cylinderSource->SetResolution(15);\n\n  // Generate a random start and end point\n  double startPoint[3];\n  double endPoint[3];\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    startPoint[i] = rng->GetRangeValue(-10, 10);\n    rng->Next();\n    endPoint[i] = rng->GetRangeValue(-10, 10);\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);   // translate to starting point\n  transform->Concatenate(matrix);     // apply direction cosines\n  transform->RotateZ(-90.0);          // align cylinder to x axis\n  transform->Scale(1.0, length, 1.0); // scale along the height vector\n  transform->Translate(0, .5, 0);     // translate to start of cylinder\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(cylinderSource->GetOutputPort());\n\n  // Create a mapper and actor for the cylinder\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n#ifdef USER_MATRIX\n  mapper->SetInputConnection(cylinderSource->GetOutputPort());\n  actor->SetUserMatrix(transform->GetMatrix());\n#else\n  mapper->SetInputConnection(transformPD->GetOutputPort());\n#endif\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create spheres for start and end point\n  vtkNew<vtkSphereSource> sphereStartSource;\n  sphereStartSource->SetCenter(startPoint);\n  sphereStartSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereStartMapper;\n  sphereStartMapper->SetInputConnection(sphereStartSource->GetOutputPort());\n  vtkNew<vtkActor> sphereStart;\n  sphereStart->SetMapper(sphereStartMapper);\n  sphereStart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  vtkNew<vtkSphereSource> sphereEndSource;\n  sphereEndSource->SetCenter(endPoint);\n  sphereEndSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereEndMapper;\n  sphereEndMapper->SetInputConnection(sphereEndSource->GetOutputPort());\n  vtkNew<vtkActor> sphereEnd;\n  sphereEnd->SetMapper(sphereEndMapper);\n  sphereEnd->GetProperty()->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVROrientedCylinder\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereStart);\n  renderer->AddActor(sphereEnd);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/OpenVROrientedCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVROrientedCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVROrientedCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVROrientedCylinder MACOSX_BUNDLE OpenVROrientedCylinder.cxx )\n  target_link_libraries(OpenVROrientedCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVROrientedCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/OpenVROrientedCylinder/#download-and-build-openvrorientedcylinder","title":"Download and Build OpenVROrientedCylinder","text":"

        Click here to download OpenVROrientedCylinder and its CMakeLists.txt file. Once the tarball OpenVROrientedCylinder.tar has been downloaded and extracted,

        cd OpenVROrientedCylinder/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OpenVROrientedCylinder\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/OpenVRSphere/","title":"OpenVRSphere","text":"

        vtk-examples/Cxx/GeometricObjects/OpenVRSphere

        "},{"location":"Cxx/GeometricObjects/OpenVRSphere/#description","title":"Description","text":"

        This example demonstrates rendering of a Sphere in OpenVR.

        Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/OpenVRSphere/#code","title":"Code","text":"

        OpenVRSphere.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  // Create a Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n\n  // Create a Mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an Actor\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a Renderer, RenderWindow, RenderWindowInteractor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVRSphere\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/OpenVRSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRSphere MACOSX_BUNDLE OpenVRSphere.cxx )\n  target_link_libraries(OpenVRSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/OpenVRSphere/#download-and-build-openvrsphere","title":"Download and Build OpenVRSphere","text":"

        Click here to download OpenVRSphere and its CMakeLists.txt file. Once the tarball OpenVRSphere.tar has been downloaded and extracted,

        cd OpenVRSphere/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OpenVRSphere\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/OpenVRTessellatedBoxSource/","title":"OpenVRTessellatedBoxSource","text":"

        vtk-examples/Cxx/GeometricObjects/OpenVRTessellatedBoxSource

        "},{"location":"Cxx/GeometricObjects/OpenVRTessellatedBoxSource/#description","title":"Description","text":"

        VTK + OpenVR TessellatedBoxSource example.

        Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/OpenVRTessellatedBoxSource/#code","title":"Code","text":"

        OpenVRTessellatedBoxSource.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkProperty.h>\n#include <vtkShrinkFilter.h>\n#include <vtkTessellatedBoxSource.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n  double bounds[6];\n  bounds[0] = -10.0;\n  bounds[1] = 10.0;\n  bounds[2] = 10.0;\n  bounds[3] = 20.0;\n  bounds[4] = -5.0;\n  bounds[5] = 5.0;\n\n  vtkNew<vtkTessellatedBoxSource> boxSource;\n  boxSource->SetLevel(3);\n  boxSource->QuadsOn();\n  boxSource->SetBounds(bounds);\n  boxSource->SetOutputPointsPrecision(vtkAlgorithm::SINGLE_PRECISION);\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(boxSource->GetOutputPort());\n  shrink->SetShrinkFactor(.8);\n\n  // Create a mapper and actor\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkOpenVRRenderer> renderer;\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OpenVRTessellatedBoxSource\");\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/OpenVRTessellatedBoxSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRTessellatedBoxSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRTessellatedBoxSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRTessellatedBoxSource MACOSX_BUNDLE OpenVRTessellatedBoxSource.cxx )\n  target_link_libraries(OpenVRTessellatedBoxSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRTessellatedBoxSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/OpenVRTessellatedBoxSource/#download-and-build-openvrtessellatedboxsource","title":"Download and Build OpenVRTessellatedBoxSource","text":"

        Click here to download OpenVRTessellatedBoxSource and its CMakeLists.txt file. Once the tarball OpenVRTessellatedBoxSource.tar has been downloaded and extracted,

        cd OpenVRTessellatedBoxSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OpenVRTessellatedBoxSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/OrientedArrow/","title":"OrientedArrow","text":"

        vtk-examples/Cxx/GeometricObjects/OrientedArrow

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/OrientedArrow/#description","title":"Description","text":"

        This example illustrates how to create and display an arrow that passes through two points.

        It demonstrates two different ways to apply the transform:

        1. Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter.

        2. Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

        Switch between the two methods by #defining USER_MATRIX or leaving out the #define.

        See also

        Compare this example with OrientedCylinder. The transform is different because the cylinder height direction is along the y-axis and the arrow height is along the x axis.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/OrientedArrow/#code","title":"Code","text":"

        OrientedArrow.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\n#define USER_MATRIX\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 77, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n\n  // Generate a random start and end point\n  double startPoint[3];\n  double endPoint[3];\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    startPoint[i] = rng->GetRangeValue(-10, 10);\n    rng->Next();\n    endPoint[i] = rng->GetRangeValue(-10, 10);\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (auto i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);\n  transform->Concatenate(matrix);\n  transform->Scale(length, length, length);\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(arrowSource->GetOutputPort());\n\n  // Create a mapper and actor for the arrow\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n#ifdef USER_MATRIX\n  mapper->SetInputConnection(arrowSource->GetOutputPort());\n  actor->SetUserMatrix(transform->GetMatrix());\n#else\n  mapper->SetInputConnection(transformPD->GetOutputPort());\n#endif\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create spheres for start and end point\n  vtkNew<vtkSphereSource> sphereStartSource;\n  sphereStartSource->SetCenter(startPoint);\n  sphereStartSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereStartMapper;\n  sphereStartMapper->SetInputConnection(sphereStartSource->GetOutputPort());\n  vtkNew<vtkActor> sphereStart;\n  sphereStart->SetMapper(sphereStartMapper);\n  sphereStart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  vtkNew<vtkSphereSource> sphereEndSource;\n  sphereEndSource->SetCenter(endPoint);\n  sphereEndSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereEndMapper;\n  sphereEndMapper->SetInputConnection(sphereEndSource->GetOutputPort());\n  vtkNew<vtkActor> sphereEnd;\n  sphereEnd->SetMapper(sphereEndMapper);\n  sphereEnd->GetProperty()->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OrientedArrow\");\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereStart);\n  renderer->AddActor(sphereEnd);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/OrientedArrow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientedArrow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientedArrow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientedArrow MACOSX_BUNDLE OrientedArrow.cxx )\n  target_link_libraries(OrientedArrow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientedArrow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/OrientedArrow/#download-and-build-orientedarrow","title":"Download and Build OrientedArrow","text":"

        Click here to download OrientedArrow and its CMakeLists.txt file. Once the tarball OrientedArrow.tar has been downloaded and extracted,

        cd OrientedArrow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OrientedArrow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/OrientedCylinder/","title":"OrientedCylinder","text":"

        vtk-examples/Cxx/GeometricObjects/OrientedCylinder

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/OrientedCylinder/#description","title":"Description","text":"

        This example illustrates how to create and display a cylinder that passes through two points.

        It demonstrates two different ways to apply the transform:

        1. Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter.

        2. Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

        Switch between the two methods by #defining USER_MATRIX or leaving out the #define.

        See also

        Compare this example with OrientedArrow. The transform is different because the cylinder height direction is along the y-axis and the arrow height is along the x axis.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/OrientedCylinder/#code","title":"Code","text":"

        OrientedCylinder.cxx

        #include <vtkActor.h>\n#include <vtkCylinderSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\n#define USER_MATRIX\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 77, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create a cylinder.\n  // Cylinder height vector is (0,1,0).\n  // Cylinder center is in the middle of the cylinder\n  vtkNew<vtkCylinderSource> cylinderSource;\n  cylinderSource->SetResolution(15);\n\n  // Generate a random start and end point\n  double startPoint[3];\n  double endPoint[3];\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    startPoint[i] = rng->GetRangeValue(-10, 10);\n    rng->Next();\n    endPoint[i] = rng->GetRangeValue(-10, 10);\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);   // translate to starting point\n  transform->Concatenate(matrix);     // apply direction cosines\n  transform->RotateZ(-90.0);          // align cylinder to x axis\n  transform->Scale(1.0, length, 1.0); // scale along the height vector\n  transform->Translate(0, .5, 0);     // translate to start of cylinder\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(cylinderSource->GetOutputPort());\n\n  // Create a mapper and actor for the cylinder\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n#ifdef USER_MATRIX\n  mapper->SetInputConnection(cylinderSource->GetOutputPort());\n  actor->SetUserMatrix(transform->GetMatrix());\n#else\n  mapper->SetInputConnection(transformPD->GetOutputPort());\n#endif\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create spheres for start and end point\n  vtkNew<vtkSphereSource> sphereStartSource;\n  sphereStartSource->SetCenter(startPoint);\n  sphereStartSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereStartMapper;\n  sphereStartMapper->SetInputConnection(sphereStartSource->GetOutputPort());\n  vtkNew<vtkActor> sphereStart;\n  sphereStart->SetMapper(sphereStartMapper);\n  sphereStart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  vtkNew<vtkSphereSource> sphereEndSource;\n  sphereEndSource->SetCenter(endPoint);\n  sphereEndSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereEndMapper;\n  sphereEndMapper->SetInputConnection(sphereEndSource->GetOutputPort());\n  vtkNew<vtkActor> sphereEnd;\n  sphereEnd->SetMapper(sphereEndMapper);\n  sphereEnd->GetProperty()->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OrientedCylinder\");\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereStart);\n  renderer->AddActor(sphereEnd);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/OrientedCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientedCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientedCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientedCylinder MACOSX_BUNDLE OrientedCylinder.cxx )\n  target_link_libraries(OrientedCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientedCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/OrientedCylinder/#download-and-build-orientedcylinder","title":"Download and Build OrientedCylinder","text":"

        Click here to download OrientedCylinder and its CMakeLists.txt file. Once the tarball OrientedCylinder.tar has been downloaded and extracted,

        cd OrientedCylinder/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OrientedCylinder\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/ParametricKuenDemo/","title":"ParametricKuenDemo","text":"

        vtk-examples/Cxx/GeometricObjects/ParametricKuenDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/ParametricKuenDemo/#description","title":"Description","text":"

        The example shows interaction with the vtkParametricKuen vtkParametricFunctionSource. The Kuen Surface This surface of constant Gaussian curvature K = -1 was discovered early. It is very popular because of its beauty.

        Here's the embedded video:

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/ParametricKuenDemo/#code","title":"Code","text":"

        ParametricKuenDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricKuen.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n\n#include <array>\n\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackMinimumU : public vtkCommand\n{\npublic:\n  static SliderCallbackMinimumU* New()\n  {\n    return new SliderCallbackMinimumU;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    if (value > .9 * this->Kuen->GetMaximumU())\n    {\n      value = .99 * this->Kuen->GetMaximumU();\n      static_cast<vtkSliderRepresentation2D*>(sliderWidget->GetRepresentation())\n          ->SetValue(value);\n    }\n    this->Kuen->SetMinimumU(value);\n  }\n  SliderCallbackMinimumU() : Kuen(0)\n  {\n  }\n  vtkParametricKuen* Kuen;\n};\n\nclass SliderCallbackMaximumU : public vtkCommand\n{\npublic:\n  static SliderCallbackMaximumU* New()\n  {\n    return new SliderCallbackMaximumU;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    if (value < this->Kuen->GetMinimumU() + .01)\n    {\n      value = this->Kuen->GetMinimumU() + .01;\n      static_cast<vtkSliderRepresentation2D*>(sliderWidget->GetRepresentation())\n          ->SetValue(value);\n    }\n    this->Kuen->SetMaximumU(static_cast<vtkSliderRepresentation2D*>(\n                                sliderWidget->GetRepresentation())\n                                ->GetValue());\n  }\n  SliderCallbackMaximumU() : Kuen(0)\n  {\n  }\n  vtkParametricKuen* Kuen;\n};\n\nclass SliderCallbackMinimumV : public vtkCommand\n{\npublic:\n  static SliderCallbackMinimumV* New()\n  {\n    return new SliderCallbackMinimumV;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    if (value > .9 * this->Kuen->GetMaximumV())\n    {\n      value = .9 * this->Kuen->GetMaximumV();\n      static_cast<vtkSliderRepresentation2D*>(sliderWidget->GetRepresentation())\n          ->SetValue(value);\n    }\n    this->Kuen->SetMinimumV(value);\n  }\n  SliderCallbackMinimumV() : Kuen(0)\n  {\n  }\n  vtkParametricKuen* Kuen;\n};\n\nclass SliderCallbackMaximumV : public vtkCommand\n{\npublic:\n  static SliderCallbackMaximumV* New()\n  {\n    return new SliderCallbackMaximumV;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    if (value < this->Kuen->GetMinimumV() + .01)\n    {\n      value = this->Kuen->GetMinimumV() + .01;\n      static_cast<vtkSliderRepresentation2D*>(sliderWidget->GetRepresentation())\n          ->SetValue(value);\n    }\n    this->Kuen->SetMaximumV(static_cast<vtkSliderRepresentation2D*>(\n                                sliderWidget->GetRepresentation())\n                                ->GetValue());\n  }\n  SliderCallbackMaximumV() : Kuen(0)\n  {\n  }\n  vtkParametricKuen* Kuen;\n};\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkParametricKuen> surface;\n  vtkNew<vtkParametricFunctionSource> source;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a parametric function source, renderer, mapper, and actor\n  source->SetParametricFunction(surface);\n\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProperty);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ParametricKuenDemo\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(.008);\n  double sliderLength(.008);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMinimumU;\n\n  sliderRepMinimumU->SetMinimumValue(-4.5);\n  sliderRepMinimumU->SetMaximumValue(4.5);\n  sliderRepMinimumU->SetValue(-4.5);\n  sliderRepMinimumU->SetTitleText(\"U min\");\n\n  sliderRepMinimumU->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumU->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepMinimumU->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumU->GetPoint2Coordinate()->SetValue(.9, .1);\n\n  sliderRepMinimumU->SetTubeWidth(tubeWidth);\n  sliderRepMinimumU->SetSliderLength(sliderLength);\n  sliderRepMinimumU->SetTitleHeight(titleHeight);\n  sliderRepMinimumU->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetMinimumU;\n  sliderWidgetMinimumU->SetInteractor(interactor);\n  sliderWidgetMinimumU->SetRepresentation(sliderRepMinimumU);\n  sliderWidgetMinimumU->SetAnimationModeToAnimate();\n  sliderWidgetMinimumU->EnabledOn();\n\n  vtkNew<SliderCallbackMinimumU> callbackMinimumU;\n  callbackMinimumU->Kuen = surface;\n\n  sliderWidgetMinimumU->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackMinimumU);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMaximumU;\n\n  sliderRepMaximumU->SetMinimumValue(-4.5);\n  sliderRepMaximumU->SetMaximumValue(4.5);\n  sliderRepMaximumU->SetValue(4.5);\n  sliderRepMaximumU->SetTitleText(\"U max\");\n\n  sliderRepMaximumU->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMaximumU->GetPoint1Coordinate()->SetValue(.1, .9);\n  sliderRepMaximumU->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMaximumU->GetPoint2Coordinate()->SetValue(.9, .9);\n\n  sliderRepMaximumU->SetTubeWidth(tubeWidth);\n  sliderRepMaximumU->SetSliderLength(sliderLength);\n  sliderRepMaximumU->SetTitleHeight(titleHeight);\n  sliderRepMaximumU->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetMaximumU;\n  sliderWidgetMaximumU->SetInteractor(interactor);\n  sliderWidgetMaximumU->SetRepresentation(sliderRepMaximumU);\n  sliderWidgetMaximumU->SetAnimationModeToAnimate();\n  sliderWidgetMaximumU->EnabledOn();\n\n  vtkNew<SliderCallbackMaximumU> callbackMaximumU;\n  callbackMaximumU->Kuen = surface;\n\n  sliderWidgetMaximumU->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackMaximumU);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMinimumV;\n\n  sliderRepMinimumV->SetMinimumValue(0.05);\n  sliderRepMinimumV->SetMaximumValue(vtkMath::Pi());\n  sliderRepMinimumV->SetValue(0.0);\n  sliderRepMinimumV->SetTitleText(\"V min\");\n\n  sliderRepMinimumV->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepMinimumV->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint2Coordinate()->SetValue(.1, .9);\n\n  sliderRepMinimumV->SetTubeWidth(tubeWidth);\n  sliderRepMinimumV->SetSliderLength(sliderLength);\n  sliderRepMinimumV->SetTitleHeight(titleHeight);\n  sliderRepMinimumV->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetMinimumV;\n  sliderWidgetMinimumV->SetInteractor(interactor);\n  sliderWidgetMinimumV->SetRepresentation(sliderRepMinimumV);\n  sliderWidgetMinimumV->SetAnimationModeToAnimate();\n  sliderWidgetMinimumV->EnabledOn();\n\n  vtkNew<SliderCallbackMinimumV> callbackMinimumV;\n  callbackMinimumV->Kuen = surface;\n\n  sliderWidgetMinimumV->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackMinimumV);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMaximumV;\n\n  sliderRepMaximumV->SetMinimumValue(0.05);\n  sliderRepMaximumV->SetMaximumValue(vtkMath::Pi() - .05);\n  sliderRepMaximumV->SetValue(vtkMath::Pi());\n  sliderRepMaximumV->SetTitleText(\"V max\");\n\n  sliderRepMaximumV->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMaximumV->GetPoint1Coordinate()->SetValue(.9, .1);\n  sliderRepMaximumV->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMaximumV->GetPoint2Coordinate()->SetValue(.9, .9);\n  sliderRepMaximumV->SetTubeWidth(tubeWidth);\n  sliderRepMaximumV->SetSliderLength(sliderLength);\n  sliderRepMaximumV->SetTitleHeight(titleHeight);\n  sliderRepMaximumV->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetMaximumV;\n  sliderWidgetMaximumV->SetInteractor(interactor);\n  sliderWidgetMaximumV->SetRepresentation(sliderRepMaximumV);\n  sliderWidgetMaximumV->SetAnimationModeToAnimate();\n  sliderWidgetMaximumV->EnabledOn();\n\n  vtkNew<SliderCallbackMaximumV> callbackMaximumV;\n  callbackMaximumV->Kuen = surface;\n\n  sliderWidgetMaximumV->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackMaximumV);\n\n  surface->SetMinimumU(-4.5);\n  surface->SetMaximumU(4.5);\n  surface->SetMinimumV(0.05);\n  surface->SetMaximumV(vtkMath::Pi() - .05);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  interactor->Initialize();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/ParametricKuenDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParametricKuenDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParametricKuenDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParametricKuenDemo MACOSX_BUNDLE ParametricKuenDemo.cxx )\n  target_link_libraries(ParametricKuenDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParametricKuenDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/ParametricKuenDemo/#download-and-build-parametrickuendemo","title":"Download and Build ParametricKuenDemo","text":"

        Click here to download ParametricKuenDemo and its CMakeLists.txt file. Once the tarball ParametricKuenDemo.tar has been downloaded and extracted,

        cd ParametricKuenDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ParametricKuenDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/ParametricObjectsDemo/","title":"ParametricObjectsDemo","text":"

        vtk-examples/Cxx/GeometricObjects/ParametricObjectsDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/ParametricObjectsDemo/#description","title":"Description","text":"

        Demonstrates the Parametric classes added by Andrew Maclean and additional classes added by Tim Meehan. The parametric spline is also included.

        Options are provided to:

        • Specify a single surface (-s SURFACE_NAME)
        • Color the back-face (-b)
        • Add normals (-n)
        • Display the geometric bounds of the object (-l)

        You can save a screenshot by pressing \"k\".

        With respect to your VTK build you may need to specify one or more of:

        -DVTK_MODULE_ENABLE_VTK_cli11=WANT\n-DVTK_MODULE_ENABLE_VTK_fmt=WANT\n

        If -DVTK_BUILD_TESTING=ON is specified when building VTK then VTK:cli11 and VTK::fmt will be automatically enabled.

        Note

        To really appreciate the complexity of some of these surfaces, select a single surface, and use the options -b -n. Also try specifying wireframe (toggle \"w\" on the keyboard) and zooming in and out.

        Tip

        If you color the back face, the three-dimensional orientable surfaces will only show backface coloring inside the surface e.g ConicSpiral or Torus. For three dimensional non-orientable surfaces; backface coloring is visible because of the twisting used to generate these surfaces e.g Boy or Figure8Klein.

        Cite

        See: Parametric Equations for Surfaces, for more information. This paper provides a description of fifteen surfaces, including their parametric equations and derivatives. Also provided is an example of how to create your own surface, namely the Figure-8 Torus.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/ParametricObjectsDemo/#code","title":"Code","text":"

        ParametricObjectsDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtk_cli11.h>\n#include <vtk_fmt.h>\n// clang-format off\n#include VTK_FMT(fmt/format.h)\n// clang-format on\n\n#include <vtkParametricBoy.h>\n#include <vtkParametricConicSpiral.h>\n#include <vtkParametricCrossCap.h>\n#include <vtkParametricDini.h>\n#include <vtkParametricEllipsoid.h>\n#include <vtkParametricEnneper.h>\n#include <vtkParametricFigure8Klein.h>\n#include <vtkParametricKlein.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricRoman.h>\n#include <vtkParametricSpline.h>\n#include <vtkParametricSuperEllipsoid.h>\n#include <vtkParametricSuperToroid.h>\n#include <vtkParametricTorus.h>\n// Extra parametric surfaces.\n#include <vtkParametricBohemianDome.h>\n#include <vtkParametricBour.h>\n#include <vtkParametricCatalanMinimal.h>\n#include <vtkParametricHenneberg.h>\n#include <vtkParametricKuen.h>\n#include <vtkParametricPluckerConoid.h>\n#include <vtkParametricPseudosphere.h>\n\n// For glyphing\n#include <vtkArrowSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkMaskPoints.h>\n\n// For writing out the image.\n#include <vtkPNGWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <locale>\n#include <map>\n#include <set>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n\n/**\n * Create a map of the parametric functions and set some parameters.\n *\n * @return The map of functions.\n */\nstd::map<std::string, vtkSmartPointer<vtkParametricFunction>>\nGetParametricFunctions();\n\n/**\n * Get the centre of the object from the bounding box.\n */\nstd::vector<double> GetCentre(const std::vector<double>& bounds);\n\n/**\n * Calculate the maximum length of side of the bounding box.\n */\ndouble GetMaximumLength(const std::vector<double>& bounds);\n\n/**\n * Display the dimensions of the bounding box, maximum diagonal length\n *    and coordinates of the centre.\n *\n * @param name: The name of the object.\n * @param bounds: The bounding box of the object.\n *\n */\nvoid DisplayBoundingBoxAndCenter(std::string const& name,\n                                 std::vector<double> const& bounds);\n\nclass PrintCallback : public vtkCallbackCommand\n{\npublic:\n  PrintCallback() : fn_{\"\"}, imageQuality_(1), rgba_(true)\n  {\n  }\n\n  static PrintCallback* New()\n  {\n    return new PrintCallback;\n  }\n\n  /*\n   * Create a vtkCallbackCommand and reimplement it.\n   *\n   */\n  void Execute(vtkObject* caller, unsigned long /*evId*/, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto rwi = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n\n    // Get the keypress\n    std::string key = rwi->GetKeySym();\n    if (key == \"k\" && !fn_.empty())\n    {\n      auto w2If = vtkSmartPointer<vtkWindowToImageFilter>::New();\n      w2If->SetInput(rwi->GetRenderWindow());\n      w2If->SetScale(this->imageQuality_, this->imageQuality_);\n      if (rgba_)\n      {\n        w2If->SetInputBufferTypeToRGBA();\n      }\n      else\n      {\n        w2If->SetInputBufferTypeToRGB();\n      }\n      // Read from the front buffer.\n      w2If->ReadFrontBufferOn();\n      w2If->Update();\n      auto writer = vtkSmartPointer<vtkPNGWriter>::New();\n      writer->SetFileName(fn_.c_str());\n      writer->SetInputConnection(w2If->GetOutputPort());\n      writer->Write();\n      std::cout << \"Screenshot saved to: \" << writer->GetFileName()\n                << std::endl;\n    }\n  }\n\n  /**\n   * Set the parameters for writing the\n   * the render window view to an image file.\n   *\n   * @param fileName The png image file name.\n   * @param imageQuality The image quality.\n   * @param rgba The buffer type, (if true, there is no background in the\n   * screenshot).\n   *\n   */\n  void SetParameters(const std::string& fileName, int imageQuality = 1,\n                     bool rgba = true)\n  {\n    if (!fileName.empty())\n    {\n      this->fn_ = fileName;\n      std::string ext{\".png\"};\n      auto found = this->fn_.find_last_of(\".\");\n      if (found == std::string::npos)\n      {\n        this->fn_ += ext;\n      }\n      else\n      {\n        this->fn_ = fileName.substr(0, fileName.find_last_of(\".\")) += ext;\n      }\n    }\n    this->imageQuality_ = imageQuality;\n    this->rgba_ = rgba;\n  }\n\nprivate:\n  PrintCallback(const PrintCallback&) = delete;\n  void operator=(const PrintCallback&) = delete;\n\n  std::string fn_;\n  int imageQuality_;\n  bool rgba_;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Display the parametric surfaces.\"};\n\n  // Define options\n  std::string surfaceName;\n  app.add_option(\"-s, --surface_name\", surfaceName, \"The name of the surface.\");\n  auto backFace{false};\n  app.add_flag(\"-b, --back_face\", backFace, \"Color the back face.\");\n  auto normals{false};\n  app.add_flag(\"-n, --normals\", normals, \"Display normals.\");\n  auto limits{false};\n  app.add_flag(\"-l, --limits\", limits,\n               \"Display the geometric bounds of the object.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  // Get the parametric functions.\n  auto pfn = GetParametricFunctions();\n\n  // Check for a single surface.\n  std::pair<std::string, bool> singleSurface{\"\", false};\n  if (!surfaceName.empty())\n  {\n    std::string sn = surfaceName;\n    std::transform(sn.begin(), sn.end(), sn.begin(),\n                   [](unsigned char c) { return std::tolower(c); });\n    // Is the surface name in the map?\n    for (auto const& t : pfn)\n    {\n      std::string k = t.first;\n      std::transform(k.begin(), k.end(), k.begin(),\n                     [](unsigned char c) { return std::tolower(c); });\n      if (sn == k)\n      {\n        singleSurface.first = t.first;\n        singleSurface.second = true;\n      }\n    }\n  }\n  if (!surfaceName.empty() && !singleSurface.second)\n  {\n    std::cout << \"Nonexistent surface: \" << surfaceName << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto rendererSize = 200;\n  auto gridColumnDimensions = 5;\n  auto gridRowDimensions = 5;\n\n  if (singleSurface.second)\n  {\n    rendererSize = 1000;\n    gridColumnDimensions = 1;\n    gridRowDimensions = 1;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create one text property for all.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetJustificationToCentered();\n  textProperty->SetFontSize(rendererSize / 12);\n  textProperty->SetColor(colors->GetColor3d(\"LavenderBlush\").GetData());\n\n  // Create a parametric function source, renderer, mapper, and actor\n  // for each object.\n  std::vector<vtkSmartPointer<vtkParametricFunctionSource>> pfnSrcs;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textmappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textactors;\n\n  // Glyph the normals.\n  std::vector<vtkSmartPointer<vtkMaskPoints>> maskPts;\n  std::vector<vtkSmartPointer<vtkArrowSource>> arrow;\n  std::vector<vtkSmartPointer<vtkGlyph3D>> glyph;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> glyphMapper;\n  std::vector<vtkSmartPointer<vtkActor>> glyphActor;\n\n  auto backProperty = vtkSmartPointer<vtkProperty>::New();\n  if (backFace)\n  {\n    backProperty->SetColor(colors->GetColor3d(\"Peru\").GetData());\n  }\n\n  // Now decide on the surfaces to build.\n  std::map<std::string, vtkSmartPointer<vtkParametricFunction>> surfaces;\n  if (singleSurface.second)\n  {\n    surfaces[singleSurface.first] = pfn[singleSurface.first];\n  }\n  else\n  {\n    surfaces = pfn;\n  }\n\n  // The bounding boxes for each object.\n  std::map<std::string, std::vector<double>> boundingBoxes;\n  std::map<int, std::string> indexedNames;\n  //  The index of each parametric object.\n  auto objIdx = -1;\n  for (auto const& obj : surfaces)\n  {\n    objIdx++;\n    indexedNames[objIdx] = obj.first;\n    pfnSrcs.push_back(vtkSmartPointer<vtkParametricFunctionSource>::New());\n    pfnSrcs[objIdx]->SetParametricFunction(obj.second);\n    pfnSrcs[objIdx]->SetUResolution(51);\n    pfnSrcs[objIdx]->SetVResolution(51);\n    pfnSrcs[objIdx]->SetWResolution(51);\n    pfnSrcs[objIdx]->Update();\n\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[objIdx]->SetInputConnection(pfnSrcs[objIdx]->GetOutputPort());\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[objIdx]->SetMapper(mappers[objIdx]);\n    actors[objIdx]->GetProperty()->SetColor(\n        colors->GetColor3d(\"NavajoWhite\").GetData());\n    if (backFace)\n    {\n      actors[objIdx]->SetBackfaceProperty(backProperty);\n    }\n\n    textmappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textmappers[objIdx]->SetInput(obj.first.c_str());\n    textmappers[objIdx]->SetTextProperty(textProperty);\n\n    textactors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    textactors[objIdx]->SetMapper(textmappers[objIdx]);\n    textactors[objIdx]->SetPosition(rendererSize / 2.0, 8);\n\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    renderers[objIdx]->SetBackground(\n        colors->GetColor3d(\"MidnightBlue\").GetData());\n\n    double bounds[6];\n    pfnSrcs[objIdx]->GetOutput()->GetBounds(bounds);\n    std::vector<double> v(std::begin(bounds), std::end(bounds));\n    boundingBoxes[obj.first] = v;\n\n    if (normals)\n    {\n      // Glyphing\n      maskPts.push_back(vtkSmartPointer<vtkMaskPoints>::New());\n      maskPts[objIdx]->RandomModeOn();\n      maskPts[objIdx]->SetMaximumNumberOfPoints(150);\n      maskPts[objIdx]->SetInputConnection(pfnSrcs[objIdx]->GetOutputPort());\n\n      arrow.push_back(vtkSmartPointer<vtkArrowSource>::New());\n      arrow[objIdx]->SetTipResolution(16);\n      arrow[objIdx]->SetTipLength(0.3);\n      arrow[objIdx]->SetTipRadius(0.1);\n\n      auto glyphScale = GetMaximumLength(boundingBoxes[obj.first]);\n\n      glyph.push_back(vtkSmartPointer<vtkGlyph3D>::New());\n      glyph[objIdx]->SetSourceConnection(arrow[objIdx]->GetOutputPort());\n      glyph[objIdx]->SetInputConnection(maskPts[objIdx]->GetOutputPort());\n      glyph[objIdx]->SetVectorModeToUseNormal();\n      glyph[objIdx]->SetScaleFactor(glyphScale / 10.0);\n      glyph[objIdx]->OrientOn();\n      glyph[objIdx]->Update();\n\n      glyphMapper.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n      glyphMapper[objIdx]->SetInputConnection(glyph[objIdx]->GetOutputPort());\n\n      glyphActor.push_back(vtkSmartPointer<vtkActor>::New());\n      glyphActor[objIdx]->SetMapper(glyphMapper[objIdx]);\n      glyphActor[objIdx]->GetProperty()->SetColor(\n          colors->GetColor3d(\"GreenYellow\").GetData());\n    }\n  }\n\n  // Need a renderer even if there is no actor.\n  for (auto i = objIdx; i < gridColumnDimensions * gridRowDimensions; i++)\n  {\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    static_cast<vtkRenderer*>(renderers.back().GetPointer())\n        ->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n    indexedNames[i] = \"\";\n  }\n\n  auto renWin = vtkSmartPointer<vtkRenderWindow>::New();\n  renWin->SetSize(rendererSize * gridColumnDimensions,\n                  rendererSize * gridRowDimensions);\n\n  for (auto row = 0; row < gridRowDimensions; row++)\n  {\n    for (auto col = 0; col < gridColumnDimensions; col++)\n    {\n      auto index = row * gridColumnDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) * rendererSize /\n              (gridColumnDimensions * rendererSize),\n          static_cast<double>(gridRowDimensions - (row + 1)) * rendererSize /\n              (gridRowDimensions * rendererSize),\n          static_cast<double>(col + 1) * rendererSize /\n              (gridColumnDimensions * rendererSize),\n          static_cast<double>(gridRowDimensions - row) * rendererSize /\n              (gridRowDimensions * rendererSize)};\n      renWin->AddRenderer(renderers[index]);\n      renderers[index]->SetViewport(viewport);\n      if (index > objIdx)\n      {\n        continue;\n      }\n      renderers[index]->AddActor(actors[index]);\n      // Normals can only be computed for polygons and triangle strips.\n      // The Spline is a line.\n      if (normals && indexedNames[index] != \"Spline\")\n      {\n        renderers[index]->AddActor(glyphActor[index]);\n      }\n      renderers[index]->AddActor(textactors[index]);\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(-30);\n      renderers[index]->GetActiveCamera()->Zoom(0.9);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  if (limits)\n  {\n    for (auto const& obj : boundingBoxes)\n    {\n      DisplayBoundingBoxAndCenter(obj.first, obj.second);\n    }\n  }\n\n  std::string fn = \"ParametricObjectsDemo\";\n  if (!surfaceName.empty())\n  {\n    fn = singleSurface.first;\n  }\n  renWin->SetWindowName(fn.c_str());\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<PrintCallback> printCallback;\n  printCallback->SetParameters(fn, 1, false);\n\n  iRen->SetRenderWindow(renWin);\n  iRen->AddObserver(vtkCommand::KeyPressEvent, printCallback);\n\n  iRen->Initialize();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::map<std::string, vtkSmartPointer<vtkParametricFunction>>\nGetParametricFunctions()\n{\n  std::map<std::string, vtkSmartPointer<vtkParametricFunction>> pfn;\n  pfn[\"Boy\"] = vtkSmartPointer<vtkParametricBoy>::New();\n  pfn[\"ConicSpiral\"] = vtkSmartPointer<vtkParametricConicSpiral>::New();\n  pfn[\"CrossCap\"] = vtkSmartPointer<vtkParametricCrossCap>::New();\n  pfn[\"Dini\"] = vtkSmartPointer<vtkParametricDini>::New();\n  pfn[\"Ellipsoid\"] = vtkSmartPointer<vtkParametricEllipsoid>::New();\n  pfn[\"Enneper\"] = vtkSmartPointer<vtkParametricEnneper>::New();\n  pfn[\"Figure8Klein\"] = vtkSmartPointer<vtkParametricFigure8Klein>::New();\n  pfn[\"Klein\"] = vtkSmartPointer<vtkParametricKlein>::New();\n  pfn[\"Mobius\"] = vtkSmartPointer<vtkParametricMobius>::New();\n  pfn[\"RandomHills\"] = vtkSmartPointer<vtkParametricRandomHills>::New();\n  pfn[\"Roman\"] = vtkSmartPointer<vtkParametricRoman>::New();\n  pfn[\"SuperEllipsoid\"] = vtkSmartPointer<vtkParametricSuperEllipsoid>::New();\n  pfn[\"SuperToroid\"] = vtkSmartPointer<vtkParametricSuperToroid>::New();\n  pfn[\"Torus\"] = vtkSmartPointer<vtkParametricTorus>::New();\n  pfn[\"Spline\"] = vtkSmartPointer<vtkParametricSpline>::New();\n  // Extra parametric surfaces.\n  pfn[\"BohemianDome\"] = vtkSmartPointer<vtkParametricBohemianDome>::New();\n  pfn[\"Bour\"] = vtkSmartPointer<vtkParametricBour>::New();\n  pfn[\"CatalanMinimal\"] = vtkSmartPointer<vtkParametricCatalanMinimal>::New();\n  pfn[\"Henneberg\"] = vtkSmartPointer<vtkParametricHenneberg>::New();\n  pfn[\"Kuen\"] = vtkSmartPointer<vtkParametricKuen>::New();\n  pfn[\"PluckerConoid\"] = vtkSmartPointer<vtkParametricPluckerConoid>::New();\n  pfn[\"Pseudosphere\"] = vtkSmartPointer<vtkParametricPseudosphere>::New();\n\n  // Now set some parameters.\n  static_cast<vtkParametricEllipsoid*>(pfn[\"Ellipsoid\"].GetPointer())\n      ->SetXRadius(0.5);\n  static_cast<vtkParametricEllipsoid*>(pfn[\"Ellipsoid\"].GetPointer())\n      ->SetYRadius(2.0);\n  static_cast<vtkParametricMobius*>(pfn[\"Mobius\"].GetPointer())->SetRadius(2.0);\n  static_cast<vtkParametricMobius*>(pfn[\"Mobius\"].GetPointer())\n      ->SetMinimumV(-0.5);\n  static_cast<vtkParametricMobius*>(pfn[\"Mobius\"].GetPointer())\n      ->SetMaximumV(0.5);\n  static_cast<vtkParametricRandomHills*>(pfn[\"RandomHills\"].GetPointer())\n      ->AllowRandomGenerationOn();\n  static_cast<vtkParametricRandomHills*>(pfn[\"RandomHills\"].GetPointer())\n      ->SetRandomSeed(1);\n  static_cast<vtkParametricRandomHills*>(pfn[\"RandomHills\"].GetPointer())\n      ->SetNumberOfHills(30);\n  static_cast<vtkParametricSuperEllipsoid*>(pfn[\"SuperEllipsoid\"].GetPointer())\n      ->SetN1(0.5);\n  static_cast<vtkParametricSuperEllipsoid*>(pfn[\"SuperEllipsoid\"].GetPointer())\n      ->SetN2(0.4);\n  static_cast<vtkParametricSuperToroid*>(pfn[\"SuperToroid\"].GetPointer())\n      ->SetN1(0.5);\n  static_cast<vtkParametricSuperToroid*>(pfn[\"SuperToroid\"].GetPointer())\n      ->SetN2(3.0);\n  // The spline needs points\n  vtkNew<vtkPoints> inputPoints;\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  for (auto p = 0; p < 10; p++)\n  {\n    std::array<double, 3> xyz{0, 0, 0};\n    for (auto& idx : xyz)\n    {\n      idx = rng->GetRangeValue(-1.0, 1.0);\n      rng->Next();\n    }\n    inputPoints->InsertNextPoint(xyz.data());\n  }\n  static_cast<vtkParametricSpline*>(pfn[\"Spline\"].GetPointer())\n      ->SetPoints(inputPoints);\n  // Extra parametric surfaces.\n  static_cast<vtkParametricBohemianDome*>(pfn[\"BohemianDome\"].GetPointer())\n      ->SetA(5.0);\n  static_cast<vtkParametricBohemianDome*>(pfn[\"BohemianDome\"].GetPointer())\n      ->SetB(1.0);\n  static_cast<vtkParametricBohemianDome*>(pfn[\"BohemianDome\"].GetPointer())\n      ->SetC(2.0);\n  static_cast<vtkParametricKuen*>(pfn[\"Kuen\"].GetPointer())->SetDeltaV0(0.001);\n  return pfn;\n}\n\nstd::vector<double> GetCentre(const std::vector<double>& bounds)\n{\n  std::vector<double> centre;\n  if (bounds.size() != 6)\n  {\n    return centre;\n  }\n  for (size_t i = 1; i < bounds.size(); i += 2)\n  {\n    centre.push_back(bounds[i] - (bounds[i] - bounds[i - 1]) / 2.0);\n  }\n  return centre;\n}\n\ndouble GetMaximumLength(const std::vector<double>& bounds)\n{\n  auto maxLen = -1.0;\n  if (bounds.size() != 6)\n  {\n    return maxLen;\n  }\n  for (size_t i = 0; i < bounds.size(); i += 2)\n  {\n    maxLen = std::max(maxLen, std::abs(bounds[i + 1] - bounds[i]));\n  }\n  return maxLen;\n}\n\nvoid DisplayBoundingBoxAndCenter(std::string const& name,\n                                 std::vector<double> const& bounds)\n{\n  if (bounds.size() != 6)\n  {\n    return;\n  }\n  auto maxLength = GetMaximumLength(bounds);\n  auto centre = GetCentre(bounds);\n\n  auto s = fmt::format(\"{:<21s}\\n\", name);\n  s += fmt::format(\"{:21s}: \", \"  Bounds (min, max)\");\n  s += fmt::format(\"{:s}:({:6.2f}, {:6.2f}) \", \"x\", bounds[0], bounds[1]);\n  s += fmt::format(\"{:s}:({:6.2f}, {:6.2f}) \", \"y\", bounds[2], bounds[3]);\n  s += fmt::format(\"{:s}:({:6.2f}, {:6.2f})\\n\", \"z\", bounds[4], bounds[5]);\n  s += fmt::format(\"{:21s}: {:6.2f}\\n\", \"  Maximum side length\", maxLength);\n  s += fmt::format(\"{:21s}: ({:6.2f}, {:6.2f}, {:6.2f})\\n\",\n                   \"  Centre (x, y, z)\", centre[0], centre[1], centre[2]);\n  std::cout << s << std::endl;\n}\n\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/ParametricObjectsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParametricObjectsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  fmt\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParametricObjectsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParametricObjectsDemo MACOSX_BUNDLE ParametricObjectsDemo.cxx )\n  target_link_libraries(ParametricObjectsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParametricObjectsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/ParametricObjectsDemo/#download-and-build-parametricobjectsdemo","title":"Download and Build ParametricObjectsDemo","text":"

        Click here to download ParametricObjectsDemo and its CMakeLists.txt file. Once the tarball ParametricObjectsDemo.tar has been downloaded and extracted,

        cd ParametricObjectsDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ParametricObjectsDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/ParametricSuperEllipsoidDemo/","title":"ParametricSuperEllipsoidDemo","text":"

        vtk-examples/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/ParametricSuperEllipsoidDemo/#code","title":"Code","text":"

        ParametricSuperEllipsoidDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSuperEllipsoid.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n\n#include <array>\n\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackN1 : public vtkCommand\n{\npublic:\n  static SliderCallbackN1* New()\n  {\n    return new SliderCallbackN1;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->SuperEllipsoid->SetN1(value);\n  }\n  SliderCallbackN1() : SuperEllipsoid(0)\n  {\n  }\n  vtkParametricSuperEllipsoid* SuperEllipsoid;\n};\n\nclass SliderCallbackN2 : public vtkCommand\n{\npublic:\n  static SliderCallbackN2* New()\n  {\n    return new SliderCallbackN2;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->SuperEllipsoid->SetN2(value);\n  }\n  SliderCallbackN2() : SuperEllipsoid(0)\n  {\n  }\n  vtkParametricSuperEllipsoid* SuperEllipsoid;\n};\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkParametricSuperEllipsoid> surface;\n  vtkNew<vtkParametricFunctionSource> source;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a parametric function source, renderer, mapper, and actor\n  source->SetParametricFunction(surface);\n\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProperty);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ParametricSuperEllipsoidDemo\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(.008);\n  double sliderLength(.008);\n  double titleHeight(.04);\n  double labelHeight(.04);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepN1;\n\n  sliderRepN1->SetMinimumValue(0.0);\n  sliderRepN1->SetMaximumValue(4.0);\n  sliderRepN1->SetValue(1.0);\n  sliderRepN1->SetTitleText(\"Z squareness\");\n\n  sliderRepN1->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN1->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepN1->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN1->GetPoint2Coordinate()->SetValue(.9, .1);\n\n  sliderRepN1->SetTubeWidth(tubeWidth);\n  sliderRepN1->SetSliderLength(sliderLength);\n  sliderRepN1->SetTitleHeight(titleHeight);\n  sliderRepN1->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetN1;\n  sliderWidgetN1->SetInteractor(interactor);\n  sliderWidgetN1->SetRepresentation(sliderRepN1);\n  sliderWidgetN1->SetAnimationModeToAnimate();\n  sliderWidgetN1->EnabledOn();\n\n  vtkNew<SliderCallbackN1> callbackN1;\n  callbackN1->SuperEllipsoid = surface;\n\n  sliderWidgetN1->AddObserver(vtkCommand::InteractionEvent, callbackN1);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepN2;\n\n  sliderRepN2->SetMinimumValue(0.0001);\n  sliderRepN2->SetMaximumValue(4.0);\n  sliderRepN2->SetValue(1.0);\n  sliderRepN2->SetTitleText(\"XY squareness\");\n\n  sliderRepN2->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN2->GetPoint1Coordinate()->SetValue(.1, .9);\n  sliderRepN2->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN2->GetPoint2Coordinate()->SetValue(.9, .9);\n\n  sliderRepN2->SetTubeWidth(tubeWidth);\n  sliderRepN2->SetSliderLength(sliderLength);\n  sliderRepN2->SetTitleHeight(titleHeight);\n  sliderRepN2->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetN2;\n  sliderWidgetN2->SetInteractor(interactor);\n  sliderWidgetN2->SetRepresentation(sliderRepN2);\n  sliderWidgetN2->SetAnimationModeToAnimate();\n  sliderWidgetN2->EnabledOn();\n\n  vtkNew<SliderCallbackN2> callbackN2;\n  callbackN2->SuperEllipsoid = surface;\n\n  sliderWidgetN2->AddObserver(vtkCommand::InteractionEvent, callbackN2);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMinimumV;\n\n  sliderRepN1->SetMinimumValue(.0001);\n  sliderRepMinimumV->SetMaximumValue(.9999 * vtkMath::Pi());\n  sliderRepMinimumV->SetValue(.0001);\n  sliderRepMinimumV->SetTitleText(\"V min\");\n\n  sliderRepMinimumV->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepMinimumV->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint2Coordinate()->SetValue(.1, .9);\n\n  sliderRepMinimumV->SetTubeWidth(tubeWidth);\n  sliderRepMinimumV->SetSliderLength(sliderLength);\n  sliderRepMinimumV->SetTitleHeight(titleHeight);\n  sliderRepMinimumV->SetLabelHeight(labelHeight);\n\n  surface->SetN1(1.0);\n  surface->SetN2(1.0);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  interactor->Initialize();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/ParametricSuperEllipsoidDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParametricSuperEllipsoidDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParametricSuperEllipsoidDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParametricSuperEllipsoidDemo MACOSX_BUNDLE ParametricSuperEllipsoidDemo.cxx )\n  target_link_libraries(ParametricSuperEllipsoidDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParametricSuperEllipsoidDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/ParametricSuperEllipsoidDemo/#download-and-build-parametricsuperellipsoiddemo","title":"Download and Build ParametricSuperEllipsoidDemo","text":"

        Click here to download ParametricSuperEllipsoidDemo and its CMakeLists.txt file. Once the tarball ParametricSuperEllipsoidDemo.tar has been downloaded and extracted,

        cd ParametricSuperEllipsoidDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ParametricSuperEllipsoidDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/ParametricSuperToroidDemo/","title":"ParametricSuperToroidDemo","text":"

        vtk-examples/Cxx/GeometricObjects/ParametricSuperToroidDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/ParametricSuperToroidDemo/#code","title":"Code","text":"

        ParametricSuperToroidDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSuperToroid.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n\n#include <array>\n\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackN1 : public vtkCommand\n{\npublic:\n  static SliderCallbackN1* New()\n  {\n    return new SliderCallbackN1;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->SuperToroid->SetN1(value);\n  }\n  SliderCallbackN1() : SuperToroid(0)\n  {\n  }\n  vtkParametricSuperToroid* SuperToroid;\n};\n\nclass SliderCallbackN2 : public vtkCommand\n{\npublic:\n  static SliderCallbackN2* New()\n  {\n    return new SliderCallbackN2;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->SuperToroid->SetN2(value);\n  }\n  SliderCallbackN2() : SuperToroid(0)\n  {\n  }\n  vtkParametricSuperToroid* SuperToroid;\n};\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkParametricSuperToroid> surface;\n  vtkNew<vtkParametricFunctionSource> source;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a parametric function source, renderer, mapper, and actor\n  source->SetParametricFunction(surface);\n\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProperty);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ParametricSuperToroidDemo\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(.008);\n  double sliderLength(.008);\n  double titleHeight(.04);\n  double labelHeight(.04);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepN1;\n\n  sliderRepN1->SetMinimumValue(0.0);\n  sliderRepN1->SetMaximumValue(4.0);\n  sliderRepN1->SetValue(1.0);\n  sliderRepN1->SetTitleText(\"Z squareness\");\n\n  sliderRepN1->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN1->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepN1->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN1->GetPoint2Coordinate()->SetValue(.9, .1);\n\n  sliderRepN1->SetTubeWidth(tubeWidth);\n  sliderRepN1->SetSliderLength(sliderLength);\n  sliderRepN1->SetTitleHeight(titleHeight);\n  sliderRepN1->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetN1;\n  sliderWidgetN1->SetInteractor(interactor);\n  sliderWidgetN1->SetRepresentation(sliderRepN1);\n  sliderWidgetN1->SetAnimationModeToAnimate();\n  sliderWidgetN1->EnabledOn();\n\n  vtkNew<SliderCallbackN1> callbackN1;\n  callbackN1->SuperToroid = surface;\n\n  sliderWidgetN1->AddObserver(vtkCommand::InteractionEvent, callbackN1);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepN2;\n\n  sliderRepN2->SetMinimumValue(0.0001);\n  sliderRepN2->SetMaximumValue(4.0);\n  sliderRepN2->SetValue(1.0);\n  sliderRepN2->SetTitleText(\"XY squareness\");\n\n  sliderRepN2->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN2->GetPoint1Coordinate()->SetValue(.1, .9);\n  sliderRepN2->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepN2->GetPoint2Coordinate()->SetValue(.9, .9);\n\n  sliderRepN2->SetTubeWidth(tubeWidth);\n  sliderRepN2->SetSliderLength(sliderLength);\n  sliderRepN2->SetTitleHeight(titleHeight);\n  sliderRepN2->SetLabelHeight(labelHeight);\n\n  vtkNew<vtkSliderWidget> sliderWidgetN2;\n  sliderWidgetN2->SetInteractor(interactor);\n  sliderWidgetN2->SetRepresentation(sliderRepN2);\n  sliderWidgetN2->SetAnimationModeToAnimate();\n  sliderWidgetN2->EnabledOn();\n\n  vtkNew<SliderCallbackN2> callbackN2;\n  callbackN2->SuperToroid = surface;\n\n  sliderWidgetN2->AddObserver(vtkCommand::InteractionEvent, callbackN2);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepMinimumV;\n\n  sliderRepN1->SetMinimumValue(.0001);\n  sliderRepMinimumV->SetMaximumValue(.9999 * vtkMath::Pi());\n  sliderRepMinimumV->SetValue(.0001);\n  sliderRepMinimumV->SetTitleText(\"V min\");\n\n  sliderRepMinimumV->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepMinimumV->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepMinimumV->GetPoint2Coordinate()->SetValue(.1, .9);\n\n  sliderRepMinimumV->SetTubeWidth(tubeWidth);\n  sliderRepMinimumV->SetSliderLength(sliderLength);\n  sliderRepMinimumV->SetTitleHeight(titleHeight);\n  sliderRepMinimumV->SetLabelHeight(labelHeight);\n\n  surface->SetN1(1.0);\n  surface->SetN2(1.0);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  interactor->Initialize();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/ParametricSuperToroidDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParametricSuperToroidDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParametricSuperToroidDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParametricSuperToroidDemo MACOSX_BUNDLE ParametricSuperToroidDemo.cxx )\n  target_link_libraries(ParametricSuperToroidDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParametricSuperToroidDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/ParametricSuperToroidDemo/#download-and-build-parametricsupertoroiddemo","title":"Download and Build ParametricSuperToroidDemo","text":"

        Click here to download ParametricSuperToroidDemo and its CMakeLists.txt file. Once the tarball ParametricSuperToroidDemo.tar has been downloaded and extracted,

        cd ParametricSuperToroidDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ParametricSuperToroidDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Plane/","title":"Plane","text":"

        vtk-examples/Cxx/GeometricObjects/Plane

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Plane/#description","title":"Description","text":"

        vtkPlaneSource object creates an m x n array of quadrilaterals arranged as a regular tiling in a plane.

        The plane is defined by specifying an origin point, and then two other points that, together with the origin, define two axes for the plane. These axes do not have to be orthogonal - so you can create a parallelogram. (The axes must not be parallel.) The resolution of the plane (i.e., number of subdivisions) is controlled by the ivars XResolution and YResolution.

        By default, the plane is centered at the origin and perpendicular to the z-axis, with width and height of length 1 and resolutions set to 1.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Plane/#code","title":"Code","text":"

        Plane.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 77, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create a plane\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->SetCenter(1.0, 0.0, 0.0);\n  planeSource->SetNormal(1.0, 0.0, 1.0);\n  planeSource->Update();\n\n  vtkPolyData* plane = planeSource->GetOutput();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(plane);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // Create a renderer, render window and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Plane\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Plane/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Plane)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Plane: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Plane MACOSX_BUNDLE Plane.cxx )\n  target_link_libraries(Plane PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Plane\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Plane/#download-and-build-plane","title":"Download and Build Plane","text":"

        Click here to download Plane and its CMakeLists.txt file. Once the tarball Plane.tar has been downloaded and extracted,

        cd Plane/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Plane\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/PlaneSourceDemo/","title":"PlaneSourceDemo","text":"

        vtk-examples/Cxx/GeometricObjects/PlaneSourceDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/PlaneSourceDemo/#description","title":"Description","text":"

        The example displays the various instance variables that define a vtkPlaneSource.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/PlaneSourceDemo/#code","title":"Code","text":"

        PlaneSourceDemo.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> CreateArrow(double& length,\n                                         std::array<double, 3>& startPoint,\n                                         std::array<double, 3>& endPoint);\n}\n\nint main(int, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"DarkSlateGray\");\n  vtkColor3d legendBackgroundColor = colors->GetColor3d(\"SlateGray\");\n  vtkColor3d originColor = colors->GetColor3d(\"OrangeRed\");\n  vtkColor3d centerColor = colors->GetColor3d(\"Gold\");\n  vtkColor3d point1Color = colors->GetColor3d(\"MediumSpringGreen\");\n  vtkColor3d point2Color = colors->GetColor3d(\"Brown\");\n  vtkColor3d xAxisColor = colors->GetColor3d(\"lime\");\n  vtkColor3d yAxisColor = colors->GetColor3d(\"orange\");\n  vtkColor3d normalColor = colors->GetColor3d(\"Raspberry\");\n\n  // Create actors\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->SetOrigin(0.0, 0.0, 0.0);\n  planeSource->SetPoint1(1, 0, 0);\n  planeSource->SetPoint2(0, 1.0, 0);\n  planeSource->Update();\n\n  std::array<double, 6> bounds;\n  planeSource->GetOutput()->GetBounds(bounds.data());\n  double length = std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]);\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(planeSource->GetOutputPort());\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(length * .04);\n  vtkNew<vtkPolyDataMapper> originMapper;\n  originMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> originActor;\n  originActor->SetPosition(planeSource->GetOrigin());\n  originActor->SetMapper(originMapper);\n  originActor->GetProperty()->SetDiffuseColor(originColor.GetData());\n\n  vtkNew<vtkPolyDataMapper> centerMapper;\n  centerMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> centerActor;\n  centerActor->SetPosition(planeSource->GetCenter());\n  centerActor->SetMapper(centerMapper);\n  centerActor->GetProperty()->SetDiffuseColor(centerColor.GetData());\n\n  vtkNew<vtkPolyDataMapper> point1Mapper;\n  point1Mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> point1Actor;\n  point1Actor->SetPosition(planeSource->GetPoint1());\n  point1Actor->SetMapper(point1Mapper);\n  point1Actor->GetProperty()->SetDiffuseColor(point1Color.GetData());\n\n  vtkNew<vtkPolyDataMapper> point2Mapper;\n  point2Mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> point2Actor;\n  point2Actor->SetPosition(planeSource->GetPoint2());\n  point2Actor->SetMapper(point2Mapper);\n  point2Actor->GetProperty()->SetDiffuseColor(point2Color.GetData());\n\n  std::array<double, 3> center;\n  std::array<double, 3> origin;\n  std::array<double, 3> normal;\n  std::array<double, 3> point1;\n  std::array<double, 3> point2;\n  for (auto i = 0; i < 3; ++i)\n  {\n    point1[i] = planeSource->GetPoint1()[i];\n    point2[i] = planeSource->GetPoint2()[i];\n    origin[i] = planeSource->GetOrigin()[i];\n    center[i] = planeSource->GetCenter()[i];\n    normal[i] = planeSource->GetNormal()[i] * length;\n  }\n  auto xAxisPolyData = CreateArrow(length, origin, point1);\n  vtkNew<vtkPolyDataMapper> xAxisMapper;\n  xAxisMapper->SetInputData(xAxisPolyData);\n  vtkNew<vtkActor> xAxisActor;\n  xAxisActor->SetMapper(xAxisMapper);\n  xAxisActor->GetProperty()->SetDiffuseColor(xAxisColor.GetData());\n\n  auto yAxisPolyData = CreateArrow(length, origin, point2);\n  vtkNew<vtkPolyDataMapper> yAxisMapper;\n  yAxisMapper->SetInputData(yAxisPolyData);\n  vtkNew<vtkActor> yAxisActor;\n  yAxisActor->SetMapper(yAxisMapper);\n  yAxisActor->GetProperty()->SetDiffuseColor(yAxisColor.GetData());\n\n  auto normalPolyData = CreateArrow(length, origin, normal);\n  vtkNew<vtkPolyDataMapper> normalMapper;\n  normalMapper->SetInputData(normalPolyData);\n  vtkNew<vtkActor> normalActor;\n  normalActor->SetMapper(normalMapper);\n  normalActor->GetProperty()->SetDiffuseColor(normalColor.GetData());\n\n  // Create the RenderWindow, Renderer\n  //\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkLegendBoxActor> legend;\n  legend->SetNumberOfEntries(7);\n  legend->UseBackgroundOn();\n  legend->SetBackgroundColor(legendBackgroundColor.GetData());\n  legend->GetPositionCoordinate()->SetValue(.7, .7);\n  legend->GetPosition2Coordinate()->SetValue(.3, .3);\n  int entry = 0;\n  legend->SetEntry(entry++, sphereSource->GetOutput(), \"center\",\n                   centerColor.GetData());\n  legend->SetEntry(entry++, sphereSource->GetOutput(), \"origin\",\n                   originColor.GetData());\n  legend->SetEntry(entry++, sphereSource->GetOutput(), \"point1\",\n                   point1Color.GetData());\n  legend->SetEntry(entry++, sphereSource->GetOutput(), \"point2\",\n                   point2Color.GetData());\n  legend->SetEntry(entry++, xAxisPolyData, \"xAxis\", xAxisColor.GetData());\n  legend->SetEntry(entry++, xAxisPolyData, \"yAxis\", yAxisColor.GetData());\n  legend->SetEntry(entry++, xAxisPolyData, \"normal\", normalColor.GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PlaneSourceDemo\");\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->AddActor(planeActor);\n  renderer->AddActor(originActor);\n  renderer->AddActor(centerActor);\n  renderer->AddActor(point1Actor);\n  renderer->AddActor(point2Actor);\n  renderer->AddActor(xAxisActor);\n  renderer->AddActor(yAxisActor);\n  renderer->AddActor(normalActor);\n  renderer->AddActor(legend);\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> CreateArrow(double& pdLength,\n                                         std::array<double, 3>& startPoint,\n                                         std::array<double, 3>& endPoint)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n  arrowSource->SetShaftRadius(pdLength * .01);\n  arrowSource->SetShaftResolution(20);\n  arrowSource->SetTipLength(pdLength * .1);\n  arrowSource->SetTipRadius(pdLength * .05);\n  arrowSource->SetTipResolution(20);\n\n  // Compute a basis\n  std::array<double, 3> normalizedX;\n  std::array<double, 3> normalizedY;\n  std::array<double, 3> normalizedZ;\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint.data(), startPoint.data(), normalizedX.data());\n  double length = vtkMath::Norm(normalizedX.data());\n  vtkMath::Normalize(normalizedX.data());\n\n  // The Z axis is an arbitrary vector cross X\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n\n  std::array<double, 3> arbitrary;\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX.data(), arbitrary.data(), normalizedZ.data());\n  vtkMath::Normalize(normalizedZ.data());\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ.data(), normalizedX.data(), normalizedY.data());\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (auto i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint.data());\n  transform->Concatenate(matrix);\n  transform->Scale(length, length, length);\n\n  // Transform the polydata\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(arrowSource->GetOutputPort());\n  transformPD->Update();\n  polyData = transformPD->GetOutput();\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/PlaneSourceDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlaneSourceDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlaneSourceDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlaneSourceDemo MACOSX_BUNDLE PlaneSourceDemo.cxx )\n  target_link_libraries(PlaneSourceDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlaneSourceDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/PlaneSourceDemo/#download-and-build-planesourcedemo","title":"Download and Build PlaneSourceDemo","text":"

        Click here to download PlaneSourceDemo and its CMakeLists.txt file. Once the tarball PlaneSourceDemo.tar has been downloaded and extracted,

        cd PlaneSourceDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PlaneSourceDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Planes/","title":"Planes","text":"

        vtk-examples/Cxx/GeometricObjects/Planes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Planes/#code","title":"Code","text":"

        Planes.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkHull.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <string>\n#include <vector>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // These are the two methods we will use.\n  std::vector<std::string> titles{\"Using frustum planes\", \"Using bounds\"};\n  std::vector<vtkSmartPointer<vtkPlanes>> planes;\n  for (auto i = 0; i < titles.size(); ++i)\n  {\n    planes.push_back(vtkSmartPointer<vtkPlanes>::New());\n  }\n\n  // Using frustum planes.\n  vtkNew<vtkCamera> camera;\n  double planesArray[24];\n  camera->GetFrustumPlanes(1, planesArray);\n  planes[0]->SetFrustumPlanes(planesArray);\n\n  // Using bounds.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n  double bounds[6];\n  sphereSource->GetOutput()->GetBounds(bounds);\n  planes[1]->SetBounds(bounds);\n\n  // At this point we have the planes created by both of the methods above.\n  // You can do whatever you want with them.\n\n  // For visualisation we will produce an n-sided convex hull\n  // and visualise it.\n\n  // Create a common text property.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetJustificationToCentered();\n\n  // Create the render window and interactor.\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"Planes\");\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  std::vector<vtkSmartPointer<vtkHull>> hulls;\n  std::vector<vtkSmartPointer<vtkPolyData>> pds;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  for (auto i = 0; i < titles.size(); ++i)\n  {\n    hulls.push_back(vtkSmartPointer<vtkHull>::New());\n    hulls[i]->SetPlanes(planes[i]);\n\n    pds.push_back(vtkSmartPointer<vtkPolyData>::New());\n\n    // To generate the convex hull we supply a vtkPolyData object and a bounding\n    // box.\n    // We define the bounding box to be where we expect the resulting polyhedron\n    // to lie.\n    // Make it a generous fit as it is only used to create the initial\n    // polygons that are eventually clipped.\n    hulls[i]->GenerateHull(pds[i], -200, 200, -200, 200, -200, 200);\n\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputData(pds[i]);\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(\n        colors->GetColor3d(\"Moccasin\").GetData());\n    actors[i]->GetProperty()->SetSpecular(0.8);\n    actors[i]->GetProperty()->SetSpecularPower(30);\n\n    textMappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textMappers[i]->SetInput(titles[i].c_str());\n    textMappers[i]->SetTextProperty(textProperty);\n\n    textActors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    textActors[i]->SetMapper(textMappers[i]);\n    textActors[i]->SetPosition(120, 16);\n\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    renderers[i]->AddActor(actors[i]);\n    renderers[i]->AddViewProp(textActors[i]);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  // Setup the viewports\n  auto xGridDimensions = 2;\n  auto yGridDimensions = 1;\n  auto rendererSize = 300;\n  renWin->SetSize(rendererSize * xGridDimensions,\n                  rendererSize * yGridDimensions);\n  for (auto row = 0; row < yGridDimensions; ++row)\n  {\n    for (auto col = 0; col < xGridDimensions; ++col)\n    {\n      auto index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      if (index > (actors.size() - 1))\n      {\n        // Add a renderer even if there is no actor.\n        // This makes the render window background all the same color.\n        vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();\n        ren->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n        ren->SetViewport(viewport);\n        renWin->AddRenderer(ren);\n        continue;\n      }\n\n      renderers[index]->SetViewport(viewport);\n      renderers[index]->SetBackground(\n          colors->GetColor3d(\"DarkSlateGray\").GetData());\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(-30);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  iRen->Initialize();\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Planes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Planes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Planes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Planes MACOSX_BUNDLE Planes.cxx )\n  target_link_libraries(Planes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Planes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Planes/#download-and-build-planes","title":"Download and Build Planes","text":"

        Click here to download Planes and its CMakeLists.txt file. Once the tarball Planes.tar has been downloaded and extracted,

        cd Planes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Planes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/PlanesIntersection/","title":"PlanesIntersection","text":"

        vtk-examples/Cxx/GeometricObjects/PlanesIntersection

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/PlanesIntersection/#code","title":"Code","text":"

        PlanesIntersection.cxx

        #include <vtkNew.h>\n#include <vtkPlanesIntersection.h>\n#include <vtkPoints.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  double bounds[6];\n  sphereSource->GetOutput()->GetBounds(bounds);\n\n  vtkNew<vtkPoints> box;\n\n  box->SetNumberOfPoints(8);\n\n  double xMin, xMax, yMin, yMax, zMin, zMax;\n  xMin = bounds[0];\n  xMax = bounds[1];\n  yMin = bounds[2];\n  yMax = bounds[3];\n  zMin = bounds[4];\n  zMax = bounds[5];\n\n  box->SetPoint(0, xMax, yMin, zMax);\n  box->SetPoint(1, xMax, yMin, zMin);\n  box->SetPoint(2, xMax, yMax, zMin);\n  box->SetPoint(3, xMax, yMax, zMax);\n  box->SetPoint(4, xMin, yMin, zMax);\n  box->SetPoint(5, xMin, yMin, zMin);\n  box->SetPoint(6, xMin, yMax, zMin);\n  box->SetPoint(7, xMin, yMax, zMax);\n\n  vtkNew<vtkPlanesIntersection> planesIntersection;\n  planesIntersection->SetBounds(bounds);\n\n  int intersects = planesIntersection->IntersectsRegion(box);\n  auto res = (intersects == 1) ? \"Yes\" : \"No\";\n\n  std::cout << \"Intersects? \" << res << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/PlanesIntersection/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlanesIntersection)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlanesIntersection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlanesIntersection MACOSX_BUNDLE PlanesIntersection.cxx )\n  target_link_libraries(PlanesIntersection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlanesIntersection\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/PlanesIntersection/#download-and-build-planesintersection","title":"Download and Build PlanesIntersection","text":"

        Click here to download PlanesIntersection and its CMakeLists.txt file. Once the tarball PlanesIntersection.tar has been downloaded and extracted,

        cd PlanesIntersection/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PlanesIntersection\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/PlatonicSolids/","title":"PlatonicSolids","text":"

        vtk-examples/Cxx/GeometricObjects/PlatonicSolids

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/PlatonicSolids/#description","title":"Description","text":"

        Display all five Platonic solids in a grid.

        Platonic solids are regular, convex polyhedrons. They are constructed by congruent (identical in shape and size) regular (all angles equal and all sides equal) polygonal faces with the same number of faces meeting at each vertex.

        Five solids satisfy the above criteria:

        Figure Tetrahedron Cube Octahedron Icosahedron Dodecahedron Vertices 4 8 6 (2 \u00d7 3) 12 (4 \u00d7 3) 20 (8 + 4 \u00d7 3) Edges 6 12 12 30 30 Faces 4 6 8 20 12

        The relationship between vertices, edges and faces is given by Euler's formula:

        V - E + F = 2\n

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/PlatonicSolids/#code","title":"Code","text":"

        PlatonicSolids.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextActor.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <functional>\n#include <string>\n#include <tuple>\n#include <vector>\n\nnamespace {\n\n/** Get the platonic solid names and initial orientations.\n *\n * @return The solids and their initial orientations.\n */\nstd::vector<std::tuple<std::string, double, double, double>>\nGetNameOrientation();\n\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  // Create a common text property.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetJustificationToCentered();\n\n  // Create the render window and interactor.\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"PlatonicSolids\");\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Platonic solids and orientation for display.\n  auto nameOrientation = GetNameOrientation();\n  auto lut = GetPlatonicLUT();\n  std::vector<vtkSmartPointer<vtkPlatonicSolidSource>> PlatonicSolids;\n\n  for (auto i = 0; i < nameOrientation.size(); ++i)\n  {\n    PlatonicSolids.push_back(vtkSmartPointer<vtkPlatonicSolidSource>::New());\n    PlatonicSolids[i]->SetSolidType(i);\n\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputConnection(PlatonicSolids[i]->GetOutputPort());\n    mappers[i]->SetLookupTable(lut);\n    mappers[i]->SetScalarRange(0, 19);\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n\n    textMappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textMappers[i]->SetInput(std::get<0>(nameOrientation[i]).c_str());\n    textMappers[i]->SetTextProperty(textProperty);\n\n    textActors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    textActors[i]->SetMapper(textMappers[i]);\n    textActors[i]->SetPosition(120, 16);\n\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    renderers[i]->AddActor(actors[i]);\n    renderers[i]->AddViewProp(textActors[i]);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  // Set up the viewports\n  auto gridDimensionsX = 3;\n  auto gridDimensionsY = 2;\n  auto rendererSize = 300;\n  renWin->SetSize(rendererSize * gridDimensionsX,\n                  rendererSize * gridDimensionsY);\n  for (auto row = 0; row < gridDimensionsY; ++row)\n  {\n    for (auto col = 0; col < gridDimensionsX; ++col)\n    {\n      auto index = row * gridDimensionsX + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / gridDimensionsX,\n          static_cast<double>(gridDimensionsY - (row + 1)) / gridDimensionsY,\n          static_cast<double>(col + 1) / gridDimensionsX,\n          static_cast<double>(gridDimensionsY - row) / gridDimensionsY};\n      if (index > (actors.size() - 1))\n      {\n        // Add a renderer even if there is no actor.\n        // This makes the render window background all the same color.\n        vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();\n        ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n        ren->SetViewport(viewport);\n        renWin->AddRenderer(ren);\n        continue;\n      }\n\n      renderers[index]->SetViewport(viewport);\n      renderers[index]->SetBackground(\n          colors->GetColor3d(\"SlateGray\").GetData());\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(\n          std::get<1>(nameOrientation[index]));\n      renderers[index]->GetActiveCamera()->Elevation(\n          std::get<2>(nameOrientation[index]));\n      renderers[index]->GetActiveCamera()->Zoom(\n          std::get<3>(nameOrientation[index]));\n    }\n  }\n\n  iRen->Initialize();\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::vector<std::tuple<std::string, double, double, double>>\nGetNameOrientation()\n{\n  auto getTuple = [](std::string const& name, double const& azimuth,\n                     double const& elevation, double const& zoom) {\n    return std::make_tuple(name, azimuth, elevation, zoom);\n  };\n\n  std::vector<std::tuple<std::string, double, double, double>> res;\n  res.push_back(getTuple(\"Tetrahedron\", 45.0, 30.0, 1.0));\n  res.push_back(getTuple(\"Cube\", -60.0, 45.0, 0.8));\n  res.push_back(getTuple(\"Octahedron\", -15.0, 10.0, 1.0));\n  res.push_back(getTuple(\"Icosahedron\", 4.5, 18.0, 1.0));\n  res.push_back(getTuple(\"Dodecahedron\", 171.0, 22.0, 1.0));\n\n  return res;\n}\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/PlatonicSolids/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlatonicSolids)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlatonicSolids: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlatonicSolids MACOSX_BUNDLE PlatonicSolids.cxx )\n  target_link_libraries(PlatonicSolids PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlatonicSolids\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/PlatonicSolids/#download-and-build-platonicsolids","title":"Download and Build PlatonicSolids","text":"

        Click here to download PlatonicSolids and its CMakeLists.txt file. Once the tarball PlatonicSolids.tar has been downloaded and extracted,

        cd PlatonicSolids/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PlatonicSolids\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Point/","title":"Point","text":"

        vtk-examples/Cxx/GeometricObjects/Point

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Point/#description","title":"Description","text":"

        vtkPoints object represents 3D points. The data model for vtkPoints is an array of vx-vy-vz triplets accessible by (point or cell) id.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Point/#code","title":"Code","text":"

        Point.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the geometry of a point (the coordinate)\n  vtkNew<vtkPoints> points;\n  const float p[3] = {1.0, 2.0, 3.0};\n\n  // Create the topology of the point (a vertex)\n  vtkNew<vtkCellArray> vertices;\n  // We need an an array of point id's for InsertNextCell.\n  vtkIdType pid[1];\n  pid[0] = points->InsertNextPoint(p);\n  vertices->InsertNextCell(1, pid);\n\n  // Create a polydata object\n  vtkNew<vtkPolyData> point;\n\n  // Set the points and vertices we created as the geometry and topology of the\n  // polydata\n  point->SetPoints(points);\n  point->SetVerts(vertices);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(point);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetPointSize(20);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Point\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Point/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Point)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Point: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Point MACOSX_BUNDLE Point.cxx )\n  target_link_libraries(Point PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Point\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Point/#download-and-build-point","title":"Download and Build Point","text":"

        Click here to download Point and its CMakeLists.txt file. Once the tarball Point.tar has been downloaded and extracted,

        cd Point/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Point\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/PolyLine/","title":"PolyLine","text":"

        vtk-examples/Cxx/GeometricObjects/PolyLine

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/PolyLine/#description","title":"Description","text":"

        The polyline is a composite one-dimensional cell consisting of one or more connected lines. The polyline is defined by an ordered list of n+1 points, where n is the number of lines in the polyline. Each pair of points (i, i+1) defines a line.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/PolyLine/#code","title":"Code","text":"

        PolyLine.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create five points.\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n  double p2[3] = {0.0, 1.0, 2.0};\n  double p3[3] = {1.0, 2.0, 3.0};\n\n  // Create a vtkPoints object and store the points in it.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(origin);\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n\n  vtkNew<vtkPolyLine> polyLine;\n  polyLine->GetPointIds()->SetNumberOfIds(5);\n  for (unsigned int i = 0; i < 5; i++)\n  {\n    polyLine->GetPointIds()->SetId(i, i);\n  }\n\n  // Create a cell array to store the lines in and add the lines to it.\n  vtkNew<vtkCellArray> cells;\n  cells->InsertNextCell(polyLine);\n\n  // Create a polydata to store everything in.\n  vtkNew<vtkPolyData> polyData;\n\n  // Add the points to the dataset.\n  polyData->SetPoints(points);\n\n  // Add the lines to the dataset.\n  polyData->SetLines(cells);\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"PolyLine\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkOliveGreen\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/PolyLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyLine MACOSX_BUNDLE PolyLine.cxx )\n  target_link_libraries(PolyLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyLine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/PolyLine/#download-and-build-polyline","title":"Download and Build PolyLine","text":"

        Click here to download PolyLine and its CMakeLists.txt file. Once the tarball PolyLine.tar has been downloaded and extracted,

        cd PolyLine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyLine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/PolyLine1/","title":"PolyLine1","text":"

        vtk-examples/Cxx/GeometricObjects/PolyLine1

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/PolyLine1/#code","title":"Code","text":"

        PolyLine1.cxx

        #include <algorithm>\n#include <array>\n#include <cmath>\n#include <vector>\n#include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // vtkPoints represents 3D points. The data model for vtkPoints is an array of\n  // vx-vy-vz triplets accessible by (point or cell) id.\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(6);\n  double c = std::cos(vtkMath::Pi() / 6); // helper variable\n  points->SetPoint(0, 0.0, -1.0, 0.0);\n  points->SetPoint(1, c, -0.5, 0.0);\n  points->SetPoint(2, c, 0.5, 0.0);\n  points->SetPoint(3, 0.0, 1.0, 0.0);\n  points->SetPoint(4, -c, 0.5, 0.0);\n  points->SetPoint(5, -c, -0.5, 0.0);\n\n  // vtkCellArray is a supporting object that explicitly represents cell\n  // connectivity.\n  // The cell array structure is a raw integer list of the form:\n  // (n,id1,id2,...,idn, n,id1,id2,...,idn, ...) where n is the number of points\n  // in\n  // the cell, and id is a zero-offset index into an associated point list.\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(7);\n  lines->InsertCellPoint(0);\n  lines->InsertCellPoint(1);\n  lines->InsertCellPoint(2);\n  lines->InsertCellPoint(3);\n  lines->InsertCellPoint(4);\n  lines->InsertCellPoint(5);\n  lines->InsertCellPoint(0);\n\n  // vtkPolyData is a data object that is a concrete implementation of\n  // vtkDataSet.\n  // vtkPolyData represents a geometric structure consisting of vertices, lines,\n  // polygons, and/or triangle strips\n  vtkNew<vtkPolyData> polygon;\n  polygon->SetPoints(points);\n  polygon->SetLines(lines);\n\n  // vtkPolyDataMapper is a class that maps polygonal data (i.e., vtkPolyData)\n  // to graphics primitives\n  vtkNew<vtkPolyDataMapper> polygonMapper;\n  polygonMapper->SetInputData(polygon);\n  polygonMapper->Update();\n\n  // Create an actor to represent the polygon. The actor orchestrates rendering\n  // of\n  // the mapper's graphics primitives. An actor also refers to properties via a\n  // vtkProperty instance, and includes an internal transformation matrix. We\n  // set this actor's mapper to be polygonMapper which we created above.\n  vtkNew<vtkActor> polygonActor;\n  polygonActor->SetMapper(polygonMapper);\n  polygonActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the\n  // background color here.\n  vtkNew<vtkRenderer> ren;\n  ren->AddActor(polygonActor);\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Automatically set up the camera based on the visible actors.\n  // The camera will reposition itself to view the center point of the actors,\n  // and move along its initial view plane normal\n  // (i.e., vector defined from camera position to focal point) so that all of\n  // the\n  // actors can be seen.\n  ren->ResetCamera();\n\n  // Finally we create the render window which will show up on the screen\n  // We put our renderer into the render window using AddRenderer. We\n  // also set the size to be 300 pixels by 300.\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"OrderedPolyLine\");\n  renWin->AddRenderer(ren);\n  renWin->SetSize(300, 300);\n\n  // The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n  // mouse) in the vtkRenderWindow. These events are translated into\n  // event invocations that VTK understands (see VTK/Common/vtkCommand.h\n  // for all events that VTK processes). Then observers of these VTK\n  // events can process them as appropriate.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/PolyLine1/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyLine1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyLine1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyLine1 MACOSX_BUNDLE PolyLine1.cxx )\n  target_link_libraries(PolyLine1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyLine1\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/PolyLine1/#download-and-build-polyline1","title":"Download and Build PolyLine1","text":"

        Click here to download PolyLine1 and its CMakeLists.txt file. Once the tarball PolyLine1.tar has been downloaded and extracted,

        cd PolyLine1/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyLine1\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Polygon/","title":"Polygon","text":"

        vtk-examples/Cxx/GeometricObjects/Polygon

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Polygon/#description","title":"Description","text":"

        The polygon is a primary two-dimensional cell. The polygon is defined by an ordered list of three or more points lying in a plane. The polygon normal is implicitly defined by a counterclockwise ordering of its points using the right-hand rule.

        The polygon may be nonconvex, but may not have internal loops, and it cannot self-intersect. The polygon has n edges, where n is the number of points in the polygon.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Polygon/#code","title":"Code","text":"

        Polygon.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolygon.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup four points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Create the polygon\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPointIds()->SetNumberOfIds(4); // make a quad\n  polygon->GetPointIds()->SetId(0, 0);\n  polygon->GetPointIds()->SetId(1, 1);\n  polygon->GetPointIds()->SetId(2, 2);\n  polygon->GetPointIds()->SetId(3, 3);\n\n  // Add the polygon to a list of polygons\n  vtkNew<vtkCellArray> polygons;\n  polygons->InsertNextCell(polygon);\n\n  // Create a PolyData\n  vtkNew<vtkPolyData> polygonPolyData;\n  polygonPolyData->SetPoints(points);\n  polygonPolyData->SetPolys(polygons);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polygonPolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Polygon\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Polygon/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Polygon)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Polygon: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Polygon MACOSX_BUNDLE Polygon.cxx )\n  target_link_libraries(Polygon PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Polygon\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Polygon/#download-and-build-polygon","title":"Download and Build Polygon","text":"

        Click here to download Polygon and its CMakeLists.txt file. Once the tarball Polygon.tar has been downloaded and extracted,

        cd Polygon/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Polygon\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/PolygonIntersection/","title":"PolygonIntersection","text":"

        vtk-examples/Cxx/GeometricObjects/PolygonIntersection

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/PolygonIntersection/#code","title":"Code","text":"

        PolygonIntersection.cxx

        #include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolygon.h>\n\nint main(int, char*[])\n{\n  // Create a square in the XY plane\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Create the polygon\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPoints()->DeepCopy(points);\n  polygon->GetPointIds()->SetNumberOfIds(4); // 4 corners of the square\n  polygon->GetPointIds()->SetId(0, 0);\n  polygon->GetPointIds()->SetId(1, 1);\n  polygon->GetPointIds()->SetId(2, 2);\n  polygon->GetPointIds()->SetId(3, 3);\n\n  // Inputs\n  double p1[3] = {0.1, 0, -1.0};\n  double p2[3] = {0.1, 0, 1.0};\n  double tolerance = 0.001;\n  // Outputs\n  double t; // Parametric coordinate of intersection (0 (corresponding to p1) to\n            // 1 (corresponding to p2))\n  double x[3]; // The coordinate of the intersection\n  double pcoords[3];\n  int subId;\n\n  vtkIdType iD =\n      polygon->IntersectWithLine(p1, p2, tolerance, t, x, pcoords, subId);\n\n  auto res = (iD == 1) ? \"Yes\" : \"No\";\n  std::cout << \"intersected? \" << res << std::endl;\n  std::cout << \"intersection: \" << x[0] << \" \" << x[1] << \" \" << x[2]\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/PolygonIntersection/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolygonIntersection)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolygonIntersection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolygonIntersection MACOSX_BUNDLE PolygonIntersection.cxx )\n  target_link_libraries(PolygonIntersection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolygonIntersection\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/PolygonIntersection/#download-and-build-polygonintersection","title":"Download and Build PolygonIntersection","text":"

        Click here to download PolygonIntersection and its CMakeLists.txt file. Once the tarball PolygonIntersection.tar has been downloaded and extracted,

        cd PolygonIntersection/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolygonIntersection\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Polyhedron/","title":"Polyhedron","text":"

        vtk-examples/Cxx/GeometricObjects/Polyhedron

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Polyhedron/#code","title":"Code","text":"

        Polyhedron.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the polyhedron, a cube.\n  vtkIdType pointIds[8] = {0, 1, 2, 3, 4, 5, 6, 7};\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(-1.0, -1.0, -1.0);\n  points->InsertNextPoint(1.0, -1.0, -1.0);\n  points->InsertNextPoint(1.0, 1.0, -1.0);\n  points->InsertNextPoint(-1.0, 1.0, -1.0);\n  points->InsertNextPoint(-1.0, -1.0, 1.0);\n  points->InsertNextPoint(1.0, -1.0, 1.0);\n  points->InsertNextPoint(1.0, 1.0, 1.0);\n  points->InsertNextPoint(-1.0, 1.0, 1.0);\n\n  vtkNew<vtkIdList> faces;\n  vtkIdType face0[4] = {0, 3, 2, 1};\n  vtkIdType face1[4] = {0, 4, 7, 3};\n  vtkIdType face2[4] = {4, 5, 6, 7};\n  vtkIdType face3[4] = {5, 1, 2, 6};\n  vtkIdType face4[4] = {0, 1, 5, 4};\n  vtkIdType face5[4] = {2, 3, 7, 6};\n\n  auto addFace = [&](const vtkIdType face[4]) {\n    faces->InsertNextId(4);\n    for (int i = 0; i < 4; ++i)\n    {\n      faces->InsertNextId(face[i]);\n    }\n  };\n\n  addFace(face0);\n  addFace(face1);\n  addFace(face2);\n  addFace(face3);\n  addFace(face4);\n  addFace(face5);\n\n  vtkNew<vtkUnstructuredGrid> ugrid;\n  ugrid->SetPoints(points);\n  ugrid->InsertNextCell(VTK_POLYHEDRON, 8, pointIds, 6, faces->GetPointer(0));\n\n  // Here we write out the cube.\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetInputData(ugrid);\n  writer->SetFileName(\"polyhedron.vtu\");\n  writer->SetDataModeToAscii();\n  writer->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(ugrid);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  // Visualize.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Polyhedron\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Polyhedron/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Polyhedron)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Polyhedron: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Polyhedron MACOSX_BUNDLE Polyhedron.cxx )\n  target_link_libraries(Polyhedron PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Polyhedron\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Polyhedron/#download-and-build-polyhedron","title":"Download and Build Polyhedron","text":"

        Click here to download Polyhedron and its CMakeLists.txt file. Once the tarball Polyhedron.tar has been downloaded and extracted,

        cd Polyhedron/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Polyhedron\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Pyramid/","title":"Pyramid","text":"

        vtk-examples/Cxx/GeometricObjects/Pyramid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Pyramid/#code","title":"Code","text":"

        Pyramid.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkPyramid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n\n  float p0[3] = {1.0, 1.0, 1.0};\n  float p1[3] = {-1.0, 1.0, 1.0};\n  float p2[3] = {-1.0, -1.0, 1.0};\n  float p3[3] = {1.0, -1.0, 1.0};\n  float p4[3] = {0.0, 0.0, 0.0};\n\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n  points->InsertNextPoint(p4);\n\n  vtkNew<vtkPyramid> pyramid;\n  pyramid->GetPointIds()->SetId(0, 0);\n  pyramid->GetPointIds()->SetId(1, 1);\n  pyramid->GetPointIds()->SetId(2, 2);\n  pyramid->GetPointIds()->SetId(3, 3);\n  pyramid->GetPointIds()->SetId(4, 4);\n\n  vtkNew<vtkCellArray> cells;\n  cells->InsertNextCell(pyramid);\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(pyramid->GetCellType(), pyramid->GetPointIds());\n\n  // Create an actor and mapper\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(ug);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Pyramid\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n\n  // Create a nice view\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(180);\n  renderer->GetActiveCamera()->Elevation(-20);\n  renderer->ResetCameraClippingRange();\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Pyramid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Pyramid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Pyramid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Pyramid MACOSX_BUNDLE Pyramid.cxx )\n  target_link_libraries(Pyramid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Pyramid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Pyramid/#download-and-build-pyramid","title":"Download and Build Pyramid","text":"

        Click here to download Pyramid and its CMakeLists.txt file. Once the tarball Pyramid.tar has been downloaded and extracted,

        cd Pyramid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Pyramid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Quad/","title":"Quad","text":"

        vtk-examples/Cxx/GeometricObjects/Quad

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Quad/#code","title":"Code","text":"

        Quad.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuad.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create four points (must be in counter clockwise order)\n  double p0[3] = {0.0, 0.0, 0.0};\n  double p1[3] = {1.0, 0.0, 0.0};\n  double p2[3] = {1.0, 1.0, 0.0};\n  double p3[3] = {0.0, 1.0, 0.0};\n\n  // Add the points to a vtkPoints object\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n\n  // Create a quad on the four points\n  vtkNew<vtkQuad> quad;\n  quad->GetPointIds()->SetId(0, 0);\n  quad->GetPointIds()->SetId(1, 1);\n  quad->GetPointIds()->SetId(2, 2);\n  quad->GetPointIds()->SetId(3, 3);\n\n  // Create a cell array to store the quad in\n  vtkNew<vtkCellArray> quads;\n  quads->InsertNextCell(quad);\n\n  // Create a polydata to store everything in\n  vtkNew<vtkPolyData> polydata;\n\n  // Add the points and quads to the dataset\n  polydata->SetPoints(points);\n  polydata->SetPolys(quads);\n\n  // Setup actor and mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Quad\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Quad/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Quad)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Quad: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Quad MACOSX_BUNDLE Quad.cxx )\n  target_link_libraries(Quad PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Quad\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Quad/#download-and-build-quad","title":"Download and Build Quad","text":"

        Click here to download Quad and its CMakeLists.txt file. Once the tarball Quad.tar has been downloaded and extracted,

        cd Quad/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Quad\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/QuadraticHexahedron/","title":"QuadraticHexahedron","text":"

        vtk-examples/Cxx/GeometricObjects/QuadraticHexahedron

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/QuadraticHexahedron/#code","title":"Code","text":"

        QuadraticHexahedron.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkQuadraticHexahedron.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTessellatorFilter.h>\n#include <vtkUnstructuredGrid.h>\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticHexahedron();\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  auto uGrid = MakeQuadraticHexahedron();\n\n  vtkNew<vtkTessellatorFilter> tessellate;\n  tessellate->SetInputData(uGrid);\n  tessellate->SetMaximumNumberOfSubdivisions(2);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(tessellate->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the grid\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(0.02);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputData(uGrid);\n  glyph3D->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  vtkNew<vtkDataSetMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n  glyph3DMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"QuadraticHexahedron\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyph3DActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticHexahedron()\n{\n  vtkNew<vtkQuadraticHexahedron> aHexahedron;\n  vtkNew<vtkPoints> points;\n\n  double* pcoords = aHexahedron->GetParametricCoords();\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  points->SetNumberOfPoints(aHexahedron->GetNumberOfPoints());\n  rng->SetSeed(5070); // for testing\n  for (auto i = 0; i < aHexahedron->GetNumberOfPoints(); ++i)\n  {\n    double perturbation[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rng->Next();\n      perturbation[j] = rng->GetRangeValue(-0.1, 0.1);\n    }\n    aHexahedron->GetPointIds()->SetId(i, i);\n    points->SetPoint(i, *(pcoords + 3 * i) + perturbation[0],\n                     *(pcoords + 3 * i + 1) + perturbation[1],\n                     *(pcoords + 3 * i + 2) + perturbation[2]);\n  }\n\n  // Add the points and hexahedron to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(aHexahedron->GetCellType(), aHexahedron->GetPointIds());\n\n  return uGrid;\n}\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/QuadraticHexahedron/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadraticHexahedron)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadraticHexahedron: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadraticHexahedron MACOSX_BUNDLE QuadraticHexahedron.cxx )\n  target_link_libraries(QuadraticHexahedron PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadraticHexahedron\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/QuadraticHexahedron/#download-and-build-quadratichexahedron","title":"Download and Build QuadraticHexahedron","text":"

        Click here to download QuadraticHexahedron and its CMakeLists.txt file. Once the tarball QuadraticHexahedron.tar has been downloaded and extracted,

        cd QuadraticHexahedron/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QuadraticHexahedron\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/QuadraticHexahedronDemo/","title":"QuadraticHexahedronDemo","text":"

        vtk-examples/Cxx/GeometricObjects/QuadraticHexahedronDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/QuadraticHexahedronDemo/#description","title":"Description","text":"

        This example shows the effect of changing the chord length error for a vtkQuadraticHexahedron.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/QuadraticHexahedronDemo/#code","title":"Code","text":"

        QuadraticHexahedronDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCellIterator.h>\n#include <vtkCommand.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGenericCell.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkQuadraticHexahedron.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTessellatorFilter.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <map>\n#include <sstream>\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticHexahedron();\n\nvoid MakeWidget(vtkSmartPointer<vtkSliderWidget>& widget,\n                vtkSmartPointer<vtkTessellatorFilter>& tessellate,\n                vtkSmartPointer<vtkTextMapper>& textMapper,\n                vtkSmartPointer<vtkRenderWindowInteractor>& interactor);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n  auto uGrid = MakeQuadraticHexahedron();\n\n  vtkSmartPointer<vtkTessellatorFilter> tessellate =\n      vtkSmartPointer<vtkTessellatorFilter>::New();\n  tessellate->SetInputData(uGrid);\n  tessellate->SetChordError(0.035);\n  tessellate->Update();\n\n  typedef std::map<const char*, int> CellContainer;\n  CellContainer cellMap;\n\n  int numTets = 0;\n  vtkNew<vtkGenericCell> cell;\n  auto it = tessellate->GetOutput()->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    it->GetCell(cell);\n    cellMap[cell->GetRepresentativeCell()->GetClassName()]++;\n    ++numTets;\n  }\n  it->Delete();\n\n  vtkSmartPointer<vtkDataSetMapper> mapper =\n      vtkSmartPointer<vtkDataSetMapper>::New();\n  mapper->SetInputConnection(tessellate->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the grid\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(0.02);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputData(uGrid);\n  glyph3D->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  vtkNew<vtkDataSetMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n  glyph3DMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(24);\n\n  std::stringstream ss;\n  ss << \"# of Tetras: \" << numTets << std::endl;\n  vtkSmartPointer<vtkTextMapper> textMapper =\n      vtkSmartPointer<vtkTextMapper>::New();\n  textMapper->SetInput(ss.str().c_str());\n  textMapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetPosition(10, 400);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"QuadraticHexahedronDemo\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 512);\n  vtkSmartPointer<vtkRenderWindowInteractor> interactor =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkSmartPointer<vtkSliderWidget> widget =\n      vtkSmartPointer<vtkSliderWidget>::New();\n  MakeWidget(widget, tessellate, textMapper, interactor);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyph3DActor);\n  renderer->AddViewProp(textActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackChordError : public vtkCommand\n{\npublic:\n  static SliderCallbackChordError* New()\n  {\n    return new SliderCallbackChordError;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->Tessellator->SetChordError(value);\n    this->Tessellator->SetMaximumNumberOfSubdivisions(4);\n    this->Tessellator->Update();\n\n    typedef std::map<const char*, int> CellContainer;\n    CellContainer cellMap;\n\n    int numTets = 0;\n    vtkNew<vtkGenericCell> cell;\n    auto it = this->Tessellator->GetOutput()->NewCellIterator();\n    for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n    {\n      it->GetCell(cell);\n      cellMap[cell->GetRepresentativeCell()->GetClassName()]++;\n      ++numTets;\n    }\n    std::stringstream ss;\n    ss << \"# of Tetras: \" << numTets << std::endl;\n    TextMapper->SetInput(ss.str().c_str());\n  }\n  SliderCallbackChordError() : Tessellator(0), TextMapper(0)\n  {\n  }\n  vtkTessellatorFilter* Tessellator;\n  vtkTextMapper* TextMapper;\n};\n\nvoid MakeWidget(vtkSmartPointer<vtkSliderWidget>& widget,\n                vtkSmartPointer<vtkTessellatorFilter>& tessellate,\n                vtkSmartPointer<vtkTextMapper>& textMapper,\n                vtkSmartPointer<vtkRenderWindowInteractor>& interactor)\n{\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(0.008);\n  double sliderLength(0.008);\n  double titleHeight(0.04);\n  double labelHeight(0.04);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepChordError;\n\n  sliderRepChordError->SetMinimumValue(0.0);\n  sliderRepChordError->SetMaximumValue(0.07);\n  sliderRepChordError->SetValue(tessellate->GetChordError());\n  sliderRepChordError->SetTitleText(\"Chord error\");\n\n  sliderRepChordError->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepChordError->GetPoint1Coordinate()->SetValue(0.1, 0.1);\n  sliderRepChordError->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepChordError->GetPoint2Coordinate()->SetValue(0.9, 0.1);\n\n  sliderRepChordError->SetTubeWidth(tubeWidth);\n  sliderRepChordError->SetSliderLength(sliderLength);\n  sliderRepChordError->SetTitleHeight(titleHeight);\n  sliderRepChordError->SetLabelHeight(labelHeight);\n\n  widget->SetInteractor(interactor);\n  widget->SetRepresentation(sliderRepChordError);\n  widget->SetAnimationModeToAnimate();\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackChordError> callbackChordError;\n  callbackChordError->Tessellator = tessellate;\n  callbackChordError->TextMapper = textMapper;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackChordError);\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticHexahedron()\n{\n  vtkNew<vtkQuadraticHexahedron> aHexahedron;\n  vtkNew<vtkPoints> points;\n\n  double* pcoords = aHexahedron->GetParametricCoords();\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  points->SetNumberOfPoints(aHexahedron->GetNumberOfPoints());\n  rng->SetSeed(5070); // for testing\n  for (auto i = 0; i < aHexahedron->GetNumberOfPoints(); ++i)\n  {\n    double perturbation[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rng->Next();\n      perturbation[j] = rng->GetRangeValue(-0.1, 0.1);\n    }\n    aHexahedron->GetPointIds()->SetId(i, i);\n    points->SetPoint(i, *(pcoords + 3 * i) + perturbation[0],\n                     *(pcoords + 3 * i + 1) + perturbation[1],\n                     *(pcoords + 3 * i + 2) + perturbation[2]);\n  }\n\n  // Add the points and hexahedron to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(aHexahedron->GetCellType(), aHexahedron->GetPointIds());\n\n  return uGrid;\n}\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/QuadraticHexahedronDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadraticHexahedronDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadraticHexahedronDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadraticHexahedronDemo MACOSX_BUNDLE QuadraticHexahedronDemo.cxx )\n  target_link_libraries(QuadraticHexahedronDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadraticHexahedronDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/QuadraticHexahedronDemo/#download-and-build-quadratichexahedrondemo","title":"Download and Build QuadraticHexahedronDemo","text":"

        Click here to download QuadraticHexahedronDemo and its CMakeLists.txt file. Once the tarball QuadraticHexahedronDemo.tar has been downloaded and extracted,

        cd QuadraticHexahedronDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QuadraticHexahedronDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/QuadraticTetra/","title":"QuadraticTetra","text":"

        vtk-examples/Cxx/GeometricObjects/QuadraticTetra

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/QuadraticTetra/#description","title":"Description","text":"

        The quadratic tetrahedron is a primary three-dimensional cell. It is defined by ten points. The first four points are located at the vertices of the tetrahedron; the next six are located in the middle of each of the six edges.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/QuadraticTetra/#code","title":"Code","text":"

        QuadraticTetra.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkQuadraticTetra.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTessellatorFilter.h>\n#include <vtkUnstructuredGrid.h>\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticTetra();\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  auto uGrid = MakeQuadraticTetra();\n\n  vtkNew<vtkTessellatorFilter> tessellate;\n  tessellate->SetInputData(uGrid);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(tessellate->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the grid\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(0.02);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputData(uGrid);\n  glyph3D->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  vtkNew<vtkDataSetMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n  glyph3DMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"QuadraticTetra\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyph3DActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticTetra()\n{\n  vtkNew<vtkQuadraticTetra> aTetra;\n  vtkNew<vtkPoints> points;\n\n  double* pcoords = aTetra->GetParametricCoords();\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  points->SetNumberOfPoints(aTetra->GetNumberOfPoints());\n  rng->SetSeed(5070); // for testing\n  for (auto i = 0; i < aTetra->GetNumberOfPoints(); ++i)\n  {\n    double perturbation[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rng->Next();\n      perturbation[j] = rng->GetRangeValue(-0.1, 0.1);\n    }\n    aTetra->GetPointIds()->SetId(i, i);\n    points->SetPoint(i, *(pcoords + 3 * i) + perturbation[0],\n                     *(pcoords + 3 * i + 1) + perturbation[1],\n                     *(pcoords + 3 * i + 2) + perturbation[2]);\n  }\n\n  // Add the points and tetra to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(aTetra->GetCellType(), aTetra->GetPointIds());\n\n  return uGrid;\n}\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/QuadraticTetra/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadraticTetra)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadraticTetra: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadraticTetra MACOSX_BUNDLE QuadraticTetra.cxx )\n  target_link_libraries(QuadraticTetra PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadraticTetra\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/QuadraticTetra/#download-and-build-quadratictetra","title":"Download and Build QuadraticTetra","text":"

        Click here to download QuadraticTetra and its CMakeLists.txt file. Once the tarball QuadraticTetra.tar has been downloaded and extracted,

        cd QuadraticTetra/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QuadraticTetra\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/QuadraticTetraDemo/","title":"QuadraticTetraDemo","text":"

        vtk-examples/Cxx/GeometricObjects/QuadraticTetraDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/QuadraticTetraDemo/#description","title":"Description","text":"

        This example shows the effect of changing the chord length error for a vtkQuadraticTetra.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/QuadraticTetraDemo/#code","title":"Code","text":"

        QuadraticTetraDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCellIterator.h>\n#include <vtkCommand.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGenericCell.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkQuadraticTetra.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTessellatorFilter.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <map>\n#include <sstream>\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticTetra();\n\nvoid MakeWidget(vtkSmartPointer<vtkSliderWidget>& widget,\n                vtkSmartPointer<vtkTessellatorFilter>& tessellate,\n                vtkSmartPointer<vtkTextMapper>& textMapper,\n                vtkSmartPointer<vtkRenderWindowInteractor>& interactor);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  auto uGrid = MakeQuadraticTetra();\n\n  vtkSmartPointer<vtkTessellatorFilter> tessellate =\n      vtkSmartPointer<vtkTessellatorFilter>::New();\n  tessellate->SetInputData(uGrid);\n  tessellate->SetChordError(.035);\n  tessellate->Update();\n\n  typedef std::map<const char*, int> CellContainer;\n  CellContainer cellMap;\n\n  int numTets = 0;\n  vtkNew<vtkGenericCell> cell;\n  auto it = tessellate->GetOutput()->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    it->GetCell(cell);\n    cellMap[cell->GetRepresentativeCell()->GetClassName()]++;\n    ++numTets;\n  }\n  it->Delete();\n\n  vtkSmartPointer<vtkDataSetMapper> mapper =\n      vtkSmartPointer<vtkDataSetMapper>::New();\n  mapper->SetInputConnection(tessellate->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the grid\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(0.02);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputData(uGrid);\n  glyph3D->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  vtkNew<vtkDataSetMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n  glyph3DMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(24);\n\n  std::stringstream ss;\n  ss << \"# of Tetras: \" << numTets << std::endl;\n  vtkSmartPointer<vtkTextMapper> textMapper =\n      vtkSmartPointer<vtkTextMapper>::New();\n  textMapper->SetInput(ss.str().c_str());\n  textMapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetPosition(10, 400);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"QuadraticTetraDemo\");\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 512);\n  vtkSmartPointer<vtkRenderWindowInteractor> interactor =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkSmartPointer<vtkSliderWidget> widget =\n      vtkSmartPointer<vtkSliderWidget>::New();\n  MakeWidget(widget, tessellate, textMapper, interactor);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyph3DActor);\n  renderer->AddViewProp(textActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackChordError : public vtkCommand\n{\npublic:\n  static SliderCallbackChordError* New()\n  {\n    return new SliderCallbackChordError;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->Tessellator->SetChordError(value);\n    this->Tessellator->SetMaximumNumberOfSubdivisions(5);\n    this->Tessellator->Update();\n\n    typedef std::map<const char*, int> CellContainer;\n    CellContainer cellMap;\n\n    int numTets = 0;\n    vtkNew<vtkGenericCell> cell;\n    auto it = this->Tessellator->GetOutput()->NewCellIterator();\n    for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n    {\n      it->GetCell(cell);\n      cellMap[cell->GetRepresentativeCell()->GetClassName()]++;\n      ++numTets;\n    }\n    std::stringstream ss;\n    ss << \"# of Tetras: \" << numTets << std::endl;\n    TextMapper->SetInput(ss.str().c_str());\n  }\n  SliderCallbackChordError() : Tessellator(0), TextMapper(0)\n  {\n  }\n  vtkTessellatorFilter* Tessellator;\n  vtkTextMapper* TextMapper;\n};\n\nvoid MakeWidget(vtkSmartPointer<vtkSliderWidget>& widget,\n                vtkSmartPointer<vtkTessellatorFilter>& tessellate,\n                vtkSmartPointer<vtkTextMapper>& textMapper,\n                vtkSmartPointer<vtkRenderWindowInteractor>& interactor)\n{\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(0.008);\n  double sliderLength(0.008);\n  double titleHeight(0.04);\n  double labelHeight(0.04);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepChordError;\n\n  sliderRepChordError->SetMinimumValue(0.0);\n  sliderRepChordError->SetMaximumValue(0.07);\n  sliderRepChordError->SetValue(tessellate->GetChordError());\n  sliderRepChordError->SetTitleText(\"Chord error\");\n\n  sliderRepChordError->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepChordError->GetPoint1Coordinate()->SetValue(0.1, 0.1);\n  sliderRepChordError->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepChordError->GetPoint2Coordinate()->SetValue(0.9, 0.1);\n\n  sliderRepChordError->SetTubeWidth(tubeWidth);\n  sliderRepChordError->SetSliderLength(sliderLength);\n  sliderRepChordError->SetTitleHeight(titleHeight);\n  sliderRepChordError->SetLabelHeight(labelHeight);\n\n  widget->SetInteractor(interactor);\n  widget->SetRepresentation(sliderRepChordError);\n  widget->SetAnimationModeToAnimate();\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackChordError> callbackChordError;\n  callbackChordError->Tessellator = tessellate;\n  callbackChordError->TextMapper = textMapper;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackChordError);\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeQuadraticTetra()\n{\n  vtkNew<vtkQuadraticTetra> aTetra;\n  vtkNew<vtkPoints> points;\n\n  double* pcoords = aTetra->GetParametricCoords();\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  points->SetNumberOfPoints(aTetra->GetNumberOfPoints());\n  rng->SetSeed(5070); // for testing\n  for (auto i = 0; i < aTetra->GetNumberOfPoints(); ++i)\n  {\n    double perturbation[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rng->Next();\n      perturbation[j] = rng->GetRangeValue(-0.2, 0.2);\n    }\n    aTetra->GetPointIds()->SetId(i, i);\n    points->SetPoint(i, *(pcoords + 3 * i) + perturbation[0],\n                     *(pcoords + 3 * i + 1) + perturbation[1],\n                     *(pcoords + 3 * i + 2) + perturbation[2]);\n  }\n\n  // Add the points and tetra to an unstructured grid\n  vtkSmartPointer<vtkUnstructuredGrid> uGrid =\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(aTetra->GetCellType(), aTetra->GetPointIds());\n\n  return uGrid;\n}\n} // namespace\n
        "},{"location":"Cxx/GeometricObjects/QuadraticTetraDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadraticTetraDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadraticTetraDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadraticTetraDemo MACOSX_BUNDLE QuadraticTetraDemo.cxx )\n  target_link_libraries(QuadraticTetraDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadraticTetraDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/QuadraticTetraDemo/#download-and-build-quadratictetrademo","title":"Download and Build QuadraticTetraDemo","text":"

        Click here to download QuadraticTetraDemo and its CMakeLists.txt file. Once the tarball QuadraticTetraDemo.tar has been downloaded and extracted,

        cd QuadraticTetraDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QuadraticTetraDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/RegularPolygonSource/","title":"RegularPolygonSource","text":"

        vtk-examples/Cxx/GeometricObjects/RegularPolygonSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/RegularPolygonSource/#description","title":"Description","text":"

        This example creates a pentagon.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/RegularPolygonSource/#code","title":"Code","text":"

        RegularPolygonSource.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRegularPolygonSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a pentagon\n  vtkNew<vtkRegularPolygonSource> polygonSource;\n  polygonSource->SetNumberOfSides(5);\n  polygonSource->SetRadius(5);\n  polygonSource->SetCenter(0, 0, 0);\n\n  vtkNew<vtkShrinkPolyData> shrink;\n  shrink->SetInputConnection(polygonSource->GetOutputPort());\n  shrink->SetShrinkFactor(0.9);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetLineWidth(5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"RegularPolygonSource\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/RegularPolygonSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RegularPolygonSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RegularPolygonSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RegularPolygonSource MACOSX_BUNDLE RegularPolygonSource.cxx )\n  target_link_libraries(RegularPolygonSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RegularPolygonSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/RegularPolygonSource/#download-and-build-regularpolygonsource","title":"Download and Build RegularPolygonSource","text":"

        Click here to download RegularPolygonSource and its CMakeLists.txt file. Once the tarball RegularPolygonSource.tar has been downloaded and extracted,

        cd RegularPolygonSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RegularPolygonSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/ShrinkCube/","title":"ShrinkCube","text":"

        vtk-examples/Cxx/GeometricObjects/ShrinkCube

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/ShrinkCube/#description","title":"Description","text":"

        Generates a cube using vtkCubeSource, then a shrink filter is applied.

        vtkShrinkFilter object shrinks cells composing an arbitrary data set towards their centroid. The centroid of a cell is computed as the average position of the cell points. Shrinking results in disconnecting the cells from one another.

        Seealso

        TessellatedBoxSource generates multiple quads or triangles per side.

        Info

        See Figure 5-17 in Chapter 5 the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/ShrinkCube/#code","title":"Code","text":"

        ShrinkCube.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n\nint main(int, char*[])\n{\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(cubeSource->GetOutputPort());\n  shrink->SetShrinkFactor(.9);\n\n  // Create a mapper and actor.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->SetWindowName(\"ShrinkCube\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/ShrinkCube/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShrinkCube)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShrinkCube: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShrinkCube MACOSX_BUNDLE ShrinkCube.cxx )\n  target_link_libraries(ShrinkCube PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShrinkCube\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/ShrinkCube/#download-and-build-shrinkcube","title":"Download and Build ShrinkCube","text":"

        Click here to download ShrinkCube and its CMakeLists.txt file. Once the tarball ShrinkCube.tar has been downloaded and extracted,

        cd ShrinkCube/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ShrinkCube\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/SourceObjectsDemo/","title":"SourceObjectsDemo","text":"

        vtk-examples/Cxx/GeometricObjects/SourceObjectsDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/SourceObjectsDemo/#description","title":"Description","text":"

        Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source.

        Info

        See Figure 3-26 in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/SourceObjectsDemo/#code","title":"Code","text":"

        SourceObjectsDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkCylinderSource.h>\n#include <vtkDiskSource.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataAlgorithm.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTextSource.h>\n\n#include <array>\n#include <vector>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> sourceObjects;\n  sourceObjects.push_back(vtkSmartPointer<vtkSphereSource>::New());\n  static_cast<vtkSphereSource*>(sourceObjects.back().GetPointer())\n      ->SetPhiResolution(21);\n  static_cast<vtkSphereSource*>(sourceObjects.back().GetPointer())\n      ->SetThetaResolution(21);\n\n  sourceObjects.push_back(vtkSmartPointer<vtkConeSource>::New());\n  static_cast<vtkConeSource*>(sourceObjects.back().GetPointer())\n      ->SetResolution(51);\n\n  sourceObjects.push_back(vtkSmartPointer<vtkCylinderSource>::New());\n  static_cast<vtkCylinderSource*>(sourceObjects.back().GetPointer())\n      ->SetResolution(51);\n\n  sourceObjects.push_back(vtkSmartPointer<vtkCubeSource>::New());\n  sourceObjects.push_back(vtkSmartPointer<vtkPlaneSource>::New());\n  sourceObjects.push_back(vtkSmartPointer<vtkTextSource>::New());\n  static_cast<vtkTextSource*>(sourceObjects.back().GetPointer())\n      ->SetText(\"Hello\");\n  static_cast<vtkTextSource*>(sourceObjects.back().GetPointer())->BackingOff();\n\n  sourceObjects.push_back(vtkSmartPointer<vtkPointSource>::New());\n  static_cast<vtkPointSource*>(sourceObjects.back().GetPointer())\n      ->SetNumberOfPoints(500);\n\n  sourceObjects.push_back(vtkSmartPointer<vtkDiskSource>::New());\n  static_cast<vtkDiskSource*>(sourceObjects.back().GetPointer())\n      ->SetCircumferentialResolution(51);\n\n  sourceObjects.push_back(vtkSmartPointer<vtkLineSource>::New());\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textmappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textactors;\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a source, renderer, mapper, and actor\n  // for each object\n  for (unsigned int i = 0; i < sourceObjects.size(); i++)\n  {\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputConnection(sourceObjects[i]->GetOutputPort());\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(\n        colors->GetColor3d(\"PeachPuff\").GetData());\n    actors[i]->SetBackfaceProperty(backProperty);\n\n    textmappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textmappers[i]->SetInput(sourceObjects[i]->GetClassName());\n    textmappers[i]->SetTextProperty(textProperty);\n\n    textactors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    textactors[i]->SetMapper(textmappers[i]);\n    textactors[i]->SetPosition(120, 16);\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n  }\n\n  auto gridDimensions = 3;\n\n  // Need a renderer even if there is no actor\n  for (auto i = static_cast<int>(sourceObjects.size());\n       i < gridDimensions * gridDimensions; ++i)\n  {\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n  }\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"SourceObjectsDemo\");\n\n  int rendererSize = 300;\n  renderWindow->SetSize(rendererSize * gridDimensions,\n                        rendererSize * gridDimensions);\n\n  for (auto row = 0; row < gridDimensions; row++)\n  {\n    for (auto col = 0; col < gridDimensions; col++)\n    {\n      auto index = row * gridDimensions + col;\n      auto x0 = double(col) / gridDimensions;\n      auto y0 = double(gridDimensions - row - 1) / gridDimensions;\n      auto x1 = double(col + 1) / gridDimensions;\n      auto y1 = double(gridDimensions - row) / gridDimensions;\n      renderWindow->AddRenderer(renderers[index]);\n      renderers[index]->SetViewport(x0, y0, x1, y1);\n\n      if (index > static_cast<int>(sourceObjects.size() - 1))\n      {\n        continue;\n      }\n\n      renderers[index]->AddActor(actors[index]);\n      renderers[index]->AddActor(textactors[index]);\n      renderers[index]->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(30);\n      renderers[index]->GetActiveCamera()->Zoom(0.8);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/SourceObjectsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SourceObjectsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonExecutionModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SourceObjectsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SourceObjectsDemo MACOSX_BUNDLE SourceObjectsDemo.cxx )\n  target_link_libraries(SourceObjectsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SourceObjectsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/SourceObjectsDemo/#download-and-build-sourceobjectsdemo","title":"Download and Build SourceObjectsDemo","text":"

        Click here to download SourceObjectsDemo and its CMakeLists.txt file. Once the tarball SourceObjectsDemo.tar has been downloaded and extracted,

        cd SourceObjectsDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SourceObjectsDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Sphere/","title":"Sphere","text":"

        vtk-examples/Cxx/GeometricObjects/Sphere

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Sphere/#description","title":"Description","text":"

        vtkSphereSource object creates a sphere (represented by polygons) of specified radius centered at the origin.

        The resolution (polygonal discretization) in both the latitude (phi) and longitude (theta) directions can be specified.

        It also is possible to create partial spheres by specifying maximum phi and theta angles. By default, the surface tessellation of the sphere uses triangles; however you can set LatLongTessellation to produce a tessellation using quadrilaterals.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Sphere/#code","title":"Code","text":"

        Sphere.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  // Make the surface smooth.\n  sphereSource->SetPhiResolution(100);\n  sphereSource->SetThetaResolution(100);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Sphere\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Sphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Sphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Sphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Sphere MACOSX_BUNDLE Sphere.cxx )\n  target_link_libraries(Sphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Sphere\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Sphere/#download-and-build-sphere","title":"Download and Build Sphere","text":"

        Click here to download Sphere and its CMakeLists.txt file. Once the tarball Sphere.tar has been downloaded and extracted,

        cd Sphere/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Sphere\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/TessellatedBoxSource/","title":"TessellatedBoxSource","text":"

        vtk-examples/Cxx/GeometricObjects/TessellatedBoxSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/TessellatedBoxSource/#description","title":"Description","text":"

        Generates a box(cube) using vtkTessellatedBoxSource with 6 sides. The faces of the box can be subdivided into multiple triangles or quads.

        Seealso

        Cube generates multiple quads or triangles per side.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/TessellatedBoxSource/#code","title":"Code","text":"

        TessellatedBoxSource.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkTessellatedBoxSource.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n  double bounds[6];\n  bounds[0] = -10.0;\n  bounds[1] = 10.0;\n  bounds[2] = 10.0;\n  bounds[3] = 20.0;\n  bounds[4] = -5.0;\n  bounds[5] = 5.0;\n\n  vtkNew<vtkTessellatedBoxSource> boxSource;\n  boxSource->SetLevel(3);\n  boxSource->QuadsOn();\n  boxSource->SetBounds(bounds);\n  boxSource->SetOutputPointsPrecision(vtkAlgorithm::SINGLE_PRECISION);\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(boxSource->GetOutputPort());\n  shrink->SetShrinkFactor(.8);\n\n  // Create a mapper and actor\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"TessellatedBoxSource\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/TessellatedBoxSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TessellatedBoxSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TessellatedBoxSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TessellatedBoxSource MACOSX_BUNDLE TessellatedBoxSource.cxx )\n  target_link_libraries(TessellatedBoxSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TessellatedBoxSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/TessellatedBoxSource/#download-and-build-tessellatedboxsource","title":"Download and Build TessellatedBoxSource","text":"

        Click here to download TessellatedBoxSource and its CMakeLists.txt file. Once the tarball TessellatedBoxSource.tar has been downloaded and extracted,

        cd TessellatedBoxSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TessellatedBoxSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Tetrahedron/","title":"Tetrahedron","text":"

        vtk-examples/Cxx/GeometricObjects/Tetrahedron

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Tetrahedron/#description","title":"Description","text":"

        Tetrahedron. The tetrahedron is a primary three-dimensional cell. The tetrahedron is defined by a list of four nonplanar points. The tetrahedron has six edges and four triangular faces.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Tetrahedron/#code","title":"Code","text":"

        Tetrahedron.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTetra.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 1);\n\n  points->InsertNextPoint(2, 2, 2);\n  points->InsertNextPoint(3, 2, 2);\n  points->InsertNextPoint(3, 3, 2);\n  points->InsertNextPoint(2, 3, 3);\n\n  // Method 1\n  vtkNew<vtkUnstructuredGrid> unstructuredGrid1;\n  unstructuredGrid1->SetPoints(points);\n\n  vtkIdType ptIds[] = {0, 1, 2, 3};\n  unstructuredGrid1->InsertNextCell(VTK_TETRA, 4, ptIds);\n\n  // Method 2\n  vtkNew<vtkUnstructuredGrid> unstructuredGrid2;\n  unstructuredGrid2->SetPoints(points);\n\n  vtkNew<vtkTetra> tetra;\n\n  tetra->GetPointIds()->SetId(0, 4);\n  tetra->GetPointIds()->SetId(1, 5);\n  tetra->GetPointIds()->SetId(2, 6);\n  tetra->GetPointIds()->SetId(3, 7);\n\n  vtkNew<vtkCellArray> cellArray;\n  cellArray->InsertNextCell(tetra);\n  unstructuredGrid2->SetCells(VTK_TETRA, cellArray);\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper1;\n  mapper1->SetInputData(unstructuredGrid1);\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper2;\n  mapper2->SetInputData(unstructuredGrid2);\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Tetrahedron\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(-10);\n  renderer->GetActiveCamera()->Elevation(-20);\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Tetrahedron/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tetrahedron)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tetrahedron: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tetrahedron MACOSX_BUNDLE Tetrahedron.cxx )\n  target_link_libraries(Tetrahedron PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tetrahedron\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Tetrahedron/#download-and-build-tetrahedron","title":"Download and Build Tetrahedron","text":"

        Click here to download Tetrahedron and its CMakeLists.txt file. Once the tarball Tetrahedron.tar has been downloaded and extracted,

        cd Tetrahedron/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Tetrahedron\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/TextActor/","title":"TextActor","text":"

        vtk-examples/Cxx/GeometricObjects/TextActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/TextActor/#code","title":"Code","text":"

        TextActor.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a rendering window and renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"TextActor\");\n  renWin->AddRenderer(ren);\n\n  // Create a render window interactor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create a text actor.\n  vtkNew<vtkTextActor> txt;\n  txt->SetInput(\"Hello World!\");\n  vtkTextProperty* txtprop = txt->GetTextProperty();\n  txtprop->SetFontFamilyToArial();\n  txtprop->BoldOn();\n  txtprop->SetFontSize(36);\n  txtprop->ShadowOn();\n  txtprop->SetShadowOffset(4, 4);\n  txtprop->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n  txt->SetDisplayPosition(20, 30);\n\n  // Assign actor to the renderer.\n  ren->AddActor(txt);\n  ren->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Enable user interface interactor.\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/TextActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextActor MACOSX_BUNDLE TextActor.cxx )\n  target_link_libraries(TextActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/TextActor/#download-and-build-textactor","title":"Download and Build TextActor","text":"

        Click here to download TextActor and its CMakeLists.txt file. Once the tarball TextActor.tar has been downloaded and extracted,

        cd TextActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TextActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Triangle/","title":"Triangle","text":"

        vtk-examples/Cxx/GeometricObjects/Triangle

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Triangle/#description","title":"Description","text":"

        The triangle is a primary two-dimensional cell. The triangle is defined by a counterclockwise ordered list of three points. The order of the points specifies the direction of the surface normal using the right-hand rule.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Triangle/#code","title":"Code","text":"

        Triangle.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangle.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a triangle.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n\n  vtkNew<vtkCellArray> triangles;\n  triangles->InsertNextCell(triangle);\n\n  // Create a polydata object\n  vtkNew<vtkPolyData> trianglePolyData;\n\n  // Add the geometry and topology to the polydata.\n  trianglePolyData->SetPoints(points);\n  trianglePolyData->SetPolys(triangles);\n\n  // Create mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(trianglePolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and an interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Triangle\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Triangle/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Triangle)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Triangle: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Triangle MACOSX_BUNDLE Triangle.cxx )\n  target_link_libraries(Triangle PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Triangle\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Triangle/#download-and-build-triangle","title":"Download and Build Triangle","text":"

        Click here to download Triangle and its CMakeLists.txt file. Once the tarball Triangle.tar has been downloaded and extracted,

        cd Triangle/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Triangle\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/TriangleStrip/","title":"TriangleStrip","text":"

        vtk-examples/Cxx/GeometricObjects/TriangleStrip

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/TriangleStrip/#description","title":"Description","text":"

        The triangle strip is a composite two-dimensional cell consisting of one or more triangles. The points defining the triangle strip need not lie in a plane. The triangle strip is defined by an ordered list of n+2 points, where n is the number of triangles. The ordering of the points is such that each set of three points defines a triangle.

        Info

        See this wikipedia article for an explanation.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/TriangleStrip/#code","title":"Code","text":"

        TriangleStrip.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangleStrip.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1.5, 1, 0);\n\n  vtkNew<vtkTriangleStrip> triangleStrip;\n  triangleStrip->GetPointIds()->SetNumberOfIds(4);\n  triangleStrip->GetPointIds()->SetId(0, 0);\n  triangleStrip->GetPointIds()->SetId(1, 1);\n  triangleStrip->GetPointIds()->SetId(2, 2);\n  triangleStrip->GetPointIds()->SetId(3, 3);\n\n  vtkNew<vtkCellArray> cells;\n  cells->InsertNextCell(triangleStrip);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetStrips(cells);\n\n  // Create an actor and mapper\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"TriangleStrip\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/TriangleStrip/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TriangleStrip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TriangleStrip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TriangleStrip MACOSX_BUNDLE TriangleStrip.cxx )\n  target_link_libraries(TriangleStrip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TriangleStrip\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/TriangleStrip/#download-and-build-trianglestrip","title":"Download and Build TriangleStrip","text":"

        Click here to download TriangleStrip and its CMakeLists.txt file. Once the tarball TriangleStrip.tar has been downloaded and extracted,

        cd TriangleStrip/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TriangleStrip\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/GeometricObjects/Vertex/","title":"Vertex","text":"

        vtk-examples/Cxx/GeometricObjects/Vertex

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/GeometricObjects/Vertex/#description","title":"Description","text":"

        The vertex is a primary zero-dimensional cell. It is defined by a single point.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/GeometricObjects/Vertex/#code","title":"Code","text":"

        Vertex.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertex.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n\n  vtkNew<vtkVertex> vertex;\n  vertex->GetPointIds()->SetId(0, 0);\n\n  vtkNew<vtkCellArray> vertices;\n  vertices->InsertNextCell(vertex);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetVerts(vertices);\n\n  // Setup actor and mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(30);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Vertex\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/GeometricObjects/Vertex/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Vertex)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Vertex: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Vertex MACOSX_BUNDLE Vertex.cxx )\n  target_link_libraries(Vertex PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Vertex\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/GeometricObjects/Vertex/#download-and-build-vertex","title":"Download and Build Vertex","text":"

        Click here to download Vertex and its CMakeLists.txt file. Once the tarball Vertex.tar has been downloaded and extracted,

        cd Vertex/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Vertex\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/AdjacencyMatrixToEdgeTable/","title":"AdjacencyMatrixToEdgeTable","text":"

        vtk-examples/Cxx/Graphs/AdjacencyMatrixToEdgeTable

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/AdjacencyMatrixToEdgeTable/#code","title":"Code","text":"

        AdjacencyMatrixToEdgeTable.cxx

        /* The output is:\n\n10 20 30\n40 50 60\n70 80 90\n\n+-----------------+------------------+\n|                 | value            |\n+-----------------+------------------+\n| 2               | 30               |\n| 1               | 20               |\n| 0               | 10               |\n| 2               | 60               |\n| 1               | 50               |\n| 0               | 40               |\n| 2               | 90               |\n| 1               | 80               |\n| 0               | 70               |\n+-----------------+------------------+\n\nThe first column is the column index of the item in the 'value' column.\nThe row index is given by the number of times we've previously seen the column\nindex. For some reason, zeros in the matrix are not reported in the table.\n\nFor example, the first row says that the value '30' is in column 2 of the matrix\n(0-based indexing). Since we have not previously seen an item in column 2, it is\nin row 0 of the matrix.\n\nThe fourth row says that the value '60' is also in column 2. We infer that '60'\nis row 1 of the matrix because we have already seen one item (the '30') in\ncolumn 2.\n*/\n\n#include <vtkAdjacencyMatrixToEdgeTable.h>\n#include <vtkArrayData.h>\n#include <vtkArrayPrint.h>\n#include <vtkDenseArray.h>\n#include <vtkNew.h>\n#include <vtkTable.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDenseArray<double>> array;\n\n  array->Resize(3, 3);\n\n  unsigned int counter{1};\n  unsigned int scale{10};\n  for (vtkIdType i = 0; i < array->GetExtents()[0].GetEnd(); i++)\n  {\n    for (vtkIdType j = 0; j < array->GetExtents()[1].GetEnd(); j++)\n    {\n      array->SetValue(i, j, counter * scale);\n      counter++;\n    }\n  }\n\n  vtkPrintMatrixFormat(std::cout, array.GetPointer());\n\n  vtkNew<vtkArrayData> arrayData;\n  arrayData->AddArray(array);\n\n  vtkNew<vtkAdjacencyMatrixToEdgeTable> adjacencyMatrixToEdgeTable;\n  adjacencyMatrixToEdgeTable->SetInputData(arrayData);\n  adjacencyMatrixToEdgeTable->Update();\n\n  adjacencyMatrixToEdgeTable->GetOutput()->Dump();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/AdjacencyMatrixToEdgeTable/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AdjacencyMatrixToEdgeTable)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AdjacencyMatrixToEdgeTable: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AdjacencyMatrixToEdgeTable MACOSX_BUNDLE AdjacencyMatrixToEdgeTable.cxx )\n  target_link_libraries(AdjacencyMatrixToEdgeTable PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AdjacencyMatrixToEdgeTable\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/AdjacencyMatrixToEdgeTable/#download-and-build-adjacencymatrixtoedgetable","title":"Download and Build AdjacencyMatrixToEdgeTable","text":"

        Click here to download AdjacencyMatrixToEdgeTable and its CMakeLists.txt file. Once the tarball AdjacencyMatrixToEdgeTable.tar has been downloaded and extracted,

        cd AdjacencyMatrixToEdgeTable/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AdjacencyMatrixToEdgeTable\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/AdjacentVertexIterator/","title":"AdjacentVertexIterator","text":"

        vtk-examples/Cxx/Graphs/AdjacentVertexIterator

        "},{"location":"Cxx/Graphs/AdjacentVertexIterator/#description","title":"Description","text":"

        The visualization in this example is currently broken. vtkGraphLayoutView does not currently allow coloring with a vtkUnsignedCharArray.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/AdjacentVertexIterator/#code","title":"Code","text":"

        AdjacentVertexIterator.cxx

        #include <vtkAdjacentVertexIterator.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkLookupTable.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkViewTheme.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // create 3 vertices\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  // add edges\n  g->AddEdge(v0, v1);\n  g->AddEdge(v0, v2);\n  g->AddEdge(v2, v3);\n\n  // Create the color array\n  vtkNew<vtkUnsignedCharArray> vertexColors;\n  vertexColors->SetNumberOfComponents(3);\n  vertexColors->SetName(\"color\");\n\n  // setup colors\n  vertexColors->InsertNextTypedTuple(\n      colors->GetColor3ub(\"Blue\").GetData()); // unconnected vertices\n\n  vertexColors->InsertNextTypedTuple(\n      colors->GetColor3ub(\"Red\").GetData()); // origin\n\n  vtkNew<vtkAdjacentVertexIterator> iterator;\n  g->GetAdjacentVertices(0, iterator);\n\n  while (iterator->HasNext())\n  {\n    vtkIdType nextVertex = iterator->Next();\n    std::cout << \"Next vertex: \" << nextVertex << std::endl;\n    vertexColors->InsertNextTypedTuple(\n        colors->GetColor3ub(\"Green\").GetData()); // connected vertices\n  }\n\n  // Add the color array to the graph\n  g->GetVertexData()->AddArray(vertexColors);\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  graphLayoutView->SetLayoutStrategyToTree();\n\n  graphLayoutView->SetVertexColorArrayName(\"color\");\n  graphLayoutView->ColorVerticesOn();\n\n  vtkNew<vtkViewTheme> theme;\n  // theme->SetPointLookupTable(lookupTable);\n  theme->ScalePointLookupTableOff();\n  graphLayoutView->ApplyViewTheme(theme);\n\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetInteractor()->Initialize();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/AdjacentVertexIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AdjacentVertexIterator)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AdjacentVertexIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AdjacentVertexIterator MACOSX_BUNDLE AdjacentVertexIterator.cxx )\n  target_link_libraries(AdjacentVertexIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AdjacentVertexIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/AdjacentVertexIterator/#download-and-build-adjacentvertexiterator","title":"Download and Build AdjacentVertexIterator","text":"

        Click here to download AdjacentVertexIterator and its CMakeLists.txt file. Once the tarball AdjacentVertexIterator.tar has been downloaded and extracted,

        cd AdjacentVertexIterator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AdjacentVertexIterator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/BoostBreadthFirstSearchTree/","title":"BoostBreadthFirstSearchTree","text":"

        vtk-examples/Cxx/Graphs/BoostBreadthFirstSearchTree

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/BoostBreadthFirstSearchTree/#code","title":"Code","text":"

        BoostBreadthFirstSearchTree.cxx

        #include <vtkBoostBreadthFirstSearchTree.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkTree.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 5 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  vtkIdType v4 = g->AddVertex();\n  vtkIdType v5 = g->AddVertex();\n\n  // Create a graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v3);\n  g->AddEdge(v2, v4);\n  g->AddEdge(v4, v5);\n\n  vtkNew<vtkBoostBreadthFirstSearchTree> bfsTree;\n  bfsTree->SetOriginVertex(v5);\n  bfsTree->SetInput(g);\n  bfsTree->Update();\n\n  {\n    // Original graph\n    vtkNew<vtkGraphLayoutView> graphLayoutView;\n    graphLayoutView->AddRepresentationFromInput(g);\n    graphLayoutView->SetLayoutStrategyToTree();\n    graphLayoutView->ResetCamera();\n    graphLayoutView->Render();\n    graphLayoutView->GetInteractor()->Start();\n  }\n\n  {\n    // BFS tree\n    vtkNew<vtkGraphLayoutView> graphLayoutView;\n    graphLayoutView->SetLayoutStrategyToTree();\n    graphLayoutView->AddRepresentationFromInput(bfsTree->GetOutput());\n    graphLayoutView->ResetCamera();\n    graphLayoutView->Render();\n    graphLayoutView->GetInteractor()->Start();\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/BoostBreadthFirstSearchTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoostBreadthFirstSearchTree)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisBoostGraphAlgorithms\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoostBreadthFirstSearchTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoostBreadthFirstSearchTree MACOSX_BUNDLE BoostBreadthFirstSearchTree.cxx )\n  target_link_libraries(BoostBreadthFirstSearchTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoostBreadthFirstSearchTree\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/BoostBreadthFirstSearchTree/#download-and-build-boostbreadthfirstsearchtree","title":"Download and Build BoostBreadthFirstSearchTree","text":"

        Click here to download BoostBreadthFirstSearchTree and its CMakeLists.txt file. Once the tarball BoostBreadthFirstSearchTree.tar has been downloaded and extracted,

        cd BoostBreadthFirstSearchTree/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BoostBreadthFirstSearchTree\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/BreadthFirstDistance/","title":"BreadthFirstDistance","text":"

        vtk-examples/Cxx/Graphs/BreadthFirstDistance

        "},{"location":"Cxx/Graphs/BreadthFirstDistance/#description","title":"Description","text":"

        This example shows how to get the distance from a vertex to the root vertex.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/BreadthFirstDistance/#code","title":"Code","text":"

        BreadthFirstDistance.cxx

        #include <vtkBoostBreadthFirstSearch.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkTree.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  vtkIdType v4 = g->AddVertex();\n\n  // Create a graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v3);\n  g->AddEdge(v2, v4);\n\n  vtkNew<vtkBoostBreadthFirstSearch> BFS;\n  BFS->SetOriginVertex(v1);\n  BFS->SetInput(g);\n  BFS->Update();\n\n  vtkIntArray* level = dynamic_cast<vtkIntArray*>(\n      BFS->GetOutput()->GetVertexData()->GetArray(\"BFS\"));\n  for (vtkIdType i = 0; i < level->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"id \" << i << \" : \" << level->GetValue(i) << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/BreadthFirstDistance/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BreadthFirstDistance)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisBoostGraphAlgorithms\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BreadthFirstDistance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BreadthFirstDistance MACOSX_BUNDLE BreadthFirstDistance.cxx )\n  target_link_libraries(BreadthFirstDistance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BreadthFirstDistance\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/BreadthFirstDistance/#download-and-build-breadthfirstdistance","title":"Download and Build BreadthFirstDistance","text":"

        Click here to download BreadthFirstDistance and its CMakeLists.txt file. Once the tarball BreadthFirstDistance.tar has been downloaded and extracted,

        cd BreadthFirstDistance/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BreadthFirstDistance\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/ColorEdges/","title":"ColorEdges","text":"

        vtk-examples/Cxx/Graphs/ColorEdges

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/ColorEdges/#code","title":"Code","text":"

        ColorEdges.cxx

        #include <vtkCamera.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkViewTheme.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableDirectedGraph> graph;\n\n  // Create a graph.\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddVertex();\n  vtkIdType v3 = graph->AddVertex();\n  graph->AddEdge(v1, v2);\n  graph->AddEdge(v2, v3);\n\n  // Create the color array.\n  vtkNew<vtkIntArray> edgeColors;\n  edgeColors->SetNumberOfComponents(1);\n  edgeColors->SetName(\"Color\");\n\n  vtkNew<vtkLookupTable> lookupTable;\n  lookupTable->SetNumberOfTableValues(2);\n  lookupTable->SetTableValue(0, colors->GetColor4d(\"Red\").GetData());\n  lookupTable->SetTableValue(1, colors->GetColor4d(\"Lime\").GetData());\n  lookupTable->Build();\n\n  edgeColors->InsertNextValue(0);\n  edgeColors->InsertNextValue(1);\n\n  // Add the color array to the graph.\n  graph->GetEdgeData()->AddArray(edgeColors);\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(graph);\n  // Needs VTK::InfovisBoostGraphAlgorithms.\n  // graphLayoutView->SetLayoutStrategyToTree();\n  graphLayoutView->SetLayoutStrategy(\"Simple 2D\");\n\n  graphLayoutView->SetEdgeColorArrayName(\"Color\");\n  graphLayoutView->ColorEdgesOn();\n\n  vtkNew<vtkViewTheme> theme;\n  theme->SetCellLookupTable(lookupTable);\n\n  graphLayoutView->ApplyViewTheme(theme);\n  graphLayoutView->ResetCamera();\n  // graphLayoutView->GetRenderer()->SetBackground(\n  //    colors->GetColor3d(\"Navy\").GetData());\n  // graphLayoutView->GetRenderer()->SetBackground2(\n  //    colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderer()->GetActiveCamera()->Zoom(0.8);\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"ColorEdges\");\n  graphLayoutView->GetInteractor()->Initialize();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/ColorEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorEdges MACOSX_BUNDLE ColorEdges.cxx )\n  target_link_libraries(ColorEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/ColorEdges/#download-and-build-coloredges","title":"Download and Build ColorEdges","text":"

        Click here to download ColorEdges and its CMakeLists.txt file. Once the tarball ColorEdges.tar has been downloaded and extracted,

        cd ColorEdges/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorEdges\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/ColorVertexLabels/","title":"ColorVertexLabels","text":"

        vtk-examples/Cxx/Graphs/ColorVertexLabels

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/ColorVertexLabels/#code","title":"Code","text":"

        ColorVertexLabels.cxx

        #include <vtkCamera.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a graph.\n  vtkNew<vtkMutableDirectedGraph> graph;\n\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddVertex();\n  graph->AddEdge(v1, v2);\n\n  // Create an array for the vertex labels.\n  vtkNew<vtkIntArray> vertexIDs;\n  vertexIDs->SetNumberOfComponents(1);\n  vertexIDs->SetName(\"VertexIDs\");\n\n  // Set the vertex labels\n  vertexIDs->InsertNextValue(0);\n  vertexIDs->InsertNextValue(1);\n\n  // Add the array to the graph.\n  graph->GetVertexData()->AddArray(vertexIDs);\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(graph);\n  graphLayoutView->SetVertexLabelVisibility(true);\n  dynamic_cast<vtkRenderedGraphRepresentation*>(\n      graphLayoutView->GetRepresentation())\n      ->GetVertexLabelTextProperty()\n      ->SetColor(colors->GetColor3d(\"Red\").GetData());\n  graphLayoutView->SetLayoutStrategyToSimple2D();\n  graphLayoutView->SetVertexLabelArrayName(\"VertexIDs\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetRenderer()->GetActiveCamera()->Zoom(0.8);\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"ColorVertexLabels\");\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/ColorVertexLabels/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorVertexLabels)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorVertexLabels: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorVertexLabels MACOSX_BUNDLE ColorVertexLabels.cxx )\n  target_link_libraries(ColorVertexLabels PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorVertexLabels\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/ColorVertexLabels/#download-and-build-colorvertexlabels","title":"Download and Build ColorVertexLabels","text":"

        Click here to download ColorVertexLabels and its CMakeLists.txt file. Once the tarball ColorVertexLabels.tar has been downloaded and extracted,

        cd ColorVertexLabels/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorVertexLabels\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/ColorVerticesLookupTable/","title":"ColorVerticesLookupTable","text":"

        vtk-examples/Cxx/Graphs/ColorVerticesLookupTable

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/ColorVerticesLookupTable/#code","title":"Code","text":"

        ColorVerticesLookupTable.cxx

        #include <vtkCamera.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkViewTheme.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a graph\n  vtkNew<vtkMutableDirectedGraph> graph;\n\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddVertex();\n  vtkIdType v3 = graph->AddVertex();\n  graph->AddEdge(v1, v2);\n  graph->AddEdge(v2, v3);\n\n  // Manually set the position of the vertices\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(2, 0, 0);\n\n  graph->SetPoints(points);\n\n  // Create the color array\n  vtkNew<vtkIntArray> vertexColors;\n  vertexColors->SetNumberOfComponents(1);\n  vertexColors->SetName(\"Color\");\n\n  vtkNew<vtkLookupTable> lookupTable;\n  lookupTable->SetNumberOfTableValues(3);\n  lookupTable->SetTableValue(0, colors->GetColor4d(\"Red\").GetData());\n  lookupTable->SetTableValue(1, colors->GetColor4d(\"White\").GetData());\n  lookupTable->SetTableValue(2, colors->GetColor4d(\"Lime\").GetData());\n  lookupTable->Build();\n\n  vertexColors->InsertNextValue(0);\n  vertexColors->InsertNextValue(1);\n  vertexColors->InsertNextValue(2);\n\n  // Add the color array to the graph\n  graph->GetVertexData()->AddArray(vertexColors);\n\n  // Visualize\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(graph);\n  graphLayoutView->SetLayoutStrategyToPassThrough();\n  graphLayoutView->SetVertexColorArrayName(\"Color\");\n  graphLayoutView->ColorVerticesOn();\n\n  vtkNew<vtkViewTheme> theme;\n  theme->SetPointLookupTable(lookupTable);\n\n  graphLayoutView->ApplyViewTheme(theme);\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"ColorVerticesLookupTable\");\n  graphLayoutView->GetInteractor()->Initialize();\n  graphLayoutView->GetRenderer()->GetActiveCamera()->Zoom(0.8);\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/ColorVerticesLookupTable/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorVerticesLookupTable)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorVerticesLookupTable: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorVerticesLookupTable MACOSX_BUNDLE ColorVerticesLookupTable.cxx )\n  target_link_libraries(ColorVerticesLookupTable PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorVerticesLookupTable\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/ColorVerticesLookupTable/#download-and-build-colorverticeslookuptable","title":"Download and Build ColorVerticesLookupTable","text":"

        Click here to download ColorVerticesLookupTable and its CMakeLists.txt file. Once the tarball ColorVerticesLookupTable.tar has been downloaded and extracted,

        cd ColorVerticesLookupTable/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorVerticesLookupTable\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/ConnectedComponents/","title":"ConnectedComponents","text":"

        vtk-examples/Cxx/Graphs/ConnectedComponents

        "},{"location":"Cxx/Graphs/ConnectedComponents/#description","title":"Description","text":"

        This example constructs a graph with 4 vertices and 2 edges. V1 and V2 are not connected to V3 or V4. We wish to obtain all of the connected components of the graph. The output of the example is a list of component IDs. All vertices with the same ID can be reached from any vertex with the same ID.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/ConnectedComponents/#code","title":"Code","text":"

        ConnectedComponents.cxx

        #include <vtkBoostConnectedComponents.h>\n#include <vtkDataArray.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraph.h>\n#include <vtkIntArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  vtkIdType v4 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v3, v4);\n\n  vtkNew<vtkBoostConnectedComponents> connectedComponents;\n  connectedComponents->SetInput(g);\n  connectedComponents->Update();\n\n  vtkGraph* outputGraph = connectedComponents->GetOutput();\n\n  vtkIntArray* components = dynamic_cast<vtkIntArray*>(\n      outputGraph->GetVertexData()->GetArray(\"component\"));\n\n  for (vtkIdType i = 0; i < components->GetNumberOfTuples(); i++)\n  {\n    int val = components->GetValue(i);\n    std::cout << val << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/ConnectedComponents/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConnectedComponents)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisBoostGraphAlgorithms\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConnectedComponents: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConnectedComponents MACOSX_BUNDLE ConnectedComponents.cxx )\n  target_link_libraries(ConnectedComponents PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConnectedComponents\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/ConnectedComponents/#download-and-build-connectedcomponents","title":"Download and Build ConnectedComponents","text":"

        Click here to download ConnectedComponents and its CMakeLists.txt file. Once the tarball ConnectedComponents.tar has been downloaded and extracted,

        cd ConnectedComponents/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConnectedComponents\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/ConstructGraph/","title":"ConstructGraph","text":"

        vtk-examples/Cxx/Graphs/ConstructGraph

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Graphs/ConstructGraph/#description","title":"Description","text":"

        This example shows how to construct a simple graph.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/ConstructGraph/#code","title":"Code","text":"

        ConstructGraph.cxx

        #include <vtkForceDirectedLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n\n  std::cout << \"Number of vertices: \" << g->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << g->GetNumberOfEdges() << std::endl;\n\n  g->AddEdge(v1, v2);\n\n  std::cout << \"Number of vertices: \" << g->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << g->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkForceDirectedLayoutStrategy> forceDirected;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  // If we create a layout object directly, just set the pointer through this\n  // method.\n  // graphLayoutView->SetLayoutStrategy(forceDirected);\n  graphLayoutView->SetLayoutStrategyToForceDirected();\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"ConstructGraph\");\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/ConstructGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConstructGraph)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConstructGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConstructGraph MACOSX_BUNDLE ConstructGraph.cxx )\n  target_link_libraries(ConstructGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConstructGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/ConstructGraph/#download-and-build-constructgraph","title":"Download and Build ConstructGraph","text":"

        Click here to download ConstructGraph and its CMakeLists.txt file. Once the tarball ConstructGraph.tar has been downloaded and extracted,

        cd ConstructGraph/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConstructGraph\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/ConstructTree/","title":"ConstructTree","text":"

        vtk-examples/Cxx/Graphs/ConstructTree

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/ConstructTree/#code","title":"Code","text":"

        ConstructTree.cxx

        #include <vtkGraphLayoutView.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTree.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableDirectedGraph> graph;\n\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddChild(v1);\n  graph->AddChild(v1);\n  graph->AddChild(v2);\n\n  /*\n  //equivalent to:\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  vtkIdType v4 = g->AddVertex();\n\n  g->AddEdge ( v1, v2 );\n  g->AddEdge ( v1, v3 );\n  g->AddEdge ( v2, v4 );\n  */\n\n  vtkNew<vtkTree> tree;\n  bool success = tree->CheckedShallowCopy(graph);\n  std::cout << \"Success? \" << success << std::endl;\n\n  vtkNew<vtkGraphLayoutView> treeLayoutView;\n  treeLayoutView->AddRepresentationFromInput(tree);\n  treeLayoutView->SetLayoutStrategyToTree();\n  treeLayoutView->ResetCamera();\n  treeLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  treeLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  treeLayoutView->GetRenderWindow()->SetWindowName(\"ConstructTree\");\n  treeLayoutView->Render();\n  treeLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/ConstructTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConstructTree)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConstructTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConstructTree MACOSX_BUNDLE ConstructTree.cxx )\n  target_link_libraries(ConstructTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConstructTree\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/ConstructTree/#download-and-build-constructtree","title":"Download and Build ConstructTree","text":"

        Click here to download ConstructTree and its CMakeLists.txt file. Once the tarball ConstructTree.tar has been downloaded and extracted,

        cd ConstructTree/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConstructTree\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/CreateTree/","title":"CreateTree","text":"

        vtk-examples/Cxx/Graphs/CreateTree

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Graphs/CreateTree/#description","title":"Description","text":"

        We create the tree, and label the vertices and edges.

        Info

        This is an update of the original example found in vtk/Examples/Infovis/Cxx/CreateTree.cxx.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/CreateTree/#code","title":"Code","text":"

        CreateTree.cxx

        /*=========================================================================\n\n  Program:   Visualization Toolkit\n  Module:    CreateTree.cxx\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n//\n// This example creates a tree and labels the vertices and edges.\n//\n\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStringArray.h>\n#include <vtkTree.h>\n#include <vtkViewTheme.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableDirectedGraph> graph;\n  vtkIdType a = graph->AddVertex();\n  vtkIdType b = graph->AddChild(a);\n  vtkIdType c = graph->AddChild(a);\n  vtkIdType d = graph->AddChild(b);\n  vtkIdType e = graph->AddChild(c);\n  vtkIdType f = graph->AddChild(c);\n\n  vtkNew<vtkStringArray> vertexLabels;\n  vertexLabels->SetName(\"VertexLabel\");\n  vertexLabels->InsertValue(a, \"a\");\n  vertexLabels->InsertValue(b, \"b\");\n  vertexLabels->InsertValue(c, \"c\");\n  vertexLabels->InsertValue(d, \"d\");\n  vertexLabels->InsertValue(e, \"e\");\n  vertexLabels->InsertValue(f, \"f\");\n  graph->GetVertexData()->AddArray(vertexLabels);\n  vtkNew<vtkStringArray> edgeLabels;\n  edgeLabels->SetName(\"EdgeLabel\");\n  edgeLabels->InsertValue(graph->GetEdgeId(a, b), \"a -> b\");\n  edgeLabels->InsertValue(graph->GetEdgeId(a, c), \"a -> c\");\n  edgeLabels->InsertValue(graph->GetEdgeId(b, d), \"b -> d\");\n  edgeLabels->InsertValue(graph->GetEdgeId(c, e), \"c -> e\");\n  edgeLabels->InsertValue(graph->GetEdgeId(c, f), \"c -> f\");\n  graph->GetEdgeData()->AddArray(edgeLabels);\n\n  vtkNew<vtkTree> tree;\n  bool validTree = tree->CheckedShallowCopy(graph);\n  if (!validTree)\n  {\n    std::cout << \"Invalid tree\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkGraphLayoutView> view;\n  view->SetRepresentationFromInput(tree);\n  // Apply a theme to the views\n  vtkNew<vtkViewTheme> theme;\n  view->ApplyViewTheme(theme->CreateMellowTheme());\n  view->SetVertexColorArrayName(\"VertexDegree\");\n  view->SetColorVertices(true);\n  view->SetVertexLabelArrayName(\"VertexLabel\");\n  view->SetVertexLabelVisibility(true);\n  view->SetEdgeLabelArrayName(\"EdgeLabel\");\n  view->SetEdgeLabelVisibility(true);\n  view->SetLayoutStrategyToTree();\n\n  view->ResetCamera();\n  view->GetRenderWindow()->SetSize(600, 600);\n  view->GetRenderWindow()->SetWindowName(\"CreateTree\");\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/CreateTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CreateTree)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CreateTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CreateTree MACOSX_BUNDLE CreateTree.cxx )\n  target_link_libraries(CreateTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CreateTree\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/CreateTree/#download-and-build-createtree","title":"Download and Build CreateTree","text":"

        Click here to download CreateTree and its CMakeLists.txt file. Once the tarball CreateTree.tar has been downloaded and extracted,

        cd CreateTree/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CreateTree\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/DepthFirstSearchAnimation/","title":"DepthFirstSearchAnimation","text":"

        vtk-examples/Cxx/Graphs/DepthFirstSearchAnimation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/DepthFirstSearchAnimation/#code","title":"Code","text":"

        DepthFirstSearchAnimation.cxx

        #include <vtkCommand.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkTree.h>\n#include <vtkTreeDFSIterator.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkViewTheme.h>\n\nclass vtkTimerCallback : public vtkCommand\n{\npublic:\n  static vtkTimerCallback* New()\n  {\n    vtkTimerCallback* cb = new vtkTimerCallback;\n    return cb;\n  }\n  virtual void Execute(vtkObject* vtkNotUsed(caller), unsigned long eventId,\n                       void* vtkNotUsed(callData))\n  {\n    if (eventId != vtkCommand::TimerEvent)\n    {\n      return;\n    }\n\n    if (this->dfs->HasNext())\n    {\n      vtkIdType nextVertex = this->dfs->Next();\n      std::cout << \"Next vertex: \" << nextVertex << std::endl;\n      dynamic_cast<vtkIntArray*>(this->Tree->GetVertexData()->GetArray(\"color\"))\n          ->SetValue(nextVertex, 10);\n      this->Tree->Modified();\n      this->GraphLayoutView->AddRepresentationFromInput(this->Tree);\n      this->GraphLayoutView->Render();\n    }\n  }\n\n  void SetDFS(vtkTreeDFSIterator* dfs)\n  {\n    this->dfs = dfs;\n  }\n  void SetTree(vtkTree* tree)\n  {\n    this->Tree = tree;\n  }\n  void SetGraphLayoutView(vtkGraphLayoutView* view)\n  {\n    this->GraphLayoutView = view;\n  }\n\nprivate:\n  vtkTreeDFSIterator* dfs = nullptr;\n  vtkTree* Tree = nullptr;\n  vtkGraphLayoutView* GraphLayoutView = nullptr;\n};\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableDirectedGraph> graph;\n\n  // Create a tree\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddChild(v1);\n  graph->AddChild(v1);\n  graph->AddChild(v2);\n\n  vtkNew<vtkTree> tree;\n  tree->CheckedShallowCopy(graph);\n\n  // Create the color array\n  vtkNew<vtkIntArray> vertexColors;\n  vertexColors->SetNumberOfComponents(1);\n  vertexColors->SetName(\"color\");\n\n  vtkNew<vtkLookupTable> lookupTable;\n\n  lookupTable->SetTableRange(0.0, 10.0);\n  lookupTable->Build();\n\n  for (vtkIdType i = 0; i < tree->GetNumberOfVertices(); i++)\n  {\n    vertexColors->InsertNextValue(0);\n  }\n\n  // Add the color array to the tree\n  tree->GetVertexData()->AddArray(vertexColors);\n\n  // Create a depth first search iterator\n  vtkNew<vtkTreeDFSIterator> dfs;\n  vtkIdType root = tree->GetRoot();\n  dfs->SetStartVertex(root);\n  dfs->SetTree(tree);\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(tree);\n  graphLayoutView->SetLayoutStrategyToTree();\n\n  graphLayoutView->SetVertexColorArrayName(\"color\");\n  graphLayoutView->ColorVerticesOn();\n\n  vtkNew<vtkViewTheme> theme;\n  theme->SetPointLookupTable(lookupTable);\n  theme->ScalePointLookupTableOff();\n\n  graphLayoutView->ApplyViewTheme(theme);\n  graphLayoutView->ResetCamera();\n  graphLayoutView->Render();\n\n  // Sign up to receive TimerEvent\n  vtkNew<vtkTimerCallback> cb;\n  cb->SetDFS(dfs);\n  cb->SetTree(tree);\n  cb->SetGraphLayoutView(graphLayoutView);\n\n  graphLayoutView->GetInteractor()->CreateRepeatingTimer(1000);\n  graphLayoutView->GetInteractor()->AddObserver(vtkCommand::TimerEvent, cb);\n\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/DepthFirstSearchAnimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DepthFirstSearchAnimation)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DepthFirstSearchAnimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DepthFirstSearchAnimation MACOSX_BUNDLE DepthFirstSearchAnimation.cxx )\n  target_link_libraries(DepthFirstSearchAnimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DepthFirstSearchAnimation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/DepthFirstSearchAnimation/#download-and-build-depthfirstsearchanimation","title":"Download and Build DepthFirstSearchAnimation","text":"

        Click here to download DepthFirstSearchAnimation and its CMakeLists.txt file. Once the tarball DepthFirstSearchAnimation.tar has been downloaded and extracted,

        cd DepthFirstSearchAnimation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DepthFirstSearchAnimation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/DepthFirstSearchIterator/","title":"DepthFirstSearchIterator","text":"

        vtk-examples/Cxx/Graphs/DepthFirstSearchIterator

        "},{"location":"Cxx/Graphs/DepthFirstSearchIterator/#description","title":"Description","text":"

        This example traverses a tree in a depth first fashion.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/DepthFirstSearchIterator/#code","title":"Code","text":"

        DepthFirstSearchIterator.cxx

        #include <vtkBoostBreadthFirstSearch.h>\n#include <vtkBoostPrimMinimumSpanningTree.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkTree.h>\n#include <vtkTreeDFSIterator.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  // Create a fully connected graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v2, v3);\n  g->AddEdge(v1, v3);\n\n  // Create the edge weight array\n  vtkNew<vtkDoubleArray> weights;\n  weights->SetNumberOfComponents(1);\n  weights->SetName(\"Weights\");\n\n  // Set the edge weights\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(2.0);\n\n  // Add the edge weight array to the graph\n  g->GetEdgeData()->AddArray(weights);\n\n  // Output original graph info\n  std::cout << \"Original Graph\" << std::endl << \"----------\" << std::endl;\n  std::cout << \"Number of vertices: \" << g->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << g->GetNumberOfEdges() << std::endl;\n\n  // Setup the minimum spanning tree filter\n  vtkNew<vtkBoostPrimMinimumSpanningTree> minimumSpanningTreeFilter;\n  minimumSpanningTreeFilter->SetOriginVertex(v1);\n  minimumSpanningTreeFilter->SetInput(g);\n  minimumSpanningTreeFilter->SetEdgeWeightArrayName(\"Weights\");\n\n  // Compute the minimum spanning tree\n  minimumSpanningTreeFilter->Update();\n\n  // Get the output tree\n  vtkNew<vtkTree> minimumSpanningTree;\n  minimumSpanningTree->ShallowCopy(minimumSpanningTreeFilter->GetOutput());\n\n  // Output information about the minimum spanning tree\n  std::cout << std::endl;\n  std::cout << \"Minimum spanning tree\" << std::endl\n            << \"----------\" << std::endl;\n  std::cout << \"Number of vertices: \"\n            << minimumSpanningTree->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << minimumSpanningTree->GetNumberOfEdges()\n            << std::endl;\n\n  vtkIdType root = minimumSpanningTree->GetRoot();\n  std::cout << \"Root: \" << root << std::endl;\n\n  vtkNew<vtkTreeDFSIterator> dFS;\n  dFS->SetStartVertex(root);\n  dFS->SetTree(minimumSpanningTree);\n\n  // Traverse the tree in a depth first fashion\n  while (dFS->HasNext())\n  {\n    vtkIdType NextVertex = dFS->Next();\n    std::cout << \"Next vertex: \" << NextVertex\n              << \" level: \" << minimumSpanningTree->GetLevel(NextVertex)\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/DepthFirstSearchIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DepthFirstSearchIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisBoostGraphAlgorithms\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DepthFirstSearchIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DepthFirstSearchIterator MACOSX_BUNDLE DepthFirstSearchIterator.cxx )\n  target_link_libraries(DepthFirstSearchIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DepthFirstSearchIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/DepthFirstSearchIterator/#download-and-build-depthfirstsearchiterator","title":"Download and Build DepthFirstSearchIterator","text":"

        Click here to download DepthFirstSearchIterator and its CMakeLists.txt file. Once the tarball DepthFirstSearchIterator.tar has been downloaded and extracted,

        cd DepthFirstSearchIterator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DepthFirstSearchIterator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/DirectedGraphToMutableDirectedGraph/","title":"DirectedGraphToMutableDirectedGraph","text":"

        vtk-examples/Cxx/Graphs/DirectedGraphToMutableDirectedGraph

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/DirectedGraphToMutableDirectedGraph/#code","title":"Code","text":"

        DirectedGraphToMutableDirectedGraph.cxx

        #include <vtkDirectedGraph.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n\nint main(int, char*[])\n{\n\n  // create a graph\n  vtkNew<vtkMutableDirectedGraph> mdg;\n\n  // add 4 vertices to the graph\n  vtkIdType v1 = mdg->AddVertex();\n  vtkIdType v2 = mdg->AddVertex();\n  vtkIdType v3 = mdg->AddVertex();\n  vtkIdType v4 = mdg->AddVertex();\n\n  // add 3 edges to the graph\n  mdg->AddEdge(v1, v2);\n  mdg->AddEdge(v1, v3);\n  mdg->AddEdge(v1, v4);\n\n  // create 4 points - one for each vertex\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 2.0);\n\n  // add the coordinates of the points to the graph\n  mdg->SetPoints(points);\n\n  std::cout << \"MDG: \" << std::endl;\n  std::cout << \"Type: \" << mdg->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << mdg->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << mdg->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkDirectedGraph> dg;\n  if (!dg->CheckedShallowCopy(mdg))\n  {\n    std::cerr << \"Could not convert graph to tree!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::cout << \"DG: \" << std::endl;\n  std::cout << \"Type: \" << dg->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << dg->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << dg->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkMutableDirectedGraph> mdg2;\n\n  if (!mdg2->CheckedShallowCopy(dg))\n  {\n    std::cerr << \"Could not convert graph to tree!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::cout << \"MDG2: \" << std::endl;\n  std::cout << \"Type: \" << mdg2->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << mdg2->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << mdg2->GetNumberOfEdges() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/DirectedGraphToMutableDirectedGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DirectedGraphToMutableDirectedGraph)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DirectedGraphToMutableDirectedGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DirectedGraphToMutableDirectedGraph MACOSX_BUNDLE DirectedGraphToMutableDirectedGraph.cxx )\n  target_link_libraries(DirectedGraphToMutableDirectedGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DirectedGraphToMutableDirectedGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/DirectedGraphToMutableDirectedGraph/#download-and-build-directedgraphtomutabledirectedgraph","title":"Download and Build DirectedGraphToMutableDirectedGraph","text":"

        Click here to download DirectedGraphToMutableDirectedGraph and its CMakeLists.txt file. Once the tarball DirectedGraphToMutableDirectedGraph.tar has been downloaded and extracted,

        cd DirectedGraphToMutableDirectedGraph/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DirectedGraphToMutableDirectedGraph\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/EdgeListIterator/","title":"EdgeListIterator","text":"

        vtk-examples/Cxx/Graphs/EdgeListIterator

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/EdgeListIterator/#code","title":"Code","text":"

        EdgeListIterator.cxx

        #include <vtkEdgeListIterator.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create a graph\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v0, v1);\n  g->AddEdge(v1, v2);\n  g->AddEdge(v0, v2);\n\n  vtkNew<vtkEdgeListIterator> edgeListIterator;\n  g->GetEdges(edgeListIterator);\n\n  while (edgeListIterator->HasNext())\n  {\n    vtkEdgeType edge = edgeListIterator->Next();\n    std::cout << \"Edge: \" << edge.Id << \" is from \"\n              << \"Source: \" << edge.Source << \" to Target: \" << edge.Target\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/EdgeListIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EdgeListIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EdgeListIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EdgeListIterator MACOSX_BUNDLE EdgeListIterator.cxx )\n  target_link_libraries(EdgeListIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EdgeListIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/EdgeListIterator/#download-and-build-edgelistiterator","title":"Download and Build EdgeListIterator","text":"

        Click here to download EdgeListIterator and its CMakeLists.txt file. Once the tarball EdgeListIterator.tar has been downloaded and extracted,

        cd EdgeListIterator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./EdgeListIterator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/EdgeWeights/","title":"EdgeWeights","text":"

        vtk-examples/Cxx/Graphs/EdgeWeights

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/EdgeWeights/#code","title":"Code","text":"

        EdgeWeights.cxx

        #include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkForceDirectedLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  // Create a fully connected graph.\n  g->AddEdge(v1, v2);\n  g->AddEdge(v2, v3);\n  g->AddEdge(v1, v3);\n\n  // Create the edge weight array.\n  vtkNew<vtkDoubleArray> weights;\n  weights->SetNumberOfComponents(1);\n  weights->SetName(\"Weights\");\n\n  // Set the edge weights\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(2.0);\n\n  // Add the edge weight array to the graph.\n  g->GetEdgeData()->AddArray(weights);\n\n  std::cout << \"Number of Weights: \"\n            << dynamic_cast<vtkDoubleArray*>(\n                   g->GetEdgeData()->GetArray(\"Weights\"))\n                   ->GetNumberOfTuples()\n            << std::endl;\n\n  for (vtkIdType i = 0; i < weights->GetNumberOfTuples(); i++)\n  {\n    double w = weights->GetValue(i);\n    std::cout << \"Weight \" << i << \" : \" << w << std::endl;\n  }\n\n  vtkNew<vtkForceDirectedLayoutStrategy> forceDirected;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView->SetLayoutStrategy(forceDirected);\n  graphLayoutView->SetLayoutStrategyToForceDirected();\n  graphLayoutView->AddRepresentationFromInput(g);\n  graphLayoutView->SetEdgeLabelVisibility(true);\n  graphLayoutView->SetEdgeLabelArrayName(\"Weights\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"EdgeWeights\");\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/EdgeWeights/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EdgeWeights)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EdgeWeights: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EdgeWeights MACOSX_BUNDLE EdgeWeights.cxx )\n  target_link_libraries(EdgeWeights PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EdgeWeights\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/EdgeWeights/#download-and-build-edgeweights","title":"Download and Build EdgeWeights","text":"

        Click here to download EdgeWeights and its CMakeLists.txt file. Once the tarball EdgeWeights.tar has been downloaded and extracted,

        cd EdgeWeights/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./EdgeWeights\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/GraphToPolyData/","title":"GraphToPolyData","text":"

        vtk-examples/Cxx/Graphs/GraphToPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Graphs/GraphToPolyData/#description","title":"Description","text":"

        This example creates a simple graph and then converts it to a polydata for visualization using Paraview.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/GraphToPolyData/#code","title":"Code","text":"

        GraphToPolyData.cxx

        #include <vtkActor.h>\n#include <vtkGraphToPolyData.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a graph\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Add 4 vertices to the graph\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  vtkIdType v4 = g->AddVertex();\n\n  // Add 3 edges to the graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v3);\n  g->AddEdge(v1, v4);\n\n  // Create 4 points - one for each vertex\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 1.0);\n\n  // Add the coordinates of the points to the graph\n  g->SetPoints(points);\n\n  // Convert the graph to a polydata\n  vtkNew<vtkGraphToPolyData> graphToPolyData;\n  graphToPolyData->SetInputData(g);\n  graphToPolyData->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(graphToPolyData->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Green\").GetData());\n\n  // Render and interact\n  renderWindow->SetWindowName(\"GraphToPolyData\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/GraphToPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GraphToPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GraphToPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GraphToPolyData MACOSX_BUNDLE GraphToPolyData.cxx )\n  target_link_libraries(GraphToPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GraphToPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/GraphToPolyData/#download-and-build-graphtopolydata","title":"Download and Build GraphToPolyData","text":"

        Click here to download GraphToPolyData and its CMakeLists.txt file. Once the tarball GraphToPolyData.tar has been downloaded and extracted,

        cd GraphToPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GraphToPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/InEdgeIterator/","title":"InEdgeIterator","text":"

        vtk-examples/Cxx/Graphs/InEdgeIterator

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/InEdgeIterator/#code","title":"Code","text":"

        InEdgeIterator.cxx

        #include <vtkInEdgeIterator.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n\nnamespace {\n\nvoid Undirected();\n\nvoid Directed();\n\n} // namespace\n\nint main(int, char*[])\n{\n  Undirected();\n  Directed();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid Undirected()\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create a graph\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v0, v1);\n  g->AddEdge(v1, v2);\n  g->AddEdge(v0, v2);\n\n  // Find all incoming edges connected to a vertex\n  vtkNew<vtkInEdgeIterator> it;\n  g->GetInEdges(0, it);\n\n  while (it->HasNext())\n  {\n    vtkInEdgeType edge = it->Next();\n    std::cout << \"Edge id: \" << edge.Id << \" Source: \" << edge.Source\n              << std::endl;\n  }\n}\n\nvoid Directed()\n{\n  vtkNew<vtkMutableDirectedGraph> g;\n\n  // Create a graph\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v0, v1);\n  g->AddEdge(v0, v2);\n\n  {\n    std::cout << \"Finding edges connected to vertex 0\" << std::endl;\n    vtkNew<vtkInEdgeIterator> it;\n    g->GetInEdges(0, it);\n\n    while (it->HasNext())\n    {\n      vtkInEdgeType edge = it->Next();\n      std::cout << \"Edge id: \" << edge.Id << \" \"\n                << \"Source: \" << edge.Source << std::endl;\n    }\n\n    std::cout << \"Nothing should be output, vertex 0 has no incoming edges!\"\n              << std::endl;\n  }\n\n  {\n    std::cout << \"Finding edges connected to vertex 1\" << std::endl;\n    vtkNew<vtkInEdgeIterator> it;\n    g->GetInEdges(1, it);\n\n    while (it->HasNext())\n    {\n      vtkInEdgeType edge = it->Next();\n      std::cout << \"Edge id: \" << edge.Id << \" \"\n                << \"Source: \" << edge.Source << std::endl;\n    }\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/Graphs/InEdgeIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InEdgeIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InEdgeIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InEdgeIterator MACOSX_BUNDLE InEdgeIterator.cxx )\n  target_link_libraries(InEdgeIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InEdgeIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/InEdgeIterator/#download-and-build-inedgeiterator","title":"Download and Build InEdgeIterator","text":"

        Click here to download InEdgeIterator and its CMakeLists.txt file. Once the tarball InEdgeIterator.tar has been downloaded and extracted,

        cd InEdgeIterator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./InEdgeIterator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/LabelVerticesAndEdges/","title":"LabelVerticesAndEdges","text":"

        vtk-examples/Cxx/Graphs/LabelVerticesAndEdges

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Graphs/LabelVerticesAndEdges/#description","title":"Description","text":"

        This example sets and displays labels of vertices and edges of a graph.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/LabelVerticesAndEdges/#code","title":"Code","text":"

        LabelVerticesAndEdges.cxx

        #include <vtkCircularLayoutStrategy.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIntArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  // Create a fully connected graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v2, v3);\n  g->AddEdge(v1, v3);\n\n  // Create the edge weight array\n  vtkNew<vtkDoubleArray> weights;\n  weights->SetNumberOfComponents(1);\n  weights->SetName(\"Weights\");\n\n  // Set the edge weights\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(2.0);\n\n  // Create an array for the vertex labels\n  vtkNew<vtkIntArray> vertexIDs;\n  vertexIDs->SetNumberOfComponents(1);\n  vertexIDs->SetName(\"VertexIDs\");\n\n  // Set the vertex labels\n  vertexIDs->InsertNextValue(0);\n  vertexIDs->InsertNextValue(1);\n  vertexIDs->InsertNextValue(2);\n\n  // Add the edge weight array to the graph\n  g->GetEdgeData()->AddArray(weights);\n  g->GetVertexData()->AddArray(vertexIDs);\n\n  vtkNew<vtkCircularLayoutStrategy> circularLayoutStrategy;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n\n  graphLayoutView->SetLayoutStrategy(circularLayoutStrategy);\n  graphLayoutView->SetVertexLabelVisibility(true);\n  graphLayoutView->SetEdgeLabelVisibility(true);\n  graphLayoutView->SetEdgeLabelArrayName(\"Weights\");     // default is \"labels\"\n  graphLayoutView->SetVertexLabelArrayName(\"VertexIDs\"); // default is \"labels\"\n  dynamic_cast<vtkRenderedGraphRepresentation*>(\n      graphLayoutView->GetRepresentation())\n      ->GetVertexLabelTextProperty()\n      ->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  dynamic_cast<vtkRenderedGraphRepresentation*>(\n      graphLayoutView->GetRepresentation())\n      ->GetEdgeLabelTextProperty()\n      ->SetColor(colors->GetColor3d(\"Lime\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"LabelVerticesAndEdges\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/LabelVerticesAndEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LabelVerticesAndEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LabelVerticesAndEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LabelVerticesAndEdges MACOSX_BUNDLE LabelVerticesAndEdges.cxx )\n  target_link_libraries(LabelVerticesAndEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LabelVerticesAndEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/LabelVerticesAndEdges/#download-and-build-labelverticesandedges","title":"Download and Build LabelVerticesAndEdges","text":"

        Click here to download LabelVerticesAndEdges and its CMakeLists.txt file. Once the tarball LabelVerticesAndEdges.tar has been downloaded and extracted,

        cd LabelVerticesAndEdges/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LabelVerticesAndEdges\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/MinimumSpanningTree/","title":"MinimumSpanningTree","text":"

        vtk-examples/Cxx/Graphs/MinimumSpanningTree

        "},{"location":"Cxx/Graphs/MinimumSpanningTree/#description","title":"Description","text":"

        This example shows how to find the minimum spanning tree. The input graph is:

        and the minimum spanning tree computed is :

        You must have compiled VTK with VTK_USE_BOOST=ON to use this functionality. You must also link to vtkInfovis.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/MinimumSpanningTree/#code","title":"Code","text":"

        MinimumSpanningTree.cxx

        #include <vtkBoostPrimMinimumSpanningTree.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkDoubleArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkTree.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  // Create a fully connected graph\n  g->AddEdge(v1, v2);\n  g->AddEdge(v2, v3);\n  g->AddEdge(v1, v3);\n\n  // Create the edge weight array\n  vtkNew<vtkDoubleArray> weights;\n  weights->SetNumberOfComponents(1);\n  weights->SetName(\"Weights\");\n\n  // Set the edge weights\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(1.0);\n  weights->InsertNextValue(2.0);\n\n  // Add the edge weight array to the graph\n  g->GetEdgeData()->AddArray(weights);\n\n  // Output original graph info\n  std::cout << \"Number of vertices: \" << g->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << g->GetNumberOfEdges() << std::endl;\n  g->Dump();\n\n  // Setup the minimum spanning tree filter\n  vtkNew<vtkBoostPrimMinimumSpanningTree> minimumSpanningTreeFilter;\n  minimumSpanningTreeFilter->SetOriginVertex(v1);\n  minimumSpanningTreeFilter->SetInput(g);\n  minimumSpanningTreeFilter->SetEdgeWeightArrayName(\"Weights\");\n\n  // Compute the minimum spanning tree\n  minimumSpanningTreeFilter->Update();\n\n  // Get the output tree\n  vtkSmartPointer<vtkTree> minimumSpanningTree;\n  minimumSpanningTree->ShallowCopy(minimumSpanningTreeFilter->GetOutput());\n\n  // Output information about the minimum spanning tree\n  std::cout << \"Number of vertices: \"\n            << minimumSpanningTree->GetNumberOfVertices() << std::endl;\n  std::cout << \"Number of edges: \" << minimumSpanningTree->GetNumberOfEdges()\n            << std::endl;\n  minimumSpanningTree->Dump();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/MinimumSpanningTree/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MinimumSpanningTree)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisBoostGraphAlgorithms\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MinimumSpanningTree: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MinimumSpanningTree MACOSX_BUNDLE MinimumSpanningTree.cxx )\n  target_link_libraries(MinimumSpanningTree PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MinimumSpanningTree\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/MinimumSpanningTree/#download-and-build-minimumspanningtree","title":"Download and Build MinimumSpanningTree","text":"

        Click here to download MinimumSpanningTree and its CMakeLists.txt file. Once the tarball MinimumSpanningTree.tar has been downloaded and extracted,

        cd MinimumSpanningTree/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MinimumSpanningTree\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/MutableDirectedGraphToDirectedGraph/","title":"MutableDirectedGraphToDirectedGraph","text":"

        vtk-examples/Cxx/Graphs/MutableDirectedGraphToDirectedGraph

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/MutableDirectedGraphToDirectedGraph/#code","title":"Code","text":"

        MutableDirectedGraphToDirectedGraph.cxx

        #include <vtkDirectedGraph.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n\nint main(int, char*[])\n{\n\n  // create a graph\n  vtkNew<vtkMutableDirectedGraph> mdg;\n\n  // add 4 vertices to the graph\n  vtkIdType v1 = mdg->AddVertex();\n  vtkIdType v2 = mdg->AddVertex();\n  vtkIdType v3 = mdg->AddVertex();\n  vtkIdType v4 = mdg->AddVertex();\n\n  // add 3 edges to the graph\n  mdg->AddEdge(v1, v2);\n  mdg->AddEdge(v1, v3);\n  mdg->AddEdge(v1, v4);\n\n  // create 4 points - one for each vertex\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 2.0);\n\n  // add the coordinates of the points to the graph\n  mdg->SetPoints(points);\n\n  std::cout << \"MDG: \" << std::endl;\n  std::cout << \"Type: \" << mdg->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << mdg->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << mdg->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkDirectedGraph> dg;\n  if (!dg->CheckedShallowCopy(mdg))\n  {\n    std::cerr << \"Could not convert graph to tree!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::cout << \"DG: \" << std::endl;\n  std::cout << \"Type: \" << dg->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << dg->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << dg->GetNumberOfEdges() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/MutableDirectedGraphToDirectedGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MutableDirectedGraphToDirectedGraph)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MutableDirectedGraphToDirectedGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MutableDirectedGraphToDirectedGraph MACOSX_BUNDLE MutableDirectedGraphToDirectedGraph.cxx )\n  target_link_libraries(MutableDirectedGraphToDirectedGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MutableDirectedGraphToDirectedGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/MutableDirectedGraphToDirectedGraph/#download-and-build-mutabledirectedgraphtodirectedgraph","title":"Download and Build MutableDirectedGraphToDirectedGraph","text":"

        Click here to download MutableDirectedGraphToDirectedGraph and its CMakeLists.txt file. Once the tarball MutableDirectedGraphToDirectedGraph.tar has been downloaded and extracted,

        cd MutableDirectedGraphToDirectedGraph/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MutableDirectedGraphToDirectedGraph\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/NOVCAGraph/","title":"NOVCAGraph","text":"

        vtk-examples/Cxx/Graphs/NOVCAGraph

        "},{"location":"Cxx/Graphs/NOVCAGraph/#description","title":"Description","text":"
        • This example shows how to construct a graph to visualize it in ParaView/VisIt using the VTK output file testVertex.vtu.

        • Contributed by Sanjaya Gajurel, Case Western Reserve University

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/NOVCAGraph/#code","title":"Code","text":"

        NOVCAGraph.cxx

        #include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyLine.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  // Create 8 Vertices.\n  vtkNew<vtkPoints> points;\n\n  for (unsigned int i = 0; i < 2; ++i)\n    for (unsigned int j = 0; j < 4; ++j) points->InsertNextPoint(i, j, 0);\n\n  // Create Edges\n  vtkNew<vtkPolyLine> line;\n  line->GetPointIds()->SetNumberOfIds(8);\n  for (unsigned int i = 0; i < 8; ++i) line->GetPointIds()->SetId(i, i);\n\n  vtkNew<vtkCellArray> cellArray;\n  cellArray->InsertNextCell(line);\n\n  // Create a Graph with Vertices and Edges.\n  vtkNew<vtkUnstructuredGrid> grid;\n  grid->SetPoints(points);\n  grid->SetCells(VTK_POLY_LINE, cellArray);\n\n  // Write the file\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetFileName(\"vertex.vtu\");\n  writer->SetInputData(grid);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/NOVCAGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NOVCAGraph)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NOVCAGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NOVCAGraph MACOSX_BUNDLE NOVCAGraph.cxx )\n  target_link_libraries(NOVCAGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NOVCAGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/NOVCAGraph/#download-and-build-novcagraph","title":"Download and Build NOVCAGraph","text":"

        Click here to download NOVCAGraph and its CMakeLists.txt file. Once the tarball NOVCAGraph.tar has been downloaded and extracted,

        cd NOVCAGraph/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./NOVCAGraph\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/OutEdgeIterator/","title":"OutEdgeIterator","text":"

        vtk-examples/Cxx/Graphs/OutEdgeIterator

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/OutEdgeIterator/#code","title":"Code","text":"

        OutEdgeIterator.cxx

        #include <vtkMutableDirectedGraph.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkOutEdgeIterator.h>\n\nnamespace {\n\nvoid Undirected();\n\nvoid Directed();\n\n} // namespace\n\nint main(int, char*[])\n{\n  Undirected();\n  Directed();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid Undirected()\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create a graph\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v0, v1);\n  g->AddEdge(v1, v2);\n  g->AddEdge(v0, v2);\n\n  // Find all outgoing edges connected to a vertex\n  vtkNew<vtkOutEdgeIterator> it;\n  g->GetOutEdges(0, it); // Get the edges connected to vertex 0\n\n  while (it->HasNext())\n  {\n    vtkOutEdgeType edge = it->Next();\n    std::cout << \"Edge id: \" << edge.Id << \" Target: \" << edge.Target\n              << std::endl;\n  }\n}\n\nvoid Directed()\n{\n  vtkNew<vtkMutableDirectedGraph> g;\n\n  // Create a graph\n  vtkIdType v0 = g->AddVertex();\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v0);\n  g->AddEdge(v2, v0);\n\n  {\n    std::cout << \"Finding edges connected to vertex 0\" << std::endl;\n    vtkNew<vtkOutEdgeIterator> it;\n    g->GetOutEdges(0, it);\n\n    while (it->HasNext())\n    {\n      vtkOutEdgeType edge = it->Next();\n      std::cout << \"Edge id: \" << edge.Id << \" Target: \" << edge.Target\n                << std::endl;\n    }\n\n    std::cout << \"Nothing should be output, vertex 0 has no outgoing edges!\"\n              << std::endl;\n  }\n\n  {\n    std::cout << \"Finding edges connected to vertex 1\" << std::endl;\n    vtkNew<vtkOutEdgeIterator> it;\n    g->GetOutEdges(1, it);\n\n    while (it->HasNext())\n    {\n      vtkOutEdgeType edge = it->Next();\n      std::cout << \"Edge id: \" << edge.Id << \" Target: \" << edge.Target\n                << std::endl;\n    }\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/Graphs/OutEdgeIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OutEdgeIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OutEdgeIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OutEdgeIterator MACOSX_BUNDLE OutEdgeIterator.cxx )\n  target_link_libraries(OutEdgeIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OutEdgeIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/OutEdgeIterator/#download-and-build-outedgeiterator","title":"Download and Build OutEdgeIterator","text":"

        Click here to download OutEdgeIterator and its CMakeLists.txt file. Once the tarball OutEdgeIterator.tar has been downloaded and extracted,

        cd OutEdgeIterator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OutEdgeIterator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/RandomGraphSource/","title":"RandomGraphSource","text":"

        vtk-examples/Cxx/Graphs/RandomGraphSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/RandomGraphSource/#code","title":"Code","text":"

        RandomGraphSource.cxx

        #include <vtkForceDirectedLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRandomGraphSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRandomGraphSource> randomGraphSource;\n  randomGraphSource->SetNumberOfVertices(5);\n  randomGraphSource->SetNumberOfEdges(4);\n  // This ensures repeatable results for testing. Turn this off for real use.\n  randomGraphSource->SetSeed(123);\n  randomGraphSource->Update();\n\n  vtkNew<vtkForceDirectedLayoutStrategy> forceDirected;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(randomGraphSource->GetOutput());\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView->SetLayoutStrategy(forceDirected);\n  graphLayoutView->SetLayoutStrategyToForceDirected();\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"RandomGraphSource\");\n  graphLayoutView->Render();\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/RandomGraphSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RandomGraphSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InfovisCore\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RandomGraphSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RandomGraphSource MACOSX_BUNDLE RandomGraphSource.cxx )\n  target_link_libraries(RandomGraphSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RandomGraphSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/RandomGraphSource/#download-and-build-randomgraphsource","title":"Download and Build RandomGraphSource","text":"

        Click here to download RandomGraphSource and its CMakeLists.txt file. Once the tarball RandomGraphSource.tar has been downloaded and extracted,

        cd RandomGraphSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RandomGraphSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/RemoveIsolatedVertices/","title":"RemoveIsolatedVertices","text":"

        vtk-examples/Cxx/Graphs/RemoveIsolatedVertices

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/RemoveIsolatedVertices/#code","title":"Code","text":"

        RemoveIsolatedVertices.cxx

        #include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkRemoveIsolatedVertices.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  g->AddVertex();\n\n  g->AddEdge(v1, v2);\n\n  std::cout << \"Graph has \" << g->GetNumberOfVertices() << \" vertices and \"\n            << g->GetNumberOfEdges() << \" edge before.\" << std::endl;\n\n  vtkNew<vtkRemoveIsolatedVertices> filter;\n  filter->SetInputData(g);\n  filter->Update();\n\n  std::cout << \"Graph has \" << filter->GetOutput()->GetNumberOfVertices()\n            << \" vertices and \" << filter->GetOutput()->GetNumberOfEdges()\n            << \" edge after.\" << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/RemoveIsolatedVertices/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RemoveIsolatedVertices)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RemoveIsolatedVertices: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RemoveIsolatedVertices MACOSX_BUNDLE RemoveIsolatedVertices.cxx )\n  target_link_libraries(RemoveIsolatedVertices PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RemoveIsolatedVertices\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/RemoveIsolatedVertices/#download-and-build-removeisolatedvertices","title":"Download and Build RemoveIsolatedVertices","text":"

        Click here to download RemoveIsolatedVertices and its CMakeLists.txt file. Once the tarball RemoveIsolatedVertices.tar has been downloaded and extracted,

        cd RemoveIsolatedVertices/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RemoveIsolatedVertices\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/ScaleVertices/","title":"ScaleVertices","text":"

        vtk-examples/Cxx/Graphs/ScaleVertices

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Graphs/ScaleVertices/#description","title":"Description","text":"

        Scale the vertices based on a data array.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/ScaleVertices/#code","title":"Code","text":"

        ScaleVertices.cxx

        #include <vtkDataSetAttributes.h>\n#include <vtkFloatArray.h>\n#include <vtkForceDirectedLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkGraphToGlyphs.h>\n#include <vtkLookupTable.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n#include <vtkViewTheme.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v2);\n\n  vtkNew<vtkFloatArray> scales;\n  scales->SetNumberOfComponents(1);\n  scales->SetName(\"Scales\");\n  scales->InsertNextValue(2.0);\n  scales->InsertNextValue(5.0);\n\n  // Add the scale array to the graph\n  g->GetVertexData()->AddArray(scales);\n\n  // Create the color array\n  vtkNew<vtkIntArray> vertexColors;\n  vertexColors->SetNumberOfComponents(1);\n  vertexColors->SetName(\"Color\");\n\n  vtkNew<vtkLookupTable> lookupTable;\n  lookupTable->SetNumberOfTableValues(2);\n  lookupTable->SetTableValue(0, colors->GetColor4d(\"Yellow\").GetData());\n  lookupTable->SetTableValue(1, colors->GetColor4d(\"Lime\").GetData());\n  lookupTable->Build();\n\n  vertexColors->InsertNextValue(0);\n  vertexColors->InsertNextValue(1);\n\n  // Add the color array to the graph\n  g->GetVertexData()->AddArray(vertexColors);\n\n  // Visualize\n\n  vtkNew<vtkViewTheme> theme;\n  theme->SetPointLookupTable(lookupTable);\n\n  vtkNew<vtkForceDirectedLayoutStrategy> forceDirected;\n\n  vtkNew<vtkGraphLayoutView> layoutView;\n  layoutView->AddRepresentationFromInput(g);\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView->SetLayoutStrategy(forceDirected);\n  layoutView->SetLayoutStrategyToForceDirected();\n  layoutView->ApplyViewTheme(theme);\n  layoutView->ScaledGlyphsOn();\n  layoutView->SetScalingArrayName(\"Scales\");\n  layoutView->SetVertexColorArrayName(\"Color\");\n  layoutView->ColorVerticesOn();\n  dynamic_cast<vtkRenderedGraphRepresentation*>(layoutView->GetRepresentation())\n      ->SetGlyphType(vtkGraphToGlyphs::CIRCLE);\n  layoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  layoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  layoutView->GetRenderWindow()->SetWindowName(\"ScaleVertices\");\n  layoutView->Render();\n  layoutView->ResetCamera();\n  layoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/ScaleVertices/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScaleVertices)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScaleVertices: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScaleVertices MACOSX_BUNDLE ScaleVertices.cxx )\n  target_link_libraries(ScaleVertices PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScaleVertices\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/ScaleVertices/#download-and-build-scalevertices","title":"Download and Build ScaleVertices","text":"

        Click here to download ScaleVertices and its CMakeLists.txt file. Once the tarball ScaleVertices.tar has been downloaded and extracted,

        cd ScaleVertices/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ScaleVertices\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/SelectedVerticesAndEdges/","title":"SelectedVerticesAndEdges","text":"

        vtk-examples/Cxx/Graphs/SelectedVerticesAndEdges

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Graphs/SelectedVerticesAndEdges/#description","title":"Description","text":"
        • Thanks to Eric Monson

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/SelectedVerticesAndEdges/#code","title":"Code","text":"

        SelectedVerticesAndEdges.cxx

        #include <vtkAnnotationLink.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInteractorStyleRubberBand2D.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n\nnamespace {\nclass RubberBandStyle : public vtkInteractorStyleRubberBand2D\n{\npublic:\n  static RubberBandStyle* New();\n  vtkTypeMacro(RubberBandStyle, vtkInteractorStyleRubberBand2D);\n\n  virtual void OnLeftButtonUp() override\n  {\n    // Forward events\n    vtkInteractorStyleRubberBand2D::OnLeftButtonUp();\n\n    vtkSelection* selection = this->View->GetRepresentation()\n                                  ->GetAnnotationLink()\n                                  ->GetCurrentSelection();\n    vtkSelectionNode* vertices;\n    vtkSelectionNode* edges;\n    if (selection->GetNode(0)->GetFieldType() == vtkSelectionNode::VERTEX)\n    {\n      vertices = selection->GetNode(0);\n    }\n    else if (selection->GetNode(0)->GetFieldType() == vtkSelectionNode::EDGE)\n    {\n      edges = selection->GetNode(0);\n    }\n\n    if (selection->GetNode(1)->GetFieldType() == vtkSelectionNode::VERTEX)\n    {\n      vertices = selection->GetNode(1);\n    }\n    else if (selection->GetNode(1)->GetFieldType() == vtkSelectionNode::EDGE)\n    {\n      edges = selection->GetNode(1);\n    }\n\n    vtkIdTypeArray* vertexList =\n        dynamic_cast<vtkIdTypeArray*>(vertices->GetSelectionList());\n    std::cout << \"There are \" << vertexList->GetNumberOfTuples()\n              << \" vertices selected.\" << std::endl;\n\n    if (vertexList->GetNumberOfTuples() > 0)\n    {\n      std::cout << \"Vertex Ids: \";\n    }\n    for (vtkIdType i = 0; i < vertexList->GetNumberOfTuples(); i++)\n    {\n      std::cout << vertexList->GetValue(i) << \" \";\n    }\n\n    std::cout << std::endl;\n    vtkIdTypeArray* edgeList =\n        dynamic_cast<vtkIdTypeArray*>(edges->GetSelectionList());\n    std::cout << \"There are \" << edgeList->GetNumberOfTuples()\n              << \" edges selected.\" << std::endl;\n    if (edgeList->GetNumberOfTuples() > 0)\n    {\n      std::cout << \"Edge Ids: \";\n    }\n\n    for (vtkIdType i = 0; i < edgeList->GetNumberOfTuples(); i++)\n    {\n      std::cout << edgeList->GetValue(i) << \" \";\n    }\n    std::cout << std::endl;\n  }\n\n  vtkGraphLayoutView* View;\n};\nvtkStandardNewMacro(RubberBandStyle);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v2);\n\n  vtkNew<vtkGraphLayoutView> view;\n  view->AddRepresentationFromInput(g);\n  view->SetLayoutStrategy(\"Simple 2D\");\n\n  vtkNew<RubberBandStyle> style;\n  style->View = view;\n  view->SetInteractorStyle(style);\n\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Navy\").GetData());\n  view->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"SelectedVerticesAndEdges\");\n  view->ResetCamera();\n  view->Render();\n\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/SelectedVerticesAndEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectedVerticesAndEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectedVerticesAndEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectedVerticesAndEdges MACOSX_BUNDLE SelectedVerticesAndEdges.cxx )\n  target_link_libraries(SelectedVerticesAndEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectedVerticesAndEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/SelectedVerticesAndEdges/#download-and-build-selectedverticesandedges","title":"Download and Build SelectedVerticesAndEdges","text":"

        Click here to download SelectedVerticesAndEdges and its CMakeLists.txt file. Once the tarball SelectedVerticesAndEdges.tar has been downloaded and extracted,

        cd SelectedVerticesAndEdges/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SelectedVerticesAndEdges\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/SelectedVerticesAndEdgesObserver/","title":"SelectedVerticesAndEdgesObserver","text":"

        vtk-examples/Cxx/Graphs/SelectedVerticesAndEdgesObserver

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Graphs/SelectedVerticesAndEdgesObserver/#description","title":"Description","text":"
        • Thanks to Eric Monson

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/SelectedVerticesAndEdgesObserver/#code","title":"Code","text":"

        SelectedVerticesAndEdgesObserver.cxx

        #include <vtkAnnotationLink.h>\n#include <vtkCallbackCommand.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkIdTypeArray.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n\nnamespace {\n\nvoid SelectionCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                               void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v2);\n\n  vtkNew<vtkCallbackCommand> selectionCallback;\n  selectionCallback->SetCallback(SelectionCallbackFunction);\n\n  vtkNew<vtkGraphLayoutView> view;\n  view->AddRepresentationFromInput(g);\n  view->SetLayoutStrategy(\"Simple 2D\");\n  view->GetRepresentation()->GetAnnotationLink()->AddObserver(\n      \"AnnotationChangedEvent\", selectionCallback);\n\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Navy\").GetData());\n  view->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  view->GetRenderWindow()->SetWindowName(\"SelectedVerticesAndEdges\");\n  view->ResetCamera();\n  view->Render();\n\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid SelectionCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                               void* clientData, void* callData)\n{\n\n  vtkAnnotationLink* annotationLink = static_cast<vtkAnnotationLink*>(caller);\n\n  vtkSelection* selection = annotationLink->GetCurrentSelection();\n  vtkSelectionNode* vertices;\n  vtkSelectionNode* edges;\n  if (selection->GetNode(0)->GetFieldType() == vtkSelectionNode::VERTEX)\n  {\n    vertices = selection->GetNode(0);\n  }\n  else if (selection->GetNode(0)->GetFieldType() == vtkSelectionNode::EDGE)\n  {\n    edges = selection->GetNode(0);\n  }\n\n  if (selection->GetNode(1)->GetFieldType() == vtkSelectionNode::VERTEX)\n  {\n    vertices = selection->GetNode(1);\n  }\n  else if (selection->GetNode(1)->GetFieldType() == vtkSelectionNode::EDGE)\n  {\n    edges = selection->GetNode(1);\n  }\n\n  vtkIdTypeArray* vertexList =\n      dynamic_cast<vtkIdTypeArray*>(vertices->GetSelectionList());\n  std::cout << \"There are \" << vertexList->GetNumberOfTuples()\n            << \" vertices selected.\" << std::endl;\n\n  if (vertexList->GetNumberOfTuples() > 0)\n  {\n    std::cout << \"Vertex Ids: \";\n  }\n  for (vtkIdType i = 0; i < vertexList->GetNumberOfTuples(); i++)\n  {\n    std::cout << vertexList->GetValue(i) << \" \";\n  }\n\n  std::cout << std::endl;\n  vtkIdTypeArray* edgeList =\n      dynamic_cast<vtkIdTypeArray*>(edges->GetSelectionList());\n  std::cout << \"There are \" << edgeList->GetNumberOfTuples()\n            << \" edges selected.\" << std::endl;\n  if (edgeList->GetNumberOfTuples() > 0)\n  {\n    std::cout << \"Edge Ids: \";\n  }\n\n  for (vtkIdType i = 0; i < edgeList->GetNumberOfTuples(); i++)\n  {\n    std::cout << edgeList->GetValue(i) << \" \";\n  }\n  std::cout << std::endl;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Graphs/SelectedVerticesAndEdgesObserver/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectedVerticesAndEdgesObserver)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectedVerticesAndEdgesObserver: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectedVerticesAndEdgesObserver MACOSX_BUNDLE SelectedVerticesAndEdgesObserver.cxx )\n  target_link_libraries(SelectedVerticesAndEdgesObserver PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectedVerticesAndEdgesObserver\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/SelectedVerticesAndEdgesObserver/#download-and-build-selectedverticesandedgesobserver","title":"Download and Build SelectedVerticesAndEdgesObserver","text":"

        Click here to download SelectedVerticesAndEdgesObserver and its CMakeLists.txt file. Once the tarball SelectedVerticesAndEdgesObserver.tar has been downloaded and extracted,

        cd SelectedVerticesAndEdgesObserver/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SelectedVerticesAndEdgesObserver\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/ShortestPath/","title":"ShortestPath","text":"

        vtk-examples/Cxx/Graphs/ShortestPath

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Graphs/ShortestPath/#description","title":"Description","text":"

        Currently, the only way to find the shortest path on a graph is to convert the graph to a mesh (using vtkGraphToPolyData) and then use the shortest path on a mesh functionality of vtkDijkstraGraphGeodesicPath.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/ShortestPath/#code","title":"Code","text":"

        ShortestPath.cxx

        #include <vtkActor.h>\n#include <vtkDijkstraGraphGeodesicPath.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkGraphToPolyData.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n/*\n   O v0\n  /|\\\n / |5\\\nv1-v2-v3\n  1  1\n\n  Shortest path between v0 and v2 should be 5\n*/\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableDirectedGraph> graph;\n  vtkIdType v0 = graph->AddVertex();\n  vtkIdType v1 = graph->AddVertex();\n  vtkIdType v2 = graph->AddVertex();\n  vtkIdType v3 = graph->AddVertex();\n\n  graph->AddEdge(v0, v1);\n  graph->AddEdge(v0, v2);\n  graph->AddEdge(v0, v3);\n  graph->AddEdge(v1, v2);\n  graph->AddEdge(v2, v3);\n\n  // Associate physical locations with the vertices\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(-1.0, -5.0, 0.0);\n  points->InsertNextPoint(0.0, -5.0, 0.0);\n  points->InsertNextPoint(1.0, -5.0, 0.0);\n\n  graph->SetPoints(points);\n\n  // Convert the graph to a polydata\n  vtkNew<vtkGraphToPolyData> graphToPolyData;\n  graphToPolyData->SetInputData(graph);\n  graphToPolyData->Update();\n\n  vtkNew<vtkDijkstraGraphGeodesicPath> dijkstra;\n  dijkstra->SetInputConnection(graphToPolyData->GetOutputPort());\n  dijkstra->SetStartVertex(0);\n  dijkstra->SetEndVertex(2);\n  dijkstra->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> pathMapper;\n  pathMapper->SetInputConnection(dijkstra->GetOutputPort());\n\n  vtkNew<vtkActor> pathActor;\n  pathActor->SetMapper(pathMapper);\n  pathActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  pathActor->GetProperty()->SetLineWidth(4);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(graphToPolyData->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  pathActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(pathActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"ForestGreen\").GetData());\n  renderer->GradientBackgroundOn();\n  renderWindow->SetWindowName(\"ShortestPath\");\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/ShortestPath/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShortestPath)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShortestPath: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShortestPath MACOSX_BUNDLE ShortestPath.cxx )\n  target_link_libraries(ShortestPath PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShortestPath\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/ShortestPath/#download-and-build-shortestpath","title":"Download and Build ShortestPath","text":"

        Click here to download ShortestPath and its CMakeLists.txt file. Once the tarball ShortestPath.tar has been downloaded and extracted,

        cd ShortestPath/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ShortestPath\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/SideBySideGraphs/","title":"SideBySideGraphs","text":"

        vtk-examples/Cxx/Graphs/SideBySideGraphs

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/SideBySideGraphs/#code","title":"Code","text":"

        SideBySideGraphs.cxx

        #include <vtkDataSetAttributes.h>\n#include <vtkForceDirectedLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkGraphToPolyData.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the first graph\n  vtkNew<vtkMutableUndirectedGraph> g0;\n  {\n    vtkIdType v1 = g0->AddVertex();\n    vtkIdType v2 = g0->AddVertex();\n    vtkIdType v3 = g0->AddVertex();\n\n    g0->AddEdge(v1, v2);\n    g0->AddEdge(v2, v3);\n    g0->AddEdge(v1, v3);\n\n    // Create points\n    vtkNew<vtkPoints> points;\n    points->InsertNextPoint(0.0, 0.0, 0.0);\n    points->InsertNextPoint(1.0, 0.0, 0.0);\n    points->InsertNextPoint(0.0, 1.0, 0.0);\n\n    // Add the coordinates of the points to the graph\n    g0->SetPoints(points);\n  }\n\n  // Create the second graph\n  vtkNew<vtkMutableUndirectedGraph> g1;\n\n  vtkIdType v1 = g1->AddVertex();\n  vtkIdType v2 = g1->AddVertex();\n\n  g1->AddEdge(v1, v2);\n\n  // Create points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n\n  // Add the coordinates of the points to the graph\n  g1->SetPoints(points);\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"SideBySideGraphs\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkForceDirectedLayoutStrategy> forceDirected;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView0;\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView0->SetLayoutStrategy(forceDirected);\n  graphLayoutView0->SetLayoutStrategyToForceDirected();\n  graphLayoutView0->SetRenderWindow(renderWindow);\n  graphLayoutView0->SetInteractor(renderWindowInteractor);\n  graphLayoutView0->GetRenderer()->SetViewport(leftViewport);\n  graphLayoutView0->AddRepresentationFromInput(g0);\n  graphLayoutView0->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Navy\").GetData());\n  graphLayoutView0->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  graphLayoutView0->Render();\n  graphLayoutView0->ResetCamera();\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView1;\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView1->SetLayoutStrategy(forceDirected);\n  graphLayoutView1->SetLayoutStrategyToForceDirected();\n  graphLayoutView1->SetRenderWindow(renderWindow);\n  graphLayoutView1->SetInteractor(renderWindowInteractor);\n  graphLayoutView1->GetRenderer()->SetViewport(rightViewport);\n  graphLayoutView1->AddRepresentationFromInput(g1);\n  graphLayoutView1->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkGreen\").GetData());\n  graphLayoutView1->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"ForestGreen\").GetData());\n  graphLayoutView1->Render();\n  graphLayoutView1->ResetCamera();\n\n  // graphLayoutView0->GetInteractor()->Start();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/SideBySideGraphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SideBySideGraphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SideBySideGraphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SideBySideGraphs MACOSX_BUNDLE SideBySideGraphs.cxx )\n  target_link_libraries(SideBySideGraphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SideBySideGraphs\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/SideBySideGraphs/#download-and-build-sidebysidegraphs","title":"Download and Build SideBySideGraphs","text":"

        Click here to download SideBySideGraphs and its CMakeLists.txt file. Once the tarball SideBySideGraphs.tar has been downloaded and extracted,

        cd SideBySideGraphs/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SideBySideGraphs\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/TreeBFSIterator/","title":"TreeBFSIterator","text":"

        vtk-examples/Cxx/Graphs/TreeBFSIterator

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/TreeBFSIterator/#code","title":"Code","text":"

        TreeBFSIterator.cxx

        #include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkTree.h>\n#include <vtkTreeBFSIterator.h>\n\nint main(int argc, char* argv[])\n{\n  // create a tree\n  vtkNew<vtkMutableDirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v3);\n\n  vtkNew<vtkTree> tree;\n  tree->CheckedShallowCopy(g);\n\n  // setup the iterator\n  vtkIdType root = 0;\n\n  vtkNew<vtkTreeBFSIterator> bfsIterator;\n  bfsIterator->SetStartVertex(root);\n  bfsIterator->SetTree(tree);\n\n  // traverse the tree in a breadth first fashion\n  while (bfsIterator->HasNext())\n  {\n    vtkIdType nextVertex = bfsIterator->Next();\n    std::cout << \"Next vertex: \" << nextVertex << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/TreeBFSIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TreeBFSIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TreeBFSIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TreeBFSIterator MACOSX_BUNDLE TreeBFSIterator.cxx )\n  target_link_libraries(TreeBFSIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TreeBFSIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/TreeBFSIterator/#download-and-build-treebfsiterator","title":"Download and Build TreeBFSIterator","text":"

        Click here to download TreeBFSIterator and its CMakeLists.txt file. Once the tarball TreeBFSIterator.tar has been downloaded and extracted,

        cd TreeBFSIterator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TreeBFSIterator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/TreeToMutableDirectedGraph/","title":"TreeToMutableDirectedGraph","text":"

        vtk-examples/Cxx/Graphs/TreeToMutableDirectedGraph

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/TreeToMutableDirectedGraph/#code","title":"Code","text":"

        TreeToMutableDirectedGraph.cxx

        #include <vtkMutableDirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkTree.h>\n\nint main(int, char*[])\n{\n\n  // create a graph\n  vtkNew<vtkMutableDirectedGraph> mdg;\n\n  // add 4 vertices to the graph\n  vtkIdType v1 = mdg->AddVertex();\n  vtkIdType v2 = mdg->AddVertex();\n  vtkIdType v3 = mdg->AddVertex();\n  vtkIdType v4 = mdg->AddVertex();\n\n  // add 3 edges to the graph\n  mdg->AddEdge(v1, v2);\n  mdg->AddEdge(v1, v3);\n  mdg->AddEdge(v1, v4);\n\n  // create 4 points - one for each vertex\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 2.0);\n\n  // add the coordinates of the points to the graph\n  mdg->SetPoints(points);\n\n  std::cout << \"MDG: \" << std::endl;\n  std::cout << \"Type: \" << mdg->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << mdg->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << mdg->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkTree> tree;\n  tree->CheckedShallowCopy(mdg);\n\n  std::cout << \"Tree: \" << std::endl;\n  std::cout << \"Type: \" << tree->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << tree->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << tree->GetNumberOfEdges() << std::endl;\n\n  vtkNew<vtkMutableDirectedGraph> mdg2;\n  if (!mdg2->CheckedShallowCopy(tree))\n  {\n    std::cerr << \"Could not convert!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::cout << \"MDG2: \" << std::endl;\n  std::cout << \"Type: \" << mdg2->GetClassName() << std::endl;\n  std::cout << \"Vertices: \" << mdg2->GetNumberOfVertices() << std::endl;\n  std::cout << \"Edges: \" << mdg2->GetNumberOfEdges() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/TreeToMutableDirectedGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TreeToMutableDirectedGraph)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TreeToMutableDirectedGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TreeToMutableDirectedGraph MACOSX_BUNDLE TreeToMutableDirectedGraph.cxx )\n  target_link_libraries(TreeToMutableDirectedGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TreeToMutableDirectedGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/TreeToMutableDirectedGraph/#download-and-build-treetomutabledirectedgraph","title":"Download and Build TreeToMutableDirectedGraph","text":"

        Click here to download TreeToMutableDirectedGraph and its CMakeLists.txt file. Once the tarball TreeToMutableDirectedGraph.tar has been downloaded and extracted,

        cd TreeToMutableDirectedGraph/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TreeToMutableDirectedGraph\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/VertexSize/","title":"VertexSize","text":"

        vtk-examples/Cxx/Graphs/VertexSize

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Graphs/VertexSize/#description","title":"Description","text":"

        Change the size of all vertices.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/VertexSize/#code","title":"Code","text":"

        VertexSize.cxx

        #include <vtkDataSetAttributes.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkGraphToGlyphs.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderedGraphRepresentation.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nclass CustomRepresentation : public vtkRenderedGraphRepresentation\n{\npublic:\n  static CustomRepresentation* New();\n  vtkTypeMacro(CustomRepresentation, vtkRenderedGraphRepresentation);\n\n  void SetVertexSize(int vertexSize)\n  {\n    this->VertexGlyph->SetScreenSize(vertexSize);\n    this->VertexGlyph->Modified();\n  }\n};\nvtkStandardNewMacro(CustomRepresentation);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v2);\n\n  // Specify coordinates so the graph is always the same for testing\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  g->SetPoints(points);\n\n  vtkNew<CustomRepresentation> representation;\n  representation->SetInputData(g);\n  representation->SetVertexSize(100);\n  representation->SetGlyphType(vtkGraphToGlyphs::CIRCLE);\n\n  vtkNew<vtkGraphLayoutView> layoutView;\n  layoutView->AddRepresentation(representation);\n  layoutView->SetLayoutStrategy(\"Pass Through\");\n  layoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SaddleBrown\").GetData());\n  layoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"Wheat\").GetData());\n  layoutView->GetRenderWindow()->SetWindowName(\"VertexSize\");\n  layoutView->ResetCamera();\n  layoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/VertexSize/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VertexSize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VertexSize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VertexSize MACOSX_BUNDLE VertexSize.cxx )\n  target_link_libraries(VertexSize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VertexSize\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/VertexSize/#download-and-build-vertexsize","title":"Download and Build VertexSize","text":"

        Click here to download VertexSize and its CMakeLists.txt file. Once the tarball VertexSize.tar has been downloaded and extracted,

        cd VertexSize/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VertexSize\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/VisualizeDirectedGraph/","title":"VisualizeDirectedGraph","text":"

        vtk-examples/Cxx/Graphs/VisualizeDirectedGraph

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/VisualizeDirectedGraph/#code","title":"Code","text":"

        VisualizeDirectedGraph.cxx

        #include <vtkActor.h>\n#include <vtkGlyph3D.h>\n#include <vtkGlyphSource2D.h>\n#include <vtkGraphLayout.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkGraphToPolyData.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimple2DLayoutStrategy.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableDirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v2, v3);\n  g->AddEdge(v3, v1);\n\n  // Do layout manually before handing graph to the view.\n  // This allows us to know the positions of edge arrows.\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n\n  vtkNew<vtkGraphLayout> layout;\n  vtkNew<vtkSimple2DLayoutStrategy> strategy;\n  layout->SetInputData(g);\n  layout->SetLayoutStrategy(strategy);\n\n  // Tell the view to use the vertex layout we provide\n  graphLayoutView->SetLayoutStrategyToPassThrough();\n  // The arrows will be positioned on a straight line between two\n  // vertices so tell the view not to draw arcs for parallel edges\n  graphLayoutView->SetEdgeLayoutStrategyToPassThrough();\n\n  // Add the graph to the view. This will render vertices and edges,\n  // but not edge arrows.\n  graphLayoutView->AddRepresentationFromInputConnection(\n      layout->GetOutputPort());\n\n  // Manually create an actor containing the glyphed arrows.\n  vtkNew<vtkGraphToPolyData> graphToPoly;\n  graphToPoly->SetInputConnection(layout->GetOutputPort());\n  graphToPoly->EdgeGlyphOutputOn();\n\n  // Set the position (0: edge start, 1: edge end) where\n  // the edge arrows should go.\n  graphToPoly->SetEdgeGlyphPosition(0.98);\n\n  // Make a simple edge arrow for glyphing.\n  vtkNew<vtkGlyphSource2D> arrowSource;\n  arrowSource->SetGlyphTypeToEdgeArrow();\n  arrowSource->SetScale(0.1);\n  arrowSource->Update();\n\n  // Use Glyph3D to repeat the glyph on all edges.\n  vtkNew<vtkGlyph3D> arrowGlyph;\n  arrowGlyph->SetInputConnection(0, graphToPoly->GetOutputPort(1));\n  arrowGlyph->SetInputConnection(1, arrowSource->GetOutputPort());\n\n  // Add the edge arrow actor to the view.\n  vtkNew<vtkPolyDataMapper> arrowMapper;\n  arrowMapper->SetInputConnection(arrowGlyph->GetOutputPort());\n  vtkNew<vtkActor> arrowActor;\n  arrowActor->SetMapper(arrowMapper);\n  graphLayoutView->GetRenderer()->AddActor(arrowActor);\n\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SaddleBrown\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"Wheat\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"VisualizeDirectedGraph\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/VisualizeDirectedGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeDirectedGraph)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeDirectedGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeDirectedGraph MACOSX_BUNDLE VisualizeDirectedGraph.cxx )\n  target_link_libraries(VisualizeDirectedGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeDirectedGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/VisualizeDirectedGraph/#download-and-build-visualizedirectedgraph","title":"Download and Build VisualizeDirectedGraph","text":"

        Click here to download VisualizeDirectedGraph and its CMakeLists.txt file. Once the tarball VisualizeDirectedGraph.tar has been downloaded and extracted,

        cd VisualizeDirectedGraph/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VisualizeDirectedGraph\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Graphs/VisualizeGraph/","title":"VisualizeGraph","text":"

        vtk-examples/Cxx/Graphs/VisualizeGraph

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Graphs/VisualizeGraph/#description","title":"Description","text":"

        This example shows how to construct a graph and visualize it. You can select edges and vertices with the mouse.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Graphs/VisualizeGraph/#code","title":"Code","text":"

        VisualizeGraph.cxx

        #include <vtkGraphLayoutView.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimple2DLayoutStrategy.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v2);\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  graphLayoutView->SetLayoutStrategy(\"Simple 2D\");\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SaddleBrown\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"Wheat\").GetData());\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"VisualizeGraph\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->Render();\n\n  dynamic_cast<vtkSimple2DLayoutStrategy*>(graphLayoutView->GetLayoutStrategy())\n      ->SetRandomSeed(0);\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Graphs/VisualizeGraph/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeGraph)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonDataModel\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeGraph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeGraph MACOSX_BUNDLE VisualizeGraph.cxx )\n  target_link_libraries(VisualizeGraph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeGraph\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Graphs/VisualizeGraph/#download-and-build-visualizegraph","title":"Download and Build VisualizeGraph","text":"

        Click here to download VisualizeGraph and its CMakeLists.txt file. Once the tarball VisualizeGraph.tar has been downloaded and extracted,

        cd VisualizeGraph/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VisualizeGraph\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/HyperTreeGrid/HyperTreeGridSource/","title":"HyperTreeGridSource","text":"

        vtk-examples/Cxx/HyperTreeGrid/HyperTreeGridSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/HyperTreeGrid/HyperTreeGridSource/#code","title":"Code","text":"

        HyperTreeGridSource.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkHyperTreeGridSource.h>\n#include <vtkHyperTreeGridToUnstructuredGrid.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkVersion.h>\n\n#include <cstdlib>\n\nint main(int, char*[])\n{\n  // Create hyper tree grid source\n  vtkNew<vtkHyperTreeGridSource> source;\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n  source->SetMaxDepth(6);\n#else\n  source->SetMaximumLevel(6);\n#endif\n  source->SetDimensions(4, 4, 3); // GridCell 3, 3, 2\n  source->SetGridScale(1.5, 1.0, 0.7);\n  source->SetBranchFactor(4);\n  source->SetDescriptor(\n      \"RRR .R. .RR ..R ..R .R.|R.......................... \"\n      \"........................... ........................... \"\n      \".............R............. ....RR.RR........R......... \"\n      \".....RRRR.....R.RR......... ........................... \"\n      \"........................... \"\n      \"...........................|........................... \"\n      \"........................... ........................... \"\n      \"...RR.RR.......RR.......... ........................... \"\n      \"RR......................... ........................... \"\n      \"........................... ........................... \"\n      \"........................... ........................... \"\n      \"........................... ........................... \"\n      \"............RRR............|........................... \"\n      \"........................... .......RR.................. \"\n      \"........................... ........................... \"\n      \"........................... ........................... \"\n      \"........................... ........................... \"\n      \"........................... \"\n      \"...........................|........................... \"\n      \"...........................\");\n  source->Update();\n\n  // Hyper tree grid to unstructured grid filter\n  vtkNew<vtkHyperTreeGridToUnstructuredGrid> htg2ug;\n  htg2ug->SetInputConnection(source->GetOutputPort());\n  htg2ug->Update();\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(htg2ug->GetOutputPort());\n  shrink->SetShrinkFactor(0.8);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Burlywood\").GetData());\n\n  // Create the RenderWindow, Renderer and Interactor\n  //\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(150);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"HyperTreeGridSource\");\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/HyperTreeGrid/HyperTreeGridSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HyperTreeGridSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersHyperTree\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HyperTreeGridSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HyperTreeGridSource MACOSX_BUNDLE HyperTreeGridSource.cxx )\n  target_link_libraries(HyperTreeGridSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HyperTreeGridSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/HyperTreeGrid/HyperTreeGridSource/#download-and-build-hypertreegridsource","title":"Download and Build HyperTreeGridSource","text":"

        Click here to download HyperTreeGridSource and its CMakeLists.txt file. Once the tarball HyperTreeGridSource.tar has been downloaded and extracted,

        cd HyperTreeGridSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HyperTreeGridSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/3DSImporter/","title":"3DSImporter","text":"

        vtk-examples/Cxx/IO/3DSImporter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/3DSImporter/#description","title":"Description","text":"

        This example illustrates Importing files in VTK. An importer creates a vtkRenderWindow that describes the scene.

        Info

        See Figure 4-13 in Chapter 4 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/3DSImporter/#code","title":"Code","text":"

        3DSImporter.cxx

        #include <vtk3DSImporter.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.3ds e.g. iflamingo.3ds\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtk3DSImporter> importer;\n  importer->SetFileName(argv[1]);\n  importer->ComputeNormalsOn();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  renWin->AddRenderer(renderer);\n  renderer->SetBackground2(colors->GetColor3d(\"Gold\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->GradientBackgroundOn();\n\n  iren->SetRenderWindow(renWin);\n  importer->SetRenderWindow(renWin);\n  importer->Update();\n\n  auto actors = renderer->GetActors();\n  std::cout << \"There are \" << actors->GetNumberOfItems() << \" actors.\"\n            << std::endl;\n\n  renWin->SetWindowName(\"3DSImporter\");\n\n  renWin->Render();\n\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, -1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Azimuth(150);\n  camera->Elevation(30);\n\n  renderer->SetActiveCamera(camera);\n  renderer->ResetCamera();\n  renderer->ResetCameraClippingRange();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/3DSImporter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(3DSImporter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"3DSImporter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(3DSImporter MACOSX_BUNDLE 3DSImporter.cxx )\n  target_link_libraries(3DSImporter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS 3DSImporter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/3DSImporter/#download-and-build-3dsimporter","title":"Download and Build 3DSImporter","text":"

        Click here to download 3DSImporter and its CMakeLists.txt file. Once the tarball 3DSImporter.tar has been downloaded and extracted,

        cd 3DSImporter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./3DSImporter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ConvertFile/","title":"ConvertFile","text":"

        vtk-examples/Cxx/IO/ConvertFile

        "},{"location":"Cxx/IO/ConvertFile/#description","title":"Description","text":"

        This example demonstrates how to read a file and then write it to a different type of file. In this example, we read a vtp file and write a ply file, but simply by changing the reader/writer classes instantiated, different behavior can be achieved.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ConvertFile/#code","title":"Code","text":"

        ConvertFile.cxx

        #include <vtkNew.h>\n#include <vtkPLYWriter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Required arguments: input.vtp output.ply e.g. Bunny.vtp \"\n                 \"ConvertFile.ply\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFileName = argv[1];\n  std::string outputFileName = argv[2];\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(inputFileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkPLYWriter> writer;\n  writer->SetFileName(outputFileName.c_str());\n  writer->SetInputConnection(reader->GetOutputPort());\n  writer->Update();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ConvertFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConvertFile)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOPLY\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConvertFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConvertFile MACOSX_BUNDLE ConvertFile.cxx )\n  target_link_libraries(ConvertFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConvertFile\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ConvertFile/#download-and-build-convertfile","title":"Download and Build ConvertFile","text":"

        Click here to download ConvertFile and its CMakeLists.txt file. Once the tarball ConvertFile.tar has been downloaded and extracted,

        cd ConvertFile/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConvertFile\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/DEMReader/","title":"DEMReader","text":"

        vtk-examples/Cxx/IO/DEMReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/DEMReader/#code","title":"Code","text":"

        DEMReader.cxx

        #include <vtkDEMReader.h>\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify arguments.\n  if (argc < 2)\n  {\n    std::cerr << \"Required: filename.dem e.g. SainteHelens.dem\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the file\n  vtkNew<vtkDEMReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.6, 0);\n  lut->SetSaturationRange(1.0, 0);\n  lut->SetValueRange(0.5, 1.0);\n  lut->SetTableRange(reader->GetOutput()->GetScalarRange());\n\n  // Visualize\n  vtkNew<vtkImageMapToColors> mapColors;\n  mapColors->SetLookupTable(lut);\n  mapColors->SetInputConnection(reader->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(mapColors->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DEMReader\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/DEMReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DEMReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DEMReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DEMReader MACOSX_BUNDLE DEMReader.cxx )\n  target_link_libraries(DEMReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DEMReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/DEMReader/#download-and-build-demreader","title":"Download and Build DEMReader","text":"

        Click here to download DEMReader and its CMakeLists.txt file. Once the tarball DEMReader.tar has been downloaded and extracted,

        cd DEMReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DEMReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/DumpXMLFile/","title":"DumpXMLFile","text":"

        vtk-examples/Cxx/IO/DumpXMLFile

        "},{"location":"Cxx/IO/DumpXMLFile/#description","title":"Description","text":"

        This example reports the cell, cell data and point data contained within a VTK XML or legacy file.

        Note

        This original source code for this example is here.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/DumpXMLFile/#code","title":"Code","text":"

        DumpXMLFile.cxx

        //\n// DumpXMLFile - report on the contents of an XML or legacy vtk file\n//  Usage: DumpXMLFile XMLFile1 XMLFile2 ...\n//         where\n//         XMLFile is a vtk XML file of type .vtu, .vtp, .vts, .vtr,\n//         .vti, .vto\n//\n#include <vtkCellData.h>\n#include <vtkCellTypes.h>\n#include <vtkDataSet.h>\n#include <vtkDataSetReader.h>\n#include <vtkFieldData.h>\n#include <vtkImageData.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkSmartPointer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLCompositeDataReader.h>\n#include <vtkXMLImageDataReader.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtkXMLReader.h>\n#include <vtkXMLRectilinearGridReader.h>\n#include <vtkXMLStructuredGridReader.h>\n#include <vtkXMLUnstructuredGridReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <map>\n\nnamespace {\n\ntemplate <class TReader> vtkDataSet* ReadAnXMLFile(const char* fileName)\n{\n  vtkNew<TReader> reader;\n  reader->SetFileName(fileName);\n  reader->Update();\n  reader->GetOutput()->Register(reader);\n  return dynamic_cast<vtkDataSet*>(reader->GetOutput());\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" XMLFile1 XMLFile2 ...\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Process each file on the command line.\n  int f = 1;\n  while (f < argc)\n  {\n    vtkSmartPointer<vtkDataSet> dataSet;\n    std::string extension =\n        vtksys::SystemTools::GetFilenameLastExtension(argv[f]);\n    // Dispatch based on the file extension.\n    if (extension == \".vtu\")\n    {\n      dataSet = ReadAnXMLFile<vtkXMLUnstructuredGridReader>(argv[f]);\n    }\n    else if (extension == \".vtp\")\n    {\n      dataSet = ReadAnXMLFile<vtkXMLPolyDataReader>(argv[f]);\n    }\n    else if (extension == \".vts\")\n    {\n      dataSet = ReadAnXMLFile<vtkXMLStructuredGridReader>(argv[f]);\n    }\n    else if (extension == \".vtr\")\n    {\n      dataSet = ReadAnXMLFile<vtkXMLRectilinearGridReader>(argv[f]);\n    }\n    else if (extension == \".vti\")\n    {\n      dataSet = ReadAnXMLFile<vtkXMLImageDataReader>(argv[f]);\n    }\n    else if (extension == \".vtk\")\n    {\n      dataSet = ReadAnXMLFile<vtkDataSetReader>(argv[f]);\n    }\n    else\n    {\n      std::cerr << argv[0] << \" Unknown extension: \" << extension << std::endl;\n      return EXIT_FAILURE;\n    }\n\n    int numberOfCells = dataSet->GetNumberOfCells();\n    int numberOfPoints = dataSet->GetNumberOfPoints();\n\n    // Generate a report.\n    std::cout << \"------------------------\" << std::endl;\n    std::cout << argv[f] << std::endl\n              << \" contains a \" << std::endl\n              << dataSet->GetClassName() << \" that has \" << numberOfCells\n              << \" cells\"\n              << \" and \" << numberOfPoints << \" points.\" << std::endl;\n    typedef std::map<int, int> CellContainer;\n    CellContainer cellMap;\n    for (int i = 0; i < numberOfCells; i++)\n    {\n      cellMap[dataSet->GetCellType(i)]++;\n    }\n\n    CellContainer::const_iterator it = cellMap.begin();\n    while (it != cellMap.end())\n    {\n      std::cout << \"\\tCell type \"\n                << vtkCellTypes::GetClassNameFromTypeId(it->first) << \" occurs \"\n                << it->second << \" times.\" << std::endl;\n      ++it;\n    }\n\n    // Now check for point data.\n    vtkPointData* pd = dataSet->GetPointData();\n    if (pd)\n    {\n      std::cout << \" contains point data with \" << pd->GetNumberOfArrays()\n                << \" arrays.\" << std::endl;\n      for (int i = 0; i < pd->GetNumberOfArrays(); i++)\n      {\n        std::cout << \"\\tArray \" << i << \" is named \"\n                  << (pd->GetArrayName(i) ? pd->GetArrayName(i) : \"NULL\")\n                  << \" has \" << pd->GetArray(i)->GetNumberOfTuples()\n                  << \" tuples\"\n                  << \" with \" << pd->GetArray(i)->GetNumberOfComponents()\n                  << \" components\"\n                  << \" of type \" << pd->GetArray(i)->GetClassName()\n                  << std::endl;\n      }\n    }\n\n    // Now check for cell data.\n    vtkCellData* cd = dataSet->GetCellData();\n    if (cd)\n    {\n      std::cout << \" contains cell data with \" << cd->GetNumberOfArrays()\n                << \" arrays.\" << std::endl;\n      for (int i = 0; i < cd->GetNumberOfArrays(); i++)\n      {\n        std::cout << \"\\tArray \" << i << \" is named \"\n                  << (cd->GetArrayName(i) ? cd->GetArrayName(i) : \"NULL\")\n                  << std::endl;\n      }\n    }\n\n    // Now check for field data.\n    if (dataSet->GetFieldData())\n    {\n      std::cout << \" contains field data with \"\n                << dataSet->GetFieldData()->GetNumberOfArrays() << \" arrays.\"\n                << std::endl;\n      for (int i = 0; i < dataSet->GetFieldData()->GetNumberOfArrays(); i++)\n      {\n        std::cout\n            << \"\\tArray \" << i << \" is named \"\n            << dataSet->GetFieldData()->GetArray(i)->GetName() << \" has \"\n            << dataSet->GetFieldData()->GetArray(i)->GetNumberOfTuples()\n            << \" tuples\"\n            << \" with \"\n            << dataSet->GetFieldData()->GetArray(i)->GetNumberOfComponents()\n            << \" components\"\n            << \" of type \"\n            << dataSet->GetFieldData()->GetArray(i)->GetClassName()\n            << std::endl;\n      }\n    }\n    f++;\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/DumpXMLFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DumpXMLFile)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOLegacy\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DumpXMLFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DumpXMLFile MACOSX_BUNDLE DumpXMLFile.cxx )\n  target_link_libraries(DumpXMLFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DumpXMLFile\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/DumpXMLFile/#download-and-build-dumpxmlfile","title":"Download and Build DumpXMLFile","text":"

        Click here to download DumpXMLFile and its CMakeLists.txt file. Once the tarball DumpXMLFile.tar has been downloaded and extracted,

        cd DumpXMLFile/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DumpXMLFile\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ExportPolyDataScene/","title":"ExportPolyDataScene","text":"

        vtk-examples/Cxx/IO/ExportPolyDataScene

        "},{"location":"Cxx/IO/ExportPolyDataScene/#description","title":"Description","text":"

        Danger

        This example is a work in progress.

        The example exports the vtkPolyData used by vtkActor's. The example stores the vtkMapper, vtkCamera, vtkActor and vtkProperty parameters as vtkFieldData in the vtkActor's vtkPolyData.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ExportPolyDataScene/#code","title":"Code","text":"

        ExportPolyDataScene.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDoubleArray.h>\n#include <vtkFieldData.h>\n#include <vtkLinearTransform.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarsToColors.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkXMLMultiBlockDataWriter.h>\n#include <vtksys/SystemTools.hxx>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\nvoid ExportMultiBlockScene(vtkRenderer* renderer, std::string fileName,\n                           bool binary = false);\nvoid SaveCameraAsFieldData(std::string const&, vtkCamera*, vtkPolyData*);\nvoid SavePropertyAsFieldData(std::string const&, vtkProperty*, vtkPolyData*);\nvoid SaveMapperAsFieldData(std::string const&, vtkPolyDataMapper*,\n                           vtkPolyData*);\nvoid SaveActorAsFieldData(std::string const&, vtkActor*, vtkPolyData*);\nvoid SaveLookupTableAsFieldData(std::string const&, vtkScalarsToColors*,\n                                vtkPolyData*);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double delta[3];\n  delta[0] = bounds[1] - bounds[0];\n  delta[1] = bounds[3] - bounds[2];\n  delta[2] = bounds[5] - bounds[4];\n  for (int c = 0; c < 4; ++c)\n  {\n    for (int b = 0; b < 4; ++b)\n    {\n      for (int a = 0; a < 4; ++a)\n      {\n        vtkNew<vtkPolyDataMapper> mapper;\n        mapper->SetInputData(polyData);\n\n        vtkNew<vtkProperty> backProperty;\n        backProperty->SetColor(colors->GetColor3d(\"peacock\").GetData());\n\n        vtkNew<vtkActor> actor;\n        actor->SetMapper(mapper);\n        actor->SetBackfaceProperty(backProperty);\n        if (b == 1)\n        {\n          actor->GetProperty()->SetDiffuseColor(\n              colors->GetColor3d(\"Orchid\").GetData());\n        }\n        else if (b == 2)\n        {\n          actor->GetProperty()->SetDiffuseColor(\n              colors->GetColor3d(\"Salmon\").GetData());\n        }\n        else if (b == 3)\n        {\n          actor->GetProperty()->SetDiffuseColor(\n              colors->GetColor3d(\"SandyBrown\").GetData());\n        }\n        else\n        {\n          actor->GetProperty()->SetDiffuseColor(\n              colors->GetColor3d(\"Crimson\").GetData());\n        }\n        actor->GetProperty()->SetSpecular(.5);\n        actor->GetProperty()->SetDiffuse(.5);\n        actor->GetProperty()->SetSpecularPower(a * b * c);\n        if ((a % 3) == 0)\n        {\n          actor->GetProperty()->EdgeVisibilityOn();\n          actor->GetProperty()->SetEdgeColor(\n              colors->GetColor3d(\"SlateGray\").GetData());\n          actor->GetProperty()->SetLineWidth(1.0);\n        }\n        else\n        {\n          actor->GetProperty()->EdgeVisibilityOff();\n        }\n        if ((a % 4) == 0)\n        {\n          actor->GetProperty()->FrontfaceCullingOn();\n        }\n        if ((a % 3) == 0 && (c & 3) == 0)\n        {\n          actor->GetProperty()->SetRepresentationToWireframe();\n        }\n        else\n        {\n          actor->GetProperty()->SetRepresentationToSurface();\n        }\n        if (c == 3)\n        {\n          vtkNew<vtkTransform> rotateTransform;\n          rotateTransform->RotateZ(30.0);\n          actor->GetProperty()->SetInterpolationToGouraud();\n          actor->SetUserTransform(rotateTransform);\n        }\n        else\n        {\n          actor->GetProperty()->SetInterpolationToFlat();\n        }\n        actor->AddPosition(1.5 * a * delta[0], 1.5 * b * delta[1],\n                           1.5 * c * delta[2]);\n        actor->SetScale((a + 1) * .5, (b + 1) * .5, (c + 1) * .5);\n\n        renderer->AddActor(actor);\n      }\n    }\n  }\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Yaw(10);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ExportPolyDataScene\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  std::string prefix;\n  if (argc < 2)\n  {\n    prefix = \"Sphere\";\n  }\n  else\n  {\n    prefix = \"Export\" +\n        vtksys::SystemTools::GetFilenameWithoutExtension(argv[1]) + \".vtp\";\n  }\n  std::cout << \"Scene is exported to \"\n            << vtksys::SystemTools::GetCurrentWorkingDirectory() + \"/\" + prefix\n            << std::endl;\n  ExportMultiBlockScene(renderer.GetPointer(), prefix, false);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid ExportMultiBlockScene(vtkRenderer* renderer, std::string fileName,\n                           bool binary)\n{\n  // Iterate over all actors in the renderer.\n  auto actors = renderer->GetActors();\n  std::cout << \"There are \" << actors->GetNumberOfItems() << \" actors\"\n            << std::endl;\n  actors->InitTraversal();\n  // Initialize dataset to write\n  vtkNew<vtkMultiBlockDataSet> multiBlockDataset;\n  multiBlockDataset->SetNumberOfBlocks(actors->GetNumberOfItems());\n\n  for (vtkIdType a = 0; a < actors->GetNumberOfItems(); ++a)\n  {\n    vtkActor* actor = actors->GetNextActor();\n\n    // Deep copy the polydata because it may be shared with other actors.\n    vtkNew<vtkPolyData> pd;\n    pd->DeepCopy(dynamic_cast<vtkPolyData*>(actor->GetMapper()->GetInput()));\n\n    // Set metadata for block.\n    multiBlockDataset->SetBlock(a, pd);\n\n    // Save Camera.\n    SaveCameraAsFieldData(\"Camera\", renderer->GetActiveCamera(), pd);\n\n    // Save Property.\n    SavePropertyAsFieldData(\"Property\", actor->GetProperty(), pd);\n    SavePropertyAsFieldData(\"BackfaceProperty\", actor->GetBackfaceProperty(),\n                            pd);\n    // Save Mapper.\n    SaveMapperAsFieldData(\"PolyDataMapper\",\n                          dynamic_cast<vtkPolyDataMapper*>(actor->GetMapper()),\n                          pd);\n    // Save Actor.\n    SaveActorAsFieldData(\"Actor\", actor, pd);\n  }\n\n  // Write multiblock dataset to disk.\n  vtkNew<vtkXMLMultiBlockDataWriter> writer;\n  if (binary)\n  {\n    writer->SetDataModeToBinary();\n    writer->SetCompressorTypeToZLib();\n  }\n  else\n  {\n    writer->SetDataModeToAscii();\n  }\n  writer->SetInputData(multiBlockDataset);\n  writer->SetFileName(fileName.c_str());\n  writer->Update();\n  return;\n}\n\n#define SAVE_SCALAR(arrayPrefix, instance, pd, name, T)                        \\\n  vtkSmartPointer<T> name = vtkSmartPointer<T>::New();                         \\\n  name->SetNumberOfComponents(1);                                              \\\n  name->SetNumberOfTuples(1);                                                  \\\n  name->SetValue(0, instance->Get##name());                                    \\\n  name->SetName(std::string(arrayPrefix + \":\" + \"#name\").c_str());             \\\n  pd->GetFieldData()->AddArray(name)\n\n#define SAVE_VECTOR(arrayPrefix, instance, pd, name, T, components, tuples)    \\\n  vtkSmartPointer<T> name = vtkSmartPointer<T>::New();                         \\\n  name->SetNumberOfComponents(components);                                     \\\n  name->SetNumberOfTuples(tuples);                                             \\\n  name->SetTuple(0, instance->Get##name());                                    \\\n  name->SetName(std::string(arrayPrefix + \":\" + \"#name\").c_str());             \\\n  pd->GetFieldData()->AddArray(name)\n\nvoid SaveCameraAsFieldData(std::string const& arrayPrefix, vtkCamera* camera,\n                           vtkPolyData* pd)\n{\n  SAVE_VECTOR(arrayPrefix, camera, pd, ViewUp, vtkDoubleArray, 3, 1);\n  SAVE_VECTOR(arrayPrefix, camera, pd, Position, vtkDoubleArray, 3, 1);\n  SAVE_VECTOR(arrayPrefix, camera, pd, FocalPoint, vtkDoubleArray, 3, 1);\n  SAVE_VECTOR(arrayPrefix, camera, pd, ClippingRange, vtkDoubleArray, 2, 1);\n  SAVE_SCALAR(arrayPrefix, camera, pd, ViewAngle, vtkDoubleArray);\n}\nvoid SavePropertyAsFieldData(std::string const& arrayPrefix,\n                             vtkProperty* property, vtkPolyData* pd)\n{\n  if (property)\n  {\n    SAVE_SCALAR(arrayPrefix, property, pd, Ambient, vtkDoubleArray);\n    SAVE_VECTOR(arrayPrefix, property, pd, AmbientColor, vtkDoubleArray, 3, 1);\n    SAVE_SCALAR(arrayPrefix, property, pd, Diffuse, vtkDoubleArray);\n    SAVE_VECTOR(arrayPrefix, property, pd, DiffuseColor, vtkDoubleArray, 3, 1);\n    SAVE_SCALAR(arrayPrefix, property, pd, Specular, vtkDoubleArray);\n    SAVE_VECTOR(arrayPrefix, property, pd, SpecularColor, vtkDoubleArray, 3, 1);\n    SAVE_SCALAR(arrayPrefix, property, pd, SpecularPower, vtkDoubleArray);\n    SAVE_VECTOR(arrayPrefix, property, pd, EdgeColor, vtkDoubleArray, 3, 1);\n    SAVE_SCALAR(arrayPrefix, property, pd, EdgeVisibility, vtkIntArray);\n    SAVE_VECTOR(arrayPrefix, property, pd, VertexColor, vtkDoubleArray, 3, 1);\n    SAVE_SCALAR(arrayPrefix, property, pd, Interpolation, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, Opacity, vtkDoubleArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, Representation, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, BackfaceCulling, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, FrontfaceCulling, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, PointSize, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, LineWidth, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, LineStipplePattern, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, LineStippleRepeatFactor,\n                vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, Lighting, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, RenderPointsAsSpheres, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, property, pd, Shading, vtkIntArray);\n\n    if (property->GetMaterialName())\n    {\n      SAVE_SCALAR(arrayPrefix, property, pd, MaterialName, vtkStringArray);\n    }\n  }\n}\nvoid SaveMapperAsFieldData(std::string const& arrayPrefix,\n                           vtkPolyDataMapper* mapper, vtkPolyData* pd)\n{\n  if (mapper->GetLookupTable())\n  {\n    std::string prefix = arrayPrefix + \"LookupTable:\";\n    vtkScalarsToColors* scalarsToColors = mapper->GetLookupTable();\n\n    SAVE_SCALAR(prefix, scalarsToColors, pd, Alpha, vtkDoubleArray);\n    SAVE_SCALAR(prefix, scalarsToColors, pd, VectorMode, vtkIntArray);\n    SAVE_SCALAR(prefix, scalarsToColors, pd, VectorComponent, vtkIntArray);\n    SAVE_SCALAR(prefix, scalarsToColors, pd, VectorSize, vtkIntArray);\n    SAVE_SCALAR(prefix, scalarsToColors, pd, IndexedLookup, vtkIntArray);\n\n    vtkLookupTable* lut =\n        dynamic_cast<vtkLookupTable*>(mapper->GetLookupTable());\n    SAVE_VECTOR(prefix, lut, pd, TableRange, vtkDoubleArray, 2, 1);\n    SAVE_SCALAR(prefix, lut, pd, Scale, vtkIntArray);\n    SAVE_VECTOR(prefix, lut, pd, HueRange, vtkDoubleArray, 2, 1);\n    SAVE_VECTOR(prefix, lut, pd, SaturationRange, vtkDoubleArray, 2, 1);\n    SAVE_VECTOR(prefix, lut, pd, ValueRange, vtkDoubleArray, 2, 1);\n    SAVE_VECTOR(prefix, lut, pd, AlphaRange, vtkDoubleArray, 2, 1);\n    SAVE_VECTOR(prefix, lut, pd, NanColor, vtkDoubleArray, 4, 1);\n    SAVE_VECTOR(prefix, lut, pd, BelowRangeColor, vtkDoubleArray, 4, 1);\n    SAVE_SCALAR(prefix, lut, pd, UseBelowRangeColor, vtkIntArray);\n    SAVE_VECTOR(prefix, lut, pd, AboveRangeColor, vtkDoubleArray, 4, 1);\n    SAVE_SCALAR(prefix, lut, pd, UseAboveRangeColor, vtkIntArray);\n    SAVE_SCALAR(prefix, lut, pd, NumberOfTableValues, vtkIntArray);\n    SAVE_SCALAR(prefix, lut, pd, Ramp, vtkIntArray);\n    SAVE_SCALAR(prefix, lut, pd, NumberOfColors, vtkIntArray);\n\n    auto Table = vtkSmartPointer<vtkUnsignedCharArray>::New();\n    //    Table->SetNumberOfComponents(4);\n    //    Table->SetNumberOfTuples(dynamic_cast<vtkLookupTable*>(lut)->GetTable()->GetNumberOfTuples());\n    Table->DeepCopy(dynamic_cast<vtkLookupTable*>(lut)->GetTable());\n    Table->SetName(\n        std::string(arrayPrefix + \":LookupTable:\" + \"Table\").c_str());\n    pd->GetFieldData()->AddArray(Table);\n\n    SAVE_SCALAR(arrayPrefix, mapper, pd, ScalarVisibility, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, Static, vtkIntArray);\n    SAVE_VECTOR(arrayPrefix, mapper, pd, ScalarRange, vtkDoubleArray, 2, 1);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, UseLookupTableScalarRange,\n                vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, ColorMode, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, InterpolateScalarsBeforeMapping,\n                vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, ScalarMode, vtkIntArray);\n    SAVE_SCALAR(arrayPrefix, mapper, pd, ResolveCoincidentTopology,\n                vtkIntArray);\n  }\n}\n\nvoid SaveActorAsFieldData(std::string const& arrayPrefix, vtkActor* actor,\n                          vtkPolyData* pd)\n{\n  SAVE_SCALAR(arrayPrefix, actor, pd, Dragable, vtkIntArray);\n  SAVE_SCALAR(arrayPrefix, actor, pd, Pickable, vtkIntArray);\n  SAVE_SCALAR(arrayPrefix, actor, pd, Visibility, vtkIntArray);\n  SAVE_VECTOR(arrayPrefix, actor, pd, Orientation, vtkDoubleArray, 3, 1);\n  SAVE_VECTOR(arrayPrefix, actor, pd, Origin, vtkDoubleArray, 3, 1);\n  SAVE_VECTOR(arrayPrefix, actor, pd, Scale, vtkDoubleArray, 3, 1);\n  SAVE_SCALAR(arrayPrefix, actor, pd, ForceOpaque, vtkIntArray);\n  SAVE_SCALAR(arrayPrefix, actor, pd, ForceTranslucent, vtkIntArray);\n\n  if (actor->GetUserTransform())\n  {\n    vtkLinearTransform* userTransform = actor->GetUserTransform();\n    userTransform->Print(std::cout);\n  }\n\n#if 0\nUserTransform\nUserMatrix\nTexture\n#endif\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/IO/ExportPolyDataScene/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExportPolyDataScene)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExportPolyDataScene: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExportPolyDataScene MACOSX_BUNDLE ExportPolyDataScene.cxx )\n  target_link_libraries(ExportPolyDataScene PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExportPolyDataScene\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ExportPolyDataScene/#download-and-build-exportpolydatascene","title":"Download and Build ExportPolyDataScene","text":"

        Click here to download ExportPolyDataScene and its CMakeLists.txt file. Once the tarball ExportPolyDataScene.tar has been downloaded and extracted,

        cd ExportPolyDataScene/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExportPolyDataScene\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/FindAllArrayNames/","title":"FindAllArrayNames","text":"

        vtk-examples/Cxx/IO/FindAllArrayNames

        "},{"location":"Cxx/IO/FindAllArrayNames/#description","title":"Description","text":"

        This example shows how to find out the names of all of the data arrays stored in a vtkPolyData.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/FindAllArrayNames/#code","title":"Code","text":"

        FindAllArrayNames.cxx

        #include <vtkCellData.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <string>\n#include <vector>\n\nnamespace {\nvoid FindAllData(vtkPolyData* polydata);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polydata;\n  if (argc < 2)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n    vtkNew<vtkXMLPolyDataWriter> writer;\n    writer->SetFileName(\"test.vtp\");\n    writer->SetInputConnection(sphereSource->GetOutputPort());\n    writer->Write();\n\n    polydata = sphereSource->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polydata = reader->GetOutput();\n  }\n\n  FindAllData(polydata);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid FindAllData(vtkPolyData* polydata)\n{\n  std::cout << \"Normals: \" << polydata->GetPointData()->GetNormals()\n            << std::endl;\n\n  vtkIdType numberOfPointArrays = polydata->GetPointData()->GetNumberOfArrays();\n  std::cout << \"Number of PointData arrays: \" << numberOfPointArrays\n            << std::endl;\n\n  vtkIdType numberOfCellArrays = polydata->GetCellData()->GetNumberOfArrays();\n  std::cout << \"Number of CellData arrays: \" << numberOfCellArrays << std::endl;\n\n  std::cout << \"Type table/key: \" << std::endl;\n  ;\n  // More values can be found in <VTK_DIR>/Common/Core/vtkSetGet.h\n  std::cout << VTK_UNSIGNED_CHAR << \" unsigned char\" << std::endl;\n  std::cout << VTK_UNSIGNED_INT << \" unsigned int\" << std::endl;\n  std::cout << VTK_FLOAT << \" float\" << std::endl;\n  std::cout << VTK_DOUBLE << \" double\" << std::endl;\n\n  for (vtkIdType i = 0; i < numberOfPointArrays; i++)\n  {\n    // The following two lines are equivalent.\n    // arrayNames.push_back(polydata->GetPointData()->GetArray(i)->GetName());\n    // arrayNames.push_back(polydata->GetPointData()->GetArrayName(i));\n    int dataTypeID = polydata->GetPointData()->GetArray(i)->GetDataType();\n    std::cout << \"Array \" << i << \": \"\n              << polydata->GetPointData()->GetArrayName(i)\n              << \" (type: \" << dataTypeID << \")\" << std::endl;\n  }\n\n  for (vtkIdType i = 0; i < numberOfCellArrays; i++)\n  {\n    // The following two lines are equivalent.\n    // polydata->GetPointData()->GetArray(i)->GetName();\n    // polydata->GetPointData()->GetArrayName(i);\n    int dataTypeID = polydata->GetCellData()->GetArray(i)->GetDataType();\n    std::cout << \"Array \" << i << \": \"\n              << polydata->GetCellData()->GetArrayName(i)\n              << \" (type: \" << dataTypeID << \")\" << std::endl;\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/IO/FindAllArrayNames/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FindAllArrayNames)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FindAllArrayNames: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FindAllArrayNames MACOSX_BUNDLE FindAllArrayNames.cxx )\n  target_link_libraries(FindAllArrayNames PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FindAllArrayNames\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/FindAllArrayNames/#download-and-build-findallarraynames","title":"Download and Build FindAllArrayNames","text":"

        Click here to download FindAllArrayNames and its CMakeLists.txt file. Once the tarball FindAllArrayNames.tar has been downloaded and extracted,

        cd FindAllArrayNames/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FindAllArrayNames\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/GLTFExporter/","title":"GLTFExporter","text":"

        vtk-examples/Cxx/IO/GLTFExporter

        "},{"location":"Cxx/IO/GLTFExporter/#description","title":"Description","text":"

        The examples uses vtkGLTFExporter to save the current scene in a .gltf file. The saved file called GLTFExporter.gltf is saved in the directory where the example is run. That file can be imported using vtkGLTFImporter.

        Warning

        Currently the camera is not writeen properly so the exported scene will not match the imported scene.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/GLTFExporter/#code","title":"Code","text":"

        GLTFExporter.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkGLTFExporter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: GLTFExporter file.gltf e.g. GLTFExporter.gltf\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SlateGray\");\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n\n  // Generate a random start and end point\n  double startPoint[3];\n  double endPoint[3];\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070); // For testing.\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    startPoint[i] = rng->GetRangeValue(-10, 10);\n    rng->Next();\n    endPoint[i] = rng->GetRangeValue(-10, 10);\n  }\n\n  // Compute a basis\n  double normalizedX[3];\n  double normalizedY[3];\n  double normalizedZ[3];\n\n  // The X axis is a vector from start to end\n  vtkMath::Subtract(endPoint, startPoint, normalizedX);\n  double length = vtkMath::Norm(normalizedX);\n  vtkMath::Normalize(normalizedX);\n\n  // The Z axis is an arbitrary vector cross X\n  double arbitrary[3];\n  for (auto i = 0; i < 3; ++i)\n  {\n    rng->Next();\n    arbitrary[i] = rng->GetRangeValue(-10, 10);\n  }\n  vtkMath::Cross(normalizedX, arbitrary, normalizedZ);\n  vtkMath::Normalize(normalizedZ);\n\n  // The Y axis is Z cross X\n  vtkMath::Cross(normalizedZ, normalizedX, normalizedY);\n  vtkNew<vtkMatrix4x4> matrix;\n\n  // Create the direction cosine matrix\n  matrix->Identity();\n  for (auto i = 0; i < 3; i++)\n  {\n    matrix->SetElement(i, 0, normalizedX[i]);\n    matrix->SetElement(i, 1, normalizedY[i]);\n    matrix->SetElement(i, 2, normalizedZ[i]);\n  }\n\n  // Apply the transforms.\n  vtkNew<vtkTransform> transform;\n  transform->Translate(startPoint);\n  transform->Concatenate(matrix);\n  transform->Scale(length, length, length);\n\n  // Transform the polydata.\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetTransform(transform);\n  transformPD->SetInputConnection(arrowSource->GetOutputPort());\n\n  // Create a mapper and actor for the arrow.\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n#ifdef USER_MATRIX\n  mapper->SetInputConnection(arrowSource->GetOutputPort());\n  actor->SetUserMatrix(transform->GetMatrix());\n#else\n  mapper->SetInputConnection(transformPD->GetOutputPort());\n#endif\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  // Create spheres for start and end point.\n  vtkNew<vtkSphereSource> sphereStartSource;\n  sphereStartSource->SetCenter(startPoint);\n  sphereStartSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereStartMapper;\n  sphereStartMapper->SetInputConnection(sphereStartSource->GetOutputPort());\n  vtkNew<vtkActor> sphereStart;\n  sphereStart->SetMapper(sphereStartMapper);\n  sphereStart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  vtkNew<vtkSphereSource> sphereEndSource;\n  sphereEndSource->SetCenter(endPoint);\n  sphereEndSource->SetRadius(0.8);\n  vtkNew<vtkPolyDataMapper> sphereEndMapper;\n  sphereEndMapper->SetInputConnection(sphereEndSource->GetOutputPort());\n  vtkNew<vtkActor> sphereEnd;\n  sphereEnd->SetMapper(sphereEndMapper);\n  sphereEnd->GetProperty()->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"GLTFExporter\");\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereStart);\n  renderer->AddActor(sphereEnd);\n  renderer->SetBackground(backgroundColor.GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  renderWindowInteractor->Start();\n\n  vtkNew<vtkGLTFExporter> writer;\n  writer->SetFileName(argv[1]);\n  writer->InlineDataOn();\n  writer->SetRenderWindow(renderWindow);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/GLTFExporter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GLTFExporter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  IOExport\n  IOExportOpenGL2\n  IOExportPDF\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GLTFExporter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GLTFExporter MACOSX_BUNDLE GLTFExporter.cxx )\n  target_link_libraries(GLTFExporter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GLTFExporter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/GLTFExporter/#download-and-build-gltfexporter","title":"Download and Build GLTFExporter","text":"

        Click here to download GLTFExporter and its CMakeLists.txt file. Once the tarball GLTFExporter.tar has been downloaded and extracted,

        cd GLTFExporter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GLTFExporter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/GLTFImporter/","title":"GLTFImporter","text":"

        vtk-examples/Cxx/IO/GLTFImporter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/GLTFImporter/#description","title":"Description","text":"

        The example uses vtkGLTFImporter to import a scene from a gltf file. glTF (derivative short form of GL Transmission Format) is a file format for 3D scenes and models using the JSON standard. It is an API-neutral runtime asset delivery format developed by the Khronos Group 3D Formats Working Group. It was announced at HTML5DevConf 2016.

        There are many sources of glTF file including:

        • SketchLab. To download you will need to signup. There are also non-free models offered here.
        • Khronos Group

        usage

        GLTFImporter FlightHelmet.gltf

        Warning

        When you run the example, be sure to specify the full pathname of the .glTF file. There is currently a bug in the vtkGLTFImporter. For example, if your home directry is /home/janedoe the the full pathname of the FlightHelmet data is /home/janedoe/VTKExamples/src/Testing/Data/gltf/FlightHelmet/FlightHelmet.gltf.

        Info

        The original data can be found here: FlightHelmet Data). Be sure to download all of the files.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/GLTFImporter/#code","title":"Code","text":"

        GLTFImporter.cxx

        #include <vtkCamera.h>\n#include <vtkGLTFImporter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc <= 1)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" <gltf file> e.g. FlightHelmet.gltf\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SlateGray\");\n\n  vtkNew<vtkGLTFImporter> importer;\n  importer->SetFileName(argv[1]);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 512);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"GLTFImporter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  importer->SetRenderWindow(renderWindow);\n  importer->Update();\n\n  vtkNew<vtkLight> headLight;\n  headLight->SetLightTypeToHeadlight();\n  headLight->SwitchOn();\n  renderer->AddLight(headLight);\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(20);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/GLTFImporter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GLTFImporter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GLTFImporter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GLTFImporter MACOSX_BUNDLE GLTFImporter.cxx )\n  target_link_libraries(GLTFImporter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GLTFImporter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/GLTFImporter/#download-and-build-gltfimporter","title":"Download and Build GLTFImporter","text":"

        Click here to download GLTFImporter and its CMakeLists.txt file. Once the tarball GLTFImporter.tar has been downloaded and extracted,

        cd GLTFImporter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GLTFImporter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/GenericDataObjectReader/","title":"GenericDataObjectReader","text":"

        vtk-examples/Cxx/IO/GenericDataObjectReader

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/GenericDataObjectReader/#code","title":"Code","text":"

        GenericDataObjectReader.cxx

        #include <vtkGenericDataObjectReader.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkStructuredGrid.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Ensure a filename was specified.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" InputFilename e.g. blow.vtk\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  // Get the filename from the command line.\n  std::string inputFilename = argv[1];\n\n  // Get all data from the file.\n  vtkNew<vtkGenericDataObjectReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // All of the standard data types can be checked and obtained like this:\n  if (reader->IsFilePolyData())\n  {\n    std::cout << \"output is polydata,\" << std::endl;\n    auto output = reader->GetPolyDataOutput();\n    std::cout << \"   output has \" << output->GetNumberOfPoints() << \" points.\"\n              << std::endl;\n  }\n\n  if (reader->IsFileUnstructuredGrid())\n  {\n    std::cout << \"output is unstructured grid,\" << std::endl;\n    auto output = reader->GetUnstructuredGridOutput();\n    std::cout << \"   output has \" << output->GetNumberOfPoints() << \" points.\"\n              << std::endl;\n  }\n\n  if (reader->IsFileStructuredGrid())\n  {\n    std::cout << \"output is structured grid,\" << std::endl;\n    auto output = reader->GetStructuredGridOutput();\n    std::cout << \"   output has \" << output->GetNumberOfPoints() << \" points.\"\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/GenericDataObjectReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GenericDataObjectReader)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOLegacy\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GenericDataObjectReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GenericDataObjectReader MACOSX_BUNDLE GenericDataObjectReader.cxx )\n  target_link_libraries(GenericDataObjectReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GenericDataObjectReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/GenericDataObjectReader/#download-and-build-genericdataobjectreader","title":"Download and Build GenericDataObjectReader","text":"

        Click here to download GenericDataObjectReader and its CMakeLists.txt file. Once the tarball GenericDataObjectReader.tar has been downloaded and extracted,

        cd GenericDataObjectReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GenericDataObjectReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/HDRReader/","title":"HDRReader","text":"

        vtk-examples/Cxx/IO/HDRReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/HDRReader/#description","title":"Description","text":"

        Demonstrates how to read high-dynamic-range imaging files.

        A callback is used to print out the color window (move the mouse horizontally over the image) and color level (move the mouse vertically over the image).

        This is based on IO/Image/Testing/Cxx/TestHDRReader.cxx in the VTK source files.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/HDRReader/#code","title":"Code","text":"

        HDRReader.cxx

        #include \"vtkHDRReader.h\"\n#include \"vtkImageData.h\"\n#include \"vtkImageViewer.h\"\n#include \"vtkNew.h\"\n#include \"vtkRenderWindowInteractor.h\"\n#include \"vtkRenderer.h\"\n#include <vtkCallbackCommand.h>\n\nnamespace {\nclass ColorCallback : public vtkCallbackCommand\n{\npublic:\n  static ColorCallback* New()\n  {\n    return new ColorCallback;\n  }\n  // Here we Create a vtkCallbackCommand and reimplement it.\n  void Execute(vtkObject* caller, unsigned long evId, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    // Just do this to demonstrate who called callback and the event that\n    // triggered it.\n    // std::cout << interactor->GetClassName() << \"  Event Id: \" << evId\n    //          << std::endl;\n\n    std::cout << \"Color window: \" << imageViewer->GetColorWindow();\n    std::cout << \" level: \" << imageViewer->GetColorLevel() << std::endl;\n  }\n  ColorCallback() : imageViewer(nullptr)\n  {\n  }\n  // Set pointers to any clientData or callData here.\n  vtkImageViewer* imageViewer;\n\nprivate:\n  ColorCallback(const ColorCallback&) = delete;\n  void operator=(const ColorCallback&) = delete;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc <= 1)\n  {\n    cout << \"Usage: \" << argv[0] << \" <hdr file>\" << endl;\n    cout << \"For example: Skyboxes/spiaggia_di_mondello_1k.hdr\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkHDRReader> reader;\n\n  // Check the image can be read\n  if (!reader->CanReadFile(filename.c_str()))\n  {\n    cerr << \"CanReadFile failed for \" << filename.c_str() << \"\\n\";\n    return EXIT_FAILURE;\n  }\n\n  reader->SetFileName(filename.c_str());\n  reader->UpdateInformation();\n\n  // Whole extent\n  const int* we = reader->GetDataExtent();\n  const int extents[6] = {we[0], we[1], we[2], we[3], 0, 0};\n  reader->UpdateExtent(extents);\n  // Visualize\n  vtkNew<vtkImageViewer> imageViewer;\n  imageViewer->SetInputData(reader->GetOutput());\n\n  imageViewer->SetColorWindow(1);\n  imageViewer->SetColorLevel(1);\n  imageViewer->SetPosition(0, 100);\n\n  vtkNew<ColorCallback> getColorWindow;\n  getColorWindow->imageViewer = imageViewer;\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  imageViewer->SetupInteractor(iren);\n  imageViewer->GetRenderWindow()->SetWindowName(\"HDRReader\");\n  imageViewer->Render();\n\n  iren->AddObserver(vtkCommand::EndInteractionEvent, getColorWindow);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/HDRReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HDRReader)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HDRReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HDRReader MACOSX_BUNDLE HDRReader.cxx )\n  target_link_libraries(HDRReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HDRReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/HDRReader/#download-and-build-hdrreader","title":"Download and Build HDRReader","text":"

        Click here to download HDRReader and its CMakeLists.txt file. Once the tarball HDRReader.tar has been downloaded and extracted,

        cd HDRReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HDRReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ImageReader2Factory/","title":"ImageReader2Factory","text":"

        vtk-examples/Cxx/IO/ImageReader2Factory

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ImageReader2Factory/#description","title":"Description","text":"

        Use vtkImageReader2Factory to read any of the supported vtk image formats.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ImageReader2Factory/#code","title":"Code","text":"

        ImageReader2Factory.cxx

        #include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  // Verify command line arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputFilename e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Parse command line arguments.\n  std::string inputFilename = argv[1];\n\n  // Read file.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imageReader;\n  imageReader.TakeReference(\n      readerFactory->CreateImageReader2(inputFilename.c_str()));\n  imageReader->SetFileName(inputFilename.c_str());\n  imageReader->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(imageReader->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Slate_grey\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageReader2Factory\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ImageReader2Factory/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageReader2Factory)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageReader2Factory: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageReader2Factory MACOSX_BUNDLE ImageReader2Factory.cxx )\n  target_link_libraries(ImageReader2Factory PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageReader2Factory\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ImageReader2Factory/#download-and-build-imagereader2factory","title":"Download and Build ImageReader2Factory","text":"

        Click here to download ImageReader2Factory and its CMakeLists.txt file. Once the tarball ImageReader2Factory.tar has been downloaded and extracted,

        cd ImageReader2Factory/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageReader2Factory\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ImageWriter/","title":"ImageWriter","text":"

        vtk-examples/Cxx/IO/ImageWriter

        "},{"location":"Cxx/IO/ImageWriter/#description","title":"Description","text":"

        A generic function WriteImage() is provided that selects what image writer to use based on the file extenstion and then writes the render window to the file. The following formats are supported: BMP, JPEG, PNM, PNG, PostScript, TIFF.

        If no file extension is specified, PNG is assumed.

        The function WriteImage() is also available in the Snippets.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ImageWriter/#code","title":"Code","text":"

        ImageWriter.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBMPWriter.h>\n#include <vtkImageWriter.h>\n#include <vtkJPEGWriter.h>\n#include <vtkPNGWriter.h>\n#include <vtkPNMWriter.h>\n#include <vtkPostScriptWriter.h>\n#include <vtkTIFFWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <array>\n#include <locale>\n#include <string>\n\nnamespace {\n\n/**\n *  Write the render window view to an image file.\n *\n *  Image types supported are:\n *    BMP, JPEG, PNM, PNG, PostScript, TIFF.\n *  The default parameters are used for all writers, change as needed.\n *\n *  @param fileName The file name, if no extension then PNG is assumed.\n *  @param renWin The render window.\n *  @param rgba Used to set the buffer type.\n *\n */\nvoid WriteImage(std::string const& fileName, vtkRenderWindow* renWin,\n                bool rgba = true);\n} // namespace\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the rendering window, renderer, and interactive renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the source.\n  vtkNew<vtkSphereSource> source;\n  source->SetCenter(0, 0, 0);\n  source->SetRadius(5.0);\n\n  // mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  // actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // color the actor\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // assign actor to the renderer\n  ren->AddActor(actor);\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  renWin->SetWindowName(\"ImageWriter\");\n  renWin->Render();\n\n  std::vector<std::string> ext = {{\"\"},      {\".png\"}, {\".jpg\"}, {\".ps\"},\n                                  {\".tiff\"}, {\".bmp\"}, {\".pnm\"}};\n  std::vector<std::string> filenames;\n  std::transform(ext.begin(), ext.end(), std::back_inserter(filenames),\n                 [](const std::string& e) { return \"ImageWriter\" + e; });\n  filenames[0] = filenames[0] + '1';\n  for (auto const& f : filenames)\n  {\n    WriteImage(f, renWin, false);\n  }\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid WriteImage(std::string const& fileName, vtkRenderWindow* renWin, bool rgba)\n{\n  if (!fileName.empty())\n  {\n    std::string fn = fileName;\n    std::string ext;\n    auto found = fn.find_last_of(\".\");\n    if (found == std::string::npos)\n    {\n      ext = \".png\";\n      fn += ext;\n    }\n    else\n    {\n      ext = fileName.substr(found, fileName.size());\n    }\n    std::locale loc;\n    std::transform(ext.begin(), ext.end(), ext.begin(),\n                   [=](char const& c) { return std::tolower(c, loc); });\n    auto writer = vtkSmartPointer<vtkImageWriter>::New();\n    if (ext == \".bmp\")\n    {\n      writer = vtkSmartPointer<vtkBMPWriter>::New();\n    }\n    else if (ext == \".jpg\")\n    {\n      writer = vtkSmartPointer<vtkJPEGWriter>::New();\n    }\n    else if (ext == \".pnm\")\n    {\n      writer = vtkSmartPointer<vtkPNMWriter>::New();\n    }\n    else if (ext == \".ps\")\n    {\n      if (rgba)\n      {\n        rgba = false;\n      }\n      writer = vtkSmartPointer<vtkPostScriptWriter>::New();\n    }\n    else if (ext == \".tiff\")\n    {\n      writer = vtkSmartPointer<vtkTIFFWriter>::New();\n    }\n    else\n    {\n      writer = vtkSmartPointer<vtkPNGWriter>::New();\n    }\n    vtkNew<vtkWindowToImageFilter> window_to_image_filter;\n    window_to_image_filter->SetInput(renWin);\n    window_to_image_filter->SetScale(1); // image quality\n    if (rgba)\n    {\n      window_to_image_filter->SetInputBufferTypeToRGBA();\n    }\n    else\n    {\n      window_to_image_filter->SetInputBufferTypeToRGB();\n    }\n    // Read from the front buffer.\n    window_to_image_filter->ReadFrontBufferOff();\n    window_to_image_filter->Update();\n\n    writer->SetFileName(fn.c_str());\n    writer->SetInputConnection(window_to_image_filter->GetOutputPort());\n    writer->Write();\n  }\n  else\n  {\n    std::cerr << \"No filename provided.\" << std::endl;\n  }\n\n  return;\n}\n\n} // namespace\n
        "},{"location":"Cxx/IO/ImageWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageWriter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageWriter MACOSX_BUNDLE ImageWriter.cxx )\n  target_link_libraries(ImageWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ImageWriter/#download-and-build-imagewriter","title":"Download and Build ImageWriter","text":"

        Click here to download ImageWriter and its CMakeLists.txt file. Once the tarball ImageWriter.tar has been downloaded and extracted,

        cd ImageWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ImportPolyDataScene/","title":"ImportPolyDataScene","text":"

        vtk-examples/Cxx/IO/ImportPolyDataScene

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ImportPolyDataScene/#code","title":"Code","text":"

        ImportPolyDataScene.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCompositeDataSet.h>\n#include <vtkDataObjectTreeIterator.h>\n#include <vtkFieldData.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n#include <vtkXMLMultiBlockDataReader.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#include <vtkDataObjectTreeRange.h>\n#endif\n\nnamespace {\nvoid ImportMultiBlockScene(vtkRenderer* renderer, std::string fileName);\nvoid RestoreCameraFromFieldData(std::string const&, vtkCamera*, vtkPolyData*);\nvoid RestorePropertyFromFieldData(std::string const&, vtkProperty*,\n                                  vtkPolyData*);\nvoid RestoreActorFromFieldData(std::string const&, vtkActor*, vtkPolyData*);\n// These functions need to be written.\n// void RestoreMapperFromFieldData(std::string const&, vtkPolyDataMapper*,\n//                                vtkPolyData*);\n// void RestoreLookupTableFromFieldData(std::string const&, vtkScalarsToColors*,\n//                                     vtkPolyData*);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.vtp e.g. ExportBunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Visualization\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImportPolyDataScene\");\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  ImportMultiBlockScene(renderer.GetPointer(), std::string(argv[1]));\n  renderWindow->Render();\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid ImportMultiBlockScene(vtkRenderer* renderer, std::string fileName)\n{\n  vtkCamera* camera = renderer->GetActiveCamera();\n\n  // Read the multiblock data\n  // auto reader = vtkSmartPointer<vtkXMLMultiBlockDataReader>::New();\n  vtkNew<vtkXMLMultiBlockDataReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->Update();\n  std::cout << \"Importing \"\n            << dynamic_cast<vtkMultiBlockDataSet*>(reader->GetOutput())\n                   ->GetNumberOfBlocks()\n            << \" actors\" << std::endl;\n\n#if VTK890\n  vtkDataObjectTree* input =\n      dynamic_cast<vtkDataObjectTree*>(reader->GetOutput());\n\n  using Opts = vtk::DataObjectTreeOptions;\n  for (vtkDataObject* dso :\n       vtk::Range(input, Opts::SkipEmptyNodes | Opts::VisitOnlyLeaves))\n  {\n    vtkPolyData* pd = dynamic_cast<vtkPolyData*>(dso);\n    RestoreCameraFromFieldData(\"Camera\", camera, pd);\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(pd);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    RestorePropertyFromFieldData(\"Property\", actor->GetProperty(), pd);\n    vtkNew<vtkProperty> backProperty;\n    actor->SetBackfaceProperty(backProperty);\n    RestorePropertyFromFieldData(\"BackfaceProperty\",\n                                 actor->GetBackfaceProperty(), pd);\n    RestoreActorFromFieldData(\"Actor\", actor, pd);\n    renderer->AddActor(actor);\n  }\n#else\n  vtkCompositeDataSet* input =\n      dynamic_cast<vtkCompositeDataSet*>(reader->GetOutput());\n\n  vtkNew<vtkDataObjectTreeIterator> iter;\n  iter->SetDataSet(input);\n  iter->SkipEmptyNodesOn();\n  iter->VisitOnlyLeavesOn();\n  for (iter->InitTraversal(); !iter->IsDoneWithTraversal();\n       iter->GoToNextItem())\n  {\n    vtkDataObject* dso = iter->GetCurrentDataObject();\n    vtkPolyData* pd = dynamic_cast<vtkPolyData*>(dso);\n    RestoreCameraFromFieldData(\"Camera\", camera, pd);\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(pd);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    RestorePropertyFromFieldData(\"Property\", actor->GetProperty(), pd);\n    vtkNew<vtkProperty> backProperty;\n    actor->SetBackfaceProperty(backProperty);\n    RestorePropertyFromFieldData(\"BackfaceProperty\",\n                                 actor->GetBackfaceProperty(), pd);\n    RestoreActorFromFieldData(\"Actor\", actor, pd);\n    renderer->AddActor(actor);\n  }\n#endif\n}\nvoid RestoreCameraFromFieldData(std::string const& arrayPrefix,\n                                vtkCamera* camera, vtkPolyData* pd)\n{\n  vtkFieldData* fd = pd->GetFieldData();\n  camera->SetFocalPoint(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"FocalPoint\").c_str())\n          ->GetTuple(0));\n  camera->SetPosition(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Position\").c_str())\n          ->GetTuple(0));\n  camera->SetViewUp(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"ViewUp\").c_str())\n          ->GetTuple(0));\n  camera->SetClippingRange(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"ClippingRange\").c_str())\n          ->GetTuple(0));\n  camera->SetViewAngle(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"ViewAngle\").c_str())\n          ->GetTuple1(0));\n}\nvoid RestorePropertyFromFieldData(std::string const& arrayPrefix,\n                                  vtkProperty* property, vtkPolyData* pd)\n{\n  if (property)\n  {\n    vtkFieldData* fd = pd->GetFieldData();\n\n    property->SetAmbient(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Ambient\").c_str())\n            ->GetTuple1(0));\n    property->SetAmbientColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"AmbientColor\").c_str())\n            ->GetTuple(0));\n    property->SetAmbientColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"AmbientColor\").c_str())\n            ->GetTuple(0));\n    property->SetDiffuse(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Diffuse\").c_str())\n            ->GetTuple1(0));\n    property->SetDiffuseColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"DiffuseColor\").c_str())\n            ->GetTuple(0));\n    property->SetSpecular(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Specular\").c_str())\n            ->GetTuple1(0));\n    property->SetSpecularColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"SpecularColor\").c_str())\n            ->GetTuple(0));\n    property->SetSpecularPower(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"SpecularPower\").c_str())\n            ->GetTuple1(0));\n    property->SetEdgeColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"EdgeColor\").c_str())\n            ->GetTuple(0));\n    property->SetEdgeVisibility(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"EdgeVisibility\").c_str())\n            ->GetTuple1(0));\n    property->SetVertexColor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"VertexColor\").c_str())\n            ->GetTuple(0));\n    property->SetVertexVisibility(\n        fd->GetArray(\n              std::string(arrayPrefix + \":\" + \"VertexVisibility\").c_str())\n            ->GetTuple1(0));\n    property->SetInterpolation(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Interpolation\").c_str())\n            ->GetTuple1(0));\n    property->SetOpacity(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Opacity\").c_str())\n            ->GetTuple1(0));\n    property->SetRepresentation(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Representation\").c_str())\n            ->GetTuple1(0));\n    property->SetBackfaceCulling(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"BackfaceCulling\").c_str())\n            ->GetTuple1(0));\n    property->SetFrontfaceCulling(\n        fd->GetArray(\n              std::string(arrayPrefix + \":\" + \"FrontfaceCulling\").c_str())\n            ->GetTuple1(0));\n    property->SetPointSize(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"PointSize\").c_str())\n            ->GetTuple1(0));\n    property->SetLineWidth(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"LineWidth\").c_str())\n            ->GetTuple1(0));\n    property->SetLineStipplePattern(\n        fd->GetArray(\n              std::string(arrayPrefix + \":\" + \"LineStipplePattern\").c_str())\n            ->GetTuple1(0));\n    property->SetLineStippleRepeatFactor(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"LineStippleRepeatFactor\")\n                         .c_str())\n            ->GetTuple1(0));\n    property->SetLighting(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Lighting\").c_str())\n                    ->GetTuple1(0) == 1.0\n            ? true\n            : false);\n    property->SetRenderPointsAsSpheres(\n        fd->GetArray(\n              std::string(arrayPrefix + \":\" + \"RenderPointsAsSpheres\").c_str())\n                    ->GetTuple1(0) == 1.0\n            ? true\n            : false);\n    property->SetRenderLinesAsTubes(\n        fd->GetArray(\n              std::string(arrayPrefix + \":\" + \"RenderLinesAsTubes\").c_str())\n                    ->GetTuple1(0) == 1.0\n            ? true\n            : false);\n    property->SetShading(\n        fd->GetArray(std::string(arrayPrefix + \":\" + \"Shading\").c_str())\n                    ->GetTuple1(0) == 1.0\n            ? true\n            : false);\n  }\n}\nvoid RestoreActorFromFieldData(std::string const& arrayPrefix, vtkActor* actor,\n                               vtkPolyData* pd)\n{\n  vtkFieldData* fd = pd->GetFieldData();\n\n  actor->SetDragable(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Dragable\").c_str())\n                  ->GetTuple1(0) == 1.0\n          ? true\n          : false);\n  actor->SetPickable(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Pickable\").c_str())\n                  ->GetTuple1(0) == 1.0\n          ? true\n          : false);\n  actor->SetVisibility(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Visibility\").c_str())\n          ->GetTuple1(0));\n  actor->SetPosition(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Position\").c_str())\n          ->GetTuple(0));\n  actor->SetOrientation(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Orientation\").c_str())\n          ->GetTuple(0));\n  actor->SetOrigin(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"Origin\").c_str())\n          ->GetTuple(0));\n  actor->SetScale(fd->GetArray(std::string(arrayPrefix + \":\" + \"Scale\").c_str())\n                      ->GetTuple(0));\n  actor->SetForceOpaque(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"ForceOpaque\").c_str())\n                  ->GetTuple1(0) == 1.0\n          ? true\n          : false);\n  actor->SetForceTranslucent(\n      fd->GetArray(std::string(arrayPrefix + \":\" + \"ForceTranslucent\").c_str())\n                  ->GetTuple1(0) == 1.0\n          ? true\n          : false);\n}\n} // namespace\n
        "},{"location":"Cxx/IO/ImportPolyDataScene/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImportPolyDataScene)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImportPolyDataScene: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImportPolyDataScene MACOSX_BUNDLE ImportPolyDataScene.cxx )\n  target_link_libraries(ImportPolyDataScene PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImportPolyDataScene\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ImportPolyDataScene/#download-and-build-importpolydatascene","title":"Download and Build ImportPolyDataScene","text":"

        Click here to download ImportPolyDataScene and its CMakeLists.txt file. Once the tarball ImportPolyDataScene.tar has been downloaded and extracted,

        cd ImportPolyDataScene/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImportPolyDataScene\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ImportToExport/","title":"ImportToExport","text":"

        vtk-examples/Cxx/IO/ImportToExport

        "},{"location":"Cxx/IO/ImportToExport/#description","title":"Description","text":"

        This example imports one of vtk3DSImporter, vtkGLTFImporter, vtkOBJImporter or vtkVRMLImporter and exports the scene using one of vtkOBJExporter

        The parameters are the input file(s) and an export file name with extension.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ImportToExport/#code","title":"Code","text":"

        ImportToExport.cxx

        #include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Importers\n#include <vtk3DSImporter.h>\n#include <vtkGLTFImporter.h>\n#include <vtkOBJImporter.h>\n#include <vtkVRMLImporter.h>\n\n// Exporters\n#include <vtkGLTFExporter.h>\n// #include <vtkIVExporter.h>\n#include <vtkOBJExporter.h>\n// #include <vtkOOGLExporter.h>\n// #include <vtkRIBExporter.h>\n// #include <vtkSVGExporter.h>\n#include <vtkVRMLExporter.h>\n#include <vtkX3DExporter.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <iterator>  // For prev\n#include <set>       // For valid extensions\n#include <sstream>   // For stringstream\n#include <string>    // For find_last_of()\n\nint main(int argc, char* argv[])\n{\n  auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();\n  auto renderer = vtkSmartPointer<vtkRenderer>::New();\n\n  if (argc < 3)\n  {\n    std::cerr << \"Expects input file name(s) and an output filename e.g. \"\n                 \"iflamingo.3ds iflamingo.obj\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n  std::string extension = \"\";\n  int outputFileArgOffset = 0; // depends on importer\n\n  std::set<std::string> inputExtensions{{\n      \"3ds\",\n      \"glb\",\n      \"gltf\",\n      \"obj\",\n      \"wrl\",\n  }};\n  std::set<std::string> outputExtensions{{\n      \"glb\",\n      \"gltf\",\n      \"obj\",\n      \"wrl\",\n      \"x3d\",\n  }};\n\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\") + 1);\n  }\n  if (inputExtensions.find(extension) == inputExtensions.end())\n  {\n    std::cout << \"Invalid input extension.\\nValid extensions are: \"\n              << std::endl;\n    for (auto it = inputExtensions.begin(); it != inputExtensions.end(); ++it)\n    {\n      if (it != std::prev(inputExtensions.end()))\n      {\n        std::cout << *it << \", \";\n      }\n      else\n      {\n        std::cout << *it << std::endl;\n      }\n    }\n    return EXIT_FAILURE;\n  }\n\n  if (extension == \"wrl\")\n  {\n    vtkNew<vtkVRMLImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(renderWindow);\n    renderWindow = importer->GetRenderWindow();\n    renderer = importer->GetRenderer();\n    importer->Read();\n    outputFileArgOffset = 2;\n  }\n  else if (extension == \"3ds\")\n  {\n    vtkNew<vtk3DSImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(renderWindow);\n    importer->ComputeNormalsOn();\n    renderWindow = importer->GetRenderWindow();\n    renderer = importer->GetRenderer();\n    importer->Read();\n    outputFileArgOffset = 2;\n  }\n  else if (extension == \"gltf\" || extension == \"glb\")\n  {\n    vtkNew<vtkGLTFImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(renderWindow);\n    renderWindow = importer->GetRenderWindow();\n    renderer = importer->GetRenderer();\n    importer->Read();\n    outputFileArgOffset = 2;\n  }\n  else if (extension == \"obj\")\n  {\n    vtkNew<vtkOBJImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetFileNameMTL(argv[2]);\n    importer->SetTexturePath(argv[3]);\n    importer->SetRenderWindow(renderWindow);\n    renderWindow = importer->GetRenderWindow();\n    renderer = importer->GetRenderer();\n    importer->Read();\n    outputFileArgOffset = 4;\n  }\n\n  std::string outputFileName = argv[outputFileArgOffset];\n  std::string outputExtension{\"\"};\n  // Split the file path and extension\n  if (outputFileName.find_last_of(\".\") != std::string::npos)\n  {\n    outputExtension =\n        outputFileName.substr(outputFileName.find_last_of(\".\") + 1);\n    auto pos = outputFileName.rfind(\".\", outputFileName.length());\n    if (pos != std::string::npos)\n    {\n      outputFileName = outputFileName.substr(0, pos);\n    }\n  }\n  std::transform(outputExtension.begin(), outputExtension.end(),\n                 outputExtension.begin(), ::tolower);\n\n  if (outputExtensions.find(outputExtension) == outputExtensions.end())\n  {\n    std::cout << \"Invalid output extension.\\nValid extensions are: \"\n              << std::endl;\n    for (auto it = outputExtensions.begin(); it != outputExtensions.end(); ++it)\n    {\n      if (it != std::prev(outputExtensions.end()))\n      {\n        std::cout << *it << \", \";\n      }\n      else\n      {\n        std::cout << *it << std::endl;\n      }\n    }\n    return EXIT_FAILURE;\n  }\n\n  if (outputExtension == \"obj\")\n  {\n    std::string exportFileName;\n    exportFileName = outputFileName + \".\" + outputExtension;\n    vtkNew<vtkOBJExporter> exporter;\n    std::stringstream comment;\n    comment << \"Converted by ImportExport from \" << fileName;\n    exporter->SetOBJFileComment(comment.str().c_str());\n    exporter->SetMTLFileComment(comment.str().c_str());\n    exporter->SetActiveRenderer(renderer);\n    exporter->SetRenderWindow(renderWindow);\n    exporter->SetFilePrefix(outputFileName.c_str());\n    std::cout << \"Writing \" << exportFileName << std::endl;\n    exporter->Write();\n  }\n  else if (outputExtension == \"wrl\")\n  {\n    std::string exportFileName;\n    exportFileName = outputFileName + \".\" + outputExtension;\n    vtkNew<vtkVRMLExporter> exporter;\n    exporter->SetFileName(exportFileName.c_str());\n    exporter->SetActiveRenderer(renderer);\n    exporter->SetRenderWindow(renderWindow);\n    std::cout << \"Writing \" << exportFileName << std::endl;\n    exporter->Write();\n  }\n  else if (outputExtension == \"gltf\" || outputExtension == \"glb\")\n  {\n    std::string exportFileName;\n    exportFileName = outputFileName + \".\" + \"gltf\";\n    vtkNew<vtkGLTFExporter> exporter;\n    exporter->SetFileName(exportFileName.c_str());\n    exporter->SetActiveRenderer(renderer);\n    exporter->SetRenderWindow(renderWindow);\n    std::cout << \"Writing \" << exportFileName << std::endl;\n    exporter->Write();\n  }\n  else if (outputExtension == \"x3d\")\n  {\n    std::string exportFileName;\n    exportFileName = outputFileName + \".\" + outputExtension;\n    vtkNew<vtkX3DExporter> exporter;\n    exporter->SetFileName(exportFileName.c_str());\n    exporter->SetActiveRenderer(renderer);\n    exporter->SetRenderWindow(renderWindow);\n    std::cout << \"Writing \" << exportFileName << std::endl;\n    exporter->Write();\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ImportToExport/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImportToExport)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOExport\n  IOExportOpenGL2\n  IOExportPDF\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImportToExport: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImportToExport MACOSX_BUNDLE ImportToExport.cxx )\n  target_link_libraries(ImportToExport PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImportToExport\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ImportToExport/#download-and-build-importtoexport","title":"Download and Build ImportToExport","text":"

        Click here to download ImportToExport and its CMakeLists.txt file. Once the tarball ImportToExport.tar has been downloaded and extracted,

        cd ImportToExport/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImportToExport\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/IndividualVRML/","title":"IndividualVRML","text":"

        vtk-examples/Cxx/IO/IndividualVRML

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/IndividualVRML/#description","title":"Description","text":"

        This example shows how to obtain each object of a scene and get it's initial transformation. The selected actor is represented in wireframe. To run this example:

        IndividualVRML filename actorname\n

        The .wrl file must contain a Shape with a DEF name.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/IndividualVRML/#code","title":"Code","text":"

        IndividualVRML.cxx

        #include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkVRMLImporter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 3)\n  {\n    std::cout << \"Required arguments: Filename Actorname e.g. teapot.wrl teapot\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n  std::cout << \"Showing \" << argv[2] << \" from \" << filename << std::endl;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"IndividualVRML\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // VRML Import.\n  vtkNew<vtkVRMLImporter> importer;\n  importer->SetFileName(filename.c_str());\n  importer->Read();\n  importer->SetRenderWindow(renderWindow);\n  importer->Update();\n\n  // ----------------------------------------------------------\n  vtkObject* defActor = importer->GetVRMLDEFObject(argv[2]);\n  if (defActor == NULL)\n  {\n    std::cout << \"Cannot locate actor \" << argv[2] << \" in \" << filename\n              << std::endl;\n    importer->Print(std::cout);\n    return EXIT_FAILURE;\n  }\n\n  vtkActor* actor = static_cast<vtkActor*>(defActor);\n  double color[3] = {0.89, 0.81, 0.34};\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkTransform> transform;\n\n  transform->Translate(actor->GetCenter()[0], actor->GetCenter()[1],\n                       actor->GetCenter()[2]);\n  // axes\n  vtkNew<vtkAxesActor> axes;\n\n  double l[3];\n  l[0] = (actor->GetBounds()[1] - actor->GetBounds()[0]) * 1.5;\n  l[1] = (actor->GetBounds()[3] - actor->GetBounds()[2]) * 1.5;\n  l[2] = (actor->GetBounds()[5] - actor->GetBounds()[4]) * 1.5;\n\n  axes->SetTotalLength(l);\n  axes->SetUserTransform(transform);\n  renderer->AddActor(axes);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->SetPosition(-14.8296, 18.1304, 12.3352);\n  renderer->GetActiveCamera()->SetFocalPoint(2.09905, 0.0832915, 2.47961);\n  renderer->GetActiveCamera()->SetViewUp(0.262918, -0.260671, 0.928937);\n  renderer->GetActiveCamera()->SetDistance(26.6348);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/IndividualVRML/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IndividualVRML)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  IOImport\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IndividualVRML: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IndividualVRML MACOSX_BUNDLE IndividualVRML.cxx )\n  target_link_libraries(IndividualVRML PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IndividualVRML\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/IndividualVRML/#download-and-build-individualvrml","title":"Download and Build IndividualVRML","text":"

        Click here to download IndividualVRML and its CMakeLists.txt file. Once the tarball IndividualVRML.tar has been downloaded and extracted,

        cd IndividualVRML/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IndividualVRML\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/JPEGReader/","title":"JPEGReader","text":"

        vtk-examples/Cxx/IO/JPEGReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/JPEGReader/#description","title":"Description","text":"

        This example shows how to read a JPG image file.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/JPEGReader/#code","title":"Code","text":"

        JPEGReader.cxx

        #include <vtkImageViewer2.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" Filename(.jpeg/jpg) e.g. Pileated.jpg \" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkJPEGReader> jpegReader;\n  jpegReader->SetFileName(argv[1]);\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(jpegReader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"JPEGReader\");\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/JPEGReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(JPEGReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"JPEGReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(JPEGReader MACOSX_BUNDLE JPEGReader.cxx )\n  target_link_libraries(JPEGReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS JPEGReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/JPEGReader/#download-and-build-jpegreader","title":"Download and Build JPEGReader","text":"

        Click here to download JPEGReader and its CMakeLists.txt file. Once the tarball JPEGReader.tar has been downloaded and extracted,

        cd JPEGReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./JPEGReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/JPEGWriter/","title":"JPEGWriter","text":"

        vtk-examples/Cxx/IO/JPEGWriter

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/JPEGWriter/#code","title":"Code","text":"

        JPEGWriter.cxx

        #include <vtkImageCanvasSource2D.h>\n#include <vtkJPEGWriter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n\n#include <array>\n\nint main(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])\n{\n  std::string outputFilename = \"output.jpg\";\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"DeepSkyBlue\").GetData();\n  auto color2 = colors->GetColor3ub(\"PaleGoldenrod\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create a 100x100 image to save into the jpeg file\n  int extent[6] = {0, 99, 0, 99, 0, 0};\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetExtent(extent);\n  imageSource->SetScalarTypeToUnsignedChar(); // vtkJPEGWriter only accepts\n                                              // unsigned char input\n  imageSource->SetNumberOfScalarComponents(\n      3); // 3 color channels: Red, Green and Blue\n\n  // Fill the whole image with a bluish background\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(extent[0], extent[1], extent[2], extent[3]);\n\n  // Paint a 30x30 yellowish square into the image\n  imageSource->SetDrawColor(drawColor2.data());\n  imageSource->FillBox(40, 70, 20, 50);\n\n  vtkNew<vtkJPEGWriter> writer;\n  writer->SetFileName(outputFilename.c_str());\n  writer->SetInputConnection(imageSource->GetOutputPort());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/JPEGWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(JPEGWriter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"JPEGWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(JPEGWriter MACOSX_BUNDLE JPEGWriter.cxx )\n  target_link_libraries(JPEGWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS JPEGWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/JPEGWriter/#download-and-build-jpegwriter","title":"Download and Build JPEGWriter","text":"

        Click here to download JPEGWriter and its CMakeLists.txt file. Once the tarball JPEGWriter.tar has been downloaded and extracted,

        cd JPEGWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./JPEGWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/MetaImageReader/","title":"MetaImageReader","text":"

        vtk-examples/Cxx/IO/MetaImageReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/MetaImageReader/#code","title":"Code","text":"

        MetaImageReader.cxx

        #include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFilename;\n\n  if (argc < 2)\n  {\n    std::cerr << \"Required arguments: image.mha e.g. Gourds.mha\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  inputFilename = argv[1];\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MetaImageReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/MetaImageReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MetaImageReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MetaImageReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MetaImageReader MACOSX_BUNDLE MetaImageReader.cxx )\n  target_link_libraries(MetaImageReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MetaImageReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/MetaImageReader/#download-and-build-metaimagereader","title":"Download and Build MetaImageReader","text":"

        Click here to download MetaImageReader and its CMakeLists.txt file. Once the tarball MetaImageReader.tar has been downloaded and extracted,

        cd MetaImageReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MetaImageReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/MetaImageWriter/","title":"MetaImageWriter","text":"

        vtk-examples/Cxx/IO/MetaImageWriter

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/MetaImageWriter/#code","title":"Code","text":"

        MetaImageWriter.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkMetaImageReader.h>\n#include <vtkMetaImageWriter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // adapt path !\n  std::string filePath = \"julia_mha.mhd\";\n  std::string filePathRaw = \"julia_mha.raw\";\n  // Create an image\n  vtkNew<vtkImageMandelbrotSource> source;\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->Update();\n\n  vtkNew<vtkMetaImageWriter> writer;\n  writer->SetInputConnection(castFilter->GetOutputPort());\n  writer->SetFileName(filePath.c_str());\n  writer->SetRAWFileName(filePathRaw.c_str());\n  writer->Write();\n\n  // Read and display file for verification that it was written correctly\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(filePath.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->SetWindowName(\"MetaImageWriter\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/MetaImageWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MetaImageWriter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MetaImageWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MetaImageWriter MACOSX_BUNDLE MetaImageWriter.cxx )\n  target_link_libraries(MetaImageWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MetaImageWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/MetaImageWriter/#download-and-build-metaimagewriter","title":"Download and Build MetaImageWriter","text":"

        Click here to download MetaImageWriter and its CMakeLists.txt file. Once the tarball MetaImageWriter.tar has been downloaded and extracted,

        cd MetaImageWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MetaImageWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/OBJImporter/","title":"OBJImporter","text":"

        vtk-examples/Cxx/IO/OBJImporter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/OBJImporter/#code","title":"Code","text":"

        OBJImporter.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJImporter.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 4)\n  {\n    std::cout\n        << \"Usage: \" << argv[0]\n        << \" objfile mtlfile texturepath e.g. doorman.obj doorman.mtl doorman\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkOBJImporter> importer;\n  importer->SetFileName(argv[1]);\n  importer->SetFileNameMTL(argv[2]);\n  importer->SetTexturePath(argv[3]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  renderer->SetBackground2(colors->GetColor3d(\"Silver\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"Gold\").GetData());\n  renderer->GradientBackgroundOn();\n  renWin->AddRenderer(renderer);\n  renderer->UseHiddenLineRemovalOn();\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"OBJImporter\");\n\n  iren->SetRenderWindow(renWin);\n  importer->SetRenderWindow(renWin);\n  importer->Update();\n\n  auto actors = renderer->GetActors();\n  actors->InitTraversal();\n  std::cout << \"There are \" << actors->GetNumberOfItems() << \" actors\"\n            << std::endl;\n\n  for (vtkIdType a = 0; a < actors->GetNumberOfItems(); ++a)\n  {\n    std::cout << importer->GetOutputDescription(a) << std::endl;\n\n    vtkActor* actor = actors->GetNextActor();\n\n    // OBJImporter turns texture interpolation off\n    if (actor->GetTexture())\n    {\n      std::cout << \"Has texture\\n\";\n      actor->GetTexture()->InterpolateOn();\n    }\n\n    vtkPolyData* pd =\n        dynamic_cast<vtkPolyData*>(actor->GetMapper()->GetInput());\n\n    vtkPolyDataMapper* mapper =\n        dynamic_cast<vtkPolyDataMapper*>(actor->GetMapper());\n    mapper->SetInputData(pd);\n  }\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/OBJImporter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OBJImporter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OBJImporter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OBJImporter MACOSX_BUNDLE OBJImporter.cxx )\n  target_link_libraries(OBJImporter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OBJImporter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/OBJImporter/#download-and-build-objimporter","title":"Download and Build OBJImporter","text":"

        Click here to download OBJImporter and its CMakeLists.txt file. Once the tarball OBJImporter.tar has been downloaded and extracted,

        cd OBJImporter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OBJImporter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/PNGReader/","title":"PNGReader","text":"

        vtk-examples/Cxx/IO/PNGReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/PNGReader/#description","title":"Description","text":"

        This example demonstrates how to read a PNG image file.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/PNGReader/#code","title":"Code","text":"

        PNGReader.cxx

        #include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.png) e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"PNGReader\");\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/PNGReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PNGReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PNGReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PNGReader MACOSX_BUNDLE PNGReader.cxx )\n  target_link_libraries(PNGReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PNGReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/PNGReader/#download-and-build-pngreader","title":"Download and Build PNGReader","text":"

        Click here to download PNGReader and its CMakeLists.txt file. Once the tarball PNGReader.tar has been downloaded and extracted,

        cd PNGReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PNGReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/PNGWriter/","title":"PNGWriter","text":"

        vtk-examples/Cxx/IO/PNGWriter

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/PNGWriter/#code","title":"Code","text":"

        PNGWriter.cxx

        #include <vtkImageCanvasSource2D.h>\n#include <vtkImageCast.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  std::string outputFilename;\n  if (argc > 1)\n  {\n    outputFilename = argv[1];\n  }\n  else\n  {\n    outputFilename = \"output.png\";\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"MediumOrchid\").GetData();\n  auto color2 = colors->GetColor3ub(\"DarkGreen\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  int extent[6] = {0, 99, 0, 99, 0, 0};\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetExtent(extent);\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(0, 99, 0, 99);\n  imageSource->SetDrawColor(drawColor2.data());\n  imageSource->FillBox(40, 70, 20, 50);\n  imageSource->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->SetInputConnection(imageSource->GetOutputPort());\n  castFilter->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(outputFilename.c_str());\n  writer->SetInputConnection(castFilter->GetOutputPort());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/PNGWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PNGWriter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PNGWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PNGWriter MACOSX_BUNDLE PNGWriter.cxx )\n  target_link_libraries(PNGWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PNGWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/PNGWriter/#download-and-build-pngwriter","title":"Download and Build PNGWriter","text":"

        Click here to download PNGWriter and its CMakeLists.txt file. Once the tarball PNGWriter.tar has been downloaded and extracted,

        cd PNGWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PNGWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ParticleReader/","title":"ParticleReader","text":"

        vtk-examples/Cxx/IO/ParticleReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ParticleReader/#description","title":"Description","text":"

        This example reads ascii files where each line consists of points with its position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file format.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ParticleReader/#code","title":"Code","text":"

        ParticleReader.cxx

        //\n// This example reads ascii files where each line consists of points with its\n// position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file\n// format.\n//\n// some standard vtk headers\n#include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParticleReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n// needed to easily convert int to std::string\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.raw) e.g. Particles.raw\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filePath = argv[1];\n  // Particles.raw supplied by VTK is big endian encoded\n  // std::string filePath = \"C:\\\\VTK\\\\vtkdata-5.8.0\\\\Data\\\\Particles.raw\";\n  // Read the file\n  vtkNew<vtkParticleReader> reader;\n\n  reader->SetFileName(filePath.c_str());\n  // if nothing gets displayed or totally wrong, swap the endianness\n  reader->SetDataByteOrderToBigEndian();\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n  std::cout << \"number of pieces: \" << mapper->GetNumberOfPieces() << std::endl;\n  mapper->SetScalarRange(4, 9);\n\n  vtkNew<vtkActor> actor;\n\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(4);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ParticleReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ParticleReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParticleReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParticleReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParticleReader MACOSX_BUNDLE ParticleReader.cxx )\n  target_link_libraries(ParticleReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParticleReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ParticleReader/#download-and-build-particlereader","title":"Download and Build ParticleReader","text":"

        Click here to download ParticleReader and its CMakeLists.txt file. Once the tarball ParticleReader.tar has been downloaded and extracted,

        cd ParticleReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ParticleReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadAllPolyDataTypes/","title":"ReadAllPolyDataTypes","text":"

        vtk-examples/Cxx/IO/ReadAllPolyDataTypes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadAllPolyDataTypes/#description","title":"Description","text":"

        This example selects the vtkPolyData reader by inspecting the extension of the file. The example processes every file passed as an argument. This assumes all of the files are modeled in the same coordinate system.

        Info

        The procedure ReadPolyData is a reusable procedure. Copy and paste it into other examples that can benefit from reading any vtkPolyData.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadAllPolyDataTypes/#code","title":"Code","text":"

        ReadAllPolyDataTypes.cxx

        #include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <algorithm>\n#include <array>\n#include <random>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Vis Pipeline\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  // Note: If a Python version is written, it is probably best to use\n  //       vtkMinimalStandardRandomSequence in it and here, to ensure\n  //       that the random number generation is the same.\n  std::mt19937 mt(4355412); // Standard mersenne_twister_engine\n  std::uniform_real_distribution<double> distribution(0.6, 1.0);\n\n  // PolyData file pipeline\n  for (int i = 1; i < argc; ++i)\n  {\n    std::cout << \"Loading: \" << argv[i] << std::endl;\n    auto polyData = ReadPolyData(argv[i]);\n\n    // Visualize\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(polyData);\n\n    std::array<double, 3> randomColor;\n    randomColor[0] = distribution(mt);\n    randomColor[1] = distribution(mt);\n    randomColor[2] = distribution(mt);\n    vtkNew<vtkProperty> backProp;\n    backProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n    backProp->SetSpecular(0.6);\n    backProp->SetSpecularPower(30);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->SetBackfaceProperty(backProp);\n    actor->GetProperty()->SetDiffuseColor(randomColor.data());\n    actor->GetProperty()->SetSpecular(0.3);\n    actor->GetProperty()->SetSpecularPower(30);\n    renderer->AddActor(actor);\n  }\n\n  renderWindow->SetWindowName(\"ReadAllPolyDataTypes\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n\n  // Drop the case of the extension\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/IO/ReadAllPolyDataTypes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadAllPolyDataTypes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadAllPolyDataTypes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadAllPolyDataTypes MACOSX_BUNDLE ReadAllPolyDataTypes.cxx )\n  target_link_libraries(ReadAllPolyDataTypes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadAllPolyDataTypes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadAllPolyDataTypes/#download-and-build-readallpolydatatypes","title":"Download and Build ReadAllPolyDataTypes","text":"

        Click here to download ReadAllPolyDataTypes and its CMakeLists.txt file. Once the tarball ReadAllPolyDataTypes.tar has been downloaded and extracted,

        cd ReadAllPolyDataTypes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadAllPolyDataTypes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadAllPolyDataTypesDemo/","title":"ReadAllPolyDataTypesDemo","text":"

        vtk-examples/Cxx/IO/ReadAllPolyDataTypesDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadAllPolyDataTypesDemo/#description","title":"Description","text":"

        This example displays a model from each of the supported vtkPolyData readers.

        Info

        The example reuses two procedures: ReadPolyData introduced in ReadAllPolyDataTypes and ViewportBorder introduced in ViewportBorders.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadAllPolyDataTypesDemo/#code","title":"Code","text":"

        ReadAllPolyDataTypesDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkCoordinate.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkPolyDataReader.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <algorithm>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n\nvoid ViewportBorder(vtkSmartPointer<vtkRenderer>& renderer, double* color,\n                    bool last = false);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetColor(0.3, 0.3, 0.3);\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  for (auto i = 1; i < argc; ++i)\n  {\n    std::cout << argv[i] << std::endl;\n    auto polyData = ReadPolyData(argv[i]);\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(polyData);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"Light_salmon\").GetData());\n    actor->GetProperty()->SetSpecular(0.6);\n    actor->GetProperty()->SetSpecularPower(30);\n\n    // Create textActors\n    vtkNew<vtkTextMapper> textMapper;\n    textMapper->SetTextProperty(textProperty);\n    textMapper->SetInput(vtksys::SystemTools::GetFilenameName(argv[i]).c_str());\n\n    vtkNew<vtkActor2D> textActor;\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(20, 20);\n\n    // Setup renderer\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(actor);\n    renderer->AddActor(textActor);\n    renderer->SetBackground(colors->GetColor3d(\"mint\").GetData());\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n  }\n\n  // Setup viewports for the renderers\n  auto rendererSize = 400;\n  auto xGridDimensions = 3;\n  auto yGridDimensions = 2;\n  yGridDimensions = argc / xGridDimensions;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  auto blank = argc - 1 + ((argc - 1) % xGridDimensions);\n  for (auto i = argc; i < blank; ++i)\n  {\n    vtkNew<vtkRenderer> renderer;\n    renderer->SetBackground(colors->GetColor3d(\"White\").GetData());\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n  }\n\n  for (auto row = 0; row < yGridDimensions; row++)\n  {\n    for (auto col = 0; col < xGridDimensions; col++)\n    {\n      auto index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      renderers[index]->SetViewport(viewport);\n      ViewportBorder(renderers[index],\n                     colors->GetColor3d(\"SlateGray\").GetData(),\n                     col == static_cast<int>(xGridDimensions));\n    }\n  }\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetWindowName(\"ReadAllPolyDataTypesDemo\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n\n  // Drop the case of the extension\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\n// draw the borders of a renderer's viewport\nvoid ViewportBorder(vtkSmartPointer<vtkRenderer>& renderer, double* color,\n                    bool last)\n{\n  // points start at upper right and proceed anti-clockwise\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  // create cells, and lines\n  vtkNew<vtkCellArray> cells;\n  cells->Initialize();\n\n  vtkNew<vtkPolyLine> lines;\n\n  // only draw last line if this is the last viewport\n  // this prevents double vertical lines at right border\n  // if different colors are used for each border, then do\n  // not specify last\n  if (last)\n  {\n    lines->GetPointIds()->SetNumberOfIds(5);\n  }\n  else\n  {\n    lines->GetPointIds()->SetNumberOfIds(4);\n  }\n  for (unsigned int i = 0; i < 4; ++i)\n  {\n    lines->GetPointIds()->SetId(i, i);\n  }\n  if (last)\n  {\n    lines->GetPointIds()->SetId(4, 0);\n  }\n  cells->InsertNextCell(lines);\n\n  // now make the polydata and display it\n  vtkNew<vtkPolyData> poly;\n  poly->Initialize();\n  poly->SetPoints(points);\n  poly->SetLines(cells);\n\n  // use normalized viewport coordinates since\n  // they are independent of window size\n  vtkNew<vtkCoordinate> coordinate;\n  coordinate->SetCoordinateSystemToNormalizedViewport();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(poly);\n  mapper->SetTransformCoordinate(coordinate);\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(color);\n\n  // line width should be at least 2 to be visible at extremes\n  actor->GetProperty()->SetLineWidth(4.0); // Line Width\n\n  renderer->AddViewProp(actor);\n}\n\n} // namespace\n
        "},{"location":"Cxx/IO/ReadAllPolyDataTypesDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadAllPolyDataTypesDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadAllPolyDataTypesDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadAllPolyDataTypesDemo MACOSX_BUNDLE ReadAllPolyDataTypesDemo.cxx )\n  target_link_libraries(ReadAllPolyDataTypesDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadAllPolyDataTypesDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadAllPolyDataTypesDemo/#download-and-build-readallpolydatatypesdemo","title":"Download and Build ReadAllPolyDataTypesDemo","text":"

        Click here to download ReadAllPolyDataTypesDemo and its CMakeLists.txt file. Once the tarball ReadAllPolyDataTypesDemo.tar has been downloaded and extracted,

        cd ReadAllPolyDataTypesDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadAllPolyDataTypesDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadAllUnstructuredGridTypes/","title":"ReadAllUnstructuredGridTypes","text":"

        vtk-examples/Cxx/IO/ReadAllUnstructuredGridTypes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadAllUnstructuredGridTypes/#description","title":"Description","text":"

        The example reads a vtkUnstructuredGrid with vtkXMLUnstructuredGridReader if the extension is .vtu or the legacy vtkUnstructuredGridReader if the extension is .vtk. If a file is not present, the example creates a vtkUnstructuredGrid by passing a vtkSphere through vtkAppendFilter.

        For a description of the VTK File Formats see VTKFileFormats.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadAllUnstructuredGridTypes/#code","title":"Code","text":"

        ReadAllUnstructuredGridTypes.cxx

        #include <vtkAppendFilter.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <algorithm>\n#include <array>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid>\nReadUnstructuredGrid(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Vis Pipeline\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  std::cout << \"Loading: \" << argv[1] << std::endl;\n  auto unstructuredGrid = ReadUnstructuredGrid(std::string(argv[1]));\n\n  // Visualize\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(unstructuredGrid);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  backProp->SetSpecular(.6);\n  backProp->SetSpecularPower(30);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProp);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetSpecular(.3);\n  actor->GetProperty()->SetSpecularPower(30);\n  actor->GetProperty()->EdgeVisibilityOn();\n  renderer->AddActor(actor);\n  renderer->GetActiveCamera()->Azimuth(45);\n  renderer->GetActiveCamera()->Elevation(45);\n  renderer->ResetCamera();\n  renderWindow->SetWindowName(\"ReadAllUnstructuredGridTypes\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkUnstructuredGrid>\nReadUnstructuredGrid(std::string const& fileName)\n{\n  vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n\n  // Drop the case of the extension\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n\n  if (extension == \".vtu\")\n  {\n    vtkNew<vtkXMLUnstructuredGridReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    unstructuredGrid = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkUnstructuredGridReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    unstructuredGrid = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    vtkNew<vtkAppendFilter> appendFilter;\n    appendFilter->AddInputData(source->GetOutput());\n    appendFilter->Update();\n    unstructuredGrid = appendFilter->GetOutput();\n  }\n\n  return unstructuredGrid;\n}\n\n} // namespace\n
        "},{"location":"Cxx/IO/ReadAllUnstructuredGridTypes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadAllUnstructuredGridTypes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOLegacy\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadAllUnstructuredGridTypes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadAllUnstructuredGridTypes MACOSX_BUNDLE ReadAllUnstructuredGridTypes.cxx )\n  target_link_libraries(ReadAllUnstructuredGridTypes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadAllUnstructuredGridTypes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadAllUnstructuredGridTypes/#download-and-build-readallunstructuredgridtypes","title":"Download and Build ReadAllUnstructuredGridTypes","text":"

        Click here to download ReadAllUnstructuredGridTypes and its CMakeLists.txt file. Once the tarball ReadAllUnstructuredGridTypes.tar has been downloaded and extracted,

        cd ReadAllUnstructuredGridTypes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadAllUnstructuredGridTypes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadBMP/","title":"ReadBMP","text":"

        vtk-examples/Cxx/IO/ReadBMP

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadBMP/#code","title":"Code","text":"

        ReadBMP.cxx

        #include <vtkBMPReader.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.bmp) e.g. masonry.bmp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkBMPReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ReadBMP\");\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadBMP/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadBMP)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadBMP: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadBMP MACOSX_BUNDLE ReadBMP.cxx )\n  target_link_libraries(ReadBMP PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadBMP\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadBMP/#download-and-build-readbmp","title":"Download and Build ReadBMP","text":"

        Click here to download ReadBMP and its CMakeLists.txt file. Once the tarball ReadBMP.tar has been downloaded and extracted,

        cd ReadBMP/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadBMP\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadCML/","title":"ReadCML","text":"

        vtk-examples/Cxx/IO/ReadCML

        "},{"location":"Cxx/IO/ReadCML/#description","title":"Description","text":"

        This example uses vtkCMLMoleculeReader to read a Chemistry Markup Language file. CML has been developed by Peter Murray-Rust and Henry Rzepa since 1995. It is the de facto XML for chemistry, accepted by publishers and with more than 1 million lines of Open Source code supporting it.

        Info

        This example uses the file porphyrin.cml. A description of the molecule Porphyrin is described here.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadCML/#code","title":"Code","text":"

        ReadCML.cxx

        #include <vtkActor.h>\n#include <vtkCMLMoleculeReader.h>\n#include <vtkCamera.h>\n#include <vtkMoleculeMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.cml) e.g. porphyrin.cml\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string fname(argv[1]);\n  vtkNew<vtkCMLMoleculeReader> cmlSource;\n\n  cmlSource->SetFileName(fname.c_str());\n\n  vtkNew<vtkMoleculeMapper> molmapper;\n  molmapper->SetInputConnection(cmlSource->GetOutputPort());\n\n  molmapper->UseBallAndStickSettings();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(molmapper);\n  actor->GetProperty()->SetDiffuse(0.7);\n  actor->GetProperty()->SetSpecular(0.5);\n  actor->GetProperty()->SetSpecularPower(20.0);\n\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(ren);\n  renderWindow->SetWindowName(\"ReadCML\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  ren->AddActor(actor);\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  ren->GetActiveCamera()->Zoom(2.0);\n  ren->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  // Finally render the scene\n  renderWindow->SetMultiSamples(0);\n  renderWindow->GetInteractor()->Initialize();\n  renderWindow->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadCML/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadCML)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  DomainsChemistry\n  DomainsChemistryOpenGL2\n  IOChemistry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadCML: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadCML MACOSX_BUNDLE ReadCML.cxx )\n  target_link_libraries(ReadCML PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadCML\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadCML/#download-and-build-readcml","title":"Download and Build ReadCML","text":"

        Click here to download ReadCML and its CMakeLists.txt file. Once the tarball ReadCML.tar has been downloaded and extracted,

        cd ReadCML/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadCML\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadDICOM/","title":"ReadDICOM","text":"

        vtk-examples/Cxx/IO/ReadDICOM

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadDICOM/#description","title":"Description","text":"

        This example reads a DICOM file and displays it on the screen. DICOM_Prostate is an example data set.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadDICOM/#code","title":"Code","text":"

        ReadDICOM.cxx

        #include <vtkDICOMImageReader.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.img) e.g. prostate.img\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  // Read all the DICOM files in the specified directory.\n  vtkNew<vtkDICOMImageReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ReadDICOM\");\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadDICOM/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadDICOM)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadDICOM: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadDICOM MACOSX_BUNDLE ReadDICOM.cxx )\n  target_link_libraries(ReadDICOM PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadDICOM\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadDICOM/#download-and-build-readdicom","title":"Download and Build ReadDICOM","text":"

        Click here to download ReadDICOM and its CMakeLists.txt file. Once the tarball ReadDICOM.tar has been downloaded and extracted,

        cd ReadDICOM/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadDICOM\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadDICOMSeries/","title":"ReadDICOMSeries","text":"

        vtk-examples/Cxx/IO/ReadDICOMSeries

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadDICOMSeries/#description","title":"Description","text":"

        This example demonstates how to read a series of DICOM images and how to scroll with the mousewheel or the up/down keys through all slices. Sample data are available as a zipped file (977 kB, 40 slices): DicomTestImages

        Seealso

        ReadDICOM.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadDICOMSeries/#code","title":"Code","text":"

        ReadDICOMSeries.cxx

        //\n// This example demonstrates how to read a series of dicom images\n// and how to scroll with the mousewheel or the up/down keys\n// through all slices\n//\n// Some standard vtk headers.\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n// Headers needed for this example.\n#include <vtkActor2D.h>\n#include <vtkDICOMImageReader.h>\n#include <vtkImageViewer2.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n// Needed to easily convert int to std::string.\n#include <sstream>\n\nnamespace {\n\n// Helper class to format slice status message.\nclass StatusMessage\n{\npublic:\n  static std::string Format(int slice, int maxSlice)\n  {\n    std::stringstream tmp;\n    tmp << \"Slice Number  \" << slice + 1 << \"/\" << maxSlice + 1;\n    return tmp.str();\n  }\n};\n\n// Define own interaction style.\nclass myVtkInteractorStyleImage : public vtkInteractorStyleImage\n{\npublic:\n  static myVtkInteractorStyleImage* New();\n  vtkTypeMacro(myVtkInteractorStyleImage, vtkInteractorStyleImage);\n\nprotected:\n  vtkImageViewer2* _ImageViewer;\n  vtkTextMapper* _StatusMapper;\n  int _Slice;\n  int _MinSlice;\n  int _MaxSlice;\n\npublic:\n  void SetImageViewer(vtkImageViewer2* imageViewer)\n  {\n    _ImageViewer = imageViewer;\n    _MinSlice = imageViewer->GetSliceMin();\n    _MaxSlice = imageViewer->GetSliceMax();\n    _Slice = _MinSlice;\n    cout << \"Slicer: Min = \" << _MinSlice << \", Max = \" << _MaxSlice\n         << std::endl;\n  }\n\n  void SetStatusMapper(vtkTextMapper* statusMapper)\n  {\n    _StatusMapper = statusMapper;\n  }\n\nprotected:\n  void MoveSliceForward()\n  {\n    if (_Slice < _MaxSlice)\n    {\n      _Slice += 1;\n      cout << \"MoveSliceForward::Slice = \" << _Slice << std::endl;\n      _ImageViewer->SetSlice(_Slice);\n      std::string msg = StatusMessage::Format(_Slice, _MaxSlice);\n      _StatusMapper->SetInput(msg.c_str());\n      _ImageViewer->Render();\n    }\n  }\n\n  void MoveSliceBackward()\n  {\n    if (_Slice > _MinSlice)\n    {\n      _Slice -= 1;\n      cout << \"MoveSliceBackward::Slice = \" << _Slice << std::endl;\n      _ImageViewer->SetSlice(_Slice);\n      std::string msg = StatusMessage::Format(_Slice, _MaxSlice);\n      _StatusMapper->SetInput(msg.c_str());\n      _ImageViewer->Render();\n    }\n  }\n\n  virtual void OnKeyDown()\n  {\n    std::string key = this->GetInteractor()->GetKeySym();\n    if (key.compare(\"Up\") == 0)\n    {\n      // cout << \"Up arrow key was pressed.\" << endl;\n      MoveSliceForward();\n    }\n    else if (key.compare(\"Down\") == 0)\n    {\n      // cout << \"Down arrow key was pressed.\" << endl;\n      MoveSliceBackward();\n    }\n    // forward event\n    vtkInteractorStyleImage::OnKeyDown();\n  }\n\n  virtual void OnMouseWheelForward()\n  {\n    // std::cout << \"Scrolled mouse wheel forward.\" << std::endl;\n    MoveSliceForward();\n    // don't forward events, otherwise the image will be zoomed\n    // in case another interactorstyle is used (e.g. trackballstyle, ...)\n    // vtkInteractorStyleImage::OnMouseWheelForward();\n  }\n\n  virtual void OnMouseWheelBackward()\n  {\n    // std::cout << \"Scrolled mouse wheel backward.\" << std::endl;\n    if (_Slice > _MinSlice)\n    {\n      MoveSliceBackward();\n    }\n    // don't forward events, otherwise the image will be zoomed\n    // in case another interactorstyle is used (e.g. trackballstyle, ...)\n    // vtkInteractorStyleImage::OnMouseWheelBackward();\n  }\n};\n\nvtkStandardNewMacro(myVtkInteractorStyleImage);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" FolderName\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string folder = argv[1];\n  // std::string folder = \"C:\\\\VTK\\\\vtkdata-5.8.0\\\\Data\\\\DicomTestImages\";\n\n  // Read all the DICOM files in the specified directory.\n  vtkNew<vtkDICOMImageReader> reader;\n  reader->SetDirectoryName(folder.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n\n  // Slice status message.\n  vtkNew<vtkTextProperty> sliceTextProp;\n  sliceTextProp->SetFontFamilyToCourier();\n  sliceTextProp->SetFontSize(20);\n  sliceTextProp->SetVerticalJustificationToBottom();\n  sliceTextProp->SetJustificationToLeft();\n\n  vtkNew<vtkTextMapper> sliceTextMapper;\n  std::string msg = StatusMessage::Format(imageViewer->GetSliceMin(),\n                                          imageViewer->GetSliceMax());\n  sliceTextMapper->SetInput(msg.c_str());\n  sliceTextMapper->SetTextProperty(sliceTextProp);\n\n  vtkNew<vtkActor2D> sliceTextActor;\n  sliceTextActor->SetMapper(sliceTextMapper);\n  sliceTextActor->SetPosition(15, 10);\n\n  // Usage hint message.\n  vtkNew<vtkTextProperty> usageTextProp;\n  usageTextProp->SetFontFamilyToCourier();\n  usageTextProp->SetFontSize(14);\n  usageTextProp->SetVerticalJustificationToTop();\n  usageTextProp->SetJustificationToLeft();\n\n  vtkNew<vtkTextMapper> usageTextMapper;\n  usageTextMapper->SetInput(\n      \"- Slice with mouse wheel\\n  or Up/Down-Key\\n- Zoom with pressed right\\n \"\n      \" mouse button while dragging\");\n  usageTextMapper->SetTextProperty(usageTextProp);\n\n  vtkNew<vtkActor2D> usageTextActor;\n  usageTextActor->SetMapper(usageTextMapper);\n  usageTextActor->GetPositionCoordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  usageTextActor->GetPositionCoordinate()->SetValue(0.05, 0.95);\n\n  // Create an interactor with our own style (inherit from\n  // vtkInteractorStyleImage) in order to catch mousewheel and key events.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<myVtkInteractorStyleImage> myInteractorStyle;\n\n  // Make imageviewer2 and sliceTextMapper visible to our interactorstyle\n  // to enable slice status message updates when scrolling through the slices.\n  myInteractorStyle->SetImageViewer(imageViewer);\n  myInteractorStyle->SetStatusMapper(sliceTextMapper);\n\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  // Make the interactor use our own interactorstyle\n  // cause SetupInteractor() is defining it's own default interatorstyle\n  // this must be called after SetupInteractor().\n  renderWindowInteractor->SetInteractorStyle(myInteractorStyle);\n  // Sdd slice status message and usage hint message to the renderer.\n  imageViewer->GetRenderer()->AddActor2D(sliceTextActor);\n  imageViewer->GetRenderer()->AddActor2D(usageTextActor);\n\n  // Initialize rendering and interaction.\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetSize(800, 800);\n  imageViewer->GetRenderWindow()->SetWindowName(\"ReadDICOMSeries\");\n  imageViewer->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadDICOMSeries/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadDICOMSeries)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadDICOMSeries: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadDICOMSeries MACOSX_BUNDLE ReadDICOMSeries.cxx )\n  target_link_libraries(ReadDICOMSeries PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadDICOMSeries\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadDICOMSeries/#download-and-build-readdicomseries","title":"Download and Build ReadDICOMSeries","text":"

        Click here to download ReadDICOMSeries and its CMakeLists.txt file. Once the tarball ReadDICOMSeries.tar has been downloaded and extracted,

        cd ReadDICOMSeries/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadDICOMSeries\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadExodusData/","title":"ReadExodusData","text":"

        vtk-examples/Cxx/IO/ReadExodusData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadExodusData/#description","title":"Description","text":"

        The example uses vtkExodusIIReader to read an ExodusII file. The nodal variable to read is the second argument. The nodal variable is displayed with a color map.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadExodusData/#code","title":"Code","text":"

        ReadExodusData.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCompositeDataGeometryFilter.h>\n#include <vtkExodusIIReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" exodus_file.e nodal_variable e.g mug.e convected\";\n    return EXIT_FAILURE;\n  }\n\n  // Read Exodus Data\n  vtkNew<vtkExodusIIReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->UpdateInformation();\n  reader->SetTimeStep(10);\n  reader->SetAllArrayStatus(vtkExodusIIReader::NODAL,\n                            1); // enables all NODAL variables\n\n  // Create Geometry\n  vtkNew<vtkCompositeDataGeometryFilter> geometry;\n  geometry->SetInputConnection(0, reader->GetOutputPort(0));\n\n  // Mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometry->GetOutputPort());\n  mapper->SelectColorArray(argv[2]);\n  mapper->SetScalarModeToUsePointFieldData();\n  mapper->InterpolateScalarsBeforeMappingOn();\n\n  // Actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  renderer->GetActiveCamera()->SetPosition(9.0, 9.0, 7.0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0.2, -0.7, 0.7);\n  renderer->GetActiveCamera()->SetDistance(14.5);\n\n  // Window and Interactor\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetSize(600, 600);\n  window->SetWindowName(\"ReadExodusData\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n  interactor->Initialize();\n\n  // Show the result\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadExodusData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadExodusData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeometry\n  IOExodus\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadExodusData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadExodusData MACOSX_BUNDLE ReadExodusData.cxx )\n  target_link_libraries(ReadExodusData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadExodusData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadExodusData/#download-and-build-readexodusdata","title":"Download and Build ReadExodusData","text":"

        Click here to download ReadExodusData and its CMakeLists.txt file. Once the tarball ReadExodusData.tar has been downloaded and extracted,

        cd ReadExodusData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadExodusData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadImageData/","title":"ReadImageData","text":"

        vtk-examples/Cxx/IO/ReadImageData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadImageData/#description","title":"Description","text":"

        This example reads an image data (.vti) file.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadImageData/#code","title":"Code","text":"

        ReadImageData.cxx

        #include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLImageDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename.vti e.g. vase.vti\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the file.\n  vtkNew<vtkXMLImageDataReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadImageData\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadImageData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadImageData MACOSX_BUNDLE ReadImageData.cxx )\n  target_link_libraries(ReadImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadImageData/#download-and-build-readimagedata","title":"Download and Build ReadImageData","text":"

        Click here to download ReadImageData and its CMakeLists.txt file. Once the tarball ReadImageData.tar has been downloaded and extracted,

        cd ReadImageData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadImageData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadLegacyUnstructuredGrid/","title":"ReadLegacyUnstructuredGrid","text":"

        vtk-examples/Cxx/IO/ReadLegacyUnstructuredGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadLegacyUnstructuredGrid/#description","title":"Description","text":"

        This example displays a vtkUnstructuredGrid that contains eleven linear cells. We use a number of techniques to visualize the cells.

        1. vtkUnstructuredGridReader reads the file src/Testing/Data/VTKCellTypes.vtk.
        2. vtkExtractEdges extracts the edges of the 2 and 3 dimensional cells. vtkTubeFilter wraps each edge with tubes.
        3. vtkGlyph3DMapper displays each point as a vtkSphere.
        4. vtkShrinkFilter highlights the cell faces by pulling them in towards their centroid.
        5. vtkLabeledDataMapper shows the point ids.
        6. vtkProperty::EdgeVisibilityOn() shows the edges of the cells after shrinking.
        7. vtkCellData colors each cell with a different color.

        The example also shows how to add a vtkCategoryLegend to a visualization. The vtkCategoryLegend has a vtkLookupTable that must be Indexed for categorical data. Since the vtkDataSetMapper for the geometry uses the lookup table to color each cell, we use vtkLookupTable::DeepCopy to copy the input vtkLookupTable and apply vtkLookupTable::IndexedLookupOn().

        The sample file is taken from the VTKFileFormats document.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadLegacyUnstructuredGrid/#code","title":"Code","text":"

        ReadLegacyUnstructuredGrid.cxx

        #include <vtkBrush.h>\n#include <vtkCategoryLegend.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkCellTypes.h>\n#include <vtkContextScene.h>\n#include <vtkContextTransform.h>\n#include <vtkContextView.h>\n#include <vtkExtractEdges.h>\n#include <vtkGenericCell.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkShrinkFilter.h>\n#include <vtkSphereSource.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n#include <vtkVariantArray.h>\n\n#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the reader for the data.\n  std::string filename = argv[1];\n  std::cout << \"Loading \" << filename.c_str() << std::endl;\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkExtractEdges> extractEdges;\n  extractEdges->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkVariantArray> legendValues;\n  auto it = reader->GetOutput()->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    vtkNew<vtkGenericCell> cell;\n    it->GetCell(cell);\n    std::string cellName =\n        vtkCellTypes::GetClassNameFromTypeId(cell->GetCellType());\n#if 0\n    std::cout << cellName\n              << \" NumberOfPoints: \" << cell->GetNumberOfPoints()\n              << \" CellDimension: \" << cell->GetCellDimension()\n              << std::endl;\n#endif\n    legendValues->InsertNextValue(vtkVariant(cellName));\n  }\n  it->Delete();\n\n  // Tube the edges\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(extractEdges->GetOutputPort());\n  tubes->SetRadius(.05);\n  tubes->SetNumberOfSides(21);\n\n  vtkNew<vtkPolyDataMapper> edgeMapper;\n  edgeMapper->SetInputConnection(tubes->GetOutputPort());\n  edgeMapper->SetScalarRange(0, 26);\n\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(edgeMapper);\n  edgeActor->GetProperty()->SetSpecular(0.6);\n  edgeActor->GetProperty()->SetSpecularPower(30);\n  ;\n\n  // Glyph the points.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(0.08);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputConnection(reader->GetOutputPort());\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n  pointMapper->ScalingOff();\n  pointMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  pointActor->GetProperty()->SetSpecular(0.6);\n  pointActor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n  pointActor->GetProperty()->SetSpecularPower(100);\n  ;\n\n  // Label the points.\n  vtkNew<vtkLabeledDataMapper> labelMapper;\n  labelMapper->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkActor2D> labelActor;\n  labelActor->SetMapper(labelMapper);\n\n  // The geometry.\n  vtkNew<vtkShrinkFilter> geometryShrink;\n  geometryShrink->SetInputConnection(reader->GetOutputPort());\n  geometryShrink->SetShrinkFactor(.8);\n\n  // NOTE: We must copy the originalLut because the CategorialLegend\n  // needs an indexed lookup table, but the geometryMapper uses a\n  // non-index lookup table.\n  vtkNew<vtkLookupTable> categoricalLut;\n  vtkSmartPointer<vtkLookupTable> originalLut =\n      reader->GetOutput()->GetCellData()->GetScalars()->GetLookupTable();\n\n  categoricalLut->DeepCopy(originalLut);\n  categoricalLut->IndexedLookupOn();\n\n  vtkNew<vtkDataSetMapper> geometryMapper;\n  geometryMapper->SetInputConnection(geometryShrink->GetOutputPort());\n  geometryMapper->SetScalarModeToUseCellData();\n  geometryMapper->SetScalarRange(0, 11);\n\n  vtkNew<vtkActor> geometryActor;\n  geometryActor->SetMapper(geometryMapper);\n  geometryActor->GetProperty()->SetLineWidth(3);\n  geometryActor->GetProperty()->EdgeVisibilityOn();\n  geometryActor->GetProperty()->SetEdgeColor(0, 0, 0);\n\n  // Legend\n  for (int v = 0; v < legendValues->GetNumberOfTuples(); ++v)\n  {\n    categoricalLut->SetAnnotation(legendValues->GetValue(v),\n                                  legendValues->GetValue(v).ToString());\n  }\n  vtkNew<vtkCategoryLegend> legend;\n  legend->SetScalarsToColors(categoricalLut);\n  legend->SetValues(legendValues);\n  legend->SetTitle(\"Cell Type\");\n  legend->GetBrush()->SetColor(colors->GetColor4ub(\"Silver\").GetData());\n\n  vtkNew<vtkContextTransform> placeLegend;\n  placeLegend->AddItem(legend);\n  placeLegend->Translate(640 - 20, 480 - 12 * 16);\n\n  vtkNew<vtkContextView> contextView;\n  contextView->GetScene()->AddItem(placeLegend);\n\n  vtkSmartPointer<vtkRenderer> renderer = contextView->GetRenderer();\n\n  vtkSmartPointer<vtkRenderWindow> renderWindow =\n      contextView->GetRenderWindow();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(geometryActor);\n  renderer->AddActor(labelActor);\n  renderer->AddActor(edgeActor);\n  renderer->AddActor(pointActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkCamera> aCamera;\n  aCamera->Azimuth(-40.0);\n  aCamera->Elevation(50.0);\n\n  renderer->SetActiveCamera(aCamera);\n  renderer->ResetCamera();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ReadLegacyUnstructuredGrid\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadLegacyUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadLegacyUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadLegacyUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadLegacyUnstructuredGrid MACOSX_BUNDLE ReadLegacyUnstructuredGrid.cxx )\n  target_link_libraries(ReadLegacyUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadLegacyUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadLegacyUnstructuredGrid/#download-and-build-readlegacyunstructuredgrid","title":"Download and Build ReadLegacyUnstructuredGrid","text":"

        Click here to download ReadLegacyUnstructuredGrid and its CMakeLists.txt file. Once the tarball ReadLegacyUnstructuredGrid.tar has been downloaded and extracted,

        cd ReadLegacyUnstructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadLegacyUnstructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadOBJ/","title":"ReadOBJ","text":"

        vtk-examples/Cxx/IO/ReadOBJ

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadOBJ/#description","title":"Description","text":"

        This example demonstrates how to read a Wavefront OBJ file. The result is displayed.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadOBJ/#code","title":"Code","text":"

        ReadOBJ.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \"Filename(.obj) e.g trumpet.obj\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n  vtkNew<vtkOBJReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SpringGreen\");\n  vtkColor3d actorColor = colors->GetColor3d(\"HoneyDew\");\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(actorColor.GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadOBJ\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadOBJ/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadOBJ)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadOBJ: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadOBJ MACOSX_BUNDLE ReadOBJ.cxx )\n  target_link_libraries(ReadOBJ PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadOBJ\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadOBJ/#download-and-build-readobj","title":"Download and Build ReadOBJ","text":"

        Click here to download ReadOBJ and its CMakeLists.txt file. Once the tarball ReadOBJ.tar has been downloaded and extracted,

        cd ReadOBJ/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadOBJ\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadPDB/","title":"ReadPDB","text":"

        vtk-examples/Cxx/IO/ReadPDB

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadPDB/#description","title":"Description","text":"

        This example reads Protein Data Bank files. The example expects a file in .pdb format for example src/Testing/Data/lys.pdb.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadPDB/#code","title":"Code","text":"

        ReadPDB.cxx

        #include <vtkGlyph3D.h>\n#include <vtkLODActor.h>\n#include <vtkNamedColors.h>\n#include <vtkPDBReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTubeFilter.h>\n\n#include <cmath>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.pdb) e.g. caffeine.pdb\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPDBReader> pdb;\n  pdb->SetFileName(argv[1]);\n  pdb->SetHBScale(1.0);\n  pdb->SetBScale(1.0);\n  pdb->Update();\n  std::cout << \"# of atoms is: \" << pdb->GetNumberOfAtoms() << std::endl;\n\n  double resolution = std::sqrt(300000.0 / pdb->GetNumberOfAtoms());\n  if (resolution > 20)\n  {\n    resolution = 20;\n  }\n  if (resolution < 4)\n  {\n    resolution = 4;\n  }\n  std::cout << \"Resolution is: \" << resolution << std::endl;\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetCenter(0, 0, 0);\n  sphere->SetRadius(1);\n  sphere->SetThetaResolution(static_cast<int>(resolution));\n  sphere->SetPhiResolution(static_cast<int>(resolution));\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(pdb->GetOutputPort());\n  glyph->SetOrient(1);\n  glyph->SetColorMode(1);\n  // glyph->ScalingOn();\n  glyph->SetScaleMode(2);\n  glyph->SetScaleFactor(0.25);\n  glyph->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> atomMapper;\n  atomMapper->SetInputConnection(glyph->GetOutputPort());\n  atomMapper->UseLookupTableScalarRangeOff();\n  atomMapper->ScalarVisibilityOn();\n  atomMapper->SetScalarModeToDefault();\n\n  vtkNew<vtkLODActor> atom;\n  atom->SetMapper(atomMapper);\n  atom->GetProperty()->SetRepresentationToSurface();\n  atom->GetProperty()->SetInterpolationToGouraud();\n  atom->GetProperty()->SetAmbient(0.1);\n  atom->GetProperty()->SetDiffuse(0.7);\n  atom->GetProperty()->SetSpecular(0.5);\n  atom->GetProperty()->SetSpecularPower(80);\n  atom->GetProperty()->SetSpecularColor(colors->GetColor3d(\"White\").GetData());\n  atom->SetNumberOfCloudPoints(30000);\n\n  renderer->AddActor(atom);\n\n  vtkNew<vtkTubeFilter> tube;\n  tube->SetInputConnection(pdb->GetOutputPort());\n  tube->SetNumberOfSides(static_cast<int>(resolution));\n  tube->CappingOff();\n  tube->SetRadius(0.2);\n  tube->SetVaryRadius(0);\n  tube->SetRadiusFactor(10);\n\n  vtkNew<vtkPolyDataMapper> bondMapper;\n  bondMapper->SetInputConnection(tube->GetOutputPort());\n  bondMapper->UseLookupTableScalarRangeOff();\n  bondMapper->ScalarVisibilityOff();\n  bondMapper->SetScalarModeToDefault();\n\n  vtkNew<vtkLODActor> bond;\n  bond->SetMapper(bondMapper);\n  bond->GetProperty()->SetRepresentationToSurface();\n  bond->GetProperty()->SetInterpolationToGouraud();\n  bond->GetProperty()->SetAmbient(0.1);\n  bond->GetProperty()->SetDiffuse(0.7);\n  bond->GetProperty()->SetSpecular(0.5);\n  bond->GetProperty()->SetSpecularPower(80);\n  bond->GetProperty()->SetSpecularColor(colors->GetColor3d(\"White\").GetData());\n\n  renderer->AddActor(bond);\n\n  renderWindow->SetWindowName(\"ReadPDB\");\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadPDB/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPDB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  FiltersCore\n  FiltersSources\n  IOChemistry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPDB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPDB MACOSX_BUNDLE ReadPDB.cxx )\n  target_link_libraries(ReadPDB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPDB\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadPDB/#download-and-build-readpdb","title":"Download and Build ReadPDB","text":"

        Click here to download ReadPDB and its CMakeLists.txt file. Once the tarball ReadPDB.tar has been downloaded and extracted,

        cd ReadPDB/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadPDB\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadPLOT3D/","title":"ReadPLOT3D","text":"

        vtk-examples/Cxx/IO/ReadPLOT3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadPLOT3D/#code","title":"Code","text":"

        ReadPLOT3D.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGridGeometryFilter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 3)\n  {\n    std::cout << \"Required parameters: XYZFilename.bin QFileName.bin e.g \"\n                 \"combxyz.bin combq.bin\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string xyzFilename(argv[1]);\n  std::string qFilename(argv[2]);\n\n  vtkNew<vtkMultiBlockPLOT3DReader> reader;\n  reader->SetXYZFileName(xyzFilename.c_str());\n  reader->SetQFileName(qFilename.c_str());\n  reader->SetScalarFunctionNumber(100);\n  reader->SetVectorFunctionNumber(202);\n  reader->Update();\n\n  vtkNew<vtkStructuredGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputData(reader->GetOutput()->GetBlock(0));\n  geometryFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometryFilter->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->SetClippingRange(3.95297, 50);\n  renderer->GetActiveCamera()->SetFocalPoint(8.88908, 0.595038, 29.3342);\n  renderer->GetActiveCamera()->SetPosition(-12.3332, 31.7479, 41.2387);\n  renderer->GetActiveCamera()->SetViewUp(0.060772, -0.319905, 0.945498);\n\n  renderWindow->SetWindowName(\"ReadPLOT3D\");\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadPLOT3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPLOT3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPLOT3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPLOT3D MACOSX_BUNDLE ReadPLOT3D.cxx )\n  target_link_libraries(ReadPLOT3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPLOT3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadPLOT3D/#download-and-build-readplot3d","title":"Download and Build ReadPLOT3D","text":"

        Click here to download ReadPLOT3D and its CMakeLists.txt file. Once the tarball ReadPLOT3D.tar has been downloaded and extracted,

        cd ReadPLOT3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadPLOT3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadPLY/","title":"ReadPLY","text":"

        vtk-examples/Cxx/IO/ReadPLY

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadPLY/#code","title":"Code","text":"

        ReadPLY.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \"  Filename(.ply) e.g. shark.ply\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkPLYReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DarkGray\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SeaGreen\").GetData());\n\n  renderWindow->SetWindowName(\"ReadPLY\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadPLY/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPLY)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOPLY\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPLY: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPLY MACOSX_BUNDLE ReadPLY.cxx )\n  target_link_libraries(ReadPLY PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPLY\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadPLY/#download-and-build-readply","title":"Download and Build ReadPLY","text":"

        Click here to download ReadPLY and its CMakeLists.txt file. Once the tarball ReadPLY.tar has been downloaded and extracted,

        cd ReadPLY/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadPLY\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadPNM/","title":"ReadPNM","text":"

        vtk-examples/Cxx/IO/ReadPNM

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadPNM/#code","title":"Code","text":"

        ReadPNM.cxx

        #include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNMReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.pnm) e.g Gourds.pnm\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkPNMReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SlateGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ReadPNM\");\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadPNM/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPNM)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPNM: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPNM MACOSX_BUNDLE ReadPNM.cxx )\n  target_link_libraries(ReadPNM PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPNM\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadPNM/#download-and-build-readpnm","title":"Download and Build ReadPNM","text":"

        Click here to download ReadPNM and its CMakeLists.txt file. Once the tarball ReadPNM.tar has been downloaded and extracted,

        cd ReadPNM/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadPNM\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadPlainTextTriangles/","title":"ReadPlainTextTriangles","text":"

        vtk-examples/Cxx/IO/ReadPlainTextTriangles

        "},{"location":"Cxx/IO/ReadPlainTextTriangles/#description","title":"Description","text":"

        Here is an example of a custom file-format reader that produces a VTK XML PolyData file from a plain-text input format.

        "},{"location":"Cxx/IO/ReadPlainTextTriangles/#input-format","title":"Input Format","text":"
        number_of_points\nnumber_of_triangles\npoint[point[0]Y point[0](0]X)Z\npoint[point[1]Y point[1](1]X)Z\n...\npoint[point[N]Y point[N](N]X)Z\ntriangle[triangle[0]B triangle[0](0]A)C\ntriangle[triangle[1]B triangle[1](1]A)C\n...\ntriangle[triangle[M]B triangle[M](M]A)C\n
        "},{"location":"Cxx/IO/ReadPlainTextTriangles/#example-input","title":"Example Input","text":"
        3\n1\n0.0 0.0 0.0\n0.0 0.0 1.0\n0.0 1.0 0.0\n0 1 2\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadPlainTextTriangles/#code","title":"Code","text":"

        ReadPlainTextTriangles.cxx

        #include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <iostream>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> custom_reader(std::ifstream& infile);\n}\n\nint main(int argc, char* argv[])\n{\n  // Verify command line arguments\n  if (argc != 2)\n  {\n    std::cerr << \"Required arguments: triangleFile.txt\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  std::ifstream fin(inputFilename.c_str());\n\n  auto polydata = custom_reader(fin);\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetInputData(polydata);\n  writer->SetFileName(\"x.vtp\");\n  writer->Write();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> custom_reader(std::ifstream& infile)\n{\n  vtkIdType number_of_points, number_of_triangles;\n  infile >> number_of_points >> number_of_triangles;\n\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(number_of_points);\n  for (vtkIdType i = 0; i < number_of_points; i++)\n  {\n    double x, y, z;\n    infile >> x >> y >> z;\n    points->SetPoint(i, x, y, z);\n  }\n\n  vtkNew<vtkCellArray> polys;\n  for (vtkIdType i = 0; i < number_of_triangles; i++)\n  {\n    vtkIdType a, b, c;\n    infile >> a >> b >> c;\n    polys->InsertNextCell(3);\n    polys->InsertCellPoint(a);\n    polys->InsertCellPoint(b);\n    polys->InsertCellPoint(c);\n  }\n  auto polydata = vtkSmartPointer<vtkPolyData>::New();\n  polydata->SetPoints(points);\n  polydata->SetPolys(polys);\n  return polydata;\n}\n} // namespace\n
        "},{"location":"Cxx/IO/ReadPlainTextTriangles/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPlainTextTriangles)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPlainTextTriangles: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPlainTextTriangles MACOSX_BUNDLE ReadPlainTextTriangles.cxx )\n  target_link_libraries(ReadPlainTextTriangles PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPlainTextTriangles\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadPlainTextTriangles/#download-and-build-readplaintexttriangles","title":"Download and Build ReadPlainTextTriangles","text":"

        Click here to download ReadPlainTextTriangles and its CMakeLists.txt file. Once the tarball ReadPlainTextTriangles.tar has been downloaded and extracted,

        cd ReadPlainTextTriangles/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadPlainTextTriangles\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadPolyData/","title":"ReadPolyData","text":"

        vtk-examples/Cxx/IO/ReadPolyData

        "},{"location":"Cxx/IO/ReadPolyData/#description","title":"Description","text":"

        This example reads a polygonal data (.vtp) file, for example src/Testing/Data/Torso.vtp.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadPolyData/#code","title":"Code","text":"

        ReadPolyData.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtp) e.g. Torso.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read all the data from the file.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkOliveGreen\").GetData());\n  renderer->GetActiveCamera()->Pitch(90);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->ResetCamera();\n\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ReadPolyData\");\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadPolyData MACOSX_BUNDLE ReadPolyData.cxx )\n  target_link_libraries(ReadPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadPolyData/#download-and-build-readpolydata","title":"Download and Build ReadPolyData","text":"

        Click here to download ReadPolyData and its CMakeLists.txt file. Once the tarball ReadPolyData.tar has been downloaded and extracted,

        cd ReadPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadRectilinearGrid/","title":"ReadRectilinearGrid","text":"

        vtk-examples/Cxx/IO/ReadRectilinearGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadRectilinearGrid/#description","title":"Description","text":"

        This example reads a rectilinear grid (.vtr) file. An example file can be found at VTKData/Data/cth.vtr.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadRectilinearGrid/#code","title":"Code","text":"

        ReadRectilinearGrid.cxx

        #include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n// #include <vtkRectilinearGridGeometryFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLRectilinearGridReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" Filename.vtr e.g. RectilinearGrid.vtr\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Parse arguments\n  std::string inputFilename = argv[1];\n\n  // Read the file\n  vtkNew<vtkXMLRectilinearGridReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // vtkNew<vtkRectilinearGridGeometryFilter> geometryFilter;\n  // geometryFilter->SetInputConnection(reader->GetOutputPort());\n  // geometryFilter->Update();\n\n  // Visualize\n  vtkNew<vtkDataSetMapper> mapper;\n  // mapper->SetInputConnection(geometryFilter->GetOutputPort());\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadRectilinearGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadRectilinearGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadRectilinearGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeometry\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadRectilinearGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadRectilinearGrid MACOSX_BUNDLE ReadRectilinearGrid.cxx )\n  target_link_libraries(ReadRectilinearGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadRectilinearGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadRectilinearGrid/#download-and-build-readrectilineargrid","title":"Download and Build ReadRectilinearGrid","text":"

        Click here to download ReadRectilinearGrid and its CMakeLists.txt file. Once the tarball ReadRectilinearGrid.tar has been downloaded and extracted,

        cd ReadRectilinearGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadRectilinearGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadSLC/","title":"ReadSLC","text":"

        vtk-examples/Cxx/IO/ReadSLC

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadSLC/#description","title":"Description","text":"

        In this example you will familiarize yourself with the stages required to read a .slc file and create a visualization pipeline in VTK. Following is the three step procedure:

        1. Read the data from .slc file using vtkSLCReader

        2. Implement Marching cubes Algorithm using vtkContourFilter

        3. Create Visualization pipeline to visualize data using an actor, mapper and rendering window

        Cite

        This example was provided by Bharatesh Chakravarthi from Virtual Environment Lab, Chung-Ang University, Seoul, South Korea

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadSLC/#code","title":"Code","text":"

        ReadSLC.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkExtractVOI.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSLCReader.h>\n\n// Author: Bharatesh Chakravarthi\n// Affiliation: Virtual Environment Lab, Chung-Ang University, Seoul, South\n// Korea\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    // Pass the filename (<filename>.slc) as parameter to read .slc file\n    std::cout << \"Required parameters: Filename(.slc) e.g vw_knee.slc\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  double isoValue = 72.0;\n  if (argc < 3)\n  {\n    isoValue = 72.0;\n  }\n  else\n  {\n    isoValue = std::atof(argv[2]);\n  }\n  std::string inputFilename = argv[1];\n\n  // Using vtkSLCReader to read Volumetric file format(<filename.slc>)\n  vtkNew<vtkSLCReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // Implementing Marching Cubes Algorithm to create the surface using\n  // vtkContourFilter object\n  vtkNew<vtkContourFilter> cFilter;\n  cFilter->SetInputConnection(reader->GetOutputPort());\n\n  // Change the range(2nd and 3rd Paramater) based on your\n  // requirement. recomended value for 1st parameter is above 1\n  // cFilter->GenerateValues(5, 80.0, 100.0);\n  cFilter->SetValue(0, isoValue);\n  cFilter->Update();\n\n  // Adding the outliner using vtkOutlineFilter object\n  vtkNew<vtkOutlineFilter> outliner;\n  outliner->SetInputConnection(reader->GetOutputPort());\n  outliner->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cFilter->GetOutputPort());\n  mapper->SetScalarVisibility(0);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuse(0.8);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Ivory\").GetData());\n  actor->GetProperty()->SetSpecular(0.8);\n  actor->GetProperty()->SetSpecularPower(120.0);\n\n  // extractVOI is used to fix the problem of subsampling of data and reduce\n  // slow interaction and increase loading speed\n  vtkNew<vtkExtractVOI> extractVOI;\n  extractVOI->SetInputConnection(reader->GetOutputPort());\n  extractVOI->SetSampleRate(2, 2, 2);\n  extractVOI->Update();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 512);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n\n  // Pick a good view\n  vtkCamera* cam1 = renderer->GetActiveCamera();\n  cam1->SetFocalPoint(0.0, 0.0, 0.0);\n  cam1->SetPosition(0.0, -1.0, 0.0);\n  cam1->SetViewUp(0.0, 0.0, -1.0);\n  cam1->Azimuth(-90.0);\n  renderer->ResetCamera();\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetWindowName(\"ReadSLC\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadSLC/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadSLC)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadSLC: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadSLC MACOSX_BUNDLE ReadSLC.cxx )\n  target_link_libraries(ReadSLC PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadSLC\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadSLC/#download-and-build-readslc","title":"Download and Build ReadSLC","text":"

        Click here to download ReadSLC and its CMakeLists.txt file. Once the tarball ReadSLC.tar has been downloaded and extracted,

        cd ReadSLC/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadSLC\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadSTL/","title":"ReadSTL","text":"

        vtk-examples/Cxx/IO/ReadSTL

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadSTL/#code","title":"Code","text":"

        ReadSTL.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    cout << \"Required parameters: Filename(.stl) e.g 42400-IDGH.stl\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkSTLReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuse(0.8);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"LightSteelBlue\").GetData());\n  actor->GetProperty()->SetSpecular(0.3);\n  actor->GetProperty()->SetSpecularPower(60.0);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadSTL\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkOliveGreen\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadSTL/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadSTL)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadSTL: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadSTL MACOSX_BUNDLE ReadSTL.cxx )\n  target_link_libraries(ReadSTL PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadSTL\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadSTL/#download-and-build-readstl","title":"Download and Build ReadSTL","text":"

        Click here to download ReadSTL and its CMakeLists.txt file. Once the tarball ReadSTL.tar has been downloaded and extracted,

        cd ReadSTL/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadSTL\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadStructuredGrid/","title":"ReadStructuredGrid","text":"

        vtk-examples/Cxx/IO/ReadStructuredGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadStructuredGrid/#description","title":"Description","text":"

        This example reads a structured grid (.vts) file. An example file can be found at VTKData/Data/multicomb_0.vts.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadStructuredGrid/#code","title":"Code","text":"

        ReadStructuredGrid.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkXMLStructuredGridReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename.vts e.g. StructuredGrid.vts\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  // Read the file.\n  vtkNew<vtkXMLStructuredGridReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  vtkNew<vtkStructuredGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputConnection(reader->GetOutputPort());\n  geometryFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometryFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadStructuredGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadStructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadStructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeometry\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadStructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadStructuredGrid MACOSX_BUNDLE ReadStructuredGrid.cxx )\n  target_link_libraries(ReadStructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadStructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadStructuredGrid/#download-and-build-readstructuredgrid","title":"Download and Build ReadStructuredGrid","text":"

        Click here to download ReadStructuredGrid and its CMakeLists.txt file. Once the tarball ReadStructuredGrid.tar has been downloaded and extracted,

        cd ReadStructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadStructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadTIFF/","title":"ReadTIFF","text":"

        vtk-examples/Cxx/IO/ReadTIFF

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadTIFF/#code","title":"Code","text":"

        ReadTIFF.cxx

        #include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTIFFReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.tif) e.g. ColorCells.tif\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkTIFFReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->Render();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderWindow()->SetWindowName(\"ReadTIFF\");\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadTIFF/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadTIFF)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadTIFF: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadTIFF MACOSX_BUNDLE ReadTIFF.cxx )\n  target_link_libraries(ReadTIFF PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadTIFF\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadTIFF/#download-and-build-readtiff","title":"Download and Build ReadTIFF","text":"

        Click here to download ReadTIFF and its CMakeLists.txt file. Once the tarball ReadTIFF.tar has been downloaded and extracted,

        cd ReadTIFF/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadTIFF\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadTextFile/","title":"ReadTextFile","text":"

        vtk-examples/Cxx/IO/ReadTextFile

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadTextFile/#description","title":"Description","text":"

        This example takes a plain text file of coordinates and reads them into a vtkPoints, which is then put into a vtkPolyData and displayed on the screen using a vtkVertexGlyphFilter.

        An example file may look like: 1 2 3 4 5 6 7 8 9

        Note

        for a simpler way to read such a file, see SimplePointsReader.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadTextFile/#code","title":"Code","text":"

        ReadTextFile.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <sstream>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.txt) e.g. TeapotPoints.txt\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Get all data from the file\n  std::string filename = argv[1];\n  std::ifstream filestream(filename.c_str());\n\n  std::string line;\n  vtkNew<vtkPoints> points;\n\n  while (std::getline(filestream, line))\n  {\n    double x, y, z;\n    std::stringstream linestream;\n    linestream << line;\n    linestream >> x >> y >> z;\n\n    points->InsertNextPoint(x, y, z);\n  }\n\n  filestream.close();\n\n  vtkNew<vtkPolyData> polyData;\n\n  polyData->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polyData);\n  glyphFilter->Update();\n\n  // Visualize\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Gainsboro\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadTextFile\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadTextFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadTextFile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadTextFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadTextFile MACOSX_BUNDLE ReadTextFile.cxx )\n  target_link_libraries(ReadTextFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadTextFile\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadTextFile/#download-and-build-readtextfile","title":"Download and Build ReadTextFile","text":"

        Click here to download ReadTextFile and its CMakeLists.txt file. Once the tarball ReadTextFile.tar has been downloaded and extracted,

        cd ReadTextFile/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadTextFile\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadUnknownTypeXMLFile/","title":"ReadUnknownTypeXMLFile","text":"

        vtk-examples/Cxx/IO/ReadUnknownTypeXMLFile

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadUnknownTypeXMLFile/#description","title":"Description","text":"

        This examples reads either a vtu (unstructured grid) or vtp (polydata) file and displays it to the screen.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadUnknownTypeXMLFile/#code","title":"Code","text":"

        ReadUnknownTypeXMLFile.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLGenericDataObjectReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Ensure a filename was specified\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputFilename\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Get all data from the file\n  vtkNew<vtkXMLGenericDataObjectReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // All of the standard data types can be checked and obtained like this:\n  if (dynamic_cast<vtkPolyData*>(reader->GetOutput()))\n  {\n    std::cout << \"File is a polydata\" << std::endl;\n  }\n  else if (dynamic_cast<vtkUnstructuredGrid*>(reader->GetOutput()))\n  {\n    std::cout << \"File is an unstructured grid\" << std::endl;\n  }\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Moccasin\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReadUnknownTypeXMLFile\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadUnknownTypeXMLFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadUnknownTypeXMLFile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadUnknownTypeXMLFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadUnknownTypeXMLFile MACOSX_BUNDLE ReadUnknownTypeXMLFile.cxx )\n  target_link_libraries(ReadUnknownTypeXMLFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadUnknownTypeXMLFile\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadUnknownTypeXMLFile/#download-and-build-readunknowntypexmlfile","title":"Download and Build ReadUnknownTypeXMLFile","text":"

        Click here to download ReadUnknownTypeXMLFile and its CMakeLists.txt file. Once the tarball ReadUnknownTypeXMLFile.tar has been downloaded and extracted,

        cd ReadUnknownTypeXMLFile/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadUnknownTypeXMLFile\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/ReadUnstructuredGrid/","title":"ReadUnstructuredGrid","text":"

        vtk-examples/Cxx/IO/ReadUnstructuredGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/ReadUnstructuredGrid/#description","title":"Description","text":"

        This example demonstrates how to read an unstructured grid (VTU) file. The front facing faces are colored Misty Rose, while the back facing faces are colored Tomato.

        An example file to use is src/Testing/Data/tetra.vtu.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/ReadUnstructuredGrid/#code","title":"Code","text":"

        ReadUnstructuredGrid.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtu) e.g. tetra.vtu\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  // Read all the data from the file.\n  vtkNew<vtkXMLUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetLineWidth(2.0);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkProperty> backFace;\n  backFace->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->SetBackfaceProperty(backFace);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  // Render and interact.\n  renderWindow->SetSize(640, 480);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/ReadUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReadUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReadUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReadUnstructuredGrid MACOSX_BUNDLE ReadUnstructuredGrid.cxx )\n  target_link_libraries(ReadUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReadUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/ReadUnstructuredGrid/#download-and-build-readunstructuredgrid","title":"Download and Build ReadUnstructuredGrid","text":"

        Click here to download ReadUnstructuredGrid and its CMakeLists.txt file. Once the tarball ReadUnstructuredGrid.tar has been downloaded and extracted,

        cd ReadUnstructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReadUnstructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/SimplePointsReader/","title":"SimplePointsReader","text":"

        vtk-examples/Cxx/IO/SimplePointsReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/SimplePointsReader/#description","title":"Description","text":"

        A file of XYZ coordinates is a very easy format that can be used for simple storage from many applications. This example demonstrates how to read this type of file into a polydata object. An example file of three points would look like this:

         0.0 0.0 0.0\n 1.0 0.0 0.0\n 0.0 1.0 0.0\n

        As a demo, save the above three lines to a file called simple.xyz and call the executable resulting from the code below with

         ./SimplePointsReader simple.xyz\n

        from the build directory.

        Seealso

        For the reverse operation, writing a points file, see the SimplePointsWriter example.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/SimplePointsReader/#code","title":"Code","text":"

        SimplePointsReader.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimplePointsReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.xyz) e.g coords.txt\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the file\n  vtkNew<vtkSimplePointsReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(6);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SimplePointsReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/SimplePointsReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SimplePointsReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SimplePointsReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SimplePointsReader MACOSX_BUNDLE SimplePointsReader.cxx )\n  target_link_libraries(SimplePointsReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SimplePointsReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/SimplePointsReader/#download-and-build-simplepointsreader","title":"Download and Build SimplePointsReader","text":"

        Click here to download SimplePointsReader and its CMakeLists.txt file. Once the tarball SimplePointsReader.tar has been downloaded and extracted,

        cd SimplePointsReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SimplePointsReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/SimplePointsWriter/","title":"SimplePointsWriter","text":"

        vtk-examples/Cxx/IO/SimplePointsWriter

        "},{"location":"Cxx/IO/SimplePointsWriter/#description","title":"Description","text":"

        Seealso

        For the opposite operation (reading a points file) see the

        SimplePointsReader example.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/SimplePointsWriter/#code","title":"Code","text":"

        SimplePointsWriter.cxx

        #include <vtkNew.h>\n#include <vtkSimplePointsWriter.h>\n#include <vtkSphereSource.h>\n\nint main(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkSimplePointsWriter> writer;\n  writer->SetFileName(\"test.xyz\");\n  writer->SetInputConnection(sphereSource->GetOutputPort());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/SimplePointsWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SimplePointsWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersSources\n  IOLegacy\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SimplePointsWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SimplePointsWriter MACOSX_BUNDLE SimplePointsWriter.cxx )\n  target_link_libraries(SimplePointsWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SimplePointsWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/SimplePointsWriter/#download-and-build-simplepointswriter","title":"Download and Build SimplePointsWriter","text":"

        Click here to download SimplePointsWriter and its CMakeLists.txt file. Once the tarball SimplePointsWriter.tar has been downloaded and extracted,

        cd SimplePointsWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SimplePointsWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/StructuredGridReader/","title":"StructuredGridReader","text":"

        vtk-examples/Cxx/IO/StructuredGridReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/StructuredGridReader/#code","title":"Code","text":"

        StructuredGridReader.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" Filename(.vtk) e.g. SampleStructGrid.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  // Read the file\n  vtkNew<vtkStructuredGridReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  vtkNew<vtkStructuredGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputConnection(reader->GetOutputPort());\n  geometryFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometryFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"StructuredGridReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/StructuredGridReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredGridReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeometry\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredGridReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredGridReader MACOSX_BUNDLE StructuredGridReader.cxx )\n  target_link_libraries(StructuredGridReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredGridReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/StructuredGridReader/#download-and-build-structuredgridreader","title":"Download and Build StructuredGridReader","text":"

        Click here to download StructuredGridReader and its CMakeLists.txt file. Once the tarball StructuredGridReader.tar has been downloaded and extracted,

        cd StructuredGridReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StructuredGridReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/StructuredPointsReader/","title":"StructuredPointsReader","text":"

        vtk-examples/Cxx/IO/StructuredPointsReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/StructuredPointsReader/#description","title":"Description","text":"

        An example input file can be found at /Data/ironProt.vtk.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/StructuredPointsReader/#code","title":"Code","text":"

        StructuredPointsReader.cxx

        #include <vtkImageDataGeometryFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" Filename(.vtk) e.g. StructuredPoints.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  // Read the file\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageDataGeometryFilter> geometryFilter;\n  geometryFilter->SetInputConnection(reader->GetOutputPort());\n  geometryFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometryFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"StructuredPointsReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/StructuredPointsReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredPointsReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeometry\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredPointsReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredPointsReader MACOSX_BUNDLE StructuredPointsReader.cxx )\n  target_link_libraries(StructuredPointsReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredPointsReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/StructuredPointsReader/#download-and-build-structuredpointsreader","title":"Download and Build StructuredPointsReader","text":"

        Click here to download StructuredPointsReader and its CMakeLists.txt file. Once the tarball StructuredPointsReader.tar has been downloaded and extracted,

        cd StructuredPointsReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StructuredPointsReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/TransientHDFReader/","title":"TransientHDFReader","text":"

        vtk-examples/Cxx/IO/TransientHDFReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/TransientHDFReader/#description","title":"Description","text":"

        That example uses a feature of vtk_hdf5 that is only available in VTK 9.3. See this blog post for more information.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/TransientHDFReader/#code","title":"Code","text":"

        TransientHDFReader.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkDiscretizableColorTransferFunction.h>\n#include <vtkHDFReader.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObject.h>\n#include <vtkObjectBase.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <cstdlib>\n\nnamespace {\nvtkNew<vtkDiscretizableColorTransferFunction> GetCTF();\n\nvoid Animate(vtkObject* caller, unsigned long /*eid*/, void* clientdata,\n             void* /*calldata*/);\n\n} // namespace\n\nint main(int ac, char* av[])\n{\n  if (ac != 2)\n  {\n    std::cout << \"Usage: \" << av[0]\n              << \" filename.vtkhdf eg. warping_spheres.vtkhdf\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the dataset.\n  vtkNew<vtkHDFReader> reader;\n  reader->SetFileName(av[1]);\n  reader->Update();\n  std::cout << \"Number of steps: \" << reader->GetNumberOfSteps() << endl;\n  auto polydata = vtkPolyData::SafeDownCast(reader->GetOutput());\n\n  // Render the dataset.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n  mapper->SetLookupTable(GetCTF());\n  mapper->SetScalarModeToUsePointFieldData();\n  mapper->SelectColorArray(\"SpatioTemporalHarmonics\");\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"TransientHDFReader\");\n  renWin->SetSize(1024, 512);\n  renWin->Render();\n\n  // Add the interactor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the animation callback.\n  vtkNew<vtkCallbackCommand> command;\n  command->SetCallback(Animate);\n  command->SetClientData(reader);\n\n  // You must initialize the vtkRenderWindowInteractor\n  // before adding the observer and setting the repeating timer.\n  iren->Initialize();\n  iren->AddObserver(vtkCommand::TimerEvent, command);\n  iren->CreateRepeatingTimer(50);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> istyle;\n  iren->SetInteractorStyle(istyle);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkNew<vtkDiscretizableColorTransferFunction> GetCTF()\n{\n  vtkNew<vtkDiscretizableColorTransferFunction> ctf;\n  ctf->SetColorSpaceToLab();\n  ctf->SetScaleToLinear();\n\n  ctf->AddRGBPoint(-30.3399130649763, 0.0862745098039216, 0.00392156862745098,\n                   0.298039215686275);\n  ctf->AddRGBPoint(-29.3502559661865, 0.113725, 0.0235294, 0.45098);\n  ctf->AddRGBPoint(-28.5283393859863, 0.105882, 0.0509804, 0.509804);\n  ctf->AddRGBPoint(-27.958028793335, 0.0392157, 0.0392157, 0.560784);\n  ctf->AddRGBPoint(-27.4044914245605, 0.0313725, 0.0980392, 0.6);\n  ctf->AddRGBPoint(-26.8677291870117, 0.0431373, 0.164706, 0.639216);\n  ctf->AddRGBPoint(-26.096134185791, 0.054902, 0.243137, 0.678431);\n  ctf->AddRGBPoint(-25.0729293823242, 0.054902, 0.317647, 0.709804);\n  ctf->AddRGBPoint(-23.8148933330084, 0.0509804, 0.396078, 0.741176);\n  ctf->AddRGBPoint(-22.9992658665124, 0.0392157, 0.466667, 0.768627);\n  ctf->AddRGBPoint(-22.1836384000164, 0.0313725, 0.537255, 0.788235);\n  ctf->AddRGBPoint(-21.3323650360107, 0.0313725, 0.615686, 0.811765);\n  ctf->AddRGBPoint(-20.4601268768311, 0.0235294, 0.709804, 0.831373);\n  ctf->AddRGBPoint(-19.5878868103027, 0.0509804, 0.8, 0.85098);\n  ctf->AddRGBPoint(-18.8666133880615, 0.0705882, 0.854902, 0.870588);\n  ctf->AddRGBPoint(-18.1956596374512, 0.262745, 0.901961, 0.862745);\n  ctf->AddRGBPoint(-17.6085758209229, 0.423529, 0.941176, 0.87451);\n  ctf->AddRGBPoint(-16.7027893066406, 0.572549, 0.964706, 0.835294);\n  ctf->AddRGBPoint(-16.0989303588867, 0.658824, 0.980392, 0.843137);\n  ctf->AddRGBPoint(-15.6628112792969, 0.764706, 0.980392, 0.866667);\n  ctf->AddRGBPoint(-15.1931447982788, 0.827451, 0.980392, 0.886275);\n  ctf->AddRGBPoint(-14.2705841064453, 0.913725, 0.988235, 0.937255);\n  ctf->AddRGBPoint(-13.9854288101196, 1, 1, 0.972549019607843);\n  ctf->AddRGBPoint(-13.7002735137939, 0.988235, 0.980392, 0.870588);\n  ctf->AddRGBPoint(-13.2809276580811, 0.992156862745098, 0.972549019607843,\n                   0.803921568627451);\n  ctf->AddRGBPoint(-12.9622249603271, 0.992157, 0.964706, 0.713725);\n  ctf->AddRGBPoint(-12.4254627227783, 0.988235, 0.956863, 0.643137);\n  ctf->AddRGBPoint(-11.5699977874756, 0.980392, 0.917647, 0.509804);\n  ctf->AddRGBPoint(-10.8487224578857, 0.968627, 0.87451, 0.407843);\n  ctf->AddRGBPoint(-10.1106739044189, 0.94902, 0.823529, 0.321569);\n  ctf->AddRGBPoint(-9.57391166687012, 0.929412, 0.776471, 0.278431);\n  ctf->AddRGBPoint(-8.78554153442383, 0.909804, 0.717647, 0.235294);\n  ctf->AddRGBPoint(-8.08104133605957, 0.890196, 0.658824, 0.196078);\n  ctf->AddRGBPoint(-7.50234400308847, 0.878431, 0.619608, 0.168627);\n  ctf->AddRGBPoint(-6.68671653659248, 0.870588, 0.54902, 0.156863);\n  ctf->AddRGBPoint(-5.87108907009648, 0.85098, 0.47451, 0.145098);\n  ctf->AddRGBPoint(-5.05546160360049, 0.831373, 0.411765, 0.133333);\n  ctf->AddRGBPoint(-4.23983413710449, 0.811765, 0.345098, 0.113725);\n  ctf->AddRGBPoint(-3.4242066706085, 0.788235, 0.266667, 0.0941176);\n  ctf->AddRGBPoint(-2.6085792041125, 0.741176, 0.184314, 0.0745098);\n  ctf->AddRGBPoint(-1.79295173761651, 0.690196, 0.12549, 0.0627451);\n  ctf->AddRGBPoint(-0.977324271120517, 0.619608, 0.0627451, 0.0431373);\n  ctf->AddRGBPoint(-0.214114964008331, 0.54902, 0.027451, 0.0705882);\n  ctf->AddRGBPoint(0.456838220357895, 0.470588, 0.0156863, 0.0901961);\n  ctf->AddRGBPoint(1.21166050434113, 0.4, 0.00392157, 0.101961);\n  ctf->AddRGBPoint(2.28518559486346, 0.188235294117647, 0, 0.0705882352941176);\n\n  ctf->SetNumberOfValues(46);\n  ctf->DiscretizeOff();\n  return ctf;\n}\n\nvoid Animate(vtkObject* caller, unsigned long /*eid*/, void* clientdata,\n             void* /*calldata*/)\n{\n  vtkRenderWindowInteractor* interactor =\n      vtkRenderWindowInteractor::SafeDownCast(caller);\n  vtkHDFReader* reader =\n      vtkHDFReader::SafeDownCast(static_cast<vtkObjectBase*>(clientdata));\n  reader->SetStep((reader->GetStep() == reader->GetNumberOfSteps() - 1)\n                      ? 0\n                      : reader->GetStep() + 1);\n  std::cout << \"Current step: \" << reader->GetStep() << std::endl;\n  reader->Update();\n  interactor->Render();\n}\n} // namespace\n
        "},{"location":"Cxx/IO/TransientHDFReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransientHDFReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOHDF\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransientHDFReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransientHDFReader MACOSX_BUNDLE TransientHDFReader.cxx )\n  target_link_libraries(TransientHDFReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransientHDFReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/TransientHDFReader/#download-and-build-transienthdfreader","title":"Download and Build TransientHDFReader","text":"

        Click here to download TransientHDFReader and its CMakeLists.txt file. Once the tarball TransientHDFReader.tar has been downloaded and extracted,

        cd TransientHDFReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TransientHDFReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/VRMLImporter/","title":"VRMLImporter","text":"

        vtk-examples/Cxx/IO/VRMLImporter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/VRMLImporter/#description","title":"Description","text":"

        This example loads a wrl file and displays it on the screen. An example file to use is src/Testing/Data/sextant.wrl.

        Seealso

        VRMLImporterDemo shows how to add additional pipeline elements to imported polydata.

        Warning

        The vtkVRMLImporter only imports VRML 2.0 files.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/VRMLImporter/#code","title":"Code","text":"

        VRMLImporter.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVRMLImporter.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: Filename e.g. sextant.wrl\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n  std::cout << \"Reading \" << filename << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VRMLImporter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // VRML Import\n  vtkNew<vtkVRMLImporter> importer;\n  importer->SetFileName(filename.c_str());\n  importer->SetRenderWindow(renderWindow);\n  importer->Update();\n\n  auto actors = renderer->GetActors();\n  std::cout << \"There are \" << actors->GetNumberOfItems() << \" actors\"\n            << std::endl;\n\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderWindow->SetSize(512, 512);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/VRMLImporter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VRMLImporter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VRMLImporter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VRMLImporter MACOSX_BUNDLE VRMLImporter.cxx )\n  target_link_libraries(VRMLImporter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VRMLImporter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/VRMLImporter/#download-and-build-vrmlimporter","title":"Download and Build VRMLImporter","text":"

        Click here to download VRMLImporter and its CMakeLists.txt file. Once the tarball VRMLImporter.tar has been downloaded and extracted,

        cd VRMLImporter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VRMLImporter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/VRMLImporterDemo/","title":"VRMLImporterDemo","text":"

        vtk-examples/Cxx/IO/VRMLImporterDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/IO/VRMLImporterDemo/#description","title":"Description","text":"

        vtkVRMLImporter imports multiple vtkActor models. Sometimes the vtkPolyData require modifications. For example the data in this example does not have normals. The example uses vtkActorCollection to walk each model's vtkPolyData and inserts a vtkPolyDataNormals if the normals do not exist.

        Bug

        vtkVRMLImporter files use a shininess between 0 and 1, while vtk's vtkProperty has a specular power between 0 and 128. The example corrects this if the specular power is <= 1.0.

        Bug

        vtkVRMLImporter incorrectly creates a vtkLookupTable for colorPerVertex. This example converts the vtkLookupTable to vtkPointData.

        Tip

        The Virtual Insect website has lots of cool wrl models of insects.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/VRMLImporterDemo/#code","title":"Code","text":"

        VRMLImporterDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVRMLImporter.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: Filename e.g. grasshop.wrl\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n  std::cout << \"Reading \" << filename << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VRMLImporterDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // VRML Import\n  vtkNew<vtkVRMLImporter> importer;\n  importer->SetFileName(filename.c_str());\n  importer->SetRenderWindow(renderWindow);\n  importer->Update();\n\n  auto actors = renderer->GetActors();\n  std::cout << \"There are \" << actors->GetNumberOfItems() << \" actors\"\n            << std::endl;\n  actors->InitTraversal();\n  for (vtkIdType a = 0; a < actors->GetNumberOfItems(); ++a)\n  {\n    vtkActor* actor = actors->GetNextActor();\n\n    // The importer shininess parameter is between 0 and 1. VTK specular power\n    // is usually 10-100. Also, the default for the specular factor for VRML is\n    // 1, while VTK's is 0\n    double specularPower = actor->GetProperty()->GetSpecularPower();\n    if (specularPower <= 1.0)\n    {\n      actor->GetProperty()->SetSpecularPower(specularPower * 128.0);\n    }\n    double specular = actor->GetProperty()->GetSpecular();\n    if (specular == 0.0)\n    {\n      actor->GetProperty()->SetSpecular(1.0);\n    }\n#if 0\n    // The VRML default ambient intensity is .2\n    double ambientIntensity = actor->GetProperty()->GetAmbient();\n    if (ambientIntensity == 0.0)\n    {\n      actor->GetProperty()->SetAmbient(.2);\n    }\n#endif\n    vtkPolyDataMapper* mapper =\n        dynamic_cast<vtkPolyDataMapper*>(actor->GetMapper());\n    if (mapper)\n    {\n      vtkPolyData* dataSet = dynamic_cast<vtkPolyData*>(mapper->GetInput());\n      if (!dataSet->GetPointData()->GetNormals())\n      {\n        vtkNew<vtkPolyDataNormals> normals;\n        normals->SetInputData(dataSet);\n        normals->SplittingOff();\n        normals->Update();\n        mapper->SetInputData(normals->GetOutput());\n      }\n\n      // If there is a lookup table, convert it to point data\n      vtkLookupTable* lut =\n          dynamic_cast<vtkLookupTable*>(mapper->GetLookupTable());\n      if (lut && mapper->GetScalarVisibility())\n      {\n        vtkNew<vtkUnsignedCharArray> pc;\n        pc->SetNumberOfComponents(4);\n        pc->SetNumberOfTuples(lut->GetNumberOfColors());\n        for (int t = 0; t < lut->GetNumberOfColors(); ++t)\n        {\n          double* lutc = lut->GetTableValue(t);\n          unsigned char lutuc[4];\n          lut->GetColorAsUnsignedChars(lutc, lutuc);\n          pc->SetTypedTuple(t, lutuc);\n        }\n        mapper->SetLookupTable(NULL);\n        mapper->GetInput()->GetPointData()->SetScalars(pc);\n      }\n    }\n  }\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n\n  renderer->SetBackground(colors->GetColor3d(\"SpringGreen\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/VRMLImporterDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VRMLImporterDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VRMLImporterDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VRMLImporterDemo MACOSX_BUNDLE VRMLImporterDemo.cxx )\n  target_link_libraries(VRMLImporterDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VRMLImporterDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/VRMLImporterDemo/#download-and-build-vrmlimporterdemo","title":"Download and Build VRMLImporterDemo","text":"

        Click here to download VRMLImporterDemo and its CMakeLists.txt file. Once the tarball VRMLImporterDemo.tar has been downloaded and extracted,

        cd VRMLImporterDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VRMLImporterDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/WriteBMP/","title":"WriteBMP","text":"

        vtk-examples/Cxx/IO/WriteBMP

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/WriteBMP/#code","title":"Code","text":"

        WriteBMP.cxx

        #include <vtkBMPReader.h>\n#include <vtkBMPWriter.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: OutputFilename.bmp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  // Convert our unsigned char colors to doubles.\n  // Set draw color needs doubles.\n  auto color1 = colors->GetColor4ub(\"SteelBlue\").GetData();\n  auto color2 = colors->GetColor4ub(\"PaleGoldenrod\").GetData();\n  std::array<double, 4> sourceColor1{0, 0, 0, 0};\n  std::array<double, 4> sourceColor2{0, 0, 0, 0};\n  // Leave alpha at zero.\n  for (auto i = 0; i < 3; ++i)\n  {\n    sourceColor1[i] = color1[i];\n    sourceColor2[i] = color2[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 9, 0, 9, 0, 0);\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetDrawColor(sourceColor1.data());\n  imageSource->FillBox(0, 9, 0, 9);\n  imageSource->SetDrawColor(sourceColor2.data());\n  imageSource->FillBox(5, 7, 5, 7);\n  imageSource->Update();\n\n  vtkNew<vtkBMPWriter> bmpWriter;\n  bmpWriter->SetFileName(filename.c_str());\n  bmpWriter->SetInputConnection(imageSource->GetOutputPort());\n  bmpWriter->Write();\n\n  // Read and display for verification.\n  vtkNew<vtkBMPReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WriteBMP\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/WriteBMP/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteBMP)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteBMP: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteBMP MACOSX_BUNDLE WriteBMP.cxx )\n  target_link_libraries(WriteBMP PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteBMP\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/WriteBMP/#download-and-build-writebmp","title":"Download and Build WriteBMP","text":"

        Click here to download WriteBMP and its CMakeLists.txt file. Once the tarball WriteBMP.tar has been downloaded and extracted,

        cd WriteBMP/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WriteBMP\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/WriteLegacyLinearCells/","title":"WriteLegacyLinearCells","text":"

        vtk-examples/Cxx/IO/WriteLegacyLinearCells

        "},{"location":"Cxx/IO/WriteLegacyLinearCells/#description","title":"Description","text":"

        This example uses vtkUnstructuredGridWriter to write each linear cell into a .vtk file. The files are written into the current directory.

        Seealso

        WriteXMLLinearCells writes the same files using the VTK XML format.

        Cite

        The VTK File Formats document discusses the XML file format.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/WriteLegacyLinearCells/#code","title":"Code","text":"

        WriteLegacyLinearCells.cxx

        #include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridWriter.h>\n\n#include <vtkHexagonalPrism.h>\n#include <vtkHexahedron.h>\n#include <vtkLine.h>\n#include <vtkPentagonalPrism.h>\n#include <vtkPixel.h>\n#include <vtkPolyLine.h>\n#include <vtkPolyVertex.h>\n#include <vtkPolygon.h>\n#include <vtkPyramid.h>\n#include <vtkQuad.h>\n#include <vtkTetra.h>\n#include <vtkTriangle.h>\n#include <vtkTriangleStrip.h>\n#include <vtkVertex.h>\n#include <vtkVoxel.h>\n#include <vtkWedge.h>\n\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n// These functions return a vtkUnstructured grid corresponding to the object.\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid> MakeUnstructuredGrid(vtkSmartPointer<T>);\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon();\n} // namespace\n\nint main(int, char*[])\n{\n  std::vector<std::string> filenames;\n  std::vector<vtkSmartPointer<vtkUnstructuredGrid>> uGrids;\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkVertex>::New()));\n  filenames.push_back(\"Vertex.vtk\");\n\n  uGrids.push_back(MakePolyVertex());\n  filenames.push_back(\"PolyVertex.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkLine>::New()));\n  filenames.push_back(\"Line.vtk\");\n\n  uGrids.push_back(MakePolyLine());\n  filenames.push_back(\"PolyLine.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkTriangle>::New()));\n  filenames.push_back(\"Triangle.vtk\");\n\n  uGrids.push_back(MakeTriangleStrip());\n  filenames.push_back(\"TriangleStrip.vtk\");\n\n  uGrids.push_back(MakePolygon());\n  filenames.push_back(\"Polygon.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkPixel>::New()));\n  filenames.push_back(\"Pixel.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkQuad>::New()));\n  filenames.push_back(\"Quad.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkTetra>::New()));\n  filenames.push_back(\"Tetra.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkVoxel>::New()));\n  filenames.push_back(\"Voxel.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkHexahedron>::New()));\n  filenames.push_back(\"Hexahedron.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkWedge>::New()));\n  filenames.push_back(\"Wedge.vtk\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkPyramid>::New()));\n  filenames.push_back(\"Pyramid.vtk\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkPentagonalPrism>::New()));\n  filenames.push_back(\"PentagonalPrism.vtk\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkHexagonalPrism>::New()));\n  filenames.push_back(\"HexagonalPrism.vtk\");\n\n  // Write each grid into a file.\n  for (unsigned int i = 0; i < uGrids.size(); ++i)\n  {\n    std::cout << \"Writing: \" << filenames[i] << std::endl;\n    vtkNew<vtkUnstructuredGridWriter> writer;\n    writer->SetFileName(filenames[i].c_str());\n    writer->SetInputData(uGrids[i]);\n    writer->Write();\n  }\n\n  return EXIT_SUCCESS;\n}\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid>\nMakeUnstructuredGrid(vtkSmartPointer<T> aCell)\n{\n  double* pcoords = aCell->GetParametricCoords();\n  for (int i = 0; i < aCell->GetNumberOfPoints(); ++i)\n  {\n    aCell->GetPointIds()->SetId(i, i);\n    aCell->GetPoints()->SetPoint(i, *(pcoords + 3 * i), *(pcoords + 3 * i + 1),\n                                 *(pcoords + 3 * i + 2));\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(aCell->GetPoints());\n  ug->InsertNextCell(aCell->GetCellType(), aCell->GetPointIds());\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex()\n{\n  // A polyvertex is a cell represents a set of 0D vertices.\n  int numberOfVertices = 6;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, .4);\n  points->InsertNextPoint(0, 1, .6);\n\n  vtkNew<vtkPolyVertex> polyVertex;\n  polyVertex->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyVertex->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyVertex->GetCellType(), polyVertex->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine()\n{\n  // A polyline is a cell that represents a set of 1D lines.\n  int numberOfVertices = 5;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, .5, 0);\n  points->InsertNextPoint(.5, 0, 0);\n  points->InsertNextPoint(1, .3, 0);\n  points->InsertNextPoint(1.5, .4, 0);\n  points->InsertNextPoint(2.0, .4, 0);\n\n  vtkNew<vtkPolyLine> polyline;\n  polyline->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyline->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyline->GetCellType(), polyline->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip()\n{\n  // A triangle is a cell that represents a triangle strip.\n  int numberOfVertices = 10;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(.5, 1, 0);\n  points->InsertNextPoint(1, -.1, 0);\n  points->InsertNextPoint(1.5, .8, 0);\n  points->InsertNextPoint(2.0, -.1, 0);\n  points->InsertNextPoint(2.5, .9, 0);\n  points->InsertNextPoint(3.0, 0, 0);\n  points->InsertNextPoint(3.5, .8, 0);\n  points->InsertNextPoint(4.0, -.2, 0);\n  points->InsertNextPoint(4.5, 1.1, 0);\n\n  vtkNew<vtkTriangleStrip> trianglestrip;\n  trianglestrip->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    trianglestrip->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(trianglestrip->GetCellType(),\n                     trianglestrip->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon()\n{\n  // A polygon is a cell that represents a polygon.\n  int numberOfVertices = 6;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, -.1, 0);\n  points->InsertNextPoint(.8, .5, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(.6, 1.2, 0);\n  points->InsertNextPoint(0, .8, 0);\n\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polygon->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polygon->GetCellType(), polygon->GetPointIds());\n\n  return ug;\n}\n} // namespace\n
        "},{"location":"Cxx/IO/WriteLegacyLinearCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteLegacyLinearCells)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOLegacy\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteLegacyLinearCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteLegacyLinearCells MACOSX_BUNDLE WriteLegacyLinearCells.cxx )\n  target_link_libraries(WriteLegacyLinearCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteLegacyLinearCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/WriteLegacyLinearCells/#download-and-build-writelegacylinearcells","title":"Download and Build WriteLegacyLinearCells","text":"

        Click here to download WriteLegacyLinearCells and its CMakeLists.txt file. Once the tarball WriteLegacyLinearCells.tar has been downloaded and extracted,

        cd WriteLegacyLinearCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WriteLegacyLinearCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/WritePLY/","title":"WritePLY","text":"

        vtk-examples/Cxx/IO/WritePLY

        "},{"location":"Cxx/IO/WritePLY/#description","title":"Description","text":"

        Note

        Unlike vtkPolyDataXMLWriter and most other VTK writers, to write colors to the .ply file you must specify to the vtkPLYWriter:

        plyWriter->SetArrayName(\"Colors\");

        where your color array was created/named like this:

        vtkNew<vtkUnsignedCharArray> colors; colors->SetNumberOfComponents(3); colors->SetName(\"Colors\");

        (This was found in response to a user question on StackOverflow: http://stackoverflow.com/questions/17783612/save-mesh-with-rgb-in-vtk/19525938)

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/WritePLY/#code","title":"Code","text":"

        WritePLY.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPLYReader.h>\n#include <vtkPLYWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: filename.ply\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPLYWriter> plyWriter;\n  plyWriter->SetFileName(filename.c_str());\n  plyWriter->SetInputConnection(sphereSource->GetOutputPort());\n  plyWriter->Write();\n\n  // Read and display for verification\n  vtkNew<vtkPLYReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WritePLY\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"cobalt_green\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/WritePLY/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WritePLY)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOPLY\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WritePLY: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WritePLY MACOSX_BUNDLE WritePLY.cxx )\n  target_link_libraries(WritePLY PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WritePLY\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/WritePLY/#download-and-build-writeply","title":"Download and Build WritePLY","text":"

        Click here to download WritePLY and its CMakeLists.txt file. Once the tarball WritePLY.tar has been downloaded and extracted,

        cd WritePLY/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WritePLY\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/WritePNM/","title":"WritePNM","text":"

        vtk-examples/Cxx/IO/WritePNM

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/WritePNM/#code","title":"Code","text":"

        WritePNM.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNMReader.h>\n#include <vtkPNMWriter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: OutputFilename.pnm\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  // Convert our unsigned char colors to doubles.\n  // Set draw color needs doubles.\n  auto color1 = colors->GetColor4ub(\"SteelBlue\").GetData();\n  auto color2 = colors->GetColor4ub(\"PaleGoldenrod\").GetData();\n  std::array<double, 4> sourceColor1{0, 0, 0, 0};\n  std::array<double, 4> sourceColor2{0, 0, 0, 0};\n  // Leave alpha at zero.\n  for (auto i = 0; i < 3; ++i)\n  {\n    sourceColor1[i] = color1[i];\n    sourceColor2[i] = color2[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 9, 0, 9, 0, 0);\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetDrawColor(sourceColor1.data());\n  imageSource->FillBox(0, 9, 0, 9);\n  imageSource->SetDrawColor(sourceColor2.data());\n  imageSource->FillBox(5, 7, 5, 7);\n  imageSource->Update();\n\n  vtkNew<vtkPNMWriter> pnmWriter;\n  pnmWriter->SetFileName(filename.c_str());\n  pnmWriter->SetInputConnection(imageSource->GetOutputPort());\n  pnmWriter->Write();\n\n  // Read and display for verification.\n  vtkNew<vtkPNMReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WritePNM\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/WritePNM/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WritePNM)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WritePNM: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WritePNM MACOSX_BUNDLE WritePNM.cxx )\n  target_link_libraries(WritePNM PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WritePNM\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/WritePNM/#download-and-build-writepnm","title":"Download and Build WritePNM","text":"

        Click here to download WritePNM and its CMakeLists.txt file. Once the tarball WritePNM.tar has been downloaded and extracted,

        cd WritePNM/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WritePNM\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/WriteSTL/","title":"WriteSTL","text":"

        vtk-examples/Cxx/IO/WriteSTL

        "},{"location":"Cxx/IO/WriteSTL/#description","title":"Description","text":"

        An STL file describes a triangulated three-dimensional surface by the unit normal and vertices (ordered by the right-hand rule) of the triangles. This example saves 3D geometric data stored in a vtkPolyData object to an STL file using vtkSTLWriter.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/WriteSTL/#code","title":"Code","text":"

        WriteSTL.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSTLWriter.h>\n#include <vtkSphereSource.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: filename.stl\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkSTLWriter> stlWriter;\n  stlWriter->SetFileName(filename.c_str());\n  stlWriter->SetInputConnection(sphereSource->GetOutputPort());\n  stlWriter->Write();\n\n  // Read and display for verification.\n  vtkNew<vtkSTLReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WriteSTL\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"cobalt_green\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/WriteSTL/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteSTL)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteSTL: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteSTL MACOSX_BUNDLE WriteSTL.cxx )\n  target_link_libraries(WriteSTL PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteSTL\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/WriteSTL/#download-and-build-writestl","title":"Download and Build WriteSTL","text":"

        Click here to download WriteSTL and its CMakeLists.txt file. Once the tarball WriteSTL.tar has been downloaded and extracted,

        cd WriteSTL/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WriteSTL\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/WriteTIFF/","title":"WriteTIFF","text":"

        vtk-examples/Cxx/IO/WriteTIFF

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/WriteTIFF/#code","title":"Code","text":"

        WriteTIFF.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTIFFReader.h>\n#include <vtkTIFFWriter.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: OutputFilename.tif\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  // Convert our unsigned char colors to doubles.\n  // Set draw color needs doubles.\n  auto color1 = colors->GetColor4ub(\"SteelBlue\").GetData();\n  auto color2 = colors->GetColor4ub(\"PaleGoldenrod\").GetData();\n  std::array<double, 4> sourceColor1{0, 0, 0, 0};\n  std::array<double, 4> sourceColor2{0, 0, 0, 0};\n  // Leave alpha at zero.\n  for (auto i = 0; i < 3; ++i)\n  {\n    sourceColor1[i] = color1[i];\n    sourceColor2[i] = color2[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 9, 0, 9, 0, 0);\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetDrawColor(sourceColor1.data());\n  imageSource->FillBox(0, 9, 0, 9);\n  imageSource->SetDrawColor(sourceColor2.data());\n  imageSource->FillBox(5, 7, 5, 7);\n  imageSource->Update();\n\n  vtkNew<vtkTIFFWriter> tiffWriter;\n  tiffWriter->SetFileName(filename.c_str());\n  tiffWriter->SetInputConnection(imageSource->GetOutputPort());\n  tiffWriter->Write();\n\n  // Read and display for verification.\n  vtkNew<vtkTIFFReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  // Setup renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WriteTIFF\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/WriteTIFF/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteTIFF)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteTIFF: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteTIFF MACOSX_BUNDLE WriteTIFF.cxx )\n  target_link_libraries(WriteTIFF PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteTIFF\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/WriteTIFF/#download-and-build-writetiff","title":"Download and Build WriteTIFF","text":"

        Click here to download WriteTIFF and its CMakeLists.txt file. Once the tarball WriteTIFF.tar has been downloaded and extracted,

        cd WriteTIFF/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WriteTIFF\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/WriteVTI/","title":"WriteVTI","text":"

        vtk-examples/Cxx/IO/WriteVTI

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/WriteVTI/#code","title":"Code","text":"

        WriteVTI.cxx

        #include <vtkActor.h>\n#include <vtkImageData.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLImageDataReader.h>\n#include <vtkXMLImageDataWriter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse command line arguments\n  if (argc != 2)\n  {\n    std::cout << \"Required arguments: filename.vti\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkImageData> imageData;\n  imageData->SetDimensions(3, 4, 5);\n  imageData->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = imageData->GetDimensions();\n\n  // Fill every entry of the image data with \"2.0\"\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel =\n            static_cast<double*>(imageData->GetScalarPointer(x, y, z));\n        pixel[0] = 2.0;\n      }\n    }\n  }\n\n  vtkNew<vtkXMLImageDataWriter> writer;\n  writer->SetFileName(filename.c_str());\n  writer->SetInputData(imageData);\n  writer->Write();\n\n  // Read the file (to test that it was written correctly)\n  vtkNew<vtkXMLImageDataReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Convert the image to a polydata\n  vtkNew<vtkImageDataGeometryFilter> imageDataGeometryFilter;\n  imageDataGeometryFilter->SetInputConnection(reader->GetOutputPort());\n  imageDataGeometryFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(imageDataGeometryFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(3);\n\n  // Setup rendering\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WriteVTI\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/WriteVTI/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteVTI)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteVTI: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteVTI MACOSX_BUNDLE WriteVTI.cxx )\n  target_link_libraries(WriteVTI PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteVTI\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/WriteVTI/#download-and-build-writevti","title":"Download and Build WriteVTI","text":"

        Click here to download WriteVTI and its CMakeLists.txt file. Once the tarball WriteVTI.tar has been downloaded and extracted,

        cd WriteVTI/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WriteVTI\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/WriteVTP/","title":"WriteVTP","text":"

        vtk-examples/Cxx/IO/WriteVTP

        "},{"location":"Cxx/IO/WriteVTP/#description","title":"Description","text":"

        In this example, we add 10 points to a polygonal data (polydata) object and write the result to a VTP file.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/WriteVTP/#code","title":"Code","text":"

        WriteVTP.cxx

        #include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataWriter.h>\n\nint main(int, char*[])\n{\n  // Create 10 points.\n  vtkNew<vtkPoints> points;\n\n  for (unsigned int i = 0; i < 10; ++i)\n  {\n    points->InsertNextPoint(i, i, i);\n  }\n\n  // Create a polydata object and add the points to it.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Write the file\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(\"test.vtp\");\n  writer->SetInputData(polydata);\n\n  // Optional - set the mode. The default is binary.\n  // writer->SetDataModeToBinary();\n  // writer->SetDataModeToAscii();\n\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/WriteVTP/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteVTP)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteVTP: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteVTP MACOSX_BUNDLE WriteVTP.cxx )\n  target_link_libraries(WriteVTP PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteVTP\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/WriteVTP/#download-and-build-writevtp","title":"Download and Build WriteVTP","text":"

        Click here to download WriteVTP and its CMakeLists.txt file. Once the tarball WriteVTP.tar has been downloaded and extracted,

        cd WriteVTP/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WriteVTP\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/WriteVTU/","title":"WriteVTU","text":"

        vtk-examples/Cxx/IO/WriteVTU

        "},{"location":"Cxx/IO/WriteVTU/#description","title":"Description","text":"

        This example writes a VTU file.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/WriteVTU/#code","title":"Code","text":"

        WriteVTU.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTetra.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridReader.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required arguments: OutputFilename.vtu\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 1);\n\n  vtkNew<vtkTetra> tetra;\n\n  tetra->GetPointIds()->SetId(0, 0);\n  tetra->GetPointIds()->SetId(1, 1);\n  tetra->GetPointIds()->SetId(2, 2);\n  tetra->GetPointIds()->SetId(3, 3);\n\n  vtkNew<vtkCellArray> cellArray;\n  cellArray->InsertNextCell(tetra);\n\n  vtkNew<vtkUnstructuredGrid> unstructuredGrid;\n  unstructuredGrid->SetPoints(points);\n  unstructuredGrid->SetCells(VTK_TETRA, cellArray);\n\n  // Write file.\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetFileName(filename.c_str());\n  writer->SetInputData(unstructuredGrid);\n  writer->Write();\n\n  // Read and display file for verification that it was written correclty.\n  vtkNew<vtkXMLUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WriteVTU\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"cobalt_green\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/WriteVTU/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteVTU)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteVTU: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteVTU MACOSX_BUNDLE WriteVTU.cxx )\n  target_link_libraries(WriteVTU PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteVTU\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/WriteVTU/#download-and-build-writevtu","title":"Download and Build WriteVTU","text":"

        Click here to download WriteVTU and its CMakeLists.txt file. Once the tarball WriteVTU.tar has been downloaded and extracted,

        cd WriteVTU/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WriteVTU\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/WriteXMLLinearCells/","title":"WriteXMLLinearCells","text":"

        vtk-examples/Cxx/IO/WriteXMLLinearCells

        "},{"location":"Cxx/IO/WriteXMLLinearCells/#description","title":"Description","text":"

        This example uses vtkXMLDataSetWriter to write each linear cell into a .vtu file. The files are written into the current directory.

        Seealso

        WriteLegacyLinearCells writes the same files using the VTK legacy format.

        Cite

        The VTK File Formats document discusses the XML file format.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/WriteXMLLinearCells/#code","title":"Code","text":"

        WriteXMLLinearCells.cxx

        #include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLDataSetWriter.h>\n\n#include <vtkHexagonalPrism.h>\n#include <vtkHexahedron.h>\n#include <vtkLine.h>\n#include <vtkPentagonalPrism.h>\n#include <vtkPixel.h>\n#include <vtkPolyLine.h>\n#include <vtkPolyVertex.h>\n#include <vtkPolygon.h>\n#include <vtkPyramid.h>\n#include <vtkQuad.h>\n#include <vtkTetra.h>\n#include <vtkTriangle.h>\n#include <vtkTriangleStrip.h>\n#include <vtkVertex.h>\n#include <vtkVoxel.h>\n#include <vtkWedge.h>\n\n#include <cstdlib>\n#include <string>\n#include <vector>\n\n// These functions return a vtkUnstructured grid corresponding to the object.\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid> MakeUnstructuredGrid(vtkSmartPointer<T>);\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine();\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip();\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon();\n} // namespace\n\nint main(int, char*[])\n{\n  std::vector<std::string> filenames;\n  std::vector<vtkSmartPointer<vtkUnstructuredGrid>> uGrids;\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkVertex>::New()));\n  filenames.push_back(\"Vertex.vtu\");\n\n  uGrids.push_back(MakePolyVertex());\n  filenames.push_back(\"PolyVertex.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkLine>::New()));\n  filenames.push_back(\"Line.vtu\");\n\n  uGrids.push_back(MakePolyLine());\n  filenames.push_back(\"PolyLine.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkTriangle>::New()));\n  filenames.push_back(\"Triangle.vtu\");\n\n  uGrids.push_back(MakeTriangleStrip());\n  filenames.push_back(\"TriangleStrip.vtu\");\n\n  uGrids.push_back(MakePolygon());\n  filenames.push_back(\"Polygon.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkPixel>::New()));\n  filenames.push_back(\"Pixel.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkQuad>::New()));\n  filenames.push_back(\"Quad.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkTetra>::New()));\n  filenames.push_back(\"Tetra.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkVoxel>::New()));\n  filenames.push_back(\"Voxel.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkHexahedron>::New()));\n  filenames.push_back(\"Hexahedron.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkWedge>::New()));\n  filenames.push_back(\"Wedge.vtu\");\n\n  uGrids.push_back(MakeUnstructuredGrid(vtkSmartPointer<vtkPyramid>::New()));\n  filenames.push_back(\"Pyramid.vtu\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkPentagonalPrism>::New()));\n  filenames.push_back(\"PentagonalPrism.vtu\");\n\n  uGrids.push_back(\n      MakeUnstructuredGrid(vtkSmartPointer<vtkHexagonalPrism>::New()));\n  filenames.push_back(\"HexagonalPrism.vtu\");\n\n  // Write each grid into  a file\n  for (unsigned int i = 0; i < uGrids.size(); ++i)\n  {\n    std::cout << \"Writing: \" << filenames[i] << std::endl;\n    vtkNew<vtkXMLDataSetWriter> writer;\n    writer->SetFileName(filenames[i].c_str());\n    writer->SetInputData(uGrids[i]);\n    writer->Write();\n  }\n\n  return EXIT_SUCCESS;\n}\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid>\nMakeUnstructuredGrid(vtkSmartPointer<T> aCell)\n{\n  double* pcoords = aCell->GetParametricCoords();\n  for (int i = 0; i < aCell->GetNumberOfPoints(); ++i)\n  {\n    aCell->GetPointIds()->SetId(i, i);\n    aCell->GetPoints()->SetPoint(i, *(pcoords + 3 * i), *(pcoords + 3 * i + 1),\n                                 *(pcoords + 3 * i + 2));\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(aCell->GetPoints());\n  ug->InsertNextCell(aCell->GetCellType(), aCell->GetPointIds());\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyVertex()\n{\n  // A polyvertex is a cell represents a set of 0D vertices\n  int numberOfVertices = 6;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(0, 0, 1);\n  points->InsertNextPoint(1, 0, .4);\n  points->InsertNextPoint(0, 1, .6);\n\n  vtkNew<vtkPolyVertex> polyVertex;\n  polyVertex->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyVertex->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyVertex->GetCellType(), polyVertex->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolyLine()\n{\n  // A polyline is a cell that represents a set of 1D lines\n  int numberOfVertices = 5;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, .5, 0);\n  points->InsertNextPoint(.5, 0, 0);\n  points->InsertNextPoint(1, .3, 0);\n  points->InsertNextPoint(1.5, .4, 0);\n  points->InsertNextPoint(2.0, .4, 0);\n\n  vtkNew<vtkPolyLine> polyline;\n  polyline->GetPointIds()->SetNumberOfIds(numberOfVertices);\n\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polyline->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polyline->GetCellType(), polyline->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakeTriangleStrip()\n{\n  // A triangle is a cell that represents a triangle strip\n  int numberOfVertices = 10;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(.5, 1, 0);\n  points->InsertNextPoint(1, -.1, 0);\n  points->InsertNextPoint(1.5, .8, 0);\n  points->InsertNextPoint(2.0, -.1, 0);\n  points->InsertNextPoint(2.5, .9, 0);\n  points->InsertNextPoint(3.0, 0, 0);\n  points->InsertNextPoint(3.5, .8, 0);\n  points->InsertNextPoint(4.0, -.2, 0);\n  points->InsertNextPoint(4.5, 1.1, 0);\n\n  vtkNew<vtkTriangleStrip> trianglestrip;\n  trianglestrip->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    trianglestrip->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(trianglestrip->GetCellType(),\n                     trianglestrip->GetPointIds());\n\n  return ug;\n}\n\nvtkSmartPointer<vtkUnstructuredGrid> MakePolygon()\n{\n  // A polygon is a cell that represents a polygon\n  int numberOfVertices = 6;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, -.1, 0);\n  points->InsertNextPoint(.8, .5, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(.6, 1.2, 0);\n  points->InsertNextPoint(0, .8, 0);\n\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPointIds()->SetNumberOfIds(numberOfVertices);\n  for (int i = 0; i < numberOfVertices; ++i)\n  {\n    polygon->GetPointIds()->SetId(i, i);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n  ug->InsertNextCell(polygon->GetCellType(), polygon->GetPointIds());\n\n  return ug;\n}\n} // namespace\n
        "},{"location":"Cxx/IO/WriteXMLLinearCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WriteXMLLinearCells)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WriteXMLLinearCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WriteXMLLinearCells MACOSX_BUNDLE WriteXMLLinearCells.cxx )\n  target_link_libraries(WriteXMLLinearCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WriteXMLLinearCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/WriteXMLLinearCells/#download-and-build-writexmllinearcells","title":"Download and Build WriteXMLLinearCells","text":"

        Click here to download WriteXMLLinearCells and its CMakeLists.txt file. Once the tarball WriteXMLLinearCells.tar has been downloaded and extracted,

        cd WriteXMLLinearCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WriteXMLLinearCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/XMLPImageDataWriter/","title":"XMLPImageDataWriter","text":"

        vtk-examples/Cxx/IO/XMLPImageDataWriter

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/XMLPImageDataWriter/#code","title":"Code","text":"

        XMLPImageDataWriter.cxx

        #include <vtkImageCanvasSource2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkXMLPImageDataWriter.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Convert our unsigned char colors to doubles\n  // Set draw color needs doubles.\n  auto color1 = colors->GetColor3ub(\"SteelBlue\").GetData();\n  auto color2 = colors->GetColor3ub(\"PaleGoldenrod\").GetData();\n  std::array<double, 3> sourceColor1{0, 0, 0};\n  std::array<double, 3> sourceColor2{0, 0, 0};\n  for (auto i = 0; i < 3; ++i)\n  {\n    sourceColor1[i] = color1[i];\n    sourceColor2[i] = color2[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetExtent(0, 20, 0, 50, 0, 1);\n  drawing->SetDrawColor(sourceColor1.data());\n  drawing->FillBox(0, 9, 0, 9);\n  drawing->SetDrawColor(sourceColor2.data());\n  drawing->DrawCircle(5, 5, 3);\n\n  int numberOfPieces = 4;\n\n  vtkNew<vtkXMLPImageDataWriter> writer;\n  writer->SetInputConnection(drawing->GetOutputPort());\n  writer->SetFileName(\"Test.pvti\");\n  writer->SetNumberOfPieces(numberOfPieces);\n  writer->SetEndPiece(numberOfPieces - 1);\n  writer->SetStartPiece(0);\n  writer->Update();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/XMLPImageDataWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(XMLPImageDataWriter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOParallelXML\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"XMLPImageDataWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(XMLPImageDataWriter MACOSX_BUNDLE XMLPImageDataWriter.cxx )\n  target_link_libraries(XMLPImageDataWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS XMLPImageDataWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/XMLPImageDataWriter/#download-and-build-xmlpimagedatawriter","title":"Download and Build XMLPImageDataWriter","text":"

        Click here to download XMLPImageDataWriter and its CMakeLists.txt file. Once the tarball XMLPImageDataWriter.tar has been downloaded and extracted,

        cd XMLPImageDataWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./XMLPImageDataWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/XMLPUnstructuredGridWriter/","title":"XMLPUnstructuredGridWriter","text":"

        vtk-examples/Cxx/IO/XMLPUnstructuredGridWriter

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/XMLPUnstructuredGridWriter/#code","title":"Code","text":"

        XMLPUnstructuredGridWriter.cxx

        #include <vtkDelaunay3D.h>\n#include <vtkNew.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPUnstructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkDelaunay3D> delaunay;\n  delaunay->SetInputConnection(sphereSource->GetOutputPort());\n  delaunay->Update();\n\n  vtkNew<vtkXMLPUnstructuredGridWriter> writer;\n  writer->SetInputConnection(delaunay->GetOutputPort());\n  writer->SetFileName(\"Test.pvtu\");\n  writer->SetNumberOfPieces(4);\n  writer->SetStartPiece(0);\n  writer->SetEndPiece(3);\n  writer->Update();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/XMLPUnstructuredGridWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(XMLPUnstructuredGridWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOParallelXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"XMLPUnstructuredGridWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(XMLPUnstructuredGridWriter MACOSX_BUNDLE XMLPUnstructuredGridWriter.cxx )\n  target_link_libraries(XMLPUnstructuredGridWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS XMLPUnstructuredGridWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/XMLPUnstructuredGridWriter/#download-and-build-xmlpunstructuredgridwriter","title":"Download and Build XMLPUnstructuredGridWriter","text":"

        Click here to download XMLPUnstructuredGridWriter and its CMakeLists.txt file. Once the tarball XMLPUnstructuredGridWriter.tar has been downloaded and extracted,

        cd XMLPUnstructuredGridWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./XMLPUnstructuredGridWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/IO/XMLStructuredGridWriter/","title":"XMLStructuredGridWriter","text":"

        vtk-examples/Cxx/IO/XMLStructuredGridWriter

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/IO/XMLStructuredGridWriter/#code","title":"Code","text":"

        XMLStructuredGridWriter.cxx

        #include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkStructuredGrid.h>\n#include <vtkXMLStructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  // Create a grid.\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  vtkNew<vtkPoints> points;\n\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 2, 0);\n  points->InsertNextPoint(1, 2, 1);\n\n  // Specify the dimensions of the grid.\n  structuredGrid->SetDimensions(2, 3, 1);\n  structuredGrid->SetPoints(points);\n\n  // Write file.\n  vtkNew<vtkXMLStructuredGridWriter> writer;\n  writer->SetFileName(\"output.vts\");\n  writer->SetInputData(structuredGrid);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/IO/XMLStructuredGridWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(XMLStructuredGridWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"XMLStructuredGridWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(XMLStructuredGridWriter MACOSX_BUNDLE XMLStructuredGridWriter.cxx )\n  target_link_libraries(XMLStructuredGridWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS XMLStructuredGridWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/IO/XMLStructuredGridWriter/#download-and-build-xmlstructuredgridwriter","title":"Download and Build XMLStructuredGridWriter","text":"

        Click here to download XMLStructuredGridWriter and its CMakeLists.txt file. Once the tarball XMLStructuredGridWriter.tar has been downloaded and extracted,

        cd XMLStructuredGridWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./XMLStructuredGridWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/CellIdFromGridCoordinates/","title":"CellIdFromGridCoordinates","text":"

        vtk-examples/Cxx/ImageData/CellIdFromGridCoordinates

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/CellIdFromGridCoordinates/#code","title":"Code","text":"

        CellIdFromGridCoordinates.cxx

        #include <vtkImageData.h>\n#include <vtkNew.h>\n#include <vtkStructuredData.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkImageData> grid;\n  grid->SetOrigin(0, 0, 0);\n\n  unsigned int numVoxelsPerDimension =\n      2; // the number of voxels in each dimension\n  grid->SetSpacing(1, 1, 1);\n\n  int extent[6];\n  extent[0] = 0;\n  extent[1] = numVoxelsPerDimension;\n  extent[2] = 0;\n  extent[3] = numVoxelsPerDimension;\n  extent[4] = 0;\n  extent[5] = numVoxelsPerDimension;\n  grid->SetExtent(extent);\n  grid->AllocateScalars(VTK_INT, 1);\n\n  for (unsigned int i = 0; i < numVoxelsPerDimension; ++i)\n  {\n    for (unsigned int j = 0; j < numVoxelsPerDimension; ++j)\n    {\n      for (unsigned int k = 0; k < numVoxelsPerDimension; ++k)\n      {\n        int pos[3];\n        pos[0] = i;\n        pos[1] = j;\n        pos[2] = k;\n\n        vtkIdType id = vtkStructuredData::ComputeCellIdForExtent(extent, pos);\n        std::cout << \"Cell \" << i << \" \" << j << \" \" << k << \" has id : \" << id\n                  << std::endl;\n      }\n    }\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageData/CellIdFromGridCoordinates/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellIdFromGridCoordinates)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellIdFromGridCoordinates: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellIdFromGridCoordinates MACOSX_BUNDLE CellIdFromGridCoordinates.cxx )\n  target_link_libraries(CellIdFromGridCoordinates PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellIdFromGridCoordinates\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/CellIdFromGridCoordinates/#download-and-build-cellidfromgridcoordinates","title":"Download and Build CellIdFromGridCoordinates","text":"

        Click here to download CellIdFromGridCoordinates and its CMakeLists.txt file. Once the tarball CellIdFromGridCoordinates.tar has been downloaded and extracted,

        cd CellIdFromGridCoordinates/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellIdFromGridCoordinates\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/ClipVolume/","title":"ClipVolume","text":"

        vtk-examples/Cxx/ImageData/ClipVolume

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageData/ClipVolume/#description","title":"Description","text":"

        This example shows how to use vtkClipVolume and subclasses of vtkImplicitFunction, producing a vtkUnstructuredGrid. The output consists of vtkTetra or other 3D cell types.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/ClipVolume/#code","title":"Code","text":"

        ClipVolume.cxx

        // This program draws a checkerboard and clips it with two planes.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipVolume.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkExecutive.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkLookupTable.h>\n#include <vtkMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nconstexpr auto IMAGESIZE{64};  // number of checkerboard squares on a side\nconstexpr auto CUBESIZE{20.0}; // physical linear dimension of entire system\n\n// Color for the checkerboard image\nconstexpr auto DIM{0.5}; // amount to dim the dark squares by\n\n// Offsets for clipping planes with normals in the X and Y directions\nconstexpr auto XOFFSET{8};\nconstexpr auto YOFFSET{8};\n\n///////////////////\n\n// Make the image data. A checkerboard pattern is used for\n// simplicity.\nvtkSmartPointer<vtkImageData> makeImage(int n, vtkColor3d fillColor,\n                                        vtkColor3d checkerColor);\n} // namespace\n\nint main(int, char*[])\n{\n\n  vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();\n\n  // Define colors\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Wheat\");\n  vtkColor3d checkerColor = colors->GetColor3d(\"Tomato\");\n  vtkColor3d fillColor = colors->GetColor3d(\"Banana\");\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(backgroundColor.GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  vtkNew<vtkInteractorStyleSwitch> style;\n  interactor->SetInteractorStyle(style);\n  interactor->SetRenderWindow(renderWindow);\n\n  auto image = makeImage(IMAGESIZE, fillColor, checkerColor);\n\n  // Clipping planes in the X and Y direction.\n  vtkNew<vtkDoubleArray> normals;\n  vtkNew<vtkPoints> clipPts;\n  normals->SetNumberOfComponents(3);\n  double xnorm[3] = {-1., 0., 0.};\n  double ynorm[3] = {0., -1., 0.};\n  double xpt[3] = {XOFFSET, 0., 0.};\n  double ypt[3] = {0., YOFFSET, 0.};\n  normals->InsertNextTuple(xnorm);\n  normals->InsertNextTuple(ynorm);\n  clipPts->InsertNextPoint(xpt);\n  clipPts->InsertNextPoint(ypt);\n  vtkNew<vtkPlanes> clipPlanes;\n  clipPlanes->SetNormals(normals);\n  clipPlanes->SetPoints(clipPts);\n\n  vtkNew<vtkClipVolume> clipper;\n  clipper->SetClipFunction(clipPlanes);\n  clipper->SetInputData(image);\n\n  vtkNew<vtkDataSetMapper> imageMapper;\n  vtkNew<vtkActor> imageActor;\n  imageActor->SetMapper(imageMapper);\n  renderer->AddViewProp(imageActor);\n  imageMapper->SetInputConnection(clipper->GetOutputPort());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n  renderWindow->SetWindowName(\"ClipVolume\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n  ;\n}\n\nnamespace {\n// Make the image data. A checkerboard pattern is used for\n// simplicity.\nvtkSmartPointer<vtkImageData> makeImage(int n, vtkColor3d fillColor,\n                                        vtkColor3d checkerColor)\n{\n  vtkNew<vtkImageData> image0;\n  image0->SetDimensions(n, n, n);\n  image0->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n  image0->SetSpacing(CUBESIZE / n, CUBESIZE / n, CUBESIZE / n);\n  int checkerSize = n / 8;\n  for (int z = 0; z < n; z++)\n  {\n    for (int y = 0; y < n; y++)\n    {\n      for (int x = 0; x < n; x++)\n      {\n        unsigned char* ptr = (unsigned char*)image0->GetScalarPointer(x, y, z);\n        *ptr = (x / checkerSize + y / checkerSize + z / checkerSize) %\n            2; // checkerboard\n      }\n    }\n  }\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(2);\n  lut->SetTableRange(0, 1);\n  lut->SetTableValue(0, fillColor.GetRed(), fillColor.GetGreen(),\n                     fillColor.GetBlue(), 1.0);\n  lut->SetTableValue(1, checkerColor.GetRed(), checkerColor.GetGreen(),\n                     checkerColor.GetBlue(), 1.0);\n\n  auto map = vtkSmartPointer<vtkImageMapToColors>::New();\n  map->SetLookupTable(lut);\n  map->SetOutputFormatToRGBA();\n  map->SetInputData(image0);\n  map->GetExecutive()->Update();\n\n  return map->GetOutput();\n}\n\n} // namespace\n
        "},{"location":"Cxx/ImageData/ClipVolume/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipVolume)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonExecutionModel\n  FiltersGeneral\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipVolume: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipVolume MACOSX_BUNDLE ClipVolume.cxx )\n  target_link_libraries(ClipVolume PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipVolume\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/ClipVolume/#download-and-build-clipvolume","title":"Download and Build ClipVolume","text":"

        Click here to download ClipVolume and its CMakeLists.txt file. Once the tarball ClipVolume.tar has been downloaded and extracted,

        cd ClipVolume/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClipVolume\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/ExtractVOI/","title":"ExtractVOI","text":"

        vtk-examples/Cxx/ImageData/ExtractVOI

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/ExtractVOI/#code","title":"Code","text":"

        ExtractVOI.cxx

        #include <vtkExtractVOI.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  int* inputDims = source->GetOutput()->GetDimensions();\n  std::cout << \"Dims: \"\n            << \" x: \" << inputDims[0] << \" y: \" << inputDims[1]\n            << \" z: \" << inputDims[2] << std::endl;\n  std::cout << \"Number of points: \" << source->GetOutput()->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Number of cells: \" << source->GetOutput()->GetNumberOfCells()\n            << std::endl;\n\n  vtkNew<vtkExtractVOI> extractVOI;\n  extractVOI->SetInputConnection(source->GetOutputPort());\n  extractVOI->SetVOI(inputDims[0] / 4., 3. * inputDims[0] / 4.,\n                     inputDims[1] / 4., 3. * inputDims[1] / 4., 0, 0);\n  extractVOI->Update();\n\n  vtkImageData* extracted = extractVOI->GetOutput();\n\n  int* extractedDims = extracted->GetDimensions();\n  std::cout << \"Dims: \"\n            << \" x: \" << extractedDims[0] << \" y: \" << extractedDims[1]\n            << \" z: \" << extractedDims[2] << std::endl;\n  std::cout << \"Number of points: \" << extracted->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Number of cells: \" << extracted->GetNumberOfCells()\n            << std::endl;\n\n  vtkNew<vtkImageCast> inputCastFilter;\n  inputCastFilter->SetInputConnection(source->GetOutputPort());\n  inputCastFilter->SetOutputScalarTypeToUnsignedChar();\n  inputCastFilter->Update();\n\n  vtkNew<vtkImageCast> extractedCastFilter;\n  extractedCastFilter->SetInputData(extracted);\n  extractedCastFilter->SetOutputScalarTypeToUnsignedChar();\n  extractedCastFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(inputCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> extractedActor;\n  extractedActor->GetMapper()->SetInputConnection(\n      extractedCastFilter->GetOutputPort());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"DarkTurquoise\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(extractedActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->ResetCamera();\n  renderWindow->SetWindowName(\"ExtractVOI\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageData/ExtractVOI/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractVOI)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractVOI: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractVOI MACOSX_BUNDLE ExtractVOI.cxx )\n  target_link_libraries(ExtractVOI PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractVOI\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/ExtractVOI/#download-and-build-extractvoi","title":"Download and Build ExtractVOI","text":"

        Click here to download ExtractVOI and its CMakeLists.txt file. Once the tarball ExtractVOI.tar has been downloaded and extracted,

        cd ExtractVOI/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractVOI\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/GetCellCenter/","title":"GetCellCenter","text":"

        vtk-examples/Cxx/ImageData/GetCellCenter

        "},{"location":"Cxx/ImageData/GetCellCenter/#description","title":"Description","text":"

        Unfortunately this function is not built in directly, but rather quite convoluted to call. This is an easy to use wrapper.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/GetCellCenter/#code","title":"Code","text":"

        GetCellCenter.cxx

        #include <vtkCell.h>\n#include <vtkImageData.h>\n#include <vtkNew.h>\n\nnamespace {\n\nvoid GetCellCenter(vtkImageData* imageData, const unsigned int cellId,\n                   double center[3]);\n\n}\n\nint main(int, char*[])\n{\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(3, 3, 2); // This will cause 18 points and 4 cells\n  imageData->SetSpacing(1.0, 1.0, 1.0);\n  imageData->SetOrigin(0.0, 0.0, 0.0);\n\n  std::cout << \"Number of points: \" << imageData->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Number of cells: \" << imageData->GetNumberOfCells()\n            << std::endl;\n\n  double center[3] = {0, 0, 0};\n  for (vtkIdType cellId = 0; cellId < imageData->GetNumberOfCells(); ++cellId)\n  {\n    GetCellCenter(imageData, cellId, center);\n\n    std::cout << \"Cell \" << cellId << \" center: \" << center[0] << \" \"\n              << center[1] << \" \" << center[2] << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetCellCenter(vtkImageData* imageData, const unsigned int cellId,\n                   double center[3])\n{\n  double pcoords[3] = {0, 0, 0};\n  double* weights = new double[imageData->GetMaxCellSize()];\n  vtkCell* cell = imageData->GetCell(cellId);\n  int subId = cell->GetParametricCenter(pcoords);\n  cell->EvaluateLocation(subId, pcoords, center, weights);\n}\n\n} // namespace\n
        "},{"location":"Cxx/ImageData/GetCellCenter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetCellCenter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetCellCenter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetCellCenter MACOSX_BUNDLE GetCellCenter.cxx )\n  target_link_libraries(GetCellCenter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetCellCenter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/GetCellCenter/#download-and-build-getcellcenter","title":"Download and Build GetCellCenter","text":"

        Click here to download GetCellCenter and its CMakeLists.txt file. Once the tarball GetCellCenter.tar has been downloaded and extracted,

        cd GetCellCenter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GetCellCenter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/ImageDataGeometryFilter/","title":"ImageDataGeometryFilter","text":"

        vtk-examples/Cxx/ImageData/ImageDataGeometryFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageData/ImageDataGeometryFilter/#description","title":"Description","text":"

        Convert a vtkImageData to a vtkPolyData.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/ImageDataGeometryFilter/#code","title":"Code","text":"

        ImageDataGeometryFilter.cxx

        #include <vtkActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Convert our unsigned char colors to doubles\n  // Set draw color needs doubles.\n  auto color1 = colors->GetColor4ub(\"SteelBlue\").GetData();\n  auto color2 = colors->GetColor4ub(\"PaleGoldenrod\").GetData();\n  std::array<double, 4> sourceColor1{0, 0, 0, 0};\n  std::array<double, 4> sourceColor2{0, 0, 0, 0};\n  for (auto i = 0; i < 4; ++i)\n  {\n    sourceColor1[i] = color1[i];\n    sourceColor2[i] = color2[i];\n  }\n\n  // Create an image\n  vtkNew<vtkImageCanvasSource2D> source1;\n  source1->SetScalarTypeToUnsignedChar();\n  source1->SetNumberOfScalarComponents(3);\n  source1->SetExtent(0, 100, 0, 100, 0, 0);\n  source1->SetDrawColor(sourceColor1.data());\n  source1->FillBox(0, 100, 0, 100);\n  source1->SetDrawColor(sourceColor2.data());\n  source1->FillBox(10, 20, 10, 20);\n  source1->FillBox(40, 50, 20, 30);\n  source1->Update();\n\n  // Convert the image to a polydata\n  vtkNew<vtkImageDataGeometryFilter> imageDataGeometryFilter;\n  imageDataGeometryFilter->SetInputConnection(source1->GetOutputPort());\n  imageDataGeometryFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(imageDataGeometryFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Visualization\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"RosyBrown\").GetData());\n\n  renderWindow->SetWindowName(\"ImageDataGeometryFilter\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageData/ImageDataGeometryFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDataGeometryFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  FiltersSources\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDataGeometryFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDataGeometryFilter MACOSX_BUNDLE ImageDataGeometryFilter.cxx )\n  target_link_libraries(ImageDataGeometryFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDataGeometryFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/ImageDataGeometryFilter/#download-and-build-imagedatageometryfilter","title":"Download and Build ImageDataGeometryFilter","text":"

        Click here to download ImageDataGeometryFilter and its CMakeLists.txt file. Once the tarball ImageDataGeometryFilter.tar has been downloaded and extracted,

        cd ImageDataGeometryFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageDataGeometryFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/ImageDataToPointSet/","title":"ImageDataToPointSet","text":"

        vtk-examples/Cxx/ImageData/ImageDataToPointSet

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/ImageDataToPointSet/#code","title":"Code","text":"

        ImageDataToPointSet.cxx

        #include <vtkImageData.h>\n#include <vtkImageDataToPointSet.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkXMLStructuredGridWriter.h>\n\nnamespace {\n\nvoid CreateImage(vtkImageData* image);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkImageData> image;\n  CreateImage(image);\n\n  vtkNew<vtkImageDataToPointSet> imageDataToPointSet;\n  imageDataToPointSet->SetInputData(image);\n  imageDataToPointSet->Update();\n\n  vtkNew<vtkXMLStructuredGridWriter> writer;\n  writer->SetInputConnection(imageDataToPointSet->GetOutputPort());\n  writer->SetFileName(\"Test.vts\");\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateImage(vtkImageData* image)\n{\n  // Create an image\n  image->SetDimensions(3, 3, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  int dims[3];\n  image->GetDimensions(dims);\n  for (int i = 0; i < dims[0]; i++)\n  {\n    for (int j = 0; j < dims[1]; j++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(i, j, 0));\n      pixel[0] = 1;\n    }\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/ImageData/ImageDataToPointSet/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDataToPointSet)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDataToPointSet: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDataToPointSet MACOSX_BUNDLE ImageDataToPointSet.cxx )\n  target_link_libraries(ImageDataToPointSet PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDataToPointSet\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/ImageDataToPointSet/#download-and-build-imagedatatopointset","title":"Download and Build ImageDataToPointSet","text":"

        Click here to download ImageDataToPointSet and its CMakeLists.txt file. Once the tarball ImageDataToPointSet.tar has been downloaded and extracted,

        cd ImageDataToPointSet/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageDataToPointSet\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/ImageIterator/","title":"ImageIterator","text":"

        vtk-examples/Cxx/ImageData/ImageIterator

        "},{"location":"Cxx/ImageData/ImageIterator/#description","title":"Description","text":"

        Extracts an extent from an image using an image iterator.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/ImageIterator/#code","title":"Code","text":"

        ImageIterator.cxx

        #include <vtkImageData.h>\n#include <vtkImageIterator.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(10, 20, 30);\n  imageData->AllocateScalars(VTK_DOUBLE, 3);\n\n  // Fill every entry of the image data with x,y,z\n  int* dims = imageData->GetDimensions();\n  double* ptr = static_cast<double*>(imageData->GetScalarPointer(0, 0, 0));\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        *ptr++ = z;\n        *ptr++ = y;\n        *ptr++ = x;\n      }\n    }\n  }\n\n  // Define the extent to be extracted\n  int extent[6];\n  extent[0] = 2;\n  extent[1] = 5;\n  extent[2] = 2;\n  extent[3] = 5;\n  extent[4] = 15;\n  extent[5] = 15;\n\n  // Retrieve the entries from the image data and print them to the screen\n  vtkImageIterator<double> it(imageData, extent);\n  while (!it.IsAtEnd())\n  {\n    double* valIt = it.BeginSpan();\n    double* valEnd = it.EndSpan();\n    while (valIt != valEnd)\n    {\n      // Increment for each component\n      double x = *valIt++;\n      double y = *valIt++;\n      double z = *valIt++;\n      std::cout << \"(\" << x << \",\" << y << \",\" << z << \") \";\n    }\n    std::cout << std::endl;\n    it.NextSpan();\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageData/ImageIterator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageIterator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageIterator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageIterator MACOSX_BUNDLE ImageIterator.cxx )\n  target_link_libraries(ImageIterator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageIterator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/ImageIterator/#download-and-build-imageiterator","title":"Download and Build ImageIterator","text":"

        Click here to download ImageIterator and its CMakeLists.txt file. Once the tarball ImageIterator.tar has been downloaded and extracted,

        cd ImageIterator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageIterator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/ImageIteratorDemo/","title":"ImageIteratorDemo","text":"

        vtk-examples/Cxx/ImageData/ImageIteratorDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageData/ImageIteratorDemo/#description","title":"Description","text":"

        vtkImageIterator is an efficient way to access the regions of a vtkImageData. A span in the vrkImageData is a continuous segment of pixels. The NextSpan() method increments the iterator to the next continuous segment.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/ImageIteratorDemo/#code","title":"Code","text":"

        ImageIteratorDemo.cxx

        #include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageIterator.h>\n#include <vtkImageViewer2.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(100, 200, 30);\n  imageData->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  // Fill every entry of the image data with a color\n  int* dims = imageData->GetDimensions();\n\n  unsigned char* ptr =\n      static_cast<unsigned char*>(imageData->GetScalarPointer(0, 0, 0));\n  unsigned char r, g, b, a;\n  colors->GetColor(\"Banana\", r, g, b, a);\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        *ptr++ = r;\n        *ptr++ = g;\n        *ptr++ = b;\n      }\n    }\n  }\n\n  // Define the extent to be modified\n  int extent[6];\n  extent[0] = 20;\n  extent[1] = 50;\n  extent[2] = 30;\n  extent[3] = 60;\n  extent[4] = 10;\n  extent[5] = 20;\n\n  // Set the entries in the region to another color\n  colors->GetColor(\"Tomato\", r, g, b, a);\n  vtkImageIterator<unsigned char> it(imageData, extent);\n  unsigned int counter = 0;\n  while (!it.IsAtEnd())\n  {\n    unsigned char* valIt = it.BeginSpan();\n    unsigned char* valEnd = it.EndSpan();\n    while (valIt != valEnd)\n    {\n      // Increment for each component\n      *valIt++ = r;\n      *valIt++ = g;\n      *valIt++ = b;\n    }\n    it.NextSpan();\n    ++counter;\n  }\n  std::cout << \"# of spans: \" << counter << std::endl;\n\n  std::cout << \"Increments: \" << imageData->GetIncrements()[0] << \", \"\n            << imageData->GetIncrements()[1] << \", \"\n            << imageData->GetIncrements()[2] << std::endl;\n  vtkIdType incX, incY, incZ;\n  imageData->GetContinuousIncrements(extent, incX, incY, incZ);\n  std::cout << \"ContinuousIncrements: \" << incX << \", \" << incY << \", \" << incZ\n            << std::endl;\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputData(imageData);\n\n  vtkNew<vtkInteractorStyleImage> style;\n  style->SetInteractionModeToImageSlicing();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetInteractorStyle(style);\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->SetSlice((extent[5] - extent[4]) / 2 + extent[4]);\n\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Slate_grey\").GetData());\n  imageViewer->GetImageActor()->InterpolateOff();\n\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderWindow()->SetWindowName(\"ImageIteratorDemo\");\n\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageData/ImageIteratorDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageIteratorDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageIteratorDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageIteratorDemo MACOSX_BUNDLE ImageIteratorDemo.cxx )\n  target_link_libraries(ImageIteratorDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageIteratorDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/ImageIteratorDemo/#download-and-build-imageiteratordemo","title":"Download and Build ImageIteratorDemo","text":"

        Click here to download ImageIteratorDemo and its CMakeLists.txt file. Once the tarball ImageIteratorDemo.tar has been downloaded and extracted,

        cd ImageIteratorDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageIteratorDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/ImageNormalize/","title":"ImageNormalize","text":"

        vtk-examples/Cxx/ImageData/ImageNormalize

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/ImageNormalize/#code","title":"Code","text":"

        ImageNormalize.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageNormalize.h>\n#include <vtkImageSinusoidSource.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageSinusoidSource> source;\n  source->Update();\n\n  vtkNew<vtkImageNormalize> normalizeFilter;\n\n  normalizeFilter->SetInputConnection(source->GetOutputPort());\n  normalizeFilter->Update();\n\n  vtkNew<vtkImageCast> inputCastFilter;\n  inputCastFilter->SetInputConnection(source->GetOutputPort());\n  inputCastFilter->SetOutputScalarTypeToUnsignedChar();\n  inputCastFilter->Update();\n\n  vtkNew<vtkImageCast> normalizeCastFilter;\n  normalizeCastFilter->SetInputConnection(normalizeFilter->GetOutputPort());\n  normalizeCastFilter->SetOutputScalarTypeToUnsignedChar();\n  normalizeCastFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(inputCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> normalizedActor;\n  normalizedActor->GetMapper()->SetInputConnection(\n      normalizeCastFilter->GetOutputPort());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(normalizedActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->ResetCamera();\n\n  renderWindow->SetWindowName(\"ImageNormalize\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageData/ImageNormalize/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageNormalize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageNormalize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageNormalize MACOSX_BUNDLE ImageNormalize.cxx )\n  target_link_libraries(ImageNormalize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageNormalize\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/ImageNormalize/#download-and-build-imagenormalize","title":"Download and Build ImageNormalize","text":"

        Click here to download ImageNormalize and its CMakeLists.txt file. Once the tarball ImageNormalize.tar has been downloaded and extracted,

        cd ImageNormalize/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageNormalize\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/ImageReslice/","title":"ImageReslice","text":"

        vtk-examples/Cxx/ImageData/ImageReslice

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/ImageReslice/#code","title":"Code","text":"

        ImageReslice.cxx

        #include <vtkImageData.h>\n#include <vtkImageReslice.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkImageData> image;\n  image->SetExtent(0, 9, 0, 9, 0, 0);\n  image->AllocateScalars(VTK_INT, 1);\n\n  int* pixel = static_cast<int*>(image->GetScalarPointer(0, 9, 0));\n  std::cout << \"pixel: \" << *pixel << std::endl;\n\n  vtkNew<vtkImageReslice> reslice;\n  reslice->SetOutputExtent(0, 9, 0, 100, 0, 0);\n  reslice->SetInputData(image);\n  reslice->Update();\n\n  int* pixel2 =\n      static_cast<int*>(reslice->GetOutput()->GetScalarPointer(0, 11, 0));\n  std::cout << \"pixel2: \" << *pixel2 << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageData/ImageReslice/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageReslice)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageReslice: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageReslice MACOSX_BUNDLE ImageReslice.cxx )\n  target_link_libraries(ImageReslice PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageReslice\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/ImageReslice/#download-and-build-imagereslice","title":"Download and Build ImageReslice","text":"

        Click here to download ImageReslice and its CMakeLists.txt file. Once the tarball ImageReslice.tar has been downloaded and extracted,

        cd ImageReslice/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageReslice\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/ImageTranslateExtent/","title":"ImageTranslateExtent","text":"

        vtk-examples/Cxx/ImageData/ImageTranslateExtent

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageData/ImageTranslateExtent/#description","title":"Description","text":"

        If you are looking to change the extent to change the \"origin\" of the image from the corner to the center, see vtkImageChangeInformation in CenterAnImage.

        Currently this method changes the extent (shown by the terminal output in the example), but does not change where the corner of the image is displayed relative to the sphere at (0,0,0).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/ImageTranslateExtent/#code","title":"Code","text":"

        ImageTranslateExtent.cxx

        #include <vtkActor.h>\n#include <vtkImageData.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkImageTranslateExtent.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid CreateColorImage(vtkImageData* const);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> colorImage;\n  CreateColorImage(\n      colorImage); // This image has (0,0) at the bottom left corner\n\n  int extent[6];\n  colorImage->GetExtent(extent);\n  std::cout << \"Old extent: \" << extent[0] << \" \" << extent[1] << \" \"\n            << extent[2] << \" \" << extent[3] << \" \" << extent[4] << \" \"\n            << extent[5] << std::endl;\n\n  // This moves the (0,0) position in the image to the center of the image\n  // colorImage->SetExtent(extent[0] - (extent[1] - extent[0]) / 2,\n  //                      extent[0] + (extent[1] - extent[0]) / 2,\n  //                      extent[2] - (extent[3] - extent[2]) / 2,\n  //                      extent[2] + (extent[3] - extent[2]) / 2,\n  //                      extent[4] - (extent[5] - extent[4]) / 2,\n  //                      extent[4] + (extent[5] - extent[4]) / 2);\n\n  int dimensions[3];\n  colorImage->GetDimensions(dimensions);\n\n  vtkNew<vtkImageTranslateExtent> translateExtent;\n  translateExtent->SetTranslation(-dimensions[0] / 2, -dimensions[1] / 2, 0);\n  translateExtent->SetInputData(colorImage);\n  translateExtent->Update();\n  colorImage->DeepCopy(translateExtent->GetOutput());\n\n  colorImage->GetExtent(extent);\n  std::cout << \"New extent: \" << extent[0] << \" \" << extent[1] << \" \"\n            << extent[2] << \" \" << extent[3] << \" \" << extent[4] << \" \"\n            << extent[5] << std::endl;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"PeachPuff\").GetData());\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper;\n  imageSliceMapper->SetInputData(colorImage);\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageSliceMapper);\n  imageSlice->SetPosition(0, 0, 0);\n\n  // Setup renderers\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->AddViewProp(sphereActor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(renderer);\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindow->SetWindowName(\"ImageTranslateExtent\");\n\n  renderWindow->Render();\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData* const image)\n{\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  vtkNew<vtkNamedColors> colors;\n  unsigned char r, g, b, a;\n  colors->GetColor(\"Thistle\", r, g, b, a);\n\n  for (unsigned int x = 0; x < 10; x++)\n  {\n    for (unsigned int y = 0; y < 10; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = r;\n      pixel[1] = g;\n      pixel[2] = b;\n    }\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/ImageData/ImageTranslateExtent/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageTranslateExtent)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageTranslateExtent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageTranslateExtent MACOSX_BUNDLE ImageTranslateExtent.cxx )\n  target_link_libraries(ImageTranslateExtent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageTranslateExtent\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/ImageTranslateExtent/#download-and-build-imagetranslateextent","title":"Download and Build ImageTranslateExtent","text":"

        Click here to download ImageTranslateExtent and its CMakeLists.txt file. Once the tarball ImageTranslateExtent.tar has been downloaded and extracted,

        cd ImageTranslateExtent/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageTranslateExtent\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/ImageWeightedSum/","title":"ImageWeightedSum","text":"

        vtk-examples/Cxx/ImageData/ImageWeightedSum

        "},{"location":"Cxx/ImageData/ImageWeightedSum/#description","title":"Description","text":"

        Sum multiple images. Images must be of the same size and type.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/ImageWeightedSum/#code","title":"Code","text":"

        ImageWeightedSum.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageSinusoidSource.h>\n#include <vtkImageWeightedSum.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // create an image\n  vtkNew<vtkImageMandelbrotSource> source1;\n  source1->SetWholeExtent(0, 255, 0, 255, 0, 0);\n  source1->Update();\n\n  vtkNew<vtkImageCast> source1Double;\n  source1Double->SetInputConnection(0, source1->GetOutputPort());\n  source1Double->SetOutputScalarTypeToDouble();\n\n  vtkNew<vtkImageSinusoidSource> source2;\n  source2->SetWholeExtent(0, 255, 0, 255, 0, 0);\n  source2->Update();\n\n  vtkNew<vtkImageWeightedSum> sumFilter;\n  sumFilter->SetWeight(0, .8);\n  sumFilter->SetWeight(1, .2);\n  sumFilter->AddInputConnection(source1Double->GetOutputPort());\n  sumFilter->AddInputConnection(source2->GetOutputPort());\n\n  sumFilter->Update();\n\n  vtkNew<vtkImageCast> source1CastFilter;\n  source1CastFilter->SetInputConnection(source1->GetOutputPort());\n  source1CastFilter->SetOutputScalarTypeToUnsignedChar();\n  source1CastFilter->Update();\n\n  vtkNew<vtkImageCast> source2CastFilter;\n  source2CastFilter->SetInputConnection(source2->GetOutputPort());\n  source2CastFilter->SetOutputScalarTypeToUnsignedChar();\n  source2CastFilter->Update();\n\n  vtkNew<vtkImageCast> summedCastFilter;\n  summedCastFilter->SetInputConnection(sumFilter->GetOutputPort());\n  summedCastFilter->SetOutputScalarTypeToUnsignedChar();\n  summedCastFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> source1Actor;\n  source1Actor->GetMapper()->SetInputConnection(\n      source1CastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> source2Actor;\n  source2Actor->GetMapper()->SetInputConnection(\n      source2CastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> summedActor;\n  summedActor->GetMapper()->SetInputConnection(\n      summedCastFilter->GetOutputPort());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, .66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"DarkTurquoise\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  leftRenderer->AddActor(source1Actor);\n  centerRenderer->AddActor(source2Actor);\n  rightRenderer->AddActor(summedActor);\n\n  leftRenderer->ResetCamera();\n  centerRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  renderWindow->SetWindowName(\"ImageWeightedSum\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageData/ImageWeightedSum/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageWeightedSum)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageWeightedSum: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageWeightedSum MACOSX_BUNDLE ImageWeightedSum.cxx )\n  target_link_libraries(ImageWeightedSum PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageWeightedSum\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/ImageWeightedSum/#download-and-build-imageweightedsum","title":"Download and Build ImageWeightedSum","text":"

        Click here to download ImageWeightedSum and its CMakeLists.txt file. Once the tarball ImageWeightedSum.tar has been downloaded and extracted,

        cd ImageWeightedSum/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageWeightedSum\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/IntersectLine/","title":"IntersectLine","text":"

        vtk-examples/Cxx/ImageData/IntersectLine

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageData/IntersectLine/#description","title":"Description","text":"

        This example demonstrates a (rather manual) way of finding which cells of a vtkImageData a finite line intersects. Note that this is not exact - a cell-centric approach is used. That is, a discrete line (DDA-like http://en.wikipedia.org/wiki/Digital_differential_analyzer_%28graphics_algorithm%29) is followed on the cell grid between the cells that contain the intersection points of the line with the bounding box of the image. These are all not necessarily the exact same cells as the line actually intersects, but it gives a reasonable \"path\" of cells through the image which might be suitable for some applications.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/IntersectLine/#code","title":"Code","text":"

        IntersectLine.cxx

        #include <vtkActor.h>\n#include <vtkBox.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkDataSetMapper.h>\n#include <vtkIdList.h>\n#include <vtkImageData.h>\n#include <vtkIntArray.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkThreshold.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <algorithm>\n#include <cmath>\n\nnamespace {\nvtkIdType FindCell(vtkImageData* grid, double point[3]);\n\nstd::vector<vtkIdType> IntersectImage(vtkImageData* image, double p0[3],\n                                      double p1[3]);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a 3x4x5 grid of points (60), which will define a 2x3x4\n  // (24) grid of cubes\n  vtkNew<vtkImageData> grid;\n\n  // Create the grid data structure\n  grid->SetDimensions(3, 4, 5);\n\n  std::cout << \"There are \" << grid->GetNumberOfPoints()\n            << \" points before shrinking.\" << std::endl;\n  std::cout << \"There are \" << grid->GetNumberOfCells()\n            << \" cells before shrinking.\" << std::endl;\n\n  // Define a ray\n  double rayOrigin[3] = {-5.0, 0, 0};\n  double rayDirection[3] = {1.0, 0, 0};\n  double rayEndPoint[3];\n  for (size_t i = 0; i < 3; ++i)\n  {\n    rayEndPoint[i] = rayOrigin[i] +\n        rayDirection[i] *\n            1000; // 1000 is an arbitrary constant that should be much larger\n                  // than the size of the scene (to create an \"infinite\" ray)\n  }\n  std::vector<vtkIdType> intersectedCells =\n      IntersectImage(grid, rayOrigin, rayEndPoint);\n\n  vtkNew<vtkShrinkFilter> shrinkFilter;\n  shrinkFilter->SetInputData(grid);\n  shrinkFilter->SetShrinkFactor(.8);\n  shrinkFilter->Update();\n\n  // Setup visibility array. Cells with visibility > 1 will be\n  // visible, and < 1 will be invisible.\n  vtkNew<vtkIntArray> visibilityArray;\n  visibilityArray->SetNumberOfComponents(1);\n  visibilityArray->SetName(\"Visibility\");\n\n  // Initially, set all cells to visible\n  for (vtkIdType cellId = 0;\n       cellId < shrinkFilter->GetOutput()->GetNumberOfCells(); ++cellId)\n  {\n    visibilityArray->InsertNextValue(10);\n  }\n\n  // Set the intersected cells to invisible\n  for (size_t i = 0; i < intersectedCells.size(); ++i)\n  {\n    visibilityArray->SetTuple1(intersectedCells[i], 0);\n  }\n\n  shrinkFilter->GetOutput()->GetCellData()->AddArray(visibilityArray);\n\n  // Threshold\n  vtkNew<vtkThreshold> threshold;\n  threshold->SetInputData(shrinkFilter->GetOutput());\n  // Criterion is cells whose scalars are greater or equal to threshold.\n  threshold->SetUpperThreshold(1);\n  threshold->SetThresholdFunction(vtkThreshold::THRESHOLD_UPPER);\n\n  threshold->SetInputArrayToProcess(\n      0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, \"Visibility\");\n  threshold->Update();\n\n  vtkUnstructuredGrid* thresholdedPolydata = threshold->GetOutput();\n  std::cout << \"There are \" << thresholdedPolydata->GetNumberOfCells()\n            << \" cells after thresholding.\" << std::endl;\n\n  /////////// Standard visualization setup //////////////\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(threshold->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetMultiSamples(0);\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderer->GetActiveCamera()->SetPosition(-6, 7, 6);\n  renderer->GetActiveCamera()->SetFocalPoint(1, 1.5, 2);\n  renderer->GetActiveCamera()->SetViewUp(0.4, 8, -0.4);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"IntersectLine\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkIdType FindCell(vtkImageData* grid, double point[3])\n{\n  double pcoords[3];\n  double weights[8];\n\n  int subId;\n\n  // The third parameter is an \"initial guess\" of the cellId\n  vtkIdType cellId =\n      grid->FindCell(point, NULL, 0, .1, subId, pcoords, weights);\n  return cellId;\n}\n\n// Intersect a finite line (with end points p0 and p1) with all of the\n// cells of a vtkImageData\nstd::vector<vtkIdType> IntersectImage(vtkImageData* image, double p0[3],\n                                      double p1[3])\n{\n  // Intersect a ray with the bounding box of the grid. There should\n  // be two points (an entrance and an exit)\n\n  // Define a box\n  double bounds[6];\n  image->GetBounds(bounds);\n\n  // The two points of intersection of the bounding box with the line\n  // will be stored here\n  double entrancePoint[3];\n  double exitPoint[3];\n\n  // We do not need the results stored in these variables, but they\n  // are required for the function call.\n  int entryPlane[6]{0, 0, 0, 0, 0, 0};\n  int exitPlane[6]{0, 0, 0, 0, 0, 0};\n\n  double t0,\n      t1; // the [0,1] normalized distances to the intersections along the ray\n\n  int hit = vtkBox::IntersectWithLine(bounds, p0, p1, t0, t1, entrancePoint,\n                                      exitPoint, *entryPlane, *exitPlane);\n\n  std::vector<vtkIdType> intersectedCells;\n\n  if (!hit)\n  {\n    std::cout << \"Not hit!\" << std::endl;\n    return intersectedCells;\n  }\n  else\n  {\n    std::cout << \"Entry point: \" << entrancePoint[0] << \" \" << entrancePoint[1]\n              << \" \" << entrancePoint[2] << std::endl;\n    std::cout << \"Exit point: \" << exitPoint[0] << \" \" << exitPoint[1] << \" \"\n              << exitPoint[2] << std::endl;\n  }\n\n  // This simple algorithm was adapted from\n  // http://www.cb.uu.se/~cris/blog/index.php/archives/400\n\n  int dim[3];\n  image->GetDimensions(dim);\n\n  // Make sure to include the first cell that the line hits\n  vtkIdType startCellId = FindCell(image, entrancePoint);\n  intersectedCells.push_back(startCellId);\n\n  double p[3];\n  p[0] = entrancePoint[0];\n  p[1] = entrancePoint[1];\n  p[2] = entrancePoint[2];\n\n  double d[3];\n  d[0] = exitPoint[0] - entrancePoint[0];\n  d[1] = exitPoint[1] - entrancePoint[1];\n  d[2] = exitPoint[2] - entrancePoint[2];\n\n  double N = std::max(std::max(std::abs(d[0]), std::abs(d[1])), std::abs(d[2]));\n\n  double s[3];\n  s[0] = d[0] / N;\n  s[1] = d[1] / N;\n  s[2] = d[2] / N;\n\n  for (size_t i = 0; i < N; ++i)\n  {\n    int ijk[3];\n    ijk[0] = vtkMath::Round(p[0]);\n    ijk[1] = vtkMath::Round(p[1]);\n    ijk[2] = vtkMath::Round(p[2]);\n\n    for (unsigned int index = 0; index < 3; ++index)\n    {\n      if (ijk[index] > dim[index] - 2)\n      {\n        ijk[index] = dim[index] - 2;\n      }\n    }\n\n    vtkIdType cellId = vtkStructuredData::ComputeCellId(dim, ijk);\n    intersectedCells.push_back(cellId);\n    p[0] += s[0];\n    p[1] += s[1];\n    p[2] += s[2];\n  }\n\n  // Make sure to include the last cell that the line hits\n  vtkIdType endCellId = FindCell(image, exitPoint);\n  intersectedCells.push_back(endCellId);\n\n  return intersectedCells;\n}\n\n} // namespace\n
        "},{"location":"Cxx/ImageData/IntersectLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IntersectLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IntersectLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IntersectLine MACOSX_BUNDLE IntersectLine.cxx )\n  target_link_libraries(IntersectLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IntersectLine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/IntersectLine/#download-and-build-intersectline","title":"Download and Build IntersectLine","text":"

        Click here to download IntersectLine and its CMakeLists.txt file. Once the tarball IntersectLine.tar has been downloaded and extracted,

        cd IntersectLine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IntersectLine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/IterateImageData/","title":"IterateImageData","text":"

        vtk-examples/Cxx/ImageData/IterateImageData

        "},{"location":"Cxx/ImageData/IterateImageData/#description","title":"Description","text":"

        This example demonstrates how to set and access locations in a 3D image.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/IterateImageData/#code","title":"Code","text":"

        IterateImageData.cxx

        #include <vtkImageData.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n\nint main(int, char*[])\n{\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(2, 3, 1);\n  imageData->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = imageData->GetDimensions();\n  // int dims[3]; // can't do this\n\n  std::cout << \"Dims: \"\n            << \" x: \" << dims[0] << \" y: \" << dims[1] << \" z: \" << dims[2]\n            << std::endl;\n\n  std::cout << \"Number of points: \" << imageData->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Number of cells: \" << imageData->GetNumberOfCells()\n            << std::endl;\n\n  // Fill every entry of the image data with \"2.0\"\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel =\n            static_cast<double*>(imageData->GetScalarPointer(x, y, z));\n        pixel[0] = 2.0;\n      }\n    }\n  }\n\n  // Retrieve the entries from the image data and print them to the screen\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel =\n            static_cast<double*>(imageData->GetScalarPointer(x, y, z));\n        // do something with v\n        std::cout << pixel[0] << \" \";\n      }\n      std::cout << std::endl;\n    }\n    std::cout << std::endl;\n  }\n\n  // Access the data linearly\n\n  vtkNew<vtkImageData> image;\n  image->SetExtent(0, 1, 0, 1, 0, 0);\n  image->AllocateScalars(VTK_INT, 1);\n\n  int* pixel;\n\n  pixel = static_cast<int*>(image->GetScalarPointer(0, 0, 0));\n  pixel[0] = 1;\n\n  pixel = static_cast<int*>(image->GetScalarPointer(1, 0, 0));\n  pixel[0] = 2;\n\n  pixel = static_cast<int*>(image->GetScalarPointer(0, 1, 0));\n  pixel[0] = 3;\n\n  pixel = static_cast<int*>(image->GetScalarPointer(1, 1, 0));\n  pixel[0] = 4;\n\n  vtkIntArray* scalars = dynamic_cast<vtkIntArray*>(\n      image->GetPointData()->GetArray(\"ImageScalars\"));\n  std::cout << \"Scalars has \" << scalars->GetNumberOfComponents()\n            << \"components \" << std::endl;\n  std::cout << \" Scalars has \" << scalars->GetNumberOfTuples() << \" tuples\"\n            << std::endl;\n\n  for (vtkIdType i = 0; i < scalars->GetNumberOfTuples(); i++)\n  {\n    std::cout << scalars->GetValue(i) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageData/IterateImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IterateImageData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IterateImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IterateImageData MACOSX_BUNDLE IterateImageData.cxx )\n  target_link_libraries(IterateImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IterateImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/IterateImageData/#download-and-build-iterateimagedata","title":"Download and Build IterateImageData","text":"

        Click here to download IterateImageData and its CMakeLists.txt file. Once the tarball IterateImageData.tar has been downloaded and extracted,

        cd IterateImageData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IterateImageData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageData/VoxelsOnBoundary/","title":"VoxelsOnBoundary","text":"

        vtk-examples/Cxx/ImageData/VoxelsOnBoundary

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageData/VoxelsOnBoundary/#description","title":"Description","text":"

        This example uses vtkMultiThreshold to extract voxels that are inside an isosurface and on the boundary of the isosurface. The result is a vtkUnstructuredGrid for each set of voxels. Before processing, vtkImageShrink3D reduces the resolution by a factor of 4.

        Compare these results with

        usage

        VoxelsOnBoundary FullHead.mhd

        Info

        Compare these results with MedicalDemo1 that extracts the surface using vtkMarchingCubes to extract an interpolated isosurface.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageData/VoxelsOnBoundary/#code","title":"Code","text":"

        VoxelsOnBoundary.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageDataToPointSet.h>\n#include <vtkImageShrink3D.h>\n#include <vtkMetaImageReader.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiThreshold.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <iostream>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageShrink3D> shrink;\n  shrink->SetShrinkFactors(4, 4, 4);\n  shrink->SetInputConnection(reader->GetOutputPort());\n  shrink->Update();\n\n  // Create a PointSet from the ImageData\n  vtkNew<vtkImageDataToPointSet> imageDataToPointSet;\n  imageDataToPointSet->SetInputConnection(reader->GetOutputPort());\n  imageDataToPointSet->SetInputConnection(shrink->GetOutputPort());\n  imageDataToPointSet->Update();\n\n  // Extract voxels on the border between the inside and outside.\n  vtkNew<vtkMultiThreshold> threshold;\n  // Inside points have one or more points above the isosurface\n  int insideId = threshold->AddIntervalSet(\n      501, 20000, vtkMultiThreshold::CLOSED, vtkMultiThreshold::CLOSED,\n      vtkDataObject::FIELD_ASSOCIATION_POINTS, \"ImageScalars\", 0, 0);\n  // Border points have points that straddle the boundary\n  int borderId = threshold->AddIntervalSet(\n      499.9999, 501.0000, vtkMultiThreshold::OPEN, vtkMultiThreshold::OPEN,\n      vtkDataObject::FIELD_ASSOCIATION_POINTS, \"ImageScalars\", 0, 0);\n\n  threshold->SetInputData(imageDataToPointSet->GetOutput());\n\n  // Select the intervals to be output\n  threshold->OutputSet(insideId);\n  threshold->OutputSet(borderId);\n  threshold->Update();\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n  // vtkColor3d outsideColor    = colors->GetColor3d(\"Crimson\");\n  vtkColor3d insideColor = colors->GetColor3d(\"Banana\");\n  vtkColor3d borderColor = colors->GetColor3d(\"Mint\");\n  // vtkColor3d surfaceColor    = colors->GetColor3d(\"Peacock\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Silver\");\n\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(dynamic_cast<vtkUnstructuredGrid*>(\n                       vtkMultiBlockDataSet::SafeDownCast(\n                           threshold->GetOutput()->GetBlock(insideId))\n                           ->GetBlock(0))\n                       ->GetCenter());\n  plane->SetNormal(1.0, -1.0, -1.0);\n\n  // Inside\n  vtkNew<vtkDataSetMapper> insideMapper;\n  insideMapper->SetInputData(dynamic_cast<vtkUnstructuredGrid*>(\n      vtkMultiBlockDataSet::SafeDownCast(\n          threshold->GetOutput()->GetBlock(insideId))\n          ->GetBlock(0)));\n  insideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> insideActor;\n  insideActor->SetMapper(insideMapper);\n  insideActor->GetProperty()->SetDiffuseColor(insideColor.GetData());\n  insideActor->GetProperty()->SetSpecular(.6);\n  insideActor->GetProperty()->SetSpecularPower(30);\n  insideActor->GetProperty()->EdgeVisibilityOn();\n\n  // Border\n  vtkNew<vtkDataSetMapper> borderMapper;\n  borderMapper->SetInputData(dynamic_cast<vtkUnstructuredGrid*>(\n      vtkMultiBlockDataSet::SafeDownCast(\n          threshold->GetOutput()->GetBlock(borderId))\n          ->GetBlock(0)));\n  borderMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> borderActor;\n  borderActor->SetMapper(borderMapper);\n  borderActor->GetProperty()->SetDiffuseColor(borderColor.GetData());\n  borderActor->GetProperty()->SetSpecular(.6);\n  borderActor->GetProperty()->SetSpecularPower(30);\n  borderActor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  renderer->AddActor(insideActor);\n  renderer->AddActor(borderActor);\n\n  renderWindow->SetWindowName(\"CellsOnBoundary\");\n  renderWindow->Render();\n\n  // Setup a good view\n  renderer->GetActiveCamera()->SetViewUp(0, 0, -1);\n  renderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Elevation(30.0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.5);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageData/VoxelsOnBoundary/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VoxelsOnBoundary)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VoxelsOnBoundary: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VoxelsOnBoundary MACOSX_BUNDLE VoxelsOnBoundary.cxx )\n  target_link_libraries(VoxelsOnBoundary PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VoxelsOnBoundary\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageData/VoxelsOnBoundary/#download-and-build-voxelsonboundary","title":"Download and Build VoxelsOnBoundary","text":"

        Click here to download VoxelsOnBoundary and its CMakeLists.txt file. Once the tarball VoxelsOnBoundary.tar has been downloaded and extracted,

        cd VoxelsOnBoundary/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VoxelsOnBoundary\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/Attenuation/","title":"Attenuation","text":"

        vtk-examples/Cxx/ImageProcessing/Attenuation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageProcessing/Attenuation/#description","title":"Description","text":"

        This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. This histograms shows how the artifact hides information in the form of scalar value clusters.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/Attenuation/#code","title":"Code","text":"

        Attenuation.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageShiftScale.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\nint main(int argc, char* argv[])\n{\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" Filename e.g. AttenuationArtifact.pgm\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToDouble();\n\n  // Get rid of discrete scalars.\n  vtkNew<vtkImageGaussianSmooth> smooth;\n  smooth->SetInputConnection(cast->GetOutputPort());\n  smooth->SetStandardDeviations(0.8, 0.8, 0);\n\n  vtkNew<vtkSphere> m1;\n  m1->SetCenter(310, 130, 0);\n  m1->SetRadius(0);\n\n  vtkNew<vtkSampleFunction> m2;\n  m2->SetImplicitFunction(m1);\n  m2->SetModelBounds(0, 264, 0, 264, 0, 1);\n  m2->SetSampleDimensions(264, 264, 1);\n\n  vtkNew<vtkImageShiftScale> m3;\n  m3->SetInputConnection(m2->GetOutputPort());\n  m3->SetScale(0.000095);\n\n  vtkNew<vtkImageMathematics> div;\n  div->SetInputConnection(0, smooth->GetOutputPort());\n  div->SetInputConnection(1, m3->GetOutputPort());\n  div->SetOperationToMultiply();\n\n  // Create actors.\n  vtkNew<vtkNamedColors> colors;\n\n  double colorWindow = 256.0;\n  double colorLevel = 127.5;\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(cast->GetOutputPort());\n  originalActor->GetProperty()->SetColorWindow(colorWindow);\n  originalActor->GetProperty()->SetColorLevel(colorLevel);\n\n  vtkNew<vtkImageActor> filteredActor;\n  filteredActor->GetMapper()->SetInputConnection(div->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double filteredViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderer> filteredRenderer;\n  filteredRenderer->SetViewport(filteredViewport);\n  filteredRenderer->AddActor(filteredActor);\n  filteredRenderer->ResetCamera();\n  filteredRenderer->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(filteredRenderer);\n  renderWindow->SetWindowName(\"Attenuation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageProcessing/Attenuation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Attenuation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  ImagingHybrid\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Attenuation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Attenuation MACOSX_BUNDLE Attenuation.cxx )\n  target_link_libraries(Attenuation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Attenuation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/Attenuation/#download-and-build-attenuation","title":"Download and Build Attenuation","text":"

        Click here to download Attenuation and its CMakeLists.txt file. Once the tarball Attenuation.tar has been downloaded and extracted,

        cd Attenuation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Attenuation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/EnhanceEdges/","title":"EnhanceEdges","text":"

        vtk-examples/Cxx/ImageProcessing/EnhanceEdges

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageProcessing/EnhanceEdges/#description","title":"Description","text":"

        High-pass filters can also be used to compress the range of an image. Since low frequencies account for much of the dynamic range of an image but carry little information, a high-pass filter can significantly decrease an image\u2019s scalar range and emphasize hidden details. The Laplacian filter, which is a second derivative operation, is one implementation of a high-pass filter. It eliminates constant and low frequencies leaving only high-frequency edges. The output of the Laplacian can be subtracted from the original image to produce edge enhancement or sharpening of an image.

        This example subtracts the Laplacian (middle) from the original image (left) resulting in edge enhancement or a sharpening operation (right).

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/EnhanceEdges/#code","title":"Code","text":"

        EnhanceEdges.cxx

        #include <vtkCamera.h>\n#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageLaplacian.h>\n#include <vtkImageMapToWindowLevelColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. FullHead.mhd\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  int scalarRange[2];\n  scalarRange[0] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[0];\n  scalarRange[1] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[1];\n  std::cout << \"Range: \" << scalarRange[0] << \", \" << scalarRange[1]\n            << std::endl;\n  // int middleSlice = (reader->GetOutput()->GetExtent()[5] -\n  //                   reader->GetOutput()->GetExtent()[4]) /\n  //    2;\n\n  // Better to use this value.\n  auto middleSlice = 22;\n\n  // Work with triple images\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToDouble();\n  cast->Update();\n\n  vtkNew<vtkImageLaplacian> laplacian;\n  laplacian->SetInputConnection(cast->GetOutputPort());\n  laplacian->SetDimensionality(3);\n\n  vtkNew<vtkImageMathematics> enhance;\n  enhance->SetInputConnection(0, cast->GetOutputPort());\n  enhance->SetInputConnection(1, laplacian->GetOutputPort());\n  enhance->SetOperationToSubtract();\n\n  int colorWindow = (scalarRange[1] - scalarRange[0]);\n  int colorLevel = colorWindow / 2;\n\n  // Map the image through the lookup table.\n  vtkNew<vtkImageMapToWindowLevelColors> originalColor;\n  originalColor->SetWindow(colorWindow);\n  originalColor->SetLevel(colorLevel);\n  originalColor->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(\n      originalColor->GetOutputPort());\n  originalActor->GetProperty()->SetInterpolationTypeToNearest();\n  originalActor->SetDisplayExtent(\n      reader->GetDataExtent()[0], reader->GetDataExtent()[1],\n      reader->GetDataExtent()[2], reader->GetDataExtent()[3], middleSlice,\n      middleSlice);\n\n  vtkNew<vtkImageMapToWindowLevelColors> laplacianColor;\n  laplacianColor->SetWindow(1000);\n  laplacianColor->SetLevel(0);\n  laplacianColor->SetInputConnection(laplacian->GetOutputPort());\n\n  vtkNew<vtkImageActor> laplacianActor;\n  laplacianActor->GetMapper()->SetInputConnection(\n      laplacianColor->GetOutputPort());\n  laplacianActor->GetProperty()->SetInterpolationTypeToNearest();\n  laplacianActor->SetDisplayExtent(originalActor->GetDisplayExtent());\n\n  vtkNew<vtkImageMapToWindowLevelColors> enhancedColor;\n  enhancedColor->SetWindow(colorWindow);\n  enhancedColor->SetLevel(colorLevel);\n  enhancedColor->SetInputConnection(enhance->GetOutputPort());\n\n  vtkNew<vtkImageActor> enhancedActor;\n  enhancedActor->GetMapper()->SetInputConnection(\n      enhancedColor->GetOutputPort());\n  enhancedActor->GetProperty()->SetInterpolationTypeToNearest();\n  enhancedActor->SetDisplayExtent(originalActor->GetDisplayExtent());\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->AddActor(originalActor);\n  vtkNew<vtkRenderer> laplacianRenderer;\n  laplacianRenderer->AddActor(laplacianActor);\n  vtkNew<vtkRenderer> enhancedRenderer;\n  enhancedRenderer->AddActor(enhancedActor);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  renderers.push_back(originalRenderer);\n  renderers.push_back(laplacianRenderer);\n  renderers.push_back(enhancedRenderer);\n\n  // Setup viewports for the renderers.\n  int rendererSize = 400;\n  unsigned int xGridDimensions = 3;\n  unsigned int yGridDimensions = 1;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n      renderWindow->AddRenderer(renderers[index]);\n    }\n  }\n  renderWindow->SetWindowName(\"EnhanceEdges\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Renderers share one camera.\n  renderWindow->Render();\n  renderers[0]->GetActiveCamera()->Dolly(1.5);\n  renderers[0]->ResetCameraClippingRange();\n\n  for (size_t r = 1; r < renderers.size(); ++r)\n  {\n    renderers[r]->SetActiveCamera(renderers[0]->GetActiveCamera());\n  }\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageProcessing/EnhanceEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EnhanceEdges)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EnhanceEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EnhanceEdges MACOSX_BUNDLE EnhanceEdges.cxx )\n  target_link_libraries(EnhanceEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EnhanceEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/EnhanceEdges/#download-and-build-enhanceedges","title":"Download and Build EnhanceEdges","text":"

        Click here to download EnhanceEdges and its CMakeLists.txt file. Once the tarball EnhanceEdges.tar has been downloaded and extracted,

        cd EnhanceEdges/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./EnhanceEdges\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/GaussianSmooth/","title":"GaussianSmooth","text":"

        vtk-examples/Cxx/ImageProcessing/GaussianSmooth

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageProcessing/GaussianSmooth/#description","title":"Description","text":"

        Low-pass filters can be implemented as convolution with a Gaussian kernel. The Gaussian kernel displayed on top has been magnified for this figure.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/GaussianSmooth/#code","title":"Code","text":"

        GaussianSmooth.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Process the\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToFloat();\n\n  vtkNew<vtkImageGaussianSmooth> filter;\n  filter->SetDimensionality(2);\n  filter->SetInputConnection(cast->GetOutputPort());\n  filter->SetStandardDeviations(4.0, 4.0);\n  filter->SetRadiusFactors(2.0, 2.0);\n\n  // Create actors\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> filteredActor;\n  filteredActor->GetMapper()->SetInputConnection(filter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double filteredViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderer> filteredRenderer;\n  filteredRenderer->SetViewport(filteredViewport);\n  filteredRenderer->AddActor(filteredActor);\n  filteredRenderer->ResetCamera();\n  filteredRenderer->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"GaussianSmooth\");\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(filteredRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageProcessing/GaussianSmooth/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GaussianSmooth)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GaussianSmooth: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GaussianSmooth MACOSX_BUNDLE GaussianSmooth.cxx )\n  target_link_libraries(GaussianSmooth PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GaussianSmooth\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/GaussianSmooth/#download-and-build-gaussiansmooth","title":"Download and Build GaussianSmooth","text":"

        Click here to download GaussianSmooth and its CMakeLists.txt file. Once the tarball GaussianSmooth.tar has been downloaded and extracted,

        cd GaussianSmooth/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GaussianSmooth\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/HybridMedianComparison/","title":"HybridMedianComparison","text":"

        vtk-examples/Cxx/ImageProcessing/HybridMedianComparison

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageProcessing/HybridMedianComparison/#description","title":"Description","text":"

        Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. The lower patterns represent the three neighborhoods used to compute the hybrid median.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/HybridMedianComparison/#code","title":"Code","text":"

        HybridMedianComparison.cxx

        #include <vtkCamera.h>\n#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageHybridMedian2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageMedian3D.h>\n#include <vtkImageNoiseSource.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageThreshold.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vector>\n\nnamespace {\nvoid AddShotNoise(vtkImageData* inputImage, vtkImageData* outputImage,\n                  double noiseAmplitude, double noiseFraction, int extent[6]);\n}\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. TestPattern.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  int scalarRange[2];\n  scalarRange[0] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[0];\n  scalarRange[1] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[1];\n  std::cout << \"Range: \" << scalarRange[0] << \", \" << scalarRange[1]\n            << std::endl;\n  int middleSlice = (reader->GetOutput()->GetExtent()[5] -\n                     reader->GetOutput()->GetExtent()[4]) /\n      2;\n\n  // Work with double images\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToDouble();\n  cast->Update();\n\n  vtkNew<vtkImageData> originalData;\n  originalData->DeepCopy(cast->GetOutput());\n\n  vtkNew<vtkImageData> noisyData;\n\n  AddShotNoise(originalData, noisyData, 2000.0, .1,\n               reader->GetOutput()->GetExtent());\n  vtkNew<vtkImageMedian3D> median;\n  median->SetInputData(noisyData);\n  median->SetKernelSize(5, 5, 1);\n\n  vtkNew<vtkImageHybridMedian2D> hybridMedian1;\n  hybridMedian1->SetInputData(noisyData);\n  vtkNew<vtkImageHybridMedian2D> hybridMedian;\n  hybridMedian->SetInputConnection(hybridMedian1->GetOutputPort());\n\n  int colorWindow = (scalarRange[1] - scalarRange[0]);\n  int colorLevel = colorWindow / 2;\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputData(originalData);\n  originalActor->GetProperty()->SetColorWindow(colorWindow);\n  originalActor->GetProperty()->SetColorLevel(colorLevel);\n  originalActor->GetProperty()->SetInterpolationTypeToNearest();\n  originalActor->SetDisplayExtent(\n      reader->GetDataExtent()[0], reader->GetDataExtent()[1],\n      reader->GetDataExtent()[2], reader->GetDataExtent()[3], middleSlice,\n      middleSlice);\n\n  vtkNew<vtkImageActor> noisyActor;\n  noisyActor->GetMapper()->SetInputData(noisyData);\n  noisyActor->GetProperty()->SetColorWindow(colorWindow);\n  noisyActor->GetProperty()->SetColorLevel(colorLevel);\n  noisyActor->GetProperty()->SetInterpolationTypeToNearest();\n  noisyActor->SetDisplayExtent(originalActor->GetDisplayExtent());\n\n  vtkNew<vtkImageActor> hybridMedianActor;\n  hybridMedianActor->GetMapper()->SetInputConnection(\n      hybridMedian->GetOutputPort());\n  hybridMedianActor->GetProperty()->SetColorWindow(colorWindow);\n  hybridMedianActor->GetProperty()->SetColorLevel(colorLevel);\n  hybridMedianActor->GetProperty()->SetInterpolationTypeToNearest();\n  hybridMedianActor->SetDisplayExtent(originalActor->GetDisplayExtent());\n\n  vtkNew<vtkImageActor> medianActor;\n  medianActor->GetMapper()->SetInputConnection(median->GetOutputPort());\n  medianActor->GetProperty()->SetColorWindow(colorWindow);\n  medianActor->GetProperty()->SetColorLevel(colorLevel);\n  medianActor->GetProperty()->SetInterpolationTypeToNearest();\n  medianActor->SetDisplayExtent(originalActor->GetDisplayExtent());\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->AddActor(originalActor);\n  vtkNew<vtkRenderer> noisyRenderer;\n  noisyRenderer->AddActor(noisyActor);\n  vtkNew<vtkRenderer> hybridRenderer;\n  hybridRenderer->AddActor(hybridMedianActor);\n  vtkNew<vtkRenderer> medianRenderer;\n  medianRenderer->AddActor(medianActor);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  renderers.push_back(originalRenderer);\n  renderers.push_back(noisyRenderer);\n  renderers.push_back(hybridRenderer);\n  renderers.push_back(medianRenderer);\n\n  // Setup viewports for the renderers.\n  int rendererSize = 400;\n  unsigned int xGridDimensions = 2;\n  unsigned int yGridDimensions = 2;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n      renderWindow->AddRenderer(renderers[index]);\n    }\n  }\n  renderWindow->SetWindowName(\"HybridMedianComparison\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Renderers share one camera.\n  renderWindow->Render();\n  renderers[0]->GetActiveCamera()->Dolly(1.5);\n  renderers[0]->ResetCameraClippingRange();\n\n  for (size_t r = 1; r < renderers.size(); ++r)\n  {\n    renderers[r]->SetActiveCamera(renderers[0]->GetActiveCamera());\n  }\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvoid AddShotNoise(vtkImageData* inputImage, vtkImageData* outputImage,\n                  double noiseAmplitude, double noiseFraction, int extent[6])\n{\n  vtkNew<vtkImageNoiseSource> shotNoiseSource;\n  shotNoiseSource->SetWholeExtent(extent);\n  shotNoiseSource->SetMinimum(0.0);\n  shotNoiseSource->SetMaximum(1.0);\n\n  vtkNew<vtkImageThreshold> shotNoiseThresh1;\n  shotNoiseThresh1->SetInputConnection(shotNoiseSource->GetOutputPort());\n  shotNoiseThresh1->ThresholdByLower(1.0 - noiseFraction);\n  shotNoiseThresh1->SetInValue(0);\n  shotNoiseThresh1->SetOutValue(noiseAmplitude);\n\n  vtkNew<vtkImageThreshold> shotNoiseThresh2;\n  shotNoiseThresh2->SetInputConnection(shotNoiseSource->GetOutputPort());\n  shotNoiseThresh2->ThresholdByLower(noiseFraction);\n  shotNoiseThresh2->SetInValue(1.0 - noiseAmplitude);\n  shotNoiseThresh2->SetOutValue(0.0);\n\n  vtkNew<vtkImageMathematics> shotNoise;\n  shotNoise->SetInputConnection(0, shotNoiseThresh1->GetOutputPort());\n  shotNoise->SetInputConnection(1, shotNoiseThresh2->GetOutputPort());\n  shotNoise->SetOperationToAdd();\n\n  vtkNew<vtkImageMathematics> add;\n  add->SetInputData(0, inputImage);\n  add->SetInputConnection(1, shotNoise->GetOutputPort());\n  add->SetOperationToAdd();\n  add->Update();\n  outputImage->DeepCopy(add->GetOutput());\n}\n} // namespace\n
        "},{"location":"Cxx/ImageProcessing/HybridMedianComparison/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HybridMedianComparison)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HybridMedianComparison: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HybridMedianComparison MACOSX_BUNDLE HybridMedianComparison.cxx )\n  target_link_libraries(HybridMedianComparison PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HybridMedianComparison\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/HybridMedianComparison/#download-and-build-hybridmediancomparison","title":"Download and Build HybridMedianComparison","text":"

        Click here to download HybridMedianComparison and its CMakeLists.txt file. Once the tarball HybridMedianComparison.tar has been downloaded and extracted,

        cd HybridMedianComparison/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HybridMedianComparison\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/IdealHighPass/","title":"IdealHighPass","text":"

        vtk-examples/Cxx/ImageProcessing/IdealHighPass

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageProcessing/IdealHighPass/#description","title":"Description","text":"

        Low-pass and high-pass filtering become trivial in the frequency domain. A portion of the pixels are simply masked or attenuated. This example shows a high pass Butterworth filter that attenuates the frequency domain image with the function out(i, j) = 1 / (1 + pow(CutOff/Freq(i,j), 2*Order)).

        The gradual attenuation of the filter is important. The ideal high-pass filter, shown in the same exaample, simply masks a set of pixels in the frequency domain. The abrupt transition causes a ringing effect in the spatial domain.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/IdealHighPass/#code","title":"Code","text":"

        IdealHighPass.cxx

        #include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageButterworthHighPass.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageFFT.h>\n#include <vtkImageIdealHighPass.h>\n#include <vtkImageMapToWindowLevelColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageProperty.h>\n#include <vtkImageRFFT.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. fullhead15.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageFFT> fft;\n  fft->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageIdealHighPass> idealHighPass;\n  idealHighPass->SetInputConnection(fft->GetOutputPort());\n  idealHighPass->SetXCutOff(0.1);\n  idealHighPass->SetYCutOff(0.1);\n\n  vtkNew<vtkImageRFFT> idealRfft;\n  idealRfft->SetInputConnection(idealHighPass->GetOutputPort());\n\n  vtkNew<vtkImageExtractComponents> idealReal;\n  idealReal->SetInputConnection(idealRfft->GetOutputPort());\n  idealReal->SetComponents(0);\n\n  vtkNew<vtkImageButterworthHighPass> butterworthHighPass;\n  butterworthHighPass->SetInputConnection(fft->GetOutputPort());\n  butterworthHighPass->SetXCutOff(0.1);\n  butterworthHighPass->SetYCutOff(0.1);\n\n  vtkNew<vtkImageRFFT> butterworthRfft;\n  butterworthRfft->SetInputConnection(butterworthHighPass->GetOutputPort());\n\n  vtkNew<vtkImageExtractComponents> butterworthReal;\n  butterworthReal->SetInputConnection(butterworthRfft->GetOutputPort());\n  butterworthReal->SetComponents(0);\n\n  // Create actors\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageMapToWindowLevelColors> idealColor;\n  idealColor->SetWindow(500);\n  idealColor->SetLevel(0);\n  idealColor->SetInputConnection(idealReal->GetOutputPort());\n\n  vtkNew<vtkImageActor> idealActor;\n  idealActor->GetMapper()->SetInputConnection(idealColor->GetOutputPort());\n  idealActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageMapToWindowLevelColors> butterworthColor;\n  butterworthColor->SetWindow(500);\n  butterworthColor->SetLevel(0);\n  butterworthColor->SetInputConnection(butterworthReal->GetOutputPort());\n\n  vtkNew<vtkImageActor> butterworthActor;\n  butterworthActor->GetMapper()->SetInputConnection(\n      butterworthColor->GetOutputPort());\n  butterworthActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> idealRenderer;\n  idealRenderer->SetViewport(0.0, 0.0, 0.5, 1.0);\n  idealRenderer->AddActor(idealActor);\n  idealRenderer->ResetCamera();\n  idealRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderer> butterworthRenderer;\n  butterworthRenderer->SetViewport(0.5, 0.0, 1.0, 1.0);\n  butterworthRenderer->AddActor(butterworthActor);\n  butterworthRenderer->SetActiveCamera(idealRenderer->GetActiveCamera());\n  butterworthRenderer->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"IdealHighPass\");\n  renderWindow->AddRenderer(idealRenderer);\n  renderWindow->AddRenderer(butterworthRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  idealRenderer->GetActiveCamera()->Dolly(1.4);\n  idealRenderer->ResetCameraClippingRange();\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageProcessing/IdealHighPass/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IdealHighPass)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingFourier\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IdealHighPass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IdealHighPass MACOSX_BUNDLE IdealHighPass.cxx )\n  target_link_libraries(IdealHighPass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IdealHighPass\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/IdealHighPass/#download-and-build-idealhighpass","title":"Download and Build IdealHighPass","text":"

        Click here to download IdealHighPass and its CMakeLists.txt file. Once the tarball IdealHighPass.tar has been downloaded and extracted,

        cd IdealHighPass/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IdealHighPass\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/IsoSubsample/","title":"IsoSubsample","text":"

        vtk-examples/Cxx/ImageProcessing/IsoSubsample

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageProcessing/IsoSubsample/#description","title":"Description","text":"

        An artifact called aliasing occurs when sub-sampling and is often associated with stair-stepping edges. Sampling theory proves that discrete sampled signals with spacing S, completely describe continuous functions composed of frequencies less than S/2. When a signal is sub-sampled, its capacity to hold high frequency information is reduced. However, the high frequency energy does not disappear. It wraps around the frequency spectrum appearing as a low frequency alias artifact. The solution, which eliminates this artifact, is to low-pass filter before sub-sampling.

        Low-pass smoothing reduces the high frequency range of an image that would cause aliasing. The same aliasing phenomena occurs when acquiring data. If a signal from an analog source contains high frequencies, saving the analog data in a discrete form requires sub-sampling that will introduce alias artifacts. For this reason, it is common practice to acquire data at high resolutions,then smooth and subsample to reduce the image to a manageable size.

        This example demonstrates aliasing that occurs when a high-frequency signal is sub-sampled. High frequencies appear as low frequency artifacts. The left image is an isosurface of a skull after sub-sampling. The right image used a low-pass filter before sub-sampling to reduce aliasing.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/IsoSubsample/#code","title":"Code","text":"

        IsoSubsample.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageMarchingCubes.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageShrink3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g FullHead.mhd\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Smoothed pipeline\n  vtkNew<vtkImageGaussianSmooth> smooth;\n  smooth->SetDimensionality(3);\n  smooth->SetInputConnection(reader->GetOutputPort());\n  smooth->SetStandardDeviations(1.75, 1.75, 0.0);\n  smooth->SetRadiusFactor(2);\n\n  vtkNew<vtkImageShrink3D> subsampleSmoothed;\n  subsampleSmoothed->SetInputConnection(smooth->GetOutputPort());\n  subsampleSmoothed->SetShrinkFactors(4, 4, 1);\n\n  vtkNew<vtkImageMarchingCubes> isoSmoothed;\n  isoSmoothed->SetInputConnection(smooth->GetOutputPort());\n  isoSmoothed->SetValue(0, 1150);\n\n  vtkNew<vtkPolyDataMapper> isoSmoothedMapper;\n  isoSmoothedMapper->SetInputConnection(isoSmoothed->GetOutputPort());\n  isoSmoothedMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoSmoothedActor;\n  isoSmoothedActor->SetMapper(isoSmoothedMapper);\n  isoSmoothedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Ivory\").GetData());\n\n  // Unsmoothed pipeline\n  // Sub sample the data\n  vtkNew<vtkImageShrink3D> subsample;\n  subsample->SetInputConnection(reader->GetOutputPort());\n  subsample->SetShrinkFactors(4, 4, 1);\n\n  vtkNew<vtkImageMarchingCubes> iso;\n  iso->SetInputConnection(subsample->GetOutputPort());\n  iso->SetValue(0, 1150);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Ivory\").GetData());\n\n  // Rendering Pipeline\n  // Setup render window, renderer, and interactor\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkRenderer> rendererLeft;\n  rendererLeft->SetViewport(leftViewport);\n\n  vtkNew<vtkRenderer> rendererRight;\n  rendererRight->SetViewport(rightViewport);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(rendererLeft);\n  renderWindow->AddRenderer(rendererRight);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  rendererLeft->AddActor(isoActor);\n  rendererRight->AddActor(isoSmoothedActor);\n\n  rendererLeft->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  rendererLeft->GetActiveCamera()->SetPosition(0.0, -1.0, 0.0);\n  rendererLeft->GetActiveCamera()->SetViewUp(0.0, 0.0, -1.0);\n  rendererLeft->ResetCamera();\n  rendererLeft->GetActiveCamera()->Azimuth(-20.0);\n  rendererLeft->GetActiveCamera()->Elevation(20.0);\n  rendererLeft->ResetCameraClippingRange();\n\n  rendererLeft->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  rendererRight->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n  rendererRight->SetActiveCamera(rendererLeft->GetActiveCamera());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"IsoSubsample\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageProcessing/IsoSubsample/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IsoSubsample)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IsoSubsample: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IsoSubsample MACOSX_BUNDLE IsoSubsample.cxx )\n  target_link_libraries(IsoSubsample PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IsoSubsample\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/IsoSubsample/#download-and-build-isosubsample","title":"Download and Build IsoSubsample","text":"

        Click here to download IsoSubsample and its CMakeLists.txt file. Once the tarball IsoSubsample.tar has been downloaded and extracted,

        cd IsoSubsample/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IsoSubsample\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/MedianComparison/","title":"MedianComparison","text":"

        vtk-examples/Cxx/ImageProcessing/MedianComparison

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageProcessing/MedianComparison/#description","title":"Description","text":"

        Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/MedianComparison/#code","title":"Code","text":"

        MedianComparison.cxx

        #include <vtkCamera.h>\n#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageMedian3D.h>\n#include <vtkImageNoiseSource.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageThreshold.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vector>\n\nnamespace {\nvoid AddShotNoise(vtkImageData* inputImage, vtkImageData* outputImage,\n                  double noiseAmplitude, double noiseFraction, int extent[6]);\n}\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. FullHead.mhd\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  int scalarRange[2];\n  scalarRange[0] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[0];\n  scalarRange[1] =\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[1];\n  std::cout << \"Range: \" << scalarRange[0] << \", \" << scalarRange[1]\n            << std::endl;\n  int middleSlice = (reader->GetOutput()->GetExtent()[5] -\n                     reader->GetOutput()->GetExtent()[4]) /\n      2;\n\n  // Work with double images.\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToDouble();\n  cast->Update();\n\n  vtkNew<vtkImageData> originalData;\n  originalData->DeepCopy(cast->GetOutput());\n\n  vtkNew<vtkImageData> noisyData;\n\n  AddShotNoise(originalData, noisyData, 2000.0, .1,\n               reader->GetOutput()->GetExtent());\n  vtkNew<vtkImageMedian3D> median;\n  median->SetInputData(noisyData);\n  median->SetKernelSize(5, 5, 1);\n\n  vtkNew<vtkImageGaussianSmooth> gaussian;\n  gaussian->SetDimensionality(2);\n  gaussian->SetInputData(noisyData);\n  gaussian->SetStandardDeviations(2.0, 2.0);\n  gaussian->SetRadiusFactors(2.0, 2.0);\n\n  int colorWindow = (scalarRange[1] - scalarRange[0]) * .8;\n  int colorLevel = colorWindow / 2;\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputData(originalData);\n  originalActor->GetProperty()->SetColorWindow(colorWindow);\n  originalActor->GetProperty()->SetColorLevel(colorLevel);\n  originalActor->GetProperty()->SetInterpolationTypeToNearest();\n  originalActor->SetZSlice(middleSlice);\n\n  vtkNew<vtkImageActor> noisyActor;\n  noisyActor->GetMapper()->SetInputData(noisyData);\n  noisyActor->GetProperty()->SetColorWindow(colorWindow);\n  noisyActor->GetProperty()->SetColorLevel(colorLevel);\n  noisyActor->GetProperty()->SetInterpolationTypeToNearest();\n  noisyActor->SetZSlice(middleSlice);\n\n  vtkNew<vtkImageActor> gaussianActor;\n  gaussianActor->GetMapper()->SetInputConnection(gaussian->GetOutputPort());\n  gaussianActor->GetProperty()->SetColorWindow(colorWindow);\n  gaussianActor->GetProperty()->SetColorLevel(colorLevel);\n  gaussianActor->GetProperty()->SetInterpolationTypeToNearest();\n  gaussianActor->SetZSlice(middleSlice);\n\n  vtkNew<vtkImageActor> medianActor;\n  medianActor->GetMapper()->SetInputConnection(median->GetOutputPort());\n  medianActor->GetProperty()->SetColorWindow(colorWindow);\n  medianActor->GetProperty()->SetColorLevel(colorLevel);\n  medianActor->GetProperty()->SetInterpolationTypeToNearest();\n  medianActor->SetZSlice(middleSlice);\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->AddActor(originalActor);\n  vtkNew<vtkRenderer> noisyRenderer;\n  noisyRenderer->AddActor(noisyActor);\n  vtkNew<vtkRenderer> gaussRenderer;\n  gaussRenderer->AddActor(gaussianActor);\n  vtkNew<vtkRenderer> medianRenderer;\n  medianRenderer->AddActor(medianActor);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  renderers.push_back(originalRenderer);\n  renderers.push_back(noisyRenderer);\n  renderers.push_back(gaussRenderer);\n  renderers.push_back(medianRenderer);\n\n  // Setup viewports for the renderers.\n  int rendererSize = 400;\n  unsigned int xGridDimensions = 2;\n  unsigned int yGridDimensions = 2;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n      renderWindow->AddRenderer(renderers[index]);\n    }\n  }\n  renderWindow->SetWindowName(\"MedianComparison\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Renderers share one camera.\n  renderWindow->Render();\n  renderers[0]->GetActiveCamera()->Dolly(1.5);\n  renderers[0]->ResetCameraClippingRange();\n  for (size_t r = 1; r < renderers.size(); ++r)\n  {\n    renderers[r]->SetActiveCamera(renderers[0]->GetActiveCamera());\n  }\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvoid AddShotNoise(vtkImageData* inputImage, vtkImageData* outputImage,\n                  double noiseAmplitude, double noiseFraction, int extent[6])\n{\n  vtkNew<vtkImageNoiseSource> shotNoiseSource;\n  shotNoiseSource->SetWholeExtent(extent);\n  shotNoiseSource->SetMinimum(0.0);\n  shotNoiseSource->SetMaximum(1.0);\n\n  vtkNew<vtkImageThreshold> shotNoiseThresh1;\n  shotNoiseThresh1->SetInputConnection(shotNoiseSource->GetOutputPort());\n  shotNoiseThresh1->ThresholdByLower(1.0 - noiseFraction);\n  shotNoiseThresh1->SetInValue(0);\n  shotNoiseThresh1->SetOutValue(noiseAmplitude);\n\n  vtkNew<vtkImageThreshold> shotNoiseThresh2;\n  shotNoiseThresh2->SetInputConnection(shotNoiseSource->GetOutputPort());\n  shotNoiseThresh2->ThresholdByLower(noiseFraction);\n  shotNoiseThresh2->SetInValue(1.0 - noiseAmplitude);\n  shotNoiseThresh2->SetOutValue(0.0);\n\n  vtkNew<vtkImageMathematics> shotNoise;\n  shotNoise->SetInputConnection(0, shotNoiseThresh1->GetOutputPort());\n  shotNoise->SetInputConnection(1, shotNoiseThresh2->GetOutputPort());\n  shotNoise->SetOperationToAdd();\n\n  vtkNew<vtkImageMathematics> add;\n  add->SetInputData(0, inputImage);\n  add->SetInputConnection(1, shotNoise->GetOutputPort());\n  add->SetOperationToAdd();\n  add->Update();\n  outputImage->DeepCopy(add->GetOutput());\n}\n} // namespace\n
        "},{"location":"Cxx/ImageProcessing/MedianComparison/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MedianComparison)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MedianComparison: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MedianComparison MACOSX_BUNDLE MedianComparison.cxx )\n  target_link_libraries(MedianComparison PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MedianComparison\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/MedianComparison/#download-and-build-mediancomparison","title":"Download and Build MedianComparison","text":"

        Click here to download MedianComparison and its CMakeLists.txt file. Once the tarball MedianComparison.tar has been downloaded and extracted,

        cd MedianComparison/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MedianComparison\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/MorphologyComparison/","title":"MorphologyComparison","text":"

        vtk-examples/Cxx/ImageProcessing/MorphologyComparison

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageProcessing/MorphologyComparison/#description","title":"Description","text":"

        Although preprocessing can do a lot to improve segmentation results, postprocessing can also be useful. Morphological filters, which operate on binary or discrete images, can be useful for manipulating the shape of the segmented regions. In this brief discussion we will only consider operations that use circular footprints, even though these morphological filters can be defined much more generally.

        Erosion is implemented by removing pixels within a specified distance of a border. For each pixel not in the segmented region, all the neighbors in a circular region around the pixels are turned off. This erosion filter shrinks the segmented region and small isolated regions disappear.

        The opposite of erosion is dilation. This filter grows the area of segmented regions. Small holes in the segmented region are completely closed. Any pixel not in the segmented region but near the region is turned on.

        Dilation and erosion are dual filters with nearly identical implementations. Dilating the \u201con\u201d pixels is equivalent to eroding \u201coff\u201d pixels in a binary image. Holes in the map disappear. However, dilation alone also grows the boundaries of the segmented regions. When dilation is followed by erosion in a closing operation, small holes are removed; however, the boundary of the segmented regions remain in the same general location.

        Opening is the dual of closing. Opening removes small islands of pixels. It is implemented with an initial erosion, followed by a dilation.

        Connectivity filters can also remove small regions without affecting the remaining boundaries of segmented regions. This set of filters separate the segmented pixels into equivalence classes based on a neighbor relation. Two pixels belong to the same class if they are touching. There are two common neighbor relations in two-dimensional images: four connectivity considers pixels neighbors if they are edge neighbors, and eight connectivity considers pixels neighbors if pixels share any vertex.

        This example demonstrates various binary filters that can alter the shape of segmented regions. From left to right, top to bottom: original image, connectivity, erosion, dilation, opening, closing.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/MorphologyComparison/#code","title":"Code","text":"

        MorphologyComparison.cxx

        #include <vtkCamera.h>\n#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageDilateErode3D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageSeedConnectivity.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. binary.pgm\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  // Dilate\n  vtkNew<vtkImageDilateErode3D> dilate;\n  dilate->SetInputConnection(reader->GetOutputPort());\n  dilate->SetDilateValue(0);\n  dilate->SetErodeValue(255);\n  dilate->SetKernelSize(31, 31, 1);\n\n  // Erode\n  vtkNew<vtkImageDilateErode3D> erode;\n  erode->SetInputConnection(reader->GetOutputPort());\n  erode->SetDilateValue(255);\n  erode->SetErodeValue(0);\n  erode->SetKernelSize(31, 31, 1);\n\n  // Opening - dilate then erode\n  vtkNew<vtkImageDilateErode3D> dilate1;\n  dilate1->SetInputConnection(reader->GetOutputPort());\n  dilate1->SetDilateValue(0);\n  dilate1->SetErodeValue(255);\n  dilate1->SetKernelSize(31, 31, 1);\n\n  vtkNew<vtkImageDilateErode3D> erode1;\n  erode1->SetInputConnection(dilate1->GetOutputPort());\n  erode1->SetDilateValue(255);\n  erode1->SetErodeValue(0);\n  erode1->SetKernelSize(31, 31, 1);\n\n  // Closing - erode then dilate\n  vtkNew<vtkImageDilateErode3D> erode2;\n  erode2->SetInputConnection(reader->GetOutputPort());\n  erode2->SetDilateValue(255);\n  erode2->SetErodeValue(0);\n  erode2->SetKernelSize(31, 31, 1);\n\n  vtkNew<vtkImageDilateErode3D> dilate2;\n  dilate2->SetInputConnection(erode2->GetOutputPort());\n  dilate2->SetDilateValue(0);\n  dilate2->SetErodeValue(255);\n  dilate2->SetKernelSize(31, 31, 1);\n\n  // Connectivity\n  vtkNew<vtkImageSeedConnectivity> con;\n  con->SetInputConnection(reader->GetOutputPort());\n  con->AddSeed(300, 200);\n  con->SetInputConnectValue(0);\n  con->SetOutputConnectedValue(0);\n  con->SetOutputUnconnectedValue(255);\n\n  // Actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n  originalActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> connectedActor;\n  connectedActor->GetMapper()->SetInputConnection(con->GetOutputPort());\n  connectedActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> erodeActor;\n  erodeActor->GetMapper()->SetInputConnection(erode->GetOutputPort());\n  erodeActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> dilateActor;\n  dilateActor->GetMapper()->SetInputConnection(dilate->GetOutputPort());\n  dilateActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> openingActor;\n  openingActor->GetMapper()->SetInputConnection(dilate2->GetOutputPort());\n  openingActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> closingActor;\n  closingActor->GetMapper()->SetInputConnection(erode1->GetOutputPort());\n  closingActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->AddActor(originalActor);\n  vtkNew<vtkRenderer> connectedRenderer;\n  connectedRenderer->AddActor(connectedActor);\n  vtkNew<vtkRenderer> dilateRenderer;\n  dilateRenderer->AddActor(dilateActor);\n  vtkNew<vtkRenderer> erodeRenderer;\n  erodeRenderer->AddActor(erodeActor);\n  vtkNew<vtkRenderer> closingRenderer;\n  closingRenderer->AddActor(closingActor);\n  vtkNew<vtkRenderer> openingRenderer;\n  openingRenderer->AddActor(openingActor);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  renderers.push_back(originalRenderer);\n  renderers.push_back(connectedRenderer);\n  renderers.push_back(erodeRenderer);\n  renderers.push_back(dilateRenderer);\n  renderers.push_back(openingRenderer);\n  renderers.push_back(closingRenderer);\n\n  // Setup viewports for the renderers.\n  int rendererSize = 300;\n  unsigned int xGridDimensions = 2;\n  unsigned int yGridDimensions = 3;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n      renderWindow->AddRenderer(renderers[index]);\n    }\n  }\n  renderWindow->SetWindowName(\"MorphologyComparison\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Renderers share one camera.\n  renderWindow->Render();\n  renderers[0]->GetActiveCamera()->Dolly(1.5);\n  renderers[0]->ResetCameraClippingRange();\n\n  for (size_t r = 1; r < renderers.size(); ++r)\n  {\n    renderers[r]->SetActiveCamera(renderers[0]->GetActiveCamera());\n  }\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageProcessing/MorphologyComparison/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MorphologyComparison)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingMorphological\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MorphologyComparison: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MorphologyComparison MACOSX_BUNDLE MorphologyComparison.cxx )\n  target_link_libraries(MorphologyComparison PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MorphologyComparison\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/MorphologyComparison/#download-and-build-morphologycomparison","title":"Download and Build MorphologyComparison","text":"

        Click here to download MorphologyComparison and its CMakeLists.txt file. Once the tarball MorphologyComparison.tar has been downloaded and extracted,

        cd MorphologyComparison/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MorphologyComparison\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/Pad/","title":"Pad","text":"

        vtk-examples/Cxx/ImageProcessing/Pad

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageProcessing/Pad/#description","title":"Description","text":"

        An important point about the discrete Fourier transform is that it treats the image as a periodic function. This means the pixels on the right border are adjacent to pixels on the left border. Since there is usually no physical relationship between these pixels, the artificial horizontal and vertical edges can distort the frequency spectrum and subsequent processing. To reduce these artifacts, the original image can be multiplied by a window function that becomes zero at the borders.

        Another approach removes these artificial edges by smoothing only along the borders.

        In both of these approaches, a portion of the original image is lost, so only the central portion of an image can be processed. If this is unacceptable, another solution is to double the dimensions of the original image with a mirror-padding filter. The intermediate image is periodic and continuous.

        The lower-left image has been padded with a constant (800). On the right, mirror padding has been used to remove artificial edges introduced by borders.

        Info

        See Figure 10-12 in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/Pad/#code","title":"Code","text":"

        Pad.cxx

        #include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageConstantPad.h>\n#include <vtkImageMapToWindowLevelColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMirrorPad.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. FullHead.mhd\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Pipelines.\n  vtkNew<vtkImageConstantPad> constantPad;\n  constantPad->SetInputConnection(reader->GetOutputPort());\n  constantPad->SetConstant(800);\n  constantPad->SetOutputWholeExtent(-127, 383, -127, 383, 22, 22);\n\n  vtkNew<vtkImageMirrorPad> mirrorPad;\n  mirrorPad->SetInputConnection(reader->GetOutputPort());\n  mirrorPad->SetOutputWholeExtent(constantPad->GetOutputWholeExtent());\n\n  // Create actors.\n\n  vtkNew<vtkImageMapToWindowLevelColors> constantPadColor;\n  constantPadColor->SetWindow(2000);\n  constantPadColor->SetLevel(1000);\n  constantPadColor->SetInputConnection(constantPad->GetOutputPort());\n\n  vtkNew<vtkImageActor> constantPadActor;\n  constantPadActor->GetMapper()->SetInputConnection(\n      constantPadColor->GetOutputPort());\n  constantPadActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageMapToWindowLevelColors> mirrorPadColor;\n  mirrorPadColor->SetWindow(2000);\n  mirrorPadColor->SetLevel(1000);\n  mirrorPadColor->SetInputConnection(mirrorPad->GetOutputPort());\n\n  vtkNew<vtkImageActor> mirrorPadActor;\n  mirrorPadActor->GetMapper()->SetInputConnection(\n      mirrorPadColor->GetOutputPort());\n  mirrorPadActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> constantPadRenderer;\n  constantPadRenderer->SetViewport(0.0, 0.0, 0.5, 1.0);\n  constantPadRenderer->AddActor(constantPadActor);\n  constantPadRenderer->ResetCamera();\n  constantPadRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderer> mirrorPadRenderer;\n  mirrorPadRenderer->SetViewport(0.5, 0.0, 1.0, 1.0);\n  mirrorPadRenderer->AddActor(mirrorPadActor);\n  mirrorPadRenderer->SetActiveCamera(constantPadRenderer->GetActiveCamera());\n  mirrorPadRenderer->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"Pad\");\n  renderWindow->AddRenderer(constantPadRenderer);\n  renderWindow->AddRenderer(mirrorPadRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  constantPadRenderer->GetActiveCamera()->Dolly(1.2);\n  constantPadRenderer->ResetCameraClippingRange();\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImageProcessing/Pad/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Pad)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Pad: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Pad MACOSX_BUNDLE Pad.cxx )\n  target_link_libraries(Pad PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Pad\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/Pad/#download-and-build-pad","title":"Download and Build Pad","text":"

        Click here to download Pad and its CMakeLists.txt file. Once the tarball Pad.tar has been downloaded and extracted,

        cd Pad/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Pad\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/RescaleAnImage/","title":"RescaleAnImage","text":"

        vtk-examples/Cxx/ImageProcessing/RescaleAnImage

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/RescaleAnImage/#code","title":"Code","text":"

        RescaleAnImage.cxx

        #include <vtkImageData.h>\n#include <vtkImageShiftScale.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n\nnamespace {\nvoid CreateImage(vtkImageData* const image,\n                 vtkMinimalStandardRandomSequence* rng);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  vtkNew<vtkImageData> image;\n  CreateImage(image, rng);\n\n  vtkNew<vtkImageShiftScale> shiftScaleFilter;\n  shiftScaleFilter->SetOutputScalarTypeToUnsignedChar();\n  shiftScaleFilter->SetInputData(image);\n  shiftScaleFilter->SetShift(\n      -1.0 * image->GetScalarRange()[0]); // brings the lower bound to 0\n  double oldRange = image->GetScalarRange()[1] - image->GetScalarRange()[0];\n  std::cout << \"Old range: [\" << image->GetScalarRange()[0] << \", \"\n            << image->GetScalarRange()[1] << \"]\" << std::endl;\n  std::cout << \"Old range magnitude: \" << oldRange << std::endl;\n  double newRange = 255; // We want the output [0,255]\n  shiftScaleFilter->SetScale(newRange / oldRange);\n  shiftScaleFilter->Update();\n\n  std::cout << \"New range: [\"\n            << shiftScaleFilter->GetOutput()->GetScalarRange()[0] << \", \"\n            << shiftScaleFilter->GetOutput()->GetScalarRange()[1] << \"]\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateImage(vtkImageData* const image,\n                 vtkMinimalStandardRandomSequence* rng)\n{\n  // Specify the size of the image data\n  image->SetDimensions(2, 3, 1);\n  image->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = image->GetDimensions();\n\n  std::cout << \"Dims: \"\n            << \" x: \" << dims[0] << \" y: \" << dims[1] << \" z: \" << dims[2]\n            << std::endl;\n\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel = static_cast<double*>(image->GetScalarPointer(x, y, z));\n        pixel[0] = rng->GetRangeValue(0.0, 2000.0);\n        rng->Next();\n      }\n    }\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/ImageProcessing/RescaleAnImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RescaleAnImage)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  ImagingCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RescaleAnImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RescaleAnImage MACOSX_BUNDLE RescaleAnImage.cxx )\n  target_link_libraries(RescaleAnImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RescaleAnImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/RescaleAnImage/#download-and-build-rescaleanimage","title":"Download and Build RescaleAnImage","text":"

        Click here to download RescaleAnImage and its CMakeLists.txt file. Once the tarball RescaleAnImage.tar has been downloaded and extracted,

        cd RescaleAnImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RescaleAnImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImageProcessing/VTKSpectrum/","title":"VTKSpectrum","text":"

        vtk-examples/Cxx/ImageProcessing/VTKSpectrum

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImageProcessing/VTKSpectrum/#description","title":"Description","text":"

        The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This example shows an image and its power spectrum displayed using a logarithmic transfer function.

        Info

        See Figure 10-10 in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImageProcessing/VTKSpectrum/#code","title":"Code","text":"

        VTKSpectrum.cxx

        #include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageFFT.h>\n#include <vtkImageFourierCenter.h>\n#include <vtkImageLogarithmicScale.h>\n#include <vtkImageMagnitude.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkWindowLevelLookupTable.h>\n\nnamespace {\n\nvoid CreateImageActor(vtkImageActor* actor, double colorWindow,\n                      double colorLevel);\n}\n\nint main(int argc, char* argv[])\n{\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. vtks.pgm\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageFFT> fft;\n  //  fft->SetFilteredAxes $VTK_IMAGE_X_AXIS $VTK_IMAGE_Y_AXIS\n  fft->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageMagnitude> mag;\n  mag->SetInputConnection(fft->GetOutputPort());\n\n  vtkNew<vtkImageFourierCenter> center;\n  center->SetInputConnection(mag->GetOutputPort());\n\n  vtkNew<vtkImageLogarithmicScale> compress;\n  compress->SetInputConnection(center->GetOutputPort());\n  compress->SetConstant(15);\n  compress->Update();\n\n  // Create actors\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n  originalActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageActor> compressedActor;\n  compressedActor->GetMapper()->SetInputConnection(compress->GetOutputPort());\n  compressedActor->GetProperty()->SetInterpolationTypeToNearest();\n  CreateImageActor(compressedActor, 160, 120);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double compressedViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderer> compressedRenderer;\n  compressedRenderer->SetViewport(compressedViewport);\n  compressedRenderer->AddActor(compressedActor);\n  compressedRenderer->ResetCamera();\n  compressedRenderer->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"VTKSpectrum\");\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(compressedRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateImageActor(vtkImageActor* actor, double colorWindow,\n                      double colorLevel)\n{\n  vtkNew<vtkWindowLevelLookupTable> wlut;\n  wlut->SetWindow(colorWindow);\n  wlut->SetLevel(colorLevel);\n  wlut->Build();\n\n  // Map the image through the lookup table\n  vtkNew<vtkImageMapToColors> color;\n  color->SetLookupTable(wlut);\n  color->SetInputData(actor->GetMapper()->GetInput());\n\n  actor->GetMapper()->SetInputConnection(color->GetOutputPort());\n  return;\n}\n\n} // namespace\n
        "},{"location":"Cxx/ImageProcessing/VTKSpectrum/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VTKSpectrum)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingFourier\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VTKSpectrum: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VTKSpectrum MACOSX_BUNDLE VTKSpectrum.cxx )\n  target_link_libraries(VTKSpectrum PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VTKSpectrum\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImageProcessing/VTKSpectrum/#download-and-build-vtkspectrum","title":"Download and Build VTKSpectrum","text":"

        Click here to download VTKSpectrum and its CMakeLists.txt file. Once the tarball VTKSpectrum.tar has been downloaded and extracted,

        cd VTKSpectrum/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VTKSpectrum\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/Actor2D/","title":"Actor2D","text":"

        vtk-examples/Cxx/Images/Actor2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/Actor2D/#code","title":"Code","text":"

        Actor2D.cxx

        #include <vtkActor2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(10, 10, 0);\n  points->InsertNextPoint(100, 100, 0);\n  points->InsertNextPoint(200, 200, 0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n  glyphFilter->Update();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n  mapper->Update();\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  actor->GetProperty()->SetPointSize(8);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->SetSize(300, 300);\n  renderWindow->SetWindowName(\"Actor2D\");\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/Actor2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Actor2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Actor2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Actor2D MACOSX_BUNDLE Actor2D.cxx )\n  target_link_libraries(Actor2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Actor2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/Actor2D/#download-and-build-actor2d","title":"Download and Build Actor2D","text":"

        Click here to download Actor2D and its CMakeLists.txt file. Once the tarball Actor2D.tar has been downloaded and extracted,

        cd Actor2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Actor2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/BackgroundImage/","title":"BackgroundImage","text":"

        vtk-examples/Cxx/Images/BackgroundImage

        "},{"location":"Cxx/Images/BackgroundImage/#description","title":"Description","text":"

        This example displays an image as the \"background\" of a scene, and renders a superquadric in front of it.

        The example accepts a jpeg file on the command line to use as a background image. If there is no file, it generates a simple background.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/BackgroundImage/#code","title":"Code","text":"

        BackgroundImage.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSuperquadricSource.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkImageData> imageData;\n\n  // Verify input arguments.\n  if (argc > 1)\n  {\n    // Read the image\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imageReader;\n    imageReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n    imageReader->SetFileName(argv[1]);\n    imageReader->Update();\n    imageData = imageReader->GetOutput();\n  }\n  else\n  {\n\n    std::array<double, 3> drawColor1{0, 0, 0};\n    std::array<double, 3> drawColor2{0, 0, 0};\n    std::array<double, 3> drawColor3{0, 0, 0};\n    auto color1 = colors->GetColor3ub(\"warm_grey\").GetData();\n    auto color2 = colors->GetColor3ub(\"DarkCyan\").GetData();\n    auto color3 = colors->GetColor3ub(\"LightCoral\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n      drawColor3[i] = color3[i];\n    }\n\n    vtkNew<vtkImageCanvasSource2D> canvasSource;\n    canvasSource->SetExtent(0, 100, 0, 100, 0, 0);\n    canvasSource->SetScalarTypeToUnsignedChar();\n    canvasSource->SetNumberOfScalarComponents(3);\n    canvasSource->SetDrawColor(drawColor1.data());\n    canvasSource->FillBox(0, 100, 0, 100);\n    canvasSource->SetDrawColor(drawColor2.data());\n    canvasSource->FillTriangle(10, 10, 25, 10, 25, 25);\n    canvasSource->SetDrawColor(drawColor3.data());\n    canvasSource->FillTube(75, 75, 0, 75, 5.0);\n    canvasSource->Update();\n    imageData = canvasSource->GetOutput();\n  }\n  // Create an image actor to display the image.\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->SetInputData(imageData);\n\n  // Create a renderer to display the image in the background.\n  vtkNew<vtkRenderer> backgroundRenderer;\n\n  // Create a superquadric.\n  vtkNew<vtkSuperquadricSource> superquadricSource;\n  superquadricSource->SetPhiRoundness(1.1);\n  superquadricSource->SetThetaRoundness(.2);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> superquadricMapper;\n  superquadricMapper->SetInputConnection(superquadricSource->GetOutputPort());\n\n  vtkNew<vtkActor> superquadricActor;\n  superquadricActor->SetMapper(superquadricMapper);\n  superquadricActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  vtkNew<vtkRenderer> sceneRenderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  // Set up the render window and renderers such that there is\n  // a background layer and a foreground layer.\n  backgroundRenderer->SetLayer(0);\n  backgroundRenderer->InteractiveOff();\n  sceneRenderer->SetLayer(1);\n  renderWindow->SetNumberOfLayers(2);\n  renderWindow->AddRenderer(backgroundRenderer);\n  renderWindow->AddRenderer(sceneRenderer);\n  renderWindow->SetWindowName(\"BackgroundImage\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add actors to the renderers\n  sceneRenderer->AddActor(superquadricActor);\n  backgroundRenderer->AddActor(imageActor);\n\n  // Render once to figure out where the background camera will be.\n  renderWindow->Render();\n\n  // Set up the background camera to fill the renderer with the image.\n  double origin[3];\n  double spacing[3];\n  int extent[6];\n  imageData->GetOrigin(origin);\n  imageData->GetSpacing(spacing);\n  imageData->GetExtent(extent);\n\n  vtkCamera* camera = backgroundRenderer->GetActiveCamera();\n  camera->ParallelProjectionOn();\n\n  double xc = origin[0] + 0.5 * (extent[0] + extent[1]) * spacing[0];\n  double yc = origin[1] + 0.5 * (extent[2] + extent[3]) * spacing[1];\n  // double xd = (extent[1] - extent[0] + 1)*spacing[0];\n  double yd = (extent[3] - extent[2] + 1) * spacing[1];\n  double d = camera->GetDistance();\n  camera->SetParallelScale(0.5 * yd);\n  camera->SetFocalPoint(xc, yc, 0.0);\n  camera->SetPosition(xc, yc, d);\n\n  // Render again to set the correct view.\n  renderWindow->Render();\n\n  // Interact with the window.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/BackgroundImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BackgroundImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOImage\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BackgroundImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BackgroundImage MACOSX_BUNDLE BackgroundImage.cxx )\n  target_link_libraries(BackgroundImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BackgroundImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/BackgroundImage/#download-and-build-backgroundimage","title":"Download and Build BackgroundImage","text":"

        Click here to download BackgroundImage and its CMakeLists.txt file. Once the tarball BackgroundImage.tar has been downloaded and extracted,

        cd BackgroundImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BackgroundImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/BorderPixelSize/","title":"BorderPixelSize","text":"

        vtk-examples/Cxx/Images/BorderPixelSize

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/BorderPixelSize/#code","title":"Code","text":"

        BorderPixelSize.cxx

        #include <vtkImageData.h>\n#include <vtkImageProperty.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nvoid CreateRandomImage(vtkImageData* image, const unsigned int dimension);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Big image.\n  vtkNew<vtkImageData> image;\n  CreateRandomImage(image, 50);\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper;\n  imageSliceMapper->SetInputData(image);\n  imageSliceMapper->BorderOn(); // This line tells the mapper to draw the full\n                                // border pixels.\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageSliceMapper);\n  imageSlice->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BorderPixelSize\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateRandomImage(vtkImageData* image, const unsigned int dimension)\n{\n  image->SetDimensions(dimension, dimension, 1);\n  image->SetOrigin(.5, .5, 0);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  unsigned int seed = 0;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->Initialize(seed);\n\n  for (unsigned int x = 0; x < dimension; x++)\n  {\n    for (unsigned int y = 0; y < dimension; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = static_cast<unsigned char>(randomSequence->GetValue() * 255);\n      randomSequence->Next();\n      pixel[1] = static_cast<unsigned char>(randomSequence->GetValue() * 255);\n      randomSequence->Next();\n      pixel[2] = static_cast<unsigned char>(randomSequence->GetValue() * 255);\n      randomSequence->Next();\n    }\n  }\n  image->Modified();\n}\n\n} // namespace\n
        "},{"location":"Cxx/Images/BorderPixelSize/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BorderPixelSize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BorderPixelSize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BorderPixelSize MACOSX_BUNDLE BorderPixelSize.cxx )\n  target_link_libraries(BorderPixelSize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BorderPixelSize\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/BorderPixelSize/#download-and-build-borderpixelsize","title":"Download and Build BorderPixelSize","text":"

        Click here to download BorderPixelSize and its CMakeLists.txt file. Once the tarball BorderPixelSize.tar has been downloaded and extracted,

        cd BorderPixelSize/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BorderPixelSize\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/CannyEdgeDetector/","title":"CannyEdgeDetector","text":"

        vtk-examples/Cxx/Images/CannyEdgeDetector

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/CannyEdgeDetector/#code","title":"Code","text":"

        CannyEdgeDetector.cxx

        #include <vtkCamera.h>\n#include <vtkGeometryFilter.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageConstantPad.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageGradient.h>\n#include <vtkImageLuminance.h>\n#include <vtkImageMagnitude.h>\n#include <vtkImageNonMaximumSuppression.h>\n#include <vtkImageToStructuredPoints.h>\n#include <vtkLinkEdgels.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n#include <vtkSubPixelPositionEdgels.h>\n#include <vtkThreshold.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cerr << \"Required args: filename.png e.g. Gourds.png\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double edgeViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  vtkNew<vtkRenderer> edgeRenderer;\n  edgeRenderer->SetViewport(edgeViewport);\n  edgeRenderer->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetMultiSamples(0);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(edgeRenderer);\n  renderWindow->SetWindowName(\"CannyEdgeDetector\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPNGReader> imageIn;\n  imageIn->SetFileName(filename.c_str());\n  imageIn->Update();\n\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->SetInputData(imageIn->GetOutput());\n\n  originalRenderer->AddActor(imageActor);\n\n  vtkNew<vtkImageLuminance> il;\n  il->SetInputConnection(imageIn->GetOutputPort());\n\n  vtkNew<vtkImageCast> ic;\n  ic->SetOutputScalarTypeToFloat();\n  ic->SetInputConnection(il->GetOutputPort());\n\n  // Smooth the image.\n  vtkNew<vtkImageGaussianSmooth> gs;\n  gs->SetInputConnection(ic->GetOutputPort());\n  gs->SetDimensionality(2);\n  gs->SetRadiusFactors(1, 1, 0);\n\n  // Gradient the image.\n  vtkNew<vtkImageGradient> imgGradient;\n  imgGradient->SetInputConnection(gs->GetOutputPort());\n  imgGradient->SetDimensionality(2);\n\n  vtkNew<vtkImageMagnitude> imgMagnitude;\n  imgMagnitude->SetInputConnection(imgGradient->GetOutputPort());\n\n  // Non maximum suppression.\n  vtkNew<vtkImageNonMaximumSuppression> nonMax;\n  imgMagnitude->Update();\n  nonMax->SetMagnitudeInputData(imgMagnitude->GetOutput());\n  imgGradient->Update();\n  nonMax->SetVectorInputData(imgGradient->GetOutput());\n  nonMax->SetDimensionality(2);\n\n  vtkNew<vtkImageConstantPad> pad;\n  pad->SetInputConnection(imgGradient->GetOutputPort());\n  pad->SetOutputNumberOfScalarComponents(3);\n  pad->SetConstant(0);\n\n  vtkNew<vtkImageToStructuredPoints> i2sp1;\n  i2sp1->SetInputConnection(nonMax->GetOutputPort());\n  pad->Update();\n  i2sp1->SetVectorInputData(pad->GetOutput());\n\n  // Link edgles.\n  vtkNew<vtkLinkEdgels> imgLink;\n  imgLink->SetInputConnection(i2sp1->GetOutputPort());\n  imgLink->SetGradientThreshold(2);\n\n  // Threshold links.\n  vtkNew<vtkThreshold> thresholdEdges;\n  thresholdEdges->SetInputConnection(imgLink->GetOutputPort());\n  thresholdEdges->SetUpperThreshold(10);\n  thresholdEdges->SetThresholdFunction(vtkThreshold::THRESHOLD_UPPER);\n  thresholdEdges->AllScalarsOff();\n\n  vtkNew<vtkGeometryFilter> gf;\n  gf->SetInputConnection(thresholdEdges->GetOutputPort());\n\n  vtkNew<vtkImageToStructuredPoints> i2sp;\n  i2sp->SetInputConnection(imgMagnitude->GetOutputPort());\n  pad->Update();\n  i2sp->SetVectorInputData(pad->GetOutput());\n\n  // Subpixel them.\n  vtkNew<vtkSubPixelPositionEdgels> spe;\n  spe->SetInputConnection(gf->GetOutputPort());\n  i2sp->Update();\n  spe->SetGradMapsData(i2sp->GetStructuredPointsOutput());\n\n  vtkNew<vtkStripper> strip;\n  strip->SetInputConnection(spe->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> dsm;\n  dsm->SetInputConnection(strip->GetOutputPort());\n  dsm->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(dsm);\n  planeActor->GetProperty()->SetAmbient(1.0);\n  planeActor->GetProperty()->SetDiffuse(0.0);\n  planeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"GhostWhite\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  edgeRenderer->AddActor(planeActor);\n\n  // Render the image.\n  interactor->Initialize();\n  renderWindow->Render();\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/CannyEdgeDetector/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CannyEdgeDetector)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonExecutionModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingMorphological\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CannyEdgeDetector: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CannyEdgeDetector MACOSX_BUNDLE CannyEdgeDetector.cxx )\n  target_link_libraries(CannyEdgeDetector PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CannyEdgeDetector\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/CannyEdgeDetector/#download-and-build-cannyedgedetector","title":"Download and Build CannyEdgeDetector","text":"

        Click here to download CannyEdgeDetector and its CMakeLists.txt file. Once the tarball CannyEdgeDetector.tar has been downloaded and extracted,

        cd CannyEdgeDetector/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CannyEdgeDetector\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/Cast/","title":"Cast","text":"

        vtk-examples/Cxx/Images/Cast

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/Cast/#description","title":"Description","text":"

        Cast an image to a different type.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/Cast/#code","title":"Code","text":"

        Cast.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a float image.\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  std::cout << source->GetOutput()->GetScalarTypeAsString() << std::endl;\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Cast\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/Cast/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cast)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cast: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cast MACOSX_BUNDLE Cast.cxx )\n  target_link_libraries(Cast PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cast\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/Cast/#download-and-build-cast","title":"Download and Build Cast","text":"

        Click here to download Cast and its CMakeLists.txt file. Once the tarball Cast.tar has been downloaded and extracted,

        cd Cast/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cast\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/CenterAnImage/","title":"CenterAnImage","text":"

        vtk-examples/Cxx/Images/CenterAnImage

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/CenterAnImage/#description","title":"Description","text":"

        This moves (0,0) from the bottom left corner of the image to the center of the image.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/CenterAnImage/#code","title":"Code","text":"

        CenterAnImage.cxx

        #include <vtkBorderRepresentation.h>\n#include <vtkBorderWidget.h>\n#include <vtkCommand.h>\n#include <vtkImageActor.h>\n#include <vtkImageChangeInformation.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n\nnamespace {\n\nclass vtkBorderCallback : public vtkCommand\n{\npublic:\n  vtkBorderCallback()\n  {\n  }\n\n  static vtkBorderCallback* New()\n  {\n    return new vtkBorderCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*);\n\n  void SetRenderer(vtkSmartPointer<vtkRenderer> renderer)\n  {\n    this->Renderer = renderer;\n  }\n  void SetImageActor(vtkSmartPointer<vtkImageActor> actor)\n  {\n    this->ImageActor = actor;\n  }\n\nprivate:\n  vtkSmartPointer<vtkRenderer> Renderer;\n  vtkSmartPointer<vtkImageActor> ImageActor;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Required parameters: Filename e.g. Ox.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imageReader;\n  imageReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  imageReader->SetFileName(argv[1]);\n  imageReader->Update();\n\n  // Shift the image center to (0,0).\n  int dims[3];\n  imageReader->GetOutput()->GetDimensions(dims);\n\n  vtkNew<vtkImageChangeInformation> changeInformation;\n  changeInformation->SetInputConnection(imageReader->GetOutputPort());\n  changeInformation->CenterImageOn();\n  changeInformation->Update();\n\n  vtkSmartPointer<vtkImageData> image = changeInformation->GetOutput();\n\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputData(image);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  vtkNew<vtkBorderWidget> borderWidget;\n  borderWidget->SetInteractor(interactor);\n  static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n      ->GetBorderProperty()\n      ->SetColor(colors->GetColor3d(\"Chartreuse\").GetData());\n  borderWidget->SelectableOff();\n\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n  renderWindow->AddRenderer(renderer);\n\n  renderer->AddActor(imageActor);\n\n  renderer->ResetCamera();\n\n  vtkNew<vtkBorderCallback> borderCallback;\n  borderCallback->SetRenderer(renderer);\n  borderCallback->SetImageActor(imageActor);\n\n  borderWidget->AddObserver(vtkCommand::InteractionEvent, borderCallback);\n  borderWidget->On();\n  renderWindow->SetWindowName(\"CenterAnImage\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid vtkBorderCallback::Execute(vtkObject* caller, unsigned long, void*)\n{\n  // Use this to format the output.\n  auto fmt = [](const double& x) {\n    std::ostringstream os;\n    os << std::fixed << std::setprecision(2) << std::setw(8) << x;\n    return os.str();\n  };\n\n  vtkBorderWidget* borderWidget = reinterpret_cast<vtkBorderWidget*>(caller);\n\n  // Get the world coordinates of the two corners of the box.\n  vtkCoordinate* lowerLeftCoordinate =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPositionCoordinate();\n  double* lowerLeft =\n      lowerLeftCoordinate->GetComputedWorldValue(this->Renderer);\n  std::cout << \"Lower left coordinate:  \" << fmt(lowerLeft[0]) << \",\"\n            << fmt(lowerLeft[1]) << \",\" << fmt(lowerLeft[2]) << std::endl;\n\n  vtkCoordinate* upperRightCoordinate =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPosition2Coordinate();\n  double* upperRight =\n      upperRightCoordinate->GetComputedWorldValue(this->Renderer);\n  std::cout << \"Upper right coordinate: \" << fmt(upperRight[0]) << \",\"\n            << fmt(upperRight[1]) << \",\" << fmt(upperRight[2]) << std::endl;\n\n  double* bounds = this->ImageActor->GetBounds();\n  double xmin = bounds[0];\n  double xmax = bounds[1];\n  double ymin = bounds[2];\n  double ymax = bounds[3];\n\n  if ((lowerLeft[0] > xmin) && (upperRight[0] < xmax) &&\n      (lowerLeft[1] > ymin) && (upperRight[1] < ymax))\n  {\n    // std::cout << \"box is inside image\" << std::endl;\n    // std::cout << \"xmin: \" << xmin << \" xmax: \" << xmax << \" ymin: \" << ymin\n    // << \" ymax: \" << ymax << std::endl;\n  }\n  else\n  {\n    std::cout << \"box is NOT inside image\" << std::endl;\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/Images/CenterAnImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CenterAnImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CenterAnImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CenterAnImage MACOSX_BUNDLE CenterAnImage.cxx )\n  target_link_libraries(CenterAnImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CenterAnImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/CenterAnImage/#download-and-build-centeranimage","title":"Download and Build CenterAnImage","text":"

        Click here to download CenterAnImage and its CMakeLists.txt file. Once the tarball CenterAnImage.tar has been downloaded and extracted,

        cd CenterAnImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CenterAnImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/Colored2DImageFusion/","title":"Colored2DImageFusion","text":"

        vtk-examples/Cxx/Images/Colored2DImageFusion

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/Colored2DImageFusion/#description","title":"Description","text":"

        This example use the vtkImageBlend class for a simple fusion of two 2D images with different color maps for each of the images.

        • Contributed by: Tim Hutz

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/Colored2DImageFusion/#code","title":"Code","text":"

        Colored2DImageFusion.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageBlend.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse input arguments.\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input1Filename Input2Filename e.g. Ox.jpg Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkLookupTable> imgFirstColorMap;\n  imgFirstColorMap->SetRange(0.0, 255.0);\n  imgFirstColorMap->SetHueRange(0.0, 0.1);\n  imgFirstColorMap->SetValueRange(0.4, 0.8);\n  imgFirstColorMap->Build();\n\n  vtkNew<vtkLookupTable> imgSecondColorMap;\n  imgSecondColorMap->SetRange(0.0, 255.0);\n  imgSecondColorMap->SetHueRange(0.67, 0.68);\n  imgSecondColorMap->SetValueRange(0.4, 0.8);\n  imgSecondColorMap->Build();\n\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imgReader;\n  imgReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  imgReader->SetFileName(argv[1]);\n\n  vtkSmartPointer<vtkImageReader2> imgReaderMoving;\n  imgReaderMoving.TakeReference(readerFactory->CreateImageReader2(argv[2]));\n  imgReaderMoving->SetFileName(argv[2]);\n\n  vtkNew<vtkImageMapToColors> firstColorMapper;\n  firstColorMapper->SetInputConnection(imgReader->GetOutputPort());\n  firstColorMapper->SetLookupTable(imgFirstColorMap);\n\n  vtkNew<vtkImageMapToColors> secondColorMapper;\n  secondColorMapper->SetInputConnection(imgReaderMoving->GetOutputPort());\n  secondColorMapper->SetLookupTable(imgSecondColorMap);\n\n  vtkNew<vtkImageBlend> imgBlender;\n  imgBlender->SetOpacity(0, 0.5);\n  imgBlender->SetOpacity(1, 0.5);\n  imgBlender->AddInputConnection(firstColorMapper->GetOutputPort());\n  imgBlender->AddInputConnection(secondColorMapper->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> imgDataSetMapper;\n  imgDataSetMapper->SetInputConnection(imgBlender->GetOutputPort());\n\n  vtkNew<vtkActor> imgActor;\n  imgActor->SetMapper(imgDataSetMapper);\n\n  vtkNew<vtkRenderer> imgRenderer;\n  imgRenderer->AddActor(imgActor);\n  imgRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderWindow> imgRenderWindow;\n  imgRenderWindow->AddRenderer(imgRenderer);\n  imgRenderWindow->SetWindowName(\"Colored2DImageFusion\");\n\n  vtkNew<vtkRenderWindowInteractor> imgInteractor;\n  imgInteractor->SetRenderWindow(imgRenderWindow);\n  imgRenderWindow->Render();\n  imgInteractor->Initialize();\n  imgInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/Colored2DImageFusion/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Colored2DImageFusion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Colored2DImageFusion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Colored2DImageFusion MACOSX_BUNDLE Colored2DImageFusion.cxx )\n  target_link_libraries(Colored2DImageFusion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Colored2DImageFusion\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/Colored2DImageFusion/#download-and-build-colored2dimagefusion","title":"Download and Build Colored2DImageFusion","text":"

        Click here to download Colored2DImageFusion and its CMakeLists.txt file. Once the tarball Colored2DImageFusion.tar has been downloaded and extracted,

        cd Colored2DImageFusion/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Colored2DImageFusion\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/CombineImages/","title":"CombineImages","text":"

        vtk-examples/Cxx/Images/CombineImages

        "},{"location":"Cxx/Images/CombineImages/#description","title":"Description","text":"

        This example takes two images and superimposes them. The opacity of each image can be set to control how they are combined.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/CombineImages/#code","title":"Code","text":"

        CombineImages.cxx

        #include <vtkImageBlend.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse input arguments.\n  if (argc != 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input1Filename Input2Filename  e.g. Ox.jpg Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the images.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imgReader1;\n  imgReader1.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  imgReader1->SetFileName(argv[1]);\n\n  vtkSmartPointer<vtkImageReader2> imgReader2;\n  imgReader2.TakeReference(readerFactory->CreateImageReader2(argv[2]));\n  imgReader2->SetFileName(argv[2]);\n\n  // Combine the images (blend takes multiple connections on the 0th input\n  // port).\n  vtkNew<vtkImageBlend> blend;\n  blend->AddInputConnection(imgReader1->GetOutputPort());\n  blend->AddInputConnection(imgReader2->GetOutputPort());\n  blend->SetOpacity(0, 0.5);\n  blend->SetOpacity(1, 0.5);\n\n  // Display the result.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(blend->GetOutputPort());\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Peru\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"CombineImages\");\n\n  imageViewer->GetRenderer()->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/CombineImages/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CombineImages)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CombineImages: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CombineImages MACOSX_BUNDLE CombineImages.cxx )\n  target_link_libraries(CombineImages PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CombineImages\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/CombineImages/#download-and-build-combineimages","title":"Download and Build CombineImages","text":"

        Click here to download CombineImages and its CMakeLists.txt file. Once the tarball CombineImages.tar has been downloaded and extracted,

        cd CombineImages/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CombineImages\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/CombiningRGBChannels/","title":"CombiningRGBChannels","text":"

        vtk-examples/Cxx/Images/CombiningRGBChannels

        "},{"location":"Cxx/Images/CombiningRGBChannels/#description","title":"Description","text":"

        This example creates three images of a square. Each square slightly overlaps the previous square. These three layers are then interpreted as the R, G, and B channel of an RGB image, by the use of vtkImageAppendComponents.

        Note

        You MUST add 3 inputs or no output will be produced.

        Seealso

        For the reverse operation, see ExtractComponents.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/CombiningRGBChannels/#code","title":"Code","text":"

        CombiningRGBChannels.cxx

        #include <vtkImageActor.h>\n#include <vtkImageAppendComponents.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 4> drawColor1{0, 0, 0, 0};\n  std::array<double, 4> drawColor2{0, 0, 0, 0};\n  auto color1 = colors->GetColor4ub(\"Black\").GetData();\n  auto color2 = colors->GetColor4ub(\"Red\").GetData();\n  for (auto i = 0; i < 4; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n  // Set the alpha to 0\n  drawColor1[3] = 0;\n  drawColor2[3] = 0;\n\n  // Create an image (will be used as the R channel)\n  vtkNew<vtkImageCanvasSource2D> red;\n  red->SetScalarTypeToUnsignedChar();\n  red->SetNumberOfScalarComponents(1);\n  red->SetExtent(0, 100, 0, 100, 0, 0);\n  red->SetDrawColor(drawColor1.data());\n  red->FillBox(0, 100, 0, 100);\n  red->SetDrawColor(drawColor2.data());\n  red->FillBox(20, 40, 20, 40);\n  red->Update();\n\n  // Create an image (will be used as the G channel)\n  vtkNew<vtkImageCanvasSource2D> green;\n  green->SetScalarTypeToUnsignedChar();\n  green->SetNumberOfScalarComponents(1);\n  green->SetExtent(0, 100, 0, 100, 0, 0);\n  green->SetDrawColor(drawColor1.data());\n  green->FillBox(0, 100, 0, 100);\n  green->SetDrawColor(drawColor2.data());\n  green->FillBox(30, 50, 30, 50);\n  green->Update();\n\n  // Create an image (will be used as the B channel)\n  vtkNew<vtkImageCanvasSource2D> blue;\n  blue->SetScalarTypeToUnsignedChar();\n  blue->SetNumberOfScalarComponents(1);\n  blue->SetExtent(0, 100, 0, 100, 0, 0);\n  blue->SetDrawColor(drawColor1.data());\n  blue->FillBox(0, 100, 0, 100);\n  blue->SetDrawColor(drawColor2.data());\n  blue->FillBox(40, 60, 40, 60);\n  blue->Update();\n\n  vtkNew<vtkImageAppendComponents> appendFilter;\n  appendFilter->SetInputConnection(0, red->GetOutputPort());\n  appendFilter->AddInputConnection(0, green->GetOutputPort());\n  appendFilter->AddInputConnection(0, blue->GetOutputPort());\n  appendFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> redActor;\n  redActor->GetMapper()->SetInputConnection(red->GetOutputPort());\n\n  vtkNew<vtkImageActor> greenActor;\n  greenActor->GetMapper()->SetInputConnection(green->GetOutputPort());\n\n  vtkNew<vtkImageActor> blueActor;\n  blueActor->GetMapper()->SetInputConnection(blue->GetOutputPort());\n\n  vtkNew<vtkImageActor> combinedActor;\n  combinedActor->GetMapper()->SetInputConnection(appendFilter->GetOutputPort());\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double redViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double greenViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double blueViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double combinedViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> redRenderer;\n  redRenderer->SetViewport(redViewport);\n  redRenderer->AddActor(redActor);\n  redRenderer->ResetCamera();\n  redRenderer->SetBackground(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> greenRenderer;\n  greenRenderer->SetViewport(greenViewport);\n  greenRenderer->AddActor(greenActor);\n  greenRenderer->ResetCamera();\n  greenRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> blueRenderer;\n  blueRenderer->SetViewport(blueViewport);\n  blueRenderer->AddActor(blueActor);\n  blueRenderer->ResetCamera();\n  blueRenderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkRenderer> combinedRenderer;\n  combinedRenderer->SetViewport(combinedViewport);\n  combinedRenderer->AddActor(combinedActor);\n  combinedRenderer->ResetCamera();\n  combinedRenderer->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(redRenderer);\n  renderWindow->AddRenderer(greenRenderer);\n  renderWindow->AddRenderer(blueRenderer);\n  renderWindow->AddRenderer(combinedRenderer);\n  renderWindow->SetWindowName(\"CombiningRGBChannels\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/CombiningRGBChannels/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CombiningRGBChannels)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CombiningRGBChannels: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CombiningRGBChannels MACOSX_BUNDLE CombiningRGBChannels.cxx )\n  target_link_libraries(CombiningRGBChannels PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CombiningRGBChannels\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/CombiningRGBChannels/#download-and-build-combiningrgbchannels","title":"Download and Build CombiningRGBChannels","text":"

        Click here to download CombiningRGBChannels and its CMakeLists.txt file. Once the tarball CombiningRGBChannels.tar has been downloaded and extracted,

        cd CombiningRGBChannels/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CombiningRGBChannels\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/DotProduct/","title":"DotProduct","text":"

        vtk-examples/Cxx/Images/DotProduct

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/DotProduct/#description","title":"Description","text":"

        This example demonstrates how to take the pixel-wise dot product of two vector images. The output is a scalar image.

        Two images, each 2x2x1, are created and filled with 3-vectors. The dot product of each pair of corresponding pixels is produced by the vtkImageDotProduct filter and output to the screen.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/DotProduct/#code","title":"Code","text":"

        DotProduct.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageDotProduct.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageData> image1;\n  image1->SetExtent(0, 1, 0, 1, 0, 0);\n  image1->AllocateScalars(VTK_FLOAT, 3);\n\n  int coord[3];\n  float* pixel;\n\n  // Fill the image with vectors\n  coord[0] = 0;\n  coord[1] = 0;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image1->GetScalarPointer(coord));\n  pixel[0] = 1.0;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 0;\n  coord[1] = 1;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image1->GetScalarPointer(coord));\n  pixel[0] = 0.0;\n  pixel[1] = 1.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 1;\n  coord[1] = 0;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image1->GetScalarPointer(coord));\n  pixel[0] = 1.0;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 1;\n  coord[1] = 1;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image1->GetScalarPointer(coord));\n  pixel[0] = 0.0;\n  pixel[1] = 1.0;\n  pixel[2] = 0.0;\n\n  // Create another image.\n  vtkNew<vtkImageData> image2;\n  image2->SetExtent(0, 1, 0, 1, 0, 0);\n  image2->AllocateScalars(VTK_FLOAT, 3);\n\n  // Fill the image with vectors.\n  coord[0] = 0;\n  coord[1] = 0;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image2->GetScalarPointer(coord));\n  pixel[0] = 1.0;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 0;\n  coord[1] = 1;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image2->GetScalarPointer(coord));\n  pixel[0] = 1.0;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 1;\n  coord[1] = 0;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image2->GetScalarPointer(coord));\n  pixel[0] = 0.5;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  coord[0] = 1;\n  coord[1] = 1;\n  coord[2] = 0;\n  pixel = static_cast<float*>(image2->GetScalarPointer(coord));\n  pixel[0] = 0.5;\n  pixel[1] = 0.0;\n  pixel[2] = 0.0;\n\n  // Compute the dot product of the images pixel wise.\n  vtkNew<vtkImageDotProduct> dotProductFilter;\n  dotProductFilter->SetInput1Data(image1);\n  dotProductFilter->SetInput2Data(image2);\n  dotProductFilter->Update();\n  std::cout << \"Output is of type: \"\n            << dotProductFilter->GetOutput()->GetScalarTypeAsString()\n            << std::endl;\n\n  vtkNew<vtkImageMathematics> imageMath;\n  imageMath->SetOperationToMultiplyByK();\n  imageMath->SetConstantK(255.0);\n  imageMath->SetInputConnection(dotProductFilter->GetOutputPort());\n  imageMath->Update();\n\n  vtkNew<vtkImageCast> imageCast;\n  imageCast->SetOutputScalarTypeToUnsignedChar();\n  imageCast->SetInputConnection(imageMath->GetOutputPort());\n  imageCast->Update();\n\n  vtkNew<vtkImageActor> dotProductActor;\n  dotProductActor->GetMapper()->SetInputConnection(imageCast->GetOutputPort());\n\n  // Display output to the terminal.\n  for (vtkIdType i = 0; i < 2; i++)\n  {\n    for (vtkIdType j = 0; j < 2; j++)\n    {\n      coord[0] = i;\n      coord[1] = j;\n      coord[2] = 0;\n      pixel = static_cast<float*>(\n          dotProductFilter->GetOutput()->GetScalarPointer(coord));\n      std::cout << \"Pixel (\" << i << \", \" << j << \") : \" << pixel[0]\n                << std::endl;\n    }\n  }\n\n  image1->GetPointData()->SetActiveVectors(\"ImageScalars\");\n  image2->GetPointData()->SetActiveVectors(\"ImageScalars\");\n\n  vtkNew<vtkArrowSource> arrowSource;\n\n  vtkNew<vtkGlyph3DMapper> glyph3Dmapper1;\n  glyph3Dmapper1->SetSourceConnection(arrowSource->GetOutputPort());\n  glyph3Dmapper1->SetInputData(image1);\n  glyph3Dmapper1->Update();\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(glyph3Dmapper1);\n\n  vtkNew<vtkGlyph3DMapper> glyph3Dmapper2;\n  glyph3Dmapper2->SetSourceConnection(arrowSource->GetOutputPort());\n  glyph3Dmapper2->SetInputData(image2);\n  glyph3Dmapper2->Update();\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(glyph3Dmapper2);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  vtkNew<vtkRenderer> centerRenderer;\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(leftRenderer);\n  renderWindow->AddRenderer(centerRenderer);\n  renderWindow->AddRenderer(rightRenderer);\n  renderWindow->SetWindowName(\"DotProduct\");\n  renderWindow->SetSize(600, 200);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  leftRenderer->AddActor(actor1);\n  centerRenderer->AddActor(actor2);\n  rightRenderer->AddActor(dotProductActor);\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/DotProduct/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DotProduct)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  ImagingCore\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DotProduct: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DotProduct MACOSX_BUNDLE DotProduct.cxx )\n  target_link_libraries(DotProduct PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DotProduct\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/DotProduct/#download-and-build-dotproduct","title":"Download and Build DotProduct","text":"

        Click here to download DotProduct and its CMakeLists.txt file. Once the tarball DotProduct.tar has been downloaded and extracted,

        cd DotProduct/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DotProduct\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/DrawOnAnImage/","title":"DrawOnAnImage","text":"

        vtk-examples/Cxx/Images/DrawOnAnImage

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/DrawOnAnImage/#description","title":"Description","text":"

        This example draws a circle in the center of the input image using vtkImageCanvasSource2D's DrawCircle method.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/DrawOnAnImage/#code","title":"Code","text":"

        DrawOnAnImage.cxx

        #include <vtkImageBlend.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputImageFilename e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imgReader;\n  imgReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  imgReader->SetFileName(argv[1]);\n  imgReader->Update();\n\n  vtkImageData* image = imgReader->GetOutput();\n\n  // Find center of image.\n  int center[2];\n  center[0] = (image->GetExtent()[1] + image->GetExtent()[0]) / 2;\n  center[1] = (image->GetExtent()[3] + image->GetExtent()[2]) / 2;\n\n  // Pick a radius for the circle.\n  int radius;\n  radius = (image->GetExtent()[1] < image->GetExtent()[3])\n      ? image->GetExtent()[1] * 2 / 5\n      : image->GetExtent()[3] * 2 / 5;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Black\").GetData();\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color2 = colors->GetColor3ub(\"Seashell\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Draw a circle in the center of the image.\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetExtent(image->GetExtent());\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(image->GetExtent()[0], image->GetExtent()[1],\n                   image->GetExtent()[2], image->GetExtent()[3]);\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(center[0], center[1], radius);\n\n  // Combine the images (blend takes multiple connections on the 0th\n  // input port).\n  vtkNew<vtkImageBlend> blend;\n  blend->AddInputConnection(imgReader->GetOutputPort());\n  blend->AddInputConnection(drawing->GetOutputPort());\n  blend->SetOpacity(0, .6);\n  blend->SetOpacity(1, .4);\n\n  // Display the result.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(blend->GetOutputPort());\n  imageViewer->SetSize(640, 512);\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  imageViewer->GetRenderWindow()->SetWindowName(\"DrawOnAnImage\");\n  imageViewer->GetRenderWindow()->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/DrawOnAnImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DrawOnAnImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DrawOnAnImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DrawOnAnImage MACOSX_BUNDLE DrawOnAnImage.cxx )\n  target_link_libraries(DrawOnAnImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DrawOnAnImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/DrawOnAnImage/#download-and-build-drawonanimage","title":"Download and Build DrawOnAnImage","text":"

        Click here to download DrawOnAnImage and its CMakeLists.txt file. Once the tarball DrawOnAnImage.tar has been downloaded and extracted,

        cd DrawOnAnImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DrawOnAnImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/DrawShapes/","title":"DrawShapes","text":"

        vtk-examples/Cxx/Images/DrawShapes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/DrawShapes/#code","title":"Code","text":"

        DrawShapes.cxx

        #include <vtkImageCanvasSource2D.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"DimGray\").GetData();\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color2 = colors->GetColor3ub(\"HotPink\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create a blank, colored image.\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 20, 0, 50, 0, 0);\n  // Comment out or set color1 to \"Black\" if you want a black image.\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(0, 20, 0, 50);\n\n  // Draw a red circle of radius 5 centered at (9,10).\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(9, 10, 5);\n  drawing->Update();\n\n  // View the result\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(drawing->GetOutputPort());\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->GetRenderer()->GradientBackgroundOn();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SkyBlue\").GetData());\n  imageViewer->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderWindow()->SetWindowName(\"DrawShapes\");\n  imageViewer->GetRenderWindow()->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/DrawShapes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DrawShapes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DrawShapes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DrawShapes MACOSX_BUNDLE DrawShapes.cxx )\n  target_link_libraries(DrawShapes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DrawShapes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/DrawShapes/#download-and-build-drawshapes","title":"Download and Build DrawShapes","text":"

        Click here to download DrawShapes and its CMakeLists.txt file. Once the tarball DrawShapes.tar has been downloaded and extracted,

        cd DrawShapes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DrawShapes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ExtractComponents/","title":"ExtractComponents","text":"

        vtk-examples/Cxx/Images/ExtractComponents

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ExtractComponents/#description","title":"Description","text":"

        This example separates an image into the red channel, the green channel, and the blue channel using vtkImageExtractComponents.

        Seealso

        For the reverse operation, see CombiningRGBChannels.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ExtractComponents/#code","title":"Code","text":"

        ExtractComponents.cxx

        #include <vtkImageActor.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputFilename e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageExtractComponents> extractRedFilter;\n  extractRedFilter->SetInputConnection(reader->GetOutputPort());\n  extractRedFilter->SetComponents(0);\n  extractRedFilter->Update();\n\n  vtkNew<vtkImageExtractComponents> extractGreenFilter;\n  extractGreenFilter->SetInputConnection(reader->GetOutputPort());\n  extractGreenFilter->SetComponents(1);\n  extractGreenFilter->Update();\n\n  vtkNew<vtkImageExtractComponents> extractBlueFilter;\n  extractBlueFilter->SetInputConnection(reader->GetOutputPort());\n  extractBlueFilter->SetComponents(2);\n  extractBlueFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> redActor;\n  redActor->GetMapper()->SetInputConnection(extractRedFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> greenActor;\n  greenActor->GetMapper()->SetInputConnection(\n      extractGreenFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> blueActor;\n  blueActor->GetMapper()->SetInputConnection(\n      extractBlueFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double redViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double greenViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double blueViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->ResetCamera();\n  inputRenderer->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n\n  vtkNew<vtkRenderer> redRenderer;\n  redRenderer->SetViewport(redViewport);\n  redRenderer->AddActor(redActor);\n  redRenderer->ResetCamera();\n  redRenderer->SetBackground(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> greenRenderer;\n  greenRenderer->SetViewport(greenViewport);\n  greenRenderer->AddActor(greenActor);\n  greenRenderer->ResetCamera();\n  greenRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> blueRenderer;\n  blueRenderer->SetViewport(blueViewport);\n  blueRenderer->AddActor(blueActor);\n  blueRenderer->ResetCamera();\n  blueRenderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(redRenderer);\n  renderWindow->AddRenderer(greenRenderer);\n  renderWindow->AddRenderer(blueRenderer);\n  renderWindow->SetWindowName(\"ExtractComponents\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ExtractComponents/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractComponents)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractComponents: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractComponents MACOSX_BUNDLE ExtractComponents.cxx )\n  target_link_libraries(ExtractComponents PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractComponents\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ExtractComponents/#download-and-build-extractcomponents","title":"Download and Build ExtractComponents","text":"

        Click here to download ExtractComponents and its CMakeLists.txt file. Once the tarball ExtractComponents.tar has been downloaded and extracted,

        cd ExtractComponents/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractComponents\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/FillWindow/","title":"FillWindow","text":"

        vtk-examples/Cxx/Images/FillWindow

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/FillWindow/#code","title":"Code","text":"

        FillWindow.cxx

        #include <vtkCamera.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> mandelbrotSource;\n  mandelbrotSource->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(mandelbrotSource->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper;\n  imageSliceMapper->SetInputConnection(castFilter->GetOutputPort());\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageSliceMapper);\n\n  int extent[6];\n  castFilter->GetOutput()->GetExtent(extent);\n\n  double origin[3];\n  castFilter->GetOutput()->GetOrigin(origin);\n\n  double spacing[3];\n  castFilter->GetOutput()->GetSpacing(spacing);\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageSlice);\n  renderer->ResetCamera();\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"FillWindow\");\n\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->ParallelProjectionOn();\n  renderer->SetBackground(colors->GetColor3d(\"Red\").GetData());\n\n  float xc = origin[0] + 0.5 * (extent[0] + extent[1]) * spacing[0];\n  float yc = origin[1] + 0.5 * (extent[2] + extent[3]) * spacing[1];\n  //  float xd = (extent[1] - extent[0] + 1)*spacing[0]; // not used\n  float yd = (extent[3] - extent[2] + 1) * spacing[1];\n\n  float d = camera->GetDistance();\n  camera->SetParallelScale(0.5f * static_cast<float>(yd));\n  camera->SetFocalPoint(xc, yc, 0.0);\n  camera->SetPosition(xc, yc, +d);\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/FillWindow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FillWindow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FillWindow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FillWindow MACOSX_BUNDLE FillWindow.cxx )\n  target_link_libraries(FillWindow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FillWindow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/FillWindow/#download-and-build-fillwindow","title":"Download and Build FillWindow","text":"

        Click here to download FillWindow and its CMakeLists.txt file. Once the tarball FillWindow.tar has been downloaded and extracted,

        cd FillWindow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FillWindow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/Flip/","title":"Flip","text":"

        vtk-examples/Cxx/Images/Flip

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/Flip/#description","title":"Description","text":"

        This example demonstrates how to flip an image over an axis.

        Need a better source image (non-symmetrical!).

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/Flip/#code","title":"Code","text":"

        Flip.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageFlip.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> castSource;\n  castSource->SetOutputScalarTypeToUnsignedChar();\n  castSource->SetInputConnection(source->GetOutputPort());\n  castSource->Update();\n\n  vtkNew<vtkImageFlip> flipXFilter;\n  flipXFilter->SetFilteredAxis(0); // flip x axis\n  flipXFilter->SetInputConnection(source->GetOutputPort());\n  flipXFilter->Update();\n\n  vtkNew<vtkImageCast> castXFilter;\n  castXFilter->SetOutputScalarTypeToUnsignedChar();\n  castXFilter->SetInputConnection(flipXFilter->GetOutputPort());\n  castXFilter->Update();\n\n  vtkNew<vtkImageFlip> flipYFilter;\n  flipYFilter->SetFilteredAxis(1); // flip y axis\n  flipYFilter->SetInputConnection(source->GetOutputPort());\n  flipYFilter->Update();\n\n  vtkNew<vtkImageCast> castYFilter;\n  castYFilter->SetOutputScalarTypeToUnsignedChar();\n  castYFilter->SetInputConnection(flipYFilter->GetOutputPort());\n  castYFilter->Update();\n\n  vtkNew<vtkImageFlip> flipZFilter;\n  flipZFilter->SetFilteredAxis(2); // flip z axis\n  flipZFilter->SetInputConnection(source->GetOutputPort());\n  flipZFilter->Update();\n\n  vtkNew<vtkImageCast> castZFilter;\n  castZFilter->SetOutputScalarTypeToUnsignedChar();\n  castZFilter->SetInputConnection(flipZFilter->GetOutputPort());\n  castZFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(castSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> xActor;\n  xActor->GetMapper()->SetInputConnection(castXFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> yActor;\n  yActor->GetMapper()->SetInputConnection(castYFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> zActor;\n  zActor->GetMapper()->SetInputConnection(castZFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double xViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double yViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double zViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->ResetCamera();\n  inputRenderer->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n\n  vtkNew<vtkRenderer> xRenderer;\n  xRenderer->SetViewport(xViewport);\n  xRenderer->AddActor(xActor);\n  xRenderer->ResetCamera();\n  xRenderer->SetBackground(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> yRenderer;\n  yRenderer->SetViewport(yViewport);\n  yRenderer->AddActor(yActor);\n  yRenderer->ResetCamera();\n  yRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> zRenderer;\n  zRenderer->SetViewport(zViewport);\n  zRenderer->AddActor(zActor);\n  zRenderer->ResetCamera();\n  zRenderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(xRenderer);\n  renderWindow->AddRenderer(yRenderer);\n  renderWindow->AddRenderer(zRenderer);\n  renderWindow->SetWindowName(\"Flip\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/Flip/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Flip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Flip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Flip MACOSX_BUNDLE Flip.cxx )\n  target_link_libraries(Flip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Flip\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/Flip/#download-and-build-flip","title":"Download and Build Flip","text":"

        Click here to download Flip and its CMakeLists.txt file. Once the tarball Flip.tar has been downloaded and extracted,

        cd Flip/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Flip\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/Gradient/","title":"Gradient","text":"

        vtk-examples/Cxx/Images/Gradient

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/Gradient/#description","title":"Description","text":"

        Find the gradient vector of an image at every pixel. Display the original image, the x component of the gradient, the y component of the gradient, and the gradient itself.

        The example takes an optional .jpeg image file.

        • Thanks to Eric Monson.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/Gradient/#code","title":"Code","text":"

        Gradient.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkDoubleArray.h>\n#include <vtkFieldDataToAttributeDataFilter.h>\n#include <vtkGlyph3D.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageGradient.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageRGBToHSV.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageShiftScale.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n  namedColors->SetColor(\"Bkg\", 0.2, 0.3, 0.6);\n\n  vtkSmartPointer<vtkImageData> originalImage;\n  vtkSmartPointer<vtkImageData> image;\n\n  int onRatio = 1;\n  double scaleFactor = 1.0;\n  if (argc < 2)\n  {\n    std::array<double, 3> drawColor1{0, 0, 0};\n    auto color1 = namedColors->GetColor3ub(\"Gray\").GetData();\n    std::array<double, 3> drawColor2{0, 0, 0};\n    auto color2 = namedColors->GetColor3ub(\"Snow\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n    }\n\n    // Create an image.\n    vtkNew<vtkImageCanvasSource2D> imageSource;\n    imageSource->SetScalarTypeToDouble();\n    imageSource->SetNumberOfScalarComponents(1);\n    imageSource->SetExtent(0, 6, 0, 6, 0, 0);\n    imageSource->SetDrawColor(drawColor1.data());\n    imageSource->FillBox(0, 6, 0, 6);\n    imageSource->SetDrawColor(drawColor2.data());\n    imageSource->FillBox(2, 4, 2, 4);\n    imageSource->Update();\n\n    originalImage = imageSource->GetOutput();\n    image = imageSource->GetOutput();\n\n    // Use all of the points.\n    onRatio = 1;\n    scaleFactor = .01;\n  }\n  else\n  {\n    // Read an image.\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> reader;\n    reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n    reader->SetFileName(argv[1]);\n\n    // Convert to HSV and extract the Value.\n    vtkNew<vtkImageRGBToHSV> hsvFilter;\n    hsvFilter->SetInputConnection(reader->GetOutputPort());\n\n    vtkNew<vtkImageExtractComponents> extractValue;\n    extractValue->SetInputConnection(hsvFilter->GetOutputPort());\n    extractValue->SetComponents(2);\n    extractValue->Update();\n\n    image = extractValue->GetOutput();\n    originalImage = reader->GetOutput();\n\n    // Use 1% of the points.\n    onRatio = image->GetPointData()->GetScalars()->GetNumberOfTuples() /\n        (image->GetPointData()->GetScalars()->GetNumberOfTuples() * .01);\n    scaleFactor = 1.0;\n  }\n\n  // Compute the gradient of the Value.\n  vtkNew<vtkImageGradient> gradientFilter;\n  gradientFilter->SetInputData(image);\n  gradientFilter->SetDimensionality(2);\n  gradientFilter->Update();\n\n  // Extract the x component of the gradient.\n  vtkNew<vtkImageExtractComponents> extractXFilter;\n  extractXFilter->SetComponents(0);\n  extractXFilter->SetInputConnection(gradientFilter->GetOutputPort());\n\n  double xRange[2];\n\n  extractXFilter->Update();\n  extractXFilter->GetOutput()->GetPointData()->GetScalars()->GetRange(xRange);\n\n  // Gradient could be negative, so take the absolute value.\n  vtkNew<vtkImageMathematics> imageAbsX;\n  imageAbsX->SetOperationToAbsoluteValue();\n  imageAbsX->SetInputConnection(extractXFilter->GetOutputPort());\n\n  // Scale the output (0,255).\n  vtkNew<vtkImageShiftScale> shiftScaleX;\n  shiftScaleX->SetOutputScalarTypeToUnsignedChar();\n  shiftScaleX->SetScale(255 / xRange[1]);\n  shiftScaleX->SetInputConnection(imageAbsX->GetOutputPort());\n\n  // Extract the y component of the gradient.\n  vtkNew<vtkImageExtractComponents> extractYFilter;\n  extractYFilter->SetComponents(1);\n  extractYFilter->SetInputConnection(gradientFilter->GetOutputPort());\n\n  double yRange[2];\n  extractYFilter->Update();\n  extractYFilter->GetOutput()->GetPointData()->GetScalars()->GetRange(yRange);\n\n  // Gradient could be negative, so take the absolute value.\n  vtkNew<vtkImageMathematics> imageAbsY;\n  imageAbsY->SetOperationToAbsoluteValue();\n  imageAbsY->SetInputConnection(extractYFilter->GetOutputPort());\n\n  // Scale the output (0,255)\n  vtkNew<vtkImageShiftScale> shiftScaleY;\n  shiftScaleY->SetOutputScalarTypeToUnsignedChar();\n  shiftScaleY->SetScale(255 / yRange[1]);\n  shiftScaleY->SetInputConnection(imageAbsY->GetOutputPort());\n\n  // Create the Glyphs for the gradient.\n  vtkNew<vtkArrowSource> arrowSource;\n\n  // The gradient is 2D but Glyph3D needs 3D vectors. Add a 0 z-component\n  // Also, ImageGradient generates a 2-component scalar for the\n  // gradient, but Glyph3D needs normals or vectors.\n  vtkNew<vtkDoubleArray> zeroes;\n  zeroes->SetNumberOfComponents(1);\n  zeroes->SetName(\"Zero\");\n  zeroes->SetNumberOfTuples(gradientFilter->GetOutput()\n                                ->GetPointData()\n                                ->GetScalars()\n                                ->GetNumberOfTuples());\n  zeroes->FillComponent(0, 0.0);\n  gradientFilter->GetOutput()->GetPointData()->AddArray(zeroes);\n\n  std::string scalarName =\n      gradientFilter->GetOutput()->GetPointData()->GetScalars()->GetName();\n\n  vtkNew<vtkFieldDataToAttributeDataFilter> scalarsToVectors;\n  scalarsToVectors->SetInputConnection(gradientFilter->GetOutputPort());\n  scalarsToVectors->SetInputFieldToPointDataField();\n  scalarsToVectors->SetOutputAttributeDataToPointData();\n  scalarsToVectors->SetVectorComponent(0, scalarName.c_str(), 0);\n  scalarsToVectors->SetVectorComponent(1, scalarName.c_str(), 1);\n  scalarsToVectors->SetVectorComponent(2, \"Zero\", 0);\n\n  // Select a small percentage of the gradients.\n  vtkNew<vtkMaskPoints> maskPoints;\n  maskPoints->SetInputConnection(scalarsToVectors->GetOutputPort());\n  maskPoints->RandomModeOff();\n  maskPoints->SetOnRatio(onRatio);\n\n  vtkNew<vtkGlyph3D> vectorGradientGlyph;\n  vectorGradientGlyph->SetSourceConnection(arrowSource->GetOutputPort());\n  vectorGradientGlyph->SetInputConnection(maskPoints->GetOutputPort());\n  vectorGradientGlyph->SetScaleModeToScaleByVector();\n  vectorGradientGlyph->SetVectorModeToUseVector();\n  vectorGradientGlyph->SetScaleFactor(scaleFactor);\n\n  // Visualize.\n\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double xGradientViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double yGradientViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double vectorGradientViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkPolyDataMapper> vectorGradientMapper;\n  vectorGradientMapper->SetInputConnection(\n      vectorGradientGlyph->GetOutputPort());\n  vectorGradientMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> vectorGradientActor;\n  vectorGradientActor->SetMapper(vectorGradientMapper);\n  vectorGradientActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  // vtkNew<vtkCamera> sharedCamera;\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->SetBackground(namedColors->GetColor3d(\"Bkg\").GetData());\n\n  vtkNew<vtkRenderer> xGradientRenderer;\n  xGradientRenderer->SetViewport(xGradientViewport);\n  xGradientRenderer->SetBackground(namedColors->GetColor3d(\"Bkg\").GetData());\n\n  vtkNew<vtkRenderer> yGradientRenderer;\n  yGradientRenderer->SetViewport(yGradientViewport);\n  yGradientRenderer->SetBackground(namedColors->GetColor3d(\"Bkg\").GetData());\n\n  vtkNew<vtkRenderer> vectorGradientRenderer;\n  vectorGradientRenderer->SetViewport(vectorGradientViewport);\n  vectorGradientRenderer->SetBackground(\n      namedColors->GetColor3d(\"Bkg\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(xGradientRenderer);\n  renderWindow->AddRenderer(yGradientRenderer);\n  renderWindow->AddRenderer(vectorGradientRenderer);\n  renderWindow->SetWindowName(\"Gradient\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputData(originalImage);\n  originalActor->InterpolateOff();\n\n  vtkNew<vtkImageActor> xGradientActor;\n  xGradientActor->InterpolateOff();\n\n  xGradientActor->GetMapper()->SetInputConnection(shiftScaleX->GetOutputPort());\n\n  vtkNew<vtkImageActor> yGradientActor;\n\n  yGradientActor->GetMapper()->SetInputConnection(shiftScaleY->GetOutputPort());\n  yGradientActor->InterpolateOff();\n\n  // Add the actors to the scenes.\n  originalRenderer->AddActor(originalActor);\n  xGradientRenderer->AddActor(xGradientActor);\n  yGradientRenderer->AddActor(yGradientActor);\n  vectorGradientRenderer->AddActor(vectorGradientActor);\n  vectorGradientRenderer->AddActor(originalActor);\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/Gradient/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Gradient)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Gradient: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Gradient MACOSX_BUNDLE Gradient.cxx )\n  target_link_libraries(Gradient PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Gradient\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/Gradient/#download-and-build-gradient","title":"Download and Build Gradient","text":"

        Click here to download Gradient and its CMakeLists.txt file. Once the tarball Gradient.tar has been downloaded and extracted,

        cd Gradient/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Gradient\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageAccumulate/","title":"ImageAccumulate","text":"

        vtk-examples/Cxx/Images/ImageAccumulate

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageAccumulate/#code","title":"Code","text":"

        ImageAccumulate.cxx

        /*\n * In this example, the resulting histogram has 6 pixels (all of them) in the\n * 3rd bin (value = 2) and zero in the rest of the bins\n */\n#include <vtkImageAccumulate.h>\n#include <vtkImageData.h>\n#include <vtkNew.h>\n#include <vtkSmartPointer.h>\n\nnamespace {\n\nvoid CreateImage(vtkSmartPointer<vtkImageData> image);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkImageData> image;\n  CreateImage(image);\n\n  vtkNew<vtkImageAccumulate> imageAccumulate;\n  imageAccumulate->SetInputData(image);\n  imageAccumulate->SetComponentExtent(0, 255, 0, 0, 0, 0);\n  imageAccumulate->SetComponentOrigin(0, 0, 0);\n  imageAccumulate->SetComponentSpacing(\n      1, 0, 0); // This will count exactly the number of pixels of each color.\n                // Use (10,0,0) to make bins of width 10 instead.\n  imageAccumulate->Update();\n\n  int dims[3];\n  imageAccumulate->GetOutput()->GetDimensions(dims);\n  for (vtkIdType bin = 0; bin < dims[0]; ++bin)\n  {\n    std::cout << *(static_cast<int*>(\n                     imageAccumulate->GetOutput()->GetScalarPointer(bin, 0, 0)))\n              << \" \";\n  }\n\n  std::cout << std::endl;\n\n  double mean[3];\n  imageAccumulate->GetMean(mean);\n  std::cout << \"Mean: \" << mean[0] << \" \" << mean[1] << \" \" << mean[2]\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateImage(vtkSmartPointer<vtkImageData> image)\n{\n  // Specify the size of the image data\n  image->SetDimensions(2, 3, 1);\n  // image->SetExtent(0,2,0,3,0,1);\n  image->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = image->GetDimensions();\n  // int dims[3]; // can't do this\n\n  std::cout << \"Dims: \"\n            << \" x: \" << dims[0] << \" y: \" << dims[1] << \" z: \" << dims[2]\n            << std::endl;\n\n  // Fill every entry of the image data with \"2.0\"\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel = static_cast<double*>(image->GetScalarPointer(x, y, z));\n        pixel[0] = 2.0;\n      }\n    }\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/Images/ImageAccumulate/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageAccumulate)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  ImagingStatistics\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageAccumulate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageAccumulate MACOSX_BUNDLE ImageAccumulate.cxx )\n  target_link_libraries(ImageAccumulate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageAccumulate\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageAccumulate/#download-and-build-imageaccumulate","title":"Download and Build ImageAccumulate","text":"

        Click here to download ImageAccumulate and its CMakeLists.txt file. Once the tarball ImageAccumulate.tar has been downloaded and extracted,

        cd ImageAccumulate/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageAccumulate\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageAccumulateGreyscale/","title":"ImageAccumulateGreyscale","text":"

        vtk-examples/Cxx/Images/ImageAccumulateGreyscale

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageAccumulateGreyscale/#code","title":"Code","text":"

        ImageAccumulateGreyscale.cxx

        #include <vtkBarChartActor.h>\n#include <vtkFieldData.h>\n#include <vtkImageAccumulate.h>\n#include <vtkImageData.h>\n#include <vtkImageMagnitude.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkIntArray.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  // Handle the arguments\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename e.g. Ox.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageMagnitude> magnitude;\n  magnitude->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkIntArray> frequencies;\n\n  vtkNew<vtkImageAccumulate> histogram;\n  histogram->SetInputConnection(magnitude->GetOutputPort());\n  histogram->SetComponentExtent(0, 255, 0, 0, 0, 0);\n  histogram->SetComponentOrigin(0, 0, 0);\n  histogram->SetComponentSpacing(1, 0, 0);\n  histogram->IgnoreZeroOn();\n  histogram->Update();\n\n  int numberOfTuples = 64;\n  frequencies->SetNumberOfComponents(1);\n  frequencies->SetNumberOfTuples(numberOfTuples);\n  vtkIdType* output =\n      static_cast<vtkIdType*>(histogram->GetOutput()->GetScalarPointer());\n\n  for (int j = 0; j < numberOfTuples; ++j)\n  {\n    frequencies->SetTuple1(j, *output++);\n  }\n\n  vtkNew<vtkDataObject> dataObject;\n\n  dataObject->GetFieldData()->AddArray(frequencies);\n\n  // Create a vtkBarChartActor.\n  vtkNew<vtkBarChartActor> barChart;\n\n  barChart->SetInput(dataObject);\n  barChart->SetTitle(\"Histogram\");\n  barChart->GetPositionCoordinate()->SetValue(0.1, 0.05, 0.0);\n  barChart->GetPosition2Coordinate()->SetValue(0.95, 0.85, 0.0);\n  barChart->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  barChart->GetLegendActor()->SetNumberOfEntries(\n      dataObject->GetFieldData()->GetArray(0)->GetNumberOfTuples());\n  barChart->LegendVisibilityOff();\n  barChart->LabelVisibilityOff();\n\n  int count = 0;\n  for (int i = 0; i < numberOfTuples; ++i)\n  {\n    barChart->SetBarColor(count++, colors->GetColor3d(\"Tomato\").GetData());\n  }\n\n  // Visualize the histogram.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(barChart);\n  renderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ImageAccumulateGreyscale\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Initialize the event loop and then start it\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageAccumulateGreyscale/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageAccumulateGreyscale)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingMath\n  ImagingStatistics\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageAccumulateGreyscale: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageAccumulateGreyscale MACOSX_BUNDLE ImageAccumulateGreyscale.cxx )\n  target_link_libraries(ImageAccumulateGreyscale PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageAccumulateGreyscale\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageAccumulateGreyscale/#download-and-build-imageaccumulategreyscale","title":"Download and Build ImageAccumulateGreyscale","text":"

        Click here to download ImageAccumulateGreyscale and its CMakeLists.txt file. Once the tarball ImageAccumulateGreyscale.tar has been downloaded and extracted,

        cd ImageAccumulateGreyscale/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageAccumulateGreyscale\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageAnisotropicDiffusion2D/","title":"ImageAnisotropicDiffusion2D","text":"

        vtk-examples/Cxx/Images/ImageAnisotropicDiffusion2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageAnisotropicDiffusion2D/#code","title":"Code","text":"

        ImageAnisotropicDiffusion2D.cxx

        #include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageAnisotropicDiffusion2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout\n        << \"Usage: \" << argv[0]\n        << \" ImagFilename e.g cake_easy.jpg [iterations(10)] [threshold(20)]\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n  int iterations = 10;\n  if (argc >= 3)\n  {\n    iterations = atoi(argv[2]);\n  }\n  float threshold = 20;\n  if (argc >= 4)\n  {\n    threshold = atoi(argv[3]);\n  }\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageAnisotropicDiffusion2D> diffusion;\n  diffusion->SetInputConnection(reader->GetOutputPort());\n  diffusion->SetNumberOfIterations(iterations);\n  diffusion->SetDiffusionThreshold(threshold);\n  diffusion->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkImageActor> diffusionActor;\n  diffusionActor->GetMapper()->SetInputConnection(diffusion->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkCamera> camera;\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->AddActor(originalActor);\n  leftRenderer->SetActiveCamera(camera);\n  leftRenderer->ResetCamera();\n  leftRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->AddActor(diffusionActor);\n  rightRenderer->SetActiveCamera(camera);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(leftRenderer);\n  renderWindow->AddRenderer(rightRenderer);\n  renderWindow->SetWindowName(\"ImageAnisotropicDiffusion2D\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageAnisotropicDiffusion2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageAnisotropicDiffusion2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageAnisotropicDiffusion2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageAnisotropicDiffusion2D MACOSX_BUNDLE ImageAnisotropicDiffusion2D.cxx )\n  target_link_libraries(ImageAnisotropicDiffusion2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageAnisotropicDiffusion2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageAnisotropicDiffusion2D/#download-and-build-imageanisotropicdiffusion2d","title":"Download and Build ImageAnisotropicDiffusion2D","text":"

        Click here to download ImageAnisotropicDiffusion2D and its CMakeLists.txt file. Once the tarball ImageAnisotropicDiffusion2D.tar has been downloaded and extracted,

        cd ImageAnisotropicDiffusion2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageAnisotropicDiffusion2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageCheckerboard/","title":"ImageCheckerboard","text":"

        vtk-examples/Cxx/Images/ImageCheckerboard

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageCheckerboard/#description","title":"Description","text":"

        This example compares two images using a checkerboard pattern.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageCheckerboard/#code","title":"Code","text":"

        ImageCheckerboard.cxx

        #include <vtkImageCheckerboard.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input1Filename Input2Filename e.g. Ox.jpg Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the images.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader1;\n  reader1.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader1->SetFileName(argv[1]);\n\n  vtkSmartPointer<vtkImageReader2> reader2;\n  reader2.TakeReference(readerFactory->CreateImageReader2(argv[2]));\n  reader2->SetFileName(argv[2]);\n\n  vtkNew<vtkImageCheckerboard> checkerboardFilter;\n  checkerboardFilter->SetInputConnection(0, reader1->GetOutputPort());\n  checkerboardFilter->SetInputConnection(1, reader2->GetOutputPort());\n  checkerboardFilter->SetNumberOfDivisions(3, 3, 1);\n\n  // Visualize.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(checkerboardFilter->GetOutputPort());\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Wheat\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ImageCheckerboard\");\n  imageViewer->GetRenderWindow()->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageCheckerboard/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageCheckerboard)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingGeneral\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageCheckerboard: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageCheckerboard MACOSX_BUNDLE ImageCheckerboard.cxx )\n  target_link_libraries(ImageCheckerboard PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageCheckerboard\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageCheckerboard/#download-and-build-imagecheckerboard","title":"Download and Build ImageCheckerboard","text":"

        Click here to download ImageCheckerboard and its CMakeLists.txt file. Once the tarball ImageCheckerboard.tar has been downloaded and extracted,

        cd ImageCheckerboard/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageCheckerboard\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageCityBlockDistance/","title":"ImageCityBlockDistance","text":"

        vtk-examples/Cxx/Images/ImageCityBlockDistance

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageCityBlockDistance/#description","title":"Description","text":"

        Compute the Manhattan distance from every point to every black point in a binary image.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageCityBlockDistance/#code","title":"Code","text":"

        ImageCityBlockDistance.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageCityBlockDistance.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" BinaryImage e.g. Yinyang.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read file.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetOutputScalarTypeToShort();\n  castFilter->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageCityBlockDistance> cityBlockDistanceFilter;\n  cityBlockDistanceFilter->SetInputConnection(castFilter->GetOutputPort());\n  cityBlockDistanceFilter->SetDimensionality(2);\n  cityBlockDistanceFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageCast> inputCastFilter;\n  inputCastFilter->SetOutputScalarTypeToUnsignedChar();\n  inputCastFilter->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(inputCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageCast> distanceCastFilter;\n  distanceCastFilter->SetOutputScalarTypeToUnsignedChar();\n  distanceCastFilter->SetInputConnection(\n      cityBlockDistanceFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> distanceActor;\n  distanceActor->GetMapper()->SetInputConnection(\n      distanceCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double distanceViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->ResetCamera();\n  inputRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> distanceRenderer;\n  distanceRenderer->SetViewport(distanceViewport);\n  distanceRenderer->AddActor(distanceActor);\n  distanceRenderer->ResetCamera();\n  distanceRenderer->SetBackground(colors->GetColor3d(\"LightSkyBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(distanceRenderer);\n  renderWindow->SetWindowName(\"ImageCityBlockDistance\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageCityBlockDistance/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageCityBlockDistance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageCityBlockDistance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageCityBlockDistance MACOSX_BUNDLE ImageCityBlockDistance.cxx )\n  target_link_libraries(ImageCityBlockDistance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageCityBlockDistance\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageCityBlockDistance/#download-and-build-imagecityblockdistance","title":"Download and Build ImageCityBlockDistance","text":"

        Click here to download ImageCityBlockDistance and its CMakeLists.txt file. Once the tarball ImageCityBlockDistance.tar has been downloaded and extracted,

        cd ImageCityBlockDistance/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageCityBlockDistance\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageContinuousDilate3D/","title":"ImageContinuousDilate3D","text":"

        vtk-examples/Cxx/Images/ImageContinuousDilate3D

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageContinuousDilate3D/#code","title":"Code","text":"

        ImageContinuousDilate3D.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageContinuousDilate3D.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> image;\n\n  if (argc < 2)\n  {\n    std::array<double, 3> drawColor1{0, 0, 0};\n    std::array<double, 3> drawColor2{0, 0, 0};\n    auto color1 = colors->GetColor3ub(\"Black\").GetData();\n    auto color2 = colors->GetColor3ub(\"Red\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n    }\n\n    // Create an image\n    vtkNew<vtkImageCanvasSource2D> source;\n    source->SetScalarTypeToUnsignedChar();\n    source->SetExtent(0, 200, 0, 200, 0, 0);\n    source->SetDrawColor(drawColor1.data());\n    source->FillBox(0, 200, 0, 200);\n    source->SetDrawColor(drawColor2.data());\n    source->FillBox(100, 150, 100, 150);\n    source->Update();\n    image->ShallowCopy(source->GetOutput());\n  }\n  else\n  {\n    vtkNew<vtkPNGReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    image->ShallowCopy(reader->GetOutput());\n  }\n\n  vtkNew<vtkImageContinuousDilate3D> dilateFilter;\n  dilateFilter->SetInputData(image);\n  dilateFilter->SetKernelSize(10, 10, 1);\n  dilateFilter->Update();\n\n  vtkNew<vtkDataSetMapper> originalMapper;\n  originalMapper->SetInputData(image);\n  originalMapper->Update();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n\n  vtkNew<vtkDataSetMapper> dilatedMapper;\n  dilatedMapper->SetInputConnection(dilateFilter->GetOutputPort());\n  dilatedMapper->Update();\n\n  vtkNew<vtkActor> dilatedActor;\n  dilatedActor->SetMapper(dilatedMapper);\n\n  // Visualize\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"ImageContinuousDilate3D\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  leftRenderer->AddActor(originalActor);\n  rightRenderer->AddActor(dilatedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageContinuousDilate3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageContinuousDilate3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingMorphological\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageContinuousDilate3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageContinuousDilate3D MACOSX_BUNDLE ImageContinuousDilate3D.cxx )\n  target_link_libraries(ImageContinuousDilate3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageContinuousDilate3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageContinuousDilate3D/#download-and-build-imagecontinuousdilate3d","title":"Download and Build ImageContinuousDilate3D","text":"

        Click here to download ImageContinuousDilate3D and its CMakeLists.txt file. Once the tarball ImageContinuousDilate3D.tar has been downloaded and extracted,

        cd ImageContinuousDilate3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageContinuousDilate3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageContinuousErode3D/","title":"ImageContinuousErode3D","text":"

        vtk-examples/Cxx/Images/ImageContinuousErode3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageContinuousErode3D/#code","title":"Code","text":"

        ImageContinuousErode3D.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageContinuousErode3D.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> image;\n\n  if (argc < 2)\n  {\n    std::array<double, 3> drawColor1{0, 0, 0};\n    std::array<double, 3> drawColor2{0, 0, 0};\n    auto color1 = colors->GetColor3ub(\"Black\").GetData();\n    auto color2 = colors->GetColor3ub(\"Red\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n    }\n\n    // Create an image\n    vtkNew<vtkImageCanvasSource2D> source;\n    source->SetScalarTypeToUnsignedChar();\n    source->SetExtent(0, 200, 0, 200, 0, 0);\n    source->SetDrawColor(drawColor1.data());\n    source->FillBox(0, 200, 0, 200);\n    source->SetDrawColor(drawColor2.data());\n    source->FillBox(100, 150, 100, 150);\n    source->Update();\n    image->ShallowCopy(source->GetOutput());\n  }\n  else\n  {\n    vtkNew<vtkPNGReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    image->ShallowCopy(reader->GetOutput());\n  }\n\n  vtkNew<vtkImageContinuousErode3D> erodeFilter;\n  erodeFilter->SetInputData(image);\n  erodeFilter->SetKernelSize(10, 10, 1);\n  erodeFilter->Update();\n\n  vtkNew<vtkDataSetMapper> originalMapper;\n  originalMapper->SetInputData(image);\n  originalMapper->Update();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n\n  vtkNew<vtkDataSetMapper> erodedMapper;\n  erodedMapper->SetInputConnection(erodeFilter->GetOutputPort());\n  erodedMapper->Update();\n\n  vtkNew<vtkActor> erodedActor;\n  erodedActor->SetMapper(erodedMapper);\n\n  // Visualize\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"ImageContinuousErode3D\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  leftRenderer->AddActor(originalActor);\n  rightRenderer->AddActor(erodedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageContinuousErode3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageContinuousErode3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingMorphological\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageContinuousErode3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageContinuousErode3D MACOSX_BUNDLE ImageContinuousErode3D.cxx )\n  target_link_libraries(ImageContinuousErode3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageContinuousErode3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageContinuousErode3D/#download-and-build-imagecontinuouserode3d","title":"Download and Build ImageContinuousErode3D","text":"

        Click here to download ImageContinuousErode3D and its CMakeLists.txt file. Once the tarball ImageContinuousErode3D.tar has been downloaded and extracted,

        cd ImageContinuousErode3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageContinuousErode3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageConvolve/","title":"ImageConvolve","text":"

        vtk-examples/Cxx/Images/ImageConvolve

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageConvolve/#code","title":"Code","text":"

        ImageConvolve.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageConvolve.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> originalCastFilter;\n  originalCastFilter->SetInputConnection(source->GetOutputPort());\n  originalCastFilter->SetOutputScalarTypeToUnsignedChar();\n  originalCastFilter->Update();\n\n  vtkNew<vtkImageConvolve> convolveFilter;\n  convolveFilter->SetInputConnection(source->GetOutputPort());\n  double kernel[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1};\n  convolveFilter->SetKernel3x3(kernel);\n  convolveFilter->Update();\n\n  vtkNew<vtkImageCast> convolvedCastFilter;\n  convolvedCastFilter->SetInputConnection(convolveFilter->GetOutputPort());\n  convolvedCastFilter->SetOutputScalarTypeToUnsignedChar();\n  convolvedCastFilter->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(\n      originalCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> convolvedActor;\n  convolvedActor->GetMapper()->SetInputConnection(\n      convolvedCastFilter->GetOutputPort());\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderer\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(leftViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n  originalRenderer->ResetCamera();\n\n  vtkNew<vtkRenderer> convolvedRenderer;\n  convolvedRenderer->SetViewport(rightViewport);\n  convolvedRenderer->AddActor(convolvedActor);\n  convolvedRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n  convolvedRenderer->ResetCamera();\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(convolvedRenderer);\n  renderWindow->SetWindowName(\"ImageConvolve\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageConvolve/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageConvolve)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageConvolve: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageConvolve MACOSX_BUNDLE ImageConvolve.cxx )\n  target_link_libraries(ImageConvolve PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageConvolve\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageConvolve/#download-and-build-imageconvolve","title":"Download and Build ImageConvolve","text":"

        Click here to download ImageConvolve and its CMakeLists.txt file. Once the tarball ImageConvolve.tar has been downloaded and extracted,

        cd ImageConvolve/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageConvolve\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageCorrelation/","title":"ImageCorrelation","text":"

        vtk-examples/Cxx/Images/ImageCorrelation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageCorrelation/#code","title":"Code","text":"

        ImageCorrelation.cxx

        #include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageCast.h>\n#include <vtkImageCorrelation.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageShiftScale.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Black\").GetData();\n  auto color2 = colors->GetColor3ub(\"Wheat\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create an image\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 300, 0, 300, 0, 0);\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(0, 300, 0, 300);\n  imageSource->SetDrawColor(drawColor2.data());\n  imageSource->FillTriangle(10, 100, 190, 150, 40, 250);\n  imageSource->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  // Create a kernel\n  vtkNew<vtkImageCanvasSource2D> kernelSource;\n  kernelSource->SetNumberOfScalarComponents(3);\n  kernelSource->SetScalarTypeToUnsignedChar();\n  kernelSource->SetExtent(0, 30, 0, 30, 0, 0);\n  kernelSource->SetDrawColor(drawColor1.data());\n  kernelSource->FillBox(0, 30, 0, 30);\n  kernelSource->SetDrawColor(drawColor2.data());\n  kernelSource->FillTriangle(10, 1, 25, 10, 1, 5);\n  kernelSource->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> kernelActor;\n  kernelActor->GetMapper()->SetInputConnection(kernelSource->GetOutputPort());\n\n  // Compute the correlation\n  vtkNew<vtkImageCorrelation> correlationFilter;\n  correlationFilter->SetInputConnection(0, imageSource->GetOutputPort());\n  correlationFilter->SetInputConnection(1, kernelSource->GetOutputPort());\n  correlationFilter->Update();\n\n  // At this point, corr pixels are doubles\n  // So, get the scalar range\n  vtkImageData* corr = correlationFilter->GetOutput();\n  double corrRange[2];\n  corr->GetPointData()->GetScalars()->GetRange(corrRange);\n\n  // Rescale the correlation filter output. note that it implies\n  // that minimum correlation is always zero.\n  vtkNew<vtkImageShiftScale> imageScale;\n  imageScale->SetInputConnection(correlationFilter->GetOutputPort());\n  imageScale->SetScale(255 / corrRange[1]);\n  imageScale->SetOutputScalarTypeToUnsignedChar();\n  imageScale->Update();\n\n  vtkNew<vtkImageCast> correlationCastFilter;\n  correlationCastFilter->SetInputConnection(imageScale->GetOutputPort());\n  correlationCastFilter->SetOutputScalarTypeToUnsignedChar();\n  correlationCastFilter->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> correlationActor;\n  correlationActor->GetMapper()->SetInputConnection(\n      correlationCastFilter->GetOutputPort());\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double kernelViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double correlationViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> kernelRenderer;\n  kernelRenderer->SetViewport(kernelViewport);\n  kernelRenderer->AddActor(kernelActor);\n  kernelRenderer->ResetCamera();\n  kernelRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> correlationRenderer;\n  correlationRenderer->SetViewport(correlationViewport);\n  correlationRenderer->AddActor(correlationActor);\n  correlationRenderer->ResetCamera();\n  correlationRenderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(kernelRenderer);\n  renderWindow->AddRenderer(correlationRenderer);\n  renderWindow->SetWindowName(\"ImageCorrelation\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageCorrelation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageCorrelation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageCorrelation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageCorrelation MACOSX_BUNDLE ImageCorrelation.cxx )\n  target_link_libraries(ImageCorrelation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageCorrelation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageCorrelation/#download-and-build-imagecorrelation","title":"Download and Build ImageCorrelation","text":"

        Click here to download ImageCorrelation and its CMakeLists.txt file. Once the tarball ImageCorrelation.tar has been downloaded and extracted,

        cd ImageCorrelation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageCorrelation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageDifference/","title":"ImageDifference","text":"

        vtk-examples/Cxx/Images/ImageDifference

        "},{"location":"Cxx/Images/ImageDifference/#description","title":"Description","text":"

        This example makes a large square and a smaller square and subtracts them, leaving the outline of a square.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageDifference/#code","title":"Code","text":"

        ImageDifference.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageDifference.h>\n#include <vtkImageMapper3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Black\").GetData();\n  auto color2 = colors->GetColor3ub(\"Wheat\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create an image\n  vtkNew<vtkImageCanvasSource2D> source1;\n  source1->SetScalarTypeToUnsignedChar();\n  source1->SetNumberOfScalarComponents(3);\n  source1->SetExtent(0, 100, 0, 100, 0, 0);\n  source1->SetDrawColor(drawColor1.data());\n  source1->FillBox(0, 100, 0, 100);\n  source1->SetDrawColor(drawColor2.data());\n  source1->FillBox(10, 90, 10, 90);\n  source1->Update();\n\n  // Create another image\n  vtkNew<vtkImageCanvasSource2D> source2;\n  source2->SetScalarTypeToUnsignedChar();\n  source2->SetNumberOfScalarComponents(3);\n  source2->SetExtent(0, 100, 0, 100, 0, 0);\n  source2->SetDrawColor(drawColor1.data());\n  source2->FillBox(0, 100, 0, 100);\n  source2->SetDrawColor(drawColor2.data());\n  source2->FillBox(20, 80, 20, 80);\n  source2->Update();\n\n  vtkNew<vtkImageDifference> differenceFilter;\n\n  differenceFilter->SetInputConnection(source1->GetOutputPort());\n  differenceFilter->SetImageConnection(source2->GetOutputPort());\n  differenceFilter->Update();\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  // Setup renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  vtkNew<vtkImageActor> leftActor;\n  leftActor->GetMapper()->SetInputConnection(source1->GetOutputPort());\n\n  leftRenderer->AddActor(leftActor);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  vtkNew<vtkImageActor> centerActor;\n  centerActor->GetMapper()->SetInputConnection(source2->GetOutputPort());\n\n  centerRenderer->AddActor(centerActor);\n  centerRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"Peacock\").GetData());\n  vtkNew<vtkImageActor> rightActor;\n  rightActor->GetMapper()->SetInputConnection(\n      differenceFilter->GetOutputPort());\n  rightRenderer->AddActor(rightActor);\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetSize(300, 100);\n  renderWindow->SetWindowName(\"ImageDifference\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageDifference/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDifference)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDifference: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDifference MACOSX_BUNDLE ImageDifference.cxx )\n  target_link_libraries(ImageDifference PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDifference\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageDifference/#download-and-build-imagedifference","title":"Download and Build ImageDifference","text":"

        Click here to download ImageDifference and its CMakeLists.txt file. Once the tarball ImageDifference.tar has been downloaded and extracted,

        cd ImageDifference/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageDifference\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageDilateErode3D/","title":"ImageDilateErode3D","text":"

        vtk-examples/Cxx/Images/ImageDilateErode3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageDilateErode3D/#description","title":"Description","text":"

        This example reads in a binary image and dilates one value and erodes another (morphological operations).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageDilateErode3D/#code","title":"Code","text":"

        ImageDilateErode3D.cxx

        #include <vtkImageActor.h>\n#include <vtkImageDilateErode3D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename.png e.g. Yinyang.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageDilateErode3D> dilateErode;\n  dilateErode->SetInputConnection(reader->GetOutputPort());\n  dilateErode->SetDilateValue(0);\n  dilateErode->SetErodeValue(255);\n  dilateErode->SetKernelSize(5, 5, 3);\n  dilateErode->ReleaseDataFlagOff();\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> openCloseActor;\n  openCloseActor->GetMapper()->SetInputConnection(dilateErode->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double openCloseViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> dilateErodeRenderer;\n  dilateErodeRenderer->SetViewport(openCloseViewport);\n  dilateErodeRenderer->AddActor(openCloseActor);\n  dilateErodeRenderer->ResetCamera();\n  dilateErodeRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(dilateErodeRenderer);\n  renderWindow->SetWindowName(\"ImageDilateErode3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageDilateErode3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDilateErode3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingMorphological\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDilateErode3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDilateErode3D MACOSX_BUNDLE ImageDilateErode3D.cxx )\n  target_link_libraries(ImageDilateErode3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDilateErode3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageDilateErode3D/#download-and-build-imagedilateerode3d","title":"Download and Build ImageDilateErode3D","text":"

        Click here to download ImageDilateErode3D and its CMakeLists.txt file. Once the tarball ImageDilateErode3D.tar has been downloaded and extracted,

        cd ImageDilateErode3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageDilateErode3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageDivergence/","title":"ImageDivergence","text":"

        vtk-examples/Cxx/Images/ImageDivergence

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageDivergence/#code","title":"Code","text":"

        ImageDivergence.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageDivergence.h>\n#include <vtkImageGradient.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> originalCastFilter;\n  originalCastFilter->SetInputConnection(source->GetOutputPort());\n  originalCastFilter->SetOutputScalarTypeToFloat();\n  originalCastFilter->Update();\n\n  // Compute the gradient (to produce a vector field).\n  vtkNew<vtkImageGradient> gradientFilter;\n  gradientFilter->SetInputConnection(source->GetOutputPort());\n  gradientFilter->Update();\n\n  vtkNew<vtkImageDivergence> divergenceFilter;\n  divergenceFilter->SetInputConnection(gradientFilter->GetOutputPort());\n  divergenceFilter->Update();\n\n  vtkNew<vtkImageCast> divergenceCastFilter;\n  divergenceCastFilter->SetInputConnection(divergenceFilter->GetOutputPort());\n  divergenceCastFilter->SetOutputScalarTypeToFloat();\n  divergenceCastFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(\n      originalCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> divergenceActor;\n  divergenceActor->GetMapper()->SetInputConnection(\n      divergenceCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(leftViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> divergenceRenderer;\n  divergenceRenderer->SetViewport(rightViewport);\n  divergenceRenderer->AddActor(divergenceActor);\n  divergenceRenderer->ResetCamera();\n  divergenceRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(divergenceRenderer);\n  renderWindow->SetWindowName(\"ImageDivergence\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageDivergence/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDivergence)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDivergence: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDivergence MACOSX_BUNDLE ImageDivergence.cxx )\n  target_link_libraries(ImageDivergence PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDivergence\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageDivergence/#download-and-build-imagedivergence","title":"Download and Build ImageDivergence","text":"

        Click here to download ImageDivergence and its CMakeLists.txt file. Once the tarball ImageDivergence.tar has been downloaded and extracted,

        cd ImageDivergence/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageDivergence\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageEllipsoidSource/","title":"ImageEllipsoidSource","text":"

        vtk-examples/Cxx/Images/ImageEllipsoidSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageEllipsoidSource/#code","title":"Code","text":"

        ImageEllipsoidSource.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 5);\n  source->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageEllipsoidSource\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageEllipsoidSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageEllipsoidSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageEllipsoidSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageEllipsoidSource MACOSX_BUNDLE ImageEllipsoidSource.cxx )\n  target_link_libraries(ImageEllipsoidSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageEllipsoidSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageEllipsoidSource/#download-and-build-imageellipsoidsource","title":"Download and Build ImageEllipsoidSource","text":"

        Click here to download ImageEllipsoidSource and its CMakeLists.txt file. Once the tarball ImageEllipsoidSource.tar has been downloaded and extracted,

        cd ImageEllipsoidSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageEllipsoidSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageExport/","title":"ImageExport","text":"

        vtk-examples/Cxx/Images/ImageExport

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageExport/#code","title":"Code","text":"

        ImageExport.cxx

        #include <vtkImageData.h>\n#include <vtkImageExport.h>\n#include <vtkNew.h>\n\n#include <memory>\n\nint main(int, char*[])\n{\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  constexpr int dims[3] = {2, 3, 1};\n\n  imageData->SetDimensions(dims[0], dims[1], dims[2]);\n  imageData->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  unsigned char value = 0;\n  for (int row = 0; row < dims[0]; ++row)\n  {\n    for (int col = 0; col < dims[1]; ++col)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(imageData->GetScalarPointer(row, col, 0));\n      pixel[0] = value;\n      value += 10;\n    }\n  }\n\n  // Create the c-style image to convert the VTK image to\n  std::unique_ptr<unsigned char> cImage(\n      new unsigned char[dims[0] * dims[1] * dims[2]]);\n\n  vtkNew<vtkImageExport> exporter;\n  exporter->SetInputData(imageData);\n  exporter->ImageLowerLeftOn();\n  exporter->Export(cImage.get());\n  exporter->Update();\n\n  // Output the raw c-style image\n  for (int row = 0; row < dims[0]; ++row)\n  {\n    for (int col = 0; col < dims[1]; ++col)\n    {\n      std::cout << static_cast<int>(cImage.get()[col * dims[0] + row]) << \" \";\n    }\n    std::cout << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageExport/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageExport)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageExport: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageExport MACOSX_BUNDLE ImageExport.cxx )\n  target_link_libraries(ImageExport PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageExport\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageExport/#download-and-build-imageexport","title":"Download and Build ImageExport","text":"

        Click here to download ImageExport and its CMakeLists.txt file. Once the tarball ImageExport.tar has been downloaded and extracted,

        cd ImageExport/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageExport\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageFFT/","title":"ImageFFT","text":"

        vtk-examples/Cxx/Images/ImageFFT

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageFFT/#code","title":"Code","text":"

        ImageFFT.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageFFT.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageFFT> fftFilter;\n  fftFilter->SetInputConnection(source->GetOutputPort());\n  fftFilter->Update();\n\n  vtkNew<vtkImageCast> fftCastFilter;\n  fftCastFilter->SetInputConnection(fftFilter->GetOutputPort());\n  fftCastFilter->SetOutputScalarTypeToUnsignedChar();\n  fftCastFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> fftActor;\n  fftActor->GetMapper()->SetInputConnection(fftCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double fftViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(.4, .5, .6);\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> fftRenderer;\n  fftRenderer->SetViewport(fftViewport);\n  fftRenderer->AddActor(fftActor);\n  fftRenderer->ResetCamera();\n  fftRenderer->SetBackground(.4, .5, .7);\n  fftRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(fftRenderer);\n  renderWindow->SetWindowName(\"ImageFFT\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageFFT/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageFFT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingFourier\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageFFT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageFFT MACOSX_BUNDLE ImageFFT.cxx )\n  target_link_libraries(ImageFFT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageFFT\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageFFT/#download-and-build-imagefft","title":"Download and Build ImageFFT","text":"

        Click here to download ImageFFT and its CMakeLists.txt file. Once the tarball ImageFFT.tar has been downloaded and extracted,

        cd ImageFFT/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageFFT\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageGaussianSmooth/","title":"ImageGaussianSmooth","text":"

        vtk-examples/Cxx/Images/ImageGaussianSmooth

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageGaussianSmooth/#code","title":"Code","text":"

        ImageGaussianSmooth.cxx

        #include <vtkImageActor.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageGaussianSmooth> gaussianSmoothFilter;\n  gaussianSmoothFilter->SetInputConnection(source->GetOutputPort());\n  gaussianSmoothFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> smoothedActor;\n  smoothedActor->GetMapper()->SetInputConnection(\n      gaussianSmoothFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double smoothedViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> gradientMagnitudeRenderer;\n  gradientMagnitudeRenderer->SetViewport(smoothedViewport);\n  gradientMagnitudeRenderer->AddActor(smoothedActor);\n  gradientMagnitudeRenderer->ResetCamera();\n  gradientMagnitudeRenderer->SetBackground(\n      colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(gradientMagnitudeRenderer);\n  renderWindow->SetWindowName(\"ImageGaussianSmooth\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageGaussianSmooth/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageGaussianSmooth)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageGaussianSmooth: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageGaussianSmooth MACOSX_BUNDLE ImageGaussianSmooth.cxx )\n  target_link_libraries(ImageGaussianSmooth PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageGaussianSmooth\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageGaussianSmooth/#download-and-build-imagegaussiansmooth","title":"Download and Build ImageGaussianSmooth","text":"

        Click here to download ImageGaussianSmooth and its CMakeLists.txt file. Once the tarball ImageGaussianSmooth.tar has been downloaded and extracted,

        cd ImageGaussianSmooth/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageGaussianSmooth\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageGradientMagnitude/","title":"ImageGradientMagnitude","text":"

        vtk-examples/Cxx/Images/ImageGradientMagnitude

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageGradientMagnitude/#code","title":"Code","text":"

        ImageGradientMagnitude.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageGradientMagnitude.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageGradientMagnitude> gradientMagnitudeFilter;\n  gradientMagnitudeFilter->SetInputConnection(source->GetOutputPort());\n  gradientMagnitudeFilter->Update();\n\n  vtkNew<vtkImageCast> gradientMagnitudeCastFilter;\n  gradientMagnitudeCastFilter->SetInputConnection(\n      gradientMagnitudeFilter->GetOutputPort());\n  gradientMagnitudeCastFilter->SetOutputScalarTypeToUnsignedChar();\n  gradientMagnitudeCastFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> gradientMagnitudeActor;\n  gradientMagnitudeActor->GetMapper()->SetInputConnection(\n      gradientMagnitudeCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double gradientMagnitudeViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> gradientMagnitudeRenderer;\n  gradientMagnitudeRenderer->SetViewport(gradientMagnitudeViewport);\n  gradientMagnitudeRenderer->AddActor(gradientMagnitudeActor);\n  gradientMagnitudeRenderer->ResetCamera();\n  gradientMagnitudeRenderer->SetBackground(\n      colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(gradientMagnitudeRenderer);\n  renderWindow->SetWindowName(\"ImageGradientMagnitude\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageGradientMagnitude/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageGradientMagnitude)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageGradientMagnitude: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageGradientMagnitude MACOSX_BUNDLE ImageGradientMagnitude.cxx )\n  target_link_libraries(ImageGradientMagnitude PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageGradientMagnitude\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageGradientMagnitude/#download-and-build-imagegradientmagnitude","title":"Download and Build ImageGradientMagnitude","text":"

        Click here to download ImageGradientMagnitude and its CMakeLists.txt file. Once the tarball ImageGradientMagnitude.tar has been downloaded and extracted,

        cd ImageGradientMagnitude/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageGradientMagnitude\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageGridSource/","title":"ImageGridSource","text":"

        vtk-examples/Cxx/Images/ImageGridSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageGridSource/#code","title":"Code","text":"

        ImageGridSource.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageGridSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageGridSource> source;\n  source->SetFillValue(122);\n  source->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageGridSource\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageGridSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageGridSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageGridSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageGridSource MACOSX_BUNDLE ImageGridSource.cxx )\n  target_link_libraries(ImageGridSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageGridSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageGridSource/#download-and-build-imagegridsource","title":"Download and Build ImageGridSource","text":"

        Click here to download ImageGridSource and its CMakeLists.txt file. Once the tarball ImageGridSource.tar has been downloaded and extracted,

        cd ImageGridSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageGridSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageHistogram/","title":"ImageHistogram","text":"

        vtk-examples/Cxx/Images/ImageHistogram

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageHistogram/#code","title":"Code","text":"

        ImageHistogram.cxx

        #include <vtkCamera.h>\n#include <vtkImageData.h>\n#include <vtkImageHistogram.h>\n#include <vtkImageProperty.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename e.g. Pileated.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkInteractorStyle> style;\n  vtkNew<vtkRenderWindow> renWin;\n  iren->SetRenderWindow(renWin);\n  iren->SetInteractorStyle(style);\n\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageHistogram> histogram;\n  histogram->SetInputConnection(reader->GetOutputPort());\n  histogram->GenerateHistogramImageOn();\n  histogram->SetHistogramImageSize(256, 256);\n  histogram->SetHistogramImageScaleToSqrt();\n  histogram->AutomaticBinningOn();\n  histogram->Update();\n\n  vtkIdType nbins = histogram->GetNumberOfBins();\n  double range[2];\n  range[0] = histogram->GetBinOrigin();\n  range[1] = range[0] + (nbins - 1) * histogram->GetBinSpacing();\n\n  for (int i = 0; i < 2; i++)\n  {\n    vtkNew<vtkRenderer> renderer;\n    vtkCamera* camera = renderer->GetActiveCamera();\n    renderer->SetViewport(0.5 * (i & 1), 0.0, 0.5 + 0.5 * (i & 1), 1.0);\n    renWin->AddRenderer(renderer);\n\n    vtkNew<vtkImageSliceMapper> imageMapper;\n    // compute y range\n    double yd;\n    if ((i & 1) == 0)\n    {\n      imageMapper->SetInputConnection(reader->GetOutputPort());\n      int extent[6];\n      reader->GetOutput()->GetExtent(extent);\n      yd = (extent[3] - extent[2] + 1);\n    }\n    else\n    {\n      imageMapper->SetInputConnection(histogram->GetOutputPort());\n      imageMapper->BorderOn();\n      int extent[6];\n      histogram->GetOutput()->GetExtent(extent);\n      yd = (extent[3] - extent[2] + 1);\n    }\n\n    const double* bounds = imageMapper->GetBounds();\n    double point[3];\n    point[0] = 0.5 * (bounds[0] + bounds[1]);\n    point[1] = 0.5 * (bounds[2] + bounds[3]);\n    point[2] = 0.5 * (bounds[4] + bounds[5]);\n\n    camera->SetFocalPoint(point);\n    point[imageMapper->GetOrientation()] += 1000;\n    camera->SetPosition(point);\n    camera->SetViewUp(0.0, 1.0, 0.0);\n    camera->ParallelProjectionOn();\n    // Set scale so that vertical dimension fills the window\n    camera->SetParallelScale(0.5 * yd);\n\n    vtkNew<vtkImageSlice> image;\n    image->SetMapper(imageMapper);\n\n    renderer->AddViewProp(image);\n\n    if ((i & 1) == 0)\n    {\n      image->GetProperty()->SetColorWindow(range[1] - range[0]);\n      image->GetProperty()->SetColorLevel(0.5 * (range[0] + range[1]));\n    }\n    else\n    {\n      image->GetProperty()->SetInterpolationTypeToNearest();\n      image->GetProperty()->SetColorWindow(255.0);\n      image->GetProperty()->SetColorLevel(127.5);\n    }\n  }\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ImageHistogram\");\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageHistogram/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageHistogram)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingStatistics\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageHistogram: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageHistogram MACOSX_BUNDLE ImageHistogram.cxx )\n  target_link_libraries(ImageHistogram PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageHistogram\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageHistogram/#download-and-build-imagehistogram","title":"Download and Build ImageHistogram","text":"

        Click here to download ImageHistogram and its CMakeLists.txt file. Once the tarball ImageHistogram.tar has been downloaded and extracted,

        cd ImageHistogram/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageHistogram\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageHybridMedian2D/","title":"ImageHybridMedian2D","text":"

        vtk-examples/Cxx/Images/ImageHybridMedian2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageHybridMedian2D/#description","title":"Description","text":"

        This example reads in an image and performs median filtering on it. The input and output are displayed.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageHybridMedian2D/#code","title":"Code","text":"

        ImageHybridMedian2D.cxx

        #include <vtkImageActor.h>\n#include <vtkImageHybridMedian2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename.png e.g Gourds.png\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageHybridMedian2D> hybridMedian;\n  hybridMedian->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> hybridMedianActor;\n  hybridMedianActor->GetMapper()->SetInputConnection(\n      hybridMedian->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double hybridMedianViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> hybridMedianRenderer;\n  hybridMedianRenderer->SetViewport(hybridMedianViewport);\n  hybridMedianRenderer->AddActor(hybridMedianActor);\n  hybridMedianRenderer->ResetCamera();\n  hybridMedianRenderer->SetBackground(\n      colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(hybridMedianRenderer);\n  renderWindow->SetWindowName(\"ImageHybridMedian2D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageHybridMedian2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageHybridMedian2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageHybridMedian2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageHybridMedian2D MACOSX_BUNDLE ImageHybridMedian2D.cxx )\n  target_link_libraries(ImageHybridMedian2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageHybridMedian2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageHybridMedian2D/#download-and-build-imagehybridmedian2d","title":"Download and Build ImageHybridMedian2D","text":"

        Click here to download ImageHybridMedian2D and its CMakeLists.txt file. Once the tarball ImageHybridMedian2D.tar has been downloaded and extracted,

        cd ImageHybridMedian2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageHybridMedian2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageIdealHighPass/","title":"ImageIdealHighPass","text":"

        vtk-examples/Cxx/Images/ImageIdealHighPass

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageIdealHighPass/#code","title":"Code","text":"

        ImageIdealHighPass.cxx

        #include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageFFT.h>\n#include <vtkImageIdealHighPass.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageRFFT.h>\n#include <vtkImageShiftScale.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageMandelbrotSource> mandelbrotSource;\n  mandelbrotSource->Update();\n\n  // Display the original image\n  vtkNew<vtkImageCast> originalCastFilter;\n  originalCastFilter->SetInputConnection(mandelbrotSource->GetOutputPort());\n  originalCastFilter->SetOutputScalarTypeToUnsignedChar();\n  originalCastFilter->Update();\n\n  vtkNew<vtkImageSliceMapper> originalSliceMapper;\n  originalSliceMapper->SetInputConnection(originalCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageSlice> originalSlice;\n  originalSlice->SetMapper(originalSliceMapper);\n\n  // Compute the FFT of the image\n  vtkNew<vtkImageFFT> fftFilter;\n  fftFilter->SetInputConnection(originalCastFilter->GetOutputPort());\n  fftFilter->Update();\n\n  // High pass filter the FFT\n  vtkNew<vtkImageIdealHighPass> highPassFilter;\n  highPassFilter->SetInputConnection(fftFilter->GetOutputPort());\n  highPassFilter->SetXCutOff(.1);\n  highPassFilter->SetYCutOff(.1);\n  highPassFilter->Update();\n\n  // Compute the IFFT of the high pass filtered image\n  vtkNew<vtkImageRFFT> rfftFilter;\n  rfftFilter->SetInputConnection(highPassFilter->GetOutputPort());\n  rfftFilter->Update();\n\n  vtkNew<vtkImageExtractComponents> extractRealFilter;\n  extractRealFilter->SetInputConnection(rfftFilter->GetOutputPort());\n  extractRealFilter->SetComponents(0);\n  extractRealFilter->Update();\n\n  vtkNew<vtkImageShiftScale> shiftScaleFilter;\n  shiftScaleFilter->SetOutputScalarTypeToUnsignedChar();\n  shiftScaleFilter->SetInputConnection(extractRealFilter->GetOutputPort());\n  shiftScaleFilter->SetShift(\n      -1.0f *\n      extractRealFilter->GetOutput()\n          ->GetScalarRange()[0]); // brings the lower bound to 0\n  float oldRange = extractRealFilter->GetOutput()->GetScalarRange()[1] -\n      extractRealFilter->GetOutput()->GetScalarRange()[0];\n  float newRange =\n      100; // We want the output [0,100] (the same as the original image)\n  shiftScaleFilter->SetScale(newRange / oldRange);\n  shiftScaleFilter->Update();\n\n  // Cast the output back to unsigned char\n  vtkNew<vtkImageCast> outputCastFilter;\n  outputCastFilter->SetInputConnection(shiftScaleFilter->GetOutputPort());\n  outputCastFilter->SetOutputScalarTypeToUnsignedChar();\n  outputCastFilter->Update();\n\n  // Display the high pass filtered image\n  vtkNew<vtkImageSliceMapper> highPassSliceMapper;\n  highPassSliceMapper->SetInputConnection(outputCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageSlice> highPassSlice;\n  highPassSlice->SetMapper(highPassSliceMapper);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double highPassViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddViewProp(originalSlice);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(.4, .5, .6);\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> highPassRenderer;\n  highPassRenderer->SetViewport(highPassViewport);\n  highPassRenderer->AddViewProp(highPassSlice);\n  highPassRenderer->ResetCamera();\n  highPassRenderer->SetBackground(.4, .5, .7);\n  highPassRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(highPassRenderer);\n  renderWindow->SetWindowName(\"ImageIdealHighPass\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageIdealHighPass/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageIdealHighPass)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingFourier\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageIdealHighPass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageIdealHighPass MACOSX_BUNDLE ImageIdealHighPass.cxx )\n  target_link_libraries(ImageIdealHighPass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageIdealHighPass\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageIdealHighPass/#download-and-build-imageidealhighpass","title":"Download and Build ImageIdealHighPass","text":"

        Click here to download ImageIdealHighPass and its CMakeLists.txt file. Once the tarball ImageIdealHighPass.tar has been downloaded and extracted,

        cd ImageIdealHighPass/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageIdealHighPass\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageImport/","title":"ImageImport","text":"

        vtk-examples/Cxx/Images/ImageImport

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageImport/#code","title":"Code","text":"

        ImageImport.cxx

        #include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageImport.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLImageDataWriter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a c-style image\n  constexpr int width = 4;\n  constexpr int height = 4;\n\n  unsigned char cImage[width * height];\n  unsigned char value = 0;\n  for (unsigned int row = 0; row < height; ++row)\n  {\n    for (unsigned int col = 0; col < width; ++col)\n    {\n      cImage[row * width + col] = value;\n      value += 10;\n    }\n  }\n\n  // Convert the c-style image to a vtkImageData\n  vtkNew<vtkImageImport> imageImport;\n  imageImport->SetDataSpacing(1, 1, 1);\n  imageImport->SetDataOrigin(0, 0, 0);\n  imageImport->SetWholeExtent(0, width - 1, 0, height - 1, 0, 0);\n  imageImport->SetDataExtentToWholeExtent();\n  imageImport->SetDataScalarTypeToUnsignedChar();\n  imageImport->SetNumberOfScalarComponents(1);\n  imageImport->SetImportVoidPointer(cImage);\n  imageImport->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> actor;\n  actor->SetInputData(imageImport->GetOutput());\n\n  // Setup renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SaddleBrown\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageImport\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageImport/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageImport)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageImport: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageImport MACOSX_BUNDLE ImageImport.cxx )\n  target_link_libraries(ImageImport PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageImport\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageImport/#download-and-build-imageimport","title":"Download and Build ImageImport","text":"

        Click here to download ImageImport and its CMakeLists.txt file. Once the tarball ImageImport.tar has been downloaded and extracted,

        cd ImageImport/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageImport\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageIslandRemoval2D/","title":"ImageIslandRemoval2D","text":"

        vtk-examples/Cxx/Images/ImageIslandRemoval2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageIslandRemoval2D/#description","title":"Description","text":"

        This example creates a small white square and a big white square. We want the ImageIslandRemoval2D to turn the small white square black and leave the big white square alone.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageIslandRemoval2D/#code","title":"Code","text":"

        ImageIslandRemoval2D.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageIslandRemoval2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetNumberOfScalarComponents(1);\n  imageSource->SetExtent(0, 200, 0, 200, 0, 0);\n\n  // Blank the image\n  imageSource->SetDrawColor(0.0);\n  imageSource->FillBox(0, 200, 0, 200);\n\n  // Draw a small box\n  imageSource->SetDrawColor(255.0);\n  imageSource->FillBox(100, 105, 100, 105);\n\n  // Draw a large box\n  imageSource->SetDrawColor(255.0);\n  imageSource->FillBox(150, 170, 150, 170);\n\n  imageSource->Update();\n\n  vtkNew<vtkImageIslandRemoval2D> islandRemovalFilter;\n  islandRemovalFilter->SetAreaThreshold(50);\n  islandRemovalFilter->SetIslandValue(255.0);\n  islandRemovalFilter->SetReplaceValue(0.0);\n  islandRemovalFilter->SetInputConnection(imageSource->GetOutputPort());\n  islandRemovalFilter->Update();\n\n  // Visualize\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> islandRemovalActor;\n  islandRemovalActor->GetMapper()->SetInputConnection(\n      islandRemovalFilter->GetOutputPort());\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double islandRemovalViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> islandRemovalRenderer;\n  islandRemovalRenderer->SetViewport(islandRemovalViewport);\n  islandRemovalRenderer->AddActor(islandRemovalActor);\n  islandRemovalRenderer->ResetCamera();\n  islandRemovalRenderer->SetBackground(\n      colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(islandRemovalRenderer);\n  renderWindow->SetWindowName(\"ImageIslandRemoval2D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageIslandRemoval2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageIslandRemoval2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingMorphological\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageIslandRemoval2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageIslandRemoval2D MACOSX_BUNDLE ImageIslandRemoval2D.cxx )\n  target_link_libraries(ImageIslandRemoval2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageIslandRemoval2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageIslandRemoval2D/#download-and-build-imageislandremoval2d","title":"Download and Build ImageIslandRemoval2D","text":"

        Click here to download ImageIslandRemoval2D and its CMakeLists.txt file. Once the tarball ImageIslandRemoval2D.tar has been downloaded and extracted,

        cd ImageIslandRemoval2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageIslandRemoval2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageLaplacian/","title":"ImageLaplacian","text":"

        vtk-examples/Cxx/Images/ImageLaplacian

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageLaplacian/#code","title":"Code","text":"

        ImageLaplacian.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageLaplacian.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> castOriginal;\n  castOriginal->SetInputConnection(source->GetOutputPort());\n  castOriginal->SetOutputScalarTypeToFloat();\n  castOriginal->Update();\n\n  vtkNew<vtkImageLaplacian> laplacianFilter;\n  laplacianFilter->SetInputConnection(source->GetOutputPort());\n  laplacianFilter->Update();\n\n  vtkNew<vtkImageCast> castLaplacian;\n  castLaplacian->SetInputConnection(laplacianFilter->GetOutputPort());\n  castLaplacian->SetOutputScalarTypeToFloat();\n  castLaplacian->Update();\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(castOriginal->GetOutputPort());\n\n  vtkNew<vtkImageActor> laplacianActor;\n  laplacianActor->GetMapper()->SetInputConnection(\n      castLaplacian->GetOutputPort());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"ImageLaplacian\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(leftViewport);\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> laplacianRenderer;\n  laplacianRenderer->SetViewport(rightViewport);\n  laplacianRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(laplacianRenderer);\n\n  originalRenderer->AddActor(originalActor);\n  laplacianRenderer->AddActor(laplacianActor);\n\n  originalRenderer->ResetCamera();\n  laplacianRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageLaplacian/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageLaplacian)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageLaplacian: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageLaplacian MACOSX_BUNDLE ImageLaplacian.cxx )\n  target_link_libraries(ImageLaplacian PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageLaplacian\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageLaplacian/#download-and-build-imagelaplacian","title":"Download and Build ImageLaplacian","text":"

        Click here to download ImageLaplacian and its CMakeLists.txt file. Once the tarball ImageLaplacian.tar has been downloaded and extracted,

        cd ImageLaplacian/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageLaplacian\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageLuminance/","title":"ImageLuminance","text":"

        vtk-examples/Cxx/Images/ImageLuminance

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageLuminance/#description","title":"Description","text":"

        There are two ways to convert images to greyscale:

        • vtkImageLuminance uses the luminance equation for properly weighting the R, G, and B components;

        • vtkImageMagnitude does a simple sum-of-squares computation of the components (i.e. the Euclidean norm -- not the quadratic mean!), and is meant for vector data.

        For an example of usage of the vtkImageMagnitude filter, see ImageMagnitude.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageLuminance/#code","title":"Code","text":"

        ImageLuminance.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageLuminance.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image of a rectangle.\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 200, 0, 200, 0, 0);\n\n  // Clear the image.\n  source->SetDrawColor(0, 0, 0);\n  source->FillBox(0, 200, 0, 200);\n\n  // Draw a red box.\n  source->SetDrawColor(255, 0, 0);\n  source->FillBox(100, 120, 100, 120);\n  source->Update();\n\n  vtkNew<vtkImageLuminance> luminanceFilter;\n  luminanceFilter->SetInputConnection(source->GetOutputPort());\n  luminanceFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> luminanceActor;\n  luminanceActor->GetMapper()->SetInputConnection(\n      luminanceFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double luminanceViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> luminanceRenderer;\n  luminanceRenderer->SetViewport(luminanceViewport);\n  luminanceRenderer->AddActor(luminanceActor);\n  luminanceRenderer->ResetCamera();\n  luminanceRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(luminanceRenderer);\n  renderWindow->SetWindowName(\"ImageLuminance\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageLuminance/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageLuminance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingColor\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageLuminance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageLuminance MACOSX_BUNDLE ImageLuminance.cxx )\n  target_link_libraries(ImageLuminance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageLuminance\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageLuminance/#download-and-build-imageluminance","title":"Download and Build ImageLuminance","text":"

        Click here to download ImageLuminance and its CMakeLists.txt file. Once the tarball ImageLuminance.tar has been downloaded and extracted,

        cd ImageLuminance/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageLuminance\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageMagnify/","title":"ImageMagnify","text":"

        vtk-examples/Cxx/Images/ImageMagnify

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageMagnify/#description","title":"Description","text":"

        vtkImageMagnify increases the dimensions of an image by integral magnification factors. It also adjusts the spacing of the pixels so that the magnified image covers the same region as the original image. To stretch the image, the pixel spacing needs to be adjusted. This example uses vtkImageChangeInformation to modify the magnified image's spacing. The result is an image that has increased numbers of pixels and is stretched in the magnified directions.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageMagnify/#code","title":"Code","text":"

        ImageMagnify.cxx

        #include <vtkImageActor.h>\n#include <vtkImageChangeInformation.h>\n#include <vtkImageMagnify.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename.png e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Increase the dimensions of the image.\n  vtkNew<vtkImageMagnify> magnifyFilter;\n  magnifyFilter->SetInputConnection(reader->GetOutputPort());\n  magnifyFilter->SetMagnificationFactors(2, 1, 1);\n  magnifyFilter->Update();\n\n  // Adjust the spacing of the magnified image. This will stretch the\n  // image.\n  vtkNew<vtkImageChangeInformation> changeFilter;\n  changeFilter->SetInputConnection(magnifyFilter->GetOutputPort());\n  changeFilter->SetSpacingScale(magnifyFilter->GetMagnificationFactors()[0],\n                                magnifyFilter->GetMagnificationFactors()[1],\n                                magnifyFilter->GetMagnificationFactors()[2]);\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> magnifiedActor;\n  magnifiedActor->GetMapper()->SetInputConnection(\n      changeFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double magnifiedViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> magnifiedRenderer;\n  magnifiedRenderer->SetViewport(magnifiedViewport);\n  magnifiedRenderer->AddActor(magnifiedActor);\n  magnifiedRenderer->ResetCamera();\n  magnifiedRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(magnifiedRenderer);\n  renderWindow->SetWindowName(\"ImageMagnify\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageMagnify/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMagnify)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMagnify: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMagnify MACOSX_BUNDLE ImageMagnify.cxx )\n  target_link_libraries(ImageMagnify PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMagnify\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageMagnify/#download-and-build-imagemagnify","title":"Download and Build ImageMagnify","text":"

        Click here to download ImageMagnify and its CMakeLists.txt file. Once the tarball ImageMagnify.tar has been downloaded and extracted,

        cd ImageMagnify/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageMagnify\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageMagnitude/","title":"ImageMagnitude","text":"

        vtk-examples/Cxx/Images/ImageMagnitude

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageMagnitude/#description","title":"Description","text":"

        There are two ways to convert images to greyscale: * vtkImageLuminance uses the [luminance equation](http://www.wikipedia.org/wiki/Luma_(video) for properly weighting the R, G, and B components; * vtkImageMagnitude does a simple sum-of-squares computation of the components (i.e. the Euclidean norm -- not the quadratic mean, and is meant for vector data.

        For an example of usage of the vtkImageLuminance filter, see ImageLuminance.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageMagnitude/#code","title":"Code","text":"

        ImageMagnitude.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMagnitude.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image of a rectangle.\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 200, 0, 200, 0, 0);\n\n  // Clear the image.\n  source->SetDrawColor(0, 0, 0);\n  source->FillBox(0, 200, 0, 200);\n\n  // Draw a red box.\n  source->SetDrawColor(255, 0, 0);\n  source->FillBox(100, 120, 100, 120);\n  source->Update();\n\n  vtkNew<vtkImageMagnitude> magnitudeFilter;\n  magnitudeFilter->SetInputConnection(source->GetOutputPort());\n  magnitudeFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> magnitudeActor;\n  magnitudeActor->GetMapper()->SetInputConnection(\n      magnitudeFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double magnitudeViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> magnitudeRenderer;\n  magnitudeRenderer->SetViewport(magnitudeViewport);\n  magnitudeRenderer->AddActor(magnitudeActor);\n  magnitudeRenderer->ResetCamera();\n  magnitudeRenderer->SetBackground(.4, .5, .7);\n  magnitudeRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(magnitudeRenderer);\n  renderWindow->SetWindowName(\"ImageMagnitude\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageMagnitude/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMagnitude)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMagnitude: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMagnitude MACOSX_BUNDLE ImageMagnitude.cxx )\n  target_link_libraries(ImageMagnitude PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMagnitude\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageMagnitude/#download-and-build-imagemagnitude","title":"Download and Build ImageMagnitude","text":"

        Click here to download ImageMagnitude and its CMakeLists.txt file. Once the tarball ImageMagnitude.tar has been downloaded and extracted,

        cd ImageMagnitude/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageMagnitude\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageMandelbrotSource/","title":"ImageMandelbrotSource","text":"

        vtk-examples/Cxx/Images/ImageMandelbrotSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageMandelbrotSource/#code","title":"Code","text":"

        ImageMandelbrotSource.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SaddleBrown\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageMagnitude\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageMandelbrotSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMandelbrotSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMandelbrotSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMandelbrotSource MACOSX_BUNDLE ImageMandelbrotSource.cxx )\n  target_link_libraries(ImageMandelbrotSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMandelbrotSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageMandelbrotSource/#download-and-build-imagemandelbrotsource","title":"Download and Build ImageMandelbrotSource","text":"

        Click here to download ImageMandelbrotSource and its CMakeLists.txt file. Once the tarball ImageMandelbrotSource.tar has been downloaded and extracted,

        cd ImageMandelbrotSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageMandelbrotSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageMapToColors/","title":"ImageMapToColors","text":"

        vtk-examples/Cxx/Images/ImageMapToColors

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageMapToColors/#code","title":"Code","text":"

        ImageMapToColors.cxx

        //\n// Displays a \"grayscale\" image as a full color image via the\n// vtkImageMapToColors filter, which uses a lookup table to\n// map scalar values to colors\n//\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageProperty.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a \"grayscale\" 16x16 image, 1-component pixels of type \"double\".\n  vtkNew<vtkImageData> image;\n  int imageExtent[6] = {0, 15, 0, 15, 0, 0};\n  image->SetExtent(imageExtent);\n  image->AllocateScalars(VTK_DOUBLE, 1);\n\n  double scalarvalue = 0.0;\n\n  for (int y = imageExtent[2]; y <= imageExtent[3]; y++)\n  {\n    for (int x = imageExtent[0]; x <= imageExtent[1]; x++)\n    {\n      double* pixel = static_cast<double*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = scalarvalue;\n      scalarvalue += 1.0;\n    }\n  }\n\n  // Map the scalar values in the image to colors with a lookup table:\n  vtkNew<vtkLookupTable> lookupTable;\n  lookupTable->SetNumberOfTableValues(256);\n  lookupTable->SetRange(0.0, 255.0);\n  lookupTable->Build();\n\n  // Pass the original image and the lookup table to a filter to create\n  // a color image:\n  vtkNew<vtkImageMapToColors> scalarValuesToColors;\n  scalarValuesToColors->SetLookupTable(lookupTable);\n  scalarValuesToColors->PassAlphaToOutputOn();\n  scalarValuesToColors->SetInputData(image);\n\n  // Create an image actor.\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputConnection(\n      scalarValuesToColors->GetOutputPort());\n  imageActor->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Visualize.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageActor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageMapToColors\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageMapToColors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMapToColors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMapToColors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMapToColors MACOSX_BUNDLE ImageMapToColors.cxx )\n  target_link_libraries(ImageMapToColors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMapToColors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageMapToColors/#download-and-build-imagemaptocolors","title":"Download and Build ImageMapToColors","text":"

        Click here to download ImageMapToColors and its CMakeLists.txt file. Once the tarball ImageMapToColors.tar has been downloaded and extracted,

        cd ImageMapToColors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageMapToColors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageMapper/","title":"ImageMapper","text":"

        vtk-examples/Cxx/Images/ImageMapper

        "},{"location":"Cxx/Images/ImageMapper/#description","title":"Description","text":"

        This example demonstrates how to display an image in 2D. The size and position are in screen coordinates.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageMapper/#code","title":"Code","text":"

        ImageMapper.cxx

        #include <vtkActor2D.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nnamespace {\nvoid CreateColorImage(vtkImageData*);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> colorImage;\n  CreateColorImage(colorImage);\n\n  vtkNew<vtkImageMapper> imageMapper;\n  imageMapper->SetInputData(colorImage);\n  imageMapper->SetColorWindow(255);\n  imageMapper->SetColorLevel(127.5);\n\n  vtkNew<vtkActor2D> imageActor;\n  imageActor->SetMapper(imageMapper);\n  imageActor->SetPosition(20, 20);\n\n  // Setup renderers\n  vtkNew<vtkRenderer> renderer;\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageMapper\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // renderer->AddViewProp(imageActor);\n  renderer->AddActor2D(imageActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 3> drawColor1{0, 0, 0};\n  std::array<unsigned char, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"HotPink\").GetData();\n  auto color2 = colors->GetColor3ub(\"Chartreuse\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  unsigned int dim = 20;\n\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  for (unsigned int x = 0; x < dim; x++)\n  {\n    for (unsigned int y = 0; y < dim; y++)\n    {\n      auto pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      if (x < dim / 2)\n      {\n        for (auto i = 0; i < 3; ++i)\n        {\n          pixel[i] = drawColor1[i];\n        }\n      }\n      else\n      {\n        for (auto i = 0; i < 3; ++i)\n        {\n          pixel[i] = drawColor2[i];\n        }\n      }\n    }\n  }\n\n  image->Modified();\n}\n} // namespace\n
        "},{"location":"Cxx/Images/ImageMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMapper MACOSX_BUNDLE ImageMapper.cxx )\n  target_link_libraries(ImageMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageMapper/#download-and-build-imagemapper","title":"Download and Build ImageMapper","text":"

        Click here to download ImageMapper and its CMakeLists.txt file. Once the tarball ImageMapper.tar has been downloaded and extracted,

        cd ImageMapper/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageMapper\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageMask/","title":"ImageMask","text":"

        vtk-examples/Cxx/Images/ImageMask

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageMask/#description","title":"Description","text":"

        This example creates an all red image. Then it creates a mask of a small rectangle. The red pixels in this rectangle are copied to the output image, while the rest of the output image is black. The black region could be set to a different color using SetMaskedOutputValue.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageMask/#code","title":"Code","text":"

        ImageMask.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMask.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image of a rectangle.\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 200, 0, 200, 0, 0);\n\n  // Create a red image.\n  source->SetDrawColor(255, 0, 0);\n  source->FillBox(0, 200, 0, 200);\n\n  source->Update();\n\n  // Create a rectanglular mask.\n  vtkNew<vtkImageCanvasSource2D> maskSource;\n  maskSource->SetScalarTypeToUnsignedChar();\n  maskSource->SetNumberOfScalarComponents(1);\n  maskSource->SetExtent(0, 200, 0, 200, 0, 0);\n\n  // Initialize the mask to black.\n  maskSource->SetDrawColor(0, 0, 0);\n  maskSource->FillBox(0, 200, 0, 200);\n\n  // Create a square.\n  maskSource->SetDrawColor(\n      255, 255,\n      255); // Anything non-zero means \"make the output\n            // pixel equal the input pixel\". If the mask is\n            // zero, the output pixel is set to MaskedValue.\n  maskSource->FillBox(100, 120, 100, 120);\n  maskSource->Update();\n\n  vtkNew<vtkImageMask> maskFilter;\n  maskFilter->SetInputConnection(0, source->GetOutputPort());\n  maskFilter->SetInputConnection(1, maskSource->GetOutputPort());\n  maskFilter->SetMaskedOutputValue(0, 1, 0);\n  maskFilter->Update();\n\n  vtkNew<vtkImageMask> inverseMaskFilter;\n  inverseMaskFilter->SetInputConnection(0, source->GetOutputPort());\n  inverseMaskFilter->SetInputConnection(1, maskSource->GetOutputPort());\n  inverseMaskFilter->SetMaskedOutputValue(0, 1, 0);\n  inverseMaskFilter->NotMaskOn();\n  inverseMaskFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> maskActor;\n  maskActor->GetMapper()->SetInputConnection(maskSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> maskedActor;\n  maskedActor->GetMapper()->SetInputConnection(maskFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> inverseMaskedActor;\n  inverseMaskedActor->GetMapper()->SetInputConnection(\n      inverseMaskFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double maskViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double maskedViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double inverseMaskedViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"SandyBrown\").GetData());\n\n  vtkNew<vtkRenderer> maskRenderer;\n  maskRenderer->SetViewport(maskViewport);\n  maskRenderer->AddActor(maskActor);\n  maskRenderer->ResetCamera();\n  maskRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> maskedRenderer;\n  maskedRenderer->SetViewport(maskedViewport);\n  maskedRenderer->AddActor(maskedActor);\n  maskedRenderer->ResetCamera();\n  maskedRenderer->SetBackground(colors->GetColor3d(\"SandyBrown\").GetData());\n\n  vtkNew<vtkRenderer> inverseMaskedRenderer;\n  inverseMaskedRenderer->SetViewport(inverseMaskedViewport);\n  inverseMaskedRenderer->AddActor(inverseMaskedActor);\n  inverseMaskedRenderer->ResetCamera();\n  inverseMaskedRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(maskRenderer);\n  renderWindow->AddRenderer(maskedRenderer);\n  renderWindow->AddRenderer(inverseMaskedRenderer);\n  renderWindow->SetWindowName(\"ImageMask\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageMask/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMask)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMask: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMask MACOSX_BUNDLE ImageMask.cxx )\n  target_link_libraries(ImageMask PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMask\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageMask/#download-and-build-imagemask","title":"Download and Build ImageMask","text":"

        Click here to download ImageMask and its CMakeLists.txt file. Once the tarball ImageMask.tar has been downloaded and extracted,

        cd ImageMask/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageMask\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageMathematics/","title":"ImageMathematics","text":"

        vtk-examples/Cxx/Images/ImageMathematics

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageMathematics/#code","title":"Code","text":"

        ImageMathematics.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 4, 0, 4, 0, 0);\n  imageSource->SetDrawColor(100.0, 0, 0);\n  imageSource->FillBox(0, 4, 0, 4);\n  imageSource->Update();\n\n  vtkNew<vtkImageMathematics> imageMath;\n  imageMath->SetOperationToMultiplyByK();\n  imageMath->SetConstantK(2.0);\n  imageMath->SetInputConnection(imageSource->GetOutputPort());\n  imageMath->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> mathActor;\n  mathActor->GetMapper()->SetInputConnection(imageMath->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(leftViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> mathRenderer;\n  mathRenderer->SetViewport(rightViewport);\n  mathRenderer->AddActor(mathActor);\n  mathRenderer->ResetCamera();\n  mathRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(mathRenderer);\n  renderWindow->SetWindowName(\"ImageMathematics\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleImage> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageMathematics/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMathematics)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMathematics: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMathematics MACOSX_BUNDLE ImageMathematics.cxx )\n  target_link_libraries(ImageMathematics PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMathematics\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageMathematics/#download-and-build-imagemathematics","title":"Download and Build ImageMathematics","text":"

        Click here to download ImageMathematics and its CMakeLists.txt file. Once the tarball ImageMathematics.tar has been downloaded and extracted,

        cd ImageMathematics/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageMathematics\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageMedian3D/","title":"ImageMedian3D","text":"

        vtk-examples/Cxx/Images/ImageMedian3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageMedian3D/#code","title":"Code","text":"

        ImageMedian3D.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMedian3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetNumberOfScalarComponents(1);\n  imageSource->SetScalarTypeToUnsignedChar();\n  unsigned int xmin = 0;\n  unsigned int xmax = 20;\n  unsigned int ymin = 0;\n  unsigned int ymax = 20;\n  imageSource->SetExtent(xmin, xmax, ymin, ymax, 0, 0);\n\n  // Make the image all black.\n  imageSource->SetDrawColor(0.0);\n  imageSource->FillBox(xmin, xmax, ymin, ymax);\n\n  // Draw a big white square.\n  imageSource->SetDrawColor(255.0);\n  imageSource->FillBox(5, 15, 5, 15);\n\n  // Add some single white pixels.\n  imageSource->SetDrawColor(255.0);\n  imageSource->FillBox(1, 1, 1, 1);\n  imageSource->FillBox(17, 17, 17, 17);\n\n  imageSource->Update();\n\n  vtkNew<vtkImageMedian3D> medianFilter;\n  medianFilter->SetInputConnection(imageSource->GetOutputPort());\n  medianFilter->SetKernelSize(3, 3, 1);\n  medianFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> medianActor;\n  medianActor->GetMapper()->SetInputConnection(medianFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(leftViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> gradientMagnitudeRenderer;\n  gradientMagnitudeRenderer->SetViewport(rightViewport);\n  gradientMagnitudeRenderer->AddActor(medianActor);\n  gradientMagnitudeRenderer->ResetCamera();\n  gradientMagnitudeRenderer->SetBackground(\n      colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(gradientMagnitudeRenderer);\n  renderWindow->SetWindowName(\"ImageMedian3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageMedian3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMedian3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMedian3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMedian3D MACOSX_BUNDLE ImageMedian3D.cxx )\n  target_link_libraries(ImageMedian3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMedian3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageMedian3D/#download-and-build-imagemedian3d","title":"Download and Build ImageMedian3D","text":"

        Click here to download ImageMedian3D and its CMakeLists.txt file. Once the tarball ImageMedian3D.tar has been downloaded and extracted,

        cd ImageMedian3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageMedian3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageMirrorPad/","title":"ImageMirrorPad","text":"

        vtk-examples/Cxx/Images/ImageMirrorPad

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageMirrorPad/#description","title":"Description","text":"

        This example shows how to enlarge an image and fill in the padded edges by mirroring the original pixels.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageMirrorPad/#code","title":"Code","text":"

        ImageMirrorPad.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMirrorPad.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkType.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetExtent(0, 20, 0, 20, 0, 0);\n  source->SetScalarTypeToUnsignedChar();\n  source->SetDrawColor(0.0, 0.0, 0.0, 1.0);\n  source->FillBox(-VTK_INT_MAX, VTK_INT_MAX, -VTK_INT_MAX, VTK_INT_MAX);\n  source->SetDrawColor(255.0, 0.0, 0.0, 0.5);\n  source->DrawCircle(10, 10, 5);\n  source->Update();\n\n  vtkNew<vtkImageMirrorPad> mirrorPadFilter;\n  mirrorPadFilter->SetInputConnection(source->GetOutputPort());\n  mirrorPadFilter->SetOutputWholeExtent(-10, 30, -10, 30, 0, 0);\n  mirrorPadFilter->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(mirrorPadFilter->GetOutputPort());\n\n  // Visualize.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageMirrorPad\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageMirrorPad/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageMirrorPad)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageMirrorPad: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageMirrorPad MACOSX_BUNDLE ImageMirrorPad.cxx )\n  target_link_libraries(ImageMirrorPad PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageMirrorPad\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageMirrorPad/#download-and-build-imagemirrorpad","title":"Download and Build ImageMirrorPad","text":"

        Click here to download ImageMirrorPad and its CMakeLists.txt file. Once the tarball ImageMirrorPad.tar has been downloaded and extracted,

        cd ImageMirrorPad/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageMirrorPad\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageNoiseSource/","title":"ImageNoiseSource","text":"

        vtk-examples/Cxx/Images/ImageNoiseSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageNoiseSource/#code","title":"Code","text":"

        ImageNoiseSource.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageNoiseSource.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image of noise.\n  vtkNew<vtkImageNoiseSource> noiseSource;\n  noiseSource->SetWholeExtent(0, 200, 0, 200, 0, 0);\n  noiseSource->SetMinimum(0.0);\n  noiseSource->SetMaximum(255.0);\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(noiseSource->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ImageNoiseSource\");\n\n  renderWindow->AddRenderer(renderer);\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageNoiseSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageNoiseSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageNoiseSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageNoiseSource MACOSX_BUNDLE ImageNoiseSource.cxx )\n  target_link_libraries(ImageNoiseSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageNoiseSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageNoiseSource/#download-and-build-imagenoisesource","title":"Download and Build ImageNoiseSource","text":"

        Click here to download ImageNoiseSource and its CMakeLists.txt file. Once the tarball ImageNoiseSource.tar has been downloaded and extracted,

        cd ImageNoiseSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageNoiseSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageNonMaximumSuppression/","title":"ImageNonMaximumSuppression","text":"

        vtk-examples/Cxx/Images/ImageNonMaximumSuppression

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageNonMaximumSuppression/#code","title":"Code","text":"

        ImageNonMaximumSuppression.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageGradient.h>\n#include <vtkImageGradientMagnitude.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageNonMaximumSuppression.h>\n#include <vtkImageSinusoidSource.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageSinusoidSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> sourceCastFilter;\n  sourceCastFilter->SetOutputScalarTypeToUnsignedChar();\n  sourceCastFilter->SetInputConnection(source->GetOutputPort());\n  sourceCastFilter->Update();\n\n  vtkNew<vtkImageGradient> gradientFilter;\n  gradientFilter->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageGradientMagnitude> gradientMagnitudeFilter;\n  gradientMagnitudeFilter->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageCast> gradientMagnitudeCastFilter;\n  gradientMagnitudeCastFilter->SetOutputScalarTypeToUnsignedChar();\n  gradientMagnitudeCastFilter->SetInputConnection(\n      gradientMagnitudeFilter->GetOutputPort());\n  gradientMagnitudeCastFilter->Update();\n\n  vtkNew<vtkImageNonMaximumSuppression> suppressionFilter;\n  suppressionFilter->SetInputConnection(\n      0, gradientMagnitudeFilter->GetOutputPort());\n  suppressionFilter->SetInputConnection(1, gradientFilter->GetOutputPort());\n  suppressionFilter->SetDimensionality(2);\n  suppressionFilter->Update();\n\n  vtkNew<vtkImageCast> suppressionCastFilter;\n  suppressionCastFilter->SetOutputScalarTypeToUnsignedChar();\n  suppressionCastFilter->SetInputConnection(suppressionFilter->GetOutputPort());\n  suppressionCastFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(\n      sourceCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> gradientMagnitudeActor;\n  gradientMagnitudeActor->GetMapper()->SetInputConnection(\n      gradientMagnitudeCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> suppressionActor;\n  suppressionActor->GetMapper()->SetInputConnection(\n      suppressionCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double gradientMagnitudeViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double suppressionViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  vtkNew<vtkRenderer> gradientMagnitudeRenderer;\n  gradientMagnitudeRenderer->SetViewport(gradientMagnitudeViewport);\n  gradientMagnitudeRenderer->AddActor(gradientMagnitudeActor);\n  gradientMagnitudeRenderer->ResetCamera();\n  gradientMagnitudeRenderer->SetBackground(\n      colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkRenderer> suppressionRenderer;\n  suppressionRenderer->SetViewport(suppressionViewport);\n  suppressionRenderer->AddActor(suppressionActor);\n  suppressionRenderer->ResetCamera();\n  suppressionRenderer->SetBackground(\n      colors->GetColor3d(\"BlanchedAlmond\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(gradientMagnitudeRenderer);\n  renderWindow->AddRenderer(suppressionRenderer);\n  renderWindow->SetWindowName(\"ImageNonMaximumSuppression\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageNonMaximumSuppression/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageNonMaximumSuppression)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingMorphological\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageNonMaximumSuppression: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageNonMaximumSuppression MACOSX_BUNDLE ImageNonMaximumSuppression.cxx )\n  target_link_libraries(ImageNonMaximumSuppression PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageNonMaximumSuppression\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageNonMaximumSuppression/#download-and-build-imagenonmaximumsuppression","title":"Download and Build ImageNonMaximumSuppression","text":"

        Click here to download ImageNonMaximumSuppression and its CMakeLists.txt file. Once the tarball ImageNonMaximumSuppression.tar has been downloaded and extracted,

        cd ImageNonMaximumSuppression/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageNonMaximumSuppression\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageOpenClose3D/","title":"ImageOpenClose3D","text":"

        vtk-examples/Cxx/Images/ImageOpenClose3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageOpenClose3D/#description","title":"Description","text":"

        This example reads a binary image and performs opening on one value and closing on another (morphological operations).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageOpenClose3D/#code","title":"Code","text":"

        ImageOpenClose3D.cxx

        #include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageOpenClose3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename.png e.g. Yinyang.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkImageOpenClose3D> openClose;\n  openClose->SetInputConnection(reader->GetOutputPort());\n  openClose->SetOpenValue(0);\n  openClose->SetCloseValue(255);\n  openClose->SetKernelSize(5, 5, 3);\n  openClose->ReleaseDataFlagOff();\n  openClose->GetOutput();\n  openClose->GetCloseValue();\n  openClose->GetOpenValue();\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> openCloseActor;\n  openCloseActor->GetMapper()->SetInputConnection(openClose->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double openCloseViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> openCloseRenderer;\n  openCloseRenderer->SetViewport(openCloseViewport);\n  openCloseRenderer->AddActor(openCloseActor);\n  openCloseRenderer->ResetCamera();\n  openCloseRenderer->SetBackground(.4, .5, .7);\n  openCloseRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(openCloseRenderer);\n  renderWindow->SetWindowName(\"ImageOpenClose3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageOpenClose3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageOpenClose3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingMorphological\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageOpenClose3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageOpenClose3D MACOSX_BUNDLE ImageOpenClose3D.cxx )\n  target_link_libraries(ImageOpenClose3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageOpenClose3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageOpenClose3D/#download-and-build-imageopenclose3d","title":"Download and Build ImageOpenClose3D","text":"

        Click here to download ImageOpenClose3D and its CMakeLists.txt file. Once the tarball ImageOpenClose3D.tar has been downloaded and extracted,

        cd ImageOpenClose3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageOpenClose3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageOrder/","title":"ImageOrder","text":"

        vtk-examples/Cxx/Images/ImageOrder

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageOrder/#code","title":"Code","text":"

        ImageOrder.cxx

        #include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\n#define DISPLAY_FIRST_IMAGE\n// Comment this out to display the first image.\n#undef DISPLAY_FIRST_IMAGE\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image, std::string const& colorName);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Image 1\n  vtkNew<vtkImageData> firstImage;\n  CreateColorImage(firstImage, \"DarkOliveGreen\");\n\n  vtkNew<vtkImageActor> firstImageActor;\n  firstImageActor->SetInputData(firstImage);\n\n  // Image 2\n  vtkNew<vtkImageData> secondImage;\n  CreateColorImage(secondImage, \"DarkSalmon\");\n\n  vtkNew<vtkImageActor> secondImageActor;\n  secondImageActor->SetInputData(secondImage);\n\n  // Visualize.\n  vtkNew<vtkRenderer> renderer;\n\n#ifdef DISPLAY_FIRST_IMAGE\n  // The first image is displayed\n  renderer->AddActor(secondImageActor);\n  renderer->AddActor(firstImageActor);\n#else\n  // The second image is displayed.\n  renderer->AddActor(firstImageActor);\n  renderer->AddActor(secondImageActor);\n#endif\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageOrder\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image, std::string const& colorName)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 3> drawColor{0, 0, 0};\n  auto color = colors->GetColor3ub(colorName).GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor[i] = color[i];\n  }\n\n  unsigned int dim = 10;\n\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  for (unsigned int x = 0; x < dim; x++)\n  {\n    for (unsigned int y = 0; y < dim; y++)\n    {\n      auto pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (auto i = 0; i < 3; ++i)\n      {\n        pixel[i] = drawColor[i];\n      }\n    }\n  }\n\n  image->Modified();\n}\n} // namespace\n
        "},{"location":"Cxx/Images/ImageOrder/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageOrder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageOrder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageOrder MACOSX_BUNDLE ImageOrder.cxx )\n  target_link_libraries(ImageOrder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageOrder\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageOrder/#download-and-build-imageorder","title":"Download and Build ImageOrder","text":"

        Click here to download ImageOrder and its CMakeLists.txt file. Once the tarball ImageOrder.tar has been downloaded and extracted,

        cd ImageOrder/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageOrder\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageOrientation/","title":"ImageOrientation","text":"

        vtk-examples/Cxx/Images/ImageOrientation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageOrientation/#code","title":"Code","text":"

        ImageOrientation.cxx

        #include <vtkImageActor.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImagePermute.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(2, 5, 0);\n  source->SetOutputScalarTypeToUnsignedChar();\n  source->Update();\n\n  vtkNew<vtkImagePermute> permuteFilter;\n  permuteFilter->SetInputConnection(source->GetOutputPort());\n  permuteFilter->SetFilteredAxes(1, 0, 2);\n  permuteFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> permutedActor;\n  permutedActor->GetMapper()->SetInputConnection(\n      permuteFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double permutedViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> permutedRenderer;\n  permutedRenderer->SetViewport(permutedViewport);\n  permutedRenderer->AddActor(permutedActor);\n  permutedRenderer->ResetCamera();\n  permutedRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(permutedRenderer);\n  renderWindow->SetWindowName(\"ImageOrientation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageOrientation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageOrientation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageOrientation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageOrientation MACOSX_BUNDLE ImageOrientation.cxx )\n  target_link_libraries(ImageOrientation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageOrientation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageOrientation/#download-and-build-imageorientation","title":"Download and Build ImageOrientation","text":"

        Click here to download ImageOrientation and its CMakeLists.txt file. Once the tarball ImageOrientation.tar has been downloaded and extracted,

        cd ImageOrientation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageOrientation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImagePermute/","title":"ImagePermute","text":"

        vtk-examples/Cxx/Images/ImagePermute

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImagePermute/#code","title":"Code","text":"

        ImagePermute.cxx

        #include <vtkImageActor.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImagePermute.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(2, 5, 0);\n  source->Update();\n\n  vtkNew<vtkImagePermute> permuteFilter;\n  permuteFilter->SetInputConnection(source->GetOutputPort());\n  permuteFilter->SetFilteredAxes(1, 0, 2);\n  permuteFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> permutedActor;\n  permutedActor->GetMapper()->SetInputConnection(\n      permuteFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double permutedViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> permutedRenderer;\n  permutedRenderer->SetViewport(permutedViewport);\n  permutedRenderer->AddActor(permutedActor);\n  permutedRenderer->ResetCamera();\n  permutedRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(permutedRenderer);\n  renderWindow->SetWindowName(\"ImagePermute\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImagePermute/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImagePermute)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImagePermute: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImagePermute MACOSX_BUNDLE ImagePermute.cxx )\n  target_link_libraries(ImagePermute PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImagePermute\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImagePermute/#download-and-build-imagepermute","title":"Download and Build ImagePermute","text":"

        Click here to download ImagePermute and its CMakeLists.txt file. Once the tarball ImagePermute.tar has been downloaded and extracted,

        cd ImagePermute/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImagePermute\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageRFFT/","title":"ImageRFFT","text":"

        vtk-examples/Cxx/Images/ImageRFFT

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageRFFT/#code","title":"Code","text":"

        ImageRFFT.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageFFT.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageRFFT.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageFFT> fftFilter;\n  fftFilter->SetInputConnection(source->GetOutputPort());\n  fftFilter->Update();\n\n  vtkNew<vtkImageCast> fftCastFilter;\n  fftCastFilter->SetInputConnection(fftFilter->GetOutputPort());\n  fftCastFilter->SetOutputScalarTypeToUnsignedChar();\n  fftCastFilter->Update();\n\n  vtkNew<vtkImageRFFT> rfftFilter;\n  rfftFilter->SetInputConnection(fftFilter->GetOutputPort());\n  rfftFilter->Update();\n\n  vtkNew<vtkImageExtractComponents> extractRealFilter;\n  extractRealFilter->SetInputConnection(rfftFilter->GetOutputPort());\n  extractRealFilter->SetComponents(0);\n  extractRealFilter->Update();\n\n  vtkNew<vtkImageCast> rfftCastFilter;\n  rfftCastFilter->SetInputConnection(extractRealFilter->GetOutputPort());\n  rfftCastFilter->SetOutputScalarTypeToUnsignedChar();\n  rfftCastFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> fftActor;\n  fftActor->GetMapper()->SetInputConnection(fftCastFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> rfftActor;\n  rfftActor->GetMapper()->SetInputConnection(rfftCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double fftViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rfftViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  vtkNew<vtkRenderer> fftRenderer;\n  fftRenderer->SetViewport(fftViewport);\n  fftRenderer->AddActor(fftActor);\n  fftRenderer->ResetCamera();\n  fftRenderer->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  vtkNew<vtkRenderer> rfftRenderer;\n  rfftRenderer->SetViewport(rfftViewport);\n  rfftRenderer->AddActor(rfftActor);\n  rfftRenderer->ResetCamera();\n  rfftRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(fftRenderer);\n  renderWindow->AddRenderer(rfftRenderer);\n  renderWindow->SetWindowName(\"ImageRFFT\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageRFFT/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageRFFT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingFourier\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageRFFT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageRFFT MACOSX_BUNDLE ImageRFFT.cxx )\n  target_link_libraries(ImageRFFT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageRFFT\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageRFFT/#download-and-build-imagerfft","title":"Download and Build ImageRFFT","text":"

        Click here to download ImageRFFT and its CMakeLists.txt file. Once the tarball ImageRFFT.tar has been downloaded and extracted,

        cd ImageRFFT/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageRFFT\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageRange3D/","title":"ImageRange3D","text":"

        vtk-examples/Cxx/Images/ImageRange3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageRange3D/#code","title":"Code","text":"

        ImageRange3D.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageRange3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: Filename.jpg e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageRange3D> rangeFilter;\n  rangeFilter->SetInputConnection(reader->GetOutputPort());\n  rangeFilter->SetKernelSize(5, 5, 5);\n  rangeFilter->Update();\n\n  vtkNew<vtkImageCast> rangeCastFilter;\n  rangeCastFilter->SetInputConnection(rangeFilter->GetOutputPort());\n  rangeCastFilter->SetOutputScalarTypeToUnsignedChar();\n  rangeCastFilter->Update();\n\n  vtkNew<vtkImageActor> rangeActor;\n  rangeActor->GetMapper()->SetInputConnection(rangeCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rangeViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> rangeRenderer;\n  rangeRenderer->SetViewport(rangeViewport);\n  rangeRenderer->AddActor(rangeActor);\n  rangeRenderer->ResetCamera();\n  rangeRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(rangeRenderer);\n  renderWindow->SetWindowName(\"ImageRange3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageRange3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageRange3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageRange3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageRange3D MACOSX_BUNDLE ImageRange3D.cxx )\n  target_link_libraries(ImageRange3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageRange3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageRange3D/#download-and-build-imagerange3d","title":"Download and Build ImageRange3D","text":"

        Click here to download ImageRange3D and its CMakeLists.txt file. Once the tarball ImageRange3D.tar has been downloaded and extracted,

        cd ImageRange3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageRange3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageRotate/","title":"ImageRotate","text":"

        vtk-examples/Cxx/Images/ImageRotate

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageRotate/#code","title":"Code","text":"

        ImageRotate.cxx

        #include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageReslice.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputFilename e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  double angle = 45;\n  if (argc > 2)\n  {\n    angle = atof(argv[2]);\n  }\n\n  // Read file\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n\n  // Rotate about the center of the image.\n  vtkNew<vtkTransform> transform;\n\n  // Compute the center of the image.\n  double center[3];\n  center[0] = (bounds[1] + bounds[0]) / 2.0;\n  center[1] = (bounds[3] + bounds[2]) / 2.0;\n  center[2] = (bounds[5] + bounds[4]) / 2.0;\n\n  // Rotate about the center\n  transform->Translate(center[0], center[1], center[2]);\n  transform->RotateWXYZ(angle, 0, 0, 1);\n  transform->Translate(-center[0], -center[1], -center[2]);\n\n  // Reslice does all of the work.\n  vtkNew<vtkImageReslice> reslice;\n  reslice->SetInputConnection(reader->GetOutputPort());\n  reslice->SetResliceTransform(transform);\n  reslice->SetInterpolationModeToCubic();\n  reslice->SetOutputSpacing(reader->GetOutput()->GetSpacing()[0],\n                            reader->GetOutput()->GetSpacing()[1],\n                            reader->GetOutput()->GetSpacing()[2]);\n  reslice->SetOutputOrigin(reader->GetOutput()->GetOrigin()[0],\n                           reader->GetOutput()->GetOrigin()[1],\n                           reader->GetOutput()->GetOrigin()[2]);\n  reslice->SetOutputExtent(\n      reader->GetOutput()\n          ->GetExtent()); // Use a larger extent than the\n                          // original image's to prevent clipping.\n\n  // Visualize\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reslice->GetOutputPort());\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"RoyalBlue\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ImageRotate\");\n  imageViewer->Render();\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageRotate/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageRotate)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  IOImage\n  ImagingCore\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageRotate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageRotate MACOSX_BUNDLE ImageRotate.cxx )\n  target_link_libraries(ImageRotate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageRotate\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageRotate/#download-and-build-imagerotate","title":"Download and Build ImageRotate","text":"

        Click here to download ImageRotate and its CMakeLists.txt file. Once the tarball ImageRotate.tar has been downloaded and extracted,

        cd ImageRotate/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageRotate\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageSeparableConvolution/","title":"ImageSeparableConvolution","text":"

        vtk-examples/Cxx/Images/ImageSeparableConvolution

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageSeparableConvolution/#description","title":"Description","text":"

        Read in a binary image and convolve it with a separable kernel. The input and output are displayed.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageSeparableConvolution/#code","title":"Code","text":"

        ImageSeparableConvolution.cxx

        #include <vtkFloatArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageSeparableConvolution.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Handle the arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: BinaryImage.png e.g. Yinyang.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkFloatArray> xKernel;\n  xKernel->SetNumberOfTuples(5);\n  xKernel->SetNumberOfComponents(1);\n  xKernel->SetValue(0, 1);\n  xKernel->SetValue(1, 1);\n  xKernel->SetValue(2, 1);\n  xKernel->SetValue(3, 1);\n  xKernel->SetValue(4, 1);\n\n  vtkNew<vtkImageSeparableConvolution> convolutionFilter;\n  convolutionFilter->SetInputConnection(reader->GetOutputPort());\n  convolutionFilter->SetXKernel(xKernel);\n  convolutionFilter->Update();\n\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageCast> convolutionCastFilter;\n  convolutionCastFilter->SetInputConnection(convolutionFilter->GetOutputPort());\n  convolutionCastFilter->SetOutputScalarTypeToUnsignedChar();\n  convolutionCastFilter->Update();\n\n  vtkNew<vtkImageActor> convolutionActor;\n  convolutionActor->GetMapper()->SetInputConnection(\n      convolutionCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double convolutionViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> convolutionRenderer;\n  convolutionRenderer->SetViewport(convolutionViewport);\n  convolutionRenderer->AddActor(convolutionActor);\n  convolutionRenderer->ResetCamera();\n  convolutionRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(convolutionRenderer);\n  renderWindow->SetWindowName(\"ImageSeparableConvolution\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageSeparableConvolution/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageSeparableConvolution)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageSeparableConvolution: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageSeparableConvolution MACOSX_BUNDLE ImageSeparableConvolution.cxx )\n  target_link_libraries(ImageSeparableConvolution PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageSeparableConvolution\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageSeparableConvolution/#download-and-build-imageseparableconvolution","title":"Download and Build ImageSeparableConvolution","text":"

        Click here to download ImageSeparableConvolution and its CMakeLists.txt file. Once the tarball ImageSeparableConvolution.tar has been downloaded and extracted,

        cd ImageSeparableConvolution/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageSeparableConvolution\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageShiftScale/","title":"ImageShiftScale","text":"

        vtk-examples/Cxx/Images/ImageShiftScale

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageShiftScale/#code","title":"Code","text":"

        ImageShiftScale.cxx

        #include <vtkImageData.h>\n#include <vtkImageProperty.h>\n#include <vtkImageShiftScale.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nvoid CreateImage(vtkImageData*);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageData> image;\n  CreateImage(image);\n\n  vtkNew<vtkImageShiftScale> shiftScaleFilter;\n  shiftScaleFilter->SetOutputScalarTypeToUnsignedChar();\n  shiftScaleFilter->SetInputData(image);\n  shiftScaleFilter->SetShift(100);\n  shiftScaleFilter->SetScale(1);\n  shiftScaleFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageSliceMapper> originalSliceMapper;\n  originalSliceMapper->SetInputData(image);\n\n  vtkNew<vtkImageSlice> originalSlice;\n  originalSlice->SetMapper(originalSliceMapper);\n  originalSlice->GetProperty()->SetInterpolationTypeToNearest();\n\n  vtkNew<vtkImageSliceMapper> shiftScaleMapper;\n  shiftScaleMapper->SetInputConnection(shiftScaleFilter->GetOutputPort());\n\n  vtkNew<vtkImageSlice> shiftScaleSlice;\n  shiftScaleSlice->SetMapper(shiftScaleMapper);\n  shiftScaleSlice->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double shiftScaleViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddViewProp(originalSlice);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> shiftScaleRenderer;\n  shiftScaleRenderer->SetViewport(shiftScaleViewport);\n  shiftScaleRenderer->AddViewProp(shiftScaleSlice);\n  shiftScaleRenderer->ResetCamera();\n  shiftScaleRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(shiftScaleRenderer);\n  renderWindow->SetWindowName(\"ImageShiftScale\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateImage(vtkImageData* image)\n{\n  unsigned int dim = 20;\n\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  for (unsigned int x = 0; x < dim; x++)\n  {\n    for (unsigned int y = 0; y < dim; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      if (x < dim / 2)\n      {\n        pixel[0] = 50;\n      }\n      else\n      {\n        pixel[0] = 150;\n      }\n    }\n  }\n\n  image->Modified();\n}\n\n} // namespace\n
        "},{"location":"Cxx/Images/ImageShiftScale/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageShiftScale)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageShiftScale: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageShiftScale MACOSX_BUNDLE ImageShiftScale.cxx )\n  target_link_libraries(ImageShiftScale PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageShiftScale\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageShiftScale/#download-and-build-imageshiftscale","title":"Download and Build ImageShiftScale","text":"

        Click here to download ImageShiftScale and its CMakeLists.txt file. Once the tarball ImageShiftScale.tar has been downloaded and extracted,

        cd ImageShiftScale/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageShiftScale\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageShrink3D/","title":"ImageShrink3D","text":"

        vtk-examples/Cxx/Images/ImageShrink3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageShrink3D/#code","title":"Code","text":"

        ImageShrink3D.cxx

        #include <vtkImageActor.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageShrink3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageShrink3D> shrinkFilter;\n  shrinkFilter->SetInputConnection(source->GetOutputPort());\n  shrinkFilter->SetShrinkFactors(2, 1, 1);\n  shrinkFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> shrunkActor;\n  shrunkActor->GetMapper()->SetInputConnection(shrinkFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double shrunkViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> shrunkRenderer;\n  shrunkRenderer->SetViewport(shrunkViewport);\n  shrunkRenderer->AddActor(shrunkActor);\n  shrunkRenderer->ResetCamera();\n  shrunkRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(shrunkRenderer);\n  renderWindow->SetWindowName(\"ImageShrink3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageShrink3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageShrink3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageShrink3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageShrink3D MACOSX_BUNDLE ImageShrink3D.cxx )\n  target_link_libraries(ImageShrink3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageShrink3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageShrink3D/#download-and-build-imageshrink3d","title":"Download and Build ImageShrink3D","text":"

        Click here to download ImageShrink3D and its CMakeLists.txt file. Once the tarball ImageShrink3D.tar has been downloaded and extracted,

        cd ImageShrink3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageShrink3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageSinusoidSource/","title":"ImageSinusoidSource","text":"

        vtk-examples/Cxx/Images/ImageSinusoidSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageSinusoidSource/#code","title":"Code","text":"

        ImageSinusoidSource.cxx

        #include <vtkImageSinusoidSource.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageSinusoidSource> sinusoidSource;\n  sinusoidSource->Update();\n\n  // Visualize.\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(sinusoidSource->GetOutputPort());\n  imageViewer->GetRenderWindow()->SetSize(500, 500);\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DimGray\").GetData());\n  imageViewer->GetRenderWindow()->SetWindowName(\"ImageSinusoidSource\");\n\n  // Set up an interactor that does not respond to mouse events.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->GetRenderWindow()->SetInteractor(renderWindowInteractor);\n  renderWindowInteractor->SetInteractorStyle(0);\n  imageViewer->Render();\n\n  // Start the event loop.\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageSinusoidSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageSinusoidSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageSinusoidSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageSinusoidSource MACOSX_BUNDLE ImageSinusoidSource.cxx )\n  target_link_libraries(ImageSinusoidSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageSinusoidSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageSinusoidSource/#download-and-build-imagesinusoidsource","title":"Download and Build ImageSinusoidSource","text":"

        Click here to download ImageSinusoidSource and its CMakeLists.txt file. Once the tarball ImageSinusoidSource.tar has been downloaded and extracted,

        cd ImageSinusoidSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageSinusoidSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageSlice/","title":"ImageSlice","text":"

        vtk-examples/Cxx/Images/ImageSlice

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageSlice/#code","title":"Code","text":"

        ImageSlice.cxx

        #include <vtkImageData.h>\n#include <vtkImageMapper.h>\n#include <vtkImageResliceMapper.h>\n#include <vtkImageSlice.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData*);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> colorImage;\n  CreateColorImage(colorImage);\n\n  vtkNew<vtkImageResliceMapper> imageResliceMapper;\n  imageResliceMapper->SetInputData(colorImage);\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageResliceMapper);\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageSlice\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData* image)\n{\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  vtkNew<vtkNamedColors> colors;\n  auto pixelColor = colors->GetColor3ub(\"Turquoise\").GetData();\n\n  for (unsigned int x = 0; x < 10; x++)\n  {\n    for (unsigned int y = 0; y < 10; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (auto j = 0; j < 3; ++j)\n      {\n        pixel[j] = pixelColor[j];\n      }\n    }\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/Images/ImageSlice/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageSlice)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingImage\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageSlice: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageSlice MACOSX_BUNDLE ImageSlice.cxx )\n  target_link_libraries(ImageSlice PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageSlice\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageSlice/#download-and-build-imageslice","title":"Download and Build ImageSlice","text":"

        Click here to download ImageSlice and its CMakeLists.txt file. Once the tarball ImageSlice.tar has been downloaded and extracted,

        cd ImageSlice/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageSlice\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageSliceMapper/","title":"ImageSliceMapper","text":"

        vtk-examples/Cxx/Images/ImageSliceMapper

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageSliceMapper/#code","title":"Code","text":"

        ImageSliceMapper.cxx

        #include <vtkImageData.h>\n#include <vtkImageMapper.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData*);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> colorImage;\n  CreateColorImage(colorImage);\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper;\n  imageSliceMapper->SetInputData(colorImage);\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageSliceMapper);\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageSliceMapper\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData* image)\n{\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  vtkNew<vtkNamedColors> colors;\n  auto pixelColor = colors->GetColor3ub(\"Turquoise\").GetData();\n\n  for (unsigned int x = 0; x < 10; x++)\n  {\n    for (unsigned int y = 0; y < 10; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (auto j = 0; j < 3; ++j)\n      {\n        pixel[j] = pixelColor[j];\n      }\n    }\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/Images/ImageSliceMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageSliceMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageSliceMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageSliceMapper MACOSX_BUNDLE ImageSliceMapper.cxx )\n  target_link_libraries(ImageSliceMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageSliceMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageSliceMapper/#download-and-build-imageslicemapper","title":"Download and Build ImageSliceMapper","text":"

        Click here to download ImageSliceMapper and its CMakeLists.txt file. Once the tarball ImageSliceMapper.tar has been downloaded and extracted,

        cd ImageSliceMapper/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageSliceMapper\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageSobel2D/","title":"ImageSobel2D","text":"

        vtk-examples/Cxx/Images/ImageSobel2D

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageSobel2D/#code","title":"Code","text":"

        ImageSobel2D.cxx

        #include <vtkArrowSource.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageShiftScale.h>\n#include <vtkImageSobel2D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Black\").GetData();\n  auto color2 = colors->GetColor3ub(\"Red\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n  // Create an image of a rectangle\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetExtent(0, 200, 0, 200, 0, 0);\n  source->SetDrawColor(drawColor1.data());\n  source->FillBox(0, 200, 0, 200);\n  source->SetDrawColor(drawColor2.data());\n  source->FillBox(100, 120, 100, 120);\n  source->Update();\n\n  // Find the x and y gradients using a sobel filter\n  vtkNew<vtkImageSobel2D> sobelFilter;\n  sobelFilter->SetInputConnection(source->GetOutputPort());\n  sobelFilter->Update();\n\n  // Extract the x component of the gradient\n  vtkNew<vtkImageExtractComponents> extractXFilter;\n  extractXFilter->SetComponents(0);\n  extractXFilter->SetInputConnection(sobelFilter->GetOutputPort());\n  extractXFilter->Update();\n\n  double xRange[2];\n  extractXFilter->GetOutput()->GetPointData()->GetScalars()->GetRange(xRange);\n\n  vtkNew<vtkImageMathematics> xImageAbs;\n  xImageAbs->SetOperationToAbsoluteValue();\n  xImageAbs->SetInputConnection(extractXFilter->GetOutputPort());\n  xImageAbs->Update();\n\n  vtkNew<vtkImageShiftScale> xShiftScale;\n  xShiftScale->SetOutputScalarTypeToUnsignedChar();\n  xShiftScale->SetScale(255 / xRange[1]);\n  xShiftScale->SetInputConnection(xImageAbs->GetOutputPort());\n  xShiftScale->Update();\n\n  // Extract the y component of the gradient\n  vtkNew<vtkImageExtractComponents> extractYFilter;\n  extractYFilter->SetComponents(1);\n  extractYFilter->SetInputConnection(sobelFilter->GetOutputPort());\n  extractYFilter->Update();\n\n  double yRange[2];\n  extractYFilter->GetOutput()->GetPointData()->GetScalars()->GetRange(yRange);\n\n  vtkNew<vtkImageMathematics> yImageAbs;\n  yImageAbs->SetOperationToAbsoluteValue();\n  yImageAbs->SetInputConnection(extractYFilter->GetOutputPort());\n  yImageAbs->Update();\n\n  vtkNew<vtkImageShiftScale> yShiftScale;\n  yShiftScale->SetOutputScalarTypeToUnsignedChar();\n  yShiftScale->SetScale(255 / yRange[1]);\n  yShiftScale->SetInputConnection(yImageAbs->GetOutputPort());\n  yShiftScale->Update();\n\n  // Create actors\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> xActor;\n  xActor->GetMapper()->SetInputConnection(xShiftScale->GetOutputPort());\n\n  vtkNew<vtkImageActor> yActor;\n  yActor->GetMapper()->SetInputConnection(yShiftScale->GetOutputPort());\n\n  vtkNew<vtkArrowSource> arrowSource;\n  sobelFilter->GetOutput()->GetPointData()->SetActiveVectors(\n      \"ImageScalarsGradient\");\n\n  vtkNew<vtkGlyph3DMapper> sobelMapper;\n  sobelMapper->ScalingOn();\n  sobelMapper->SetScaleFactor(.05);\n  sobelMapper->SetSourceConnection(arrowSource->GetOutputPort());\n  sobelMapper->SetInputConnection(sobelFilter->GetOutputPort());\n  sobelMapper->Update();\n\n  vtkNew<vtkActor> sobelActor;\n  sobelActor->SetMapper(sobelMapper);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double xViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double yViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double sobelViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Setup renderers\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  vtkNew<vtkRenderer> xRenderer;\n  xRenderer->SetViewport(xViewport);\n  xRenderer->AddActor(xActor);\n  xRenderer->ResetCamera();\n  xRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> yRenderer;\n  yRenderer->SetViewport(yViewport);\n  yRenderer->AddActor(yActor);\n  yRenderer->ResetCamera();\n  yRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> sobelRenderer;\n  sobelRenderer->SetViewport(sobelViewport);\n  sobelRenderer->AddActor(sobelActor);\n  sobelRenderer->ResetCamera();\n  sobelRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(xRenderer);\n  renderWindow->AddRenderer(yRenderer);\n  renderWindow->AddRenderer(sobelRenderer);\n  renderWindow->SetWindowName(\"ImageSobel2D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageSobel2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageSobel2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  ImagingCore\n  ImagingGeneral\n  ImagingMath\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageSobel2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageSobel2D MACOSX_BUNDLE ImageSobel2D.cxx )\n  target_link_libraries(ImageSobel2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageSobel2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageSobel2D/#download-and-build-imagesobel2d","title":"Download and Build ImageSobel2D","text":"

        Click here to download ImageSobel2D and its CMakeLists.txt file. Once the tarball ImageSobel2D.tar has been downloaded and extracted,

        cd ImageSobel2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageSobel2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageStack/","title":"ImageStack","text":"

        vtk-examples/Cxx/Images/ImageStack

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageStack/#code","title":"Code","text":"

        ImageStack.cxx

        #include <vtkImageData.h>\n#include <vtkImageProperty.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkImageStack.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nstatic void CreateColorImage(vtkImageData*, const int corner,\n                             const unsigned int channel);\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Image 1\n  vtkNew<vtkImageData> image1;\n  CreateColorImage(image1, 1, 0);\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper1;\n  imageSliceMapper1->SetInputData(image1);\n\n  vtkNew<vtkImageSlice> imageSlice1;\n  imageSlice1->SetMapper(imageSliceMapper1);\n  imageSlice1->GetProperty()->SetOpacity(.5);\n\n  // Image 2\n  vtkNew<vtkImageData> image2;\n  CreateColorImage(image2, 4, 1);\n\n  vtkNew<vtkImageSliceMapper> imageSliceMapper2;\n  imageSliceMapper2->SetInputData(image2);\n\n  vtkNew<vtkImageSlice> imageSlice2;\n  imageSlice2->SetMapper(imageSliceMapper2);\n  imageSlice2->GetProperty()->SetOpacity(.5);\n\n  // Stack.\n  vtkNew<vtkImageStack> imageStack;\n  imageStack->AddImage(imageSlice1);\n  imageStack->AddImage(imageSlice2);\n  // imageStack->SetActiveLayer(1);\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageStack);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageStack\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nvoid CreateColorImage(vtkImageData* image, const int corner,\n                      const unsigned int channel)\n{\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  for (unsigned int x = 0; x < 10; x++)\n  {\n    for (unsigned int y = 0; y < 10; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = 0;\n      pixel[1] = 0;\n      pixel[2] = 0;\n    }\n  }\n\n  for (int x = corner; x < corner + 3; x++)\n  {\n    for (int y = corner; y < corner + 3; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[channel] = 255;\n    }\n  }\n}\n
        "},{"location":"Cxx/Images/ImageStack/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageStack)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingImage\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageStack: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageStack MACOSX_BUNDLE ImageStack.cxx )\n  target_link_libraries(ImageStack PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageStack\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageStack/#download-and-build-imagestack","title":"Download and Build ImageStack","text":"

        Click here to download ImageStack and its CMakeLists.txt file. Once the tarball ImageStack.tar has been downloaded and extracted,

        cd ImageStack/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageStack\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageStencil/","title":"ImageStencil","text":"

        vtk-examples/Cxx/Images/ImageStencil

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageStencil/#description","title":"Description","text":"

        This example creates a red image and a green image. It creates a mask that is half on and half off. It then combines the images according to the mask using an ImageStencil.

        Seealso

        ImageTransparency and Transparency

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageStencil/#code","title":"Code","text":"

        ImageStencil.cxx

        #include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageStencil.h>\n// #include <vtkImageStencilData.h>\n#include <vtkImageToImageStencil.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\nvoid CreateColorImage(vtkImageData*, unsigned int channel);\nvoid CreateMask(vtkImageData*);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> image1;\n  CreateColorImage(image1, 0); // Create a red image.\n\n  vtkNew<vtkImageData> image2;\n  CreateColorImage(image2, 1); // Create a green image.\n\n  vtkNew<vtkImageData> mask;\n  CreateMask(mask);\n\n  // vtkNew<vtkImageStencilData> stencilData;\n  vtkNew<vtkImageToImageStencil> imageToImageStencil;\n  imageToImageStencil->SetInputData(mask);\n  imageToImageStencil->ThresholdByUpper(122);\n\n  vtkNew<vtkImageStencil> stencil;\n  stencil->SetInputConnection(2, imageToImageStencil->GetOutputPort());\n  stencil->ReverseStencilOn();\n  stencil->SetBackgroundInputData(image2);\n  stencil->SetInputData(image1);\n  stencil->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(stencil->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageStencil\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  ;\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image, const unsigned int channel)\n{\n  unsigned int dim = 20;\n\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  for (unsigned int x = 0; x < dim; x++)\n  {\n    for (unsigned int y = 0; y < dim; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = 0;\n      pixel[1] = 0;\n      pixel[2] = 0;\n\n      pixel[channel] = 255;\n    }\n  }\n\n  image->Modified();\n}\n\nvoid CreateMask(vtkImageData* image)\n{\n  unsigned int dim = 20;\n\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  for (unsigned int x = 0; x < dim; x++)\n  {\n    for (unsigned int y = 0; y < dim; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      if (x < dim / 2)\n      {\n        pixel[0] = 0;\n      }\n      else\n      {\n        pixel[0] = 255;\n      }\n    }\n  }\n\n  image->Modified();\n}\n} // namespace\n
        "},{"location":"Cxx/Images/ImageStencil/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageStencil)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingStencil\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageStencil: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageStencil MACOSX_BUNDLE ImageStencil.cxx )\n  target_link_libraries(ImageStencil PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageStencil\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageStencil/#download-and-build-imagestencil","title":"Download and Build ImageStencil","text":"

        Click here to download ImageStencil and its CMakeLists.txt file. Once the tarball ImageStencil.tar has been downloaded and extracted,

        cd ImageStencil/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageStencil\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageText/","title":"ImageText","text":"

        vtk-examples/Cxx/Images/ImageText

        "},{"location":"Cxx/Images/ImageText/#description","title":"Description","text":"

        This example demonstrates how to draw text onto an image vtkImageData. It uses vtkImageBlend to blend the text and the image. For another example using vtkImageBlend, see CombineImages.

        Seealso

        DrawText for an example of drawing text, also in 2D, but into the render window rather than into a vtkImageData object.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageText/#code","title":"Code","text":"

        ImageText.cxx

        #include <vtkFreeTypeTools.h>\n#include <vtkImageActor.h>\n#include <vtkImageBlend.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStdString.h>\n#include <vtkTextProperty.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Blue\").GetData();\n  auto color2 = colors->GetColor3ub(\"Red\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n  // Create a blue image with a red circle of radius 50 centered at (60, 60).\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar(); // PNGWriter requires unsigned char\n                                          // (or unsigned short).\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 150, 0, 120, 0,\n                     0); // xmin, xmax, ymin, ymax, zmin, zmax\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(0, 150, 0, 120);\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(60, 60, 50); // parameters: x, y, radius\n  // Create an image of text.\n  vtkFreeTypeTools* freeType = vtkFreeTypeTools::GetInstance();\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  textProperty->SetJustificationToLeft();\n  textProperty->SetFontSize(24);\n  textProperty->SetOrientation(25);\n  vtkStdString text(\"   Test String\");\n  vtkNew<vtkImageData> textImage;\n  freeType->RenderString(textProperty, text, 70, textImage.GetPointer());\n\n  // Combine the images.\n  vtkNew<vtkImageBlend> blend;\n  blend->AddInputConnection(drawing->GetOutputPort());\n  blend->AddInputData(textImage);\n  blend->SetOpacity(0, 1.0); // background image: 50% opaque\n  blend->SetOpacity(1, 1.0); // text: 100% opaque\n  blend->Update();\n\n  vtkNew<vtkImageActor> blendActor;\n  blendActor->GetMapper()->SetInputConnection(blend->GetOutputPort());\n\n  vtkNew<vtkRenderer> blendRenderer;\n  blendRenderer->AddActor(blendActor);\n  blendRenderer->ResetCamera();\n  blendRenderer->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(blendRenderer);\n  renderWindow->SetWindowName(\"ImageText\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageText/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageText)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageText: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageText MACOSX_BUNDLE ImageText.cxx )\n  target_link_libraries(ImageText PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageText\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageText/#download-and-build-imagetext","title":"Download and Build ImageText","text":"

        Click here to download ImageText and its CMakeLists.txt file. Once the tarball ImageText.tar has been downloaded and extracted,

        cd ImageText/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageText\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageThreshold/","title":"ImageThreshold","text":"

        vtk-examples/Cxx/Images/ImageThreshold

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageThreshold/#description","title":"Description","text":"

        The image on the left is the input image and the image on the right is the thresholded version.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageThreshold/#code","title":"Code","text":"

        ImageThreshold.cxx

        #include <vtkImageActor.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageThreshold.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageMandelbrotSource> imageSource;\n  imageSource->Update();\n\n  vtkNew<vtkImageThreshold> imageThreshold;\n  imageThreshold->SetInputConnection(imageSource->GetOutputPort());\n  unsigned char lower = 100;\n  unsigned char upper = 200;\n\n  imageThreshold->ThresholdBetween(lower, upper);\n  imageThreshold->ReplaceInOn();\n  imageThreshold->SetInValue(255);\n  imageThreshold->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkImageActor> thresholdedActor;\n  thresholdedActor->GetMapper()->SetInputConnection(\n      imageThreshold->GetOutputPort());\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"ImageThreshold\");\n\n  // And one interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(.6, .5, .4);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(.4, .5, .6);\n  rightRenderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(thresholdedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageThreshold/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageThreshold)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageThreshold: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageThreshold MACOSX_BUNDLE ImageThreshold.cxx )\n  target_link_libraries(ImageThreshold PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageThreshold\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageThreshold/#download-and-build-imagethreshold","title":"Download and Build ImageThreshold","text":"

        Click here to download ImageThreshold and its CMakeLists.txt file. Once the tarball ImageThreshold.tar has been downloaded and extracted,

        cd ImageThreshold/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageThreshold\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageToPolyDataFilter/","title":"ImageToPolyDataFilter","text":"

        vtk-examples/Cxx/Images/ImageToPolyDataFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageToPolyDataFilter/#code","title":"Code","text":"

        ImageToPolyDataFilter.cxx

        #include <vtkActor.h>\n#include <vtkImageQuantizeRGBToIndex.h>\n#include <vtkImageToPolyDataFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangleFilter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cerr << \"Required arguments: filename.png e.g. Gourds.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkPNGReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageQuantizeRGBToIndex> quant;\n  quant->SetInputConnection(reader->GetOutputPort());\n  quant->SetNumberOfColors(16);\n\n  vtkNew<vtkImageToPolyDataFilter> i2pd;\n  i2pd->SetInputConnection(quant->GetOutputPort());\n  i2pd->SetLookupTable(quant->GetLookupTable());\n  i2pd->SetColorModeToLUT();\n  i2pd->SetOutputStyleToPolygonalize();\n  i2pd->SetError(0);\n  i2pd->DecimationOn();\n  i2pd->SetDecimationError(0.0);\n  i2pd->SetSubImageSize(25);\n\n  // Need a triangle filter because the polygons are complex and concave\n  vtkNew<vtkTriangleFilter> tf;\n  tf->SetInputConnection(i2pd->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(tf->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->SetSize(300, 250);\n  renderWindow->SetWindowName(\"ImageToPolyDataFilter\");\n\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageToPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageToPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersHybrid\n  IOImage\n  ImagingColor\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageToPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageToPolyDataFilter MACOSX_BUNDLE ImageToPolyDataFilter.cxx )\n  target_link_libraries(ImageToPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageToPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageToPolyDataFilter/#download-and-build-imagetopolydatafilter","title":"Download and Build ImageToPolyDataFilter","text":"

        Click here to download ImageToPolyDataFilter and its CMakeLists.txt file. Once the tarball ImageToPolyDataFilter.tar has been downloaded and extracted,

        cd ImageToPolyDataFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageToPolyDataFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageToStructuredPoints/","title":"ImageToStructuredPoints","text":"

        vtk-examples/Cxx/Images/ImageToStructuredPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageToStructuredPoints/#code","title":"Code","text":"

        ImageToStructuredPoints.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageCanvasSource2D.h>\n// #include <vtkImageData.h>\n#include <vtkImageToStructuredPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Gray\").GetData();\n  auto color2 = colors->GetColor3ub(\"Gray\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n  drawColor2[0] = 255;\n\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetExtent(0, 20, 0, 20, 0, 0);\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetDrawColor(drawColor1.data());\n  source->FillBox(0, 20, 0, 20);\n  source->SetDrawColor(drawColor2.data());\n  source->FillBox(0, 15, 0, 20);\n  source->Update();\n\n  vtkNew<vtkImageToStructuredPoints> convertFilter;\n  convertFilter->SetInputConnection(source->GetOutputPort());\n  convertFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(convertFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"LimeGreen\").GetData());\n\n  renderWindow->SetWindowName(\"ImageToStructuredPoints\");\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageToStructuredPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageToStructuredPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonExecutionModel\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageToStructuredPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageToStructuredPoints MACOSX_BUNDLE ImageToStructuredPoints.cxx )\n  target_link_libraries(ImageToStructuredPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageToStructuredPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageToStructuredPoints/#download-and-build-imagetostructuredpoints","title":"Download and Build ImageToStructuredPoints","text":"

        Click here to download ImageToStructuredPoints and its CMakeLists.txt file. Once the tarball ImageToStructuredPoints.tar has been downloaded and extracted,

        cd ImageToStructuredPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageToStructuredPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageTransparency/","title":"ImageTransparency","text":"

        vtk-examples/Cxx/Images/ImageTransparency

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageTransparency/#description","title":"Description","text":"

        Seealso

        ImageStencil and Transparency

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageTransparency/#code","title":"Code","text":"

        ImageTransparency.cxx

        #include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image, std::string const& colorNameunsigned,\n                      unsigned char const alpha);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> image;\n  // Use this to control the transparency [0 .. 255]\n  unsigned char alpha = 50;\n  CreateColorImage(image, \"Gold\", alpha);\n\n  // Create actor.\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputData(image);\n\n  // Visualize.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageTransparency\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateColorImage(vtkImageData* image, std::string const& colorName,\n                      unsigned char const alpha)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> drawColor{0, 0, 0};\n  auto color = colors->GetColor4ub(colorName).GetData();\n  for (auto i = 0; i < 4; ++i)\n  {\n    drawColor[i] = color[i];\n  }\n\n  unsigned int dim = 10;\n\n  // Specify the size of the image data.\n  image->SetDimensions(dim, dim, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 4);\n\n  int* dims = image->GetDimensions();\n\n  std::cout << \"Dims: \"\n            << \" x: \" << dims[0] << \" y: \" << dims[1] << \" z: \" << dims[2]\n            << std::endl;\n\n  for (unsigned char y = 0; y < dims[1]; y++)\n  {\n    for (unsigned char x = 0; x < dims[0]; x++)\n    {\n      auto pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (auto i = 0; i < 4; ++i)\n      {\n        pixel[i] = drawColor[i];\n      }\n      if (x < 5)\n      {\n        pixel[3] = alpha;\n      }\n      else\n      {\n        pixel[3] = 255;\n      }\n    }\n  }\n\n  image->Modified();\n}\n} // namespace\n
        "},{"location":"Cxx/Images/ImageTransparency/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageTransparency)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageTransparency: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageTransparency MACOSX_BUNDLE ImageTransparency.cxx )\n  target_link_libraries(ImageTransparency PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageTransparency\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageTransparency/#download-and-build-imagetransparency","title":"Download and Build ImageTransparency","text":"

        Click here to download ImageTransparency and its CMakeLists.txt file. Once the tarball ImageTransparency.tar has been downloaded and extracted,

        cd ImageTransparency/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageTransparency\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageValueRange/","title":"ImageValueRange","text":"

        vtk-examples/Cxx/Images/ImageValueRange

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageValueRange/#code","title":"Code","text":"

        ImageValueRange.cxx

        #include <vtkDoubleArray.h>\n#include <vtkImageData.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n\nint main(int, char*[])\n{\n  // Create the image data.\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data.\n  imageData->SetDimensions(5, 1, 1);\n  imageData->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = imageData->GetDimensions();\n\n  for (int x = 0; x < dims[0]; x++)\n  {\n    double* pixel = static_cast<double*>(imageData->GetScalarPointer(x, 0, 0));\n    pixel[0] = x * 10;\n  }\n\n  double valuesRange[2];\n  dynamic_cast<vtkDoubleArray*>(\n      imageData->GetPointData()->GetArray(\"ImageScalars\"))\n      ->GetValueRange(valuesRange);\n  std::cout << \"valuesRange = \" << valuesRange[0] << \" \" << valuesRange[1]\n            << std::endl;\n\n  // Alternatively.\n  auto min = imageData->GetScalarRange()[0];\n  auto max = imageData->GetScalarRange()[1];\n  std::cout << \"alternatively:\\nvaluesRange = \" << min << \" \" << max\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageValueRange/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageValueRange)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageValueRange: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageValueRange MACOSX_BUNDLE ImageValueRange.cxx )\n  target_link_libraries(ImageValueRange PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageValueRange\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageValueRange/#download-and-build-imagevaluerange","title":"Download and Build ImageValueRange","text":"

        Click here to download ImageValueRange and its CMakeLists.txt file. Once the tarball ImageValueRange.tar has been downloaded and extracted,

        cd ImageValueRange/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageValueRange\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageVariance3D/","title":"ImageVariance3D","text":"

        vtk-examples/Cxx/Images/ImageVariance3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageVariance3D/#code","title":"Code","text":"

        ImageVariance3D.cxx

        #include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageEllipsoidSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageVariance3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageEllipsoidSource> source;\n  source->SetWholeExtent(0, 20, 0, 20, 0, 0);\n  source->SetCenter(10, 10, 0);\n  source->SetRadius(3, 4, 0);\n  source->Update();\n\n  vtkNew<vtkImageVariance3D> varianceFilter;\n  varianceFilter->SetInputConnection(source->GetOutputPort());\n  varianceFilter->SetKernelSize(5, 4, 3);\n  varianceFilter->Update();\n\n  vtkNew<vtkImageCast> varianceCastFilter;\n  varianceCastFilter->SetOutputScalarTypeToFloat();\n  varianceCastFilter->SetInputConnection(varianceFilter->GetOutputPort());\n  varianceCastFilter->Update();\n\n  // Create actors.\n  vtkNew<vtkImageActor> originalActor;\n  originalActor->GetMapper()->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkImageActor> varianceActor;\n  varianceActor->GetMapper()->SetInputConnection(\n      varianceCastFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double originalViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double varianceViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->AddActor(originalActor);\n  originalRenderer->ResetCamera();\n  originalRenderer->SetBackground(.4, .5, .6);\n  originalRenderer->SetBackground(\n      colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> varianceRenderer;\n  varianceRenderer->SetViewport(varianceViewport);\n  varianceRenderer->AddActor(varianceActor);\n  varianceRenderer->ResetCamera();\n  varianceRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(varianceRenderer);\n  renderWindow->SetWindowName(\"ImageVariance3D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageVariance3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageVariance3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  ImagingGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageVariance3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageVariance3D MACOSX_BUNDLE ImageVariance3D.cxx )\n  target_link_libraries(ImageVariance3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageVariance3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageVariance3D/#download-and-build-imagevariance3d","title":"Download and Build ImageVariance3D","text":"

        Click here to download ImageVariance3D and its CMakeLists.txt file. Once the tarball ImageVariance3D.tar has been downloaded and extracted,

        cd ImageVariance3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageVariance3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ImageWarp/","title":"ImageWarp","text":"

        vtk-examples/Cxx/Images/ImageWarp

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/ImageWarp/#description","title":"Description","text":"

        Combining the imaging and visualization pipelines to deform an image in the z-direction. The vtkMergeFilter is used to combine the warped surface with the original color data.

        Info

        See Figure 10-17 in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ImageWarp/#code","title":"Code","text":"

        ImageWarp.cxx

        /*\n * This example shows how to combine data from both the imaging\n *  and graphics pipelines. The vtkMergeData filter is used to\n *  merge the data from each together.\n */\n#include <vtkActor.h>\n#include <vtkBMPReader.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkImageLuminance.h>\n#include <vtkMergeFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkWarpScalar.h>\n\n#include <array>\n#include <iomanip>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fileName\" << std::endl;\n    std::cout << \"where: fileName is the masonry.bmp file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{60, 93, 144, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Read in an image and compute a luminance value-> The image is extracted\n  // as a set of polygons (vtkImageDataGeometryFilter). We then will\n  // warp the plane using the scalar (luminance) values.\n  //\n  vtkNew<vtkBMPReader> reader;\n  reader->SetFileName(fileName.c_str());\n  // Convert the image to a grey scale.\n  vtkNew<vtkImageLuminance> luminance;\n  luminance->SetInputConnection(reader->GetOutputPort());\n  // Pass the data to the pipeline as polygons.\n  vtkNew<vtkImageDataGeometryFilter> geometry;\n  geometry->SetInputConnection(luminance->GetOutputPort());\n  // Warp the data in a direction perpendicular to the image plane.\n  vtkNew<vtkWarpScalar> warp;\n  warp->SetInputConnection(geometry->GetOutputPort());\n  warp->SetScaleFactor(-0.1);\n\n  // Use vtkMergeFilter to combine the original image with the warped geometry.\n  vtkNew<vtkMergeFilter> merge;\n  merge->SetGeometryConnection(warp->GetOutputPort());\n  merge->SetScalarsConnection(reader->GetOutputPort());\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(merge->GetOutputPort());\n  mapper->SetScalarRange(0, 255);\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create the rendering window, renderer, and interactive renderer.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(actor);\n  ren->ResetCamera();\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  // ren->GetActiveCamera()->Azimuth(20);\n  // ren->GetActiveCamera()->Elevation(30);\n  // ren->ResetCameraClippingRange();\n  // ren->GetActiveCamera()->Zoom(1.3);\n  ren->GetActiveCamera()->SetPosition(-100, -130, 325);\n  ren->GetActiveCamera()->SetFocalPoint(105, 114, -29);\n  ren->GetActiveCamera()->SetViewUp(0.51, 0.54, 0.67);\n  ren->ResetCameraClippingRange();\n\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"ImageWarp\");\n\n  // Render the image.\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ImageWarp/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageWarp)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOImage\n  ImagingColor\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageWarp: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageWarp MACOSX_BUNDLE ImageWarp.cxx )\n  target_link_libraries(ImageWarp PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageWarp\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ImageWarp/#download-and-build-imagewarp","title":"Download and Build ImageWarp","text":"

        Click here to download ImageWarp and its CMakeLists.txt file. Once the tarball ImageWarp.tar has been downloaded and extracted,

        cd ImageWarp/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageWarp\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/InteractWithImage/","title":"InteractWithImage","text":"

        vtk-examples/Cxx/Images/InteractWithImage

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/InteractWithImage/#description","title":"Description","text":"

        This example shows how to display an image and zoom/pan/adjust brightness interactively.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/InteractWithImage/#code","title":"Code","text":"

        InteractWithImage.cxx

        #include <vtkImageActor.h> // Note: this is a 3D actor (c.f. vtkImageMapper which is 2D)\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: Filename e.g. Ox.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetWindowName(\"InteractWithImage\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n\n  // Setup interactor style (this is what implements the zooming, panning and\n  // brightness adjustment functionality).\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/InteractWithImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InteractWithImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InteractWithImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InteractWithImage MACOSX_BUNDLE InteractWithImage.cxx )\n  target_link_libraries(InteractWithImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InteractWithImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/InteractWithImage/#download-and-build-interactwithimage","title":"Download and Build InteractWithImage","text":"

        Click here to download InteractWithImage and its CMakeLists.txt file. Once the tarball InteractWithImage.tar has been downloaded and extracted,

        cd InteractWithImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./InteractWithImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/Interpolation/","title":"Interpolation","text":"

        vtk-examples/Cxx/Images/Interpolation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/Interpolation/#code","title":"Code","text":"

        Interpolation.cxx

        #include <vtkImageData.h>\n#include <vtkImageProperty.h>\n#include <vtkImageResliceMapper.h>\n#include <vtkImageSlice.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData*);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> colorImage;\n  CreateColorImage(colorImage);\n\n  vtkNew<vtkImageResliceMapper> imageResliceMapper;\n  imageResliceMapper->SetInputData(colorImage);\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageResliceMapper);\n  imageSlice->GetProperty()->SetInterpolationTypeToNearest();\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300, 300);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Interpolation\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateColorImage(vtkImageData* image)\n{\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  vtkNew<vtkNamedColors> colors;\n  auto pixelColor = colors->GetColor3ub(\"Turquoise\").GetData();\n\n  for (unsigned int x = 0; x < 10; x++)\n  {\n    for (unsigned int y = 0; y < 10; y++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (auto j = 0; j < 3; ++j)\n      {\n        pixel[j] = pixelColor[j];\n      }\n    }\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/Images/Interpolation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Interpolation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingImage\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Interpolation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Interpolation MACOSX_BUNDLE Interpolation.cxx )\n  target_link_libraries(Interpolation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Interpolation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/Interpolation/#download-and-build-interpolation","title":"Download and Build Interpolation","text":"

        Click here to download Interpolation and its CMakeLists.txt file. Once the tarball Interpolation.tar has been downloaded and extracted,

        cd Interpolation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Interpolation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/MarkKeypoints/","title":"MarkKeypoints","text":"

        vtk-examples/Cxx/Images/MarkKeypoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/MarkKeypoints/#description","title":"Description","text":"
        • Thanks to Dean Inglis.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/MarkKeypoints/#code","title":"Code","text":"

        MarkKeypoints.cxx

        #include <sstream>\n#include <vtkAbstractPicker.h>\n#include <vtkActor2D.h>\n#include <vtkCoordinate.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVectorText.h>\n\n#include <array>\n\nnamespace {\n\nclass MyStyle : public vtkInteractorStyleImage\n{\npublic:\n  static MyStyle* New();\n  vtkTypeMacro(MyStyle, vtkInteractorStyleImage);\n\n  std::vector<vtkActor2D*> Numbers;\n\n  void OnLeftButtonDown() override\n  {\n    this->Interactor->GetPicker()->Pick(this->Interactor->GetEventPosition()[0],\n                                        this->Interactor->GetEventPosition()[1],\n                                        0, // always zero.\n                                        this->CurrentRenderer);\n    double picked[3];\n    this->Interactor->GetPicker()->GetPickPosition(picked);\n    this->AddNumber(picked);\n\n    // Forward events\n    vtkInteractorStyleImage::OnLeftButtonDown();\n\n    // this->Interactor->GetRenderWindow()->Render();\n    this->Interactor->Render();\n  }\n\n  void AddNumber(double p[3])\n  {\n    vtkNew<vtkNamedColors> colors;\n\n    std::cout << \"Adding marker at \" << p[0] << \" \" << p[1]; //<< std::endl;\n\n    // normally, with an image you would do\n    // double* s = image->GetSpacing();\n    // double* o = image->GetOrigin();\n    // p[0] = static_cast<int>( (p[0] - o[0]) / s[0] + 0.5 );\n    p[0] = static_cast<int>(p[0] + 0.5);\n    p[1] = static_cast<int>(p[1] + 0.5);\n\n    std::cout << \" -> \" << p[0] << \" \" << p[1] << std::endl;\n\n    // Convert the current number to a string\n    std::stringstream ss;\n    ss << Numbers.size();\n\n    // Create an actor for the text\n    vtkNew<vtkVectorText> textSource;\n    textSource->SetText(ss.str().c_str());\n\n    // get the bounds of the text\n    textSource->Update();\n    double* bounds = textSource->GetOutput()->GetBounds();\n    // transform the polydata to be centered over the pick position\n    double center[3] = {0.5 * (bounds[1] + bounds[0]),\n                        0.5 * (bounds[3] + bounds[2]), 0.0};\n\n    vtkNew<vtkTransform> trans;\n    trans->Translate(-center[0], -center[1], 0);\n    trans->Translate(p[0], p[1], 0);\n\n    vtkNew<vtkTransformPolyDataFilter> tpd;\n    tpd->SetTransform(trans);\n    tpd->SetInputConnection(textSource->GetOutputPort());\n\n    // Create a mapper\n    vtkNew<vtkPolyDataMapper2D> mapper;\n    vtkNew<vtkCoordinate> coordinate;\n    coordinate->SetCoordinateSystemToWorld();\n    mapper->SetTransformCoordinate(coordinate);\n    mapper->SetInputConnection(tpd->GetOutputPort());\n\n    vtkNew<vtkActor2D> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n    this->CurrentRenderer->AddViewProp(actor);\n    this->Numbers.push_back(actor);\n  }\n};\n\nvtkStandardNewMacro(MyStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"DimGray\").GetData();\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color2 = colors->GetColor3ub(\"HotPink\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create a blank, black image\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 20, 0, 50, 0, 0);\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(0, 20, 0, 50);\n\n  // Draw a circle of radius 5 centered at (9,10)\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(9, 10, 5);\n  drawing->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(drawing->GetOutputPort());\n  actor->InterpolateOff();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MarkKeypoints\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SkyBlue\").GetData());\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<MyStyle> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->SetDefaultRenderer(renderer);\n  style->SetCurrentRenderer(renderer);\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/MarkKeypoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarkKeypoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarkKeypoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarkKeypoints MACOSX_BUNDLE MarkKeypoints.cxx )\n  target_link_libraries(MarkKeypoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarkKeypoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/MarkKeypoints/#download-and-build-markkeypoints","title":"Download and Build MarkKeypoints","text":"

        Click here to download MarkKeypoints and its CMakeLists.txt file. Once the tarball MarkKeypoints.tar has been downloaded and extracted,

        cd MarkKeypoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MarkKeypoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/NegativeIndices/","title":"NegativeIndices","text":"

        vtk-examples/Cxx/Images/NegativeIndices

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/NegativeIndices/#code","title":"Code","text":"

        NegativeIndices.cxx

        #include <vtkImageData.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // Create the image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetExtent(-5, 5, -5, 5, -5, 5);\n\n  // Fill every entry of the image data with \"2.0\"\n  int* extent = imageData->GetExtent();\n\n  imageData->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  std::cout << \"Extent: \"\n            << \" xmin: \" << extent[0] << \" xmax: \" << extent[1]\n            << \" ymin: \" << extent[2] << \" ymax: \" << extent[3]\n            << \" zmin: \" << extent[4] << \" zmax: \" << extent[5] << std::endl;\n\n  for (int z = extent[4]; z < extent[5]; z++)\n  {\n    for (int y = extent[2]; y < extent[3]; y++)\n    {\n      for (int x = extent[0]; x < extent[1]; x++)\n      {\n        imageData->SetScalarComponentFromDouble(x, y, z, 0, 2.0);\n      }\n    }\n  }\n\n  // Retrieve the entries from the image data and print them to the screen\n  for (int z = extent[4]; z < extent[5]; z++)\n  {\n    for (int y = extent[2]; y < extent[3]; y++)\n    {\n      for (int x = extent[0]; x < extent[1]; x++)\n      {\n        // Zero is the component, add another loop if you have more\n        // than one component\n        double v = imageData->GetScalarComponentAsDouble(x, y, z, 0);\n        // Eo something with v\n        std::cout << v << \" \";\n      }\n      std::cout << std::endl;\n    }\n    std::cout << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/NegativeIndices/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NegativeIndices)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NegativeIndices: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NegativeIndices MACOSX_BUNDLE NegativeIndices.cxx )\n  target_link_libraries(NegativeIndices PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NegativeIndices\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/NegativeIndices/#download-and-build-negativeindices","title":"Download and Build NegativeIndices","text":"

        Click here to download NegativeIndices and its CMakeLists.txt file. Once the tarball NegativeIndices.tar has been downloaded and extracted,

        cd NegativeIndices/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./NegativeIndices\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/PickPixel/","title":"PickPixel","text":"

        vtk-examples/Cxx/Images/PickPixel

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/PickPixel/#description","title":"Description","text":"

        This example demonstrates how to continuously retrieve pixel values using the mouse.

        • Contributed by: Dean Inglis

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/PickPixel/#code","title":"Code","text":"

        PickPixel.cxx

        #include <vtkAssemblyPath.h>\n#include <vtkCell.h>\n#include <vtkCommand.h>\n#include <vtkCornerAnnotation.h>\n#include <vtkDataArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageViewer2.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPropPicker.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n\n// The mouse motion callback, to pick the image and recover pixel values.\nclass vtkImageInteractionCallback1 : public vtkCommand\n{\npublic:\n  static vtkImageInteractionCallback1* New()\n  {\n    return new vtkImageInteractionCallback1;\n  }\n\n  vtkImageInteractionCallback1()\n  {\n    this->Viewer = 0;\n    this->Picker = 0;\n    this->Annotation = 0;\n    this->PointData = vtkPointData::New();\n  }\n\n  ~vtkImageInteractionCallback1()\n  {\n    this->Viewer = 0;\n    this->Picker = 0;\n    this->Annotation = 0;\n    this->PointData->Delete();\n  }\n\n  void SetPicker(vtkPropPicker* picker)\n  {\n    this->Picker = picker;\n  }\n\n  void SetAnnotation(vtkCornerAnnotation* annotation)\n  {\n    this->Annotation = annotation;\n  }\n\n  void SetViewer(vtkImageViewer2* viewer)\n  {\n    this->Viewer = viewer;\n  }\n\n  virtual void Execute(vtkObject*, unsigned long vtkNotUsed(event), void*)\n  {\n    // this->Viewer;\n    vtkRenderWindowInteractor* interactor =\n        this->Viewer->GetRenderWindow()->GetInteractor();\n    vtkRenderer* renderer = this->Viewer->GetRenderer();\n    vtkImageActor* actor = this->Viewer->GetImageActor();\n    vtkImageData* image = this->Viewer->GetInput();\n    vtkInteractorStyle* style =\n        dynamic_cast<vtkInteractorStyle*>(interactor->GetInteractorStyle());\n\n    // Pick at the mouse location provided by the interactor.\n    this->Picker->Pick(interactor->GetEventPosition()[0],\n                       interactor->GetEventPosition()[1], 0.0, renderer);\n\n    // There could be other props assigned to this picker, so\n    // make sure we picked the image actor.\n    vtkAssemblyPath* path = this->Picker->GetPath();\n    bool validPick = false;\n\n    if (path)\n    {\n      vtkCollectionSimpleIterator sit;\n      path->InitTraversal(sit);\n      // vtkAssemblyNode *node;\n      for (int i = 0; i < path->GetNumberOfItems() && !validPick; ++i)\n      {\n        auto node = path->GetNextNode(sit);\n        if (actor == dynamic_cast<vtkImageActor*>(node->GetViewProp()))\n        {\n          validPick = true;\n        }\n      }\n    }\n\n    if (!validPick)\n    {\n      this->Annotation->SetText(0, \"Off Image\");\n      interactor->Render();\n      // Pass the event further on.\n      style->OnMouseMove();\n      return;\n    }\n\n    // Get the world coordinates of the pick.\n    double pos[3];\n    this->Picker->GetPickPosition(pos);\n    // Fixes some numerical problems with the picking.\n    double* bounds = actor->GetDisplayBounds();\n    int axis = this->Viewer->GetSliceOrientation();\n    pos[axis] = bounds[2 * axis];\n\n    vtkPointData* pd = image->GetPointData();\n    if (!pd)\n    {\n      return;\n    }\n\n    this->PointData->InterpolateAllocate(pd, 1, 1);\n\n    // Use tolerance as a function of size of source data.\n    double tol2 = image->GetLength();\n    tol2 = tol2 ? tol2 * tol2 / 1000.0 : 0.001;\n\n    // Find the cell that contains pos.\n    int subId;\n    double pcoords[3], weights[8];\n    vtkCell* cell =\n        image->FindAndGetCell(pos, NULL, -1, tol2, subId, pcoords, weights);\n    if (cell)\n    {\n      // Interpolate the point data.\n      this->PointData->InterpolatePoint(pd, 0, cell->PointIds, weights);\n      int components = this->PointData->GetScalars()->GetNumberOfComponents();\n      double* tuple = this->PointData->GetScalars()->GetTuple(0);\n\n      std::string message = \"Location: ( \";\n      message += vtkVariant(pos[0]).ToString();\n      message += \", \";\n      message += vtkVariant(pos[1]).ToString();\n      message += \", \";\n      message += vtkVariant(pos[2]).ToString();\n      message += \" )\\nValue: ( \";\n\n      for (int c = 0; c < components; ++c)\n      {\n        message += vtkVariant(tuple[c]).ToString();\n        if (c != components - 1)\n        {\n          message += \", \";\n        }\n      }\n      message += \" )\";\n      this->Annotation->SetText(0, message.c_str());\n      interactor->Render();\n      style->OnMouseMove();\n    }\n  }\n\nprivate:\n  // Pointer to the viewer.\n  vtkImageViewer2* Viewer;\n\n  // Pointer to the picke.r\n  vtkPropPicker* Picker;\n\n  // Pointer to the annotation.\n  vtkCornerAnnotation* Annotation;\n\n  // Interpolator.\n  vtkPointData* PointData;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  // Picker to pick pixels.\n  vtkNew<vtkPropPicker> propPicker;\n  propPicker->PickFromListOn();\n\n  // Give the picker a prop to pick.\n  vtkNew<vtkImageViewer2> imageViewer;\n  propPicker->AddPickList(imageViewer->GetImageActor());\n\n  // Visualize.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->SetSize(600, 600);\n  imageViewer->GetRenderWindow()->SetWindowName(\"PickPixel\");\n\n  vtkRenderer* renderer = imageViewer->GetRenderer();\n  renderer->ResetCamera();\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Annotate the image with window/level and mouse over pixel information.\n  vtkNew<vtkCornerAnnotation> cornerAnnotation;\n  cornerAnnotation->SetLinearFontScaleFactor(2);\n  cornerAnnotation->SetNonlinearFontScaleFactor(1);\n  cornerAnnotation->SetMaximumFontSize(20);\n  cornerAnnotation->SetText(0, \"Off Image\");\n  cornerAnnotation->SetText(3, \"<window>\\n<level>\");\n  cornerAnnotation->GetTextProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  imageViewer->GetRenderer()->AddViewProp(cornerAnnotation);\n\n  // Callback listens to MouseMoveEvents invoked by the interactor's style.\n  vtkNew<vtkImageInteractionCallback1> callback;\n  callback->SetViewer(imageViewer);\n  callback->SetAnnotation(cornerAnnotation);\n  callback->SetPicker(propPicker);\n\n  // InteractorStyleImage allows for the following controls:\n  // 1) middle mouse + move = camera pan\n  // 2) left mouse + move = window/level\n  // 3) right mouse + move = camera zoom\n  // 4) middle mouse wheel scroll = zoom\n  // 5) 'r' = reset window/level\n  // 6) shift + 'r' = reset camera\n  vtkInteractorStyleImage* imageStyle = imageViewer->GetInteractorStyle();\n  imageStyle->AddObserver(vtkCommand::MouseMoveEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/PickPixel/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PickPixel)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PickPixel: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PickPixel MACOSX_BUNDLE PickPixel.cxx )\n  target_link_libraries(PickPixel PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PickPixel\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/PickPixel/#download-and-build-pickpixel","title":"Download and Build PickPixel","text":"

        Click here to download PickPixel and its CMakeLists.txt file. Once the tarball PickPixel.tar has been downloaded and extracted,

        cd PickPixel/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PickPixel\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/PickPixel2/","title":"PickPixel2","text":"

        vtk-examples/Cxx/Images/PickPixel2

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/PickPixel2/#description","title":"Description","text":"

        This example demonstrates how to continuously retrieve pixel values using the mouse.

        This example is a slight modification of the existing example PickPixel. The main difference is the display of the exact pixel coordinates and values instead of interpolated values.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/PickPixel2/#code","title":"Code","text":"

        PickPixel2.cxx

        #include <vtkAssemblyPath.h>\n#include <vtkCell.h>\n#include <vtkCommand.h>\n#include <vtkCornerAnnotation.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageData.h>\n#include <vtkImageNoiseSource.h>\n#include <vtkImageViewer2.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPropPicker.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTIFFReader.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n\n// Template for image value reading.\ntemplate <typename T>\nvoid vtkValueMessageTemplate(vtkImageData* image, int* position,\n                             std::string& message)\n{\n  T* tuple = ((T*)image->GetScalarPointer(position));\n  int components = image->GetNumberOfScalarComponents();\n  for (int c = 0; c < components; ++c)\n  {\n    message += vtkVariant(tuple[c]).ToString();\n    if (c != (components - 1))\n    {\n      message += \", \";\n    }\n  }\n  message += \" )\";\n}\n\n// The mouse motion callback, to pick the image and recover pixel values.\nclass vtkImageInteractionCallback : public vtkCommand\n{\npublic:\n  static vtkImageInteractionCallback* New()\n  {\n    return new vtkImageInteractionCallback;\n  }\n\n  vtkImageInteractionCallback()\n  {\n    this->Viewer = NULL;\n    this->Picker = NULL;\n    this->Annotation = NULL;\n  }\n\n  ~vtkImageInteractionCallback()\n  {\n    this->Viewer = NULL;\n    this->Picker = NULL;\n    this->Annotation = NULL;\n  }\n\n  void SetPicker(vtkPropPicker* picker)\n  {\n    this->Picker = picker;\n  }\n\n  void SetAnnotation(vtkCornerAnnotation* annotation)\n  {\n    this->Annotation = annotation;\n  }\n\n  void SetViewer(vtkImageViewer2* viewer)\n  {\n    this->Viewer = viewer;\n  }\n\n  virtual void Execute(vtkObject*, unsigned long vtkNotUsed(event), void*)\n  {\n    vtkRenderWindowInteractor* interactor =\n        this->Viewer->GetRenderWindow()->GetInteractor();\n    vtkRenderer* renderer = this->Viewer->GetRenderer();\n    vtkImageActor* actor = this->Viewer->GetImageActor();\n    vtkImageData* image = this->Viewer->GetInput();\n    vtkInteractorStyle* style =\n        dynamic_cast<vtkInteractorStyle*>(interactor->GetInteractorStyle());\n\n    // Pick at the mouse location provided by the interactor.\n    this->Picker->Pick(interactor->GetEventPosition()[0],\n                       interactor->GetEventPosition()[1], 0.0, renderer);\n\n    // There could be other props assigned to this picker, so\n    // make sure we picked the image actor.\n    vtkAssemblyPath* path = this->Picker->GetPath();\n    bool validPick = false;\n\n    if (path)\n    {\n      vtkCollectionSimpleIterator sit;\n      path->InitTraversal(sit);\n      for (int i = 0; i < path->GetNumberOfItems() && !validPick; ++i)\n      {\n        auto node = path->GetNextNode(sit);\n        if (actor == dynamic_cast<vtkImageActor*>(node->GetViewProp()))\n        {\n          validPick = true;\n        }\n      }\n    }\n\n    if (!validPick)\n    {\n      this->Annotation->SetText(0, \"Off Image\");\n      interactor->Render();\n      // Pass the event further on.\n      style->OnMouseMove();\n      return;\n    }\n\n    // Get the world coordinates of the pick.\n    double pos[3];\n    this->Picker->GetPickPosition(pos);\n\n    int image_coordinate[3];\n\n    int axis = this->Viewer->GetSliceOrientation();\n    switch (axis)\n    {\n    case vtkImageViewer2::SLICE_ORIENTATION_XZ:\n      image_coordinate[0] = vtkMath::Round(pos[0]);\n      image_coordinate[1] = this->Viewer->GetSlice();\n      image_coordinate[2] = vtkMath::Round(pos[2]);\n      break;\n    case vtkImageViewer2::SLICE_ORIENTATION_YZ:\n      image_coordinate[0] = this->Viewer->GetSlice();\n      image_coordinate[1] = vtkMath::Round(pos[0]);\n      image_coordinate[2] = vtkMath::Round(pos[1]);\n      break;\n    default: // vtkImageViewer2::SLICE_ORIENTATION_XY\n      image_coordinate[0] = vtkMath::Round(pos[0]);\n      image_coordinate[1] = vtkMath::Round(pos[1]);\n      image_coordinate[2] = this->Viewer->GetSlice();\n      break;\n    }\n\n    std::string message = \"Location: ( \";\n    message += vtkVariant(image_coordinate[0]).ToString();\n    message += \", \";\n    message += vtkVariant(image_coordinate[1]).ToString();\n    message += \", \";\n    message += vtkVariant(image_coordinate[2]).ToString();\n    message += \" )\\nValue: ( \";\n\n    switch (image->GetScalarType())\n    {\n      vtkTemplateMacro(\n          (vtkValueMessageTemplate<VTK_TT>(image, image_coordinate, message)));\n\n    default:\n      return;\n    }\n\n    this->Annotation->SetText(0, message.c_str());\n    interactor->Render();\n    style->OnMouseMove();\n  }\n\nprivate:\n  vtkImageViewer2* Viewer;         // Pointer to the viewer\n  vtkPropPicker* Picker;           // Pointer to the picker\n  vtkCornerAnnotation* Annotation; // Pointer to the annotation\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << argv[0]\n              << \" Required parameters: (tif) Filename e.g. ColorCells.tif\"\n              << std::endl\n              << \"missing...\" << std::endl;\n    std::cout << \"A noise image will be created!\" << std::endl;\n\n    // Create a noise image.\n    vtkNew<vtkImageNoiseSource> noiseSource;\n    noiseSource->SetWholeExtent(0, 512, 0, 512, 0, 0);\n    noiseSource->SetMinimum(0.0);\n    noiseSource->SetMaximum(255.0);\n\n    // Cast noise image to unsigned char.\n    vtkNew<vtkImageCast> imageCast;\n    imageCast->SetInputConnection(noiseSource->GetOutputPort());\n    imageCast->SetOutputScalarTypeToUnsignedChar();\n    imageCast->Update();\n\n    // Connect to image viewer pipeline.\n    imageViewer->SetInputConnection(imageCast->GetOutputPort());\n  }\n  else\n  {\n    // Parse input argument.\n    std::string inputFilename = argv[1];\n\n    // Read the image.\n    vtkNew<vtkTIFFReader> tiffReader;\n    if (!tiffReader->CanReadFile(inputFilename.c_str()))\n    {\n      std::cout << argv[0] << \": Error reading file \" << inputFilename\n                << std::endl;\n      return EXIT_FAILURE;\n    }\n    tiffReader->SetFileName(inputFilename.c_str());\n\n    // Connect to image viewer pipeline.\n    imageViewer->SetInputConnection(tiffReader->GetOutputPort());\n  }\n\n  // Picker to pick pixels.\n  vtkNew<vtkPropPicker> propPicker;\n  propPicker->PickFromListOn();\n\n  // Give the picker a prop to pick.\n  vtkImageActor* imageActor = imageViewer->GetImageActor();\n  propPicker->AddPickList(imageActor);\n\n  // Disable interpolation, so we can see each pixel.\n  imageActor->InterpolateOff();\n\n  // Visualize.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->SetupInteractor(renderWindowInteractor);\n  imageViewer->SetSize(600, 600);\n  imageViewer->GetRenderWindow()->SetWindowName(\"PickPixel2\");\n\n  vtkRenderer* renderer = imageViewer->GetRenderer();\n  renderer->ResetCamera();\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Annotate the image with window/level and mouse over pixel\n  // information\n  vtkNew<vtkCornerAnnotation> cornerAnnotation;\n  cornerAnnotation->SetLinearFontScaleFactor(2);\n  cornerAnnotation->SetNonlinearFontScaleFactor(1);\n  cornerAnnotation->SetMaximumFontSize(20);\n  cornerAnnotation->SetText(0, \"Off Image\");\n  cornerAnnotation->SetText(3, \"<window>\\n<level>\");\n  cornerAnnotation->GetTextProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  imageViewer->GetRenderer()->AddViewProp(cornerAnnotation);\n\n  // Callback listens to MouseMoveEvents invoked by the interactor's style\n  vtkNew<vtkImageInteractionCallback> callback;\n  callback->SetViewer(imageViewer);\n  callback->SetAnnotation(cornerAnnotation);\n  callback->SetPicker(propPicker);\n\n  // InteractorStyleImage allows for the following controls:\n  // 1) middle mouse + move = camera pan\n  // 2) left mouse + move = window/level\n  // 3) right mouse + move = camera zoom\n  // 4) middle mouse wheel scroll = zoom\n  // 5) 'r' = reset window/level\n  // 6) shift + 'r' = reset camera\n  vtkInteractorStyleImage* imageStyle = imageViewer->GetInteractorStyle();\n  imageStyle->AddObserver(vtkCommand::MouseMoveEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/PickPixel2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PickPixel2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PickPixel2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PickPixel2 MACOSX_BUNDLE PickPixel2.cxx )\n  target_link_libraries(PickPixel2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PickPixel2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/PickPixel2/#download-and-build-pickpixel2","title":"Download and Build PickPixel2","text":"

        Click here to download PickPixel2 and its CMakeLists.txt file. Once the tarball PickPixel2.tar has been downloaded and extracted,

        cd PickPixel2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PickPixel2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/RGBToHSI/","title":"RGBToHSI","text":"

        vtk-examples/Cxx/Images/RGBToHSI

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/RGBToHSI/#description","title":"Description","text":"

        Convert RGB channels to HSI channels. See this article for a description of the HSI colormodel.

        Seealso

        RGBToYIQ and RGBToHSV

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/RGBToHSI/#code","title":"Code","text":"

        RGBToHSI.cxx

        #include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageRGBToHSI.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \"image e.g. Gourds2.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageRGBToHSI> hsiFilter;\n  hsiFilter->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageExtractComponents> extractHFilter;\n  extractHFilter->SetInputConnection(hsiFilter->GetOutputPort());\n  extractHFilter->SetComponents(0);\n\n  vtkNew<vtkImageExtractComponents> extractSFilter;\n  extractSFilter->SetInputConnection(hsiFilter->GetOutputPort());\n  extractSFilter->SetComponents(1);\n\n  vtkNew<vtkImageExtractComponents> extractIFilter;\n  extractIFilter->SetInputConnection(hsiFilter->GetOutputPort());\n  extractIFilter->SetComponents(2);\n\n  // Create actors.\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> hActor;\n  hActor->GetMapper()->SetInputConnection(extractHFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> sActor;\n  sActor->GetMapper()->SetInputConnection(extractSFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> iActor;\n  iActor->GetMapper()->SetInputConnection(extractIFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double hViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double sViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double iViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Shared camera.\n  vtkNew<vtkCamera> sharedCamera;\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->SetActiveCamera(sharedCamera);\n  inputRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> hRenderer;\n  hRenderer->SetViewport(hViewport);\n  hRenderer->AddActor(hActor);\n  hRenderer->SetActiveCamera(sharedCamera);\n  hRenderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> sRenderer;\n  sRenderer->SetViewport(sViewport);\n  sRenderer->AddActor(sActor);\n  sRenderer->SetActiveCamera(sharedCamera);\n  sRenderer->SetBackground(colors->GetColor3d(\"LavenderBlush\").GetData());\n\n  vtkNew<vtkRenderer> iRenderer;\n  iRenderer->SetViewport(iViewport);\n  iRenderer->AddActor(iActor);\n  iRenderer->SetActiveCamera(sharedCamera);\n  iRenderer->SetBackground(colors->GetColor3d(\"Lavender\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->SetWindowName(\"RGBToHSI\");\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(hRenderer);\n  renderWindow->AddRenderer(sRenderer);\n  renderWindow->AddRenderer(iRenderer);\n  inputRenderer->ResetCamera();\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/RGBToHSI/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RGBToHSI)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RGBToHSI: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RGBToHSI MACOSX_BUNDLE RGBToHSI.cxx )\n  target_link_libraries(RGBToHSI PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RGBToHSI\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/RGBToHSI/#download-and-build-rgbtohsi","title":"Download and Build RGBToHSI","text":"

        Click here to download RGBToHSI and its CMakeLists.txt file. Once the tarball RGBToHSI.tar has been downloaded and extracted,

        cd RGBToHSI/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RGBToHSI\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/RGBToHSV/","title":"RGBToHSV","text":"

        vtk-examples/Cxx/Images/RGBToHSV

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/RGBToHSV/#description","title":"Description","text":"

        Convert RGB channels to HSV channels. See this article for a description of the RGB colormodel.

        Seealso

        RGBToYIQ and RGBToHSI

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/RGBToHSV/#code","title":"Code","text":"

        RGBToHSV.cxx

        #include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageRGBToHSV.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \"image e.g. Gourds2.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageRGBToHSV> hsvFilter;\n  hsvFilter->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageExtractComponents> extractHueFilter;\n  extractHueFilter->SetInputConnection(hsvFilter->GetOutputPort());\n  extractHueFilter->SetComponents(0);\n\n  vtkNew<vtkImageExtractComponents> extractSaturationFilter;\n  extractSaturationFilter->SetInputConnection(hsvFilter->GetOutputPort());\n  extractSaturationFilter->SetComponents(1);\n\n  vtkNew<vtkImageExtractComponents> extractValueFilter;\n  extractValueFilter->SetInputConnection(hsvFilter->GetOutputPort());\n  extractValueFilter->SetComponents(2);\n\n  // Create actors.\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> hActor;\n  hActor->GetMapper()->SetInputConnection(extractHueFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> sActor;\n  sActor->GetMapper()->SetInputConnection(\n      extractSaturationFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> vActor;\n  vActor->GetMapper()->SetInputConnection(extractValueFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double hViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double sViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double vViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Shared camera.\n  vtkNew<vtkCamera> sharedCamera;\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->SetActiveCamera(sharedCamera);\n  inputRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> hRenderer;\n  hRenderer->SetViewport(hViewport);\n  hRenderer->AddActor(hActor);\n  hRenderer->SetActiveCamera(sharedCamera);\n  hRenderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> sRenderer;\n  sRenderer->SetViewport(sViewport);\n  sRenderer->AddActor(sActor);\n  sRenderer->SetActiveCamera(sharedCamera);\n  sRenderer->SetBackground(colors->GetColor3d(\"LavenderBlush\").GetData());\n\n  vtkNew<vtkRenderer> vRenderer;\n  vRenderer->SetViewport(vViewport);\n  vRenderer->AddActor(vActor);\n  vRenderer->SetActiveCamera(sharedCamera);\n  vRenderer->SetBackground(colors->GetColor3d(\"Lavender\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->SetWindowName(\"RGBToHSV\");\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(hRenderer);\n  renderWindow->AddRenderer(sRenderer);\n  renderWindow->AddRenderer(vRenderer);\n  inputRenderer->ResetCamera();\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/RGBToHSV/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RGBToHSV)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RGBToHSV: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RGBToHSV MACOSX_BUNDLE RGBToHSV.cxx )\n  target_link_libraries(RGBToHSV PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RGBToHSV\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/RGBToHSV/#download-and-build-rgbtohsv","title":"Download and Build RGBToHSV","text":"

        Click here to download RGBToHSV and its CMakeLists.txt file. Once the tarball RGBToHSV.tar has been downloaded and extracted,

        cd RGBToHSV/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RGBToHSV\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/RGBToYIQ/","title":"RGBToYIQ","text":"

        vtk-examples/Cxx/Images/RGBToYIQ

        "},{"location":"Cxx/Images/RGBToYIQ/#description","title":"Description","text":"

        Convert RGB channels to YIQ channels. See this article for a description of the YIQ colormodel.

        Seealso

        RGBToHSV and RGBToHSI

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/RGBToYIQ/#code","title":"Code","text":"

        RGBToYIQ.cxx

        #include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageRGBToYIQ.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify command line arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \"image e.g. Gourds2.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkImageRGBToYIQ> yiqFilter;\n  yiqFilter->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageExtractComponents> extractYFilter;\n  extractYFilter->SetInputConnection(yiqFilter->GetOutputPort());\n  extractYFilter->SetComponents(0);\n\n  vtkNew<vtkImageExtractComponents> extractIFilter;\n  extractIFilter->SetInputConnection(yiqFilter->GetOutputPort());\n  extractIFilter->SetComponents(1);\n\n  vtkNew<vtkImageExtractComponents> extractQFilter;\n  extractQFilter->SetInputConnection(yiqFilter->GetOutputPort());\n  extractQFilter->SetComponents(2);\n\n  // Create actors.\n  vtkNew<vtkImageActor> inputActor;\n  inputActor->GetMapper()->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkImageActor> yActor;\n  yActor->GetMapper()->SetInputConnection(extractYFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> iActor;\n  iActor->GetMapper()->SetInputConnection(extractIFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> qActor;\n  qActor->GetMapper()->SetInputConnection(extractQFilter->GetOutputPort());\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double inputViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double yViewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double iViewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double qViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Shared camera.\n  vtkNew<vtkCamera> sharedCamera;\n\n  // Setup renderers.\n  vtkNew<vtkRenderer> inputRenderer;\n  inputRenderer->SetViewport(inputViewport);\n  inputRenderer->AddActor(inputActor);\n  inputRenderer->SetActiveCamera(sharedCamera);\n  inputRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderer> yRenderer;\n  yRenderer->SetViewport(yViewport);\n  yRenderer->AddActor(yActor);\n  yRenderer->SetActiveCamera(sharedCamera);\n  yRenderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> iRenderer;\n  iRenderer->SetViewport(iViewport);\n  iRenderer->AddActor(iActor);\n  iRenderer->SetActiveCamera(sharedCamera);\n  iRenderer->SetBackground(colors->GetColor3d(\"LavenderBlush\").GetData());\n\n  vtkNew<vtkRenderer> qRenderer;\n  qRenderer->SetViewport(qViewport);\n  qRenderer->AddActor(qActor);\n  qRenderer->SetActiveCamera(sharedCamera);\n  qRenderer->SetBackground(colors->GetColor3d(\"Lavender\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->SetWindowName(\"RGBToYIQ\");\n  renderWindow->AddRenderer(inputRenderer);\n  renderWindow->AddRenderer(yRenderer);\n  renderWindow->AddRenderer(iRenderer);\n  renderWindow->AddRenderer(qRenderer);\n  inputRenderer->ResetCamera();\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/RGBToYIQ/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RGBToYIQ)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RGBToYIQ: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RGBToYIQ MACOSX_BUNDLE RGBToYIQ.cxx )\n  target_link_libraries(RGBToYIQ PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RGBToYIQ\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/RGBToYIQ/#download-and-build-rgbtoyiq","title":"Download and Build RGBToYIQ","text":"

        Click here to download RGBToYIQ and its CMakeLists.txt file. Once the tarball RGBToYIQ.tar has been downloaded and extracted,

        cd RGBToYIQ/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RGBToYIQ\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/RTAnalyticSource/","title":"RTAnalyticSource","text":"

        vtk-examples/Cxx/Images/RTAnalyticSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/RTAnalyticSource/#code","title":"Code","text":"

        RTAnalyticSource.cxx

        #include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRTAnalyticSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRTAnalyticSource> analyticSource;\n  analyticSource->SetWholeExtent(-10, 10, -10, 10, 0, 0);\n\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputConnection(analyticSource->GetOutputPort());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"RTAnalyticSource\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  interactor->SetRenderWindow(renderWindow);\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderWindow->AddRenderer(renderer);\n\n  renderer->AddActor(imageActor);\n\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/RTAnalyticSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RTAnalyticSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RTAnalyticSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RTAnalyticSource MACOSX_BUNDLE RTAnalyticSource.cxx )\n  target_link_libraries(RTAnalyticSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RTAnalyticSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/RTAnalyticSource/#download-and-build-rtanalyticsource","title":"Download and Build RTAnalyticSource","text":"

        Click here to download RTAnalyticSource and its CMakeLists.txt file. Once the tarball RTAnalyticSource.tar has been downloaded and extracted,

        cd RTAnalyticSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RTAnalyticSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ResizeImage/","title":"ResizeImage","text":"

        vtk-examples/Cxx/Images/ResizeImage

        "},{"location":"Cxx/Images/ResizeImage/#description","title":"Description","text":"

        Resize an image using a sinc interpolator. Without command line arguments, the example resizes a synthetic image. An image file can be passed on the command lines. The new dimensions can also be passed as well as an integer specifying the window for sinc interpolator. See vtkImageSincInterpolator for details. A -1 turns off interpolation.

        Several window functions are provided. See this article for a description og window functions.

        vtkImageResize maintains the physical size of the image.

        Note

        This example was inspired by a question asked by Qiang Wang.

        Seealso

        The paper \"Some windows with very good sidelobe behavior\" describes the windows implemented in vtkImageSincInterpolator.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ResizeImage/#code","title":"Code","text":"

        ResizeImage.cxx

        #include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageResize.h>\n#include <vtkImageSincInterpolator.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkImageData> imageData;\n\n  int newSize[2] = {200, 10};\n  int windowFunction = 0;\n\n  // Verify input arguments\n  // e.g. Gourds2.jpg 1280 1024 5\n  if (argc > 1)\n  {\n    // Read the image\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> reader;\n    reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    imageData = reader->GetOutput();\n\n    if (argc > 3)\n    {\n      newSize[0] = atoi(argv[2]);\n      newSize[1] = atoi(argv[3]);\n    }\n    if (argc > 4)\n    {\n      windowFunction = atoi(argv[4]);\n    }\n  }\n  else\n  {\n    std::array<double, 3> drawColor1{0, 0, 0};\n    auto color1 = colors->GetColor3ub(\"Gray\").GetData();\n    std::array<double, 3> drawColor2{0, 0, 0};\n    auto color2 = colors->GetColor3ub(\"Aquamarine\").GetData();\n    std::array<double, 3> drawColor3{0, 0, 0};\n    auto color3 = colors->GetColor3ub(\"Violet\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n      drawColor3[i] = color3[i];\n    }\n\n    vtkNew<vtkImageCanvasSource2D> canvasSource;\n    canvasSource->SetExtent(0, 100, 0, 100, 0, 0);\n    canvasSource->SetScalarTypeToUnsignedChar();\n    canvasSource->SetNumberOfScalarComponents(3);\n    canvasSource->SetDrawColor(drawColor1.data());\n    canvasSource->FillBox(0, 100, 0, 100);\n    canvasSource->SetDrawColor(drawColor2.data());\n    canvasSource->FillTriangle(10, 10, 25, 10, 25, 25);\n    canvasSource->SetDrawColor(drawColor3.data());\n    canvasSource->FillTube(75, 75, 0, 75, 5.0);\n    canvasSource->Update();\n    imageData = canvasSource->GetOutput();\n  }\n\n  vtkNew<vtkImageSincInterpolator> interpolator;\n  interpolator->UseWindowParameterOn();\n  if (windowFunction >= 0 && windowFunction <= 10)\n  {\n    interpolator->SetWindowFunction(windowFunction);\n  }\n\n  vtkNew<vtkImageResize> resize;\n  resize->SetInputData(imageData);\n  resize->SetInterpolator(interpolator);\n  resize->SetOutputDimensions(newSize[0], newSize[1], 1);\n  resize->InterpolateOn();\n\n  if (windowFunction < 0)\n  {\n    resize->InterpolateOff();\n    std::cout << \"Using nearest neighbor interpolation\" << std::endl;\n    ;\n  }\n  else\n  {\n    std::cout << \"Using window function : \"\n              << interpolator->GetWindowFunctionAsString() << std::endl;\n    ;\n  }\n\n  // Create an image actor to display the image\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputConnection(resize->GetOutputPort());\n  imageActor->InterpolateOff();\n\n  // Setup renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(5.0);\n  renderer->ResetCameraClippingRange();\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(1280, 1024);\n  renderWindow->SetWindowName(\"ResizeImage\");\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ResizeImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ResizeImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ResizeImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ResizeImage MACOSX_BUNDLE ResizeImage.cxx )\n  target_link_libraries(ResizeImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ResizeImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ResizeImage/#download-and-build-resizeimage","title":"Download and Build ResizeImage","text":"

        Click here to download ResizeImage and its CMakeLists.txt file. Once the tarball ResizeImage.tar has been downloaded and extracted,

        cd ResizeImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ResizeImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/ResizeImageDemo/","title":"ResizeImageDemo","text":"

        vtk-examples/Cxx/Images/ResizeImageDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/ResizeImageDemo/#code","title":"Code","text":"

        ResizeImageDemo.cxx

        #include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageResize.h>\n#include <vtkImageSincInterpolator.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <array>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkImageData> imageData;\n\n  double factor = .5;\n  int newSize[2];\n\n  // Verify input arguments\n  if (argc > 1)\n  {\n    // Read the image\n    // e.g. Pileated.jpg 3\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> reader;\n    reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    imageData = reader->GetOutput();\n    if (argc > 2)\n    {\n      factor = atof(argv[2]);\n    }\n  }\n  else\n  {\n    std::array<double, 3> drawColor1{0, 0, 0};\n    auto color1 = colors->GetColor3ub(\"Gray\").GetData();\n    std::array<double, 3> drawColor2{0, 0, 0};\n    auto color2 = colors->GetColor3ub(\"Aquamarine\").GetData();\n    std::array<double, 3> drawColor3{0, 0, 0};\n    auto color3 = colors->GetColor3ub(\"Violet\").GetData();\n    for (auto i = 0; i < 3; ++i)\n    {\n      drawColor1[i] = color1[i];\n      drawColor2[i] = color2[i];\n      drawColor3[i] = color3[i];\n    }\n\n    vtkNew<vtkImageCanvasSource2D> canvasSource;\n    canvasSource->SetExtent(0, 100, 0, 100, 0, 0);\n    canvasSource->SetScalarTypeToUnsignedChar();\n    canvasSource->SetNumberOfScalarComponents(3);\n    canvasSource->SetDrawColor(drawColor1.data());\n    canvasSource->FillBox(0, 100, 0, 100);\n    canvasSource->SetDrawColor(drawColor2.data());\n    canvasSource->FillTriangle(10, 10, 25, 10, 25, 25);\n    canvasSource->SetDrawColor(drawColor3.data());\n    canvasSource->FillTube(75, 75, 0, 75, 5.0);\n    canvasSource->Update();\n    imageData = canvasSource->GetOutput();\n  }\n\n  std::cout << \"Original dimensions: \" << imageData->GetDimensions()[0] << \", \"\n            << imageData->GetDimensions()[1] << std::endl;\n  newSize[0] = imageData->GetDimensions()[0] * factor;\n  newSize[1] = imageData->GetDimensions()[1] * factor;\n  std::cout << \"New dimensions: \" << newSize[0] << \", \" << newSize[1]\n            << std::endl;\n\n  // One camera for all\n  vtkNew<vtkCamera> camera;\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(20);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Setup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"ResizeImageDemo\");\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  for (int i = -1; i <= 10; ++i)\n  {\n    vtkNew<vtkImageSincInterpolator> interpolator;\n    auto windowFunction = i;\n    interpolator->UseWindowParameterOn();\n\n    vtkNew<vtkImageResize> resize;\n    resize->SetInputData(imageData);\n    resize->SetInterpolator(interpolator);\n    resize->SetOutputDimensions(newSize[0], newSize[1], 1);\n    resize->InterpolateOn();\n\n    // Create an image actor to display the image\n    vtkNew<vtkImageActor> imageActor;\n    imageActor->GetMapper()->SetInputConnection(resize->GetOutputPort());\n    imageActor->InterpolateOff();\n\n    // Create textActors\n    vtkNew<vtkTextMapper> textMapper;\n    textMapper->SetTextProperty(textProperty);\n    if (windowFunction < 0)\n    {\n      resize->InterpolateOff();\n      textMapper->SetInput(\"Nearest neighbor\");\n    }\n    else\n    {\n      resize->InterpolateOn();\n      interpolator->SetWindowFunction(windowFunction);\n      textMapper->SetInput(interpolator->GetWindowFunctionAsString());\n    }\n\n    vtkNew<vtkActor2D> textActor;\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(100, 16);\n    // Setup renderer\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(imageActor);\n    renderer->AddActor(textActor);\n    ;\n    renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n    renderer->SetActiveCamera(camera);\n    renderer->ResetCamera();\n    renderer->GetActiveCamera()->Dolly(5);\n    renderer->ResetCameraClippingRange();\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n  }\n  // Setup viewports for the renderers\n  int rendererSize = 200;\n  unsigned int xGridDimensions = 4;\n  unsigned int yGridDimensions = 3;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  // Setup render window interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/ResizeImageDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ResizeImageDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ResizeImageDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ResizeImageDemo MACOSX_BUNDLE ResizeImageDemo.cxx )\n  target_link_libraries(ResizeImageDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ResizeImageDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/ResizeImageDemo/#download-and-build-resizeimagedemo","title":"Download and Build ResizeImageDemo","text":"

        Click here to download ResizeImageDemo and its CMakeLists.txt file. Once the tarball ResizeImageDemo.tar has been downloaded and extracted,

        cd ResizeImageDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ResizeImageDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/StaticImage/","title":"StaticImage","text":"

        vtk-examples/Cxx/Images/StaticImage

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/StaticImage/#description","title":"Description","text":"

        This example displays an image in a non-interactable window.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/StaticImage/#code","title":"Code","text":"

        StaticImage.cxx

        #include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g. Ox.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Visualize.\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(reader->GetOutputPort());\n  imageViewer->GetRenderWindow()->SetSize(500, 500);\n  imageViewer->GetRenderWindow()->SetWindowName(\"StaticImage\");\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Peru\").GetData());\n  imageViewer->GetRenderer()->ResetCamera();\n\n  // Set up an interactor that does not respond to mouse events.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  imageViewer->GetRenderWindow()->SetInteractor(renderWindowInteractor);\n  renderWindowInteractor->SetInteractorStyle(0);\n  imageViewer->Render();\n\n  // Start the event loop.\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/StaticImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StaticImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StaticImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StaticImage MACOSX_BUNDLE StaticImage.cxx )\n  target_link_libraries(StaticImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StaticImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/StaticImage/#download-and-build-staticimage","title":"Download and Build StaticImage","text":"

        Click here to download StaticImage and its CMakeLists.txt file. Once the tarball StaticImage.tar has been downloaded and extracted,

        cd StaticImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StaticImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Images/Transparency/","title":"Transparency","text":"

        vtk-examples/Cxx/Images/Transparency

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Images/Transparency/#description","title":"Description","text":"

        This example creates a half transparent, half green mask and overlays it on top of an input image.

        Seealso

        ImageTransparency and ImageStencil.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Images/Transparency/#code","title":"Code","text":"

        Transparency.cxx

        #include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.jpg) e.g Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkImageData* image = reader->GetOutput();\n\n  // Create a mask - half of the image should be transparent and the other half\n  // opaque\n  vtkNew<vtkImageData> maskImage;\n  int extent[6];\n  image->GetExtent(extent);\n  maskImage->SetExtent(extent);\n  maskImage->AllocateScalars(VTK_DOUBLE, 1);\n\n  for (int y = extent[2]; y < extent[3]; y++)\n  {\n    for (int x = extent[0]; x < extent[1]; x++)\n    {\n      double* pixel =\n          static_cast<double*>(maskImage->GetScalarPointer(x, y, 0));\n      if (y > (extent[3] - extent[2]) / 2.0)\n      {\n        pixel[0] = 0.0;\n      }\n      else\n      {\n        pixel[0] = 1.0;\n      }\n    }\n  }\n\n  vtkNew<vtkLookupTable> lookupTable;\n  lookupTable->SetNumberOfTableValues(2);\n  lookupTable->SetRange(0.0, 1.0);\n  lookupTable->SetTableValue(0, 0.0, 0.0, 0.0, 0.0); // label 0 is transparent\n  lookupTable->SetTableValue(\n      1,\n      colors->GetColor4d(\"Khaki\").GetData()); // label 1 is opaque and colored\n  lookupTable->Build();\n\n  vtkNew<vtkImageMapToColors> mapTransparency;\n  mapTransparency->SetLookupTable(lookupTable);\n  mapTransparency->PassAlphaToOutputOn();\n  mapTransparency->SetInputData(maskImage);\n\n  // Create actors\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputData(image);\n\n  vtkNew<vtkImageActor> maskActor;\n  maskActor->GetMapper()->SetInputConnection(mapTransparency->GetOutputPort());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageActor);\n  renderer->AddActor(maskActor);\n  renderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Transparency\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Images/Transparency/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Transparency)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Transparency: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Transparency MACOSX_BUNDLE Transparency.cxx )\n  target_link_libraries(Transparency PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Transparency\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Images/Transparency/#download-and-build-transparency","title":"Download and Build Transparency","text":"

        Click here to download Transparency and its CMakeLists.txt file. Once the tarball Transparency.tar has been downloaded and extracted,

        cd Transparency/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Transparency\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/","title":"BooleanOperationImplicitFunctions","text":"

        vtk-examples/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/#description","title":"Description","text":"

        Demonstration on how to perform boolean operations with implicit functions.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/#code","title":"Code","text":"

        BooleanOperationImplicitFunctions.cxx

        #include <vtkActor.h>\n#include <vtkBox.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\nint main(int argc, char* argv[])\n{\n  // Define colors.\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d actorColor = colors->GetColor3d(\"AliceBlue\");\n  vtkColor3d EdgeColour = colors->GetColor3d(\"SteelBlue\");\n  vtkColor3d BackgroundColour = colors->GetColor3d(\"Silver\");\n\n  // Create a sphere.\n  vtkNew<vtkSphere> sphere;\n  sphere->SetCenter(1.0, 0.0, 0.0);\n  sphere->SetRadius(1);\n\n  // Create a box.\n  vtkNew<vtkBox> box;\n  box->SetBounds(-1, 1, -1, 1, -1, 1);\n\n  // Combine the two implicit functions.\n  vtkNew<vtkImplicitBoolean> boolean;\n  boolean->SetOperationTypeToDifference();\n  // boolean->SetOperationTypeToUnion()\n  // boolean->SetOperationTypeToIntersection()\n  boolean->AddFunction(box);\n  boolean->AddFunction(sphere);\n  // The sample function generates a distance function from the implicit\n  // function.This is then contoured to get a polygonal surface.\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetImplicitFunction(boolean);\n  sample->SetModelBounds(-1, 2, -1, 1, -1, 1);\n  sample->SetSampleDimensions(40, 40, 40);\n  sample->ComputeNormalsOff();\n\n  // Contour\n  vtkNew<vtkContourFilter> surface;\n  surface->SetInputConnection(sample->GetOutputPort());\n  surface->SetValue(0, 0.0);\n\n  // Create a mapper and an actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(actorColor.GetData());\n  actor->GetProperty()->SetEdgeColor(EdgeColour.GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(BackgroundColour.GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BooleanOperationImplicitFunctions\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor.\n  renderer->AddActor(actor);\n\n  // Start\n  renderer->GetActiveCamera()->SetPosition(5.0, -4.0, 1.6);\n  renderer->GetActiveCamera()->SetViewUp(0.1, 0.5, 0.9);\n  renderer->GetActiveCamera()->SetDistance(6.7);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BooleanOperationImplicitFunctions)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BooleanOperationImplicitFunctions: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BooleanOperationImplicitFunctions MACOSX_BUNDLE BooleanOperationImplicitFunctions.cxx )\n  target_link_libraries(BooleanOperationImplicitFunctions PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BooleanOperationImplicitFunctions\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/#download-and-build-booleanoperationimplicitfunctions","title":"Download and Build BooleanOperationImplicitFunctions","text":"

        Click here to download BooleanOperationImplicitFunctions and its CMakeLists.txt file. Once the tarball BooleanOperationImplicitFunctions.tar has been downloaded and extracted,

        cd BooleanOperationImplicitFunctions/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BooleanOperationImplicitFunctions\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImplicitFunctions/ImplicitDataSet/","title":"ImplicitDataSet","text":"

        vtk-examples/Cxx/ImplicitFunctions/ImplicitDataSet

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImplicitFunctions/ImplicitDataSet/#code","title":"Code","text":"

        ImplicitDataSet.cxx

        #include <vtkImageData.h>\n#include <vtkImplicitDataSet.h>\n#include <vtkNew.h>\n#include <vtkRTAnalyticSource.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkRTAnalyticSource> waveletSource;\n  waveletSource->Update();\n\n  vtkNew<vtkImplicitDataSet> implicitWavelet;\n  implicitWavelet->SetDataSet(waveletSource->GetOutput());\n\n  double x[3] = {0.5, 0, 0};\n  // Value should roughly be 258.658.\n  cout << \"x: \" << implicitWavelet->EvaluateFunction(x) << endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImplicitFunctions/ImplicitDataSet/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitDataSet)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  ImagingCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitDataSet: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitDataSet MACOSX_BUNDLE ImplicitDataSet.cxx )\n  target_link_libraries(ImplicitDataSet PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitDataSet\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImplicitFunctions/ImplicitDataSet/#download-and-build-implicitdataset","title":"Download and Build ImplicitDataSet","text":"

        Click here to download ImplicitDataSet and its CMakeLists.txt file. Once the tarball ImplicitDataSet.tar has been downloaded and extracted,

        cd ImplicitDataSet/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitDataSet\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImplicitFunctions/ImplicitQuadric/","title":"ImplicitQuadric","text":"

        vtk-examples/Cxx/ImplicitFunctions/ImplicitQuadric

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImplicitFunctions/ImplicitQuadric/#description","title":"Description","text":"

        Create an ellipsoid by using the implicit quadric.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImplicitFunctions/ImplicitQuadric/#code","title":"Code","text":"

        ImplicitQuadric.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\n#include <cstdlib>\n\nint main(int argc, char* argv[])\n{\n  // Define colors.\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d actorColor = colors->GetColor3d(\"AliceBlue\");\n  vtkColor3d EdgeColour = colors->GetColor3d(\"SteelBlue\");\n  vtkColor3d BackgroundColour = colors->GetColor3d(\"Silver\");\n\n  // Create a Quadric.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0);\n\n  /*The sample function generates a distance function from the implicit\n        function.This is then contoured to get a polygonal surface.*/\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetImplicitFunction(quadric);\n  sample->SetModelBounds(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5);\n  sample->SetSampleDimensions(40, 40, 40);\n  sample->ComputeNormalsOff();\n\n  // Contour.\n  vtkNew<vtkContourFilter> surface;\n  surface->SetInputConnection(sample->GetOutputPort());\n  surface->SetValue(0, 0.0);\n\n  // Create a mapper and an actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(actorColor.GetData());\n  actor->GetProperty()->SetEdgeColor(EdgeColour.GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(BackgroundColour.GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitQuadric\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  // Add the actor.\n  renderer->AddActor(actor);\n  // Start\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImplicitFunctions/ImplicitQuadric/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitQuadric)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitQuadric: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitQuadric MACOSX_BUNDLE ImplicitQuadric.cxx )\n  target_link_libraries(ImplicitQuadric PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitQuadric\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImplicitFunctions/ImplicitQuadric/#download-and-build-implicitquadric","title":"Download and Build ImplicitQuadric","text":"

        Click here to download ImplicitQuadric and its CMakeLists.txt file. Once the tarball ImplicitQuadric.tar has been downloaded and extracted,

        cd ImplicitQuadric/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitQuadric\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImplicitFunctions/ImplicitSphere/","title":"ImplicitSphere","text":"

        vtk-examples/Cxx/ImplicitFunctions/ImplicitSphere

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImplicitFunctions/ImplicitSphere/#description","title":"Description","text":"

        This example creates an isosurface of sampled sphere.

        Info

        See Figure 6-23b in Chapter 6 the VTK Textbook.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImplicitFunctions/ImplicitSphere/#code","title":"Code","text":"

        ImplicitSphere.cxx

        #include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\n#include <algorithm>\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkSphere> sphere;\n\n  // Sample the function.\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(sphere);\n  double value = 2.0;\n  double xmin = -value, xmax = value, ymin = -value, ymax = value,\n         zmin = -value, zmax = value;\n  sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n  // Create the 0 isosurface.\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(1, 1, 1);\n\n  // Map the contours to graphical primitives.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contours->GetOutputPort());\n  contourMapper->ScalarVisibilityOff();\n\n  // Create an actor for the contours.\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitSphere\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(contourActor);\n  renderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImplicitFunctions/ImplicitSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitSphere MACOSX_BUNDLE ImplicitSphere.cxx )\n  target_link_libraries(ImplicitSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImplicitFunctions/ImplicitSphere/#download-and-build-implicitsphere","title":"Download and Build ImplicitSphere","text":"

        Click here to download ImplicitSphere and its CMakeLists.txt file. Once the tarball ImplicitSphere.tar has been downloaded and extracted,

        cd ImplicitSphere/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitSphere\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImplicitFunctions/ImplicitSphere1/","title":"ImplicitSphere1","text":"

        vtk-examples/Cxx/ImplicitFunctions/ImplicitSphere1

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/ImplicitFunctions/ImplicitSphere1/#description","title":"Description","text":"

        Shows how to create a surface representing a sphere by creating an implicit sphere, sampling the implicit function, and finally contouring the sampled data to produce the surface.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImplicitFunctions/ImplicitSphere1/#code","title":"Code","text":"

        ImplicitSphere1.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\n#include <cstdlib>\n\nint main(int argc, char* argv[])\n{\n  // Define colors.\n  auto colors = vtkSmartPointer<vtkNamedColors>::New();\n  vtkColor3d actorColor = colors->GetColor3d(\"AliceBlue\");\n  vtkColor3d EdgeColour = colors->GetColor3d(\"SteelBlue\");\n  vtkColor3d BackgroundColour = colors->GetColor3d(\"Silver\");\n\n  // Create a sphere.\n  auto sphere = vtkSmartPointer<vtkSphere>::New();\n  sphere->SetCenter(0.0, 0.0, 0.0);\n  sphere->SetRadius(0.5);\n\n  /* The sample function generates a distance function from the implicit\n         function.This is then contoured to get a polygonal surface.*/\n  auto sample = vtkSmartPointer<vtkSampleFunction>::New();\n  sample->SetImplicitFunction(sphere);\n  sample->SetModelBounds(-.5, .5, -.5, .5, -.5, .5);\n  sample->SetSampleDimensions(20, 20, 20);\n  sample->ComputeNormalsOff();\n\n  // Contour\n  auto surface = vtkSmartPointer<vtkContourFilter>::New();\n  surface->SetInputConnection(sample->GetOutputPort());\n  surface->SetValue(0, 0.0);\n\n  // Create a mapper and an actor.\n  auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  auto actor = vtkSmartPointer<vtkActor>::New();\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetColor(actorColor.GetData());\n  actor->GetProperty()->SetEdgeColor(EdgeColour.GetData());\n\n  // A renderer and render window.\n  auto renderer = vtkSmartPointer<vtkRenderer>::New();\n  renderer->SetBackground(BackgroundColour.GetData());\n  auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitSphere1\");\n\n  auto renderWindowInteractor =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  // Add the actor.\n  renderer->AddActor(actor);\n  // Start\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImplicitFunctions/ImplicitSphere1/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitSphere1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitSphere1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitSphere1 MACOSX_BUNDLE ImplicitSphere1.cxx )\n  target_link_libraries(ImplicitSphere1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitSphere1\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImplicitFunctions/ImplicitSphere1/#download-and-build-implicitsphere1","title":"Download and Build ImplicitSphere1","text":"

        Click here to download ImplicitSphere1 and its CMakeLists.txt file. Once the tarball ImplicitSphere1.tar has been downloaded and extracted,

        cd ImplicitSphere1/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitSphere1\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImplicitFunctions/IsoContours/","title":"IsoContours","text":"

        vtk-examples/Cxx/ImplicitFunctions/IsoContours

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImplicitFunctions/IsoContours/#code","title":"Code","text":"

        IsoContours.cxx

        #include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkContourFilter.h>\n#include <vtkImageData.h>\n#include <vtkInteractorStyleUser.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation.h>\n#include <vtkSliderRepresentation3D.h>\n#include <vtkSliderWidget.h>\n#include <vtkXMLImageDataWriter.h>\n\nnamespace {\nvoid CreateData(vtkImageData* data);\n\nclass vtkSliderCallback : public vtkCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value =\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue();\n    this->ContourFilter->GenerateValues(1, value, value);\n  }\n  vtkSliderCallback() : ContourFilter(NULL)\n  {\n  }\n  vtkContourFilter* ContourFilter;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> data;\n  CreateData(data);\n\n  // Create an isosurface.\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetInputData(data);\n  contourFilter->GenerateValues(1, 10,\n                                10); // (numContours, rangeStart, rangeEnd)\n\n  // Map the contours to graphical primitives.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contourFilter->GetOutputPort());\n\n  // Create an actor for the contours.\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n  contourActor->GetProperty()->SetLineWidth(5);\n\n  // Create the outline.\n  vtkNew<vtkOutlineFilter> outlineFilter;\n  outlineFilter->SetInputData(data);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outlineFilter->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Gray\").GetData());\n  outlineActor->GetProperty()->SetLineWidth(3);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"IsoContours\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(contourActor);\n  renderer->AddActor(outlineActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  vtkNew<vtkSliderRepresentation3D> sliderRep;\n  sliderRep->SetMinimumValue(0.0);\n  sliderRep->SetMaximumValue(30.0);\n  sliderRep->SetValue(10.0);\n  sliderRep->SetTitleText(\"Contour value\");\n  sliderRep->SetPoint1InWorldCoordinates(-20, -40, 0);\n  sliderRep->SetPoint2InWorldCoordinates(0, -40, 0);\n  sliderRep->SetSliderWidth(.2);\n  sliderRep->SetLabelHeight(.1);\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(interactor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->ContourFilter = contourFilter;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  vtkNew<vtkInteractorStyleUser> style;\n  interactor->SetInteractorStyle(style);\n\n  renderWindow->SetSize(500, 500);\n  renderWindow->Render();\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateData(vtkImageData* data)\n{\n  data->SetExtent(-25, 25, -25, 25, 0, 0);\n  data->AllocateScalars(VTK_DOUBLE, 1);\n  int* extent = data->GetExtent();\n\n  for (int y = extent[2]; y <= extent[3]; y++)\n  {\n    for (int x = extent[0]; x <= extent[1]; x++)\n    {\n      double* pixel = static_cast<double*>(data->GetScalarPointer(x, y, 0));\n      pixel[0] = sqrt(pow(x, 2.0) + pow(y, 2.0));\n    }\n  }\n\n  vtkNew<vtkXMLImageDataWriter> writer;\n  writer->SetFileName(\"data.vti\");\n  writer->SetInputData(data);\n  writer->Write();\n}\n} // namespace\n
        "},{"location":"Cxx/ImplicitFunctions/IsoContours/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IsoContours)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IsoContours: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IsoContours MACOSX_BUNDLE IsoContours.cxx )\n  target_link_libraries(IsoContours PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IsoContours\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImplicitFunctions/IsoContours/#download-and-build-isocontours","title":"Download and Build IsoContours","text":"

        Click here to download IsoContours and its CMakeLists.txt file. Once the tarball IsoContours.tar has been downloaded and extracted,

        cd IsoContours/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IsoContours\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/ImplicitFunctions/SampleFunction/","title":"SampleFunction","text":"

        vtk-examples/Cxx/ImplicitFunctions/SampleFunction

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/ImplicitFunctions/SampleFunction/#code","title":"Code","text":"

        SampleFunction.cxx

        #include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSuperquadric.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSuperquadric> implicitFunction;\n  implicitFunction->SetPhiRoundness(2.5);\n  implicitFunction->SetThetaRoundness(0.5);\n\n  // Sample the function.\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(implicitFunction);\n  double value = 2.0;\n  double xmin = -value, xmax = value, ymin = -value, ymax = value,\n         zmin = -value, zmax = value;\n  sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n  // Create the 0 isosurface.\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(1, 2.0, 2.0);\n\n  // Map the contours to graphical primitives.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contours->GetOutputPort());\n  contourMapper->SetScalarRange(0.0, 1.2);\n\n  // Create an actor for the contours.\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n\n  // -- create a box around the function to indicate the sampling volume --\n\n  // Create outline.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(sample->GetOutputPort());\n\n  // Map it to graphics primitives.\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  // Create an actor for it.\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Samplefunction\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(contourActor);\n  renderer->AddActor(outlineActor);\n  renderer->SetBackground(colors->GetColor3d(\"Tan\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/ImplicitFunctions/SampleFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SampleFunction)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SampleFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SampleFunction MACOSX_BUNDLE SampleFunction.cxx )\n  target_link_libraries(SampleFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SampleFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/ImplicitFunctions/SampleFunction/#download-and-build-samplefunction","title":"Download and Build SampleFunction","text":"

        Click here to download SampleFunction and its CMakeLists.txt file. Once the tarball SampleFunction.tar has been downloaded and extracted,

        cd SampleFunction/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SampleFunction\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/ArrayToTable/","title":"ArrayToTable","text":"

        vtk-examples/Cxx/InfoVis/ArrayToTable

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/ArrayToTable/#code","title":"Code","text":"

        ArrayToTable.cxx

        #include <vtkArrayData.h>\n#include <vtkArrayToTable.h>\n#include <vtkDenseArray.h>\n#include <vtkNew.h>\n#include <vtkTable.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDenseArray<int>> array;\n  array->Resize(2, 4);\n\n  // set values\n  std::cout << \"There are \" << array->GetExtents()[0].GetEnd() << std::endl;\n  std::cout << \"There are \" << array->GetExtents()[1].GetEnd() << std::endl;\n\n  for (vtkIdType i = 0; i < array->GetExtents()[0].GetEnd(); i++)\n  {\n    for (vtkIdType j = 0; j < array->GetExtents()[1].GetEnd(); j++)\n    {\n      array->SetValue(i, j, i + j);\n    }\n  }\n\n  vtkNew<vtkArrayData> arrayData;\n  arrayData->AddArray(array);\n\n  vtkNew<vtkArrayToTable> arrayToTable;\n  arrayToTable->SetInputData(arrayData);\n  arrayToTable->Update();\n\n  auto table = arrayToTable->GetOutput();\n  table->Dump();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/ArrayToTable/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ArrayToTable)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ArrayToTable: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ArrayToTable MACOSX_BUNDLE ArrayToTable.cxx )\n  target_link_libraries(ArrayToTable PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ArrayToTable\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/ArrayToTable/#download-and-build-arraytotable","title":"Download and Build ArrayToTable","text":"

        Click here to download ArrayToTable and its CMakeLists.txt file. Once the tarball ArrayToTable.tar has been downloaded and extracted,

        cd ArrayToTable/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ArrayToTable\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/DelimitedTextReader/","title":"DelimitedTextReader","text":"

        vtk-examples/Cxx/InfoVis/DelimitedTextReader

        "},{"location":"Cxx/InfoVis/DelimitedTextReader/#description","title":"Description","text":"

        This example takes a plain text file of coordinates and normals (x y z nx ny nz) and reads them into a vtkPolyData and displays them on the screen. This can be easily changed to reading a file with any delimiter by changing the argument of Reader->SetFieldDelimiterCharacters(\" \");

        Here is an example file:

         0.0 0.0 0.0 1.0 2.0 3.0\n 1.0 0.0 0.0 4.0 5.0 6.1\n 0.0 1.0 0.0 7.2 8.3 9.4\n ```\n!!! question\n    If you have a question about this example, please use the [VTK Discourse Forum](https://discourse.vtk.org/)\n\n###Code\n**DelimitedTextReader.cxx**\n``` c++ hl_lines=\"1 2 3 4 5 6 7 8 9 10 11 12 14 18 30 36 38 39 70 74 79 82 87 88 92\"\n\n#include <vtkActor.h>\n#include <vtkDelimitedTextReader.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersionMacros.h> // For version macros\n#include <vtkVertexGlyphFilter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename e.g DelimitedData.txt\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkDelimitedTextReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->DetectNumericColumnsOn();\n  reader->SetFieldDelimiterCharacters(\" \");\n  reader->Update();\n\n  vtkTable* table = reader->GetOutput();\n\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkDoubleArray> normals;\n\n  normals->SetNumberOfComponents(3); // 3d normals (ie x,y,z)\n\n  std::cout << \"Table has \" << table->GetNumberOfRows() << \" rows.\"\n            << std::endl;\n  std::cout << \"Table has \" << table->GetNumberOfColumns() << \" columns.\"\n            << std::endl;\n\n  for (vtkIdType i = 0; i < table->GetNumberOfRows(); i++)\n  {\n    std::cout << \"x: \" << (table->GetValue(i, 0)).ToDouble()\n              << \" y: \" << (table->GetValue(i, 1)).ToDouble()\n              << \" z: \" << (table->GetValue(i, 2)).ToDouble();\n\n    points->InsertNextPoint((table->GetValue(i, 0)).ToDouble(),\n                            (table->GetValue(i, 1)).ToDouble(),\n                            (table->GetValue(i, 2)).ToDouble());\n\n    double n[3];\n    n[0] = (table->GetValue(i, 3)).ToDouble();\n    n[1] = (table->GetValue(i, 4)).ToDouble();\n    n[2] = (table->GetValue(i, 5)).ToDouble();\n\n    std::cout << \" n: \" << n[0] << \" \" << n[1] << \" \" << n[2] << std::endl;\n    normals->InsertNextTuple(n);\n  }\n\n  std::cout << \"There are \" << points->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->SetNormals(normals);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n  glyphFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(30);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DelimitedTextReader\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Mint\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/DelimitedTextReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DelimitedTextReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOInfovis\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DelimitedTextReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DelimitedTextReader MACOSX_BUNDLE DelimitedTextReader.cxx )\n  target_link_libraries(DelimitedTextReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DelimitedTextReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/DelimitedTextReader/#download-and-build-delimitedtextreader","title":"Download and Build DelimitedTextReader","text":"

        Click here to download DelimitedTextReader and its CMakeLists.txt file. Once the tarball DelimitedTextReader.tar has been downloaded and extracted,

        cd DelimitedTextReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DelimitedTextReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/DelimitedTextWriter/","title":"DelimitedTextWriter","text":"

        vtk-examples/Cxx/InfoVis/DelimitedTextWriter

        "},{"location":"Cxx/InfoVis/DelimitedTextWriter/#description","title":"Description","text":"

        Is the output of

        \"\",\"\",\"\"\n0,1,2\n3,4,5\n6,7,8\n

        expected? What is the first line indicating? Simply that there are 3 string fields?

        With my prior edit, the first line is now \"column-0\",\"column-1\",\"column-2\" -- the first line is the names of the column arrays in the table. I added them to the example because the example was crashing on Windows builds, where streaming a NULL char* is no bueno. (David Cole)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/DelimitedTextWriter/#code","title":"Code","text":"

        DelimitedTextWriter.cxx

        #include <vtkDelimitedTextWriter.h>\n#include <vtkNew.h>\n#include <vtkTable.h>\n#include <vtkVariantArray.h>\n\n#include <sstream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  std::string outputFilename = \"output.txt\";\n\n  // Use the specified filename if it is provided.\n  if (argc == 2)\n  {\n    outputFilename = argv[1];\n  }\n\n  // Construct an empty table\n  vtkNew<vtkTable> table;\n\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    vtkNew<vtkVariantArray> col;\n\n    std::ostringstream oss;\n    oss << \"column-\" << i;\n    std::string colName = oss.str();\n    col->SetName(colName.c_str());\n\n    col->InsertNextValue(vtkVariant(0.0));\n    col->InsertNextValue(vtkVariant(0.0));\n    col->InsertNextValue(vtkVariant(0.0));\n    table->AddColumn(col);\n  }\n\n  // Fill the table with values\n  unsigned int counter = 0;\n  for (vtkIdType r = 0; r < table->GetNumberOfRows(); r++)\n  {\n    for (vtkIdType c = 0; c < table->GetNumberOfColumns(); c++)\n    {\n      table->SetValue(r, c, vtkVariant(counter));\n      counter++;\n    }\n  }\n\n  vtkNew<vtkDelimitedTextWriter> writer;\n  writer->SetFileName(outputFilename.c_str());\n  writer->SetInputData(table);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/DelimitedTextWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DelimitedTextWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DelimitedTextWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DelimitedTextWriter MACOSX_BUNDLE DelimitedTextWriter.cxx )\n  target_link_libraries(DelimitedTextWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DelimitedTextWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/DelimitedTextWriter/#download-and-build-delimitedtextwriter","title":"Download and Build DelimitedTextWriter","text":"

        Click here to download DelimitedTextWriter and its CMakeLists.txt file. Once the tarball DelimitedTextWriter.tar has been downloaded and extracted,

        cd DelimitedTextWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DelimitedTextWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/GraphPoints/","title":"GraphPoints","text":"

        vtk-examples/Cxx/InfoVis/GraphPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/GraphPoints/#code","title":"Code","text":"

        GraphPoints.cxx

        #include <vtkGraphLayoutView.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  // Create 3 vertices\n  vtkIdType v1 = g->AddVertex();\n  vtkIdType v2 = g->AddVertex();\n  vtkIdType v3 = g->AddVertex();\n  g->AddEdge(v1, v2);\n  g->AddEdge(v1, v3);\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  g->SetPoints(points);\n\n  std::cout << \"Number of output points: \"\n            << g->GetPoints()->GetNumberOfPoints() << std::endl;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  graphLayoutView->SetLayoutStrategy(\"Pass Through\");\n  graphLayoutView->ResetCamera();\n  graphLayoutView->GetRenderer()->GradientBackgroundOn();\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"RoyalBlue\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"GraphPoints\");\n  graphLayoutView->Render();\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/GraphPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GraphPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GraphPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GraphPoints MACOSX_BUNDLE GraphPoints.cxx )\n  target_link_libraries(GraphPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GraphPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/GraphPoints/#download-and-build-graphpoints","title":"Download and Build GraphPoints","text":"

        Click here to download GraphPoints and its CMakeLists.txt file. Once the tarball GraphPoints.tar has been downloaded and extracted,

        cd GraphPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GraphPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/KMeansClustering/","title":"KMeansClustering","text":"

        vtk-examples/Cxx/InfoVis/KMeansClustering

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/InfoVis/KMeansClustering/#description","title":"Description","text":"

        This example clusters 3D points using the KMeans algorithm. The points are assigned to a cluster by creating an array with each point's cluster id.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/KMeansClustering/#code","title":"Code","text":"

        KMeansClustering.cxx

        #include <vtkActor.h>\n#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkKMeansStatistics.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVertexGlyphFilter.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <sstream>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create 2 clusters, one near (0,0,0) and the other near (3,3,3).\n  vtkNew<vtkPoints> points;\n\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(3.0, 3.0, 3.0);\n  points->InsertNextPoint(0.1, 0.1, 0.1);\n  points->InsertNextPoint(3.1, 3.1, 3.1);\n  points->InsertNextPoint(0.2, 0.2, 0.2);\n  points->InsertNextPoint(3.2, 3.2, 3.2);\n\n  // Get the points into the format needed for KMeans.\n  vtkNew<vtkTable> inputData;\n\n  for (int c = 0; c < 3; ++c)\n  {\n    std::stringstream colName;\n    colName << \"coord \" << c;\n    vtkNew<vtkDoubleArray> doubleArray;\n    doubleArray->SetNumberOfComponents(1);\n    doubleArray->SetName(colName.str().c_str());\n    doubleArray->SetNumberOfTuples(points->GetNumberOfPoints());\n\n    for (int r = 0; r < points->GetNumberOfPoints(); ++r)\n    {\n      double p[3];\n      points->GetPoint(r, p);\n\n      doubleArray->SetValue(r, p[c]);\n    }\n\n    inputData->AddColumn(doubleArray);\n  }\n\n  vtkNew<vtkKMeansStatistics> kMeansStatistics;\n  kMeansStatistics->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA, inputData);\n  kMeansStatistics->SetColumnStatus(inputData->GetColumnName(0), 1);\n  kMeansStatistics->SetColumnStatus(inputData->GetColumnName(1), 1);\n  kMeansStatistics->SetColumnStatus(inputData->GetColumnName(2), 1);\n  // kMeansStatistics->SetColumnStatus( \"Testing\", 1 );\n  kMeansStatistics->RequestSelectedColumns();\n  kMeansStatistics->SetAssessOption(true);\n  kMeansStatistics->SetDefaultNumberOfClusters(2);\n  kMeansStatistics->Update();\n\n  // Display the results.\n  kMeansStatistics->GetOutput()->Dump();\n\n  vtkNew<vtkIntArray> clusterArray;\n  clusterArray->SetNumberOfComponents(1);\n  clusterArray->SetName(\"ClusterId\");\n\n  for (int r = 0; r < kMeansStatistics->GetOutput()->GetNumberOfRows(); r++)\n  {\n    vtkVariant v = kMeansStatistics->GetOutput()->GetValue(\n        r, kMeansStatistics->GetOutput()->GetNumberOfColumns() - 1);\n    std::cout << \"Point \" << r << \" is in cluster \" << v.ToInt() << std::endl;\n    clusterArray->InsertNextValue(v.ToInt());\n  }\n\n  // Output the cluster centers.\n  auto outputMetaDS =\n      dynamic_cast<vtkMultiBlockDataSet*>(kMeansStatistics->GetOutputDataObject(\n          vtkStatisticsAlgorithm::OUTPUT_MODEL));\n  auto outputMeta = dynamic_cast<vtkTable*>(outputMetaDS->GetBlock(0));\n  auto coord0 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 0\"));\n  auto coord1 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 1\"));\n  auto coord2 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 2\"));\n  std::cout << \"CLuster centers:\" << std::endl;\n  for (unsigned int i = 0; i < coord0->GetNumberOfTuples(); ++i)\n  {\n    std::cout << coord0->GetValue(i) << \" \" << coord1->GetValue(i) << \" \"\n              << coord2->GetValue(i) << std::endl;\n  }\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  // polydata->GetPointData()->AddArray(clusterArray);\n  polydata->GetPointData()->SetScalars(clusterArray);\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(\"output.vtp\");\n  writer->SetInputData(polydata);\n  writer->Write();\n\n  // Display\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n  glyphFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(4);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"KMeansClustering\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"OliveDrab\").GetData());\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/KMeansClustering/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KMeansClustering)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersStatistics\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KMeansClustering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KMeansClustering MACOSX_BUNDLE KMeansClustering.cxx )\n  target_link_libraries(KMeansClustering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KMeansClustering\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/KMeansClustering/#download-and-build-kmeansclustering","title":"Download and Build KMeansClustering","text":"

        Click here to download KMeansClustering and its CMakeLists.txt file. Once the tarball KMeansClustering.tar has been downloaded and extracted,

        cd KMeansClustering/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KMeansClustering\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/MutableGraphHelper/","title":"MutableGraphHelper","text":"

        vtk-examples/Cxx/InfoVis/MutableGraphHelper

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/MutableGraphHelper/#code","title":"Code","text":"

        MutableGraphHelper.cxx

        #include <vtkGraphLayoutView.h>\n#include <vtkMutableDirectedGraph.h>\n#include <vtkMutableGraphHelper.h>\n#include <vtkMutableUndirectedGraph.h>\n#include <vtkNew.h>\n#include <vtkRenderWindowInteractor.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMutableUndirectedGraph> g;\n\n  vtkNew<vtkMutableGraphHelper> graphHelper;\n  graphHelper->SetGraph(g);\n  vtkIdType v0 = graphHelper->AddVertex();\n  vtkIdType v1 = graphHelper->AddVertex();\n\n  graphHelper->AddEdge(v0, v1);\n\n  // Can also do this:\n  graphHelper->RemoveEdge(0);\n\n  vtkNew<vtkGraphLayoutView> treeLayoutView;\n  treeLayoutView->AddRepresentationFromInput(graphHelper->GetGraph());\n  treeLayoutView->SetLayoutStrategyToTree();\n  treeLayoutView->ResetCamera();\n  treeLayoutView->Render();\n  treeLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/MutableGraphHelper/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MutableGraphHelper)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  InfovisCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MutableGraphHelper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MutableGraphHelper MACOSX_BUNDLE MutableGraphHelper.cxx )\n  target_link_libraries(MutableGraphHelper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MutableGraphHelper\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/MutableGraphHelper/#download-and-build-mutablegraphhelper","title":"Download and Build MutableGraphHelper","text":"

        Click here to download MutableGraphHelper and its CMakeLists.txt file. Once the tarball MutableGraphHelper.tar has been downloaded and extracted,

        cd MutableGraphHelper/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MutableGraphHelper\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/PKMeansClustering/","title":"PKMeansClustering","text":"

        vtk-examples/Cxx/InfoVis/PKMeansClustering

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/PKMeansClustering/#code","title":"Code","text":"

        PKMeansClustering.cxx

        #include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNew.h>\n#include <vtkPKMeansStatistics.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkTable.h>\n#include <vtkXMLPolyDataWriter.h>\n\n// display\n#include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <sstream>\n\nint main(int, char*[])\n{\n  // create 2 clusters, one near (0,0,0) and the other near (3,3,3)\n  vtkNew<vtkPoints> points;\n\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(3.0, 3.0, 3.0);\n  points->InsertNextPoint(0.1, 0.1, 0.1);\n  points->InsertNextPoint(3.1, 3.1, 3.1);\n  points->InsertNextPoint(0.2, 0.2, 0.2);\n  points->InsertNextPoint(3.2, 3.2, 3.2);\n\n  // Get the points into the format needed for KMeans\n  vtkNew<vtkTable> inputData;\n\n  for (int c = 0; c < 3; ++c)\n  {\n    std::stringstream colName;\n    colName << \"coord \" << c;\n    vtkNew<vtkDoubleArray> doubleArray;\n    doubleArray->SetNumberOfComponents(1);\n    doubleArray->SetName(colName.str().c_str());\n    doubleArray->SetNumberOfTuples(points->GetNumberOfPoints());\n\n    for (int r = 0; r < points->GetNumberOfPoints(); ++r)\n    {\n      double p[3];\n      points->GetPoint(r, p);\n\n      doubleArray->SetValue(r, p[c]);\n    }\n\n    inputData->AddColumn(doubleArray);\n  }\n\n  vtkNew<vtkPKMeansStatistics> pKMeansStatistics;\n  // vtkNew<vtkKMeansStatistics> pKMeansStatistics;\n  // pks->SetMaxNumIterations( 10 );\n  pKMeansStatistics->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA,\n                                  inputData);\n  pKMeansStatistics->SetColumnStatus(inputData->GetColumnName(0), 1);\n  pKMeansStatistics->SetColumnStatus(inputData->GetColumnName(1), 1);\n  pKMeansStatistics->SetColumnStatus(inputData->GetColumnName(2), 1);\n  pKMeansStatistics->RequestSelectedColumns();\n  pKMeansStatistics->SetAssessOption(true);\n  pKMeansStatistics->SetDefaultNumberOfClusters(2);\n  pKMeansStatistics->Update();\n\n  // Display the results\n  pKMeansStatistics->GetOutput()->Dump();\n\n  vtkNew<vtkIntArray> clusterArray;\n  clusterArray->SetNumberOfComponents(1);\n  clusterArray->SetName(\"ClusterId\");\n\n  for (unsigned int r = 0;\n       r < pKMeansStatistics->GetOutput()->GetNumberOfRows(); r++)\n  {\n    vtkVariant v = pKMeansStatistics->GetOutput()->GetValue(\n        r, pKMeansStatistics->GetOutput()->GetNumberOfColumns() - 1);\n    std::cout << \"Point \" << r << \" is in cluster \" << v.ToInt() << std::endl;\n    clusterArray->InsertNextValue(v.ToInt());\n  }\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->SetScalars(clusterArray);\n\n  // Output the cluster centers\n\n  auto outputMetaDS = dynamic_cast<vtkMultiBlockDataSet*>(\n      pKMeansStatistics->GetOutputDataObject(\n          vtkStatisticsAlgorithm::OUTPUT_MODEL));\n  auto outputMeta = dynamic_cast<vtkTable*>(outputMetaDS->GetBlock(0));\n  // auto outputMeta = dynamic_cast<vtkTable*>( outputMetaDS->GetBlock( 1 ) );\n  auto coord0 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 0\"));\n  auto coord1 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 1\"));\n  auto coord2 =\n      dynamic_cast<vtkDoubleArray*>(outputMeta->GetColumnByName(\"coord 2\"));\n\n  for (unsigned int i = 0; i < coord0->GetNumberOfTuples(); ++i)\n  {\n    std::cout << coord0->GetValue(i) << \" \" << coord1->GetValue(i) << \" \"\n              << coord2->GetValue(i) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/PKMeansClustering/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PKMeansClustering)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersParallelStatistics\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PKMeansClustering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PKMeansClustering MACOSX_BUNDLE PKMeansClustering.cxx )\n  target_link_libraries(PKMeansClustering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PKMeansClustering\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/PKMeansClustering/#download-and-build-pkmeansclustering","title":"Download and Build PKMeansClustering","text":"

        Click here to download PKMeansClustering and its CMakeLists.txt file. Once the tarball PKMeansClustering.tar has been downloaded and extracted,

        cd PKMeansClustering/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PKMeansClustering\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/ParallelCoordinatesView/","title":"ParallelCoordinatesView","text":"

        vtk-examples/Cxx/InfoVis/ParallelCoordinatesView

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/ParallelCoordinatesView/#code","title":"Code","text":"

        ParallelCoordinatesView.cxx

        #include <vtkDelimitedTextReader.h>\n#include <vtkDoubleArray.h>\n#include <vtkFloatArray.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParallelCoordinatesRepresentation.h>\n#include <vtkParallelCoordinatesView.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStringArray.h>\n#include <vtkTable.h>\n\n#include <vtksys/SystemTools.hxx>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkTable> table = vtkSmartPointer<vtkTable>::New();\n  std::string title;\n\n  if (argc > 1)\n  {\n    std::string inputFilename;\n    inputFilename = argv[1];\n    vtkNew<vtkDelimitedTextReader> reader;\n    reader->SetFileName(inputFilename.c_str());\n    reader->SetHaveHeaders(1);\n    reader->DetectNumericColumnsOn();\n    reader->SetFieldDelimiterCharacters(\",\");\n    reader->Update();\n    table = reader->GetOutput();\n    title = vtksys::SystemTools::GetFilenameWithoutExtension(\n        vtksys::SystemTools::GetFilenameName(inputFilename));\n  }\n  else\n  {\n    title = \"Generated Data\";\n    vtkNew<vtkIntArray> array1;\n    array1->SetName(\"Array1\");\n    array1->SetNumberOfComponents(1);\n    array1->InsertNextValue(0);\n    array1->InsertNextValue(1);\n    array1->InsertNextValue(2);\n    array1->InsertNextValue(3);\n    array1->InsertNextValue(4);\n\n    vtkNew<vtkFloatArray> array2;\n    array2->SetName(\"Array2\");\n    array2->SetNumberOfComponents(1);\n    array2->InsertNextValue(-0);\n    array2->InsertNextValue(-1);\n    array2->InsertNextValue(-2);\n    array2->InsertNextValue(-3);\n    array2->InsertNextValue(-4);\n\n    vtkNew<vtkDoubleArray> array3;\n    array3->SetName(\"Array3\");\n    array3->SetNumberOfComponents(1);\n    array3->InsertNextValue(0);\n    array3->InsertNextValue(1);\n    array3->InsertNextValue(4);\n    array3->InsertNextValue(9);\n    array3->InsertNextValue(16);\n\n    table->AddColumn(array1);\n    table->AddColumn(array2);\n    table->AddColumn(array3);\n  }\n\n  vtkNew<vtkPolyData> polydata;\n\n  for (vtkIdType i = 0; i < table->GetNumberOfColumns(); ++i)\n  {\n    if (dynamic_cast<vtkStringArray*>(table->GetColumn(i)))\n    {\n      std::cout << i << \" is \"\n                << \"StringArray named \";\n    }\n    else if (dynamic_cast<vtkDoubleArray*>(table->GetColumn(i)))\n    {\n      std::cout << i << \" is \"\n                << \"DoubleArray named \";\n    }\n    else if (dynamic_cast<vtkFloatArray*>(table->GetColumn(i)))\n    {\n      std::cout << i << \" is \"\n                << \"DoubleArray named \";\n    }\n    else if (dynamic_cast<vtkIntArray*>(table->GetColumn(i)))\n    {\n      std::cout << i << \" is \"\n                << \"IntArray named \";\n    }\n    else\n    {\n      std::cout << i << \" is \"\n                << \"Unknown type named \";\n    }\n    std::cout << \"\\\"\" << table->GetColumn(i)->GetName() << \"\\\"\" << std::endl;\n\n    polydata->GetPointData()->AddArray(table->GetColumn(i));\n  }\n\n  vtkNew<vtkParallelCoordinatesRepresentation> rep;\n  rep->SetInputData(polydata);\n\n  // List all of the attribute arrays you want plotted in parallel coordinates\n  // Set up the parallel coordinates Representation to be used in the View\n  for (vtkIdType i = 0; i < table->GetNumberOfColumns(); ++i)\n  {\n    if (dynamic_cast<vtkStringArray*>(table->GetColumn(i)))\n    {\n      continue;\n    }\n    else\n    {\n      rep->SetInputArrayToProcess(i, 0, 0, 0, table->GetColumn(i)->GetName());\n    }\n  }\n  rep->UseCurvesOn();\n  rep->SetFontSize(.5);\n  rep->SetPlotTitle(title.c_str());\n  rep->SetLineOpacity(0.5);\n  rep->SetLineColor(colors->GetColor3d(\"Gold\").GetData());\n  rep->SetAxisColor(colors->GetColor3d(\"OrangeRed\").GetData());\n  rep->SetAxisLabelColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // Set up the Parallel Coordinates View and hook in the Representation\n  vtkNew<vtkParallelCoordinatesView> view;\n  view->SetRepresentation(rep);\n  view->SetInspectMode(1);\n  view->SetDisplayHoverText(1);\n\n  // Brush Mode determines the type of interaction you perform to select data\n  view->SetBrushModeToLasso();\n  view->SetBrushOperatorToReplace();\n\n  // Set up render window\n  view->GetRenderWindow()->SetSize(600, 300);\n  view->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Indigo\").GetData());\n\n  view->GetRenderWindow()->SetWindowName(\"ParallelCoordinatesView\");\n  view->ResetCamera();\n  view->Render();\n\n  // Start interaction event loop\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/ParallelCoordinatesView/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParallelCoordinatesView)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOInfovis\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParallelCoordinatesView: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParallelCoordinatesView MACOSX_BUNDLE ParallelCoordinatesView.cxx )\n  target_link_libraries(ParallelCoordinatesView PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParallelCoordinatesView\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/ParallelCoordinatesView/#download-and-build-parallelcoordinatesview","title":"Download and Build ParallelCoordinatesView","text":"

        Click here to download ParallelCoordinatesView and its CMakeLists.txt file. Once the tarball ParallelCoordinatesView.tar has been downloaded and extracted,

        cd ParallelCoordinatesView/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ParallelCoordinatesView\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/PassThrough/","title":"PassThrough","text":"

        vtk-examples/Cxx/InfoVis/PassThrough

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/PassThrough/#code","title":"Code","text":"

        PassThrough.cxx

        #include <vtkNew.h>\n#include <vtkPassThrough.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"Points before: \"\n            << sphereSource->GetOutput()->GetNumberOfPoints() << std::endl;\n\n  vtkNew<vtkPassThrough> passThrough;\n  passThrough->SetInputConnection(sphereSource->GetOutputPort());\n  passThrough->Update();\n\n  auto output = dynamic_cast<vtkPolyData*>(passThrough->GetOutput());\n\n  std::cout << \"Points after: \" << output->GetNumberOfPoints() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/PassThrough/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PassThrough)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PassThrough: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PassThrough MACOSX_BUNDLE PassThrough.cxx )\n  target_link_libraries(PassThrough PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PassThrough\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/PassThrough/#download-and-build-passthrough","title":"Download and Build PassThrough","text":"

        Click here to download PassThrough and its CMakeLists.txt file. Once the tarball PassThrough.tar has been downloaded and extracted,

        cd PassThrough/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PassThrough\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/SCurveSpline/","title":"SCurveSpline","text":"

        vtk-examples/Cxx/InfoVis/SCurveSpline

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/SCurveSpline/#code","title":"Code","text":"

        SCurveSpline.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSCurveSpline.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(5);\n  pointSource->Update();\n\n  vtkPoints* points = pointSource->GetOutput()->GetPoints();\n\n  vtkNew<vtkSCurveSpline> xSpline;\n  vtkNew<vtkSCurveSpline> ySpline;\n  vtkNew<vtkSCurveSpline> zSpline;\n\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetXSpline(xSpline);\n  spline->SetYSpline(ySpline);\n  spline->SetZSpline(zSpline);\n  spline->SetPoints(points);\n\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->Update();\n\n  // Setup actor and mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(functionSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SCurveSpline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/SCurveSpline/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SCurveSpline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SCurveSpline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SCurveSpline MACOSX_BUNDLE SCurveSpline.cxx )\n  target_link_libraries(SCurveSpline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SCurveSpline\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/SCurveSpline/#download-and-build-scurvespline","title":"Download and Build SCurveSpline","text":"

        Click here to download SCurveSpline and its CMakeLists.txt file. Once the tarball SCurveSpline.tar has been downloaded and extracted,

        cd SCurveSpline/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SCurveSpline\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/TreeMapView/","title":"TreeMapView","text":"

        vtk-examples/Cxx/InfoVis/TreeMapView

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/InfoVis/TreeMapView/#description","title":"Description","text":"

        Fix: use a much simpler tree and generate the tree in the code instead of reading files.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/TreeMapView/#code","title":"Code","text":"

        TreeMapView.cxx

        #include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTreeMapView.h>\n#include <vtkViewTheme.h>\n#include <vtkXMLTreeReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    cout << \"Usage: \" << argv[0] << \" treeFileName graphFileName\" << std::endl;\n    cout << \"where: treeFileName is Infovis-XML-vtkclasses.xml and \"\n            \"graphFileName is Infovis-XML-vtklibrary.xml\"\n         << endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string treeFileName(argv[1]);\n  std::string graphFileName(argv[2]);\n\n  // We need to put the graph and tree edges in different domains.\n  vtkNew<vtkXMLTreeReader> reader1;\n  reader1->SetFileName(treeFileName.c_str());\n  reader1->SetEdgePedigreeIdArrayName(\"tree edge\");\n  reader1->GenerateVertexPedigreeIdsOff();\n  reader1->SetVertexPedigreeIdArrayName(\"id\");\n\n  vtkNew<vtkXMLTreeReader> reader2;\n  reader2->SetFileName(graphFileName.c_str());\n  reader2->SetEdgePedigreeIdArrayName(\"graph edge\");\n  reader2->GenerateVertexPedigreeIdsOff();\n  reader2->SetVertexPedigreeIdArrayName(\"id\");\n\n  reader1->Update();\n  reader2->Update();\n\n  vtkNew<vtkTreeMapView> view;\n  view->DisplayHoverTextOff();\n  view->SetGraphFromInputConnection(reader1->GetOutputPort());\n  view->SetTreeFromInputConnection(reader2->GetOutputPort());\n\n  view->SetAreaColorArrayName(\"level\");\n  view->SetEdgeColorToSplineFraction();\n  view->SetColorEdges(true);\n  view->SetAreaLabelArrayName(\"id\");\n  view->SetAreaHoverArrayName(\"id\");\n  view->SetAreaLabelVisibility(true);\n  view->SetAreaSizeArrayName(\"VertexDegree\");\n\n  // Apply a theme to the views\n  // vtkViewTheme* const theme = vtkViewTheme::CreateMellowTheme();\n  // view->ApplyViewTheme(theme);\n  // theme->Delete();\n  vtkNew<vtkViewTheme> theme;\n  view->ApplyViewTheme(theme->CreateMellowTheme());\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->SetAlphaBitPlanes(1);\n  view->Update();\n  view->ResetCamera();\n\n  view->GetRenderWindow()->SetSize(600, 600);\n  view->GetRenderWindow()->SetWindowName(\"TreeMapView\");\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/TreeMapView/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TreeMapView)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOInfovis\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TreeMapView: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TreeMapView MACOSX_BUNDLE TreeMapView.cxx )\n  target_link_libraries(TreeMapView PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TreeMapView\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/TreeMapView/#download-and-build-treemapview","title":"Download and Build TreeMapView","text":"

        Click here to download TreeMapView and its CMakeLists.txt file. Once the tarball TreeMapView.tar has been downloaded and extracted,

        cd TreeMapView/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TreeMapView\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/WordCloud/","title":"WordCloud","text":"

        vtk-examples/Cxx/InfoVis/WordCloud

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/InfoVis/WordCloud/#description","title":"Description","text":"

        A word cloud is a visualization of word frequency in a given text as a weighted list. It is a variation of a tag cloud.

        This example creates a word cloud using vtkFreeTypeTools to render words into images. vtkImageBlend adds these images onto a final image. A vtkImageIterator compares pixels in the text image with those in the final image. If a non-background pixel exists in the final image, that word is not kept.

        The example illustrates a number of std:: concepts including random numbers, regular expressions and multi_set.

        Also, the kwsys CommandLineArguments used to process command line arguments.

        Many parameters are exposed on the command line:

        Usage: WordCloud textFileName \n  --backgroundColorName opt  Name of the color for the background(MignightBlue)\n  --bwMask  Mask image has a single channel(false).\n  --colorDistribution opt o  Distribution of random colors(.6 1.0). If\n                             wordColorName is not empty, random colors are\n                             generated with this distribution\n  --colorScheme opt  Color scheme(constant)\n  --dpi opt  Dots per inch(200)\n  --fontFile opt  Font file name(\"\"). If fontFileName is empty, the\n                             built-in Arial font is used.\n  --fontMultiplier opt  Font multiplier(6). This final FontSize is this\n                             value * the word frequency.\n  --gap opt  Space gap of words (2). The gap is the number of\n                             spaces added to the beginning and end of each word\n  --help  Show help(false)\n  --maskColorName opt  Name of the color for the mask (black). This is\n                             the name of the color that defines the foreground\n                             of the mask. Usually black or white\n  --maskFile opt  Mask file name(\"\"). If the mask file is specified,\n                             if will be used as the mask, otherwise a black\n                             square is used as the mask.\n  --maxFontSize opt  Maximum font size(48)\n  --minFontSize opt  Minimum font size(8)\n  --offsetDistribution opt   Range of random offsets(-size[0]/100.0\n                             -size{1]/100.0)(-20 20).\n  --orientationDistribution  Ranges of random orientations(-20 20)\n  --size opt opt ...  Size of image(640 480)\n  --wordColorName opt  Name of the color for the words(). If the name is\n                             empty, the colorDistribution will generate random\n                             colors.\n

        The example image was produced with these arguments:

        WordCloud ${DATA}/Gettysburg.txt --dpi 150 --fontFile ${DATA}/Canterbury.ttf\n

        and these parameters:

        Cloud Parameters\n  BackgroundColorName: MidnightBlue\n  BWMask: false\n  ColorDistribution: 0.6 1\n  ColorSchemeName:\n  DPI: 150\n  FontFile: /Canterbury.ttf\n  FontMultiplier: 6\n  Gap: 2\n  MaskColorName: black\n  MaskFile:\n  MinFontSize: 12\n  MaxFontSize: 48\n  OffsetDistribution: -6 4\n  OrientationDistribution: -20 20\n  Orientations:\n  ReplacementPairs:\n  Sizes: 640 480\n  StopWords:\n  Title:\n  WordColorName:\n

        and produced this output:

        Kept 94 words\nStopped 178 words\nSkipped 5 words\n

        Info

        We may add a word cloud class to VTK is there is enough interest.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/WordCloud/#code","title":"Code","text":"

        WordCloud.cxx

        #include <vtkNew.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkFreeTypeTools.h>\n#include <vtkImageBlend.h>\n#include <vtkImageData.h>\n#include <vtkImageIterator.h>\n\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\n#include <vtkImageAppendComponents.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageResize.h>\n\n#include <vtksys/CommandLineArguments.hxx>\n\n// stl\n#include <algorithm>\n#include <fstream>\n#include <functional>\n#include <iostream>\n#include <iterator>\n#include <map>\n#include <random>\n#include <regex>\n#include <set>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n// Cloud Parameters\nstruct CloudParameters\n{\n  CloudParameters()\n    : FontFile(\"\"),\n      MaskFile(\"\"),\n      DPI(200),\n      MaxFontSize(48),\n      MinFontSize(12),\n      MinFrequency(1),\n      FontMultiplier(6),\n      ColorSchemeName(\"\"),\n      BackgroundColorName(\"MidnightBlue\"),\n      MaskColorName(\"black\"),\n      BWMask(false),\n      WordColorName(\"\"),\n      Gap(2),\n      KeptCount(0){};\n  void Print(ostream& os)\n  {\n    os << \"Cloud Parameters\" << std::endl;\n    os << \"  BackgroundColorName: \" << BackgroundColorName << std::endl;\n    os << \"  BWMask: \" << (BWMask ? \"true\" : \"false\") << std::endl;\n    os << \"  ColorDistribution: \" << ColorDistribution[0] << \" \"\n       << ColorDistribution[1] << std::endl;\n    os << \"  ColorSchemeName: \" << ColorSchemeName << std::endl;\n    os << \"  DPI: \" << DPI << std::endl;\n    os << \"  FontFile: \" << FontFile << std::endl;\n    os << \"  FontMultiplier: \" << FontMultiplier << std::endl;\n    os << \"  Gap: \" << Gap << std::endl;\n    os << \"  MaskColorName: \" << MaskColorName << std::endl;\n    os << \"  MaskFile: \" << MaskFile << std::endl;\n    os << \"  MinFontSize: \" << MinFontSize << std::endl;\n    os << \"  MaxFontSize: \" << MaxFontSize << std::endl;\n    os << \"  MinFrequency: \" << MinFrequency << std::endl;\n    os << \"  OffsetDistribution: \" << OffsetDistribution[0] << \" \"\n       << OffsetDistribution[1] << std::endl;\n    os << \"  OrientationDistribution: \" << OrientationDistribution[0] << \" \"\n       << OrientationDistribution[1] << std::endl;\n    os << \"  Orientations: \";\n    for (auto o : Orientations)\n    {\n      os << o << \" \";\n    }\n    os << std::endl;\n    os << \"  ReplacementPairs: \";\n    for (auto p = 0; p < ReplacementPairs.size(); p += 2)\n    {\n      os << ReplacementPairs[p] << \"->\" << ReplacementPairs[p + 1] << \" \";\n    }\n    os << std::endl;\n    os << \"  Sizes: \" << Sizes[0] << \" \" << Sizes[1] << std::endl;\n    os << \"  StopWords: \";\n    for (auto const& s : StopWords)\n    {\n      os << s << \" \";\n    }\n    os << std::endl;\n    os << \"  Title: \" << Title << std::endl;\n    os << \"  WordColorName: \" << WordColorName << std::endl;\n  }\n  std::vector<int> AdjustedSizes;\n  std::string BackgroundColorName;\n  bool BWMask;\n  std::string ColorSchemeName;\n  int DPI;\n  std::string FontFile;\n  int Gap;\n  int KeptCount;\n  std::string MaskColorName;\n  std::string MaskFile;\n  int MaxFontSize;\n  int MinFontSize;\n  int MinFrequency;\n  int FontMultiplier;\n  std::vector<double> ColorDistribution;\n  std::vector<int> OffsetDistribution;\n  std::vector<double> OrientationDistribution;\n  std::vector<double> Orientations;\n  std::vector<std::string> ReplacementPairs;\n  std::vector<int> Sizes;\n  std::vector<std::string> StopWords;\n  std::string Title;\n  std::string WordColorName;\n};\nbool ProcessCommandLine(vtksys::CommandLineArguments& arg,\n                        CloudParameters& cloudParameters);\n\n// Declaring the type of Predicate that accepts 2 pairs and return a bool\ntypedef std::function<bool(std::pair<std::string, int>,\n                           std::pair<std::string, int>)>\n    Comparator;\n\nstd::multiset<std::pair<std::string, int>, Comparator>\nFindWordsSortedByFrequency(std::string&, CloudParameters& cloudParameters);\nstruct ExtentOffset\n{\n  ExtentOffset(int _x = 0.0, int _y = 0.0) : x(_x), y(_y)\n  {\n  }\n  int x, y;\n};\nstruct ArchimedesValue\n{\n  ArchimedesValue(double _x = 0.0, double _y = 0.0) : x(_x), y(_y)\n  {\n  }\n  double x, y;\n};\nbool AddWordToFinal(const std::string, const int, CloudParameters&,\n                    std::mt19937&, double orientation,\n                    std::vector<ExtentOffset>&, vtkImageBlend*,\n                    std::array<int, 6>&);\n\nvoid ArchimedesSpiral(std::vector<ExtentOffset>&, std::vector<int>&);\nvoid ReplaceMaskColorWithBackgroundColor(vtkImageData*, CloudParameters&);\nvoid CreateStopList(std::vector<std::string>& StopList);\nvoid ShowColorSeriesNames(ostream& os);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Process command line argumemts.\n  CloudParameters cloudParameters;\n  vtksys::CommandLineArguments arg;\n  arg.Initialize(argc, argv);\n  if (!ProcessCommandLine(arg, cloudParameters))\n  {\n    return EXIT_FAILURE;\n  }\n\n  // Get the file that contains the text to be converted to a word cloud.\n  char** newArgv = nullptr;\n  int newArgc = 0;\n  arg.GetUnusedArguments(&newArgc, &newArgv);\n  if (newArgc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" textFileName \" << arg.GetHelp()\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Open the text file\n  std::ifstream t(newArgv[1]);\n  std::stringstream buffer;\n  buffer << t.rdbuf();\n  std::string s = buffer.str();\n  t.close();\n\n  // Generate a path for placement of words.\n  std::vector<ExtentOffset> offset;\n  ArchimedesSpiral(offset, cloudParameters.Sizes);\n\n  // Sort the word by frequency.\n  std::multiset<std::pair<std::string, int>, Comparator> sortedWords =\n      FindWordsSortedByFrequency(s, cloudParameters);\n\n  // Create a mask image.\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3ub maskColor =\n      colors->GetColor3ub(cloudParameters.MaskColorName.c_str());\n  vtkSmartPointer<vtkImageData> maskImage;\n  // If a mask file is not defined, create a square mask.\n  if (cloudParameters.MaskFile == \"\")\n  {\n    vtkNew<vtkImageCanvasSource2D> defaultMask;\n    defaultMask->SetScalarTypeToUnsignedChar();\n    defaultMask->SetNumberOfScalarComponents(3);\n    defaultMask->SetExtent(0, cloudParameters.Sizes[0] - 1, 0,\n                           cloudParameters.Sizes[1] - 1, 0, 0);\n    defaultMask->SetDrawColor(maskColor.GetData()[0], maskColor.GetData()[1],\n                              maskColor.GetData()[2]);\n    defaultMask->FillBox(0, cloudParameters.Sizes[0] - 1, 0,\n                         cloudParameters.Sizes[1] - 1);\n    defaultMask->Update();\n    maskImage = defaultMask->GetOutput();\n    cloudParameters.AdjustedSizes.push_back(cloudParameters.Sizes[0]);\n    cloudParameters.AdjustedSizes.push_back(cloudParameters.Sizes[1]);\n  }\n  else\n  {\n    // Read the mask file.\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> reader;\n    reader.TakeReference(\n        readerFactory->CreateImageReader2(cloudParameters.MaskFile.c_str()));\n    reader->SetFileName(cloudParameters.MaskFile.c_str());\n    reader->Update();\n    int dimensions[3];\n    reader->GetOutput()->GetDimensions(dimensions);\n    vtkNew<vtkImageResize> resize;\n    resize->SetInputData(reader->GetOutput());\n    resize->InterpolateOff();\n    double aspect = static_cast<double>(dimensions[1]) /\n        static_cast<double>(dimensions[0]) *\n        static_cast<double>(cloudParameters.Sizes[0]) /\n        static_cast<double>(cloudParameters.Sizes[1]);\n    cloudParameters.AdjustedSizes.push_back(cloudParameters.Sizes[0]);\n    cloudParameters.AdjustedSizes.push_back(aspect * cloudParameters.Sizes[1]);\n    resize->SetOutputDimensions(cloudParameters.AdjustedSizes[0],\n                                cloudParameters.AdjustedSizes[1], 1);\n    if (cloudParameters.BWMask)\n    {\n      vtkNew<vtkImageAppendComponents> appendFilter;\n      appendFilter->SetInputConnection(0, resize->GetOutputPort());\n      appendFilter->AddInputConnection(0, resize->GetOutputPort());\n      appendFilter->AddInputConnection(0, resize->GetOutputPort());\n      appendFilter->Update();\n      maskImage = appendFilter->GetOutput();\n    }\n    else\n    {\n      vtkNew<vtkImageExtractComponents> rgbImage;\n      rgbImage->SetInputConnection(resize->GetOutputPort());\n      rgbImage->SetComponents(0, 1, 2);\n      rgbImage->Update();\n      maskImage = rgbImage->GetOutput();\n    }\n  }\n\n  // Create an image that will hold the final image.\n  vtkNew<vtkImageBlend> final;\n  final->AddInputData(maskImage);\n  final->SetOpacity(0, .5);\n  final->Update();\n\n  // Try to add each word.\n  int numberSkipped = 0;\n  int keep = 0;\n  std::array<int, 6> extent;\n  bool added;\n  // Create a vector of orientations to try..\n  std::mt19937 mt(4355412); // Standard mersenne twister engine.\n  for (auto const& element : sortedWords)\n  {\n    std::vector<double> orientations;\n    if (cloudParameters.Orientations.size() != 0)\n    {\n      orientations = cloudParameters.Orientations;\n    }\n    else\n    {\n      std::uniform_real_distribution<> orientationDist(\n          cloudParameters.OrientationDistribution[0],\n          cloudParameters.OrientationDistribution[1]);\n      orientations.push_back(orientationDist(mt));\n    }\n    std::shuffle(std::begin(orientations), std::end(orientations), mt);\n    for (auto o : orientations)\n    {\n      added = AddWordToFinal(element.first, element.second, cloudParameters, mt,\n                             o, offset, final, extent);\n      if (added)\n      {\n        //      std::cout << element.first << \": \" << element.second <<\n        //      std::endl;\n        keep++;\n        break;\n      }\n      else\n      {\n        numberSkipped++;\n        //      std::cout << \"skipped: \" << element.first << \": \" <<\n        //      element.second << std::endl;\n      }\n    }\n  }\n  std::cout << \"Kept \" << keep << \" words\" << std::endl;\n  std::cout << \"Skipped \" << numberSkipped << \" words\" << std::endl;\n\n  // If a maskFile is specified, replace the maskColor with the background\n  // color.\n  ReplaceMaskColorWithBackgroundColor(final->GetOutput(), cloudParameters);\n\n  // Display the final image.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputData(final->GetOutput());\n  imageViewer->SetupInteractor(interactor);\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Wheat\").GetData());\n  imageViewer->SetSize(cloudParameters.Sizes[0], cloudParameters.Sizes[1]);\n  imageViewer->GetRenderer()->ResetCamera();\n\n  // Zoom in a bit.\n  vtkCamera* camera = imageViewer->GetRenderer()->GetActiveCamera();\n  camera->ParallelProjectionOn();\n  camera->SetParallelScale(cloudParameters.AdjustedSizes[0] * .4);\n  imageViewer->GetRenderWindow()->SetWindowName(\"WordCloud\");\n  imageViewer->GetRenderWindow()->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nstd::multiset<std::pair<std::string, int>, Comparator>\nFindWordsSortedByFrequency(std::string& s, CloudParameters& cloudParameters)\n{\n  // Make replacements.\n  // Create a stop list.\n  std::vector<std::string> stopList;\n  CreateStopList(stopList);\n\n  // Add user stop words.\n  for (auto const& stop : cloudParameters.StopWords)\n  {\n    stopList.push_back(stop);\n  }\n\n  // Drop the case of all words.\n  std::transform(s.begin(), s.end(), s.begin(), ::tolower);\n\n  // Extract words\n  std::regex wordRegex(\"(\\\\w+)\");\n  auto wordsBegin = std::sregex_iterator(s.begin(), s.end(), wordRegex);\n  auto wordsEnd = std::sregex_iterator();\n\n  // Store the words in a map that will contain frequencies.\n  std::map<std::string, int> wordContainer;\n\n  // If a title is present add it with a high frequency.\n  if (cloudParameters.Title.length() > 0)\n  {\n    wordContainer[cloudParameters.Title] = 1000;\n  }\n  const int N = 1;\n  int stop = 0;\n  for (std::sregex_iterator i = wordsBegin; i != wordsEnd; ++i)\n  {\n    std::string matchStr = (*i).str();\n\n    // Replace words with another.\n    for (auto p = 0; p < cloudParameters.ReplacementPairs.size(); p += 2)\n    {\n      std::string from = cloudParameters.ReplacementPairs[p];\n      std::string to = cloudParameters.ReplacementPairs[p + 1];\n      size_t pos = 0;\n      pos = matchStr.find(from, pos);\n      if (matchStr.length() == from.length() && pos == 0)\n      {\n        matchStr.replace(pos, to.length(), to);\n        stopList.push_back(from);\n      }\n    }\n\n    // Skip the word if it is in the stop list or contains a digit.\n    auto it = std::find(stopList.begin(), stopList.end() - 1, matchStr);\n    const auto digit = (*i).str().find_first_of(\"0123456789\");\n    if (*it != *(stopList.end() - 1) || digit != std::string::npos)\n    {\n      stop++;\n      continue;\n    }\n\n    // Only include words that have more than N characters.\n    if (matchStr.size() > N)\n    {\n      // Raise the case of he first letter in the word\n      std::transform(matchStr.begin(), matchStr.begin() + 1, matchStr.begin(),\n                     ::toupper);\n      wordContainer[matchStr]++;\n    }\n  }\n  std::cout << \"Stopped \" << stop << \" words\" << std::endl;\n\n  // Defining a lambda function to compare two pairs. It will compare\n  // two pairs using second field.\n  Comparator compFunctor = [](std::pair<std::string, int> elem1,\n                              std::pair<std::string, int> elem2) {\n    if (elem1.second == elem2.second)\n    {\n      return elem1.first.length() > elem2.first.length();\n    }\n    return elem1.second > elem2.second;\n  };\n\n  // Declaring a multiset that will store the pairs using above comparision\n  // logic.\n  std::multiset<std::pair<std::string, int>, Comparator> setOfWords(\n      wordContainer.begin(), wordContainer.end(), compFunctor);\n\n  return setOfWords;\n}\nbool AddWordToFinal(const std::string word, const int frequency,\n                    CloudParameters& cloudParameters, std::mt19937& mt,\n                    double orientation, std::vector<ExtentOffset>& offset,\n                    vtkImageBlend* final, std::array<int, 6>& extent)\n{\n  // Skip single character words.\n  if (frequency < cloudParameters.MinFrequency)\n  {\n    return false;\n  }\n\n  // Create an image of the string.\n  vtkFreeTypeTools* freeType = vtkFreeTypeTools::GetInstance();\n  freeType->ScaleToPowerTwoOff();\n\n  // Create random distributions.\n  std::uniform_real_distribution<> colorDist(\n      cloudParameters.ColorDistribution[0],\n      cloudParameters.ColorDistribution[1]);\n  // bool discreteOrientations = cloudParameters.Orientations.size() != 0;\n\n  // Setup a property for the strings containing fixed parameters.\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkTextProperty> textProperty;\n  if (cloudParameters.WordColorName.length() > 0)\n  {\n    textProperty->SetColor(\n        colors->GetColor3d(cloudParameters.WordColorName).GetData());\n  }\n  else if (cloudParameters.ColorSchemeName.length() > 0)\n  {\n    vtkNew<vtkColorSeries> colorScheme;\n    //    int index =\n    //        colorScheme->SetColorSchemeByName(cloudParameters.ColorSchemeName);\n    vtkColor3ub color =\n        colorScheme->GetColorRepeating(cloudParameters.KeptCount);\n    if (color.Compare(colors->GetColor3ub(\"black\"), 1) &&\n        cloudParameters.KeptCount == 0)\n    {\n      std::cout << \"The color scheme \" << cloudParameters.ColorSchemeName\n                << \" does not exist.\" << std::endl;\n      ShowColorSeriesNames(std::cout);\n    }\n    textProperty->SetColor(color.GetRed() * 255.0, color.GetGreen() * 255.0,\n                           color.GetBlue() * 255.0);\n  }\n  else\n  {\n    textProperty->SetColor(colorDist(mt), colorDist(mt), colorDist(mt));\n  }\n  textProperty->SetVerticalJustificationToCentered();\n  textProperty->SetJustificationToCentered();\n  textProperty->SetLineOffset(4);\n\n  // Check if a font file is present.\n  if (cloudParameters.FontFile.length() > 0)\n  {\n    textProperty->SetFontFile(cloudParameters.FontFile.c_str());\n    textProperty->SetFontFamily(VTK_FONT_FILE);\n  }\n  else\n  {\n    textProperty->SetFontFamilyToArial();\n  }\n\n  // Set the font size\n  int fontSize = cloudParameters.FontMultiplier * frequency;\n  if (fontSize > cloudParameters.MaxFontSize)\n  {\n    fontSize = cloudParameters.MaxFontSize;\n  }\n  if (fontSize < cloudParameters.MinFontSize)\n  {\n    fontSize = cloudParameters.MinFontSize;\n  }\n  if (frequency == 1000)\n  {\n    fontSize *= 1.2;\n    ;\n  }\n  textProperty->SetFontSize(fontSize);\n  textProperty->SetOrientation(orientation);\n\n  // Add gap\n  std::string spaces;\n  for (int p = 0; p < cloudParameters.Gap; ++p)\n  {\n    spaces.push_back(' ');\n  }\n\n  // For each string, create an image and see if it overlaps with other images,\n  // if so, skip it.\n  int accepted = 0;\n  vtkNew<vtkImageData> textImage;\n  freeType->RenderString(textProperty, spaces + word + spaces,\n                         cloudParameters.DPI, textImage.GetPointer());\n\n  // Set the extent of the text image\n  std::array<int, 4> bb;\n  freeType->GetBoundingBox(textProperty, spaces + word + spaces,\n                           cloudParameters.DPI, bb.data());\n  vtkColor3ub maskColor =\n      colors->GetColor3ub(cloudParameters.MaskColorName.c_str());\n  unsigned char maskR = maskColor.GetData()[0];\n  unsigned char maskG = maskColor.GetData()[1];\n  unsigned char maskB = maskColor.GetData()[2];\n\n  std::uniform_real_distribution<> offsetDist(\n      cloudParameters.OffsetDistribution[0],\n      cloudParameters.OffsetDistribution[1]);\n\n  for (auto it = offset.begin(); it < offset.end(); ++it)\n  {\n    int offsetX = (*it).x + offsetDist(mt); // Add some noise to the offset.\n    int offsetY = (*it).y + offsetDist(mt);\n    // Make sure the text image will fit on the final image\n    if (offsetX + bb[1] - bb[0] < cloudParameters.AdjustedSizes[0] - 1 &&\n        offsetY + bb[3] - bb[2] < cloudParameters.AdjustedSizes[1] - 1 &&\n        offsetX >= 0 && offsetY >= 0)\n    {\n      textImage->SetExtent(offsetX, offsetX + bb[1] - bb[0], offsetY,\n                           offsetY + bb[3] - bb[2], 0, 0);\n      vtkNew<vtkImageData> image;\n      final->Update();\n\n      // Does the text image overlap with images on the final image.\n      vtkImageIterator<unsigned char> finalIt(final->GetOutput(),\n                                              textImage->GetExtent());\n      textImage->GetExtent(extent.data());\n      bool good = true;\n      while (!finalIt.IsAtEnd())\n      {\n        auto finalSpan = finalIt.BeginSpan();\n        while (finalSpan != finalIt.EndSpan())\n        {\n          unsigned char R, G, B;\n          R = *finalSpan++;\n          G = *finalSpan++;\n          B = *finalSpan++;\n          // If the pixel does not contain the background color, the word will\n          // not fit.\n          if (R != maskR && G != maskG && B != maskB)\n          {\n            good = false;\n            break;\n          }\n        }\n        if (!good)\n        {\n          break;\n        }\n        finalIt.NextSpan();\n      }\n      if (good)\n      {\n        accepted++;\n        (cloudParameters.KeptCount)++;\n        image->DeepCopy(textImage);\n        final->AddInputData(image);\n        final->Update();\n        return true;\n      }\n    }\n  }\n  return false;\n}\n\nvoid ArchimedesSpiral(std::vector<ExtentOffset>& offset,\n                      std::vector<int>& sizes)\n{\n  const int centerX = sizes[0] / 2.0;\n  const int centerY = sizes[1] / 2.0;\n\n  const std::size_t N = 10000;\n  constexpr auto pi = 3.141592653589793238462643383279502884L; /* pi */\n  const double deltaAngle = pi * 20 / N;\n  double maxX = -1000.0;\n  double minX = 1000.0;\n  double maxY = -1000.0;\n  double minY = 1000.0;\n  double range = -1000;\n  double e = sizes[0] / sizes[1];\n  std::vector<ArchimedesValue> archimedes;\n  for (std::size_t i = 0; i < N; i += 10)\n  {\n    double x, y;\n    double angle = deltaAngle * i;\n    x = e * angle * std::cos(angle);\n    y = e * angle * std::sin(angle);\n    archimedes.push_back(ArchimedesValue(x, y));\n    maxX = std::max(maxX, x);\n    minX = std::min(minX, x);\n    maxY = std::max(maxY, y);\n    minY = std::min(minY, y);\n    range = std::max(maxX - minX, maxY - minY);\n  }\n  double scaleX = 1.0 / range * sizes[0];\n  //  double scaleY = 1.0 / range * sizes[1];\n  int j = 0;\n  for (auto it = archimedes.begin(); it < archimedes.end(); ++it)\n  {\n\n    if ((*it).y * scaleX + centerY < 0 || (*it).x * scaleX + centerX - 50 < 0)\n      continue;\n    offset.push_back(ExtentOffset((*it).x * scaleX + centerX - 50,\n                                  (*it).y * scaleX + centerY));\n  }\n}\nbool ProcessCommandLine(vtksys::CommandLineArguments& arg,\n                        CloudParameters& cloudParameters)\n{\n  typedef vtksys::CommandLineArguments argT;\n\n  // Need this to get arguments without --'s\n  arg.StoreUnusedArguments(true);\n\n  arg.AddArgument(\"--backgroundColorName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.BackgroundColorName,\n                  \"Name of the color for the background(MignightBlue)\");\n  arg.AddArgument(\n      \"--colorDistribution\", argT::MULTI_ARGUMENT,\n      &cloudParameters.ColorDistribution,\n      \"Distribution of random colors(.6 1.0). If wordColorName is not empty, \"\n      \"random colors are generated with this distribution\");\n  arg.AddArgument(\"--colorSchemeName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.ColorSchemeName, \"Color scheme name()\");\n  arg.AddArgument(\"--dpi\", argT::SPACE_ARGUMENT, &cloudParameters.DPI,\n                  \"Dots per inch(200)\");\n  arg.AddArgument(\"--fontFile\", argT::SPACE_ARGUMENT, &cloudParameters.FontFile,\n                  \"Font file name(\\\"\\\"). If fontFileName is empty, the \"\n                  \"built-in Arial font is used.\");\n  arg.AddArgument(\"--fontMultiplier\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.FontMultiplier,\n                  \"Font multiplier(6). This final FontSize is this value * the \"\n                  \"word frequency.\");\n  arg.AddArgument(\"--gap\", argT::SPACE_ARGUMENT, &cloudParameters.Gap,\n                  \"Space gap of words (2). The gap is the number of spaces \"\n                  \"added to the beginning and end of each word\");\n  arg.AddArgument(\n      \"--maskColorName\", argT::SPACE_ARGUMENT, &cloudParameters.MaskColorName,\n      \"Name of the color for the mask (black). This is the name of the color \"\n      \"that defines the foreground of the mask. Usually black or white\");\n  arg.AddArgument(\n      \"--maskFile\", argT::SPACE_ARGUMENT, &cloudParameters.MaskFile,\n      \"Mask file name(\\\"\\\"). If the mask file is specified, if will be used as \"\n      \"the mask, otherwise a black square is used as the mask.\");\n  arg.AddArgument(\"--minFontSize\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MinFontSize, \"Minimum font size(8)\");\n  arg.AddArgument(\"--minFrequency\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MinFrequency,\n                  \"Minimum word frequency accepted(2)\");\n  arg.AddArgument(\"--maxFontSize\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MaxFontSize, \"Maximum font size(48)\");\n  arg.AddArgument(\n      \"--offsetDistribution\", argT::MULTI_ARGUMENT,\n      &cloudParameters.OffsetDistribution,\n      \"Range of random offsets(-size[0]/100.0 -size{1]/100.0)(-20 20).\");\n  arg.AddArgument(\"--orientationDistribution\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.OrientationDistribution,\n                  \"Ranges of random orientations(-20 20)\");\n  arg.AddArgument(\"--orientations\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.Orientations,\n                  \"List of discrete orientations (). If non-empty, these will \"\n                  \"be used instead of the orientations distribution\");\n  arg.AddArgument(\"--stopWords\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.StopWords,\n                  \"User provided stop words(). These will ba added to the \"\n                  \"built-in stop list.\");\n  arg.AddArgument(\"--bwMask\", argT::NO_ARGUMENT, &cloudParameters.BWMask,\n                  \"Mask image has a single channel(false). Mask images \"\n                  \"normally have three channels (r,g,b).\");\n  arg.AddArgument(\"--size\", argT::MULTI_ARGUMENT, &cloudParameters.Sizes,\n                  \"Size of image(640 480)\");\n  arg.AddArgument(\"--wordColorName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.WordColorName,\n                  \"Name of the color for the words(). If the name is empty, \"\n                  \"the colorDistribution will generate random colors.\");\n  arg.AddArgument(\"--replacementPairs\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.ReplacementPairs,\n                  \"Replace word with another word ().\");\n  arg.AddArgument(\"--title\", argT::SPACE_ARGUMENT, &cloudParameters.Title,\n                  \"Use this word and set a high frequency().\");\n  bool help = false;\n  arg.AddArgument(\"--help\", argT::NO_ARGUMENT, &help, \"Show help(false)\");\n  arg.Parse();\n  if (help)\n  {\n    std::cout << \"Usage: \"\n              << \"WordCloud\"\n              << \" textFileName \" << arg.GetHelp() << std::endl;\n    return false;\n  }\n\n  // Set defaults for vector arguments\n  if (cloudParameters.ColorDistribution.size() == 0)\n  {\n    cloudParameters.ColorDistribution.push_back(.6);\n    cloudParameters.ColorDistribution.push_back(1.0);\n  }\n  if (cloudParameters.OrientationDistribution.size() == 0)\n  {\n    cloudParameters.OrientationDistribution.push_back(-20);\n    cloudParameters.OrientationDistribution.push_back(20);\n  }\n  if (cloudParameters.Sizes.size() == 0)\n  {\n    cloudParameters.Sizes.push_back(640);\n    cloudParameters.Sizes.push_back(480);\n  }\n  if (cloudParameters.OffsetDistribution.size() == 0)\n  {\n    cloudParameters.OffsetDistribution.push_back(-cloudParameters.Sizes[0] /\n                                                 100.0);\n    cloudParameters.OffsetDistribution.push_back(cloudParameters.Sizes[1] /\n                                                 100.0);\n  }\n\n  cloudParameters.Print(std::cout);\n  return true;\n}\nvoid ReplaceMaskColorWithBackgroundColor(vtkImageData* finalImage,\n                                         CloudParameters& cloudParameters)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkColor3ub maskColor =\n      colors->GetColor3ub(cloudParameters.MaskColorName.c_str());\n  unsigned char maskR = maskColor.GetData()[0];\n  unsigned char maskG = maskColor.GetData()[1];\n  unsigned char maskB = maskColor.GetData()[2];\n\n  vtkColor3ub backgroundColor =\n      colors->GetColor3ub(cloudParameters.BackgroundColorName.c_str());\n  unsigned char bkgR = backgroundColor.GetData()[0];\n  unsigned char bkgG = backgroundColor.GetData()[1];\n  unsigned char bkgB = backgroundColor.GetData()[2];\n\n  vtkImageIterator<unsigned char> finalIt(finalImage, finalImage->GetExtent());\n  while (!finalIt.IsAtEnd())\n  {\n    auto finalSpan = finalIt.BeginSpan();\n    while (finalSpan != finalIt.EndSpan())\n    {\n      unsigned char R, G, B;\n      R = *finalSpan;\n      G = *(finalSpan + 1);\n      B = *(finalSpan + 2);\n      // If the pixel does not contain the background color, the word will not\n      // fit\n      if (R != maskR && G != maskG && B != maskB)\n      {\n        finalSpan += 3;\n        continue;\n      }\n      else\n      {\n        *finalSpan = bkgR;\n        *(finalSpan + 1) = bkgG;\n        *(finalSpan + 2) = bkgB;\n      }\n      finalSpan += 3;\n    }\n    finalIt.NextSpan();\n  }\n}\n\nvoid ShowColorSeriesNames(ostream& os)\n{\n  vtkNew<vtkColorSeries> colorSeries;\n  os << \"Valid schemes\" << std::endl;\n  for (auto i = 0; i < colorSeries->GetNumberOfColorSchemes(); ++i)\n  {\n    colorSeries->SetColorScheme(i);\n    os << \"  \" << colorSeries->GetColorSchemeName() << std::endl;\n  }\n}\n\nvoid CreateStopList(std::vector<std::string>& stopList)\n{\n  stopList.push_back(\"a\");\n  stopList.push_back(\"able\");\n  stopList.push_back(\"about\");\n  stopList.push_back(\"above\");\n  stopList.push_back(\"abst\");\n  stopList.push_back(\"accordance\");\n  stopList.push_back(\"according\");\n  stopList.push_back(\"accordingly\");\n  stopList.push_back(\"across\");\n  stopList.push_back(\"act\");\n  stopList.push_back(\"actually\");\n  stopList.push_back(\"added\");\n  stopList.push_back(\"adj\");\n  stopList.push_back(\"affected\");\n  stopList.push_back(\"affecting\");\n  stopList.push_back(\"affects\");\n  stopList.push_back(\"after\");\n  stopList.push_back(\"afterwards\");\n  stopList.push_back(\"again\");\n  stopList.push_back(\"against\");\n  stopList.push_back(\"ah\");\n  stopList.push_back(\"all\");\n  stopList.push_back(\"almost\");\n  stopList.push_back(\"alone\");\n  stopList.push_back(\"along\");\n  stopList.push_back(\"already\");\n  stopList.push_back(\"also\");\n  stopList.push_back(\"although\");\n  stopList.push_back(\"always\");\n  stopList.push_back(\"am\");\n  stopList.push_back(\"among\");\n  stopList.push_back(\"amongst\");\n  stopList.push_back(\"an\");\n  stopList.push_back(\"and\");\n  stopList.push_back(\"announce\");\n  stopList.push_back(\"another\");\n  stopList.push_back(\"any\");\n  stopList.push_back(\"anybody\");\n  stopList.push_back(\"anyhow\");\n  stopList.push_back(\"anymore\");\n  stopList.push_back(\"anyone\");\n  stopList.push_back(\"anything\");\n  stopList.push_back(\"anyway\");\n  stopList.push_back(\"anyways\");\n  stopList.push_back(\"anywhere\");\n  stopList.push_back(\"apparently\");\n  stopList.push_back(\"approximately\");\n  stopList.push_back(\"are\");\n  stopList.push_back(\"aren\");\n  stopList.push_back(\"arent\");\n  stopList.push_back(\"arise\");\n  stopList.push_back(\"around\");\n  stopList.push_back(\"as\");\n  stopList.push_back(\"aside\");\n  stopList.push_back(\"ask\");\n  stopList.push_back(\"asking\");\n  stopList.push_back(\"at\");\n  stopList.push_back(\"auth\");\n  stopList.push_back(\"available\");\n  stopList.push_back(\"away\");\n  stopList.push_back(\"awfully\");\n  stopList.push_back(\"b\");\n  stopList.push_back(\"back\");\n  stopList.push_back(\"be\");\n  stopList.push_back(\"became\");\n  stopList.push_back(\"because\");\n  stopList.push_back(\"become\");\n  stopList.push_back(\"becomes\");\n  stopList.push_back(\"becoming\");\n  stopList.push_back(\"been\");\n  stopList.push_back(\"before\");\n  stopList.push_back(\"beforehand\");\n  stopList.push_back(\"begin\");\n  stopList.push_back(\"beginning\");\n  stopList.push_back(\"beginnings\");\n  stopList.push_back(\"begins\");\n  stopList.push_back(\"behind\");\n  stopList.push_back(\"being\");\n  stopList.push_back(\"believe\");\n  stopList.push_back(\"below\");\n  stopList.push_back(\"beside\");\n  stopList.push_back(\"besides\");\n  stopList.push_back(\"between\");\n  stopList.push_back(\"beyond\");\n  stopList.push_back(\"biol\");\n  stopList.push_back(\"both\");\n  stopList.push_back(\"brief\");\n  stopList.push_back(\"briefly\");\n  stopList.push_back(\"but\");\n  stopList.push_back(\"by\");\n  stopList.push_back(\"c\");\n  stopList.push_back(\"ca\");\n  stopList.push_back(\"came\");\n  stopList.push_back(\"can\");\n  stopList.push_back(\"cannot\");\n  stopList.push_back(\"can't\");\n  stopList.push_back(\"cause\");\n  stopList.push_back(\"causes\");\n  stopList.push_back(\"certain\");\n  stopList.push_back(\"certainly\");\n  stopList.push_back(\"co\");\n  stopList.push_back(\"com\");\n  stopList.push_back(\"come\");\n  stopList.push_back(\"comes\");\n  stopList.push_back(\"contain\");\n  stopList.push_back(\"containing\");\n  stopList.push_back(\"contains\");\n  stopList.push_back(\"could\");\n  stopList.push_back(\"couldnt\");\n  stopList.push_back(\"cum\");\n  stopList.push_back(\"d\");\n  stopList.push_back(\"date\");\n  stopList.push_back(\"did\");\n  stopList.push_back(\"didn't\");\n  stopList.push_back(\"different\");\n  stopList.push_back(\"do\");\n  stopList.push_back(\"does\");\n  stopList.push_back(\"doesn't\");\n  stopList.push_back(\"doing\");\n  stopList.push_back(\"done\");\n  stopList.push_back(\"don't\");\n  stopList.push_back(\"down\");\n  stopList.push_back(\"downwards\");\n  stopList.push_back(\"due\");\n  stopList.push_back(\"dr\");\n  stopList.push_back(\"during\");\n  stopList.push_back(\"e\");\n  stopList.push_back(\"each\");\n  stopList.push_back(\"ed\");\n  stopList.push_back(\"edu\");\n  stopList.push_back(\"effect\");\n  stopList.push_back(\"eg\");\n  stopList.push_back(\"eight\");\n  stopList.push_back(\"eighty\");\n  stopList.push_back(\"either\");\n  stopList.push_back(\"else\");\n  stopList.push_back(\"elsewhere\");\n  stopList.push_back(\"end\");\n  stopList.push_back(\"ending\");\n  stopList.push_back(\"enough\");\n  stopList.push_back(\"especially\");\n  stopList.push_back(\"et\");\n  stopList.push_back(\"et-al\");\n  stopList.push_back(\"etc\");\n  stopList.push_back(\"even\");\n  stopList.push_back(\"ever\");\n  stopList.push_back(\"every\");\n  stopList.push_back(\"everybody\");\n  stopList.push_back(\"everyone\");\n  stopList.push_back(\"everything\");\n  stopList.push_back(\"everywhere\");\n  stopList.push_back(\"ex\");\n  stopList.push_back(\"except\");\n  stopList.push_back(\"f\");\n  stopList.push_back(\"far\");\n  stopList.push_back(\"few\");\n  stopList.push_back(\"ff\");\n  stopList.push_back(\"fifth\");\n  stopList.push_back(\"first\");\n  stopList.push_back(\"five\");\n  stopList.push_back(\"fix\");\n  stopList.push_back(\"followed\");\n  stopList.push_back(\"following\");\n  stopList.push_back(\"follows\");\n  stopList.push_back(\"for\");\n  stopList.push_back(\"former\");\n  stopList.push_back(\"formerly\");\n  stopList.push_back(\"forth\");\n  stopList.push_back(\"found\");\n  stopList.push_back(\"four\");\n  stopList.push_back(\"from\");\n  stopList.push_back(\"further\");\n  stopList.push_back(\"furthermore\");\n  stopList.push_back(\"g\");\n  stopList.push_back(\"gave\");\n  stopList.push_back(\"get\");\n  stopList.push_back(\"gets\");\n  stopList.push_back(\"getting\");\n  stopList.push_back(\"give\");\n  stopList.push_back(\"given\");\n  stopList.push_back(\"gives\");\n  stopList.push_back(\"giving\");\n  stopList.push_back(\"go\");\n  stopList.push_back(\"goes\");\n  stopList.push_back(\"gone\");\n  stopList.push_back(\"got\");\n  stopList.push_back(\"gotten\");\n  stopList.push_back(\"h\");\n  stopList.push_back(\"had\");\n  stopList.push_back(\"happens\");\n  stopList.push_back(\"hardly\");\n  stopList.push_back(\"has\");\n  stopList.push_back(\"hasn\");\n  stopList.push_back(\"have\");\n  stopList.push_back(\"haven\");\n  stopList.push_back(\"having\");\n  stopList.push_back(\"he\");\n  stopList.push_back(\"hed\");\n  stopList.push_back(\"hence\");\n  stopList.push_back(\"her\");\n  stopList.push_back(\"here\");\n  stopList.push_back(\"hereafter\");\n  stopList.push_back(\"hereby\");\n  stopList.push_back(\"herein\");\n  stopList.push_back(\"heres\");\n  stopList.push_back(\"hereupon\");\n  stopList.push_back(\"hers\");\n  stopList.push_back(\"herself\");\n  stopList.push_back(\"hes\");\n  stopList.push_back(\"hi\");\n  stopList.push_back(\"hid\");\n  stopList.push_back(\"him\");\n  stopList.push_back(\"himself\");\n  stopList.push_back(\"his\");\n  stopList.push_back(\"hither\");\n  stopList.push_back(\"home\");\n  stopList.push_back(\"how\");\n  stopList.push_back(\"howbeit\");\n  stopList.push_back(\"however\");\n  stopList.push_back(\"hundred\");\n  stopList.push_back(\"i\");\n  stopList.push_back(\"id\");\n  stopList.push_back(\"ie\");\n  stopList.push_back(\"if\");\n  stopList.push_back(\"im\");\n  stopList.push_back(\"immediate\");\n  stopList.push_back(\"immediately\");\n  stopList.push_back(\"importance\");\n  stopList.push_back(\"important\");\n  stopList.push_back(\"in\");\n  stopList.push_back(\"inc\");\n  stopList.push_back(\"indeed\");\n  stopList.push_back(\"index\");\n  stopList.push_back(\"information\");\n  stopList.push_back(\"instead\");\n  stopList.push_back(\"into\");\n  stopList.push_back(\"invention\");\n  stopList.push_back(\"inward\");\n  stopList.push_back(\"is\");\n  stopList.push_back(\"isn\");\n  stopList.push_back(\"it\");\n  stopList.push_back(\"itd\");\n  stopList.push_back(\"it\");\n  stopList.push_back(\"its\");\n  stopList.push_back(\"itself\");\n  stopList.push_back(\"j\");\n  stopList.push_back(\"jr\");\n  stopList.push_back(\"just\");\n  stopList.push_back(\"k\");\n  stopList.push_back(\"keep\");\n  stopList.push_back(\"keeps\");\n  stopList.push_back(\"kept\");\n  stopList.push_back(\"kg\");\n  stopList.push_back(\"km\");\n  stopList.push_back(\"know\");\n  stopList.push_back(\"known\");\n  stopList.push_back(\"knows\");\n  stopList.push_back(\"l\");\n  stopList.push_back(\"largely\");\n  stopList.push_back(\"last\");\n  stopList.push_back(\"lately\");\n  stopList.push_back(\"later\");\n  stopList.push_back(\"latter\");\n  stopList.push_back(\"latterly\");\n  stopList.push_back(\"laude\");\n  stopList.push_back(\"least\");\n  stopList.push_back(\"less\");\n  stopList.push_back(\"lest\");\n  stopList.push_back(\"let\");\n  stopList.push_back(\"lets\");\n  stopList.push_back(\"like\");\n  stopList.push_back(\"liked\");\n  stopList.push_back(\"likely\");\n  stopList.push_back(\"line\");\n  stopList.push_back(\"little\");\n  stopList.push_back(\"ll\");\n  stopList.push_back(\"look\");\n  stopList.push_back(\"looking\");\n  stopList.push_back(\"looks\");\n  stopList.push_back(\"ltd\");\n  stopList.push_back(\"m\");\n  stopList.push_back(\"made\");\n  stopList.push_back(\"mainly\");\n  stopList.push_back(\"make\");\n  stopList.push_back(\"makes\");\n  stopList.push_back(\"many\");\n  stopList.push_back(\"may\");\n  stopList.push_back(\"maybe\");\n  stopList.push_back(\"me\");\n  stopList.push_back(\"mean\");\n  stopList.push_back(\"means\");\n  stopList.push_back(\"meantime\");\n  stopList.push_back(\"meanwhile\");\n  stopList.push_back(\"merely\");\n  stopList.push_back(\"met\");\n  stopList.push_back(\"mg\");\n  stopList.push_back(\"mic\");\n  stopList.push_back(\"might\");\n  stopList.push_back(\"million\");\n  stopList.push_back(\"miss\");\n  stopList.push_back(\"ml\");\n  stopList.push_back(\"more\");\n  stopList.push_back(\"moreover\");\n  stopList.push_back(\"most\");\n  stopList.push_back(\"mostly\");\n  stopList.push_back(\"mr\");\n  stopList.push_back(\"mrs\");\n  stopList.push_back(\"much\");\n  stopList.push_back(\"mug\");\n  stopList.push_back(\"must\");\n  stopList.push_back(\"my\");\n  stopList.push_back(\"myself\");\n  stopList.push_back(\"n\");\n  stopList.push_back(\"na\");\n  stopList.push_back(\"name\");\n  stopList.push_back(\"namely\");\n  stopList.push_back(\"nay\");\n  stopList.push_back(\"nd\");\n  stopList.push_back(\"near\");\n  stopList.push_back(\"nearly\");\n  stopList.push_back(\"necessarily\");\n  stopList.push_back(\"necessary\");\n  stopList.push_back(\"need\");\n  stopList.push_back(\"needs\");\n  stopList.push_back(\"neither\");\n  stopList.push_back(\"never\");\n  stopList.push_back(\"nevertheless\");\n  stopList.push_back(\"new\");\n  stopList.push_back(\"next\");\n  stopList.push_back(\"nine\");\n  stopList.push_back(\"ninety\");\n  stopList.push_back(\"no\");\n  stopList.push_back(\"nobody\");\n  stopList.push_back(\"non\");\n  stopList.push_back(\"none\");\n  stopList.push_back(\"nonetheless\");\n  stopList.push_back(\"noone\");\n  stopList.push_back(\"nor\");\n  stopList.push_back(\"normally\");\n  stopList.push_back(\"nos\");\n  stopList.push_back(\"not\");\n  stopList.push_back(\"noted\");\n  stopList.push_back(\"nothing\");\n  stopList.push_back(\"now\");\n  stopList.push_back(\"nowhere\");\n  stopList.push_back(\"o\");\n  stopList.push_back(\"obtain\");\n  stopList.push_back(\"obtained\");\n  stopList.push_back(\"obviously\");\n  stopList.push_back(\"of\");\n  stopList.push_back(\"off\");\n  stopList.push_back(\"often\");\n  stopList.push_back(\"oh\");\n  stopList.push_back(\"ok\");\n  stopList.push_back(\"okay\");\n  stopList.push_back(\"old\");\n  stopList.push_back(\"omitted\");\n  stopList.push_back(\"on\");\n  stopList.push_back(\"once\");\n  stopList.push_back(\"one\");\n  stopList.push_back(\"ones\");\n  stopList.push_back(\"only\");\n  stopList.push_back(\"onto\");\n  stopList.push_back(\"or\");\n  stopList.push_back(\"ord\");\n  stopList.push_back(\"org\");\n  stopList.push_back(\"other\");\n  stopList.push_back(\"others\");\n  stopList.push_back(\"otherwise\");\n  stopList.push_back(\"ought\");\n  stopList.push_back(\"our\");\n  stopList.push_back(\"ours\");\n  stopList.push_back(\"ourselves\");\n  stopList.push_back(\"out\");\n  stopList.push_back(\"outside\");\n  stopList.push_back(\"over\");\n  stopList.push_back(\"overall\");\n  stopList.push_back(\"owing\");\n  stopList.push_back(\"own\");\n  stopList.push_back(\"p\");\n  stopList.push_back(\"page\");\n  stopList.push_back(\"pages\");\n  stopList.push_back(\"part\");\n  stopList.push_back(\"particular\");\n  stopList.push_back(\"particularly\");\n  stopList.push_back(\"past\");\n  stopList.push_back(\"per\");\n  stopList.push_back(\"perhaps\");\n  stopList.push_back(\"ph\");\n  stopList.push_back(\"placed\");\n  stopList.push_back(\"please\");\n  stopList.push_back(\"plus\");\n  stopList.push_back(\"poorly\");\n  stopList.push_back(\"possible\");\n  stopList.push_back(\"possibly\");\n  stopList.push_back(\"potentially\");\n  stopList.push_back(\"pp\");\n  stopList.push_back(\"predominantly\");\n  stopList.push_back(\"present\");\n  stopList.push_back(\"previously\");\n  stopList.push_back(\"primarily\");\n  stopList.push_back(\"probably\");\n  stopList.push_back(\"promptly\");\n  stopList.push_back(\"proud\");\n  stopList.push_back(\"provides\");\n  stopList.push_back(\"put\");\n  stopList.push_back(\"q\");\n  stopList.push_back(\"que\");\n  stopList.push_back(\"quickly\");\n  stopList.push_back(\"quite\");\n  stopList.push_back(\"qv\");\n  stopList.push_back(\"r\");\n  stopList.push_back(\"ran\");\n  stopList.push_back(\"rather\");\n  stopList.push_back(\"rd\");\n  stopList.push_back(\"re\");\n  stopList.push_back(\"readily\");\n  stopList.push_back(\"really\");\n  stopList.push_back(\"recent\");\n  stopList.push_back(\"recently\");\n  stopList.push_back(\"ref\");\n  stopList.push_back(\"refs\");\n  stopList.push_back(\"regarding\");\n  stopList.push_back(\"regardless\");\n  stopList.push_back(\"regards\");\n  stopList.push_back(\"related\");\n  stopList.push_back(\"relatively\");\n  stopList.push_back(\"research\");\n  stopList.push_back(\"respectively\");\n  stopList.push_back(\"resulted\");\n  stopList.push_back(\"resulting\");\n  stopList.push_back(\"results\");\n  stopList.push_back(\"right\");\n  stopList.push_back(\"run\");\n  stopList.push_back(\"s\");\n  stopList.push_back(\"said\");\n  stopList.push_back(\"same\");\n  stopList.push_back(\"saw\");\n  stopList.push_back(\"sat\");\n  stopList.push_back(\"say\");\n  stopList.push_back(\"saying\");\n  stopList.push_back(\"says\");\n  stopList.push_back(\"sec\");\n  stopList.push_back(\"section\");\n  stopList.push_back(\"see\");\n  stopList.push_back(\"seeing\");\n  stopList.push_back(\"seem\");\n  stopList.push_back(\"seemed\");\n  stopList.push_back(\"seeming\");\n  stopList.push_back(\"seems\");\n  stopList.push_back(\"seen\");\n  stopList.push_back(\"self\");\n  stopList.push_back(\"selves\");\n  stopList.push_back(\"sent\");\n  stopList.push_back(\"seven\");\n  stopList.push_back(\"several\");\n  stopList.push_back(\"shall\");\n  stopList.push_back(\"she\");\n  stopList.push_back(\"shed\");\n  stopList.push_back(\"shes\");\n  stopList.push_back(\"should\");\n  stopList.push_back(\"shouldn\");\n  stopList.push_back(\"show\");\n  stopList.push_back(\"showed\");\n  stopList.push_back(\"shown\");\n  stopList.push_back(\"showns\");\n  stopList.push_back(\"shows\");\n  stopList.push_back(\"significant\");\n  stopList.push_back(\"significantly\");\n  stopList.push_back(\"similar\");\n  stopList.push_back(\"similarly\");\n  stopList.push_back(\"since\");\n  stopList.push_back(\"six\");\n  stopList.push_back(\"slightly\");\n  stopList.push_back(\"so\");\n  stopList.push_back(\"some\");\n  stopList.push_back(\"somebody\");\n  stopList.push_back(\"somehow\");\n  stopList.push_back(\"someone\");\n  stopList.push_back(\"somethan\");\n  stopList.push_back(\"something\");\n  stopList.push_back(\"sometime\");\n  stopList.push_back(\"sometimes\");\n  stopList.push_back(\"somewhat\");\n  stopList.push_back(\"somewhere\");\n  stopList.push_back(\"soon\");\n  stopList.push_back(\"sorry\");\n  stopList.push_back(\"specifically\");\n  stopList.push_back(\"specified\");\n  stopList.push_back(\"specify\");\n  stopList.push_back(\"specifying\");\n  stopList.push_back(\"still\");\n  stopList.push_back(\"stop\");\n  stopList.push_back(\"strongly\");\n  stopList.push_back(\"sub\");\n  stopList.push_back(\"substantially\");\n  stopList.push_back(\"successfully\");\n  stopList.push_back(\"such\");\n  stopList.push_back(\"sufficiently\");\n  stopList.push_back(\"suggest\");\n  stopList.push_back(\"sup\");\n  stopList.push_back(\"sure\");\n  stopList.push_back(\"t\");\n  stopList.push_back(\"take\");\n  stopList.push_back(\"taken\");\n  stopList.push_back(\"taking\");\n  stopList.push_back(\"tell\");\n  stopList.push_back(\"tends\");\n  stopList.push_back(\"th\");\n  stopList.push_back(\"than\");\n  stopList.push_back(\"thank\");\n  stopList.push_back(\"thanks\");\n  stopList.push_back(\"thanx\");\n  stopList.push_back(\"that\");\n  stopList.push_back(\"thats\");\n  stopList.push_back(\"the\");\n  stopList.push_back(\"their\");\n  stopList.push_back(\"theirs\");\n  stopList.push_back(\"them\");\n  stopList.push_back(\"themselves\");\n  stopList.push_back(\"then\");\n  stopList.push_back(\"thence\");\n  stopList.push_back(\"there\");\n  stopList.push_back(\"thereafter\");\n  stopList.push_back(\"thereby\");\n  stopList.push_back(\"thered\");\n  stopList.push_back(\"therefore\");\n  stopList.push_back(\"therein\");\n  stopList.push_back(\"thereof\");\n  stopList.push_back(\"therere\");\n  stopList.push_back(\"theres\");\n  stopList.push_back(\"thereto\");\n  stopList.push_back(\"thereupon\");\n  stopList.push_back(\"these\");\n  stopList.push_back(\"they\");\n  stopList.push_back(\"theyd\");\n  stopList.push_back(\"theyre\");\n  stopList.push_back(\"think\");\n  stopList.push_back(\"this\");\n  stopList.push_back(\"those\");\n  stopList.push_back(\"thou\");\n  stopList.push_back(\"though\");\n  stopList.push_back(\"thoughh\");\n  stopList.push_back(\"thousand\");\n  stopList.push_back(\"throug\");\n  stopList.push_back(\"through\");\n  stopList.push_back(\"throughout\");\n  stopList.push_back(\"thru\");\n  stopList.push_back(\"thus\");\n  stopList.push_back(\"til\");\n  stopList.push_back(\"tip\");\n  stopList.push_back(\"to\");\n  stopList.push_back(\"together\");\n  stopList.push_back(\"too\");\n  stopList.push_back(\"took\");\n  stopList.push_back(\"toward\");\n  stopList.push_back(\"towards\");\n  stopList.push_back(\"tried\");\n  stopList.push_back(\"tries\");\n  stopList.push_back(\"truly\");\n  stopList.push_back(\"try\");\n  stopList.push_back(\"trying\");\n  stopList.push_back(\"ts\");\n  stopList.push_back(\"twice\");\n  stopList.push_back(\"two\");\n  stopList.push_back(\"u\");\n  stopList.push_back(\"un\");\n  stopList.push_back(\"under\");\n  stopList.push_back(\"unfortunately\");\n  stopList.push_back(\"unless\");\n  stopList.push_back(\"unlike\");\n  stopList.push_back(\"unlikely\");\n  stopList.push_back(\"until\");\n  stopList.push_back(\"unto\");\n  stopList.push_back(\"up\");\n  stopList.push_back(\"upon\");\n  stopList.push_back(\"ups\");\n  stopList.push_back(\"us\");\n  stopList.push_back(\"use\");\n  stopList.push_back(\"used\");\n  stopList.push_back(\"useful\");\n  stopList.push_back(\"usefully\");\n  stopList.push_back(\"usefulness\");\n  stopList.push_back(\"uses\");\n  stopList.push_back(\"using\");\n  stopList.push_back(\"usually\");\n  stopList.push_back(\"v\");\n  stopList.push_back(\"value\");\n  stopList.push_back(\"various\");\n  stopList.push_back(\"ve\");\n  stopList.push_back(\"very\");\n  stopList.push_back(\"via\");\n  stopList.push_back(\"viz\");\n  stopList.push_back(\"vol\");\n  stopList.push_back(\"vols\");\n  stopList.push_back(\"vs\");\n  stopList.push_back(\"w\");\n  stopList.push_back(\"want\");\n  stopList.push_back(\"wants\");\n  stopList.push_back(\"was\");\n  stopList.push_back(\"wasnt\");\n  stopList.push_back(\"wasnt\");\n  stopList.push_back(\"way\");\n  stopList.push_back(\"we\");\n  stopList.push_back(\"wed\");\n  stopList.push_back(\"welcome\");\n  stopList.push_back(\"went\");\n  stopList.push_back(\"were\");\n  stopList.push_back(\"werent\");\n  stopList.push_back(\"what\");\n  stopList.push_back(\"whatever\");\n  stopList.push_back(\"whats\");\n  stopList.push_back(\"when\");\n  stopList.push_back(\"whence\");\n  stopList.push_back(\"whenever\");\n  stopList.push_back(\"where\");\n  stopList.push_back(\"whereafter\");\n  stopList.push_back(\"whereas\");\n  stopList.push_back(\"whereby\");\n  stopList.push_back(\"wherein\");\n  stopList.push_back(\"wheres\");\n  stopList.push_back(\"whereupon\");\n  stopList.push_back(\"wherever\");\n  stopList.push_back(\"whether\");\n  stopList.push_back(\"which\");\n  stopList.push_back(\"while\");\n  stopList.push_back(\"whim\");\n  stopList.push_back(\"whither\");\n  stopList.push_back(\"who\");\n  stopList.push_back(\"whod\");\n  stopList.push_back(\"whoever\");\n  stopList.push_back(\"whole\");\n  stopList.push_back(\"whom\");\n  stopList.push_back(\"whomever\");\n  stopList.push_back(\"whos\");\n  stopList.push_back(\"whose\");\n  stopList.push_back(\"why\");\n  stopList.push_back(\"widely\");\n  stopList.push_back(\"will\");\n  stopList.push_back(\"willing\");\n  stopList.push_back(\"wish\");\n  stopList.push_back(\"with\");\n  stopList.push_back(\"within\");\n  stopList.push_back(\"without\");\n  stopList.push_back(\"wont\");\n  stopList.push_back(\"words\");\n  stopList.push_back(\"world\");\n  stopList.push_back(\"would\");\n  stopList.push_back(\"wouldnt\");\n  stopList.push_back(\"www\");\n  stopList.push_back(\"x\");\n  stopList.push_back(\"y\");\n  stopList.push_back(\"yes\");\n  stopList.push_back(\"yet\");\n  stopList.push_back(\"you\");\n  stopList.push_back(\"youd\");\n  stopList.push_back(\"your\");\n  stopList.push_back(\"youre\");\n  stopList.push_back(\"yours\");\n  stopList.push_back(\"yourself\");\n  stopList.push_back(\"yourselves\");\n  stopList.push_back(\"z\");\n  stopList.push_back(\"zero\");\n}\n} // namespace\n
        "},{"location":"Cxx/InfoVis/WordCloud/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WordCloud)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WordCloud: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WordCloud MACOSX_BUNDLE WordCloud.cxx )\n  target_link_libraries(WordCloud PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WordCloud\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/WordCloud/#download-and-build-wordcloud","title":"Download and Build WordCloud","text":"

        Click here to download WordCloud and its CMakeLists.txt file. Once the tarball WordCloud.tar has been downloaded and extracted,

        cd WordCloud/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WordCloud\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/WordCloudDemo/","title":"WordCloudDemo","text":"

        vtk-examples/Cxx/InfoVis/WordCloudDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/WordCloudDemo/#code","title":"Code","text":"

        WordCloudDemo.cxx

        #include <vtkNew.h>\n#include <vtkSmartPointer.h>\n#include <vtkWordCloud.h>\n\n#include <vtkCamera.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <vtksys/CommandLineArguments.hxx>\n\nnamespace {\n// Cloud Parameters.\nclass CloudParameters\n{\npublic:\n  CloudParameters()\n    : BackgroundColorName(\"MidnightBlue\"),\n      BWMask(false),\n      ColorSchemeName(\"\"),\n      DPI(200),\n      FileName(\"\"),\n      FontFileName(\"\"),\n      FontMultiplier(6),\n      Gap(2),\n      MaskColorName(\"black\"),\n      MaskFileName(\"\"),\n      MaxFontSize(48),\n      MinFontSize(12),\n      MinFrequency(1),\n      StopListFileName(\"\"),\n      Title(\"\"),\n      WordColorName(\"\"){};\n  void Print(ostream& os)\n  {\n    os << \"Cloud Parameters\" << std::endl;\n    os << \"  BackgroundColorName: \" << BackgroundColorName << std::endl;\n    os << \"  BWMask: \" << (BWMask ? \"true\" : \"false\") << std::endl;\n    os << \"  ColorDistribution: \" << ColorDistribution[0] << \" \"\n       << ColorDistribution[1] << std::endl;\n    os << \"  ColorSchemeName: \" << ColorSchemeName << std::endl;\n    os << \"  DPI: \" << DPI << std::endl;\n    os << \"  FontFileName: \" << FontFileName << std::endl;\n    os << \"  FontMultiplier: \" << FontMultiplier << std::endl;\n    os << \"  Gap: \" << Gap << std::endl;\n    os << \"  MaskColorName: \" << MaskColorName << std::endl;\n    os << \"  MaskFileName: \" << MaskFileName << std::endl;\n    os << \"  MinFontSize: \" << MinFontSize << std::endl;\n    os << \"  MaxFontSize: \" << MaxFontSize << std::endl;\n    os << \"  MinFrequency: \" << MinFrequency << std::endl;\n    os << \"  OffsetDistribution: \" << OffsetDistribution[0] << \" \"\n       << OffsetDistribution[1] << std::endl;\n    os << \"  OrientationDistribution: \" << OrientationDistribution[0] << \" \"\n       << OrientationDistribution[1] << std::endl;\n    os << \"  Orientations: \";\n    for (auto o : Orientations)\n    {\n      os << o << \" \";\n    }\n    os << std::endl;\n    os << \"  ReplacementPairs: \";\n    for (auto p = 0; p < ReplacementPairs.size(); p += 2)\n    {\n      os << ReplacementPairs[p] << \"->\" << ReplacementPairs[p + 1] << \" \";\n    }\n    os << std::endl;\n    os << \"  Sizes: \" << Sizes[0] << \" \" << Sizes[1] << std::endl;\n    os << \"  StopWords: \";\n    for (auto const& s : StopWords)\n    {\n      os << s << \" \";\n    }\n    os << std::endl;\n    os << \"  Title: \" << Title << std::endl;\n    os << \"  WordColorName: \" << WordColorName << std::endl;\n  }\n  std::string BackgroundColorName;\n  bool BWMask;\n  std::string ColorSchemeName;\n  std::vector<double> ColorDistribution;\n  int DPI;\n  std::string FileName;\n  std::string FontFileName;\n  int FontMultiplier;\n  int Gap;\n  std::string MaskColorName;\n  std::string MaskFileName;\n  int MaxFontSize;\n  int MinFontSize;\n  int MinFrequency;\n  std::vector<int> OffsetDistribution;\n  std::vector<double> OrientationDistribution;\n  std::vector<double> Orientations;\n  std::vector<std::string> ReplacementPairs;\n  std::vector<int> Sizes;\n  std::vector<std::string> StopWords;\n  std::string StopListFileName;\n  std::string Title;\n  std::string WordColorName;\n};\n\nbool ProcessCommandLine(vtksys::CommandLineArguments& arg,\n                        CloudParameters& cloudParameters);\n\nvoid CloudParametersToWordCloud(CloudParameters& cloudParameters,\n                                vtkSmartPointer<vtkWordCloud>& wordCloud);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Process command line argumemts.\n  CloudParameters cloudParameters;\n  vtksys::CommandLineArguments arg;\n  arg.Initialize(argc, argv);\n  if (!ProcessCommandLine(arg, cloudParameters))\n  {\n    return EXIT_FAILURE;\n  }\n\n  // Transfer parameters to word cloud member data.\n  auto wordCloud = vtkSmartPointer<vtkWordCloud>::New();\n  CloudParametersToWordCloud(cloudParameters, wordCloud);\n\n  // Get the file that contains the text to be converted to a word cloud.\n  char** newArgv = nullptr;\n  int newArgc = 0;\n  arg.GetUnusedArguments(&newArgc, &newArgv);\n  if (newArgc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" textFileName \" << arg.GetHelp()\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  wordCloud->SetFileName(newArgv[1]);\n  wordCloud->Update();\n  wordCloud->Print(std::cout);\n  std::cout << \"Kept Words: \" << wordCloud->GetKeptWords().size() << std::endl;\n  std::cout << \"Stopped Words: \" << wordCloud->GetStoppedWords().size()\n            << std::endl;\n  std::cout << \"Skipped Words: \" << wordCloud->GetSkippedWords().size()\n            << std::endl;\n\n  // Display the final image.\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputData(wordCloud->GetOutput());\n  imageViewer->SetupInteractor(interactor);\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(wordCloud->GetBackgroundColorName()).GetData());\n  imageViewer->SetSize(wordCloud->GetSizes()[0], wordCloud->GetSizes()[1]);\n  imageViewer->GetRenderer()->ResetCamera();\n\n  // Zoom in a bit\n  vtkCamera* camera = imageViewer->GetRenderer()->GetActiveCamera();\n  camera->ParallelProjectionOn();\n  camera->SetParallelScale(wordCloud->GetAdjustedSizes()[0] * .4);\n\n  imageViewer->GetRenderWindow()->SetWindowName(\"WordCloudDemo\");\n  imageViewer->GetRenderWindow()->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nbool ProcessCommandLine(vtksys::CommandLineArguments& arg,\n                        CloudParameters& cloudParameters)\n{\n  typedef vtksys::CommandLineArguments argT;\n\n  // Need this to get arguments without --'s.\n  arg.StoreUnusedArguments(true);\n\n  arg.AddArgument(\"--backgroundColorName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.BackgroundColorName,\n                  \"Name of the color for the background(MignightBlue)\");\n  arg.AddArgument(\n      \"--colorDistribution\", argT::MULTI_ARGUMENT,\n      &cloudParameters.ColorDistribution,\n      \"Distribution of random colors(.6 1.0). If wordColorName is not empty, \"\n      \"random colors are generated with this distribution\");\n  arg.AddArgument(\"--colorSchemeName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.ColorSchemeName, \"Color scheme name()\");\n  arg.AddArgument(\"--dpi\", argT::SPACE_ARGUMENT, &cloudParameters.DPI,\n                  \"Dots per inch(200)\");\n  arg.AddArgument(\"--fontFileName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.FontFileName,\n                  \"Font file name(\\\"\\\"). If fontFileName is empty, the \"\n                  \"built-in Arial font is used.\");\n  arg.AddArgument(\"--fontMultiplier\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.FontMultiplier,\n                  \"Font multiplier(6). This final FontSize is this value * the \"\n                  \"word frequency.\");\n  arg.AddArgument(\"--gap\", argT::SPACE_ARGUMENT, &cloudParameters.Gap,\n                  \"Space gap of words (2). The gap is the number of spaces \"\n                  \"added to the beginning and end of each word\");\n  arg.AddArgument(\n      \"--maskColorName\", argT::SPACE_ARGUMENT, &cloudParameters.MaskColorName,\n      \"Name of the color for the mask (black). This is the name of the color \"\n      \"that defines the foreground of the mask. Usually black or white\");\n  arg.AddArgument(\n      \"--maskFileName\", argT::SPACE_ARGUMENT, &cloudParameters.MaskFileName,\n      \"Mask file name(\\\"\\\"). If the mask file is specified, if will be used as \"\n      \"the mask, otherwise a black square is used as the mask.\");\n  arg.AddArgument(\"--minFontSize\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MinFontSize, \"Minimum font size(8)\");\n  arg.AddArgument(\"--minFrequency\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MinFrequency,\n                  \"Minimum word frequency accepted(2)\");\n  arg.AddArgument(\"--maxFontSize\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.MaxFontSize, \"Maximum font size(48)\");\n  arg.AddArgument(\n      \"--offsetDistribution\", argT::MULTI_ARGUMENT,\n      &cloudParameters.OffsetDistribution,\n      \"Range of random offsets(-size[0]/100.0 -size{1]/100.0)(-20 20).\");\n  arg.AddArgument(\"--orientationDistribution\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.OrientationDistribution,\n                  \"Ranges of random orientations(-20 20)\");\n  arg.AddArgument(\"--orientations\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.Orientations,\n                  \"List of discrete orientations (). If non-empty, these will \"\n                  \"be used instead of the orientations distribution\");\n  arg.AddArgument(\n      \"--stopListFileName\", argT::SPACE_ARGUMENT,\n      &cloudParameters.StopListFileName,\n      \"User provided stop list file. Replaces built-in stop list().\");\n  arg.AddArgument(\"--stopWords\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.StopWords,\n                  \"User provided stop words(). These will ba added to the \"\n                  \"built-in stop list.\");\n  arg.AddArgument(\"--bwMask\", argT::NO_ARGUMENT, &cloudParameters.BWMask,\n                  \"Mask image has a single channel(false). Mask images \"\n                  \"normally have three channels (r,g,b).\");\n  arg.AddArgument(\"--size\", argT::MULTI_ARGUMENT, &cloudParameters.Sizes,\n                  \"Size of image(640 480)\");\n  arg.AddArgument(\"--wordColorName\", argT::SPACE_ARGUMENT,\n                  &cloudParameters.WordColorName,\n                  \"Name of the color for the words(). If the name is empty, \"\n                  \"the colorDistribution will generate random colors.\");\n  arg.AddArgument(\"--replacementPairs\", argT::MULTI_ARGUMENT,\n                  &cloudParameters.ReplacementPairs,\n                  \"Replace word with another word ().\");\n  arg.AddArgument(\"--title\", argT::SPACE_ARGUMENT, &cloudParameters.Title,\n                  \"Use this word and set a high frequency().\");\n  bool help = false;\n  arg.AddArgument(\"--help\", argT::NO_ARGUMENT, &help, \"Show help(false)\");\n  arg.Parse();\n  if (help)\n  {\n    std::cout << \"Usage: \"\n              << \"WordCloud\"\n              << \" textFileName \" << arg.GetHelp() << std::endl;\n    return false;\n  }\n\n  // Set defaults for vector arguments.\n  if (cloudParameters.ColorDistribution.size() == 0)\n  {\n    cloudParameters.ColorDistribution.push_back(.6);\n    cloudParameters.ColorDistribution.push_back(1.0);\n  }\n\n  if (cloudParameters.OrientationDistribution.size() == 0)\n  {\n    cloudParameters.OrientationDistribution.push_back(-20);\n    cloudParameters.OrientationDistribution.push_back(20);\n  }\n  if (cloudParameters.Sizes.size() == 0)\n  {\n    cloudParameters.Sizes.push_back(640);\n    cloudParameters.Sizes.push_back(480);\n  }\n  if (cloudParameters.OffsetDistribution.size() == 0)\n  {\n    cloudParameters.OffsetDistribution.push_back(-cloudParameters.Sizes[0] /\n                                                 100.0);\n    cloudParameters.OffsetDistribution.push_back(cloudParameters.Sizes[1] /\n                                                 100.0);\n  }\n  return true;\n}\nvoid CloudParametersToWordCloud(CloudParameters& cloudParameters,\n                                vtkSmartPointer<vtkWordCloud>& wordCloud)\n{\n  wordCloud->SetBackgroundColorName(cloudParameters.BackgroundColorName);\n  wordCloud->SetBWMask(cloudParameters.BWMask);\n  wordCloud->SetColorSchemeName(cloudParameters.ColorSchemeName);\n  wordCloud->SetFontFileName(cloudParameters.FontFileName);\n\n  std::array<double, 2> colorDistribution;\n  colorDistribution[0] = cloudParameters.ColorDistribution[0];\n  colorDistribution[1] = cloudParameters.ColorDistribution[1];\n  wordCloud->SetColorDistribution(colorDistribution);\n  wordCloud->SetDPI(cloudParameters.DPI);\n  wordCloud->SetFileName(cloudParameters.FileName);\n  wordCloud->SetFontFileName(cloudParameters.FontFileName);\n  wordCloud->SetFontMultiplier(cloudParameters.FontMultiplier);\n  wordCloud->SetGap(cloudParameters.Gap);\n  wordCloud->SetMaskColorName(cloudParameters.MaskColorName);\n  wordCloud->SetMaskFileName(cloudParameters.MaskFileName);\n  wordCloud->SetMaxFontSize(cloudParameters.MaxFontSize);\n  wordCloud->SetMinFontSize(cloudParameters.MinFontSize);\n  wordCloud->SetMinFrequency(cloudParameters.MinFrequency);\n\n  std::array<int, 2> offsetDistribution;\n  offsetDistribution[0] = cloudParameters.OffsetDistribution[0];\n  offsetDistribution[1] = cloudParameters.OffsetDistribution[1];\n  wordCloud->SetOffsetDistribution(offsetDistribution);\n\n  std::array<double, 2> orientationDistribution;\n  orientationDistribution[0] = cloudParameters.OrientationDistribution[0];\n  orientationDistribution[1] = cloudParameters.OrientationDistribution[1];\n  wordCloud->SetOrientationDistribution(orientationDistribution);\n  wordCloud->SetOrientations(cloudParameters.Orientations);\n\n  std::vector<std::tuple<std::string, std::string>> replacementPairs;\n  std::tuple<std::string, std::string> replacementPair;\n  for (auto p = 0; p < cloudParameters.ReplacementPairs.size(); p += 2)\n  {\n    std::string from = cloudParameters.ReplacementPairs[p];\n    std::string to = cloudParameters.ReplacementPairs[p + 1];\n    replacementPair = std::make_tuple(from, to);\n    replacementPairs.push_back(replacementPair);\n  }\n  wordCloud->SetReplacementPairs(replacementPairs);\n\n  std::array<int, 2> sizes;\n  sizes[0] = cloudParameters.Sizes[0];\n  sizes[1] = cloudParameters.Sizes[1];\n  wordCloud->SetSizes(sizes);\n\n  std::set<std::string> stopWords;\n  for (auto const& s : cloudParameters.StopWords)\n  {\n    stopWords.insert(s);\n  }\n  wordCloud->SetStopWords(stopWords);\n  wordCloud->SetStopListFileName(cloudParameters.StopListFileName);\n  wordCloud->SetWordColorName(cloudParameters.WordColorName);\n  std::string title(cloudParameters.Title);\n  wordCloud->SetTitle(title);\n}\n} // namespace\n
        "},{"location":"Cxx/InfoVis/WordCloudDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WordCloudDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InfovisCore\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WordCloudDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WordCloudDemo MACOSX_BUNDLE WordCloudDemo.cxx )\n  target_link_libraries(WordCloudDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WordCloudDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/WordCloudDemo/#download-and-build-wordclouddemo","title":"Download and Build WordCloudDemo","text":"

        Click here to download WordCloudDemo and its CMakeLists.txt file. Once the tarball WordCloudDemo.tar has been downloaded and extracted,

        cd WordCloudDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WordCloudDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/InfoVis/XGMLReader/","title":"XGMLReader","text":"

        vtk-examples/Cxx/InfoVis/XGMLReader

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/InfoVis/XGMLReader/#description","title":"Description","text":"

        This example reads and displays the graph from a gml file.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/InfoVis/XGMLReader/#code","title":"Code","text":"

        XGMLReader.cxx

        #include <vtkGraphLayoutStrategy.h>\n#include <vtkGraphLayoutView.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimple2DLayoutStrategy.h>\n#include <vtkUndirectedGraph.h>\n#include <vtkViewTheme.h>\n#include <vtkXGMLReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: Filename e.g. fsm.gml\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkXGMLReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  vtkUndirectedGraph* g = reader->GetOutput();\n\n  vtkNew<vtkViewTheme> theme;\n  theme->SetLineWidth(1);\n  theme->SetPointSize(5);\n  theme->SetCellOpacity(0.99);\n  theme->SetOutlineColor(colors->GetColor3d(\"Gray\").GetData());\n  // Vertices\n  theme->SetPointColor(colors->GetColor3d(\"Chartreuse\").GetData());\n  theme->SetSelectedPointColor(colors->GetColor3d(\"Magenta\").GetData());\n  theme->SetPointHueRange(1.0, 1.0);\n  theme->SetPointSaturationRange(1.0, 1.0);\n  theme->SetPointValueRange(0.0, 1.0);\n  // theme->SetPointAlphaRange(0.2, 0.8);\n  // Edges\n  theme->SetCellColor(colors->GetColor3d(\"Honeydew\").GetData());\n  theme->SetSelectedCellColor(colors->GetColor3d(\"Cyan\").GetData());\n  theme->SetCellHueRange(0.1, 0.1);\n  theme->SetCellSaturationRange(0.2, 1.0);\n  theme->SetCellValueRange(0.5, 1.0);\n  // theme->SetCellAlphaRange(0.2, 0.8);\n\n  vtkNew<vtkSimple2DLayoutStrategy> simple2D;\n\n  vtkNew<vtkGraphLayoutView> graphLayoutView;\n  graphLayoutView->AddRepresentationFromInput(g);\n  graphLayoutView->ApplyViewTheme(theme);\n  // If we create a layout object directly, just set the pointer to this method.\n  // graphLayoutView->SetLayoutStrategy(simple2D);\n  graphLayoutView->SetLayoutStrategyToSimple2D();\n\n  graphLayoutView->ResetCamera();\n\n  graphLayoutView->GetRenderer()->GradientBackgroundOn();\n  graphLayoutView->GetRenderer()->SetBackground2(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n  graphLayoutView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Black\").GetData());\n\n  graphLayoutView->GetRenderWindow()->SetSize(600, 600);\n  graphLayoutView->GetRenderWindow()->SetWindowName(\"XGMLReader\");\n\n  graphLayoutView->Render();\n\n  graphLayoutView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/InfoVis/XGMLReader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(XGMLReader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOInfovis\n  InfovisLayout\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsCore\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"XGMLReader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(XGMLReader MACOSX_BUNDLE XGMLReader.cxx )\n  target_link_libraries(XGMLReader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS XGMLReader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/InfoVis/XGMLReader/#download-and-build-xgmlreader","title":"Download and Build XGMLReader","text":"

        Click here to download XGMLReader and its CMakeLists.txt file. Once the tarball XGMLReader.tar has been downloaded and extracted,

        cd XGMLReader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./XGMLReader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/Assembly/","title":"Assembly","text":"

        vtk-examples/Cxx/Interaction/Assembly

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/Assembly/#code","title":"Code","text":"

        Assembly.cxx

        #include <vtkActor.h>\n#include <vtkAssembly.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetCenter(5.0, 0.0, 0.0);\n  cubeSource->Update();\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  // Combine the sphere and cube into an assembly.\n  vtkNew<vtkAssembly> assembly;\n  assembly->AddPart(sphereActor);\n  assembly->AddPart(cubeActor);\n\n  // Apply a transform to the whole assembly.\n  vtkNew<vtkTransform> transform;\n  transform->PostMultiply(); // This is the key line.\n  transform->Translate(5.0, 0, 0);\n\n  assembly->SetUserTransform(transform);\n\n  // Extract each actor from the assembly and change its opacity.\n  vtkNew<vtkPropCollection> collection;\n\n  assembly->GetActors(collection);\n  collection->InitTraversal();\n  for (vtkIdType i = 0; i < collection->GetNumberOfItems(); i++)\n  {\n    dynamic_cast<vtkActor*>(collection->GetNextProp())\n        ->GetProperty()\n        ->SetOpacity(0.5);\n  }\n\n  // Visualization\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(assembly);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderer->ResetCamera();\n  renderWindow->SetWindowName(\"Assembly\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/Assembly/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Assembly)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Assembly: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Assembly MACOSX_BUNDLE Assembly.cxx )\n  target_link_libraries(Assembly PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Assembly\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/Assembly/#download-and-build-assembly","title":"Download and Build Assembly","text":"

        Click here to download Assembly and its CMakeLists.txt file. Once the tarball Assembly.tar has been downloaded and extracted,

        cd Assembly/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Assembly\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/CallBack/","title":"CallBack","text":"

        vtk-examples/Cxx/Interaction/CallBack

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/CallBack/#description","title":"Description","text":""},{"location":"Cxx/Interaction/CallBack/#demonstrate-how-to-set-up-a-callback-with-client-data","title":"Demonstrate how to set up a callback with client data","text":"

        Getting the camera orientation after interacting with the image is used as an example.

        We define a callback passing the active camera as client data and linking the callback to the EndInteractionEvent of the vtkRenderWindowInteractor class. This allows us to get the camera orientation after we manipulate the image. We can then copy/paste this data as needed into our camera to set up a nice initial orientation as shown in the example.

        To help orient the cone, we use a vtkOrientationMarkerWidget and a vtkOutlineFilter.

        "},{"location":"Cxx/Interaction/CallBack/#c","title":"C++","text":"

        There are two methodologies in C++.

        1. Create a class that inherits from vtkCallbackCommand reimplementing Execute( vtkObject *caller, unsigned long evId, void*) and setting pointers to a client and/or call data as needed. When the class is implemented, it becomes the callback function.
        2. Create a function with this signature: void f( vtkObject * caller, long unsigned int evId, void* clientData, void* callData) and, where needed, create a vtkCallbackCommand setting its callback to the function we have created.

        The example demonstrates both approaches.

        In the function PrintCameraOrientation note how we convert an array to a vector and get a comma-separated list.

        "},{"location":"Cxx/Interaction/CallBack/#python","title":"Python","text":"

        In Python the approach is even simpler. We simply define a function to use as the callback with this signature: def MyCallback(obj, ev):. Then, to pass client data to it, we simply do: MyCallback.myClientData = myClientData. This relies on the fact that Python functions are in fact objects and we are simply adding new attributes such as myClientData in this case.

        An alternative method is to define a class passsing the needed variables in the __init__ function and then implement a _call__ function that does the work.

        Both approaches are demonstrated in the example.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/CallBack/#code","title":"Code","text":"

        CallBack.cxx

        /*\nDemonstrate the use of a callback.\n\nWe also add call data.\n\n*/\n\n#include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iterator>\n#include <sstream>\n#include <vector>\n\n#define USE_CALLBACKCOMMAND_CLASS\n// Uncomment this if you want to use the function instead.\n// #undef USE_CALLBACKCOMMAND_CLASS\n\nnamespace {\nvoid PrintCameraOrientation(vtkCamera* cam);\nvoid MakeAxesActor(vtkAxesActor* axesActor);\n\n#if defined(USE_CALLBACKCOMMAND_CLASS)\n/**\nHere we inherit from vtkCallbackCommand and set pointers to any\nclient and/or call data as needed.\nWhen the class is implemented, it becomes the callback function.\n*/\nclass CameraModifiedCallback : public vtkCallbackCommand\n{\npublic:\n  static CameraModifiedCallback* New()\n  {\n    return new CameraModifiedCallback;\n  }\n  // Here we Create a vtkCallbackCommand and reimplement it.\n  void Execute(vtkObject* caller, unsigned long evId, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto interactor = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n    // Just do this to demonstrate who called callback and the event that\n    // triggered it.\n    std::cout << interactor->GetClassName() << \"  Event Id: \" << evId\n              << std::endl;\n\n    // Now print the camera orientation.\n    PrintCameraOrientation(this->cam);\n  }\n  CameraModifiedCallback() : cam(nullptr)\n  {\n  }\n  // Set pointers to any clientData or callData here.\n  vtkCamera* cam;\n\nprivate:\n  CameraModifiedCallback(const CameraModifiedCallback&) = delete;\n  void operator=(const CameraModifiedCallback&) = delete;\n};\n\n#else\n/**\nAn alternative method is to create a function with this signature:\nvoid f(vtkObject* caller, long unsigned int evId, void* clientData, void*\ncallData)\nand, where needed, create a vtkCallbackCommand setting its callback to the\nfunction we have created.\n*/\nvoid vtkCallbackFunc(vtkObject* caller, long unsigned int evId,\n                     void* clientData, void* /*callData*/)\n{\n  // Note the use of reinterpret_cast to cast the caller and callData to the\n  // expected types.\n  auto interactor = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n  std::cout << interactor->GetClassName() << \"  Event Id: \" << evId\n            << std::endl;\n  auto cam = reinterpret_cast<vtkCamera*>(clientData);\n\n  // Now print the camera orientation.\n  PrintCameraOrientation(cam);\n};\n#endif\n} // namespace\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the Renderer, RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Use a cone as a source.\n  vtkNew<vtkConeSource> source;\n  source->SetCenter(0, 0, 0);\n  source->SetRadius(1);\n  // Use the golden ratio for the height. Because we can!\n  source->SetHeight(1.6180339887498948482);\n  source->SetResolution(128);\n  source->Update();\n\n  // Pipeline\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"peacock\").GetData());\n  // Lighting\n  actor->GetProperty()->SetAmbient(0.3);\n  actor->GetProperty()->SetDiffuse(0.0);\n  actor->GetProperty()->SetSpecular(1.0);\n  actor->GetProperty()->SetSpecularPower(20.0);\n\n  // Get an outline of the data set for context.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputData(source->GetOutput());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(actor);\n\n  ren->AddActor(outlineActor);\n  ren->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n  renWin->SetSize(512, 512);\n\n  // Set up a nice camera position.\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(4.6, -2.0, 3.8);\n  camera->SetFocalPoint(0.0, 0.0, 0.0);\n  camera->SetClippingRange(3.2, 10.2);\n  camera->SetViewUp(0.3, 1.0, 0.13);\n  ren->SetActiveCamera(camera);\n\n  renWin->Render();\n  renWin->SetWindowName(\"CallBack\");\n\n  vtkNew<vtkAxesActor> axes;\n  MakeAxesActor(axes);\n  vtkNew<vtkOrientationMarkerWidget> om;\n  om->SetOrientationMarker(axes);\n  // Position lower left in the viewport.\n  om->SetViewport(0, 0, 0.2, 0.2);\n  om->SetInteractor(iren);\n  om->EnabledOn();\n  om->InteractiveOn();\n\n#if defined(USE_CALLBACKCOMMAND_CLASS)\n  // When we implement the class, it automatically becomes the callback\n  // function.\n  vtkNew<CameraModifiedCallback> getOrientation;\n  // Set the camera to use.\n  getOrientation->cam = ren->GetActiveCamera();\n#else\n  // Create the vtkCallbackCommand.\n  vtkNew<vtkCallbackCommand> getOrientation;\n  // Set the callback to the function we created.\n  getOrientation->SetCallback(vtkCallbackFunc);\n  // Set the client data.\n  getOrientation->SetClientData(ren->GetActiveCamera());\n#endif\n  iren->AddObserver(vtkCommand::EndInteractionEvent, getOrientation);\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeAxesActor(vtkAxesActor* axes)\n{\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(\"X\");\n  axes->SetYAxisLabelText(\"Y\");\n  axes->SetZAxisLabelText(\"Z\");\n  axes->SetTotalLength(1.0, 1.0, 1.0);\n  axes->SetCylinderRadius(0.5 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.025 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.5 * axes->GetSphereRadius());\n}\n\n/**\nGet a comma separated list.\n*/\ntemplate <typename T> std::string CommaSeparatedList(std::vector<T> v)\n{\n  std::ostringstream os;\n  std::copy(v.begin(), v.end() - 1, std::ostream_iterator<T>(os, \", \"));\n  os << v.back();\n  return os.str();\n}\n\n/**\nPrint the camera orientation.\n*/\nvoid PrintCameraOrientation(vtkCamera* cam)\n{\n  auto width = 16;\n  double pos[3];\n  cam->GetPosition(pos);\n  double fp[3];\n  cam->GetFocalPoint(fp);\n  double vu[3];\n  cam->GetViewUp(vu);\n  double cr[2];\n  cam->GetClippingRange(cr);\n  std::cout << setw(width) << \"Position: \"\n            << CommaSeparatedList(std::vector<double>(pos, pos + 3))\n            << std::endl;\n  std::cout << setw(width) << \"Focal point: \"\n            << CommaSeparatedList(std::vector<double>(fp, fp + 3)) << std::endl;\n  std::cout << setw(width) << \"Clipping range: \"\n            << CommaSeparatedList(std::vector<double>(cr, cr + 2)) << std::endl;\n  std::cout << setw(width) << \"View up: \"\n            << CommaSeparatedList(std::vector<double>(vu, vu + 3)) << std::endl;\n  std::cout << setw(width) << \"Distance: \" << cam->GetDistance() << std::endl;\n};\n} // namespace\n
        "},{"location":"Cxx/Interaction/CallBack/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CallBack)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CallBack: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CallBack MACOSX_BUNDLE CallBack.cxx )\n  target_link_libraries(CallBack PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CallBack\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/CallBack/#download-and-build-callback","title":"Download and Build CallBack","text":"

        Click here to download CallBack and its CMakeLists.txt file. Once the tarball CallBack.tar has been downloaded and extracted,

        cd CallBack/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CallBack\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/CallData/","title":"CallData","text":"

        vtk-examples/Cxx/Interaction/CallData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/CallData/#description","title":"Description","text":"

        This example demonstrates the use of 'calldata' in a vtkCallbackCommand. Here, we create a custom VTK filter to invoke an event to which we attach a value (the 'calldata'). We use a timer to modify and update the filter so that the event is triggered repeatedly, demonstrating the pass-via-calldata.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/CallData/#code","title":"Code","text":"

        CallData.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkInformationVector.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass vtkMyTestFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkMyTestFilter, vtkPolyDataAlgorithm);\n  static vtkMyTestFilter* New();\n\n  int RefreshEvent;\n\n  unsigned int Counter;\n\nprotected:\n  vtkMyTestFilter()\n  {\n    this->SetNumberOfInputPorts(0);\n\n    this->RefreshEvent = vtkCommand::UserEvent + 1;\n\n    this->Counter = 0;\n  }\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*)\n  {\n    this->InvokeEvent(this->RefreshEvent, &this->Counter);\n    this->Counter++;\n    return 1;\n  }\n\nprivate:\n  vtkMyTestFilter(const vtkMyTestFilter&) = delete;\n  void operator=(const vtkMyTestFilter&) = delete;\n};\n\nvtkStandardNewMacro(vtkMyTestFilter);\n\nvoid CallbackFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\nclass vtkTimerCallback : public vtkCommand\n{\npublic:\n  static vtkTimerCallback* New()\n  {\n    vtkTimerCallback* cb = new vtkTimerCallback;\n\n    return cb;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long vtkNotUsed(eventId),\n                       void* vtkNotUsed(callData))\n  {\n    TestFilter->Modified();\n    TestFilter->Update();\n    auto iren = vtkRenderWindowInteractor::SafeDownCast(caller);\n    if (TestFilter->Counter > 10)\n    {\n      std::cout << \"Timer Destroyed: \" << iren->DestroyTimer(this->timerId)\n                << endl;\n    }\n  }\n\n  int timerId;\n\n  vtkMyTestFilter* TestFilter;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Add an object to make the scene interesting\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Goldenrod\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkMyTestFilter> testFilter;\n\n  vtkNew<vtkCallbackCommand> callback;\n  callback->SetCallback(CallbackFunction);\n  testFilter->AddObserver(testFilter->RefreshEvent, callback);\n  testFilter->Update();\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetWindowName(\"CallData\");\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  // Sign up to receive TimerEvent.\n  vtkNew<vtkTimerCallback> timerCallback;\n  timerCallback->TestFilter = testFilter;\n\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, timerCallback);\n  timerCallback->timerId = renderWindowInteractor->CreateRepeatingTimer(100);\n  std::cout << \"timerId: \" << timerCallback->timerId << std::endl;\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CallbackFunction(vtkObject* vtkNotUsed(caller),\n                      long unsigned int vtkNotUsed(eventId),\n                      void* vtkNotUsed(clientData), void* callData)\n{\n  unsigned int* callDataCasted = reinterpret_cast<unsigned int*>(callData);\n  std::cout << *callDataCasted << std::endl;\n}\n} // namespace\n
        "},{"location":"Cxx/Interaction/CallData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CallData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CallData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CallData MACOSX_BUNDLE CallData.cxx )\n  target_link_libraries(CallData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CallData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/CallData/#download-and-build-calldata","title":"Download and Build CallData","text":"

        Click here to download CallData and its CMakeLists.txt file. Once the tarball CallData.tar has been downloaded and extracted,

        cd CallData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CallData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/ClientData/","title":"ClientData","text":"

        vtk-examples/Cxx/Interaction/ClientData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/ClientData/#code","title":"Code","text":"

        ClientData.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                              void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Goldenrod\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCallbackCommand> keypressCallback;\n\n  // Allow the observer to access the sphereSource\n  keypressCallback->SetClientData(sphereSource);\n  keypressCallback->SetCallback(KeypressCallbackFunction);\n  renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent,\n                                      keypressCallback);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetWindowName(\"ClientData\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject*, long unsigned int vtkNotUsed(eventId),\n                              void* clientData, void* vtkNotUsed(callData))\n{\n  // Prove that we can access the sphere source\n  auto sphereSource = static_cast<vtkSphereSource*>(clientData);\n  std::cout << \"Radius is \" << sphereSource->GetRadius() << std::endl;\n}\n} // namespace\n
        "},{"location":"Cxx/Interaction/ClientData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClientData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClientData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClientData MACOSX_BUNDLE ClientData.cxx )\n  target_link_libraries(ClientData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClientData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/ClientData/#download-and-build-clientdata","title":"Download and Build ClientData","text":"

        Click here to download ClientData and its CMakeLists.txt file. Once the tarball ClientData.tar has been downloaded and extracted,

        cd ClientData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClientData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/DoubleClick/","title":"DoubleClick","text":"

        vtk-examples/Cxx/Interaction/DoubleClick

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/DoubleClick/#code","title":"Code","text":"

        DoubleClick.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// Define interaction style\nclass MouseInteractorStyleDoubleClick : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorStyleDoubleClick* New();\n  vtkTypeMacro(MouseInteractorStyleDoubleClick,\n               vtkInteractorStyleTrackballCamera);\n\n  MouseInteractorStyleDoubleClick() : NumberOfClicks(0), ResetPixelDistance(5)\n  {\n    this->PreviousPosition[0] = 0;\n    this->PreviousPosition[1] = 0;\n  }\n\n  virtual void OnLeftButtonDown() override\n  {\n    this->NumberOfClicks++;\n    int pickPosition[2];\n    this->GetInteractor()->GetEventPosition(pickPosition);\n\n    int xdist = pickPosition[0] - this->PreviousPosition[0];\n    int ydist = pickPosition[1] - this->PreviousPosition[1];\n\n    this->PreviousPosition[0] = pickPosition[0];\n    this->PreviousPosition[1] = pickPosition[1];\n\n    int moveDistance = (int)sqrt((double)(xdist * xdist + ydist * ydist));\n\n    // Reset numClicks - If mouse moved further than resetPixelDistance.\n    if (moveDistance > this->ResetPixelDistance)\n    {\n      this->NumberOfClicks = 1;\n    }\n\n    if (this->NumberOfClicks == 2)\n    {\n      std::cout << \"Double clicked.\" << std::endl;\n      this->NumberOfClicks = 0;\n    }\n\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n\nprivate:\n  unsigned int NumberOfClicks;\n  int PreviousPosition[2];\n  int ResetPixelDistance;\n};\nvtkStandardNewMacro(MouseInteractorStyleDoubleClick);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<MouseInteractorStyleDoubleClick> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindow->SetWindowName(\"DoubleClick\");\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/DoubleClick/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DoubleClick)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DoubleClick: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DoubleClick MACOSX_BUNDLE DoubleClick.cxx )\n  target_link_libraries(DoubleClick PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DoubleClick\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/DoubleClick/#download-and-build-doubleclick","title":"Download and Build DoubleClick","text":"

        Click here to download DoubleClick and its CMakeLists.txt file. Once the tarball DoubleClick.tar has been downloaded and extracted,

        cd DoubleClick/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DoubleClick\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/EllipticalButton/","title":"EllipticalButton","text":"

        vtk-examples/Cxx/Interaction/EllipticalButton

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/EllipticalButton/#description","title":"Description","text":"

        This example creates a 3D button using vtkEllipsoidalButton. Interaction is done by assigning the button to a vtkProp3DButtonRepresentation. Then a callback for a vtkButtonWidget controls the color of the button and the displayed geometry. Click on the button to see the color of both the button and geometry change.

        Warning

        There is a bug in vtkEllipticalButtonSource. If CircumferentialResolution is odd, improper geometry is created.

        Warning

        Values close to 1.0 for RadialRatio can cause shading artifacts at the corners of the button.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/EllipticalButton/#code","title":"Code","text":"

        EllipticalButton.cxx

        #include <vtkActor.h>\n#include <vtkButtonWidget.h>\n#include <vtkCommand.h>\n#include <vtkEllipticalButtonSource.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProp3DButtonRepresentation.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTexture.h>\n\n// Callback for the interaction.\nnamespace {\n\nclass vtkButtonCallback : public vtkCommand\n{\npublic:\n  static vtkButtonCallback* New()\n  {\n    return new vtkButtonCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    auto buttonWidget = reinterpret_cast<vtkButtonWidget*>(caller);\n    auto rep = reinterpret_cast<vtkProp3DButtonRepresentation*>(\n        buttonWidget->GetRepresentation());\n    int state = rep->GetState();\n    this->Actor->GetProperty()->SetColor(\n        reinterpret_cast<vtkActor*>(rep->GetButtonProp(state))\n            ->GetProperty()\n            ->GetColor());\n    std::cout << \"State: \" << state << \"\\n\";\n  }\n\n  vtkButtonCallback() : Actor(0)\n  {\n  }\n\n  vtkActor* Actor;\n};\n\nvtkSmartPointer<vtkActor> CreateButtonActor(const char* textureFile);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" imageFilename e.g. YinYang.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkSuperquadricSource> source;\n  source->SetPhiResolution(64);\n  source->SetThetaResolution(64);\n  source->SetThetaRoundness(1.5);\n  source->SetThickness(1.5);\n  source->SetSize(2);\n  source->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(color->GetColor3d(\"Burlywood\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(200, 200);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"EllipticalButton\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create the widget and its representation\n  vtkSmartPointer<vtkActor> buttonActor1 = CreateButtonActor(argv[1]);\n  buttonActor1->GetProperty()->SetColor(color->GetColor3d(\"Tomato\").GetData());\n  vtkSmartPointer<vtkActor> buttonActor2 = CreateButtonActor(argv[1]);\n  buttonActor2->GetProperty()->SetColor(color->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkProp3DButtonRepresentation> buttonRepresentation;\n  buttonRepresentation->SetNumberOfStates(2);\n  buttonRepresentation->SetButtonProp(0, buttonActor1);\n  buttonRepresentation->SetButtonProp(1, buttonActor2);\n  buttonRepresentation->FollowCameraOn();\n\n  vtkNew<vtkButtonCallback> callback;\n  callback->Actor = actor;\n  actor->GetProperty()->SetColor(\n      reinterpret_cast<vtkActor*>(buttonRepresentation->GetButtonProp(0))\n          ->GetProperty()\n          ->GetColor());\n\n  renderWindowInteractor->Initialize();\n\n  vtkNew<vtkButtonWidget> buttonWidget;\n  buttonWidget->SetInteractor(renderWindowInteractor);\n  buttonWidget->SetRepresentation(buttonRepresentation);\n  buttonWidget->AddObserver(vtkCommand::StateChangedEvent, callback);\n  buttonWidget->SetEnabled(1);\n\n  renderer->ResetCamera();\n  renderer->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> CreateButtonActor(const char* textureFile)\n{\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imageReader;\n  imageReader.TakeReference(readerFactory->CreateImageReader2(textureFile));\n  imageReader->SetFileName(textureFile);\n  imageReader->Update();\n\n  // Aspect ratio of image\n  int dims[3];\n  imageReader->GetOutput()->GetDimensions(dims);\n  double aspect = static_cast<double>(dims[0]) / static_cast<double>(dims[1]);\n\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(imageReader->GetOutputPort());\n\n  vtkNew<vtkEllipticalButtonSource> ellipticalButtonSource;\n  ellipticalButtonSource->SetCircumferentialResolution(50);\n  ellipticalButtonSource->SetShoulderResolution(10);\n  ellipticalButtonSource->SetTextureResolution(10);\n  ellipticalButtonSource->SetRadialRatio(1.05);\n  ellipticalButtonSource->SetShoulderTextureCoordinate(0.0, 0.0);\n  ellipticalButtonSource->SetTextureDimensions(dims[0], dims[1]);\n  ellipticalButtonSource->SetTextureStyleToProportional();\n  ellipticalButtonSource->TwoSidedOn();\n  ellipticalButtonSource->SetWidth(aspect);\n  ellipticalButtonSource->SetHeight(1.0);\n  ellipticalButtonSource->SetDepth(.15);\n  ellipticalButtonSource->SetCenter(2, 2, 0);\n\n  ellipticalButtonSource->SetOutputPointsPrecision(\n      vtkAlgorithm::SINGLE_PRECISION);\n\n  vtkNew<vtkPolyDataMapper> buttonMapper;\n  buttonMapper->SetInputConnection(ellipticalButtonSource->GetOutputPort());\n\n  vtkNew<vtkActor> buttonActor;\n  buttonActor->SetMapper(buttonMapper);\n  buttonActor->SetTexture(texture);\n\n  return buttonActor;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Interaction/EllipticalButton/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EllipticalButton)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOImage\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EllipticalButton: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EllipticalButton MACOSX_BUNDLE EllipticalButton.cxx )\n  target_link_libraries(EllipticalButton PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EllipticalButton\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/EllipticalButton/#download-and-build-ellipticalbutton","title":"Download and Build EllipticalButton","text":"

        Click here to download EllipticalButton and its CMakeLists.txt file. Once the tarball EllipticalButton.tar has been downloaded and extracted,

        cd EllipticalButton/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./EllipticalButton\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/Game/","title":"Game","text":"

        vtk-examples/Cxx/Interaction/Game

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/Game/#code","title":"Code","text":"

        Game.cxx

        // Demonstrate moving pieces and \"snapping\".\n\n#include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSelectEnclosedPoints.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\nnamespace {\n\n// Define interaction style.\nclass MouseInteractorStyle6 : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static MouseInteractorStyle6* New();\n  vtkTypeMacro(MouseInteractorStyle6, vtkInteractorStyleTrackballActor);\n\n  virtual void OnLeftButtonDown() override\n  {\n    std::cout << \"Pressed left mouse button.\" << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnLeftButtonDown();\n  }\n\n  virtual void OnMiddleButtonUp() override\n  {\n    // std::cout << \"Pressed middle mouse button.\" << std::endl;\n\n    int x = this->Interactor->GetEventPosition()[0];\n    int y = this->Interactor->GetEventPosition()[1];\n    this->FindPokedRenderer(x, y);\n    this->FindPickedActor(x, y);\n\n    if (this->CurrentRenderer == NULL || this->InteractionProp == NULL)\n    {\n      std::cout << \"Nothing selected.\" << std::endl;\n      return;\n    }\n\n    vtkNew<vtkPropCollection> actors;\n\n    this->InteractionProp->GetActors(actors);\n    actors->InitTraversal();\n    vtkActor* actor = dynamic_cast<vtkActor*>(actors->GetNextProp());\n\n    vtkPolyData* polydata =\n        dynamic_cast<vtkPolyData*>(actor->GetMapper()->GetInputAsDataSet());\n\n    vtkNew<vtkTransform> transform;\n    transform->SetMatrix(actor->GetMatrix());\n\n    vtkNew<vtkTransformPolyDataFilter> transformPolyData;\n    transformPolyData->SetInputData(polydata);\n    transformPolyData->SetTransform(transform);\n    transformPolyData->Update();\n\n    vtkNew<vtkSelectEnclosedPoints> selectEnclosedPoints;\n    selectEnclosedPoints->SetInputConnection(\n        transformPolyData->GetOutputPort());\n    selectEnclosedPoints->SetSurfaceData(this->Sphere);\n    selectEnclosedPoints->Update();\n\n    vtkDataArray* insideArray = dynamic_cast<vtkDataArray*>(\n        selectEnclosedPoints->GetOutput()->GetPointData()->GetArray(\n            \"SelectedPoints\"));\n\n    bool inside = false;\n    for (vtkIdType i = 0; i < insideArray->GetNumberOfTuples(); i++)\n    {\n      if (insideArray->GetComponent(i, 0) == 1)\n      {\n        inside = true;\n        break;\n      }\n    }\n\n    if (inside)\n    {\n      std::cout << \"A point of the cube is inside the sphere!\" << std::endl;\n      // Reset the cube to its original position.\n      // this->CubeActor->GetMatrix()->Identity();\n      // this->CubeActor->SetOrigin(0,0,0);\n      this->CubeActor->SetPosition(0, 0, 0);\n      this->CubeActor->SetOrientation(0, 0, 0);\n\n      this->Interactor->GetRenderWindow()\n          ->GetRenderers()\n          ->GetFirstRenderer()\n          ->Render();\n      this->Interactor->GetRenderWindow()->Render();\n    }\n\n    // Release interaction\n    this->StopState();\n  }\n\n  virtual void OnRightButtonDown() override\n  {\n    std::cout << \"Pressed right mouse button.\" << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnRightButtonDown();\n  }\n\n  vtkPolyData* Sphere = nullptr;\n  vtkActor* CubeActor = nullptr;\n};\nvtkStandardNewMacro(MouseInteractorStyle6);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(2);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(color->GetColor3d(\"Tomato\").GetData());\n\n  // Cube\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetCenter(5.0, 0.0, 0.0);\n  cubeSource->Update();\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(color->GetColor3d(\"DodgerBlue\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Game\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(cubeActor);\n  renderer->SetBackground(color->GetColor3d(\"Burlywood\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<MouseInteractorStyle6> style;\n  style->Sphere = sphereSource->GetOutput();\n  style->CubeActor = cubeActor;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/Game/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Game)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Game: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Game MACOSX_BUNDLE Game.cxx )\n  target_link_libraries(Game PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Game\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/Game/#download-and-build-game","title":"Download and Build Game","text":"

        Click here to download Game and its CMakeLists.txt file. Once the tarball Game.tar has been downloaded and extracted,

        cd Game/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Game\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/ImageClip/","title":"ImageClip","text":"

        vtk-examples/Cxx/Interaction/ImageClip

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/ImageClip/#description","title":"Description","text":"

        This example loads an image into the left half of the window. When you move the border widget (the green square in the bottom left corner) over the image, the region that is selected is displayed in the right half of the window.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/ImageClip/#code","title":"Code","text":"

        ImageClip.cxx

        #include <vtkBorderRepresentation.h>\n#include <vtkBorderWidget.h>\n#include <vtkCommand.h>\n#include <vtkImageActor.h>\n#include <vtkImageClip.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInformation.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkJPEGReader.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\n#include <string>\n\nnamespace {\n\nclass vtkBorderCallback2 : public vtkCommand\n{\npublic:\n  vtkBorderCallback2()\n  {\n  }\n\n  static vtkBorderCallback2* New()\n  {\n    return new vtkBorderCallback2;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n\n    vtkBorderWidget* borderWidget = reinterpret_cast<vtkBorderWidget*>(caller);\n\n    // Get the world coordinates of the two corners of the box.\n    auto lowerLeftCoordinate =\n        static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n            ->GetPositionCoordinate();\n    auto lowerLeft =\n        lowerLeftCoordinate->GetComputedWorldValue(this->LeftRenderer);\n    std::cout << \"Lower left coordinate: \" << lowerLeft[0] << \", \"\n              << lowerLeft[1] << \", \" << lowerLeft[2] << std::endl;\n\n    auto upperRightCoordinate =\n        static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n            ->GetPosition2Coordinate();\n    auto upperRight =\n        upperRightCoordinate->GetComputedWorldValue(this->LeftRenderer);\n    std::cout << \"Upper right coordinate: \" << upperRight[0] << \", \"\n              << upperRight[1] << \", \" << upperRight[2] << std::endl;\n\n    double* bounds = this->ImageActor->GetBounds();\n    double xmin = bounds[0];\n    double xmax = bounds[1];\n    double ymin = bounds[2];\n    double ymax = bounds[3];\n\n    if ((lowerLeft[0] > xmin) && (upperRight[0] < xmax) &&\n        (lowerLeft[1] > ymin) && (upperRight[1] < ymax))\n    {\n      this->ClipFilter->SetOutputWholeExtent(\n          vtkMath::Round(lowerLeft[0]), vtkMath::Round(upperRight[0]),\n          vtkMath::Round(lowerLeft[1]), vtkMath::Round(upperRight[1]), 0, 1);\n    }\n    else\n    {\n      std::cout << \"box is NOT inside image\" << std::endl;\n    }\n  }\n\n  void SetLeftRenderer(vtkSmartPointer<vtkRenderer> renderer)\n  {\n    this->LeftRenderer = renderer;\n  }\n  void SetImageActor(vtkSmartPointer<vtkImageActor> actor)\n  {\n    this->ImageActor = actor;\n  }\n  void SetClipFilter(vtkSmartPointer<vtkImageClip> clip)\n  {\n    this->ClipFilter = clip;\n  }\n\nprivate:\n  vtkSmartPointer<vtkRenderer> LeftRenderer;\n  vtkSmartPointer<vtkImageActor> ImageActor;\n  vtkSmartPointer<vtkImageClip> ClipFilter;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  // Parse input arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.jpg) e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n\n  // Read the image.\n  vtkNew<vtkJPEGReader> jPEGReader;\n\n  if (!jPEGReader->CanReadFile(inputFilename.c_str()))\n  {\n    std::cout << \"Error: cannot read \" << inputFilename << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  jPEGReader->SetFileName(inputFilename.c_str());\n  jPEGReader->Update();\n\n  int extent[6];\n  jPEGReader->GetOutput()->GetExtent(extent);\n  // xmin, xmax, ymin, ymax\n  // std::cout << \"extent: \" << extent[0] << \" \" << extent[1] << \" \" <<\n  // extent[2] << \" \" <<  extent[3] << \" \" <<  extent[4] << \" \" <<\n  // extent[5] << std::endl;\n\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputConnection(jPEGReader->GetOutputPort());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  vtkNew<vtkBorderWidget> borderWidget;\n  borderWidget->SetInteractor(interactor);\n  static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n      ->GetBorderProperty()\n      ->SetColor(color->GetColor3d(\"Lime\").GetData());\n  borderWidget->SelectableOff();\n\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges in normalized coordinates.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(color->GetColor3d(\"DarkSlateGray\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(color->GetColor3d(\"DimGray\").GetData());\n\n  leftRenderer->AddActor(imageActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  vtkNew<vtkImageClip> imageClip;\n  imageClip->SetInputConnection(jPEGReader->GetOutputPort());\n  jPEGReader->UpdateInformation();\n  imageClip->SetOutputWholeExtent(jPEGReader->GetOutputInformation(0)->Get(\n      vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));\n  imageClip->ClipDataOn();\n\n  vtkNew<vtkImageActor> clipActor;\n  clipActor->GetMapper()->SetInputConnection(imageClip->GetOutputPort());\n\n  rightRenderer->AddActor(clipActor);\n\n  vtkNew<vtkBorderCallback2> borderCallback;\n  borderCallback->SetLeftRenderer(leftRenderer);\n  borderCallback->SetImageActor(imageActor);\n  borderCallback->SetClipFilter(imageClip);\n\n  borderWidget->AddObserver(vtkCommand::InteractionEvent, borderCallback);\n\n  renderWindow->SetWindowName(\"ImageClip\");\n  renderWindow->Render();\n  borderWidget->On();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/ImageClip/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageClip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonExecutionModel\n  IOImage\n  ImagingCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageClip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageClip MACOSX_BUNDLE ImageClip.cxx )\n  target_link_libraries(ImageClip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageClip\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/ImageClip/#download-and-build-imageclip","title":"Download and Build ImageClip","text":"

        Click here to download ImageClip and its CMakeLists.txt file. Once the tarball ImageClip.tar has been downloaded and extracted,

        cd ImageClip/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageClip\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/ImageRegion/","title":"ImageRegion","text":"

        vtk-examples/Cxx/Interaction/ImageRegion

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/ImageRegion/#description","title":"Description","text":"

        This example shows how to get the image coordinates of the corners of a BorderWidget.

        It currently says the pick for the lower left corner of the border widget is valid even when it is off the image.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/ImageRegion/#code","title":"Code","text":"

        ImageRegion.cxx

        #include <vtkAssemblyNode.h>\n#include <vtkAssemblyPath.h>\n#include <vtkBorderRepresentation.h>\n#include <vtkBorderWidget.h>\n#include <vtkCommand.h>\n#include <vtkCoordinate.h>\n#include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPropPicker.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\nclass vtkBorderCallback : public vtkCommand\n{\npublic:\n  vtkBorderCallback()\n  {\n  }\n\n  static vtkBorderCallback* New()\n  {\n    return new vtkBorderCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkBorderWidget* borderWidget = reinterpret_cast<vtkBorderWidget*>(caller);\n\n    // Get the display coordinates of the two corners of the box\n    vtkCoordinate* lowerLeftCoordinate =\n        static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n            ->GetPositionCoordinate();\n    double* lowerLeft;\n    lowerLeft = lowerLeftCoordinate->GetComputedWorldValue(this->Renderer);\n    std::cout << \"Lower left coordinate: \" << lowerLeft[0] << \", \"\n              << lowerLeft[1] << std::endl;\n    lowerLeft[2] = 0;\n\n    vtkCoordinate* upperRightCoordinate =\n        static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n            ->GetPosition2Coordinate();\n    double* upperRight;\n    upperRight = upperRightCoordinate->GetComputedWorldValue(this->Renderer);\n    std::cout << \"Upper right coordinate: \" << upperRight[0] << \", \"\n              << upperRight[1] << std::endl;\n    upperRight[2] = 0;\n\n    // Pick at the two corners of the box.\n    vtkSmartPointer<vtkPropPicker> picker =\n        vtkSmartPointer<vtkPropPicker>::New();\n\n    //    int valid1 = picker->Pick( lowerLeft[0],\n    picker->Pick(lowerLeft[0], lowerLeft[1], 0.0, this->Renderer);\n\n    vtkAssemblyPath* path = picker->GetPath();\n\n    vtkProp* pickedProp = NULL;\n\n    bool validPick = false;\n    if (path)\n    {\n      std::cout << \"There are \" << path->GetNumberOfItems()\n                << \" items in the path.\" << std::endl;\n      vtkCollectionSimpleIterator sit;\n      path->InitTraversal(sit);\n      vtkAssemblyNode* node;\n      for (int i = 0; i < path->GetNumberOfItems(); ++i)\n      {\n        node = path->GetNextNode(sit);\n        pickedProp = node->GetViewProp();\n        if (this->ImageActor == dynamic_cast<vtkImageActor*>(pickedProp))\n        {\n          std::cout << \"Correct actor picked.\" << std::endl;\n          validPick = true;\n          break;\n        }\n      }\n    }\n\n    if (!validPick)\n    {\n      std::cout << \"Off Image\" << std::endl;\n    }\n    else\n    {\n      double pos1[3];\n      picker->GetPickPosition(pos1);\n      std::cout << \"Lower Left Pick: \" << pos1[0] << \" \" << pos1[1]\n                << std::endl;\n    }\n    /*\n      if(valid1 != 0)\n        {\n        std::cout << \"Valid1: \" << valid1 << std::endl;\n        double pos1[3];\n        picker->GetPickPosition( pos1 );\n        std::cout << \"Lower Left Pick: \" << pos1[0] << \" \" << pos1[1] <<\n      std::endl;\n        }\n      else\n        {\n        std::cout << \"Left - nothing was picked\" << std::endl;\n        }\n      */\n\n    /*\n    int valid2 = picker->Pick( upperRight[0],\n                  upperRight[1], 0.0, this->Renderer );\n    if(valid2 != 0)\n      {\n      std::cout << \"Valid2: \" << valid2 << std::endl;\n      double pos2[3];\n      picker->GetPickPosition( pos2 );\n      std::cout << \"Upper right Pick: \" << pos2[0] << \" \" << pos2[1] <<\n    std::endl;\n      }\n    else\n      {\n      std::cout << \"Right - nothing was picked\" << std::endl;\n      }\n    */\n    std::cout << std::endl;\n  }\n\n  void SetRenderer(vtkSmartPointer<vtkRenderer> ren)\n  {\n    this->Renderer = ren;\n  }\n  void SetImageActor(vtkSmartPointer<vtkImageActor> im)\n  {\n    this->ImageActor = im;\n  }\n\nprivate:\n  vtkSmartPointer<vtkRenderer> Renderer;\n  vtkSmartPointer<vtkImageActor> ImageActor;\n};\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  // Parse input arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.jpg) e.g. Gourds2.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string InputFilename = argv[1];\n\n  // Read the image\n  vtkNew<vtkJPEGReader> jPEGReader;\n  jPEGReader->SetFileName(InputFilename.c_str());\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(jPEGReader->GetOutputPort());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleImage> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkBorderWidget> borderWidget;\n  borderWidget->SetInteractor(renderWindowInteractor);\n  static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n      ->GetBorderProperty()\n      ->SetColor(color->GetColor3d(\"Lime\").GetData());\n  borderWidget->SelectableOff();\n\n  vtkNew<vtkBorderCallback> borderCallback;\n  borderCallback->SetRenderer(renderer);\n  borderCallback->SetImageActor(actor);\n\n  borderWidget->AddObserver(vtkCommand::InteractionEvent, borderCallback);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(color->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->SetWindowName(\"ImageRegion\");\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  borderWidget->On();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/ImageRegion/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageRegion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageRegion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageRegion MACOSX_BUNDLE ImageRegion.cxx )\n  target_link_libraries(ImageRegion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageRegion\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/ImageRegion/#download-and-build-imageregion","title":"Download and Build ImageRegion","text":"

        Click here to download ImageRegion and its CMakeLists.txt file. Once the tarball ImageRegion.tar has been downloaded and extracted,

        cd ImageRegion/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageRegion\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/InteractorStyleTerrain/","title":"InteractorStyleTerrain","text":"

        vtk-examples/Cxx/Interaction/InteractorStyleTerrain

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/InteractorStyleTerrain/#code","title":"Code","text":"

        InteractorStyleTerrain.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTerrain.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"InteractorStyleTerrain\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTerrain> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/InteractorStyleTerrain/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InteractorStyleTerrain)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InteractorStyleTerrain: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InteractorStyleTerrain MACOSX_BUNDLE InteractorStyleTerrain.cxx )\n  target_link_libraries(InteractorStyleTerrain PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InteractorStyleTerrain\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/InteractorStyleTerrain/#download-and-build-interactorstyleterrain","title":"Download and Build InteractorStyleTerrain","text":"

        Click here to download InteractorStyleTerrain and its CMakeLists.txt file. Once the tarball InteractorStyleTerrain.tar has been downloaded and extracted,

        cd InteractorStyleTerrain/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./InteractorStyleTerrain\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/InteractorStyleUser/","title":"InteractorStyleUser","text":"

        vtk-examples/Cxx/Interaction/InteractorStyleUser

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/InteractorStyleUser/#description","title":"Description","text":"

        This style is designed to NOT provide any default functionality. You must specify how to handle every event that you want handled.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/InteractorStyleUser/#code","title":"Code","text":"

        InteractorStyleUser.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkInteractorStyleUser.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid ClickCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                           void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"InteractorStyleUser\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<vtkCallbackCommand> clickCallback;\n  clickCallback->SetCallback(ClickCallbackFunction);\n\n  renderWindowInteractor->AddObserver(vtkCommand::LeftButtonPressEvent,\n                                      clickCallback);\n\n  vtkNew<vtkInteractorStyleUser> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid ClickCallbackFunction(vtkObject*, long unsigned int, void*, void*)\n{\n  std::cout << \"Click callback\" << std::endl;\n\n  // We can get the calling object like this:\n  // vtkRenderWindowInteractor *iren =\n  //  static_cast<vtkRenderWindowInteractor*>(caller);\n}\n\n} // namespace\n
        "},{"location":"Cxx/Interaction/InteractorStyleUser/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InteractorStyleUser)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InteractorStyleUser: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InteractorStyleUser MACOSX_BUNDLE InteractorStyleUser.cxx )\n  target_link_libraries(InteractorStyleUser PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InteractorStyleUser\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/InteractorStyleUser/#download-and-build-interactorstyleuser","title":"Download and Build InteractorStyleUser","text":"

        Click here to download InteractorStyleUser and its CMakeLists.txt file. Once the tarball InteractorStyleUser.tar has been downloaded and extracted,

        cd InteractorStyleUser/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./InteractorStyleUser\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/KeypressEvents/","title":"KeypressEvents","text":"

        vtk-examples/Cxx/Interaction/KeypressEvents

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/KeypressEvents/#description","title":"Description","text":"

        This example shows how to catch keypress events. For example, do something if the user presses the 's' key.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/KeypressEvents/#code","title":"Code","text":"

        KeypressEvents.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Define interaction style.\nclass KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static KeyPressInteractorStyle* New();\n  vtkTypeMacro(KeyPressInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnKeyPress() override\n  {\n    // Get the keypress.\n    vtkRenderWindowInteractor* rwi = this->Interactor;\n    std::string key = rwi->GetKeySym();\n\n    // Output the key that was pressed.\n    std::cout << \"Pressed \" << key << std::endl;\n\n    // Handle an arrow key.\n    if (key == \"Up\")\n    {\n      std::cout << \"The up arrow was pressed.\" << std::endl;\n    }\n\n    // Handle a \"normal\" key.\n    if (key == \"a\")\n    {\n      std::cout << \"The a key was pressed.\" << std::endl;\n    }\n\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnKeyPress();\n  }\n};\nvtkStandardNewMacro(KeyPressInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"KeypressEvents\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<KeyPressInteractorStyle> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->SetCurrentRenderer(renderer);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/KeypressEvents/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KeypressEvents)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KeypressEvents: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KeypressEvents MACOSX_BUNDLE KeypressEvents.cxx )\n  target_link_libraries(KeypressEvents PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KeypressEvents\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/KeypressEvents/#download-and-build-keypressevents","title":"Download and Build KeypressEvents","text":"

        Click here to download KeypressEvents and its CMakeLists.txt file. Once the tarball KeypressEvents.tar has been downloaded and extracted,

        cd KeypressEvents/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KeypressEvents\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/KeypressObserver/","title":"KeypressObserver","text":"

        vtk-examples/Cxx/Interaction/KeypressObserver

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/KeypressObserver/#code","title":"Code","text":"

        KeypressObserver.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nvoid KeypressCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                              void* clientData, void* callData);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"KeypressObserver\");\n\n  vtkNew<vtkCallbackCommand> keypressCallback;\n  keypressCallback->SetCallback(KeypressCallbackFunction);\n  renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent,\n                                      keypressCallback);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid KeypressCallbackFunction(vtkObject* caller,\n                              long unsigned int vtkNotUsed(eventId),\n                              void* vtkNotUsed(clientData),\n                              void* vtkNotUsed(callData))\n{\n  std::cout << \"Keypress callback\" << std::endl;\n\n  vtkRenderWindowInteractor* iren =\n      static_cast<vtkRenderWindowInteractor*>(caller);\n\n  std::cout << \"Pressed: \" << iren->GetKeySym() << std::endl;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Interaction/KeypressObserver/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KeypressObserver)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KeypressObserver: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KeypressObserver MACOSX_BUNDLE KeypressObserver.cxx )\n  target_link_libraries(KeypressObserver PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KeypressObserver\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/KeypressObserver/#download-and-build-keypressobserver","title":"Download and Build KeypressObserver","text":"

        Click here to download KeypressObserver and its CMakeLists.txt file. Once the tarball KeypressObserver.tar has been downloaded and extracted,

        cd KeypressObserver/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KeypressObserver\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/MouseEvents/","title":"MouseEvents","text":"

        vtk-examples/Cxx/Interaction/MouseEvents

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/MouseEvents/#description","title":"Description","text":"

        This example shows how to subclass an interactor style to implement custom behaviors.

        See MouseEventsObserver for a different approach that uses an existing interactor style class and adds an event observer to it.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/MouseEvents/#code","title":"Code","text":"

        MouseEvents.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Define interaction style.\nclass customMouseInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static customMouseInteractorStyle* New();\n  vtkTypeMacro(customMouseInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnLeftButtonDown() override\n  {\n    std::cout << \"Pressed left mouse button.\" << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n\n  virtual void OnMiddleButtonDown() override\n  {\n    std::cout << \"Pressed middle mouse button.\" << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();\n  }\n\n  virtual void OnRightButtonDown() override\n  {\n    std::cout << \"Pressed right mouse button.\" << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnRightButtonDown();\n  }\n};\n\nvtkStandardNewMacro(customMouseInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MouseEvents\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<customMouseInteractorStyle> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/MouseEvents/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MouseEvents)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MouseEvents: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MouseEvents MACOSX_BUNDLE MouseEvents.cxx )\n  target_link_libraries(MouseEvents PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MouseEvents\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/MouseEvents/#download-and-build-mouseevents","title":"Download and Build MouseEvents","text":"

        Click here to download MouseEvents and its CMakeLists.txt file. Once the tarball MouseEvents.tar has been downloaded and extracted,

        cd MouseEvents/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MouseEvents\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/MouseEventsObserver/","title":"MouseEventsObserver","text":"

        vtk-examples/Cxx/Interaction/MouseEventsObserver

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/MouseEventsObserver/#description","title":"Description","text":"

        This example shows how to add an event observer to an existing style class.

        See MouseEvents for a different approach that subclasses an existin interactor style to implement custom behaviors.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/MouseEventsObserver/#code","title":"Code","text":"

        MouseEventsObserver.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nvoid ClickCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                           void* clientData, void* callData);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MouseEventsObserver\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCallbackCommand> clickCallback;\n  clickCallback->SetCallback(ClickCallbackFunction);\n\n  renderWindowInteractor->AddObserver(vtkCommand::LeftButtonPressEvent,\n                                      clickCallback);\n  renderWindowInteractor->AddObserver(vtkCommand::RightButtonPressEvent,\n                                      clickCallback);\n  renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent, clickCallback);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid ClickCallbackFunction(vtkObject* vtkNotUsed(caller),\n                           long unsigned int eventId,\n                           void* vtkNotUsed(clientData),\n                           void* vtkNotUsed(callData))\n{\n  std::cout << \"Click callback\" << std::endl;\n  std::cout << \"Event: \" << vtkCommand::GetStringFromEventId(eventId)\n            << std::endl;\n\n  // Get the interactor like this:\n  // auto* iren = static_cast<vtkRenderWindowInteractor*>(caller);\n}\n\n} // namespace\n
        "},{"location":"Cxx/Interaction/MouseEventsObserver/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MouseEventsObserver)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MouseEventsObserver: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MouseEventsObserver MACOSX_BUNDLE MouseEventsObserver.cxx )\n  target_link_libraries(MouseEventsObserver PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MouseEventsObserver\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/MouseEventsObserver/#download-and-build-mouseeventsobserver","title":"Download and Build MouseEventsObserver","text":"

        Click here to download MouseEventsObserver and its CMakeLists.txt file. Once the tarball MouseEventsObserver.tar has been downloaded and extracted,

        cd MouseEventsObserver/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MouseEventsObserver\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/MoveAGlyph/","title":"MoveAGlyph","text":"

        vtk-examples/Cxx/Interaction/MoveAGlyph

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/MoveAGlyph/#description","title":"Description","text":"

        This example allows the user to reposition a glyph. It does this by faking the interactor into thinking that a new actor (MoveActor) is the object to be interacted with. We use the array generated by glyph3D->GeneratePointIdsOn() to determine the point associated with the glyph that the user selected. A \"ghost\" actor of the selected glyph is generated (because all of the glyphs are part of the same actor, so they would all move together). This actor is moved, and its final position is used to update the point in the original data set.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/MoveAGlyph/#code","title":"Code","text":"

        MoveAGlyph.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellPicker.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Define interaction style.\nclass InteractorStyleMoveGlyph : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static InteractorStyleMoveGlyph* New();\n  vtkTypeMacro(InteractorStyleMoveGlyph, vtkInteractorStyleTrackballActor);\n\n  InteractorStyleMoveGlyph()\n  {\n    this->MoveSphereSource = vtkSmartPointer<vtkSphereSource>::New();\n    this->MoveSphereSource->SetRadius(.1);\n    this->MoveSphereSource->Update();\n\n    this->MoveMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n    this->MoveMapper->SetInputConnection(\n        this->MoveSphereSource->GetOutputPort());\n\n    this->MoveActor = vtkSmartPointer<vtkActor>::New();\n    this->MoveActor->SetMapper(this->MoveMapper);\n    this->MoveActor->GetProperty()->SetColor(\n        this->color->GetColor3d(\"Pink\").GetData());\n    // this->MoveActor->VisibilityOff();\n\n    this->Move = false;\n  }\n\n  void OnMouseMove() override\n  {\n    if (!this->Move)\n    {\n      return;\n    }\n\n    vtkInteractorStyleTrackballActor::OnMouseMove();\n  }\n\n  void OnMiddleButtonUp() override\n  {\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnMiddleButtonUp();\n    this->Move = false;\n    this->MoveActor->VisibilityOff();\n\n    this->Data->GetPoints()->SetPoint(this->SelectedPoint,\n                                      this->MoveActor->GetPosition());\n    this->Data->Modified();\n    this->GetCurrentRenderer()->Render();\n    this->GetCurrentRenderer()->GetRenderWindow()->Render();\n  }\n  void OnMiddleButtonDown() override\n  {\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnMiddleButtonDown();\n    this->MoveActor->VisibilityOn();\n    if (static_cast<vtkCellPicker*>(this->InteractionPicker)->GetPointId() >= 0)\n    {\n      vtkIdType id =\n          dynamic_cast<vtkIdTypeArray*>(\n              this->GlyphData->GetPointData()->GetArray(\"InputPointIds\"))\n              ->GetValue(static_cast<vtkCellPicker*>(this->InteractionPicker)\n                             ->GetPointId());\n      std::cout << \"Id: \" << id << std::endl;\n      this->Move = true;\n      this->SelectedPoint = id;\n\n      double p[3];\n      this->Data->GetPoint(id, p);\n      std::cout << \"p: \" << p[0] << \" \" << p[1] << \" \" << p[2] << std::endl;\n      this->MoveActor->SetPosition(p);\n    }\n\n    this->GetCurrentRenderer()->AddActor(this->MoveActor);\n    this->InteractionProp = this->MoveActor;\n  }\n  vtkNew<vtkNamedColors> color;\n\n  vtkPolyData* Data;\n  vtkPolyData* GlyphData;\n\n  vtkSmartPointer<vtkPolyDataMapper> MoveMapper;\n  vtkSmartPointer<vtkActor> MoveActor;\n  vtkSmartPointer<vtkSphereSource> MoveSphereSource;\n\n  bool Move;\n  vtkIdType SelectedPoint;\n};\nvtkStandardNewMacro(InteractorStyleMoveGlyph);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(2, 0, 0);\n\n  vtkNew<vtkPolyData> input;\n  input->SetPoints(points);\n\n  vtkNew<vtkSphereSource> glyphSource;\n  glyphSource->SetRadius(0.1);\n  glyphSource->Update();\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->GeneratePointIdsOn();\n  glyph3D->SetSourceConnection(glyphSource->GetOutputPort());\n  glyph3D->SetInputData(input);\n  glyph3D->SetScaleModeToDataScalingOff();\n  glyph3D->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(color->GetColor3d(\"Tomato\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MoveAGlyph\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(color->GetColor3d(\"Burlywood\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<InteractorStyleMoveGlyph> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->Data = input;\n  style->GlyphData = glyph3D->GetOutput();\n\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/MoveAGlyph/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MoveAGlyph)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MoveAGlyph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MoveAGlyph MACOSX_BUNDLE MoveAGlyph.cxx )\n  target_link_libraries(MoveAGlyph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MoveAGlyph\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/MoveAGlyph/#download-and-build-moveaglyph","title":"Download and Build MoveAGlyph","text":"

        Click here to download MoveAGlyph and its CMakeLists.txt file. Once the tarball MoveAGlyph.tar has been downloaded and extracted,

        cd MoveAGlyph/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MoveAGlyph\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/MoveAVertexUnstructuredGrid/","title":"MoveAVertexUnstructuredGrid","text":"

        vtk-examples/Cxx/Interaction/MoveAVertexUnstructuredGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/MoveAVertexUnstructuredGrid/#code","title":"Code","text":"

        MoveAVertexUnstructuredGrid.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointPicker.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVertexGlyphFilter.h>\n\nnamespace {\n// Define interaction style.\nclass InteractorStyleMoveVertex : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static InteractorStyleMoveVertex* New();\n  vtkTypeMacro(InteractorStyleMoveVertex, vtkInteractorStyleTrackballActor);\n\n  InteractorStyleMoveVertex()\n  {\n\n    this->Move = false;\n    this->PointPicker = vtkSmartPointer<vtkPointPicker>::New();\n\n    // Setup ghost glyph.\n    vtkNew<vtkPoints> points;\n    points->InsertNextPoint(0, 0, 0);\n    this->MovePolyData = vtkSmartPointer<vtkPolyData>::New();\n    this->MovePolyData->SetPoints(points);\n    this->MoveGlyphFilter = vtkSmartPointer<vtkVertexGlyphFilter>::New();\n    this->MoveGlyphFilter->SetInputData(this->MovePolyData);\n    this->MoveGlyphFilter->Update();\n\n    this->MoveMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n    this->MoveMapper->SetInputConnection(\n        this->MoveGlyphFilter->GetOutputPort());\n\n    this->MoveActor = vtkSmartPointer<vtkActor>::New();\n    this->MoveActor->SetMapper(this->MoveMapper);\n    this->MoveActor->VisibilityOff();\n    this->MoveActor->GetProperty()->SetPointSize(10);\n    this->MoveActor->GetProperty()->SetColor(\n        this->color->GetColor3d(\"Pink\").GetData());\n  }\n\n  void OnMouseMove() override\n  {\n    if (!this->Move)\n    {\n      return;\n    }\n\n    vtkInteractorStyleTrackballActor::OnMouseMove();\n  }\n\n  void OnMiddleButtonUp() override\n  {\n    this->EndPan();\n\n    this->Move = false;\n    this->MoveActor->VisibilityOff();\n\n    this->Data->GetPoints()->SetPoint(this->SelectedPoint,\n                                      this->MoveActor->GetPosition());\n    this->Data->Modified();\n    this->GetCurrentRenderer()->Render();\n    this->GetCurrentRenderer()->GetRenderWindow()->Render();\n  }\n  void OnMiddleButtonDown() override\n  {\n    // Get the selected point.\n    int x = this->Interactor->GetEventPosition()[0];\n    int y = this->Interactor->GetEventPosition()[1];\n    this->FindPokedRenderer(x, y);\n    this->PointPicker->Pick(this->Interactor->GetEventPosition()[0],\n                            this->Interactor->GetEventPosition()[1],\n                            0, // always zero.\n                            this->Interactor->GetRenderWindow()\n                                ->GetRenderers()\n                                ->GetFirstRenderer());\n\n    if (this->PointPicker->GetPointId() >= 0)\n    {\n      this->StartPan();\n      this->MoveActor->VisibilityOn();\n      this->Move = true;\n      this->SelectedPoint = this->PointPicker->GetPointId();\n\n      std::cout << \"Dragging point \" << this->SelectedPoint << std::endl;\n\n      double p[3];\n      this->Data->GetPoint(this->SelectedPoint, p);\n      std::cout << \"p: \" << p[0] << \" \" << p[1] << \" \" << p[2] << std::endl;\n      this->MoveActor->SetPosition(p);\n\n      this->GetCurrentRenderer()->AddActor(this->MoveActor);\n      this->InteractionProp = this->MoveActor;\n    }\n  }\n\n  vtkNew<vtkNamedColors> color;\n\n  vtkUnstructuredGrid* Data;\n  vtkPolyData* GlyphData;\n\n  vtkSmartPointer<vtkPolyDataMapper> MoveMapper;\n  vtkSmartPointer<vtkActor> MoveActor;\n  vtkSmartPointer<vtkPolyData> MovePolyData;\n  vtkSmartPointer<vtkVertexGlyphFilter> MoveGlyphFilter;\n\n  vtkSmartPointer<vtkPointPicker> PointPicker;\n\n  bool Move;\n  vtkIdType SelectedPoint;\n};\nvtkStandardNewMacro(InteractorStyleMoveVertex);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> color;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(2, 0, 0);\n\n  vtkNew<vtkUnstructuredGrid> input;\n  input->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(input);\n  glyphFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(10);\n  actor->GetProperty()->SetColor(color->GetColor3d(\"Tomato\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MoveAVertexUnstructuredGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(color->GetColor3d(\"Gray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<InteractorStyleMoveVertex> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->Data = input;\n  style->GlyphData = glyphFilter->GetOutput();\n\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/MoveAVertexUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MoveAVertexUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MoveAVertexUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MoveAVertexUnstructuredGrid MACOSX_BUNDLE MoveAVertexUnstructuredGrid.cxx )\n  target_link_libraries(MoveAVertexUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MoveAVertexUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/MoveAVertexUnstructuredGrid/#download-and-build-moveavertexunstructuredgrid","title":"Download and Build MoveAVertexUnstructuredGrid","text":"

        Click here to download MoveAVertexUnstructuredGrid and its CMakeLists.txt file. Once the tarball MoveAVertexUnstructuredGrid.tar has been downloaded and extracted,

        cd MoveAVertexUnstructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MoveAVertexUnstructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/ObserverMemberFunction/","title":"ObserverMemberFunction","text":"

        vtk-examples/Cxx/Interaction/ObserverMemberFunction

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/ObserverMemberFunction/#code","title":"Code","text":"

        ObserverMemberFunction.cxx

        #include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// A class not derived from vtkObjectBase.\nclass MyClass\n{\npublic:\n  void KeypressCallbackFunction(vtkObject*,\n                                long unsigned int vtkNotUsed(eventId),\n                                void* vtkNotUsed(callData))\n  {\n    std::cout << \"Caught event in MyClass\" << std::endl;\n  }\n};\n\n// A class that is derived from vtkObjectBase.\nclass MyInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MyInteractorStyle* New();\n  vtkTypeMacro(MyInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  void KeypressCallbackFunction(vtkObject*,\n                                long unsigned int vtkNotUsed(eventId),\n                                void* vtkNotUsed(callData))\n  {\n    std::cout << \"Caught event in MyInteractorStyle\" << std::endl;\n  }\n};\nvtkStandardNewMacro(MyInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ObserverMemberFunction\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  MyClass myClass;\n  renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent, &myClass,\n                                      &MyClass::KeypressCallbackFunction);\n\n  vtkSmartPointer<MyInteractorStyle> style =\n      vtkSmartPointer<MyInteractorStyle>::New();\n  renderWindowInteractor->AddObserver(\n      vtkCommand::KeyPressEvent, style,\n      &MyInteractorStyle::KeypressCallbackFunction);\n\n  // vtkSmartPointer<MyInteractorStyle> style2 =\n  //    vtkSmartPointer<MyInteractorStyle>::New();\n  // renderWindowInteractor->AddObserver(\n  //    vtkCommand::KeyPressEvent, style2,\n  //    &MyInteractorStyle::KeypressCallbackFunction);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/ObserverMemberFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ObserverMemberFunction)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ObserverMemberFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ObserverMemberFunction MACOSX_BUNDLE ObserverMemberFunction.cxx )\n  target_link_libraries(ObserverMemberFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ObserverMemberFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/ObserverMemberFunction/#download-and-build-observermemberfunction","title":"Download and Build ObserverMemberFunction","text":"

        Click here to download ObserverMemberFunction and its CMakeLists.txt file. Once the tarball ObserverMemberFunction.tar has been downloaded and extracted,

        cd ObserverMemberFunction/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ObserverMemberFunction\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/PickableOff/","title":"PickableOff","text":"

        vtk-examples/Cxx/Interaction/PickableOff

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/PickableOff/#code","title":"Code","text":"

        PickableOff.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> coneSource0;\n  coneSource0->Update();\n\n  vtkNew<vtkConeSource> coneSource1;\n  coneSource1->SetCenter(2, 0, 0);\n  coneSource1->Update();\n\n  // Create mappers and actors\n  vtkNew<vtkPolyDataMapper> coneMapper0;\n  coneMapper0->SetInputConnection(coneSource0->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> coneMapper1;\n  coneMapper1->SetInputConnection(coneSource1->GetOutputPort());\n\n  // Create actors\n  vtkNew<vtkActor> coneActor0;\n  coneActor0->SetMapper(coneMapper0);\n  coneActor0->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkActor> coneActor1;\n  coneActor1->SetMapper(coneMapper1);\n  coneActor1->PickableOff();\n  coneActor1->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PickableOff\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(coneActor0);\n  renderer->AddActor(coneActor1);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballActor> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/PickableOff/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PickableOff)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PickableOff: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PickableOff MACOSX_BUNDLE PickableOff.cxx )\n  target_link_libraries(PickableOff PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PickableOff\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/PickableOff/#download-and-build-pickableoff","title":"Download and Build PickableOff","text":"

        Click here to download PickableOff and its CMakeLists.txt file. Once the tarball PickableOff.tar has been downloaded and extracted,

        cd PickableOff/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PickableOff\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/Picking/","title":"Picking","text":"

        vtk-examples/Cxx/Interaction/Picking

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/Picking/#code","title":"Code","text":"

        Picking.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPropPicker.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Handle mouse events.\nclass MouseInteractorStyle2 : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorStyle2* New();\n  vtkTypeMacro(MouseInteractorStyle2, vtkInteractorStyleTrackballCamera);\n  vtkNew<vtkNamedColors> colors;\n\n  virtual void OnLeftButtonDown() override\n  {\n    int* clickPos = this->GetInteractor()->GetEventPosition();\n\n    // Pick from this location.\n    vtkNew<vtkPropPicker> picker;\n    picker->Pick(clickPos[0], clickPos[1], 0, this->GetDefaultRenderer());\n\n    double* pos = picker->GetPickPosition();\n    std::cout << \"Pick position (world coordinates) is: \" << pos[0] << \" \"\n              << pos[1] << \" \" << pos[2] << std::endl;\n\n    auto pickedActor = picker->GetActor();\n    if (pickedActor == nullptr)\n    {\n      std::cout << \"No actor picked.\" << std::endl;\n    }\n    else\n    {\n      std::cout << \"Picked actor: \" << picker->GetActor() << std::endl;\n      // Create a sphere.\n      vtkNew<vtkSphereSource> sphereSource;\n      sphereSource->SetCenter(pos[0], pos[1], pos[2]);\n      sphereSource->SetRadius(0.1);\n\n      // Create a mapper and actor.\n      vtkNew<vtkPolyDataMapper> mapper;\n      mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n      vtkNew<vtkActor> actor;\n      actor->SetMapper(mapper);\n      actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n      this->GetDefaultRenderer()->AddActor(actor);\n      // Forward events.\n      vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n    }\n  }\n\nprivate:\n};\n\nvtkStandardNewMacro(MouseInteractorStyle2);\n\n} // namespace\n\n// Execute application.\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->Update();\n\n  // Create a polydata object.\n  vtkPolyData* polydata = planeSource->GetOutput();\n\n  // Create a mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  std::cout << \"Actor address: \" << actor << std::endl;\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Picking\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Set the custom stype to use for interaction.\n  vtkNew<MouseInteractorStyle2> style;\n  style->SetDefaultRenderer(renderer);\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/Picking/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Picking)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Picking: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Picking MACOSX_BUNDLE Picking.cxx )\n  target_link_libraries(Picking PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Picking\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/Picking/#download-and-build-picking","title":"Download and Build Picking","text":"

        Click here to download Picking and its CMakeLists.txt file. Once the tarball Picking.tar has been downloaded and extracted,

        cd Picking/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Picking\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/PointPicker/","title":"PointPicker","text":"

        vtk-examples/Cxx/Interaction/PointPicker

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/PointPicker/#description","title":"Description","text":"

        This example demonstrates how to get the closest point in the data set to the mouse click.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/PointPicker/#code","title":"Code","text":"

        PointPicker.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointPicker.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Define interaction style.\nclass MouseInteractorStylePP : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorStylePP* New();\n  vtkTypeMacro(MouseInteractorStylePP, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnLeftButtonDown() override\n  {\n    std::cout << \"Picking pixel: \" << this->Interactor->GetEventPosition()[0]\n              << \" \" << this->Interactor->GetEventPosition()[1] << std::endl;\n    this->Interactor->GetPicker()->Pick(this->Interactor->GetEventPosition()[0],\n                                        this->Interactor->GetEventPosition()[1],\n                                        0, // always zero.\n                                        this->Interactor->GetRenderWindow()\n                                            ->GetRenderers()\n                                            ->GetFirstRenderer());\n    double picked[3];\n    this->Interactor->GetPicker()->GetPickPosition(picked);\n    std::cout << \"Picked value: \" << picked[0] << \" \" << picked[1] << \" \"\n              << picked[2] << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n};\n\nvtkStandardNewMacro(MouseInteractorStylePP);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPointPicker> pointPicker;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointPicker\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetPicker(pointPicker);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<MouseInteractorStylePP> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/PointPicker/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointPicker)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointPicker: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointPicker MACOSX_BUNDLE PointPicker.cxx )\n  target_link_libraries(PointPicker PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointPicker\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/PointPicker/#download-and-build-pointpicker","title":"Download and Build PointPicker","text":"

        Click here to download PointPicker and its CMakeLists.txt file. Once the tarball PointPicker.tar has been downloaded and extracted,

        cd PointPicker/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointPicker\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/RubberBand2D/","title":"RubberBand2D","text":"

        vtk-examples/Cxx/Interaction/RubberBand2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/RubberBand2D/#description","title":"Description","text":"

        This example shows how to get the coordinates of the corners of the rubber band (the box that is drawn).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/RubberBand2D/#code","title":"Code","text":"

        RubberBand2D.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleRubberBand2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nclass MyRubberBand : public vtkInteractorStyleRubberBand2D\n{\npublic:\n  static MyRubberBand* New();\n  vtkTypeMacro(MyRubberBand, vtkInteractorStyleRubberBand2D);\n\n  virtual void OnLeftButtonUp() override\n  {\n    // Forward events.\n    vtkInteractorStyleRubberBand2D::OnLeftButtonUp();\n\n    std::cout << \"Start position: \" << this->StartPosition[0] << \" \"\n              << this->StartPosition[1] << std::endl;\n    std::cout << \"End position: \" << this->EndPosition[0] << \" \"\n              << this->EndPosition[1] << std::endl;\n  }\n};\n\nvtkStandardNewMacro(MyRubberBand);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RubberBand2D\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<MyRubberBand> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/RubberBand2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RubberBand2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RubberBand2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RubberBand2D MACOSX_BUNDLE RubberBand2D.cxx )\n  target_link_libraries(RubberBand2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RubberBand2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/RubberBand2D/#download-and-build-rubberband2d","title":"Download and Build RubberBand2D","text":"

        Click here to download RubberBand2D and its CMakeLists.txt file. Once the tarball RubberBand2D.tar has been downloaded and extracted,

        cd RubberBand2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RubberBand2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/RubberBand2DObserver/","title":"RubberBand2DObserver","text":"

        vtk-examples/Cxx/Interaction/RubberBand2DObserver

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/RubberBand2DObserver/#code","title":"Code","text":"

        RubberBand2DObserver.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkInteractorStyleRubberBand2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nvoid SelectionChangedCallbackFunction(vtkObject* caller,\n                                      long unsigned int eventId,\n                                      void* clientData, void* callData);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RubberBand2DObserver\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n\n  vtkNew<vtkCallbackCommand> selectionChangedCallback;\n  selectionChangedCallback->SetCallback(SelectionChangedCallbackFunction);\n\n  vtkNew<vtkInteractorStyleRubberBand2D> style;\n  style->AddObserver(vtkCommand::SelectionChangedEvent,\n                     selectionChangedCallback);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid SelectionChangedCallbackFunction(vtkObject* vtkNotUsed(caller),\n                                      long unsigned int vtkNotUsed(eventId),\n                                      void* vtkNotUsed(clientData),\n                                      void* callData)\n{\n  std::cout << \"SelectionChanged callback\" << std::endl;\n\n  unsigned int* rect = reinterpret_cast<unsigned int*>(callData);\n  unsigned int pos1X = rect[0];\n  unsigned int pos1Y = rect[1];\n  unsigned int pos2X = rect[2];\n  unsigned int pos2Y = rect[3];\n\n  std::cout << \"Start x: \" << pos1X << \" Start y: \" << pos1Y\n            << \" End x: \" << pos2X << \" End y: \" << pos2Y << std::endl;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Interaction/RubberBand2DObserver/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RubberBand2DObserver)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RubberBand2DObserver: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RubberBand2DObserver MACOSX_BUNDLE RubberBand2DObserver.cxx )\n  target_link_libraries(RubberBand2DObserver PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RubberBand2DObserver\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/RubberBand2DObserver/#download-and-build-rubberband2dobserver","title":"Download and Build RubberBand2DObserver","text":"

        Click here to download RubberBand2DObserver and its CMakeLists.txt file. Once the tarball RubberBand2DObserver.tar has been downloaded and extracted,

        cd RubberBand2DObserver/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RubberBand2DObserver\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/RubberBand3D/","title":"RubberBand3D","text":"

        vtk-examples/Cxx/Interaction/RubberBand3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/RubberBand3D/#code","title":"Code","text":"

        RubberBand3D.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleRubberBand3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nclass MyRubberBand3D : public vtkInteractorStyleRubberBand3D\n{\npublic:\n  static MyRubberBand3D* New();\n  vtkTypeMacro(MyRubberBand3D, vtkInteractorStyleRubberBand3D);\n\n  virtual void OnLeftButtonUp() override\n  {\n    // Forward events.\n    vtkInteractorStyleRubberBand3D::OnLeftButtonUp();\n\n    std::cout << \"Start position: \" << this->StartPosition[0] << \" \"\n              << this->StartPosition[1] << std::endl;\n    std::cout << \"End position: \" << this->EndPosition[0] << \" \"\n              << this->EndPosition[1] << std::endl;\n  }\n};\nvtkStandardNewMacro(MyRubberBand3D);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RubberBand3D\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<MyRubberBand3D> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/RubberBand3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RubberBand3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RubberBand3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RubberBand3D MACOSX_BUNDLE RubberBand3D.cxx )\n  target_link_libraries(RubberBand3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RubberBand3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/RubberBand3D/#download-and-build-rubberband3d","title":"Download and Build RubberBand3D","text":"

        Click here to download RubberBand3D and its CMakeLists.txt file. Once the tarball RubberBand3D.tar has been downloaded and extracted,

        cd RubberBand3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RubberBand3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/RubberBandPick/","title":"RubberBandPick","text":"

        vtk-examples/Cxx/Interaction/RubberBandPick

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/RubberBandPick/#description","title":"Description","text":"

        Press 'r', then make a selection with the left mouse button.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/RubberBandPick/#code","title":"Code","text":"

        RubberBandPick.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RubberBandPick\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleRubberBandPick> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/RubberBandPick/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RubberBandPick)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RubberBandPick: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RubberBandPick MACOSX_BUNDLE RubberBandPick.cxx )\n  target_link_libraries(RubberBandPick PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RubberBandPick\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/RubberBandPick/#download-and-build-rubberbandpick","title":"Download and Build RubberBandPick","text":"

        Click here to download RubberBandPick and its CMakeLists.txt file. Once the tarball RubberBandPick.tar has been downloaded and extracted,

        cd RubberBandPick/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RubberBandPick\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/RubberBandZoom/","title":"RubberBandZoom","text":"

        vtk-examples/Cxx/Interaction/RubberBandZoom

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/RubberBandZoom/#description","title":"Description","text":"

        This example demonstrates how to select a region of the window to zoom in.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/RubberBandZoom/#code","title":"Code","text":"

        RubberBandZoom.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleRubberBandZoom.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RubberBandZoom\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderWindow->SetWindowName(\"RubberBandZoom\");\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleRubberBandZoom> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderer->GetActiveCamera()->Zoom(0.5);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/RubberBandZoom/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RubberBandZoom)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RubberBandZoom: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RubberBandZoom MACOSX_BUNDLE RubberBandZoom.cxx )\n  target_link_libraries(RubberBandZoom PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RubberBandZoom\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/RubberBandZoom/#download-and-build-rubberbandzoom","title":"Download and Build RubberBandZoom","text":"

        Click here to download RubberBandZoom and its CMakeLists.txt file. Once the tarball RubberBandZoom.tar has been downloaded and extracted,

        cd RubberBandZoom/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RubberBandZoom\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/SelectAVertex/","title":"SelectAVertex","text":"

        vtk-examples/Cxx/Interaction/SelectAVertex

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/SelectAVertex/#description","title":"Description","text":"

        Click and drag a vertex by \"ghosting\" a glyph over the selected vertex and using it for the interaction.

        Use middle mouse button to interact with the vertex.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/SelectAVertex/#code","title":"Code","text":"

        SelectAVertex.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointPicker.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVertexGlyphFilter.h>\n\nnamespace {\n\n// Define interaction style.\nclass InteractorStyle2 : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static InteractorStyle2* New();\n  vtkTypeMacro(InteractorStyle2, vtkInteractorStyleTrackballActor);\n  vtkNew<vtkNamedColors> color;\n\n  InteractorStyle2()\n  {\n    this->Move = false;\n    this->PointPicker = vtkSmartPointer<vtkPointPicker>::New();\n\n    // Setup ghost glyph.\n    vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();\n    points->InsertNextPoint(0, 0, 0);\n    this->MovePolyData = vtkSmartPointer<vtkPolyData>::New();\n    this->MovePolyData->SetPoints(points);\n    this->MoveGlyphFilter = vtkSmartPointer<vtkVertexGlyphFilter>::New();\n    this->MoveGlyphFilter->SetInputData(this->MovePolyData);\n    this->MoveGlyphFilter->Update();\n\n    this->MoveMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n    this->MoveMapper->SetInputConnection(\n        this->MoveGlyphFilter->GetOutputPort());\n\n    this->MoveActor = vtkSmartPointer<vtkActor>::New();\n    this->MoveActor->SetMapper(this->MoveMapper);\n    this->MoveActor->VisibilityOff();\n    this->MoveActor->GetProperty()->SetPointSize(10);\n    this->MoveActor->GetProperty()->SetColor(\n        this->color->GetColor3d(\"Pink\").GetData());\n  }\n\n  void OnMouseMove() override\n  {\n    if (!this->Move)\n    {\n      return;\n    }\n\n    vtkInteractorStyleTrackballActor::OnMouseMove();\n  }\n\n  void OnMiddleButtonUp() override\n  {\n    this->EndPan();\n\n    this->Move = false;\n    this->MoveActor->VisibilityOff();\n\n    this->Data->GetPoints()->SetPoint(this->SelectedPoint,\n                                      this->MoveActor->GetPosition());\n    this->Data->Modified();\n    this->GetCurrentRenderer()->Render();\n    this->GetCurrentRenderer()->GetRenderWindow()->Render();\n  }\n  void OnMiddleButtonDown() override\n  {\n    // Get the selected point.\n    int x = this->Interactor->GetEventPosition()[0];\n    int y = this->Interactor->GetEventPosition()[1];\n    this->FindPokedRenderer(x, y);\n\n    this->PointPicker->Pick(this->Interactor->GetEventPosition()[0],\n                            this->Interactor->GetEventPosition()[1],\n                            0, // always zero.\n                            this->Interactor->GetRenderWindow()\n                                ->GetRenderers()\n                                ->GetFirstRenderer());\n\n    if (this->PointPicker->GetPointId() >= 0)\n    {\n      this->StartPan();\n      this->MoveActor->VisibilityOn();\n      this->Move = true;\n      this->SelectedPoint = this->PointPicker->GetPointId();\n\n      std::cout << \"Dragging point \" << this->SelectedPoint << std::endl;\n\n      double p[3];\n      this->Data->GetPoint(this->SelectedPoint, p);\n      std::cout << \"p: \" << p[0] << \" \" << p[1] << \" \" << p[2] << std::endl;\n      this->MoveActor->SetPosition(p);\n\n      this->GetCurrentRenderer()->AddActor(this->MoveActor);\n      this->InteractionProp = this->MoveActor;\n    }\n  }\n\n  vtkPolyData* Data;\n  vtkPolyData* GlyphData;\n\n  vtkSmartPointer<vtkPolyDataMapper> MoveMapper;\n  vtkSmartPointer<vtkActor> MoveActor;\n  vtkSmartPointer<vtkPolyData> MovePolyData;\n  vtkSmartPointer<vtkVertexGlyphFilter> MoveGlyphFilter;\n\n  vtkSmartPointer<vtkPointPicker> PointPicker;\n\n  bool Move;\n  vtkIdType SelectedPoint;\n};\nvtkStandardNewMacro(InteractorStyle2);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(2, 0, 0);\n\n  vtkNew<vtkPolyData> input;\n  input->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(input);\n  glyphFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(10);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SelectAVertex\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Gray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<InteractorStyle2> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->Data = input;\n\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/SelectAVertex/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectAVertex)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectAVertex: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectAVertex MACOSX_BUNDLE SelectAVertex.cxx )\n  target_link_libraries(SelectAVertex PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectAVertex\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/SelectAVertex/#download-and-build-selectavertex","title":"Download and Build SelectAVertex","text":"

        Click here to download SelectAVertex and its CMakeLists.txt file. Once the tarball SelectAVertex.tar has been downloaded and extracted,

        cd SelectAVertex/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SelectAVertex\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/SelectAnActor/","title":"SelectAnActor","text":"

        vtk-examples/Cxx/Interaction/SelectAnActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/SelectAnActor/#code","title":"Code","text":"

        SelectAnActor.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\n// Handle mouse events.\nclass MouseInteractorStyle5 : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static MouseInteractorStyle5* New();\n  vtkTypeMacro(MouseInteractorStyle5, vtkInteractorStyleTrackballActor);\n\n  virtual void OnLeftButtonDown() override\n  {\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnLeftButtonDown();\n\n    if (this->InteractionProp == this->Cube)\n    {\n      std::cout << \"Picked cube.\" << std::endl;\n    }\n    else if (this->InteractionProp == this->Sphere)\n    {\n      std::cout << \"Picked sphere.\" << std::endl;\n    }\n  }\n\n  vtkActor* Cube;\n  vtkActor* Sphere;\n};\n\nvtkStandardNewMacro(MouseInteractorStyle5);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(2, 0, 0);\n  sphereSource->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SelectAnActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Set the custom stype to use for interaction.\n  vtkNew<MouseInteractorStyle5> style;\n  style->SetDefaultRenderer(renderer);\n  style->Cube = cubeActor;\n  style->Sphere = sphereActor;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderer->AddActor(cubeActor);\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/SelectAnActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectAnActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectAnActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectAnActor MACOSX_BUNDLE SelectAnActor.cxx )\n  target_link_libraries(SelectAnActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectAnActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/SelectAnActor/#download-and-build-selectanactor","title":"Download and Build SelectAnActor","text":"

        Click here to download SelectAnActor and its CMakeLists.txt file. Once the tarball SelectAnActor.tar has been downloaded and extracted,

        cd SelectAnActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SelectAnActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/ShiftAndControl/","title":"ShiftAndControl","text":"

        vtk-examples/Cxx/Interaction/ShiftAndControl

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/ShiftAndControl/#description","title":"Description","text":"

        This example demonstrates how to \"alt+click\", \"control+click\" and \"shift+click\" an actor.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/ShiftAndControl/#code","title":"Code","text":"

        ShiftAndControl.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n\nclass MouseInteractorStyleShiftAndControl\n  : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static MouseInteractorStyleShiftAndControl* New();\n\n  virtual void OnLeftButtonDown()\n  {\n    if (this->Interactor->GetShiftKey())\n    {\n      std::cout << \"Shift held. \";\n    }\n\n    if (this->Interactor->GetControlKey())\n    {\n      std::cout << \"Control held. \";\n    }\n\n    if (this->Interactor->GetAltKey())\n    {\n      std::cout << \"Alt held. \";\n    }\n\n    std::cout << \"Pressed left mouse button.\" << std::endl;\n\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnLeftButtonDown();\n  }\n};\n\nvtkStandardNewMacro(MouseInteractorStyleShiftAndControl);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ShiftAndControl\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<MouseInteractorStyleShiftAndControl> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/ShiftAndControl/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShiftAndControl)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShiftAndControl: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShiftAndControl MACOSX_BUNDLE ShiftAndControl.cxx )\n  target_link_libraries(ShiftAndControl PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShiftAndControl\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/ShiftAndControl/#download-and-build-shiftandcontrol","title":"Download and Build ShiftAndControl","text":"

        Click here to download ShiftAndControl and its CMakeLists.txt file. Once the tarball ShiftAndControl.tar has been downloaded and extracted,

        cd ShiftAndControl/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ShiftAndControl\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/StyleSwitch/","title":"StyleSwitch","text":"

        vtk-examples/Cxx/Interaction/StyleSwitch

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/StyleSwitch/#description","title":"Description","text":"

        The class vtkInteractorStyleSwitch allows handles interactively switching between four interactor styles -- joystick actor, joystick camera, trackball actor, and trackball camera. Type 'j' or 't' to select joystick or trackball, and type 'c' or 'a' to select camera or actor. The default interactor style is joystick camera.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/StyleSwitch/#code","title":"Code","text":"

        StyleSwitch.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"StyleSwitch\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleSwitch> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/StyleSwitch/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StyleSwitch)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StyleSwitch: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StyleSwitch MACOSX_BUNDLE StyleSwitch.cxx )\n  target_link_libraries(StyleSwitch PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StyleSwitch\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/StyleSwitch/#download-and-build-styleswitch","title":"Download and Build StyleSwitch","text":"

        Click here to download StyleSwitch and its CMakeLists.txt file. Once the tarball StyleSwitch.tar has been downloaded and extracted,

        cd StyleSwitch/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StyleSwitch\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/TrackballActor/","title":"TrackballActor","text":"

        vtk-examples/Cxx/Interaction/TrackballActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/TrackballActor/#description","title":"Description","text":"

        This example shows how to visualize data in \"trackball\" mode. That is, click and drag actors is the way to interact.

        Contrast this with TrackballCamera.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/TrackballActor/#code","title":"Code","text":"

        TrackballActor.cxx

        #include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(1.0, 0.0, 0.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TrackballActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(coneActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballActor> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/TrackballActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TrackballActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TrackballActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TrackballActor MACOSX_BUNDLE TrackballActor.cxx )\n  target_link_libraries(TrackballActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TrackballActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/TrackballActor/#download-and-build-trackballactor","title":"Download and Build TrackballActor","text":"

        Click here to download TrackballActor and its CMakeLists.txt file. Once the tarball TrackballActor.tar has been downloaded and extracted,

        cd TrackballActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TrackballActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/TrackballCamera/","title":"TrackballCamera","text":"

        vtk-examples/Cxx/Interaction/TrackballCamera

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/TrackballCamera/#description","title":"Description","text":"

        This example demonstrates the trackball camera mode. When the mouse is clicked and dragged from anywhere in the window, the camera is modified.

        Contrast this with TrackballActor.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/TrackballCamera/#code","title":"Code","text":"

        TrackballCamera.cxx

        #include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(1.0, 0.0, 0.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a cone.\n  vtkNew<vtkConeSource> coneSource;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TrackballCamera\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(coneActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/TrackballCamera/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TrackballCamera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TrackballCamera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TrackballCamera MACOSX_BUNDLE TrackballCamera.cxx )\n  target_link_libraries(TrackballCamera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TrackballCamera\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/TrackballCamera/#download-and-build-trackballcamera","title":"Download and Build TrackballCamera","text":"

        Click here to download TrackballCamera and its CMakeLists.txt file. Once the tarball TrackballCamera.tar has been downloaded and extracted,

        cd TrackballCamera/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TrackballCamera\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/UserEvent/","title":"UserEvent","text":"

        vtk-examples/Cxx/Interaction/UserEvent

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/UserEvent/#code","title":"Code","text":"

        UserEvent.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include \"vtkTestFilter.h\"\n\nnamespace {\n\nvoid CallbackFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"UserEvent\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkTestFilter> filter;\n\n  vtkNew<vtkCallbackCommand> callback;\n  callback->SetCallback(CallbackFunction);\n  filter->AddObserver(filter->RefreshEvent, callback);\n\n  filter->Update();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CallbackFunction(vtkObject* /* caller */, long unsigned int /* eventId */,\n                      void* /* clientData */, void* /* callData */)\n{\n  std::cout << \"CallbackFunction called.\" << std::endl;\n}\n\n} // namespace\n

        vtkTestFilter.h

        #ifndef __vtkTestFilter_h\n#define __vtkTestFilter_h\n\n#include <vtkInformation.h>\n#include <vtkInformationVector.h>\n#include <vtkPolyDataAlgorithm.h>\n\nclass vtkTestFilter : public vtkPolyDataAlgorithm\n{\npublic:\n  vtkTypeMacro(vtkTestFilter, vtkPolyDataAlgorithm);\n  static vtkTestFilter* New();\n\n  int RefreshEvent;\n\nprotected:\n  vtkTestFilter();\n\n  int RequestData(vtkInformation*, vtkInformationVector**,\n                  vtkInformationVector*) override;\n\nprivate:\n  vtkTestFilter(const vtkTestFilter&);  // Not implemented.\n  void operator=(const vtkTestFilter&); // Not implemented.\n};\n\nvtkStandardNewMacro(vtkTestFilter);\n\nvtkTestFilter::vtkTestFilter()\n{\n  this->SetNumberOfInputPorts(0);\n\n  this->RefreshEvent = vtkCommand::UserEvent + 1;\n}\n\nint vtkTestFilter::RequestData(vtkInformation* vtkNotUsed(request),\n                               vtkInformationVector**, vtkInformationVector*)\n{\n  // Get the info object\n  //  auto outInfo = outputVector->GetInformationObject(0);\n\n  //  auto output = vtkPolyData::SafeDownCast(\n  //      outInfo->Get(vtkDataObject::DATA_OBJECT()));\n  this->InvokeEvent(this->RefreshEvent, nullptr);\n\n  return 1;\n}\n\n#endif // __vtkTestFilter_h\n
        "},{"location":"Cxx/Interaction/UserEvent/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(UserEvent)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"UserEvent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(UserEvent MACOSX_BUNDLE UserEvent.cxx )\n  target_link_libraries(UserEvent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS UserEvent\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/UserEvent/#download-and-build-userevent","title":"Download and Build UserEvent","text":"

        Click here to download UserEvent and its CMakeLists.txt file. Once the tarball UserEvent.tar has been downloaded and extracted,

        cd UserEvent/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./UserEvent\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Interaction/WorldPointPicker/","title":"WorldPointPicker","text":"

        vtk-examples/Cxx/Interaction/WorldPointPicker

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Interaction/WorldPointPicker/#description","title":"Description","text":"

        This example demonstrates how to get the position of the point in 3D that is exactly behind the mouse click. This point is not likely a point that exists in the data set - i.e. it can be a point on the interior of a cell.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Interaction/WorldPointPicker/#code","title":"Code","text":"

        WorldPointPicker.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSphereSource.h>\n#include <vtkWorldPointPicker.h>\n\nnamespace {\n\n// Define interaction style.\nclass MouseInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorStyle* New();\n  vtkTypeMacro(MouseInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnLeftButtonDown() override\n  {\n    std::cout << \"Picking pixel: \" << this->Interactor->GetEventPosition()[0]\n              << \" \" << this->Interactor->GetEventPosition()[1] << std::endl;\n    this->Interactor->GetPicker()->Pick(this->Interactor->GetEventPosition()[0],\n                                        this->Interactor->GetEventPosition()[1],\n                                        0, // always zero.\n                                        this->Interactor->GetRenderWindow()\n                                            ->GetRenderers()\n                                            ->GetFirstRenderer());\n    double picked[3];\n    this->Interactor->GetPicker()->GetPickPosition(picked);\n    std::cout << \"Picked value: \" << picked[0] << \" \" << picked[1] << \" \"\n              << picked[2] << std::endl;\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n};\nvtkStandardNewMacro(MouseInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkWorldPointPicker> worldPointPicker;\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WorldPointPicker\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetPicker(worldPointPicker);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<MouseInteractorStyle> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Interaction/WorldPointPicker/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WorldPointPicker)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WorldPointPicker: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WorldPointPicker MACOSX_BUNDLE WorldPointPicker.cxx )\n  target_link_libraries(WorldPointPicker PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WorldPointPicker\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Interaction/WorldPointPicker/#download-and-build-worldpointpicker","title":"Download and Build WorldPointPicker","text":"

        Click here to download WorldPointPicker and its CMakeLists.txt file. Once the tarball WorldPointPicker.tar has been downloaded and extracted,

        cd WorldPointPicker/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WorldPointPicker\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Lighting/Light/","title":"Light","text":"

        vtk-examples/Cxx/Lighting/Light

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Lighting/Light/#code","title":"Code","text":"

        Light.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkLightActor.h>\n#include <vtkLightCollection.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <cstdlib>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  double lightPosition[3] = {0, 0, 1};\n\n  // Create a light\n  double lightFocalPoint[3] = {0, 0, 0};\n\n  vtkNew<vtkLight> light;\n  light->SetLightTypeToSceneLight();\n  light->SetPosition(lightPosition[0], lightPosition[1], lightPosition[2]);\n  light->SetPositional(true); // required for vtkLightActor below\n  light->SetConeAngle(10);\n  light->SetFocalPoint(lightFocalPoint[0], lightFocalPoint[1],\n                       lightFocalPoint[2]);\n  light->SetDiffuseColor(colors->GetColor3d(\"Red\").GetData());\n  light->SetAmbientColor(colors->GetColor3d(\"Green\").GetData());\n  light->SetSpecularColor(colors->GetColor3d(\"Blue\").GetData());\n\n  vtkLightCollection* originalLights = renderer->GetLights();\n  std::cout << \"Originally there are \" << originalLights->GetNumberOfItems()\n            << \" lights.\" << std::endl;\n\n  //  renderer->AddLight(light); // can't do this here - must do this after the\n  //  renderWindow->Render() below\n\n  // Display where the light is\n  vtkNew<vtkLightActor> lightActor;\n  lightActor->SetLight(light);\n  renderer->AddViewProp(lightActor);\n\n  // Display where the light is focused\n  vtkNew<vtkSphereSource> lightFocalPointSphere;\n  lightFocalPointSphere->SetCenter(lightFocalPoint);\n  lightFocalPointSphere->SetRadius(0.1);\n  lightFocalPointSphere->Update();\n\n  vtkNew<vtkPolyDataMapper> lightFocalPointMapper;\n  lightFocalPointMapper->SetInputConnection(\n      lightFocalPointSphere->GetOutputPort());\n\n  vtkNew<vtkActor> lightFocalPointActor;\n  lightFocalPointActor->SetMapper(lightFocalPointMapper);\n  lightFocalPointActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Yellow\").GetData());\n  renderer->AddViewProp(lightFocalPointActor);\n\n  // Create a plane for the light to shine on\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->SetResolution(100, 100);\n  planeSource->Update();\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputData(planeSource->GetOutput());\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n  renderer->AddActor(planeActor);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Light\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  std::cout << \"Now there are \" << originalLights->GetNumberOfItems()\n            << \" lights.\" << std::endl;\n\n  renderer->AddLight(light); // must do this after renderWindow->Render();\n  std::cout << \"Now there are \" << originalLights->GetNumberOfItems()\n            << \" lights.\" << std::endl;\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-2.17199, -2.50774, 2.18);\n  camera->SetFocalPoint(-0.144661, -0.146372, 0.180482);\n  camera->SetViewUp(0.0157883, 0.638203, 0.769706);\n  camera->SetDistance(3.69921);\n  camera->SetClippingRange(1.76133, 6.14753);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Lighting/Light/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Light)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Light: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Light MACOSX_BUNDLE Light.cxx )\n  target_link_libraries(Light PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Light\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Lighting/Light/#download-and-build-light","title":"Download and Build Light","text":"

        Click here to download Light and its CMakeLists.txt file. Once the tarball Light.tar has been downloaded and extracted,

        cd Light/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Light\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Lighting/LightActor/","title":"LightActor","text":"

        vtk-examples/Cxx/Lighting/LightActor

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Lighting/LightActor/#code","title":"Code","text":"

        LightActor.cxx

        #include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkLightActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <cstdlib>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  // Display where the light is\n  vtkNew<vtkLight> light;\n  light->SetPositional(true); // without this line, the program crashes\n  vtkNew<vtkLightActor> lightActor;\n  lightActor->SetLight(light);\n  renderer->AddViewProp(lightActor);\n  lightActor->GetFrustumProperty()->SetColor(\n      colors->GetColor3d(\"LavenderBlush\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LightActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->ResetCamera();\n  renderer->ResetCameraClippingRange();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-2.17199, -2.50774, 2.18);\n  camera->SetFocalPoint(-0.144661, -0.146372, 0.180482);\n  camera->SetViewUp(0.0157883, 0.638203, 0.769706);\n  camera->SetDistance(3.69921);\n  camera->SetClippingRange(1.76133, 6.14753);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Lighting/LightActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LightActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LightActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LightActor MACOSX_BUNDLE LightActor.cxx )\n  target_link_libraries(LightActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LightActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Lighting/LightActor/#download-and-build-lightactor","title":"Download and Build LightActor","text":"

        Click here to download LightActor and its CMakeLists.txt file. Once the tarball LightActor.tar has been downloaded and extracted,

        cd LightActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LightActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Lighting/SpotLights/","title":"SpotLights","text":"

        vtk-examples/Cxx/Lighting/SpotLights

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Lighting/SpotLights/#description","title":"Description","text":"

        This example places two vtkLight's with PositionalOn().

        Cite

        This example was inspired by Oliver Natt's question (and python script) on the VTK Users mailing list.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Lighting/SpotLights/#code","title":"Code","text":"

        SpotLights.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  // create a rendering window and renderer\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SpotLights\");\n\n  // create a renderwindowinteractor\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  // create a plane and add it to the renderer\n  vtkNew<vtkPlaneSource> source;\n  source->SetOrigin(-5.0, 0.0, 5.0);\n  source->SetPoint1(5.0, 0.0, 5.0);\n  source->SetPoint2(-5.0, 0.0, -5.0);\n  source->SetResolution(100, 100);\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  renderer->AddActor(actor);\n\n  // set camera view\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(40.0);\n  renderer->GetActiveCamera()->Elevation(30.0);\n\n  // create a green light\n  vtkNew<vtkLight> greenLight;\n  greenLight->PositionalOn();\n  greenLight->SetPosition(-4.0, 4.0, -1.0);\n  greenLight->SetColor(colors->GetColor3d(\"Lawn_green\").GetData());\n  greenLight->SetIntensity(0.5);\n\n  // create a pink light\n  vtkNew<vtkLight> pinkLight;\n  pinkLight->PositionalOn();\n  pinkLight->SetPosition(4.0, 5.0, 1.0);\n  pinkLight->SetColor(colors->GetColor3d(\"DeepPink\").GetData());\n  pinkLight->SetIntensity(0.6);\n\n  // add lights to the renderer\n  renderer->AddLight(pinkLight);\n  renderer->AddLight(greenLight);\n\n  // define a background for better visibility\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"SkyBlue\").GetData());\n  renderer->GradientBackgroundOn();\n\n  // enable interactor\n  iren->Initialize();\n  renderWindow->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Lighting/SpotLights/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SpotLights)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SpotLights: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SpotLights MACOSX_BUNDLE SpotLights.cxx )\n  target_link_libraries(SpotLights PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SpotLights\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Lighting/SpotLights/#download-and-build-spotlights","title":"Download and Build SpotLights","text":"

        Click here to download SpotLights and its CMakeLists.txt file. Once the tarball SpotLights.tar has been downloaded and extracted,

        cd SpotLights/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SpotLights\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/1DTupleInterpolation/","title":"1DTupleInterpolation","text":"

        vtk-examples/Cxx/Math/1DTupleInterpolation

        "},{"location":"Cxx/Math/1DTupleInterpolation/#description","title":"Description","text":"

        Contributed by: Lars Friedrich

        A simple example that shows how to use vtkTupleInterpolator for the purpose of interpolating 1D functions. Internally the program investigates two functions: sine and Runge function with sparsely distributed supporting points. The application uses different interpolation modes: linear, cardinal spline and Kochanek spline. Moreover, the example offers the \"--csv-output\" (or \"-co\") option which causes the program to generate CSV-sheets reflecting the interpolated data. In order to demonstrate the spline interpolation behavior at the edge regions, we use the open and closed interval spline options as well. For example, a Kochanek-interpolation of the Runge function:

        "},{"location":"Cxx/Math/1DTupleInterpolation/#program-usage","title":"Program Usage","text":"
        ./1DTupleInterpolation [](options)\n\n  -h or --help ... print this short help\n  -nv or --no-verbose ... no verbose messages to std::cout\n  -co or --csv-output ... CSV (comma separated values) file outputs\n

        Note

        optional arguments are case-sensitive!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/1DTupleInterpolation/#code","title":"Code","text":"

        1DTupleInterpolation.cxx

        //\n#include <cmath>\n#include <cstdlib>\n#include <fstream>\n#include <iostream>\n#include <string>\n#ifndef M_PI\n#define M_PI 3.14159265358979323846\n#endif\n#include <vtkCardinalSpline.h>\n#include <vtkKochanekSpline.h>\n#include <vtkNew.h>\n#include <vtkTupleInterpolator.h>\n\n#include <ctime>\n#include <vector>\n\n#define VERBOSE(x)                                                             \\\n  {                                                                            \\\n    if (Verbose)                                                               \\\n    {                                                                          \\\n      std::cout x;                                                             \\\n      std::cout.flush();                                                       \\\n    }                                                                          \\\n  }\n\n// verbose flag\nbool Verbose = true;\n// CSV output flag\nbool CSVOutput = false;\n\nnamespace {\n/**\n * Print example usage information.\n **/\nvoid PrintUsage(char* binname);\n\n/** Runge function. **/\ndouble FRunge(double x)\n{\n  return 1.0 / (1.0 + x * x);\n}\n\n/** Sine function. **/\ndouble FSin(double x)\n{\n  return sin(x);\n}\n\n/** Execute a specific tuple interpolation method with pre-initialized tuple\n * interpolator. **/\nbool TestInterpolation(vtkTupleInterpolator* tupInt, double tolerance,\n                       const char* csvFileName, double (*mathFunc)(double),\n                       std::vector<double>& x, const std::vector<double>& y,\n                       double N, double symmetricIntervalWidth);\n\n} // namespace\n\n/** \\brief Demonstrate base functionality of VTK-based tuple interpolation (1D).\n * Demonstrate base functionality of VTK-based tuple interpolation (1D).\n *\n * Application result is 0 if SUCCESSFUL.\n *\n * Arguments: <br>\n * -h or --help ... print short help <br>\n * -nv or --no-verbose ... message output (verbose) <br>\n * -co or --csv-output ... CSV (comma separated values) file outputs <br>\n *\n * @author ---\n * @version 1.2\n */\nint main(int argc, char* argv[])\n{\n  // arguments check\n  for (int i = 1; i < argc; i++)\n  {\n    if (std::string(argv[i]) == \"-nv\" || std::string(argv[i]) == \"--no-verbose\")\n      Verbose = false;\n    if (std::string(argv[i]) == \"-h\" || std::string(argv[i]) == \"--help\")\n    {\n      if (argc > 0)\n        PrintUsage(argv[0]);\n      else\n        PrintUsage(nullptr);\n      return EXIT_FAILURE;\n    }\n    if (std::string(argv[i]) == \"-co\" || std::string(argv[i]) == \"--csv-output\")\n      CSVOutput = true;\n  }\n\n  VERBOSE(<< \"\\nDemonstrating VTK-based 1-tuple interpolation capabilities.\\n\")\n  bool ok = true;\n\n  VERBOSE(<< \"  * Generate supporting points ... \")\n  bool lok = true; // local OK\n  // - SINE -\n  constexpr int N1 = 13;\n  std::vector<double> xs(N1, 0);\n  std::vector<double> ys(N1, 0);\n  std::ofstream csv;\n  if (CSVOutput)\n  {\n    csv.open(\"sine.csv\", std::ios::out);\n    if (csv.is_open())\n      csv << \"x;y\\n\";\n    else\n      lok = false;\n  }\n  // prepare the supporting points (sine):\n  for (int i = 0; i < N1; i++)\n  {\n    xs[i] = -M_PI + (double)i / (double)(N1 - 1) * (2. * M_PI);\n    ys[i] = FSin(xs[i]);\n\n    if (CSVOutput && csv.is_open())\n      csv << xs[i] << \";\" << ys[i] << \"\\n\";\n  }\n  if (CSVOutput && csv.is_open())\n    csv.close();\n  // - RUNGE -\n  const int N2 = 10;\n  std::vector<double> xr(N2, 0);\n  std::vector<double> yr(N2, 0);\n  if (CSVOutput)\n  {\n    csv.open(\"runge.csv\", std::ios::out);\n    if (csv.is_open())\n      csv << \"x;y\\n\";\n    else\n      lok = false;\n  }\n  // prepare the supporting points (sine):\n  for (int i = 0; i < N2; i++)\n  {\n    xr[i] = -5.0 + (double)i / (double)(N2 - 1) * (2. * 5.0);\n    yr[i] = FRunge(xr[i]);\n\n    if (CSVOutput && csv.is_open())\n      csv << xr[i] << \";\" << yr[i] << \"\\n\";\n  }\n  if (CSVOutput && csv.is_open())\n    csv.close();\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of sine using linear method ... \")\n  // initialize the tuple interpolator (1D):\n  vtkNew<vtkTupleInterpolator> tupInt;\n  tupInt->SetInterpolationTypeToLinear(); // linear\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.04, \"sin_linear_int.csv\", FSin, xs, ys, N1,\n                          M_PI);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of sine using cardinal spline method (open \"\n             \"interval) ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->SetInterpolationTypeToSpline(); // spline (implicit reset!)\n  vtkNew<vtkCardinalSpline> cardSpline;\n  cardSpline->SetClosed(false);\n  tupInt->SetInterpolatingSpline(cardSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.1, \"sin_card_spline_open_int.csv\", FSin, xs,\n                          ys, N1, M_PI);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of sine using cardinal spline method (closed \"\n             \"interval) ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->Initialize();                   // reset\n  tupInt->SetInterpolationTypeToSpline(); // spline\n  cardSpline->SetClosed(true);\n  tupInt->SetInterpolatingSpline(cardSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.05, \"sin_card_spline_closed_int.csv\", FSin,\n                          xs, ys, N1, M_PI);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of sine using Kochanek spline (default setup) \"\n             \"method (open interval) ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->Initialize();                   // reset\n  tupInt->SetInterpolationTypeToSpline(); // spline\n  vtkNew<vtkKochanekSpline> kochSpline;\n  kochSpline->SetClosed(false);\n  tupInt->SetInterpolatingSpline(kochSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.1, \"sin_koch_spline_open_int.csv\", FSin, xs,\n                          ys, N1, M_PI);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of sine using Kochanek spline (default setup) \"\n             \"method (closed interval) ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->Initialize();                   // reset\n  tupInt->SetInterpolationTypeToSpline(); // spline\n  kochSpline->SetClosed(true);\n  tupInt->SetInterpolatingSpline(kochSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.06, \"sin_koch_spline_closed_int.csv\", FSin,\n                          xs, ys, N1, M_PI);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of Runge using linear method ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->Initialize();\n  tupInt->SetInterpolationTypeToLinear(); // linear\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.25 /* around 0! */, \"runge_linear_int.csv\",\n                          FRunge, xr, yr, N2, 5.0);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of Runge using cardinal spline method ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->SetInterpolationTypeToSpline(); // spline (implicit reset!)\n  cardSpline->SetClosed(false);\n  tupInt->SetInterpolatingSpline(cardSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.15 /* around 0! */,\n                          \"runge_card_spline_int.csv\", FRunge, xr, yr, N2, 5.0);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"  * Interpolation of Runge using Kochanek spline method ... \")\n  // initialize the tuple interpolator (1D):\n  tupInt->Initialize();                   // reset\n  tupInt->SetInterpolationTypeToSpline(); // spline (implicit reset!)\n  kochSpline->SetClosed(false);\n  tupInt->SetInterpolatingSpline(kochSpline);\n  tupInt->SetNumberOfComponents(\n      1); // 1D (NOTE: set #components AFTER interpolation-type!)\n  lok = TestInterpolation(tupInt, 0.18 /* around 0! */,\n                          \"runge_koch_spline_int.csv\", FRunge, xr, yr, N2, 5.0);\n  ok = ok && lok;\n  VERBOSE(<< (lok ? \"OK\" : \"FAILURE\") << \"\\n\")\n\n  VERBOSE(<< \"Application result: \")\n  if (ok)\n  {\n    VERBOSE(<< \"OK\\n\\n\")\n    return EXIT_SUCCESS;\n  }\n  else\n  {\n    VERBOSE(<< \"FAILURE\\n\\n\")\n    return EXIT_FAILURE;\n  }\n}\n\nnamespace {\n/**\n * Print example usage information.\n **/\nvoid PrintUsage(char* binname)\n{\n  std::string progname = \"<binary-name>\";\n  if (binname)\n    progname = std::string(binname);\n  std::cout << \"\\n\";\n  std::cout << \"   *** E X A M P L E   U S A G E ***\\n\";\n  std::cout << \"\\n\";\n  std::cout << progname << \" [options]\\n\";\n  std::cout << \"\\n\";\n  std::cout << \"  -h or --help ... print this short help\\n\";\n  std::cout << \"  -nv or --no-verbose ... no verbose messages to std::cout\\n\";\n  std::cout << \"  -co or --csv-output ... CSV (comma separated values) file \"\n               \"outputs\\n\";\n  std::cout << \"\\n\";\n  std::cout << \"  NOTE: optional arguments are case-sensitive!\\n\";\n  std::cout << \"\\n\";\n  std::cout << \"  Author: ---\\n\";\n  std::cout << \"  Affiliation: ---\\n\";\n  std::cout << \"\\n\";\n}\n\n/** Execute a specific tuple interpolation method with pre-initialized tuple\n * interpolator. **/\nbool TestInterpolation(vtkTupleInterpolator* tupInt, double tolerance,\n                       const char* csvFileName, double (*mathFunc)(double),\n                       std::vector<double>& x, const std::vector<double>& y,\n                       double N, double symmetricIntervalWidth)\n{\n  bool ok = true;\n  std::ofstream csvint;\n  if (CSVOutput)\n  {\n    csvint.open(csvFileName, std::ios::out);\n    if (csvint.is_open())\n      csvint << \"x;y;e\\n\";\n    else\n      ok = false;\n  }\n  double yt[1];\n  for (int i = 0; i < N; i++) // re-define supporting points\n  {\n    yt[0] = y[i];\n    tupInt->AddTuple(x[i], yt);\n  }\n  // draw random samples from interval and test against mathFunc:\n  for (int i = 0; i < 1000; i++)\n  {\n    double f = (double)(rand() % 100001) / 100000.;\n    double xi = (f * 2.0 - 1.0) * symmetricIntervalWidth;\n    double yi[1];\n    tupInt->InterpolateTuple(xi, yi);\n    double ei = std::abs(yi[0] - mathFunc(xi));\n    // we have a tolerance within [-PI;+PI] - empirical!\n    if (xi >= -symmetricIntervalWidth && xi <= symmetricIntervalWidth &&\n        ei > tolerance)\n      ok = false;\n    if (CSVOutput && csvint.is_open())\n      csvint << xi << \";\" << yi[0] << \";\" << ei << \"\\n\";\n  }\n  if (CSVOutput && csvint.is_open())\n    csvint.close();\n  return ok;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Math/1DTupleInterpolation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(1DTupleInterpolation)\n\nfind_package(VTK COMPONENTS \n  CommonComputationalGeometry\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"1DTupleInterpolation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(1DTupleInterpolation MACOSX_BUNDLE 1DTupleInterpolation.cxx )\n  target_link_libraries(1DTupleInterpolation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS 1DTupleInterpolation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/1DTupleInterpolation/#download-and-build-1dtupleinterpolation","title":"Download and Build 1DTupleInterpolation","text":"

        Click here to download 1DTupleInterpolation and its CMakeLists.txt file. Once the tarball 1DTupleInterpolation.tar has been downloaded and extracted,

        cd 1DTupleInterpolation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./1DTupleInterpolation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/EigenSymmetric/","title":"EigenSymmetric","text":"

        vtk-examples/Cxx/Math/EigenSymmetric

        "},{"location":"Cxx/Math/EigenSymmetric/#description","title":"Description","text":"

        At the moment, this is a pretty messy process, so here are some helper functions that will hopefully eventually be wrapped into a class/interface.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/EigenSymmetric/#code","title":"Code","text":"

        EigenSymmetric.cxx

        #include <vtkMath.h>\n\nnamespace {\n/* allocate memory for an nrow x ncol matrix */\ntemplate <class TReal> TReal** create_matrix(long nrow, long ncol)\n{\n  typedef TReal* TRealPointer;\n  TReal** m = new TRealPointer[nrow];\n\n  TReal* block = (TReal*)calloc(nrow * ncol, sizeof(TReal));\n  m[0] = block;\n  for (int row = 1; row < nrow; ++row)\n  {\n    m[row] = &block[row * ncol];\n  }\n  return m;\n}\n\n/* free a TReal matrix allocated with matrix() */\ntemplate <class TReal> void free_matrix(TReal** m)\n{\n  free(m[0]);\n  delete[] m;\n}\n\n} // namespace\n\nint main(int, char*[])\n{\n  // Create this matrix\n  // 1 2 3\n  // 2 5 9\n  // 3 9 8\n\n  double** a = create_matrix<double>(3, 3);\n  a[0][0] = 1;\n  a[0][1] = 2;\n  a[0][2] = 3;\n  a[1][0] = 2;\n  a[1][1] = 5;\n  a[1][2] = 9;\n  a[2][0] = 3;\n  a[2][1] = 9;\n  a[2][2] = 8;\n\n  // create a matrix for the eigenvectors to be stored in\n  double** w = create_matrix<double>(3, 3);\n\n  // create a vector for the eigenvalues to be stored in\n  double v[3];\n\n  // compute the eigenvalues/vectors\n  vtkMath::Jacobi(a, v, w);\n\n  // output eigen values\n  std::cout << \"Eigen values (decreasing order): \" << std::endl;\n  for (int i = 0; i < 3; i++)\n  {\n    std::cout << v[i] << \" \";\n  }\n\n  // output eigenvectors\n  std::cout << \"Eigen vectors (same order as eigen values): \" << std::endl;\n  for (int i = 0; i < 3; i++)\n  {\n    // the columns of w are the eigenvectors\n    std::cout << \"Eigen vector \" << i << \" : \" << w[0][i] << \" \" << w[1][i]\n              << \" \" << w[2][i] << std::endl;\n  }\n\n  // clean up\n  free_matrix(w);\n  free_matrix(a);\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Math/EigenSymmetric/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EigenSymmetric)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EigenSymmetric: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EigenSymmetric MACOSX_BUNDLE EigenSymmetric.cxx )\n  target_link_libraries(EigenSymmetric PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EigenSymmetric\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/EigenSymmetric/#download-and-build-eigensymmetric","title":"Download and Build EigenSymmetric","text":"

        Click here to download EigenSymmetric and its CMakeLists.txt file. Once the tarball EigenSymmetric.tar has been downloaded and extracted,

        cd EigenSymmetric/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./EigenSymmetric\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/HomogeneousLeastSquares/","title":"HomogeneousLeastSquares","text":"

        vtk-examples/Cxx/Math/HomogeneousLeastSquares

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/HomogeneousLeastSquares/#code","title":"Code","text":"

        HomogeneousLeastSquares.cxx

        #include <vtkMath.h>\n\nnamespace {\n/* allocate memory for an nrow x ncol matrix */\ntemplate <class TReal> TReal** create_matrix(long nrow, long ncol)\n{\n  typedef TReal* TRealPointer;\n  TReal** m = new TRealPointer[nrow];\n\n  TReal* block = (TReal*)calloc(nrow * ncol, sizeof(TReal));\n  m[0] = block;\n  for (int row = 1; row < nrow; ++row)\n  {\n    m[row] = &block[row * ncol];\n  }\n  return m;\n}\n\n/* free a TReal matrix allocated with matrix() */\ntemplate <class TReal> void free_matrix(TReal** m)\n{\n  free(m[0]);\n  delete[] m;\n}\n\n} // namespace\n\nint main(int, char*[])\n{\n\n  // Solve XM = Y;\n\n  int numberOfSamples = 3;\n  int numberOfVariables = 2;\n  double** x = create_matrix<double>(numberOfSamples, numberOfVariables);\n  x[0][0] = 1;\n  x[0][1] = 2;\n  x[1][0] = 2;\n  x[1][1] = 4;\n  x[2][0] = 3;\n  x[2][1] = 6;\n\n  double** m = create_matrix<double>(numberOfVariables, 1);\n\n  vtkMath::SolveHomogeneousLeastSquares(numberOfSamples, x, numberOfVariables,\n                                        m);\n\n  std::cout << \"Solution is: \" << m[0][0] << \" \" << m[1][0] << std::endl;\n\n  free_matrix(x);\n  free_matrix(m);\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Math/HomogeneousLeastSquares/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HomogeneousLeastSquares)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HomogeneousLeastSquares: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HomogeneousLeastSquares MACOSX_BUNDLE HomogeneousLeastSquares.cxx )\n  target_link_libraries(HomogeneousLeastSquares PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HomogeneousLeastSquares\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/HomogeneousLeastSquares/#download-and-build-homogeneousleastsquares","title":"Download and Build HomogeneousLeastSquares","text":"

        Click here to download HomogeneousLeastSquares and its CMakeLists.txt file. Once the tarball HomogeneousLeastSquares.tar has been downloaded and extracted,

        cd HomogeneousLeastSquares/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HomogeneousLeastSquares\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/LUFactorization/","title":"LUFactorization","text":"

        vtk-examples/Cxx/Math/LUFactorization

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/LUFactorization/#code","title":"Code","text":"

        LUFactorization.cxx

        #include <vtkMath.h>\n\nnamespace {\ntemplate <class TReal> TReal** create_matrix(long nrow, long ncol)\n{\n  typedef TReal* TRealPointer;\n  TReal** m = new TRealPointer[nrow];\n\n  TReal* block = (TReal*)calloc(nrow * ncol, sizeof(TReal));\n  m[0] = block;\n  for (int row = 1; row < nrow; ++row)\n  {\n    m[row] = &block[row * ncol];\n  }\n  return m;\n}\n\n/* free a TReal matrix allocated with matrix() */\ntemplate <class TReal> void free_matrix(TReal** m)\n{\n  free(m[0]);\n  delete[] m;\n}\n\nvoid OutputMatrix(double** a)\n{\n  std::cout << \"[ \" << a[0][0] << \" \" << a[0][1] << std::endl;\n  std::cout << \"  \" << a[1][0] << \" \" << a[1][1] << \" ]\" << std::endl;\n}\n} // namespace\n\nint main(int, char*[])\n{\n  // Create and populate matrix\n  int n = 2;\n  double** a = create_matrix<double>(n, n);\n  a[0][0] = 4;\n  a[0][1] = 3;\n  a[1][0] = 6;\n  a[1][1] = 3;\n\n  //[4 3; 6 3] should decompose to [1 0; 1.5 1] * [4 3; 0 -1.5]\n\n  std::cout << \"a\" << std::endl;\n  OutputMatrix(a);\n\n  // These values do not seem to change the result?\n  int pivotIndices[2] = {0, 0};\n\n  // Decompose matrix A into LU form\n  vtkMath::LUFactorLinearSystem(a, pivotIndices, n);\n\n  std::cout << \"A decomposed into (unit lower triangular) L and U:\"\n            << std::endl;\n  OutputMatrix(a);\n\n  /* The resulting matrix,\n   [6       3]\n   [.66667  1]\n   is a superposition of L and U, with L being a unit lower triangular matrix.\n   That is, ones on the diagonal, zeros in the upper right triangle, and values\n  in the lower left triangle.\n\n  The diagonal of the resulting A is the diagonal of U. The upper right triangle\n  of A is the upper right triangle of U. The lower left triangle of A is the\n  lower left triangle of L (and remember, the diagonal of L is all 1's).\n  */\n\n  /*\n  To show that the resulting interpretation of the output matrix A is correct,\n  we form the matrices following the description above and show that they\n  multiply to the original A matrix. octave:9> [1 0; .666667 1] * [6 3; 0 1] ans\n  =\n\n   6.0000   3.0000\n   4.0000   3.0000\n  */\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Math/LUFactorization/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LUFactorization)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LUFactorization: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LUFactorization MACOSX_BUNDLE LUFactorization.cxx )\n  target_link_libraries(LUFactorization PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LUFactorization\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/LUFactorization/#download-and-build-lufactorization","title":"Download and Build LUFactorization","text":"

        Click here to download LUFactorization and its CMakeLists.txt file. Once the tarball LUFactorization.tar has been downloaded and extracted,

        cd LUFactorization/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LUFactorization\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/LeastSquares/","title":"LeastSquares","text":"

        vtk-examples/Cxx/Math/LeastSquares

        "},{"location":"Cxx/Math/LeastSquares/#description","title":"Description","text":"

        This example solves XM = Y (an interesting way to write Ax = b).

        In particular, we are trying to solve

        [4]     [-2](1)\n\n[2] M = [6](1)\n\n[3]     [1](2)\n

        It currently does not work.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/LeastSquares/#code","title":"Code","text":"

        LeastSquares.cxx

        #include <vtkMath.h>\n\nnamespace {\n/* allocate memory for an nrow x ncol matrix */\ntemplate <class TReal> TReal** create_matrix(long nrow, long ncol)\n{\n  typedef TReal* TRealPointer;\n  TReal** m = new TRealPointer[nrow];\n\n  TReal* block = (TReal*)calloc(nrow * ncol, sizeof(TReal));\n  m[0] = block;\n  for (int row = 1; row < nrow; ++row)\n  {\n    m[row] = &block[row * ncol];\n  }\n  return m;\n}\n\n/* free a TReal matrix allocated with matrix() */\ntemplate <class TReal> void free_matrix(TReal** m)\n{\n  free(m[0]);\n  delete[] m;\n}\n} // namespace\n\nint main(int, char*[])\n{\n\n  // Solve XM = Y;\n\n  int numberOfSamples = 3;\n  int numberOfVariables = 2;\n  double** x = create_matrix<double>(numberOfSamples, numberOfVariables);\n  x[0][0] = 1;\n  x[0][1] = 4;\n  x[1][0] = 1;\n  x[1][1] = 2;\n  x[2][0] = 2;\n  x[2][1] = 3;\n\n  double** m = create_matrix<double>(numberOfVariables, 1);\n\n  double** y = create_matrix<double>(numberOfSamples, 1);\n  y[0][0] = -2;\n  y[1][0] = 6;\n  y[2][0] = 1;\n\n  vtkMath::SolveLeastSquares(numberOfSamples, x, numberOfVariables, y, 1, m);\n\n  std::cout << \"Solution is: \" << m[0][0] << \" \" << m[1][0] << std::endl;\n\n  // Solution should be [3; -1];\n  free_matrix(x);\n  free_matrix(m);\n  free_matrix(y);\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Math/LeastSquares/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LeastSquares)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LeastSquares: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LeastSquares MACOSX_BUNDLE LeastSquares.cxx )\n  target_link_libraries(LeastSquares PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LeastSquares\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/LeastSquares/#download-and-build-leastsquares","title":"Download and Build LeastSquares","text":"

        Click here to download LeastSquares and its CMakeLists.txt file. Once the tarball LeastSquares.tar has been downloaded and extracted,

        cd LeastSquares/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LeastSquares\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/MatrixInverse/","title":"MatrixInverse","text":"

        vtk-examples/Cxx/Math/MatrixInverse

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/MatrixInverse/#code","title":"Code","text":"

        MatrixInverse.cxx

        #include <vtkMatrix3x3.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMatrix3x3> m;\n\n  m->SetElement(2, 1, 2.0); // Set element (0,0) to 1.0\n\n  std::cout << *m << std::endl;\n\n  m->Invert();\n\n  std::cout << *m << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Math/MatrixInverse/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MatrixInverse)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonMath\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MatrixInverse: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MatrixInverse MACOSX_BUNDLE MatrixInverse.cxx )\n  target_link_libraries(MatrixInverse PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MatrixInverse\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/MatrixInverse/#download-and-build-matrixinverse","title":"Download and Build MatrixInverse","text":"

        Click here to download MatrixInverse and its CMakeLists.txt file. Once the tarball MatrixInverse.tar has been downloaded and extracted,

        cd MatrixInverse/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MatrixInverse\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/MatrixTranspose/","title":"MatrixTranspose","text":"

        vtk-examples/Cxx/Math/MatrixTranspose

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/MatrixTranspose/#code","title":"Code","text":"

        MatrixTranspose.cxx

        #include <vtkMatrix3x3.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMatrix3x3> m;\n\n  m->SetElement(2, 1, 2.0); // Set element (2,1) to 2.0\n\n  std::cout << *m << std::endl;\n\n  m->Transpose();\n\n  std::cout << *m << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Math/MatrixTranspose/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MatrixTranspose)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonMath\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MatrixTranspose: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MatrixTranspose MACOSX_BUNDLE MatrixTranspose.cxx )\n  target_link_libraries(MatrixTranspose PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MatrixTranspose\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/MatrixTranspose/#download-and-build-matrixtranspose","title":"Download and Build MatrixTranspose","text":"

        Click here to download MatrixTranspose and its CMakeLists.txt file. Once the tarball MatrixTranspose.tar has been downloaded and extracted,

        cd MatrixTranspose/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MatrixTranspose\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/NormalizeVector/","title":"NormalizeVector","text":"

        vtk-examples/Cxx/Math/NormalizeVector

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/NormalizeVector/#code","title":"Code","text":"

        NormalizeVector.cxx

        #include <vtkMath.h>\n\nint main(int, char*[])\n{\n  double a[3] = {100.0, 2.0, 1.0};\n  std::cout << a[0] << \" \" << a[1] << \" \" << a[2] << std::endl;\n  vtkMath::Normalize(a);\n  std::cout << a[0] << \" \" << a[1] << \" \" << a[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Math/NormalizeVector/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NormalizeVector)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NormalizeVector: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NormalizeVector MACOSX_BUNDLE NormalizeVector.cxx )\n  target_link_libraries(NormalizeVector PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NormalizeVector\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/NormalizeVector/#download-and-build-normalizevector","title":"Download and Build NormalizeVector","text":"

        Click here to download NormalizeVector and its CMakeLists.txt file. Once the tarball NormalizeVector.tar has been downloaded and extracted,

        cd NormalizeVector/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./NormalizeVector\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/PerpendicularVector/","title":"PerpendicularVector","text":"

        vtk-examples/Cxx/Math/PerpendicularVector

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/PerpendicularVector/#code","title":"Code","text":"

        PerpendicularVector.cxx

        #include <vtkMath.h>\n\nint main(int, char*[])\n{\n  double x[3] = {1, 0, 0};\n  double y[3];\n  vtkMath::Perpendiculars(x, y, nullptr, 0);\n\n  std::cout << \"y: \" << y[0] << \" \" << y[1] << \" \" << y[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Math/PerpendicularVector/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PerpendicularVector)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PerpendicularVector: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PerpendicularVector MACOSX_BUNDLE PerpendicularVector.cxx )\n  target_link_libraries(PerpendicularVector PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PerpendicularVector\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/PerpendicularVector/#download-and-build-perpendicularvector","title":"Download and Build PerpendicularVector","text":"

        Click here to download PerpendicularVector and its CMakeLists.txt file. Once the tarball PerpendicularVector.tar has been downloaded and extracted,

        cd PerpendicularVector/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PerpendicularVector\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/VectorDot/","title":"VectorDot","text":"

        vtk-examples/Cxx/Math/VectorDot

        "},{"location":"Cxx/Math/VectorDot/#description","title":"Description","text":"

        Note that the filter maps the values to a scalar range. In the example, the values of the dot products are:

         1, .707, 0\n

        The filter outputs

         1, .414, -1\n

        because the default scalar range that the filter maps the values to is (-1,1).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/VectorDot/#code","title":"Code","text":"

        VectorDot.cxx

        #include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkVectorDot.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  // Generate data\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(2, 0, 0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Add normals\n  vtkNew<vtkFloatArray> normals;\n  normals->SetNumberOfComponents(3);\n  normals->SetName(\"Normals\");\n\n  float n0[3] = {1, 0, 0};\n  float n1[3] = {1, 0, 0};\n  float n2[3] = {1, 0, 0};\n  normals->InsertNextTupleValue(n0);\n  normals->InsertNextTupleValue(n1);\n  normals->InsertNextTupleValue(n2);\n\n  polydata->GetPointData()->SetNormals(normals);\n\n  // Add vectors.\n  vtkNew<vtkFloatArray> vectors;\n  vectors->SetNumberOfComponents(3);\n  vectors->SetName(\"Vectors\");\n\n  float v0[3] = {1, 0, 0};\n  float v1[3] = {.707f, .707f, 0};\n  float v2[3] = {0, 1, 0};\n  vectors->InsertNextTupleValue(v0);\n  vectors->InsertNextTupleValue(v1);\n  vectors->InsertNextTupleValue(v2);\n\n  polydata->GetPointData()->SetVectors(vectors);\n\n  // Compute the dot products between normals and vectors.\n  vtkNew<vtkVectorDot> vectorDot;\n  vectorDot->SetInputData(polydata);\n  vectorDot->Update();\n\n  // Get the results.\n  auto scalars = dynamic_cast<vtkFloatArray*>(\n      vectorDot->GetOutput()->GetPointData()->GetScalars());\n\n  // Output the results.\n  for (vtkIdType i = 0; i < scalars->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Value \" << i << \" : \" << scalars->GetValue(i) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Math/VectorDot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorDot)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorDot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorDot MACOSX_BUNDLE VectorDot.cxx )\n  target_link_libraries(VectorDot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorDot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/VectorDot/#download-and-build-vectordot","title":"Download and Build VectorDot","text":"

        Click here to download VectorDot and its CMakeLists.txt file. Once the tarball VectorDot.tar has been downloaded and extracted,

        cd VectorDot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VectorDot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Math/VectorNorm/","title":"VectorNorm","text":"

        vtk-examples/Cxx/Math/VectorNorm

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Math/VectorNorm/#code","title":"Code","text":"

        VectorNorm.cxx

        #include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkVectorNorm.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1, 2, 3);\n  points->InsertNextPoint(4, 5, 6);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkFloatArray> distances;\n  distances->SetNumberOfComponents(3);\n  distances->SetName(\"Distances\");\n\n  float v1[3] = {1, 2, 3};\n  float v2[3] = {4, 5, 6};\n  distances->InsertNextTupleValue(v1);\n  distances->InsertNextTupleValue(v2);\n\n  polydata->GetPointData()->SetVectors(distances);\n\n  vtkNew<vtkVectorNorm> vectorNorm;\n  vectorNorm->SetInputData(polydata);\n  vectorNorm->Update();\n\n  vtkFloatArray* scalars = dynamic_cast<vtkFloatArray*>(\n      vectorNorm->GetOutput()->GetPointData()->GetScalars());\n\n  for (vtkIdType i = 0; i < scalars->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Value \" << i << \" : \" << scalars->GetValue(i) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Math/VectorNorm/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorNorm)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorNorm: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorNorm MACOSX_BUNDLE VectorNorm.cxx )\n  target_link_libraries(VectorNorm PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorNorm\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Math/VectorNorm/#download-and-build-vectornorm","title":"Download and Build VectorNorm","text":"

        Click here to download VectorNorm and its CMakeLists.txt file. Once the tarball VectorNorm.tar has been downloaded and extracted,

        cd VectorNorm/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VectorNorm\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Matlab/MatlabEngineFilter/","title":"MatlabEngineFilter","text":"

        vtk-examples/Cxx/Matlab/MatlabEngineFilter

        "},{"location":"Cxx/Matlab/MatlabEngineFilter/#description","title":"Description","text":"

        This example currently does nothing.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Matlab/MatlabEngineFilter/#code","title":"Code","text":"

        MatlabEngineFilter.cxx

        // need to set VTK_USE_MATLAB_MEX ON\n\n#include <vtkMatlabEngineFilter.h>\n#include <vtkNew.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkMatlabEngineFilter> matlabFilter;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Matlab/MatlabEngineFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MatlabEngineFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MatlabEngineFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MatlabEngineFilter MACOSX_BUNDLE MatlabEngineFilter.cxx )\n  target_link_libraries(MatlabEngineFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MatlabEngineFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Matlab/MatlabEngineFilter/#download-and-build-matlabenginefilter","title":"Download and Build MatlabEngineFilter","text":"

        Click here to download MatlabEngineFilter and its CMakeLists.txt file. Once the tarball MatlabEngineFilter.tar has been downloaded and extracted,

        cd MatlabEngineFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MatlabEngineFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Medical/GenerateCubesFromLabels/","title":"GenerateCubesFromLabels","text":"

        vtk-examples/Cxx/Medical/GenerateCubesFromLabels

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Medical/GenerateCubesFromLabels/#description","title":"Description","text":"

        Sometimes it is helpful to view the results of a segmentation without any post processing. This example converts the point data from a labeled volume into cell data. The surfaces are displayed as vtkPolydata. If you want to created smoothed polydata models from your segmented volumes, see the example GenerateModelsFromLabels. The input volume must be in MetaIO format.

         Usage: GenerateCubesFromLabels InputVolume.mhd StartLabel EndLabel\n      where\n        InputVolume is a meta file containing a 3 volume of discrete labels.\n        StartLabel is the first label to be processed\n        EndLabel is the last label to be processed\n        NOTE: There can be gaps in the labeling. If a label does not exist in the volume, it will be skipped.\n

        Note

        This original source code for this example is here.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Medical/GenerateCubesFromLabels/#code","title":"Code","text":"

        GenerateCubesFromLabels.cxx

        //\n// GenerateCubesFromLabels\n//   Usage: GenerateCubesFromLabels InputVolume Startlabel Endlabel\n//          where\n//          InputVolume is a meta file containing a 3 volume of\n//            discrete labels.\n//          StartLabel is the first label to be processed\n//          EndLabel is the last label to be processed\n//          NOTE: There can be gaps in the labeling. If a label does\n//          not exist in the volume, it will be skipped.\n//\n//\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkGeometryFilter.h>\n#include <vtkImageData.h>\n#include <vtkImageWrapPad.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkThreshold.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n\n#include <iostream>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 4)\n  {\n    std::cout\n        << \"Usage: \" << argv[0]\n        << \" InputVolume StartLabel EndLabel e.g. Frog/frogtissue.mhd 1 29\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Define all of the variables\n  unsigned int startLabel = atoi(argv[2]);\n  unsigned int endLabel = atoi(argv[3]);\n\n  // Generate cubes from labels.\n  // 1) Read the meta file\n  // 2) Convert point data to cell data\n  // 3) Convert to geometry and display\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Pad the volume so that we can change the point data into cell.\n  // data.\n  int* extent = reader->GetOutput()->GetExtent();\n  vtkNew<vtkImageWrapPad> pad;\n  pad->SetInputConnection(reader->GetOutputPort());\n  pad->SetOutputWholeExtent(extent[0], extent[1] + 1, extent[2], extent[3] + 1,\n                            extent[4], extent[5] + 1);\n  pad->Update();\n\n  // Copy the scalar point data of the volume into the scalar cell data.\n  pad->GetOutput()->GetCellData()->SetScalars(\n      reader->GetOutput()->GetPointData()->GetScalars());\n\n  vtkNew<vtkThreshold> selector;\n  selector->SetInputArrayToProcess(0, 0, 0,\n                                   vtkDataObject::FIELD_ASSOCIATION_CELLS,\n                                   vtkDataSetAttributes::SCALARS);\n  selector->SetInputConnection(pad->GetOutputPort());\n  selector->SetLowerThreshold(startLabel);\n  selector->SetUpperThreshold(endLabel);\n  selector->Update();\n\n  // Shift the geometry by 1/2.\n  vtkNew<vtkTransform> transform;\n  transform->Translate(-0.5, -0.5, -0.5);\n\n  vtkNew<vtkTransformFilter> transformModel;\n  transformModel->SetTransform(transform);\n  transformModel->SetInputConnection(selector->GetOutputPort());\n\n  vtkNew<vtkGeometryFilter> geometry;\n  geometry->SetInputConnection(transformModel->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometry->GetOutputPort());\n  mapper->SetScalarRange(startLabel, endLabel);\n  mapper->SetScalarModeToUseCellData();\n  mapper->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"GenerateCubesFromLabels\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateBlue\").GetData());\n  renderWindow->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(42.301174, 939.893457, -124.005030);\n  camera->SetFocalPoint(224.697134, 221.301653, 146.823706);\n  camera->SetViewUp(0.262286, -0.281321, -0.923073);\n  camera->SetDistance(789.297581);\n  camera->SetClippingRange(168.744328, 1509.660206);\n\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Medical/GenerateCubesFromLabels/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GenerateCubesFromLabels)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GenerateCubesFromLabels: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GenerateCubesFromLabels MACOSX_BUNDLE GenerateCubesFromLabels.cxx )\n  target_link_libraries(GenerateCubesFromLabels PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GenerateCubesFromLabels\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Medical/GenerateCubesFromLabels/#download-and-build-generatecubesfromlabels","title":"Download and Build GenerateCubesFromLabels","text":"

        Click here to download GenerateCubesFromLabels and its CMakeLists.txt file. Once the tarball GenerateCubesFromLabels.tar has been downloaded and extracted,

        cd GenerateCubesFromLabels/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GenerateCubesFromLabels\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Medical/GenerateModelsFromLabels/","title":"GenerateModelsFromLabels","text":"

        vtk-examples/Cxx/Medical/GenerateModelsFromLabels

        "},{"location":"Cxx/Medical/GenerateModelsFromLabels/#description","title":"Description","text":"

        This example uses vtkDiscreteFlyingEdges3D or vtkDiscreteMarchingCubes to create vtkPolyData models from a 3D volume that contains discrete labels. These volumes are normally the output of a segmentation algorithm. The polydata for each label will be output into a separate file.

        You can load these files into ParaView, where they will appear as a series of time steps. You can then single step through displaying the polydate from each file making up the series.

        If you want to see the segmentation results as cube models, see the example GenerateCubesFromLabels

        The input volume must be in MetaIO format.

        Once you generate the models, you can view them with Paraview

        Note

        This original source code for this example is here.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Medical/GenerateModelsFromLabels/#code","title":"Code","text":"

        GenerateModelsFromLabels.cxx

        //\n// GenerateModelsFromLabels\n//   Usage: GenerateModelsFromLabels InputVolume Startlabel Endlabel\n//          where\n//          InputVolume is a meta file containing a 3 volume of\n//            discrete labels.\n//          StartLabel is the first label to be processed\n//          EndLabel is the last label to be processed\n//          NOTE: There can be gaps in the labeling. If a label does\n//          not exist in the volume, it will be skipped.\n//\n//\n#include <vtkGeometryFilter.h>\n#include <vtkImageAccumulate.h>\n#include <vtkImageData.h>\n#include <vtkMaskFields.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkThreshold.h>\n#include <vtkVersion.h>\n#include <vtkWindowedSincPolyDataFilter.h>\n#include <vtkXMLPolyDataWriter.h>\n\n// vtkDiscreteFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n// #undef USE_FLYING_EDGES\n\n#ifdef USE_FLYING_EDGES\n#include <vtkDiscreteFlyingEdges3D.h>\n#else\n#include <vtkDiscreteMarchingCubes.h>\n#endif\n\n#include <sstream>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 4)\n  {\n    std::cout\n        << \"Usage: \" << argv[0]\n        << \" InputVolume StartLabel EndLabel  e.g. Frog/frogtissue.mhd 1 29\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create all of the classes we will need.\n  vtkNew<vtkMetaImageReader> reader;\n  vtkNew<vtkImageAccumulate> histogram;\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkDiscreteFlyingEdges3D> discreteCubes;\n#else\n  vtkNew<vtkDiscreteMarchingCubes> discreteCubes;\n#endif\n  vtkNew<vtkWindowedSincPolyDataFilter> smoother;\n  vtkNew<vtkThreshold> selector;\n  vtkNew<vtkMaskFields> scalarsOff;\n  vtkNew<vtkGeometryFilter> geometry;\n  vtkNew<vtkXMLPolyDataWriter> writer;\n\n  // Define all of the variables\n  unsigned int startLabel = atoi(argv[2]);\n  unsigned int endLabel = atoi(argv[3]);\n  std::string filePrefix = \"Label\";\n  unsigned int smoothingIterations = 15;\n  double passBand = 0.001;\n  double featureAngle = 120.0;\n\n  // Generate models from labels.\n  // 1) Read the meta file\n  // 2) Generate a histogram of the labels\n  // 3) Generate models from the labeled volume\n  // 4) Smooth the models\n  // 5) Output each model into a separate file\n\n  reader->SetFileName(argv[1]);\n\n  histogram->SetInputConnection(reader->GetOutputPort());\n  histogram->SetComponentExtent(0, endLabel, 0, 0, 0, 0);\n  histogram->SetComponentOrigin(0, 0, 0);\n  histogram->SetComponentSpacing(1, 1, 1);\n  histogram->Update();\n\n  discreteCubes->SetInputConnection(reader->GetOutputPort());\n  discreteCubes->GenerateValues(endLabel - startLabel + 1, startLabel,\n                                endLabel);\n\n  smoother->SetInputConnection(discreteCubes->GetOutputPort());\n  smoother->SetNumberOfIterations(smoothingIterations);\n  smoother->BoundarySmoothingOff();\n  smoother->FeatureEdgeSmoothingOff();\n  smoother->SetFeatureAngle(featureAngle);\n  smoother->SetPassBand(passBand);\n  smoother->NonManifoldSmoothingOn();\n  smoother->NormalizeCoordinatesOn();\n  smoother->Update();\n\n  selector->SetInputConnection(smoother->GetOutputPort());\n#ifdef USE_FLYING_EDGES\n  selector->SetInputArrayToProcess(0, 0, 0,\n                                   vtkDataObject::FIELD_ASSOCIATION_POINTS,\n                                   vtkDataSetAttributes::SCALARS);\n#else\n  selector->SetInputArrayToProcess(0, 0, 0,\n                                   vtkDataObject::FIELD_ASSOCIATION_CELLS,\n                                   vtkDataSetAttributes::SCALARS);\n#endif\n\n  // Strip the scalars from the output\n  scalarsOff->SetInputConnection(selector->GetOutputPort());\n  scalarsOff->CopyAttributeOff(vtkMaskFields::POINT_DATA,\n                               vtkDataSetAttributes::SCALARS);\n  scalarsOff->CopyAttributeOff(vtkMaskFields::CELL_DATA,\n                               vtkDataSetAttributes::SCALARS);\n\n  geometry->SetInputConnection(scalarsOff->GetOutputPort());\n\n  writer->SetInputConnection(geometry->GetOutputPort());\n\n  for (unsigned int i = startLabel; i <= endLabel; i++)\n  {\n    // see if the label exists, if not skip it\n    double frequency =\n        histogram->GetOutput()->GetPointData()->GetScalars()->GetTuple1(i);\n    if (frequency == 0.0)\n    {\n      continue;\n    }\n\n    // select the cells for a given label\n    selector->SetLowerThreshold(i);\n    selector->SetUpperThreshold(i);\n\n    // output the polydata\n    std::stringstream ss;\n    ss << filePrefix << i << \".vtp\";\n    std::cout << argv[0] << \" writing \" << ss.str() << std::endl;\n\n    writer->SetFileName(ss.str().c_str());\n    writer->Write();\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Medical/GenerateModelsFromLabels/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GenerateModelsFromLabels)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOImage\n  IOXML\n  ImagingStatistics\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GenerateModelsFromLabels: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GenerateModelsFromLabels MACOSX_BUNDLE GenerateModelsFromLabels.cxx )\n  target_link_libraries(GenerateModelsFromLabels PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GenerateModelsFromLabels\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Medical/GenerateModelsFromLabels/#download-and-build-generatemodelsfromlabels","title":"Download and Build GenerateModelsFromLabels","text":"

        Click here to download GenerateModelsFromLabels and its CMakeLists.txt file. Once the tarball GenerateModelsFromLabels.tar has been downloaded and extracted,

        cd GenerateModelsFromLabels/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GenerateModelsFromLabels\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Medical/MedicalDemo1/","title":"MedicalDemo1","text":"

        vtk-examples/Cxx/Medical/MedicalDemo1

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Medical/MedicalDemo1/#description","title":"Description","text":"

        The skin extracted from a CT dataset of the head.

        usage

        MedicalDemo1 FullHead.mhd

        Note

        The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

        Note

        This original source code for this example is here.

        Info

        See Figure 12-2 in Chapter 12 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Medical/MedicalDemo1/#code","title":"Code","text":"

        MedicalDemo1.cxx

        // Derived from VTK/Examples/Cxx/Medical1.cxx\n// This example reads a volume dataset, extracts an isosurface that\n// represents the skin and displays it.\n//\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> skinColor{{240, 184, 160, 255}};\n  colors->SetColor(\"SkinColor\", skinColor.data());\n  std::array<unsigned char, 4> backColor{{255, 229, 200, 255}};\n  colors->SetColor(\"BackfaceColor\", backColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the renderer, the render window, and the interactor. The renderer\n  // draws into the render window, the interactor enables mouse- and\n  // keyboard-based interaction with the data within the render window.\n  //\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // An isosurface, or contour value of 500 is known to correspond to the\n  // skin of the patient.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> skinExtractor;\n#else\n  vtkNew<vtkMarchingCubes> skinExtractor;\n#endif\n\n  skinExtractor->SetInputConnection(reader->GetOutputPort());\n  skinExtractor->SetValue(0, 500);\n\n  vtkNew<vtkPolyDataMapper> skinMapper;\n  skinMapper->SetInputConnection(skinExtractor->GetOutputPort());\n  skinMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> skin;\n  skin->SetMapper(skinMapper);\n  skin->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"SkinColor\").GetData());\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"BackfaceColor\").GetData());\n  skin->SetBackfaceProperty(backProp);\n\n  // An outline provides context around the data.\n  //\n  vtkNew<vtkOutlineFilter> outlineData;\n  outlineData->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outlineData->GetOutputPort());\n\n  vtkNew<vtkActor> outline;\n  outline->SetMapper(mapOutline);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // It is convenient to create an initial view of the data. The FocalPoint\n  // and Position form a vector direction. Later on (ResetCamera() method)\n  // this vector is used to position the camera to look at the data in\n  // this direction.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n\n  // Actors are added to the renderer. An initial camera view is created.\n  // The Dolly() method moves the camera towards the FocalPoint,\n  // thereby enlarging the image.\n  aRenderer->AddActor(outline);\n  aRenderer->AddActor(skin);\n  aRenderer->SetActiveCamera(aCamera);\n  aRenderer->ResetCamera();\n  aCamera->Dolly(1.5);\n\n  // Set a background color for the renderer and set the size of the\n  // render window (expressed in pixels).\n  aRenderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"MedicalDemo1\");\n\n  // Note that when camera movement occurs (as it does in the Dolly()\n  // method), the clipping planes often need adjusting. Clipping planes\n  // consist of two planes: near and far along the view direction. The\n  // near plane clips out objects in front of the plane; the far plane\n  // clips out objects behind the plane. This way only what is drawn\n  // between the planes is actually rendered.\n  aRenderer->ResetCameraClippingRange();\n\n  // Initialize the event loop and then start it.\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Medical/MedicalDemo1/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MedicalDemo1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MedicalDemo1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MedicalDemo1 MACOSX_BUNDLE MedicalDemo1.cxx )\n  target_link_libraries(MedicalDemo1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MedicalDemo1\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Medical/MedicalDemo1/#download-and-build-medicaldemo1","title":"Download and Build MedicalDemo1","text":"

        Click here to download MedicalDemo1 and its CMakeLists.txt file. Once the tarball MedicalDemo1.tar has been downloaded and extracted,

        cd MedicalDemo1/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MedicalDemo1\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Medical/MedicalDemo2/","title":"MedicalDemo2","text":"

        vtk-examples/Cxx/Medical/MedicalDemo2

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Medical/MedicalDemo2/#description","title":"Description","text":"

        Skin and bone isosurfaces.

        Usage

        MedicalDemo2 FullHead.mhd

        Note

        The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

        Note

        This original source code for this example is here.

        Info

        See Figure 12-3 in Chapter 12 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Medical/MedicalDemo2/#code","title":"Code","text":"

        MedicalDemo2.cxx

        // Derived from VTK/Examples/Cxx/Medical2.cxx\n// This example reads a volume dataset, extracts two isosurfaces that\n// represent the skin and bone, and then displays them.\n//\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the colors.\n  std::array<unsigned char, 4> skinColor{{240, 184, 160, 255}};\n  colors->SetColor(\"SkinColor\", skinColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the renderer, the render window, and the interactor. The renderer\n  // draws into the render window, the interactor enables mouse- and\n  // keyboard-based interaction with the data within the render window.\n  //\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // The following reader is used to read a series of 2D slices (images)\n  // that compose the volume. The slice dimensions are set, and the\n  // pixel spacing. The data Endianness must also be specified. The reader\n  // uses the FilePrefix in combination with the slice number to construct\n  // filenames using the format FilePrefix.%d. (In this case the FilePrefix\n  // is the root name of the file: quarter.)\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // An isosurface, or contour value of 500 is known to correspond to the\n  // skin of the patient.\n  // The triangle stripper is used to create triangle strips from the\n  // isosurface; these render much faster on many systems.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> skinExtractor;\n#else\n  vtkNew<vtkMarchingCubes> skinExtractor;\n#endif\n  skinExtractor->SetInputConnection(reader->GetOutputPort());\n  skinExtractor->SetValue(0, 500);\n\n  vtkNew<vtkStripper> skinStripper;\n  skinStripper->SetInputConnection(skinExtractor->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> skinMapper;\n  skinMapper->SetInputConnection(skinStripper->GetOutputPort());\n  skinMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> skin;\n  skin->SetMapper(skinMapper);\n  skin->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"SkinColor\").GetData());\n  skin->GetProperty()->SetSpecular(0.3);\n  skin->GetProperty()->SetSpecularPower(20);\n  skin->GetProperty()->SetOpacity(0.5);\n\n  // An isosurface, or contour value of 1150 is known to correspond to the\n  // bone of the patient.\n  // The triangle stripper is used to create triangle strips from the\n  // isosurface; these render much faster on may systems.\n  vtkNew<vtkFlyingEdges3D> boneExtractor;\n  boneExtractor->SetInputConnection(reader->GetOutputPort());\n  boneExtractor->SetValue(0, 1150);\n\n  vtkNew<vtkStripper> boneStripper;\n  boneStripper->SetInputConnection(boneExtractor->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> boneMapper;\n  boneMapper->SetInputConnection(boneStripper->GetOutputPort());\n  boneMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> bone;\n  bone->SetMapper(boneMapper);\n  bone->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Ivory\").GetData());\n\n  // An outline provides context around the data.\n  //\n  vtkNew<vtkOutlineFilter> outlineData;\n  outlineData->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outlineData->GetOutputPort());\n\n  vtkNew<vtkActor> outline;\n  outline->SetMapper(mapOutline);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // It is convenient to create an initial view of the data. The FocalPoint\n  // and Position form a vector direction. Later on (ResetCamera() method)\n  // this vector is used to position the camera to look at the data in\n  // this direction.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n\n  // Actors are added to the renderer. An initial camera view is created.\n  // The Dolly() method moves the camera towards the FocalPoint,\n  // thereby enlarging the image.\n  aRenderer->AddActor(outline);\n  aRenderer->AddActor(skin);\n  aRenderer->AddActor(bone);\n  aRenderer->SetActiveCamera(aCamera);\n  aRenderer->ResetCamera();\n  aCamera->Dolly(1.5);\n\n  // Set a background color for the renderer and set the size of the\n  // render window (expressed in pixels).\n  aRenderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"MedicalDemo2\");\n\n  // Note that when camera movement occurs (as it does in the Dolly()\n  // method), the clipping planes often need adjusting. Clipping planes\n  // consist of two planes: near and far along the view direction. The\n  // near plane clips out objects in front of the plane; the far plane\n  // clips out objects behind the plane. This way only what is drawn\n  // between the planes is actually rendered.\n  aRenderer->ResetCameraClippingRange();\n\n  // Initialize the event loop and then start it.\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Medical/MedicalDemo2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MedicalDemo2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MedicalDemo2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MedicalDemo2 MACOSX_BUNDLE MedicalDemo2.cxx )\n  target_link_libraries(MedicalDemo2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MedicalDemo2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Medical/MedicalDemo2/#download-and-build-medicaldemo2","title":"Download and Build MedicalDemo2","text":"

        Click here to download MedicalDemo2 and its CMakeLists.txt file. Once the tarball MedicalDemo2.tar has been downloaded and extracted,

        cd MedicalDemo2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MedicalDemo2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Medical/MedicalDemo3/","title":"MedicalDemo3","text":"

        vtk-examples/Cxx/Medical/MedicalDemo3

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Medical/MedicalDemo3/#description","title":"Description","text":"

        Composite image of three planes and translucent skin

        Usage

        MedicalDemo3 FullHead.mhd

        Note

        The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

        Note

        This original source code for this example is here.

        Info

        See Figure 12-4 in Chapter 12 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Medical/MedicalDemo3/#code","title":"Code","text":"

        MedicalDemo3.cxx

        // Derived from VTK/Examples/Cxx/Medical3.cxx\n// This example reads a volume dataset, extracts two isosurfaces that\n// represent the skin and bone, creates three orthogonal planes\n// (sagittal, axial, coronal), and displays them.\n//\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkLookupTable.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd  e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> skinColor{{240, 184, 160, 255}};\n  colors->SetColor(\"SkinColor\", skinColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the renderer, the render window, and the interactor. The\n  // renderer draws into the render window, the interactor enables\n  // mouse- and keyboard-based interaction with the data within the\n  // render window.\n  //\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aRenderer);\n  renWin->SetWindowName(\"MedicalDemo3\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Set a background color for the renderer and set the size of the\n  // render window (expressed in pixels).\n  aRenderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renWin->SetSize(640, 480);\n\n  // The following reader is used to read a series of 2D slices (images)\n  // that compose the volume. The slice dimensions are set, and the\n  // pixel spacing. The data Endianness must also be specified. The\n  // reader uses the FilePrefix in combination with the slice number to\n  // construct filenames using the format FilePrefix.%d. (In this case\n  // the FilePrefix is the root name of the file: quarter.)\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // An isosurface, or contour value of 500 is known to correspond to\n  // the skin of the patient.\n  // The triangle stripper is used to create triangle\n  // strips from the isosurface; these render much faster on may\n  // systems.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> skinExtractor;\n#else\n  vtkNew<vtkMarchingCubes> skinExtractor;\n#endif\n  skinExtractor->SetInputConnection(reader->GetOutputPort());\n  skinExtractor->SetValue(0, 500);\n  skinExtractor->Update();\n\n  vtkNew<vtkStripper> skinStripper;\n  skinStripper->SetInputConnection(skinExtractor->GetOutputPort());\n  skinStripper->Update();\n\n  vtkNew<vtkPolyDataMapper> skinMapper;\n  skinMapper->SetInputConnection(skinStripper->GetOutputPort());\n  skinMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> skin;\n  skin->SetMapper(skinMapper);\n  skin->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"SkinColor\").GetData());\n  skin->GetProperty()->SetSpecular(0.3);\n  skin->GetProperty()->SetSpecularPower(20);\n\n  // An isosurface, or contour value of 1150 is known to correspond to\n  // the bone of the patient.\n  // The triangle stripper is used to create triangle\n  // strips from the isosurface; these render much faster on may\n  // systems.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> boneExtractor;\n#else\n  vtkNew<vtkMarchingCubes> boneExtractor;\n#endif\n  boneExtractor->SetInputConnection(reader->GetOutputPort());\n  boneExtractor->SetValue(0, 1150);\n\n  vtkNew<vtkStripper> boneStripper;\n  boneStripper->SetInputConnection(boneExtractor->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> boneMapper;\n  boneMapper->SetInputConnection(boneStripper->GetOutputPort());\n  boneMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> bone;\n  bone->SetMapper(boneMapper);\n  bone->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Ivory\").GetData());\n\n  // An outline provides context around the data.\n  //\n  vtkNew<vtkOutlineFilter> outlineData;\n  outlineData->SetInputConnection(reader->GetOutputPort());\n  outlineData->Update();\n\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outlineData->GetOutputPort());\n\n  vtkNew<vtkActor> outline;\n  outline->SetMapper(mapOutline);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Now we are creating three orthogonal planes passing through the\n  // volume. Each plane uses a different texture map and therefore has\n  // different coloration.\n\n  // Start by creating a black/white lookup table.\n  vtkNew<vtkLookupTable> bwLut;\n  bwLut->SetTableRange(0, 2000);\n  bwLut->SetSaturationRange(0, 0);\n  bwLut->SetHueRange(0, 0);\n  bwLut->SetValueRange(0, 1);\n  bwLut->Build(); // effective built\n\n  // Now create a lookup table that consists of the full hue circle\n  // (from HSV).\n  vtkNew<vtkLookupTable> hueLut;\n  hueLut->SetTableRange(0, 2000);\n  hueLut->SetHueRange(0, 1);\n  hueLut->SetSaturationRange(1, 1);\n  hueLut->SetValueRange(1, 1);\n  hueLut->Build(); // effective built\n\n  // Finally, create a lookup table with a single hue but having a range\n  // in the saturation of the hue.\n  vtkNew<vtkLookupTable> satLut;\n  satLut->SetTableRange(0, 2000);\n  satLut->SetHueRange(0.6, 0.6);\n  satLut->SetSaturationRange(0, 1);\n  satLut->SetValueRange(1, 1);\n  satLut->Build(); // effective built\n\n  // Create the first of the three planes. The filter vtkImageMapToColors\n  // maps the data through the corresponding lookup table created above. The\n  // vtkImageActor is a type of vtkProp and conveniently displays an image on\n  // a single quadrilateral plane. It does this using texture mapping and as\n  // a result is quite fast. (Note: the input image has to be unsigned char\n  // values, which the vtkImageMapToColors produces.) Note also that by\n  // specifying the DisplayExtent, the pipeline requests data of this extent\n  // and the vtkImageMapToColors only processes a slice of data.\n  vtkNew<vtkImageMapToColors> sagittalColors;\n  sagittalColors->SetInputConnection(reader->GetOutputPort());\n  sagittalColors->SetLookupTable(bwLut);\n  sagittalColors->Update();\n\n  vtkNew<vtkImageActor> sagittal;\n  sagittal->GetMapper()->SetInputConnection(sagittalColors->GetOutputPort());\n  sagittal->SetDisplayExtent(128, 128, 0, 255, 0, 92);\n  sagittal->ForceOpaqueOn();\n\n  // Create the second (axial) plane of the three planes. We use the\n  // same approach as before except that the extent differs.\n  vtkNew<vtkImageMapToColors> axialColors;\n  axialColors->SetInputConnection(reader->GetOutputPort());\n  axialColors->SetLookupTable(hueLut);\n  axialColors->Update();\n\n  vtkNew<vtkImageActor> axial;\n  axial->GetMapper()->SetInputConnection(axialColors->GetOutputPort());\n  axial->SetDisplayExtent(0, 255, 0, 255, 46, 46);\n  axial->ForceOpaqueOn();\n\n  // Create the third (coronal) plane of the three planes. We use\n  // the same approach as before except that the extent differs.\n  vtkNew<vtkImageMapToColors> coronalColors;\n  coronalColors->SetInputConnection(reader->GetOutputPort());\n  coronalColors->SetLookupTable(satLut);\n  coronalColors->Update();\n\n  vtkNew<vtkImageActor> coronal;\n  coronal->GetMapper()->SetInputConnection(coronalColors->GetOutputPort());\n  coronal->SetDisplayExtent(0, 255, 128, 128, 0, 92);\n  coronal->ForceOpaqueOn();\n\n  // It is convenient to create an initial view of the data. The\n  // FocalPoint and Position form a vector direction. Later on\n  // (ResetCamera() method) this vector is used to position the camera\n  // to look at the data in this direction.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n\n  // Actors are added to the renderer.\n  aRenderer->AddActor(outline);\n  aRenderer->AddActor(sagittal);\n  aRenderer->AddActor(axial);\n  aRenderer->AddActor(coronal);\n  aRenderer->AddActor(skin);\n  aRenderer->AddActor(bone);\n\n  // Turn off bone for this example.\n  bone->VisibilityOff();\n\n  // Set skin to semi-transparent.\n  skin->GetProperty()->SetOpacity(0.5);\n\n  // An initial camera view is created. The Dolly() method moves\n  // the camera towards the FocalPoint, thereby enlarging the image.\n  aRenderer->SetActiveCamera(aCamera);\n\n  // Calling Render() directly on a vtkRenderer is strictly forbidden.\n  // Only calling Render() on the vtkRenderWindow is a valid call.\n  renWin->Render();\n\n  aRenderer->ResetCamera();\n  aCamera->Dolly(1.5);\n\n  // Note that when camera movement occurs (as it does in the Dolly()\n  // method), the clipping planes often need adjusting. Clipping planes\n  // consist of two planes: near and far along the view direction. The\n  // near plane clips out objects in front of the plane; the far plane\n  // clips out objects behind the plane. This way only what is drawn\n  // between the planes is actually rendered.\n  aRenderer->ResetCameraClippingRange();\n\n  // interact with data\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Medical/MedicalDemo3/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MedicalDemo3)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MedicalDemo3: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MedicalDemo3 MACOSX_BUNDLE MedicalDemo3.cxx )\n  target_link_libraries(MedicalDemo3 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MedicalDemo3\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Medical/MedicalDemo3/#download-and-build-medicaldemo3","title":"Download and Build MedicalDemo3","text":"

        Click here to download MedicalDemo3 and its CMakeLists.txt file. Once the tarball MedicalDemo3.tar has been downloaded and extracted,

        cd MedicalDemo3/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MedicalDemo3\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Medical/MedicalDemo4/","title":"MedicalDemo4","text":"

        vtk-examples/Cxx/Medical/MedicalDemo4

        "},{"location":"Cxx/Medical/MedicalDemo4/#description","title":"Description","text":"

        Volume rendering of the dataset.

        Usage

        MedicalDemo4 FullHead.mhd

        Note

        This original source code for this example is here.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Medical/MedicalDemo4/#code","title":"Code","text":"

        MedicalDemo4.cxx

        // Derived from VTK/Examples/Cxx/Medical4.cxx\n// This example reads a volume dataset and displays it via volume rendering.\n//\n\n#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkFixedPointVolumeRayCastMapper.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVolume.h>\n#include <vtkVolumeProperty.h>\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \"file.mhd e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the renderer, the render window, and the interactor. The renderer\n  // draws into the render window, the interactor enables mouse- and\n  // keyboard-based interaction with the scene.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // The following reader is used to read a series of 2D slices (images)\n  // that compose the volume. The slice dimensions are set, and the\n  // pixel spacing. The data Endianness must also be specified. The reader\n  // uses the FilePrefix in combination with the slice number to construct\n  // filenames using the format FilePrefix.%d. (In this case the FilePrefix\n  // is the root name of the file: quarter.)\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // The volume will be displayed by ray-cast alpha compositing.\n  // A ray-cast mapper is needed to do the ray-casting.\n  vtkNew<vtkFixedPointVolumeRayCastMapper> volumeMapper;\n  volumeMapper->SetInputConnection(reader->GetOutputPort());\n\n  // The color transfer function maps voxel intensities to colors.\n  // It is modality-specific, and often anatomy-specific as well.\n  // The goal is to one color for flesh (between 500 and 1000)\n  // and another color for bone (1150 and over).\n  vtkNew<vtkColorTransferFunction> volumeColor;\n  volumeColor->AddRGBPoint(0, 0.0, 0.0, 0.0);\n  volumeColor->AddRGBPoint(500, 240.0 / 255.0, 184.0 / 255.0, 160.0 / 255.0);\n  volumeColor->AddRGBPoint(1000, 240.0 / 255.0, 184.0 / 255.0, 160.0 / 255.0);\n  volumeColor->AddRGBPoint(1150, 1.0, 1.0, 240.0 / 255.0); // Ivory\n\n  // The opacity transfer function is used to control the opacity\n  // of different tissue types.\n  vtkNew<vtkPiecewiseFunction> volumeScalarOpacity;\n  volumeScalarOpacity->AddPoint(0, 0.00);\n  volumeScalarOpacity->AddPoint(500, 0.15);\n  volumeScalarOpacity->AddPoint(1000, 0.15);\n  volumeScalarOpacity->AddPoint(1150, 0.85);\n\n  // The gradient opacity function is used to decrease the opacity\n  // in the \"flat\" regions of the volume while maintaining the opacity\n  // at the boundaries between tissue types. The gradient is measured\n  // as the amount by which the intensity changes over unit distance.\n  // For most medical data, the unit distance is 1mm.\n  vtkNew<vtkPiecewiseFunction> volumeGradientOpacity;\n  volumeGradientOpacity->AddPoint(0, 0.0);\n  volumeGradientOpacity->AddPoint(90, 0.5);\n  volumeGradientOpacity->AddPoint(100, 1.0);\n\n  // The VolumeProperty attaches the color and opacity functions to the\n  // volume, and sets other volume properties. The interpolation should\n  // be set to linear to do a high-quality rendering. The ShadeOn option\n  // turns on directional lighting, which will usually enhance the\n  // appearance of the volume and make it look more \"3D\". However,\n  // the quality of the shading depends on how accurately the gradient\n  // of the volume can be calculated, and for noisy data the gradient\n  // estimation will be very poor. The impact of the shading can be\n  // decreased by increasing the Ambient coefficient while decreasing\n  // the Diffuse and Specular coefficient. To increase the impact\n  // of shading, decrease the Ambient and increase the Diffuse and Specular.\n  vtkNew<vtkVolumeProperty> volumeProperty;\n  volumeProperty->SetColor(volumeColor);\n  volumeProperty->SetScalarOpacity(volumeScalarOpacity);\n  volumeProperty->SetGradientOpacity(volumeGradientOpacity);\n  volumeProperty->SetInterpolationTypeToLinear();\n  volumeProperty->ShadeOn();\n  volumeProperty->SetAmbient(0.4);\n  volumeProperty->SetDiffuse(0.6);\n  volumeProperty->SetSpecular(0.2);\n\n  // The vtkVolume is a vtkProp3D (like a vtkActor) and controls the position\n  // and orientation of the volume in world coordinates.\n  vtkNew<vtkVolume> volume;\n  volume->SetMapper(volumeMapper);\n  volume->SetProperty(volumeProperty);\n\n  // Finally, add the volume to the renderer\n  ren->AddViewProp(volume);\n\n  // Set up an initial view of the volume. The focal point will be the\n  // center of the volume, and the camera position will be 400mm to the\n  // patient's left (which is our right).\n  vtkCamera* camera = ren->GetActiveCamera();\n  double* c = volume->GetCenter();\n  camera->SetViewUp(0, 0, -1);\n  camera->SetPosition(c[0], c[1] - 400, c[2]);\n  camera->SetFocalPoint(c[0], c[1], c[2]);\n  camera->Azimuth(30.0);\n  camera->Elevation(30.0);\n\n  // Set a background color for the renderer\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  // Increase the size of the render window\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"MedicalDemo4\");\n\n  // Interact with the data.\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Medical/MedicalDemo4/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MedicalDemo4)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolume\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MedicalDemo4: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MedicalDemo4 MACOSX_BUNDLE MedicalDemo4.cxx )\n  target_link_libraries(MedicalDemo4 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MedicalDemo4\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Medical/MedicalDemo4/#download-and-build-medicaldemo4","title":"Download and Build MedicalDemo4","text":"

        Click here to download MedicalDemo4 and its CMakeLists.txt file. Once the tarball MedicalDemo4.tar has been downloaded and extracted,

        cd MedicalDemo4/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MedicalDemo4\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Medical/TissueLens/","title":"TissueLens","text":"

        vtk-examples/Cxx/Medical/TissueLens

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Medical/TissueLens/#description","title":"Description","text":"

        This example uses two vtkClipDataSet filters to achieve a \"tissue lens\" effect. First, a vtkSphere implicit function is used to clip a spherical hole in the isosurface extracted with vtkFlyingEdges3D or vtkMarchingCubes. Then a geometric [vtkSphere](https://www.vtk.org/doc/nightly/html/classvtkSphere.html#details)Source samples the original volume data using a vtkProbeFilter. vtkClipDataSet uses the resulting scalar point data to clip the sphere surface with the isosurface value.

        Usage

        TissueLens FullHead.mhd

        Note

        The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Medical/TissueLens/#code","title":"Code","text":"

        TissueLens.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipDataSet.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphere.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> skinColor{{240, 184, 160, 255}};\n  colors->SetColor(\"SkinColor\", skinColor.data());\n  std::array<unsigned char, 4> backColor{{255, 229, 200, 255}};\n  colors->SetColor(\"BackfaceColor\", backColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd e.g. FullHead.mhd\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the volume data.\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // An isosurface, or contour value of 500 is known to correspond to the\n  // skin of the patient.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> skinExtractor;\n#else\n  vtkNew<vtkMarchingCubes> skinExtractor;\n#endif\n  skinExtractor->SetInputConnection(reader->GetOutputPort());\n  skinExtractor->SetValue(0, 500);\n\n  // Define a spherical clip function to clip the isosurface.\n  vtkNew<vtkSphere> clipFunction;\n  clipFunction->SetRadius(50);\n  clipFunction->SetCenter(73, 52, 15);\n\n  // Clip the isosurface with a sphere.\n  vtkNew<vtkClipDataSet> skinClip;\n  skinClip->SetInputConnection(skinExtractor->GetOutputPort());\n  skinClip->SetClipFunction(clipFunction);\n  skinClip->SetValue(0);\n  skinClip->GenerateClipScalarsOn();\n  skinClip->Update();\n\n  vtkNew<vtkDataSetMapper> skinMapper;\n  skinMapper->SetInputConnection(skinClip->GetOutputPort());\n  skinMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> skin;\n  skin->SetMapper(skinMapper);\n  skin->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"SkinColor\").GetData());\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"BackfaceColor\").GetData());\n  skin->SetBackfaceProperty(backProp);\n\n  // Define a model for the \"lens\". Its geometry matches the implicit\n  // sphere used to clip the isosurface.\n  vtkNew<vtkSphereSource> lensModel;\n  lensModel->SetRadius(50);\n  lensModel->SetCenter(73, 52, 15);\n  lensModel->SetPhiResolution(201);\n  lensModel->SetThetaResolution(101);\n\n  // Sample the input volume with the lens model geometry.\n  vtkNew<vtkProbeFilter> lensProbe;\n  lensProbe->SetInputConnection(lensModel->GetOutputPort());\n  lensProbe->SetSourceConnection(reader->GetOutputPort());\n\n  // Clip the lens data with the isosurface value.\n  vtkNew<vtkClipDataSet> lensClip;\n  lensClip->SetInputConnection(lensProbe->GetOutputPort());\n  lensClip->SetValue(500);\n  lensClip->GenerateClipScalarsOff();\n  lensClip->Update();\n\n  // Define a suitable grayscale lut.\n  vtkNew<vtkLookupTable> bwLut;\n  bwLut->SetTableRange(0, 2048);\n  bwLut->SetSaturationRange(0, 0);\n  bwLut->SetHueRange(0, 0);\n  bwLut->SetValueRange(0.2, 1);\n  bwLut->Build();\n\n  vtkNew<vtkDataSetMapper> lensMapper;\n  lensMapper->SetInputConnection(lensClip->GetOutputPort());\n  lensMapper->SetScalarRange(lensClip->GetOutput()->GetScalarRange());\n  lensMapper->SetLookupTable(bwLut);\n\n  vtkNew<vtkActor> lens;\n  lens->SetMapper(lensMapper);\n\n  // It is convenient to create an initial view of the data. The FocalPoint\n  // and Position form a vector direction. Later on (ResetCamera() method)\n  // this vector is used to position the camera to look at the data in\n  // this direction.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n\n  // Create the renderer, the render window, and the interactor. The renderer\n  // draws into the render window, the interactor enables mouse- and\n  // keyboard-based interaction with the data within the render window.\n  //\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Actors are added to the renderer. An initial camera view is created.\n  // The Dolly() method moves the camera towards the FocalPoint,\n  // thereby enlarging the image.\n  aRenderer->AddActor(lens);\n  aRenderer->AddActor(skin);\n  aRenderer->SetActiveCamera(aCamera);\n  aRenderer->ResetCamera();\n  aCamera->Dolly(1.5);\n\n  // Set a background color for the renderer and set the size of the\n  // render window (expressed in pixels).\n  aRenderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"TissueLens\");\n\n  // Note that when camera movement occurs (as it does in the Dolly()\n  // method), the clipping planes often need adjusting. Clipping planes\n  // consist of two planes: near and far along the view direction. The\n  // near plane clips out objects in front of the plane; the far plane\n  // clips out objects behind the plane. This way only what is drawn\n  // between the planes is actually rendered.\n  aRenderer->ResetCameraClippingRange();\n\n  // Initialize the event loop and then start it.\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Medical/TissueLens/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TissueLens)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TissueLens: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TissueLens MACOSX_BUNDLE TissueLens.cxx )\n  target_link_libraries(TissueLens PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TissueLens\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Medical/TissueLens/#download-and-build-tissuelens","title":"Download and Build TissueLens","text":"

        Click here to download TissueLens and its CMakeLists.txt file. Once the tarball TissueLens.tar has been downloaded and extracted,

        cd TissueLens/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TissueLens\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/AddCell/","title":"AddCell","text":"

        vtk-examples/Cxx/Meshes/AddCell

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/AddCell/#code","title":"Code","text":"

        AddCell.cxx

        #include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkTriangle.h>\n\nint main(int, char*[])\n{\n  // Create a triangle\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n\n  vtkNew<vtkCellArray> triangles;\n  triangles->InsertNextCell(triangle);\n\n  // Create a polydata object\n  vtkNew<vtkPolyData> polyData;\n\n  // Add the geometry and topology to the polydata\n  polyData->SetPoints(points);\n  polyData->SetPolys(triangles);\n\n  std::cout << \"There are \" << polyData->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n\n  polyData->GetPolys()->InsertNextCell(triangle);\n\n  std::cout << \"There are \" << polyData->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/AddCell/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AddCell)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AddCell: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AddCell MACOSX_BUNDLE AddCell.cxx )\n  target_link_libraries(AddCell PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AddCell\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/AddCell/#download-and-build-addcell","title":"Download and Build AddCell","text":"

        Click here to download AddCell and its CMakeLists.txt file. Once the tarball AddCell.tar has been downloaded and extracted,

        cd AddCell/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AddCell\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/BoundaryEdges/","title":"BoundaryEdges","text":"

        vtk-examples/Cxx/Meshes/BoundaryEdges

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/BoundaryEdges/#description","title":"Description","text":"

        This filter will extract the boundary edges of a mesh. The original mesh is shown with the feature edges shown in red.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/BoundaryEdges/#code","title":"Code","text":"

        BoundaryEdges.cxx

        #include <vtkActor.h>\n#include <vtkDiskSource.h>\n#include <vtkFeatureEdges.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDiskSource> diskSource;\n  diskSource->Update();\n\n  vtkNew<vtkFeatureEdges> featureEdges;\n  featureEdges->SetInputConnection(diskSource->GetOutputPort());\n  featureEdges->BoundaryEdgesOn();\n  featureEdges->FeatureEdgesOff();\n  featureEdges->ManifoldEdgesOff();\n  featureEdges->NonManifoldEdgesOff();\n  featureEdges->ColoringOn();\n  featureEdges->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> edgeMapper;\n  edgeMapper->SetInputConnection(featureEdges->GetOutputPort());\n  edgeMapper->SetScalarModeToUseCellData();\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(edgeMapper);\n\n  vtkNew<vtkPolyDataMapper> diskMapper;\n  diskMapper->SetInputConnection(diskSource->GetOutputPort());\n  vtkNew<vtkActor> diskActor;\n  diskActor->SetMapper(diskMapper);\n  diskActor->GetProperty()->SetColor(colors->GetColor3d(\"Gray\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BoundaryEdges\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(edgeActor);\n  renderer->AddActor(diskActor);\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/BoundaryEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoundaryEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoundaryEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoundaryEdges MACOSX_BUNDLE BoundaryEdges.cxx )\n  target_link_libraries(BoundaryEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoundaryEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/BoundaryEdges/#download-and-build-boundaryedges","title":"Download and Build BoundaryEdges","text":"

        Click here to download BoundaryEdges and its CMakeLists.txt file. Once the tarball BoundaryEdges.tar has been downloaded and extracted,

        cd BoundaryEdges/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BoundaryEdges\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/CapClip/","title":"CapClip","text":"

        vtk-examples/Cxx/Meshes/CapClip

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/CapClip/#description","title":"Description","text":"

        This example shows how to generate a \"cap\" on a clipped vtkPolyData. After clipping with vtkClipPolyData, it uses a clever ''trick'' to convert polylines into polygons. If a polydata file is provided, it will cap it. Otherwise it caps a clipped sphere.

        Warning

        The clipping is done with a scalar field provided by vtkPlane and results may depend on the resolution of the input vtkPolyData.

        Style

        This example collects all of the color definition in the beginning of the example. This makes it easier to make changes to the colors without having to search the code.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/CapClip/#code","title":"Code","text":"

        CapClip.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFeatureEdges.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkStripper.h>\n#include <vtkXMLPolyDataReader.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\n//\n// Demonstrate the use of clipping and capping on polyhedral data\n//\n\nint main(int argc, char* argv[])\n{\n  // Define colors\n  vtkNew<vtkNamedColors> colors;\n  auto backgroundColor = colors->GetColor3d(\"steel_blue\");\n  auto boundaryColor = colors->GetColor3d(\"banana\");\n  auto clipColor = colors->GetColor3d(\"tomato\");\n  // PolyData to process\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(polyData->GetCenter());\n  plane->SetNormal(1.0, -1.0, -1.0);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputData(polyData);\n  clipper->SetClipFunction(plane);\n  clipper->SetValue(0);\n  clipper->Update();\n\n  polyData = clipper->GetOutput();\n\n  vtkNew<vtkDataSetMapper> clipMapper;\n  clipMapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> clipActor;\n  clipActor->SetMapper(clipMapper);\n  clipActor->GetProperty()->SetDiffuseColor(clipColor.GetData());\n  clipActor->GetProperty()->SetInterpolationToFlat();\n  clipActor->GetProperty()->EdgeVisibilityOn();\n\n  // Now extract feature edges\n  vtkNew<vtkFeatureEdges> boundaryEdges;\n  boundaryEdges->SetInputData(polyData);\n  boundaryEdges->BoundaryEdgesOn();\n  boundaryEdges->FeatureEdgesOff();\n  boundaryEdges->NonManifoldEdgesOff();\n  boundaryEdges->ManifoldEdgesOff();\n\n  vtkNew<vtkStripper> boundaryStrips;\n  boundaryStrips->SetInputConnection(boundaryEdges->GetOutputPort());\n  boundaryStrips->Update();\n\n  // Change the polylines into polygons\n  vtkNew<vtkPolyData> boundaryPoly;\n  boundaryPoly->SetPoints(boundaryStrips->GetOutput()->GetPoints());\n  boundaryPoly->SetPolys(boundaryStrips->GetOutput()->GetLines());\n\n  vtkNew<vtkPolyDataMapper> boundaryMapper;\n  boundaryMapper->SetInputData(boundaryPoly);\n\n  vtkNew<vtkActor> boundaryActor;\n  boundaryActor->SetMapper(boundaryMapper);\n  boundaryActor->GetProperty()->SetDiffuseColor(boundaryColor.GetData());\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer->AddActor(clipActor);\n  renderer->AddActor(boundaryActor);\n\n  // Generate an interesting view\n  //\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.2);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"CapClip\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Meshes/CapClip/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CapClip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CapClip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CapClip MACOSX_BUNDLE CapClip.cxx )\n  target_link_libraries(CapClip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CapClip\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/CapClip/#download-and-build-capclip","title":"Download and Build CapClip","text":"

        Click here to download CapClip and its CMakeLists.txt file. Once the tarball CapClip.tar has been downloaded and extracted,

        cd CapClip/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CapClip\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/CellEdges/","title":"CellEdges","text":"

        vtk-examples/Cxx/Meshes/CellEdges

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/CellEdges/#code","title":"Code","text":"

        CellEdges.cxx

        #include <vtkIdList.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkTriangle.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPoints()->SetPoint(0, 1.0, 0.0, 0.0);\n  triangle->GetPoints()->SetPoint(1, 0.0, 0.0, 0.0);\n  triangle->GetPoints()->SetPoint(2, 0.0, 1.0, 0.0);\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n\n  std::cout << \"The cell has \" << triangle->GetNumberOfEdges() << \" edges.\"\n            << std::endl;\n\n  for (vtkIdType i = 0; i < triangle->GetNumberOfEdges(); i++)\n  {\n    vtkCell* edge = triangle->GetEdge(i);\n\n    vtkIdList* pointIdList = edge->GetPointIds();\n    std::cout << \"Edge \" << i << \" has \" << pointIdList->GetNumberOfIds()\n              << \" points.\" << std::endl;\n\n    for (vtkIdType p = 0; p < pointIdList->GetNumberOfIds(); p++)\n    {\n      std::cout << \"Edge \" << i << \" uses point \" << pointIdList->GetId(p)\n                << std::endl;\n    }\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/CellEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellEdges)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellEdges MACOSX_BUNDLE CellEdges.cxx )\n  target_link_libraries(CellEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/CellEdges/#download-and-build-celledges","title":"Download and Build CellEdges","text":"

        Click here to download CellEdges and its CMakeLists.txt file. Once the tarball CellEdges.tar has been downloaded and extracted,

        cd CellEdges/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellEdges\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/ClipClosedSurface/","title":"ClipClosedSurface","text":"

        vtk-examples/Cxx/Meshes/ClipClosedSurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/ClipClosedSurface/#code","title":"Code","text":"

        ClipClosedSurface.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipClosedSurface.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPlaneCollection.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n//\n// Demonstrate the use of clipping of polygonal data\n//\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // PolyData to process\n  vtkSmartPointer<vtkPolyData> polyData;\n\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Create a sphere\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(20);\n    sphereSource->SetPhiResolution(11);\n    sphereSource->Update();\n\n    polyData = sphereSource->GetOutput();\n  }\n\n  auto center = polyData->GetCenter();\n  vtkNew<vtkPlane> plane1;\n  plane1->SetOrigin(center[0], center[1], center[2]);\n  plane1->SetNormal(0.0, -1.0, 0.0);\n  vtkNew<vtkPlane> plane2;\n  plane2->SetOrigin(center[0], center[1], center[2]);\n  plane2->SetNormal(0.0, 0.0, 1.0);\n  vtkNew<vtkPlane> plane3;\n  plane3->SetOrigin(center[0], center[1], center[2]);\n  plane3->SetNormal(-1.0, 0.0, 0.0);\n\n  vtkNew<vtkPlaneCollection> planes;\n  planes->AddItem(plane1);\n  planes->AddItem(plane2);\n  planes->AddItem(plane3);\n\n  vtkNew<vtkClipClosedSurface> clipper;\n  clipper->SetInputData(polyData);\n  clipper->SetClippingPlanes(planes);\n  clipper->SetActivePlaneId(2);\n  clipper->SetScalarModeToColors();\n  clipper->SetClipColor(colors->GetColor3d(\"Banana\").GetData());\n  clipper->SetBaseColor(colors->GetColor3d(\"Tomato\").GetData());\n  clipper->SetActivePlaneColor(colors->GetColor3d(\"SandyBrown\").GetData());\n\n  vtkNew<vtkDataSetMapper> clipMapper;\n  clipMapper->SetInputConnection(clipper->GetOutputPort());\n\n  vtkNew<vtkActor> clipActor;\n  clipActor->SetMapper(clipMapper);\n  clipActor->GetProperty()->SetColor(1.0000, 0.3882, 0.2784);\n  clipActor->GetProperty()->SetInterpolationToFlat();\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"ClipClosedSurface\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(clipActor);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/ClipClosedSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipClosedSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipClosedSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipClosedSurface MACOSX_BUNDLE ClipClosedSurface.cxx )\n  target_link_libraries(ClipClosedSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipClosedSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/ClipClosedSurface/#download-and-build-clipclosedsurface","title":"Download and Build ClipClosedSurface","text":"

        Click here to download ClipClosedSurface and its CMakeLists.txt file. Once the tarball ClipClosedSurface.tar has been downloaded and extracted,

        cd ClipClosedSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClipClosedSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/ClipDataSetWithPolyData/","title":"ClipDataSetWithPolyData","text":"

        vtk-examples/Cxx/Meshes/ClipDataSetWithPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/ClipDataSetWithPolyData/#description","title":"Description","text":"

        The example that shows how to use the vtkClipDataSet to clip a vtkRectilinearGrid with an arbitrary polydata. vtkImplicitPolyDataDistance is used to turn the polydata into an implicit function. Every point of the grid is evaluated before sending to vtkClipDataSet. This example uses a vtkConeSource to generate polydata to use, however any polydata could be used, including stl files.

        The left part of the image shows the inside clip and the distance field on a center slice. The right side shows the outside clip. When the program exits using the \"e: key, the example will report the cell type for both the inside and outside clips.

        Note

        This example was translated to C++ from the Python example ClipDataSetWithPolyData1.

        Note

        vtkClipDataSet tetrahedralizes the volume before clipping. Contrast this with the vtkTableBasedClipDataSet example: TableBasedClipDataSetWithPolyData.

        Here is the summary reported when the example exits:

        The clipped dataset(inside) contains a vtkUnstructuredGrid that has 49514 cells Cell type vtkTetra occurs 41034 times. Cell type vtkWedge occurs 8480 times.

        The clipped dataset(outside) contains a vtkUnstructuredGrid that has 714434 cells Cell type vtkTetra occurs 705090 times. Cell type vtkWedge occurs 9344 times.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/ClipDataSetWithPolyData/#code","title":"Code","text":"

        ClipDataSetWithPolyData.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellTypes.h>\n#include <vtkClipDataSet.h>\n#include <vtkConeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFloatArray.h>\n#include <vtkImplicitPolyDataDistance.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRectilinearGridGeometryFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <map>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create polydata to slice the grid with. In this case, use a cone. This\n  // could be any polydata including an stl file.\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(50);\n  cone->SetDirection(0, 0, -1);\n  cone->SetHeight(3.0);\n  cone->CappingOn();\n  cone->Update();\n\n  // Implicit function that will be used to slice the mesh.\n  vtkNew<vtkImplicitPolyDataDistance> implicitPolyDataDistance;\n  implicitPolyDataDistance->SetInput(cone->GetOutput());\n\n  // Create a grid\n  unsigned int dimension = 51;\n  vtkNew<vtkFloatArray> xCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    xCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  vtkNew<vtkFloatArray> yCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    yCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  vtkNew<vtkFloatArray> zCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    zCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  // The coordinates are assigned to the rectilinear grid. Make sure that\n  // the number of values in each of the XCoordinates, YCoordinates,\n  // and ZCoordinates is equal to what is defined in SetDimensions().\n  vtkNew<vtkRectilinearGrid> rgrid;\n  rgrid->SetDimensions(xCoords->GetNumberOfTuples(),\n                       yCoords->GetNumberOfTuples(),\n                       zCoords->GetNumberOfTuples());\n  rgrid->SetXCoordinates(xCoords);\n  rgrid->SetYCoordinates(yCoords);\n  rgrid->SetZCoordinates(zCoords);\n\n  // Create an array to hold distance information.\n  vtkNew<vtkFloatArray> signedDistances;\n  signedDistances->SetNumberOfComponents(1);\n  signedDistances->SetName(\"SignedDistances\");\n\n  // Evaluate the signed distance function at all of the grid points.\n  for (vtkIdType pointId = 0; pointId < rgrid->GetNumberOfPoints(); ++pointId)\n  {\n    double p[3];\n    rgrid->GetPoint(pointId, p);\n    double signedDistance = implicitPolyDataDistance->EvaluateFunction(p);\n    signedDistances->InsertNextValue(signedDistance);\n  }\n\n  // Add the SignedDistances to the grid.\n  rgrid->GetPointData()->SetScalars(signedDistances);\n\n  // Use vtkClipDataSet to slice the grid with the polydata.\n  vtkNew<vtkClipDataSet> clipper;\n  clipper->SetInputData(rgrid);\n  clipper->InsideOutOn();\n  clipper->SetValue(0.0);\n  clipper->GenerateClippedOutputOff();\n  clipper->Update();\n\n  // For some reason we cannot use:\n  /*\n   vtkNew<vtkClipDataSet> clipper;\n   clipper->SetInputData(rgrid);\n   clipper->InsideOutOn();\n   clipper->SetValue(0.0);\n   clipper->GenerateClippedOutputOn();\n   clipper->Update();\n  */\n\n  // So we define a new clipper for the outside clip.\n  vtkNew<vtkClipDataSet> clipper1;\n  clipper1->SetInputData(rgrid);\n  clipper1->InsideOutOff();\n  clipper1->SetValue(0.0);\n  clipper1->GenerateClippedOutputOff();\n  clipper1->Update();\n\n  // --- mappers, actors, render, etc. ---\n  // Mapper and actor to view the cone.\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n\n  // Geometry filter to view the background grid.\n  vtkNew<vtkRectilinearGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputData(rgrid);\n  geometryFilter->SetExtent(0, dimension, 0, dimension, dimension / 2,\n                            dimension / 2);\n  geometryFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> rgridMapper;\n  rgridMapper->SetInputConnection(geometryFilter->GetOutputPort());\n  rgridMapper->SetScalarRange(\n      rgrid->GetPointData()->GetArray(\"SignedDistances\")->GetRange());\n\n  vtkNew<vtkActor> wireActor;\n  wireActor->SetMapper(rgridMapper);\n  wireActor->GetProperty()->SetRepresentationToWireframe();\n\n  // Mapper and actor to view the clipped mesh.\n  vtkNew<vtkDataSetMapper> clipperMapper;\n  clipperMapper->SetInputConnection(clipper->GetOutputPort());\n  clipperMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkDataSetMapper> clipperOutsideMapper;\n  // clipperOutsideMapper->SetInputConnection(clipper->GetOutputPort(1));\n  clipperOutsideMapper->SetInputConnection(clipper1->GetOutputPort());\n  clipperOutsideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clipperActor;\n  clipperActor->SetMapper(clipperMapper);\n  clipperActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> clipperOutsideActor;\n  clipperOutsideActor->SetMapper(clipperOutsideMapper);\n  clipperOutsideActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  // A renderer and render window.\n  // Create a renderer, render window, and interactor.\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  // Add the actors.\n  leftRenderer->AddActor(wireActor);\n  leftRenderer->AddActor(clipperActor);\n  rightRenderer->AddActor(clipperOutsideActor);\n\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->SetSize(640, 480);\n  renwin->AddRenderer(leftRenderer);\n  renwin->AddRenderer(rightRenderer);\n  renwin->SetWindowName(\"ClipDataSetWithPolyData\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renwin);\n\n  // Share the camera.\n\n  leftRenderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  leftRenderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  leftRenderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  leftRenderer->GetActiveCamera()->Azimuth(30);\n  leftRenderer->GetActiveCamera()->Elevation(30);\n  leftRenderer->ResetCamera();\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  renwin->Render();\n  interactor->Start();\n\n  // Generate a report.\n  vtkIdType numberOfCells = clipper->GetOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset(inside) contains a \" << std::endl\n            << clipper->GetOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> CellContainer;\n  CellContainer cellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    cellMap[clipper->GetOutput()->GetCellType(i)]++;\n  }\n\n  CellContainer::const_iterator it = cellMap.begin();\n  while (it != cellMap.end())\n  {\n    std::cout << \"\\tCell type \"\n              << vtkCellTypes::GetClassNameFromTypeId(it->first) << \" occurs \"\n              << it->second << \" times.\" << std::endl;\n    ++it;\n  }\n\n  numberOfCells = clipper1->GetOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset(outside) contains a \" << std::endl\n            << clipper1->GetOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> OutsideCellContainer;\n  CellContainer outsideCellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    outsideCellMap[clipper1->GetOutput()->GetCellType(i)]++;\n  }\n\n  it = outsideCellMap.begin();\n  while (it != outsideCellMap.end())\n  {\n    std::cout << \"\\tCell type \"\n              << vtkCellTypes::GetClassNameFromTypeId(it->first) << \" occurs \"\n              << it->second << \" times.\" << std::endl;\n    ++it;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/ClipDataSetWithPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipDataSetWithPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipDataSetWithPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipDataSetWithPolyData MACOSX_BUNDLE ClipDataSetWithPolyData.cxx )\n  target_link_libraries(ClipDataSetWithPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipDataSetWithPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/ClipDataSetWithPolyData/#download-and-build-clipdatasetwithpolydata","title":"Download and Build ClipDataSetWithPolyData","text":"

        Click here to download ClipDataSetWithPolyData and its CMakeLists.txt file. Once the tarball ClipDataSetWithPolyData.tar has been downloaded and extracted,

        cd ClipDataSetWithPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClipDataSetWithPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/ClipFrustum/","title":"ClipFrustum","text":"

        vtk-examples/Cxx/Meshes/ClipFrustum

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/ClipFrustum/#description","title":"Description","text":"

        The example uses vtkClipPolyData to clip a model with a vtkCamera's view frustum. The frustum is displayed using vtkFrustumSource.

        The example proceeds as follow:

        1. Read a vtkPolyData. The example can read any of the supported polydata readers.
        2. Generates a view of the model.
        3. Recovers the view frustum of the current vtkCamera.
        4. Creates an implicit function using vtkPlanes::SetFrustumPlanes.
        5. Passes the vtkPlanes to vtkFrustumSource.
        6. Passes the vtkPlanes to vtkClipPolyData as the ClipFunction.
        7. Tells vtkClipPolyData to generate vtkPolyData for inside and outside.
        8. Presents the frustum, and clipped models. The inside model is red and the outside model is gold.

        Bug

        The first attempt to write the example used vtkClipConvexPolyData, but that filter has bugs and only works with one plane.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/ClipFrustum/#code","title":"Code","text":"

        ClipFrustum.cxx

        #include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkFrustumSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPlanes.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  renderer->AddActor(actor);\n\n  vtkNew<vtkPolyDataMapper> outMapper;\n  outMapper->SetInputData(polyData);\n  outMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> outActor;\n  outActor->SetMapper(outMapper);\n  outActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Gold\").GetData());\n  outActor->GetProperty()->SetSpecular(.6);\n  outActor->GetProperty()->SetSpecularPower(30);\n\n  // Position the camera so that we can see the frustum.\n  double viewUp[3] = {0.0, 1.0, 0.0};\n  double position[3] = {1.0, 0.0, 0.0};\n  PositionCamera(renderer, viewUp, position);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->SetViewAngle(10.0);\n\n  double planesArray[24];\n  renderer->GetActiveCamera()->GetFrustumPlanes(1.0, planesArray);\n\n  vtkNew<vtkPlanes> planes;\n  planes->SetFrustumPlanes(planesArray);\n\n  vtkNew<vtkFrustumSource> frustumSource;\n  frustumSource->ShowLinesOff();\n  frustumSource->SetPlanes(planes);\n  frustumSource->Update();\n\n  vtkNew<vtkPolyDataMapper> frustumMapper;\n  frustumMapper->SetInputConnection(frustumSource->GetOutputPort());\n\n  vtkNew<vtkActor> frustumActor;\n  frustumActor->SetMapper(frustumMapper);\n  frustumActor->GetProperty()->EdgeVisibilityOn();\n  frustumActor->GetProperty()->SetOpacity(.5);\n  frustumActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkClipPolyData> clip;\n  clip->SetInputData(polyData);\n  clip->SetClipFunction(planes);\n  clip->InsideOutOn();\n  clip->GenerateClippedOutputOn();\n  clip->Update();\n\n  mapper->SetInputConnection(clip->GetOutputPort());\n  outMapper->SetInputData(clip->GetClippedOutput());\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->AddActor(frustumActor);\n  renderer->AddActor(outActor);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ClipFrustum\");\n\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position)\n{\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  renderer->GetActiveCamera()->SetViewUp(viewUp);\n  renderer->GetActiveCamera()->SetPosition(position);\n  renderer->ResetCamera();\n  return;\n}\n} // namespace\n
        "},{"location":"Cxx/Meshes/ClipFrustum/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipFrustum)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipFrustum: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipFrustum MACOSX_BUNDLE ClipFrustum.cxx )\n  target_link_libraries(ClipFrustum PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipFrustum\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/ClipFrustum/#download-and-build-clipfrustum","title":"Download and Build ClipFrustum","text":"

        Click here to download ClipFrustum and its CMakeLists.txt file. Once the tarball ClipFrustum.tar has been downloaded and extracted,

        cd ClipFrustum/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClipFrustum\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/ColoredElevationMap/","title":"ColoredElevationMap","text":"

        vtk-examples/Cxx/Meshes/ColoredElevationMap

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/ColoredElevationMap/#code","title":"Code","text":"

        ColoredElevationMap.cxx

        #include <vtkActor.h>\n#include <vtkDelaunay2D.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iomanip>\n#include <iostream>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a grid of points (height/terrian map).\n  vtkNew<vtkPoints> points;\n\n  unsigned int GridSize = 20;\n  double xx, yy, zz;\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775586); // For testing\n  for (unsigned int x = 0; x < GridSize; x++)\n  {\n    for (unsigned int y = 0; y < GridSize; y++)\n    {\n      rng->Next();\n      xx = x + rng->GetRangeValue(-0.2, 0.2);\n      rng->Next();\n      yy = y + rng->GetRangeValue(-0.2, 0.2);\n      rng->Next();\n      zz = rng->GetRangeValue(-0.5, 0.5);\n      points->InsertNextPoint(xx, yy, zz);\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> inputPolyData;\n  inputPolyData->SetPoints(points);\n\n  // Triangulate the grid points.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(inputPolyData);\n  delaunay->Update();\n  vtkPolyData* outputPolyData = delaunay->GetOutput();\n\n  double bounds[6];\n  outputPolyData->GetBounds(bounds);\n\n  // Find min and max z.\n  double minz = bounds[4];\n  double maxz = bounds[5];\n\n  std::cout.precision(3);\n  std::cout << \"minz: \" << std::right << std::setw(6) << minz << std::endl;\n  std::cout << \"maxz: \" << std::right << std::setw(6) << maxz << std::endl;\n  std::cout.precision(0);\n\n  // Create the color map.\n  vtkNew<vtkLookupTable> colorLookupTable;\n  colorLookupTable->SetTableRange(minz, maxz);\n  colorLookupTable->Build();\n\n  // Generate the colors for each point based on the color map.\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n\n  std::cout << \"There are \" << outputPolyData->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout.precision(6);\n  std::cout << std::fixed;\n  for (int i = 0; i < outputPolyData->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    outputPolyData->GetPoint(i, p);\n\n    double dcolor[3];\n    colorLookupTable->GetColor(p[2], dcolor);\n    // std::cout << \"dcolor: \" << std::right << std::setw(8) << dcolor[0] << \" \"\n    //          << std::right << std::setw(8)<< dcolor[1] << \" \"\n    //          << std::right << std::setw(8) << dcolor[2]\n    //          << std::endl;\n    unsigned char color[3];\n    for (unsigned int j = 0; j < 3; j++)\n    {\n      color[j] = static_cast<unsigned char>(255.0 * dcolor[j]);\n    }\n    // std::cout << \"color:  \" << std::right << std::setw(8) << (int)color[0]\n    //          << \" \" << std::right << std::setw(8) << (int)color[1] << \" \"\n    //          << std::right << std::setw(8)\n    //          << (int)color[2] << std::endl;\n\n    colors->InsertNextTupleValue(color);\n  }\n  std::cout.precision(0);\n\n  outputPolyData->GetPointData()->SetScalars(colors);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(outputPolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"ColoredElevationMap\");\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/ColoredElevationMap/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColoredElevationMap)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColoredElevationMap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColoredElevationMap MACOSX_BUNDLE ColoredElevationMap.cxx )\n  target_link_libraries(ColoredElevationMap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColoredElevationMap\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/ColoredElevationMap/#download-and-build-coloredelevationmap","title":"Download and Build ColoredElevationMap","text":"

        Click here to download ColoredElevationMap and its CMakeLists.txt file. Once the tarball ColoredElevationMap.tar has been downloaded and extracted,

        cd ColoredElevationMap/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColoredElevationMap\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/Decimation/","title":"Decimation","text":"

        vtk-examples/Cxx/Meshes/Decimation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/Decimation/#description","title":"Description","text":"

        This example decimates a mesh using progressive decimation. The SetTargetReduction function specifies how many triangles should reduced by specifying the percentage (0,1) of triangles to be removed. For example, if the mesh contains 100 triangles and SetTargetReduction(.90) is called, after the decimation there will be approximately 10 triangles - a 90% reduction.

        The implementation of vtkDecimatePro is similar to the algorithm originally described in \"Decimation of Triangle Meshes\", Proc Siggraph `92, with three major differences. First, this algorithm does not necessarily preserve the topology of the mesh. Second, it is guaranteed to give the a mesh reduction factor specified by the user (as long as certain constraints are not set - see Caveats). Third, it is set up generate progressive meshes, that is a stream of operations that can be easily transmitted and incrementally updated (see Hugues Hoppe's Siggraph '96 paper on progressive meshes).

        Seealso

        QuadricClustering and QuadricDecimation.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/Decimation/#code","title":"Code","text":"

        Decimation.cxx

        #include <vtkCamera.h>\n#include <vtkDecimatePro.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    vtkNew<vtkTriangleFilter> triangles;\n    triangles->SetInputConnection(reader->GetOutputPort());\n    triangles->Update();\n    inputPolyData = triangles->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(30);\n    sphereSource->SetPhiResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  float reduction = 0.9; // 90% reduction\n  if (argc > 2)\n  {\n    reduction = atof(argv[2]);\n  }\n  vtkNew<vtkNamedColors> colors;\n  std::cout << \"Before decimation\" << std::endl << \"------------\" << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n\n  vtkNew<vtkDecimatePro> decimate;\n  decimate->SetInputData(inputPolyData);\n  decimate->SetTargetReduction(reduction);\n  decimate->PreserveTopologyOn();\n  decimate->Update();\n\n  vtkNew<vtkPolyData> decimated;\n  decimated->ShallowCopy(decimate->GetOutput());\n\n  std::cout << \"After decimation\" << std::endl << \"------------\" << std::endl;\n\n  std::cout << \"There are \" << decimated->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << decimated->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n  std::cout << \"Reduction: \"\n            << static_cast<double>((inputPolyData->GetNumberOfPolys() -\n                                    decimated->GetNumberOfPolys())) /\n          static_cast<double>(inputPolyData->GetNumberOfPolys())\n            << std::endl;\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputData(inputPolyData);\n\n  vtkNew<vtkProperty> backFace;\n  backFace->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetInterpolationToFlat();\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  inputActor->SetBackfaceProperty(backFace);\n\n  vtkNew<vtkPolyDataMapper> decimatedMapper;\n  decimatedMapper->SetInputData(decimated);\n\n  vtkNew<vtkActor> decimatedActor;\n  decimatedActor->SetMapper(decimatedMapper);\n  decimatedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  decimatedActor->GetProperty()->SetInterpolationToFlat();\n  decimatedActor->SetBackfaceProperty(backFace);\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"Decimation\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Add the sphere to the left and the cube to the right\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(decimatedActor);\n\n  // Shared camera\n  // Shared camera looking down the -y axis\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, -1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Elevation(30);\n  camera->Azimuth(30);\n\n  leftRenderer->SetActiveCamera(camera);\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->ResetCamera();\n  leftRenderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/Decimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Decimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Decimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Decimation MACOSX_BUNDLE Decimation.cxx )\n  target_link_libraries(Decimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Decimation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/Decimation/#download-and-build-decimation","title":"Download and Build Decimation","text":"

        Click here to download Decimation and its CMakeLists.txt file. Once the tarball Decimation.tar has been downloaded and extracted,

        cd Decimation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Decimation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/DeformPointSet/","title":"DeformPointSet","text":"

        vtk-examples/Cxx/Meshes/DeformPointSet

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/DeformPointSet/#description","title":"Description","text":"

        Deform a point set with a polyhedra. Supply a .vtp file and see it deformed.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/DeformPointSet/#code","title":"Code","text":"

        DeformPointSet.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDeformPointSet.h>\n#include <vtkElevationFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyData> input;\n  double bounds[6];\n\n  if (argc == 1)\n  {\n    // Create a sphere to warp\n    vtkNew<vtkSphereSource> sphere;\n    sphere->SetThetaResolution(51);\n    sphere->SetPhiResolution(17);\n    sphere->Update();\n    sphere->GetOutput()->GetBounds(bounds);\n\n    // Generate some scalars on the polydata\n    vtkNew<vtkElevationFilter> ele;\n    ele->SetInputConnection(sphere->GetOutputPort());\n    ele->SetLowPoint(0, 0, -0.5);\n    ele->SetHighPoint(0, 0, 0.5);\n    ele->SetLowPoint((bounds[1] + bounds[0]) / 2.0,\n                     (bounds[3] + bounds[2]) / 2.0, -bounds[5]);\n    ele->SetHighPoint((bounds[1] + bounds[0]) / 2.0,\n                      (bounds[3] + bounds[2]) / 2.0, bounds[5]);\n    ele->Update();\n    input->ShallowCopy(ele->GetOutput());\n  }\n  else\n  {\n    std::string inputFilename = argv[1];\n\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(inputFilename.c_str());\n    reader->Update();\n\n    input->ShallowCopy(reader->GetOutput());\n    input->GetBounds(bounds);\n  }\n\n  // Now create a control mesh, in this case a octagon that encloses\n  // the point set\n  vtkNew<vtkPoints> pts;\n  pts->SetNumberOfPoints(6);\n  pts->SetPoint(0, bounds[0] - .1 * (bounds[1] - bounds[0]),\n                (bounds[3] + bounds[2]) / 2.0, (bounds[5] + bounds[4]) / 2.0);\n  pts->SetPoint(1, bounds[1] + .1 * (bounds[1] - bounds[0]),\n                (bounds[3] + bounds[2]) / 2.0, (bounds[5] + bounds[4]) / 2.0);\n  pts->SetPoint(2, (bounds[1] + bounds[0]) / 2.0,\n                bounds[2] - .1 * (bounds[3] - bounds[2]),\n                (bounds[5] + bounds[4]) / 2.0);\n  pts->SetPoint(3, (bounds[1] + bounds[0]) / 2.0,\n                bounds[3] + .1 * (bounds[3] - bounds[2]),\n                (bounds[5] + bounds[4]) / 2.0);\n  pts->SetPoint(4, (bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0,\n                bounds[4] - .1 * (bounds[5] - bounds[4]));\n  pts->SetPoint(5, (bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0,\n                bounds[5] + .1 * (bounds[5] - bounds[4]));\n\n  vtkNew<vtkCellArray> tris;\n  // clang-format off\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(2); tris->InsertCellPoint(0);  tris->InsertCellPoint(4);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(1); tris->InsertCellPoint(2);  tris->InsertCellPoint(4);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(3);  tris->InsertCellPoint(1);  tris->InsertCellPoint(4);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(0);  tris->InsertCellPoint(3);  tris->InsertCellPoint(4);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(0);  tris->InsertCellPoint(2);  tris->InsertCellPoint(5);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(2);  tris->InsertCellPoint(1);  tris->InsertCellPoint(5);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(1); tris->InsertCellPoint(3);  tris->InsertCellPoint(5);\n  tris->InsertNextCell(3);\n  tris->InsertCellPoint(3);  tris->InsertCellPoint(0);  tris->InsertCellPoint(5);\n  // clang-format on\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(pts);\n  pd->SetPolys(tris);\n\n  // Display the control mesh\n  vtkNew<vtkPolyDataMapper> meshMapper;\n  meshMapper->SetInputData(pd);\n  vtkNew<vtkActor> meshActor;\n  meshActor->SetMapper(meshMapper);\n  meshActor->GetProperty()->SetRepresentationToWireframe();\n  meshActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Do the intitial weight generation\n  vtkNew<vtkDeformPointSet> deform;\n  deform->SetInputData(input);\n  deform->SetControlMeshData(pd);\n  deform->Update(); // this creates the initial weights\n\n  // Now move one point and deform\n  double controlPoint[3];\n  pts->GetPoint(5, controlPoint);\n  pts->SetPoint(5, controlPoint[0], controlPoint[1],\n                bounds[5] + .8 * (bounds[5] - bounds[4]));\n  pts->Modified();\n\n  // Display the warped polydata\n  vtkNew<vtkPolyDataMapper> polyMapper;\n  polyMapper->SetInputConnection(deform->GetOutputPort());\n  vtkNew<vtkActor> polyActor;\n  polyActor->SetMapper(polyMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(polyActor);\n  renderer->AddActor(meshActor);\n\n  renderer->GetActiveCamera()->SetPosition(1, 1, 1);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"DeformPointSet\");\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/DeformPointSet/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DeformPointSet)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DeformPointSet: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DeformPointSet MACOSX_BUNDLE DeformPointSet.cxx )\n  target_link_libraries(DeformPointSet PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DeformPointSet\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/DeformPointSet/#download-and-build-deformpointset","title":"Download and Build DeformPointSet","text":"

        Click here to download DeformPointSet and its CMakeLists.txt file. Once the tarball DeformPointSet.tar has been downloaded and extracted,

        cd DeformPointSet/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DeformPointSet\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/ElevationFilter/","title":"ElevationFilter","text":"

        vtk-examples/Cxx/Meshes/ElevationFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/ElevationFilter/#code","title":"Code","text":"

        ElevationFilter.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDelaunay2D.h>\n#include <vtkElevationFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataWriter.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Create a grid of points (height/terrain map)\n  vtkNew<vtkPoints> points;\n\n  unsigned int gridSize = 10;\n  for (unsigned int x = 0; x < gridSize; x++)\n  {\n    for (unsigned int y = 0; y < gridSize; y++)\n    {\n      points->InsertNextPoint(x, y, (x + y) / (y + 1));\n    }\n  }\n\n  double bounds[6];\n  points->GetBounds(bounds);\n\n  // Add the grid points to a polydata object\n  vtkNew<vtkPolyData> inputPolyData;\n  inputPolyData->SetPoints(points);\n\n  // Triangulate the grid points\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(inputPolyData);\n  delaunay->Update();\n\n  vtkNew<vtkElevationFilter> elevationFilter;\n  elevationFilter->SetInputConnection(delaunay->GetOutputPort());\n  elevationFilter->SetLowPoint(0.0, 0.0, bounds[4]);\n  elevationFilter->SetHighPoint(0.0, 0.0, bounds[5]);\n  elevationFilter->Update();\n\n  vtkNew<vtkPolyData> output;\n  output->ShallowCopy(dynamic_cast<vtkPolyData*>(elevationFilter->GetOutput()));\n\n  vtkFloatArray* elevation = dynamic_cast<vtkFloatArray*>(\n      output->GetPointData()->GetArray(\"Elevation\"));\n\n  // Create the color map\n  vtkNew<vtkLookupTable> colorLookupTable;\n  colorLookupTable->SetTableRange(bounds[4], bounds[5]);\n  colorLookupTable->Build();\n\n  // Generate the colors for each point based on the color map\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n\n  for (vtkIdType i = 0; i < output->GetNumberOfPoints(); i++)\n  {\n    double val = elevation->GetValue(i);\n    // std::cout << \"val: \" << val << std::endl;\n\n    double dcolor[3];\n    colorLookupTable->GetColor(val, dcolor);\n    // std::cout << \"dcolor: \" << dcolor[0] << \" \" << dcolor[1] << \" \" <<\n    // dcolor[2] << std::endl;\n    unsigned char color[3];\n    for (unsigned int j = 0; j < 3; j++)\n    {\n      color[j] = 255 * dcolor[j] / 1.0;\n    }\n    // std::cout << \"color: \" << (int)color[0] << \" \" << (int)color[1] << \" \" <<\n    // (int)color[2] << std::endl;\n\n    colors->InsertNextTupleValue(color);\n  }\n\n  output->GetPointData()->AddArray(colors);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(output);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ElevationFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"ForestGreen\").GetData());\n\n  // z-axis points upwards and y-axis is lower right edge.\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-13.3586, 20.7305, 22.5147);\n  camera->SetFocalPoint(4.5, 4.5, 4.5);\n  camera->SetViewUp(0.506199, -0.328212, 0.797521);\n  camera->SetDistance(30.1146);\n  camera->SetClippingRange(14.3196, 50.0698);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/ElevationFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ElevationFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ElevationFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ElevationFilter MACOSX_BUNDLE ElevationFilter.cxx )\n  target_link_libraries(ElevationFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ElevationFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/ElevationFilter/#download-and-build-elevationfilter","title":"Download and Build ElevationFilter","text":"

        Click here to download ElevationFilter and its CMakeLists.txt file. Once the tarball ElevationFilter.tar has been downloaded and extracted,

        cd ElevationFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ElevationFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/ExtractEdges/","title":"ExtractEdges","text":"

        vtk-examples/Cxx/Meshes/ExtractEdges

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/ExtractEdges/#description","title":"Description","text":"

        This example shows how to extract the edges from a PolyData. In this case, we convert a sphere into a wireframe sphere. We demonstrate how to traverse the resulting edges.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/ExtractEdges/#code","title":"Code","text":"

        ExtractEdges.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkExtractEdges.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"Sphere\" << endl << \"----------\" << endl;\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfCells()\n            << \" cells.\" << std::endl;\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfPoints()\n            << \" points.\" << std::endl;\n\n  vtkNew<vtkExtractEdges> extractEdges;\n  extractEdges->SetInputConnection(sphereSource->GetOutputPort());\n  extractEdges->Update();\n\n  vtkCellArray* lines = extractEdges->GetOutput()->GetLines();\n  vtkPoints* points = extractEdges->GetOutput()->GetPoints();\n\n  std::cout << std::endl << \"Edges\" << endl << \"----------\" << std::endl;\n  std::cout << \"There are \" << lines->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n  std::cout << \"There are \" << points->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  // Traverse all of the edges.\n  for (vtkIdType i = 0; i < extractEdges->GetOutput()->GetNumberOfCells(); i++)\n  {\n    // std::cout << \"Type: \" <<\n    // extractEdges->GetOutput()->GetCell(i)->GetClassName() << std::endl;\n    auto line = dynamic_cast<vtkLine*>(extractEdges->GetOutput()->GetCell(i));\n    std::cout << \"Line \" << i << \" : \" << *line << std::endl;\n  }\n\n  // Visualize the edges.\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(extractEdges->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ExtractEdges\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/ExtractEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractEdges MACOSX_BUNDLE ExtractEdges.cxx )\n  target_link_libraries(ExtractEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/ExtractEdges/#download-and-build-extractedges","title":"Download and Build ExtractEdges","text":"

        Click here to download ExtractEdges and its CMakeLists.txt file. Once the tarball ExtractEdges.tar has been downloaded and extracted,

        cd ExtractEdges/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractEdges\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/FillHoles/","title":"FillHoles","text":"

        vtk-examples/Cxx/Meshes/FillHoles

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/FillHoles/#description","title":"Description","text":"

        This filter finds holes in a mesh and closes them.

        Seealso

        IdentifyHoles fills the holes and then identifies each hole.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/FillHoles/#code","title":"Code","text":"

        FillHoles.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkExtractSelection.h>\n#include <vtkFillHolesFilter.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInformation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto input = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkFillHolesFilter> fillHolesFilter;\n  fillHolesFilter->SetInputData(input);\n  fillHolesFilter->SetHoleSize(100000.0);\n  fillHolesFilter->Update();\n\n  // Make the triangle winding order consistent\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(fillHolesFilter->GetOutput());\n  normals->ConsistencyOn();\n  normals->SplittingOff();\n  normals->Update();\n\n#if 0\n  // Restore the original normals\n  normals->GetOutput()->GetPointData()->\n    SetNormals(input->GetPointData()->GetNormals());\n#endif\n  // Visualize\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputData(input);\n\n  vtkNew<vtkProperty> backfaceProp;\n  backfaceProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->SetBackfaceProperty(backfaceProp);\n  originalActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  vtkNew<vtkPolyDataMapper> filledMapper;\n  filledMapper->SetInputData(fillHolesFilter->GetOutput());\n\n  vtkNew<vtkActor> filledActor;\n  filledActor->SetMapper(filledMapper);\n  filledActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  filledActor->SetBackfaceProperty(backfaceProp);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"FillHoles\");\n\n  renderWindow->AddRenderer(leftRenderer);\n  renderWindow->AddRenderer(rightRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  leftRenderer->AddActor(originalActor);\n  rightRenderer->AddActor(filledActor);\n  leftRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  leftRenderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  leftRenderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  leftRenderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  leftRenderer->GetActiveCamera()->Azimuth(30);\n  leftRenderer->GetActiveCamera()->Elevation(30);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Share the camera.\n\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n  // Render and interact.\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nvoid GenerateData(vtkPolyData* input)\n{\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Remove some cells.\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  // Set values.\n  ids->InsertNextValue(2);\n  ids->InsertNextValue(10);\n\n  vtkNew<vtkSelectionNode> selectionNode;\n  selectionNode->SetFieldType(vtkSelectionNode::CELL);\n  selectionNode->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode->SetSelectionList(ids);\n  selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(),\n                                      1); // invert the selection\n\n  vtkNew<vtkSelection> selection;\n  selection->AddNode(selectionNode);\n\n  vtkNew<vtkExtractSelection> extractSelection;\n  extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n  extractSelection->SetInputData(1, selection);\n  extractSelection->Update();\n\n  // In selection\n  vtkNew<vtkDataSetSurfaceFilter> surfaceFilter;\n  surfaceFilter->SetInputConnection(extractSelection->GetOutputPort());\n  surfaceFilter->Update();\n\n  input->ShallowCopy(surfaceFilter->GetOutput());\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Meshes/FillHoles/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FillHoles)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersGeometry\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FillHoles: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FillHoles MACOSX_BUNDLE FillHoles.cxx )\n  target_link_libraries(FillHoles PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FillHoles\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/FillHoles/#download-and-build-fillholes","title":"Download and Build FillHoles","text":"

        Click here to download FillHoles and its CMakeLists.txt file. Once the tarball FillHoles.tar has been downloaded and extracted,

        cd FillHoles/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FillHoles\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/FitToHeightMap/","title":"FitToHeightMap","text":"

        vtk-examples/Cxx/Meshes/FitToHeightMap

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/FitToHeightMap/#description","title":"Description","text":"

        This example uses vtkFitToHeightMapFilter to cover a height map with vtkPolyData generated by a vtkPlaneSource. The plane's origin, point1 and point2 are calculated from the DEM's bounding box. The z coordinate of each parameter is set to the height of the DEM. With this plane, the example uses vtkProbeFilter to apply the scalar elevation data from the DEM.

        vtkWarpScalar is used to \"elevate\" the DEM mesh. Once the planes are draped over the warped DEM mesh, they are displayed side-by-side using the same vtkLookupTable.

        The displayed meshes are original (left), point fit (middle) and cell fit (right).

        Note

        DEM files for the United States are available here.

        Info

        This example requires vtk version 8.2 or newer.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/FitToHeightMap/#code","title":"Code","text":"

        FitToHeightMap.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDEMReader.h>\n#include <vtkFitToHeightMapFilter.h>\n#include <vtkImageData.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkWarpScalar.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.dem e.g. SainteHelens.dem\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Create the RenderWindow, Renderer\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren0;\n  ren0->SetViewport(0, 0, 1.0 / 3.0, 1);\n  ren0->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1);\n  ren1->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> ren2;\n  ren2->SetViewport(2.0 / 3.0, 0, 1, 1);\n  ren2->SetBackground(colors->GetColor3d(\"Tan\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1200, 400);\n  renderWindow->AddRenderer(ren0);\n  renderWindow->AddRenderer(ren1);\n  renderWindow->AddRenderer(ren2);\n  renderWindow->SetWindowName(\"FitToHeightMap\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Create pipeline. Load terrain data.\n  //\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.6, 0);\n  lut->SetSaturationRange(1.0, 0);\n  lut->SetValueRange(0.5, 1.0);\n\n  // Read the data: a height field results\n  vtkNew<vtkDEMReader> demReader;\n  demReader->SetFileName(argv[1]);\n  demReader->Update(); // Update so we can get bounds\n\n  vtkNew<vtkImageDataGeometryFilter> surface;\n  surface->SetInputConnection(demReader->GetOutputPort());\n\n  // Warp the surface in the vertical direction\n  vtkNew<vtkWarpScalar> warp;\n  warp->SetInputConnection(surface->GetOutputPort());\n  warp->SetScaleFactor(1);\n  warp->UseNormalOn();\n  warp->SetNormal(0, 0, 1);\n  warp->Update();\n\n  // Show the terrain\n  double lo = demReader->GetOutput()->GetScalarRange()[0];\n  double hi = demReader->GetOutput()->GetScalarRange()[1];\n\n  vtkNew<vtkPolyDataMapper> demMapper;\n  demMapper->SetInputConnection(warp->GetOutputPort());\n  demMapper->ScalarVisibilityOn();\n  demMapper->SetScalarRange(lo, hi);\n  demMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> demActor;\n  demActor->SetMapper(demMapper);\n\n  // Create polygon(s) to fit. z-values should be height of DEM\n  // to accomodate ProbeFilter\n  double zLevel = demReader->GetOutput()->GetBounds()[5];\n  double* demBounds;\n  demBounds = demReader->GetOutput()->GetBounds();\n\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetOrigin(demBounds[0], demBounds[2], zLevel);\n  plane->SetPoint1(demBounds[1], demBounds[2], zLevel);\n  plane->SetPoint2(demBounds[0], demBounds[3], zLevel);\n  plane->SetResolution(128, 128);\n  plane->Update();\n\n  // Get the scalrs from the DEM\n  vtkNew<vtkProbeFilter> probeDem;\n  probeDem->SetSourceData(demReader->GetOutput());\n  probeDem->SetInputConnection(plane->GetOutputPort());\n  probeDem->Update();\n\n  // Fit polygons to surface using two strategies\n  // Both will share the same lookup tables\n  vtkNew<vtkFitToHeightMapFilter> pointFit;\n  pointFit->SetInputConnection(probeDem->GetOutputPort());\n  pointFit->SetHeightMapConnection(demReader->GetOutputPort());\n  pointFit->SetFittingStrategyToPointProjection();\n  pointFit->UseHeightMapOffsetOn();\n\n  vtkNew<vtkPolyDataMapper> pointMapper;\n  pointMapper->SetInputConnection(pointFit->GetOutputPort());\n  pointMapper->ScalarVisibilityOn();\n  pointMapper->SetScalarRange(lo, hi);\n  pointMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n\n  // Fit polygons to surface (cell strategy)\n  vtkNew<vtkFitToHeightMapFilter> cellFit;\n  cellFit->SetInputConnection(probeDem->GetOutputPort());\n  cellFit->SetHeightMapConnection(demReader->GetOutputPort());\n  cellFit->SetFittingStrategyToCellAverageHeight();\n  cellFit->UseHeightMapOffsetOn();\n\n  vtkNew<vtkPolyDataMapper> cellMapper;\n  cellMapper->SetInputConnection(cellFit->GetOutputPort());\n  cellMapper->ScalarVisibilityOn();\n  cellMapper->SetScalarRange(lo, hi);\n  cellMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> cellActor;\n  cellActor->SetMapper(cellMapper);\n\n  // Render the three representations\n  ren0->AddActor(demActor);\n  ren1->AddActor(pointActor);\n  ren2->AddActor(cellActor);\n\n  // Look down the x axis\n  ren0->GetActiveCamera()->SetPosition(1, 0, 0);\n  ren0->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  ren0->GetActiveCamera()->SetViewUp(0, 0, 1);\n  ren0->ResetCamera();\n\n  // Rotate to an oblique view\n  ren0->GetActiveCamera()->Azimuth(30.0);\n  ren0->GetActiveCamera()->Elevation(60.0);\n\n  // Share the cameras\n  ren1->SetActiveCamera(ren0->GetActiveCamera());\n  ren2->SetActiveCamera(ren0->GetActiveCamera());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/FitToHeightMap/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FitToHeightMap)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  FiltersModeling\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FitToHeightMap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FitToHeightMap MACOSX_BUNDLE FitToHeightMap.cxx )\n  target_link_libraries(FitToHeightMap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FitToHeightMap\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/FitToHeightMap/#download-and-build-fittoheightmap","title":"Download and Build FitToHeightMap","text":"

        Click here to download FitToHeightMap and its CMakeLists.txt file. Once the tarball FitToHeightMap.tar has been downloaded and extracted,

        cd FitToHeightMap/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FitToHeightMap\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/IdentifyHoles/","title":"IdentifyHoles","text":"

        vtk-examples/Cxx/Meshes/IdentifyHoles

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/IdentifyHoles/#description","title":"Description","text":"

        This example fills the holes in a mesh and then extracts the filled holes as seprate regions.

        The example proceeds as follow:

        1. Read the polydata.
        2. Fill the holes with vtkFillHolesFilter.
        3. Create a new polydata that contains the filled holes. To do this we rely on the fact that the fill holes filter stores the original cells first and then adds the new cells that fill the holes. Using vtkCellIterator, we skip the original cells and then continue iterating to obtain the new cells.
        4. Use vtkConnectivityFilter on the filled polydata to identify the individual holes.

        Note

        We have to use vtkConnectivtyFilter and not vtkPolyDataConnectivityFilter since the later does not create RegionIds cell data.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/IdentifyHoles/#code","title":"Code","text":"

        IdentifyHoles.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkConnectivityFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFillHolesFilter.h>\n#include <vtkGenericCell.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cout << \"Usgae: \" << argv[0] << \" file.vtp e.g. Torso.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // Fill the holes\n  vtkNew<vtkFillHolesFilter> fillHoles;\n  fillHoles->SetInputConnection(reader->GetOutputPort());\n  fillHoles->SetHoleSize(1000.0);\n\n  // Make the triangle winding order consistent\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(fillHoles->GetOutputPort());\n  normals->ConsistencyOn();\n  normals->SplittingOff();\n  normals->Update();\n  normals->GetOutput()->GetPointData()->SetNormals(\n      reader->GetOutput()->GetPointData()->GetNormals());\n\n  // How many added cells\n  vtkIdType numOriginalCells = reader->GetOutput()->GetNumberOfCells();\n  vtkIdType numNewCells = normals->GetOutput()->GetNumberOfCells();\n\n  // Iterate over the original cells\n  auto it = normals->GetOutput()->NewCellIterator();\n  vtkIdType numCells = 0;\n  for (it->InitTraversal();\n       !it->IsDoneWithTraversal() && numCells < numOriginalCells;\n       it->GoToNextCell(), ++numCells)\n  {\n  }\n  std::cout << \"Num original: \" << numOriginalCells\n            << \", Num new: \" << numNewCells\n            << \", Num added: \" << numNewCells - numOriginalCells << std::endl;\n  vtkNew<vtkPolyData> holePolyData;\n  holePolyData->Allocate(normals->GetOutput(), numNewCells - numOriginalCells);\n  holePolyData->SetPoints(normals->GetOutput()->GetPoints());\n\n  vtkNew<vtkGenericCell> cell;\n\n  // The remaining cells are the new ones from the hole filler\n  for (; !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    it->GetCell(cell);\n    holePolyData->InsertNextCell(it->GetCellType(), cell->GetPointIds());\n  }\n  it->Delete();\n\n  // We have to use ConnectivtyFilter and not\n  // PolyDataConnectivityFilter since the later does not create\n  // RegionIds cell data.\n  vtkNew<vtkConnectivityFilter> connectivity;\n  connectivity->SetInputData(holePolyData);\n  connectivity->SetExtractionModeToAllRegions();\n  connectivity->ColorRegionsOn();\n  connectivity->Update();\n  std::cout << \"Found \" << connectivity->GetNumberOfExtractedRegions()\n            << \" holes\" << std::endl;\n\n  // Visualize\n\n  // Create a mapper and actor for the fill polydata\n  vtkNew<vtkDataSetMapper> filledMapper;\n  filledMapper->SetInputConnection(connectivity->GetOutputPort());\n  filledMapper->SetScalarModeToUseCellData();\n  filledMapper->SetScalarRange(connectivity->GetOutput()\n                                   ->GetCellData()\n                                   ->GetArray(\"RegionId\")\n                                   ->GetRange());\n  vtkNew<vtkActor> filledActor;\n  filledActor->SetMapper(filledMapper);\n  filledActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a mapper and actor for the original polydata\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkProperty> backfaceProp;\n  backfaceProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->SetBackfaceProperty(backfaceProp);\n  originalActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Flesh\").GetData());\n  originalActor->GetProperty()->SetRepresentationToWireframe();\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(512, 512);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"IdentifyHoles\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(originalActor);\n  renderer->AddActor(filledActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  renderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->GetActiveCamera()->Azimuth(60);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n  // Render and interact\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/IdentifyHoles/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IdentifyHoles)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IdentifyHoles: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IdentifyHoles MACOSX_BUNDLE IdentifyHoles.cxx )\n  target_link_libraries(IdentifyHoles PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IdentifyHoles\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/IdentifyHoles/#download-and-build-identifyholes","title":"Download and Build IdentifyHoles","text":"

        Click here to download IdentifyHoles and its CMakeLists.txt file. Once the tarball IdentifyHoles.tar has been downloaded and extracted,

        cd IdentifyHoles/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IdentifyHoles\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/InterpolateFieldDataDemo/","title":"InterpolateFieldDataDemo","text":"

        vtk-examples/Cxx/Meshes/InterpolateFieldDataDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/InterpolateFieldDataDemo/#description","title":"Description","text":"

        This example uses vtkPointInterpolator probe a high resolution dataset with a lower resolution dataset. Then, using vtkInterpolateDataSetAttributes, interpolate between the original low resolution data and the probed, low resolution data.

        Warning

        For the vtkPointInterpolator, point arrays will not be interpolated unless PassPointArrays is off. vtkPointInterpolator does not interpolate vtkFieldData. To interpolate vtkFieldData it must be added as the active scalar.

        Warning

        vtkInterpolateDataSetAttibutes does not interpolate vtkFieldData. To interpolate vtkFieldData it must be added as the active scalar.

        Thanks

        This example was inspired by Andrew E. Slaughter, Idaho National Laboratory.

        Note

        In Windows, testing using coarseGrid.e will fail. It seems that this file has UTF-8 characters in it.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/InterpolateFieldDataDemo/#code","title":"Code","text":"

        InterpolateFieldDataDemo.cxx

        // This example was derived a python script created by Andrew E. Slaughter\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCompositeDataGeometryFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExodusIIReader.h>\n#include <vtkGaussianKernel.h>\n#include <vtkInterpolateDataSetAttributes.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPointInterpolator.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStaticPointLocator.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int argc, char* argv[])\n{\n  std::string variable = \"u\";\n  double range[2] = {0, 10};\n\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" coarseMesh fineMesh e.g. coarseGrid.e fineGrid.e-s002\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string file0 = argv[1];\n  std::string file1 = argv[2];\n\n  ///////////////////////////////////////////////////////////////////////////\n  // FILE 0: COARSE MESH WITH SOLUTION 0\n  vtkNew<vtkExodusIIReader> coarseReader;\n  coarseReader->SetFileName(file0.c_str());\n  coarseReader->UpdateInformation();\n  coarseReader->SetTimeStep(0);\n  coarseReader->SetAllArrayStatus(vtkExodusIIReader::NODAL, 1);\n  coarseReader->Update();\n\n  vtkNew<vtkCompositeDataGeometryFilter> coarseGeometry;\n  coarseGeometry->SetInputConnection(0, coarseReader->GetOutputPort(0));\n  coarseGeometry->Update();\n\n  vtkNew<vtkPolyDataMapper> coarseMapper;\n  coarseMapper->SetInputConnection(coarseGeometry->GetOutputPort());\n  coarseMapper->SelectColorArray(variable.c_str());\n  coarseMapper->SetScalarModeToUsePointFieldData();\n  coarseMapper->InterpolateScalarsBeforeMappingOn();\n  coarseMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> coarseActor;\n  coarseActor->SetMapper(coarseMapper);\n  coarseActor->GetProperty()->SetEdgeVisibility(true);\n\n  vtkNew<vtkRenderer> coarseRenderer;\n  coarseRenderer->AddViewProp(coarseActor);\n\n  /////////////////////////////////////////////////////////////////////\n  // FILE 1: FINE MESH WITH SOLUTION 1\n\n  vtkNew<vtkExodusIIReader> fineReader;\n  fineReader->SetFileName(file1.c_str());\n  fineReader->UpdateInformation();\n  fineReader->SetTimeStep(0);\n  fineReader->SetAllArrayStatus(vtkExodusIIReader::NODAL, 1);\n  fineReader->Update();\n\n  vtkNew<vtkCompositeDataGeometryFilter> fineGeometry;\n  fineGeometry->SetInputConnection(0, fineReader->GetOutputPort(0));\n  fineGeometry->Update();\n  fineGeometry->GetOutput()->GetPointData()->SetActiveScalars(variable.c_str());\n\n  vtkNew<vtkPolyDataMapper> fineGeometryMapper;\n  fineGeometryMapper->SetInputConnection(fineGeometry->GetOutputPort());\n  fineGeometryMapper->SelectColorArray(variable.c_str());\n  fineGeometryMapper->SetScalarModeToUsePointFieldData();\n  fineGeometryMapper->InterpolateScalarsBeforeMappingOn();\n  fineGeometryMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> fineGeometryActor;\n  fineGeometryActor->SetMapper(fineGeometryMapper);\n  fineGeometryActor->GetProperty()->SetEdgeVisibility(true);\n\n  vtkNew<vtkRenderer> fineGeometryRenderer;\n  fineGeometryRenderer->AddViewProp(fineGeometryActor);\n\n  //////////////////////////////////////////////////////////////////////\n  // PROJECT SOLUTION FROM FILE 0 to GRID FROM FILE 1\n\n  // Build the structure to interpolate onto\n  vtkSmartPointer<vtkUnstructuredGrid>\n      coarseInterpolatedGrid = // output to be interpolated on to\n      vtkSmartPointer<vtkUnstructuredGrid>::New();\n\n  vtkMultiBlockDataSet* coarseMultiBlock = dynamic_cast<vtkMultiBlockDataSet*>(\n      coarseReader->GetOutput()->GetBlock(0));\n  coarseInterpolatedGrid->DeepCopy(\n      dynamic_cast<vtkUnstructuredGrid*>(coarseMultiBlock->GetBlock(0)));\n\n  vtkNew<vtkStaticPointLocator> locator;\n  locator->SetDataSet(fineGeometry->GetOutput());\n  locator->BuildLocator();\n\n  vtkNew<vtkGaussianKernel> kernel;\n  kernel->SetSharpness(4);\n  kernel->SetKernelFootprintToNClosest();\n  kernel->SetNumberOfPoints(10);\n  kernel->SetSharpness(4.0);\n\n  // Probe the fine geometry with the course geometry.\n  // NOTE: The point arrays will not be interpolated unless PassPointArrays is\n  // off.\n  vtkNew<vtkPointInterpolator> coarseInterpolator;\n  coarseInterpolator->SetSourceData(\n      fineGeometry->GetOutput()); // Pc data set to be probed by input points P\n  coarseInterpolator->SetInputData(coarseGeometry->GetOutput());\n  coarseInterpolator->SetKernel(kernel);\n  coarseInterpolator->SetLocator(locator);\n  coarseInterpolator->SetNullPointsStrategyToClosestPoint();\n  coarseInterpolator->PassPointArraysOff();\n  coarseInterpolator->Update();\n\n  vtkNew<vtkDataSetMapper> coarseInterpolatorMapper;\n  coarseInterpolatorMapper->SetInputConnection(\n      coarseInterpolator->GetOutputPort());\n  coarseInterpolatorMapper->SelectColorArray(variable.c_str());\n  coarseInterpolatorMapper->SetScalarModeToUsePointFieldData();\n  coarseInterpolatorMapper->InterpolateScalarsBeforeMappingOn();\n  coarseInterpolatorMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> coarseInterpolatorActor;\n  coarseInterpolatorActor->SetMapper(coarseInterpolatorMapper);\n  coarseInterpolatorActor->GetProperty()->SetEdgeVisibility(true);\n\n  vtkNew<vtkRenderer> coarseInterpolatorRenderer;\n  coarseInterpolatorRenderer->AddActor(coarseInterpolatorActor);\n\n  // Set the active scalar for the two inputs.\n  // NOTE: InterpolateDataSetAttibutes does not interpolate field data.\n  // To interpolate field data it must be added as the active scalar\n  coarseInterpolatedGrid->GetPointData()->SetActiveScalars(variable.c_str());\n  coarseInterpolator->GetOutput()->GetPointData()->SetActiveScalars(\n      variable.c_str());\n\n  vtkNew<vtkInterpolateDataSetAttributes> coarseInterpolateAttributes;\n  coarseInterpolateAttributes->AddInputData(0, coarseInterpolatedGrid);\n  coarseInterpolateAttributes->AddInputData(0, coarseInterpolator->GetOutput());\n  coarseInterpolateAttributes->SetT(0.5);\n  coarseInterpolateAttributes->Update();\n\n  vtkNew<vtkDataSetMapper> coarseInterpolateAttibutesMapper;\n  coarseInterpolateAttibutesMapper->SetInputConnection(\n      coarseInterpolateAttributes->GetOutputPort());\n  coarseInterpolateAttibutesMapper->SelectColorArray(variable.c_str());\n  coarseInterpolateAttibutesMapper->SetScalarModeToUsePointFieldData();\n  coarseInterpolateAttibutesMapper->InterpolateScalarsBeforeMappingOn();\n  coarseInterpolateAttibutesMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> coarseInterpolateAttributesActor;\n  coarseInterpolateAttributesActor->SetMapper(coarseInterpolateAttibutesMapper);\n  coarseInterpolateAttributesActor->GetProperty()->SetEdgeVisibility(true);\n\n  vtkNew<vtkRenderer> coarseInterpolateAttributesRenderer;\n  coarseInterpolateAttributesRenderer->AddActor(\n      coarseInterpolateAttributesActor);\n\n  /////////////////////////\n  //  Window and Interactor\n\n  vtkNew<vtkRenderWindow> window;\n\n  // Use the same camera for each renderer\n  fineGeometryRenderer->SetActiveCamera(coarseRenderer->GetActiveCamera());\n  coarseInterpolatorRenderer->SetActiveCamera(\n      coarseRenderer->GetActiveCamera());\n  coarseInterpolateAttributesRenderer->SetActiveCamera(\n      coarseRenderer->GetActiveCamera());\n\n  // Set each renderer color\n  vtkNew<vtkNamedColors> colors;\n  coarseRenderer->SetBackground(colors->GetColor3d(\"Gainsboro\").GetData());\n  coarseInterpolatorRenderer->SetBackground(\n      colors->GetColor3d(\"LightGrey\").GetData());\n  coarseInterpolateAttributesRenderer->SetBackground(\n      colors->GetColor3d(\"Silver\").GetData());\n  fineGeometryRenderer->SetBackground(colors->GetColor3d(\"DarkGray\").GetData());\n\n  // Set the viewport for each renderer\n  coarseRenderer->SetViewport(0, 0, 0.25, 1);\n  coarseInterpolatorRenderer->SetViewport(0.25, 0, 0.5, 1);\n  coarseInterpolateAttributesRenderer->SetViewport(0.5, 0, 0.75, 1);\n  fineGeometryRenderer->SetViewport(0.75, 0, 1, 1);\n\n  // Add the renderers\n  window->AddRenderer(coarseRenderer);             // low res\n  window->AddRenderer(coarseInterpolatorRenderer); // interpolated geometry\n  window->AddRenderer(\n      coarseInterpolateAttributesRenderer);  // interpolated attributes\n  window->AddRenderer(fineGeometryRenderer); // hi res with point data\n\n  // The size the window to hold 4 viewports of width 320\n  window->SetSize(1280, 320);\n  window->SetWindowName(\"InterpolateFieldDataDemo\");\n\n  // Create the interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n  window->Render();\n  interactor->Initialize();\n\n  // Reset the camera to a default view, shared by all\n  coarseRenderer->ResetCamera();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/InterpolateFieldDataDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InterpolateFieldDataDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersGeometry\n  FiltersPoints\n  IOExodus\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InterpolateFieldDataDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InterpolateFieldDataDemo MACOSX_BUNDLE InterpolateFieldDataDemo.cxx )\n  target_link_libraries(InterpolateFieldDataDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InterpolateFieldDataDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/InterpolateFieldDataDemo/#download-and-build-interpolatefielddatademo","title":"Download and Build InterpolateFieldDataDemo","text":"

        Click here to download InterpolateFieldDataDemo and its CMakeLists.txt file. Once the tarball InterpolateFieldDataDemo.tar has been downloaded and extracted,

        cd InterpolateFieldDataDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./InterpolateFieldDataDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/MatrixMathFilter/","title":"MatrixMathFilter","text":"

        vtk-examples/Cxx/Meshes/MatrixMathFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/MatrixMathFilter/#code","title":"Code","text":"

        MatrixMathFilter.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkMatrixMathFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGridReader.h>\n#include <vtkXMLPolyDataWriter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cerr << \"Required arguments: vtkFile e.g. tensors.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  std::cout << \"filename: \" << filename << std::endl;\n\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkDataSetSurfaceFilter> surfaceFilter;\n  surfaceFilter->SetInputConnection(reader->GetOutputPort());\n  surfaceFilter->Update();\n\n  vtkNew<vtkMatrixMathFilter> matrixMathFilter;\n  // matrixMathFilter->SetOperationToDeterminant();\n  matrixMathFilter->SetOperationToEigenvalue();\n  matrixMathFilter->SetInputConnection(surfaceFilter->GetOutputPort());\n  matrixMathFilter->Update();\n  matrixMathFilter->GetOutput()->GetPointData()->SetActiveScalars(\"Eigenvalue\");\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetInputConnection(matrixMathFilter->GetOutputPort());\n  writer->SetFileName(\"output.vtp\");\n  writer->Write();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(matrixMathFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MatrixMathFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n  renderer->GetActiveCamera()->Azimuth(45);\n  renderer->GetActiveCamera()->Pitch(-22.5);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(0.95);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/MatrixMathFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MatrixMathFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  FiltersVerdict\n  IOLegacy\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MatrixMathFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MatrixMathFilter MACOSX_BUNDLE MatrixMathFilter.cxx )\n  target_link_libraries(MatrixMathFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MatrixMathFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/MatrixMathFilter/#download-and-build-matrixmathfilter","title":"Download and Build MatrixMathFilter","text":"

        Click here to download MatrixMathFilter and its CMakeLists.txt file. Once the tarball MatrixMathFilter.tar has been downloaded and extracted,

        cd MatrixMathFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MatrixMathFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/OBBDicer/","title":"OBBDicer","text":"

        vtk-examples/Cxx/Meshes/OBBDicer

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/OBBDicer/#description","title":"Description","text":"

        The vtkOBBDicer filter breaks up an input mesh into a number of pieces. The resulting mesh contains scalar point data that can be used to extract the individual pieces with a filter like vtkThresholdFilter. This examples displays the output of vtkOBBDicer with a different color for each piece.

        The first argument is a filename for a vtkPolyData reader. If not specified, then a vtkSphereSource generates the vtkPolyData. The second argument is the number of pieces and is optional. The default is 4.

        The example was run with these arguments:

           OBBDicer Armadill0 20\n

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/OBBDicer/#code","title":"Code","text":"

        OBBDicer.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBDicer.h>\n#include <vtkOutlineCornerFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <random>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  int pieces = 4;\n  if (argc > 2)\n  {\n    pieces = std::atoi(argv[2]);\n  }\n\n  auto inputPolyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  // Create pipeline\n  vtkNew<vtkOBBDicer> dicer;\n  dicer->SetInputData(inputPolyData);\n  dicer->SetNumberOfPieces(pieces);\n  dicer->SetDiceModeToSpecifiedNumberOfPieces();\n  dicer->Update();\n\n  int numberOfRegions = dicer->GetNumberOfActualPieces();\n\n  // Fill in a few known colors, the rest will be generated if needed\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(std::max(numberOfRegions, 10));\n  lut->Build();\n  lut->SetTableValue(0, colors->GetColor4d(\"Gold\").GetData());\n  lut->SetTableValue(1, colors->GetColor4d(\"Banana\").GetData());\n  lut->SetTableValue(2, colors->GetColor4d(\"Tomato\").GetData());\n  lut->SetTableValue(3, colors->GetColor4d(\"Wheat\").GetData());\n  lut->SetTableValue(4, colors->GetColor4d(\"Lavender\").GetData());\n  lut->SetTableValue(5, colors->GetColor4d(\"Flesh\").GetData());\n  lut->SetTableValue(6, colors->GetColor4d(\"Raspberry\").GetData());\n  lut->SetTableValue(7, colors->GetColor4d(\"Salmon\").GetData());\n  lut->SetTableValue(8, colors->GetColor4d(\"Mint\").GetData());\n  lut->SetTableValue(9, colors->GetColor4d(\"Peacock\").GetData());\n\n  // If the number of regions is larger than the number of specified colors,\n  // generate some random colors.\n  // Note: If a Python version is written, it is probably best to use\n  //       vtkMinimalStandardRandomSequence in it and here, to ensure\n  //       that the random number generation is the same.\n  if (numberOfRegions > 9)\n  {\n    std::mt19937 mt(4355412); // Standard mersenne_twister_engine\n    std::uniform_real_distribution<double> distribution(.6, 1.0);\n    for (auto i = 10; i < numberOfRegions; ++i)\n    {\n      lut->SetTableValue(i, distribution(mt), distribution(mt),\n                         distribution(mt), 1.0);\n    }\n  }\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(dicer->GetOutputPort());\n  inputMapper->SetScalarRange(0, dicer->GetNumberOfActualPieces());\n  inputMapper->SetLookupTable(lut);\n\n  std::cout << \"Asked for: \" << dicer->GetNumberOfPieces()\n            << \" pieces, got: \" << dicer->GetNumberOfActualPieces()\n            << std::endl;\n\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkOutlineCornerFilter> outline;\n  outline->SetInputData(inputPolyData);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OBBDicer\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(outlineActor);\n  renderer->AddActor(inputActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->GetActiveCamera()->Azimuth(150);\n  renderer->GetActiveCamera()->Elevation(15);\n  renderer->ResetCamera();\n\n  // Render the image\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Meshes/OBBDicer/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OBBDicer)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OBBDicer: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OBBDicer MACOSX_BUNDLE OBBDicer.cxx )\n  target_link_libraries(OBBDicer PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OBBDicer\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/OBBDicer/#download-and-build-obbdicer","title":"Download and Build OBBDicer","text":"

        Click here to download OBBDicer and its CMakeLists.txt file. Once the tarball OBBDicer.tar has been downloaded and extracted,

        cd OBBDicer/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OBBDicer\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/PointInterpolator/","title":"PointInterpolator","text":"

        vtk-examples/Cxx/Meshes/PointInterpolator

        "},{"location":"Cxx/Meshes/PointInterpolator/#description","title":"Description","text":"

        This example uses vtkPointInterpolator with a Gaussian Kernel (or other kernel) to interpolate and extrapolate more smoothly the fields inside and outside the probed area.

        Info

        This C++ code is translated from the python code that Kenichiro Yoshimi wrote to respond to Hosam. See the discourse discussion.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/PointInterpolator/#code","title":"Code","text":"

        PointInterpolator.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDelimitedTextReader.h>\n#include <vtkGaussianKernel.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPointGaussianMapper.h>\n#include <vtkPointInterpolator.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkTableToPolyData.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" sparsePoints.txt InterpolatingOnSTL_final.stl\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string pointsFile = argv[1];\n  std::string probeSurfaceFile = argv[2];\n\n  // Read a points data\n  vtkNew<vtkDelimitedTextReader> pointsReader;\n  pointsReader->SetFileName(pointsFile.c_str());\n  pointsReader->DetectNumericColumnsOn();\n  pointsReader->SetFieldDelimiterCharacters(\"\\t\");\n  pointsReader->SetHaveHeaders(true);\n\n  vtkNew<vtkTableToPolyData> tablePoints;\n  tablePoints->SetInputConnection(pointsReader->GetOutputPort());\n  tablePoints->SetXColumn(\"x\");\n  tablePoints->SetYColumn(\"y\");\n  tablePoints->SetZColumn(\"z\");\n  tablePoints->Update();\n\n  vtkPolyData* points = tablePoints->GetOutput();\n  points->GetPointData()->SetActiveScalars(\"val\");\n  double* range = points->GetPointData()->GetScalars()->GetRange();\n\n  // Read a probe surface\n  vtkNew<vtkSTLReader> stlReader;\n  stlReader->SetFileName(probeSurfaceFile.c_str());\n  stlReader->Update();\n\n  vtkPolyData* surface = stlReader->GetOutput();\n  // double* bounds = surface->GetBounds();\n\n  // Gaussian kernel.\n  vtkNew<vtkGaussianKernel> gaussianKernel;\n  gaussianKernel->SetSharpness(2.0);\n  gaussianKernel->SetRadius(12.0);\n\n  vtkNew<vtkPointInterpolator> interpolator;\n  interpolator->SetInputData(surface);\n  interpolator->SetSourceData(points);\n  interpolator->SetKernel(gaussianKernel);\n\n  // Visualize.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(interpolator->GetOutputPort());\n  mapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkPointGaussianMapper> pointsMapper;\n  pointsMapper->SetInputData(points);\n  pointsMapper->SetScalarRange(range);\n  pointsMapper->SetScaleFactor(0.6);\n  pointsMapper->EmissiveOff();\n  // clang-format off\n  pointsMapper->SetSplatShaderCode(\n      \"//VTK::Color::Impl\\n\"\n      \"float dist = dot(offsetVCVSOutput.xy,offsetVCVSOutput.xy);\\n\"\n      \"if (dist > 1.0) {\\n\"\n      \"  discard;\\n\"\n      \"} else {\\n\"\n      \"  float scale = (1.0 - dist);\\n\"\n      \"  ambientColor *= scale;\\n\"\n      \"  diffuseColor *= scale;\\n\"\n      \"};\\n\");\n  // clang-format on\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"PointInterpolator\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(pointsActor);\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(-45);\n\n  renderWindow->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/PointInterpolator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointInterpolator)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersPoints\n  IOGeometry\n  IOInfovis\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointInterpolator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointInterpolator MACOSX_BUNDLE PointInterpolator.cxx )\n  target_link_libraries(PointInterpolator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointInterpolator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/PointInterpolator/#download-and-build-pointinterpolator","title":"Download and Build PointInterpolator","text":"

        Click here to download PointInterpolator and its CMakeLists.txt file. Once the tarball PointInterpolator.tar has been downloaded and extracted,

        cd PointInterpolator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointInterpolator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/QuadricClustering/","title":"QuadricClustering","text":"

        vtk-examples/Cxx/Meshes/QuadricClustering

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/QuadricClustering/#description","title":"Description","text":"

        The algorithm used is the one described by Peter Lindstrom in his Siggraph 2000 paper, \"Out-of-Core Simplification of Large Polygonal Models.\" The general approach of the algorithm is to cluster vertices in a uniform binning of space, accumulating the quadric of each triangle (pushed out to the triangles vertices) within each bin, and then determining an optimal position for a single vertex in a bin by using the accumulated quadric.

        Seealso

        QuadricDecimation and Decimation.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/QuadricClustering/#code","title":"Code","text":"

        QuadricClustering.cxx

        #include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadricClustering.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    inputPolyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(30);\n    sphereSource->SetPhiResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::cout << \"Before decimation\" << std::endl << \"------------\" << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n\n  vtkNew<vtkQuadricClustering> decimate;\n  decimate->SetInputData(inputPolyData);\n  decimate->UseFeatureEdgesOn();\n  decimate->Update();\n\n  vtkNew<vtkPolyData> decimated;\n  decimated->ShallowCopy(decimate->GetOutput());\n\n  std::cout << \"After decimation\" << std::endl << \"------------\" << std::endl;\n  std::cout << \"There are \" << decimated->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << decimated->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n  std::cout << \"Reduction: \"\n            << static_cast<double>((inputPolyData->GetNumberOfPolys() -\n                                    decimated->GetNumberOfPolys())) /\n          static_cast<double>(inputPolyData->GetNumberOfPolys())\n            << std::endl;\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputData(inputPolyData);\n\n  vtkNew<vtkProperty> backFace;\n  backFace->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetInterpolationToFlat();\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  inputActor->SetBackfaceProperty(backFace);\n\n  vtkNew<vtkPolyDataMapper> decimatedMapper;\n  decimatedMapper->SetInputData(decimated);\n\n  vtkNew<vtkActor> decimatedActor;\n  decimatedActor->SetMapper(decimatedMapper);\n  decimatedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  decimatedActor->GetProperty()->SetInterpolationToFlat();\n  decimatedActor->SetBackfaceProperty(backFace);\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"QuadricClustering\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Add the sphere to the left and the cube to the right\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(decimatedActor);\n\n  // Shared camera looking down the -y axis\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, -1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Elevation(30);\n  camera->Azimuth(30);\n\n  leftRenderer->SetActiveCamera(camera);\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->ResetCamera();\n  leftRenderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/QuadricClustering/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadricClustering)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadricClustering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadricClustering MACOSX_BUNDLE QuadricClustering.cxx )\n  target_link_libraries(QuadricClustering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadricClustering\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/QuadricClustering/#download-and-build-quadricclustering","title":"Download and Build QuadricClustering","text":"

        Click here to download QuadricClustering and its CMakeLists.txt file. Once the tarball QuadricClustering.tar has been downloaded and extracted,

        cd QuadricClustering/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QuadricClustering\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/QuadricDecimation/","title":"QuadricDecimation","text":"

        vtk-examples/Cxx/Meshes/QuadricDecimation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/QuadricDecimation/#description","title":"Description","text":"

        This example uses Quadric Clustering, based on the work of Garland and Heckbert who first presented the quadric error measure at Siggraph '97 \"Surface Simplification Using Quadric Error Metrics\". For details of the algorithm Michael Garland's Ph.D. thesis is also recommended. Hughues Hoppe's Vis '99 paper, \"New Quadric Metric for Simplifying Meshes with Appearance Attributes\" is also a good take on the subject especially as it pertains to the error metric applied to attributes.

        Seealso

        QuadricClustering and Decimation.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/QuadricDecimation/#code","title":"Code","text":"

        QuadricDecimation.cxx

        #include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadricDecimation.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    vtkNew<vtkTriangleFilter> triangles;\n    triangles->SetInputConnection(reader->GetOutputPort());\n    triangles->Update();\n    inputPolyData = triangles->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(30);\n    sphereSource->SetPhiResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  std::cout << \"Before decimation\" << std::endl << \"------------\" << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << inputPolyData->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n\n  vtkNew<vtkQuadricDecimation> decimate;\n  decimate->SetInputData(inputPolyData);\n  decimate->AttributeErrorMetricOn();\n  decimate->SetTargetReduction(.9);\n  decimate->VolumePreservationOn();\n\n  decimate->Update();\n\n  vtkNew<vtkPolyData> decimated;\n  decimated->ShallowCopy(decimate->GetOutput());\n\n  std::cout << \"After decimation\" << std::endl << \"------------\" << std::endl;\n  std::cout << \"There are \" << decimated->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << decimated->GetNumberOfPolys() << \" polygons.\"\n            << std::endl;\n  std::cout << \"Reduction: \"\n            << static_cast<double>((inputPolyData->GetNumberOfPolys() -\n                                    decimated->GetNumberOfPolys())) /\n          static_cast<double>(inputPolyData->GetNumberOfPolys())\n            << std::endl;\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputData(inputPolyData);\n\n  vtkNew<vtkProperty> backFace;\n  backFace->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetInterpolationToFlat();\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  inputActor->SetBackfaceProperty(backFace);\n\n  vtkNew<vtkPolyDataMapper> decimatedMapper;\n  decimatedMapper->SetInputData(decimated);\n\n  vtkNew<vtkActor> decimatedActor;\n  decimatedActor->SetMapper(decimatedMapper);\n  decimatedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"NavajoWhite\").GetData());\n  decimatedActor->GetProperty()->SetInterpolationToFlat();\n  decimatedActor->SetBackfaceProperty(backFace);\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"QuadricDecimation\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Add the sphere to the left and the cube to the right\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(decimatedActor);\n\n  // Shared camera looking down the -y axis\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, -1, 0);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->Elevation(30);\n  camera->Azimuth(30);\n\n  leftRenderer->SetActiveCamera(camera);\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->ResetCamera();\n  leftRenderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/QuadricDecimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadricDecimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadricDecimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadricDecimation MACOSX_BUNDLE QuadricDecimation.cxx )\n  target_link_libraries(QuadricDecimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadricDecimation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/QuadricDecimation/#download-and-build-quadricdecimation","title":"Download and Build QuadricDecimation","text":"

        Click here to download QuadricDecimation and its CMakeLists.txt file. Once the tarball QuadricDecimation.tar has been downloaded and extracted,

        cd QuadricDecimation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QuadricDecimation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/SimpleElevationFilter/","title":"SimpleElevationFilter","text":"

        vtk-examples/Cxx/Meshes/SimpleElevationFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/SimpleElevationFilter/#code","title":"Code","text":"

        SimpleElevationFilter.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDelaunay2D.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimpleElevationFilter.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Created a grid of points (heigh/terrian map).\n  vtkNew<vtkPoints> points;\n\n  unsigned int GridSize = 10;\n  for (unsigned int x = 0; x < GridSize; x++)\n  {\n    for (unsigned int y = 0; y < GridSize; y++)\n    {\n      points->InsertNextPoint(x, y, (x + y) / (y + 1));\n      std::cout << x << \" \" << y << \" \" << (x + y) / (y + 1) << std::endl;\n    }\n  }\n\n  double bounds[6];\n  points->GetBounds(bounds);\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> inputPolyData;\n  inputPolyData->SetPoints(points);\n\n  // Triangulate the grid points.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(inputPolyData);\n  delaunay->Update();\n\n  vtkNew<vtkSimpleElevationFilter> elevationFilter;\n  elevationFilter->SetInputConnection(delaunay->GetOutputPort());\n  elevationFilter->SetVector(0.0, 0.0, 1);\n  elevationFilter->Update();\n\n  vtkNew<vtkPolyData> output;\n  output->ShallowCopy(dynamic_cast<vtkPolyData*>(elevationFilter->GetOutput()));\n\n  vtkFloatArray* elevation = dynamic_cast<vtkFloatArray*>(\n      output->GetPointData()->GetArray(\"Elevation\"));\n\n  // Create the color map.\n  vtkNew<vtkLookupTable> colorLookupTable;\n  colorLookupTable->SetTableRange(bounds[4], bounds[5]);\n  colorLookupTable->Build();\n\n  // Generate the colors for each point based on the color map.\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n\n  for (vtkIdType i = 0; i < output->GetNumberOfPoints(); i++)\n  {\n    double val = elevation->GetValue(i);\n    // std::cout << \"val: \" << val << std::endl;\n\n    double dcolor[3];\n    colorLookupTable->GetColor(val, dcolor);\n    // std::cout << \"dcolor: \" << dcolor[0] << \" \" << dcolor[1] << \" \" <<\n    // dcolor[2]\n    //          << std::endl;\n    unsigned char color[3];\n    for (unsigned int j = 0; j < 3; j++)\n    {\n      color[j] = 255 * dcolor[j] / 1.0;\n    }\n    // std::cout << \"color: \" << (int)color[0] << \" \" << (int)color[1] << \" \"\n    //          << (int)color[2] << std::endl;\n\n    colors->InsertNextTupleValue(color);\n  }\n\n  output->GetPointData()->AddArray(colors);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(output);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SimpleElevationFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"ForestGreen\").GetData());\n\n  // z-axis points upwards and y-axis is lower right edge.\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-13.3586, 20.7305, 22.5147);\n  camera->SetFocalPoint(4.5, 4.5, 4.5);\n  camera->SetViewUp(0.506199, -0.328212, 0.797521);\n  camera->SetDistance(30.1146);\n  camera->SetClippingRange(14.3196, 50.0698);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/SimpleElevationFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SimpleElevationFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SimpleElevationFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SimpleElevationFilter MACOSX_BUNDLE SimpleElevationFilter.cxx )\n  target_link_libraries(SimpleElevationFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SimpleElevationFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/SimpleElevationFilter/#download-and-build-simpleelevationfilter","title":"Download and Build SimpleElevationFilter","text":"

        Click here to download SimpleElevationFilter and its CMakeLists.txt file. Once the tarball SimpleElevationFilter.tar has been downloaded and extracted,

        cd SimpleElevationFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SimpleElevationFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/SolidClip/","title":"SolidClip","text":"

        vtk-examples/Cxx/Meshes/SolidClip

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/SolidClip/#description","title":"Description","text":"

        This example clips a mesh and applies a backface property to that mesh so that it appears to have a solid interior.

        The \"ghost\" of the part clipped away is also shown.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/SolidClip/#code","title":"Code","text":"

        SolidClip.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSuperquadricSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a superquadric.\n  vtkNew<vtkSuperquadricSource> superquadricSource;\n  superquadricSource->SetPhiRoundness(3.1);\n  superquadricSource->SetThetaRoundness(2.2);\n\n  // Define a clipping plane.\n  vtkNew<vtkPlane> clipPlane;\n  clipPlane->SetNormal(1.0, -1.0, -1.0);\n  clipPlane->SetOrigin(0.0, 0.0, 0.0);\n\n  // Clip the source with the plane.\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(superquadricSource->GetOutputPort());\n  clipper->SetClipFunction(clipPlane);\n  // This will give us the polygonal data that is clipped away.\n  clipper->GenerateClippedOutputOn();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> superquadricMapper;\n  superquadricMapper->SetInputConnection(clipper->GetOutputPort());\n\n  vtkNew<vtkActor> superquadricActor;\n  superquadricActor->SetMapper(superquadricMapper);\n\n  // Create a property to be used for the back faces. Turn off all\n  // shading by specifying 0 weights for specular and diffuse. Max the\n  // ambient.\n  vtkNew<vtkProperty> backFaces;\n  backFaces->SetSpecular(0.0);\n  backFaces->SetDiffuse(0.0);\n  backFaces->SetAmbient(1.0);\n  backFaces->SetAmbientColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  superquadricActor->SetBackfaceProperty(backFaces);\n\n  // Here we get the the polygonal data that is clipped away.\n  vtkNew<vtkPolyDataMapper> clippedAwayMapper;\n  clippedAwayMapper->SetInputData(clipper->GetClippedOutput());\n  clippedAwayMapper->ScalarVisibilityOff();\n\n  // Let us display it as a faint object\n  vtkNew<vtkActor> clippedAwayActor;\n  clippedAwayActor->SetMapper(clippedAwayMapper);\n  clippedAwayActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Silver\").GetData());\n  clippedAwayActor->GetProperty()->SetOpacity(0.1);\n\n  // Create a renderer.\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"SolidClip\");\n\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add actors to the renderers.\n  renderer->AddActor(superquadricActor);\n  renderer->AddActor(clippedAwayActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->SetSize(600, 600);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  // Interact with the window.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/SolidClip/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SolidClip)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SolidClip: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SolidClip MACOSX_BUNDLE SolidClip.cxx )\n  target_link_libraries(SolidClip PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SolidClip\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/SolidClip/#download-and-build-solidclip","title":"Download and Build SolidClip","text":"

        Click here to download SolidClip and its CMakeLists.txt file. Once the tarball SolidClip.tar has been downloaded and extracted,

        cd SolidClip/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SolidClip\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/SplitPolyData/","title":"SplitPolyData","text":"

        vtk-examples/Cxx/Meshes/SplitPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/SplitPolyData/#description","title":"Description","text":"

        The vtkOBBDicer filter breaks up an input mesh into a number of pieces. The resulting mesh contains scalar point data that can be used to extract the individual pieces with a filter like vtkThreshold. This example stores each piece into a .vtp file.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/SplitPolyData/#code","title":"Code","text":"

        SplitPolyData.cxx

        #include <vtkActor.h>\n#include <vtkColorSeries.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGeometryFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBDicer.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkThreshold.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <sstream>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  std::string filename;\n  std::string extension;\n\n  vtkSmartPointer<vtkPolyData> inputPolyData =\n      ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n  if (argc > 1)\n  {\n    filename =\n        vtksys::SystemTools::GetFilenameWithoutExtension(std::string(argv[1]));\n    extension = vtksys::SystemTools::GetFilenameExtension(std::string(argv[1]));\n  }\n  else\n  {\n    filename = \"sphere\";\n    extension = \".vtp\";\n  }\n\n  // Create pipeline\n  vtkNew<vtkOBBDicer> dicer;\n  dicer->SetInputData(inputPolyData);\n  dicer->SetNumberOfPieces(4);\n  dicer->SetDiceModeToSpecifiedNumberOfPieces();\n  dicer->Update();\n\n  vtkNew<vtkThreshold> selector;\n  selector->SetInputArrayToProcess(0, 0, 0, 0, \"vtkOBBDicer_GroupIds\");\n  selector->SetInputConnection(dicer->GetOutputPort());\n  selector->AllScalarsOff();\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(namedColors->GetColor3d(\"NavajoWhite\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"SplitPolyData\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Use a color series to create a transfer function\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_DIVERGING_SPECTRAL_11);\n\n  // Create an actor for each piece\n  for (int i = 0; i < dicer->GetNumberOfActualPieces(); ++i)\n  {\n    selector->SetLowerThreshold(i);\n    selector->SetUpperThreshold(i);\n    vtkNew<vtkGeometryFilter> geometry;\n    geometry->SetInputConnection(selector->GetOutputPort());\n    geometry->Update();\n\n    vtkNew<vtkDataSetMapper> mapper;\n    mapper->SetInputData(geometry->GetOutput());\n    mapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n\n    vtkColor3ub color = colorSeries->GetColor(i);\n    double dColor[3];\n    dColor[0] = static_cast<double>(color[0]) / 255.0;\n    dColor[1] = static_cast<double>(color[1]) / 255.0;\n    dColor[2] = static_cast<double>(color[2]) / 255.0;\n    actor->GetProperty()->SetColor(dColor);\n    renderer->AddActor(actor);\n  }\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  vtkNew<vtkGeometryFilter> geometry;\n  geometry->SetInputConnection(selector->GetOutputPort());\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetInputConnection(geometry->GetOutputPort());\n  for (int i = 0; i < dicer->GetNumberOfActualPieces(); ++i)\n  {\n    std::stringstream pieceName;\n    pieceName << filename << \"_\" << i + 1 << extension;\n    selector->SetLowerThreshold(i);\n    selector->SetUpperThreshold(i);\n    writer->SetFileName(pieceName.str().c_str());\n    writer->Write();\n  }\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Meshes/SplitPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SplitPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SplitPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SplitPolyData MACOSX_BUNDLE SplitPolyData.cxx )\n  target_link_libraries(SplitPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SplitPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/SplitPolyData/#download-and-build-splitpolydata","title":"Download and Build SplitPolyData","text":"

        Click here to download SplitPolyData and its CMakeLists.txt file. Once the tarball SplitPolyData.tar has been downloaded and extracted,

        cd SplitPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SplitPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/Subdivision/","title":"Subdivision","text":"

        vtk-examples/Cxx/Meshes/Subdivision

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/Subdivision/#description","title":"Description","text":"

        In this example a mesh is read from a file and then subdivided using linear subdivision. The SetNumberOfSubdivisions(n) function controls how many times the mesh is subdivided. For each n, the number of triangles will increase by approximately a factor of 4. For example, if n=2, the number of triangles in the resulting mesh will be 16x the number of triangles in the original mesh.

        Different types of subdivisions can be obtained by replacing vtkLinearSubdivisionFilter with either vtkLoopSubdivisionFilter or vtkButterflySubdivisionFilter.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/Subdivision/#code","title":"Code","text":"

        Subdivision.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkButterflySubdivisionFilter.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkLoopSubdivisionFilter.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <map>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Test with these parameters: footbones.ply 2.\n  vtkNew<vtkNamedColors> colors;\n\n  std::map<int, std::string> actorColors;\n  actorColors[0] = \"BurlyWood\";\n  actorColors[1] = \"BurlyWood\";\n  actorColors[2] = \"BurlyWood\";\n\n  std::map<int, std::string> rendererColors;\n  rendererColors[0] = \"Gainsboro\";\n  rendererColors[1] = \"LightGrey\";\n  rendererColors[2] = \"Silver\";\n\n  vtkSmartPointer<vtkPolyData> originalMesh;\n\n  if (argc > 1) // If a file name is specified, open and use the file.\n  {\n    auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n    // Subdivision filters only work on triangles.\n    vtkNew<vtkTriangleFilter> triangles;\n    triangles->SetInputData(polyData);\n    triangles->Update();\n    originalMesh = triangles->GetOutput();\n  }\n  else // If a file name is not specified, create a sphere.\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n    originalMesh = sphereSource->GetOutput();\n  }\n\n  std::cout << \"Before subdivision\" << std::endl;\n  std::cout << \"    There are \" << originalMesh->GetNumberOfPoints()\n            << \" points.\" << std::endl;\n  std::cout << \"    There are \" << originalMesh->GetNumberOfPolys()\n            << \" triangles.\" << std::endl;\n\n  double numberOfViewports = 3.0;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(200 * numberOfViewports, 200); //(width, height)\n  renderWindow->SetWindowName(\"Subdivision\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  int numberOfSubdivisions = 2;\n  for (unsigned i = 0; i < numberOfViewports; i++)\n  {\n    // Note: Here we create a superclass pointer (vtkPolyDataAlgorithm) so that\n    // we can easily instantiate different types of subdivision filters.\n    // Typically you would not want to do this, but rather create the pointer to\n    // be the type filter you will actually use, e.g.\n    // vtkNew<vtkLinearSubdivisionFilter>  subdivisionFilter;\n    vtkSmartPointer<vtkPolyDataAlgorithm> subdivisionFilter;\n    switch (i)\n    {\n    case 0:\n      subdivisionFilter = vtkSmartPointer<vtkLinearSubdivisionFilter>::New();\n      dynamic_cast<vtkLinearSubdivisionFilter*>(subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      break;\n    case 1:\n      subdivisionFilter = vtkSmartPointer<vtkLoopSubdivisionFilter>::New();\n      dynamic_cast<vtkLoopSubdivisionFilter*>(subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      break;\n    case 2:\n      subdivisionFilter = vtkSmartPointer<vtkButterflySubdivisionFilter>::New();\n      dynamic_cast<vtkButterflySubdivisionFilter*>(\n          subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      break;\n    default:\n      break;\n    }\n    subdivisionFilter->SetInputData(originalMesh);\n    subdivisionFilter->Update();\n\n    vtkNew<vtkRenderer> renderer;\n\n    renderWindow->AddRenderer(renderer);\n    renderer->SetViewport(static_cast<double>(i) / numberOfViewports, 0,\n                          static_cast<double>(i + 1) / numberOfViewports, 1);\n\n    // Create a mapper and actor.\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(subdivisionFilter->GetOutputPort());\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(\n        colors->GetColor3d(actorColors[i]).GetData());\n\n    renderer->AddActor(actor);\n    renderer->SetBackground(colors->GetColor3d(rendererColors[i]).GetData());\n    renderer->ResetCamera();\n\n    renderWindow->Render();\n  }\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Meshes/Subdivision/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Subdivision)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Subdivision: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Subdivision MACOSX_BUNDLE Subdivision.cxx )\n  target_link_libraries(Subdivision PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Subdivision\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/Subdivision/#download-and-build-subdivision","title":"Download and Build Subdivision","text":"

        Click here to download Subdivision and its CMakeLists.txt file. Once the tarball Subdivision.tar has been downloaded and extracted,

        cd Subdivision/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Subdivision\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/SubdivisionDemo/","title":"SubdivisionDemo","text":"

        vtk-examples/Cxx/Meshes/SubdivisionDemo

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/SubdivisionDemo/#code","title":"Code","text":"

        SubdivisionDemo.cxx

        #include <vtkActor.h>\n#include <vtkButterflySubdivisionFilter.h>\n#include <vtkCamera.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkLoopSubdivisionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Test with these parameters: footbones.ply 2\n  int numberOfSubdivisions = 2;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  vtkSmartPointer<vtkPolyData> originalMesh; /* =\n      vtkSmartPointer<vtkPolyData>::New();*/\n  if (argc > 1) // If a file name is specified, open and use the file.\n  {\n    // Subdivision filters only work on triangles.\n    vtkNew<vtkTriangleFilter> triangles;\n    triangles->SetInputData(polyData);\n    triangles->Update();\n    originalMesh = triangles->GetOutput();\n  }\n  else\n  {\n    originalMesh = polyData;\n  }\n  if (argc > 2)\n  {\n    numberOfSubdivisions = std::stod(argv[2]);\n  }\n  std::cout << \"Before subdivision\" << std::endl;\n  std::cout << \"    There are \" << originalMesh->GetNumberOfPoints()\n            << \" points.\" << std::endl;\n  std::cout << \"    There are \" << originalMesh->GetNumberOfPolys()\n            << \" triangles.\" << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d background = colors->GetColor3d(\"Gray\");\n  vtkColor3d originalColor = colors->GetColor3d(\"Tomato\");\n  vtkColor3d loopColor = colors->GetColor3d(\"Banana\");\n  vtkColor3d butterflyColor = colors->GetColor3d(\"DodgerBlue\");\n\n  double numberOfViewports = 3.0;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(400 * numberOfViewports, 512); //(width, height)\n  renderWindow->SetWindowName(\"SubdivisionDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCamera> camera;\n\n  vtkNew<vtkLegendBoxActor> legend;\n  legend->SetNumberOfEntries(3);\n  vtkNew<vtkRenderer> legendRen;\n\n  for (unsigned i = 0; i < numberOfViewports; i++)\n  {\n    // Note: Here we create a superclass pointer (vtkPolyDataAlgorithm) so\n    // that we can easily instantiate different types of subdivision filters.\n    // Typically you would not want to do this, but rather create the pointer\n    // to be the type filter you will actually use, e.g.\n    // vtkNew<vtkLinearSubdivisionFilter>  subdivisionFilter;\n    vtkSmartPointer<vtkPolyDataAlgorithm> subdivisionFilter;\n    vtkNew<vtkRenderer> renderer;\n    vtkNew<vtkActor> actor;\n    switch (i)\n    {\n    case 0:\n      subdivisionFilter = vtkSmartPointer<vtkLinearSubdivisionFilter>::New();\n      dynamic_cast<vtkLinearSubdivisionFilter*>(subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      actor->GetProperty()->SetDiffuseColor(originalColor.GetData());\n      legend->SetEntry(i, subdivisionFilter->GetOutput(), \"Linear\",\n                       originalColor.GetData());\n      break;\n    case 1:\n      subdivisionFilter = vtkSmartPointer<vtkLoopSubdivisionFilter>::New();\n      dynamic_cast<vtkLoopSubdivisionFilter*>(subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      actor->GetProperty()->SetDiffuseColor(loopColor.GetData());\n      legend->SetEntry(i, subdivisionFilter->GetOutput(), \"Loop\",\n                       loopColor.GetData());\n      break;\n    case 2:\n      subdivisionFilter = vtkSmartPointer<vtkButterflySubdivisionFilter>::New();\n      dynamic_cast<vtkButterflySubdivisionFilter*>(\n          subdivisionFilter.GetPointer())\n          ->SetNumberOfSubdivisions(numberOfSubdivisions);\n      actor->GetProperty()->SetDiffuseColor(butterflyColor.GetData());\n      legend->SetEntry(i, subdivisionFilter->GetOutput(), \"Butterfly\",\n                       butterflyColor.GetData());\n      break;\n    default:\n      break;\n    }\n    subdivisionFilter->SetInputData(originalMesh);\n    subdivisionFilter->Update();\n\n    renderWindow->AddRenderer(renderer);\n    // We reserve the lower part of the viewport for the legend.\n    renderer->SetViewport(static_cast<double>(i) / numberOfViewports, 0.2,\n                          static_cast<double>(i + 1) / numberOfViewports, 1);\n    renderer->SetBackground(background.GetData());\n    renderer->SetActiveCamera(camera);\n    renderer->UseHiddenLineRemovalOn();\n    // Create a mapper and actor\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(subdivisionFilter->GetOutputPort());\n    actor->SetMapper(mapper);\n    renderer->AddActor(actor);\n    renderer->ResetCamera();\n  }\n\n  // Position the legend below the three viewports defined above.\n  legend->GetPositionCoordinate()->SetCoordinateSystemToView();\n  legend->GetPositionCoordinate()->SetValue(-0.3, -0.9);\n  legend->GetPosition2Coordinate()->SetCoordinateSystemToView();\n  legend->GetPosition2Coordinate()->SetValue(0.3, 0.9);\n  legend->BorderOff();\n  legendRen->AddActor(legend);\n  legendRen->SetBackground(background.GetData());\n  legendRen->SetViewport(0.0, 0.0, 1.0, 0.2);\n  renderWindow->AddRenderer(legendRen);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase.\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Meshes/SubdivisionDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SubdivisionDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SubdivisionDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SubdivisionDemo MACOSX_BUNDLE SubdivisionDemo.cxx )\n  target_link_libraries(SubdivisionDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SubdivisionDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/SubdivisionDemo/#download-and-build-subdivisiondemo","title":"Download and Build SubdivisionDemo","text":"

        Click here to download SubdivisionDemo and its CMakeLists.txt file. Once the tarball SubdivisionDemo.tar has been downloaded and extracted,

        cd SubdivisionDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SubdivisionDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData/","title":"TableBasedClipDataSetWithPolyData","text":"

        vtk-examples/Cxx/Meshes/TableBasedClipDataSetWithPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData/#description","title":"Description","text":"

        The example that shows how to use the vtkTableBasedClipDataSet to clip a vtkRectilinearGrid with an arbitrary polydata. vtkImplicitPolyDataDistance is used to turn the polydata into an implicit function. Every point of the grid is evaluated before sending to vtkTableBasedClipDataSet. This example uses a vtkConeSource to generate polydata to use, however any polydata could be used, including stl files.

        The left part of the image shows the inside clip and the distance field on a center slice. The right side shows the outside clip. When the program exits using the \"e: key, the example will report the cell type for both the inside and outside clips.

        Note

        Contrast this with the vtkClipDataSet example: ClipDataSetWithPolyData.

        Here is the summary reported when the example exits:

        \nThe clipped dataset(inside) contains a \n[vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 14176 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3084 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 6820 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 1196 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 3076 times.\n------------------------\nThe clipped dataset(outside) contains a \n[vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 125600 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3276 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 117732 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 1260 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 3332 times.\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData/#code","title":"Code","text":"

        TableBasedClipDataSetWithPolyData.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellTypes.h>\n#include <vtkConeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFloatArray.h>\n#include <vtkImplicitPolyDataDistance.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRectilinearGridGeometryFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTableBasedClipDataSet.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <map>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create polydata to slice the grid with. In this case, use a cone. This\n  // could be any polydata including a stl file.\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(50);\n  cone->SetDirection(0, 0, -1);\n  cone->SetHeight(3.0);\n  cone->CappingOn();\n  cone->Update();\n\n  // Implicit function that will be used to slice the mesh\n  vtkNew<vtkImplicitPolyDataDistance> implicitPolyDataDistance;\n  implicitPolyDataDistance->SetInput(cone->GetOutput());\n\n  // create a grid.\n  unsigned int dimension = 51;\n  vtkNew<vtkFloatArray> xCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    xCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  vtkNew<vtkFloatArray> yCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    yCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  vtkNew<vtkFloatArray> zCoords;\n  for (unsigned int i = 0; i < dimension; ++i)\n  {\n    zCoords->InsertNextValue(-1.0 +\n                             i * 2.0 / static_cast<float>(dimension - 1));\n  }\n  // The coordinates are assigned to the rectilinear grid. Make sure that\n  // the number of values in each of the XCoordinates, YCoordinates,\n  // and ZCoordinates is equal to what is defined in SetDimensions().\n  vtkNew<vtkRectilinearGrid> rgrid;\n  rgrid->SetDimensions(xCoords->GetNumberOfTuples(),\n                       yCoords->GetNumberOfTuples(),\n                       zCoords->GetNumberOfTuples());\n  rgrid->SetXCoordinates(xCoords);\n  rgrid->SetYCoordinates(yCoords);\n  rgrid->SetZCoordinates(zCoords);\n\n  // Create an array to hold distance information.\n  vtkNew<vtkFloatArray> signedDistances;\n  signedDistances->SetNumberOfComponents(1);\n  signedDistances->SetName(\"SignedDistances\");\n\n  // Evaluate the signed distance function at all of the grid points\n  for (vtkIdType pointId = 0; pointId < rgrid->GetNumberOfPoints(); ++pointId)\n  {\n    double p[3];\n    rgrid->GetPoint(pointId, p);\n    double signedDistance = implicitPolyDataDistance->EvaluateFunction(p);\n    signedDistances->InsertNextValue(signedDistance);\n  }\n\n  // Add the SignedDistances to the grid.\n  rgrid->GetPointData()->SetScalars(signedDistances);\n\n  // Use vtkTableBasedClipDataSet to slice the grid with the polydata.\n  vtkNew<vtkTableBasedClipDataSet> clipper;\n  clipper->SetInputData(rgrid);\n  clipper->InsideOutOn();\n  clipper->SetValue(0.0);\n  clipper->GenerateClippedOutputOn();\n  clipper->Update();\n\n  // --- mappers, actors, render, etc. ---\n  // Mapper and actor to view the cone.\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n\n  // Geometry filter to view the background grid.\n  vtkNew<vtkRectilinearGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputData(rgrid);\n  geometryFilter->SetExtent(0, dimension, 0, dimension, dimension / 2,\n                            dimension / 2);\n  geometryFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> rgridMapper;\n  rgridMapper->SetInputConnection(geometryFilter->GetOutputPort());\n  rgridMapper->SetScalarRange(\n      rgrid->GetPointData()->GetArray(\"SignedDistances\")->GetRange());\n\n  vtkNew<vtkActor> wireActor;\n  wireActor->SetMapper(rgridMapper);\n  wireActor->GetProperty()->SetRepresentationToWireframe();\n\n  // Mapper and actor to view the clipped mesh.\n  vtkNew<vtkDataSetMapper> clipperMapper;\n  clipperMapper->SetInputConnection(clipper->GetOutputPort());\n  clipperMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkDataSetMapper> clipperOutsideMapper;\n  clipperOutsideMapper->SetInputConnection(clipper->GetOutputPort(1));\n  clipperOutsideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clipperActor;\n  clipperActor->SetMapper(clipperMapper);\n  clipperActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> clipperOutsideActor;\n  clipperOutsideActor->SetMapper(clipperOutsideMapper);\n  clipperOutsideActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  // A renderer and render window\n  // Create a renderer, render window, and interactor.\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n  leftRenderer->UseHiddenLineRemovalOn();\n\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n  rightRenderer->UseHiddenLineRemovalOn();\n\n  // Add the actors.\n  leftRenderer->AddActor(wireActor);\n  leftRenderer->AddActor(clipperActor);\n  rightRenderer->AddActor(clipperOutsideActor);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(leftRenderer);\n  renderWindow->AddRenderer(rightRenderer);\n  renderWindow->SetWindowName(\"TableBasedClipDataSetWithPolyData\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Share the camera.\n\n  leftRenderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  leftRenderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  leftRenderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  leftRenderer->GetActiveCamera()->Azimuth(30);\n  leftRenderer->GetActiveCamera()->Elevation(30);\n  leftRenderer->ResetCamera();\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  // Generate a report.\n  vtkIdType numberOfCells = clipper->GetOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset(inside) contains a \" << std::endl\n            << clipper->GetOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> CellContainer;\n  CellContainer cellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    cellMap[clipper->GetOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : cellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n\n  numberOfCells = clipper->GetClippedOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset(outside) contains a \" << std::endl\n            << clipper->GetClippedOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> OutsideCellContainer;\n  CellContainer outsideCellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    outsideCellMap[clipper->GetClippedOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : outsideCellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TableBasedClipDataSetWithPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TableBasedClipDataSetWithPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TableBasedClipDataSetWithPolyData MACOSX_BUNDLE TableBasedClipDataSetWithPolyData.cxx )\n  target_link_libraries(TableBasedClipDataSetWithPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TableBasedClipDataSetWithPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData/#download-and-build-tablebasedclipdatasetwithpolydata","title":"Download and Build TableBasedClipDataSetWithPolyData","text":"

        Click here to download TableBasedClipDataSetWithPolyData and its CMakeLists.txt file. Once the tarball TableBasedClipDataSetWithPolyData.tar has been downloaded and extracted,

        cd TableBasedClipDataSetWithPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TableBasedClipDataSetWithPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData2/","title":"TableBasedClipDataSetWithPolyData2","text":"

        vtk-examples/Cxx/Meshes/TableBasedClipDataSetWithPolyData2

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData2/#description","title":"Description","text":"

        The example that shows how to use the vtkTableBasedClipDataSet to clip a vtkRectilinearGrid that contains a checkerboard pattern.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData2/#code","title":"Code","text":"

        TableBasedClipDataSetWithPolyData2.cxx

        // This program draws a checkerboard ala an OOF3D image display and\n// clips it with two planes.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkExecutive.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkLookupTable.h>\n#include <vtkMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTableBasedClipDataSet.h>\n\n///////////////////\nnamespace {\n// Make a rectilinear grid that shows image-like data, by creating a\n// cubic cell at each point. A checkerboard pattern is used for\n// simplicity.\n\nvtkSmartPointer<vtkRectilinearGrid> makeImage(int n);\n\n} // namespace\n\nint main(int, char*[])\n{\n  constexpr int imageSize = 64; // number of checkerboard squares on a side.\n\n  // Offsets for clipping planes with normals in the X and Y directions.\n  constexpr int xOffset = 8;\n  constexpr int yOffset = 8;\n\n  vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"TableBasedClipDataSetWithPolyData2\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  vtkNew<vtkInteractorStyleSwitch> style;\n  interactor->SetInteractorStyle(style);\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkSmartPointer<vtkRectilinearGrid> image = makeImage(imageSize);\n\n  // Clipping planes in the X and Y direction.\n  auto normals = vtkSmartPointer<vtkDoubleArray>::New();\n  vtkNew<vtkPoints> clipPts;\n  normals->SetNumberOfComponents(3);\n  double xnorm[3] = {-1., 0., 0.};\n  double ynorm[3] = {0., -1., 0.};\n  double xpt[3] = {xOffset, 0., 0.};\n  double ypt[3] = {0., yOffset, 0.};\n  normals->InsertNextTuple(xnorm);\n  normals->InsertNextTuple(ynorm);\n  clipPts->InsertNextPoint(xpt);\n  clipPts->InsertNextPoint(ypt);\n\n  vtkNew<vtkPlanes> clipPlanes;\n  clipPlanes->SetNormals(normals);\n  clipPlanes->SetPoints(clipPts);\n\n  vtkNew<vtkTableBasedClipDataSet> clipper;\n  clipper->SetClipFunction(clipPlanes);\n  clipper->SetInputData(image);\n\n  vtkNew<vtkDataSetMapper> imageMapper;\n  vtkNew<vtkActor> imageActor;\n  imageActor->SetMapper(imageMapper);\n  renderer->AddViewProp(imageActor);\n  imageMapper->SetInputConnection(clipper->GetOutputPort());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  interactor->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkRectilinearGrid> makeImage(int n)\n{\n  constexpr double cubeSize =\n      20.0; // physical linear dimension of entire system.\n\n  // This is a simplification of a program that uses actual image data\n  // as a source for the rectilinear grid.  In order to recreate the\n  // same vtk calls, create a dummy image here.\n  vtkNew<vtkImageData> image0;\n  image0->SetDimensions(n, n, n);\n  image0->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n  image0->SetSpacing(cubeSize / n, cubeSize / n, cubeSize / n);\n  int checkerSize = n / 8;\n  for (int z = 0; z < n; z++)\n  {\n    for (int y = 0; y < n; y++)\n    {\n      for (int x = 0; x < n; x++)\n      {\n        unsigned char* ptr = (unsigned char*)image0->GetScalarPointer(x, y, z);\n        *ptr = (x / checkerSize + y / checkerSize + z / checkerSize) %\n            2; // checkerboard\n      }\n    }\n  }\n\n  // Color for the checkerboard image\n  // double r = 0.7;\n  // double g = 0.7;\n  // double b = 0.7;\n  // double a = 1.0;\n  // double dim = 0.5; // amount to dim the dark squares by\n\n  vtkNew<vtkNamedColors> colors;\n  // colors->GetColor(\"LightCoral\", r, g, b, a);\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(2);\n  lut->SetTableRange(0, 1);\n  // lut->SetTableValue(0, r, g, b, a);\n  // lut->SetTableValue(1, dim * r, dim * g, dim * b, a);\n  // Or we can have fun ...\n  lut->SetTableValue(0, colors->GetColor4d(\"Thistle\").GetData());\n  lut->SetTableValue(1, colors->GetColor4d(\"DarkSlateBlue\").GetData());\n\n  vtkNew<vtkImageMapToColors> map;\n  map->SetLookupTable(lut);\n  map->SetOutputFormatToRGBA();\n  map->SetInputData(image0);\n  map->GetExecutive()->Update();\n  vtkImageData* image = map->GetOutput();\n\n  // Convert the image to a rectilinear grid.  Each point in the image\n  // becomes a cubic cell in the grid.\n\n  vtkNew<vtkRectilinearGrid> rectgrid;\n\n  int extent[6];\n  image->GetExtent(extent);\n  extent[1] += 1;\n  extent[3] += 1;\n  extent[5] += 1;\n  rectgrid->SetExtent(extent);\n\n  vtkNew<vtkDoubleArray> xcoords;\n  vtkNew<vtkDoubleArray> ycoords;\n  vtkNew<vtkDoubleArray> zcoords;\n  xcoords->SetNumberOfValues(n + 1);\n  ycoords->SetNumberOfValues(n + 1);\n  zcoords->SetNumberOfValues(n + 1);\n  double spacing[3];\n  image->GetSpacing(spacing);\n  for (vtkIdType i = 0; i <= n; i++)\n  {\n    xcoords->InsertValue(i, i * spacing[0]);\n    ycoords->InsertValue(i, i * spacing[1]);\n    zcoords->InsertValue(i, i * spacing[2]);\n  }\n  rectgrid->SetXCoordinates(xcoords);\n  rectgrid->SetYCoordinates(ycoords);\n  rectgrid->SetZCoordinates(zcoords);\n\n  vtkPointData* pointData = image->GetPointData();\n  vtkCellData* cellData = rectgrid->GetCellData();\n  cellData->ShallowCopy(pointData);\n  return rectgrid;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TableBasedClipDataSetWithPolyData2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonExecutionModel\n  FiltersGeneral\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TableBasedClipDataSetWithPolyData2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TableBasedClipDataSetWithPolyData2 MACOSX_BUNDLE TableBasedClipDataSetWithPolyData2.cxx )\n  target_link_libraries(TableBasedClipDataSetWithPolyData2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TableBasedClipDataSetWithPolyData2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/TableBasedClipDataSetWithPolyData2/#download-and-build-tablebasedclipdatasetwithpolydata2","title":"Download and Build TableBasedClipDataSetWithPolyData2","text":"

        Click here to download TableBasedClipDataSetWithPolyData2 and its CMakeLists.txt file. Once the tarball TableBasedClipDataSetWithPolyData2.tar has been downloaded and extracted,

        cd TableBasedClipDataSetWithPolyData2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TableBasedClipDataSetWithPolyData2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/Triangulate/","title":"Triangulate","text":"

        vtk-examples/Cxx/Meshes/Triangulate

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/Triangulate/#code","title":"Code","text":"

        Triangulate.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRegularPolygonSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangleFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRegularPolygonSource> polygonSource;\n  polygonSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(polygonSource->GetOutputPort());\n  triangleFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(polygonSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetRepresentationToWireframe();\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkPolyDataMapper> triangleMapper;\n  triangleMapper->SetInputConnection(triangleFilter->GetOutputPort());\n  vtkNew<vtkActor> triangleActor;\n  triangleActor->SetMapper(triangleMapper);\n  triangleActor->GetProperty()->SetRepresentationToWireframe();\n  triangleActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"Triangulate\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"SaddleBrown\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(triangleActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/Triangulate/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Triangulate)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Triangulate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Triangulate MACOSX_BUNDLE Triangulate.cxx )\n  target_link_libraries(Triangulate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Triangulate\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/Triangulate/#download-and-build-triangulate","title":"Download and Build Triangulate","text":"

        Click here to download Triangulate and its CMakeLists.txt file. Once the tarball Triangulate.tar has been downloaded and extracted,

        cd Triangulate/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Triangulate\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Meshes/WindowedSincPolyDataFilter/","title":"WindowedSincPolyDataFilter","text":"

        vtk-examples/Cxx/Meshes/WindowedSincPolyDataFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Meshes/WindowedSincPolyDataFilter/#description","title":"Description","text":"

        This example demonstrates how to smooth a mesh.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Meshes/WindowedSincPolyDataFilter/#code","title":"Code","text":"

        WindowedSincPolyDataFilter.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkWindowedSincPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkWindowedSincPolyDataFilter> smoother;\n  smoother->SetInputConnection(sphereSource->GetOutputPort());\n  smoother->SetNumberOfIterations(15);\n  smoother->BoundarySmoothingOff();\n  smoother->FeatureEdgeSmoothingOff();\n  smoother->SetFeatureAngle(120.0);\n  smoother->SetPassBand(.001);\n  smoother->NonManifoldSmoothingOn();\n  smoother->NormalizeCoordinatesOn();\n  smoother->Update();\n\n  vtkNew<vtkPolyDataMapper> smoothedMapper;\n  smoothedMapper->SetInputConnection(smoother->GetOutputPort());\n  vtkNew<vtkActor> smoothedActor;\n  smoothedActor->SetMapper(smoothedMapper);\n  smoothedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightCoral\").GetData());\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightCoral\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"WindowedSincPolyDataFilter\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  // Add the sphere to the left and the smoothed sphere to the right.\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(smoothedActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Meshes/WindowedSincPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WindowedSincPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WindowedSincPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WindowedSincPolyDataFilter MACOSX_BUNDLE WindowedSincPolyDataFilter.cxx )\n  target_link_libraries(WindowedSincPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WindowedSincPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Meshes/WindowedSincPolyDataFilter/#download-and-build-windowedsincpolydatafilter","title":"Download and Build WindowedSincPolyDataFilter","text":"

        Click here to download WindowedSincPolyDataFilter and its CMakeLists.txt file. Once the tarball WindowedSincPolyDataFilter.tar has been downloaded and extracted,

        cd WindowedSincPolyDataFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WindowedSincPolyDataFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/Bottle/","title":"Bottle","text":"

        vtk-examples/Cxx/Modelling/Bottle

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/Bottle/#code","title":"Code","text":"

        Bottle.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRotationalExtrusionFilter.h>\n#include <vtkStripper.h>\n#include <vtkTubeFilter.h>\n\nint main(int, char*[])\n{\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // create bottle profile\n  //\n  vtkNew<vtkPoints> points;\n  points->InsertPoint(0, 0.01, 0.0, 0.0);\n  points->InsertPoint(1, 1.5, 0.0, 0.0);\n  points->InsertPoint(2, 1.5, 0.0, 3.5);\n  points->InsertPoint(3, 1.25, 0.0, 3.75);\n  points->InsertPoint(4, 0.75, 0.0, 4.00);\n  points->InsertPoint(5, 0.6, 0.0, 4.35);\n  points->InsertPoint(6, 0.7, 0.0, 4.65);\n  points->InsertPoint(7, 1.0, 0.0, 4.75);\n  points->InsertPoint(8, 1.0, 0.0, 5.0);\n  points->InsertPoint(9, 0.2, 0.0, 5.0);\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(10); // number of points\n  lines->InsertCellPoint(0);\n  lines->InsertCellPoint(1);\n  lines->InsertCellPoint(2);\n  lines->InsertCellPoint(3);\n  lines->InsertCellPoint(4);\n  lines->InsertCellPoint(5);\n  lines->InsertCellPoint(6);\n  lines->InsertCellPoint(7);\n  lines->InsertCellPoint(8);\n  lines->InsertCellPoint(9);\n\n  vtkNew<vtkPolyData> profile;\n  profile->SetPoints(points);\n  profile->SetLines(lines);\n\n  // extrude profile to make bottle\n  //\n  vtkNew<vtkRotationalExtrusionFilter> extrude;\n  extrude->SetInputData(profile);\n  extrude->SetResolution(60);\n\n  vtkNew<vtkPolyDataMapper> map;\n  map->SetInputConnection(extrude->GetOutputPort());\n\n  vtkNew<vtkActor> bottle;\n  bottle->SetMapper(map);\n  bottle->GetProperty()->SetColor(colors->GetColor3d(\"Mint\").GetData());\n\n  // display the profile\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputData(profile);\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(stripper->GetOutputPort());\n  tubes->SetNumberOfSides(11);\n  tubes->SetRadius(0.05);\n\n  vtkNew<vtkPolyDataMapper> profileMapper;\n  profileMapper->SetInputConnection(tubes->GetOutputPort());\n\n  vtkNew<vtkActor> profileActor;\n  profileActor->SetMapper(profileMapper);\n  profileActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer->AddActor(bottle);\n  renderer->AddActor(profileActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"Bottle\");\n  renWin->Render();\n\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  // render the image\n  //\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Modelling/Bottle/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Bottle)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Bottle: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Bottle MACOSX_BUNDLE Bottle.cxx )\n  target_link_libraries(Bottle PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Bottle\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/Bottle/#download-and-build-bottle","title":"Download and Build Bottle","text":"

        Click here to download Bottle and its CMakeLists.txt file. Once the tarball Bottle.tar has been downloaded and extracted,

        cd Bottle/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Bottle\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/CappedSphere/","title":"CappedSphere","text":"

        vtk-examples/Cxx/Modelling/CappedSphere

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Modelling/CappedSphere/#description","title":"Description","text":"

        Demonstrates how to create a capped sphere.

        Firstly a line is created in the x-z plane corresponding to an arc from +z to -z in the +x direction in the x-z plane, the length of the arc is specified in degrees.

        Then the line is extended by dropping a perpendicular to the x-axis.

        The points generated are then converted to a line and passed through to the vtkRotationalExtrusionFilter to generate the resultant 3D surface.

        The parameters are:

        • angle - the arc length in degrees default 90\u00b0 (a hemisphere)
        • step -the step size of the arc in degrees, default 1\u00b0
        • radius - the radius of the arc default 1

        Options are provided to:

        • Uncap the sphere (-u, --uncapped)
        • Display the line that was rotationally extruded (-s, --show_line)

        Note

        The coordinate system for specifying the arc is left-handed with 0\u00b0 aligned with the positive z-axis, 90\u00b0 aligned with the positive x-axis.

        Note

        You can substitute different parametric equations for x and z in the line generating function to get other shapes.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/CappedSphere/#code","title":"Code","text":"

        CappedSphere.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRotationalExtrusionFilter.h>\n\n#include <array>\n#include <cmath>\n#include <iomanip>\n#include <iostream>\n#include <regex>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n/**\n * Get the points for a line.\n *\n * @param angle: Length of the arc in degrees.\n * @param step: Step size in degrees.\n * @param radius: Radius of the arc.\n * @param uncapped: True if uncapped.\n * @param start: Starting angle.\n * @return: A vector of points.\n */\nstd::vector<std::array<double, 3>>\nGetLine(double const& angle, double const& step, double const& radius,\n        bool const& noCap, double const& start);\n\n/**\n * Show the command line parameters.\n *\n * @param fn: The program name.\n */\nstd::string ShowUsage(std::string fn);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Our degree/radian conversions\n  constexpr auto pi = 3.141592653589793238462643383279502884L; /* pi */\n  auto d_r = [pi](long double d) { return pi * d / 180.0; };\n  // auto r_d = [pi](long double r) { return 180 * r / pi; };\n  auto isNumber = [](std::string const& token) {\n    return std::regex_match(\n        token, std::regex((\"((\\\\+|-)?[[:digit:]]+)(\\\\.(([[:digit:]]+)?))?\")));\n  };\n\n  auto angle = 90.0;\n  auto step = 1.0;\n  auto radius = 1.0;\n  auto uncapped = false;\n  auto showLine = false;\n\n  // The command line arguments\n  std::vector<std::string> cmdVec;\n  for (auto i = 1; i < argc; ++i)\n  {\n    cmdVec.push_back(argv[i]);\n  }\n  if (!cmdVec.empty())\n  {\n    // Look for parameters\n    auto posCnt = 0;\n    for (auto const& token : cmdVec)\n    {\n      if (token == \"-h\" || token == \"--help\")\n      {\n        std::cout << ShowUsage(argv[0]) << std::endl;\n        return EXIT_SUCCESS;\n      }\n      if (token == \"-u\" || token == \"--uncapped\")\n      {\n        uncapped = true;\n      }\n      if (token == \"-s\" || token == \"--show_line\")\n      {\n        showLine = true;\n      }\n      if (isNumber(token) && posCnt < 3)\n      {\n        switch (posCnt)\n        {\n        case 0:\n          angle = std::stod(token);\n          break;\n        case 1:\n          step = std::stod(token);\n          break;\n        case 2:\n          radius = std::stod(token);\n          break;\n        default:\n          break;\n        }\n        posCnt++;\n      }\n    }\n  }\n  angle = d_r(std::abs(angle));\n  step = d_r(std::abs(step));\n  radius = std::abs(radius);\n  // With default settings set this to 45 and you get a bowl with a flat bottom.\n  auto start = d_r(90);\n\n  auto pts = GetLine(angle, step, radius, uncapped, start);\n\n  // Setup points and lines\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> lines;\n  for (auto pt : pts)\n  {\n    unsigned long pt_id = points->InsertNextPoint(pt.data());\n    if (pt_id < pts.size() - 1)\n    {\n      vtkNew<vtkLine> line;\n      line->GetPointIds()->SetId(0, pt_id);\n      line->GetPointIds()->SetId(1, pt_id + 1);\n      lines->InsertNextCell(line);\n    }\n  }\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetLines(lines);\n\n  // Extrude the profile to make the capped sphere\n  vtkNew<vtkRotationalExtrusionFilter> extrude;\n  extrude->SetInputData(polydata);\n  extrude->SetResolution(60);\n\n  //  Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  // To see the line\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetLineWidth(4);\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  // To see the surface\n  vtkNew<vtkPolyDataMapper> surfaceMapper;\n  surfaceMapper->SetInputConnection(extrude->GetOutputPort());\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetColor(colors->GetColor3d(\"Khaki\").GetData());\n\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren->AddActor(surfaceActor);\n  if (showLine)\n  {\n    ren->AddActor(lineActor);\n  }\n  ren->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  ren->ResetCamera();\n  ren->GetActiveCamera()->Azimuth(0);\n  ren->GetActiveCamera()->Elevation(60);\n  ren->ResetCameraClippingRange();\n\n  renWin->SetSize(600, 600);\n  renWin->Render();\n  renWin->SetWindowName(\"CappedSphere\");\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::vector<std::array<double, 3>>\nGetLine(double const& angle, double const& step, double const& radius,\n        bool const& uncapped, double const& start)\n{\n  auto constexpr precision = 1.0e-06;\n  std::vector<std::array<double, 3>> pts;\n  // Do the curved line\n  auto theta = 0.0;\n  while (theta <= angle)\n  {\n    std::array<double, 3> p{{0.0, 0.0, 0.0}};\n    p[0] = radius * std::cos(start - theta);\n    p[2] = radius * std::sin(theta - start);\n    if (p[0] < 0)\n    {\n      p[0] = 0;\n      pts.push_back(p);\n      break;\n    }\n    if (std::abs(p[0]) < precision)\n    {\n      p[0] = 0;\n    }\n    if (std::abs(p[2]) < precision)\n    {\n      p[2] = 0;\n    }\n    pts.push_back(p);\n    theta += step;\n  }\n  if (!uncapped)\n  {\n    // Drop a perpendicular from the last point to the x-axis\n    if (pts.size() > 1)\n    {\n      std::array<double, 3> lastPoint = pts.back();\n      if (lastPoint[0] > 0)\n      {\n        auto numPts = 10;\n        auto interval = double(numPts) / radius;\n        auto i = 1;\n        while (i < numPts)\n        {\n          std::array<double, 3> p{{0.0, 0.0, lastPoint[2]}};\n          p[0] = lastPoint[0] - i / interval;\n          if (p[0] < 0)\n          {\n            p[0] = 0;\n            pts.push_back(p);\n            break;\n          }\n          if (std::abs(p[0]) < precision)\n          {\n            p[0] = 0;\n          }\n          if (std::abs(p[2]) < precision)\n          {\n            p[2] = 0;\n          }\n          pts.push_back(p);\n          ++i;\n        }\n      }\n      lastPoint = pts.back();\n      if (lastPoint[0] > precision)\n      {\n        std::array<double, 3> p{{0.0, 0.0, lastPoint[2]}};\n        pts.push_back(p);\n      }\n    }\n  }\n  return pts;\n}\n\nstd::string ShowUsage(std::string fn)\n{\n  // Remove the folder (if present) then emove the extension in this order\n  // since the folder name may contain perionds.\n  auto last_slash_idx = fn.find_last_of(\"\\\\/\");\n  if (std::string::npos != last_slash_idx)\n  {\n    fn.erase(0, last_slash_idx + 1);\n  }\n  // auto period_idx = fn.rfind('.');\n  // if (std::string::npos != period_idx)\n  //{\n  //  fn.erase(period_idx);\n  //}\n  std::ostringstream os;\n  os << \"\\nusage: \" << fn << \" [-h] [-u] [-s] [angle] [step] [radius]\\n\";\n  os << \"\\n\";\n  os << \"Display a capped sphere.\\n\";\n  os << \"\\n\";\n  os << \"positional arguments:\\n\";\n  os << \"  angle            The length of the arc in degrees from +z to -z in \"\n        \"the +x\\n\";\n  os << \"                   direction in the x-z plane.\\n\";\n  os << \"  step             Step size in degrees.\\n\";\n  os << \"  radius           Radius of the arc.\\n\";\n  os << \"\\n\";\n  os << \"optional arguments:\\n\";\n  os << \"  -h, --help       show this help message and exit\\n\";\n  os << \"  -u, --uncapped   Uncap the sphere.\\n\";\n  os << \"  -s, --show_line  Show the line that is rotationally extruded to \"\n        \"make the\\n\";\n  os << \"                   surface.\";\n  os << std::endl;\n  return os.str();\n}\n\n} // namespace\n
        "},{"location":"Cxx/Modelling/CappedSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CappedSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CappedSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CappedSphere MACOSX_BUNDLE CappedSphere.cxx )\n  target_link_libraries(CappedSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CappedSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/CappedSphere/#download-and-build-cappedsphere","title":"Download and Build CappedSphere","text":"

        Click here to download CappedSphere and its CMakeLists.txt file. Once the tarball CappedSphere.tar has been downloaded and extracted,

        cd CappedSphere/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CappedSphere\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/ContourTriangulator/","title":"ContourTriangulator","text":"

        vtk-examples/Cxx/Modelling/ContourTriangulator

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/ContourTriangulator/#code","title":"Code","text":"

        ContourTriangulator.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourTriangulator.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMarchingSquares.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  std::string inputFileName;\n  if (argc > 1)\n  {\n    inputFileName = argv[1];\n  }\n  else\n  {\n    cout << \"Usage: \" << argv[0]\n         << \" png_file [iso value] e.g. fullhead15.png 500\" << endl;\n    return EXIT_FAILURE;\n  }\n  int isoValue = 500;\n  if (argc > 2)\n  {\n    isoValue = atoi(argv[2]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPNGReader> reader;\n  if (!reader->CanReadFile(inputFileName.c_str()))\n  {\n    std::cerr << \"Error: Could not read \" << inputFileName << \".\\n\";\n    return EXIT_FAILURE;\n  }\n  reader->SetFileName(inputFileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkMarchingSquares> iso;\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->SetValue(0, isoValue);\n\n  vtkNew<vtkDataSetMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MediumOrchid\").GetData());\n\n  vtkNew<vtkContourTriangulator> poly;\n  poly->SetInputConnection(iso->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> polyMapper;\n  polyMapper->SetInputConnection(poly->GetOutputPort());\n  polyMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> polyActor;\n  polyActor->SetMapper(polyMapper);\n  polyActor->GetProperty()->SetColor(colors->GetColor3d(\"Gray\").GetData());\n\n  // Standard rendering classes\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetMultiSamples(0);\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"ContourTriangulator\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(polyActor);\n  renderer->AddActor(isoActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renWin->SetSize(300, 300);\n\n  vtkCamera* camera = renderer->GetActiveCamera();\n  renderer->ResetCamera();\n  camera->Azimuth(180);\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Modelling/ContourTriangulator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ContourTriangulator)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ContourTriangulator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ContourTriangulator MACOSX_BUNDLE ContourTriangulator.cxx )\n  target_link_libraries(ContourTriangulator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ContourTriangulator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/ContourTriangulator/#download-and-build-contourtriangulator","title":"Download and Build ContourTriangulator","text":"

        Click here to download ContourTriangulator and its CMakeLists.txt file. Once the tarball ContourTriangulator.tar has been downloaded and extracted,

        cd ContourTriangulator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ContourTriangulator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/Delaunay3D/","title":"Delaunay3D","text":"

        vtk-examples/Cxx/Modelling/Delaunay3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Modelling/Delaunay3D/#description","title":"Description","text":"

        This example creates a tetrahedral mesh from unorganized points. The example uses the vtkDelaunay3D filter. The resulting mesh will be a solid convex hull of the original points. The example takes the points from a XML PolyData file (.vtp) produces the 3D Delaunay tetrahedralization (both with alpha = 0 and a non-zero alpha), and displays the result on the screen.

        For alpha != 0 (right window), the tetra are yellow, the lines are blue and the triangles are red.

        The example requires a .vtp file and an optional alpha.

        Seealso

        See Delaunay3DDemo to interactively adjust Alpha.

        Note

        This original source code for this example is here.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/Delaunay3D/#code","title":"Code","text":"

        Delaunay3D.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkCleanPolyData.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDelaunay3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <sstream>\n\nint main(int argc, char* argv[])\n{\n  float alpha = 0.5;\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtp [alpha] e.g. Bunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  if (argc > 2)\n  {\n    alpha = atof(argv[2]);\n  }\n  // Read the file.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkNamedColors> color;\n\n  vtkNew<vtkDataSetMapper> originalMapper;\n  originalMapper->SetInputConnection(reader->GetOutputPort());\n  originalMapper->ScalarVisibilityOff();\n  originalMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(color->GetColor3d(\"tomato\").GetData());\n  originalActor->GetProperty()->SetInterpolationToFlat();\n\n  // Clean the polydata. This will remove duplicate points that may be\n  // present in the input data.\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(reader->GetOutputPort());\n\n  // Generate a tetrahedral mesh from the input points. By\n  // default, the generated volume is the convex hull of the points.\n  vtkNew<vtkDelaunay3D> delaunay3D;\n  delaunay3D->SetInputConnection(cleaner->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> delaunayMapper;\n  delaunayMapper->SetInputConnection(delaunay3D->GetOutputPort());\n  delaunayMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> delaunayActor;\n  delaunayActor->SetMapper(delaunayMapper);\n  delaunayActor->GetProperty()->SetColor(color->GetColor3d(\"banana\").GetData());\n  delaunayActor->GetProperty()->SetInterpolationToFlat();\n\n  // Generate a mesh from the input points. If Alpha is non-zero, then\n  // tetrahedra, triangles, edges and vertices that lie within the\n  // alpha radius are output.\n  vtkNew<vtkDelaunay3D> delaunay3DAlpha;\n  delaunay3DAlpha->SetInputConnection(cleaner->GetOutputPort());\n  delaunay3DAlpha->SetAlpha(alpha);\n  delaunay3DAlpha->Update();\n  std::cout << \"Alpha: \" << alpha << std::endl;\n\n  vtkNew<vtkUnsignedCharArray> cellData;\n  cellData->SetNumberOfComponents(3);\n\n  int numTetras = 0;\n  int numLines = 0;\n  int numTris = 0;\n  int numVerts = 0;\n\n  auto it = delaunay3DAlpha->GetOutput()->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    if (it->GetCellType() == VTK_TETRA)\n    {\n      numTetras++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Banana\").GetData());\n    }\n    else if (it->GetCellType() == VTK_LINE)\n    {\n      numLines++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Peacock\").GetData());\n    }\n    else if (it->GetCellType() == VTK_TRIANGLE)\n    {\n      numTris++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Tomato\").GetData());\n    }\n    else if (it->GetCellType() == VTK_VERTEX)\n    {\n      numVerts++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Lime\").GetData());\n    }\n  }\n  it->Delete();\n\n  std::stringstream ss;\n  ss << \"numTetras: \" << numTetras << std::endl;\n  ss << \"numLines: \" << numLines << std::endl;\n  ss << \"numTris: \" << numTris << std::endl;\n  ss << \"numVerts: \" << numVerts;\n\n  // Set the cell color depending on cell type.\n  delaunay3DAlpha->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  vtkNew<vtkDataSetMapper> delaunayAlphaMapper;\n  delaunayAlphaMapper->SetInputConnection(delaunay3DAlpha->GetOutputPort());\n  delaunayAlphaMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> delaunayAlphaActor;\n  delaunayAlphaActor->SetMapper(delaunayAlphaMapper);\n  delaunayAlphaActor->GetProperty()->SetPointSize(5.0);\n  delaunayAlphaActor->GetProperty()->SetInterpolationToFlat();\n\n  // Visualize\n\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetColor(color->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkTextMapper> textMapper;\n  textMapper->SetInput(ss.str().c_str());\n  textMapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetPosition(10, 10);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Shared camera\n  vtkNew<vtkCamera> sharedCamera;\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetActiveCamera(sharedCamera);\n\n  vtkNew<vtkRenderer> delaunayRenderer;\n  delaunayRenderer->SetActiveCamera(sharedCamera);\n\n  vtkNew<vtkRenderer> delaunayAlphaRenderer;\n  delaunayAlphaRenderer->SetActiveCamera(sharedCamera);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->SetWindowName(\"Delaunay3D\");\n\n  renderWindow->AddRenderer(originalRenderer);\n  originalRenderer->SetViewport(leftViewport);\n  renderWindow->AddRenderer(delaunayRenderer);\n  delaunayRenderer->SetViewport(centerViewport);\n  renderWindow->AddRenderer(delaunayAlphaRenderer);\n  delaunayAlphaRenderer->SetViewport(rightViewport);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  originalRenderer->AddActor(originalActor);\n  delaunayRenderer->AddActor(delaunayActor);\n  delaunayAlphaRenderer->AddActor(delaunayAlphaActor);\n  delaunayAlphaRenderer->AddViewProp(textActor);\n\n  originalRenderer->SetBackground(color->GetColor3d(\"Slate_Grey\").GetData());\n  delaunayRenderer->SetBackground(color->GetColor3d(\"Light_Grey\").GetData());\n  delaunayAlphaRenderer->SetBackground(color->GetColor3d(\"Grey\").GetData());\n\n  originalRenderer->ResetCamera();\n  renderWindow->Render();\n\n  // Render and interact.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Modelling/Delaunay3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Delaunay3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Delaunay3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Delaunay3D MACOSX_BUNDLE Delaunay3D.cxx )\n  target_link_libraries(Delaunay3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Delaunay3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/Delaunay3D/#download-and-build-delaunay3d","title":"Download and Build Delaunay3D","text":"

        Click here to download Delaunay3D and its CMakeLists.txt file. Once the tarball Delaunay3D.tar has been downloaded and extracted,

        cd Delaunay3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Delaunay3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/Delaunay3DDemo/","title":"Delaunay3DDemo","text":"

        vtk-examples/Cxx/Modelling/Delaunay3DDemo

        "},{"location":"Cxx/Modelling/Delaunay3DDemo/#description","title":"Description","text":"

        This example creates a tetrahedral mesh from unorganized points. The example uses the vtkDelaunay3D filter. The resulting mesh will be a solid convex hull of the original points. The example takes the points from a XML PolyData file (.vtp) produces the 3D Delaunay tetrahedralization (both with alpha = 0 and a non-zero alpha), and displays the result on the screen.

        For alpha != 0 (right window), the tetra are yellow, the lines are blue and the triangles are red.

        Alpha can be changed interactively to see its affect on the resulting surface.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/Delaunay3DDemo/#code","title":"Code","text":"

        Delaunay3DDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkCleanPolyData.h>\n#include <vtkCommand.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDelaunay3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <sstream>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n\nvoid MakeWidget(vtkSliderWidget*, vtkDelaunay3D*, vtkTextMapper*, vtkRenderer*,\n                vtkRenderWindowInteractor*);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtp [alpha] e.g. Bunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> color;\n\n  vtkNew<vtkDataSetMapper> originalMapper;\n  originalMapper->SetInputData(polyData);\n  originalMapper->ScalarVisibilityOff();\n  originalMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(color->GetColor3d(\"tomato\").GetData());\n  originalActor->GetProperty()->SetInterpolationToFlat();\n\n  // Clean the polydata. This will remove duplicate points that may be\n  // present in the input data.\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputData(polyData);\n\n  // Generate a tetrahedral mesh from the input points. By\n  // default, the generated volume is the convex hull of the points.\n  vtkNew<vtkDelaunay3D> delaunay3D;\n  delaunay3D->SetInputConnection(cleaner->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> delaunayMapper;\n  delaunayMapper->SetInputConnection(delaunay3D->GetOutputPort());\n  delaunayMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> delaunayActor;\n  delaunayActor->SetMapper(delaunayMapper);\n  delaunayActor->GetProperty()->SetColor(color->GetColor3d(\"banana\").GetData());\n  delaunayActor->GetProperty()->SetInterpolationToFlat();\n\n  // Generate a mesh from the input points. If Alpha is non-zero, then\n  // tetrahedra, triangles, edges and vertices that lie within the\n  // alpha radius are output.\n  vtkNew<vtkDelaunay3D> delaunay3DAlpha;\n  delaunay3DAlpha->SetInputConnection(cleaner->GetOutputPort());\n  delaunay3DAlpha->SetAlpha(0.0105);\n  delaunay3DAlpha->Update();\n\n  vtkNew<vtkUnsignedCharArray> cellData;\n  cellData->SetNumberOfComponents(3);\n\n  int numTetras = 0;\n  int numLines = 0;\n  int numTris = 0;\n  int numVerts = 0;\n\n  auto it = delaunay3DAlpha->GetOutput()->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    if (it->GetCellType() == VTK_TETRA)\n    {\n      numTetras++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Banana\").GetData());\n    }\n    else if (it->GetCellType() == VTK_LINE)\n    {\n      numLines++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Peacock\").GetData());\n    }\n    else if (it->GetCellType() == VTK_TRIANGLE)\n    {\n      numTris++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Tomato\").GetData());\n    }\n    else if (it->GetCellType() == VTK_VERTEX)\n    {\n      numVerts++;\n      cellData->InsertNextTypedTuple(color->GetColor3ub(\"Lime\").GetData());\n    }\n  }\n  it->Delete();\n\n  std::stringstream ss;\n  ss << \"numTetras: \" << numTetras << std::endl;\n  ss << \"numLines: \" << numLines << std::endl;\n  ss << \"numTris: \" << numTris << std::endl;\n  ss << \"numVerts: \" << numVerts;\n\n  // Set the cell color depending on cell type.\n  delaunay3DAlpha->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  vtkNew<vtkDataSetMapper> delaunayAlphaMapper;\n  delaunayAlphaMapper->SetInputConnection(delaunay3DAlpha->GetOutputPort());\n  delaunayAlphaMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> delaunayAlphaActor;\n  delaunayAlphaActor->SetMapper(delaunayAlphaMapper);\n  delaunayAlphaActor->GetProperty()->SetPointSize(5.0);\n  delaunayAlphaActor->GetProperty()->SetInterpolationToFlat();\n\n  // Visualize\n\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(16);\n  textProperty->SetColor(color->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkTextMapper> textMapper;\n  textMapper->SetInput(ss.str().c_str());\n  textMapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> textActor;\n  textActor->SetMapper(textMapper);\n  textActor->SetPosition(10, 10);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Shared camera\n  vtkNew<vtkCamera> sharedCamera;\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetActiveCamera(sharedCamera);\n  originalRenderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderer> delaunayRenderer;\n  delaunayRenderer->SetActiveCamera(sharedCamera);\n  delaunayRenderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderer> delaunayAlphaRenderer;\n  delaunayAlphaRenderer->SetActiveCamera(sharedCamera);\n  delaunayAlphaRenderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->SetWindowName(\"Delaunay3DDemo\");\n\n  renderWindow->AddRenderer(originalRenderer);\n  originalRenderer->SetViewport(leftViewport);\n\n  renderWindow->AddRenderer(delaunayRenderer);\n  delaunayRenderer->SetViewport(centerViewport);\n\n  renderWindow->AddRenderer(delaunayAlphaRenderer);\n  delaunayAlphaRenderer->SetViewport(rightViewport);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkSliderWidget> widget;\n  MakeWidget(widget, delaunay3DAlpha, textMapper, delaunayAlphaRenderer,\n             renderWindowInteractor);\n\n  originalRenderer->AddActor(originalActor);\n  delaunayRenderer->AddActor(delaunayActor);\n  delaunayAlphaRenderer->AddActor(delaunayAlphaActor);\n  delaunayAlphaRenderer->AddViewProp(textActor);\n\n  originalRenderer->SetBackground(color->GetColor3d(\"Slate_Grey\").GetData());\n  delaunayRenderer->SetBackground(color->GetColor3d(\"Light_Grey\").GetData());\n  delaunayAlphaRenderer->SetBackground(color->GetColor3d(\"Grey\").GetData());\n\n  originalRenderer->ResetCamera();\n  renderWindow->Render();\n\n  // Render and interact.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackAlpha : public vtkCommand\n{\npublic:\n  static SliderCallbackAlpha* New()\n  {\n    return new SliderCallbackAlpha;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->Delaunay3D->SetAlpha(value);\n    this->Delaunay3D->Update();\n\n    vtkNew<vtkUnsignedCharArray> cellData;\n    cellData->SetNumberOfComponents(3);\n\n    // Set the cell color depending on cell type.\n    vtkNew<vtkNamedColors> color;\n    int numTetras = 0;\n    int numLines = 0;\n    int numTris = 0;\n    int numVerts = 0;\n\n    auto it = this->Delaunay3D->GetOutput()->NewCellIterator();\n    for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n    {\n      if (it->GetCellType() == VTK_TETRA)\n      {\n        numTetras++;\n        cellData->InsertNextTypedTuple(color->GetColor3ub(\"Banana\").GetData());\n      }\n      else if (it->GetCellType() == VTK_LINE)\n      {\n        numLines++;\n        cellData->InsertNextTypedTuple(color->GetColor3ub(\"Peacock\").GetData());\n      }\n      else if (it->GetCellType() == VTK_TRIANGLE)\n      {\n        numTris++;\n        cellData->InsertNextTypedTuple(color->GetColor3ub(\"Tomato\").GetData());\n      }\n      else if (it->GetCellType() == VTK_VERTEX)\n      {\n        numVerts++;\n        cellData->InsertNextTypedTuple(color->GetColor3ub(\"Lime\").GetData());\n      }\n    }\n    it->Delete();\n\n    this->Delaunay3D->GetOutput()->GetCellData()->SetScalars(cellData);\n    std::stringstream ss;\n    ss << \"numTetras: \" << numTetras << std::endl;\n    ss << \"numLines: \" << numLines << std::endl;\n    ss << \"numTris: \" << numTris << std::endl;\n    ss << \"numVerts: \" << numVerts;\n    this->TextMapper->SetInput(ss.str().c_str());\n  }\n  SliderCallbackAlpha() : Delaunay3D(0), TextMapper(0)\n  {\n  }\n  vtkDelaunay3D* Delaunay3D;\n  vtkTextMapper* TextMapper;\n};\n\nvoid MakeWidget(vtkSliderWidget* widget, vtkDelaunay3D* delaunay3D,\n                vtkTextMapper* textMapper, vtkRenderer* renderer,\n                vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(.02);\n  double sliderLength(.04);\n  double titleHeight(.04);\n  double labelHeight(.04);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepAlpha;\n\n  sliderRepAlpha->SetRenderer(renderer);\n\n  sliderRepAlpha->SetMinimumValue(0.0001);\n  sliderRepAlpha->SetMaximumValue(1.0);\n  sliderRepAlpha->SetValue(delaunay3D->GetAlpha());\n  sliderRepAlpha->SetTitleText(\"Alpha\");\n  sliderRepAlpha->SetRenderer(renderer);\n  sliderRepAlpha->GetPoint1Coordinate()->SetValue(0.1, .1);\n  sliderRepAlpha->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n  sliderRepAlpha->GetPoint2Coordinate()->SetValue(.9, .1);\n  sliderRepAlpha->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepAlpha->SetTubeWidth(tubeWidth);\n  sliderRepAlpha->SetSliderLength(sliderLength);\n  sliderRepAlpha->SetTitleHeight(titleHeight);\n  sliderRepAlpha->SetLabelHeight(labelHeight);\n  sliderRepAlpha->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepAlpha->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepAlpha->BuildRepresentation();\n\n  widget->SetRepresentation(sliderRepAlpha);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(2);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackAlpha> callbackAlpha;\n  callbackAlpha->Delaunay3D = delaunay3D;\n  callbackAlpha->TextMapper = textMapper;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackAlpha);\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Modelling/Delaunay3DDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Delaunay3DDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Delaunay3DDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Delaunay3DDemo MACOSX_BUNDLE Delaunay3DDemo.cxx )\n  target_link_libraries(Delaunay3DDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Delaunay3DDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/Delaunay3DDemo/#download-and-build-delaunay3ddemo","title":"Download and Build Delaunay3DDemo","text":"

        Click here to download Delaunay3DDemo and its CMakeLists.txt file. Once the tarball Delaunay3DDemo.tar has been downloaded and extracted,

        cd Delaunay3DDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Delaunay3DDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/DelaunayMesh/","title":"DelaunayMesh","text":"

        vtk-examples/Cxx/Modelling/DelaunayMesh

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Modelling/DelaunayMesh/#description","title":"Description","text":"

        This is two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with spheres and tubes.

        Info

        See Figure 9-54 in Chapter 9 The VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/DelaunayMesh/#code","title":"Code","text":"

        DelaunayMesh.cxx

        /*\nThis code is based on the VTK file: Examples/Modelling/Tcl/DelMesh.py.\n\nThis example demonstrates how to use 2D Delaunay triangulation.\nWe create a fancy image of a 2D Delaunay triangulation. Points are\n randomly generated.\n*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDelaunay2D.h>\n#include <vtkExtractEdges.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTubeFilter.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Generate some \"random\" points.\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(1);\n  for (auto i = 0; i < 50; ++i)\n  {\n    double p1;\n    double p2;\n    p1 = randomSequence->GetValue();\n    randomSequence->Next();\n    p2 = randomSequence->GetValue();\n    randomSequence->Next();\n    points->InsertPoint(i, p1, p2, 0.0);\n  }\n  // Create a polydata with the points we just created.\n  vtkNew<vtkPolyData> profile;\n  profile->SetPoints(points);\n\n  // Perform a 2D Delaunay triangulation on them.\n  vtkNew<vtkDelaunay2D> delny;\n  delny->SetInputData(profile);\n  delny->SetTolerance(0.001);\n  vtkNew<vtkPolyDataMapper> mapMesh;\n  mapMesh->SetInputConnection(delny->GetOutputPort());\n  vtkNew<vtkActor> meshActor;\n  meshActor->SetMapper(mapMesh);\n  meshActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // We will now create a nice looking mesh by wrapping the edges in tubes,\n  // and putting fat spheres at the points.\n  vtkNew<vtkExtractEdges> extract;\n  extract->SetInputConnection(delny->GetOutputPort());\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(extract->GetOutputPort());\n  tubes->SetRadius(0.01);\n  tubes->SetNumberOfSides(6);\n  vtkNew<vtkPolyDataMapper> mapEdges;\n  mapEdges->SetInputConnection(tubes->GetOutputPort());\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(mapEdges);\n  edgeActor->GetProperty()->SetColor(colors->GetColor3d(\"peacock\").GetData());\n  edgeActor->GetProperty()->SetSpecularColor(1, 1, 1);\n  edgeActor->GetProperty()->SetSpecular(0.3);\n  edgeActor->GetProperty()->SetSpecularPower(20);\n  edgeActor->GetProperty()->SetAmbient(0.2);\n  edgeActor->GetProperty()->SetDiffuse(0.8);\n\n  vtkNew<vtkSphereSource> ball;\n  ball->SetRadius(0.025);\n  ball->SetThetaResolution(12);\n  ball->SetPhiResolution(12);\n  vtkNew<vtkGlyph3D> balls;\n  balls->SetInputConnection(delny->GetOutputPort());\n  balls->SetSourceConnection(ball->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> mapBalls;\n  mapBalls->SetInputConnection(balls->GetOutputPort());\n  vtkNew<vtkActor> ballActor;\n  ballActor->SetMapper(mapBalls);\n  ballActor->GetProperty()->SetColor(colors->GetColor3d(\"hot_pink\").GetData());\n  ballActor->GetProperty()->SetSpecularColor(1, 1, 1);\n  ballActor->GetProperty()->SetSpecular(0.3);\n  ballActor->GetProperty()->SetSpecularPower(20);\n  ballActor->GetProperty()->SetAmbient(0.2);\n  ballActor->GetProperty()->SetDiffuse(0.8);\n\n  // Create the rendering window, renderer, and interactive renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(ballActor);\n  ren->AddActor(edgeActor);\n  ren->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"DelaunayMesh\");\n\n  ren->ResetCamera();\n  ren->GetActiveCamera()->Zoom(1.3);\n\n  // Interact with the data.\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Modelling/DelaunayMesh/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DelaunayMesh)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DelaunayMesh: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DelaunayMesh MACOSX_BUNDLE DelaunayMesh.cxx )\n  target_link_libraries(DelaunayMesh PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DelaunayMesh\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/DelaunayMesh/#download-and-build-delaunaymesh","title":"Download and Build DelaunayMesh","text":"

        Click here to download DelaunayMesh and its CMakeLists.txt file. Once the tarball DelaunayMesh.tar has been downloaded and extracted,

        cd DelaunayMesh/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DelaunayMesh\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/DiscreteMarchingCubes/","title":"DiscreteMarchingCubes","text":"

        vtk-examples/Cxx/Modelling/DiscreteMarchingCubes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Modelling/DiscreteMarchingCubes/#description","title":"Description","text":"

        Creates surfaces from labeled data. Volume data does not always contain samples of continuous data. A volume may contain discrete integer values, often the result of segmentation. vtkDiscreteFlyingEdges3D or vtkDiscreteMarchingCubes create surfaces from these segmented volumes using a modified flying edges or marching cubes algorithm. The algorithm generates one or more models representing the boundaries between the specified label and the adjacent structures. One or more label values must be specified to generate the models. The boundary positions are always defined to be half-way between adjacent voxels.

        Seealso

        SmoothDiscreteMarchingCubes produces smooth models.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/DiscreteMarchingCubes/#code","title":"Code","text":"

        DiscreteMarchingCubes.cxx

        #include <vtkActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageThreshold.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphere.h>\n#include <vtkVersion.h>\n\n// vtkDiscreteFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n\n#endif\n#undef USE_FLYING_EDGES\n#ifdef USE_FLYING_EDGES\n#include <vtkDiscreteFlyingEdges3D.h>\n#else\n#include <vtkDiscreteMarchingCubes.h>\n#endif\n\nnamespace {\nvtkSmartPointer<vtkLookupTable> MakeColors(unsigned int n);\n\nvtkSmartPointer<vtkImageData> MakeBlob(int n, double radius);\n} // namespace\n\nint main(int /*argc*/, char* /* argv */[])\n{\n  int n = 20;\n  double radius = 8;\n\n  vtkSmartPointer<vtkImageData> blob = MakeBlob(n, radius);\n\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkDiscreteFlyingEdges3D> discrete;\n#else\n  vtkNew<vtkDiscreteMarchingCubes> discrete;\n#endif\n  discrete->SetInputData(blob);\n  discrete->GenerateValues(n, 1, n);\n\n  vtkSmartPointer<vtkLookupTable> lut = MakeColors(n);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(discrete->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, lut->GetNumberOfColors());\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"DiscreteMarchingCubes\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  ren1->AddActor(actor);\n\n  vtkNew<vtkNamedColors> colors;\n  ren1->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkImageData> MakeBlob(int n, double radius)\n{\n  vtkNew<vtkImageData> blobImage;\n\n  double maxR = 50 - 2.0 * radius;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(5071);\n  for (int i = 0; i < n; ++i)\n  {\n    vtkNew<vtkSphere> sphere;\n    sphere->SetRadius(radius);\n    auto x = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n    auto y = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n    auto z = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n\n    sphere->SetCenter(int(x), int(y), int(z));\n\n    vtkNew<vtkSampleFunction> sampler;\n    sampler->SetImplicitFunction(sphere);\n    sampler->SetOutputScalarTypeToFloat();\n    sampler->SetSampleDimensions(100, 100, 100);\n    sampler->SetModelBounds(-50, 50, -50, 50, -50, 50);\n\n    vtkNew<vtkImageThreshold> thres;\n    thres->SetInputConnection(sampler->GetOutputPort());\n    thres->ThresholdByLower(radius * radius);\n    thres->ReplaceInOn();\n    thres->ReplaceOutOn();\n    thres->SetInValue(i + 1);\n    thres->SetOutValue(0);\n    thres->Update();\n    if (i == 0)\n    {\n      blobImage->DeepCopy(thres->GetOutput());\n    }\n\n    vtkNew<vtkImageMathematics> maxValue;\n    maxValue->SetInputData(0, blobImage);\n    maxValue->SetInputData(1, thres->GetOutput());\n    maxValue->SetOperationToMax();\n    maxValue->Modified();\n    maxValue->Update();\n\n    blobImage->DeepCopy(maxValue->GetOutput());\n  }\n  return blobImage;\n}\n\n// Generate some random colors.\nvtkSmartPointer<vtkLookupTable> MakeColors(unsigned int n)\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(n);\n  lut->SetTableRange(0, n - 1);\n  lut->SetScaleToLinear();\n  lut->Build();\n  lut->SetTableValue(0, 0, 0, 0, 1);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(5071);\n  for (int i = 1; i < static_cast<int>(n); ++i)\n  {\n    auto r = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    auto g = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    auto b = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    lut->SetTableValue(i, r, g, b, 1.0);\n  }\n  return lut;\n}\n} // namespace\n
        "},{"location":"Cxx/Modelling/DiscreteMarchingCubes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DiscreteMarchingCubes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  ImagingCore\n  ImagingHybrid\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DiscreteMarchingCubes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DiscreteMarchingCubes MACOSX_BUNDLE DiscreteMarchingCubes.cxx )\n  target_link_libraries(DiscreteMarchingCubes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DiscreteMarchingCubes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/DiscreteMarchingCubes/#download-and-build-discretemarchingcubes","title":"Download and Build DiscreteMarchingCubes","text":"

        Click here to download DiscreteMarchingCubes and its CMakeLists.txt file. Once the tarball DiscreteMarchingCubes.tar has been downloaded and extracted,

        cd DiscreteMarchingCubes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DiscreteMarchingCubes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/ExtractLargestIsosurface/","title":"ExtractLargestIsosurface","text":"

        vtk-examples/Cxx/Modelling/ExtractLargestIsosurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Modelling/ExtractLargestIsosurface/#description","title":"Description","text":"
        • Contributed by: Jinyoung Hwang

        This example reads a structured points dataset stored in a .vtk file and constructs a 3D model using vtkFlyingEdges3D or vtkMarchingCubes, vtkPolyDataConnectivityFilter is used to extract the largest isosurface.

        Data is available at:

        1. test.vtk: http://web.kaist.ac.kr/~hjy/test.vtk

        2. brainweb.img: http://web.kaist.ac.kr/~hjy/brainweb.img

        3. brainweb.hdr: http://web.kaist.ac.kr/~hjy/brainweb.hdr

        Second and third datasets can be downloaded from BrainWeb, which is free of charge in use for a research. \"test.vtk\" was converted from \"brainweb.img\" using a program by Erik Vidholm (http://www.cb.uu.se/~erik/vtk/rawToVTK.cpp).

        The examples expects 2 or 3 argments:

         ExtractLargestIsosurface InputFilename Threshold (ExtractLargest)\n

        if ExtractLargest is omitted or 1, the largest isosurface is extracted

        if ExtractLargest is 0 (or -a in Python), all of the isosurfaces are extracted

        Try

        ExtractLargestIsosurface test.vtk 50

        and compare the results to

        ExtractLargestIsosurface test.vtk 50 0

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/ExtractLargestIsosurface/#code","title":"Code","text":"

        ExtractLargestIsosurface.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMarchingCubes.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <array>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" InputFile(.vtk) Threshold e.g. brain.vtk 50 1\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  const char* fileName = argv[1];\n  float threshold = atof(argv[2]);\n  auto extractLargest = true;\n  if (argc == 4)\n  {\n    extractLargest = atoi(argv[3]) == 1;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> skinColor{{240, 184, 160, 255}};\n  colors->SetColor(\"SkinColor\", skinColor.data());\n  std::array<unsigned char, 4> backColor{{255, 229, 200, 255}};\n  colors->SetColor(\"BackfaceColor\", backColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n\n  // Load data\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(fileName);\n\n  // Create a 3D model using flying edges or marching cubes.\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> mc;\n#else\n  vtkNew<vtkMarchingCubes> mc;\n#endif\n\n  mc->SetInputConnection(reader->GetOutputPort());\n  mc->ComputeNormalsOn();\n  mc->ComputeGradientsOn();\n  mc->SetValue(0, threshold); // Second value acts as threshold.\n\n  // To remain largest region.\n  vtkNew<vtkPolyDataConnectivityFilter> confilter;\n  confilter->SetInputConnection(mc->GetOutputPort());\n  confilter->SetExtractionModeToLargestRegion();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  if (extractLargest)\n  {\n    mapper->SetInputConnection(confilter->GetOutputPort());\n  }\n  else\n  {\n    mapper->SetInputConnection(mc->GetOutputPort());\n  }\n  mapper->ScalarVisibilityOff();\n\n  // Visualize\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"SkinColor\").GetData());\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"BackfaceColor\").GetData());\n  actor->SetBackfaceProperty(backProp);\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->GetActiveCamera()->SetViewUp(0.0, 0.0, 1.0);\n  renderer->GetActiveCamera()->SetPosition(0.0, 1.0, 0.0);\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Elevation(30.0);\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(renderer);\n  renwin->SetSize(640, 480);\n  renwin->SetWindowName(\"ExtractLargestIsosurface\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n  renwin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Modelling/ExtractLargestIsosurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractLargestIsosurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractLargestIsosurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractLargestIsosurface MACOSX_BUNDLE ExtractLargestIsosurface.cxx )\n  target_link_libraries(ExtractLargestIsosurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractLargestIsosurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/ExtractLargestIsosurface/#download-and-build-extractlargestisosurface","title":"Download and Build ExtractLargestIsosurface","text":"

        Click here to download ExtractLargestIsosurface and its CMakeLists.txt file. Once the tarball ExtractLargestIsosurface.tar has been downloaded and extracted,

        cd ExtractLargestIsosurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractLargestIsosurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/Finance/","title":"Finance","text":"

        vtk-examples/Cxx/Modelling/Finance

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Modelling/Finance/#description","title":"Description","text":"

        The first step is to choose dependent and independent variables. This choice is essentially a mapping from multidimensional data into an unstructured point dataset. This example chooses MONTHLY_PAYMENT, INTEREST_RATE, and LOAN_AMOUNT as (x, y, z) point coordinates, and TIME_LATE as a scalar value. This maps four of six variables. For now we will ignore the other two variables.

        The example uses vtkGaussianSplatter to perform the splatting operation (i.e., conversion from unstructured points to volume dataset). This is followed by an isosurface extraction. We splat the data two times. The first time we splat the entire population. This is to show context and appears as gray/ wireframe in the figure. The second time we splat the data and scale it by the value of TIME_LATE . As a result, only payments that are late contribute to the second isosurface. The results of this visualization are interesting. First, we see that there is a strong correlation between the two independent variables MONTHLY_PAYMENT and LOAN_AMOUNT . (This is more evident when viewing the data interactively.) We see that the data falls roughly on a plane at a 45 degree angle between these two axes. With a little reflection this is evident: the monthly payment is strongly a function of loan amount (as well as interest rate and payment period). Second, we see that there is a clustering of delinquent accounts within the total population. The cluster tends to grow with larger interest rates and shrink with smaller monthly payments and loan amounts. Although the relationship with interest rate is expected, the clustering towards smaller monthly payments is not. Thus our visualization has provided a clue into the data. Further exploration may reveal the reason(s), or we may perform additional data analysis and acquisition to understand the phenomena.

        One important note about multidimensional visualization. Because we tend to combine variables in odd ways (e.g., the use of MONTHLY_PAYMENT , INTEREST_RATE , and LOAN_AMOUNT as (x, y, z) coordinates), normalization of the data is usually required. To normalize data we simply adjust data values to lie between (0,1). Otherwise our data can be badly skewed and result in poor visualizations.

        Info

        See Figure 9-50 in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/Finance/#code","title":"Code","text":"

        Finance.cxx

        #include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkDataSet.h>\n#include <vtkFloatArray.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <algorithm>\n#include <array>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkDataSet> ReadFinancialData(const char* fname, const char* x,\n                                              const char* y, const char* z,\n                                              const char* s);\n\nint ParseFile(FILE* file, const char* tag, float* data);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  double bounds[6];\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" financial_file e.g. financial.txt\"\n              << endl;\n    return EXIT_FAILURE;\n  }\n  char* fname = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the color for the population.\n  std::array<unsigned char, 4> popColor{{230, 230, 230, 255}};\n  colors->SetColor(\"PopColor\", popColor.data());\n\n  // Read the data.\n  auto dataSet = ReadFinancialData(fname, \"MONTHLY_PAYMENT\", \"INTEREST_RATE\",\n                                   \"LOAN_AMOUNT\", \"TIME_LATE\");\n  // Construct the pipeline for the original population.\n  vtkNew<vtkGaussianSplatter> popSplatter;\n  popSplatter->SetInputData(dataSet);\n  popSplatter->SetSampleDimensions(100, 100, 100);\n  popSplatter->SetRadius(0.05);\n  popSplatter->ScalarWarpingOff();\n\n  vtkNew<vtkContourFilter> popSurface;\n  popSurface->SetInputConnection(popSplatter->GetOutputPort());\n  popSurface->SetValue(0, 0.01);\n\n  vtkNew<vtkPolyDataMapper> popMapper;\n  popMapper->SetInputConnection(popSurface->GetOutputPort());\n  popMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> popActor;\n  popActor->SetMapper(popMapper);\n  popActor->GetProperty()->SetOpacity(0.3);\n  popActor->GetProperty()->SetColor(colors->GetColor3d(\"popColor\").GetData());\n\n  // Construct the pipeline for the delinquent population.\n  vtkNew<vtkGaussianSplatter> lateSplatter;\n  lateSplatter->SetInputData(dataSet);\n  lateSplatter->SetSampleDimensions(50, 50, 50);\n  lateSplatter->SetRadius(0.05);\n  lateSplatter->SetScaleFactor(0.005);\n\n  vtkNew<vtkContourFilter> lateSurface;\n  lateSurface->SetInputConnection(lateSplatter->GetOutputPort());\n  lateSurface->SetValue(0, 0.01);\n\n  vtkNew<vtkPolyDataMapper> lateMapper;\n  lateMapper->SetInputConnection(lateSurface->GetOutputPort());\n  lateMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> lateActor;\n  lateActor->SetMapper(lateMapper);\n  lateActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  // Create axes.\n  popSplatter->Update();\n  popSplatter->GetOutput()->GetBounds(bounds);\n\n  vtkNew<vtkAxes> axes;\n  axes->SetOrigin(bounds[0], bounds[2], bounds[4]);\n  axes->SetScaleFactor(popSplatter->GetOutput()->GetLength() / 5);\n\n  vtkNew<vtkTubeFilter> axesTubes;\n  axesTubes->SetInputConnection(axes->GetOutputPort());\n  axesTubes->SetRadius(axes->GetScaleFactor() / 25.0);\n  axesTubes->SetNumberOfSides(6);\n\n  vtkNew<vtkPolyDataMapper> axesMapper;\n  axesMapper->SetInputConnection(axesTubes->GetOutputPort());\n\n  vtkNew<vtkActor> axesActor;\n  axesActor->SetMapper(axesMapper);\n\n  // Graphics stuff.\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"Financial\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renWin);\n\n  // Set up the renderer.\n  renderer->AddActor(lateActor);\n  renderer->AddActor(axesActor);\n  renderer->AddActor(popActor);\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(640, 480);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.3);\n  renderer->ResetCameraClippingRange();\n\n  // Interact with the data.\n  renWin->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkDataSet> ReadFinancialData(const char* filename,\n                                              const char* x, const char* y,\n                                              const char* z, const char* s)\n{\n  float xyz[3];\n  FILE* file;\n  int i, npts;\n  char tag[80];\n\n  if ((file = fopen(filename, \"r\")) == 0)\n  {\n    std::cerr << \"ERROR: Can't open file: \" << filename << std::endl;\n    return nullptr;\n  }\n\n  int n = fscanf(file, \"%79s %d\", tag, &npts); // read number of points\n  if (n != 2)\n  {\n    std::cerr << \"ERROR: Can't read file: \" << filename << std::endl;\n    fclose(file);\n    return NULL;\n  }\n  // Check for a reasonable npts.\n  if (npts <= 0)\n  {\n    std::cerr << \"ERROR: Number of points must be greater that 0\" << std::endl;\n    fclose(file);\n    return NULL;\n  }\n  // We arbitrarily pick a large upper limit on npts.\n  if (npts > VTK_INT_MAX / 10)\n  {\n    std::cerr << \"ERROR: npts (\" << npts << \") is unreasonably large\"\n              << std::endl;\n    fclose(file);\n    return NULL;\n  }\n  vtkNew<vtkUnstructuredGrid> dataSet;\n  float* xV = new float[npts];\n  float* yV = new float[npts];\n  float* zV = new float[npts];\n  float* sV = new float[npts];\n\n  if (!ParseFile(file, x, xV) || !ParseFile(file, y, yV) ||\n      !ParseFile(file, z, zV) || !ParseFile(file, s, sV))\n  {\n    std::cerr << \"ERROR: Couldn't read data!\" << std::endl;\n    delete[] xV;\n    delete[] yV;\n    delete[] zV;\n    delete[] sV;\n    fclose(file);\n    return NULL;\n  }\n\n  vtkNew<vtkPoints> newPts;\n  vtkNew<vtkFloatArray> newScalars;\n\n  for (i = 0; i < npts; i++)\n  {\n    xyz[0] = xV[i];\n    xyz[1] = yV[i];\n    xyz[2] = zV[i];\n    //     std::cout << xV[i] << \" \" << yV[i] << \" \" << zV[i] << std::endl;\n    newPts->InsertPoint(i, xyz);\n    newScalars->InsertValue(i, sV[i]);\n  }\n\n  dataSet->SetPoints(newPts);\n  dataSet->GetPointData()->SetScalars(newScalars);\n\n  // cleanup\n  delete[] xV;\n  delete[] yV;\n  delete[] zV;\n  delete[] sV;\n  fclose(file);\n\n  return dataSet;\n}\n\nint ParseFile(FILE* file, const char* label, float* data)\n{\n  char tag[80];\n  int i, npts, readData = 0;\n  float min = VTK_FLOAT_MAX;\n  float max = (-VTK_FLOAT_MAX);\n\n  if (file == NULL || label == NULL)\n    return 0;\n\n  rewind(file);\n\n  if (fscanf(file, \"%79s %d\", tag, &npts) != 2)\n  {\n    std::cerr << \"ERROR: IO Error \" << __FILE__ << \":\" << __LINE__ << std::endl;\n    return 0;\n  }\n  while (!readData && fscanf(file, \"%79s\", tag) == 1)\n  {\n    if (!strcmp(tag, label))\n    {\n      readData = 1;\n      for (i = 0; i < npts; i++)\n      {\n        if (fscanf(file, \"%f\", data + i) != 1)\n        {\n          std::cerr << \"ERROR: IO Error \" << __FILE__ << \":\" << __LINE__\n                    << std::endl;\n          return 0;\n        }\n        if (data[i] < min)\n          min = data[i];\n        if (data[i] > min)\n          max = data[i];\n      }\n      // normalize data\n      for (i = 0; i < npts; i++) data[i] = min + data[i] / (max - min);\n    }\n    else\n    {\n      for (i = 0; i < npts; i++)\n      {\n        if (fscanf(file, \"%*f\") != 0)\n        {\n          std::cerr << \"ERROR: IO Error \" << __FILE__ << \":\" << __LINE__\n                    << std::endl;\n          return 0;\n        }\n      }\n    }\n  }\n\n  if (!readData)\n    return 0;\n  else\n    return 1;\n}\n} // namespace\n
        "},{"location":"Cxx/Modelling/Finance/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Finance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Finance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Finance MACOSX_BUNDLE Finance.cxx )\n  target_link_libraries(Finance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Finance\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/Finance/#download-and-build-finance","title":"Download and Build Finance","text":"

        Click here to download Finance and its CMakeLists.txt file. Once the tarball Finance.tar has been downloaded and extracted,

        cd Finance/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Finance\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/FinanceFieldData/","title":"FinanceFieldData","text":"

        vtk-examples/Cxx/Modelling/FinanceFieldData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Modelling/FinanceFieldData/#description","title":"Description","text":"

        This example is similar to Finance, but here we read a .vtk file with vtkDataObjectReader. The file is: src/Testing/Data/financial.vtk.

        The generated image is Figure 5 in VTKFileFormats.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/FinanceFieldData/#code","title":"Code","text":"

        FinanceFieldData.cxx

        #include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkDataObjectReader.h>\n#include <vtkDataObjectToDataSetFilter.h>\n#include <vtkFieldDataToAttributeDataFilter.h>\n#include <vtkFollower.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkImageData.h>\n#include <vtkMarchingContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n#include <vtkVectorText.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" financial.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataObjectReader> reader;\n  reader->SetFileName(argv[1]);\n\n  int size = 3187; // maximum number possible\n\n  std::string xAxis = \"INTEREST_RATE\";\n  std::string yAxis = \"MONTHLY_PAYMENT\";\n  std::string zAxis = \"MONTHLY_INCOME\";\n  std::string scalar = \"TIME_LATE\";\n\n  // Extract the data from field as a polydata (just points),\n  // then extract scalars.\n  vtkNew<vtkDataObjectToDataSetFilter> do2ds;\n  do2ds->SetInputConnection(reader->GetOutputPort());\n  do2ds->SetDataSetTypeToPolyData();\n  // format: component//, arrayname, arraycomp, minArrayId, maxArrayId,\n  // Normalize\n  do2ds->DefaultNormalizeOn();\n  do2ds->SetPointComponent(0, const_cast<char*>(xAxis.c_str()), 0);\n  do2ds->SetPointComponent(1, const_cast<char*>(yAxis.c_str()), 0, 0, size, 1);\n  do2ds->SetPointComponent(2, const_cast<char*>(zAxis.c_str()), 0);\n  do2ds->Update();\n  vtkNew<vtkFieldDataToAttributeDataFilter> fd2ad;\n  fd2ad->SetInputConnection(do2ds->GetOutputPort());\n  fd2ad->SetInputFieldToDataObjectField();\n  fd2ad->SetOutputAttributeDataToPointData();\n  fd2ad->DefaultNormalizeOn();\n  fd2ad->SetScalarComponent(0, scalar.c_str(), 0);\n\n  // Construct pipeline for the original population.\n  vtkNew<vtkGaussianSplatter> popSplatter;\n  popSplatter->SetInputConnection(fd2ad->GetOutputPort());\n  popSplatter->SetSampleDimensions(150, 150, 150);\n  popSplatter->SetRadius(0.05);\n  popSplatter->ScalarWarpingOff();\n\n  vtkNew<vtkMarchingContourFilter> popSurface;\n  popSurface->SetInputConnection(popSplatter->GetOutputPort());\n  popSurface->SetValue(0, 0.01);\n  vtkNew<vtkPolyDataMapper> popMapper;\n  popMapper->SetInputConnection(popSurface->GetOutputPort());\n  popMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> popActor;\n  popActor->SetMapper(popMapper);\n  popActor->GetProperty()->SetOpacity(0.3);\n  popActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Construct the pipeline for the delinquent population.\n  vtkNew<vtkGaussianSplatter> lateSplatter;\n  lateSplatter->SetInputConnection(fd2ad->GetOutputPort());\n  lateSplatter->SetSampleDimensions(150, 150, 150);\n  lateSplatter->SetRadius(0.05);\n  lateSplatter->SetScaleFactor(0.05);\n\n  vtkNew<vtkMarchingContourFilter> lateSurface;\n  lateSurface->SetInputConnection(lateSplatter->GetOutputPort());\n  lateSurface->SetValue(0, 0.01);\n  vtkNew<vtkPolyDataMapper> lateMapper;\n  lateMapper->SetInputConnection(lateSurface->GetOutputPort());\n  lateMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> lateActor;\n  lateActor->SetMapper(lateMapper);\n  lateActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create axes.\n  popSplatter->Update();\n  double* bounds;\n  bounds = popSplatter->GetOutput()->GetBounds();\n  vtkNew<vtkAxes> axes;\n  axes->SetOrigin(bounds[0], bounds[2], bounds[4]);\n  axes->SetScaleFactor(popSplatter->GetOutput()->GetLength() / 5.0);\n  vtkNew<vtkTubeFilter> axesTubes;\n  axesTubes->SetInputConnection(axes->GetOutputPort());\n  axesTubes->SetRadius(axes->GetScaleFactor() / 25.0);\n  axesTubes->SetNumberOfSides(6);\n  vtkNew<vtkPolyDataMapper> axesMapper;\n  axesMapper->SetInputConnection(axesTubes->GetOutputPort());\n  vtkNew<vtkActor> axesActor;\n  axesActor->SetMapper(axesMapper);\n\n  // Label the axes.\n  vtkNew<vtkVectorText> XText;\n  XText->SetText(const_cast<char*>(xAxis.c_str()));\n  vtkNew<vtkPolyDataMapper> XTextMapper;\n  XTextMapper->SetInputConnection(XText->GetOutputPort());\n\n  vtkNew<vtkFollower> XActor;\n  XActor->SetMapper(XTextMapper);\n  XActor->SetScale(0.02, .02, .02);\n  XActor->SetPosition(0.35, -0.05, -0.05);\n  XActor->GetProperty()->SetColor(0, 0, 0);\n\n  vtkNew<vtkVectorText> YText;\n  YText->SetText(const_cast<char*>(yAxis.c_str()));\n\n  vtkNew<vtkPolyDataMapper> YTextMapper;\n  YTextMapper->SetInputConnection(YText->GetOutputPort());\n  vtkNew<vtkFollower> YActor;\n  YActor->SetMapper(YTextMapper);\n  YActor->SetScale(0.02, .02, .02);\n  YActor->SetPosition(-0.05, 0.35, -0.05);\n  YActor->GetProperty()->SetColor(0, 0, 0);\n\n  vtkNew<vtkVectorText> ZText;\n  ZText->SetText(const_cast<char*>(zAxis.c_str()));\n  vtkNew<vtkPolyDataMapper> ZTextMapper;\n  ZTextMapper->SetInputConnection(ZText->GetOutputPort());\n  vtkNew<vtkFollower> ZActor;\n  ZActor->SetMapper(ZTextMapper);\n  ZActor->SetScale(0.02, .02, .02);\n  ZActor->SetPosition(-0.05, -0.05, 0.35);\n  ZActor->GetProperty()->SetColor(0, 0, 0);\n\n  // Graphics stuff.\n  //\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"FinanceFieldData\");\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  renderer->AddActor(axesActor);\n  renderer->AddActor(lateActor);\n  renderer->AddActor(XActor);\n  renderer->AddActor(YActor);\n  renderer->AddActor(ZActor);\n  renderer->AddActor(popActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->SetSize(650, 480);\n\n  vtkNew<vtkCamera> camera;\n  camera->SetClippingRange(.274, 13.72);\n  camera->SetFocalPoint(0.433816, 0.333131, 0.449);\n  camera->SetPosition(-1.96987, 1.15145, 1.49053);\n  camera->SetViewUp(0.378927, 0.911821, 0.158107);\n  renderer->SetActiveCamera(camera);\n  XActor->SetCamera(camera);\n  YActor->SetCamera(camera);\n  ZActor->SetCamera(camera);\n\n  // Render and interact with the data.\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Modelling/FinanceFieldData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FinanceFieldData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  IOLegacy\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FinanceFieldData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FinanceFieldData MACOSX_BUNDLE FinanceFieldData.cxx )\n  target_link_libraries(FinanceFieldData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FinanceFieldData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/FinanceFieldData/#download-and-build-financefielddata","title":"Download and Build FinanceFieldData","text":"

        Click here to download FinanceFieldData and its CMakeLists.txt file. Once the tarball FinanceFieldData.tar has been downloaded and extracted,

        cd FinanceFieldData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FinanceFieldData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/MarchingCubes/","title":"MarchingCubes","text":"

        vtk-examples/Cxx/Modelling/MarchingCubes

        "},{"location":"Cxx/Modelling/MarchingCubes/#description","title":"Description","text":"

        Creates a surface from a volume using Flying Edges or Marching Cubes.

        Without arguments, the examples generates a voxelized sphere with vtkVoxelModeller.

        Note

        vtkVoxelModeller by default produces a VTK_BIT scalar image. Marching Cubes does not support this type. The scalar output is set to float for this example.

        To generate a surface from a DICOM series, provide a folder containing the series and specify an isovalue for the surface.

        This Midas Repository contains a number of DICOM datasets.

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/MarchingCubes/#code","title":"Code","text":"

        MarchingCubes.cxx

        #include <vtkActor.h>\n#include <vtkDICOMImageReader.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n#include <vtkVoxelModeller.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> volume;\n  double isoValue;\n  if (argc < 3)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetPhiResolution(20);\n    sphereSource->SetThetaResolution(20);\n    sphereSource->Update();\n\n    double bounds[6];\n    sphereSource->GetOutput()->GetBounds(bounds);\n    for (unsigned int i = 0; i < 6; i += 2)\n    {\n      double range = bounds[i + 1] - bounds[i];\n      bounds[i] = bounds[i] - 0.1 * range;\n      bounds[i + 1] = bounds[i + 1] + 0.1 * range;\n    }\n    vtkNew<vtkVoxelModeller> voxelModeller;\n    voxelModeller->SetSampleDimensions(50, 50, 50);\n    voxelModeller->SetModelBounds(bounds);\n    voxelModeller->SetScalarTypeToFloat();\n    voxelModeller->SetMaximumDistance(0.1);\n\n    voxelModeller->SetInputConnection(sphereSource->GetOutputPort());\n    voxelModeller->Update();\n    isoValue = 0.5;\n    volume->DeepCopy(voxelModeller->GetOutput());\n  }\n  else\n  {\n    vtkNew<vtkDICOMImageReader> reader;\n    reader->SetDirectoryName(argv[1]);\n    reader->Update();\n    volume->DeepCopy(reader->GetOutput());\n    isoValue = atof(argv[2]);\n  }\n\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> surface;\n#else\n  vtkNew<vtkMarchingCubes> surface;\n#endif\n  surface->SetInputData(volume);\n  surface->ComputeNormalsOn();\n  surface->SetValue(0, isoValue);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MarchingCubes\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  renderer->AddActor(actor);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Modelling/MarchingCubes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCubes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOImage\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCubes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCubes MACOSX_BUNDLE MarchingCubes.cxx )\n  target_link_libraries(MarchingCubes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCubes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/MarchingCubes/#download-and-build-marchingcubes","title":"Download and Build MarchingCubes","text":"

        Click here to download MarchingCubes and its CMakeLists.txt file. Once the tarball MarchingCubes.tar has been downloaded and extracted,

        cd MarchingCubes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MarchingCubes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/MarchingSquares/","title":"MarchingSquares","text":"

        vtk-examples/Cxx/Modelling/MarchingSquares

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/MarchingSquares/#code","title":"Code","text":"

        MarchingSquares.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMarchingSquares.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFileName;\n  if (argc > 1)\n  {\n    inputFileName = argv[1];\n  }\n  int isoValue = 500;\n  if (argc > 2)\n  {\n    isoValue = atoi(argv[2]);\n  }\n\n  vtkNew<vtkPNGReader> reader;\n  if (!reader->CanReadFile(inputFileName.c_str()))\n  {\n    std::cerr << \"Error: Could not read \" << inputFileName << \".\\n\";\n    return EXIT_FAILURE;\n  }\n  reader->SetFileName(inputFileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkMarchingSquares> iso;\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->SetValue(0, isoValue);\n\n  vtkNew<vtkDataSetMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // Standard rendering classes\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetMultiSamples(0);\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"MarchingSquares\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(isoActor);\n\n  // Standard testing code.\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renWin->SetSize(300, 300);\n\n  vtkCamera* camera = renderer->GetActiveCamera();\n  renderer->ResetCamera();\n  camera->Azimuth(180);\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Modelling/MarchingSquares/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingSquares)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingSquares: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingSquares MACOSX_BUNDLE MarchingSquares.cxx )\n  target_link_libraries(MarchingSquares PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingSquares\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/MarchingSquares/#download-and-build-marchingsquares","title":"Download and Build MarchingSquares","text":"

        Click here to download MarchingSquares and its CMakeLists.txt file. Once the tarball MarchingSquares.tar has been downloaded and extracted,

        cd MarchingSquares/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MarchingSquares\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/SmoothDiscreteMarchingCubes/","title":"SmoothDiscreteMarchingCubes","text":"

        vtk-examples/Cxx/Modelling/SmoothDiscreteMarchingCubes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Modelling/SmoothDiscreteMarchingCubes/#description","title":"Description","text":"

        Creates surfaces from labeled data. Volume data does not always contain samples of continuous data. A volume may contain discrete integer values, often the result of segmentation. This example smooths the discrete models generated by vtkDiscreteMarchingCubes with vtkWindowedSincPolyDataFilter.

        Seealso

        DiscreteMarchingCubes produces rough models.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/SmoothDiscreteMarchingCubes/#code","title":"Code","text":"

        SmoothDiscreteMarchingCubes.cxx

        #include <vtkActor.h>\n#include <vtkDiscreteMarchingCubes.h>\n#include <vtkImageData.h>\n#include <vtkImageMathematics.h>\n#include <vtkImageThreshold.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphere.h>\n#include <vtkWindowedSincPolyDataFilter.h>\n\nnamespace {\nvtkSmartPointer<vtkLookupTable> MakeColors(unsigned int n);\n\nvtkSmartPointer<vtkImageData> MakeBlob(int n, double radius);\n} // namespace\n\nint main(int /* argc */, char* /* argv */[])\n{\n  int n = 20;\n  double radius = 8;\n\n  vtkSmartPointer<vtkImageData> blob = MakeBlob(n, radius);\n\n  vtkNew<vtkDiscreteMarchingCubes> discrete;\n  discrete->SetInputData(blob);\n  discrete->GenerateValues(n, 1, n);\n\n  unsigned int smoothingIterations = 15;\n  double passBand = 0.001;\n  double featureAngle = 120.0;\n\n  vtkNew<vtkWindowedSincPolyDataFilter> smoother;\n  smoother->SetInputConnection(discrete->GetOutputPort());\n  smoother->SetNumberOfIterations(smoothingIterations);\n  smoother->BoundarySmoothingOff();\n  smoother->FeatureEdgeSmoothingOff();\n  smoother->SetFeatureAngle(featureAngle);\n  smoother->SetPassBand(passBand);\n  smoother->NonManifoldSmoothingOn();\n  smoother->NormalizeCoordinatesOn();\n  smoother->Update();\n\n  vtkSmartPointer<vtkLookupTable> lut = MakeColors(n);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(smoother->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, lut->GetNumberOfColors());\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"SmoothDiscreteMarchingCubes\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  ren1->AddActor(actor);\n\n  vtkNew<vtkNamedColors> colors;\n  ren1->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkImageData> MakeBlob(int n, double radius)\n{\n  vtkNew<vtkImageData> blobImage;\n\n  double maxR = 50 - 2.0 * radius;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(5071);\n  for (int i = 0; i < n; ++i)\n  {\n    vtkNew<vtkSphere> sphere;\n    sphere->SetRadius(radius);\n    auto x = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n    auto y = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n    auto z = randomSequence->GetRangeValue(-maxR, maxR);\n    randomSequence->Next();\n\n    sphere->SetCenter(int(x), int(y), int(z));\n\n    vtkNew<vtkSampleFunction> sampler;\n    sampler->SetImplicitFunction(sphere);\n    sampler->SetOutputScalarTypeToFloat();\n    sampler->SetSampleDimensions(100, 100, 100);\n    sampler->SetModelBounds(-50, 50, -50, 50, -50, 50);\n\n    vtkNew<vtkImageThreshold> thres;\n    thres->SetInputConnection(sampler->GetOutputPort());\n    thres->ThresholdByLower(radius * radius);\n    thres->ReplaceInOn();\n    thres->ReplaceOutOn();\n    thres->SetInValue(i + 1);\n    thres->SetOutValue(0);\n    thres->Update();\n    if (i == 0)\n    {\n      blobImage->DeepCopy(thres->GetOutput());\n    }\n\n    vtkNew<vtkImageMathematics> maxValue;\n    maxValue->SetInputData(0, blobImage);\n    maxValue->SetInputData(1, thres->GetOutput());\n    maxValue->SetOperationToMax();\n    maxValue->Modified();\n    maxValue->Update();\n\n    blobImage->DeepCopy(maxValue->GetOutput());\n  }\n  return blobImage;\n}\n\n// Generate some random colors\nvtkSmartPointer<vtkLookupTable> MakeColors(unsigned int n)\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(n);\n  lut->SetTableRange(0, n - 1);\n  lut->SetScaleToLinear();\n  lut->Build();\n  lut->SetTableValue(0, 0, 0, 0, 1);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(5071);\n  for (int i = 1; i < static_cast<int>(n); ++i)\n  {\n    auto r = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    auto g = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    auto b = randomSequence->GetRangeValue(0.4, 1);\n    randomSequence->Next();\n    lut->SetTableValue(i, r, g, b, 1.0);\n  }\n  return lut;\n}\n} // namespace\n
        "},{"location":"Cxx/Modelling/SmoothDiscreteMarchingCubes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SmoothDiscreteMarchingCubes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  ImagingCore\n  ImagingHybrid\n  ImagingMath\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SmoothDiscreteMarchingCubes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SmoothDiscreteMarchingCubes MACOSX_BUNDLE SmoothDiscreteMarchingCubes.cxx )\n  target_link_libraries(SmoothDiscreteMarchingCubes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SmoothDiscreteMarchingCubes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/SmoothDiscreteMarchingCubes/#download-and-build-smoothdiscretemarchingcubes","title":"Download and Build SmoothDiscreteMarchingCubes","text":"

        Click here to download SmoothDiscreteMarchingCubes and its CMakeLists.txt file. Once the tarball SmoothDiscreteMarchingCubes.tar has been downloaded and extracted,

        cd SmoothDiscreteMarchingCubes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SmoothDiscreteMarchingCubes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Modelling/Spring/","title":"Spring","text":"

        vtk-examples/Cxx/Modelling/Spring

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Modelling/Spring/#code","title":"Code","text":"

        Spring.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRotationalExtrusionFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // create spring profile (a circle)\n  //\n  vtkNew<vtkPoints> points;\n  points->InsertPoint(0, 1.0, 0.0, 0.0);\n  points->InsertPoint(1, 1.0732, 0.0, -0.1768);\n  points->InsertPoint(2, 1.25, 0.0, -0.25);\n  points->InsertPoint(3, 1.4268, 0.0, -0.1768);\n  points->InsertPoint(4, 1.5, 0.0, 0.00);\n  points->InsertPoint(5, 1.4268, 0.0, 0.1768);\n  points->InsertPoint(6, 1.25, 0.0, 0.25);\n  points->InsertPoint(7, 1.0732, 0.0, 0.1768);\n\n  vtkNew<vtkCellArray> poly;\n  poly->InsertNextCell(8); // number of points\n  poly->InsertCellPoint(0);\n  poly->InsertCellPoint(1);\n  poly->InsertCellPoint(2);\n  poly->InsertCellPoint(3);\n  poly->InsertCellPoint(4);\n  poly->InsertCellPoint(5);\n  poly->InsertCellPoint(6);\n  poly->InsertCellPoint(7);\n\n  vtkNew<vtkPolyData> profile;\n  profile->SetPoints(points);\n  profile->SetPolys(poly);\n\n  // extrude profile to make spring\n  //\n  vtkNew<vtkRotationalExtrusionFilter> extrude;\n  extrude->SetInputData(profile);\n  extrude->SetResolution(360);\n  extrude->SetTranslation(6);\n  extrude->SetDeltaRadius(1.0);\n  extrude->SetAngle(2160.0); // six revolutions\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(extrude->GetOutputPort());\n  normals->SetFeatureAngle(60);\n\n  vtkNew<vtkPolyDataMapper> map;\n  map->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkActor> spring;\n  spring->SetMapper(map);\n  spring->GetProperty()->SetColor(colors->GetColor3d(\"PowderBlue\").GetData());\n  spring->GetProperty()->SetDiffuse(0.7);\n  spring->GetProperty()->SetSpecular(0.4);\n  spring->GetProperty()->SetSpecularPower(20);\n  spring->GetProperty()->BackfaceCullingOn();\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer->AddActor(spring);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderWindow->SetSize(640, 512);\n  renderWindow->SetWindowName(\"Spring\");\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(90);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Modelling/Spring/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Spring)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Spring: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Spring MACOSX_BUNDLE Spring.cxx )\n  target_link_libraries(Spring PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Spring\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Modelling/Spring/#download-and-build-spring","title":"Download and Build Spring","text":"

        Click here to download Spring and its CMakeLists.txt file. Once the tarball Spring.tar has been downloaded and extracted,

        cd Spring/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Spring\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Parallel/ExodusIIWriter/","title":"ExodusIIWriter","text":"

        vtk-examples/Cxx/Parallel/ExodusIIWriter

        "},{"location":"Cxx/Parallel/ExodusIIWriter/#description","title":"Description","text":"

        Requires VTK to be built with VTK_USE_PARALLEL.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Parallel/ExodusIIWriter/#code","title":"Code","text":"

        ExodusIIWriter.cxx

        #include <vtkExodusIIWriter.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkTimeSourceExample.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkTimeSourceExample> timeSource;\n\n  vtkNew<vtkExodusIIWriter> exodusWriter;\n  exodusWriter->SetFileName(\"output.exii\");\n  exodusWriter->SetInputConnection(timeSource->GetOutputPort());\n  exodusWriter->WriteAllTimeStepsOn();\n  exodusWriter->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Parallel/ExodusIIWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExodusIIWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOExodus\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExodusIIWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExodusIIWriter MACOSX_BUNDLE ExodusIIWriter.cxx )\n  target_link_libraries(ExodusIIWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExodusIIWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Parallel/ExodusIIWriter/#download-and-build-exodusiiwriter","title":"Download and Build ExodusIIWriter","text":"

        Click here to download ExodusIIWriter and its CMakeLists.txt file. Once the tarball ExodusIIWriter.tar has been downloaded and extracted,

        cd ExodusIIWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExodusIIWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Picking/AreaPicking/","title":"AreaPicking","text":"

        vtk-examples/Cxx/Picking/AreaPicking

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Picking/AreaPicking/#description","title":"Description","text":"

        This example creates 3 points+vertices. Currently, the address of the picked prop is 0 (this is not correct). A red bounding box is drawn around every picked prop.

        • For [vtkInteractorStyleTrackballCamera](https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleTrackballCamera.html#details) - use 'p' to pick at the current mouse position

        • For [vtkInteractorStyleRubberBandPick](https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleRubberBandPick.html#details) - use 'r' and left-mouse to draw a selection box used to pick

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Picking/AreaPicking/#code","title":"Code","text":"

        AreaPicking.cxx

        #include <vtkActor.h>\n#include <vtkAreaPicker.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCellArray.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkInteractorStyleTrackball.h>\n// #include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProp3DCollection.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\nvoid PickCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                          void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  // Create a set of points.\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> vertices;\n  vtkIdType pid[1];\n  pid[0] = points->InsertNextPoint(1.0, 0.0, 0.0);\n  vertices->InsertNextCell(1, pid);\n  pid[0] = points->InsertNextPoint(0.0, 0.0, 0.0);\n  vertices->InsertNextCell(1, pid);\n  pid[0] = points->InsertNextPoint(0.0, 1.0, 0.0);\n  vertices->InsertNextCell(1, pid);\n\n  // Create a polydata\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetVerts(vertices);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(8);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"AreaPicking\");\n\n  vtkNew<vtkAreaPicker> areaPicker;\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->SetPicker(areaPicker);\n\n  renderer->AddActor(actor);\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n\n  // For vtkInteractorStyleRubberBandPick - use 'r' and left-mouse to draw a\n  // selection box used to pick.\n  vtkNew<vtkInteractorStyleRubberBandPick> style;\n\n  // For vtkInteractorStyleTrackballCamera - use 'p' to pick at the current\n  // mouse position.\n  //  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  //    paraview\n  style->SetCurrentRenderer(renderer);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkCallbackCommand> pickCallback;\n  pickCallback->SetCallback(PickCallbackFunction);\n\n  areaPicker->AddObserver(vtkCommand::EndPickEvent, pickCallback);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid PickCallbackFunction(vtkObject* caller,\n                          long unsigned int vtkNotUsed(eventId),\n                          void* vtkNotUsed(clientData),\n                          void* vtkNotUsed(callData))\n{\n  std::cout << \"Pick.\" << std::endl;\n  vtkAreaPicker* areaPicker = static_cast<vtkAreaPicker*>(caller);\n  vtkProp3DCollection* props = areaPicker->GetProp3Ds();\n  props->InitTraversal();\n\n  for (vtkIdType i = 0; i < props->GetNumberOfItems(); i++)\n  {\n    vtkProp3D* prop = props->GetNextProp3D();\n    std::cout << \"Picked prop: \" << prop << std::endl;\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/Picking/AreaPicking/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AreaPicking)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AreaPicking: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AreaPicking MACOSX_BUNDLE AreaPicking.cxx )\n  target_link_libraries(AreaPicking PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AreaPicking\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Picking/AreaPicking/#download-and-build-areapicking","title":"Download and Build AreaPicking","text":"

        Click here to download AreaPicking and its CMakeLists.txt file. Once the tarball AreaPicking.tar has been downloaded and extracted,

        cd AreaPicking/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AreaPicking\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Picking/CellPicking/","title":"CellPicking","text":"

        vtk-examples/Cxx/Picking/CellPicking

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Picking/CellPicking/#description","title":"Description","text":"

        This example demonstrates how to get the coordinates of the point on an actor that is clicked with the left mouse button. It also indicates which cell the selected point belongs to by highlighting the edges of that cell.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Picking/CellPicking/#code","title":"Code","text":"

        CellPicking.cxx

        #include <vtkActor.h>\n#include <vtkCellPicker.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangleFilter.h>\n#include <vtkUnstructuredGrid.h>\n\nnamespace {\n\n// Catch mouse events.\nclass MouseInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorStyle* New();\n\n  MouseInteractorStyle()\n  {\n    selectedMapper = vtkSmartPointer<vtkDataSetMapper>::New();\n    selectedActor = vtkSmartPointer<vtkActor>::New();\n  }\n\n  virtual void OnLeftButtonDown() override\n  {\n    vtkNew<vtkNamedColors> colors;\n\n    // Get the location of the click (in window coordinates).\n    int* pos = this->GetInteractor()->GetEventPosition();\n\n    vtkNew<vtkCellPicker> picker;\n    picker->SetTolerance(0.0005);\n\n    // Pick from this location.\n    picker->Pick(pos[0], pos[1], 0, this->GetDefaultRenderer());\n\n    double* worldPosition = picker->GetPickPosition();\n    std::cout << \"Cell id is: \" << picker->GetCellId() << std::endl;\n\n    if (picker->GetCellId() != -1)\n    {\n\n      std::cout << \"Pick position is: (\" << worldPosition[0] << \", \"\n                << worldPosition[1] << \", \" << worldPosition[2] << \")\" << endl;\n\n      vtkNew<vtkIdTypeArray> ids;\n      ids->SetNumberOfComponents(1);\n      ids->InsertNextValue(picker->GetCellId());\n\n      vtkNew<vtkSelectionNode> selectionNode;\n      selectionNode->SetFieldType(vtkSelectionNode::CELL);\n      selectionNode->SetContentType(vtkSelectionNode::INDICES);\n      selectionNode->SetSelectionList(ids);\n\n      vtkNew<vtkSelection> selection;\n      selection->AddNode(selectionNode);\n\n      vtkNew<vtkExtractSelection> extractSelection;\n      extractSelection->SetInputData(0, this->Data);\n      extractSelection->SetInputData(1, selection);\n      extractSelection->Update();\n\n      // In selection\n      vtkNew<vtkUnstructuredGrid> selected;\n      selected->ShallowCopy(extractSelection->GetOutput());\n\n      std::cout << \"Number of points in the selection: \"\n                << selected->GetNumberOfPoints() << std::endl;\n      std::cout << \"Number of cells in the selection : \"\n                << selected->GetNumberOfCells() << std::endl;\n      selectedMapper->SetInputData(selected);\n      selectedActor->SetMapper(selectedMapper);\n      selectedActor->GetProperty()->EdgeVisibilityOn();\n      selectedActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"Tomato\").GetData());\n\n      selectedActor->GetProperty()->SetLineWidth(3);\n\n      this->Interactor->GetRenderWindow()\n          ->GetRenderers()\n          ->GetFirstRenderer()\n          ->AddActor(selectedActor);\n    }\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n\n  vtkSmartPointer<vtkPolyData> Data;\n  vtkSmartPointer<vtkDataSetMapper> selectedMapper;\n  vtkSmartPointer<vtkActor> selectedActor;\n};\n\nvtkStandardNewMacro(MouseInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(planeSource->GetOutputPort());\n  triangleFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(triangleFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"SeaGreen\").GetData());\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CellPicking\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindowInteractor->Initialize();\n\n  // Set the custom stype to use for interaction.\n  vtkNew<MouseInteractorStyle> style;\n  style->SetDefaultRenderer(renderer);\n  style->Data = triangleFilter->GetOutput();\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n\n  renderer->SetBackground(colors->GetColor3d(\"PaleTurquoise\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Picking/CellPicking/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellPicking)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellPicking: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellPicking MACOSX_BUNDLE CellPicking.cxx )\n  target_link_libraries(CellPicking PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellPicking\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Picking/CellPicking/#download-and-build-cellpicking","title":"Download and Build CellPicking","text":"

        Click here to download CellPicking and its CMakeLists.txt file. Once the tarball CellPicking.tar has been downloaded and extracted,

        cd CellPicking/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellPicking\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Picking/HighlightPickedActor/","title":"HighlightPickedActor","text":"

        vtk-examples/Cxx/Picking/HighlightPickedActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Picking/HighlightPickedActor/#description","title":"Description","text":"

        Click on a sphere to highlight it. The picked sphere color changes to red, and its EdgeVisibity is On. The example subclasses vtkInteractorStyleTrackballCamera with a local class called MouseInteractorHighLightActor. The new interactor overrides the OnLeftButtonDown of vtkInteractorStyleTrackballCamera.

        Seealso

        HighlightWithSilhouette generates a silhouette of the picked actor.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Picking/HighlightPickedActor/#code","title":"Code","text":"

        HighlightPickedActor.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPropPicker.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// Handle mouse events\nclass MouseInteractorHighLightActor : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorHighLightActor* New();\n  vtkTypeMacro(MouseInteractorHighLightActor,\n               vtkInteractorStyleTrackballCamera);\n\n  MouseInteractorHighLightActor()\n  {\n    LastPickedActor = NULL;\n    LastPickedProperty = vtkProperty::New();\n  }\n  virtual ~MouseInteractorHighLightActor()\n  {\n    LastPickedProperty->Delete();\n  }\n  virtual void OnLeftButtonDown() override\n  {\n    vtkNew<vtkNamedColors> colors;\n\n    int* clickPos = this->GetInteractor()->GetEventPosition();\n\n    // Pick from this location.\n    vtkNew<vtkPropPicker> picker;\n    picker->Pick(clickPos[0], clickPos[1], 0, this->GetDefaultRenderer());\n\n    // If we picked something before, reset its property.\n    if (this->LastPickedActor)\n    {\n      this->LastPickedActor->GetProperty()->DeepCopy(this->LastPickedProperty);\n    }\n    this->LastPickedActor = picker->GetActor();\n    if (this->LastPickedActor)\n    {\n      // Save the property of the picked actor so that we can\n      // restore it next time.\n      this->LastPickedProperty->DeepCopy(this->LastPickedActor->GetProperty());\n      // Highlight the picked actor by changing its properties.\n      this->LastPickedActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"Red\").GetData());\n      this->LastPickedActor->GetProperty()->SetDiffuse(1.0);\n      this->LastPickedActor->GetProperty()->SetSpecular(0.0);\n      this->LastPickedActor->GetProperty()->EdgeVisibilityOn();\n    }\n\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n\nprivate:\n  vtkActor* LastPickedActor;\n  vtkProperty* LastPickedProperty;\n};\n\nvtkStandardNewMacro(MouseInteractorHighLightActor);\n} // namespace\n\n// Execute application.\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int numberOfSpheres = 10;\n  if (argc > 1)\n  {\n    numberOfSpheres = atoi(argv[1]);\n  }\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HighlightPickedActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Set the custom type to use for interaction.\n  vtkNew<MouseInteractorHighLightActor> style;\n  style->SetDefaultRenderer(renderer);\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  for (int i = 0; i < numberOfSpheres; ++i)\n  {\n    vtkNew<vtkSphereSource> source;\n    double x, y, z, radius;\n    // random position and radius\n    x = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    radius = randomSequence->GetRangeValue(0.5, 1.0);\n    randomSequence->Next();\n    source->SetRadius(radius);\n    source->SetCenter(x, y, z);\n    source->SetPhiResolution(11);\n    source->SetThetaResolution(21);\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(source->GetOutputPort());\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    double r, g, b;\n    r = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    g = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    b = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    actor->GetProperty()->SetDiffuseColor(r, g, b);\n    actor->GetProperty()->SetDiffuse(0.8);\n    actor->GetProperty()->SetSpecular(0.5);\n    actor->GetProperty()->SetSpecularColor(\n        colors->GetColor3d(\"White\").GetData());\n    actor->GetProperty()->SetSpecularPower(30.0);\n    renderer->AddActor(actor);\n  }\n\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Picking/HighlightPickedActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HighlightPickedActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HighlightPickedActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HighlightPickedActor MACOSX_BUNDLE HighlightPickedActor.cxx )\n  target_link_libraries(HighlightPickedActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HighlightPickedActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Picking/HighlightPickedActor/#download-and-build-highlightpickedactor","title":"Download and Build HighlightPickedActor","text":"

        Click here to download HighlightPickedActor and its CMakeLists.txt file. Once the tarball HighlightPickedActor.tar has been downloaded and extracted,

        cd HighlightPickedActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HighlightPickedActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Picking/HighlightSelectedPoints/","title":"HighlightSelectedPoints","text":"

        vtk-examples/Cxx/Picking/HighlightSelectedPoints

        "},{"location":"Cxx/Picking/HighlightSelectedPoints/#description","title":"Description","text":"

        This example demonstrates how to select and highlight points using a rubber band. Press 'r' to enter selection mode. Selected points are shown in red. The ids of the selected points are output.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Picking/HighlightSelectedPoints/#code","title":"Code","text":"

        HighlightSelectedPoints.cxx

        #include <vtkActor.h>\n#include <vtkAreaPicker.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkExtractGeometry.h>\n#include <vtkIdFilter.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkVersion.h>\n#include <vtkVertexGlyphFilter.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\nnamespace {\n// Define interaction style\nclass InteractorStyle : public vtkInteractorStyleRubberBandPick\n{\npublic:\n  static InteractorStyle* New();\n  vtkTypeMacro(InteractorStyle, vtkInteractorStyleRubberBandPick);\n\n  InteractorStyle()\n  {\n    this->SelectedMapper = vtkSmartPointer<vtkDataSetMapper>::New();\n    this->SelectedActor = vtkSmartPointer<vtkActor>::New();\n    this->SelectedActor->SetMapper(SelectedMapper);\n  }\n\n  virtual void OnLeftButtonUp() override\n  {\n    vtkNew<vtkNamedColors> colors;\n\n    // Forward events\n    vtkInteractorStyleRubberBandPick::OnLeftButtonUp();\n\n    vtkPlanes* frustum =\n        static_cast<vtkAreaPicker*>(this->GetInteractor()->GetPicker())\n            ->GetFrustum();\n\n    vtkNew<vtkExtractGeometry> extractGeometry;\n    extractGeometry->SetImplicitFunction(frustum);\n    extractGeometry->SetInputData(this->Points);\n    extractGeometry->Update();\n\n    vtkNew<vtkVertexGlyphFilter> glyphFilter;\n    glyphFilter->SetInputConnection(extractGeometry->GetOutputPort());\n    glyphFilter->Update();\n\n    vtkPolyData* selected = glyphFilter->GetOutput();\n    std::cout << \"Selected \" << selected->GetNumberOfPoints() << \" points.\"\n              << std::endl;\n    std::cout << \"Selected \" << selected->GetNumberOfCells() << \" cells.\"\n              << std::endl;\n    this->SelectedMapper->SetInputData(selected);\n    this->SelectedMapper->ScalarVisibilityOff();\n\n    vtkIdTypeArray* ids = dynamic_cast<vtkIdTypeArray*>(\n        selected->GetPointData()->GetArray(\"OriginalIds\"));\n    for (vtkIdType i = 0; i < ids->GetNumberOfTuples(); i++)\n    {\n      std::cout << \"Id \" << i << \" : \" << ids->GetValue(i) << std::endl;\n    }\n\n    this->SelectedActor->GetProperty()->SetColor(\n        colors->GetColor3d(\"Red\").GetData());\n    this->SelectedActor->GetProperty()->SetPointSize(5);\n\n    this->CurrentRenderer->AddActor(SelectedActor);\n    this->GetInteractor()->GetRenderWindow()->Render();\n    this->HighlightProp(NULL);\n  }\n\n  void SetPoints(vtkSmartPointer<vtkPolyData> points)\n  {\n    this->Points = points;\n  }\n\nprivate:\n  vtkSmartPointer<vtkPolyData> Points;\n  vtkSmartPointer<vtkActor> SelectedActor;\n  vtkSmartPointer<vtkDataSetMapper> SelectedMapper;\n};\n\nvtkStandardNewMacro(InteractorStyle);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(20);\n  pointSource->Update();\n\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputConnection(pointSource->GetOutputPort());\n#if VTK890\n  idFilter->SetCellIdsArrayName(\"OriginalIds\");\n  idFilter->SetPointIdsArrayName(\"OriginalIds\");\n#else\n  idFilter->SetIdsArrayName(\"OriginalIds\");\n#endif\n  idFilter->Update();\n\n  vtkNew<vtkDataSetSurfaceFilter> surfaceFilter;\n  surfaceFilter->SetInputConnection(idFilter->GetOutputPort());\n  surfaceFilter->Update();\n\n  vtkPolyData* input = surfaceFilter->GetOutput();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(input);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(3);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HighlightSelectedPoints\");\n\n  vtkNew<vtkAreaPicker> areaPicker;\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetPicker(areaPicker);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<InteractorStyle> style;\n  style->SetPoints(input);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Picking/HighlightSelectedPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HighlightSelectedPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersGeneral\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HighlightSelectedPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HighlightSelectedPoints MACOSX_BUNDLE HighlightSelectedPoints.cxx )\n  target_link_libraries(HighlightSelectedPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HighlightSelectedPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Picking/HighlightSelectedPoints/#download-and-build-highlightselectedpoints","title":"Download and Build HighlightSelectedPoints","text":"

        Click here to download HighlightSelectedPoints and its CMakeLists.txt file. Once the tarball HighlightSelectedPoints.tar has been downloaded and extracted,

        cd HighlightSelectedPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HighlightSelectedPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Picking/HighlightSelection/","title":"HighlightSelection","text":"

        vtk-examples/Cxx/Picking/HighlightSelection

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Picking/HighlightSelection/#description","title":"Description","text":"

        This example demonstrates how to select and highlight cells using vtkInteractorStyleRubberBandPick. Press 'r' to enter selection mode.

        vtkExtractPolyDataGeometry selects all cells within the selected area. The cells include those on the visible surface as well as those that exist within the view frustum returned by the interactor.

        The example accepts a geometry file as the first argument. Without an argument a vtkSphereSource will be used as the vtkPolyData.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Picking/HighlightSelection/#code","title":"Code","text":"

        HighlightSelection.cxx

        #include <vtkActor.h>\n#include <vtkAreaPicker.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkExtractPolyDataGeometry.h>\n#include <vtkIdFilter.h>\n#include <vtkInteractorStyleRubberBandPick.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#define VTKISRBP_ORIENT 0\n#define VTKISRBP_SELECT 1\n\nnamespace {\n// Define interaction style\nclass HighlightInteractorStyle : public vtkInteractorStyleRubberBandPick\n{\npublic:\n  static HighlightInteractorStyle* New();\n  vtkTypeMacro(HighlightInteractorStyle, vtkInteractorStyleRubberBandPick);\n\n  HighlightInteractorStyle() : vtkInteractorStyleRubberBandPick()\n  {\n    this->SelectedMapper = vtkSmartPointer<vtkDataSetMapper>::New();\n    this->SelectedActor = vtkSmartPointer<vtkActor>::New();\n    this->SelectedActor->SetMapper(SelectedMapper);\n  }\n\n  virtual void OnLeftButtonUp() override\n  {\n    // Forward events\n    vtkInteractorStyleRubberBandPick::OnLeftButtonUp();\n\n    if (this->CurrentMode == VTKISRBP_SELECT)\n    {\n      vtkNew<vtkNamedColors> colors;\n\n      vtkPlanes* frustum =\n          static_cast<vtkAreaPicker*>(this->GetInteractor()->GetPicker())\n              ->GetFrustum();\n\n      vtkNew<vtkExtractPolyDataGeometry> extractPolyDataGeometry;\n      extractPolyDataGeometry->SetInputData(this->PolyData);\n      extractPolyDataGeometry->SetImplicitFunction(frustum);\n      extractPolyDataGeometry->Update();\n\n      std::cout << \"Extracted \"\n                << extractPolyDataGeometry->GetOutput()->GetNumberOfCells()\n                << \" cells.\" << std::endl;\n      this->SelectedMapper->SetInputData(extractPolyDataGeometry->GetOutput());\n      this->SelectedMapper->ScalarVisibilityOff();\n\n      // vtkIdTypeArray* ids =\n      // dynamic_cast<vtkIdTypeArray*>(selected->GetPointData()->GetArray(\"OriginalIds\"));\n\n      this->SelectedActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"Tomato\").GetData());\n      this->SelectedActor->GetProperty()->SetPointSize(5);\n      this->SelectedActor->GetProperty()->SetRepresentationToWireframe();\n\n      this->GetInteractor()\n          ->GetRenderWindow()\n          ->GetRenderers()\n          ->GetFirstRenderer()\n          ->AddActor(SelectedActor);\n      this->GetInteractor()->GetRenderWindow()->Render();\n      this->HighlightProp(NULL);\n    }\n  }\n\n  void SetPolyData(vtkSmartPointer<vtkPolyData> polyData)\n  {\n    this->PolyData = polyData;\n  }\n\nprivate:\n  vtkSmartPointer<vtkPolyData> PolyData;\n  vtkSmartPointer<vtkActor> SelectedActor;\n  vtkSmartPointer<vtkDataSetMapper> SelectedMapper;\n};\nvtkStandardNewMacro(HighlightInteractorStyle);\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputData(polyData);\n#if VTK890\n  idFilter->SetCellIdsArrayName(\"OriginalIds\");\n  idFilter->SetPointIdsArrayName(\"OriginalIds\");\n#else\n  idFilter->SetIdsArrayName(\"OriginalIds\");\n#endif\n  idFilter->Update();\n\n  // This is needed to convert the ouput of vtkIdFilter (vtkDataSet) back to\n  // vtkPolyData.\n  vtkNew<vtkDataSetSurfaceFilter> surfaceFilter;\n  surfaceFilter->SetInputConnection(idFilter->GetOutputPort());\n  surfaceFilter->Update();\n\n  vtkPolyData* input = surfaceFilter->GetOutput();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(5);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"HighlightSelection\");\n\n  vtkNew<vtkAreaPicker> areaPicker;\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetPicker(areaPicker);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Tan\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<HighlightInteractorStyle> style;\n  style->SetPolyData(input);\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(21);\n    source->SetThetaResolution(40);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Picking/HighlightSelection/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HighlightSelection)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersGeometry\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HighlightSelection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HighlightSelection MACOSX_BUNDLE HighlightSelection.cxx )\n  target_link_libraries(HighlightSelection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HighlightSelection\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Picking/HighlightSelection/#download-and-build-highlightselection","title":"Download and Build HighlightSelection","text":"

        Click here to download HighlightSelection and its CMakeLists.txt file. Once the tarball HighlightSelection.tar has been downloaded and extracted,

        cd HighlightSelection/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HighlightSelection\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Picking/HighlightWithSilhouette/","title":"HighlightWithSilhouette","text":"

        vtk-examples/Cxx/Picking/HighlightWithSilhouette

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Picking/HighlightWithSilhouette/#description","title":"Description","text":"

        Click on a sphere to highlight it. vtkPolyDataSilhoutte creates a silhouette of the picked vtkActor. The example subclasses vtkInteractorStyleTrackballCamera with a local class called MouseInteractorHighLightActor. The new interactor overrides the OnLeftButtonDown of vtkInteractorStyleTrackballCamera.

        Watch this video showing the picking of several spheres.

        Seealso

        HighlightPickedActor C++ or Python where the color and edge visibility of the picked actor is changed.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Picking/HighlightWithSilhouette/#code","title":"Code","text":"

        HighlightWithSilhouette.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataSilhouette.h>\n#include <vtkPropPicker.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// Handle mouse events\nclass MouseInteractorHighLightActor : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MouseInteractorHighLightActor* New();\n  vtkTypeMacro(MouseInteractorHighLightActor,\n               vtkInteractorStyleTrackballCamera);\n\n  MouseInteractorHighLightActor()\n  {\n    LastPickedActor = nullptr;\n    SilhouetteActor = nullptr;\n    Silhouette = nullptr;\n  }\n  virtual ~MouseInteractorHighLightActor()\n  {\n  }\n  virtual void OnLeftButtonDown() override\n  {\n    int* clickPos = this->GetInteractor()->GetEventPosition();\n\n    // Pick from this location.\n    vtkNew<vtkPropPicker> picker;\n    picker->Pick(clickPos[0], clickPos[1], 0, this->GetDefaultRenderer());\n    this->LastPickedActor = picker->GetActor();\n\n    // If we picked something before, remove the silhouette actor and\n    // generate a new one\n    if (this->LastPickedActor)\n    {\n      this->GetDefaultRenderer()->RemoveActor(this->SilhouetteActor);\n\n      // Highlight the picked actor by generating a silouhette\n      this->Silhouette->SetInputData(\n          dynamic_cast<vtkPolyDataMapper*>(this->LastPickedActor->GetMapper())\n              ->GetInput());\n      this->GetDefaultRenderer()->AddActor(this->SilhouetteActor);\n    }\n\n    // Forward events\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n  void SetSilhouette(vtkPolyDataSilhouette* silhouette)\n  {\n    this->Silhouette = silhouette;\n  }\n  void SetSilhouetteActor(vtkActor* silhouetteActor)\n  {\n    this->SilhouetteActor = silhouetteActor;\n  }\n\nprivate:\n  vtkActor* LastPickedActor;\n  vtkActor* SilhouetteActor;\n  vtkPolyDataSilhouette* Silhouette;\n};\n\nvtkStandardNewMacro(MouseInteractorHighLightActor);\n} // namespace\n\n// Execute application.\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Bkg\", 0.3, 0.4, 0.5);\n\n  int numberOfSpheres = 10;\n  if (argc > 1)\n  {\n    numberOfSpheres = atoi(argv[1]);\n  }\n  // Create a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HighlightWithSilhouette\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  for (int i = 0; i < numberOfSpheres; ++i)\n  {\n    vtkNew<vtkSphereSource> source;\n    double x, y, z, radius;\n    // random position and radius\n    x = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-5.0, 5.0);\n    randomSequence->Next();\n    radius = randomSequence->GetRangeValue(0.5, 1.0);\n    randomSequence->Next();\n    source->SetRadius(radius);\n    source->SetCenter(x, y, z);\n    source->SetPhiResolution(11);\n    source->SetThetaResolution(21);\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(source->GetOutputPort());\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    double r, g, b;\n    r = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    g = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    b = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    actor->GetProperty()->SetDiffuseColor(r, g, b);\n    actor->GetProperty()->SetDiffuse(0.8);\n    actor->GetProperty()->SetSpecular(0.5);\n    actor->GetProperty()->SetSpecularColor(\n        colors->GetColor3d(\"White\").GetData());\n    actor->GetProperty()->SetSpecularPower(30.0);\n    renderer->AddActor(actor);\n  }\n\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n\n  // Create the silhouette pipeline, the input data will be set in the\n  // interactor\n  vtkNew<vtkPolyDataSilhouette> silhouette;\n  silhouette->SetCamera(renderer->GetActiveCamera());\n\n  // Create mapper and actor for silhouette\n  vtkNew<vtkPolyDataMapper> silhouetteMapper;\n  silhouetteMapper->SetInputConnection(silhouette->GetOutputPort());\n\n  vtkNew<vtkActor> silhouetteActor;\n  silhouetteActor->SetMapper(silhouetteMapper);\n  silhouetteActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  silhouetteActor->GetProperty()->SetLineWidth(5);\n\n  // Set the custom type to use for interaction.\n  vtkNew<MouseInteractorHighLightActor> style;\n  style->SetDefaultRenderer(renderer);\n  style->SetSilhouetteActor(silhouetteActor);\n  style->SetSilhouette(silhouette);\n\n  interactor->SetInteractorStyle(style);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Picking/HighlightWithSilhouette/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HighlightWithSilhouette)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersHybrid\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HighlightWithSilhouette: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HighlightWithSilhouette MACOSX_BUNDLE HighlightWithSilhouette.cxx )\n  target_link_libraries(HighlightWithSilhouette PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HighlightWithSilhouette\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Picking/HighlightWithSilhouette/#download-and-build-highlightwithsilhouette","title":"Download and Build HighlightWithSilhouette","text":"

        Click here to download HighlightWithSilhouette and its CMakeLists.txt file. Once the tarball HighlightWithSilhouette.tar has been downloaded and extracted,

        cd HighlightWithSilhouette/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HighlightWithSilhouette\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/AreaPlot/","title":"AreaPlot","text":"

        vtk-examples/Cxx/Plotting/AreaPlot

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/AreaPlot/#description","title":"Description","text":"

        This example illustrates vtkPlotArea, which draws a filled region between two curves. The example uses a valid mask to select the values to define the region to be plotted.

        The example also shows how to control the size and colors of the plot's components.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/AreaPlot/#code","title":"Code","text":"

        AreaPlot.cxx

        #include <vtkAxis.h>\n#include <vtkBrush.h>\n#include <vtkCharArray.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotArea.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkTextProperty.h>\n#include <vtkVersion.h>\n\n#include <algorithm>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetRenderWindow()->SetWindowName(\"AreaPlot\");\n\n  vtkNew<vtkChartXY> chart;\n  chart->SetTitle(\"Area Plot\");\n  chart->GetTitleProperties()->SetFontSize(36);\n  chart->GetTitleProperties()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  chart->GetAxis(0)->GetTitleProperties()->SetFontSize(24);\n  chart->GetAxis(0)->GetTitleProperties()->SetColor(\n      colors->GetColor3d(\"orange\").GetData());\n  chart->GetAxis(0)->GetLabelProperties()->SetColor(\n      colors->GetColor3d(\"beige\").GetData());\n  chart->GetAxis(0)->GetLabelProperties()->SetFontSize(18);\n\n  chart->GetAxis(1)->GetTitleProperties()->SetFontSize(24);\n  chart->GetAxis(1)->GetTitleProperties()->SetColor(\n      colors->GetColor3d(\"orange\").GetData());\n  chart->GetAxis(1)->GetLabelProperties()->SetColor(\n      colors->GetColor3d(\"beige\").GetData());\n  chart->GetAxis(1)->GetLabelProperties()->SetFontSize(18);\n\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  vtkNew<vtkFloatArray> arrS2;\n  arrS2->SetName(\"Sine2\");\n  table->AddColumn(arrS2);\n\n  vtkNew<vtkFloatArray> arrS3;\n  arrS3->SetName(\"Sine3\");\n  table->AddColumn(arrS3);\n\n  vtkNew<vtkFloatArray> arr1;\n  arr1->SetName(\"One\");\n  table->AddColumn(arr1);\n\n  vtkNew<vtkCharArray> validMask;\n  validMask->SetName(\"ValidMask\");\n  table->AddColumn(validMask);\n\n  // Test charting with a few more points...\n  int numPoints = 69;\n  float inc = 7.5 / (numPoints - 1);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc + 0.01);\n    table->SetValue(i, 1, cos(i * inc) + 0.01);\n    table->SetValue(i, 2, sin(i * inc) + 0.01);\n    table->SetValue(i, 3, sin(i * inc) + 0.5);\n    table->SetValue(i, 4, sin(i * inc) * sin(i * inc) + 0.01);\n    table->SetValue(i, 5, 1.0);\n\n    validMask->SetValue(i, (i > 30 && i < 40) ? 0 : 1);\n  }\n\n  // Add multiple line plots, setting the colors etc.\n  vtkColor3d color3d = colors->GetColor3d(\"tomato\");\n  vtkPlotArea* area =\n      dynamic_cast<vtkPlotArea*>(chart->AddPlot(vtkChart::AREA));\n  area->SetInputData(table);\n  area->SetInputArray(0, \"X Axis\");\n  area->SetInputArray(1, \"Sine\");\n  area->SetInputArray(2, \"Sine2\");\n  area->SetValidPointMaskName(\"ValidMask\");\n#if VTK_HAS_SETCOLORF\n  area->GetBrush()->SetColorF(color3d.GetRed(), color3d.GetGreen(),\n                              color3d.GetBlue(), 0.6);\n#else\n  area->GetBrush()->SetColor(color3d.GetRed(), color3d.GetGreen(),\n                             color3d.GetBlue(), 0.6);\n#endif\n\n  chart->GetAxis(vtkAxis::LEFT)->SetLogScale(true);\n\n  // Render the scene and compare the image to a reference image.\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/AreaPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AreaPlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AreaPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AreaPlot MACOSX_BUNDLE AreaPlot.cxx )\n  target_link_libraries(AreaPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AreaPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/AreaPlot/#download-and-build-areaplot","title":"Download and Build AreaPlot","text":"

        Click here to download AreaPlot and its CMakeLists.txt file. Once the tarball AreaPlot.tar has been downloaded and extracted,

        cd AreaPlot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AreaPlot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/BarChart/","title":"BarChart","text":"

        vtk-examples/Cxx/Plotting/BarChart

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/BarChart/#description","title":"Description","text":"

        This example shows how to create a Bar Chart.

        Also see the BarChartQt example.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/BarChart/#code","title":"Code","text":"

        BarChart.cxx

        #include <vtkAxis.h>\n#include <vtkChartXY.h>\n#include <vtkColorSeries.h>\n#include <vtkContextView.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkTextProperty.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n// Monthly circulation data\nstatic int data_2008[] = {10822, 10941, 9979,  10370, 9460, 11228,\n                          15093, 12231, 10160, 9816,  9384, 7892};\nstatic int data_2009[] = {9058,  9474,  9979,  9408, 8900, 11569,\n                          14688, 12231, 10294, 9585, 8957, 8590};\nstatic int data_2010[] = {9058,  10941, 9979,  10270, 8900, 11228,\n                          14688, 12231, 10160, 9585,  9384, 8590};\n\nint main(int, char*[])\n{\n  // Colors\n  vtkNew<vtkColorSeries> colorSeries;\n  // colorSeries->SetColorScheme(\n  //    vtkColorSeries::BREWER_SEQUENTIAL_YELLOW_ORANGE_BROWN_3);\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_DIVERGING_SPECTRAL_3);\n  // colorSeries->SetColorScheme(vtkColorSeries::BREWER_DIVERGING_PURPLE_ORANGE_3);\n  // colorSeries->SetColorScheme(\n  //    vtkColorSeries::BREWER_DIVERGING_BROWN_BLUE_GREEN_3);\n  // colorSeries->SetColorScheme(vtkColorSeries::BREWER_SEQUENTIAL_BLUE_GREEN_3);\n  // colorSeries->SetColorScheme(vtkColorSeries::BREWER_SEQUENTIAL_BLUE_PURPLE_3);\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Seashell\");\n  vtkColor3d axisColor = colors->GetColor3d(\"Black\");\n  vtkColor3d titleColor = colors->GetColor3d(\"MidnightBlue\");\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(backgroundColor.GetData());\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetRenderWindow()->SetWindowName(\"BarChart\");\n\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Set various properties.\n  vtkAxis* xAxis = chart->GetAxis(vtkAxis::BOTTOM);\n  xAxis->SetTitle(\"Monthly\");\n  xAxis->GetTitleProperties()->SetColor(axisColor.GetData());\n  xAxis->GetTitleProperties()->SetFontSize(16);\n  xAxis->GetTitleProperties()->ItalicOn();\n  xAxis->GetLabelProperties()->SetColor(axisColor.GetData());\n  xAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"Black\"));\n\n  vtkAxis* yAxis = chart->GetAxis(vtkAxis::LEFT);\n  yAxis->SetTitle(\"Circulation\");\n  yAxis->GetTitleProperties()->SetColor(axisColor.GetData());\n  yAxis->GetTitleProperties()->SetFontSize(16);\n  yAxis->GetTitleProperties()->ItalicOn();\n  yAxis->GetLabelProperties()->SetColor(axisColor.GetData());\n  yAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"Black\"));\n\n  chart->SetTitle(\"Circulation 2008, 2009, 2010\");\n  chart->GetTitleProperties()->SetFontSize(24);\n  chart->GetTitleProperties()->SetColor(titleColor.GetData());\n  chart->GetTitleProperties()->BoldOn();\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkIntArray> arrMonth;\n  arrMonth->SetName(\"Month\");\n  table->AddColumn(arrMonth);\n\n  vtkNew<vtkIntArray> arr2008;\n  arr2008->SetName(\"2008\");\n  table->AddColumn(arr2008);\n\n  vtkNew<vtkIntArray> arr2009;\n  arr2009->SetName(\"2009\");\n  table->AddColumn(arr2009);\n\n  vtkNew<vtkIntArray> arr2010;\n  arr2010->SetName(\"2010\");\n  table->AddColumn(arr2010);\n\n  table->SetNumberOfRows(12);\n  for (int i = 0; i < 12; i++)\n  {\n    table->SetValue(i, 0, i + 1);\n    table->SetValue(i, 1, data_2008[i]);\n    table->SetValue(i, 2, data_2009[i]);\n    table->SetValue(i, 3, data_2010[i]);\n  }\n\n  // Add multiple line plots, setting the colors etc.\n#if VTK_HAS_SETCOLORF\n  vtkPlot* line = 0;\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColorF(colorSeries->GetColor(0).GetRed() / 255.0,\n                  colorSeries->GetColor(0).GetGreen() / 255.0,\n                  colorSeries->GetColor(0).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 1);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColorF(colorSeries->GetColor(1).GetRed() / 255.0,\n                  colorSeries->GetColor(1).GetGreen() / 255.0,\n                  colorSeries->GetColor(1).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 2);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColorF(colorSeries->GetColor(2).GetRed() / 255.0,\n                  colorSeries->GetColor(2).GetGreen() / 255.0,\n                  colorSeries->GetColor(2).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 3);\n#else\n  vtkPlot* line = 0;\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColor(colorSeries->GetColor(0).GetRed() / 255.0,\n                 colorSeries->GetColor(0).GetGreen() / 255.0,\n                 colorSeries->GetColor(0).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 1);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColor(colorSeries->GetColor(1).GetRed() / 255.0,\n                 colorSeries->GetColor(1).GetGreen() / 255.0,\n                 colorSeries->GetColor(1).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 2);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetColor(colorSeries->GetColor(2).GetRed() / 255.0,\n                 colorSeries->GetColor(2).GetGreen() / 255.0,\n                 colorSeries->GetColor(2).GetBlue() / 255.0);\n  line->SetInputData(table, 0, 3);\n#endif\n\n  // Finally render the scene and compare the image to a reference image.\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/BarChart/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BarChart)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BarChart: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BarChart MACOSX_BUNDLE BarChart.cxx )\n  target_link_libraries(BarChart PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BarChart\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/BarChart/#download-and-build-barchart","title":"Download and Build BarChart","text":"

        Click here to download BarChart and its CMakeLists.txt file. Once the tarball BarChart.tar has been downloaded and extracted,

        cd BarChart/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BarChart\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/BoxChart/","title":"BoxChart","text":"

        vtk-examples/Cxx/Plotting/BoxChart

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/BoxChart/#description","title":"Description","text":"

        This example demonstrates how to generate a box plot.

        The example uses data from the Michelson Morley experiment. Compare the wiki example output with the Wikipedia results

        Warning

        The ChartBox expects an input table with exactly 5 rows per column. The 5 rows are minimum, 1st quartile, median, 3rd quartile and maximum. vtkComputeQuartiles is used to create a valid input table from the original data.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/BoxChart/#code","title":"Code","text":"

        BoxChart.cxx

        #include <vtkAxis.h>\n#include <vtkChartBox.h>\n#include <vtkComputeQuartiles.h>\n#include <vtkContextView.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNew.h>\n#include <vtkPlotBox.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStatisticsAlgorithm.h>\n#include <vtkStringArray.h>\n#include <vtkTable.h>\n#include <vtkTextProperty.h>\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(400, 400);\n  view->GetRenderWindow()->SetMultiSamples(0);\n\n  vtkNew<vtkChartBox> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Creates a vtkPlotBox input table.\n  int numParam = 5;\n  vtkNew<vtkTable> inputBoxPlotTable;\n\n  for (int i = 0; i < numParam; i++)\n  {\n    char num[10];\n    sprintf(num, \"Run %d\", i + 1);\n    vtkNew<vtkIntArray> arrIndex;\n    arrIndex->SetName(num);\n    inputBoxPlotTable->AddColumn(arrIndex);\n  }\n\n  inputBoxPlotTable->SetNumberOfRows(20);\n  double values[20][5] = {\n      {850, 960, 880, 890, 890},  {740, 940, 880, 810, 840},\n      {900, 960, 880, 810, 780},  {1070, 940, 860, 820, 810},\n      {930, 880, 720, 800, 760},  {850, 800, 720, 770, 810},\n      {950, 850, 620, 760, 790},  {980, 880, 860, 740, 810},\n      {980, 900, 970, 750, 820},  {880, 840, 950, 760, 850},\n      {1000, 830, 880, 910, 870}, {980, 790, 910, 920, 870},\n      {930, 810, 850, 890, 810},  {650, 880, 870, 860, 740},\n      {760, 880, 840, 880, 810},  {810, 830, 840, 720, 940},\n      {1000, 800, 850, 840, 950}, {1000, 790, 840, 850, 800},\n      {960, 760, 840, 850, 810},  {960, 800, 840, 780, 870}};\n  for (int j = 0; j < 20; ++j)\n  {\n    for (int i = 0; i < 5; ++i)\n    {\n      inputBoxPlotTable->SetValue(j, i, values[j][i]);\n    }\n  }\n  vtkNew<vtkComputeQuartiles> quartiles;\n  quartiles->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA,\n                          inputBoxPlotTable);\n  quartiles->Update();\n\n  vtkTable* outTable = quartiles->GetOutput();\n  vtkNew<vtkLookupTable> lookup;\n  lookup->SetNumberOfColors(5);\n  lookup->SetRange(0, 4);\n  lookup->Build();\n\n  chart->GetPlot(0)->SetInputData(outTable);\n  chart->SetShowLegend(true);\n  chart->SetColumnVisibilityAll(true);\n  chart->SetTitle(\"Michelson-Morley experiment\");\n  chart->GetTitleProperties()->SetFontSize(16);\n  chart->GetYAxis()->SetTitle(\"Speed of Light (km/s - 299000)\");\n\n  // Set the labels.\n  vtkNew<vtkStringArray> labels;\n  labels->SetNumberOfValues(5);\n  labels->SetValue(0, \"Run 1\");\n  labels->SetValue(1, \"Run 2\");\n  labels->SetValue(2, \"Run 3\");\n  labels->SetValue(3, \"Run 4\");\n  labels->SetValue(4, \"Run 5\");\n  chart->GetPlot(0)->SetLabels(labels);\n\n  // Render the scene.\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderer()->SetBackground(.8, .8, .8);\n  view->GetInteractor()->Initialize();\n  view->Render();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/BoxChart/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoxChart)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonCore\n  CommonDataModel\n  FiltersStatistics\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoxChart: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoxChart MACOSX_BUNDLE BoxChart.cxx )\n  target_link_libraries(BoxChart PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoxChart\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/BoxChart/#download-and-build-boxchart","title":"Download and Build BoxChart","text":"

        Click here to download BoxChart and its CMakeLists.txt file. Once the tarball BoxChart.tar has been downloaded and extracted,

        cd BoxChart/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BoxChart\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/ChartMatrix/","title":"ChartMatrix","text":"

        vtk-examples/Cxx/Plotting/ChartMatrix

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/ChartMatrix/#description","title":"Description","text":"

        This example illustrates the use vtkChartMatrix, a container that holds a matrix of charts. The example creates a 2 x 2 matrix of plots. The matrix elements are:

        • (0,0): a vtkPlotPoints
        • (0,1): a vtkPlotPoints
        • (1,0): a vtkPlotLine
        • (1,1): a vtkPlotBar and a vtkPlotPoints

        The example also illustrates how to use vtkNamedColors to set the colors for the plots.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/ChartMatrix/#code","title":"Code","text":"

        ChartMatrix.cxx

        #include <vtkAxis.h>\n#include <vtkChartMatrix.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkPlotPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(1280, 1024);\n  view->GetRenderWindow()->SetWindowName(\"ChartMatrix\");\n\n  vtkNew<vtkChartMatrix> matrix;\n  view->GetScene()->AddItem(matrix);\n  matrix->SetSize(vtkVector2i(2, 2));\n  matrix->SetGutter(vtkVector2f(30.0, 30.0));\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n  vtkNew<vtkFloatArray> arrX;\n\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  vtkNew<vtkFloatArray> arrS2;\n  arrS2->SetName(\"Sine2\");\n  table->AddColumn(arrS2);\n\n  vtkNew<vtkFloatArray> tangent;\n  tangent->SetName(\"Tangent\");\n  table->AddColumn(tangent);\n\n  int numPoints = 42;\n  float inc = 7.5 / (numPoints - 1);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc);\n    table->SetValue(i, 1, cos(i * inc));\n    table->SetValue(i, 2, sin(i * inc));\n    table->SetValue(i, 3, sin(i * inc) + 0.5);\n    table->SetValue(i, 4, tan(i * inc));\n  }\n\n  // Add multiple line plots, setting the colors etc\n  // lower left plot, a point chart\n  vtkChart* chart = matrix->GetChart(vtkVector2i(0, 0));\n  vtkPlot* plot = chart->AddPlot(vtkChart::POINTS);\n  plot->SetInputData(table, 0, 1);\n  dynamic_cast<vtkPlotPoints*>(plot)->SetMarkerStyle(vtkPlotPoints::DIAMOND);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"sea_green\").GetRed(),\n                 colors->GetColor3ub(\"sea_green\").GetGreen(),\n                 colors->GetColor3ub(\"sea_green\").GetBlue(), 255);\n\n  // upper left plot, a point chart\n  chart = matrix->GetChart(vtkVector2i(0, 1));\n  plot = chart->AddPlot(vtkChart::POINTS);\n  plot->SetInputData(table, 0, 2);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"rose_madder\").GetRed(),\n                 colors->GetColor3ub(\"rose_madder\").GetGreen(),\n                 colors->GetColor3ub(\"rose_madder\").GetBlue(), 255);\n\n  //\n  chart = matrix->GetChart(vtkVector2i(1, 0));\n  plot = chart->AddPlot(vtkChart::LINE);\n  plot->SetInputData(table, 0, 3);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"dark_orange\").GetRed(),\n                 colors->GetColor3ub(\"dark_orange\").GetGreen(),\n                 colors->GetColor3ub(\"dark_orange\").GetBlue(), 255);\n\n  // upper right plot, a bar and point chart\n  chart = matrix->GetChart(vtkVector2i(1, 1));\n  plot = chart->AddPlot(vtkChart::BAR);\n  plot->SetInputData(table, 0, 4);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"burnt_sienna\").GetRed(),\n                 colors->GetColor3ub(\"burnt_sienna\").GetGreen(),\n                 colors->GetColor3ub(\"burnt_sienna\").GetBlue(), 255);\n\n  plot = chart->AddPlot(vtkChart::POINTS);\n  plot->SetInputData(table, 0, 1);\n  dynamic_cast<vtkPlotPoints*>(plot)->SetMarkerStyle(vtkPlotPoints::CROSS);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"rose_madder\").GetRed(),\n                 colors->GetColor3ub(\"rose_madder\").GetGreen(),\n                 colors->GetColor3ub(\"rose_madder\").GetBlue(), 255);\n\n  // Lower right plot, a line chart\n\n  chart = matrix->GetChart(vtkVector2i(1, 0));\n  plot = chart->AddPlot(vtkChart::LINE);\n  plot->SetInputData(table, 0, 3);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"dark_orange\").GetRed(),\n                 colors->GetColor3ub(\"dark_orange\").GetGreen(),\n                 colors->GetColor3ub(\"dark_orange\").GetBlue(), 255);\n\n  plot = chart->AddPlot(vtkChart::LINE);\n  plot->SetInputData(table, 0, 3);\n#if VTK_HAS_SETCOLORF\n  plot->GetXAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColorF(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#else\n  plot->GetXAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n  plot->GetYAxis()->GetGridPen()->SetColor(\n      colors->GetColor3d(\"warm_grey\").GetData());\n#endif\n  plot->SetColor(colors->GetColor3ub(\"royal_blue\").GetRed(),\n                 colors->GetColor3ub(\"royal_blue\").GetGreen(),\n                 colors->GetColor3ub(\"royal_blue\").GetBlue(), 255);\n\n  // Finally render the scene and compare the image to a reference image\n  view->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"navajo_white\").GetData());\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/ChartMatrix/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ChartMatrix)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ChartMatrix: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ChartMatrix MACOSX_BUNDLE ChartMatrix.cxx )\n  target_link_libraries(ChartMatrix PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ChartMatrix\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/ChartMatrix/#download-and-build-chartmatrix","title":"Download and Build ChartMatrix","text":"

        Click here to download ChartMatrix and its CMakeLists.txt file. Once the tarball ChartMatrix.tar has been downloaded and extracted,

        cd ChartMatrix/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ChartMatrix\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/ChartsOn3DScene/","title":"ChartsOn3DScene","text":"

        vtk-examples/Cxx/Plotting/ChartsOn3DScene

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/ChartsOn3DScene/#description","title":"Description","text":"

        This example illustrates how to combine a 3D scene with a vtkChartXY.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/ChartsOn3DScene/#code","title":"Code","text":"

        ChartsOn3DScene.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkChartXY.h>\n#include <vtkContextActor.h>\n#include <vtkContextScene.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->SetMultiSamples(4);\n  renwin->SetSize(640, 480);\n  renwin->SetWindowName(\"ChartsOn3DScene\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor4d(\"seagreen\").GetData());\n  renwin->AddRenderer(renderer);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->SetPosition(1.0, 1.0, -4.0);\n  renderer->GetActiveCamera()->Azimuth(40);\n\n  // Cube Source 1\n  vtkNew<vtkCubeSource> cube;\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cube->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor4d(\"peacock\").GetData());\n  renderer->AddActor(cubeActor);\n  cubeActor->GetProperty()->SetRepresentationToSurface();\n\n  // Now the chart,\n  vtkNew<vtkChartXY> chart;\n  vtkNew<vtkContextScene> chartScene;\n  vtkNew<vtkContextActor> chartActor;\n\n  chart->SetAutoSize(false);\n  chart->SetSize(vtkRectf(0.0, 0.0, 320, 220));\n\n  chartScene->AddItem(chart);\n  chartActor->SetScene(chartScene);\n\n  // Both needed.\n  renderer->AddActor(chartActor);\n  chartScene->SetRenderer(renderer);\n\n  // Create a table with some points in it.\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  vtkNew<vtkFloatArray> arrT;\n  arrT->SetName(\"Tan\");\n  table->AddColumn(arrT);\n\n  // Test charting with a few more points...\n  int numPoints = 69;\n  float inc = 7.5 / (numPoints - 1.0);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc);\n    table->SetValue(i, 1, cos(i * inc) + 0.0);\n    table->SetValue(i, 2, sin(i * inc) + 0.0);\n    table->SetValue(i, 3, tan(i * inc) + 0.5);\n  }\n\n  // Add multiple line plots, setting the colors etc.\n  vtkColor3d color3d = colors->GetColor3d(\"banana\");\n\n  vtkPlot* points = chart->AddPlot(vtkChart::POINTS);\n#if VTK_HAS_SETCOLORF\n  points->SetInputData(table, 0, 1);\n  points->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::CROSS);\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 2);\n  points->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::PLUS);\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 3);\n  points->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n#else\n  points->SetInputData(table, 0, 1);\n  points->SetColor(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::CROSS);\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 2);\n  points->SetColor(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::PLUS);\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 3);\n  points->SetColor(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n  points->SetWidth(1.0);\n#endif\n  renwin->SetMultiSamples(0);\n  renwin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/ChartsOn3DScene/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ChartsOn3DScene)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ChartsOn3DScene: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ChartsOn3DScene MACOSX_BUNDLE ChartsOn3DScene.cxx )\n  target_link_libraries(ChartsOn3DScene PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ChartsOn3DScene\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/ChartsOn3DScene/#download-and-build-chartson3dscene","title":"Download and Build ChartsOn3DScene","text":"

        Click here to download ChartsOn3DScene and its CMakeLists.txt file. Once the tarball ChartsOn3DScene.tar has been downloaded and extracted,

        cd ChartsOn3DScene/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ChartsOn3DScene\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/CompareRandomGeneratorsCxx/","title":"CompareRandomGeneratorsCxx","text":"

        vtk-examples/Cxx/Plotting/CompareRandomGeneratorsCxx

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/CompareRandomGeneratorsCxx/#description","title":"Description","text":"

        This example demonstrates 6 random number generators offered by c++11. These are now part of the C++ standard. They offer a different API and more generators than presented the vtk generators vtkMinimalStandardRandomSequence, vtkBoxMuellerRandomSequence, vtkGaussianRandomSequence and vtkMersenneTwister.

        The vtkRandomSequence generators are used internally by vtk classes, but application developers may prefer to use the C++ standard generators.

        The c++ standard random number collections is described here.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/CompareRandomGeneratorsCxx/#code","title":"Code","text":"

        CompareRandomGeneratorsCxx.cxx

        #include <vtkActor2D.h>\n#include <vtkBarChartActor.h>\n#include <vtkDataObject.h>\n#include <vtkFieldData.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <algorithm>\n#include <map>\n#include <random>\n#include <vector>\n\nnamespace {\nvtkSmartPointer<vtkIntArray> CreateUniformDistribution(int, double, double);\nvtkSmartPointer<vtkIntArray> CreateNormalDistribution(int, double, double);\nvtkSmartPointer<vtkIntArray> CreateWeibullDistribution(int, double, double);\nvtkSmartPointer<vtkIntArray> CreateGammaDistribution(int, double, double);\nvtkSmartPointer<vtkIntArray> CreateCauchyDistribution(int, double, double);\nvtkSmartPointer<vtkIntArray> CreateExtremeValueDistribution(int, double,\n                                                            double);\n} // namespace\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  int count = 100000;\n  std::map<std::string, vtkSmartPointer<vtkIntArray>> frequencies;\n  frequencies[\"Uniform Distribution\"] =\n      CreateUniformDistribution(count, -200.0, 200.0);\n  frequencies[\"Normal Distribution\"] =\n      CreateNormalDistribution(count, 0.0, 6.0);\n  frequencies[\"Weibull Distribution\"] =\n      CreateWeibullDistribution(count, 1.5, 1.0);\n  frequencies[\"Gamma Distribution\"] = CreateGammaDistribution(count, 2.0, 2.0);\n  frequencies[\"Cauchy Distribution\"] =\n      CreateCauchyDistribution(count, -1.0, 2.0);\n  frequencies[\"Extreme Value Distribution\"] =\n      CreateExtremeValueDistribution(count, .5, 1.0);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  for (auto fit = frequencies.begin(); fit != frequencies.end(); fit++)\n  {\n    vtkNew<vtkBarChartActor> chart;\n\n    vtkNew<vtkDataObject> dataObject;\n    dataObject->GetFieldData()->AddArray(fit->second);\n\n    chart->SetInput(dataObject);\n    chart->SetTitle(fit->first.c_str());\n    chart->GetPositionCoordinate()->SetValue(0.05, 0.05, 0.0);\n    chart->GetPosition2Coordinate()->SetValue(0.95, 0.85, 0.0);\n    chart->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n    chart->LegendVisibilityOff();\n    chart->LabelVisibilityOff();\n    chart->TitleVisibilityOff();\n    for (int c = 0; c < count; ++c)\n    {\n      chart->SetBarColor(c, colors->GetColor3d(\"MidnightBlue\").GetData());\n    }\n    // Create a title.\n    vtkNew<vtkTextProperty> titleProperty;\n    titleProperty->SetFontSize(16);\n    titleProperty->SetJustificationToCentered();\n\n    vtkNew<vtkTextMapper> titleMapper;\n    titleMapper->SetInput(fit->first.c_str());\n    titleMapper->SetTextProperty(titleProperty);\n\n    vtkNew<vtkActor2D> titleActor;\n    titleActor->SetMapper(titleMapper);\n    titleActor->GetPositionCoordinate()\n        ->SetCoordinateSystemToNormalizedViewport();\n    titleActor->GetPositionCoordinate()->SetValue(.5, .85, 0.0);\n    titleActor->GetProperty()->SetColor(\n        colors->GetColor3d(\"MidnightBlue\").GetData());\n\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(chart);\n    renderer->AddActor(titleActor);\n    renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n  }\n\n  // Setup a grid of renderers.\n  int gridCols = 3;\n  int gridRows = 2;\n\n  // Define side length (in pixels) of each renderer square.\n  int rendererSize = 300;\n\n  renderWindow->SetWindowName(\"CompareRandomGeneratorsCxx\");\n  renderWindow->SetSize(rendererSize * gridCols, rendererSize * gridRows);\n\n  // Set up a grid of viewports for each renderer.\n  int r = 0;\n  for (auto row = 0; row < gridRows; row++)\n  {\n    for (auto col = 0; col < gridCols; col++)\n    {\n      // auto index = row * gridCols + col;\n\n      // Set the renderer's viewport dimensions (xmin, ymin, xmax, ymax) within\n      // the render window. Note that for the Y values, we need to subtract the\n      // row index from gridRows because the viewport Y axis points upwards, but\n      // we want to draw the grid from top to down.\n      double viewport[4] = {static_cast<double>(col) / gridCols,\n                            static_cast<double>(gridRows - row - 1) / gridRows,\n                            static_cast<double>(col + 1) / gridCols,\n                            static_cast<double>(gridRows - row) / gridRows};\n      renderers[r]->SetViewport(viewport);\n      ++r;\n    }\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  // Initialize the event loop and then start it.\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkIntArray> CreateUniformDistribution(int count, double a,\n                                                       double b)\n{\n  std::mt19937 generator(8775070);\n  double rmin, rmax;\n  rmax = b;\n  rmin = a;\n  std::uniform_real_distribution<double> distribution(a, b);\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[numberOfBins - 1] = 0;\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\n\nvtkSmartPointer<vtkIntArray> CreateNormalDistribution(int count, double a,\n                                                      double b)\n{\n  double rmin, rmax;\n  std::mt19937 generator(8775070);\n  std::normal_distribution<double> distribution(a, b);\n  rmax = 6.0 * b;\n  rmin = -6.0 * b;\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[numberOfBins - 1] = 0;\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\nvtkSmartPointer<vtkIntArray> CreateWeibullDistribution(int count, double a,\n                                                       double b)\n{\n  double rmin, rmax;\n  std::mt19937 generator(8775070);\n  std::weibull_distribution<double> distribution(a, b);\n  rmax = 3.0;\n  rmin = 0.0;\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[numberOfBins - 1] = 0;\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\nvtkSmartPointer<vtkIntArray> CreateGammaDistribution(int count, double a,\n                                                     double b)\n{\n  double rmin, rmax;\n  std::mt19937 generator(8775070);\n  std::gamma_distribution<double> distribution(a, b);\n  rmax = 20.0;\n  rmin = 0.0;\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[numberOfBins - 1] = 0;\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\n\nvtkSmartPointer<vtkIntArray> CreateCauchyDistribution(int count, double a,\n                                                      double b)\n{\n  double rmin, rmax;\n  std::mt19937 generator(8775070);\n  std::cauchy_distribution<double> distribution(a, b);\n\n  rmin = -10;\n  rmax = 15.0;\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[0] = frequencies[1];\n  frequencies[numberOfBins - 1] = frequencies[numberOfBins - 2];\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\nvtkSmartPointer<vtkIntArray> CreateExtremeValueDistribution(int count, double a,\n                                                            double b)\n{\n  double rmin, rmax;\n  std::mt19937 generator(8775070);\n\n  std::extreme_value_distribution<double> distribution(a, b);\n  rmax = 5.0;\n  rmin = -2.0;\n\n  double range = (rmax - rmin);\n  int numberOfBins = std::max(51, (int)std::ceil(range / 10));\n\n  std::vector<int> frequencies(numberOfBins, 0);\n  for (int i = 0; i < count; ++i)\n  {\n    double value = (distribution(generator) - rmin) / range;\n    int bin = (int)(std::floor((numberOfBins)*value));\n    if (bin > numberOfBins - 1)\n    {\n      bin = numberOfBins - 1;\n    }\n    else if (bin < 0)\n    {\n      bin = 0;\n    }\n    ++frequencies[bin];\n  }\n  frequencies[numberOfBins - 1] = 0;\n\n  vtkNew<vtkIntArray> frequenciesArray;\n  frequenciesArray->SetNumberOfComponents(1);\n  frequenciesArray->SetNumberOfTuples(numberOfBins);\n\n  for (int i = 0; i < numberOfBins; ++i)\n  {\n    frequenciesArray->SetTypedTuple(i, &frequencies[i]);\n  }\n  frequenciesArray->SetName(\"frequencies\");\n\n  return frequenciesArray;\n}\n} // namespace\n
        "},{"location":"Cxx/Plotting/CompareRandomGeneratorsCxx/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CompareRandomGeneratorsCxx)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CompareRandomGeneratorsCxx: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CompareRandomGeneratorsCxx MACOSX_BUNDLE CompareRandomGeneratorsCxx.cxx )\n  target_link_libraries(CompareRandomGeneratorsCxx PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CompareRandomGeneratorsCxx\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/CompareRandomGeneratorsCxx/#download-and-build-comparerandomgeneratorscxx","title":"Download and Build CompareRandomGeneratorsCxx","text":"

        Click here to download CompareRandomGeneratorsCxx and its CMakeLists.txt file. Once the tarball CompareRandomGeneratorsCxx.tar has been downloaded and extracted,

        cd CompareRandomGeneratorsCxx/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CompareRandomGeneratorsCxx\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/Diagram/","title":"Diagram","text":"

        vtk-examples/Cxx/Plotting/Diagram

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/Diagram/#description","title":"Description","text":"

        This example show how to create a custom vtkChartXY by providing a subclass of vtkContextItem.

        Also, the example uses vtkColorSeries to specify the colors of the diagram's boxes. The vtkColorSeries scheme can be specified on the command line. If an unknown scheme is used, a list of valid schemes is provided.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/Diagram/#code","title":"Code","text":"

        Diagram.cxx

        #include <vtkBrush.h>\n#include <vtkColorSeries.h>\n#include <vtkContext2D.h>\n#include <vtkContextActor.h>\n#include <vtkContextItem.h>\n#include <vtkContextScene.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkPen.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n//----------------------------------------------------------------------------\nclass APIDiagram : public vtkContextItem\n{\npublic:\n  static APIDiagram* New();\n  vtkTypeMacro(APIDiagram, vtkContextItem);\n  APIDiagram()\n  {\n    this->ColorSeries = vtkSmartPointer<vtkColorSeries>::New();\n    this->ColorSchemeName = \"Brewer Diverging Spectral (7)\";\n    this->ColorSeries->SetColorSchemeByName(this->ColorSchemeName);\n  }\n  // Paint event for the chart, called whenever the chart needs to be drawn.\n  virtual bool Paint(vtkContext2D* painter);\n  void SetColorSchemeName(std::string seriesName)\n  {\n    this->ColorSeries->SetColorSchemeByName(seriesName);\n    if (this->ColorSeries->GetColorScheme() >\n        vtkColorSeries::BREWER_QUALITATIVE_SET3)\n    {\n      this->PrintColorSchemes();\n    }\n  }\n  void PrintColorSchemes(ostream& os = std::cout)\n  {\n    int saveId = this->ColorSeries->GetColorScheme();\n    for (unsigned int i = 0; i < vtkColorSeries::BREWER_QUALITATIVE_SET3; ++i)\n    {\n      this->ColorSeries->SetColorScheme(i);\n      os << this->ColorSeries->GetColorSchemeName() << std::endl;\n    }\n    this->ColorSeries->SetColorScheme(saveId);\n  }\n\nprotected:\n  vtkSmartPointer<vtkColorSeries> ColorSeries;\n  std::string ColorSchemeName;\n};\n} // namespace\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  std::string colorSchemeName = \"Brewer Diverging Brown-Blue-Green (7)\";\n  if (argc > 1)\n  {\n    colorSchemeName = std::string(argv[1]);\n  }\n\n  // Set up a 2D chart actor, APIDiagram object andn add them to the renderer.\n  vtkNew<APIDiagram> diagram;\n  diagram->SetColorSchemeName(colorSchemeName);\n\n  vtkNew<vtkContextActor> actor;\n  actor->GetScene()->AddItem(diagram);\n\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Tan\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(800, 600);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Diagram\");\n\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->SetMultiSamples(0);\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\n// Make our new derived class to draw a diagram.\nvtkStandardNewMacro(APIDiagram);\n// This function draws our API diagram\nbool APIDiagram::Paint(vtkContext2D* painter)\n{\n  // Drawing a hard wired diagram 800x600 as a demonstration of the 2D API.\n  painter->GetTextProp()->SetVerticalJustificationToCentered();\n  painter->GetTextProp()->SetJustificationToCentered();\n  painter->GetTextProp()->SetColor(0.0, 0.0, 0.0);\n  painter->GetTextProp()->SetFontSize(24);\n  painter->GetPen()->SetColor(0, 0, 0);\n\n  unsigned int c = 0;\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n\n  painter->DrawRect(100, 50, 200, 100);\n  painter->DrawString(200, 100, \"OpenGL\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n  painter->DrawRect(300, 50, 200, 100);\n  painter->DrawString(400, 100, \"Others?\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n  painter->DrawRect(500, 50, 200, 100);\n  painter->DrawString(600, 100, \"Others?\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n  painter->DrawRect(100, 150, 600, 100);\n  painter->DrawString(400, 200, \"2D API\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n  painter->DrawRect(100, 250, 600, 200);\n  painter->DrawString(400, 400, \"Canvas API\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  c++;\n  painter->DrawRect(100, 250, 300, 100);\n  painter->DrawString(250, 300, \"Point Mark\");\n\n  painter->GetBrush()->SetColor(\n      (this->ColorSeries->GetColorRepeating(c)).GetData());\n  painter->DrawRect(100, 450, 600, 100);\n  painter->DrawString(400, 500, \"Canvas View\");\n\n  return true;\n}\n
        "},{"location":"Cxx/Plotting/Diagram/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Diagram)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Diagram: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Diagram MACOSX_BUNDLE Diagram.cxx )\n  target_link_libraries(Diagram PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Diagram\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/Diagram/#download-and-build-diagram","title":"Download and Build Diagram","text":"

        Click here to download Diagram and its CMakeLists.txt file. Once the tarball Diagram.tar has been downloaded and extracted,

        cd Diagram/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Diagram\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/FunctionalBagPlot/","title":"FunctionalBagPlot","text":"

        vtk-examples/Cxx/Plotting/FunctionalBagPlot

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/FunctionalBagPlot/#description","title":"Description","text":"

        This example illustrates how to use the vtkPlotFunctionalBag. This class, depending on the number of components in a column, will either draw a line plot (1 component) or, for two component columns, a filled polygonal band (the bag) going from the first to second component.

        The example uses a qualitative color map selected from vtkColorSeries.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/FunctionalBagPlot/#code","title":"Code","text":"

        FunctionalBagPlot.cxx

        #include <vtkChartLegend.h>\n#include <vtkChartXY.h>\n#include <vtkColorSeries.h>\n#include <vtkContextView.h>\n#include <vtkDoubleArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPen.h>\n#include <vtkPlotFunctionalBag.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#include <sstream>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Creates an input table\n  const int numCols = 7;\n  const int numVals = 100;\n\n  vtkNew<vtkTable> inputTable;\n\n  vtkNew<vtkDoubleArray> arr[numCols];\n  for (int i = 0; i < numCols; i++)\n  {\n    std::stringstream ss;\n    ss << \"Y\" << i;\n    arr[i]->SetName(ss.str().c_str());\n    arr[i]->SetNumberOfValues(numVals);\n    for (int j = 0; j < numVals; j++)\n    {\n      arr[i]->SetValue(j,\n                       (i + 1) *\n                               fabs(sin((j * 2.f * vtkMath::Pi()) /\n                                        static_cast<float>(numVals))) *\n                               j +\n                           i * 20);\n    }\n    inputTable->AddColumn(arr[i]);\n  }\n\n  // Create a X-axis column\n  vtkNew<vtkDoubleArray> xArr;\n  xArr->SetName(\"X\");\n  xArr->SetNumberOfValues(numVals);\n  for (int j = 0; j < numVals; j++)\n  {\n    xArr->SetValue(j, j * 2.0);\n  }\n  inputTable->AddColumn(xArr);\n\n  // Create the bag columns\n  vtkNew<vtkDoubleArray> q3Arr;\n  q3Arr->SetName(\"Q3\");\n  q3Arr->SetNumberOfComponents(2);\n  q3Arr->SetNumberOfTuples(numVals);\n  vtkNew<vtkDoubleArray> q2Arr;\n  q2Arr->SetName(\"Q2\");\n  q2Arr->SetNumberOfComponents(2);\n  q2Arr->SetNumberOfTuples(numVals);\n\n  for (int i = 0; i < numVals; i++)\n  {\n    double v0, v1;\n    v0 = arr[1]->GetVariantValue(i).ToFloat();\n    v1 = arr[5]->GetVariantValue(i).ToFloat();\n    q3Arr->SetTuple2(i, v0, v1);\n\n    v0 = arr[2]->GetVariantValue(i).ToFloat();\n    v1 = arr[4]->GetVariantValue(i).ToFloat();\n    q2Arr->SetTuple2(i, v0, v1);\n  }\n\n  inputTable->AddColumn(q3Arr);\n  inputTable->AddColumn(q2Arr);\n\n  // Set up a 2D scene and add an XY chart to it\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->SetWindowName(\"FunctionalBagPlot\");\n\n  vtkNew<vtkChartXY> chart;\n  chart->SetShowLegend(true);\n  chart->GetLegend()->SetHorizontalAlignment(vtkChartLegend::LEFT);\n  chart->GetLegend()->SetVerticalAlignment(vtkChartLegend::TOP);\n\n  view->GetScene()->AddItem(chart);\n\n  // Create the functional bag plots\n  vtkColor3d color3d = colors->GetColor3d(\"Tomato\");\n  vtkNew<vtkPlotFunctionalBag> q3Plot;\n#if VTK_HAS_SETCOLORF\n  q3Plot->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n#else\n  q3Plot->SetColor(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n#endif\n  q3Plot->SetInputData(inputTable, \"X\", \"Q3\");\n  chart->AddPlot(q3Plot);\n\n  color3d = colors->GetColor3d(\"Banana\");\n  vtkNew<vtkPlotFunctionalBag> q2Plot;\n#if VTK_HAS_SETCOLORF\n  q2Plot->SetColorF(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n#else\n  q2Plot->SetColor(color3d.GetRed(), color3d.GetGreen(), color3d.GetBlue());\n#endif\n  q2Plot->SetInputData(inputTable, \"X\", \"Q2\");\n  chart->AddPlot(q2Plot);\n\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_QUALITATIVE_SET3);\n  ;\n\n  vtkNew<vtkLookupTable> lookup;\n  lookup->SetNumberOfColors(numCols);\n  lookup->SetRange(0, numCols - 1);\n  for (int j = 0; j < numCols; j++)\n  {\n    vtkNew<vtkPlotFunctionalBag> plot;\n    vtkColor3ub color = colorSeries->GetColorRepeating(j);\n    lookup->SetTableValue(j, color.GetRed() / 255., color.GetGreen() / 255.,\n                          color.GetBlue() / 255., 1.);\n    double rgb[3];\n    lookup->GetColor(j, rgb);\n#if VTK_HAS_SETCOLORF\n    plot->SetColorF(rgb[0], rgb[1], rgb[2]);\n#else\n    plot->SetColor(rgb[0], rgb[1], rgb[2]);\n#endif\n    plot->SetInputData(inputTable, \"X\", inputTable->GetColumn(j)->GetName());\n    plot->GetPen()->SetWidth(3.0);\n    chart->AddPlot(plot);\n  }\n\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render the scene\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/FunctionalBagPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FunctionalBagPlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FunctionalBagPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FunctionalBagPlot MACOSX_BUNDLE FunctionalBagPlot.cxx )\n  target_link_libraries(FunctionalBagPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FunctionalBagPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/FunctionalBagPlot/#download-and-build-functionalbagplot","title":"Download and Build FunctionalBagPlot","text":"

        Click here to download FunctionalBagPlot and its CMakeLists.txt file. Once the tarball FunctionalBagPlot.tar has been downloaded and extracted,

        cd FunctionalBagPlot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FunctionalBagPlot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/Histogram2D/","title":"Histogram2D","text":"

        vtk-examples/Cxx/Plotting/Histogram2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/Histogram2D/#description","title":"Description","text":"

        This examples uses a vtkChartHistogram to draw a 2D histogram represented as an image.

        The example shows how to set various properties.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/Histogram2D/#code","title":"Code","text":"

        Histogram2D.cxx

        #include <vtkAxis.h>\n#include <vtkBrush.h>\n#include <vtkChartHistogram2D.h>\n#include <vtkColorLegend.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkContextView.h>\n#include <vtkImageData.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  // Define colors.\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SlateGray\");\n  vtkColor3d titleColor = colors->GetColor3d(\"Orange\");\n  vtkColor3d axisTitleColor = colors->GetColor3d(\"Orange\");\n  vtkColor3d axisLabelColor = colors->GetColor3d(\"Beige\");\n  vtkColor4ub legendBackgroundColor = colors->GetColor4ub(\"Tomato\");\n\n  // Set up a 2D scene, add an XY chart to it.\n  int size = 400;\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(512, 512);\n  view->GetRenderWindow()->SetWindowName(\"Histogram2D\");\n\n  view->GetRenderer()->SetBackground(backgroundColor.GetData());\n\n  // Define a chart\n  vtkNew<vtkChartHistogram2D> chart;\n\n  // Chart Title.\n  chart->SetTitle(\"2D Histogram\");\n  chart->GetTitleProperties()->SetFontSize(36);\n  chart->GetTitleProperties()->SetColor(titleColor.GetData());\n\n  // Chart Axes.\n  chart->GetAxis(0)->GetTitleProperties()->SetFontSize(24);\n  chart->GetAxis(0)->GetTitleProperties()->SetColor(axisTitleColor.GetData());\n  chart->GetAxis(0)->GetLabelProperties()->SetColor(axisLabelColor.GetData());\n  chart->GetAxis(0)->GetLabelProperties()->SetFontSize(18);\n\n  chart->GetAxis(1)->GetTitleProperties()->SetFontSize(24);\n  chart->GetAxis(1)->GetTitleProperties()->SetColor(\n      colors->GetColor3d(\"orange\").GetData());\n  chart->GetAxis(1)->GetLabelProperties()->SetColor(\n      colors->GetColor3d(\"beige\").GetData());\n  chart->GetAxis(1)->GetLabelProperties()->SetFontSize(18);\n\n  // Chart Legend.\n  dynamic_cast<vtkColorLegend*>(chart->GetLegend())->DrawBorderOn();\n  chart->GetLegend()->GetBrush()->SetColor(legendBackgroundColor);\n\n  // Add the chart to the view.\n  view->GetScene()->AddItem(chart);\n\n  vtkNew<vtkImageData> data;\n  data->SetExtent(0, size - 1, 0, size - 1, 0, 0);\n  data->AllocateScalars(VTK_DOUBLE, 1);\n\n  data->SetOrigin(100.0, -100.0, 0.0);\n  data->SetSpacing(2.0, 1.0, 1.0);\n\n  double* dPtr = static_cast<double*>(data->GetScalarPointer(0, 0, 0));\n  for (int i = 0; i < size; ++i)\n  {\n    for (int j = 0; j < size; ++j)\n    {\n      dPtr[i * size + j] =\n          std::sin(vtkMath::RadiansFromDegrees(double(2 * i))) *\n          std::cos(vtkMath::RadiansFromDegrees(double(j)));\n    }\n  }\n  chart->SetInputData(data);\n\n  vtkNew<vtkColorTransferFunction> transferFunction;\n  transferFunction->AddHSVSegment(0.0, 0.0, 1.0, 1.0, 0.3333, 0.3333, 1.0, 1.0);\n  transferFunction->AddHSVSegment(0.3333, 0.3333, 1.0, 1.0, 0.6666, 0.6666, 1.0,\n                                  1.0);\n  transferFunction->AddHSVSegment(0.6666, 0.6666, 1.0, 1.0, 1.0, 0.2, 1.0, 0.3);\n  transferFunction->Build();\n  chart->SetTransferFunction(transferFunction);\n\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/Histogram2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Histogram2D)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Histogram2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Histogram2D MACOSX_BUNDLE Histogram2D.cxx )\n  target_link_libraries(Histogram2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Histogram2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/Histogram2D/#download-and-build-histogram2d","title":"Download and Build Histogram2D","text":"

        Click here to download Histogram2D and its CMakeLists.txt file. Once the tarball Histogram2D.tar has been downloaded and extracted,

        cd Histogram2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Histogram2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/HistogramBarChart/","title":"HistogramBarChart","text":"

        vtk-examples/Cxx/Plotting/HistogramBarChart

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/HistogramBarChart/#code","title":"Code","text":"

        HistogramBarChart.cxx

        #include <vtkActor.h>\n#include <vtkBarChartActor.h>\n#include <vtkFieldData.h>\n#include <vtkImageAccumulate.h>\n#include <vtkImageData.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkIntArray.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStdString.h>\n\nint main(int argc, char* argv[])\n{\n  // Handle the arguments\n  if (argc < 2)\n  {\n    std::cout << \"Required arguments: filename [optional ignore zero:] <y/n> \"\n                 \"e.g. Pileated.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  int ignoreZero = 0;\n  if (argc == 3)\n  {\n    vtkStdString ignore = argv[2];\n    std::cout << ignore << std::endl;\n    if (ignore == \"y\" || ignore == \"Y\")\n    {\n      ignoreZero = 1;\n    }\n  }\n\n  // Read an image\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  int numComponents = reader->GetOutput()->GetNumberOfScalarComponents();\n  std::cout << \"Number of components: \" << numComponents << std::endl;\n  if (numComponents > 3)\n  {\n    std::cout << \"Error: cannot process an image with \" << numComponents\n              << \" components!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  double colors[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};\n\n  // const char* labels[3] = {\n  //  \"Red\", \"Green\", \"Blue\" };\n\n  vtkNew<vtkIntArray> redFrequencies;\n  vtkNew<vtkIntArray> greenFrequencies;\n  vtkNew<vtkIntArray> blueFrequencies;\n\n  // Process the image, extracting and barChartting a histogram for each\n  // component.\n  for (int i = 0; i < numComponents; ++i)\n  {\n    vtkNew<vtkImageExtractComponents> extract;\n    extract->SetInputConnection(reader->GetOutputPort());\n    extract->SetComponents(i);\n    extract->Update();\n\n    vtkNew<vtkImageAccumulate> histogram;\n    histogram->SetInputConnection(extract->GetOutputPort());\n    histogram->SetComponentExtent(1, 55, 0, 0, 0, 0);\n    histogram->SetComponentOrigin(0, 0, 0);\n    histogram->SetComponentSpacing(1, 0, 0);\n    histogram->SetIgnoreZero(ignoreZero);\n    histogram->Update();\n\n    vtkIntArray* currentArray = 0;\n    if (i == 0)\n    {\n      currentArray = redFrequencies;\n    }\n    else if (i == 1)\n    {\n      currentArray = greenFrequencies;\n    }\n    else\n    {\n      currentArray = blueFrequencies;\n    }\n\n    currentArray->SetNumberOfComponents(1);\n    currentArray->SetNumberOfTuples(54);\n\n    vtkIdType* output =\n        static_cast<vtkIdType*>(histogram->GetOutput()->GetScalarPointer());\n\n    for (int j = 0; j < 54; ++j)\n    {\n      currentArray->SetTuple1(j, *output++);\n    }\n  }\n\n  vtkNew<vtkDataObject> dataObject;\n\n  if (numComponents == 1)\n  {\n    dataObject->GetFieldData()->AddArray(redFrequencies);\n  }\n  else\n  {\n    vtkIntArray* rgb[3] = {0, 0, 0};\n    vtkNew<vtkIntArray> allFrequencies;\n    allFrequencies->SetNumberOfComponents(1);\n    if (numComponents == 2)\n    {\n      rgb[0] = redFrequencies;\n      rgb[1] = greenFrequencies;\n    }\n    else\n    {\n      rgb[0] = redFrequencies;\n      rgb[1] = greenFrequencies;\n      rgb[2] = blueFrequencies;\n    }\n    for (int i = 0; i < 54; ++i)\n    {\n      for (int j = 0; j < numComponents; ++j)\n      {\n        allFrequencies->InsertNextTuple1(rgb[j]->GetTuple1(i));\n      }\n    }\n\n    dataObject->GetFieldData()->AddArray(allFrequencies);\n  }\n\n  // Create a vtkBarChartActor.\n  vtkNew<vtkBarChartActor> barChart;\n\n  // BUG 1: If input is not set first, the x-axis of the bar chart will be too\n  // long.\n  //\n  barChart->SetInput(dataObject);\n  barChart->SetTitle(\"Histogram\");\n  barChart->GetPositionCoordinate()->SetValue(0.05, 0.05, 0.0);\n  barChart->GetPosition2Coordinate()->SetValue(0.95, 0.85, 0.0);\n  barChart->GetProperty()->SetColor(1, 1, 1);\n\n  // BUG 2: If the number of entries is not set to the number of data array\n  // tuples, the bar chart actor will crash. The crash occurs whether the legend\n  // and or labels are visible or not.\n\n  barChart->GetLegendActor()->SetNumberOfEntries(\n      dataObject->GetFieldData()->GetArray(0)->GetNumberOfTuples());\n  barChart->LegendVisibilityOff();\n  barChart->LabelVisibilityOff();\n\n  // BUG 3: the y-axis labels do not accurately reflect the range of data.\n\n  int count = 0;\n  for (int i = 0; i < 54; ++i)\n  {\n    for (int j = 0; j < numComponents; ++j)\n    {\n      barChart->SetBarColor(count++, colors[j]);\n    }\n  }\n\n  // Visualize the histogram(s)\n  vtkNew<vtkNamedColors> namedColors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(barChart);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"HistogramBarChart\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  // Initialize the event loop and then start it.\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/HistogramBarChart/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HistogramBarChart)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  ImagingCore\n  ImagingStatistics\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HistogramBarChart: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HistogramBarChart MACOSX_BUNDLE HistogramBarChart.cxx )\n  target_link_libraries(HistogramBarChart PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HistogramBarChart\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/HistogramBarChart/#download-and-build-histogrambarchart","title":"Download and Build HistogramBarChart","text":"

        Click here to download HistogramBarChart and its CMakeLists.txt file. Once the tarball HistogramBarChart.tar has been downloaded and extracted,

        cd HistogramBarChart/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HistogramBarChart\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/LinePlot/","title":"LinePlot","text":"

        vtk-examples/Cxx/Plotting/LinePlot

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/LinePlot/#description","title":"Description","text":"

        This example demonstrates how to plot XY data.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/LinePlot/#code","title":"Code","text":"

        LinePlot.cxx

        #include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a table with some points in it.\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  // Fill in the table with some example values.\n  int numPoints = 69;\n  float inc = 7.5 / (numPoints - 1);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc);\n    table->SetValue(i, 1, cos(i * inc));\n    table->SetValue(i, 2, sin(i * inc));\n  }\n\n  // Set up the view\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetWindowName(\"LinePlot\");\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Add multiple line plots, setting the colors etc.\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  vtkPlot* line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 1);\n  line->SetColor(0, 255, 0, 255);\n  line->SetWidth(1.0);\n  line = chart->AddPlot(vtkChart::LINE);\n  line->SetInputData(table, 0, 2);\n  line->SetColor(255, 0, 0, 255);\n  line->SetWidth(5.0);\n\n  // For dotted line, the line type can be from 2 to 5 for different dash/dot\n  // patterns (see enum in vtkPen containing DASH_LINE, value 2):\n  // #ifndef WIN32\n  //   line->GetPen()->SetLineType(vtkPen::DASH_LINE);\n  // #endif\n  // (ifdef-ed out on Windows because DASH_LINE does not work on Windows\n  //  machines with built-in Intel HD graphics card...)\n\n  // view->GetRenderWindow()->SetMultiSamples(0);\n\n  // Start interactor\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/LinePlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LinePlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LinePlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LinePlot MACOSX_BUNDLE LinePlot.cxx )\n  target_link_libraries(LinePlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LinePlot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/LinePlot/#download-and-build-lineplot","title":"Download and Build LinePlot","text":"

        Click here to download LinePlot and its CMakeLists.txt file. Once the tarball LinePlot.tar has been downloaded and extracted,

        cd LinePlot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LinePlot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/MultiplePlots/","title":"MultiplePlots","text":"

        vtk-examples/Cxx/Plotting/MultiplePlots

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/MultiplePlots/#description","title":"Description","text":"

        Display multiple plots by using viewports in a single render window.

        In this case, we display two graphs side-by-side.

        The difference between setting a background in the renderer and setting the chart background is shown.

        Note

        This example was prompted by this discussion vtk chart background shifted towards origin.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/MultiplePlots/#code","title":"Code","text":"

        MultiplePlots.cxx

        #include <vtkAxis.h>\n#include <vtkBrush.h>\n#include <vtkChartXY.h>\n#include <vtkContextActor.h>\n#include <vtkContextScene.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#include <array>\n#include <cmath>\n#include <vector>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"MultiplePlots\");\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Setup the viewports\n  auto gridDimensionsX = 2;\n  auto gridDimensionsY = 1;\n  auto rendererSizeX = 320;\n  auto rendererSizeY = 240;\n  renWin->SetSize(rendererSizeX * gridDimensionsX,\n                  rendererSizeY * gridDimensionsY);\n  std::cout << rendererSizeX * gridDimensionsX << \" \"\n            << gridDimensionsY * gridDimensionsY << std::endl;\n  std::vector<std::array<double, 4>> viewPorts;\n  for (auto row = 0; row < gridDimensionsY; ++row)\n  {\n    for (auto col = 0; col < gridDimensionsX; ++col)\n    {\n      // index = row * gridDimensionsX + col\n\n      // (xmin, ymin, xmax, ymax)\n      viewPorts.push_back(std::array<double, 4>{\n          static_cast<double>(col) / gridDimensionsX,\n          static_cast<double>(gridDimensionsY - (row + 1.0)) / gridDimensionsY,\n          static_cast<double>(col + 1.0) / gridDimensionsX,\n          static_cast<double>(gridDimensionsY - static_cast<double>(row)) /\n              gridDimensionsY});\n    }\n  }\n\n  // Link the renderers to the viewports.\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n  leftRenderer->SetViewport(viewPorts[0].data());\n  renWin->AddRenderer(leftRenderer);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetBackground(colors->GetColor3d(\"Lavender\").GetData());\n  rightRenderer->SetViewport(viewPorts[1].data());\n  renWin->AddRenderer(rightRenderer);\n\n  // Create the charts.\n  vtkNew<vtkChartXY> leftChart;\n  vtkNew<vtkContextScene> leftChartScene;\n  vtkNew<vtkContextActor> leftChartActor;\n\n  leftChartScene->AddItem(leftChart);\n  leftChartActor->SetScene(leftChartScene);\n\n  leftRenderer->AddActor(leftChartActor);\n  leftChartScene->SetRenderer(leftRenderer);\n\n  auto xAxis = leftChart->GetAxis(vtkAxis::BOTTOM);\n  xAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"LightGrey\"));\n  xAxis->SetTitle(\"x\");\n  auto yAxis = leftChart->GetAxis(vtkAxis::LEFT);\n  yAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"LightGrey\"));\n  yAxis->SetTitle(\"cos(x)\");\n#if VTK_HAS_SETCOLORF\n  leftChart->GetBackgroundBrush()->SetColorF(\n      colors->GetColor4d(\"MistyRose\").GetData());\n#else\n  leftChart->GetBackgroundBrush()->SetColor(\n      colors->GetColor4d(\"MistyRose\").GetData());\n#endif\n  leftChart->GetBackgroundBrush()->SetOpacityF(0.4);\n  leftChart->SetTitle(\"Cosine\");\n\n  vtkNew<vtkChartXY> rightChart;\n  vtkNew<vtkContextScene> rightChartScene;\n  vtkNew<vtkContextActor> rightChartActor;\n\n  rightChartScene->AddItem(rightChart);\n  rightChartActor->SetScene(rightChartScene);\n\n  rightRenderer->AddActor(rightChartActor);\n  rightChartScene->SetRenderer(rightRenderer);\n\n  xAxis = rightChart->GetAxis(vtkAxis::BOTTOM);\n  xAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"LightCyan\"));\n  xAxis->SetTitle(\"x\");\n  yAxis = rightChart->GetAxis(vtkAxis::LEFT);\n  yAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"LightCyan\"));\n  yAxis->SetTitle(\"sin(x)\");\n#if VTK_HAS_SETCOLORF\n  rightChart->GetBackgroundBrush()->SetColorF(\n      colors->GetColor4d(\"Thistle\").GetData());\n#else\n  rightChart->GetBackgroundBrush()->SetColor(\n      colors->GetColor4d(\"Thistle\").GetData());\n#endif\n  rightChart->GetBackgroundBrush()->SetOpacityF(0.4);\n  rightChart->SetTitle(\"Sine\");\n\n  // Create a table with some points in it.\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  // Fill in the table with some example values.\n  auto numPoints = 40;\n  auto inc = 7.5 / (numPoints - 1.0);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc);\n    table->SetValue(i, 1, cos(i * inc));\n    table->SetValue(i, 2, sin(i * inc));\n  }\n\n  auto ptColor = colors->GetColor4ub(\"Black\");\n\n  auto points = leftChart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 1);\n  points->SetColor(ptColor.GetRed(), ptColor.GetGreen(), ptColor.GetBlue(),\n                   ptColor.GetAlpha());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::CROSS);\n\n  points = rightChart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 2);\n  points->SetColor(ptColor.GetRed(), ptColor.GetGreen(), ptColor.GetBlue(),\n                   ptColor.GetAlpha());\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::PLUS);\n\n  renWin->Render();\n  iRen->Initialize();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/MultiplePlots/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultiplePlots)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultiplePlots: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultiplePlots MACOSX_BUNDLE MultiplePlots.cxx )\n  target_link_libraries(MultiplePlots PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultiplePlots\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/MultiplePlots/#download-and-build-multipleplots","title":"Download and Build MultiplePlots","text":"

        Click here to download MultiplePlots and its CMakeLists.txt file. Once the tarball MultiplePlots.tar has been downloaded and extracted,

        cd MultiplePlots/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MultiplePlots\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/ParallelCoordinates/","title":"ParallelCoordinates","text":"

        vtk-examples/Cxx/Plotting/ParallelCoordinates

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/ParallelCoordinates/#code","title":"Code","text":"

        ParallelCoordinates.cxx

        #include <vtkChartParallelCoordinates.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  view->GetRenderWindow()->SetSize(800, 600);\n  view->GetRenderWindow()->SetWindowName(\"ParallelCoordinates\");\n\n  vtkNew<vtkChartParallelCoordinates> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"Field 1\");\n  table->AddColumn(arrX);\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Field 2\");\n  table->AddColumn(arrC);\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Field 3\");\n  table->AddColumn(arrS);\n  vtkNew<vtkFloatArray> arrS2;\n  arrS2->SetName(\"Field 4\");\n  table->AddColumn(arrS2);\n  // Test charting with a few more points...\n\n  table->SetNumberOfRows(10);\n  for (int i = 0; i < 10; ++i)\n  {\n    table->SetValue(i, 0, 0 * i);\n    table->SetValue(i, 1, 1 * i);\n    table->SetValue(i, 2, 2 * i);\n    table->SetValue(i, 3, 3 * i);\n  }\n\n  chart->GetPlot(0)->SetInputData(table);\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/ParallelCoordinates/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParallelCoordinates)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParallelCoordinates: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParallelCoordinates MACOSX_BUNDLE ParallelCoordinates.cxx )\n  target_link_libraries(ParallelCoordinates PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParallelCoordinates\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/ParallelCoordinates/#download-and-build-parallelcoordinates","title":"Download and Build ParallelCoordinates","text":"

        Click here to download ParallelCoordinates and its CMakeLists.txt file. Once the tarball ParallelCoordinates.tar has been downloaded and extracted,

        cd ParallelCoordinates/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ParallelCoordinates\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/PieChart/","title":"PieChart","text":"

        vtk-examples/Cxx/Plotting/PieChart

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/PieChart/#code","title":"Code","text":"

        PieChart.cxx

        #include <vtkChartPie.h>\n#include <vtkColorSeries.h>\n#include <vtkContextView.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotPie.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStringArray.h>\n#include <vtkTable.h>\n\nnamespace {\nconstexpr int NUM_ITEMS = 5;\nconstexpr int data[] = {77938, 9109, 2070, 12806, 19514};\n// constexpr int data[] = {200,200,200,200,200};\nstd::string labels[] = {\"Books\", \"New and Popular\", \"Periodical\", \"Audiobook\",\n                        \"Video\"};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  view->GetRenderWindow()->SetSize(600, 350);\n  view->GetRenderWindow()->SetWindowName(\"PieChart\");\n\n  vtkNew<vtkChartPie> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkIntArray> arrData;\n  vtkNew<vtkStringArray> labelArray;\n\n  arrData->SetName(\"2008 Circulation\");\n  for (int i = 0; i < NUM_ITEMS; i++)\n  {\n    arrData->InsertNextValue(data[i]);\n    labelArray->InsertNextValue(labels[i]);\n  }\n\n  table->AddColumn(arrData);\n\n  // Create a color series to use with our stacks.\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::WARM);\n\n  // Add multiple line plots, setting the colors etc\n  vtkPlotPie* pie = dynamic_cast<vtkPlotPie*>(chart->AddPlot(0));\n  pie->SetColorSeries(colorSeries);\n  pie->SetInputData(table);\n  pie->SetInputArray(0, \"2008 Circulation\");\n  pie->SetLabels(labelArray);\n\n  chart->SetShowLegend(true);\n\n  chart->SetTitle(\"Circulation 2008\");\n\n  // Finally render the scene and compare the image to a reference image\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/PieChart/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PieChart)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PieChart: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PieChart MACOSX_BUNDLE PieChart.cxx )\n  target_link_libraries(PieChart PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PieChart\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/PieChart/#download-and-build-piechart","title":"Download and Build PieChart","text":"

        Click here to download PieChart and its CMakeLists.txt file. Once the tarball PieChart.tar has been downloaded and extracted,

        cd PieChart/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PieChart\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/PieChartActor/","title":"PieChartActor","text":"

        vtk-examples/Cxx/Plotting/PieChartActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/PieChartActor/#code","title":"Code","text":"

        PieChartActor.cxx

        #include <vtkColorSeries.h>\n#include <vtkDataObject.h>\n#include <vtkFieldData.h>\n#include <vtkFloatArray.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPieChartActor.h>\n#include <vtkPoints.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\n#include <map>\n\nint main(int /*argc*/, char* /*argv*/[])\n{\n  typedef std::map<std::string, int> DataContainer;\n  DataContainer movies;\n\n  movies[\"Comedy\"] = 27;\n  movies[\"Action\"] = 18;\n  movies[\"Romance\"] = 14;\n  movies[\"Drama\"] = 14;\n  movies[\"Horror\"] = 11;\n  movies[\"Foreign\"] = 8;\n  movies[\"Scifi\"] = 8;\n\n  int numTuples = static_cast<int>(movies.size());\n\n  vtkNew<vtkFloatArray> bitter;\n  bitter->SetNumberOfTuples(numTuples);\n\n  DataContainer::iterator m;\n  int i = 0;\n  for (m = movies.begin(); m != movies.end(); ++m)\n  {\n    bitter->SetTuple1(i++, m->second);\n  }\n\n  vtkNew<vtkDataObject> dobj;\n  dobj->GetFieldData()->AddArray(bitter);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPieChartActor> actor;\n  actor->SetInputData(dobj);\n  actor->SetTitle(\"Movie Watching\");\n  actor->GetPositionCoordinate()->SetValue(0.05, 0.1, 0.0);\n  actor->GetPosition2Coordinate()->SetValue(0.95, 0.85, 0.0);\n  actor->GetProperty()->SetColor(0, 0, 0);\n  actor->GetProperty()->SetLineWidth(2);\n  actor->GetLabelTextProperty()->SetFontSize(18);\n  actor->GetLegendActor()->SetNumberOfEntries(numTuples);\n\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_QUALITATIVE_PASTEL2);\n  i = 0;\n  for (m = movies.begin(); m != movies.end(); ++m)\n  {\n    vtkColor3ub rgb = colorSeries->GetColorRepeating(i);\n    actor->SetPieceColor(i, static_cast<double>(rgb.GetRed()) / 255.0,\n                         static_cast<double>(rgb.GetGreen()) / 255.0,\n                         static_cast<double>(rgb.GetBlue()) / 255.0);\n    actor->SetPieceLabel(i++, m->first.c_str());\n  }\n  actor->LegendVisibilityOn();\n  // Set text colors (same as actor for backward compat with test).\n  actor->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  actor->GetTitleTextProperty()->SetFontSize(40);\n  actor->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"Bisque\").GetData());\n  actor->GetLabelTextProperty()->SetFontSize(24);\n\n  // Create the RenderWindow, Renderer and both Actors.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren1->AddActor(actor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(1024, 512);\n  renWin->SetWindowName(\"PieChartActor\");\n\n  // Render the image.\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/PieChartActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PieChartActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PieChartActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PieChartActor MACOSX_BUNDLE PieChartActor.cxx )\n  target_link_libraries(PieChartActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PieChartActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/PieChartActor/#download-and-build-piechartactor","title":"Download and Build PieChartActor","text":"

        Click here to download PieChartActor and its CMakeLists.txt file. Once the tarball PieChartActor.tar has been downloaded and extracted,

        cd PieChartActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PieChartActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/PlotLine3D/","title":"PlotLine3D","text":"

        vtk-examples/Cxx/Plotting/PlotLine3D

        "},{"location":"Cxx/Plotting/PlotLine3D/#description","title":"Description","text":"

        This example illustrates plotting 3D points using vtkPlotLine3D. It plots the solution to the Lorenz Attractor.

        Warning

        The current vtkPlotLine3D produces the warning, \"vtkOpenGLContextDevice3D (): a line width has been requested that is larger than your system supports\" which appears to have no effect on the results.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/PlotLine3D/#code","title":"Code","text":"

        PlotLine3D.cxx

        #include <vtkCamera.h>\n#include <vtkChartXYZ.h>\n#include <vtkContext3D.h>\n#include <vtkContextScene.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPen.h>\n#include <vtkPlotLine3D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\n// Plot the solution to the Lorenz attractor.\n// http://en.wikipedia.org/wiki/Lorenz_system\nnamespace {\nvoid lorenz(const float* varX, float* varXDerivative)\n{\n  const float sigma = 10.f;\n  const float rho = 28.f;\n  const float beta = 2.66666666666f;\n\n  varXDerivative[0] = sigma * (varX[1] - varX[0]);\n  varXDerivative[1] = varX[0] * (rho - varX[2]) - varX[1];\n  varXDerivative[2] = varX[0] * varX[1] - beta * varX[2];\n}\n} // namespace\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the data.\n  vtkNew<vtkTable> varXSolution;\n\n  vtkNew<vtkFloatArray> arrX0;\n  arrX0->SetName(\"X\");\n  varXSolution->AddColumn(arrX0);\n\n  vtkNew<vtkFloatArray> arrX1;\n  arrX1->SetName(\"Y\");\n  varXSolution->AddColumn(arrX1);\n\n  vtkNew<vtkFloatArray> arrX2;\n  arrX2->SetName(\"Z\");\n  varXSolution->AddColumn(arrX2);\n\n  const unsigned int numberOfTimePoints = 1000;\n  varXSolution->SetNumberOfRows(numberOfTimePoints);\n  float varX[3];\n  varX[0] = 0.0f;\n  varX[1] = 1.0f;\n  varX[2] = 1.05f;\n\n  float varXDerivative[3];\n  const float deltaT = 0.01f;\n  for (unsigned int ii = 0; ii < numberOfTimePoints; ++ii)\n  {\n    varXSolution->SetValue(ii, 0, varX[0]);\n    varXSolution->SetValue(ii, 1, varX[1]);\n    varXSolution->SetValue(ii, 2, varX[2]);\n    lorenz(varX, varXDerivative);\n    varX[0] += varXDerivative[0] * deltaT;\n    varX[1] += varXDerivative[1] * deltaT;\n    varX[2] += varXDerivative[2] * deltaT;\n  }\n\n  // Set up a 3D scene and add an XYZ chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetRenderWindow()->SetWindowName(\"PlotLine3D\");\n\n  vtkNew<vtkChartXYZ> chart;\n  chart->SetGeometry(vtkRectf(5.0, 5.0, 635.0, 475.0));\n  view->GetScene()->AddItem(chart);\n\n  // Add a line plot.\n  vtkNew<vtkPlotLine3D> plot;\n  plot->SetInputData(varXSolution);\n#if VTK_HAS_SETCOLORF\n  plot->GetPen()->SetColorF(colors->GetColor3d(\"LightCoral\").GetData());\n#else\n  plot->GetPen()->SetColor(colors->GetColor3d(\"LightCoral\").GetData());\n#endif\n  view->GetRenderWindow()->SetMultiSamples(0);\n  plot->GetPen()->SetWidth(2.0);\n  chart->AddPlot(plot);\n\n  // Finally render the scene.\n  view->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"DarkOliveGreen\").GetData());\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/PlotLine3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlotLine3D)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlotLine3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlotLine3D MACOSX_BUNDLE PlotLine3D.cxx )\n  target_link_libraries(PlotLine3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlotLine3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/PlotLine3D/#download-and-build-plotline3d","title":"Download and Build PlotLine3D","text":"

        Click here to download PlotLine3D and its CMakeLists.txt file. Once the tarball PlotLine3D.tar has been downloaded and extracted,

        cd PlotLine3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PlotLine3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/ScatterPlot/","title":"ScatterPlot","text":"

        vtk-examples/Cxx/Plotting/ScatterPlot

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/ScatterPlot/#code","title":"Code","text":"

        ScatterPlot.cxx

        #include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(400, 300);\n  view->GetRenderWindow()->SetWindowName(\"ScatterPlot\");\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n  chart->SetShowLegend(true);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkFloatArray> arrX;\n  arrX->SetName(\"X Axis\");\n  table->AddColumn(arrX);\n\n  vtkNew<vtkFloatArray> arrC;\n  arrC->SetName(\"Cosine\");\n  table->AddColumn(arrC);\n\n  vtkNew<vtkFloatArray> arrS;\n  arrS->SetName(\"Sine\");\n  table->AddColumn(arrS);\n\n  vtkNew<vtkFloatArray> arrT;\n  arrT->SetName(\"Sine - Cosine\");\n  table->AddColumn(arrT);\n\n  // Test charting with a few more points...\n  int numPoints = 40;\n  float inc = 7.5 / (numPoints - 1);\n  table->SetNumberOfRows(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    table->SetValue(i, 0, i * inc);\n    table->SetValue(i, 1, cos(i * inc) + 0.0);\n    table->SetValue(i, 2, sin(i * inc) + 0.0);\n    table->SetValue(i, 3, sin(i * inc) - cos(i * inc));\n  }\n\n  // Add multiple scatter plots, setting the colors etc.\n  vtkPlot* points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 1);\n  points->SetColor(0, 0, 0, 255);\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::CROSS);\n\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 2);\n  points->SetColor(0, 0, 0, 255);\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::PLUS);\n\n  points = chart->AddPlot(vtkChart::POINTS);\n  points->SetInputData(table, 0, 3);\n  points->SetColor(0, 0, 255, 255);\n  points->SetWidth(1.0);\n  dynamic_cast<vtkPlotPoints*>(points)->SetMarkerStyle(vtkPlotPoints::CIRCLE);\n\n  // Finally render the scene.\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/ScatterPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScatterPlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScatterPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScatterPlot MACOSX_BUNDLE ScatterPlot.cxx )\n  target_link_libraries(ScatterPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScatterPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/ScatterPlot/#download-and-build-scatterplot","title":"Download and Build ScatterPlot","text":"

        Click here to download ScatterPlot and its CMakeLists.txt file. Once the tarball ScatterPlot.tar has been downloaded and extracted,

        cd ScatterPlot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ScatterPlot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/SpiderPlot/","title":"SpiderPlot","text":"

        vtk-examples/Cxx/Plotting/SpiderPlot

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/SpiderPlot/#description","title":"Description","text":"

        A spider plot is used to display multivariate data. See this wikipedia article for more information.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/SpiderPlot/#code","title":"Code","text":"

        SpiderPlot.cxx

        #include <vtkDataObject.h>\n#include <vtkFieldData.h>\n#include <vtkFloatArray.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSpiderPlotActor.h>\n#include <vtkTextProperty.h>\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int numTuples = 12;\n\n  vtkNew<vtkFloatArray> bitter;\n  bitter->SetNumberOfTuples(numTuples);\n\n  vtkNew<vtkFloatArray> crispy;\n  crispy->SetNumberOfTuples(numTuples);\n\n  vtkNew<vtkFloatArray> crunchy;\n  crunchy->SetNumberOfTuples(numTuples);\n\n  vtkNew<vtkFloatArray> salty;\n  salty->SetNumberOfTuples(numTuples);\n\n  vtkNew<vtkFloatArray> oily;\n  oily->SetNumberOfTuples(numTuples);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  for (int i = 0; i < numTuples; i++)\n  {\n    bitter->SetTuple1(i, randomSequence->GetRangeValue(1, 10));\n    randomSequence->Next();\n    crispy->SetTuple1(i, randomSequence->GetRangeValue(-1, 1));\n    randomSequence->Next();\n    crunchy->SetTuple1(i, randomSequence->GetRangeValue(1, 100));\n    randomSequence->Next();\n    salty->SetTuple1(i, randomSequence->GetRangeValue(0, 10));\n    randomSequence->Next();\n    oily->SetTuple1(i, randomSequence->GetRangeValue(5, 25));\n    randomSequence->Next();\n  }\n\n  vtkNew<vtkDataObject> dobj;\n  dobj->GetFieldData()->AddArray(bitter);\n  dobj->GetFieldData()->AddArray(crispy);\n  dobj->GetFieldData()->AddArray(crunchy);\n  dobj->GetFieldData()->AddArray(salty);\n  dobj->GetFieldData()->AddArray(oily);\n\n  vtkNew<vtkSpiderPlotActor> actor;\n  actor->SetInputData(dobj);\n  actor->SetTitle(\"Spider Plot\");\n  actor->SetIndependentVariablesToColumns();\n  actor->GetPositionCoordinate()->SetValue(0.05, 0.1, 0.0);\n  actor->GetPosition2Coordinate()->SetValue(0.95, 0.85, 0.0);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  actor->SetAxisLabel(0, \"Bitter\");\n  actor->SetAxisRange(0, 1, 10);\n  actor->SetAxisLabel(1, \"Crispy\");\n  actor->SetAxisRange(1, -1, 1);\n  actor->SetAxisLabel(2, \"Crunchy\");\n  actor->SetAxisRange(2, 1, 100);\n  actor->SetAxisLabel(3, \"Salty\");\n  actor->SetAxisRange(3, 0, 10);\n  actor->SetAxisLabel(4, \"Oily\");\n  actor->SetAxisRange(4, 5, 25);\n  actor->GetLegendActor()->SetNumberOfEntries(numTuples);\n  for (int i = 0; i < numTuples; i++)\n  {\n    double r, g, b;\n    r = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    g = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    b = randomSequence->GetRangeValue(0.4, 1.0);\n    randomSequence->Next();\n    actor->SetPlotColor(i, r, g, b);\n  }\n  actor->LegendVisibilityOn();\n\n  // Set text colors\n  actor->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  actor->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren1->AddActor(actor);\n  ren1->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renWin->SetSize(600, 500);\n  renWin->SetWindowName(\"SpiderPlot\");\n\n  // render the image\n  iren->Initialize();\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/SpiderPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SpiderPlot)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SpiderPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SpiderPlot MACOSX_BUNDLE SpiderPlot.cxx )\n  target_link_libraries(SpiderPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SpiderPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/SpiderPlot/#download-and-build-spiderplot","title":"Download and Build SpiderPlot","text":"

        Click here to download SpiderPlot and its CMakeLists.txt file. Once the tarball SpiderPlot.tar has been downloaded and extracted,

        cd SpiderPlot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SpiderPlot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/StackedBar/","title":"StackedBar","text":"

        vtk-examples/Cxx/Plotting/StackedBar

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/StackedBar/#code","title":"Code","text":"

        StackedBar.cxx

        #include <vtkAxis.h>\n#include <vtkChartLegend.h>\n#include <vtkChartXY.h>\n#include <vtkColorSeries.h>\n#include <vtkContextView.h>\n#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotBar.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStringArray.h>\n#include <vtkTable.h>\n#include <vtkTextProperty.h>\n\nnamespace {\nconstexpr int num_months = 12;\n\nconstexpr int month[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};\n\nconstexpr int book_2008[] = {5675, 5902, 6388, 5990, 5575, 7393,\n                             9878, 8082, 6417, 5946, 5526, 5166};\nconstexpr int new_popular_2008[] = {701, 687, 736, 696, 750, 814,\n                                    923, 860, 786, 735, 680, 741};\nconstexpr int periodical_2008[] = {184, 176, 166, 131, 171, 191,\n                                   231, 166, 197, 162, 152, 143};\nconstexpr int audiobook_2008[] = {903,  1038, 987,  1073, 1144, 1203,\n                                  1173, 1196, 1213, 1076, 926,  874};\nconstexpr int video_2008[] = {1524, 1565, 1627, 1445, 1179, 1816,\n                              2293, 1811, 1588, 1561, 1542, 1563};\n\nconstexpr int book_2009[] = {6388, 5990, 5575, 9878, 8082, 5675,\n                             7393, 5902, 5526, 5166, 5946, 6417};\nconstexpr int new_popular_2009[] = {696, 735, 786, 814, 736, 860,\n                                    750, 687, 923, 680, 741, 701};\nconstexpr int periodical_2009[] = {197, 166, 176, 231, 171, 152,\n                                   166, 131, 184, 191, 143, 162};\nconstexpr int audiobook_2009[] = {1213, 1076, 926,  987,  903, 1196,\n                                  1073, 1144, 1203, 1038, 874, 1173};\nconstexpr int video_2009[] = {2293, 1561, 1542, 1627, 1588, 1179,\n                              1563, 1445, 1811, 1565, 1524, 1816};\n\nvoid build_array(const char* name, vtkIntArray* array, const int c_array[])\n{\n  array->SetName(name);\n  for (int i = 0; i < num_months; ++i)\n  {\n    array->InsertNextValue(c_array[i]);\n  }\n}\n\n} // namespace\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderWindow()->SetSize(500, 350);\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkIntArray> arrMonth;\n  build_array(\"Month\", arrMonth, month);\n  table->AddColumn(arrMonth);\n\n  vtkNew<vtkIntArray> arrBooks2008;\n  build_array(\"Books 2008\", arrBooks2008, book_2008);\n  table->AddColumn(arrBooks2008);\n  vtkNew<vtkIntArray> arrNewPopular2008;\n  build_array(\"New / Popular 2008\", arrNewPopular2008, new_popular_2008);\n  table->AddColumn(arrNewPopular2008);\n  vtkNew<vtkIntArray> arrPeriodical2008;\n  build_array(\"Periodical 2008\", arrPeriodical2008, periodical_2008);\n  table->AddColumn(arrPeriodical2008);\n  vtkNew<vtkIntArray> arrAudiobook2008;\n  build_array(\"Audiobook 2008\", arrAudiobook2008, audiobook_2008);\n  table->AddColumn(arrAudiobook2008);\n  vtkNew<vtkIntArray> arrVideo2008;\n  build_array(\"Video 2008\", arrVideo2008, video_2008);\n  table->AddColumn(arrVideo2008);\n\n  vtkNew<vtkIntArray> arrBooks2009;\n  build_array(\"Books 2009\", arrBooks2009, book_2009);\n  table->AddColumn(arrBooks2009);\n  vtkNew<vtkIntArray> arrNewPopular2009;\n  build_array(\"New / Popular 2009\", arrNewPopular2009, new_popular_2009);\n  table->AddColumn(arrNewPopular2009);\n  vtkNew<vtkIntArray> arrPeriodical2009;\n  build_array(\"Periodical 2009\", arrPeriodical2009, periodical_2009);\n  table->AddColumn(arrPeriodical2009);\n  vtkNew<vtkIntArray> arrAudiobook2009;\n  build_array(\"Audiobook 2009\", arrAudiobook2009, audiobook_2009);\n  table->AddColumn(arrAudiobook2009);\n  vtkNew<vtkIntArray> arrVideo2009;\n  build_array(\"Video 2009\", arrVideo2009, video_2009);\n  table->AddColumn(arrVideo2009);\n\n  // Create a color series to use with our stacks.\n  vtkNew<vtkColorSeries> colorSeries1;\n  colorSeries1->SetColorScheme(vtkColorSeries::WILD_FLOWER);\n\n  // Add multiple line plots, setting the colors etc.\n  vtkPlotBar* bar = 0;\n\n  bar = dynamic_cast<vtkPlotBar*>(chart->AddPlot(vtkChart::BAR));\n  bar->SetColorSeries(colorSeries1);\n  bar->SetInputData(table, \"Month\", \"Books 2008\");\n  bar->SetInputArray(2, \"New / Popular 2008\");\n  bar->SetInputArray(3, \"Periodical 2008\");\n  bar->SetInputArray(4, \"Audiobook 2008\");\n  bar->SetInputArray(5, \"Video 2008\");\n\n  vtkNew<vtkColorSeries> colorSeries2;\n  colorSeries2->SetColorScheme(vtkColorSeries::WILD_FLOWER);\n\n  bar = dynamic_cast<vtkPlotBar*>(chart->AddPlot(vtkChart::BAR));\n  bar->SetColorSeries(colorSeries2);\n  bar->SetInputData(table, \"Month\", \"Books 2009\");\n  bar->SetInputArray(2, \"New / Popular 2009\");\n  bar->SetInputArray(3, \"Periodical 2009\");\n  bar->SetInputArray(4, \"Audiobook 2009\");\n  bar->SetInputArray(5, \"Video 2009\");\n\n  chart->SetShowLegend(true);\n  vtkAxis* axis = chart->GetAxis(vtkAxis::BOTTOM);\n  axis->SetBehavior(1);\n  axis->SetMaximum(13.0);\n  axis->SetTitle(\"Month\");\n  chart->GetAxis(vtkAxis::LEFT)->SetTitle(\"\");\n  chart->SetTitle(\"Circulation 2008, 2009\");\n\n  // Set up the legend to be off to the top right of the viewport.\n  chart->GetLegend()->SetInline(false);\n  chart->GetLegend()->SetHorizontalAlignment(vtkChartLegend::RIGHT);\n  chart->GetLegend()->SetVerticalAlignment(vtkChartLegend::TOP);\n\n  // Set up some custom labels for months.\n  vtkNew<vtkDoubleArray> dates;\n  vtkNew<vtkStringArray> strings;\n  dates->InsertNextValue(1);\n  strings->InsertNextValue(\"January\");\n  dates->InsertNextValue(2);\n  strings->InsertNextValue(\"February\");\n  dates->InsertNextValue(3);\n  strings->InsertNextValue(\"March\");\n  dates->InsertNextValue(4);\n  strings->InsertNextValue(\"April\");\n  dates->InsertNextValue(5);\n  strings->InsertNextValue(\"May\");\n  dates->InsertNextValue(6);\n  strings->InsertNextValue(\"June\");\n  dates->InsertNextValue(7);\n  strings->InsertNextValue(\"July\");\n  dates->InsertNextValue(8);\n  strings->InsertNextValue(\"August\");\n  dates->InsertNextValue(9);\n  strings->InsertNextValue(\"September\");\n  dates->InsertNextValue(10);\n  strings->InsertNextValue(\"October\");\n  dates->InsertNextValue(11);\n  strings->InsertNextValue(\"November\");\n  dates->InsertNextValue(12);\n  strings->InsertNextValue(\"December\");\n  axis->SetCustomTickPositions(dates, strings);\n  axis->GetLabelProperties()->SetOrientation(90);\n  axis->GetLabelProperties()->SetVerticalJustification(VTK_TEXT_CENTERED);\n  axis->GetLabelProperties()->SetJustification(VTK_TEXT_RIGHT);\n\n  // Finally render the scene and compare the image to a reference image.\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Cornsilk\").GetData());\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderWindow()->Render();\n  view->GetRenderWindow()->SetSize(600, 400);\n  view->GetRenderWindow()->SetWindowName(\"StackedBar\");\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/StackedBar/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StackedBar)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StackedBar: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StackedBar MACOSX_BUNDLE StackedBar.cxx )\n  target_link_libraries(StackedBar PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StackedBar\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/StackedBar/#download-and-build-stackedbar","title":"Download and Build StackedBar","text":"

        Click here to download StackedBar and its CMakeLists.txt file. Once the tarball StackedBar.tar has been downloaded and extracted,

        cd StackedBar/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StackedBar\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/StackedPlot/","title":"StackedPlot","text":"

        vtk-examples/Cxx/Plotting/StackedPlot

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/StackedPlot/#code","title":"Code","text":"

        StackedPlot.cxx

        #include <vtkAxis.h>\n#include <vtkChartXY.h>\n#include <vtkColorSeries.h>\n#include <vtkContextView.h>\n#include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlotStacked.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStringArray.h>\n#include <vtkTable.h>\n\nnamespace {\n// Monthly checkout data.\nstd::string month_labels[] = {\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\n                              \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"};\nconstexpr int book[] = {5675, 5902, 6388, 5990, 5575, 7393,\n                        9878, 8082, 6417, 5946, 5526, 5166};\nconstexpr int new_popular[] = {701, 687, 736, 696, 750, 814,\n                               923, 860, 786, 735, 680, 741};\nconstexpr int periodical[] = {184, 176, 166, 131, 171, 191,\n                              231, 166, 197, 162, 152, 143};\nconstexpr int audiobook[] = {903,  1038, 987,  1073, 1144, 1203,\n                             1173, 1196, 1213, 1076, 926,  874};\nconstexpr int video[] = {1524, 1565, 1627, 1445, 1179, 1816,\n                         2293, 1811, 1588, 1561, 1542, 1563};\n} // namespace\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up a 2D scene, add an XY chart to it.\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(1.0, 1.0, 1.0);\n  view->GetRenderWindow()->SetSize(400, 300);\n  vtkNew<vtkChartXY> chart;\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkStringArray> arrMonthLabel;\n  arrMonthLabel->SetNumberOfValues(12);\n\n  vtkNew<vtkDoubleArray> arrXTickPositions;\n  arrXTickPositions->SetNumberOfValues(12);\n\n  vtkNew<vtkIntArray> arrMonth;\n  arrMonth->SetName(\"Month\");\n  table->AddColumn(arrMonth);\n\n  vtkNew<vtkIntArray> arrBook;\n  arrBook->SetName(\"Books\");\n  table->AddColumn(arrBook);\n\n  vtkNew<vtkIntArray> arrNewPopularBook;\n  arrNewPopularBook->SetName(\"New / Popular\");\n  table->AddColumn(arrNewPopularBook);\n\n  vtkNew<vtkIntArray> arrPeriodical;\n  arrPeriodical->SetName(\"Periodical\");\n  table->AddColumn(arrPeriodical);\n\n  vtkNew<vtkIntArray> arrAudiobook;\n  arrAudiobook->SetName(\"Audiobook\");\n  table->AddColumn(arrAudiobook);\n\n  vtkNew<vtkIntArray> arrVideo;\n  arrVideo->SetName(\"Video\");\n  table->AddColumn(arrVideo);\n\n  table->SetNumberOfRows(12);\n  for (int i = 0; i < 12; i++)\n  {\n    arrMonthLabel->SetValue(i, month_labels[i]);\n    arrXTickPositions->SetValue(i, i);\n\n    arrBook->SetValue(i, book[i]);\n    arrNewPopularBook->SetValue(i, new_popular[i]);\n    arrPeriodical->SetValue(i, periodical[i]);\n    arrAudiobook->SetValue(i, audiobook[i]);\n    arrVideo->SetValue(i, video[i]);\n  }\n\n  // Set the Month Labels\n  chart->GetAxis(1)->SetCustomTickPositions(arrXTickPositions, arrMonthLabel);\n  chart->GetAxis(1)->SetMaximum(11);\n\n  chart->GetAxis(1)->SetRange(0, 11);\n  chart->GetAxis(1)->SetBehavior(vtkAxis::FIXED);\n  chart->GetAxis(1)->SetTitle(\"Month\");\n\n  chart->SetShowLegend(true);\n\n  chart->GetAxis(0)->SetTitle(\"Checkouts\");\n\n  // Add multiple line plots, setting the colors etc.\n  vtkPlotStacked* stack = 0;\n\n  // Books\n  stack = dynamic_cast<vtkPlotStacked*>(chart->AddPlot(vtkChart::STACKED));\n  stack->SetUseIndexForXSeries(true);\n  stack->SetInputData(table);\n  stack->SetInputArray(1, \"Books\");\n  stack->SetInputArray(2, \"New / Popular\");\n  stack->SetInputArray(3, \"Periodical\");\n  stack->SetInputArray(4, \"Audiobook\");\n  stack->SetInputArray(5, \"Video\");\n\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::WILD_FLOWER);\n  stack->SetColorSeries(colorSeries);\n\n  // Finally render the scene and compare the image to a reference image.\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Cornsilk\").GetData());\n  view->GetRenderWindow()->SetSize(600, 400);\n  view->GetRenderWindow()->SetWindowName(\"StackedPlot\");\n  view->GetRenderWindow()->Render();\n  view->GetInteractor()->Initialize();\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/StackedPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StackedPlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StackedPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StackedPlot MACOSX_BUNDLE StackedPlot.cxx )\n  target_link_libraries(StackedPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StackedPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/StackedPlot/#download-and-build-stackedplot","title":"Download and Build StackedPlot","text":"

        Click here to download StackedPlot and its CMakeLists.txt file. Once the tarball StackedPlot.tar has been downloaded and extracted,

        cd StackedPlot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StackedPlot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Plotting/SurfacePlot/","title":"SurfacePlot","text":"

        vtk-examples/Cxx/Plotting/SurfacePlot

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Plotting/SurfacePlot/#description","title":"Description","text":"

        This examples creates a vtkChartXYZ that contains a vtkPlotSurface.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Plotting/SurfacePlot/#code","title":"Code","text":"

        SurfacePlot.cxx

        #include <vtkChartXYZ.h>\n#include <vtkContextMouseEvent.h>\n#include <vtkContextScene.h>\n#include <vtkContextView.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPen.h>\n#include <vtkPlotSurface.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90220220630ULL\n#define VTK_HAS_SETCOLORF 1\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkChartXYZ> chart;\n  chart->SetGeometry(vtkRectf(10.0, 10.0, 630, 470));\n\n  vtkNew<vtkPlotSurface> plot;\n\n  vtkNew<vtkContextView> view;\n  view->GetRenderer()->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetScene()->AddItem(chart);\n\n  // Create a surface.\n  vtkNew<vtkTable> table;\n  vtkIdType numPoints = 70;\n  float inc = 9.424778 / (numPoints - 1);\n  for (vtkIdType i = 0; i < numPoints; ++i)\n  {\n    vtkNew<vtkFloatArray> arr;\n    table->AddColumn(arr);\n  }\n\n  table->SetNumberOfRows(static_cast<vtkIdType>(numPoints));\n  for (vtkIdType i = 0; i < numPoints; ++i)\n  {\n    float x = i * inc;\n    for (vtkIdType j = 0; j < numPoints; ++j)\n    {\n      float y = j * inc;\n      table->SetValue(i, j, sin(sqrt(x * x + y * y)));\n    }\n  }\n\n  // Set up the surface plot we wish to visualize and add it to the chart.\n  plot->SetXRange(0, 10.0);\n  plot->SetYRange(0, 10.0);\n  plot->SetInputData(table);\n#if VTK_HAS_SETCOLORF\n  plot->GetPen()->SetColorF(colors->GetColor3d(\"Tomato\").GetData());\n#else\n  plot->GetPen()->SetColorF(colors->GetColor3d(\"Tomato\").GetData());\n#endif\n  chart->AddPlot(plot);\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n  view->GetInteractor()->Initialize();\n  view->GetRenderWindow()->SetWindowName(\"SurfacePlot\");\n  view->GetRenderWindow()->Render();\n\n  // rotate\n  vtkContextMouseEvent mouseEvent;\n  mouseEvent.SetInteractor(view->GetInteractor());\n\n  vtkVector2i pos;\n\n  vtkVector2i lastPos;\n  mouseEvent.SetButton(vtkContextMouseEvent::LEFT_BUTTON);\n  lastPos.Set(100, 50);\n  mouseEvent.SetLastScreenPos(lastPos);\n  pos.Set(150, 100);\n  mouseEvent.SetScreenPos(pos);\n\n  vtkVector2d sP(pos.Cast<double>().GetData());\n  vtkVector2d lSP(lastPos.Cast<double>().GetData());\n  vtkVector2d screenPos(mouseEvent.GetScreenPos().Cast<double>().GetData());\n  vtkVector2d lastScreenPos(\n      mouseEvent.GetLastScreenPos().Cast<double>().GetData());\n\n  chart->MouseMoveEvent(mouseEvent);\n\n  view->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Plotting/SurfacePlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SurfacePlot)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContext2D\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SurfacePlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SurfacePlot MACOSX_BUNDLE SurfacePlot.cxx )\n  target_link_libraries(SurfacePlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SurfacePlot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Plotting/SurfacePlot/#download-and-build-surfaceplot","title":"Download and Build SurfacePlot","text":"

        Click here to download SurfacePlot and its CMakeLists.txt file. Once the tarball SurfacePlot.tar has been downloaded and extracted,

        cd SurfacePlot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SurfacePlot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/CompareExtractSurface/","title":"CompareExtractSurface","text":"

        vtk-examples/Cxx/Points/CompareExtractSurface

        "},{"location":"Cxx/Points/CompareExtractSurface/#description","title":"Description","text":"

        This example compares three surface reconstruction algorithms:

        1. ExtractSurface
        2. PoissonReconstruction
        3. Powercrust

        We usually try to keep examples short, but this example teaches several concepts.

        1. Compare multiple algorithms
        2. Time multiple algorithms
        3. Reuse code from other examples
        4. Use multiple remote modules
        5. Generate figures for papers

        Warning

        This example runs longer than most. Be patient.

        Info

        See PoissonReconstruction Remote Module to configure.

        Info

        See Powercrust Remote Module to configure.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/CompareExtractSurface/#code","title":"Code","text":"

        CompareExtractSurface.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkCoordinate.h>\n#include <vtkExtractSurface.h>\n#include <vtkNamedColors.h>\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointData.h>\n#include <vtkPoissonReconstruction.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkPolyLine.h>\n#include <vtkPowerCrustSurfaceReconstruction.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSignedDistance.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTimerLog.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\nvtkSmartPointer<vtkPolyDataAlgorithm> MakeExtractSurface(vtkPolyData*);\nvtkSmartPointer<vtkPolyDataAlgorithm> MakePoissonExtractSurface(vtkPolyData*);\nvtkSmartPointer<vtkPolyDataAlgorithm>\nMakePowercrustExtractSurface(vtkPolyData*);\nvoid MakeViewportGrid(std::vector<vtkSmartPointer<vtkRenderer>>& renderers,\n                      unsigned int renderersize, unsigned int xGridDimensions,\n                      unsigned int yGridDimensions);\nvoid ViewportBorder(vtkSmartPointer<vtkRenderer>& renderer, double* color,\n                    bool last = false);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  std::cout << \"# of points: \" << polyData->GetNumberOfPoints() << std::endl;\n\n  auto colors = vtkSmartPointer<vtkNamedColors>::New();\n\n  auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();\n\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> surfaceObjects;\n  surfaceObjects.push_back(MakeExtractSurface(polyData.GetPointer()));\n  surfaceObjects.push_back(MakePoissonExtractSurface(polyData.GetPointer()));\n  surfaceObjects.push_back(MakePowercrustExtractSurface(polyData.GetPointer()));\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  // One camera for all\n  auto camera = vtkSmartPointer<vtkCamera>::New();\n  for (size_t i = 0; i < surfaceObjects.size(); ++i)\n  {\n    auto timer = vtkSmartPointer<vtkTimerLog>::New();\n    timer->StartTimer();\n    surfaceObjects[i]->Update();\n    timer->StopTimer();\n\n    auto surfaceMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n    surfaceMapper->SetInputConnection(surfaceObjects[i]->GetOutputPort());\n\n    auto back = vtkSmartPointer<vtkProperty>::New();\n    back->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n    back->SetSpecular(.6);\n    back->SetSpecularPower(50.0);\n\n    auto surfaceActor = vtkSmartPointer<vtkActor>::New();\n    surfaceActor->SetMapper(surfaceMapper);\n    surfaceActor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"Tomato\").GetData());\n    surfaceActor->GetProperty()->SetSpecular(.6);\n    surfaceActor->GetProperty()->SetSpecularPower(50.0);\n    surfaceActor->SetBackfaceProperty(back);\n    // Setup renderer\n    auto renderer = vtkSmartPointer<vtkRenderer>::New();\n    renderer->AddActor(surfaceActor);\n    renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    renderer->SetActiveCamera(camera);\n    renderer->GetActiveCamera()->SetPosition(-1, 0, 0);\n    renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n    renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n    renderer->GetActiveCamera()->Dolly(5);\n    renderer->ResetCamera();\n    renderer->ResetCameraClippingRange();\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n\n    auto textProperty = vtkSmartPointer<vtkTextProperty>::New();\n    textProperty->SetFontSize(15);\n    textProperty->SetJustificationToCentered();\n\n    std::stringstream ss;\n    ss << surfaceObjects[i]->GetClassName() << std::endl;\n    ss << \"# of Polys: \" << surfaceObjects[i]->GetOutput()->GetNumberOfPolys()\n       << std::endl;\n    ss << \"Time: \" << timer->GetElapsedTime() << std::endl;\n\n    auto textMapper = vtkSmartPointer<vtkTextMapper>::New();\n    textMapper->SetInput(ss.str().c_str());\n    textMapper->SetTextProperty(textProperty);\n\n    auto textActor = vtkSmartPointer<vtkActor2D>::New();\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(200, 0);\n    textActor->GetProperty()->SetLineWidth(4.0); // Line Width\n\n    renderer->AddViewProp(textActor);\n  }\n\n  unsigned int rendererSize = 400;\n  unsigned int xGridDimensions = 3;\n  unsigned int yGridDimensions = 1;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n\n  MakeViewportGrid(renderers, rendererSize, xGridDimensions, yGridDimensions);\n  for (size_t i = 0; i < renderers.size(); ++i)\n  {\n    ViewportBorder(renderers[i], colors->GetColor3d(\"Gold\").GetData(),\n                   i == renderers.size() - 1);\n  }\n  auto iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvtkSmartPointer<vtkPolyDataAlgorithm> MakeExtractSurface(vtkPolyData* polyData)\n{\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = polyData->GetNumberOfPoints() * .00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 50;\n  }\n\n  // Do we need to estimate normals?\n  auto distance = vtkSmartPointer<vtkSignedDistance>::New();\n  if (polyData->GetPointData()->GetNormals())\n  {\n    std::cout << \"ExtractSurface: Using normals from input file\" << std::endl;\n    distance->SetInputData(polyData);\n  }\n  else\n  {\n    std::cout << \" ExtractSurface: Estimating normals using PCANormalEstimation\"\n              << std::endl;\n    auto normals = vtkSmartPointer<vtkPCANormalEstimation>::New();\n    normals->SetInputData(polyData);\n    normals->SetSampleSize(sampleSize);\n    normals->SetNormalOrientationToGraphTraversal();\n    normals->FlipNormalsOn();\n    distance->SetInputConnection(normals->GetOutputPort());\n  }\n  int dimension = 256;\n  double radius;\n  radius = std::max(std::max(range[0], range[1]), range[2]) /\n      static_cast<double>(dimension) * 4; // ~4 voxels\n\n  distance->SetRadius(radius);\n  distance->SetDimensions(dimension, dimension, dimension);\n  distance->SetBounds(bounds[0] - range[0] * .1, bounds[1] + range[0] * .1,\n                      bounds[2] - range[1] * .1, bounds[3] + range[1] * .1,\n                      bounds[4] - range[2] * .1, bounds[5] + range[2] * .1);\n\n  auto surface = vtkSmartPointer<vtkExtractSurface>::New();\n  surface->SetInputConnection(distance->GetOutputPort());\n  surface->SetRadius(radius * .99);\n  return surface;\n}\nvtkSmartPointer<vtkPolyDataAlgorithm>\nMakePoissonExtractSurface(vtkPolyData* polyData)\n{\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = polyData->GetNumberOfPoints() * .00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 10;\n  }\n\n  auto surface = vtkSmartPointer<vtkPoissonReconstruction>::New();\n  surface->SetDepth(12);\n  if (polyData->GetPointData()->GetNormals())\n  {\n    std::cout << \"PoissonReconstruction: Using normals from input file\"\n              << std::endl;\n    surface->SetInputData(polyData);\n  }\n  else\n  {\n    std::cout << \"ExtractSurface: Estimating normals using PCANormalEstimation\"\n              << std::endl;\n    auto normals = vtkSmartPointer<vtkPCANormalEstimation>::New();\n    normals->SetInputData(polyData);\n    normals->SetSampleSize(sampleSize);\n    normals->SetNormalOrientationToGraphTraversal();\n    normals->FlipNormalsOff();\n    surface->SetInputConnection(normals->GetOutputPort());\n  }\n  return surface;\n}\nvtkSmartPointer<vtkPolyDataAlgorithm>\nMakePowercrustExtractSurface(vtkPolyData* polyData)\n{\n  auto surface = vtkSmartPointer<vtkPowerCrustSurfaceReconstruction>::New();\n  surface->SetInputData(polyData);\n  return surface;\n}\n\nvoid MakeViewportGrid(std::vector<vtkSmartPointer<vtkRenderer>>& renderers,\n                      unsigned int rendererSize, unsigned int xGridDimensions,\n                      unsigned int yGridDimensions)\n{\n  //\n  // Setup viewports for the renderers\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      auto index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n}\n// draw the borders of a renderer's viewport\nvoid ViewportBorder(vtkSmartPointer<vtkRenderer>& renderer, double* color,\n                    bool last)\n{\n  // points start at upper right and proceed anti-clockwise\n  auto points = vtkSmartPointer<vtkPoints>::New();\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  // create cells, and lines\n  auto cells = vtkSmartPointer<vtkCellArray>::New();\n  cells->Initialize();\n\n  auto lines = vtkSmartPointer<vtkPolyLine>::New();\n\n  // only draw last line if this is the last viewport\n  // this prevents double vertical lines at right border\n  // if different colors are used for each border, then do\n  // not specify last\n  if (last)\n  {\n    lines->GetPointIds()->SetNumberOfIds(5);\n  }\n  else\n  {\n    lines->GetPointIds()->SetNumberOfIds(4);\n  }\n  for (unsigned int i = 0; i < 4; ++i)\n  {\n    lines->GetPointIds()->SetId(i, i);\n  }\n  if (last)\n  {\n    lines->GetPointIds()->SetId(4, 0);\n  }\n  cells->InsertNextCell(lines);\n\n  // now make the polydata and display it\n  auto poly = vtkSmartPointer<vtkPolyData>::New();\n  poly->Initialize();\n  poly->SetPoints(points);\n  poly->SetLines(cells);\n\n  // use normalized viewport coordinates since\n  // they are independent of window size\n  auto coordinate = vtkSmartPointer<vtkCoordinate>::New();\n  coordinate->SetCoordinateSystemToNormalizedViewport();\n\n  auto mapper = vtkSmartPointer<vtkPolyDataMapper2D>::New();\n  mapper->SetInputData(poly);\n  mapper->SetTransformCoordinate(coordinate);\n\n  auto actor = vtkSmartPointer<vtkActor2D>::New();\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(color);\n  // line width should be at least 2 to be visible at extremes\n\n  actor->GetProperty()->SetLineWidth(4.0); // Line Width\n\n  renderer->AddViewProp(actor);\n}\n\n} // namespace\n
        "},{"location":"Cxx/Points/CompareExtractSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CompareExtractSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonSystem\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CompareExtractSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CompareExtractSurface MACOSX_BUNDLE CompareExtractSurface.cxx )\n  target_link_libraries(CompareExtractSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CompareExtractSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/CompareExtractSurface/#download-and-build-compareextractsurface","title":"Download and Build CompareExtractSurface","text":"

        Click here to download CompareExtractSurface and its CMakeLists.txt file. Once the tarball CompareExtractSurface.tar has been downloaded and extracted,

        cd CompareExtractSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CompareExtractSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/DensifyPoints/","title":"DensifyPoints","text":"

        vtk-examples/Cxx/Points/DensifyPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Points/DensifyPoints/#description","title":"Description","text":"

        In this example, the original points are yellow and the added points are red.

        The image was produced using src/Testing/Data/Torso.vtp.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/DensifyPoints/#code","title":"Code","text":"

        DensifyPoints.cxx

        #include <vtkCamera.h>\n#include <vtkDensifyPointCloudFilter.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n\n  double maxRange = std::max(std::max(range[0], range[1]), range[2]);\n\n  std::cout << \"# of original points: \" << polyData->GetNumberOfPoints()\n            << std::endl;\n  vtkNew<vtkDensifyPointCloudFilter> densify;\n  densify->SetInputData(polyData);\n  densify->SetMaximumNumberOfIterations(5);\n  densify->SetTargetDistance(maxRange * .03);\n  densify->SetNumberOfClosestPoints(10);\n  densify->Update();\n  std::cout << \"# of densified points: \"\n            << densify->GetOutput()->GetNumberOfPoints() << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  ///\n  double radius = maxRange * .01;\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetRadius(radius);\n\n  vtkNew<vtkGlyph3DMapper> glyph3D1;\n  glyph3D1->SetInputData(polyData);\n  glyph3D1->SetSourceConnection(sphereSource1->GetOutputPort());\n  glyph3D1->ScalarVisibilityOff();\n  glyph3D1->ScalingOff();\n\n  vtkNew<vtkActor> glyph3DActor1;\n  glyph3DActor1->SetMapper(glyph3D1);\n  glyph3DActor1->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetRadius(radius * .75);\n\n  vtkNew<vtkGlyph3DMapper> glyph3D2;\n  glyph3D2->SetInputConnection(densify->GetOutputPort());\n  glyph3D2->SetSourceConnection(sphereSource2->GetOutputPort());\n  glyph3D2->ScalarVisibilityOff();\n  glyph3D2->ScalingOff();\n\n  vtkNew<vtkActor> glyph3DActor2;\n  glyph3DActor2->SetMapper(glyph3D2);\n  glyph3DActor2->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create graphics stuff.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"DensifyPoints\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(glyph3DActor1);\n  ren1->AddActor(glyph3DActor2);\n\n  // Generate an interesting view\n  //\n  ren1->GetActiveCamera()->SetPosition(1, 0, 0);\n  ren1->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  ren1->GetActiveCamera()->SetViewUp(0, 0, 1);\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Points/DensifyPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DensifyPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DensifyPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DensifyPoints MACOSX_BUNDLE DensifyPoints.cxx )\n  target_link_libraries(DensifyPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DensifyPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/DensifyPoints/#download-and-build-densifypoints","title":"Download and Build DensifyPoints","text":"

        Click here to download DensifyPoints and its CMakeLists.txt file. Once the tarball DensifyPoints.tar has been downloaded and extracted,

        cd DensifyPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DensifyPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/ExtractClusters/","title":"ExtractClusters","text":"

        vtk-examples/Cxx/Points/ExtractClusters

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Points/ExtractClusters/#description","title":"Description","text":"

        This example extracts clusters of points. The points lie on spheres that are randomly placed. Each cluster has a different color. The number of extracted clusters may be less that the number of random spheres, if the points on one sphere are within the specified distance of points on another sphere.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/ExtractClusters/#code","title":"Code","text":"

        ExtractClusters.cxx

        #include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkEuclideanClusterExtraction.h>\n#include <vtkGlyph3D.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  // randomSequence->SetSeed(8775070);\n  randomSequence->SetSeed(4355412);\n\n  double limits = 10;\n  double radius = 0.5;\n\n  vtkNew<vtkAppendPolyData> append;\n  for (unsigned i = 0; i < 30; ++i)\n  {\n    vtkNew<vtkPointSource> points;\n\n    points->SetNumberOfPoints(800);\n    points->SetRadius(2.5 * radius);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-limits, limits);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-limits, limits);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-limits, limits);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n\n    append->AddInputConnection(points->GetOutputPort());\n  }\n\n  vtkNew<vtkEuclideanClusterExtraction> cluster;\n  cluster->SetInputConnection(append->GetOutputPort());\n  cluster->SetExtractionModeToAllClusters();\n  cluster->SetRadius(radius);\n  cluster->ColorClustersOn();\n  cluster->Update();\n\n  std::cout << \"Found \" << cluster->GetNumberOfExtractedClusters()\n            << \" clusters within radius \" << radius << std::endl;\n\n  // Create a lookup table to map point data to colors\n  vtkNew<vtkLookupTable> lut;\n  int tableSize = cluster->GetNumberOfExtractedClusters();\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n\n  // Fill in the lookup table\n  for (unsigned int i = 0; static_cast<int>(i) < tableSize; ++i)\n  {\n    double r, g, b;\n    r = randomSequence->GetRangeValue(0.25, 1.0);\n    randomSequence->Next();\n    g = randomSequence->GetRangeValue(0.25, 1.0);\n    randomSequence->Next();\n    b = randomSequence->GetRangeValue(0.25, 1.0);\n    randomSequence->Next();\n    lut->SetTableValue(i, r, g, b, 1.0);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetRadius(radius / 2.0);\n\n  vtkNew<vtkGlyph3D> glyphs;\n  glyphs->SetInputConnection(cluster->GetOutputPort());\n  glyphs->SetSourceConnection(sphere->GetOutputPort());\n  glyphs->ScalingOff();\n  glyphs->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphs->GetOutputPort());\n  mapper->SetScalarRange(0, tableSize - 1);\n  mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(640, 512);\n  renWin->SetWindowName(\"ExtractClusters\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer\n  //\n  ren1->AddActor(actor);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Points/ExtractClusters/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractClusters)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractClusters: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractClusters MACOSX_BUNDLE ExtractClusters.cxx )\n  target_link_libraries(ExtractClusters PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractClusters\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/ExtractClusters/#download-and-build-extractclusters","title":"Download and Build ExtractClusters","text":"

        Click here to download ExtractClusters and its CMakeLists.txt file. Once the tarball ExtractClusters.tar has been downloaded and extracted,

        cd ExtractClusters/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractClusters\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/ExtractEnclosedPoints/","title":"ExtractEnclosedPoints","text":"

        vtk-examples/Cxx/Points/ExtractEnclosedPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Points/ExtractEnclosedPoints/#description","title":"Description","text":"

        This example uses vtkExtractEnclosedPoints to select points that exist within a closed vtkPolyData surface. After reading a vtk polydata file, the example generates 10000 random points within the bounding box of the vtkPolyData.

        If the polydata is not closed or is non-manifold, the filter does not create an output.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/ExtractEnclosedPoints/#code","title":"Code","text":"

        ExtractEnclosedPoints.cxx

        #include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkExtractEnclosedPoints.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <random>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  std::mt19937 mt(4355412); // Standard mersenne_twister_engine\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \" \" << bounds[2]\n            << \", \" << bounds[3] << \" \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n  // Generate random points within the bounding box of the polydata\n  std::uniform_real_distribution<double> distributionX(bounds[0], bounds[1]);\n  std::uniform_real_distribution<double> distributionY(bounds[2], bounds[3]);\n  std::uniform_real_distribution<double> distributionZ(bounds[4], bounds[5]);\n  vtkNew<vtkPolyData> pointsPolyData;\n  vtkNew<vtkPoints> points;\n  pointsPolyData->SetPoints(points);\n\n  points->SetNumberOfPoints(10000);\n  for (auto i = 0; i < 10000; ++i)\n  {\n    double point[3];\n    point[0] = distributionX(mt);\n    point[1] = distributionY(mt);\n    point[2] = distributionZ(mt);\n    points->SetPoint(i, point);\n  }\n\n  vtkNew<vtkExtractEnclosedPoints> extract;\n  extract->SetSurfaceData(polyData);\n  extract->SetInputData(pointsPolyData);\n  extract->SetTolerance(.0001);\n  extract->CheckSurfaceOn();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> source;\n  source->SetRadius((bounds[1] - bounds[0]) * .005);\n\n  vtkNew<vtkGlyph3DMapper> glyph3Dmapper;\n  glyph3Dmapper->SetSourceConnection(source->GetOutputPort());\n  glyph3Dmapper->SetInputConnection(extract->GetOutputPort());\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyph3Dmapper);\n  glyphActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  glyphActor->GetProperty()->SetSpecular(0.6);\n  glyphActor->GetProperty()->SetSpecularPower(30);\n  ;\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  backProp->SetSpecular(0.6);\n  backProp->SetSpecularPower(30);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProp);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(0.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  actor->GetProperty()->SetOpacity(0.3);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyphActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  renderWindow->SetSize(640, 512);\n  renderWindow->SetWindowName(\"ExtractEnclosedPoints\");\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Points/ExtractEnclosedPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractEnclosedPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractEnclosedPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractEnclosedPoints MACOSX_BUNDLE ExtractEnclosedPoints.cxx )\n  target_link_libraries(ExtractEnclosedPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractEnclosedPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/ExtractEnclosedPoints/#download-and-build-extractenclosedpoints","title":"Download and Build ExtractEnclosedPoints","text":"

        Click here to download ExtractEnclosedPoints and its CMakeLists.txt file. Once the tarball ExtractEnclosedPoints.tar has been downloaded and extracted,

        cd ExtractEnclosedPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractEnclosedPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/ExtractPointsDemo/","title":"ExtractPointsDemo","text":"

        vtk-examples/Cxx/Points/ExtractPointsDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Points/ExtractPointsDemo/#description","title":"Description","text":"

        Demonstrates point extraction from four implicit functions: sphere, cone, cylinder and superquadric.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/ExtractPointsDemo/#code","title":"Code","text":"

        ExtractPointsDemo.cxx

        #include <vtkBoundedPointSource.h>\n#include <vtkCamera.h>\n#include <vtkCone.h>\n#include <vtkCylinder.h>\n#include <vtkExtractPoints.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphere.h>\n#include <vtkSphereSource.h>\n#include <vtkSuperquadric.h>\n\n#include <vector>\n\nint main(int /*argc*/, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create implicit functions\n  vtkNew<vtkCone> cone;\n  cone->SetAngle(30.0);\n  vtkNew<vtkSphere> sphere;\n  vtkNew<vtkCylinder> cylinder;\n  vtkNew<vtkSuperquadric> superquadric;\n  superquadric->SetPhiRoundness(2.5);\n  superquadric->SetThetaRoundness(0.5);\n\n  // Store the functions\n  std::vector<vtkSmartPointer<vtkImplicitFunction>> functions;\n  functions.push_back(sphere);\n  functions.push_back(cone);\n  functions.push_back(cylinder);\n  functions.push_back(superquadric);\n\n  vtkNew<vtkBoundedPointSource> pointSource;\n  pointSource->SetNumberOfPoints(100000);\n\n  // Rows and columns\n  unsigned int gridXDimensions = 2;\n  unsigned int gridYDimensions = 2;\n\n  // Need a renderer even if there is no actor\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  double background[6] = {0.4, 0.5, 0.6, 0.6, 0.5, 0.4};\n  for (size_t i = 0; i < gridXDimensions * gridYDimensions; i++)\n  {\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n    renderers[i]->SetBackground(background);\n    // auto fwdIt = std::rotate(background, background + 1, background + 6);\n  }\n\n  // Glyphs\n  double radius = 0.02;\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(radius);\n\n  // One render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  int rendererSize = 256;\n  renderWindow->SetSize(rendererSize * gridXDimensions,\n                        rendererSize * gridYDimensions);\n  renderWindow->SetWindowName(\"ExtractPointsDemo\");\n\n  // Create a pipeline for each function\n  for (int row = 0; row < static_cast<int>(gridYDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(gridXDimensions); col++)\n    {\n      int index = row * gridXDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (gridXDimensions * rendererSize),\n                            static_cast<double>(gridYDimensions - (row + 1)) *\n                                rendererSize / (gridYDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (gridXDimensions * rendererSize),\n                            static_cast<double>(gridYDimensions - row) *\n                                rendererSize /\n                                (gridYDimensions * rendererSize)};\n      renderWindow->AddRenderer(renderers[index]);\n      renderers[index]->SetViewport(viewport);\n      if (index > static_cast<int>(functions.size() - 1))\n      {\n        continue;\n      }\n      // Define the pipeline\n      vtkNew<vtkExtractPoints> extract;\n      extract->SetInputConnection(pointSource->GetOutputPort());\n      extract->SetImplicitFunction(functions[index]);\n\n      vtkNew<vtkGlyph3DMapper> glyph;\n      glyph->SetInputConnection(extract->GetOutputPort());\n      glyph->SetSourceConnection(sphereSource->GetOutputPort());\n      glyph->ScalingOff();\n\n      vtkNew<vtkActor> glyphActor;\n      glyphActor->SetMapper(glyph);\n      glyphActor->GetProperty()->SetColor(\n          colors->GetColor3d(\"MistyRose\").GetData());\n\n      renderers[index]->AddActor(glyphActor);\n      renderers[index]->ResetCamera();\n      renderers[index]->GetActiveCamera()->Azimuth(30);\n      renderers[index]->GetActiveCamera()->Elevation(-30);\n      renderers[index]->GetActiveCamera()->Dolly(1.1);\n      renderers[index]->ResetCameraClippingRange();\n    }\n  }\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Points/ExtractPointsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractPointsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersPoints\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractPointsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractPointsDemo MACOSX_BUNDLE ExtractPointsDemo.cxx )\n  target_link_libraries(ExtractPointsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractPointsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/ExtractPointsDemo/#download-and-build-extractpointsdemo","title":"Download and Build ExtractPointsDemo","text":"

        Click here to download ExtractPointsDemo and its CMakeLists.txt file. Once the tarball ExtractPointsDemo.tar has been downloaded and extracted,

        cd ExtractPointsDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractPointsDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/ExtractSurface/","title":"ExtractSurface","text":"

        vtk-examples/Cxx/Points/ExtractSurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Points/ExtractSurface/#description","title":"Description","text":"

        This example loosely follows the most excellent paper by Curless and Levoy: \"A Volumetric Method for Building Complex Models from Range Images.\" First it estimates normals from the points, then creates a signed distance field, followed by surface extraction of the zero-level set of the distance field.

        If the example is run without an argument, the example uses random points on a spherical shell. With a filename, the example uses the points on the vtkPolyData.

        The image was created using the Armadillo dataset, src/Testing/Data/Armadillo.ply.

        Info

        CompareExtractSurface compares three surface extraction algorithms.

        Seealso

        PowercrustExtractSurface reconstructs surfaces and is implemented as a VTK remote module. PoissonExtractSurface reconstructs surfaces and is implemented as a VTK remote module.

        Warning

        If you experience extraneous lines in the reconstruction, update your VTK. A patch was made on September 5, 2017 to correct the issue.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/ExtractSurface/#code","title":"Code","text":"

        ExtractSurface.cxx

        #include <vtkCamera.h>\n#include <vtkExtractSurface.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSignedDistance.h>\n#include <vtkSmartPointer.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  std::cout << \"# of points: \" << polyData->GetNumberOfPoints() << std::endl;\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = polyData->GetNumberOfPoints() * 0.00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 10;\n  }\n  std::cout << \"Sample size is: \" << sampleSize << std::endl;\n  // Do we need to estimate normals?\n  vtkNew<vtkSignedDistance> distance;\n  if (polyData->GetPointData()->GetNormals())\n  {\n    std::cout << \"Using normals from input file\" << std::endl;\n    distance->SetInputData(polyData);\n  }\n  else\n  {\n    std::cout << \"Estimating normals using PCANormalEstimation\" << std::endl;\n    vtkNew<vtkPCANormalEstimation> normals;\n    normals->SetInputData(polyData);\n    normals->SetSampleSize(sampleSize);\n    normals->SetNormalOrientationToGraphTraversal();\n    normals->FlipNormalsOn();\n    distance->SetInputConnection(normals->GetOutputPort());\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  int dimension = 256;\n  double radius;\n  radius = std::max(std::max(range[0], range[1]), range[2]) /\n      static_cast<double>(dimension) * 4; // ~4 voxels\n  std::cout << \"Radius: \" << radius << std::endl;\n\n  distance->SetRadius(radius);\n  distance->SetDimensions(dimension, dimension, dimension);\n  distance->SetBounds(bounds[0] - range[0] * .1, bounds[1] + range[0] * .1,\n                      bounds[2] - range[1] * .1, bounds[3] + range[1] * .1,\n                      bounds[4] - range[2] * .1, bounds[5] + range[2] * .1);\n\n  vtkNew<vtkExtractSurface> surface;\n  surface->SetInputConnection(distance->GetOutputPort());\n  surface->SetRadius(radius * .99);\n  surface->Update();\n\n  vtkNew<vtkPolyDataMapper> surfaceMapper;\n  surfaceMapper->SetInputConnection(surface->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  surfaceActor->SetBackfaceProperty(back);\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"ExtractSurface\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer,set the background and size.\n  ren1->AddActor(surfaceActor);\n\n  // Generate an interesting view.\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(1000);\n    points->SetRadius(1.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-1.0, 1.0);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-1.0, 1.0);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-1.0, 1.0);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Points/ExtractSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractSurface MACOSX_BUNDLE ExtractSurface.cxx )\n  target_link_libraries(ExtractSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/ExtractSurface/#download-and-build-extractsurface","title":"Download and Build ExtractSurface","text":"

        Click here to download ExtractSurface and its CMakeLists.txt file. Once the tarball ExtractSurface.tar has been downloaded and extracted,

        cd ExtractSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/ExtractSurfaceDemo/","title":"ExtractSurfaceDemo","text":"

        vtk-examples/Cxx/Points/ExtractSurfaceDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Points/ExtractSurfaceDemo/#description","title":"Description","text":"

        This example loosely follows the most excellent paper by Curless and Levoy: \"A Volumetric Method for Building Complex Models from Range Images.\" First it estimates normals from the points, then creates a signed distance field, followed by surface extraction of the zero-level set of the distance field.

        This is a demo version of ExtractSurface. It displays some a sampling of the normals with arrows. It also uses a different color for the front and back surfaces.

        The image was created using the Armadillo dataset, src/Testing/Data/Armadillo.ply.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/ExtractSurfaceDemo/#code","title":"Code","text":"

        ExtractSurfaceDemo.cxx

        #include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkExtractSurface.h>\n#include <vtkGlyph3D.h>\n#include <vtkMaskPoints.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSignedDistance.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvoid MakeGlyphs(vtkPolyData* src, double size, vtkGlyph3D* glyph);\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = 15;\n\n  std::cout << \"Sample size is: \" << sampleSize << std::endl;\n  // Do we need to estimate normals?\n  vtkNew<vtkSignedDistance> distance;\n  vtkNew<vtkPCANormalEstimation> normals;\n  if (polyData->GetPointData()->GetNormals())\n  {\n    std::cout << \"Using normals from input file\" << std::endl;\n    distance->SetInputData(polyData);\n  }\n  else\n  {\n    std::cout << \"Estimating normals using PCANormalEstimation\" << std::endl;\n    normals->SetInputData(polyData);\n    normals->SetSampleSize(sampleSize);\n    normals->SetNormalOrientationToGraphTraversal();\n    normals->FlipNormalsOn();\n    distance->SetInputConnection(normals->GetOutputPort());\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  int dimension = 512;\n  double radius;\n  radius = range[0] / static_cast<double>(dimension) * 3; // ~3 voxels\n  std::cout << \"Radius: \" << radius << std::endl;\n\n  distance->SetRadius(radius);\n  distance->SetDimensions(dimension, dimension, dimension);\n  distance->SetBounds(bounds[0] - range[0] * .1, bounds[1] + range[0] * .1,\n                      bounds[2] - range[1] * .1, bounds[3] + range[1] * .1,\n                      bounds[4] - range[2] * .1, bounds[5] + range[2] * .1);\n\n  vtkNew<vtkExtractSurface> surface;\n  surface->SetInputConnection(distance->GetOutputPort());\n  surface->SetRadius(radius * .99);\n  surface->HoleFillingOn();\n  surface->Update();\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  if (polyData->GetPointData()->GetNormals())\n  {\n    MakeGlyphs(polyData, radius * 2.0, glyph3D.GetPointer());\n  }\n  else\n  {\n    MakeGlyphs(normals->GetOutput(), radius * 2.0, glyph3D.GetPointer());\n  }\n  vtkNew<vtkPolyDataMapper> surfaceMapper;\n  surfaceMapper->SetInputConnection(surface->GetOutputPort());\n  surfaceMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetColor(colors->GetColor3d(\"Coral\").GetData());\n  surfaceActor->SetBackfaceProperty(backProp);\n\n  vtkNew<vtkPolyDataMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"ExtractSurfaceDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(surfaceActor);\n  ren1->AddActor(glyph3DActor);\n\n  // Generate an interesting view.\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\n//-----------------------------------------------------------------------------\nvoid MakeGlyphs(vtkPolyData* src, double size, vtkGlyph3D* glyph)\n{\n  vtkNew<vtkMaskPoints> maskPts;\n  maskPts->SetOnRatio(20);\n  maskPts->RandomModeOn();\n  maskPts->SetInputData(src);\n  // Source for the glyph filter.\n  vtkNew<vtkArrowSource> arrow;\n  arrow->SetTipResolution(16);\n  arrow->SetTipLength(0.3);\n  arrow->SetTipRadius(0.1);\n\n  glyph->SetSourceConnection(arrow->GetOutputPort());\n  glyph->SetInputConnection(maskPts->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  //  glyph->SetColorModeToColorByVector();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->SetScaleFactor(size);\n  glyph->OrientOn();\n  glyph->Update();\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // A random position.\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Points/ExtractSurfaceDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractSurfaceDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractSurfaceDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractSurfaceDemo MACOSX_BUNDLE ExtractSurfaceDemo.cxx )\n  target_link_libraries(ExtractSurfaceDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractSurfaceDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/ExtractSurfaceDemo/#download-and-build-extractsurfacedemo","title":"Download and Build ExtractSurfaceDemo","text":"

        Click here to download ExtractSurfaceDemo and its CMakeLists.txt file. Once the tarball ExtractSurfaceDemo.tar has been downloaded and extracted,

        cd ExtractSurfaceDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractSurfaceDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/FitImplicitFunction/","title":"FitImplicitFunction","text":"

        vtk-examples/Cxx/Points/FitImplicitFunction

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/FitImplicitFunction/#code","title":"Code","text":"

        FitImplicitFunction.cxx

        #include <vtkBoundedPointSource.h>\n#include <vtkCamera.h>\n#include <vtkFitImplicitFunction.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphere.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  double radius = 1.0;\n  vtkNew<vtkBoundedPointSource> points;\n  points->SetNumberOfPoints(1000000);\n  points->SetBounds(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0);\n\n  vtkNew<vtkSphere> sphere;\n  sphere->SetRadius(radius);\n\n  vtkNew<vtkFitImplicitFunction> fit;\n  fit->SetInputConnection(points->GetOutputPort());\n  fit->SetImplicitFunction(sphere);\n  fit->SetThreshold(0.01);\n  fit->Update();\n  std::cout << fit->GetOutput()->GetNumberOfPoints() << \" out of \"\n            << points->GetNumberOfPoints() << \" points are within \"\n            << fit->GetThreshold() << \" of the implicit function\" << std::endl;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(radius * 0.05);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputConnection(fit->GetOutputPort());\n  glyph3D->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  vtkNew<vtkPolyDataMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"FitImplicitFunction\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(glyph3DActor);\n\n  // Generate an interesting view.\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Points/FitImplicitFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FitImplicitFunction)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FitImplicitFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FitImplicitFunction MACOSX_BUNDLE FitImplicitFunction.cxx )\n  target_link_libraries(FitImplicitFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FitImplicitFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/FitImplicitFunction/#download-and-build-fitimplicitfunction","title":"Download and Build FitImplicitFunction","text":"

        Click here to download FitImplicitFunction and its CMakeLists.txt file. Once the tarball FitImplicitFunction.tar has been downloaded and extracted,

        cd FitImplicitFunction/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FitImplicitFunction\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/MaskPointsFilter/","title":"MaskPointsFilter","text":"

        vtk-examples/Cxx/Points/MaskPointsFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/MaskPointsFilter/#code","title":"Code","text":"

        MaskPointsFilter.cxx

        #include <vtkBoundedPointSource.h>\n#include <vtkCamera.h>\n#include <vtkCone.h>\n#include <vtkGlyph3D.h>\n#include <vtkImageData.h>\n#include <vtkImageThreshold.h>\n#include <vtkMaskPointsFilter.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleImplicitFunctionFilter.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvtkSmartPointer<vtkImageData> CreatePoints();\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkImageData> imageMask;\n  if (argc < 2)\n  {\n    imageMask = CreatePoints();\n  }\n  else\n  {\n    int upper = 1100;\n    if (argc > 2)\n    {\n      upper = atoi(argv[2]);\n    }\n    // Read the volume data e.g. FullHead.mhd\n    vtkNew<vtkMetaImageReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    vtkNew<vtkImageThreshold> threshold;\n    threshold->SetInputConnection(reader->GetOutputPort());\n    threshold->ThresholdByUpper(upper);\n    threshold->SetOutputScalarTypeToUnsignedChar();\n    threshold->ReplaceInOn();\n    threshold->SetInValue(255);\n    threshold->SetOutValue(0);\n    threshold->ReplaceOutOn();\n    threshold->Update();\n    imageMask = dynamic_cast<vtkImageData*>(threshold->GetOutput());\n  }\n  vtkNew<vtkBoundedPointSource> pointSource;\n  pointSource->SetNumberOfPoints(100000);\n  pointSource->SetBounds(imageMask->GetBounds());\n\n  vtkNew<vtkMaskPointsFilter> maskPoints;\n  maskPoints->SetInputConnection(pointSource->GetOutputPort());\n  maskPoints->SetMaskData(imageMask);\n\n  double radius = imageMask->GetSpacing()[0] * 4.0;\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(radius);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(maskPoints->GetOutputPort());\n  glyph->SetSourceConnection(sphereSource->GetOutputPort());\n  glyph->ScalingOff();\n  glyph->Update();\n\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyph->GetOutputPort());\n  glyphMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyphMapper);\n  glyphActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"MaskPointsFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(glyphActor);\n\n  // Generate an interesting view\n  //\n  ren1->GetActiveCamera()->SetPosition(1, 0, 0);\n  ren1->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  ren1->GetActiveCamera()->SetViewUp(0, 0, -1);\n  ren1->GetActiveCamera()->Azimuth(30);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkImageData> CreatePoints()\n{\n  vtkSmartPointer<vtkImageData> imageMask;\n\n  vtkNew<vtkImageData> image;\n  image->SetDimensions(256, 256, 256);\n  image->AllocateScalars(VTK_DOUBLE, 1);\n  image->SetSpacing(5.0 / 255.0, 5.0 / 255.0, 5.0 / 255.0);\n  image->SetOrigin(-2.5, -2.5, -2.5);\n  vtkNew<vtkCone> implicitFunction;\n  vtkNew<vtkSampleImplicitFunctionFilter> sample;\n  sample->SetImplicitFunction(implicitFunction);\n  sample->SetInputData(image);\n\n  vtkNew<vtkImageThreshold> threshold;\n  threshold->SetInputConnection(sample->GetOutputPort());\n  threshold->ThresholdByLower(.5);\n  threshold->SetOutputScalarTypeToUnsignedChar();\n  threshold->ReplaceInOn();\n  threshold->SetInValue(255);\n  threshold->SetOutValue(0);\n  threshold->ReplaceOutOn();\n  threshold->Update();\n  imageMask = dynamic_cast<vtkImageData*>(threshold->GetOutput());\n  return imageMask;\n}\n} // namespace\n
        "},{"location":"Cxx/Points/MaskPointsFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MaskPointsFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersPoints\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MaskPointsFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MaskPointsFilter MACOSX_BUNDLE MaskPointsFilter.cxx )\n  target_link_libraries(MaskPointsFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MaskPointsFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/MaskPointsFilter/#download-and-build-maskpointsfilter","title":"Download and Build MaskPointsFilter","text":"

        Click here to download MaskPointsFilter and its CMakeLists.txt file. Once the tarball MaskPointsFilter.tar has been downloaded and extracted,

        cd MaskPointsFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MaskPointsFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/NormalEstimation/","title":"NormalEstimation","text":"

        vtk-examples/Cxx/Points/NormalEstimation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/NormalEstimation/#code","title":"Code","text":"

        NormalEstimation.cxx

        #include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid MakeGlyphs(vtkPolyData* src, double size, vtkGlyph3D* glyph);\n}\n\nint main(int, char*[])\n{\n  double radius = 1.0;\n  vtkNew<vtkPointSource> points;\n  points->SetNumberOfPoints(1000);\n  points->SetRadius(radius);\n  points->SetCenter(0.0, 0.0, 0.0);\n  points->SetDistributionToShell();\n\n  int sampleSize = 10;\n  vtkNew<vtkPCANormalEstimation> normals;\n  normals->SetInputConnection(points->GetOutputPort());\n  normals->SetSampleSize(sampleSize);\n  normals->SetNormalOrientationToGraphTraversal();\n  normals->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  MakeGlyphs(normals->GetOutput(), radius * 0.2, glyph3D.GetPointer());\n\n  vtkNew<vtkPolyDataMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetRadius(1.0);\n  sphere->SetThetaResolution(41);\n  sphere->SetPhiResolution(21);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"NormalEstimation\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer->AddActor(glyph3DActor);\n  renderer->AddActor(sphereActor);\n\n  // Generate an interesting view\n  //\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvoid MakeGlyphs(vtkPolyData* src, double size, vtkGlyph3D* glyph)\n{\n  // Source for the glyph filter\n  vtkNew<vtkArrowSource> arrow;\n  arrow->SetTipResolution(16);\n  arrow->SetTipLength(0.3);\n  arrow->SetTipRadius(0.1);\n\n  glyph->SetSourceConnection(arrow->GetOutputPort());\n  glyph->SetInputData(src);\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->SetScaleFactor(size);\n  glyph->OrientOn();\n  glyph->Update();\n}\n} // namespace\n
        "},{"location":"Cxx/Points/NormalEstimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NormalEstimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NormalEstimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NormalEstimation MACOSX_BUNDLE NormalEstimation.cxx )\n  target_link_libraries(NormalEstimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NormalEstimation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/NormalEstimation/#download-and-build-normalestimation","title":"Download and Build NormalEstimation","text":"

        Click here to download NormalEstimation and its CMakeLists.txt file. Once the tarball NormalEstimation.tar has been downloaded and extracted,

        cd NormalEstimation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./NormalEstimation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/PointOccupancy/","title":"PointOccupancy","text":"

        vtk-examples/Cxx/Points/PointOccupancy

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/PointOccupancy/#code","title":"Code","text":"

        PointOccupancy.cxx

        #include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointOccupancyFilter.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkThreshold.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  int dimension = 128;\n  vtkNew<vtkPointOccupancyFilter> occupancy;\n  occupancy->SetInputData(polyData);\n  occupancy->SetSampleDimensions(dimension, dimension, dimension);\n  occupancy->SetOccupiedValue(255);\n  occupancy->Update();\n\n  vtkNew<vtkThreshold> threshold;\n  threshold->SetInputConnection(occupancy->GetOutputPort());\n  threshold->SetUpperThreshold(255);\n  threshold->SetThresholdFunction(vtkThreshold::THRESHOLD_UPPER);\n  threshold->AllScalarsOff();\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(threshold->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Colors\n  vtkNew<vtkNamedColors> nc;\n  double flesh[3];\n  nc->GetColorRGB(\"moccasin\", flesh);\n  actor->GetProperty()->SetColor(flesh);\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(actor);\n  ren1->SetBackground(nc->GetColor3d(\"CornflowerBLue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"PointOccupancy\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Generate an interesting view.\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.25);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Points/PointOccupancy/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointOccupancy)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointOccupancy: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointOccupancy MACOSX_BUNDLE PointOccupancy.cxx )\n  target_link_libraries(PointOccupancy PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointOccupancy\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/PointOccupancy/#download-and-build-pointoccupancy","title":"Download and Build PointOccupancy","text":"

        Click here to download PointOccupancy and its CMakeLists.txt file. Once the tarball PointOccupancy.tar has been downloaded and extracted,

        cd PointOccupancy/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointOccupancy\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/PoissonExtractSurface/","title":"PoissonExtractSurface","text":"

        vtk-examples/Cxx/Points/PoissonExtractSurface

        "},{"location":"Cxx/Points/PoissonExtractSurface/#description","title":"Description","text":"

        This example uses the PoissonReconstruction remote module to reconstruct surfaces from unorganized points. This code was, with permission, adapted directly from the original implementation by Kazhdan, Bolitho, and Hugues. The original implementation can be found here.

        PoissonReconstruction requires that the vtkPolyData input have vtkNormals. If normals are not included in the vtkPointData, the example uses vtkPCANormalEstimation to create normals.

        If the example is run without an argument, the example uses random points on a spherical shell. With a filename, the example uses the points on the vtkPolyData.

        Cite

        The VTK Journal paper Poisson Surface Reconstruction for VTK describes the VTK implementaion.

        Info

        CompareExtractSurface compares three surface extraction algorithms.

        Seealso

        ExtractSurface reconstructs surfaces and is included with the VTK distribution. PowercrustExtractSurface reconstructs surfaces and is implemented as a VTK remote module.

        Info

        PoissonReconstruction is implemented as a VTK Remote Module.

        To use PoissonReconstruction in VTK:

        1. Download PoissonReconstruction.remote.cmake and place it in your VTK/Remote directory.
        2. Reconfigure your VTK build with cmake
        3. Enable the remote module by setting Module_PoissonReconstruction:BOOL=ON.
        4. make

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/PoissonExtractSurface/#code","title":"Code","text":"

        PoissonExtractSurface.cxx

        #include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointSource.h>\n#include <vtkPoissonReconstruction.h>\n\n#include <vtkCamera.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <vtkNamedColors.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n  std::cout << \"# of points: \" << polyData->GetNumberOfPoints() << std::endl;\n\n  vtkSmartPointer<vtkPoissonReconstruction> surface =\n      vtkSmartPointer<vtkPoissonReconstruction>::New();\n  surface->SetDepth(12);\n\n  int sampleSize = polyData->GetNumberOfPoints() * .00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 10;\n  }\n  if (polyData->GetPointData()->GetNormals())\n  {\n    std::cout << \"Using normals from input file\" << std::endl;\n    surface->SetInputData(polyData);\n  }\n  else\n  {\n    std::cout << \"Estimating normals using PCANormalEstimation\" << std::endl;\n    vtkSmartPointer<vtkPCANormalEstimation> normals =\n        vtkSmartPointer<vtkPCANormalEstimation>::New();\n    normals->SetInputData(polyData);\n    normals->SetSampleSize(sampleSize);\n    normals->SetNormalOrientationToGraphTraversal();\n    normals->FlipNormalsOff();\n    surface->SetInputConnection(normals->GetOutputPort());\n  }\n\n  vtkSmartPointer<vtkPolyDataMapper> surfaceMapper =\n      vtkSmartPointer<vtkPolyDataMapper>::New();\n  surfaceMapper->SetInputConnection(surface->GetOutputPort());\n\n  vtkSmartPointer<vtkNamedColors> colors =\n      vtkSmartPointer<vtkNamedColors>::New();\n\n  vtkSmartPointer<vtkProperty> back = vtkSmartPointer<vtkProperty>::New();\n  back->SetColor(colors->GetColor3d(\"banana\").GetData());\n\n  vtkSmartPointer<vtkActor> surfaceActor = vtkSmartPointer<vtkActor>::New();\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  surfaceActor->SetBackfaceProperty(back);\n\n  // Create graphics stuff\n  //\n  vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkSmartPointer<vtkRenderWindow> renWin =\n      vtkSmartPointer<vtkRenderWindow>::New();\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n\n  vtkSmartPointer<vtkRenderWindowInteractor> iren =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(surfaceActor);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkSmartPointer<vtkPLYReader> reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkSmartPointer<vtkXMLPolyDataReader> reader =\n        vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkSmartPointer<vtkPolyDataReader> reader =\n        vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkSmartPointer<vtkOBJReader> reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkSmartPointer<vtkBYUReader> reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkSmartPointer<vtkPointSource> points =\n        vtkSmartPointer<vtkPointSource>::New();\n    points->SetNumberOfPoints(1000);\n    points->SetRadius(1.0);\n    points->SetCenter(vtkMath::Random(-1, 1), vtkMath::Random(-1, 1),\n                      vtkMath::Random(-1, 1));\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Points/PoissonExtractSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PoissonExtractSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PoissonExtractSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PoissonExtractSurface MACOSX_BUNDLE PoissonExtractSurface.cxx )\n  target_link_libraries(PoissonExtractSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PoissonExtractSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/PoissonExtractSurface/#download-and-build-poissonextractsurface","title":"Download and Build PoissonExtractSurface","text":"

        Click here to download PoissonExtractSurface and its CMakeLists.txt file. Once the tarball PoissonExtractSurface.tar has been downloaded and extracted,

        cd PoissonExtractSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PoissonExtractSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/PowercrustExtractSurface/","title":"PowercrustExtractSurface","text":"

        vtk-examples/Cxx/Points/PowercrustExtractSurface

        "},{"location":"Cxx/Points/PowercrustExtractSurface/#description","title":"Description","text":"

        The Powercrust, or Crust algorithm, reconstructs surfaces from unorganized points.

        If the example is run without an argument, the example uses random points on a spherical shell. With a filename, the example uses the points on the vtkPolyData.

        Cite

        See The Power Crust for technical details.

        Info

        CompareExtractSurface compares three surface extraction algorithms.

        Seealso

        ExtractSurface reconstructs surfaces and is included with the VTK distribution. PoissonExtractSurface reconstructs surfaces and is implemented as a VTK remote module.

        Danger

        The code is covered by the GPL License and may restrict commercial use..

        Info

        The Power Crust is implemented as a VTK Remote Module.

        To use the Power Crust in VTK:

        1. Download Powercrust.remote.cmake and place it in your VTK/Remote directory.
        2. Reconfigure your VTK build with cmake
        3. Enable the remote module by setting Module_Powercrust:BOOL=ON.
        4. make

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/PowercrustExtractSurface/#code","title":"Code","text":"

        PowercrustExtractSurface.cxx

        #include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPowerCrustSurfaceReconstruction.h>\n\n#include <vtkCamera.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <vtkNamedColors.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n  std::cout << \"# of points: \" << polyData->GetNumberOfPoints() << std::endl;\n\n  vtkSmartPointer<vtkPowerCrustSurfaceReconstruction> surface =\n      vtkSmartPointer<vtkPowerCrustSurfaceReconstruction>::New();\n  surface->SetInputData(polyData);\n\n  vtkSmartPointer<vtkPolyDataMapper> surfaceMapper =\n      vtkSmartPointer<vtkPolyDataMapper>::New();\n  surfaceMapper->SetInputConnection(surface->GetOutputPort());\n\n  vtkSmartPointer<vtkNamedColors> colors =\n      vtkSmartPointer<vtkNamedColors>::New();\n\n  vtkSmartPointer<vtkProperty> back = vtkSmartPointer<vtkProperty>::New();\n  back->SetColor(colors->GetColor3d(\"banana\").GetData());\n\n  vtkSmartPointer<vtkActor> surfaceActor = vtkSmartPointer<vtkActor>::New();\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  surfaceActor->SetBackfaceProperty(back);\n\n  // Create graphics stuff\n  //\n  vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkSmartPointer<vtkRenderWindow> renWin =\n      vtkSmartPointer<vtkRenderWindow>::New();\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n\n  vtkSmartPointer<vtkRenderWindowInteractor> iren =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(surfaceActor);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkSmartPointer<vtkPLYReader> reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkSmartPointer<vtkXMLPolyDataReader> reader =\n        vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkSmartPointer<vtkPolyDataReader> reader =\n        vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkSmartPointer<vtkOBJReader> reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkSmartPointer<vtkBYUReader> reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkSmartPointer<vtkPointSource> points =\n        vtkSmartPointer<vtkPointSource>::New();\n    points->SetNumberOfPoints(1000);\n    points->SetRadius(1.0);\n    points->SetCenter(vtkMath::Random(-1, 1), vtkMath::Random(-1, 1),\n                      vtkMath::Random(-1, 1));\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Points/PowercrustExtractSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PowercrustExtractSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PowercrustExtractSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PowercrustExtractSurface MACOSX_BUNDLE PowercrustExtractSurface.cxx )\n  target_link_libraries(PowercrustExtractSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PowercrustExtractSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/PowercrustExtractSurface/#download-and-build-powercrustextractsurface","title":"Download and Build PowercrustExtractSurface","text":"

        Click here to download PowercrustExtractSurface and its CMakeLists.txt file. Once the tarball PowercrustExtractSurface.tar has been downloaded and extracted,

        cd PowercrustExtractSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PowercrustExtractSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/RadiusOutlierRemoval/","title":"RadiusOutlierRemoval","text":"

        vtk-examples/Cxx/Points/RadiusOutlierRemoval

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Points/RadiusOutlierRemoval/#description","title":"Description","text":"

        In this example, outliers are red. Yellow points satisfy the radius and neighbor restrictions.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/RadiusOutlierRemoval/#code","title":"Code","text":"

        RadiusOutlierRemoval.cxx

        #include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRadiusOutlierRemoval.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  std::cout << \"# of original points: \" << polyData->GetNumberOfPoints()\n            << std::endl;\n  vtkNew<vtkRadiusOutlierRemoval> removal;\n  removal->SetInputData(polyData);\n  removal->SetRadius(range[0] / 50.0);\n  removal->SetNumberOfNeighbors(6);\n  removal->GenerateOutliersOn();\n  removal->Update();\n  std::cout << \"# of removed points: \" << removal->GetNumberOfPointsRemoved()\n            << std::endl;\n\n  ///\n  double radius = range[0] * .01;\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetRadius(radius);\n\n  vtkNew<vtkGlyph3D> glyph3D1;\n  glyph3D1->SetInputConnection(removal->GetOutputPort());\n  glyph3D1->SetSourceConnection(sphereSource1->GetOutputPort());\n  glyph3D1->ScalingOff();\n  glyph3D1->Update();\n  vtkNew<vtkPolyDataMapper> glyph3DMapper1;\n  glyph3DMapper1->SetInputConnection(glyph3D1->GetOutputPort());\n  glyph3DMapper1->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor1;\n  glyph3DActor1->SetMapper(glyph3DMapper1);\n  glyph3DActor1->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  ////\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetRadius(radius * 0.75);\n\n  vtkNew<vtkGlyph3D> glyph3D2;\n  glyph3D2->SetInputConnection(removal->GetOutputPort(1));\n  glyph3D2->SetSourceConnection(sphereSource2->GetOutputPort());\n  glyph3D2->ScalingOff();\n  glyph3D2->Update();\n\n  vtkNew<vtkPolyDataMapper> glyph3DMapper2;\n  glyph3DMapper2->SetInputConnection(glyph3D2->GetOutputPort());\n  glyph3DMapper2->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor2;\n  glyph3DActor2->SetMapper(glyph3DMapper2);\n  glyph3DActor2->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"RadiusOutlierRemoval\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(glyph3DActor1);\n  ren1->AddActor(glyph3DActor2);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Points/RadiusOutlierRemoval/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RadiusOutlierRemoval)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RadiusOutlierRemoval: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RadiusOutlierRemoval MACOSX_BUNDLE RadiusOutlierRemoval.cxx )\n  target_link_libraries(RadiusOutlierRemoval PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RadiusOutlierRemoval\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/RadiusOutlierRemoval/#download-and-build-radiusoutlierremoval","title":"Download and Build RadiusOutlierRemoval","text":"

        Click here to download RadiusOutlierRemoval and its CMakeLists.txt file. Once the tarball RadiusOutlierRemoval.tar has been downloaded and extracted,

        cd RadiusOutlierRemoval/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RadiusOutlierRemoval\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/SignedDistance/","title":"SignedDistance","text":"

        vtk-examples/Cxx/Points/SignedDistance

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Points/SignedDistance/#description","title":"Description","text":"

        Contrast this with the UnsignedDistance example.

        The image was created using the Armadillo dataset, src/Testing/Data/Armadillo.ply.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/SignedDistance/#code","title":"Code","text":"

        SignedDistance.cxx

        #include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPCANormalEstimation.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSignedDistance.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = polyData->GetNumberOfPoints() * .00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 10;\n  }\n  std::cout << \"Sample size is: \" << sampleSize << std::endl;\n  vtkNew<vtkPCANormalEstimation> normals;\n  normals->SetInputData(polyData);\n  normals->SetSampleSize(sampleSize);\n  normals->SetNormalOrientationToGraphTraversal();\n  normals->FlipNormalsOn();\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  int dimension = 256;\n  dimension = 128;\n  // auto radius = range[0] * 0.02;\n  auto radius = range[0] / static_cast<double>(dimension) * 5; // ~5 voxels\n  std::cout << \"Radius: \" << radius << std::endl;\n  vtkNew<vtkSignedDistance> distance;\n  distance->SetInputConnection(normals->GetOutputPort());\n  distance->SetRadius(radius);\n  distance->SetDimensions(dimension, dimension, dimension);\n  distance->SetBounds(bounds[0] - range[0] * 0.1, bounds[1] + range[0] * 0.1,\n                      bounds[2] - range[1] * 0.1, bounds[3] + range[1] * 0.1,\n                      bounds[4] - range[2] * 0.1, bounds[5] + range[2] * 0.1);\n\n  // Create a lookup table that consists of the full hue circle\n  // (from HSV).\n  auto belowRangeColor = colors->GetColor4d(\"Black\").GetData();\n  belowRangeColor[3] = 0.2;\n  auto aboveRangeColor = colors->GetColor4d(\"White\").GetData();\n  aboveRangeColor[3] = 0.2;\n  vtkNew<vtkLookupTable> hueLut;\n  hueLut->SetTableRange(-0.99 * radius, 0.99 * radius);\n  hueLut->SetHueRange(0.667, 0);\n  hueLut->SetSaturationRange(1, 1);\n  hueLut->SetValueRange(1, 1);\n  hueLut->UseBelowRangeColorOn();\n  hueLut->SetBelowRangeColor(belowRangeColor);\n  hueLut->UseAboveRangeColorOn();\n  hueLut->SetAboveRangeColor(aboveRangeColor);\n  hueLut->SetNumberOfColors(5);\n  hueLut->Build();\n  double* last = hueLut->GetTableValue(4);\n  hueLut->SetAboveRangeColor(last[0], last[1], last[2], 0);\n\n  vtkNew<vtkImageMapToColors> sagittalColors;\n  sagittalColors->SetInputConnection(distance->GetOutputPort());\n  sagittalColors->SetLookupTable(hueLut);\n  sagittalColors->Update();\n\n  vtkNew<vtkImageActor> sagittal;\n  sagittal->GetMapper()->SetInputConnection(sagittalColors->GetOutputPort());\n  sagittal->SetDisplayExtent(dimension / 2, dimension / 2, 0, dimension - 1, 0,\n                             dimension - 1);\n  sagittal->ForceOpaqueOn();\n\n  vtkNew<vtkImageMapToColors> axialColors;\n  axialColors->SetInputConnection(distance->GetOutputPort());\n  axialColors->SetLookupTable(hueLut);\n  axialColors->Update();\n\n  vtkNew<vtkImageActor> axial;\n  axial->GetMapper()->SetInputConnection(axialColors->GetOutputPort());\n  axial->SetDisplayExtent(0, dimension - 1, 0, dimension - 1, dimension / 2,\n                          dimension / 2);\n  axial->ForceOpaqueOn();\n\n  vtkNew<vtkImageMapToColors> coronalColors;\n  coronalColors->SetInputConnection(distance->GetOutputPort());\n  coronalColors->SetLookupTable(hueLut);\n  coronalColors->Update();\n\n  vtkNew<vtkImageActor> coronal;\n  coronal->GetMapper()->SetInputConnection(coronalColors->GetOutputPort());\n  coronal->SetDisplayExtent(0, dimension - 1, dimension / 2, dimension / 2, 0,\n                            dimension - 1);\n  coronal->ForceOpaqueOn();\n\n  // Create a scalar bar.\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(hueLut);\n  scalarBar->SetTitle(\"Distance\");\n  scalarBar->SetNumberOfLabels(5);\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(600, 400);\n  renWin->SetWindowName(\"SignedDistance\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(sagittal);\n  ren1->AddActor(axial);\n  ren1->AddActor(coronal);\n  ren1->AddActor2D(scalarBar);\n\n  // Generate an interesting view\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n  std::cout << distance->GetOutput()->GetScalarRange()[0] << \", \"\n            << distance->GetOutput()->GetScalarRange()[1] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase.\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Points/SignedDistance/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SignedDistance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  ImagingCore\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SignedDistance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SignedDistance MACOSX_BUNDLE SignedDistance.cxx )\n  target_link_libraries(SignedDistance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SignedDistance\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/SignedDistance/#download-and-build-signeddistance","title":"Download and Build SignedDistance","text":"

        Click here to download SignedDistance and its CMakeLists.txt file. Once the tarball SignedDistance.tar has been downloaded and extracted,

        cd SignedDistance/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SignedDistance\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Points/UnsignedDistance/","title":"UnsignedDistance","text":"

        vtk-examples/Cxx/Points/UnsignedDistance

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Points/UnsignedDistance/#description","title":"Description","text":"

        Contrast this with the SignedDistance example.

        The image was created using the Armadillo dataset, src/Testing/Data/Armadillo.ply.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Points/UnsignedDistance/#code","title":"Code","text":"

        UnsignedDistance.cxx

        #include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageData.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper3D.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnsignedDistance.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n\n  int sampleSize = polyData->GetNumberOfPoints() * .00005;\n  if (sampleSize < 10)\n  {\n    sampleSize = 10;\n  }\n  std::cout << \"Sample size is: \" << sampleSize << std::endl;\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  int dimension = 256;\n  dimension = 128;\n  // auto radius = range[0] * .02;\n  auto radius = range[0] / static_cast<double>(dimension) * 5;\n  ; // ~5 voxels\n  std::cout << \"Radius: \" << radius << std::endl;\n  vtkNew<vtkUnsignedDistance> distance;\n  distance->SetInputData(polyData);\n  distance->SetRadius(radius);\n  distance->SetDimensions(dimension, dimension, dimension);\n  distance->SetBounds(bounds[0] - range[0] * .1, bounds[1] + range[0] * .1,\n                      bounds[2] - range[1] * .1, bounds[3] + range[1] * .1,\n                      bounds[4] - range[2] * .1, bounds[5] + range[2] * .1);\n\n  // Create a lookup table that consists of the full hue circle\n  // (from HSV).\n  auto aboveRangeColor = colors->GetColor4d(\"White\").GetData();\n  aboveRangeColor[3] = 0.2;\n  vtkNew<vtkLookupTable> hueLut;\n  hueLut->SetTableRange(-.99 * radius, .99 * radius);\n  hueLut->SetHueRange(.667, 0);\n  hueLut->SetSaturationRange(1, 1);\n  hueLut->SetValueRange(1, 1);\n  hueLut->UseAboveRangeColorOn();\n  hueLut->SetAboveRangeColor(aboveRangeColor);\n  hueLut->SetNumberOfColors(5);\n  hueLut->Build();\n  double* last = hueLut->GetTableValue(4);\n  hueLut->SetAboveRangeColor(last[0], last[1], last[2], 0);\n\n  vtkNew<vtkImageMapToColors> sagittalColors;\n  sagittalColors->SetInputConnection(distance->GetOutputPort());\n  sagittalColors->SetLookupTable(hueLut);\n  sagittalColors->Update();\n\n  vtkNew<vtkImageActor> sagittal;\n  sagittal->GetMapper()->SetInputConnection(sagittalColors->GetOutputPort());\n  sagittal->SetDisplayExtent(dimension / 2, dimension / 2, 0, dimension - 1, 0,\n                             dimension - 1);\n  sagittal->ForceOpaqueOn();\n\n  vtkNew<vtkImageMapToColors> axialColors;\n  axialColors->SetInputConnection(distance->GetOutputPort());\n  axialColors->SetLookupTable(hueLut);\n  axialColors->Update();\n\n  vtkNew<vtkImageActor> axial;\n  axial->GetMapper()->SetInputConnection(axialColors->GetOutputPort());\n  axial->SetDisplayExtent(0, dimension - 1, 0, dimension - 1, dimension / 2,\n                          dimension / 2);\n  axial->ForceOpaqueOn();\n\n  vtkNew<vtkImageMapToColors> coronalColors;\n  coronalColors->SetInputConnection(distance->GetOutputPort());\n  coronalColors->SetLookupTable(hueLut);\n  coronalColors->Update();\n\n  vtkNew<vtkImageActor> coronal;\n  coronal->GetMapper()->SetInputConnection(coronalColors->GetOutputPort());\n  coronal->SetDisplayExtent(0, dimension - 1, dimension / 2, dimension / 2, 0,\n                            dimension - 1);\n  coronal->ForceOpaqueOn();\n\n  // Create a scalar bar.\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(hueLut);\n  scalarBar->SetTitle(\"Distance\");\n  scalarBar->SetNumberOfLabels(5);\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(.3, .4, .6);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(600, 400);\n  renWin->SetWindowName(\"UnsignedDistance\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(sagittal);\n  ren1->AddActor(axial);\n  ren1->AddActor(coronal);\n  ren1->AddActor2D(scalarBar);\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Generate an interesting view.\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(120);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n  std::cout << distance->GetOutput()->GetScalarRange()[0] << \", \"\n            << distance->GetOutput()->GetScalarRange()[1] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase.\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    vtkNew<vtkPointSource> points;\n    points->SetNumberOfPoints(100000);\n    points->SetRadius(10.0);\n    double x, y, z;\n    // random position\n    x = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(-100, 100);\n    randomSequence->Next();\n    points->SetCenter(x, y, z);\n    points->SetDistributionToShell();\n    points->Update();\n    polyData = points->GetOutput();\n  }\n  return polyData;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Points/UnsignedDistance/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(UnsignedDistance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  ImagingCore\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"UnsignedDistance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(UnsignedDistance MACOSX_BUNDLE UnsignedDistance.cxx )\n  target_link_libraries(UnsignedDistance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS UnsignedDistance\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Points/UnsignedDistance/#download-and-build-unsigneddistance","title":"Download and Build UnsignedDistance","text":"

        Click here to download UnsignedDistance and its CMakeLists.txt file. Once the tarball UnsignedDistance.tar has been downloaded and extracted,

        cd UnsignedDistance/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./UnsignedDistance\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/AlignFrames/","title":"AlignFrames","text":"

        vtk-examples/Cxx/PolyData/AlignFrames

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/AlignFrames/#code","title":"Code","text":"

        AlignFrames.cxx

        #include <vtkLandmarkTransform.h>\n#include <vtkMath.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n#include <vtkVertexGlyphFilter.h>\n#include <vtkXMLPolyDataWriter.h>\n\nnamespace {\nstruct Frame\n{\n  Frame(float o[3], float x[3], float y[3], float z[3])\n  {\n    this->SetOrigin(o);\n    this->SetXDirection(x);\n    this->SetYDirection(y);\n    this->SetZDirection(z);\n\n    std::cout << \"Origin: \" << this->origin[0] << \" \" << this->origin[1] << \" \"\n              << this->origin[2] << std::endl;\n    std::cout << \"xDirection: \" << this->xDirection[0] << \" \"\n              << this->xDirection[1] << \" \" << this->xDirection[2] << std::endl;\n    std::cout << \"yDirection: \" << this->yDirection[0] << \" \"\n              << this->yDirection[1] << \" \" << this->yDirection[2] << std::endl;\n    std::cout << \"zDirection: \" << this->zDirection[0] << \" \"\n              << this->zDirection[1] << \" \" << this->zDirection[2] << std::endl;\n  }\n\n  void ApplyTransform(vtkTransform* transform, std::string filename)\n  {\n    vtkNew<vtkPolyData> polydata;\n    CreatePolydata(polydata);\n\n    vtkNew<vtkTransformFilter> transformFilter;\n    transformFilter->SetInputData(polydata);\n    transformFilter->SetTransform(transform);\n    transformFilter->Update();\n\n    vtkNew<vtkXMLPolyDataWriter> writer;\n    writer->SetFileName(filename.c_str());\n    writer->SetInputConnection(transformFilter->GetOutputPort());\n    writer->Write();\n  }\n\n  void CreatePolydata(vtkPolyData* polydata)\n  {\n    vtkNew<vtkPoints> points;\n\n    points->InsertNextPoint(this->origin);\n    float x[3];\n    vtkMath::Add(this->origin, this->xDirection, x);\n    points->InsertNextPoint(x);\n    float y[3];\n    vtkMath::Add(this->origin, this->yDirection, y);\n    points->InsertNextPoint(y);\n    float z[3];\n    vtkMath::Add(this->origin, this->zDirection, z);\n    points->InsertNextPoint(z);\n\n    polydata->SetPoints(points);\n\n    vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n    vertexGlyphFilter->AddInputData(polydata);\n    vertexGlyphFilter->Update();\n\n    polydata->ShallowCopy(vertexGlyphFilter->GetOutput());\n  }\n\n  void Write(std::string filename)\n  {\n    vtkNew<vtkPolyData> polydata;\n    CreatePolydata(polydata);\n\n    vtkNew<vtkXMLPolyDataWriter> writer;\n    writer->SetFileName(filename.c_str());\n    writer->SetInputData(polydata);\n    writer->Write();\n  }\n\n  float origin[3];\n  float xDirection[3];\n  float yDirection[3];\n  float zDirection[3];\n\n  void SetOrigin(float o[3])\n  {\n    this->origin[0] = o[0];\n    this->origin[1] = o[1];\n    this->origin[2] = o[2];\n  }\n\n  void SetXDirection(float direction[3])\n  {\n    vtkMath::Normalize(direction);\n    this->xDirection[0] = direction[0];\n    this->xDirection[1] = direction[1];\n    this->xDirection[2] = direction[2];\n  }\n\n  void SetYDirection(float direction[3])\n  {\n    vtkMath::Normalize(direction);\n    this->yDirection[0] = direction[0];\n    this->yDirection[1] = direction[1];\n    this->yDirection[2] = direction[2];\n  }\n\n  void SetZDirection(float direction[3])\n  {\n    vtkMath::Normalize(direction);\n    this->zDirection[0] = direction[0];\n    this->zDirection[1] = direction[1];\n    this->zDirection[2] = direction[2];\n  }\n};\n\nvoid AlignFrames(Frame sourceFrame, Frame destinationFrame,\n                 vtkTransform* transform);\n} // namespace\n\nint main(int, char*[])\n{\n  float frame1origin[3] = {0, 0, 0};\n  float frame1XDirection[3] = {1, 0, 0};\n  float frame1YDirection[3] = {0, 1, 0};\n  std::cout << frame1YDirection[0] << \" \" << frame1YDirection[1] << \" \"\n            << frame1YDirection[2] << std::endl;\n  float frame1ZDirection[3] = {0, 0, 1};\n  Frame frame1(frame1origin, frame1XDirection, frame1YDirection,\n               frame1ZDirection);\n  frame1.Write(\"frame1.vtp\");\n\n  float frame2origin[3] = {0, 0, 0};\n  float frame2XDirection[3] = {.707f, .707f, 0};\n  float frame2YDirection[3] = {-.707f, .707f, 0};\n  float frame2ZDirection[3] = {0, 0, 1};\n  Frame frame2(frame2origin, frame2XDirection, frame2YDirection,\n               frame2ZDirection);\n  frame2.Write(\"frame2.vtp\");\n\n  vtkNew<vtkTransform> transform;\n  AlignFrames(frame2, frame1, transform); // Brings frame2 to frame1\n\n  // std::cout << *transform << std::endl;\n\n  frame2.ApplyTransform(transform, \"transformed.vtp\");\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid AlignFrames(Frame sourceFrame, Frame targetFrame, vtkTransform* transform)\n{\n  // This function takes two frames and finds the matrix M between them.\n\n  vtkNew<vtkLandmarkTransform> landmarkTransform;\n\n  // Setup source points\n  vtkNew<vtkPoints> sourcePoints;\n\n  sourcePoints->InsertNextPoint(sourceFrame.origin);\n  float sourceX[3];\n  vtkMath::Add(sourceFrame.origin, sourceFrame.xDirection, sourceX);\n  sourcePoints->InsertNextPoint(sourceX);\n  float sourceY[3];\n  vtkMath::Add(sourceFrame.origin, sourceFrame.yDirection, sourceY);\n  sourcePoints->InsertNextPoint(sourceY);\n  float sourceZ[3];\n  vtkMath::Add(sourceFrame.origin, sourceFrame.zDirection, sourceZ);\n  sourcePoints->InsertNextPoint(sourceZ);\n\n  // Setup target points\n  vtkNew<vtkPoints> targetPoints;\n\n  targetPoints->InsertNextPoint(targetFrame.origin);\n  float targetX[3];\n  vtkMath::Add(targetFrame.origin, targetFrame.xDirection, targetX);\n  targetPoints->InsertNextPoint(targetX);\n  float targetY[3];\n  vtkMath::Add(targetFrame.origin, targetFrame.yDirection, targetY);\n  targetPoints->InsertNextPoint(targetY);\n  float targetZ[3];\n  vtkMath::Add(targetFrame.origin, targetFrame.zDirection, targetZ);\n  targetPoints->InsertNextPoint(targetZ);\n\n  landmarkTransform->SetSourceLandmarks(sourcePoints);\n  landmarkTransform->SetTargetLandmarks(targetPoints);\n  landmarkTransform->SetModeToRigidBody();\n  landmarkTransform->Update();\n\n  vtkMatrix4x4* M = landmarkTransform->GetMatrix();\n\n  transform->SetMatrix(M);\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/AlignFrames/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AlignFrames)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AlignFrames: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AlignFrames MACOSX_BUNDLE AlignFrames.cxx )\n  target_link_libraries(AlignFrames PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AlignFrames\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/AlignFrames/#download-and-build-alignframes","title":"Download and Build AlignFrames","text":"

        Click here to download AlignFrames and its CMakeLists.txt file. Once the tarball AlignFrames.tar has been downloaded and extracted,

        cd AlignFrames/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AlignFrames\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/AlignTwoPolyDatas/","title":"AlignTwoPolyDatas","text":"

        vtk-examples/Cxx/PolyData/AlignTwoPolyDatas

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/AlignTwoPolyDatas/#description","title":"Description","text":"

        This example shows how to align two vtkPolyData's. Typically, the two datasets are related. For example, aligning a CT head isosurface with an MRI head isosurface of the same patient. Or two steps in a time series of an evolving surface. These cases usually reside in the same coordinate system, and the initial alignment is \"close\" to the desired results.

        Another case is when the two datasets are from the \"same\" family of objects - for example, running the example with two types of sharks that exist in different coordinate systems.

        The algorithm proceeds as follows:

        1. Read the two vtkPolyData's that exist in the example's command line. The first file contains the source vtkPolyData to be aligned with the second file's vtkPolyData called the target. Another naming convention is moving and fixed.

        2. Compute a measure of fit of the two original files. We use the recently added vtkHausdorffDistancePointSetFilter to compute the measure. See Hausdorff Distance.

        3. Align the bounding boxes of the two datasets. Here we use a vtkOBBTree locator to create oriented bounding boxes. See Oriented Bounding Boxes. Use the bounding box corner coordinates to create source and target vtkLandmarkTransform's. vtkTransformPolyData uses this transform to create a new source vtkPolyData. Since the orientations of the bounding boxes may differ, the AlignBoundingBoxes function tries ten different rotations. For each rotation, it computes the Hausdorff distance between the target's OBB corners and the transformed source's OBB corners. Finally, transform the original source using the smallest distance.

        4. Improve the alignment with vtkIterativeClosestPointTransform with a RigidBody transform. Compute the distance metric again.

        5. Display the source and target vtkPolyData's with the transform that has the best distance metric.

        Info

        The example is run with src/Testing/Data/thingiverse/Grey_Nurse_Shark.stl and src/Testing/Data/greatWhite.stl, in this case, we reorient the target using a rotation. vtkTransformPolyDataFilter is used to get a better fit in this case.

        Info

        If example is run with src/Testing/Data/thingiverse/Grey_Nurse_Shark.stl and src/Testing/Data/shark.ply the fit is really poor and the Iterative Closest Point algotithm fails. So we fallback and use oriented bounding boxes.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/AlignTwoPolyDatas/#code","title":"Code","text":"

        AlignTwoPolyDatas.cxx

        #include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFieldData.h>\n#include <vtkHausdorffDistancePointSetFilter.h>\n#include <vtkIterativeClosestPointTransform.h>\n#include <vtkLandmarkTransform.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVersion.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <cmath>     // for std::isnan and std::isinf\n#include <string>    // For find_last_of()\n\n#include <array>\n#include <random>\n#include <sstream>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define VTK_HAS_COW 1\n#endif\n\n#if VTK_HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\nnamespace {\n/**\n * Show the command lime parameters.\n *\n * @param fn: The program name.\n */\nstd::string ShowUsage(std::string fn);\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\nvoid AlignBoundingBoxes(vtkPolyData*, vtkPolyData*);\nvoid BestBoundingBox(std::string const& axis, vtkPolyData* target,\n                     vtkPolyData* source, vtkPolyData* targetLandmarks,\n                     vtkPolyData* sourceLandmarks, double& distance,\n                     vtkPoints* bestPoints);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc != 3)\n  {\n    std::cout << ShowUsage(argv[0]) << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Vis Pipeline\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"sea_green_light\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  std::cout << \"Loading source: \" << argv[1] << std::endl;\n  auto sourcePolyData = ReadPolyData(argv[1]);\n\n  // Save the source polydata in case the align does not improve\n  // segmentation.\n  vtkNew<vtkPolyData> originalSourcePolyData;\n  originalSourcePolyData->DeepCopy(sourcePolyData);\n\n  std::cout << \"Loading target: \" << argv[2] << std::endl;\n  auto targetPolyData = ReadPolyData(argv[2]);\n\n  // If the target orientation is markedly different, you may need to apply a\n  // transform to orient the target with the source.\n  // For example, when using Grey_Nurse_Shark.stl as the\n  //  source and thingiverse/greatWhite.stl as the target,\n  // you need to transform the target.\n  auto sourceFound =\n      std::string(argv[1]).find(\"Grey_Nurse_Shark.stl\") != std::string::npos;\n  auto targetFound =\n      std::string(argv[2]).find(\"greatWhite.stl\") != std::string::npos;\n  vtkNew<vtkTransform> trnf;\n  if (sourceFound && targetFound)\n  {\n    trnf->RotateY(90);\n  }\n  vtkNew<vtkTransformPolyDataFilter> tpd;\n  tpd->SetTransform(trnf);\n  tpd->SetInputData(targetPolyData);\n  tpd->Update();\n\n  vtkNew<vtkHausdorffDistancePointSetFilter> distance;\n  distance->SetInputData(0, tpd->GetOutput());\n  distance->SetInputData(1, sourcePolyData);\n  distance->Update();\n\n  double distanceBeforeAlign = static_cast<vtkPointSet*>(distance->GetOutput(0))\n                                   ->GetFieldData()\n                                   ->GetArray(\"HausdorffDistance\")\n                                   ->GetComponent(0, 0);\n\n  // Get initial alignment using oriented bounding boxes.\n  AlignBoundingBoxes(sourcePolyData, tpd->GetOutput());\n\n  distance->SetInputData(0, tpd->GetOutput());\n  distance->SetInputData(1, sourcePolyData);\n  distance->Modified();\n  distance->Update();\n  double distanceAfterAlign = static_cast<vtkPointSet*>(distance->GetOutput(0))\n                                  ->GetFieldData()\n                                  ->GetArray(\"HausdorffDistance\")\n                                  ->GetComponent(0, 0);\n\n  double bestDistance = std::min(distanceBeforeAlign, distanceAfterAlign);\n\n  if (distanceAfterAlign > distanceBeforeAlign)\n  {\n    sourcePolyData->DeepCopy(originalSourcePolyData);\n  }\n\n  // Refine the alignment using IterativeClosestPoint.\n  vtkNew<vtkIterativeClosestPointTransform> icp;\n  icp->SetSource(sourcePolyData);\n  icp->SetTarget(tpd->GetOutput());\n  icp->GetLandmarkTransform()->SetModeToRigidBody();\n  icp->SetMaximumNumberOfLandmarks(100);\n  icp->SetMaximumMeanDistance(.00001);\n  icp->SetMaximumNumberOfIterations(500);\n  icp->CheckMeanDistanceOn();\n  icp->StartByMatchingCentroidsOn();\n  icp->Update();\n  auto icpMeanDistance = icp->GetMeanDistance();\n\n  //  icp->Print(std::cout);\n\n  auto lmTransform = icp->GetLandmarkTransform();\n  vtkNew<vtkTransformPolyDataFilter> transform;\n  transform->SetInputData(sourcePolyData);\n  transform->SetTransform(lmTransform);\n  transform->SetTransform(icp);\n  transform->Update();\n\n  distance->SetInputData(0, tpd->GetOutput());\n  distance->SetInputData(1, transform->GetOutput());\n  distance->Update();\n\n  // Note: If there is an error extracting eigenfunctions, then this will be\n  // zero.\n  double distanceAfterICP = static_cast<vtkPointSet*>(distance->GetOutput(0))\n                                ->GetFieldData()\n                                ->GetArray(\"HausdorffDistance\")\n                                ->GetComponent(0, 0);\n  if (!(std::isnan(icpMeanDistance) || std::isinf(icpMeanDistance)))\n  {\n    if (distanceAfterICP < bestDistance)\n    {\n      bestDistance = distanceAfterICP;\n    }\n  }\n\n  std::cout << \"Distances:\" << std::endl;\n  std::cout << \"  Before aligning:                        \"\n            << distanceBeforeAlign << std::endl;\n  std::cout << \"  Aligning using oriented bounding boxes: \"\n            << distanceAfterAlign << std::endl;\n  std::cout << \"  Aligning using IterativeClosestPoint:   \" << distanceAfterICP\n            << std::endl;\n  std::cout << \"  Best distance:                          \" << bestDistance\n            << std::endl;\n\n  // Select the source to use.\n  vtkNew<vtkDataSetMapper> sourceMapper;\n  if (bestDistance == distanceBeforeAlign)\n  {\n    sourceMapper->SetInputData(originalSourcePolyData);\n    std::cout << \"Using original alignment\" << std::endl;\n  }\n  else if (bestDistance == distanceAfterAlign)\n  {\n    sourceMapper->SetInputData(sourcePolyData);\n    std::cout << \"Using alignment by OBB\" << std::endl;\n  }\n  else\n  {\n    sourceMapper->SetInputConnection(transform->GetOutputPort());\n    std::cout << \"Using alignment by ICP\" << std::endl;\n  }\n  sourceMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> sourceActor;\n  sourceActor->SetMapper(sourceMapper);\n  sourceActor->GetProperty()->SetOpacity(0.6);\n  sourceActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"White\").GetData());\n  renderer->AddActor(sourceActor);\n\n  vtkNew<vtkDataSetMapper> targetMapper;\n  targetMapper->SetInputData(tpd->GetOutput());\n  targetMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> targetActor;\n  targetActor->SetMapper(targetMapper);\n  targetActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  renderer->AddActor(targetActor);\n\n  renderWindow->AddRenderer(renderer);\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"AlignTwoPolyDatas\");\n\n#if VTK_HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(renderer);\n  // Enable the widget.\n  camOrientManipulator->On();\n#else\n  vtkNew<vtkAxesActor> axes;\n\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  double rgba[4]{0.0, 0.0, 0.0, 0.0};\n  colors->GetColor(\"Carrot\", rgba);\n  widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n  widget->SetOrientationMarker(axes);\n  widget->SetInteractor(interactor);\n  widget->SetViewport(0.0, 0.0, 0.2, 0.2);\n  widget->EnabledOn();\n  widget->InteractiveOn();\n#endif\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\n\nstd::string ShowUsage(std::string fn)\n{\n  // Remove the folder (if present) then remove the extension in this order\n  // since the folder name may contain periods.\n  auto last_slash_idx = fn.find_last_of(\"\\\\/\");\n  if (std::string::npos != last_slash_idx)\n  {\n    fn.erase(0, last_slash_idx + 1);\n  }\n  auto period_idx = fn.rfind('.');\n  if (std::string::npos != period_idx)\n  {\n    fn.erase(period_idx);\n  }\n  std::ostringstream os;\n  os << \"\\nusage: \" << fn << \" src_fn tgt_fn\\n\\n\"\n     << \"How to align two vtkPolyData's.\\n\\n\"\n     << \"positional arguments:\\n\"\n     << \"  src_fn      The polydata source file name,e.g. \"\n        \"Grey_Nurse_Shark.stl.\\n\"\n     << \"  tgt_fn      The polydata target file name, e.g. shark.ply.\\n\"\n     << \"\\n\"\n     << std::endl;\n  return os.str();\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid AlignBoundingBoxes(vtkPolyData* source, vtkPolyData* target)\n{\n  // Use OBBTree to create an oriented bounding box for target and source\n  vtkNew<vtkOBBTree> sourceOBBTree;\n  sourceOBBTree->SetDataSet(source);\n  sourceOBBTree->SetMaxLevel(1);\n  sourceOBBTree->BuildLocator();\n\n  vtkNew<vtkOBBTree> targetOBBTree;\n  targetOBBTree->SetDataSet(target);\n  targetOBBTree->SetMaxLevel(1);\n  targetOBBTree->BuildLocator();\n\n  vtkNew<vtkPolyData> sourceLandmarks;\n  sourceOBBTree->GenerateRepresentation(0, sourceLandmarks);\n\n  vtkNew<vtkPolyData> targetLandmarks;\n  targetOBBTree->GenerateRepresentation(0, targetLandmarks);\n\n  vtkNew<vtkLandmarkTransform> lmTransform;\n  lmTransform->SetModeToSimilarity();\n  lmTransform->SetTargetLandmarks(targetLandmarks->GetPoints());\n  // vtkNew<vtkTransformPolyDataFilter> lmTransformPD;\n  double bestDistance = VTK_DOUBLE_MAX;\n  vtkNew<vtkPoints> bestPoints;\n  BestBoundingBox(\"X\", target, source, targetLandmarks, sourceLandmarks,\n                  bestDistance, bestPoints);\n  BestBoundingBox(\"Y\", target, source, targetLandmarks, sourceLandmarks,\n                  bestDistance, bestPoints);\n  BestBoundingBox(\"Z\", target, source, targetLandmarks, sourceLandmarks,\n                  bestDistance, bestPoints);\n\n  lmTransform->SetSourceLandmarks(bestPoints);\n  lmTransform->Modified();\n\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  transformPD->SetInputData(source);\n  transformPD->SetTransform(lmTransform);\n  transformPD->Update();\n\n  source->DeepCopy(transformPD->GetOutput());\n}\nvoid BestBoundingBox(std::string const& axis, vtkPolyData* target,\n                     vtkPolyData* source, vtkPolyData* targetLandmarks,\n                     vtkPolyData* sourceLandmarks, double& bestDistance,\n                     vtkPoints* bestPoints)\n{\n  vtkNew<vtkHausdorffDistancePointSetFilter> distance;\n  vtkNew<vtkTransform> testTransform;\n  vtkNew<vtkTransformPolyDataFilter> testTransformPD;\n  vtkNew<vtkLandmarkTransform> lmTransform;\n  vtkNew<vtkTransformPolyDataFilter> lmTransformPD;\n\n  lmTransform->SetModeToSimilarity();\n  lmTransform->SetTargetLandmarks(targetLandmarks->GetPoints());\n\n  double sourceCenter[3];\n  sourceLandmarks->GetCenter(sourceCenter);\n\n  auto delta = 90.0;\n  for (auto i = 0; i < 4; ++i)\n  {\n    auto angle = delta * i;\n    // Rotate about center\n    testTransform->Identity();\n    testTransform->Translate(sourceCenter[0], sourceCenter[1], sourceCenter[2]);\n    if (axis == \"X\")\n    {\n      testTransform->RotateX(angle);\n    }\n    else if (axis == \"Y\")\n    {\n      testTransform->RotateY(angle);\n    }\n    else\n    {\n      testTransform->RotateZ(angle);\n    }\n    testTransform->Translate(-sourceCenter[0], -sourceCenter[1],\n                             -sourceCenter[2]);\n\n    testTransformPD->SetTransform(testTransform);\n    testTransformPD->SetInputData(sourceLandmarks);\n    testTransformPD->Update();\n\n    lmTransform->SetSourceLandmarks(testTransformPD->GetOutput()->GetPoints());\n    lmTransform->Modified();\n\n    lmTransformPD->SetInputData(source);\n    lmTransformPD->SetTransform(lmTransform);\n    lmTransformPD->Update();\n\n    distance->SetInputData(0, target);\n    distance->SetInputData(1, lmTransformPD->GetOutput());\n    distance->Update();\n\n    double testDistance = static_cast<vtkPointSet*>(distance->GetOutput(0))\n                              ->GetFieldData()\n                              ->GetArray(\"HausdorffDistance\")\n                              ->GetComponent(0, 0);\n    if (testDistance < bestDistance)\n    {\n      bestDistance = testDistance;\n      bestPoints->DeepCopy(testTransformPD->GetOutput()->GetPoints());\n    }\n  }\n  return;\n}\n\n} // namespace\n
        "},{"location":"Cxx/PolyData/AlignTwoPolyDatas/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AlignTwoPolyDatas)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AlignTwoPolyDatas: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AlignTwoPolyDatas MACOSX_BUNDLE AlignTwoPolyDatas.cxx )\n  target_link_libraries(AlignTwoPolyDatas PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AlignTwoPolyDatas\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/AlignTwoPolyDatas/#download-and-build-aligntwopolydatas","title":"Download and Build AlignTwoPolyDatas","text":"

        Click here to download AlignTwoPolyDatas and its CMakeLists.txt file. Once the tarball AlignTwoPolyDatas.tar has been downloaded and extracted,

        cd AlignTwoPolyDatas/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AlignTwoPolyDatas\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/AttachAttributes/","title":"AttachAttributes","text":"

        vtk-examples/Cxx/PolyData/AttachAttributes

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/AttachAttributes/#code","title":"Code","text":"

        AttachAttributes.cxx

        // vtk includes\n#include <vtkDoubleArray.h>\n#include <vtkInformation.h>\n#include <vtkInformationDoubleVectorKey.h>\n#include <vtkNew.h>\n\n// std includes\n#include <iostream>\n\nint main(int, char*[])\n{\n\n  // create a 2-element array\n  vtkNew<vtkDoubleArray> array;\n  array->SetName(\"array\");\n  array->SetNumberOfComponents(1);\n  array->SetNumberOfTuples(2);\n  array->SetValue(0, 1.);\n  array->SetValue(1, 2.);\n\n  // access the info (presently none stored)\n  vtkInformation* info = array->GetInformation();\n\n  // add one attribute, a double vector\n  const char* name = \"myKey\";\n  const char* location = \"MyClass\"; //\n  const int length = 3;\n  vtkInformationDoubleVectorKey* key =\n      new vtkInformationDoubleVectorKey(name, location, length);\n  double values[] = {0.1, 0.2, 0.3};\n  info->Set(key, values[0], values[1], values[2]);\n\n  // extract the key\n  double* vals = info->Get(key);\n  std::cout << \"extracted values are: \" << vals[0] << \", \" << vals[1] << \", \"\n            << vals[2] << '\\n';\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/AttachAttributes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AttachAttributes)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AttachAttributes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AttachAttributes MACOSX_BUNDLE AttachAttributes.cxx )\n  target_link_libraries(AttachAttributes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AttachAttributes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/AttachAttributes/#download-and-build-attachattributes","title":"Download and Build AttachAttributes","text":"

        Click here to download AttachAttributes and its CMakeLists.txt file. Once the tarball AttachAttributes.tar has been downloaded and extracted,

        cd AttachAttributes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AttachAttributes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/BooleanOperationPolyDataFilter/","title":"BooleanOperationPolyDataFilter","text":"

        vtk-examples/Cxx/PolyData/BooleanOperationPolyDataFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/BooleanOperationPolyDataFilter/#description","title":"Description","text":"

        The vtkBooleanOperationPolyDataFilter works best with \"clean\" data, so this examples first runs vtkTriangleFilter and then vtkCleanPolyData.

        This example can be run in three ways:

        1. BooleanOperationPolyDataFilter - Computes the intersection of two spheres

        2. BooleanOperationPolyDataFilter intersection|difference|union - Computes the intersection(difference or union) of two spheres

        3. BooleanOperationPolyDataFilter input1.vtk intersection|difference|union input2.vtk - Computes the intersection(difference or union) of two vtkPolyData's

        Cite

        See Boolean Operations on Surfaces in VTK Without External Libraries for details on the algorithm.

        Seealso

        LoopBooleanPolyDataFilter, it uses an alternative algorithm to do the boolean operations.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/BooleanOperationPolyDataFilter/#code","title":"Code","text":"

        BooleanOperationPolyDataFilter.cxx

        #include <vtkActor.h>\n#include <vtkBooleanOperationPolyDataFilter.h>\n#include <vtkCleanPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangleFilter.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkSphereSource.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkCamera.h>\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> input1;\n  vtkSmartPointer<vtkPolyData> input2;\n\n  std::string operation(\"intersection\");\n\n  if (argc == 4)\n  {\n    auto poly1 = ReadPolyData(argv[1]);\n    vtkNew<vtkTriangleFilter> tri1;\n    tri1->SetInputData(poly1);\n    vtkNew<vtkCleanPolyData> clean1;\n    clean1->SetInputConnection(tri1->GetOutputPort());\n    clean1->Update();\n    input1 = clean1->GetOutput();\n\n    auto poly2 = ReadPolyData(argv[3]);\n    vtkNew<vtkTriangleFilter> tri2;\n    tri2->SetInputData(poly2);\n    tri2->Update();\n    vtkNew<vtkCleanPolyData> clean2;\n    clean2->SetInputConnection(tri2->GetOutputPort());\n    clean2->Update();\n    input2 = clean2->GetOutput();\n    operation = argv[2];\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource1;\n    sphereSource1->SetCenter(0.25, 0, 0);\n    sphereSource1->SetPhiResolution(21);\n    sphereSource1->SetThetaResolution(21);\n    sphereSource1->Update();\n    input1 = sphereSource1->GetOutput();\n\n    vtkNew<vtkSphereSource> sphereSource2;\n    sphereSource2->Update();\n    input2 = sphereSource2->GetOutput();\n\n    if (argc == 2)\n    {\n      operation = argv[1];\n    }\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> input1Mapper;\n  input1Mapper->SetInputData(input1);\n  input1Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> input1Actor;\n  input1Actor->SetMapper(input1Mapper);\n  input1Actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  input1Actor->GetProperty()->SetSpecular(0.6);\n  input1Actor->GetProperty()->SetSpecularPower(20);\n  input1Actor->SetPosition(input1->GetBounds()[1] - input1->GetBounds()[0], 0,\n                           0);\n  vtkNew<vtkPolyDataMapper> input2Mapper;\n  input2Mapper->SetInputData(input2);\n  input2Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> input2Actor;\n  input2Actor->SetMapper(input2Mapper);\n  input2Actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  input2Actor->GetProperty()->SetSpecular(0.6);\n  input2Actor->GetProperty()->SetSpecularPower(20);\n  input2Actor->SetPosition(-(input1->GetBounds()[1] - input1->GetBounds()[0]),\n                           0, 0);\n  vtkNew<vtkBooleanOperationPolyDataFilter> booleanOperation;\n  if (operation == \"union\")\n  {\n    booleanOperation->SetOperationToUnion();\n  }\n  else if (operation == \"intersection\")\n  {\n    booleanOperation->SetOperationToIntersection();\n  }\n  else if (operation == \"difference\")\n  {\n    booleanOperation->SetOperationToDifference();\n  }\n  else\n  {\n    std::cout << \"Unknown operation: \" << operation << std::endl;\n    return EXIT_FAILURE;\n  }\n  booleanOperation->SetInputData(0, input1);\n  booleanOperation->SetInputData(1, input2);\n\n  vtkNew<vtkPolyDataMapper> booleanOperationMapper;\n  booleanOperationMapper->SetInputConnection(booleanOperation->GetOutputPort());\n  booleanOperationMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> booleanOperationActor;\n  booleanOperationActor->SetMapper(booleanOperationMapper);\n  booleanOperationActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  booleanOperationActor->GetProperty()->SetSpecular(.6);\n  booleanOperationActor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(input1Actor);\n  renderer->AddViewProp(input2Actor);\n  renderer->AddViewProp(booleanOperationActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"BooleanOperationPolyDataFilter\");\n\n  double viewUp[3] = {0.0, 0.0, 1.0};\n  double position[3] = {0.0, -1.0, 0.0};\n  PositionCamera(renderer, viewUp, position);\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position)\n{\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  renderer->GetActiveCamera()->SetViewUp(viewUp);\n  renderer->GetActiveCamera()->SetPosition(position);\n  renderer->ResetCamera();\n  return;\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/BooleanOperationPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BooleanOperationPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BooleanOperationPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BooleanOperationPolyDataFilter MACOSX_BUNDLE BooleanOperationPolyDataFilter.cxx )\n  target_link_libraries(BooleanOperationPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BooleanOperationPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/BooleanOperationPolyDataFilter/#download-and-build-booleanoperationpolydatafilter","title":"Download and Build BooleanOperationPolyDataFilter","text":"

        Click here to download BooleanOperationPolyDataFilter and its CMakeLists.txt file. Once the tarball BooleanOperationPolyDataFilter.tar has been downloaded and extracted,

        cd BooleanOperationPolyDataFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BooleanOperationPolyDataFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/Casting/","title":"Casting","text":"

        vtk-examples/Cxx/PolyData/Casting

        "},{"location":"Cxx/PolyData/Casting/#description","title":"Description","text":"

        This example creates a polydata object with 3 points and attaches a distance value to each point. To retrieve the array from the polydata, we have to use a SafeDownCast to the type that we want. This is necessary because to keep things as general as possible the polydata will return an abstract array class.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/Casting/#code","title":"Code","text":"

        Casting.cxx

        #include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  // Create points.\n  vtkNew<vtkPoints> points;\n\n  unsigned int numberOfPoints = 3;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Add the points to a polydata\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Add distances to each point\n  vtkNew<vtkDoubleArray> distances;\n  distances->SetNumberOfComponents(1);\n  distances->SetName(\"Distances\");\n\n  distances->InsertNextValue(1.1);\n  distances->InsertNextValue(2.2);\n  distances->InsertNextValue(3.3);\n\n  polydata->GetPointData()->AddArray(distances);\n\n  // Get the distances from the polydata.\n  vtkDoubleArray* array = dynamic_cast<vtkDoubleArray*>(\n      polydata->GetPointData()->GetArray(\"Distances\"));\n\n  if (array)\n  {\n    for (unsigned int i = 0; i < numberOfPoints; i++)\n    {\n      double dist;\n      dist = array->GetValue(i);\n      std::cout << \"Distance: \" << dist << std::endl;\n    }\n  }\n\n  // Cast the double distances to ints.\n  vtkDoubleArray* doubleDistances = dynamic_cast<vtkDoubleArray*>(\n      polydata->GetPointData()->GetArray(\"Distances\"));\n  vtkIntArray* intDistances = dynamic_cast<vtkIntArray*>(doubleDistances);\n\n  if (intDistances)\n  {\n    for (unsigned int i = 0; i < numberOfPoints; i++)\n    {\n      int dist;\n      dist = intDistances->GetValue(i);\n      std::cout << \"Distance: \" << dist << std::endl;\n    }\n  }\n  else\n  {\n    std::cout << \"invalid cast.\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/Casting/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Casting)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Casting: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Casting MACOSX_BUNDLE Casting.cxx )\n  target_link_libraries(Casting PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Casting\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/Casting/#download-and-build-casting","title":"Download and Build Casting","text":"

        Click here to download Casting and its CMakeLists.txt file. Once the tarball Casting.tar has been downloaded and extracted,

        cd Casting/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Casting\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CellCenters/","title":"CellCenters","text":"

        vtk-examples/Cxx/PolyData/CellCenters

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CellCenters/#code","title":"Code","text":"

        CellCenters.cxx

        #include <vtkActor.h>\n#include <vtkCellCenters.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(3, 3, 2);\n  imageData->SetSpacing(1.0, 1.0, 1.0);\n  imageData->SetOrigin(0.0, 0.0, 0.0);\n\n  vtkNew<vtkCellCenters> cellCentersFilter;\n  cellCentersFilter->SetInputData(imageData);\n  cellCentersFilter->VertexCellsOn();\n  cellCentersFilter->Update();\n\n  // Access the cell centers\n  for (vtkIdType i = 0; i < cellCentersFilter->GetOutput()->GetNumberOfPoints();\n       i++)\n  {\n    double p[3];\n    cellCentersFilter->GetOutput()->GetPoint(i, p);\n    cout << \"Point \" << i << \" : \" << p[0] << \" , \" << p[1] << \" , \" << p[2]\n         << endl;\n  }\n\n  // Display the cell centers\n  vtkNew<vtkDataSetMapper> centerMapper;\n  centerMapper->SetInputConnection(cellCentersFilter->GetOutputPort());\n  vtkNew<vtkActor> centerActor;\n  centerActor->SetMapper(centerMapper);\n  centerActor->GetProperty()->SetPointSize(5);\n  centerActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(imageData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderer> renderer;\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CellCenters\");\n\n  renderer->AddActor(actor);\n  renderer->AddActor(centerActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/CellCenters/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellCenters)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellCenters: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellCenters MACOSX_BUNDLE CellCenters.cxx )\n  target_link_libraries(CellCenters PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellCenters\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CellCenters/#download-and-build-cellcenters","title":"Download and Build CellCenters","text":"

        Click here to download CellCenters and its CMakeLists.txt file. Once the tarball CellCenters.tar has been downloaded and extracted,

        cd CellCenters/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellCenters\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CellCentersDemo/","title":"CellCentersDemo","text":"

        vtk-examples/Cxx/PolyData/CellCentersDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CellCentersDemo/#code","title":"Code","text":"

        CellCentersDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellCenters.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <algorithm>\n#include <vector>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Define the colors used in the example\n  vtkNew<vtkNamedColors> colors;\n\n  vtkColor3d actorColor = colors->GetColor3d(\"Banana\");\n  vtkColor3d pointActorColor = colors->GetColor3d(\"Peacock\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Silver\");\n\n  // Read the polydata\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  std::vector<double> bounds(6);\n  polyData->GetBounds(&bounds[0]);\n  std::vector<double> range(3);\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n\n  vtkNew<vtkCellCenters> centers;\n  centers->SetInputData(polyData);\n\n  auto maxRange = std::max_element(range.begin(), range.end());\n  double radius = 0;\n  if (argc > 1)\n  {\n    radius = *maxRange * 0.0025;\n  }\n  else\n  {\n    radius = *maxRange * 0.01;\n  }\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(11);\n  sphere->SetThetaResolution(11);\n  sphere->SetRadius(radius);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputConnection(centers->GetOutputPort());\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(pointActorColor.GetData());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(actorColor.GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->AddActor(pointActor);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n  renderer->SetBackground(backgroundColor.GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"CellCentersDemo\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/CellCentersDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellCentersDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellCentersDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellCentersDemo MACOSX_BUNDLE CellCentersDemo.cxx )\n  target_link_libraries(CellCentersDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellCentersDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CellCentersDemo/#download-and-build-cellcentersdemo","title":"Download and Build CellCentersDemo","text":"

        Click here to download CellCentersDemo and its CMakeLists.txt file. Once the tarball CellCentersDemo.tar has been downloaded and extracted,

        cd CellCentersDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellCentersDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CellEdgeNeighbors/","title":"CellEdgeNeighbors","text":"

        vtk-examples/Cxx/PolyData/CellEdgeNeighbors

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/CellEdgeNeighbors/#description","title":"Description","text":"

        Determine which cells share an edge with a specified cell.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CellEdgeNeighbors/#code","title":"Code","text":"

        CellEdgeNeighbors.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdList.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n\n#include <list>\n\nint main(int, char*[])\n{\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(sphereSource->GetOutputPort());\n  triangleFilter->Update();\n\n  vtkIdType cellId = 0;\n\n  vtkNew<vtkIdList> cellPointIds;\n  triangleFilter->GetOutput()->GetCellPoints(cellId, cellPointIds);\n\n  std::list<vtkIdType> neighbors;\n\n  for (vtkIdType i = 0; i < cellPointIds->GetNumberOfIds(); i++)\n  {\n    vtkNew<vtkIdList> idList;\n\n    // Add one of the edge points.\n    idList->InsertNextId(cellPointIds->GetId(i));\n\n    // Add the other edge point\n    if (i + 1 == cellPointIds->GetNumberOfIds())\n    {\n      idList->InsertNextId(cellPointIds->GetId(0));\n    }\n    else\n    {\n      idList->InsertNextId(cellPointIds->GetId(i + 1));\n    }\n\n    // Get the neighbors of the cell.\n    vtkNew<vtkIdList> neighborCellIds;\n\n    triangleFilter->GetOutput()->GetCellNeighbors(cellId, idList,\n                                                  neighborCellIds);\n\n    for (vtkIdType j = 0; j < neighborCellIds->GetNumberOfIds(); j++)\n    {\n      neighbors.push_back(neighborCellIds->GetId(j));\n    }\n  }\n\n  std::cout << \"Edge neighbor ids are: \" << std::endl;\n\n  for (auto it1 = neighbors.begin(); it1 != neighbors.end(); ++it1)\n  {\n    std::cout << \" \" << *it1;\n  }\n  std::cout << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  sphereMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"Lamp_Black\").GetData());\n  sphereActor->GetProperty()->EdgeVisibilityOn();\n  sphereActor->GetProperty()->SetLineWidth(5);\n\n  vtkNew<vtkDataSetMapper> mainCellMapper;\n\n  vtkNew<vtkDataSetMapper> neighborCellsMapper;\n\n  // Create a dataset with the cell of interest.\n  {\n    vtkNew<vtkIdTypeArray> ids;\n    ids->SetNumberOfComponents(1);\n    ids->InsertNextValue(cellId);\n\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::CELL);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n    extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    mainCellMapper->SetInputConnection(extractSelection->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> mainCellActor;\n  mainCellActor->SetMapper(mainCellMapper);\n  mainCellActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a dataset with the neighbor cells.\n  {\n    vtkNew<vtkIdTypeArray> ids;\n    ids->SetNumberOfComponents(1);\n    for (auto it1 = neighbors.begin(); it1 != neighbors.end(); ++it1)\n    {\n      ids->InsertNextValue(*it1);\n    }\n\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::CELL);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n    extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    neighborCellsMapper->SetInputConnection(extractSelection->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> neighborCellsActor;\n  neighborCellsActor->SetMapper(neighborCellsMapper);\n  neighborCellsActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(mainCellActor);\n  renderer->AddActor(neighborCellsActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"CellEdgeNeighbors\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/CellEdgeNeighbors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellEdgeNeighbors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellEdgeNeighbors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellEdgeNeighbors MACOSX_BUNDLE CellEdgeNeighbors.cxx )\n  target_link_libraries(CellEdgeNeighbors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellEdgeNeighbors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CellEdgeNeighbors/#download-and-build-celledgeneighbors","title":"Download and Build CellEdgeNeighbors","text":"

        Click here to download CellEdgeNeighbors and its CMakeLists.txt file. Once the tarball CellEdgeNeighbors.tar has been downloaded and extracted,

        cd CellEdgeNeighbors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellEdgeNeighbors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CellLocator/","title":"CellLocator","text":"

        vtk-examples/Cxx/PolyData/CellLocator

        "},{"location":"Cxx/PolyData/CellLocator/#description","title":"Description","text":"

        This example creates a sphere and then finds the closest point on the sphere to a test point.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CellLocator/#code","title":"Code","text":"

        CellLocator.cxx

        #include <vtkCellLocator.h>\n#include <vtkNew.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create the tree\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(sphereSource->GetOutput());\n  cellLocator->BuildLocator();\n\n  double testPoint[3] = {2.0, 0.0, 0.0};\n\n  // Find the closest points to TestPoint\n  double closestPoint[3];   // the coordinates of the closest point will be\n                            // returned here\n  double closestPointDist2; // the squared distance to the closest point will be\n                            // returned here\n  vtkIdType cellId; // the cell id of the cell containing the closest point will\n                    // be returned here\n  int subId;        // this is rarely used (in triangle strips only, I believe)\n  cellLocator->FindClosestPoint(testPoint, closestPoint, cellId, subId,\n                                closestPointDist2);\n\n  std::cout << \"Coordinates of closest point: \" << closestPoint[0] << \" \"\n            << closestPoint[1] << \" \" << closestPoint[2] << std::endl;\n  std::cout << \"Squared distance to closest point: \" << closestPointDist2\n            << std::endl;\n  std::cout << \"CellId: \" << cellId << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/CellLocator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellLocator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellLocator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellLocator MACOSX_BUNDLE CellLocator.cxx )\n  target_link_libraries(CellLocator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellLocator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CellLocator/#download-and-build-celllocator","title":"Download and Build CellLocator","text":"

        Click here to download CellLocator and its CMakeLists.txt file. Once the tarball CellLocator.tar has been downloaded and extracted,

        cd CellLocator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellLocator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CellLocatorVisualization/","title":"CellLocatorVisualization","text":"

        vtk-examples/Cxx/PolyData/CellLocatorVisualization

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/CellLocatorVisualization/#description","title":"Description","text":"

        The idea of this example is to navigate levels of a uniform spatial tree, vtkCellLocator, using a slider.

        Note

        It is not desirable to have CellsPerBucket set \"too small\". This is because at some point, refining a bucket will result in each cell in that bucket to also be in the bucket's children. This only wastes memory and computation. The value that is \"too small\" is dependent on the grid but in general a value between 10 and 100 should work well (the default value is 25).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CellLocatorVisualization/#code","title":"Code","text":"

        CellLocatorVisualization.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCellLocator.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n\nclass vtkSliderCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  vtkSliderCallback() : CellLocator(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->CellLocator->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkCellLocator* CellLocator;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n\nvoid SetSliderColors(vtkSliderRepresentation2D* slider);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> inputSource;\n  inputSource->SetPhiResolution(10);\n  inputSource->SetThetaResolution(10);\n  inputSource->Update();\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(inputSource->GetOutputPort());\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the tree.\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(inputSource->GetOutput());\n  cellLocator->BuildLocator();\n\n  // Initialize the representation.\n  vtkNew<vtkPolyData> polydata;\n  cellLocator->GenerateRepresentation(0, polydata);\n\n  vtkNew<vtkPolyDataMapper> locatorTreeMapper;\n  locatorTreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> locatorTreeActor;\n  locatorTreeActor->SetMapper(locatorTreeMapper);\n  locatorTreeActor->GetProperty()->SetInterpolationToFlat();\n  locatorTreeActor->GetProperty()->SetRepresentationToWireframe();\n  locatorTreeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Gold\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CellLocatorVisualization\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(locatorTreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(cellLocator->GetLevel());\n  sliderRep->SetValue(0);\n  sliderRep->SetTitleText(\"MaxPointsPerRegion\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(.2, .1);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(.8, .1);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  SetSliderColors(sliderRep);\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->CellLocator = cellLocator;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid SetSliderColors(vtkSliderRepresentation2D* slider)\n{\n  vtkNew<vtkNamedColors> colors;\n  // Set color properties:\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(colors->GetColor3d(\"Peru\").GetData());\n  // Change the color of the text indicating what the slider controls.\n  slider->GetTitleProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"DeepPink\").GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(colors->GetColor3d(\"Teal\").GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(colors->GetColor3d(\"Teal\").GetData());\n}\n\n} // namespace\n
        "},{"location":"Cxx/PolyData/CellLocatorVisualization/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellLocatorVisualization)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellLocatorVisualization: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellLocatorVisualization MACOSX_BUNDLE CellLocatorVisualization.cxx )\n  target_link_libraries(CellLocatorVisualization PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellLocatorVisualization\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CellLocatorVisualization/#download-and-build-celllocatorvisualization","title":"Download and Build CellLocatorVisualization","text":"

        Click here to download CellLocatorVisualization and its CMakeLists.txt file. Once the tarball CellLocatorVisualization.tar has been downloaded and extracted,

        cd CellLocatorVisualization/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellLocatorVisualization\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CellPointNeighbors/","title":"CellPointNeighbors","text":"

        vtk-examples/Cxx/PolyData/CellPointNeighbors

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/CellPointNeighbors/#description","title":"Description","text":"

        Determine which cells share at least a single point with a specified cell.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CellPointNeighbors/#code","title":"Code","text":"

        CellPointNeighbors.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdList.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n\n#include <list>\n\nint main(int, char*[])\n{\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(sphereSource->GetOutputPort());\n  triangleFilter->Update();\n\n  // Find all cells connected to point 0.\n  vtkIdType cellId = 0;\n\n  vtkNew<vtkIdList> cellPointIds;\n  triangleFilter->GetOutput()->GetCellPoints(cellId, cellPointIds);\n\n  // Neighbor cells may be listed multiple times.\n  // Use std::set instead of std::list if you want a unique list of neighbors.\n  std::list<vtkIdType> neighbors;\n\n  /* For each vertex of the cell, we calculate which cells use that point.\n   So if we do this for each vertex, we have all the neighbors.\n   In the case of using \"cellPointIds\" as a parameter of \"GetCellNeighbors\",\n   we will obtain an empty set. This is because the only cell that is using that\n   set of points is the current one. That is why we have to make each vertice at\n   time.*/\n\n  for (vtkIdType i = 0; i < cellPointIds->GetNumberOfIds(); i++)\n  {\n    vtkNew<vtkIdList> idList;\n    idList->InsertNextId(cellPointIds->GetId(i));\n\n    // Get the neighbors of the cell.\n    vtkNew<vtkIdList> neighborCellIds;\n\n    triangleFilter->GetOutput()->GetCellNeighbors(cellId, idList,\n                                                  neighborCellIds);\n\n    for (vtkIdType j = 0; j < neighborCellIds->GetNumberOfIds(); j++)\n    {\n      neighbors.push_back(neighborCellIds->GetId(j));\n    }\n  }\n\n  std::cout << \"Point neighbor ids are: \" << std::endl;\n\n  for (auto it1 = neighbors.begin(); it1 != neighbors.end(); ++it1)\n  {\n    std::cout << \" \" << *it1;\n  }\n  std::cout << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkDataSetMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  sphereMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"Lamp_Black\").GetData());\n  sphereActor->GetProperty()->EdgeVisibilityOn();\n  sphereActor->GetProperty()->SetLineWidth(3);\n\n  vtkNew<vtkDataSetMapper> mainCellMapper;\n\n  vtkNew<vtkDataSetMapper> neighborCellsMapper;\n\n  // Create a dataset with the cell of interest.\n  {\n    vtkNew<vtkIdTypeArray> ids;\n    ids->SetNumberOfComponents(1);\n    ids->InsertNextValue(cellId);\n\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::CELL);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n    extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    mainCellMapper->SetInputConnection(extractSelection->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> mainCellActor;\n  mainCellActor->SetMapper(mainCellMapper);\n  mainCellActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a dataset with the neighbor cells.\n  {\n    vtkNew<vtkIdTypeArray> ids;\n    ids->SetNumberOfComponents(1);\n    for (auto it1 = neighbors.begin(); it1 != neighbors.end(); ++it1)\n    {\n      ids->InsertNextValue(*it1);\n    }\n\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::CELL);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n    extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    neighborCellsMapper->SetInputConnection(extractSelection->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> neighborCellsActor;\n  neighborCellsActor->SetMapper(neighborCellsMapper);\n  neighborCellsActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CellPointNeighbors\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(mainCellActor);\n  renderer->AddActor(neighborCellsActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/CellPointNeighbors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellPointNeighbors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellPointNeighbors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellPointNeighbors MACOSX_BUNDLE CellPointNeighbors.cxx )\n  target_link_libraries(CellPointNeighbors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellPointNeighbors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CellPointNeighbors/#download-and-build-cellpointneighbors","title":"Download and Build CellPointNeighbors","text":"

        Click here to download CellPointNeighbors and its CMakeLists.txt file. Once the tarball CellPointNeighbors.tar has been downloaded and extracted,

        cd CellPointNeighbors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellPointNeighbors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CellTreeLocator/","title":"CellTreeLocator","text":"

        vtk-examples/Cxx/PolyData/CellTreeLocator

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CellTreeLocator/#code","title":"Code","text":"

        CellTreeLocator.cxx

        #include <vtkCellTreeLocator.h>\n#include <vtkGenericCell.h>\n#include <vtkNew.h>\n#include <vtkSphereSource.h>\n\n// Note that:\n// vtkCellTreeLocator moved from vtkFiltersGeneral to vtkCommonDataModel in\n// VTK commit 4a29e6f7dd9acb460644fe487d2e80aac65f7be9\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n  sphereSource->Update();\n\n  // Create the tree.\n  vtkNew<vtkCellTreeLocator> cellTree;\n  cellTree->SetDataSet(sphereSource->GetOutput());\n  cellTree->BuildLocator();\n\n  double testInside[3] = {0.5, 0.0, 0.0};\n  double testOutside[3] = {10.0, 0.0, 0.0};\n\n  double pcoords[3], weights[3];\n\n  vtkIdType cellId;\n\n  vtkNew<vtkGenericCell> cell;\n\n  int returnValue = EXIT_SUCCESS;\n\n  // Should be inside.\n  cellId = cellTree->FindCell(testInside, 0, cell, pcoords, weights);\n  if (cellId >= 0)\n  {\n    std::cout << \"First point: in cell \" << cellId << std::endl;\n  }\n  else\n  {\n    std::cout << \"ERROR: Cell was not found but should have been.\" << std::endl;\n    returnValue = EXIT_FAILURE;\n  }\n\n  // Should be outside.\n  cellId = cellTree->FindCell(testOutside, 0, cell, pcoords, weights);\n  if (cellId >= 0)\n  {\n    std::cout << \"ERROR: Found point in cell \" << cellId\n              << \" but it should be outside the domain.\" << std::endl;\n    returnValue = EXIT_FAILURE;\n  }\n  else\n  {\n    std::cout << \"Second point: outside\" << std::endl;\n  }\n\n  return returnValue;\n}\n
        "},{"location":"Cxx/PolyData/CellTreeLocator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellTreeLocator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellTreeLocator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellTreeLocator MACOSX_BUNDLE CellTreeLocator.cxx )\n  target_link_libraries(CellTreeLocator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellTreeLocator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CellTreeLocator/#download-and-build-celltreelocator","title":"Download and Build CellTreeLocator","text":"

        Click here to download CellTreeLocator and its CMakeLists.txt file. Once the tarball CellTreeLocator.tar has been downloaded and extracted,

        cd CellTreeLocator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellTreeLocator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CellsInsideObject/","title":"CellsInsideObject","text":"

        vtk-examples/Cxx/PolyData/CellsInsideObject

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/CellsInsideObject/#description","title":"Description","text":"

        This example illustrates how to extract the cells that exist inside a closed surface. It uses vtkSelectEnclosedPoints to mark points that are inside and outside the surface. vtkMultiThreshold is used to extract the three meshes into three vtkMultiBlockDataSet's. The cells completely outside are shown in crimson, completely inside are yellow and border cells are green. A translucent copy of the closed surface helps illustrate the selection process.

        If two polydata datasets are provided, the example uses the second as the closed surface. If only one dataset is provided, the closed surface is generated by rotating the first dataset by 90 degrees around its Y axis.

        Info

        The example is run with src/Testing/Data/cow.g.

        Warning

        The surface that contains cells must be closed and manifold. The example does not check for this. Run ClosedSurface (C++) or (Python) to check your surface.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CellsInsideObject/#code","title":"Code","text":"

        CellsInsideObject.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiThreshold.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelectEnclosedPoints.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkUnstructuredGrid.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <iostream>\n#include <string> // For find_last_of()\n#include <vector>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Read the polyData's\n  auto polyData1 = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n  auto polyData = ReadPolyData(argc > 2 ? argv[2] : \"\");\n  ;\n\n  vtkSmartPointer<vtkPolyData> polyData2;\n  vtkNew<vtkTransform> transform;\n  vtkNew<vtkTransformPolyDataFilter> transformPD;\n  // If only one polydata is present, generate a second polydata by\n  // rotating the orginal about its center.\n  if (argc < 3)\n  {\n    std::cout << \"Generating modified polyData1\" << std::endl;\n    double center[3];\n    polyData1->GetCenter(center);\n    transform->Translate(center[0], center[1], center[2]);\n    transform->RotateY(90.0);\n    transform->Translate(-center[0], -center[1], -center[2]);\n    transformPD->SetTransform(transform);\n    transformPD->SetInputData(polyData1);\n    transformPD->Update();\n    polyData2 = transformPD->GetOutput();\n  }\n  else\n  {\n    polyData2 = polyData;\n  }\n  // Mark points inside with 1 and outside with a 0\n  vtkNew<vtkSelectEnclosedPoints> select;\n  select->SetInputData(polyData1);\n  select->SetSurfaceData(polyData2);\n\n  // Extract three meshes, one completely inside, one completely\n  // outside and on the border between the inside and outside.\n\n  vtkNew<vtkMultiThreshold> threshold;\n  // Outside points have a 0 value in ALL points of a cell\n  int outsideId = threshold->AddBandpassIntervalSet(\n      0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, \"SelectedPoints\", 0, 1);\n  // Inside points have a 1 value in ALL points of a cell\n  int insideId = threshold->AddBandpassIntervalSet(\n      1, 1, vtkDataObject::FIELD_ASSOCIATION_POINTS, \"SelectedPoints\", 0, 1);\n  // Border points have a 0 or a 1 in at least one point of a cell\n  int borderId = threshold->AddIntervalSet(\n      0, 1, vtkMultiThreshold::OPEN, vtkMultiThreshold::OPEN,\n      vtkDataObject::FIELD_ASSOCIATION_POINTS, \"SelectedPoints\", 0, 0);\n\n  threshold->SetInputConnection(select->GetOutputPort());\n\n  // Select the intervals to be output\n  threshold->OutputSet(outsideId);\n  threshold->OutputSet(insideId);\n  threshold->OutputSet(borderId);\n  threshold->Update();\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d outsideColor = colors->GetColor3d(\"Crimson\");\n  vtkColor3d insideColor = colors->GetColor3d(\"Banana\");\n  vtkColor3d borderColor = colors->GetColor3d(\"Mint\");\n  vtkColor3d surfaceColor = colors->GetColor3d(\"Peacock\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Silver\");\n\n  // Outside\n  vtkNew<vtkDataSetMapper> outsideMapper;\n  outsideMapper->SetInputData(dynamic_cast<vtkUnstructuredGrid*>(\n      vtkMultiBlockDataSet::SafeDownCast(\n          threshold->GetOutput()->GetBlock(outsideId))\n          ->GetBlock(0)));\n  outsideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> outsideActor;\n  outsideActor->SetMapper(outsideMapper);\n  outsideActor->GetProperty()->SetDiffuseColor(outsideColor.GetData());\n  outsideActor->GetProperty()->SetSpecular(.6);\n  outsideActor->GetProperty()->SetSpecularPower(30);\n\n  // Inside\n  vtkNew<vtkDataSetMapper> insideMapper;\n  insideMapper->SetInputData(dynamic_cast<vtkUnstructuredGrid*>(\n      vtkMultiBlockDataSet::SafeDownCast(\n          threshold->GetOutput()->GetBlock(insideId))\n          ->GetBlock(0)));\n  insideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> insideActor;\n  insideActor->SetMapper(insideMapper);\n  insideActor->GetProperty()->SetDiffuseColor(insideColor.GetData());\n  insideActor->GetProperty()->SetSpecular(.6);\n  insideActor->GetProperty()->SetSpecularPower(30);\n  insideActor->GetProperty()->EdgeVisibilityOn();\n\n  // Border\n  vtkNew<vtkDataSetMapper> borderMapper;\n  borderMapper->SetInputData(dynamic_cast<vtkUnstructuredGrid*>(\n      vtkMultiBlockDataSet::SafeDownCast(\n          threshold->GetOutput()->GetBlock(borderId))\n          ->GetBlock(0)));\n  borderMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> borderActor;\n  borderActor->SetMapper(borderMapper);\n  borderActor->GetProperty()->SetDiffuseColor(borderColor.GetData());\n  borderActor->GetProperty()->SetSpecular(.6);\n  borderActor->GetProperty()->SetSpecularPower(30);\n  borderActor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkDataSetMapper> surfaceMapper;\n  surfaceMapper->SetInputData(polyData2);\n  surfaceMapper->ScalarVisibilityOff();\n\n  // Surface of object containing cell\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetDiffuseColor(surfaceColor.GetData());\n  surfaceActor->GetProperty()->SetOpacity(.1);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  renderer->AddActor(surfaceActor);\n  renderer->AddActor(outsideActor);\n  renderer->AddActor(insideActor);\n  renderer->AddActor(borderActor);\n\n  renderWindow->SetWindowName(\"CellsInsideObject\");\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/CellsInsideObject/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CellsInsideObject)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CellsInsideObject: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CellsInsideObject MACOSX_BUNDLE CellsInsideObject.cxx )\n  target_link_libraries(CellsInsideObject PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CellsInsideObject\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CellsInsideObject/#download-and-build-cellsinsideobject","title":"Download and Build CellsInsideObject","text":"

        Click here to download CellsInsideObject and its CMakeLists.txt file. Once the tarball CellsInsideObject.tar has been downloaded and extracted,

        cd CellsInsideObject/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CellsInsideObject\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CenterOfMass/","title":"CenterOfMass","text":"

        vtk-examples/Cxx/PolyData/CenterOfMass

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CenterOfMass/#code","title":"Code","text":"

        CenterOfMass.cxx

        #include <vtkCenterOfMass.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\n#include <cmath>\n#include <limits>\n\nint main(int, char*[])\n{\n  // Create a point set of a square.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(0, 1, 0);\n  points->InsertNextPoint(1, 1, 0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Compute the center of mass.\n  vtkNew<vtkCenterOfMass> centerOfMassFilter;\n  centerOfMassFilter->SetInputData(polydata);\n  centerOfMassFilter->SetUseScalarsAsWeights(false);\n  centerOfMassFilter->Update();\n\n  double center[3];\n  centerOfMassFilter->GetCenter(center);\n\n  std::cout << \"Center of mass is \" << center[0] << \" \" << center[1] << \" \"\n            << center[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/CenterOfMass/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CenterOfMass)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CenterOfMass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CenterOfMass MACOSX_BUNDLE CenterOfMass.cxx )\n  target_link_libraries(CenterOfMass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CenterOfMass\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CenterOfMass/#download-and-build-centerofmass","title":"Download and Build CenterOfMass","text":"

        Click here to download CenterOfMass and its CMakeLists.txt file. Once the tarball CenterOfMass.tar has been downloaded and extracted,

        cd CenterOfMass/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CenterOfMass\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CleanPolyData/","title":"CleanPolyData","text":"

        vtk-examples/Cxx/PolyData/CleanPolyData

        "},{"location":"Cxx/PolyData/CleanPolyData/#description","title":"Description","text":"

        When a cube is created, it has 24 vertices (4 for each face). This is done because the normal at each face is very different. Often we would want a cube to only have 8 vertices. The vtkCleanPolyData filter removes coincident points, resulting in the cube we would expect.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CleanPolyData/#code","title":"Code","text":"

        CleanPolyData.cxx

        #include <vtkCleanPolyData.h>\n#include <vtkCubeSource.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  std::cout << \"Input cube has \" << cubeSource->GetOutput()->GetNumberOfPoints()\n            << \" vertices.\" << std::endl;\n\n  vtkNew<vtkCleanPolyData> cleanPolyData;\n  cleanPolyData->SetInputConnection(cubeSource->GetOutputPort());\n  cleanPolyData->Update();\n\n  std::cout << \"Cleaned cube has \"\n            << cleanPolyData->GetOutput()->GetNumberOfPoints() << \" vertices.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/CleanPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CleanPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CleanPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CleanPolyData MACOSX_BUNDLE CleanPolyData.cxx )\n  target_link_libraries(CleanPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CleanPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CleanPolyData/#download-and-build-cleanpolydata","title":"Download and Build CleanPolyData","text":"

        Click here to download CleanPolyData and its CMakeLists.txt file. Once the tarball CleanPolyData.tar has been downloaded and extracted,

        cd CleanPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CleanPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ClosedSurface/","title":"ClosedSurface","text":"

        vtk-examples/Cxx/PolyData/ClosedSurface

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ClosedSurface/#code","title":"Code","text":"

        ClosedSurface.cxx

        #include <vtkFeatureEdges.h>\n#include <vtkNew.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  std::string fileName = \"vtkSphereSource\";\n  if (argc > 1)\n  {\n    fileName = argv[1];\n  }\n\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(fileName.c_str());\n\n  vtkNew<vtkFeatureEdges> featureEdges;\n  featureEdges->FeatureEdgesOff();\n  featureEdges->BoundaryEdgesOn();\n  featureEdges->NonManifoldEdgesOn();\n  featureEdges->ManifoldEdgesOff();\n  featureEdges->SetInputData(polyData);\n  featureEdges->Update();\n\n  int numberOfOpenEdges = featureEdges->GetOutput()->GetNumberOfCells();\n\n  if (numberOfOpenEdges > 0)\n  {\n    std::cout << fileName << \": Surface is not closed\" << std::endl;\n  }\n  else\n  {\n    std::cout << fileName << \": Surface is closed\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/ClosedSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClosedSurface)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClosedSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClosedSurface MACOSX_BUNDLE ClosedSurface.cxx )\n  target_link_libraries(ClosedSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClosedSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ClosedSurface/#download-and-build-closedsurface","title":"Download and Build ClosedSurface","text":"

        Click here to download ClosedSurface and its CMakeLists.txt file. Once the tarball ClosedSurface.tar has been downloaded and extracted,

        cd ClosedSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClosedSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ColorCells/","title":"ColorCells","text":"

        vtk-examples/Cxx/PolyData/ColorCells

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ColorCells/#description","title":"Description","text":"

        This example shows how to assign specific colors to individual cells of a vtkPolyData using a vtkLookupTable. The vtkCellData has a vtkFloatArray that contains a scalar values.

        Seealso

        The example ColorCellsWithRGB creates a vtkCellData with a vtkUnsignedCharArray that contains rgb values.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ColorCells/#code","title":"Code","text":"

        ColorCells.cxx

        #include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <algorithm>\n\nnamespace {\nvoid RandomColors(vtkLookupTable* lut, int numberOfColors);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Provide some geometry.\n  int resolution = 3;\n  vtkNew<vtkPlaneSource> aPlane;\n  aPlane->SetXResolution(resolution);\n  aPlane->SetYResolution(resolution);\n\n  // Create cell data.\n  vtkNew<vtkFloatArray> cellData;\n  for (int i = 0; i < resolution * resolution; i++)\n  {\n    cellData->InsertNextValue(i + 1);\n  }\n\n  // Create a lookup table to map cell data to colors.\n  vtkNew<vtkLookupTable> lut;\n  int tableSize = std::max(resolution * resolution + 1, 10);\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n  RandomColors(lut, tableSize);\n\n  aPlane->Update(); // Force an update so we can set cell data.\n  aPlane->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(aPlane->GetOutputPort());\n  mapper->SetScalarRange(0, tableSize - 1);\n  mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColorCells\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid RandomColors(vtkLookupTable* lut, int numberOfColors)\n{\n  // Fill in a few known colors, the rest will be generated if needed\n  vtkNew<vtkNamedColors> colors;\n  lut->SetTableValue(0, colors->GetColor4d(\"Black\").GetData());\n  lut->SetTableValue(1, colors->GetColor4d(\"Banana\").GetData());\n  lut->SetTableValue(2, colors->GetColor4d(\"Tomato\").GetData());\n  lut->SetTableValue(3, colors->GetColor4d(\"Wheat\").GetData());\n  lut->SetTableValue(4, colors->GetColor4d(\"Lavender\").GetData());\n  lut->SetTableValue(5, colors->GetColor4d(\"Flesh\").GetData());\n  lut->SetTableValue(6, colors->GetColor4d(\"Raspberry\").GetData());\n  lut->SetTableValue(7, colors->GetColor4d(\"Salmon\").GetData());\n  lut->SetTableValue(8, colors->GetColor4d(\"Mint\").GetData());\n  lut->SetTableValue(9, colors->GetColor4d(\"Peacock\").GetData());\n\n  // If the number of colors is larger than the number of specified colors,\n  // generate some random colors.\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(4355412);\n  if (numberOfColors > 9)\n  {\n    for (auto i = 10; i < numberOfColors; ++i)\n    {\n      double r, g, b;\n      r = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      g = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      b = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      lut->SetTableValue(i, r, g, b, 1.0);\n    }\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/PolyData/ColorCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorCells MACOSX_BUNDLE ColorCells.cxx )\n  target_link_libraries(ColorCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ColorCells/#download-and-build-colorcells","title":"Download and Build ColorCells","text":"

        Click here to download ColorCells and its CMakeLists.txt file. Once the tarball ColorCells.tar has been downloaded and extracted,

        cd ColorCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ColorCellsWithRGB/","title":"ColorCellsWithRGB","text":"

        vtk-examples/Cxx/PolyData/ColorCellsWithRGB

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ColorCellsWithRGB/#description","title":"Description","text":"

        This example shows how to assign specific colors to individual cells of a vtkPolyData. This example stores the vtkCellData as rgb triples in a vtkUnsignedCharArray.

        Seealso

        The example ColorCells creates a vtkCellData with a vtkFloatArray that contains index values for a vtkLookupTable.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ColorCellsWithRGB/#code","title":"Code","text":"

        ColorCellsWithRGB.cxx

        #include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n\nint main(int, char*[])\n{\n  // Provide some geometry.\n  int resolutionX = 5;\n  int resolutionY = 3;\n\n  vtkNew<vtkPlaneSource> aPlane;\n  aPlane->SetXResolution(resolutionX);\n  aPlane->SetYResolution(resolutionY);\n  aPlane->Update();\n\n  // Create cell data.\n  vtkNew<vtkUnsignedCharArray> cellData;\n  cellData->SetNumberOfComponents(3);\n  cellData->SetNumberOfTuples(aPlane->GetOutput()->GetNumberOfCells());\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  auto min_r = 64.0;\n  auto max_r = 255.0;\n  for (int i = 0; i < aPlane->GetOutput()->GetNumberOfCells(); i++)\n  {\n    double rgb[3];\n    for (auto j = 0; j < 3; ++j)\n    {\n      rgb[j] = randomSequence->GetRangeValue(min_r, max_r);\n      randomSequence->Next();\n    }\n    cellData->InsertTuple(i, rgb);\n  }\n\n  aPlane->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  // Setup actor and mapper.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(aPlane->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColorCellsWithRGB\");\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ColorCellsWithRGB/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorCellsWithRGB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorCellsWithRGB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorCellsWithRGB MACOSX_BUNDLE ColorCellsWithRGB.cxx )\n  target_link_libraries(ColorCellsWithRGB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorCellsWithRGB\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ColorCellsWithRGB/#download-and-build-colorcellswithrgb","title":"Download and Build ColorCellsWithRGB","text":"

        Click here to download ColorCellsWithRGB and its CMakeLists.txt file. Once the tarball ColorCellsWithRGB.tar has been downloaded and extracted,

        cd ColorCellsWithRGB/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorCellsWithRGB\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ColorDisconnectedRegions/","title":"ColorDisconnectedRegions","text":"

        vtk-examples/Cxx/PolyData/ColorDisconnectedRegions

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ColorDisconnectedRegions/#code","title":"Code","text":"

        ColorDisconnectedRegions.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create some spheres.\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->Update();\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(5, 0, 0);\n  sphereSource2->Update();\n\n  vtkNew<vtkSphereSource> sphereSource3;\n  sphereSource3->SetCenter(10, 0, 0);\n  sphereSource3->Update();\n\n  vtkNew<vtkAppendPolyData> appendFilter;\n  appendFilter->AddInputConnection(sphereSource1->GetOutputPort());\n  appendFilter->AddInputConnection(sphereSource2->GetOutputPort());\n  appendFilter->AddInputConnection(sphereSource3->GetOutputPort());\n  appendFilter->Update();\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputConnection(appendFilter->GetOutputPort());\n  connectivityFilter->SetExtractionModeToAllRegions();\n  connectivityFilter->ColorRegionsOn();\n  connectivityFilter->Update();\n\n  // Visualize.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(connectivityFilter->GetOutputPort());\n  mapper->SetScalarRange(connectivityFilter->GetOutput()\n                             ->GetPointData()\n                             ->GetArray(\"RegionId\")\n                             ->GetRange());\n  mapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ColorDisconnectedRegions\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ColorDisconnectedRegions/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorDisconnectedRegions)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorDisconnectedRegions: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorDisconnectedRegions MACOSX_BUNDLE ColorDisconnectedRegions.cxx )\n  target_link_libraries(ColorDisconnectedRegions PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorDisconnectedRegions\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ColorDisconnectedRegions/#download-and-build-colordisconnectedregions","title":"Download and Build ColorDisconnectedRegions","text":"

        Click here to download ColorDisconnectedRegions and its CMakeLists.txt file. Once the tarball ColorDisconnectedRegions.tar has been downloaded and extracted,

        cd ColorDisconnectedRegions/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorDisconnectedRegions\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ColorDisconnectedRegionsDemo/","title":"ColorDisconnectedRegionsDemo","text":"

        vtk-examples/Cxx/PolyData/ColorDisconnectedRegionsDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ColorDisconnectedRegionsDemo/#code","title":"Code","text":"

        ColorDisconnectedRegionsDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n// #include <random>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\nvoid RandomColors(vtkLookupTable* lut, int numberOfColors);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputData(polyData);\n  connectivityFilter->SetExtractionModeToAllRegions();\n  connectivityFilter->ColorRegionsOn();\n  connectivityFilter->Update();\n\n  // Visualize.\n  auto numberOfRegions = connectivityFilter->GetNumberOfExtractedRegions();\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(std::max(numberOfRegions, 10));\n  lut->Build();\n  RandomColors(lut, numberOfRegions);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(connectivityFilter->GetOutputPort());\n  mapper->SetScalarRange(connectivityFilter->GetOutput()\n                             ->GetPointData()\n                             ->GetArray(\"RegionId\")\n                             ->GetRange());\n  mapper->SetLookupTable(lut);\n  mapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  // Create a useful view.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.2);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ColorDisconnectedRegions\");\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetInteractorStyle(style);\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid RandomColors(vtkLookupTable* lut, int numberOfColors)\n{\n  // Fill in a few known colors, the rest will be generated if needed.\n  vtkNew<vtkNamedColors> colors;\n  lut->SetTableValue(0, colors->GetColor4d(\"Gold\").GetData());\n  lut->SetTableValue(1, colors->GetColor4d(\"Banana\").GetData());\n  lut->SetTableValue(2, colors->GetColor4d(\"Tomato\").GetData());\n  lut->SetTableValue(3, colors->GetColor4d(\"Wheat\").GetData());\n  lut->SetTableValue(4, colors->GetColor4d(\"Lavender\").GetData());\n  lut->SetTableValue(5, colors->GetColor4d(\"Flesh\").GetData());\n  lut->SetTableValue(6, colors->GetColor4d(\"Raspberry\").GetData());\n  lut->SetTableValue(7, colors->GetColor4d(\"Salmon\").GetData());\n  lut->SetTableValue(8, colors->GetColor4d(\"Mint\").GetData());\n  lut->SetTableValue(9, colors->GetColor4d(\"Peacock\").GetData());\n\n  // If the number of colors is larger than the number of specified colors,\n  // generate some random colors.\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(4355412);\n  if (numberOfColors > 9)\n  {\n    for (auto i = 10; i < numberOfColors; ++i)\n    {\n      double r, g, b;\n      r = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      g = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      b = randomSequence->GetRangeValue(0.6, 1.0);\n      randomSequence->Next();\n      lut->SetTableValue(i, r, g, b, 1.0);\n    }\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/ColorDisconnectedRegionsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorDisconnectedRegionsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorDisconnectedRegionsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorDisconnectedRegionsDemo MACOSX_BUNDLE ColorDisconnectedRegionsDemo.cxx )\n  target_link_libraries(ColorDisconnectedRegionsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorDisconnectedRegionsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ColorDisconnectedRegionsDemo/#download-and-build-colordisconnectedregionsdemo","title":"Download and Build ColorDisconnectedRegionsDemo","text":"

        Click here to download ColorDisconnectedRegionsDemo and its CMakeLists.txt file. Once the tarball ColorDisconnectedRegionsDemo.tar has been downloaded and extracted,

        cd ColorDisconnectedRegionsDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorDisconnectedRegionsDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ColoredPoints/","title":"ColoredPoints","text":"

        vtk-examples/Cxx/PolyData/ColoredPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ColoredPoints/#code","title":"Code","text":"

        ColoredPoints.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <vtkNamedColors.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  vtkNew<vtkPolyData> pointsPolydata;\n\n  pointsPolydata->SetPoints(points);\n\n  vtkNew<vtkVertexGlyphFilter> vertexFilter;\n  vertexFilter->SetInputData(pointsPolydata);\n  vertexFilter->Update();\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->ShallowCopy(vertexFilter->GetOutput());\n\n  // Setup colors\n  vtkNew<vtkNamedColors> namedColors;\n\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"Tomato\").GetData());\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"Mint\").GetData());\n  colors->InsertNextTupleValue(namedColors->GetColor3ub(\"Peacock\").GetData());\n\n  polydata->GetPointData()->SetScalars(colors);\n\n  // Visualization\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(10);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColoredPoints\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"Burlywood\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ColoredPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColoredPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColoredPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColoredPoints MACOSX_BUNDLE ColoredPoints.cxx )\n  target_link_libraries(ColoredPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColoredPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ColoredPoints/#download-and-build-coloredpoints","title":"Download and Build ColoredPoints","text":"

        Click here to download ColoredPoints and its CMakeLists.txt file. Once the tarball ColoredPoints.tar has been downloaded and extracted,

        cd ColoredPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColoredPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CombineImportedActors/","title":"CombineImportedActors","text":"

        vtk-examples/Cxx/PolyData/CombineImportedActors

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CombineImportedActors/#code","title":"Code","text":"

        CombineImportedActors.cxx

        // Importers\n#include <vtk3DSImporter.h>\n#include <vtkGLTFImporter.h>\n#include <vtkOBJImporter.h>\n#include <vtkVRMLImporter.h>\n\n// Rendering\n#include <vtkActorCollection.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Pipeline\n#include <vtkAppendPolyData.h>\n#include <vtkCellData.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkUnsignedCharArray.h>\n\n#include <algorithm> // For transform()\n#include <cctype>    // For to_lower\n#include <string>    // For find_last_of()\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkRenderWindow> importRenderWindow;\n  vtkSmartPointer<vtkRenderer> importRenderer;\n\n  if (argc < 2)\n  {\n    std::cerr << \"Need a file e.g. iflamingo.3ds\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n  std::string extension = \"\";\n  int filePrefixArgOffset = 0; // Depends on importer.\n\n  // Make the extension lowercase.\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\") + 1);\n  }\n  if (extension == \"wrl\")\n  {\n    vtkNew<vtkVRMLImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(importRenderWindow);\n    importRenderWindow = importer->GetRenderWindow();\n    importer->Read();\n    importRenderer = importer->GetRenderer();\n    // filePrefixArgOffset = 2;\n  }\n  else if (extension == \"3ds\")\n  {\n    vtkNew<vtk3DSImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(importRenderWindow);\n    importRenderWindow = importer->GetRenderWindow();\n    importer->Read();\n    importRenderer = importer->GetRenderer();\n    // filePrefixArgOffset = 2;\n  }\n  else if (extension == \"gltf\" || extension == \"glb\")\n  {\n    vtkNew<vtkGLTFImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetRenderWindow(importRenderWindow);\n    importRenderWindow = importer->GetRenderWindow();\n    importer->Read();\n    importRenderer = importer->GetRenderer();\n    // filePrefixArgOffset = 2;\n  }\n  else if (extension == \"obj\")\n  {\n    vtkNew<vtkOBJImporter> importer;\n    importer->SetFileName(argv[1]);\n    importer->SetFileNameMTL(argv[2]);\n    importer->SetTexturePath(argv[3]);\n    importer->SetRenderWindow(importRenderWindow);\n    importRenderWindow = importer->GetRenderWindow();\n    importer->Read();\n    importRenderer = importer->GetRenderer();\n    // filePrefixArgOffset = 4;\n  }\n  vtkNew<vtkAppendPolyData> append;\n  vtkActorCollection* allActors = importRenderer->GetActors();\n  vtkCollectionSimpleIterator actorsIt;\n  vtkActor* anActor = nullptr;\n  ;\n  allActors->InitTraversal(actorsIt);\n  while ((anActor = allActors->GetNextActor(actorsIt)))\n  {\n    vtkNew<vtkPolyData> appendPD;\n    vtkPolyData* pd;\n    anActor->GetMapper()->Update();\n    if (anActor->GetUserMatrix() != nullptr)\n    {\n      vtkNew<vtkTransform> transform;\n      transform->SetMatrix(anActor->GetUserMatrix());\n      vtkNew<vtkTransformPolyDataFilter> transformPD;\n      transformPD->SetTransform(transform);\n      transformPD->SetInputData(\n          dynamic_cast<vtkPolyData*>(anActor->GetMapper()->GetInput()));\n      transformPD->Update();\n      appendPD->DeepCopy(transformPD->GetOutput());\n    }\n    else\n    {\n      pd = dynamic_cast<vtkPolyData*>(anActor->GetMapper()->GetInput());\n      appendPD->DeepCopy(pd);\n    }\n    vtkNew<vtkUnsignedCharArray> cellData;\n    cellData->SetNumberOfComponents(3);\n    cellData->SetNumberOfTuples(appendPD->GetNumberOfCells());\n    for (int i = 0; i < appendPD->GetNumberOfCells(); i++)\n    {\n      double rgb[4];\n      anActor->GetProperty()->GetDiffuseColor(rgb);\n      for (int j = 0; j < 4; ++j)\n      {\n        rgb[j] *= 255.0;\n      }\n      cellData->InsertTuple(i, rgb);\n    }\n    appendPD->GetCellData()->SetScalars(cellData);\n\n    append->AddInputData(appendPD);\n  }\n  append->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(append->GetOutput());\n  mapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"CombineImportedActors\");\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  // renderer->SetActiveCamera(importRenderer->GetActiveCamera());\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-7, 34, 2);\n  camera->SetViewUp(0, 0, 1);\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/CombineImportedActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CombineImportedActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  IOImport\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CombineImportedActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CombineImportedActors MACOSX_BUNDLE CombineImportedActors.cxx )\n  target_link_libraries(CombineImportedActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CombineImportedActors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CombineImportedActors/#download-and-build-combineimportedactors","title":"Download and Build CombineImportedActors","text":"

        Click here to download CombineImportedActors and its CMakeLists.txt file. Once the tarball CombineImportedActors.tar has been downloaded and extracted,

        cd CombineImportedActors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CombineImportedActors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ContoursToSurface/","title":"ContoursToSurface","text":"

        vtk-examples/Cxx/PolyData/ContoursToSurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ContoursToSurface/#description","title":"Description","text":"

        This example creates a stack of 21 circles and creates a closed surface from them.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ContoursToSurface/#code","title":"Code","text":"

        ContoursToSurface.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCellArray.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVoxelContoursToSurfaceFilter.h>\n\nnamespace {\nvoid CreateCircle(const double& z, const double& radius, const int& resolution,\n                  vtkPolyData* polyData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the data: a series of discs representing the intersections of x-y\n  // planes through a unit sphere centered at 0, 0, 0\n  //\n  int numDivisions = 20;\n  int resolution = 100;\n  double lastz = 0.0;\n  double z = 0.0;\n  // double radius = 0.0;\n  double sphereRadius = 1.0;\n  double zmin = -0.9 * sphereRadius;\n  double zmax = 0.9 * sphereRadius;\n\n  // Append all the discs into one polydata\n  //\n  vtkNew<vtkAppendPolyData> appendFilter;\n\n  for (int i = 0; i <= numDivisions; ++i)\n  {\n    lastz = z;\n    double u = i / double(numDivisions);\n    z = (1. - u) * zmin + u * zmax;\n    auto radius = sqrt(sphereRadius * sphereRadius - z * z);\n    vtkNew<vtkPolyData> circle;\n    CreateCircle(z, radius, resolution, circle);\n    appendFilter->AddInputData(circle);\n  }\n\n  double deltaz = z - lastz;\n\n  if (!appendFilter->GetNumberOfInputConnections(0))\n  {\n    cerr << \"error, no contours!\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  appendFilter->Update();\n\n  // Convert to ijk coordinates for the contour to surface filter\n  //\n  double bounds[6];\n  vtkPolyData* contours = appendFilter->GetOutput();\n  contours->GetBounds(bounds);\n  double origin[3] = {bounds[0], bounds[2], bounds[4]};\n  double spacing[3] = {(bounds[1] - bounds[0]) / 40,\n                       (bounds[3] - bounds[2]) / 40, deltaz};\n\n  vtkNew<vtkPolyData> poly;\n  vtkNew<vtkPoints> points;\n  vtkPoints* contourPoints = contours->GetPoints();\n  int numPoints = contourPoints->GetNumberOfPoints();\n  points->SetNumberOfPoints(numPoints);\n  for (int i = 0; i < numPoints; ++i)\n  {\n    double pt[3];\n    contourPoints->GetPoint(i, pt);\n    pt[0] = static_cast<int>((pt[0] - origin[0]) / spacing[0] + 0.5);\n    pt[1] = static_cast<int>((pt[1] - origin[1]) / spacing[1] + 0.5);\n    pt[2] = static_cast<int>((pt[2] - origin[2]) / spacing[2] + 0.5);\n    points->SetPoint(i, pt);\n  }\n  poly->SetPolys(contours->GetPolys());\n  poly->SetPoints(points);\n\n  // Create the contour to surface filter\n  //\n  vtkNew<vtkVoxelContoursToSurfaceFilter> contoursToSurface;\n  contoursToSurface->SetInputData(poly);\n  contoursToSurface->SetSpacing(spacing[0], spacing[1], spacing[2]);\n  contoursToSurface->Update();\n\n  // Rescale the output back into world coordinates and center it\n  //\n  double scaleCenter[3];\n  contoursToSurface->GetOutput()->GetCenter(scaleCenter);\n  double scaleBounds[6];\n  contoursToSurface->GetOutput()->GetBounds(scaleBounds);\n  double center[3];\n  contours->GetCenter(center);\n\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(contoursToSurface->GetOutputPort());\n  vtkNew<vtkTransform> transform;\n  transformFilter->SetTransform(transform);\n  transform->Translate(-scaleCenter[0], -scaleCenter[1], -scaleCenter[2]);\n  transform->Scale((bounds[1] - bounds[0]) / (scaleBounds[1] - scaleBounds[0]),\n                   (bounds[3] - bounds[2]) / (scaleBounds[3] - scaleBounds[2]),\n                   (bounds[5] - bounds[4]) / (scaleBounds[5] - scaleBounds[4]));\n  transform->Translate(center[0], center[1], center[2]);\n\n  // Visualize the contours\n  //\n  vtkNew<vtkPolyDataMapper> contoursMapper;\n  contoursMapper->SetInputData(contours);\n  contoursMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> contoursActor;\n  contoursActor->SetMapper(contoursMapper);\n  contoursActor->GetProperty()->SetRepresentationToWireframe();\n  contoursActor->GetProperty()->ShadingOff();\n  contoursActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize the surface\n  //\n  vtkNew<vtkPolyDataMapper> surfaceMapper;\n  surfaceMapper->SetInputConnection(transformFilter->GetOutputPort());\n  surfaceMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> surfaceActor;\n  surfaceActor->SetMapper(surfaceMapper);\n  surfaceActor->GetProperty()->SetRepresentationToWireframe();\n  surfaceActor->GetProperty()->ShadingOff();\n  surfaceActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create two renderers side by side to show the contours and the surface\n  // separately\n  //\n  std::cout << \"Press 't' for trackball interaction\" << std::endl;\n  std::cout << \"Press 'r' to reset the camera\" << std::endl;\n  std::cout << \"Press 'w' for wireframe representation\" << std::endl;\n  std::cout << \"Press 's' for surface representation\" << std::endl;\n\n  vtkNew<vtkRenderer> renderer1;\n  renderer1->SetViewport(0., 0., 0.5, 1.);\n  renderer1->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  vtkNew<vtkRenderer> renderer2;\n  renderer2->SetViewport(0.5, 0., 1., 1.);\n  renderer2->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(800, 400);\n  renderWindow->SetWindowName(\"ContoursToSurface\");\n\n  renderWindow->AddRenderer(renderer1);\n  renderWindow->AddRenderer(renderer2);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer1->AddViewProp(surfaceActor);\n  renderer2->AddViewProp(contoursActor);\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateCircle(const double& z, const double& radius, const int& resolution,\n                  vtkPolyData* polyData)\n{\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> cells;\n\n  points->SetNumberOfPoints(resolution);\n  cells->Allocate(1, resolution);\n  cells->InsertNextCell(resolution);\n\n  for (int i = 0; i < resolution; ++i)\n  {\n    double theta = vtkMath::RadiansFromDegrees(360. * i / double(resolution));\n    double x = radius * cos(theta);\n    double y = radius * sin(theta);\n    points->SetPoint(i, x, y, z);\n    cells->InsertCellPoint(i);\n  }\n\n  polyData->Initialize();\n  polyData->SetPolys(cells);\n  polyData->SetPoints(points);\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/ContoursToSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ContoursToSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ContoursToSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ContoursToSurface MACOSX_BUNDLE ContoursToSurface.cxx )\n  target_link_libraries(ContoursToSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ContoursToSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ContoursToSurface/#download-and-build-contourstosurface","title":"Download and Build ContoursToSurface","text":"

        Click here to download ContoursToSurface and its CMakeLists.txt file. Once the tarball ContoursToSurface.tar has been downloaded and extracted,

        cd ContoursToSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ContoursToSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ConvexHull/","title":"ConvexHull","text":"

        vtk-examples/Cxx/PolyData/ConvexHull

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ConvexHull/#code","title":"Code","text":"

        ConvexHull.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkHull.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required arguments: Filename e.g. cowHead.vtp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkHull> hullFilter;\n  hullFilter->SetInputConnection(reader->GetOutputPort());\n  hullFilter->AddCubeFacePlanes();\n  hullFilter->AddRecursiveSpherePlanes(5);\n\n  vtkNew<vtkDataSetMapper> originalMapper;\n  originalMapper->SetInputConnection(reader->GetOutputPort());\n  originalMapper->ScalarVisibilityOff();\n\n  // Create an actor for the surface.\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(hullFilter->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the surface.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->SetOpacity(0.5);\n  actor->GetProperty()->EdgeVisibilityOff();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ConvexHull\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(originalActor);\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ConvexHull/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConvexHull)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConvexHull: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConvexHull MACOSX_BUNDLE ConvexHull.cxx )\n  target_link_libraries(ConvexHull PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConvexHull\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ConvexHull/#download-and-build-convexhull","title":"Download and Build ConvexHull","text":"

        Click here to download ConvexHull and its CMakeLists.txt file. Once the tarball ConvexHull.tar has been downloaded and extracted,

        cd ConvexHull/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConvexHull\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ConvexHullShrinkWrap/","title":"ConvexHullShrinkWrap","text":"

        vtk-examples/Cxx/PolyData/ConvexHullShrinkWrap

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ConvexHullShrinkWrap/#description","title":"Description","text":"

        This example creates a point cloud, and a sphere larger than the point cloud which fully contains the cloud. It then \"shrink wraps\" the sphere onto the points. This produces an approximation of a convex hull.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ConvexHullShrinkWrap/#code","title":"Code","text":"

        ConvexHullShrinkWrap.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmoothPolyDataFilter.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(10);\n  sphereSource->SetPhiResolution(50);\n  sphereSource->SetThetaResolution(50);\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(60);\n  pointSource->SetRadius(2);\n\n  vtkNew<vtkSmoothPolyDataFilter> smoothFilter;\n  smoothFilter->SetInputConnection(0, sphereSource->GetOutputPort());\n  smoothFilter->SetInputConnection(1, pointSource->GetOutputPort());\n\n  vtkNew<vtkSphereSource> glyphSource;\n  glyphSource->SetRadius(.04);\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetInputConnection(pointSource->GetOutputPort());\n  glyph3D->SetSourceConnection(glyphSource->GetOutputPort());\n  glyph3D->ScalingOff();\n\n  vtkNew<vtkDataSetMapper> glyph3DMapper;\n  glyph3DMapper->SetInputConnection(glyph3D->GetOutputPort());\n  glyph3DMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyph3DActor;\n  glyph3DActor->SetMapper(glyph3DMapper);\n  glyph3DActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(smoothFilter->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create an actor for the surface.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetEdgeColor(\n      namedColors->GetColor3d(\"IvoryBlack\").GetData());\n  actor->GetProperty()->SetOpacity(1.0);\n  actor->GetProperty()->EdgeVisibilityOff();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ConvexHullShrinkWrap\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(glyph3DActor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ConvexHullShrinkWrap/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConvexHullShrinkWrap)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConvexHullShrinkWrap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConvexHullShrinkWrap MACOSX_BUNDLE ConvexHullShrinkWrap.cxx )\n  target_link_libraries(ConvexHullShrinkWrap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConvexHullShrinkWrap\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ConvexHullShrinkWrap/#download-and-build-convexhullshrinkwrap","title":"Download and Build ConvexHullShrinkWrap","text":"

        Click here to download ConvexHullShrinkWrap and its CMakeLists.txt file. Once the tarball ConvexHullShrinkWrap.tar has been downloaded and extracted,

        cd ConvexHullShrinkWrap/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConvexHullShrinkWrap\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CopyAllArrays/","title":"CopyAllArrays","text":"

        vtk-examples/Cxx/PolyData/CopyAllArrays

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CopyAllArrays/#code","title":"Code","text":"

        CopyAllArrays.cxx

        #include <vtkDoubleArray.h>\n#include <vtkFloatArray.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid ManualMethod(vtkPolyData* input);\nvoid AutomaticMethod(vtkPolyData* input);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkPolyData* polydata = sphereSource->GetOutput();\n\n  vtkNew<vtkDoubleArray> doubles;\n  doubles->SetName(\"Doubles\");\n  doubles->SetNumberOfTuples(polydata->GetNumberOfPoints());\n\n  polydata->GetPointData()->AddArray(doubles);\n\n  vtkNew<vtkIntArray> ints;\n  ints->SetName(\"Ints\");\n  ints->SetNumberOfTuples(polydata->GetNumberOfPoints());\n\n  polydata->GetPointData()->AddArray(ints);\n\n  ManualMethod(polydata);\n  AutomaticMethod(polydata);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid ManualMethod(vtkPolyData* input)\n{\n  unsigned int numberOfArrays = input->GetPointData()->GetNumberOfArrays();\n  std::cout << \"There are \" << numberOfArrays << \" arrays.\" << std::endl;\n\n  vtkNew<vtkPolyData> newPolyData;\n\n  for (unsigned int i = 0; i < numberOfArrays; i++)\n  {\n    std::cout << \"array \" << i << \":\" << std::endl;\n    std::cout << \"name: \" << input->GetPointData()->GetArrayName(i)\n              << std::endl;\n    std::cout << \"type: \" << input->GetPointData()->GetArray(i)->GetDataType()\n              << std::endl;\n    std::cout << std::endl;\n\n    newPolyData->GetPointData()->AddArray(input->GetPointData()->GetArray(i));\n  }\n\n  std::cout << \"new polydata: \" << std::endl;\n\n  for (unsigned int i = 0; i < numberOfArrays; i++)\n  {\n    std::cout << \"array \" << i << \":\" << std::endl;\n    std::cout << \"name: \" << newPolyData->GetPointData()->GetArrayName(i)\n              << std::endl;\n    std::cout << \"type: \"\n              << newPolyData->GetPointData()->GetArray(i)->GetDataType()\n              << std::endl;\n    std::cout << std::endl;\n  }\n}\n\nvoid AutomaticMethod(vtkPolyData* input)\n{\n  unsigned int numberOfArrays = input->GetPointData()->GetNumberOfArrays();\n  std::cout << \"There are \" << numberOfArrays << \" arrays.\" << std::endl;\n\n  vtkNew<vtkPolyData> newPolyData;\n\n  newPolyData->GetPointData()->PassData(input->GetPointData());\n\n  for (unsigned int i = 0; i < numberOfArrays; i++)\n  {\n    std::cout << \"array \" << i << \":\" << std::endl;\n    std::cout << \"name: \" << input->GetPointData()->GetArrayName(i)\n              << std::endl;\n    std::cout << \"type: \" << input->GetPointData()->GetArray(i)->GetDataType()\n              << std::endl;\n    std::cout << std::endl;\n  }\n\n  std::cout << \"new polydata: \" << std::endl;\n\n  for (unsigned int i = 0; i < numberOfArrays; i++)\n  {\n    std::cout << \"array \" << i << \":\" << std::endl;\n    std::cout << \"name: \" << newPolyData->GetPointData()->GetArrayName(i)\n              << std::endl;\n    std::cout << \"type: \"\n              << newPolyData->GetPointData()->GetArray(i)->GetDataType()\n              << std::endl;\n    std::cout << std::endl;\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/CopyAllArrays/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CopyAllArrays)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CopyAllArrays: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CopyAllArrays MACOSX_BUNDLE CopyAllArrays.cxx )\n  target_link_libraries(CopyAllArrays PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CopyAllArrays\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CopyAllArrays/#download-and-build-copyallarrays","title":"Download and Build CopyAllArrays","text":"

        Click here to download CopyAllArrays and its CMakeLists.txt file. Once the tarball CopyAllArrays.tar has been downloaded and extracted,

        cd CopyAllArrays/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CopyAllArrays\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/Curvatures/","title":"Curvatures","text":"

        vtk-examples/Cxx/PolyData/Curvatures

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/Curvatures/#code","title":"Code","text":"

        Curvatures.cxx

        #include <vtkActor.h>\n#include <vtkCameraOrientationWidget.h>\n#include <vtkColorSeries.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkCurvatures.h>\n#include <vtkFeatureEdges.h>\n#include <vtkIdFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkVersion.h>\n#include <vtkXMLPolyDataReader.h>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\n#include <array>\n#include <numeric>\n#include <set>\n\nnamespace {\n\n//! Adjust curvatures along the edges of the surface.\n/*!\n * This function adjusts curvatures along the edges of the surface by replacing\n *  the value with the average value of the curvatures of points in the\n *  neighborhood.\n *\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param epsilon: Curvature values less than this will be set to zero.\n * @return\n */\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon = 1.0e-08);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse command line arguments\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtp) e.g. cowHead.vtp m 16\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Defaults\n  auto scheme = 16;\n  std::string curvature{\"Mean_Curvature\"};\n  if (argc > 2)\n  {\n    std::string tmp = argv[2];\n    if (tmp[0] == 'g' || tmp[0] == 'G')\n    {\n      curvature = \"Gauss_Curvature\";\n    }\n    else\n    {\n      if (tmp[0] == 'm' || tmp[0] == 'm')\n      {\n        curvature = \"Mean_Curvature\";\n      }\n      else\n      {\n        std::cerr << \"Curvature must be either gaussian or mean.\" << std::endl;\n        return EXIT_FAILURE;\n      }\n    }\n  }\n\n  if (argc > 3)\n  {\n    scheme = atoi(argv[3]);\n  }\n\n  // Create a polydata.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  auto source = reader->GetOutput();\n\n  vtkNew<vtkCurvatures> cc;\n  cc->SetInputData(source);\n  if (curvature == \"Gauss_Curvature\")\n  {\n    cc->SetCurvatureTypeToGaussian();\n    cc->Update();\n  }\n  else\n  {\n    if (curvature == \"Mean_Curvature\")\n    {\n      cc->SetCurvatureTypeToMean();\n      cc->Update();\n    }\n    else\n    {\n      std::cerr << \"Unknown curvature\" << std::endl;\n      return EXIT_FAILURE;\n    }\n  }\n  AdjustEdgeCurvatures(cc->GetOutput(), curvature);\n  source->GetPointData()->AddArray(\n      cc->GetOutput()->GetPointData()->GetAbstractArray(curvature.c_str()));\n\n  auto scalarRange =\n      source->GetPointData()->GetScalars(curvature.c_str())->GetRange();\n\n  auto curvatureTitle = curvature;\n  std::replace(curvatureTitle.begin(), curvatureTitle.end(), '_', '\\n');\n\n  // Build a lookup table.\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(scheme);\n  std::cout << \"Using color scheme #: \" << colorSeries->GetColorScheme() << \", \"\n            << colorSeries->GetColorSchemeName() << std::endl;\n\n  vtkNew<vtkColorTransferFunction> lut;\n  lut->SetColorSpaceToHSV();\n\n  // Use a color series to create a transfer function.\n  auto numColors = colorSeries->GetNumberOfColors();\n  for (int i = 0; i < numColors; i++)\n  {\n    vtkColor3ub color = colorSeries->GetColor(i);\n    double dColor[3];\n    dColor[0] = static_cast<double>(color[0]) / 255.0;\n    dColor[1] = static_cast<double>(color[1]) / 255.0;\n    dColor[2] = static_cast<double>(color[2]) / 255.0;\n    double t = scalarRange[0] +\n        (scalarRange[1] - scalarRange[0]) /\n            (static_cast<double>(numColors) - 1) * i;\n    lut->AddRGBPoint(t, dColor[0], dColor[1], dColor[2]);\n  }\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(source);\n  mapper->SetScalarModeToUsePointFieldData();\n  mapper->SelectColorArray(curvature.c_str());\n  mapper->SetScalarRange(scalarRange);\n  mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  auto windowWidth = 800;\n  auto windowHeight = 800;\n\n  // Create a scalar bar.\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(mapper->GetLookupTable());\n  scalarBar->SetTitle(curvatureTitle.c_str());\n  scalarBar->UnconstrainedFontSizeOn();\n  scalarBar->SetNumberOfLabels(5);\n  scalarBar->SetMaximumWidthInPixels(windowWidth / 8);\n  scalarBar->SetMaximumHeightInPixels(windowHeight / 3);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(windowWidth, windowHeight);\n  renWin->SetWindowName(\"Curvatures\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n  // Important: The interactor must be set prior to enabling the widget.\n  iRen->SetRenderWindow(renWin);\n\n#ifdef HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(renderer);\n  // Enable the widget.\n  camOrientManipulator->On();\n#endif\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor2D(scalarBar);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact.\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon)\n{\n  auto PointNeighbourhood =\n      [&source](vtkIdType const& pId) -> std::set<vtkIdType> {\n    // Extract the topological neighbors for point pId. In two steps:\n    //  1) source->GetPointCells(pId, cellIds)\n    //  2) source->GetCellPoints(cellId, cellPointIds) for all cellId in cellIds\n    vtkNew<vtkIdList> cellIds;\n    source->GetPointCells(pId, cellIds);\n    std::set<vtkIdType> neighbours;\n    for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); ++i)\n    {\n      auto cellId = cellIds->GetId(i);\n      vtkNew<vtkIdList> cellPointIds;\n      source->GetCellPoints(cellId, cellPointIds);\n      for (vtkIdType j = 0; j < cellPointIds->GetNumberOfIds(); ++j)\n      {\n        neighbours.insert(cellPointIds->GetId(j));\n      }\n    }\n    return neighbours;\n  };\n\n  auto ComputeDistance = [&source](vtkIdType const& ptIdA,\n                                   vtkIdType const& ptIdB) {\n    std::array<double, 3> ptA{0.0, 0.0, 0.0};\n    std::array<double, 3> ptB{0.0, 0.0, 0.0};\n    std::array<double, 3> ptC{0.0, 0.0, 0.0};\n    source->GetPoint(ptIdA, ptA.data());\n    source->GetPoint(ptIdB, ptB.data());\n    std::transform(std::begin(ptA), std::end(ptA), std::begin(ptB),\n                   std::begin(ptC), std::minus<double>());\n    // Calculate the norm.\n    auto result = std::sqrt(std::inner_product(std::begin(ptC), std::end(ptC),\n                                               std::begin(ptC), 0.0));\n    return result;\n  };\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n\n  // Get the boundary point IDs.\n  std::string name = \"Ids\";\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputData(source);\n  idFilter->SetPointIds(true);\n  idFilter->SetCellIds(false);\n  idFilter->SetPointIdsArrayName(name.c_str());\n  idFilter->SetCellIdsArrayName(name.c_str());\n  idFilter->Update();\n\n  vtkNew<vtkFeatureEdges> edges;\n\n  edges->SetInputConnection(idFilter->GetOutputPort());\n  edges->BoundaryEdgesOn();\n  edges->ManifoldEdgesOff();\n  edges->NonManifoldEdgesOff();\n  edges->FeatureEdgesOff();\n  edges->Update();\n\n  auto edgeAarray =\n      edges->GetOutput()->GetPointData()->GetAbstractArray(name.c_str());\n  std::vector<vtkIdType> boundaryIds;\n  for (vtkIdType i = 0; i < edges->GetOutput()->GetNumberOfPoints(); ++i)\n  {\n    boundaryIds.push_back(edgeAarray->GetVariantValue(i).ToInt());\n  }\n  // Remove duplicate Ids.\n  std::set<vtkIdType> pIdsSet(boundaryIds.begin(), boundaryIds.end());\n  for (auto const pId : boundaryIds)\n  {\n    auto pIdsNeighbors = PointNeighbourhood(pId);\n    std::set<vtkIdType> pIdsNeighborsInterior;\n    std::set_difference(\n        pIdsNeighbors.begin(), pIdsNeighbors.end(), pIdsSet.begin(),\n        pIdsSet.end(),\n        std::inserter(pIdsNeighborsInterior, pIdsNeighborsInterior.begin()));\n    // Compute distances and extract curvature values.\n    std::vector<double> curvs;\n    std::vector<double> dists;\n    for (auto const pIdN : pIdsNeighborsInterior)\n    {\n      curvs.push_back(curvatures[pIdN]);\n      dists.push_back(ComputeDistance(pIdN, pId));\n    }\n    std::vector<vtkIdType> nonZeroDistIds;\n    for (size_t i = 0; i < dists.size(); ++i)\n    {\n      if (dists[i] > 0)\n      {\n        nonZeroDistIds.push_back(i);\n      }\n    }\n    std::vector<double> curvsNonZero;\n    std::vector<double> distsNonZero;\n    for (auto const i : nonZeroDistIds)\n    {\n      curvsNonZero.push_back(curvs[i]);\n      distsNonZero.push_back(dists[i]);\n    }\n    // Iterate over the edge points and compute the curvature as the weighted\n    // average of the neighbours.\n    auto countInvalid = 0;\n    auto newCurv = 0.0;\n    if (curvsNonZero.size() > 0)\n    {\n      std::vector<double> weights;\n      double sum = 0.0;\n      for (auto const d : distsNonZero)\n      {\n        sum += 1.0 / d;\n        weights.push_back(1.0 / d);\n      }\n      for (size_t i = 0; i < weights.size(); ++i)\n      {\n        weights[i] = weights[i] / sum;\n      }\n      newCurv = std::inner_product(curvsNonZero.begin(), curvsNonZero.end(),\n                                   weights.begin(), 0.0);\n    }\n    else\n    {\n      // Corner case.\n      // countInvalid += 1;\n      // Assuming the curvature of the point is planar.\n      newCurv = 0.0;\n    }\n    // Set the new curvature value.\n    curvatures[pId] = newCurv;\n  }\n\n  // Set small values to zero.\n  if (epsilon != 0.0)\n  {\n    auto eps = std::abs(epsilon);\n    for (size_t i = 0; i < curvatures.size(); ++i)\n    {\n      if (std::abs(curvatures[i]) < eps)\n      {\n        curvatures[i] = 0.0;\n      }\n    }\n  }\n\n  if (static_cast<size_t>(source->GetNumberOfPoints()) != curvatures.size())\n  {\n    std::string s = curvatureName;\n    s += \":\\nCannot add the adjusted curvatures to the source.\\n\";\n    s += \" The number of points in source does not equal the\\n\";\n    s += \" number of point ids in the adjusted curvature array.\";\n    std::cerr << s << std::endl;\n    return;\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\n} // namespace\n
        "},{"location":"Cxx/PolyData/Curvatures/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Curvatures)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Curvatures: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Curvatures MACOSX_BUNDLE Curvatures.cxx )\n  target_link_libraries(Curvatures PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Curvatures\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/Curvatures/#download-and-build-curvatures","title":"Download and Build Curvatures","text":"

        Click here to download Curvatures and its CMakeLists.txt file. Once the tarball Curvatures.tar has been downloaded and extracted,

        cd Curvatures/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Curvatures\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CurvaturesAdjustEdges/","title":"CurvaturesAdjustEdges","text":"

        vtk-examples/Cxx/PolyData/CurvaturesAdjustEdges

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/CurvaturesAdjustEdges/#description","title":"Description","text":"

        This example demonstrates how to calculate Gaussian and Mean curvatures for a vtkPolyData source. Since edges can produce large discrepancies to curvatures, edge adjustment can be applied. If we know the geometry of the surface we can also modify the curvatures.

        Functions are provided to achieve these aims.

        A histogram of the frequencies is also output to the console. This is useful if you want to get an idea of the distribution of the scalars in each band.

        This example was inspired by these discussions:

        • vtkCurvatures yields unreasonably large values along borders
        • How to extract the ids of the boundary points of a surface?

        Thanks to everyone involved in these discussions.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CurvaturesAdjustEdges/#code","title":"Code","text":"

        CurvaturesAdjustEdges.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkCubeSource.h>\n#include <vtkCurvatures.h>\n#include <vtkDelaunay2D.h>\n#include <vtkDoubleArray.h>\n#include <vtkFeatureEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkIdFilter.h>\n#include <vtkIdList.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricBour.h>\n#include <vtkParametricEnneper.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTexturedSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\n#include <algorithm>\n#include <array>\n#include <cctype>\n#include <cmath>\n#include <cstdlib>\n#include <functional>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <map>\n#include <numeric>\n#include <set>\n#include <sstream>\n\nnamespace {\n\n//! Adjust curvatures along the edges of the surface.\n/*!\n * This function adjusts curvatures along the edges of the surface by replacing\n *  the value with the average value of the curvatures of points in the\n *  neighborhood.\n *\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param epsilon: Curvature values less than this will be set to zero.\n * @return\n */\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon = 1.0e-08);\n\n//! Constrain curvatures to the range [lower_bound ... upper_bound].\n/*!\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param lowerBound: The lower bound.\n * @param upperBound: The upper bound.\n * @return\n */\nvoid ConstrainCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                         double const& lowerBound = 0.0,\n                         double const& upperBound = 0.0);\n\n// Some sample surfaces to try.\nvtkSmartPointer<vtkPolyData> GetBour();\nvtkSmartPointer<vtkPolyData> GetCube();\nvtkSmartPointer<vtkPolyData> GetEnneper();\nvtkSmartPointer<vtkPolyData> GetHills();\nvtkSmartPointer<vtkPolyData> GetMobius();\nvtkSmartPointer<vtkPolyData> GetRandomHills();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetTorus();\n\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& soource);\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLut();\nvtkSmartPointer<vtkLookupTable> GetDivergingLut1();\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision = 2,\n                                            bool const& nearestInteger = false);\n//! Count the number of scalars in each band.\n/*\n * The scalars used are the active scalars in the polydata.\n *\n * @param bands - the bands.\n * @param src - the vtkPolyData source.\n * @return The frequencies of the scalars in each band.\n */\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src);\n//!\n/*\n * The bands and frequencies are adjusted so that the first and last\n *  frequencies in the range are non-zero.\n * @param bands: The bands.\n * @param freq: The frequencies.\n */\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq);\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision = 2);\n\n} // namespace\n\nint main(int, char*[])\n{\n\n  std::string desiredSurface = \"RandomHills\";\n  // desiredSurface = \"Bour\";\n  // desiredSurface = \"Cube\";\n  // desiredSurface = \"Hills\";\n  // desiredSurface = \"Enneper\";\n  // desiredSurface = \"Mobius\";\n  // desiredSurface = \"RandomHills\";\n  // desiredSurface = \"Sphere\";\n  // desiredSurface = \"Torus\";\n\n  auto source = GetSource(desiredSurface);\n\n  vtkNew<vtkCurvatures> gc;\n  gc->SetInputData(source);\n  gc->SetCurvatureTypeToGaussian();\n  gc->Update();\n  std::vector<std::string> adjSurfaces{\"Bour\", \"Enneper\", \"Hills\",\n                                       \"RandomHills\", \"Torus\"};\n  if (std::find(adjSurfaces.begin(), adjSurfaces.end(), desiredSurface) !=\n      adjSurfaces.end())\n  {\n    AdjustEdgeCurvatures(gc->GetOutput(), \"Gauss_Curvature\");\n  }\n  if (desiredSurface == \"Bour\")\n  {\n    // Gaussian curvature is -1/(r(r+1)^4))\n    ConstrainCurvatures(gc->GetOutput(), \"Gauss_Curvature\", -0.0625, -0.0625);\n  }\n  if (desiredSurface == \"Enneper\")\n  {\n    // Gaussian curvature is -4/(1 + r^2)^4\n    ConstrainCurvatures(gc->GetOutput(), \"Gauss_Curvature\", -0.25, -0.25);\n  }\n  if (desiredSurface == \"Cube\")\n  {\n    ConstrainCurvatures(gc->GetOutput(), \"Gauss_Curvature\", 0.0, 0.0);\n  }\n  if (desiredSurface == \"Mobius\")\n  {\n    ConstrainCurvatures(gc->GetOutput(), \"Gauss_Curvature\", 0.0, 0.0);\n  }\n  if (desiredSurface == \"Sphere\")\n  {\n    // Gaussian curvature is 1/r^2\n    ConstrainCurvatures(gc->GetOutput(), \"Gauss_Curvature\", 4.0, 4.0);\n  }\n  source->GetPointData()->AddArray(\n      gc->GetOutput()->GetPointData()->GetAbstractArray(\"Gauss_Curvature\"));\n\n  vtkNew<vtkCurvatures> mc;\n  mc->SetInputData(source);\n  mc->SetCurvatureTypeToMean();\n  mc->Update();\n  if (std::find(adjSurfaces.begin(), adjSurfaces.end(), desiredSurface) !=\n      adjSurfaces.end())\n  {\n    AdjustEdgeCurvatures(mc->GetOutput(), \"Mean_Curvature\");\n  }\n  if (desiredSurface == \"Bour\")\n  {\n    // Mean curvature is 0\n    ConstrainCurvatures(mc->GetOutput(), \"Mean_Curvature\", 0.0, 0.0);\n  }\n  if (desiredSurface == \"Enneper\")\n  {\n    // Mean curvature is 0\n    ConstrainCurvatures(mc->GetOutput(), \"Mean_Curvature\", 0.0, 0.0);\n  }\n  if (desiredSurface == \"Sphere\")\n  {\n    // Mean curvature is 1/r\n    ConstrainCurvatures(mc->GetOutput(), \"Mean_Curvature\", 2.0, 2.0);\n  }\n  source->GetPointData()->AddArray(\n      mc->GetOutput()->GetPointData()->GetAbstractArray(\"Mean_Curvature\"));\n\n  // Uncomment the following lines if you want to write out the polydata.\n  // vtkNew<vtkXMLPolyDataWriter> writer;\n  // writer->SetFileName(\"Source.vtp\");\n  // writer->SetInputData(source);\n  // writer->SetDataModeToAscii();\n  // writer->Write();\n\n  // Let's visualise what we have done.\n\n  vtkNew<vtkNamedColors> colors;\n\n  colors->SetColor(\"ParaViewBkg\",\n                   std::array<unsigned char, 4>{82, 87, 110, 255}.data());\n\n  auto windowWidth = 1024;\n  auto windowHeight = 512;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(windowWidth, windowHeight);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  // Create a common text property.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(24);\n  textProperty->SetJustificationToCentered();\n\n  auto lut = GetDivergingLut();\n  // auto lut = GetDivergingLut1();\n\n  // Define viewport ranges\n  std::array<double, 2> xmins{0, 0.5};\n  std::array<double, 2> xmaxs{0.5, 1};\n  std::array<double, 2> ymins{0, 0};\n  std::array<double, 2> ymaxs{1.0, 1.0};\n\n  vtkCamera* camera = nullptr;\n\n#ifdef HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n#endif\n\n  std::array<std::string, 2> curvatureTypes{\"Gauss_Curvature\",\n                                            \"Mean_Curvature\"};\n  for (size_t idx = 0; idx < curvatureTypes.size(); ++idx)\n  {\n    auto curvatureTitle = curvatureTypes[idx];\n    std::replace(curvatureTitle.begin(), curvatureTitle.end(), '_', '\\n');\n\n    source->GetPointData()->SetActiveScalars(curvatureTypes[idx].c_str());\n    auto scalarRange = source->GetPointData()\n                           ->GetScalars(curvatureTypes[idx].c_str())\n                           ->GetRange();\n\n    auto bands = GetBands(scalarRange, 10);\n    auto freq = GetFrequencies(bands, source);\n    AdjustFrequencyRanges(bands, freq);\n    std::cout << curvatureTypes[idx] << std::endl;\n    PrintBandsFrequencies(bands, freq);\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(source);\n    mapper->SetScalarModeToUsePointFieldData();\n    mapper->SelectColorArray(curvatureTypes[idx].c_str());\n    mapper->SetScalarRange(scalarRange);\n    mapper->SetLookupTable(lut);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n\n    // Create a scalar bar\n    vtkNew<vtkScalarBarActor> scalarBar;\n    scalarBar->SetLookupTable(mapper->GetLookupTable());\n    scalarBar->SetTitle(curvatureTitle.c_str());\n    scalarBar->UnconstrainedFontSizeOn();\n    scalarBar->SetNumberOfLabels(\n        std::min<int>(5, static_cast<int>(freq.size())));\n    scalarBar->SetMaximumWidthInPixels(windowWidth / 8);\n    scalarBar->SetMaximumHeightInPixels(windowHeight / 3);\n    scalarBar->SetBarRatio(scalarBar->GetBarRatio() * 0.5);\n    scalarBar->SetPosition(0.85, 0.1);\n\n    vtkNew<vtkTextMapper> textMapper;\n    textMapper->SetInput(curvatureTitle.c_str());\n    textMapper->SetTextProperty(textProperty);\n\n    vtkNew<vtkActor2D> textActor;\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(250, 16);\n\n    vtkNew<vtkRenderer> renderer;\n    renderer->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n\n    renderer->AddActor(actor);\n    renderer->AddActor(textActor);\n    renderer->AddActor(scalarBar);\n\n    renWin->AddRenderer(renderer);\n\n    if (idx == 0)\n    {\n#ifdef HAS_COW\n      camOrientManipulator->SetParentRenderer(renderer);\n#endif\n      camera = renderer->GetActiveCamera();\n      camera->Elevation(60);\n    }\n    else\n    {\n      renderer->SetActiveCamera(camera);\n    }\n    renderer->SetViewport(xmins[idx], ymins[idx], xmaxs[idx], ymaxs[idx]);\n    renderer->ResetCamera();\n  }\n#ifdef HAS_COW\n  // Enable the widget.\n  camOrientManipulator->On();\n#endif\n\n  renWin->Render();\n  renWin->SetWindowName(\"CurvaturesAdjustEdges\");\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon)\n{\n  auto PointNeighbourhood =\n      [&source](vtkIdType const& pId) -> std::set<vtkIdType> {\n    // Extract the topological neighbors for point pId. In two steps:\n    //  1) source->GetPointCells(pId, cellIds)\n    //  2) source->GetCellPoints(cellId, cellPointIds) for all cellId in cellIds\n    vtkNew<vtkIdList> cellIds;\n    source->GetPointCells(pId, cellIds);\n    std::set<vtkIdType> neighbours;\n    for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); ++i)\n    {\n      auto cellId = cellIds->GetId(i);\n      vtkNew<vtkIdList> cellPointIds;\n      source->GetCellPoints(cellId, cellPointIds);\n      for (vtkIdType j = 0; j < cellPointIds->GetNumberOfIds(); ++j)\n      {\n        neighbours.insert(cellPointIds->GetId(j));\n      }\n    }\n    return neighbours;\n  };\n\n  auto ComputeDistance = [&source](vtkIdType const& ptIdA,\n                                   vtkIdType const& ptIdB) {\n    std::array<double, 3> ptA{0.0, 0.0, 0.0};\n    std::array<double, 3> ptB{0.0, 0.0, 0.0};\n    std::array<double, 3> ptC{0.0, 0.0, 0.0};\n    source->GetPoint(ptIdA, ptA.data());\n    source->GetPoint(ptIdB, ptB.data());\n    std::transform(std::begin(ptA), std::end(ptA), std::begin(ptB),\n                   std::begin(ptC), std::minus<double>());\n    // Calculate the norm.\n    auto result = std::sqrt(std::inner_product(std::begin(ptC), std::end(ptC),\n                                               std::begin(ptC), 0.0));\n    return result;\n  };\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n\n  // Get the boundary point IDs.\n  std::string name = \"Ids\";\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputData(source);\n  idFilter->SetPointIds(true);\n  idFilter->SetCellIds(false);\n  idFilter->SetPointIdsArrayName(name.c_str());\n  idFilter->SetCellIdsArrayName(name.c_str());\n  idFilter->Update();\n\n  vtkNew<vtkFeatureEdges> edges;\n\n  edges->SetInputConnection(idFilter->GetOutputPort());\n  edges->BoundaryEdgesOn();\n  edges->ManifoldEdgesOff();\n  edges->NonManifoldEdgesOff();\n  edges->FeatureEdgesOff();\n  edges->Update();\n\n  auto edgeAarray =\n      edges->GetOutput()->GetPointData()->GetAbstractArray(name.c_str());\n  std::vector<vtkIdType> boundaryIds;\n  for (vtkIdType i = 0; i < edges->GetOutput()->GetNumberOfPoints(); ++i)\n  {\n    boundaryIds.push_back(edgeAarray->GetVariantValue(i).ToInt());\n  }\n  // Remove duplicate Ids.\n  std::set<vtkIdType> pIdsSet(boundaryIds.begin(), boundaryIds.end());\n  for (auto const pId : boundaryIds)\n  {\n    auto pIdsNeighbors = PointNeighbourhood(pId);\n    std::set<vtkIdType> pIdsNeighborsInterior;\n    std::set_difference(\n        pIdsNeighbors.begin(), pIdsNeighbors.end(), pIdsSet.begin(),\n        pIdsSet.end(),\n        std::inserter(pIdsNeighborsInterior, pIdsNeighborsInterior.begin()));\n    // Compute distances and extract curvature values.\n    std::vector<double> curvs;\n    std::vector<double> dists;\n    for (auto const pIdN : pIdsNeighborsInterior)\n    {\n      curvs.push_back(curvatures[pIdN]);\n      dists.push_back(ComputeDistance(pIdN, pId));\n    }\n    std::vector<vtkIdType> nonZeroDistIds;\n    for (size_t i = 0; i < dists.size(); ++i)\n    {\n      if (dists[i] > 0)\n      {\n        nonZeroDistIds.push_back(i);\n      }\n    }\n    std::vector<double> curvsNonZero;\n    std::vector<double> distsNonZero;\n    for (auto const i : nonZeroDistIds)\n    {\n      curvsNonZero.push_back(curvs[i]);\n      distsNonZero.push_back(dists[i]);\n    }\n    // Iterate over the edge points and compute the curvature as the weighted\n    // average of the neighbours.\n    auto countInvalid = 0;\n    auto newCurv = 0.0;\n    if (curvsNonZero.size() > 0)\n    {\n      std::vector<double> weights;\n      double sum = 0.0;\n      for (auto const d : distsNonZero)\n      {\n        sum += 1.0 / d;\n        weights.push_back(1.0 / d);\n      }\n      for (size_t i = 0; i < weights.size(); ++i)\n      {\n        weights[i] = weights[i] / sum;\n      }\n      newCurv = std::inner_product(curvsNonZero.begin(), curvsNonZero.end(),\n                                   weights.begin(), 0.0);\n    }\n    else\n    {\n      // Corner case.\n      // countInvalid += 1;\n      // Assuming the curvature of the point is planar.\n      newCurv = 0.0;\n    }\n    // Set the new curvature value.\n    curvatures[pId] = newCurv;\n  }\n\n  // Set small values to zero.\n  if (epsilon != 0.0)\n  {\n    auto eps = std::abs(epsilon);\n    for (size_t i = 0; i < curvatures.size(); ++i)\n    {\n      if (std::abs(curvatures[i]) < eps)\n      {\n        curvatures[i] = 0.0;\n      }\n    }\n  }\n\n  if (static_cast<size_t>(source->GetNumberOfPoints()) != curvatures.size())\n  {\n    std::string s = curvatureName;\n    s += \":\\nCannot add the adjusted curvatures to the source.\\n\";\n    s += \" The number of points in source does not equal the\\n\";\n    s += \" number of point ids in the adjusted curvature array.\";\n    std::cerr << s << std::endl;\n    return;\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\nvoid ConstrainCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                         double const& lowerBound, double const& upperBound)\n{\n  std::array<double, 2> bounds{0.0, 0.0};\n  if (lowerBound < upperBound)\n  {\n    bounds[0] = lowerBound;\n    bounds[1] = upperBound;\n  }\n  else\n  {\n    bounds[0] = upperBound;\n    bounds[1] = lowerBound;\n  }\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n  //  Set upper and lower bounds.\n  for (size_t i = 0; i < curvatures.size(); ++i)\n  {\n    if (curvatures[i] < bounds[0])\n    {\n      curvatures[i] = bounds[0];\n    }\n    else\n    {\n      if (curvatures[i] > bounds[1])\n      {\n        curvatures[i] = bounds[1];\n      }\n    }\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  source->GetPointData()->RemoveArray(curvatureName.c_str());\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\n// clang-format off\n/**\n * See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n *\n *                   start point         midPoint            end point\n * cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n * purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n * green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n * blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n * green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n *\n */\n// clang-format on\nvtkSmartPointer<vtkLookupTable> GetDivergingLut()\n{\n\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, 0.230, 0.299, 0.754);\n  ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n  ctf->AddRGBPoint(1.0, 0.706, 0.016, 0.150);\n\n  auto tableSize = 256;\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(static_cast<double>(i) / lut->GetNumberOfColors(),\n                  rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(static_cast<vtkIdType>(i), rgba.data());\n  }\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLut1()\n{\n  vtkNew<vtkNamedColors> colors;\n  // Colour transfer function.\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, colors->GetColor3d(\"MidnightBlue\").GetRed(),\n                   colors->GetColor3d(\"MidnightBlue\").GetGreen(),\n                   colors->GetColor3d(\"MidnightBlue\").GetBlue());\n  ctf->AddRGBPoint(0.5, colors->GetColor3d(\"Gainsboro\").GetRed(),\n                   colors->GetColor3d(\"Gainsboro\").GetGreen(),\n                   colors->GetColor3d(\"Gainsboro\").GetBlue());\n  ctf->AddRGBPoint(1.0, colors->GetColor3d(\"DarkOrange\").GetRed(),\n                   colors->GetColor3d(\"DarkOrange\").GetGreen(),\n                   colors->GetColor3d(\"DarkOrange\").GetBlue());\n\n  // Lookup table.\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(256);\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(double(i) / lut->GetNumberOfColors(), rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(i, rgba.data());\n  }\n\n  return lut;\n}\n\nvtkSmartPointer<vtkPolyData> GetBour()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricBour> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(3);\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(subdivide->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetEnneper()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricEnneper> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetHills()\n{\n  // Create four hills on a plane.\n  // This will have regions of negative, zero and positive Gsaussian\n  // curvatures.\n\n  auto xRes = 50;\n  auto yRes = 50;\n  auto xMin = -5.0;\n  auto xMax = 5.0;\n  auto dx = (xMax - xMin) / (xRes - 1.0);\n  auto yMin = -5.0;\n  auto yMax = 5.0;\n  auto dy = (yMax - yMin) / (xRes - 1.0);\n\n  // Make a grid.\n  vtkNew<vtkPoints> points;\n  for (auto i = 0; i < xRes; ++i)\n  {\n    auto x = xMin + i * dx;\n    for (auto j = 0; j < yRes; ++j)\n    {\n      auto y = yMin + j * dy;\n      points->InsertNextPoint(x, y, 0);\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> plane;\n  plane->SetPoints(points);\n\n  // Triangulate the grid.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(plane);\n  delaunay->Update();\n\n  auto polydata = delaunay->GetOutput();\n\n  vtkNew<vtkDoubleArray> elevation;\n  elevation->SetNumberOfTuples(points->GetNumberOfPoints());\n\n  //  We define the parameters for the hills here.\n  // [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n  std::vector<std::array<double, 5>> hd{{-2.5, -2.5, 2.5, 6.5, 3.5},\n                                        {2.5, 2.5, 2.5, 2.5, 2},\n                                        {5.0, -2.5, 1.5, 1.5, 2.5},\n                                        {-5.0, 5, 2.5, 3.0, 3}};\n  std::array<double, 2> xx{0.0, 0.0};\n  for (auto i = 0; i < points->GetNumberOfPoints(); ++i)\n  {\n    auto x = polydata->GetPoint(i);\n    for (size_t j = 0; j < hd.size(); ++j)\n    {\n      xx[0] = std::pow(x[0] - hd[j][0] / hd[j][2], 2.0);\n      xx[1] = std::pow(x[1] - hd[j][1] / hd[j][3], 2.0);\n      x[2] += hd[j][4] * std::exp(-(xx[0] + xx[1]) / 2.0);\n    }\n    polydata->GetPoints()->SetPoint(i, x);\n    elevation->SetValue(i, x[2]);\n  }\n\n  vtkNew<vtkFloatArray> textures;\n  textures->SetNumberOfComponents(2);\n  textures->SetNumberOfTuples(2 * polydata->GetNumberOfPoints());\n  textures->SetName(\"Textures\");\n\n  for (auto i = 0; i < xRes; ++i)\n  {\n    float tc[2];\n    tc[0] = i / (xRes - 1.0);\n    for (auto j = 0; j < yRes; ++j)\n    {\n      // tc[1] = 1.0 - j / (yRes - 1.0);\n      tc[1] = j / (yRes - 1.0);\n      textures->SetTuple(static_cast<vtkIdType>(i) * yRes + j, tc);\n    }\n  }\n\n  polydata->GetPointData()->SetScalars(elevation);\n  polydata->GetPointData()->GetScalars()->SetName(\"Elevation\");\n  polydata->GetPointData()->SetTCoords(textures);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(polydata);\n  normals->SetInputData(polydata);\n  normals->SetFeatureAngle(30);\n  normals->SplittingOff();\n\n  vtkNew<vtkTransform> tr1;\n  tr1->RotateX(-90);\n\n  vtkNew<vtkTransformPolyDataFilter> tf1;\n  tf1->SetInputConnection(normals->GetOutputPort());\n  tf1->SetTransform(tr1);\n  tf1->Update();\n\n  return tf1->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetMobius()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricMobius> surface;\n  surface->SetMinimumV(-0.25);\n  surface->SetMaximumV(0.25);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetRandomHills()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricRandomHills> surface;\n  surface->SetRandomSeed(1);\n  surface->SetNumberOfHills(30);\n  // If you want a plane\n  // surface->SetHillAmplitude(0);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(surface->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricTorus> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& source)\n{\n  std::string surface = source;\n  std::transform(surface.begin(), surface.end(), surface.begin(),\n                 [](unsigned char c) { return std::tolower(c); });\n  std::map<std::string, int> available_surfaces = {\n      {\"bour\", 0},   {\"cube\", 1},        {\"enneper\", 2}, {\"hills\", 3},\n      {\"mobius\", 4}, {\"randomhills\", 5}, {\"sphere\", 6},  {\"torus\", 7}};\n  if (available_surfaces.find(surface) == available_surfaces.end())\n  {\n    std::cout << \"The surface is not available.\" << std::endl;\n    std::cout << \"Using RandomHills instead.\" << std::endl;\n    surface = \"randomhills\";\n  }\n  switch (available_surfaces[surface])\n  {\n  case 0:\n    return GetBour();\n    break;\n  case 1:\n    return GetCube();\n    break;\n  case 2:\n    return GetEnneper();\n    break;\n  case 3:\n    return GetHills();\n    break;\n  case 4:\n    return GetMobius();\n    break;\n  case 5:\n    return GetRandomHills();\n    break;\n  case 6:\n    return GetSphere();\n    break;\n  case 7:\n    return GetTorus();\n    break;\n  }\n  return GetRandomHills();\n}\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision,\n                                            bool const& nearestInteger)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  auto RoundOff = [&prec](const double& x) {\n    auto pow_10 = std::pow(10.0, prec);\n    return std::round(x * pow_10) / pow_10;\n  };\n\n  std::map<int, std::vector<double>> bands;\n  if ((dR[1] < dR[0]) || (numberOfBands <= 0))\n  {\n    return bands;\n  }\n  double x[2];\n  for (int i = 0; i < 2; ++i)\n  {\n    x[i] = dR[i];\n  }\n  if (nearestInteger)\n  {\n    x[0] = std::floor(x[0]);\n    x[1] = std::ceil(x[1]);\n  }\n  double dx = (x[1] - x[0]) / static_cast<double>(numberOfBands);\n  std::vector<double> b;\n  b.push_back(x[0]);\n  b.push_back(x[0] + dx / 2.0);\n  b.push_back(x[0] + dx);\n  for (int i = 0; i < numberOfBands; ++i)\n  {\n    if (i == 0)\n    {\n      for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n      {\n        *p = RoundOff(*p);\n      }\n      b[0] = x[0];\n    }\n    bands[i] = b;\n    for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n    {\n      *p = RoundOff(*p + dx);\n    }\n  }\n  return bands;\n}\n\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src)\n{\n  std::map<int, int> freq;\n  for (auto i = 0; i < static_cast<int>(bands.size()); ++i)\n  {\n    freq[i] = 0;\n  }\n  vtkIdType tuples = src->GetPointData()->GetScalars()->GetNumberOfTuples();\n  for (int i = 0; i < tuples; ++i)\n  {\n    double* x = src->GetPointData()->GetScalars()->GetTuple(i);\n    for (auto j = 0; j < static_cast<int>(bands.size()); ++j)\n    {\n      if (*x <= bands[j][2])\n      {\n        freq[j] = freq[j] + 1;\n        break;\n      }\n    }\n  }\n  return freq;\n}\n\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq)\n{\n  // Get the indices of the first and last non-zero elements.\n  auto first = 0;\n  for (auto i = 0; i < static_cast<int>(freq.size()); ++i)\n  {\n    if (freq[i] != 0)\n    {\n      first = i;\n      break;\n    }\n  }\n  std::vector<int> keys;\n  for (std::map<int, int>::iterator it = freq.begin(); it != freq.end(); ++it)\n  {\n    keys.push_back(it->first);\n  }\n  std::reverse(keys.begin(), keys.end());\n  auto last = keys[0];\n  for (size_t i = 0; i < keys.size(); ++i)\n  {\n    if (freq[keys[i]] != 0)\n    {\n      last = keys[i];\n      break;\n    }\n  }\n  // Now adjust the ranges.\n  std::map<int, int>::iterator freqItr;\n  freqItr = freq.find(first);\n  freq.erase(freq.begin(), freqItr);\n  freqItr = ++freq.find(last);\n  freq.erase(freqItr, freq.end());\n  std::map<int, std::vector<double>>::iterator bandItr;\n  bandItr = bands.find(first);\n  bands.erase(bands.begin(), bandItr);\n  bandItr = ++bands.find(last);\n  bands.erase(bandItr, bands.end());\n  // Reindex freq and bands.\n  std::map<int, int> adjFreq;\n  int idx = 0;\n  for (auto p : freq)\n  {\n    adjFreq[idx] = p.second;\n    ++idx;\n  }\n  std::map<int, std::vector<double>> adjBands;\n  idx = 0;\n  for (auto const& p : bands)\n  {\n    adjBands[idx] = p.second;\n    ++idx;\n  }\n  bands = adjBands;\n  freq = adjFreq;\n}\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  if (bands.size() != freq.size())\n  {\n    std::cout << \"Bands and frequencies must be the same size.\" << std::endl;\n    return;\n  }\n  std::ostringstream os;\n  os << \"Bands & Frequencies:\\n\";\n  size_t idx = 0;\n  auto total = 0;\n  auto width = prec + 6;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    total += freq[p->first];\n    for (std::vector<double>::const_iterator q = p->second.begin();\n         q != p->second.end(); ++q)\n    {\n      if (q == p->second.begin())\n      {\n        os << std::setw(4) << idx << \" [\";\n      }\n      if (q == std::prev(p->second.end()))\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \"]: \" << std::setw(8) << freq[p->first] << \"\\n\";\n      }\n      else\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \", \";\n      }\n    }\n    ++idx;\n  }\n  width = 3 * width + 13;\n  os << std::left << std::setw(width) << \"Total\" << std::right << std::setw(8)\n     << total << std::endl;\n  std::cout << os.str() << endl;\n}\n\n} // namespace\n
        "},{"location":"Cxx/PolyData/CurvaturesAdjustEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CurvaturesAdjustEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CurvaturesAdjustEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CurvaturesAdjustEdges MACOSX_BUNDLE CurvaturesAdjustEdges.cxx )\n  target_link_libraries(CurvaturesAdjustEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CurvaturesAdjustEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CurvaturesAdjustEdges/#download-and-build-curvaturesadjustedges","title":"Download and Build CurvaturesAdjustEdges","text":"

        Click here to download CurvaturesAdjustEdges and its CMakeLists.txt file. Once the tarball CurvaturesAdjustEdges.tar has been downloaded and extracted,

        cd CurvaturesAdjustEdges/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CurvaturesAdjustEdges\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/CurvaturesDemo/","title":"CurvaturesDemo","text":"

        vtk-examples/Cxx/PolyData/CurvaturesDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/CurvaturesDemo/#description","title":"Description","text":"

        How to get the Gaussian and Mean curvatures of a surface.

        Two different surfaces are used in this demonstration with each surface coloured according to its Gaussian and Mean curvatures.

        • The first surface is a superquadric surface, this demonstrates the use of extra filters that are needed to get a nice smooth surface.

        • The second surface is a parametric surface, in this case the surface has already been triangulated so no extra processing is necessary.

        In order to get a nice coloured image, a vtkColorTransferFunction has been used to generate a set of colours for the vtkLookupTable tables. We have used a diverging colour space. Because of the symmetry of the ranges selected for the lookup tables, the white colouration represents a midpoint value whilst the blue represents values less than the midpoint value and orange represents colours greater than the midpoint value.

        In the case of the Random Hills Gaussian curvature surface, this colouration shows the nature of the surface quite nicely. The blue areas are saddle points (negative Gaussian curvature) and the orange areas have a positive Gaussian curvature.

        In the case of the mean curvature the blue colouration represents negative curvature perpendicular to one of the principal axes.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/CurvaturesDemo/#code","title":"Code","text":"

        CurvaturesDemo.cxx

        /*\nThe purpose of this is to demonstrate how to get the Gaussian and Mean\ncurvatures of a surface.\n\nTwo different surfaces are used in this demonstration with each\nsurface coloured according to its Gaussian and Mean curvatures.\n\nThe first surface is a superquadric surface, this demonstrates the use\nof extra filters that are needed to get a nice smooth surface.\n\nThe second surface is a parametric surface, in this case the surface\nhas already been triangulated so no extra processing is necessary.\n\nIn order to get a nice coloured image, a vtkColorTransferFunction has\nbeen used to generate a set of colours for the vtkLookUp tables. We\nhave used a diverging colour space.  Because of the symmetry of the\nranges selected for the lookup tables, the white colouration\nrepresents a midpoint value whilst the blue represents values less\nthan the midopoint value and orange represents colours greater than the\nmidpoint value.\n\nIn the case of the Random Hills Gaussian Curvature surface, this\ncolouration shows the nature of the surface quite nicely. The blue\nareas are saddle points (negative Gaussian curvature) and the orange\nareas have a positive Gaussian curvature.\nIn the case of the mean curvature the blue colouration is representing\nnegative curvature perpendicular to one of the principal axes.\n\nThis example also demonstrates the use of std::vector and the linking\nof the elements of the vector together to form a pipeline.\n*/\n\n#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCleanPolyData.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkCurvatures.h>\n#include <vtkFeatureEdges.h>\n#include <vtkIdFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n\n#include <algorithm>\n#include <array>\n#include <iterator>\n#include <map>\n#include <numeric>\n#include <set>\n#include <string>\n#include <vector>\n\nnamespace {\n//! Adjust curvatures along the edges of the surface.\n/*!\n * This function adjusts curvatures along the edges of the surface by replacing\n *  the value with the average value of the curvatures of points in the\n *  neighborhood.\n *\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param epsilon: Curvature values less than this will be set to zero.\n * @return\n */\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon = 1.0e-08);\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLut();\nvtkSmartPointer<vtkLookupTable> GetDivergingLut1();\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n  // We are going to handle two different sources.\n  // The first source is a superquadric source.\n  vtkNew<vtkSuperquadricSource> torus;\n  torus->SetCenter(0.0, 0.0, 0.0);\n  torus->SetScale(1.0, 1.0, 1.0);\n  torus->SetPhiResolution(64);\n  torus->SetThetaResolution(64);\n  torus->SetThetaRoundness(1);\n  torus->SetThickness(0.5);\n  torus->SetSize(0.5);\n  torus->SetToroidal(1);\n\n  // Rotate the torus towards the observer (around the x-axis).\n  vtkNew<vtkTransform> torusT;\n  torusT->RotateX(55);\n\n  vtkNew<vtkTransformFilter> torusTF;\n  torusTF->SetInputConnection(torus->GetOutputPort());\n  torusTF->SetTransform(torusT);\n\n  // The quadric is made of strips, so pass it through a triangle filter as\n  // the curvature filter only operates on polys.\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(torusTF->GetOutputPort());\n\n  // The quadric has nasty discontinuities from the way the edges are generated\n  // so let's pass it though a CleanPolyDataFilter and merge any points which\n  // are coincident, or very close.\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  // The next source will be a parametric function.\n  vtkNew<vtkParametricRandomHills> rh;\n  vtkNew<vtkParametricFunctionSource> rhFnSrc;\n  rhFnSrc->SetParametricFunction(rh);\n  rhFnSrc->Update();\n\n  std::map<int, vtkSmartPointer<vtkPolyData>> sources;\n  for (auto i = 0; i < 4; ++i)\n  {\n    std::string curvatureName;\n    if (i < 2)\n    {\n      vtkNew<vtkCurvatures> cc;\n      cc->SetInputConnection(cleaner->GetOutputPort());\n      if (i % 2 == 0)\n      {\n        cc->SetCurvatureTypeToGaussian();\n        curvatureName = \"Gauss_Curvature\";\n      }\n      else\n      {\n        cc->SetCurvatureTypeToMean();\n        curvatureName = \"Mean_Curvature\";\n      }\n      cc->Update();\n      AdjustEdgeCurvatures(cc->GetOutput(), curvatureName.c_str());\n      sources[i] = cc->GetOutput();\n    }\n    else\n    {\n      vtkNew<vtkCurvatures> cc;\n      cc->SetInputConnection(rhFnSrc->GetOutputPort());\n      if (i % 2 == 0)\n      {\n        cc->SetCurvatureTypeToGaussian();\n        curvatureName = \"Gauss_Curvature\";\n      }\n      else\n      {\n        cc->SetCurvatureTypeToMean();\n        curvatureName = \"Mean_Curvature\";\n      }\n      cc->Update();\n      AdjustEdgeCurvatures(cc->GetOutput(), curvatureName.c_str());\n      sources[i] = cc->GetOutput();\n    }\n  }\n\n  std::map<int, std::string> curvatures{\n      {0, {\"Gauss_Curvature\"}},\n      {1, {\"Mean_Curvature\"}},\n      {2, {\"Gauss_Curvature\"}},\n      {3, {\"Mean_Curvature\"}},\n  };\n\n  // auto lut = GetDivergingLut();\n  auto lut = GetDivergingLut1();\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textmappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textactors;\n  std::vector<vtkSmartPointer<vtkScalarBarActor>> scalarBars;\n  for (size_t idx = 0; idx < sources.size(); ++idx)\n  {\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    textmappers.push_back(vtkSmartPointer<vtkTextMapper>::New());\n    textactors.push_back(vtkSmartPointer<vtkActor2D>::New());\n    scalarBars.push_back(vtkSmartPointer<vtkScalarBarActor>::New());\n    renderers.push_back(vtkSmartPointer<vtkRenderer>::New());\n  }\n\n  // Create a common text property.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(24);\n  textProperty->SetJustificationToCentered();\n\n  // RenderWindow Dimensions\n  //\n  auto rendererSize = 512;\n  auto gridDimensions = 2;\n  auto windowWidth = rendererSize * gridDimensions;\n  auto windowHeight = rendererSize * gridDimensions;\n\n  for (auto idx = 0; idx < static_cast<int>(sources.size()); ++idx)\n  {\n    std::string curvatureName = curvatures[idx];\n    std::replace(curvatureName.begin(), curvatureName.end(), '_', '\\n');\n\n    sources[idx]->GetPointData()->SetActiveScalars(curvatures[idx].c_str());\n    auto scalarRange = sources[idx]\n                           ->GetPointData()\n                           ->GetScalars(curvatures[idx].c_str())\n                           ->GetRange();\n\n    mappers[idx]->SetInputData(sources[idx]);\n    mappers[idx]->SetScalarModeToUsePointFieldData();\n    mappers[idx]->SelectColorArray(curvatures[idx].c_str());\n    mappers[idx]->SetScalarRange(scalarRange);\n    mappers[idx]->SetLookupTable(lut);\n\n    actors[idx]->SetMapper(mappers[idx]);\n\n    textmappers[idx]->SetInput(curvatureName.c_str());\n    textmappers[idx]->SetTextProperty(textProperty);\n\n    textactors[idx]->SetMapper(textmappers[idx]);\n    textactors[idx]->SetPosition(250, 16);\n\n    // Create a scalar bar\n    scalarBars[idx]->SetLookupTable(mappers[idx]->GetLookupTable());\n    scalarBars[idx]->SetTitle(curvatureName.c_str());\n    scalarBars[idx]->UnconstrainedFontSizeOn();\n    scalarBars[idx]->SetNumberOfLabels(5);\n    scalarBars[idx]->SetMaximumWidthInPixels(windowWidth / 8);\n    scalarBars[idx]->SetMaximumHeightInPixels(windowHeight / 3);\n    scalarBars[idx]->SetBarRatio(scalarBars[idx]->GetBarRatio() * 0.5);\n    scalarBars[idx]->SetPosition(0.85, 0.1);\n  }\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(rendererSize * gridDimensions,\n                        rendererSize * gridDimensions);\n  renderWindow->SetWindowName(\"CurvaturesDemo\");\n\n  // Add and position the renders to the render window.\n  for (auto row = 0; row < gridDimensions; ++row)\n  {\n    for (auto col = 0; col < gridDimensions; ++col)\n    {\n      auto idx = row * gridDimensions + col;\n      renderers[idx]->SetViewport(\n          static_cast<double>(col) / gridDimensions,\n          (static_cast<double>(gridDimensions) - (row + 1.0)) / gridDimensions,\n          (static_cast<double>(col) + 1) / gridDimensions,\n          (static_cast<double>(gridDimensions) - row) / gridDimensions);\n      renderWindow->AddRenderer(renderers[idx]);\n\n      renderers[idx]->AddActor(actors[idx]);\n      renderers[idx]->AddActor(textactors[idx]);\n      renderers[idx]->AddActor(scalarBars[idx]);\n      renderers[idx]->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    }\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon)\n{\n  auto PointNeighbourhood =\n      [&source](vtkIdType const& pId) -> std::set<vtkIdType> {\n    // Extract the topological neighbors for point pId. In two steps:\n    //  1) source->GetPointCells(pId, cellIds)\n    //  2) source->GetCellPoints(cellId, cellPointIds) for all cellId in cellIds\n    vtkNew<vtkIdList> cellIds;\n    source->GetPointCells(pId, cellIds);\n    std::set<vtkIdType> neighbours;\n    for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); ++i)\n    {\n      auto cellId = cellIds->GetId(i);\n      vtkNew<vtkIdList> cellPointIds;\n      source->GetCellPoints(cellId, cellPointIds);\n      for (vtkIdType j = 0; j < cellPointIds->GetNumberOfIds(); ++j)\n      {\n        neighbours.insert(cellPointIds->GetId(j));\n      }\n    }\n    return neighbours;\n  };\n\n  auto ComputeDistance = [&source](vtkIdType const& ptIdA,\n                                   vtkIdType const& ptIdB) {\n    std::array<double, 3> ptA{0.0, 0.0, 0.0};\n    std::array<double, 3> ptB{0.0, 0.0, 0.0};\n    std::array<double, 3> ptC{0.0, 0.0, 0.0};\n    source->GetPoint(ptIdA, ptA.data());\n    source->GetPoint(ptIdB, ptB.data());\n    std::transform(std::begin(ptA), std::end(ptA), std::begin(ptB),\n                   std::begin(ptC), std::minus<double>());\n    // Calculate the norm.\n    auto result = std::sqrt(std::inner_product(std::begin(ptC), std::end(ptC),\n                                               std::begin(ptC), 0.0));\n    return result;\n  };\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n\n  // Get the boundary point IDs.\n  std::string name = \"Ids\";\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputData(source);\n  idFilter->SetPointIds(true);\n  idFilter->SetCellIds(false);\n  idFilter->SetPointIdsArrayName(name.c_str());\n  idFilter->SetCellIdsArrayName(name.c_str());\n  idFilter->Update();\n\n  vtkNew<vtkFeatureEdges> edges;\n\n  edges->SetInputConnection(idFilter->GetOutputPort());\n  edges->BoundaryEdgesOn();\n  edges->ManifoldEdgesOff();\n  edges->NonManifoldEdgesOff();\n  edges->FeatureEdgesOff();\n  edges->Update();\n\n  auto edgeAarray =\n      edges->GetOutput()->GetPointData()->GetAbstractArray(name.c_str());\n  std::vector<vtkIdType> boundaryIds;\n  for (vtkIdType i = 0; i < edges->GetOutput()->GetNumberOfPoints(); ++i)\n  {\n    boundaryIds.push_back(edgeAarray->GetVariantValue(i).ToInt());\n  }\n  // Remove duplicate Ids.\n  std::set<vtkIdType> pIdsSet(boundaryIds.begin(), boundaryIds.end());\n  for (auto const pId : boundaryIds)\n  {\n    auto pIdsNeighbors = PointNeighbourhood(pId);\n    std::set<vtkIdType> pIdsNeighborsInterior;\n    std::set_difference(\n        pIdsNeighbors.begin(), pIdsNeighbors.end(), pIdsSet.begin(),\n        pIdsSet.end(),\n        std::inserter(pIdsNeighborsInterior, pIdsNeighborsInterior.begin()));\n    // Compute distances and extract curvature values.\n    std::vector<double> curvs;\n    std::vector<double> dists;\n    for (auto const pIdN : pIdsNeighborsInterior)\n    {\n      curvs.push_back(curvatures[pIdN]);\n      dists.push_back(ComputeDistance(pIdN, pId));\n    }\n    std::vector<vtkIdType> nonZeroDistIds;\n    for (size_t i = 0; i < dists.size(); ++i)\n    {\n      if (dists[i] > 0)\n      {\n        nonZeroDistIds.push_back(i);\n      }\n    }\n    std::vector<double> curvsNonZero;\n    std::vector<double> distsNonZero;\n    for (auto const i : nonZeroDistIds)\n    {\n      curvsNonZero.push_back(curvs[i]);\n      distsNonZero.push_back(dists[i]);\n    }\n    // Iterate over the edge points and compute the curvature as the weighted\n    // average of the neighbours.\n    auto countInvalid = 0;\n    auto newCurv = 0.0;\n    if (curvsNonZero.size() > 0)\n    {\n      std::vector<double> weights;\n      double sum = 0.0;\n      for (auto const d : distsNonZero)\n      {\n        sum += 1.0 / d;\n        weights.push_back(1.0 / d);\n      }\n      for (size_t i = 0; i < weights.size(); ++i)\n      {\n        weights[i] = weights[i] / sum;\n      }\n      newCurv = std::inner_product(curvsNonZero.begin(), curvsNonZero.end(),\n                                   weights.begin(), 0.0);\n    }\n    else\n    {\n      // Corner case.\n      // countInvalid += 1;\n      // Assuming the curvature of the point is planar.\n      newCurv = 0.0;\n    }\n    // Set the new curvature value.\n    curvatures[pId] = newCurv;\n  }\n\n  // Set small values to zero.\n  if (epsilon != 0.0)\n  {\n    auto eps = std::abs(epsilon);\n    for (size_t i = 0; i < curvatures.size(); ++i)\n    {\n      if (std::abs(curvatures[i]) < eps)\n      {\n        curvatures[i] = 0.0;\n      }\n    }\n  }\n\n  if (static_cast<size_t>(source->GetNumberOfPoints()) != curvatures.size())\n  {\n    std::string s = curvatureName;\n    s += \":\\nCannot add the adjusted curvatures to the source.\\n\";\n    s += \" The number of points in source does not equal the\\n\";\n    s += \" number of point ids in the adjusted curvature array.\";\n    std::cerr << s << std::endl;\n    return;\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\n// clang-format off\n/**\n * See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n *\n *                   start point         midPoint            end point\n * cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n * purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n * green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n * blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n * green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n *\n */\n// clang-format on\nvtkSmartPointer<vtkLookupTable> GetDivergingLut()\n{\n\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, 0.230, 0.299, 0.754);\n  ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n  ctf->AddRGBPoint(1.0, 0.706, 0.016, 0.150);\n\n  auto tableSize = 256;\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(static_cast<double>(i) / lut->GetNumberOfColors(),\n                  rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(static_cast<vtkIdType>(i), rgba.data());\n  }\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLut1()\n{\n  vtkNew<vtkNamedColors> colors;\n  // Colour transfer function.\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, colors->GetColor3d(\"MidnightBlue\").GetRed(),\n                   colors->GetColor3d(\"MidnightBlue\").GetGreen(),\n                   colors->GetColor3d(\"MidnightBlue\").GetBlue());\n  ctf->AddRGBPoint(0.5, colors->GetColor3d(\"Gainsboro\").GetRed(),\n                   colors->GetColor3d(\"Gainsboro\").GetGreen(),\n                   colors->GetColor3d(\"Gainsboro\").GetBlue());\n  ctf->AddRGBPoint(1.0, colors->GetColor3d(\"DarkOrange\").GetRed(),\n                   colors->GetColor3d(\"DarkOrange\").GetGreen(),\n                   colors->GetColor3d(\"DarkOrange\").GetBlue());\n\n  // Lookup table.\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(256);\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(double(i) / lut->GetNumberOfColors(), rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(i, rgba.data());\n  }\n\n  return lut;\n}\n\n} // namespace\n
        "},{"location":"Cxx/PolyData/CurvaturesDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CurvaturesDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CurvaturesDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CurvaturesDemo MACOSX_BUNDLE CurvaturesDemo.cxx )\n  target_link_libraries(CurvaturesDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CurvaturesDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/CurvaturesDemo/#download-and-build-curvaturesdemo","title":"Download and Build CurvaturesDemo","text":"

        Click here to download CurvaturesDemo and its CMakeLists.txt file. Once the tarball CurvaturesDemo.tar has been downloaded and extracted,

        cd CurvaturesDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CurvaturesDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/DataBounds/","title":"DataBounds","text":"

        vtk-examples/Cxx/PolyData/DataBounds

        "},{"location":"Cxx/PolyData/DataBounds/#description","title":"Description","text":"

        This examples gets the bounds of a dataset. Note that Update() must be applied to create the output of the filter.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/DataBounds/#code","title":"Code","text":"

        DataBounds.cxx

        #include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> modelSource;\n    modelSource->Update();\n    polyData = modelSource->GetOutput();\n  }\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n\n  std::cout << \"xmin: \" << bounds[0] << \" \"\n            << \"xmax: \" << bounds[1] << std::endl\n            << \"ymin: \" << bounds[2] << \" \"\n            << \"ymax: \" << bounds[3] << std::endl\n            << \"zmin: \" << bounds[4] << \" \"\n            << \"zmax: \" << bounds[5] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/DataBounds/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataBounds)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataBounds: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataBounds MACOSX_BUNDLE DataBounds.cxx )\n  target_link_libraries(DataBounds PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataBounds\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/DataBounds/#download-and-build-databounds","title":"Download and Build DataBounds","text":"

        Click here to download DataBounds and its CMakeLists.txt file. Once the tarball DataBounds.tar has been downloaded and extracted,

        cd DataBounds/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DataBounds\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/DataSetSurfaceFilter/","title":"DataSetSurfaceFilter","text":"

        vtk-examples/Cxx/PolyData/DataSetSurfaceFilter

        "},{"location":"Cxx/PolyData/DataSetSurfaceFilter/#description","title":"Description","text":"

        This example demonstrates how to convert an unstructured grid to a polydata. Currently nothing is done with the resulting polydata.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/DataSetSurfaceFilter/#code","title":"Code","text":"

        DataSetSurfaceFilter.cxx

        #include <vtkDataSetSurfaceFilter.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n#include <vtkVertex.h>\n\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid> MakeUnstructuredGrid(vtkSmartPointer<T>);\n}\n\nint main(int argc, char* argv[])\n{\n  auto surfaceFilter = vtkSmartPointer<vtkDataSetSurfaceFilter>::New();\n  if (argc < 2)\n  {\n    // std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtk) e.g. uGridEx.vtk \"\n    //          << std::endl;\n    auto unstructuredGrid =\n        MakeUnstructuredGrid(vtkSmartPointer<vtkVertex>::New());\n    surfaceFilter->SetInputData(unstructuredGrid);\n  }\n  else\n  {\n    // Create the reader for the data.\n    // This is the data that will be rendered.\n    std::string filename = argv[1];\n    std::cout << \"Loading \" << filename.c_str() << std::endl;\n    vtkNew<vtkUnstructuredGridReader> reader;\n    reader->SetFileName(filename.c_str());\n    surfaceFilter->SetInputConnection(reader->GetOutputPort());\n  }\n\n  surfaceFilter->Update();\n\n  vtkPolyData* polydata = surfaceFilter->GetOutput();\n\n  std::cout << \"Output has \" << polydata->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid>\nMakeUnstructuredGrid(vtkSmartPointer<T> aCell)\n{\n  double* pcoords = aCell->GetParametricCoords();\n  for (int i = 0; i < aCell->GetNumberOfPoints(); ++i)\n  {\n    aCell->GetPointIds()->SetId(i, i);\n    aCell->GetPoints()->SetPoint(i, *(pcoords + 3 * i), *(pcoords + 3 * i + 1),\n                                 *(pcoords + 3 * i + 2));\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(aCell->GetPoints());\n  ug->InsertNextCell(aCell->GetCellType(), aCell->GetPointIds());\n  return ug;\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/DataSetSurfaceFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataSetSurfaceFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  IOLegacy\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataSetSurfaceFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataSetSurfaceFilter MACOSX_BUNDLE DataSetSurfaceFilter.cxx )\n  target_link_libraries(DataSetSurfaceFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataSetSurfaceFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/DataSetSurfaceFilter/#download-and-build-datasetsurfacefilter","title":"Download and Build DataSetSurfaceFilter","text":"

        Click here to download DataSetSurfaceFilter and its CMakeLists.txt file. Once the tarball DataSetSurfaceFilter.tar has been downloaded and extracted,

        cd DataSetSurfaceFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DataSetSurfaceFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/DecimatePolyline/","title":"DecimatePolyline","text":"

        vtk-examples/Cxx/PolyData/DecimatePolyline

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/DecimatePolyline/#description","title":"Description","text":"

        This example shows how to decimate a polyline.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/DecimatePolyline/#code","title":"Code","text":"

        DecimatePolyline.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkDecimatePolylineFilter.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  const unsigned int numberofpoints = 100;\n\n  vtkNew<vtkPolyData> circle;\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> lines;\n  vtkIdType* lineIndices = new vtkIdType[numberofpoints + 1];\n\n  for (unsigned int i = 0; i < numberofpoints; i++)\n  {\n    const double angle = 2.0 * vtkMath::Pi() * static_cast<double>(i) /\n        static_cast<double>(numberofpoints);\n    points->InsertPoint(static_cast<vtkIdType>(i), cos(angle), sin(angle), 0.);\n    lineIndices[i] = static_cast<vtkIdType>(i);\n  }\n  lineIndices[numberofpoints] = 0;\n  lines->InsertNextCell(numberofpoints + 1, lineIndices);\n  delete[] lineIndices;\n\n  circle->SetPoints(points);\n  circle->SetLines(lines);\n\n  vtkNew<vtkPolyDataMapper> c_mapper;\n  c_mapper->SetInputData(circle);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> c_actor;\n  c_actor->SetMapper(c_mapper);\n  c_actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  c_actor->GetProperty()->SetLineWidth(3);\n\n  vtkNew<vtkDecimatePolylineFilter> decimate;\n  decimate->SetInputData(circle);\n  decimate->SetTargetReduction(0.95);\n  decimate->Update();\n\n  vtkNew<vtkPolyDataMapper> d_mapper;\n  d_mapper->SetInputConnection(decimate->GetOutputPort());\n\n  vtkNew<vtkActor> d_actor;\n  d_actor->SetMapper(d_mapper);\n  d_actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  d_actor->GetProperty()->SetLineWidth(3);\n\n  vtkNew<vtkRenderer> ren;\n  ren->AddActor(c_actor);\n  ren->AddActor(d_actor);\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(ren);\n  renwin->SetSize(640, 480);\n  renwin->SetWindowName(\"DecimatePolyline\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n\n  renwin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/DecimatePolyline/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DecimatePolyline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DecimatePolyline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DecimatePolyline MACOSX_BUNDLE DecimatePolyline.cxx )\n  target_link_libraries(DecimatePolyline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DecimatePolyline\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/DecimatePolyline/#download-and-build-decimatepolyline","title":"Download and Build DecimatePolyline","text":"

        Click here to download DecimatePolyline and its CMakeLists.txt file. Once the tarball DecimatePolyline.tar has been downloaded and extracted,

        cd DecimatePolyline/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DecimatePolyline\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/DeleteCells/","title":"DeleteCells","text":"

        vtk-examples/Cxx/PolyData/DeleteCells

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/DeleteCells/#description","title":"Description","text":"

        This example demonstrates how to delete a cell from a vtkPolyData. This is a three-step process: first, build upward-links from points to cells; second, mark cells for deletion; third, delete the marked cells. The first step is necessary to create a data structure suitable for efficient delete operations. Creating this data structure is computationally expensive, so it is only carried out before operations that need it, e.g. those that require changes to the topology.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/DeleteCells/#code","title":"Code","text":"

        DeleteCells.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 0, 0);\n  points->InsertNextPoint(1, 1, 0);\n  points->InsertNextPoint(0, 1, 0);\n\n  vtkNew<vtkLine> line0;\n  line0->GetPointIds()->SetId(0, 0);\n  line0->GetPointIds()->SetId(1, 1);\n\n  vtkNew<vtkLine> line1;\n  line1->GetPointIds()->SetId(0, 1);\n  line1->GetPointIds()->SetId(1, 2);\n\n  vtkNew<vtkLine> line2;\n  line2->GetPointIds()->SetId(0, 2);\n  line2->GetPointIds()->SetId(1, 3);\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line0);\n  lines->InsertNextCell(line1);\n  lines->InsertNextCell(line2);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetLines(lines);\n\n  // Tell the polydata to build 'upward' links from points to cells.\n  polydata->BuildLinks();\n  // Mark a cell as deleted.\n  polydata->DeleteCell(1);\n  // Remove the marked cell.\n  polydata->RemoveDeletedCells();\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputDataObject(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  actor->GetProperty()->SetLineWidth(4);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DeleteCells\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/DeleteCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DeleteCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DeleteCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DeleteCells MACOSX_BUNDLE DeleteCells.cxx )\n  target_link_libraries(DeleteCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DeleteCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/DeleteCells/#download-and-build-deletecells","title":"Download and Build DeleteCells","text":"

        Click here to download DeleteCells and its CMakeLists.txt file. Once the tarball DeleteCells.tar has been downloaded and extracted,

        cd DeleteCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DeleteCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/DeletePoint/","title":"DeletePoint","text":"

        vtk-examples/Cxx/PolyData/DeletePoint

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/DeletePoint/#code","title":"Code","text":"

        DeletePoint.cxx

        #include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkSmartPointer.h>\n\nnamespace {\nvoid OutputPoints(vtkSmartPointer<vtkPoints> points);\nvoid ReallyDeletePoint(vtkSmartPointer<vtkPoints> points, vtkIdType id);\n} // namespace\n\nint main(int, char*[])\n{\n  // Create a set of points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 1.0);\n\n  std::cout << \"Number of points: \" << points->GetNumberOfPoints() << std::endl;\n  OutputPoints(points);\n\n  ReallyDeletePoint(points, 1);\n\n  std::cout << \"Number of points: \" << points->GetNumberOfPoints() << std::endl;\n  OutputPoints(points);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid OutputPoints(vtkSmartPointer<vtkPoints> points)\n{\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    points->GetPoint(i, p);\n    cout << p[0] << \" \" << p[1] << \" \" << p[2] << endl;\n  }\n}\n\nvoid ReallyDeletePoint(vtkSmartPointer<vtkPoints> points, vtkIdType id)\n{\n  vtkNew<vtkPoints> newPoints;\n\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    if (i != id)\n    {\n      double p[3];\n      points->GetPoint(i, p);\n      newPoints->InsertNextPoint(p);\n    }\n  }\n\n  points->ShallowCopy(newPoints);\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/DeletePoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DeletePoint)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DeletePoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DeletePoint MACOSX_BUNDLE DeletePoint.cxx )\n  target_link_libraries(DeletePoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DeletePoint\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/DeletePoint/#download-and-build-deletepoint","title":"Download and Build DeletePoint","text":"

        Click here to download DeletePoint and its CMakeLists.txt file. Once the tarball DeletePoint.tar has been downloaded and extracted,

        cd DeletePoint/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DeletePoint\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/DetermineArrayDataTypes/","title":"DetermineArrayDataTypes","text":"

        vtk-examples/Cxx/PolyData/DetermineArrayDataTypes

        "},{"location":"Cxx/PolyData/DetermineArrayDataTypes/#description","title":"Description","text":"

        This example shows how to determine the type of data stored in a named array in a vtp file.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/DetermineArrayDataTypes/#code","title":"Code","text":"

        DetermineArrayDataTypes.cxx

        #include <string>\n#include <vector>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\nvoid FindAllData(const std::string& inputFilename);\n}\n\nint main(int argc, char* argv[])\n{\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" InputFilename e.g. filledContours.vtp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string inputFilename = argv[1];\n  FindAllData(inputFilename);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid FindAllData(const std::string& InputFilename)\n{\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(InputFilename.c_str());\n  reader->Update();\n  vtkPolyData* polydata = reader->GetOutput();\n\n  unsigned int numberOfArrays = polydata->GetPointData()->GetNumberOfArrays();\n  std::cout << \"NumArrays: \" << numberOfArrays << std::endl;\n\n  std::cout << \"key: \" << std::endl;\n  ;\n  // More values can be found in <VTK_DIR>/Common/Core/vtkSetGet.h\n  std::cout << VTK_UNSIGNED_CHAR << \" unsigned char\" << std::endl;\n  std::cout << VTK_UNSIGNED_INT << \" unsigned int\" << std::endl;\n  std::cout << VTK_FLOAT << \" float\" << std::endl;\n  std::cout << VTK_DOUBLE << \" double\" << std::endl;\n\n  std::vector<std::string> arrayNames;\n  for (unsigned int i = 0; i < numberOfArrays; i++)\n  {\n    // The following two lines are equivalent:\n    // arrayNames.push_back(polydata->GetPointData()->GetArray(i)->GetName());\n    arrayNames.push_back(polydata->GetPointData()->GetArrayName(i));\n    int dataTypeID = polydata->GetPointData()->GetArray(i)->GetDataType();\n    std::cout << \"Array \" << i << \": \" << arrayNames[i]\n              << \" (type: \" << dataTypeID << \")\" << std::endl;\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/DetermineArrayDataTypes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DetermineArrayDataTypes)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DetermineArrayDataTypes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DetermineArrayDataTypes MACOSX_BUNDLE DetermineArrayDataTypes.cxx )\n  target_link_libraries(DetermineArrayDataTypes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DetermineArrayDataTypes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/DetermineArrayDataTypes/#download-and-build-determinearraydatatypes","title":"Download and Build DetermineArrayDataTypes","text":"

        Click here to download DetermineArrayDataTypes and its CMakeLists.txt file. Once the tarball DetermineArrayDataTypes.tar has been downloaded and extracted,

        cd DetermineArrayDataTypes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DetermineArrayDataTypes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/DijkstraGraphGeodesicPath/","title":"DijkstraGraphGeodesicPath","text":"

        vtk-examples/Cxx/PolyData/DijkstraGraphGeodesicPath

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/DijkstraGraphGeodesicPath/#code","title":"Code","text":"

        DijkstraGraphGeodesicPath.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDijkstraGraphGeodesicPath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkDijkstraGraphGeodesicPath> dijkstra;\n  dijkstra->SetInputConnection(sphereSource->GetOutputPort());\n  dijkstra->SetStartVertex(0);\n  // dijkstra->SetEndVertex(10);\n  dijkstra->SetEndVertex(7);\n  dijkstra->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> pathMapper;\n  pathMapper->SetInputConnection(dijkstra->GetOutputPort());\n\n  vtkNew<vtkActor> pathActor;\n  pathActor->SetMapper(pathMapper);\n  pathActor->GetProperty()->SetColor(colors->GetColor3d(\"HotPink\").GetData());\n  pathActor->GetProperty()->SetLineWidth(4);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DijkstraGraphGeodesicPath\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor(pathActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(2.9, -1.6, 0.3);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n  camera->SetDistance(3);\n  camera->Zoom(1.5);\n\n  // Render and interact.\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/DijkstraGraphGeodesicPath/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DijkstraGraphGeodesicPath)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DijkstraGraphGeodesicPath: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DijkstraGraphGeodesicPath MACOSX_BUNDLE DijkstraGraphGeodesicPath.cxx )\n  target_link_libraries(DijkstraGraphGeodesicPath PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DijkstraGraphGeodesicPath\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/DijkstraGraphGeodesicPath/#download-and-build-dijkstragraphgeodesicpath","title":"Download and Build DijkstraGraphGeodesicPath","text":"

        Click here to download DijkstraGraphGeodesicPath and its CMakeLists.txt file. Once the tarball DijkstraGraphGeodesicPath.tar has been downloaded and extracted,

        cd DijkstraGraphGeodesicPath/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DijkstraGraphGeodesicPath\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/DistancePolyDataFilter/","title":"DistancePolyDataFilter","text":"

        vtk-examples/Cxx/PolyData/DistancePolyDataFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/DistancePolyDataFilter/#code","title":"Code","text":"

        DistancePolyDataFilter.cxx

        #include <vtkActor.h>\n#include <vtkCleanPolyData.h>\n#include <vtkDistancePolyDataFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> input1;\n  vtkSmartPointer<vtkPolyData> input2;\n  if (argc == 3)\n  {\n    //     std::cerr << \"Usage: \" << argv[0]\n    //               << \" filename1.vtk\"\n    //               << \" filename2.vtk\" << std::endl;\n    vtkNew<vtkPolyDataReader> reader1;\n    reader1->SetFileName(argv[1]);\n    reader1->Update();\n    input1 = reader1->GetOutput();\n\n    vtkNew<vtkPolyDataReader> reader2;\n    reader2->SetFileName(argv[2]);\n    reader2->Update();\n    input2 = reader2->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource1;\n    sphereSource1->SetCenter(1, 0, 0);\n    sphereSource1->SetPhiResolution(21);\n    sphereSource1->SetThetaResolution(21);\n    sphereSource1->Update();\n    input1 = sphereSource1->GetOutput();\n\n    vtkNew<vtkSphereSource> sphereSource2;\n    sphereSource2->SetPhiResolution(21);\n    sphereSource2->SetThetaResolution(21);\n    sphereSource2->Update();\n    input2 = sphereSource2->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCleanPolyData> clean1;\n  clean1->SetInputData(input1);\n\n  vtkNew<vtkCleanPolyData> clean2;\n  clean2->SetInputData(input2);\n\n  vtkNew<vtkDistancePolyDataFilter> distanceFilter;\n\n  distanceFilter->SetInputConnection(0, clean1->GetOutputPort());\n  distanceFilter->SetInputConnection(1, clean2->GetOutputPort());\n  distanceFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(distanceFilter->GetOutputPort());\n  mapper->SetScalarRange(\n      distanceFilter->GetOutput()->GetPointData()->GetScalars()->GetRange()[0],\n      distanceFilter->GetOutput()->GetPointData()->GetScalars()->GetRange()[1]);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(mapper->GetLookupTable());\n  scalarBar->SetTitle(\"Distance\");\n  scalarBar->SetNumberOfLabels(4);\n  scalarBar->UnconstrainedFontSizeOn();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Gold\").GetData());\n  renderer->GradientBackgroundOn();\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(600, 500);\n  renWin->SetWindowName(\"DistancePolyDataFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renWin);\n\n  renderer->AddActor(actor);\n  renderer->AddActor2D(scalarBar);\n\n  renWin->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/DistancePolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DistancePolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DistancePolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DistancePolyDataFilter MACOSX_BUNDLE DistancePolyDataFilter.cxx )\n  target_link_libraries(DistancePolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DistancePolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/DistancePolyDataFilter/#download-and-build-distancepolydatafilter","title":"Download and Build DistancePolyDataFilter","text":"

        Click here to download DistancePolyDataFilter and its CMakeLists.txt file. Once the tarball DistancePolyDataFilter.tar has been downloaded and extracted,

        cd DistancePolyDataFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DistancePolyDataFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/DownsamplePointCloud/","title":"DownsamplePointCloud","text":"

        vtk-examples/Cxx/PolyData/DownsamplePointCloud

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/DownsamplePointCloud/#description","title":"Description","text":"

        This example downsamples a point cloud by specifying the minimum distance two points can be from each other. The filter will delete points so that this criterion is met.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/DownsamplePointCloud/#code","title":"Code","text":"

        DownsamplePointCloud.cxx

        #include <vtkActor.h>\n#include <vtkCleanPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(1000);\n  pointSource->SetRadius(1.0);\n  pointSource->Update();\n  auto pts = pointSource->GetNumberOfPoints();\n\n  vtkNew<vtkCleanPolyData> cleanPolyData;\n  cleanPolyData->SetInputConnection(pointSource->GetOutputPort());\n  cleanPolyData->SetTolerance(0.1);\n  cleanPolyData->Update();\n  auto cleanPts = cleanPolyData->GetOutput()->GetNumberOfPoints();\n\n  std::cout << \"Original points\" << pts << std::endl;\n  std::cout << \"Cleaned points \" << cleanPts << std::endl;\n  std::cout << \"Reduction      \"\n            << (1.0 - static_cast<double>(cleanPts) / pts) * 100.0 << \"%\"\n            << std::endl;\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(pointSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n  inputActor->GetProperty()->SetPointSize(3);\n\n  vtkNew<vtkPolyDataMapper> cleanedMapper;\n  cleanedMapper->SetInputConnection(cleanPolyData->GetOutputPort());\n  vtkNew<vtkActor> cleanedActor;\n  cleanedActor->SetMapper(cleanedMapper);\n  cleanedActor->GetProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n  cleanedActor->GetProperty()->SetPointSize(3);\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"DownsamplePointCloud\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"van_dyke_brown\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"ultramarine\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(cleanedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/DownsamplePointCloud/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DownsamplePointCloud)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DownsamplePointCloud: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DownsamplePointCloud MACOSX_BUNDLE DownsamplePointCloud.cxx )\n  target_link_libraries(DownsamplePointCloud PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DownsamplePointCloud\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/DownsamplePointCloud/#download-and-build-downsamplepointcloud","title":"Download and Build DownsamplePointCloud","text":"

        Click here to download DownsamplePointCloud and its CMakeLists.txt file. Once the tarball DownsamplePointCloud.tar has been downloaded and extracted,

        cd DownsamplePointCloud/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DownsamplePointCloud\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/EmbedPointsIntoVolume/","title":"EmbedPointsIntoVolume","text":"

        vtk-examples/Cxx/PolyData/EmbedPointsIntoVolume

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/EmbedPointsIntoVolume/#code","title":"Code","text":"

        EmbedPointsIntoVolume.cxx

        #include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyData> input;\n\n  if (argc == 1) // Generate the data.\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetRadius(.01);\n    sphereSource->Update();\n    input->ShallowCopy(sphereSource->GetOutput());\n  }\n  else // Read the data from a file.\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    input->ShallowCopy(reader->GetOutput());\n  }\n\n  vtkNew<vtkGaussianSplatter> splatter;\n  splatter->SetInputData(input);\n\n  unsigned int n = 200;\n  splatter->SetSampleDimensions(n, n, n);\n  splatter->SetRadius(.02);\n  splatter->SetExponentFactor(-10);\n  splatter->SetEccentricity(2);\n  splatter->Update();\n\n  vtkNew<vtkContourFilter> isoSurface;\n  isoSurface->SetInputConnection(splatter->GetOutputPort());\n  isoSurface->SetValue(0, .95 * splatter->GetRadius());\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(isoSurface->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"EmbedPointsIntoVolume\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/EmbedPointsIntoVolume/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EmbedPointsIntoVolume)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EmbedPointsIntoVolume: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EmbedPointsIntoVolume MACOSX_BUNDLE EmbedPointsIntoVolume.cxx )\n  target_link_libraries(EmbedPointsIntoVolume PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EmbedPointsIntoVolume\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/EmbedPointsIntoVolume/#download-and-build-embedpointsintovolume","title":"Download and Build EmbedPointsIntoVolume","text":"

        Click here to download EmbedPointsIntoVolume and its CMakeLists.txt file. Once the tarball EmbedPointsIntoVolume.tar has been downloaded and extracted,

        cd EmbedPointsIntoVolume/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./EmbedPointsIntoVolume\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ExternalContour/","title":"ExternalContour","text":"

        vtk-examples/Cxx/PolyData/ExternalContour

        "},{"location":"Cxx/PolyData/ExternalContour/#description","title":"Description","text":"

        Compute the external contour of a polydata.

        At first, it creates a black and white image of a scene containing the polydata and then extracts the contour of the black shape from the image.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ExternalContour/#code","title":"Code","text":"

        ExternalContour.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVersion.h>\n#include <vtkWindowToImageFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkPolyData> data3d;\n\n  if (argc > 1)\n  {\n    // E.g. Bunny.vtp\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    data3d = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetCenter(0.0, 0.0, 5.0);\n    source->SetRadius(2.0);\n    source->SetPhiResolution(20.);\n    source->SetThetaResolution(20.);\n    source->Update();\n\n    data3d = source->GetOutput();\n  }\n\n  double bounds_data[6], center_data[3];\n  data3d->GetBounds(bounds_data);\n  data3d->GetCenter(center_data);\n\n  // Black and white scene with the data in order to print the view.\n  vtkNew<vtkPolyDataMapper> mapper_data;\n  mapper_data->SetInputData(data3d);\n\n  vtkNew<vtkActor> actor_data;\n  actor_data->SetMapper(mapper_data);\n  actor_data->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderer> tmp_rend;\n  tmp_rend->SetBackground(colors->GetColor3d(\"White\").GetData());\n\n  tmp_rend->AddActor(actor_data);\n  tmp_rend->ResetCamera();\n  tmp_rend->GetActiveCamera()->SetParallelProjection(1);\n\n  vtkNew<vtkRenderWindow> tmp_rW;\n  tmp_rW->SetOffScreenRendering(1);\n  tmp_rW->AddRenderer(tmp_rend);\n\n  tmp_rW->Render();\n\n  // Get a print of the window\n  vtkNew<vtkWindowToImageFilter> windowToImageFilter;\n  windowToImageFilter->SetInput(tmp_rW);\n#if VTK_MAJOR_VERSION >= 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90\n  windowToImageFilter->SetScale(2); // image quality\n#else\n  windowToImageFilter->SetMagnification(2); // image quality\n#endif\n  windowToImageFilter->Update();\n\n  // Extract the silhouette corresponding to the black limit of the image.\n  vtkNew<vtkContourFilter> ContFilter;\n  ContFilter->SetInputConnection(windowToImageFilter->GetOutputPort());\n  ContFilter->SetValue(0, 255);\n  ContFilter->Update();\n\n  // Make the contour coincide with the data.\n  vtkSmartPointer<vtkPolyData> contour = ContFilter->GetOutput();\n\n  double bounds_contour[6], center_contour[3];\n  double trans_x = 0.0, trans_y = 0.0, trans_z = 0.0, ratio_x = 0.0,\n         ratio_y = 0.0;\n  contour->GetBounds(bounds_contour);\n\n  ratio_x = (bounds_data[1] - bounds_data[0]) /\n      (bounds_contour[1] - bounds_contour[0]);\n  ratio_y = (bounds_data[3] - bounds_data[2]) /\n      (bounds_contour[3] - bounds_contour[2]);\n\n  // Rescale the contour so that it shares the same bounds as the\n  // input data.\n  vtkNew<vtkTransform> transform1;\n  transform1->Scale(ratio_x, ratio_y, 1.0);\n\n  vtkNew<vtkTransformPolyDataFilter> tfilter1;\n  tfilter1->SetInputData(contour);\n  tfilter1->SetTransform(transform1);\n  tfilter1->Update();\n\n  contour = tfilter1->GetOutput();\n\n  // Translate the contour so that it shares the same center as the\n  // input data.\n  contour->GetCenter(center_contour);\n  trans_x = center_data[0] - center_contour[0];\n  trans_y = center_data[1] - center_contour[1];\n  trans_z = center_data[2] - center_contour[2];\n\n  vtkNew<vtkTransform> transform2;\n  transform2->Translate(trans_x, trans_y, trans_z);\n\n  vtkNew<vtkTransformPolyDataFilter> tfilter2;\n  tfilter2->SetInputData(contour);\n  tfilter2->SetTransform(transform2);\n  tfilter2->Update();\n\n  contour = tfilter2->GetOutput();\n\n  // Render the result : Input data + resulting silhouette\n\n  // Updating the color of the data.\n  actor_data->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a mapper and actor of the silhouette.\n  vtkNew<vtkPolyDataMapper> mapper_contour;\n  mapper_contour->SetInputData(contour);\n\n  vtkNew<vtkActor> actor_contour;\n  actor_contour->SetMapper(mapper_contour);\n  actor_contour->GetProperty()->SetLineWidth(2.0);\n\n  // 2 renderers and a render window.\n  vtkNew<vtkRenderer> renderer1;\n  renderer1->AddActor(actor_data);\n\n  vtkNew<vtkRenderer> renderer2;\n  renderer2->AddActor(actor_contour);\n\n  vtkNew<vtkRenderWindow> renderwindow;\n  renderwindow->SetSize(400, 400);\n  renderwindow->SetWindowName(\"ExternalContour\");\n  renderwindow->AddRenderer(renderer1);\n\n  renderer1->SetViewport(0.0, 0.0, 0.5, 1.0);\n  renderer1->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderwindow->AddRenderer(renderer2);\n  renderer2->SetViewport(0.5, 0.0, 1.0, 1.0);\n  renderer2->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  iren->SetRenderWindow(renderwindow);\n  iren->SetInteractorStyle(style);\n\n  renderwindow->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ExternalContour/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExternalContour)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExternalContour: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExternalContour MACOSX_BUNDLE ExternalContour.cxx )\n  target_link_libraries(ExternalContour PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExternalContour\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ExternalContour/#download-and-build-externalcontour","title":"Download and Build ExternalContour","text":"

        Click here to download ExternalContour and its CMakeLists.txt file. Once the tarball ExternalContour.tar has been downloaded and extracted,

        cd ExternalContour/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExternalContour\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ExtractCellsUsingPoints/","title":"ExtractCellsUsingPoints","text":"

        vtk-examples/Cxx/PolyData/ExtractCellsUsingPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ExtractCellsUsingPoints/#code","title":"Code","text":"

        ExtractCellsUsingPoints.cxx

        #include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInformation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfCells()\n            << \" input cells.\" << std::endl;\n\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  // Set values\n\n  for (vtkIdType i = 0; i < sphereSource->GetOutput()->GetNumberOfPoints() - 15;\n       i++)\n  {\n    ids->InsertNextValue(i);\n  }\n\n  vtkNew<vtkSelectionNode> selectionNode;\n  selectionNode->SetFieldType(vtkSelectionNode::POINT);\n  selectionNode->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode->SetSelectionList(ids);\n  selectionNode->GetProperties()->Set(vtkSelectionNode::CONTAINING_CELLS(), 1);\n\n  vtkNew<vtkSelection> selection;\n  selection->AddNode(selectionNode);\n\n  vtkNew<vtkExtractSelection> extractSelection;\n\n  extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n  extractSelection->SetInputData(1, selection);\n  extractSelection->Update();\n\n  // In selection\n  vtkNew<vtkUnstructuredGrid> selected;\n  selected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << selected->GetNumberOfPoints()\n            << \" points in the selection.\" << std::endl;\n  std::cout << \"There are \" << selected->GetNumberOfCells()\n            << \" cells in the selection.\" << std::endl;\n\n  // Get points that are NOT in the selection.\n  selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(),\n                                      1); // invert the selection\n  extractSelection->Update();\n\n  vtkNew<vtkUnstructuredGrid> notSelected;\n  notSelected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << notSelected->GetNumberOfPoints()\n            << \" points NOT in the selection.\" << std::endl;\n  std::cout << \"There are \" << notSelected->GetNumberOfCells()\n            << \" cells NOT in the selection.\" << std::endl;\n\n  vtkNew<vtkProperty> backfaces;\n  backfaces->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkDataSetMapper> inputMapper;\n  inputMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkDataSetMapper> selectedMapper;\n  selectedMapper->SetInputData(selected);\n\n  vtkNew<vtkActor> selectedActor;\n  selectedActor->SetMapper(selectedMapper);\n  selectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  vtkNew<vtkProperty> backProperty;\n  selectedActor->SetBackfaceProperty(backProperty);\n  selectedActor->SetBackfaceProperty(backfaces);\n\n  vtkNew<vtkDataSetMapper> notSelectedMapper;\n  notSelectedMapper->SetInputData(notSelected);\n\n  vtkNew<vtkActor> notSelectedActor;\n  notSelectedActor->SetMapper(notSelectedMapper);\n  notSelectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  notSelectedActor->SetBackfaceProperty(backfaces);\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->SetWindowName(\"ExtractCellsUsingPoints\");\n\n  // And one interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, .66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Create a camera for all renderers.\n  vtkNew<vtkCamera> camera;\n\n  // Setup the renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  leftRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"orchid_dark\").GetData());\n  centerRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->AddActor(inputActor);\n  centerRenderer->AddActor(selectedActor);\n  rightRenderer->AddActor(notSelectedActor);\n\n  leftRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ExtractCellsUsingPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractCellsUsingPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractCellsUsingPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractCellsUsingPoints MACOSX_BUNDLE ExtractCellsUsingPoints.cxx )\n  target_link_libraries(ExtractCellsUsingPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractCellsUsingPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ExtractCellsUsingPoints/#download-and-build-extractcellsusingpoints","title":"Download and Build ExtractCellsUsingPoints","text":"

        Click here to download ExtractCellsUsingPoints and its CMakeLists.txt file. Once the tarball ExtractCellsUsingPoints.tar has been downloaded and extracted,

        cd ExtractCellsUsingPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractCellsUsingPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ExtractOutsideSurface/","title":"ExtractOutsideSurface","text":"

        vtk-examples/Cxx/PolyData/ExtractOutsideSurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ExtractOutsideSurface/#description","title":"Description","text":"

        This example extracts the outer surface of a multiple surface vtkPolyData model. The example assumes the outside surface is closed and there is only one outside surface. It also assumes that the center of the model lies inside the outer surface.

        The example casts a ray from outside the bounds of the model into the center of the model. It uses a vtkCellLocator to intersect the ray with the model. The intersected cell is used as a seed to the [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ConnectivityFilter which is run with the extraction mode set to CellSeededRegions.

        If run without arguments, the example generates a small (in area) sphere inside a large (in area) sphere. The inner sphere has more cells than the outer sphere, but should not be extracted.

        The gold model is the original vtkPolyData and the blue model is the outer surface.

        You can try your own surface by specifying a XML PolyData file (.vtp) on the command line.

        Seealso

        RemoveOutsideSurface removes the outside surface.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ExtractOutsideSurface/#code","title":"Code","text":"

        ExtractOutsideSurface.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCellLocator.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // PolyData to process\n  vtkSmartPointer<vtkPolyData> polyData;\n\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Small sphere with most polgons.\n    vtkNew<vtkSphereSource> sphereSource1;\n    sphereSource1->SetThetaResolution(10);\n    sphereSource1->SetPhiResolution(10);\n    sphereSource1->SetCenter(5, 5, 5);\n    sphereSource1->SetRadius(1.5);\n\n    // Large sphere with least polygons.\n    vtkNew<vtkSphereSource> sphereSource2;\n    sphereSource2->SetRadius(10);\n    sphereSource2->SetCenter(10, 1, 10);\n\n    vtkNew<vtkAppendPolyData> appendFilter;\n    appendFilter->AddInputConnection(sphereSource1->GetOutputPort());\n    appendFilter->AddInputConnection(sphereSource2->GetOutputPort());\n    appendFilter->Update();\n    polyData = appendFilter->GetOutput();\n  }\n\n  double center[3], bounds[6];\n  polyData->GetCenter(center);\n  std::cout << \"Center of data is: \" << center[0] << \", \" << center[1] << \", \"\n            << center[2] << std::endl;\n  polyData->GetPoints()->GetBounds(bounds);\n  std::cout << \"Bounds of data is: \" << bounds[0] << \", \" << bounds[1] << \", \"\n            << bounds[2] << \", \" << bounds[3] << \", \" << bounds[4] << \", \"\n            << bounds[5] << std::endl;\n\n  // Build a cell locator.\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(polyData);\n  cellLocator->BuildLocator();\n\n  // Now fire a ray from outside the bounds to the center and find a\n  // cell. This cell should be on the outside surface.\n  double rayStart[3];\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    rayStart[i] = bounds[2 * i + 1] * 1.1;\n  }\n\n  vtkIdType cellId = -1;\n  double xyz[3], t, pcoords[3];\n  int subId;\n\n  cellLocator->IntersectWithLine(rayStart, center, 0.0001, t, xyz, pcoords,\n                                 subId, cellId);\n  std::cout << \"Id of cell on outside surface: \" << cellId << std::endl;\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputData(polyData);\n  connectivityFilter->SetExtractionModeToCellSeededRegions();\n  connectivityFilter->InitializeSeedList();\n  connectivityFilter->AddSeed(cellId);\n\n  // Create a mapper and actor for original data.\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputData(polyData);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->BackfaceCullingOn();\n  originalActor->GetProperty()->SetOpacity(0.6);\n  originalActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a mapper and actor for extracted data.\n  vtkNew<vtkPolyDataMapper> extractedMapper;\n  extractedMapper->SetInputConnection(connectivityFilter->GetOutputPort());\n\n  vtkNew<vtkActor> extractedActor;\n  extractedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n  extractedActor->SetMapper(extractedMapper);\n  extractedActor->GetProperty()->SetOpacity(0.6);\n  extractedActor->GetProperty()->BackfaceCullingOn();\n\n  // Create a renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(originalActor);\n  renderer->AddActor(extractedActor);\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"Beige\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  extractedActor->SetPosition((bounds[1] - bounds[0]) / 1.9, 0, 0);\n  originalActor->SetPosition(-(bounds[1] - bounds[0]) / 1.9, 0, 0);\n\n  // Create a render window.\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(renderer);\n  renwin->SetSize(512, 512);\n  renwin->SetWindowName(\"ExtractOutsideSurface\");\n\n  // Create an interactor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n  renwin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ExtractOutsideSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractOutsideSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractOutsideSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractOutsideSurface MACOSX_BUNDLE ExtractOutsideSurface.cxx )\n  target_link_libraries(ExtractOutsideSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractOutsideSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ExtractOutsideSurface/#download-and-build-extractoutsidesurface","title":"Download and Build ExtractOutsideSurface","text":"

        Click here to download ExtractOutsideSurface and its CMakeLists.txt file. Once the tarball ExtractOutsideSurface.tar has been downloaded and extracted,

        cd ExtractOutsideSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractOutsideSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ExtractPolyLinesFromPolyData/","title":"ExtractPolyLinesFromPolyData","text":"

        vtk-examples/Cxx/PolyData/ExtractPolyLinesFromPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ExtractPolyLinesFromPolyData/#description","title":"Description","text":"

        This example uses vtkCutter to create contour lines. It processes these lines with vtkStripper to create continuous poly lines. After exiting the example with the \"e\" key, the lines are printed.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ExtractPolyLinesFromPolyData/#code","title":"Code","text":"

        ExtractPolyLinesFromPolyData.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkCutter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkStripper.h>\n\n#ifdef VTK_CELL_ARRAY_V2\n#include <vtkCellArrayIterator.h>\n#endif // VTK_CELL_ARRAY_V2\n\nint main(int, char*[])\n{\n  // Define colors for example.\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d lineColor = colors->GetColor3d(\"peacock\");\n  vtkColor3d modelColor = colors->GetColor3d(\"silver\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"wheat\");\n\n  vtkNew<vtkSphereSource> modelSource;\n\n  vtkNew<vtkPlane> plane;\n\n  vtkNew<vtkCutter> cutter;\n  cutter->SetInputConnection(modelSource->GetOutputPort());\n  cutter->SetCutFunction(plane);\n  cutter->GenerateValues(10, -0.5, 0.5);\n\n  vtkNew<vtkPolyDataMapper> modelMapper;\n  modelMapper->SetInputConnection(modelSource->GetOutputPort());\n\n  vtkNew<vtkActor> model;\n  model->SetMapper(modelMapper);\n  model->GetProperty()->SetDiffuseColor(modelColor.GetData());\n  model->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(cutter->GetOutputPort());\n  stripper->JoinContiguousSegmentsOn();\n\n  vtkNew<vtkPolyDataMapper> linesMapper;\n  linesMapper->SetInputConnection(stripper->GetOutputPort());\n\n  vtkNew<vtkActor> lines;\n  lines->SetMapper(linesMapper);\n  lines->GetProperty()->SetDiffuseColor(lineColor.GetData());\n  lines->GetProperty()->SetLineWidth(3.0);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ExtractPolyLinesFromPolyData\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer.\n  renderer->AddActor(model);\n  renderer->AddActor(lines);\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->GetActiveCamera()->Azimuth(-45);\n  renderer->GetActiveCamera()->Elevation(-22.5);\n  renderer->ResetCamera();\n\n  // This starts the event loop and as a side effect causes an initial\n  // render.\n  renderWindow->Render();\n\n  interactor->Start();\n\n  // Extract the lines from the polydata.\n  vtkIdType numberOfLines = cutter->GetOutput()->GetNumberOfLines();\n\n  std::cout << \"-----------Lines without using vtkStripper\" << std::endl;\n  std::cout << \"There are \" << numberOfLines << \" lines in the polydata\"\n            << std::endl;\n\n  numberOfLines = stripper->GetOutput()->GetNumberOfLines();\n  vtkPoints* points = stripper->GetOutput()->GetPoints();\n  vtkCellArray* cells = stripper->GetOutput()->GetLines();\n\n  std::cout << \"-----------Lines using vtkStripper\" << std::endl;\n  std::cout << \"There are \" << numberOfLines << \" lines in the polydata\"\n            << std::endl;\n\n#ifdef VTK_CELL_ARRAY_V2\n\n  // Newer versions of vtkCellArray prefer local iterators:\n  auto cellIter = vtk::TakeSmartPointer(cells->NewIterator());\n  for (cellIter->GoToFirstCell(); !cellIter->IsDoneWithTraversal();\n       cellIter->GoToNextCell())\n  {\n    std::cout << \"Line \" << cellIter->GetCurrentCellId() << \":\\n\";\n\n    vtkIdList* cell = cellIter->GetCurrentCell();\n    for (vtkIdType i = 0; i < cell->GetNumberOfIds(); ++i)\n    {\n      double point[3];\n      points->GetPoint(cell->GetId(i), point);\n      std::cout << \"\\t(\" << point[0] << \", \" << point[1] << \", \" << point[2]\n                << \")\" << std::endl;\n    }\n  }\n\n#else // VTK_CELL_ARRAY_V2\n\n  // Older implementations of vtkCellArray use internal iterator APIs (not\n  // thread safe):\n  vtkIdType* indices;\n  vtkIdType numberOfPoints;\n  unsigned int lineCount = 0;\n  for (cells->InitTraversal(); cells->GetNextCell(numberOfPoints, indices);\n       lineCount++)\n  {\n    std::cout << \"Line \" << lineCount << \": \" << std::endl;\n    for (vtkIdType i = 0; i < numberOfPoints; i++)\n    {\n      double point[3];\n      points->GetPoint(indices[i], point);\n      std::cout << \"\\t(\" << point[0] << \", \" << point[1] << \", \" << point[2]\n                << \")\" << std::endl;\n    }\n  }\n\n#endif // VTK_CELL_ARRAY_V2\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ExtractPolyLinesFromPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractPolyLinesFromPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractPolyLinesFromPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractPolyLinesFromPolyData MACOSX_BUNDLE ExtractPolyLinesFromPolyData.cxx )\n  target_link_libraries(ExtractPolyLinesFromPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractPolyLinesFromPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ExtractPolyLinesFromPolyData/#download-and-build-extractpolylinesfrompolydata","title":"Download and Build ExtractPolyLinesFromPolyData","text":"

        Click here to download ExtractPolyLinesFromPolyData and its CMakeLists.txt file. Once the tarball ExtractPolyLinesFromPolyData.tar has been downloaded and extracted,

        cd ExtractPolyLinesFromPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractPolyLinesFromPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ExtractSelection/","title":"ExtractSelection","text":"

        vtk-examples/Cxx/PolyData/ExtractSelection

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ExtractSelection/#description","title":"Description","text":"

        This example creates 50 random points and extracts 10 of them (the points with ids 10-19).

        Also demonstrated is how to invert the selection.

        The three actors in the render window display from left to right:

        • all the points
        • the selected points
        • the points not selected.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ExtractSelection/#code","title":"Code","text":"

        ExtractSelection.cxx

        #include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInformation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\n// #include <array>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // std::array<double, 4> bkgL = {{0.6, 0.5, 0.4, 1.0}};\n  // std::array<double, 4> bkgC = {{0.3, 0.1, 0.4, 1.0}};\n  // std::array<double, 4> bkgR = {{0.4, 0.5, 0.6, 1.0}};\n  // colors->SetColor(\"leftBkg\", bkgL.data());\n  // colors->SetColor(\"centreBkg\", bkgC.data());\n  // colors->SetColor(\"rightBkg\", bkgR.data());\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(50);\n  pointSource->Update();\n\n  std::cout << \"There are \" << pointSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  // Set values.\n  for (unsigned int i = 10; i < 20; i++)\n  {\n    ids->InsertNextValue(i);\n  }\n\n  vtkNew<vtkSelectionNode> selectionNode;\n  selectionNode->SetFieldType(vtkSelectionNode::POINT);\n  selectionNode->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode->SetSelectionList(ids);\n\n  vtkNew<vtkSelection> selection;\n  selection->AddNode(selectionNode);\n\n  vtkNew<vtkExtractSelection> extractSelection;\n  extractSelection->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelection->SetInputData(1, selection);\n  extractSelection->Update();\n\n  // In selection.\n  vtkNew<vtkUnstructuredGrid> selected;\n  selected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << selected->GetNumberOfPoints() << \" points and \";\n  std::cout << selected->GetNumberOfCells() << \" cells in the selection.\"\n            << std::endl;\n\n  // Get points that are NOT in the selection.\n  selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(),\n                                      1); // invert the selection\n  extractSelection->Update();\n\n  vtkNew<vtkUnstructuredGrid> notSelected;\n  notSelected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << notSelected->GetNumberOfPoints()\n            << \" points and \";\n  std::cout << notSelected->GetNumberOfCells() << \" cells NOT in the selection.\"\n            << std::endl;\n\n  vtkNew<vtkDataSetMapper> inputMapper;\n  inputMapper->SetInputConnection(pointSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  inputActor->GetProperty()->SetPointSize(5);\n\n  vtkNew<vtkDataSetMapper> selectedMapper;\n  selectedMapper->SetInputData(selected);\n\n  vtkNew<vtkActor> selectedActor;\n  selectedActor->SetMapper(selectedMapper);\n  selectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  selectedActor->GetProperty()->SetPointSize(5);\n\n  vtkNew<vtkDataSetMapper> notSelectedMapper;\n  notSelectedMapper->SetInputData(notSelected);\n\n  vtkNew<vtkActor> notSelectedActor;\n  notSelectedActor->SetMapper(notSelectedMapper);\n  notSelectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  notSelectedActor->GetProperty()->SetPointSize(5);\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->SetWindowName(\"ExtractSelection\");\n\n  // And one interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges (xmin, ymin, xmax, ymax).\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, .66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Create a camera for all renderers.\n  vtkNew<vtkCamera> camera;\n\n  // Setup the renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  leftRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"orchid_dark\").GetData());\n  centerRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->AddActor(inputActor);\n  centerRenderer->AddActor(selectedActor);\n  rightRenderer->AddActor(notSelectedActor);\n\n  leftRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ExtractSelection/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractSelection)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractSelection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractSelection MACOSX_BUNDLE ExtractSelection.cxx )\n  target_link_libraries(ExtractSelection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractSelection\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ExtractSelection/#download-and-build-extractselection","title":"Download and Build ExtractSelection","text":"

        Click here to download ExtractSelection and its CMakeLists.txt file. Once the tarball ExtractSelection.tar has been downloaded and extracted,

        cd ExtractSelection/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractSelection\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ExtractSelectionCells/","title":"ExtractSelectionCells","text":"

        vtk-examples/Cxx/PolyData/ExtractSelectionCells

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ExtractSelectionCells/#code","title":"Code","text":"

        ExtractSelectionCells.cxx

        #include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n#include <vtkInformation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n\n// #include <array>\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // std::array<double, 4> bkgL = {{0.6, 0.5, 0.4, 1.0}};\n  // std::array<double, 4> bkgC = {{0.3, 0.1, 0.4, 1.0}};\n  // std::array<double, 4> bkgR = {{0.4, 0.5, 0.6, 1.0}};\n  // colors->SetColor(\"leftBkg\", bkgL.data());\n  // colors->SetColor(\"centreBkg\", bkgC.data());\n  // colors->SetColor(\"rightBkg\", bkgR.data());\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfCells()\n            << \" input cells.\" << std::endl;\n\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  // Specify that we want to extract cells 10 through 19.\n  for (unsigned int i = 10; i < 20; i++)\n  {\n    ids->InsertNextValue(i);\n  }\n\n  vtkNew<vtkSelectionNode> selectionNode;\n  selectionNode->SetFieldType(vtkSelectionNode::CELL);\n  selectionNode->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode->SetSelectionList(ids);\n\n  vtkNew<vtkSelection> selection;\n  selection->AddNode(selectionNode);\n\n  vtkNew<vtkExtractSelection> extractSelection;\n  extractSelection->SetInputConnection(0, sphereSource->GetOutputPort());\n  extractSelection->SetInputData(1, selection);\n  extractSelection->Update();\n\n  // In selection.\n  vtkNew<vtkUnstructuredGrid> selected;\n  selected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << selected->GetNumberOfPoints()\n            << \" points in the selection.\" << std::endl;\n  std::cout << \"There are \" << selected->GetNumberOfCells()\n            << \" cells in the selection.\" << std::endl;\n\n  // Get points that are NOT in the selection.\n  selectionNode->GetProperties()->Set(vtkSelectionNode::INVERSE(),\n                                      1); // invert the selection\n  extractSelection->Update();\n\n  vtkNew<vtkUnstructuredGrid> notSelected;\n  notSelected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << notSelected->GetNumberOfPoints()\n            << \" points NOT in the selection.\" << std::endl;\n  std::cout << \"There are \" << notSelected->GetNumberOfCells()\n            << \" cells NOT in the selection.\" << std::endl;\n\n  vtkNew<vtkProperty> backfaces;\n  backfaces->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkDataSetMapper> inputMapper;\n  inputMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  inputActor->SetBackfaceProperty(backfaces);\n\n  vtkNew<vtkDataSetMapper> selectedMapper;\n  selectedMapper->SetInputData(selected);\n\n  vtkNew<vtkActor> selectedActor;\n  selectedActor->SetMapper(selectedMapper);\n  selectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  selectedActor->SetBackfaceProperty(backfaces);\n\n  vtkNew<vtkDataSetMapper> notSelectedMapper;\n  notSelectedMapper->SetInputData(notSelected);\n\n  vtkNew<vtkActor> notSelectedActor;\n  notSelectedActor->SetMapper(notSelectedMapper);\n  notSelectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  notSelectedActor->SetBackfaceProperty(backfaces);\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(900, 300);\n  renderWindow->SetWindowName(\"ExtractSelectionCells\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, .66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Create a camera for all renderers.\n  vtkNew<vtkCamera> camera;\n\n  // Setup the renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  leftRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"orchid_dark\").GetData());\n  centerRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->AddActor(inputActor);\n  centerRenderer->AddActor(selectedActor);\n  rightRenderer->AddActor(notSelectedActor);\n\n  leftRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ExtractSelectionCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractSelectionCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractSelectionCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractSelectionCells MACOSX_BUNDLE ExtractSelectionCells.cxx )\n  target_link_libraries(ExtractSelectionCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractSelectionCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ExtractSelectionCells/#download-and-build-extractselectioncells","title":"Download and Build ExtractSelectionCells","text":"

        Click here to download ExtractSelectionCells and its CMakeLists.txt file. Once the tarball ExtractSelectionCells.tar has been downloaded and extracted,

        cd ExtractSelectionCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractSelectionCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ExtractSelectionOriginalId/","title":"ExtractSelectionOriginalId","text":"

        vtk-examples/Cxx/PolyData/ExtractSelectionOriginalId

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ExtractSelectionOriginalId/#code","title":"Code","text":"

        ExtractSelectionOriginalId.cxx

        #include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(50);\n  pointSource->Update();\n\n  std::cout << \"There are \" << pointSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  // set values\n  for (unsigned int i = 10; i < 20; i++)\n  {\n    ids->InsertNextValue(i);\n  }\n\n  vtkNew<vtkSelectionNode> selectionNode;\n  selectionNode->SetFieldType(vtkSelectionNode::POINT);\n  selectionNode->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode->SetSelectionList(ids);\n\n  vtkNew<vtkSelection> selection;\n  selection->AddNode(selectionNode);\n\n  vtkNew<vtkExtractSelection> extractSelection;\n\n  extractSelection->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelection->SetInputData(1, selection);\n  extractSelection->Update();\n\n  // in selection\n  vtkNew<vtkUnstructuredGrid> selected;\n  selected->ShallowCopy(extractSelection->GetOutput());\n\n  std::cout << \"There are \" << selected->GetNumberOfPoints()\n            << \" points in the selection.\" << std::endl;\n\n  selected->Print(std::cout);\n\n  vtkIdTypeArray* originalIds = dynamic_cast<vtkIdTypeArray*>(\n      selected->GetPointData()->GetArray(\"vtkOriginalPointIds\"));\n\n  for (vtkIdType i = 0; i < originalIds->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Point \" << i << \" was originally point \"\n              << originalIds->GetValue(i) << std::endl;\n  }\n\n  for (vtkIdType i = 0; i < originalIds->GetNumberOfTuples(); i++)\n  {\n    vtkIdType query = originalIds->GetValue(i);\n    for (vtkIdType j = 0; j < originalIds->GetNumberOfTuples(); j++)\n    {\n      if (originalIds->GetValue(j) == query)\n      {\n        std::cout << \"Original point \" << query << \" is now \" << j << std::endl;\n      }\n    }\n  }\n\n  vtkNew<vtkDataSetMapper> inputMapper;\n  inputMapper->SetInputConnection(pointSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  inputActor->GetProperty()->SetPointSize(5);\n\n  vtkNew<vtkDataSetMapper> selectedMapper;\n  selectedMapper->SetInputData(selected);\n\n  vtkNew<vtkActor> selectedActor;\n  selectedActor->SetMapper(selectedMapper);\n  selectedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  selectedActor->GetProperty()->SetPointSize(5);\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"ExtractSelectionOriginalId\");\n\n  // And one interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Create a camera for all renderers.\n  vtkNew<vtkCamera> camera;\n\n  // Setup the renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n  leftRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(selectedActor);\n\n  leftRenderer->ResetCamera();\n  // rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ExtractSelectionOriginalId/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractSelectionOriginalId)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractSelectionOriginalId: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractSelectionOriginalId MACOSX_BUNDLE ExtractSelectionOriginalId.cxx )\n  target_link_libraries(ExtractSelectionOriginalId PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractSelectionOriginalId\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ExtractSelectionOriginalId/#download-and-build-extractselectionoriginalid","title":"Download and Build ExtractSelectionOriginalId","text":"

        Click here to download ExtractSelectionOriginalId and its CMakeLists.txt file. Once the tarball ExtractSelectionOriginalId.tar has been downloaded and extracted,

        cd ExtractSelectionOriginalId/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractSelectionOriginalId\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/FieldData/","title":"FieldData","text":"

        vtk-examples/Cxx/PolyData/FieldData

        "},{"location":"Cxx/PolyData/FieldData/#description","title":"Description","text":"

        Three types of data can be stored in a vtkPolyData object - PointData, CellData, and FieldData. For PointData, there must be a piece of data associated with each point (e.g. a temperature data array with the temperature at each point). For CellData, there must be a piece of data associated with each cell (e.g. the area of each triangle). For data that does not align with either points or cells, FieldData should be used. This is typically data that describes the dataset as a whole. An example could be the name of the dataset, or the center of mass of the points, etc.

        This demo adds general data to a polydata (not at each point or cell). In this example, the center of mass of the data is stored.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/FieldData/#code","title":"Code","text":"

        FieldData.cxx

        #include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> source;\n  source->Update();\n\n  // Extract the polydata.\n  vtkNew<vtkPolyData> polydata;\n  polydata->ShallowCopy(source->GetOutput());\n\n  vtkNew<vtkDoubleArray> location;\n\n  // Create the data to store (here we just use (0,0,0)).\n  double locationValue[3] = {0, 0, 0};\n\n  location->SetNumberOfComponents(3);\n  location->SetName(\"MyDoubleArray\");\n  location->InsertNextTuple(locationValue);\n  // The data is added to FIELD data (rather than POINT data as usual).\n  polydata->GetFieldData()->AddArray(location);\n\n  vtkNew<vtkIntArray> intValue;\n  intValue->SetNumberOfComponents(1);\n  intValue->SetName(\"MyIntValue\");\n  intValue->InsertNextValue(5);\n\n  polydata->GetFieldData()->AddArray(intValue);\n\n  // Get the data back out\n  auto retrievedArray = dynamic_cast<vtkIntArray*>(\n      polydata->GetFieldData()->GetAbstractArray(\"MyIntValue\"));\n\n  std::cout << retrievedArray->GetValue(0) << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/FieldData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FieldData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FieldData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FieldData MACOSX_BUNDLE FieldData.cxx )\n  target_link_libraries(FieldData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FieldData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/FieldData/#download-and-build-fielddata","title":"Download and Build FieldData","text":"

        Click here to download FieldData and its CMakeLists.txt file. Once the tarball FieldData.tar has been downloaded and extracted,

        cd FieldData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FieldData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/FitSplineToCutterOutput/","title":"FitSplineToCutterOutput","text":"

        vtk-examples/Cxx/PolyData/FitSplineToCutterOutput

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/FitSplineToCutterOutput/#description","title":"Description","text":"

        This examples cuts a vtkPolydata and fits a vtkKochanekSpline to the resulting polylines. The cut lines are passed through vtkStripper to make them into connected polylines. Then, the lines are passed through vtkTubeFilter to improve the visualization.

        The examples takes an optional argument that specifies a vtk polydata file (.vtp). If run without an argument, it processes a sphere.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/FitSplineToCutterOutput/#code","title":"Code","text":"

        FitSplineToCutterOutput.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkCutter.h>\n#include <vtkKochanekSpline.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSplineFilter.h>\n#include <vtkStripper.h>\n#include <vtkTubeFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\n#ifdef VTK_CELL_ARRAY_V2\n#include <vtkCellArrayIterator.h>\n#endif // VTK_CELL_ARRAY_V2\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> modelSource;\n    modelSource->Update();\n    polyData = modelSource->GetOutput();\n  }\n\n  double length = polyData->GetLength();\n\n  vtkNew<vtkPlane> plane;\n  plane->SetNormal(0, 1, 1);\n  plane->SetOrigin(polyData->GetCenter());\n\n  vtkNew<vtkCutter> cutter;\n  cutter->SetInputData(polyData);\n  cutter->SetCutFunction(plane);\n  cutter->GenerateValues(1, 0.0, 0.0);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> modelMapper;\n  modelMapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> model;\n  model->SetMapper(modelMapper);\n  model->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  model->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(cutter->GetOutputPort());\n\n  vtkNew<vtkKochanekSpline> spline;\n  spline->SetDefaultTension(.5);\n\n  vtkNew<vtkSplineFilter> sf;\n  sf->SetInputConnection(stripper->GetOutputPort());\n  sf->SetSubdivideToSpecified();\n  sf->SetNumberOfSubdivisions(50);\n  sf->SetSpline(spline);\n  sf->GetSpline()->ClosedOn();\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(sf->GetOutputPort());\n  tubes->SetNumberOfSides(8);\n  tubes->SetRadius(length / 100.0);\n\n  vtkNew<vtkPolyDataMapper> linesMapper;\n  linesMapper->SetInputConnection(tubes->GetOutputPort());\n  linesMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> lines;\n  lines->SetMapper(linesMapper);\n  lines->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer.\n  renderer->AddActor(model);\n  renderer->AddActor(lines);\n\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->GetActiveCamera()->Azimuth(300);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"FitSplineToCutterOutput\");\n\n  // This starts the event loop and as a side effect causes an initial\n  // render.\n  renderWindow->Render();\n  interactor->Start();\n\n  // Extract the lines from the polydata.\n  vtkIdType numberOfLines = cutter->GetOutput()->GetNumberOfLines();\n\n  std::cout << \"-----------Lines without using vtkStripper\" << std::endl;\n  if (numberOfLines == 1)\n  {\n    std::cout << \"There is \" << numberOfLines << \" line in the polydata\"\n              << std::endl;\n  }\n  else\n  {\n    std::cout << \"There are \" << numberOfLines << \" lines in the polydata\"\n              << std::endl;\n  }\n  numberOfLines = stripper->GetOutput()->GetNumberOfLines();\n  vtkPoints* points = stripper->GetOutput()->GetPoints();\n  vtkCellArray* cells = stripper->GetOutput()->GetLines();\n\n  std::cout << \"-----------Lines using vtkStripper\" << std::endl;\n  if (numberOfLines == 1)\n  {\n    std::cout << \"There is \" << numberOfLines << \" line in the polydata\"\n              << std::endl;\n  }\n  else\n  {\n\n    std::cout << \"There are \" << numberOfLines << \" lines in the polydata\"\n              << std::endl;\n  }\n\n#ifdef VTK_CELL_ARRAY_V2\n\n  // Newer versions of vtkCellArray prefer local iterators:\n  auto cellIter = vtk::TakeSmartPointer(cells->NewIterator());\n  for (cellIter->GoToFirstCell(); !cellIter->IsDoneWithTraversal();\n       cellIter->GoToNextCell())\n  {\n    std::cout << \"Line \" << cellIter->GetCurrentCellId() << \":\\n\";\n\n    vtkIdList* cell = cellIter->GetCurrentCell();\n    for (vtkIdType i = 0; i < cell->GetNumberOfIds(); ++i)\n    {\n      double point[3];\n      points->GetPoint(cell->GetId(i), point);\n      std::cout << \"\\t(\" << point[0] << \", \" << point[1] << \", \" << point[2]\n                << \")\" << std::endl;\n    }\n  }\n\n#else // VTK_CELL_ARRAY_V2\n\n  // Older implementations of vtkCellArray use internal iterator APIs (not\n  // thread safe):\n  vtkIdType* indices;\n  vtkIdType numberOfPoints;\n  unsigned int lineCount = 0;\n  for (cells->InitTraversal(); cells->GetNextCell(numberOfPoints, indices);\n       lineCount++)\n  {\n    std::cout << \"Line \" << lineCount << \": \" << std::endl;\n    for (vtkIdType i = 0; i < numberOfPoints; i++)\n    {\n      double point[3];\n      points->GetPoint(indices[i], point);\n      std::cout << \"\\t(\" << point[0] << \", \" << point[1] << \", \" << point[2]\n                << \")\" << std::endl;\n    }\n  }\n\n#endif // VTK_CELL_ARRAY_V2\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/FitSplineToCutterOutput/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FitSplineToCutterOutput)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FitSplineToCutterOutput: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FitSplineToCutterOutput MACOSX_BUNDLE FitSplineToCutterOutput.cxx )\n  target_link_libraries(FitSplineToCutterOutput PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FitSplineToCutterOutput\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/FitSplineToCutterOutput/#download-and-build-fitsplinetocutteroutput","title":"Download and Build FitSplineToCutterOutput","text":"

        Click here to download FitSplineToCutterOutput and its CMakeLists.txt file. Once the tarball FitSplineToCutterOutput.tar has been downloaded and extracted,

        cd FitSplineToCutterOutput/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FitSplineToCutterOutput\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/GeometryFilter/","title":"GeometryFilter","text":"

        vtk-examples/Cxx/PolyData/GeometryFilter

        "},{"location":"Cxx/PolyData/GeometryFilter/#description","title":"Description","text":"

        This example demonstrates how to convert an unstructured grid to a polydata. Currently nothing is done with the resulting polydata.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/GeometryFilter/#code","title":"Code","text":"

        GeometryFilter.cxx

        #include <vtkGeometryFilter.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n#include <vtkVertex.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid> MakeUnstructuredGrid(vtkSmartPointer<T>);\n}\n\nint main(int argc, char* argv[])\n{\n  auto geometryFilter = vtkSmartPointer<vtkGeometryFilter>::New();\n  if (argc < 2)\n  {\n    // std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtk) e.g. uGridEx.vtk \"\n    //          << std::endl;\n    auto unstructuredGrid =\n        MakeUnstructuredGrid(vtkSmartPointer<vtkVertex>::New());\n    geometryFilter->SetInputData(unstructuredGrid);\n  }\n  else\n  {\n    // Create the reader for the data.\n    // This is the data that will be rendered.\n    std::string filename = argv[1];\n    std::cout << \"Loading \" << filename.c_str() << std::endl;\n    vtkNew<vtkUnstructuredGridReader> reader;\n    reader->SetFileName(filename.c_str());\n    geometryFilter->SetInputConnection(reader->GetOutputPort());\n  }\n\n  geometryFilter->Update();\n\n  vtkPolyData* polydata = geometryFilter->GetOutput();\n\n  std::cout << \"Output has \" << polydata->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\ntemplate <typename T>\nvtkSmartPointer<vtkUnstructuredGrid>\nMakeUnstructuredGrid(vtkSmartPointer<T> aCell)\n{\n  double* pcoords = aCell->GetParametricCoords();\n  for (int i = 0; i < aCell->GetNumberOfPoints(); ++i)\n  {\n    aCell->GetPointIds()->SetId(i, i);\n    aCell->GetPoints()->SetPoint(i, *(pcoords + 3 * i), *(pcoords + 3 * i + 1),\n                                 *(pcoords + 3 * i + 2));\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(aCell->GetPoints());\n  ug->InsertNextCell(aCell->GetCellType(), aCell->GetPointIds());\n  return ug;\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/GeometryFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GeometryFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  IOLegacy\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GeometryFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GeometryFilter MACOSX_BUNDLE GeometryFilter.cxx )\n  target_link_libraries(GeometryFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GeometryFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/GeometryFilter/#download-and-build-geometryfilter","title":"Download and Build GeometryFilter","text":"

        Click here to download GeometryFilter and its CMakeLists.txt file. Once the tarball GeometryFilter.tar has been downloaded and extracted,

        cd GeometryFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GeometryFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/GetMiscCellData/","title":"GetMiscCellData","text":"

        vtk-examples/Cxx/PolyData/GetMiscCellData

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/GetMiscCellData/#code","title":"Code","text":"

        GetMiscCellData.cxx

        #include <vtkCellData.h>\n#include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 3)\n  {\n    std::cout << \"Required arguments: Filename ArrayName e.g. SuperQuadric.vtp \"\n                 \"Normals\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Get filename from command line.\n  std::string filename = argv[1]; // First command line argument.\n\n  // Get array name\n  std::string arrayName = argv[2]; // Second command line argument.\n\n  // Read the file.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  auto polydata = reader->GetOutput();\n\n  // Get the number of cells in the polydata.\n  vtkIdType idNumCellsInFile = polydata->GetNumberOfCells();\n\n  auto array = dynamic_cast<vtkFloatArray*>(\n      polydata->GetCellData()->GetArray(arrayName.c_str()));\n\n  if (array)\n  {\n    std::cout << \"Got array \" << arrayName << \" with \" << idNumCellsInFile\n              << \" values\" << std::endl;\n    for (int i = 0; i < idNumCellsInFile; i++)\n    {\n      // Since there could be a lot of cells just print the first 10\n      if (i < 10 || i == idNumCellsInFile - 1)\n      {\n        double value;\n        value = array->GetValue(i);\n        std::cout << i << \": \" << value << std::endl;\n      }\n      else\n      {\n        if (i == 10)\n          std::cout << \"...\" << std::endl;\n      }\n    }\n  }\n  else\n  {\n    std::cout << \"The file \" << filename\n              << \" does not have a CellData array named \" << arrayName\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/GetMiscCellData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetMiscCellData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetMiscCellData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetMiscCellData MACOSX_BUNDLE GetMiscCellData.cxx )\n  target_link_libraries(GetMiscCellData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetMiscCellData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/GetMiscCellData/#download-and-build-getmisccelldata","title":"Download and Build GetMiscCellData","text":"

        Click here to download GetMiscCellData and its CMakeLists.txt file. Once the tarball GetMiscCellData.tar has been downloaded and extracted,

        cd GetMiscCellData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GetMiscCellData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/GetMiscPointData/","title":"GetMiscPointData","text":"

        vtk-examples/Cxx/PolyData/GetMiscPointData

        "},{"location":"Cxx/PolyData/GetMiscPointData/#description","title":"Description","text":"

        This example demonstrates how to get data stored at each point in a polydata.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/GetMiscPointData/#code","title":"Code","text":"

        GetMiscPointData.cxx

        #include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 3)\n  {\n    std::cout << \"Required arguments: Filename ArrayName e.g. cowHead.vtp \"\n                 \"Gauss_Curvature\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Get filename from command line.\n  std::string filename = argv[1]; // First command line argument.\n\n  // Get array name.\n  std::string arrayName = argv[2]; // Second command line argument.\n\n  // Read the file.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  std::cout << \"Reading \" << filename << std::endl;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Extract the polydata.\n  auto polydata = reader->GetOutput();\n\n  // Get the number of points in the polydata.\n  vtkIdType idNumPointsInFile = polydata->GetNumberOfPoints();\n\n  auto array = dynamic_cast<vtkDoubleArray*>(\n      polydata->GetPointData()->GetArray(arrayName.c_str()));\n\n  if (array)\n  {\n    std::cout << \"Got array \" << arrayName << \" with \" << idNumPointsInFile\n              << \" values\" << std::endl;\n    for (int i = 0; i < idNumPointsInFile; i++)\n    {\n      // Since there could be a lot of points just print the first 10\n      if (i < 10 || i == idNumPointsInFile - 1)\n      {\n        double value;\n        value = array->GetValue(i);\n        std::cout << i << \": \" << value << std::endl;\n      }\n      else\n      {\n        if (i == 10)\n          std::cout << \"...\" << std::endl;\n      }\n    }\n  }\n  else\n  {\n    std::cout << \"The file \" << filename\n              << \" does not have a PointData array named \" << arrayName\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/GetMiscPointData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetMiscPointData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetMiscPointData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetMiscPointData MACOSX_BUNDLE GetMiscPointData.cxx )\n  target_link_libraries(GetMiscPointData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetMiscPointData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/GetMiscPointData/#download-and-build-getmiscpointdata","title":"Download and Build GetMiscPointData","text":"

        Click here to download GetMiscPointData and its CMakeLists.txt file. Once the tarball GetMiscPointData.tar has been downloaded and extracted,

        cd GetMiscPointData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GetMiscPointData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/GradientFilter/","title":"GradientFilter","text":"

        vtk-examples/Cxx/PolyData/GradientFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/GradientFilter/#description","title":"Description","text":"

        Computes the gradient of a scalar field defined on the points of a data set.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/GradientFilter/#code","title":"Code","text":"

        GradientFilter.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkAssignAttribute.h>\n#include <vtkCamera.h>\n#include <vtkExtractEdges.h>\n#include <vtkGlyph3D.h>\n#include <vtkGradientFilter.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGridReader.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtk) e.g. uGridEx.vtk \"\n              << std::endl;\n  }\n  // Create the reader for the data.\n  // This is the data that will be rendered.\n  std::string filename = argv[1];\n  std::cout << \"Loading \" << filename.c_str() << std::endl;\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n\n  vtkNew<vtkExtractEdges> edges;\n  edges->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(edges->GetOutputPort());\n  tubes->SetRadius(0.0625);\n  tubes->SetVaryRadiusToVaryRadiusOff();\n  tubes->SetNumberOfSides(32);\n\n  vtkNew<vtkPolyDataMapper> tubesMapper;\n  tubesMapper->SetInputConnection(tubes->GetOutputPort());\n  tubesMapper->SetScalarRange(0.0, 26.0);\n\n  vtkNew<vtkActor> tubesActor;\n  tubesActor->SetMapper(tubesMapper);\n\n  vtkNew<vtkGradientFilter> gradients;\n  gradients->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkAssignAttribute> vectors;\n  vectors->SetInputConnection(gradients->GetOutputPort());\n  vectors->Assign(\"Gradients\", vtkDataSetAttributes::VECTORS,\n                  vtkAssignAttribute::POINT_DATA);\n\n  vtkNew<vtkArrowSource> arrow;\n\n  vtkNew<vtkGlyph3D> glyphs;\n  glyphs->SetInputConnection(0, vectors->GetOutputPort());\n  glyphs->SetInputConnection(1, arrow->GetOutputPort());\n  glyphs->ScalingOn();\n  glyphs->SetScaleModeToScaleByVector();\n  glyphs->SetScaleFactor(0.25);\n  glyphs->OrientOn();\n  glyphs->ClampingOff();\n  glyphs->SetVectorModeToUseVector();\n  glyphs->SetIndexModeToOff();\n\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyphs->GetOutputPort());\n  glyphMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyphMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(tubesActor);\n  renderer->AddActor(glyphActor);\n  renderer->SetBackground(0.328125, 0.347656, 0.425781);\n\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(renderer);\n  renwin->SetSize(350, 500);\n  renwin->SetWindowName(\"GradientFilter\");\n\n  renderer->ResetCamera();\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->Elevation(-80.0);\n  camera->OrthogonalizeViewUp();\n  camera->Azimuth(135.0);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n  renwin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/GradientFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GradientFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GradientFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GradientFilter MACOSX_BUNDLE GradientFilter.cxx )\n  target_link_libraries(GradientFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GradientFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/GradientFilter/#download-and-build-gradientfilter","title":"Download and Build GradientFilter","text":"

        Click here to download GradientFilter and its CMakeLists.txt file. Once the tarball GradientFilter.tar has been downloaded and extracted,

        cd GradientFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GradientFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/GreedyTerrainDecimation/","title":"GreedyTerrainDecimation","text":"

        vtk-examples/Cxx/PolyData/GreedyTerrainDecimation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/GreedyTerrainDecimation/#code","title":"Code","text":"

        GreedyTerrainDecimation.cxx

        #include <vtkActor.h>\n#include <vtkGreedyTerrainDecimation.h>\n#include <vtkImageData.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageData> image;\n  image->SetDimensions(3, 3, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n\n  int dims[3];\n  image->GetDimensions(dims);\n  for (int i = 0; i < dims[0]; i++)\n  {\n    for (int j = 0; j < dims[1]; j++)\n    {\n      auto pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(i, j, 0));\n      // pixel[0] = vtkMath::Round(vtkMath::Random(0, 255));\n      pixel[0] = vtkMath::Round(randomSequence->GetRangeValue(0.0, 5.0));\n      randomSequence->Next();\n    }\n  }\n\n  vtkNew<vtkGreedyTerrainDecimation> decimation;\n  decimation->SetInputData(image);\n  decimation->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(decimation->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Red\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"GreedyTerrainDecimation\");\n\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/GreedyTerrainDecimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GreedyTerrainDecimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GreedyTerrainDecimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GreedyTerrainDecimation MACOSX_BUNDLE GreedyTerrainDecimation.cxx )\n  target_link_libraries(GreedyTerrainDecimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GreedyTerrainDecimation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/GreedyTerrainDecimation/#download-and-build-greedyterraindecimation","title":"Download and Build GreedyTerrainDecimation","text":"

        Click here to download GreedyTerrainDecimation and its CMakeLists.txt file. Once the tarball GreedyTerrainDecimation.tar has been downloaded and extracted,

        cd GreedyTerrainDecimation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GreedyTerrainDecimation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/HighlightBadCells/","title":"HighlightBadCells","text":"

        vtk-examples/Cxx/PolyData/HighlightBadCells

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/HighlightBadCells/#code","title":"Code","text":"

        HighlightBadCells.cxx

        #include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkDataSet.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkMeshQuality.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkThreshold.h>\n#include <vtkTriangleFilter.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(sphereSource->GetOutputPort());\n  triangleFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> sphereMapper;\n  sphereMapper->SetInputConnection(triangleFilter->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkPolyData* mesh = triangleFilter->GetOutput();\n  cout << \"There are \" << mesh->GetNumberOfCells() << \" cells.\" << endl;\n\n  vtkNew<vtkMeshQuality> qualityFilter;\n  qualityFilter->SetInputData(mesh);\n  qualityFilter->SetTriangleQualityMeasureToArea();\n  qualityFilter->Update();\n\n  vtkDataSet* qualityMesh = qualityFilter->GetOutput();\n  auto qualityArray = dynamic_cast<vtkDoubleArray*>(\n      qualityMesh->GetCellData()->GetArray(\"Quality\"));\n\n  cout << \"There are \" << qualityArray->GetNumberOfTuples() << \" values.\"\n       << endl;\n\n  for (vtkIdType i = 0; i < qualityArray->GetNumberOfTuples(); i++)\n  {\n    double val = qualityArray->GetValue(i);\n    cout << \"value \" << i << \" : \" << val << endl;\n  }\n\n  vtkNew<vtkThreshold> selectCells;\n  // selectCells->ThresholdByLower(.02);\n  selectCells->SetLowerThreshold(0.02);\n  selectCells->SetThresholdFunction(vtkThreshold::THRESHOLD_LOWER);\n  selectCells->SetInputArrayToProcess(0, 0, 0,\n                                      vtkDataObject::FIELD_ASSOCIATION_CELLS,\n                                      vtkDataSetAttributes::SCALARS);\n  selectCells->SetInputData(qualityMesh);\n  selectCells->Update();\n\n  vtkUnstructuredGrid* ug = selectCells->GetOutput();\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(ug);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n  actor->GetProperty()->SetLineWidth(5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HighlightBadCells\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/HighlightBadCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HighlightBadCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  FiltersVerdict\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HighlightBadCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HighlightBadCells MACOSX_BUNDLE HighlightBadCells.cxx )\n  target_link_libraries(HighlightBadCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HighlightBadCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/HighlightBadCells/#download-and-build-highlightbadcells","title":"Download and Build HighlightBadCells","text":"

        Click here to download HighlightBadCells and its CMakeLists.txt file. Once the tarball HighlightBadCells.tar has been downloaded and extracted,

        cd HighlightBadCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HighlightBadCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ImplicitDataSetClipping/","title":"ImplicitDataSetClipping","text":"

        vtk-examples/Cxx/PolyData/ImplicitDataSetClipping

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ImplicitDataSetClipping/#description","title":"Description","text":"

        This example demonstrates how to clip one object with another.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ImplicitDataSetClipping/#code","title":"Code","text":"

        ImplicitDataSetClipping.cxx

        #include <vtkActor.h>\n#include <vtkBox.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkClipPolyData.h>\n#include <vtkCubeSource.h>\n#include <vtkDataSetWriter.h>\n#include <vtkIdFilter.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid WritePolyData(vtkPolyData* const polyData, const std::string& filename);\n\nvoid WriteDataSet(vtkDataSet* const dataSet, const std::string& filename);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // colors->SetColor(\"Bkg\", 0.2, 0.3, 0.4);\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(.75, 0, 0);\n\n  unsigned int res = 10;\n  sphereSource->SetThetaResolution(res);\n  sphereSource->SetPhiResolution(res);\n  sphereSource->Update();\n\n  std::cout << \"The sphere has \"\n            << sphereSource->GetOutput()->GetNumberOfPoints() << \" points.\"\n            << \" and \" << sphereSource->GetOutput()->GetNumberOfCells()\n            << \" cells. \" << std::endl;\n\n  // Add ids to the points and cells of the sphere.\n  vtkNew<vtkIdFilter> cellIdFilter;\n  cellIdFilter->SetInputConnection(sphereSource->GetOutputPort());\n  cellIdFilter->SetCellIds(true);\n  cellIdFilter->SetPointIds(false);\n#if VTK890\n  cellIdFilter->SetCellIdsArrayName(\"CellIds\");\n#else\n  cellIdFilter->SetIdsArrayName(\"CellIds\");\n#endif\n  cellIdFilter->Update();\n\n  WriteDataSet(cellIdFilter->GetOutput(), \"CellIdFilter.vtp\");\n\n  vtkNew<vtkIdFilter> pointIdFilter;\n  pointIdFilter->SetInputConnection(cellIdFilter->GetOutputPort());\n  pointIdFilter->SetCellIds(false);\n  pointIdFilter->SetPointIds(true);\n#if VTK890\n  pointIdFilter->SetPointIdsArrayName(\"PointIds\");\n#else\n  pointIdFilter->SetIdsArrayName(\"PointIds\");\n#endif\n  pointIdFilter->Update();\n\n  vtkDataSet* sphereWithIds = pointIdFilter->GetOutput();\n\n  WriteDataSet(sphereWithIds, \"BothIdFilter.vtp\");\n\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  vtkNew<vtkBox> implicitCube;\n  implicitCube->SetBounds(cubeSource->GetOutput()->GetBounds());\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetClipFunction(implicitCube);\n  clipper->SetInputData(sphereWithIds);\n  clipper->InsideOutOn();\n  clipper->Update();\n\n  WriteDataSet(clipper->GetOutput(), \"clipper.vtp\");\n\n  // Get the clipped cell ids.\n  vtkPolyData* clipped = clipper->GetOutput();\n\n  std::cout << \"There are \" << clipped->GetNumberOfPoints()\n            << \" clipped points.\" << std::endl;\n  std::cout << \"There are \" << clipped->GetNumberOfCells() << \" clipped cells.\"\n            << std::endl;\n\n  vtkIdTypeArray* clippedCellIds = dynamic_cast<vtkIdTypeArray*>(\n      clipped->GetCellData()->GetArray(\"CellIds\"));\n\n  for (vtkIdType i = 0; i < clippedCellIds->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Clipped cell id \" << i << \" : \" << clippedCellIds->GetValue(i)\n              << std::endl;\n  }\n\n  // Create a mapper and actor for clipped sphere.\n  vtkNew<vtkPolyDataMapper> clippedMapper;\n  clippedMapper->SetInputConnection(clipper->GetOutputPort());\n  clippedMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clippedActor;\n  clippedActor->SetMapper(clippedMapper);\n  clippedActor->GetProperty()->SetRepresentationToWireframe();\n  clippedActor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // Create a mapper and actor for cube.\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetRepresentationToWireframe();\n  cubeActor->GetProperty()->SetOpacity(0.5);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitDataSetClipping\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(clippedActor);\n  renderer->AddActor(cubeActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Generate an interesting view.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid WritePolyData(vtkPolyData* const polyData, const std::string& filename)\n{\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetInputData(polyData);\n  writer->SetFileName(filename.c_str());\n  writer->Write();\n}\n\nvoid WriteDataSet(vtkDataSet* const dataSet, const std::string& filename)\n{\n  vtkNew<vtkDataSetWriter> writer;\n  writer->SetInputData(dataSet);\n  writer->SetFileName(filename.c_str());\n  writer->Write();\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/ImplicitDataSetClipping/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitDataSetClipping)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOLegacy\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitDataSetClipping: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitDataSetClipping MACOSX_BUNDLE ImplicitDataSetClipping.cxx )\n  target_link_libraries(ImplicitDataSetClipping PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitDataSetClipping\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ImplicitDataSetClipping/#download-and-build-implicitdatasetclipping","title":"Download and Build ImplicitDataSetClipping","text":"

        Click here to download ImplicitDataSetClipping and its CMakeLists.txt file. Once the tarball ImplicitDataSetClipping.tar has been downloaded and extracted,

        cd ImplicitDataSetClipping/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitDataSetClipping\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ImplicitModeller/","title":"ImplicitModeller","text":"

        vtk-examples/Cxx/PolyData/ImplicitModeller

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ImplicitModeller/#code","title":"Code","text":"

        ImplicitModeller.cxx

        #include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitModeller.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImplicitModeller> implicitModeller;\n  implicitModeller->SetSampleDimensions(50, 50, 50);\n  implicitModeller->SetInputData(polyData);\n  implicitModeller->AdjustBoundsOn();\n  implicitModeller->SetAdjustDistance(.1); // Adjust by 10%\n  implicitModeller->SetMaximumDistance(.1);\n\n  // Compute the range to select a reasonable contour value\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double xrange = bounds[1] - bounds[0];\n\n  // Create the 0 isosurface\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetInputConnection(implicitModeller->GetOutputPort());\n  contourFilter->SetValue(0, xrange / 30.0); // 30% of xrange\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(contourFilter->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Sienna\").GetData());\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ImplicitModeller\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphere;\n    sphere->Update();\n    polyData = sphere->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/ImplicitModeller/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitModeller)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersHybrid\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitModeller: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitModeller MACOSX_BUNDLE ImplicitModeller.cxx )\n  target_link_libraries(ImplicitModeller PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitModeller\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ImplicitModeller/#download-and-build-implicitmodeller","title":"Download and Build ImplicitModeller","text":"

        Click here to download ImplicitModeller and its CMakeLists.txt file. Once the tarball ImplicitModeller.tar has been downloaded and extracted,

        cd ImplicitModeller/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitModeller\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ImplicitPolyDataDistance/","title":"ImplicitPolyDataDistance","text":"

        vtk-examples/Cxx/PolyData/ImplicitPolyDataDistance

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ImplicitPolyDataDistance/#code","title":"Code","text":"

        ImplicitPolyDataDistance.cxx

        #include <vtkActor.h>\n#include <vtkFloatArray.h>\n#include <vtkImplicitPolyDataDistance.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n  sphereSource->Update();\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  sphereMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetOpacity(0.3);\n  sphereActor->GetProperty()->SetColor(1, 0, 0);\n\n  vtkNew<vtkImplicitPolyDataDistance> implicitPolyDataDistance;\n  implicitPolyDataDistance->SetInput(sphereSource->GetOutput());\n\n  // Setup a grid\n  vtkNew<vtkPoints> points;\n  float step = 0.1;\n  for (float x = -2.0; x <= 2.0; x += step)\n  {\n    for (float y = -2.0; y <= 2.0; y += step)\n    {\n      for (float z = -2.0; z <= 2.0; z += step)\n      {\n        points->InsertNextPoint(x, y, z);\n      }\n    }\n  }\n\n  // Add distances to each point\n  vtkNew<vtkFloatArray> signedDistances;\n  signedDistances->SetNumberOfComponents(1);\n  signedDistances->SetName(\"SignedDistances\");\n\n  // Evaluate the signed distance function at all of the grid points\n  for (vtkIdType pointId = 0; pointId < points->GetNumberOfPoints(); ++pointId)\n  {\n    double p[3];\n    points->GetPoint(pointId, p);\n    float signedDistance = implicitPolyDataDistance->EvaluateFunction(p);\n    signedDistances->InsertNextValue(signedDistance);\n  }\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n  polyData->GetPointData()->SetScalars(signedDistances);\n\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->SetInputData(polyData);\n  vertexGlyphFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> signedDistanceMapper;\n  signedDistanceMapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n  signedDistanceMapper->ScalarVisibilityOn();\n\n  vtkNew<vtkActor> signedDistanceActor;\n  signedDistanceActor->SetMapper(signedDistanceMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(sphereActor);\n  renderer->AddViewProp(signedDistanceActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitPolyDataDistance\");\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ImplicitPolyDataDistance/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitPolyDataDistance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitPolyDataDistance: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitPolyDataDistance MACOSX_BUNDLE ImplicitPolyDataDistance.cxx )\n  target_link_libraries(ImplicitPolyDataDistance PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitPolyDataDistance\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ImplicitPolyDataDistance/#download-and-build-implicitpolydatadistance","title":"Download and Build ImplicitPolyDataDistance","text":"

        Click here to download ImplicitPolyDataDistance and its CMakeLists.txt file. Once the tarball ImplicitPolyDataDistance.tar has been downloaded and extracted,

        cd ImplicitPolyDataDistance/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitPolyDataDistance\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ImplicitSelectionLoop/","title":"ImplicitSelectionLoop","text":"

        vtk-examples/Cxx/PolyData/ImplicitSelectionLoop

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ImplicitSelectionLoop/#code","title":"Code","text":"

        ImplicitSelectionLoop.cxx

        #include <vtkClipPolyData.h>\n#include <vtkImplicitSelectionLoop.h>\n#include <vtkLODActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(100);\n  sphereSource->SetThetaResolution(100);\n  sphereSource->Update();\n\n  vtkNew<vtkPoints> selectionPoints;\n\n  selectionPoints->InsertPoint(0, -0.16553, 0.135971, 0.451972);\n  selectionPoints->InsertPoint(1, -0.0880123, -0.134952, 0.4747);\n  selectionPoints->InsertPoint(2, 0.00292618, -0.134604, 0.482459);\n  selectionPoints->InsertPoint(3, 0.0641941, 0.067112, 0.490947);\n  selectionPoints->InsertPoint(4, 0.15577, 0.0734765, 0.469245);\n  selectionPoints->InsertPoint(5, 0.166667, -0.129217, 0.454622);\n  selectionPoints->InsertPoint(6, 0.241259, -0.123363, 0.420581);\n  selectionPoints->InsertPoint(7, 0.240334, 0.0727106, 0.432555);\n  selectionPoints->InsertPoint(8, 0.308529, 0.0844311, 0.384357);\n  selectionPoints->InsertPoint(9, 0.32672, -0.121674, 0.359187);\n  selectionPoints->InsertPoint(10, 0.380721, -0.117342, 0.302527);\n  selectionPoints->InsertPoint(11, 0.387804, 0.0455074, 0.312375);\n  selectionPoints->InsertPoint(12, 0.43943, -0.111673, 0.211707);\n  selectionPoints->InsertPoint(13, 0.470984, -0.0801913, 0.147919);\n  selectionPoints->InsertPoint(14, 0.436777, 0.0688872, 0.233021);\n  selectionPoints->InsertPoint(15, 0.44874, 0.188852, 0.109882);\n  selectionPoints->InsertPoint(16, 0.391352, 0.254285, 0.176943);\n  selectionPoints->InsertPoint(17, 0.373274, 0.154162, 0.294296);\n  selectionPoints->InsertPoint(18, 0.274659, 0.311654, 0.276609);\n  selectionPoints->InsertPoint(19, 0.206068, 0.31396, 0.329702);\n  selectionPoints->InsertPoint(20, 0.263789, 0.174982, 0.387308);\n  selectionPoints->InsertPoint(21, 0.213034, 0.175485, 0.417142);\n  selectionPoints->InsertPoint(22, 0.169113, 0.261974, 0.390286);\n  selectionPoints->InsertPoint(23, 0.102552, 0.25997, 0.414814);\n  selectionPoints->InsertPoint(24, 0.131512, 0.161254, 0.454705);\n  selectionPoints->InsertPoint(25, 0.000192443, 0.156264, 0.475307);\n  selectionPoints->InsertPoint(26, -0.0392091, 0.000251724, 0.499943);\n  selectionPoints->InsertPoint(27, -0.096161, 0.159646, 0.46438);\n\n  vtkNew<vtkImplicitSelectionLoop> loop;\n  loop->SetLoop(selectionPoints);\n\n  vtkNew<vtkClipPolyData> clip;\n  clip->SetInputConnection(sphereSource->GetOutputPort());\n  clip->SetClipFunction(loop);\n  clip->SetValue(0.0);\n\n  vtkNew<vtkPolyDataMapper> clipMapper;\n  clipMapper->SetInputConnection(clip->GetOutputPort());\n  clipMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkLODActor> clipActor;\n  clipActor->SetMapper(clipMapper);\n  clipActor->SetBackfaceProperty(backProp);\n  clipActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(clipActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetSize(500, 500);\n  renderWindow->SetWindowName(\"ImplicitSelectionLoop\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ImplicitSelectionLoop/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitSelectionLoop)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitSelectionLoop: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitSelectionLoop MACOSX_BUNDLE ImplicitSelectionLoop.cxx )\n  target_link_libraries(ImplicitSelectionLoop PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitSelectionLoop\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ImplicitSelectionLoop/#download-and-build-implicitselectionloop","title":"Download and Build ImplicitSelectionLoop","text":"

        Click here to download ImplicitSelectionLoop and its CMakeLists.txt file. Once the tarball ImplicitSelectionLoop.tar has been downloaded and extracted,

        cd ImplicitSelectionLoop/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitSelectionLoop\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/InterpolateMeshOnGrid/","title":"InterpolateMeshOnGrid","text":"

        vtk-examples/Cxx/PolyData/InterpolateMeshOnGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/InterpolateMeshOnGrid/#description","title":"Description","text":"

        This example resamples a mesh on a grid of points.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/InterpolateMeshOnGrid/#code","title":"Code","text":"

        InterpolateMeshOnGrid.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDelaunay2D.h>\n#include <vtkFloatArray.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkWarpScalar.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <iostream>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a random set of 100 points in the xy-plane in (0,10)x(0,10).\n  // If you had instead started with a set of (x,y,z) points, you must copy\n  // the zvalues into a FloatArray and set it as the data set's scalars,\n  // and then set the z-coordinates to zero\n  vtkNew<vtkPoints> randomPoints;\n\n  vtkNew<vtkFloatArray> zvalues;\n  zvalues->SetName(\"ZValues\");\n\n  unsigned int gridSize = 10;\n  float maxHeight = 1;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  for (unsigned int i = 0; i < 100; ++i)\n  {\n    double x, y, z;\n    // random position and radius.\n    x = randomSequence->GetRangeValue(0, gridSize);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(0, gridSize);\n    randomSequence->Next();\n    z = randomSequence->GetRangeValue(0, maxHeight);\n    randomSequence->Next();\n\n    // randomPoints->InsertNextPoint ( x, y, z);\n    randomPoints->InsertNextPoint(x, y, 0);\n    zvalues->InsertNextValue(z);\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> randomPolyData;\n  randomPolyData->SetPoints(randomPoints);\n  randomPolyData->GetPointData()->SetScalars(zvalues);\n\n  // Triangulate the grid points. If you do not have a mesh (points\n  // only), the output will not be interpolated!\n  vtkNew<vtkDelaunay2D> randomDelaunay;\n  randomDelaunay->SetInputData(randomPolyData);\n  randomDelaunay->Update();\n\n  // Create a grid of points to interpolate over.\n  vtkNew<vtkPoints> gridPoints;\n  for (unsigned int x = 0; x < gridSize; x++)\n  {\n    for (unsigned int y = 0; y < gridSize; y++)\n    {\n      gridPoints->InsertNextPoint(x, y, 0);\n    }\n  }\n\n  // Create a dataset from the grid points.\n  vtkNew<vtkPolyData> gridPolyData;\n  gridPolyData->SetPoints(gridPoints);\n\n  // Perform the interpolation.\n  vtkNew<vtkProbeFilter> probeFilter;\n  probeFilter->SetSourceConnection(randomDelaunay->GetOutputPort());\n  probeFilter->SetInputData(\n      gridPolyData); //\n                     // Interpolate 'Source' at these points.\n  probeFilter->Update();\n\n  // Map the output zvalues to the z-coordinates of the data so that\n  // we get a surface, rather than a flat grid with interpolated\n  // scalars.\n  vtkNew<vtkWarpScalar> gridWarpScalar;\n  gridWarpScalar->SetInputConnection(probeFilter->GetOutputPort());\n  gridWarpScalar->Update();\n\n  //////// Setup outputs ////////\n  // Output random points.\n  // Map the output zvalues to the z-coordinates of the data.\n  vtkNew<vtkWarpScalar> randomWarpScalar;\n  randomWarpScalar->SetInputConnection(randomDelaunay->GetOutputPort());\n  randomWarpScalar->Update();\n\n  vtkNew<vtkXMLPolyDataWriter> randomWriter;\n  randomWriter->SetFileName(\"randomSurface.vtp\");\n  randomWriter->SetInputConnection(randomWarpScalar->GetOutputPort());\n  randomWriter->Write();\n\n  // Mesh the output grid points\n  vtkNew<vtkDelaunay2D> gridDelaunay;\n  gridDelaunay->SetInputConnection(gridWarpScalar->GetOutputPort());\n\n  vtkNew<vtkXMLPolyDataWriter> gridWriter;\n  gridWriter->SetFileName(\"gridSurface.vtp\");\n  gridWriter->SetInputConnection(gridDelaunay->GetOutputPort());\n  gridWriter->Write();\n\n  ////////// Setup visualization ////////\n  vtkNew<vtkDataSetMapper> randomMapper;\n  randomMapper->SetInputConnection(randomWarpScalar->GetOutputPort());\n  randomMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> randomActor;\n  randomActor->SetMapper(randomMapper);\n  randomActor->GetProperty()->SetColor(colors->GetColor3d(\"Salmon\").GetData());\n  randomActor->GetProperty()->SetPointSize(3);\n\n  vtkNew<vtkDataSetMapper> gridMapper;\n  gridMapper->SetInputConnection(gridDelaunay->GetOutputPort());\n  gridMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> gridActor;\n  gridActor->SetMapper(gridMapper);\n  gridActor->GetProperty()->SetColor(colors->GetColor3d(\"SteelBlue\").GetData());\n  gridActor->GetProperty()->SetPointSize(3);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"InterpolateMeshOnGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderer->AddActor(randomActor);\n  renderer->AddActor(gridActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(5.87551, -15.9539, 17.5858);\n  camera->SetFocalPoint(4.94546, 4.90463, 0.498443);\n  camera->SetViewUp(-0.00568191, 0.633548, 0.773683);\n  camera->SetDistance(26.98);\n  camera->SetClippingRange(18.197, 38.1011);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/InterpolateMeshOnGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InterpolateMeshOnGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InterpolateMeshOnGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InterpolateMeshOnGrid MACOSX_BUNDLE InterpolateMeshOnGrid.cxx )\n  target_link_libraries(InterpolateMeshOnGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InterpolateMeshOnGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/InterpolateMeshOnGrid/#download-and-build-interpolatemeshongrid","title":"Download and Build InterpolateMeshOnGrid","text":"

        Click here to download InterpolateMeshOnGrid and its CMakeLists.txt file. Once the tarball InterpolateMeshOnGrid.tar has been downloaded and extracted,

        cd InterpolateMeshOnGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./InterpolateMeshOnGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/InterpolateTerrain/","title":"InterpolateTerrain","text":"

        vtk-examples/Cxx/PolyData/InterpolateTerrain

        "},{"location":"Cxx/PolyData/InterpolateTerrain/#description","title":"Description","text":"

        This example samples a \"terrain map\" using two approaches.

        • Creates an image from the x,y points of the terrain and then uses vtkProbeFilter to interpolate the heights.
        • Uses vtkCellLocator to directly interpolate the terrain polydata.

        Note that the results differ when the point is not one of the original terrain points. This is because the image has quadrilateral elements and the polydata has triangles. As the resolution of the grid increases, the two results converge.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/InterpolateTerrain/#code","title":"Code","text":"

        InterpolateTerrain.cxx

        #include <vtkCellLocator.h>\n#include <vtkDelaunay2D.h>\n#include <vtkDoubleArray.h>\n#include <vtkImageData.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProbeFilter.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkImageData> image;\n  image->SetExtent(0, 9, 0, 9, 0, 0);\n  image->AllocateScalars(VTK_DOUBLE, 1);\n\n  // Create a random set of heights on a grid. This is often called a\n  //\"terrain map\".\n  vtkNew<vtkPoints> points;\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  unsigned int GridSize = 10;\n  for (unsigned int x = 0; x < GridSize; x++)\n  {\n    for (unsigned int y = 0; y < GridSize; y++)\n    {\n      double val = randomSequence->GetRangeValue(-1, 1);\n      randomSequence->Next();\n      points->InsertNextPoint(x, y, val);\n      image->SetScalarComponentFromDouble(x, y, 0, 0, val);\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Triangulate the grid points.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(polydata);\n  delaunay->Update();\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(\"surface.vtp\");\n  writer->SetInputConnection(delaunay->GetOutputPort());\n  writer->Write();\n\n  // Add some points to interpolate.\n  vtkNew<vtkPoints> probePoints;\n  probePoints->InsertNextPoint(5.2, 3.2, 0);\n  probePoints->InsertNextPoint(5.0, 3.0, 0);\n  probePoints->InsertNextPoint(0.0, 0.0, 0);\n\n  vtkNew<vtkPolyData> probePolyData;\n  probePolyData->SetPoints(probePoints);\n\n  vtkNew<vtkProbeFilter> probe;\n  probe->SetSourceData(image);\n  probe->SetInputData(probePolyData);\n  probe->Update();\n\n  vtkDataArray* data = probe->GetOutput()->GetPointData()->GetScalars();\n  vtkDoubleArray* doubleData = dynamic_cast<vtkDoubleArray*>(data);\n\n  for (int i = 0; i < doubleData->GetNumberOfTuples(); i++)\n  {\n    double val = doubleData->GetValue(i);\n    cout << \"Interpolation using ProbeFilter \";\n    cout << \"doubleData->GetValue(\" << i << \"): \" << val << endl;\n  }\n\n  // Now find the elevation with a CellLocator.\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(delaunay->GetOutput());\n  cellLocator->BuildLocator();\n\n  for (int i = 0; i < doubleData->GetNumberOfTuples(); i++)\n  {\n    int subId;\n    double t, xyz[3], pcoords[3];\n    double rayStart[3], rayEnd[3];\n    probePoints->GetPoint(i, rayStart);\n    rayStart[2] += 1000.0;\n    probePoints->GetPoint(i, rayEnd);\n    rayEnd[2] -= 1000.0;\n\n    if (cellLocator->IntersectWithLine(rayStart, rayEnd, 0.0001, t, xyz,\n                                       pcoords, subId))\n    {\n      cout << \"Interpolation using CellLocator \";\n      cout << \"Elevation at \" << rayStart[0] << \", \" << rayStart[1] << \" is \"\n           << xyz[2] << endl;\n    }\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/InterpolateTerrain/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InterpolateTerrain)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InterpolateTerrain: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InterpolateTerrain MACOSX_BUNDLE InterpolateTerrain.cxx )\n  target_link_libraries(InterpolateTerrain PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InterpolateTerrain\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/InterpolateTerrain/#download-and-build-interpolateterrain","title":"Download and Build InterpolateTerrain","text":"

        Click here to download InterpolateTerrain and its CMakeLists.txt file. Once the tarball InterpolateTerrain.tar has been downloaded and extracted,

        cd InterpolateTerrain/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./InterpolateTerrain\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/IntersectionPolyDataFilter/","title":"IntersectionPolyDataFilter","text":"

        vtk-examples/Cxx/PolyData/IntersectionPolyDataFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/IntersectionPolyDataFilter/#code","title":"Code","text":"

        IntersectionPolyDataFilter.cxx

        #include <vtkActor.h>\n#include <vtkIntersectionPolyDataFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(2.0);\n  sphereSource1->Update();\n  vtkNew<vtkPolyDataMapper> sphere1Mapper;\n  sphere1Mapper->SetInputConnection(sphereSource1->GetOutputPort());\n  sphere1Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> sphere1Actor;\n  sphere1Actor->SetMapper(sphere1Mapper);\n  sphere1Actor->GetProperty()->SetOpacity(.3);\n  sphere1Actor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(1.0, 0.0, 0.0);\n  sphereSource2->SetRadius(2.0);\n  vtkNew<vtkPolyDataMapper> sphere2Mapper;\n  sphere2Mapper->SetInputConnection(sphereSource2->GetOutputPort());\n  sphere2Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> sphere2Actor;\n  sphere2Actor->SetMapper(sphere2Mapper);\n  sphere2Actor->GetProperty()->SetOpacity(.3);\n  sphere2Actor->GetProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n\n  vtkNew<vtkIntersectionPolyDataFilter> intersectionPolyDataFilter;\n  intersectionPolyDataFilter->SetInputConnection(\n      0, sphereSource1->GetOutputPort());\n  intersectionPolyDataFilter->SetInputConnection(\n      1, sphereSource2->GetOutputPort());\n  intersectionPolyDataFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> intersectionMapper;\n  intersectionMapper->SetInputConnection(\n      intersectionPolyDataFilter->GetOutputPort());\n  intersectionMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> intersectionActor;\n  intersectionActor->SetMapper(intersectionMapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(sphere1Actor);\n  renderer->AddViewProp(sphere2Actor);\n  renderer->AddViewProp(intersectionActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"IntersectionPolyDataFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/IntersectionPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IntersectionPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IntersectionPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IntersectionPolyDataFilter MACOSX_BUNDLE IntersectionPolyDataFilter.cxx )\n  target_link_libraries(IntersectionPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IntersectionPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/IntersectionPolyDataFilter/#download-and-build-intersectionpolydatafilter","title":"Download and Build IntersectionPolyDataFilter","text":"

        Click here to download IntersectionPolyDataFilter and its CMakeLists.txt file. Once the tarball IntersectionPolyDataFilter.tar has been downloaded and extracted,

        cd IntersectionPolyDataFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IntersectionPolyDataFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/IterateOverLines/","title":"IterateOverLines","text":"

        vtk-examples/Cxx/PolyData/IterateOverLines

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/IterateOverLines/#code","title":"Code","text":"

        IterateOverLines.cxx

        #include <vtkCellArray.h>\n#include <vtkLine.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n  double p2[3] = {0.0, 1.0, 2.0};\n  double p3[3] = {1.0, 2.0, 3.0};\n\n  // Create a vtkPoints object and store the points in it\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(origin);\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n\n  // Create a cell array to store the lines in and add the lines to it\n  vtkNew<vtkCellArray> lines;\n\n  // Create four lines\n  for (unsigned int i = 0; i < 4; i++)\n  {\n    vtkNew<vtkLine> line;\n    line->GetPointIds()->SetId(0, i);\n    line->GetPointIds()->SetId(1, i + 1);\n    lines->InsertNextCell(line);\n  }\n\n  // Create a polydata to store everything in\n  vtkNew<vtkPolyData> linesPolyData;\n\n  // Add the points to the dataset\n  linesPolyData->SetPoints(points);\n\n  // Add the lines to the dataset\n  linesPolyData->SetLines(lines);\n\n  std::cout << \"There are \" << linesPolyData->GetNumberOfLines() << \" lines.\"\n            << std::endl;\n\n  linesPolyData->GetLines()->InitTraversal();\n  vtkNew<vtkIdList> idList;\n  while (linesPolyData->GetLines()->GetNextCell(idList))\n  {\n    std::cout << \"Line has \" << idList->GetNumberOfIds() << \" points.\"\n              << std::endl;\n\n    for (vtkIdType pointId = 0; pointId < idList->GetNumberOfIds(); pointId++)\n    {\n      std::cout << idList->GetId(pointId) << \" \";\n    }\n    std::cout << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/IterateOverLines/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IterateOverLines)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IterateOverLines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IterateOverLines MACOSX_BUNDLE IterateOverLines.cxx )\n  target_link_libraries(IterateOverLines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IterateOverLines\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/IterateOverLines/#download-and-build-iterateoverlines","title":"Download and Build IterateOverLines","text":"

        Click here to download IterateOverLines and its CMakeLists.txt file. Once the tarball IterateOverLines.tar has been downloaded and extracted,

        cd IterateOverLines/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IterateOverLines\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/KochanekSpline/","title":"KochanekSpline","text":"

        vtk-examples/Cxx/PolyData/KochanekSpline

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/KochanekSpline/#description","title":"Description","text":"

        The vtkKochanekSpline provides three parameters to control the shape of the spline:

        1. tension - Changes the length of the tangent vector
        2. bias - Primarily changes the direction of the tangent vector
        3. continuity - Changes the sharpness in change between tangents

        Seealso

        KochanekSplineDemo provides sliders to change the three parameters.

        Seealso

        This wikipedia article describes the controlsin detail.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/KochanekSpline/#code","title":"Code","text":"

        KochanekSpline.cxx

        #include <vtkActor.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkKochanekSpline.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int numberOfPoints = 10;\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(numberOfPoints);\n  pointSource->Update();\n\n  vtkPoints* points = pointSource->GetOutput()->GetPoints();\n\n  vtkNew<vtkKochanekSpline> xSpline;\n  vtkNew<vtkKochanekSpline> ySpline;\n  vtkNew<vtkKochanekSpline> zSpline;\n\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetXSpline(xSpline);\n  spline->SetYSpline(ySpline);\n  spline->SetZSpline(zSpline);\n  spline->SetPoints(points);\n\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->SetUResolution(50 * numberOfPoints);\n  functionSource->SetVResolution(50 * numberOfPoints);\n  functionSource->SetWResolution(50 * numberOfPoints);\n  functionSource->Update();\n\n  // Setup actor and mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(functionSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DarkSlateGrey\").GetData());\n  actor->GetProperty()->SetLineWidth(3.0);\n\n  // Glyph the points\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.02);\n\n  // Create a polydata to store everything in\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputData(polyData);\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"KochanekSpline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(pointActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/KochanekSpline/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KochanekSpline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KochanekSpline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KochanekSpline MACOSX_BUNDLE KochanekSpline.cxx )\n  target_link_libraries(KochanekSpline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KochanekSpline\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/KochanekSpline/#download-and-build-kochanekspline","title":"Download and Build KochanekSpline","text":"

        Click here to download KochanekSpline and its CMakeLists.txt file. Once the tarball KochanekSpline.tar has been downloaded and extracted,

        cd KochanekSpline/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KochanekSpline\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/KochanekSplineDemo/","title":"KochanekSplineDemo","text":"

        vtk-examples/Cxx/PolyData/KochanekSplineDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/KochanekSplineDemo/#description","title":"Description","text":"

        The example provides vtkSliderWidget s to change tension, continuity and bias of the vtkKochanekSpline.

        1. tension - Changes the length of the tangent vector
        2. bias - Primarily changes the direction of the tangent vector
        3. continuity - Changes the sharpness in change between tangents

        Seealso

        This wikipedia article describes the controlsin detail.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/KochanekSplineDemo/#code","title":"Code","text":"

        KochanekSplineDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCommand.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkKochanekSpline.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\nnamespace {\nvoid MakeTensionWidget(vtkSliderWidget*, vtkParametricFunctionSource*,\n                       vtkParametricSpline*, vtkRenderer*,\n                       vtkRenderWindowInteractor*);\nvoid MakeContinuityWidget(vtkSliderWidget*, vtkParametricFunctionSource*,\n                          vtkParametricSpline*, vtkRenderer*,\n                          vtkRenderWindowInteractor*);\nvoid MakeBiasWidget(vtkSliderWidget*, vtkParametricFunctionSource*,\n                    vtkParametricSpline*, vtkRenderer*,\n                    vtkRenderWindowInteractor*);\nvoid SetSliderColors(vtkSliderRepresentation2D* slider);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int numberOfPoints = 7;\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(numberOfPoints);\n  double radius = 1.0;\n  double delta = 2.0 * vtkMath::Pi() / double(numberOfPoints);\n  for (int n = 0; n < numberOfPoints; ++n)\n  {\n    double theta = delta * n;\n    double x = radius * std::cos(theta);\n    double y = radius * std::sin(theta);\n    double z = n * (vtkMath::Pi() / numberOfPoints);\n    points->SetPoint(n, x, y, z);\n  }\n\n  vtkNew<vtkKochanekSpline> xSpline;\n  vtkNew<vtkKochanekSpline> ySpline;\n  vtkNew<vtkKochanekSpline> zSpline;\n\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetXSpline(xSpline);\n  spline->SetYSpline(ySpline);\n  spline->SetZSpline(zSpline);\n  spline->SetPoints(points);\n\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->SetUResolution(50 * numberOfPoints);\n  functionSource->SetVResolution(50 * numberOfPoints);\n  functionSource->SetWResolution(50 * numberOfPoints);\n  functionSource->Update();\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(functionSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DarkSlateGrey\").GetData());\n  actor->GetProperty()->SetLineWidth(3.0);\n\n  // Glyph the points.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.1);\n\n  // Create a polydata to store everything in.\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputData(polyData);\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  pointActor->GetProperty()->SetOpacity(.5);\n  ;\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"KochanekSpline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(pointActor);\n  ;\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->Render();\n\n  vtkNew<vtkSliderWidget> tensionWidget;\n  MakeTensionWidget(tensionWidget, functionSource, spline, renderer,\n                    renderWindowInteractor);\n  vtkNew<vtkSliderWidget> continuityWidget;\n  MakeContinuityWidget(continuityWidget, functionSource, spline, renderer,\n                       renderWindowInteractor);\n  vtkNew<vtkSliderWidget> biasWidget;\n  MakeBiasWidget(biasWidget, functionSource, spline, renderer,\n                 renderWindowInteractor);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackTension : public vtkCommand\n{\npublic:\n  static SliderCallbackTension* New()\n  {\n    return new SliderCallbackTension;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetXSpline())\n        ->SetDefaultTension(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetYSpline())\n        ->SetDefaultTension(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetZSpline())\n        ->SetDefaultTension(value);\n    ParametricSource->Modified();\n    ParametricSource->Update();\n  }\n  SliderCallbackTension() : ParametricSource(0), ParametricSpline(0)\n  {\n  }\n  vtkParametricSpline* ParametricSpline;\n  vtkParametricFunctionSource* ParametricSource;\n};\n\nvoid MakeTensionWidget(vtkSliderWidget* widget,\n                       vtkParametricFunctionSource* parametricSource,\n                       vtkParametricSpline* parametricSpline,\n                       vtkRenderer* renderer,\n                       vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepTension;\n\n  sliderRepTension->SetRenderer(renderer);\n\n  sliderRepTension->SetMinimumValue(-1.0);\n  sliderRepTension->SetMaximumValue(1.0);\n  sliderRepTension->SetValue(\n      dynamic_cast<vtkKochanekSpline*>(parametricSpline->GetXSpline())\n          ->GetDefaultTension());\n  sliderRepTension->SetTitleText(\"Tension\");\n  sliderRepTension->SetRenderer(renderer);\n  sliderRepTension->GetPoint1Coordinate()->SetValue(0.1, 0.1);\n  sliderRepTension->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n  sliderRepTension->GetPoint2Coordinate()->SetValue(0.3, 0.1);\n  sliderRepTension->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepTension->SetTubeWidth(tubeWidth);\n  sliderRepTension->SetSliderLength(sliderLength);\n  sliderRepTension->SetTitleHeight(titleHeight);\n  sliderRepTension->SetLabelHeight(labelHeight);\n  sliderRepTension->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepTension->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepTension->BuildRepresentation();\n  SetSliderColors(sliderRepTension);\n\n  widget->SetRepresentation(sliderRepTension);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackTension> callbackTension;\n  callbackTension->ParametricSpline = parametricSpline;\n  callbackTension->ParametricSource = parametricSource;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackTension);\n}\n\nclass SliderCallbackContinuity : public vtkCommand\n{\npublic:\n  static SliderCallbackContinuity* New()\n  {\n    return new SliderCallbackContinuity;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetXSpline())\n        ->SetDefaultContinuity(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetYSpline())\n        ->SetDefaultContinuity(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetZSpline())\n        ->SetDefaultContinuity(value);\n    ParametricSource->Modified();\n    ParametricSource->Update();\n  }\n  SliderCallbackContinuity() : ParametricSource(0), ParametricSpline(0)\n  {\n  }\n  vtkParametricSpline* ParametricSpline;\n  vtkParametricFunctionSource* ParametricSource;\n};\n\nvoid MakeContinuityWidget(vtkSliderWidget* widget,\n                          vtkParametricFunctionSource* parametricSource,\n                          vtkParametricSpline* parametricSpline,\n                          vtkRenderer* renderer,\n                          vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepContinuity;\n\n  sliderRepContinuity->SetRenderer(renderer);\n\n  sliderRepContinuity->SetMinimumValue(-1.0);\n  sliderRepContinuity->SetMaximumValue(1.0);\n  sliderRepContinuity->SetValue(\n      dynamic_cast<vtkKochanekSpline*>(parametricSpline->GetXSpline())\n          ->GetDefaultContinuity());\n  sliderRepContinuity->SetTitleText(\"Continuity\");\n  sliderRepContinuity->SetRenderer(renderer);\n  sliderRepContinuity->GetPoint1Coordinate()->SetValue(0.4, 0.1);\n  sliderRepContinuity->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n  sliderRepContinuity->GetPoint2Coordinate()->SetValue(0.6, 0.1);\n  sliderRepContinuity->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepContinuity->SetTubeWidth(tubeWidth);\n  sliderRepContinuity->SetSliderLength(sliderLength);\n  sliderRepContinuity->SetTitleHeight(titleHeight);\n  sliderRepContinuity->SetLabelHeight(labelHeight);\n  sliderRepContinuity->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepContinuity->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepContinuity->BuildRepresentation();\n  SetSliderColors(sliderRepContinuity);\n\n  widget->SetRepresentation(sliderRepContinuity);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackContinuity> callbackContinuity;\n  callbackContinuity->ParametricSpline = parametricSpline;\n  callbackContinuity->ParametricSource = parametricSource;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackContinuity);\n}\n\nclass SliderCallbackBias : public vtkCommand\n{\npublic:\n  static SliderCallbackBias* New()\n  {\n    return new SliderCallbackBias;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetXSpline())\n        ->SetDefaultBias(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetYSpline())\n        ->SetDefaultBias(value);\n    dynamic_cast<vtkKochanekSpline*>(this->ParametricSpline->GetZSpline())\n        ->SetDefaultBias(value);\n    ParametricSource->Modified();\n    ParametricSource->Update();\n  }\n  SliderCallbackBias() : ParametricSource(0), ParametricSpline(0)\n  {\n  }\n  vtkParametricSpline* ParametricSpline;\n  vtkParametricFunctionSource* ParametricSource;\n};\n\nvoid MakeBiasWidget(vtkSliderWidget* widget,\n                    vtkParametricFunctionSource* parametricSource,\n                    vtkParametricSpline* parametricSpline,\n                    vtkRenderer* renderer,\n                    vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepBias;\n\n  sliderRepBias->SetRenderer(renderer);\n\n  sliderRepBias->SetMinimumValue(-1.0);\n  sliderRepBias->SetMaximumValue(1.0);\n  sliderRepBias->SetValue(\n      dynamic_cast<vtkKochanekSpline*>(parametricSpline->GetXSpline())\n          ->GetDefaultBias());\n  sliderRepBias->SetTitleText(\"Bias\");\n  sliderRepBias->SetRenderer(renderer);\n  sliderRepBias->GetPoint1Coordinate()->SetValue(0.7, 0.1);\n  sliderRepBias->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n  sliderRepBias->GetPoint2Coordinate()->SetValue(0.9, 0.1);\n  sliderRepBias->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepBias->SetTubeWidth(tubeWidth);\n  sliderRepBias->SetSliderLength(sliderLength);\n  sliderRepBias->SetTitleHeight(titleHeight);\n  sliderRepBias->SetLabelHeight(labelHeight);\n  sliderRepBias->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepBias->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepBias->BuildRepresentation();\n  SetSliderColors(sliderRepBias);\n\n  widget->SetRepresentation(sliderRepBias);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  vtkNew<SliderCallbackBias> callbackBias;\n  callbackBias->ParametricSpline = parametricSpline;\n  callbackBias->ParametricSource = parametricSource;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackBias);\n}\n\nvoid SetSliderColors(vtkSliderRepresentation2D* slider)\n{\n  vtkNew<vtkNamedColors> colors;\n  // Set color properties:\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(colors->GetColor3d(\"Peru\").GetData());\n  // Change the color of the text indicating what the slider controls.\n  slider->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"OrangeRed\").GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(\"OrangeRed\").GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"DeepPink\").GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n}\n\n} // namespace\n
        "},{"location":"Cxx/PolyData/KochanekSplineDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KochanekSplineDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KochanekSplineDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KochanekSplineDemo MACOSX_BUNDLE KochanekSplineDemo.cxx )\n  target_link_libraries(KochanekSplineDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KochanekSplineDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/KochanekSplineDemo/#download-and-build-kochaneksplinedemo","title":"Download and Build KochanekSplineDemo","text":"

        Click here to download KochanekSplineDemo and its CMakeLists.txt file. Once the tarball KochanekSplineDemo.tar has been downloaded and extracted,

        cd KochanekSplineDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KochanekSplineDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/LinearExtrusion/","title":"LinearExtrusion","text":"

        vtk-examples/Cxx/PolyData/LinearExtrusion

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/LinearExtrusion/#description","title":"Description","text":"

        This example creates some text, extrudes it to make it 3D.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/LinearExtrusion/#code","title":"Code","text":"

        LinearExtrusion.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVectorText.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create vector text\n  vtkNew<vtkVectorText> vecText;\n  vecText->SetText(\"Text!\");\n\n  // Apply linear extrusion\n  vtkNew<vtkLinearExtrusionFilter> extrude;\n  extrude->SetInputConnection(vecText->GetOutputPort());\n  extrude->SetExtrusionTypeToNormalExtrusion();\n  extrude->SetVector(0, 0, 1);\n  extrude->SetScaleFactor(0.5);\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(extrude->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(triangleFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PaleGoldenrod\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LinearExtrusion\");\n\n  renderer->AddActor(actor);\n\n  renderer->ResetCamera();\n  // Generate an interesting view\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/LinearExtrusion/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LinearExtrusion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LinearExtrusion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LinearExtrusion MACOSX_BUNDLE LinearExtrusion.cxx )\n  target_link_libraries(LinearExtrusion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LinearExtrusion\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/LinearExtrusion/#download-and-build-linearextrusion","title":"Download and Build LinearExtrusion","text":"

        Click here to download LinearExtrusion and its CMakeLists.txt file. Once the tarball LinearExtrusion.tar has been downloaded and extracted,

        cd LinearExtrusion/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LinearExtrusion\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/LoopBooleanPolyDataFilter/","title":"LoopBooleanPolyDataFilter","text":"

        vtk-examples/Cxx/PolyData/LoopBooleanPolyDataFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/LoopBooleanPolyDataFilter/#description","title":"Description","text":"

        The vtkLoopBooleanPolyDataFilter works best with \"clean\" data, so this examples first runs vtkTriangleFilter and then vtkCleanPolyData.

        This example can be run in three ways:

        1. LoopBooleanPolyDataFilter - Computes the intersection of two spheres

        2. LoopBooleanPolyDataFilter intersection|difference|union - Computes the intersection(difference or union) of two spheres

        3. LoopBooleanPolyDataFilter input1.vtk intersection|difference|union input2.vtk - Computes the intersection(difference or union) of two vtkPolyData's

        Seealso

        BooleanOperationPolyDataFilter uses an alternative algorithm to do the boolean operations.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/LoopBooleanPolyDataFilter/#code","title":"Code","text":"

        LoopBooleanPolyDataFilter.cxx

        #include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCleanPolyData.h>\n#include <vtkLoopBooleanPolyDataFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkCamera.h>\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> input1;\n  vtkSmartPointer<vtkPolyData> input2;\n\n  std::string operation(\"intersection\");\n\n  if (argc == 4)\n  {\n    auto poly1 = ReadPolyData(argv[1]);\n    vtkNew<vtkTriangleFilter> tri1;\n    tri1->SetInputData(poly1);\n    vtkNew<vtkCleanPolyData> clean1;\n    clean1->SetInputConnection(tri1->GetOutputPort());\n    clean1->Update();\n    input1 = clean1->GetOutput();\n\n    auto poly2 = ReadPolyData(argv[3]);\n    vtkNew<vtkTriangleFilter> tri2;\n    tri2->SetInputData(poly2);\n    tri2->Update();\n    vtkNew<vtkCleanPolyData> clean2;\n    clean2->SetInputConnection(tri2->GetOutputPort());\n    clean2->Update();\n    input2 = clean2->GetOutput();\n    operation = argv[2];\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource1;\n    sphereSource1->SetCenter(.25, 0, 0);\n    sphereSource1->SetPhiResolution(21);\n    sphereSource1->SetThetaResolution(21);\n    sphereSource1->Update();\n    input1 = sphereSource1->GetOutput();\n\n    vtkNew<vtkSphereSource> sphereSource2;\n    sphereSource2->Update();\n    input2 = sphereSource2->GetOutput();\n\n    if (argc == 2)\n    {\n      operation = argv[1];\n    }\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> input1Mapper;\n  input1Mapper->SetInputData(input1);\n  input1Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> input1Actor;\n  input1Actor->SetMapper(input1Mapper);\n  input1Actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  input1Actor->GetProperty()->SetSpecular(.6);\n  input1Actor->GetProperty()->SetSpecularPower(20);\n  input1Actor->SetPosition(input1->GetBounds()[1] - input1->GetBounds()[0], 0,\n                           0);\n  vtkNew<vtkPolyDataMapper> input2Mapper;\n  input2Mapper->SetInputData(input2);\n  input2Mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> input2Actor;\n  input2Actor->SetMapper(input2Mapper);\n  input2Actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  input2Actor->GetProperty()->SetSpecular(.6);\n  input2Actor->GetProperty()->SetSpecularPower(20);\n  input2Actor->SetPosition(-(input1->GetBounds()[1] - input1->GetBounds()[0]),\n                           0, 0);\n  vtkNew<vtkLoopBooleanPolyDataFilter> booleanOperation;\n  if (operation == \"union\")\n  {\n    booleanOperation->SetOperationToUnion();\n  }\n  else if (operation == \"intersection\")\n  {\n    booleanOperation->SetOperationToIntersection();\n  }\n  else if (operation == \"difference\")\n  {\n    booleanOperation->SetOperationToDifference();\n  }\n  else\n  {\n    std::cout << \"Unknown operation: \" << operation << std::endl;\n    return EXIT_FAILURE;\n  }\n  booleanOperation->SetInputData(0, input1);\n  booleanOperation->SetInputData(1, input2);\n\n  vtkNew<vtkPolyDataMapper> booleanOperationMapper;\n  booleanOperationMapper->SetInputConnection(booleanOperation->GetOutputPort());\n  booleanOperationMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> booleanOperationActor;\n  booleanOperationActor->SetMapper(booleanOperationMapper);\n  booleanOperationActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  booleanOperationActor->GetProperty()->SetSpecular(.6);\n  booleanOperationActor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(input1Actor);\n  renderer->AddViewProp(input2Actor);\n  renderer->AddViewProp(booleanOperationActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"LoopBooleanPolyDataFilter\");\n\n  double viewUp[3] = {0.0, 0.0, 1.0};\n  double position[3] = {0.0, -1.0, 0.0};\n  PositionCamera(renderer, viewUp, position);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid PositionCamera(vtkRenderer* renderer, double* viewUp, double* position)\n{\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.0, 0.0);\n  renderer->GetActiveCamera()->SetViewUp(viewUp);\n  renderer->GetActiveCamera()->SetPosition(position);\n  renderer->ResetCamera();\n  return;\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/LoopBooleanPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LoopBooleanPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LoopBooleanPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LoopBooleanPolyDataFilter MACOSX_BUNDLE LoopBooleanPolyDataFilter.cxx )\n  target_link_libraries(LoopBooleanPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LoopBooleanPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/LoopBooleanPolyDataFilter/#download-and-build-loopbooleanpolydatafilter","title":"Download and Build LoopBooleanPolyDataFilter","text":"

        Click here to download LoopBooleanPolyDataFilter and its CMakeLists.txt file. Once the tarball LoopBooleanPolyDataFilter.tar has been downloaded and extracted,

        cd LoopBooleanPolyDataFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LoopBooleanPolyDataFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/MaskPoints/","title":"MaskPoints","text":"

        vtk-examples/Cxx/PolyData/MaskPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/MaskPoints/#code","title":"Code","text":"

        MaskPoints.cxx

        #include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVertexGlyphFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a set of points\n  vtkNew<vtkPointSource> pointsSource;\n  pointsSource->SetNumberOfPoints(40);\n  pointsSource->Update();\n\n  std::cout << \"There are \" << pointsSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n\n  // Create a point set\n  vtkNew<vtkMaskPoints> maskPoints;\n  maskPoints->SetOnRatio(2); // keep every 2nd point (half the number of points)\n  maskPoints->SetInputConnection(pointsSource->GetOutputPort());\n  maskPoints->Update();\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputConnection(maskPoints->GetOutputPort());\n  glyphFilter->Update();\n\n  std::cout << \"There are \" << maskPoints->GetOutput()->GetNumberOfPoints()\n            << \" masked points.\" << std::endl;\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(pointsSource->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetPointSize(5);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkPolyDataMapper> maskedMapper;\n  maskedMapper->SetInputConnection(glyphFilter->GetOutputPort());\n  vtkNew<vtkActor> maskedActor;\n  maskedActor->SetMapper(maskedMapper);\n  maskedActor->GetProperty()->SetPointSize(5);\n  maskedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"MaskPoints\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Chocolate\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(maskedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/MaskPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MaskPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MaskPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MaskPoints MACOSX_BUNDLE MaskPoints.cxx )\n  target_link_libraries(MaskPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MaskPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/MaskPoints/#download-and-build-maskpoints","title":"Download and Build MaskPoints","text":"

        Click here to download MaskPoints and its CMakeLists.txt file. Once the tarball MaskPoints.tar has been downloaded and extracted,

        cd MaskPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MaskPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/MergePoints/","title":"MergePoints","text":"

        vtk-examples/Cxx/PolyData/MergePoints

        "},{"location":"Cxx/PolyData/MergePoints/#description","title":"Description","text":"

        Add new points if they are unique. You must add the original points first. After that, the locator will only add unique points.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/MergePoints/#code","title":"Code","text":"

        MergePoints.cxx

        #include <vtkMergePoints.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  // Create a set of points.\n  vtkNew<vtkPointSource> pointsSource;\n  pointsSource->SetNumberOfPoints(100);\n  pointsSource->Update();\n\n  vtkPolyData* points = pointsSource->GetOutput();\n\n  // Get a point point in the set.\n  double inSet[3];\n  points->GetPoint(25, inSet);\n\n  std::cout << \"There are \" << points->GetNumberOfPoints() << \" input points.\"\n            << std::endl;\n\n  vtkIdType id;\n\n  // Insert all of the points.\n  vtkNew<vtkMergePoints> mergePoints;\n  mergePoints->SetDataSet(points);\n  mergePoints->SetDivisions(10, 10, 10);\n  mergePoints->InitPointInsertion(points->GetPoints(), points->GetBounds());\n\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    mergePoints->InsertUniquePoint(points->GetPoint(i), id);\n  }\n\n  // Insert a few of the original points.\n  std::cout << \"Insert some of the original points\" << std::endl;\n  int inserted;\n  for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i += 10)\n  {\n    points->GetPoint(i, inSet);\n    inserted = mergePoints->InsertUniquePoint(inSet, id);\n    std::cout << \"\\tPoint: \" << inSet[0] << \", \" << inSet[1] << \", \" << inSet[2]\n              << \" \";\n\n    std::cout << \"Inserted? \" << ((inserted == 0) ? \"No, \" : \"Yes, \");\n    std::cout << \"Id:: \" << id << std::endl;\n  }\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  // These points are probably outside the original set of points.\n  std::cout << \"Insert some new points\" << std::endl;\n  double outsideSet[3];\n  auto radius = pointsSource->GetRadius();\n  for (unsigned int i = 0; i < 10; i++)\n  {\n    for (auto j = 0; j < 3; ++j)\n    {\n      outsideSet[j] = rng->GetRangeValue(-radius, radius);\n      rng->Next();\n    }\n\n    inserted = mergePoints->InsertUniquePoint(outsideSet, id);\n    std::cout << \"\\tPoint: \" << outsideSet[0] << \", \" << outsideSet[1] << \", \"\n              << outsideSet[2] << \" \";\n\n    std::cout << \"Inserted? \" << ((inserted == 0) ? \"No, \" : \"Yes, \");\n    std::cout << \"Id:: \" << id << std::endl;\n  }\n\n  std::cout << \"There are now \" << points->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/MergePoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MergePoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MergePoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MergePoints MACOSX_BUNDLE MergePoints.cxx )\n  target_link_libraries(MergePoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MergePoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/MergePoints/#download-and-build-mergepoints","title":"Download and Build MergePoints","text":"

        Click here to download MergePoints and its CMakeLists.txt file. Once the tarball MergePoints.tar has been downloaded and extracted,

        cd MergePoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MergePoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/MergeSelections/","title":"MergeSelections","text":"

        vtk-examples/Cxx/PolyData/MergeSelections

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/MergeSelections/#code","title":"Code","text":"

        MergeSelections.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdTypeArray.h>\n// #include <vtkInformation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A nifty way of setting backgrounds in multiple renderers.\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorSchemeByName(\"Brewer Qualitative Pastel2\");\n  colors->SetColor(\"ren0\", colorSeries->GetColor(0));\n  colors->SetColor(\"ren1\", colorSeries->GetColor(1));\n  colors->SetColor(\"ren2\", colorSeries->GetColor(2));\n  colors->SetColor(\"ren3\", colorSeries->GetColor(3));\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(50);\n  pointSource->Update();\n\n  std::cout << \"There are \" << pointSource->GetOutput()->GetNumberOfPoints()\n            << \" input points.\" << std::endl;\n\n  vtkNew<vtkIdTypeArray> ids1;\n  ids1->SetNumberOfComponents(1);\n\n  // Set values\n  for (unsigned int i = 10; i < 20; i++)\n  {\n    ids1->InsertNextValue(i);\n  }\n\n  vtkNew<vtkIdTypeArray> ids2;\n  ids2->SetNumberOfComponents(1);\n\n  for (unsigned int i = 15; i < 30; i++)\n  {\n    ids2->InsertNextValue(i);\n  }\n\n  vtkNew<vtkSelectionNode> selectionNode1;\n  selectionNode1->SetFieldType(vtkSelectionNode::POINT);\n  selectionNode1->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode1->SetSelectionList(ids1);\n\n  vtkNew<vtkSelectionNode> selectionNode2;\n  selectionNode2->SetFieldType(vtkSelectionNode::POINT);\n  selectionNode2->SetContentType(vtkSelectionNode::INDICES);\n  selectionNode2->SetSelectionList(ids2);\n\n  vtkNew<vtkSelection> selection1;\n  selection1->AddNode(selectionNode1);\n\n  vtkNew<vtkSelection> selection2;\n  selection2->AddNode(selectionNode2);\n\n  vtkNew<vtkSelection> selectionCombined;\n  selectionCombined->AddNode(selectionNode1);\n  selectionCombined->Union(selectionNode2);\n\n  std::cout << \"There are \" << selectionCombined->GetNumberOfNodes()\n            << \" nodes.\" << std::endl;\n\n  vtkNew<vtkExtractSelection> extractSelection1;\n  extractSelection1->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelection1->SetInputData(1, selection1);\n  extractSelection1->Update();\n\n  vtkNew<vtkExtractSelection> extractSelection2;\n  extractSelection2->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelection2->SetInputData(1, selection2);\n  extractSelection2->Update();\n\n  vtkNew<vtkExtractSelection> extractSelectionCombined;\n  extractSelectionCombined->SetInputConnection(0, pointSource->GetOutputPort());\n  extractSelectionCombined->SetInputData(1, selectionCombined);\n  extractSelectionCombined->Update();\n\n  // In selection\n  vtkDataSet* ds =\n      dynamic_cast<vtkDataSet*>(extractSelectionCombined->GetOutput());\n  std::cout << \"There are \" << ds->GetNumberOfPoints()\n            << \" points in the selection.\" << std::endl;\n  std::cout << \"There are \" << ds->GetNumberOfCells()\n            << \" cells in the selection.\" << std::endl;\n\n  /*\n  // Not in selection.\n  // Here we nvert the selections.\n  selectionNode1->GetProperties()->Set(vtkSelectionNode::INVERSE(), 1);\n  selectionNode2->GetProperties()->Set(vtkSelectionNode::INVERSE(), 1);\n  extractSelectionCombined->Update();\n  std::cout << \"There are \"\n            << dynamic_cast<vtkDataSet*>(extractSelectionCombined->GetOutput())\n                   ->GetNumberOfPoints()\n            << \" points not in the selection.\" << std::endl;\n  std::cout << \"There are \"\n            << dynamic_cast<vtkDataSet*>(extractSelectionCombined->GetOutput())\n                   ->GetNumberOfCells()\n            << \" cells not in the selection.\" << std::endl;\n  */\n\n  // Visualize\n  vtkNew<vtkDataSetMapper> mapperOriginal;\n  mapperOriginal->SetInputConnection(pointSource->GetOutputPort());\n  mapperOriginal->ScalarVisibilityOff();\n\n  vtkNew<vtkDataSetMapper> mapper1;\n  mapper1->SetInputConnection(extractSelection1->GetOutputPort());\n  mapper1->ScalarVisibilityOff();\n\n  vtkNew<vtkDataSetMapper> mapper2;\n  mapper2->SetInputConnection(extractSelection2->GetOutputPort());\n  mapper2->ScalarVisibilityOff();\n\n  vtkNew<vtkDataSetMapper> mapperCombined;\n  mapperCombined->SetInputConnection(extractSelectionCombined->GetOutputPort());\n  mapperCombined->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(mapperOriginal);\n  originalActor->GetProperty()->SetPointSize(5);\n  originalActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetPointSize(5);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetPointSize(5);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkActor> actorCombined;\n  actorCombined->SetMapper(mapperCombined);\n  actorCombined->GetProperty()->SetPointSize(5);\n  actorCombined->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(1000, 250);\n  renderWindow->SetWindowName(\"MergeSelections\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  double originalViewport[4] = {0.0, 0.0, 0.25, 1.0};\n  double selection1Viewport[4] = {0.25, 0.0, 0.5, 1.0};\n  double selection2Viewport[4] = {0.5, 0.0, 0.75, 1.0};\n  double selectionCombinedViewport[4] = {0.75, 0.0, 1.0, 1.0};\n\n  // Create a camera for all renderers\n  vtkNew<vtkCamera> camera;\n\n  vtkNew<vtkRenderer> originalRenderer;\n  originalRenderer->SetViewport(originalViewport);\n  originalRenderer->SetBackground(colors->GetColor3d(\"Ren0\").GetData());\n  originalRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> selection1Renderer;\n  selection1Renderer->SetViewport(selection1Viewport);\n  selection1Renderer->SetBackground(colors->GetColor3d(\"Ren1\").GetData());\n  selection1Renderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> selection2Renderer;\n  selection2Renderer->SetViewport(selection2Viewport);\n  selection2Renderer->SetBackground(colors->GetColor3d(\"Ren2\").GetData());\n  selection2Renderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> selectionCombinedRenderer;\n  selectionCombinedRenderer->SetViewport(selectionCombinedViewport);\n  selectionCombinedRenderer->SetBackground(\n      colors->GetColor3d(\"Ren3\").GetData());\n  selectionCombinedRenderer->SetActiveCamera(camera);\n\n  renderWindow->AddRenderer(originalRenderer);\n  renderWindow->AddRenderer(selection1Renderer);\n  renderWindow->AddRenderer(selection2Renderer);\n  renderWindow->AddRenderer(selectionCombinedRenderer);\n\n  originalRenderer->AddActor(originalActor);\n  selection1Renderer->AddActor(actor1);\n  selection2Renderer->AddActor(actor2);\n  selectionCombinedRenderer->AddActor(actorCombined);\n\n  originalRenderer->ResetCamera();\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/MergeSelections/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MergeSelections)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersExtraction\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MergeSelections: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MergeSelections MACOSX_BUNDLE MergeSelections.cxx )\n  target_link_libraries(MergeSelections PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MergeSelections\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/MergeSelections/#download-and-build-mergeselections","title":"Download and Build MergeSelections","text":"

        Click here to download MergeSelections and its CMakeLists.txt file. Once the tarball MergeSelections.tar has been downloaded and extracted,

        cd MergeSelections/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MergeSelections\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/MeshQuality/","title":"MeshQuality","text":"

        vtk-examples/Cxx/PolyData/MeshQuality

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/MeshQuality/#description","title":"Description","text":"

        This example uses one of many selectable methods to determine the quality of a mesh. In this case, we have selected to use the area of the triangles. We show how to retrieve the quality metric computed on each triangle after the process is completed.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/MeshQuality/#code","title":"Code","text":"

        MeshQuality.cxx

        #include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkColorSeries.h>\n#include <vtkDoubleArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMeshQuality.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n\n#include <iostream>\n#include <string>\n\nvoid MakeLUT(vtkLookupTable* lut)\n{\n  // Make the lookup table.\n  vtkNew<vtkColorSeries> colorSeries;\n  // Select a color scheme.\n  int colorSeriesEnum;\n  colorSeriesEnum = colorSeries->BREWER_DIVERGING_BROWN_BLUE_GREEN_9;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_10;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_3;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_PURPLE_ORANGE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_PURPLE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_GREEN_9;\n  // colorSeriesEnum = colorSeries->BREWER_QUALITATIVE_SET3;\n  // colorSeriesEnum = colorSeries->CITRUS;\n  colorSeries->SetColorScheme(colorSeriesEnum);\n\n  colorSeries->BuildLookupTable(lut);\n  lut->SetNanColor(1, 0, 0, 1);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(sphereSource->GetOutputPort());\n  triangleFilter->Update();\n\n  vtkPolyData* mesh = triangleFilter->GetOutput();\n  std::cout << \"There are \" << mesh->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n\n  vtkNew<vtkMeshQuality> qualityFilter;\n  qualityFilter->SetInputData(mesh);\n  qualityFilter->SetTriangleQualityMeasureToArea();\n  qualityFilter->Update();\n\n  auto qualityArray = dynamic_cast<vtkDoubleArray*>(\n      qualityFilter->GetOutput()->GetCellData()->GetArray(\"Quality\"));\n\n  std::cout << \"There are \" << qualityArray->GetNumberOfTuples() << \" values.\"\n            << std::endl;\n\n  for (vtkIdType i = 0; i < qualityArray->GetNumberOfTuples(); i++)\n  {\n    double val = qualityArray->GetValue(i);\n    std::cout << \"value \" << i << \" : \" << val << std::endl;\n  }\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->ShallowCopy(qualityFilter->GetOutput());\n\n  // Visualize\n\n  vtkNew<vtkLookupTable> lut;\n  MakeLUT(lut);\n  lut->SetTableRange(polydata->GetScalarRange());\n  lut->IndexedLookupOff();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n  mapper->SetScalarRange(polydata->GetScalarRange());\n  mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MeshQuality\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/MeshQuality/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MeshQuality)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  FiltersVerdict\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MeshQuality: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MeshQuality MACOSX_BUNDLE MeshQuality.cxx )\n  target_link_libraries(MeshQuality PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MeshQuality\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/MeshQuality/#download-and-build-meshquality","title":"Download and Build MeshQuality","text":"

        Click here to download MeshQuality and its CMakeLists.txt file. Once the tarball MeshQuality.tar has been downloaded and extracted,

        cd MeshQuality/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MeshQuality\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/MiscCellData/","title":"MiscCellData","text":"

        vtk-examples/Cxx/PolyData/MiscCellData

        "},{"location":"Cxx/PolyData/MiscCellData/#description","title":"Description","text":"

        This demo attaches a double to a cell (triangle) in a polydata.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/MiscCellData/#code","title":"Code","text":"

        MiscCellData.cxx

        #include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkTriangle.h>\n#include <vtkXMLPolyDataWriter.h>\n\nint main(int, char*[])\n{\n  // We will write the resulting file to output.vtp so it can be inspected in\n  // Paraview.\n  std::string outputFilename = \"output.vtp\";\n\n  // Setup 3 points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Create a triangle\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n\n  // Add the triangle to a cell array\n  vtkNew<vtkCellArray> triangles;\n  triangles->InsertNextCell(triangle);\n\n  // Setup data for the triangle. Attach a value of 1.45.\n  // This can be anything you wish to store with it.\n  vtkNew<vtkDoubleArray> triangleData;\n  triangleData->SetNumberOfComponents(\n      1); // We will have only 1 value associated with the triangle.\n  triangleData->SetName(\"TriangleData\"); // Set the name of the value.\n  triangleData->InsertNextValue(1.45);   // Set the actual value.\n\n  // Create a polydata that contains the points,\n  // the triangle on those points, and the data\n  // array (value) we created for the triangle.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetPolys(triangles);\n  polydata->GetCellData()->AddArray(triangleData);\n\n  // Write the file.\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetInputData(polydata);\n  writer->SetFileName(outputFilename.c_str());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/MiscCellData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MiscCellData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MiscCellData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MiscCellData MACOSX_BUNDLE MiscCellData.cxx )\n  target_link_libraries(MiscCellData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MiscCellData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/MiscCellData/#download-and-build-misccelldata","title":"Download and Build MiscCellData","text":"

        Click here to download MiscCellData and its CMakeLists.txt file. Once the tarball MiscCellData.tar has been downloaded and extracted,

        cd MiscCellData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MiscCellData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/MiscPointData/","title":"MiscPointData","text":"

        vtk-examples/Cxx/PolyData/MiscPointData

        "},{"location":"Cxx/PolyData/MiscPointData/#description","title":"Description","text":"

        This demo attaches a vector (in this case a float vector of length 1) to each point in a polydata.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/MiscPointData/#code","title":"Code","text":"

        MiscPointData.cxx

        #include <vtkFloatArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required arguments: Filename e.g. cowHead.vtp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Get filename from command line.\n  std::string filename = argv[1]; // First command line argument.\n\n  // Read the file\n  vtkNew<vtkXMLPolyDataReader> reader;\n  std::cout << \"Reading \" << filename << std::endl;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Extract the polydata.\n  auto polydata = reader->GetOutput();\n\n  // Get the number of points in the polydata.\n  vtkIdType idNumPointsInFile = polydata->GetNumberOfPoints();\n\n  // Add distances to each point\n  vtkNew<vtkFloatArray> distances;\n  distances->SetNumberOfComponents(1);\n  distances->SetName(\"Distances\");\n\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n\n  for (vtkIdType i = 0; i < idNumPointsInFile; i++)\n  {\n    distances->InsertNextValue(rng->GetRangeValue(0.0, 1.0));\n    rng->Next();\n  }\n\n  polydata->GetPointData()->AddArray(distances);\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/MiscPointData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MiscPointData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MiscPointData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MiscPointData MACOSX_BUNDLE MiscPointData.cxx )\n  target_link_libraries(MiscPointData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MiscPointData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/MiscPointData/#download-and-build-miscpointdata","title":"Download and Build MiscPointData","text":"

        Click here to download MiscPointData and its CMakeLists.txt file. Once the tarball MiscPointData.tar has been downloaded and extracted,

        cd MiscPointData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MiscPointData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/MultiBlockMergeFilter/","title":"MultiBlockMergeFilter","text":"

        vtk-examples/Cxx/PolyData/MultiBlockMergeFilter

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/MultiBlockMergeFilter/#code","title":"Code","text":"

        MultiBlockMergeFilter.cxx

        #include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockMergeFilter.h>\n#include <vtkNew.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->Update();\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10, 10, 10);\n  sphereSource2->Update();\n\n  vtkNew<vtkMultiBlockDataSet> multiBlockDataSet1;\n  multiBlockDataSet1->SetNumberOfBlocks(1);\n  multiBlockDataSet1->SetBlock(0, sphereSource1->GetOutput());\n\n  vtkNew<vtkMultiBlockDataSet> multiBlockDataSet2;\n  multiBlockDataSet2->SetNumberOfBlocks(1);\n  multiBlockDataSet2->SetBlock(0, sphereSource2->GetOutput());\n\n  vtkNew<vtkMultiBlockMergeFilter> multiBlockMergeFilter;\n  multiBlockMergeFilter->AddInputData(multiBlockDataSet1);\n  multiBlockMergeFilter->AddInputData(multiBlockDataSet2);\n  multiBlockMergeFilter->Update();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/MultiBlockMergeFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultiBlockMergeFilter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultiBlockMergeFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultiBlockMergeFilter MACOSX_BUNDLE MultiBlockMergeFilter.cxx )\n  target_link_libraries(MultiBlockMergeFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultiBlockMergeFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/MultiBlockMergeFilter/#download-and-build-multiblockmergefilter","title":"Download and Build MultiBlockMergeFilter","text":"

        Click here to download MultiBlockMergeFilter and its CMakeLists.txt file. Once the tarball MultiBlockMergeFilter.tar has been downloaded and extracted,

        cd MultiBlockMergeFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MultiBlockMergeFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/NullPoint/","title":"NullPoint","text":"

        vtk-examples/Cxx/PolyData/NullPoint

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/NullPoint/#code","title":"Code","text":"

        NullPoint.cxx

        #include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90000000000ULL\n#define VTK_VER_GE_90 1\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(2, 2, 2);\n  points->InsertNextPoint(3, 3, 3);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkFloatArray> floatArray;\n  floatArray->SetNumberOfValues(3);\n  floatArray->SetNumberOfComponents(1);\n  floatArray->SetName(\"FloatArray\");\n  for (vtkIdType i = 0; i < 3; i++)\n  {\n    floatArray->SetValue(i, 2);\n  }\n  polydata->GetPointData()->AddArray(floatArray);\n\n  vtkNew<vtkIntArray> intArray;\n  intArray->SetNumberOfValues(3);\n  intArray->SetNumberOfComponents(1);\n  intArray->SetName(\"IntArray\");\n  for (vtkIdType i = 0; i < 3; i++)\n  {\n    intArray->SetValue(i, 2);\n  }\n\n  polydata->GetPointData()->AddArray(intArray);\n\n  for (vtkIdType i = 0; i < 3; i++)\n  {\n    double p[3];\n    polydata->GetPoint(i, p);\n    vtkFloatArray* pointsFloatArray = dynamic_cast<vtkFloatArray*>(\n        polydata->GetPointData()->GetArray(\"FloatArray\"));\n    vtkIntArray* pointsIntArray = dynamic_cast<vtkIntArray*>(\n        polydata->GetPointData()->GetArray(\"IntArray\"));\n    std::cout << \"Point \" << i << \" : \" << p[0] << \" \" << p[1] << \" \" << p[2]\n              << \" \" << pointsFloatArray->GetValue(i) << \" \"\n              << pointsIntArray->GetValue(i) << std::endl;\n  }\n\n#if VTK_VER_GE_90\n  polydata->GetPointData()->NullData(1);\n#else\n  polydata->GetPointData()->NullPoint(1);\n#endif\n  polydata->Modified();\n\n  for (vtkIdType i = 0; i < 3; i++)\n  {\n    double p[3];\n    polydata->GetPoint(i, p);\n    vtkFloatArray* pointsFloatArray = dynamic_cast<vtkFloatArray*>(\n        polydata->GetPointData()->GetArray(\"FloatArray\"));\n    vtkIntArray* pointsIntArray = dynamic_cast<vtkIntArray*>(\n        polydata->GetPointData()->GetArray(\"IntArray\"));\n    std::cout << \"Point \" << i << \" : \" << p[0] << \" \" << p[1] << \" \" << p[2]\n              << \" \" << pointsFloatArray->GetValue(i) << \" \"\n              << pointsIntArray->GetValue(i) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/NullPoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NullPoint)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NullPoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NullPoint MACOSX_BUNDLE NullPoint.cxx )\n  target_link_libraries(NullPoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NullPoint\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/NullPoint/#download-and-build-nullpoint","title":"Download and Build NullPoint","text":"

        Click here to download NullPoint and its CMakeLists.txt file. Once the tarball NullPoint.tar has been downloaded and extracted,

        cd NullPoint/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./NullPoint\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/OrientedBoundingCylinder/","title":"OrientedBoundingCylinder","text":"

        vtk-examples/Cxx/PolyData/OrientedBoundingCylinder

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/OrientedBoundingCylinder/#description","title":"Description","text":"

        This example creates an oriented cylinder that encloses a vtkPolyData. The axis of the cylinder is aligned with the longest axis of the vtkPolyData.

        The example proceeds as follow:

        1. A vtkOBBTree creates an oriented bounding box. The z dimension of the box is aligned with the longest axis.
        2. A vtkQuad finds the center of each face of the bounding box.
        3. A vtkLineSource creates a line from the centers of the long axis faces.
        4. vtkTubeFilter creates a \"cylinder\" from the lines with a radius equal to the an inner circle of bounding box.
        5. vtkExtractEnclosedPoints determines if there are points outside the initial guess.
        6. If there are points outside, the example does a linear search from the initial radius to the outer circle.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/OrientedBoundingCylinder/#code","title":"Code","text":"

        OrientedBoundingCylinder.cxx

        #include <vtkActor.h>\n#include <vtkCleanPolyData.h>\n#include <vtkExtractEnclosedPoints.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBBTree.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuad.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTubeFilter.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n#include <cctype> // For to_lower\n#include <cstdlib>\n#include <iostream>\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\ndouble MakeAQuad(std::vector<std::array<double, 3>>&, std::array<double, 3>&);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  // Get bounds of polydata.\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n\n  // Create the tree.\n  vtkNew<vtkOBBTree> obbTree;\n  obbTree->SetDataSet(polyData);\n  obbTree->SetMaxLevel(1);\n  obbTree->BuildLocator();\n\n  // Get the PolyData for the OBB.\n  vtkNew<vtkPolyData> obbPolydata;\n  obbTree->GenerateRepresentation(0, obbPolydata);\n\n  // Get the points of the OBB.\n  vtkNew<vtkPoints> obbPoints;\n  obbPoints->DeepCopy(obbPolydata->GetPoints());\n\n  // Use a quad to find centers of OBB faces.\n  vtkNew<vtkQuad> aQuad;\n\n  std::vector<std::array<double, 3>> facePoints(4);\n  std::vector<std::array<double, 3>> centers(3);\n  std::vector<std::array<double, 3>> endPoints(3);\n\n  std::array<double, 3> center;\n  std::array<double, 3> endPoint;\n  std::array<double, 3> point0, point1, point2, point3, point4, point5, point6,\n      point7;\n  std::array<double, 3> radii;\n  std::array<double, 3> lengths;\n\n  // Transfer the points to std::array's.\n  obbPoints->GetPoint(0, point0.data());\n  obbPoints->GetPoint(1, point1.data());\n  obbPoints->GetPoint(2, point2.data());\n  obbPoints->GetPoint(3, point3.data());\n  obbPoints->GetPoint(4, point4.data());\n  obbPoints->GetPoint(5, point5.data());\n  obbPoints->GetPoint(6, point6.data());\n  obbPoints->GetPoint(7, point7.data());\n\n  // x face.\n  // ids[0] = 2; ids[1] = 3; ids[2] = 7; ids[3] = 6;\n  facePoints[0] = point2;\n  facePoints[1] = point3;\n  facePoints[2] = point7;\n  facePoints[3] = point6;\n  radii[0] = MakeAQuad(facePoints, centers[0]);\n  MakeAQuad(facePoints, centers[0]);\n  // ids[0] = 0; ids[1] = 4; ids[2] = 5; ids[3] = 1;\n  facePoints[0] = point0;\n  facePoints[1] = point4;\n  facePoints[2] = point5;\n  facePoints[3] = point1;\n  MakeAQuad(facePoints, endPoints[0]);\n  lengths[0] = std::sqrt(vtkMath::Distance2BetweenPoints(centers[0].data(),\n                                                         endPoints[0].data())) /\n      2.0;\n\n  // y face.\n  // ids[0] = 0; ids[1] = 1; ids[2] = 2; ids[3] = 3;\n  facePoints[0] = point0;\n  facePoints[1] = point1;\n  facePoints[2] = point2;\n  facePoints[3] = point3;\n  radii[1] = MakeAQuad(facePoints, centers[1]);\n  // ids[0] = 4; ids[1] = 6; ids[2] = 7; ids[3] = 5;\n  facePoints[0] = point4;\n  facePoints[1] = point6;\n  facePoints[2] = point7;\n  facePoints[3] = point5;\n  MakeAQuad(facePoints, endPoints[1]);\n  lengths[1] = std::sqrt(vtkMath::Distance2BetweenPoints(centers[1].data(),\n                                                         endPoints[1].data())) /\n      2.0;\n\n  // z face.\n  // ids[0] = 0; ids[1] = 2; ids[2] = 6; ids[3] = 4;\n  facePoints[0] = point0;\n  facePoints[1] = point2;\n  facePoints[2] = point6;\n  facePoints[3] = point4;\n  MakeAQuad(facePoints, centers[2]);\n  radii[2] =\n      std::sqrt(vtkMath::Distance2BetweenPoints(point0.data(), point2.data())) /\n      2.0;\n  double outerRadius =\n      std::sqrt(vtkMath::Distance2BetweenPoints(point0.data(), point6.data())) /\n      2.0;\n\n  // ids[0] = 1; ids[1] = 3; ids[2] = 7; ids[3] = 5;\n  facePoints[0] = point1;\n  facePoints[1] = point5;\n  facePoints[2] = point7;\n  facePoints[3] = point3;\n  MakeAQuad(facePoints, endPoints[2]);\n  lengths[2] = std::sqrt(vtkMath::Distance2BetweenPoints(centers[2].data(),\n                                                         endPoints[2].data())) /\n      2.0;\n\n  // Find long axis.\n  int longAxis = -1;\n  double length = VTK_DOUBLE_MIN;\n  for (auto i = 0; i < 3; ++i)\n  {\n    std::cout << \"length: \" << lengths[i] << std::endl;\n    if (lengths[i] > length)\n    {\n      length = lengths[i];\n      longAxis = i;\n    }\n  }\n  std::cout << \"longAxis: \" << longAxis << std::endl;\n  std::cout << \"radii: \";\n  double radius = radii[longAxis];\n  for (auto& a : radii)\n  {\n    std::cout << a << \", \";\n  }\n  std::cout << std::endl;\n  std::cout << \"radius: \" << radius << std::endl;\n  std::cout << \"outerRadius: \" << outerRadius << std::endl;\n  center = centers[longAxis];\n  endPoint = endPoints[longAxis];\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(center.data());\n  lineSource->SetPoint2(endPoint.data());\n\n  vtkNew<vtkTubeFilter> tube;\n  tube->SetInputConnection(lineSource->GetOutputPort());\n  tube->SetRadius(radius);\n  tube->SetNumberOfSides(51);\n  tube->CappingOn();\n  tube->Update();\n\n  // See if all points lie inside cylinder.\n  vtkNew<vtkCleanPolyData> clean;\n  clean->SetInputData(tube->GetOutput());\n  clean->Update();\n\n  vtkNew<vtkExtractEnclosedPoints> enclosedPoints;\n  enclosedPoints->SetSurfaceData(clean->GetOutput());\n  enclosedPoints->SetInputData(polyData);\n  enclosedPoints->SetTolerance(.0001);\n  enclosedPoints->GenerateOutliersOn();\n  enclosedPoints->CheckSurfaceOn();\n  enclosedPoints->Update();\n\n  std::cout << \"polyData points: \" << polyData->GetPoints()->GetNumberOfPoints()\n            << \" excluded points: \"\n            << enclosedPoints->GetOutput(1)->GetPoints()->GetNumberOfPoints()\n            << std::endl;\n\n  vtkNew<vtkPolyDataMapper> repMapper;\n  repMapper->SetInputData(obbPolydata);\n  vtkNew<vtkActor> repActor;\n  repActor->SetMapper(repMapper);\n  repActor->GetProperty()->SetColor(colors->GetColor3d(\"peacock\").GetData());\n  repActor->GetProperty()->SetOpacity(.6);\n\n  // Create a mapper and actor for the cylinder.\n  vtkNew<vtkPolyDataMapper> cylinderMapper;\n  cylinderMapper->SetInputConnection(tube->GetOutputPort());\n\n  vtkNew<vtkActor> cylinderActor;\n\n  cylinderActor->SetMapper(cylinderMapper);\n  cylinderActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"banana\").GetData());\n  cylinderActor->GetProperty()->SetOpacity(.5);\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputData(polyData);\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"tomato\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  // Display all centers and endpoints.\n  std::vector<vtkColor3d> cs;\n  cs.push_back(colors->GetColor3d(\"red\"));\n  cs.push_back(colors->GetColor3d(\"green\"));\n  cs.push_back(colors->GetColor3d(\"blue\"));\n  for (auto i = 0; i < 3; ++i)\n  {\n    vtkNew<vtkSphereSource> ps1;\n    ps1->SetCenter(centers[i].data());\n    ps1->SetRadius(length * .04);\n    ps1->SetPhiResolution(21);\n    ps1->SetThetaResolution(41);\n    vtkNew<vtkPolyDataMapper> pm1;\n    pm1->SetInputConnection(ps1->GetOutputPort());\n    vtkNew<vtkActor> pa1;\n    pa1->GetProperty()->SetColor(cs[i].GetData());\n    pa1->GetProperty()->SetSpecularPower(50);\n    pa1->GetProperty()->SetSpecular(.4);\n    pa1->GetProperty()->SetDiffuse(.6);\n    pa1->SetMapper(pm1);\n    renderer->AddActor(pa1);\n\n    vtkNew<vtkSphereSource> ps2;\n    ps2->SetCenter(endPoints[i].data());\n    ps2->SetRadius(length * .04);\n    ps2->SetPhiResolution(21);\n    ps2->SetThetaResolution(41);\n    vtkNew<vtkPolyDataMapper> pm2;\n    pm2->SetInputConnection(ps2->GetOutputPort());\n    vtkNew<vtkActor> pa2;\n    pa2->GetProperty()->SetColor(cs[i].GetData());\n    pa2->SetMapper(pm2);\n    renderer->AddActor(pa2);\n  }\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OrientedBoundingCylinder\");\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  // Add the actors to the scene.\n  renderer->AddActor(originalActor);\n  renderer->AddActor(cylinderActor);\n  //  renderer->AddActor(repActor);\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"SkyBlue\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"LightSeaGreen\").GetData());\n\n  // double adjustedRadius = radius;\n  double adjustedIncr = (outerRadius - radius) / 20.0;\n  if (enclosedPoints->GetOutput(1)->GetPoints()->GetNumberOfPoints() > 4)\n  {\n    std::cout << \"improving...\" << std::endl;\n    for (double r = radius;\n         enclosedPoints->GetOutput(1)->GetPoints()->GetNumberOfPoints() > 4;\n         r += adjustedIncr)\n    {\n      tube->SetRadius(r);\n      tube->Update();\n      clean->Update();\n      enclosedPoints->Update();\n      if (enclosedPoints->GetOutput(1)->GetPoints() != nullptr)\n      {\n        std::cout << \"r: \" << r << std::endl;\n        std::cout\n            << \" excluded points: \"\n            << enclosedPoints->GetOutput(1)->GetPoints()->GetNumberOfPoints()\n            << std::endl;\n        renderWindow->Render();\n      }\n      else\n      {\n        break;\n      }\n    }\n  }\n\n  // Render and interact.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase.\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\ndouble MakeAQuad(std::vector<std::array<double, 3>>& points,\n                 std::array<double, 3>& center)\n{\n  vtkNew<vtkQuad> aQuad;\n  aQuad->GetPoints()->SetPoint(0, points[0].data());\n  aQuad->GetPoints()->SetPoint(1, points[1].data());\n  aQuad->GetPoints()->SetPoint(2, points[2].data());\n  aQuad->GetPoints()->SetPoint(3, points[3].data());\n  aQuad->GetPointIds()->SetId(0, 0);\n  aQuad->GetPointIds()->SetId(1, 1);\n  aQuad->GetPointIds()->SetId(2, 2);\n  aQuad->GetPointIds()->SetId(3, 3);\n\n  std::array<double, 3> pcenter;\n  pcenter[0] = pcenter[1] = pcenter[2] = -12345.0;\n  aQuad->GetParametricCenter(pcenter.data());\n  std::vector<double> cweights(aQuad->GetNumberOfPoints());\n  int pSubId = 0;\n  aQuad->EvaluateLocation(pSubId, pcenter.data(), center.data(),\n                          &(*cweights.begin()));\n\n  std::cout << \"center: \";\n  for (auto& a : center)\n  {\n    std::cout << a << \", \";\n  }\n  std::cout << std::endl;\n\n  return std::sqrt(aQuad->GetLength2()) / 2.0;\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/OrientedBoundingCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientedBoundingCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersPoints\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientedBoundingCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientedBoundingCylinder MACOSX_BUNDLE OrientedBoundingCylinder.cxx )\n  target_link_libraries(OrientedBoundingCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientedBoundingCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/OrientedBoundingCylinder/#download-and-build-orientedboundingcylinder","title":"Download and Build OrientedBoundingCylinder","text":"

        Click here to download OrientedBoundingCylinder and its CMakeLists.txt file. Once the tarball OrientedBoundingCylinder.tar has been downloaded and extracted,

        cd OrientedBoundingCylinder/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OrientedBoundingCylinder\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/Outline/","title":"Outline","text":"

        vtk-examples/Cxx/PolyData/Outline

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/Outline/#description","title":"Description","text":"

        This example shows how to draw the outline of the dataset.

        Seealso

        BoundingBox and CubeAxesActor2D.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/Outline/#code","title":"Code","text":"

        Outline.cxx

        #include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cone.\n  vtkNew<vtkConeSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetResolution(100);\n  source->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the outline.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Setup the window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Outline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor(outlineActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/Outline/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Outline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Outline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Outline MACOSX_BUNDLE Outline.cxx )\n  target_link_libraries(Outline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Outline\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/Outline/#download-and-build-outline","title":"Download and Build Outline","text":"

        Click here to download Outline and its CMakeLists.txt file. Once the tarball Outline.tar has been downloaded and extracted,

        cd Outline/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Outline\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ParametricSpline/","title":"ParametricSpline","text":"

        vtk-examples/Cxx/PolyData/ParametricSpline

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ParametricSpline/#code","title":"Code","text":"

        ParametricSpline.cxx

        #include <vtkActor.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create three points. We will join (Origin and P0) with a red line and\n  // (Origin and P1) with a green line.\n  double origin[3] = {0.0, 0.0, 0.0};\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {0.0, 1.0, 0.0};\n  double p2[3] = {0.0, 1.0, 2.0};\n  double p3[3] = {1.0, 2.0, 3.0};\n\n  // Create a vtkPoints object and store the points in it.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(origin);\n  points->InsertNextPoint(p0);\n  points->InsertNextPoint(p1);\n  points->InsertNextPoint(p2);\n  points->InsertNextPoint(p3);\n\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetPoints(points);\n\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->Update();\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(0.1);\n\n  // Setup actor and mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(functionSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DarkSlateGrey\").GetData());\n  actor->GetProperty()->SetLineWidth(3.0);\n\n  // Create a polydata to store everything in.\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputData(polyData);\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ParametricSpline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->AddActor(pointActor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ParametricSpline/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ParametricSpline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ParametricSpline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ParametricSpline MACOSX_BUNDLE ParametricSpline.cxx )\n  target_link_libraries(ParametricSpline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ParametricSpline\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ParametricSpline/#download-and-build-parametricspline","title":"Download and Build ParametricSpline","text":"

        Click here to download ParametricSpline and its CMakeLists.txt file. Once the tarball ParametricSpline.tar has been downloaded and extracted,

        cd ParametricSpline/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ParametricSpline\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PointCellIds/","title":"PointCellIds","text":"

        vtk-examples/Cxx/PolyData/PointCellIds

        "},{"location":"Cxx/PolyData/PointCellIds/#description","title":"Description","text":"

        This example demonstrates how to get the number of Ids in points and cells.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PointCellIds/#code","title":"Code","text":"

        PointCellIds.cxx

        #include <vtkCellData.h>\n#include <vtkIdFilter.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfPoints()\n            << \" points.\" << std::endl;\n  std::cout << \"There are \" << sphereSource->GetOutput()->GetNumberOfCells()\n            << \" cells.\" << std::endl;\n\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputConnection(sphereSource->GetOutputPort());\n#if VTK890\n  idFilter->SetPointIdsArrayName(\"ids\");\n  idFilter->SetCellIdsArrayName(\"ids\");\n#else\n  idFilter->SetIdsArrayName(\"ids\");\n#endif\n  idFilter->Update();\n\n  std::cout << \"point arrays: \" << std::endl;\n  for (vtkIdType i = 0;\n       i < idFilter->GetOutput()->GetPointData()->GetNumberOfArrays(); i++)\n  {\n    std::cout << idFilter->GetOutput()->GetPointData()->GetArrayName(i)\n              << std::endl;\n  }\n\n  std::cout << \"cell arrays: \" << std::endl;\n  for (vtkIdType i = 0;\n       i < idFilter->GetOutput()->GetCellData()->GetNumberOfArrays(); i++)\n  {\n    std::cout << idFilter->GetOutput()->GetCellData()->GetArrayName(i)\n              << std::endl;\n  }\n\n  vtkIdTypeArray* pointIds = dynamic_cast<vtkIdTypeArray*>(\n      idFilter->GetOutput()->GetPointData()->GetArray(\"ids\"));\n  std::cout << \"There are \" << pointIds->GetNumberOfTuples() << \" point ids\"\n            << std::endl;\n\n  vtkIdTypeArray* cellIds = dynamic_cast<vtkIdTypeArray*>(\n      idFilter->GetOutput()->GetCellData()->GetArray(\"ids\"));\n  std::cout << \"There are \" << cellIds->GetNumberOfTuples() << \" cell ids\"\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PointCellIds/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointCellIds)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointCellIds: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointCellIds MACOSX_BUNDLE PointCellIds.cxx )\n  target_link_libraries(PointCellIds PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointCellIds\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PointCellIds/#download-and-build-pointcellids","title":"Download and Build PointCellIds","text":"

        Click here to download PointCellIds and its CMakeLists.txt file. Once the tarball PointCellIds.tar has been downloaded and extracted,

        cd PointCellIds/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointCellIds\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PointInsideObject/","title":"PointInsideObject","text":"

        vtk-examples/Cxx/PolyData/PointInsideObject

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/PointInsideObject/#description","title":"Description","text":"

        This example creates a cube at the origin with side 1. Then it checks if the points are inside the cube. There is one point inside, one in the border and one outside. The answer for the first one should be yes, and for the other two, no.

        Then render the cube and the points to see the result.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PointInsideObject/#code","title":"Code","text":"

        PointInsideObject.cxx

        #include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkDataArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelectEnclosedPoints.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A cube centered on the origin, 1cm sides.\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  vtkPolyData* cube = cubeSource->GetOutput();\n\n  double testInside[3] = {0.0, 0.0, 0.0};\n  double testOutside[3] = {0.7, 0.0, 0.0};\n  double testBorderOutside[3] = {0.5, 0.0, 0.0};\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(testInside);\n  points->InsertNextPoint(testOutside);\n  points->InsertNextPoint(testBorderOutside);\n\n  vtkNew<vtkPolyData> pointsPolydata;\n  pointsPolydata->SetPoints(points);\n\n  // Points inside test.\n  vtkNew<vtkSelectEnclosedPoints> selectEnclosedPoints;\n  selectEnclosedPoints->SetInputData(pointsPolydata);\n  selectEnclosedPoints->SetSurfaceData(cube);\n  selectEnclosedPoints->Update();\n\n  for (unsigned int i = 0; i < 3; ++i)\n  {\n    std::cout << \"Point \" << i << \": \";\n    if (selectEnclosedPoints->IsInside(i) == 1)\n    {\n      std::cout << \"inside\" << std::endl;\n    }\n    else\n    {\n      std::cout << \"outside\" << std::endl;\n    }\n  }\n\n  auto insideArray = dynamic_cast<vtkDataArray*>(\n      selectEnclosedPoints->GetOutput()->GetPointData()->GetArray(\n          \"SelectedPoints\"));\n\n  for (vtkIdType i = 0; i < insideArray->GetNumberOfTuples(); ++i)\n  {\n    std::cout << \"Tuple \" << i << \": \";\n    if (insideArray->GetComponent(i, 0) == 1)\n    {\n      std::cout << \"inside\" << std::endl;\n    }\n    else\n    {\n      std::cout << \"outside\" << std::endl;\n    }\n  }\n\n  // RENDERING PART\n\n  // Cube mapper, actor.\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetOpacity(0.5);\n  cubeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"SandyBrown\").GetData());\n\n  // Points mapper, actor.\n  // First, apply vtkVertexGlyphFilter to make cells around points, vtk only\n  // render cells.\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->AddInputData(pointsPolydata);\n  vertexGlyphFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetPointSize(5);\n  pointsActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"GreenYellow\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointCellIds\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(cubeActor);\n  renderer->AddActor(pointsActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PointInsideObject/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointInsideObject)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointInsideObject: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointInsideObject MACOSX_BUNDLE PointInsideObject.cxx )\n  target_link_libraries(PointInsideObject PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointInsideObject\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PointInsideObject/#download-and-build-pointinsideobject","title":"Download and Build PointInsideObject","text":"

        Click here to download PointInsideObject and its CMakeLists.txt file. Once the tarball PointInsideObject.tar has been downloaded and extracted,

        cd PointInsideObject/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointInsideObject\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PointInsideObject2/","title":"PointInsideObject2","text":"

        vtk-examples/Cxx/PolyData/PointInsideObject2

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/PointInsideObject2/#description","title":"Description","text":"

        This example creates a volume (convex hull-ish) out of a mesh object. It then uses FindCell (which determines if a point is inside of a cell) to determine if a point is inside of any of the 3D cells created by Delaunay3D or not. This could potentially lead to false positives - that is, points that are outside the mesh but inside the convex hull.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PointInsideObject2/#code","title":"Code","text":"

        PointInsideObject2.cxx

        #include <vtkActor.h>\n#include <vtkDelaunay3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmoothPolyDataFilter.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> bigSphereSource;\n  bigSphereSource->SetCenter(0.0, 0.0, 0.0);\n  bigSphereSource->SetRadius(4);\n  bigSphereSource->SetThetaResolution(20);\n  bigSphereSource->SetPhiResolution(20);\n  bigSphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> bigSphereMapper;\n  bigSphereMapper->SetInputConnection(bigSphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> bigSphereActor;\n  bigSphereActor->SetMapper(bigSphereMapper);\n  bigSphereActor->GetProperty()->SetOpacity(0.5);\n  bigSphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkSphereSource> smallSphereSource;\n  smallSphereSource->SetCenter(1, 2, 1);\n  smallSphereSource->SetRadius(2);\n  smallSphereSource->SetThetaResolution(20);\n  smallSphereSource->SetPhiResolution(20);\n  smallSphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> smallSphereMapper;\n  smallSphereMapper->SetInputConnection(smallSphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> smallSphereActor;\n  smallSphereActor->SetMapper(smallSphereMapper);\n  smallSphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Cornsilk\").GetData());\n\n  vtkNew<vtkPoints> pointsInside;\n  vtkNew<vtkPolyData> polyDataInside;\n  double point[3];\n\n  // We generate points inside a spherical area defined by bigSphereSource.\n  // Then we apply delaunay3D to it instead on  bigSphereSource.\n  // This will avoid the \"Unable to factor linear system\" warnings cuused by\n  //  degenerate points on the sphere.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(400);\n  // Slightly larger than the radius of the big sphere\n  pointSource->SetRadius(4.2);\n\n  vtkNew<vtkSmoothPolyDataFilter> smoothFilter;\n  smoothFilter->SetInputConnection(0, bigSphereSource->GetOutputPort());\n  smoothFilter->SetInputConnection(1, pointSource->GetOutputPort());\n\n  vtkNew<vtkDelaunay3D> delaunay3D;\n  // delaunay3D->SetInputConnection(bigSphereSource->GetOutputPort());\n  delaunay3D->SetInputConnection(smoothFilter->GetOutputPort());\n  delaunay3D->Update();\n\n  for (vtkIdType i = 0; i < smallSphereSource->GetOutput()->GetNumberOfPoints();\n       i++)\n  {\n    smallSphereSource->GetOutput()->GetPoint(i, point);\n\n    double pcoords[3];\n    // The number of weights >= max number of nodes in each cell.\n    double weights[4];\n    int subId;\n    vtkIdType cellId = delaunay3D->GetOutput()->FindCell(\n        point, nullptr, 0, 0.1, subId, pcoords, weights);\n\n    if (cellId >= 0)\n    {\n      std::cout << \"In cell \" << cellId << std::endl;\n      std::cout << \"inside\" << std::endl;\n      pointsInside->InsertNextPoint(point);\n    }\n    else\n    {\n      std::cout << \"outside\" << std::endl;\n    }\n  }\n\n  polyDataInside->SetPoints(pointsInside);\n\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->SetInputData(polyDataInside);\n  vertexGlyphFilter->Update();\n\n  // Mapper and actor for points inside.\n  vtkNew<vtkPolyDataMapper> pointsInsideMapper;\n  pointsInsideMapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n  vtkNew<vtkActor> pointsInsideActor;\n  pointsInsideActor->SetMapper(pointsInsideMapper);\n  pointsInsideActor->GetProperty()->SetPointSize(6);\n  pointsInsideActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Magenta\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointInsideObject2\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(smallSphereActor);\n  renderer->AddActor(bigSphereActor);\n  renderer->AddActor(pointsInsideActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PointInsideObject2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointInsideObject2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointInsideObject2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointInsideObject2 MACOSX_BUNDLE PointInsideObject2.cxx )\n  target_link_libraries(PointInsideObject2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointInsideObject2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PointInsideObject2/#download-and-build-pointinsideobject2","title":"Download and Build PointInsideObject2","text":"

        Click here to download PointInsideObject2 and its CMakeLists.txt file. Once the tarball PointInsideObject2.tar has been downloaded and extracted,

        cd PointInsideObject2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointInsideObject2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PointLocator/","title":"PointLocator","text":"

        vtk-examples/Cxx/PolyData/PointLocator

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/PointLocator/#description","title":"Description","text":"

        Create a point locator for a set of points. The 'n' (next) and 'p' (previous) keys change the resolution of the cells.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PointLocator/#code","title":"Code","text":"

        PointLocator.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointLocator.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nclass KeyPressInteractorStyle3 : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static KeyPressInteractorStyle3* New();\n\n  KeyPressInteractorStyle3() : PointsPerBucket(1)\n  {\n    pointLocator = nullptr;\n    renderWindow = nullptr;\n    polydata = nullptr;\n  }\n\n  virtual void OnChar()\n  {\n    vtkRenderWindowInteractor* rwi = this->Interactor;\n    char ch = rwi->GetKeyCode();\n\n    switch (ch)\n    {\n    case 'n':\n      cout << \"Next.\" << endl;\n      this->PointsPerBucket++;\n      break;\n    case 'p':\n      cout << \"Previous.\" << endl;\n      if (this->PointsPerBucket > 1)\n      {\n        this->PointsPerBucket--;\n      }\n      break;\n    default:\n      std::cout << \"An unhandled key was pressed.\" << std::endl;\n      break;\n    }\n\n    std::cout << \"PointsPerBucket = \" << this->PointsPerBucket << std::endl;\n\n    // Create the tree.\n    pointLocator->SetNumberOfPointsPerBucket(this->PointsPerBucket);\n    pointLocator->BuildLocator();\n    pointLocator->GenerateRepresentation(1, polydata);\n\n    renderWindow->Render();\n\n    // Forward events.\n    vtkInteractorStyleTrackballCamera::OnChar();\n  }\n\n  vtkPointLocator* pointLocator;\n  vtkRenderWindow* renderWindow;\n  vtkPolyData* polydata;\n\nprivate:\n  unsigned int PointsPerBucket;\n};\n\nvtkStandardNewMacro(KeyPressInteractorStyle3);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(4000);\n  pointSource->Update();\n\n  // Create the tree\n  vtkNew<vtkPointLocator> pointLocator;\n  pointLocator->SetDataSet(pointSource->GetOutput());\n  pointLocator->AutomaticOn();\n  pointLocator->SetNumberOfPointsPerBucket(2);\n  pointLocator->BuildLocator();\n\n  std::cout << \"There are \" << pointLocator->GetLevel() << \" levels.\"\n            << std::endl;\n  std::cout << \"There are \" << pointLocator->GetNumberOfPointsPerBucket()\n            << \" points per bucket.\" << endl;\n\n  vtkNew<vtkPolyData> polydata;\n  pointLocator->GenerateRepresentation(pointLocator->GetLevel(), polydata);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peru\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointLocator\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<KeyPressInteractorStyle3> style;\n  style->pointLocator = pointLocator;\n  style->renderWindow = renderWindow;\n  style->polydata = polydata;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Beige\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderWindow->SetWindowName(\"PointLocator\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PointLocator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointLocator)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointLocator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointLocator MACOSX_BUNDLE PointLocator.cxx )\n  target_link_libraries(PointLocator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointLocator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PointLocator/#download-and-build-pointlocator","title":"Download and Build PointLocator","text":"

        Click here to download PointLocator and its CMakeLists.txt file. Once the tarball PointLocator.tar has been downloaded and extracted,

        cd PointLocator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointLocator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PointLocatorRadius/","title":"PointLocatorRadius","text":"

        vtk-examples/Cxx/PolyData/PointLocatorRadius

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PointLocatorRadius/#code","title":"Code","text":"

        PointLocatorRadius.cxx

        #include <vtkIdList.h>\n#include <vtkNew.h>\n#include <vtkPointLocator.h>\n#include <vtkPointSource.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(400);\n  pointSource->Update();\n\n  // Create the tree.\n  vtkNew<vtkPointLocator> pointLocator;\n  pointLocator->SetDataSet(pointSource->GetOutput());\n  pointLocator->AutomaticOn();\n  pointLocator->SetNumberOfPointsPerBucket(2);\n  pointLocator->BuildLocator();\n\n  double radius = 0.1;\n  double center[3] = {0.0, 0.0, 0.0};\n  vtkNew<vtkIdList> result;\n  pointLocator->FindPointsWithinRadius(radius, center, result);\n\n  for (vtkIdType i = 0; i < result->GetNumberOfIds(); i++)\n  {\n    unsigned int id = result->GetId(i);\n    std::cout << \"id of point \" << i << \" : \" << id << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PointLocatorRadius/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointLocatorRadius)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointLocatorRadius: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointLocatorRadius MACOSX_BUNDLE PointLocatorRadius.cxx )\n  target_link_libraries(PointLocatorRadius PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointLocatorRadius\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PointLocatorRadius/#download-and-build-pointlocatorradius","title":"Download and Build PointLocatorRadius","text":"

        Click here to download PointLocatorRadius and its CMakeLists.txt file. Once the tarball PointLocatorRadius.tar has been downloaded and extracted,

        cd PointLocatorRadius/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointLocatorRadius\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PointLocatorVisualization/","title":"PointLocatorVisualization","text":"

        vtk-examples/Cxx/PolyData/PointLocatorVisualization

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/PointLocatorVisualization/#description","title":"Description","text":"

        The idea of this example is to navigate levels of a uniform spatial tree (vtkPointLocator) using a slider.

        Note

        It is not desirable to have PointsPerBucket set \"too small\". This is because at some point, refining a bucket will result in each cell in that bucket to also be in the bucket's children. This only wastes memory and computation. The value that is \"too small\" is dependent on the grid but in general a value between 10 and 100 should work well (the default value is 25).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PointLocatorVisualization/#code","title":"Code","text":"

        PointLocatorVisualization.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointLocator.h>\n#include <vtkPointSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n\nclass vtkSliderCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  vtkSliderCallback() : PointLocator(0), Level(0), PolyData(0), Renderer(0)\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->Level = vtkMath::Round(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->PointLocator->GenerateRepresentation(this->Level, this->PolyData);\n    this->Renderer->Render();\n  }\n\n  vtkPointLocator* PointLocator;\n  int Level;\n  vtkPolyData* PolyData;\n  vtkRenderer* Renderer;\n};\n\nvoid SetSliderColors(vtkSliderRepresentation2D* slider);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> inputSource;\n  inputSource->SetPhiResolution(10);\n  inputSource->SetThetaResolution(10);\n  inputSource->Update();\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(inputSource->GetOutputPort());\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  pointsActor->GetProperty()->SetInterpolationToFlat();\n  pointsActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Seashell\").GetData());\n\n  // Create the tree.\n  vtkNew<vtkPointLocator> pointLocator;\n  pointLocator->SetDataSet(inputSource->GetOutput());\n  pointLocator->BuildLocator();\n\n  // Initialize the representation.\n  vtkNew<vtkPolyData> polydata;\n  pointLocator->GenerateRepresentation(0, polydata);\n\n  vtkNew<vtkPolyDataMapper> locatorTreeMapper;\n  locatorTreeMapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> locatorTreeActor;\n  locatorTreeActor->SetMapper(locatorTreeMapper);\n  locatorTreeActor->GetProperty()->SetInterpolationToFlat();\n  locatorTreeActor->GetProperty()->SetRepresentationToWireframe();\n  locatorTreeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointLocatorVisualization\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(pointsActor);\n  renderer->AddActor(locatorTreeActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n  sliderRep->SetMinimumValue(0);\n  sliderRep->SetMaximumValue(pointLocator->GetLevel());\n  sliderRep->SetValue(0);\n  sliderRep->SetTitleText(\"MaxPointsPerRegion\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(0.2, 0.1);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(0.8, 0.1);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n  SetSliderColors(sliderRep);\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->PointLocator = pointLocator;\n  callback->PolyData = polydata;\n  callback->Renderer = renderer;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid SetSliderColors(vtkSliderRepresentation2D* slider)\n{\n  vtkNew<vtkNamedColors> colors;\n  // Set color properties:\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(colors->GetColor3d(\"Peru\").GetData());\n  // Change the color of the text indicating what the slider controls.\n  slider->GetTitleProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"DeepPink\").GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(colors->GetColor3d(\"Teal\").GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(colors->GetColor3d(\"Teal\").GetData());\n}\n\n} // namespace\n
        "},{"location":"Cxx/PolyData/PointLocatorVisualization/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointLocatorVisualization)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointLocatorVisualization: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointLocatorVisualization MACOSX_BUNDLE PointLocatorVisualization.cxx )\n  target_link_libraries(PointLocatorVisualization PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointLocatorVisualization\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PointLocatorVisualization/#download-and-build-pointlocatorvisualization","title":"Download and Build PointLocatorVisualization","text":"

        Click here to download PointLocatorVisualization and its CMakeLists.txt file. Once the tarball PointLocatorVisualization.tar has been downloaded and extracted,

        cd PointLocatorVisualization/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointLocatorVisualization\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PointSource/","title":"PointSource","text":"

        vtk-examples/Cxx/PolyData/PointSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PointSource/#code","title":"Code","text":"

        PointSource.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a point cloud.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetCenter(0.0, 0.0, 0.0);\n  pointSource->SetNumberOfPoints(50);\n  pointSource->SetRadius(5.0);\n  pointSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(pointSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->SetPointSize(4);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointSource\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PointSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointSource MACOSX_BUNDLE PointSource.cxx )\n  target_link_libraries(PointSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PointSource/#download-and-build-pointsource","title":"Download and Build PointSource","text":"

        Click here to download PointSource and its CMakeLists.txt file. Once the tarball PointSource.tar has been downloaded and extracted,

        cd PointSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PointsProjectedHull/","title":"PointsProjectedHull","text":"

        vtk-examples/Cxx/PolyData/PointsProjectedHull

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/PointsProjectedHull/#description","title":"Description","text":"

        This example demonstrates how to find the 2D convex hull of a point set projected onto any of the coordinate planes (in this case, we choose the YZ plane (projection along the x axis) ).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PointsProjectedHull/#code","title":"Code","text":"

        PointsProjectedHull.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPointsProjectedHull.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <memory>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(21);\n  sphere->SetThetaResolution(21);\n  sphere->SetRadius(.01);\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(40);\n  pointSource->Update();\n\n  // Setup actor and mapper.\n  vtkNew<vtkGlyph3DMapper> pointMapper;\n  pointMapper->SetInputConnection(pointSource->GetOutputPort());\n  pointMapper->SetSourceConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkPointsProjectedHull> points;\n  points->DeepCopy(pointSource->GetOutput()->GetPoints());\n\n  int xSize = points->GetSizeCCWHullX();\n  std::cout << \"xSize: \" << xSize << std::endl;\n\n  std::unique_ptr<double[]> pts{new double[xSize * 2]};\n\n  points->GetCCWHullX(pts.get(), xSize);\n\n  vtkNew<vtkPoints> xHullPoints;\n  for (int i = 0; i < xSize; i++)\n  {\n    double yval = pts[2 * i];\n    double zval = pts[2 * i + 1];\n    std::cout << \"(y,z) value of point \" << i << \" : (\" << yval << \" , \" << zval\n              << \")\" << std::endl;\n    xHullPoints->InsertNextPoint(0.0, yval, zval);\n  }\n  // Insert the first point again to close the loop.\n  xHullPoints->InsertNextPoint(0.0, pts[0], pts[1]);\n\n  // Display the x hull.\n  vtkNew<vtkPolyLine> xPolyLine;\n  xPolyLine->GetPointIds()->SetNumberOfIds(xHullPoints->GetNumberOfPoints());\n\n  for (vtkIdType i = 0; i < xHullPoints->GetNumberOfPoints(); i++)\n  {\n    xPolyLine->GetPointIds()->SetId(i, i);\n  }\n\n  // Create a cell array to store the lines in and add the lines to it.\n  vtkNew<vtkCellArray> cells;\n  cells->InsertNextCell(xPolyLine);\n\n  // Create a polydata to store everything in.\n  vtkNew<vtkPolyData> polyData;\n\n  // Add the points to the dataset.\n  polyData->SetPoints(xHullPoints);\n\n  // Add the lines to the dataset.\n  polyData->SetLines(cells);\n\n  // Create tubes around the lines.\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputData(polyData);\n  tubes->SetRadius(0.005);\n  tubes->SetNumberOfSides(21);\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> xHullMapper;\n  xHullMapper->SetInputConnection(tubes->GetOutputPort());\n\n  vtkNew<vtkActor> xHullActor;\n  xHullActor->SetMapper(xHullMapper);\n  xHullActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointsProjectedHull\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->AddActor(xHullActor);\n  renderer->AddActor(pointActor);\n\n  // Rotate camera.\n  renderer->GetActiveCamera()->Azimuth(90);\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PointsProjectedHull/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointsProjectedHull)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointsProjectedHull: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointsProjectedHull MACOSX_BUNDLE PointsProjectedHull.cxx )\n  target_link_libraries(PointsProjectedHull PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointsProjectedHull\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PointsProjectedHull/#download-and-build-pointsprojectedhull","title":"Download and Build PointsProjectedHull","text":"

        Click here to download PointsProjectedHull and its CMakeLists.txt file. Once the tarball PointsProjectedHull.tar has been downloaded and extracted,

        cd PointsProjectedHull/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointsProjectedHull\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataCellNormals/","title":"PolyDataCellNormals","text":"

        vtk-examples/Cxx/PolyData/PolyDataCellNormals

        "},{"location":"Cxx/PolyData/PolyDataCellNormals/#description","title":"Description","text":"

        This example shows how to add normals to vertices. This is identical to adding normals to any type of cells. The only difference from [Normals to/from a Polydata]]([Add/Get) is

        polydata->GetPointData()->SetNormals(PointNormalsArray);

        vtkSmartPointer<vtkDoubleArray> PointNormalsRetrieved = vtkDoubleArray::SafeDownCast(polydata->GetPointData()->GetNormals());

        are changed to

        polydata->GetCellData()->SetNormals(CellNormalsArray);

        and

        vtkSmartPointer<vtkDoubleArray> CellNormalsRetrieved = vtkDoubleArray::SafeDownCast(polydata->GetCellData()->GetNormals());

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataCellNormals/#code","title":"Code","text":"

        PolyDataCellNormals.cxx

        #include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n\n  ///////// Set Point Normals ///////////\n\n  // Setup point coordinates\n  double x[3] = {1.0, 0.0, 0.0};\n  double y[3] = {0.0, 0.0, 1.0};\n  double z[3] = {0.0, 0.0, 0.0};\n\n  // create 3 points and add a vertex at each point\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkCellArray> vertices;\n\n  for (unsigned int i = 0; i < 3; ++i)\n  {\n    // Declare a variable to store the index of the point that gets added. This\n    // behaves just like an unsigned int.\n    vtkIdType pid[1];\n\n    // Add a point to the polydata and save its index, which we will use to\n    // create the vertex on that point.\n    pid[0] = points->InsertNextPoint(x[i], y[i], z[i]);\n\n    // create a vertex cell on the point that was just added.\n    vertices->InsertNextCell(1, pid);\n  }\n\n  // add the points and vertices to a polydata\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetVerts(vertices);\n\n  // set vertex (cell) normals\n  vtkNew<vtkDoubleArray> normalsArray;\n  normalsArray->SetNumberOfComponents(3); // 3d normals (ie x,y,z)\n  normalsArray->SetNumberOfTuples(polydata->GetNumberOfPoints());\n\n  // construct the normal vectors\n  double cN1[3] = {1.0, 0.0, 0.0};\n  double cN2[3] = {0.0, 1.0, 0.0};\n  double cN3[3] = {0.0, 0.0, 1.0};\n\n  // add the data to the normals array\n  normalsArray->SetTuple(0, cN1);\n  normalsArray->SetTuple(1, cN2);\n  normalsArray->SetTuple(2, cN3);\n\n  // add the normals to the cells in the polydata\n  polydata->GetCellData()->SetNormals(normalsArray);\n\n  ///////// Get cell normals ///////////\n  // vtkSmartPointer<vtkDoubleArray> cellNormalsRetrieved =\n  //    dynamic_cast<vtkDoubleArray*>(polydata->GetCellData()->GetNormals());\n  auto cellNormalsRetrieved =\n      dynamic_cast<vtkDoubleArray*>(polydata->GetCellData()->GetNormals());\n  if (cellNormalsRetrieved)\n  {\n    cout << \"There are \" << cellNormalsRetrieved->GetNumberOfTuples()\n         << \" cell normals.\" << endl;\n\n    for (vtkIdType i = 0; i < cellNormalsRetrieved->GetNumberOfTuples(); i++)\n    {\n      double cN[3];\n      cellNormalsRetrieved->GetTuple(i, cN);\n      cout << \"Cell normal \" << i << \": \" << cN[0] << \" \" << cN[1] << \" \"\n           << cN[2] << endl;\n    }\n  }\n  else\n  {\n    cout << \"No cell normals.\" << endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolyDataCellNormals/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataCellNormals)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataCellNormals: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataCellNormals MACOSX_BUNDLE PolyDataCellNormals.cxx )\n  target_link_libraries(PolyDataCellNormals PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataCellNormals\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataCellNormals/#download-and-build-polydatacellnormals","title":"Download and Build PolyDataCellNormals","text":"

        Click here to download PolyDataCellNormals and its CMakeLists.txt file. Once the tarball PolyDataCellNormals.tar has been downloaded and extracted,

        cd PolyDataCellNormals/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataCellNormals\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/","title":"PolyDataConnectivityFilter LargestRegion","text":"

        vtk-examples/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/#description","title":"Description","text":"

        This example uses [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ConnectivityFilter to keep the largest connected region of a mesh. Note that this is based on the number of points, not the actual area of the region.

        The original vtkPolyData is red, on top. The extracted region is yellow, on the bottom.

        Note

        Contrast this with PolyDataConnectivityFilter_SpecifiedRegion.

        Note

        Contributed by: Jinyoung Hwang

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/#code","title":"Code","text":"

        PolyDataConnectivityFilter_LargestRegion.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Small sphere\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetRadius(5);\n\n  // Large sphere\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetRadius(10);\n  sphereSource2->SetCenter(25, 0, 0);\n  sphereSource2->SetThetaResolution(10);\n  sphereSource2->SetPhiResolution(10);\n\n  vtkNew<vtkAppendPolyData> appendFilter;\n  appendFilter->AddInputConnection(sphereSource1->GetOutputPort());\n  appendFilter->AddInputConnection(sphereSource2->GetOutputPort());\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputConnection(appendFilter->GetOutputPort());\n  connectivityFilter->SetExtractionModeToLargestRegion();\n\n  // Create a mapper and actor for original data\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(appendFilter->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a mapper and actor for extracted data\n  vtkNew<vtkPolyDataMapper> extractedMapper;\n  extractedMapper->SetInputConnection(connectivityFilter->GetOutputPort());\n  extractedMapper->Update();\n\n  vtkNew<vtkActor> extractedActor;\n  extractedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  extractedActor->SetMapper(extractedMapper);\n  extractedActor->SetPosition(0, -20, 0);\n\n  // Visualization\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(originalActor);\n  renderer->AddActor(extractedActor);\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"Gold\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolyDataConnectivityFilter_LargestRegion\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataConnectivityFilter_LargestRegion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataConnectivityFilter_LargestRegion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataConnectivityFilter_LargestRegion MACOSX_BUNDLE PolyDataConnectivityFilter_LargestRegion.cxx )\n  target_link_libraries(PolyDataConnectivityFilter_LargestRegion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataConnectivityFilter_LargestRegion\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/#download-and-build-polydataconnectivityfilter_largestregion","title":"Download and Build PolyDataConnectivityFilter_LargestRegion","text":"

        Click here to download PolyDataConnectivityFilter_LargestRegion and its CMakeLists.txt file. Once the tarball PolyDataConnectivityFilter_LargestRegion.tar has been downloaded and extracted,

        cd PolyDataConnectivityFilter_LargestRegion/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataConnectivityFilter_LargestRegion\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/","title":"PolyDataConnectivityFilter SpecifiedRegion","text":"

        vtk-examples/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#description","title":"Description","text":"

        This example creates two spheres and combines them together into one polydata. The [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ConnectivityFilter is used to find the two spheres as they are separate regions (disconnected). If region 0 is selected, the small sphere is extracted. If region 1 is selected, the large sphere is extracted.

        The original vtkPolyData is red, on top. The extracted region is yellow, on the bottom.

        Note

        Contrast this with PolyDataConnectivityFilter_LargestRegion.

        Note

        Contributed by: Jinyoung Hwang

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#code","title":"Code","text":"

        PolyDataConnectivityFilter_SpecifiedRegion.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <vtkNamedColors.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetRadius(5);\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetRadius(10);\n  sphereSource2->SetCenter(25, 0, 0);\n\n  vtkNew<vtkAppendPolyData> appendFilter;\n  appendFilter->AddInputConnection(sphereSource1->GetOutputPort());\n  appendFilter->AddInputConnection(sphereSource2->GetOutputPort());\n\n  vtkNew<vtkPolyDataConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputConnection(appendFilter->GetOutputPort());\n  connectivityFilter->SetExtractionModeToSpecifiedRegions();\n  connectivityFilter->AddSpecifiedRegion(0); // select the region to extract\n                                             // here\n  connectivityFilter->Update();\n\n  // Create a mapper and actor for original data\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(appendFilter->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // create a mapper and actor for extracted data\n  vtkNew<vtkPolyDataMapper> extractedMapper;\n  extractedMapper->SetInputConnection(connectivityFilter->GetOutputPort());\n\n  vtkNew<vtkActor> extractedActor;\n  extractedActor->SetMapper(extractedMapper);\n  extractedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  extractedActor->SetPosition(0, -20, 0);\n\n  // create a renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(originalActor);\n  renderer->AddActor(extractedActor);\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"Gold\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Silver\").GetData());\n\n  // create a render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolyDataConnectivityFilter_SpecifiedRegion\");\n\n  // create an interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataConnectivityFilter_SpecifiedRegion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataConnectivityFilter_SpecifiedRegion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataConnectivityFilter_SpecifiedRegion MACOSX_BUNDLE PolyDataConnectivityFilter_SpecifiedRegion.cxx )\n  target_link_libraries(PolyDataConnectivityFilter_SpecifiedRegion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataConnectivityFilter_SpecifiedRegion\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/#download-and-build-polydataconnectivityfilter_specifiedregion","title":"Download and Build PolyDataConnectivityFilter_SpecifiedRegion","text":"

        Click here to download PolyDataConnectivityFilter_SpecifiedRegion and its CMakeLists.txt file. Once the tarball PolyDataConnectivityFilter_SpecifiedRegion.tar has been downloaded and extracted,

        cd PolyDataConnectivityFilter_SpecifiedRegion/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataConnectivityFilter_SpecifiedRegion\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataContourToImageData/","title":"PolyDataContourToImageData","text":"

        vtk-examples/Cxx/PolyData/PolyDataContourToImageData

        "},{"location":"Cxx/PolyData/PolyDataContourToImageData/#description","title":"Description","text":"
        • Contributed by: Lars Friedrich

        This example generates a sphere, cuts it with a plane and, therefore, generates a circlular contour (vtkPolyData). Subsequently a binary image representation (vtkImageData) is extracted from it. Internally [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ToImageStencil and vtkLinearExtrusionFilter are utilized. Both the circular poly data (circle.vtp) and the resultant image (labelImage.mhd) are saved to disk.

        Note

        Similar to example PolyDataToImageData, I am not really sure whether or not the image origin needs to be adjusted as the sphere-image-overlay shows some offset in paraview visualization (at least I think ...). Maybe someone could verify that. Thanks!

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataContourToImageData/#code","title":"Code","text":"

        PolyDataContourToImageData.cxx

        #include <vtkCutter.h>\n#include <vtkImageData.h>\n#include <vtkImageStencil.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkMetaImageWriter.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataToImageStencil.h>\n#include <vtkSphereSource.h>\n#include <vtkStripper.h>\n#include <vtkXMLPolyDataWriter.h>\n\n// This example generates a sphere, cuts it with a plane and, therefore,\n// generates a circlular contour (vtkPolyData). Subsequently a binary\n// image representation (vtkImageData) is extracted from it. Internally\n// vtkPolyDataToImageStencil and vtkLinearExtrusionFilter are\n// utilized. Both the circular poly data (circle.vtp) and the resultant\n// image (labelImage.mhd) are saved to disk.\n\nint main(int, char*[])\n{\n  // 3D source sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n  sphereSource->SetCenter(40, 40, 0);\n  sphereSource->SetRadius(20);\n\n  // generate circle by cutting the sphere with an implicit plane\n  // (through its center, axis-aligned)\n  vtkNew<vtkCutter> circleCutter;\n  circleCutter->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkPlane> cutPlane;\n  cutPlane->SetOrigin(sphereSource->GetCenter());\n  cutPlane->SetNormal(0, 0, 1);\n  circleCutter->SetCutFunction(cutPlane);\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(circleCutter->GetOutputPort()); // valid circle\n  stripper->Update();\n\n  // that's our circle\n  auto circle = stripper->GetOutput();\n\n  // write circle out\n  vtkNew<vtkXMLPolyDataWriter> polyDataWriter;\n  polyDataWriter->SetInputData(circle);\n  polyDataWriter->SetFileName(\"circle.vtp\");\n  polyDataWriter->SetCompressorTypeToNone();\n  polyDataWriter->SetDataModeToAscii();\n  polyDataWriter->Write();\n\n  // prepare the binary image's voxel grid\n  vtkNew<vtkImageData> whiteImage;\n  double bounds[6];\n  circle->GetBounds(bounds);\n  double spacing[3]; // desired volume spacing\n  spacing[0] = 0.5;\n  spacing[1] = 0.5;\n  spacing[2] = 0.5;\n  whiteImage->SetSpacing(spacing);\n\n  // compute dimensions\n  int dim[3];\n  for (int i = 0; i < 3; i++)\n  {\n    dim[i] = static_cast<int>(\n                 ceil((bounds[i * 2 + 1] - bounds[i * 2]) / spacing[i])) +\n        1;\n    if (dim[i] < 1)\n      dim[i] = 1;\n  }\n  whiteImage->SetDimensions(dim);\n  whiteImage->SetExtent(0, dim[0] - 1, 0, dim[1] - 1, 0, dim[2] - 1);\n  double origin[3];\n\n  // NOTE: I am not sure whether or not we had to add some offset!\n  origin[0] = bounds[0]; // + spacing[0] / 2;\n  origin[1] = bounds[2]; // + spacing[1] / 2;\n  origin[2] = bounds[4]; // + spacing[2] / 2;\n  whiteImage->SetOrigin(origin);\n  whiteImage->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  // fill the image with foreground voxels:\n  unsigned char inval = 255;\n  unsigned char outval = 0;\n  vtkIdType count = whiteImage->GetNumberOfPoints();\n  for (vtkIdType i = 0; i < count; ++i)\n  {\n    whiteImage->GetPointData()->GetScalars()->SetTuple1(i, inval);\n  }\n\n  // sweep polygonal data (this is the important thing with contours!)\n  vtkNew<vtkLinearExtrusionFilter> extruder;\n  extruder->SetInputData(circle);\n  extruder->SetScaleFactor(1.);\n  extruder->SetExtrusionTypeToVectorExtrusion();\n  extruder->SetVector(0, 0, 1);\n  extruder->Update();\n\n  // polygonal data --> image stencil:\n  vtkNew<vtkPolyDataToImageStencil> pol2stenc;\n  pol2stenc->SetTolerance(0); // important if extruder->SetVector(0, 0, 1) !!!\n  pol2stenc->SetInputConnection(extruder->GetOutputPort());\n  pol2stenc->SetOutputOrigin(origin);\n  pol2stenc->SetOutputSpacing(spacing);\n  pol2stenc->SetOutputWholeExtent(whiteImage->GetExtent());\n  pol2stenc->Update();\n\n  // cut the corresponding white image and set the background:\n  vtkNew<vtkImageStencil> imgstenc;\n  imgstenc->SetInputData(whiteImage);\n  imgstenc->SetStencilConnection(pol2stenc->GetOutputPort());\n  imgstenc->ReverseStencilOff();\n  imgstenc->SetBackgroundValue(outval);\n  imgstenc->Update();\n  imgstenc->GetOutput()->Print(std::cout);\n\n  vtkNew<vtkMetaImageWriter> imageWriter;\n  imageWriter->SetFileName(\"labelImage.mhd\");\n  imageWriter->SetInputConnection(imgstenc->GetOutputPort());\n  imageWriter->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolyDataContourToImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataContourToImageData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOImage\n  IOXML\n  ImagingStencil\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataContourToImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataContourToImageData MACOSX_BUNDLE PolyDataContourToImageData.cxx )\n  target_link_libraries(PolyDataContourToImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataContourToImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataContourToImageData/#download-and-build-polydatacontourtoimagedata","title":"Download and Build PolyDataContourToImageData","text":"

        Click here to download PolyDataContourToImageData and its CMakeLists.txt file. Once the tarball PolyDataContourToImageData.tar has been downloaded and extracted,

        cd PolyDataContourToImageData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataContourToImageData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataExtractNormals/","title":"PolyDataExtractNormals","text":"

        vtk-examples/Cxx/PolyData/PolyDataExtractNormals

        "},{"location":"Cxx/PolyData/PolyDataExtractNormals/#description","title":"Description","text":"

        This demo looks for multiple types of normals in a polydata and generates them if they do not exist.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataExtractNormals/#code","title":"Code","text":"

        PolyDataExtractNormals.cxx

        #include <vtkCellData.h>\n#include <vtkDoubleArray.h>\n#include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nvoid TestPointNormals(vtkPolyData* polydata);\nvoid TestCellNormals(vtkPolyData* polydata);\n\nbool GetPointNormals(vtkPolyData* polydata);\nbool GetCellNormals(vtkPolyData* polydata);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkPolyData> polydata;\n\n  // If a file is provided, read it. Else, create a sphere.\n  if (argc == 2)\n  {\n\n    // Read File\n    std::string filename = argv[1]; // first command line argument\n    std::cout << \"Reading file \" << filename << \"...\" << std::endl;\n\n    vtkNew<vtkXMLPolyDataReader> reader;\n    std::cout << \"Reading \" << filename << std::endl;\n    reader->SetFileName(filename.c_str());\n    reader->Update();\n    polydata->DeepCopy(reader->GetOutput());\n  }\n  else\n  {\n    std::cout << \"Creating a sphere...\" << std::endl;\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n    std::cout << \"In main: \" << sphereSource->GetOutput()->GetNumberOfPoints()\n              << std::endl;\n    polydata->DeepCopy(sphereSource->GetOutput());\n  }\n\n  std::cout << \"PolyData address: \" << polydata << std::endl;\n\n  TestPointNormals(polydata);\n\n  TestCellNormals(polydata);\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid TestPointNormals(vtkPolyData* polydata)\n{\n  std::cout << \"In TestPointNormals: \" << polydata->GetNumberOfPoints()\n            << std::endl;\n  // Try to read normals directly\n  bool hasPointNormals = GetPointNormals(polydata);\n\n  if (!hasPointNormals)\n  {\n    std::cout << \"No point normals were found. Computing normals...\"\n              << std::endl;\n\n    // Generate normals\n    vtkNew<vtkPolyDataNormals> normalGenerator;\n    normalGenerator->SetInputData(polydata);\n    normalGenerator->ComputePointNormalsOn();\n    normalGenerator->ComputeCellNormalsOff();\n    normalGenerator->Update();\n    /*\n    // Optional settings\n    normalGenerator->SetFeatureAngle(0.1);\n    normalGenerator->SetSplitting(1);\n    normalGenerator->SetConsistency(0);\n    normalGenerator->SetAutoOrientNormals(0);\n    normalGenerator->SetComputePointNormals(1);\n    normalGenerator->SetComputeCellNormals(0);\n    normalGenerator->SetFlipNormals(0);\n    normalGenerator->SetNonManifoldTraversal(1);\n    */\n\n    polydata = normalGenerator->GetOutput();\n\n    // Try to read normals again\n    hasPointNormals = GetPointNormals(polydata);\n\n    std::cout << \"On the second try, has point normals? \" << hasPointNormals\n              << std::endl;\n  }\n  else\n  {\n    std::cout << \"Point normals were found!\" << std::endl;\n  }\n}\n\nvoid TestCellNormals(vtkPolyData* polydata)\n{\n  // Try to read normals directly\n  bool hasCellNormals = GetCellNormals(polydata);\n\n  if (!hasCellNormals)\n  {\n    std::cout << \"No cell normals were found. Computing normals...\"\n              << std::endl;\n\n    // Generate normals\n    vtkNew<vtkPolyDataNormals> normalGenerator;\n    normalGenerator->SetInputData(polydata);\n    normalGenerator->ComputePointNormalsOff();\n    normalGenerator->ComputeCellNormalsOn();\n    normalGenerator->Update();\n    /*\n    // Optional settings\n    normalGenerator->SetFeatureAngle(0.1);\n    normalGenerator->SetSplitting(1);\n    normalGenerator->SetConsistency(0);\n    normalGenerator->SetAutoOrientNormals(0);\n    normalGenerator->SetComputePointNormals(1);\n    normalGenerator->SetComputeCellNormals(0);\n    normalGenerator->SetFlipNormals(0);\n    normalGenerator->SetNonManifoldTraversal(1);\n    */\n\n    polydata = normalGenerator->GetOutput();\n\n    // Try to read normals again\n    hasCellNormals = GetCellNormals(polydata);\n\n    std::cout << \"On the second try, has cell normals? \" << hasCellNormals\n              << std::endl;\n  }\n  else\n  {\n    std::cout << \"Cell normals were found!\" << std::endl;\n  }\n}\n\nbool GetPointNormals(vtkPolyData* polydata)\n{\n  std::cout << \"In GetPointNormals: \" << polydata->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Looking for point normals...\" << std::endl;\n\n  // Count points\n  vtkIdType numPoints = polydata->GetNumberOfPoints();\n  std::cout << \"There are \" << numPoints << \" points.\" << std::endl;\n\n  // Count triangles\n  vtkIdType numPolys = polydata->GetNumberOfPolys();\n  std::cout << \"There are \" << numPolys << \" polys.\" << std::endl;\n\n  ////////////////////////////////////////////////////////////////\n  // Double normals in an array\n  vtkDoubleArray* normalDataDouble = dynamic_cast<vtkDoubleArray*>(\n      polydata->GetPointData()->GetArray(\"Normals\"));\n\n  if (normalDataDouble)\n  {\n    int nc = normalDataDouble->GetNumberOfTuples();\n    std::cout << \"There are \" << nc << \" components in normalDataDouble\"\n              << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Double normals in an array\n  vtkFloatArray* normalDataFloat = dynamic_cast<vtkFloatArray*>(\n      polydata->GetPointData()->GetArray(\"Normals\"));\n\n  if (normalDataFloat)\n  {\n    int nc = normalDataFloat->GetNumberOfTuples();\n    std::cout << \"There are \" << nc << \" components in normalDataFloat\"\n              << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Point normals\n  vtkDoubleArray* normalsDouble =\n      dynamic_cast<vtkDoubleArray*>(polydata->GetPointData()->GetNormals());\n\n  if (normalsDouble)\n  {\n    std::cout << \"There are \" << normalsDouble->GetNumberOfComponents()\n              << \" components in normalsDouble\" << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Point normals\n  vtkFloatArray* normalsFloat =\n      dynamic_cast<vtkFloatArray*>(polydata->GetPointData()->GetNormals());\n\n  if (normalsFloat)\n  {\n    std::cout << \"There are \" << normalsFloat->GetNumberOfComponents()\n              << \" components in normalsFloat\" << std::endl;\n    return true;\n  }\n\n  /////////////////////////////////////////////////////////////////////\n  // Generic type point normals\n  vtkDataArray* normalsGeneric =\n      polydata->GetPointData()->GetNormals(); // works\n  if (normalsGeneric)\n  {\n    std::cout << \"There are \" << normalsGeneric->GetNumberOfTuples()\n              << \" normals in normalsGeneric\" << std::endl;\n\n    double testDouble[3];\n    normalsGeneric->GetTuple(0, testDouble);\n\n    std::cout << \"Double: \" << testDouble[0] << \" \" << testDouble[1] << \" \"\n              << testDouble[2] << std::endl;\n\n    // Can't do this:\n    /*\n    float testFloat[3];\n    normalsGeneric->GetTuple(0, testFloat);\n\n    std::cout << \"Float: \" << testFloat[0] << \" \"\n              << testFloat[1] << \" \" << testFloat[2] << std::endl;\n    */\n    return true;\n  }\n\n  // If the function has not yet quit, there were none of these types of normals\n  std::cout << \"Normals not found!\" << std::endl;\n  return false;\n}\n\nbool GetCellNormals(vtkPolyData* polydata)\n{\n  std::cout << \"Looking for cell normals...\" << std::endl;\n\n  // Count points\n  vtkIdType numCells = polydata->GetNumberOfCells();\n  std::cout << \"There are \" << numCells << \" cells.\" << std::endl;\n\n  // Count triangles\n  vtkIdType numPolys = polydata->GetNumberOfPolys();\n  std::cout << \"There are \" << numPolys << \" polys.\" << std::endl;\n\n  ////////////////////////////////////////////////////////////////\n  // Double normals in an array\n  vtkDoubleArray* normalDataDouble = dynamic_cast<vtkDoubleArray*>(\n      polydata->GetCellData()->GetArray(\"Normals\"));\n\n  if (normalDataDouble)\n  {\n    int nc = normalDataDouble->GetNumberOfTuples();\n    std::cout << \"There are \" << nc << \" components in normalDataDouble\"\n              << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Double normals in an array\n  vtkFloatArray* normalDataFloat = dynamic_cast<vtkFloatArray*>(\n      polydata->GetCellData()->GetArray(\"Normals\"));\n\n  if (normalDataFloat)\n  {\n    int nc = normalDataFloat->GetNumberOfTuples();\n    std::cout << \"There are \" << nc << \" components in normalDataFloat\"\n              << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Point normals\n  vtkDoubleArray* normalsDouble =\n      dynamic_cast<vtkDoubleArray*>(polydata->GetCellData()->GetNormals());\n\n  if (normalsDouble)\n  {\n    std::cout << \"There are \" << normalsDouble->GetNumberOfComponents()\n              << \" components in normalsDouble\" << std::endl;\n    return true;\n  }\n\n  ////////////////////////////////////////////////////////////////\n  // Point normals\n  vtkFloatArray* normalsFloat =\n      dynamic_cast<vtkFloatArray*>(polydata->GetCellData()->GetNormals());\n\n  if (normalsFloat)\n  {\n    std::cout << \"There are \" << normalsFloat->GetNumberOfComponents()\n              << \" components in normalsFloat\" << std::endl;\n    return true;\n  }\n\n  /////////////////////////////////////////////////////////////////////\n  // Generic type point normals\n  vtkDataArray* normalsGeneric = polydata->GetCellData()->GetNormals(); // works\n  if (normalsGeneric)\n  {\n    std::cout << \"There are \" << normalsGeneric->GetNumberOfTuples()\n              << \" normals in normalsGeneric\" << std::endl;\n\n    double testDouble[3];\n    normalsGeneric->GetTuple(0, testDouble);\n\n    std::cout << \"Double: \" << testDouble[0] << \" \" << testDouble[1] << \" \"\n              << testDouble[2] << std::endl;\n\n    // Can't do this:\n    /*\n    float testFloat[3];\n    normalsGeneric->GetTuple(0, testFloat);\n\n    std::cout << \"Float: \" << testFloat[0] << \" \"\n              << testFloat[1] << \" \" << testFloat[2] << std::endl;\n    */\n    return true;\n  }\n\n  // If the function has not yet quit, there were none of these types of normals\n  std::cout << \"Normals not found!\" << std::endl;\n  return false;\n}\n\n} // namespace\n
        "},{"location":"Cxx/PolyData/PolyDataExtractNormals/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataExtractNormals)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataExtractNormals: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataExtractNormals MACOSX_BUNDLE PolyDataExtractNormals.cxx )\n  target_link_libraries(PolyDataExtractNormals PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataExtractNormals\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataExtractNormals/#download-and-build-polydataextractnormals","title":"Download and Build PolyDataExtractNormals","text":"

        Click here to download PolyDataExtractNormals and its CMakeLists.txt file. Once the tarball PolyDataExtractNormals.tar has been downloaded and extracted,

        cd PolyDataExtractNormals/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataExtractNormals\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataGetPoint/","title":"PolyDataGetPoint","text":"

        vtk-examples/Cxx/PolyData/PolyDataGetPoint

        "},{"location":"Cxx/PolyData/PolyDataGetPoint/#description","title":"Description","text":"

        This example demonstrates how to obtain the coordinates of a point in a vtkPolyData object.

        • Suggested by Sara Rolfe

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataGetPoint/#code","title":"Code","text":"

        PolyDataGetPoint.cxx

        #include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkPolyData* polydata = sphereSource->GetOutput();\n\n  // Write all of the coordinates of the points in the vtkPolyData to the\n  // console.\n  for (vtkIdType i = 0; i < polydata->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    polydata->GetPoint(i, p);\n    // This is identical to:\n    // polydata->GetPoints()->GetPoint(i,p);\n    std::cout << \"Point \" << i << \" : (\" << p[0] << \" \" << p[1] << \" \" << p[2]\n              << \")\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolyDataGetPoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataGetPoint)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataGetPoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataGetPoint MACOSX_BUNDLE PolyDataGetPoint.cxx )\n  target_link_libraries(PolyDataGetPoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataGetPoint\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataGetPoint/#download-and-build-polydatagetpoint","title":"Download and Build PolyDataGetPoint","text":"

        Click here to download PolyDataGetPoint and its CMakeLists.txt file. Once the tarball PolyDataGetPoint.tar has been downloaded and extracted,

        cd PolyDataGetPoint/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataGetPoint\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataIsoLines/","title":"PolyDataIsoLines","text":"

        vtk-examples/Cxx/PolyData/PolyDataIsoLines

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataIsoLines/#code","title":"Code","text":"

        PolyDataIsoLines.cxx

        #include <vtkActor.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtkXMLPolyDataWriter.h>\n\n// #include <algorithm>\n// #include <iostream>\n// #include <string>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required arguments: Filename e.g. cowHead.vtp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  // float range[2];\n  double range[2];\n  reader->GetOutput()->GetPointData()->GetScalars()->GetRange(range);\n  // std::cout << \"Range: \" << range[0] << \" , \" << range[1] << std::endl;\n\n  vtkNew<vtkBandedPolyDataContourFilter> bf;\n  bf->SetInputConnection(reader->GetOutputPort());\n  int numContours = 30;\n  bf->GenerateValues(numContours, range);\n  bf->GenerateContourEdgesOn();\n  bf->Update();\n\n  // Color the contours.\n  bf->GetOutput(1)->GetPointData()->SetScalars(\n      bf->GetOutput()->GetPointData()->GetScalars());\n\n  // Make sure the mapper uses the new colors.\n  bf->GetOutput(0)->GetPointData()->SetActiveScalars(\"Scalars\");\n\n  {\n    vtkNew<vtkXMLPolyDataWriter> writer;\n    writer->SetInputConnection(bf->GetOutputPort());\n    writer->SetFileName(\"output.vtp\");\n    writer->Update();\n  }\n\n  {\n    vtkNew<vtkXMLPolyDataWriter> writer;\n    writer->SetInputConnection(bf->GetOutputPort(1));\n    writer->SetFileName(\"ContourEdges.vtp\");\n    writer->Update();\n  }\n\n  /*\n  // See which isocontours are being generated\n  auto values = bf->GetValues();\n  auto numOfContours = bf->GetNumberOfContours();\n  vtkIdType someContours = std::min(numContours, 10);\n  for (vtkIdType i = 0; i < someContours; i++)\n  {\n    cout << values[i] << \" \";\n  }\n  cout << endl;\n  */\n\n  // Color actor.\n  vtkNew<vtkPolyDataMapper> colorMapper;\n  colorMapper->SetInputConnection(bf->GetOutputPort(0));\n  colorMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> colorActor;\n  colorActor->SetMapper(colorMapper);\n\n  // Edge actor.\n  vtkNew<vtkPolyDataMapper> edgeMapper;\n  edgeMapper->SetInputConnection(bf->GetOutputPort(1));\n  edgeMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(edgeMapper);\n  edgeActor->GetProperty()->SetLineWidth(5);\n\n  // Create the RenderWindow, Renderer and both Actors.\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolyDataIsoLines\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer.\n  renderer->AddActor(colorActor);\n  renderer->AddActor(edgeActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolyDataIsoLines/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataIsoLines)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataIsoLines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataIsoLines MACOSX_BUNDLE PolyDataIsoLines.cxx )\n  target_link_libraries(PolyDataIsoLines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataIsoLines\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataIsoLines/#download-and-build-polydataisolines","title":"Download and Build PolyDataIsoLines","text":"

        Click here to download PolyDataIsoLines and its CMakeLists.txt file. Once the tarball PolyDataIsoLines.tar has been downloaded and extracted,

        cd PolyDataIsoLines/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataIsoLines\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataPointNormals/","title":"PolyDataPointNormals","text":"

        vtk-examples/Cxx/PolyData/PolyDataPointNormals

        "},{"location":"Cxx/PolyData/PolyDataPointNormals/#description","title":"Description","text":"

        This demo adds a normal to each point in a polydata.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataPointNormals/#code","title":"Code","text":"

        PolyDataPointNormals.cxx

        #include <vtkCellArray.h>\n#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  ///////// Set Point Normals ///////////\n  // Create 3 points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Add the points to a polydata.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  // Set point normals.\n  vtkNew<vtkDoubleArray> pointNormalsArray;\n  pointNormalsArray->SetNumberOfComponents(3); // 3d normals (ie x,y,z)\n  pointNormalsArray->SetNumberOfTuples(polydata->GetNumberOfPoints());\n\n  // Construct the normal vectors.\n  double pN1[3] = {1.0, 0.0, 0.0};\n  double pN2[3] = {0.0, 1.0, 0.0};\n  double pN3[3] = {0.0, 0.0, 1.0};\n\n  // Add the data to the normals array.\n  pointNormalsArray->SetTuple(0, pN1);\n  pointNormalsArray->SetTuple(1, pN2);\n  pointNormalsArray->SetTuple(2, pN3);\n\n  // Add the normals to the points in the polydata.\n  polydata->GetPointData()->SetNormals(pointNormalsArray);\n\n  ///////// Get Point Normals ///////////\n  auto pointNormalsRetrieved =\n      dynamic_cast<vtkDoubleArray*>(polydata->GetPointData()->GetNormals());\n  if (pointNormalsRetrieved)\n  {\n    std::cout << \"There are \" << pointNormalsRetrieved->GetNumberOfTuples()\n              << \" point normals.\" << std::endl;\n\n    for (vtkIdType i = 0; i < pointNormalsRetrieved->GetNumberOfTuples(); i++)\n    {\n      double pN[3];\n      pointNormalsRetrieved->GetTuple(i, pN);\n      std::cout << \"Point normal \" << i << \": \" << pN[0] << \" \" << pN[1] << \" \"\n                << pN[2] << std::endl;\n    }\n\n  } // end if(pointNormalsRetrieved)\n  else\n  {\n    std::cout << \"No point normals.\" << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolyDataPointNormals/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataPointNormals)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataPointNormals: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataPointNormals MACOSX_BUNDLE PolyDataPointNormals.cxx )\n  target_link_libraries(PolyDataPointNormals PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataPointNormals\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataPointNormals/#download-and-build-polydatapointnormals","title":"Download and Build PolyDataPointNormals","text":"

        Click here to download PolyDataPointNormals and its CMakeLists.txt file. Once the tarball PolyDataPointNormals.tar has been downloaded and extracted,

        cd PolyDataPointNormals/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataPointNormals\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataPointSampler/","title":"PolyDataPointSampler","text":"

        vtk-examples/Cxx/PolyData/PolyDataPointSampler

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/PolyDataPointSampler/#description","title":"Description","text":"

        Original points are yellow and added points are red.

        This example uses the src/Testing/Data/Torso.vtp dataset.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataPointSampler/#code","title":"Code","text":"

        PolyDataPointSampler.cxx

        #include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataPointSampler.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double range[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    range[i] = bounds[2 * i + 1] - bounds[2 * i];\n  }\n  std::cout << \"Range: \" << range[0] << \", \" << range[1] << \", \" << range[2]\n            << std::endl;\n  std::cout << \"# of original points: \" << polyData->GetNumberOfPoints()\n            << std::endl;\n  vtkNew<vtkPolyDataPointSampler> sample;\n  sample->SetInputData(polyData);\n  sample->SetDistance(range[0] / 50);\n  sample->Update();\n  std::cout << \"# of points after sampling: \"\n            << sample->GetOutput()->GetNumberOfPoints() << std::endl;\n\n  ///\n  double radius = range[0] * 0.01;\n  vtkNew<vtkSphereSource> originalSource;\n  originalSource->SetRadius(radius);\n\n  vtkNew<vtkGlyph3D> originalGlyph3D;\n  originalGlyph3D->SetInputData(polyData);\n  originalGlyph3D->SetSourceConnection(originalSource->GetOutputPort());\n  originalGlyph3D->ScalingOff();\n  originalGlyph3D->Update();\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(originalGlyph3D->GetOutputPort());\n  originalMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkSphereSource> sampleSource;\n  sampleSource->SetRadius(radius * 0.75);\n\n  vtkNew<vtkGlyph3D> sampleGlyph3D;\n  sampleGlyph3D->SetInputConnection(sample->GetOutputPort());\n  sampleGlyph3D->SetSourceConnection(sampleSource->GetOutputPort());\n  sampleGlyph3D->ScalingOff();\n  sampleGlyph3D->Update();\n\n  vtkNew<vtkPolyDataMapper> sampleMapper;\n  sampleMapper->SetInputConnection(sampleGlyph3D->GetOutputPort());\n  sampleMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> sampleActor;\n  sampleActor->SetMapper(sampleMapper);\n  sampleActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create graphics stuff.\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"PolyDataPointSampler\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(originalActor);\n  ren1->AddActor(sampleActor);\n\n  // Generate an interesting view.\n  ren1->GetActiveCamera()->SetPosition(1, 0, 0);\n  ren1->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  ren1->GetActiveCamera()->SetViewUp(0, 0, 1);\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.0);\n  ren1->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphere;\n    sphere->SetRadius(1.0);\n    sphere->SetPhiResolution(21);\n    sphere->SetThetaResolution(41);\n    sphere->Update();\n    polyData = sphere->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/PolyData/PolyDataPointSampler/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataPointSampler)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataPointSampler: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataPointSampler MACOSX_BUNDLE PolyDataPointSampler.cxx )\n  target_link_libraries(PolyDataPointSampler PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataPointSampler\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataPointSampler/#download-and-build-polydatapointsampler","title":"Download and Build PolyDataPointSampler","text":"

        Click here to download PolyDataPointSampler and its CMakeLists.txt file. Once the tarball PolyDataPointSampler.tar has been downloaded and extracted,

        cd PolyDataPointSampler/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataPointSampler\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataToImageData/","title":"PolyDataToImageData","text":"

        vtk-examples/Cxx/PolyData/PolyDataToImageData

        "},{"location":"Cxx/PolyData/PolyDataToImageData/#description","title":"Description","text":"
        • Contributed by: Lars Friedrich

        This example generates a sphere (prerequisite: closed surface of type vtkPolyData) and converts it into volume representation (vtkImageData) where the foreground voxels are 255 (inside) and the background voxels are 0 (outside). Internally [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ToImageStencil is utilized. The resultant image is saved to disk in metaimage file format (SphereVolume.mhd).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataToImageData/#code","title":"Code","text":"

        PolyDataToImageData.cxx

        #include <vtkImageData.h>\n#include <vtkImageStencil.h>\n#include <vtkMetaImageWriter.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataToImageStencil.h>\n#include <vtkSphereSource.h>\n\n/**\n * This program generates a sphere (closed surface, vtkPolyData) and converts it\n * into volume representation (vtkImageData) where the foreground voxels are 1\n * and the background voxels are 0. Internally vtkPolyDataToImageStencil is\n * utilized. The resultant image is saved to disk in metaimage file format\n * (SphereVolume.mhd).\n */\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(20);\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n  auto pd = sphereSource->GetOutput();\n  sphereSource->Update();\n\n  vtkNew<vtkImageData> whiteImage;\n  double bounds[6];\n  pd->GetBounds(bounds);\n  double spacing[3]; // desired volume spacing\n  spacing[0] = 0.5;\n  spacing[1] = 0.5;\n  spacing[2] = 0.5;\n  whiteImage->SetSpacing(spacing);\n\n  // compute dimensions\n  int dim[3];\n  for (int i = 0; i < 3; i++)\n  {\n    dim[i] = static_cast<int>(\n        ceil((bounds[i * 2 + 1] - bounds[i * 2]) / spacing[i]));\n  }\n  whiteImage->SetDimensions(dim);\n  whiteImage->SetExtent(0, dim[0] - 1, 0, dim[1] - 1, 0, dim[2] - 1);\n\n  double origin[3];\n  origin[0] = bounds[0] + spacing[0] / 2;\n  origin[1] = bounds[2] + spacing[1] / 2;\n  origin[2] = bounds[4] + spacing[2] / 2;\n  whiteImage->SetOrigin(origin);\n  whiteImage->AllocateScalars(VTK_UNSIGNED_CHAR, 1);\n\n  // Fill the image with foreground voxels:\n  unsigned char inval = 255;\n  unsigned char outval = 0;\n  vtkIdType count = whiteImage->GetNumberOfPoints();\n  for (vtkIdType i = 0; i < count; ++i)\n  {\n    whiteImage->GetPointData()->GetScalars()->SetTuple1(i, inval);\n  }\n\n  // polygonal data --> image stencil:\n  vtkNew<vtkPolyDataToImageStencil> pol2stenc;\n  pol2stenc->SetInputData(pd);\n  pol2stenc->SetOutputOrigin(origin);\n  pol2stenc->SetOutputSpacing(spacing);\n  pol2stenc->SetOutputWholeExtent(whiteImage->GetExtent());\n  pol2stenc->Update();\n\n  // Cut the corresponding white image and set the background:\n  vtkNew<vtkImageStencil> imgstenc;\n  imgstenc->SetInputData(whiteImage);\n  imgstenc->SetStencilConnection(pol2stenc->GetOutputPort());\n  imgstenc->ReverseStencilOff();\n  imgstenc->SetBackgroundValue(outval);\n  imgstenc->Update();\n\n  vtkNew<vtkMetaImageWriter> writer;\n  writer->SetFileName(\"SphereVolume.mhd\");\n  writer->SetInputData(imgstenc->GetOutput());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolyDataToImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataToImageData)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOImage\n  ImagingStencil\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataToImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataToImageData MACOSX_BUNDLE PolyDataToImageData.cxx )\n  target_link_libraries(PolyDataToImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataToImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataToImageData/#download-and-build-polydatatoimagedata","title":"Download and Build PolyDataToImageData","text":"

        Click here to download PolyDataToImageData and its CMakeLists.txt file. Once the tarball PolyDataToImageData.tar has been downloaded and extracted,

        cd PolyDataToImageData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataToImageData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolyDataToUnstructuredGrid/","title":"PolyDataToUnstructuredGrid","text":"

        vtk-examples/Cxx/PolyData/PolyDataToUnstructuredGrid

        "},{"location":"Cxx/PolyData/PolyDataToUnstructuredGrid/#description","title":"Description","text":"

        There is not a filter whose sole purpose is converting a vtkPolyData to a vtkUnstructuredGrid. However, the append filter can accept any type of input, and produces a vtkUnstructuredGrid, so we can use it for this purpose.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolyDataToUnstructuredGrid/#code","title":"Code","text":"

        PolyDataToUnstructuredGrid.cxx

        #include <vtkAppendFilter.h>\n#include <vtkNew.h>\n#include <vtkSphereSource.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Combine the two data sets.\n  vtkNew<vtkAppendFilter> appendFilter;\n  appendFilter->AddInputData(sphereSource->GetOutput());\n  appendFilter->Update();\n\n  vtkNew<vtkUnstructuredGrid> unstructuredGrid;\n  unstructuredGrid->ShallowCopy(appendFilter->GetOutput());\n\n  // Write the unstructured grid.\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetFileName(\"UnstructuredGrid.vtu\");\n  writer->SetInputData(unstructuredGrid);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolyDataToUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataToUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataToUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataToUnstructuredGrid MACOSX_BUNDLE PolyDataToUnstructuredGrid.cxx )\n  target_link_libraries(PolyDataToUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataToUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolyDataToUnstructuredGrid/#download-and-build-polydatatounstructuredgrid","title":"Download and Build PolyDataToUnstructuredGrid","text":"

        Click here to download PolyDataToUnstructuredGrid and its CMakeLists.txt file. Once the tarball PolyDataToUnstructuredGrid.tar has been downloaded and extracted,

        cd PolyDataToUnstructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataToUnstructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolygonalSurfaceContourLineInterpolator/","title":"PolygonalSurfaceContourLineInterpolator","text":"

        vtk-examples/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolygonalSurfaceContourLineInterpolator/#code","title":"Code","text":"

        PolygonalSurfaceContourLineInterpolator.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientedGlyphContourRepresentation.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataCollection.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolygonalSurfaceContourLineInterpolator.h>\n#include <vtkPolygonalSurfacePointPlacer.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkPolyData> polyData;\n  if (argc < 2)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(40);\n    sphereSource->SetPhiResolution(20);\n    sphereSource->Update();\n\n    polyData = sphereSource->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n\n  // The Dijkistra interpolator will not accept cells that aren't triangles.\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputData(polyData);\n  triangleFilter->Update();\n\n  auto pd = triangleFilter->GetOutput();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(triangleFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the render window, renderer and interactor.\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolygonalSurfaceContourLineInterpolator\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size.\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  // Here comes the contour widget stuff...\n\n  vtkNew<vtkContourWidget> contourWidget;\n  contourWidget->SetInteractor(interactor);\n  vtkSmartPointer<vtkOrientedGlyphContourRepresentation> rep =\n      dynamic_cast<vtkOrientedGlyphContourRepresentation*>(\n          contourWidget->GetRepresentation());\n  rep->GetLinesProperty()->SetColor(colors->GetColor3d(\"Crimson\").GetData());\n  rep->GetLinesProperty()->SetLineWidth(3.0);\n\n  vtkNew<vtkPolygonalSurfacePointPlacer> pointPlacer;\n  pointPlacer->AddProp(actor);\n  pointPlacer->GetPolys()->AddItem(pd);\n  rep->SetPointPlacer(pointPlacer);\n\n  vtkNew<vtkPolygonalSurfaceContourLineInterpolator> interpolator;\n  interpolator->GetPolys()->AddItem(pd);\n  rep->SetLineInterpolator(interpolator);\n\n  renderWindow->Render();\n  interactor->Initialize();\n\n  contourWidget->EnabledOn();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolygonalSurfaceContourLineInterpolator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolygonalSurfaceContourLineInterpolator)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolygonalSurfaceContourLineInterpolator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolygonalSurfaceContourLineInterpolator MACOSX_BUNDLE PolygonalSurfaceContourLineInterpolator.cxx )\n  target_link_libraries(PolygonalSurfaceContourLineInterpolator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolygonalSurfaceContourLineInterpolator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolygonalSurfaceContourLineInterpolator/#download-and-build-polygonalsurfacecontourlineinterpolator","title":"Download and Build PolygonalSurfaceContourLineInterpolator","text":"

        Click here to download PolygonalSurfaceContourLineInterpolator and its CMakeLists.txt file. Once the tarball PolygonalSurfaceContourLineInterpolator.tar has been downloaded and extracted,

        cd PolygonalSurfaceContourLineInterpolator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolygonalSurfaceContourLineInterpolator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/PolygonalSurfacePointPlacer/","title":"PolygonalSurfacePointPlacer","text":"

        vtk-examples/Cxx/PolyData/PolygonalSurfacePointPlacer

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/PolygonalSurfacePointPlacer/#description","title":"Description","text":"

        This example demonstrates how to draw curves on a surface.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/PolygonalSurfacePointPlacer/#code","title":"Code","text":"

        PolygonalSurfacePointPlacer.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkContourWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientedGlyphContourRepresentation.h>\n#include <vtkPolyDataCollection.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolygonalSurfacePointPlacer.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nclass MyCallback : public vtkCallbackCommand\n{\npublic:\n  static MyCallback* New()\n  {\n    return new MyCallback;\n  }\n  MyCallback()\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkContourWidget* contourWidget =\n        reinterpret_cast<vtkContourWidget*>(caller);\n    vtkContourRepresentation* rep = static_cast<vtkContourRepresentation*>(\n        contourWidget->GetRepresentation());\n    std::cout << \"There are \" << rep->GetNumberOfNodes() << \" nodes.\"\n              << std::endl;\n  }\n\n  void SetSphereSource(vtkSmartPointer<vtkSphereSource> sphere)\n  {\n    this->SphereSource = sphere;\n  }\n\nprivate:\n  vtkSmartPointer<vtkSphereSource> SphereSource;\n};\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(5);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the RenderWindow, Renderer.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolygonalSurfacePointPlacer\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  vtkNew<vtkContourWidget> contourWidget;\n  contourWidget->SetInteractor(interactor);\n\n  vtkNew<MyCallback> callback;\n  callback->SetSphereSource(sphereSource);\n  contourWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  vtkOrientedGlyphContourRepresentation* rep =\n      dynamic_cast<vtkOrientedGlyphContourRepresentation*>(\n          contourWidget->GetRepresentation());\n\n  vtkNew<vtkPolygonalSurfacePointPlacer> pointPlacer;\n  pointPlacer->AddProp(actor);\n  pointPlacer->GetPolys()->AddItem(sphereSource->GetOutput());\n\n  rep->GetLinesProperty()->SetColor(colors->GetColor3d(\"Crimson\").GetData());\n  rep->GetLinesProperty()->SetLineWidth(3.0);\n  rep->SetPointPlacer(pointPlacer);\n\n  contourWidget->EnabledOn();\n  renderer->ResetCamera();\n  renderWindow->Render();\n  interactor->Initialize();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/PolygonalSurfacePointPlacer/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolygonalSurfacePointPlacer)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolygonalSurfacePointPlacer: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolygonalSurfacePointPlacer MACOSX_BUNDLE PolygonalSurfacePointPlacer.cxx )\n  target_link_libraries(PolygonalSurfacePointPlacer PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolygonalSurfacePointPlacer\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/PolygonalSurfacePointPlacer/#download-and-build-polygonalsurfacepointplacer","title":"Download and Build PolygonalSurfacePointPlacer","text":"

        Click here to download PolygonalSurfacePointPlacer and its CMakeLists.txt file. Once the tarball PolygonalSurfacePointPlacer.tar has been downloaded and extracted,

        cd PolygonalSurfacePointPlacer/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolygonalSurfacePointPlacer\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ProcrustesAlignmentFilter/","title":"ProcrustesAlignmentFilter","text":"

        vtk-examples/Cxx/PolyData/ProcrustesAlignmentFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ProcrustesAlignmentFilter/#description","title":"Description","text":"

        This example aligns three objects (deformed spheres) using the Procrustes algorithm. The original shapes are shown on the left. The alignment using a rigid transform is shown in the middle, and the alignment using a similarity transform is shown on the right.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ProcrustesAlignmentFilter/#code","title":"Code","text":"

        ProcrustesAlignmentFilter.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLandmarkTransform.h>\n#include <vtkMultiBlockDataGroupFilter.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSet.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProcrustesAlignmentFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(31);\n  sphereSource->SetThetaResolution(31);\n\n  // make two copies of the shape and distort them a little\n  vtkNew<vtkTransform> transform1;\n  transform1->Translate(0.2, 0.1, 0.3);\n  transform1->Scale(1.3, 1.1, 0.8);\n\n  vtkNew<vtkTransform> transform2;\n  transform2->Translate(0.3, 0.7, 0.1);\n  transform2->Scale(1.0, 0.1, 1.8);\n\n  vtkNew<vtkTransformPolyDataFilter> transformer1;\n  transformer1->SetInputConnection(sphereSource->GetOutputPort());\n  transformer1->SetTransform(transform1);\n\n  vtkNew<vtkTransformPolyDataFilter> transformer2;\n  transformer2->SetInputConnection(sphereSource->GetOutputPort());\n  transformer2->SetTransform(transform2);\n\n  // map these three shapes into the first renderer\n  vtkNew<vtkPolyDataMapper> map1a;\n  map1a->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> Actor1a;\n  Actor1a->SetMapper(map1a);\n  Actor1a->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkPolyDataMapper> map1b;\n  map1b->SetInputConnection(transformer1->GetOutputPort());\n\n  vtkNew<vtkActor> Actor1b;\n  Actor1b->SetMapper(map1b);\n  Actor1b->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkPolyDataMapper> map1c;\n  map1c->SetInputConnection(transformer2->GetOutputPort());\n  vtkNew<vtkActor> Actor1c;\n  Actor1c->SetMapper(map1c);\n  Actor1c->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n\n  // align the shapes using Procrustes (using SetModeToRigidBody)\n  vtkNew<vtkProcrustesAlignmentFilter> procrustes1;\n  vtkNew<vtkMultiBlockDataGroupFilter> group;\n  group->AddInputConnection(sphereSource->GetOutputPort());\n  group->AddInputConnection(transformer1->GetOutputPort());\n  group->AddInputConnection(transformer2->GetOutputPort());\n  procrustes1->SetInputConnection(group->GetOutputPort());\n  procrustes1->GetLandmarkTransform()->SetModeToRigidBody();\n\n  // map the aligned shapes into the second renderer\n  vtkNew<vtkDataSetMapper> map2a;\n\n  procrustes1->Update();\n  map2a->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes1->GetOutput()->GetBlock(0)));\n\n  vtkNew<vtkActor> Actor2a;\n  Actor2a->SetMapper(map2a);\n  Actor2a->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkDataSetMapper> map2b;\n  procrustes1->Update();\n  map2b->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes1->GetOutput()->GetBlock(1)));\n\n  vtkNew<vtkActor> Actor2b;\n  Actor2b->SetMapper(map2b);\n  Actor2b->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkDataSetMapper> map2c;\n  procrustes1->Update();\n  map2c->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes1->GetOutput()->GetBlock(2)));\n\n  vtkNew<vtkActor> Actor2c;\n  Actor2c->SetMapper(map2c);\n  Actor2c->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n\n  // align the shapes using Procrustes (using SetModeToSimilarity (default))\n  vtkNew<vtkProcrustesAlignmentFilter> procrustes2;\n  procrustes2->SetInputConnection(group->GetOutputPort());\n\n  // map the aligned shapes into the third renderer\n  vtkNew<vtkDataSetMapper> map3a;\n  procrustes2->Update();\n  map3a->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes2->GetOutput()->GetBlock(0)));\n\n  vtkNew<vtkActor> Actor3a;\n  Actor3a->SetMapper(map3a);\n  Actor3a->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkDataSetMapper> map3b;\n  procrustes2->Update();\n  map3b->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes2->GetOutput()->GetBlock(1)));\n\n  vtkNew<vtkActor> Actor3b;\n  Actor3b->SetMapper(map3b);\n  Actor3b->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkDataSetMapper> map3c;\n  procrustes2->Update();\n  map3c->SetInputData(\n      dynamic_cast<vtkDataSet*>(procrustes2->GetOutput()->GetBlock(2)));\n\n  vtkNew<vtkActor> Actor3c;\n  Actor3c->SetMapper(map3c);\n  Actor3c->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create the RenderWindow and its three Renderers\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderer> ren2;\n  vtkNew<vtkRenderer> ren3;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->AddRenderer(ren2);\n  renWin->AddRenderer(ren3);\n  renWin->SetSize(600, 300);\n  renWin->SetWindowName(\"ProcrustesAlignmentFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer\n  ren1->AddActor(Actor1a);\n  ren1->AddActor(Actor1b);\n  ren1->AddActor(Actor1c);\n\n  ren2->AddActor(Actor2a);\n  ren2->AddActor(Actor2b);\n  ren2->AddActor(Actor2c);\n\n  ren3->AddActor(Actor3a);\n  ren3->AddActor(Actor3b);\n  ren3->AddActor(Actor3c);\n\n  // set the properties of the renderers\n\n  ren1->SetBackground(colors->GetColor3d(\"Bisque\").GetData());\n  ren1->SetViewport(0.0, 0.0, 0.33, 1.0);\n  ren1->GetActiveCamera()->SetPosition(1, -1, 0);\n  ren1->ResetCamera();\n\n  ren2->SetBackground(colors->GetColor3d(\"Cornsilk\").GetData());\n  ren2->SetViewport(0.33, 0.0, 0.66, 1.0);\n  ren2->ResetCamera();\n  ren2->GetActiveCamera()->SetPosition(1, -1, 0);\n  ren2->ResetCamera();\n\n  ren3->SetBackground(colors->GetColor3d(\"Eggshell\").GetData());\n  ren3->SetViewport(0.66, 0.0, 1.0, 1.0);\n  ren3->ResetCamera();\n  ren3->GetActiveCamera()->SetPosition(1, -1, 0);\n  ren3->ResetCamera();\n\n  renWin->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ProcrustesAlignmentFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProcrustesAlignmentFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersHybrid\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProcrustesAlignmentFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProcrustesAlignmentFilter MACOSX_BUNDLE ProcrustesAlignmentFilter.cxx )\n  target_link_libraries(ProcrustesAlignmentFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProcrustesAlignmentFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ProcrustesAlignmentFilter/#download-and-build-procrustesalignmentfilter","title":"Download and Build ProcrustesAlignmentFilter","text":"

        Click here to download ProcrustesAlignmentFilter and its CMakeLists.txt file. Once the tarball ProcrustesAlignmentFilter.tar has been downloaded and extracted,

        cd ProcrustesAlignmentFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ProcrustesAlignmentFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/QuantizePolyDataPoints/","title":"QuantizePolyDataPoints","text":"

        vtk-examples/Cxx/PolyData/QuantizePolyDataPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/QuantizePolyDataPoints/#description","title":"Description","text":"

        This example demonstrates how to \"snap\" points onto a discrete grid. This example rounds the coordinates of each point the the nearest 0.1

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/QuantizePolyDataPoints/#code","title":"Code","text":"

        QuantizePolyDataPoints.cxx

        #include <vtkCamera.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkQuantizePolyDataPoints.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(100);\n  pointSource->Update();\n\n  std::cout << \"There are \" << pointSource->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n\n  vtkNew<vtkQuantizePolyDataPoints> quantizeFilter;\n  quantizeFilter->SetInputConnection(pointSource->GetOutputPort());\n  quantizeFilter->SetQFactor(.1);\n  quantizeFilter->Update();\n\n  vtkPolyData* quantized = quantizeFilter->GetOutput();\n  std::cout << \"There are \" << quantized->GetNumberOfPoints()\n            << \" quantized points.\" << std::endl;\n\n  for (vtkIdType i = 0; i < pointSource->GetOutput()->GetNumberOfPoints(); i++)\n  {\n    double pOrig[3];\n    double pQuantized[3];\n    pointSource->GetOutput()->GetPoint(i, pOrig);\n    quantized->GetPoints()->GetPoint(i, pQuantized);\n\n    std::cout << \"Point \" << i << \" : (\" << pOrig[0] << \", \" << pOrig[1] << \", \"\n              << pOrig[2] << \")\"\n              << \" (\" << pQuantized[0] << \", \" << pQuantized[1] << \", \"\n              << pQuantized[2] << \")\" << std::endl;\n  }\n\n  double radius = 0.02;\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(radius);\n\n  vtkNew<vtkGlyph3DMapper> inputMapper;\n  inputMapper->SetInputConnection(pointSource->GetOutputPort());\n  inputMapper->SetSourceConnection(sphereSource->GetOutputPort());\n  inputMapper->ScalarVisibilityOff();\n  inputMapper->ScalingOff();\n\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(colors->GetColor3d(\"Orchid\").GetData());\n\n  vtkNew<vtkGlyph3DMapper> quantizedMapper;\n  quantizedMapper->SetInputConnection(quantizeFilter->GetOutputPort());\n  quantizedMapper->SetSourceConnection(sphereSource->GetOutputPort());\n  quantizedMapper->ScalarVisibilityOff();\n  quantizedMapper->ScalingOff();\n\n  vtkNew<vtkActor> quantizedActor;\n  quantizedActor->SetMapper(quantizedMapper);\n  quantizedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Orchid\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 360);\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"QuantizePolyDataPoints\");\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Bisque\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"PaleTurquoise\").GetData());\n\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(quantizedActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/QuantizePolyDataPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuantizePolyDataPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuantizePolyDataPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuantizePolyDataPoints MACOSX_BUNDLE QuantizePolyDataPoints.cxx )\n  target_link_libraries(QuantizePolyDataPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuantizePolyDataPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/QuantizePolyDataPoints/#download-and-build-quantizepolydatapoints","title":"Download and Build QuantizePolyDataPoints","text":"

        Click here to download QuantizePolyDataPoints and its CMakeLists.txt file. Once the tarball QuantizePolyDataPoints.tar has been downloaded and extracted,

        cd QuantizePolyDataPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QuantizePolyDataPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/Reflection/","title":"Reflection","text":"

        vtk-examples/Cxx/PolyData/Reflection

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/Reflection/#description","title":"Description","text":"

        Note

        This example uses vtkReflectionFilter, which outputs a vtkDataObject. For an example that returns a vtkPolyData, see TransformPolyData.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/Reflection/#code","title":"Code","text":"

        Reflection.cxx

        #include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkReflectionFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Mint\").GetData());\n\n  // Reflection\n  vtkNew<vtkReflectionFilter> reflectionFilter;\n  reflectionFilter->SetInputConnection(coneSource->GetOutputPort());\n  reflectionFilter->CopyInputOff();\n  reflectionFilter->Update();\n\n  vtkNew<vtkDataSetMapper> reflectionMapper;\n  reflectionMapper->SetInputConnection(reflectionFilter->GetOutputPort());\n  vtkNew<vtkActor> reflectionActor;\n  reflectionActor->SetMapper(reflectionMapper);\n  reflectionActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Reflection\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(coneActor);\n  renderer->AddActor(reflectionActor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/Reflection/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Reflection)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Reflection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Reflection MACOSX_BUNDLE Reflection.cxx )\n  target_link_libraries(Reflection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Reflection\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/Reflection/#download-and-build-reflection","title":"Download and Build Reflection","text":"

        Click here to download Reflection and its CMakeLists.txt file. Once the tarball Reflection.tar has been downloaded and extracted,

        cd Reflection/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Reflection\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/RemoveOutsideSurface/","title":"RemoveOutsideSurface","text":"

        vtk-examples/Cxx/PolyData/RemoveOutsideSurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/RemoveOutsideSurface/#description","title":"Description","text":"

        This example removes the outer surface of a multiple surface vtkPolyData model. The examples assumes the outside surface is closed and there is only one outside surface. It also assumes that the center of the model lies inside the outer surface.

        The example proceeds as follows:

        1. Use vtkConnectivityFilter to label all of the regions in the model with a region id.
        2. Cast a ray from outside the bounds of the model into the center of the model. Use a vtkCellLocator to intersect the ray with the model. The intersected cell will be on the outside surface of the model.
        3. The vtkCellData of the intersected cell will have the region id of the cell.
        4. Use a vtkCellIterator to visit each cell of the model. Cells whose region id is not equal to the interesected cell's region io are retained on a new vtkPolyData

        The resulting vtkPolyData will contain all but the outside surface.

        If run without arguments, the example generates several small (in area) spheres inside a large (in area) sphere. The inner sphere have more cells than the outer sphere, but will not be extracted.

        The gold model is the original polydata and the blue model is the original with tghe outer surface removed.

        You can try your own surface by specifying a XML PolyData file (.vtp) on the command line.

        Seealso

        ExtractOutsideSurface extracts only the outside surface.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/RemoveOutsideSurface/#code","title":"Code","text":"

        RemoveOutsideSurface.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkCellLocator.h>\n#include <vtkConnectivityFilter.h>\n#include <vtkGenericCell.h>\n#include <vtkIdTypeArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // PolyData to process.\n  vtkSmartPointer<vtkPolyData> polyData;\n\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkAppendPolyData> appendFilter;\n\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n\n    for (int i = 0; i < 20; ++i)\n    {\n      // Small spheres with most polgons\n      vtkNew<vtkSphereSource> sphereSource1;\n      sphereSource1->SetThetaResolution(10);\n      sphereSource1->SetPhiResolution(10);\n      auto x = randomSequence->GetRangeValue(4.0, 14.0);\n      randomSequence->Next();\n      auto y = randomSequence->GetRangeValue(-3.0, 5.0);\n      randomSequence->Next();\n      // auto z = randomSequence->GetRangeValue(4.0, 14.0);\n      randomSequence->Next();\n      sphereSource1->SetCenter(x, y, x);\n      sphereSource1->SetRadius(1.0);\n      appendFilter->AddInputConnection(sphereSource1->GetOutputPort());\n    }\n\n    // Large sphere with least polygons.\n    vtkNew<vtkSphereSource> sphereSource2;\n    sphereSource2->SetRadius(10);\n    sphereSource2->SetCenter(10, 1, 10);\n\n    appendFilter->AddInputConnection(sphereSource2->GetOutputPort());\n    appendFilter->Update();\n    polyData = appendFilter->GetOutput();\n  }\n\n  double center[3], bounds[6];\n  polyData->GetCenter(center);\n  std::cout << \"Center of data: \" << center[0] << \", \" << center[1] << \", \"\n            << center[2] << std::endl;\n  polyData->GetPoints()->GetBounds(bounds);\n  std::cout << \"Bounds of data: \" << bounds[0] << \", \" << bounds[1] << \", \"\n            << bounds[2] << \", \" << bounds[3] << \", \" << bounds[4] << \", \"\n            << bounds[5] << std::endl;\n\n  // Extract all regions and label cells with region number.\n  vtkNew<vtkConnectivityFilter> connectivityFilter;\n  connectivityFilter->SetInputData(polyData);\n  connectivityFilter->SetExtractionModeToAllRegions();\n  connectivityFilter->ColorRegionsOn();\n  connectivityFilter->Update();\n\n  // Build a cell locator.\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(connectivityFilter->GetOutput());\n  cellLocator->BuildLocator();\n\n  // Now fire a ray from outside the bounds to the center and find a\n  // cell. This cell should be on the outside surface.\n  double rayStart[3];\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    rayStart[i] = bounds[2 * i + 1] * 1.1;\n  }\n\n  vtkIdType cellId = -1;\n  double xyz[3], t, pcoords[3];\n  int subId;\n\n  cellLocator->IntersectWithLine(rayStart, center, 0.0001, t, xyz, pcoords,\n                                 subId, cellId);\n\n  vtkIdTypeArray* cd = dynamic_cast<vtkIdTypeArray*>(\n      connectivityFilter->GetOutput()->GetCellData()->GetScalars());\n  vtkIdType outsideRegionId = cd->GetTuple1(cellId);\n  std::cout << \"Id of cell on outside surface: \" << cellId << std::endl;\n  std::cout << \"CellData at \" << cellId << \": \" << outsideRegionId << std::endl;\n\n  // Build a polydata from cells that are not in the outside surface\n  // Iterate over the original cells.\n  vtkNew<vtkPolyData> insidePolyData;\n  insidePolyData->Allocate();\n  insidePolyData->SetPoints(connectivityFilter->GetOutput()->GetPoints());\n\n  vtkNew<vtkGenericCell> cell;\n  auto it = connectivityFilter->GetOutput()->NewCellIterator();\n  vtkIdType originalCellId = 0;\n  for (it->InitTraversal(); !it->IsDoneWithTraversal();\n       it->GoToNextCell(), ++originalCellId)\n  {\n    //  Retain cell if it is NOT an outside cell.\n    if (cd->GetTuple1(originalCellId) != outsideRegionId)\n    {\n      it->GetCell(cell);\n      insidePolyData->InsertNextCell(it->GetCellType(), cell->GetPointIds());\n    }\n  }\n  it->Delete();\n\n  // Create a mapper and actor for original data.\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputData(polyData);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->BackfaceCullingOn();\n  originalActor->GetProperty()->SetOpacity(.5);\n  originalActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a mapper and actor for extracted data.\n  vtkNew<vtkPolyDataMapper> extractedMapper;\n  extractedMapper->SetInputData(insidePolyData);\n\n  vtkNew<vtkActor> extractedActor;\n  extractedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Peacock\").GetData());\n  extractedActor->SetMapper(extractedMapper);\n  extractedActor->GetProperty()->SetOpacity(0.5);\n  extractedActor->GetProperty()->BackfaceCullingOn();\n\n  // Create a renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(originalActor);\n  renderer->AddActor(extractedActor);\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"Beige\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  extractedActor->SetPosition((bounds[1] - bounds[0]) / 1.9, 0, 0);\n  originalActor->SetPosition(-(bounds[1] - bounds[0]) / 1.9, 0, 0);\n\n  // Create a render window.\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(renderer);\n  renwin->SetSize(512, 512);\n  renwin->SetWindowName(\"RemoveOutsideSurface\");\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renwin);\n  renwin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/RemoveOutsideSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RemoveOutsideSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RemoveOutsideSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RemoveOutsideSurface MACOSX_BUNDLE RemoveOutsideSurface.cxx )\n  target_link_libraries(RemoveOutsideSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RemoveOutsideSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/RemoveOutsideSurface/#download-and-build-removeoutsidesurface","title":"Download and Build RemoveOutsideSurface","text":"

        Click here to download RemoveOutsideSurface and its CMakeLists.txt file. Once the tarball RemoveOutsideSurface.tar has been downloaded and extracted,

        cd RemoveOutsideSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RemoveOutsideSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/RemoveVertices/","title":"RemoveVertices","text":"

        vtk-examples/Cxx/PolyData/RemoveVertices

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/RemoveVertices/#code","title":"Code","text":"

        RemoveVertices.cxx

        #include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtkXMLPolyDataWriter.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtp e.g. Bunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string filename = argv[1];\n\n  // Read all the data from the file.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkPolyData> output;\n  output->ShallowCopy(reader->GetOutput());\n  // output->SetVerts(NULL);\n  vtkNew<vtkCellArray> verts;\n  output->SetVerts(verts);\n  // output->SetPoints(reader->GetOutput()->GetPoints());\n  // output->SetPolys(reader->GetOutput()->GetPolys());\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(\"test.vtp\");\n  writer->SetInputData(output);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/RemoveVertices/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RemoveVertices)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RemoveVertices: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RemoveVertices MACOSX_BUNDLE RemoveVertices.cxx )\n  target_link_libraries(RemoveVertices PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RemoveVertices\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/RemoveVertices/#download-and-build-removevertices","title":"Download and Build RemoveVertices","text":"

        Click here to download RemoveVertices and its CMakeLists.txt file. Once the tarball RemoveVertices.tar has been downloaded and extracted,

        cd RemoveVertices/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RemoveVertices\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ResampleAppendedPolyData/","title":"ResampleAppendedPolyData","text":"

        vtk-examples/Cxx/PolyData/ResampleAppendedPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ResampleAppendedPolyData/#description","title":"Description","text":"

        The example populates a level terrain with randomly positioned and scaled objects selected from vtkPlatonicSolidSource.

        The example proceeds as follows:

        1. Create a terrain using vtkPlaneSource.
        2. Generate objects using vtkPlatonicSolidSource, randomly selecting the type of solid.
        3. Randomly scale and place the object using std::random.
        4. Use vtkAppendPolyDatato to append the object to the terrain and other objects.
        5. Create a higher or lower resolution terrain.
        6. For each point in the new terrain, create a long line, through the point.
        7. Use vtkCellLocator::IntersectWithLine to find the intersection of the line and use its z value as the new terrain height.
        8. Display original and resampled terrain in side-by-side viewports.

        Note

        The example was motivated on this question on VTK's Discourse.

        Note

        Note that std::mt19937_64 gives different results for Microsoft Visual Studio and Linux gcc so it has been commented out and vtkMinimalStandardRandomSequence used instead.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ResampleAppendedPolyData/#code","title":"Code","text":"

        ResampleAppendedPolyData.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkCellLocator.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n// #include <random>\n\nint main(int, char*[])\n{\n  // Define adjustable paramaters.\n  constexpr double xMin = -10.0;\n  constexpr double xMax = 10.0;\n  constexpr double yMin = -10.0;\n  constexpr double yMax = 10.0;\n  constexpr int xResolution = 100;\n  constexpr int yResolution = 100;\n  constexpr double scaleMin = 0.2;\n  constexpr double scaleMax = 1.5;\n  constexpr int numberOfObjects = 200;\n  constexpr int probeResolution = 200.0;\n\n  // Generate terrain.\n  vtkNew<vtkPlaneSource> terrain;\n  terrain->SetOrigin(xMin, yMin, 0.0);\n  terrain->SetPoint2(xMin, yMax, 0.0);\n  terrain->SetPoint1(xMax, yMin, 0.0);\n  terrain->SetXResolution(xResolution);\n  terrain->SetYResolution(yResolution);\n  terrain->Update();\n\n  // Generate objects and append them to terrain.\n  vtkNew<vtkAppendPolyData> append;\n  append->AddInputConnection(terrain->GetOutputPort());\n\n  // Commented out since it gives different results for VS and gcc.\n  // std::mt19937_64 mt(4355412); // Standard mersenne twister engine\n  // std::uniform_int_distribution<> solid(0, 4);\n  // std::uniform_real_distribution<> scale(scaleMin, scaleMax);\n  // std::uniform_real_distribution<> position(xMin + 1.0, xMax - 1.0);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(4355412);\n\n  for (auto i = 0; i < numberOfObjects; ++i)\n  {\n    int solid = static_cast<int>(randomSequence->GetRangeValue(0, 4));\n    randomSequence->Next();\n    double s = randomSequence->GetRangeValue(scaleMin, scaleMax);\n    randomSequence->Next();\n    double x, y;\n    x = randomSequence->GetRangeValue(xMin + 1.0, xMax - 1.0);\n    randomSequence->Next();\n    y = randomSequence->GetRangeValue(yMin + 1.0, yMax - 1.0);\n    randomSequence->Next();\n\n    // Generate an object.\n    vtkNew<vtkPlatonicSolidSource> platonic;\n    // platonic->SetSolidType(solid(mt));\n    platonic->SetSolidType(solid);\n\n    // Translate and scale.\n    vtkNew<vtkTransform> transform;\n    // double s = scale(mt);\n    // transform->Translate(position(mt), position(mt), 0.0);\n    transform->Translate(x, y, 0.0);\n    transform->Scale(s, s, s);\n    vtkNew<vtkTransformPolyDataFilter> transformPD;\n    transformPD->SetTransform(transform);\n    transformPD->SetInputConnection(platonic->GetOutputPort());\n    transformPD->Update();\n\n    vtkNew<vtkPolyData> pd;\n    pd->DeepCopy(transformPD->GetOutput());\n    append->AddInputData(pd);\n  }\n  append->Update();\n\n  // Resample terrian.\n  vtkNew<vtkCellLocator> cellLocator;\n  cellLocator->SetDataSet(append->GetOutput());\n  cellLocator->BuildLocator();\n\n  // Generate a probe plane.\n  vtkNew<vtkPlaneSource> probeTerrain;\n  probeTerrain->SetOrigin(terrain->GetOrigin());\n  probeTerrain->SetPoint2(terrain->GetPoint2());\n  probeTerrain->SetPoint1(terrain->GetPoint1());\n  probeTerrain->SetXResolution(probeResolution);\n  probeTerrain->SetYResolution(probeResolution);\n  probeTerrain->Update();\n\n  vtkPoints* probePoints = probeTerrain->GetOutput()->GetPoints();\n  for (auto i = 0; i < probeTerrain->GetOutput()->GetNumberOfPoints(); ++i)\n  {\n    int subId;\n    double t, xyz[3], pcoords[3];\n    double rayStart[3], rayEnd[3];\n    probePoints->GetPoint(i, rayStart);\n    rayStart[2] += 100000.0;\n    probePoints->GetPoint(i, rayEnd);\n    rayEnd[2] -= 100000.0;\n\n    if (cellLocator->IntersectWithLine(rayStart, rayEnd, 0.0001, t, xyz,\n                                       pcoords, subId))\n    {\n      // The new elevation is in xyz[2].\n      double pt[3];\n      probePoints->GetPoint(i, pt);\n      probePoints->SetPoint(i, pt[0], pt[1], xyz[2]);\n    }\n  }\n  probeTerrain->GetOutput()->GetPointData()->SetNormals(nullptr);\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  // Two viewports, left for original and right for resampled.\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(append->GetOutputPort());\n  originalMapper->SetInputData(append->GetOutput());\n  originalMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetRepresentationToWireframe();\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Seashell\").GetData());\n\n  vtkNew<vtkPolyDataMapper> resampledMapper;\n  resampledMapper->SetInputConnection(append->GetOutputPort());\n  resampledMapper->SetInputData(probeTerrain->GetOutput());\n  resampledMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> resampledActor;\n  resampledActor->SetMapper(resampledMapper);\n  resampledActor->GetProperty()->SetRepresentationToWireframe();\n  resampledActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Seashell\").GetData());\n\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->UseHiddenLineRemovalOn();\n  rightRenderer->AddActor(resampledActor);\n  rightRenderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->UseHiddenLineRemovalOn();\n  leftRenderer->AddActor(originalActor);\n  leftRenderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(rightRenderer);\n  renderWindow->AddRenderer(leftRenderer);\n  renderWindow->SetSize(1024, 512);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"ResampleAppendedPolyData\");\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindow->Render();\n  vtkCamera* camera;\n  camera = leftRenderer->GetActiveCamera();\n  camera->SetFocalPoint(0.0, 0.0, 0.0);\n  camera->SetPosition(1.0, 0.0, 0.0);\n  camera->SetViewUp(0.0, 0.0, 1.0);\n  camera->Azimuth(30.0);\n  camera->Elevation(45.0);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->SetActiveCamera(camera);\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ResampleAppendedPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ResampleAppendedPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ResampleAppendedPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ResampleAppendedPolyData MACOSX_BUNDLE ResampleAppendedPolyData.cxx )\n  target_link_libraries(ResampleAppendedPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ResampleAppendedPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ResampleAppendedPolyData/#download-and-build-resampleappendedpolydata","title":"Download and Build ResampleAppendedPolyData","text":"

        Click here to download ResampleAppendedPolyData and its CMakeLists.txt file. Once the tarball ResampleAppendedPolyData.tar has been downloaded and extracted,

        cd ResampleAppendedPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ResampleAppendedPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ResamplePolyLine/","title":"ResamplePolyLine","text":"

        vtk-examples/Cxx/PolyData/ResamplePolyLine

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/ResamplePolyLine/#description","title":"Description","text":"

        This example resamples a polyline with a vtkCardinalSpline. The resampled line will have 10 times the number of points contained in the original polyline. If no XML file is provided, a random polyline is generated.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ResamplePolyLine/#code","title":"Code","text":"

        ResamplePolyLine.cxx

        #include <vtkActor.h>\n#include <vtkCardinalSpline.h>\n#include <vtkCellArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSplineFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = vtkSmartPointer<vtkPolyData>::New();\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    unsigned int numberOfPoints = 10;\n    vtkNew<vtkPoints> points;\n    vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n    randomSequence->SetSeed(8775070);\n    for (unsigned int i = 0; i < numberOfPoints; ++i)\n    {\n      double x, y, z;\n      // Random position and radius.\n      x = randomSequence->GetRangeValue(-1.0, 1.0);\n      randomSequence->Next();\n      y = randomSequence->GetRangeValue(-1.0, 1.0);\n      randomSequence->Next();\n      z = randomSequence->GetRangeValue(-1.0, 1.0);\n      randomSequence->Next();\n      points->InsertNextPoint(x, y, z);\n    }\n    vtkNew<vtkCellArray> lines;\n    lines->InsertNextCell(numberOfPoints);\n    for (unsigned int i = 0; i < numberOfPoints; ++i)\n    {\n      lines->InsertCellPoint(i);\n    }\n    polyData->SetPoints(points);\n    polyData->SetLines(lines);\n  }\n\n  vtkNew<vtkCardinalSpline> spline;\n  spline->SetLeftConstraint(2);\n  spline->SetLeftValue(0.0);\n  spline->SetRightConstraint(2);\n  spline->SetRightValue(0.0);\n\n  vtkNew<vtkSplineFilter> splineFilter;\n  splineFilter->SetInputData(polyData);\n  splineFilter->SetNumberOfSubdivisions(polyData->GetNumberOfPoints() * 10);\n  splineFilter->SetSpline(spline);\n\n  vtkNew<vtkPolyDataMapper> splineMapper;\n  splineMapper->SetInputConnection(splineFilter->GetOutputPort());\n\n  vtkNew<vtkActor> splineActor;\n  splineActor->SetMapper(splineMapper);\n\n  vtkNew<vtkSphereSource> originalNodes;\n  originalNodes->SetRadius(.04);\n  originalNodes->SetPhiResolution(10);\n  originalNodes->SetThetaResolution(10);\n\n  vtkNew<vtkGlyph3D> glyphOriginal;\n  glyphOriginal->SetInputData(polyData);\n  glyphOriginal->SetSourceConnection(originalNodes->GetOutputPort());\n\n  vtkNew<vtkSphereSource> newNodes;\n  newNodes->SetRadius(.02);\n  newNodes->SetPhiResolution(10);\n  newNodes->SetThetaResolution(10);\n\n  vtkNew<vtkGlyph3D> glyphNew;\n  glyphNew->SetInputConnection(splineFilter->GetOutputPort());\n  glyphNew->SetSourceConnection(newNodes->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(glyphOriginal->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  originalActor->GetProperty()->SetOpacity(.6);\n\n  vtkNew<vtkPolyDataMapper> newMapper;\n  newMapper->SetInputConnection(glyphNew->GetOutputPort());\n\n  vtkNew<vtkActor> newActor;\n  newActor->SetMapper(newMapper);\n  newActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ResamplePolyLine\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(originalActor);\n  renderer->AddActor(newActor);\n  renderer->AddActor(splineActor);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ResamplePolyLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ResamplePolyLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ResamplePolyLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ResamplePolyLine MACOSX_BUNDLE ResamplePolyLine.cxx )\n  target_link_libraries(ResamplePolyLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ResamplePolyLine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ResamplePolyLine/#download-and-build-resamplepolyline","title":"Download and Build ResamplePolyLine","text":"

        Click here to download ResamplePolyLine and its CMakeLists.txt file. Once the tarball ResamplePolyLine.tar has been downloaded and extracted,

        cd ResamplePolyLine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ResamplePolyLine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ReverseSense/","title":"ReverseSense","text":"

        vtk-examples/Cxx/PolyData/ReverseSense

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ReverseSense/#code","title":"Code","text":"

        ReverseSense.cxx

        #include <vtkFloatArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkReverseSense.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  auto pointNormals = dynamic_cast<vtkFloatArray*>(\n      sphereSource->GetOutput()->GetPointData()->GetNormals());\n\n  std::cout << std::endl << \"Normals: \" << std::endl;\n  // Display the first few normals.\n  for (unsigned int i = 0; i < 5; i++)\n  {\n    double pN[3];\n    pointNormals->GetTuple(i, pN);\n    std::cout << \"Point normal \" << i << \": \" << pN[0] << \" \" << pN[1] << \" \"\n              << pN[2] << std::endl;\n  }\n\n  vtkNew<vtkReverseSense> reverseSense;\n  reverseSense->SetInputConnection(sphereSource->GetOutputPort());\n  reverseSense->ReverseNormalsOn();\n  reverseSense->Update();\n\n  auto reversedNormals = dynamic_cast<vtkFloatArray*>(\n      reverseSense->GetOutput()->GetPointData()->GetNormals());\n\n  std::cout << std::endl << \"Reversed: \" << std::endl;\n  // Display the first few normals to verify that they are flipped\n  for (unsigned int i = 0; i < 5; i++)\n  {\n    double pN[3];\n    reversedNormals->GetTuple(i, pN);\n    std::cout << \"Reversed normal \" << i << \": \" << pN[0] << \" \" << pN[1] << \" \"\n              << pN[2] << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ReverseSense/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReverseSense)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReverseSense: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReverseSense MACOSX_BUNDLE ReverseSense.cxx )\n  target_link_libraries(ReverseSense PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReverseSense\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ReverseSense/#download-and-build-reversesense","title":"Download and Build ReverseSense","text":"

        Click here to download ReverseSense and its CMakeLists.txt file. Once the tarball ReverseSense.tar has been downloaded and extracted,

        cd ReverseSense/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReverseSense\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/RibbonFilter/","title":"RibbonFilter","text":"

        vtk-examples/Cxx/PolyData/RibbonFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/RibbonFilter/#description","title":"Description","text":"

        This example demonstrates how to draw a flat surface (a ribbon) along a line.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/RibbonFilter/#code","title":"Code","text":"

        RibbonFilter.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRibbonFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Spiral parameters.\n  unsigned int nV = 256; // No. of vertices\n  double rS = 2;         // Spiral radius\n  unsigned int nCyc = 3; // No. of helical cycles\n  double h = 10;         // Height\n\n  unsigned int i;\n\n  // Create points and cells for a helix.\n  vtkNew<vtkPoints> points;\n  for (i = 0; i < nV; i++)\n  {\n    // Helical coordinates.\n    auto vX = rS * cos(2 * vtkMath::Pi() * nCyc * i / (nV - 1));\n    auto vY = rS * sin(2 * vtkMath::Pi() * nCyc * i / (nV - 1));\n    auto vZ = h * i / nV;\n    points->InsertPoint(i, vX, vY, vZ);\n  }\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(nV);\n  for (i = 0; i < nV; i++)\n  {\n    lines->InsertCellPoint(i);\n  }\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n  polyData->SetLines(lines);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  lineActor->GetProperty()->SetLineWidth(3);\n\n  // Create a ribbon around the line.\n  vtkNew<vtkRibbonFilter> ribbonFilter;\n  ribbonFilter->SetInputData(polyData);\n  ribbonFilter->SetWidth(.4);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> ribbonMapper;\n  ribbonMapper->SetInputConnection(ribbonFilter->GetOutputPort());\n\n  vtkNew<vtkActor> ribbonActor;\n  ribbonActor->SetMapper(ribbonMapper);\n  ribbonActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"RibbonFilter\");\n\n  // Add the actor to the scene.\n  renderer->AddActor(ribbonActor);\n  renderer->AddActor(lineActor);\n\n  // Render and interact.\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Generate an interesting view.\n  renderer->GetActiveCamera()->Azimuth(40);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/RibbonFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RibbonFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RibbonFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RibbonFilter MACOSX_BUNDLE RibbonFilter.cxx )\n  target_link_libraries(RibbonFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RibbonFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/RibbonFilter/#download-and-build-ribbonfilter","title":"Download and Build RibbonFilter","text":"

        Click here to download RibbonFilter and its CMakeLists.txt file. Once the tarball RibbonFilter.tar has been downloaded and extracted,

        cd RibbonFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RibbonFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/RotationAroundLine/","title":"RotationAroundLine","text":"

        vtk-examples/Cxx/PolyData/RotationAroundLine

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/RotationAroundLine/#description","title":"Description","text":"

        This example demonstrates how to rotate an object around an axis. For the demo, we rotate a cone 10 degrees around the y axis.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/RotationAroundLine/#code","title":"Code","text":"

        RotationAroundLine.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a rendering window and renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"RotationAroundLine\");\n\n  // Create a renderwindowinteractor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create arrow\n  vtkNew<vtkArrowSource> source;\n\n  // Create a transform that rotates the arrow 45\u00b0 around the z-axis.\n  vtkNew<vtkTransform> transform;\n  transform->RotateWXYZ(45, 0, 0, 1);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetTransform(transform);\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->Update();\n\n  // Mapper for the original arrow.\n  vtkNew<vtkPolyDataMapper> coneMapper1;\n  coneMapper1->SetInputConnection(source->GetOutputPort());\n\n  // Another mapper for the rotated arrow.\n  vtkNew<vtkPolyDataMapper> coneMapper2;\n  coneMapper2->SetInputConnection(transformFilter->GetOutputPort());\n\n  // Actor for original arrow.\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(coneMapper1);\n\n  // Actor for rotated arrow.\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(coneMapper2);\n\n  // Color the original arrow.\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"LightCoral\").GetData());\n\n  // Color rotated arrow.\n  actor2->GetProperty()->SetColor(\n      colors->GetColor3d(\"PaleTurquoise\").GetData());\n\n  // Assign actor to the renderer.\n  ren->AddActor(actor1);\n  ren->AddActor(actor2);\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Enable the user interface interactor.\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/RotationAroundLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotationAroundLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotationAroundLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotationAroundLine MACOSX_BUNDLE RotationAroundLine.cxx )\n  target_link_libraries(RotationAroundLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotationAroundLine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/RotationAroundLine/#download-and-build-rotationaroundline","title":"Download and Build RotationAroundLine","text":"

        Click here to download RotationAroundLine and its CMakeLists.txt file. Once the tarball RotationAroundLine.tar has been downloaded and extracted,

        cd RotationAroundLine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RotationAroundLine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/RuledSurfaceFilter/","title":"RuledSurfaceFilter","text":"

        vtk-examples/Cxx/PolyData/RuledSurfaceFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/RuledSurfaceFilter/#code","title":"Code","text":"

        RuledSurfaceFilter.cxx

        #include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRuledSurfaceFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create first line.\n  vtkNew<vtkPoints> points;\n  points->InsertPoint(0, 0, 0, 1);\n  points->InsertPoint(1, 1, 0, 0);\n  points->InsertPoint(2, 0, 1, 0);\n  points->InsertPoint(3, 1, 1, 1);\n\n  vtkNew<vtkLine> line1;\n  line1->GetPointIds()->SetId(0, 0);\n  line1->GetPointIds()->SetId(1, 1);\n\n  vtkNew<vtkLine> line2;\n  line2->GetPointIds()->SetId(0, 2);\n  line2->GetPointIds()->SetId(1, 3);\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(line1);\n  lines->InsertNextCell(line2);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetLines(lines);\n\n  vtkNew<vtkRuledSurfaceFilter> ruledSurfaceFilter;\n  ruledSurfaceFilter->SetInputData(polydata);\n  ruledSurfaceFilter->SetResolution(21, 21);\n  ruledSurfaceFilter->SetRuledModeToResample();\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RuledSurfaceFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(ruledSurfaceFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(60);\n  renderer->GetActiveCamera()->Elevation(60);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/RuledSurfaceFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RuledSurfaceFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RuledSurfaceFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RuledSurfaceFilter MACOSX_BUNDLE RuledSurfaceFilter.cxx )\n  target_link_libraries(RuledSurfaceFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RuledSurfaceFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/RuledSurfaceFilter/#download-and-build-ruledsurfacefilter","title":"Download and Build RuledSurfaceFilter","text":"

        Click here to download RuledSurfaceFilter and its CMakeLists.txt file. Once the tarball RuledSurfaceFilter.tar has been downloaded and extracted,

        cd RuledSurfaceFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RuledSurfaceFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/SelectPolyData/","title":"SelectPolyData","text":"

        vtk-examples/Cxx/PolyData/SelectPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/SelectPolyData/#code","title":"Code","text":"

        SelectPolyData.cxx

        #include <vtkClipPolyData.h>\n#include <vtkLODActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelectPolyData.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(50);\n  sphereSource->SetThetaResolution(100);\n  sphereSource->Update();\n\n  vtkNew<vtkPoints> selectionPoints;\n\n  selectionPoints->InsertPoint(0, -0.16553, 0.135971, 0.451972);\n  selectionPoints->InsertPoint(1, -0.0880123, -0.134952, 0.4747);\n  selectionPoints->InsertPoint(2, 0.00292618, -0.134604, 0.482459);\n  selectionPoints->InsertPoint(3, 0.0641941, 0.067112, 0.490947);\n  selectionPoints->InsertPoint(4, 0.15577, 0.0734765, 0.469245);\n  selectionPoints->InsertPoint(5, 0.166667, -0.129217, 0.454622);\n  selectionPoints->InsertPoint(6, 0.241259, -0.123363, 0.420581);\n  selectionPoints->InsertPoint(7, 0.240334, 0.0727106, 0.432555);\n  selectionPoints->InsertPoint(8, 0.308529, 0.0844311, 0.384357);\n  selectionPoints->InsertPoint(9, 0.32672, -0.121674, 0.359187);\n  selectionPoints->InsertPoint(10, 0.380721, -0.117342, 0.302527);\n  selectionPoints->InsertPoint(11, 0.387804, 0.0455074, 0.312375);\n  selectionPoints->InsertPoint(12, 0.43943, -0.111673, 0.211707);\n  selectionPoints->InsertPoint(13, 0.470984, -0.0801913, 0.147919);\n  selectionPoints->InsertPoint(14, 0.436777, 0.0688872, 0.233021);\n  selectionPoints->InsertPoint(15, 0.44874, 0.188852, 0.109882);\n  selectionPoints->InsertPoint(16, 0.391352, 0.254285, 0.176943);\n  selectionPoints->InsertPoint(17, 0.373274, 0.154162, 0.294296);\n  selectionPoints->InsertPoint(18, 0.274659, 0.311654, 0.276609);\n  selectionPoints->InsertPoint(19, 0.206068, 0.31396, 0.329702);\n  selectionPoints->InsertPoint(20, 0.263789, 0.174982, 0.387308);\n  selectionPoints->InsertPoint(21, 0.213034, 0.175485, 0.417142);\n  selectionPoints->InsertPoint(22, 0.169113, 0.261974, 0.390286);\n  selectionPoints->InsertPoint(23, 0.102552, 0.25997, 0.414814);\n  selectionPoints->InsertPoint(24, 0.131512, 0.161254, 0.454705);\n  selectionPoints->InsertPoint(25, 0.000192443, 0.156264, 0.475307);\n  selectionPoints->InsertPoint(26, -0.0392091, 0.000251724, 0.499943);\n  selectionPoints->InsertPoint(27, -0.096161, 0.159646, 0.46438);\n\n  vtkNew<vtkSelectPolyData> loop;\n  loop->SetInputConnection(sphereSource->GetOutputPort());\n  loop->SetLoop(selectionPoints);\n  loop->GenerateSelectionScalarsOn();\n  loop->SetSelectionModeToSmallestRegion(); // negative scalars inside\n\n  vtkNew<vtkClipPolyData> clip;\n  clip->SetInputConnection(loop->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> clipMapper;\n  clipMapper->SetInputConnection(clip->GetOutputPort());\n  clipMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkLODActor> clipActor;\n  clipActor->SetMapper(clipMapper);\n  clipActor->SetBackfaceProperty(backProp);\n  clipActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SelectPolyData\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(clipActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetSize(500, 500);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/SelectPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectPolyData MACOSX_BUNDLE SelectPolyData.cxx )\n  target_link_libraries(SelectPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/SelectPolyData/#download-and-build-selectpolydata","title":"Download and Build SelectPolyData","text":"

        Click here to download SelectPolyData and its CMakeLists.txt file. Once the tarball SelectPolyData.tar has been downloaded and extracted,

        cd SelectPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SelectPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/SelectVisiblePoints/","title":"SelectVisiblePoints","text":"

        vtk-examples/Cxx/PolyData/SelectVisiblePoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/SelectVisiblePoints/#description","title":"Description","text":"

        This example demonstrates how to determine which objects are visible.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/SelectVisiblePoints/#code","title":"Code","text":"

        SelectVisiblePoints.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelectVisiblePoints.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nclass MyInteractor : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static MyInteractor* New();\n  vtkTypeMacro(MyInteractor, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnLeftButtonDown() override\n  {\n    this->VisibleFilter->Update();\n    std::cout << \"There are currently: \"\n              << this->VisibleFilter->GetOutput()->GetNumberOfPoints()\n              << \" visible.\" << std::endl;\n    // Forward events\n    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();\n  }\n\n  void SetVisibleFilter(vtkSmartPointer<vtkSelectVisiblePoints> vis)\n  {\n    this->VisibleFilter = vis;\n  }\n\nprivate:\n  vtkSmartPointer<vtkSelectVisiblePoints> VisibleFilter;\n};\n\nvtkStandardNewMacro(MyInteractor);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(5.0, 0, 0);\n  sphereSource->Update();\n\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetRadius(2.0);\n  pointSource->SetNumberOfPoints(200);\n  pointSource->Update();\n\n  // Create an actor and mapper.\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkPolyDataMapper> pointsMapper;\n  pointsMapper->SetInputConnection(pointSource->GetOutputPort());\n\n  vtkNew<vtkActor> pointsActor;\n  pointsActor->SetMapper(pointsMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Honeydew\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SelectVisiblePoints\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(pointsActor);\n  renderer->SetBackground(colors->GetColor3d(\"ivory_black\").GetData());\n\n  vtkNew<vtkSelectVisiblePoints> selectVisiblePoints;\n  selectVisiblePoints->SetInputConnection(pointSource->GetOutputPort());\n  selectVisiblePoints->SetRenderer(renderer);\n  selectVisiblePoints->Update();\n\n  vtkNew<MyInteractor> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->SetVisibleFilter(selectVisiblePoints);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/SelectVisiblePoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectVisiblePoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectVisiblePoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectVisiblePoints MACOSX_BUNDLE SelectVisiblePoints.cxx )\n  target_link_libraries(SelectVisiblePoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectVisiblePoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/SelectVisiblePoints/#download-and-build-selectvisiblepoints","title":"Download and Build SelectVisiblePoints","text":"

        Click here to download SelectVisiblePoints and its CMakeLists.txt file. Once the tarball SelectVisiblePoints.tar has been downloaded and extracted,

        cd SelectVisiblePoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SelectVisiblePoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ShrinkPolyData/","title":"ShrinkPolyData","text":"

        vtk-examples/Cxx/PolyData/ShrinkPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ShrinkPolyData/#code","title":"Code","text":"

        ShrinkPolyData.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]); // e.g. cowHead.vtp\n    reader->Update();\n    inputPolyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetPhiResolution(15);\n    sphereSource->SetThetaResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkShrinkPolyData> shrink;\n  shrink->SetShrinkFactor(.8);\n  shrink->SetInputData(inputPolyData);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(shrink->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Salmon\").GetData());\n  actor->SetBackfaceProperty(back);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ShrinkPolyData\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ShrinkPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShrinkPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShrinkPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShrinkPolyData MACOSX_BUNDLE ShrinkPolyData.cxx )\n  target_link_libraries(ShrinkPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShrinkPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ShrinkPolyData/#download-and-build-shrinkpolydata","title":"Download and Build ShrinkPolyData","text":"

        Click here to download ShrinkPolyData and its CMakeLists.txt file. Once the tarball ShrinkPolyData.tar has been downloaded and extracted,

        cd ShrinkPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ShrinkPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/Silhouette/","title":"Silhouette","text":"

        vtk-examples/Cxx/PolyData/Silhouette

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/Silhouette/#code","title":"Code","text":"

        Silhouette.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataSilhouette.h>\n#include <vtkProperty.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  if (argc < 2)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->Update();\n\n    polyData = sphereSource->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n\n    vtkNew<vtkCleanPolyData> clean;\n    clean->SetInputConnection(reader->GetOutputPort());\n    clean->Update();\n\n    polyData = clean->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // create mapper and actor for original model\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  // create renderer and renderWindow\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  renderer->AddActor(actor); // view the original model\n\n  // Compute the silhouette\n  vtkNew<vtkPolyDataSilhouette> silhouette;\n  silhouette->SetInputData(polyData);\n  silhouette->SetCamera(renderer->GetActiveCamera());\n  silhouette->SetEnableFeatureAngle(0);\n\n  // create mapper and actor for silouette\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(silhouette->GetOutputPort());\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor2->GetProperty()->SetLineWidth(5);\n\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  // render and interact\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"Silhouette\");\n\n  renderWindow->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/Silhouette/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Silhouette)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersHybrid\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Silhouette: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Silhouette MACOSX_BUNDLE Silhouette.cxx )\n  target_link_libraries(Silhouette PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Silhouette\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/Silhouette/#download-and-build-silhouette","title":"Download and Build Silhouette","text":"

        Click here to download Silhouette and its CMakeLists.txt file. Once the tarball Silhouette.tar has been downloaded and extracted,

        cd Silhouette/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Silhouette\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/SmoothPolyDataFilter/","title":"SmoothPolyDataFilter","text":"

        vtk-examples/Cxx/PolyData/SmoothPolyDataFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/SmoothPolyDataFilter/#code","title":"Code","text":"

        SmoothPolyDataFilter.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDelaunay2D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmoothPolyDataFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create parabola over a grid of points\n  vtkNew<vtkPoints> points;\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n\n  int GridSize = 20;\n  double z;\n  for (int x = -GridSize; x < GridSize; x++)\n  {\n    for (int y = -GridSize; y < GridSize; y++)\n    {\n      z = randomSequence->GetRangeValue(-1, 1) + 0.05 * x * x + 0.05 * y * y;\n      randomSequence->Next();\n      points->InsertNextPoint(x, y, z);\n    }\n  }\n\n  // Add the grid points to a polydata object\n  vtkNew<vtkPolyData> inputPolyData;\n  inputPolyData->SetPoints(points);\n\n  // Triangulate the grid points\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(inputPolyData);\n  delaunay->Update();\n\n  vtkNew<vtkSmoothPolyDataFilter> smoothFilter;\n  smoothFilter->SetInputConnection(delaunay->GetOutputPort());\n  smoothFilter->SetNumberOfIterations(15);\n  smoothFilter->SetRelaxationFactor(0.1);\n  smoothFilter->FeatureEdgeSmoothingOff();\n  smoothFilter->BoundarySmoothingOn();\n  smoothFilter->Update();\n\n  // Update normals on newly smoothed polydata\n  vtkNew<vtkPolyDataNormals> normalGenerator;\n  normalGenerator->SetInputConnection(smoothFilter->GetOutputPort());\n  normalGenerator->ComputePointNormalsOn();\n  normalGenerator->ComputeCellNormalsOn();\n  normalGenerator->Update();\n\n  vtkNew<vtkPolyDataMapper> inputMapper;\n  inputMapper->SetInputConnection(delaunay->GetOutputPort());\n  vtkNew<vtkActor> inputActor;\n  inputActor->SetMapper(inputMapper);\n  inputActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkPolyDataMapper> smoothedMapper;\n  smoothedMapper->SetInputConnection(normalGenerator->GetOutputPort());\n  vtkNew<vtkActor> smoothedActor;\n  smoothedActor->SetMapper(smoothedMapper);\n  smoothedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"SmoothPolyDataFilter\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  // Add the input parabola to the left and the smoothed parabola to the right\n  leftRenderer->AddActor(inputActor);\n  rightRenderer->AddActor(smoothedActor);\n\n  leftRenderer->ResetCamera();\n  leftRenderer->GetActiveCamera()->Azimuth(130);\n  leftRenderer->GetActiveCamera()->Elevation(-80);\n  vtkCamera* camera;\n  camera = leftRenderer->GetActiveCamera();\n\n  rightRenderer->ResetCamera();\n  rightRenderer->GetActiveCamera()->Azimuth(130);\n  rightRenderer->GetActiveCamera()->Elevation(-80);\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/SmoothPolyDataFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SmoothPolyDataFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SmoothPolyDataFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SmoothPolyDataFilter MACOSX_BUNDLE SmoothPolyDataFilter.cxx )\n  target_link_libraries(SmoothPolyDataFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SmoothPolyDataFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/SmoothPolyDataFilter/#download-and-build-smoothpolydatafilter","title":"Download and Build SmoothPolyDataFilter","text":"

        Click here to download SmoothPolyDataFilter and its CMakeLists.txt file. Once the tarball SmoothPolyDataFilter.tar has been downloaded and extracted,

        cd SmoothPolyDataFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SmoothPolyDataFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/Stripper/","title":"Stripper","text":"

        vtk-examples/Cxx/PolyData/Stripper

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/Stripper/#code","title":"Code","text":"

        Stripper.cxx

        #include <vtkNew.h>\n#include <vtkSphereSource.h>\n#include <vtkStripper.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  std::cout << \"Number of cells before stripping: \"\n            << sphereSource->GetOutput()->GetNumberOfCells() << std::endl;\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(sphereSource->GetOutputPort());\n  stripper->Update();\n\n  std::cout << \"Number of cells after stripping: \"\n            << stripper->GetOutput()->GetNumberOfCells() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/Stripper/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Stripper)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Stripper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Stripper MACOSX_BUNDLE Stripper.cxx )\n  target_link_libraries(Stripper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Stripper\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/Stripper/#download-and-build-stripper","title":"Download and Build Stripper","text":"

        Click here to download Stripper and its CMakeLists.txt file. Once the tarball Stripper.tar has been downloaded and extracted,

        cd Stripper/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Stripper\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ThinPlateSplineTransform/","title":"ThinPlateSplineTransform","text":"

        vtk-examples/Cxx/PolyData/ThinPlateSplineTransform

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ThinPlateSplineTransform/#code","title":"Code","text":"

        ThinPlateSplineTransform.cxx

        #include <vtkActor2D.h>\n#include <vtkBMPReader.h>\n#include <vtkDataObject.h>\n#include <vtkImageBlend.h>\n#include <vtkImageGridSource.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageMapper.h>\n#include <vtkImageReslice.h>\n#include <vtkInteractorStyleTerrain.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkThinPlateSplineTransform.h>\n\n#include <iostream>\n#include <string>\n\n// Warp an image with a thin plate spline.\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename.bmp e.g. masonry.bmp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // First, create an image to warp.\n  vtkNew<vtkImageGridSource> imageGrid;\n  imageGrid->SetGridSpacing(16, 16, 0);\n  imageGrid->SetGridOrigin(0, 0, 0);\n  imageGrid->SetDataExtent(0, 255, 0, 255, 0, 0);\n  imageGrid->SetDataScalarTypeToUnsignedChar();\n\n  vtkNew<vtkLookupTable> table;\n  table->SetTableRange(0, 1);\n  table->SetAlphaRange(0.0, 1.0);\n  table->SetHueRange(0.15, 0.15);\n  table->SetSaturationRange(1, 1);\n  table->SetValueRange(0, 1);\n  table->Build();\n\n  vtkNew<vtkImageMapToColors> alpha;\n  alpha->SetInputConnection(imageGrid->GetOutputPort());\n  alpha->SetLookupTable(table);\n\n  vtkNew<vtkBMPReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n  auto dataExtent = reader->GetDataExtent();\n  // Use dataExtent[1] and dataExtent[3] to set the render window size.\n\n  vtkNew<vtkImageBlend> blend;\n  blend->AddInputConnection(0, reader->GetOutputPort());\n  blend->AddInputConnection(0, alpha->GetOutputPort());\n\n  // Next, create a ThinPlateSpline transform.\n\n  vtkNew<vtkPoints> p1;\n  p1->SetNumberOfPoints(8);\n  p1->SetPoint(0, 0, 0, 0);\n  p1->SetPoint(1, 0, 255, 0);\n  p1->SetPoint(2, 255, 0, 0);\n  p1->SetPoint(3, 255, 255, 0);\n  p1->SetPoint(4, 96, 96, 0);\n  p1->SetPoint(5, 96, 159, 0);\n  p1->SetPoint(6, 159, 159, 0);\n  p1->SetPoint(7, 159, 96, 0);\n\n  vtkNew<vtkPoints> p2;\n  p2->SetNumberOfPoints(8);\n  p2->SetPoint(0, 0, 0, 0);\n  p2->SetPoint(1, 0, 255, 0);\n  p2->SetPoint(2, 255, 0, 0);\n  p2->SetPoint(3, 255, 255, 0);\n  p2->SetPoint(4, 96, 159, 0);\n  p2->SetPoint(5, 159, 159, 0);\n  p2->SetPoint(6, 159, 96, 0);\n  p2->SetPoint(7, 96, 96, 0);\n\n  vtkNew<vtkThinPlateSplineTransform> transform;\n  transform->SetSourceLandmarks(p2);\n  transform->SetTargetLandmarks(p1);\n  transform->SetBasisToR2LogR();\n  // You must invert the transform before passing it to vtkImageReslice.\n  transform->Inverse();\n\n  vtkNew<vtkImageReslice> reslice;\n  reslice->SetInputConnection(blend->GetOutputPort());\n  reslice->SetResliceTransform(transform);\n  reslice->SetInterpolationModeToLinear();\n  vtkNew<vtkImageMapper> map;\n  map->SetInputConnection(reslice->GetOutputPort());\n  map->SetColorWindow(255.0);\n  map->SetColorLevel(127.5);\n  map->SetZSlice(0);\n  vtkNew<vtkActor2D> act;\n  act->SetMapper(map);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(act);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->SetSize(dataExtent[1], dataExtent[3]);\n  window->SetWindowName(\"ThinPlateSplineTransform\");\n\n  window->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n  vtkNew<vtkInteractorStyleTerrain> style;\n  interactor->SetInteractorStyle(style);\n  window->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ThinPlateSplineTransform/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ThinPlateSplineTransform)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  IOImage\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ThinPlateSplineTransform: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ThinPlateSplineTransform MACOSX_BUNDLE ThinPlateSplineTransform.cxx )\n  target_link_libraries(ThinPlateSplineTransform PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ThinPlateSplineTransform\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ThinPlateSplineTransform/#download-and-build-thinplatesplinetransform","title":"Download and Build ThinPlateSplineTransform","text":"

        Click here to download ThinPlateSplineTransform and its CMakeLists.txt file. Once the tarball ThinPlateSplineTransform.tar has been downloaded and extracted,

        cd ThinPlateSplineTransform/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ThinPlateSplineTransform\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ThresholdCells/","title":"ThresholdCells","text":"

        vtk-examples/Cxx/PolyData/ThresholdCells

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ThresholdCells/#code","title":"Code","text":"

        ThresholdCells.cxx

        #include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkThreshold.h>\n#include <vtkTriangle.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(2, 2, 2);\n  points->InsertNextPoint(3, 3, 3);\n  points->InsertNextPoint(4, 4, 4);\n\n  // Create three triangles.\n  vtkNew<vtkTriangle> triangle0;\n  triangle0->GetPointIds()->SetId(0, 0);\n  triangle0->GetPointIds()->SetId(1, 1);\n  triangle0->GetPointIds()->SetId(2, 2);\n\n  vtkNew<vtkTriangle> triangle1;\n  triangle1->GetPointIds()->SetId(0, 1);\n  triangle1->GetPointIds()->SetId(1, 2);\n  triangle1->GetPointIds()->SetId(2, 3);\n\n  vtkNew<vtkTriangle> triangle2;\n  triangle2->GetPointIds()->SetId(0, 2);\n  triangle2->GetPointIds()->SetId(1, 3);\n  triangle2->GetPointIds()->SetId(2, 4);\n\n  // Add the triangles to a cell array.\n  vtkNew<vtkCellArray> triangles;\n  triangles->InsertNextCell(triangle0);\n  triangles->InsertNextCell(triangle1);\n  triangles->InsertNextCell(triangle2);\n\n  // Setup index array.\n  vtkNew<vtkIntArray> index;\n  index->SetNumberOfComponents(1);\n  index->SetName(\"index\");\n  index->InsertNextValue(0);\n  index->InsertNextValue(1);\n  index->InsertNextValue(2);\n\n  // Add points, cells and index array to a polydata.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetPolys(triangles);\n  polydata->GetCellData()->AddArray(index);\n\n  std::cout << \"There are \" << polydata->GetNumberOfCells()\n            << \" cells before thresholding.\" << std::endl;\n\n  vtkNew<vtkThreshold> threshold;\n  threshold->SetInputData(polydata);\n  threshold->SetLowerThreshold(1);\n  threshold->SetThresholdFunction(vtkThreshold::THRESHOLD_LOWER);\n  // Doesn't work because the array is not added as SCALARS, i.e. via SetScalars\n  // threshold->SetInputArrayToProcess(0, 0, 0,\n  // vtkDataObject::FIELD_ASSOCIATION_CELLS, vtkDataSetAttributes::SCALARS); use\n  // like this:\n  threshold->SetInputArrayToProcess(\n      0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, \"index\");\n  threshold->Update();\n\n  vtkUnstructuredGrid* thresholdedPolydata = threshold->GetOutput();\n  std::cout << \"There are \" << thresholdedPolydata->GetNumberOfCells()\n            << \" cells after thresholding.\" << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ThresholdCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ThresholdCells)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ThresholdCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ThresholdCells MACOSX_BUNDLE ThresholdCells.cxx )\n  target_link_libraries(ThresholdCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ThresholdCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ThresholdCells/#download-and-build-thresholdcells","title":"Download and Build ThresholdCells","text":"

        Click here to download ThresholdCells and its CMakeLists.txt file. Once the tarball ThresholdCells.tar has been downloaded and extracted,

        cd ThresholdCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ThresholdCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/ThresholdPoints/","title":"ThresholdPoints","text":"

        vtk-examples/Cxx/PolyData/ThresholdPoints

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/ThresholdPoints/#code","title":"Code","text":"

        ThresholdPoints.cxx

        #include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkThresholdPoints.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(2, 2, 2);\n  points->InsertNextPoint(3, 3, 3);\n  points->InsertNextPoint(4, 4, 4);\n\n  std::cout << \"There are \" << points->GetNumberOfPoints()\n            << \" points before thresholding.\" << std::endl;\n\n  // Setup position index.\n  vtkNew<vtkIntArray> index;\n  index->SetNumberOfComponents(1);\n  index->SetName(\"index\");\n  index->InsertNextValue(0);\n  index->InsertNextValue(1);\n  index->InsertNextValue(2);\n  index->InsertNextValue(3);\n  index->InsertNextValue(4);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->AddArray(index);\n\n  vtkNew<vtkThresholdPoints> threshold;\n  threshold->SetInputData(polydata);\n  threshold->ThresholdByLower(2);\n  threshold->SetInputArrayToProcess(\n      0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, \"index\");\n  threshold->Update();\n\n  // vtkPolyData* thresholdedPolydata = threshold->GetOutput();\n  vtkPolyData* thresholdedPolydata = threshold->GetOutput();\n  std::cout << \"There are \" << thresholdedPolydata->GetNumberOfPoints()\n            << \" points after thresholding.\" << std::endl;\n  for (vtkIdType i = 0; i < thresholdedPolydata->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    thresholdedPolydata->GetPoint(i, p);\n    std::cout << \"Point \" << i << \" : \" << p[0] << \" \" << p[1] << \" \" << p[2]\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/ThresholdPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ThresholdPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ThresholdPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ThresholdPoints MACOSX_BUNDLE ThresholdPoints.cxx )\n  target_link_libraries(ThresholdPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ThresholdPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/ThresholdPoints/#download-and-build-thresholdpoints","title":"Download and Build ThresholdPoints","text":"

        Click here to download ThresholdPoints and its CMakeLists.txt file. Once the tarball ThresholdPoints.tar has been downloaded and extracted,

        cd ThresholdPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ThresholdPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/TransformFilter/","title":"TransformFilter","text":"

        vtk-examples/Cxx/PolyData/TransformFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/TransformFilter/#description","title":"Description","text":"

        This example stretches an arrow.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/TransformFilter/#code","title":"Code","text":"

        TransformFilter.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n\n  vtkNew<vtkTransform> transform;\n  transform->Scale(5, 1, 1);\n\n  vtkNew<vtkTransformFilter> transformFilter;\n  transformFilter->SetInputConnection(arrowSource->GetOutputPort());\n  transformFilter->SetTransform(transform);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(transformFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Coral\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TransformFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/TransformFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformFilter MACOSX_BUNDLE TransformFilter.cxx )\n  target_link_libraries(TransformFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/TransformFilter/#download-and-build-transformfilter","title":"Download and Build TransformFilter","text":"

        Click here to download TransformFilter and its CMakeLists.txt file. Once the tarball TransformFilter.tar has been downloaded and extracted,

        cd TransformFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TransformFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/TransformOrderDemo/","title":"TransformOrderDemo","text":"

        vtk-examples/Cxx/PolyData/TransformOrderDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/TransformOrderDemo/#description","title":"Description","text":"

        This example creates an image. In the left viewport, it translates the image, then translates and rotates the image. In the right viewport, it rotates the image, then rotates and translates the image. One can see that the result is clearly not the same!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/TransformOrderDemo/#code","title":"Code","text":"

        TransformOrderDemo.cxx

        #include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkImageActor.h>\n#include <vtkImageCast.h>\n#include <vtkImageMandelbrotSource.h>\n#include <vtkImageMapper3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image\n  vtkNew<vtkImageMandelbrotSource> source;\n  source->Update();\n\n  vtkNew<vtkImageCast> castFilter;\n  castFilter->SetInputConnection(source->GetOutputPort());\n  castFilter->SetOutputScalarTypeToUnsignedChar();\n  castFilter->Update();\n\n  // Create an actor\n  vtkNew<vtkImageActor> actor1a;\n  actor1a->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n  vtkNew<vtkImageActor> actor1b;\n  actor1b->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> actor2a;\n  actor2a->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  vtkNew<vtkImageActor> actor2b;\n  actor2b->GetMapper()->SetInputConnection(castFilter->GetOutputPort());\n\n  // Create the transformation\n  vtkNew<vtkTransform> transform1a;\n  transform1a->PostMultiply();\n  transform1a->Translate(10.0, 0.0, 0.0);\n  actor1a->SetUserTransform(transform1a);\n\n  vtkNew<vtkTransform> transform1b;\n  transform1b->PostMultiply();\n  transform1b->Translate(10.0, 0.0, 0.0);\n  transform1b->RotateZ(40.0);\n  actor1b->SetUserTransform(transform1b);\n\n  vtkNew<vtkTransform> transform2a;\n  transform2a->PostMultiply();\n  transform2a->RotateZ(40.0);\n  actor2a->SetUserTransform(transform2a);\n\n  vtkNew<vtkTransform> transform2b;\n  transform2b->PostMultiply();\n  transform2b->RotateZ(40.0);\n  transform2b->Translate(10.0, 0.0, 0.0);\n  actor2b->SetUserTransform(transform2b);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Cetup render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 640);\n  renderWindow->SetWindowName(\"TransformOrderDemo\");\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // an interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkAxesActor> axes;\n  axes->AxisLabelsOff();\n  axes->SetTotalLength(5, 5, 5);\n\n  vtkCamera* camera;\n  camera = leftRenderer->GetActiveCamera();\n  leftRenderer->AddActor(axes);\n  leftRenderer->AddActor(actor1a);\n  leftRenderer->AddActor(actor1b);\n\n  rightRenderer->AddActor(axes);\n  rightRenderer->AddActor(actor2a);\n  rightRenderer->AddActor(actor2b);\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->ResetCamera();\n  // rightRenderer->ResetCamera();\n  camera->Zoom(1.3);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/TransformOrderDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformOrderDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  ImagingCore\n  ImagingSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformOrderDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformOrderDemo MACOSX_BUNDLE TransformOrderDemo.cxx )\n  target_link_libraries(TransformOrderDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformOrderDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/TransformOrderDemo/#download-and-build-transformorderdemo","title":"Download and Build TransformOrderDemo","text":"

        Click here to download TransformOrderDemo and its CMakeLists.txt file. Once the tarball TransformOrderDemo.tar has been downloaded and extracted,

        cd TransformOrderDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TransformOrderDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/TransformPipeline/","title":"TransformPipeline","text":"

        vtk-examples/Cxx/PolyData/TransformPipeline

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/TransformPipeline/#description","title":"Description","text":"

        This example demonstrates how to connect a transformation for keeping the coordinates one actor relative to another. I used a robotic arm because it's good example used originally by James D. Foley in book: Computer Graphics: Principles and Practice in C. Someone who read this book may want to know how to make it in VTK.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/TransformPipeline/#code","title":"Code","text":"

        TransformPipeline.cxx

        // This example describes the transformation pipeline. Robotic arm was used to\n// demonstrate an example.\n#include <vtkActor.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"Robotic Arm\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // arm\n  vtkNew<vtkCylinderSource> arm;\n  arm->SetRadius(8);\n  arm->SetHeight(20);\n  arm->SetResolution(20);\n\n  vtkNew<vtkPolyDataMapper> armMapper;\n  armMapper->SetInputConnection(arm->GetOutputPort());\n\n  vtkNew<vtkTransform> armTransform;\n\n  vtkNew<vtkActor> armActor;\n  armActor->SetUserTransform(armTransform);\n  armActor->SetMapper(armMapper);\n  armActor->GetProperty()->SetColor(colors->GetColor3d(\"SandyBrown\").GetData());\n\n  // forearm\n  vtkNew<vtkCylinderSource> forearm;\n  forearm->SetRadius(6);\n  forearm->SetHeight(15);\n  forearm->SetResolution(20);\n  forearm->SetCenter(*(arm->GetCenter()),\n                     *(arm->GetCenter() + 1) + forearm->GetHeight(),\n                     *(arm->GetCenter() + 2));\n\n  vtkNew<vtkPolyDataMapper> forearmMapper;\n  forearmMapper->SetInputConnection(forearm->GetOutputPort());\n\n  vtkNew<vtkTransform> forearmTransform;\n  forearmTransform->SetInput(armTransform);\n\n  vtkNew<vtkActor> forearmActor;\n  forearmActor->SetUserTransform(forearmTransform);\n  forearmActor->SetMapper(forearmMapper);\n  forearmActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"RoyalBLue\").GetData());\n\n  // hand\n  vtkNew<vtkCylinderSource> hand;\n  hand->SetRadius(4);\n  hand->SetHeight(10);\n  hand->SetResolution(20);\n  hand->SetCenter(*(forearm->GetCenter()),\n                  *(forearm->GetCenter() + 1) + hand->GetHeight(),\n                  *(forearm->GetCenter() + 2));\n\n  vtkNew<vtkPolyDataMapper> handMapper;\n  handMapper->SetInputConnection(hand->GetOutputPort());\n\n  vtkNew<vtkTransform> handTransform;\n  handTransform->SetInput(forearmTransform);\n\n  vtkNew<vtkActor> handActor;\n  handActor->SetUserTransform(handTransform);\n  handActor->SetMapper(handMapper);\n  handActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"GreenYellow\").GetData());\n\n  ren1->AddActor(armActor);\n  ren1->AddActor(forearmActor);\n  ren1->AddActor(handActor);\n\n  renWin->Render();\n\n  // execution of robot arm motion\n  for (int i = 0; i < 45; i++)\n  {\n    armTransform->Identity();\n    armTransform->RotateZ(-i);\n    renWin->Render();\n  }\n  // execution of robot forearm motion\n  for (int i = 0; i < 45; i++)\n  {\n    forearmTransform->Identity();\n    forearmTransform->RotateZ(i);\n    renWin->Render();\n  }\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/TransformPipeline/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformPipeline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformPipeline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformPipeline MACOSX_BUNDLE TransformPipeline.cxx )\n  target_link_libraries(TransformPipeline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformPipeline\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/TransformPipeline/#download-and-build-transformpipeline","title":"Download and Build TransformPipeline","text":"

        Click here to download TransformPipeline and its CMakeLists.txt file. Once the tarball TransformPipeline.tar has been downloaded and extracted,

        cd TransformPipeline/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TransformPipeline\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/TriangleArea/","title":"TriangleArea","text":"

        vtk-examples/Cxx/PolyData/TriangleArea

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/TriangleArea/#code","title":"Code","text":"

        TriangleArea.cxx

        #include <vtkCellArray.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkTriangle.h>\n\nint main(int, char*[])\n{\n  // setup points (geometry)\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // create a triangle on the three points in the polydata\n  vtkNew<vtkTriangle> triangle1;\n  triangle1->GetPointIds()->SetId(0, 0);\n  triangle1->GetPointIds()->SetId(1, 1);\n  triangle1->GetPointIds()->SetId(2, 2);\n\n  vtkNew<vtkTriangle> triangle2;\n  triangle2->GetPointIds()->SetId(0, 2);\n  triangle2->GetPointIds()->SetId(1, 3);\n  triangle2->GetPointIds()->SetId(2, 0);\n\n  // add the triangles to the list of triangles\n  vtkNew<vtkCellArray> triangles;\n  triangles->InsertNextCell(triangle1);\n  triangles->InsertNextCell(triangle2);\n\n  // create a polydata object\n  vtkNew<vtkPolyData> polydata;\n\n  // add the geometry and topology to the polydata\n  polydata->SetPoints(points);\n  polydata->SetPolys(triangles);\n\n  for (vtkIdType i = 0; i < polydata->GetNumberOfCells(); i++)\n  {\n    vtkCell* cell = polydata->GetCell(0);\n\n    vtkTriangle* triangle = dynamic_cast<vtkTriangle*>(cell);\n    double p0[3];\n    double p1[3];\n    double p2[3];\n    triangle->GetPoints()->GetPoint(0, p0);\n    std::cout << \"p0: \" << p0[0] << \" \" << p0[1] << \" \" << p0[2] << std::endl;\n    triangle->GetPoints()->GetPoint(1, p1);\n    std::cout << \"p1: \" << p1[0] << \" \" << p1[1] << \" \" << p1[2] << std::endl;\n    triangle->GetPoints()->GetPoint(2, p2);\n    std::cout << \"p2: \" << p2[0] << \" \" << p2[1] << \" \" << p2[2] << std::endl;\n\n    double area = vtkTriangle::TriangleArea(p0, p1, p2);\n\n    std::cout << \"area of triangle \" << i << \": \" << area << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/TriangleArea/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TriangleArea)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TriangleArea: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TriangleArea MACOSX_BUNDLE TriangleArea.cxx )\n  target_link_libraries(TriangleArea PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TriangleArea\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/TriangleArea/#download-and-build-trianglearea","title":"Download and Build TriangleArea","text":"

        Click here to download TriangleArea and its CMakeLists.txt file. Once the tarball TriangleArea.tar has been downloaded and extracted,

        cd TriangleArea/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TriangleArea\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/TriangleColoredPoints/","title":"TriangleColoredPoints","text":"

        vtk-examples/Cxx/PolyData/TriangleColoredPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/TriangleColoredPoints/#description","title":"Description","text":"

        This example shows how by adding a color to each vertex of a triangle, the triangle's color will be smoothly varying between the colors of the vertices.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/TriangleColoredPoints/#code","title":"Code","text":"

        TriangleColoredPoints.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangle.h>\n#include <vtkUnsignedCharArray.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> nc;\n\n  // Setup points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  // Define some colors.\n  unsigned char red[3] = {255, 0, 0};\n  unsigned char green[3] = {0, 255, 0};\n  unsigned char blue[3] = {0, 0, 255};\n\n  // Setup the colors array.\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n\n  // Add the three colors we have created to the array.\n  colors->InsertNextTupleValue(red);\n  colors->InsertNextTupleValue(green);\n  colors->InsertNextTupleValue(blue);\n\n  // Create a triangle.\n  vtkNew<vtkCellArray> triangles;\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n  triangles->InsertNextCell(triangle);\n\n  // Create a polydata object and add everything to it.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetPolys(triangles);\n  polydata->GetPointData()->SetScalars(colors);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TriangleColoredPoints\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(nc->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/TriangleColoredPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TriangleColoredPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TriangleColoredPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TriangleColoredPoints MACOSX_BUNDLE TriangleColoredPoints.cxx )\n  target_link_libraries(TriangleColoredPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TriangleColoredPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/TriangleColoredPoints/#download-and-build-trianglecoloredpoints","title":"Download and Build TriangleColoredPoints","text":"

        Click here to download TriangleColoredPoints and its CMakeLists.txt file. Once the tarball TriangleColoredPoints.tar has been downloaded and extracted,

        cd TriangleColoredPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TriangleColoredPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/TriangleSolidColor/","title":"TriangleSolidColor","text":"

        vtk-examples/Cxx/PolyData/TriangleSolidColor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/TriangleSolidColor/#code","title":"Code","text":"

        TriangleSolidColor.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkCellData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTriangle.h>\n#include <vtkUnsignedCharArray.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> nc;\n\n  // Setup points.\n  vtkNew<vtkPoints> points;\n  // vtkNew<vtkCellArray> vertices;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(0.0, 1.0, 0.0);\n\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetNumberOfComponents(3);\n  colors->SetName(\"Colors\");\n  // Pick a color\n  colors->InsertNextTupleValue(nc->GetColor3ub(\"LightSeaGreen\").GetData());\n\n  vtkNew<vtkCellArray> triangles;\n  vtkNew<vtkTriangle> triangle;\n  triangle->GetPointIds()->SetId(0, 0);\n  triangle->GetPointIds()->SetId(1, 1);\n  triangle->GetPointIds()->SetId(2, 2);\n  triangles->InsertNextCell(triangle);\n\n  vtkNew<vtkPolyData> polydata;\n\n  polydata->SetPoints(points);\n  polydata->SetPolys(triangles);\n  polydata->GetCellData()->SetScalars(colors);\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TriangleSolidColor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(nc->GetColor3d(\"SlateGray\").GetData());\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/TriangleSolidColor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TriangleSolidColor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TriangleSolidColor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TriangleSolidColor MACOSX_BUNDLE TriangleSolidColor.cxx )\n  target_link_libraries(TriangleSolidColor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TriangleSolidColor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/TriangleSolidColor/#download-and-build-trianglesolidcolor","title":"Download and Build TriangleSolidColor","text":"

        Click here to download TriangleSolidColor and its CMakeLists.txt file. Once the tarball TriangleSolidColor.tar has been downloaded and extracted,

        cd TriangleSolidColor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TriangleSolidColor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/TubeFilter/","title":"TubeFilter","text":"

        vtk-examples/Cxx/PolyData/TubeFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/TubeFilter/#description","title":"Description","text":"

        This example creates a tube around a line. This is helpful because when you zoom the camera, the thickness of a line remains constant, while the thickness of a tube varies.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/TubeFilter/#code","title":"Code","text":"

        TubeFilter.cxx

        #include <vtkActor.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n\n/*\n * This example creates a tube around a line.\n * This is helpful because when you zoom the camera,\n * the thickness of a line remains constant,\n * while the thickness of a tube varies.\n * */\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n  // Create a line.\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(1.0, 0.0, 0.0);\n  lineSource->SetPoint2(0.0, 1.0, 0.0);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(lineSource->GetOutputPort());\n  vtkNew<vtkActor> lineActor;\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  lineActor->SetMapper(lineMapper);\n\n  // Create a tube (cylinder) around the line.\n  vtkNew<vtkTubeFilter> tubeFilter;\n  tubeFilter->SetInputConnection(lineSource->GetOutputPort());\n  tubeFilter->SetRadius(.025); // default is .5\n  tubeFilter->SetNumberOfSides(50);\n  tubeFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> tubeMapper;\n  tubeMapper->SetInputConnection(tubeFilter->GetOutputPort());\n  vtkNew<vtkActor> tubeActor;\n  tubeActor->GetProperty()->SetOpacity(\n      0.5); // Make the tube have some transparency.\n  tubeActor->SetMapper(tubeMapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TubeFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(tubeActor);\n  renderer->AddActor(lineActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/TubeFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TubeFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TubeFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TubeFilter MACOSX_BUNDLE TubeFilter.cxx )\n  target_link_libraries(TubeFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TubeFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/TubeFilter/#download-and-build-tubefilter","title":"Download and Build TubeFilter","text":"

        Click here to download TubeFilter and its CMakeLists.txt file. Once the tarball TubeFilter.tar has been downloaded and extracted,

        cd TubeFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TubeFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/VertexConnectivity/","title":"VertexConnectivity","text":"

        vtk-examples/Cxx/PolyData/VertexConnectivity

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/VertexConnectivity/#description","title":"Description","text":"

        The input must be only edges (i.e. vtkExtractEdges must be run).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/VertexConnectivity/#code","title":"Code","text":"

        VertexConnectivity.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractEdges.h>\n#include <vtkExtractSelection.h>\n#include <vtkIdList.h>\n#include <vtkIdTypeArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelection.h>\n#include <vtkSelectionNode.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVertexGlyphFilter.h>\n\n#include <iostream>\n#include <string>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\nnamespace {\n\nvtkSmartPointer<vtkIdList> GetConnectedVertices(vtkPolyData* mesh, int id);\n\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(sphereSource->GetOutputPort());\n  triangleFilter->Update();\n\n  vtkNew<vtkExtractEdges> extractEdges;\n  extractEdges->SetInputConnection(triangleFilter->GetOutputPort());\n  extractEdges->Update();\n\n  vtkSmartPointer<vtkPolyData> mesh = extractEdges->GetOutput();\n\n  vtkSmartPointer<vtkIdList> connectedVertices = GetConnectedVertices(mesh, 0);\n\n  vtkNew<vtkIdTypeArray> ids;\n  ids->SetNumberOfComponents(1);\n\n  std::cout << \"Connected vertices: \";\n  for (vtkIdType i = 0; i < connectedVertices->GetNumberOfIds(); i++)\n  {\n    std::cout << connectedVertices->GetId(i) << \" \";\n    ids->InsertNextValue(connectedVertices->GetId(i));\n  }\n  std::cout << std::endl;\n\n  vtkNew<vtkDataSetMapper> connectedVertexMapper;\n\n  {\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::POINT);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n\n    extractSelection->SetInputConnection(0, extractEdges->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    vtkNew<vtkVertexGlyphFilter> glyphFilter;\n    glyphFilter->SetInputConnection(extractSelection->GetOutputPort());\n    glyphFilter->Update();\n\n    connectedVertexMapper->SetInputConnection(glyphFilter->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> connectedVertexActor;\n  connectedVertexActor->SetMapper(connectedVertexMapper);\n  connectedVertexActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Red\").GetData());\n  connectedVertexActor->GetProperty()->SetPointSize(5);\n\n  vtkNew<vtkDataSetMapper> queryVertexMapper;\n\n  {\n    vtkNew<vtkIdTypeArray> ids2;\n    ids2->SetNumberOfComponents(1);\n    ids2->InsertNextValue(0);\n\n    vtkNew<vtkSelectionNode> selectionNode;\n    selectionNode->SetFieldType(vtkSelectionNode::POINT);\n    selectionNode->SetContentType(vtkSelectionNode::INDICES);\n    selectionNode->SetSelectionList(ids2);\n\n    vtkNew<vtkSelection> selection;\n    selection->AddNode(selectionNode);\n\n    vtkNew<vtkExtractSelection> extractSelection;\n\n    extractSelection->SetInputConnection(0, extractEdges->GetOutputPort());\n    extractSelection->SetInputData(1, selection);\n    extractSelection->Update();\n\n    vtkNew<vtkVertexGlyphFilter> glyphFilter;\n    glyphFilter->SetInputConnection(extractSelection->GetOutputPort());\n    glyphFilter->Update();\n\n    queryVertexMapper->SetInputConnection(glyphFilter->GetOutputPort());\n  }\n\n  vtkNew<vtkActor> queryVertexActor;\n  queryVertexActor->SetMapper(queryVertexMapper);\n  queryVertexActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Lime\").GetData());\n  queryVertexActor->GetProperty()->SetPointSize(5);\n\n  vtkNew<vtkDataSetMapper> sphereMapper;\n  sphereMapper->SetInputConnection(extractEdges->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Snow\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VertexConnectivity\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(queryVertexActor);\n  renderer->AddActor(connectedVertexActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkIdList> GetConnectedVertices(vtkPolyData* mesh, int id)\n{\n  vtkNew<vtkIdList> connectedVertices;\n\n  // Get all cells that vertex 'id' is a part of.\n  vtkNew<vtkIdList> cellIdList;\n  mesh->GetPointCells(id, cellIdList);\n\n  /*\n  cout << \"Vertex 0 is used in cells \";\n  for(vtkIdType i = 0; i < cellIdList->GetNumberOfIds(); i++)\n    {\n    cout << cellIdList->GetId(i) << \", \";\n    }\n  cout << endl;\n  */\n\n  for (vtkIdType i = 0; i < cellIdList->GetNumberOfIds(); i++)\n  {\n    // cout << \"id \" << i << \" : \" << cellIdList->GetId(i) << endl;\n\n    vtkNew<vtkIdList> pointIdList;\n    mesh->GetCellPoints(cellIdList->GetId(i), pointIdList);\n\n    // cout << \"End points are \" << pointIdList->GetId(0) << \" and \" <<\n    // pointIdList->GetId(1) << endl;\n\n    if (pointIdList->GetId(0) != id)\n    {\n      // cout << \"Connected to \" << pointIdList->GetId(0) << endl;\n      connectedVertices->InsertNextId(pointIdList->GetId(0));\n    }\n    else\n    {\n      // cout << \"Connected to \" << pointIdList->GetId(1) << endl;\n      connectedVertices->InsertNextId(pointIdList->GetId(1));\n    }\n  }\n\n  return connectedVertices;\n}\n\n} // namespace\n
        "},{"location":"Cxx/PolyData/VertexConnectivity/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VertexConnectivity)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VertexConnectivity: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VertexConnectivity MACOSX_BUNDLE VertexConnectivity.cxx )\n  target_link_libraries(VertexConnectivity PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VertexConnectivity\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/VertexConnectivity/#download-and-build-vertexconnectivity","title":"Download and Build VertexConnectivity","text":"

        Click here to download VertexConnectivity and its CMakeLists.txt file. Once the tarball VertexConnectivity.tar has been downloaded and extracted,

        cd VertexConnectivity/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VertexConnectivity\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/WarpScalar/","title":"WarpScalar","text":"

        vtk-examples/Cxx/PolyData/WarpScalar

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/WarpScalar/#code","title":"Code","text":"

        WarpScalar.cxx

        #include <vtkActor.h>\n#include <vtkDoubleArray.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkWarpScalar.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create Scalars.\n  vtkNew<vtkDoubleArray> scalars;\n  int numberOfPoints = sphereSource->GetOutput()->GetNumberOfPoints();\n  scalars->SetNumberOfTuples(numberOfPoints);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  for (vtkIdType i = 0; i < numberOfPoints; ++i)\n  {\n    scalars->SetTuple1(i, randomSequence->GetRangeValue(0.0, 1.0 / 7.0));\n    randomSequence->Next();\n  }\n\n  sphereSource->GetOutput()->GetPointData()->SetScalars(scalars);\n\n  vtkNew<vtkWarpScalar> warpScalar;\n  warpScalar->SetInputConnection(sphereSource->GetOutputPort());\n  warpScalar->SetScaleFactor(1); // Use the scalars themselves.\n\n  // Required for SetNormal to have an effect.\n  warpScalar->UseNormalOn();\n  warpScalar->SetNormal(0, 0, 1);\n\n  warpScalar->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(warpScalar->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WarpScalar\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/WarpScalar/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WarpScalar)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WarpScalar: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WarpScalar MACOSX_BUNDLE WarpScalar.cxx )\n  target_link_libraries(WarpScalar PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WarpScalar\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/WarpScalar/#download-and-build-warpscalar","title":"Download and Build WarpScalar","text":"

        Click here to download WarpScalar and its CMakeLists.txt file. Once the tarball WarpScalar.tar has been downloaded and extracted,

        cd WarpScalar/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WarpScalar\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/WarpSurface/","title":"WarpSurface","text":"

        vtk-examples/Cxx/PolyData/WarpSurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/PolyData/WarpSurface/#description","title":"Description","text":"

        The image was produced using src/Testing/Data/cowHead.vtp and a scale of .1.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/WarpSurface/#code","title":"Code","text":"

        WarpSurface.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkDataSetAttributes.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkWarpVector.h>\n#include <vtkXMLPolyDataReader.h>\nint main(int argc, char* argv[])\n{\n  double scale = 1.0;\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n  // If a file is provided, use it, otherwise generate a sphere\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]); // e.g. cowHead.vtp\n    reader->Update();\n    inputPolyData = reader->GetOutput();\n    if (argc > 2)\n    {\n      scale = atof(argv[2]);\n    }\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetPhiResolution(15);\n    sphereSource->SetThetaResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkCleanPolyData> clean;\n  clean->SetInputData(inputPolyData);\n\n  // Generate normals\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(clean->GetOutputPort());\n  normals->SplittingOff();\n\n  // Warp using the normals\n  vtkNew<vtkWarpVector> warp;\n  warp->SetInputConnection(normals->GetOutputPort());\n  warp->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS,\n                               vtkDataSetAttributes::NORMALS);\n  warp->SetScaleFactor(scale);\n\n  // Visualize the original and warped models\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(warp->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> warpedActor;\n  warpedActor->SetMapper(mapper);\n  warpedActor->GetProperty()->SetColor(colors->GetColor4d(\"Flesh\").GetData());\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(normals->GetOutputPort());\n  originalMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetInterpolationToFlat();\n  originalActor->GetProperty()->SetColor(colors->GetColor4d(\"Flesh\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"WarpSurface\");\n\n  // Create a camera for all renderers\n  vtkNew<vtkCamera> camera;\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  leftRenderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderer> rightRenderer;\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CornFlower\").GetData());\n  rightRenderer->SetActiveCamera(camera);\n\n  leftRenderer->AddActor(originalActor);\n  rightRenderer->AddActor(warpedActor);\n\n  rightRenderer->ResetCamera();\n\n  renderWindow->AddRenderer(rightRenderer);\n  renderWindow->AddRenderer(leftRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/WarpSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WarpSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WarpSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WarpSurface MACOSX_BUNDLE WarpSurface.cxx )\n  target_link_libraries(WarpSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WarpSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/WarpSurface/#download-and-build-warpsurface","title":"Download and Build WarpSurface","text":"

        Click here to download WarpSurface and its CMakeLists.txt file. Once the tarball WarpSurface.tar has been downloaded and extracted,

        cd WarpSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WarpSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/WarpVector/","title":"WarpVector","text":"

        vtk-examples/Cxx/PolyData/WarpVector

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/WarpVector/#code","title":"Code","text":"

        WarpVector.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkDoubleArray.h>\n#include <vtkLine.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkWarpVector.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(2.0, 0.0, 0.0);\n  points->InsertNextPoint(3.0, 0.0, 0.0);\n  points->InsertNextPoint(4.0, 0.0, 0.0);\n\n  vtkNew<vtkCellArray> lines;\n  vtkNew<vtkLine> line;\n  line->GetPointIds()->SetId(0, 0);\n  line->GetPointIds()->SetId(1, 1);\n  lines->InsertNextCell(line);\n  line->GetPointIds()->SetId(0, 1);\n  line->GetPointIds()->SetId(1, 2);\n  lines->InsertNextCell(line);\n  line->GetPointIds()->SetId(0, 2);\n  line->GetPointIds()->SetId(1, 3);\n  lines->InsertNextCell(line);\n  line->GetPointIds()->SetId(0, 3);\n  line->GetPointIds()->SetId(1, 4);\n  lines->InsertNextCell(line);\n\n  vtkNew<vtkDoubleArray> warpData;\n  warpData->SetNumberOfComponents(3);\n  warpData->SetName(\"warpData\");\n  double warp[3] = {0.0, 0.0, 0.0};\n  warp[1] = 0.0;\n  warpData->InsertNextTuple(warp);\n  warp[1] = 0.1;\n  warpData->InsertNextTuple(warp);\n  warp[1] = 0.3;\n  warpData->InsertNextTuple(warp);\n  warp[1] = 0.0;\n  warpData->InsertNextTuple(warp);\n  warp[1] = 0.1;\n  warpData->InsertNextTuple(warp);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetLines(lines);\n  polydata->GetPointData()->AddArray(warpData);\n  polydata->GetPointData()->SetActiveVectors(warpData->GetName());\n\n  // WarpVector will use the array marked as active vector in polydata\n  // it has to be a 3 component array with the same number of\n  // tuples as points in polydata.\n  vtkNew<vtkWarpVector> warpVector;\n  warpVector->SetInputData(polydata);\n  warpVector->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(warpVector->GetPolyDataOutput());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"cobalt_green\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WarpVector\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/WarpVector/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WarpVector)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WarpVector: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WarpVector MACOSX_BUNDLE WarpVector.cxx )\n  target_link_libraries(WarpVector PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WarpVector\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/WarpVector/#download-and-build-warpvector","title":"Download and Build WarpVector","text":"

        Click here to download WarpVector and its CMakeLists.txt file. Once the tarball WarpVector.tar has been downloaded and extracted,

        cd WarpVector/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WarpVector\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/PolyData/WeightedTransformFilter/","title":"WeightedTransformFilter","text":"

        vtk-examples/Cxx/PolyData/WeightedTransformFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/PolyData/WeightedTransformFilter/#code","title":"Code","text":"

        WeightedTransformFilter.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n#include <vtkWeightedTransformFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Use a sphere as a basis of the shape.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(40);\n  sphere->SetThetaResolution(40);\n  sphere->Update();\n\n  vtkPolyData* sphereData = sphere->GetOutput();\n\n  // Create a data array to hold the weighting coefficients.\n  vtkNew<vtkFloatArray> tfarray;\n  vtkIdType npoints = sphereData->GetNumberOfPoints();\n  tfarray->SetNumberOfComponents(2);\n  tfarray->SetNumberOfTuples(npoints);\n\n  // Parameterize the sphere along the z axis, and fill the weights\n  // with (1.0-a, a) to linearly interpolate across the shape.\n  for (int i = 0; i < npoints; i++)\n  {\n    double pt[3];\n    sphereData->GetPoint(i, pt);\n    //    double x = pt[0];\n    //    double y = pt[1];\n    double z = pt[2];\n\n    double zn = z + 0.5;\n    double zn1 = 1.0 - zn;\n    if (zn > 1.0)\n    {\n      zn = 1.0;\n    }\n    if (zn1 < 0.0)\n    {\n      zn1 = 0.0;\n    }\n\n    tfarray->SetComponent(i, 0, zn1);\n    tfarray->SetComponent(i, 1, zn);\n  }\n\n  // Create field data to hold the array, and bind it to the sphere.\n  //  vtkNew<vtkFieldData> fd;\n  tfarray->SetName(\"weights\");\n  sphereData->GetPointData()->AddArray(tfarray);\n\n  // Use an ordinary transform to stretch the shape.\n  vtkNew<vtkTransform> stretch;\n  stretch->Scale(1, 1, 3.2);\n\n  vtkNew<vtkTransformFilter> stretchFilter;\n  stretchFilter->SetInputData(sphereData);\n  stretchFilter->SetTransform(stretch);\n\n  // Now, for the weighted transform stuff.\n  vtkNew<vtkWeightedTransformFilter> weightedTrans;\n\n  // Create two transforms to interpolate between.\n  vtkNew<vtkTransform> identity;\n  identity->Identity();\n\n  vtkNew<vtkTransform> rotated;\n  double rotatedAngle = 45;\n  rotated->RotateX(rotatedAngle);\n\n  weightedTrans->SetNumberOfTransforms(2);\n  weightedTrans->SetTransform(identity, 0);\n  weightedTrans->SetTransform(rotated, 1);\n  // Which data array should the filter use ?\n  weightedTrans->SetWeightArray(\"weights\");\n\n  weightedTrans->SetInputConnection(stretchFilter->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> weightedTransMapper;\n  weightedTransMapper->SetInputConnection(weightedTrans->GetOutputPort());\n  vtkNew<vtkActor> weightedTransActor;\n  weightedTransActor->SetMapper(weightedTransMapper);\n  weightedTransActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  weightedTransActor->GetProperty()->SetRepresentationToSurface();\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WeightedTransformFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(weightedTransActor);\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n  renderWindow->SetSize(300, 300);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(90);\n  renderer->GetActiveCamera()->Dolly(1);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/PolyData/WeightedTransformFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WeightedTransformFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersHybrid\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WeightedTransformFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WeightedTransformFilter MACOSX_BUNDLE WeightedTransformFilter.cxx )\n  target_link_libraries(WeightedTransformFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WeightedTransformFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/PolyData/WeightedTransformFilter/#download-and-build-weightedtransformfilter","title":"Download and Build WeightedTransformFilter","text":"

        Click here to download WeightedTransformFilter and its CMakeLists.txt file. Once the tarball WeightedTransformFilter.tar has been downloaded and extracted,

        cd WeightedTransformFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WeightedTransformFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Qt/BarChartQt/","title":"BarChartQt","text":"

        vtk-examples/Cxx/Qt/BarChartQt

        "},{"location":"Cxx/Qt/BarChartQt/#description","title":"Description","text":"

        This example shows how to create a Bar Chart.

        Also see the BarChart example.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/BarChartQt/#code","title":"Code","text":"

        BarChartQt.cxx

        #include \"BarChartQt.h\"\n#include \"ui_BarChartQt.h\"\n\n#include <vtkAxis.h>\n#include <vtkChartXY.h>\n#include <vtkContextView.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkIntArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlot.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTable.h>\n#include <vtkTextProperty.h>\n#include <vtkVersion.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n#if VTK_VERSION_NUMBER >= 90000000000ULL\n#define VTK900 1\n#endif\n\nnamespace {\n// Monthly circulation data.\nint data_2008[] = {10822, 10941, 9979,  10370, 9460, 11228,\n                   15093, 12231, 10160, 9816,  9384, 7892};\nint data_2009[] = {9058,  9474,  9979,  9408, 8900, 11569,\n                   14688, 12231, 10294, 9585, 8957, 8590};\nint data_2010[] = {9058,  10941, 9979,  10270, 8900, 11228,\n                   14688, 12231, 10160, 9585,  9384, 8590};\n} // namespace\n\n// Constructor\nBarChartQt::BarChartQt(QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::BarChartQt)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;\n#if VTK890\n  this->ui->qvtkWidget->setRenderWindow(renderWindow);\n#else\n  this->ui->qvtkWidget->SetRenderWindow(renderWindow);\n#endif\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Seashell\");\n  vtkColor3d axisColor = colors->GetColor3d(\"Black\");\n  vtkColor3d titleColor = colors->GetColor3d(\"MidnightBlue\");\n\n  vtkNew<vtkChartXY> chart;\n\n  // Set various properties.\n  vtkAxis* xAxis = chart->GetAxis(vtkAxis::BOTTOM);\n  xAxis->SetTitle(\"Monthly\");\n  xAxis->GetTitleProperties()->SetColor(axisColor.GetData());\n  xAxis->GetTitleProperties()->SetFontSize(16);\n  xAxis->GetTitleProperties()->ItalicOn();\n  xAxis->GetLabelProperties()->SetColor(axisColor.GetData());\n  xAxis->SetGridVisible(true);\n  xAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"Black\"));\n\n  vtkAxis* yAxis = chart->GetAxis(vtkAxis::LEFT);\n  yAxis->SetTitle(\"Circulation\");\n  yAxis->GetTitleProperties()->SetColor(axisColor.GetData());\n  yAxis->GetTitleProperties()->SetFontSize(16);\n  yAxis->GetTitleProperties()->ItalicOn();\n  yAxis->GetLabelProperties()->SetColor(axisColor.GetData());\n  yAxis->SetGridVisible(true);\n  yAxis->GetGridPen()->SetColor(colors->GetColor4ub(\"Black\"));\n\n  chart->SetTitle(\"Circulation 2008, 2009, 2010\");\n  chart->GetTitleProperties()->SetFontSize(24);\n  chart->GetTitleProperties()->SetColor(titleColor.GetData());\n  chart->GetTitleProperties()->BoldOn();\n\n  // Set up a 2D scene, add an XY chart to it\n  vtkNew<vtkContextView> view;\n  view->SetRenderWindow(renderWindow);\n  view->GetRenderer()->SetBackground(backgroundColor.GetData());\n  view->GetRenderWindow()->SetSize(640, 480);\n  view->GetScene()->AddItem(chart);\n\n  // Create a table with some points in it...\n  vtkNew<vtkTable> table;\n\n  vtkNew<vtkIntArray> arrMonth;\n  arrMonth->SetName(\"Month\");\n  table->AddColumn(arrMonth);\n\n  vtkNew<vtkIntArray> arr2008;\n  arr2008->SetName(\"2008\");\n  table->AddColumn(arr2008);\n\n  vtkNew<vtkIntArray> arr2009;\n  arr2009->SetName(\"2009\");\n  table->AddColumn(arr2009);\n\n  vtkNew<vtkIntArray> arr2010;\n  arr2010->SetName(\"2010\");\n  table->AddColumn(arr2010);\n\n  table->SetNumberOfRows(12);\n  for (int i = 0; i < 12; i++)\n  {\n    table->SetValue(i, 0, i + 1);\n    table->SetValue(i, 1, data_2008[i]);\n    table->SetValue(i, 2, data_2009[i]);\n    table->SetValue(i, 3, data_2010[i]);\n  }\n\n  // Add multiple line plots, setting the colors etc.\n  vtkPlot* line = 0;\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetInputData(table, 0, 1);\n  auto rgba = colors->GetColor4ub(\"YellowGreen\");\n  line->SetColor(rgba[0], rgba[1], rgba[2], rgba[3]);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetInputData(table, 0, 2);\n  rgba = colors->GetColor4ub(\"Salmon\");\n  line->SetColor(rgba[0], rgba[1], rgba[2], rgba[3]);\n\n  line = chart->AddPlot(vtkChart::BAR);\n  line->SetInputData(table, 0, 3);\n  rgba = colors->GetColor4ub(\"CornflowerBlue\");\n  line->SetColor(rgba[0], rgba[1], rgba[2], rgba[3]);\n\n  view->GetRenderWindow()->SetMultiSamples(0);\n\n#if !defined(VTK900)\n  view->SetInteractor(this->ui->qvtkWidget->GetInteractor());\n#endif\n  // VTK/Qt wedded\n#if VTK890\n  this->ui->qvtkWidget->setRenderWindow(view->GetRenderWindow());\n#else\n  this->ui->qvtkWidget->SetRenderWindow(view->GetRenderWindow());\n#endif\n\n  // Set up action signals and slots.\n  connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));\n}\n\nBarChartQt::~BarChartQt()\n{\n  delete this->ui;\n}\n\nvoid BarChartQt::slotExit()\n{\n  std::cout << \"Exiting\" << std::endl;\n  qApp->exit();\n}\n

        BarChartQt.h

        #ifndef BarChartQt_H\n#define BarChartQt_H\n\n#include <QMainWindow>\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass BarChartQt;\n}\n\nclass BarChartQt : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  // Constructor/Destructor\n  explicit BarChartQt(QWidget* parent = nullptr);\n  virtual ~BarChartQt();\n\npublic slots:\n\n  void slotExit();\n\nprivate:\n  // Designer form\n  Ui::BarChartQt* ui;\n};\n\n#endif\n

        BarChartQt.ui

        <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>BarChartQt</class>\n <widget class=\"QMainWindow\" name=\"BarChartQt\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n     <width>660</width>\n     <height>520</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>BarChartQt</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidget\">\n    <property name=\"geometry\">\n     <rect>\n      <x>10</x>\n      <y>20</y>\n      <width>640</width>\n      <height>480</height>\n     </rect>\n    </property>\n   </widget>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources>\n\n </resources>\n <connections/>\n</ui>\n

        BarChartQtDriver.cxx

        #include <QApplication>\n#include <QSurfaceFormat>\n\n#include <QVTKOpenGLNativeWidget.h>\n\n#include \"BarChartQt.h\"\n\nint main(int argc, char** argv)\n{\n  // Needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  // QT Stuff\n  QApplication app(argc, argv);\n\n  BarChartQt BarChartQt;\n  BarChartQt.show();\n\n  return app.exec();\n}\n
        "},{"location":"Cxx/Qt/BarChartQt/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(BarChartQt)\n\nfind_package(VTK COMPONENTS \n  ChartsCore\n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsContext2D\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"BarChartQt: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"BarChartQt: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(BarChartQt MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(BarChartQt ${qt_components})\nelse()\n  target_link_libraries(BarChartQt ${qt_modules})\nendif()\ntarget_link_libraries(BarChartQt ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BarChartQt\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/BarChartQt/#download-and-build-barchartqt","title":"Download and Build BarChartQt","text":"

        Click here to download BarChartQt and its CMakeLists.txt file. Once the tarball BarChartQt.tar has been downloaded and extracted,

         cd BarChartQt/build\n

        This example requires Qt and VTK.

        If VTK and Qt are installed:

         cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

         cmake -DVTK_DIR=/home/me/vtk_build ..\n

        If Qt is not found on your system, you will need to tell CMake where to find qmake:

        cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

        Build the project:

        make\n

        and run it:

        ./BarChartQt\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

        "},{"location":"Cxx/Qt/BorderWidgetQt/","title":"BorderWidgetQt","text":"

        vtk-examples/Cxx/Qt/BorderWidgetQt

        "},{"location":"Cxx/Qt/BorderWidgetQt/#description","title":"Description","text":"

        This example draws a border around a region selected with the mouse. Note that the default border color is white - so if you have a white background you will not see anything!

        Also see the BorderWidget example.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/BorderWidgetQt/#code","title":"Code","text":"

        BorderWidgetQt.cxx

        #include \"BorderWidgetQt.h\"\n#include \"ui_BorderWidgetQt.h\"\n\n#include <vtkBorderRepresentation.h>\n#include <vtkBorderWidget.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n#include <vtkWidgetCallbackMapper.h>\n#include <vtkWidgetEvent.h>\n\n#include <iostream>\n#include <string>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\nnamespace {\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n\nclass vtkCustomBorderWidget : public vtkBorderWidget\n{\npublic:\n  static vtkCustomBorderWidget* New();\n  vtkTypeMacro(vtkCustomBorderWidget, vtkBorderWidget);\n\n  static void EndSelectAction(vtkAbstractWidget* w);\n\n  vtkCustomBorderWidget();\n};\n\nvtkStandardNewMacro(vtkCustomBorderWidget);\n\n} // namespace\n\n// Constructor\nBorderWidgetQt::BorderWidgetQt(QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::BorderWidgetQt)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;\n#if VTK890\n  this->ui->qvtkWidget->setRenderWindow(renderWindow);\n#else\n  this->ui->qvtkWidget->SetRenderWindow(renderWindow);\n#endif\n\n  auto lut = GetPlatonicLUT();\n\n  vtkNew<vtkPlatonicSolidSource> source;\n  source->SetSolidTypeToDodecahedron();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, 19);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->GetActiveCamera()->Elevation(30.0);\n  renderer->GetActiveCamera()->Azimuth(180.0);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Connect VTK with Qt.\n#if VTK890\n  this->ui->qvtkWidget->renderWindow()->AddRenderer(renderer);\n#else\n  this->ui->qvtkWidget->GetRenderWindow()->AddRenderer(renderer);\n#endif\n\n  // Add a border widget to the renderer.\n  this->BorderWidget = vtkNew<vtkCustomBorderWidget>();\n#if VTK890\n  this->BorderWidget->SetInteractor(this->ui->qvtkWidget->interactor());\n#else\n  this->borderWidget->SetInteractor(this->ui->qvtkWidget->GetInteractor());\n#endif\n  this->BorderWidget->CreateDefaultRepresentation();\n  this->BorderWidget->SelectableOff();\n  this->BorderWidget->On();\n}\n\nBorderWidgetQt::~BorderWidgetQt()\n{\n  delete this->ui;\n}\n\nnamespace {\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\nvtkCustomBorderWidget::vtkCustomBorderWidget()\n{\n  this->CallbackMapper->SetCallbackMethod(\n      vtkCommand::MiddleButtonReleaseEvent, vtkWidgetEvent::EndSelect, this,\n      vtkCustomBorderWidget::EndSelectAction);\n}\n\nvoid vtkCustomBorderWidget::EndSelectAction(vtkAbstractWidget* w)\n{\n  vtkBorderWidget* borderWidget = dynamic_cast<vtkBorderWidget*>(w);\n\n  // Get the actual box coordinates/planes.\n  // vtkNew<vtkPolyData> polydata;\n\n  // Get the bottom left corner.\n  auto lowerLeft =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPosition();\n  std::cout << \"Lower left: \" << lowerLeft[0] << \" \" << lowerLeft[1]\n            << std::endl;\n\n  auto upperRight =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPosition2();\n  std::cout << \"Upper right: \" << lowerLeft[0] + upperRight[0] << \" \"\n            << lowerLeft[1] + upperRight[1] << std::endl;\n\n  vtkBorderWidget::EndSelectAction(w);\n}\n\n} // namespace\n

        BorderWidgetQt.h

        #ifndef BorderWidgetQt_H\n#define BorderWidgetQt_H\n\n#include <QMainWindow>\n#include <vtkSmartPointer.h>\n\nclass vtkBorderWidget;\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass BorderWidgetQt;\n}\n\nclass BorderWidgetQt : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  // Constructor/Destructor\n  explicit BorderWidgetQt(QWidget* parent = nullptr);\n  virtual ~BorderWidgetQt();\n\nprivate:\n  vtkSmartPointer<vtkBorderWidget> BorderWidget;\n  // Designer form\n  Ui::BorderWidgetQt* ui;\n};\n\n#endif\n

        BorderWidgetQt.ui

        <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>BorderWidgetQt</class>\n <widget class=\"QMainWindow\" name=\"BorderWidgetQt\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>572</width>\n    <height>583</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>BorderWidgetQt</string>\n  </property>\n  <property name=\"windowIcon\">\n   <iconset resource=\"Icons/icons.qrc\">\n    <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n  </property>\n  <property name=\"iconSize\">\n   <size>\n    <width>22</width>\n    <height>22</height>\n   </size>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidget\" native=\"true\">\n    <property name=\"geometry\">\n     <rect>\n      <x>10</x>\n      <y>20</y>\n      <width>511</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/fileopen.png</normaloff>:/Icons/fileopen.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"icon\">\n    <iconset>\n     <normaloff/>\n    </iconset>\n   </property>\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/print.png</normaloff>:/Icons/print.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/filesave.png</normaloff>:/Icons/filesave.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources>\n  <include location=\"Icons/icons.qrc\"/>\n </resources>\n <connections/>\n</ui>\n

        BorderWidgetQtDriver.cxx

        #include <QApplication>\n#include <QSurfaceFormat>\n#include <QVTKOpenGLNativeWidget.h>\n\n#include \"BorderWidgetQt.h\"\n\nint main(int argc, char* argv[])\n{\n  // needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  QApplication app(argc, argv);\n\n  BorderWidgetQt borderWidgetQt;\n  borderWidgetQt.show();\n\n  return app.exec();\n}\n
        "},{"location":"Cxx/Qt/BorderWidgetQt/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(BorderWidgetQt)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"BorderWidgetQt: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"BorderWidgetQt: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(BorderWidgetQt MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(BorderWidgetQt ${qt_components})\nelse()\n  target_link_libraries(BorderWidgetQt ${qt_modules})\nendif()\ntarget_link_libraries(BorderWidgetQt ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BorderWidgetQt\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/BorderWidgetQt/#download-and-build-borderwidgetqt","title":"Download and Build BorderWidgetQt","text":"

        Click here to download BorderWidgetQt and its CMakeLists.txt file. Once the tarball BorderWidgetQt.tar has been downloaded and extracted,

         cd BorderWidgetQt/build\n

        This example requires Qt and VTK.

        If VTK and Qt are installed:

         cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

         cmake -DVTK_DIR=/home/me/vtk_build ..\n

        If Qt is not found on your system, you will need to tell CMake where to find qmake:

        cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

        Build the project:

        make\n

        and run it:

        ./BorderWidgetQt\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

        "},{"location":"Cxx/Qt/EventQtSlotConnect/","title":"EventQtSlotConnect","text":"

        vtk-examples/Cxx/Qt/EventQtSlotConnect

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/EventQtSlotConnect/#code","title":"Code","text":"

        EventQtSlotConnect.cxx

        #include \"EventQtSlotConnect.h\"\n#include \"ui_EventQtSlotConnect.h\"\n\n#include <vtkEventQtSlotConnect.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n#include <iostream>\n#include <string>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\nnamespace {\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n} // namespace\n\n// Constructor\nEventQtSlotConnect::EventQtSlotConnect(QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::EventQtSlotConnect)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;\n#if VTK890\n  this->ui->qvtkWidget->setRenderWindow(renderWindow);\n#else\n  this->ui->qvtkWidget->SetRenderWindow(renderWindow);\n#endif\n\n  vtkNew<vtkEventQtSlotConnect> slotConnector;\n  this->Connections = slotConnector;\n\n  auto lut = GetPlatonicLUT();\n\n  vtkNew<vtkPlatonicSolidSource> source;\n  source->SetSolidTypeToOctahedron();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, 19);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n#if VTK890\n  this->ui->qvtkWidget->renderWindow()->AddRenderer(renderer);\n#else\n  this->ui->qvtkWidget->GetRenderWindow()->AddRenderer(renderer);\n#endif\n\n#if VTK890\n  this->Connections->Connect(\n      this->ui->qvtkWidget->renderWindow()->GetInteractor(),\n      vtkCommand::LeftButtonPressEvent, this,\n      SLOT(slot_clicked(vtkObject*, unsigned long, void*, void*)));\n#else\n  this->Connections->Connect(\n      this->qvtkWidget->GetRenderWindow()->GetInteractor(),\n      vtkCommand::LeftButtonPressEvent, this,\n      SLOT(slot_clicked(vtkObject*, unsigned long, void*, void*)));\n#endif\n};\n\nEventQtSlotConnect::~EventQtSlotConnect()\n{\n  delete this->ui;\n}\n\nvoid EventQtSlotConnect::slot_clicked(vtkObject*, unsigned long, void*, void*)\n{\n  std::cout << \"Clicked.\" << std::endl;\n}\n\nnamespace {\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\n} // namespace\n

        EventQtSlotConnect.ui

        <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>EventQtSlotConnect</class>\n <widget class=\"QMainWindow\" name=\"EventQtSlotConnect\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>561</width>\n    <height>575</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>EventQtSlotConnect</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\n    <item>\n     <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidget\">\n      <property name=\"sizePolicy\">\n       <sizepolicy hsizetype=\"Expanding\" vsizetype=\"MinimumExpanding\">\n        <horstretch>0</horstretch>\n        <verstretch>0</verstretch>\n       </sizepolicy>\n      </property>\n     </widget>\n    </item>\n   </layout>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources/>\n <connections/>\n</ui>\n

        EventQtSlotConnect.h

        #ifndef EventQtSlotConnect_H\n#define EventQtSlotConnect_H\n\n#include <QMainWindow>\n\n#include <vtkObject.h>\n#include <vtkSmartPointer.h>\n\n// Forward class declarations\nclass vtkEventQtSlotConnect;\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass EventQtSlotConnect;\n}\n\nclass EventQtSlotConnect : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  explicit EventQtSlotConnect(QWidget* parent = nullptr);\n  virtual ~EventQtSlotConnect();\n\npublic slots:\n\n  void slot_clicked(vtkObject*, unsigned long, void*, void*);\n\nprivate:\n  vtkSmartPointer<vtkEventQtSlotConnect> Connections;\n  // Designer form\n  Ui::EventQtSlotConnect* ui;\n};\n\n#endif\n

        EventQtSlotConnectDriver.cxx

        #include <QApplication>\n#include <QSurfaceFormat>\n\n#include <QVTKOpenGLNativeWidget.h>\n\n#include \"EventQtSlotConnect.h\"\n\nint main(int argc, char** argv)\n{\n  // needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  QApplication app(argc, argv);\n\n  EventQtSlotConnect eventQtSlotConnect;\n  eventQtSlotConnect.show();\n\n  return app.exec();\n}\n
        "},{"location":"Cxx/Qt/EventQtSlotConnect/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(EventQtSlotConnect)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  GUISupportQt\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"EventQtSlotConnect: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"EventQtSlotConnect: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(EventQtSlotConnect MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(EventQtSlotConnect ${qt_components})\nelse()\n  target_link_libraries(EventQtSlotConnect ${qt_modules})\nendif()\ntarget_link_libraries(EventQtSlotConnect ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EventQtSlotConnect\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/EventQtSlotConnect/#download-and-build-eventqtslotconnect","title":"Download and Build EventQtSlotConnect","text":"

        Click here to download EventQtSlotConnect and its CMakeLists.txt file. Once the tarball EventQtSlotConnect.tar has been downloaded and extracted,

         cd EventQtSlotConnect/build\n

        This example requires Qt and VTK.

        If VTK and Qt are installed:

         cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

         cmake -DVTK_DIR=/home/me/vtk_build ..\n

        If Qt is not found on your system, you will need to tell CMake where to find qmake:

        cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

        Build the project:

        make\n

        and run it:

        ./EventQtSlotConnect\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

        "},{"location":"Cxx/Qt/ImageDataToQImage/","title":"ImageDataToQImage","text":"

        vtk-examples/Cxx/Qt/ImageDataToQImage

        "},{"location":"Cxx/Qt/ImageDataToQImage/#description","title":"Description","text":"

        This example shows how a vtkImageData can be converted into a QImage.

        Seealso

        the QImageToImageSource example.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/ImageDataToQImage/#code","title":"Code","text":"

        ImageDataToQImage.cxx

        #include <vtkImageData.h>\n#include <vtkNew.h>\n#include <vtkSmartPointer.h>\n\n#include <QApplication>\n#include <QColor>\n#include <QImage>\n\n// Create a green 50x50 imageData for demonstration purposes\nvtkSmartPointer<vtkImageData> createDemoImageData()\n{\n  vtkNew<vtkImageData> image;\n  image->SetDimensions(50, 50, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  int width = image->GetDimensions()[0];\n  int height = image->GetDimensions()[1];\n\n  for (int y = 0; y < height; y++)\n  {\n    for (int x = 0; x < width; x++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      pixel[0] = 0;\n      pixel[1] = 255;\n      pixel[2] = 0;\n    }\n  }\n\n  return image;\n}\n\n// The actual conversion code\nQImage vtkImageDataToQImage(vtkSmartPointer<vtkImageData> imageData)\n{\n  if (!imageData)\n  {\n    return QImage();\n  }\n\n  /// \\todo retrieve just the UpdateExtent\n  int width = imageData->GetDimensions()[0];\n  int height = imageData->GetDimensions()[1];\n  QImage image(width, height, QImage::Format_RGB32);\n  QRgb* rgbPtr = reinterpret_cast<QRgb*>(image.bits()) + width * (height - 1);\n  unsigned char* colorsPtr =\n      reinterpret_cast<unsigned char*>(imageData->GetScalarPointer());\n\n  // Loop over the vtkImageData contents.\n  for (int row = 0; row < height; row++)\n  {\n    for (int col = 0; col < width; col++)\n    {\n      // Swap the vtkImageData RGB values with an equivalent QColor\n      *(rgbPtr++) = QColor(colorsPtr[0], colorsPtr[1], colorsPtr[2]).rgb();\n      colorsPtr += imageData->GetNumberOfScalarComponents();\n    }\n\n    rgbPtr -= width * 2;\n  }\n\n  return image;\n}\n\nint main(int argc, char* argv[])\n{\n  QApplication app(argc, argv);\n\n  QImage qimage = vtkImageDataToQImage(createDemoImageData());\n  qimage.save(\"qimage.png\");\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Qt/ImageDataToQImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageDataToQImage)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageDataToQImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageDataToQImage MACOSX_BUNDLE ImageDataToQImage.cxx )\n  target_link_libraries(ImageDataToQImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageDataToQImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/ImageDataToQImage/#download-and-build-imagedatatoqimage","title":"Download and Build ImageDataToQImage","text":"

        Click here to download ImageDataToQImage and its CMakeLists.txt file. Once the tarball ImageDataToQImage.tar has been downloaded and extracted,

        cd ImageDataToQImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageDataToQImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Qt/MinimalQtVTKApp/","title":"MinimalQtVTKApp","text":"

        vtk-examples/Cxx/Qt/MinimalQtVTKApp

        "},{"location":"Cxx/Qt/MinimalQtVTKApp/#description","title":"Description","text":"

        This is meant to serve as a minimal Qt/VTK example for Qt application developers looking to use VTK and VTK developers looking to develop Qt applications.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/MinimalQtVTKApp/#code","title":"Code","text":"

        MinimalQtVTKApp.cxx

        #include <QVTKOpenGLNativeWidget.h>\n#include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkPointData.h>\n#include <vtkProperty.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <QApplication>\n#include <QDockWidget>\n#include <QGridLayout>\n#include <QLabel>\n#include <QMainWindow>\n#include <QPointer>\n#include <QPushButton>\n#include <QVBoxLayout>\n\n#include <cmath>\n#include <cstdlib>\n#include <random>\n\nnamespace {\n/**\n * Deform the sphere source using a random amplitude and modes and render it in\n * the window\n *\n * @param sphere the original sphere source\n * @param mapper the mapper for the scene\n * @param window the window to render to\n * @param randEng the random number generator engine\n */\nvoid Randomize(vtkSphereSource* sphere, vtkMapper* mapper,\n               vtkGenericOpenGLRenderWindow* window, std::mt19937& randEng);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  QApplication app(argc, argv);\n\n  // Main window.\n  QMainWindow mainWindow;\n  mainWindow.resize(1200, 900);\n\n  // Control area.\n  QDockWidget controlDock;\n  mainWindow.addDockWidget(Qt::LeftDockWidgetArea, &controlDock);\n\n  QLabel controlDockTitle(\"Control Dock\");\n  controlDockTitle.setMargin(20);\n  controlDock.setTitleBarWidget(&controlDockTitle);\n\n  QPointer<QVBoxLayout> dockLayout = new QVBoxLayout();\n  QWidget layoutContainer;\n  layoutContainer.setLayout(dockLayout);\n  controlDock.setWidget(&layoutContainer);\n\n  QPushButton randomizeButton;\n  randomizeButton.setText(\"Randomize\");\n  dockLayout->addWidget(&randomizeButton);\n\n  // Render area.\n  QPointer<QVTKOpenGLNativeWidget> vtkRenderWidget =\n      new QVTKOpenGLNativeWidget();\n  mainWindow.setCentralWidget(vtkRenderWidget);\n\n  // VTK part.\n  vtkNew<vtkGenericOpenGLRenderWindow> window;\n  vtkRenderWidget->setRenderWindow(window.Get());\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetRadius(1.0);\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(100);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetEdgeVisibility(true);\n  actor->GetProperty()->SetRepresentationToSurface();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n\n  window->AddRenderer(renderer);\n\n  // Setup initial status.\n  std::mt19937 randEng(0);\n  ::Randomize(sphere, mapper, window, randEng);\n\n  // connect the buttons\n  QObject::connect(&randomizeButton, &QPushButton::released,\n                   [&]() { ::Randomize(sphere, mapper, window, randEng); });\n\n  mainWindow.show();\n\n  return app.exec();\n}\n\nnamespace {\nvoid Randomize(vtkSphereSource* sphere, vtkMapper* mapper,\n               vtkGenericOpenGLRenderWindow* window, std::mt19937& randEng)\n{\n  // Generate randomness.\n  double randAmp = 0.2 + ((randEng() % 1000) / 1000.0) * 0.2;\n  double randThetaFreq = 1.0 + (randEng() % 9);\n  double randPhiFreq = 1.0 + (randEng() % 9);\n\n  // Extract and prepare data.\n  sphere->Update();\n  vtkSmartPointer<vtkPolyData> newSphere;\n  newSphere.TakeReference(sphere->GetOutput()->NewInstance());\n  newSphere->DeepCopy(sphere->GetOutput());\n  vtkNew<vtkDoubleArray> height;\n  height->SetName(\"Height\");\n  height->SetNumberOfComponents(1);\n  height->SetNumberOfTuples(newSphere->GetNumberOfPoints());\n  newSphere->GetPointData()->AddArray(height);\n\n  // Deform the sphere.\n  for (int iP = 0; iP < newSphere->GetNumberOfPoints(); iP++)\n  {\n    double pt[3] = {0.0};\n    newSphere->GetPoint(iP, pt);\n    double theta = std::atan2(pt[1], pt[0]);\n    double phi =\n        std::atan2(pt[2], std::sqrt(std::pow(pt[0], 2) + std::pow(pt[1], 2)));\n    double thisAmp =\n        randAmp * std::cos(randThetaFreq * theta) * std::sin(randPhiFreq * phi);\n    height->SetValue(iP, thisAmp);\n    pt[0] += thisAmp * std::cos(theta) * std::cos(phi);\n    pt[1] += thisAmp * std::sin(theta) * std::cos(phi);\n    pt[2] += thisAmp * std::sin(phi);\n    newSphere->GetPoints()->SetPoint(iP, pt);\n  }\n  newSphere->GetPointData()->SetScalars(height);\n\n  // Reconfigure the pipeline to take the new deformed sphere.\n  mapper->SetInputDataObject(newSphere);\n  mapper->SetScalarModeToUsePointData();\n  mapper->ColorByArrayComponent(\"Height\", 0);\n  window->Render();\n}\n} // namespace\n
        "},{"location":"Cxx/Qt/MinimalQtVTKApp/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(MinimalQtVTKApp)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersSources\n  GUISupportQt\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"MinimalQtVTKApp: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"MinimalQtVTKApp: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(MinimalQtVTKApp MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(MinimalQtVTKApp ${qt_components})\nelse()\n  target_link_libraries(MinimalQtVTKApp ${qt_modules})\nendif()\ntarget_link_libraries(MinimalQtVTKApp ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MinimalQtVTKApp\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/MinimalQtVTKApp/#download-and-build-minimalqtvtkapp","title":"Download and Build MinimalQtVTKApp","text":"

        Click here to download MinimalQtVTKApp and its CMakeLists.txt file. Once the tarball MinimalQtVTKApp.tar has been downloaded and extracted,

         cd MinimalQtVTKApp/build\n

        This example requires Qt and VTK.

        If VTK and Qt are installed:

         cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

         cmake -DVTK_DIR=/home/me/vtk_build ..\n

        If Qt is not found on your system, you will need to tell CMake where to find qmake:

        cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

        Build the project:

        make\n

        and run it:

        ./MinimalQtVTKApp\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

        "},{"location":"Cxx/Qt/QImageToImageSource/","title":"QImageToImageSource","text":"

        vtk-examples/Cxx/Qt/QImageToImageSource

        "},{"location":"Cxx/Qt/QImageToImageSource/#description","title":"Description","text":"

        This example demonstrates the use of vtkQImageToImageSource.

        See also the ImageDataToQImage example.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/QImageToImageSource/#code","title":"Code","text":"

        QImageToImageSource.cxx

        #include <QApplication>\n#include <QPixmap>\n#include <vtkNew.h>\n\n#include <vtkQImageToImageSource.h>\n\nint main(int argc, char* argv[])\n{\n  QApplication app(argc, argv);\n\n  QPixmap pixmap(10, 10);\n  QColor color(10, 20, 30);\n  pixmap.fill(color);\n\n  vtkNew<vtkQImageToImageSource> qimageToImageSource;\n  QImage qimage = pixmap.toImage();\n  qimageToImageSource->SetQImage(&qimage);\n  qimageToImageSource->Update();\n\n  //  vtkImageData* image = qimageToImageSource->GetOutput();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Qt/QImageToImageSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QImageToImageSource)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  RenderingQt\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QImageToImageSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QImageToImageSource MACOSX_BUNDLE QImageToImageSource.cxx )\n  target_link_libraries(QImageToImageSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QImageToImageSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/QImageToImageSource/#download-and-build-qimagetoimagesource","title":"Download and Build QImageToImageSource","text":"

        Click here to download QImageToImageSource and its CMakeLists.txt file. Once the tarball QImageToImageSource.tar has been downloaded and extracted,

        cd QImageToImageSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QImageToImageSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Qt/RenderWindowNoUiFile/","title":"RenderWindowNoUiFile","text":"

        vtk-examples/Cxx/Qt/RenderWindowNoUiFile

        "},{"location":"Cxx/Qt/RenderWindowNoUiFile/#description","title":"Description","text":"

        This is a very basic example that shows how to create a Qt window. Typically, one would want to design a form in the QtDesigner (this is shown in RenderWindowUISingleInheritance).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/RenderWindowNoUiFile/#code","title":"Code","text":"

        RenderWindowNoUiFile.cxx

        #include <QApplication>\n\n#include <vtkActor.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n#include <QSurfaceFormat>\n#include <QVTKOpenGLNativeWidget.h>\n\nnamespace {\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n} // namespace\n\nint main(int argc, char** argv)\n{\n  // Needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  QApplication app(argc, argv);\n\n  QVTKOpenGLNativeWidget widget;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;\n#if VTK890\n  widget.setRenderWindow(renderWindow);\n#else\n  widget.SetRenderWindow(renderWindow);\n#endif\n\n  widget.resize(600, 600);\n\n  auto lut = GetPlatonicLUT();\n\n  vtkNew<vtkPlatonicSolidSource> source;\n  source->SetSolidTypeToIcosahedron();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, 19);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n#if VTK890\n  widget.renderWindow()->AddRenderer(renderer);\n  widget.renderWindow()->SetWindowName(\"RenderWindowNoUIFile\");\n#else\n  widget.GetRenderWindow()->AddRenderer(renderer);\n  widget.GetRenderWindow()->SetWindowName(\"RenderWindowNoUIFile\");\n#endif\n  widget.show();\n\n  app.exec();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Qt/RenderWindowNoUiFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RenderWindowNoUiFile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  GUISupportQt\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RenderWindowNoUiFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RenderWindowNoUiFile MACOSX_BUNDLE RenderWindowNoUiFile.cxx )\n  target_link_libraries(RenderWindowNoUiFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RenderWindowNoUiFile\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/RenderWindowNoUiFile/#download-and-build-renderwindownouifile","title":"Download and Build RenderWindowNoUiFile","text":"

        Click here to download RenderWindowNoUiFile and its CMakeLists.txt file. Once the tarball RenderWindowNoUiFile.tar has been downloaded and extracted,

        cd RenderWindowNoUiFile/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RenderWindowNoUiFile\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Qt/RenderWindowUISingleInheritance/","title":"RenderWindowUISingleInheritance","text":"

        vtk-examples/Cxx/Qt/RenderWindowUISingleInheritance

        "},{"location":"Cxx/Qt/RenderWindowUISingleInheritance/#description","title":"Description","text":"

        Using a QVTKOpenGLNativeWidget with the Qt Single Inheritance model. This cleanly separates the public interface of the class from its internals.

        The main widget is derived from from QMainWindow and the class Ui::RenderWindowUISingleInheritance becomes a variable in the class.

        The procedure is:

        • In the header file RenderWindowUISingleInheritance.h forward declare the class Ui_RenderWindowUISingleInheritance and create a private variable in the class:
        private:\n  // Designer form\n  Ui_RenderWindowUISingleInheritance* ui;\n
        • In the source file RenderWindowUISingleInheritance.cxx, assign and initialise in the constructor:
          this->ui = new Ui_RenderWindowUISingleInheritance;\n  this->ui->setupUi(this);\n

        This approach also ensures that when CMAKE_AUTOUIC is set to ON and subfolders are used we get a build with no errors.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/RenderWindowUISingleInheritance/#code","title":"Code","text":"

        RenderWindowUISingleInheritance.cxx

        #include \"RenderWindowUISingleInheritance.h\"\n#include \"ui_RenderWindowUISingleInheritance.h\"\n\n#include <vtkCamera.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\nnamespace {\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n} // namespace\n\n// Constructor\nRenderWindowUISingleInheritance::RenderWindowUISingleInheritance(\n    QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::RenderWindowUISingleInheritance)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;\n#if VTK890\n  this->ui->qvtkWidget->setRenderWindow(renderWindow);\n#else\n  this->ui->qvtkWidget->SetRenderWindow(renderWindow);\n#endif\n\n  auto lut = GetPlatonicLUT();\n\n  vtkNew<vtkPlatonicSolidSource> source;\n  source->SetSolidTypeToIcosahedron();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, 19);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->GetActiveCamera()->Azimuth(180.0);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // VTK/Qt wedded.\n#if VTK890\n  this->ui->qvtkWidget->renderWindow()->AddRenderer(renderer);\n  this->ui->qvtkWidget->renderWindow()->SetWindowName(\n      \"RenderWindowUISingleInheritance\");\n#else\n  this->ui->qvtkWidget->GetRenderWindow()->AddRenderer(renderer);\n  this->ui->qvtkWidget->GetRenderWindow()->SetWindowName(\n      \"RenderWindowUISingleInheritance\");\n#endif\n  // Set up action signals and slots.\n  connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));\n}\n\nRenderWindowUISingleInheritance::~RenderWindowUISingleInheritance()\n{\n  delete this->ui;\n}\n\nvoid RenderWindowUISingleInheritance::slotExit()\n{\n  qApp->exit();\n}\n\nnamespace {\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\n} // namespace\n

        RenderWindowUISingleInheritanceDriver.cxx

        #include <QApplication>\n#include <QSurfaceFormat>\n#include <QVTKOpenGLNativeWidget.h>\n\n#include \"RenderWindowUISingleInheritance.h\"\n\nint main(int argc, char** argv)\n{\n  // needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  // QT Stuff\n  QApplication app(argc, argv);\n\n  RenderWindowUISingleInheritance renderWindowUISingleInheritance;\n  renderWindowUISingleInheritance.show();\n\n  return app.exec();\n}\n

        RenderWindowUISingleInheritance.ui

        <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>RenderWindowUISingleInheritance</class>\n <widget class=\"QMainWindow\" name=\"RenderWindowUISingleInheritance\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>541</width>\n    <height>583</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>RenderWindowUISingleInheritance</string>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidget\">\n    <property name=\"geometry\">\n     <rect>\n      <x>10</x>\n      <y>20</y>\n      <width>511</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources>\n\n </resources>\n <connections/>\n</ui>\n

        RenderWindowUISingleInheritance.h

        #ifndef RenderWindowUISingleInheritance_H\n#define RenderWindowUISingleInheritance_H\n\n#include <vtkSmartPointer.h>\n\n#include <QMainWindow>\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass RenderWindowUISingleInheritance;\n}\n\nclass RenderWindowUISingleInheritance : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  // Constructor/Destructor\n  explicit RenderWindowUISingleInheritance(QWidget* parent = nullptr);\n  virtual ~RenderWindowUISingleInheritance();\n\nprivate:\n  // Designer form\n  Ui::RenderWindowUISingleInheritance* ui;\n\npublic slots:\n  void slotExit();\n};\n\n#endif\n
        "},{"location":"Cxx/Qt/RenderWindowUISingleInheritance/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(RenderWindowUISingleInheritance)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"RenderWindowUISingleInheritance: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"RenderWindowUISingleInheritance: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(RenderWindowUISingleInheritance MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(RenderWindowUISingleInheritance ${qt_components})\nelse()\n  target_link_libraries(RenderWindowUISingleInheritance ${qt_modules})\nendif()\ntarget_link_libraries(RenderWindowUISingleInheritance ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RenderWindowUISingleInheritance\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/RenderWindowUISingleInheritance/#download-and-build-renderwindowuisingleinheritance","title":"Download and Build RenderWindowUISingleInheritance","text":"

        Click here to download RenderWindowUISingleInheritance and its CMakeLists.txt file. Once the tarball RenderWindowUISingleInheritance.tar has been downloaded and extracted,

         cd RenderWindowUISingleInheritance/build\n

        This example requires Qt and VTK.

        If VTK and Qt are installed:

         cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

         cmake -DVTK_DIR=/home/me/vtk_build ..\n

        If Qt is not found on your system, you will need to tell CMake where to find qmake:

        cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

        Build the project:

        make\n

        and run it:

        ./RenderWindowUISingleInheritance\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

        "},{"location":"Cxx/Qt/ShareCameraQt/","title":"ShareCameraQt","text":"

        vtk-examples/Cxx/Qt/ShareCameraQt

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/ShareCameraQt/#code","title":"Code","text":"

        ShareCameraQt.cxx

        #include \"ShareCameraQt.h\"\n#include \"ui_ShareCameraQt.h\"\n\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n// Constructor\nShareCameraQt::ShareCameraQt(QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::ShareCameraQt)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindowLeft;\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindowRight;\n#if VTK890\n  this->ui->qvtkWidgetLeft->setRenderWindow(renderWindowLeft);\n  this->ui->qvtkWidgetRight->setRenderWindow(renderWindowRight);\n#else\n  this->ui->qvtkWidgetLeft->SetRenderWindow(renderWindowLeft);\n  this->ui->qvtkWidgetRight->SetRenderWindow(renderWindowRight);\n#endif\n\n  // Cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetDirection(0.0, 1.0, 0.0);\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor4d(\"Tomato\").GetData());\n\n  // Cube\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetXLength(0.8);\n  cubeSource->SetYLength(0.8);\n  cubeSource->SetZLength(0.8);\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(\n      colors->GetColor4d(\"MediumSeaGreen\").GetData());\n\n  // VTK Renderer.\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->AddActor(coneActor);\n  leftRenderer->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n\n  // Add Actor to renderer.\n  rightRenderer->AddActor(cubeActor);\n  rightRenderer->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  // VTK/Qt wedded.\n#if VTK890\n  this->ui->qvtkWidgetLeft->renderWindow()->AddRenderer(leftRenderer);\n  this->ui->qvtkWidgetRight->renderWindow()->AddRenderer(rightRenderer);\n#else\n  this->ui->qvtkWidgetLeft->GetRenderWindow()->AddRenderer(leftRenderer);\n  this->ui->qvtkWidgetRight->GetRenderWindow()->AddRenderer(rightRenderer);\n#endif\n\n  rightRenderer->ResetCamera();\n  leftRenderer->ResetCamera();\n\n  // Here we share the camera.\n  rightRenderer->SetActiveCamera(leftRenderer->GetActiveCamera());\n\n  // Position the cube using the left renderer active camera.\n  leftRenderer->GetActiveCamera()->Azimuth(60);\n  leftRenderer->ResetCamera();\n\n  // Set up action signals and slots.\n  connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));\n\n#if VTK890\n  this->ui->qvtkWidgetLeft->renderWindow()->AddObserver(\n      vtkCommand::ModifiedEvent, this, &ShareCameraQt::ModifiedHandler);\n#else\n  this->ui->qvtkWidgetLeft->GetRenderWindow()->AddObserver(\n      vtkCommand::ModifiedEvent, this, &ShareCameraQt::ModifiedHandler);\n#endif\n}\n\nvoid ShareCameraQt::ModifiedHandler()\n{\n#if VTK890\n  this->ui->qvtkWidgetRight->renderWindow()->Render();\n#else\n  this->ui->qvtkWidgetRight->GetRenderWindow()->Render();\n#endif\n}\n\nvoid ShareCameraQt::slotExit()\n{\n  qApp->exit();\n}\n

        ShareCameraQt.h

        #ifndef ShareCameraQt_H\n#define ShareCameraQt_H\n\n#include <QMainWindow>\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass ShareCameraQt;\n}\n\nclass ShareCameraQt : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  // Constructor/Destructor\n  explicit ShareCameraQt(QWidget* parent = nullptr);\n  virtual ~ShareCameraQt() = default;\n\nprivate:\n  // Designer form\n  Ui::ShareCameraQt* ui;\n\npublic slots:\n  void slotExit();\n\nprotected:\n  void ModifiedHandler();\n};\n\n#endif\n

        ShareCameraQt.ui

        <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>ShareCameraQt</class>\n <widget class=\"QMainWindow\" name=\"ShareCameraQt\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>990</width>\n    <height>583</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ShareCameraQt</string>\n  </property>\n  <property name=\"windowIcon\">\n   <iconset resource=\"Icons/icons.qrc\">\n    <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n  </property>\n  <property name=\"iconSize\">\n   <size>\n    <width>22</width>\n    <height>22</height>\n   </size>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidgetLeft\">\n    <property name=\"geometry\">\n     <rect>\n      <x>10</x>\n      <y>20</y>\n      <width>511</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidgetRight\">\n    <property name=\"geometry\">\n     <rect>\n      <x>540</x>\n      <y>20</y>\n      <width>441</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/fileopen.png</normaloff>:/Icons/fileopen.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"icon\">\n    <iconset>\n     <normaloff/>\n    </iconset>\n   </property>\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/print.png</normaloff>:/Icons/print.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/filesave.png</normaloff>:/Icons/filesave.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources>\n  <include location=\"Icons/icons.qrc\"/>\n </resources>\n <connections/>\n</ui>\n

        ShareCameraQtDriver.cxx

        #include <QApplication>\n#include <QSurfaceFormat>\n#include <QVTKOpenGLNativeWidget.h>\n\n#include \"ShareCameraQt.h\"\n\nint main(int argc, char** argv)\n{\n  // needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  // QT Stuff\n  QApplication app(argc, argv);\n\n  ShareCameraQt shareCameraQt;\n  shareCameraQt.show();\n\n  return app.exec();\n}\n
        "},{"location":"Cxx/Qt/ShareCameraQt/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(ShareCameraQt)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShareCameraQt: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"ShareCameraQt: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(ShareCameraQt MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(ShareCameraQt ${qt_components})\nelse()\n  target_link_libraries(ShareCameraQt ${qt_modules})\nendif()\ntarget_link_libraries(ShareCameraQt ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShareCameraQt\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/ShareCameraQt/#download-and-build-sharecameraqt","title":"Download and Build ShareCameraQt","text":"

        Click here to download ShareCameraQt and its CMakeLists.txt file. Once the tarball ShareCameraQt.tar has been downloaded and extracted,

         cd ShareCameraQt/build\n

        This example requires Qt and VTK.

        If VTK and Qt are installed:

         cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

         cmake -DVTK_DIR=/home/me/vtk_build ..\n

        If Qt is not found on your system, you will need to tell CMake where to find qmake:

        cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

        Build the project:

        make\n

        and run it:

        ./ShareCameraQt\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

        "},{"location":"Cxx/Qt/ShowEvent/","title":"ShowEvent","text":"

        vtk-examples/Cxx/Qt/ShowEvent

        "},{"location":"Cxx/Qt/ShowEvent/#description","title":"Description","text":"

        Small example (not doing anything actually) to show the use of the overwritten QWidget::showEvent() function to initialize the VTK widget when it is actually used, not directly in the constructor.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/ShowEvent/#code","title":"Code","text":"

        ShowEvent.cxx

        #include <iostream>\n\n#include \"ShowEvent.h\"\n#include \"ui_ShowEvent.h\"\n\nShowEvent::ShowEvent(QWidget* parent) : QWidget(parent), ui(new Ui::ShowEvent)\n{\n  this->ui->setupUi(this);\n\n  // Do not do anything related to VTK display here!\n  std::cout << \"Constructor\" << std::endl;\n}\n\nvoid ShowEvent::showEvent(QShowEvent*)\n{\n  // Instead, do the VTK display things here!\n  std::cout << \"VTK Stuff\" << std::endl;\n}\n

        ShowEvent.h

        #ifndef ShowEventQt_H\n#define ShowEventQt_H\n\n#include <QMainWindow>\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass ShowEvent;\n}\n\nclass ShowEvent : public QWidget //, private Ui::ShowEvent\n{\n  Q_OBJECT\n\npublic:\n  explicit ShowEvent(QWidget* parent = nullptr);\n  virtual ~ShowEvent() = default;\n\nprivate:\n  Ui::ShowEvent* ui;\n\nprotected:\n  void showEvent(QShowEvent* event);\n};\n\n#endif\n

        ShowEventDriver.cxx

        #include <QApplication>\n\n#include \"ShowEvent.h\"\n\nint main(int argc, char* argv[])\n{\n  QApplication app(argc, argv);\n  ShowEvent showEvent;\n\n  showEvent.show();\n  return app.exec();\n}\n

        ShowEvent.ui

        <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>ShowEvent</class>\n <widget class=\"QWidget\" name=\"ShowEvent\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>312</width>\n    <height>243</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>ShowEvent</string>\n  </property>\n  <layout class=\"QGridLayout\" name=\"gridLayout\">\n   <item row=\"0\" column=\"0\">\n    <widget class=\"QGraphicsView\" name=\"graphicsView\">\n     <property name=\"backgroundBrush\">\n      <brush brushstyle=\"NoBrush\">\n       <color alpha=\"255\">\n        <red>0</red>\n        <green>0</green>\n        <blue>0</blue>\n       </color>\n      </brush>\n     </property>\n    </widget>\n   </item>\n  </layout>\n </widget>\n <resources/>\n <connections/>\n</ui>\n
        "},{"location":"Cxx/Qt/ShowEvent/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShowEvent)\n\nfind_package(VTK COMPONENTS \n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShowEvent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShowEvent MACOSX_BUNDLE ShowEvent.cxx )\n  target_link_libraries(ShowEvent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShowEvent\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/ShowEvent/#download-and-build-showevent","title":"Download and Build ShowEvent","text":"

        Click here to download ShowEvent and its CMakeLists.txt file. Once the tarball ShowEvent.tar has been downloaded and extracted,

        cd ShowEvent/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ShowEvent\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Qt/SideBySideRenderWindowsQt/","title":"SideBySideRenderWindowsQt","text":"

        vtk-examples/Cxx/Qt/SideBySideRenderWindowsQt

        "},{"location":"Cxx/Qt/SideBySideRenderWindowsQt/#description","title":"Description","text":"

        Although this example includes ui_SideBySideRenderWindowsQt.h, this file is not distributed, it is created by Qt at compile time.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Qt/SideBySideRenderWindowsQt/#code","title":"Code","text":"

        SideBySideRenderWindowsQt.cxx

        #include \"SideBySideRenderWindowsQt.h\"\n#include \"ui_SideBySideRenderWindowsQt.h\"\n\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkElevationFilter.h>\n#include <vtkGenericOpenGLRenderWindow.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define VTK890 1\n#endif\n\n// Constructor\nSideBySideRenderWindowsQt::SideBySideRenderWindowsQt(QWidget* parent)\n  : QMainWindow(parent), ui(new Ui::SideBySideRenderWindowsQt)\n{\n  this->ui->setupUi(this);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindowLeft;\n  vtkNew<vtkGenericOpenGLRenderWindow> renderWindowRight;\n#if VTK890\n  this->ui->qvtkWidgetLeft->setRenderWindow(renderWindowLeft);\n  this->ui->qvtkWidgetRight->setRenderWindow(renderWindowRight);\n#else\n  this->ui->qvtkWidgetLeft->SetRenderWindow(renderWindowLeft);\n  this->ui->qvtkWidgetRight->SetRenderWindow(renderWindowRight);\n#endif\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n  vtkNew<vtkElevationFilter> sphereElev;\n  sphereElev->SetInputConnection(sphereSource->GetOutputPort());\n  sphereElev->SetLowPoint(0, -1.0, 0);\n  sphereElev->SetHighPoint(0, 1.0, 0);\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereElev->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n\n  // Cube\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetXLength(0.8);\n  cubeSource->SetYLength(0.8);\n  cubeSource->SetZLength(0.8);\n  vtkNew<vtkElevationFilter> cubeElev;\n  cubeElev->SetInputConnection(cubeSource->GetOutputPort());\n  cubeElev->SetLowPoint(0, -1.0, 0);\n  cubeElev->SetHighPoint(0, 1.0, 0);\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeElev->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n\n  // VTK Renderer.\n  vtkNew<vtkRenderer> leftRenderer;\n  leftRenderer->AddActor(sphereActor);\n  leftRenderer->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n\n  // Add Actor to renderer.\n  rightRenderer->AddActor(cubeActor);\n  rightRenderer->GetActiveCamera()->Azimuth(60);\n  rightRenderer->ResetCamera();\n  rightRenderer->GetActiveCamera()->Zoom(0.8);\n  rightRenderer->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  // VTK/Qt wedded.\n#if VTK890\n  this->ui->qvtkWidgetLeft->renderWindow()->AddRenderer(leftRenderer);\n  this->ui->qvtkWidgetRight->renderWindow()->AddRenderer(rightRenderer);\n#else\n  this->ui->qvtkWidgetLeft->GetRenderWindow()->AddRenderer(leftRenderer);\n  this->ui->qvtkWidgetRight->GetRenderWindow()->AddRenderer(rightRenderer);\n#endif\n\n  // Set up action signals and slots.\n  connect(this->ui->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));\n}\n\nvoid SideBySideRenderWindowsQt::slotExit()\n{\n  qApp->exit();\n}\n

        SideBySideRenderWindowsQt.ui

        <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>SideBySideRenderWindowsQt</class>\n <widget class=\"QMainWindow\" name=\"SideBySideRenderWindowsQt\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>990</width>\n    <height>583</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>SideBySideRenderWindowsQt</string>\n  </property>\n  <property name=\"windowIcon\">\n   <iconset resource=\"Icons/icons.qrc\">\n    <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n  </property>\n  <property name=\"iconSize\">\n   <size>\n    <width>22</width>\n    <height>22</height>\n   </size>\n  </property>\n  <widget class=\"QWidget\" name=\"centralwidget\">\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidgetLeft\">\n    <property name=\"geometry\">\n     <rect>\n      <x>10</x>\n      <y>20</y>\n      <width>511</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n   <widget class=\"QVTKOpenGLNativeWidget\" name=\"qvtkWidgetRight\">\n    <property name=\"geometry\">\n     <rect>\n      <x>540</x>\n      <y>20</y>\n      <width>441</width>\n      <height>541</height>\n     </rect>\n    </property>\n   </widget>\n  </widget>\n  <action name=\"actionOpenFile\">\n   <property name=\"enabled\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/fileopen.png</normaloff>:/Icons/fileopen.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Open File...</string>\n   </property>\n  </action>\n  <action name=\"actionExit\">\n   <property name=\"icon\">\n    <iconset>\n     <normaloff/>\n    </iconset>\n   </property>\n   <property name=\"text\">\n    <string>Exit</string>\n   </property>\n  </action>\n  <action name=\"actionPrint\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/print.png</normaloff>:/Icons/print.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Print</string>\n   </property>\n  </action>\n  <action name=\"actionHelp\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/help.png</normaloff>:/Icons/help.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Help</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"icon\">\n    <iconset resource=\"Icons/icons.qrc\">\n     <normaloff>:/Icons/filesave.png</normaloff>:/Icons/filesave.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Save</string>\n   </property>\n  </action>\n </widget>\n <customwidgets>\n  <customwidget>\n   <class>QVTKOpenGLNativeWidget</class>\n   <extends>QWidget</extends>\n   <header>QVTKOpenGLNativeWidget.h</header>\n  </customwidget>\n </customwidgets>\n <resources>\n  <include location=\"Icons/icons.qrc\"/>\n </resources>\n <connections/>\n</ui>\n

        SideBySideRenderWindowsQt.h

        #ifndef SideBySideRenderWindowsQt_H\n#define SideBySideRenderWindowsQt_H\n\n#include <QMainWindow>\n\n/*\n * See \"The Single Inheritance Approach\" in this link:\n * [Using a Designer UI File in Your C++\n * Application](https://doc.qt.io/qt-5/designer-using-a-ui-file.html)\n */\nnamespace Ui {\nclass SideBySideRenderWindowsQt;\n}\n\nclass SideBySideRenderWindowsQt : public QMainWindow\n{\n  Q_OBJECT\npublic:\n  // Constructor/Destructor\n  explicit SideBySideRenderWindowsQt(QWidget* parent = nullptr);\n  virtual ~SideBySideRenderWindowsQt() = default;\n\nprivate:\n  // Designer form\n  Ui::SideBySideRenderWindowsQt* ui;\n\npublic slots:\n\n  void slotExit();\n};\n\n#endif\n

        SideBySideRenderWindowsQtDriver.cxx

        #include <QApplication>\n#include <QSurfaceFormat>\n\n#include \"SideBySideRenderWindowsQt.h\"\n#include <QVTKOpenGLNativeWidget.h>\n\nint main(int argc, char** argv)\n{\n  // needed to ensure appropriate OpenGL context is created for VTK rendering.\n  QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());\n\n  // QT Stuff\n  QApplication app(argc, argv);\n\n  SideBySideRenderWindowsQt sideBySideRenderWindowsQt;\n  sideBySideRenderWindowsQt.show();\n\n  return app.exec();\n}\n
        "},{"location":"Cxx/Qt/SideBySideRenderWindowsQt/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nif(POLICY CMP0020)\n  cmake_policy(SET CMP0020 NEW)\n  cmake_policy(SET CMP0071 NEW)\nendif()\n\nPROJECT(SideBySideRenderWindowsQt)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  GUISupportQt\n  RenderingQt\n)\n\nif(NOT VTK_FOUND)\n  message(FATAL_ERROR \"SideBySideRenderWindowsQt: Unable to find the VTK build folder.\")\nendif()\n\nif(NOT(TARGET VTK::GUISupportQt))\n  message(FATAL_ERROR \"SideBySideRenderWindowsQt: VTK not built with Qt support.\")\nendif()\n\nif(NOT DEFINED VTK_QT_VERSION)\n  set(VTK_QT_VERSION 5)\nendif()\n\nset(qt_components Core Gui Widgets)\nif(${VTK_QT_VERSION} VERSION_GREATER_EQUAL 6)\n  list(APPEND qt_components OpenGLWidgets)\nendif()\nlist(SORT qt_components)\n# We have ui files, so this will also bring in the macro:\n#   qt5_wrap_ui or qt_wrap_ui from Widgets.\nfind_package(Qt${VTK_QT_VERSION} QUIET\n  REQUIRED COMPONENTS ${qt_components}\n)\n\nforeach(_qt_comp IN LISTS qt_components)\n  list(APPEND qt_modules \"Qt${VTK_QT_VERSION}::${_qt_comp}\")\nendforeach()\n\nmessage (STATUS \"VTK_VERSION: ${VTK_VERSION}, Qt Version: ${Qt${VTK_QT_VERSION}Widgets_VERSION}\")\n\n# Instruct CMake to run moc and uic automatically when needed.\nset(CMAKE_AUTOMOC ON)\nset(CMAKE_AUTOUIC ON)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})\n\nfile(GLOB UI_FILES *.ui)\nfile(GLOB QT_WRAP *.h)\nfile(GLOB CXX_FILES *.cxx)\n\n# For VTK versions greater than or equal to 8.90.0:\n#  CMAKE_AUTOUIC is ON so we handle uic automatically for Qt targets.\n#  CMAKE_AUTOMOC is ON so we handle moc automatically for Qt targets.\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\n# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.\nadd_executable(SideBySideRenderWindowsQt MACOSX_BUNDLE\n  ${CXX_FILES} ${UISrcs} ${QT_WRAP}\n)\nif (Qt${VTK_QT_VERSION}Widgets_VERSION VERSION_LESS \"5.11.0\")\n  qt5_use_modules(SideBySideRenderWindowsQt ${qt_components})\nelse()\n  target_link_libraries(SideBySideRenderWindowsQt ${qt_modules})\nendif()\ntarget_link_libraries(SideBySideRenderWindowsQt ${VTK_LIBRARIES})\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SideBySideRenderWindowsQt\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Qt/SideBySideRenderWindowsQt/#download-and-build-sidebysiderenderwindowsqt","title":"Download and Build SideBySideRenderWindowsQt","text":"

        Click here to download SideBySideRenderWindowsQt and its CMakeLists.txt file. Once the tarball SideBySideRenderWindowsQt.tar has been downloaded and extracted,

         cd SideBySideRenderWindowsQt/build\n

        This example requires Qt and VTK.

        If VTK and Qt are installed:

         cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

         cmake -DVTK_DIR=/home/me/vtk_build ..\n

        If Qt is not found on your system, you will need to tell CMake where to find qmake:

        cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/something/qmake  ..\n

        Build the project:

        make\n

        and run it:

        ./SideBySideRenderWindowsQt\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time. You may also need to add a Qt related path.

        "},{"location":"Cxx/RectilinearGrid/RGrid/","title":"RGrid","text":"

        vtk-examples/Cxx/RectilinearGrid/RGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/RectilinearGrid/RGrid/#description","title":"Description","text":"

        Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray.

        Info

        See Figure 5-20 in Chapter 5 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/RectilinearGrid/RGrid/#code","title":"Code","text":"

        RGrid.cxx

        // This example shows how to create a rectilinear grid.\n//\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRectilinearGridGeometryFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  int i;\n  static double x[47] = {\n      -1.22396,  -1.17188,  -1.11979,  -1.06771,  -1.01562,  -0.963542,\n      -0.911458, -0.859375, -0.807292, -0.755208, -0.703125, -0.651042,\n      -0.598958, -0.546875, -0.494792, -0.442708, -0.390625, -0.338542,\n      -0.286458, -0.234375, -0.182292, -0.130209, -0.078125, -0.026042,\n      0.0260415, 0.078125,  0.130208,  0.182291,  0.234375,  0.286458,\n      0.338542,  0.390625,  0.442708,  0.494792,  0.546875,  0.598958,\n      0.651042,  0.703125,  0.755208,  0.807292,  0.859375,  0.911458,\n      0.963542,  1.01562,   1.06771,   1.11979,   1.17188};\n  static double y[33] = {-1.25,     -1.17188,  -1.09375,  -1.01562,  -0.9375,\n                         -0.859375, -0.78125,  -0.703125, -0.625,    -0.546875,\n                         -0.46875,  -0.390625, -0.3125,   -0.234375, -0.15625,\n                         -0.078125, 0,         0.078125,  0.15625,   0.234375,\n                         0.3125,    0.390625,  0.46875,   0.546875,  0.625,\n                         0.703125,  0.78125,   0.859375,  0.9375,    1.01562,\n                         1.09375,   1.17188,   1.25};\n  static double z[44] = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.9,\n                         1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.75, 1.8, 1.9,\n                         2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.75, 2.8, 2.9,\n                         3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.75, 3.8, 3.9};\n\n  // Create a rectilinear grid by defining three arrays specifying the\n  // coordinates in the x-y-z directions.\n  vtkNew<vtkDoubleArray> xCoords;\n  for (i = 0; i < 47; i++)\n  {\n    xCoords->InsertNextValue(x[i]);\n  }\n  vtkNew<vtkDoubleArray> yCoords;\n  for (i = 0; i < 33; i++)\n  {\n    yCoords->InsertNextValue(y[i]);\n  }\n  vtkNew<vtkDoubleArray> zCoords;\n  for (i = 0; i < 44; i++)\n  {\n    zCoords->InsertNextValue(z[i]);\n  }\n  // The coordinates are assigned to the rectilinear grid. Make sure that\n  // the number of values in each of the XCoordinates, YCoordinates,\n  // and ZCoordinates is equal to what is defined in SetDimensions().\n  //\n  vtkNew<vtkRectilinearGrid> rgrid;\n  rgrid->SetDimensions(47, 33, 44);\n  rgrid->SetXCoordinates(xCoords);\n  rgrid->SetYCoordinates(yCoords);\n  rgrid->SetZCoordinates(zCoords);\n\n  // Extract a plane from the grid to see what we've got.\n  vtkNew<vtkRectilinearGridGeometryFilter> plane;\n  plane->SetInputData(rgrid);\n  plane->SetExtent(0, 46, 16, 16, 0, 43);\n\n  vtkNew<vtkPolyDataMapper> rgridMapper;\n  rgridMapper->SetInputConnection(plane->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> wireActor;\n  wireActor->SetMapper(rgridMapper);\n  wireActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  wireActor->GetProperty()->EdgeVisibilityOn();\n\n  // Create the usual rendering stuff.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"RGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(wireActor);\n  renderer->SetBackground(colors->GetColor3d(\"Beige\").GetData());\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Zoom(1.0);\n  renderer->ResetCamera();\n\n  renWin->SetSize(640, 480);\n\n  // interact with data\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/RectilinearGrid/RGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RGrid MACOSX_BUNDLE RGrid.cxx )\n  target_link_libraries(RGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/RectilinearGrid/RGrid/#download-and-build-rgrid","title":"Download and Build RGrid","text":"

        Click here to download RGrid and its CMakeLists.txt file. Once the tarball RGrid.tar has been downloaded and extracted,

        cd RGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/RectilinearGrid/RectilinearGrid/","title":"RectilinearGrid","text":"

        vtk-examples/Cxx/RectilinearGrid/RectilinearGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/RectilinearGrid/RectilinearGrid/#description","title":"Description","text":"

        Shows how to create a vtkRectilinearGrid.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/RectilinearGrid/RectilinearGrid/#code","title":"Code","text":"

        RectilinearGrid.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid\n  vtkNew<vtkRectilinearGrid> grid;\n\n  grid->SetDimensions(2, 3, 1);\n\n  vtkNew<vtkDoubleArray> xArray;\n  xArray->InsertNextValue(0.0);\n  xArray->InsertNextValue(2.0);\n\n  vtkNew<vtkDoubleArray> yArray;\n  yArray->InsertNextValue(0.0);\n  yArray->InsertNextValue(1.0);\n  yArray->InsertNextValue(2.0);\n\n  vtkNew<vtkDoubleArray> zArray;\n  zArray->InsertNextValue(0.0);\n\n  grid->SetXCoordinates(xArray);\n  grid->SetYCoordinates(yArray);\n  grid->SetZCoordinates(zArray);\n\n  std::cout << \"There are \" << grid->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << grid->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n\n  for (vtkIdType id = 0; id < grid->GetNumberOfPoints(); id++)\n  {\n    double p[3];\n    grid->GetPoint(id, p);\n    std::cout << \"Point \" << id << \" : (\" << p[0] << \" , \" << p[1] << \" , \"\n              << p[2] << \")\" << std::endl;\n  }\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(grid);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RectilinearGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/RectilinearGrid/RectilinearGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RectilinearGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RectilinearGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RectilinearGrid MACOSX_BUNDLE RectilinearGrid.cxx )\n  target_link_libraries(RectilinearGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RectilinearGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/RectilinearGrid/RectilinearGrid/#download-and-build-rectilineargrid","title":"Download and Build RectilinearGrid","text":"

        Click here to download RectilinearGrid and its CMakeLists.txt file. Once the tarball RectilinearGrid.tar has been downloaded and extracted,

        cd RectilinearGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RectilinearGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/RectilinearGrid/RectilinearGridToTetrahedra/","title":"RectilinearGridToTetrahedra","text":"

        vtk-examples/Cxx/RectilinearGrid/RectilinearGridToTetrahedra

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/RectilinearGrid/RectilinearGridToTetrahedra/#code","title":"Code","text":"

        RectilinearGridToTetrahedra.cxx

        #include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRectilinearGridToTetrahedra.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  // Create a grid.\n  vtkNew<vtkRectilinearGrid> grid;\n\n  grid->SetDimensions(5, 4, 3);\n\n  vtkNew<vtkDoubleArray> xArray;\n  xArray->InsertNextValue(0.0);\n  xArray->InsertNextValue(1.0);\n  xArray->InsertNextValue(2.0);\n  xArray->InsertNextValue(3.0);\n  xArray->InsertNextValue(4.0);\n\n  vtkNew<vtkDoubleArray> yArray;\n  yArray->InsertNextValue(0.0);\n  yArray->InsertNextValue(1.0);\n  yArray->InsertNextValue(2.0);\n  yArray->InsertNextValue(3.0);\n\n  vtkNew<vtkDoubleArray> zArray;\n  zArray->InsertNextValue(0.0);\n  zArray->InsertNextValue(1.0);\n  zArray->InsertNextValue(2.0);\n\n  grid->SetXCoordinates(xArray);\n  grid->SetYCoordinates(yArray);\n  grid->SetZCoordinates(zArray);\n\n  vtkNew<vtkRectilinearGridToTetrahedra> rectilinearGridToTetrahedra;\n  rectilinearGridToTetrahedra->SetInputData(grid);\n  rectilinearGridToTetrahedra->Update();\n\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetFileName(\"output.vtu\");\n  writer->SetInputConnection(rectilinearGridToTetrahedra->GetOutputPort());\n  writer->Write();\n\n  std::cout << \"There are \"\n            << rectilinearGridToTetrahedra->GetOutput()->GetNumberOfCells()\n            << \" cells.\" << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/RectilinearGrid/RectilinearGridToTetrahedra/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RectilinearGridToTetrahedra)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RectilinearGridToTetrahedra: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RectilinearGridToTetrahedra MACOSX_BUNDLE RectilinearGridToTetrahedra.cxx )\n  target_link_libraries(RectilinearGridToTetrahedra PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RectilinearGridToTetrahedra\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/RectilinearGrid/RectilinearGridToTetrahedra/#download-and-build-rectilineargridtotetrahedra","title":"Download and Build RectilinearGridToTetrahedra","text":"

        Click here to download RectilinearGridToTetrahedra and its CMakeLists.txt file. Once the tarball RectilinearGridToTetrahedra.tar has been downloaded and extracted,

        cd RectilinearGridToTetrahedra/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RectilinearGridToTetrahedra\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/RectilinearGrid/VisualizeRectilinearGrid/","title":"VisualizeRectilinearGrid","text":"

        vtk-examples/Cxx/RectilinearGrid/VisualizeRectilinearGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/RectilinearGrid/VisualizeRectilinearGrid/#code","title":"Code","text":"

        VisualizeRectilinearGrid.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid.\n  vtkNew<vtkRectilinearGrid> grid;\n\n  grid->SetDimensions(2, 3, 2);\n\n  vtkNew<vtkDoubleArray> xArray;\n  xArray->InsertNextValue(0.0);\n  xArray->InsertNextValue(2.0);\n\n  vtkNew<vtkDoubleArray> yArray;\n  yArray->InsertNextValue(0.0);\n  yArray->InsertNextValue(1.0);\n  yArray->InsertNextValue(2.0);\n\n  vtkNew<vtkDoubleArray> zArray;\n  zArray->InsertNextValue(0.0);\n  zArray->InsertNextValue(5.0);\n\n  grid->SetXCoordinates(xArray);\n  grid->SetYCoordinates(yArray);\n  grid->SetZCoordinates(zArray);\n\n  vtkNew<vtkShrinkFilter> shrinkFilter;\n  shrinkFilter->SetInputData(grid);\n  shrinkFilter->SetShrinkFactor(.8);\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrinkFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VisualizeRectilinearGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->GetActiveCamera()->Roll(10.0);\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/RectilinearGrid/VisualizeRectilinearGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeRectilinearGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeRectilinearGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeRectilinearGrid MACOSX_BUNDLE VisualizeRectilinearGrid.cxx )\n  target_link_libraries(VisualizeRectilinearGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeRectilinearGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/RectilinearGrid/VisualizeRectilinearGrid/#download-and-build-visualizerectilineargrid","title":"Download and Build VisualizeRectilinearGrid","text":"

        Click here to download VisualizeRectilinearGrid and its CMakeLists.txt file. Once the tarball VisualizeRectilinearGrid.tar has been downloaded and extracted,

        cd VisualizeRectilinearGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VisualizeRectilinearGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/RenderMan/PolyDataRIB/","title":"PolyDataRIB","text":"

        vtk-examples/Cxx/RenderMan/PolyDataRIB

        "},{"location":"Cxx/RenderMan/PolyDataRIB/#description","title":"Description","text":"

        To see the RenderMan results for this example, download and install the non-commercial version of RenderMan.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/RenderMan/PolyDataRIB/#code","title":"Code","text":"

        PolyDataRIB.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRIBExporter.h>\n#include <vtkRIBProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n// static vtkSmartPointer<vtkRIBProperty> spatter(const char *sizes,\n//                                                const char *specksize,\n//                                                const char *spattercolor,\n//                                                const char *basecolor);\nnamespace {\nvtkSmartPointer<vtkRIBProperty> rmarble(const char* veining);\n}\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse command line arguments\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtp) [freqency]\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  const char* freq = \"1\";\n  if (argc > 2)\n  {\n    freq = argv[2];\n  }\n\n  std::string filename = argv[1];\n  std::string prefix =\n      vtksys::SystemTools::GetFilenameWithoutExtension(filename);\n\n  // Read all the data from the file\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(reader->GetOutputPort());\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  auto marble = rmarble(freq);\n  actor->SetProperty(marble);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"NavajoWhite\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PolyDataRIB\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  // Generate an interesting view\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  prefix = prefix + \"_\" + freq;\n  vtkNew<vtkRIBExporter> aRib;\n  aRib->BackgroundOn();\n  aRib->SetInput(renderWindow);\n  aRib->SetFilePrefix(prefix.c_str());\n  aRib->Write();\n  std::cout << \"Exported RIB file is: \" << prefix << \".rib\" << std::endl;\n  if (getenv(\"RMANTREE\") == NULL)\n  {\n    std::cout << \"To render the generated rib file, set the environment \"\n                 \"variable RMANTREE to the base of your RenderMan install\"\n              << std::endl;\n  }\n  else\n  {\n    std::string rmantree = getenv(\"RMANTREE\");\n    std::cout << \"To create a tif file run: \" << std::endl;\n    std::cout << rmantree << \"bin/prman \" << prefix << \".rib \" << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n\n// vtkSmartPointer<vtkRIBProperty> spatter(const char *sizes,\n//                                         const char *specksize,\n//                                         const char *spattercolor,\n//                                         const char *basecolor)\n// {\n//   vtkNew<vtkRIBProperty> spatterProp;\n//   spatterProp->SetVariable(\"sizes\", \"float\");\n//   spatterProp->AddVariable(\"specksize\", \"float\");\n//   spatterProp->AddVariable(\"spattercolor\", \"color\");\n//   spatterProp->AddVariable(\"basecolor\", \"color\");\n\n//   spatterProp->SetSurfaceShaderParameter(\"sizes\", sizes);\n//   spatterProp->AddSurfaceShaderParameter(\"specksize\", specksize);\n//   spatterProp->AddSurfaceShaderParameter(\"spattercolor\", spattercolor);\n//   spatterProp->AddSurfaceShaderParameter(\"basecolor\", basecolor);\n//   spatterProp->SetSurfaceShader(\"spatter\");\n\n//   return spatterProp;\n// }\n\nnamespace {\nvtkSmartPointer<vtkRIBProperty> rmarble(const char* veining)\n{\n  vtkNew<vtkRIBProperty> rmarbleProp;\n  rmarbleProp->SetVariable(\"veining\", \"float\");\n  rmarbleProp->SetSurfaceShaderParameter(\"veining\", veining);\n  rmarbleProp->SetSurfaceShader(\"rmarble\");\n\n  return rmarbleProp;\n}\n} // namespace\n
        "},{"location":"Cxx/RenderMan/PolyDataRIB/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PolyDataRIB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOExport\n  IOExportOpenGL2\n  IOExportPDF\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PolyDataRIB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PolyDataRIB MACOSX_BUNDLE PolyDataRIB.cxx )\n  target_link_libraries(PolyDataRIB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PolyDataRIB\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/RenderMan/PolyDataRIB/#download-and-build-polydatarib","title":"Download and Build PolyDataRIB","text":"

        Click here to download PolyDataRIB and its CMakeLists.txt file. Once the tarball PolyDataRIB.tar has been downloaded and extracted,

        cd PolyDataRIB/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PolyDataRIB\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/AmbientSpheres/","title":"AmbientSpheres","text":"

        vtk-examples/Cxx/Rendering/AmbientSpheres

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/AmbientSpheres/#description","title":"Description","text":"

        Note

        This original source code for this example is here.

        Info

        Similar examples setting the diffuse and specular properties are: See DiffuseSpheres.cxx, DiffuseSpheres.py and SpecularSpheres.cxx, SpecularSpheres.py.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/AmbientSpheres/#code","title":"Code","text":"

        AmbientSpheres.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"bkg\", bkg.data());\n\n  // The following lines create a sphere represented by polygons.\n  //\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(50);\n\n  // The mapper is responsible for pushing the geometry into the graphics\n  // library. It may also do color mapping, if scalars or other attributes\n  // are defined.\n  //\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  // The actor is a grouping mechanism: besides the geometry (mapper), it\n  // also has a property, transformation matrix, and/or texture map.\n  // In this example we create eight different spheres (two rows of four\n  // spheres) and set the ambient lighting coefficients. A little ambient\n  // is turned on so the sphere is not completely black on the back side.\n  //\n  // Since we are using the same sphere source and mapper for all eight spheres\n  // we will use a std::array holding the actors.\n  //\n  // If you want/need to use std::vector, then you must use\n  // std::vector<vtkSmartPointer<vtkActor>> spheres;\n  // and then, in a loop, create the object using\n  // spheres.push_back(vtkSmartPointer<vtkActor>::New());\n  //\n  // The reason:\n  // vtkNew, in contrast to vtkSmartPointer, has no assignment operator\n  // or copy constructor and owns one object for its whole lifetime.\n  // Thus vtkNew does not satisfy the CopyAssignable and CopyConstructible\n  // requirements needed for other std containers like std::vector or std::list.\n  // std::array, on the other hand, is a container encapsulating fixed size\n  // arrays so its elements do not need to be CopyAssignable and\n  // CopyConstructible.\n  //\n  // So:\n  //    std::array - vtkNew or vtkSmartPointer can be used.\n  //    std::vector, std::list - only vtkSmartPointer can be used.\n  //\n  auto const numberOfSpheres = 8;\n  std::array<vtkNew<vtkActor>, numberOfSpheres> spheres;\n  auto ambient = 0.125;\n  auto diffuse = 0.0;\n  auto specular = 0.0;\n  std::array<double, 3> position{{0, 0, 0}};\n  for (auto i = 0; i < spheres.size(); ++i)\n  {\n    spheres[i]->SetMapper(sphereMapper);\n    spheres[i]->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n    spheres[i]->GetProperty()->SetAmbient(ambient);\n    spheres[i]->GetProperty()->SetDiffuse(diffuse);\n    spheres[i]->GetProperty()->SetSpecular(specular);\n    spheres[i]->AddPosition(position.data());\n    ambient += 0.125;\n    position[0] += 1.25;\n    if (i == 3)\n    {\n      position[0] = 0;\n      position[1] = 1.25;\n    }\n  }\n\n  // Create the graphics structure. The renderer renders into the\n  // render window. The render window interactor captures mouse events\n  // and will perform appropriate camera or actor manipulation\n  // depending on the nature of the events.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  for (auto i = 0; i < numberOfSpheres; ++i)\n  {\n    ren->AddActor(spheres[i]);\n  }\n\n  ren->SetBackground(colors->GetColor3d(\"bkg\").GetData());\n  renWin->SetSize(640, 480);\n  std::cout << \"DPI: \" << renWin->GetDPI() << std::endl;\n  renWin->SetWindowName(\"AmbientSpheres\");\n\n  // Set up the lighting.\n  //\n  vtkNew<vtkLight> light;\n  light->SetFocalPoint(1.875, 0.6125, 0);\n  light->SetPosition(0.875, 1.6125, 1);\n  ren->AddLight(light);\n\n  // We want to eliminate perspective effects on the apparent lighting.\n  // Parallel camera projection will be used. To zoom in parallel projection\n  // mode, the ParallelScale is set.\n  //\n  ren->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  ren->GetActiveCamera()->SetPosition(0, 0, 1);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->GetActiveCamera()->ParallelProjectionOn();\n  ren->ResetCamera();\n  ren->GetActiveCamera()->SetParallelScale(2.0);\n  // This starts the event loop and invokes an initial render.\n  //\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/AmbientSpheres/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AmbientSpheres)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AmbientSpheres: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AmbientSpheres MACOSX_BUNDLE AmbientSpheres.cxx )\n  target_link_libraries(AmbientSpheres PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AmbientSpheres\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/AmbientSpheres/#download-and-build-ambientspheres","title":"Download and Build AmbientSpheres","text":"

        Click here to download AmbientSpheres and its CMakeLists.txt file. Once the tarball AmbientSpheres.tar has been downloaded and extracted,

        cd AmbientSpheres/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AmbientSpheres\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/CameraBlur/","title":"CameraBlur","text":"

        vtk-examples/Cxx/Rendering/CameraBlur

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/CameraBlur/#description","title":"Description","text":"

        Example of motion blur.

        Info

        See Figure 7-37 in Chapter 7 in the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/CameraBlur/#code","title":"Code","text":"

        CameraBlur.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"Bkg\", bkg.data());\n\n  // Create the rendering objects.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the pipeline, ball and spikes.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(7);\n  sphere->SetThetaResolution(7);\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  vtkNew<vtkActor> sphereActor2;\n  sphereActor2->SetMapper(sphereMapper);\n\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(5);\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(sphere->GetOutputPort());\n  glyph->SetSourceConnection(cone->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->SetScaleFactor(0.25);\n  vtkNew<vtkPolyDataMapper> spikeMapper;\n  spikeMapper->SetInputConnection(glyph->GetOutputPort());\n  vtkNew<vtkActor> spikeActor;\n  spikeActor->SetMapper(spikeMapper);\n  vtkNew<vtkActor> spikeActor2;\n  spikeActor2->SetMapper(spikeMapper);\n\n  spikeActor->SetPosition(0, 0.7, 0);\n  sphereActor->SetPosition(0, 0.7, 0);\n  spikeActor2->SetPosition(0, -1.0, -10);\n  sphereActor2->SetPosition(0, -1.0, -10);\n  spikeActor2->SetScale(1.5, 1.5, 1.5);\n  sphereActor2->SetScale(1.5, 1.5, 1.5);\n\n  ren1->AddActor(sphereActor);\n  ren1->AddActor(spikeActor);\n  ren1->AddActor(sphereActor2);\n  ren1->AddActor(spikeActor2);\n  ren1->SetBackground(colors->GetColor3d(\"Bkg\").GetData());\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"CameraBlur\");\n  //   renWin->DoubleBufferOff();\n\n  // Do the first render and then zoom in a little.\n  renWin->Render();\n  ren1->GetActiveCamera()->SetFocalPoint(0, 0, 0.0);\n  ren1->GetActiveCamera()->Zoom(1.8);\n  ren1->GetActiveCamera()->SetFocalDisk(0.05);\n\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/CameraBlur/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraBlur)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraBlur: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraBlur MACOSX_BUNDLE CameraBlur.cxx )\n  target_link_libraries(CameraBlur PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraBlur\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/CameraBlur/#download-and-build-camerablur","title":"Download and Build CameraBlur","text":"

        Click here to download CameraBlur and its CMakeLists.txt file. Once the tarball CameraBlur.tar has been downloaded and extracted,

        cd CameraBlur/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CameraBlur\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/ColoredSphere/","title":"ColoredSphere","text":"

        vtk-examples/Cxx/Rendering/ColoredSphere

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/ColoredSphere/#description","title":"Description","text":"

        This demonstrates a simple visualization pipeline. A polygonal representation of a sphere is created with the source object (vtkSphereSource). The sphere is passed through a filter (vtkElevationFilter) that computes the height of each point of the sphere above a plane. The plane is perpendicular to the z-axis, and passes through the point (0,0,-1). The data is finally mapped (vtkDataSetMapper) through a lookup table. The mapping process converts height value into colors, and interfaces the sphere geometry to the rendering library. The mapper is assigned to an actor, and then the actor is displayed.

        The execution of the pipeline occurs implicitly when we render the actor. Each actor asks its mapper to update itself. The mapper in turn asks its input to update itself. This process continues until a source object is encountered. Then the source will execute if modified since the last render.

        Info

        See Figure 4-19 in Chapter 4 the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/ColoredSphere/#code","title":"Code","text":"

        ColoredSphere.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkElevationFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(12);\n  sphere->SetThetaResolution(12);\n\n  vtkNew<vtkElevationFilter> colorIt;\n  colorIt->SetInputConnection(sphere->GetOutputPort());\n  colorIt->SetLowPoint(0, 0, -1);\n  colorIt->SetHighPoint(0, 0, 1);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(colorIt->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ColoredSphere\");\n\n  renWin->Render();\n\n  // interact with data\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/ColoredSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColoredSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColoredSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColoredSphere MACOSX_BUNDLE ColoredSphere.cxx )\n  target_link_libraries(ColoredSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColoredSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/ColoredSphere/#download-and-build-coloredsphere","title":"Download and Build ColoredSphere","text":"

        Click here to download ColoredSphere and its CMakeLists.txt file. Once the tarball ColoredSphere.tar has been downloaded and extracted,

        cd ColoredSphere/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColoredSphere\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/Cone3/","title":"Cone3","text":"

        vtk-examples/Cxx/Rendering/Cone3

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/Cone3/#description","title":"Description","text":"

        Info

        See Figure 3-27 in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/Cone3/#code","title":"Code","text":"

        Cone3.cxx

        //\n// This example demonstrates how to use multiple renderers within a\n// render window. It is a variation of the Cone.cxx example. Please\n// refer to that example for additional documentation.\n//\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the cone. The actor orchestrates rendering\n  // of the mapper's graphics primitives. An actor also refers to properties\n  // via a vtkProperty instance, and includes an internal transformation\n  // matrix. We set this actor's mapper to be coneMapper which we created\n  // above.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n\n  //\n  // Create two renderers and assign actors to them. A renderer renders into\n  // a viewport within the vtkRenderWindow. It is part or all of a window on\n  // the screen and it is responsible for drawing the actors it has.  We also\n  // set the background color here. In this example we are adding the same\n  // actor to two different renderers; it is okay to add different actors to\n  // different renderers as well.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->SetViewport(0.0, 0.0, 0.5, 1.0);\n\n  vtkNew<vtkRenderer> ren2;\n  ren2->AddActor(coneActor);\n  ren2->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n  ren2->SetViewport(0.5, 0.0, 1.0, 1.0);\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->AddRenderer(ren2);\n  renWin->SetSize(600, 300);\n  renWin->SetWindowName(\"Cone3\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  //\n  // Make one view 90 degrees from other.\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(90);\n\n  //\n  // Now we loop over 60 degrees and render the cone each time.\n  //\n  for (int i = 0; i < 60; ++i)\n  {\n    // render the image\n    renWin->Render();\n    // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth(1);\n    ren2->GetActiveCamera()->Azimuth(1);\n  }\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/Cone3/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cone3)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cone3: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cone3 MACOSX_BUNDLE Cone3.cxx )\n  target_link_libraries(Cone3 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cone3\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/Cone3/#download-and-build-cone3","title":"Download and Build Cone3","text":"

        Click here to download Cone3 and its CMakeLists.txt file. Once the tarball Cone3.tar has been downloaded and extracted,

        cd Cone3/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cone3\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/Cone4/","title":"Cone4","text":"

        vtk-examples/Cxx/Rendering/Cone4

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/Cone4/#description","title":"Description","text":"

        This example modifies vtkActor's properties and transformation matrix.

        Info

        See Figure 3-28 in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/Cone4/#code","title":"Code","text":"

        Cone4.cxx

        //\n// This example demonstrates the creation of multiple actors and the\n// manipulation of their properties and transformations. It is a\n// derivative of Cone.tcl, see that example for more information.\n//\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Next we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the first cone. The actor's properties are\n  // modified to give it different surface properties. By default, an actor\n  // is create with a property so the GetProperty() method can be used.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  coneActor->GetProperty()->SetDiffuse(0.7);\n  coneActor->GetProperty()->SetSpecular(0.4);\n  coneActor->GetProperty()->SetSpecularPower(20);\n\n  //\n  // Create a property and directly manipulate it. Assign it to the\n  // second actor.\n  //\n  vtkNew<vtkProperty> property;\n  property->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  property->SetDiffuse(0.7);\n  property->SetSpecular(0.4);\n  property->SetSpecularPower(20);\n\n  //\n  // Create a second actor and a property. The property is directly\n  // manipulated and then assigned to the actor. In this way, a single\n  // property can be shared among many actors. Note also that we use the\n  // same mapper as the first actor did. This way we avoid duplicating\n  // geometry, which may save lots of memory if the geoemtry is large.\n  vtkNew<vtkActor> coneActor2;\n  coneActor2->SetMapper(coneMapper);\n  coneActor2->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  coneActor2->SetProperty(property);\n  coneActor2->SetPosition(0, 2, 0);\n\n  //\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the background\n  // color here.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->AddActor(coneActor2);\n  ren1->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"Cone4\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  //\n  // Now we loop over 60 degrees and render the cone each time.\n  //\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->ResetCamera();\n  for (int i = 0; i < 60; ++i)\n  {\n    // render the image\n    renWin->Render();\n    // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth(1);\n  }\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/Cone4/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cone4)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cone4: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cone4 MACOSX_BUNDLE Cone4.cxx )\n  target_link_libraries(Cone4 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cone4\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/Cone4/#download-and-build-cone4","title":"Download and Build Cone4","text":"

        Click here to download Cone4 and its CMakeLists.txt file. Once the tarball Cone4.tar has been downloaded and extracted,

        cd Cone4/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cone4\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/DiffuseSpheres/","title":"DiffuseSpheres","text":"

        vtk-examples/Cxx/Rendering/DiffuseSpheres

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/DiffuseSpheres/#description","title":"Description","text":"

        Note

        This original source code for this example is here.

        Info

        Similar examples setting the ambient and specular properties are: See AmbientSpheres.cxx, AmbientSpheres.py, AmbientSpheres.java and SpecularSpheres.cxx, SpecularSpheres.py.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/DiffuseSpheres/#code","title":"Code","text":"

        DiffuseSpheres.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"bkg\", bkg.data());\n\n  // The following lines create a sphere represented by polygons.\n  //\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(50);\n\n  // The mapper is responsible for pushing the geometry into the graphics\n  // library. It may also do color mapping, if scalars or other attributes\n  // are defined.\n  //\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  // The actor is a grouping mechanism: besides the geometry (mapper), it\n  // also has a property, transformation matrix, and/or texture map.\n  // In this example we create eight different spheres (two rows of four\n  // spheres) and set the diffuse lighting coefficients. A little ambient\n  // is turned on so the sphere is not completely black on the back side.\n  //\n  // Since we are using the same sphere source and mapper for all eight spheres\n  // we will use a std::array holding the actors.\n  //\n  // If you want/need to use std::vector, then you must use\n  // std::vector<vtkSmartPointer<vtkActor>> spheres;\n  // and then, in a loop, create the object using\n  // spheres.push_back(vtkSmartPointer<vtkActor>::New());\n  //\n  // The reason:\n  // vtkNew, in contrast to vtkSmartPointer, has no assignment operator\n  // or copy constructor and owns one object for its whole lifetime.\n  // Thus vtkNew does not satisfy the CopyAssignable and CopyConstructible\n  // requirements needed for other std containers like std::vector or std::list.\n  // std::array, on the other hand, is a container encapsulating fixed size\n  // arrays so its elements do not need to be CopyAssignable and\n  // CopyConstructible.\n  //\n  // So:\n  //    std::array - vtkNew or vtkSmartPointer can be used.\n  //    std::vector, std::list - only vtkSmartPointer can be used.\n  //\n  auto const numberOfSpheres = 8;\n  std::array<vtkNew<vtkActor>, numberOfSpheres> spheres;\n  auto ambient = 0.3;\n  auto diffuse = 0.0;\n  auto specular = 0.0;\n  std::array<double, 3> position{{0, 0, 0}};\n  for (auto i = 0; i < spheres.size(); ++i)\n  {\n    spheres[i]->SetMapper(sphereMapper);\n    spheres[i]->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n    spheres[i]->GetProperty()->SetAmbient(ambient);\n    spheres[i]->GetProperty()->SetDiffuse(diffuse);\n    spheres[i]->GetProperty()->SetSpecular(specular);\n    spheres[i]->AddPosition(position.data());\n    std::cout << diffuse << std::endl;\n    diffuse += 0.125;\n    position[0] += 1.25;\n    if (i == 3)\n    {\n      position[0] = 0;\n      position[1] = 1.25;\n    }\n  }\n\n  // Create the graphics structure. The renderer renders into the\n  // render window. The render window interactor captures mouse events\n  // and will perform appropriate camera or actor manipulation\n  // depending on the nature of the events.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  for (auto i = 0; i < numberOfSpheres; ++i)\n  {\n    ren->AddActor(spheres[i]);\n  }\n\n  ren->SetBackground(colors->GetColor3d(\"bkg\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"DiffuseSpheres\");\n\n  // Set up the lighting.\n  //\n  vtkNew<vtkLight> light;\n  light->SetFocalPoint(1.875, 0.6125, 0);\n  light->SetPosition(0.875, 1.6125, 1);\n  ren->AddLight(light);\n\n  // We want to eliminate perspective effects on the apparent lighting.\n  // Parallel camera projection will be used. To zoom in parallel projection\n  // mode, the ParallelScale is set.\n  //\n  ren->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  ren->GetActiveCamera()->SetPosition(0, 0, 1);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->GetActiveCamera()->ParallelProjectionOn();\n  ren->ResetCamera();\n  ren->GetActiveCamera()->SetParallelScale(2.0);\n  // This starts the event loop and invokes an initial render.\n  //\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/DiffuseSpheres/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DiffuseSpheres)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DiffuseSpheres: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DiffuseSpheres MACOSX_BUNDLE DiffuseSpheres.cxx )\n  target_link_libraries(DiffuseSpheres PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DiffuseSpheres\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/DiffuseSpheres/#download-and-build-diffusespheres","title":"Download and Build DiffuseSpheres","text":"

        Click here to download DiffuseSpheres and its CMakeLists.txt file. Once the tarball DiffuseSpheres.tar has been downloaded and extracted,

        cd DiffuseSpheres/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DiffuseSpheres\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/FlatVersusGouraud/","title":"FlatVersusGouraud","text":"

        vtk-examples/Cxx/Rendering/FlatVersusGouraud

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/FlatVersusGouraud/#description","title":"Description","text":"

        Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look.

        In this example, the flat and gouraud images for each pair have linked cameras. Rotate and zoom a pair to get a better look at the differences.

        Info

        See Figure 3-7 in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/FlatVersusGouraud/#code","title":"Code","text":"

        FlatVersusGouraud.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid CreateSphere(vtkRenderer*, bool);\nvoid CreateCylinder(vtkRenderer*, bool);\nvoid CreateIsoSurface(vtkRenderer*, bool);\nvoid CreateModel(vtkRenderer*, bool, char*);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename\" << std::endl;\n    std::cout << \"where: filename is the file cow.obj\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  // Create the 8 renderers\n  vtkNew<vtkRenderer> flatSphereRenderer;\n  renderers.push_back(flatSphereRenderer);\n  vtkNew<vtkRenderer> flatCylinderRenderer;\n  renderers.push_back(flatCylinderRenderer);\n  vtkNew<vtkRenderer> flatIsoSurfaceRenderer;\n  renderers.push_back(flatIsoSurfaceRenderer);\n  vtkNew<vtkRenderer> flatModelRenderer;\n  renderers.push_back(flatModelRenderer);\n  vtkNew<vtkRenderer> smoothSphereRenderer;\n  renderers.push_back(smoothSphereRenderer);\n  vtkNew<vtkRenderer> smoothCylinderRenderer;\n  renderers.push_back(smoothCylinderRenderer);\n  vtkNew<vtkRenderer> smoothIsoSurfaceRenderer;\n  renderers.push_back(smoothIsoSurfaceRenderer);\n  vtkNew<vtkRenderer> smoothModelRenderer;\n  renderers.push_back(smoothModelRenderer);\n\n  // Add the actors\n  CreateSphere(flatSphereRenderer, true);\n  CreateCylinder(flatCylinderRenderer, true);\n  CreateIsoSurface(flatIsoSurfaceRenderer, true);\n  CreateModel(flatModelRenderer, true, argv[1]);\n\n  CreateSphere(smoothSphereRenderer, false);\n  CreateCylinder(smoothCylinderRenderer, false);\n  CreateIsoSurface(smoothIsoSurfaceRenderer, false);\n  CreateModel(smoothModelRenderer, false, argv[1]);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"FlatVersusGouraud\");\n\n  // Setup viewports for the renderers\n  int rendererSize = 256;\n  unsigned int xGridDimensions = 4;\n  unsigned int yGridDimensions = 2;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  for (size_t r = 0; r < renderers.size(); ++r)\n  {\n    renderers[r]->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    renderers[r]->GetActiveCamera()->Azimuth(20);\n    renderers[r]->GetActiveCamera()->Elevation(30);\n    renderers[r]->ResetCamera();\n    if (r > 3)\n    {\n      renderers[r]->SetActiveCamera(renderers[r - 4]->GetActiveCamera());\n    }\n    renderWindow->AddRenderer(renderers[r]);\n  }\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateSphere(vtkRenderer* renderer, bool flat)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkSphereSource> sphere;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n  if (flat)\n  {\n    actor->GetProperty()->SetInterpolationToFlat();\n  }\n  else\n  {\n    actor->GetProperty()->SetInterpolationToGouraud();\n  }\n  renderer->AddActor(actor);\n}\n\nvoid CreateCylinder(vtkRenderer* renderer, bool flat)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkCylinderSource> cylinder;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cylinder->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n  if (flat)\n  {\n    actor->GetProperty()->SetInterpolationToFlat();\n  }\n  else\n  {\n    actor->GetProperty()->SetInterpolationToGouraud();\n  }\n  renderer->AddActor(actor);\n}\n\nvoid CreateIsoSurface(vtkRenderer* renderer, bool flat)\n{\n  double range[2];\n  // Sample quadric function\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 2, 3, 0, 1, 0, 0, 0, 0, 0);\n\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(25, 25, 25);\n  sample->SetImplicitFunction(quadric);\n\n  // Generate implicit surface\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(sample->GetOutputPort());\n  range[0] = 1.0;\n  range[1] = 6.0;\n  contour->GenerateValues(5, range);\n\n  // Map contour\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contour->GetOutputPort());\n  contourMapper->SetScalarRange(0, 7);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(contourMapper);\n  if (flat)\n  {\n    actor->GetProperty()->SetInterpolationToFlat();\n  }\n  else\n  {\n    actor->GetProperty()->SetInterpolationToGouraud();\n  }\n  renderer->AddActor(actor);\n  return;\n}\n\nvoid CreateModel(vtkRenderer* renderer, bool flat, char* fileName)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkOBJReader> reader;\n  reader->SetFileName(fileName);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tan\").GetData());\n  if (flat)\n  {\n    actor->GetProperty()->SetInterpolationToFlat();\n  }\n  else\n  {\n    actor->GetProperty()->SetInterpolationToGouraud();\n  }\n  renderer->AddActor(actor);\n}\n} // namespace\n
        "},{"location":"Cxx/Rendering/FlatVersusGouraud/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FlatVersusGouraud)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FlatVersusGouraud: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FlatVersusGouraud MACOSX_BUNDLE FlatVersusGouraud.cxx )\n  target_link_libraries(FlatVersusGouraud PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FlatVersusGouraud\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/FlatVersusGouraud/#download-and-build-flatversusgouraud","title":"Download and Build FlatVersusGouraud","text":"

        Click here to download FlatVersusGouraud and its CMakeLists.txt file. Once the tarball FlatVersusGouraud.tar has been downloaded and extracted,

        cd FlatVersusGouraud/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FlatVersusGouraud\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/GradientBackground/","title":"GradientBackground","text":"

        vtk-examples/Cxx/Rendering/GradientBackground

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/GradientBackground/#description","title":"Description","text":"

        Demonstrates the gradient backgrounds available in VTK.

        The gradient background modes are:

        • Vertical
        • Horizontal
        • Radial Farthest Side
        • Radial Farthest Corner

        The user can also edit the code to change the stop colors marking the beginning and end points in a gradient.

        An option is provided for the user to read in a data file so that more interesting objects can be viewed.

        The viewport border can also be set and colored.

        For more information, see New in VTK 9.3: Radial Gradient Background

        !!! note VTK 9.3 or later is required.

        !!! note The C++ version requires C++ 17 or later as std::filesystem is used.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/GradientBackground/#code","title":"Code","text":"

        GradientBackground.cxx

        // Based on:\n//  https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/Core/Testing/Cxx/TestGradientBackground.cxx?ref_type=heads\n// See:\n//  [New in VTK 9.3: Radial Gradient\n//  Background](https://www.kitware.com/new-in-vtk-9-3-radial-gradient-background/)\n\n#include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkColor.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkViewport.h>\n#include <vtk_cli11.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyDataMapper2D.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty2D.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <string>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\n/**\n * @brief ReadPolyData Read from a file containing vtkPolyData.\n *\n * ReadPolyData\n *    If the path is empty a cone is returned.\n *    If the extension is unknown a sphere is returned.\n *\n * @param path - The std::filesystem path to the file.\n * @return The vtkPolyData.\n */\nvtkNew<vtkPolyData> ReadPolyData(fs::path const& path);\n\n/**\n * @brief ViewportBorder Set a border around a viewport.\n *\n * @param renderer - The renderer corresponding to the viewport.\n * @param sides - A boolean array corresponding to [top, left, bottom, right].\n * @param borderColor - The color of the border.\n * @param borderWidth - The width of the border.\n */\nvoid ViewportBorder(vtkRenderer* renderer, const std::array<bool, 4>& sides,\n                    std::string const& borderColor,\n                    double const& borderWidth = 2);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n\n  CLI::App app{\"Demonstrates the background shading options.\"};\n\n  // Define options\n  std::string fileName{\"\"};\n  app.add_option(\"fileName\", fileName,\n                 \"A optional path to a file that contains vtkPolyData e.g. \"\n                 \"star-wars-vader-tie-fighter.obj\");\n  CLI11_PARSE(app, argc, argv);\n\n  auto path = fs::path(fileName);\n  if (!path.empty())\n  {\n    if (!fs::is_regular_file(path))\n    {\n      std::cerr << \"Unable to find: \" << path << std::endl;\n      return EXIT_FAILURE;\n    }\n  }\n\n  auto pd = ReadPolyData(path);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetWindowName(\"GradientBackground\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<vtkRenderer> renderers[4];\n\n  // For each gradient specify the mode.\n  vtkViewport::GradientModes modes[4] = {\n      vtkViewport::GradientModes::VTK_GRADIENT_VERTICAL,\n      vtkViewport::GradientModes::VTK_GRADIENT_HORIZONTAL,\n      vtkViewport::GradientModes::VTK_GRADIENT_RADIAL_VIEWPORT_FARTHEST_SIDE,\n      vtkViewport::GradientModes::VTK_GRADIENT_RADIAL_VIEWPORT_FARTHEST_CORNER,\n  };\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(pd);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Honeydew\").GetData());\n  actor->GetProperty()->SetSpecular(0.3);\n  actor->GetProperty()->SetSpecularPower(60.0);\n\n  const auto renWidth = 640;\n  const auto renHeight = 480;\n\n  // The bounds for each view port.\n  double xmins[4] = {0.0, 0.5, 0.0, 0.5};\n  double ymins[4] = {0.0, 0.0, 0.5, 0.5};\n  double xmaxs[4] = {0.5, 1.0, 0.5, 1.0};\n  double ymaxs[4] = {0.5, 0.5, 1.0, 1.0};\n\n  // Here we select and name the colors.\n  // Feel free to change colors.\n  const auto bottomColor = colors->GetColor3d(\"Gold\");\n  const auto topColor = colors->GetColor3d(\"OrangeRed\");\n  const auto leftColor = colors->GetColor3d(\"Gold\");\n  const auto rightColor = colors->GetColor3d(\"OrangeRed\");\n  const auto centerColor = colors->GetColor3d(\"Gold\");\n  const auto sideColor = colors->GetColor3d(\"OrangeRed\");\n  const auto cornerColor = colors->GetColor3d(\"OrangeRed\");\n\n  const std::array<std::string, 4> viewportTitle{\"Vertical\", \"Horizontal\",\n                                                 \"Radial Farthest Side\",\n                                                 \"Radial Farthest Corner\"};\n\n  // Create one text property for all.\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetJustificationToCentered();\n  textProperty->SetFontSize(renHeight / 12);\n  textProperty->SetColor(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkTextMapper> textMappers[4];\n  vtkNew<vtkActor2D> textActors[4];\n\n  // Define borders for the viewports {top, left, bottom, right}.\n  std::array<bool, 4> lb{false, true, true, false};\n  std::array<bool, 4> lbr{false, true, true, true};\n  std::array<bool, 4> tlb{true, true, true, false};\n  std::array<bool, 4> tlbr{true, true, true, true};\n  std::string borderColor = \"DarkGreen\";\n  auto borderWidth = 4.0;\n\n  for (int i = 0; i < 4; ++i)\n  {\n    auto textMapper = textMappers[i].Get();\n    textMapper->SetInput(viewportTitle[i].c_str());\n    textMapper->SetTextProperty(textProperty);\n\n    auto textActor = textActors[i].Get();\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(renWidth / 2, 8);\n\n    auto ren = renderers[i].Get();\n    ren->AddActor(textActor);\n    ren->AddActor(actor);\n    ren->GradientBackgroundOn();\n    ren->SetGradientMode(modes[i]);\n\n    ren->SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i]);\n\n    switch (i)\n    {\n    case 0:\n    default:\n      // Vertical\n      ren->SetBackground(bottomColor.GetData());\n      ren->SetBackground2(topColor.GetData());\n      ViewportBorder(ren, lb, borderColor, borderWidth);\n      break;\n    case 1:\n      // Horizontal\n      ren->SetBackground(leftColor.GetData());\n      ren->SetBackground2(rightColor.GetData());\n      ViewportBorder(ren, lbr, borderColor, borderWidth);\n      break;\n    case 2:\n      // Radial Farthest Side\n      ren->SetBackground(centerColor.GetData());\n      ren->SetBackground2(sideColor.GetData());\n      ViewportBorder(ren, tlb, borderColor, borderWidth);\n      break;\n    case 3:\n      // Radial Farthest Corner\n      ren->SetBackground(centerColor.GetData());\n      ren->SetBackground2(cornerColor.GetData());\n      ViewportBorder(ren, tlbr, borderColor, borderWidth);\n      break;\n    }\n\n    renWin->AddRenderer(ren);\n  }\n\n  renWin->SetInteractor(iRen);\n  renWin->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  iRen->Initialize();\n  iRen->UpdateSize(renWidth * 2, renHeight * 2);\n\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkNew<vtkPolyData> ReadPolyData(fs::path const& path)\n{\n\n  vtkNew<vtkPolyData> polyData;\n\n  if (path.empty())\n  {\n    // Default to a cone if the path is empty.\n    vtkNew<vtkConeSource> source;\n    source->SetResolution(25);\n    source->SetDirection(0, 1, 0);\n    source->SetHeight(1);\n    source->Update();\n    polyData->DeepCopy(source->GetOutput());\n    return polyData;\n  }\n\n  std::string extension = path.extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(path.generic_string().c_str());\n    reader->Update();\n    polyData->DeepCopy(reader->GetOutput());\n  }\n  else\n  {\n    std::cerr << \"Warning: \" << path\n              << \" unknown extension, using a sphere instead.\" << std::endl;\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(50);\n    source->SetThetaResolution(50);\n    source->Update();\n    polyData->DeepCopy(source->GetOutput());\n  }\n  return polyData;\n}\n\nvoid ViewportBorder(vtkRenderer* renderer, std::array<bool, 4> const& sides,\n                    std::string const& borderColor, double const& borderWidth)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Points start at upper right and proceed anti-clockwise.\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  vtkNew<vtkCellArray> cells;\n  cells->Initialize();\n\n  if (sides[0])\n  {\n    // Top\n    vtkNew<vtkPolyLine> top;\n    top->GetPointIds()->SetNumberOfIds(2);\n    top->GetPointIds()->SetId(0, 0);\n    top->GetPointIds()->SetId(1, 1);\n    cells->InsertNextCell(top);\n  }\n  if (sides[1])\n  {\n    // Left\n    vtkNew<vtkPolyLine> left;\n    left->GetPointIds()->SetNumberOfIds(2);\n    left->GetPointIds()->SetId(0, 1);\n    left->GetPointIds()->SetId(1, 2);\n    cells->InsertNextCell(left);\n  }\n  if (sides[2])\n  {\n    // Bottom\n    vtkNew<vtkPolyLine> bottom;\n    bottom->GetPointIds()->SetNumberOfIds(2);\n    bottom->GetPointIds()->SetId(0, 2);\n    bottom->GetPointIds()->SetId(1, 3);\n    cells->InsertNextCell(bottom);\n  }\n  if (sides[3])\n  {\n    // Right\n    vtkNew<vtkPolyLine> right;\n    right->GetPointIds()->SetNumberOfIds(2);\n    right->GetPointIds()->SetId(0, 3);\n    right->GetPointIds()->SetId(1, 0);\n    cells->InsertNextCell(right);\n  }\n\n  // Now make the polydata and display it.\n  vtkNew<vtkPolyData> poly;\n  poly->Initialize();\n  poly->SetPoints(points);\n  poly->SetLines(cells);\n\n  // Use normalized viewport coordinates since\n  // they are independent of window size.\n  vtkNew<vtkCoordinate> coordinate;\n  coordinate->SetCoordinateSystemToNormalizedViewport();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(poly);\n  mapper->SetTransformCoordinate(coordinate);\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(borderColor).GetData());\n\n  // Line width should be at least 2 to be visible at extremes.\n  actor->GetProperty()->SetLineWidth(borderWidth);\n  renderer->AddViewProp(actor);\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/GradientBackground/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GradientBackground)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GradientBackground: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GradientBackground MACOSX_BUNDLE GradientBackground.cxx )\n  target_link_libraries(GradientBackground PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GradientBackground\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/GradientBackground/#download-and-build-gradientbackground","title":"Download and Build GradientBackground","text":"

        Click here to download GradientBackground and its CMakeLists.txt file. Once the tarball GradientBackground.tar has been downloaded and extracted,

        cd GradientBackground/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GradientBackground\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/HiddenLineRemoval/","title":"HiddenLineRemoval","text":"

        vtk-examples/Cxx/Rendering/HiddenLineRemoval

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/HiddenLineRemoval/#code","title":"Code","text":"

        HiddenLineRemoval.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // e.g. file cow.obj\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  backProp->SetSpecular(0.6);\n  backProp->SetSpecularPower(30);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProp);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(0.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  actor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HiddenLineRemoval\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Rendering/HiddenLineRemoval/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HiddenLineRemoval)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HiddenLineRemoval: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HiddenLineRemoval MACOSX_BUNDLE HiddenLineRemoval.cxx )\n  target_link_libraries(HiddenLineRemoval PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HiddenLineRemoval\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/HiddenLineRemoval/#download-and-build-hiddenlineremoval","title":"Download and Build HiddenLineRemoval","text":"

        Click here to download HiddenLineRemoval and its CMakeLists.txt file. Once the tarball HiddenLineRemoval.tar has been downloaded and extracted,

        cd HiddenLineRemoval/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HiddenLineRemoval\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/InterpolateCamera/","title":"InterpolateCamera","text":"

        vtk-examples/Cxx/Rendering/InterpolateCamera

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/InterpolateCamera/#description","title":"Description","text":"

        This example uses vtkCameraInterpolator to generate a smooth interpolation between camera views. The key points for the cameras' positions are generated from the vtkPolyData's bounding box. The cameras' focal points are at the center of the polydata.

        The key points are computed from the corners of the bounding box. They are pushed out along a vector from the center to the corner point. The amount of pushing is a random multiplier of the range of the data.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/InterpolateCamera/#code","title":"Code","text":"

        InterpolateCamera.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCameraInterpolator.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <array>\n#include <chrono>\n#include <iterator>\n// #include <random>\n#include <thread>\n#include <vector>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n\nvoid ComputeKeyPoints(vtkPolyData* polyData, std::array<double, 3>& center,\n                      std::vector<std::array<double, 3>>& keyPoints);\n\ntemplate <class T, std::size_t N>\nostream& operator<<(ostream& o, const std::array<T, N>& arr)\n{\n  copy(arr.cbegin(), arr.cend(), std::ostream_iterator<T>(o, \", \"));\n  return o;\n}\n\ntemplate <class T, std::size_t N>\nostream& operator<<(ostream& o, const std::vector<T>& vec)\n{\n  copy(vec.cbegin(), vec.cend(), std::ostream_iterator<T>(o, \", \"));\n  return o;\n}\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Setup camera views for interpolation\n  vtkNew<vtkCameraInterpolator> interpolator;\n  interpolator->SetInterpolationTypeToSpline();\n\n  std::array<double, 3> center;\n  std::vector<std::array<double, 3>> keyPoints;\n  ComputeKeyPoints(polyData, center, keyPoints);\n\n  for (size_t i = 0; i < keyPoints.size() + 1; ++i)\n  {\n    // auto j = i;\n    vtkNew<vtkCamera> cam;\n    cam->SetFocalPoint(center.data());\n    if (i < keyPoints.size())\n    {\n      cam->SetPosition(keyPoints[i].data());\n    }\n    else\n    {\n      cam->SetPosition(keyPoints[0].data());\n    }\n    cam->SetViewUp(0.0, 0.0, 1.0);\n    interpolator->AddCamera((double)i, cam);\n  }\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkProperty> backProp;\n  backProp->SetDiffuseColor(colors->GetColor3d(\"Banana\").GetData());\n  backProp->SetDiffuse(.76);\n  backProp->SetSpecular(.4);\n  backProp->SetSpecularPower(30);\n  ;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetBackfaceProperty(backProp);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(.6);\n  actor->GetProperty()->SetSpecularPower(30);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"InterpolateCamera\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  renderer->SetActiveCamera(camera);\n\n  auto numSteps = 600;\n  auto minT = interpolator->GetMinimumT();\n  auto maxT = interpolator->GetMaximumT();\n  for (auto i = 0; i < numSteps; ++i)\n  {\n    double t = (double)i * (maxT - minT) / (double)(numSteps - 1);\n    interpolator->InterpolateCamera(t, camera);\n    renderer->ResetCameraClippingRange();\n    renderWindow->Render();\n    std::this_thread::sleep_for(std::chrono::milliseconds(50));\n  }\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\nvoid ComputeKeyPoints(vtkPolyData* polyData, std::array<double, 3>& center,\n                      std::vector<std::array<double, 3>>& keyPoints)\n{\n  // std::mt19937 mt(4355412); // Standard mersenne_twister_engine\n  // std::uniform_real_distribution<double> dis(1.0, 3.0);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(4355412);\n\n  // Get Bounding Box\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n\n  double range;\n  range = std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n                   bounds[5] - bounds[3]);\n\n  std::vector<std::array<double, 3>> points(8);\n  std::array<double, 3> point;\n  point = {{bounds[0], bounds[2], bounds[4]}};\n  points[0] = point;\n\n  point = {{bounds[1], bounds[2], bounds[4]}};\n  points[1] = point;\n\n  point = {{bounds[1], bounds[2], bounds[5]}};\n  points[2] = point;\n\n  point = {{bounds[0], bounds[2], bounds[5]}};\n  points[3] = point;\n\n  point = {{bounds[0], bounds[3], bounds[4]}};\n  points[4] = point;\n\n  point = {{bounds[1], bounds[3], bounds[4]}};\n  points[5] = point;\n\n  point = {{bounds[1], bounds[3], bounds[5]}};\n  points[6] = point;\n\n  point = {{bounds[0], bounds[3], bounds[5]}};\n  points[7] = point;\n\n  polyData->GetCenter(center.data());\n\n  for (size_t i = 0; i < points.size(); ++i)\n  {\n    std::array<double, 3> direction;\n    for (auto j = 0; j < 3; ++j)\n    {\n      direction[j] = points[i][j] - center[j];\n    }\n    vtkMath::Normalize(direction.data());\n    // double factor = dis(mt);\n    double factor = randomSequence->GetRangeValue(1.0, 3.0);\n    randomSequence->Next();\n    keyPoints.resize(8);\n    for (auto j = 0; j < 3; ++j)\n    {\n      keyPoints[i][j] = points[i][j] + direction[j] * range * factor;\n    }\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/Rendering/InterpolateCamera/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(InterpolateCamera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"InterpolateCamera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(InterpolateCamera MACOSX_BUNDLE InterpolateCamera.cxx )\n  target_link_libraries(InterpolateCamera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS InterpolateCamera\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/InterpolateCamera/#download-and-build-interpolatecamera","title":"Download and Build InterpolateCamera","text":"

        Click here to download InterpolateCamera and its CMakeLists.txt file. Once the tarball InterpolateCamera.tar has been downloaded and extracted,

        cd InterpolateCamera/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./InterpolateCamera\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/LayeredActors/","title":"LayeredActors","text":"

        vtk-examples/Cxx/Rendering/LayeredActors

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/LayeredActors/#description","title":"Description","text":"

        Demonstrates the use of two renderers in a render window. Notice that the second (and subsequent) renderers will have a transparent background.

        The first layer (layer 0) contains the base object, a slab in this case. The second layer (layer 1) contains an object (axes in this case). This axes object will always be in front of the base layer object. When the program runs, the top-most layer will be the active layer, layer 1 in this case.

        Two callbacks are provided, the first callback selects which layer is active:

        • Pressing 0 on the keyboard will let you manipulate the objects in layer 0.
        • Pressing 1 on the keyboard will let you manipulate the objects in layer 1.

        The second callback allows you to orient objects in all layers using the object in the active layer.

        Note

        Objects in the top-most layer will always be in front of any objects in other layers.

        Info

        This is an extension of the TransparentBackground.cxx and TransparentBackground.py examples, extended by adding an extra callback so that the non-active layer objects move in conjunction with the active layer objects.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/LayeredActors/#code","title":"Code","text":"

        LayeredActors.cxx

        #include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkInteractorObserver.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkTransform.h>\n\n#include <array>\n#include <cstdlib>\n#include <iostream>\n\nnamespace {\n/**\n * Copy an array to the internal buffer within the vector class.\n *\n * @param arr - The array.\n * @return - The vector corresponding to the array.\n */\ntemplate <typename T>\nstd::vector<T> CopyArrayToVector(T* arr, std::size_t arr_len)\n{\n  return std::vector<T>(arr, arr + arr_len);\n}\n\n//! The positional information relating to the camera.\nstruct Orientation\n{\n  std::vector<double> position{0.0, 0.0, 0.0};\n  std::vector<double> focalPoint{0.0, 0.0, 0.0};\n  std::vector<double> viewUp{0.0, 0.0, 0.0};\n  double distance = 0;\n  std::vector<double> clipplingRange{0.0, 0.0};\n  std::vector<double> orientation{0.0, 0.0, 0.0};\n};\n\n/**\n * Select the layer to manipulate.\n */\nvoid SelectLayer(vtkObject* caller, long unsigned int eventId, void* clientData,\n                 void* callData);\n\n/**\n * Orient layer 0 based on the camera orientation in layer 1 or vice versa.\n */\nvoid OrientLayer(vtkObject* caller, long unsigned int eventId, void* clientData,\n                 void* callData);\n\n//! Get the camera orientation.\n/*\n * @param ren - the renderer.\n * @return The orientation parameters.\n */\nOrientation GetOrientation(vtkRenderer* ren);\n\n//! Set the camera orientation.\n/*\n *\n * @param ren - the renderer.\n * @param p - The orientation parameters.\n * @return\n */\nvoid SetOrientation(vtkRenderer* ren, Orientation const& p);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetXLength(4.0);\n  cubeSource->SetYLength(9.0);\n  cubeSource->SetZLength(1.0);\n  cubeSource->SetCenter(0.0, 0.0, 0.0);\n\n  // Make the slab and axes actors.\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkProperty> back;\n  back->SetColor(colors->GetColor3d(\"Sienna\").GetData());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"BurlyWood\").GetData());\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->EdgeVisibilityOn();\n  cubeActor->GetProperty()->SetLineWidth(2.0);\n  cubeActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"PapayaWhip\").GetData());\n  cubeActor->SetBackfaceProperty(back);\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 0.0, 0.0);\n\n  vtkNew<vtkAxesActor> axes;\n  // The axes can be positioned with a user transform.\n  axes->SetUserTransform(transform);\n\n  // The renderers, render window and interactor.\n  std::array<vtkNew<vtkRenderer>, 2> renderers;\n  vtkNew<vtkRenderWindow> renWin;\n  for (auto&& ren : renderers)\n  {\n    renWin->AddRenderer(ren);\n  }\n  renWin->SetSize(800, 800);\n  renWin->SetWindowName(\"LayeredActors\");\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  // Define the renderers and allocate them to layers.\n  // Layer 0 - background not transparent.\n  renderers[0]->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderers[0]->AddActor(cubeActor);\n  renderers[0]->SetLayer(0);\n\n  // Layer 1 - the background is transparent,\n  //       so we only see the layer 0 background color\n  renderers[1]->AddActor(axes);\n  renderers[1]->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderers[1]->SetLayer(1);\n\n  // Set a common camera view for each layer.\n  for (const auto& renderer : renderers)\n  {\n    auto camera = renderer->GetActiveCamera();\n    camera->Elevation(-30.0);\n    camera->Azimuth(-30.0);\n    renderer->ResetCamera();\n  }\n\n  // We have two layers.\n  renWin->SetNumberOfLayers(static_cast<int>(renderers.size()));\n\n  renWin->Render();\n\n  vtkNew<vtkCallbackCommand> selectLayerCB;\n  selectLayerCB->SetCallback(SelectLayer);\n  iRen->AddObserver(vtkCommand::KeyPressEvent, selectLayerCB);\n  vtkNew<vtkCallbackCommand> orientLayerCB;\n  orientLayerCB->SetCallback(OrientLayer);\n  iRen->AddObserver(vtkCommand::EndInteractionEvent, orientLayerCB);\n\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid SelectLayer(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                 void* vtkNotUsed(clientData), void* vtkNotUsed(callData))\n{\n  vtkRenderWindowInteractor* iRen =\n      static_cast<vtkRenderWindowInteractor*>(caller);\n  vtkRendererCollection* renderers = iRen->GetRenderWindow()->GetRenderers();\n  if (renderers->GetNumberOfItems() < 2)\n  {\n    std::cerr << \"We need at least two renderers, we have only \"\n              << renderers->GetNumberOfItems() << std::endl;\n    return;\n  }\n  renderers->InitTraversal();\n  // Top item.\n  vtkRenderer* ren0 = renderers->GetNextItem();\n  // Bottom item.\n  vtkRenderer* ren1 = renderers->GetNextItem();\n\n  std::string key = iRen->GetKeySym();\n\n  if (key == \"0\")\n  {\n    std::cout << \"Selected layer: \" << key << std::endl;\n    iRen->GetRenderWindow()\n        ->GetInteractor()\n        ->GetInteractorStyle()\n        ->SetDefaultRenderer(ren0);\n    ren0->InteractiveOn();\n    ren1->InteractiveOff();\n  }\n  if (key == \"1\")\n  {\n    std::cout << \"Selected layer: \" << key << std::endl;\n    iRen->GetRenderWindow()\n        ->GetInteractor()\n        ->GetInteractorStyle()\n        ->SetDefaultRenderer(ren1);\n    ren0->InteractiveOff();\n    ren1->InteractiveOn();\n  }\n}\n\nvoid OrientLayer(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                 void* vtkNotUsed(clientData), void* vtkNotUsed(callData))\n{\n  vtkRenderWindowInteractor* iRen =\n      static_cast<vtkRenderWindowInteractor*>(caller);\n  vtkRendererCollection* renderers = iRen->GetRenderWindow()->GetRenderers();\n  if (renderers->GetNumberOfItems() < 2)\n  {\n    std::cerr << \"We need at least two renderers, we have only \"\n              << renderers->GetNumberOfItems() << std::endl;\n    return;\n  }\n  renderers->InitTraversal();\n  // Top item.\n  vtkRenderer* ren0 = renderers->GetNextItem();\n  // Bottom item.\n  vtkRenderer* ren1 = renderers->GetNextItem();\n\n  if (ren1->GetInteractive())\n  {\n    auto orient1 = GetOrientation(ren1);\n    SetOrientation(ren0, orient1);\n    ren0->ResetCamera();\n  }\n  else\n  {\n    auto orient0 = GetOrientation(ren0);\n    SetOrientation(ren1, orient0);\n    ren1->ResetCamera();\n  }\n}\n\nOrientation GetOrientation(vtkRenderer* ren)\n{\n  Orientation p;\n\n  vtkCamera* camera = ren->GetActiveCamera();\n  p.position = CopyArrayToVector<double>(camera->GetPosition(), 3);\n  p.focalPoint = CopyArrayToVector<double>(camera->GetFocalPoint(), 3);\n  p.viewUp = CopyArrayToVector<double>(camera->GetViewUp(), 3);\n  p.distance = camera->GetDistance();\n  p.clipplingRange = CopyArrayToVector<double>(camera->GetClippingRange(), 2);\n  p.orientation = CopyArrayToVector<double>(camera->GetOrientation(), 3);\n\n  return p;\n}\n\nvoid SetOrientation(vtkRenderer* ren, Orientation const& p)\n{\n  vtkCamera* camera = ren->GetActiveCamera();\n  camera->SetPosition(p.position.data());\n  camera->SetFocalPoint(p.focalPoint.data());\n  camera->SetViewUp(p.viewUp.data());\n  camera->SetDistance(p.distance);\n  camera->SetClippingRange(p.clipplingRange.data());\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/LayeredActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LayeredActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LayeredActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LayeredActors MACOSX_BUNDLE LayeredActors.cxx )\n  target_link_libraries(LayeredActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LayeredActors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/LayeredActors/#download-and-build-layeredactors","title":"Download and Build LayeredActors","text":"

        Click here to download LayeredActors and its CMakeLists.txt file. Once the tarball LayeredActors.tar has been downloaded and extracted,

        cd LayeredActors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LayeredActors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/Mace/","title":"Mace","text":"

        vtk-examples/Cxx/Rendering/Mace

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/Mace/#description","title":"Description","text":"

        An example of multiple inputs and outputs.

        Info

        See Figure 4-21 in Chapter 4 the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/Mace/#code","title":"Code","text":"

        Mace.cxx

        #include <vtkConeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(8);\n  sphere->SetPhiResolution(8);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(6);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(sphere->GetOutputPort());\n  glyph->SetSourceConnection(cone->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->SetScaleFactor(0.25);\n\n  vtkNew<vtkPolyDataMapper> spikeMapper;\n  spikeMapper->SetInputConnection(glyph->GetOutputPort());\n\n  vtkNew<vtkActor> spikeActor;\n  spikeActor->SetMapper(spikeMapper);\n  spikeActor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(spikeActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"Mace\");\n\n  // interact with data\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/Mace/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Mace)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Mace: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Mace MACOSX_BUNDLE Mace.cxx )\n  target_link_libraries(Mace PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Mace\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/Mace/#download-and-build-mace","title":"Download and Build Mace","text":"

        Click here to download Mace and its CMakeLists.txt file. Once the tarball Mace.tar has been downloaded and extracted,

        cd Mace/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Mace\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/Model/","title":"Model","text":"

        vtk-examples/Cxx/Rendering/Model

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/Model/#description","title":"Description","text":"

        Info

        See Figure 3-24 in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/Model/#code","title":"Code","text":"

        Model.cxx

        #include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> cubeColor{{250, 128, 114, 255}};\n  colors->SetColor(\"CubeColor\", cubeColor.data());\n  std::array<unsigned char, 4> bkg{{230, 230, 230, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // create rendering windows and three renderers\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderer> ren2;\n  vtkNew<vtkRenderWindow> renWindow1;\n  renWindow1->AddRenderer(ren1);\n  renWindow1->AddRenderer(ren2);\n  renWindow1->SetWindowName(\"Model\");\n\n  vtkNew<vtkRenderWindowInteractor> iren1;\n  iren1->SetRenderWindow(renWindow1);\n  vtkNew<vtkRenderer> ren3;\n  vtkNew<vtkRenderWindow> renWindow2;\n  renWindow2->AddRenderer(ren3);\n  renWindow2->SetWindowName(\"Model\");\n\n  vtkNew<vtkRenderWindowInteractor> iren2;\n  iren2->SetRenderWindow(renWindow2);\n\n  // create an actor and give it cone geometry\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(8);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // create an actor and give it cube geometry\n  vtkNew<vtkCubeSource> cube;\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cube->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"CubeColor\").GetData());\n\n  // create an actor and give it sphere geometry\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(16);\n  sphere->SetPhiResolution(16);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Melon\").GetData());\n\n  // assign our actor to both renderers\n  ren1->AddActor(coneActor);\n  ren2->AddActor(sphereActor);\n  ren3->AddActor(cubeActor);\n\n  // set the size of our window\n  renWindow1->SetSize(300, 150);\n  renWindow1->SetPosition(0, 50);\n  renWindow2->SetSize(300, 300);\n  renWindow2->SetPosition(0, 300);\n\n  // set the viewports and background of the renderers\n  ren1->SetViewport(0, 0, 0.5, 1);\n  ren1->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  ren2->SetViewport(0.5, 0, 1, 1);\n  ren2->SetBackground(colors->GetColor3d(\"Linen\").GetData());\n  ren3->SetBackground(colors->GetColor3d(\"Honeydew\").GetData());\n\n  // draw the resulting scene\n  renWindow1->Render();\n  renWindow2->Render();\n\n  iren1->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/Model/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Model)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Model: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Model MACOSX_BUNDLE Model.cxx )\n  target_link_libraries(Model PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Model\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/Model/#download-and-build-model","title":"Download and Build Model","text":"

        Click here to download Model and its CMakeLists.txt file. Once the tarball Model.tar has been downloaded and extracted,

        cd Model/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Model\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/MotionBlur/","title":"MotionBlur","text":"

        vtk-examples/Cxx/Rendering/MotionBlur

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/MotionBlur/#description","title":"Description","text":"

        Example of motin blur.

        Info

        See Figure 7-36 in Chapter 7 in the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/MotionBlur/#code","title":"Code","text":"

        MotionBlur.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderStepsPass.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSimpleMotionBlurPass.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file e.g. Armadillo.ply\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the colors.\n  std::array<unsigned char, 4> a1Diff{{255, 204, 77, 255}};\n  colors->SetColor(\"A1Diff\", a1Diff.data());\n  std::array<unsigned char, 4> a2Amb{{51, 51, 255, 255}};\n  colors->SetColor(\"A2Amb\", a2Amb.data());\n  std::array<unsigned char, 4> a2Diff{{51, 255, 204, 255}};\n  colors->SetColor(\"A2Diff\", a2Diff.data());\n  std::array<unsigned char, 4> a3Amb{{128, 166, 255, 255}};\n  colors->SetColor(\"A3Amb\", a3Amb.data());\n  std::array<unsigned char, 4> bkg{{77, 102, 153, 255}};\n  colors->SetColor(\"Bkg\", bkg.data());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Bkg\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(500, 500);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MotionBlur\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPLYReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  // Create three models.\n  {\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetAmbientColor(colors->GetColor3d(\"Red\").GetData());\n    actor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"A1Diff\").GetData());\n    actor->GetProperty()->SetSpecular(0.0);\n    actor->GetProperty()->SetDiffuse(0.5);\n    actor->GetProperty()->SetAmbient(0.3);\n    actor->SetPosition(-0.1, 0.0, -0.1);\n    renderer->AddActor(actor);\n  }\n\n  {\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetAmbientColor(\n        colors->GetColor3d(\"A2Amb\").GetData());\n    actor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"A2Diff\").GetData());\n    actor->GetProperty()->SetSpecularColor(\n        colors->GetColor3d(\"Black\").GetData());\n    actor->GetProperty()->SetSpecular(0.2);\n    actor->GetProperty()->SetDiffuse(0.9);\n    actor->GetProperty()->SetAmbient(0.1);\n    actor->GetProperty()->SetSpecularPower(10.0);\n    renderer->AddActor(actor);\n  }\n\n  {\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"A3Amb\").GetData());\n    actor->GetProperty()->SetSpecularColor(\n        colors->GetColor3d(\"White\").GetData());\n    actor->GetProperty()->SetSpecular(0.7);\n    actor->GetProperty()->SetDiffuse(0.4);\n    actor->GetProperty()->SetSpecularPower(60.0);\n    actor->SetPosition(0.1, 0.0, 0.1);\n    renderer->AddActor(actor);\n  }\n\n  renderWindow->SetMultiSamples(0);\n\n  // Create the basic VTK render steps.\n  vtkNew<vtkRenderStepsPass> basicPasses;\n\n  vtkNew<vtkSimpleMotionBlurPass> motion;\n  motion->SetDelegatePass(basicPasses);\n\n  // Tell the renderer to use our render pass pipeline.\n  vtkOpenGLRenderer* glrenderer =\n      dynamic_cast<vtkOpenGLRenderer*>(renderer.GetPointer());\n  glrenderer->SetPass(motion);\n\n  int numRenders = 30;\n\n  renderer->GetActiveCamera()->SetPosition(0, 0, -1);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(15.0);\n  renderer->GetActiveCamera()->Zoom(1.2);\n\n  renderWindow->Render();\n\n  for (int i = 0; i < numRenders; ++i)\n  {\n    renderer->GetActiveCamera()->Azimuth(10.0 / numRenders);\n    renderer->GetActiveCamera()->Elevation(10.0 / numRenders);\n    renderWindow->Render();\n  }\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/MotionBlur/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MotionBlur)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOPLY\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MotionBlur: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MotionBlur MACOSX_BUNDLE MotionBlur.cxx )\n  target_link_libraries(MotionBlur PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MotionBlur\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/MotionBlur/#download-and-build-motionblur","title":"Download and Build MotionBlur","text":"

        Click here to download MotionBlur and its CMakeLists.txt file. Once the tarball MotionBlur.tar has been downloaded and extracted,

        cd MotionBlur/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MotionBlur\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/OutlineGlowPass/","title":"OutlineGlowPass","text":"

        vtk-examples/Cxx/Rendering/OutlineGlowPass

        "},{"location":"Cxx/Rendering/OutlineGlowPass/#description","title":"Description","text":"

        Demonstrates how to render an object in a scene with a glowing outline.

        The class vtkOutlineGlowPass is designed to highlight parts of a scene by applying the render pass to a layered renderer on top of the main scene. For optimal results, actors that form the outline should be brightly colored with lighting disabled. The outline will have the color of the actors. There is only one outline around all objects rendered by the delegate.

        When combined with layered renderers, this creates a very visible highlight without altering the highlighted object.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/OutlineGlowPass/#code","title":"Code","text":"

        OutlineGlowPass.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOutlineGlowPass.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderStepsPass.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSmartPointer.h>\n#include <vtkVersion.h>\n\n#include <iomanip>\n#include <iostream>\n#include <string>\n\nnamespace {\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return True if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n} // namespace\n\nint main(int, char*[])\n{\n  if (!VTKVersionOk(9, 0, 20200909))\n  {\n    std::cerr\n        << \"You need VTK version 9.0.20200909 or greater to run this program.\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetMultiSamples(0);\n\n  iren->SetRenderWindow(renWin);\n\n  // Set up the renderers.\n  // One for the object and the other for the outline.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderer> rendererOutline;\n  rendererOutline->SetLayer(1);\n  renWin->SetNumberOfLayers(2);\n  renWin->AddRenderer(rendererOutline);\n  renWin->AddRenderer(renderer);\n\n  // Create an arrow.\n  vtkNew<vtkArrowSource> arrowSource;\n  // arrowSource->SetShaftRadius(1.0);\n  // arrowSource->SetTipLength(1.0);\n  arrowSource->Update();\n\n  // Create mapper and actor for the main renderer.\n  vtkNew<vtkPolyDataMapper> mapperMain;\n  mapperMain->SetInputConnection(arrowSource->GetOutputPort());\n\n  vtkNew<vtkActor> actorMain;\n  actorMain->SetMapper(mapperMain);\n  actorMain->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"LimeGreen\").GetData());\n\n  renderer->AddActor(actorMain);\n\n  // Lets make the outline glow!\n  // Create the render pass.\n  vtkNew<vtkRenderStepsPass> basicPasses;\n  vtkNew<vtkOutlineGlowPass> glowPass;\n  glowPass->SetDelegatePass(basicPasses);\n\n  // Apply the render pass to the highlight renderer.\n  rendererOutline->SetPass(glowPass);\n\n  // Create mapper and actor for the outline.\n  vtkNew<vtkPolyDataMapper> mapperOutline;\n  mapperOutline->SetInputConnection(arrowSource->GetOutputPort());\n\n  vtkNew<vtkActor> actorOutline;\n  actorOutline->SetMapper(mapperOutline);\n  actorOutline->GetProperty()->SetColor(\n      colors->GetColor3d(\"Magenta\").GetData());\n  actorOutline->GetProperty()->LightingOff();\n\n  rendererOutline->AddActor(actorOutline);\n\n  renWin->SetSize(600, 600);\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"DarkSlateBlue\").GetData());\n\n  renderer->ResetCamera();\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->Roll(45.0);\n  camera->Azimuth(-30.0);\n  camera->Elevation(-15.0);\n  renderer->ResetCamera();\n  // Now set the active camera for the outline.\n  rendererOutline->SetActiveCamera(camera);\n\n  renWin->SetWindowName(\"OutlineGlowPass\");\n\n  renWin->Render();\n\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n#ifndef VTK_VERSION_NUMBER\n  auto ver = vtkSmartPointer<vtkVersion>();\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  if (vtk_version_number >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#else\n  if (VTK_VERSION_NUMBER >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#endif\n}\n} // namespace\n
        "},{"location":"Cxx/Rendering/OutlineGlowPass/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OutlineGlowPass)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OutlineGlowPass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OutlineGlowPass MACOSX_BUNDLE OutlineGlowPass.cxx )\n  target_link_libraries(OutlineGlowPass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OutlineGlowPass\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/OutlineGlowPass/#download-and-build-outlineglowpass","title":"Download and Build OutlineGlowPass","text":"

        Click here to download OutlineGlowPass and its CMakeLists.txt file. Once the tarball OutlineGlowPass.tar has been downloaded and extracted,

        cd OutlineGlowPass/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OutlineGlowPass\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/PBR_Anisotropy/","title":"PBR Anisotropy","text":"

        vtk-examples/Cxx/Rendering/PBR_Anisotropy

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/PBR_Anisotropy/#description","title":"Description","text":"

        This example is based on TestPBRAnisotropy.cxx and renders spheres with different anisotropy values.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Cxx/Rendering/PBR_Anisotropy/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/PBR_Anisotropy/#code","title":"Code","text":"

        PBR_Anisotropy.cxx

        #include <vtkActor.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkSphereSource.h>\n#include <vtkTextureMapToSphere.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Render spheres with different anisotropy values.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useEquirectangular{false};\n  app.add_flag(\"-e, --use_equirectangular\", useEquirectangular,\n               \"Use the equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useCubemap = !useEquirectangular;\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(75);\n  sphere->SetPhiResolution(75);\n\n  vtkNew<vtkTextureMapToSphere> textureMap;\n  textureMap->SetInputConnection(sphere->GetOutputPort());\n  textureMap->PreventSeamOff();\n\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(textureMap->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(tangents->GetOutputPort());\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 0.0, 0.0);\n    actorSphere->RotateX(20);\n    actorSphere->RotateY(20);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetAnisotropy(1.0);\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 1.0, 0.0);\n    actorSphere->RotateX(20);\n    actorSphere->RotateY(20);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(0.1);\n    actorSphere->GetProperty()->SetAnisotropy(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 2.0, 0.0);\n    actorSphere->RotateX(20);\n    actorSphere->RotateY(20);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(0.1);\n    actorSphere->GetProperty()->SetAnisotropy(1.0);\n    actorSphere->GetProperty()->SetAnisotropyRotation(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Anisotropy\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/PBR_Anisotropy/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Anisotropy)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  FiltersTexture\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Anisotropy: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Anisotropy MACOSX_BUNDLE PBR_Anisotropy.cxx )\n  target_link_libraries(PBR_Anisotropy PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Anisotropy\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/PBR_Anisotropy/#download-and-build-pbr_anisotropy","title":"Download and Build PBR_Anisotropy","text":"

        Click here to download PBR_Anisotropy and its CMakeLists.txt file. Once the tarball PBR_Anisotropy.tar has been downloaded and extracted,

        cd PBR_Anisotropy/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PBR_Anisotropy\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/PBR_Clear_Coat/","title":"PBR Clear Coat","text":"

        vtk-examples/Cxx/Rendering/PBR_Clear_Coat

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/PBR_Clear_Coat/#description","title":"Description","text":"

        This example is based on TestPBRClearCoat.cxx and renders a cube with custom texture mapping and a coat normal texture.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Cxx/Rendering/PBR_Clear_Coat/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/PBR_Clear_Coat/#code","title":"Code","text":"

        PBR_Clear_Coat.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPNGReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkTexture.h>\n#include <vtkTriangleFilter.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\n      \"Render a cube with custom texture mapping and a coat normal texture.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useEquirectangular{false};\n  app.add_flag(\"-e, --use_equirectangular\", useEquirectangular,\n               \"Use the equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useCubemap = !useEquirectangular;\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n  ren->AutomaticLightCreationOff();\n\n  vtkNew<vtkLight> light;\n  light->SetPosition(2.0, 0.0, 2.0);\n  light->SetFocalPoint(0.0, 0.0, 0.0);\n\n  ren->AddLight(light);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n  ren->UseSphericalHarmonicsOff();\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkCubeSource> cube;\n\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(cube->GetOutputPort());\n\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(triangulation->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(tangents->GetOutputPort());\n\n  vtkNew<vtkPNGReader> materialReader;\n  materialReader->SetFileName(parameters.parameters[\"material\"].c_str());\n\n  vtkNew<vtkTexture> material;\n  material->InterpolateOn();\n  material->SetInputConnection(materialReader->GetOutputPort());\n\n  vtkNew<vtkPNGReader> albedoReader;\n  albedoReader->SetFileName(parameters.parameters[\"albedo\"].c_str());\n\n  vtkNew<vtkTexture> albedo;\n  albedo->UseSRGBColorSpaceOn();\n  albedo->InterpolateOn();\n  albedo->SetInputConnection(albedoReader->GetOutputPort());\n\n  vtkNew<vtkPNGReader> normalReader;\n  normalReader->SetFileName(parameters.parameters[\"normal\"].c_str());\n\n  // Uncomment this if you want a similar image to the VTK test image.\n  // vtkNew<vtkImageFlip> flip;\n  // flip->SetInputConnection(normalReader->GetOutputPort());\n  // flip->SetFilteredAxes(0);\n\n  vtkNew<vtkTexture> normal;\n  normal->InterpolateOn();\n  normal->SetInputConnection(normalReader->GetOutputPort());\n\n  vtkNew<vtkTexture> coatNormal;\n  coatNormal->InterpolateOn();\n  coatNormal->SetInputConnection(normalReader->GetOutputPort());\n  // Uncomment this if you want a similar image to the VTK test image.\n  // coatNormal->SetInputConnection(flip->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetOrientation(0.0, 25.0, 0.0);\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToPBR();\n\n  // Set metallic, roughness and coat strength to 1.0 as they act as multipliers\n  // with texture value.\n  actor->GetProperty()->SetMetallic(1.0);\n  actor->GetProperty()->SetRoughness(1.0);\n  actor->GetProperty()->SetCoatStrength(1.0);\n  actor->GetProperty()->SetCoatColor(colors->GetColor3d(\"Red\").GetData());\n\n  actor->GetProperty()->SetBaseColorTexture(albedo);\n  actor->GetProperty()->SetORMTexture(material);\n  actor->GetProperty()->SetNormalTexture(normal);\n  actor->GetProperty()->SetCoatNormalTexture(coatNormal);\n\n  ren->AddActor(actor);\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Clear_Coat\");\n\n  renWin->Render();\n  ren->GetActiveCamera()->Zoom(1.5);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/PBR_Clear_Coat/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Clear_Coat)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  FiltersCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Clear_Coat: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Clear_Coat MACOSX_BUNDLE PBR_Clear_Coat.cxx )\n  target_link_libraries(PBR_Clear_Coat PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Clear_Coat\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/PBR_Clear_Coat/#download-and-build-pbr_clear_coat","title":"Download and Build PBR_Clear_Coat","text":"

        Click here to download PBR_Clear_Coat and its CMakeLists.txt file. Once the tarball PBR_Clear_Coat.tar has been downloaded and extracted,

        cd PBR_Clear_Coat/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PBR_Clear_Coat\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/PBR_Edge_Tint/","title":"PBR Edge Tint","text":"

        vtk-examples/Cxx/Rendering/PBR_Edge_Tint

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/PBR_Edge_Tint/#description","title":"Description","text":"

        This example is based on TestPBREdgeTint.cxx and renders spheres with different edge colors using a skybox as image based lighting.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Cxx/Rendering/PBR_Edge_Tint/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/PBR_Edge_Tint/#code","title":"Code","text":"

        PBR_Edge_Tint.cxx

        #include <vtkActor.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkSphereSource.h>\n#include <vtkTexture.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Render spheres with different edge colors using a skybox as \"\n               \"image based lighting.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useCubemap{false};\n  app.add_flag(\"-c, --use_cubemap\", useCubemap,\n               \"Build the cubemap from the six cubemap files. Overrides the \"\n               \"equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(75);\n  sphere->SetPhiResolution(75);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 0.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetEdgeTint(\n        colors->GetColor3d(\"Black\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 1.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetEdgeTint(\n        colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 2.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetEdgeTint(\n        colors->GetColor3d(\"Red\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 3.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetEdgeTint(\n        colors->GetColor3d(\"Blue\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 4.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetEdgeTint(\n        colors->GetColor3d(\"Yellow\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Edge_Tint\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/PBR_Edge_Tint/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Edge_Tint)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Edge_Tint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Edge_Tint MACOSX_BUNDLE PBR_Edge_Tint.cxx )\n  target_link_libraries(PBR_Edge_Tint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Edge_Tint\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/PBR_Edge_Tint/#download-and-build-pbr_edge_tint","title":"Download and Build PBR_Edge_Tint","text":"

        Click here to download PBR_Edge_Tint and its CMakeLists.txt file. Once the tarball PBR_Edge_Tint.tar has been downloaded and extracted,

        cd PBR_Edge_Tint/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PBR_Edge_Tint\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/PBR_HDR_Environment/","title":"PBR HDR Environment","text":"

        vtk-examples/Cxx/Rendering/PBR_HDR_Environment

        "},{"location":"Cxx/Rendering/PBR_HDR_Environment/#description","title":"Description","text":"

        This example is based on TestPBRHdrEnvironment.cxx and renders spheres with different materials using a skybox as image based lighting.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Cxx/Rendering/PBR_HDR_Environment/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/PBR_HDR_Environment/#code","title":"Code","text":"

        PBR_HDR_Environment.cxx

        #include <vtkActor.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkSphereSource.h>\n#include <vtkTexture.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Renders spheres with different materials using a skybox as \"\n               \"image based lighting.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useCubemap{false};\n  app.add_flag(\"-c, --use_cubemap\", useCubemap,\n               \"Build the cubemap from the six cubemap files. Overrides the \"\n               \"equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n  ren->UseSphericalHarmonicsOff();\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(75);\n  sphere->SetPhiResolution(75);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 0.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n\n    ren->AddActor(actorSphere);\n  }\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_HDR_Environment\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/PBR_HDR_Environment/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_HDR_Environment)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_HDR_Environment: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_HDR_Environment MACOSX_BUNDLE PBR_HDR_Environment.cxx )\n  target_link_libraries(PBR_HDR_Environment PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_HDR_Environment\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/PBR_HDR_Environment/#download-and-build-pbr_hdr_environment","title":"Download and Build PBR_HDR_Environment","text":"

        Click here to download PBR_HDR_Environment and its CMakeLists.txt file. Once the tarball PBR_HDR_Environment.tar has been downloaded and extracted,

        cd PBR_HDR_Environment/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PBR_HDR_Environment\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/PBR_Mapping/","title":"PBR Mapping","text":"

        vtk-examples/Cxx/Rendering/PBR_Mapping

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/PBR_Mapping/#description","title":"Description","text":"

        This example is based on TestPBRMapping.cxx and renders spheres with different edge colors using a skybox as image based lighting.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Cxx/Rendering/PBR_Mapping/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/PBR_Mapping/#code","title":"Code","text":"

        PBR_Mapping.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPNGReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkTexture.h>\n#include <vtkTriangleFilter.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Render a cube with custom texture mapping.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useEquirectangular{false};\n  app.add_flag(\"-e, --use_equirectangular\", useEquirectangular,\n               \"Use the equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useCubemap = !useEquirectangular;\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n  ren->AutomaticLightCreationOff();\n\n  vtkNew<vtkLight> light;\n  light->SetPosition(2.0, 0.0, 2.0);\n  light->SetFocalPoint(0.0, 0.0, 0.0);\n\n  ren->AddLight(light);\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n  ren->UseSphericalHarmonicsOff();\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkCubeSource> cube;\n\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(cube->GetOutputPort());\n\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(triangulation->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(tangents->GetOutputPort());\n\n  vtkNew<vtkPNGReader> materialReader;\n  materialReader->SetFileName(parameters.parameters[\"material\"].c_str());\n\n  vtkNew<vtkTexture> material;\n  material->InterpolateOn();\n  material->SetInputConnection(materialReader->GetOutputPort());\n\n  vtkNew<vtkPNGReader> albedoReader;\n  albedoReader->SetFileName(parameters.parameters[\"albedo\"].c_str());\n\n  vtkNew<vtkTexture> albedo;\n  albedo->UseSRGBColorSpaceOn();\n  albedo->InterpolateOn();\n  albedo->SetInputConnection(albedoReader->GetOutputPort());\n\n  vtkNew<vtkPNGReader> normalReader;\n  normalReader->SetFileName(parameters.parameters[\"normal\"].c_str());\n\n  vtkNew<vtkTexture> normal;\n  normal->InterpolateOn();\n  normal->SetInputConnection(normalReader->GetOutputPort());\n\n  vtkNew<vtkPNGReader> anisotropyReader;\n  anisotropyReader->SetFileName(parameters.parameters[\"anisotropy\"].c_str());\n\n  vtkNew<vtkTexture> anisotropy;\n  anisotropy->InterpolateOn();\n  anisotropy->SetInputConnection(anisotropyReader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetOrientation(0.0, 25.0, 0.0);\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToPBR();\n\n  // Set metallic, roughness, anisotropy and anisotropyRotation\n  // to 1.0 as they act as multipliers with texture value.\n  actor->GetProperty()->SetMetallic(1.0);\n  actor->GetProperty()->SetRoughness(1.0);\n  actor->GetProperty()->SetAnisotropy(1.0);\n  actor->GetProperty()->SetAnisotropyRotation(1.0);\n  actor->GetProperty()->SetCoatColor(colors->GetColor3d(\"White\").GetData());\n\n  actor->GetProperty()->SetBaseColorTexture(albedo);\n  actor->GetProperty()->SetORMTexture(material);\n  actor->GetProperty()->SetNormalTexture(normal);\n  actor->GetProperty()->SetAnisotropyTexture(anisotropy);\n\n  ren->AddActor(actor);\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Clear_Coat\");\n\n  renWin->Render();\n  ren->GetActiveCamera()->Zoom(1.5);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/PBR_Mapping/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Mapping)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  FiltersCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Mapping: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Mapping MACOSX_BUNDLE PBR_Mapping.cxx )\n  target_link_libraries(PBR_Mapping PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Mapping\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/PBR_Mapping/#download-and-build-pbr_mapping","title":"Download and Build PBR_Mapping","text":"

        Click here to download PBR_Mapping and its CMakeLists.txt file. Once the tarball PBR_Mapping.tar has been downloaded and extracted,

        cd PBR_Mapping/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PBR_Mapping\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/PBR_Materials/","title":"PBR Materials","text":"

        vtk-examples/Cxx/Rendering/PBR_Materials

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/PBR_Materials/#description","title":"Description","text":"

        This example is based on TestPBRMaterials.cxx and renders spheres with different materials using a skybox as image based lighting. Red, cyan and black spheres are dielectric, brass and white spheres are metallic. Roughness ranges from 0 to 1 in steps of 0.2.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Cxx/Rendering/PBR_Materials/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/PBR_Materials/#code","title":"Code","text":"

        PBR_Materials.cxx

        #include <vtkActor.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkSphereSource.h>\n#include <vtkTexture.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Render spheres with different materials using a skybox as \"\n               \"image based lighting.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useEquirectangular{false};\n  app.add_flag(\"-e, --use_equirectangular\", useEquirectangular,\n               \"Use the equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useCubemap = !useEquirectangular;\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(100);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 0.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 1.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Brass\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 2.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 3.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 4.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n    actorSphere->GetProperty()->SetRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Materials\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/PBR_Materials/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Materials)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Materials: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Materials MACOSX_BUNDLE PBR_Materials.cxx )\n  target_link_libraries(PBR_Materials PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Materials\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/PBR_Materials/#download-and-build-pbr_materials","title":"Download and Build PBR_Materials","text":"

        Click here to download PBR_Materials and its CMakeLists.txt file. Once the tarball PBR_Materials.tar has been downloaded and extracted,

        cd PBR_Materials/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PBR_Materials\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/PBR_Materials_Coat/","title":"PBR Materials Coat","text":"

        vtk-examples/Cxx/Rendering/PBR_Materials_Coat

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/PBR_Materials_Coat/#description","title":"Description","text":"

        This example is based on TestPBRMaterialsCoat.cxx and renders spheres with different coat materials using a skybox as image based lighting.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Cxx/Rendering/PBR_Materials_Coat/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/PBR_Materials_Coat/#code","title":"Code","text":"

        PBR_Materials_Coat.cxx

        #include <vtkActor.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOpenGLTexture.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSkybox.h>\n#include <vtkSphereSource.h>\n#include <vtkTexture.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Render spheres with different coat materials using a skybox as \"\n               \"image based lighting.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Parameters.\");\n  auto useEquirectangular{false};\n  app.add_flag(\"-e, --use_equirectangular\", useEquirectangular,\n               \"Use the equirectangular entry in the json file.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useCubemap = !useEquirectangular;\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"Brass\",\n                   std::array<unsigned char, 4>{184, 115, 51, 255}.data());\n  colors->SetColor(\"DarkTeal\",\n                   std::array<unsigned char, 4>{0, 128, 77, 255}.data());\n\n  vtkNew<vtkOpenGLRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  ren->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren->UseSphericalHarmonicsOn();\n    ren->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren->UseSphericalHarmonicsOff();\n    ren->SetEnvironmentTexture(envTexture, true);\n  }\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(75);\n  sphere->SetPhiResolution(75);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphere->GetOutputPort());\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 0.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Brass\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(0.1);\n    actorSphere->GetProperty()->SetCoatStrength(1.0);\n    actorSphere->GetProperty()->SetCoatRoughness(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 1.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"Brass\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(1.0);\n    actorSphere->GetProperty()->SetCoatStrength(1.0);\n    actorSphere->GetProperty()->SetCoatRoughness(i / 5.0);\n\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 2.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetMetallic(1.0);\n    actorSphere->GetProperty()->SetRoughness(0.1);\n    actorSphere->GetProperty()->SetCoatColor(\n        colors->GetColor3d(\"Red\").GetData());\n    actorSphere->GetProperty()->SetCoatRoughness(0.1);\n    actorSphere->GetProperty()->SetCoatStrength(i / 5.0);\n\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 3.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n    actorSphere->GetProperty()->SetRoughness(0.1);\n    actorSphere->GetProperty()->SetCoatColor(\n        colors->GetColor3d(\"Red\").GetData());\n    actorSphere->GetProperty()->SetCoatRoughness(1.0);\n    actorSphere->GetProperty()->SetCoatStrength(i / 5.0);\n    ren->AddActor(actorSphere);\n  }\n\n  for (int i = 0; i < 6; i++)\n  {\n    vtkNew<vtkActor> actorSphere;\n    actorSphere->SetPosition(i, 4.0, 0.0);\n    actorSphere->SetMapper(mapper);\n    actorSphere->GetProperty()->SetInterpolationToPBR();\n    actorSphere->GetProperty()->SetColor(\n        colors->GetColor3d(\"DarkTeal\").GetData());\n    actorSphere->GetProperty()->SetBaseIOR(1.0 + (i / 3.0));\n    ren->AddActor(actorSphere);\n  }\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren->AddActor(skybox);\n  }\n\n  renWin->SetWindowName(\"PBR_Materials_Coat\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/PBR_Materials_Coat/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Materials_Coat)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Materials_Coat: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Materials_Coat MACOSX_BUNDLE PBR_Materials_Coat.cxx )\n  target_link_libraries(PBR_Materials_Coat PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Materials_Coat\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/PBR_Materials_Coat/#download-and-build-pbr_materials_coat","title":"Download and Build PBR_Materials_Coat","text":"

        Click here to download PBR_Materials_Coat and its CMakeLists.txt file. Once the tarball PBR_Materials_Coat.tar has been downloaded and extracted,

        cd PBR_Materials_Coat/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PBR_Materials_Coat\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/PBR_Skybox/","title":"PBR Skybox","text":"

        vtk-examples/Cxx/Rendering/PBR_Skybox

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/PBR_Skybox/#description","title":"Description","text":"

        Demonstrates physically based rendering using image based lighting and a skybox.

        Physically based rendering sets color, metallicity and roughness of the object, sliders are provided so that you can experiment with the various parameters.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

        <DATA>/PBR_Skybox.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Cxx/Rendering/PBR_Skybox/#options","title":"Options","text":"
        Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

        Additionally, you can save a screenshot by pressing \"k\".

        "},{"location":"Cxx/Rendering/PBR_Skybox/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Skybox.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/PBR_Skybox/#code","title":"Code","text":"

        PBR_Skybox.cxx

        #include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCameraPass.h>\n#include <vtkCleanPolyData.h>\n#include <vtkClipPolyData.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLightsPass.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpaquePass.h>\n#include <vtkOpenGLRenderWindow.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkOverlayPass.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkParametricBoy.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSequencePass.h>\n#include <vtkSkybox.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTexture.h>\n#include <vtkTexturedSphereSource.h>\n#include <vtkToneMappingPass.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n// For writing out the image.\n#include <vtkImageWriter.h>\n#include <vtkJPEGWriter.h>\n#include <vtkPNGWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <memory>\n#include <numeric>\n#include <sstream>\n#include <string>\n#include <vector>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define VTK_HAS_COW 1\n#endif\n\n#if VTK_HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return True if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n// Some sample surfaces to try.\nvtkSmartPointer<vtkPolyData> GetBoy();\nvtkSmartPointer<vtkPolyData> GetMobius();\nvtkSmartPointer<vtkPolyData> GetRandomHills();\nvtkSmartPointer<vtkPolyData> GetTorus();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetClippedSphere();\nvtkSmartPointer<vtkPolyData> GetCube();\nvtkSmartPointer<vtkPolyData> GetClippedCube();\n\n/**\n * Generate u, v texture coordinates on a parametric surface.\n *\n * @param uResolution: u resolution\n * @param vResolution: v resolution\n * @param pd: The polydata representing the surface.\n *\n * @return The polydata with the texture coordinates added.\n */\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd);\n\nclass SliderCallbackExposure : public vtkCommand\n{\npublic:\n  static SliderCallbackExposure* New()\n  {\n    return new SliderCallbackExposure;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetExposure(value);\n  }\n  SliderCallbackExposure() : property(nullptr)\n  {\n  }\n  vtkToneMappingPass* property;\n};\n\nclass SliderCallbackMetallic : public vtkCommand\n{\npublic:\n  static SliderCallbackMetallic* New()\n  {\n    return new SliderCallbackMetallic;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetMetallic(value);\n  }\n  SliderCallbackMetallic() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackRoughness : public vtkCommand\n{\npublic:\n  static SliderCallbackRoughness* New()\n  {\n    return new SliderCallbackRoughness;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetRoughness(value);\n  }\n  SliderCallbackRoughness() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nstruct SliderProperties\n{\n  // Set up the sliders\n  double tubeWidth{0.008};\n  double sliderLength{0.075};\n  double sliderWidth{0.025};\n  double endCapLength = 0.025;\n  double endCapWidth = 0.025;\n  double titleHeight{0.025};\n  double labelHeight{0.020};\n\n  double minimumValue{0.0};\n  double maximumValue{1.0};\n  double initialValue{0.0};\n\n  std::array<double, 2> p1{0.02, 0.1};\n  std::array<double, 2> p2{0.18, 0.1};\n\n  std::string title{\"\"};\n\n  std::string titleColor{\"Black\"};\n  std::string labelColor{\"Black\"};\n  std::string valueColor{\"DarkSlateGray\"};\n  std::string sliderColor{\"BurlyWood\"};\n  std::string selectedColor{\"Lime\"};\n  std::string barColor{\"Black\"};\n  std::string barEndsColor{\"Indigo\"};\n};\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties);\n\nclass PrintCallback : public vtkCallbackCommand\n{\npublic:\n  PrintCallback() : fn_{\"\"}, imageQuality_(1), rgba_(true)\n  {\n  }\n\n  static PrintCallback* New()\n  {\n    return new PrintCallback;\n  }\n\n  /*\n   * Create a vtkCallbackCommand and reimplement it.\n   *\n   */\n  void Execute(vtkObject* caller, unsigned long /*evId*/, void*) override\n  {\n    if (this->fn_.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto rwi = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n\n    // Get the keypress\n    std::string key = rwi->GetKeySym();\n    if (key == \"k\" && !this->fn_.empty())\n    {\n      auto w2If = vtkSmartPointer<vtkWindowToImageFilter>::New();\n      w2If->SetInput(rwi->GetRenderWindow());\n      w2If->SetScale(this->imageQuality_, this->imageQuality_);\n      if (rgba_)\n      {\n        w2If->SetInputBufferTypeToRGBA();\n      }\n      else\n      {\n        w2If->SetInputBufferTypeToRGB();\n      }\n      // Read from the front buffer.\n      w2If->ReadFrontBufferOn();\n      w2If->Update();\n      std::vector<std::string> jpeg{\".jpeg\", \".jpg\"};\n      auto writer = vtkSmartPointer<vtkImageWriter>::New();\n      if (std::find(jpeg.begin(), jpeg.end(), ext_) != jpeg.end())\n      {\n        writer = vtkSmartPointer<vtkJPEGWriter>::New();\n      }\n      else\n      {\n        writer = vtkSmartPointer<vtkPNGWriter>::New();\n      }\n      writer->SetFileName(this->fn_.c_str());\n      writer->SetInputConnection(w2If->GetOutputPort());\n      writer->Write();\n      std::cout << \"Screenshot saved to: \" << writer->GetFileName()\n                << std::endl;\n    }\n  }\n\n  /**\n   * Set the parameters for writing the\n   *  render window view to an image file.\n   *\n   * @param fileName The png image file name.\n   * @param imageQuality The image quality.\n   * @param rgba The buffer type, (if true, there is no background in the\n   * screenshot).\n   *\n   */\n  void SetParameters(const std::string& fileName, int imageQuality = 1,\n                     bool rgba = true)\n  {\n    if (fileName.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n    auto pth = fs::absolute(fileName);\n    auto ext = pth.extension().generic_string();\n    if (!pth.has_extension())\n      ext = \".png\";\n    std::transform(ext.begin(), ext.end(), ext.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::vector<std::string> validSuffixes{\".jpeg\", \".jpg\", \".png\"};\n    if (std::find(validSuffixes.begin(), validSuffixes.end(), ext) ==\n        validSuffixes.end())\n    {\n      ext = \".png\";\n    }\n    this->ext_ = ext;\n    this->fn_ = pth.replace_extension(this->ext_).generic_string();\n    this->imageQuality_ = imageQuality;\n    this->rgba_ = rgba;\n  }\n\nprivate:\n  PrintCallback(const PrintCallback&) = delete;\n  void operator=(const PrintCallback&) = delete;\n\n  std::string fn_;\n  std::string ext_;\n  int imageQuality_;\n  bool rgba_;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (!VTKVersionOk(9, 0, 0))\n  {\n    std::cerr << \"You need VTK version 9.0 or greater to run this program.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  CLI::App app{\"Demonstrates physically based rendering, image based lighting \"\n               \"and a skybox.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Skybox.json.\");\n  std::string surfaceName;\n  app.add_option(\"-s, --surface\", surfaceName,\n                 \"The name of the surface. Overrides the surface entry in the \"\n                 \"json file.\");\n  auto useCubemap{false};\n  app.add_flag(\"-c, --use_cubemap\", useCubemap,\n               \"Build the cubemap from the six cubemap files. Overrides the \"\n               \"equirectangular entry in the json file.\");\n  auto useTonemapping{false};\n  app.add_flag(\"-t, --use_tonemapping\", useTonemapping, \"Use tone mapping.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  if (!surfaceName.empty())\n  {\n    parameters.parameters[\"object\"] = surfaceName;\n  }\n\n  // Check for missing parameters.\n  if (parameters.parameters.find(\"bkgcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"bkgcolor\"] = \"BkgColor\";\n  }\n  if (parameters.parameters.find(\"objcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"objcolor\"] = \"White\";\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  // Build the pipeline.\n  // ren1 is for the slider rendering,\n  // ren2 is for the object rendering.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkOpenGLRenderer> ren2;\n  ren1->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n  ren2->SetBackground(\n      colors->GetColor3d(parameters.parameters[\"bkgcolor\"]).GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  // The order here is important.\n  // This ensures that the sliders will be in ren1.\n  renderWindow->AddRenderer(ren2);\n  renderWindow->AddRenderer(ren1);\n  ren1->SetViewport(0.0, 0.0, 0.2, 1.0);\n  ren2->SetViewport(0.2, 0.0, 1, 1);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  // Set up tone mapping so we can vary the exposure.\n  // Custom Passes.\n  vtkNew<vtkCameraPass> cameraP;\n  vtkNew<vtkSequencePass> seq;\n  vtkNew<vtkOpaquePass> opaque;\n  vtkNew<vtkLightsPass> lights;\n  vtkNew<vtkOverlayPass> overlay;\n\n  vtkNew<vtkRenderPassCollection> passes;\n  passes->AddItem(lights);\n  passes->AddItem(opaque);\n  passes->AddItem(overlay);\n  seq->SetPasses(passes);\n  cameraP->SetDelegatePass(seq);\n\n  vtkNew<vtkToneMappingPass> toneMappingP;\n  toneMappingP->SetToneMappingType(vtkToneMappingPass::GenericFilmic);\n  toneMappingP->SetGenericFilmicUncharted2Presets();\n  toneMappingP->SetExposure(1.0);\n  toneMappingP->SetDelegatePass(cameraP);\n\n  if (useTonemapping)\n  {\n    vtkOpenGLRenderer::SafeDownCast(ren2)->SetPass(toneMappingP);\n  }\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren2->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Turn off the default lighting and use image based lighting.\n  ren2->AutomaticLightCreationOff();\n  ren2->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren2->UseSphericalHarmonicsOn();\n    ren2->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren2->UseSphericalHarmonicsOff();\n    ren2->SetEnvironmentTexture(envTexture, true);\n  }\n\n  // Get the surface.\n  std::string desiredSurface = parameters.parameters[\"object\"];\n  std::transform(desiredSurface.begin(), desiredSurface.end(),\n                 desiredSurface.begin(),\n                 [](char c) { return std::tolower(c); });\n  std::map<std::string, int> availableSurfaces = {\n      {\"boy\", 0},   {\"mobius\", 1},     {\"randomhills\", 2},\n      {\"torus\", 3}, {\"sphere\", 4},     {\"clippedsphere\", 5},\n      {\"cube\", 6},  {\"clippedcube\", 7}};\n  if (availableSurfaces.find(desiredSurface) == availableSurfaces.end())\n  {\n    std::cout << \"The requested surface: \" << parameters.parameters[\"object\"]\n              << \" not found, reverting to Boys Surface.\" << std::endl;\n    desiredSurface = \"boy\";\n  }\n  vtkSmartPointer<vtkPolyData> source;\n  switch (availableSurfaces[desiredSurface])\n  {\n  case 1:\n    source = GetMobius();\n    break;\n  case 2:\n    source = GetRandomHills();\n    break;\n  case 3:\n    source = GetTorus();\n    break;\n  case 4:\n    source = GetSphere();\n    break;\n  case 5:\n    source = GetClippedSphere();\n    break;\n  case 6:\n    source = GetCube();\n    break;\n  case 7:\n    source = GetClippedCube();\n    break;\n  case 0:\n  default:\n    source = GetBoy();\n  };\n\n  // Lets use a smooth metallic surface.\n  auto diffuseCoefficient = 1.0;\n  auto roughnessCoefficient = 0.0;\n  auto metallicCoefficient = 1.0;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(source);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Enable PBR on the model.\n  actor->GetProperty()->SetInterpolationToPBR();\n  // Configure the basic properties.\n  actor->GetProperty()->SetColor(\n      colors->GetColor4d(parameters.parameters[\"objcolor\"]).GetData());\n  actor->GetProperty()->SetDiffuse(diffuseCoefficient);\n  actor->GetProperty()->SetRoughness(roughnessCoefficient);\n  actor->GetProperty()->SetMetallic(metallicCoefficient);\n  ren2->AddActor(actor);\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren2->AddActor(skybox);\n  }\n\n  // Create the slider callbacks to manipulate various parameters.\n\n  auto stepSize = 1.0 / 3.0;\n  auto posY = 0.1;\n  auto posX0 = 0.02;\n  auto posX1 = 0.18;\n\n  auto slwP = SliderProperties();\n\n  slwP.initialValue = 1.0;\n  slwP.maximumValue = 5.0;\n  slwP.title = \"Exposure\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swExposure = MakeSliderWidget(slwP);\n  swExposure->SetInteractor(interactor);\n  swExposure->SetAnimationModeToAnimate();\n  if (useTonemapping)\n  {\n    swExposure->EnabledOn();\n  }\n  else\n  {\n    swExposure->EnabledOff();\n  }\n  swExposure->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackExposure> swExpCB;\n  swExpCB->property = dynamic_cast<vtkToneMappingPass*>(ren2->GetPass());\n  swExposure->AddObserver(vtkCommand::InteractionEvent, swExpCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = metallicCoefficient;\n  slwP.maximumValue = 1.0;\n  slwP.title = \"Metallicity\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swMetallic = MakeSliderWidget(slwP);\n  swMetallic->SetInteractor(interactor);\n  swMetallic->SetAnimationModeToAnimate();\n  swMetallic->EnabledOn();\n  swMetallic->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackMetallic> swMetallicCB;\n  swMetallicCB->property = actor->GetProperty();\n  swMetallic->AddObserver(vtkCommand::InteractionEvent, swMetallicCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = roughnessCoefficient;\n  slwP.title = \"Roughness\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swRoughness = MakeSliderWidget(slwP);\n  swRoughness->SetInteractor(interactor);\n  swRoughness->SetAnimationModeToAnimate();\n  swRoughness->EnabledOn();\n  swRoughness->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackRoughness> swRoughnessCB;\n  swRoughnessCB->property = actor->GetProperty();\n  swRoughness->AddObserver(vtkCommand::InteractionEvent, swRoughnessCB);\n\n  auto name = fs::path(argv[0]).stem().generic_string();\n  renderWindow->SetSize(1000, 625);\n  renderWindow->Render();\n  renderWindow->SetWindowName(name.c_str());\n\n#if VTK_HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(ren2);\n  // Enable the widget.\n  camOrientManipulator->On();\n#else\n  vtkNew<vtkAxesActor> axes;\n\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  double rgba[4]{0.0, 0.0, 0.0, 0.0};\n  colors->GetColor(\"Carrot\", rgba);\n  widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n  widget->SetOrientationMarker(axes);\n  widget->SetInteractor(interactor);\n  widget->SetViewport(0.0, 0.0, 0.2, 0.2);\n  widget->EnabledOn();\n  widget->InteractiveOn();\n#endif\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<PrintCallback> printCallback;\n  printCallback->SetParameters(name, 1, false);\n  // printCallback->SetParameters(name + \".jpg\", 1, false);\n  interactor->AddObserver(vtkCommand::KeyPressEvent, printCallback);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n#ifndef VTK_VERSION_NUMBER\n  vtkNew<vtkVersion>();\n  ver;\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  if (vtk_version_number >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#else\n  if (VTK_VERSION_NUMBER >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#endif\n}\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\nvtkSmartPointer<vtkPolyData> GetBoy()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricBoy> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetMobius()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricMobius> surface;\n  surface->SetMinimumV(-0.25);\n  surface->SetMaximumV(0.25);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetRandomHills()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricRandomHills> surface;\n  surface->SetRandomSeed(1);\n  surface->SetNumberOfHills(30);\n  // If you want a plane\n  // surface->SetHillAmplitude(0);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricTorus> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(surface->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, 0);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(surface->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(clipper->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(3);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(subdivide->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(5);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, -1);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(subdivide->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(clipper->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(cleaner->GetOutputPort());\n  normals->FlipNormalsOn();\n  normals->SetFeatureAngle(60);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(normals->GetOutputPort());\n  tangents->ComputeCellTangentsOn();\n  tangents->ComputePointTangentsOn();\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd)\n{\n  float u0 = 1.0;\n  float v0 = 0.0;\n  float du = 1.0 / (uResolution - 1.0);\n  float dv = 1.0 / (vResolution - 1.0);\n  vtkIdType numPts = pd->GetNumberOfPoints();\n  vtkNew<vtkFloatArray> tCoords;\n  tCoords->SetNumberOfComponents(2);\n  tCoords->SetNumberOfTuples(numPts);\n  tCoords->SetName(\"Texture Coordinates\");\n  vtkIdType ptId = 0;\n  float u = u0;\n  for (auto i = 0; i < uResolution; ++i)\n  {\n    float v = v0;\n    for (auto j = 0; j < vResolution; ++j)\n    {\n      float tc[2]{u, v};\n      tCoords->SetTuple(ptId, tc);\n      v += dv;\n      ptId++;\n    }\n    u -= du;\n  }\n  pd->GetPointData()->SetTCoords(tCoords);\n  return pd;\n}\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkSliderRepresentation2D> slider;\n\n  slider->SetMinimumValue(properties.minimumValue);\n  slider->SetMaximumValue(properties.maximumValue);\n  slider->SetValue(properties.initialValue);\n  slider->SetTitleText(properties.title.c_str());\n\n  slider->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint1Coordinate()->SetValue(properties.p1[0], properties.p1[1]);\n  slider->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint2Coordinate()->SetValue(properties.p2[0], properties.p2[1]);\n\n  slider->SetTubeWidth(properties.tubeWidth);\n  slider->SetSliderLength(properties.sliderLength);\n  slider->SetSliderWidth(properties.sliderWidth);\n  slider->SetEndCapLength(properties.endCapLength);\n  slider->SetEndCapWidth(properties.endCapWidth);\n  slider->SetTitleHeight(properties.titleHeight);\n  slider->SetLabelHeight(properties.labelHeight);\n\n  // Set the color properties\n  // Change the color of the title.\n  slider->GetTitleProperty()->SetColor(\n      colors->GetColor3d(properties.titleColor).GetData());\n  // Change the color of the label.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.labelColor).GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(\n      colors->GetColor3d(properties.barColor).GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(\n      colors->GetColor3d(properties.barEndsColor).GetData());\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(\n      colors->GetColor3d(properties.sliderColor).GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(properties.selectedColor).GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.valueColor).GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetRepresentation(slider);\n\n  return sliderWidget;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/PBR_Skybox/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Skybox)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Skybox: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Skybox MACOSX_BUNDLE PBR_Skybox.cxx )\n  target_link_libraries(PBR_Skybox PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Skybox\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/PBR_Skybox/#download-and-build-pbr_skybox","title":"Download and Build PBR_Skybox","text":"

        Click here to download PBR_Skybox and its CMakeLists.txt file. Once the tarball PBR_Skybox.tar has been downloaded and extracted,

        cd PBR_Skybox/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PBR_Skybox\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/","title":"PBR Skybox Anisotropy","text":"

        vtk-examples/Cxx/Rendering/PBR_Skybox_Anisotropy

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#description","title":"Description","text":"

        Demonstrates physically based rendering (PBR) using image based lighting, anisotropic texturing and a skybox.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

        <DATA>/PBR_Skybox_Anisotropy.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#options","title":"Options","text":"
        Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

        Additionally, you can save a screenshot by pressing \"k\".

        "},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Skybox_Anisotropy.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#code","title":"Code","text":"

        PBR_Skybox_Anisotropy.cxx

        #include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCameraPass.h>\n#include <vtkCleanPolyData.h>\n#include <vtkClipPolyData.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLightsPass.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpaquePass.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkOverlayPass.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkParametricBoy.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSequencePass.h>\n#include <vtkSkybox.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTexture.h>\n#include <vtkTexturedSphereSource.h>\n#include <vtkToneMappingPass.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n// For writing out the image.\n#include <vtkImageWriter.h>\n#include <vtkJPEGWriter.h>\n#include <vtkPNGWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <numeric>\n#include <sstream>\n#include <string>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define VTK_HAS_COW 1\n#endif\n\n#if VTK_HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return True if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n/**\n * Read an image and convert it to a texture.\n *\n * @param path: The image path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadTexture(std::string path);\n\n/**\n * Check that the needed textures exist.\n *\n * @param parameters:  The parameters.\n * @param wantedTextures: The wanted textures.\n *\n * @return true if all the wanted textures are present.\n */\nbool CheckForMissingTextures(Parameters& parameters,\n                             std::vector<std::string> const& wantedTextures);\n\n// Some sample surfaces to try.\nvtkSmartPointer<vtkPolyData> GetBoy();\nvtkSmartPointer<vtkPolyData> GetMobius();\nvtkSmartPointer<vtkPolyData> GetRandomHills();\nvtkSmartPointer<vtkPolyData> GetTorus();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetClippedSphere();\nvtkSmartPointer<vtkPolyData> GetCube();\nvtkSmartPointer<vtkPolyData> GetClippedCube();\n\n/**\n * Generate u, v texture coordinates on a parametric surface.\n *\n * @param uResolution: u resolution\n * @param vResolution: v resolution\n * @param pd: The polydata representing the surface.\n *\n * @return The polydata with the texture coordinates added.\n */\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd);\n\nclass SliderCallbackExposure : public vtkCommand\n{\npublic:\n  static SliderCallbackExposure* New()\n  {\n    return new SliderCallbackExposure;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetExposure(value);\n  }\n  SliderCallbackExposure() : property(nullptr)\n  {\n  }\n  vtkToneMappingPass* property;\n};\n\nclass SliderCallbackMetallic : public vtkCommand\n{\npublic:\n  static SliderCallbackMetallic* New()\n  {\n    return new SliderCallbackMetallic;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetMetallic(value);\n  }\n  SliderCallbackMetallic() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackRoughness : public vtkCommand\n{\npublic:\n  static SliderCallbackRoughness* New()\n  {\n    return new SliderCallbackRoughness;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetRoughness(value);\n  }\n  SliderCallbackRoughness() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackOcclusionStrength : public vtkCommand\n{\npublic:\n  static SliderCallbackOcclusionStrength* New()\n  {\n    return new SliderCallbackOcclusionStrength;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetOcclusionStrength(value);\n  }\n  SliderCallbackOcclusionStrength() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackNormalScale : public vtkCommand\n{\npublic:\n  static SliderCallbackNormalScale* New()\n  {\n    return new SliderCallbackNormalScale;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetNormalScale(value);\n  }\n  SliderCallbackNormalScale() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackAnisotropy : public vtkCommand\n{\npublic:\n  static SliderCallbackAnisotropy* New()\n  {\n    return new SliderCallbackAnisotropy;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetAnisotropy(value);\n  }\n  SliderCallbackAnisotropy() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackAnisotropyRotation : public vtkCommand\n{\npublic:\n  static SliderCallbackAnisotropyRotation* New()\n  {\n    return new SliderCallbackAnisotropyRotation;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetAnisotropyRotation(value);\n  }\n  SliderCallbackAnisotropyRotation() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nstruct SliderProperties\n{\n  // Set up the sliders\n  double tubeWidth{0.008};\n  double sliderLength{0.075};\n  double sliderWidth{0.025};\n  double endCapLength = 0.025;\n  double endCapWidth = 0.025;\n  double titleHeight{0.025};\n  double labelHeight{0.020};\n\n  double minimumValue{0.0};\n  double maximumValue{1.0};\n  double initialValue{0.0};\n\n  std::array<double, 2> p1{0.02, 0.1};\n  std::array<double, 2> p2{0.18, 0.1};\n\n  std::string title{\"\"};\n\n  std::string titleColor{\"Black\"};\n  std::string labelColor{\"Black\"};\n  std::string valueColor{\"DarkSlateGray\"};\n  std::string sliderColor{\"BurlyWood\"};\n  std::string selectedColor{\"Lime\"};\n  std::string barColor{\"Black\"};\n  std::string barEndsColor{\"Indigo\"};\n};\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties);\n\nclass PrintCallback : public vtkCallbackCommand\n{\npublic:\n  PrintCallback() : fn_{\"\"}, imageQuality_(1), rgba_(true)\n  {\n  }\n\n  static PrintCallback* New()\n  {\n    return new PrintCallback;\n  }\n\n  /*\n   * Create a vtkCallbackCommand and reimplement it.\n   *\n   */\n  void Execute(vtkObject* caller, unsigned long /*evId*/, void*) override\n  {\n    if (this->fn_.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto rwi = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n\n    // Get the keypress\n    std::string key = rwi->GetKeySym();\n    if (key == \"k\" && !this->fn_.empty())\n    {\n      auto w2If = vtkSmartPointer<vtkWindowToImageFilter>::New();\n      w2If->SetInput(rwi->GetRenderWindow());\n      w2If->SetScale(this->imageQuality_, this->imageQuality_);\n      if (rgba_)\n      {\n        w2If->SetInputBufferTypeToRGBA();\n      }\n      else\n      {\n        w2If->SetInputBufferTypeToRGB();\n      }\n      // Read from the front buffer.\n      w2If->ReadFrontBufferOn();\n      w2If->Update();\n      std::vector<std::string> jpeg{\".jpeg\", \".jpg\"};\n      auto writer = vtkSmartPointer<vtkImageWriter>::New();\n      if (std::find(jpeg.begin(), jpeg.end(), ext_) != jpeg.end())\n      {\n        writer = vtkSmartPointer<vtkJPEGWriter>::New();\n      }\n      else\n      {\n        writer = vtkSmartPointer<vtkPNGWriter>::New();\n      }\n      writer->SetFileName(this->fn_.c_str());\n      writer->SetInputConnection(w2If->GetOutputPort());\n      writer->Write();\n      std::cout << \"Screenshot saved to: \" << writer->GetFileName()\n                << std::endl;\n    }\n  }\n\n  /**\n   * Set the parameters for writing the\n   *  render window view to an image file.\n   *\n   * @param fileName The png image file name.\n   * @param imageQuality The image quality.\n   * @param rgba The buffer type, (if true, there is no background in the\n   * screenshot).\n   *\n   */\n  void SetParameters(const std::string& fileName, int imageQuality = 1,\n                     bool rgba = true)\n  {\n    if (fileName.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n    auto pth = fs::absolute(fileName);\n    auto ext = pth.extension().generic_string();\n    if (!pth.has_extension())\n      ext = \".png\";\n    std::transform(ext.begin(), ext.end(), ext.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::vector<std::string> validSuffixes{\".jpeg\", \".jpg\", \".png\"};\n    if (std::find(validSuffixes.begin(), validSuffixes.end(), ext) ==\n        validSuffixes.end())\n    {\n      ext = \".png\";\n    }\n    this->ext_ = ext;\n    this->fn_ = pth.replace_extension(this->ext_).generic_string();\n    this->imageQuality_ = imageQuality;\n    this->rgba_ = rgba;\n  }\n\nprivate:\n  PrintCallback(const PrintCallback&) = delete;\n  void operator=(const PrintCallback&) = delete;\n\n  std::string fn_;\n  std::string ext_;\n  int imageQuality_;\n  bool rgba_;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (!VTKVersionOk(9, 0, 0))\n  {\n    std::cerr << \"You need VTK version 9.0 or greater to run this program.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  CLI::App app{\"Demonstrates physically based rendering, a skybox, \"\n               \"image based lighting and anisotropic texturing.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters e.g. \"\n                 \"PBR_Skybox_Anisotropy.json.\");\n  std::string surfaceName;\n  app.add_option(\"-s, --surface\", surfaceName,\n                 \"The name of the surface. Overrides the surface entry in the \"\n                 \"json file.\");\n  auto useCubemap{false};\n  app.add_flag(\"-c, --use_cubemap\", useCubemap,\n               \"Build the cubemap from the six cubemap files. Overrides the \"\n               \"equirectangular entry in the json file.\");\n  auto useTonemapping{false};\n  app.add_flag(\"-t, --use_tonemapping\", useTonemapping, \"Use tone mapping.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  if (!surfaceName.empty())\n  {\n    parameters.parameters[\"object\"] = surfaceName;\n  }\n\n  // Check for missing parameters.\n  if (parameters.parameters.find(\"bkgcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"bkgcolor\"] = \"BkgColor\";\n  }\n  if (parameters.parameters.find(\"objcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"objcolor\"] = \"White\";\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  std::vector<std::string> wantedTextures{\"albedo\", \"normal\", \"material\",\n                                          \"anisotropy\"};\n  if (!CheckForMissingTextures(parameters, wantedTextures))\n  {\n    return EXIT_FAILURE;\n  }\n\n  // Build the pipeline.\n  // ren1 is for the slider rendering,\n  // ren2 is for the object rendering.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkOpenGLRenderer> ren2;\n  ren1->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n  ren2->SetBackground(\n      colors->GetColor3d(parameters.parameters[\"bkgcolor\"]).GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  // The order here is important.\n  // This ensures that the sliders will be in ren1.\n  renderWindow->AddRenderer(ren2);\n  renderWindow->AddRenderer(ren1);\n  ren1->SetViewport(0.0, 0.0, 0.2, 1.0);\n  ren2->SetViewport(0.2, 0.0, 1, 1);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  // Set up tone mapping so we can vary the exposure.\n  // Custom Passes.\n  vtkNew<vtkCameraPass> cameraP;\n  vtkNew<vtkSequencePass> seq;\n  vtkNew<vtkOpaquePass> opaque;\n  vtkNew<vtkLightsPass> lights;\n  vtkNew<vtkOverlayPass> overlay;\n\n  vtkNew<vtkRenderPassCollection> passes;\n  passes->AddItem(lights);\n  passes->AddItem(opaque);\n  passes->AddItem(overlay);\n  seq->SetPasses(passes);\n  cameraP->SetDelegatePass(seq);\n\n  vtkNew<vtkToneMappingPass> toneMappingP;\n  toneMappingP->SetToneMappingType(vtkToneMappingPass::GenericFilmic);\n  toneMappingP->SetGenericFilmicUncharted2Presets();\n  toneMappingP->SetExposure(1.0);\n  toneMappingP->SetDelegatePass(cameraP);\n\n  if (useTonemapping)\n  {\n    vtkOpenGLRenderer::SafeDownCast(ren2)->SetPass(toneMappingP);\n  }\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren2->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Turn off the default lighting and use image based lighting.\n  ren2->AutomaticLightCreationOff();\n  ren2->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren2->UseSphericalHarmonicsOn();\n    ren2->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren2->UseSphericalHarmonicsOff();\n    ren2->SetEnvironmentTexture(envTexture, true);\n  }\n\n  // Get the textures.\n  auto baseColor = ReadTexture(parameters.parameters[\"albedo\"]);\n  baseColor->SetColorModeToDirectScalars();\n  baseColor->UseSRGBColorSpaceOn();\n  auto normal = ReadTexture(parameters.parameters[\"normal\"]);\n  normal->SetColorModeToDirectScalars();\n  auto material = ReadTexture(parameters.parameters[\"material\"]);\n  material->SetColorModeToDirectScalars();\n  auto anisotropy = ReadTexture(parameters.parameters[\"anisotropy\"]);\n  anisotropy->SetColorModeToDirectScalars();\n\n  // Get the surface.\n  std::string desiredSurface = parameters.parameters[\"object\"];\n  std::transform(desiredSurface.begin(), desiredSurface.end(),\n                 desiredSurface.begin(),\n                 [](char c) { return std::tolower(c); });\n  std::map<std::string, int> availableSurfaces = {\n      {\"boy\", 0},   {\"mobius\", 1},     {\"randomhills\", 2},\n      {\"torus\", 3}, {\"sphere\", 4},     {\"clippedsphere\", 5},\n      {\"cube\", 6},  {\"clippedcube\", 7}};\n  if (availableSurfaces.find(desiredSurface) == availableSurfaces.end())\n  {\n    std::cout << \"The requested surface: \" << parameters.parameters[\"object\"]\n              << \" not found, reverting to Boys Surface.\" << std::endl;\n    desiredSurface = \"boy\";\n  }\n  vtkSmartPointer<vtkPolyData> source;\n  switch (availableSurfaces[desiredSurface])\n  {\n  case 1:\n    source = GetMobius();\n    break;\n  case 2:\n    source = GetRandomHills();\n    break;\n  case 3:\n    source = GetTorus();\n    break;\n  case 4:\n    source = GetSphere();\n    break;\n  case 5:\n    source = GetClippedSphere();\n    break;\n  case 6:\n    source = GetCube();\n    break;\n  case 7:\n    source = GetClippedCube();\n    break;\n  case 0:\n  default:\n    source = GetBoy();\n  };\n\n  // Let's use a nonmetallic surface.\n  auto diffuseCoefficient = 1.0;\n  auto roughnessCoefficient = 0.3;\n  auto metallicCoefficient = 0.0;\n  // Other parameters.\n  auto occlusionStrength = 1.0;\n  auto normalScale = 1.0;\n  auto anisotropyCoefficient = 1.0;\n  auto anisotropyRotation = 0.0;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(source);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  // Enable PBR on the model.\n  actor->GetProperty()->SetInterpolationToPBR();\n  // Configure the basic properties.\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n  actor->GetProperty()->SetDiffuse(diffuseCoefficient);\n  actor->GetProperty()->SetRoughness(roughnessCoefficient);\n  actor->GetProperty()->SetMetallic(metallicCoefficient);\n  // Configure textures (needs tcoords on the mesh).\n  actor->GetProperty()->SetBaseColorTexture(baseColor);\n  actor->GetProperty()->SetORMTexture(material);\n  actor->GetProperty()->SetOcclusionStrength(occlusionStrength);\n  // Needs tcoords, normals and tangents on the mesh.\n  actor->GetProperty()->SetNormalTexture(normal);\n  actor->GetProperty()->SetNormalScale(normalScale);\n  actor->GetProperty()->SetAnisotropyTexture(anisotropy);\n  actor->GetProperty()->SetAnisotropy(anisotropyCoefficient);\n  actor->GetProperty()->SetAnisotropyRotation(anisotropyRotation);\n  ren2->AddActor(actor);\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren2->AddActor(skybox);\n  }\n\n  // Create the slider callbacks to manipulate various parameters.\n\n  auto stepSize = 1.0 / 7.0;\n  auto posY = 0.1;\n  auto posX0 = 0.02;\n  auto posX1 = 0.18;\n\n  auto slwP = SliderProperties();\n\n  slwP.initialValue = 1.0;\n  slwP.maximumValue = 5.0;\n  slwP.title = \"Exposure\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swExposure = MakeSliderWidget(slwP);\n  swExposure->SetInteractor(interactor);\n  swExposure->SetAnimationModeToAnimate();\n  if (useTonemapping)\n  {\n    swExposure->EnabledOn();\n  }\n  else\n  {\n    swExposure->EnabledOff();\n  }\n  swExposure->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackExposure> swExpCB;\n  swExpCB->property = dynamic_cast<vtkToneMappingPass*>(ren2->GetPass());\n  swExposure->AddObserver(vtkCommand::InteractionEvent, swExpCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = metallicCoefficient;\n  slwP.maximumValue = 1.0;\n  slwP.title = \"Metallicity\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swMetallic = MakeSliderWidget(slwP);\n  swMetallic->SetInteractor(interactor);\n  swMetallic->SetAnimationModeToAnimate();\n  swMetallic->EnabledOn();\n  swMetallic->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackMetallic> swMetallicCB;\n  swMetallicCB->property = actor->GetProperty();\n  swMetallic->AddObserver(vtkCommand::InteractionEvent, swMetallicCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = roughnessCoefficient;\n  slwP.title = \"Roughness\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swRoughness = MakeSliderWidget(slwP);\n  swRoughness->SetInteractor(interactor);\n  swRoughness->SetAnimationModeToAnimate();\n  swRoughness->EnabledOn();\n  swRoughness->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackRoughness> swRoughnessCB;\n  swRoughnessCB->property = actor->GetProperty();\n  swRoughness->AddObserver(vtkCommand::InteractionEvent, swRoughnessCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = occlusionStrength;\n  slwP.maximumValue = 5.0;\n  slwP.title = \"Occlusion\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swOccStr = MakeSliderWidget(slwP);\n  swOccStr->SetInteractor(interactor);\n  swOccStr->SetAnimationModeToAnimate();\n  swOccStr->EnabledOn();\n  swOccStr->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackOcclusionStrength> swOccStrCB;\n  swOccStrCB->property = actor->GetProperty();\n  swOccStr->AddObserver(vtkCommand::InteractionEvent, swOccStrCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = normalScale;\n  slwP.maximumValue = 5;\n  slwP.title = \"Normal\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swNormal = MakeSliderWidget(slwP);\n  swNormal->SetInteractor(interactor);\n  swNormal->SetAnimationModeToAnimate();\n  swNormal->EnabledOn();\n  swNormal->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackNormalScale> swNormalCB;\n  swNormalCB->property = actor->GetProperty();\n  swNormal->AddObserver(vtkCommand::InteractionEvent, swNormalCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = anisotropyCoefficient;\n  slwP.maximumValue = 1;\n  slwP.title = \"Anisotropy\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swAnisotropy = MakeSliderWidget(slwP);\n  swAnisotropy->SetInteractor(interactor);\n  swAnisotropy->SetAnimationModeToAnimate();\n  swAnisotropy->EnabledOn();\n  swAnisotropy->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackAnisotropy> swAnisotropyCB;\n  swAnisotropyCB->property = actor->GetProperty();\n  swAnisotropy->AddObserver(vtkCommand::InteractionEvent, swAnisotropyCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = anisotropyRotation;\n  slwP.maximumValue = 1;\n  slwP.title = \"Anisotropy Rotation\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n  // posY += stepSize;\n\n  auto swAnisotropyRotation = MakeSliderWidget(slwP);\n  swAnisotropyRotation->SetInteractor(interactor);\n  swAnisotropyRotation->SetAnimationModeToAnimate();\n  swAnisotropyRotation->EnabledOn();\n  swAnisotropyRotation->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackAnisotropyRotation> swAnisotropyRotationCB;\n  swAnisotropyRotationCB->property = actor->GetProperty();\n  swAnisotropyRotation->AddObserver(vtkCommand::InteractionEvent,\n                                    swAnisotropyRotationCB);\n\n  auto name = fs::path(argv[0]).stem().generic_string();\n  renderWindow->SetSize(1000, 625);\n  renderWindow->Render();\n  renderWindow->SetWindowName(name.c_str());\n\n#if VTK_HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(ren2);\n  // Enable the widget.\n  camOrientManipulator->On();\n#else\n  vtkNew<vtkAxesActor> axes;\n\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  double rgba[4]{0.0, 0.0, 0.0, 0.0};\n  colors->GetColor(\"Carrot\", rgba);\n  widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n  widget->SetOrientationMarker(axes);\n  widget->SetInteractor(interactor);\n  widget->SetViewport(0.0, 0.0, 0.2, 0.2);\n  widget->EnabledOn();\n  widget->InteractiveOn();\n#endif\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<PrintCallback> printCallback;\n  printCallback->SetParameters(name, 1, false);\n  // printCallback->SetParameters(name + \".jpg\", 1, false);\n  interactor->AddObserver(vtkCommand::KeyPressEvent, printCallback);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n#ifndef VTK_VERSION_NUMBER\n  vtkNew<vtkVersion>();\n  ver;\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  if (vtk_version_number >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#else\n  if (VTK_VERSION_NUMBER >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#endif\n}\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\nvtkNew<vtkTexture> ReadTexture(std::string path)\n{\n  // Read the image which will be the texture\n  std::string extension;\n  if (path.find_last_of(\".\") != std::string::npos)\n  {\n    extension = path.substr(path.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  std::vector<std::string> validExtensions{\".jpg\", \".png\", \".bmp\", \".tiff\",\n                                           \".pnm\", \".pgm\", \".ppm\"};\n  vtkNew<vtkTexture> texture;\n  texture->InterpolateOn();\n\n  if (std::find(validExtensions.begin(), validExtensions.end(), extension) ==\n      validExtensions.end())\n  {\n    std::cout << \"Unable to read the texture file:\" << path << std::endl;\n    return texture;\n  }\n  // Read the images\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imgReader;\n  imgReader.TakeReference(readerFactory->CreateImageReader2(path.c_str()));\n  imgReader->SetFileName(path.c_str());\n\n  texture->SetInputConnection(imgReader->GetOutputPort());\n  texture->Update();\n\n  return texture;\n}\n\nbool CheckForMissingTextures(Parameters& parameters,\n                             std::vector<std::string> const& wantedTextures)\n{\n  bool haveTextures = true;\n\n  for (auto const& textureName : wantedTextures)\n  {\n    if (parameters.parameters.find(\"equirectangular\") ==\n        parameters.parameters.end())\n    {\n      std::cerr << \"Missing texture: \" << textureName << std::endl;\n      haveTextures = false;\n    }\n    else if (parameters.parameters[textureName].empty())\n    {\n      std::cerr << \"No texture path for: \" << textureName << std::endl;\n      haveTextures = false;\n    }\n  }\n\n  return haveTextures;\n}\n\nvtkSmartPointer<vtkPolyData> GetBoy()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricBoy> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetMobius()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricMobius> surface;\n  surface->SetMinimumV(-0.25);\n  surface->SetMaximumV(0.25);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetRandomHills()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricRandomHills> surface;\n  surface->SetRandomSeed(1);\n  surface->SetNumberOfHills(30);\n  // If you want a plane\n  // surface->SetHillAmplitude(0);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricTorus> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(surface->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, 0);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(surface->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(clipper->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(3);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(subdivide->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(5);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, -1);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(subdivide->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(clipper->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(cleaner->GetOutputPort());\n  normals->FlipNormalsOn();\n  normals->SetFeatureAngle(60);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(normals->GetOutputPort());\n  tangents->ComputeCellTangentsOn();\n  tangents->ComputePointTangentsOn();\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd)\n{\n  float u0 = 1.0;\n  float v0 = 0.0;\n  float du = 1.0 / (uResolution - 1.0);\n  float dv = 1.0 / (vResolution - 1.0);\n  vtkIdType numPts = pd->GetNumberOfPoints();\n  vtkNew<vtkFloatArray> tCoords;\n  tCoords->SetNumberOfComponents(2);\n  tCoords->SetNumberOfTuples(numPts);\n  tCoords->SetName(\"Texture Coordinates\");\n  vtkIdType ptId = 0;\n  float u = u0;\n  for (auto i = 0; i < uResolution; ++i)\n  {\n    float v = v0;\n    for (auto j = 0; j < vResolution; ++j)\n    {\n      float tc[2]{u, v};\n      tCoords->SetTuple(ptId, tc);\n      v += dv;\n      ptId++;\n    }\n    u -= du;\n  }\n  pd->GetPointData()->SetTCoords(tCoords);\n  return pd;\n}\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkSliderRepresentation2D> slider;\n\n  slider->SetMinimumValue(properties.minimumValue);\n  slider->SetMaximumValue(properties.maximumValue);\n  slider->SetValue(properties.initialValue);\n  slider->SetTitleText(properties.title.c_str());\n\n  slider->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint1Coordinate()->SetValue(properties.p1[0], properties.p1[1]);\n  slider->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint2Coordinate()->SetValue(properties.p2[0], properties.p2[1]);\n\n  slider->SetTubeWidth(properties.tubeWidth);\n  slider->SetSliderLength(properties.sliderLength);\n  slider->SetSliderWidth(properties.sliderWidth);\n  slider->SetEndCapLength(properties.endCapLength);\n  slider->SetEndCapWidth(properties.endCapWidth);\n  slider->SetTitleHeight(properties.titleHeight);\n  slider->SetLabelHeight(properties.labelHeight);\n\n  // Set the color properties\n  // Change the color of the title.\n  slider->GetTitleProperty()->SetColor(\n      colors->GetColor3d(properties.titleColor).GetData());\n  // Change the color of the label.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.labelColor).GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(\n      colors->GetColor3d(properties.barColor).GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(\n      colors->GetColor3d(properties.barEndsColor).GetData());\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(\n      colors->GetColor3d(properties.sliderColor).GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(properties.selectedColor).GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.valueColor).GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetRepresentation(slider);\n\n  return sliderWidget;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Skybox_Anisotropy)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Skybox_Anisotropy: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Skybox_Anisotropy MACOSX_BUNDLE PBR_Skybox_Anisotropy.cxx )\n  target_link_libraries(PBR_Skybox_Anisotropy PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Skybox_Anisotropy\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/PBR_Skybox_Anisotropy/#download-and-build-pbr_skybox_anisotropy","title":"Download and Build PBR_Skybox_Anisotropy","text":"

        Click here to download PBR_Skybox_Anisotropy and its CMakeLists.txt file. Once the tarball PBR_Skybox_Anisotropy.tar has been downloaded and extracted,

        cd PBR_Skybox_Anisotropy/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PBR_Skybox_Anisotropy\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/","title":"PBR Skybox Texturing","text":"

        vtk-examples/Cxx/Rendering/PBR_Skybox_Texturing

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#description","title":"Description","text":"

        Demonstrates physically based rendering (PBR) using image based lighting, texturing and a skybox.

        Physically based rendering sets metallicity, roughness, occlusion strength, the emissive factor and normal scaling of the object. Textures are used to set base color, ORM, emissivity and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

        <DATA>/PBR_Skybox_Texturing.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#options","title":"Options","text":"
        Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

        Additionally, you can save a screenshot by pressing \"k\".

        "},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Skybox_Texturing.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#code","title":"Code","text":"

        PBR_Skybox_Texturing.cxx

        #include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCameraPass.h>\n#include <vtkCleanPolyData.h>\n#include <vtkClipPolyData.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkHDRReader.h>\n#include <vtkImageFlip.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLightsPass.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpaquePass.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkOverlayPass.h>\n#include <vtkPBRIrradianceTexture.h>\n#include <vtkParametricBoy.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataTangents.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSequencePass.h>\n#include <vtkSkybox.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTexture.h>\n#include <vtkTexturedSphereSource.h>\n#include <vtkToneMappingPass.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n// For writing out the image.\n#include <vtkImageWriter.h>\n#include <vtkJPEGWriter.h>\n#include <vtkPNGWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <iomanip>\n#include <iostream>\n#include <numeric>\n#include <sstream>\n#include <string>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define VTK_HAS_COW 1\n#endif\n\n#if VTK_HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\nnamespace fs = std::filesystem;\n\nnamespace {\n\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return True if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n\nstruct Parameters\n{\n  std::map<std::string, std::string> parameters;\n  std::vector<std::string> cubemap;\n  bool skybox{true};\n  bool parsedOk{false};\n};\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid GetParameters(const fs::path fnPath, Parameters& parameters);\n\nstd::string DisplayParameters(Parameters& parameters);\n\n/**\n * Read six images forming a cubemap.\n *\n * @param fileNames: The paths to the six cubemap files.\n *\n * @return The cubemap texture.\n */\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames);\n\n/**\n *  Read an equirectangular environment file and convert it to a texture.\n *\n * @param fileName: The equirectangular file path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName);\n\n/**\n * Read an image and convert it to a texture.\n *\n * @param path: The image path.\n *\n * @return The texture.\n */\nvtkNew<vtkTexture> ReadTexture(std::string path);\n\n/**\n * Check that the needed textures exist.\n *\n * @param parameters:  The parameters.\n * @param wantedTextures: The wanted textures.\n *\n * @return true if all the wanted textures are present.\n */\nbool CheckForMissingTextures(Parameters& parameters,\n                             std::vector<std::string> const& wantedTextures);\n\n// Some sample surfaces to try.\nvtkSmartPointer<vtkPolyData> GetBoy();\nvtkSmartPointer<vtkPolyData> GetMobius();\nvtkSmartPointer<vtkPolyData> GetRandomHills();\nvtkSmartPointer<vtkPolyData> GetTorus();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetClippedSphere();\nvtkSmartPointer<vtkPolyData> GetCube();\nvtkSmartPointer<vtkPolyData> GetClippedCube();\n\n/**\n * Generate u, v texture coordinates on a parametric surface.\n *\n * @param uResolution: u resolution\n * @param vResolution: v resolution\n * @param pd: The polydata representing the surface.\n *\n * @return The polydata with the texture coordinates added.\n */\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd);\n\nclass SliderCallbackExposure : public vtkCommand\n{\npublic:\n  static SliderCallbackExposure* New()\n  {\n    return new SliderCallbackExposure;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetExposure(value);\n  }\n  SliderCallbackExposure() : property(nullptr)\n  {\n  }\n  vtkToneMappingPass* property;\n};\n\nclass SliderCallbackMetallic : public vtkCommand\n{\npublic:\n  static SliderCallbackMetallic* New()\n  {\n    return new SliderCallbackMetallic;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetMetallic(value);\n  }\n  SliderCallbackMetallic() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackRoughness : public vtkCommand\n{\npublic:\n  static SliderCallbackRoughness* New()\n  {\n    return new SliderCallbackRoughness;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetRoughness(value);\n  }\n  SliderCallbackRoughness() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackOcclusionStrength : public vtkCommand\n{\npublic:\n  static SliderCallbackOcclusionStrength* New()\n  {\n    return new SliderCallbackOcclusionStrength;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetOcclusionStrength(value);\n  }\n  SliderCallbackOcclusionStrength() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nclass SliderCallbackNormalScale : public vtkCommand\n{\npublic:\n  static SliderCallbackNormalScale* New()\n  {\n    return new SliderCallbackNormalScale;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetNormalScale(value);\n  }\n  SliderCallbackNormalScale() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\n\nstruct SliderProperties\n{\n  // Set up the sliders\n  double tubeWidth{0.008};\n  double sliderLength{0.075};\n  double sliderWidth{0.025};\n  double endCapLength = 0.025;\n  double endCapWidth = 0.025;\n  double titleHeight{0.025};\n  double labelHeight{0.020};\n\n  double minimumValue{0.0};\n  double maximumValue{1.0};\n  double initialValue{0.0};\n\n  std::array<double, 2> p1{0.02, 0.1};\n  std::array<double, 2> p2{0.18, 0.1};\n\n  std::string title{\"\"};\n\n  std::string titleColor{\"Black\"};\n  std::string labelColor{\"Black\"};\n  std::string valueColor{\"DarkSlateGray\"};\n  std::string sliderColor{\"BurlyWood\"};\n  std::string selectedColor{\"Lime\"};\n  std::string barColor{\"Black\"};\n  std::string barEndsColor{\"Indigo\"};\n};\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties);\n\nclass PrintCallback : public vtkCallbackCommand\n{\npublic:\n  PrintCallback() : fn_{\"\"}, imageQuality_(1), rgba_(true)\n  {\n  }\n\n  static PrintCallback* New()\n  {\n    return new PrintCallback;\n  }\n\n  /*\n   * Create a vtkCallbackCommand and reimplement it.\n   *\n   */\n  void Execute(vtkObject* caller, unsigned long /*evId*/, void*) override\n  {\n    if (this->fn_.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto rwi = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n\n    // Get the keypress\n    std::string key = rwi->GetKeySym();\n    if (key == \"k\" && !this->fn_.empty())\n    {\n      auto w2If = vtkSmartPointer<vtkWindowToImageFilter>::New();\n      w2If->SetInput(rwi->GetRenderWindow());\n      w2If->SetScale(this->imageQuality_, this->imageQuality_);\n      if (rgba_)\n      {\n        w2If->SetInputBufferTypeToRGBA();\n      }\n      else\n      {\n        w2If->SetInputBufferTypeToRGB();\n      }\n      // Read from the front buffer.\n      w2If->ReadFrontBufferOn();\n      w2If->Update();\n      std::vector<std::string> jpeg{\".jpeg\", \".jpg\"};\n      auto writer = vtkSmartPointer<vtkImageWriter>::New();\n      if (std::find(jpeg.begin(), jpeg.end(), ext_) != jpeg.end())\n      {\n        writer = vtkSmartPointer<vtkJPEGWriter>::New();\n      }\n      else\n      {\n        writer = vtkSmartPointer<vtkPNGWriter>::New();\n      }\n      writer->SetFileName(this->fn_.c_str());\n      writer->SetInputConnection(w2If->GetOutputPort());\n      writer->Write();\n      std::cout << \"Screenshot saved to: \" << writer->GetFileName()\n                << std::endl;\n    }\n  }\n\n  /**\n   * Set the parameters for writing the\n   *  render window view to an image file.\n   *\n   * @param fileName The png image file name.\n   * @param imageQuality The image quality.\n   * @param rgba The buffer type, (if true, there is no background in the\n   * screenshot).\n   *\n   */\n  void SetParameters(const std::string& fileName, int imageQuality = 1,\n                     bool rgba = true)\n  {\n    if (fileName.empty())\n    {\n      std::cerr << \"A file name is required.\" << std::endl;\n      return;\n    }\n    auto pth = fs::absolute(fileName);\n    auto ext = pth.extension().generic_string();\n    if (!pth.has_extension())\n      ext = \".png\";\n    std::transform(ext.begin(), ext.end(), ext.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::vector<std::string> validSuffixes{\".jpeg\", \".jpg\", \".png\"};\n    if (std::find(validSuffixes.begin(), validSuffixes.end(), ext) ==\n        validSuffixes.end())\n    {\n      ext = \".png\";\n    }\n    this->ext_ = ext;\n    this->fn_ = pth.replace_extension(this->ext_).generic_string();\n    this->imageQuality_ = imageQuality;\n    this->rgba_ = rgba;\n  }\n\nprivate:\n  PrintCallback(const PrintCallback&) = delete;\n  void operator=(const PrintCallback&) = delete;\n\n  std::string fn_;\n  std::string ext_;\n  int imageQuality_;\n  bool rgba_;\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (!VTKVersionOk(9, 0, 0))\n  {\n    std::cerr << \"You need VTK version 9.0 or greater to run this program.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n  // VTK blue\n  std::array<unsigned char, 4> col1{{6, 79, 141, 255}};\n  colors->SetColor(\"VTKBlue\", col1.data());\n  // Let's make a complementary colour to VTKBlue.\n  std::transform(col1.begin(), std::prev(col1.end()), col1.begin(),\n                 [](unsigned char c) { return 255 - c; });\n  colors->SetColor(\"VTKBlueComp\", col1.data());\n\n  CLI::App app{\"Demonstrates physically based rendering, a skybox, \"\n               \"image based lighting and texturing.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file containing the parameters.\");\n  std::string surfaceName;\n  app.add_option(\"-s, --surface\", surfaceName,\n                 \"The name of the surface. Overrides the surface entry in the \"\n                 \"json file.\");\n  auto useCubemap{false};\n  app.add_flag(\"-c, --use_cubemap\", useCubemap,\n               \"Build the cubemap from the six cubemap files. Overrides the \"\n               \"equirectangular entry in the json file.\");\n  auto useTonemapping{false};\n  app.add_flag(\"-t, --use_tonemapping\", useTonemapping, \"Use tone mapping.\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  GetParameters(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  if (!surfaceName.empty())\n  {\n    parameters.parameters[\"object\"] = surfaceName;\n  }\n\n  // Check for missing parameters.\n  if (parameters.parameters.find(\"bkgcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"bkgcolor\"] = \"BkgColor\";\n  }\n  if (parameters.parameters.find(\"objcolor\") == parameters.parameters.end())\n  {\n    parameters.parameters[\"objcolor\"] = \"White\";\n  }\n\n  auto res = DisplayParameters(parameters);\n  std::cout << res << std::endl;\n\n  std::vector<std::string> wantedTextures{\"albedo\", \"normal\", \"material\",\n                                          \"emissive\"};\n  if (!CheckForMissingTextures(parameters, wantedTextures))\n  {\n    return EXIT_FAILURE;\n  }\n\n  // Build the pipeline.\n  // ren1 is for the slider rendering,\n  // ren2 is for the object rendering.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkOpenGLRenderer> ren2;\n  ren1->SetBackground(colors->GetColor3d(\"Snow\").GetData());\n  ren2->SetBackground(\n      colors->GetColor3d(parameters.parameters[\"bkgcolor\"]).GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  // The order here is important.\n  // This ensures that the sliders will be in ren1.\n  renderWindow->AddRenderer(ren2);\n  renderWindow->AddRenderer(ren1);\n  ren1->SetViewport(0.0, 0.0, 0.2, 1.0);\n  ren2->SetViewport(0.2, 0.0, 1, 1);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  // Set up tone mapping so we can vary the exposure.\n  // Custom Passes.\n  vtkNew<vtkCameraPass> cameraP;\n  vtkNew<vtkSequencePass> seq;\n  vtkNew<vtkOpaquePass> opaque;\n  vtkNew<vtkLightsPass> lights;\n  vtkNew<vtkOverlayPass> overlay;\n\n  vtkNew<vtkRenderPassCollection> passes;\n  passes->AddItem(lights);\n  passes->AddItem(opaque);\n  passes->AddItem(overlay);\n  seq->SetPasses(passes);\n  cameraP->SetDelegatePass(seq);\n\n  vtkNew<vtkToneMappingPass> toneMappingP;\n  toneMappingP->SetToneMappingType(vtkToneMappingPass::GenericFilmic);\n  toneMappingP->SetGenericFilmicUncharted2Presets();\n  toneMappingP->SetExposure(1.0);\n  toneMappingP->SetDelegatePass(cameraP);\n\n  if (useTonemapping)\n  {\n    vtkOpenGLRenderer::SafeDownCast(ren2)->SetPass(toneMappingP);\n  }\n\n  vtkSmartPointer<vtkPBRIrradianceTexture> irradiance =\n      ren2->GetEnvMapIrradiance();\n  irradiance->SetIrradianceStep(0.3);\n\n  vtkNew<vtkSkybox> skybox;\n\n  // Choose how to generate the skybox.\n  vtkNew<vtkTexture> cubeMap;\n  vtkNew<vtkTexture> envTexture;\n  auto isHDR = false;\n  auto hasSkybox = false;\n  auto gammaCorrect = false;\n\n  if (useCubemap && !parameters.cubemap.empty())\n  {\n    std::cout << \"Using the cubemap files to generate the environment texture.\"\n              << std::endl;\n    envTexture = ReadCubemap(parameters.cubemap);\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else if (parameters.parameters.find(\"equirectangular\") !=\n               parameters.parameters.end() &&\n           !parameters.parameters[\"equirectangular\"].empty())\n  {\n    std::cout\n        << \"Using the equirectangular file to generate the environment texture.\"\n        << std::endl;\n    envTexture =\n        ReadEquirectangularFile(parameters.parameters[\"equirectangular\"]);\n    std::string extension = fs::path(parameters.parameters[\"equirectangular\"])\n                                .extension()\n                                .generic_string();\n    std::transform(extension.begin(), extension.end(), extension.begin(),\n                   [](char c) { return std::tolower(c); });\n    std::string extensions{\".hdr .pic\"};\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      isHDR = true;\n      gammaCorrect = true;\n    }\n    if (parameters.skybox)\n    {\n      skybox->SetTexture(envTexture);\n      skybox->SetFloorRight(0, 0, 1);\n      skybox->SetProjection(vtkSkybox::Sphere);\n      skybox->SetTexture(envTexture);\n      hasSkybox = true;\n    }\n  }\n  else\n  {\n    std::cerr << \"An environment texture is required,\\n\"\n              << \"please add the necessary equirectangular\"\n              << \" or cubemap file paths to the json file.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Turn off the default lighting and use image based lighting.\n  ren2->AutomaticLightCreationOff();\n  ren2->UseImageBasedLightingOn();\n  if (isHDR)\n  {\n    ren2->UseSphericalHarmonicsOn();\n    ren2->SetEnvironmentTexture(envTexture, false);\n  }\n  else\n  {\n    ren2->UseSphericalHarmonicsOff();\n    ren2->SetEnvironmentTexture(envTexture, true);\n  }\n\n  // Get the textures\n  auto baseColor = ReadTexture(parameters.parameters[\"albedo\"]);\n  baseColor->UseSRGBColorSpaceOn();\n  auto normal = ReadTexture(parameters.parameters[\"normal\"]);\n  auto material = ReadTexture(parameters.parameters[\"material\"]);\n  auto emissive = ReadTexture(parameters.parameters[\"emissive\"]);\n  emissive->UseSRGBColorSpaceOn();\n\n  // Get the surface.\n  std::string desiredSurface = parameters.parameters[\"object\"];\n  std::transform(desiredSurface.begin(), desiredSurface.end(),\n                 desiredSurface.begin(),\n                 [](char c) { return std::tolower(c); });\n  std::map<std::string, int> availableSurfaces = {\n      {\"boy\", 0},   {\"mobius\", 1},     {\"randomhills\", 2},\n      {\"torus\", 3}, {\"sphere\", 4},     {\"clippedsphere\", 5},\n      {\"cube\", 6},  {\"clippedcube\", 7}};\n  if (availableSurfaces.find(desiredSurface) == availableSurfaces.end())\n  {\n    std::cout << \"The requested surface: \" << parameters.parameters[\"object\"]\n              << \" not found, reverting to Boys Surface.\" << std::endl;\n    desiredSurface = \"boy\";\n  }\n  vtkSmartPointer<vtkPolyData> source;\n  switch (availableSurfaces[desiredSurface])\n  {\n  case 1:\n    source = GetMobius();\n    break;\n  case 2:\n    source = GetRandomHills();\n    break;\n  case 3:\n    source = GetTorus();\n    break;\n  case 4:\n    source = GetSphere();\n    break;\n  case 5:\n    source = GetClippedSphere();\n    break;\n  case 6:\n    source = GetCube();\n    break;\n  case 7:\n    source = GetClippedCube();\n    break;\n  case 0:\n  default:\n    source = GetBoy();\n  };\n\n  // Let's use a nonmetallic surface.\n  auto diffuseCoefficient = 1.0;\n  auto roughnessCoefficient = 0.3;\n  auto metallicCoefficient = 0.0;\n  // Other parameters.\n  auto occlusionStrength = 1.0;\n  auto normalScale = 1.0;\n  // auto emissiveCol = colors->GetColor3d(\"VTKBlueComp\").GetData();\n  // std::array<double, 3> emissiveFactor{emissiveCol[0], emissiveCol[1],\n  //                                      emissiveCol[2]};\n  // Make VTK silvery in appearance.\n  std::array<double, 3> emissiveFactor{1.0, 1.0, 1.0};\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(source);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Enable PBR on the model.\n  actor->GetProperty()->SetInterpolationToPBR();\n  // Configure the basic properties.\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n  actor->GetProperty()->SetDiffuse(diffuseCoefficient);\n  actor->GetProperty()->SetRoughness(roughnessCoefficient);\n  actor->GetProperty()->SetMetallic(metallicCoefficient);\n  // Configure textures (needs tcoords on the mesh).\n  actor->GetProperty()->SetBaseColorTexture(baseColor);\n  actor->GetProperty()->SetORMTexture(material);\n  actor->GetProperty()->SetOcclusionStrength(occlusionStrength);\n  actor->GetProperty()->SetEmissiveTexture(emissive);\n  actor->GetProperty()->SetEmissiveFactor(emissiveFactor.data());\n  // Needs tcoords, normals and tangents on the mesh.\n  actor->GetProperty()->SetNormalTexture(normal);\n  actor->GetProperty()->SetNormalScale(normalScale);\n  ren2->AddActor(actor);\n\n  if (hasSkybox)\n  {\n    if (gammaCorrect)\n    {\n      skybox->GammaCorrectOn();\n    }\n    else\n    {\n      skybox->GammaCorrectOff();\n    }\n    ren2->AddActor(skybox);\n  }\n\n  // Create the slider callbacks to manipulate various parameters.\n\n  auto stepSize = 1.0 / 5.0;\n  auto posY = 0.1;\n  auto posX0 = 0.02;\n  auto posX1 = 0.18;\n\n  auto slwP = SliderProperties();\n  slwP.initialValue = 1.0;\n  slwP.maximumValue = 5.0;\n  slwP.title = \"Exposure\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swExposure = MakeSliderWidget(slwP);\n  swExposure->SetInteractor(interactor);\n  swExposure->SetAnimationModeToAnimate();\n  if (useTonemapping)\n  {\n    swExposure->EnabledOn();\n  }\n  else\n  {\n    swExposure->EnabledOff();\n  }\n  swExposure->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackExposure> swExpCB;\n  swExpCB->property = dynamic_cast<vtkToneMappingPass*>(ren2->GetPass());\n  swExposure->AddObserver(vtkCommand::InteractionEvent, swExpCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = metallicCoefficient;\n  slwP.maximumValue = 1.0;\n  slwP.title = \"Metallicity\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swMetallic = MakeSliderWidget(slwP);\n  swMetallic->SetInteractor(interactor);\n  swMetallic->SetAnimationModeToAnimate();\n  swMetallic->EnabledOn();\n  swMetallic->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackMetallic> swMetallicCB;\n  swMetallicCB->property = actor->GetProperty();\n  swMetallic->AddObserver(vtkCommand::InteractionEvent, swMetallicCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = roughnessCoefficient;\n  slwP.title = \"Roughness\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swRoughness = MakeSliderWidget(slwP);\n  swRoughness->SetInteractor(interactor);\n  swRoughness->SetAnimationModeToAnimate();\n  swRoughness->EnabledOn();\n  swRoughness->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackRoughness> swRoughnessCB;\n  swRoughnessCB->property = actor->GetProperty();\n  swRoughness->AddObserver(vtkCommand::InteractionEvent, swRoughnessCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = occlusionStrength;\n  slwP.maximumValue = 5;\n  slwP.title = \"Occlusion\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swOccStr = MakeSliderWidget(slwP);\n  swOccStr->SetInteractor(interactor);\n  swOccStr->SetAnimationModeToAnimate();\n  swOccStr->EnabledOn();\n  swOccStr->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackOcclusionStrength> swOccStrCB;\n  swOccStrCB->property = actor->GetProperty();\n  swOccStr->AddObserver(vtkCommand::InteractionEvent, swOccStrCB);\n\n  posY += stepSize;\n\n  slwP.initialValue = normalScale;\n  slwP.maximumValue = 5;\n  slwP.title = \"Normal\";\n  //  Screen coordinates.\n  slwP.p1[0] = posX0;\n  slwP.p1[1] = posY;\n  slwP.p2[0] = posX1;\n  slwP.p2[1] = posY;\n\n  auto swNormal = MakeSliderWidget(slwP);\n  swNormal->SetInteractor(interactor);\n  swNormal->SetAnimationModeToAnimate();\n  swNormal->EnabledOn();\n  swNormal->SetCurrentRenderer(ren1);\n  vtkNew<SliderCallbackNormalScale> swNormalCB;\n  swNormalCB->property = actor->GetProperty();\n  swNormal->AddObserver(vtkCommand::InteractionEvent, swNormalCB);\n\n  auto name = fs::path(argv[0]).stem().generic_string();\n  renderWindow->SetSize(1000, 625);\n  renderWindow->Render();\n  renderWindow->SetWindowName(name.c_str());\n\n#if VTK_HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(ren2);\n  // Enable the widget.\n  camOrientManipulator->On();\n#else\n  vtkNew<vtkAxesActor> axes;\n\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  double rgba[4]{0.0, 0.0, 0.0, 0.0};\n  colors->GetColor(\"Carrot\", rgba);\n  widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n  widget->SetOrientationMarker(axes);\n  widget->SetInteractor(interactor);\n  widget->SetViewport(0.0, 0.0, 0.2, 0.2);\n  widget->EnabledOn();\n  widget->InteractiveOn();\n#endif\n\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<PrintCallback> printCallback;\n  printCallback->SetParameters(name, 1, false);\n  // printCallback->SetParameters(name + \".jpg\", 1, false);\n  interactor->AddObserver(vtkCommand::KeyPressEvent, printCallback);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n#ifndef VTK_VERSION_NUMBER\n  vtkNew<vtkVersion>();\n  ver;\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  if (vtk_version_number >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#else\n  if (VTK_VERSION_NUMBER >= neededVersion)\n  {\n    return true;\n  }\n  return false;\n#endif\n}\n\nvoid GetParameters(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Extract the values.\n  std::set<std::string> keysNoPaths{\"title\", \"object\", \"objcolor\", \"bkgcolor\",\n                                    \"skybox\"};\n  std::set<std::string> keysWithPaths{\"cubemap\",    \"equirectangular\", \"albedo\",\n                                      \"normal\",     \"material\",        \"coat\",\n                                      \"anisotropy\", \"emissive\"};\n  fs::path cubemapPath;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (keysNoPaths.find(outer.name()) != keysNoPaths.end())\n    {\n      if (outer.name() == \"skybox\")\n      {\n        parameters.skybox = outer->asBool();\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n      continue;\n    }\n    if (keysWithPaths.find(outer.name()) != keysWithPaths.end())\n    {\n      if (outer.name() == \"cubemap\")\n      {\n        std::string path;\n        for (Json::Value::const_iterator pth = root[\"cubemap\"].begin();\n             pth != root[\"cubemap\"].end(); ++pth)\n        {\n          if (pth.name() == \"root\")\n          {\n            cubemapPath = fs::path(pth->asString());\n            std::cout << path << std::endl;\n          }\n          if (pth.name() == \"files\")\n          {\n            for (Json::Value::const_iterator fls =\n                     root[\"cubemap\"][\"files\"].begin();\n                 fls != root[\"cubemap\"][\"files\"].end(); ++fls)\n            {\n              parameters.cubemap.push_back(fls->asString());\n            }\n          }\n        }\n      }\n      else\n      {\n        parameters.parameters[outer.name()] = outer->asString();\n      }\n    }\n  }\n  // Build and check the paths.\n  if (!parameters.cubemap.empty())\n  {\n    if (parameters.cubemap.size() != 6)\n    {\n      std::cerr << \"There must be six filenames for the cubemap.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < parameters.cubemap.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / cubemapPath /\n            fs::path(parameters.cubemap[i]);\n        if (parameters.cubemap[i].empty())\n        {\n          std::cerr << \"A missing path in the cubemap.\" << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.cubemap[i] = pth.make_preferred().string();\n          if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n          {\n            std::cerr << \"Not a file or path does not exist: \"\n                      << parameters.cubemap[i] << std::endl;\n            parameters.parsedOk = false;\n          }\n        }\n      }\n    }\n  }\n  // Check the remaining paths, we don't need cubemap now.\n  keysWithPaths.erase(\"cubemap\");\n  for (auto& p : parameters.parameters)\n  {\n    if (keysWithPaths.find(p.first) != keysWithPaths.end())\n    {\n      if (p.second.empty())\n      {\n        std::cerr << \"No path for the key \" << p.first << std::endl;\n        parameters.parsedOk = false;\n      }\n      else\n      {\n        auto pth = fnPath.parent_path() / fs::path(p.second);\n        p.second = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << p.second\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n      }\n    }\n  }\n\n  return;\n}\n\nstd::string DisplayParameters(Parameters& parameters)\n{\n  std::stringstream res;\n  std::vector<std::string> parameterKeys{\n      \"title\",   \"object\",          \"objcolor\", \"bkgcolor\", \"skybox\",\n      \"cubemap\", \"equirectangular\", \"albedo\",   \"normal\",   \"material\",\n      \"coat\",    \"anisotropy\",      \"emissive\"};\n  for (auto const& e : parameterKeys)\n  {\n    if (e == \"cubemap\")\n    {\n      for (std::vector<std::string>::const_iterator it =\n               parameters.cubemap.begin();\n           it != parameters.cubemap.end(); ++it)\n      {\n        if (it == parameters.cubemap.cbegin())\n        {\n          res << std::setw(15) << std::left << \"cubemap\"\n              << \": \" << *it << \"\\n\";\n        }\n        else\n        {\n          res << std::setw(17) << \" \" << *it << \"\\n\";\n        }\n      }\n    }\n    else if (e == \"skybox\")\n    {\n      res << std::setw(15) << std::left << e << \": \" << std::boolalpha\n          << parameters.skybox << \"\\n\";\n    }\n    else\n    {\n      if (parameters.parameters.find(e) != parameters.parameters.end())\n      {\n        res << std::setw(15) << std::left << e << \": \"\n            << parameters.parameters[e] << \"\\n\";\n      }\n    }\n  }\n\n  return res.str();\n}\n\nvtkNew<vtkTexture> ReadCubemap(std::vector<std::string> const& fileNames)\n{\n  vtkNew<vtkTexture> cubeMap;\n  cubeMap->CubeMapOn();\n\n  auto i = 0;\n  for (auto const& fn : fileNames)\n  {\n    // Read the images\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(readerFactory->CreateImageReader2(fn.c_str()));\n    imgReader->SetFileName(fn.c_str());\n\n    // Each image must be flipped in Y due to canvas\n    // versus vtk ordering.\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    cubeMap->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n\n  cubeMap->MipmapOn();\n  cubeMap->InterpolateOn();\n\n  return cubeMap;\n}\n\nvtkNew<vtkTexture> ReadEquirectangularFile(std::string const& fileName)\n{\n  vtkNew<vtkTexture> texture;\n\n  std::string extension = fs::path(fileName).extension().generic_string();\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 [](char c) { return std::tolower(c); });\n\n  if (std::string(\".jpeg .jpg .png\").find(extension, 0) != std::string::npos)\n  {\n    vtkNew<vtkImageReader2Factory> readerFactory;\n    vtkSmartPointer<vtkImageReader2> imgReader;\n    imgReader.TakeReference(\n        readerFactory->CreateImageReader2(fileName.c_str()));\n    imgReader->SetFileName(fileName.c_str());\n\n    texture->SetInputConnection(imgReader->GetOutputPort());\n  }\n  else\n  {\n    vtkNew<vtkHDRReader> reader;\n    auto extensions = reader->GetFileExtensions();\n    if (std::string(extensions).find(extension, 0) != std::string::npos)\n    {\n      if (reader->CanReadFile(fileName.c_str()))\n      {\n        reader->SetFileName(fileName.c_str());\n\n        texture->SetInputConnection(reader->GetOutputPort());\n        texture->SetColorModeToDirectScalars();\n      }\n      else\n      {\n        std::cerr << \"Unable to read the file: \" << fileName << std::endl;\n        return texture;\n      }\n    }\n  }\n\n  texture->MipmapOn();\n  texture->InterpolateOn();\n\n  return texture;\n}\n\nvtkNew<vtkTexture> ReadTexture(std::string path)\n{\n  // Read the image which will be the texture\n  std::string extension;\n  if (path.find_last_of(\".\") != std::string::npos)\n  {\n    extension = path.substr(path.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  std::vector<std::string> validExtensions{\".jpg\", \".png\", \".bmp\", \".tiff\",\n                                           \".pnm\", \".pgm\", \".ppm\"};\n  vtkNew<vtkTexture> texture;\n  texture->InterpolateOn();\n\n  if (std::find(validExtensions.begin(), validExtensions.end(), extension) ==\n      validExtensions.end())\n  {\n    std::cout << \"Unable to read the texture file:\" << path << std::endl;\n    return texture;\n  }\n  // Read the images\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imgReader;\n  imgReader.TakeReference(readerFactory->CreateImageReader2(path.c_str()));\n  imgReader->SetFileName(path.c_str());\n\n  texture->SetInputConnection(imgReader->GetOutputPort());\n  texture->Update();\n\n  return texture;\n}\n\nbool CheckForMissingTextures(Parameters& parameters,\n                             std::vector<std::string> const& wantedTextures)\n{\n  bool haveTextures = true;\n\n  for (auto const& textureName : wantedTextures)\n  {\n    if (parameters.parameters.find(\"equirectangular\") ==\n        parameters.parameters.end())\n    {\n      std::cerr << \"Missing texture: \" << textureName << std::endl;\n      haveTextures = false;\n    }\n    else if (parameters.parameters[textureName].empty())\n    {\n      std::cerr << \"No texture path for: \" << textureName << std::endl;\n      haveTextures = false;\n    }\n  }\n\n  return haveTextures;\n}\n\nvtkSmartPointer<vtkPolyData> GetBoy()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricBoy> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetMobius()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricMobius> surface;\n  surface->SetMinimumV(-0.25);\n  surface->SetMaximumV(0.25);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetRandomHills()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricRandomHills> surface;\n  surface->SetRandomSeed(1);\n  surface->SetNumberOfHills(30);\n  // If you want a plane\n  // surface->SetHillAmplitude(0);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  auto uResolution = 51;\n  auto vResolution = 51;\n  vtkNew<vtkParametricTorus> surface;\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetUResolution(uResolution);\n  source->SetVResolution(vResolution);\n  source->GenerateTextureCoordinatesOn();\n  source->SetParametricFunction(surface);\n  source->Update();\n\n  // Build the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(source->GetOutputPort());\n  tangents->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(tangents->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(surface->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedSphere()\n{\n  auto thetaResolution = 32;\n  auto phiResolution = 32;\n  vtkNew<vtkTexturedSphereSource> surface;\n  surface->SetThetaResolution(thetaResolution);\n  surface->SetPhiResolution(phiResolution);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, 0);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(surface->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(clipper->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(3);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(subdivide->GetOutputPort());\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetClippedCube()\n{\n  vtkNew<vtkCubeSource> surface;\n\n  // Triangulate\n  vtkNew<vtkTriangleFilter> triangulation;\n  triangulation->SetInputConnection(surface->GetOutputPort());\n\n  // Subdivide the triangles\n  vtkNew<vtkLinearSubdivisionFilter> subdivide;\n  subdivide->SetInputConnection(triangulation->GetOutputPort());\n  subdivide->SetNumberOfSubdivisions(5);\n\n  vtkNew<vtkPlane> clip_plane;\n  clip_plane->SetOrigin(0, 0.3, 0);\n  clip_plane->SetNormal(0, -1, -1);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(subdivide->GetOutputPort());\n  clipper->SetClipFunction(clip_plane);\n  clipper->GenerateClippedOutputOn();\n\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(clipper->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(cleaner->GetOutputPort());\n  normals->FlipNormalsOn();\n  normals->SetFeatureAngle(60);\n\n  // Now the tangents\n  vtkNew<vtkPolyDataTangents> tangents;\n  tangents->SetInputConnection(normals->GetOutputPort());\n  tangents->ComputeCellTangentsOn();\n  tangents->ComputePointTangentsOff();\n  tangents->Update();\n  return tangents->GetOutput();\n}\n\nvtkNew<vtkPolyData> UVTcoords(const float& uResolution,\n                              const float& vResolution, vtkNew<vtkPolyData> pd)\n{\n  float u0 = 1.0;\n  float v0 = 0.0;\n  float du = 1.0 / (uResolution - 1.0);\n  float dv = 1.0 / (vResolution - 1.0);\n  vtkIdType numPts = pd->GetNumberOfPoints();\n  vtkNew<vtkFloatArray> tCoords;\n  tCoords->SetNumberOfComponents(2);\n  tCoords->SetNumberOfTuples(numPts);\n  tCoords->SetName(\"Texture Coordinates\");\n  vtkIdType ptId = 0;\n  float u = u0;\n  for (auto i = 0; i < uResolution; ++i)\n  {\n    float v = v0;\n    for (auto j = 0; j < vResolution; ++j)\n    {\n      float tc[2]{u, v};\n      tCoords->SetTuple(ptId, tc);\n      v += dv;\n      ptId++;\n    }\n    u -= du;\n  }\n  pd->GetPointData()->SetTCoords(tCoords);\n  return pd;\n}\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& properties)\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkSliderRepresentation2D> slider;\n\n  slider->SetMinimumValue(properties.minimumValue);\n  slider->SetMaximumValue(properties.maximumValue);\n  slider->SetValue(properties.initialValue);\n  slider->SetTitleText(properties.title.c_str());\n\n  slider->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint1Coordinate()->SetValue(properties.p1[0], properties.p1[1]);\n  slider->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint2Coordinate()->SetValue(properties.p2[0], properties.p2[1]);\n\n  slider->SetTubeWidth(properties.tubeWidth);\n  slider->SetSliderLength(properties.sliderLength);\n  slider->SetSliderWidth(properties.sliderWidth);\n  slider->SetEndCapLength(properties.endCapLength);\n  slider->SetEndCapWidth(properties.endCapWidth);\n  slider->SetTitleHeight(properties.titleHeight);\n  slider->SetLabelHeight(properties.labelHeight);\n\n  // Set the color properties\n  // Change the color of the title.\n  slider->GetTitleProperty()->SetColor(\n      colors->GetColor3d(properties.titleColor).GetData());\n  // Change the color of the label.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.labelColor).GetData());\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(\n      colors->GetColor3d(properties.barColor).GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(\n      colors->GetColor3d(properties.barEndsColor).GetData());\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(\n      colors->GetColor3d(properties.sliderColor).GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(properties.selectedColor).GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(properties.valueColor).GetData());\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetRepresentation(slider);\n\n  return sliderWidget;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PBR_Skybox_Texturing)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PBR_Skybox_Texturing: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PBR_Skybox_Texturing MACOSX_BUNDLE PBR_Skybox_Texturing.cxx )\n  target_link_libraries(PBR_Skybox_Texturing PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PBR_Skybox_Texturing\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/PBR_Skybox_Texturing/#download-and-build-pbr_skybox_texturing","title":"Download and Build PBR_Skybox_Texturing","text":"

        Click here to download PBR_Skybox_Texturing and its CMakeLists.txt file. Once the tarball PBR_Skybox_Texturing.tar has been downloaded and extracted,

        cd PBR_Skybox_Texturing/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PBR_Skybox_Texturing\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/Rainbow/","title":"Rainbow","text":"

        vtk-examples/Cxx/Rendering/Rainbow

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/Rainbow/#description","title":"Description","text":"

        This example demonstrates the use and manipulation of vtkLookupTable's.

        First a simple pipeline that reads a vtkStructuredGrid and then extracts a plane using vtkStructuredGeometryFilter from the grid. The plane will be colored differently by using different vtkLookupTable's.

        Note

        The Update method is manually invoked because it causes the reader to read; later on we use the output of the reader to set a range for the scalar values.

        Note

        This original tcl source code for this example is here.

        Info

        See Figure 6-3 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/Rainbow/#code","title":"Code","text":"

        Rainbow.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\n// This example demonstrates the use and manipulation of lookup tables.\n\n// First create a simple pipeline that reads a structured grid\n// and then extracts a plane from the grid. The plane will be colored\n// differently by using different lookup tables.\n//\n// Note: The Update method is manually invoked because it causes the\n// reader to read; later on we use the output of the reader to set\n// a range for the scalar values.\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" filexyz.bin fileq.bin e.g.: combxyz.bin combq.bin\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkStructuredGrid* pl3dOutput =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  // Create the 4 renderers\n  vtkNew<vtkRenderer> grayScaleRenderer;\n  renderers.push_back(grayScaleRenderer);\n  vtkNew<vtkRenderer> rainbowBlueRedRenderer;\n  renderers.push_back(rainbowBlueRedRenderer);\n  vtkNew<vtkRenderer> rainbowRedBlueRenderer;\n  renderers.push_back(rainbowRedBlueRenderer);\n  vtkNew<vtkRenderer> largeContrastRenderer;\n  renderers.push_back(largeContrastRenderer);\n\n  std::vector<vtkSmartPointer<vtkLookupTable>> luts;\n\n  vtkNew<vtkLookupTable> grayScaleLut;\n  grayScaleLut->SetHueRange(0, 0);\n  grayScaleLut->SetSaturationRange(0, 0);\n  grayScaleLut->SetValueRange(0.2, 1.0);\n  grayScaleLut->SetNumberOfColors(256);\n  grayScaleLut->SetHueRange(0.0, 0.667);\n  grayScaleLut->Build();\n  luts.push_back(grayScaleLut);\n\n  vtkNew<vtkLookupTable> rainbowBlueRedLut;\n  rainbowBlueRedLut->SetNumberOfColors(256);\n  rainbowBlueRedLut->SetHueRange(0.667, 0.0);\n  rainbowBlueRedLut->Build();\n  luts.push_back(rainbowBlueRedLut);\n\n  vtkNew<vtkLookupTable> rainbowRedBlueLut;\n  rainbowRedBlueLut->SetNumberOfColors(256);\n  rainbowRedBlueLut->SetHueRange(0.0, 0.667);\n  rainbowRedBlueLut->Build();\n  luts.push_back(rainbowRedBlueLut);\n\n  vtkNew<vtkLookupTable> highContrastLut;\n  highContrastLut->SetNumberOfColors(256);\n  highContrastLut->Build();\n\n  for (int l = 0; l < 16; ++l)\n  {\n    highContrastLut->SetTableValue(l * 16, 1, 0, 0, 1);\n    highContrastLut->SetTableValue(l * 16 + 1, 0, 1, 0, 1);\n    highContrastLut->SetTableValue(l * 16 + 2, 0, 0, 1, 1);\n    highContrastLut->SetTableValue(l * 16 + 3, 0, 0, 0, 1);\n  }\n  luts.push_back(highContrastLut);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  int rendererSize = 256;\n  unsigned int xGridDimensions = 2;\n  unsigned int yGridDimensions = 2;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  vtkNew<vtkStructuredGridGeometryFilter> plane;\n  plane->SetInputData(pl3dOutput);\n  plane->SetExtent(1, 100, 1, 100, 7, 7);\n\n  for (size_t r = 0; r < renderers.size(); ++r)\n  {\n    vtkSmartPointer<vtkLookupTable> lut = luts[r];\n    vtkNew<vtkPolyDataMapper> planeMapper;\n    planeMapper->SetLookupTable(lut);\n    planeMapper->SetInputConnection(plane->GetOutputPort());\n    planeMapper->SetScalarRange(pl3dOutput->GetScalarRange());\n\n    vtkNew<vtkActor> planeActor;\n    planeActor->SetMapper(planeMapper);\n\n    // This creates an outline around the data.\n    vtkNew<vtkStructuredGridOutlineFilter> outline;\n    outline->SetInputData(pl3dOutput);\n\n    vtkNew<vtkPolyDataMapper> outlineMapper;\n    outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n    vtkNew<vtkActor> outlineActor;\n    outlineActor->SetMapper(outlineMapper);\n\n    // Create the RenderWindow, Renderer and both Actors.\n    //\n    renderers[r]->AddActor(outlineActor);\n    renderers[r]->AddActor(planeActor);\n\n    renderers[r]->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    renderers[r]->TwoSidedLightingOff();\n    renderers[r]->GetActiveCamera()->Azimuth(20);\n    renderers[r]->GetActiveCamera()->Elevation(30);\n    renderers[r]->ResetCamera();\n    if (r > 0)\n    {\n      renderers[r]->SetActiveCamera(renderers[0]->GetActiveCamera());\n    }\n    renderWindow->AddRenderer(renderers[r]);\n  }\n\n  // Add the actors to the renderer, set the background and size.\n\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  renderWindow->SetWindowName(\"Rainbow\");\n\n  interactor->Initialize();\n\n  vtkCamera* cam1 = renderers[0]->GetActiveCamera();\n  cam1->SetClippingRange(3.95297, 50);\n  cam1->SetFocalPoint(8.88908, 0.595038, 29.3342);\n  cam1->SetPosition(-12.3332, 31.7479, 41.2387);\n  cam1->SetViewUp(0.060772, -0.319905, 0.945498);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/Rainbow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Rainbow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Rainbow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Rainbow MACOSX_BUNDLE Rainbow.cxx )\n  target_link_libraries(Rainbow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Rainbow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/Rainbow/#download-and-build-rainbow","title":"Download and Build Rainbow","text":"

        Click here to download Rainbow and its CMakeLists.txt file. Once the tarball Rainbow.tar has been downloaded and extracted,

        cd Rainbow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Rainbow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/Rotations/","title":"Rotations","text":"

        vtk-examples/Cxx/Rendering/Rotations

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/Rotations/#description","title":"Description","text":"

        Rotations of a cow about her axes. In this model, the x axis is from the left to right; the y axis is from bottom to top; and the z axis emerges from the image. The camera location is the same in all four images.

        Info

        See Figure 3-31 in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/Rotations/#code","title":"Code","text":"

        Rotations.cxx

        #include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <array>\n#include <cctype> // For to_lower\n#include <string> // For find_last_of()\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\nvoid RotateX(vtkRenderWindow* renWin, vtkActor* actor);\nvoid RotateY(vtkRenderWindow* renWin, vtkActor* actor);\nvoid RotateZ(vtkRenderWindow* renWin, vtkActor* actor);\nvoid RotateXY(vtkRenderWindow* renWin, vtkActor* actor);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  /*\n  To match the illustrations in VTKTextbook.pdf, use BkgColor as the background\n    and Wheat as the cow colour.\n  Also comment out the lines:\n    modelActor->GetProperty()->SetSpecular(.6);\n    modelActor->GetProperty()->SetSpecularPower(30);\n  and use cow.g as the input data.\n  */\n\n  auto figure = 0;\n  std::string actorColor = \"Wheat\";\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [figure] [actorColor]\"\n              << std::endl;\n    std::cout << \"where: filename is the file cow.obj\" << std::endl;\n    std::cout << \"       figure is 0, 1, 2, or 3, default 0\" << std::endl;\n    std::cout << \"       actorColor: A color name, default Wheat.\" << std::endl;\n    std::cout << \"Options 0, 1, 2 and 3 are provided to let you generate \"\n                 \"approximations to the following figures:\\n Figure 3-31d, \"\n                 \"Figure 3-31a, Figure 3-33b and Figure 3-33c in Chapter 3 of \"\n                 \"the VTK Textbook.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n\n  if (argc == 3)\n  {\n    figure = atoi(argv[2]);\n  }\n  else if (argc > 3)\n  {\n    figure = atoi(argv[2]);\n    actorColor = argv[3];\n  }\n\n  // Create renderer stuff\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  // std::array<unsigned char, 4> bkg{{60, 93, 144, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"Rotations\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the pipeline.\n  //\n  auto polyData = ReadPolyData(fileName.c_str());\n\n  vtkNew<vtkPolyDataMapper> modelMapper;\n  modelMapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> modelActor;\n  modelActor->SetMapper(modelMapper);\n  modelActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(actorColor).GetData());\n\n  if (actorColor != \"Wheat\")\n  {\n    modelActor->GetProperty()->SetSpecular(0.6);\n    modelActor->GetProperty()->SetSpecularPower(30);\n  }\n\n  vtkNew<vtkAxes> modelAxesSource;\n  modelAxesSource->SetScaleFactor(10);\n  modelAxesSource->SetOrigin(0, 0, 0);\n\n  vtkNew<vtkPolyDataMapper> modelAxesMapper;\n  modelAxesMapper->SetInputConnection(modelAxesSource->GetOutputPort());\n\n  vtkNew<vtkActor> modelAxes;\n  modelAxes->SetMapper(modelAxesMapper);\n\n  ren1->AddActor(modelAxes);\n  modelAxes->VisibilityOff();\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(modelActor);\n  if (actorColor == \"Wheat\")\n  {\n    ren1->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  }\n  else\n  {\n    ren1->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  }\n  renWin->SetSize(640, 480);\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(0);\n  ren1->GetActiveCamera()->SetClippingRange(0.1, 1000.0);\n\n  modelAxes->VisibilityOn();\n\n  renWin->Render();\n  renWin->Render();\n\n  switch (figure)\n  {\n  default:\n  case 0:\n    RotateXY(renWin, modelActor);\n    break;\n  case 1:\n    RotateX(renWin, modelActor);\n    break;\n  case 2:\n    RotateY(renWin, modelActor);\n    break;\n  case 3:\n    RotateZ(renWin, modelActor);\n    break;\n  }\n  renWin->EraseOff();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid RotateX(vtkRenderWindow* renWin, vtkActor* actor)\n{\n  actor->SetOrientation(0, 0, 0);\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n\n  for (auto i = 0; i < 6; ++i)\n  {\n    actor->RotateX(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  renWin->EraseOn();\n}\n\nvoid RotateY(vtkRenderWindow* renWin, vtkActor* actor)\n{\n  actor->SetOrientation(0, 0, 0);\n  renWin->Render();\n  renWin->EraseOff();\n\n  for (auto i = 0; i < 6; ++i)\n  {\n    actor->RotateY(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  renWin->EraseOn();\n}\n\nvoid RotateZ(vtkRenderWindow* renWin, vtkActor* actor)\n{\n  actor->SetOrientation(0, 0, 0);\n  renWin->Render();\n  renWin->EraseOff();\n\n  for (auto i = 0; i < 6; ++i)\n  {\n    actor->RotateZ(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  renWin->EraseOn();\n}\n\nvoid RotateXY(vtkRenderWindow* renWin, vtkActor* actor)\n{\n  actor->SetOrientation(0, 0, 0);\n  actor->RotateX(60);\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n\n  for (auto i = 0; i < 6; ++i)\n  {\n    actor->RotateY(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  renWin->EraseOn();\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension = \"\";\n  if (fileName.find_last_of(\".\") != std::string::npos)\n  {\n    extension = fileName.substr(fileName.find_last_of(\".\"));\n  }\n  // Make the extension lowercase\n  std::transform(extension.begin(), extension.end(), extension.begin(),\n                 ::tolower);\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName.c_str());\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    // Return a polydata sphere if the extension is unknown.\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(20);\n    source->SetPhiResolution(11);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Rendering/Rotations/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Rotations)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Rotations: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Rotations MACOSX_BUNDLE Rotations.cxx )\n  target_link_libraries(Rotations PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Rotations\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/Rotations/#download-and-build-rotations","title":"Download and Build Rotations","text":"

        Click here to download Rotations and its CMakeLists.txt file. Once the tarball Rotations.tar has been downloaded and extracted,

        cd Rotations/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Rotations\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/RotationsA/","title":"RotationsA","text":"

        vtk-examples/Cxx/Rendering/RotationsA

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/RotationsA/#code","title":"Code","text":"

        RotationsA.cxx

        // These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n// The command line parameters are: cow.obj 1\n#include \"Rotations.cxx\"\n
        "},{"location":"Cxx/Rendering/RotationsA/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotationsA)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotationsA: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotationsA MACOSX_BUNDLE RotationsA.cxx )\n  target_link_libraries(RotationsA PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotationsA\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/RotationsA/#download-and-build-rotationsa","title":"Download and Build RotationsA","text":"

        Click here to download RotationsA and its CMakeLists.txt file. Once the tarball RotationsA.tar has been downloaded and extracted,

        cd RotationsA/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RotationsA\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/RotationsB/","title":"RotationsB","text":"

        vtk-examples/Cxx/Rendering/RotationsB

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/RotationsB/#code","title":"Code","text":"

        RotationsB.cxx

        // These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n// The command line parameters are: cow.obj 2\n#include \"Rotations.cxx\"\n
        "},{"location":"Cxx/Rendering/RotationsB/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotationsB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotationsB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotationsB MACOSX_BUNDLE RotationsB.cxx )\n  target_link_libraries(RotationsB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotationsB\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/RotationsB/#download-and-build-rotationsb","title":"Download and Build RotationsB","text":"

        Click here to download RotationsB and its CMakeLists.txt file. Once the tarball RotationsB.tar has been downloaded and extracted,

        cd RotationsB/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RotationsB\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/RotationsC/","title":"RotationsC","text":"

        vtk-examples/Cxx/Rendering/RotationsC

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/RotationsC/#code","title":"Code","text":"

        RotationsC.cxx

        // These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n// The command line parameters are: cow.obj 3\n#include \"Rotations.cxx\"\n
        "},{"location":"Cxx/Rendering/RotationsC/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotationsC)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotationsC: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotationsC MACOSX_BUNDLE RotationsC.cxx )\n  target_link_libraries(RotationsC PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotationsC\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/RotationsC/#download-and-build-rotationsc","title":"Download and Build RotationsC","text":"

        Click here to download RotationsC and its CMakeLists.txt file. Once the tarball RotationsC.tar has been downloaded and extracted,

        cd RotationsC/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RotationsC\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/RotationsD/","title":"RotationsD","text":"

        vtk-examples/Cxx/Rendering/RotationsD

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/RotationsD/#code","title":"Code","text":"

        RotationsD.cxx

        // These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n// Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n// The command line parameters are: cow.obj 0\n#include \"Rotations.cxx\"\n
        "},{"location":"Cxx/Rendering/RotationsD/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotationsD)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotationsD: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotationsD MACOSX_BUNDLE RotationsD.cxx )\n  target_link_libraries(RotationsD PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotationsD\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/RotationsD/#download-and-build-rotationsd","title":"Download and Build RotationsD","text":"

        Click here to download RotationsD and its CMakeLists.txt file. Once the tarball RotationsD.tar has been downloaded and extracted,

        cd RotationsD/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RotationsD\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/Shadows/","title":"Shadows","text":"

        vtk-examples/Cxx/Rendering/Shadows

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/Shadows/#code","title":"Code","text":"

        Shadows.cxx

        // Test baking shadow maps.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCameraPass.h>\n#include <vtkCubeSource.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderStepsPass.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSequencePass.h>\n#include <vtkShadowMapBakerPass.h>\n#include <vtkShadowMapPass.h>\n#include <vtkSmartPointer.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  // Read the polyData.\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"HighNoonSun\", 1.0, 1.0, .9843, 1.0); // Color temp. 5400k.\n  colors->SetColor(\"100W Tungsten\", 1.0, .8392, .6667,\n                   1.0); // Color temp. 2850k.\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkLight> light1;\n  light1->SetFocalPoint(0, 0, 0);\n  light1->SetPosition(0, 1, 0.2);\n  light1->SetColor(colors->GetColor3d(\"HighNoonSun\").GetData());\n  light1->SetIntensity(0.3);\n  renderer->AddLight(light1);\n\n  vtkNew<vtkLight> light2;\n  light2->SetFocalPoint(0, 0, 0);\n  light2->SetPosition(1.0, 1.0, 1.0);\n  light2->SetColor(colors->GetColor3d(\"100W Tungsten\").GetData());\n  light2->SetIntensity(0.8);\n  renderer->AddLight(light2);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetAmbientColor(\n      colors->GetColor3d(\"SaddleBrown\").GetData());\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Sienna\").GetData());\n  actor->GetProperty()->SetSpecularColor(colors->GetColor3d(\"White\").GetData());\n  actor->GetProperty()->SetSpecular(0.51);\n  actor->GetProperty()->SetDiffuse(0.7);\n  actor->GetProperty()->SetAmbient(0.7);\n  actor->GetProperty()->SetSpecularPower(30.0);\n  actor->GetProperty()->SetOpacity(1.0);\n  renderer->AddActor(actor);\n\n  // Add a plane.\n  std::array<double, 6> bounds;\n  polyData->GetBounds(bounds.data());\n\n  std::array<double, 3> range;\n  range[0] = bounds[1] - bounds[0];\n  range[1] = bounds[3] - bounds[2];\n  range[2] = bounds[5] - bounds[4];\n  std::cout << \"Range: \" << range[0] << \",\" << range[1] << \",\" << range[2]\n            << std::endl;\n  double expand = 1.0;\n  auto thickness = range[2] * 0.1;\n  vtkNew<vtkCubeSource> plane;\n  plane->SetCenter((bounds[1] + bounds[0]) / 2.0, bounds[2] - thickness / 2.0,\n                   (bounds[5] + bounds[4]) / 2.0);\n  plane->SetXLength(bounds[1] - bounds[0] + (range[0] * expand));\n  plane->SetYLength(thickness);\n  plane->SetZLength(bounds[5] - bounds[4] + (range[2] * expand));\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(plane->GetOutputPort());\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n  renderer->AddActor(planeActor);\n\n  renderWindow->SetMultiSamples(0);\n\n  vtkNew<vtkShadowMapPass> shadows;\n\n  vtkNew<vtkSequencePass> seq;\n\n  vtkNew<vtkRenderPassCollection> passes;\n  passes->AddItem(shadows->GetShadowMapBakerPass());\n  passes->AddItem(shadows);\n  seq->SetPasses(passes);\n\n  vtkNew<vtkCameraPass> cameraP;\n  cameraP->SetDelegatePass(seq);\n\n  // Tell the renderer to use our render pass pipeline.\n  vtkOpenGLRenderer* glrenderer =\n      dynamic_cast<vtkOpenGLRenderer*>(renderer.GetPointer());\n  glrenderer->SetPass(cameraP);\n\n  renderer->GetActiveCamera()->SetPosition(-0.2, 0.2, 1);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(2.25);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"Shadows\");\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameLastExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetThetaResolution(100);\n    source->SetPhiResolution(100);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Rendering/Shadows/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Shadows)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Shadows: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Shadows MACOSX_BUNDLE Shadows.cxx )\n  target_link_libraries(Shadows PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Shadows\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/Shadows/#download-and-build-shadows","title":"Download and Build Shadows","text":"

        Click here to download Shadows and its CMakeLists.txt file. Once the tarball Shadows.tar has been downloaded and extracted,

        cd Shadows/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Shadows\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/SpecularSpheres/","title":"SpecularSpheres","text":"

        vtk-examples/Cxx/Rendering/SpecularSpheres

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/SpecularSpheres/#description","title":"Description","text":"

        Note

        The original source code for this example is here.

        Info

        See Figure 3-10 in Chapter 3 the VTK Textbook.

        Info

        Similar examples setting the ambient and diffuse properties are: See AmbientSpheres.cxx, AmbientSpheres.py, AmbientSpheres.java and DiffuseSpheres.cxx, DiffuseSpheres.py.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/SpecularSpheres/#code","title":"Code","text":"

        SpecularSpheres.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"bkg\", bkg.data());\n\n  // The following lines create a sphere represented by polygons.\n  //\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(100);\n  sphere->SetPhiResolution(50);\n\n  // The mapper is responsible for pushing the geometry into the graphics\n  // library. It may also do color mapping, if scalars or other attributes\n  // are defined.\n  //\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  // The actor is a grouping mechanism: besides the geometry (mapper), it\n  // also has a property, transformation matrix, and/or texture map.\n  // In this example we create eight different spheres (two rows of four\n  // spheres) and set the specular lighting coefficients. A little ambient\n  // is turned on so the sphere is not completely black on the back side.\n  //\n  // Since we are using the same sphere source and mapper for all eight spheres\n  // we will use a std::array holding the actors.\n  //\n  // If you want/need to use std::vector, then you must use\n  // std::vector<vtkSmartPointer<vtkActor>> spheres;\n  // and then, in a loop, create the object using\n  // spheres.push_back(vtkSmartPointer<vtkActor>::New());\n  //\n  // The reason:\n  // vtkNew, in contrast to vtkSmartPointer, has no assignment operator\n  // or copy constructor and owns one object for its whole lifetime.\n  // Thus vtkNew does not satisfy the CopyAssignable and CopyConstructible\n  // requirements needed for other std containers like std::vector or std::list.\n  // std::array, on the other hand, is a container encapsulating fixed size\n  // arrays so its elements do not need to be CopyAssignable and\n  // CopyConstructible.\n  //\n  // So:\n  //    std::array - vtkNew or vtkSmartPointer can be used.\n  //    std::vector, std::list - only vtkSmartPointer can be used.\n  //\n  auto const numberOfSpheres = 8;\n  std::array<vtkNew<vtkActor>, numberOfSpheres> spheres;\n  auto ambient = 0.3;\n  auto diffuse = 0.5;\n  auto specular = 1.0;\n  auto spBase = 5.0;\n  auto spScale = 1.0;\n  std::array<double, 3> position{{0, 0, 0}};\n  for (auto i = 0; i < spheres.size(); ++i)\n  {\n    auto specularPower = spBase * spScale;\n    spheres[i]->SetMapper(sphereMapper);\n    spheres[i]->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n    spheres[i]->GetProperty()->SetAmbient(ambient);\n    spheres[i]->GetProperty()->SetDiffuse(diffuse);\n    spheres[i]->GetProperty()->SetSpecular(specular);\n    spheres[i]->GetProperty()->SetSpecularPower(specularPower);\n    spheres[i]->GetProperty()->SetSpecularColor(\n        colors->GetColor3d(\"White\").GetData());\n    spheres[i]->AddPosition(position.data());\n    spScale = spScale * 2.0;\n    position[0] += 1.25;\n    if (i == 3)\n    {\n      specular = 0.5;\n      spScale = 1.0;\n      position[0] = 0;\n      position[1] = 1.25;\n    }\n  }\n\n  // Create the graphics structure. The renderer renders into the\n  // render window. The render window interactor captures mouse events\n  // and will perform appropriate camera or actor manipulation\n  // depending on the nature of the events.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  for (auto i = 0; i < 8; ++i)\n  {\n    ren->AddActor(spheres[i]);\n  }\n\n  ren->SetBackground(colors->GetColor3d(\"bkg\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"SpecularSpheres\");\n\n  // Set up the lighting.\n  //\n  vtkNew<vtkLight> light;\n  light->SetFocalPoint(1.875, 0.6125, 0);\n  light->SetPosition(0.875, 1.6125, 1);\n  ren->AddLight(light);\n\n  // We want to eliminate perspective effects on the apparent lighting.\n  // Parallel camera projection will be used. To zoom in parallel projection\n  // mode, the ParallelScale is set.\n  //\n  ren->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  ren->GetActiveCamera()->SetPosition(0, 0, 1);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->GetActiveCamera()->ParallelProjectionOn();\n  ren->ResetCamera();\n  ren->GetActiveCamera()->SetParallelScale(2.0);\n  // This starts the event loop and invokes an initial render.\n  //\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/SpecularSpheres/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SpecularSpheres)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SpecularSpheres: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SpecularSpheres MACOSX_BUNDLE SpecularSpheres.cxx )\n  target_link_libraries(SpecularSpheres PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SpecularSpheres\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/SpecularSpheres/#download-and-build-specularspheres","title":"Download and Build SpecularSpheres","text":"

        Click here to download SpecularSpheres and its CMakeLists.txt file. Once the tarball SpecularSpheres.tar has been downloaded and extracted,

        cd SpecularSpheres/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SpecularSpheres\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/StippledLine/","title":"StippledLine","text":"

        vtk-examples/Cxx/Rendering/StippledLine

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/StippledLine/#description","title":"Description","text":"

        VTK OpenGL2 no longer supports Stippled Lines. This example uses texture mapping to created stippled lines. Two parameters, StipplePattern and StippleRepeat, control the pattern of the stippled lines.

        StipplePattern is a 16-bit binary pattern, 1 = pixel on, 0 = pixel off.

        StippleRepeat is the stippling repeat factor of a Line, which specifies how many times each bit in the pattern is to be repeated.

        It can be tricky to set the proper pattern and repeat, so experiment.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/StippledLine/#code","title":"Code","text":"

        StippledLine.cxx

        #include <vtkActor.h>\n#include <vtkDoubleArray.h>\n#include <vtkImageData.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid StippledLine(vtkActor* actor, int LineStipplePattern = 0xFFFF,\n                  int LineStippleRepeat = 1);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkLineSource> lines;\n  // Create two points, P0 and P1\n  double p0[3] = {1.0, 0.0, 0.0};\n  double p1[3] = {5.0, 0.0, 0.0};\n\n  lines->SetResolution(11);\n  lines->SetPoint1(p0);\n  lines->SetPoint2(p1);\n  lines->Update();\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(lines->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetLineWidth(5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  StippledLine(actor, 0xA1A1, 2);\n\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"StippledLine\");\n\n  renWin->AddRenderer(ren1);\n  vtkSmartPointer<vtkRenderWindowInteractor> iren =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renWin);\n  ren1->AddActor(actor);\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid StippledLine(vtkActor* actor, int lineStipplePattern,\n                  int lineStippleRepeat)\n{\n  vtkNew<vtkDoubleArray> tcoords;\n  vtkNew<vtkImageData> image;\n  vtkNew<vtkTexture> texture;\n\n  // Create texture.\n  int dimension = 16 * lineStippleRepeat;\n\n  image->SetDimensions(dimension, 1, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 4);\n  image->SetExtent(0, dimension - 1, 0, 0, 0, 0);\n  unsigned char* pixel;\n  pixel = static_cast<unsigned char*>(image->GetScalarPointer());\n  unsigned char on = 255;\n  unsigned char off = 0;\n  for (int i = 0; i < 16; ++i)\n  {\n    unsigned int mask = (1 << i);\n    unsigned int bit = (lineStipplePattern & mask) >> i;\n    unsigned char value = static_cast<unsigned char>(bit);\n    if (value == 0)\n    {\n      for (int j = 0; j < lineStippleRepeat; ++j)\n      {\n        *pixel = on;\n        *(pixel + 1) = on;\n        *(pixel + 2) = on;\n        *(pixel + 3) = off;\n        pixel += 4;\n      }\n    }\n    else\n    {\n      for (int j = 0; j < lineStippleRepeat; ++j)\n      {\n        *pixel = on;\n        *(pixel + 1) = on;\n        *(pixel + 2) = on;\n        *(pixel + 3) = on;\n        pixel += 4;\n      }\n    }\n  }\n  vtkPolyData* polyData =\n      dynamic_cast<vtkPolyData*>(actor->GetMapper()->GetInput());\n\n  // Create texture coordnates.\n  tcoords->SetNumberOfComponents(1);\n  tcoords->SetNumberOfTuples(polyData->GetNumberOfPoints());\n  for (int i = 0; i < polyData->GetNumberOfPoints(); ++i)\n  {\n    double value = static_cast<double>(i) * .5;\n    tcoords->SetTypedTuple(i, &value);\n  }\n\n  polyData->GetPointData()->SetTCoords(tcoords);\n  texture->SetInputData(image);\n  texture->InterpolateOff();\n  texture->RepeatOn();\n\n  actor->SetTexture(texture);\n}\n} // namespace\n
        "},{"location":"Cxx/Rendering/StippledLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StippledLine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StippledLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StippledLine MACOSX_BUNDLE StippledLine.cxx )\n  target_link_libraries(StippledLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StippledLine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/StippledLine/#download-and-build-stippledline","title":"Download and Build StippledLine","text":"

        Click here to download StippledLine and its CMakeLists.txt file. Once the tarball StippledLine.tar has been downloaded and extracted,

        cd StippledLine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StippledLine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/StringToImageDemo/","title":"StringToImageDemo","text":"

        vtk-examples/Cxx/Rendering/StringToImageDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/StringToImageDemo/#description","title":"Description","text":"

        This example demonstrates the use of vtkFreeTypeTools to populate an image with multiple strings converted into images. The final image is created using vtkImageBlend to blend each string image into the final image. If a string image does not fit in the final image or overlaps with an image in final, that sting image is skipped.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/StringToImageDemo/#code","title":"Code","text":"

        StringToImageDemo.cxx

        #include <vtkCamera.h>\n#include <vtkFreeTypeTools.h>\n#include <vtkImageBlend.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageIterator.h>\n#include <vtkImageViewer2.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStdString.h>\n#include <vtkTextProperty.h>\n\n#include <array>\n// #include <random>\n\nint main(int argc, char* argv[])\n{\n  vtkStdString text;\n  if (argc < 2)\n  {\n    text = \"Old Guys Rule\";\n  }\n  else\n  {\n    text = argv[1];\n  }\n\n  // Create a blank, black image\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 640, 0, 480, 0, 0);\n  drawing->SetDrawColor(0, 0, 0);\n  drawing->FillBox(0, 629, 0, 479);\n\n  // Create an image that will hold the final image\n  vtkNew<vtkImageBlend> final;\n  final->AddInputConnection(drawing->GetOutputPort());\n  final->SetOpacity(0, 1.0);\n  final->Update();\n\n  // Create an image of the string\n  int dpi = 150;\n  vtkFreeTypeTools* freeType = vtkFreeTypeTools::GetInstance();\n  freeType->ScaleToPowerTwoOff();\n\n  // Setup a property for the strings containing fixed parameters\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  textProperty->SetVerticalJustificationToCentered();\n  textProperty->SetJustificationToCentered();\n\n  // Distributions for random parameters\n  // std::mt19937 mt(4355412); // Standard mersenne_twister_engine\n  // std::uniform_int_distribution<> extentXDist(0, 640);\n  // std::uniform_int_distribution<> extentYDist(0, 480);\n  // std::uniform_int_distribution<> fontDist(6, 42);\n  // std::uniform_real_distribution<double> orientationDist(-90, 90);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n\n  // For each string, create an image and see if it overlaps with other images,\n  // if so, skip it\n  int tried = 600;\n  int accepted = 0;\n  for (int i = 0; i < tried; ++i)\n  {\n    // int fontSize = fontDist(mt);\n    int fontSize = static_cast<int>(randomSequence->GetRangeValue(6, 42));\n    randomSequence->Next();\n    // textProperty->SetOrientation(orientationDist(mt));\n    textProperty->SetOrientation(randomSequence->GetRangeValue(-90, 90));\n    randomSequence->Next();\n    textProperty->SetFontSize(fontSize);\n\n    vtkNew<vtkImageData> textImage;\n    freeType->RenderString(textProperty, text, dpi, textImage.GetPointer());\n\n    // Set the extent of the text image\n    std::array<int, 4> bb;\n    freeType->GetBoundingBox(textProperty, text, dpi, bb.data());\n    // int offsetX = extentXDist(mt);\n    // int offsetY = extentYDist(mt);\n    int offsetX = static_cast<int>(randomSequence->GetRangeValue(0, 640));\n    randomSequence->Next();\n    int offsetY = static_cast<int>(randomSequence->GetRangeValue(0, 480));\n    randomSequence->Next();\n    // Make sure the text image will fit on the final image\n    if (offsetX + bb[1] - bb[0] < 639 && offsetY + bb[3] - bb[2] < 479)\n    {\n      textImage->SetExtent(offsetX, offsetX + bb[1] - bb[0], offsetY,\n                           offsetY + bb[3] - bb[2], 0, 0);\n      vtkNew<vtkImageData> image;\n      final->Update();\n\n      // Does the text image overlap with images on the final image\n      vtkImageIterator<unsigned char> finalIt(final->GetOutput(),\n                                              textImage->GetExtent());\n      unsigned char R;\n      bool good = true;\n      while (!finalIt.IsAtEnd())\n      {\n        auto finalSpan = finalIt.BeginSpan();\n        while (finalSpan != finalIt.EndSpan())\n        {\n          R = *finalSpan++;\n          finalSpan++;\n          finalSpan++;\n          if (R != 0)\n          {\n            good = false;\n            break;\n          }\n        }\n        if (!good)\n        {\n          break;\n        }\n        finalIt.NextSpan();\n      }\n      if (good)\n      {\n        accepted++;\n        image->DeepCopy(textImage);\n        final->AddInputData(image);\n        final->SetOpacity(i + 1, 1.0); // text: 100% opaque\n        final->Update();\n      }\n    }\n  }\n  std::cout << \"Tried \" << tried << \", but only accepted \" << accepted\n            << std::endl;\n  // Display the result\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputData(final->GetOutput());\n  imageViewer->SetSize(640, 512);\n  imageViewer->SetupInteractor(interactor);\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Wheat\").GetData());\n  imageViewer->GetRenderer()->ResetCamera();\n  imageViewer->GetRenderWindow()->SetWindowName(\"StringToImageDemo\");\n\n  auto camera = imageViewer->GetRenderer()->GetActiveCamera();\n  camera->ParallelProjectionOn();\n  camera->SetParallelScale(640 * 0.4);\n  imageViewer->GetRenderWindow()->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/StringToImageDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StringToImageDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingSources\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StringToImageDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StringToImageDemo MACOSX_BUNDLE StringToImageDemo.cxx )\n  target_link_libraries(StringToImageDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StringToImageDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/StringToImageDemo/#download-and-build-stringtoimagedemo","title":"Download and Build StringToImageDemo","text":"

        Click here to download StringToImageDemo and its CMakeLists.txt file. Once the tarball StringToImageDemo.tar has been downloaded and extracted,

        cd StringToImageDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StringToImageDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/StripFran/","title":"StripFran","text":"

        vtk-examples/Cxx/Rendering/StripFran

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/StripFran/#description","title":"Description","text":"

        Triangle strip examples. Left, structured triangle mesh consisting of 134 strips each of 390 triangles. Right, Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip.

        Info

        See Figure 9-21 in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/StripFran/#code","title":"Code","text":"

        StripFran.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDecimatePro.h>\n#include <vtkMaskPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fran_cut.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer1;\n  renderer1->SetViewport(0., 0., 0.5, 1.);\n\n  vtkNew<vtkRenderer> renderer2;\n  renderer2->SetViewport(0.5, 0., 1., 1.);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer1);\n  renderWindow->AddRenderer(renderer2);\n  renderWindow->SetWindowName(\"StripFran\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // create a cyberware source\n  //\n  vtkNew<vtkPolyDataReader> cyber;\n  cyber->SetFileName(argv[1]);\n\n  vtkNew<vtkDecimatePro> deci;\n  deci->SetInputConnection(cyber->GetOutputPort());\n  deci->SetTargetReduction(0.7);\n  deci->PreserveTopologyOn();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(deci->GetOutputPort());\n\n  vtkNew<vtkMaskPolyData> mask;\n  mask->SetInputConnection(deci->GetOutputPort());\n  mask->SetOnRatio(2);\n\n  vtkNew<vtkPolyDataMapper> cyberMapper;\n  cyberMapper->SetInputConnection(mask->GetOutputPort());\n\n  vtkNew<vtkActor> cyberActor;\n  cyberActor->SetMapper(cyberMapper);\n  cyberActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(cyber->GetOutputPort());\n\n  vtkNew<vtkMaskPolyData> stripperMask;\n  stripperMask->SetInputConnection(stripper->GetOutputPort());\n  stripperMask->SetOnRatio(2);\n\n  vtkNew<vtkPolyDataMapper> stripperMapper;\n  stripperMapper->SetInputConnection(stripperMask->GetOutputPort());\n\n  vtkNew<vtkActor> stripperActor;\n  stripperActor->SetMapper(stripperMapper);\n  stripperActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer1->AddActor(stripperActor);\n  renderer2->AddActor(cyberActor);\n  renderer1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer2->SetBackground(colors->GetColor3d(\"Papaya_Whip\").GetData());\n  renderWindow->SetSize(1024, 640);\n\n  // render the image\n  //\n  vtkNew<vtkCamera> cam1;\n  cam1->SetFocalPoint(0, 0, 0);\n  cam1->SetPosition(1, 0, 0);\n  cam1->SetViewUp(0, 1, 0);\n  renderer1->SetActiveCamera(cam1);\n  renderer2->SetActiveCamera(cam1);\n  renderer1->ResetCamera();\n  cam1->Azimuth(30);\n  cam1->Elevation(30);\n  cam1->Dolly(1.4);\n  renderer1->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/StripFran/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StripFran)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StripFran: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StripFran MACOSX_BUNDLE StripFran.cxx )\n  target_link_libraries(StripFran PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StripFran\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/StripFran/#download-and-build-stripfran","title":"Download and Build StripFran","text":"

        Click here to download StripFran and its CMakeLists.txt file. Once the tarball StripFran.tar has been downloaded and extracted,

        cd StripFran/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StripFran\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/TransformSphere/","title":"TransformSphere","text":"

        vtk-examples/Cxx/Rendering/TransformSphere

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/TransformSphere/#description","title":"Description","text":"

        This example extends the pipeline of the ColoredSphere.cxx example and shows the effects of type checking on the connectivity of process objects. We add a transform filter (vtkTransformFilter) to nonuniformly scale the sphere in the x-y-z directions. The transform filter only operates on objects with explicit point coordinate representation (i.e., a subclass of vtkPointSet ). However, the elevation filter generates the more general form vtkDataSet as output. Hence we cannot connect the transform filter to the elevation filter. But we can connect the transform filter to the sphere source, and then the elevation filter to the transform filter. (Note: an alternative method is to use vtkCastToConcrete to perform run-time casting.)

        Info

        See Figure 4-20 in Chapter 4 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/TransformSphere/#code","title":"Code","text":"

        TransformSphere.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkElevationFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(12);\n  sphere->SetPhiResolution(12);\n\n  vtkNew<vtkTransform> aTransform;\n  aTransform->Scale(1, 1.5, 2);\n\n  vtkNew<vtkTransformFilter> transFilter;\n  transFilter->SetInputConnection(sphere->GetOutputPort());\n  transFilter->SetTransform(aTransform);\n\n  vtkNew<vtkElevationFilter> colorIt;\n  colorIt->SetInputConnection(transFilter->GetOutputPort());\n  colorIt->SetLowPoint(0, 0, -1);\n  colorIt->SetHighPoint(0, 0, 1);\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.667, 0);\n  lut->SetSaturationRange(1, 1);\n  lut->SetValueRange(1, 1);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetLookupTable(lut);\n  mapper->SetInputConnection(colorIt->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"TransformSphere\");\n\n  renWin->Render();\n\n  // interact with data\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Rendering/TransformSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformSphere MACOSX_BUNDLE TransformSphere.cxx )\n  target_link_libraries(TransformSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/TransformSphere/#download-and-build-transformsphere","title":"Download and Build TransformSphere","text":"

        Click here to download TransformSphere and its CMakeLists.txt file. Once the tarball TransformSphere.tar has been downloaded and extracted,

        cd TransformSphere/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TransformSphere\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/TransparentBackground/","title":"TransparentBackground","text":"

        vtk-examples/Cxx/Rendering/TransparentBackground

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/TransparentBackground/#description","title":"Description","text":"

        Demonstrates the use of two renderers. Notice that the second (and subsequent) renderers will have a transparent background.

        You can manipulate the object in the second layer/renderer whilst the objects in the first layer/renderer form the background.

        • Pressing 0 on the keyboard will let you manipulate the objects in layer 0.
        • Pressing 1 on the keyboard will let you manipulate the objects in layer 1.

        Info

        Also see the LayeredActors.cxx and LayeredActors.py examples, where we have added an extra callback so that the non-active layer objects move in conjunction with the active layer objects.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/TransparentBackground/#code","title":"Code","text":"

        TransparentBackground.cxx

        /**\n  1. Create a cube and cone source.\n  2. Render it with the cube in layer 0 and the cone in layer 1 of the render\n  window.\n  3. Interact with it.\n  4. Notice that the cube and the cone are both visible and the layer 1\n  background is transparent.\n  5. Pressing '0' on the keyboard will let you manipulate the objects in\n  layer 0.\n  6. Pressing '1' on the keyboard will let you manipulate the objects in\n  layer 1.\n*/\n\n#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkInteractorObserver.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n\n#include <array>\n#include <cstdlib>\n#include <iomanip>\n#include <iostream>\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                              void* clientData, void* callData);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetXLength(4.0);\n  cubeSource->SetYLength(9.0);\n  cubeSource->SetZLength(1.0);\n  cubeSource->SetCenter(0.0, 0.0, 0.0);\n\n  // Render the cube\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"DarkGreen\").GetData());\n  cubeActor->SetMapper(cubeMapper);\n\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetCenter(0.0, 0.0, 0.0);\n  coneSource->SetHeight(1.0);\n  coneSource->SetRadius(0.25);\n  coneSource->SetDirection(0.0, 1.0, 0.0);\n  coneSource->SetResolution(60);\n  coneSource->CappingOn();\n\n  // Render the cone\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"DarkTurquoise\").GetData());\n  // Make the cone slightly transparent for fun\n  coneActor->GetProperty()->SetOpacity(0.75);\n  coneActor->SetMapper(coneMapper);\n\n  // The renderers, render window and interactor\n  std::array<vtkNew<vtkRenderer>, 2> renderers;\n  vtkNew<vtkRenderWindow> renWin;\n  for (auto&& ren : renderers)\n  {\n    renWin->AddRenderer(ren);\n  }\n  renWin->SetSize(800, 800);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Layer 0 - background not transparent\n  renderers[0]->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderers[0]->AddActor(cubeActor);\n  renderers[0]->SetLayer(0);\n\n  // Layer 1 - the background is transparent\n  //           so we only see the layer 0 background color\n  renderers[1]->AddActor(coneActor);\n  renderers[1]->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderers[1]->SetLayer(1);\n\n  // We have two layers\n  renWin->SetNumberOfLayers(static_cast<int>(renderers.size()));\n  renWin->Render();\n  renWin->SetWindowName(\"TransparentBackground\");\n  renWin->StereoRenderOff();\n\n  vtkNew<vtkCallbackCommand> keypressCallback;\n  keypressCallback->SetCallback(KeypressCallbackFunction);\n  iren->AddObserver(vtkCommand::KeyPressEvent, keypressCallback);\n\n  // Interact with the data\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject* caller,\n                              long unsigned int vtkNotUsed(eventId),\n                              void* vtkNotUsed(clientData),\n                              void* vtkNotUsed(callData))\n{\n  vtkRenderWindowInteractor* iren =\n      static_cast<vtkRenderWindowInteractor*>(caller);\n  vtkRendererCollection* renderers = iren->GetRenderWindow()->GetRenderers();\n  if (renderers->GetNumberOfItems() < 2)\n  {\n    std::cerr << \"We need at least two renderers, we have only \"\n              << renderers->GetNumberOfItems() << std::endl;\n    return;\n  }\n  renderers->InitTraversal();\n  // Top item\n  vtkRenderer* ren0 = renderers->GetNextItem();\n  // Bottom item\n  vtkRenderer* ren1 = renderers->GetNextItem();\n\n  std::string key = iren->GetKeySym();\n\n  if (key == \"0\")\n  {\n    iren->GetRenderWindow()\n        ->GetInteractor()\n        ->GetInteractorStyle()\n        ->SetDefaultRenderer(ren0);\n    ren0->InteractiveOn();\n    ren1->InteractiveOff();\n  }\n  if (key == \"1\")\n  {\n    iren->GetRenderWindow()\n        ->GetInteractor()\n        ->GetInteractorStyle()\n        ->SetDefaultRenderer(ren1);\n    ren0->InteractiveOff();\n    ren1->InteractiveOn();\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/Rendering/TransparentBackground/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransparentBackground)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransparentBackground: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransparentBackground MACOSX_BUNDLE TransparentBackground.cxx )\n  target_link_libraries(TransparentBackground PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransparentBackground\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/TransparentBackground/#download-and-build-transparentbackground","title":"Download and Build TransparentBackground","text":"

        Click here to download TransparentBackground and its CMakeLists.txt file. Once the tarball TransparentBackground.tar has been downloaded and extracted,

        cd TransparentBackground/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TransparentBackground\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/WalkCow/","title":"WalkCow","text":"

        vtk-examples/Cxx/Rendering/WalkCow

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Rendering/WalkCow/#description","title":"Description","text":"

        This generates Fig. 3-32: The cow \"walking\" around the global origin; Fig. 3-33: The cow rotating about a vector passing through her nose. (a) With origin (0,0,0). (b) With origin at (6.1,1.3,.02). found in VTKTextbook.

        The example allows an optional second argument that selects the figure to be generated. A 0 generates Fig 3-32, 1 generates Fig 3-33a and 2 generates Fig 3-33b.

        Info

        See Figure 3-32 in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/WalkCow/#code","title":"Code","text":"

        WalkCow.cxx

        // Translated from walkCow.tcl\n\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkBYUReader.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkVersionMacros.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <array>\n\nnamespace {\n/*\nThese Rotate* and Walk functions create a scene where multiple\n   views of the object exist.\n\n  They all operate in a similar manner, namely:\n  1) Accept vtkActor, vtkRenderer, vtkRenderWindow as parameters.\n  2) Position the object.\n  3) Position the observer with the focal point sent to the centre\n      of the object.\n  4) Render and set EraseOff() in the render window.\n     Note that:\n      EraseOff() has to be called after a Render() call\n       to work in the desired way.\n  5) Then rotate or walk the object around the scene.\n  6) Write out the scene using Screenshot().\n  6) Set EraseOff() in the render window.\n  7) Reset the object position.\n\n*/\nvoid Rotate_X(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Rotate_Y(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Rotate_Z(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Rotate_XY(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Rotate_V_0(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Rotate_V_V(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\nvoid Walk(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin);\n\n/*\n// Used to estimate positions similar to the book illustrations.\nstatic void CameraModifiedCallback(vtkObject* caller,\n                                   long unsigned int vtkNotUsed(eventId),\n                                   void* vtkNotUsed(clientData),\n                                   void* vtkNotUsed(callData));\n*/\n\n// Save a screenshot.\nvoid Screenshot(std::string fileName, vtkRenderWindow* renWin);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  int figure = 0;\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [figure]\" << std::endl;\n    std::cout << \"where: filename is the file cow.g\" << std::endl;\n    std::cout << \"       figure is 0, 1, or 2, default 0\" << std::endl;\n    std::cout\n        << \"Options 0, 1 and 2 are provided to let you generate\"\n           \" approximations to the following figures:\\n Figure 3-32,\"\n           \" Figure 3-33a and Figure 3-33b in Chapter 3 of the VTK Textbook.\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n  if (argc == 3)\n  {\n    figure = std::abs(atoi(argv[2]));\n    figure = (figure > 2) ? 0 : figure;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg1{{60, 93, 144, 255}};\n  colors->SetColor(\"BkgColor1\", bkg1.data());\n  std::array<unsigned char, 4> bkg2{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor2\", bkg2.data());\n\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // The cow pipeline.\n  vtkNew<vtkBYUReader> cow;\n  cow->SetGeometryFileName(fileName.c_str());\n  cow->Update();\n\n  vtkNew<vtkPolyDataMapper> cowMapper;\n  cowMapper->SetInputConnection(cow->GetOutputPort());\n  cowMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> cowActor;\n  cowActor->SetMapper(cowMapper);\n  cowActor->GetProperty()->SetColor(colors->GetColor3d(\"Wheat\").GetData());\n\n  ren->AddActor(cowActor);\n\n  // Axes pipeline.\n  vtkNew<vtkAxes> cowAxesSource;\n  cowAxesSource->SetScaleFactor(10.0);\n  cowAxesSource->SetOrigin(0, 0, 0);\n\n  vtkNew<vtkPolyDataMapper> cowAxesMapper;\n  cowAxesMapper->SetInputConnection(cowAxesSource->GetOutputPort());\n\n  vtkNew<vtkActor> cowAxes;\n  cowAxes->SetMapper(cowAxesMapper);\n  cowAxes->VisibilityOff();\n\n  ren->AddActor(cowAxes);\n\n  ren->SetBackground(colors->GetColor3d(\"BkgColor1\").GetData());\n  renWin->SetSize(600, 480);\n  renWin->SetWindowName(\"WalkCow\");\n\n  iren->Initialize();\n  cowAxes->VisibilityOn();\n  renWin->Render();\n\n  // Activate this if you want to see the Position and Focal point.\n  // vtkNew<vtkCallbackCommand> modifiedCallback;\n  // modifiedCallback->SetCallback(CameraModifiedCallback);\n  // ren->GetActiveCamera()->AddObserver(vtkCommand::ModifiedEvent,\n  // modifiedCallback);\n\n  // These four rotations use the same camera position.\n  Rotate_X(cowActor, ren, renWin);\n  Rotate_Y(cowActor, ren, renWin);\n  Rotate_Z(cowActor, ren, renWin);\n  Rotate_XY(cowActor, ren, renWin);\n\n  ren->SetBackground(colors->GetColor3d(\"BkgColor2\").GetData());\n  switch (figure)\n  {\n  default:\n  case 0:\n    Rotate_V_0(cowActor, ren, renWin);\n    Rotate_V_V(cowActor, ren, renWin);\n    // Walk() needs to go after Rotate_V_0() or Rotate_V_V().\n    Walk(cowActor, ren, renWin);\n    break;\n  case 1:\n    Rotate_V_0(cowActor, ren, renWin);\n    break;\n  case 2:\n    Rotate_V_V(cowActor, ren, renWin);\n    break;\n  }\n\n  // Interact with data.\n  // Keep the last rendered image.\n  renWin->EraseOff();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid Rotate_X(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // Six rotations about the x axis.\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(2, 25, 0);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->GetActiveCamera()->SetViewUp(0, 0, -1);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateX(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-31a.png\", renWin);\n  renWin->EraseOn();\n}\n\nvoid Rotate_Y(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // Six rotations about the y axis.\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(2, 0, 25);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateY(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-31b.png\", renWin);\n  renWin->EraseOn();\n}\n\nvoid Rotate_Z(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // Six rotations about the z axis.\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(2, 0, 25);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateZ(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-31c.png\", renWin);\n  renWin->EraseOn();\n}\n\nvoid Rotate_XY(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // First a rotation about the x axis, then six rotations about the y axis.\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(2, 0, 25);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  cowActor->RotateX(60);\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateY(60);\n    renWin->Render();\n    renWin->Render();\n  }\n  cowActor->RotateX(-60);\n  Screenshot(\"Fig3-31d.png\", renWin);\n  renWin->EraseOn();\n}\n\nvoid Rotate_V_0(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // The cow rotating about a vector passing through her nose.\n  // With the origin at (0, 0, 0).\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  vtkNew<vtkTransform> cowPos;\n  cowPos->Identity();\n  cowPos->SetMatrix(cowActor->GetMatrix());\n  vtkNew<vtkTransform> cowTransform;\n  cowTransform->Identity();\n  cowActor->SetUserMatrix(cowTransform->GetMatrix());\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(16, 9, -12);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateWXYZ(60, 2.19574, -1.42455, -0.0331036);\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-33a.png\", renWin);\n  renWin->EraseOn();\n  // Put the cow back on the origin.\n  // for (int idx = 0; idx < 6; idx++)\n  //{\n  //  cowActor->RotateWXYZ(-60, 2.19574, -1.42455, -0.0331036);\n  //}\n  // cowActor->SetUserMatrix(cowPos->GetMatrix());\n  // ren->GetActiveCamera()->SetPosition(0, 0, 1);\n  // ren->GetActiveCamera()->SetViewUp(0, 1, 0);\n  // ren->ResetCamera();\n}\n\nvoid Rotate_V_V(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // The cow rotating about a vector passing through her nose.\n  // With the origin at (6.11414, 1.27386, 0.015175).\n  ren->ResetCamera();\n  ren->ResetCameraClippingRange();\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0);\n  cowActor->SetPosition(0, 0, 0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  vtkNew<vtkTransform> cowPos;\n  cowPos->Identity();\n  cowPos->SetMatrix(cowActor->GetMatrix());\n  cowActor->SetOrigin(6.11414, 1.27386, 0.015175); // The cow's nose\n  vtkNew<vtkTransform> cowTransform;\n  cowTransform->Identity();\n  cowActor->SetUserMatrix(cowTransform->GetMatrix());\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(31, 23, -21);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowActor->RotateWXYZ(60, 2.19574, -1.42455, -0.0331036);\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-33b.png\", renWin);\n  renWin->EraseOn();\n  // Put the cow back on the origin.\n  // for (int idx = 0; idx < 6; idx++)\n  //{\n  //  cowActor->RotateWXYZ(-60, 2.19574, -1.42455, -0.0331036);\n  //}\n  // cowActor->SetUserMatrix(cowPos->GetMatrix());\n}\n\nvoid Walk(vtkActor* cowActor, vtkRenderer* ren, vtkRenderWindow* renWin)\n{\n  // The cow \"walking\" around the global origin\n  vtkNew<vtkTransform> cowPos;\n  cowPos->Identity();\n  cowPos->SetMatrix(cowActor->GetMatrix());\n  cowActor->SetOrientation(0.0, 0.0, 0.0);\n  cowActor->SetOrigin(0.0, 0.0, 0.0);\n  // Get the focal point.\n  double* bounds = cowActor->GetBounds();\n  double fp[3];\n  for (int i = 0; i < 3; ++i)\n  {\n    fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0;\n  }\n  vtkNew<vtkTransform> cowTransform;\n  cowTransform->Identity();\n  cowTransform->Translate(0, 0, 5);\n  cowActor->SetUserMatrix(cowTransform->GetMatrix());\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(1, 24, 16);\n  ren->GetActiveCamera()->SetFocalPoint(fp);\n  ren->GetActiveCamera()->SetViewUp(0, 0, -1);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  renWin->Render();\n  renWin->EraseOff();\n  for (int idx = 0; idx < 6; idx++)\n  {\n    cowTransform->Identity();\n    cowTransform->RotateY(idx * 60);\n    cowTransform->Translate(0, 0, 5);\n    cowActor->SetUserMatrix(cowTransform->GetMatrix());\n    renWin->Render();\n    renWin->Render();\n  }\n  Screenshot(\"Fig3-32.png\", renWin);\n  renWin->EraseOn();\n  // Walkies are over, put the cow back on the origin.\n  // cowActor->SetUserMatrix(cowPos->GetMatrix());\n}\n\n/*\nstatic void CameraModifiedCallback(vtkObject* caller,\n                                   long unsigned int vtkNotUsed(eventId),\n                                   void* vtkNotUsed(clientData),\n                                   void* vtkNotUsed(callData))\n{\n  std::cout << caller->GetClassName() << \" modified\" << std::endl;\n  vtkCamera* camera = static_cast<vtkCamera*>(caller);\n  // Print the interesting stuff.\n  std::cout << \"\\tPosition: \" << camera->GetPosition()[0] << \", \"\n            << camera->GetPosition()[1] << \", \" << camera->GetPosition()[2]\n            << std::endl;\n  std::cout << \"\\tFocal point: \" << camera->GetFocalPoint()[0] << \", \"\n            << camera->GetFocalPoint()[1] << \", \" << camera->GetFocalPoint()[2]\n            << std::endl;\n}\n*/\n\nvoid Screenshot(std::string fileName, vtkRenderWindow* renWin)\n{\n  vtkNew<vtkWindowToImageFilter> windowToImageFilter;\n  windowToImageFilter->SetInput(renWin);\n#if VTK_MAJOR_VERSION > 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 1\n  windowToImageFilter->SetScale(1); // image quality\n#else\n  windowToImageFilter->SetMagnification(1); // image quality\n#endif\n  // We are not recording the alpha (transparency) channel.\n  // windowToImageFilter->SetInputBufferTypeToRGBA();\n  windowToImageFilter->SetInputBufferTypeToRGB();\n  // Read from the front buffer.\n  windowToImageFilter->ReadFrontBufferOff();\n  windowToImageFilter->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(fileName.c_str());\n  writer->SetInputConnection(windowToImageFilter->GetOutputPort());\n  writer->Write();\n}\n} // namespace\n
        "},{"location":"Cxx/Rendering/WalkCow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WalkCow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  IOGeometry\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WalkCow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WalkCow MACOSX_BUNDLE WalkCow.cxx )\n  target_link_libraries(WalkCow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WalkCow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/WalkCow/#download-and-build-walkcow","title":"Download and Build WalkCow","text":"

        Click here to download WalkCow and its CMakeLists.txt file. Once the tarball WalkCow.tar has been downloaded and extracted,

        cd WalkCow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WalkCow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/WalkCowA/","title":"WalkCowA","text":"

        vtk-examples/Cxx/Rendering/WalkCowA

        "},{"location":"Cxx/Rendering/WalkCowA/#description","title":"Description","text":"

        This generates Fig. 3-33a: The cow rotating about a vector passing through her nose. (a) With origin (0,0,0).

        Info

        See Figure 3-33a in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/WalkCowA/#code","title":"Code","text":"

        WalkCowA.cxx

        // These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkBYUReader.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkVersionMacros.h>\n#include <vtkWindowToImageFilter.h>\n\n// The command line parameters are: cow.g 1\n#include \"WalkCow.cxx\"\n
        "},{"location":"Cxx/Rendering/WalkCowA/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WalkCowA)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  IOGeometry\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WalkCowA: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WalkCowA MACOSX_BUNDLE WalkCowA.cxx )\n  target_link_libraries(WalkCowA PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WalkCowA\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/WalkCowA/#download-and-build-walkcowa","title":"Download and Build WalkCowA","text":"

        Click here to download WalkCowA and its CMakeLists.txt file. Once the tarball WalkCowA.tar has been downloaded and extracted,

        cd WalkCowA/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WalkCowA\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Rendering/WalkCowB/","title":"WalkCowB","text":"

        vtk-examples/Cxx/Rendering/WalkCowB

        "},{"location":"Cxx/Rendering/WalkCowB/#description","title":"Description","text":"

        This generates Fig. 3-33b: The cow rotating about a vector passing through her nose.(b) With origin at (6.1,1.3,.02).

        Info

        See Figure 3-33b in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Rendering/WalkCowB/#code","title":"Code","text":"

        WalkCowB.cxx

        // These includes are necessary for WhatModulesVTK.py\n#include <vtkActor.h>\n#include <vtkAxes.h>\n#include <vtkBYUReader.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkVersionMacros.h>\n#include <vtkWindowToImageFilter.h>\n\n// The command line parameters are: cow.g 2\n#include \"WalkCow.cxx\"\n
        "},{"location":"Cxx/Rendering/WalkCowB/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WalkCowB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  IOGeometry\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WalkCowB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WalkCowB MACOSX_BUNDLE WalkCowB.cxx )\n  target_link_libraries(WalkCowB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WalkCowB\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Rendering/WalkCowB/#download-and-build-walkcowb","title":"Download and Build WalkCowB","text":"

        Click here to download WalkCowB and its CMakeLists.txt file. Once the tarball WalkCowB.tar has been downloaded and extracted,

        cd WalkCowB/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WalkCowB\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Shaders/BozoShader/","title":"BozoShader","text":"

        vtk-examples/Cxx/Shaders/BozoShader

        "},{"location":"Cxx/Shaders/BozoShader/#description","title":"Description","text":"

        This example shows how to add user functions to a VTK shader. The example's fragment shader uses an implementation of Ken Perlin's noise function. Perlin received a Technical Achievement Academy Award for his work procedural texture.

        The shader code contains a variable \"k\" that controls the frequency of the noisy colors. The default value will provide reasonable results for all polydata.

        The file for the shader code is src/Testing/Data/Shaders/PerlinNoise.glsl.

        usage

        BozoShader PerlinNoise.glsl horse.ply

        Cite

        Perlin's original Siggraph Paper: Perlin, K. 1985. \"An Image Synthesizer.\" Computer Graphics 19(3).

        Cite

        This shader is inspired by Ken Perlin's Bozo shader.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Shaders/BozoShader/#code","title":"Code","text":"

        BozoShader.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShaderProgram.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkTriangleMeshPointNormals.h>\n#include <vtkVersion.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\n// -----------------------------------------------------------------------\n// Update a uniform in the shader for each render. We do this with a\n// callback for the UpdateShaderEvent\nclass vtkShaderCallback : public vtkCommand\n{\npublic:\n  static vtkShaderCallback* New()\n  {\n    return new vtkShaderCallback;\n  }\n  vtkRenderer* Renderer;\n  float k;\n  void Execute(vtkObject*, unsigned long, void* calldata) override\n  {\n    vtkShaderProgram* program = reinterpret_cast<vtkShaderProgram*>(calldata);\n    if (program)\n    {\n      program->SetUniformf(\"k\", k);\n    }\n  }\n  void Print(std::ostream& os)\n  {\n    os << \"k: \" << k << std::endl;\n  }\n\n  vtkShaderCallback()\n  {\n    this->Renderer = nullptr;\n    this->k = 5;\n  }\n};\n} // namespace\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Shaders/PerlinNoise.glsl \"\n              << \"[polydataFile] \"\n              << \"[k(5)]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto polyData = ReadPolyData(argc > 2 ? argv[2] : \"\");\n\n  std::ifstream shaderFile(argv[1]);\n  std::ostringstream shaderCode;\n  shaderCode << shaderFile.rdbuf();\n\n  // Create a transform to rescale model\n  double center[3];\n  polyData->GetCenter(center);\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double maxBound =\n      std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n               bounds[5] - bounds[4]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Rescale polydata to [-1,1]\n  vtkNew<vtkTransform> userTransform;\n  userTransform->Translate(-center[0], -center[1], -center[2]);\n  userTransform->Scale(1.0 / maxBound, 1.0 / maxBound, 1.0 / maxBound);\n  vtkNew<vtkTransformPolyDataFilter> transform;\n  transform->SetTransform(userTransform);\n  transform->SetInputData(polyData);\n\n  vtkNew<vtkTriangleFilter> triangles;\n  triangles->SetInputConnection(transform->GetOutputPort());\n\n  vtkNew<vtkTriangleMeshPointNormals> norms;\n  norms->SetInputConnection(triangles->GetOutputPort());\n\n  mapper->SetInputConnection(norms->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetAmbientColor(0.2, 0.2, 0.2);\n  actor->GetProperty()->SetDiffuseColor(1.0, 1.0, 1.0);\n  actor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n  actor->GetProperty()->SetSpecular(0.5);\n  actor->GetProperty()->SetDiffuse(0.7);\n  actor->GetProperty()->SetAmbient(0.1);\n  actor->GetProperty()->SetSpecularPower(100.0);\n  actor->GetProperty()->SetOpacity(1.0);\n\n  // Modify the vertex shader to pass the position of the vertex\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n\n  // Add the code to generate noise\n  // These functions need to be defined outside of main. Use the System::Dec\n  // to declare and implement\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\"//VTK::System::Dec\",\n                                   false, // before the standard replacements\n                                   shaderCode.str(),\n                                   false // only do it once\n  );\n\n#else\n  mapper->AddShaderReplacement(vtkShader::Fragment, \"//VTK::System::Dec\",\n                               false, // before the standard replacements\n                               shaderCode.str(),\n                               false // only do it once\n  );\n#endif\n\n  // Define varying and uniforms for the fragment shader here\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform float k = 1.0;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform float k = 1.0;\\n\",\n      false // only do it once\n  );\n#endif\n\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"  vec3 noisyColor;\\n\"\n      \"  noisyColor.r = noise(k * 10.0 * myVertexMC);\\n\"\n      \"  noisyColor.g = noise(k * 11.0 * myVertexMC);\\n\"\n      \"  noisyColor.b = noise(k * 12.0 * myVertexMC);\\n\"\n      \"  /* map ranges of noise values into different colors */\\n\"\n      \"  int i;\\n\"\n      \"  float lowerValue = .3;\\n\"\n      \"  float upperValue = .6;\\n\"\n      \"  for ( i=0; i<3; i+=1)\\n\"\n      \"  {\\n\"\n      \"    noisyColor[i] = (noisyColor[i] + 1.0) / 2.0;\\n\"\n      \"    if (noisyColor[i] < lowerValue) \\n\"\n      \"    {\\n\"\n      \"      noisyColor[i] = lowerValue;\\n\"\n      \"    }\\n\"\n      \"    else\\n\"\n      \"    {\\n\"\n      \"      if (noisyColor[i] < upperValue)\\n\"\n      \"      {\\n\"\n      \"        noisyColor[i] = upperValue;\\n\"\n      \"      }\\n\"\n      \"      else\\n\"\n      \"      {\\n\"\n      \"        noisyColor[i] = 1.0;\\n\"\n      \"      }\\n\"\n      \"    }\\n\"\n      \"  }\\n\"\n      \"  fragOutput0.rgb = opacity * vec3(ambientColor + noisyColor * diffuse \"\n      \"+ specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"  vec3 noisyColor;\\n\"\n      \"  noisyColor.r = noise(k * 10.0 * myVertexMC);\\n\"\n      \"  noisyColor.g = noise(k * 11.0 * myVertexMC);\\n\"\n      \"  noisyColor.b = noise(k * 12.0 * myVertexMC);\\n\"\n      \"  /* map ranges of noise values into different colors */\\n\"\n      \"  int i;\\n\"\n      \"  float lowerValue = .3;\\n\"\n      \"  float upperValue = .6;\\n\"\n      \"  for ( i=0; i<3; i+=1)\\n\"\n      \"  {\\n\"\n      \"    noisyColor[i] = (noisyColor[i] + 1.0) / 2.0;\\n\"\n      \"    if (noisyColor[i] < lowerValue) \\n\"\n      \"    {\\n\"\n      \"      noisyColor[i] = lowerValue;\\n\"\n      \"    }\\n\"\n      \"    else\\n\"\n      \"    {\\n\"\n      \"      if (noisyColor[i] < upperValue)\\n\"\n      \"      {\\n\"\n      \"        noisyColor[i] = upperValue;\\n\"\n      \"      }\\n\"\n      \"      else\\n\"\n      \"      {\\n\"\n      \"        noisyColor[i] = 1.0;\\n\"\n      \"      }\\n\"\n      \"    }\\n\"\n      \"  }\\n\"\n      \"  fragOutput0.rgb = opacity * vec3(ambientColor + noisyColor * diffuse \"\n      \"+ specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#endif\n  vtkNew<vtkShaderCallback> myCallback;\n  myCallback->Renderer = renderer;\n  if (argc == 2 || argc == 3)\n  {\n    myCallback->k = 1;\n  }\n  else\n  {\n    myCallback->k = atof(argv[3]);\n  }\n  std::cout << \"Input: \" << (argc > 2 ? argv[2] : \"Generated Sphere\")\n            << std::endl;\n  myCallback->Print(std::cout);\n  mapper->AddObserver(vtkCommand::UpdateShaderEvent, myCallback);\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(-.3, 0, .08);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(.26, 0.0, .96);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.5);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"BozoShader\");\n  renderWindow->Render();\n  interactor->Start();\n\n  transform->GetOutput()->GetBounds(bounds);\n  std::cout << \"Range: \"\n            << \" x \" << bounds[1] - bounds[0] << \" y \" << bounds[3] - bounds[2]\n            << \" y \" << bounds[5] - bounds[4] << std::endl;\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Shaders/BozoShader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BozoShader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BozoShader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BozoShader MACOSX_BUNDLE BozoShader.cxx )\n  target_link_libraries(BozoShader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BozoShader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Shaders/BozoShader/#download-and-build-bozoshader","title":"Download and Build BozoShader","text":"

        Click here to download BozoShader and its CMakeLists.txt file. Once the tarball BozoShader.tar has been downloaded and extracted,

        cd BozoShader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BozoShader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Shaders/BozoShaderDemo/","title":"BozoShaderDemo","text":"

        vtk-examples/Cxx/Shaders/BozoShaderDemo

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Shaders/BozoShaderDemo/#code","title":"Code","text":"

        BozoShaderDemo.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShaderProgram.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkTriangleMeshPointNormals.h>\n#include <vtkVersion.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\n// -----------------------------------------------------------------------\n// Update a uniform in the shader for each render. We do this with a\n// callback for the UpdateShaderEvent\nclass vtkShaderCallback : public vtkCommand\n{\npublic:\n  static vtkShaderCallback* New()\n  {\n    return new vtkShaderCallback;\n  }\n  vtkRenderer* Renderer;\n  float k;\n  void Execute(vtkObject*, unsigned long, void* calldata) override\n  {\n    vtkShaderProgram* program = reinterpret_cast<vtkShaderProgram*>(calldata);\n    if (program)\n    {\n      program->SetUniformf(\"k\", k);\n    }\n  }\n  void Print(std::ostream& os)\n  {\n    os << \"k: \" << k << std::endl;\n  }\n\n  vtkShaderCallback()\n  {\n    this->Renderer = nullptr;\n    this->k = 5;\n  }\n};\n} // namespace\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" PerlnNoise.glsl \"\n              << \"[polydataFile] \"\n              << \"[k(5)]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(20);\n  //  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(0.3, 0.3, 0.3);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  for (int i = 2; i < argc; ++i)\n  {\n    std::cout << \"Reading file: \" << argv[i] << std::endl;\n    auto polyData = ReadPolyData(argv[i]);\n    std::ifstream shaderFile(argv[1]);\n    std::ostringstream shaderCode;\n    shaderCode << shaderFile.rdbuf();\n    shaderFile.close();\n\n    // Create a transform to rescale model\n    double center[3];\n    polyData->GetCenter(center);\n    double bounds[6];\n    polyData->GetBounds(bounds);\n    double maxBound =\n        std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n                 bounds[5] - bounds[4]);\n\n    // Create textActors\n    vtkNew<vtkTextMapper> textMapper;\n    textMapper->SetTextProperty(textProperty);\n    textMapper->SetInput(vtksys::SystemTools::GetFilenameName(argv[i]).c_str());\n\n    vtkNew<vtkActor2D> textActor;\n    textActor->SetMapper(textMapper);\n    textActor->SetPosition(20, 20);\n\n    vtkNew<vtkActor> actor;\n    vtkNew<vtkRenderer> renderer;\n    vtkNew<vtkOpenGLPolyDataMapper> mapper;\n    renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n    renderer->AddActor(actor);\n    renderer->AddActor(textActor);\n\n    // Rescale polydata to [-1,1]\n    vtkNew<vtkTransform> userTransform;\n    userTransform->Translate(-center[0], -center[1], -center[2]);\n    userTransform->Scale(1.0 / maxBound, 1.0 / maxBound, 1.0 / maxBound);\n    vtkNew<vtkTransformPolyDataFilter> transform;\n    transform->SetTransform(userTransform);\n    transform->SetInputData(polyData);\n\n    vtkNew<vtkTriangleFilter> triangles;\n    triangles->SetInputConnection(transform->GetOutputPort());\n\n    vtkNew<vtkTriangleMeshPointNormals> norms;\n    norms->SetInputConnection(triangles->GetOutputPort());\n\n    mapper->SetInputConnection(norms->GetOutputPort());\n    mapper->ScalarVisibilityOff();\n\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetAmbientColor(0.2, 0.2, 0.2);\n    actor->GetProperty()->SetDiffuseColor(1.0, 1.0, 1.0);\n    actor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n    actor->GetProperty()->SetSpecular(0.5);\n    actor->GetProperty()->SetDiffuse(0.7);\n    actor->GetProperty()->SetAmbient(0.1);\n    actor->GetProperty()->SetSpecularPower(100.0);\n    actor->GetProperty()->SetOpacity(1.0);\n\n    renderer->ResetCamera();\n    renderer->GetActiveCamera()->Zoom(1.2);\n\n    // Modify the vertex shader to pass the position of the vertex\n#if USE_SHADER_PROPERTIES\n    vtkShaderProperty* sp = actor->GetShaderProperty();\n    sp->AddVertexShaderReplacement(\n        \"//VTK::Normal::Dec\",  // replace the normal block\n        true,                  // before the standard replacements\n        \"//VTK::Normal::Dec\\n\" // we still want the default\n        \"  out vec4 myVertexMC;\\n\",\n        false // only do it once\n    );\n#else\n    mapper->AddShaderReplacement(\n        vtkShader::Vertex,\n        \"//VTK::Normal::Dec\",  // replace the normal block\n        true,                  // before the standard replacements\n        \"//VTK::Normal::Dec\\n\" // we still want the default\n        \"  out vec4 myVertexMC;\\n\",\n        false // only do it once\n    );\n#endif\n#if USE_SHADER_PROPERTIES\n    sp->AddVertexShaderReplacement(\n        \"//VTK::Normal::Impl\",  // replace the normal block\n        true,                   // before the standard replacements\n        \"//VTK::Normal::Impl\\n\" // we still want the default\n        \"  myVertexMC = vertexMC;\\n\",\n        false // only do it once\n    );\n\n#else\n    mapper->AddShaderReplacement(\n        vtkShader::Vertex,\n        \"//VTK::Normal::Impl\",  // replace the normal block\n        true,                   // before the standard replacements\n        \"//VTK::Normal::Impl\\n\" // we still want the default\n        \"  myVertexMC = vertexMC;\\n\",\n        false // only do it once\n    );\n\n#endif\n    // Add the code to generate noise\n    // These functions need to be defined outside of main. Use the System::Dec\n    // to declare and implement\n#if USE_SHADER_PROPERTIES\n    sp->AddFragmentShaderReplacement(\"//VTK::System::Dec\",\n                                     false, // before the standard replacements\n                                     shaderCode.str(),\n                                     false // only do it once\n    );\n#else\n    mapper->AddShaderReplacement(vtkShader::Fragment, \"//VTK::System::Dec\",\n                                 false, // before the standard replacements\n                                 shaderCode.str(),\n                                 false // only do it once\n    );\n#endif\n\n    // Define varying and uniforms for the fragment shader here\n#if USE_SHADER_PROPERTIES\n    sp->AddFragmentShaderReplacement(\n        \"//VTK::Normal::Dec\",  // replace the normal block\n        true,                  // before the standard replacements\n        \"//VTK::Normal::Dec\\n\" // we still want the default\n        \"  varying vec4 myVertexMC;\\n\"\n        \"  uniform float k = 1.0;\\n\",\n        false // only do it once\n    );\n#else\n    mapper->AddShaderReplacement(\n        vtkShader::Fragment,   // in the fragment shader\n        \"//VTK::Normal::Dec\",  // replace the normal block\n        true,                  // before the standard replacements\n        \"//VTK::Normal::Dec\\n\" // we still want the default\n        \"  varying vec4 myVertexMC;\\n\"\n        \"  uniform float k = 1.0;\\n\",\n        false // only do it once\n    );\n#endif\n\n#if USE_SHADER_PROPERTIES\n    sp->AddFragmentShaderReplacement(\n        \"//VTK::Light::Impl\",  // replace the light block\n        false,                 // after the standard replacements\n        \"//VTK::Light::Impl\\n\" // we still want the default calc\n        \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n        \"  vec3 noisyColor;\\n\"\n        \"  noisyColor.r = noise(k * 10.0 * myVertexMC);\\n\"\n        \"  noisyColor.g = noise(k * 11.0 * myVertexMC);\\n\"\n        \"  noisyColor.b = noise(k * 12.0 * myVertexMC);\\n\"\n        \"  /* map ranges of noise values into different colors */\\n\"\n        \"  int i;\\n\"\n        \"  float lowerValue = .3;\\n\"\n        \"  float upperValue = .6;\\n\"\n        \"  for ( i=0; i<3; i+=1)\\n\"\n        \"  {\\n\"\n        \"    noisyColor[i] = (noisyColor[i] + 1.0) / 2.0;\\n\"\n        \"    if (noisyColor[i] < lowerValue) \\n\"\n        \"    {\\n\"\n        \"      noisyColor[i] = lowerValue;\\n\"\n        \"    }\\n\"\n        \"    else\\n\"\n        \"    {\\n\"\n        \"      if (noisyColor[i] < upperValue)\\n\"\n        \"      {\\n\"\n        \"        noisyColor[i] = upperValue;\\n\"\n        \"      }\\n\"\n        \"      else\\n\"\n        \"      {\\n\"\n        \"        noisyColor[i] = 1.0;\\n\"\n        \"      }\\n\"\n        \"    }\\n\"\n        \"  }\\n\"\n        \"  fragOutput0.rgb = opacity * vec3(ambientColor + noisyColor * \"\n        \"diffuse + specular);\\n\"\n        \"  fragOutput0.a = opacity;\\n\",\n        false // only do it once\n    );\n#else\n    mapper->AddShaderReplacement(\n        vtkShader::Fragment,   // in the fragment shader\n        \"//VTK::Light::Impl\",  // replace the light block\n        false,                 // after the standard replacements\n        \"//VTK::Light::Impl\\n\" // we still want the default calc\n        \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n        \"  vec3 noisyColor;\\n\"\n        \"  noisyColor.r = noise(k * 10.0 * myVertexMC);\\n\"\n        \"  noisyColor.g = noise(k * 11.0 * myVertexMC);\\n\"\n        \"  noisyColor.b = noise(k * 12.0 * myVertexMC);\\n\"\n        \"  /* map ranges of noise values into different colors */\\n\"\n        \"  int i;\\n\"\n        \"  float lowerValue = .3;\\n\"\n        \"  float upperValue = .6;\\n\"\n        \"  for ( i=0; i<3; i+=1)\\n\"\n        \"  {\\n\"\n        \"    noisyColor[i] = (noisyColor[i] + 1.0) / 2.0;\\n\"\n        \"    if (noisyColor[i] < lowerValue) \\n\"\n        \"    {\\n\"\n        \"      noisyColor[i] = lowerValue;\\n\"\n        \"    }\\n\"\n        \"    else\\n\"\n        \"    {\\n\"\n        \"      if (noisyColor[i] < upperValue)\\n\"\n        \"      {\\n\"\n        \"        noisyColor[i] = upperValue;\\n\"\n        \"      }\\n\"\n        \"      else\\n\"\n        \"      {\\n\"\n        \"        noisyColor[i] = 1.0;\\n\"\n        \"      }\\n\"\n        \"    }\\n\"\n        \"  }\\n\"\n        \"  fragOutput0.rgb = opacity * vec3(ambientColor + noisyColor * \"\n        \"diffuse + specular);\\n\"\n        \"  fragOutput0.a = opacity;\\n\",\n        false // only do it once\n    );\n#endif\n    vtkNew<vtkShaderCallback> myCallback;\n    myCallback->Renderer = renderer;\n    myCallback->k = 1;\n    mapper->AddObserver(vtkCommand::UpdateShaderEvent, myCallback);\n  }\n\n  // Setup viewports for the renderers\n  int rendererSize = 250;\n  unsigned int xGridDimensions = 3;\n  unsigned int yGridDimensions = 3;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"BozoShaderDemo\");\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Shaders/BozoShaderDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BozoShaderDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BozoShaderDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BozoShaderDemo MACOSX_BUNDLE BozoShaderDemo.cxx )\n  target_link_libraries(BozoShaderDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BozoShaderDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Shaders/BozoShaderDemo/#download-and-build-bozoshaderdemo","title":"Download and Build BozoShaderDemo","text":"

        Click here to download BozoShaderDemo and its CMakeLists.txt file. Once the tarball BozoShaderDemo.tar has been downloaded and extracted,

        cd BozoShaderDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BozoShaderDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Shaders/ColorByNormal/","title":"ColorByNormal","text":"

        vtk-examples/Cxx/Shaders/ColorByNormal

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Shaders/ColorByNormal/#description","title":"Description","text":"

        This example modifies the shader to color based on model normal To do this we have to modify the vertex shader to pass the normal in model coordinates through to the fragment shader. By default the normal is converted to View coordinates and then passed on. We keep that, but add a varying for the original normal. Then we modify the fragment shader to set the diffuse color based on that normal.

        Cite

        This example was inspired by the test TestUserShader.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Shaders/ColorByNormal/#code","title":"Code","text":"

        ColorByNormal.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangleMeshPointNormals.h>\n#include <vtkVersion.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <sstream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkTriangleMeshPointNormals> norms;\n  norms->SetInputData(polyData);\n\n  mapper->SetInputConnection(norms->GetOutputPort());\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetAmbientColor(0.2, 0.2, 1.0);\n  actor->GetProperty()->SetDiffuseColor(1.0, 0.65, 0.7);\n  actor->GetProperty()->SetSpecularColor(1.0, 1.0, 1.0);\n  actor->GetProperty()->SetSpecular(0.5);\n  actor->GetProperty()->SetDiffuse(0.7);\n  actor->GetProperty()->SetAmbient(0.5);\n  actor->GetProperty()->SetSpecularPower(20.0);\n  actor->GetProperty()->SetOpacity(1.0);\n\n  // Modify the shader to color based on model normal\n  // To do this we have to modify the vertex shader\n  // to pass the normal in model coordinates\n  // through to the fragment shader. By default the normal\n  // is converted to View coordinates and then passed on.\n  // We keep that, but add a varying for the original normal.\n  // Then we modify the fragment shader to set the diffuse color\n  // based on that normal. First lets modify the vertex\n  // shader\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec3 myNormalMCVSOutput;\\n\", // but we add this\n      false                                   // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec3 myNormalMCVSOutput;\\n\", // but we add this\n      false                                   // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Impl\",                // replace the normal block\n      true,                                 // before the standard replacements\n      \"//VTK::Normal::Impl\\n\"               // we still want the default\n      \"  myNormalMCVSOutput = normalMC;\\n\", // but we add this\n      false                                 // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Impl\",                // replace the normal block\n      true,                                 // before the standard replacements\n      \"//VTK::Normal::Impl\\n\"               // we still want the default\n      \"  myNormalMCVSOutput = normalMC;\\n\", // but we add this\n      false                                 // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Color::Impl\", // dummy replacement for testing clear method\n      true, \"VTK::Color::Impl\\n\", false);\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Color::Impl\", // dummy replacement for testing clear method\n      true, \"VTK::Color::Impl\\n\", false);\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->ClearVertexShaderReplacement(\"//VTK::Color::Impl\", true);\n#else\n  mapper->ClearShaderReplacement(\n      vtkShader::Vertex, // clear our dummy replacement\n      \"//VTK::Color::Impl\", true);\n#endif\n\n  // now modify the fragment shader\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec3 myNormalMCVSOutput;\\n\", // but we add this\n      false                                   // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec3 myNormalMCVSOutput;\\n\", // but we add this\n      false                                   // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default calc\n      \"  diffuseColor = abs(myNormalMCVSOutput);\\n\", // but we add this\n      false                                          // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,    // in the fragment shader\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default calc\n      \"  diffuseColor = abs(myNormalMCVSOutput);\\n\", // but we add this\n      false                                          // only do it once\n  );\n#endif\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(1.0, 1.0, -1.0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->GetActiveCamera()->Elevation(30.0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.3);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ColorByNormal\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Shaders/ColorByNormal/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorByNormal)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorByNormal: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorByNormal MACOSX_BUNDLE ColorByNormal.cxx )\n  target_link_libraries(ColorByNormal PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorByNormal\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Shaders/ColorByNormal/#download-and-build-colorbynormal","title":"Download and Build ColorByNormal","text":"

        Click here to download ColorByNormal and its CMakeLists.txt file. Once the tarball ColorByNormal.tar has been downloaded and extracted,

        cd ColorByNormal/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorByNormal\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Shaders/CubeMap/","title":"CubeMap","text":"

        vtk-examples/Cxx/Shaders/CubeMap

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Shaders/CubeMap/#code","title":"Code","text":"

        CubeMap.cxx

        // Inspired by the VTK test Rendering/OpenGL2/Testing/Cxx/TesCubeMap.cxx\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageFlip.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTexture.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <iostream>\n#include <string>\n\nnamespace {\n/**\n * Read the cube map.\n *\n * @param folderPath: The folder where the cube maps are stored.\n * @param fileRoot: The root of the individual cube map file names.\n * @param ext: The extension of the cube map files.\n * @param key: The key to data used to build the full file name.\n *\n * @return The cubemap texture.\n */\nvtkSmartPointer<vtkTexture> ReadCubeMap(std::string const& folderPath,\n                                        std::string const& fileRoot,\n                                        std::string const& ext, int const& key);\n\n} // namespace\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" horse.ply path_to_cubemap_files\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  vtkNew<vtkPLYReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataNormals> norms;\n  norms->SetInputConnection(reader->GetOutputPort());\n\n  auto texture = ReadCubeMap(argv[2], \"/skybox\", \".jpg\", 2);\n\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  mapper->SetInputConnection(norms->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  renderer->AddActor(actor);\n  actor->SetTexture(texture);\n  actor->SetMapper(mapper);\n\n  // Add new code in default VTK vertex shader\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n#endif\n      \"//VTK::PositionVC::Dec\",  // replace the normal block\n      true,                      // before the standard replacements\n      \"//VTK::PositionVC::Dec\\n\" // we still want the default\n      \"out vec3 TexCoords;\\n\",\n      false // only do it once\n  );\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n#endif\n      \"//VTK::PositionVC::Impl\",  // replace the normal block\n      true,                       // before the standard replacements\n      \"//VTK::PositionVC::Impl\\n\" // we still want the default\n      \"vec3 camPos = -MCVCMatrix[3].xyz * mat3(MCVCMatrix);\\n\"\n      \"TexCoords.xyz = reflect(vertexMC.xyz - camPos, normalize(normalMC));\\n\",\n      false // only do it once\n  );\n\n  // Replace VTK fragment shader\n#if USE_SHADER_PROPERTIES\n  sp->SetFragmentShaderCode(\n#else\n  mapper->SetFragmentShaderCode(\n#endif\n      \"//VTK::System::Dec\\n\" // always start with this line\n      \"//VTK::Output::Dec\\n\" // always have this line in your FS\n      \"in vec3 TexCoords;\\n\"\n      \"uniform samplerCube texture_0;\\n\"\n      \"void main () {\\n\"\n      \"  gl_FragData[0] = texture(texture_0, TexCoords);\\n\"\n      \"}\\n\");\n\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetPosition(-.4, .2, .15);\n  renderer->GetActiveCamera()->SetViewUp(.3, -.1, .9);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.4);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"CubeMap\");\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindow->GetInteractor()->SetInteractorStyle(style);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkTexture> ReadCubeMap(std::string const& folderPath,\n                                        std::string const& fileRoot,\n                                        std::string const& ext, int const& key)\n{\n  // A map of cube map naming conventions and the corresponding file name\n  // components.\n  std::map<int, std::vector<std::string>> fileNames{\n      {0, {\"right\", \"left\", \"top\", \"bottom\", \"front\", \"back\"}},\n      {1, {\"posx\", \"negx\", \"posy\", \"negy\", \"posz\", \"negz\"}},\n      {2, {\"-px\", \"-nx\", \"-py\", \"-ny\", \"-pz\", \"-nz\"}},\n      {3, {\"0\", \"1\", \"2\", \"3\", \"4\", \"5\"}}};\n  std::vector<std::string> fns;\n  if (fileNames.count(key))\n  {\n    fns = fileNames.at(key);\n  }\n  else\n  {\n    std::cerr << \"ReadCubeMap(): invalid key, unable to continue.\" << std::endl;\n    std::exit(EXIT_FAILURE);\n  }\n  vtkNew<vtkTexture> texture;\n  texture->CubeMapOn();\n  // Build the file names.\n  std::for_each(fns.begin(), fns.end(),\n                [&folderPath, &fileRoot, &ext](std::string& f) {\n                  f = folderPath + fileRoot + f + ext;\n                });\n  auto i = 0;\n  for (auto const& fn : fns)\n  {\n    vtkNew<vtkJPEGReader> imgReader;\n    imgReader->SetFileName(fn.c_str());\n\n    vtkNew<vtkImageFlip> flip;\n    flip->SetInputConnection(imgReader->GetOutputPort());\n    flip->SetFilteredAxis(1); // flip y axis\n    texture->SetInputConnection(i, flip->GetOutputPort(0));\n    ++i;\n  }\n  return texture;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Shaders/CubeMap/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CubeMap)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOImage\n  IOPLY\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CubeMap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CubeMap MACOSX_BUNDLE CubeMap.cxx )\n  target_link_libraries(CubeMap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CubeMap\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Shaders/CubeMap/#download-and-build-cubemap","title":"Download and Build CubeMap","text":"

        Click here to download CubeMap and its CMakeLists.txt file. Once the tarball CubeMap.tar has been downloaded and extracted,

        cd CubeMap/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CubeMap\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Shaders/MarbleShader/","title":"MarbleShader","text":"

        vtk-examples/Cxx/Shaders/MarbleShader

        "},{"location":"Cxx/Shaders/MarbleShader/#description","title":"Description","text":"

        This example shows how to add user functions to a VTK shader. The example's fragment shader uses an implementation of Ken Perlin's noise function. Perlin received a Technical Achievement Academy Award for his work procedural texture.

        The file for the shader code is src/Testing/Data/Shaders/PerlinNoise.glsl.

        "},{"location":"Cxx/Shaders/MarbleShader/#parameters","title":"Parameters","text":"
        • veinfreq - controls the lowest frequency of the color veins e.g. 10
        • veinlevels - how many \"levels\" of vein tendrils it has e.g. 2
        • warpfreq - lowest frequency of the turbulent warping in the marble e.g. 10
        • _ warping_ - controls how much turbulent warping there will be e.g. 0.5
        • veincolor - the color of the veins e.g. white: 1 1 1
        • sharpness - controls how sharp or fuzzy the veins are (higher = sharper) e.g. 8

        Cite

        Perlin's original Siggraph Paper: Perlin, K. 1985. \"An Image Synthesizer.\" Computer Graphics 19(3).

        Cite

        This shader is inspired by Larry Gritz's veined marble shader.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Shaders/MarbleShader/#code","title":"Code","text":"

        MarbleShader.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShaderProgram.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkTriangleMeshPointNormals.h>\n#include <vtkVersion.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\n// -----------------------------------------------------------------------\n// Update uniform variables in the shader for each render. We do this with a\n// callback for the UpdateShaderEvent\nclass ShaderCallback : public vtkCommand\n{\npublic:\n  static ShaderCallback* New()\n  {\n    return new ShaderCallback;\n  }\n  vtkRenderer* Renderer;\n  float veincolor[3];\n  float veinfreq;\n  int veinlevels;\n  float warpfreq;\n  float warping;\n  float sharpness;\n\n  void Execute(vtkObject*, unsigned long, void* calldata) override\n  {\n    vtkShaderProgram* program = reinterpret_cast<vtkShaderProgram*>(calldata);\n    if (program)\n    {\n      program->SetUniform3f(\"veincolor\", veincolor);\n      program->SetUniformf(\"veinfreq\", veinfreq);\n      program->SetUniformi(\"veinlevels\", veinlevels);\n      program->SetUniformf(\"warpfreq\", warpfreq);\n      program->SetUniformf(\"warping\", warping);\n      program->SetUniformf(\"sharpness\", sharpness);\n    }\n  }\n  void Print(std::ostream& os)\n  {\n    os << \"veincolor: \" << veincolor[0] << \", \" << veincolor[1] << \", \"\n       << veincolor[2] << std::endl;\n    os << \"veinfreq: \" << veinfreq << std::endl;\n    os << \"veinlevels: \" << veinlevels << std::endl;\n    os << \"warpfreq: \" << warpfreq << std::endl;\n    os << \"warping: \" << warping << std::endl;\n    os << \"sharpness: \" << sharpness << std::endl;\n  }\n\n  ShaderCallback()\n  {\n    this->Renderer = nullptr;\n    this->veincolor[0] = this->veincolor[1] = this->veincolor[2] = 1.0;\n    this->veinfreq = 10.0;\n    this->veinlevels = 2;\n    this->warpfreq = 1.0;\n    this->warping = .5;\n    this->sharpness = 8.0;\n  }\n};\n} // namespace\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" PerlnNoise.glsl \"\n              << \"[polydataFile] \"\n              << \"[veincolor(1,1,1)] \"\n              << \"[veinfreq(10)] \"\n              << \"[veinlevels(2)] \"\n              << \"[warpfreq(1)] \"\n              << \"[warping(.5)] \"\n              << \"[sharpness(8)]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto polyData = ReadPolyData(2 ? argv[2] : \"\");\n\n  std::ifstream shaderFile(argv[1]);\n  std::ostringstream shaderCode;\n  shaderCode << shaderFile.rdbuf();\n\n  // Create a transform to rescale model\n  double center[3];\n  polyData->GetCenter(center);\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double maxBound =\n      std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n               bounds[5] - bounds[4]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Rescale polydata to [-1,1]\n  vtkNew<vtkTransform> userTransform;\n  userTransform->Translate(-center[0], -center[1], -center[2]);\n  userTransform->Scale(1.0 / maxBound, 1.0 / maxBound, 1.0 / maxBound);\n  vtkNew<vtkTransformPolyDataFilter> transform;\n  transform->SetTransform(userTransform);\n  transform->SetInputData(polyData);\n\n  vtkNew<vtkTriangleFilter> triangles;\n  triangles->SetInputConnection(transform->GetOutputPort());\n\n  vtkNew<vtkTriangleMeshPointNormals> norms;\n  norms->SetInputConnection(triangles->GetOutputPort());\n\n  mapper->SetInputConnection(norms->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuse(1.0);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"ivoryblack\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(5);\n\n  // Modify the vertex shader to pass the position of the vertex\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n\n#endif\n\n  // Add the code to generate noise\n  // These functions need to be defined outside of main. Use the System::Dec\n  // to declare and implement\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\"//VTK::System::Dec\",\n                                   false, // before the standard replacements\n                                   shaderCode.str(),\n                                   false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(vtkShader::Fragment, \"//VTK::System::Dec\",\n                               false, // before the standard replacements\n                               shaderCode.str(),\n                               false // only do it once\n  );\n#endif\n// Define varying and uniforms for the fragment shader here\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform vec3 veincolor = vec3(1.0, 1.0, 1.0);\\n\"\n      \"  uniform float veinfreq = 10.0;\\n\"\n      \"  uniform int veinlevels = 2;\\n\"\n      \"  uniform float warpfreq = 1;\\n\"\n      \"  uniform float warping = .5;\\n\"\n      \"  uniform float sharpness = 8.0;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform vec3 veincolor = vec3(1.0, 1.0, 1.0);\\n\"\n      \"  uniform float veinfreq = 10.0;\\n\"\n      \"  uniform int veinlevels = 2;\\n\"\n      \"  uniform float warpfreq = 1;\\n\"\n      \"  uniform float warping = .5;\\n\"\n      \"  uniform float sharpness = 8.0;\\n\",\n      false // only do it once\n  );\n#endif\n\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"\\n\"\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"#define snoise(x) (2.0 * pnoise(x) - 1.0)\\n\"\n      \"  vec3 Ct;\\n\"\n      \"  int i;\\n\"\n      \"  float turb, freq;\\n\"\n      \"  float turbsum;\\n\"\n      \"  /* perturb the lookup */\\n\"\n      \"  freq = 1.0;\\n\"\n      \"  vec4 offset = vec4(0.0,0.0,0.0,0.0);\\n\"\n      \"  vec4 noisyPoint;\\n\"\n      \"  vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"\\n\"\n      \"    for (i = 0;  i < 6;  i += 1) {\\n\"\n      \"      noisyPoint[0] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[1] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[2] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[3] = 1.0;\\n\"\n      \"      offset += 2.0 * warping * (noisyPoint - 0.5)  / freq;\\n\"\n      \"      freq *= 2.0;\\n\"\n      \"    }\\n\"\n      \"    myLocalVertexMC.x += offset.x;\\n\"\n      \"    myLocalVertexMC.y += offset.y;\\n\"\n      \"    myLocalVertexMC.z += offset.z;\\n\"\n      \"\\n\"\n      \"    /* Now calculate the veining function for the lookup area */\\n\"\n      \"    turbsum = 0.0;  freq = 1.0;\\n\"\n      \"    myLocalVertexMC *= veinfreq;\\n\"\n      \"    for (i = 0;  i < veinlevels;  i += 1) {\\n\"\n      \"      turb = abs (snoise (myLocalVertexMC));\\n\"\n      \"      turb = pow (smoothstep (0.8, 1.0, 1.0 - turb), sharpness) / \"\n      \"freq;\\n\"\n      \"      turbsum += (1.0-turbsum) * turb;\\n\"\n      \"      freq *= 1.5;\\n\"\n      \"      myLocalVertexMC *= 1.5;\\n\"\n      \"    }\\n\"\n      \"\\n\"\n      \"    Ct = mix (diffuseColor, veincolor, turbsum);\\n\"\n      \"\\n\"\n      \"  fragOutput0.rgb = opacity * (ambientColor + Ct + specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"\\n\"\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"#define snoise(x) (2.0 * pnoise(x) - 1.0)\\n\"\n      \"  vec3 Ct;\\n\"\n      \"  int i;\\n\"\n      \"  float turb, freq;\\n\"\n      \"  float turbsum;\\n\"\n      \"  /* perturb the lookup */\\n\"\n      \"  freq = 1.0;\\n\"\n      \"  vec4 offset = vec4(0.0,0.0,0.0,0.0);\\n\"\n      \"  vec4 noisyPoint;\\n\"\n      \"  vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"\\n\"\n      \"    for (i = 0;  i < 6;  i += 1) {\\n\"\n      \"      noisyPoint[0] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[1] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[2] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[3] = 1.0;\\n\"\n      \"      offset += 2.0 * warping * (noisyPoint - 0.5)  / freq;\\n\"\n      \"      freq *= 2.0;\\n\"\n      \"    }\\n\"\n      \"    myLocalVertexMC.x += offset.x;\\n\"\n      \"    myLocalVertexMC.y += offset.y;\\n\"\n      \"    myLocalVertexMC.z += offset.z;\\n\"\n      \"\\n\"\n      \"    /* Now calculate the veining function for the lookup area */\\n\"\n      \"    turbsum = 0.0;  freq = 1.0;\\n\"\n      \"    myLocalVertexMC *= veinfreq;\\n\"\n      \"    for (i = 0;  i < veinlevels;  i += 1) {\\n\"\n      \"      turb = abs (snoise (myLocalVertexMC));\\n\"\n      \"      turb = pow (smoothstep (0.8, 1.0, 1.0 - turb), sharpness) / \"\n      \"freq;\\n\"\n      \"      turbsum += (1.0-turbsum) * turb;\\n\"\n      \"      freq *= 1.5;\\n\"\n      \"      myLocalVertexMC *= 1.5;\\n\"\n      \"    }\\n\"\n      \"\\n\"\n      \"    Ct = mix (diffuseColor, veincolor, turbsum);\\n\"\n      \"\\n\"\n      \"  fragOutput0.rgb = opacity * (ambientColor + Ct + specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#endif\n\n  vtkNew<ShaderCallback> myCallback;\n  myCallback->Renderer = renderer;\n  if (argc == 6)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n  }\n  if (argc == 7)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n    myCallback->veinfreq = atof(argv[6]);\n  }\n  if (argc == 8)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n    myCallback->veinfreq = atof(argv[6]);\n    myCallback->veinlevels = atoi(argv[7]);\n  }\n  if (argc == 9)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n    myCallback->veinfreq = atof(argv[6]);\n    myCallback->veinlevels = atoi(argv[7]);\n    myCallback->warpfreq = atof(argv[8]);\n  }\n  if (argc == 10)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n    myCallback->veinfreq = atof(argv[6]);\n    myCallback->veinlevels = atoi(argv[7]);\n    myCallback->warpfreq = atof(argv[8]);\n    myCallback->warping = atof(argv[9]);\n  }\n  if (argc == 11)\n  {\n    myCallback->veincolor[0] = atof(argv[3]);\n    myCallback->veincolor[1] = atof(argv[4]);\n    myCallback->veincolor[2] = atof(argv[5]);\n    myCallback->veinfreq = atof(argv[6]);\n    myCallback->veinlevels = atoi(argv[7]);\n    myCallback->warpfreq = atof(argv[8]);\n    myCallback->warping = atof(argv[9]);\n    myCallback->sharpness = atof(argv[10]);\n  }\n  std::cout << \"Input: \" << (argc > 2 ? argv[2] : \"Generated Sphere\")\n            << std::endl;\n  myCallback->Print(std::cout);\n  mapper->AddObserver(vtkCommand::UpdateShaderEvent, myCallback);\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(-.3, 0, .08);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(.26, 0.0, .96);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.5);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"MarbleShader\");\n  renderWindow->Render();\n  interactor->Start();\n\n  transform->GetOutput()->GetBounds(bounds);\n  std::cout << \"Range: \"\n            << \" x \" << bounds[1] - bounds[0] << \" y \" << bounds[3] - bounds[2]\n            << \" y \" << bounds[5] - bounds[4] << std::endl;\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Shaders/MarbleShader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarbleShader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarbleShader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarbleShader MACOSX_BUNDLE MarbleShader.cxx )\n  target_link_libraries(MarbleShader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarbleShader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Shaders/MarbleShader/#download-and-build-marbleshader","title":"Download and Build MarbleShader","text":"

        Click here to download MarbleShader and its CMakeLists.txt file. Once the tarball MarbleShader.tar has been downloaded and extracted,

        cd MarbleShader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MarbleShader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Shaders/MarbleShaderDemo/","title":"MarbleShaderDemo","text":"

        vtk-examples/Cxx/Shaders/MarbleShaderDemo

        "},{"location":"Cxx/Shaders/MarbleShaderDemo/#description","title":"Description","text":"

        Makes solid marble texture with strong veins. The \"veincolor\" parameter controls the color of the veins. The background color is given by the surface's DiffuseColor.

        Explore the parameter space with the vtkSliderWidget.

        "},{"location":"Cxx/Shaders/MarbleShaderDemo/#parameters","title":"Parameters","text":"
        • veinfreq - controls the lowest frequency of the color veins e.g. 10
        • veinlevels - how many \"levels\" of vein tendrils it has e.g. 2
        • warpfreq - lowest frequency of the turbulent warping in the marble e.g. 10
        • _ warping_ - controls how much turbulent warping there will be e.g. 0.5
        • veincolor - the color of the veins e.g. white: 1 1 1
        • sharpness - controls how sharp or fuzzy the veins are (higher = sharper) e.g. 8

        Cite

        This shader is inspired by Larry Gritz's veined marble shader.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Shaders/MarbleShaderDemo/#code","title":"Code","text":"

        MarbleShaderDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkShaderProgram.h>\n#include <vtkSmartPointer.h>\n#include <vtkVersion.h>\n\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkTriangleMeshPointNormals.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <chrono>\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <thread>\n\n#define DELAY 200\nnamespace {\n// -----------------------------------------------------------------------\n// Update uniform variables in the shader for each render. We do this with a\n// callback for the UpdateShaderEvent\nclass ShaderCallback : public vtkCommand\n{\npublic:\n  static ShaderCallback* New()\n  {\n    return new ShaderCallback;\n  }\n  vtkRenderer* Renderer;\n  float veincolor[3];\n  float veinfreq;\n  float veinlevels;\n  float warpfreq;\n  float warping;\n  float sharpness;\n\n  void Execute(vtkObject*, unsigned long, void* calldata) override\n  {\n    vtkShaderProgram* program = reinterpret_cast<vtkShaderProgram*>(calldata);\n    if (program)\n    {\n      program->SetUniform3f(\"veincolor\", veincolor);\n      program->SetUniformf(\"veinfreq\", veinfreq);\n      program->SetUniformi(\"veinlevels\", veinlevels);\n      program->SetUniformf(\"warpfreq\", warpfreq);\n      program->SetUniformf(\"warping\", warping);\n      program->SetUniformf(\"sharpness\", sharpness);\n      std::cout << \"------------\" << std::endl;\n      Print(std::cout);\n    }\n  }\n  void Print(std::ostream& os)\n  {\n    os << \"veincolor: \" << veincolor[0] << \", \" << veincolor[1] << \", \"\n       << veincolor[2] << std::endl;\n    os << \"veinfreq: \" << veinfreq << std::endl;\n    os << \"veinlevels: \" << veinlevels << std::endl;\n    os << \"warpfreq: \" << warpfreq << std::endl;\n    os << \"warping: \" << warping << std::endl;\n    os << \"sharpness: \" << sharpness << std::endl;\n  }\n\n  ShaderCallback()\n  {\n    this->Renderer = nullptr;\n    this->veincolor[0] = this->veincolor[1] = this->veincolor[2] = 1.0;\n    this->veinfreq = 10.0;\n    this->veinlevels = 2;\n    this->warpfreq = 1.0;\n    this->warping = .5;\n    this->sharpness = 8.0;\n  }\n};\n\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackVeinFreq : public vtkCommand\n{\npublic:\n  static SliderCallbackVeinFreq* New()\n  {\n    return new SliderCallbackVeinFreq;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n\n    float value = static_cast<vtkSliderRepresentation2D*>(\n                      sliderWidget->GetRepresentation())\n                      ->GetValue();\n    this->Shader->veinfreq = value;\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackVeinFreq() : Shader(0)\n  {\n  }\n  ShaderCallback* Shader;\n};\n\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackVeinLevels : public vtkCommand\n{\npublic:\n  static SliderCallbackVeinLevels* New()\n  {\n    return new SliderCallbackVeinLevels;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n\n    int value = static_cast<vtkSliderRepresentation2D*>(\n                    sliderWidget->GetRepresentation())\n                    ->GetValue();\n    static_cast<vtkSliderRepresentation2D*>(sliderWidget->GetRepresentation())\n        ->SetValue(value);\n    this->Shader->veinlevels = value;\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackVeinLevels() : Shader(0)\n  {\n  }\n  ShaderCallback* Shader;\n};\n\nclass SliderCallbackWarpFreq : public vtkCommand\n{\npublic:\n  static SliderCallbackWarpFreq* New()\n  {\n    return new SliderCallbackWarpFreq;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n\n    float value = static_cast<vtkSliderRepresentation2D*>(\n                      sliderWidget->GetRepresentation())\n                      ->GetValue();\n    this->Shader->warpfreq = value;\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackWarpFreq() : Shader(0)\n  {\n  }\n  ShaderCallback* Shader;\n};\n\nclass SliderCallbackWarping : public vtkCommand\n{\npublic:\n  static SliderCallbackWarping* New()\n  {\n    return new SliderCallbackWarping;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n\n    float value = static_cast<vtkSliderRepresentation2D*>(\n                      sliderWidget->GetRepresentation())\n                      ->GetValue();\n    this->Shader->warping = value;\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackWarping() : Shader(0)\n  {\n  }\n  ShaderCallback* Shader;\n};\n\n} // namespace\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" PerlnNoise.glsl \"\n              << \"[polydataFile] \"\n              << \"[veincolor(1,1,1)] \"\n              << \"[veinfreq(10)] \"\n              << \"[veinlevels(2)] \"\n              << \"[warpfreq(1)] \"\n              << \"[warping(.5)] \"\n              << \"[sharpness(8)]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto polyData = ReadPolyData(argc > 2 ? argv[2] : \"\");\n\n  std::ifstream shaderFile(argv[1]);\n  std::ostringstream shaderCode;\n  shaderCode << shaderFile.rdbuf();\n\n  // Create a transform to rescale model\n  double center[3];\n  polyData->GetCenter(center);\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double maxBound =\n      std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n               bounds[5] - bounds[4]);\n\n  auto colors = vtkSmartPointer<vtkNamedColors>::New();\n\n  auto actor = vtkSmartPointer<vtkActor>::New();\n\n  auto renderer = vtkSmartPointer<vtkRenderer>::New();\n  auto mapper = vtkSmartPointer<vtkOpenGLPolyDataMapper>::New();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  auto style = vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();\n\n  auto interactor = vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  interactor->SetRenderWindow(renderWindow);\n  interactor->SetInteractorStyle(style);\n\n  // Rescale polydata to [-1,1]\n  auto userTransform = vtkSmartPointer<vtkTransform>::New();\n  userTransform->Translate(-center[0], -center[1], -center[2]);\n  userTransform->Scale(1.0 / maxBound, 1.0 / maxBound, 1.0 / maxBound);\n  auto transform = vtkSmartPointer<vtkTransformPolyDataFilter>::New();\n  transform->SetTransform(userTransform);\n  transform->SetInputData(polyData);\n\n  auto triangles = vtkSmartPointer<vtkTriangleFilter>::New();\n  triangles->SetInputConnection(transform->GetOutputPort());\n\n  auto norms = vtkSmartPointer<vtkTriangleMeshPointNormals>::New();\n  norms->SetInputConnection(triangles->GetOutputPort());\n\n  mapper->SetInputConnection(norms->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuse(1.0);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"wheat\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(50);\n\n  // Modify the vertex shader to pass the position of the vertex\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n\n  // Add the code to generate noise\n  // These functions need to be defined outside of main. Use the System::Dec\n  // to declare and implement\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\"//VTK::System::Dec\",\n                                   false, // before the standard replacements\n                                   shaderCode.str(),\n                                   false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(vtkShader::Fragment, // in the fragment shader\n                               \"//VTK::System::Dec\",\n                               false, // before the standard replacements\n                               shaderCode.str(),\n                               false // only do it once\n  );\n#endif\n// Define varying and uniforms for the fragment shader here\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform vec3 veincolor = vec3(1.0, 1.0, 1.0);\\n\"\n      \"  uniform float veinfreq = 10.0;\\n\"\n      \"  uniform int veinlevels = 2;\\n\"\n      \"  uniform float warpfreq = 1;\\n\"\n      \"  uniform float warping = .5;\\n\"\n      \"  uniform float sharpness = 8.0;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"  uniform vec3 veincolor = vec3(1.0, 1.0, 1.0);\\n\"\n      \"  uniform float veinfreq = 10.0;\\n\"\n      \"  uniform int veinlevels = 2;\\n\"\n      \"  uniform float warpfreq = 1;\\n\"\n      \"  uniform float warping = .5;\\n\"\n      \"  uniform float sharpness = 8.0;\\n\",\n      false // only do it once\n  );\n\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"\\n\"\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"#define snoise(x) (2.0 * pnoise(x) - 1.0)\\n\"\n      \"  vec3 Ct;\\n\"\n      \"  int i;\\n\"\n      \"  float turb, freq;\\n\"\n      \"  float turbsum;\\n\"\n      \"  /* perturb the lookup */\\n\"\n      \"  freq = 1.0;\\n\"\n      \"  vec4 offset = vec4(0.0,0.0,0.0,0.0);\\n\"\n      \"  vec4 noisyPoint;\\n\"\n      \"  vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"\\n\"\n      \"    for (i = 0;  i < 6;  i += 1) {\\n\"\n      \"      noisyPoint[0] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[1] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[2] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[3] = 1.0;\\n\"\n      \"      offset += 2.0 * warping * (noisyPoint - 0.5)  / freq;\\n\"\n      \"      freq *= 2.0;\\n\"\n      \"    }\\n\"\n      \"    myLocalVertexMC.x += offset.x;\\n\"\n      \"    myLocalVertexMC.y += offset.y;\\n\"\n      \"    myLocalVertexMC.z += offset.z;\\n\"\n      \"\\n\"\n      \"    /* Now calculate the veining function for the lookup area */\\n\"\n      \"    turbsum = 0.0;  freq = 1.0;\\n\"\n      \"    myLocalVertexMC *= veinfreq;\\n\"\n      \"    for (i = 0;  i < veinlevels;  i += 1) {\\n\"\n      \"      turb = abs (snoise (myLocalVertexMC));\\n\"\n      \"      turb = pow (smoothstep (0.8, 1.0, 1.0 - turb), sharpness) / \"\n      \"freq;\\n\"\n      \"      turbsum += (1.0-turbsum) * turb;\\n\"\n      \"      freq *= 1.5;\\n\"\n      \"      myLocalVertexMC *= 1.5;\\n\"\n      \"    }\\n\"\n      \"\\n\"\n      \"    Ct = mix (diffuseColor, veincolor, turbsum);\\n\"\n      \"\\n\"\n      \"  fragOutput0.rgb = opacity * (ambientColor + Ct + specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"\\n\"\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"#define snoise(x) (2.0 * pnoise(x) - 1.0)\\n\"\n      \"  vec3 Ct;\\n\"\n      \"  int i;\\n\"\n      \"  float turb, freq;\\n\"\n      \"  float turbsum;\\n\"\n      \"  /* perturb the lookup */\\n\"\n      \"  freq = 1.0;\\n\"\n      \"  vec4 offset = vec4(0.0,0.0,0.0,0.0);\\n\"\n      \"  vec4 noisyPoint;\\n\"\n      \"  vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"\\n\"\n      \"    for (i = 0;  i < 6;  i += 1) {\\n\"\n      \"      noisyPoint[0] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[1] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[2] = snoise(warpfreq * freq * myLocalVertexMC);\\n\"\n      \"      noisyPoint[3] = 1.0;\\n\"\n      \"      offset += 2.0 * warping * (noisyPoint - 0.5)  / freq;\\n\"\n      \"      freq *= 2.0;\\n\"\n      \"    }\\n\"\n      \"    myLocalVertexMC.x += offset.x;\\n\"\n      \"    myLocalVertexMC.y += offset.y;\\n\"\n      \"    myLocalVertexMC.z += offset.z;\\n\"\n      \"\\n\"\n      \"    /* Now calculate the veining function for the lookup area */\\n\"\n      \"    turbsum = 0.0;  freq = 1.0;\\n\"\n      \"    myLocalVertexMC *= veinfreq;\\n\"\n      \"    for (i = 0;  i < veinlevels;  i += 1) {\\n\"\n      \"      turb = abs (snoise (myLocalVertexMC));\\n\"\n      \"      turb = pow (smoothstep (0.8, 1.0, 1.0 - turb), sharpness) / \"\n      \"freq;\\n\"\n      \"      turbsum += (1.0-turbsum) * turb;\\n\"\n      \"      freq *= 1.5;\\n\"\n      \"      myLocalVertexMC *= 1.5;\\n\"\n      \"    }\\n\"\n      \"\\n\"\n      \"    Ct = mix (diffuseColor, veincolor, turbsum);\\n\"\n      \"\\n\"\n      \"  fragOutput0.rgb = opacity * (ambientColor + Ct + specular);\\n\"\n      \"  fragOutput0.a = opacity;\\n\",\n      false // only do it once\n  );\n#endif\n\n  auto myCallback = vtkSmartPointer<ShaderCallback>::New();\n  myCallback->Renderer = renderer;\n\n  std::cout << \"Input: \" << (argc > 2 ? argv[2] : \"Generated Sphere\")\n            << std::endl;\n  myCallback->Print(std::cout);\n  mapper->AddObserver(vtkCommand::UpdateShaderEvent, myCallback);\n\n  // Setup a slider widget for each varying parameter\n  double tubeWidth(.015);\n  double sliderLength(.008);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  auto sliderRepVeinFreq = vtkSmartPointer<vtkSliderRepresentation2D>::New();\n\n  sliderRepVeinFreq->SetMinimumValue(1.0);\n  sliderRepVeinFreq->SetMaximumValue(15.0);\n  sliderRepVeinFreq->SetValue(7.5);\n  sliderRepVeinFreq->SetTitleText(\"Vein Frequency\");\n\n  sliderRepVeinFreq->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepVeinFreq->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepVeinFreq->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepVeinFreq->GetPoint2Coordinate()->SetValue(.9, .1);\n\n  sliderRepVeinFreq->SetTubeWidth(tubeWidth);\n  sliderRepVeinFreq->SetSliderLength(sliderLength);\n  sliderRepVeinFreq->SetTitleHeight(titleHeight);\n  sliderRepVeinFreq->SetLabelHeight(labelHeight);\n\n  auto sliderWidgetVeinFreq = vtkSmartPointer<vtkSliderWidget>::New();\n  sliderWidgetVeinFreq->SetInteractor(interactor);\n  sliderWidgetVeinFreq->SetRepresentation(sliderRepVeinFreq);\n  sliderWidgetVeinFreq->SetAnimationModeToAnimate();\n  sliderWidgetVeinFreq->SetNumberOfAnimationSteps(10);\n  sliderWidgetVeinFreq->EnabledOn();\n\n  auto callbackVeinFreq = vtkSmartPointer<SliderCallbackVeinFreq>::New();\n  callbackVeinFreq->Shader = myCallback;\n\n  sliderWidgetVeinFreq->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackVeinFreq);\n\n  auto sliderRepVeinLevels = vtkSmartPointer<vtkSliderRepresentation2D>::New();\n\n  sliderRepVeinLevels->SetMinimumValue(1);\n  sliderRepVeinLevels->SetMaximumValue(5);\n  sliderRepVeinLevels->SetValue(3);\n  sliderRepVeinLevels->SetTitleText(\"Vein Levels\");\n\n  sliderRepVeinLevels->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepVeinLevels->GetPoint1Coordinate()->SetValue(.1, .9);\n  sliderRepVeinLevels->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepVeinLevels->GetPoint2Coordinate()->SetValue(.9, .9);\n\n  sliderRepVeinLevels->SetTubeWidth(tubeWidth);\n  sliderRepVeinLevels->SetSliderLength(sliderLength);\n  sliderRepVeinLevels->SetTitleHeight(titleHeight);\n  sliderRepVeinLevels->SetLabelHeight(labelHeight);\n\n  auto sliderWidgetVeinLevels = vtkSmartPointer<vtkSliderWidget>::New();\n  sliderWidgetVeinLevels->SetInteractor(interactor);\n  sliderWidgetVeinLevels->SetRepresentation(sliderRepVeinLevels);\n  sliderWidgetVeinLevels->SetAnimationModeToAnimate();\n  sliderWidgetVeinLevels->SetNumberOfAnimationSteps(10);\n  sliderWidgetVeinLevels->EnabledOn();\n\n  auto callbackVeinLevels = vtkSmartPointer<SliderCallbackVeinLevels>::New();\n  callbackVeinLevels->Shader = myCallback;\n  myCallback->veincolor[0] = colors->GetColor3d(\"Green\").GetData()[0];\n  myCallback->veincolor[1] = colors->GetColor3d(\"Green\").GetData()[1];\n  myCallback->veincolor[2] = colors->GetColor3d(\"Green\").GetData()[2];\n  sliderWidgetVeinLevels->AddObserver(vtkCommand::InteractionEvent,\n                                      callbackVeinLevels);\n\n  auto sliderRepWarpFreq = vtkSmartPointer<vtkSliderRepresentation2D>::New();\n\n  sliderRepWarpFreq->SetMinimumValue(1.0);\n  sliderRepWarpFreq->SetMaximumValue(2.0);\n  sliderRepWarpFreq->SetValue(1.5);\n  sliderRepWarpFreq->SetTitleText(\"Warp Frequency\");\n\n  sliderRepWarpFreq->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepWarpFreq->GetPoint1Coordinate()->SetValue(.1, .1);\n  sliderRepWarpFreq->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepWarpFreq->GetPoint2Coordinate()->SetValue(.1, .9);\n\n  sliderRepWarpFreq->SetTubeWidth(tubeWidth);\n  sliderRepWarpFreq->SetSliderLength(sliderLength);\n  sliderRepWarpFreq->SetTitleHeight(titleHeight);\n  sliderRepWarpFreq->SetLabelHeight(labelHeight);\n\n  auto sliderWidgetWarpFreq = vtkSmartPointer<vtkSliderWidget>::New();\n  sliderWidgetWarpFreq->SetInteractor(interactor);\n  sliderWidgetWarpFreq->SetRepresentation(sliderRepWarpFreq);\n  sliderWidgetWarpFreq->SetAnimationModeToAnimate();\n  sliderWidgetWarpFreq->SetNumberOfAnimationSteps(10);\n  sliderWidgetWarpFreq->EnabledOn();\n\n  auto callbackWarpFreq = vtkSmartPointer<SliderCallbackWarpFreq>::New();\n  callbackWarpFreq->Shader = myCallback;\n\n  sliderWidgetWarpFreq->AddObserver(vtkCommand::InteractionEvent,\n                                    callbackWarpFreq);\n\n  auto sliderRepWarping = vtkSmartPointer<vtkSliderRepresentation2D>::New();\n\n  sliderRepWarping->SetMinimumValue(0.0);\n  sliderRepWarping->SetMaximumValue(1.0);\n  sliderRepWarping->SetValue(.5);\n  sliderRepWarping->SetTitleText(\"Warping\");\n\n  sliderRepWarping->GetPoint1Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepWarping->GetPoint1Coordinate()->SetValue(.9, .1);\n  sliderRepWarping->GetPoint2Coordinate()\n      ->SetCoordinateSystemToNormalizedDisplay();\n  sliderRepWarping->GetPoint2Coordinate()->SetValue(.9, .9);\n\n  sliderRepWarping->SetTubeWidth(tubeWidth);\n  sliderRepWarping->SetSliderLength(sliderLength);\n  sliderRepWarping->SetTitleHeight(titleHeight);\n  sliderRepWarping->SetLabelHeight(labelHeight);\n\n  auto sliderWidgetWarping = vtkSmartPointer<vtkSliderWidget>::New();\n  sliderWidgetWarping->SetInteractor(interactor);\n  sliderWidgetWarping->SetRepresentation(sliderRepWarping);\n  sliderWidgetWarping->SetAnimationModeToAnimate();\n  sliderWidgetWarping->SetNumberOfAnimationSteps(10);\n  sliderWidgetWarping->EnabledOn();\n\n  auto callbackWarping = vtkSmartPointer<SliderCallbackWarping>::New();\n  callbackWarping->Shader = myCallback;\n\n  sliderWidgetWarping->AddObserver(vtkCommand::InteractionEvent,\n                                   callbackWarping);\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.5);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"MarbleShaderDemo\");\n  renderWindow->Render();\n  interactor->Start();\n\n  transform->GetOutput()->GetBounds(bounds);\n  std::cout << \"Range: \"\n            << \" x \" << bounds[1] - bounds[0] << \" y \" << bounds[3] - bounds[2]\n            << \" y \" << bounds[5] - bounds[4] << std::endl;\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    auto reader = vtkSmartPointer<vtkPLYReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    auto reader = vtkSmartPointer<vtkOBJReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    auto reader = vtkSmartPointer<vtkSTLReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    auto reader = vtkSmartPointer<vtkPolyDataReader>::New();\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    auto reader = vtkSmartPointer<vtkBYUReader>::New();\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    auto source = vtkSmartPointer<vtkSphereSource>::New();\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Shaders/MarbleShaderDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarbleShaderDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarbleShaderDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarbleShaderDemo MACOSX_BUNDLE MarbleShaderDemo.cxx )\n  target_link_libraries(MarbleShaderDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarbleShaderDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Shaders/MarbleShaderDemo/#download-and-build-marbleshaderdemo","title":"Download and Build MarbleShaderDemo","text":"

        Click here to download MarbleShaderDemo and its CMakeLists.txt file. Once the tarball MarbleShaderDemo.tar has been downloaded and extracted,

        cd MarbleShaderDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MarbleShaderDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Shaders/SpatterShader/","title":"SpatterShader","text":"

        vtk-examples/Cxx/Shaders/SpatterShader

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Shaders/SpatterShader/#code","title":"Code","text":"

        SpatterShader.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShaderProgram.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVersion.h>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\n// -----------------------------------------------------------------------\n// Update uniform variables in the shader for each render. We do this with a\n// callback for the UpdateShaderEvent\nclass ShaderCallback : public vtkCommand\n{\npublic:\n  static ShaderCallback* New()\n  {\n    return new ShaderCallback;\n  }\n  vtkRenderer* Renderer;\n  float specksize;\n  int sizes;\n  float basecolor[3];\n  float spattercolor[3];\n\n  void Execute(vtkObject*, unsigned long, void* calldata) override\n  {\n    vtkShaderProgram* program = reinterpret_cast<vtkShaderProgram*>(calldata);\n    if (program)\n    {\n      program->SetUniformf(\"specksize\", specksize);\n      program->SetUniformi(\"sizes\", sizes);\n      program->SetUniform3f(\"basecolor\", basecolor);\n      program->SetUniform3f(\"spattercolor\", spattercolor);\n    }\n  }\n\n  void Print(std::ostream& os)\n  {\n    os << \"specksize: \" << specksize << std::endl;\n    os << \"sizes: \" << sizes << std::endl;\n    os << \"basecolor: \" << basecolor[0] << \", \" << basecolor[1] << \", \"\n       << basecolor[2] << std::endl;\n    os << \"spattercolor: \" << spattercolor[0] << \", \" << spattercolor[1] << \", \"\n       << spattercolor[2] << std::endl;\n  }\n\n  ShaderCallback()\n  {\n    this->Renderer = nullptr;\n    // size of the smallest paint specks\n    this->specksize = .05;\n    // number of different sizes of paint specks (each doubles the previous\n    // size)\n    this->sizes = 3;\n    // the background color on which to spatter paint\n    this->basecolor[0] = this->basecolor[1] = this->basecolor[2] = .7;\n    //  the color of the paint spatters\n    this->spattercolor[0] = this->spattercolor[1] = this->spattercolor[2] = 0.0;\n  }\n};\n} // namespace\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" PerlnNoise.glsl \"\n              << \"[polydataFile] \"\n              << \"[specksize(.05)] \"\n              << \"[sizes(3)] \"\n              << \"[basecolor{.7,.7,.7)] \"\n              << \"[spattercolor(0.0,0.0,0.0)] \" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto polyData = ReadPolyData(argc > 2 ? argv[2] : \"\");\n\n  std::ifstream shaderFile(argv[1]);\n  std::ostringstream shaderCode;\n  shaderCode << shaderFile.rdbuf();\n\n  // Create a transform to rescale model\n  double center[3];\n  polyData->GetCenter(center);\n  double bounds[6];\n  polyData->GetBounds(bounds);\n  double maxBound =\n      std::max(std::max(bounds[1] - bounds[0], bounds[3] - bounds[2]),\n               bounds[5] - bounds[4]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  renderer->AddActor(actor);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Clean\n  vtkNew<vtkCleanPolyData> clean;\n  clean->SetInputData(polyData);\n\n  // Rescale polydata to [-1,1]\n  vtkNew<vtkTransform> userTransform;\n  userTransform->Translate(-center[0], -center[1], -center[2]);\n  userTransform->Scale(1.0 / maxBound, 1.0 / maxBound, 1.0 / maxBound);\n  vtkNew<vtkTransformPolyDataFilter> transform;\n  transform->SetTransform(userTransform);\n  transform->SetInputConnection(clean->GetOutputPort());\n\n  vtkNew<vtkTriangleFilter> triangles;\n  triangles->SetInputConnection(transform->GetOutputPort());\n\n  vtkNew<vtkPolyDataNormals> norms;\n  norms->SetInputConnection(triangles->GetOutputPort());\n\n  mapper->SetInputConnection(norms->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuse(1.0);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"ivoryblack\").GetData());\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(2);\n\n  // Modify the vertex shader to pass the position of the vertex\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  out vec4 myVertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::Normal::Impl\",  // replace the normal block\n      true,                   // before the standard replacements\n      \"//VTK::Normal::Impl\\n\" // we still want the default\n      \"  myVertexMC = vertexMC;\\n\",\n      false // only do it once\n  );\n#endif\n\n  // Add the code to generate noise\n  // These functions need to be defined outside of main. Use the System::Dec\n  // to declare and implement\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\"//VTK::System::Dec\",\n                                   false, // before the standard replacements\n                                   shaderCode.str(),\n                                   false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(vtkShader::Fragment, \"//VTK::System::Dec\",\n                               false, // before the standard replacements\n                               shaderCode.str(),\n                               false // only do it once\n  );\n#endif\n  // Define varying and uniforms for the fragment shader here\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"uniform float specksize = .05;\\n\"\n      \"uniform int sizes = 3;\\n\"\n      \"uniform vec3 basecolor = vec3(.7,.7,.7);\\n\"\n      \"uniform vec3 spattercolor = vec3(0.0, 0.0, 0.0);\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Normal::Dec\",  // replace the normal block\n      true,                  // before the standard replacements\n      \"//VTK::Normal::Dec\\n\" // we still want the default\n      \"  varying vec4 myVertexMC;\\n\"\n      \"uniform float specksize = .05;\\n\"\n      \"uniform int sizes = 3;\\n\"\n      \"uniform vec3 basecolor = vec3(.7,.7,.7);\\n\"\n      \"uniform vec3 spattercolor = vec3(0.0, 0.0, 0.0);\\n\",\n      false // only do it once\n  );\n#endif\n\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"\\n\"\n      \"float speckle, size, threshold = 0.7;\\n\"\n      \"vec3 paint;\\n\"\n      \"float scalefac;\\n\"\n      \"vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"scalefac = 1.0/specksize;\\n\"\n      \"paint = basecolor;\\n\"\n      \"for (size=1; size<=sizes; size +=1) {\\n\"\n      \"  speckle = pnoise(myLocalVertexMC * scalefac);\\n\"\n      \"  if (speckle > threshold) {\\n\"\n      \"    paint = spattercolor;\\n\"\n      \"    break;\\n\"\n      \"  }\\n\"\n      \"  scalefac /= 2.0;\\n\"\n      \"}\\n\"\n      \"/* get final color */\\n\"\n      \"fragOutput0.rgb = opacity * vec3(ambientColor + paint + specular);\\n\"\n      \"fragOutput0.a = opacity;\\n\",\n      false // only do once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,   // in the fragment shader\n      \"//VTK::Light::Impl\",  // replace the light block\n      false,                 // after the standard replacements\n      \"//VTK::Light::Impl\\n\" // we still want the default calc\n      \"#define pnoise(x) ((noise(x) + 1.0) / 2.0)\\n\"\n      \"\\n\"\n      \"float speckle, size, threshold = 0.7;\\n\"\n      \"vec3 paint;\\n\"\n      \"float scalefac;\\n\"\n      \"vec4 myLocalVertexMC = myVertexMC;\\n\"\n      \"scalefac = 1.0/specksize;\\n\"\n      \"paint = basecolor;\\n\"\n      \"for (size=1; size<=sizes; size +=1) {\\n\"\n      \"  speckle = pnoise(myLocalVertexMC * scalefac);\\n\"\n      \"  if (speckle > threshold) {\\n\"\n      \"    paint = spattercolor;\\n\"\n      \"    break;\\n\"\n      \"  }\\n\"\n      \"  scalefac /= 2.0;\\n\"\n      \"}\\n\"\n      \"/* get final color */\\n\"\n      \"fragOutput0.rgb = opacity * vec3(ambientColor + paint + specular);\\n\"\n      \"fragOutput0.a = opacity;\\n\",\n      false // only do once\n  );\n#endif\n\n  vtkNew<ShaderCallback> myCallback;\n  myCallback->Renderer = renderer;\n  if (argc == 4)\n  {\n    myCallback->specksize = atof(argv[3]);\n  }\n  if (argc == 5)\n  {\n    myCallback->specksize = atof(argv[3]);\n    myCallback->sizes = atoi(argv[4]);\n  }\n  if (argc == 8)\n  {\n    myCallback->specksize = atof(argv[3]);\n    myCallback->sizes = atoi(argv[4]);\n    myCallback->basecolor[0] = atof(argv[5]);\n    myCallback->basecolor[1] = atof(argv[6]);\n    myCallback->basecolor[2] = atof(argv[7]);\n  }\n  if (argc == 11)\n  {\n    myCallback->specksize = atof(argv[3]);\n    myCallback->sizes = atoi(argv[4]);\n    myCallback->basecolor[0] = atof(argv[5]);\n    myCallback->basecolor[1] = atof(argv[6]);\n    myCallback->basecolor[2] = atof(argv[7]);\n    myCallback->spattercolor[0] = atof(argv[8]);\n    myCallback->spattercolor[1] = atof(argv[9]);\n    myCallback->spattercolor[2] = atof(argv[10]);\n  }\n  std::cout << \"Input: \" << (argc > 2 ? argv[2] : \"Generated Sphere\")\n            << std::endl;\n  myCallback->Print(std::cout);\n  mapper->AddObserver(vtkCommand::UpdateShaderEvent, myCallback);\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(-.3, 0, .08);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(.26, 0.0, .96);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.5);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"SpatterShader\");\n  renderWindow->Render();\n  interactor->Start();\n\n  transform->GetOutput()->GetBounds(bounds);\n  std::cout << \"Range: \"\n            << \" x \" << bounds[1] - bounds[0] << \" y \" << bounds[3] - bounds[2]\n            << \" y \" << bounds[5] - bounds[4] << std::endl;\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Shaders/SpatterShader/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SpatterShader)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SpatterShader: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SpatterShader MACOSX_BUNDLE SpatterShader.cxx )\n  target_link_libraries(SpatterShader PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SpatterShader\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Shaders/SpatterShader/#download-and-build-spattershader","title":"Download and Build SpatterShader","text":"

        Click here to download SpatterShader and its CMakeLists.txt file. Once the tarball SpatterShader.tar has been downloaded and extracted,

        cd SpatterShader/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SpatterShader\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Shaders/SphereMap/","title":"SphereMap","text":"

        vtk-examples/Cxx/Shaders/SphereMap

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Shaders/SphereMap/#code","title":"Code","text":"

        SphereMap.cxx

        /*=========================================================================\n\n  Program:   Visualization Toolkit\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkJPEGReader.h>\n#include <vtkLight.h>\n#include <vtkNew.h>\n#include <vtkOpenGLPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSkybox.h>\n#include <vtkTexture.h>\n#include <vtkVersion.h>\n#include <vtkXMLPolyDataReader.h>\n\n#if VTK_VERSION_NUMBER >= 89000000000ULL\n#define USE_SHADER_PROPERTIES 1\n#include <vtkShaderProperty.h>\n#endif\n\n//----------------------------------------------------------------------------\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.vtp wintersun.jpg\" << std::endl;\n    return EXIT_SUCCESS;\n  }\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(0.0, 0.0, 0.0);\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkLight> light;\n  light->SetLightTypeToSceneLight();\n  light->SetPosition(1.0, 7.0, 1.0);\n  renderer->AddLight(light);\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataNormals> norms;\n  norms->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkTexture> texture;\n  texture->InterpolateOn();\n\n  // mipmapping works on many systems but is not\n  // core 3.2 for cube maps. VTK will silently\n  // ignore it if it is not supported. We commented it\n  // out here to make valid images easier\n  // texture->MipmapOn();\n\n  vtkNew<vtkJPEGReader> imgReader;\n  imgReader->SetFileName(argv[2]);\n  texture->SetInputConnection(imgReader->GetOutputPort());\n\n  vtkNew<vtkOpenGLPolyDataMapper> mapper;\n  mapper->SetInputConnection(norms->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetPosition(0, 0, 0);\n  actor->SetScale(6.0, 6.0, 6.0);\n  actor->GetProperty()->SetSpecular(0.8);\n  actor->GetProperty()->SetSpecularPower(20);\n  actor->GetProperty()->SetDiffuse(0.1);\n  actor->GetProperty()->SetAmbient(0.1);\n  actor->GetProperty()->SetDiffuseColor(1.0, 0.0, 0.4);\n  actor->GetProperty()->SetAmbientColor(0.4, 0.0, 1.0);\n  renderer->AddActor(actor);\n  actor->SetTexture(texture);\n  actor->SetMapper(mapper);\n\n#if USE_SHADER_PROPERTIES\n  vtkShaderProperty* sp = actor->GetShaderProperty();\n  sp->AddVertexShaderReplacement(\n      \"//VTK::PositionVC::Dec\",  // replace\n      true,                      // before the standard replacements\n      \"//VTK::PositionVC::Dec\\n\" // we still want the default\n      \"out vec3 TexCoords;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::PositionVC::Dec\",  // replace\n      true,                      // before the standard replacements\n      \"//VTK::PositionVC::Dec\\n\" // we still want the default\n      \"out vec3 TexCoords;\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddVertexShaderReplacement(\n      \"//VTK::PositionVC::Impl\",  // replace\n      true,                       // before the standard replacements\n      \"//VTK::PositionVC::Impl\\n\" // we still want the default\n      \"vec3 camPos = -MCVCMatrix[3].xyz * mat3(MCVCMatrix);\\n\"\n      \"TexCoords.xyz = reflect(vertexMC.xyz - camPos, normalize(normalMC));\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Vertex,\n      \"//VTK::PositionVC::Impl\",  // replace\n      true,                       // before the standard replacements\n      \"//VTK::PositionVC::Impl\\n\" // we still want the default\n      \"vec3 camPos = -MCVCMatrix[3].xyz * mat3(MCVCMatrix);\\n\"\n      \"TexCoords.xyz = reflect(vertexMC.xyz - camPos, normalize(normalMC));\\n\",\n      false // only do it once\n  );\n#endif\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Dec\",  // replace\n      true,                 // before the standard replacements\n      \"//VTK::Light::Dec\\n\" // we still want the default\n      \"in vec3 TexCoords;\\n\",\n      false // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,\n      \"//VTK::Light::Dec\",  // replace\n      true,                 // before the standard replacements\n      \"//VTK::Light::Dec\\n\" // we still want the default\n      \"in vec3 TexCoords;\\n\",\n      false // only do it once\n  );\n#endif\n\n#if USE_SHADER_PROPERTIES\n  sp->AddFragmentShaderReplacement(\n      \"//VTK::Light::Impl\", // replace\n      true,                 // before the standard replacements\n      \"//VTK::Light::Impl\\n\"\n      \"  float phix = length(vec2(TexCoords.x, TexCoords.z));\\n\"\n      \"  vec3 skyColor = texture(actortexture, vec2(0.5*atan(TexCoords.z, \"\n      \"TexCoords.x)/3.1415927 + 0.5, atan(TexCoords.y,phix)/3.1415927 + \"\n      \"0.5)).xyz;\\n\"\n      \"  gl_FragData[0] = vec4(ambientColor + diffuse + specular + \"\n      \"specularColor*skyColor, opacity);\\n\", // we still want the default\n      false                                  // only do it once\n  );\n#else\n  mapper->AddShaderReplacement(\n      vtkShader::Fragment,\n      \"//VTK::Light::Impl\", // replace\n      true,                 // before the standard replacements\n      \"//VTK::Light::Impl\\n\"\n      \"  float phix = length(vec2(TexCoords.x, TexCoords.z));\\n\"\n      \"  vec3 skyColor = texture(actortexture, vec2(0.5*atan(TexCoords.z, \"\n      \"TexCoords.x)/3.1415927 + 0.5, atan(TexCoords.y,phix)/3.1415927 + \"\n      \"0.5)).xyz;\\n\"\n      \"  gl_FragData[0] = vec4(ambientColor + diffuse + specular + \"\n      \"specularColor*skyColor, opacity);\\n\", // we still want the default\n      false                                  // only do it once\n  );\n#endif\n\n  vtkNew<vtkSkybox> world;\n  world->SetProjectionToSphere();\n  world->SetTexture(texture);\n  renderer->AddActor(world);\n\n  renderer->GetActiveCamera()->SetPosition(0.0, 0.55, 2.0);\n  renderer->GetActiveCamera()->SetFocalPoint(0.0, 0.55, 0.0);\n  renderer->GetActiveCamera()->SetViewAngle(60.0);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(1.1);\n  renderer->GetActiveCamera()->Azimuth(0);\n  renderer->GetActiveCamera()->Elevation(5);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"SphereMap\");\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindow->GetInteractor()->SetInteractorStyle(style);\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Shaders/SphereMap/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SphereMap)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  IOImage\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SphereMap: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SphereMap MACOSX_BUNDLE SphereMap.cxx )\n  target_link_libraries(SphereMap PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SphereMap\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Shaders/SphereMap/#download-and-build-spheremap","title":"Download and Build SphereMap","text":"

        Click here to download SphereMap and its CMakeLists.txt file. Once the tarball SphereMap.tar has been downloaded and extracted,

        cd SphereMap/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SphereMap\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/SimpleOperations/DistanceBetweenPoints/","title":"DistanceBetweenPoints","text":"

        vtk-examples/Cxx/SimpleOperations/DistanceBetweenPoints

        "},{"location":"Cxx/SimpleOperations/DistanceBetweenPoints/#description","title":"Description","text":"

        This example finds the squared distance and the Euclidean distance between two 3D points.

        Other languages

        See (Python), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/SimpleOperations/DistanceBetweenPoints/#code","title":"Code","text":"

        DistanceBetweenPoints.cxx

        #include <vtkMath.h>\n\nint main(int, char*[])\n{\n  // Create two points.\n  double p0[3] = {0.0, 0.0, 0.0};\n  double p1[3] = {1.0, 1.0, 1.0};\n\n  // Find the squared distance between the points.\n  double squaredDistance = vtkMath::Distance2BetweenPoints(p0, p1);\n\n  // Take the square root to get the Euclidean distance between the points.\n  double distance = std::sqrt(squaredDistance);\n\n  // Output the results.\n  std::cout << \"SquaredDistance = \" << squaredDistance << std::endl;\n  std::cout << \"Distance = \" << distance << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/SimpleOperations/DistanceBetweenPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DistanceBetweenPoints)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DistanceBetweenPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DistanceBetweenPoints MACOSX_BUNDLE DistanceBetweenPoints.cxx )\n  target_link_libraries(DistanceBetweenPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DistanceBetweenPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/SimpleOperations/DistanceBetweenPoints/#download-and-build-distancebetweenpoints","title":"Download and Build DistanceBetweenPoints","text":"

        Click here to download DistanceBetweenPoints and its CMakeLists.txt file. Once the tarball DistanceBetweenPoints.tar has been downloaded and extracted,

        cd DistanceBetweenPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DistanceBetweenPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/SimpleOperations/DistancePointToLine/","title":"DistancePointToLine","text":"

        vtk-examples/Cxx/SimpleOperations/DistancePointToLine

        "},{"location":"Cxx/SimpleOperations/DistancePointToLine/#description","title":"Description","text":"

        This example computes the distance from a point to a line.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/SimpleOperations/DistancePointToLine/#code","title":"Code","text":"

        DistancePointToLine.cxx

        #include <vtkLine.h>\n#include <vtkNew.h>\n// #include <vtkPoints.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  double lineP0[3] = {0.0, 0.0, 0.0};\n  double lineP1[3] = {2.0, 0.0, 0.0};\n\n  double p0[3] = {1.0, 0, 0};\n  double p1[3] = {1.0, 2.0, 0};\n\n  /*\n  vtkNew<vtkLine> line;\n  line->GetPoints()->SetPoint(0, lineP0);\n  line->GetPoints()->SetPoint(0, lineP1);\n  */\n\n  {\n    double dist0 = vtkLine::DistanceToLine(p0, lineP0, lineP1);\n    std::cout << \"Dist0: \" << dist0 << std::endl;\n\n    double dist1 = vtkLine::DistanceToLine(p1, lineP0, lineP1);\n    std::cout << \"Dist1: \" << dist1 << std::endl;\n  }\n\n  {\n    double t;\n    double closest[3];\n    double dist0 = vtkLine::DistanceToLine(p0, lineP0, lineP1, t, closest);\n    std::cout << \"Dist0: \" << dist0 << \" closest point: \" << closest[0] << \" \"\n              << closest[1] << \" \" << closest[2] << std::endl;\n\n    double dist1 = vtkLine::DistanceToLine(p1, lineP0, lineP1, t, closest);\n    std::cout << \"Dist1: \" << dist1 << \" closest point: \" << closest[0] << \" \"\n              << closest[1] << \" \" << closest[2] << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/SimpleOperations/DistancePointToLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DistancePointToLine)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DistancePointToLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DistancePointToLine MACOSX_BUNDLE DistancePointToLine.cxx )\n  target_link_libraries(DistancePointToLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DistancePointToLine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/SimpleOperations/DistancePointToLine/#download-and-build-distancepointtoline","title":"Download and Build DistancePointToLine","text":"

        Click here to download DistancePointToLine and its CMakeLists.txt file. Once the tarball DistancePointToLine.tar has been downloaded and extracted,

        cd DistancePointToLine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DistancePointToLine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/SimpleOperations/FloatingPointExceptions/","title":"FloatingPointExceptions","text":"

        vtk-examples/Cxx/SimpleOperations/FloatingPointExceptions

        "},{"location":"Cxx/SimpleOperations/FloatingPointExceptions/#description","title":"Description","text":"

        This example makes the illegal division by zero produce an error: Error: Floating point exception detected. Signal 8 rather than simply store \"inf\" in y.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/SimpleOperations/FloatingPointExceptions/#code","title":"Code","text":"

        FloatingPointExceptions.cxx

        #include <vtkFloatingPointExceptions.h>\n\n// Avoid the \"potential divide by 0\" warning from the Microsoft\n// compiler, since this example intentionally divides by 0\n#ifdef _MSC_VER\n#pragma warning(disable : 4723)\n#endif\n\nint main(int, char*[])\n{\n  // Disabled by default with gcc or visual studio.\n  // Enabled by default by Borland CC.\n  vtkFloatingPointExceptions::Enable();\n\n  double x = 0.0;\n  double y = 1.0 / x; // floating-point exception\n\n  std::cout << \"x: \" << x << \" y: \" << y << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/SimpleOperations/FloatingPointExceptions/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FloatingPointExceptions)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FloatingPointExceptions: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FloatingPointExceptions MACOSX_BUNDLE FloatingPointExceptions.cxx )\n  target_link_libraries(FloatingPointExceptions PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FloatingPointExceptions\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/SimpleOperations/FloatingPointExceptions/#download-and-build-floatingpointexceptions","title":"Download and Build FloatingPointExceptions","text":"

        Click here to download FloatingPointExceptions and its CMakeLists.txt file. Once the tarball FloatingPointExceptions.tar has been downloaded and extracted,

        cd FloatingPointExceptions/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FloatingPointExceptions\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/SimpleOperations/GaussianRandomNumber/","title":"GaussianRandomNumber","text":"

        vtk-examples/Cxx/SimpleOperations/GaussianRandomNumber

        "},{"location":"Cxx/SimpleOperations/GaussianRandomNumber/#description","title":"Description","text":"

        This example generates 3 random numbers from a Gaussian distribution with mean 0.0 and standard deviation 2.0.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/SimpleOperations/GaussianRandomNumber/#code","title":"Code","text":"

        GaussianRandomNumber.cxx

        #include <vtkBoxMuellerRandomSequence.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // The number of random numbers we wish to produce\n  unsigned int numRand = 3;\n\n  vtkNew<vtkBoxMuellerRandomSequence> randomSequence;\n\n  // Generate numRand random numbers from a Gaussian distribution with mean 0.0\n  // and standard deviation 2.0\n  auto mean = 0.0;\n  auto standardDeviation = 2.0;\n  for (unsigned int i = 0; i < numRand; i++)\n  {\n    auto a = randomSequence->GetScaledValue(mean, standardDeviation);\n    randomSequence->Next();\n    std::cout << a << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/SimpleOperations/GaussianRandomNumber/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GaussianRandomNumber)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GaussianRandomNumber: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GaussianRandomNumber MACOSX_BUNDLE GaussianRandomNumber.cxx )\n  target_link_libraries(GaussianRandomNumber PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GaussianRandomNumber\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/SimpleOperations/GaussianRandomNumber/#download-and-build-gaussianrandomnumber","title":"Download and Build GaussianRandomNumber","text":"

        Click here to download GaussianRandomNumber and its CMakeLists.txt file. Once the tarball GaussianRandomNumber.tar has been downloaded and extracted,

        cd GaussianRandomNumber/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GaussianRandomNumber\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/SimpleOperations/PerspectiveTransform/","title":"PerspectiveTransform","text":"

        vtk-examples/Cxx/SimpleOperations/PerspectiveTransform

        "},{"location":"Cxx/SimpleOperations/PerspectiveTransform/#description","title":"Description","text":"

        The perspective transform automatically appends the \"homogeneous 1\" to the point before it is multiplied by the matrix. It then divides the first 3 coordinates of the result by the 4th coordinate of the result. For comparison, the standard projection (vtkTransform) is also performed with the same matrix and the same point. Note that the results are much different.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/SimpleOperations/PerspectiveTransform/#code","title":"Code","text":"

        PerspectiveTransform.cxx

        #include <vtkMatrix4x4.h>\n#include <vtkNew.h>\n#include <vtkPerspectiveTransform.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkMatrix4x4> m;\n  m->SetElement(0, 0, 1);\n  m->SetElement(0, 1, 2);\n  m->SetElement(0, 2, 3);\n  m->SetElement(0, 3, 4);\n  m->SetElement(1, 0, 2);\n  m->SetElement(1, 1, 2);\n  m->SetElement(1, 2, 3);\n  m->SetElement(1, 3, 4);\n  m->SetElement(2, 0, 3);\n  m->SetElement(2, 1, 2);\n  m->SetElement(2, 2, 3);\n  m->SetElement(2, 3, 4);\n  m->SetElement(3, 0, 4);\n  m->SetElement(3, 1, 2);\n  m->SetElement(3, 2, 3);\n  m->SetElement(3, 3, 4);\n\n  vtkNew<vtkPerspectiveTransform> perspectiveTransform;\n  perspectiveTransform->SetMatrix(m);\n\n  vtkNew<vtkTransform> transform;\n  transform->SetMatrix(m);\n\n  double p[3];\n  p[0] = 1.0;\n  p[1] = 2.0;\n  p[2] = 3.0;\n\n  double normalProjection[3];\n  transform->TransformPoint(p, normalProjection);\n\n  std::cout << \"Standard projection: \" << normalProjection[0] << \" \"\n            << normalProjection[1] << \" \" << normalProjection[2] << std::endl;\n\n  double perspectiveProjection[3];\n  perspectiveTransform->TransformPoint(p, perspectiveProjection);\n  std::cout << \"Perspective projection: \" << perspectiveProjection[0] << \" \"\n            << perspectiveProjection[1] << \" \" << perspectiveProjection[2]\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/SimpleOperations/PerspectiveTransform/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PerspectiveTransform)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonMath\n  CommonTransforms\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PerspectiveTransform: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PerspectiveTransform MACOSX_BUNDLE PerspectiveTransform.cxx )\n  target_link_libraries(PerspectiveTransform PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PerspectiveTransform\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/SimpleOperations/PerspectiveTransform/#download-and-build-perspectivetransform","title":"Download and Build PerspectiveTransform","text":"

        Click here to download PerspectiveTransform and its CMakeLists.txt file. Once the tarball PerspectiveTransform.tar has been downloaded and extracted,

        cd PerspectiveTransform/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PerspectiveTransform\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/SimpleOperations/ProjectPointPlane/","title":"ProjectPointPlane","text":"

        vtk-examples/Cxx/SimpleOperations/ProjectPointPlane

        "},{"location":"Cxx/SimpleOperations/ProjectPointPlane/#description","title":"Description","text":"

        This example projects a point onto a plane. To use this example, you must have the CVSHEAD version of VTK (as of 2/2/2010).

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/SimpleOperations/ProjectPointPlane/#code","title":"Code","text":"

        ProjectPointPlane.cxx

        #include <vtkNew.h>\n#include <vtkPlane.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(0.0, 0.0, 0.0);\n  plane->SetNormal(0.0, 0.0, 1.0);\n\n  double p[3] = {23.1, 54.6, 9.2};\n  double origin[3] = {0.0, 0.0, 0.0};\n  double normal[3] = {0.0, 0.0, 1.0};\n  double projected[3];\n\n  plane->ProjectPoint(p, origin, normal, projected);\n\n  std::cout << \"Projected: \" << projected[0] << \" \" << projected[1] << \" \"\n            << projected[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/SimpleOperations/ProjectPointPlane/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProjectPointPlane)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProjectPointPlane: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProjectPointPlane MACOSX_BUNDLE ProjectPointPlane.cxx )\n  target_link_libraries(ProjectPointPlane PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProjectPointPlane\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/SimpleOperations/ProjectPointPlane/#download-and-build-projectpointplane","title":"Download and Build ProjectPointPlane","text":"

        Click here to download ProjectPointPlane and its CMakeLists.txt file. Once the tarball ProjectPointPlane.tar has been downloaded and extracted,

        cd ProjectPointPlane/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ProjectPointPlane\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/SimpleOperations/RandomSequence/","title":"RandomSequence","text":"

        vtk-examples/Cxx/SimpleOperations/RandomSequence

        "},{"location":"Cxx/SimpleOperations/RandomSequence/#description","title":"Description","text":"

        This is the \"new\" (December, 2009) VTK way to produce random numbers. It is actually a random sequence generator.

        Other languages

        See (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/SimpleOperations/RandomSequence/#code","title":"Code","text":"

        RandomSequence.cxx

        #include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // Create a random sequence generator.\n  vtkNew<vtkMinimalStandardRandomSequence> sequence;\n\n  // initialize the sequence\n  sequence->SetSeed(1);\n\n  // Get 3 random numbers.\n  double x = sequence->GetValue();\n  sequence->Next();\n  double y = sequence->GetValue();\n  sequence->Next();\n  double z = sequence->GetValue();\n\n  // You can also use seq->GetRangeValue(-1.0,1.0);\n  // to set a range on the random values.\n\n  // Output the resulting random numbersl\n  std::cout << \"x: \" << x << \" y: \" << y << \" z: \" << z << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/SimpleOperations/RandomSequence/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RandomSequence)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RandomSequence: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RandomSequence MACOSX_BUNDLE RandomSequence.cxx )\n  target_link_libraries(RandomSequence PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RandomSequence\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/SimpleOperations/RandomSequence/#download-and-build-randomsequence","title":"Download and Build RandomSequence","text":"

        Click here to download RandomSequence and its CMakeLists.txt file. Once the tarball RandomSequence.tar has been downloaded and extracted,

        cd RandomSequence/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RandomSequence\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/SimpleOperations/UniformRandomNumber/","title":"UniformRandomNumber","text":"

        vtk-examples/Cxx/SimpleOperations/UniformRandomNumber

        "},{"location":"Cxx/SimpleOperations/UniformRandomNumber/#description","title":"Description","text":"

        This example generates 3 random numbers between 0 and 2 from a uniform distribution.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/SimpleOperations/UniformRandomNumber/#code","title":"Code","text":"

        UniformRandomNumber.cxx

        #include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNew.h>\n\n#include <time.h>\n\nint main(int, char*[])\n{\n  // Set the number of random numbers we wish to produce to 3.\n  unsigned int numRand = 3;\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  // Without this line, the random numbers will be the same every iteration.\n  // randomSequence->SetSeed(time(NULL));\n\n  // Generate numRand random numbers from a uniform distribution between 0.0\n  // and 2.0\n  for (unsigned int i = 0; i < numRand; i++)\n  {\n    auto a = randomSequence->GetRangeValue(0.0, 2.0);\n    randomSequence->Next();\n\n    std::cout << a << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/SimpleOperations/UniformRandomNumber/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(UniformRandomNumber)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"UniformRandomNumber: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(UniformRandomNumber MACOSX_BUNDLE UniformRandomNumber.cxx )\n  target_link_libraries(UniformRandomNumber PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS UniformRandomNumber\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/SimpleOperations/UniformRandomNumber/#download-and-build-uniformrandomnumber","title":"Download and Build UniformRandomNumber","text":"

        Click here to download UniformRandomNumber and its CMakeLists.txt file. Once the tarball UniformRandomNumber.tar has been downloaded and extracted,

        cd UniformRandomNumber/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./UniformRandomNumber\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Snippets/CameraPosition/","title":"CameraPosition","text":""},{"location":"Cxx/Snippets/CameraPosition/#description","title":"Description","text":"

        A callback that gives you the camera position and focal point.

        "},{"location":"Cxx/Snippets/CameraPosition/#declaration-section","title":"Declaration Section","text":"
        #include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n\nnamespace {\n\n// Get the camera position.\nvoid CameraModifiedCallback(vtkObject* caller,\n                            long unsigned int vtkNotUsed(eventId),\n                            void* vtkNotUsed(clientData),\n                            void* vtkNotUsed(callData));\n} // namespace\n
        "},{"location":"Cxx/Snippets/CameraPosition/#implementation-section","title":"Implementation Section","text":"
        namespace {\n\nvoid CameraModifiedCallback(vtkObject* caller,\n                            long unsigned int vtkNotUsed(eventId),\n                            void* vtkNotUsed(clientData),\n                            void* vtkNotUsed(callData))\n{\n  std::cout << caller->GetClassName() << \" modified\" << std::endl;\n  vtkCamera* camera = static_cast<vtkCamera*>(caller);\n  // Print the interesting stuff.\n  std::cout << \"  auto camera = renderer->GetActiveCamera();\" << std::endl;\n  std::cout << \"  camera->SetPosition(\" << camera->GetPosition()[0] << \", \"\n            << camera->GetPosition()[1] << \", \" << camera->GetPosition()[2]\n            << \");\" << std::endl;\n  std::cout << \"  camera->SetFocalPoint(\" << camera->GetFocalPoint()[0] << \", \"\n            << camera->GetFocalPoint()[1] << \", \" << camera->GetFocalPoint()[2]\n            << \");\" << std::endl;\n  std::cout << \"  camera->SetViewUp(\" << camera->GetViewUp()[0] << \", \"\n            << camera->GetViewUp()[1] << \", \" << camera->GetViewUp()[2] << \");\"\n            << std::endl;\n  std::cout << \"  camera->SetDistance(\" << camera->GetDistance() << \");\"\n            << std::endl;\n  std::cout << \"  camera->SetClippingRange(\" << camera->GetClippingRange()[0]\n            << \", \" << camera->GetClippingRange()[1] << \");\" << std::endl;\n  std::cout << std::endl;\n}\n} // namespace\n
        "},{"location":"Cxx/Snippets/CameraPosition/#usage","title":"Usage","text":"
          // Call vtkRenderWindow::Render() before this code e.g. renWin->Render();\n  vtkNew<vtkCallbackCommand> modifiedCallback;\n  modifiedCallback->SetCallback(CameraModifiedCallback);\n  renderer->GetActiveCamera()->AddObserver(vtkCommand::ModifiedEvent,\n                                           modifiedCallback);\n

        Once you have the output, replace the renderer->GetActiveCamera()->AddObserver... line with the output data.

        "},{"location":"Cxx/Snippets/CheckVTKVersion/","title":"CheckVTKVersion","text":""},{"location":"Cxx/Snippets/CheckVTKVersion/#description","title":"Description","text":"

        This enables us to check the VTK version and provide alternatives for different VTK versions.

        true is returned if the requested VTK version is >= the current version.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Cxx/Snippets/CheckVTKVersion/#declaration-section","title":"Declaration Section","text":"
        #include <vtkNew.h>\n#include <vtkVersion.h>\n\nnamespace {\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return true if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n\n} // namespace\n
        "},{"location":"Cxx/Snippets/CheckVTKVersion/#implementation-section","title":"Implementation Section","text":"
        namespace {\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n  auto res = false;\n#ifndef VTK_VERSION_NUMBER\n  vtkNew<vtkVersion> ver;\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  res = vtk_version_number >= neededVersion;\n#else\n  res = VTK_VERSION_NUMBER >= neededVersion;\n#endif\n  return res;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Snippets/CheckVTKVersion/#typical-usage","title":"Typical usage","text":"
          // We can check and exit if the VTK version is too old.\n  if (!VTKVersionOk(9, 0, 0))\n  {\n    std::cerr << \"You need VTK version 9.0.0 or greater to run this program.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n

        See:

        • PBR_Skybox for a typical usage example. Here we are deciding to use vtkCameraOrientationWidget instead of vtkOrientationMarkerWidget if the VTK version is >= 9.0.20210718.
        • CheckVTKVersion for a test/example.
        "},{"location":"Cxx/Snippets/ChooseContrastingColor/","title":"ChooseContrastingColor","text":""},{"location":"Cxx/Snippets/ChooseContrastingColor/#description","title":"Description","text":"

        Given a color, find a contrasting color. If the given color is \"light\", use the lightColor otherwise use the darkColor.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Cxx/Snippets/ChooseContrastingColor/#declaration-section","title":"Declaration Section","text":"
        #include <vtkNamedColors.h>\n#include <vtkMath.h>\nnamespace\n{\n// Given a color, find a contrasting color. If the given color is \"light\",\n// use the lightColor otherwise use the darkColor\nvoid ChooseContrastingColor(double *rgbIn,\n                            double *rgbOut,\n                            const double threshold = .5,\n                            const std::string lightColor = \"white\",\n                            const std::string darkColor = \"black\");\n}\n
        "},{"location":"Cxx/Snippets/ChooseContrastingColor/#implementation-section","title":"Implementation Section","text":"
        namespace\n{\nvoid ChooseContrastingColor(double *rgbIn,\n                            double *rgbOut,\n                            const double threshold,\n                            const std::string lightColor,\n                            const std::string darkColor)\n{\n  auto colors = vtkSmartPointer<vtkNamedColors>::New();\n\n  double hsv[3];\n  // If the value is <= threshold, use a light color, otherwise use a dark color\n  vtkMath::RGBToHSV(rgbIn, hsv);\n  if (hsv[2] <= threshold)\n  {\n    colors->GetColor(lightColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n  else\n  {\n    colors->GetColor(darkColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n}\n}  // namespace\n
        "},{"location":"Cxx/Snippets/PointToGlyph/","title":"PointToGlyph","text":""},{"location":"Cxx/Snippets/PointToGlyph/#description","title":"Description","text":"

        Represent points as glyphs. The point is represented as a sphere.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Cxx/Snippets/PointToGlyph/#declaration-section","title":"Declaration Section","text":"
        #include <vtkActor.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\nnamespace\n{\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n}\n
        "},{"location":"Cxx/Snippets/PointToGlyph/#implementation-section","title":"Implementation Section","text":"
        namespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Snippets/PointToGlyph/#usage","title":"Usage","text":"
          // Map the points to spheres\n  auto sphereActor = PointToGlyph(someFilter->GetOutput()->GetPoints(), 0.05);\n  // Set the actor color here\n
        "},{"location":"Cxx/Snippets/ReadPolyData/","title":"ReadPolyData","text":""},{"location":"Cxx/Snippets/ReadPolyData/#description","title":"Description","text":"

        Given a filename, uses the appropriate vtkPolyData reader to read any vtkPolyData file.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Cxx/Snippets/ReadPolyData/#declaration-section","title":"Declaration Section","text":"
        // Readers\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtkPolyData.h>\n#include <vtkSphereSource.h>\n\n#include <algorithm> // For transform()\n#include <string> // For find_last_of()\n#include <cctype> // For to_lower\n\nnamespace {\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(std::string const& fileName);\n\n}\n
        "},{"location":"Cxx/Snippets/ReadPolyData/#implementation-section","title":"Implementation Section","text":"
        namespace {\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(25);\n    source->SetThetaResolution(25);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Snippets/RestoreSceneFromFieldData/","title":"RestoreSceneFromFieldData","text":""},{"location":"Cxx/Snippets/RestoreSceneFromFieldData/#description","title":"Description","text":"

        Given a vtkDataSet, vtkActor and vtkCamera, restore the necessary variables in the vtkDataSet's vtkFieldData to recreate a scene to a file.

        Note

        The snippet currently just saves the vtkCamera variables.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Cxx/Snippets/RestoreSceneFromFieldData/#declaration-section","title":"Declaration Section","text":"
        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSet.h>\n#include <vtkFieldData.h>\n#include <vtkStringArray.h>\n#include <vtksys/RegularExpression.hxx>\n\nnamespace\n{\nvoid RestoreSceneFromFieldData(vtkDataSet *data,\n                               vtkActor *actor,\n                               vtkCamera *camera);\n}\n
        "},{"location":"Cxx/Snippets/RestoreSceneFromFieldData/#implementation-section","title":"Implementation Section","text":"
        namespace\n{\nvoid  RestoreSceneFromFieldData(vtkDataSet *data,\n                               vtkActor *actor,\n                               vtkCamera *camera)\n{\n\n  std::istringstream buffer;\n\n  // Get the saved camera information from the field data\n  if (vtkStringArray::SafeDownCast(\n        data->GetFieldData()->GetAbstractArray(\"Camera\")))\n  {\n    buffer.str(vtkStringArray::SafeDownCast(\n                 data->GetFieldData()->GetAbstractArray(\"Camera\"))->GetValue(0));\n  }\n  else\n  {\n    return;\n  }\n\n  std::string line;\n  double vector[3];\n  double scalar;\n\n  vtksys::RegularExpression reCP(\"^Camera:Position\");\n  vtksys::RegularExpression reCFP(\"^Camera:FocalPoint\");\n  vtksys::RegularExpression reCVU(\"^Camera:ViewUp\");\n  vtksys::RegularExpression reCVA(\"^Camera:ViewAngle\");\n  vtksys::RegularExpression reCCR(\"^Camera:ClippingRange\");\n  vtksys::RegularExpression floatNumber(\n      \"[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])\");\n  vtksys::RegularExpression floatScalar(\"[^0-9\\\\.\\\\-]*([0-9\\\\.\\\\-e]*[^,])\");\n\n  while (std::getline(buffer,line))\n  {\n    if (reCFP.find(line))\n    {\n      std::string rest(line, reCFP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetFocalPoint(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCP.find(line))\n    {\n      std::string rest(line, reCP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetPosition(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVU.find(line))\n    {\n      std::string rest(line, reCVU.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetViewUp(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVA.find(line))\n    {\n      std::string rest(line, reCVA.end());\n      if (floatScalar.find(rest))\n      {\n        camera->SetViewAngle(\n          atof(floatScalar.match(1).c_str()));\n      }\n    }\n    else if (reCCR.find(line))\n    {\n      std::string rest(line, reCCR.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetClippingRange(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()));\n      }\n    }\n    else\n    {\n      std::cout << \"Unrecognized line: \" << line << std::endl;\n    }\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/Snippets/RestoreSceneFromFile/","title":"RestoreSceneFromFile","text":""},{"location":"Cxx/Snippets/RestoreSceneFromFile/#description","title":"Description","text":"

        Given a filename, vtkActor and vtkCamera, reads necessary variables to recreate the scene from a file.

        Note

        The snippet currently just restores the vtkCamera variables.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Cxx/Snippets/RestoreSceneFromFile/#declaration-section","title":"Declaration Section","text":"
        #include <vtkActor.h>\n#include <vtkCamera.h>\nnamespace\n{\nvoid RestoreSceneFromFile(std::string fileName,\n                          vtkActor *actor,\n                          vtkCamera *camera);\n}\n
        "},{"location":"Cxx/Snippets/RestoreSceneFromFile/#implementation-section","title":"Implementation Section","text":"
        namespace\n{\n#include <fstream>\n\nvoid RestoreSceneFromFile(std::string fileName,\n                          vtkActor *actor,\n                          vtkCamera *camera)\n{\n  std::ifstream saveFile(fileName);\n  std::string line;\n  double vector[3];\n  double scalar;\n\n  vtksys::RegularExpression reCP(\"^Camera:Position\");\n  vtksys::RegularExpression reCFP(\"^Camera:FocalPoint\");\n  vtksys::RegularExpression reCVU(\"^Camera:ViewUp\");\n  vtksys::RegularExpression reCVA(\"^Camera:ViewAngle\");\n  vtksys::RegularExpression reCCR(\"^Camera:ClippingRange\");\n  vtksys::RegularExpression floatNumber(\n      \"[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])\");\n  vtksys::RegularExpression floatScalar(\"[^0-9\\\\.\\\\-]*([0-9\\\\.\\\\-e]*[^,])\");\n\n  while (std::getline(saveFile, line) && ! saveFile.eof())\n  {\n    if (reCFP.find(line))\n    {\n      std::string rest(line, reCFP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetFocalPoint(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCP.find(line))\n    {\n      std::string rest(line, reCP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetPosition(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVU.find(line))\n    {\n      std::string rest(line, reCVU.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetViewUp(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()),\n          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVA.find(line))\n    {\n      std::string rest(line, reCVA.end());\n      if (floatScalar.find(rest))\n      {\n        camera->SetViewAngle(\n          atof(floatScalar.match(1).c_str()));\n      }\n    }\n    else if (reCCR.find(line))\n    {\n      std::string rest(line, reCCR.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetClippingRange(\n          atof(floatNumber.match(1).c_str()),\n          atof(floatNumber.match(2).c_str()));\n      }\n    }\n    else\n    {\n      std::cout << \"Unrecognized line: \" << line << std::endl;\n    }\n  }\n  saveFile.close();\n}\n} // namespace\n
        "},{"location":"Cxx/Snippets/SaveSceneToFieldData/","title":"SaveSceneToFieldData","text":""},{"location":"Cxx/Snippets/SaveSceneToFieldData/#description","title":"Description","text":"

        Given a vtkDataSet, vtkActor and vtkCamera, save necessary variables in the vtkDataSet's vtkFieldData to recreate a scene to a file.

        Note

        The snippet currently just saves the vtkCamera variables.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Cxx/Snippets/SaveSceneToFieldData/#declaration-section","title":"Declaration Section","text":"
        namespace\n{\nvoid SaveSceneToFieldData(vtkDataSet *data,\n                          vtkActor *actor,\n                          vtkCamera *camera);\n}\n
        "},{"location":"Cxx/Snippets/SaveSceneToFieldData/#implementation-section","title":"Implementation Section","text":"
        #include <sstream>\n\nnamespace\n{\nvoid SaveSceneToFieldData(vtkDataSet *data,\n                          vtkActor *actor,\n                          vtkCamera *camera)\n{\n  std::ostringstream buffer;\n  double vector[3];\n  double scalar;\n\n  camera->GetFocalPoint(vector);\n  buffer << \"Camera:FocalPoint \"\n         << vector[0] << \", \"\n         << vector[1] << \", \"\n         << vector[2] << std::endl;\n  camera->GetPosition(vector);\n  buffer << \"Camera:Position \"\n           << vector[0] << \", \"\n           << vector[1] << \", \"\n           << vector[2] << std::endl;\n  camera->GetViewUp(vector);\n  buffer << \"Camera:ViewUp \"\n           << vector[0] << \", \"\n           << vector[1] << \", \"\n           << vector[2] << std::endl;\n  scalar = camera->GetViewAngle();\n  buffer << \"Camera:ViewAngle \"\n           << scalar << std::endl;\n  camera->GetClippingRange(vector);\n  buffer << \"Camera:ClippingRange \"\n           << vector[0] << \", \"\n           << vector[1] << std::endl;\n  vtkSmartPointer<vtkStringArray> cameraArray = \n    vtkSmartPointer<vtkStringArray>::New();\n  cameraArray->SetNumberOfValues(1);\n  cameraArray->SetValue(0, buffer.str());\n  cameraArray->SetName(\"Camera\");\n  data->GetFieldData()->AddArray(cameraArray);\n}\n} // namespace\n
        "},{"location":"Cxx/Snippets/SaveSceneToFile/","title":"SaveSceneToFile","text":""},{"location":"Cxx/Snippets/SaveSceneToFile/#description","title":"Description","text":"

        Given a filename, vtkActor and vtkCamera, save necessary variables to recreate a scene to a file.

        Note

        The snippet currently just saves the vtkCamera variables.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Cxx/Snippets/SaveSceneToFile/#declaration-section","title":"Declaration Section","text":"
        #include <vtkActor.h>\n#include <vtkCamera.h>\nnamespace\n{\nvoid SaveSceneToFile(std::string fileName,\n                     vtkActor *actor,\n                     vtkCamera *camera);\n}\n
        "},{"location":"Cxx/Snippets/SaveSceneToFile/#implementation-section","title":"Implementation Section","text":"
        namespace\n{\n#include <fstream>\n\nvoid SaveSceneToFile(std::string fileName,\n                     vtkActor *actor,\n                     vtkCamera *camera)\n{\n// Actor\n//  Position, orientation, origin, scale, usrmatrix, usertransform\n//Camera\n//  FocalPoint, Position, ViewUp, ViewAngle, ClippingRange\n  std::ofstream saveFile(fileName, std::ofstream::out);\n  double vector[3];\n  double scalar;\n\n  camera->GetFocalPoint(vector);\n  saveFile << \"Camera:FocalPoint \"\n           << vector[0] << \", \"\n           << vector[1] << \", \"\n           << vector[2] << std::endl;\n  camera->GetPosition(vector);\n  saveFile << \"Camera:Position \"\n           << vector[0] << \", \"\n           << vector[1] << \", \"\n           << vector[2] << std::endl;\n  camera->GetViewUp(vector);\n  saveFile << \"Camera:ViewUp \"\n           << vector[0] << \", \"\n           << vector[1] << \", \"\n           << vector[2] << std::endl;\n  scalar = camera->GetViewAngle();\n  saveFile << \"Camera:ViewAngle \"\n           << scalar << std::endl;\n  camera->GetClippingRange(vector);\n  saveFile << \"Camera:ClippingRange \"\n           << vector[0] << \", \"\n           << vector[1] << std::endl;\n  saveFile.close();\n}\n} // namespace\n
        "},{"location":"Cxx/Snippets/ViewportBorders/","title":"ViewportBorders","text":""},{"location":"Cxx/Snippets/ViewportBorders/#description","title":"Description","text":"

        Draw the borders of a vtkRenderer's viewports.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Cxx/Snippets/ViewportBorders/#declaration-section","title":"Declaration Section","text":"
        #include <vtkRenderer.h>\n#include <vtkPoints.h>\n#include <vtkCellArray.h>\n#include <vtkPolyLines.h>\n#include <vtkPolyData.h>\n#include <vtkCoordinate.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkActor2D.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n\nnamespace\n{\nvoid ViewportBorders(vtkSmartPointer<vtkRenderer> &renderer,\n                     double *color,\n                     bool last = false);\n}\n
        "},{"location":"Cxx/Snippets/ViewportBorders/#implementation-section","title":"Implementation Section","text":"
        namespace\n{\n// Draw the borders of a renderer's viewport\nvoid ViewportBorders(vtkSmartPointer<vtkRenderer> &renderer,\n                     double *color,\n                     bool last)\n{\n  // points start at upper right and proceed anti-clockwise\n  auto points = vtkSmartPointer<vtkPoints>::New();\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  // create cells, and lines\n  auto cells =  vtkSmartPointer<vtkCellArray>::New();\n  cells->Initialize(); \n\n  auto lines = vtkSmartPointer<vtkPolyLine>::New();\n\n  // only draw last line if this is the last viewport\n  // this prevents double vertical lines at right border\n  // if different colors are used for each border, then do\n  // not specify last\n  if (last)\n  {\n    lines->GetPointIds()->SetNumberOfIds(5);\n  }\n  else\n  {\n  lines->GetPointIds()->SetNumberOfIds(4);\n  }\n  for(unsigned int i = 0; i < 4; ++i)\n  {\n    lines->GetPointIds()->SetId(i,i);\n  }\n  if (last)\n  {\n    lines->GetPointIds()->SetId(4, 0);\n  }\n  cells->InsertNextCell(lines);\n\n  // now make tge polydata and display it\n  auto poly = vtkSmartPointer<vtkPolyData>::New();\n  poly->Initialize(); \n  poly->SetPoints(points); \n  poly->SetLines(cells); \n\n  // use normalized viewport coordinates since\n  // they are independent of window size\n  auto coordinate = vtkSmartPointer<vtkCoordinate>::New();\n  coordinate->SetCoordinateSystemToNormalizedViewport(); \n\n  auto mapper = vtkSmartPointer<vtkPolyDataMapper2D>::New();\n  mapper->SetInputData(poly); \n  mapper->SetTransformCoordinate(coordinate); \n\n  auto actor = vtkSmartPointer<vtkActor2D>::New();\n  actor->SetMapper(mapper); \n  actor->GetProperty()->SetColor(color);\n  // line width should be at least 2 to be visible at extremes\n\n  actor->GetProperty()->SetLineWidth(4.0); // Line Width \n\n  renderer->AddViewProp(actor);\n}\n} // namespace\n
        "},{"location":"Cxx/Snippets/WriteImage/","title":"Description","text":"

        Given a filename, render window and optionally a rgba value, take a screenshot of the render window and write it to a file. The extension of the filename determines what writer to use.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Cxx/Snippets/WriteImage/#c","title":"C++","text":""},{"location":"Cxx/Snippets/WriteImage/#declaration-section","title":"Declaration Section","text":"
        #include <vtkBMPWriter.h>\n#include <vtkImageWriter.h>\n#include <vtkJPEGWriter.h>\n#include <vtkPNGWriter.h>\n#include <vtkPNMWriter.h>\n#include <vtkPostScriptWriter.h>\n#include <vtkTIFFWriter.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <algorithm>\n#include <locale>\n#include <string>\n\nnamespace\n{\n/**\n * Write the render window view to an image file.\n * \n * Image types supported are:\n *  BMP, JPEG, PNM, PNG, PostScript, TIFF.\n * The default parameters are used for all writers, change as needed.\n * \n * @param fileName The file name, if no extension then PNG is assumed.\n * @param renWin The render window.\n * @param rgba Used to set the buffer type.\n * \n */\nvoid WriteImage(std::string const& fileName, vtkRenderWindow* renWin,\n                bool rgba = true);\n\n\n}\n
        "},{"location":"Cxx/Snippets/WriteImage/#implementation-section","title":"Implementation Section","text":"
        namespace {\n\nvoid WriteImage(std::string const& fileName, vtkRenderWindow* renWin, bool rgba)\n{\n  if (!fileName.empty())\n  {\n    std::string fn = fileName;\n    std::string ext;\n    auto found = fn.find_last_of(\".\");\n    if (found == std::string::npos)\n    {\n      ext = \".png\";\n      fn += ext;\n    }\n    else\n    {\n      ext = fileName.substr(found, fileName.size());\n    }\n    std::locale loc;\n    std::transform(ext.begin(), ext.end(), ext.begin(),\n                   [=](char const& c) { return std::tolower(c, loc); });\n    auto writer = vtkSmartPointer<vtkImageWriter>::New();\n    if (ext == \".bmp\")\n    {\n      writer = vtkSmartPointer<vtkBMPWriter>::New();\n    }\n    else if (ext == \".jpg\")\n    {\n      writer = vtkSmartPointer<vtkJPEGWriter>::New();\n    }\n    else if (ext == \".pnm\")\n    {\n      writer = vtkSmartPointer<vtkPNMWriter>::New();\n    }\n    else if (ext == \".ps\")\n    {\n      if (rgba)\n      {\n        rgba = false;\n      }\n      writer = vtkSmartPointer<vtkPostScriptWriter>::New();\n    }\n    else if (ext == \".tiff\")\n    {\n      writer = vtkSmartPointer<vtkTIFFWriter>::New();\n    }\n    else\n    {\n      writer = vtkSmartPointer<vtkPNGWriter>::New();\n    }\n    vtkNew<vtkWindowToImageFilter> window_to_image_filter;\n    window_to_image_filter->SetInput(renWin);\n    window_to_image_filter->SetScale(1); // image quality\n    if (rgba)\n    {\n      window_to_image_filter->SetInputBufferTypeToRGBA();\n    }\n    else\n    {\n      window_to_image_filter->SetInputBufferTypeToRGB();\n    }\n    // Read from the front buffer.\n    window_to_image_filter->ReadFrontBufferOff();\n    window_to_image_filter->Update();\n\n    writer->SetFileName(fn.c_str());\n    writer->SetInputConnection(window_to_image_filter->GetOutputPort());\n    writer->Write();\n  }\n  else\n  {\n    std::cerr << \"No filename provided.\" << std::endl;\n  }\n\n  return;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Snippets/WriteImage/#usage","title":"Usage","text":"
          WriteImage(f, renWin, false);\n
        "},{"location":"Cxx/Snippets/WriteImage/#note","title":"Note","text":"

        You may need to your edit your CMakeLists.txt adding this to the find_package(VTK COMPONENTS statement:

          IOImage\n  RenderingCore\n
        "},{"location":"Cxx/StructuredGrid/BlankPoint/","title":"BlankPoint","text":"

        vtk-examples/Cxx/StructuredGrid/BlankPoint

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/StructuredGrid/BlankPoint/#code","title":"Code","text":"

        BlankPoint.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n\n#include <iostream>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  vtkNew<vtkPoints> points;\n\n  unsigned int gridSize = 8;\n  unsigned int counter = 0;\n  unsigned int ptIdx = 0;\n  // Create a 5x5 grid of points\n  for (unsigned int j = 0; j < gridSize; j++)\n  {\n    for (unsigned int i = 0; i < gridSize; i++)\n    {\n      if (i == 3 && j == 3) // Make one point higher than the rest\n      {\n        points->InsertNextPoint(i, j, 2);\n        std::cout << \"The different point is number \" << counter << std::endl;\n        ptIdx = counter;\n      }\n      else\n      {\n        // Make most of the points the same height\n        points->InsertNextPoint(i, j, 0);\n      }\n      counter++;\n    }\n  }\n\n  // Specify the dimensions of the grid, set the points and blank one point.\n  structuredGrid->SetDimensions(gridSize, gridSize, 1);\n  structuredGrid->SetPoints(points);\n  structuredGrid->BlankPoint(ptIdx);\n  structuredGrid->Modified();\n\n  // Check.\n  auto isVisible = [&structuredGrid](int const& ptNum) {\n    if (structuredGrid->IsPointVisible(ptNum))\n    {\n      std::cout << \"Point: \" << ptNum << \" is visible\" << std::endl;\n    }\n    else\n    {\n      std::cout << \"Point: \" << ptNum << \" is not visible\" << std::endl;\n    }\n  };\n\n  // Should not be visible.\n  isVisible(ptIdx);\n  // Should be visible.\n  isVisible(7);\n\n  // We need the geometry filter to ensure that the\n  // blanked point and surrounding faces is missing.\n  vtkNew<vtkStructuredGridGeometryFilter>geometryFilter;\n  geometryFilter->SetInputData(structuredGrid);\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> gridMapper;\n  // gridMapper->SetInputData(structuredGrid);\n  gridMapper->SetInputConnection(geometryFilter->GetOutputPort());\n\n\n  vtkNew<vtkActor> gridActor;\n  gridActor->SetMapper(gridMapper);\n  gridActor->GetProperty()->EdgeVisibilityOn();\n  gridActor->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Blue\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BlankPoint\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(gridActor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/StructuredGrid/BlankPoint/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BlankPoint)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BlankPoint: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BlankPoint MACOSX_BUNDLE BlankPoint.cxx )\n  target_link_libraries(BlankPoint PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BlankPoint\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/StructuredGrid/BlankPoint/#download-and-build-blankpoint","title":"Download and Build BlankPoint","text":"

        Click here to download BlankPoint and its CMakeLists.txt file. Once the tarball BlankPoint.tar has been downloaded and extracted,

        cd BlankPoint/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BlankPoint\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/StructuredGrid/GetLinearPointId/","title":"GetLinearPointId","text":"

        vtk-examples/Cxx/StructuredGrid/GetLinearPointId

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/StructuredGrid/GetLinearPointId/#code","title":"Code","text":"

        GetLinearPointId.cxx

        #include <vtkNew.h>\n#include <vtkStructuredData.h>\n#include <vtkStructuredGrid.h>\n\nint main(int, char*[])\n{\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  // Set the dimensions of the grid\n  {\n    int dims[3] = {5, 10, 1};\n    structuredGrid->SetDimensions(dims);\n  }\n\n  // Retrieve the dimensions of the grid\n  int dimensions[3];\n  structuredGrid->GetDimensions(dimensions);\n\n  {\n    int queryPoint[3] = {4, 0, 0};\n    vtkIdType pointId =\n        vtkStructuredData::ComputePointId(dimensions, queryPoint);\n\n    std::cout << \"PointId: \" << pointId << std::endl; // Outputs '4'\n  }\n\n  {\n    int queryPoint[3] = {0, 1, 0};\n    vtkIdType pointId =\n        vtkStructuredData::ComputePointId(dimensions, queryPoint);\n\n    std::cout << \"PointId: \" << pointId << std::endl; // Outputs '5'\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/StructuredGrid/GetLinearPointId/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetLinearPointId)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetLinearPointId: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetLinearPointId MACOSX_BUNDLE GetLinearPointId.cxx )\n  target_link_libraries(GetLinearPointId PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetLinearPointId\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/StructuredGrid/GetLinearPointId/#download-and-build-getlinearpointid","title":"Download and Build GetLinearPointId","text":"

        Click here to download GetLinearPointId and its CMakeLists.txt file. Once the tarball GetLinearPointId.tar has been downloaded and extracted,

        cd GetLinearPointId/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GetLinearPointId\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/StructuredGrid/SGrid/","title":"SGrid","text":"

        vtk-examples/Cxx/StructuredGrid/SGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/StructuredGrid/SGrid/#description","title":"Description","text":"

        Creating a structured grid dataset of a semicylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction.

        Info

        See Figure 5-19 in Chapter 5 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/StructuredGrid/SGrid/#code","title":"Code","text":"

        SGrid.cxx

        // This example shows how to manually create a structured grid.\n// The basic idea is to instantiate vtkStructuredGrid, set its dimensions,\n// and then assign points defining the grid coordinate. The number of\n// points must equal the number of points implicit in the dimensions\n// (i.e., dimX*dimY*dimZ). Also, data attributes (either point or cell)\n// can be added to the dataset.\n//\n//\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDoubleArray.h>\n#include <vtkHedgeHog.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n\nint main(int, char*[])\n{\n  double x[3], v[3], rMin = 0.5, rMax = 1.0, deltaRad, deltaZ;\n  double radius, theta;\n  static int dims[3] = {13, 11, 11};\n\n  // Create the structured grid.\n  vtkNew<vtkStructuredGrid> sgrid;\n  sgrid->SetDimensions(dims);\n\n  // We also create the points and vectors. The points\n  // form a hemi-cylinder of data.\n  vtkNew<vtkDoubleArray> vectors;\n  vectors->SetNumberOfComponents(3);\n  vectors->SetNumberOfTuples(dims[0] * dims[1] * dims[2]);\n  vtkNew<vtkPoints> points;\n  points->Allocate(dims[0] * dims[1] * dims[2]);\n\n  deltaZ = 2.0 / (dims[2] - 1);\n  deltaRad = (rMax - rMin) / (dims[1] - 1);\n  v[2] = 0.0;\n  for (auto k = 0; k < dims[2]; k++)\n  {\n    x[2] = -1.0 + k * deltaZ;\n    auto kOffset = k * dims[0] * dims[1];\n    for (auto j = 0; j < dims[1]; j++)\n    {\n      radius = rMin + j * deltaRad;\n      auto jOffset = j * dims[0];\n      for (auto i = 0; i < dims[0]; i++)\n      {\n        theta = i * vtkMath::RadiansFromDegrees(15.0);\n        x[0] = radius * cos(theta);\n        x[1] = radius * sin(theta);\n        v[0] = -x[1];\n        v[1] = x[0];\n        auto offset = i + jOffset + kOffset;\n        points->InsertPoint(offset, x);\n        vectors->InsertTuple(offset, v);\n      }\n    }\n  }\n  sgrid->SetPoints(points);\n  sgrid->GetPointData()->SetVectors(vectors);\n\n  // We create a simple pipeline to display the data.\n  vtkNew<vtkHedgeHog> hedgehog;\n  hedgehog->SetInputData(sgrid);\n  hedgehog->SetScaleFactor(0.1);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> sgridMapper;\n  sgridMapper->SetInputConnection(hedgehog->GetOutputPort());\n  vtkNew<vtkActor> sgridActor;\n  sgridActor->SetMapper(sgridMapper);\n  sgridActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create the usual rendering stuff\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"SGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(sgridActor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renWin->SetSize(640, 480);\n\n  // interact with data\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/StructuredGrid/SGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SGrid MACOSX_BUNDLE SGrid.cxx )\n  target_link_libraries(SGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/StructuredGrid/SGrid/#download-and-build-sgrid","title":"Download and Build SGrid","text":"

        Click here to download SGrid and its CMakeLists.txt file. Once the tarball SGrid.tar has been downloaded and extracted,

        cd SGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/StructuredGrid/StructuredGrid/","title":"StructuredGrid","text":"

        vtk-examples/Cxx/StructuredGrid/StructuredGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/StructuredGrid/StructuredGrid/#description","title":"Description","text":"

        This example reads and writes points into a structured grid.

        The structured grid is colored by point data. However there is an option to color by cell data.

        Demonstration code is also provided to list cells and their Ids along with listing point Ids shared between cells.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/StructuredGrid/StructuredGrid/#code","title":"Code","text":"

        StructuredGrid.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellIterator.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n\n#include <iterator>\n#include <map>\n#include <set>\n\n#define USE_POINT_DATA\n// Uncomment the next line if you want to use cell data instead\n// #undef USE_POINT_DATA\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  size_t nx = 2, ny = 3, nz = 2;\n  auto dataSize = nx * ny * nz;\n\n  vtkNew<vtkDoubleArray> pointValues;\n  pointValues->SetNumberOfComponents(1);\n  pointValues->SetNumberOfTuples(dataSize);\n  for (size_t i = 0; i < dataSize; ++i)\n  {\n    pointValues->SetValue(i, i);\n  }\n\n  auto numberOfCells = (nx - 1) * (ny - 1) * (nz - 1);\n  vtkNew<vtkDoubleArray> cellValues;\n  cellValues->SetNumberOfTuples(numberOfCells);\n  for (size_t i = 0; i < numberOfCells; ++i)\n  {\n    cellValues->SetValue(i, i);\n  }\n\n  vtkNew<vtkPoints> points;\n  auto x = 0.0;\n  auto y = 0.0;\n  auto z = 0.0;\n  for (unsigned int k = 0; k < nz; k++)\n  {\n    z += 2.0;\n    for (unsigned int j = 0; j < ny; j++)\n    {\n      y += 1.0;\n      for (unsigned int i = 0; i < nx; i++)\n      {\n        x += .5;\n        points->InsertNextPoint(x, y, z);\n      }\n    }\n  }\n\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n  // Specify the dimensions of the grid\n  structuredGrid->SetDimensions(static_cast<int>(nx), static_cast<int>(ny),\n                                static_cast<int>(nz));\n  structuredGrid->SetPoints(points);\n  structuredGrid->GetCellData()->SetScalars(cellValues);\n  structuredGrid->GetPointData()->SetScalars(pointValues);\n\n  // The key is the cell Id and the value is a set of corresponding point Ids.\n  std::map<vtkIdType, std::set<vtkIdType>> cellPointIds;\n  vtkCellIterator* it = structuredGrid->NewCellIterator();\n  for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n  {\n    vtkIdList* pointIds = it->GetPointIds();\n    std::set<vtkIdType> ptIds;\n    for (vtkIdType* id = pointIds->begin(); id != pointIds->end(); ++id)\n    {\n      ptIds.insert(*id);\n    }\n    cellPointIds[it->GetCellId()] = ptIds;\n  }\n  it->Delete();\n\n  std::cout << \"Cells and their points\" << std::endl;\n  for (auto const& cell : cellPointIds)\n  {\n    std::cout << \"Cell Id: \" << cell.first << \" Point Ids: \";\n    for (auto id = cell.second.begin(); id != cell.second.end(); ++id)\n      if (id != std::prev(cell.second.end()))\n      {\n        std::cout << *id << \", \";\n      }\n      else\n      {\n        std::cout << *id << std::endl;\n      }\n  }\n\n  // The key is the point Id and the value is a set of corresponding cell Ids.\n  std::map<vtkIdType, std::set<vtkIdType>>\n      commonPointIds; // = cellPointIds.begin()->second;\n  for (auto const& cell : cellPointIds)\n  {\n    for (auto pointId : cell.second)\n    {\n      commonPointIds[pointId].insert(cell.first);\n    }\n  }\n\n  std::cout << \"Point Ids shared between cells\" << std::endl;\n  for (auto point = commonPointIds.begin(); point != commonPointIds.end();\n       ++point)\n  {\n    if (point->second.size() > 1)\n    {\n      std::cout << \"Point Id: \" << point->first << \" CellIds: \";\n      for (auto cellId = point->second.begin(); cellId != point->second.end();\n           ++cellId)\n      {\n        if (cellId != std::prev(point->second.end()))\n        {\n          std::cout << *cellId << \", \";\n        }\n        else\n        {\n          std::cout << *cellId << std::endl;\n        }\n      }\n    }\n  }\n\n#if defined(USE_POINT_DATA)\n  // Use the point data\n  // Map the scalar values in the image to colors with a lookup table:\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(dataSize);\n  lut->Build();\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(structuredGrid);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, dataSize - 1);\n  mapper->ScalarVisibilityOn();\n#else\n  // Use the cell data\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(numberOfCells);\n  lut->Build();\n  // Assign some specific colors in this case\n  lut->SetTableValue(0, colors->GetColor4d(\"Red\").GetData());\n  lut->SetTableValue(numberOfCells - 1, colors->GetColor4d(\"Banana\").GetData());\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(structuredGrid);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, numberOfCells - 1);\n  // mapper->ScalarVisibilityOff();\n#endif\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Add the actor to the scene\n  ren->AddActor(actor);\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  ren->GetActiveCamera()->Azimuth(60);\n  ren->GetActiveCamera()->Elevation(-45);\n  ren->GetActiveCamera()->Dolly(1.2);\n  ren->ResetCamera();\n\n  // Render and interact\n  renWin->Render();\n  renWin->SetSize(800, 800);\n  renWin->SetWindowName(\"StructuredGrid\");\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/StructuredGrid/StructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredGrid MACOSX_BUNDLE StructuredGrid.cxx )\n  target_link_libraries(StructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/StructuredGrid/StructuredGrid/#download-and-build-structuredgrid","title":"Download and Build StructuredGrid","text":"

        Click here to download StructuredGrid and its CMakeLists.txt file. Once the tarball StructuredGrid.tar has been downloaded and extracted,

        cd StructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/StructuredGrid/StructuredGridOutline/","title":"StructuredGridOutline","text":"

        vtk-examples/Cxx/StructuredGrid/StructuredGridOutline

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/StructuredGrid/StructuredGridOutline/#description","title":"Description","text":"

        Visualize the outline of a structured grid.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/StructuredGrid/StructuredGridOutline/#code","title":"Code","text":"

        StructuredGridOutline.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  vtkNew<vtkPoints> points;\n  unsigned int numi = 2;\n  unsigned int numj = 3;\n  unsigned int numk = 2;\n\n  for (unsigned int k = 0; k < numk; k++)\n  {\n    for (unsigned int j = 0; j < numj; j++)\n    {\n      for (unsigned int i = 0; i < numi; i++)\n      {\n        points->InsertNextPoint(i, j, k);\n      }\n    }\n  }\n\n  // specify the dimensions of the grid\n  structuredGrid->SetDimensions(numi, numj, numk);\n  structuredGrid->SetPoints(points);\n\n  std::cout << \"There are \" << structuredGrid->GetNumberOfPoints() << \" points.\"\n            << std::endl;\n  std::cout << \"There are \" << structuredGrid->GetNumberOfCells() << \" cells.\"\n            << std::endl;\n\n  vtkNew<vtkStructuredGridOutlineFilter> outlineFilter;\n  outlineFilter->SetInputData(structuredGrid);\n  outlineFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(outlineFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"StructuredGridOutline\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/StructuredGrid/StructuredGridOutline/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredGridOutline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredGridOutline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredGridOutline MACOSX_BUNDLE StructuredGridOutline.cxx )\n  target_link_libraries(StructuredGridOutline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredGridOutline\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/StructuredGrid/StructuredGridOutline/#download-and-build-structuredgridoutline","title":"Download and Build StructuredGridOutline","text":"

        Click here to download StructuredGridOutline and its CMakeLists.txt file. Once the tarball StructuredGridOutline.tar has been downloaded and extracted,

        cd StructuredGridOutline/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StructuredGridOutline\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/StructuredGrid/VisualizeStructuredGrid/","title":"VisualizeStructuredGrid","text":"

        vtk-examples/Cxx/StructuredGrid/VisualizeStructuredGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/StructuredGrid/VisualizeStructuredGrid/#description","title":"Description","text":"

        Visualize the points of a structured grid.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/StructuredGrid/VisualizeStructuredGrid/#code","title":"Code","text":"

        VisualizeStructuredGrid.cxx

        #include <vtkActor.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  vtkNew<vtkPoints> points;\n  unsigned int numi = 2;\n  unsigned int numj = 3;\n  unsigned int numk = 2;\n\n  for (unsigned int k = 0; k < numk; k++)\n  {\n    for (unsigned int j = 0; j < numj; j++)\n    {\n      for (unsigned int i = 0; i < numi; i++)\n      {\n        points->InsertNextPoint(i, j, k);\n      }\n    }\n  }\n\n  // Specify the dimensions of the grid\n  structuredGrid->SetDimensions(numi, numj, numk);\n  structuredGrid->SetPoints(points);\n\n  std::cout << \"There are \" << structuredGrid->GetNumberOfPoints() << \" points.\"\n            << std::endl; // there should be 2*3*2 = 12 points\n  std::cout << \"There are \" << structuredGrid->GetNumberOfCells() << \" cells.\"\n            << std::endl; // The 12 points define the corners of 2 cubes/cells\n                          // (4 points are shared by both cubes)\n\n  vtkNew<vtkStructuredGridGeometryFilter> geometryFilter;\n  geometryFilter->SetInputData(structuredGrid);\n  geometryFilter->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(geometryFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(1);\n\n  // Visualize\n\n  // Map the points to spheres\n  auto sphereActor =\n      PointToGlyph(geometryFilter->GetOutput()->GetPoints(), 0.02);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VisualizeStructuredGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(sphereActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
        "},{"location":"Cxx/StructuredGrid/VisualizeStructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeStructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeStructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeStructuredGrid MACOSX_BUNDLE VisualizeStructuredGrid.cxx )\n  target_link_libraries(VisualizeStructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeStructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/StructuredGrid/VisualizeStructuredGrid/#download-and-build-visualizestructuredgrid","title":"Download and Build VisualizeStructuredGrid","text":"

        Click here to download VisualizeStructuredGrid and its CMakeLists.txt file. Once the tarball VisualizeStructuredGrid.tar has been downloaded and extracted,

        cd VisualizeStructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VisualizeStructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/StructuredGrid/VisualizeStructuredGridCells/","title":"VisualizeStructuredGridCells","text":"

        vtk-examples/Cxx/StructuredGrid/VisualizeStructuredGridCells

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/StructuredGrid/VisualizeStructuredGridCells/#code","title":"Code","text":"

        VisualizeStructuredGridCells.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkStructuredGrid.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a grid\n  vtkNew<vtkStructuredGrid> structuredGrid;\n\n  vtkNew<vtkPoints> points;\n  unsigned int numi = 3;\n  unsigned int numj = 4;\n  unsigned int numk = 5;\n\n  for (unsigned int k = 0; k < numk; k++)\n  {\n    for (unsigned int j = 0; j < numj; j++)\n    {\n      for (unsigned int i = 0; i < numi; i++)\n      {\n        points->InsertNextPoint(i, j, k);\n      }\n    }\n  }\n\n  // Specify the dimensions of the grid\n  structuredGrid->SetDimensions(numi, numj, numk);\n  structuredGrid->SetPoints(points);\n\n  std::cout << \"There are \" << structuredGrid->GetNumberOfPoints()\n            << \" points before shrinking.\" << std::endl;\n  std::cout << \"There are \" << structuredGrid->GetNumberOfCells()\n            << \" cells before shrinking.\" << std::endl;\n\n  vtkNew<vtkShrinkFilter> shrinkFilter;\n  shrinkFilter->SetInputData(structuredGrid);\n  shrinkFilter->SetShrinkFactor(.8);\n  shrinkFilter->Update();\n\n  std::cout << \"There are \" << shrinkFilter->GetOutput()->GetNumberOfPoints()\n            << \" points after shrinking.\" << std::endl;\n  std::cout << \"There are \" << shrinkFilter->GetOutput()->GetNumberOfCells()\n            << \" cells after shrinking.\" << std::endl;\n\n  // Note: there are more points after shrinking because cells no longer share\n  // points.\n\n  // Create a mapper and actor\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(shrinkFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VisualizeStructuredGridCells\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(9.56681, 4.14093, 5.85709);\n  camera->SetFocalPoint(1, 1.5, 2);\n  camera->SetViewUp(-0.172781, 0.94846, -0.26565);\n  camera->SetDistance(9.7592);\n  camera->SetClippingRange(5.84116, 14.7147);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/StructuredGrid/VisualizeStructuredGridCells/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeStructuredGridCells)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeStructuredGridCells: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeStructuredGridCells MACOSX_BUNDLE VisualizeStructuredGridCells.cxx )\n  target_link_libraries(VisualizeStructuredGridCells PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeStructuredGridCells\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/StructuredGrid/VisualizeStructuredGridCells/#download-and-build-visualizestructuredgridcells","title":"Download and Build VisualizeStructuredGridCells","text":"

        Click here to download VisualizeStructuredGridCells and its CMakeLists.txt file. Once the tarball VisualizeStructuredGridCells.tar has been downloaded and extracted,

        cd VisualizeStructuredGridCells/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VisualizeStructuredGridCells\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid/","title":"StructuredPointsToUnstructuredGrid","text":"

        vtk-examples/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid/#code","title":"Code","text":"

        StructuredPointsToUnstructuredGrid.cxx

        #include <vtkNew.h>\n#include <vtkStructuredPoints.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridWriter.h>\n\nint main(int, char*[])\n{\n  // Create a structuredpoints\n  vtkNew<vtkStructuredPoints> structuredPoints;\n\n  // Specify the size of the image data\n  structuredPoints->SetDimensions(2, 3, 1);\n  structuredPoints->AllocateScalars(VTK_DOUBLE, 1);\n\n  int* dims = structuredPoints->GetDimensions();\n\n  std::cout << \"Dims: \"\n            << \" x: \" << dims[0] << \" y: \" << dims[1] << \" z: \" << dims[2]\n            << std::endl;\n\n  std::cout << \"Number of points: \" << structuredPoints->GetNumberOfPoints()\n            << std::endl;\n  std::cout << \"Number of cells: \" << structuredPoints->GetNumberOfCells()\n            << std::endl;\n\n  // fill every entry of the image data with \"2.0\"\n  for (int z = 0; z < dims[2]; z++)\n  {\n    for (int y = 0; y < dims[1]; y++)\n    {\n      for (int x = 0; x < dims[0]; x++)\n      {\n        double* pixel =\n            static_cast<double*>(structuredPoints->GetScalarPointer(x, y, z));\n        pixel[0] = 2.0;\n      }\n    }\n  }\n\n  // Copy the points from the StructuredPoints to the UnstructuredGrid\n  vtkNew<vtkPoints> points;\n\n  // retrieve the entries from the grid and print them to the screen\n  for (vtkIdType i = 0; i < structuredPoints->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    structuredPoints->GetPoint(i, p);\n\n    points->InsertNextPoint(p);\n  }\n\n  vtkNew<vtkUnstructuredGrid> ug;\n  ug->SetPoints(points);\n\n  vtkNew<vtkXMLUnstructuredGridWriter> writer;\n  writer->SetFileName(\"output.vtu\");\n  writer->SetInputData(ug);\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredPointsToUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredPointsToUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredPointsToUnstructuredGrid MACOSX_BUNDLE StructuredPointsToUnstructuredGrid.cxx )\n  target_link_libraries(StructuredPointsToUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredPointsToUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid/#download-and-build-structuredpointstounstructuredgrid","title":"Download and Build StructuredPointsToUnstructuredGrid","text":"

        Click here to download StructuredPointsToUnstructuredGrid and its CMakeLists.txt file. Once the tarball StructuredPointsToUnstructuredGrid.tar has been downloaded and extracted,

        cd StructuredPointsToUnstructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StructuredPointsToUnstructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/StructuredPoints/Vol/","title":"Vol","text":"

        vtk-examples/Cxx/StructuredPoints/Vol

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/StructuredPoints/Vol/#description","title":"Description","text":"

        Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26^3.

        Info

        See Figure 5-18 in Chapter 5 the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/StructuredPoints/Vol/#code","title":"Code","text":"

        Vol.cxx

        #include <vtkActor.h>\n#include <vtkContourFilter.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPoints.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkStructuredPoints> vol;\n  vol->SetDimensions(26, 26, 26);\n  vol->SetOrigin(-0.5, -0.5, -0.5);\n  auto sp = 1.0 / 25.0;\n  vol->SetSpacing(sp, sp, sp);\n\n  vtkNew<vtkDoubleArray> scalars;\n  scalars->SetNumberOfComponents(1);\n  scalars->SetNumberOfTuples(26 * 26 * 26);\n  for (auto k = 0; k < 26; k++)\n  {\n    auto z = -0.5 + k * sp;\n    auto kOffset = k * 26 * 26;\n    for (auto j = 0; j < 26; j++)\n    {\n      auto y = -0.5 + j * sp;\n      auto jOffset = j * 26;\n      for (auto i = 0; i < 26; i++)\n      {\n        auto x = -0.5 + i * sp;\n        auto s = x * x + y * y + z * z - (0.4 * 0.4);\n        auto offset = i + jOffset + kOffset;\n        scalars->InsertTuple(offset, &s);\n      }\n    }\n  }\n  vol->GetPointData()->SetScalars(scalars);\n\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputData(vol);\n  contour->SetValue(0, 0.0);\n\n  vtkNew<vtkPolyDataMapper> volMapper;\n  volMapper->SetInputConnection(contour->GetOutputPort());\n  volMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> volActor;\n  volActor->SetMapper(volMapper);\n  volActor->GetProperty()->EdgeVisibilityOn();\n  volActor->GetProperty()->SetColor(colors->GetColor3d(\"Salmon\").GetData());\n  renderer->AddActor(volActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"Vol\");\n\n  // interact with data\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/StructuredPoints/Vol/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Vol)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Vol: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Vol MACOSX_BUNDLE Vol.cxx )\n  target_link_libraries(Vol PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Vol\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/StructuredPoints/Vol/#download-and-build-vol","title":"Download and Build Vol","text":"

        Click here to download Vol and its CMakeLists.txt file. Once the tarball Vol.tar has been downloaded and extracted,

        cd Vol/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Vol\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Texture/AnimateVectors/","title":"AnimateVectors","text":"

        vtk-examples/Cxx/Texture/AnimateVectors

        "},{"location":"Cxx/Texture/AnimateVectors/#description","title":"Description","text":"

        Texture maps can be animated as a function of time. By choosing a texture map whose intensity varies monotonically from dark to light, and then \u201cmoving\u201d the texture along an object,the object appears to crawl in the direction of the texture map motion. We can use this technique to add apparent motion to things like hedgehogs to show vector magnitude. This example uses texture map animation to simulate vector field motion.

        Cite

        See B. Yamrom and K. M. Martin. Vector Field Animation with Texture Maps. IEEE Computer Graphics and Applications. 15(2):22\u201324, 1995 for background.

        Info

        See Figure 7-3 in Chapter 7 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Texture/AnimateVectors/#code","title":"Code","text":"

        AnimateVectors.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkTexture.h>\n#include <vtkThresholdPoints.h>\n\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" carotid.vtk vecAnim1.vtk ...\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // read data\n  //\n  // create pipeline\n  //\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkThresholdPoints> threshold;\n  threshold->SetInputConnection(reader->GetOutputPort());\n  threshold->ThresholdByUpper(200);\n\n  vtkNew<vtkLineSource> line;\n  line->SetResolution(1);\n\n  vtkNew<vtkGlyph3D> lines;\n  lines->SetInputConnection(threshold->GetOutputPort());\n  lines->SetSourceConnection(line->GetOutputPort());\n  lines->SetScaleFactor(0.005);\n  lines->SetScaleModeToScaleByScalar();\n  lines->Update();\n\n  vtkNew<vtkPolyDataMapper> vectorMapper;\n  vectorMapper->SetInputConnection(lines->GetOutputPort());\n  vectorMapper->SetScalarRange(lines->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> vectorActor;\n  vectorActor->SetMapper(vectorMapper);\n  vectorActor->GetProperty()->SetOpacity(0.99);\n  vectorActor->GetProperty()->SetLineWidth(1.5);\n\n  // outline\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  //  texture maps\n  std::vector<vtkSmartPointer<vtkTexture>> textureMaps;\n  for (int i = 2; i < argc; ++i)\n  {\n    vtkNew<vtkStructuredPointsReader> tmap;\n    tmap->SetFileName(argv[i]);\n\n    vtkNew<vtkTexture> texture;\n    texture->SetInputConnection(tmap->GetOutputPort());\n    texture->InterpolateOff();\n    texture->RepeatOff();\n    textureMaps.push_back(texture);\n  }\n  vectorActor->SetTexture(textureMaps[0]);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer->AddActor(vectorActor);\n  renderer->AddActor(outlineActor);\n\n  vtkNew<vtkCamera> cam1;\n  cam1->SetClippingRange(17.4043, 870.216);\n  cam1->SetFocalPoint(136.71, 104.025, 23);\n  cam1->SetPosition(204.747, 258.939, 63.7925);\n  cam1->SetViewUp(-0.102647, -0.210897, 0.972104);\n  cam1->Zoom(1.2);\n  renderer->SetActiveCamera(cam1);\n\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"AnimateVectors\");\n\n  // go into loop\n  for (int j = 0; j < 100; ++j)\n  {\n    for (size_t i = 0; i < textureMaps.size(); ++i)\n    {\n      vectorActor->SetTexture(textureMaps[i]);\n      renderWindow->Render();\n    }\n  }\n  interactor->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Texture/AnimateVectors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AnimateVectors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AnimateVectors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AnimateVectors MACOSX_BUNDLE AnimateVectors.cxx )\n  target_link_libraries(AnimateVectors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AnimateVectors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Texture/AnimateVectors/#download-and-build-animatevectors","title":"Download and Build AnimateVectors","text":"

        Click here to download AnimateVectors and its CMakeLists.txt file. Once the tarball AnimateVectors.tar has been downloaded and extracted,

        cd AnimateVectors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AnimateVectors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Texture/ProjectedTexture/","title":"ProjectedTexture","text":"

        vtk-examples/Cxx/Texture/ProjectedTexture

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Texture/ProjectedTexture/#description","title":"Description","text":"

        vtkProjectedTexture is tricky to set up. Picking the right parameters will take some iterations. The example uses vtkFrustumSource to help understand the parameters.

        Cite

        This example was inspired by Thomas Kilgus, German Cancer Research Center (DKFZ), Div. Medical and Biological Informatics, Junior group: Computer-assisted Interventions (E131), Im Neuenheimer Feld 280, 69120 Heidelberg, Germany

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Texture/ProjectedTexture/#code","title":"Code","text":"

        ProjectedTexture.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFrustumSource.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProjectedTexture.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTexture.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" polydata texture e.g. fran_cut.vtk fran_cut.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> textureFile;\n  textureFile.TakeReference(readerFactory->CreateImageReader2(argv[2]));\n  textureFile->SetFileName(argv[2]);\n  textureFile->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  double center[3];\n  polyData->GetCenter(center);\n  std::cout << \"Center: \" << center[0] << \", \" << center[1] << \", \" << center[2]\n            << std::endl;\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(center[0], center[1] + .0375, center[2] + .5);\n  camera->SetFocalPoint(center[0], center[1] + .0375, center[2]);\n  camera->Azimuth(-45);\n  camera->Roll(-90);\n  camera->SetClippingRange(.5, .6);\n  double planesArray[24];\n\n  camera->GetFrustumPlanes(1.0, planesArray);\n\n  // Settings for vtkProjectedTexture\n\n  double aspect[3];\n  aspect[1] = 1.0;\n  aspect[2] = 1.0;\n  aspect[0] = 1.0;\n  //(1.0/ (vtkMath::RadiansFromDegrees(std::tan(camera->GetViewAngle()))))\n  /// 2.0;\n  std::cout << \"Aspect: \" << aspect[0] << \", \" << aspect[1] << \", \" << aspect[2]\n            << std::endl;\n\n  vtkNew<vtkProjectedTexture> projectedTexture;\n\n  projectedTexture->SetAspectRatio(aspect);\n  projectedTexture->SetPosition(camera->GetPosition());\n  projectedTexture->SetFocalPoint(camera->GetFocalPoint());\n  projectedTexture->SetUp(camera->GetViewUp()[0], camera->GetViewUp()[1],\n                          camera->GetViewUp()[2]);\n\n  projectedTexture->SetInputData(\n      polyData); // This can be the same as the one to project on.\n  projectedTexture->Update();\n\n  // Map Texture on Surface\n  polyData->GetPointData()->SetTCoords(\n      projectedTexture->GetOutput()->GetPointData()->GetTCoords());\n\n  vtkNew<vtkTexture> texture;\n  texture->SetInputData(textureFile->GetOutput());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetTexture(texture);\n\n  vtkNew<vtkPlanes> planes;\n  planes->SetFrustumPlanes(planesArray);\n\n  vtkNew<vtkFrustumSource> frustumSource;\n  frustumSource->ShowLinesOff();\n  frustumSource->SetPlanes(planes);\n  frustumSource->Update();\n\n  vtkNew<vtkPolyDataMapper> frustumMapper;\n  frustumMapper->SetInputConnection(frustumSource->GetOutputPort());\n\n  vtkNew<vtkActor> frustumActor;\n  frustumActor->SetMapper(frustumMapper);\n  frustumActor->GetProperty()->EdgeVisibilityOn();\n  frustumActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  frustumActor->GetProperty()->SetOpacity(.5);\n  frustumActor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->AddActor(frustumActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->SetActiveCamera(camera);\n  camera->Azimuth(180);\n  camera->Roll(-90);\n  renderer->ResetCameraClippingRange();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ProjectedTexture\");\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Texture/ProjectedTexture/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProjectedTexture)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOImage\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProjectedTexture: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProjectedTexture MACOSX_BUNDLE ProjectedTexture.cxx )\n  target_link_libraries(ProjectedTexture PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProjectedTexture\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Texture/ProjectedTexture/#download-and-build-projectedtexture","title":"Download and Build ProjectedTexture","text":"

        Click here to download ProjectedTexture and its CMakeLists.txt file. Once the tarball ProjectedTexture.tar has been downloaded and extracted,

        cd ProjectedTexture/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ProjectedTexture\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Texture/TextureCutQuadric/","title":"TextureCutQuadric","text":"

        vtk-examples/Cxx/Texture/TextureCutQuadric

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Texture/TextureCutQuadric/#description","title":"Description","text":"

        Clip geometry using a 2D texture map and two implicit functions. The technique is described in : Geometric Clipping Using Boolean Textures.

        Info

        See Figure 9-45b in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Texture/TextureCutQuadric/#code","title":"Code","text":"

        TextureCutQuadric.cxx

        #include <vtkActor.h>\n#include <vtkBooleanTexture.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImplicitTextureCoords.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTexture.h>\n\nnamespace {\n\ndouble positions[][3]{{-4, 4, 0},  {-2, 4, 0},  {0, 4, 0},  {2, 4, 0},\n                      {-4, 2, 0},  {-2, 2, 0},  {0, 2, 0},  {2, 2, 0},\n                      {-4, 0, 0},  {-2, 0, 0},  {0, 0, 0},  {2, 0, 0},\n                      {-4, -2, 0}, {-2, -2, 0}, {0, -2, 0}, {2, -2, 0}};\n\nunsigned char solid[]{255, 255};\nunsigned char clear[]{255, 0};\nunsigned char edge[]{0, 255};\n\nvtkSmartPointer<vtkBooleanTexture> MakeBooleanTexture(int, int, int);\n} // namespace\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renWin;\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkRenderer> aren;\n\n  // define two elliptical cylinders\n  vtkNew<vtkQuadric> quadric1;\n  quadric1->SetCoefficients(1, 2, 0, 0, 0, 0, 0, 0, 0, -.07);\n\n  vtkNew<vtkQuadric> quadric2;\n  quadric2->SetCoefficients(2, 1, 0, 0, 0, 0, 0, 0, 0, -.07);\n\n  // create a sphere for all to use\n  vtkNew<vtkSphereSource> aSphere;\n  aSphere->SetPhiResolution(21);\n  aSphere->SetThetaResolution(21);\n\n  // create texture coordinates for all\n  vtkNew<vtkImplicitTextureCoords> tcoords;\n  tcoords->SetInputConnection(aSphere->GetOutputPort());\n  tcoords->SetRFunction(quadric1);\n  tcoords->SetSFunction(quadric2);\n\n  vtkNew<vtkDataSetMapper> aMapper;\n  aMapper->SetInputConnection(tcoords->GetOutputPort());\n\n  // create a mapper, sphere and texture map for each case\n  for (int i = 0; i < 16; i++)\n  {\n    auto aBoolean = MakeBooleanTexture(i, 64, 0);\n\n    vtkNew<vtkTexture> aTexture2;\n    aTexture2->SetInputConnection(aBoolean->GetOutputPort());\n    aTexture2->InterpolateOff();\n    aTexture2->RepeatOff();\n\n    vtkNew<vtkActor> anActor2;\n\n    anActor2->SetMapper(aMapper);\n    anActor2->SetTexture(aTexture2);\n    anActor2->SetPosition(&positions[i][0]);\n    anActor2->SetScale(2.0, 2.0, 2.0);\n    anActor2->GetProperty()->SetColor(\n        colors->GetColor3d(\"MistyRose\").GetData());\n\n    aren->AddActor(anActor2);\n  }\n\n  aren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(500, 500);\n  renWin->AddRenderer(aren);\n  renWin->SetWindowName(\"TextureCutQuadric\");\n\n  // interact with data\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkBooleanTexture>\nMakeBooleanTexture(int caseNumber, int resolution, int thickness)\n{\n  vtkNew<vtkBooleanTexture> booleanTexture;\n\n  booleanTexture->SetXSize(resolution);\n  booleanTexture->SetYSize(resolution);\n  booleanTexture->SetThickness(thickness);\n\n  switch (caseNumber)\n  {\n  case 0:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(solid);\n    booleanTexture->SetOnIn(solid);\n    booleanTexture->SetOnOut(solid);\n    booleanTexture->SetInOn(solid);\n    booleanTexture->SetOutOn(solid);\n    break;\n  case 1: /* cut inside 1 */\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(solid);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(solid);\n    break;\n  case 2: /* cut outside 1 */\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(solid);\n    booleanTexture->SetInOn(solid);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 3: /* cut all 1 */\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(clear);\n    booleanTexture->SetOnOut(solid);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 4:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(solid);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(solid);\n    break;\n  case 5:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(clear);\n    booleanTexture->SetOutOn(solid);\n    break;\n  case 6:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 7:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutOut(solid);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(clear);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(clear);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 8:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(solid);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(solid);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 9:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 10:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(solid);\n    booleanTexture->SetOutOn(clear);\n    break;\n  case 11:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetInOut(solid);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(clear);\n    booleanTexture->SetOnOut(edge);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(clear);\n    break;\n  case 12:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(solid);\n    booleanTexture->SetOnOut(clear);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 13:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutIn(solid);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(clear);\n    booleanTexture->SetInOn(clear);\n    booleanTexture->SetOutOn(edge);\n    break;\n  case 14:\n    booleanTexture->SetInIn(solid);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(edge);\n    booleanTexture->SetOnIn(edge);\n    booleanTexture->SetOnOut(clear);\n    booleanTexture->SetInOn(edge);\n    booleanTexture->SetOutOn(clear);\n    break;\n  case 15:\n    booleanTexture->SetInIn(clear);\n    booleanTexture->SetInOut(clear);\n    booleanTexture->SetOutIn(clear);\n    booleanTexture->SetOutOut(clear);\n    booleanTexture->SetOnOn(clear);\n    booleanTexture->SetOnIn(clear);\n    booleanTexture->SetOnOut(clear);\n    booleanTexture->SetInOn(clear);\n    booleanTexture->SetOutOn(clear);\n    break;\n  }\n\n  return booleanTexture;\n}\n} // namespace\n
        "},{"location":"Cxx/Texture/TextureCutQuadric/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureCutQuadric)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  FiltersTexture\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureCutQuadric: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureCutQuadric MACOSX_BUNDLE TextureCutQuadric.cxx )\n  target_link_libraries(TextureCutQuadric PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureCutQuadric\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Texture/TextureCutQuadric/#download-and-build-texturecutquadric","title":"Download and Build TextureCutQuadric","text":"

        Click here to download TextureCutQuadric and its CMakeLists.txt file. Once the tarball TextureCutQuadric.tar has been downloaded and extracted,

        cd TextureCutQuadric/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TextureCutQuadric\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Texture/TextureCutSphere/","title":"TextureCutSphere","text":"

        vtk-examples/Cxx/Texture/TextureCutSphere

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Texture/TextureCutSphere/#description","title":"Description","text":"

        Sphere cut with transparent texture.

        Info

        See Figure 9-43b in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Texture/TextureCutSphere/#code","title":"Code","text":"

        TextureCutSphere.cxx

        //\n// Cut an outer sphere to reveal an inner sphere.\n//\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkImplicitTextureCoords.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkTexture.h>\n\nint main(int /* argc */, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Hidden sphere.\n  vtkNew<vtkSphereSource> sphere1;\n  sphere1->SetRadius(0.5);\n\n  vtkNew<vtkPolyDataMapper> innerMapper;\n  innerMapper->SetInputConnection(sphere1->GetOutputPort());\n\n  vtkNew<vtkActor> innerSphere;\n  innerSphere->SetMapper(innerMapper);\n  innerSphere->GetProperty()->SetColor(\n      colors->GetColor3d(\"BlanchedAlmond\").GetData());\n\n  // Sphere to texture.\n  vtkNew<vtkSphereSource> sphere2;\n  sphere2->SetRadius(1.0);\n  sphere2->SetPhiResolution(21);\n  sphere2->SetThetaResolution(21);\n\n  vtkNew<vtkPlanes> planes;\n\n  double pts[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(2);\n  points->SetPoint(0, pts);\n  points->SetPoint(1, pts + 3);\n\n  double nrms[6] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0};\n  vtkNew<vtkDoubleArray> normals;\n  normals->SetNumberOfComponents(3);\n  normals->SetNumberOfTuples(2);\n  normals->SetTuple(0, nrms);\n  normals->SetTuple(1, nrms + 3);\n\n  planes->SetPoints(points);\n  planes->SetNormals(normals);\n\n  vtkNew<vtkImplicitTextureCoords> tcoords;\n  tcoords->SetInputConnection(sphere2->GetOutputPort());\n  tcoords->SetRFunction(planes);\n\n  vtkNew<vtkDataSetMapper> outerMapper;\n  outerMapper->SetInputConnection(tcoords->GetOutputPort());\n\n  vtkNew<vtkStructuredPointsReader> tmap;\n  tmap->SetFileName(argv[1]);\n\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(tmap->GetOutputPort());\n  texture->InterpolateOff();\n  texture->RepeatOff();\n\n  vtkNew<vtkActor> outerSphere;\n  outerSphere->SetMapper(outerMapper);\n  outerSphere->SetTexture(texture);\n  outerSphere->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightSalmon\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkRenderer> aren;\n  iren->SetRenderWindow(renWin);\n  renWin->AddRenderer(aren);\n\n  aren->AddActor(innerSphere);\n  aren->AddActor(outerSphere);\n  aren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  aren->GetActiveCamera()->Azimuth(-30);\n  aren->GetActiveCamera()->Elevation(-30);\n  aren->ResetCamera();\n\n  renWin->SetSize(500, 500);\n  renWin->SetWindowName(\"TextureCutSphere\");\n\n  // Interact with the data.\n  renWin->Render();\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Texture/TextureCutSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureCutSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  FiltersTexture\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureCutSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureCutSphere MACOSX_BUNDLE TextureCutSphere.cxx )\n  target_link_libraries(TextureCutSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureCutSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Texture/TextureCutSphere/#download-and-build-texturecutsphere","title":"Download and Build TextureCutSphere","text":"

        Click here to download TextureCutSphere and its CMakeLists.txt file. Once the tarball TextureCutSphere.tar has been downloaded and extracted,

        cd TextureCutSphere/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TextureCutSphere\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Texture/TexturePlane/","title":"TexturePlane","text":"

        vtk-examples/Cxx/Texture/TexturePlane

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Texture/TexturePlane/#description","title":"Description","text":"

        Simple example of texture mapping.

        Info

        See Figure 7-33 in Chapter 7 in the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Texture/TexturePlane/#code","title":"Code","text":"

        TexturePlane.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n//\n// This simple example shows how to do basic texture mapping.\n//\n//\n// Load in the texture map. A texture is any unsigned char image. If it\n// is not of this type, you will have to map it through a lookup table\n// or by using vtkImageShiftScale.\n//\nint main(int argc, char* argv[])\n{\n  // Verify input arguments\n  if (argc != 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> textureFile;\n  textureFile.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  textureFile->SetFileName(argv[1]);\n  textureFile->Update();\n\n  vtkNew<vtkTexture> atext;\n  atext->SetInputConnection(textureFile->GetOutputPort());\n  atext->InterpolateOn();\n\n  // Create a plane source and actor. The vtkPlanesSource generates\n  // texture coordinates.\n  //\n  vtkNew<vtkPlaneSource> plane;\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(plane->GetOutputPort());\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n  planeActor->SetTexture(atext);\n\n  // Create the RenderWindow, Renderer and both Actors\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(planeActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"TexturePlane\");\n\n  // render the image\n  renWin->Render();\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(-30);\n  renderer->GetActiveCamera()->Roll(-20);\n  renderer->ResetCameraClippingRange();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Texture/TexturePlane/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TexturePlane)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TexturePlane: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TexturePlane MACOSX_BUNDLE TexturePlane.cxx )\n  target_link_libraries(TexturePlane PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TexturePlane\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Texture/TexturePlane/#download-and-build-textureplane","title":"Download and Build TexturePlane","text":"

        Click here to download TexturePlane and its CMakeLists.txt file. Once the tarball TexturePlane.tar has been downloaded and extracted,

        cd TexturePlane/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TexturePlane\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Texture/TextureThreshold/","title":"TextureThreshold","text":"

        vtk-examples/Cxx/Texture/TextureThreshold

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Texture/TextureThreshold/#description","title":"Description","text":"

        Demonstrating texture thresholding applied to scalar data from a simulation of fluid flow.

        There are three planes cutting the blunt fin with different thresholds set. From the left, the scalar threshold is set so that:

        1. Only data with a scalar value greater than or equal to 1.5 is shown.
        2. Only data with a scalar value less than or equal to 1.5 is shown.
        3. Only data with a scalar value between 1.5 and 1.8 inclusive is shown.

        Info

        See Figure 9-43a in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Texture/TextureThreshold/#code","title":"Code","text":"

        TextureThreshold.cxx

        /*\nModified from VTK/Filters/Texture/Testing/Python/textureThreshold.py.\n\nDemonstrating texture thresholding applied to scalar data from a simulation of\nfluid flow->\n    There are three planes cutting the blunt fin with different thresholds set.\n     From the left, the scalar threshold is set so that:\n       1) Only data with a scalar value greater than or equal to 1.5 is shown.\n       2) Only data with a scalar value less than or equal to 1.5 is shown.\n*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkTexture.h>\n#include <vtkThresholdTextureCoords.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 4)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename1 filename2 filename3\"\n              << std::endl;\n    std::cout << \"where: filename1 is bluntfinxyz.bin,\\n\"\n              << \"       filename2 is bluntfinq.bin and\\n\"\n              << \"       filename3 is texThres2.vtk.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string dataFn1 = argv[1];\n  std::string dataFn2 = argv[2];\n  std::string textureFn = argv[3];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the data.\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(dataFn1.c_str());\n  pl3d->SetQFileName(dataFn2.c_str());\n  pl3d->SetScalarFunctionNumber(100); // Density\n  pl3d->SetVectorFunctionNumber(202); // Momentum\n  pl3d->Update();\n\n  vtkStructuredGrid* output =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // Make the wall (floor).\n  vtkNew<vtkStructuredGridGeometryFilter> wall;\n  wall->SetInputData(output);\n  wall->SetExtent(0, 100, 0, 0, 0, 100);\n  vtkNew<vtkPolyDataMapper> wallMap;\n  wallMap->SetInputConnection(wall->GetOutputPort());\n  wallMap->ScalarVisibilityOff();\n  vtkNew<vtkActor> wallActor;\n  wallActor->SetMapper(wallMap);\n  wallActor->GetProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // Make the fin (rear wall).\n  vtkNew<vtkStructuredGridGeometryFilter> fin;\n  fin->SetInputData(output);\n  fin->SetExtent(0, 100, 0, 100, 0, 0);\n  vtkNew<vtkPolyDataMapper> finMap;\n  finMap->SetInputConnection(fin->GetOutputPort());\n  finMap->ScalarVisibilityOff();\n  vtkNew<vtkActor> finActor;\n  finActor->SetMapper(finMap);\n  finActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Get the texture.\n  vtkNew<vtkStructuredPointsReader> tmap;\n  tmap->SetFileName(textureFn.c_str());\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(tmap->GetOutputPort());\n  texture->InterpolateOff();\n  texture->RepeatOff();\n\n  // Create the rendering window, renderer, and interactive renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Make the planes to threshold and texture.\n  std::vector<vtkSmartPointer<vtkStructuredGridGeometryFilter>> plane;\n  std::vector<vtkSmartPointer<vtkThresholdTextureCoords>> thresh;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> planeMap;\n  std::vector<vtkSmartPointer<vtkActor>> planeActor;\n  // Define the extents of planes that we will use.\n  std::vector<std::array<int, 6>> planeExtents{{10, 10, 0, 100, 0, 100},\n                                               {30, 30, 0, 100, 0, 100},\n                                               {35, 35, 0, 100, 0, 100}};\n  // Now set up the pipeline.\n  for (unsigned int i = 0; i < planeExtents.size(); ++i)\n  {\n    plane.push_back(vtkSmartPointer<vtkStructuredGridGeometryFilter>::New());\n    plane[i]->SetInputData(output);\n    plane[i]->SetExtent(planeExtents[i].data());\n    thresh.push_back(vtkSmartPointer<vtkThresholdTextureCoords>::New());\n    thresh[i]->SetInputConnection(plane[i]->GetOutputPort());\n    thresh[i]->SetInputConnection(plane[i]->GetOutputPort());\n    // If you want an image similar to Fig 9-43(a) in the VTK textbook, set\n    // thresh[i]->ThresholdByUpper(1.5); for all planes.\n    switch (i)\n    {\n    case 0:\n    default:\n      thresh[i]->ThresholdByUpper(1.5);\n      break;\n    case 1:\n      thresh[i]->ThresholdByLower(1.5);\n      break;\n    case 2:\n      thresh[i]->ThresholdBetween(1.5, 1.8);\n      break;\n    }\n    planeMap.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    planeMap[i]->SetInputConnection(thresh[i]->GetOutputPort());\n    planeMap[i]->SetScalarRange(output->GetScalarRange());\n    planeActor.push_back(vtkSmartPointer<vtkActor>::New());\n    planeActor[i]->SetMapper(planeMap[i]);\n    planeActor[i]->SetTexture(texture);\n    // The slight transparency gives a nice effect.\n    planeActor[i]->GetProperty()->SetOpacity(0.999);\n    ren->AddActor(planeActor[i]);\n  }\n  // Get an outline of the data set for context.\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(output);\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the remaining actors to the renderer, set the background and size.\n  ren->AddActor(outlineActor);\n  ren->AddActor(wallActor);\n  ren->AddActor(finActor);\n  ren->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"TextureThreshold\");\n\n  vtkNew<vtkCamera> cam;\n  cam->SetClippingRange(1.51176, 75.5879);\n  cam->SetFocalPoint(2.33749, 2.96739, 3.61023);\n  cam->SetPosition(10.8787, 5.27346, 15.8687);\n  cam->SetViewAngle(30);\n  cam->SetViewUp(-0.0610856, 0.987798, -0.143262);\n  ren->SetActiveCamera(cam);\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Texture/TextureThreshold/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureThreshold)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  FiltersTexture\n  IOLegacy\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureThreshold: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureThreshold MACOSX_BUNDLE TextureThreshold.cxx )\n  target_link_libraries(TextureThreshold PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureThreshold\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Texture/TextureThreshold/#download-and-build-texturethreshold","title":"Download and Build TextureThreshold","text":"

        Click here to download TextureThreshold and its CMakeLists.txt file. Once the tarball TextureThreshold.tar has been downloaded and extracted,

        cd TextureThreshold/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TextureThreshold\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Texture/TexturedSphere/","title":"TexturedSphere","text":"

        vtk-examples/Cxx/Texture/TexturedSphere

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Texture/TexturedSphere/#code","title":"Code","text":"

        TexturedSphere.cxx

        #include <vtkActor.h>\n#include <vtkImageReader.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTexture.h>\n#include <vtkTextureMapToSphere.h>\n#include <vtkTexturedSphereSource.h>\n#include <vtkTransformTextureCoords.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" texture(.png/.ppm) e.g. earth.ppm\"\n              << \" [translate]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  double translate[3];\n  if (argc > 2)\n  {\n    translate[0] = atof(argv[2]);\n  }\n  else\n  {\n    translate[0] = 0.0;\n  }\n  translate[1] = 0.0;\n  translate[2] = 0.0;\n  std::cout << translate[0] << \", \" << translate[1] << \", \" << translate[2]\n            << \"\\n\";\n  // Create a sphere with texture coordinates\n  vtkNew<vtkTexturedSphereSource> source;\n  source->SetThetaResolution(100);\n  source->SetPhiResolution(100);\n\n  // Read texture file\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> imageReader;\n  imageReader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  imageReader->SetFileName(argv[1]);\n\n  // Create texture\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(imageReader->GetOutputPort());\n\n  vtkNew<vtkTransformTextureCoords> transformTexture;\n  transformTexture->SetInputConnection(source->GetOutputPort());\n  transformTexture->SetPosition(translate);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(transformTexture->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->SetTexture(texture);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TexturedSphere\");\n\n  vtkNew<vtkRenderWindowInteractor> renWinInteractor;\n  renWinInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renWinInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Texture/TexturedSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TexturedSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  FiltersTexture\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TexturedSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TexturedSphere MACOSX_BUNDLE TexturedSphere.cxx )\n  target_link_libraries(TexturedSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TexturedSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Texture/TexturedSphere/#download-and-build-texturedsphere","title":"Download and Build TexturedSphere","text":"

        Click here to download TexturedSphere and its CMakeLists.txt file. Once the tarball TexturedSphere.tar has been downloaded and extracted,

        cd TexturedSphere/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TexturedSphere\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Tutorial/Tutorial_Step1/","title":"Tutorial Step1","text":"

        vtk-examples/Cxx/Tutorial/Tutorial_Step1

        "},{"location":"Cxx/Tutorial/Tutorial_Step1/#description","title":"Description","text":"

        This example creates a polygonal model of a cone, and then renders it to the screen. It will rotate the cone 360 degrees and then exit. The basic setup of source -> mapper -> actor -> renderer -> renderwindow is typical of most VTK programs.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Tutorial/Tutorial_Step1/#code","title":"Code","text":"

        Tutorial_Step1.cxx

        /*=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  //\n  // Next we create an instance of vtkNamedColors and we will use\n  // this to select colors for the object and background.\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Now we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the cone. The actor orchestrates rendering\n  // of the mapper's graphics primitives. An actor also refers to properties\n  // via a vtkProperty instance, and includes an internal transformation\n  // matrix. We set this actor's mapper to be coneMapper which we created\n  // above.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  //\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the background\n  // color here.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Tutorial_Step1\");\n\n  //\n  // Now we loop over 360 degrees and render the cone each time.\n  //\n  for (int i = 0; i < 360; ++i)\n  {\n    // Render the image\n    renWin->Render();\n    // Rotate the active camera by one degree.\n    ren1->GetActiveCamera()->Azimuth(1);\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step1/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step1 MACOSX_BUNDLE Tutorial_Step1.cxx )\n  target_link_libraries(Tutorial_Step1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step1\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step1/#download-and-build-tutorial_step1","title":"Download and Build Tutorial_Step1","text":"

        Click here to download Tutorial_Step1 and its CMakeLists.txt file. Once the tarball Tutorial_Step1.tar has been downloaded and extracted,

        cd Tutorial_Step1/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Tutorial_Step1\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Tutorial/Tutorial_Step2/","title":"Tutorial Step2","text":"

        vtk-examples/Cxx/Tutorial/Tutorial_Step2

        "},{"location":"Cxx/Tutorial/Tutorial_Step2/#description","title":"Description","text":"

        This example shows how to add an observer to a C++ program. It extends the Tutorial_Step1 example (see that example for information on the basic setup).

        VTK uses a command/observer design pattern. That is, observers watch for particular events that any vtkObject (or subclass) may invoke on itself. For example, the vtkRenderer invokes a \"StartEvent\" as it begins to render. Here we add an observer that invokes a command when this event is observed.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Tutorial/Tutorial_Step2/#code","title":"Code","text":"

        Tutorial_Step2.cxx

        /*=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n\n//\n// We put the callback in an anonymous namespace, i.e. a namespace with\n// no name. This anonymous namespace is only accessible within the file\n// that you have created it in. So it is a good way of declaring unique\n// identifiers and avoiding making global static variables.\n//\nnamespace {\n// Callback for the interaction.\nclass vtkMyCallback : public vtkCommand\n{\npublic:\n  static vtkMyCallback* New()\n  {\n    return new vtkMyCallback;\n  }\n  void Execute(vtkObject* caller, unsigned long, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto renderer = reinterpret_cast<vtkRenderer*>(caller);\n    std::cout << renderer->GetActiveCamera()->GetPosition()[0] << \" \"\n              << renderer->GetActiveCamera()->GetPosition()[1] << \" \"\n              << renderer->GetActiveCamera()->GetPosition()[2] << std::endl;\n  }\n  vtkMyCallback() = default;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // The pipeline creation is documented in Tutorial_Step1.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  ren1->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Tutorial_Step2\");\n\n  // Here is where we setup the observer.\n  vtkNew<vtkMyCallback> mo1;\n  ren1->AddObserver(vtkCommand::StartEvent, mo1);\n\n  //\n  // Now we loop over 360 degrees and render the cone each time.\n  //\n  for (int i = 0; i < 360; ++i)\n  {\n    // Render the image.\n    renWin->Render();\n    // Rotate the active camera by one degree.\n    ren1->GetActiveCamera()->Azimuth(1);\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step2 MACOSX_BUNDLE Tutorial_Step2.cxx )\n  target_link_libraries(Tutorial_Step2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step2/#download-and-build-tutorial_step2","title":"Download and Build Tutorial_Step2","text":"

        Click here to download Tutorial_Step2 and its CMakeLists.txt file. Once the tarball Tutorial_Step2.tar has been downloaded and extracted,

        cd Tutorial_Step2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Tutorial_Step2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Tutorial/Tutorial_Step3/","title":"Tutorial Step3","text":"

        vtk-examples/Cxx/Tutorial/Tutorial_Step3

        "},{"location":"Cxx/Tutorial/Tutorial_Step3/#description","title":"Description","text":"

        This example demonstrates how to use multiple renderers within a render window.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Tutorial/Tutorial_Step3/#code","title":"Code","text":"

        Tutorial_Step3.cxx

        /*=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Next we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the cone. The actor orchestrates rendering\n  // of the mapper's graphics primitives. An actor also refers to properties\n  // via a vtkProperty instance, and includes an internal transformation\n  // matrix. We set this actor's mapper to be coneMapper which we created\n  // above.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  //\n  // Create two renderers and assign actors to them. A renderer renders into\n  // a viewport within the vtkRenderWindow. It is part or all of a window on\n  // the screen and it is responsible for drawing the actors it has.  We also\n  // set the background color here. In this example we are adding the same\n  // actor to two different renderers; it is okay to add different actors to\n  // different renderers as well.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  ren1->SetViewport(0.0, 0.0, 0.5, 1.0);\n\n  vtkNew<vtkRenderer> ren2;\n  ren2->AddActor(coneActor);\n  ren2->SetBackground(colors->GetColor3d(\"DodgerBlue\").GetData());\n  ren2->SetViewport(0.5, 0.0, 1.0, 1.0);\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->AddRenderer(ren2);\n  renWin->SetSize(600, 300);\n  renWin->SetWindowName(\"Tutorial_Step3\");\n\n  //\n  // Make one view 90 degrees from other.\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(90);\n\n  //\n  // Now we loop over 360 degrees and render the cones each time.\n  //\n  for (int i = 0; i < 360; ++i)\n  {\n    // render the image\n    renWin->Render();\n    // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth(1);\n    ren2->GetActiveCamera()->Azimuth(1);\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step3/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step3)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step3: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step3 MACOSX_BUNDLE Tutorial_Step3.cxx )\n  target_link_libraries(Tutorial_Step3 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step3\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step3/#download-and-build-tutorial_step3","title":"Download and Build Tutorial_Step3","text":"

        Click here to download Tutorial_Step3 and its CMakeLists.txt file. Once the tarball Tutorial_Step3.tar has been downloaded and extracted,

        cd Tutorial_Step3/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Tutorial_Step3\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Tutorial/Tutorial_Step4/","title":"Tutorial Step4","text":"

        vtk-examples/Cxx/Tutorial/Tutorial_Step4

        "},{"location":"Cxx/Tutorial/Tutorial_Step4/#description","title":"Description","text":"

        This example demonstrates the creation of multiple actors and the manipulation of their properties and transformations.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Tutorial/Tutorial_Step4/#code","title":"Code","text":"

        Tutorial_Step4.cxx

        /*=========================================================================\n\n  Program:   Visualization Toolkit\n  Module:    Cone4.cxx\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Next we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the first cone. The actor's properties are\n  // modified to give it different surface properties. By default, an actor\n  // is create with a property so the GetProperty() method can be used.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(0.2, 0.63, 0.79);\n  coneActor->GetProperty()->SetDiffuse(0.7);\n  coneActor->GetProperty()->SetSpecular(0.4);\n  coneActor->GetProperty()->SetSpecularPower(20);\n\n  //\n  // Create a property and directly manipulate it. Assign it to the\n  // second actor.\n  //\n  vtkNew<vtkProperty> property;\n  property->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  property->SetDiffuse(0.7);\n  property->SetSpecular(0.4);\n  property->SetSpecularPower(20);\n\n  //\n  // Create a second actor and a property. The property is directly\n  // manipulated and then assigned to the actor. In this way, a single\n  // property can be shared among many actors. Note also that we use the\n  // same mapper as the first actor did. This way we avoid duplicating\n  // geometry, which may save lots of memory if the geometry is large.\n  vtkNew<vtkActor> coneActor2;\n  coneActor2->SetMapper(coneMapper);\n  coneActor2->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightSeaGreen\").GetData());\n  coneActor2->SetProperty(property);\n  coneActor2->SetPosition(0, 2, 0);\n\n  //\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the background\n  // color here.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->AddActor(coneActor2);\n  ren1->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Tutorial_Step4\");\n\n  //\n  // Now we loop over 360 degrees and render the cones each time.\n  //\n  for (int i = 0; i < 360; ++i)\n  {\n    // render the image\n    renWin->Render();\n    // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth(1);\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step4/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step4)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step4: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step4 MACOSX_BUNDLE Tutorial_Step4.cxx )\n  target_link_libraries(Tutorial_Step4 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step4\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step4/#download-and-build-tutorial_step4","title":"Download and Build Tutorial_Step4","text":"

        Click here to download Tutorial_Step4 and its CMakeLists.txt file. Once the tarball Tutorial_Step4.tar has been downloaded and extracted,

        cd Tutorial_Step4/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Tutorial_Step4\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Tutorial/Tutorial_Step5/","title":"Tutorial Step5","text":"

        vtk-examples/Cxx/Tutorial/Tutorial_Step5

        "},{"location":"Cxx/Tutorial/Tutorial_Step5/#description","title":"Description","text":"

        This example introduces the concepts of interaction into the Python environment. A different interaction style (than the default) is defined.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Tutorial/Tutorial_Step5/#code","title":"Code","text":"

        Tutorial_Step5.cxx

        /*=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Next we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the cone. The actor orchestrates rendering\n  // of the mapper's graphics primitives. An actor also refers to properties\n  // via a vtkProperty instance, and includes an internal transformation\n  // matrix. We set this actor's mapper to be coneMapper which we created\n  // above.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Bisque\").GetData());\n\n  //\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the background\n  // color here.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Tutorial_Step5\");\n\n  //\n  // The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n  // mouse) in the vtkRenderWindow. These events are translated into\n  // event invocations that VTK understands (see VTK/Common/vtkCommand.h\n  // for all events that VTK processes). Then observers of these VTK\n  // events can process them as appropriate.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  //\n  // By default the vtkRenderWindowInteractor instantiates an instance\n  // of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n  // it observes into operations on the camera, actors, and/or properties\n  // in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n  // Here we specify a particular interactor style.\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  //\n  // Unlike the previous scripts where we performed some operations and then\n  // exited, here we leave an event loop running. The user can use the mouse\n  // and keyboard to perform the operations on the scene according to the\n  // current interaction style. When the user presses the \"e\" key, by default\n  // an ExitEvent is invoked by the vtkRenderWindowInteractor which is caught\n  // and drops out of the event loop (triggered by the Start() method that\n  // follows.\n  //\n  iren->Initialize();\n  iren->Start();\n\n  //\n  // Final note: recall that observers can watch for particular events and\n  // take appropriate action. Pressing \"u\" in the render window causes the\n  // vtkRenderWindowInteractor to invoke a UserEvent. This can be caught to\n  // popup a GUI, etc. See the Tcl Cone5.tcl example for an idea of how this\n  // works.\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step5/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step5)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step5: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step5 MACOSX_BUNDLE Tutorial_Step5.cxx )\n  target_link_libraries(Tutorial_Step5 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step5\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step5/#download-and-build-tutorial_step5","title":"Download and Build Tutorial_Step5","text":"

        Click here to download Tutorial_Step5 and its CMakeLists.txt file. Once the tarball Tutorial_Step5.tar has been downloaded and extracted,

        cd Tutorial_Step5/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Tutorial_Step5\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Tutorial/Tutorial_Step6/","title":"Tutorial Step6","text":"

        vtk-examples/Cxx/Tutorial/Tutorial_Step6

        "},{"location":"Cxx/Tutorial/Tutorial_Step6/#description","title":"Description","text":"

        This example introduces 3D widgets. 3D widgets take advantage of the event/observer design pattern introduced previously. They typically have a particular representation in the scene which can be interactively selected and manipulated using the mouse and keyboard. As the widgets are manipulated, they in turn invoke events such as StartInteractionEvent, InteractionEvent, and EndInteractionEvent which can be used to manipulate the scene that the widget is embedded in. 3D widgets work in the context of the event loop which was set up in the previous example.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Tutorial/Tutorial_Step6/#code","title":"Code","text":"

        Tutorial_Step6.cxx

        /*=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n// First include the required header files for the VTK classes we are using.\n#include <vtkActor.h>\n#include <vtkBoxWidget.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nnamespace {\n//\n// Similar to Tutorial_Step2.cxx, we define a callback for interaction.\n//\nclass vtkMyCallback : public vtkCommand\n{\npublic:\n  static vtkMyCallback* New()\n  {\n    return new vtkMyCallback;\n  }\n  void Execute(vtkObject* caller, unsigned long, void*) override\n  {\n    vtkNew<vtkTransform> t;\n    auto widget = reinterpret_cast<vtkBoxWidget*>(caller);\n    widget->GetTransform(t);\n    widget->GetProp3D()->SetUserTransform(t);\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //\n  // Next we create an instance of vtkConeSource and set some of its\n  // properties. The instance of vtkConeSource \"cone\" is part of a\n  // visualization pipeline (it is a source process object); it produces data\n  // (output type is vtkPolyData) which other filters may process.\n  //\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  //\n  // In this example we terminate the pipeline with a mapper process object.\n  // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n  // between the source and the mapper.)  We create an instance of\n  // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n  // connect the output of the cone source to the input of this mapper.\n  //\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  //\n  // Create an actor to represent the cone. The actor orchestrates rendering\n  // of the mapper's graphics primitives. An actor also refers to properties\n  // via a vtkProperty instance, and includes an internal transformation\n  // matrix. We set this actor's mapper to be coneMapper which we created\n  // above.\n  //\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Bisque\").GetData());\n\n  //\n  // Create the Renderer and assign actors to it. A renderer is like a\n  // viewport. It is part or all of a window on the screen and it is\n  // responsible for drawing the actors it has.  We also set the background\n  // color here.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->AddActor(coneActor);\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  //\n  // Finally we create the render window which will show up on the screen.\n  // We put our renderer into the render window using AddRenderer. We also\n  // set the size to be 300 pixels by 300.\n  //\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Tutorial_Step6\");\n\n  //\n  // The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n  // mouse) in the vtkRenderWindow. These events are translated into\n  // event invocations that VTK understands (see VTK/Common/vtkCommand.h\n  // for all events that VTK processes). Then observers of these VTK\n  // events can process them as appropriate.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  //\n  // By default the vtkRenderWindowInteractor instantiates an instance\n  // of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n  // it observes into operations on the camera, actors, and/or properties\n  // in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n  // Here we specify a particular interactor style.\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  //\n  // Here we use a vtkBoxWidget to transform the underlying coneActor (by\n  // manipulating its transformation matrix). Many other types of widgets\n  // are available for use, see the documentation for more details.\n  //\n  // The SetInteractor method is how 3D widgets are associated with the render\n  // window interactor. Internally, SetInteractor sets up a bunch of callbacks\n  // using the Command/Observer mechanism (AddObserver()). The place factor\n  // controls the initial size of the widget with respect to the bounding box\n  // of the input to the widget.\n  vtkNew<vtkBoxWidget> boxWidget;\n  boxWidget->SetInteractor(iren);\n  boxWidget->SetPlaceFactor(1.25);\n  boxWidget->GetOutlineProperty()->SetColor(\n      colors->GetColor3d(\"Gold\").GetData());\n\n  //\n  // Place the interactor initially. The input to a 3D widget is used to\n  // initially position and scale the widget. The EndInteractionEvent is\n  // observed which invokes the SelectPolygons callback.\n  //\n  boxWidget->SetProp3D(coneActor);\n  boxWidget->PlaceWidget();\n  vtkNew<vtkMyCallback> callback;\n  boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  //\n  // Normally the user presses the \"i\" key to bring a 3D widget to life. Here\n  // we will manually enable it so it appears with the cone.\n  //\n  boxWidget->On();\n\n  //\n  // Start the event loop.\n  //\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step6/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Tutorial_Step6)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Tutorial_Step6: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Tutorial_Step6 MACOSX_BUNDLE Tutorial_Step6.cxx )\n  target_link_libraries(Tutorial_Step6 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Tutorial_Step6\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Tutorial/Tutorial_Step6/#download-and-build-tutorial_step6","title":"Download and Build Tutorial_Step6","text":"

        Click here to download Tutorial_Step6 and its CMakeLists.txt file. Once the tarball Tutorial_Step6.tar has been downloaded and extracted,

        cd Tutorial_Step6/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Tutorial_Step6\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/","title":"ClipUnstructuredGridWithPlane","text":"

        vtk-examples/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/#description","title":"Description","text":"

        The example uses vtkTableBasedClipDataSet to clip a vtkUnstructuredGrid. The resulting output and clipped output are presented in yellow and red respectively. To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each output about their centers.

        Note that unlike other clipping filters (except for vtkClipPolyData), vtkTableBasedClipDataSet retains the original cells if they are not clipped.

        After exiting, the example reports the number of each cell type for each output:

        The inside dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 26116 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3751 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 17361 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 628 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 4376 times.\nThe clipped dataset contains a \n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 25655 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3715 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 16984 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 616 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 4340 times.\n

        Compare these results with ClipUnstructuredGridWithPlane2 (C++), ClipUnstructuredGridWithPlane2 (Python). Also, the resulting vtkUnstructuredGrid's has 1/4 the number of cells.

        usage

        ClipUnstructuredGridWithPlane treemesh.vtk

        thanks

        Thanks to Bane Sullivan for sharing the treemesh.vtk unstructured grid dataset.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/#code","title":"Code","text":"

        ClipUnstructuredGridWithPlane.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellTypes.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTableBasedClipDataSet.h>\n#include <vtkTransform.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtk e.g. treemesh.vtk\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Create the reader for the data.\n  std::string filename = argv[1];\n  std::cout << \"Loading \" << filename.c_str() << std::endl;\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n  double center[3];\n  reader->GetOutput()->GetCenter(center);\n\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  double xnorm[3] = {-1.0, -1.0, 1.0};\n\n  vtkNew<vtkPlane> clipPlane;\n  clipPlane->SetOrigin(reader->GetOutput()->GetCenter());\n  clipPlane->SetNormal(xnorm);\n\n  vtkNew<vtkTableBasedClipDataSet> clipper;\n  clipper->SetClipFunction(clipPlane);\n  clipper->SetInputData(reader->GetOutput());\n  clipper->SetValue(0.0);\n  clipper->GenerateClippedOutputOn();\n  clipper->Update();\n\n  vtkNew<vtkDataSetMapper> insideMapper;\n  insideMapper->SetInputData(clipper->GetOutput());\n  insideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> insideActor;\n  insideActor->SetMapper(insideMapper);\n  insideActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  insideActor->GetProperty()->SetAmbient(.3);\n  insideActor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkDataSetMapper> clippedMapper;\n  clippedMapper->SetInputData(clipper->GetClippedOutput());\n  clippedMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clippedActor;\n  clippedActor->SetMapper(clippedMapper);\n  clippedActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  insideActor->GetProperty()->SetAmbient(.3);\n  clippedActor->GetProperty()->EdgeVisibilityOn();\n\n  // Create transforms to make a better visualization\n  vtkNew<vtkTransform> insideTransform;\n  insideTransform->Translate(-(bounds[1] - bounds[0]) * .75, 0, 0);\n  insideTransform->Translate(center[0], center[1], center[2]);\n  insideTransform->RotateY(-120.0);\n  insideTransform->Translate(-center[0], -center[1], -center[2]);\n  insideActor->SetUserTransform(insideTransform);\n\n  vtkNew<vtkTransform> clippedTransform;\n  clippedTransform->Translate((bounds[1] - bounds[0]) * .75, 0, 0);\n  clippedTransform->Translate(center[0], center[1], center[2]);\n  clippedTransform->RotateY(60.0);\n  clippedTransform->Translate(-center[0], -center[1], -center[2]);\n  clippedActor->SetUserTransform(clippedTransform);\n\n  renderer->AddViewProp(clippedActor);\n  renderer->AddViewProp(insideActor);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ClipUnstructuredGridWithPlane\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  // Generate a report\n  vtkIdType numberOfCells = clipper->GetOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The inside dataset contains a \" << std::endl\n            << clipper->GetOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> CellContainer;\n  CellContainer cellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    cellMap[clipper->GetOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : cellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n\n  numberOfCells = clipper->GetClippedOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset contains a \" << std::endl\n            << clipper->GetClippedOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> OutsideCellContainer;\n  CellContainer outsideCellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    outsideCellMap[clipper->GetClippedOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : outsideCellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipUnstructuredGridWithPlane)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipUnstructuredGridWithPlane: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipUnstructuredGridWithPlane MACOSX_BUNDLE ClipUnstructuredGridWithPlane.cxx )\n  target_link_libraries(ClipUnstructuredGridWithPlane PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipUnstructuredGridWithPlane\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/#download-and-build-clipunstructuredgridwithplane","title":"Download and Build ClipUnstructuredGridWithPlane","text":"

        Click here to download ClipUnstructuredGridWithPlane and its CMakeLists.txt file. Once the tarball ClipUnstructuredGridWithPlane.tar has been downloaded and extracted,

        cd ClipUnstructuredGridWithPlane/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClipUnstructuredGridWithPlane\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/","title":"ClipUnstructuredGridWithPlane2","text":"

        vtk-examples/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#description","title":"Description","text":"

        The example uses vtkClipDataSet to clip a vtkUnstructuredGrid. The resulting output and clipped output are presented in yellow and red respectively. To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each output about their centers.

        Note that this clipping filter does not retain the original cells if they are not clipped.

        After exiting, the example reports the number of each cell type for each output:

        The inside dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 110148 cells\n        Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 106998 times.\n        Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 3150 times.\nThe clipped dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 111824 cells\n        Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 107420 times.\n        Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 4404 times.\n

        Compare these results with ClipUnstructuredGridWithPlane (C++) ClipUnstructuredGridWithPlane (Python). Notice that in this example, the original vtkHexahedron in the unclipped regions are converted to vtkTetra. Also, the resulting vtkUnstructuredGrid's have more than 4 times the number of cells.

        usage

        ClipUnstructuredGridWithPlane2 treemesh.vtk

        thanks

        Thanks to Bane Sullivan for sharing the treemesh.vtk unstructured grid dataset.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#code","title":"Code","text":"

        ClipUnstructuredGridWithPlane2.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellTypes.h>\n#include <vtkClipDataSet.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtk e.g. treemesh.vtk\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Create the reader for the data.\n  std::string filename = argv[1];\n  std::cout << \"Loading \" << filename.c_str() << std::endl;\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n  double center[3];\n  reader->GetOutput()->GetCenter(center);\n\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  double xnorm[3] = {-1.0, -1.0, 1.0};\n\n  vtkNew<vtkPlane> clipPlane;\n  clipPlane->SetOrigin(reader->GetOutput()->GetCenter());\n  clipPlane->SetNormal(xnorm);\n\n  vtkNew<vtkClipDataSet> clipper;\n  clipper->SetClipFunction(clipPlane);\n  clipper->SetInputData(reader->GetOutput());\n  clipper->SetValue(0.0);\n  clipper->GenerateClippedOutputOn();\n  clipper->Update();\n\n  vtkNew<vtkDataSetMapper> insideMapper;\n  insideMapper->SetInputData(clipper->GetOutput());\n  insideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> insideActor;\n  insideActor->SetMapper(insideMapper);\n  insideActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"banana\").GetData());\n  insideActor->GetProperty()->SetAmbient(.3);\n  insideActor->GetProperty()->EdgeVisibilityOn();\n\n  vtkNew<vtkDataSetMapper> clippedMapper;\n  clippedMapper->SetInputData(clipper->GetClippedOutput());\n  clippedMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clippedActor;\n  clippedActor->SetMapper(clippedMapper);\n  clippedActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"tomato\").GetData());\n  insideActor->GetProperty()->SetAmbient(.3);\n  clippedActor->GetProperty()->EdgeVisibilityOn();\n\n  // Create transforms to make a better visualization\n  vtkNew<vtkTransform> insideTransform;\n  insideTransform->Translate(-(bounds[1] - bounds[0]) * .75, 0, 0);\n  insideTransform->Translate(center[0], center[1], center[2]);\n  insideTransform->RotateY(-120.0);\n  insideTransform->Translate(-center[0], -center[1], -center[2]);\n  insideActor->SetUserTransform(insideTransform);\n\n  vtkNew<vtkTransform> clippedTransform;\n  clippedTransform->Translate((bounds[1] - bounds[0]) * .75, 0, 0);\n  clippedTransform->Translate(center[0], center[1], center[2]);\n  clippedTransform->RotateY(60.0);\n  clippedTransform->Translate(-center[0], -center[1], -center[2]);\n  clippedActor->SetUserTransform(clippedTransform);\n\n  renderer->AddViewProp(clippedActor);\n  renderer->AddViewProp(insideActor);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ClipUnstructuredGridWithPlane2\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  // Generate a report\n  vtkIdType numberOfCells = clipper->GetOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The inside dataset contains a \" << std::endl\n            << clipper->GetOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> CellContainer;\n  CellContainer cellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    cellMap[clipper->GetOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : cellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n\n  numberOfCells = clipper->GetClippedOutput()->GetNumberOfCells();\n  std::cout << \"------------------------\" << std::endl;\n  std::cout << \"The clipped dataset contains a \" << std::endl\n            << clipper->GetClippedOutput()->GetClassName() << \" that has \"\n            << numberOfCells << \" cells\" << std::endl;\n  typedef std::map<int, int> OutsideCellContainer;\n  CellContainer outsideCellMap;\n  for (vtkIdType i = 0; i < numberOfCells; i++)\n  {\n    outsideCellMap[clipper->GetClippedOutput()->GetCellType(i)]++;\n  }\n\n  for (auto c : outsideCellMap)\n  {\n    std::cout << \"\\tCell type \" << vtkCellTypes::GetClassNameFromTypeId(c.first)\n              << \" occurs \" << c.second << \" times.\" << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipUnstructuredGridWithPlane2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipUnstructuredGridWithPlane2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipUnstructuredGridWithPlane2 MACOSX_BUNDLE ClipUnstructuredGridWithPlane2.cxx )\n  target_link_libraries(ClipUnstructuredGridWithPlane2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipUnstructuredGridWithPlane2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#download-and-build-clipunstructuredgridwithplane2","title":"Download and Build ClipUnstructuredGridWithPlane2","text":"

        Click here to download ClipUnstructuredGridWithPlane2 and its CMakeLists.txt file. Once the tarball ClipUnstructuredGridWithPlane2.tar has been downloaded and extracted,

        cd ClipUnstructuredGridWithPlane2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClipUnstructuredGridWithPlane2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/UnstructuredGrid/UGrid/","title":"UGrid","text":"

        vtk-examples/Cxx/UnstructuredGrid/UGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/UnstructuredGrid/UGrid/#description","title":"Description","text":"

        Creation of an unstructured grid.

        Info

        See Figure 5-21 in Chapter 05 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/UnstructuredGrid/UGrid/#code","title":"Code","text":"

        UGrid.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellType.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\nint main(int, char*[])\n{\n  int i;\n  static double x[27][3] = {\n      {0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {0, 1, 0}, {1, 1, 0}, {2, 1, 0},\n      {0, 0, 1}, {1, 0, 1}, {2, 0, 1}, {0, 1, 1}, {1, 1, 1}, {2, 1, 1},\n      {0, 1, 2}, {1, 1, 2}, {2, 1, 2}, {0, 1, 3}, {1, 1, 3}, {2, 1, 3},\n      {0, 1, 4}, {1, 1, 4}, {2, 1, 4}, {0, 1, 5}, {1, 1, 5}, {2, 1, 5},\n      {0, 1, 6}, {1, 1, 6}, {2, 1, 6}};\n  static vtkIdType pts[12][8] = {\n      {0, 1, 4, 3, 6, 7, 10, 9},      {1, 2, 5, 4, 7, 8, 11, 10},\n      {6, 10, 9, 12, 0, 0, 0, 0},     {8, 11, 10, 14, 0, 0, 0, 0},\n      {16, 17, 14, 13, 12, 15, 0, 0}, {18, 15, 19, 16, 20, 17, 0, 0},\n      {22, 23, 20, 19, 0, 0, 0, 0},   {21, 22, 18, 0, 0, 0, 0, 0},\n      {22, 19, 18, 0, 0, 0, 0, 0},    {23, 26, 0, 0, 0, 0, 0, 0},\n      {21, 24, 0, 0, 0, 0, 0, 0},     {25, 0, 0, 0, 0, 0, 0, 0}};\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkPoints> points;\n  for (i = 0; i < 27; i++) points->InsertPoint(i, x[i]);\n\n  vtkNew<vtkUnstructuredGrid> ugrid;\n  ugrid->Allocate(100);\n  ugrid->InsertNextCell(VTK_HEXAHEDRON, 8, pts[0]);\n  ugrid->InsertNextCell(VTK_HEXAHEDRON, 8, pts[1]);\n  ugrid->InsertNextCell(VTK_TETRA, 4, pts[2]);\n  ugrid->InsertNextCell(VTK_TETRA, 4, pts[3]);\n  ugrid->InsertNextCell(VTK_POLYGON, 6, pts[4]);\n  ugrid->InsertNextCell(VTK_TRIANGLE_STRIP, 6, pts[5]);\n  ugrid->InsertNextCell(VTK_QUAD, 4, pts[6]);\n  ugrid->InsertNextCell(VTK_TRIANGLE, 3, pts[7]);\n  ugrid->InsertNextCell(VTK_TRIANGLE, 3, pts[8]);\n  ugrid->InsertNextCell(VTK_LINE, 2, pts[9]);\n  ugrid->InsertNextCell(VTK_LINE, 2, pts[10]);\n  ugrid->InsertNextCell(VTK_VERTEX, 1, pts[11]);\n\n  ugrid->SetPoints(points);\n\n  vtkNew<vtkDataSetMapper> ugridMapper;\n  ugridMapper->SetInputData(ugrid);\n\n  vtkNew<vtkActor> ugridActor;\n  ugridActor->SetMapper(ugridMapper);\n  ugridActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  ugridActor->GetProperty()->EdgeVisibilityOn();\n\n  renderer->AddActor(ugridActor);\n  renderer->SetBackground(colors->GetColor3d(\"Beige\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Dolly(1.2);\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"UGrid)\");\n\n  // interact with data\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/UnstructuredGrid/UGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(UGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"UGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(UGrid MACOSX_BUNDLE UGrid.cxx )\n  target_link_libraries(UGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS UGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/UnstructuredGrid/UGrid/#download-and-build-ugrid","title":"Download and Build UGrid","text":"

        Click here to download UGrid and its CMakeLists.txt file. Once the tarball UGrid.tar has been downloaded and extracted,

        cd UGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./UGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/2DArray/","title":"2DArray","text":"

        vtk-examples/Cxx/Utilities/2DArray

        "},{"location":"Cxx/Utilities/2DArray/#description","title":"Description","text":"

        This example creates a 5x5 2D array and sets the (4,4) (zero based indexing, of course) entry to 5.0. Then it outputs this value to demonstrate accessing.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/2DArray/#code","title":"Code","text":"

        2DArray.cxx

        #include <vtkDenseArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDenseArray<double>> array;\n\n  array->Resize(5, 5);\n\n  array->SetValue(4, 4, 5.0);\n\n  std::cout << array->GetValue(4, 4) << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/2DArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(2DArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"2DArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(2DArray MACOSX_BUNDLE 2DArray.cxx )\n  target_link_libraries(2DArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS 2DArray\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/2DArray/#download-and-build-2darray","title":"Download and Build 2DArray","text":"

        Click here to download 2DArray and its CMakeLists.txt file. Once the tarball 2DArray.tar has been downloaded and extracted,

        cd 2DArray/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./2DArray\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/3DArray/","title":"3DArray","text":"

        vtk-examples/Cxx/Utilities/3DArray

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/3DArray/#code","title":"Code","text":"

        3DArray.cxx

        #include <vtkDenseArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // Create an N-D array\n  vtkNew<vtkDenseArray<double>> array;\n\n  // Resize the array to 4x5x3\n  array->Resize(4, 5, 3);\n\n  // Set a value\n  int i = 0;\n  int j = 0;\n  int k = 0;\n  double value = 3.0;\n  array->SetValue(i, j, k, value);\n\n  // Get a value\n  std::cout << array->GetValue(i, j, k) << std::endl;\n\n  // Get size (bounds) of whole array\n  cout << array->GetExtents() << endl;\n\n  // Get size (bounds) of array dimensions\n  std::cout << array->GetExtents()[0] << std::endl;\n  std::cout << array->GetExtents()[1] << std::endl;\n  std::cout << array->GetExtents()[2] << std::endl;\n\n  // Get the bounds of the 0th dimension\n  std::cout << array->GetExtents()[0].GetBegin() << std::endl;\n  std::cout << array->GetExtents()[0].GetEnd() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/3DArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(3DArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"3DArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(3DArray MACOSX_BUNDLE 3DArray.cxx )\n  target_link_libraries(3DArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS 3DArray\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/3DArray/#download-and-build-3darray","title":"Download and Build 3DArray","text":"

        Click here to download 3DArray and its CMakeLists.txt file. Once the tarball 3DArray.tar has been downloaded and extracted,

        cd 3DArray/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./3DArray\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/Animation/","title":"Animation","text":"

        vtk-examples/Cxx/Utilities/Animation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Utilities/Animation/#description","title":"Description","text":"

        This example demonstrates how to create a simple animation. A timer is used to move a sphere across a scene.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/Animation/#code","title":"Code","text":"

        Animation.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass vtkTimerCallback2 : public vtkCallbackCommand\n{\npublic:\n  vtkTimerCallback2() = default;\n\n  static vtkTimerCallback2* New()\n  {\n    vtkTimerCallback2* cb = new vtkTimerCallback2;\n    cb->TimerCount = 0;\n    return cb;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long eventId,\n                       void* vtkNotUsed(callData))\n  {\n    if (vtkCommand::TimerEvent == eventId)\n    {\n      ++this->TimerCount;\n    }\n    std::cout << this->TimerCount << std::endl;\n    actor->SetPosition(this->TimerCount, this->TimerCount, 0);\n    if (this->TimerCount < this->maxCount)\n    {\n\n      vtkRenderWindowInteractor* iren =\n          dynamic_cast<vtkRenderWindowInteractor*>(caller);\n      iren->GetRenderWindow()->Render();\n    }\n    else\n    {\n      vtkRenderWindowInteractor* iren =\n          dynamic_cast<vtkRenderWindowInteractor*>(caller);\n      if (this->timerId > -1)\n      {\n        iren->DestroyTimer(this->timerId);\n      }\n    }\n  }\n\nprivate:\n  int TimerCount = 0;\n\npublic:\n  vtkActor* actor = nullptr;\n  int timerId = 0;\n  int maxCount = -1;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(2.0);\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetSpecular(0.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Animation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Zoom(0.8);\n  renderWindow->Render();\n\n  // Initialize must be called prior to creating timer events.\n  renderWindowInteractor->Initialize();\n\n  // Sign up to receive TimerEvent\n  vtkNew<vtkTimerCallback2> cb;\n  cb->actor = actor;\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, cb);\n\n  int timerId = renderWindowInteractor->CreateRepeatingTimer(500);\n  std::cout << \"timerId: \" << timerId << std::endl;\n  // Destroy the timer when maxCount is reached.\n  cb->maxCount = 3;\n  cb->timerId = timerId;\n  // Start the interaction and timer\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/Animation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Animation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Animation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Animation MACOSX_BUNDLE Animation.cxx )\n  target_link_libraries(Animation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Animation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/Animation/#download-and-build-animation","title":"Download and Build Animation","text":"

        Click here to download Animation and its CMakeLists.txt file. Once the tarball Animation.tar has been downloaded and extracted,

        cd Animation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Animation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/AnimationScene/","title":"AnimationScene","text":"

        vtk-examples/Cxx/Utilities/AnimationScene

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/AnimationScene/#code","title":"Code","text":"

        AnimationScene.cxx

        #include <vtkAnimationCue.h>\n#include <vtkAnimationScene.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass CueAnimator\n{\npublic:\n  CueAnimator()\n  {\n    this->SphereSource = 0;\n    this->Mapper = 0;\n    this->Actor = 0;\n  }\n\n  ~CueAnimator()\n  {\n    this->Cleanup();\n  }\n\n  void StartCue(vtkAnimationCue::AnimationCueInfo* vtkNotUsed(info),\n                vtkRenderer* ren)\n  {\n    vtkNew<vtkNamedColors> colors;\n\n    cout << \"*** IN StartCue \" << endl;\n    this->SphereSource = vtkSphereSource::New();\n    this->SphereSource->SetRadius(0.5);\n\n    this->Mapper = vtkPolyDataMapper::New();\n    this->Mapper->SetInputConnection(this->SphereSource->GetOutputPort());\n\n    this->Actor = vtkActor::New();\n    this->Actor->SetMapper(this->Mapper);\n    this->Actor->GetProperty()->SetSpecular(0.6);\n    this->Actor->GetProperty()->SetSpecularPower(30);\n    this->Actor->GetProperty()->SetColor(\n        colors->GetColor3d(\"Peacock\").GetData());\n\n    ren->AddActor(this->Actor);\n    ren->ResetCamera();\n    ren->Render();\n  }\n\n  void Tick(vtkAnimationCue::AnimationCueInfo* info, vtkRenderer* ren)\n  {\n    double newradius = 0.1 +\n        (static_cast<double>(info->AnimationTime - info->StartTime) /\n         static_cast<double>(info->EndTime - info->StartTime)) *\n            1;\n    this->SphereSource->SetRadius(newradius);\n    this->SphereSource->Update();\n    ren->Render();\n  }\n\n  void EndCue(vtkAnimationCue::AnimationCueInfo* vtkNotUsed(info),\n              vtkRenderer* ren)\n  {\n    (void)ren;\n    // don't remove the actor for the regression image.\n    //      ren->RemoveActor(this->Actor);\n    this->Cleanup();\n  }\n\nprotected:\n  vtkSphereSource* SphereSource;\n  vtkPolyDataMapper* Mapper;\n  vtkActor* Actor;\n\n  void Cleanup()\n  {\n    if (this->SphereSource != 0)\n    {\n      this->SphereSource->Delete();\n      this->SphereSource = 0;\n    }\n\n    if (this->Mapper != 0)\n    {\n      this->Mapper->Delete();\n      this->Mapper = 0;\n    }\n    if (this->Actor != 0)\n    {\n      this->Actor->Delete();\n      this->Actor = 0;\n    }\n  }\n};\n\nclass vtkAnimationCueObserver : public vtkCommand\n{\npublic:\n  static vtkAnimationCueObserver* New()\n  {\n    return new vtkAnimationCueObserver;\n  }\n\n  virtual void Execute(vtkObject* vtkNotUsed(caller), unsigned long event,\n                       void* calldata)\n  {\n    if (this->Animator != 0 && this->Renderer != 0)\n    {\n      vtkAnimationCue::AnimationCueInfo* info =\n          static_cast<vtkAnimationCue::AnimationCueInfo*>(calldata);\n      switch (event)\n      {\n      case vtkCommand::StartAnimationCueEvent:\n        this->Animator->StartCue(info, this->Renderer);\n        break;\n      case vtkCommand::EndAnimationCueEvent:\n        this->Animator->EndCue(info, this->Renderer);\n        break;\n      case vtkCommand::AnimationCueTickEvent:\n        this->Animator->Tick(info, this->Renderer);\n        break;\n      }\n    }\n    if (this->RenWin != 0)\n    {\n      this->RenWin->Render();\n    }\n  }\n\n  vtkRenderer* Renderer;\n  vtkRenderWindow* RenWin;\n  CueAnimator* Animator;\n\nprotected:\n  vtkAnimationCueObserver()\n  {\n    this->Renderer = 0;\n    this->Animator = 0;\n    this->RenWin = 0;\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the graphics structure. The renderer renders into the\n  // render window.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetMultiSamples(0);\n  renWin->SetWindowName(\"AnimationScene\");\n\n  iren->SetRenderWindow(renWin);\n  renWin->AddRenderer(ren1);\n  ren1->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n  renWin->Render();\n\n  // Create an Animation Scene\n  vtkNew<vtkAnimationScene> scene;\n\n  scene->SetModeToRealTime();\n  // scene->SetModeToSequence();\n\n  scene->SetLoop(0);\n  scene->SetFrameRate(5);\n  scene->SetStartTime(3);\n  scene->SetEndTime(20);\n\n  // Create an Animation Cue.\n  vtkNew<vtkAnimationCue> cue1;\n  cue1->SetStartTime(5);\n  cue1->SetEndTime(23);\n  scene->AddCue(cue1);\n\n  // Create cue animator;\n  CueAnimator animator;\n\n  // Create Cue observer.\n  vtkNew<vtkAnimationCueObserver> observer;\n  observer->Renderer = ren1;\n  observer->Animator = &animator;\n  observer->RenWin = renWin;\n\n  cue1->AddObserver(vtkCommand::StartAnimationCueEvent, observer);\n  cue1->AddObserver(vtkCommand::EndAnimationCueEvent, observer);\n  cue1->AddObserver(vtkCommand::AnimationCueTickEvent, observer);\n\n  scene->Play();\n  scene->Stop();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/AnimationScene/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AnimationScene)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AnimationScene: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AnimationScene MACOSX_BUNDLE AnimationScene.cxx )\n  target_link_libraries(AnimationScene PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AnimationScene\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/AnimationScene/#download-and-build-animationscene","title":"Download and Build AnimationScene","text":"

        Click here to download AnimationScene and its CMakeLists.txt file. Once the tarball AnimationScene.tar has been downloaded and extracted,

        cd AnimationScene/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AnimationScene\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ArrayCalculator/","title":"ArrayCalculator","text":"

        vtk-examples/Cxx/Utilities/ArrayCalculator

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ArrayCalculator/#code","title":"Code","text":"

        ArrayCalculator.cxx

        #include <vtkArrayCalculator.h>\n#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(2.0, 0.0, 0.0);\n  points->InsertNextPoint(3.0, 0.0, 0.0);\n\n  vtkNew<vtkDoubleArray> array;\n  array->SetName(\"orig\");\n  array->InsertNextValue(1.0);\n  array->InsertNextValue(2.0);\n  array->InsertNextValue(3.0);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->AddArray(array);\n\n  vtkNew<vtkArrayCalculator> calc1;\n  calc1->SetInputData(polydata);\n  calc1->AddScalarArrayName(\"orig\");\n  calc1->SetFunction(\"orig+1\");\n  calc1->SetResultArrayName(\"orig\");\n  calc1->Update();\n\n  auto output1 = dynamic_cast<vtkDoubleArray*>(\n      calc1->GetPolyDataOutput()->GetPointData()->GetArray(\"orig\"));\n\n  for (vtkIdType i = 0; i < output1->GetNumberOfTuples(); i++)\n  {\n    double val = output1->GetValue(i);\n    cout << \"output1 value \" << i << \": \" << val << endl;\n  }\n\n  vtkNew<vtkArrayCalculator> calc2;\n  calc2->SetInputData(polydata);\n  calc2->AddScalarArrayName(\"orig\");\n  calc2->SetFunction(\"if(orig=2,1,orig)\");\n  calc2->SetResultArrayName(\"new\");\n  calc2->Update();\n\n  auto output2 = dynamic_cast<vtkDoubleArray*>(\n      calc2->GetPolyDataOutput()->GetPointData()->GetArray(\"new\"));\n\n  for (vtkIdType i = 0; i < output2->GetNumberOfTuples(); i++)\n  {\n    double val = output2->GetValue(i);\n    cout << \"output2 value \" << i << \": \" << val << endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ArrayCalculator/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ArrayCalculator)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ArrayCalculator: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ArrayCalculator MACOSX_BUNDLE ArrayCalculator.cxx )\n  target_link_libraries(ArrayCalculator PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ArrayCalculator\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ArrayCalculator/#download-and-build-arraycalculator","title":"Download and Build ArrayCalculator","text":"

        Click here to download ArrayCalculator and its CMakeLists.txt file. Once the tarball ArrayCalculator.tar has been downloaded and extracted,

        cd ArrayCalculator/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ArrayCalculator\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ArrayLookup/","title":"ArrayLookup","text":"

        vtk-examples/Cxx/Utilities/ArrayLookup

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ArrayLookup/#code","title":"Code","text":"

        ArrayLookup.cxx

        #include <vtkFloatArray.h>\n#include <vtkIdList.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFloatArray> distances;\n  distances->SetNumberOfComponents(1);\n  distances->SetName(\"Distances\");\n\n  distances->InsertNextValue(5);\n  distances->InsertNextValue(15);\n  distances->InsertNextValue(15);\n  distances->InsertNextValue(25);\n  distances->InsertNextValue(15);\n\n  // Get first location\n  vtkIdType result = distances->LookupValue(15);\n  std::cout << \"result: \" << result << std::endl;\n\n  // Get all locations\n  vtkNew<vtkIdList> idList;\n  distances->LookupValue(15, idList);\n  std::cout << \"found at: \" << std::endl;\n  for (vtkIdType i = 0; i < idList->GetNumberOfIds(); i++)\n  {\n    std::cout << idList->GetId(i) << \" \";\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ArrayLookup/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ArrayLookup)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ArrayLookup: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ArrayLookup MACOSX_BUNDLE ArrayLookup.cxx )\n  target_link_libraries(ArrayLookup PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ArrayLookup\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ArrayLookup/#download-and-build-arraylookup","title":"Download and Build ArrayLookup","text":"

        Click here to download ArrayLookup and its CMakeLists.txt file. Once the tarball ArrayLookup.tar has been downloaded and extracted,

        cd ArrayLookup/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ArrayLookup\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ArrayRange/","title":"ArrayRange","text":"

        vtk-examples/Cxx/Utilities/ArrayRange

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ArrayRange/#code","title":"Code","text":"

        ArrayRange.cxx

        #include <vtkFloatArray.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  /////////// Floats ///////////\n  {\n    vtkNew<vtkFloatArray> distances;\n    distances->SetNumberOfComponents(1);\n    distances->SetName(\"Distances\");\n\n    distances->InsertNextValue(5);\n    distances->InsertNextValue(15);\n    distances->InsertNextValue(25);\n\n    // Get min and max\n    double range[2];\n    distances->GetRange(range);\n    std::cout << \"range = \" << range[0] << \" \" << range[1] << std::endl;\n  }\n\n  /////////////// Ints //////////////\n  {\n    vtkNew<vtkIntArray> ints;\n    ints->SetNumberOfComponents(1);\n    ints->SetName(\"Ints\");\n\n    ints->InsertNextValue(5);\n    ints->InsertNextValue(15);\n    ints->InsertNextValue(25);\n\n    // Get min and max\n    int valuesRange[2];\n    ints->GetValueRange(valuesRange); // Note this is not GetRange()!\n    std::cout << \"valuesRange = \" << valuesRange[0] << \" \" << valuesRange[1]\n              << std::endl;\n  }\n\n  /////////// Range with negative values ///////////\n  {\n    vtkNew<vtkIntArray> ints;\n    ints->SetNumberOfComponents(1);\n    ints->SetName(\"Ints\");\n\n    ints->InsertNextValue(-50);\n    ints->InsertNextValue(15);\n    ints->InsertNextValue(25);\n\n    // Get min and max\n    int valuesRange[2];\n    ints->GetValueRange(valuesRange); // Note this is not GetRange()!\n    std::cout << \"valuesRange = \" << valuesRange[0] << \" \" << valuesRange[1]\n              << std::endl;\n  }\n\n  /////////// Magnitude range ///////////\n  {\n    vtkNew<vtkIntArray> ints;\n    ints->SetNumberOfComponents(1);\n    ints->SetName(\"Ints\");\n\n    ints->InsertNextValue(-50);\n    ints->InsertNextValue(15);\n    ints->InsertNextValue(25);\n\n    // Get min and max\n    int valuesRange[2];\n    ints->GetValueRange(valuesRange, -1);\n    std::cout << \"valuesRange = \" << valuesRange[0] << \" \" << valuesRange[1]\n              << std::endl;\n  }\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ArrayRange/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ArrayRange)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ArrayRange: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ArrayRange MACOSX_BUNDLE ArrayRange.cxx )\n  target_link_libraries(ArrayRange PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ArrayRange\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ArrayRange/#download-and-build-arrayrange","title":"Download and Build ArrayRange","text":"

        Click here to download ArrayRange and its CMakeLists.txt file. Once the tarball ArrayRange.tar has been downloaded and extracted,

        cd ArrayRange/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ArrayRange\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ArrayWriter/","title":"ArrayWriter","text":"

        vtk-examples/Cxx/Utilities/ArrayWriter

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ArrayWriter/#code","title":"Code","text":"

        ArrayWriter.cxx

        #include <vtkArrayData.h>\n#include <vtkArrayWriter.h>\n#include <vtkDenseArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDenseArray<double>> array;\n  array->Resize(1, 3);\n  array->SetValue(0, 0, 1.0);\n  array->SetValue(0, 1, 2.0);\n  array->SetValue(0, 2, 3.0);\n  {\n    // Method 1\n    vtkNew<vtkArrayWriter> writer;\n    vtkNew<vtkArrayData> arrayData;\n    arrayData->AddArray(array);\n    writer->SetInputData(arrayData);\n    vtkStdString file1 = \"Test1.txt\";\n    writer->Write(file1);\n  }\n  {\n    vtkStdString file2 = \"Test2.txt\";\n    // Method 2\n    vtkNew<vtkArrayWriter> writer;\n    writer->Write(array, file2);\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ArrayWriter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ArrayWriter)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  IOCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ArrayWriter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ArrayWriter MACOSX_BUNDLE ArrayWriter.cxx )\n  target_link_libraries(ArrayWriter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ArrayWriter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ArrayWriter/#download-and-build-arraywriter","title":"Download and Build ArrayWriter","text":"

        Click here to download ArrayWriter and its CMakeLists.txt file. Once the tarball ArrayWriter.tar has been downloaded and extracted,

        cd ArrayWriter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ArrayWriter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/BoundingBox/","title":"BoundingBox","text":"

        vtk-examples/Cxx/Utilities/BoundingBox

        "},{"location":"Cxx/Utilities/BoundingBox/#description","title":"Description","text":"

        Seealso

        Outline and CubeAxesActor2D

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/BoundingBox/#code","title":"Code","text":"

        BoundingBox.cxx

        #include <vtkBoundingBox.h>\n\nint main(int, char*[])\n{\n  double p0[3] = {0, 0, 0};\n  double p1[3] = {0.5, 0.5, 0.5};\n  double p2[3] = {1.0, 1.0, 1.0};\n\n  vtkBoundingBox boundingBox;\n\n  boundingBox.AddPoint(p0);\n\n  double bounds[6];\n\n  boundingBox.GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \", \" << bounds[2]\n            << \", \" << bounds[3] << \", \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n\n  // After adding this point, the box gets bigger\n  boundingBox.AddPoint(p2);\n\n  boundingBox.GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \", \" << bounds[2]\n            << \", \" << bounds[3] << \", \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n\n  // After adding this point, the box size does not change as the point is\n  // already inside the box\n  boundingBox.AddPoint(p1);\n\n  boundingBox.GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \", \" << bounds[2]\n            << \", \" << bounds[3] << \", \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/BoundingBox/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoundingBox)\n\nfind_package(VTK COMPONENTS \n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoundingBox: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoundingBox MACOSX_BUNDLE BoundingBox.cxx )\n  target_link_libraries(BoundingBox PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoundingBox\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/BoundingBox/#download-and-build-boundingbox","title":"Download and Build BoundingBox","text":"

        Click here to download BoundingBox and its CMakeLists.txt file. Once the tarball BoundingBox.tar has been downloaded and extracted,

        cd BoundingBox/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BoundingBox\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/BoundingBoxIntersection/","title":"BoundingBoxIntersection","text":"

        vtk-examples/Cxx/Utilities/BoundingBoxIntersection

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/BoundingBoxIntersection/#code","title":"Code","text":"

        BoundingBoxIntersection.cxx

        #include <vtkBoundingBox.h>\n\nint main(int, char*[])\n{\n  vtkBoundingBox boundingBox0;\n  boundingBox0.SetBounds(0, 1, 0, 1, 0, 1);\n\n  vtkBoundingBox boundingBox1;\n  boundingBox1.SetBounds(5, 6, 5, 6, 5, 6);\n\n  vtkBoundingBox boundingBox2;\n  boundingBox2.SetBounds(0.5, 1.5, 0.5, 1.5, 0.5, 1.5);\n\n  std::cout << boundingBox0.IntersectBox(boundingBox1)\n            << std::endl; // Should be 0\n  std::cout << boundingBox0.IntersectBox(boundingBox2)\n            << std::endl; // Should be 1\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/BoundingBoxIntersection/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoundingBoxIntersection)\n\nfind_package(VTK COMPONENTS \n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoundingBoxIntersection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoundingBoxIntersection MACOSX_BUNDLE BoundingBoxIntersection.cxx )\n  target_link_libraries(BoundingBoxIntersection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoundingBoxIntersection\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/BoundingBoxIntersection/#download-and-build-boundingboxintersection","title":"Download and Build BoundingBoxIntersection","text":"

        Click here to download BoundingBoxIntersection and its CMakeLists.txt file. Once the tarball BoundingBoxIntersection.tar has been downloaded and extracted,

        cd BoundingBoxIntersection/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BoundingBoxIntersection\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/Box/","title":"Box","text":"

        vtk-examples/Cxx/Utilities/Box

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/Box/#code","title":"Code","text":"

        Box.cxx

        #include <vtkBox.h>\n\nint main(int, char*[])\n{\n  // Define a box\n  double bounds[6] = {-1, 1, -1, 1, -1, 1};\n\n  // Define a ray\n  double rayOrigin[3] = {-5.0, 0, 0};\n  double rayDirection[3] = {1, 0, 0};\n\n  double intersection[3];\n  double t;\n\n  auto hit =\n      vtkBox::IntersectBox(bounds, rayOrigin, rayDirection, intersection, t);\n\n  if (!hit)\n  {\n    std::cout << \"Not hit!\" << std::endl;\n  }\n  else\n  {\n    // Intersection should be (-1.0, 0, 0)\n    std::cout << \"Intersection is \" << intersection[0] << \" \" << intersection[1]\n              << \" \" << intersection[2] << std::endl;\n    std::cout << \"t is \" << t << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/Box/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Box)\n\nfind_package(VTK COMPONENTS \n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Box: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Box MACOSX_BUNDLE Box.cxx )\n  target_link_libraries(Box PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Box\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/Box/#download-and-build-box","title":"Download and Build Box","text":"

        Click here to download Box and its CMakeLists.txt file. Once the tarball Box.tar has been downloaded and extracted,

        cd Box/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Box\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/BrownianPoints/","title":"BrownianPoints","text":"

        vtk-examples/Cxx/Utilities/BrownianPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/BrownianPoints/#code","title":"Code","text":"

        BrownianPoints.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkBrownianPoints.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Generate random vectors.\n  vtkMath::RandomSeed(5070); // for testing\n  vtkNew<vtkBrownianPoints> brownianPoints;\n  brownianPoints->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkArrowSource> arrowSource;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetSourceConnection(arrowSource->GetOutputPort());\n  glyph3D->SetInputConnection(brownianPoints->GetOutputPort());\n  glyph3D->SetScaleFactor(0.3);\n\n  // Create a mapper and actor for sphere.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->EdgeVisibilityOn();\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->SetMapper(mapper);\n\n  // Create a mapper and actor for glyphs.\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  glyphActor->SetMapper(glyphMapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(glyphActor);\n\n  // Create a nice view.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"BrownianPoints\");\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/BrownianPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BrownianPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BrownianPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BrownianPoints MACOSX_BUNDLE BrownianPoints.cxx )\n  target_link_libraries(BrownianPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BrownianPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/BrownianPoints/#download-and-build-brownianpoints","title":"Download and Build BrownianPoints","text":"

        Click here to download BrownianPoints and its CMakeLists.txt file. Once the tarball BrownianPoints.tar has been downloaded and extracted,

        cd BrownianPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BrownianPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/CameraModifiedEvent/","title":"CameraModifiedEvent","text":"

        vtk-examples/Cxx/Utilities/CameraModifiedEvent

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/CameraModifiedEvent/#code","title":"Code","text":"

        CameraModifiedEvent.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid CameraModifiedCallback(vtkObject* caller,\n                            long unsigned int vtkNotUsed(eventId),\n                            void* vtkNotUsed(clientData),\n                            void* vtkNotUsed(callData))\n{\n  std::cout << caller->GetClassName() << \" modified\" << std::endl;\n\n  vtkCamera* camera = static_cast<vtkCamera*>(caller);\n  // Print the interesting stuff.\n  std::cout << \"\\tPosition: \" << camera->GetPosition()[0] << \", \"\n            << camera->GetPosition()[1] << \", \" << camera->GetPosition()[2]\n            << std::endl;\n  std::cout << \"\\tFocal point: \" << camera->GetFocalPoint()[0] << \", \"\n            << camera->GetFocalPoint()[1] << \", \" << camera->GetFocalPoint()[2]\n            << std::endl;\n}\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CameraModifiedEvent\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkCallbackCommand> modifiedCallback;\n  modifiedCallback->SetCallback(CameraModifiedCallback);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->AddObserver(vtkCommand::ModifiedEvent,\n                                           modifiedCallback);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/CameraModifiedEvent/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraModifiedEvent)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraModifiedEvent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraModifiedEvent MACOSX_BUNDLE CameraModifiedEvent.cxx )\n  target_link_libraries(CameraModifiedEvent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraModifiedEvent\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/CameraModifiedEvent/#download-and-build-cameramodifiedevent","title":"Download and Build CameraModifiedEvent","text":"

        Click here to download CameraModifiedEvent and its CMakeLists.txt file. Once the tarball CameraModifiedEvent.tar has been downloaded and extracted,

        cd CameraModifiedEvent/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CameraModifiedEvent\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/CardinalSpline/","title":"CardinalSpline","text":"

        vtk-examples/Cxx/Utilities/CardinalSpline

        "},{"location":"Cxx/Utilities/CardinalSpline/#description","title":"Description","text":"

        This example takes two points that have associated scalar values and allows you to interpolate the value at any point on the line between them using cardinal spline interpolation.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/CardinalSpline/#code","title":"Code","text":"

        CardinalSpline.cxx

        #include <vtkCardinalSpline.h>\n#include <vtkFloatArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  // Create a scalar array.  The array could be associated with the scalars of a\n  // vtkDataSet\n  vtkNew<vtkFloatArray> distances;\n  distances->SetNumberOfComponents(1);\n  distances->SetName(\"Distances\");\n  distances->InsertNextValue(100.0);\n  distances->InsertNextValue(300.0);\n\n  // Create a cardinal spline to show how to linearly interpolate between two\n  // scalar values\n  vtkNew<vtkCardinalSpline> spline;\n  spline->ClosedOff();\n\n  // Set the left and right second derivatives to 0 corresponding to linear\n  // interpolation\n  spline->SetLeftConstraint(2);\n  spline->SetLeftValue(0);\n  spline->SetRightConstraint(2);\n  spline->SetRightValue(0);\n  double* r = distances->GetRange();\n  double xmin = r[0];\n  double xmax = r[1];\n  double length = xmax - xmin;\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); ++i)\n  {\n    double x = distances->GetTuple1(i);\n    double t = (x - xmin) / length;\n    spline->AddPoint(t, x);\n  }\n\n  // Evaluate every 50 distance units along the line\n  std::cout << \"Spline interpolation:\" << std::endl;\n  double dt = .25;\n  for (double t = dt; t <= 1. - dt; t += dt)\n  {\n    std::cout << \"t: \" << t << \" value = \" << spline->Evaluate(t) << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/CardinalSpline/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CardinalSpline)\n\nfind_package(VTK COMPONENTS \n  CommonComputationalGeometry\n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CardinalSpline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CardinalSpline MACOSX_BUNDLE CardinalSpline.cxx )\n  target_link_libraries(CardinalSpline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CardinalSpline\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/CardinalSpline/#download-and-build-cardinalspline","title":"Download and Build CardinalSpline","text":"

        Click here to download CardinalSpline and its CMakeLists.txt file. Once the tarball CardinalSpline.tar has been downloaded and extracted,

        cd CardinalSpline/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CardinalSpline\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/CheckVTKVersion/","title":"CheckVTKVersion","text":"

        vtk-examples/Cxx/Utilities/CheckVTKVersion

        "},{"location":"Cxx/Utilities/CheckVTKVersion/#description","title":"Description","text":"

        This example demonstrates how to check the VTK version with vtkVersion.

        Also demonstrated is the usage of the various version macros.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/CheckVTKVersion/#code","title":"Code","text":"

        CheckVTKVersion.cxx

        #include <vtkNew.h>\n#include <vtkVersion.h>\n\n#include <array>\n#include <vector>\n\n#ifdef VTK_VERSION_NUMBER\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define VTK_HAS_COW 1\n#endif\n#endif\n\n#if VTK_HAS_COW\n// Add any specific includes here.\n// #include <vtkCameraOrientationWidget.h>\n#endif\n\nnamespace {\n/**\n * Check the VTK version.\n *\n * @param major: Major version.\n * @param major: Minor version.\n * @param major: Build version.\n *\n * @return true if the requested VTK version is greater or equal to the actual\n * VTK version.\n */\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build);\n\n} // namespace\n\nint main(int, char*[])\n{\n  std::cout << \"VTK Version: \" << vtkVersion::GetVTKVersion() << std::endl;\n\n  // We can check and exit if the VTK version is too old.\n  if (!VTKVersionOk(9, 0, 0))\n  {\n    std::cerr << \"You need VTK version 9.0.0 or greater to run this program.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::vector<std::array<int, 3>> testVersions = {{9, 2, 20220831}, {9, 19, 0}};\n  for (auto const& ver : testVersions)\n  {\n    if (VTKVersionOk(ver[0], ver[1], ver[2]))\n    {\n      std::cout << \"This code works for VTK Versions >= \" << ver[0] << \".\"\n                << ver[1] << \".\" << ver[2] << std::endl;\n    }\n    else\n    {\n      std::cout << \"You need VTK Version \" << ver[0] << \".\" << ver[1] << \".\"\n                << ver[2] << \" or greater.\" << std::endl;\n    }\n  }\n\n  // If we want to use alternative code do it this way.\n#ifdef VTK_HAS_COW\n  std::cout << \"Using vtkCameraOrientationWidget.\" << std::endl;\n#else\n  std::cout << \"Fallback to using vtkAxesActor\" << std::endl;\n#endif\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nbool VTKVersionOk(unsigned long long const& major,\n                  unsigned long long const& minor,\n                  unsigned long long const& build)\n{\n  unsigned long long neededVersion =\n      10000000000ULL * major + 100000000ULL * minor + build;\n  auto res = false;\n#ifndef VTK_VERSION_NUMBER\n  vtkNew<vtkVersion> ver;\n  unsigned long long vtk_version_number =\n      10000000000ULL * ver->GetVTKMajorVersion() +\n      100000000ULL * ver->GetVTKMinorVersion() + ver->GetVTKBuildVersion();\n  res = vtk_version_number >= neededVersion;\n#else\n  res = VTK_VERSION_NUMBER >= neededVersion;\n#endif\n  return res;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Utilities/CheckVTKVersion/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CheckVTKVersion)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  InteractionWidgets\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CheckVTKVersion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CheckVTKVersion MACOSX_BUNDLE CheckVTKVersion.cxx )\n  target_link_libraries(CheckVTKVersion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CheckVTKVersion\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/CheckVTKVersion/#download-and-build-checkvtkversion","title":"Download and Build CheckVTKVersion","text":"

        Click here to download CheckVTKVersion and its CMakeLists.txt file. Once the tarball CheckVTKVersion.tar has been downloaded and extracted,

        cd CheckVTKVersion/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CheckVTKVersion\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ColorLookupTable/","title":"ColorLookupTable","text":"

        vtk-examples/Cxx/Utilities/ColorLookupTable

        "},{"location":"Cxx/Utilities/ColorLookupTable/#description","title":"Description","text":"

        This example shows how to create a table of colors that map from a continuous range of values.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ColorLookupTable/#code","title":"Code","text":"

        ColorLookupTable.cxx

        #include <vtkLookupTable.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkLookupTable> lookupTable;\n\n  lookupTable->SetTableRange(0.0, 10.0);\n  // If you don't want to use the whole color range, you can use\n  // SetValueRange, SetHueRange, and SetSaturationRange\n  lookupTable->Build();\n\n  double color[3];\n  lookupTable->GetColor(1.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  lookupTable->GetColor(5.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ColorLookupTable/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorLookupTable)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorLookupTable: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorLookupTable MACOSX_BUNDLE ColorLookupTable.cxx )\n  target_link_libraries(ColorLookupTable PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorLookupTable\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ColorLookupTable/#download-and-build-colorlookuptable","title":"Download and Build ColorLookupTable","text":"

        Click here to download ColorLookupTable and its CMakeLists.txt file. Once the tarball ColorLookupTable.tar has been downloaded and extracted,

        cd ColorLookupTable/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorLookupTable\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ColorMapToLUT/","title":"ColorMapToLUT","text":"

        vtk-examples/Cxx/Utilities/ColorMapToLUT

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Utilities/ColorMapToLUT/#description","title":"Description","text":"

        Demonstrate a cone using the vtkDiscretizableColorTransferFunction to generate the colormap.

        These two Python functions can be used to generate C++ and Python functions from a JSON or XML colormap. They can then be copied into ColorMapToLUT.cxx, ColorMapToLUT.py or into your own code.

        • ColorMapToLUT_XML
        • ColorMapToLUT_JSON

        Feel free to use either of these programs to generate different colormaps until you find one you like.

        A good initial source for color maps is: SciVisColor -- this will provide you with plenty of XML examples.

        ColorMapToLUT_JSON will allow you to select colormaps by name from ParaView Default Colormaps.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ColorMapToLUT/#code","title":"Code","text":"

        ColorMapToLUT.cxx

        #include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkDiscretizableColorTransferFunction.h>\n#include <vtkElevationFilter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n// #include <vtkSphereSource.h>\n\n#include <array>\n\nnamespace {\nvtkNew<vtkDiscretizableColorTransferFunction> GetCTF();\n\n}\n\nint main(int, char*[])\n{\n  std::array<unsigned char, 4> bkg{82, 87, 110, 255};\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"ParaViewBkg\", bkg.data());\n\n  vtkNew<vtkRenderer> ren;\n  ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ColorMapToLUT\");\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  // vtkNew<vtkSphereSource> sphere;\n  // sphere->SetThetaResolution(64);\n  // sphere->SetPhiResolution(32);\n  // auto bounds = sphere->GetOutput()->GetBounds();\n\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(6);\n  cone->SetDirection(0, 1, 0);\n  cone->SetHeight(1);\n  cone->Update();\n  auto bounds = cone->GetOutput()->GetBounds();\n\n  vtkNew<vtkElevationFilter> elevation_filter;\n  elevation_filter->SetLowPoint(0, bounds[2], 0);\n  elevation_filter->SetHighPoint(0, bounds[3], 0);\n  elevation_filter->SetInputConnection(cone->GetOutputPort());\n  // elevation_filter->SetInputConnection(sphere->GetOutputPort());\n\n  auto ctf = GetCTF();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(elevation_filter->GetOutputPort());\n  mapper->SetLookupTable(ctf);\n  mapper->SetColorModeToMapScalars();\n  mapper->InterpolateScalarsBeforeMappingOn();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  ren->AddActor(actor);\n\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkNew<vtkDiscretizableColorTransferFunction> GetCTF()\n{\n  // name: Fast, creator: Francesca Samsel and Alan W. Scott\n  // interpolationspace: lab, interpolationtype: linear, space: RGB\n  // file name: Fast.xml\n\n  vtkNew<vtkDiscretizableColorTransferFunction> ctf;\n\n  ctf->SetColorSpaceToLab();\n  ctf->SetScaleToLinear();\n\n  ctf->SetNanColor(0, 0, 0);\n  ctf->SetAboveRangeColor(0, 0, 0);\n  ctf->UseAboveRangeColorOn();\n  ctf->SetBelowRangeColor(0, 0, 0);\n  ctf->UseBelowRangeColorOn();\n\n  ctf->AddRGBPoint(0, 0.05639999999999999, 0.05639999999999999, 0.47);\n  ctf->AddRGBPoint(0.17159223942480895, 0.24300000000000013, 0.4603500000000004,\n                   0.81);\n  ctf->AddRGBPoint(0.2984914818394138, 0.3568143826543521, 0.7450246485363142,\n                   0.954367702893722);\n  ctf->AddRGBPoint(0.4321287371255907, 0.6882, 0.93, 0.9179099999999999);\n  ctf->AddRGBPoint(0.5, 0.8994959551205902, 0.944646394975174,\n                   0.7686567142818399);\n  ctf->AddRGBPoint(0.5882260353170073, 0.957107977357604, 0.8338185108985666,\n                   0.5089156299842102);\n  ctf->AddRGBPoint(0.7061412605695164, 0.9275207599610714, 0.6214389091739178,\n                   0.31535705838676426);\n  ctf->AddRGBPoint(0.8476395308725272, 0.8, 0.3520000000000001,\n                   0.15999999999999998);\n  ctf->AddRGBPoint(1, 0.59, 0.07670000000000013, 0.11947499999999994);\n\n  ctf->SetNumberOfValues(9);\n  ctf->DiscretizeOff();\n\n  return ctf;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Utilities/ColorMapToLUT/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorMapToLUT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorMapToLUT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorMapToLUT MACOSX_BUNDLE ColorMapToLUT.cxx )\n  target_link_libraries(ColorMapToLUT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorMapToLUT\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ColorMapToLUT/#download-and-build-colormaptolut","title":"Download and Build ColorMapToLUT","text":"

        Click here to download ColorMapToLUT and its CMakeLists.txt file. Once the tarball ColorMapToLUT.tar has been downloaded and extracted,

        cd ColorMapToLUT/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorMapToLUT\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ColorTransferFunction/","title":"ColorTransferFunction","text":"

        vtk-examples/Cxx/Utilities/ColorTransferFunction

        "},{"location":"Cxx/Utilities/ColorTransferFunction/#description","title":"Description","text":"

        This example demonstrates how to map the values (0.0 to 10.0) to the colors (red to green).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ColorTransferFunction/#code","title":"Code","text":"

        ColorTransferFunction.cxx

        #include <vtkColorTransferFunction.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkColorTransferFunction> colorTransferFunction;\n\n  colorTransferFunction->AddRGBPoint(0.0, 1, 0, 0);\n  colorTransferFunction->AddRGBPoint(10.0, 0, 1, 0);\n\n  double color[3];\n  colorTransferFunction->GetColor(1.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  colorTransferFunction->GetColor(5.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ColorTransferFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorTransferFunction)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorTransferFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorTransferFunction MACOSX_BUNDLE ColorTransferFunction.cxx )\n  target_link_libraries(ColorTransferFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorTransferFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ColorTransferFunction/#download-and-build-colortransferfunction","title":"Download and Build ColorTransferFunction","text":"

        Click here to download ColorTransferFunction and its CMakeLists.txt file. Once the tarball ColorTransferFunction.tar has been downloaded and extracted,

        cd ColorTransferFunction/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorTransferFunction\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/CommandSubclass/","title":"CommandSubclass","text":"

        vtk-examples/Cxx/Utilities/CommandSubclass

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/CommandSubclass/#code","title":"Code","text":"

        CommandSubclass.cxx

        #include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\n// We wil use these to destroy the timer after maxCounter times.\nunsigned int counter = 0;\nunsigned int maxCounter = 5;\nvtkRenderWindowInteractor* iren;\n\nclass CommandSubclass2 : public vtkCommand\n{\npublic:\n  vtkTypeMacro(CommandSubclass2, vtkCommand);\n\n  static CommandSubclass2* New()\n  {\n    return new CommandSubclass2;\n  }\n\n  void Execute(vtkObject* vtkNotUsed(caller), unsigned long vtkNotUsed(eventId),\n               void* vtkNotUsed(callData))\n  {\n    std::cout << \"Timer callback\" << std::endl;\n    if (counter > maxCounter)\n    {\n      iren->DestroyTimer();\n    }\n    counter++;\n  }\n};\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CommandSubclass\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Initialize must be called prior to creating timer events.\n  renderWindowInteractor->Initialize();\n  iren = renderWindowInteractor;\n\n  vtkNew<CommandSubclass2> timerCallback;\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, timerCallback);\n  auto timerId = renderWindowInteractor->CreateRepeatingTimer(500);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/CommandSubclass/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CommandSubclass)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CommandSubclass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CommandSubclass MACOSX_BUNDLE CommandSubclass.cxx )\n  target_link_libraries(CommandSubclass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CommandSubclass\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/CommandSubclass/#download-and-build-commandsubclass","title":"Download and Build CommandSubclass","text":"

        Click here to download CommandSubclass and its CMakeLists.txt file. Once the tarball CommandSubclass.tar has been downloaded and extracted,

        cd CommandSubclass/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CommandSubclass\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ConstructTable/","title":"ConstructTable","text":"

        vtk-examples/Cxx/Utilities/ConstructTable

        "},{"location":"Cxx/Utilities/ConstructTable/#description","title":"Description","text":"

        This example creates a 3x3 table. The columns MUST be added first - if you attempt to call AddRow type functions, they will not do anything (or produce errors) because the table still has 0 columns until you tell it otherwise. This example adds 3 empty columns to the table, then goes back and fills them in.

        Warning: the table does not copy the data, so if you add the SAME column to the table each time, i.e.

        [vtkSmartPointer](https://www.vtk.org/doc/nightly/html/classvtkSmartPointer.html#details)<[vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)Array> col = [vtkSmartPointer](https://www.vtk.org/doc/nightly/html/classvtkSmartPointer.html#details)<[vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)Array>::New();\n\ncol->InsertNextValue([vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)(0.0));\ncol->InsertNextValue([vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)(0.0));\ncol->InsertNextValue([vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)(0.0));\ntable->AddColumn(Col);\ntable->AddColumn(Col);\ntable->AddColumn(Col);\n

        If you modify one of the entries in the table with Table->SetValue (r, c, [vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)(counter)); after they have all been set to the same column, the rth entry in EVERY column will be changed.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ConstructTable/#code","title":"Code","text":"

        ConstructTable.cxx

        #include <vtkNew.h>\n#include <vtkTable.h>\n#include <vtkVariant.h>\n#include <vtkVariantArray.h>\n\nint main(int, char*[])\n{\n  // construct an empty table\n  vtkNew<vtkTable> table;\n\n  for (unsigned int i = 0; i < 3; i++)\n  {\n    vtkNew<vtkVariantArray> col;\n\n    col->InsertNextValue(vtkVariant(0.0));\n    col->InsertNextValue(vtkVariant(0.0));\n    col->InsertNextValue(vtkVariant(0.0));\n    table->AddColumn(col);\n  }\n\n  // fill the table with values\n  unsigned int counter = 0;\n  for (vtkIdType r = 0; r < table->GetNumberOfRows(); r++)\n  {\n    for (vtkIdType c = 0; c < table->GetNumberOfColumns(); c++)\n    {\n      table->SetValue(r, c, vtkVariant(counter));\n      counter++;\n    }\n  }\n\n  // print information about the table\n  std::cout << \"NumRows: \" << table->GetNumberOfRows() << std::endl;\n  std::cout << \"NumCols: \" << table->GetNumberOfColumns() << std::endl;\n\n  // display the table\n  table->Dump(3);\n\n  // access elements of the table\n  for (vtkIdType r = 0; r < table->GetNumberOfRows(); r++)\n  {\n    for (vtkIdType c = 0; c < table->GetNumberOfColumns(); c++)\n    {\n      vtkVariant v = table->GetValue(r, c);\n      std::cout << \"(r,c) = (\" << r << \",\" << c << \") = \" << v << std::endl;\n    }\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ConstructTable/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ConstructTable)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ConstructTable: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ConstructTable MACOSX_BUNDLE ConstructTable.cxx )\n  target_link_libraries(ConstructTable PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ConstructTable\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ConstructTable/#download-and-build-constructtable","title":"Download and Build ConstructTable","text":"

        Click here to download ConstructTable and its CMakeLists.txt file. Once the tarball ConstructTable.tar has been downloaded and extracted,

        cd ConstructTable/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ConstructTable\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/Coordinate/","title":"Coordinate","text":"

        vtk-examples/Cxx/Utilities/Coordinate

        "},{"location":"Cxx/Utilities/Coordinate/#description","title":"Description","text":"

        There are many possible coordinate conversions. This example demonstrates NormalizedDisplay->Display.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/Coordinate/#code","title":"Code","text":"

        Coordinate.cxx

        #include <vtkCoordinate.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkRenderWindow> rendererWindow;\n\n  vtkNew<vtkRenderer> renderer;\n  rendererWindow->AddRenderer(renderer);\n  rendererWindow->Render();\n\n  vtkNew<vtkCoordinate> coordinate;\n  coordinate->SetCoordinateSystemToNormalizedDisplay();\n  coordinate->SetValue(.5, .5, 0);\n  std::cout << *coordinate << std::endl;\n  std::cout << coordinate->GetCoordinateSystemAsString() << std::endl;\n\n  int* val;\n  val = coordinate->GetComputedDisplayValue(renderer);\n  std::cout << \"Val: \" << val[0] << \" \" << val[1] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/Coordinate/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Coordinate)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Coordinate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Coordinate MACOSX_BUNDLE Coordinate.cxx )\n  target_link_libraries(Coordinate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Coordinate\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/Coordinate/#download-and-build-coordinate","title":"Download and Build Coordinate","text":"

        Click here to download Coordinate and its CMakeLists.txt file. Once the tarball Coordinate.tar has been downloaded and extracted,

        cd Coordinate/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Coordinate\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/CustomDenseArray/","title":"CustomDenseArray","text":"

        vtk-examples/Cxx/Utilities/CustomDenseArray

        "},{"location":"Cxx/Utilities/CustomDenseArray/#description","title":"Description","text":"

        The only thing you have to do to enable your class to work with vtkDenseArray is add a single line:

        operator [vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)() const { return [vtkVariant](https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details)(); }\n

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/CustomDenseArray/#code","title":"Code","text":"

        CustomDenseArray.cxx

        #include <vtkDenseArray.h>\n#include <vtkNew.h>\n\nstruct Point\n{\n  double x, y;\n\n  operator vtkVariant() const\n  {\n    return vtkVariant();\n  }\n};\n\nint main(int, char*[])\n{\n  Point point;\n  point.x = 1.0;\n  point.y = 2.0;\n\n  std::cout << point.x << \" \" << point.y << std::endl;\n\n  vtkNew<vtkDenseArray<Point>> array;\n  array->Resize(5, 5);\n\n  array->SetValue(4, 4, point);\n\n  Point retrievedPoint = array->GetValue(4, 4);\n  std::cout << retrievedPoint.x << \" \" << retrievedPoint.y << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/CustomDenseArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CustomDenseArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CustomDenseArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CustomDenseArray MACOSX_BUNDLE CustomDenseArray.cxx )\n  target_link_libraries(CustomDenseArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CustomDenseArray\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/CustomDenseArray/#download-and-build-customdensearray","title":"Download and Build CustomDenseArray","text":"

        Click here to download CustomDenseArray and its CMakeLists.txt file. Once the tarball CustomDenseArray.tar has been downloaded and extracted,

        cd CustomDenseArray/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CustomDenseArray\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/DataAnimation/","title":"DataAnimation","text":"

        vtk-examples/Cxx/Utilities/DataAnimation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Utilities/DataAnimation/#description","title":"Description","text":"

        This causes one point of the sphere to be moved outwards at each iteration.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/DataAnimation/#code","title":"Code","text":"

        DataAnimation.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProgrammableFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid TimerCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                           void* clientData, void* callData);\n\nunsigned int counter = 0;\nunsigned int maxCount = 6;\n\nvoid AdjustPoints2(void* arguments)\n{\n  std::cout << \"AdjustPoints2\" << std::endl;\n  vtkProgrammableFilter* programmableFilter =\n      static_cast<vtkProgrammableFilter*>(arguments);\n\n  vtkPoints* inPts = programmableFilter->GetPolyDataInput()->GetPoints();\n  vtkIdType numPts = inPts->GetNumberOfPoints();\n  vtkNew<vtkPoints> newPts;\n  newPts->SetNumberOfPoints(numPts);\n\n  for (vtkIdType i = 0; i < numPts; i++)\n  {\n    double p[3];\n    inPts->GetPoint(i, p);\n    newPts->SetPoint(i, p);\n  }\n\n  double p0[3];\n  inPts->GetPoint(0, p0);\n  p0[2] = p0[2] + counter * 0.1;\n  newPts->SetPoint(0, p0);\n\n  programmableFilter->GetPolyDataOutput()->CopyStructure(\n      programmableFilter->GetPolyDataInput());\n  programmableFilter->GetPolyDataOutput()->SetPoints(newPts);\n}\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkProgrammableFilter> programmableFilter;\n  programmableFilter->SetInputConnection(sphereSource->GetOutputPort());\n\n  programmableFilter->SetExecuteMethod(AdjustPoints2, programmableFilter);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(programmableFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DataAnimation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Initialize must be called prior to creating timer events.\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->CreateRepeatingTimer(500);\n\n  vtkNew<vtkCallbackCommand> timerCallback;\n  timerCallback->SetCallback(TimerCallbackFunction);\n  timerCallback->SetClientData(programmableFilter);\n\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, timerCallback);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(2.26841, -1.51874, 1.805);\n  camera->SetFocalPoint(-0.148582, 0.0814323, 0.24803);\n  camera->SetViewUp(0.157813, 0.800687, 0.577923);\n  camera->SetDistance(3.29037);\n  camera->SetClippingRange(1.14823, 5.60288);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid TimerCallbackFunction(vtkObject* caller,\n                           long unsigned int vtkNotUsed(eventId),\n                           void* clientData, void* vtkNotUsed(callData))\n{\n  cout << \"timer callback\" << endl;\n\n  auto programmableFilter = static_cast<vtkProgrammableFilter*>(clientData);\n\n  vtkRenderWindowInteractor* iren =\n      static_cast<vtkRenderWindowInteractor*>(caller);\n\n  programmableFilter->Modified();\n\n  iren->Render();\n\n  if (counter > maxCount)\n  {\n    iren->DestroyTimer();\n  }\n\n  counter++;\n}\n} // namespace\n
        "},{"location":"Cxx/Utilities/DataAnimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataAnimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersProgrammable\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataAnimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataAnimation MACOSX_BUNDLE DataAnimation.cxx )\n  target_link_libraries(DataAnimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataAnimation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/DataAnimation/#download-and-build-dataanimation","title":"Download and Build DataAnimation","text":"

        Click here to download DataAnimation and its CMakeLists.txt file. Once the tarball DataAnimation.tar has been downloaded and extracted,

        cd DataAnimation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DataAnimation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/DataAnimationSubclass/","title":"DataAnimationSubclass","text":"

        vtk-examples/Cxx/Utilities/DataAnimationSubclass

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/DataAnimationSubclass/#code","title":"Code","text":"

        DataAnimationSubclass.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProgrammableFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nunsigned int counter = 0;\n\nclass CommandSubclass : public vtkCommand\n{\npublic:\n  vtkTypeMacro(CommandSubclass, vtkCommand);\n  static CommandSubclass* New()\n  {\n    return new CommandSubclass;\n  }\n\n  void Execute(vtkObject* caller, unsigned long vtkNotUsed(eventId),\n               void* vtkNotUsed(callData)) override\n  {\n    std::cout << \"Timer callback\" << std::endl;\n\n    vtkRenderWindowInteractor* iren =\n        static_cast<vtkRenderWindowInteractor*>(caller);\n\n    this->ProgrammableFilter->Modified();\n\n    iren->Render();\n\n    if (counter > maxCount)\n    {\n      iren->DestroyTimer();\n    }\n  }\n  vtkSmartPointer<vtkProgrammableFilter> ProgrammableFilter;\n\npublic:\n  unsigned int maxCount = 7;\n};\n\nvoid AdjustPoints(void* arguments);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkProgrammableFilter> programmableFilter;\n  programmableFilter->SetInputConnection(sphereSource->GetOutputPort());\n  programmableFilter->SetExecuteMethod(AdjustPoints, programmableFilter);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(programmableFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DataAnimationWSubclass\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Initialize must be called prior to creating timer events.\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->CreateRepeatingTimer(500);\n\n  vtkNew<CommandSubclass> timerCallback;\n  timerCallback->ProgrammableFilter = programmableFilter;\n\n  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, timerCallback);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(2.26841, -1.51874, 1.805);\n  camera->SetFocalPoint(-0.148582, 0.0814323, 0.24803);\n  camera->SetViewUp(0.157813, 0.800687, 0.577923);\n  camera->SetDistance(3.29037);\n  camera->SetClippingRange(1.14823, 5.60288);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid AdjustPoints(void* arguments)\n{\n  std::cout << \"AdjustPoints\" << std::endl;\n  auto programmableFilter = static_cast<vtkProgrammableFilter*>(arguments);\n\n  vtkPoints* inPts = programmableFilter->GetPolyDataInput()->GetPoints();\n  vtkIdType numPts = inPts->GetNumberOfPoints();\n  vtkNew<vtkPoints> newPts;\n  newPts->SetNumberOfPoints(numPts);\n\n  for (vtkIdType i = 0; i < numPts; i++)\n  {\n    double p[3];\n    inPts->GetPoint(i, p);\n    newPts->SetPoint(i, p);\n  }\n\n  double p0[3];\n  inPts->GetPoint(0, p0);\n  p0[2] = p0[2] + counter * 0.1;\n  newPts->SetPoint(0, p0);\n\n  programmableFilter->GetPolyDataOutput()->CopyStructure(\n      programmableFilter->GetPolyDataInput());\n  programmableFilter->GetPolyDataOutput()->SetPoints(newPts);\n  counter++;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Utilities/DataAnimationSubclass/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataAnimationSubclass)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersProgrammable\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataAnimationSubclass: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataAnimationSubclass MACOSX_BUNDLE DataAnimationSubclass.cxx )\n  target_link_libraries(DataAnimationSubclass PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataAnimationSubclass\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/DataAnimationSubclass/#download-and-build-dataanimationsubclass","title":"Download and Build DataAnimationSubclass","text":"

        Click here to download DataAnimationSubclass and its CMakeLists.txt file. Once the tarball DataAnimationSubclass.tar has been downloaded and extracted,

        cd DataAnimationSubclass/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DataAnimationSubclass\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/DeepCopy/","title":"DeepCopy","text":"

        vtk-examples/Cxx/Utilities/DeepCopy

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/DeepCopy/#code","title":"Code","text":"

        DeepCopy.cxx

        #include <vtkNew.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPolyData> polydata;\n\n  vtkNew<vtkPolyData> polydataCopy;\n\n  polydataCopy->DeepCopy(polydata);\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/DeepCopy/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DeepCopy)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DeepCopy: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DeepCopy MACOSX_BUNDLE DeepCopy.cxx )\n  target_link_libraries(DeepCopy PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DeepCopy\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/DeepCopy/#download-and-build-deepcopy","title":"Download and Build DeepCopy","text":"

        Click here to download DeepCopy and its CMakeLists.txt file. Once the tarball DeepCopy.tar has been downloaded and extracted,

        cd DeepCopy/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DeepCopy\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/DenseArrayRange/","title":"DenseArrayRange","text":"

        vtk-examples/Cxx/Utilities/DenseArrayRange

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/DenseArrayRange/#code","title":"Code","text":"

        DenseArrayRange.cxx

        #include <vtkDenseArray.h>\n#include <vtkNew.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDenseArray<double>> array;\n  array->Resize(5, 1);\n\n  for (unsigned int i = 0; i < 5; i++)\n  {\n    array->SetValue(i, 0, 2.0 + i);\n    double val = array->GetValue(i, 0);\n    std::cout << \"val: \" << val << std::endl;\n  }\n\n  // int extent = array->GetExtents()[1];\n  int dim1start = array->GetExtent(0).GetBegin();\n  int dim1end = array->GetExtent(0).GetEnd();\n  std::cout << \"dim1: \" << dim1start << \" to \" << dim1end << std::endl;\n  // int dim2 = array->GetExtent(1)[1];\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/DenseArrayRange/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DenseArrayRange)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DenseArrayRange: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DenseArrayRange MACOSX_BUNDLE DenseArrayRange.cxx )\n  target_link_libraries(DenseArrayRange PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DenseArrayRange\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/DenseArrayRange/#download-and-build-densearrayrange","title":"Download and Build DenseArrayRange","text":"

        Click here to download DenseArrayRange and its CMakeLists.txt file. Once the tarball DenseArrayRange.tar has been downloaded and extracted,

        cd DenseArrayRange/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DenseArrayRange\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/DetermineActorType/","title":"DetermineActorType","text":"

        vtk-examples/Cxx/Utilities/DetermineActorType

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/DetermineActorType/#code","title":"Code","text":"

        DetermineActorType.cxx

        #include <vtkActor.h>\n#include <vtkActorCollection.h>\n#include <vtkCamera.h>\n#include <vtkCubeAxesActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Cube axes\n  vtkNew<vtkCubeAxesActor> cubeAxesActor;\n\n  // Create a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  cubeAxesActor->SetCamera(renderer->GetActiveCamera());\n  cubeAxesActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  renderer->AddActor(actor);\n  renderer->AddActor(cubeAxesActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Determine the types of the actors - method 1\n  {\n    std::cout << \"Method 1:\" << std::endl;\n    vtkActorCollection* actorCollection = renderer->GetActors();\n    actorCollection->InitTraversal();\n\n    for (vtkIdType i = 0; i < actorCollection->GetNumberOfItems(); i++)\n    {\n      vtkActor* nextActor = actorCollection->GetNextActor();\n      std::cout << \"nextActor \" << i << \" : \" << nextActor->GetClassName()\n                << std::endl;\n      std::string className = nextActor->GetClassName();\n      std::string wantedClass = \"vtkCubeAxesActor\";\n      if (className == wantedClass)\n      {\n        std::cout << \"nextActor \" << i << \" is a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n      else\n      {\n        std::cout << \"nextActor \" << i << \" is NOT a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n    }\n  }\n\n  // Determine the types of the actors - method 2\n  {\n    std::cout << \"Method 2:\" << std::endl;\n    vtkActorCollection* actorCollection = renderer->GetActors();\n    actorCollection->InitTraversal();\n\n    for (vtkIdType i = 0; i < actorCollection->GetNumberOfItems(); i++)\n    {\n      vtkActor* nextActor = actorCollection->GetNextActor();\n      std::cout << \"nextActor \" << i << \" : \" << nextActor->GetClassName()\n                << std::endl;\n      if (nextActor->IsA(\"vtkCubeAxesActor\"))\n      {\n        std::cout << \"nextActor \" << i << \" is a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n      else\n      {\n        std::cout << \"nextActor \" << i << \" is NOT a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n    }\n  }\n\n  // Determine the types of the actors - method 3\n  {\n    std::cout << \"Method 3:\" << std::endl;\n    vtkActorCollection* actorCollection = renderer->GetActors();\n    actorCollection->InitTraversal();\n\n    for (vtkIdType i = 0; i < actorCollection->GetNumberOfItems(); i++)\n    {\n      vtkActor* nextActor = actorCollection->GetNextActor();\n      std::cout << \"nextActor \" << i << \" : \" << nextActor->GetClassName()\n                << std::endl;\n\n      if (dynamic_cast<vtkCubeAxesActor*>(nextActor) != 0)\n      {\n        std::cout << \"nextActor \" << i << \" is a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n      else\n      {\n        std::cout << \"nextActor \" << i << \" is NOT a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n    }\n  }\n\n  // Determine the types of the actors - method 4\n  {\n    std::cout << \"Method 4:\" << std::endl;\n    vtkActorCollection* actorCollection = renderer->GetActors();\n    actorCollection->InitTraversal();\n\n    for (vtkIdType i = 0; i < actorCollection->GetNumberOfItems(); i++)\n    {\n      vtkActor* nextActor = actorCollection->GetNextActor();\n      std::cout << \"nextActor \" << i << \" : \" << nextActor->GetClassName()\n                << std::endl;\n\n      if (dynamic_cast<vtkCubeAxesActor*>(nextActor) != 0)\n      {\n        std::cout << \"nextActor \" << i << \" is a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n      else\n      {\n        std::cout << \"nextActor \" << i << \" is NOT a vtkCubeAxesActor!\"\n                  << std::endl;\n      }\n    }\n  }\n\n  // Render the scene\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DetermineActorType\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(0, 0, 8.09748);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetViewUp(0, 1, 0);\n  camera->SetDistance(8.09748);\n  camera->SetClippingRange(6.0265, 10.7239);\n\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/DetermineActorType/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DetermineActorType)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DetermineActorType: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DetermineActorType MACOSX_BUNDLE DetermineActorType.cxx )\n  target_link_libraries(DetermineActorType PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DetermineActorType\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/DetermineActorType/#download-and-build-determineactortype","title":"Download and Build DetermineActorType","text":"

        Click here to download DetermineActorType and its CMakeLists.txt file. Once the tarball DetermineActorType.tar has been downloaded and extracted,

        cd DetermineActorType/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DetermineActorType\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/DiscretizableColorTransferFunction/","title":"DiscretizableColorTransferFunction","text":"

        vtk-examples/Cxx/Utilities/DiscretizableColorTransferFunction

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/DiscretizableColorTransferFunction/#code","title":"Code","text":"

        DiscretizableColorTransferFunction.cxx

        #include <vtkDiscretizableColorTransferFunction.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkDiscretizableColorTransferFunction>\n      discretizableColorTransferFunction;\n\n  discretizableColorTransferFunction->DiscretizeOn();\n  discretizableColorTransferFunction->SetNumberOfValues(2);\n\n  discretizableColorTransferFunction->AddRGBPoint(0.0, 1, 0, 0);\n  discretizableColorTransferFunction->AddRGBPoint(10.0, 0, 1, 0);\n  discretizableColorTransferFunction->Build();\n\n  double color[3];\n  discretizableColorTransferFunction->GetColor(1.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  discretizableColorTransferFunction->GetColor(5.0, color);\n  std::cout << color[0] << \" \" << color[1] << \" \" << color[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/DiscretizableColorTransferFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DiscretizableColorTransferFunction)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DiscretizableColorTransferFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DiscretizableColorTransferFunction MACOSX_BUNDLE DiscretizableColorTransferFunction.cxx )\n  target_link_libraries(DiscretizableColorTransferFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DiscretizableColorTransferFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/DiscretizableColorTransferFunction/#download-and-build-discretizablecolortransferfunction","title":"Download and Build DiscretizableColorTransferFunction","text":"

        Click here to download DiscretizableColorTransferFunction and its CMakeLists.txt file. Once the tarball DiscretizableColorTransferFunction.tar has been downloaded and extracted,

        cd DiscretizableColorTransferFunction/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DiscretizableColorTransferFunction\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ExtractArrayComponent/","title":"ExtractArrayComponent","text":"

        vtk-examples/Cxx/Utilities/ExtractArrayComponent

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ExtractArrayComponent/#code","title":"Code","text":"

        ExtractArrayComponent.cxx

        #include <vtkArrayCalculator.h>\n#include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(2.0, 0.0, 0.0);\n  points->InsertNextPoint(3.0, 0.0, 0.0);\n\n  vtkNew<vtkDoubleArray> array;\n  array->SetName(\"InputArray\");\n  array->SetNumberOfComponents(3);\n  array->InsertNextTuple3(1, 10, 100);\n  array->InsertNextTuple3(2, 20, 200);\n  array->InsertNextTuple3(3, 30, 300);\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->AddArray(array);\n\n  vtkNew<vtkArrayCalculator> arrayCalculator;\n  arrayCalculator->SetInputData(polydata);\n  arrayCalculator->AddVectorArrayName(\"InputArray\");\n  // Extract component '1' from the InputArray by\n  // taking the dot product of each tuple with the\n  // vector (0,1,0)\n  arrayCalculator->SetFunction(\"dot(InputArray,jHat)\");\n  arrayCalculator->SetResultArrayName(\"OutputArray\");\n  arrayCalculator->Update();\n\n  vtkSmartPointer<vtkDoubleArray> outputArray = dynamic_cast<vtkDoubleArray*>(\n      arrayCalculator->GetPolyDataOutput()->GetPointData()->GetArray(\n          \"OutputArray\"));\n\n  for (vtkIdType i = 0; i < outputArray->GetNumberOfTuples(); i++)\n  {\n    double val = outputArray->GetValue(i);\n    std::cout << \"output value \" << i << \": \" << val << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ExtractArrayComponent/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractArrayComponent)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractArrayComponent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractArrayComponent MACOSX_BUNDLE ExtractArrayComponent.cxx )\n  target_link_libraries(ExtractArrayComponent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractArrayComponent\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ExtractArrayComponent/#download-and-build-extractarraycomponent","title":"Download and Build ExtractArrayComponent","text":"

        Click here to download ExtractArrayComponent and its CMakeLists.txt file. Once the tarball ExtractArrayComponent.tar has been downloaded and extracted,

        cd ExtractArrayComponent/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractArrayComponent\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ExtractFaces/","title":"ExtractFaces","text":"

        vtk-examples/Cxx/Utilities/ExtractFaces

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ExtractFaces/#code","title":"Code","text":"

        ExtractFaces.cxx

        #include <vtkCellIterator.h>\n#include <vtkCellTypes.h>\n#include <vtkGenericCell.h>\n#include <vtkPointSet.h>\n#include <vtkXMLGenericDataObjectReader.h>\n\n#include <iostream>\n#include <map>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  std::map<std::string, int> cellMap;\n\n  for (int arg = 1; arg < argc; ++arg)\n  {\n    auto reader = vtkSmartPointer<vtkXMLGenericDataObjectReader>::New();\n    reader->SetFileName(argv[arg]);\n    reader->Update();\n\n    //    vtkPointSet *pointSet =\n    //    vtkPointSet::SafeDownCast(reader->GetOutput());;\n    vtkPointSet* pointSet = dynamic_cast<vtkPointSet*>(reader->GetOutput());\n    ;\n    auto it = pointSet->NewCellIterator();\n    for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell())\n    {\n      auto cell = vtkSmartPointer<vtkGenericCell>::New();\n      it->GetCell(cell);\n      std::string cellName =\n          vtkCellTypes::GetClassNameFromTypeId(cell->GetCellType());\n      if (cellMap.count(cellName) == 0)\n      {\n        std::cout << \"Type: \" << cellName << \" has \" << cell->GetNumberOfFaces()\n                  << \" faces\" << std::endl;\n      }\n      cellMap[cellName]++;\n    }\n    it->Delete();\n  }\n  for (auto itm = cellMap.begin(); itm != cellMap.end(); ++itm)\n  {\n    std::cout << itm->first << \" occurs \" << itm->second << \" times\"\n              << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ExtractFaces/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractFaces)\n\nfind_package(VTK COMPONENTS \n  CommonDataModel\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractFaces: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractFaces MACOSX_BUNDLE ExtractFaces.cxx )\n  target_link_libraries(ExtractFaces PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractFaces\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ExtractFaces/#download-and-build-extractfaces","title":"Download and Build ExtractFaces","text":"

        Click here to download ExtractFaces and its CMakeLists.txt file. Once the tarball ExtractFaces.tar has been downloaded and extracted,

        cd ExtractFaces/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractFaces\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/FileOutputWindow/","title":"FileOutputWindow","text":"

        vtk-examples/Cxx/Utilities/FileOutputWindow

        "},{"location":"Cxx/Utilities/FileOutputWindow/#description","title":"Description","text":"

        This example shows how to pipe error output to a text file instead of the usual vtk pop-up window.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/FileOutputWindow/#code","title":"Code","text":"

        FileOutputWindow.cxx

        #include <vtkFileOutputWindow.h>\n#include <vtkNew.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFileOutputWindow> fileOutputWindow;\n  fileOutputWindow->SetFileName(\"output.txt\");\n\n  // Note that the SetInstance function is a static member of vtkOutputWindow.\n  vtkOutputWindow::SetInstance(fileOutputWindow);\n\n  // This causes an error intentionally (file name not specified) - this error\n  // will be written to the file output.txt\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->Update();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/FileOutputWindow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FileOutputWindow)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FileOutputWindow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FileOutputWindow MACOSX_BUNDLE FileOutputWindow.cxx )\n  target_link_libraries(FileOutputWindow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FileOutputWindow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/FileOutputWindow/#download-and-build-fileoutputwindow","title":"Download and Build FileOutputWindow","text":"

        Click here to download FileOutputWindow and its CMakeLists.txt file. Once the tarball FileOutputWindow.tar has been downloaded and extracted,

        cd FileOutputWindow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FileOutputWindow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/FilenameFunctions/","title":"FilenameFunctions","text":"

        vtk-examples/Cxx/Utilities/FilenameFunctions

        "},{"location":"Cxx/Utilities/FilenameFunctions/#description","title":"Description","text":"

        This example gets a list of all files in a directory. It then extracts the file extension and filename from each string.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/FilenameFunctions/#code","title":"Code","text":"

        FilenameFunctions.cxx

        #include <string>\n#include <vtkDirectory.h>\n#include <vtkNew.h>\n#include <vtksys/SystemTools.hxx>\n\nint main(int argc, char* argv[])\n{\n  std::string directoryName;\n  if (argc < 2)\n  {\n    directoryName = std::string(\".\");\n  }\n  else\n  {\n    directoryName = std::string(argv[1]);\n  }\n\n  vtkNew<vtkDirectory> directory;\n  int opened = directory->Open(directoryName.c_str());\n\n  if (!opened)\n  {\n    std::cout << \"Invalid directory!\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int numberOfFiles = directory->GetNumberOfFiles();\n  std::cout << \"Number of files: \" << numberOfFiles << std::endl;\n\n  for (int i = 0; i < numberOfFiles; i++)\n  {\n    std::string fileString = directoryName;\n    fileString += \"/\";\n    fileString += directory->GetFile(i);\n\n    std::string ext = vtksys::SystemTools::GetFilenameLastExtension(fileString);\n    std::cout << fileString << \" extension: \" << ext << std::endl;\n\n    std::string name =\n        vtksys::SystemTools::GetFilenameWithoutLastExtension(fileString);\n    std::cout << \"name: \" << name << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/FilenameFunctions/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FilenameFunctions)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonSystem\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FilenameFunctions: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FilenameFunctions MACOSX_BUNDLE FilenameFunctions.cxx )\n  target_link_libraries(FilenameFunctions PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FilenameFunctions\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/FilenameFunctions/#download-and-build-filenamefunctions","title":"Download and Build FilenameFunctions","text":"

        Click here to download FilenameFunctions and its CMakeLists.txt file. Once the tarball FilenameFunctions.tar has been downloaded and extracted,

        cd FilenameFunctions/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FilenameFunctions\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ForLoop/","title":"ForLoop","text":"

        vtk-examples/Cxx/Utilities/ForLoop

        "},{"location":"Cxx/Utilities/ForLoop/#description","title":"Description","text":"

        As a result of historical and evolving C++ standards there are are multiple ways of doing the same thing with vtkDataArrays in the VTK C++ code base. This example demonstrates various ways of iterating through a vtkDataArray and operating on the resultant tuple to create a new result. The result of the operation is inserted into a new vtkDataArray.

        In this example, all the functions operate on a vtkTypeFloat64Array of vectors to compute a vtkTypeFloat64Array of magnitudes. We also test to ensure the correct magnitudes are generated.

        This example demonstrates:

        • The classic for loop e.g. for (auto c = 0; c < 3; ++c) and static_cast.

          • naivemag3, demonstrates the classic for loop using a counter.
          • mag3GetPointer, uses raw pointers, it becomes a little complicated calling mag3Trampoline which then calls mag3Helper. Lots of static_cast has to be used.
          • mag3Explicit, instantiate a templated function with explicit types. It is similar to naivemag3.
        • A dispatcher/worker paradigm. This is the recommended approach. In the dispatcher function, we instantiate a worker. Then we use vtkArrayDispatch to generate optimised workers when the arrays are both float or double and fall back to just using the worker for other situations.

          • mag3Dispatch1 instantiates the struct Mag3Worker1 where we use accessors, APIType and assume the tuple sizes.
          • mag3Dispatch2a instantiates the struct Mag3Worker2a where range objects are used.
          • mag3Dispatch2b instantiates the struct Mag3Worker2b where range objects are used. Here ReferenceType and ConstReferenceType are used. Also elements in the range are accessed using operator[] like a STL indexed container.
          • mag3Dispatch3 instantiates the struct Mag3Worker3 where range objects are used. Here ValueType and ConstReferenceType are used. We also create a lambda to calculate the magnitude for each tuple. This is then used in std::transform to generate the magnitudes.

        Refer to Further reading for more information.

        Note that VTK provides a (not so well known) series of templated data types that are especially useful when dealing with data from other sources:

        • vtkTypeFloat32Array, vtkTypeFloat64Array,
        • vtkTypeInt8Array, vtkTypeInt64Array,
        • vtkTypeUInt8Array, vtkTypeUInt64Array
        "},{"location":"Cxx/Utilities/ForLoop/#best-practice","title":"Best Practice","text":"

        Yohann Bearzi has provided the following guidelines for best practices:

        • Whenever you hold a vtkDataArray for which you don't know the underlying type (i.e. you cannot safely vtkArrayDownCast), you should use vtkArrayDispatch and write your accesses in a functor. This prevents a bunch of implicit static_cast.
        • Whenever you hold a vtkDataArray on which you know the underlying type (ghost arrays for instance vtkUnsignedCharArray, or global ids vtkIdTypeArray), you should use vtkArrayDownCast.
        • When you finally hold a typed instance of vtkDataArray:

          • If the array only holds values (tuples with one component), use GetValue.
          • If the array holds tuples, you can prevent a copy for each access with AOS arrays by using vtk::ArrayTupleRange. In this case, the pointer of the corresponding tuple in the array is directly used for access.

        If you want to use STL algorithms, such as std::transform or std::sort, convert your downcasted array into a range and proceed.

        If you know at compile time how many components are in your array, you should template vtk::ArrayTupleRange and vtk::ArrayValueRange with the number of components (3 for 3D points, for instance).

        It is left as an exercise for the reader to identify best practices in the example.

        "},{"location":"Cxx/Utilities/ForLoop/#thanks","title":"Thanks","text":"

        Special thanks must go to wangzhezhe for developing the source code on which this example is based, see this discourse article: get the raw pointer from the vtkPoints, the original source code is here: forloops.cpp.

        "},{"location":"Cxx/Utilities/ForLoop/#further-reading","title":"Further reading","text":"

        For further reading please see:

        • Working with vtkDataArrays: 2019 Edition
        • C++11 for-range support in VTK
        • New Data Array Layouts in VTK 7.1

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ForLoop/#code","title":"Code","text":"

        ForLoop.cxx

        #include <vtkArrayDispatch.h>\n#include <vtkDataArrayAccessor.h>\n#include <vtkDataArrayRange.h>\n#include <vtkNew.h>\n#include <vtkTypeFloat64Array.h>\n\n#include <algorithm>\n#include <array>\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <type_traits>\n#include <vector>\n\nnamespace {\n\n// Using naive way to go through the array.\nvoid naivemag3(vtkDataArray* vectors, vtkDataArray* magnitudes);\n\n// GetVoidPointer, mag3GetPointer call mag3Trampoline then call mag3Helper\nvoid mag3GetPointer(vtkDataArray* vecs, vtkDataArray* mags);\n\ntemplate <typename VecType>\nvoid mag3Trampoline(VecType* vecs, vtkDataArray* mags, vtkIdType numTuples);\n\ntemplate <typename VecType, typename MagType>\nvoid mag3Helper(VecType* vecs, MagType* mags, vtkIdType numTuples);\n\n// mag3 explicit types\ntemplate <typename ArrayT1, typename ArrayT2>\nvoid mag3Explicit(ArrayT1* vectors, ArrayT2* magnitudes);\n\nstruct Mag3Worker1\n{\n  template <typename VecArray, typename MagArray>\n  void operator()(VecArray* vecs, MagArray* mags)\n  {\n    // The Accessor types:\n    using VecAccess = vtkDataArrayAccessor<VecArray>;\n    using MagAccess = vtkDataArrayAccessor<MagArray>;\n\n    // The \"APITypes\"\n    // (explicit-type when possible, double for plain vtkDataArrays)\n    using VecType = typename VecAccess::APIType;\n    using MagType = typename MagAccess::APIType;\n\n    // Tell the compiler the tuple sizes to enable optimizations:\n    VTK_ASSUME(vecs->GetNumberOfComponents() == 3);\n    VTK_ASSUME(mags->GetNumberOfComponents() == 1);\n\n    const vtkIdType numTuples = vecs->GetNumberOfTuples();\n\n    VecAccess vecAccess{vecs};\n    MagAccess magAccess{mags};\n\n    for (vtkIdType t = 0; t < numTuples; ++t)\n    {\n      MagType mag = 0;\n      for (int c = 0; c < 3; ++c)\n      {\n        VecType comp = vecAccess.Get(t, c);\n        auto cc = static_cast<MagType>(comp);\n        mag += cc * cc;\n      }\n      mag = std::sqrt(mag);\n      magAccess.Set(t, 0, mag);\n    }\n  }\n};\n\nstruct Mag3Worker2a\n{\n  template <typename VecArray, typename MagArray>\n  void operator()(VecArray* vecs, MagArray* mags)\n  {\n    // Create range objects:\n    // Refer to this:\n    // https://vtk.org/doc/nightly/html/classvtkArrayDispatch.html\n    const auto vecRange = vtk::DataArrayTupleRange<3>(vecs);\n    auto magRange = vtk::DataArrayValueRange<1>(mags);\n\n    using VecType = typename decltype(vecRange)::ComponentType;\n    using MagType = typename decltype(magRange)::ValueType;\n\n    auto magIter = magRange.begin();\n    for (const auto& vecTuple : vecRange)\n    {\n      MagType mag = 0;\n      for (const VecType comp : vecTuple)\n      {\n        auto c = static_cast<MagType>(comp);\n        mag += c * c;\n      }\n      *magIter = std::sqrt(mag);\n      magIter++;\n    }\n  }\n};\n\n/**\n * This is similar to MagWorker2a but demonstrates the use of ReferenceType and\n * ConstReferenceType.\n *\n * Also elements in the range are accessed using operator[]\n * like an stl indexed container.\n *\n */\nstruct Mag3Worker2b\n{\n  template <typename VecArray, typename MagArray>\n  void operator()(VecArray* vecs, MagArray* mags)\n  {\n    // Create range objects:\n    const auto vecRange = vtk::DataArrayTupleRange<3>(vecs);\n    auto magRange = vtk::DataArrayValueRange<1>(mags);\n\n    using VecConstTupleRef =\n        typename decltype(vecRange)::ConstTupleReferenceType;\n    using VecConstCompRef =\n        typename decltype(vecRange)::ConstComponentReferenceType;\n    using MagRef = typename decltype(magRange)::ReferenceType;\n    using MagType = typename decltype(magRange)::ValueType;\n\n    for (vtkIdType id = 0; id < vecRange.size(); ++id)\n    {\n      MagRef magRef = magRange[id] = 0;\n      VecConstTupleRef vecTuple = vecRange[id];\n      for (VecConstCompRef&& comp : vecTuple)\n      {\n        auto c = static_cast<MagType>(comp);\n        magRef += c * c;\n      }\n      magRef = std::sqrt(magRef);\n    }\n  }\n};\n\n/**\n * Here we create a functor for use by std::transform.\n *\n */\nstruct Mag3Worker3\n{\n  template <typename VecArray, typename MagArray>\n  void operator()(VecArray* vecs, MagArray* mags)\n  {\n    // Create range objects:\n    const auto vecRange = vtk::DataArrayTupleRange<3>(vecs);\n    auto magRange = vtk::DataArrayValueRange<1>(mags);\n\n    using VecConstTupleRef =\n        typename decltype(vecRange)::ConstTupleReferenceType;\n    using MagType = typename decltype(magRange)::ValueType;\n\n    // Per-tuple magnitude functor for std::transform:\n    auto computeMag = [](VecConstTupleRef tuple) -> MagType {\n      MagType mag = 0;\n      for (const auto& comp : tuple)\n      {\n        auto c = static_cast<MagType>(comp);\n        mag += c * c;\n      }\n      return std::sqrt(mag);\n    };\n\n    std::transform(vecRange.cbegin(), vecRange.cend(), magRange.begin(),\n                   computeMag);\n  }\n};\n\nvoid mag3Dispatch1(vtkDataArray* vecs, vtkDataArray* mags);\n\nvoid mag3Dispatch2a(vtkDataArray* vecs, vtkDataArray* mags);\n\nvoid mag3Dispatch2b(vtkDataArray* vecs, vtkDataArray* mags);\n\nvoid mag3Dispatch3(vtkDataArray* vecs, vtkDataArray* mags);\n\nbool verifyResults(vtkDataArray* magnitudes,\n                   std::vector<std::string> const& expectedMagnitudes);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // The data and the result arrays.\n  // Of course you can use:\n  // vtkNew<vtkDoubleArray> darray;\n  // vtkNew<vtkDoubleArray> results;\n  // However, lets use the VTK templated data types:\n  vtkNew<vtkTypeFloat64Array> darray;\n  vtkNew<vtkTypeFloat64Array> results;\n\n  // The number of components must be set in advance.\n  darray->SetNumberOfComponents(3);\n  results->SetNumberOfComponents(1);\n\n  int TupleNum = 10;\n\n  darray->SetNumberOfTuples(TupleNum);\n  results->SetNumberOfTuples(TupleNum);\n\n  auto printTuple = [](const std::array<vtkTypeFloat64, 3> tuple) {\n    std::ostringstream os;\n    auto separator = \"\";\n    auto const sep = \", \";\n    for (const auto& t : tuple)\n    {\n      os.setf(ios::fixed, ios::floatfield);\n      os << std::setprecision(1) << separator << t;\n      separator = sep;\n    }\n    return os.str();\n  };\n\n  for (vtkIdType i = 0; i < TupleNum; i++)\n  {\n    std::array<vtkTypeFloat64, 3> tuple = {{i * 0.1, i * 0.2, i * 0.3}};\n    // std::cout << printTuple(tuple) << std::endl;\n\n    // If the number of tuples is not set in advance, we can use InsertTuple.\n    // darray->InsertTuple(i, tuple.data());\n    darray->SetTuple(i, tuple.data());\n  }\n\n  // Set up for testing.\n  std::vector<std::string> expectedMagnitudes{\n      \"0.000000\", \"0.374166\", \"0.748331\", \"1.122497\", \"1.496663\",\n      \"1.870829\", \"2.244994\", \"2.619160\", \"2.993326\", \"3.367492\"};\n  std::string failMessage =\n      \"---         Fail: Results don't match expected values.\";\n  auto exitValue = EXIT_SUCCESS;\n\n  // We could explicitly specify the capture list:\n  //  [&exitValue, &results, &expectedMagnitudes, &failMessage]\n  //  instead of just [&].\n  auto checkResult = [&]() {\n    if (!verifyResults(results, expectedMagnitudes))\n    {\n      std::cout << failMessage << std::endl;\n      exitValue = EXIT_FAILURE;\n    }\n  };\n\n  auto resetResults = [&]() {\n    for (vtkIdType i = 0; i < TupleNum; i++)\n    {\n      vtkTypeFloat64 v = 0;\n      results->SetTuple(i, &v);\n    }\n  };\n\n  // Using naive API.\n  naivemag3(darray, results);\n  checkResult();\n\n  // Reset results to zero.\n  resetResults();\n\n  // Using get raw pointer.\n  mag3GetPointer(darray, results);\n  checkResult();\n\n  // Reset results to zero.\n  resetResults();\n\n  // Instantiate with explicit type.\n  mag3Explicit<vtkTypeFloat64Array, vtkTypeFloat64Array>(darray, results);\n  checkResult();\n\n  // Worker and dispatcher, there are four different types of worker.\n  mag3Dispatch1(darray, results);\n  checkResult();\n\n  mag3Dispatch2a(darray, results);\n  checkResult();\n\n  mag3Dispatch2b(darray, results);\n  checkResult();\n\n  mag3Dispatch3(darray, results);\n  checkResult();\n\n  if (exitValue == EXIT_SUCCESS)\n  {\n    std::cout << \"All tests passed.\" << std::endl;\n  }\n  else\n  {\n    std::cout << \"Some tests failed.\" << std::endl;\n  }\n  return exitValue;\n}\n\nnamespace {\n\nvoid naivemag3(vtkDataArray* vectors, vtkDataArray* magnitudes)\n{\n  std::cout << \"--- Testing naivemag3\" << std::endl;\n  const vtkIdType numTuples = vectors->GetNumberOfTuples();\n  std::array<vtkTypeFloat64, 3> tuple;\n  for (vtkIdType t = 0; t < numTuples; ++t)\n  {\n    vectors->GetTuple(t, tuple.data());\n    vtkTypeFloat64 mag = 0.;\n    for (vtkTypeFloat64 comp : tuple)\n    {\n      // std::cout << \"comp \" << comp << std::endl;\n      mag += comp * comp;\n    }\n    mag = std::sqrt(mag);\n    // Assume that space is allocated.\n    magnitudes->SetTuple(t, &mag);\n  }\n}\n\n// GetVoidPointer, mag3GetPointer call mag3Trampoline then call mag3Helper\nvoid mag3GetPointer(vtkDataArray* vecs, vtkDataArray* mags)\n{\n  std::cout << \"--- Testing mag3GetPointer\" << std::endl;\n  const vtkIdType numTuples = vecs->GetNumberOfTuples();\n  // Resolve vecs data type:\n  switch (vecs->GetDataType())\n  {\n    vtkTemplateMacro(mag3Trampoline(\n        static_cast<VTK_TT*>(vecs->GetVoidPointer(0)), mags, numTuples));\n  default:\n    std::cout << \"error at mag3GetPointer\" << std::endl;\n  }\n}\n\ntemplate <typename VecType>\nvoid mag3Trampoline(VecType* vecs, vtkDataArray* mags, vtkIdType numTuples)\n{\n  // Resolve mags data type:\n  switch (mags->GetDataType())\n  {\n    vtkTemplateMacro(mag3Helper(\n        vecs, static_cast<VTK_TT*>(mags->GetVoidPointer(0)), numTuples));\n  default:\n    std::cout << \"error at mag3Trampoline\" << std::endl;\n  }\n}\n\ntemplate <typename VecType, typename MagType>\nvoid mag3Helper(VecType* vecs, MagType* mags, vtkIdType numTuples)\n{\n  for (vtkIdType t = 0; t < numTuples; ++t)\n  {\n    MagType mag = 0;\n    for (size_t i = 0; i < 3; ++i)\n    {\n      auto v = static_cast<MagType>(*vecs);\n      mag += v * v;\n      ++vecs;\n    }\n    *mags = std::sqrt(mag);\n    ++mags;\n  }\n}\n\ntemplate <typename ArrayT1, typename ArrayT2>\nvoid mag3Explicit(ArrayT1* vectors, ArrayT2* magnitudes)\n\n{\n  std::cout << \"--- Testing mag3Explicit\" << std::endl;\n  using VecType = typename ArrayT1::ValueType;\n  using MagType = typename ArrayT2::ValueType;\n\n  const vtkIdType numTuples = vectors->GetNumberOfTuples();\n\n  for (vtkIdType t = 0; t < numTuples; ++t)\n  {\n    MagType mag = 0;\n    for (int c = 0; c < 3; ++c)\n    {\n      VecType comp = vectors->GetTypedComponent(t, c);\n      mag += static_cast<MagType>(comp * comp);\n    }\n    mag = std::sqrt(mag);\n    magnitudes->SetTypedComponent(t, 0, mag);\n  }\n}\n\nvoid mag3Dispatch1(vtkDataArray* vecs, vtkDataArray* mags)\n{\n  std::cout << \"--- Testing mag3Dispatch1\" << std::endl;\n  Mag3Worker1 worker1;\n\n  // Create a dispatcher. We want to generate fast-paths for when\n  // vecs and mags both use doubles or floats, but fallback to a\n  // slow path for any other situation.\n  using Dispatcher =\n      vtkArrayDispatch::Dispatch2ByValueType<vtkArrayDispatch::Reals,\n                                             vtkArrayDispatch::Reals>;\n\n  if (!Dispatcher::Execute(vecs, mags, worker1))\n  {\n    // Otherwise fallback to using the vtkDataArray API.\n    worker1(vecs, mags);\n  }\n}\n\nvoid mag3Dispatch2a(vtkDataArray* vecs, vtkDataArray* mags)\n{\n  std::cout << \"--- Testing mag3Dispatch2a\" << std::endl;\n  Mag3Worker2a worker2a;\n\n  // Create a dispatcher. We want to generate fast-paths for when\n  // vecs and mags both use doubles or floats, but fallback to a\n  // slow path for any other situation.\n  using Dispatcher =\n      vtkArrayDispatch::Dispatch2ByValueType<vtkArrayDispatch::Reals,\n                                             vtkArrayDispatch::Reals>;\n\n  // Generate optimized workers when mags/vecs are both float|double\n  if (!Dispatcher::Execute(vecs, mags, worker2a))\n  {\n    // Otherwise fallback to using the vtkDataArray API.\n    worker2a(vecs, mags);\n  }\n}\n\nvoid mag3Dispatch2b(vtkDataArray* vecs, vtkDataArray* mags)\n{\n  std::cout << \"--- Testing mag3Dispatch2b\" << std::endl;\n  Mag3Worker2b worker2b;\n\n  // Create a dispatcher. We want to generate fast-paths for when\n  // vecs and mags both use doubles or floats, but fallback to a\n  // slow path for any other situation.\n  using Dispatcher =\n      vtkArrayDispatch::Dispatch2ByValueType<vtkArrayDispatch::Reals,\n                                             vtkArrayDispatch::Reals>;\n\n  // Generate optimized workers when mags/vecs are both float|double\n  if (!Dispatcher::Execute(vecs, mags, worker2b))\n  {\n    // Otherwise fallback to using the vtkDataArray API.\n    worker2b(vecs, mags);\n  }\n}\n\nvoid mag3Dispatch3(vtkDataArray* vecs, vtkDataArray* mags)\n{\n  std::cout << \"--- Testing mag3Dispatch3\" << std::endl;\n  Mag3Worker3 worker3;\n\n  // Create a dispatcher. We want to generate fast-paths for when\n  // vecs and mags both use doubles or floats, but fallback to a\n  // slow path for any other situation.\n  using Dispatcher =\n      vtkArrayDispatch::Dispatch2ByValueType<vtkArrayDispatch::Reals,\n                                             vtkArrayDispatch::Reals>;\n\n  // Generate optimized workers when mags/vecs are both float|double\n  if (!Dispatcher::Execute(vecs, mags, worker3))\n  {\n    // Otherwise fallback to using the vtkDataArray API.\n    worker3(vecs, mags);\n  }\n}\n\nbool verifyResults(vtkDataArray* magnitudes,\n                   std::vector<std::string> const& expectedMagnitudes)\n{\n  std::vector<std::string> actualMagnitudes;\n  auto magRange = vtk::DataArrayValueRange<1>(magnitudes);\n  for (const auto& magTuple : magRange)\n  {\n    std::ostringstream os;\n    os.setf(ios::fixed, ios::floatfield);\n    os << std::setprecision(6) << magTuple;\n    actualMagnitudes.push_back(os.str());\n  }\n\n  return (std::equal(actualMagnitudes.begin(), actualMagnitudes.end(),\n                     expectedMagnitudes.begin()));\n}\n\n} // namespace\n
        "},{"location":"Cxx/Utilities/ForLoop/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ForLoop)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ForLoop: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ForLoop MACOSX_BUNDLE ForLoop.cxx )\n  target_link_libraries(ForLoop PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ForLoop\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ForLoop/#download-and-build-forloop","title":"Download and Build ForLoop","text":"

        Click here to download ForLoop and its CMakeLists.txt file. Once the tarball ForLoop.tar has been downloaded and extracted,

        cd ForLoop/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ForLoop\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/FrameRate/","title":"FrameRate","text":"

        vtk-examples/Cxx/Utilities/FrameRate

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/FrameRate/#code","title":"Code","text":"

        FrameRate.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid CallbackFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  for (unsigned int i = 0; i < 10; i++)\n  {\n    // Create a sphere\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetCenter(i, 0, 0);\n\n    // Create a mapper and actor\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"carrot\").GetData());\n\n    renderer->AddActor(actor);\n  }\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"FrameRate\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCallbackCommand> callback;\n\n  callback->SetCallback(CallbackFunction);\n  renderer->AddObserver(vtkCommand::EndEvent, callback);\n  renderer->SetBackground(colors->GetColor3d(\"sap_green\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CallbackFunction(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                      void* vtkNotUsed(clientData), void* vtkNotUsed(callData))\n{\n  vtkRenderer* renderer = static_cast<vtkRenderer*>(caller);\n\n  double timeInSeconds = renderer->GetLastRenderTimeInSeconds();\n  double fps = 1.0 / timeInSeconds;\n  std::cout << \"FPS: \" << fps << std::endl;\n\n  std::cout << \"Callback\" << std::endl;\n}\n} // namespace\n
        "},{"location":"Cxx/Utilities/FrameRate/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FrameRate)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FrameRate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FrameRate MACOSX_BUNDLE FrameRate.cxx )\n  target_link_libraries(FrameRate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FrameRate\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/FrameRate/#download-and-build-framerate","title":"Download and Build FrameRate","text":"

        Click here to download FrameRate and its CMakeLists.txt file. Once the tarball FrameRate.tar has been downloaded and extracted,

        cd FrameRate/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FrameRate\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/FullScreen/","title":"FullScreen","text":"

        vtk-examples/Cxx/Utilities/FullScreen

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/FullScreen/#code","title":"Code","text":"

        FullScreen.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#define USE_SCREEN_SIZE\n// #undef USE_SCREEN_SIZE\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"FullScreen\");\n\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // We have two different approaches.\n#ifdef USE_SCREEN_SIZE\n  // This allows you to resize the window and shows the window name.\n  renderWindow->Render();\n  renderWindow->SetSize(renderWindow->GetScreenSize());\n#else\n  // Set to true to get full screen mode.\n  // This uses the whole screen for the image.\n  renderWindow->SetFullScreen(true);\n#endif\n\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/FullScreen/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FullScreen)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FullScreen: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FullScreen MACOSX_BUNDLE FullScreen.cxx )\n  target_link_libraries(FullScreen PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FullScreen\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/FullScreen/#download-and-build-fullscreen","title":"Download and Build FullScreen","text":"

        Click here to download FullScreen and its CMakeLists.txt file. Once the tarball FullScreen.tar has been downloaded and extracted,

        cd FullScreen/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FullScreen\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/FunctionParser/","title":"FunctionParser","text":"

        vtk-examples/Cxx/Utilities/FunctionParser

        "},{"location":"Cxx/Utilities/FunctionParser/#description","title":"Description","text":"

        This example shows how to substitute values and evaluate a string such as \"a+b\".

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/FunctionParser/#code","title":"Code","text":"

        FunctionParser.cxx

        #include <vtkFunctionParser.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFunctionParser> functionParser;\n  functionParser->SetFunction(\"a+b\");\n\n  functionParser->SetScalarVariableValue(\"a\", 2);\n  functionParser->SetScalarVariableValue(\"b\", 3);\n\n  double result = functionParser->GetScalarResult();\n\n  std::cout << \"result: \" << result << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/FunctionParser/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FunctionParser)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonMisc\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FunctionParser: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FunctionParser MACOSX_BUNDLE FunctionParser.cxx )\n  target_link_libraries(FunctionParser PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FunctionParser\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/FunctionParser/#download-and-build-functionparser","title":"Download and Build FunctionParser","text":"

        Click here to download FunctionParser and its CMakeLists.txt file. Once the tarball FunctionParser.tar has been downloaded and extracted,

        cd FunctionParser/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FunctionParser\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/GetClassName/","title":"GetClassName","text":"

        vtk-examples/Cxx/Utilities/GetClassName

        "},{"location":"Cxx/Utilities/GetClassName/#description","title":"Description","text":"

        This example demonstrates the GetClassName function. This should be available for every VTK class. This is extremely helpful for debugging - you are able to determine the type of a variable that is passed as an abstract type. With this information, the list of functions that can be called on this variable can be determined.

        The example illustrates alternative ways to get the \"name\" of a class. Notice that the GetClassName provides a simple and useful solution.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/GetClassName/#code","title":"Code","text":"

        GetClassName.cxx

        #include <typeinfo>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n\nnamespace {\nstatic const char* unmangleName(const char* name);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n\n  std::cout << \"points->GetClassName():             \" << points->GetClassName()\n            << std::endl;\n  std::cout << \"Mangled\" << std::endl;\n  std::cout << \"\\ttypeid(points).name():              \" << typeid(points).name()\n            << std::endl;\n  std::cout << \"\\ttypeid(points.GetPointer()).name(): \"\n            << typeid(points.GetPointer()).name() << std::endl;\n  std::cout << \"Unmangled\" << std::endl;\n  std::cout << \"\\ttypeid(points.GetPointer()).name(): \"\n            << unmangleName(typeid(points).name()) << std::endl;\n  std::cout << \"\\ttypeid(points.GetPointer()).name(): \"\n            << unmangleName(typeid(points.GetPointer()).name()) << std::endl;\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// Better name demangling for gcc\n#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)\n#define GCC_USEDEMANGLE\n#endif\n\n#ifdef GCC_USEDEMANGLE\n#include <cstdlib>\n#include <cxxabi.h>\n#endif\n\nconst char* unmangleName(const char* name)\n{\n#ifdef GCC_USEDEMANGLE\n  char const* mangledName = name;\n  int status;\n  char* unmangled = abi::__cxa_demangle(mangledName, 0, 0, &status);\n  return unmangled;\n#else\n  return name;\n#endif\n}\n} // namespace\n
        "},{"location":"Cxx/Utilities/GetClassName/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetClassName)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetClassName: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetClassName MACOSX_BUNDLE GetClassName.cxx )\n  target_link_libraries(GetClassName PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetClassName\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/GetClassName/#download-and-build-getclassname","title":"Download and Build GetClassName","text":"

        Click here to download GetClassName and its CMakeLists.txt file. Once the tarball GetClassName.tar has been downloaded and extracted,

        cd GetClassName/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GetClassName\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/GetDataRoot/","title":"GetDataRoot","text":"

        vtk-examples/Cxx/Utilities/GetDataRoot

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/GetDataRoot/#code","title":"Code","text":"

        GetDataRoot.cxx

        #include <vtkNew.h>\n#include <vtkTesting.h>\n\nint main(int, char*[])\n{\n  // Locate VTK_DATA_ROOT\n  vtkNew<vtkTesting> testHelper;\n  std::string dataRoot = testHelper->GetDataRoot();\n\n  std::cout << \"dataRoot: \" << dataRoot << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/GetDataRoot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(GetDataRoot)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  TestingRendering\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"GetDataRoot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(GetDataRoot MACOSX_BUNDLE GetDataRoot.cxx )\n  target_link_libraries(GetDataRoot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS GetDataRoot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/GetDataRoot/#download-and-build-getdataroot","title":"Download and Build GetDataRoot","text":"

        Click here to download GetDataRoot and its CMakeLists.txt file. Once the tarball GetDataRoot.tar has been downloaded and extracted,

        cd GetDataRoot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./GetDataRoot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/KnownLengthArray/","title":"KnownLengthArray","text":"

        vtk-examples/Cxx/Utilities/KnownLengthArray

        "},{"location":"Cxx/Utilities/KnownLengthArray/#description","title":"Description","text":"

        This example creates a VTK style float array. This can be easily interchanged with vtkIntArray, vtkDoubleArray, etc.

        The terminology is as follows:

        • SetNumberOfComponents(): sets the number of elements that a tuple in the array will have. See VectorArrayKnownLength for an example with tuples with more than one element.
        • SetNumberOfValues(): sets the number of tuples the array will have. See UnknownLengthArray for an example where the number of values is not known in advance.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/KnownLengthArray/#code","title":"Code","text":"

        KnownLengthArray.cxx

        #include <vtkFloatArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFloatArray> distances;\n  distances->SetName(\"Distances\");\n  distances->SetNumberOfComponents(1);\n  distances->SetNumberOfValues(5);\n\n  // set values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    float f = (float)i + 0.1;\n    distances->SetValue(i, f);\n  }\n\n  // get values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    float f = distances->GetValue(i);\n    std::cout << f << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/KnownLengthArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KnownLengthArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KnownLengthArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KnownLengthArray MACOSX_BUNDLE KnownLengthArray.cxx )\n  target_link_libraries(KnownLengthArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KnownLengthArray\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/KnownLengthArray/#download-and-build-knownlengtharray","title":"Download and Build KnownLengthArray","text":"

        Click here to download KnownLengthArray and its CMakeLists.txt file. Once the tarball KnownLengthArray.tar has been downloaded and extracted,

        cd KnownLengthArray/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KnownLengthArray\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/LUTUtilities/","title":"LUTUtilities","text":"

        vtk-examples/Cxx/Utilities/LUTUtilities

        "},{"location":"Cxx/Utilities/LUTUtilities/#description","title":"Description","text":"

        A class called LUTUtilities is demonstrated along with a test harness that shows you how to use the class.

        This class allows you to:

        • Print the contents of the lookup table
        • Compare two lookup tables to see if they are the same.

        The test harness is a function called: TestLookupTables that tests pairs of lookup tables against each other.

        The program will not display any output if all tests are successful.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/LUTUtilities/#code","title":"Code","text":"

        LUTUtilities.cxx

        #include <vtkColorSeries.h>\n#include <vtkLookupTable.h>\n#include <vtkNew.h>\n#include <vtkVariantArray.h>\n\n#include <cstdlib>\n#include <iomanip>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <string>\n#include <vector>\n\n//! Utilities for displaying and comparing lookup tables.\nclass LUTUtilities\n{\npublic:\n  //-----------------------------------------------------------------------------\n  //! Constructor.\n  LUTUtilities(){};\n\n  //-----------------------------------------------------------------------------\n  //! Destructor.\n  ~LUTUtilities(){};\n\n  //-----------------------------------------------------------------------------\n  //! Display the contents of the lookup table.\n  /*!\n   * @param lut - the lookup table.\n   * @return a string containing the table data.\n   */\n  std::string DisplayLUTAsString(vtkLookupTable* lut)\n  {\n    vtkIdType tv = lut->GetNumberOfTableValues();\n    double dR[2];\n    lut->GetTableRange(dR);\n    std::ostringstream os;\n    if (lut->GetIndexedLookup())\n    {\n      vtkIdType av = lut->GetNumberOfAnnotatedValues();\n      os << \"Categorical Lookup Table\\nNumber of annotated values: \" << av\n         << \" Number of table values: \" << tv << \"\\nTable Range: \" << std::fixed\n         << std::setw(8) << std::setprecision(6) << dR[0] << \" to \" << dR[1]\n         << std::endl;\n      if (av > 0)\n      {\n        for (vtkIdType i = 0; i < av; ++i)\n        {\n          double rgba[4];\n          lut->GetAnnotationColor(lut->GetAnnotatedValue(i), rgba);\n          os << std::setw(5) << lut->GetAnnotation(i) << \": \";\n          os << this->AssembleRGBAString(rgba);\n          os << std::endl;\n        }\n      }\n      else\n      {\n        for (vtkIdType i = 0; i < tv; ++i)\n        {\n          double rgba[4];\n          lut->GetTableValue(i, rgba);\n          os << std::setw(5) << i << \": \";\n          os << this->AssembleRGBAString(rgba);\n          os << std::endl;\n        }\n      }\n    }\n    else\n    {\n      os << \"Ordinal Lookup Table\\nNumber of table values : \" << tv\n         << \"\\nTable Range: \" << std::fixed << std::setw(8)\n         << std::setprecision(6) << dR[0] << \" to \" << dR[1] << std::endl;\n      std::vector<double> indices;\n      for (int i = 0; i < tv; ++i)\n      {\n        indices.push_back((dR[1] - dR[0]) * i / tv + dR[0]);\n      }\n      for (std::vector<double>::const_iterator p = indices.begin();\n           p != indices.end(); ++p)\n      {\n        double rgba[4];\n        lut->GetColor(*p, rgba);\n        rgba[3] = lut->GetOpacity(*p);\n        os << std::fixed << std::setw(5) << std::setprecision(2) << *p << \": \";\n        os << this->AssembleRGBAString(rgba);\n        os << std::endl;\n      }\n    }\n    return os.str();\n  }\n\n  //-----------------------------------------------------------------------------\n  //! Compare two lookup tables.\n  /*!\n   * @param lut1 - the lookup table.\n   * @param lut2 - the lookup table.\n   * @return true if the tables are the same.\n   */\n  std::pair<bool, std::string> CompareLUTs(vtkLookupTable* lut1,\n                                           vtkLookupTable* lut2)\n  {\n    std::pair<bool, std::string> res(true, \"\");\n    if (lut1->GetIndexedLookup() != lut2->GetIndexedLookup())\n    {\n      res.first = false;\n      res.second = \"One table is ordinal and the other is categorical.\";\n      return res;\n    }\n    if (lut1->GetIndexedLookup() &&\n        lut1->GetNumberOfAnnotatedValues() !=\n            lut2->GetNumberOfAnnotatedValues())\n    {\n      res.first = false;\n      res.second = \"The number of annotated values do not match.\";\n      return res;\n    }\n    if (lut1->GetNumberOfTableValues() != lut2->GetNumberOfTableValues())\n    {\n      res.first = false;\n      res.second = \"Table values do not match.\";\n      return res;\n    }\n    double dR1[2];\n    lut1->GetTableRange(dR1);\n    double dR2[2];\n    lut2->GetTableRange(dR2);\n    if (dR1[0] != dR2[0] && dR2[1] != dR1[1])\n    {\n      res.first = false;\n      res.second = \"Table ranges do not match.\";\n    }\n    if (lut1->GetIndexedLookup())\n    {\n      vtkIdType av = lut1->GetNumberOfAnnotatedValues();\n      if (av > 0)\n      {\n        for (vtkIdType i = 0; i < av; ++i)\n        {\n          if (lut1->GetAnnotation(i) != lut1->GetAnnotation(i))\n          {\n            res.first = false;\n            res.second = \"Annotations do not match.\";\n            return res;\n          }\n        }\n        for (vtkIdType i = 0; i < av; ++i)\n        {\n          double rgba1[4];\n          lut1->GetAnnotationColor(lut1->GetAnnotatedValue(i), rgba1);\n          double rgba2[4];\n          lut2->GetAnnotationColor(lut2->GetAnnotatedValue(i), rgba2);\n          if (!this->CompareRGBA(rgba1, rgba2))\n          {\n            res.first = false;\n            res.second = \"Colors do not match.\";\n            return res;\n          }\n        }\n      }\n      else\n      {\n        for (vtkIdType i = 0; i < av; ++i)\n        {\n          double rgba1[4];\n          lut1->GetTableValue(i, rgba1);\n          double rgba2[4];\n          lut2->GetTableValue(i, rgba2);\n          if (!this->CompareRGBA(rgba1, rgba2))\n          {\n            res.first = false;\n            res.second = \"Colors do not match.\";\n            return res;\n          }\n        }\n      }\n    }\n    else\n    {\n      vtkIdType tv = lut1->GetNumberOfTableValues();\n      std::vector<double> indices;\n      for (int i = 0; i < tv; ++i)\n      {\n        indices.push_back((dR1[1] - dR1[0]) * i / tv + dR1[0]);\n      }\n      for (std::vector<double>::const_iterator p = indices.begin();\n           p != indices.end(); ++p)\n      {\n        double rgba1[4];\n        lut1->GetColor(*p, rgba1);\n        rgba1[3] = lut1->GetOpacity(*p);\n        double rgba2[4];\n        lut2->GetColor(*p, rgba2);\n        rgba2[3] = lut2->GetOpacity(*p);\n        if (!this->CompareRGBA(rgba1, rgba2))\n        {\n          res.first = false;\n          res.second = \"Colors do not match.\";\n          return res;\n        }\n      }\n    }\n    return res;\n  }\n\nprivate:\n  //-----------------------------------------------------------------------------\n  //! Get a string of [R, G, B, A] as double.\n  std::string RGBAToDoubleString(double* rgba)\n  {\n    std::ostringstream os;\n    os << \"[\";\n    for (int i = 0; i < 4; ++i)\n    {\n      if (i == 0)\n      {\n        os << std::fixed << std::setw(8) << std::setprecision(6) << rgba[i];\n      }\n      else\n      {\n        os << std::fixed << std::setw(9) << std::setprecision(6) << rgba[i];\n      }\n      if (i < 3)\n      {\n        os << \",\";\n      }\n    }\n    os << \"]\";\n    return os.str();\n  }\n\n  //-----------------------------------------------------------------------------\n  //! Get a string of [R, G, B, A] as unsigned char.\n  std::string RGBAToCharString(double* rgba)\n  {\n    std::ostringstream os;\n    os << \"[\";\n    for (int i = 0; i < 4; ++i)\n    {\n      if (i == 0)\n      {\n        os << std::setw(3) << static_cast<int>(rgba[i] * 255);\n      }\n      else\n      {\n        os << std::setw(4) << static_cast<int>(rgba[i] * 255);\n      }\n      if (i < 3)\n      {\n        os << \",\";\n      }\n    }\n    os << \"]\";\n    return os.str();\n  }\n\n  //-----------------------------------------------------------------------------\n  //! Get a hexadecimal string of the RGB colors.\n  std::string RGBToHexString(double* rgba)\n  {\n    std::ostringstream os;\n    for (int i = 0; i < 3; ++i)\n    {\n      os << std::setw(2) << std::setfill('0') << std::hex\n         << static_cast<int>(rgba[i] * 255);\n    }\n    return os.str();\n  }\n\n  //-----------------------------------------------------------------------------\n  //! Get a string of [R, G, B, A] as double, unsigned char and hex.\n  std::string AssembleRGBAString(double* rgba)\n  {\n    std::ostringstream os;\n    os << this->RGBAToDoubleString(rgba);\n    os << \" \";\n    os << this->RGBAToCharString(rgba);\n    os << \" 0x\";\n    os << this->RGBToHexString(rgba);\n    return os.str();\n  }\n\n  //-----------------------------------------------------------------------------\n  //! Compare two rgba colors.\n  template <typename T> bool CompareRGBA(T* rgba1, T* rgba2)\n  {\n    bool areEquivalent = true;\n    for (int i = 0; i < 4; ++i)\n    {\n      areEquivalent &= rgba1[i] == rgba2[i];\n      if (!areEquivalent)\n      {\n        return false;\n      }\n    }\n    return true;\n  }\n};\n\n//-----------------------------------------------------------------------------\n//! Get all the color scheme names.\n/*!\n * @return a map of the names keyed on their index.\n */\nstd::map<int, std::string> GetAllColorSchemes()\n{\n  std::map<int, std::string> colorSchemes;\n  vtkNew<vtkColorSeries> colorSeries;\n  for (int i = 0; i < colorSeries->GetNumberOfColorSchemes(); ++i)\n  {\n    colorSeries->SetColorScheme(i);\n    colorSchemes[i] = colorSeries->GetColorSchemeName();\n  }\n  return colorSchemes;\n}\n\n//-----------------------------------------------------------------------------\n//! The available color scheme indexes and names.\n/*!\n * @param colorSchemes - a map of the names keyed on their index.\n * @return a string if the indexes and names.\n */\nstd::string AvailableColorSchemes(std::map<int, std::string>& colorSchemes)\n{\n  std::ostringstream os;\n  for (std::map<int, std::string>::const_iterator p = colorSchemes.begin();\n       p != colorSchemes.end(); ++p)\n  {\n    os << std::setw(3) << p->first << \"\\t\" << p->second << std::endl;\n  }\n  return os.str();\n}\n\n//-----------------------------------------------------------------------------\n//! Display the available color schemes.\nvoid DisplayAvailableColorSchemes()\n{\n  std::string line(\"-----------------------------------------------------------\"\n                   \"------------------\\n\");\n  std::map<int, std::string> colorSchemes;\n  colorSchemes = GetAllColorSchemes();\n  std::cout << line << AvailableColorSchemes(colorSchemes) << line << std::endl;\n}\n\n//-----------------------------------------------------------------------------\n//! Display the lookup tables and reason for failure.\n/*!\n * @param reason - the reason.\n * @param lut1 - the first lookup table.\n * @param lut2 - the second lookup table.\n */\nvoid DisplayResults(std::string& reason, vtkLookupTable* lut1,\n                    vtkLookupTable* lut2)\n{\n  LUTUtilities lutUtilities;\n  std::string line(\"-----------------------------------------------------------\"\n                   \"------------------\\n\");\n  std::cout << line;\n  std::cout << reason << std::endl;\n  std::cout << lutUtilities.DisplayLUTAsString(lut1) << std::endl;\n  std::cout << lutUtilities.DisplayLUTAsString(lut2) << std::endl;\n  std::cout << line;\n}\n\n//-----------------------------------------------------------------------------\n//! Test pairs of lookup tables.\n/*!\n * @param lut1 - the first lookup table.\n * @param lut2 - the second lookup table.\n * @param expected - if false a fail is expected.\n * @return true/false.\n */\nbool TestTables(vtkLookupTable* lut1, vtkLookupTable* lut2,\n                bool const expected = true)\n{\n  LUTUtilities lutUtilities;\n  std::pair<bool, std::string> comparison =\n      lutUtilities.CompareLUTs(lut1, lut2);\n  if (comparison.first != expected)\n  {\n    DisplayResults(comparison.second, lut1, lut2);\n  }\n  return (expected) ? comparison.first : !comparison.first;\n}\n\n//-----------------------------------------------------------------------------\n//! Test various combinations of lookup tables.\n/*!\n * @param lutMode - if true the tables are ordinal, categorical otherwise.\n * @return true if all tests passed.\n */\nbool TestLookupTables(bool const& lutMode)\n{\n  LUTUtilities lutUtilities;\n  vtkNew<vtkLookupTable> lut1;\n  vtkNew<vtkLookupTable> lut2;\n  vtkNew<vtkColorSeries> colorSeries;\n  int colorSeriesEnum = colorSeries->SPECTRUM;\n  colorSeries->SetColorScheme(colorSeriesEnum);\n\n  colorSeries->BuildLookupTable(lut1);\n  colorSeries->BuildLookupTable(lut2);\n  if (lutMode)\n  {\n    lut1->IndexedLookupOff();\n    lut2->IndexedLookupOff();\n  }\n  lut1->SetNanColor(1, 0, 0, 1);\n  lut2->SetNanColor(1, 0, 0, 1);\n\n  if (!lutMode)\n  {\n    //  For the annotation just use a letter of the alphabet.\n    vtkNew<vtkVariantArray> values1;\n    vtkNew<vtkVariantArray> values2;\n    std::string str = \"abcdefghijklmnopqrstuvwxyz\";\n    for (int i = 0; i < lut1->GetNumberOfTableValues(); ++i)\n    {\n      values1->InsertNextValue(vtkVariant(str.substr(i, 1)));\n    }\n    for (int i = 0; i < lut2->GetNumberOfTableValues(); ++i)\n    {\n      values2->InsertNextValue(vtkVariant(str.substr(i, 1)));\n    }\n    for (int i = 0; i < values1->GetNumberOfTuples(); ++i)\n    {\n      lut1->SetAnnotation(i, values1->GetValue(i).ToString());\n    }\n    for (int i = 0; i < values2->GetNumberOfTuples(); ++i)\n    {\n      lut2->SetAnnotation(i, values2->GetValue(i).ToString());\n    }\n  }\n\n  // Are they the same?\n  bool res = true;\n  res &= TestTables(lut1, lut2);\n\n  // Different size\n  lut2->SetNumberOfTableValues(5);\n  res &= TestTables(lut1, lut2, false);\n  lut2->SetNumberOfTableValues(lut1->GetNumberOfTableValues());\n  res &= TestTables(lut1, lut2);\n\n  if (lutMode)\n  {\n    // Different range\n    lut2->SetTableRange(1, 2);\n    res &= TestTables(lut1, lut2, false);\n    double tr[2];\n    lut1->GetTableRange(tr);\n    lut2->SetTableRange(tr);\n    res &= TestTables(lut1, lut2);\n\n    // Different color\n    colorSeriesEnum = colorSeries->COOL;\n    colorSeries->SetColorScheme(colorSeriesEnum);\n    vtkNew<vtkLookupTable> lut3;\n    colorSeries->BuildLookupTable(lut3);\n    lut3->IndexedLookupOff();\n    res &= TestTables(lut1, lut3, false);\n\n    // One indexed, the other ordinal.\n    lut1->IndexedLookupOn();\n    res &= TestTables(lut1, lut2, false);\n  }\n  else\n  {\n    // Different color\n    colorSeriesEnum = colorSeries->COOL;\n    colorSeries->SetColorScheme(colorSeriesEnum);\n    vtkNew<vtkLookupTable> lut3;\n    //  For the annotation just use a letter of the alphabet.\n    vtkNew<vtkVariantArray> values;\n    std::string str = \"abcdefghijklmnopqrstuvwxyz\";\n    for (int i = 0; i < lut1->GetNumberOfTableValues(); ++i)\n    {\n      values->InsertNextValue(vtkVariant(str.substr(i, 1)));\n    }\n    for (int i = 0; i < values->GetNumberOfTuples(); ++i)\n    {\n      lut3->SetAnnotation(i, values->GetValue(i).ToString());\n    }\n    colorSeries->BuildLookupTable(lut3);\n    res &= TestTables(lut1, lut3, false);\n\n    // Different annotations.\n    lut2->ResetAnnotations();\n    for (int i = 0; i < values->GetNumberOfTuples(); ++i)\n    {\n      if (i % 3 == 0)\n        continue;\n      lut2->SetAnnotation(i, values->GetValue(i).ToString());\n    }\n    res &= TestTables(lut1, lut2, false);\n\n    // No annotations.\n    lut1->ResetAnnotations();\n    lut2->ResetAnnotations();\n    res &= TestTables(lut1, lut2);\n\n    // One indexed, the other ordinal.\n    lut1->IndexedLookupOff();\n    res &= TestTables(lut1, lut2, false);\n  }\n\n  return res;\n}\n\n//-----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  // DisplayAvailableColorSchemes();\n  // Test ordinal LUTS.\n  bool res = TestLookupTables(true);\n  // Test categorical LUTs.\n  res &= TestLookupTables(false);\n  return (res) ? EXIT_SUCCESS : EXIT_FAILURE;\n}\n
        "},{"location":"Cxx/Utilities/LUTUtilities/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LUTUtilities)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LUTUtilities: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LUTUtilities MACOSX_BUNDLE LUTUtilities.cxx )\n  target_link_libraries(LUTUtilities PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LUTUtilities\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/LUTUtilities/#download-and-build-lututilities","title":"Download and Build LUTUtilities","text":"

        Click here to download LUTUtilities and its CMakeLists.txt file. Once the tarball LUTUtilities.tar has been downloaded and extracted,

        cd LUTUtilities/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LUTUtilities\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/MassProperties/","title":"MassProperties","text":"

        vtk-examples/Cxx/Utilities/MassProperties

        "},{"location":"Cxx/Utilities/MassProperties/#description","title":"Description","text":"

        This example uses vtkMassProperties to compute the volume of a closed mesh. vtkMassProperties requires triangles with consistent ordering. This example uses vtkFillHolesFilter and vtkTriangleFilter to ensure a closed, triangulated mesh. vtkPolyDataNormals enforces consistent normals.

        If run with no arguments, a vtkSphereSource generates the vtkPolyData. Of given a file containing vtkPolyData, it computes that data's volume and surface area.

        Cite

        (Alyassin A.M. et al, \"Evaluation of new algorithms for the interactive measurement of surface area and volume\", Med Phys 21(6) 1994.)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/MassProperties/#code","title":"Code","text":"

        MassProperties.cxx

        #include <vtkFillHolesFilter.h>\n#include <vtkMassProperties.h>\n#include <vtkNew.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangleFilter.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  vtkNew<vtkFillHolesFilter> fillHolesFilter;\n  fillHolesFilter->SetInputData(polyData);\n  fillHolesFilter->SetHoleSize(1000.0);\n\n  vtkNew<vtkTriangleFilter> triangleFilter;\n  triangleFilter->SetInputConnection(fillHolesFilter->GetOutputPort());\n\n  // Make the triangle windong order consistent\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(triangleFilter->GetOutputPort());\n  normals->ConsistencyOn();\n  normals->SplittingOff();\n\n  vtkNew<vtkMassProperties> massProperties;\n  massProperties->SetInputConnection(normals->GetOutputPort());\n  massProperties->Update();\n  std::cout << \"Volume: \" << massProperties->GetVolume() << std::endl\n            << \"    VolumeX: \" << massProperties->GetVolumeX() << std::endl\n            << \"    VolumeY: \" << massProperties->GetVolumeY() << std::endl\n            << \"    VolumeZ: \" << massProperties->GetVolumeZ() << std::endl\n            << \"Area:   \" << massProperties->GetSurfaceArea() << std::endl\n            << \"    MinCellArea: \" << massProperties->GetMinCellArea()\n            << std::endl\n            << \"    MinCellArea: \" << massProperties->GetMaxCellArea()\n            << std::endl\n            << \"NormalizedShapeIndex: \"\n            << massProperties->GetNormalizedShapeIndex() << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->SetPhiResolution(51);\n    source->SetThetaResolution(51);\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Utilities/MassProperties/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MassProperties)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MassProperties: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MassProperties MACOSX_BUNDLE MassProperties.cxx )\n  target_link_libraries(MassProperties PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MassProperties\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/MassProperties/#download-and-build-massproperties","title":"Download and Build MassProperties","text":"

        Click here to download MassProperties and its CMakeLists.txt file. Once the tarball MassProperties.tar has been downloaded and extracted,

        cd MassProperties/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MassProperties\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ObserveError/","title":"ObserveError","text":"

        vtk-examples/Cxx/Utilities/ObserveError

        "},{"location":"Cxx/Utilities/ObserveError/#description","title":"Description","text":"

        When vtk encounters an error or warning, by default the message is written to standard output. This example shows how to catch the error or warning. The example prints to standard output, but an application may wish to present the error or warning in a different manner, e.g. write to a log file or present the message in a window.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ObserveError/#code","title":"Code","text":"

        ObserveError.cxx

        #include <string>\n#include <vtkCommand.h>\n#include <vtkImageData.h>\n#include <vtkNew.h>\n\nclass ErrorObserver : public vtkCommand\n{\npublic:\n  ErrorObserver()\n    : Error(false), Warning(false), ErrorMessage(\"\"), WarningMessage(\"\")\n  {\n  }\n  static ErrorObserver* New()\n  {\n    return new ErrorObserver;\n  }\n  bool GetError() const\n  {\n    return this->Error;\n  }\n  bool GetWarning() const\n  {\n    return this->Warning;\n  }\n  void Clear()\n  {\n    this->Error = false;\n    this->Warning = false;\n    this->ErrorMessage = \"\";\n    this->WarningMessage = \"\";\n  }\n  virtual void Execute(vtkObject* vtkNotUsed(caller), unsigned long event,\n                       void* calldata)\n  {\n    switch (event)\n    {\n    case vtkCommand::ErrorEvent:\n      ErrorMessage = static_cast<char*>(calldata);\n      this->Error = true;\n      break;\n    case vtkCommand::WarningEvent:\n      WarningMessage = static_cast<char*>(calldata);\n      this->Warning = true;\n      break;\n    }\n  }\n  std::string GetErrorMessage()\n  {\n    return ErrorMessage;\n  }\n  std::string GetWarningMessage()\n  {\n    return WarningMessage;\n  }\n\nprivate:\n  bool Error;\n  bool Warning;\n  std::string ErrorMessage;\n  std::string WarningMessage;\n};\n\nint main(int, char*[])\n{\n  vtkNew<ErrorObserver> errorObserver;\n\n  vtkNew<vtkImageData> image;\n  image->AddObserver(vtkCommand::ErrorEvent, errorObserver);\n  image->AddObserver(vtkCommand::WarningEvent, errorObserver);\n  image->GetCell(1);\n  if (errorObserver->GetError())\n  {\n    std::cout << \"Caught error! \" << errorObserver->GetErrorMessage();\n  }\n\n  image->ShallowCopy(NULL);\n  if (errorObserver->GetWarning())\n  {\n    std::cout << \"Caught warning! \" << errorObserver->GetWarningMessage();\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ObserveError/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ObserveError)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ObserveError: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ObserveError MACOSX_BUNDLE ObserveError.cxx )\n  target_link_libraries(ObserveError PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ObserveError\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ObserveError/#download-and-build-observeerror","title":"Download and Build ObserveError","text":"

        Click here to download ObserveError and its CMakeLists.txt file. Once the tarball ObserveError.tar has been downloaded and extracted,

        cd ObserveError/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ObserveError\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/OffScreenRendering/","title":"OffScreenRendering","text":"

        vtk-examples/Cxx/Utilities/OffScreenRendering

        "},{"location":"Cxx/Utilities/OffScreenRendering/#description","title":"Description","text":"

        This example renders a scene directly to a file without displaying a window. You must turn on VTK_OPENGL_HAS_OSMESA in the VTK advanced build configuration.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/OffScreenRendering/#code","title":"Code","text":"

        OffScreenRendering.cxx

        #include <vtkActor.h>\n#include <vtkGraphicsFactory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkWindowToImageFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup offscreen rendering\n  vtkNew<vtkGraphicsFactory> graphics_factory;\n  graphics_factory->SetOffScreenOnlyMode(1);\n  graphics_factory->SetUseMesaClasses(1);\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetOffScreenRendering(1);\n  renderWindow->AddRenderer(renderer);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<vtkWindowToImageFilter> windowToImageFilter;\n  windowToImageFilter->SetInput(renderWindow);\n  windowToImageFilter->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(\"screenshot.png\");\n  writer->SetInputConnection(windowToImageFilter->GetOutputPort());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/OffScreenRendering/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OffScreenRendering)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OffScreenRendering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OffScreenRendering MACOSX_BUNDLE OffScreenRendering.cxx )\n  target_link_libraries(OffScreenRendering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OffScreenRendering\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/OffScreenRendering/#download-and-build-offscreenrendering","title":"Download and Build OffScreenRendering","text":"

        Click here to download OffScreenRendering and its CMakeLists.txt file. Once the tarball OffScreenRendering.tar has been downloaded and extracted,

        cd OffScreenRendering/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OffScreenRendering\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/PCADemo/","title":"PCADemo","text":"

        vtk-examples/Cxx/Utilities/PCADemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/PCADemo/#code","title":"Code","text":"

        PCADemo.cxx

        #include <vtkActor.h>\n#include <vtkBoxMuellerRandomSequence.h>\n#include <vtkDoubleArray.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLine.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPCAStatistics.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTable.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVertexGlyphFilter.h>\n\nnamespace {\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph\n * @param scale - The scale, used to determine the size of the glyph\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkBoxMuellerRandomSequence> randomSequence;\n\n  vtkNew<vtkPoints> points;\n  for (unsigned int i = 0; i < 200; i++)\n  {\n    auto x = randomSequence->GetScaledValue(0, 2);\n    randomSequence->Next();\n    auto y = randomSequence->GetScaledValue(0, 5);\n    randomSequence->Next();\n    points->InsertNextPoint(x, y, 0);\n  }\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateZ(30);\n\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetTransform(transform);\n  transformFilter->SetInputData(polydata);\n  transformFilter->Update();\n\n  // These would be all of your \"x\" values.\n  vtkNew<vtkDoubleArray> xArray;\n  xArray->SetNumberOfComponents(1);\n  xArray->SetName(\"x\");\n\n  // These would be all of your \"y\" values.\n  vtkNew<vtkDoubleArray> yArray;\n  yArray->SetNumberOfComponents(1);\n  yArray->SetName(\"y\");\n\n  for (vtkIdType i = 0; i < polydata->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    transformFilter->GetOutput()->GetPoint(i, p);\n    xArray->InsertNextValue(p[0]);\n    yArray->InsertNextValue(p[1]);\n  }\n\n  vtkNew<vtkTable> datasetTable;\n  datasetTable->AddColumn(xArray);\n  datasetTable->AddColumn(yArray);\n\n  vtkNew<vtkPCAStatistics> pcaStatistics;\n  pcaStatistics->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA, datasetTable);\n\n  pcaStatistics->SetColumnStatus(\"x\", 1);\n  pcaStatistics->SetColumnStatus(\"y\", 1);\n\n  pcaStatistics->RequestSelectedColumns();\n  pcaStatistics->SetDeriveOption(true);\n  pcaStatistics->Update();\n\n  ///////// Eigenvalues ////////////\n  vtkNew<vtkDoubleArray> eigenvalues;\n  pcaStatistics->GetEigenvalues(eigenvalues);\n  for (vtkIdType i = 0; i < eigenvalues->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Eigenvalue \" << i << \" = \" << eigenvalues->GetValue(i)\n              << std::endl;\n  }\n\n  ///////// Eigenvectors ////////////\n  vtkNew<vtkDoubleArray> eigenvectors;\n\n  pcaStatistics->GetEigenvectors(eigenvectors);\n\n  vtkNew<vtkDoubleArray> evec1;\n  pcaStatistics->GetEigenvector(0, evec1);\n\n  vtkNew<vtkDoubleArray> evec2;\n  pcaStatistics->GetEigenvector(1, evec2);\n\n  double scale = 3.0;\n  vtkNew<vtkLineSource> vector1Source;\n  vector1Source->SetPoint1(0, 0, 0);\n  vector1Source->SetPoint1(scale * evec1->GetValue(0),\n                           scale * evec1->GetValue(1), 0);\n\n  vtkNew<vtkPolyDataMapper> vec1Mapper;\n  vec1Mapper->SetInputConnection(vector1Source->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> vector1Actor;\n  vector1Actor->SetMapper(vec1Mapper);\n  vector1Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LimeGreen\").GetData());\n  vector1Actor->GetProperty()->SetLineWidth(3);\n\n  vtkNew<vtkLineSource> vector2Source;\n  vector2Source->SetPoint1(0, 0, 0);\n  vector2Source->SetPoint1(scale * evec2->GetValue(0),\n                           scale * evec2->GetValue(1), 0);\n\n  vtkNew<vtkPolyDataMapper> vec2Mapper;\n  vec2Mapper->SetInputConnection(vector2Source->GetOutputPort());\n\n  vtkNew<vtkActor> vector2Actor;\n  vector2Actor->SetMapper(vec2Mapper);\n  vector2Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  vector2Actor->GetProperty()->SetLineWidth(3);\n\n  // Project all of the points onto the eigenvector with\n  // the largest eigenvalues\n  double p0[3];\n  p0[0] = -100 * evec1->GetValue(0);\n  p0[1] = -100 * evec1->GetValue(1);\n  p0[2] = 0;\n  double p1[3];\n  p1[0] = 100 * evec1->GetValue(0);\n  p1[1] = 100 * evec1->GetValue(1);\n  p1[2] = 0;\n\n  vtkNew<vtkPoints> projectedPoints;\n  for (vtkIdType i = 0; i < polydata->GetNumberOfPoints(); i++)\n  {\n    double p[3];\n    transformFilter->GetOutput()->GetPoint(i, p);\n    double t;\n    double closestPoint[3];\n    vtkLine::DistanceToLine(p, p0, p1, t, closestPoint);\n    double newP[3];\n    double v[3];\n    vtkMath::Subtract(p1, p0, v);\n    vtkMath::Normalize(v);\n    vtkMath::MultiplyScalar(v, t);\n    vtkMath::Add(p0, v, newP);\n    projectedPoints->InsertNextPoint(t, 0, 0);\n  }\n\n  vtkNew<vtkPolyData> projectedPolyData;\n  projectedPolyData->SetPoints(projectedPoints);\n\n  vtkNew<vtkVertexGlyphFilter> projectedGlyphFilter;\n  projectedGlyphFilter->SetInputData(projectedPolyData);\n  projectedGlyphFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> projectedMapper;\n  projectedMapper->SetInputConnection(projectedGlyphFilter->GetOutputPort());\n  vtkNew<vtkActor> projectedActor;\n  projectedActor->SetMapper(projectedMapper);\n  projectedActor->GetProperty()->SetPointSize(2);\n  projectedActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"PCADemo\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkVertexGlyphFilter> glyphFilter;\n  glyphFilter->SetInputConnection(transformFilter->GetOutputPort());\n  glyphFilter->Update();\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(glyphFilter->GetOutputPort());\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetPointSize(1);\n\n  // Map the points to spheres\n  auto sphereActor =\n      PointToGlyph(transformFilter->GetOutput()->GetPoints(), 0.007);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n\n  // leftRenderer->AddActor(originalActor);\n  leftRenderer->AddActor(sphereActor);\n  leftRenderer->AddActor(vector1Actor);\n  leftRenderer->AddActor(vector2Actor);\n\n  rightRenderer->AddActor(projectedActor);\n\n  leftRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Utilities/PCADemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PCADemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  FiltersStatistics\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PCADemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PCADemo MACOSX_BUNDLE PCADemo.cxx )\n  target_link_libraries(PCADemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PCADemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/PCADemo/#download-and-build-pcademo","title":"Download and Build PCADemo","text":"

        Click here to download PCADemo and its CMakeLists.txt file. Once the tarball PCADemo.tar has been downloaded and extracted,

        cd PCADemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PCADemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/PCAStatistics/","title":"PCAStatistics","text":"

        vtk-examples/Cxx/Utilities/PCAStatistics

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/PCAStatistics/#code","title":"Code","text":"

        PCAStatistics.cxx

        #include <vtkDoubleArray.h>\n#include <vtkNew.h>\n#include <vtkPCAStatistics.h>\n#include <vtkTable.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  // Each one of these arrays is a single component of\n  // the data. That is, if you have 3D spatial data (x,y,z)\n  // you need to construct an array of all the x values,\n  // an array of all the y values, and an array of all the\n  // z values.\n\n  // Construct a data set of 3 3D points.\n\n  // These would be all of your \"x\" values.\n  const char m0Name[] = \"M0\";\n  vtkNew<vtkDoubleArray> dataset1Arr;\n  dataset1Arr->SetNumberOfComponents(1);\n  dataset1Arr->SetName(m0Name);\n  dataset1Arr->InsertNextValue(0);\n  dataset1Arr->InsertNextValue(1);\n  dataset1Arr->InsertNextValue(0);\n\n  // These would be all of your \"y\" values.\n  const char m1Name[] = \"M1\";\n  vtkNew<vtkDoubleArray> dataset2Arr;\n  dataset2Arr->SetNumberOfComponents(1);\n  dataset2Arr->SetName(m1Name);\n  dataset2Arr->InsertNextValue(0);\n  dataset2Arr->InsertNextValue(0);\n  dataset2Arr->InsertNextValue(1);\n\n  // These would be all of your \"z\" values.\n  const char m2Name[] = \"M2\";\n  vtkNew<vtkDoubleArray> dataset3Arr;\n  dataset3Arr->SetNumberOfComponents(1);\n  dataset3Arr->SetName(m2Name);\n  dataset3Arr->InsertNextValue(0);\n  dataset3Arr->InsertNextValue(0);\n  dataset3Arr->InsertNextValue(0);\n\n  vtkNew<vtkTable> datasetTable;\n  datasetTable->AddColumn(dataset1Arr);\n  datasetTable->AddColumn(dataset2Arr);\n  datasetTable->AddColumn(dataset3Arr);\n\n  vtkNew<vtkPCAStatistics> pcaStatistics;\n  pcaStatistics->SetInputData(vtkStatisticsAlgorithm::INPUT_DATA, datasetTable);\n  pcaStatistics->SetColumnStatus(\"M0\", 1);\n  pcaStatistics->SetColumnStatus(\"M1\", 1);\n  pcaStatistics->SetColumnStatus(\"M2\", 1);\n  pcaStatistics->RequestSelectedColumns();\n  pcaStatistics->SetDeriveOption(true);\n  pcaStatistics->Update();\n\n  ///////// Eigenvalues ////////////\n  vtkNew<vtkDoubleArray> eigenvalues;\n  pcaStatistics->GetEigenvalues(eigenvalues);\n  //  double eigenvaluesGroundTruth[3] = {.5, .166667, 0};\n  for (vtkIdType i = 0; i < eigenvalues->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Eigenvalue \" << i << \" = \" << eigenvalues->GetValue(i)\n              << std::endl;\n  }\n\n  ///////// Eigenvectors ////////////\n  vtkNew<vtkDoubleArray> eigenvectors;\n\n  pcaStatistics->GetEigenvectors(eigenvectors);\n  for (vtkIdType i = 0; i < eigenvectors->GetNumberOfTuples(); i++)\n  {\n    std::cout << \"Eigenvector \" << i << \" : \";\n    double* evec = new double[eigenvectors->GetNumberOfComponents()];\n    eigenvectors->GetTuple(i, evec);\n    for (vtkIdType j = 0; j < eigenvectors->GetNumberOfComponents(); j++)\n    {\n      std::cout << evec[j] << \" \";\n      vtkNew<vtkDoubleArray> eigenvectorSingle;\n      pcaStatistics->GetEigenvector(i, eigenvectorSingle);\n    }\n    delete[] evec;\n    std::cout << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/PCAStatistics/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PCAStatistics)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersStatistics\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PCAStatistics: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PCAStatistics MACOSX_BUNDLE PCAStatistics.cxx )\n  target_link_libraries(PCAStatistics PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PCAStatistics\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/PCAStatistics/#download-and-build-pcastatistics","title":"Download and Build PCAStatistics","text":"

        Click here to download PCAStatistics and its CMakeLists.txt file. Once the tarball PCAStatistics.tar has been downloaded and extracted,

        cd PCAStatistics/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PCAStatistics\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/PiecewiseFunction/","title":"PiecewiseFunction","text":"

        vtk-examples/Cxx/Utilities/PiecewiseFunction

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/PiecewiseFunction/#code","title":"Code","text":"

        PiecewiseFunction.cxx

        #include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPiecewiseFunction> piecewiseFunction;\n  piecewiseFunction->AddPoint(0.0, 0.0);\n  piecewiseFunction->AddPoint(1.0, 2.0);\n\n  double test = piecewiseFunction->GetValue(0.25);\n\n  std::cout << \"test: \" << test << \" (should be 0.5)\" << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/PiecewiseFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PiecewiseFunction)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PiecewiseFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PiecewiseFunction MACOSX_BUNDLE PiecewiseFunction.cxx )\n  target_link_libraries(PiecewiseFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PiecewiseFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/PiecewiseFunction/#download-and-build-piecewisefunction","title":"Download and Build PiecewiseFunction","text":"

        Click here to download PiecewiseFunction and its CMakeLists.txt file. Once the tarball PiecewiseFunction.tar has been downloaded and extracted,

        cd PiecewiseFunction/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PiecewiseFunction\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/PointInPolygon/","title":"PointInPolygon","text":"

        vtk-examples/Cxx/Utilities/PointInPolygon

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/PointInPolygon/#code","title":"Code","text":"

        PointInPolygon.cxx

        #include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolygon.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  // Create the polygon\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPoints()->InsertNextPoint(0.0, 0.0, 0.0);\n  polygon->GetPoints()->InsertNextPoint(1.0, 0.0, 0.0);\n  polygon->GetPoints()->InsertNextPoint(1.0, 1.0, 0.0);\n  polygon->GetPoints()->InsertNextPoint(0.0, 1.0, 0.0);\n\n  double testIn[3] = {0.5, 0.5, 0.0};\n  double testOut[3] = {2.0, 0.5, 0.0};\n\n  double n[3];\n  polygon->ComputeNormal(\n      polygon->GetPoints()->GetNumberOfPoints(),\n      static_cast<double*>(polygon->GetPoints()->GetData()->GetVoidPointer(0)),\n      n);\n\n  double bounds[6];\n  polygon->GetPoints()->GetBounds(bounds);\n\n  std::cout << \"testIn in polygon? \"\n            << polygon->PointInPolygon(\n                   testIn, polygon->GetPoints()->GetNumberOfPoints(),\n                   static_cast<double*>(\n                       polygon->GetPoints()->GetData()->GetVoidPointer(0)),\n                   bounds, n)\n            << std::endl;\n\n  std::cout << \"testOut in polygon? \"\n            << polygon->PointInPolygon(\n                   testOut, polygon->GetPoints()->GetNumberOfPoints(),\n                   static_cast<double*>(\n                       polygon->GetPoints()->GetData()->GetVoidPointer(0)),\n                   bounds, n)\n            << std::endl;\n\n  /*\n  std::cout << \"New functions:\" << std::endl;\n\n  std::cout << \"testIn in polygon? \" << polygon->PointInPolygon(testIn) <<\n  std::endl;\n\n  std::cout << \"testOut in polygon? \" << polygon->PointInPolygon(testOut) <<\n  std::endl;\n  */\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/PointInPolygon/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointInPolygon)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointInPolygon: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointInPolygon MACOSX_BUNDLE PointInPolygon.cxx )\n  target_link_libraries(PointInPolygon PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointInPolygon\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/PointInPolygon/#download-and-build-pointinpolygon","title":"Download and Build PointInPolygon","text":"

        Click here to download PointInPolygon and its CMakeLists.txt file. Once the tarball PointInPolygon.tar has been downloaded and extracted,

        cd PointInPolygon/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointInPolygon\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/RenderScalarToFloatBuffer/","title":"RenderScalarToFloatBuffer","text":"

        vtk-examples/Cxx/Utilities/RenderScalarToFloatBuffer

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/RenderScalarToFloatBuffer/#code","title":"Code","text":"

        RenderScalarToFloatBuffer.cxx

        // Renders a scalar from a polydata into a float buffer.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCameraPass.h>\n#include <vtkDataSetReader.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkImageActor.h>\n#include <vtkImageMapToColors.h>\n#include <vtkImageSliceMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSequencePass.h>\n#include <vtkValuePass.h>\n#include <vtkVersion.h>\n#include <vtkWindowToImageFilter.h>\n#include <vtkXMLImageDataWriter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 4)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" input(.vtk) array_name output(.vti) e.g. uGridEx.vtk \"\n                 \"scalars RenderScalarToFloatBuffer.vti\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  vtkNew<vtkDataSetReader> fileReader;\n\n  // Read .vtk file\n  fileReader->SetFileName(argv[1]);\n\n  // Render the scalar into an image\n  vtkNew<vtkDataSetSurfaceFilter> surface;\n  surface->SetInputConnection(fileReader->GetOutputPort());\n  mapper->SetInputConnection(surface->GetOutputPort());\n  actor->SetMapper(mapper);\n  renderer->AddActor(actor);\n  renWin->AddRenderer(renderer);\n  iRen->SetRenderWindow(renWin);\n  renWin->SetMultiSamples(0);\n  renderer->ResetCamera();\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->Elevation(-90);\n\n  vtkNew<vtkValuePass> valuePass;\n#if VTK_MAJOR_VERSION < 9\n  valuePass->SetRenderingMode(vtkValuePass::FLOATING_POINT);\n#endif\n  valuePass->SetInputArrayToProcess(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA,\n                                    argv[2]);\n  valuePass->SetInputComponentToProcess(0);\n  vtkNew<vtkRenderPassCollection> passes;\n  passes->AddItem(valuePass);\n  vtkNew<vtkSequencePass> sequence;\n  sequence->SetPasses(passes);\n  vtkNew<vtkCameraPass> cameraPass;\n  cameraPass->SetDelegatePass(sequence);\n  renderer->SetPass(cameraPass);\n  renWin->Render();\n  // Get the rendered image\n  vtkFloatArray* buffer = valuePass->GetFloatImageDataArray(renderer);\n  int* ext = valuePass->GetFloatImageExtents();\n  buffer->SetName(argv[2]);\n  vtkNew<vtkImageData> image;\n  image->SetExtent(ext);\n  image->GetPointData()->SetScalars(buffer);\n\n  // Write the image\n  vtkNew<vtkXMLImageDataWriter> writer;\n  writer->SetFileName(argv[3]);\n  writer->SetInputDataObject(image);\n  writer->Write();\n\n  // Show the image on the screen\n  renWin->RemoveRenderer(renderer);\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.6, 0);\n  lut->SetSaturationRange(1.0, 0);\n  lut->SetValueRange(0.5, 1.0);\n  lut->SetTableRange(image->GetScalarRange());\n  vtkNew<vtkImageMapToColors> mapColors;\n  mapColors->SetLookupTable(lut);\n  mapColors->SetInputDataObject(image);\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->GetMapper()->SetInputConnection(mapColors->GetOutputPort());\n  vtkNew<vtkRenderer> ren;\n  ren->AddActor(imageActor);\n  ren->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renWin->AddRenderer(ren);\n  renWin->SetWindowName(\"RenderScalarToFloatBuffer\");\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/RenderScalarToFloatBuffer/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RenderScalarToFloatBuffer)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeometry\n  IOLegacy\n  IOXML\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RenderScalarToFloatBuffer: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RenderScalarToFloatBuffer MACOSX_BUNDLE RenderScalarToFloatBuffer.cxx )\n  target_link_libraries(RenderScalarToFloatBuffer PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RenderScalarToFloatBuffer\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/RenderScalarToFloatBuffer/#download-and-build-renderscalartofloatbuffer","title":"Download and Build RenderScalarToFloatBuffer","text":"

        Click here to download RenderScalarToFloatBuffer and its CMakeLists.txt file. Once the tarball RenderScalarToFloatBuffer.tar has been downloaded and extracted,

        cd RenderScalarToFloatBuffer/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RenderScalarToFloatBuffer\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ReportRenderWindowCapabilities/","title":"ReportRenderWindowCapabilities","text":"

        vtk-examples/Cxx/Utilities/ReportRenderWindowCapabilities

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ReportRenderWindowCapabilities/#code","title":"Code","text":"

        ReportRenderWindowCapabilities.cxx

        #include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer and render window<\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ReportRenderWindowCapabilities\");\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  std::cout << renderWindow->ReportCapabilities();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ReportRenderWindowCapabilities/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReportRenderWindowCapabilities)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReportRenderWindowCapabilities: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReportRenderWindowCapabilities MACOSX_BUNDLE ReportRenderWindowCapabilities.cxx )\n  target_link_libraries(ReportRenderWindowCapabilities PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReportRenderWindowCapabilities\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ReportRenderWindowCapabilities/#download-and-build-reportrenderwindowcapabilities","title":"Download and Build ReportRenderWindowCapabilities","text":"

        Click here to download ReportRenderWindowCapabilities and its CMakeLists.txt file. Once the tarball ReportRenderWindowCapabilities.tar has been downloaded and extracted,

        cd ReportRenderWindowCapabilities/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReportRenderWindowCapabilities\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/RescaleReverseLUT/","title":"RescaleReverseLUT","text":"

        vtk-examples/Cxx/Utilities/RescaleReverseLUT

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Utilities/RescaleReverseLUT/#description","title":"Description","text":"

        This example shows how to adjust a colormap so that the colormap scalar range matches the scalar range on the object. This is done by adjusting the colormap so that the colormap scalar range matches the scalar range of the object by rescaling the control points and, optionally, reversing the order of the colors.

        Of course, if you are generating the scalars, it may be easier to just change the scalar range of your filter. However, this may not be possible in some cases.

        Here, we generate the original Color Transfer Function (CTF) corresponding to the seven colors that Isaac Newton labeled when dividing the spectrum of visible light in 1672. There are seven colors and the scalar range is [-1, 1].

        The cylinder has a vtkElevationFilter applied to it with a scalar range of [0, 1].

        There are four images:

        • Original - The cylinder is colored by only the top four colors from the CTF. This is because the elevation scalar range on the cylinder is [0, 1] and the CTF scalar range is [-1, 1]. So the coloring is green->violet.
        • Reversed - We have reversed the colors from the original CTF and the lower four colors in the original CTF are now the top four colors used to color the cylinder. The coloring is now green->red.
        • Rescaled - The original CTF is rescaled to the range [0, 1] to match the scalar range of the elevation filter. The coloring is red->violet.
        • Rescaled and Reversed - The original CTF is rescaled to the range [0, 1] and the colors reversed. The coloring is violet->red.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/RescaleReverseLUT/#code","title":"Code","text":"

        RescaleReverseLUT.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCylinderSource.h>\n#include <vtkDiscretizableColorTransferFunction.h>\n#include <vtkElevationFilter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <array>\n#include <string>\n#include <vector>\n\nnamespace {\n/**\n * Generate the color transfer function.\n *\n * The seven colors corresponding to the colors that Isaac Newton labelled\n *     when dividing the spectrum of visible light in 1672 are used.\n *\n * The modern variant of these colors can be selected and used instead.\n *\n * See: [Rainbow](https://en.wikipedia.org/wiki/Rainbow)\n *\n * @param modern: Selects either Newton's original seven colors or the modern\n * version.\n *\n * @return The color transfer function.\n */\nvtkNew<vtkDiscretizableColorTransferFunction>\nGetCTF(bool const& modern = false);\n\n/**\n * Generate a new color transfer function from the old one,\n * adding in the new x and rgb values.\n *\n * @param oldCTF: The old color transfer function.\n * @param newX: The new color x-values.\n * @param newRGB: The color RGB values.\n * @param reverse: If true, reverse the colors.\n *\n * @return The new color transfer function.\n */\nvtkNew<vtkDiscretizableColorTransferFunction>\nGenerateNewCTF(vtkNew<vtkDiscretizableColorTransferFunction> const& oldCTF,\n               std::vector<double> const& newX,\n               std::vector<std::array<double, 3>> const& newRGB,\n               bool const& reverse = false);\n\n/**\n * Rescale the values.\n *\n * See:\n * https://stats.stackexchange.com/questions/25894/changing-the-scale-of-a-variable-to-0-100\n *\n * @param xv: The values to be rescaled.\n * @param newMin: The new minimum value.\n * @param newMax: The new maximum value.\n *\n * @return The rescaled values.\n */\nstd::vector<double> Rescale(std::vector<double> const& xv,\n                            double const& newMin = 0, double const& newMax = 1);\n\n/**\n * Rescale and, optionally, reverse the colors in the color transfer function.\n *\n * @param ctf: The color transfer function to rescale.\n * @param newMin: The new minimum value.\n * @param newMax: The new maximum value.\n * @param reverse: If true, reverse the colors.\n *\n * @return The rescaled color transfer function.\n */\nvtkNew<vtkDiscretizableColorTransferFunction>\nRescaleCTF(vtkNew<vtkDiscretizableColorTransferFunction> const& ctf,\n           double const& newMin = 0, double const& newMax = 1,\n           bool const& reverse = false);\n} // namespace\n\nint main(int, char*[])\n{\n  std::array<unsigned char, 4> bkg{82, 87, 110, 255};\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"ParaViewBkg\", bkg.data());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(640 * 2, 480 * 2);\n  renWin->SetWindowName(\"RescaleReverseLUT\");\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  std::vector<vtkNew<vtkDiscretizableColorTransferFunction>> ctf;\n  ctf.push_back(GetCTF(false));\n  const double* tmp = ctf[0]->GetRange();\n  ctf.push_back(RescaleCTF(ctf[0], 0, 1, false));\n  ctf.push_back(RescaleCTF(ctf[0], tmp[0], tmp[1], true));\n  ctf.push_back(RescaleCTF(ctf[0], 0, 1, true));\n\n  // Define viewport ranges.\n  std::array<double, 4> xMins{0.0, 0.0, 0.5, 0.5};\n  std::array<double, 4> xMaxs{0.5, 0.5, 1.0, 1.0};\n  std::array<double, 4> yMins{0.5, 0.0, 0.5, 0.0};\n  std::array<double, 4> yMaxs{1.0, 0.5, 1.0, 0.5};\n\n  // Define titles.\n  std::vector<std::string> titles{\"Orginal\", \"Rescaled\", \"Reversed\",\n                                  \"Rescaled and Reversed\"};\n\n  // Create a common text property->\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetFontSize(36);\n  textProperty->SetJustificationToCentered();\n  textProperty->SetColor(colors->GetColor3d(\"LightGoldenrodYellow\").GetData());\n\n  std::vector<vtkSmartPointer<vtkCylinderSource>> sources;\n  std::vector<vtkSmartPointer<vtkElevationFilter>> elevation_filters;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  std::vector<vtkSmartPointer<vtkScalarBarActor>> scalarBars;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  std::vector<vtkSmartPointer<vtkTextMapper>> textMappers;\n  std::vector<vtkSmartPointer<vtkActor2D>> textActors;\n\n  for (auto i = 0; i < 4; ++i)\n  {\n    vtkNew<vtkCylinderSource> cylinder;\n    cylinder->SetCenter(0.0, 0.0, 0.0);\n    cylinder->SetResolution(6);\n    cylinder->Update();\n    double* bounds = cylinder->GetOutput()->GetBounds();\n    sources.push_back(cylinder);\n\n    vtkNew<vtkElevationFilter> elevation_filter;\n    elevation_filter->SetScalarRange(0, 1);\n    elevation_filter->SetLowPoint(0, bounds[2], 0);\n    elevation_filter->SetHighPoint(0, bounds[3], 0);\n    elevation_filter->SetInputConnection(sources[i]->GetOutputPort());\n    elevation_filters.push_back(elevation_filter);\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(elevation_filters[i]->GetOutputPort());\n    mapper->SetLookupTable(ctf[i]);\n    mapper->SetColorModeToMapScalars();\n    mapper->InterpolateScalarsBeforeMappingOn();\n    mappers.push_back(mapper);\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mappers[i]);\n    actors.push_back(actor);\n\n    // Add a scalar bar.\n    vtkNew<vtkScalarBarActor> scalarBar;\n    scalarBar->SetLookupTable(ctf[i]);\n    scalarBars.push_back(scalarBar);\n\n    vtkNew<vtkTextMapper> textMapper;\n    textMappers.push_back(textMapper);\n    textMappers[i]->SetInput(titles[i].c_str());\n    textMappers[i]->SetTextProperty(textProperty);\n\n    vtkNew<vtkActor2D> textActor;\n    textActors.push_back(textActor);\n    textActors[i]->SetMapper(textMappers[i]);\n    // Note: The position of an Actor2D is specified in display coordinates.\n    textActors[i]->SetPosition(300, 16);\n\n    vtkNew<vtkRenderer> ren;\n    ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n    ren->AddActor(actors[i]);\n    ren->AddActor(scalarBars[i]);\n    ren->AddActor(textActors[i]);\n    ren->SetViewport(xMins[i], yMins[i], xMaxs[i], yMaxs[i]);\n    renderers.push_back(ren);\n\n    renWin->AddRenderer(renderers[i]);\n  }\n\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkNew<vtkDiscretizableColorTransferFunction> GetCTF(bool const& modern)\n{\n  // name: Rainbow, creator: Andrew Maclean\n  // interpolationspace: RGB, space: rgb\n  // file name:\n\n  vtkNew<vtkDiscretizableColorTransferFunction> ctf;\n\n  ctf->SetColorSpaceToRGB();\n  ctf->SetScaleToLinear();\n  ctf->SetNanColor(0.5, 0.5, 0.5);\n  ctf->SetBelowRangeColor(0.0, 0.0, 0.0);\n  ctf->UseBelowRangeColorOn();\n  ctf->SetAboveRangeColor(1.0, 1.0, 1.0);\n  ctf->UseAboveRangeColorOn();\n\n  if (modern)\n  {\n    ctf->AddRGBPoint(-1.0, 1.0, 0.0, 0.0);                 // Red\n    ctf->AddRGBPoint(-2.0 / 3.0, 1.0, 128.0 / 255.0, 0.0); // Orange #ff8000\n    ctf->AddRGBPoint(-1.0 / 3.0, 1.0, 1.0, 0.0);           // Yellow\n    ctf->AddRGBPoint(0.0, 0.0, 1.0, 0.0);                  // Green  #00ff00\n    ctf->AddRGBPoint(1.0 / 3.0, 0.0, 1.0, 1.0);            // Cyan\n    ctf->AddRGBPoint(2.0 / 3.0, 0.0, 0.0, 1.0);            // Blue\n    ctf->AddRGBPoint(1.0, 128.0 / 255.0, 0.0, 1.0);        // Violet #8000ff\n  }\n  else\n  {\n    ctf->AddRGBPoint(-1.0, 1.0, 0.0, 0.0);                 // Red\n    ctf->AddRGBPoint(-2.0 / 3.0, 1.0, 165.0 / 255.0, 0.0); // Orange #00a500\n    ctf->AddRGBPoint(-1.0 / 3.0, 1.0, 1.0, 0.0);           // Yellow\n    ctf->AddRGBPoint(0.0, 0.0, 125.0 / 255.0, 0.0);        // Green  #008000\n    ctf->AddRGBPoint(1.0 / 3.0, 0.0, 153.0 / 255.0, 1.0);  // Blue   #0099ff\n    ctf->AddRGBPoint(2.0 / 3.0, 68.0 / 255.0, 0,\n                     153.0 / 255.0);                // Indigo #4400ff\n    ctf->AddRGBPoint(1.0, 153.0 / 255.0, 0.0, 1.0); // Violet #9900ff\n  }\n\n  ctf->SetNumberOfValues(7);\n  ctf->DiscretizeOn();\n\n  return ctf;\n}\n\nvtkNew<vtkDiscretizableColorTransferFunction>\nGenerateNewCTF(vtkNew<vtkDiscretizableColorTransferFunction> const& oldCTF,\n               std::vector<double> const& newX,\n               std::vector<std::array<double, 3>> const& newRGB,\n               bool const& reverse)\n{\n  vtkNew<vtkDiscretizableColorTransferFunction> newCTF;\n  newCTF->SetScale(oldCTF->GetScale());\n  newCTF->SetColorSpace(oldCTF->GetColorSpace());\n  newCTF->SetNanColor(oldCTF->GetNanColor());\n  if (!reverse)\n  {\n    newCTF->SetBelowRangeColor(oldCTF->GetBelowRangeColor());\n    newCTF->SetUseBelowRangeColor(oldCTF->GetUseBelowRangeColor());\n    newCTF->SetAboveRangeColor(oldCTF->GetAboveRangeColor());\n    newCTF->SetUseAboveRangeColor(oldCTF->GetUseAboveRangeColor());\n  }\n  else\n  {\n    newCTF->SetBelowRangeColor(oldCTF->GetAboveRangeColor());\n    newCTF->SetUseBelowRangeColor(oldCTF->GetUseAboveRangeColor());\n    newCTF->SetAboveRangeColor(oldCTF->GetBelowRangeColor());\n    newCTF->SetUseAboveRangeColor(oldCTF->GetUseBelowRangeColor());\n  }\n  newCTF->SetNumberOfValues(newX.size());\n  newCTF->SetDiscretize(oldCTF->GetDiscretize());\n  if (!reverse)\n  {\n    for (size_t i = 0; i < newX.size(); ++i)\n    {\n      newCTF->AddRGBPoint(newX[i], newRGB[i][0], newRGB[i][1],\n                          newRGB[i][2]);\n    }\n  }\n  else\n  {\n    auto sz = newX.size();\n    for (size_t i = 0; i < sz; i++)\n    {\n      auto j = sz - (i + 1);\n      newCTF->AddRGBPoint(newX[i], newRGB[j][0], newRGB[j][1],\n                          newRGB[j][2]);\n    }\n  }\n  newCTF->Build();\n  return newCTF;\n}\n\nstd::vector<double> Rescale(std::vector<double> const& values,\n                            double const& newMin, double const& newMax)\n{\n  std::vector<double> res;\n  double oldMin = *std::min_element(values.begin(), values.end());\n  double oldMax = *std::max_element(values.begin(), values.end());\n  for (size_t i = 0; i < values.size(); ++i)\n  {\n    double newV =\n        (newMax - newMin) / (oldMax - oldMin) * (values[i] - oldMin) + newMin;\n    // double newV1 =\n    //     (newMax - newMin) / (oldMax - oldMin) * (values[i] - oldMax) +\n    //     newMax;\n    res.push_back(newV);\n  }\n  return res;\n}\n\nvtkNew<vtkDiscretizableColorTransferFunction>\nRescaleCTF(vtkNew<vtkDiscretizableColorTransferFunction> const& ctf,\n           double const& newMin, double const& newMax, bool const& reverse)\n{\n  double r0;\n  double r1;\n\n  if (newMin > newMax)\n  {\n    r0 = newMax;\n    r1 = newMin;\n  }\n  else\n  {\n    r0 = newMin;\n    r1 = newMax;\n  }\n\n  std::vector<double> xv;\n  std::vector<std::array<double, 3>> rgbv;\n  double nv[6] = {0, 0, 0, 0, 0, 0};\n  for (auto i = 0; i < ctf->GetNumberOfValues(); ++i)\n  {\n    ctf->GetNodeValue(i, nv);\n    double x = nv[0];\n    std::array<double, 3> rgb;\n    for (auto j = 1; j < 4; ++j)\n    {\n      rgb[j - 1] = nv[j];\n    }\n    xv.push_back(x);\n    rgbv.push_back(rgb);\n  }\n  std::vector<double> xvr = Rescale(xv, r0, r1);\n\n  return GenerateNewCTF(ctf, xvr, rgbv, reverse);\n}\n\n} // namespace\n
        "},{"location":"Cxx/Utilities/RescaleReverseLUT/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RescaleReverseLUT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RescaleReverseLUT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RescaleReverseLUT MACOSX_BUNDLE RescaleReverseLUT.cxx )\n  target_link_libraries(RescaleReverseLUT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RescaleReverseLUT\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/RescaleReverseLUT/#download-and-build-rescalereverselut","title":"Download and Build RescaleReverseLUT","text":"

        Click here to download RescaleReverseLUT and its CMakeLists.txt file. Once the tarball RescaleReverseLUT.tar has been downloaded and extracted,

        cd RescaleReverseLUT/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RescaleReverseLUT\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ResetCameraOrientation/","title":"ResetCameraOrientation","text":"

        vtk-examples/Cxx/Utilities/ResetCameraOrientation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Utilities/ResetCameraOrientation/#description","title":"Description","text":"

        This example demonstrates how to reset the camera orientation.

        In this case, the original orientation is stored, a new orientation calculated, and, finally the original orientation is restored. The original, new and restored orientations of the cone are displayed in one second intervals. After this you can interact with the scene.

        To set the camera position, you can use:

        • SetPosition, SetFocalPoint, SetViewUp, SetDistance, SetClippingRange
        • Roll, Elevation, Azimuth
        • SetRoll, Pitch, Yaw

        If you haven't used SetDistance or SetClippingRange remember to ren->ResetCamera(); or ren.ResetCamera().

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ResetCameraOrientation/#code","title":"Code","text":"

        ResetCameraOrientation.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <chrono>\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <thread>\n#include <vector>\n\nnamespace {\n\n//! The positional information relating to the camera.\nstruct Orientation\n{\n  void ToVector(const double* from, std::vector<double>& to)\n  {\n    for (size_t i = 0; i < to.size(); ++i)\n    {\n      to[i] = from[i];\n    }\n  };\n\n  std::vector<double> position{0.0, 0.0, 0.0};\n  std::vector<double> focalPoint{0.0, 0.0, 0.0};\n  std::vector<double> viewUp{0.0, 0.0, 0.0};\n  double distance = 0;\n  std::vector<double> clipplingRange{0.0, 0.0};\n  std::vector<double> orientation{0.0, 0.0, 0.0};\n};\n\n//! Produce a comma-separated string of numbers from a vector.\n/*\n *\n * @param v - the vector of doubles.\n * @param precision - number of decimal places.\n * @param width - the width.\n * @return A comma-separated string.\n */\nstd::string CommaSeparatedList(std::vector<double> const& v,\n                               const int precision = 6, const int width = 10);\n\n//! Get the camera orientation.\n/*\n * @param ren - the renderer.\n * @return The orientation parameters.\n */\nOrientation GetOrientation(vtkRenderer* ren);\n\n//! Set the camera orientation.\n/*\n *\n * @param ren - the renderer.\n * @param p - The orientation parameters.\n * @return\n */\nvoid SetOrientation(vtkRenderer* ren, Orientation const& p);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> cone;\n  cone->SetHeight(3.0);\n  cone->SetRadius(1.0);\n  cone->SetResolution(10);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Bisque\").GetData());\n\n  vtkNew<vtkRenderer> ren;\n  ren->AddActor(coneActor);\n  ren->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"ResetCameraOrientation\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  vtkCamera* camera = ren->GetActiveCamera();\n  camera->SetRoll(15);\n  camera->Elevation(-15);\n  camera->Azimuth(30);\n  ren->ResetCamera();\n\n  renWin->Render();\n  Orientation originalOrient = GetOrientation(ren);\n  std::cout << std::setw(23) << \"Original orientation:\"\n            << CommaSeparatedList(originalOrient.orientation) << std::endl;\n  std::this_thread::sleep_for(std::chrono::seconds(1));\n\n  camera->SetPosition(-3.568189, 5.220048, 2.352639);\n  camera->SetFocalPoint(-0.399044, -0.282865, 0.131438);\n  camera->SetViewUp(0.623411, 0.573532, -0.531431);\n  camera->SetDistance(6.727500);\n  camera->SetClippingRange(3.001430, 11.434082);\n  // No need to use ren->ResetCamera() as we have all the parameters.\n  renWin->Render();\n  Orientation newOrient = GetOrientation(ren);\n  std::cout << std::setw(23)\n            << \"New orientation:\" << CommaSeparatedList(newOrient.orientation)\n            << std::endl;\n  std::this_thread::sleep_for(std::chrono::seconds(1));\n\n  std::cout << \"Reloading the original orientation.\" << std::endl;\n  SetOrientation(ren, originalOrient);\n  renWin->Render();\n  Orientation check = GetOrientation(ren);\n  std::cout << std::setw(23)\n            << \"Final orientation:\" << CommaSeparatedList(check.orientation)\n            << std::endl;\n  std::this_thread::sleep_for(std::chrono::seconds(1));\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nstd::string CommaSeparatedList(std::vector<double> const& v,\n                               const int precision, const int width)\n{\n  std::ostringstream os;\n  for (auto p = v.begin(); p < v.end() - 1; ++p)\n  {\n    os << std::fixed << std::setw(width) << std::setprecision(precision) << *p\n       << \", \";\n  }\n  os << std::fixed << std::setw(width) << std::setprecision(precision)\n     << v.back();\n  return os.str();\n}\n\nOrientation GetOrientation(vtkRenderer* ren)\n{\n  Orientation p;\n\n  vtkCamera* camera = ren->GetActiveCamera();\n  p.ToVector(camera->GetPosition(), p.position);\n  p.ToVector(camera->GetFocalPoint(), p.focalPoint);\n  p.ToVector(camera->GetViewUp(), p.viewUp);\n  p.distance = camera->GetDistance();\n  p.ToVector(camera->GetClippingRange(), p.clipplingRange);\n  p.ToVector(camera->GetOrientation(), p.orientation);\n\n  return p;\n}\n\nvoid SetOrientation(vtkRenderer* ren, Orientation const& p)\n{\n  vtkCamera* camera = ren->GetActiveCamera();\n  camera->SetPosition(p.position.data());\n  camera->SetFocalPoint(p.focalPoint.data());\n  camera->SetViewUp(p.viewUp.data());\n  camera->SetDistance(p.distance);\n  camera->SetClippingRange(p.clipplingRange.data());\n}\n\n} // namespace\n
        "},{"location":"Cxx/Utilities/ResetCameraOrientation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ResetCameraOrientation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ResetCameraOrientation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ResetCameraOrientation MACOSX_BUNDLE ResetCameraOrientation.cxx )\n  target_link_libraries(ResetCameraOrientation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ResetCameraOrientation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ResetCameraOrientation/#download-and-build-resetcameraorientation","title":"Download and Build ResetCameraOrientation","text":"

        Click here to download ResetCameraOrientation and its CMakeLists.txt file. Once the tarball ResetCameraOrientation.tar has been downloaded and extracted,

        cd ResetCameraOrientation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ResetCameraOrientation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/SaveSceneToFieldData/","title":"SaveSceneToFieldData","text":"

        vtk-examples/Cxx/Utilities/SaveSceneToFieldData

        "},{"location":"Cxx/Utilities/SaveSceneToFieldData/#description","title":"Description","text":"

        This example saves a vtkCamera's parameters in the vtkFieldData of a vkDataSet.

        To see how the scene is saved and restored,

        1. Interact with the scene. Press the e key to exit the first iteractor. The current state of the scene's vtkCamera will be saved in the vtkDataSet's vtkFieldData.

        2. Interact with the scene again. Press the e key to exit the second interactor. The scene will be restored to the previous state.

        3. Press the e key to exit the example.

        Info

        This example uses snippets.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/SaveSceneToFieldData/#code","title":"Code","text":"

        SaveSceneToFieldData.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFieldData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <vtksys/RegularExpression.hxx>\n#include <vtksys/SystemTools.hxx>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <fstream>\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\nvoid SaveSceneToFieldData(vtkDataSet* data, vtkActor* actor, vtkCamera* camera);\nvoid RestoreSceneFromFieldData(vtkDataSet* data, vtkActor* actor,\n                               vtkCamera* camera);\n} // namespace\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  ;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SaveSceneToFieldData\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  std::cout\n      << \"Interact with image to get desired view and then press 'e' or 'q'\"\n      << std::endl;\n\n  // Interact to change camera.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  // After the interaction is done, save the scene.\n  SaveSceneToFieldData(polyData, actor, renderer->GetActiveCamera());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  // After interaction, restore the scene.\n  RestoreSceneFromFieldData(polyData, actor, renderer->GetActiveCamera());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\n#include <sstream>\nnamespace {\nvoid SaveSceneToFieldData(vtkDataSet* data, vtkActor* /* actor */,\n                          vtkCamera* camera)\n{\n  std::ostringstream buffer;\n  double vector[3];\n  double scalar;\n\n  camera->GetFocalPoint(vector);\n  buffer << \"Camera:FocalPoint \" << vector[0] << \", \" << vector[1] << \", \"\n         << vector[2] << std::endl;\n  camera->GetPosition(vector);\n  buffer << \"Camera:Position \" << vector[0] << \", \" << vector[1] << \", \"\n         << vector[2] << std::endl;\n  camera->GetViewUp(vector);\n  buffer << \"Camera:ViewUp \" << vector[0] << \", \" << vector[1] << \", \"\n         << vector[2] << std::endl;\n  scalar = camera->GetViewAngle();\n  buffer << \"Camera:ViewAngle \" << scalar << std::endl;\n  camera->GetClippingRange(vector);\n  buffer << \"Camera:ClippingRange \" << vector[0] << \", \" << vector[1]\n         << std::endl;\n  vtkNew<vtkStringArray> cameraArray;\n  cameraArray->SetNumberOfValues(1);\n  cameraArray->SetValue(0, buffer.str());\n  cameraArray->SetName(\"Camera\");\n  data->GetFieldData()->AddArray(cameraArray);\n}\n\nvoid RestoreSceneFromFieldData(vtkDataSet* data, vtkActor* /* actor */,\n                               vtkCamera* camera)\n{\n\n  std::istringstream buffer;\n\n  // Get the saved camera information from the field data\n  if (dynamic_cast<vtkStringArray*>(\n          data->GetFieldData()->GetAbstractArray(\"Camera\")))\n  {\n    buffer.str(dynamic_cast<vtkStringArray*>(\n                   data->GetFieldData()->GetAbstractArray(\"Camera\"))\n                   ->GetValue(0));\n  }\n  else\n  {\n    return;\n  }\n\n  std::string line;\n\n  vtksys::RegularExpression reCP(\"^Camera:Position\");\n  vtksys::RegularExpression reCFP(\"^Camera:FocalPoint\");\n  vtksys::RegularExpression reCVU(\"^Camera:ViewUp\");\n  vtksys::RegularExpression reCVA(\"^Camera:ViewAngle\");\n  vtksys::RegularExpression reCCR(\"^Camera:ClippingRange\");\n  vtksys::RegularExpression floatNumber(\n      \"[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\"\n      \"\\\\-]*([0-9e\\\\.\\\\-]*[^,])\");\n  vtksys::RegularExpression floatScalar(\"[^0-9\\\\.\\\\-]*([0-9\\\\.\\\\-e]*[^,])\");\n\n  while (std::getline(buffer, line))\n  {\n    if (reCFP.find(line))\n    {\n      std::string rest(line, reCFP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetFocalPoint(atof(floatNumber.match(1).c_str()),\n                              atof(floatNumber.match(2).c_str()),\n                              atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCP.find(line))\n    {\n      std::string rest(line, reCP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetPosition(atof(floatNumber.match(1).c_str()),\n                            atof(floatNumber.match(2).c_str()),\n                            atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVU.find(line))\n    {\n      std::string rest(line, reCVU.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetViewUp(atof(floatNumber.match(1).c_str()),\n                          atof(floatNumber.match(2).c_str()),\n                          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVA.find(line))\n    {\n      std::string rest(line, reCVA.end());\n      if (floatScalar.find(rest))\n      {\n        camera->SetViewAngle(atof(floatScalar.match(1).c_str()));\n      }\n    }\n    else if (reCCR.find(line))\n    {\n      std::string rest(line, reCCR.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetClippingRange(atof(floatNumber.match(1).c_str()),\n                                 atof(floatNumber.match(2).c_str()));\n      }\n    }\n    else\n    {\n      std::cout << \"Unrecognized line: \" << line << std::endl;\n    }\n  }\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Utilities/SaveSceneToFieldData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SaveSceneToFieldData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SaveSceneToFieldData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SaveSceneToFieldData MACOSX_BUNDLE SaveSceneToFieldData.cxx )\n  target_link_libraries(SaveSceneToFieldData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SaveSceneToFieldData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/SaveSceneToFieldData/#download-and-build-savescenetofielddata","title":"Download and Build SaveSceneToFieldData","text":"

        Click here to download SaveSceneToFieldData and its CMakeLists.txt file. Once the tarball SaveSceneToFieldData.tar has been downloaded and extracted,

        cd SaveSceneToFieldData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SaveSceneToFieldData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/SaveSceneToFile/","title":"SaveSceneToFile","text":"

        vtk-examples/Cxx/Utilities/SaveSceneToFile

        "},{"location":"Cxx/Utilities/SaveSceneToFile/#description","title":"Description","text":"

        This example saves a vtkCamera's parameters in a file.

        To see how the scene is saved and restored,

        1. Interact with the scene. Press the e key to exit the first iteractor. The current state of the scene's vtkCamera will be saved in the file.
        2. Interact with the scene again. Press the e key to exit the second interactor. The saved file is read and the scene will be restored to the previous state.
        3. Press the e key to exit the example.

        Info

        This example uses snippets.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/SaveSceneToFile/#code","title":"Code","text":"

        SaveSceneToFile.cxx

        #include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTimerLog.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/RegularExpression.hxx>\n#include <vtksys/SystemTools.hxx>\n\n#include <fstream>\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n\nvoid SaveSceneToFile(std::string fileName, vtkActor* actor, vtkCamera* camera);\n\nvoid RestoreSceneFromFile(std::string fileName, vtkActor* actor,\n                          vtkCamera* camera);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Crimson\").GetData());\n  actor->GetProperty()->SetSpecular(.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  ;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  std::cout\n      << \"Interact with image to get desired view and then press 'e' or 'q'\"\n      << std::endl;\n\n  // Interact to change camera\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  // After the interaction is done, save the scene.\n  SaveSceneToFile(argv[2], actor, renderer->GetActiveCamera());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  // After interaction, restore the scene\n  RestoreSceneFromFile(argv[2], actor, renderer->GetActiveCamera());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid SaveSceneToFile(std::string fileName, vtkActor* /* actor */,\n                     vtkCamera* camera)\n{\n  // Actor\n  //  Position, orientation, origin, scale, usrmatrix, usertransform\n  // Camera\n  //  FocalPoint, Position, ViewUp, ViewAngle, ClippingRange\n  std::ofstream saveFile(fileName, std::ofstream::out);\n  double vector[3];\n  double scalar;\n\n  camera->GetFocalPoint(vector);\n  saveFile << \"Camera:FocalPoint \" << vector[0] << \", \" << vector[1] << \", \"\n           << vector[2] << std::endl;\n  camera->GetPosition(vector);\n  saveFile << \"Camera:Position \" << vector[0] << \", \" << vector[1] << \", \"\n           << vector[2] << std::endl;\n  camera->GetViewUp(vector);\n  saveFile << \"Camera:ViewUp \" << vector[0] << \", \" << vector[1] << \", \"\n           << vector[2] << std::endl;\n  scalar = camera->GetViewAngle();\n  saveFile << \"Camera:ViewAngle \" << scalar << std::endl;\n  camera->GetClippingRange(vector);\n  saveFile << \"Camera:ClippingRange \" << vector[0] << \", \" << vector[1]\n           << std::endl;\n  saveFile.close();\n}\n\nvoid RestoreSceneFromFile(std::string fileName, vtkActor* /* actor */,\n                          vtkCamera* camera)\n{\n  std::ifstream saveFile(fileName);\n  std::string line;\n\n  vtksys::RegularExpression reCP(\"^Camera:Position\");\n  vtksys::RegularExpression reCFP(\"^Camera:FocalPoint\");\n  vtksys::RegularExpression reCVU(\"^Camera:ViewUp\");\n  vtksys::RegularExpression reCVA(\"^Camera:ViewAngle\");\n  vtksys::RegularExpression reCCR(\"^Camera:ClippingRange\");\n  vtksys::RegularExpression floatNumber(\n      \"[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\\\\-]*([0-9e\\\\.\\\\-]*[^,])[^0-9\\\\.\"\n      \"\\\\-]*([0-9e\\\\.\\\\-]*[^,])\");\n  vtksys::RegularExpression floatScalar(\"[^0-9\\\\.\\\\-]*([0-9\\\\.\\\\-e]*[^,])\");\n\n  while (std::getline(saveFile, line) && !saveFile.eof())\n  {\n    if (reCFP.find(line))\n    {\n      std::string rest(line, reCFP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetFocalPoint(atof(floatNumber.match(1).c_str()),\n                              atof(floatNumber.match(2).c_str()),\n                              atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCP.find(line))\n    {\n      std::string rest(line, reCP.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetPosition(atof(floatNumber.match(1).c_str()),\n                            atof(floatNumber.match(2).c_str()),\n                            atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVU.find(line))\n    {\n      std::string rest(line, reCVU.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetViewUp(atof(floatNumber.match(1).c_str()),\n                          atof(floatNumber.match(2).c_str()),\n                          atof(floatNumber.match(3).c_str()));\n      }\n    }\n    else if (reCVA.find(line))\n    {\n      std::string rest(line, reCVA.end());\n      if (floatScalar.find(rest))\n      {\n        camera->SetViewAngle(atof(floatScalar.match(1).c_str()));\n      }\n    }\n    else if (reCCR.find(line))\n    {\n      std::string rest(line, reCCR.end());\n      if (floatNumber.find(rest))\n      {\n        camera->SetClippingRange(atof(floatNumber.match(1).c_str()),\n                                 atof(floatNumber.match(2).c_str()));\n      }\n    }\n    else\n    {\n      std::cout << \"Unrecognized line: \" << line << std::endl;\n    }\n  }\n  saveFile.close();\n}\n\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Utilities/SaveSceneToFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SaveSceneToFile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonSystem\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SaveSceneToFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SaveSceneToFile MACOSX_BUNDLE SaveSceneToFile.cxx )\n  target_link_libraries(SaveSceneToFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SaveSceneToFile\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/SaveSceneToFile/#download-and-build-savescenetofile","title":"Download and Build SaveSceneToFile","text":"

        Click here to download SaveSceneToFile and its CMakeLists.txt file. Once the tarball SaveSceneToFile.tar has been downloaded and extracted,

        cd SaveSceneToFile/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SaveSceneToFile\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/Screenshot/","title":"Screenshot","text":"

        vtk-examples/Cxx/Utilities/Screenshot

        "},{"location":"Cxx/Utilities/Screenshot/#description","title":"Description","text":"

        This example shows how to save the window to a file (png in this case). You can combine this with the KeypressEvents example to make a useful functionality.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/Screenshot/#code","title":"Code","text":"

        Screenshot.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVersion.h>\n#include <vtkWindowToImageFilter.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n  sphereSource->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"IndianRed\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetAlphaBitPlanes(1); // enable usage of alpha channel\n  renderWindow->SetWindowName(\"Screenshot\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  renderWindow->Render();\n\n  // Screenshot\n  vtkNew<vtkWindowToImageFilter> windowToImageFilter;\n  windowToImageFilter->SetInput(renderWindow);\n#if VTK_MAJOR_VERSION >= 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90\n  windowToImageFilter->SetScale(2); // image quality\n#else\n  windowToImageFilter->SetMagnification(2); // image quality\n#endif\n  windowToImageFilter->SetInputBufferTypeToRGBA(); // also record the alpha\n                                                   // (transparency) channel\n  windowToImageFilter->ReadFrontBufferOff();       // read from the back buffer\n  windowToImageFilter->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(\"screenshot2.png\");\n  writer->SetInputConnection(windowToImageFilter->GetOutputPort());\n  writer->Write();\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/Screenshot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Screenshot)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Screenshot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Screenshot MACOSX_BUNDLE Screenshot.cxx )\n  target_link_libraries(Screenshot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Screenshot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/Screenshot/#download-and-build-screenshot","title":"Download and Build Screenshot","text":"

        Click here to download Screenshot and its CMakeLists.txt file. Once the tarball Screenshot.tar has been downloaded and extracted,

        cd Screenshot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Screenshot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ShallowCopy/","title":"ShallowCopy","text":"

        vtk-examples/Cxx/Utilities/ShallowCopy

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ShallowCopy/#code","title":"Code","text":"

        ShallowCopy.cxx

        #include <vtkNew.h>\n#include <vtkPolyData.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPolyData> polydata;\n\n  vtkNew<vtkPolyData> polydataCopy;\n\n  polydataCopy->ShallowCopy(polydata);\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ShallowCopy/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShallowCopy)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShallowCopy: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShallowCopy MACOSX_BUNDLE ShallowCopy.cxx )\n  target_link_libraries(ShallowCopy PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShallowCopy\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ShallowCopy/#download-and-build-shallowcopy","title":"Download and Build ShallowCopy","text":"

        Click here to download ShallowCopy and its CMakeLists.txt file. Once the tarball ShallowCopy.tar has been downloaded and extracted,

        cd ShallowCopy/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ShallowCopy\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ShareCamera/","title":"ShareCamera","text":"

        vtk-examples/Cxx/Utilities/ShareCamera

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ShareCamera/#code","title":"Code","text":"

        ShareCamera.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataAlgorithm.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <map>\n#include <vector>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // We store background colors in a vector. Then we extract the red, green and\n  // blue components later when coloring the reneder background.\n  std::vector<vtkColor3ub> rendererColors;\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorSchemeByName(\"Brewer Qualitative Pastel2\");\n  rendererColors.push_back(colorSeries->GetColor(0));\n  rendererColors.push_back(colorSeries->GetColor(1));\n  rendererColors.push_back(colorSeries->GetColor(2));\n  rendererColors.push_back(colorSeries->GetColor(3));\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  double xmins[4] = {0, 0.5, 0, 0.5};\n  double xmaxs[4] = {0.5, 1, 0.5, 1};\n  double ymins[4] = {0, 0, 0.5, 0.5};\n  double ymaxs[4] = {0.5, 0.5, 1, 1};\n\n  vtkCamera* camera = nullptr;\n\n  // Using the superclass for the sources\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> sources;\n\n  for (unsigned i = 0; i < 4; i++)\n  {\n    switch (i)\n    {\n    case 0: {\n      // Create a sphere\n      vtkNew<vtkSphereSource> sphereSource;\n      sphereSource->SetCenter(0.0, 0.0, 0.0);\n      sphereSource->Update();\n      sources.push_back(sphereSource);\n      break;\n    }\n    case 1: {\n      // Create a cone\n      vtkNew<vtkConeSource> coneSource;\n      coneSource->SetCenter(0.0, 0.0, 0.0);\n      coneSource->Update();\n      sources.push_back(coneSource);\n      break;\n    }\n    case 2: {\n      // Create a cube\n      vtkNew<vtkCubeSource> cubeSource;\n      cubeSource->SetCenter(0.0, 0.0, 0.0);\n      cubeSource->Update();\n      sources.push_back(cubeSource);\n      break;\n    }\n    default:\n    case 3: {\n      // Create a cylinder\n      vtkNew<vtkCylinderSource> cylinderSource;\n      cylinderSource->SetCenter(0.0, 0.0, 0.0);\n      cylinderSource->Update();\n      sources.push_back(cylinderSource);\n    }\n    };\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sources[i]->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(actor);\n    double r, g, b;\n    r = rendererColors[i].GetRed() / 255.0;\n    g = rendererColors[i].GetGreen() / 255.0;\n    b = rendererColors[i].GetBlue() / 255.0;\n    renderer->SetBackground(r, g, b);\n\n    renderWindow->AddRenderer(renderer);\n\n    if (i == 0)\n    {\n      camera = renderer->GetActiveCamera();\n      camera->Azimuth(30);\n      camera->Elevation(30);\n    }\n    else\n    {\n      renderer->SetActiveCamera(camera);\n    }\n    renderer->SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i]);\n\n    renderer->ResetCamera();\n  }\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ShareCamera\");\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ShareCamera/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShareCamera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonExecutionModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShareCamera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShareCamera MACOSX_BUNDLE ShareCamera.cxx )\n  target_link_libraries(ShareCamera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShareCamera\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ShareCamera/#download-and-build-sharecamera","title":"Download and Build ShareCamera","text":"

        Click here to download ShareCamera and its CMakeLists.txt file. Once the tarball ShareCamera.tar has been downloaded and extracted,

        cd ShareCamera/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ShareCamera\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ShepardMethod/","title":"ShepardMethod","text":"

        vtk-examples/Cxx/Utilities/ShepardMethod

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Utilities/ShepardMethod/#description","title":"Description","text":"

        This example samples unstructured points onto structured points using the Shepard method. The example starts with two points which have associated scalars (0 (black) and 1(white)). The results are displayed by coloring planes between the two points with the corresponding interpolated values. The values are reflected by black (0) to white (1).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ShepardMethod/#code","title":"Code","text":"

        ShepardMethod.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkContourFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShepardMethod.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVertexGlyphFilter.h>\n\n// For compatibility with new VTK generic data arrays\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a set of vertices (polydata)\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(100.0, 0.0, 0.0);\n  points->InsertNextPoint(300.0, 0.0, 0.0);\n\n  // Setup colors\n  unsigned char white[3] = {255, 255, 255};\n  unsigned char black[3] = {0, 0, 0};\n\n  vtkNew<vtkUnsignedCharArray> vertexColors;\n  vertexColors->SetNumberOfComponents(3);\n  vertexColors->SetName(\"Colors\");\n  vertexColors->InsertNextTupleValue(black);\n  vertexColors->InsertNextTupleValue(white);\n\n  // Create a scalar array for the pointdata, each value represents the distance\n  // of the vertices from the first vertex.\n  vtkNew<vtkFloatArray> values;\n  values->SetNumberOfComponents(1);\n  values->SetName(\"Values\");\n  values->InsertNextValue(0.0);\n  values->InsertNextValue(1.0);\n\n  // We must make two objects, because the ShepardMethod uses the ActiveScalars,\n  // as does the renderer!\n  vtkNew<vtkPolyData> polydataToProcess;\n  polydataToProcess->SetPoints(points);\n  polydataToProcess->GetPointData()->SetScalars(values);\n\n  vtkNew<vtkPolyData> polydataToVisualize;\n  polydataToVisualize->SetPoints(points);\n  polydataToVisualize->GetPointData()->SetScalars(vertexColors);\n\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->AddInputData(polydataToVisualize);\n  vertexGlyphFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> vertsMapper;\n  // vertsMapper->ScalarVisibilityOff();\n  vertsMapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> vertsActor;\n  vertsActor->SetMapper(vertsMapper);\n  vertsActor->GetProperty()->SetColor(1, 0, 0);\n  vertsActor->GetProperty()->SetPointSize(3);\n\n  // Create a shepard filter to interpolate the vertices over a regularized\n  // image grid.\n  vtkNew<vtkShepardMethod> shepard;\n  shepard->SetInputData(polydataToProcess);\n  shepard->SetSampleDimensions(2, 2, 2);\n  shepard->SetModelBounds(100, 300, -10, 10, -10, 10);\n  shepard->SetMaximumDistance(1);\n\n  // Contour the shepard generated image at 3 isovalues.\n  // The accuracy of the results are highly dependent on how the shepard filter\n  // is set up.\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetNumberOfContours(3);\n  contourFilter->SetValue(0, 0.25);\n  contourFilter->SetValue(1, 0.50);\n  contourFilter->SetValue(2, 0.75);\n  contourFilter->SetInputConnection(shepard->GetOutputPort());\n  contourFilter->Update();\n\n  // Create a mapper and actor for the resulting isosurfaces.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contourFilter->GetOutputPort());\n  contourMapper->ScalarVisibilityOn();\n  contourMapper->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n  contourActor->GetProperty()->SetAmbient(1);\n  contourActor->GetProperty()->SetSpecular(0);\n  contourActor->GetProperty()->SetDiffuse(0);\n\n  // Report the results of the interpolation.\n  double* range = contourFilter->GetOutput()->GetScalarRange();\n\n  std::cout << \"Shepard interpolation:\" << std::endl;\n  std::cout << \"Contour output scalar range: \" << range[0] << \", \" << range[1]\n            << std::endl;\n\n  vtkIdType nCells = contourFilter->GetOutput()->GetNumberOfCells();\n  double bounds[6];\n  for (vtkIdType i = 0; i < nCells; ++i)\n  {\n    if (i %\n        2) // each isosurface value only has 2 cells so report on the odd ones.\n    {\n      contourFilter->GetOutput()->GetCellBounds(i, bounds);\n      std::cout << \"Cell \" << i << \", x position: \" << bounds[0] << std::endl;\n    }\n  }\n\n  // Create a transfer function to color the isosurfaces.\n  vtkNew<vtkColorTransferFunction> lut;\n  lut->SetColorSpaceToRGB();\n  lut->AddRGBPoint(range[0], 0, 0, 0); // black\n  lut->AddRGBPoint(range[1], 1, 1, 1); // white\n  lut->SetScaleToLinear();\n\n  contourMapper->SetLookupTable(lut);\n\n  // Create a renderer, render window and interactor.\n  vtkNew<vtkRenderer> renderer;\n  renderer->GradientBackgroundOn();\n  renderer->AddActor(contourActor);\n  renderer->AddActor(vertsActor);\n  renderer->SetBackground(colors->GetColor3d(\"Blue\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Magenta\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ShepardMethod\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Position the camera so that the image produced is viewable\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->SetPosition(450, 100, 100);\n  camera->SetFocalPoint(200, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ShepardMethod/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShepardMethod)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShepardMethod: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShepardMethod MACOSX_BUNDLE ShepardMethod.cxx )\n  target_link_libraries(ShepardMethod PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShepardMethod\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ShepardMethod/#download-and-build-shepardmethod","title":"Download and Build ShepardMethod","text":"

        Click here to download ShepardMethod and its CMakeLists.txt file. Once the tarball ShepardMethod.tar has been downloaded and extracted,

        cd ShepardMethod/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ShepardMethod\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/SortDataArray/","title":"SortDataArray","text":"

        vtk-examples/Cxx/Utilities/SortDataArray

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/SortDataArray/#code","title":"Code","text":"

        SortDataArray.cxx

        #include <vtkDoubleArray.h>\n#include <vtkIntArray.h>\n#include <vtkNew.h>\n#include <vtkSortDataArray.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkDoubleArray> valueArray;\n  valueArray->InsertNextValue(20.0);\n  valueArray->InsertNextValue(10.0);\n  valueArray->InsertNextValue(30.0);\n\n  vtkNew<vtkIntArray> keyArray;\n  keyArray->InsertNextValue(1);\n  keyArray->InsertNextValue(0);\n  keyArray->InsertNextValue(2);\n\n  std::cout << \"Unsorted: \" << valueArray->GetValue(0) << \" \"\n            << valueArray->GetValue(1) << \" \" << valueArray->GetValue(2)\n            << std::endl;\n\n  // Sort the array\n  vtkNew<vtkSortDataArray> sortDataArray;\n  sortDataArray->Sort(keyArray, valueArray);\n\n  std::cout << \"Sorted: \" << valueArray->GetValue(0) << \" \"\n            << valueArray->GetValue(1) << \" \" << valueArray->GetValue(2)\n            << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/SortDataArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SortDataArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SortDataArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SortDataArray MACOSX_BUNDLE SortDataArray.cxx )\n  target_link_libraries(SortDataArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SortDataArray\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/SortDataArray/#download-and-build-sortdataarray","title":"Download and Build SortDataArray","text":"

        Click here to download SortDataArray and its CMakeLists.txt file. Once the tarball SortDataArray.tar has been downloaded and extracted,

        cd SortDataArray/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SortDataArray\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/SparseArray/","title":"SparseArray","text":"

        vtk-examples/Cxx/Utilities/SparseArray

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/SparseArray/#code","title":"Code","text":"

        SparseArray.cxx

        #include <vtkNew.h>\n#include <vtkSparseArray.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkSparseArray<double>> array;\n  array->Resize(5, 1);\n  array->SetNullValue(-1);\n\n  for (unsigned int i = 0; i < 5; i++)\n  {\n    array->SetValue(i, 0, i);\n  }\n\n  for (unsigned int i = 0; i < 6; i++)\n  {\n    double val = array->GetValue(i, 0);\n    std::cout << val << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/SparseArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SparseArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SparseArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SparseArray MACOSX_BUNDLE SparseArray.cxx )\n  target_link_libraries(SparseArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SparseArray\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/SparseArray/#download-and-build-sparsearray","title":"Download and Build SparseArray","text":"

        Click here to download SparseArray and its CMakeLists.txt file. Once the tarball SparseArray.tar has been downloaded and extracted,

        cd SparseArray/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SparseArray\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/TimeStamp/","title":"TimeStamp","text":"

        vtk-examples/Cxx/Utilities/TimeStamp

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/TimeStamp/#code","title":"Code","text":"

        TimeStamp.cxx

        #include <vtkTimeStamp.h>\n\nint main(int, char*[])\n{\n  vtkTimeStamp timeStamp;\n  std::cout << \"Time stamp: \" << timeStamp << std::endl;\n  timeStamp.Modified();\n  std::cout << \"Time stamp: \" << timeStamp << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/TimeStamp/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TimeStamp)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TimeStamp: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TimeStamp MACOSX_BUNDLE TimeStamp.cxx )\n  target_link_libraries(TimeStamp PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TimeStamp\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/TimeStamp/#download-and-build-timestamp","title":"Download and Build TimeStamp","text":"

        Click here to download TimeStamp and its CMakeLists.txt file. Once the tarball TimeStamp.tar has been downloaded and extracted,

        cd TimeStamp/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TimeStamp\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/Timer/","title":"Timer","text":"

        vtk-examples/Cxx/Utilities/Timer

        "},{"location":"Cxx/Utilities/Timer/#description","title":"Description","text":"

        This example demonstrates how to use a timer with an interactor. It outputs a count every specified interval.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/Timer/#code","title":"Code","text":"

        Timer.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nclass vtkTimerCallback : public vtkCallbackCommand\n{\npublic:\n  vtkTimerCallback() = default;\n\n  static vtkTimerCallback* New()\n  {\n    vtkTimerCallback* cb = new vtkTimerCallback;\n    cb->TimerCount = 0;\n    return cb;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long eventId,\n                       void* vtkNotUsed(callData))\n  {\n    if (vtkCommand::TimerEvent == eventId)\n    {\n      ++this->TimerCount;\n    }\n    std::cout << this->TimerCount << std::endl;\n    if (this->TimerCount >= this->maxCount)\n    {\n      auto iren = dynamic_cast<vtkRenderWindowInteractor*>(caller);\n      if (this->timerId > -1)\n      {\n        iren->DestroyTimer(this->timerId);\n      }\n    }\n  }\n\nprivate:\n  int TimerCount = 0;\n\npublic:\n  int maxCount = 0;\n  int timerId = -1;\n};\n\nint main(int, char*[])\n{\n  // Setup renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Timer\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Initialize must be called prior to creating timer events.\n  renderWindow->Render();\n  interactor->Initialize();\n\n  // Sign up to receive TimerEvent.\n  vtkNew<vtkTimerCallback> cb;\n  interactor->AddObserver(vtkCommand::TimerEvent, cb);\n\n  int timerId = interactor->CreateRepeatingTimer(100);\n  std::cout << \"timerId: \" << timerId << std::endl;\n  // Destroy the timer when maxCount is reached.\n  cb->maxCount = 10;\n  cb->timerId = timerId;\n\n  // Note: nothing is displayed in the render window.\n  // Start the interaction and timer.\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/Timer/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Timer)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Timer: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Timer MACOSX_BUNDLE Timer.cxx )\n  target_link_libraries(Timer PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Timer\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/Timer/#download-and-build-timer","title":"Download and Build Timer","text":"

        Click here to download Timer and its CMakeLists.txt file. Once the tarball Timer.tar has been downloaded and extracted,

        cd Timer/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Timer\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/TimerLog/","title":"TimerLog","text":"

        vtk-examples/Cxx/Utilities/TimerLog

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/TimerLog/#code","title":"Code","text":"

        TimerLog.cxx

        #include <vtkNew.h>\n#include <vtkTimerLog.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkTimerLog> timerLog;\n\n  std::cout << \"Current time: \" << timerLog->GetUniversalTime() << std::endl;\n\n  timerLog->MarkEvent(\"opened file\");\n\n  timerLog->MarkEvent(\"did other stuff\");\n\n  std::cout << \"Timer log:\" << *timerLog << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/TimerLog/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TimerLog)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonSystem\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TimerLog: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TimerLog MACOSX_BUNDLE TimerLog.cxx )\n  target_link_libraries(TimerLog PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TimerLog\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/TimerLog/#download-and-build-timerlog","title":"Download and Build TimerLog","text":"

        Click here to download TimerLog and its CMakeLists.txt file. Once the tarball TimerLog.tar has been downloaded and extracted,

        cd TimerLog/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TimerLog\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/UnknownLengthArray/","title":"UnknownLengthArray","text":"

        vtk-examples/Cxx/Utilities/UnknownLengthArray

        "},{"location":"Cxx/Utilities/UnknownLengthArray/#description","title":"Description","text":"

        The only difference between this example and the KnownLengthArray example is that SetNumberOfValues() is not called, and SetValue() is replaced by InsertNextValue().

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/UnknownLengthArray/#code","title":"Code","text":"

        UnknownLengthArray.cxx

        #include <vtkFloatArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFloatArray> distances;\n  distances->SetName(\"Distances\");\n  distances->SetNumberOfComponents(1);\n\n  // set values\n  for (vtkIdType i = 0; i < 5; i++)\n  {\n    float f = (float)i + 0.1;\n    // this will allocate memory as necessary\n    distances->InsertNextValue(f);\n  }\n\n  // get values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    float f = distances->GetValue(i);\n    std::cout << f << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/UnknownLengthArray/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(UnknownLengthArray)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"UnknownLengthArray: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(UnknownLengthArray MACOSX_BUNDLE UnknownLengthArray.cxx )\n  target_link_libraries(UnknownLengthArray PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS UnknownLengthArray\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/UnknownLengthArray/#download-and-build-unknownlengtharray","title":"Download and Build UnknownLengthArray","text":"

        Click here to download UnknownLengthArray and its CMakeLists.txt file. Once the tarball UnknownLengthArray.tar has been downloaded and extracted,

        cd UnknownLengthArray/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./UnknownLengthArray\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/Variant/","title":"Variant","text":"

        vtk-examples/Cxx/Utilities/Variant

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/Variant/#code","title":"Code","text":"

        Variant.cxx

        #include <vtkVariant.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  double dVal = vtkVariant(\"2\").ToDouble();\n  std::cout << \"dVal: \" << dVal << std::endl;\n  std::string strVal = vtkVariant(dVal).ToString();\n  std::cout << \"strVal: \" << strVal << std::endl;\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/Variant/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Variant)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Variant: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Variant MACOSX_BUNDLE Variant.cxx )\n  target_link_libraries(Variant PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Variant\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/Variant/#download-and-build-variant","title":"Download and Build Variant","text":"

        Click here to download Variant and its CMakeLists.txt file. Once the tarball Variant.tar has been downloaded and extracted,

        cd Variant/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Variant\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/Vector/","title":"Vector","text":"

        vtk-examples/Cxx/Utilities/Vector

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/Vector/#code","title":"Code","text":"

        Vector.cxx

        #include <vtkVector.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkVector3d v(1.0, 2.0, 3.0);\n  std::cout << v.GetX() << \" \" << v.GetY() << \" \" << v.GetZ() << std::endl;\n\n  double* vals = v.GetData();\n\n  std::cout << vals[0] << \" \" << vals[1] << \" \" << vals[2] << std::endl;\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/Vector/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Vector)\n\nfind_package(VTK COMPONENTS \n  CommonDataModel\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Vector: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Vector MACOSX_BUNDLE Vector.cxx )\n  target_link_libraries(Vector PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Vector\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/Vector/#download-and-build-vector","title":"Download and Build Vector","text":"

        Click here to download Vector and its CMakeLists.txt file. Once the tarball Vector.tar has been downloaded and extracted,

        cd Vector/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Vector\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/VectorArrayKnownLength/","title":"VectorArrayKnownLength","text":"

        vtk-examples/Cxx/Utilities/VectorArrayKnownLength

        "},{"location":"Cxx/Utilities/VectorArrayKnownLength/#description","title":"Description","text":"

        This example creates a VTK style float array of vectors. This can be easily interchanged with vtkIntArray, vtkDoubleArray, etc.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/VectorArrayKnownLength/#code","title":"Code","text":"

        VectorArrayKnownLength.cxx

        #include <vtkFloatArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFloatArray> distances;\n  distances->SetName(\"Distances\");\n  distances->SetNumberOfComponents(3);\n  distances->SetNumberOfTuples(5);\n\n  // set values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    float tuple[3];\n    tuple[0] = (float)i + 0.1;\n    tuple[1] = (float)i + 0.2;\n    tuple[2] = (float)i + 0.3;\n    distances->SetTuple(i, tuple);\n  }\n\n  // get values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    double d[3];\n    distances->GetTuple(i, d);\n    std::cout << d[0] << \" \" << d[1] << \" \" << d[2] << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/VectorArrayKnownLength/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorArrayKnownLength)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorArrayKnownLength: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorArrayKnownLength MACOSX_BUNDLE VectorArrayKnownLength.cxx )\n  target_link_libraries(VectorArrayKnownLength PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorArrayKnownLength\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/VectorArrayKnownLength/#download-and-build-vectorarrayknownlength","title":"Download and Build VectorArrayKnownLength","text":"

        Click here to download VectorArrayKnownLength and its CMakeLists.txt file. Once the tarball VectorArrayKnownLength.tar has been downloaded and extracted,

        cd VectorArrayKnownLength/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VectorArrayKnownLength\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/VectorArrayUnknownLength/","title":"VectorArrayUnknownLength","text":"

        vtk-examples/Cxx/Utilities/VectorArrayUnknownLength

        "},{"location":"Cxx/Utilities/VectorArrayUnknownLength/#description","title":"Description","text":"

        This example creates a VTK style float array of vectors. This can be easily interchanged with vtkIntArray, vtkDoubleArray, etc.

        The only difference between this example and the VectorArrayKnownLength example is that SetNumberOfValues() is not called, and SetTuple() is replaced by InsertNextTuple().

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/VectorArrayUnknownLength/#code","title":"Code","text":"

        VectorArrayUnknownLength.cxx

        #include <vtkFloatArray.h>\n#include <vtkNew.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkFloatArray> distances;\n  distances->SetName(\"Distances\");\n  distances->SetNumberOfComponents(3);\n\n  // set values\n  for (vtkIdType i = 0; i < 5; i++)\n  {\n    float tuple[3];\n    tuple[0] = (float)i + 0.1;\n    tuple[1] = (float)i + 0.2;\n    tuple[2] = (float)i + 0.3;\n    // this will allocate memory as necessary\n    distances->InsertNextTuple(tuple);\n  }\n\n  // get values\n  for (vtkIdType i = 0; i < distances->GetNumberOfTuples(); i++)\n  {\n    double d[3];\n    distances->GetTuple(i, d);\n    std::cout << d[0] << \" \" << d[1] << \" \" << d[2] << std::endl;\n  }\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/VectorArrayUnknownLength/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorArrayUnknownLength)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorArrayUnknownLength: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorArrayUnknownLength MACOSX_BUNDLE VectorArrayUnknownLength.cxx )\n  target_link_libraries(VectorArrayUnknownLength PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorArrayUnknownLength\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/VectorArrayUnknownLength/#download-and-build-vectorarrayunknownlength","title":"Download and Build VectorArrayUnknownLength","text":"

        Click here to download VectorArrayUnknownLength and its CMakeLists.txt file. Once the tarball VectorArrayUnknownLength.tar has been downloaded and extracted,

        cd VectorArrayUnknownLength/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VectorArrayUnknownLength\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ViewportBorders/","title":"ViewportBorders","text":"

        vtk-examples/Cxx/Utilities/ViewportBorders

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Utilities/ViewportBorders/#description","title":"Description","text":"

        Sometimes multiple vtkRenderer viewports can be difficult to differentiate. This example draws a border around each viewport. The example creates a vtkPolyLine that outlines the viewport. The coordinates for the vtkPoints are specified in normalized viewport coordinates. The coordinate selection is made with a vtkCoordinate. The vtkPolyDataMapper2D and vtkActor2D render the border.

        To run the example, provide 1-N vtkPolyDataReader files.

        This examples uses the data, src/Testing/Data/v.vtk,, src/Testing/Data/t.vtk and src/Testing/Data/k.vtk.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ViewportBorders/#code","title":"Code","text":"

        ViewportBorders.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCellArray.h>\n#include <vtkCoordinate.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkPolyDataReader.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\nvoid ViewportBorder(vtkRenderer* renderer, double* color, bool last = false);\n}\n\nint main(int argc, char* argv[])\n{\n\n  int numberOfFiles = argc - 1;\n  if (numberOfFiles == 0)\n  {\n    std::cout << \"Usage\" << argv[0]\n              << \" file1 file2 file3 ... fileN e.g. v.vtk t.vtk k.vtk\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(300 * numberOfFiles, 300);\n  renderWindow->SetWindowName(\"ViewportBorders\");\n\n  double size = 1.0 / numberOfFiles;\n  for (unsigned int i = 0; static_cast<int>(i) < numberOfFiles; ++i)\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(argv[i + 1]);\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(reader->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(actor);\n    renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n    double viewport[4];\n    viewport[0] = size * i;\n    viewport[1] = 0.0;\n    viewport[2] = size * (i + 1);\n    viewport[3] = 1.0;\n    renderer->SetViewport(viewport);\n    ViewportBorder(renderer, colors->GetColor3d(\"Gold\").GetData(),\n                   static_cast<int>(i) == numberOfFiles - 1);\n    renderWindow->AddRenderer(renderer);\n  }\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\nnamespace {\n// Draw the borders of a renderer's viewport.\nvoid ViewportBorder(vtkRenderer* renderer, double* color, bool last)\n{\n  // points start at upper right and proceed anti-clockwise\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  // Create cells, and lines.\n  vtkNew<vtkCellArray> cells;\n  cells->Initialize();\n\n  vtkNew<vtkPolyLine> lines;\n\n  // Only draw last line if this is the last viewport.\n  // This prevents double vertical lines at right border.\n  // If different colors are used for each border, then do\n  // not specify last.\n  if (last)\n  {\n    lines->GetPointIds()->SetNumberOfIds(5);\n  }\n  else\n  {\n    lines->GetPointIds()->SetNumberOfIds(4);\n  }\n  for (unsigned int i = 0; i < 4; ++i)\n  {\n    lines->GetPointIds()->SetId(i, i);\n  }\n  if (last)\n  {\n    lines->GetPointIds()->SetId(4, 0);\n  }\n  cells->InsertNextCell(lines);\n\n  // Now make the polydata and display it.\n  vtkNew<vtkPolyData> poly;\n  poly->Initialize();\n  poly->SetPoints(points);\n  poly->SetLines(cells);\n\n  // Use normalized viewport coordinates since\n  // they are independent of window size.\n  vtkNew<vtkCoordinate> coordinate;\n  coordinate->SetCoordinateSystemToNormalizedViewport();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(poly);\n  mapper->SetTransformCoordinate(coordinate);\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(color);\n  // Line width should be at least 2 to be visible at extremes.\n\n  actor->GetProperty()->SetLineWidth(4.0); // Line Width\n\n  renderer->AddViewProp(actor);\n}\n} // namespace\n
        "},{"location":"Cxx/Utilities/ViewportBorders/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ViewportBorders)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ViewportBorders: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ViewportBorders MACOSX_BUNDLE ViewportBorders.cxx )\n  target_link_libraries(ViewportBorders PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ViewportBorders\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ViewportBorders/#download-and-build-viewportborders","title":"Download and Build ViewportBorders","text":"

        Click here to download ViewportBorders and its CMakeLists.txt file. Once the tarball ViewportBorders.tar has been downloaded and extracted,

        cd ViewportBorders/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ViewportBorders\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/WindowModifiedEvent/","title":"WindowModifiedEvent","text":"

        vtk-examples/Cxx/Utilities/WindowModifiedEvent

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Utilities/WindowModifiedEvent/#description","title":"Description","text":"

        This example limits the horizontal window size to 400.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/WindowModifiedEvent/#code","title":"Code","text":"

        WindowModifiedEvent.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nvoid WindowModifiedCallback(vtkObject* caller,\n                            long unsigned int vtkNotUsed(eventId),\n                            void* vtkNotUsed(clientData),\n                            void* vtkNotUsed(callData))\n{\n  std::cout << \"Window modified\" << std::endl;\n  std::cout << caller->GetClassName() << std::endl;\n\n  vtkRenderWindow* window = static_cast<vtkRenderWindow*>(caller);\n  int* windowSize = window->GetSize();\n  std::cout << \"Size: \" << windowSize[0] << \" \" << windowSize[1] << std::endl;\n\n  if (windowSize[0] > 400)\n  {\n    window->SetSize(400, windowSize[1]);\n    window->Render();\n    window->Modified();\n    window->Render();\n  }\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WindowModifiedEvent\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkCallbackCommand> m_pModifiedCallback;\n  m_pModifiedCallback->SetCallback(WindowModifiedCallback);\n  // m_pModifiedCallback->SetClientData(this);\n\n  renderWindow->AddObserver(vtkCommand::ModifiedEvent, m_pModifiedCallback);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/WindowModifiedEvent/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WindowModifiedEvent)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WindowModifiedEvent: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WindowModifiedEvent MACOSX_BUNDLE WindowModifiedEvent.cxx )\n  target_link_libraries(WindowModifiedEvent PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WindowModifiedEvent\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/WindowModifiedEvent/#download-and-build-windowmodifiedevent","title":"Download and Build WindowModifiedEvent","text":"

        Click here to download WindowModifiedEvent and its CMakeLists.txt file. Once the tarball WindowModifiedEvent.tar has been downloaded and extracted,

        cd WindowModifiedEvent/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WindowModifiedEvent\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Utilities/ZBuffer/","title":"ZBuffer","text":"

        vtk-examples/Cxx/Utilities/ZBuffer

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Utilities/ZBuffer/#code","title":"Code","text":"

        ZBuffer.cxx

        // This demo creates depth map for a polydata instance by extracting\n// exact ZBuffer values.\n#include <vtkActor.h>\n#include <vtkBMPWriter.h>\n#include <vtkImageShiftScale.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n#include <vtkWindowToImageFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" input(.vtp) output(.bmp)\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  vtkNew<vtkActor> actor;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  vtkNew<vtkXMLPolyDataReader> fileReader;\n  vtkNew<vtkWindowToImageFilter> filter;\n  vtkNew<vtkBMPWriter> imageWriter;\n  vtkNew<vtkImageShiftScale> scale;\n\n  // Read .vtp file\n  fileReader->SetFileName(argv[1]);\n\n  // Build visualization enviroment\n  mapper->SetInputConnection(fileReader->GetOutputPort());\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tan\").GetData());\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"WindowModifiedEvent\");\n\n  interactor->SetRenderWindow(renWin);\n  renWin->Render();\n\n  // Create Depth Map\n  filter->SetInput(renWin);\n#if VTK_MAJOR_VERSION >= 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90\n  filter->SetScale(1);\n#else\n  filter->SetMagnification(1);\n#endif\n  filter->SetInputBufferTypeToZBuffer(); // Extract z buffer value\n\n  scale->SetOutputScalarTypeToUnsignedChar();\n  scale->SetInputConnection(filter->GetOutputPort());\n  scale->SetShift(0);\n  scale->SetScale(-255);\n\n  // Write depth map as a .bmp image\n  imageWriter->SetFileName(argv[2]);\n  imageWriter->SetInputConnection(scale->GetOutputPort());\n  imageWriter->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Utilities/ZBuffer/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ZBuffer)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  IOXML\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ZBuffer: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ZBuffer MACOSX_BUNDLE ZBuffer.cxx )\n  target_link_libraries(ZBuffer PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ZBuffer\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Utilities/ZBuffer/#download-and-build-zbuffer","title":"Download and Build ZBuffer","text":"

        Click here to download ZBuffer and its CMakeLists.txt file. Once the tarball ZBuffer.tar has been downloaded and extracted,

        cd ZBuffer/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ZBuffer\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Video/FFMPEG/","title":"FFMPEG","text":"

        vtk-examples/Cxx/Video/FFMPEG

        "},{"location":"Cxx/Video/FFMPEG/#description","title":"Description","text":"

        You must set VTK_USE_FFMPEG_ENCODER ON in your VTK build.

        CMake won't find FFMPEG headers?

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Video/FFMPEG/#code","title":"Code","text":"

        FFMPEG.cxx

        #include <vtkFFMPEGWriter.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkNew.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 100, 0, 100, 0, 0);\n\n  vtkNew<vtkFFMPEGWriter> writer;\n\n  writer->SetInputConnection(source->GetOutputPort());\n  writer->SetFileName(\"test.avi\");\n  writer->Start();\n\n  for (unsigned int i = 0; i < 100; i++)\n  {\n    source->SetDrawColor(0, 0, 0, 1);   // black\n    source->FillBox(0, 100, 0, 100);    // clear image\n    source->SetDrawColor(255, 0, 0, 1); // red\n    source->FillBox(i, 20, 10, 20);\n    source->Update();\n\n    writer->Write();\n  }\n  writer->End();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Video/FFMPEG/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FFMPEG)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOFFMPEG\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FFMPEG: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FFMPEG MACOSX_BUNDLE FFMPEG.cxx )\n  target_link_libraries(FFMPEG PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FFMPEG\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Video/FFMPEG/#download-and-build-ffmpeg","title":"Download and Build FFMPEG","text":"

        Click here to download FFMPEG and its CMakeLists.txt file. Once the tarball FFMPEG.tar has been downloaded and extracted,

        cd FFMPEG/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FFMPEG\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Video/MPEG2/","title":"MPEG2","text":"

        vtk-examples/Cxx/Video/MPEG2

        "},{"location":"Cxx/Video/MPEG2/#description","title":"Description","text":"

        You must set VTK_USE_MPEG2_ENCODER ON VTK_USE_OGGTHEORA_ENCODER ON in your VTK build.

        CMake won't find MPEG2?

        When compiling: cannot find -lvtkoggtheora

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Video/MPEG2/#code","title":"Code","text":"

        MPEG2.cxx

        #include <vtkImageCanvasSource2D.h>\n#include <vtkMPEG2Writer.h>\n#include <vtkNew.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 100, 0, 100, 0, 0);\n\n  vtkNew<vtkMPEG2Writer> writer;\n\n  writer->SetInputConnection(source->GetOutputPort());\n  writer->SetFileName(\"test.avi\");\n  writer->Start();\n\n  for (unsigned int i = 0; i < 100; i++)\n  {\n    source->SetDrawColor(0, 0, 0, 1);   // black\n    source->FillBox(0, 100, 0, 100);    // clear image\n    source->SetDrawColor(255, 0, 0, 1); // red\n    source->FillBox(i, 20, 10, 20);\n    source->Update();\n\n    writer->Write();\n  }\n  writer->End();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Video/MPEG2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MPEG2)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MPEG2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MPEG2 MACOSX_BUNDLE MPEG2.cxx )\n  target_link_libraries(MPEG2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MPEG2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Video/MPEG2/#download-and-build-mpeg2","title":"Download and Build MPEG2","text":"

        Click here to download MPEG2 and its CMakeLists.txt file. Once the tarball MPEG2.tar has been downloaded and extracted,

        cd MPEG2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MPEG2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Video/OggTheora/","title":"OggTheora","text":"

        vtk-examples/Cxx/Video/OggTheora

        "},{"location":"Cxx/Video/OggTheora/#description","title":"Description","text":"

        can't find lvtkoggtheora

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Video/OggTheora/#code","title":"Code","text":"

        OggTheora.cxx

        #include <vtkImageCanvasSource2D.h>\n#include <vtkNew.h>\n#include <vtkOggTheoraWriter.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkImageCanvasSource2D> source;\n  source->SetScalarTypeToUnsignedChar();\n  source->SetNumberOfScalarComponents(3);\n  source->SetExtent(0, 100, 0, 100, 0, 0);\n\n  vtkNew<vtkOggTheoraWriter> writer;\n\n  writer->SetInputConnection(source->GetOutputPort());\n  writer->SetFileName(\"test.avi\");\n  writer->Start();\n\n  for (unsigned int i = 0; i < 100; i++)\n  {\n    source->SetDrawColor(0, 0, 0, 1);   // black\n    source->FillBox(0, 100, 0, 100);    // clear image\n    source->SetDrawColor(255, 0, 0, 1); // red\n    source->FillBox(i, 20, 10, 20);\n    source->Update();\n\n    writer->Write();\n  }\n  writer->End();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Video/OggTheora/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OggTheora)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  IOOggTheora\n  ImagingSources\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OggTheora: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OggTheora MACOSX_BUNDLE OggTheora.cxx )\n  target_link_libraries(OggTheora PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OggTheora\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Video/OggTheora/#download-and-build-oggtheora","title":"Download and Build OggTheora","text":"

        Click here to download OggTheora and its CMakeLists.txt file. Once the tarball OggTheora.tar has been downloaded and extracted,

        cd OggTheora/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OggTheora\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Views/RenderView/","title":"RenderView","text":"

        vtk-examples/Cxx/Views/RenderView

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Views/RenderView/#description","title":"Description","text":"

        Here is a little bit easier way to get your objects to appear on the screen.

        Warning

        This example requires the ViewsInfovis module,

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Views/RenderView/#code","title":"Code","text":"

        RenderView.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderView.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkRenderView> renderView;\n  renderView->SetInteractionMode(vtkRenderView::INTERACTION_MODE_3D);\n  renderView->GetRenderer()->AddActor(actor);\n  renderView->RenderOnMouseMoveOn();\n  renderView->Update();\n  renderView->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"Beige\").GetData());\n\n  renderView->ResetCamera();\n  renderView->GetInteractor()->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Views/RenderView/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RenderView)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  ViewsInfovis\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RenderView: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RenderView MACOSX_BUNDLE RenderView.cxx )\n  target_link_libraries(RenderView PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RenderView\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Views/RenderView/#download-and-build-renderview","title":"Download and Build RenderView","text":"

        Click here to download RenderView and its CMakeLists.txt file. Once the tarball RenderView.tar has been downloaded and extracted,

        cd RenderView/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RenderView\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/AlphaFrequency/","title":"AlphaFrequency","text":"

        vtk-examples/Cxx/Visualization/AlphaFrequency

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/AlphaFrequency/#code","title":"Code","text":"

        AlphaFrequency.cxx

        //\n// Create bar charts of frequency of letters.\n//\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorText.h>\n\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::vector<vtkSmartPointer<vtkVectorText>> letters;\n  std::vector<vtkSmartPointer<vtkLinearExtrusionFilter>> extrude;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n\n  char filename[512];\n  char text[2];\n  static char alphabet[] = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n  int i, j, freq[26], maxFreq;\n  float x, y;\n  FILE* fPtr;\n  int c;\n\n  //\n  // count the letters\n  //\n  if ((argc == 1) || ((argc == 2) && !(strcmp(\"-S\", argv[1]))))\n  {\n    cerr << \"Please provide filename: \" << argv[0] << \" filename\\n\";\n    strcpy(filename, \"./Makefile\");\n    cerr << \"Using the file \" << filename << \" as input\\n\";\n  }\n  else\n  {\n    strcpy(filename, argv[1]);\n  }\n\n  if ((fPtr = fopen(filename, \"r\")) == NULL)\n  {\n    cerr << \"Cannot open file: \" << filename << \"\\n\";\n    exit(1);\n  }\n\n  for (i = 0; i < 26; i++) freq[i] = 0;\n  while ((c = fgetc(fPtr)) != EOF)\n  {\n    if (isalpha(c))\n    {\n      c = tolower(c);\n      freq[c - 97]++;\n    }\n  }\n\n  for (maxFreq = 0, i = 0; i < 26; i++)\n    if (freq[i] > maxFreq)\n      maxFreq = freq[i];\n  //\n  // graphics stuff\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  //\n  // Setup letters\n  //\n  text[1] = '\\0';\n  for (i = 0; i < 26; i++)\n  {\n    text[0] = alphabet[i];\n    letters.push_back(vtkSmartPointer<vtkVectorText>::New());\n    letters[i]->SetText(text);\n\n    extrude.push_back(vtkSmartPointer<vtkLinearExtrusionFilter>::New());\n    extrude[i]->SetInputConnection(letters[i]->GetOutputPort());\n    extrude[i]->SetExtrusionType(VTK_VECTOR_EXTRUSION);\n    extrude[i]->SetVector(0, 0, 1.0);\n    extrude[i]->SetScaleFactor((double)freq[i] / maxFreq * 2.50);\n\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputConnection(extrude[i]->GetOutputPort());\n    mappers[i]->ScalarVisibilityOff();\n\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n    actors[i]->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n    if (freq[i] <= 0)\n    {\n      actors[i]->VisibilityOff();\n    }\n    ren->AddActor(actors[i]);\n  }\n  //\n  // Position actors\n  //\n  for (y = 0.0, j = 0; j < 2; j++, y += (-3.0))\n  {\n    for (x = 0.0, i = 0; i < 13; i++, x += 1.5)\n    {\n      actors[j * 13 + i]->SetPosition(x, y, 0.0);\n    }\n  }\n\n  ren->ResetCamera();\n  ren->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  ren->GetActiveCamera()->Elevation(30.0);\n  ren->GetActiveCamera()->Azimuth(-30.0);\n  ren->GetActiveCamera()->Dolly(1.25);\n  ren->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"AlphaFrequency\");\n\n  // interact with data\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/AlphaFrequency/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AlphaFrequency)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AlphaFrequency: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AlphaFrequency MACOSX_BUNDLE AlphaFrequency.cxx )\n  target_link_libraries(AlphaFrequency PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AlphaFrequency\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/AlphaFrequency/#download-and-build-alphafrequency","title":"Download and Build AlphaFrequency","text":"

        Click here to download AlphaFrequency and its CMakeLists.txt file. Once the tarball AlphaFrequency.tar has been downloaded and extracted,

        cd AlphaFrequency/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AlphaFrequency\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/AnnotatedCubeActor/","title":"AnnotatedCubeActor","text":"

        vtk-examples/Cxx/Visualization/AnnotatedCubeActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/AnnotatedCubeActor/#description","title":"Description","text":"

        The example demonstrates how to create and label an annotated cube actor.

        To colour the individual cube faces, see: ColoredAnnotatedCube.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/AnnotatedCubeActor/#code","title":"Code","text":"

        AnnotatedCubeActor.cxx

        #include <vtkAnnotatedCubeActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Set up the renderer, window, and interactor.\n  //\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"AnnotatedCubeActor\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkAnnotatedCubeActor> cube;\n  cube->SetFaceTextScale(2.0 / 3.0);\n\n  // Anatomic labelling.\n  //\n  cube->SetXPlusFaceText(\"A\");\n  cube->SetXMinusFaceText(\"P\");\n  cube->SetYPlusFaceText(\"L\");\n  cube->SetYMinusFaceText(\"R\");\n  cube->SetZPlusFaceText(\"S\");\n  cube->SetZMinusFaceText(\"I\");\n\n  // Change the vector text colors.\n  //\n  cube->GetTextEdgesProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  cube->GetTextEdgesProperty()->SetLineWidth(4);\n\n  // clang-format off\n  cube->GetXPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Turquoise\").GetData());\n  cube->GetXMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Turquoise\").GetData());\n  cube->GetYPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  cube->GetYMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  cube->GetZPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetZMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  // clang-format on\n\n  renderer->AddActor(cube);\n\n  // Set up an interesting view.\n  //\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->SetViewUp(0, 0, 1);\n  camera->SetFocalPoint(0, 0, 0);\n  camera->SetPosition(4.5, 4.5, 2.5);\n  renderer->ResetCamera();\n  camera->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/AnnotatedCubeActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AnnotatedCubeActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AnnotatedCubeActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AnnotatedCubeActor MACOSX_BUNDLE AnnotatedCubeActor.cxx )\n  target_link_libraries(AnnotatedCubeActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AnnotatedCubeActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/AnnotatedCubeActor/#download-and-build-annotatedcubeactor","title":"Download and Build AnnotatedCubeActor","text":"

        Click here to download AnnotatedCubeActor and its CMakeLists.txt file. Once the tarball AnnotatedCubeActor.tar has been downloaded and extracted,

        cd AnnotatedCubeActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AnnotatedCubeActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Arbitrary3DCursor/","title":"Arbitrary3DCursor","text":"

        vtk-examples/Cxx/Visualization/Arbitrary3DCursor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Arbitrary3DCursor/#code","title":"Code","text":"

        Arbitrary3DCursor.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointWidget.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n\n// This does the actual work: updates the probe.\n// Callback for the interaction.\nclass vtkmyPWCallback : public vtkCallbackCommand\n{\npublic:\n  vtkmyPWCallback() = default;\n\n  static vtkmyPWCallback* New()\n  {\n    return new vtkmyPWCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkPointWidget* pointWidget = reinterpret_cast<vtkPointWidget*>(caller);\n    pointWidget->GetPolyData(this->PolyData);\n    double position[3];\n    pointWidget->GetPosition(position);\n    std::ostringstream text;\n    text << \"cursor: \" << std::fixed << std::setprecision(4) << position[0]\n         << \", \" << position[1] << \", \" << position[2];\n    this->PositionActor->SetInput(text.str().c_str());\n    this->CursorActor->VisibilityOn();\n  }\n\n  vtkPolyData* PolyData = nullptr;\n  vtkActor* CursorActor = nullptr;\n  vtkTextActor* PositionActor = nullptr;\n};\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> inputPolyData;\n\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n    inputPolyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetPhiResolution(15);\n    sphereSource->SetThetaResolution(15);\n    sphereSource->Update();\n    inputPolyData = sphereSource->GetOutput();\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyData> point;\n\n  vtkNew<vtkProbeFilter> probe;\n  probe->SetInputData(point);\n  probe->SetSourceData(inputPolyData);\n\n  // Create glyph.\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(16);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(probe->GetOutputPort());\n  glyph->SetSourceConnection(cone->GetOutputPort());\n  glyph->SetVectorModeToUseVector();\n  glyph->SetScaleModeToDataScalingOff();\n  glyph->SetScaleFactor(inputPolyData->GetLength() * 0.1);\n\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyph->GetOutputPort());\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyphMapper);\n  glyphActor->VisibilityOn();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(inputPolyData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"gold\").GetData());\n\n  vtkNew<vtkTextActor> textActor;\n  textActor->GetTextProperty()->SetFontSize(12);\n  textActor->SetPosition(10, 20);\n  textActor->SetInput(\"cursor:\");\n  textActor->GetTextProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n\n  // Create the RenderWindow, Render1er and both Actors.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // The SetInteractor method is how 3D widgets are associated with the render\n  // window interactor. Internally, SetInteractor sets up a bunch of callbacks\n  // using the Command/Observer mechanism (AddObserver()).\n  vtkNew<vtkmyPWCallback> myCallback;\n  myCallback->PolyData = point;\n  myCallback->CursorActor = glyphActor;\n  myCallback->PositionActor = textActor;\n\n  // The point widget is used probe the dataset.\n  vtkNew<vtkPointWidget> pointWidget;\n  pointWidget->SetInteractor(iren);\n  pointWidget->SetInputData(inputPolyData);\n  pointWidget->AllOff();\n  pointWidget->PlaceWidget();\n  pointWidget->AddObserver(vtkCommand::InteractionEvent, myCallback);\n\n  ren1->AddActor(glyphActor);\n  ren1->AddActor(actor);\n  ren1->AddActor2D(textActor);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->GradientBackgroundOn();\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->SetBackground2(colors->GetColor3d(\"Wheat\").GetData());\n\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"Arbitrary3DCursor\");\n  renWin->Render();\n  pointWidget->On();\n\n  // Render the image\n  iren->Initialize();\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Arbitrary3DCursor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Arbitrary3DCursor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Arbitrary3DCursor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Arbitrary3DCursor MACOSX_BUNDLE Arbitrary3DCursor.cxx )\n  target_link_libraries(Arbitrary3DCursor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Arbitrary3DCursor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Arbitrary3DCursor/#download-and-build-arbitrary3dcursor","title":"Download and Build Arbitrary3DCursor","text":"

        Click here to download Arbitrary3DCursor and its CMakeLists.txt file. Once the tarball Arbitrary3DCursor.tar has been downloaded and extracted,

        cd Arbitrary3DCursor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Arbitrary3DCursor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/AssignCellColorsFromLUT/","title":"AssignCellColorsFromLUT","text":"

        vtk-examples/Cxx/Visualization/AssignCellColorsFromLUT

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/AssignCellColorsFromLUT/#description","title":"Description","text":"

        Demonstrates how to assign colors to cells in a vtkPolyData structure using lookup tables. Two techniques are demonstrated:

        1. Using a lookup table of predefined colors.
        2. Using a lookup table generated from a color transfer function.

        The resultant display shows in the left-hand column, the cells in a plane colored by the two lookup tables and in the right-hand column, the same polydata that has been read in from a file demonstrating that the structures are identical.

        The top row of the display uses the color transfer function to create a green to tan transition in a diverging color space. Note that the central square is white indicating the midpoint.

        The bottom row of the display uses a lookup table of predefined colors.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/AssignCellColorsFromLUT/#code","title":"Code","text":"

        AssignCellColorsFromLUT.cxx

        /*\nDemonstrates how to assign colors to cells in a vtkPolyData structure using\n lookup tables.\nTwo techniques are demonstrated:\n1) Using a lookup table of predefined colors.\n2) Using a lookup table generated from a color transfer function.\n\nThe resultant display shows in the left-hand column, the cells in a plane\ncolored by the two lookup tables and in the right-hand column, the same\npolydata that has been read in from a file demonstrating that the structures\nare identical.\n\nThe top row of the display uses the color transfer function to create a\ngreen to tan transition in a diverging color space.\nNote that the central square is white indicating the midpoint.\n\nThe bottom row of the display uses a lookup table of predefined colors.\n*/\n\n#include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtkXMLPolyDataWriter.h>\n\n#include <algorithm>\n#include <iomanip>\n#include <iostream>\n\ntemplate <typename T> void PrintColour(T& rgb)\n{\n  // Don't do this in real code! Range checking etc. is needed.\n  for (size_t i = 0; i < 3; ++i)\n  {\n    if (i < 2)\n    {\n      std::cout << static_cast<double>(rgb[i]) << \" \";\n    }\n    else\n    {\n      std::cout << static_cast<double>(rgb[i]);\n    }\n  }\n}\n\n//! Make a lookup table from a set of named colors.\n/*\n * See: http://www.vtk.org/doc/nightly/html/classvtkColorTransferFunction.html\n */\nvoid MakeLUT(size_t const& tableSize, vtkLookupTable* lut)\n{\n  vtkNew<vtkNamedColors> nc;\n\n  lut->SetNumberOfTableValues(static_cast<vtkIdType>(tableSize));\n  lut->Build();\n\n  // Fill in a few known colors, the rest will be generated if needed.\n  lut->SetTableValue(0, nc->GetColor4d(\"Black\").GetData());\n  lut->SetTableValue(1, nc->GetColor4d(\"Banana\").GetData());\n  lut->SetTableValue(2, nc->GetColor4d(\"Tomato\").GetData());\n  lut->SetTableValue(3, nc->GetColor4d(\"Wheat\").GetData());\n  lut->SetTableValue(4, nc->GetColor4d(\"Lavender\").GetData());\n  lut->SetTableValue(5, nc->GetColor4d(\"Flesh\").GetData());\n  lut->SetTableValue(6, nc->GetColor4d(\"Raspberry\").GetData());\n  lut->SetTableValue(7, nc->GetColor4d(\"Salmon\").GetData());\n  lut->SetTableValue(8, nc->GetColor4d(\"Mint\").GetData());\n  lut->SetTableValue(9, nc->GetColor4d(\"Peacock\").GetData());\n}\n\n//! Use a color transfer Function to generate the colors in the lookup table.\nvoid MakeLUTFromCTF(size_t const& tableSize, vtkLookupTable* lut)\n{\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  // Green to tan.\n  ctf->AddRGBPoint(0.0, 0.085, 0.532, 0.201);\n  ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n  ctf->AddRGBPoint(1.0, 0.677, 0.492, 0.093);\n\n  lut->SetNumberOfTableValues(static_cast<vtkIdType>(tableSize));\n  lut->Build();\n\n  for (size_t i = 0; i < tableSize; ++i)\n  {\n    double* rgb;\n    rgb = ctf->GetColor(static_cast<double>(i) / tableSize);\n    lut->SetTableValue(static_cast<vtkIdType>(i), rgb);\n  }\n}\n\n//! Create the cell data using the colors from the lookup table.\nvoid MakeCellData(size_t const& tableSize, vtkLookupTable* lut,\n                  vtkUnsignedCharArray* colors)\n{\n  for (size_t i = 1; i < tableSize; i++)\n  {\n    double rgb[3];\n    unsigned char ucrgb[3];\n    // Get the interpolated color.\n    // Of course you can use any function whose range is [0...1]\n    // to get the required color and assign it to a cell Id.\n    // In this case we are just using the cell (Id + 1)/(tableSize - 1)\n    // to get the interpolated color.\n    lut->GetColor(static_cast<double>(i) / (tableSize - 1), rgb);\n    for (size_t j = 0; j < 3; ++j)\n    {\n      ucrgb[j] = static_cast<unsigned char>(rgb[j] * 255);\n    }\n    colors->InsertNextTuple3(ucrgb[0], ucrgb[1], ucrgb[2]);\n    // Print out what we have.\n    std::cout << \"(\";\n    PrintColour<double[3]>(rgb);\n    std::cout << \") (\";\n    PrintColour<unsigned char[3]>(ucrgb);\n    std::cout << \")\" << std::endl;\n  }\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> nc;\n\n  // Provide some geometry.\n  int resolution = 3;\n  vtkNew<vtkPlaneSource> plane11;\n  plane11->SetXResolution(resolution);\n  plane11->SetYResolution(resolution);\n\n  vtkNew<vtkPlaneSource> plane12;\n  plane12->SetXResolution(resolution);\n  plane12->SetYResolution(resolution);\n\n  // Create a lookup table to map cell data to colors.\n  vtkNew<vtkLookupTable> lut1;\n  vtkNew<vtkLookupTable> lut2;\n  int tableSize = std::max(resolution * resolution + 1, 10);\n\n  // Force an update so we can set cell data.\n  plane11->Update();\n  plane12->Update();\n\n  MakeLUT(tableSize, lut1);\n  MakeLUTFromCTF(tableSize, lut2);\n\n  vtkNew<vtkUnsignedCharArray> colorData1;\n  colorData1->SetName(\"colors\"); // Any name will work here.\n  colorData1->SetNumberOfComponents(3);\n  std::cout << \"Using a lookup table from a set of named colors.\" << std::endl;\n  MakeCellData(tableSize, lut1, colorData1);\n  // Then use SetScalars() to add it to the vtkPolyData structure,\n  // this will then be interpreted as a color table.\n  plane11->GetOutput()->GetCellData()->SetScalars(colorData1);\n\n  vtkNew<vtkUnsignedCharArray> colorData2;\n  colorData2->SetName(\"colors\");\n  colorData2->SetNumberOfComponents(3);\n  std::cout << \"Using a lookup table created from a color transfer function.\"\n            << std::endl;\n  MakeCellData(tableSize, lut2, colorData2);\n  plane12->GetOutput()->GetCellData()->SetScalars(colorData2);\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> mapper11;\n  mapper11->SetInputConnection(plane11->GetOutputPort());\n  // Now, instead of doing this:\n  // mapper11->SetScalarRange(0, tableSize - 1);\n  // mapper11->SetLookupTable(lut1);\n  // We can just use the color data that we created from the lookup table and\n  // assigned to the cells:\n  mapper11->SetScalarModeToUseCellData();\n  mapper11->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper12;\n  mapper12->SetInputConnection(plane12->GetOutputPort());\n  mapper12->SetScalarModeToUseCellData();\n  mapper12->Update();\n\n  vtkNew<vtkXMLPolyDataWriter> writer;\n  writer->SetFileName(\"pdlut.vtp\");\n  writer->SetInputData(mapper11->GetInput());\n  // This is set so we can see the data in a text editor.\n  writer->SetDataModeToAscii();\n  writer->Write();\n  writer->SetFileName(\"pdctf.vtp\");\n  writer->SetInputData(mapper12->GetInput());\n  writer->Write();\n\n  vtkNew<vtkActor> actor11;\n  actor11->SetMapper(mapper11);\n  vtkNew<vtkActor> actor12;\n  actor12->SetMapper(mapper12);\n\n  // Let's read in the data we wrote out.\n  vtkNew<vtkXMLPolyDataReader> reader1;\n  reader1->SetFileName(\"pdlut.vtp\");\n\n  vtkNew<vtkXMLPolyDataReader> reader2;\n  reader2->SetFileName(\"pdctf.vtp\");\n\n  vtkNew<vtkPolyDataMapper> mapper21;\n  mapper21->SetInputConnection(reader1->GetOutputPort());\n  mapper21->SetScalarModeToUseCellData();\n  mapper21->Update();\n  vtkNew<vtkActor> actor21;\n  actor21->SetMapper(mapper11);\n\n  vtkNew<vtkPolyDataMapper> mapper22;\n  mapper22->SetInputConnection(reader2->GetOutputPort());\n  mapper22->SetScalarModeToUseCellData();\n  mapper22->Update();\n  vtkNew<vtkActor> actor22;\n  actor22->SetMapper(mapper22);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double viewport11[4] = {0.0, 0.0, 0.5, 0.5};\n  double viewport12[4] = {0.0, 0.5, 0.5, 1.0};\n  double viewport21[4] = {0.5, 0.0, 1.0, 0.5};\n  double viewport22[4] = {0.5, 0.5, 1.0, 1.0};\n\n  // Set up the renderers.\n  vtkNew<vtkRenderer> ren11;\n  vtkNew<vtkRenderer> ren12;\n  vtkNew<vtkRenderer> ren21;\n  vtkNew<vtkRenderer> ren22;\n\n  // Setup the render windows.\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"AssignCellColorsFromLUT\");\n\n  renWin->AddRenderer(ren11);\n  renWin->AddRenderer(ren12);\n  renWin->AddRenderer(ren21);\n  renWin->AddRenderer(ren22);\n  ren11->SetViewport(viewport11);\n  ren12->SetViewport(viewport12);\n  ren21->SetViewport(viewport21);\n  ren22->SetViewport(viewport22);\n  ren11->SetBackground(nc->GetColor3d(\"MidnightBlue\").GetData());\n  ren12->SetBackground(nc->GetColor3d(\"MidnightBlue\").GetData());\n  ren21->SetBackground(nc->GetColor3d(\"MidnightBlue\").GetData());\n  ren22->SetBackground(nc->GetColor3d(\"MidnightBlue\").GetData());\n  ren11->AddActor(actor11);\n  ren12->AddActor(actor12);\n  ren21->AddActor(actor21);\n  ren22->AddActor(actor22);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/AssignCellColorsFromLUT/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AssignCellColorsFromLUT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AssignCellColorsFromLUT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AssignCellColorsFromLUT MACOSX_BUNDLE AssignCellColorsFromLUT.cxx )\n  target_link_libraries(AssignCellColorsFromLUT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AssignCellColorsFromLUT\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/AssignCellColorsFromLUT/#download-and-build-assigncellcolorsfromlut","title":"Download and Build AssignCellColorsFromLUT","text":"

        Click here to download AssignCellColorsFromLUT and its CMakeLists.txt file. Once the tarball AssignCellColorsFromLUT.tar has been downloaded and extracted,

        cd AssignCellColorsFromLUT/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AssignCellColorsFromLUT\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/AxisActor/","title":"AxisActor","text":"

        vtk-examples/Cxx/Visualization/AxisActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/AxisActor/#description","title":"Description","text":"

        This example illustrates the use of vtkAxisActor. This is a fairly complicated object that allows extensive control over a single axis. The parameters may be tricky to setup. vtkAxisActor is usually used onsode other classes,e.g. vtkCubeAxisActor.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/AxisActor/#code","title":"Code","text":"

        AxisActor.cxx

        #include <vtkActor.h>\n#include <vtkAxisActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkStringArray.h>\n#include <vtkTextProperty.h>\n\n#include <iostream>\n#include <string>\n\n//----------------------------------------------------------------------------\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> source;\n  source->SetPhiResolution(31);\n  source->SetThetaResolution(31);\n  source->Update();\n  double bounds[6];\n  source->GetOutput()->GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[2] << \", \" << bounds[3]\n            << \", \" << bounds[1] << \", \" << bounds[3] << \", \" << bounds[5]\n            << std::endl;\n  double center[3];\n  source->GetOutput()->GetCenter(center);\n  std::cout << \"Center: \" << center[0] << \", \" << center[1] << \", \" << center[2]\n            << std::endl;\n\n  // Create the axis actor.\n  vtkNew<vtkAxisActor> axis;\n  axis->SetPoint1(-1.1, 0.0, 0.0);\n  axis->SetPoint2(1.1, 0.0, 0.0);\n  axis->SetTickLocationToBoth();\n  axis->SetAxisTypeToX();\n  axis->SetTitle(\"A Sphere\");\n  axis->SetTitleScale(0.2);\n  axis->TitleVisibilityOn();\n\n  axis->SetMajorTickSize(0.05);\n  axis->SetMinorTickSize(1);\n  axis->DrawGridlinesOff();\n  axis->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"banana\").GetData());\n  axis->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"orange\").GetData());\n\n  vtkNew<vtkStringArray> labels;\n  labels->SetNumberOfTuples(1);\n  labels->SetValue(0, \"x Axis\");\n\n  axis->SetLabels(labels);\n  axis->SetLabelScale(.1);\n  axis->MinorTicksVisibleOn();\n  axis->SetDeltaMajor(0, .1);\n  axis->SetCalculateTitleOffset(0);\n  axis->SetCalculateLabelOffset(0);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor4d(\"Tomato\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"AxisActor\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  axis->SetCamera(renderer->GetActiveCamera());\n\n  renderer->AddActor(actor);\n  renderer->AddActor(axis);\n\n  renderer->SetBackground(colors->GetColor4d(\"SlateGray\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderer->ResetCamera();\n  renderer->ResetCameraClippingRange();\n\n  // Render the image.\n  renderWindow->Render();\n\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/AxisActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AxisActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AxisActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AxisActor MACOSX_BUNDLE AxisActor.cxx )\n  target_link_libraries(AxisActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AxisActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/AxisActor/#download-and-build-axisactor","title":"Download and Build AxisActor","text":"

        Click here to download AxisActor and its CMakeLists.txt file. Once the tarball AxisActor.tar has been downloaded and extracted,

        cd AxisActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AxisActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/BackfaceCulling/","title":"BackfaceCulling","text":"

        vtk-examples/Cxx/Visualization/BackfaceCulling

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/BackfaceCulling/#description","title":"Description","text":"

        This example renders a sphere with backface culling enabled.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/BackfaceCulling/#code","title":"Code","text":"

        BackfaceCulling.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n  vtkNew<vtkProperty> backProperty;\n  backProperty->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  actor->SetBackfaceProperty(backProperty);\n  // Since back face culling is on, when you zoom into the sphere, you won't see\n  // the gold colored backface.\n  actor->GetProperty()->BackfaceCullingOn();\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BackfaceCulling\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/BackfaceCulling/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BackfaceCulling)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BackfaceCulling: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BackfaceCulling MACOSX_BUNDLE BackfaceCulling.cxx )\n  target_link_libraries(BackfaceCulling PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BackfaceCulling\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/BackfaceCulling/#download-and-build-backfaceculling","title":"Download and Build BackfaceCulling","text":"

        Click here to download BackfaceCulling and its CMakeLists.txt file. Once the tarball BackfaceCulling.tar has been downloaded and extracted,

        cd BackfaceCulling/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BackfaceCulling\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/BackgroundColor/","title":"BackgroundColor","text":"

        vtk-examples/Cxx/Visualization/BackgroundColor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/BackgroundColor/#description","title":"Description","text":"

        This example demonstrates how to change the background color of the render window.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/BackgroundColor/#code","title":"Code","text":"

        BackgroundColor.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(4.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"SeaGreen\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BackgroundColor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Plum\").GetData());\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/BackgroundColor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BackgroundColor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BackgroundColor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BackgroundColor MACOSX_BUNDLE BackgroundColor.cxx )\n  target_link_libraries(BackgroundColor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BackgroundColor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/BackgroundColor/#download-and-build-backgroundcolor","title":"Download and Build BackgroundColor","text":"

        Click here to download BackgroundColor and its CMakeLists.txt file. Once the tarball BackgroundColor.tar has been downloaded and extracted,

        cd BackgroundColor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BackgroundColor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/BackgroundGradient/","title":"BackgroundGradient","text":"

        vtk-examples/Cxx/Visualization/BackgroundGradient

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/BackgroundGradient/#code","title":"Code","text":"

        BackgroundGradient.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"SeaGreen\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BackgroundGradient\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n\n  // Setup the background gradient\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"Banana\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Tomato\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/BackgroundGradient/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BackgroundGradient)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BackgroundGradient: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BackgroundGradient MACOSX_BUNDLE BackgroundGradient.cxx )\n  target_link_libraries(BackgroundGradient PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BackgroundGradient\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/BackgroundGradient/#download-and-build-backgroundgradient","title":"Download and Build BackgroundGradient","text":"

        Click here to download BackgroundGradient and its CMakeLists.txt file. Once the tarball BackgroundGradient.tar has been downloaded and extracted,

        cd BackgroundGradient/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BackgroundGradient\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/BackgroundTexture/","title":"BackgroundTexture","text":"

        vtk-examples/Cxx/Visualization/BackgroundTexture

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/BackgroundTexture/#code","title":"Code","text":"

        BackgroundTexture.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkContourFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShepardMethod.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkVertexGlyphFilter.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a set of vertices (polydata)\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(100.0, 0.0, 0.0);\n  points->InsertNextPoint(300.0, 0.0, 0.0);\n\n  // Setup colors\n  unsigned char white[3] = {255, 255, 255};\n  unsigned char black[3] = {0, 0, 0};\n\n  vtkNew<vtkUnsignedCharArray> vertexColors;\n  vertexColors->SetNumberOfComponents(3);\n  vertexColors->SetName(\"Colors\");\n  vertexColors->InsertNextTupleValue(black);\n  vertexColors->InsertNextTupleValue(white);\n\n  // Create a scalar array for the pointdata, each value represents the\n  // distance. of the vertices from the first vertex\n  vtkNew<vtkFloatArray> values;\n  values->SetNumberOfComponents(1);\n  values->SetName(\"Values\");\n  values->InsertNextValue(0.0);\n  values->InsertNextValue(1.0);\n\n  // We must make two objects, because the ShepardMethod uses the ActiveScalars,\n  // as does the renderer!\n  vtkNew<vtkPolyData> polydataToProcess;\n  polydataToProcess->SetPoints(points);\n  polydataToProcess->GetPointData()->SetScalars(values);\n\n  vtkNew<vtkPolyData> polydataToVisualize;\n  polydataToVisualize->SetPoints(points);\n  polydataToVisualize->GetPointData()->SetScalars(vertexColors);\n\n  vtkNew<vtkVertexGlyphFilter> vertexGlyphFilter;\n  vertexGlyphFilter->AddInputData(polydataToVisualize);\n  vertexGlyphFilter->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> vertsMapper;\n  // vertsMapper->ScalarVisibilityOff();\n  vertsMapper->SetInputConnection(vertexGlyphFilter->GetOutputPort());\n\n  vtkNew<vtkActor> vertsActor;\n  vertsActor->SetMapper(vertsMapper);\n  vertsActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  vertsActor->GetProperty()->SetPointSize(3);\n\n  // Create a Shepard filter to interpolate the vertices over a regularized\n  // image grid.\n  vtkNew<vtkShepardMethod> shepard;\n  shepard->SetInputData(polydataToProcess);\n  shepard->SetSampleDimensions(2, 2, 2);\n  shepard->SetModelBounds(100, 300, -10, 10, -10, 10);\n  shepard->SetMaximumDistance(1);\n\n  // Contour the shepard generated image at 3 isovalues.\n  // The accuracy of the results are highly dependent on how the shepard filter\n  // is set up.\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetNumberOfContours(3);\n  contourFilter->SetValue(0, 0.25);\n  contourFilter->SetValue(1, 0.50);\n  contourFilter->SetValue(2, 0.75);\n  contourFilter->SetInputConnection(shepard->GetOutputPort());\n  contourFilter->Update();\n\n  // Create a mapper and actor for the resulting isosurfaces.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contourFilter->GetOutputPort());\n  contourMapper->ScalarVisibilityOn();\n  contourMapper->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n  contourActor->GetProperty()->SetAmbient(1);\n  contourActor->GetProperty()->SetSpecular(0);\n  contourActor->GetProperty()->SetDiffuse(0);\n\n  // Report the results of the interpolation.\n  double* range = contourFilter->GetOutput()->GetScalarRange();\n\n  std::cout << \"Shepard interpolation:\" << std::endl;\n  std::cout << \"contour output scalar range: \" << range[0] << \", \" << range[1]\n            << std::endl;\n\n  vtkIdType nCells = contourFilter->GetOutput()->GetNumberOfCells();\n  double bounds[6];\n  for (vtkIdType i = 0; i < nCells; ++i)\n  {\n    if (i %\n        2) // Each isosurface value only has 2 cells so report on the odd ones\n    {\n      contourFilter->GetOutput()->GetCellBounds(i, bounds);\n      std::cout << \"cell \" << i << \", x position: \" << bounds[0] << std::endl;\n    }\n  }\n\n  // Create a transfer function to color the isosurfaces.\n  vtkNew<vtkColorTransferFunction> lut;\n  lut->SetColorSpaceToRGB();\n  lut->AddRGBPoint(range[0], 0, 0, 0); // black\n  lut->AddRGBPoint(range[1], 1, 1, 1); // white\n  lut->SetScaleToLinear();\n\n  contourMapper->SetLookupTable(lut);\n\n  // Create a renderer, render window and interactor.\n  vtkNew<vtkRenderer> renderer;\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"Blue\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"Magenta\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BackgroundTexture\");\n\n  renderer->AddActor(contourActor);\n  renderer->AddActor(vertsActor);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Position the camera so that the image produced is viewable.\n  vtkCamera* camera = renderer->GetActiveCamera();\n  camera->SetPosition(450, 100, 100);\n  camera->SetFocalPoint(200, 0, 0);\n  camera->SetViewUp(0, 0, 1);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/BackgroundTexture/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BackgroundTexture)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BackgroundTexture: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BackgroundTexture MACOSX_BUNDLE BackgroundTexture.cxx )\n  target_link_libraries(BackgroundTexture PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BackgroundTexture\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/BackgroundTexture/#download-and-build-backgroundtexture","title":"Download and Build BackgroundTexture","text":"

        Click here to download BackgroundTexture and its CMakeLists.txt file. Once the tarball BackgroundTexture.tar has been downloaded and extracted,

        cd BackgroundTexture/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BackgroundTexture\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/BillboardTextActor3D/","title":"BillboardTextActor3D","text":"

        vtk-examples/Cxx/Visualization/BillboardTextActor3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/BillboardTextActor3D/#code","title":"Code","text":"

        BillboardTextActor3D.cxx

        #include <vtkActor.h>\n#include <vtkBillboardTextActor3D.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\nvoid ActorCallback(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                   void* clientData, void* vtkNotUsed(callData))\n{\n  auto textActor = static_cast<vtkBillboardTextActor3D*>(clientData);\n  auto actor = static_cast<vtkActor*>(caller);\n  std::ostringstream label;\n  label << std::setprecision(3) << actor->GetPosition()[0] << \", \"\n        << actor->GetPosition()[1] << \", \" << actor->GetPosition()[2]\n        << std::endl;\n  textActor->SetPosition(actor->GetPosition());\n  textActor->SetInput(label.str().c_str());\n}\n\nvoid RandomPosition(double p[3], double const& min_r, double const& max_r,\n                    vtkMinimalStandardRandomSequence* rng);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // For testing\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  // rng->SetSeed(8775070);\n  rng->SetSeed(5127);\n\n  // Create a renderer\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Create a render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BillboardTextActor3D\");\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n\n  auto min_r = -10.0;\n  auto max_r = 10.0;\n\n  for (auto i = 0; i < 10; ++i)\n  {\n    if (i == 0)\n    {\n      // Create an actor representing the origin\n      vtkNew<vtkPolyDataMapper> mapper;\n      mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n      vtkNew<vtkActor> actor;\n      actor->SetMapper(mapper);\n      actor->SetPosition(0, 0, 0);\n      actor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n\n      renderer->AddActor(actor);\n    }\n    // Create a mapper\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n    // Create an actor\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->SetPosition(0, 0, 0);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n    // Setup the text and add it to the renderer\n    vtkNew<vtkBillboardTextActor3D> textActor;\n    textActor->SetInput(\"\");\n    textActor->SetPosition(actor->GetPosition());\n    textActor->GetTextProperty()->SetFontSize(12);\n    textActor->GetTextProperty()->SetColor(\n        colors->GetColor3d(\"Gold\").GetData());\n    textActor->GetTextProperty()->SetJustificationToCentered();\n\n    renderer->AddActor(actor);\n    renderer->AddActor(textActor);\n\n    // If you want to use a callback, do this:\n    // vtkNew<vtkCallbackCommand> actorCallback;\n    // actorCallback->SetCallback(ActorCallback);\n    // actorCallback->SetClientData(textActor);\n    // actor->AddObserver(vtkCommand::ModifiedEvent, actorCallback);\n    // Otherwise do this:\n    double position[3];\n    RandomPosition(position, min_r, max_r, rng);\n    actor->SetPosition(position);\n    std::ostringstream label;\n    label << std::setprecision(3) << actor->GetPosition()[0] << \", \"\n          << actor->GetPosition()[1] << \", \" << actor->GetPosition()[2]\n          << std::endl;\n    textActor->SetPosition(actor->GetPosition());\n    textActor->SetInput(label.str().c_str());\n  }\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"BillboardTextActor3D\");\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid RandomPosition(double p[3], double const& min_r, double const& max_r,\n                    vtkMinimalStandardRandomSequence* rng)\n{\n  for (auto i = 0; i < 3; ++i)\n  {\n    p[i] = rng->GetRangeValue(min_r, max_r);\n    rng->Next();\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/BillboardTextActor3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BillboardTextActor3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BillboardTextActor3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BillboardTextActor3D MACOSX_BUNDLE BillboardTextActor3D.cxx )\n  target_link_libraries(BillboardTextActor3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BillboardTextActor3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/BillboardTextActor3D/#download-and-build-billboardtextactor3d","title":"Download and Build BillboardTextActor3D","text":"

        Click here to download BillboardTextActor3D and its CMakeLists.txt file. Once the tarball BillboardTextActor3D.tar has been downloaded and extracted,

        cd BillboardTextActor3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BillboardTextActor3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/BlobbyLogo/","title":"BlobbyLogo","text":"

        vtk-examples/Cxx/Visualization/BlobbyLogo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/BlobbyLogo/#description","title":"Description","text":"

        This is the blobby vtk logo described in chapter 12 of the VTK textbook. The example uses vtkAppendPolyData to combine three vtkPolyData. A vtkImplicitModeller creates a vtkImageData of the distnaces from the polydata triangles. vtkContourFilter extracts an isosurface representing an offset surface.

        This examples uses the data src/Testing/Data/v.vtk, src/Testing/Data/t.vtk and src/Testing/Data/k.vtk.

        Info

        See Figure 12-13 in Chapter 12 the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/BlobbyLogo/#code","title":"Code","text":"

        BlobbyLogo.cxx

        //\n// use implicit modeller to create the VTK logo\n//\n\n#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitModeller.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 4)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" v.vtk t.vtk k.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> aRenderWindow;\n  aRenderWindow->AddRenderer(aRenderer);\n  aRenderWindow->SetWindowName(\"BlobbyLogo\");\n\n  vtkNew<vtkRenderWindowInteractor> anInteractor;\n  anInteractor->SetRenderWindow(aRenderWindow);\n  aRenderWindow->SetSize(300, 300);\n\n  // read the geometry file containing the letter v\n  vtkNew<vtkPolyDataReader> letterV;\n  letterV->SetFileName(argv[1]);\n\n  // read the geometry file containing the letter t\n  vtkNew<vtkPolyDataReader> letterT;\n  letterT->SetFileName(argv[2]);\n\n  // read the geometry file containing the letter k\n  vtkNew<vtkPolyDataReader> letterK;\n  letterK->SetFileName(argv[3]);\n\n  // create a transform and transform filter for each letter\n  vtkNew<vtkTransform> VTransform;\n  vtkNew<vtkTransformPolyDataFilter> VTransformFilter;\n  VTransformFilter->SetInputConnection(letterV->GetOutputPort());\n  VTransformFilter->SetTransform(VTransform);\n\n  vtkNew<vtkTransform> TTransform;\n  vtkNew<vtkTransformPolyDataFilter> TTransformFilter;\n  TTransformFilter->SetInputConnection(letterT->GetOutputPort());\n  TTransformFilter->SetTransform(TTransform);\n\n  vtkNew<vtkTransform> KTransform;\n  vtkNew<vtkTransformPolyDataFilter> KTransformFilter;\n  KTransformFilter->SetInputConnection(letterK->GetOutputPort());\n  KTransformFilter->SetTransform(KTransform);\n\n  // now append them all\n  vtkNew<vtkAppendPolyData> appendAll;\n  appendAll->AddInputConnection(VTransformFilter->GetOutputPort());\n  appendAll->AddInputConnection(TTransformFilter->GetOutputPort());\n  appendAll->AddInputConnection(KTransformFilter->GetOutputPort());\n\n  // create normals\n  vtkNew<vtkPolyDataNormals> logoNormals;\n  logoNormals->SetInputConnection(appendAll->GetOutputPort());\n  logoNormals->SetFeatureAngle(60);\n\n  // map to rendering primitives\n  vtkNew<vtkPolyDataMapper> logoMapper;\n  logoMapper->SetInputConnection(logoNormals->GetOutputPort());\n\n  // now an actor\n  vtkNew<vtkActor> logo;\n  logo->SetMapper(logoMapper);\n\n  // now create an implicit model of the same letter\n  vtkNew<vtkImplicitModeller> blobbyLogoImp;\n  blobbyLogoImp->SetInputConnection(appendAll->GetOutputPort());\n  blobbyLogoImp->SetMaximumDistance(.075);\n  blobbyLogoImp->SetSampleDimensions(64, 64, 64);\n  blobbyLogoImp->SetAdjustDistance(0.05);\n\n  // extract an iso surface\n  vtkNew<vtkContourFilter> blobbyLogoIso;\n  blobbyLogoIso->SetInputConnection(blobbyLogoImp->GetOutputPort());\n  blobbyLogoIso->SetValue(1, 1.5);\n\n  // map to rendering primitives\n  vtkNew<vtkPolyDataMapper> blobbyLogoMapper;\n  blobbyLogoMapper->SetInputConnection(blobbyLogoIso->GetOutputPort());\n  blobbyLogoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkProperty> tomato;\n  tomato->SetDiffuseColor(colors->GetColor3d(\"tomato\").GetData());\n  tomato->SetSpecular(.3);\n  tomato->SetSpecularPower(20);\n\n  vtkNew<vtkProperty> banana;\n  banana->SetDiffuseColor(colors->GetColor3d(\"banana\").GetData());\n  banana->SetDiffuse(.7);\n  banana->SetSpecular(.4);\n  banana->SetSpecularPower(20);\n\n  // now an actor\n  vtkNew<vtkActor> blobbyLogo;\n  blobbyLogo->SetMapper(blobbyLogoMapper);\n  blobbyLogo->SetProperty(banana);\n\n  // position the letters\n\n  VTransform->Translate(-16.0, 0.0, 12.5);\n  VTransform->RotateY(40);\n\n  KTransform->Translate(14.0, 0.0, 0.0);\n  KTransform->RotateY(-40);\n\n  // move the polygonal letters to the front\n  logo->SetProperty(tomato);\n  logo->SetPosition(0, 0, 6);\n\n  aRenderer->AddActor(logo);\n  aRenderer->AddActor(blobbyLogo);\n\n  aRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  aRenderWindow->Render();\n\n  // interact with data\n  anInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/BlobbyLogo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BlobbyLogo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersHybrid\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BlobbyLogo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BlobbyLogo MACOSX_BUNDLE BlobbyLogo.cxx )\n  target_link_libraries(BlobbyLogo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BlobbyLogo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/BlobbyLogo/#download-and-build-blobbylogo","title":"Download and Build BlobbyLogo","text":"

        Click here to download BlobbyLogo and its CMakeLists.txt file. Once the tarball BlobbyLogo.tar has been downloaded and extracted,

        cd BlobbyLogo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BlobbyLogo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Blow/","title":"Blow","text":"

        vtk-examples/Cxx/Visualization/Blow

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/Blow/#description","title":"Description","text":"

        Extrusion blow molding process.

        In the extrusion blow molding process, a material is extruded through an annular die to form a hollow cylinder. This cylinder is called a parison. Two mold halves are then closed on the parison, while at the same time the parison is inflated with air. Some of the parison material remains within the mold while some becomes waste material. The material is typically a polymer plastic softened with heat, but blow molding has been used to form metal parts. Plastic bottles are often manufactured using a blow molding process.

        In this example the polymer was molded using an isothermal, nonlinear-elastic, incompressible (rubber-like) material. Triangular membrane finite elements were used to model the parison, while a combination of triangular and quadrilateral finite elements were used to model the mold. The mold surface is assumed to be rigid, and the parison is assumed to attach to the mold upon contact. Thus the thinning of the parison is controlled by its stretching during inflation and the sequence in which it contacts the mold.

        Ten steps of the analysis are illustrated. The color of the parison indicates its thickness. Using a rainbow scale, red areas are thinnest while blue regions are thickest. Our visualization shows clearly one problem with the analysis technique we are using. Note that while the nodes (i.e., points) of the finite element mesh are prevented from passing through the mold, the interior of the triangular elements are not. This is apparent from the occlusion of the mold wireframe by the parison mesh.

        You can also view the individual steps.

        Info

        See Figure 12-17 in Chapter 12 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Blow/#code","title":"Code","text":"

        Blow.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConnectivityFilter.h>\n#include <vtkContourFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDataSetReader.h>\n#include <vtkGeometryFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkWarpVector.h>\n\n#include <cstdlib>\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [data_point] e.g. blow.vtk\"\n              << std::endl;\n    std::cout << \"where: filename is blow.vtk.\" << std::endl;\n    std::cout << \"       data_point allows you to specify which frame is to be \"\n                 \"displayed.\"\n              << std::endl;\n    std::cout << \"       If data_point < 0 or data_point > 9 all ten \"\n                 \"frames are then displayed.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Default is to display all ten frames.\n  auto dataPoint = -1;\n  std::string fileName = argv[1];\n  if (argc > 2)\n  {\n    dataPoint = atoi(argv[2]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::vector<std::string> thickness;\n  std::vector<std::string> displacement;\n  for (auto i = 0; i < 10; ++i)\n  {\n    std::ostringstream os;\n    os << i;\n    thickness.push_back(\"thickness\" + os.str());\n    displacement.push_back(\"displacement\" + os.str());\n    os.str(\"\");\n  }\n\n  std::vector<vtkSmartPointer<vtkDataSetReader>> reader;\n  std::vector<vtkSmartPointer<vtkWarpVector>> warp;\n  std::vector<vtkSmartPointer<vtkConnectivityFilter>> connect;\n  std::vector<vtkSmartPointer<vtkGeometryFilter>> mold;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> moldMapper;\n  std::vector<vtkSmartPointer<vtkActor>> moldActor;\n  std::vector<vtkSmartPointer<vtkConnectivityFilter>> connect2;\n  std::vector<vtkSmartPointer<vtkGeometryFilter>> parison;\n  std::vector<vtkSmartPointer<vtkPolyDataNormals>> normals2;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> parisonMapper;\n  std::vector<vtkSmartPointer<vtkActor>> parisonActor;\n  std::vector<vtkSmartPointer<vtkContourFilter>> cf;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> contourMapper;\n  std::vector<vtkSmartPointer<vtkActor>> contours;\n  std::vector<vtkSmartPointer<vtkRenderer>> ren;\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.0, 0.66667);\n\n  for (auto i = 0; i < 10; ++i)\n  {\n    // Create the reader and warp the data vith vectors.\n    reader.push_back(vtkSmartPointer<vtkDataSetReader>::New());\n    reader[i]->SetFileName(fileName.c_str());\n    reader[i]->SetScalarsName(thickness[i].c_str());\n    reader[i]->SetVectorsName(displacement[i].c_str());\n    reader[i]->Update();\n\n    warp.push_back(vtkSmartPointer<vtkWarpVector>::New());\n    warp[i]->SetInputData(reader[i]->GetUnstructuredGridOutput());\n\n    // Extract the mold from the mesh using connectivity.\n    connect.push_back(vtkSmartPointer<vtkConnectivityFilter>::New());\n    connect[i]->SetInputConnection(warp[i]->GetOutputPort());\n    connect[i]->SetExtractionModeToSpecifiedRegions();\n    connect[i]->AddSpecifiedRegion(0);\n    connect[i]->AddSpecifiedRegion(1);\n    mold.push_back(vtkSmartPointer<vtkGeometryFilter>::New());\n    mold[i]->SetInputConnection(connect[i]->GetOutputPort());\n    moldMapper.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    moldMapper[i]->SetInputConnection(mold[i]->GetOutputPort());\n    moldMapper[i]->ScalarVisibilityOff();\n    moldActor.push_back(vtkSmartPointer<vtkActor>::New());\n    moldActor[i]->SetMapper(moldMapper[i]);\n    moldActor[i]->GetProperty()->SetColor(\n        colors->GetColor3d(\"ivory_black\").GetData());\n    moldActor[i]->GetProperty()->SetRepresentationToWireframe();\n\n    // Extract the parison from the mesh using connectivity.\n    connect2.push_back(vtkSmartPointer<vtkConnectivityFilter>::New());\n    connect2[i]->SetInputConnection(warp[i]->GetOutputPort());\n    connect2[i]->SetExtractionModeToSpecifiedRegions();\n    connect2[i]->AddSpecifiedRegion(2);\n    parison.push_back(vtkSmartPointer<vtkGeometryFilter>::New());\n    parison[i]->SetInputConnection(connect2[i]->GetOutputPort());\n    normals2.push_back(vtkSmartPointer<vtkPolyDataNormals>::New());\n    normals2[i]->SetInputConnection(parison[i]->GetOutputPort());\n    normals2[i]->SetFeatureAngle(60);\n    parisonMapper.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    parisonMapper[i]->SetInputConnection(normals2[i]->GetOutputPort());\n    parisonMapper[i]->SetLookupTable(lut);\n    parisonMapper[i]->SetScalarRange(0.12, 1.0);\n    parisonActor.push_back(vtkSmartPointer<vtkActor>::New());\n    parisonActor[i]->SetMapper(parisonMapper[i]);\n\n    cf.push_back(vtkSmartPointer<vtkContourFilter>::New());\n    cf[i]->SetInputConnection(connect2[i]->GetOutputPort());\n    cf[i]->SetValue(0, 0.5);\n    contourMapper.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    contourMapper[i]->SetInputConnection(cf[i]->GetOutputPort());\n    contours.push_back(vtkSmartPointer<vtkActor>::New());\n    contours[i]->SetMapper(contourMapper[i]);\n\n    ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n    ren[i]->AddActor(moldActor[i]);\n    ren[i]->AddActor(parisonActor[i]);\n    ren[i]->AddActor(contours[i]);\n    ren[i]->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n    ren[i]->GetActiveCamera()->SetPosition(50.973277, 12.298821, 29.102547);\n    ren[i]->GetActiveCamera()->SetFocalPoint(0.141547, 12.298821, -0.245166);\n    ren[i]->GetActiveCamera()->SetViewUp(-0.500000, 0.000000, 0.866025);\n    ren[i]->GetActiveCamera()->SetClippingRange(36.640827, 78.614680);\n  }\n\n  // Create the RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  auto rendererSizeX = 750;\n  auto rendererSizeY = 400;\n  auto renWinScale = 0.5;\n  renWin->SetWindowName(\"Blow\");\n  if (dataPoint >= 0 && dataPoint < 10)\n  {\n    renWin->AddRenderer(ren[dataPoint]);\n    renWin->SetSize(rendererSizeX, rendererSizeY);\n  }\n  else\n  {\n    auto gridDimensionsX = 2;\n    auto gridDimensionsY = 5;\n    renWin->SetSize(int(rendererSizeX * gridDimensionsX * renWinScale),\n                    int(rendererSizeY * gridDimensionsY * renWinScale));\n    // Add and position the renders to the render window.\n    for (auto row = 0; row < gridDimensionsY; ++row)\n    {\n      for (auto col = 0; col < gridDimensionsX; ++col)\n      {\n        auto idx = row * gridDimensionsX + col;\n        auto x0 = double(col) / gridDimensionsX;\n        auto y0 = double(gridDimensionsY - row - 1) / gridDimensionsY;\n        auto x1 = double(col + 1) / gridDimensionsX;\n        auto y1 = double(gridDimensionsY - row) / gridDimensionsY;\n        renWin->AddRenderer(ren[idx]);\n        ren[idx]->SetViewport(x0, y0, x1, y1);\n      }\n    }\n  }\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Blow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Blow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Blow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Blow MACOSX_BUNDLE Blow.cxx )\n  target_link_libraries(Blow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Blow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Blow/#download-and-build-blow","title":"Download and Build Blow","text":"

        Click here to download Blow and its CMakeLists.txt file. Once the tarball Blow.tar has been downloaded and extracted,

        cd Blow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Blow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/BoxClipStructuredPoints/","title":"BoxClipStructuredPoints","text":"

        vtk-examples/Cxx/Visualization/BoxClipStructuredPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/BoxClipStructuredPoints/#description","title":"Description","text":"

        Note

        The image was generated with this volume data: src/Testing/Data/HeadMRVolume.mhd, src/Testing/Data/HeadMRVolume.raw and src/Testing/Data/polyline.vtk.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/BoxClipStructuredPoints/#code","title":"Code","text":"

        BoxClipStructuredPoints.cxx

        #include <vtkActor.h>\n#include <vtkBoxClipDataSet.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageData.h>\n#include <vtkLookupTable.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.mhd e.g. HeadMRVolume.mhd\"\n              << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Silver\");\n\n  // Read the data.\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n\n  double range[2];\n  reader->GetOutput()->GetScalarRange(range);\n\n  double minBoxPoint[3];\n  double maxBoxPoint[3];\n  minBoxPoint[0] = (bounds[1] - bounds[0]) / 2.0 + bounds[0];\n  minBoxPoint[1] = (bounds[3] - bounds[2]) / 2.0 + bounds[2];\n  minBoxPoint[2] = (bounds[5] - bounds[4]) / 2.0 + bounds[4];\n  maxBoxPoint[0] = bounds[1];\n  maxBoxPoint[1] = bounds[3];\n  maxBoxPoint[2] = bounds[5];\n\n  vtkNew<vtkBoxClipDataSet> boxClip;\n  boxClip->SetInputConnection(reader->GetOutputPort());\n\n  const double minusx[] = {-1.0, -0.5, 0.0};\n  const double minusy[] = {0.0, -1.0, 0.0};\n  const double minusz[] = {0.0, 0.0, -1.0};\n  const double plusx[] = {1.0, 0.0, 0.0};\n  const double plusy[] = {0.0, 1.0, 0.0};\n  const double plusz[] = {0.0, 0.0, 1.0};\n  boxClip->SetBoxClip(minusx, minBoxPoint, minusy, minBoxPoint, minusz,\n                      minBoxPoint, plusx, maxBoxPoint, plusy, maxBoxPoint,\n                      plusz, maxBoxPoint);\n  boxClip->GenerateClippedOutputOn();\n\n  // Define a lut.\n  vtkNew<vtkLookupTable> lut1;\n  lut1->SetHueRange(0.667, 0);\n\n  vtkNew<vtkDataSetMapper> mapperIn;\n  mapperIn->SetInputConnection(boxClip->GetOutputPort(0));\n  mapperIn->SetScalarRange(reader->GetOutput()->GetScalarRange());\n  mapperIn->SetLookupTable(lut1);\n  mapperIn->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actorIn;\n  actorIn->SetMapper(mapperIn);\n\n  vtkNew<vtkDataSetMapper> mapperOut;\n  mapperOut->SetInputConnection(boxClip->GetOutputPort(1));\n  mapperOut->SetScalarRange(reader->GetOutput()->GetScalarRange());\n  mapperOut->SetLookupTable(lut1);\n  mapperOut->SetColorModeToMapScalars();\n\n  // Move the outside actor.\n  vtkNew<vtkActor> actorOut;\n  actorOut->SetMapper(mapperOut);\n  actorOut->AddPosition(-0.5 * (maxBoxPoint[0] - minBoxPoint[0]),\n                        -0.5 * (maxBoxPoint[1] - minBoxPoint[1]),\n                        -0.5 * (maxBoxPoint[2] - minBoxPoint[2]));\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"BoxClipStructuredPoints\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actorIn);\n  renderer->AddActor(actorOut);\n\n  // Generate an interesting view.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/BoxClipStructuredPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoxClipStructuredPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoxClipStructuredPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoxClipStructuredPoints MACOSX_BUNDLE BoxClipStructuredPoints.cxx )\n  target_link_libraries(BoxClipStructuredPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoxClipStructuredPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/BoxClipStructuredPoints/#download-and-build-boxclipstructuredpoints","title":"Download and Build BoxClipStructuredPoints","text":"

        Click here to download BoxClipStructuredPoints and its CMakeLists.txt file. Once the tarball BoxClipStructuredPoints.tar has been downloaded and extracted,

        cd BoxClipStructuredPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BoxClipStructuredPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/BoxClipUnstructuredGrid/","title":"BoxClipUnstructuredGrid","text":"

        vtk-examples/Cxx/Visualization/BoxClipUnstructuredGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/BoxClipUnstructuredGrid/#description","title":"Description","text":"

        This example uses the data src/Testing/Data/hexa.vtk.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/BoxClipUnstructuredGrid/#code","title":"Code","text":"

        BoxClipUnstructuredGrid.cxx

        #include <vtkActor.h>\n#include <vtkBoxClipDataSet.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.vtk e.g. hexa.vtk\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d backgroundColor = colors->GetColor3d(\"Silver\");\n\n  // Read the data\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n\n  double range[2];\n  reader->GetOutput()->GetScalarRange(range);\n\n  double minBoxPoint[3];\n  double maxBoxPoint[3];\n  minBoxPoint[0] = (bounds[1] - bounds[0]) / 2.0 + bounds[0];\n  minBoxPoint[1] = (bounds[3] - bounds[2]) / 2.0 + bounds[2];\n  minBoxPoint[2] = (bounds[5] - bounds[4]) / 2.0 + bounds[4];\n  maxBoxPoint[0] = bounds[1];\n  maxBoxPoint[1] = bounds[3];\n  maxBoxPoint[2] = bounds[5];\n\n  vtkNew<vtkBoxClipDataSet> boxClip;\n  boxClip->SetInputConnection(reader->GetOutputPort());\n  boxClip->GenerateClippedOutputOn();\n\n  const double minusx[] = {-1.0, -0.5, 0.0};\n  const double minusy[] = {0.0, -1.0, 0.0};\n  const double minusz[] = {0.0, 0.0, -1.0};\n  const double plusx[] = {1.0, 0.0, 0.0};\n  const double plusy[] = {0.0, 1.0, 0.0};\n  const double plusz[] = {0.0, 0.0, 1.0};\n  boxClip->SetBoxClip(minusx, minBoxPoint, minusy, minBoxPoint, minusz,\n                      minBoxPoint, plusx, maxBoxPoint, plusy, maxBoxPoint,\n                      plusz, maxBoxPoint);\n\n  // Define a lut\n  vtkNew<vtkLookupTable> lut1;\n  lut1->SetHueRange(.667, 0);\n\n  vtkNew<vtkDataSetMapper> mapperIn;\n  mapperIn->SetInputConnection(boxClip->GetOutputPort());\n  mapperIn->SetScalarRange(reader->GetOutput()->GetScalarRange());\n  mapperIn->SetLookupTable(lut1);\n  mapperIn->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actorIn;\n  actorIn->SetMapper(mapperIn);\n\n  vtkNew<vtkDataSetMapper> mapperOut;\n  mapperOut->SetInputConnection(boxClip->GetOutputPort(1));\n  mapperOut->SetScalarRange(reader->GetOutput()->GetScalarRange());\n  mapperOut->SetLookupTable(lut1);\n  mapperOut->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actorOut;\n  actorOut->SetMapper(mapperOut);\n  actorOut->AddPosition(-0.5 * (maxBoxPoint[0] - minBoxPoint[0]),\n                        -0.5 * (maxBoxPoint[1] - minBoxPoint[1]),\n                        -0.5 * (maxBoxPoint[2] - minBoxPoint[2]));\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(backgroundColor.GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"BoxClipUnstructuredGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actorIn);\n  renderer->AddActor(actorOut);\n\n  // Generate an interesting view\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.0);\n  renderer->ResetCameraClippingRange();\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/BoxClipUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoxClipUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoxClipUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoxClipUnstructuredGrid MACOSX_BUNDLE BoxClipUnstructuredGrid.cxx )\n  target_link_libraries(BoxClipUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoxClipUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/BoxClipUnstructuredGrid/#download-and-build-boxclipunstructuredgrid","title":"Download and Build BoxClipUnstructuredGrid","text":"

        Click here to download BoxClipUnstructuredGrid and its CMakeLists.txt file. Once the tarball BoxClipUnstructuredGrid.tar has been downloaded and extracted,

        cd BoxClipUnstructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BoxClipUnstructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Camera/","title":"Camera","text":"

        vtk-examples/Cxx/Visualization/Camera

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Camera/#code","title":"Code","text":"

        Camera.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(10.0);\n  sphereSource->SetPhiResolution(30);\n  sphereSource->SetThetaResolution(30);\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetSpecular(0.6);\n  actor->GetProperty()->SetSpecularPower(30);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"LightSkyBlue\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(0, 0, 100);\n  camera->SetFocalPoint(0, 0, 0);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n\n  renderer->SetActiveCamera(camera);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Camera\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Camera/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Camera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Camera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Camera MACOSX_BUNDLE Camera.cxx )\n  target_link_libraries(Camera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Camera\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Camera/#download-and-build-camera","title":"Download and Build Camera","text":"

        Click here to download Camera and its CMakeLists.txt file. Once the tarball Camera.tar has been downloaded and extracted,

        cd Camera/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Camera\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CameraActor/","title":"CameraActor","text":"

        vtk-examples/Cxx/Visualization/CameraActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CameraActor/#code","title":"Code","text":"

        CameraActor.cxx

        #include <vtkCamera.h>\n#include <vtkCameraActor.h>\n#include <vtkMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(400);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetDiffuseColor(\n      namedColors->GetColor3d(\"Tomato\").GetData());\n\n  // Camera\n  vtkNew<vtkCamera> camera;\n\n  vtkNew<vtkCameraActor> cameraActor;\n  cameraActor->SetCamera(camera);\n  cameraActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Black\").GetData());\n\n  // (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).\n  auto bounds = cameraActor->GetBounds();\n  std::cout << \"bounds: \" << bounds[0] << \" \" << bounds[1] << \" \" << bounds[2]\n            << \" \" << bounds[3] << \" \" << bounds[4] << \" \" << bounds[5]\n            << std::endl;\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CameraActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(sphereActor);\n  // Compute the active camera parameters\n  renderer->ResetCamera();\n\n  // Set the camera parameters for the camera actor\n  camera->DeepCopy(renderer->GetActiveCamera());\n  renderer->AddActor(cameraActor);\n\n  // Position the camera so that we can see the camera actor\n  renderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 1, 0);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/CameraActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraActor MACOSX_BUNDLE CameraActor.cxx )\n  target_link_libraries(CameraActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CameraActor/#download-and-build-cameraactor","title":"Download and Build CameraActor","text":"

        Click here to download CameraActor and its CMakeLists.txt file. Once the tarball CameraActor.tar has been downloaded and extracted,

        cd CameraActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CameraActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CameraModel1/","title":"CameraModel1","text":"

        vtk-examples/Cxx/Visualization/CameraModel1

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/CameraModel1/#description","title":"Description","text":"

        This example illustrates the camera movement around the focal point.

        Note

        For camera movement centered at the camera position see CameraModel2.

        Note

        This is an adaptation of the code written by Chung Kai Lun Pete.

        Note

        This example corresponds to Figure 3-12 in the VTK Text.

        Info

        See Figure 3-12 in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CameraModel1/#code","title":"Code","text":"

        CameraModel1.cxx

        /*\n   Adaptation of the code by\n        Author: Chung Kai Lun Peter\n        Email: hkpeterpeter@gmail.com\n        File:\n                demo_vtk_camera_1.cpp\n        Purpose:\n                Ported from camera.tcl from the VTK textbook.\n                It illustrates the camera model of VTK.\n*/\n\n#include <vtkAppendFilter.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkConeSource.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImplicitModeller.h>\n#include <vtkLODActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRotationalExtrusionFilter.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkWarpTo.h>\n\n#include <algorithm>\n#include <array>\n\nint main(int /* argc */, char* /* argv */[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the colors.\n  std::array<unsigned char, 4> azArrowColor{{255, 77, 77}};\n  colors->SetColor(\"AzimuthArrowColor\", azArrowColor.data());\n  std::array<unsigned char, 4> elevArrowColor{{77, 255, 77}};\n  colors->SetColor(\"ElevationArrowColor\", elevArrowColor.data());\n  std::array<unsigned char, 4> rollArrowColor{{255, 255, 77}};\n  colors->SetColor(\"RollArrowColor\", rollArrowColor.data());\n  std::array<unsigned char, 4> spikeColor{{255, 77, 255}};\n  colors->SetColor(\"SpikeColor\", spikeColor.data());\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // create a camera model\n  vtkNew<vtkConeSource> camCS;\n  camCS->SetHeight(1.5);\n  camCS->SetResolution(12);\n  camCS->SetRadius(0.4);\n\n  vtkNew<vtkCubeSource> camCBS;\n  camCBS->SetXLength(1.5);\n  camCBS->SetZLength(0.8);\n  camCBS->SetCenter(0.4, 0, 0);\n\n  vtkNew<vtkAppendFilter> camAPD;\n  camAPD->AddInputConnection(camCS->GetOutputPort());\n  camAPD->AddInputConnection(camCBS->GetOutputPort());\n\n  vtkNew<vtkDataSetMapper> camMapper;\n  camMapper->SetInputConnection(camAPD->GetOutputPort());\n\n  vtkNew<vtkLODActor> camActor;\n  camActor->SetMapper(camMapper);\n  camActor->SetScale(2, 2, 2);\n\n  // draw the arrows\n  vtkNew<vtkPolyData> pd;\n  vtkNew<vtkCellArray> ca;\n  vtkNew<vtkPoints> fp;\n  fp->InsertNextPoint(0, 1, 0);\n  fp->InsertNextPoint(8, 1, 0);\n  fp->InsertNextPoint(8, 2, 0);\n  fp->InsertNextPoint(10, 0.01, 0);\n  fp->InsertNextPoint(8, -2, 0);\n  fp->InsertNextPoint(8, -1, 0);\n  fp->InsertNextPoint(0, -1, 0);\n  ca->InsertNextCell(7);\n  ca->InsertCellPoint(0);\n  ca->InsertCellPoint(1);\n  ca->InsertCellPoint(2);\n  ca->InsertCellPoint(3);\n  ca->InsertCellPoint(4);\n  ca->InsertCellPoint(5);\n  ca->InsertCellPoint(6);\n  pd->SetPoints(fp);\n  pd->SetPolys(ca);\n\n  vtkNew<vtkPolyData> pd2;\n  vtkNew<vtkCellArray> ca2;\n  vtkNew<vtkPoints> fp2;\n  fp2->InsertNextPoint(0, 1, 0);\n  fp2->InsertNextPoint(8, 1, 0);\n  fp2->InsertNextPoint(8, 2, 0);\n  fp2->InsertNextPoint(10, 0.01, 0);\n  ca2->InsertNextCell(4);\n  ca2->InsertCellPoint(0);\n  ca2->InsertCellPoint(1);\n  ca2->InsertCellPoint(2);\n  ca2->InsertCellPoint(3);\n  pd2->SetPoints(fp2);\n  pd2->SetLines(ca2);\n\n  vtkNew<vtkImplicitModeller> arrowIM;\n  arrowIM->SetInputData(pd);\n  arrowIM->SetSampleDimensions(50, 20, 8);\n\n  vtkNew<vtkContourFilter> arrowCF;\n  arrowCF->SetInputConnection(arrowIM->GetOutputPort());\n  arrowCF->SetValue(0, 0.2);\n\n  vtkNew<vtkWarpTo> arrowWT;\n  arrowWT->SetInputConnection(arrowCF->GetOutputPort());\n  arrowWT->SetPosition(5, 0, 5);\n  arrowWT->SetScaleFactor(0.85);\n  arrowWT->AbsoluteOn();\n\n  vtkNew<vtkTransform> arrowT;\n  arrowT->RotateY(60);\n  arrowT->Translate(-1.33198, 0, -1.479);\n  arrowT->Scale(1, 0.5, 1);\n\n  vtkNew<vtkTransformFilter> arrowTF;\n  arrowTF->SetInputConnection(arrowWT->GetOutputPort());\n  arrowTF->SetTransform(arrowT);\n\n  vtkNew<vtkDataSetMapper> arrowMapper;\n  arrowMapper->SetInputConnection(arrowTF->GetOutputPort());\n  arrowMapper->ScalarVisibilityOff();\n\n  // draw the azimuth arrows\n  vtkNew<vtkLODActor> a1Actor;\n  a1Actor->SetMapper(arrowMapper);\n  a1Actor->RotateZ(180);\n  a1Actor->SetPosition(1, 0, -1);\n  a1Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AzimuthArrowColor\").GetData());\n  a1Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a1Actor->GetProperty()->SetSpecular(0.3);\n  a1Actor->GetProperty()->SetSpecularPower(20);\n  a1Actor->GetProperty()->SetAmbient(0.2);\n  a1Actor->GetProperty()->SetDiffuse(0.8);\n\n  vtkNew<vtkLODActor> a2Actor;\n  a2Actor->SetMapper(arrowMapper);\n  a2Actor->RotateZ(180);\n  a2Actor->RotateX(180);\n  a2Actor->SetPosition(1, 0, 1);\n  a2Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AzimuthArrowColor\").GetData());\n  a2Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a2Actor->GetProperty()->SetSpecular(0.3);\n  a2Actor->GetProperty()->SetSpecularPower(20);\n  a2Actor->GetProperty()->SetAmbient(0.2);\n  a2Actor->GetProperty()->SetDiffuse(0.8);\n\n  // draw the elevation arrows\n  vtkNew<vtkLODActor> a3Actor;\n  a3Actor->SetMapper(arrowMapper);\n  a3Actor->RotateZ(180);\n  a3Actor->RotateX(90);\n  a3Actor->SetPosition(1, -1, 0);\n  a3Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"ElevationArrowColor\").GetData());\n  a3Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a3Actor->GetProperty()->SetSpecular(0.3);\n  a3Actor->GetProperty()->SetSpecularPower(20);\n  a3Actor->GetProperty()->SetAmbient(0.2);\n  a3Actor->GetProperty()->SetDiffuse(0.8);\n\n  vtkNew<vtkLODActor> a4Actor;\n  a4Actor->SetMapper(arrowMapper);\n  a4Actor->RotateZ(180);\n  a4Actor->RotateX(-90);\n  a4Actor->SetPosition(1, 1, 0);\n  a4Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"ElevationArrowColor\").GetData());\n  a4Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a4Actor->GetProperty()->SetSpecular(0.3);\n  a4Actor->GetProperty()->SetSpecularPower(20);\n  a4Actor->GetProperty()->SetAmbient(0.2);\n  a4Actor->GetProperty()->SetDiffuse(0.8);\n\n  // draw the DOP\n  vtkNew<vtkTransform> arrowT2;\n  arrowT2->Scale(1, 0.6, 1);\n  arrowT2->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> arrowTF2;\n  arrowTF2->SetInputData(pd2);\n  arrowTF2->SetTransform(arrowT2);\n\n  vtkNew<vtkRotationalExtrusionFilter> arrowREF;\n  arrowREF->SetInputConnection(arrowTF2->GetOutputPort());\n  arrowREF->CappingOff();\n  arrowREF->SetResolution(30);\n\n  vtkNew<vtkPolyDataMapper> spikeMapper;\n  spikeMapper->SetInputConnection(arrowREF->GetOutputPort());\n\n  vtkNew<vtkLODActor> a5Actor;\n  a5Actor->SetMapper(spikeMapper);\n  a5Actor->SetScale(.3, .3, .6);\n  a5Actor->RotateY(90);\n  a5Actor->SetPosition(-2, 0, 0);\n  a5Actor->GetProperty()->SetColor(colors->GetColor3d(\"SpikeColor\").GetData());\n  a5Actor->GetProperty()->SetAmbient(0.2);\n  a5Actor->GetProperty()->SetDiffuse(0.8);\n\n  // focal point\n  vtkNew<vtkSphereSource> fps;\n  fps->SetRadius(0.5);\n  vtkNew<vtkPolyDataMapper> fpMapper;\n  fpMapper->SetInputConnection(fps->GetOutputPort());\n  vtkNew<vtkLODActor> fpActor;\n  fpActor->SetMapper(fpMapper);\n  fpActor->SetPosition(-9, 0, 0);\n  fpActor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  fpActor->GetProperty()->SetSpecular(0.3);\n  fpActor->GetProperty()->SetAmbient(0.2);\n  fpActor->GetProperty()->SetDiffuse(0.8);\n  fpActor->GetProperty()->SetSpecularPower(20);\n\n  // create the roll arrows\n  vtkNew<vtkWarpTo> arrowWT2;\n  arrowWT2->SetInputConnection(arrowCF->GetOutputPort());\n  arrowWT2->SetPosition(5, 0, 2.5);\n  arrowWT2->SetScaleFactor(0.95);\n  arrowWT2->AbsoluteOn();\n\n  vtkNew<vtkTransform> arrowT3;\n  arrowT3->Translate(-2.50358, 0, -1.70408);\n  arrowT3->Scale(0.5, 0.3, 1);\n\n  vtkNew<vtkTransformFilter> arrowTF3;\n  arrowTF3->SetInputConnection(arrowWT2->GetOutputPort());\n  arrowTF3->SetTransform(arrowT3);\n\n  vtkNew<vtkDataSetMapper> arrowMapper2;\n  arrowMapper2->SetInputConnection(arrowTF3->GetOutputPort());\n  arrowMapper2->ScalarVisibilityOff();\n\n  // draw the roll arrows\n  vtkNew<vtkLODActor> a6Actor;\n  a6Actor->SetMapper(arrowMapper2);\n  a6Actor->RotateZ(90);\n  a6Actor->SetPosition(-4, 0, 0);\n  a6Actor->SetScale(1.5, 1.5, 1.5);\n  a6Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"RollArrowColor\").GetData());\n  a6Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a6Actor->GetProperty()->SetSpecular(0.3);\n  a6Actor->GetProperty()->SetSpecularPower(20);\n  a6Actor->GetProperty()->SetAmbient(0.2);\n  a6Actor->GetProperty()->SetDiffuse(0.8);\n\n  // Add the actors to the renderer, set the background and size\n  ren1->AddActor(camActor);\n  ren1->AddActor(a1Actor);\n  ren1->AddActor(a2Actor);\n  ren1->AddActor(a3Actor);\n  ren1->AddActor(a4Actor);\n  ren1->AddActor(a5Actor);\n  ren1->AddActor(a6Actor);\n  ren1->AddActor(fpActor);\n  ren1->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CameraModel1\");\n\n  // render the image\n\n  vtkCamera* cam1 = (ren1->GetActiveCamera());\n  ren1->ResetCamera();\n  cam1->Azimuth(150);\n  cam1->Elevation(30);\n  cam1->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  // Create a TextActor for azimuth  (a1 and a2 actor's color)\n  vtkNew<vtkTextActor> text;\n  text->SetInput(\"Azimuth\");\n  vtkTextProperty* tprop = text->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a1Actor->GetProperty()->GetColor());\n  text->SetDisplayPosition(20, 50);\n  ren1->AddActor2D(text);\n\n  // Create a TextActor for elevation  (a3 and a4 actor's color)\n  vtkNew<vtkTextActor> text2;\n  text2->SetInput(\"Elevation\");\n  tprop = text2->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a3Actor->GetProperty()->GetColor());\n  text2->SetDisplayPosition(20, 100);\n  ren1->AddActor2D(text2);\n\n  // Create a TextActor for roll (a6 actor's color)\n  vtkNew<vtkTextActor> text3;\n  text3->SetInput(\"Roll\");\n  tprop = text3->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a6Actor->GetProperty()->GetColor());\n  text3->SetDisplayPosition(20, 150);\n  ren1->AddActor2D(text3);\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/CameraModel1/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraModel1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersHybrid\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraModel1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraModel1 MACOSX_BUNDLE CameraModel1.cxx )\n  target_link_libraries(CameraModel1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraModel1\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CameraModel1/#download-and-build-cameramodel1","title":"Download and Build CameraModel1","text":"

        Click here to download CameraModel1 and its CMakeLists.txt file. Once the tarball CameraModel1.tar has been downloaded and extracted,

        cd CameraModel1/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CameraModel1\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CameraModel2/","title":"CameraModel2","text":"

        vtk-examples/Cxx/Visualization/CameraModel2

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/CameraModel2/#description","title":"Description","text":"

        This example illustrates the camera movement centered at the camera position.

        Note

        For camera movement around the focal point see CameraModel1.

        Note

        This is an adaptation of the code written by Chung Kai Lun Pete.

        Info

        See Figure 3-13 in Chapter 3 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CameraModel2/#code","title":"Code","text":"

        CameraModel2.cxx

        /*\n   Adaptation of the code by\n        Author: Chung Kai Lun Peter\n        Email: hkpeterpeter@gmail.com\n        File:\n            demo_vtk_camera_2.cpp\n        Purpose:\n                Ported from camera2.tcl.\n                It illustrates the camera model of VTK.\n*/\n\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkConeSource.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImplicitModeller.h>\n#include <vtkLODActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRotationalExtrusionFilter.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformFilter.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkWarpTo.h>\n\n#include <algorithm>\n#include <array>\n\nint main(int /* argc */, char* /* argv */[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the colors.\n  std::array<unsigned char, 4> azArrowColor{{255, 77, 77}};\n  colors->SetColor(\"AzimuthArrowColor\", azArrowColor.data());\n  std::array<unsigned char, 4> elevArrowColor{{77, 255, 77}};\n  colors->SetColor(\"ElevationArrowColor\", elevArrowColor.data());\n  std::array<unsigned char, 4> rollArrowColor{{255, 255, 77}};\n  colors->SetColor(\"RollArrowColor\", rollArrowColor.data());\n  std::array<unsigned char, 4> spikeColor{{255, 77, 255}};\n  colors->SetColor(\"SpikeColor\", spikeColor.data());\n  std::array<unsigned char, 4> upSpikeColor{{77, 255, 255}};\n  colors->SetColor(\"UpSpikeColor\", upSpikeColor.data());\n\n  // create a camera model\n  vtkNew<vtkConeSource> camCS;\n  camCS->SetHeight(1.5);\n  camCS->SetResolution(12);\n  camCS->SetRadius(0.4);\n\n  vtkNew<vtkCubeSource> camCBS;\n  camCBS->SetXLength(1.5);\n  camCBS->SetZLength(0.8);\n  camCBS->SetCenter(0.4, 0, 0);\n\n  vtkNew<vtkAppendPolyData> camAPD;\n  camAPD->AddInputConnection(camCBS->GetOutputPort());\n  camAPD->AddInputConnection(camCS->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> camMapper;\n  camMapper->SetInputConnection(camAPD->GetOutputPort());\n  vtkNew<vtkLODActor> camActor;\n  camActor->SetMapper(camMapper);\n  camActor->SetScale(2, 2, 2);\n\n  // draw the arrows\n  vtkNew<vtkPolyData> pd;\n  vtkNew<vtkCellArray> ca;\n  vtkNew<vtkPoints> pts;\n  pts->InsertNextPoint(0, 1, 0);\n  pts->InsertNextPoint(8, 1, 0);\n  pts->InsertNextPoint(8, 2, 0);\n  pts->InsertNextPoint(10, 0, 0);\n  pts->InsertNextPoint(8, -2, 0);\n  pts->InsertNextPoint(8, -1, 0);\n  pts->InsertNextPoint(0, -1, 0);\n  ca->InsertNextCell(7);\n  ca->InsertCellPoint(0);\n  ca->InsertCellPoint(1);\n  ca->InsertCellPoint(2);\n  ca->InsertCellPoint(3);\n  ca->InsertCellPoint(4);\n  ca->InsertCellPoint(5);\n  ca->InsertCellPoint(6);\n  pd->SetPoints(pts);\n  pd->SetPolys(ca);\n\n  vtkNew<vtkPolyData> pd2;\n  vtkNew<vtkCellArray> ca2;\n  vtkNew<vtkPoints> pts2;\n  pts2->InsertNextPoint(0, 1, 0);\n  pts2->InsertNextPoint(8, 1, 0);\n  pts2->InsertNextPoint(8, 2, 0);\n  pts2->InsertNextPoint(10, 0.01, 0);\n  ca2->InsertNextCell(4);\n  ca2->InsertCellPoint(0);\n  ca2->InsertCellPoint(1);\n  ca2->InsertCellPoint(2);\n  ca2->InsertCellPoint(3);\n  pd2->SetPoints(pts2);\n  pd2->SetLines(ca2);\n\n  vtkNew<vtkImplicitModeller> arrowIM;\n  arrowIM->SetInputData(pd);\n  arrowIM->SetSampleDimensions(50, 20, 8);\n\n  vtkNew<vtkContourFilter> arrowCF;\n  arrowCF->SetInputConnection(arrowIM->GetOutputPort());\n  arrowCF->SetValue(0, 0.2);\n\n  vtkNew<vtkWarpTo> arrowWT;\n  arrowWT->SetInputConnection(arrowCF->GetOutputPort());\n  arrowWT->SetPosition(5, 0, 5);\n  arrowWT->SetScaleFactor(0.85);\n  arrowWT->AbsoluteOn();\n\n  vtkNew<vtkTransform> arrowT;\n  arrowT->RotateY(60);\n  arrowT->Translate(-1.33198, 0, -1.479);\n  arrowT->Scale(1, 0.5, 1);\n\n  vtkNew<vtkTransformFilter> arrowTF;\n  arrowTF->SetInputConnection(arrowWT->GetOutputPort());\n  arrowTF->SetTransform(arrowT);\n\n  vtkNew<vtkDataSetMapper> arrowMapper;\n  arrowMapper->SetInputConnection(arrowTF->GetOutputPort());\n  arrowMapper->ScalarVisibilityOff();\n\n  // draw the azimuth arrows\n  vtkNew<vtkLODActor> a1Actor;\n  a1Actor->SetMapper(arrowMapper);\n  a1Actor->SetPosition(-9, 0, -1);\n  a1Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AzimuthArrowColor\").GetData());\n  a1Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a1Actor->GetProperty()->SetSpecular(0.3);\n  a1Actor->GetProperty()->SetSpecularPower(20);\n  a1Actor->GetProperty()->SetAmbient(0.2);\n  a1Actor->GetProperty()->SetDiffuse(0.8);\n\n  vtkNew<vtkLODActor> a2Actor;\n  a2Actor->SetMapper(arrowMapper);\n  a2Actor->RotateX(180);\n  a2Actor->SetPosition(-9, 0, 1);\n  a2Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"AzimuthArrowColor\").GetData());\n  a2Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a2Actor->GetProperty()->SetSpecular(0.3);\n  a2Actor->GetProperty()->SetSpecularPower(20);\n  a2Actor->GetProperty()->SetAmbient(0.2);\n  a2Actor->GetProperty()->SetDiffuse(0.8);\n\n  // draw the elevation arrows\n  vtkNew<vtkLODActor> a3Actor;\n  a3Actor->SetMapper(arrowMapper);\n  a3Actor->RotateX(-90);\n  a3Actor->SetPosition(-9, -1, 0);\n  a3Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"ElevationArrowColor\").GetData());\n  a3Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a3Actor->GetProperty()->SetSpecular(0.3);\n  a3Actor->GetProperty()->SetSpecularPower(20);\n  a3Actor->GetProperty()->SetAmbient(0.2);\n  a3Actor->GetProperty()->SetDiffuse(0.8);\n\n  vtkNew<vtkLODActor> a4Actor;\n  a4Actor->SetMapper(arrowMapper);\n  a4Actor->RotateX(90);\n  a4Actor->SetPosition(-9, 1, 0);\n  a4Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"ElevationArrowColor\").GetData());\n  a4Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a4Actor->GetProperty()->SetSpecular(0.3);\n  a4Actor->GetProperty()->SetSpecularPower(20);\n  a4Actor->GetProperty()->SetAmbient(0.2);\n  a4Actor->GetProperty()->SetDiffuse(0.8);\n\n  // draw the DOP\n  vtkNew<vtkTransform> arrowT2;\n  arrowT2->Scale(1, 0.6, 1);\n  arrowT2->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> arrowTF2;\n  arrowTF2->SetInputData(pd2);\n  arrowTF2->SetTransform(arrowT2);\n\n  vtkNew<vtkRotationalExtrusionFilter> arrowREF;\n  arrowREF->SetInputConnection(arrowTF2->GetOutputPort());\n  arrowREF->CappingOff();\n  arrowREF->SetResolution(30);\n\n  vtkNew<vtkPolyDataMapper> spikeMapper;\n  spikeMapper->SetInputConnection(arrowREF->GetOutputPort());\n\n  vtkNew<vtkLODActor> a5Actor;\n  a5Actor->SetMapper(spikeMapper);\n  a5Actor->SetScale(0.3, 0.3, 0.6);\n  a5Actor->RotateY(-90);\n  a5Actor->SetPosition(-8, 0, 0);\n  a5Actor->GetProperty()->SetColor(colors->GetColor3d(\"SpikeColor\").GetData());\n  a5Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a5Actor->GetProperty()->SetSpecular(0.3);\n  a5Actor->GetProperty()->SetAmbient(0.2);\n  a5Actor->GetProperty()->SetDiffuse(0.8);\n  a5Actor->GetProperty()->SetSpecularPower(20);\n\n  vtkNew<vtkLODActor> a7Actor;\n  a7Actor->SetMapper(spikeMapper);\n  a7Actor->SetScale(0.2, 0.2, 0.7);\n  a7Actor->RotateZ(90);\n  a7Actor->RotateY(-90);\n  a7Actor->SetPosition(-9, 1, 0);\n  a7Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"UpSpikeColor\").GetData());\n  a7Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a7Actor->GetProperty()->SetSpecular(0.3);\n  a7Actor->GetProperty()->SetAmbient(0.2);\n  a7Actor->GetProperty()->SetDiffuse(0.8);\n  a7Actor->GetProperty()->SetSpecularPower(20);\n\n  // focal point\n  vtkNew<vtkSphereSource> ss;\n  ss->SetRadius(0.5);\n  vtkNew<vtkPolyDataMapper> fpMapper;\n  fpMapper->SetInputConnection(ss->GetOutputPort());\n  vtkNew<vtkLODActor> fpActor;\n  fpActor->SetMapper(fpMapper);\n  fpActor->SetPosition(-9, 0, 0);\n  fpActor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  fpActor->GetProperty()->SetSpecular(0.3);\n  fpActor->GetProperty()->SetAmbient(0.2);\n  fpActor->GetProperty()->SetDiffuse(0.8);\n  fpActor->GetProperty()->SetSpecularPower(20);\n\n  // create the roll arrows\n  vtkNew<vtkWarpTo> arrowWT2;\n  arrowWT2->SetInputConnection(arrowCF->GetOutputPort());\n  arrowWT2->SetPosition(5, 0, 2.5);\n  arrowWT2->SetScaleFactor(0.95);\n  arrowWT2->AbsoluteOn();\n\n  vtkNew<vtkTransform> arrowT3;\n  arrowT3->Translate(-2.50358, 0, -1.70408);\n  arrowT3->Scale(0.5, 0.3, 1);\n\n  vtkNew<vtkTransformFilter> arrowTF3;\n  arrowTF3->SetInputConnection(arrowWT2->GetOutputPort());\n  arrowTF3->SetTransform(arrowT3);\n\n  vtkNew<vtkDataSetMapper> arrowMapper2;\n  arrowMapper2->SetInputConnection(arrowTF3->GetOutputPort());\n  arrowMapper2->ScalarVisibilityOff();\n\n  // draw the roll arrows\n  vtkNew<vtkLODActor> a6Actor;\n  a6Actor->SetMapper(arrowMapper2);\n  a6Actor->RotateZ(90);\n  a6Actor->SetPosition(-4, 0, 0);\n  a6Actor->SetScale(1.5, 1.5, 1.5);\n  a6Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"RollArrowColor\").GetData());\n  a6Actor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  a6Actor->GetProperty()->SetSpecular(0.3);\n  a6Actor->GetProperty()->SetSpecularPower(20);\n  a6Actor->GetProperty()->SetAmbient(0.2);\n  a6Actor->GetProperty()->SetDiffuse(0.8);\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  ren1->AddActor(camActor);\n  ren1->AddActor(a1Actor);\n  ren1->AddActor(a2Actor);\n  ren1->AddActor(a3Actor);\n  ren1->AddActor(a4Actor);\n  ren1->AddActor(a5Actor);\n  ren1->AddActor(a6Actor);\n  ren1->AddActor(a7Actor);\n  ren1->AddActor(fpActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CameraModel2\");\n\n  // render the image\n\n  vtkCamera* cam1 = (ren1->GetActiveCamera());\n  ren1->ResetCamera();\n  cam1->Azimuth(150);\n  cam1->Elevation(30);\n  cam1->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  // Create a TextActor for Yaw  (a1 and a2 actor's color)\n  vtkNew<vtkTextActor> text;\n  text->SetInput(\"Yaw\");\n  vtkTextProperty* tprop = text->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a1Actor->GetProperty()->GetColor());\n  text->SetDisplayPosition(20, 50);\n  ren1->AddActor2D(text);\n\n  // Create a TextActor for Pitch  (a3 and a4 actor's color)\n  vtkNew<vtkTextActor> text2;\n  text2->SetInput(\"Pitch\");\n  tprop = text2->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a3Actor->GetProperty()->GetColor());\n  text2->SetDisplayPosition(20, 100);\n  ren1->AddActor2D(text2);\n\n  // Create a TextActor for roll (a6 actor's color)\n  vtkNew<vtkTextActor> text3;\n  text3->SetInput(\"Roll\");\n  tprop = text3->GetTextProperty();\n  tprop->SetFontFamilyToArial();\n  tprop->ShadowOff();\n  tprop->SetLineSpacing(1.0);\n  tprop->SetFontSize(36);\n  tprop->SetColor(a6Actor->GetProperty()->GetColor());\n  text3->SetDisplayPosition(20, 150);\n  ren1->AddActor2D(text3);\n\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/CameraModel2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraModel2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersHybrid\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraModel2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraModel2 MACOSX_BUNDLE CameraModel2.cxx )\n  target_link_libraries(CameraModel2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraModel2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CameraModel2/#download-and-build-cameramodel2","title":"Download and Build CameraModel2","text":"

        Click here to download CameraModel2 and its CMakeLists.txt file. Once the tarball CameraModel2.tar has been downloaded and extracted,

        cd CameraModel2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CameraModel2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CaptionActor2D/","title":"CaptionActor2D","text":"

        vtk-examples/Cxx/Visualization/CaptionActor2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CaptionActor2D/#code","title":"Code","text":"

        CaptionActor2D.cxx

        #include <vtkAbstractPicker.h>\n#include <vtkActor2D.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\nclass MyStyle : public vtkInteractorStyleImage\n{\npublic:\n  static MyStyle* New();\n  vtkTypeMacro(MyStyle, vtkInteractorStyleImage);\n\n  std::vector<vtkActor2D*> Numbers;\n\n  void OnLeftButtonDown()\n  {\n    // std::cout << \"Picking pixel: \" << this->Interactor->GetEventPosition()[0]\n    // << \" \" << this->Interactor->GetEventPosition()[1] << std::endl;\n    this->Interactor->GetPicker()->Pick(\n        this->Interactor->GetEventPosition()[0],\n        this->Interactor->GetEventPosition()[1],\n        0, // always zero.\n        // this->Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer());\n        this->CurrentRenderer);\n    double picked[3];\n    this->Interactor->GetPicker()->GetPickPosition(picked);\n    // std::cout << \"Picked point with coordinate: \" << picked[0] << \" \" <<\n    // picked[1] << \" \" << picked[2] << std::endl;\n\n    this->AddNumber(picked);\n\n    // Forward events\n    vtkInteractorStyleImage::OnLeftButtonDown();\n\n    // this->Interactor->GetRenderWindow()->Render();\n    this->Interactor->Render();\n  }\n\n  void AddNumber(double p[3])\n  {\n    std::cout << \"Adding marker at \" << p[0] << \" \" << p[1]; //<< std::endl;\n\n    // normally, with an image you would do\n    // double* s = image->GetSpacing();\n    // double* o = image->GetOrigin();\n    // p[0] = static_cast<int>( (p[0] - o[0]) / s[0] + 0.5 );\n    p[0] = static_cast<int>(p[0] + 0.5);\n    p[1] = static_cast<int>(p[1] + 0.5);\n\n    std::cout << \" -> \" << p[0] << \" \" << p[1] << std::endl;\n\n    // Convert the current number to a string\n    std::stringstream ss;\n    ss << Numbers.size();\n    std::cout << \"Adding number: \" << ss.str() << std::endl;\n\n    // Create an actor for the text\n    vtkNew<vtkCaptionActor2D> captionActor;\n    captionActor->SetCaption(ss.str().c_str());\n    captionActor->SetAttachmentPoint(p);\n    captionActor->BorderOff();\n    captionActor->GetCaptionTextProperty()->BoldOff();\n    captionActor->GetCaptionTextProperty()->ItalicOff();\n    captionActor->GetCaptionTextProperty()->ShadowOff();\n    captionActor->ThreeDimensionalLeaderOff();\n\n    this->CurrentRenderer->AddViewProp(captionActor);\n\n    this->Numbers.push_back(captionActor);\n  }\n};\n\nvtkStandardNewMacro(MyStyle);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a blank, black image.\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 20, 0, 50, 0, 0);\n  drawing->FillBox(0, 20, 0, 50);\n\n  // Draw a red circle of radius 5 centered at (9,10).\n  drawing->SetDrawColor(255, 0, 0, 0);\n  drawing->DrawCircle(9, 10, 5);\n  drawing->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(drawing->GetOutputPort());\n  actor->InterpolateOff();\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CaptionActor2D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"Blue\").GetData());\n\n  renderWindow->Render();\n\n  vtkNew<MyStyle> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->SetDefaultRenderer(renderer);\n  style->SetCurrentRenderer(renderer);\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/CaptionActor2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CaptionActor2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CaptionActor2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CaptionActor2D MACOSX_BUNDLE CaptionActor2D.cxx )\n  target_link_libraries(CaptionActor2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CaptionActor2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CaptionActor2D/#download-and-build-captionactor2d","title":"Download and Build CaptionActor2D","text":"

        Click here to download CaptionActor2D and its CMakeLists.txt file. Once the tarball CaptionActor2D.tar has been downloaded and extracted,

        cd CaptionActor2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CaptionActor2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ChooseTextColor/","title":"ChooseTextColor","text":"

        vtk-examples/Cxx/Visualization/ChooseTextColor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ChooseTextColor/#description","title":"Description","text":"

        This example uses a simple algorithm to choose a color that \"contrasts\" with another color. The ChooseContrastingColor procedure converts the input RGB value to HSV using vtkMath::RGBToHSV. If the value is <= .5, the light color is chosen as the contrasting color. Otherwise, the dark color is chosen. The default light color is white and the default dark color is black. Any color from vtkNamedColors can be specified for the light and dark colors.

        To run the example with your own arguments:

        ChooseTextColor fontFile [background] [lightColor] [darkColor]\n

        Info

        VTKNamedColorPatches shows the available colors.

        Info

        The ChooseContrastingColor procedure is reusable, Cut and paste the declarations and code into other examples.

        Tip

        There are many sources of TrueType fonts. Here is one source.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ChooseTextColor/#code","title":"Code","text":"

        ChooseTextColor.cxx

        #include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\n// Given a color, find a contrasting color. If the given color is \"light\",\n// use the lightColor otherwise use the darkColor.\nvoid ChooseContrastingColor(double* rgbIn, double* rgbOut,\n                            const double threshold = .5,\n                            const std::string& lightColor = \"white\",\n                            const std::string& darkColor = \"black\");\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" font.ttf [backColor] [lightColor] [darkColor]\" << std::endl;\n    std::cerr << \"E.g. Canterbury.ttf Pink MintCream SaddleBrown\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Defaults\n  double threshold(.8);\n  std::string backColor = \"SlateGray\";\n  std::string lightColor = \"White\";\n  std::string darkColor = \"Black\";\n  if (argc > 2)\n  {\n    backColor = argv[2];\n  }\n  if (argc > 3)\n  {\n    lightColor = argv[3];\n  }\n  if (argc > 4)\n  {\n    darkColor = argv[4];\n  }\n\n  std::string fontFile(argv[1]);\n  std::stringstream str;\n  str << \"Font: \"\n      << vtksys::SystemTools::GetFilenameWithoutExtension(std::string(argv[1]))\n      << \"\\n\"\n      << \"Background: \" << backColor << \"\\n\"\n      << \"Light Color: \" << lightColor << \"\\n\"\n      << \"Dark Color: \" << darkColor;\n\n  int width = 640;\n  int height = 480;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkTextActor> actor;\n  actor->GetTextProperty()->SetJustificationToCentered();\n  actor->GetTextProperty()->SetVerticalJustificationToCentered();\n  actor->SetTextScaleModeToViewport();\n  actor->SetInput(str.str().c_str());\n  actor->SetPosition(width / 2, height / 2);\n  actor->GetTextProperty()->BoldOff();\n  actor->GetTextProperty()->SetFontSize(40);\n  actor->GetTextProperty()->SetFontFamily(VTK_FONT_FILE);\n  actor->GetTextProperty()->SetFontFile(fontFile.c_str());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(backColor.c_str()).GetData());\n\n  // Compute a good color for text on the renderer background.\n  double rgb[3];\n  ChooseContrastingColor(renderer->GetBackground(), rgb, threshold, lightColor,\n                         darkColor);\n  std::cout << rgb[0] << \",\" << rgb[1] << \",\" << rgb[2] << std::endl;\n  actor->GetTextProperty()->SetColor(rgb);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->SetSize(width, height);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ChooseTextColor\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid ChooseContrastingColor(double* rgbIn, double* rgbOut,\n                            const double threshold,\n                            const std::string& lightColor,\n                            const std::string& darkColor)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  double hsv[3];\n  // If the value is <= threshold, use a light color, otherwise use a dark\n  // color.\n  vtkMath::RGBToHSV(rgbIn, hsv);\n  if (hsv[2] <= threshold)\n  {\n    colors->GetColor(lightColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n  else\n  {\n    colors->GetColor(darkColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/ChooseTextColor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ChooseTextColor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ChooseTextColor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ChooseTextColor MACOSX_BUNDLE ChooseTextColor.cxx )\n  target_link_libraries(ChooseTextColor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ChooseTextColor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ChooseTextColor/#download-and-build-choosetextcolor","title":"Download and Build ChooseTextColor","text":"

        Click here to download ChooseTextColor and its CMakeLists.txt file. Once the tarball ChooseTextColor.tar has been downloaded and extracted,

        cd ChooseTextColor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ChooseTextColor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ChooseTextColorDemo/","title":"ChooseTextColorDemo","text":"

        vtk-examples/Cxx/Visualization/ChooseTextColorDemo

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ChooseTextColorDemo/#code","title":"Code","text":"

        ChooseTextColorDemo.cxx

        #include <vtkCamera.h>\n#include <vtkCoordinate.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n\n// For drawing the vieport border.\n#include <vtkActor2D.h>\n#include <vtkCellArray.h>\n#include <vtkCoordinate.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderer.h>\n\nnamespace {\n// Given a color, find a contrasting color. If the given color is \"light\",\n// use the lightColor otherwise use the darkColor.\nvoid ChooseContrastingColor(double* rgbIn, double* rgbOut,\n                            double threshold = .5,\n                            const std::string& lightColor = \"white\",\n                            const std::string& darkColor = \"black\");\n\nvoid ViewportBorder(vtkRenderer* renderer, double* color, bool last = false);\n\nvoid RandomHSV(double hsv[3], double const& min_r, double const& max_r,\n               vtkMinimalStandardRandomSequence* rng);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // For testing\n  vtkNew<vtkMinimalStandardRandomSequence> rng;\n  rng->SetSeed(8775070);\n  // rng->SetSeed(0);\n  // rng->SetSeed(4355412);\n\n  double threshold = .5;\n  std::string lightColor = \"white\";\n  std::string darkColor = \"black\";\n  if (argc > 1)\n  {\n    threshold = atof(argv[1]);\n  }\n  if (argc > 2)\n  {\n    lightColor = argv[2];\n  }\n  if (argc > 3)\n  {\n    darkColor = argv[3];\n  }\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  unsigned int xGridDimensions = 10;\n  unsigned int yGridDimensions = 10;\n  auto min_r = 0.0;\n  auto max_r = 1.0;\n  for (auto i = 0; i < static_cast<int>(xGridDimensions * yGridDimensions); ++i)\n  {\n    // Create textActors\n    vtkNew<vtkTextActor> textActor;\n    textActor->GetTextProperty()->SetJustificationToCentered();\n    textActor->GetTextProperty()->SetVerticalJustificationToCentered();\n    textActor->SetInput(\"Text\");\n    textActor->SetPosition(50, 50);\n    textActor->GetTextProperty()->BoldOff();\n    textActor->GetTextProperty()->SetFontSize(20);\n\n    // Setup renderer\n    vtkNew<vtkRenderer> renderer;\n    renderer->AddActor(textActor);\n    double hsv[3];\n    RandomHSV(hsv, min_r, max_r, rng);\n    double rgb[3];\n    vtkMath::HSVToRGB(hsv, rgb);\n    renderer->SetBackground(rgb);\n    // Compute a good color for text on the renderer background\n    ChooseContrastingColor(renderer->GetBackground(), rgb, threshold,\n                           lightColor, darkColor);\n    textActor->GetTextProperty()->SetColor(rgb);\n    renderers.push_back(renderer);\n    renderWindow->AddRenderer(renderer);\n  }\n\n  // Setup viewports for the renderers\n  int rendererSize = 100;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  renderWindow->SetWindowName(\"ChooseTextColorDemo\");\n\n  for (auto row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (auto col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      auto index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {static_cast<double>(col) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - (row + 1)) *\n                                rendererSize / (yGridDimensions * rendererSize),\n                            static_cast<double>(col + 1) * rendererSize /\n                                (xGridDimensions * rendererSize),\n                            static_cast<double>(yGridDimensions - row) *\n                                rendererSize /\n                                (yGridDimensions * rendererSize)};\n      renderers[index]->SetViewport(viewport);\n      ViewportBorder(renderers[index], colors->GetColor3d(\"White\").GetData(),\n                     col == static_cast<int>(xGridDimensions));\n    }\n  }\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// draw the borders of a renderer's viewport\nvoid ViewportBorder(vtkRenderer* renderer, double* color, bool last)\n{\n  // Points start at upper right and proceed anti-clockwise\n  vtkNew<vtkPoints> points;\n  points->SetNumberOfPoints(4);\n  points->InsertPoint(0, 1, 1, 0);\n  points->InsertPoint(1, 0, 1, 0);\n  points->InsertPoint(2, 0, 0, 0);\n  points->InsertPoint(3, 1, 0, 0);\n\n  // create cells, and lines\n  vtkNew<vtkCellArray> cells;\n  cells->Initialize();\n\n  vtkNew<vtkPolyLine> lines;\n\n  // Only draw the last line if this is the last viewport.\n  // This prevents double vertical lines at the right border.\n  // If different colors are used for each border, then do\n  // not specify last.\n  if (last)\n  {\n    lines->GetPointIds()->SetNumberOfIds(5);\n  }\n  else\n  {\n    lines->GetPointIds()->SetNumberOfIds(4);\n  }\n  for (unsigned int i = 0; i < 4; ++i)\n  {\n    lines->GetPointIds()->SetId(i, i);\n  }\n  if (last)\n  {\n    lines->GetPointIds()->SetId(4, 0);\n  }\n  cells->InsertNextCell(lines);\n\n  // Now make the polydata and display it.\n  vtkNew<vtkPolyData> poly;\n  poly->Initialize();\n  poly->SetPoints(points);\n  poly->SetLines(cells);\n\n  // Use normalized viewport coordinates since\n  // they are independent of window size.\n  vtkNew<vtkCoordinate> coordinate;\n  coordinate->SetCoordinateSystemToNormalizedViewport();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(poly);\n  mapper->SetTransformCoordinate(coordinate);\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(color);\n  // line width should be at least 2 to be visible at extremes.\n\n  actor->GetProperty()->SetLineWidth(4.0); // Line Width\n\n  renderer->AddViewProp(actor);\n}\n\nvoid ChooseContrastingColor(double* rgbIn, double* rgbOut, double threshold,\n                            const std::string& lightColor,\n                            const std::string& darkColor)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  double hsv[3];\n  // If the value is <= threshold, use a light color, otherwise use a dark\n  // color.\n  vtkMath::RGBToHSV(rgbIn, hsv);\n  if (hsv[2] <= threshold)\n  {\n    colors->GetColor(lightColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n  else\n  {\n    colors->GetColor(darkColor.c_str(), rgbOut[0], rgbOut[1], rgbOut[2]);\n  }\n}\n\nvoid RandomHSV(double hsv[3], double const& min_r, double const& max_r,\n               vtkMinimalStandardRandomSequence* rng)\n{\n  for (auto i = 0; i < 3; ++i)\n  {\n    hsv[i] = rng->GetRangeValue(min_r, max_r);\n    rng->Next();\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/ChooseTextColorDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ChooseTextColorDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ChooseTextColorDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ChooseTextColorDemo MACOSX_BUNDLE ChooseTextColorDemo.cxx )\n  target_link_libraries(ChooseTextColorDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ChooseTextColorDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ChooseTextColorDemo/#download-and-build-choosetextcolordemo","title":"Download and Build ChooseTextColorDemo","text":"

        Click here to download ChooseTextColorDemo and its CMakeLists.txt file. Once the tarball ChooseTextColorDemo.tar has been downloaded and extracted,

        cd ChooseTextColorDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ChooseTextColorDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ClipArt/","title":"ClipArt","text":"

        vtk-examples/Cxx/Visualization/ClipArt

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ClipArt/#description","title":"Description","text":"

        This is an adaptation of the VTK test clipArt.tcl. Provide a jpg file with 2D clipart and the example will create 3D polydata model. The examples illustrates a number of VTK classes including vtkImageThreshold, vtkImageSeedConnectivity, vtkDecimatePro and vtkClipPolyData.

        The example assumes that the image has a white background. Try it with this src/Testing/Data/stormy.jpg.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ClipArt/#code","title":"Code","text":"

        ClipArt.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkDecimatePro.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageRGBToHSV.h>\n#include <vtkImageSeedConnectivity.h>\n#include <vtkImageShrink3D.h>\n#include <vtkImageThreshold.h>\n#include <vtkJPEGReader.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n#include <vtkTextureMapToPlane.h>\n#include <vtkTriangleFilter.h>\n\n#include <vtkInformation.h>\n#include <vtkStreamingDemandDrivenPipeline.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" Filename(.jpg) e.g. stormy.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkJPEGReader> imageIn;\n  imageIn->SetFileName(argv[1]);\n\n  // Convert the image to hsv so that we can threshold on value.\n  vtkNew<vtkImageRGBToHSV> toHSV;\n  toHSV->SetInputConnection(imageIn->GetOutputPort());\n\n  // Just work with the value\n  vtkNew<vtkImageExtractComponents> extractImage;\n  extractImage->SetInputConnection(toHSV->GetOutputPort());\n  extractImage->SetComponents(2);\n\n  // Threshold to a black/white image.\n  vtkNew<vtkImageThreshold> threshold1;\n  threshold1->SetInputConnection(extractImage->GetOutputPort());\n  threshold1->ThresholdByUpper(230);\n  threshold1->SetInValue(255);\n  threshold1->SetOutValue(0);\n  threshold1->Update();\n\n  // Place a seed in each corner and label connected pixels with 255.\n  threshold1->UpdateInformation();\n\n  int* extent = threshold1->GetOutputInformation(0)->Get(\n      vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());\n  vtkNew<vtkImageSeedConnectivity> connect;\n  connect->SetInputConnection(threshold1->GetOutputPort());\n  connect->SetInputConnectValue(255);\n  connect->SetOutputConnectedValue(255);\n  connect->SetOutputUnconnectedValue(0);\n  connect->AddSeed(extent[0], extent[2]);\n  connect->AddSeed(extent[1], extent[2]);\n  connect->AddSeed(extent[1], extent[3]);\n  connect->AddSeed(extent[0], extent[3]);\n\n  // Smooth a little before clipping.\n  vtkNew<vtkImageGaussianSmooth> smooth;\n  smooth->SetDimensionality(2);\n  smooth->SetStandardDeviation(1.0, 1.0);\n  smooth->SetInputConnection(connect->GetOutputPort());\n\n  vtkNew<vtkImageShrink3D> shrink;\n  shrink->SetInputConnection(smooth->GetOutputPort());\n  shrink->SetShrinkFactors(1, 1, 1);\n  shrink->AveragingOn();\n\n  // Convert the image to polydata.\n  vtkNew<vtkImageDataGeometryFilter> geometry;\n  geometry->SetInputConnection(shrink->GetOutputPort());\n\n  // Create texture coordinates\n  vtkNew<vtkTextureMapToPlane> geometryTexture;\n  geometryTexture->SetInputConnection(geometry->GetOutputPort());\n  geometryTexture->SetOrigin(0, 0, 0);\n  geometryTexture->SetPoint1(extent[1], 0, 0);\n  geometryTexture->SetPoint2(0, extent[3], 0);\n\n  // Clip the geometry.\n  vtkNew<vtkClipPolyData> clip;\n  clip->SetInputConnection(geometryTexture->GetOutputPort());\n  clip->SetValue(5.5);\n  clip->GenerateClipScalarsOff();\n  clip->InsideOutOff();\n  clip->InsideOutOn();\n\n  vtkNew<vtkTriangleFilter> triangles;\n  triangles->SetInputConnection(clip->GetOutputPort());\n\n  vtkNew<vtkDecimatePro> decimate;\n  decimate->SetInputConnection(triangles->GetOutputPort());\n  decimate->BoundaryVertexDeletionOn();\n  decimate->SetDegree(100);\n  decimate->PreserveTopologyOn();\n  decimate->SetTargetReduction(.99);\n\n  vtkNew<vtkLinearExtrusionFilter> extrude;\n  extrude->SetInputConnection(decimate->GetOutputPort());\n  extrude->SetExtrusionTypeToNormalExtrusion();\n  extrude->SetScaleFactor(-10);\n\n  vtkNew<vtkPolyDataMapper> map;\n  map->SetInputConnection(extrude->GetOutputPort());\n  map->ScalarVisibilityOff();\n\n  vtkNew<vtkTexture> imageTexture;\n  imageTexture->InterpolateOn();\n  imageTexture->SetInputConnection(imageIn->GetOutputPort());\n\n  vtkNew<vtkActor> clipart;\n  clipart->SetMapper(map);\n  clipart->SetTexture(imageTexture);\n\n  // Create the RenderWindow, Renderer and Interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ClipArt\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(clipart);\n\n  // Create a nice view.\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  renderer->SetBackground(0.2, 0.3, 0.4);\n  renderWindow->SetSize(320, 256);\n\n  interactor->Initialize();\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ClipArt/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipArt)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonExecutionModel\n  FiltersCore\n  FiltersGeometry\n  FiltersModeling\n  FiltersTexture\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingGeneral\n  ImagingMorphological\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipArt: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipArt MACOSX_BUNDLE ClipArt.cxx )\n  target_link_libraries(ClipArt PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipArt\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ClipArt/#download-and-build-clipart","title":"Download and Build ClipArt","text":"

        Click here to download ClipArt and its CMakeLists.txt file. Once the tarball ClipArt.tar has been downloaded and extracted,

        cd ClipArt/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClipArt\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CloseWindow/","title":"CloseWindow","text":"

        vtk-examples/Cxx/Visualization/CloseWindow

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CloseWindow/#code","title":"Code","text":"

        CloseWindow.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject* caller, long unsigned int eventId,\n                              void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCallbackCommand> keypressCallback;\n  keypressCallback->SetCallback(KeypressCallbackFunction);\n  renderWindowInteractor->AddObserver(vtkCommand::KeyPressEvent,\n                                      keypressCallback);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"First Window\");\n  renderWindowInteractor->Start();\n\n  std::cout << \"Window 1 closed...\" << std::endl;\n\n  // Make another interactor, but use the same render window.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor2;\n  renderWindowInteractor2->AddObserver(vtkCommand::KeyPressEvent,\n                                       keypressCallback);\n\n  // Note: We can change actor and background colors for the second window.\n  actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BlanchedAlmond\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderWindowInteractor2->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"Second Window\");\n\n  renderWindowInteractor2->Start();\n  std::cout << \"Window 2 closed. Exiting...\" << std::endl;\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid KeypressCallbackFunction(vtkObject* caller,\n                              long unsigned int vtkNotUsed(eventId),\n                              void* vtkNotUsed(clientData),\n                              void* vtkNotUsed(callData))\n{\n\n  auto iren = static_cast<vtkRenderWindowInteractor*>(caller);\n  // Close the window.\n  iren->GetRenderWindow()->Finalize();\n\n  // Stop the interactor.\n  iren->TerminateApp();\n  std::cout << \"Closing window...\" << std::endl;\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/CloseWindow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CloseWindow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CloseWindow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CloseWindow MACOSX_BUNDLE CloseWindow.cxx )\n  target_link_libraries(CloseWindow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CloseWindow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CloseWindow/#download-and-build-closewindow","title":"Download and Build CloseWindow","text":"

        Click here to download CloseWindow and its CMakeLists.txt file. Once the tarball CloseWindow.tar has been downloaded and extracted,

        cd CloseWindow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CloseWindow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CollisionDetection/","title":"CollisionDetection","text":"

        vtk-examples/Cxx/Visualization/CollisionDetection

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/CollisionDetection/#description","title":"Description","text":"

        This examples uses vtkCollisionDetectionFilter to find the intersection between a fixed (solid white) and moving (red wireframe) sphere. The animation places the moving sphere some distance from the fixed sphere and moves the moving sphere until it contacts the fixed sphere.

        Three collision modes are available and can be set as the first argument on the command line.

        1. All contacts (0) finds all the contacting cell pairs with two points per collision.
        2. First contact (1) quickly find the first contact point.
        3. Half contacts (2) finds all the contacting cell pairs with one points per collision.

        The animation pauses between each frame. The total animation should be 3 seconds.

        Three videos on the VTK Examples Project youtube playlist show each of the collision modes.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CollisionDetection/#code","title":"Code","text":"

        CollisionDetection.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCollisionDetectionFilter.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n\n#include <sstream>\n#include <thread>\n\nint main(int argc, char* argv[])\n{\n  int contactMode = 0;\n  if (argc > 1)\n  {\n    contactMode = std::stoi(std::string(argv[1]));\n  }\n  vtkNew<vtkSphereSource> sphere0;\n  sphere0->SetRadius(0.29);\n  sphere0->SetPhiResolution(31);\n  sphere0->SetThetaResolution(31);\n  sphere0->SetCenter(0.0, 0, 0);\n\n  vtkNew<vtkSphereSource> sphere1;\n  sphere1->SetPhiResolution(30);\n  sphere1->SetThetaResolution(30);\n  sphere1->SetRadius(0.3);\n\n  vtkNew<vtkMatrix4x4> matrix1;\n  vtkNew<vtkTransform> transform0;\n\n  vtkNew<vtkCollisionDetectionFilter> collide;\n  collide->SetInputConnection(0, sphere0->GetOutputPort());\n  collide->SetTransform(0, transform0);\n  collide->SetInputConnection(1, sphere1->GetOutputPort());\n  collide->SetMatrix(1, matrix1);\n  collide->SetBoxTolerance(0.0);\n  collide->SetCellTolerance(0.0);\n  collide->SetNumberOfCellsPerNode(2);\n  if (contactMode == 0)\n  {\n    collide->SetCollisionModeToAllContacts();\n  }\n  else if (contactMode == 1)\n  {\n    collide->SetCollisionModeToFirstContact();\n  }\n  else\n  {\n    collide->SetCollisionModeToHalfContacts();\n  }\n  collide->GenerateScalarsOn();\n\n  // Visualize\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(collide->GetOutputPort(0));\n  mapper1->ScalarVisibilityOff();\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->BackfaceCullingOn();\n  actor1->SetUserTransform(transform0);\n  actor1->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  actor1->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(collide->GetOutputPort(1));\n\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->BackfaceCullingOn();\n  actor2->SetUserMatrix(matrix1);\n\n  vtkNew<vtkPolyDataMapper> mapper3;\n  mapper3->SetInputConnection(collide->GetContactsOutputPort());\n  mapper3->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> actor3;\n  actor3->SetMapper(mapper3);\n  actor3->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  actor3->GetProperty()->SetLineWidth(3.0);\n\n  vtkNew<vtkTextActor> txt;\n  txt->GetTextProperty()->SetFontSize(18);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->AddActor(actor3);\n  renderer->AddActor(txt);\n  renderer->SetBackground(colors->GetColor3d(\"Gray\").GetData());\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(640, 480);\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Move the first object\n  int numSteps = 100;\n  double dx = 1.0 / static_cast<double>(numSteps) * 2.0;\n  transform0->Translate(-numSteps * dx - .3, 0.0, 0.0);\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Azimuth(-60);\n  renderer->GetActiveCamera()->Elevation(45);\n  renderer->GetActiveCamera()->Dolly(1.2);\n\n  renderWindow->SetWindowName(\"CollisionDetection\");\n  renderWindow->Render();\n\n  for (int i = 0; i < numSteps; ++i)\n  {\n    transform0->Translate(dx, 0.0, 0.0);\n    renderer->ResetCameraClippingRange();\n    std::ostringstream textStream;\n    textStream << collide->GetCollisionModeAsString()\n               << \": Number of contact cells is \"\n               << collide->GetNumberOfContacts();\n    txt->SetInput(textStream.str().c_str());\n    renderWindow->Render();\n    if (collide->GetNumberOfContacts() > 0)\n    {\n      break;\n    }\n    // The total animation time is 3 seconds.\n    std::this_thread::sleep_for(std::chrono::milliseconds(3000 / numSteps));\n  }\n  renderer->ResetCamera();\n  renderWindow->Render();\n  interactor->Start();\n  // In Field Data there will be an array named \"ContactCells\".\n  // This array indexes contacting cells (e.g.) index 50 of array 0\n  //  points to a cell (triangle) which contacts/intersects a cell\n  //  at index 50 of array 1.\n  // You can directly obtain these, see GetContactCells(int i)\n  //  in the documentation.\n  // collide->GetOutput(0)->Print(std::cout);\n  // collide->GetOutput(1)->Print(std::cout);\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/CollisionDetection/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CollisionDetection)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonMath\n  CommonTransforms\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CollisionDetection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CollisionDetection MACOSX_BUNDLE CollisionDetection.cxx )\n  target_link_libraries(CollisionDetection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CollisionDetection\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CollisionDetection/#download-and-build-collisiondetection","title":"Download and Build CollisionDetection","text":"

        Click here to download CollisionDetection and its CMakeLists.txt file. Once the tarball CollisionDetection.tar has been downloaded and extracted,

        cd CollisionDetection/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CollisionDetection\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ColorActorEdges/","title":"ColorActorEdges","text":"

        vtk-examples/Cxx/Visualization/ColorActorEdges

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ColorActorEdges/#description","title":"Description","text":"

        This example colors the edges of a actor.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ColorActorEdges/#code","title":"Code","text":"

        ColorActorEdges.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  // Flat shading\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  // Set the color for edges of the sphere.\n  actor->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Red\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColorActorEdges\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ColorActorEdges/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorActorEdges)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorActorEdges: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorActorEdges MACOSX_BUNDLE ColorActorEdges.cxx )\n  target_link_libraries(ColorActorEdges PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorActorEdges\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ColorActorEdges/#download-and-build-coloractoredges","title":"Download and Build ColorActorEdges","text":"

        Click here to download ColorActorEdges and its CMakeLists.txt file. Once the tarball ColorActorEdges.tar has been downloaded and extracted,

        cd ColorActorEdges/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorActorEdges\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ColorAnActor/","title":"ColorAnActor","text":"

        vtk-examples/Cxx/Visualization/ColorAnActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ColorAnActor/#description","title":"Description","text":"

        This example creates a red sphere.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ColorAnActor/#code","title":"Code","text":"

        ColorAnActor.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Set the color of the sphere\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Bisque\").GetData());\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColorAnActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Navy\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ColorAnActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorAnActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorAnActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorAnActor MACOSX_BUNDLE ColorAnActor.cxx )\n  target_link_libraries(ColorAnActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorAnActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ColorAnActor/#download-and-build-coloranactor","title":"Download and Build ColorAnActor","text":"

        Click here to download ColorAnActor and its CMakeLists.txt file. Once the tarball ColorAnActor.tar has been downloaded and extracted,

        cd ColorAnActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorAnActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ColorGlyphs/","title":"ColorGlyphs","text":"

        vtk-examples/Cxx/Visualization/ColorGlyphs

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ColorGlyphs/#description","title":"Description","text":"

        This example creates a red, green, and blue cube.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ColorGlyphs/#code","title":"Code","text":"

        ColorGlyphs.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n\n// For compatibility with new VTK generic data arrays.\n#ifdef vtkGenericDataArray_h\n#define InsertNextTupleValue InsertNextTypedTuple\n#endif\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> nc;\n\n  // Create points\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(5, 0, 0);\n  points->InsertNextPoint(10, 0, 0);\n\n  // Setup scales. This can also be an Int array\n  // char is used since it takes the least memory\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetName(\"colors\");\n  colors->SetNumberOfComponents(3);\n  unsigned char r[3] = {255, 0, 0};\n  unsigned char g[3] = {0, 255, 0};\n  unsigned char b[3] = {0, 0, 255};\n  colors->InsertNextTupleValue(r);\n  colors->InsertNextTupleValue(g);\n  colors->InsertNextTupleValue(b);\n\n  // Combine into a polydata\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->SetScalars(colors);\n\n  // Create anything you want here, we will use a cube for the demo.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetColorModeToColorByScalar();\n  glyph3D->SetSourceConnection(cubeSource->GetOutputPort());\n  glyph3D->SetInputData(polydata);\n  glyph3D->ScalingOff();\n  glyph3D->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph3D->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ColorGlyphs\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(nc->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Elevation(20);\n  renderer->GetActiveCamera()->Azimuth(10);\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ColorGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorGlyphs MACOSX_BUNDLE ColorGlyphs.cxx )\n  target_link_libraries(ColorGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ColorGlyphs/#download-and-build-colorglyphs","title":"Download and Build ColorGlyphs","text":"

        Click here to download ColorGlyphs and its CMakeLists.txt file. Once the tarball ColorGlyphs.tar has been downloaded and extracted,

        cd ColorGlyphs/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorGlyphs\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ColorSeriesPatches/","title":"ColorSeriesPatches","text":"

        vtk-examples/Cxx/Visualization/ColorSeriesPatches

        "},{"location":"Cxx/Visualization/ColorSeriesPatches/#description","title":"Description","text":"

        This example shows how to produce a HTML page called VTKColorSeriesPatches showing the available colors series in vtkColorSeries.

        It also shows how to select the text color based on luminance. In this case, Digital CCIR601 is used, which gives less weight to the red and blue components of a color.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ColorSeriesPatches/#code","title":"Code","text":"

        ColorSeriesPatches.cxx

        /*\n * Produce a HTML page called VTKColorSeriesPatches.html showing the available\n * color series in vtkColorSeries.\n *\n * It also shows how to select the text color based on luminance.\n * In this case Digital CCIR601 is used which gives less weight to the red and\n * blue components of a color.\n *\n */\n\n#include <vtkColorSeries.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n\n#include <algorithm>\n#include <cstdlib>\n#include <fstream>\n#include <iostream>\n#include <map>\n#include <regex>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n\n//! Convert to and from HTML color strings.\nclass HTMLToFromRGBAColor\n{\npublic:\n  HTMLToFromRGBAColor() = default;\n  virtual ~HTMLToFromRGBAColor() = default;\n\npublic:\n  bool IsValidHTMLColorString(std::string const& s);\n  std::string RGBToHTMLColor(vtkColor3ub const& rgb);\n  vtkColor3ub HTMLColorToRGB(std::string const& colorString);\n  double RGBToLumaCCIR601(vtkColor3ub const& rgb);\n};\n\n/**\n * Holds the color series id, name and colors.\n */\nclass ColorStructures\n{\npublic:\n  ColorStructures() : max_colors(0)\n  {\n    this->Init();\n  }\n\n  virtual ~ColorStructures() = default;\n\nprivate:\n  void Init();\n\npublic:\n  std::map<int, std::pair<std::string, std::vector<vtkColor3ub>>> cs_colors;\n  int max_colors;\n};\n\n/**\n * This class creates a HTML Table displaying all the colors in\n * the class vtkColorSeries.\n */\nclass HTMLTableMaker\n{\n\npublic:\n  HTMLTableMaker() = default;\n\n  ~HTMLTableMaker() = default;\n\npublic:\n  std::string MakeHTMLTable();\n\nprivate:\n  std::string MakeHTMLStyle();\n  std::string MakeHTMLHeader();\n  std::string MakeTableHeader();\n  std::string MakeTD1(int const idx, std::string const& name);\n  std::string MakeTD2(std::vector<vtkColor3ub> const& rgb);\n  std::string MakeTable();\n\nprivate:\n  vtkNew<vtkNamedColors> nc;\n  ColorStructures cs = ColorStructures();\n  HTMLToFromRGBAColor htmlRGBA = HTMLToFromRGBAColor();\n};\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  HTMLTableMaker ncpt;\n\n  std::ofstream outputFile;\n  outputFile.open(\"VTKColorSeriesPatches.html\",\n                  ios::out | ios::trunc | ios::binary);\n  outputFile << ncpt.MakeHTMLTable();\n  outputFile.close();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nbool HTMLToFromRGBAColor::IsValidHTMLColorString(std::string const& s)\n{\n  if (s.size() == 7 || s.size() == 9) // #rrggbb or #rrggbbaa\n  {\n    if (s.compare(0, 1, \"#\") == 0 &&\n        s.find_first_not_of(\"0123456789abcdefABCDEF\", 1) == std::string::npos)\n    {\n      return true;\n    }\n  }\n  return false;\n}\n\nstd::string HTMLToFromRGBAColor::RGBToHTMLColor(vtkColor3ub const& rgb)\n{\n  std::string s = \"#\";\n  std::ostringstream os;\n  os << std::setfill('0') << std::hex << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetRed()) << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetGreen()) << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetBlue());\n  s += os.str();\n  return s;\n}\n\nvtkColor3ub HTMLToFromRGBAColor::HTMLColorToRGB(std::string const& colorString)\n{\n  vtkColor3ub c(0, 0, 0);\n  if (IsValidHTMLColorString(colorString) && colorString.size() == 7)\n  {\n    auto i = 1;\n    while (i < static_cast<int>(colorString.size()))\n    {\n      std::istringstream is(colorString.substr(i, 2));\n      int x;\n      is >> std::hex >> x;\n      c[(i - 1) / 2] = x;\n      i += 2;\n    }\n  }\n  return c;\n}\n\ndouble HTMLToFromRGBAColor::RGBToLumaCCIR601(vtkColor3ub const& rgb)\n{\n  return 0.299 * rgb.GetRed() + 0.587 * rgb.GetGreen() + 0.114 * rgb.GetBlue();\n}\n\nvoid ColorStructures::Init()\n{\n  auto cs = vtkColorSeries::New();\n  std::vector<int> sizes;\n  for (auto i = 0; i < cs->GetNumberOfColorSchemes(); ++i)\n  {\n    cs->SetColorScheme(i);\n    sizes.push_back(cs->GetNumberOfColors());\n    std::vector<vtkColor3ub> vc;\n    for (auto j = 0; j < cs->GetNumberOfColors(); ++j)\n    {\n      vc.push_back(cs->GetColor(j));\n    }\n    this->cs_colors[i] = std::pair<std::string, std::vector<vtkColor3ub>>(\n        cs->GetColorSchemeName(), vc);\n  }\n  this->max_colors = *std::max_element(sizes.begin(), sizes.end());\n}\n\nstd::string HTMLTableMaker::MakeHTMLStyle()\n{\n  std::string s = \"  <style>\\n\";\n  s += \"\\n\";\n  s += \"  body {\\n\";\n  s += \"    background-color: snow\\n\";\n  s += \"  }\\n\";\n  s += \"  h1 {text-align:left;}\\n\";\n  s += \"  h2 {text-align:left;}\\n\";\n  s += \"  h3 {text-align:left;}\\n\";\n  s += \"  h4 {text-align:left;}\\n\";\n  s += \"  h5 {text-align:left;}\\n\";\n  s += \"  h6 {text-align:left;}\\n\";\n  s += \"\\n\";\n  s += \"  p {text-align:left;}\\n\";\n  s += \"\\n\";\n  s += \"  table {\\n\";\n  s += \"    font-family: arial, sans-serif;\\n\";\n  s += \"    border-collapse: collapse;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"    padding: 4px;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  th {\\n\";\n  s += \"    background: LightSteelBlue;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  th[colspan]:not([colspan=\\\"1\\\"]) {\\n\";\n  s += \"    background: LightSteelBlue;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"    text-align : center;\\n\";\n  s += \"    vertical-align : top;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  tr {\\n\";\n  s += \"    background: MintCream;\\n\";\n  s += \"    vertical-align : top;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  td {\\n\";\n  s += \"    background: MintCream;\\n\";\n  s += \"    border: 1px solid #dddddd;\\n\";\n  s += \"    text-align: left;\\n\";\n  s += \"    padding: 8px;\\n\";\n  s += \"    font-family: monospace;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"    font-weight: bold;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  td[colspan]:not([colspan=\\\"1\\\"]) {\\n\";\n  s += \"    text-align : center;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  .cour {\\n\";\n  s += \"    font-family: Courier;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  html, body {\\n\";\n  s += \"    height: 100%;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  html {\\n\";\n  s += \"    display: table;\\n\";\n  s += \"    margin: auto;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  body {\\n\";\n  s += \"    display: table-cell;\\n\";\n  s += \"    vertical-align: middle;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  thead {color: DarkGreen;}\\n\";\n  s += \"  tbody {color: MidnightBlue;}\\n\";\n  s += \"  tfoot {color: SaddleBrown;}\\n\";\n  s += \"\\n\";\n  s += \"  </style>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeHTMLHeader()\n{\n  std::string s = \"<!DOCTYPE html>\\n\";\n  s += \"<html lang=\\\"en\\\">\\n\";\n  s += \"<head>\\n\";\n  s += \"<meta charset=\\\"UTF-8\\\" />\\n\";\n  s += \"<title>vtkColorSeries</title>\\n\";\n  s += this->MakeHTMLStyle();\n  s += \"</head>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTableHeader()\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<th>Index</th>\\n\";\n  s +=\n      \"<th colspan=\\\"\" + std::to_string(this->cs.max_colors) + \"\\\">Name</th>\\n\";\n  s += \"</tr>\\n\";\n  s += \"<tr>\\n\";\n  s += \"<th></th>\\n\";\n  s += \"<th colspan=\\\"\" + std::to_string(this->cs.max_colors) +\n      \"\\\">Colors in the Series</th>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTD1(int const idx, std::string const& name)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<td>\";\n  s += \"<b>\" + std::to_string(idx) + \"</b>\";\n  s += \"</td>\\n\";\n\n  s += \"<td colspan=\\\"\" + std::to_string(this->cs.max_colors) + \"\\\">\";\n  s += \"<b>\" + name + \"</b>\";\n  s += \"</td>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\nstd::string HTMLTableMaker::MakeTD2(std::vector<vtkColor3ub> const& rgbs)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<td></td>\\n\";\n\n  auto cnt = 0;\n  for (auto p : rgbs)\n  {\n    std::ostringstream os;\n    os << std::setw(3) << cnt << \"&#160;&#160;\";\n    auto ss = std::regex_replace(os.str(), std::regex(\" \"), \"&#160;\");\n    auto y = this->htmlRGBA.RGBToLumaCCIR601(p);\n    std::string textColor{\"#000000\"}; // Black\n    if (y < 255 / 2.0)\n    {\n      textColor = \"#ffffff\"; // White\n    }\n    s += \"<td style=\\\"background:\" + this->htmlRGBA.RGBToHTMLColor(p) +\n        \";color:\" + textColor;\n    s += \"\\\">\" + ss + \"</td>\\n\";\n    ++cnt;\n  }\n  if (cnt < this->cs.max_colors)\n  {\n    s += \"<td colspan=\\\"\" + std::to_string(this->cs.max_colors - cnt) +\n        \"\\\"> &#160; </td>\\n\";\n  }\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTable()\n{\n  auto res = this->MakeTableHeader();\n  for (auto const& p : this->cs.cs_colors)\n  {\n    auto idx = p.first;\n    auto name = p.second.first;\n    res += this->MakeTD1(idx, name);\n    res += this->MakeTD2(p.second.second);\n  }\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeHTMLTable()\n{\n  auto res = this->MakeHTMLHeader();\n  res += \"<body>\\n\";\n  res += \"<h1>Color series available in vtkColorSeries</h1>\\n\";\n  res += \"<table>\\n\";\n  res += this->MakeTable();\n  res += \"</table>\\n\";\n  res += \"</body>\\n\";\n  return res;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/ColorSeriesPatches/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorSeriesPatches)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorSeriesPatches: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorSeriesPatches MACOSX_BUNDLE ColorSeriesPatches.cxx )\n  target_link_libraries(ColorSeriesPatches PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorSeriesPatches\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ColorSeriesPatches/#download-and-build-colorseriespatches","title":"Download and Build ColorSeriesPatches","text":"

        Click here to download ColorSeriesPatches and its CMakeLists.txt file. Once the tarball ColorSeriesPatches.tar has been downloaded and extracted,

        cd ColorSeriesPatches/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorSeriesPatches\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ColoredAnnotatedCube/","title":"ColoredAnnotatedCube","text":"

        vtk-examples/Cxx/Visualization/ColoredAnnotatedCube

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ColoredAnnotatedCube/#description","title":"Description","text":"

        This example demonstrates how to color the individual faces of an annotated cube.

        This is based on a very nice example by Rodrigo Figueiredo in this discussion.

        The process is:

        • Create the annotated cube actor using vtkAnnotatedCubeActor.
        • Select the names on the faces, text colors and, if needed, any rotations of the text.
        • Make the annotated cube transparent.
        • Create a cube actor with colored faces.
        • Combine the annotated cube actor and cube actor into a prop assembly using vtkPropAssembly. Since the annotated cube and the cube are the same size you get an assembly with colored cube faces and the requisite text.
        • Create a vtkOrientationMarkerWidget and set the set the orientation marker to be the prop assembly.

        The function MakeAnnotatedCubeActor generates the annotated cube with different colored faces which is then added to a vtkOrientationMarkerWidget.

        The colored annotated cube is then placed in the lower left of the view (default). Additionally, a vtkOrientationMarkerWidget containing an axes actor has been added to the lower right of the view.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ColoredAnnotatedCube/#code","title":"Code","text":"

        ColoredAnnotatedCube.cxx

        #include <vtkAnnotatedCubeActor.h>\n#include <vtkAxesActor.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkCamera.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkCellData.h>\n#include <vtkColorSeries.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkElevationFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPropAssembly.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <array>\n\nnamespace {\n/**\n * Nake the annotated cube actor with different colored faces.\n *\n * @param colors: Used to set the colors of the cube faces.\n * @return The annotated cube actor.\n */\nvtkSmartPointer<vtkPropAssembly> MakeAnnotatedCubeActor(vtkNamedColors* colors);\n\n/**\n * Make an axes actor.\n *\n * @param scale: Sets the scale and direction of the axes.\n * @param xyzLabels: Labels for the axes.\n * @return The axes actor.\n */\nvtkSmartPointer<vtkAxesActor>\nMakeAxesActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels);\n\n} // namespace\n\nint main(int, char*[])\n{\n  // Basic stuff setup\n  // Set up the renderer, window, and interactor.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetSize(640, 480);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Create a cone with an elliptical base whose major axis is in the\n  // X-direction.\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetCenter(0.0, 0.0, 0.0);\n  coneSource->SetRadius(5.0);\n  coneSource->SetHeight(15.0);\n  coneSource->SetDirection(0, 1, 0);\n  coneSource->SetResolution(60);\n  coneSource->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Scale(1.0, 1.0, 0.75);\n\n  vtkNew<vtkTransformPolyDataFilter> transF;\n  transF->SetInputConnection(coneSource->GetOutputPort());\n  transF->SetTransform(transform);\n\n  double bounds[6];\n  transF->GetOutput()->GetBounds(bounds);\n\n  vtkNew<vtkElevationFilter> elevation;\n  elevation->SetInputConnection(transF->GetOutputPort());\n  elevation->SetLowPoint(0, bounds[2], 0);\n  elevation->SetHighPoint(0, bounds[3], 0);\n\n  vtkNew<vtkBandedPolyDataContourFilter> bandedContours;\n  bandedContours->SetInputConnection(elevation->GetOutputPort());\n  bandedContours->SetScalarModeToValue();\n  bandedContours->GenerateContourEdgesOn();\n  bandedContours->GenerateValues(11, elevation->GetScalarRange());\n\n  // Make a lookup table using a color series.\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetColorScheme(vtkColorSeries::BREWER_DIVERGING_SPECTRAL_11);\n\n  vtkNew<vtkLookupTable> lut;\n  colorSeries->BuildLookupTable(lut, vtkColorSeries::ORDINAL);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(bandedContours->GetOutputPort());\n  coneMapper->SetScalarRange(elevation->GetScalarRange());\n  coneMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n\n  // Contouring\n  vtkNew<vtkPolyDataMapper> contourLineMapper;\n  contourLineMapper->SetInputData(bandedContours->GetContourEdgesOutput());\n  contourLineMapper->SetScalarRange(elevation->GetScalarRange());\n  contourLineMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> contourLineActor;\n  contourLineActor->SetMapper(contourLineMapper);\n  contourLineActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"DimGray\").GetData());\n\n  // Set up the Orientation Marker Widget.\n  auto prop_assembly = MakeAnnotatedCubeActor(colors);\n  vtkNew<vtkOrientationMarkerWidget> om1;\n  om1->SetOrientationMarker(prop_assembly);\n  om1->SetInteractor(iRen);\n  om1->SetDefaultRenderer(ren);\n  om1->On();\n  om1->InteractiveOn();\n\n  std::array<std::string, 3> xyzLabels{{\"X\", \"Y\", \"Z\"}};\n  std::array<double, 3> scale{{1.0, 1.0, 1.0}};\n  auto axes = MakeAxesActor(scale, xyzLabels);\n\n  vtkNew<vtkOrientationMarkerWidget> om2;\n  om2->SetOrientationMarker(axes);\n  // Position lower right in the viewport.\n  om2->SetViewport(0.8, 0, 1.0, 0.2);\n  om2->SetInteractor(iRen);\n  om2->EnabledOn();\n  om2->InteractiveOn();\n\n  ren->AddActor(coneActor);\n  ren->AddActor(contourLineActor);\n  ren->SetBackground2(colors->GetColor3d(\"RoyalBlue\").GetData());\n  ren->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n  ren->GradientBackgroundOn();\n  ren->GetActiveCamera()->Azimuth(45);\n  ren->GetActiveCamera()->Pitch(-22.5);\n  ren->ResetCamera();\n\n  renWin->SetSize(600, 600);\n  renWin->Render();\n  renWin->SetWindowName(\"ColoredAnnotatedCube\");\n  renWin->Render();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPropAssembly> MakeAnnotatedCubeActor(vtkNamedColors* colors)\n{\n  // Annotated Cube setup.\n  vtkNew<vtkAnnotatedCubeActor> annotated_cube;\n  annotated_cube->SetFaceTextScale(0.366667);\n\n  // Anatomic labeling\n  annotated_cube->SetXPlusFaceText(\"X+\");\n  annotated_cube->SetXMinusFaceText(\"X-\");\n  annotated_cube->SetYPlusFaceText(\"Y+\");\n  annotated_cube->SetYMinusFaceText(\"Y-\");\n  annotated_cube->SetZPlusFaceText(\"Z+\");\n  annotated_cube->SetZMinusFaceText(\"Z-\");\n\n  // Change the vector text colors.\n  annotated_cube->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"Black\").GetData());\n  annotated_cube->GetTextEdgesProperty()->SetLineWidth(1);\n\n  annotated_cube->GetXPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Turquoise\").GetData());\n  annotated_cube->GetXMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Turquoise\").GetData());\n  annotated_cube->GetYPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  annotated_cube->GetYMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Mint\").GetData());\n  annotated_cube->GetZPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  annotated_cube->GetZMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  annotated_cube->SetXFaceTextRotation(90);\n  annotated_cube->SetYFaceTextRotation(180);\n  annotated_cube->SetZFaceTextRotation(-90);\n  // Make the annotated cube transparent.\n  annotated_cube->GetCubeProperty()->SetOpacity(0);\n\n  // Colored faces cube setup.\n  vtkNew<vtkCubeSource> cube_source;\n  cube_source->Update();\n\n  vtkNew<vtkUnsignedCharArray> face_colors;\n  face_colors->SetNumberOfComponents(3);\n  auto face_x_plus = colors->GetColor3ub(\"Red\").GetData();\n  auto face_x_minus = colors->GetColor3ub(\"Green\").GetData();\n  auto face_y_plus = colors->GetColor3ub(\"Blue\").GetData();\n  auto face_y_minus = colors->GetColor3ub(\"Yellow\").GetData();\n  auto face_z_plus = colors->GetColor3ub(\"Cyan\").GetData();\n  auto face_z_minus = colors->GetColor3ub(\"Magenta\").GetData();\n  face_colors->InsertNextTypedTuple(face_x_minus);\n  face_colors->InsertNextTypedTuple(face_x_plus);\n  face_colors->InsertNextTypedTuple(face_y_minus);\n  face_colors->InsertNextTypedTuple(face_y_plus);\n  face_colors->InsertNextTypedTuple(face_z_minus);\n  face_colors->InsertNextTypedTuple(face_z_plus);\n\n  cube_source->GetOutput()->GetCellData()->SetScalars(face_colors);\n  cube_source->Update();\n\n  vtkNew<vtkPolyDataMapper> cube_mapper;\n  cube_mapper->SetInputData(cube_source->GetOutput());\n  cube_mapper->Update();\n\n  vtkNew<vtkActor> cube_actor;\n  cube_actor->SetMapper(cube_mapper);\n\n  // Assemble the colored cube and annotated cube texts into a composite prop.\n  vtkNew<vtkPropAssembly> prop_assembly;\n  prop_assembly->AddPart(annotated_cube);\n  prop_assembly->AddPart(cube_actor);\n  return prop_assembly;\n}\n\nvtkSmartPointer<vtkAxesActor>\nMakeAxesActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels)\n{\n  vtkNew<vtkAxesActor> axes;\n  axes->SetScale(scale[0], scale[1], scale[2]);\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(xyzLabels[0].c_str());\n  axes->SetYAxisLabelText(xyzLabels[1].c_str());\n  axes->SetZAxisLabelText(xyzLabels[2].c_str());\n  axes->SetCylinderRadius(0.5 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.025 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.5 * axes->GetSphereRadius());\n  vtkTextProperty* tprop =\n      axes->GetXAxisCaptionActor2D()->GetCaptionTextProperty();\n  tprop->ItalicOn();\n  tprop->ShadowOn();\n  tprop->SetFontFamilyToTimes();\n  // Use the same text properties on the other two axes.\n  axes->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  axes->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  return axes;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/ColoredAnnotatedCube/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColoredAnnotatedCube)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColoredAnnotatedCube: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColoredAnnotatedCube MACOSX_BUNDLE ColoredAnnotatedCube.cxx )\n  target_link_libraries(ColoredAnnotatedCube PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColoredAnnotatedCube\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ColoredAnnotatedCube/#download-and-build-coloredannotatedcube","title":"Download and Build ColoredAnnotatedCube","text":"

        Click here to download ColoredAnnotatedCube and its CMakeLists.txt file. Once the tarball ColoredAnnotatedCube.tar has been downloaded and extracted,

        cd ColoredAnnotatedCube/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColoredAnnotatedCube\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ComplexV/","title":"ComplexV","text":"

        vtk-examples/Cxx/Visualization/ComplexV

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ComplexV/#description","title":"Description","text":"

        ComplexV from the VTK Textbook. The original example was written in TCL.

        The example shows 167,000 3D vectors (using oriented and scaled lines) in the region of the human carotid artery. The larger vectors lie inside the arteries, the smaller vectors lie outside the arteries and are randomly oriented (measurement error) but small in magnitude. Clearly the details of the vector field are not discernible from this image.

        Info

        See Figure 6-13 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ComplexV/#code","title":"Code","text":"

        ComplexV.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkHedgeHog.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" carotid.vtk\" << std::endl;\n    return EXIT_SUCCESS;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkHedgeHog> hhog;\n  hhog->SetInputConnection(reader->GetOutputPort());\n  hhog->SetScaleFactor(0.3);\n\n  vtkNew<vtkLookupTable> lut;\n  //  lut->SetHueRange(.667, 0.0);\n  lut->Build();\n\n  vtkNew<vtkPolyDataMapper> hhogMapper;\n  hhogMapper->SetInputConnection(hhog->GetOutputPort());\n  hhogMapper->SetScalarRange(50, 550);\n  hhogMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> hhogActor;\n  hhogActor->SetMapper(hhogMapper);\n\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> aRenderWindow;\n  aRenderWindow->AddRenderer(aRenderer);\n\n  vtkNew<vtkRenderWindowInteractor> anInteractor;\n  anInteractor->SetRenderWindow(aRenderWindow);\n  aRenderWindow->SetSize(640, 480);\n  aRenderWindow->SetWindowName(\"ComplexV\");\n\n  aRenderer->AddActor(outlineActor);\n  aRenderer->AddActor(hhogActor);\n\n  aRenderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Generate an interesting view\n\n  aRenderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  aRenderer->GetActiveCamera()->SetPosition(1, 0, 0);\n  aRenderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  aRenderer->ResetCamera();\n\n  aRenderer->GetActiveCamera()->Azimuth(60);\n  aRenderer->GetActiveCamera()->Elevation(30);\n  aRenderer->GetActiveCamera()->Dolly(1.1);\n  aRenderer->ResetCameraClippingRange();\n\n  aRenderWindow->Render();\n\n  // interact with data\n  anInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ComplexV/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ComplexV)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ComplexV: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ComplexV MACOSX_BUNDLE ComplexV.cxx )\n  target_link_libraries(ComplexV PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ComplexV\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ComplexV/#download-and-build-complexv","title":"Download and Build ComplexV","text":"

        Click here to download ComplexV and its CMakeLists.txt file. Once the tarball ComplexV.tar has been downloaded and extracted,

        cd ComplexV/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ComplexV\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CornerAnnotation/","title":"CornerAnnotation","text":"

        vtk-examples/Cxx/Visualization/CornerAnnotation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CornerAnnotation/#code","title":"Code","text":"

        CornerAnnotation.cxx

        #include <vtkActor.h>\n#include <vtkCornerAnnotation.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CornerAnnotation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Annotate the image with window/level and mouse over pixel information.\n  vtkNew<vtkCornerAnnotation> cornerAnnotation;\n  cornerAnnotation->SetLinearFontScaleFactor(2);\n  cornerAnnotation->SetNonlinearFontScaleFactor(1);\n  cornerAnnotation->SetMaximumFontSize(20);\n  cornerAnnotation->SetText(0, \"lower left\");\n  cornerAnnotation->SetText(1, \"lower right\");\n  cornerAnnotation->SetText(2, \"upper left\");\n  cornerAnnotation->SetText(3, \"upper right\");\n  cornerAnnotation->GetTextProperty()->SetColor(\n      colors->GetColor3d(\"Gold\").GetData());\n\n  renderer->AddViewProp(cornerAnnotation);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/CornerAnnotation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CornerAnnotation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CornerAnnotation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CornerAnnotation MACOSX_BUNDLE CornerAnnotation.cxx )\n  target_link_libraries(CornerAnnotation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CornerAnnotation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CornerAnnotation/#download-and-build-cornerannotation","title":"Download and Build CornerAnnotation","text":"

        Click here to download CornerAnnotation and its CMakeLists.txt file. Once the tarball CornerAnnotation.tar has been downloaded and extracted,

        cd CornerAnnotation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CornerAnnotation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/","title":"CorrectlyRenderTranslucentGeometry","text":"

        vtk-examples/Cxx/Visualization/CorrectlyRenderTranslucentGeometry

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/#description","title":"Description","text":"
        • Contributed by: Lars Friedrich

        Correctly rendering translucent geometry with OpenGL-functionality in the background (as in the case of VTK) requires non-intersecting polygons and depth-sorted traversal. In general these requirements are not satisfied as the inherent order of scene traversal is object-based. Using a method, namely depth peeling, presented by NVIDIA in 2001 Interactive Order-Independent Transparency, shadow mapping (multi-pass rendering) in conjunction with alpha test can be consulted to achieve correct blending of the rendered objects in the frame buffer.

        VTK implements this feature since November 2006 as described in the VTK WIKI (Francois Bertel). Unfortunately depth peeling has several OpenGL extension, context and driver requirements (but also runs on Mesa) which restrict the approach's usage to modern GPUs. Usually this feature slows down the rendering process depending on the configuration (occlusion ratio and maximum number of iterative peels).

        However if depth peeling is not available on a certain machine, depth sorting can be accomplished on the CPU using DepthSortPolyData. This is usually much slower than the GPU-implementation and furthermore brings additional restrictions with it (e.g. poly data must be merged within one set).

        This example program generates a set of intersecting (overlapping) spheres that have transparency properties. The program automatically checks whether depth peeling is supported or not. If depth peeling is not supported, CPU-based depth sorting is used. In addition the program tries to determine an average frame rate for the scene.

        The following image shows the spheres arrangement (and view position) and compares the different render modes: no special translucency treatment, CPU depth sorting and GPU depth peeling.

        "},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/#program-usage","title":"Program Usage","text":"
        ./CorrectlyRenderTranslucentGeometry Theta Phi MaximumPeels OcclusionRatio ForceDepthSortingFlag DoNotUseAnyDepthRelatedAlgorithmFlag\n

        Theta ... spheres' THETA resolution

        Phi ... spheres' PHI resolution

        MaximumPeels ... maximum number of depth peels (multi-pass rendering) for depth peeling mode

        OcclusionRatio ... occlusion ratio for depth peeling mode (0.0 for a perfect rendered image, >0.0 for a non-perfect image which is expected to be slower)

        ForceDepthSortingFlag ... force depth sorting even if depth peeling is supported

        DoNotUseAnyDepthRelatedAlgorithmFlag ... neither use depth peeling nor depth sorting - just render as usual

        Example calls:

        ./CorrectlyRenderTranslucentGeometry 100 100 50 0.1 0 0 ... will render the spheres using depth peeling if available (depth sorting otherwise)\n\n./CorrectlyRenderTranslucentGeometry 100 100 50 0.1 1 0 ... will render the spheres using depth sorting even if depth peeling is available\n\n./CorrectlyRenderTranslucentGeometry 100 100 50 0.1 0 1 ... will render the spheres using neither depth peeling nor depth sorting\n

        Resultant frame rates show that depth peeling is usually much faster than the CPU-implementation, however, it will slow down the rendering process due to internal multi-pass rendering.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/#code","title":"Code","text":"

        CorrectlyRenderTranslucentGeometry.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkDepthSortPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTimerLog.h>\n#include <vtkTransform.h>\n\nnamespace {\n\n/**\n * Generate a bunch of overlapping spheres within one poly data set:\n * one big sphere evenly surrounded by four small spheres that intersect the\n * centered sphere.\n * @param theta sphere sampling resolution (THETA)\n * @param phi sphere sampling resolution (PHI)\n * @return the set of spheres within one logical poly data set\n **/\nvtkSmartPointer<vtkAppendPolyData> GenerateOverlappingBunchOfSpheres(int theta,\n                                                                     int phi);\n\n/**\n * Setup the rendering environment for depth peeling (general depth peeling\n * support is requested).\n * @see IsDepthPeelingSupported()\n * @param renderWindow a valid openGL-supporting render window\n * @param renderer a valid renderer instance\n * @param maxNoOfPeels maximum number of depth peels (multi-pass rendering)\n * @param occulusionRation the occlusion ration (0.0 means a perfect image,\n * >0.0 means a non-perfect image which in general results in faster rendering)\n * @return TRUE if depth peeling could be set up\n */\nbool SetupEnvironmentForDepthPeeling(vtkRenderWindow* renderWindow,\n                                     vtkRenderer* renderer, int maxNoOfPeels,\n                                     double occlusionRatio);\n\n/**\n * Find out whether this box supports depth peeling. Depth peeling requires\n * a variety of openGL extensions and appropriate drivers.\n * @param renderWindow a valid openGL-supporting render window\n * @param renderer a valid renderer instance\n * @param doItOffscreen do the test off screen which means that nothing is\n * rendered to screen (this requires the box to support off screen rendering)\n * @return TRUE if depth peeling is supported, FALSE otherwise (which means\n * that another strategy must be used for correct rendering of translucent\n * geometry, e.g. CPU-based depth sorting)\n */\nbool IsDepthPeelingSupported(vtkRenderWindow* renderWindow,\n                             vtkRenderer* renderer, bool doItOffScreen);\n} // namespace\n\n/**\n * Example application demonstrating correct rendering of translucent geometry.\n * It will automatically detect whether depth peeling is supported by the\n * hardware and software, and will apply depth peeling if possible. Otherwise\n * a fallback strategy is used: depth sorting on the CPU.\n * <br>Usage:\n * [ProgramName] Theta Phi MaximumPeels OcclusionRatio ForceDepthSortingFlag\n * DoNotUseAnyDepthRelatedAlgorithmFlag\n * <br>\n * Theta ... spheres' THETA resolution <br>\n * Phi ... spheres' PHI resolution <br>\n * MaximumPeels ... maximum number of depth peels (multi-pass rendering) for\n * depth peeling mode <br>\n * OcclusionRatio ... occlusion ratio for depth peeling mode (0.0 for a\n * perfect rendered image, >0.0 for a non-perfect image which is expected to\n * be slower) <br>\n * ForceDepthSortingFlag ... force depth sorting even if depth peeling is\n * supported <br>\n * DoNotUseAnyDepthRelatedAlgorithmFlag ... neither use depth peeling nor\n * depth sorting - just render as usual\n */\nint main(int argc, char* argv[])\n{\n  if (argc != 7)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Theta Phi MaximumPeels \"\n              << \"OcclusionRatio ForceDepthSortingFlag \"\n              << \"DoNotUseAnyDepthRelatedAlgorithmFlag\" << std::endl;\n    std::cerr << \"100 100 50 0.1 0 0\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  int theta = atoi(argv[1]);\n  int phi = atoi(argv[2]);\n  int maxPeels = atoi(argv[3]);\n  double occulusionRatio = atof(argv[4]);\n  bool forceDepthSort = atoi(argv[5]) == 1;\n  bool withoutAnyDepthThings = atoi(argv[6]) == 1;\n\n  // Generate a translucent sphere poly data set that partially overlaps:\n  auto translucentGeometry = GenerateOverlappingBunchOfSpheres(theta, phi);\n\n  // generate a basic Mapper and Actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(translucentGeometry->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetOpacity(0.5); // translucent !!!\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Crimson\").GetData());\n  actor->RotateX(-72); // put the objects in a position where it is easy to see\n                       // different overlapping regions\n\n  // Create the RenderWindow, Renderer and RenderWindowInteractor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 400);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CorrectlyRenderTranslucentGeometry\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Setup view geometry\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(2.2); // so the object is larger\n  renderWindow->Render();\n\n  // Answer the key question: Does this box support GPU Depth Peeling?\n  bool useDepthPeeling = IsDepthPeelingSupported(renderWindow, renderer, true);\n  std::cout << \"DEPTH PEELING SUPPORT: \" << (useDepthPeeling ? \"YES\" : \"NO\")\n            << std::endl;\n\n  int success = EXIT_SUCCESS;\n\n  // Use depth peeling if available and not explicitly prohibited, otherwise we\n  // use manual depth sorting\n  std::cout << std::endl << \"CHOSEN MODE: \";\n  if (useDepthPeeling && !forceDepthSort && !withoutAnyDepthThings) // GPU\n  {\n    std::cout << \"*** DEPTH PEELING ***\" << std::endl;\n    // Setup GPU depth peeling with configured parameters\n    success = !SetupEnvironmentForDepthPeeling(renderWindow, renderer, maxPeels,\n                                               occulusionRatio);\n  }\n  else if (!withoutAnyDepthThings) // CPU\n  {\n    std::cout << \"*** DEPTH SORTING ***\" << std::endl;\n    // Setup CPU depth sorting filter\n    vtkNew<vtkDepthSortPolyData> depthSort;\n    depthSort->SetInputConnection(translucentGeometry->GetOutputPort());\n    depthSort->SetDirectionToBackToFront();\n    depthSort->SetVector(1, 1, 1);\n    depthSort->SetCamera(renderer->GetActiveCamera());\n    depthSort->SortScalarsOff(); // do not really need this here\n    // Bring it to the mapper's input\n    mapper->SetInputConnection(depthSort->GetOutputPort());\n    depthSort->Update();\n  }\n  else\n  {\n    std::cout << \"*** NEITHER DEPTH PEELING NOR DEPTH SORTING ***\" << std::endl;\n  }\n\n  // Initialize interaction\n  renderWindowInteractor->Initialize();\n\n  // Check the average frame rate when rotating the actor\n  int endCount = 100;\n  vtkNew<vtkTimerLog> clock;\n  // Set a user transform for successively rotating the camera position\n  vtkNew<vtkTransform> transform;\n  transform->Identity();\n  transform->RotateY(2.0); // rotate 2 degrees around Y-axis at each iteration\n  auto camera = renderer->GetActiveCamera();\n  double camPos[3]; // camera position\n  // Start test\n  clock->StartTimer();\n  for (int i = 0; i < endCount; i++)\n  {\n    camera->GetPosition(camPos);\n    transform->TransformPoint(camPos, camPos);\n    camera->SetPosition(camPos);\n    renderWindow->Render();\n  }\n  clock->StopTimer();\n  double frameRate = (double)endCount / clock->GetElapsedTime();\n  std::cout << \"AVERAGE FRAME RATE: \" << frameRate << \" fps\" << std::endl;\n\n  // Start interaction\n  renderWindowInteractor->Start();\n\n  return success;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkAppendPolyData> GenerateOverlappingBunchOfSpheres(int theta,\n                                                                     int phi)\n{\n  vtkNew<vtkAppendPolyData> appendData;\n\n  for (int i = 0; i < 5; i++)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(theta);\n    sphereSource->SetPhiResolution(phi);\n    sphereSource->SetRadius(0.5); // all spheres except the center\n                                  // one should have radius = 0.5\n    switch (i)\n    {\n    case 0:\n      sphereSource->SetRadius(1);\n      sphereSource->SetCenter(0, 0, 0);\n      break;\n    case 1:\n      sphereSource->SetCenter(1, 0, 0);\n      break;\n    case 2:\n      sphereSource->SetCenter(-1, 0, 0);\n      break;\n    case 3:\n      sphereSource->SetCenter(0, 1, 0);\n      break;\n    case 4:\n      sphereSource->SetCenter(0, -1, 0);\n      break;\n    }\n    sphereSource->Update();\n    appendData->AddInputConnection(sphereSource->GetOutputPort());\n  }\n\n  return appendData;\n}\n\nbool SetupEnvironmentForDepthPeeling(vtkRenderWindow* renderWindow,\n                                     vtkRenderer* renderer, int maxNoOfPeels,\n                                     double occlusionRatio)\n{\n  if (!renderWindow || !renderer)\n    return false;\n\n  // 1. Use a render window with alpha bits (as initial value is 0 (false)):\n  renderWindow->SetAlphaBitPlanes(true);\n\n  // 2. Force to not pick a framebuffer with a multisample buffer\n  // (as initial value is 8):\n  renderWindow->SetMultiSamples(0);\n\n  // 3. Choose to use depth peeling (if supported) (initial value is 0 (false)):\n  renderer->SetUseDepthPeeling(true);\n\n  // 4. Set depth peeling parameters\n  // - Set the maximum number of rendering passes (initial value is 4):\n  renderer->SetMaximumNumberOfPeels(maxNoOfPeels);\n  // - Set the occlusion ratio (initial value is 0.0, exact image):\n  renderer->SetOcclusionRatio(occlusionRatio);\n\n  return true;\n}\n\nbool IsDepthPeelingSupported(vtkRenderWindow* renderWindow,\n                             vtkRenderer* renderer, bool doItOffScreen)\n{\n\n  bool success = true;\n\n  // Save original renderer / render window state\n  bool origOffScreenRendering = renderWindow->GetOffScreenRendering() == 1;\n  bool origAlphaBitPlanes = renderWindow->GetAlphaBitPlanes() == 1;\n  int origMultiSamples = renderWindow->GetMultiSamples();\n  bool origUseDepthPeeling = renderer->GetUseDepthPeeling() == 1;\n  int origMaxPeels = renderer->GetMaximumNumberOfPeels();\n  double origOcclusionRatio = renderer->GetOcclusionRatio();\n\n  // Activate off screen rendering on demand\n  renderWindow->SetOffScreenRendering(doItOffScreen);\n\n  // Setup environment for depth peeling (with some default parametrization)\n  success = success &&\n      SetupEnvironmentForDepthPeeling(renderWindow, renderer, 100, 0.1);\n\n  // Do a test render\n  renderWindow->Render();\n\n  // Check whether depth peeling was used\n  success = success && renderer->GetLastRenderingUsedDepthPeeling();\n\n  // recover original state\n  renderWindow->SetOffScreenRendering(origOffScreenRendering);\n  renderWindow->SetAlphaBitPlanes(origAlphaBitPlanes);\n  renderWindow->SetMultiSamples(origMultiSamples);\n  renderer->SetUseDepthPeeling(origUseDepthPeeling);\n  renderer->SetMaximumNumberOfPeels(origMaxPeels);\n  renderer->SetOcclusionRatio(origOcclusionRatio);\n\n  return success;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CorrectlyRenderTranslucentGeometry)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonSystem\n  CommonTransforms\n  FiltersCore\n  FiltersHybrid\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CorrectlyRenderTranslucentGeometry: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CorrectlyRenderTranslucentGeometry MACOSX_BUNDLE CorrectlyRenderTranslucentGeometry.cxx )\n  target_link_libraries(CorrectlyRenderTranslucentGeometry PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CorrectlyRenderTranslucentGeometry\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CorrectlyRenderTranslucentGeometry/#download-and-build-correctlyrendertranslucentgeometry","title":"Download and Build CorrectlyRenderTranslucentGeometry","text":"

        Click here to download CorrectlyRenderTranslucentGeometry and its CMakeLists.txt file. Once the tarball CorrectlyRenderTranslucentGeometry.tar has been downloaded and extracted,

        cd CorrectlyRenderTranslucentGeometry/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CorrectlyRenderTranslucentGeometry\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CreateColorSeriesDemo/","title":"CreateColorSeriesDemo","text":"

        vtk-examples/Cxx/Visualization/CreateColorSeriesDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/CreateColorSeriesDemo/#description","title":"Description","text":"

        This example demonstrates how to create a custom vtkColorSeries. The examples produces a vtkLookupTable explicitly. The vtkLookupTable is populated with colors from the vtkColorSeries using GetColorRepeating, since the size of the vtkLookupTable may be larger than the colors in the vtkColorSeries.

        A vtkPlaneSource generates the geometry. The vtkCellData is populated with increasing integers starting at 1.

        Ten different color series are generated from VTK color names in vtkNamedColors. The first argument of the example is one of \"Blue\", \"Brown\", \"Red\", \"Orange\", \"White\", \"Grey\", \"Magenta\", \"Cyan\", \"Yellow\" and \"Green\".

        The colors are added from left to right, row by row, from the bottom left-hand corner of the table.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CreateColorSeriesDemo/#code","title":"Code","text":"

        CreateColorSeriesDemo.cxx

        #include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkColorSeries.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <map>\n#include <string>\n#include <vector>\n\nnamespace {\nvoid CreateLookupTableVTKBlue(vtkLookupTable* lut, int tableSize = 0);\nvoid CreateLookupTableVTKBrown(vtkLookupTable* lut, int tableSize = 0);\nvoid CreateLookupTableVTKRed(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKOrange(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKWhite(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKGrey(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKMagenta(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKCyan(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKYellow(vtkLookupTable* lu, int tableSize = 0);\nvoid CreateLookupTableVTKGreen(vtkLookupTable* lu, int tableSize = 0);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  std::string seriesName = \"Red\";\n  if (argc > 1)\n  {\n    seriesName = argv[1];\n  }\n\n  // Provide some geometry.\n  int resolution = 6;\n  vtkNew<vtkPlaneSource> aPlane;\n  aPlane->SetXResolution(resolution);\n  aPlane->SetYResolution(resolution);\n\n  // Create cell data.\n  vtkNew<vtkFloatArray> cellData;\n  for (int i = 0; i < resolution * resolution; i++)\n  {\n    cellData->InsertNextValue(i);\n  }\n  aPlane->Update(); // Force an update so we can set cell data.\n  aPlane->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkLookupTable> lut;\n  if (seriesName == \"Blue\")\n  {\n    CreateLookupTableVTKBlue(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Brown\")\n  {\n    CreateLookupTableVTKBrown(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Red\")\n  {\n    CreateLookupTableVTKRed(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Orange\")\n  {\n    CreateLookupTableVTKOrange(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"White\")\n  {\n    CreateLookupTableVTKWhite(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Grey\")\n  {\n    CreateLookupTableVTKGrey(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Magenta\")\n  {\n    CreateLookupTableVTKMagenta(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Cyan\")\n  {\n    CreateLookupTableVTKCyan(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Yellow\")\n  {\n    CreateLookupTableVTKYellow(lut, resolution * resolution + 1);\n  }\n  else if (seriesName == \"Green\")\n  {\n    CreateLookupTableVTKGreen(lut, resolution * resolution + 1);\n  }\n  else\n  {\n    std::cout << \"Bad series name: \" << seriesName << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Setup actor and mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetLookupTable(lut);\n  mapper->SetInputConnection(aPlane->GetOutputPort());\n  mapper->SetScalarModeToUseCellData();\n  mapper->SetScalarRange(0, resolution * resolution + 1);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CreateColorSeriesDemo\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateLookupTableVTKBlue(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKBlueColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"alice_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"blue_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"blue_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadet\"));\n  myColors->AddColor(nc->GetColor3ub(\"cobalt\"));\n  myColors->AddColor(nc->GetColor3ub(\"cornflower\"));\n  myColors->AddColor(nc->GetColor3ub(\"cerulean\"));\n  myColors->AddColor(nc->GetColor3ub(\"dodger_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"indigo\"));\n  myColors->AddColor(nc->GetColor3ub(\"manganese_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"midnight_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"navy\"));\n  myColors->AddColor(nc->GetColor3ub(\"peacock\"));\n  myColors->AddColor(nc->GetColor3ub(\"powder_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"royal_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_blue_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_blue_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_blue_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"sky_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"sky_blue_deep\"));\n  myColors->AddColor(nc->GetColor3ub(\"sky_blue_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"steel_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"steel_blue_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"turquoise_blue\"));\n  myColors->AddColor(nc->GetColor3ub(\"ultramarine\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKBrown(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKBrownColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"beige\"));\n  myColors->AddColor(nc->GetColor3ub(\"brown\"));\n  myColors->AddColor(nc->GetColor3ub(\"brown_madder\"));\n  myColors->AddColor(nc->GetColor3ub(\"brown_ochre\"));\n  myColors->AddColor(nc->GetColor3ub(\"burlywood\"));\n  myColors->AddColor(nc->GetColor3ub(\"burnt_sienna\"));\n  myColors->AddColor(nc->GetColor3ub(\"burnt_umber\"));\n  myColors->AddColor(nc->GetColor3ub(\"chocolate\"));\n  myColors->AddColor(nc->GetColor3ub(\"deep_ochre\"));\n  myColors->AddColor(nc->GetColor3ub(\"flesh\"));\n  myColors->AddColor(nc->GetColor3ub(\"flesh_ochre\"));\n  myColors->AddColor(nc->GetColor3ub(\"gold_ochre\"));\n  myColors->AddColor(nc->GetColor3ub(\"greenish_umber\"));\n  myColors->AddColor(nc->GetColor3ub(\"khaki\"));\n  myColors->AddColor(nc->GetColor3ub(\"khaki_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"light_beige\"));\n  myColors->AddColor(nc->GetColor3ub(\"peru\"));\n  myColors->AddColor(nc->GetColor3ub(\"rosy_brown\"));\n  myColors->AddColor(nc->GetColor3ub(\"raw_sienna\"));\n  myColors->AddColor(nc->GetColor3ub(\"raw_umber\"));\n  myColors->AddColor(nc->GetColor3ub(\"sepia\"));\n  myColors->AddColor(nc->GetColor3ub(\"sienna\"));\n  myColors->AddColor(nc->GetColor3ub(\"saddle_brown\"));\n  myColors->AddColor(nc->GetColor3ub(\"sandy_brown\"));\n  myColors->AddColor(nc->GetColor3ub(\"tan\"));\n  myColors->AddColor(nc->GetColor3ub(\"van_dyke_brown\"));\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKRed(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKRedColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"alizarin_crimson\"));\n  myColors->AddColor(nc->GetColor3ub(\"brick\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_red_deep\"));\n  myColors->AddColor(nc->GetColor3ub(\"coral\"));\n  myColors->AddColor(nc->GetColor3ub(\"coral_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"deep_pink\"));\n  myColors->AddColor(nc->GetColor3ub(\"english_red\"));\n  myColors->AddColor(nc->GetColor3ub(\"firebrick\"));\n  myColors->AddColor(nc->GetColor3ub(\"geranium_lake\"));\n  myColors->AddColor(nc->GetColor3ub(\"hot_pink\"));\n  myColors->AddColor(nc->GetColor3ub(\"indian_red\"));\n  myColors->AddColor(nc->GetColor3ub(\"light_salmon\"));\n  myColors->AddColor(nc->GetColor3ub(\"madder_lake_deep\"));\n  myColors->AddColor(nc->GetColor3ub(\"maroon\"));\n  myColors->AddColor(nc->GetColor3ub(\"pink\"));\n  myColors->AddColor(nc->GetColor3ub(\"pink_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"raspberry\"));\n  myColors->AddColor(nc->GetColor3ub(\"red\"));\n  myColors->AddColor(nc->GetColor3ub(\"rose_madder\"));\n  myColors->AddColor(nc->GetColor3ub(\"salmon\"));\n  myColors->AddColor(nc->GetColor3ub(\"tomato\"));\n  myColors->AddColor(nc->GetColor3ub(\"venetian_red\"));\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKGrey(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->SetColorSchemeByName(\"VTKGreyColors\");\n  myColors->AddColor(nc->GetColor3ub(\"cold_grey\"));\n  myColors->AddColor(nc->GetColor3ub(\"dim_grey\"));\n  myColors->AddColor(nc->GetColor3ub(\"grey\"));\n  myColors->AddColor(nc->GetColor3ub(\"light_grey\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_grey\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_grey_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"slate_grey_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"warm_grey\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKWhite(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->SetColorSchemeByName(\"VTKWhiteColors\");\n  myColors->AddColor(nc->GetColor3ub(\"antique_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"azure\"));\n  myColors->AddColor(nc->GetColor3ub(\"bisque\"));\n  myColors->AddColor(nc->GetColor3ub(\"blanched_almond\"));\n  myColors->AddColor(nc->GetColor3ub(\"cornsilk\"));\n  myColors->AddColor(nc->GetColor3ub(\"eggshell\"));\n  myColors->AddColor(nc->GetColor3ub(\"floral_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"gainsboro\"));\n  myColors->AddColor(nc->GetColor3ub(\"ghost_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"honeydew\"));\n  myColors->AddColor(nc->GetColor3ub(\"ivory\"));\n  myColors->AddColor(nc->GetColor3ub(\"lavender\"));\n  myColors->AddColor(nc->GetColor3ub(\"lavender_blush\"));\n  myColors->AddColor(nc->GetColor3ub(\"lemon_chiffon\"));\n  myColors->AddColor(nc->GetColor3ub(\"linen\"));\n  myColors->AddColor(nc->GetColor3ub(\"mint_cream\"));\n  myColors->AddColor(nc->GetColor3ub(\"misty_rose\"));\n  myColors->AddColor(nc->GetColor3ub(\"moccasin\"));\n  myColors->AddColor(nc->GetColor3ub(\"navajo_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"old_lace\"));\n  myColors->AddColor(nc->GetColor3ub(\"papaya_whip\"));\n  myColors->AddColor(nc->GetColor3ub(\"peach_puff\"));\n  myColors->AddColor(nc->GetColor3ub(\"seashell\"));\n  myColors->AddColor(nc->GetColor3ub(\"snow\"));\n  myColors->AddColor(nc->GetColor3ub(\"thistle\"));\n  myColors->AddColor(nc->GetColor3ub(\"titanium_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"wheat\"));\n  myColors->AddColor(nc->GetColor3ub(\"white\"));\n  myColors->AddColor(nc->GetColor3ub(\"white_smoke\"));\n  myColors->AddColor(nc->GetColor3ub(\"zinc_white\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKOrange(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKOrangeColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_orange\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_red_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"carrot\"));\n  myColors->AddColor(nc->GetColor3ub(\"dark_orange\"));\n  myColors->AddColor(nc->GetColor3ub(\"mars_orange\"));\n  myColors->AddColor(nc->GetColor3ub(\"mars_yellow\"));\n  myColors->AddColor(nc->GetColor3ub(\"orange\"));\n  myColors->AddColor(nc->GetColor3ub(\"orange_red\"));\n  myColors->AddColor(nc->GetColor3ub(\"yellow_ochre\"));\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKMagenta(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKMagentaColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"blue_violet\"));\n  myColors->AddColor(nc->GetColor3ub(\"cobalt_violet_deep\"));\n  myColors->AddColor(nc->GetColor3ub(\"magenta\"));\n  myColors->AddColor(nc->GetColor3ub(\"orchid\"));\n  myColors->AddColor(nc->GetColor3ub(\"orchid_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"orchid_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"permanent_red_violet\"));\n  myColors->AddColor(nc->GetColor3ub(\"plum\"));\n  myColors->AddColor(nc->GetColor3ub(\"purple\"));\n  myColors->AddColor(nc->GetColor3ub(\"purple_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"ultramarine_violet\"));\n  myColors->AddColor(nc->GetColor3ub(\"violet\"));\n  myColors->AddColor(nc->GetColor3ub(\"violet_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"violet_red\"));\n  myColors->AddColor(nc->GetColor3ub(\"violet_red_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"violet_red_pale\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKCyan(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKCyanColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"aquamarine\"));\n  myColors->AddColor(nc->GetColor3ub(\"aquamarine_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"cyan\"));\n  myColors->AddColor(nc->GetColor3ub(\"cyan_white\"));\n  myColors->AddColor(nc->GetColor3ub(\"turquoise\"));\n  myColors->AddColor(nc->GetColor3ub(\"turquoise_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"turquoise_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"turquoise_pale\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKYellow(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKYellowColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"aureoline_yellow\"));\n  myColors->AddColor(nc->GetColor3ub(\"banana\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_lemon\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_yellow\"));\n  myColors->AddColor(nc->GetColor3ub(\"cadmium_yellow_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"gold\"));\n  myColors->AddColor(nc->GetColor3ub(\"goldenrod\"));\n  myColors->AddColor(nc->GetColor3ub(\"goldenrod_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"goldenrod_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"goldenrod_pale\"));\n  myColors->AddColor(nc->GetColor3ub(\"light_goldenrod\"));\n  myColors->AddColor(nc->GetColor3ub(\"melon\"));\n  myColors->AddColor(nc->GetColor3ub(\"naples_yellow_deep\"));\n  myColors->AddColor(nc->GetColor3ub(\"yellow\"));\n  myColors->AddColor(nc->GetColor3ub(\"yellow_light\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n\nvoid CreateLookupTableVTKGreen(vtkLookupTable* lut, int size)\n{\n  vtkNew<vtkColorSeries> myColors;\n  myColors->SetColorSchemeByName(\"VTKGreenColors\");\n\n  vtkNew<vtkNamedColors> nc;\n\n  myColors->AddColor(nc->GetColor3ub(\"chartreuse\"));\n  myColors->AddColor(nc->GetColor3ub(\"chrome_oxide_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"cinnabar_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"cobalt_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"emerald_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"forest_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"green\"));\n  myColors->AddColor(nc->GetColor3ub(\"green_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"green_pale\"));\n  myColors->AddColor(nc->GetColor3ub(\"green_yellow\"));\n  myColors->AddColor(nc->GetColor3ub(\"lawn_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"lime_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"mint\"));\n  myColors->AddColor(nc->GetColor3ub(\"olive\"));\n  myColors->AddColor(nc->GetColor3ub(\"olive_drab\"));\n  myColors->AddColor(nc->GetColor3ub(\"olive_green_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"permanent_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"sap_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"sea_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"sea_green_dark\"));\n  myColors->AddColor(nc->GetColor3ub(\"sea_green_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"sea_green_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"spring_green\"));\n  myColors->AddColor(nc->GetColor3ub(\"spring_green_medium\"));\n  myColors->AddColor(nc->GetColor3ub(\"terre_verte\"));\n  myColors->AddColor(nc->GetColor3ub(\"viridian_light\"));\n  myColors->AddColor(nc->GetColor3ub(\"yellow_green\"));\n\n  int numberOfColors = myColors->GetNumberOfColors();\n  std::cout << \"Number of colors: \" << numberOfColors << std::endl;\n  lut->SetNumberOfTableValues(size == 0 ? numberOfColors : size);\n  lut->SetTableRange(0, lut->GetNumberOfTableValues());\n  for (int i = 0; i < lut->GetNumberOfTableValues(); ++i)\n  {\n    vtkColor3ub color = myColors->GetColorRepeating(i);\n    lut->SetTableValue(i, color.GetRed() / 255., color.GetGreen() / 255.,\n                       color.GetBlue() / 255., 1.);\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/CreateColorSeriesDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CreateColorSeriesDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CreateColorSeriesDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CreateColorSeriesDemo MACOSX_BUNDLE CreateColorSeriesDemo.cxx )\n  target_link_libraries(CreateColorSeriesDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CreateColorSeriesDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CreateColorSeriesDemo/#download-and-build-createcolorseriesdemo","title":"Download and Build CreateColorSeriesDemo","text":"

        Click here to download CreateColorSeriesDemo and its CMakeLists.txt file. Once the tarball CreateColorSeriesDemo.tar has been downloaded and extracted,

        cd CreateColorSeriesDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CreateColorSeriesDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CubeAxesActor/","title":"CubeAxesActor","text":"

        vtk-examples/Cxx/Visualization/CubeAxesActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CubeAxesActor/#code","title":"Code","text":"

        CubeAxesActor.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeAxesActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  // Define colors for this example.\n  vtkNew<vtkNamedColors> colors;\n\n  vtkColor3d backgroundColor = colors->GetColor3d(\"DarkSlateGray\");\n  vtkColor3d actorColor = colors->GetColor3d(\"Tomato\");\n  vtkColor3d axis1Color = colors->GetColor3d(\"Salmon\");\n  vtkColor3d axis2Color = colors->GetColor3d(\"PaleGreen\");\n  vtkColor3d axis3Color = colors->GetColor3d(\"LightSkyBlue\");\n\n  // Create a superquadric.\n  vtkNew<vtkSuperquadricSource> superquadricSource;\n  superquadricSource->SetPhiRoundness(3.1);\n  superquadricSource->SetThetaRoundness(1.0);\n  superquadricSource->Update(); // Needed to GetBounds later\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(superquadricSource->GetOutputPort());\n\n  vtkNew<vtkActor> superquadricActor;\n  superquadricActor->SetMapper(mapper);\n  superquadricActor->GetProperty()->SetDiffuseColor(actorColor.GetData());\n  superquadricActor->GetProperty()->SetDiffuse(.7);\n  superquadricActor->GetProperty()->SetSpecular(.7);\n  superquadricActor->GetProperty()->SetSpecularPower(50.0);\n\n  vtkNew<vtkCubeAxesActor> cubeAxesActor;\n  cubeAxesActor->SetUseTextActor3D(1);\n  cubeAxesActor->SetBounds(superquadricSource->GetOutput()->GetBounds());\n  cubeAxesActor->SetCamera(renderer->GetActiveCamera());\n  cubeAxesActor->GetTitleTextProperty(0)->SetColor(axis1Color.GetData());\n  cubeAxesActor->GetTitleTextProperty(0)->SetFontSize(48);\n  cubeAxesActor->GetLabelTextProperty(0)->SetColor(axis1Color.GetData());\n\n  cubeAxesActor->GetTitleTextProperty(1)->SetColor(axis2Color.GetData());\n  cubeAxesActor->GetLabelTextProperty(1)->SetColor(axis2Color.GetData());\n\n  cubeAxesActor->GetTitleTextProperty(2)->SetColor(axis3Color.GetData());\n  cubeAxesActor->GetLabelTextProperty(2)->SetColor(axis3Color.GetData());\n\n  cubeAxesActor->DrawXGridlinesOn();\n  cubeAxesActor->DrawYGridlinesOn();\n  cubeAxesActor->DrawZGridlinesOn();\n#if VTK_MAJOR_VERSION == 6\n  cubeAxesActor->SetGridLineLocation(VTK_GRID_LINES_FURTHEST);\n#endif\n#if VTK_MAJOR_VERSION > 6\n  cubeAxesActor->SetGridLineLocation(cubeAxesActor->VTK_GRID_LINES_FURTHEST);\n#endif\n\n  cubeAxesActor->XAxisMinorTickVisibilityOff();\n  cubeAxesActor->YAxisMinorTickVisibilityOff();\n  cubeAxesActor->ZAxisMinorTickVisibilityOff();\n\n  cubeAxesActor->SetFlyModeToStaticEdges();\n  renderer->AddActor(cubeAxesActor);\n  renderer->AddActor(superquadricActor);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n  renderer->SetBackground(backgroundColor.GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"CubeAxesActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Zoom(0.8);\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/CubeAxesActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CubeAxesActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CubeAxesActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CubeAxesActor MACOSX_BUNDLE CubeAxesActor.cxx )\n  target_link_libraries(CubeAxesActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CubeAxesActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CubeAxesActor/#download-and-build-cubeaxesactor","title":"Download and Build CubeAxesActor","text":"

        Click here to download CubeAxesActor and its CMakeLists.txt file. Once the tarball CubeAxesActor.tar has been downloaded and extracted,

        cd CubeAxesActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CubeAxesActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CubeAxesActor2D/","title":"CubeAxesActor2D","text":"

        vtk-examples/Cxx/Visualization/CubeAxesActor2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/CubeAxesActor2D/#description","title":"Description","text":"

        For more information on how to configure this actor, see this email.

        Seealso

        BoundingBox and Outline.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CubeAxesActor2D/#code","title":"Code","text":"

        CubeAxesActor2D.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeAxesActor2D.h>\n#include <vtkLODActor.h>\n// #include <vtkLight.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextProperty.h>\n\n// The vtkCubeAxesActor2D draws axes on the bounding box of the data set and\n// labels the axes with x-y-z coordinates.\n\n//----------------------------------------------------------------------------//\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPlatonicSolidSource> icosahedron;\n  icosahedron->SetSolidTypeToIcosahedron();\n\n  // Create a vtkPolyDataNormals filter to calculate the normals of the data\n  // set.\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(icosahedron->GetOutputPort());\n\n  // Set up the associated mapper and actor.\n  vtkNew<vtkPolyDataMapper> icosahedron_mapper;\n  icosahedron_mapper->SetInputConnection(normals->GetOutputPort());\n  icosahedron_mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkLODActor> icosahedron_actor;\n  icosahedron_actor->SetMapper(icosahedron_mapper.GetPointer());\n  icosahedron_actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Plum\").GetData());\n\n  // Create a vtkOutlineFilter to draw the bounding box of the data set.\n  // Also create the associated mapper and actor.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> map_outline;\n  map_outline->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outline_actor;\n  outline_actor->SetMapper(map_outline.GetPointer());\n  outline_actor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the Renderers.  Assign them the appropriate viewport\n  // coordinates, active camera, and light.\n  vtkNew<vtkRenderer> ren;\n  ren->SetViewport(0, 0, 0.5, 1.0);\n  // It is also possible to enhance the display with cameras.\n  // ren->SetActiveCamera(camera);\n  // ren->AddLight(light);\n\n  vtkNew<vtkRenderer> ren2;\n  ren2->SetViewport(0.5, 0, 1.0, 1.0);\n  ren2->SetActiveCamera(ren->GetActiveCamera());\n  // ren2->AddLight(light);\n\n  // Create the RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren.GetPointer());\n  renWin->AddRenderer(ren2.GetPointer());\n  renWin->SetWindowName(\"CubeAxesActor2D\");\n  renWin->SetSize(1200, 600);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin.GetPointer());\n\n  // Add the actors to the renderer, and set the background.\n  ren->AddViewProp(icosahedron_actor.GetPointer());\n  ren->AddViewProp(outline_actor.GetPointer());\n  ren2->AddViewProp(icosahedron_actor.GetPointer());\n  ren2->AddViewProp(outline_actor.GetPointer());\n\n  ren->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  ren2->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Create a text property for both cube axes.\n  vtkNew<vtkTextProperty> tprop;\n  tprop->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  tprop->ShadowOn();\n  tprop->SetFontSize(20);\n\n  // Create a vtkCubeAxesActor2D. Use the outer edges of the bounding box to\n  // draw the axes. Add the actor to the renderer.\n  vtkNew<vtkCubeAxesActor2D> axes;\n  axes->SetInputConnection(normals->GetOutputPort());\n  axes->SetCamera(ren->GetActiveCamera());\n  axes->SetLabelFormat(\"%6.4g\");\n  axes->SetFlyModeToOuterEdges();\n  axes->SetAxisTitleTextProperty(tprop.GetPointer());\n  axes->SetAxisLabelTextProperty(tprop.GetPointer());\n  ren->AddViewProp(axes.GetPointer());\n\n  // Create a vtkCubeAxesActor2D. Use the closest vertex to the camera to\n  // determine where to draw the axes. Add the actor to the renderer.\n  vtkNew<vtkCubeAxesActor2D> axes2;\n  axes2->SetViewProp(icosahedron_actor.GetPointer());\n  axes2->SetCamera(ren2->GetActiveCamera());\n  axes2->SetLabelFormat(\"%6.4g\");\n  axes2->SetFlyModeToClosestTriad();\n  axes2->ScalingOff();\n  axes2->SetAxisTitleTextProperty(tprop.GetPointer());\n  axes2->SetAxisLabelTextProperty(tprop.GetPointer());\n  ren2->AddViewProp(axes2.GetPointer());\n\n  ren->ResetCamera();\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/CubeAxesActor2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CubeAxesActor2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CubeAxesActor2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CubeAxesActor2D MACOSX_BUNDLE CubeAxesActor2D.cxx )\n  target_link_libraries(CubeAxesActor2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CubeAxesActor2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CubeAxesActor2D/#download-and-build-cubeaxesactor2d","title":"Download and Build CubeAxesActor2D","text":"

        Click here to download CubeAxesActor2D and its CMakeLists.txt file. Once the tarball CubeAxesActor2D.tar has been downloaded and extracted,

        cd CubeAxesActor2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CubeAxesActor2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Cursor2D/","title":"Cursor2D","text":"

        vtk-examples/Cxx/Visualization/Cursor2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Cursor2D/#code","title":"Code","text":"

        Cursor2D.cxx

        #include <vtkActor.h>\n#include <vtkCursor2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Cursor2D\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkCursor2D> cursor;\n  cursor->SetModelBounds(-10, 10, -10, 10, 0, 0);\n  cursor->AllOn();\n  cursor->SetFocalPoint(5.0, 5.0, 0.0);\n  cursor->OutlineOn();\n  cursor->Update();\n\n  vtkNew<vtkPolyDataMapper> cursorMapper;\n  cursorMapper->SetInputConnection(cursor->GetOutputPort());\n  vtkNew<vtkActor> cursorActor;\n  cursorActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  cursorActor->SetMapper(cursorMapper);\n  renderer->AddActor(cursorActor);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Cursor2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cursor2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cursor2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cursor2D MACOSX_BUNDLE Cursor2D.cxx )\n  target_link_libraries(Cursor2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cursor2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Cursor2D/#download-and-build-cursor2d","title":"Download and Build Cursor2D","text":"

        Click here to download Cursor2D and its CMakeLists.txt file. Once the tarball Cursor2D.tar has been downloaded and extracted,

        cd Cursor2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cursor2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Cursor3D/","title":"Cursor3D","text":"

        vtk-examples/Cxx/Visualization/Cursor3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Cursor3D/#code","title":"Code","text":"

        Cursor3D.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCursor3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->SetWindowName(\"Cursor3D\");\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkCursor3D> cursor;\n  cursor->SetModelBounds(-10, 10, -10, 10, -10, 10);\n  cursor->AllOn();\n  cursor->OutlineOff();\n  cursor->Update();\n\n  vtkNew<vtkPolyDataMapper> cursorMapper;\n  cursorMapper->SetInputConnection(cursor->GetOutputPort());\n  vtkNew<vtkActor> cursorActor;\n  cursorActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  cursorActor->SetMapper(cursorMapper);\n  renderer->AddActor(cursorActor);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Cursor3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cursor3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cursor3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cursor3D MACOSX_BUNDLE Cursor3D.cxx )\n  target_link_libraries(Cursor3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cursor3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Cursor3D/#download-and-build-cursor3d","title":"Download and Build Cursor3D","text":"

        Click here to download Cursor3D and its CMakeLists.txt file. Once the tarball Cursor3D.tar has been downloaded and extracted,

        cd Cursor3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cursor3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CursorShape/","title":"CursorShape","text":"

        vtk-examples/Cxx/Visualization/CursorShape

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CursorShape/#code","title":"Code","text":"

        CursorShape.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CursorShape\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n\n  // This must occur after the above Render() call or it does not work.\n  renderWindow->SetCurrentCursor(VTK_CURSOR_HAND);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/CursorShape/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CursorShape)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CursorShape: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CursorShape MACOSX_BUNDLE CursorShape.cxx )\n  target_link_libraries(CursorShape PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CursorShape\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CursorShape/#download-and-build-cursorshape","title":"Download and Build CursorShape","text":"

        Click here to download CursorShape and its CMakeLists.txt file. Once the tarball CursorShape.tar has been downloaded and extracted,

        cd CursorShape/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CursorShape\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CurvatureBandsWithGlyphs/","title":"CurvatureBandsWithGlyphs","text":"

        vtk-examples/Cxx/Visualization/CurvatureBandsWithGlyphs

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/CurvatureBandsWithGlyphs/#description","title":"Description","text":"

        In this example we are coloring the surface by partitioning the gaussian curvature into bands and using arrows to display the normals on the surface.

        Rather beautiful surfaces are generated.

        The banded contour filter and an indexed lookup table are used to generate the curvature bands on the surface. To further enhance the surface, the surface normals are glyphed and colored by elevation using a diverging lookup table.

        Note that:

        • If the regions on a surface have zero Gaussian curvature, then they can be flattened into a plane with no distortion, and the geometry of the region is Euclidean geometry.

        • If the regions on a surface have positive Gaussian curvature, then the geometry of the surface is spherical geometry.

        • If the regions on the surface have a negative Gaussian curvature, then the geometry of the surface is hyperbolic geometry.

        In the above image you can see that the random hills incorporate all of these geometries.

        The surface selected is the parametric random hills surface. The problem with the random hills surface is:

        • Most of the gaussian curvatures will lie in the range -1 to 0.2 (say) with a few large values say 20 to 40 at the peaks of the hills.
        • The edges of the random hills surface also have large irregular values so we need to handle these also. In order to fix this, a function is provided to adjust the edges.

        So we need to manually generate custom bands to group the curvatures. The bands selected in the examples show that the surface is mostly planar with some hyperbolic regions (saddle points) and some spherical regions.

        Feel free to experiment with different color schemes and/or the other sources from the parametric function group or the torus etc.

        You will usually need to adjust the parameters for maskPts, arrow and glyph for a nice appearance.

        A histogram of the frequencies is also output to the console. This is useful if you want to get an idea of the distribution of the scalars in each band.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CurvatureBandsWithGlyphs/#code","title":"Code","text":"

        CurvatureBandsWithGlyphs.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkColorSeries.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkCurvatures.h>\n#include <vtkDelaunay2D.h>\n#include <vtkDoubleArray.h>\n#include <vtkElevationFilter.h>\n#include <vtkFeatureEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdFilter.h>\n#include <vtkIdList.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkReverseSense.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVariant.h>\n#include <vtkVariantArray.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\n#include <algorithm>\n#include <array>\n#include <cctype>\n#include <cmath>\n#include <cstdlib>\n#include <cstring>\n#include <functional>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <numeric>\n#include <set>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n\n//! Adjust curvatures along the edges of the surface.\n/*!\n * This function adjusts curvatures along the edges of the surface by replacing\n *  the value with the average value of the curvatures of points in the\n *  neighborhood.\n *\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param epsilon: Curvature values less than this will be set to zero.\n * @return\n */\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon = 1.0e-08);\n\n//! Constrain curvatures to the range [lower_bound ... upper_bound].\n/*!\n * Remember to update the vtkCurvatures object before calling this.\n *\n * @param source - A vtkPolyData object corresponding to the vtkCurvatures\n * object.\n * @param curvatureName: The name of the curvature, \"Gauss_Curvature\" or\n * \"Mean_Curvature\".\n * @param lowerBound: The lower bound.\n * @param upperBound: The upper bound.\n * @return\n */\nvoid ConstrainCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                         double const& lowerBound = 0.0,\n                         double const& upperBound = 0.0);\n\n//! Generate elevations over the surface.\n/*!\n@param src - the vtkPolyData source.\n@return elev - the elevations.\n*/\nvtkSmartPointer<vtkPolyData> GetElevations(vtkPolyData* src);\n\nvtkSmartPointer<vtkPolyData> GetHills();\nvtkSmartPointer<vtkPolyData> GetParametricHills();\nvtkSmartPointer<vtkPolyData> GetParametricTorus();\nvtkSmartPointer<vtkPolyData> GetPlane();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetTorus();\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& source);\n\nvtkSmartPointer<vtkColorSeries> GetColorSeries();\n\nvtkSmartPointer<vtkLookupTable> GetCategoricalLUT();\n\nvtkSmartPointer<vtkLookupTable> GetOrdinaLUT();\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLUT();\n\nvtkSmartPointer<vtkLookupTable> ReverseLUT(vtkLookupTable* lut);\n\n//!  Glyph the normals on the surface.\n/*!\n@param src - the vtkPolyData source.\n#param scaleFactor - the scale factor for the glyphs.\n@param reverseNormals - if True the normals on the surface are reversed.\n@return The glyphs.\n*/\nvtkNew<vtkGlyph3D> GetGlyphs(vtkPolyData* src, double const& scaleFactor = 1.0,\n                             bool const& reverseNormals = false);\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision = 2,\n                                            bool const& nearestInteger = false);\n\n//! Divide a range into custom bands\n/*!\nYou need to specify each band as an array [r1, r2] where r1 < r2 and\nappend these to a vector.\nThe vector should ultimately look\nlike this: [[r1, r2], [r2, r3], [r3, r4]...]\n\n@param dR - [min, max] the range that is to be covered by the bands.\n@param numberOfBands - the number of bands, a positive integer.\n@param myBands - the bands.\n@return  A map consisting of the band inxex and [min, midpoint, max] for each\nband.\n*/\nstd::map<int, std::vector<double>>\nGetCustomBands(double const dR[2], int const& numberOfBands,\n               std::vector<std::array<double, 2>> const& myBands);\n\n//! Divide a range into integral bands\n/*!\nDivide a range into bands\n@param dR - [min, max] the range that is to be covered by the bands.\n@returnA map consisting of the band inxex and [min, midpoint, max] for each\nband.\n*/\nstd::map<int, std::vector<double>> GetIntegralBands(double const dR[2]);\n\n//! Count the number of scalars in each band.\n/*\n * The scalars used are the active scalars in the polydata.\n *\n * @param bands - the bands.\n * @param src - the vtkPolyData source.\n * @return The frequencies of the scalars in each band.\n */\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src);\n//!\n/*\n * The bands and frequencies are adjusted so that the first and last\n *  frequencies in the range are non-zero.\n * @param bands: The bands.\n * @param freq: The frequencies.\n */\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq);\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision = 2);\n\n} // namespace\n\nint main(int, char*[])\n{\n  // Get the surface\n  std::string desiredSurface{\"RandomHills\"};\n  // desiredSurface = \"Hills\";\n  // desiredSurface = \"ParametricTorus\";\n  // desiredSurface = \"Plane\";\n  // desiredSurface = \"RandomHills\";\n  // desiredSurface = \"Sphere\";\n  // desiredSurface = \"Torus\";\n  auto source = GetSource(desiredSurface);\n\n  // The length of the normal arrow glyphs.\n  auto scaleFactor = 1.0;\n  if (desiredSurface == \"Hills\")\n  {\n    scaleFactor = 0.5;\n  }\n  if (desiredSurface == \"Sphere\")\n  {\n    scaleFactor = 2.0;\n  }\n  std::cout << desiredSurface << std::endl;\n\n  auto gaussianCurvature = true;\n  std::string curvature =\n      (gaussianCurvature) ? \"Gauss_Curvature\" : \"Mean_Curvature\";\n\n  vtkNew<vtkCurvatures> cc;\n  cc->SetInputData(source);\n  std::vector<std::string> needsAdjusting{\"Hills\", \"ParametricTorus\", \"Plane\",\n                                          \"RandomHills\", \"Torus\"};\n  if (gaussianCurvature)\n  {\n    cc->SetCurvatureTypeToGaussian();\n    cc->Update();\n    if (std::find(needsAdjusting.begin(), needsAdjusting.end(),\n                  desiredSurface) != needsAdjusting.end())\n    {\n      AdjustEdgeCurvatures(cc->GetOutput(), curvature);\n    }\n    if (desiredSurface == \"Plane\")\n    {\n      ConstrainCurvatures(cc->GetOutput(), curvature, 0.0, 0.0);\n    }\n    if (desiredSurface == \"Sphere\")\n    {\n\n      // Gaussian curvature is 1/r^2\n      ConstrainCurvatures(cc->GetOutput(), curvature, 4.0, 4.0);\n    }\n  }\n  else\n  {\n\n    cc->SetCurvatureTypeToMean();\n    cc->Update();\n    if (std::find(needsAdjusting.begin(), needsAdjusting.end(),\n                  desiredSurface) != needsAdjusting.end())\n    {\n      AdjustEdgeCurvatures(cc->GetOutput(), curvature);\n    }\n    if (desiredSurface == \"Plane\")\n    {\n      ConstrainCurvatures(cc->GetOutput(), curvature, 0.0, 0.0);\n    }\n    if (desiredSurface == \"Sphere\")\n    {\n\n      // Mean curvature is 1/r\n      ConstrainCurvatures(cc->GetOutput(), curvature, 2.0, 2.0);\n    }\n  }\n\n  cc->GetOutput()->GetPointData()->SetActiveScalars(curvature.c_str());\n  auto scalarRangeCurvatures = cc->GetOutput()\n                                   ->GetPointData()\n                                   ->GetScalars(curvature.c_str())\n                                   ->GetRange();\n  auto scalarRangeElevation =\n      cc->GetOutput()->GetPointData()->GetScalars(\"Elevation\")->GetRange();\n\n  auto lut = GetCategoricalLUT();\n  auto lut1 = GetDivergingLUT();\n  lut->SetTableRange(scalarRangeCurvatures);\n  lut1->SetTableRange(scalarRangeElevation);\n  auto numberOfBands = lut->GetNumberOfTableValues();\n  auto precision = 10;\n  auto bands = GetBands(scalarRangeCurvatures, numberOfBands, precision, false);\n\n  if (desiredSurface == \"RandomHills\")\n  {\n    // These are my custom bands.\n    // Generated by first running:\n    // bands = GetBands(scalarRangeCurvatures, numberOfBands, precision, false);\n    // then:\n    //  std::vector<int> freq = Frequencies(bands, src);\n    //  PrintBandsFrequencies(bands, freq);\n    // Finally using the output to create this table:\n    // std::vector<std::array<double, 2>> myBands = {\n    //    {-0.630, -0.190},  {-0.190, -0.043}, {-0.043, -0.0136},\n    //    {-0.0136, 0.0158}, {0.0158, 0.0452}, {0.0452, 0.0746},12\n    //    {0.0746, 0.104},   {0.104, 0.251},   {0.251, 1.131}};\n    //  This demonstrates that the gaussian curvature of the surface\n    //   is mostly planar with some hyperbolic regions (saddle points)\n    //   and some spherical regions.\n    std::vector<std::array<double, 2>> myBands = {\n        {-0.630, -0.190}, {-0.190, -0.043}, {-0.043, 0.0452}, {0.0452, 0.0746},\n        {0.0746, 0.104},  {0.104, 0.251},   {0.251, 1.131}};\n\n    // Comment this out if you want to see how allocating\n    // equally spaced bands works.\n    bands = GetCustomBands(scalarRangeCurvatures, numberOfBands, myBands);\n    // Adjust the number of table values\n    lut->SetNumberOfTableValues(static_cast<vtkIdType>(bands.size()));\n  }\n  else if (desiredSurface == \"Hills\")\n  {\n    std::vector<std::array<double, 2>> myBands = {\n        {-2.104, -0.15},   {-0.15, -0.1},   {-0.1, -0.05},\n        {-0.05, -0.02},    {-0.02, -0.005}, {-0.005, -0.0005},\n        {-0.0005, 0.0005}, {0.0005, 0.09},  {0.09, 4.972},\n    };\n\n    // Comment this out if you want to see how allocating\n    // equally spaced bands works.\n    bands = GetCustomBands(scalarRangeCurvatures, numberOfBands, myBands);\n    // Adjust the number of table values\n    lut->SetNumberOfTableValues(static_cast<vtkIdType>(bands.size()));\n  }\n\n  // Let's do a frequency table.\n  auto freq = GetFrequencies(bands, cc->GetOutput());\n  AdjustFrequencyRanges(bands, freq);\n  PrintBandsFrequencies(bands, freq);\n\n  scalarRangeCurvatures[0] = bands.begin()->second[0];\n  scalarRangeCurvatures[1] = std::prev(bands.end())->second[2];\n  lut->SetTableRange(scalarRangeCurvatures);\n  lut->SetNumberOfTableValues(bands.size());\n\n  // We will use the midpoint of the band as the label.\n  std::vector<std::string> labels;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    std::ostringstream os;\n    os << std::fixed << std::setw(6) << std::setprecision(2) << p->second[1];\n    labels.push_back(os.str());\n  }\n\n  // Annotate\n  vtkNew<vtkVariantArray> values;\n  for (size_t i = 0; i < labels.size(); ++i)\n  {\n    values->InsertNextValue(vtkVariant(labels[i]));\n  }\n  for (vtkIdType i = 0; i < values->GetNumberOfTuples(); ++i)\n  {\n    lut->SetAnnotation(i, values->GetValue(i).ToString());\n  }\n\n  // Create a lookup table with the colors reversed.\n  auto lutr = ReverseLUT(lut);\n\n  // Create the contour bands.\n  vtkNew<vtkBandedPolyDataContourFilter> bcf;\n  bcf->SetInputData(cc->GetOutput());\n  // Use either the minimum or maximum value for each band.\n  int i = 0;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    bcf->SetValue(i, p->second[2]);\n    ++i;\n  }\n  // We will use an indexed lookup table.\n  bcf->SetScalarModeToIndex();\n  bcf->GenerateContourEdgesOn();\n\n  // Generate the glyphs on the original surface.\n\n  auto glyph = GetGlyphs(cc->GetOutput(), scaleFactor, false);\n\n  // ------------------------------------------------------------\n  // Create the mappers and actors\n  // ------------------------------------------------------------\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  colors->SetColor(\"BkgColor\",\n                   std::array<unsigned char, 4>{179, 204, 255, 255}.data());\n  colors->SetColor(\"ParaViewBkg\",\n                   std::array<unsigned char, 4>{82, 87, 110, 255}.data());\n\n  vtkNew<vtkPolyDataMapper> srcMapper;\n  srcMapper->SetInputConnection(bcf->GetOutputPort());\n  srcMapper->SetScalarRange(scalarRangeCurvatures);\n  srcMapper->SetLookupTable(lut);\n  srcMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> srcActor;\n  srcActor->SetMapper(srcMapper);\n\n  // Create contour edges\n  vtkNew<vtkPolyDataMapper> edgeMapper;\n  edgeMapper->SetInputData(bcf->GetContourEdgesOutput());\n  edgeMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(edgeMapper);\n  edgeActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyph->GetOutputPort());\n  glyphMapper->SetScalarModeToUsePointFieldData();\n  glyphMapper->SetColorModeToMapScalars();\n  glyphMapper->ScalarVisibilityOn();\n  glyphMapper->SelectColorArray(\"Elevation\");\n  // Colour by scalars.\n  glyphMapper->SetLookupTable(lut1);\n  glyphMapper->SetScalarRange(scalarRangeElevation);\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyphMapper);\n\n  auto windowWidth = 800;\n  auto windowHeight = 800;\n\n  // Add scalar bars.\n  auto curvatureType = curvature;\n  std::replace(curvatureType.begin(), curvatureType.end(), '_', '\\n');\n\n  vtkNew<vtkScalarBarActor> scalarBar;\n  // This LUT puts the lowest value at the top of the scalar bar.\n  // scalarBar->SetLookupTable(lut);\n  // Use this LUT if you want the highest value at the top.\n  scalarBar->SetLookupTable(lutr);\n  scalarBar->SetTitle(curvatureType.c_str());\n  scalarBar->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->GetAnnotationTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->UnconstrainedFontSizeOn();\n  scalarBar->SetMaximumWidthInPixels(windowWidth / 8);\n  scalarBar->SetMaximumHeightInPixels(windowHeight / 3);\n  scalarBar->SetPosition(0.85, 0.05);\n\n  vtkNew<vtkScalarBarActor> scalarBarElev;\n  scalarBarElev->SetLookupTable(lut1);\n  scalarBarElev->SetTitle(\"Elevation\");\n  scalarBarElev->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBarElev->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBarElev->GetAnnotationTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBarElev->UnconstrainedFontSizeOn();\n  if (desiredSurface == \"Plane\")\n  {\n    scalarBarElev->SetNumberOfLabels(1);\n  }\n  else\n  {\n    scalarBarElev->SetNumberOfLabels(5);\n  }\n  scalarBarElev->SetMaximumWidthInPixels(windowWidth / 8);\n  scalarBarElev->SetMaximumHeightInPixels(windowHeight / 3);\n  // scalarBarElev->SetBarRatio(scalarBarElev->GetBarRatio() * 0.5);\n  scalarBarElev->SetPosition(0.85, 0.4);\n\n  // ------------------------------------------------------------\n  // Create the RenderWindow, Renderer and Interactor\n  // ------------------------------------------------------------\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  renWin->AddRenderer(ren);\n  // Important: The interactor must be set prior to enabling the widget.\n  iren->SetRenderWindow(renWin);\n#ifdef HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(ren);\n  // Enable the widget.\n  camOrientManipulator->On();\n#endif\n\n  // add actors\n  ren->AddViewProp(srcActor);\n  ren->AddViewProp(edgeActor);\n  ren->AddViewProp(glyphActor);\n  ren->AddActor2D(scalarBar);\n  ren->AddActor2D(scalarBarElev);\n\n  ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n  renWin->SetSize(windowWidth, windowHeight);\n  renWin->SetWindowName(\"CurvatureBandsWithGlyphs\");\n\n  if (desiredSurface == \"RandomHills\")\n  {\n    auto camera = ren->GetActiveCamera();\n    camera->SetPosition(10.9299, 59.1505, 24.9823);\n    camera->SetFocalPoint(2.21692, 7.97545, 7.75135);\n    camera->SetViewUp(-0.230136, 0.345504, -0.909761);\n    camera->SetDistance(54.6966);\n    camera->SetClippingRange(36.3006, 77.9852);\n    renWin->Render();\n  }\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid AdjustEdgeCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                          double const& epsilon)\n{\n  auto PointNeighbourhood =\n      [&source](vtkIdType const& pId) -> std::set<vtkIdType> {\n    // Extract the topological neighbors for point pId. In two steps:\n    //  1) source->GetPointCells(pId, cellIds)\n    //  2) source->GetCellPoints(cellId, cellPointIds) for all cellId in cellIds\n    vtkNew<vtkIdList> cellIds;\n    source->GetPointCells(pId, cellIds);\n    std::set<vtkIdType> neighbours;\n    for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); ++i)\n    {\n      auto cellId = cellIds->GetId(i);\n      vtkNew<vtkIdList> cellPointIds;\n      source->GetCellPoints(cellId, cellPointIds);\n      for (vtkIdType j = 0; j < cellPointIds->GetNumberOfIds(); ++j)\n      {\n        neighbours.insert(cellPointIds->GetId(j));\n      }\n    }\n    return neighbours;\n  };\n\n  auto ComputeDistance = [&source](vtkIdType const& ptIdA,\n                                   vtkIdType const& ptIdB) {\n    std::array<double, 3> ptA{0.0, 0.0, 0.0};\n    std::array<double, 3> ptB{0.0, 0.0, 0.0};\n    std::array<double, 3> ptC{0.0, 0.0, 0.0};\n    source->GetPoint(ptIdA, ptA.data());\n    source->GetPoint(ptIdB, ptB.data());\n    std::transform(std::begin(ptA), std::end(ptA), std::begin(ptB),\n                   std::begin(ptC), std::minus<double>());\n    // Calculate the norm.\n    auto result = std::sqrt(std::inner_product(std::begin(ptC), std::end(ptC),\n                                               std::begin(ptC), 0.0));\n    return result;\n  };\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n\n  // Get the boundary point IDs.\n  std::string name = \"Ids\";\n  vtkNew<vtkIdFilter> idFilter;\n  idFilter->SetInputData(source);\n  idFilter->SetPointIds(true);\n  idFilter->SetCellIds(false);\n  idFilter->SetPointIdsArrayName(name.c_str());\n  idFilter->SetCellIdsArrayName(name.c_str());\n  idFilter->Update();\n\n  vtkNew<vtkFeatureEdges> edges;\n\n  edges->SetInputConnection(idFilter->GetOutputPort());\n  edges->BoundaryEdgesOn();\n  edges->ManifoldEdgesOff();\n  edges->NonManifoldEdgesOff();\n  edges->FeatureEdgesOff();\n  edges->Update();\n\n  auto edgeAarray =\n      edges->GetOutput()->GetPointData()->GetAbstractArray(name.c_str());\n  std::vector<vtkIdType> boundaryIds;\n  for (vtkIdType i = 0; i < edges->GetOutput()->GetNumberOfPoints(); ++i)\n  {\n    boundaryIds.push_back(edgeAarray->GetVariantValue(i).ToInt());\n  }\n  // Remove duplicate Ids.\n  std::set<vtkIdType> pIdsSet(boundaryIds.begin(), boundaryIds.end());\n  for (auto const pId : boundaryIds)\n  {\n    auto pIdsNeighbors = PointNeighbourhood(pId);\n    std::set<vtkIdType> pIdsNeighborsInterior;\n    std::set_difference(\n        pIdsNeighbors.begin(), pIdsNeighbors.end(), pIdsSet.begin(),\n        pIdsSet.end(),\n        std::inserter(pIdsNeighborsInterior, pIdsNeighborsInterior.begin()));\n    // Compute distances and extract curvature values.\n    std::vector<double> curvs;\n    std::vector<double> dists;\n    for (auto const pIdN : pIdsNeighborsInterior)\n    {\n      curvs.push_back(curvatures[pIdN]);\n      dists.push_back(ComputeDistance(pIdN, pId));\n    }\n    std::vector<vtkIdType> nonZeroDistIds;\n    for (size_t i = 0; i < dists.size(); ++i)\n    {\n      if (dists[i] > 0)\n      {\n        nonZeroDistIds.push_back(i);\n      }\n    }\n    std::vector<double> curvsNonZero;\n    std::vector<double> distsNonZero;\n    for (auto const i : nonZeroDistIds)\n    {\n      curvsNonZero.push_back(curvs[i]);\n      distsNonZero.push_back(dists[i]);\n    }\n    // Iterate over the edge points and compute the curvature as the weighted\n    // average of the neighbours.\n    auto countInvalid = 0;\n    auto newCurv = 0.0;\n    if (curvsNonZero.size() > 0)\n    {\n      std::vector<double> weights;\n      double sum = 0.0;\n      for (auto const d : distsNonZero)\n      {\n        sum += 1.0 / d;\n        weights.push_back(1.0 / d);\n      }\n      for (size_t i = 0; i < weights.size(); ++i)\n      {\n        weights[i] = weights[i] / sum;\n      }\n      newCurv = std::inner_product(curvsNonZero.begin(), curvsNonZero.end(),\n                                   weights.begin(), 0.0);\n    }\n    else\n    {\n      // Corner case.\n      // countInvalid += 1;\n      // Assuming the curvature of the point is planar.\n      newCurv = 0.0;\n    }\n    // Set the new curvature value.\n    curvatures[pId] = newCurv;\n  }\n\n  // Set small values to zero.\n  if (epsilon != 0.0)\n  {\n    auto eps = std::abs(epsilon);\n    for (size_t i = 0; i < curvatures.size(); ++i)\n    {\n      if (std::abs(curvatures[i]) < eps)\n      {\n        curvatures[i] = 0.0;\n      }\n    }\n  }\n\n  if (static_cast<size_t>(source->GetNumberOfPoints()) != curvatures.size())\n  {\n    std::string s = curvatureName;\n    s += \":\\nCannot add the adjusted curvatures to the source.\\n\";\n    s += \" The number of points in source does not equal the\\n\";\n    s += \" number of point ids in the adjusted curvature array.\";\n    std::cerr << s << std::endl;\n    return;\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\nvoid ConstrainCurvatures(vtkPolyData* source, std::string const& curvatureName,\n                         double const& lowerBound, double const& upperBound)\n{\n  std::array<double, 2> bounds{0.0, 0.0};\n  if (lowerBound < upperBound)\n  {\n    bounds[0] = lowerBound;\n    bounds[1] = upperBound;\n  }\n  else\n  {\n    bounds[0] = upperBound;\n    bounds[1] = lowerBound;\n  }\n\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n  // Curvature as a vector.\n  auto array = source->GetPointData()->GetAbstractArray(curvatureName.c_str());\n  std::vector<double> curvatures;\n  for (vtkIdType i = 0; i < source->GetNumberOfPoints(); ++i)\n  {\n    curvatures.push_back(array->GetVariantValue(i).ToDouble());\n  }\n  //  Set upper and lower bounds.\n  for (size_t i = 0; i < curvatures.size(); ++i)\n  {\n    if (curvatures[i] < bounds[0])\n    {\n      curvatures[i] = bounds[0];\n    }\n    else\n    {\n      if (curvatures[i] > bounds[1])\n      {\n        curvatures[i] = bounds[1];\n      }\n    }\n  }\n  vtkNew<vtkDoubleArray> adjustedCurvatures;\n  for (auto curvature : curvatures)\n  {\n    adjustedCurvatures->InsertNextTuple1(curvature);\n  }\n  adjustedCurvatures->SetName(curvatureName.c_str());\n  source->GetPointData()->RemoveArray(curvatureName.c_str());\n  source->GetPointData()->AddArray(adjustedCurvatures);\n  source->GetPointData()->SetActiveScalars(curvatureName.c_str());\n}\n\nvtkSmartPointer<vtkPolyData> GetElevations(vtkPolyData* src)\n{\n  double bounds[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};\n  src->GetBounds(bounds);\n  if (std::abs(bounds[2]) < 1.0e-8 && std::abs(bounds[3]) < 1.0e-8)\n  {\n    bounds[3] = bounds[2] + 1;\n  }\n  vtkNew<vtkElevationFilter> elevFilter;\n  elevFilter->SetInputData(src);\n  elevFilter->SetLowPoint(0, bounds[2], 0);\n  elevFilter->SetHighPoint(0, bounds[3], 0);\n  elevFilter->SetScalarRange(bounds[2], bounds[3]);\n  elevFilter->Update();\n\n  return elevFilter->GetPolyDataOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetHills()\n{\n  // Create four hills on a plane.\n  // This will have regions of negative, zero and positive Gsaussian curvatures.\n\n  auto xRes = 50;\n  auto yRes = 50;\n  auto xMin = -5.0;\n  auto xMax = 5.0;\n  auto dx = (xMax - xMin) / (xRes - 1.0);\n  auto yMin = -5.0;\n  auto yMax = 5.0;\n  auto dy = (yMax - yMin) / (xRes - 1.0);\n\n  // Make a grid.\n  vtkNew<vtkPoints> points;\n  for (auto i = 0; i < xRes; ++i)\n  {\n    auto x = xMin + i * dx;\n    for (auto j = 0; j < yRes; ++j)\n    {\n      auto y = yMin + j * dy;\n      points->InsertNextPoint(x, y, 0);\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> plane;\n  plane->SetPoints(points);\n\n  // Triangulate the grid.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(plane);\n  delaunay->Update();\n\n  auto polydata = delaunay->GetOutput();\n\n  vtkNew<vtkDoubleArray> elevation;\n  elevation->SetNumberOfTuples(points->GetNumberOfPoints());\n\n  //  We define the parameters for the hills here.\n  // [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n  std::vector<std::array<double, 5>> hd{{-2.5, -2.5, 2.5, 6.5, 3.5},\n                                        {2.5, 2.5, 2.5, 2.5, 2},\n                                        {5.0, -2.5, 1.5, 1.5, 2.5},\n                                        {-5.0, 5, 2.5, 3.0, 3}};\n  std::array<double, 2> xx{0.0, 0.0};\n  for (auto i = 0; i < points->GetNumberOfPoints(); ++i)\n  {\n    auto x = polydata->GetPoint(i);\n    for (size_t j = 0; j < hd.size(); ++j)\n    {\n      xx[0] = std::pow(x[0] - hd[j][0] / hd[j][2], 2.0);\n      xx[1] = std::pow(x[1] - hd[j][1] / hd[j][3], 2.0);\n      x[2] += hd[j][4] * std::exp(-(xx[0] + xx[1]) / 2.0);\n    }\n    polydata->GetPoints()->SetPoint(i, x);\n    elevation->SetValue(i, x[2]);\n  }\n\n  vtkNew<vtkFloatArray> textures;\n  textures->SetNumberOfComponents(2);\n  textures->SetNumberOfTuples(2 * polydata->GetNumberOfPoints());\n  textures->SetName(\"Textures\");\n\n  for (auto i = 0; i < xRes; ++i)\n  {\n    float tc[2];\n    tc[0] = i / (xRes - 1.0);\n    for (auto j = 0; j < yRes; ++j)\n    {\n      // tc[1] = 1.0 - j / (yRes - 1.0);\n      tc[1] = j / (yRes - 1.0);\n      textures->SetTuple(static_cast<vtkIdType>(i) * yRes + j, tc);\n    }\n  }\n\n  polydata->GetPointData()->SetScalars(elevation);\n  polydata->GetPointData()->GetScalars()->SetName(\"Elevation\");\n  polydata->GetPointData()->SetTCoords(textures);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(polydata);\n  normals->SetInputData(polydata);\n  normals->SetFeatureAngle(30);\n  normals->SplittingOff();\n\n  vtkNew<vtkTransform> tr1;\n  tr1->RotateX(-90);\n\n  vtkNew<vtkTransformPolyDataFilter> tf1;\n  tf1->SetInputConnection(normals->GetOutputPort());\n  tf1->SetTransform(tr1);\n  tf1->Update();\n\n  return tf1->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetParametricHills()\n{\n  vtkNew<vtkParametricRandomHills> fn;\n  fn->AllowRandomGenerationOn();\n  fn->SetRandomSeed(1);\n  fn->SetNumberOfHills(30);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetParametricFunction(fn);\n  source->SetUResolution(50);\n  source->SetVResolution(50);\n  source->SetScalarModeToZ();\n  source->Update();\n\n  // Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n  // source->GetOutput()->GetPointData()->GetNormals()->SetName(\"Normals\");\n  // source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Scalars\");\n  // Rename the scalars to \"Elevation\" since we are using the Z-scalars as\n  // elevations.\n  source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Elevation\");\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetParametricTorus()\n{\n  vtkNew<vtkParametricTorus> fn;\n  fn->SetRingRadius(5);\n  fn->SetCrossSectionRadius(2);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetParametricFunction(fn);\n  source->SetUResolution(50);\n  source->SetVResolution(50);\n  source->SetScalarModeToZ();\n  source->Update();\n\n  // Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n  // source->GetOutput()->GetPointData()->GetNormals()->SetName(\"Normals\");\n  // source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Scalars\");\n  // Rename the scalars to \"Elevation\" since we are using the Z-scalars as\n  // elevations.\n  source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Elevation\");\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetPlane()\n{\n  vtkNew<vtkPlaneSource> source;\n  source->SetOrigin(-10.0, -10.0, 0.0);\n  source->SetPoint2(-10.0, 10.0, 0.0);\n  source->SetPoint1(10.0, -10.0, 0.0);\n  source->SetXResolution(20);\n  source->SetYResolution(20);\n  source->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 0.0, 0.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  // We have a m x n array of quadrilaterals arranged as a regular tiling in a\n  // plane. So pass it through a triangle filter since the curvature filter only\n  // operates on polys.\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(transformFilter->GetOutputPort());\n\n  // Pass it though a CleanPolyDataFilter and merge any points which\n  // are coincident, or very close\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  return cleaner->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  vtkNew<vtkSphereSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetRadius(10.0);\n  source->SetThetaResolution(32);\n  source->SetPhiResolution(32);\n  source->Update();\n\n  return source->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  vtkNew<vtkSuperquadricSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetCenter(1.0, 1.0, 1.0);\n  source->SetPhiResolution(64);\n  source->SetThetaResolution(64);\n  source->SetThetaRoundness(1);\n  source->SetThickness(0.5);\n  source->SetSize(10);\n  source->SetToroidal(1);\n  source->Update();\n\n  // The quadric is made of strips, so pass it through a triangle filter as\n  // the curvature filter only operates on polys\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(source->GetOutputPort());\n\n  // The quadric has nasty discontinuities from the way the edges are generated\n  // so let's pass it though a CleanPolyDataFilter and merge any points which\n  // are coincident, or very close\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  return cleaner->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& source)\n{\n  std::string surface = source;\n  std::transform(surface.begin(), surface.end(), surface.begin(),\n                 [](unsigned char c) { return std::tolower(c); });\n  std::map<std::string, int> available_surfaces = {\n      {\"hills\", 0},       {\"parametrictorus\", 1}, {\"plane\", 2},\n      {\"randomhills\", 3}, {\"sphere\", 4},          {\"torus\", 5}};\n  if (available_surfaces.find(surface) == available_surfaces.end())\n  {\n    std::cout << \"The surface is not available.\" << std::endl;\n    std::cout << \"Using RandomHills instead.\" << std::endl;\n    surface = \"randomhills\";\n  }\n  switch (available_surfaces[surface])\n  {\n  case 0:\n    return GetHills();\n    break;\n  case 1:\n    return GetParametricTorus();\n    break;\n  case 2:\n    return GetElevations(GetPlane());\n    break;\n  case 3:\n    return GetParametricHills();\n    break;\n  case 4:\n    return GetElevations(GetSphere());\n    break;\n  case 5:\n    return GetElevations(GetTorus());\n    break;\n  }\n  return GetParametricHills();\n}\n\nvtkSmartPointer<vtkColorSeries> GetColorSeries()\n{\n\n  vtkNew<vtkColorSeries> colorSeries;\n  // Select a color scheme.\n  int colorSeriesEnum;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_BROWN_BLUE_GREEN_9;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_10;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_3;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_PURPLE_ORANGE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_PURPLE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_GREEN_9;\n  colorSeriesEnum = colorSeries->BREWER_QUALITATIVE_SET3;\n  // colorSeriesEnum = colorSeries->CITRUS;\n  colorSeries->SetColorScheme(colorSeriesEnum);\n  return colorSeries;\n}\n\nvtkSmartPointer<vtkLookupTable> GetCategoricalLUT()\n{\n  vtkSmartPointer<vtkColorSeries> colorSeries = GetColorSeries();\n  // Make the lookup table.\n  vtkNew<vtkLookupTable> lut;\n  colorSeries->BuildLookupTable(lut, vtkColorSeries::CATEGORICAL);\n  lut->SetNanColor(0, 0, 0, 1);\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> GetOrdinaLUT()\n{\n  vtkSmartPointer<vtkColorSeries> colorSeries = GetColorSeries();\n  // Make the lookup table.\n  vtkNew<vtkLookupTable> lut;\n  colorSeries->BuildLookupTable(lut, vtkColorSeries::ORDINAL);\n  lut->SetNanColor(0, 0, 0, 1);\n\n  return lut;\n}\n\n// clang-format off\n/**\n * See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n *\n *                   start point         midPoint            end point\n * cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n * purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n * green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n * blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n * green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n *\n */\n// clang-format on\nvtkSmartPointer<vtkLookupTable> GetDivergingLUT()\n{\n\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, 0.085, 0.532, 0.201);\n  ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n  ctf->AddRGBPoint(1.0, 0.758, 0.214, 0.233);\n\n  auto tableSize = 256;\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(static_cast<double>(i) / lut->GetNumberOfColors(),\n                  rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(static_cast<vtkIdType>(i), rgba.data());\n  }\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> ReverseLUT(vtkLookupTable* lut)\n{\n  // First do a deep copy just to get the whole structure\n  // and then reverse the colors and annotations.\n  vtkNew<vtkLookupTable> lutr;\n  lutr->DeepCopy(lut);\n  vtkIdType t = lut->GetNumberOfTableValues() - 1;\n  for (vtkIdType i = t; i >= 0; --i)\n  {\n    std::array<double, 3> rgb{0.0, 0.0, 0.0};\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    lut->GetColor(i, rgb.data());\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    rgba[3] = lut->GetOpacity(i);\n    lutr->SetTableValue(t - i, rgba.data());\n  }\n  t = lut->GetNumberOfAnnotatedValues() - 1;\n  for (vtkIdType i = t; i >= 0; --i)\n  {\n    lutr->SetAnnotation(t - i, lut->GetAnnotation(i));\n  }\n\n  return lutr;\n}\n\nvtkNew<vtkGlyph3D> GetGlyphs(vtkPolyData* src, double const& scaleFactor,\n                             bool const& reverseNormals)\n{\n  // Sometimes the contouring algorithm can create a volume whose gradient\n  // vector and ordering of polygon(using the right hand rule) are\n  // inconsistent. vtkReverseSense cures this problem.\n  vtkNew<vtkReverseSense> reverse;\n  vtkNew<vtkMaskPoints> maskPts;\n  maskPts->SetOnRatio(5);\n  maskPts->RandomModeOn();\n  if (reverseNormals)\n  {\n    reverse->SetInputData(src);\n    reverse->ReverseCellsOn();\n    reverse->ReverseNormalsOn();\n    maskPts->SetInputConnection(reverse->GetOutputPort());\n  }\n  else\n  {\n    maskPts->SetInputData(src);\n  }\n\n  // Source for the glyph filter\n  vtkNew<vtkArrowSource> arrow;\n  arrow->SetTipResolution(16);\n  arrow->SetTipLength(0.3);\n  arrow->SetTipRadius(0.1);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetSourceConnection(arrow->GetOutputPort());\n  glyph->SetInputConnection(maskPts->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleFactor(scaleFactor);\n  glyph->SetColorModeToColorByVector();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->OrientOn();\n  glyph->Update();\n\n  return glyph;\n}\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision,\n                                            bool const& nearestInteger)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  auto RoundOff = [&prec](const double& x) {\n    auto pow_10 = std::pow(10.0, prec);\n    return std::round(x * pow_10) / pow_10;\n  };\n\n  std::map<int, std::vector<double>> bands;\n  if ((dR[1] < dR[0]) || (numberOfBands <= 0))\n  {\n    return bands;\n  }\n  double x[2];\n  for (int i = 0; i < 2; ++i)\n  {\n    x[i] = dR[i];\n  }\n  if (nearestInteger)\n  {\n    x[0] = std::floor(x[0]);\n    x[1] = std::ceil(x[1]);\n  }\n  double dx = (x[1] - x[0]) / static_cast<double>(numberOfBands);\n  std::vector<double> b;\n  b.push_back(x[0]);\n  b.push_back(x[0] + dx / 2.0);\n  b.push_back(x[0] + dx);\n  for (int i = 0; i < numberOfBands; ++i)\n  {\n    if (i == 0)\n    {\n      for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n      {\n        *p = RoundOff(*p);\n      }\n      b[0] = x[0];\n    }\n    bands[i] = b;\n    for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n    {\n      *p = RoundOff(*p + dx);\n    }\n  }\n  return bands;\n}\n\nstd::map<int, std::vector<double>>\nGetCustomBands(double const dR[2], int const& numberOfBands,\n               std::vector<std::array<double, 2>> const& myBands)\n{\n  std::map<int, std::vector<double>> bands;\n  if ((dR[1] < dR[0]) || (numberOfBands <= 0))\n  {\n    return bands;\n  }\n\n  std::vector<std::array<double, 2>> x;\n  std::copy(myBands.begin(), myBands.end(), std::back_inserter(x));\n\n  // Determine the index of the range minimum and range maximum.\n  int idxMin = 0;\n  for (auto idx = 0; idx < static_cast<int>(myBands.size()); ++idx)\n  {\n    if (dR[0] < myBands[idx][1] && dR[0] >= myBands[idx][0])\n    {\n      idxMin = idx;\n      break;\n    }\n  }\n  int idxMax = static_cast<int>(myBands.size()) - 1;\n  for (int idx = static_cast<int>(myBands.size()) - 1; idx >= 0; --idx)\n  {\n    if (dR[1] < myBands[idx][1] && dR[1] >= myBands[idx][0])\n    {\n      idxMax = static_cast<int>(idx);\n      break;\n    }\n  }\n\n  // Set the minimum to match the range minimum.\n  x[idxMin][0] = dR[0];\n  x[idxMax][1] = dR[1];\n  for (int i = idxMin; i < idxMax + 1; ++i)\n  {\n    std::vector<double> b(3);\n    b[0] = x[i][0];\n    b[1] = x[i][0] + (x[i][1] - x[i][0]) / 2.0;\n    b[2] = x[i][1];\n    bands[i] = b;\n  }\n  return bands;\n}\n\nstd::map<int, std::vector<double>> GetIntegralBands(double const dR[2])\n{\n  std::map<int, std::vector<double>> bands;\n  if (dR[1] < dR[0])\n  {\n    return bands;\n  }\n  double x[2];\n  for (int i = 0; i < 2; ++i)\n  {\n    x[i] = dR[i];\n  }\n  x[0] = std::floor(x[0]);\n  x[1] = std::ceil(x[1]);\n  int numberOfBands = static_cast<int>(std::abs(x[1]) + std::abs(x[0]));\n  return GetBands(x, numberOfBands, false);\n}\n\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src)\n{\n  std::map<int, int> freq;\n  for (auto i = 0; i < static_cast<int>(bands.size()); ++i)\n  {\n    freq[i] = 0;\n  }\n  vtkIdType tuples = src->GetPointData()->GetScalars()->GetNumberOfTuples();\n  for (int i = 0; i < tuples; ++i)\n  {\n    double* x = src->GetPointData()->GetScalars()->GetTuple(i);\n    for (auto j = 0; j < static_cast<int>(bands.size()); ++j)\n    {\n      if (*x <= bands[j][2])\n      {\n        freq[j] = freq[j] + 1;\n        break;\n      }\n    }\n  }\n  return freq;\n}\n\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq)\n{\n  // Get the indices of the first and last non-zero elements.\n  auto first = 0;\n  for (auto i = 0; i < static_cast<int>(freq.size()); ++i)\n  {\n    if (freq[i] != 0)\n    {\n      first = i;\n      break;\n    }\n  }\n  std::vector<int> keys;\n  for (std::map<int, int>::iterator it = freq.begin(); it != freq.end(); ++it)\n  {\n    keys.push_back(it->first);\n  }\n  std::reverse(keys.begin(), keys.end());\n  auto last = keys[0];\n  for (size_t i = 0; i < keys.size(); ++i)\n  {\n    if (freq[keys[i]] != 0)\n    {\n      last = keys[i];\n      break;\n    }\n  }\n  // Now adjust the ranges.\n  std::map<int, int>::iterator freqItr;\n  freqItr = freq.find(first);\n  freq.erase(freq.begin(), freqItr);\n  freqItr = ++freq.find(last);\n  freq.erase(freqItr, freq.end());\n  std::map<int, std::vector<double>>::iterator bandItr;\n  bandItr = bands.find(first);\n  bands.erase(bands.begin(), bandItr);\n  bandItr = ++bands.find(last);\n  bands.erase(bandItr, bands.end());\n  // Reindex freq and bands.\n  std::map<int, int> adjFreq;\n  int idx = 0;\n  for (auto p : freq)\n  {\n    adjFreq[idx] = p.second;\n    ++idx;\n  }\n  std::map<int, std::vector<double>> adjBands;\n  idx = 0;\n  for (auto const& p : bands)\n  {\n    adjBands[idx] = p.second;\n    ++idx;\n  }\n  bands = adjBands;\n  freq = adjFreq;\n}\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  if (bands.size() != freq.size())\n  {\n    std::cout << \"Bands and frequencies must be the same size.\" << std::endl;\n    return;\n  }\n  std::ostringstream os;\n  os << \"Bands & Frequencies:\\n\";\n  size_t idx = 0;\n  auto total = 0;\n  auto width = prec + 6;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    total += freq[p->first];\n    for (std::vector<double>::const_iterator q = p->second.begin();\n         q != p->second.end(); ++q)\n    {\n      if (q == p->second.begin())\n      {\n        os << std::setw(4) << idx << \" [\";\n      }\n      if (q == std::prev(p->second.end()))\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \"]: \" << std::setw(8) << freq[p->first] << \"\\n\";\n      }\n      else\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \", \";\n      }\n    }\n    ++idx;\n  }\n  width = 3 * width + 13;\n  os << std::left << std::setw(width) << \"Total\" << std::right << std::setw(8)\n     << total << std::endl;\n  std::cout << os.str() << endl;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/CurvatureBandsWithGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CurvatureBandsWithGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CurvatureBandsWithGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CurvatureBandsWithGlyphs MACOSX_BUNDLE CurvatureBandsWithGlyphs.cxx )\n  target_link_libraries(CurvatureBandsWithGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CurvatureBandsWithGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CurvatureBandsWithGlyphs/#download-and-build-curvaturebandswithglyphs","title":"Download and Build CurvatureBandsWithGlyphs","text":"

        Click here to download CurvatureBandsWithGlyphs and its CMakeLists.txt file. Once the tarball CurvatureBandsWithGlyphs.tar has been downloaded and extracted,

        cd CurvatureBandsWithGlyphs/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CurvatureBandsWithGlyphs\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/CurvedReformation/","title":"CurvedReformation","text":"

        vtk-examples/Cxx/Visualization/CurvedReformation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/CurvedReformation/#description","title":"Description","text":"

        This example makes a curved reformation of a volume. The example requires three parameters:

        1. Input volume
        2. Input polydata that defines a polyline for the reformation. The polyline will be resampled with a cubic spline
        3. Resolution is the result resolution of the reformation.

        Note

        The image was generated with this volume data: src/Testing/Data/HeadMRVolume.mhd and src/Testing/Data/HeadMRVolume.raw and this polyLine data: src/Testing/Data/polyline.vtk.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/CurvedReformation/#code","title":"Code","text":"

        CurvedReformation.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageData.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSplineFilter.h>\n#include <vtkWindowLevelLookupTable.h>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> SweepLine(vtkPolyData* line, double direction[3],\n                                       double distance, unsigned int cols);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Verify arguments\n  if (argc < 4)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" InputVolume PolyDataInput\"\n              << \" Resolution\" << std::endl;\n    std::cout << \"e.g. HeadMRVolume.mhd polyline.vtk 200\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Parse arguments.\n  std::string volumeFileName = argv[1];\n  std::string polyDataFileName = argv[2];\n  std::stringstream ssResolution;\n  ssResolution << argv[3];\n  unsigned int resolution;\n  ssResolution >> resolution;\n\n  // Output arguments.\n  std::cout << \"InputVolume: \" << volumeFileName << std::endl\n            << \"PolyDataInput: \" << polyDataFileName << std::endl\n            << \"Resolution: \" << resolution << std::endl;\n\n  // Read the volume data.\n  vtkNew<vtkImageReader2Factory> imageFactory;\n  vtkSmartPointer<vtkImageReader2> imageReader;\n  imageReader.TakeReference(\n      imageFactory->CreateImageReader2(volumeFileName.c_str()));\n  imageReader->SetFileName(volumeFileName.c_str());\n  imageReader->Update();\n\n  // Read the Polyline.\n  vtkNew<vtkPolyDataReader> polyLineReader;\n  polyLineReader->SetFileName(polyDataFileName.c_str());\n  polyLineReader->Update();\n\n  vtkNew<vtkSplineFilter> spline;\n  spline->SetInputConnection(polyLineReader->GetOutputPort());\n  spline->SetSubdivideToSpecified();\n  spline->SetNumberOfSubdivisions(resolution);\n\n  // Sweep the line to form a surface.\n  double direction[3];\n  direction[0] = 0.0;\n  direction[1] = 0.0;\n  direction[2] = 1.0;\n  double distance = 164;\n  spline->Update();\n  auto surface =\n      SweepLine(spline->GetOutput(), direction, distance, atoi(argv[3]));\n\n  // Probe the volume with the extruded surface.\n  vtkNew<vtkProbeFilter> sampleVolume;\n  sampleVolume->SetInputConnection(1, imageReader->GetOutputPort());\n  sampleVolume->SetInputData(0, surface);\n\n  // Compute a simple window/level based on scalar range.\n  vtkNew<vtkWindowLevelLookupTable> wlLut;\n  double range = imageReader->GetOutput()->GetScalarRange()[1] -\n      imageReader->GetOutput()->GetScalarRange()[0];\n  double level = (imageReader->GetOutput()->GetScalarRange()[1] +\n                  imageReader->GetOutput()->GetScalarRange()[0]) /\n      2.0;\n  wlLut->SetWindow(range);\n  wlLut->SetLevel(level);\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(sampleVolume->GetOutputPort());\n  mapper->SetLookupTable(wlLut);\n  mapper->SetScalarRange(0, 255);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CurvedReformation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Set the camera for viewing medical images.\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->GetActiveCamera()->SetPosition(0, 0, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 1, 0);\n  renderer->ResetCamera();\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkPolyData> SweepLine(vtkPolyData* line, double direction[3],\n                                       double distance, unsigned int cols)\n{\n  unsigned int rows = line->GetNumberOfPoints();\n  double spacing = distance / cols;\n  vtkNew<vtkPolyData> surface;\n\n  // Generate the points.\n  cols++;\n  unsigned int numberOfPoints = rows * cols;\n  unsigned int numberOfPolys = (rows - 1) * (cols - 1);\n  vtkNew<vtkPoints> points;\n  points->Allocate(numberOfPoints);\n  vtkNew<vtkCellArray> polys;\n  polys->Allocate(numberOfPolys * 4);\n\n  double x[3];\n  unsigned int cnt = 0;\n  for (unsigned int row = 0; row < rows; row++)\n  {\n    for (unsigned int col = 0; col < cols; col++)\n    {\n      double p[3];\n      line->GetPoint(row, p);\n      x[0] = p[0] + direction[0] * col * spacing;\n      x[1] = p[1] + direction[1] * col * spacing;\n      x[2] = p[2] + direction[2] * col * spacing;\n      points->InsertPoint(cnt++, x);\n    }\n  }\n  // Generate the quads.\n  vtkIdType pts[4];\n  for (unsigned int row = 0; row < rows - 1; row++)\n  {\n    for (unsigned int col = 0; col < cols - 1; col++)\n    {\n      pts[0] = col + row * (cols);\n      pts[1] = pts[0] + 1;\n      pts[2] = pts[0] + cols + 1;\n      pts[3] = pts[0] + cols;\n      polys->InsertNextCell(4, pts);\n    }\n  }\n  surface->SetPoints(points);\n  surface->SetPolys(polys);\n\n  return surface;\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/CurvedReformation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CurvedReformation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  IOImage\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CurvedReformation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CurvedReformation MACOSX_BUNDLE CurvedReformation.cxx )\n  target_link_libraries(CurvedReformation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CurvedReformation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/CurvedReformation/#download-and-build-curvedreformation","title":"Download and Build CurvedReformation","text":"

        Click here to download CurvedReformation and its CMakeLists.txt file. Once the tarball CurvedReformation.tar has been downloaded and extracted,

        cd CurvedReformation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CurvedReformation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/DepthSortPolyData/","title":"DepthSortPolyData","text":"

        vtk-examples/Cxx/Visualization/DepthSortPolyData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/DepthSortPolyData/#description","title":"Description","text":"
        • Contributed by: Lars Friedrich

        This is a C++-port of the VTK example '''DepthSort.py''' found in [VTKSourceDir/Examples/VisualizationAlgorithms/Python(https://gitlab.kitware.com/vtk/vtk/blob/master/Examples/VisualizationAlgorithms/Python/DepthSort.py). It was slightly modified. It generates 5 spheres with configurable PHI and THETA resolution. The spheres overlap. Therefore, correct blending and visualization in general requires depth sorting of the underlying polygons which will not happen when simply using a poly data mapper. Depth sorting can be achieved by connecting a vtkDepthSortPolyData filter to the mapper instead of the pure poly data.

        "},{"location":"Cxx/Visualization/DepthSortPolyData/#program-usage","title":"Program Usage","text":"
        Usage: ./DepthSortPolyData DepthSortFlag ThetaResolution  PhiResolution ScalarVisibilityFlag*\n\nDepthSortFlag ... activate/deactivate the depth sorting algorithm\n\nThetaResolution ... THETA resolution for the spheres\n\nPhiResolution ... PHI resolution for the spheres\n\nScalarVisibilityFlag ... show/hide the found depth values as scalars\n

        Example calls:

        ./DepthSortPolyData 0 100 100 0\n... will render the spheres 'as usual' (without depth sorting); in general you will be confronted with situations (specific view directions) where you cannot determine whether a small sphere is behind or in front of the big center sphere\n
        ./DepthSortPolyData 1 100 100 0\n... will render the spheres using depth sorting; the sphere depth order should now be visually traceable\n
        ./DepthSortPolyData 1 100 100 1\n... will render the spheres using depth sorting; the depth values are mapped to the spheres and renderd on the surfaces\n

        Using higher PHI/THETA resolutions shows how depth sorting reduces the frame rate.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/DepthSortPolyData/#code","title":"Code","text":"

        DepthSortPolyData.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkDepthSortPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc != 5)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" DepthSortFlag ThetaResolution \"\n              << \" PhiResolution ScalarVisibilityFlag\" << std::endl;\n    std::cerr << \"1 100 100 0\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  bool doDepthSort = atoi(argv[1]) == 1;\n  int theta = atoi(argv[2]);\n  int phi = atoi(argv[3]);\n  bool scalarVisibility = atoi(argv[4]) == 1;\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a bunch of spheres that overlap and cannot be easily arranged\n  // so that the blending works without sorting. They are appended into a\n  // single vtkPolyData because the filter only sorts within a single\n  // vtkPolyData input.\n  vtkNew<vtkAppendPolyData> appendData;\n\n  for (int i = 0; i < 5; i++)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetThetaResolution(theta);\n    sphereSource->SetPhiResolution(phi);\n    sphereSource->SetRadius(\n        0.5); // all sphere except the center one should have radius = 0.5\n    switch (i)\n    {\n    case 0:\n      sphereSource->SetRadius(1);\n      sphereSource->SetCenter(0, 0, 0);\n      break;\n    case 1:\n      sphereSource->SetCenter(1, 0, 0);\n      break;\n    case 2:\n      sphereSource->SetCenter(-1, 0, 0);\n      break;\n    case 3:\n      sphereSource->SetCenter(0, 1, 0);\n      break;\n    case 4:\n      sphereSource->SetCenter(0, -1, 0);\n      break;\n    }\n    sphereSource->Update();\n    appendData->AddInputConnection(sphereSource->GetOutputPort());\n  }\n\n  // The dephSort object is set up to generate scalars representing\n  // the sort depth.  A camera is assigned for the sorting. The camera\n  // defines the sort vector (position and focal point).\n  vtkNew<vtkCamera> camera;\n  vtkNew<vtkDepthSortPolyData> depthSort;\n\n  depthSort->SetInputConnection(appendData->GetOutputPort());\n  depthSort->SetDirectionToBackToFront();\n  depthSort->SetVector(1, 1, 1);\n  depthSort->SetCamera(camera);\n  depthSort->SortScalarsOn();\n  depthSort->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  if (doDepthSort)\n  {\n    mapper->SetInputConnection(depthSort->GetOutputPort());\n  }\n  else\n  {\n    mapper->SetInputConnection(appendData->GetOutputPort());\n  }\n\n  mapper->SetScalarVisibility(scalarVisibility);\n  if (scalarVisibility)\n  {\n    mapper->SetScalarRange(0, depthSort->GetOutput()->GetNumberOfCells());\n  }\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetOpacity(0.5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Crimson\").GetData());\n  actor->RotateX(-72); // put the object in a position where it is easy\n  // to see different overlapping regions\n\n  // If an Prop3D is supplied, then its transformation matrix is taken\n  // into account during sorting.\n  depthSort->SetProp3D(actor);\n\n  // Create the RenderWindow, Renderer and both Actors\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetActiveCamera(camera);\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DepthSortPolyData\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->SetSize(600, 400);\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(2.2); // so the object is larger\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/DepthSortPolyData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DepthSortPolyData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersHybrid\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DepthSortPolyData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DepthSortPolyData MACOSX_BUNDLE DepthSortPolyData.cxx )\n  target_link_libraries(DepthSortPolyData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DepthSortPolyData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/DepthSortPolyData/#download-and-build-depthsortpolydata","title":"Download and Build DepthSortPolyData","text":"

        Click here to download DepthSortPolyData and its CMakeLists.txt file. Once the tarball DepthSortPolyData.tar has been downloaded and extracted,

        cd DepthSortPolyData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DepthSortPolyData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/DisplayCoordinateAxes/","title":"DisplayCoordinateAxes","text":"

        vtk-examples/Cxx/Visualization/DisplayCoordinateAxes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/DisplayCoordinateAxes/#description","title":"Description","text":"

        This example shows how to display the coordinate axes in the render window.

        Seealso

        Axes.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/DisplayCoordinateAxes/#code","title":"Code","text":"

        DisplayCoordinateAxes.cxx

        #include <vtkActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(1.0);\n  sphereSource->Update();\n\n  vtkPolyData* polydata = sphereSource->GetOutput();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  // Create an actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"DisplayCoordinateAxes\");\n  renderWindow->AddRenderer(renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkAxesActor> axes;\n\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  double rgba[4]{0.0, 0.0, 0.0, 0.0};\n  colors->GetColor(\"Carrot\", rgba);\n  widget->SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n  widget->SetOrientationMarker(axes);\n  widget->SetInteractor(renderWindowInteractor);\n  widget->SetViewport(0.0, 0.0, 0.4, 0.4);\n  widget->SetEnabled(1);\n  widget->InteractiveOn();\n\n  renderer->GetActiveCamera()->Azimuth(50);\n  renderer->GetActiveCamera()->Elevation(-30);\n\n  renderer->ResetCamera();\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/DisplayCoordinateAxes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DisplayCoordinateAxes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DisplayCoordinateAxes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DisplayCoordinateAxes MACOSX_BUNDLE DisplayCoordinateAxes.cxx )\n  target_link_libraries(DisplayCoordinateAxes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DisplayCoordinateAxes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/DisplayCoordinateAxes/#download-and-build-displaycoordinateaxes","title":"Download and Build DisplayCoordinateAxes","text":"

        Click here to download DisplayCoordinateAxes and its CMakeLists.txt file. Once the tarball DisplayCoordinateAxes.tar has been downloaded and extracted,

        cd DisplayCoordinateAxes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DisplayCoordinateAxes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/DisplayQuadricSurfaces/","title":"DisplayQuadricSurfaces","text":"

        vtk-examples/Cxx/Visualization/DisplayQuadricSurfaces

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/DisplayQuadricSurfaces/#description","title":"Description","text":"

        This example demonstrates how to display several types of quadric surfaces.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/DisplayQuadricSurfaces/#code","title":"Code","text":"

        DisplayQuadricSurfaces.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\nnamespace {\nvoid Other();\nvoid Sphere();\nvoid Cone();\nvoid Ellipsoid();\nvoid Cylinder();\nvoid HyperboloidOneSheet();\nvoid HyperboloidTwoSheets();\nvoid HyperbolicParaboloid();\nvoid EllipticParaboloid();\n\nvoid PlotFunction(vtkQuadric* quadric, double value);\n} // namespace\n\nint main(int, char*[])\n{\n  // Other();\n  // Sphere();\n  // Cone();\n  // Ellipsoid();\n  // Cylinder();\n  // HyperboloidOneSheet();\n  // HyperboloidTwoSheets();\n  // HyperbolicParaboloid();\n  EllipticParaboloid();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid Sphere()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, 1, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2 + 1*z^2\n\n  PlotFunction(quadric, 1.0);\n}\n\nvoid EllipticParaboloid()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, 0, 0, 0, 0, 0, 0, -1, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2\n\n  PlotFunction(quadric, 10.0);\n}\n\nvoid HyperbolicParaboloid()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, -1, 0, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 - 1*y^2\n\n  PlotFunction(quadric, 10.0);\n}\n\nvoid Cylinder()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, 0, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2\n\n  PlotFunction(quadric, 1.0);\n}\n\nvoid HyperboloidOneSheet()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2\n\n  PlotFunction(quadric, 1.0);\n}\n\nvoid HyperboloidTwoSheets()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2\n\n  PlotFunction(quadric, -1.0);\n}\n\nvoid Ellipsoid()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, 2, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2 + 1*z^2\n\n  PlotFunction(quadric, -1.0);\n}\n\nvoid Cone()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 1*x^2 + 1*y^2 - 1*z^2\n  PlotFunction(quadric, 0.0);\n}\n\nvoid Other()\n{\n  // Create the quadric function definition.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0);\n\n  // F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x +\n  // a7*y + a8*z + a9 F(x,y,z) = 0.5*x^2 + 1*y^2 + 0.2*z^2 + 0*x*y + 0.1*y*z +\n  // 0*x*z + 0*x + 0.2*y + 0*z + 0\n  PlotFunction(quadric, 1.0);\n}\n\nvoid PlotFunction(vtkQuadric* quadric, double value)\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Sample the quadric function.\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(quadric);\n  // double xmin = 0, xmax=1, ymin=0, ymax=1, zmin=0, zmax=1;\n  double bounds[6]{-10, 11, -10, 10, -10, 10};\n  sample->SetModelBounds(bounds);\n\n  // Create five surfaces F(x,y,z) = constant between range specified.\n  /*\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(5, 0.0, 1.2);\n  */\n\n  // Create the 0 isosurface.\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(sample->GetOutputPort());\n  contours->GenerateValues(1, value, value);\n\n  // Map the contours to graphical primitives.\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contours->GetOutputPort());\n  contourMapper->SetScalarRange(0.0, 1.2);\n\n  // Create an actor for the contours.\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n\n  // -- create a box around the function to indicate the sampling volume --\n\n  // Create outline.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(sample->GetOutputPort());\n\n  // Map it to graphics primitives.\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  // Create an actor for it.\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Setup the window.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"DisplayQuadricSurfaces\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the scene.\n  ren1->AddActor(contourActor);\n  ren1->AddActor(outlineActor);\n  ren1->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n\n  // Render and interact.\n  renWin->Render();\n  ren1->GetActiveCamera()->Azimuth(-55);\n  ren1->GetActiveCamera()->Elevation(15);\n  iren->Start();\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/DisplayQuadricSurfaces/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DisplayQuadricSurfaces)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DisplayQuadricSurfaces: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DisplayQuadricSurfaces MACOSX_BUNDLE DisplayQuadricSurfaces.cxx )\n  target_link_libraries(DisplayQuadricSurfaces PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DisplayQuadricSurfaces\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/DisplayQuadricSurfaces/#download-and-build-displayquadricsurfaces","title":"Download and Build DisplayQuadricSurfaces","text":"

        Click here to download DisplayQuadricSurfaces and its CMakeLists.txt file. Once the tarball DisplayQuadricSurfaces.tar has been downloaded and extracted,

        cd DisplayQuadricSurfaces/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DisplayQuadricSurfaces\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/DistanceToCamera/","title":"DistanceToCamera","text":"

        vtk-examples/Cxx/Visualization/DistanceToCamera

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/DistanceToCamera/#description","title":"Description","text":"

        This example produces two arrows whose scale stays fixed with respect to the distance from the camera (i.e. as you zoom in and out). Standard spheres are drawn for comparison.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/DistanceToCamera/#code","title":"Code","text":"

        DistanceToCamera.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkDistanceToCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  //---------------------------------------------------------------------------\n  // Draw some arrows that maintain a fixed size during zooming.\n\n  // Create a set of points.\n  vtkNew<vtkPointSource> fixedPointSource;\n  fixedPointSource->SetNumberOfPoints(2);\n\n  // Calculate the distance to the camera of each point.\n  vtkNew<vtkDistanceToCamera> distanceToCamera;\n  distanceToCamera->SetInputConnection(fixedPointSource->GetOutputPort());\n  distanceToCamera->SetScreenSize(100.0);\n\n  // Glyph each point with an arrow.\n  vtkNew<vtkArrowSource> arrow;\n  vtkNew<vtkGlyph3D> fixedGlyph;\n  fixedGlyph->SetInputConnection(distanceToCamera->GetOutputPort());\n  fixedGlyph->SetSourceConnection(arrow->GetOutputPort());\n\n  // Scale each point.\n  fixedGlyph->SetScaleModeToScaleByScalar();\n  fixedGlyph->SetInputArrayToProcess(\n      0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, \"DistanceToCamera\");\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> fixedMapper;\n  fixedMapper->SetInputConnection(fixedGlyph->GetOutputPort());\n  fixedMapper->SetScalarVisibility(false);\n\n  // Create an actor.\n  vtkNew<vtkActor> fixedActor;\n  fixedActor->SetMapper(fixedMapper);\n  fixedActor->GetProperty()->SetColor(colors->GetColor3d(\"Cyan\").GetData());\n\n  //---------------------------------------------------------------------------\n  // Draw some spheres that get bigger when zooming in.\n  // Create a set of points.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(4);\n\n  // Glyph each point with a sphere.\n  vtkNew<vtkSphereSource> sphere;\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(pointSource->GetOutputPort());\n  glyph->SetSourceConnection(sphere->GetOutputPort());\n  glyph->SetScaleFactor(0.1);\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph->GetOutputPort());\n  mapper->SetScalarVisibility(false);\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  //---------------------------------------------------------------------------\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DistanceToCamera\");\n\n  // Give DistanceToCamera a pointer to the renderer.\n  distanceToCamera->SetRenderer(renderer);\n\n  // Add the actors to the scene.\n  renderer->AddActor(fixedActor);\n  renderer->AddActor(actor);\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/DistanceToCamera/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DistanceToCamera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DistanceToCamera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DistanceToCamera MACOSX_BUNDLE DistanceToCamera.cxx )\n  target_link_libraries(DistanceToCamera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DistanceToCamera\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/DistanceToCamera/#download-and-build-distancetocamera","title":"Download and Build DistanceToCamera","text":"

        Click here to download DistanceToCamera and its CMakeLists.txt file. Once the tarball DistanceToCamera.tar has been downloaded and extracted,

        cd DistanceToCamera/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DistanceToCamera\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/DrawText/","title":"DrawText","text":"

        vtk-examples/Cxx/Visualization/DrawText

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/DrawText/#description","title":"Description","text":"

        This example writes \"Hello world\" in the bottom left corner of the render window. The text size and color are set. There are many properties that can be set that control how the text is changed when the render window is resized, but they are not covered in this example.

        This example draws text in 2D. For an example using 3D text that can be placed on the scene like a regular vtkActor, see VectorText. For an example of drawing text, also in 2D, but into a vtkImageData object rather than into the render window, see ImageText.

        Seealso

        TextWidget

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/DrawText/#code","title":"Code","text":"

        DrawText.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(sphereSource->GetOutput());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer.\n  vtkNew<vtkRenderer> renderer;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Create a render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DrawText\");\n\n  // Create an interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Setup the text and add it to the renderer.\n  vtkNew<vtkTextActor> textActor;\n  textActor->SetInput(\"Hello world\");\n  textActor->SetPosition2(10, 40);\n  textActor->GetTextProperty()->SetFontSize(24);\n  textActor->GetTextProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  renderer->AddActor2D(textActor);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/DrawText/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DrawText)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DrawText: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DrawText MACOSX_BUNDLE DrawText.cxx )\n  target_link_libraries(DrawText PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DrawText\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/DrawText/#download-and-build-drawtext","title":"Download and Build DrawText","text":"

        Click here to download DrawText and its CMakeLists.txt file. Once the tarball DrawText.tar has been downloaded and extracted,

        cd DrawText/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DrawText\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/EdgePoints/","title":"EdgePoints","text":"

        vtk-examples/Cxx/Visualization/EdgePoints

        "},{"location":"Cxx/Visualization/EdgePoints/#description","title":"Description","text":"

        This example uses vtkEdgePoints to generat a set of points that lie on an isosurface. Points are generated along the edges of cells that starddle the given iso value. Unlike vtkMarchingCubes it does not generate normals at the points.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/EdgePoints/#code","title":"Code","text":"

        EdgePoints.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkEdgePoints.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    cout << \"Usage: \" << argv[0] << \" file.mhd e.g. mhd 500\" << endl;\n    return EXIT_FAILURE;\n  }\n\n  double isoValue = 0.0;\n  if (argc > 2)\n  {\n    isoValue = std::stod(std::string(argv[2]));\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> isoColor{{255, 125, 64}};\n  colors->SetColor(\"IsoColor\", isoColor.data());\n  std::array<unsigned char, 4> bkg{{51, 77, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  vtkNew<vtkRenderer> aRenderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aRenderer);\n  renWin->SetWindowName(\"EdgePoints\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkEdgePoints> isoExtractor;\n  isoExtractor->SetInputConnection(reader->GetOutputPort());\n  isoExtractor->SetValue(isoValue);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(isoExtractor->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> iso;\n  iso->SetMapper(isoMapper);\n  iso->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"Bisque\").GetData());\n\n  // An outline provides context around the data.\n  //\n  vtkNew<vtkOutlineFilter> outlineData;\n  outlineData->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outlineData->GetOutputPort());\n\n  vtkNew<vtkActor> outline;\n  outline->SetMapper(mapOutline);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // It is convenient to create an initial view of the data. The FocalPoint\n  // and Position form a vector direction. Later on (ResetCamera() method)\n  // this vector is used to position the camera to look at the data in\n  // this direction.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n\n  // Actors are added to the renderer. An initial camera view is created.\n  // The Dolly() method moves the camera towards the FocalPoint,\n  // thereby enlarging the image.\n  aRenderer->AddActor(outline);\n  aRenderer->AddActor(iso);\n  aRenderer->SetActiveCamera(aCamera);\n  aRenderer->ResetCamera();\n  aCamera->Dolly(1.1);\n\n  // Set a background color for the renderer and set the size of the\n  // render window (expressed in pixels).\n  aRenderer->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  renWin->SetSize(640, 480);\n\n  // Note that when camera movement occurs (as it does in the Dolly()\n  // method), the clipping planes often need adjusting. Clipping planes\n  // consist of two planes: near and far along the view direction. The\n  // near plane clips out objects in front of the plane; the far plane\n  // clips out objects behind the plane. This way only what is drawn\n  // between the planes is actually rendered.\n  aRenderer->ResetCameraClippingRange();\n\n  // Initialize the event loop and then start it.\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/EdgePoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(EdgePoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersModeling\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"EdgePoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(EdgePoints MACOSX_BUNDLE EdgePoints.cxx )\n  target_link_libraries(EdgePoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS EdgePoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/EdgePoints/#download-and-build-edgepoints","title":"Download and Build EdgePoints","text":"

        Click here to download EdgePoints and its CMakeLists.txt file. Once the tarball EdgePoints.tar has been downloaded and extracted,

        cd EdgePoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./EdgePoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ElevationBandsWithGlyphs/","title":"ElevationBandsWithGlyphs","text":"

        vtk-examples/Cxx/Visualization/ElevationBandsWithGlyphs

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ElevationBandsWithGlyphs/#description","title":"Description","text":"

        In this example we are coloring the surface by partitioning the elevation into bands and using arrows to display the normals on the surface.

        Rather beautiful surfaces are generated.

        The banded contour filter and an indexed lookup table are used along with the elevation filter to generate the banding on the surface. To further enhance the surface, the surface normals are glyphed and colored by elevation using an ordinal lookup table.

        Feel free to experiment with different color schemes and/or the other sources from the parametric function group or a cone etc.

        You will usually need to adjust the parameters for maskPts, arrow and glyph for a nice appearance. Do this in the function MakeGlyphs().

        You may also need to add an elevation filter to generate the scalars as demonstrated in MakeSphere().

        PrintBandsFrequencies() allows you to inspect the bands and the number of scalars in each band. This are useful if you want to get an idea of the distribution of the scalars in each band.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ElevationBandsWithGlyphs/#code","title":"Code","text":"

        ElevationBandsWithGlyphs.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkColorSeries.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkDelaunay2D.h>\n#include <vtkDoubleArray.h>\n#include <vtkElevationFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkReverseSense.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTriangleFilter.h>\n#include <vtkVariant.h>\n#include <vtkVariantArray.h>\n#include <vtkVersion.h>\n\n#if VTK_VERSION_NUMBER >= 90020210809ULL\n#define HAS_COW\n#include <vtkCameraOrientationWidget.h>\n#endif\n\n#include <algorithm>\n#include <array>\n#include <cctype>\n#include <cmath>\n#include <cstdlib>\n#include <cstring>\n#include <functional>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <numeric>\n#include <set>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n//! Generate elevations over the surface.\n/*!\n@param src - the vtkPolyData source.\n@return elev - the elevations.\n*/\nvtkSmartPointer<vtkPolyData> GetElevations(vtkPolyData* src);\n\nvtkSmartPointer<vtkPolyData> GetHills();\nvtkSmartPointer<vtkPolyData> GetParametricHills();\nvtkSmartPointer<vtkPolyData> GetParametricTorus();\nvtkSmartPointer<vtkPolyData> GetPlane();\nvtkSmartPointer<vtkPolyData> GetSphere();\nvtkSmartPointer<vtkPolyData> GetTorus();\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& source);\n\nvtkSmartPointer<vtkColorSeries> GetColorSeries();\n\nvtkSmartPointer<vtkLookupTable> GetCategoricalLUT();\n\nvtkSmartPointer<vtkLookupTable> GetOrdinaLUT();\n\nvtkSmartPointer<vtkLookupTable> GetDivergingLUT();\n\nvtkSmartPointer<vtkLookupTable> ReverseLUT(vtkLookupTable* lut);\n\n//!  Glyph the normals on the surface.\n/*!\n@param src - the vtkPolyData source.\n#param scaleFactor - the scale factor for the glyphs.\n@param reverseNormals - if True the normals on the surface are reversed.\n@return The glyphs.\n*/\nvtkNew<vtkGlyph3D> GetGlyphs(vtkPolyData* src, double const& scaleFactor = 1.0,\n                             bool const& reverseNormals = false);\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision = 2,\n                                            bool const& nearestInteger = false);\n\n//! Divide a range into custom bands\n/*!\nYou need to specify each band as an array [r1, r2] where r1 < r2 and\nappend these to a vector.\nThe vector should ultimately look\nlike this: [[r1, r2], [r2, r3], [r3, r4]...]\n\n@param dR - [min, max] the range that is to be covered by the bands.\n@param numberOfBands - the number of bands, a positive integer.\n@param myBands - the bands.\n@return  A map consisting of the band inxex and [min, midpoint, max] for each\nband.\n*/\nstd::map<int, std::vector<double>>\nGetCustomBands(double const dR[2], int const& numberOfBands,\n               std::vector<std::array<double, 2>> const& myBands);\n\n//! Divide a range into integral bands\n/*!\nDivide a range into bands\n@param dR - [min, max] the range that is to be covered by the bands.\n@returnA map consisting of the band inxex and [min, midpoint, max] for each\nband.\n*/\nstd::map<int, std::vector<double>> GetIntegralBands(double const dR[2]);\n\n//! Count the number of scalars in each band.\n/*\n * The scalars used are the active scalars in the polydata.\n *\n * @param bands - the bands.\n * @param src - the vtkPolyData source.\n * @return The frequencies of the scalars in each band.\n */\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src);\n//!\n/*\n * The bands and frequencies are adjusted so that the first and last\n *  frequencies in the range are non-zero.\n * @param bands: The bands.\n * @param freq: The frequencies.\n */\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq);\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision = 2);\n\n} // namespace\n\nint main(int, char*[])\n{\n  // Get the surface\n  std::string desiredSurface{\"RandomHills\"};\n  // desiredSurface = \"Hills\";\n  // desiredSurface = \"ParametricTorus\";\n  // desiredSurface = \"Plane\";\n  // desiredSurface = \"RandomHills\";\n  // desiredSurface = \"Sphere\";\n  // desiredSurface = \"Torus\";\n  auto source = GetSource(desiredSurface);\n\n  // The length of the normal arrow glyphs.\n  auto scaleFactor = 1.0;\n  if (desiredSurface == \"Hills\")\n  {\n    scaleFactor = 0.5;\n  }\n  if (desiredSurface == \"Sphere\")\n  {\n    scaleFactor = 2.0;\n  }\n  std::cout << desiredSurface << std::endl;\n\n  source->GetPointData()->SetActiveScalars(\"Elevation\");\n  auto scalarRange =\n      source->GetPointData()->GetScalars(\"Elevation\")->GetRange();\n\n  auto lut = GetCategoricalLUT();\n  auto lut1 = GetOrdinaLUT();\n  lut->SetTableRange(scalarRange);\n  lut1->SetTableRange(scalarRange);\n  vtkIdType numberOfBands = lut->GetNumberOfTableValues();\n  auto precision = 10;\n  auto bands = GetBands(scalarRange, numberOfBands, precision, false);\n\n  if (desiredSurface == \"RandomHills\")\n  {\n    // These are my custom bands.\n    // Generated by first running:\n    // bands = GetBands(scalarRange, numberOfBands, precision, false);\n    // then:\n    //  std::vector<int> freq = Frequencies(bands, source);\n    //  PrintBandsFrequencies(bands, freq);\n    // Finally using the output to create this table:\n    std::vector<std::array<double, 2>> myBands = {\n        {0, 1.0},   {1.0, 2.0}, {2.0, 3.0}, {3.0, 4.0},\n        {4.0, 5.0}, {5.0, 6.0}, {6.0, 7.0}, {7.0, 8.0}};\n    // Comment this out if you want to see how allocating\n    // equally spaced bands works.\n    bands = GetCustomBands(scalarRange, numberOfBands, myBands);\n    // bands = GetBands(scalarRange, numberOfBands, precision, false);\n    // Adjust the number of table values\n  }\n  lut->SetNumberOfTableValues(static_cast<vtkIdType>(bands.size()));\n  lut1->SetNumberOfTableValues(static_cast<vtkIdType>(bands.size()));\n\n  // Let's do a frequency table.\n  auto freq = GetFrequencies(bands, source);\n  AdjustFrequencyRanges(bands, freq);\n  PrintBandsFrequencies(bands, freq);\n\n  scalarRange[0] = bands.begin()->second[0];\n  scalarRange[1] = std::prev(bands.end())->second[2];\n  lut->SetTableRange(scalarRange);\n  lut->SetNumberOfTableValues(bands.size());\n\n  // We will use the midpoint of the band as the label.\n  std::vector<std::string> labels;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    std::ostringstream os;\n    os << std::fixed << std::setw(6) << std::setprecision(2) << p->second[1];\n    labels.push_back(os.str());\n  }\n\n  // Annotate\n  vtkNew<vtkVariantArray> values;\n  for (size_t i = 0; i < labels.size(); ++i)\n  {\n    values->InsertNextValue(vtkVariant(labels[i]));\n  }\n  for (vtkIdType i = 0; i < values->GetNumberOfTuples(); ++i)\n  {\n    lut->SetAnnotation(i, values->GetValue(i).ToString());\n  }\n\n  // Create a lookup table with the colors reversed.\n  auto lutr = ReverseLUT(lut);\n\n  // Create the contour bands.\n  vtkNew<vtkBandedPolyDataContourFilter> bcf;\n  bcf->SetInputData(source);\n  // Use either the minimum or maximum value for each band.\n  int i = 0;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    bcf->SetValue(i, p->second[2]);\n    ++i;\n  }\n  // We will use an indexed lookup table.\n  bcf->SetScalarModeToIndex();\n  bcf->GenerateContourEdgesOn();\n\n  // Generate the glyphs on the original surface.\n  auto glyph = GetGlyphs(source, scaleFactor, false);\n\n  // ------------------------------------------------------------\n  // Create the mappers and actors\n  // ------------------------------------------------------------\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  colors->SetColor(\"BkgColor\",\n                   std::array<unsigned char, 4>{179, 204, 255, 255}.data());\n  colors->SetColor(\"ParaViewBkg\",\n                   std::array<unsigned char, 4>{82, 87, 110, 255}.data());\n\n  vtkNew<vtkPolyDataMapper> srcMapper;\n  srcMapper->SetInputConnection(bcf->GetOutputPort());\n  srcMapper->SetScalarRange(scalarRange);\n  srcMapper->SetLookupTable(lut);\n  srcMapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> srcActor;\n  srcActor->SetMapper(srcMapper);\n\n  // Create contour edges\n  vtkNew<vtkPolyDataMapper> edgeMapper;\n  edgeMapper->SetInputData(bcf->GetContourEdgesOutput());\n  edgeMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> edgeActor;\n  edgeActor->SetMapper(edgeMapper);\n  edgeActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkPolyDataMapper> glyphMapper;\n  glyphMapper->SetInputConnection(glyph->GetOutputPort());\n  glyphMapper->SetScalarModeToUsePointFieldData();\n  glyphMapper->SetColorModeToMapScalars();\n  glyphMapper->ScalarVisibilityOn();\n  glyphMapper->SelectColorArray(\"Elevation\");\n  // Colour by scalars.\n  glyphMapper->SetLookupTable(lut1);\n  glyphMapper->SetScalarRange(scalarRange);\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(glyphMapper);\n\n  auto windowWidth = 800;\n  auto windowHeight = 800;\n\n  // Add scalar bars.\n  vtkNew<vtkScalarBarActor> scalarBar;\n  // This LUT puts the lowest value at the top of the scalar bar.\n  // scalarBar->SetLookupTable(lut);\n  // Use this LUT if you want the highest value at the top.\n  scalarBar->SetLookupTable(lutr);\n  scalarBar->SetTitle(\"Elevation\");\n  scalarBar->GetTitleTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->GetAnnotationTextProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  scalarBar->UnconstrainedFontSizeOn();\n  scalarBar->SetMaximumWidthInPixels(windowWidth / 8);\n  scalarBar->SetMaximumHeightInPixels(windowHeight / 3);\n  scalarBar->SetPosition(0.85, 0.05);\n\n  // ------------------------------------------------------------\n  // Create the RenderWindow, Renderer and Interactor\n  // ------------------------------------------------------------\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  renWin->AddRenderer(ren);\n  // Important: The interactor must be set prior to enabling the widget.\n  iren->SetRenderWindow(renWin);\n#ifdef HAS_COW\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(ren);\n  // Enable the widget.\n  camOrientManipulator->On();\n#endif\n\n  // add actors\n  ren->AddViewProp(srcActor);\n  ren->AddViewProp(edgeActor);\n  ren->AddViewProp(glyphActor);\n  ren->AddActor2D(scalarBar);\n\n  ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n  renWin->SetSize(windowWidth, windowHeight);\n  renWin->SetWindowName(\"ElevationBandsWithGlyphs\");\n\n  if (desiredSurface == \"RandomHills\")\n  {\n    auto camera = ren->GetActiveCamera();\n    camera->SetPosition(10.9299, 59.1505, 24.9823);\n    camera->SetFocalPoint(2.21692, 7.97545, 7.75135);\n    camera->SetViewUp(-0.230136, 0.345504, -0.909761);\n    camera->SetDistance(54.6966);\n    camera->SetClippingRange(36.3006, 77.9852);\n    renWin->Render();\n  }\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> GetElevations(vtkPolyData* src)\n{\n  double bounds[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};\n  src->GetBounds(bounds);\n  if (std::abs(bounds[2]) < 1.0e-8 && std::abs(bounds[3]) < 1.0e-8)\n  {\n    bounds[3] = bounds[2] + 1;\n  }\n  vtkNew<vtkElevationFilter> elevFilter;\n  elevFilter->SetInputData(src);\n  elevFilter->SetLowPoint(0, bounds[2], 0);\n  elevFilter->SetHighPoint(0, bounds[3], 0);\n  elevFilter->SetScalarRange(bounds[2], bounds[3]);\n  elevFilter->Update();\n\n  return elevFilter->GetPolyDataOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetHills()\n{\n  // Create four hills on a plane.\n  // This will have regions of negative, zero and positive Gsaussian curvatures.\n\n  auto xRes = 50;\n  auto yRes = 50;\n  auto xMin = -5.0;\n  auto xMax = 5.0;\n  auto dx = (xMax - xMin) / (xRes - 1.0);\n  auto yMin = -5.0;\n  auto yMax = 5.0;\n  auto dy = (yMax - yMin) / (xRes - 1.0);\n\n  // Make a grid.\n  vtkNew<vtkPoints> points;\n  for (auto i = 0; i < xRes; ++i)\n  {\n    auto x = xMin + i * dx;\n    for (auto j = 0; j < yRes; ++j)\n    {\n      auto y = yMin + j * dy;\n      points->InsertNextPoint(x, y, 0);\n    }\n  }\n\n  // Add the grid points to a polydata object.\n  vtkNew<vtkPolyData> plane;\n  plane->SetPoints(points);\n\n  // Triangulate the grid.\n  vtkNew<vtkDelaunay2D> delaunay;\n  delaunay->SetInputData(plane);\n  delaunay->Update();\n\n  auto polydata = delaunay->GetOutput();\n\n  vtkNew<vtkDoubleArray> elevation;\n  elevation->SetNumberOfTuples(points->GetNumberOfPoints());\n\n  //  We define the parameters for the hills here.\n  // [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n  std::vector<std::array<double, 5>> hd{{-2.5, -2.5, 2.5, 6.5, 3.5},\n                                        {2.5, 2.5, 2.5, 2.5, 2},\n                                        {5.0, -2.5, 1.5, 1.5, 2.5},\n                                        {-5.0, 5, 2.5, 3.0, 3}};\n  std::array<double, 2> xx{0.0, 0.0};\n  for (auto i = 0; i < points->GetNumberOfPoints(); ++i)\n  {\n    auto x = polydata->GetPoint(i);\n    for (size_t j = 0; j < hd.size(); ++j)\n    {\n      xx[0] = std::pow(x[0] - hd[j][0] / hd[j][2], 2.0);\n      xx[1] = std::pow(x[1] - hd[j][1] / hd[j][3], 2.0);\n      x[2] += hd[j][4] * std::exp(-(xx[0] + xx[1]) / 2.0);\n    }\n    polydata->GetPoints()->SetPoint(i, x);\n    elevation->SetValue(i, x[2]);\n  }\n\n  vtkNew<vtkFloatArray> textures;\n  textures->SetNumberOfComponents(2);\n  textures->SetNumberOfTuples(2 * polydata->GetNumberOfPoints());\n  textures->SetName(\"Textures\");\n\n  for (auto i = 0; i < xRes; ++i)\n  {\n    float tc[2];\n    tc[0] = i / (xRes - 1.0);\n    for (auto j = 0; j < yRes; ++j)\n    {\n      // tc[1] = 1.0 - j / (yRes - 1.0);\n      tc[1] = j / (yRes - 1.0);\n      textures->SetTuple(static_cast<vtkIdType>(i) * yRes + j, tc);\n    }\n  }\n\n  polydata->GetPointData()->SetScalars(elevation);\n  polydata->GetPointData()->GetScalars()->SetName(\"Elevation\");\n  polydata->GetPointData()->SetTCoords(textures);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(polydata);\n  normals->SetInputData(polydata);\n  normals->SetFeatureAngle(30);\n  normals->SplittingOff();\n\n  vtkNew<vtkTransform> tr1;\n  tr1->RotateX(-90);\n\n  vtkNew<vtkTransformPolyDataFilter> tf1;\n  tf1->SetInputConnection(normals->GetOutputPort());\n  tf1->SetTransform(tr1);\n  tf1->Update();\n\n  return tf1->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetParametricHills()\n{\n  vtkNew<vtkParametricRandomHills> fn;\n  fn->AllowRandomGenerationOn();\n  fn->SetRandomSeed(1);\n  fn->SetNumberOfHills(30);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetParametricFunction(fn);\n  source->SetUResolution(50);\n  source->SetVResolution(50);\n  source->SetScalarModeToZ();\n  source->Update();\n\n  // Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n  // source->GetOutput()->GetPointData()->GetNormals()->SetName(\"Normals\");\n  // source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Scalars\");\n  // Rename the scalars to \"Elevation\" since we are using the Z-scalars as\n  // elevations.\n  source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Elevation\");\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 5.0, 15.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetParametricTorus()\n{\n  vtkNew<vtkParametricTorus> fn;\n  fn->SetRingRadius(5);\n  fn->SetCrossSectionRadius(2);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetParametricFunction(fn);\n  source->SetUResolution(50);\n  source->SetVResolution(50);\n  source->SetScalarModeToZ();\n  source->Update();\n\n  // Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n  // source->GetOutput()->GetPointData()->GetNormals()->SetName(\"Normals\");\n  // source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Scalars\");\n  // Rename the scalars to \"Elevation\" since we are using the Z-scalars as\n  // elevations.\n  source->GetOutput()->GetPointData()->GetScalars()->SetName(\"Elevation\");\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  return transformFilter->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetPlane()\n{\n  vtkNew<vtkPlaneSource> source;\n  source->SetOrigin(-10.0, -10.0, 0.0);\n  source->SetPoint2(-10.0, 10.0, 0.0);\n  source->SetPoint1(10.0, -10.0, 0.0);\n  source->SetXResolution(20);\n  source->SetYResolution(20);\n  source->Update();\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.0, 0.0, 0.0);\n  transform->RotateX(-90.0);\n  vtkNew<vtkTransformPolyDataFilter> transformFilter;\n  transformFilter->SetInputConnection(source->GetOutputPort());\n  transformFilter->SetTransform(transform);\n  transformFilter->Update();\n\n  // We have a m x n array of quadrilaterals arranged as a regular tiling in a\n  // plane. So pass it through a triangle filter since the curvature filter only\n  // operates on polys.\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(transformFilter->GetOutputPort());\n\n  // Pass it though a CleanPolyDataFilter and merge any points which\n  // are coincident, or very close\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  return cleaner->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSphere()\n{\n  vtkNew<vtkSphereSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetRadius(10.0);\n  source->SetThetaResolution(32);\n  source->SetPhiResolution(32);\n  source->Update();\n\n  return source->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetTorus()\n{\n  vtkNew<vtkSuperquadricSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetCenter(1.0, 1.0, 1.0);\n  source->SetPhiResolution(64);\n  source->SetThetaResolution(64);\n  source->SetThetaRoundness(1);\n  source->SetThickness(0.5);\n  source->SetSize(10);\n  source->SetToroidal(1);\n  source->Update();\n\n  // The quadric is made of strips, so pass it through a triangle filter as\n  // the curvature filter only operates on polys\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(source->GetOutputPort());\n\n  // The quadric has nasty discontinuities from the way the edges are generated\n  // so let's pass it though a CleanPolyDataFilter and merge any points which\n  // are coincident, or very close\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n\n  return cleaner->GetOutput();\n}\n\nvtkSmartPointer<vtkPolyData> GetSource(std::string const& source)\n{\n  std::string surface = source;\n  std::transform(surface.begin(), surface.end(), surface.begin(),\n                 [](unsigned char c) { return std::tolower(c); });\n  std::map<std::string, int> available_surfaces = {\n      {\"hills\", 0},       {\"parametrictorus\", 1}, {\"plane\", 2},\n      {\"randomhills\", 3}, {\"sphere\", 4},          {\"torus\", 5}};\n  if (available_surfaces.find(surface) == available_surfaces.end())\n  {\n    std::cout << \"The surface is not available.\" << std::endl;\n    std::cout << \"Using RandomHills instead.\" << std::endl;\n    surface = \"randomhills\";\n  }\n  switch (available_surfaces[surface])\n  {\n  case 0:\n    return GetHills();\n    break;\n  case 1:\n    return GetParametricTorus();\n    break;\n  case 2:\n    return GetElevations(GetPlane());\n    break;\n  case 3:\n    return GetParametricHills();\n    break;\n  case 4:\n    return GetElevations(GetSphere());\n    break;\n  case 5:\n    return GetElevations(GetTorus());\n    break;\n  }\n  return GetParametricHills();\n}\n\nvtkSmartPointer<vtkColorSeries> GetColorSeries()\n{\n\n  vtkNew<vtkColorSeries> colorSeries;\n  // Select a color scheme.\n  int colorSeriesEnum;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_BROWN_BLUE_GREEN_9;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_10;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_3;\n  // colorSeriesEnum = colorSeries->BREWER_DIVERGING_PURPLE_ORANGE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_PURPLE_9;\n  // colorSeriesEnum = colorSeries->BREWER_SEQUENTIAL_BLUE_GREEN_9;\n  colorSeriesEnum = colorSeries->BREWER_QUALITATIVE_SET3;\n  // colorSeriesEnum = colorSeries->CITRUS;\n  colorSeries->SetColorScheme(colorSeriesEnum);\n  return colorSeries;\n}\n\nvtkSmartPointer<vtkLookupTable> GetCategoricalLUT()\n{\n  vtkSmartPointer<vtkColorSeries> colorSeries = GetColorSeries();\n  // Make the lookup table.\n  vtkNew<vtkLookupTable> lut;\n  colorSeries->BuildLookupTable(lut, vtkColorSeries::CATEGORICAL);\n  lut->SetNanColor(0, 0, 0, 1);\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> GetOrdinaLUT()\n{\n  vtkSmartPointer<vtkColorSeries> colorSeries = GetColorSeries();\n  // Make the lookup table.\n  vtkNew<vtkLookupTable> lut;\n  colorSeries->BuildLookupTable(lut, vtkColorSeries::ORDINAL);\n  lut->SetNanColor(0, 0, 0, 1);\n\n  return lut;\n}\n\n// clang-format off\n/**\n * See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n *\n *                   start point         midPoint            end point\n * cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n * purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n * green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n * blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n * green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n *\n */\n// clang-format on\nvtkSmartPointer<vtkLookupTable> GetDivergingLUT()\n{\n\n  vtkNew<vtkColorTransferFunction> ctf;\n  ctf->SetColorSpaceToDiverging();\n  ctf->AddRGBPoint(0.0, 0.085, 0.532, 0.201);\n  ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n  ctf->AddRGBPoint(1.0, 0.758, 0.214, 0.233);\n\n  auto tableSize = 256;\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(tableSize);\n  lut->Build();\n\n  for (auto i = 0; i < lut->GetNumberOfColors(); ++i)\n  {\n    std::array<double, 3> rgb;\n    ctf->GetColor(static_cast<double>(i) / lut->GetNumberOfColors(),\n                  rgb.data());\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    lut->SetTableValue(static_cast<vtkIdType>(i), rgba.data());\n  }\n\n  return lut;\n}\n\nvtkSmartPointer<vtkLookupTable> ReverseLUT(vtkLookupTable* lut)\n{\n  // First do a deep copy just to get the whole structure\n  // and then reverse the colors and annotations.\n  vtkNew<vtkLookupTable> lutr;\n  lutr->DeepCopy(lut);\n  vtkIdType t = lut->GetNumberOfTableValues() - 1;\n  for (vtkIdType i = t; i >= 0; --i)\n  {\n    std::array<double, 3> rgb{0.0, 0.0, 0.0};\n    std::array<double, 4> rgba{0.0, 0.0, 0.0, 1.0};\n    lut->GetColor(i, rgb.data());\n    std::copy(std::begin(rgb), std::end(rgb), std::begin(rgba));\n    rgba[3] = lut->GetOpacity(i);\n    lutr->SetTableValue(t - i, rgba.data());\n  }\n  t = lut->GetNumberOfAnnotatedValues() - 1;\n  for (vtkIdType i = t; i >= 0; --i)\n  {\n    lutr->SetAnnotation(t - i, lut->GetAnnotation(i));\n  }\n\n  return lutr;\n}\n\nvtkNew<vtkGlyph3D> GetGlyphs(vtkPolyData* src, double const& scaleFactor,\n                             bool const& reverseNormals)\n{\n  // Sometimes the contouring algorithm can create a volume whose gradient\n  // vector and ordering of polygon(using the right hand rule) are\n  // inconsistent. vtkReverseSense cures this problem.\n  vtkNew<vtkReverseSense> reverse;\n  vtkNew<vtkMaskPoints> maskPts;\n  maskPts->SetOnRatio(5);\n  maskPts->RandomModeOn();\n  if (reverseNormals)\n  {\n    reverse->SetInputData(src);\n    reverse->ReverseCellsOn();\n    reverse->ReverseNormalsOn();\n    maskPts->SetInputConnection(reverse->GetOutputPort());\n  }\n  else\n  {\n    maskPts->SetInputData(src);\n  }\n\n  // Source for the glyph filter\n  vtkNew<vtkArrowSource> arrow;\n  arrow->SetTipResolution(16);\n  arrow->SetTipLength(0.3);\n  arrow->SetTipRadius(0.1);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetSourceConnection(arrow->GetOutputPort());\n  glyph->SetInputConnection(maskPts->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleFactor(scaleFactor);\n  glyph->SetColorModeToColorByVector();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->OrientOn();\n  glyph->Update();\n\n  return glyph;\n}\n\nstd::map<int, std::vector<double>> GetBands(double const dR[2],\n                                            int const& numberOfBands,\n                                            int const& precision,\n                                            bool const& nearestInteger)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  auto RoundOff = [&prec](const double& x) {\n    auto pow_10 = std::pow(10.0, prec);\n    return std::round(x * pow_10) / pow_10;\n  };\n\n  std::map<int, std::vector<double>> bands;\n  if ((dR[1] < dR[0]) || (numberOfBands <= 0))\n  {\n    return bands;\n  }\n  double x[2];\n  for (int i = 0; i < 2; ++i)\n  {\n    x[i] = dR[i];\n  }\n  if (nearestInteger)\n  {\n    x[0] = std::floor(x[0]);\n    x[1] = std::ceil(x[1]);\n  }\n  double dx = (x[1] - x[0]) / static_cast<double>(numberOfBands);\n  std::vector<double> b;\n  b.push_back(x[0]);\n  b.push_back(x[0] + dx / 2.0);\n  b.push_back(x[0] + dx);\n  for (int i = 0; i < numberOfBands; ++i)\n  {\n    if (i == 0)\n    {\n      for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n      {\n        *p = RoundOff(*p);\n      }\n      b[0] = x[0];\n    }\n    bands[i] = b;\n    for (std::vector<double>::iterator p = b.begin(); p != b.end(); ++p)\n    {\n      *p = RoundOff(*p + dx);\n    }\n  }\n  return bands;\n}\n\nstd::map<int, std::vector<double>>\nGetCustomBands(double const dR[2], int const& numberOfBands,\n               std::vector<std::array<double, 2>> const& myBands)\n{\n  std::map<int, std::vector<double>> bands;\n  if ((dR[1] < dR[0]) || (numberOfBands <= 0))\n  {\n    return bands;\n  }\n\n  std::vector<std::array<double, 2>> x;\n  std::copy(myBands.begin(), myBands.end(), std::back_inserter(x));\n\n  // Determine the index of the range minimum and range maximum.\n  int idxMin = 0;\n  for (auto idx = 0; idx < static_cast<int>(myBands.size()); ++idx)\n  {\n    if (dR[0] < myBands[idx][1] && dR[0] >= myBands[idx][0])\n    {\n      idxMin = idx;\n      break;\n    }\n  }\n  int idxMax = static_cast<int>(myBands.size()) - 1;\n  for (int idx = static_cast<int>(myBands.size()) - 1; idx >= 0; --idx)\n  {\n    if (dR[1] < myBands[idx][1] && dR[1] >= myBands[idx][0])\n    {\n      idxMax = static_cast<int>(idx);\n      break;\n    }\n  }\n\n  // Set the minimum to match the range minimum.\n  x[idxMin][0] = dR[0];\n  x[idxMax][1] = dR[1];\n  for (int i = idxMin; i < idxMax + 1; ++i)\n  {\n    std::vector<double> b(3);\n    b[0] = x[i][0];\n    b[1] = x[i][0] + (x[i][1] - x[i][0]) / 2.0;\n    b[2] = x[i][1];\n    bands[i] = b;\n  }\n  return bands;\n}\n\nstd::map<int, std::vector<double>> GetIntegralBands(double const dR[2])\n{\n  std::map<int, std::vector<double>> bands;\n  if (dR[1] < dR[0])\n  {\n    return bands;\n  }\n  double x[2];\n  for (int i = 0; i < 2; ++i)\n  {\n    x[i] = dR[i];\n  }\n  x[0] = std::floor(x[0]);\n  x[1] = std::ceil(x[1]);\n  int numberOfBands = static_cast<int>(std::abs(x[1]) + std::abs(x[0]));\n  return GetBands(x, numberOfBands, false);\n}\n\nstd::map<int, int> GetFrequencies(std::map<int, std::vector<double>>& bands,\n                                  vtkPolyData* src)\n{\n  std::map<int, int> freq;\n  for (auto i = 0; i < static_cast<int>(bands.size()); ++i)\n  {\n    freq[i] = 0;\n  }\n  vtkIdType tuples = src->GetPointData()->GetScalars()->GetNumberOfTuples();\n  for (int i = 0; i < tuples; ++i)\n  {\n    double* x = src->GetPointData()->GetScalars()->GetTuple(i);\n    for (auto j = 0; j < static_cast<int>(bands.size()); ++j)\n    {\n      if (*x <= bands[j][2])\n      {\n        freq[j] = freq[j] + 1;\n        break;\n      }\n    }\n  }\n  return freq;\n}\n\nvoid AdjustFrequencyRanges(std::map<int, std::vector<double>>& bands,\n                           std::map<int, int>& freq)\n{\n  // Get the indices of the first and last non-zero elements.\n  auto first = 0;\n  for (auto i = 0; i < static_cast<int>(freq.size()); ++i)\n  {\n    if (freq[i] != 0)\n    {\n      first = i;\n      break;\n    }\n  }\n  std::vector<int> keys;\n  for (std::map<int, int>::iterator it = freq.begin(); it != freq.end(); ++it)\n  {\n    keys.push_back(it->first);\n  }\n  std::reverse(keys.begin(), keys.end());\n  auto last = keys[0];\n  for (size_t i = 0; i < keys.size(); ++i)\n  {\n    if (freq[keys[i]] != 0)\n    {\n      last = keys[i];\n      break;\n    }\n  }\n  // Now adjust the ranges.\n  std::map<int, int>::iterator freqItr;\n  freqItr = freq.find(first);\n  freq.erase(freq.begin(), freqItr);\n  freqItr = ++freq.find(last);\n  freq.erase(freqItr, freq.end());\n  std::map<int, std::vector<double>>::iterator bandItr;\n  bandItr = bands.find(first);\n  bands.erase(bands.begin(), bandItr);\n  bandItr = ++bands.find(last);\n  bands.erase(bandItr, bands.end());\n  // Reindex freq and bands.\n  std::map<int, int> adjFreq;\n  int idx = 0;\n  for (auto p : freq)\n  {\n    adjFreq[idx] = p.second;\n    ++idx;\n  }\n  std::map<int, std::vector<double>> adjBands;\n  idx = 0;\n  for (auto const& p : bands)\n  {\n    adjBands[idx] = p.second;\n    ++idx;\n  }\n  bands = adjBands;\n  freq = adjFreq;\n}\n\nvoid PrintBandsFrequencies(std::map<int, std::vector<double>> const& bands,\n                           std::map<int, int>& freq, int const& precision)\n{\n  auto prec = abs(precision);\n  prec = (prec > 14) ? 14 : prec;\n\n  if (bands.size() != freq.size())\n  {\n    std::cout << \"Bands and frequencies must be the same size.\" << std::endl;\n    return;\n  }\n  std::ostringstream os;\n  os << \"Bands & Frequencies:\\n\";\n  size_t idx = 0;\n  auto total = 0;\n  auto width = prec + 6;\n  for (std::map<int, std::vector<double>>::const_iterator p = bands.begin();\n       p != bands.end(); ++p)\n  {\n    total += freq[p->first];\n    for (std::vector<double>::const_iterator q = p->second.begin();\n         q != p->second.end(); ++q)\n    {\n      if (q == p->second.begin())\n      {\n        os << std::setw(4) << idx << \" [\";\n      }\n      if (q == std::prev(p->second.end()))\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \"]: \" << std::setw(8) << freq[p->first] << \"\\n\";\n      }\n      else\n      {\n        os << std::fixed << std::setw(width) << std::setprecision(prec) << *q\n           << \", \";\n      }\n    }\n    ++idx;\n  }\n  width = 3 * width + 13;\n  os << std::left << std::setw(width) << \"Total\" << std::right << std::setw(8)\n     << total << std::endl;\n  std::cout << os.str() << endl;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/ElevationBandsWithGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ElevationBandsWithGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ElevationBandsWithGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ElevationBandsWithGlyphs MACOSX_BUNDLE ElevationBandsWithGlyphs.cxx )\n  target_link_libraries(ElevationBandsWithGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ElevationBandsWithGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ElevationBandsWithGlyphs/#download-and-build-elevationbandswithglyphs","title":"Download and Build ElevationBandsWithGlyphs","text":"

        Click here to download ElevationBandsWithGlyphs and its CMakeLists.txt file. Once the tarball ElevationBandsWithGlyphs.tar has been downloaded and extracted,

        cd ElevationBandsWithGlyphs/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ElevationBandsWithGlyphs\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ExtrudePolyDataAlongLine/","title":"ExtrudePolyDataAlongLine","text":"

        vtk-examples/Cxx/Visualization/ExtrudePolyDataAlongLine

        "},{"location":"Cxx/Visualization/ExtrudePolyDataAlongLine/#description","title":"Description","text":"

        Extrude a 2D polydata along a line. It uses vtkRuledSurfaceFilter.

        The example proceeds as follows:

        1. Obtain the 2D polydata from a file( or generate a disk).

        2. Generates random points in 3D space and fits a spline to the points.

        3. Computes an orientation frame at each point on the line.

        4. Places a copy of the 2D polydata at each point on the line, oriented by the the frame at that point.

        5. For each contour in the 2D polydata, appends all of the copies.

        6. Creates a ruled surface for each contour.

        Note

        This example requires the remote module ''SplineDrivenImageSampler.'' Check to see if the file ''SplineDrivenImageSlicer.remote.cmake'' exists in VTK/Remote. If it does not, copy this file to ''VTK/Remote/SplineDrivenImageSlicer.remote.cmake''.

        Warning

        A bug in vtkRuledSurfaceFilter occasionally drops triangles. This is being fixed.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ExtrudePolyDataAlongLine/#code","title":"Code","text":"

        ExtrudePolyDataAlongLine.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkDiskSource.h>\n#include <vtkFeatureEdges.h>\n#include <vtkFrenetSerretFrame.h>\n#include <vtkLineSource.h>\n#include <vtkMath.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRuledSurfaceFilter.h>\n#include <vtkSmartPointer.h>\n#include <vtkStripper.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataReader.h>\n#include <vtkSTLReader.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // For testing\n  vtkMath::RandomSeed(7859821);\n  // Read a polydata\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n  ;\n\n  int numberOfContours = polyData->GetNumberOfLines();\n  std::cout << \"Number of contours: \" << numberOfContours << std::endl;\n\n  // Generate  some random points\n  int numberOfPoints = 10;\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(numberOfPoints);\n  pointSource->Update();\n\n  vtkPoints* points = pointSource->GetOutput()->GetPoints();\n\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetPoints(points);\n\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->SetUResolution(50 * numberOfPoints);\n  functionSource->SetVResolution(50 * numberOfPoints);\n  functionSource->SetWResolution(50 * numberOfPoints);\n\n  // Create the frame\n  vtkNew<vtkFrenetSerretFrame> frame;\n  frame->SetInputConnection(functionSource->GetOutputPort());\n  frame->ConsistentNormalsOn();\n  frame->Update();\n\n  frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSNormals\");\n  frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSTangents\");\n  frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSBinormals\");\n\n  vtkPoints* linePoints = frame->GetOutput()->GetPoints();\n\n  std::vector<vtkSmartPointer<vtkAppendPolyData>> skeletons;\n  for (int i = 0; i < numberOfContours; ++i)\n  {\n    skeletons.push_back(vtkSmartPointer<vtkAppendPolyData>::New());\n  }\n\n  for (int i = 0; i < linePoints->GetNumberOfPoints(); ++i)\n  {\n    vtkNew<vtkTransform> transform;\n\n    // Compute a basis\n    double normalizedX[3];\n    frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSNormals\");\n    frame->GetOutput()->GetPointData()->GetVectors()->GetTuple(i, normalizedX);\n    double normalizedY[3];\n    frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSBinormals\");\n    frame->GetOutput()->GetPointData()->GetVectors()->GetTuple(i, normalizedY);\n    double normalizedZ[3];\n    frame->GetOutput()->GetPointData()->SetActiveVectors(\"FSTangents\");\n    frame->GetOutput()->GetPointData()->GetVectors()->GetTuple(i, normalizedZ);\n\n    // Create the direction cosine matrix\n    vtkNew<vtkMatrix4x4> matrix;\n    matrix->Identity();\n    for (unsigned int j = 0; j < 3; ++j)\n    {\n      matrix->SetElement(j, 0, normalizedX[j]);\n      matrix->SetElement(j, 1, normalizedY[j]);\n      matrix->SetElement(j, 2, normalizedZ[j]);\n    }\n\n    transform->Translate(linePoints->GetPoint(i)[0], linePoints->GetPoint(i)[1],\n                         linePoints->GetPoint(i)[2]);\n    transform->Scale(.02, .02, .02);\n    transform->Concatenate(matrix);\n\n    vtkNew<vtkTransformPolyDataFilter> transformPD;\n    vtkNew<vtkPolyData> polyDataCopy;\n    polyDataCopy->DeepCopy(polyData);\n\n    transformPD->SetTransform(transform);\n    transformPD->SetInputData(polyDataCopy);\n    transformPD->Update();\n\n    vtkNew<vtkPolyDataConnectivityFilter> contours;\n    contours->SetInputConnection(transformPD->GetOutputPort());\n    contours->Update();\n    for (int r = 0; r < contours->GetNumberOfExtractedRegions(); ++r)\n    {\n      contours->SetExtractionModeToSpecifiedRegions();\n      contours->InitializeSpecifiedRegionList();\n      contours->AddSpecifiedRegion(r);\n      contours->Update();\n      vtkNew<vtkPolyData> skeleton;\n      skeleton->DeepCopy(contours->GetOutput());\n      skeletons[r]->AddInputData(skeleton);\n    }\n  }\n  vtkNew<vtkRenderer> renderer;\n\n  for (int i = 0; i < numberOfContours; ++i)\n  {\n    vtkNew<vtkRuledSurfaceFilter> ruled;\n    ruled->SetRuledModeToPointWalk();\n    ruled->CloseSurfaceOff();\n    ruled->SetOnRatio(1);\n    ruled->SetDistanceFactor(10000000);\n    ruled->SetInputConnection(skeletons[i]->GetOutputPort());\n\n    vtkNew<vtkPolyDataNormals> normals;\n    normals->SetInputConnection(ruled->GetOutputPort());\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(normals->GetOutputPort());\n    vtkNew<vtkProperty> backProp;\n    backProp->SetColor(1.0, 0.3882, 0.278);\n    vtkNew<vtkActor> actor;\n    actor->SetBackfaceProperty(backProp);\n    actor->GetProperty()->SetColor(0.8900, 0.8100, 0.3400);\n    actor->SetMapper(mapper);\n    renderer->AddActor(actor);\n  }\n\n  // Setup render window, renderer, and interactor\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(.4, .5, .7);\n\n  // Pick a good view\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.1);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(512, 512);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n\n    // Center the data\n    vtkNew<vtkTransform> transform;\n    std::cout << reader->GetOutput()->GetCenter()[0] << \", \"\n              << reader->GetOutput()->GetCenter()[1] << \", \"\n              << reader->GetOutput()->GetCenter()[2] << std::endl;\n    transform->Translate(-reader->GetOutput()->GetCenter()[0],\n                         -reader->GetOutput()->GetCenter()[1],\n                         -reader->GetOutput()->GetCenter()[2]);\n    vtkNew<vtkTransformPolyDataFilter> transformPD;\n    transformPD->SetTransform(transform);\n    transformPD->SetInputData(reader->GetOutput());\n    transformPD->Update();\n\n    polyData = transformPD->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkDiskSource> diskSource;\n    diskSource->SetCircumferentialResolution(3);\n\n    vtkNew<vtkCleanPolyData> clean;\n    clean->SetInputConnection(diskSource->GetOutputPort());\n\n    vtkNew<vtkFeatureEdges> edges;\n    edges->SetInputConnection(clean->GetOutputPort());\n    edges->NonManifoldEdgesOff();\n    edges->ManifoldEdgesOff();\n    edges->BoundaryEdgesOn();\n    edges->FeatureEdgesOff();\n\n    vtkNew<vtkStripper> stripper;\n    stripper->SetInputConnection(edges->GetOutputPort());\n    stripper->Update();\n    polyData = stripper->GetOutput();\n\n#if 0\n    vtkNew<vtkLineSource> lineSource;\n    lineSource->SetResolution(10);\n    lineSource->Update();\n\n    polyData = lineSource->GetOutput();\n#endif\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/ExtrudePolyDataAlongLine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtrudePolyDataAlongLine)\n\nfind_package(VTK COMPONENTS \n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  CommonMath\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtrudePolyDataAlongLine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtrudePolyDataAlongLine MACOSX_BUNDLE ExtrudePolyDataAlongLine.cxx )\n  target_link_libraries(ExtrudePolyDataAlongLine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtrudePolyDataAlongLine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ExtrudePolyDataAlongLine/#download-and-build-extrudepolydataalongline","title":"Download and Build ExtrudePolyDataAlongLine","text":"

        Click here to download ExtrudePolyDataAlongLine and its CMakeLists.txt file. Once the tarball ExtrudePolyDataAlongLine.tar has been downloaded and extracted,

        cd ExtrudePolyDataAlongLine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtrudePolyDataAlongLine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/FastSplatter/","title":"FastSplatter","text":"

        vtk-examples/Cxx/Visualization/FastSplatter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/FastSplatter/#code","title":"Code","text":"

        FastSplatter.cxx

        #include <vtkFastSplatter.h>\n#include <vtkImageData.h>\n#include <vtkImageShiftScale.h>\n#include <vtkImageViewer2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nnamespace {\nconstexpr int SPLAT_IMAGE_SIZE = 100;\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // For the purposes of this example we'll build the splat image by\n  // hand.\n\n  vtkNew<vtkImageData> splatImage;\n  splatImage->SetDimensions(SPLAT_IMAGE_SIZE, SPLAT_IMAGE_SIZE, 1);\n  splatImage->AllocateScalars(VTK_FLOAT, 1);\n\n  for (int i = 0; i < SPLAT_IMAGE_SIZE; ++i)\n  {\n    for (int j = 0; j < SPLAT_IMAGE_SIZE; ++j)\n    {\n      double xCoord =\n          1 - fabs((i - SPLAT_IMAGE_SIZE / 2) / (SPLAT_IMAGE_SIZE / 2.0));\n      double yCoord =\n          1 - fabs((j - SPLAT_IMAGE_SIZE / 2) / (SPLAT_IMAGE_SIZE / 2.0));\n\n      splatImage->SetScalarComponentFromDouble(i, j, 0, 0, xCoord * yCoord);\n    }\n  }\n\n  vtkNew<vtkPolyData> splatPoints;\n  vtkNew<vtkPoints> points;\n\n  points->SetNumberOfPoints(5);\n  double point[3];\n\n  point[0] = 0;\n  point[1] = 0;\n  point[2] = 0;\n  points->SetPoint(0, point);\n\n  point[0] = 1;\n  point[1] = 1;\n  point[2] = 0;\n  points->SetPoint(1, point);\n\n  point[0] = -1;\n  point[1] = 1;\n  point[2] = 0;\n  points->SetPoint(2, point);\n\n  point[0] = 1;\n  point[1] = -1;\n  point[2] = 0;\n  points->SetPoint(3, point);\n\n  point[0] = -1;\n  point[1] = -1;\n  point[2] = 0;\n  points->SetPoint(4, point);\n\n  splatPoints->SetPoints(points);\n\n  vtkNew<vtkFastSplatter> splatter;\n  splatter->SetInputData(splatPoints);\n  splatter->SetInputData(1, splatImage);\n  splatter->SetOutputDimensions(2 * SPLAT_IMAGE_SIZE, 2 * SPLAT_IMAGE_SIZE, 1);\n\n  // The image viewers and writers are only happy with unsigned char\n  // images.  This will convert the floats into that format.\n  vtkNew<vtkImageShiftScale> resultScale;\n  resultScale->SetOutputScalarTypeToUnsignedChar();\n  resultScale->SetShift(0);\n  resultScale->SetScale(255);\n  resultScale->SetInputConnection(splatter->GetOutputPort());\n\n  splatter->Update();\n  resultScale->Update();\n\n  // Set up a viewer for the image.  vtkImageViewer and\n  // vtkImageViewer2 are convenient wrappers around vtkActor2D,\n  // vtkImageMapper, vtkRenderer, and vtkRenderWindow.  All you need\n  // to supply is the interactor and hooray, Bob's your uncle.\n  vtkNew<vtkImageViewer2> imageViewer;\n  imageViewer->SetInputConnection(resultScale->GetOutputPort());\n  imageViewer->SetColorLevel(127);\n  imageViewer->SetColorWindow(255);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  imageViewer->SetupInteractor(iren);\n\n  imageViewer->Render();\n  imageViewer->GetRenderer()->SetBackground(\n      colors->GetColor3d(\"SlateGray\").GetData());\n  imageViewer->GetRenderer()->ResetCamera();\n\n  imageViewer->GetRenderWindow()->SetWindowName(\"FastSplatter\");\n\n  imageViewer->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/FastSplatter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FastSplatter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingCore\n  ImagingHybrid\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FastSplatter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FastSplatter MACOSX_BUNDLE FastSplatter.cxx )\n  target_link_libraries(FastSplatter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FastSplatter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/FastSplatter/#download-and-build-fastsplatter","title":"Download and Build FastSplatter","text":"

        Click here to download FastSplatter and its CMakeLists.txt file. Once the tarball FastSplatter.tar has been downloaded and extracted,

        cd FastSplatter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FastSplatter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/FlatShading/","title":"FlatShading","text":"

        vtk-examples/Cxx/Visualization/FlatShading

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/FlatShading/#code","title":"Code","text":"

        FlatShading.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Set shading to flat.\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"FlatShading\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderer->GetActiveCamera()->Azimuth(-55);\n  renderer->ResetCamera();\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/FlatShading/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FlatShading)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FlatShading: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FlatShading MACOSX_BUNDLE FlatShading.cxx )\n  target_link_libraries(FlatShading PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FlatShading\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/FlatShading/#download-and-build-flatshading","title":"Download and Build FlatShading","text":"

        Click here to download FlatShading and its CMakeLists.txt file. Once the tarball FlatShading.tar has been downloaded and extracted,

        cd FlatShading/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FlatShading\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Follower/","title":"Follower","text":"

        vtk-examples/Cxx/Visualization/Follower

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/Follower/#description","title":"Description","text":"

        The text is a 3D actor and is placed in 3D space, but stays right side up and facing the camera, while the cube does not.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Follower/#code","title":"Code","text":"

        Follower.cxx

        #include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkFollower.h>\n#include <vtkInteractorStyle.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorText.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create some text.\n  vtkNew<vtkVectorText> textSource;\n  textSource->SetText(\"Hello\");\n\n  // Create a mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(textSource->GetOutputPort());\n\n  // Create a subclass of vtkActor: a vtkFollower that remains facing the\n  // camera.\n  vtkNew<vtkFollower> follower;\n  follower->SetMapper(mapper);\n  follower->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a transparent cube that does not move around to face the camera.\n  vtkNew<vtkCubeSource> cubeSource;\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  cubeActor->GetProperty()->SetOpacity(0.3);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Follower\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  dynamic_cast<vtkInteractorStyle*>(\n      renderWindowInteractor->GetInteractorStyle())\n      ->AutoAdjustCameraClippingRangeOn();\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(follower);\n  renderer->AddActor(cubeActor);\n  renderer->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n  follower->SetCamera(renderer->GetActiveCamera());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Follower/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Follower)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Follower: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Follower MACOSX_BUNDLE Follower.cxx )\n  target_link_libraries(Follower PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Follower\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Follower/#download-and-build-follower","title":"Download and Build Follower","text":"

        Click here to download Follower and its CMakeLists.txt file. Once the tarball Follower.tar has been downloaded and extracted,

        cd Follower/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Follower\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/FontFile/","title":"FontFile","text":"

        vtk-examples/Cxx/Visualization/FontFile

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/FontFile/#description","title":"Description","text":"

        The example uses an external font file. There are many sources of TrueType fonts. Here is one source.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/FontFile/#code","title":"Code","text":"

        FontFile.cxx

        #include <vtkActor2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <iostream>\n#include <sstream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[1] << \" font.ttf e.g. CopyPaste.ttf\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fontFile(argv[1]);\n  std::stringstream str;\n  str << \"Font: \"\n      << vtksys::SystemTools::GetFilenameWithoutExtension(std::string(argv[1]))\n      << \"\\n\"\n      << \"Sample multiline\\ntext rendered\\nusing FreeTypeTools.\";\n\n  int width = 640;\n  int height = 480;\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkTextMapper> mapper;\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetPosition(width / 2, height / 2);\n  actor->SetMapper(mapper);\n  mapper->GetTextProperty()->BoldOff();\n  ;\n  mapper->GetTextProperty()->SetFontSize(50);\n  mapper->GetTextProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  mapper->GetTextProperty()->SetJustificationToCentered();\n  mapper->GetTextProperty()->SetVerticalJustificationToCentered();\n  mapper->GetTextProperty()->SetFontFamily(VTK_FONT_FILE);\n  mapper->GetTextProperty()->SetFontFile(fontFile.c_str());\n  mapper->SetInput(str.str().c_str());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  renderWindow->SetSize(width, height);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"FontFile\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n\n  renderWindow->Render();\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/FontFile/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FontFile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FontFile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FontFile MACOSX_BUNDLE FontFile.cxx )\n  target_link_libraries(FontFile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FontFile\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/FontFile/#download-and-build-fontfile","title":"Download and Build FontFile","text":"

        Click here to download FontFile and its CMakeLists.txt file. Once the tarball FontFile.tar has been downloaded and extracted,

        cd FontFile/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FontFile\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/FrogBrain/","title":"FrogBrain","text":"

        vtk-examples/Cxx/Visualization/FrogBrain

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/FrogBrain/#description","title":"Description","text":"

        The frog's brain. Model extracted without smoothing (left) and with smoothing (right).

        Info

        See Figure 12-7 in Chapter 12 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/FrogBrain/#code","title":"Code","text":"

        FrogBrain.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageThreshold.h>\n#include <vtkLookupTable.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n#include <vtkVersion.h>\n#include <vtkWindowedSincPolyDataFilter.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <map>\n\nnamespace {\nvoid CreateFrogLut(vtkLookupTable* colorLut);\nvoid CreateFrogActor(std::string fileName, int tissue, vtkActor* actor);\nvoid CreateSmoothFrogActor(std::string fileName, int tissue, vtkActor* actor);\nvoid CreateTissueMap(std::map<std::string, int>& tissueMap);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \"InputFile(.mhd) Tissue e.g.frogtissue.mhd brain\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::map<std::string, int> tissueMap;\n  CreateTissueMap(tissueMap);\n\n  vtkNew<vtkLookupTable> colorLut;\n  colorLut->SetNumberOfColors(17);\n  colorLut->SetTableRange(0, 16);\n  colorLut->Build();\n\n  CreateFrogLut(colorLut);\n\n  vtkNew<vtkNamedColors> colors;\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> rendererLeft;\n  rendererLeft->SetViewport(0, 0, 0.5, 1);\n  vtkNew<vtkRenderer> rendererRight;\n  rendererRight->SetViewport(0.5, 0, 1, 1);\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(rendererLeft);\n  renderWindow->AddRenderer(rendererRight);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetDiffuseColor(\n      colorLut->GetTableValue(tissueMap[argv[2]]));\n  CreateFrogActor(argv[1], tissueMap[argv[2]], actor);\n  rendererLeft->AddActor(actor);\n\n  vtkNew<vtkActor> actorSmooth;\n  actorSmooth->GetProperty()->SetDiffuseColor(\n      colorLut->GetTableValue(tissueMap[argv[2]]));\n  actorSmooth->GetProperty()->SetDiffuse(1.0);\n  actorSmooth->GetProperty()->SetSpecular(.5);\n  actorSmooth->GetProperty()->SetSpecularPower(100);\n  CreateSmoothFrogActor(argv[1], tissueMap[argv[2]], actorSmooth);\n  rendererRight->AddActor(actorSmooth);\n\n  rendererLeft->ResetCamera();\n  rendererLeft->GetActiveCamera()->SetViewUp(-1, 0, 0);\n  rendererLeft->GetActiveCamera()->Azimuth(180);\n  rendererLeft->ResetCameraClippingRange();\n\n  rendererLeft->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n  rendererRight->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n  rendererRight->SetActiveCamera(rendererLeft->GetActiveCamera());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"FrogBrain\");\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateTissueMap(std::map<std::string, int>& tissueMap)\n{\n  tissueMap[\"blood\"] = 1;\n  tissueMap[\"brain\"] = 2;\n  tissueMap[\"duodenum\"] = 3;\n  tissueMap[\"eyeRetina\"] = 4;\n  tissueMap[\"eyeWhite\"] = 5;\n  tissueMap[\"heart\"] = 6;\n  tissueMap[\"ileum\"] = 7;\n  tissueMap[\"kidney\"] = 8;\n  tissueMap[\"intestine\"] = 9;\n  tissueMap[\"liver\"] = 10;\n  tissueMap[\"lung\"] = 11;\n  tissueMap[\"nerve\"] = 12;\n  tissueMap[\"skeleton\"] = 13;\n  tissueMap[\"spleen\"] = 14;\n  tissueMap[\"stomach\"] = 15;\n  return;\n}\n\nvoid CreateSmoothFrogActor(std::string fileName, int tissue, vtkActor* actor)\n{\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageThreshold> selectTissue;\n  selectTissue->ThresholdBetween(tissue, tissue);\n  selectTissue->SetInValue(255);\n  selectTissue->SetOutValue(0);\n  selectTissue->SetInputConnection(reader->GetOutputPort());\n\n  int gaussianRadius = 1;\n  double gaussianStandardDeviation = 2.0;\n  vtkNew<vtkImageGaussianSmooth> gaussian;\n  gaussian->SetStandardDeviations(gaussianStandardDeviation,\n                                  gaussianStandardDeviation,\n                                  gaussianStandardDeviation);\n  gaussian->SetRadiusFactors(gaussianRadius, gaussianRadius, gaussianRadius);\n  gaussian->SetInputConnection(selectTissue->GetOutputPort());\n\n  double isoValue = 127.5;\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> iso_surface;\n#else\n  vtkNew<vtkMarchingCubes> iso_surface;\n#endif\n  iso_surface->SetInputConnection(gaussian->GetOutputPort());\n  iso_surface->ComputeScalarsOff();\n  iso_surface->ComputeGradientsOff();\n  iso_surface->ComputeNormalsOff();\n  iso_surface->SetValue(0, isoValue);\n\n  int smoothingIterations = 20;\n  double passBand = 0.001;\n  double featureAngle = 60.0;\n  vtkNew<vtkWindowedSincPolyDataFilter> smoother;\n  smoother->SetInputConnection(iso_surface->GetOutputPort());\n  smoother->SetNumberOfIterations(smoothingIterations);\n  smoother->BoundarySmoothingOff();\n  smoother->FeatureEdgeSmoothingOff();\n  smoother->SetFeatureAngle(featureAngle);\n  smoother->SetPassBand(passBand);\n  smoother->NonManifoldSmoothingOn();\n  smoother->NormalizeCoordinatesOn();\n  smoother->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(smoother->GetOutputPort());\n  normals->SetFeatureAngle(featureAngle);\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(stripper->GetOutputPort());\n\n  actor->SetMapper(mapper);\n  return;\n}\n\nvoid CreateFrogActor(std::string fileName, int tissue, vtkActor* actor)\n{\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageThreshold> selectTissue;\n  selectTissue->ThresholdBetween(tissue, tissue);\n  selectTissue->SetInValue(255);\n  selectTissue->SetOutValue(0);\n  selectTissue->SetInputConnection(reader->GetOutputPort());\n\n  double isoValue = 63.5;\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> iso_surface;\n#else\n  vtkNew<vtkMarchingCubes> iso_surface;\n#endif\n  iso_surface->SetInputConnection(selectTissue->GetOutputPort());\n  iso_surface->ComputeScalarsOff();\n  iso_surface->ComputeGradientsOff();\n  iso_surface->ComputeNormalsOn();\n  iso_surface->SetValue(0, isoValue);\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(iso_surface->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(stripper->GetOutputPort());\n\n  actor->SetMapper(mapper);\n  return;\n}\n\nvoid CreateFrogLut(vtkLookupTable* colorLut)\n{\n  vtkNew<vtkNamedColors> colors;\n  colorLut->SetTableValue(0, 0, 0, 0, 0);\n  colorLut->SetTableValue(1,\n                          colors->GetColor4d(\"salmon\").GetData()); // blood\n  colorLut->SetTableValue(2,\n                          colors->GetColor4d(\"beige\").GetData()); // brain\n  colorLut->SetTableValue(3,\n                          colors->GetColor4d(\"orange\").GetData()); // duodenum\n  colorLut->SetTableValue(\n      4,\n      colors->GetColor4d(\"misty_rose\").GetData()); // eye_retina\n  colorLut->SetTableValue(5,\n                          colors->GetColor4d(\"white\").GetData()); // eye_white\n  colorLut->SetTableValue(6,\n                          colors->GetColor4d(\"tomato\").GetData()); // heart\n  colorLut->SetTableValue(7,\n                          colors->GetColor4d(\"raspberry\").GetData()); // ileum\n  colorLut->SetTableValue(8,\n                          colors->GetColor4d(\"banana\").GetData()); // kidney\n  colorLut->SetTableValue(9,\n                          colors->GetColor4d(\"peru\").GetData()); // l_intestine\n  colorLut->SetTableValue(10,\n                          colors->GetColor4d(\"pink\").GetData()); // liver\n  colorLut->SetTableValue(11,\n                          colors->GetColor4d(\"powder_blue\").GetData()); // lung\n  colorLut->SetTableValue(12,\n                          colors->GetColor4d(\"carrot\").GetData()); // nerve\n  colorLut->SetTableValue(13,\n                          colors->GetColor4d(\"wheat\").GetData()); // skeleton\n  colorLut->SetTableValue(14,\n                          colors->GetColor4d(\"violet\").GetData()); // spleen\n  colorLut->SetTableValue(15,\n                          colors->GetColor4d(\"plum\").GetData()); // stomach\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/FrogBrain/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FrogBrain)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FrogBrain: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FrogBrain MACOSX_BUNDLE FrogBrain.cxx )\n  target_link_libraries(FrogBrain PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FrogBrain\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/FrogBrain/#download-and-build-frogbrain","title":"Download and Build FrogBrain","text":"

        Click here to download FrogBrain and its CMakeLists.txt file. Once the tarball FrogBrain.tar has been downloaded and extracted,

        cd FrogBrain/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FrogBrain\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/FrogSlice/","title":"FrogSlice","text":"

        vtk-examples/Cxx/Visualization/FrogSlice

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/FrogSlice/#description","title":"Description","text":"

        This example uses a dataset derived from a frog. This data was prepared at Lawrence Berkeley National Laboratories and is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels. (To accommodate the volume readers we have in VTK, we processed the mask files and combined them all into one vtkMetaImageReader .mhd file. Integer numbers 1\u201315 to represent the 15 tissues.

        This example shows a photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow.

        Info

        See Figure 12-6 in Chapter 12 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/FrogSlice/#code","title":"Code","text":"

        FrogSlice.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImageConstantPad.h>\n#include <vtkLookupTable.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTexture.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkWindowLevelLookupTable.h>\n\n#include <map>\n#include <string>\n\nnamespace {\nvoid CreateFrogLut(vtkLookupTable* colorLut);\nvoid SliceOrder(\n    std::map<std::string, vtkSmartPointer<vtkTransform>>& sliceOrder);\n} // namespace\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" frog.mhd frogtissue.mhd [slice]\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  int sliceNumber = 39; // to match figure 12-6\n  if (argc > 3)\n  {\n    sliceNumber = atoi(argv[3]);\n  }\n  std::map<std::string, vtkSmartPointer<vtkTransform>> sliceOrder;\n  SliceOrder(sliceOrder);\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Now create the RenderWindow, Renderer and Interactor\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderer> ren2;\n  vtkNew<vtkRenderer> ren3;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->AddRenderer(ren2);\n  renWin->AddRenderer(ren3);\n  renWin->SetWindowName(\"FrogSlice\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkMetaImageReader> greyReader;\n  greyReader->SetFileName(argv[1]);\n  greyReader->Update();\n\n  vtkNew<vtkImageConstantPad> greyPadder;\n  greyPadder->SetInputConnection(greyReader->GetOutputPort());\n  greyPadder->SetOutputWholeExtent(0, 511, 0, 511, sliceNumber, sliceNumber);\n  greyPadder->SetConstant(0);\n\n  vtkNew<vtkPlaneSource> greyPlane;\n\n  vtkNew<vtkTransformPolyDataFilter> greyTransform;\n  greyTransform->SetTransform(sliceOrder[\"hfsi\"]);\n  greyTransform->SetInputConnection(greyPlane->GetOutputPort());\n\n  vtkNew<vtkPolyDataNormals> greyNormals;\n  greyNormals->SetInputConnection(greyTransform->GetOutputPort());\n  greyNormals->FlipNormalsOff();\n\n  vtkNew<vtkWindowLevelLookupTable> wllut;\n  wllut->SetWindow(255);\n  wllut->SetLevel(128);\n  wllut->SetTableRange(0, 255);\n  wllut->Build();\n\n  vtkNew<vtkPolyDataMapper> greyMapper;\n  greyMapper->SetInputConnection(greyPlane->GetOutputPort());\n\n  vtkNew<vtkTexture> greyTexture;\n  greyTexture->SetInputConnection(greyPadder->GetOutputPort());\n  greyTexture->SetLookupTable(wllut);\n  greyTexture->SetColorModeToMapScalars();\n  greyTexture->InterpolateOn();\n\n  vtkNew<vtkActor> greyActor;\n  greyActor->SetMapper(greyMapper);\n  greyActor->SetTexture(greyTexture);\n\n  vtkNew<vtkMetaImageReader> segmentReader;\n  segmentReader->SetFileName(argv[2]);\n  segmentReader->Update();\n\n  vtkNew<vtkImageConstantPad> segmentPadder;\n  segmentPadder->SetInputConnection(segmentReader->GetOutputPort());\n  segmentPadder->SetOutputWholeExtent(0, 511, 0, 511, sliceNumber, sliceNumber);\n  segmentPadder->SetConstant(0);\n\n  vtkNew<vtkPlaneSource> segmentPlane;\n\n  vtkNew<vtkTransformPolyDataFilter> segmentTransform;\n  segmentTransform->SetTransform(sliceOrder[\"hfsi\"]);\n  segmentTransform->SetInputConnection(segmentPlane->GetOutputPort());\n\n  vtkNew<vtkPolyDataNormals> segmentNormals;\n  segmentNormals->SetInputConnection(segmentTransform->GetOutputPort());\n  segmentNormals->FlipNormalsOn();\n\n  vtkNew<vtkLookupTable> colorLut;\n  colorLut->SetNumberOfColors(17);\n  colorLut->SetTableRange(0, 16);\n  colorLut->Build();\n  CreateFrogLut(colorLut);\n\n  vtkNew<vtkPolyDataMapper> segmentMapper;\n  segmentMapper->SetInputConnection(segmentPlane->GetOutputPort());\n\n  vtkNew<vtkTexture> segmentTexture;\n  segmentTexture->SetInputConnection(segmentPadder->GetOutputPort());\n  segmentTexture->SetLookupTable(colorLut);\n  segmentTexture->SetColorModeToMapScalars();\n  segmentTexture->InterpolateOff();\n\n  vtkNew<vtkActor> segmentActor;\n  segmentActor->SetMapper(segmentMapper);\n  segmentActor->SetTexture(segmentTexture);\n\n  vtkNew<vtkActor> segmentOverlayActor;\n  segmentOverlayActor->SetMapper(segmentMapper);\n  segmentOverlayActor->SetTexture(segmentTexture);\n\n  segmentOverlayActor->GetProperty()->SetOpacity(.5);\n  ren1->SetBackground(0, 0, 0);\n  ren1->SetViewport(0, .5, .5, 1);\n  renWin->SetSize(640, 480);\n  ren1->AddActor(greyActor);\n\n  ren2->SetBackground(0, 0, 0);\n  ren2->SetViewport(.5, .5, 1, 1);\n  ren2->AddActor(segmentActor);\n\n  vtkNew<vtkCamera> cam1;\n  cam1->SetViewUp(0, -1, 0);\n  cam1->SetPosition(0, 0, -1);\n  ren1->SetActiveCamera(cam1);\n  ren1->ResetCamera();\n  cam1->SetViewUp(0, -1, 0);\n  cam1->SetPosition(0.0554068, -0.0596001, -0.491383);\n  cam1->SetFocalPoint(0.0554068, -0.0596001, 0);\n  ren1->ResetCameraClippingRange();\n\n  ren3->AddActor(greyActor);\n  ren3->AddActor(segmentOverlayActor);\n  segmentOverlayActor->SetPosition(0, 0, -0.01);\n\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren2->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren3->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  ren3->SetViewport(0, 0, 1, .5);\n\n  ren2->SetActiveCamera(ren1->GetActiveCamera());\n  ren3->SetActiveCamera(ren1->GetActiveCamera());\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateFrogLut(vtkLookupTable* colorLut)\n{\n  vtkNew<vtkNamedColors> colors;\n  colorLut->SetTableValue(0, colors->GetColor4d(\"black\").GetData());\n  colorLut->SetTableValue(1,\n                          colors->GetColor4d(\"salmon\").GetData()); // blood\n  colorLut->SetTableValue(2,\n                          colors->GetColor4d(\"beige\").GetData()); // brain\n  colorLut->SetTableValue(3,\n                          colors->GetColor4d(\"orange\").GetData()); // duodenum\n  colorLut->SetTableValue(\n      4,\n      colors->GetColor4d(\"misty_rose\").GetData()); // eye_retina\n  colorLut->SetTableValue(5,\n                          colors->GetColor4d(\"white\").GetData()); // eye_white\n  colorLut->SetTableValue(6,\n                          colors->GetColor4d(\"tomato\").GetData()); // heart\n  colorLut->SetTableValue(7,\n                          colors->GetColor4d(\"raspberry\").GetData()); // ileum\n  colorLut->SetTableValue(8,\n                          colors->GetColor4d(\"banana\").GetData()); // kidney\n  colorLut->SetTableValue(9,\n                          colors->GetColor4d(\"peru\").GetData()); // l_intestine\n  colorLut->SetTableValue(10,\n                          colors->GetColor4d(\"pink\").GetData()); // liver\n  colorLut->SetTableValue(11,\n                          colors->GetColor4d(\"powder_blue\").GetData()); // lung\n  colorLut->SetTableValue(12,\n                          colors->GetColor4d(\"carrot\").GetData()); // nerve\n  colorLut->SetTableValue(13,\n                          colors->GetColor4d(\"wheat\").GetData()); // skeleton\n  colorLut->SetTableValue(14,\n                          colors->GetColor4d(\"violet\").GetData()); // spleen\n  colorLut->SetTableValue(15,\n                          colors->GetColor4d(\"plum\").GetData()); // stomach\n}\n\nvoid SliceOrder(\n    std::map<std::string, vtkSmartPointer<vtkTransform>>& sliceOrder)\n{\n  //\n  // these transformations permute medical image data to maintain proper\n  // orientation regardless of the acquisition order. After applying these\n  // transforms with vtkTransformFilter, a view up of 0,-1,0 will result in\n  // the body part facing the viewer. NOTE: some transformations have a -1\n  // scale factor for one of the components.\n  //       To ensure proper polygon orientation and normal direction, you must\n  //       apply the vtkPolyDataNormals filter.\n  //\n  // Naming:\n  // si - superior to inferior (top to bottom)\n  // is - inferior to superior (bottom to top)\n  // ap - anterior to posterior (front to back)\n  // pa - posterior to anterior (back to front)\n  // lr - left to right\n  // rl - right to left\n  //\n  double siMatrix[16] = {1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1};\n  vtkNew<vtkTransform> si;\n  si->SetMatrix(siMatrix);\n  sliceOrder[\"si\"] = si;\n\n  double isMatrix[16] = {1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, 1};\n  vtkNew<vtkTransform> is;\n  is->SetMatrix(isMatrix);\n  sliceOrder[\"is\"] = is;\n\n  vtkNew<vtkTransform> ap;\n  ap->Scale(1, -1, 1);\n  sliceOrder[\"ap\"] = ap;\n\n  vtkNew<vtkTransform> pa;\n  pa->Scale(1, -1, -1);\n  sliceOrder[\"pa\"] = pa;\n\n  double lrMatrix[16] = {0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1};\n  vtkNew<vtkTransform> lr;\n  lr->SetMatrix(lrMatrix);\n  sliceOrder[\"lr\"] = lr;\n\n  double rlMatrix[16] = {0, 0, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1};\n  vtkNew<vtkTransform> rl;\n  rl->SetMatrix(rlMatrix);\n  sliceOrder[\"rl\"] = rl;\n\n  //\n  // The previous transforms assume radiological views of the slices (viewed\n  // from the feet). other modalities such as physical sectioning may view\n  // from the head. these transforms modify the original with a 180 rotation\n  // about y\n  //\n  double hfMatrix[16] = {-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1};\n  vtkNew<vtkTransform> hf;\n  hf->SetMatrix(hfMatrix);\n  sliceOrder[\"hf\"] = hf;\n\n  vtkNew<vtkTransform> hfsi;\n  hfsi->Concatenate(hf->GetMatrix());\n  hfsi->Concatenate(si->GetMatrix());\n  sliceOrder[\"hfsi\"] = hfsi;\n\n  vtkNew<vtkTransform> hfis;\n  hfis->Concatenate(hf->GetMatrix());\n  hfis->Concatenate(is->GetMatrix());\n  sliceOrder[\"hfis\"] = hfis;\n\n  vtkNew<vtkTransform> hfap;\n  hfap->Concatenate(hf->GetMatrix());\n  hfap->Concatenate(ap->GetMatrix());\n  sliceOrder[\"hfap\"] = hfap;\n\n  vtkNew<vtkTransform> hfpa;\n  hfpa->Concatenate(hf->GetMatrix());\n  hfpa->Concatenate(pa->GetMatrix());\n  sliceOrder[\"hfpa\"] = hfpa;\n\n  vtkNew<vtkTransform> hflr;\n  hflr->Concatenate(hf->GetMatrix());\n  hflr->Concatenate(lr->GetMatrix());\n  sliceOrder[\"\"] = hflr;\n\n  vtkNew<vtkTransform> hfrl;\n  hfrl->Concatenate(hf->GetMatrix());\n  hfrl->Concatenate(rl->GetMatrix());\n  sliceOrder[\"hfrl\"] = hfrl;\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/FrogSlice/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FrogSlice)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FrogSlice: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FrogSlice MACOSX_BUNDLE FrogSlice.cxx )\n  target_link_libraries(FrogSlice PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FrogSlice\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/FrogSlice/#download-and-build-frogslice","title":"Download and Build FrogSlice","text":"

        Click here to download FrogSlice and its CMakeLists.txt file. Once the tarball FrogSlice.tar has been downloaded and extracted,

        cd FrogSlice/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FrogSlice\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/FroggieSurface/","title":"FroggieSurface","text":"

        vtk-examples/Cxx/Visualization/FroggieSurface

        "},{"location":"Cxx/Visualization/FroggieSurface/#description","title":"Description","text":"

        Construct surfaces from a segmented frog dataset. Up to fifteen different surfaces may be extracted. The example, FroggieView is similar to this example and uses sliders to control the opacities of the tissues.

        By default the frog is oriented so that we look down on the dorsal (posterior) surface and the superior surface faces the top of the screen. The frog is rendered with the skin being translucent so that you can see the internal organs.

        In the lower left of the image there is a prop assembly with labelled XYZ axes and a cube labelled with anatomical orientations:

        • Sagittal plane
        • L - left
        • R - right
        • Coronal plane
        • A - anterior
        • P - posterior
        • Transverse plane
        • S - superior
        • I - inferior

        This prop assembly can be moved and resized.

        Individual tissues can be specified by using the \"-t\" option e.g. \"-t skin skeleton\".

        We use vtkFlyingEdges3D to take the 3D structured point set and generate the iso-surfaces. However, if desired, you can specify vtkMarchingCubes instead, use the option \"-m\".

        The parameters used to generate the example image are loaded from a JSON file containing the data needed to access and generate the actors for each tissue along with other supplementary data such as the data file names. This means that the user need only load this one file in order to generate the data for rendering. This file is called:

        <DATA>/Frog_mhd.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see Frog_mhd_format.

        The code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder.

        The dataset was prepared at the Lawrence Berkeley National Laboratories and is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels.

        To accommodate the volume readers in VTK, the mask files were processed and combined into one vtkMetaImageReader file, called frogtissue.mhd. Integer numbers 1-15 are used to represent the 15 tissues. A similar process was done for the frog skin with the result being stored in a file called frog.mhd.

        Further information:

        • VTK Examples - FroggieSurface and FroggieView

        Info

        Mutually exclusive options \"-a, -b, -c, -d\" are provided to let you generate approximations to the following figures: Figure 12-9a, Figure 12-9b, Figure 12-9c, and Figure 12-9d in Chapter 12 of the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/FroggieSurface/#code","title":"Code","text":"

        FroggieSurface.cxx

        #include <vtkActor.h>\n#include <vtkAnnotatedCubeActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkCameraOrientationWidget.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkDecimatePro.h>\n#include <vtkFlyingEdges3D.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageIslandRemoval2D.h>\n#include <vtkImageShrink3D.h>\n#include <vtkImageThreshold.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMarchingCubes.h>\n#include <vtkMatrix4x4.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProp3D.h>\n#include <vtkPropAssembly.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStripper.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkWindowedSincPolyDataFilter.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <fstream>\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <variant>\n\nnamespace fs = std::filesystem;\n\nnamespace {\nstruct Parameters\n{\n  std::vector<std::string> names;\n  std::map<std::string, std::string> colors;\n  std::map<std::string, std::string> mhdFiles;\n  std::vector<std::string> fig_129b;\n  std::vector<std::string> fig_129cd;\n  std::map<std::string,\n           std::map<std::string, std::variant<int, double, std::string>>>\n      tissues;\n\n  bool parsedOk{false};\n};\n\n/**\n * Take a string and convert it to lowercase.\n *\n * See: https://en.cppreference.com/w/cpp/string/byte/tolower\n * Only works with ASCII characters.\n *\n * @param s: The string to be converted to lowercase.\n *\n * @return The lowercase version of the string.\n */\nstd::string ToLowerCase(std::string s);\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid ParseJSON(const fs::path fnPath, Parameters& parameters);\n\n/**\n * Create the lookup table for the frog tissues.\n *\n * Each table value corresponds the color of one of the frog tissues.\n *\n * @param indices: The tissue name and index.\n * @param colors: The tissue name and color.\n * @return: The lookup table.\n */\nvtkNew<vtkLookupTable>\nCreateTissueLUT(std::map<std::string, int> const& indices,\n                std::map<std::string, std::string>& colors);\n\nclass SliceOrder\n{\n  // clang-format off\n  /*\n    These transformations permute image and other geometric data to maintain\n      proper orientation regardless of the acquisition order. After applying\n      these transforms with vtkTransformFilter, a view up of 0, -1, 0 will\n      result in the body part facing the viewer.\n\n    NOTE: Some transformations have a -1 scale factor for one of the components.\n          To ensure proper polygon orientation and normal direction,\n            you must apply the vtkPolyDataNormals filter.\n\n    Naming (the nomenclature is medical):\n      si - superior to inferior (top to bottom)\n      is - inferior to superior (bottom to top)\n      ap - anterior to posterior (front to back)\n      pa - posterior to anterior (back to front)\n      lr - left to right\n      rl - right to left\n\n    */\n  // clang-format on\n\npublic:\n  /**\n   * Generate the transforms corresponding to the slice order.\n   */\n  SliceOrder();\n\n  virtual ~SliceOrder() = default;\n\npublic:\n  /**\n   * Returns the vtkTransform corresponding to the slice order.\n   *\n   * @param sliceOrder: The slice order.\n   * @return The vtkTransform corresponding to the slice order.\n   */\n  vtkSmartPointer<vtkTransform> Get(std::string const& sliceOrder);\n\n  /**\n   * Print the homogenous matrix corresponding to the slice order.\n   *\n   * @param order: The slice order.\n   */\n  void PrintTransform(std::string const& order);\n\n  /**\n   * Print all the homogenous matrices corresponding to the slice orders.\n   *\n   */\n  void PrintAlltransforms();\n\nprivate:\n  std::map<std::string, vtkSmartPointer<vtkTransform>> transform;\n};\n\n/**\n * Create the actor for a specific tissue.\n *\n * @param name: The tissue name.\n * @param tissue: The tissue parameters.\n * @param files: The path to the tissue files.\n * @param flying_edges: If true use flying edges.\n * @param decimate: If true decimate.\n * @param lut: The color lookup table for the tissues.\n * @param so: The transforms corresponding to the slice order.\n * @param actor: The actor.\n */\nvoid CreateTissueActor(\n    std::string const& name,\n    std::map<std::string, std::variant<int, double, std::string>>& tissue,\n    std::map<std::string, std::string>& files, bool const& flying_edges,\n    bool const& decimate, vtkLookupTable& color_lut, SliceOrder& so,\n    vtkActor* actor);\n\n/**\n * @param scale: Sets the scale and direction of the axes.\n * @param xyzLabels: Labels for the axes.\n * @return The axes actor.\n */\nvtkNew<vtkAxesActor> MakeAxesActor(std::array<double, 3>& scale,\n                                   std::array<std::string, 3> const& xyzLabels);\n\n/**\n * @param cubeLabels: The labels for the cube faces.\n * @param colors: Used to set the colors of the cube faces.\n * @return The annotated cube actor.\n */\nvtkNew<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(std::array<std::string, 6> const& cubeLabels,\n                       vtkNamedColors* colors);\n\n/**\n * @param labelSelector: The selector used to define labels for the axes and\n * cube.\n * @param colors: Used to set the colors of the cube faces.\n * @return The combined axes and annotated cube prop.\n */\nvtkNew<vtkPropAssembly> MakeCubeActor(std::string const& labelSelector,\n                                      vtkNamedColors* colors);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"Construct surfaces from a segmented frog dataset.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file e.g. Frog_mhd.json.\")\n      ->required()\n      ->check(CLI::ExistingFile);\n\n  bool flyingEdges = true;\n  app.add_flag(\"-m{false},!-n\", flyingEdges,\n               \"Use flying edges by default, marching cubes if set.\");\n  bool decimation{false};\n  // -o: obliterate a synonym for decimation.\n  app.add_flag(\"-o\", decimation, \"Decimate if set.\");\n\n  std::vector<std::string> chosenTissues;\n  app.add_option(\"-t\", chosenTissues, \"Select one or more tissues.\");\n\n  std::array<bool, 6> view{false, false, false, false, false, false};\n  auto* ogroup =\n      app.add_option_group(\"view\",\n                           \"Select the orientation of the frog. Only none or \"\n                           \"one of these can be selected.\");\n  ogroup->add_flag(\"-a\", view[0],\n                   \"The view corresponds to Fig 12-9a in the VTK Textbook\");\n  ogroup->add_flag(\"-b\", view[1],\n                   \"The view corresponds to Fig 12-9b in the VTK Textbook\");\n  ogroup->add_flag(\"-c\", view[2],\n                   \"The view corresponds to Fig 12-9c in the VTK Textbook\");\n  ogroup->add_flag(\"-d\", view[3],\n                   \"The view corresponds to Fig 12-9d in the VTK Textbook\");\n  ogroup->add_flag(\n      \"-l\", view[4],\n      \"The view corresponds to looking down on the anterior surface\");\n  ogroup->add_flag(\"-p\", view[5],\n                   \"The view corresponds to looking down on the posterior \"\n                   \"surface (the default)\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto selectCount = std::count_if(view.begin(), view.end(),\n                                   [=](const bool& e) { return e == true; });\n  if (selectCount > 1)\n  {\n    std::cerr << \"Only one or none of the options -a, -b, -c, -d, -l, -p can \"\n                 \"be selected;\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  ParseJSON(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  std::vector<std::string> tissues;\n  std::map<std::string, int> indices;\n\n  for (auto const& n : parameters.names)\n  {\n    if (n != \"brainbin\")\n    {\n      tissues.push_back(n);\n      indices[n] = *std::get_if<int>(&parameters.tissues[n][\"tissue\"]);\n    }\n  }\n  auto lut = CreateTissueLUT(indices, parameters.colors);\n\n  char selectFigure{'\\0'};\n  if (selectCount == 1)\n  {\n    if (view[0])\n    {\n      selectFigure = 'a';\n    }\n    else if (view[1])\n    {\n      // No skin.\n      tissues = parameters.fig_129b;\n      selectFigure = 'b';\n    }\n    else if (view[2])\n    {\n      // No skin, blood and skeleton.\n      tissues = parameters.fig_129cd;\n      selectFigure = 'c';\n    }\n    else if (view[3])\n    {\n      // No skin, blood and skeleton.\n      tissues = parameters.fig_129cd;\n      selectFigure = 'd';\n    }\n    else if (view[4])\n    {\n      // Looking down on the anterior surface.\n      selectFigure = 'l';\n    }\n    else // The default\n    {\n      // Looking down on the posterior surface.\n      selectFigure = 'p';\n    }\n  }\n\n  if (!chosenTissues.empty())\n  {\n    for (auto i = 0; i < chosenTissues.size(); ++i)\n    {\n      chosenTissues[i] = ToLowerCase(chosenTissues[i]);\n    }\n    std::vector<std::string> res;\n    auto has_brainbin{false};\n    if (std::find(chosenTissues.begin(), chosenTissues.end(), \"brainbin\") !=\n        chosenTissues.end())\n    {\n      std::cout << \"Using brainbin instead of brain.\" << std::endl;\n      res.push_back(\"brainbin\");\n      indices.erase(\"brain\");\n      indices[\"brainbin\"] = 2;\n      parameters.colors.erase(\"brain\");\n      parameters.colors[\"brainbin\"] = \"beige\";\n      has_brainbin = true;\n    }\n    for (auto const& ct : chosenTissues)\n    {\n      if (has_brainbin && (ct == \"brain\" || ct == \"brainbin\"))\n      {\n        continue;\n      }\n      if (std::find(tissues.begin(), tissues.end(), ct) != tissues.end())\n      {\n        res.push_back(ct);\n      }\n      else\n      {\n        std::cout << \"Tissue: \" << ct << \" is not available.\" << std::endl;\n        return EXIT_FAILURE;\n      }\n    }\n    if (res.size() == 1 && res[0] == \"skin\")\n    {\n      parameters.tissues[\"skin\"][\"opacity\"] = 1.0;\n    }\n    tissues = res;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"ParaViewBkg\",\n                   std::array<unsigned char, 4>{82, 87, 110, 255}.data());\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  SliceOrder so;\n  // so.PrintAlltransforms();\n\n  size_t colorSize{0};\n  for (auto const& p : parameters.colors)\n  {\n    colorSize = std::max(colorSize, p.second.size());\n  }\n  size_t nameSize{0};\n  for (auto const& p : parameters.names)\n  {\n    nameSize = std::max(nameSize, p.size());\n  }\n\n  std::string line(7 + nameSize + colorSize, '-');\n\n  std::cout << line << '\\n'\n            << std::setw(nameSize) << std::left << \"Tissue\"\n            << \" Label \"\n            << \"Color\" << '\\n'\n            << line << std::endl;\n  auto intSize = 2;\n\n  for (auto const& name : tissues)\n  {\n    vtkNew<vtkActor> actor;\n    CreateTissueActor(name, parameters.tissues[name], parameters.mhdFiles,\n                      flyingEdges, decimation, *lut, so, actor);\n    ren->AddActor(actor);\n    std::cout << std::setw(nameSize) << std::left << name << \" \"\n              << std::setw(intSize + 3) << std::right << indices[name] << \" \"\n              << std::setw(colorSize) << std::left << parameters.colors[name]\n              << std::endl;\n  }\n  std::cout << line << std::endl;\n\n  renWin->SetSize(1024, 1024);\n  renWin->SetWindowName(\"FroggieSurface\");\n\n  ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n\n  auto camera = ren->GetActiveCamera();\n  // Superior Anterior Left\n  auto labels{\"sal\"};\n  if (selectFigure == 'a')\n  {\n    // Fig 12-9a in the VTK Textbook\n    camera->SetPosition(742.731237, -441.329635, -877.192015);\n    camera->SetFocalPoint(247.637687, 120.680880, -253.487473);\n    camera->SetViewUp(-0.323882, -0.816232, 0.478398);\n    camera->SetDistance(974.669585);\n    camera->SetClippingRange(311.646383, 1803.630763);\n  }\n  else if (selectFigure == 'b')\n  {\n    // Fig 12-9b in the VTK Textbook\n    camera->SetPosition(717.356065, -429.889054, -845.381584);\n    camera->SetFocalPoint(243.071719, 100.996487, -247.446340);\n    camera->SetViewUp(-0.320495, -0.820148, 0.473962);\n    camera->SetDistance(929.683631);\n    camera->SetClippingRange(293.464446, 1732.794957);\n  }\n  else if (selectFigure == 'c')\n  {\n    // Fig 12-9c in the VTK Textbook\n    camera->SetPosition(447.560023, -136.611491, -454.753689);\n    camera->SetFocalPoint(253.142277, 91.949451, -238.583973);\n    camera->SetViewUp(-0.425438, -0.786048, 0.448477);\n    camera->SetDistance(369.821187);\n    camera->SetClippingRange(0.829116, 829.115939);\n  }\n  else if (selectFigure == 'd')\n  {\n    // Fig 12-9d in the VTK Textbook\n    camera->SetPosition(347.826249, -469.633647, -236.234262);\n    camera->SetFocalPoint(296.893207, 89.307704, -225.156581);\n    camera->SetViewUp(-0.687345, -0.076948, 0.722244);\n    camera->SetDistance(561.366478);\n    camera->SetClippingRange(347.962064, 839.649856);\n  }\n  else if (selectFigure == 'l')\n  {\n    // Orient so that we look down on the anterior surface and\n    //  the superior surface faces the top of the screen.\n    // Left Superior Anterior\n    labels = \"lsa\";\n    vtkNew<vtkTransform> transform;\n    transform->SetMatrix(camera->GetModelTransformMatrix());\n    transform->RotateY(90);\n    transform->RotateZ(90);\n    camera->SetModelTransformMatrix(transform->GetMatrix());\n    ren->ResetCamera();\n  }\n  else\n  {\n    // Orient so that we look down on the posterior surface and\n    //  the superior surface faces the top of the screen.\n    // Right Superior Posterior\n    labels = \"rsp\";\n    vtkNew<vtkTransform> transform;\n    transform->SetMatrix(camera->GetModelTransformMatrix());\n    transform->RotateY(-90);\n    transform->RotateZ(90);\n    camera->SetModelTransformMatrix(transform->GetMatrix());\n    ren->ResetCamera();\n  }\n\n  vtkNew<vtkCameraOrientationWidget> cow;\n  cow->SetParentRenderer(ren);\n  // Turn off if you do not want it.\n  cow->On();\n  cow->EnabledOn();\n\n  auto axes = MakeCubeActor(labels, colors);\n  vtkNew<vtkOrientationMarkerWidget> om;\n  om->SetOrientationMarker(axes);\n  // Position upper left in the viewport.\n  // om->SetViewport(0.0, 0.8, 0.2, 1.0);\n  // Position lower left in the viewport.\n  om->SetViewport(0, 0, 0.2, 0.2);\n  om->SetInteractor(iRen);\n  om->EnabledOn();\n  om->InteractiveOn();\n\n  renWin->Render();\n\n  iRen->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::string ToLowerCase(std::string s)\n{\n  std::transform(s.begin(), s.end(), s.begin(),\n                 [](unsigned char c) { return std::tolower(c); } // correct\n  );\n  return s;\n}\n\nvoid ParseJSON(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Get the parameters that we need.\n  fs::path mhdPath;\n  std::vector<std::string> fileNames;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (outer.name() == \"files\")\n    {\n      std::string path;\n      for (Json::Value::const_iterator pth = root[\"files\"].begin();\n           pth != root[\"files\"].end(); ++pth)\n      {\n        if (pth.name() == \"root\")\n        {\n          mhdPath = fs::path(pth->asString());\n        }\n        if (pth.name() == \"mhd_files\")\n        {\n          for (Json::Value::const_iterator fls =\n                   root[\"files\"][\"mhd_files\"].begin();\n               fls != root[\"files\"][\"mhd_files\"].end(); ++fls)\n          {\n            fileNames.push_back(fls->asString());\n          }\n        }\n      }\n    }\n    if (outer.name() == \"tissues\")\n    {\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"colors\"].begin();\n           tc != root[\"tissues\"][\"colors\"].end(); ++tc)\n      {\n        parameters.colors[tc.name()] = tc->asString();\n      }\n    }\n    if (outer.name() == \"figures\")\n    {\n      for (Json::Value::const_iterator c = root[\"figures\"][\"fig12-9b\"].begin();\n           c != root[\"figures\"][\"fig12-9b\"].end(); ++c)\n      {\n        parameters.fig_129b.push_back(c->asString());\n      }\n      for (Json::Value::const_iterator c = root[\"figures\"][\"fig12-9cd\"].begin();\n           c != root[\"figures\"][\"fig12-9cd\"].end(); ++c)\n      {\n        parameters.fig_129cd.push_back(c->asString());\n      }\n    }\n    if (outer.name() == \"tissue_parameters\")\n    {\n      // A map of the parameters and the type of the parameter.\n      std::map<std::string, std::string> parameterTypes;\n      for (Json::Value::const_iterator p =\n               root[\"tissue_parameters\"][\"parameter types\"].begin();\n           p != root[\"tissue_parameters\"][\"parameter types\"].end(); ++p)\n      {\n        parameterTypes[p.name()] = p->asString();\n      }\n\n      // Map a variant of the correct type to the parameter name.\n      // parameterTypes: A map of the parameters and the type of the parameter.\n      // p: The Json iterator\n      // kv: The map of the parameter name (ket) and\n      //     the vatiant of the correct type (value).\n      auto populate =\n          [&parameterTypes](\n              Json::Value::const_iterator& p,\n              std::map<std::string, std::variant<int, double, std::string>>&\n                  kv) {\n            std::string n = p.name();\n            if (parameterTypes.find(n) == parameterTypes.end())\n            {\n              std::cout << \"We cannot determine the type for \" << n\n                        << std::endl;\n              return;\n            }\n            if (parameterTypes[p.name()] == \"int\")\n            {\n              kv[ToLowerCase(p.name())] = p->asInt();\n            }\n            if (parameterTypes[p.name()] == \"dbl\")\n            {\n              kv[ToLowerCase(p.name())] = p->asDouble();\n            }\n            if (parameterTypes[p.name()] == \"str\")\n            {\n              kv[ToLowerCase(p.name())] = p->asString();\n            }\n          };\n\n      std::map<std::string, std::variant<int, double, std::string>> bp;\n      for (Json::Value::const_iterator p =\n               root[\"tissue_parameters\"][\"default\"].begin();\n           p != root[\"tissue_parameters\"][\"default\"].end(); ++p)\n      {\n        populate(p, bp);\n      }\n      for (Json::Value::const_iterator p =\n               root[\"tissue_parameters\"][\"frog\"].begin();\n           p != root[\"tissue_parameters\"][\"frog\"].end(); ++p)\n      {\n        populate(p, bp);\n      }\n      std::set<std::string> exclude{\"default\", \"frog\", \"parameter types\"};\n      for (Json::Value::const_iterator p = root[\"tissue_parameters\"].begin();\n           p != root[\"tissue_parameters\"].end(); ++p)\n      {\n        if (exclude.find(p.name()) != exclude.end())\n        {\n          continue;\n        }\n        std::map<std::string, std::variant<int, double, std::string>> tmp;\n        std::copy(bp.begin(), bp.end(), std::inserter(tmp, tmp.end()));\n        for (Json::Value::const_iterator q =\n                 root[\"tissue_parameters\"][p.name()].begin();\n             q != root[\"tissue_parameters\"][p.name()].end(); ++q)\n        {\n          populate(q, tmp);\n        }\n        parameters.tissues[p.name()] = tmp;\n        parameters.names.push_back(p.name());\n      }\n    }\n  }\n\n  //  Build and check the paths.\n  if (!fileNames.empty())\n  {\n    if (fileNames.size() != 2)\n    {\n      std::cerr << \"Expected two file names.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < fileNames.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / mhdPath / fs::path(fileNames[i]);\n        fileNames[i] = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << fileNames[i]\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.mhdFiles[pth.stem().string()] =\n              pth.make_preferred().string();\n        }\n      }\n    }\n  }\n  else\n  {\n    std::cerr << \"Expected .mhd file names in the JSON file.\";\n    parameters.parsedOk = false;\n  }\n}\n\nvtkNew<vtkLookupTable>\nCreateTissueLUT(std::map<std::string, int> const& indices,\n                std::map<std::string, std::string>& colors)\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(colors.size());\n  lut->SetTableRange(0, colors.size() - 1);\n  lut->Build();\n\n  vtkNew<vtkNamedColors> nc;\n\n  for (auto const& p : indices)\n  {\n    lut->SetTableValue(p.second, nc->GetColor4d(colors[p.first]).GetData());\n  }\n\n  return lut;\n}\n\nSliceOrder::SliceOrder()\n{\n  vtkNew<vtkMatrix4x4> si_mat;\n  si_mat->Zero();\n  si_mat->SetElement(0, 0, 1);\n  si_mat->SetElement(1, 2, 1);\n  si_mat->SetElement(2, 1, -1);\n  si_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> is_mat;\n  is_mat->Zero();\n  is_mat->SetElement(0, 0, 1);\n  is_mat->SetElement(1, 2, -1);\n  is_mat->SetElement(2, 1, -1);\n  is_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> lr_mat;\n  lr_mat->Zero();\n  lr_mat->SetElement(0, 2, -1);\n  lr_mat->SetElement(1, 1, -1);\n  lr_mat->SetElement(2, 0, 1);\n  lr_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> rl_mat;\n  rl_mat->Zero();\n  rl_mat->SetElement(0, 2, 1);\n  rl_mat->SetElement(1, 1, -1);\n  rl_mat->SetElement(2, 0, 1);\n  rl_mat->SetElement(3, 3, 1);\n\n  // The previous transforms assume radiological views of the slices\n  //  (viewed from the feet).\n  // Other modalities such as physical sectioning may view from the head.\n  // The following transforms modify the original with a 180\u00b0 rotation about y\n\n  vtkNew<vtkMatrix4x4> hf_mat;\n  hf_mat->Zero();\n  hf_mat->SetElement(0, 0, -1);\n  hf_mat->SetElement(1, 1, 1);\n  hf_mat->SetElement(2, 2, -1);\n  hf_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkTransform> si_trans;\n  si_trans->SetMatrix(si_mat);\n  this->transform[\"si\"] = si_trans;\n\n  vtkNew<vtkTransform> is_trans;\n  is_trans->SetMatrix(is_mat);\n  this->transform[\"is\"] = is_trans;\n\n  vtkNew<vtkTransform> ap_trans;\n  ap_trans->Scale(1, -1, 1);\n  this->transform[\"ap\"] = ap_trans;\n\n  vtkNew<vtkTransform> pa_trans;\n  pa_trans->Scale(1, -1, -1);\n  this->transform[\"pa\"] = pa_trans;\n\n  vtkNew<vtkTransform> lr_trans;\n  lr_trans->SetMatrix(lr_mat);\n  this->transform[\"lr\"] = lr_trans;\n\n  vtkNew<vtkTransform> rl_trans;\n  lr_trans->SetMatrix(rl_mat);\n  this->transform[\"rl\"] = rl_trans;\n\n  vtkNew<vtkTransform> hf_trans;\n  hf_trans->SetMatrix(hf_mat);\n  this->transform[\"hf\"] = hf_trans;\n\n  vtkNew<vtkTransform> hf_si_trans;\n  hf_si_trans->SetMatrix(hf_mat);\n  hf_si_trans->Concatenate(si_mat);\n  this->transform[\"hfsi\"] = hf_si_trans;\n\n  vtkNew<vtkTransform> hf_is_trans;\n  hf_is_trans->SetMatrix(hf_mat);\n  hf_is_trans->Concatenate(is_mat);\n  this->transform[\"hfis\"] = hf_is_trans;\n\n  vtkNew<vtkTransform> hf_ap_trans;\n  hf_ap_trans->SetMatrix(hf_mat);\n  hf_ap_trans->Scale(1, -1, 1);\n  this->transform[\"hfap\"] = hf_ap_trans;\n\n  vtkNew<vtkTransform> hf_pa_trans;\n  hf_pa_trans->SetMatrix(hf_mat);\n  hf_pa_trans->Scale(1, -1, -1);\n  this->transform[\"hfpa\"] = hf_pa_trans;\n\n  vtkNew<vtkTransform> hf_lr_trans;\n  hf_lr_trans->SetMatrix(hf_mat);\n  hf_lr_trans->Concatenate(lr_mat);\n  this->transform[\"hflr\"] = hf_lr_trans;\n\n  vtkNew<vtkTransform> hf_rl_trans;\n  hf_rl_trans->SetMatrix(hf_mat);\n  hf_rl_trans->Concatenate(rl_mat);\n  this->transform[\"hfrl\"] = hf_rl_trans;\n\n  // Identity\n  this->transform[\"I\"] = vtkNew<vtkTransform>();\n\n  // Zero\n  vtkNew<vtkTransform> z_trans;\n  z_trans->Scale(0, 0, 0);\n  this->transform[\"Z\"] = z_trans;\n}\n\nvoid SliceOrder::PrintTransform(std::string const& order)\n{\n  auto m = this->transform[order]->GetMatrix();\n  std::ostringstream os;\n  os.setf(std::ios_base::fmtflags(), std::ios_base::floatfield);\n  os << order << '\\n';\n  for (int i = 0; i < 4; ++i)\n  {\n    for (int j = 0; j < 4; ++j)\n    {\n      if (j < 3)\n      {\n        os << std::setw(6) << std::right << std::setprecision(2)\n           << m->GetElement(i, j) << \" \";\n      }\n      else\n      {\n        os << std::setw(6) << std::right << m->GetElement(i, j) << '\\n';\n      }\n    }\n  }\n  std::cout << os.str() << '\\n';\n  os.str(\"\");\n}\n\nvoid SliceOrder::PrintAlltransforms()\n{\n  for (auto const p : this->transform)\n  {\n    PrintTransform(p.first);\n  }\n}\n\nvtkSmartPointer<vtkTransform> SliceOrder::Get(std::string const& sliceOrder)\n{\n  return this->transform[sliceOrder];\n}\n\nvoid CreateTissueActor(\n    std::string const& name,\n    std::map<std::string, std::variant<int, double, std::string>>& tissue,\n    std::map<std::string, std::string>& files, bool const& flying_edges,\n    bool const& decimate, vtkLookupTable& color_lut, SliceOrder& so,\n    vtkActor* actor)\n{\n\n  auto pixelSize = *std::get_if<int>(&tissue[\"pixel_size\"]);\n  auto spacing = *std::get_if<double>(&tissue[\"spacing\"]);\n  auto startSlice = *std::get_if<int>(&tissue[\"start_slice\"]);\n  std::array<double, 3> dataSpacing{static_cast<double>(pixelSize),\n                                    static_cast<double>(pixelSize), spacing};\n  auto columns = *std::get_if<int>(&tissue[\"columns\"]);\n  auto rows = *std::get_if<int>(&tissue[\"rows\"]);\n  std::array<double, 3> dataOrigin = {-(columns / 2.0) * pixelSize,\n                                      -(rows / 2.0) * pixelSize,\n                                      startSlice * spacing};\n  std::array<int, 6> voi;\n  voi[0] = *std::get_if<int>(&tissue[\"start_column\"]);\n  voi[1] = *std::get_if<int>(&tissue[\"end_column\"]);\n  voi[2] = *std::get_if<int>(&tissue[\"start_row\"]);\n  voi[3] = *std::get_if<int>(&tissue[\"end_row\"]);\n  voi[4] = *std::get_if<int>(&tissue[\"start_slice\"]);\n  voi[5] = *std::get_if<int>(&tissue[\"end_slice\"]);\n  // Adjust y bounds for PNM coordinate system.\n  auto tmp = voi[2];\n  voi[2] = rows - voi[3] - 1;\n  voi[3] = rows - tmp - 1;\n\n  std::string fn;\n  if (name == \"skin\")\n  {\n    fn = files[\"frog\"];\n  }\n  else\n  {\n    fn = files[\"frogtissue\"];\n  }\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(fn.c_str());\n  reader->SetDataSpacing(dataSpacing.data());\n  reader->SetDataOrigin(dataOrigin.data());\n  reader->SetDataExtent(voi.data());\n  reader->Update();\n\n  // These are used to determine what filters\n  // to use based on the options chosen.\n  auto islandRemoverFlag{false};\n  auto selectTissueFlag{false};\n  auto gaussianFlag{false};\n\n  vtkNew<vtkImageIslandRemoval2D> islandRemover;\n  vtkNew<vtkImageThreshold> selectTissue;\n  if (name != \"skin\")\n  {\n    auto ir = *std::get_if<double>(&tissue[\"island_replace\"]);\n    auto ia = *std::get_if<double>(&tissue[\"island_area\"]);\n    auto idx = *std::get_if<int>(&tissue[\"tissue\"]);\n    if (ir > 0)\n    {\n      islandRemover->SetAreaThreshold(ia);\n      islandRemover->SetIslandValue(ir);\n      islandRemover->SetReplaceValue(idx);\n      islandRemover->SetInputConnection(reader->GetOutputPort());\n      islandRemover->Update();\n      islandRemoverFlag = true;\n    }\n    selectTissue->ThresholdBetween(idx, idx);\n    selectTissue->SetInValue(255);\n    selectTissue->SetOutValue(0);\n    if (islandRemoverFlag)\n    {\n      selectTissue->SetInputConnection(islandRemover->GetOutputPort());\n    }\n    else\n    {\n      selectTissue->SetInputConnection(reader->GetOutputPort());\n    }\n    selectTissue->Update();\n    selectTissueFlag = true;\n  }\n\n  std::array<int, 3> sampleRate;\n  sampleRate[0] = *std::get_if<int>(&tissue[\"sample_rate_column\"]);\n  sampleRate[1] = *std::get_if<int>(&tissue[\"sample_rate_row\"]);\n  sampleRate[2] = *std::get_if<int>(&tissue[\"sample_rate_slice\"]);\n  vtkNew<vtkImageShrink3D> shrinker;\n  if (selectTissueFlag)\n  {\n    shrinker->SetInputConnection(selectTissue->GetOutputPort());\n  }\n  else\n  {\n    shrinker->SetInputConnection(reader->GetOutputPort());\n  }\n  shrinker->SetShrinkFactors(sampleRate.data());\n  shrinker->AveragingOn();\n  shrinker->Update();\n\n  std::array<double, 3> gsd;\n  gsd[0] = *std::get_if<double>(&tissue[\"gaussian_standard_deviation_column\"]);\n  gsd[1] = *std::get_if<double>(&tissue[\"gaussian_standard_deviation_row\"]);\n  gsd[2] = *std::get_if<double>(&tissue[\"gaussian_standard_deviation_slice\"]);\n\n  vtkNew<vtkImageGaussianSmooth> gaussian;\n\n  bool allZero =\n      std::all_of(gsd.begin(), gsd.end(), [](double i) { return i == 0; });\n  if (!allZero)\n  {\n    std::array<double, 3> grf;\n    grf[0] = *std::get_if<double>(&tissue[\"gaussian_radius_factor_column\"]);\n    grf[1] = *std::get_if<double>(&tissue[\"gaussian_radius_factor_row\"]);\n    grf[2] = *std::get_if<double>(&tissue[\"gaussian_radius_factor_slice\"]);\n\n    gaussian->SetStandardDeviations(gsd.data());\n    gaussian->SetRadiusFactors(grf.data());\n    gaussian->SetInputConnection(shrinker->GetOutputPort());\n    gaussian->Update();\n    gaussianFlag = true;\n  }\n\n  auto iso_value = *std::get_if<double>(&tissue[\"value\"]);\n  vtkNew<vtkFlyingEdges3D> flyingIsoSurface;\n  vtkNew<vtkMarchingCubes> marchingIsoSurface;\n  if (flying_edges)\n  {\n    if (gaussianFlag)\n    {\n      flyingIsoSurface->SetInputConnection(gaussian->GetOutputPort());\n    }\n    else\n    {\n      flyingIsoSurface->SetInputConnection(shrinker->GetOutputPort());\n    }\n    flyingIsoSurface->ComputeScalarsOff();\n    flyingIsoSurface->ComputeGradientsOff();\n    flyingIsoSurface->ComputeNormalsOff();\n    flyingIsoSurface->SetValue(0, iso_value);\n    flyingIsoSurface->Update();\n  }\n  else\n  {\n    if (gaussianFlag)\n    {\n      marchingIsoSurface->SetInputConnection(gaussian->GetOutputPort());\n    }\n    else\n    {\n      marchingIsoSurface->SetInputConnection(shrinker->GetOutputPort());\n    }\n    marchingIsoSurface->ComputeScalarsOff();\n    marchingIsoSurface->ComputeGradientsOff();\n    marchingIsoSurface->ComputeNormalsOff();\n    marchingIsoSurface->SetValue(0, iso_value);\n    marchingIsoSurface->Update();\n  }\n\n  auto sliceOrder = *std::get_if<std::string>(&tissue[\"slice_order\"]);\n  auto transform = vtkSmartPointer<vtkTransform>::New();\n  transform = so.Get(sliceOrder);\n  vtkNew<vtkTransformPolyDataFilter> tf;\n  tf->SetTransform(transform);\n  if (flying_edges)\n  {\n    tf->SetInputConnection(flyingIsoSurface->GetOutputPort());\n  }\n  else\n  {\n    tf->SetInputConnection(marchingIsoSurface->GetOutputPort());\n  }\n\n  vtkNew<vtkDecimatePro> decimator;\n  if (decimate)\n  {\n    auto decimateAngle = *std::get_if<double>(&tissue[\"decimate_angle\"]);\n    auto decimateError = *std::get_if<double>(&tissue[\"decimate_error\"]);\n    auto decimateReduction =\n        *std::get_if<double>(&tissue[\"decimate_reduction\"]);\n    decimator->SetInputConnection(tf->GetOutputPort());\n    decimator->SetFeatureAngle(decimateAngle);\n    decimator->PreserveTopologyOn();\n    decimator->SetErrorIsAbsolute(1);\n    decimator->SetAbsoluteError(decimateError);\n    decimator->SetTargetReduction(decimateReduction);\n  }\n\n  vtkNew<vtkWindowedSincPolyDataFilter> smoother;\n  auto smoothIterations = *std::get_if<int>(&tissue[\"smooth_iterations\"]);\n  if (smoothIterations != 0)\n  {\n    auto smoothAngle = *std::get_if<double>(&tissue[\"smooth_angle\"]);\n    auto smoothFactor = *std::get_if<double>(&tissue[\"smooth_factor\"]);\n    if (decimate)\n    {\n      smoother->SetInputConnection(decimator->GetOutputPort());\n    }\n    else\n    {\n      smoother->SetInputConnection(tf->GetOutputPort());\n    }\n    smoother->SetNumberOfIterations(smoothIterations);\n    smoother->BoundarySmoothingOff();\n    smoother->FeatureEdgeSmoothingOff();\n    smoother->SetFeatureAngle(smoothAngle);\n    smoother->SetPassBand(smoothFactor);\n    smoother->NonManifoldSmoothingOn();\n    smoother->NormalizeCoordinatesOff();\n    smoother->Update();\n  }\n\n  auto featureAngle = *std::get_if<double>(&tissue[\"feature_angle\"]);\n  vtkNew<vtkPolyDataNormals> normals;\n  if (smoothIterations != 0)\n  {\n    normals->SetInputConnection(smoother->GetOutputPort());\n  }\n  else\n  {\n    if (decimate)\n    {\n      normals->SetInputConnection(decimator->GetOutputPort());\n    }\n    else\n    {\n      normals->SetInputConnection(tf->GetOutputPort());\n    }\n  }\n  normals->SetFeatureAngle(featureAngle);\n\n  vtkNew<vtkStripper> stripper;\n  stripper->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(stripper->GetOutputPort());\n\n  auto opacity = *std::get_if<double>(&tissue[\"opacity\"]);\n  auto tissue_color =\n      color_lut.GetTableValue(*std::get_if<int>(&tissue[\"tissue\"]));\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetOpacity(opacity);\n  actor->GetProperty()->SetDiffuseColor(tissue_color);\n  actor->GetProperty()->SetSpecular(0.5);\n  actor->GetProperty()->SetSpecularPower(10);\n}\n\nvtkNew<vtkAxesActor> MakeAxesActor(std::array<double, 3>& scale,\n                                   std::array<std::string, 3> const& xyzLabels)\n{\n  vtkNew<vtkAxesActor> axes;\n  axes->SetScale(scale.data());\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(xyzLabels[0].c_str());\n  axes->SetYAxisLabelText(xyzLabels[1].c_str());\n  axes->SetZAxisLabelText(xyzLabels[2].c_str());\n  axes->SetCylinderRadius(0.5 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.025 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.5 * axes->GetSphereRadius());\n  auto tprop = axes->GetXAxisCaptionActor2D()->GetCaptionTextProperty();\n  tprop->ItalicOn();\n  tprop->ShadowOn();\n  tprop->SetFontFamilyToTimes();\n  // Use the same text properties on the other two axes.\n  axes->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  axes->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  return axes;\n}\n\nvtkNew<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(std::array<std::string, 6> const& cubeLabels,\n                       vtkNamedColors* colors)\n{\n  // A cube with labeled faces.\n  vtkNew<vtkAnnotatedCubeActor> cube;\n  cube->SetXPlusFaceText(cubeLabels[0].c_str());\n  cube->SetXMinusFaceText(cubeLabels[1].c_str());\n  cube->SetYPlusFaceText(cubeLabels[2].c_str());\n  cube->SetYMinusFaceText(cubeLabels[3].c_str());\n  cube->SetZPlusFaceText(cubeLabels[4].c_str());\n  cube->SetZMinusFaceText(cubeLabels[5].c_str());\n  cube->SetFaceTextScale(0.5);\n  cube->GetCubeProperty()->SetColor(colors->GetColor3d(\"Gainsboro\").GetData());\n\n  cube->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Change the vector text colors.\n  cube->GetXPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetXMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetYPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetYMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetZPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  cube->GetZMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  return cube;\n}\n\nvtkNew<vtkPropAssembly> MakeCubeActor(std::string const& labelSelector,\n                                      vtkNamedColors* colors)\n{\n  std::array<std::string, 3> xyzLabels;\n  std::array<std::string, 6> cubeLabels;\n  std::array<double, 3> scale;\n  if (labelSelector == \"sal\")\n  {\n    // xyzLabels = std::array<std::string,3>{\"S\", \"A\", \"L\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"S\", \"I\", \"A\", \"P\", \"L\", \"R\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else if (labelSelector == \"rsp\")\n  {\n    // xyzLabels = std::array<std::string, 3>{\"R\", \"S\", \"P\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"R\", \"L\", \"S\", \"I\", \"P\", \"A\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else if (labelSelector == \"lsa\")\n  {\n    // xyzLabels = std::array<std::string, 3>{\"L\", \"S\", \"A\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"L\", \"R\", \"S\", \"I\", \"A\", \"P\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else\n  {\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"+X\", \"-X\", \"+Y\", \"-Y\", \"+Z\", \"-Z\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n\n  // We are combining a vtkAxesActor and a vtkAnnotatedCubeActor\n  // into a vtkPropAssembly\n  auto cube = MakeAnnotatedCubeActor(cubeLabels, colors);\n  auto axes = MakeAxesActor(scale, xyzLabels);\n\n  // Combine orientation markers into one with an assembly.\n  vtkNew<vtkPropAssembly> assembly;\n  assembly->AddPart(axes);\n  assembly->AddPart(cube);\n  return assembly;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/FroggieSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FroggieSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonMath\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  IOImage\n  ImagingCore\n  ImagingGeneral\n  ImagingMorphological\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FroggieSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FroggieSurface MACOSX_BUNDLE FroggieSurface.cxx )\n  target_link_libraries(FroggieSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FroggieSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/FroggieSurface/#download-and-build-froggiesurface","title":"Download and Build FroggieSurface","text":"

        Click here to download FroggieSurface and its CMakeLists.txt file. Once the tarball FroggieSurface.tar has been downloaded and extracted,

        cd FroggieSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FroggieSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/FroggieView/","title":"FroggieView","text":"

        vtk-examples/Cxx/Visualization/FroggieView

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/FroggieView/#description","title":"Description","text":"

        View surfaces of a segmented frog dataset using preprocessed *.vtk tissue files. This means that loading and processing is much faster when comapred with FroggieSurface.

        FroggieView provides the ability to turn on and off surfaces, control their opacity through the use of sliders and control the camera position.

        By default the frog is oriented so that we look down on the dorsal (posterior) surface and the superior surface faces the top of the screen. The frog is rendered with the skin being translucent so that you can see the internal organs.

        In the lower left of the image there is a prop assembly with labelled XYZ axes and a cube labelled with anatomical orientations:

        • Sagittal plane
        • L - left
        • R - right
        • Coronal plane
        • A - anterior
        • P - posterior
        • Transverse plane
        • S - superior
        • I - inferior

        This prop assembly can be moved and resized.

        The opacity of each tissue is controlled by a slider, additionally you can turn all the sliders on or off by pressing the \"n\" key.

        If the option \"-n\" is selected, no sliders will displayed.

        Individual tissues can be specified by using the \"-t\" option e.g. \"-t skin skeleton\".

        The parameters used to generate the example image are loaded from a JSON file containing the data needed to access and generate the actors for each tissue along with other supplementary data such as the data file names. This means that the user need only load this one file in order to generate the data for rendering. This file is called:

        <DATA>/Frog_vtk.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see Frog_vtk_format.

        The code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder.

        The dataset was prepared at the Lawrence Berkeley National Laboratories. It is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels.

        Further information:

        • VTK Examples - FroggieSurface and FroggieView

        Info

        Mutually exclusive options \"-a -b -c -d\" are provided to let you generate approximations to the following figures: Figure 12-9a, Figure 12-9b, Figure 12-9c, and Figure 12-9d in Chapter 12 of the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/FroggieView/#code","title":"Code","text":"

        FroggieView.cxx

        #include <vtkActor.h>\n#include <vtkAnnotatedCubeActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCameraOrientationWidget.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProp3D.h>\n#include <vtkPropAssembly.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <vtk_cli11.h>\n#include <vtk_jsoncpp.h>\n\n#include <array>\n#include <cstdlib>\n#include <filesystem>\n#include <fstream>\n#include <iomanip>\n#include <iostream>\n#include <sstream>\n#include <string>\n\nnamespace fs = std::filesystem;\n\nnamespace {\nstruct Parameters\n{\n  std::vector<std::string> names;\n  std::map<std::string, std::string> colors;\n  std::map<std::string, int> indices;\n  std::map<std::string, std::string> orientation;\n  std::map<std::string, double> opacity;\n  std::map<std::string, std::string> vtkFiles;\n  std::vector<std::string> fig_129b;\n  std::vector<std::string> fig_129cd;\n\n  bool parsedOk{false};\n};\n\n/**\n * Take a string and convert it to lowercase.\n *\n * See: https://en.cppreference.com/w/cpp/string/byte/tolower\n * Only works with ASCII characters.\n *\n * @param s: The string to be converted to lowercase.\n *\n * @return The lowercase version of the string.\n */\nstd::string ToLowerCase(std::string s);\n\n/**\n * Read the parameters from a json file and check that the file paths exist.\n *\n * @param fnPath: The path to the json file.\n * @param parameters:  The parameters.\n */\nvoid ParseJSON(const fs::path fnPath, Parameters& parameters);\n\n/**\n * Create the lookup table for the frog tissues.\n *\n * Each table value corresponds the color of one of the frog tissues.\n *\n * @param indices: The tissue name and index.\n * @param colors: The tissue name and color.\n * @return: The lookup table.\n */\nvtkNew<vtkLookupTable>\nCreateTissueLUT(std::map<std::string, int> const& indices,\n                std::map<std::string, std::string>& colors);\n\nclass SliceOrder\n{\n  // clang-format off\n  /*\n    These transformations permute image and other geometric data to maintain\n      proper orientation regardless of the acquisition order. After applying\n      these transforms with vtkTransformFilter, a view up of 0, -1, 0 will\n      result in the body part facing the viewer.\n\n    NOTE: Some transformations have a -1 scale factor for one of the components.\n          To ensure proper polygon orientation and normal direction,\n            you must apply the vtkPolyDataNormals filter.\n\n    Naming (the nomenclature is medical):\n      si - superior to inferior (top to bottom)\n      is - inferior to superior (bottom to top)\n      ap - anterior to posterior (front to back)\n      pa - posterior to anterior (back to front)\n      lr - left to right\n      rl - right to left\n\n    */\n  // clang-format on\n\npublic:\n  /**\n   * Generate the transforms corresponding to the slice order.\n   */\n  SliceOrder();\n\n  virtual ~SliceOrder() = default;\n\npublic:\n  /**\n   * Returns the vtkTransform corresponding to the slice order.\n   *\n   * @param sliceOrder: The slice order.\n   * @return The vtkTransform corresponding to the slice order.\n   */\n  vtkSmartPointer<vtkTransform> Get(std::string const& sliceOrder);\n\n  /**\n   * Print the homogenous matrix corresponding to the slice order.\n   *\n   * @param order: The slice order.\n   */\n  void PrintTransform(std::string const& order);\n\n  /**\n   * Print all the homogenous matrices corresponding to the slice orders.\n   *\n   */\n  void PrintAlltransforms();\n\nprivate:\n  std::map<std::string, vtkSmartPointer<vtkTransform>> transform;\n};\n\n/**\n * @param scale: Sets the scale and direction of the axes.\n * @param xyzLabels: Labels for the axes.\n * @return The axes actor.\n */\nvtkNew<vtkAxesActor> MakeAxesActor(std::array<double, 3>& scale,\n                                   std::array<std::string, 3> const& xyzLabels);\n\n/**\n * @param cubeLabels: The labels for the cube faces.\n * @param colors: Used to set the colors of the cube faces.\n * @return The annotated cube actor.\n */\nvtkNew<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(std::array<std::string, 6> const& cubeLabels,\n                       vtkNamedColors* colors);\n\n/**\n * @param labelSelector: The selector used to define labels for the axes and\n * cube.\n * @param colors: Used to set the colors of the cube faces.\n * @return The combined axes and annotated cube prop.\n */\nvtkNew<vtkPropAssembly> MakeCubeActor(std::string const& labelSelector,\n                                      vtkNamedColors* colors);\n\nclass SliderCallbackOpacity : public vtkCallbackCommand\n{\npublic:\n  static SliderCallbackOpacity* New()\n  {\n    return new SliderCallbackOpacity;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    this->property->SetOpacity(value);\n  }\n  SliderCallbackOpacity() : property(nullptr)\n  {\n  }\n  vtkProperty* property;\n};\nstruct SliderProperties\n{\n  double tubeWidth{0.004};\n  double sliderLength{0.015};\n  double sliderWidth{0.008};\n  double endCapLength{0.008};\n  double endCapWidth{0.02};\n  double titleHeight{0.02};\n  double labelHeight{0.02};\n\n  double valueMinimum{0.0};\n  double valueMaximum{1.0};\n  double valueInitial{1.0};\n\n  std::array<double, 2> p1{0.02, 0.1};\n  std::array<double, 2> p2{0.18, 0.1};\n\n  std::string title;\n\n  std::string titleColor{\"Black\"};\n  std::string labelColor{\"Black\"};\n  std::string valueColor{\"DarkSlateGray\"};\n  std::string sliderColor{\"BurlyWood\"};\n  std::string selectedColor{\"Lime\"};\n  std::string barColor{\"Black\"};\n  std::string barEndsColor{\"Indigo\"};\n};\n\n/**\n * @param properties: The slider properties.\n * @param lut: The color lookup table.\n * @param idx: The tissue index.\n * @return The slider widget.\n */\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& sp,\n                                         vtkLookupTable* lut, int const& idx);\n\nclass SliderToggleCallback : public vtkCallbackCommand\n{\npublic:\n  SliderToggleCallback() = default;\n\n  static SliderToggleCallback* New()\n  {\n    return new SliderToggleCallback;\n  }\n\n  /*\n   * Create a vtkCallbackCommand and reimplement it.\n   *\n   */\n  void Execute(vtkObject* caller, unsigned long /*evId*/, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    auto rwi = reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n\n    // Get the keypress\n    std::string key = rwi->GetKeySym();\n    if (key == \"n\")\n    {\n      for (auto const& p : *this->sliders)\n      {\n        if (p.second->GetEnabled())\n        {\n          p.second->Off();\n        }\n        else\n        {\n          p.second->On();\n        }\n      }\n    }\n  }\n\n  /**\n   * For handling the sliders.\n   *\n   * @param sliders The sliders.\n   *\n   */\n  void SetParameters(\n      std::map<std::string, vtkSmartPointer<vtkSliderWidget>>* sliders)\n  {\n    this->sliders = sliders;\n  }\n\nprivate:\n  SliderToggleCallback(const SliderToggleCallback&) = delete;\n  void operator=(const SliderToggleCallback&) = delete;\n\n  std::map<std::string, vtkSmartPointer<vtkSliderWidget>>* sliders{nullptr};\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  CLI::App app{\"View surfaces of a segmented frog dataset using preprocessed \"\n               \"VTK tissue files.\"};\n\n  // Define options\n  std::string fileName;\n  app.add_option(\"fileName\", fileName,\n                 \"The path to the JSON file e.g. Frog_vtk.json.\")\n      ->required()\n      ->check(CLI::ExistingFile);\n\n  std::vector<std::string> chosenTissues;\n  app.add_option(\"-t\", chosenTissues, \"Select one or more tissues.\");\n  auto noSliders = false;\n  app.add_flag(\"-n\", noSliders, \"No sliders\");\n\n  std::array<bool, 6> view{false, false, false, false};\n  auto* ogroup = app.add_option_group(\n      \"view\",\n      \"Select a view corresponding to Fig 12-9 in the VTK Textbook. Only one \"\n      \"or none of these can be selected.\");\n  ogroup->add_flag(\"-a\", view[0],\n                   \"The view corresponds to Fig 12-9a in the VTK Textbook\");\n  ogroup->add_flag(\"-b\", view[1],\n                   \"The view corresponds to Fig 12-9b in the VTK Textbook\");\n  ogroup->add_flag(\"-c\", view[2],\n                   \"The view corresponds to Fig 12-9c in the VTK Textbook\");\n  ogroup->add_flag(\"-d\", view[3],\n                   \"The view corresponds to Fig 12-9d in the VTK Textbook\");\n  ogroup->add_flag(\n      \"-l\", view[4],\n      \"The view corresponds to looking down on the anterior surface\");\n  ogroup->add_flag(\"-p\", view[5],\n                   \"The view corresponds to looking down on the posterior \"\n                   \"surface (the default)\");\n\n  CLI11_PARSE(app, argc, argv);\n\n  auto selectCount = std::count_if(view.begin(), view.end(),\n                                   [=](const bool& e) { return e == true; });\n  if (selectCount > 1)\n  {\n    std::cerr << \"Only one or none of the options -a, -b, -c, -d, -l, -p can \"\n                 \"be selected;\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto fnPath = fs::path(fileName);\n  if (!fnPath.has_extension())\n  {\n    fnPath.replace_extension(\".json\");\n  }\n  if (!fs::is_regular_file(fnPath))\n  {\n    std::cerr << \"Unable to find: \" << fnPath << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  Parameters parameters;\n  ParseJSON(fnPath, parameters);\n  if (!parameters.parsedOk)\n  {\n    return EXIT_FAILURE;\n  }\n\n  auto tissues = parameters.names;\n  auto indices = parameters.indices;\n\n  auto lut = CreateTissueLUT(parameters.indices, parameters.colors);\n\n  char selectFigure{'\\0'};\n  if (selectCount == 1)\n  {\n    if (view[0])\n    {\n      selectFigure = 'a';\n    }\n    else if (view[1])\n    {\n      // No skin.\n      tissues = parameters.fig_129b;\n      selectFigure = 'b';\n    }\n    else if (view[2])\n    {\n      // No skin, blood and skeleton.\n      tissues = parameters.fig_129cd;\n      selectFigure = 'c';\n    }\n    else if (view[3])\n    {\n      // No skin, blood and skeleton.\n      tissues = parameters.fig_129cd;\n      selectFigure = 'd';\n    }\n    else if (view[4])\n    {\n      // Looking down on the anterior surface.\n      selectFigure = 'l';\n    }\n    else // The default\n    {\n      // Looking down on the posterior surface.\n      selectFigure = 'p';\n    }\n  }\n\n  if (!chosenTissues.empty())\n  {\n    for (auto i = 0; i < chosenTissues.size(); ++i)\n    {\n      chosenTissues[i] = ToLowerCase(chosenTissues[i]);\n    }\n    std::vector<std::string> res;\n    auto has_brainbin{false};\n    if (std::find(chosenTissues.begin(), chosenTissues.end(), \"brainbin\") !=\n        chosenTissues.end())\n    {\n      std::cout << \"Using brainbin instead of brain.\" << std::endl;\n      res.push_back(\"brainbin\");\n      indices.erase(\"brain\");\n      indices[\"brainbin\"] = 2;\n      parameters.colors.erase(\"brain\");\n      parameters.colors[\"brainbin\"] = \"beige\";\n      has_brainbin = true;\n    }\n    for (auto const& ct : chosenTissues)\n    {\n      if (has_brainbin && (ct == \"brain\" || ct == \"brainbin\"))\n      {\n        continue;\n      }\n      if (std::find(tissues.begin(), tissues.end(), ct) != tissues.end())\n      {\n        res.push_back(ct);\n      }\n      else\n      {\n        std::cout << \"Tissue: \" << ct << \" is not available.\" << std::endl;\n        return EXIT_FAILURE;\n      }\n    }\n    if (res.size() == 1 && res[0] == \"skin\")\n    {\n      parameters.opacity[\"skin\"] = 1.0;\n    }\n    tissues = res;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  colors->SetColor(\"ParaViewBkg\",\n                   std::array<unsigned char, 4>{82, 87, 110, 255}.data());\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iRen->SetInteractorStyle(style);\n\n  SliceOrder so;\n  // so.PrintAlltransforms();\n\n  size_t colorSize{0};\n  for (auto const& p : parameters.colors)\n  {\n    colorSize = std::max(colorSize, p.second.size());\n  }\n  size_t nameSize{0};\n  for (auto const& p : parameters.names)\n  {\n    nameSize = std::max(nameSize, p.size());\n  }\n\n  std::map<std::string, vtkSmartPointer<vtkSliderWidget>> sliders;\n  auto leftStepSize = 1.0 / 9;\n  auto leftPosY = 0.275;\n  auto leftPosX0 = 0.02;\n  auto leftPosX1 = 0.18;\n  auto rightStepSize = 1.0 / 9;\n  auto rightPosY = 0.05;\n  auto rightPosX0 = 0.8 + 0.02;\n  auto rightPosX1 = 0.8 + 0.18;\n\n  auto sliderCount = 0;\n\n  std::string line(7 + nameSize + colorSize, '-');\n\n  std::cout << line << '\\n'\n            << std::setw(nameSize) << std::left << \"Tissue\"\n            << \" Label \"\n            << \"Color\" << '\\n'\n            << line << std::endl;\n  auto intSize = 2;\n\n  for (auto const& tissue : tissues)\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(parameters.vtkFiles[tissue].c_str());\n    reader->Update();\n\n    auto trans = so.Get(parameters.orientation[tissue]);\n    trans->Scale(1, -1, -1);\n\n    vtkNew<vtkTransformPolyDataFilter> tf;\n    tf->SetInputConnection(reader->GetOutputPort());\n    tf->SetTransform(trans);\n    tf->SetInputConnection(reader->GetOutputPort());\n\n    vtkNew<vtkPolyDataNormals> normals;\n    normals->SetInputConnection(tf->GetOutputPort());\n    normals->SetFeatureAngle(60.0);\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(normals->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetOpacity(parameters.opacity[tissue]);\n    actor->GetProperty()->SetDiffuseColor(lut->GetTableValue(indices[tissue]));\n    actor->GetProperty()->SetSpecular(0.2);\n    actor->GetProperty()->SetSpecularPower(10);\n\n    ren->AddActor(actor);\n\n    if (!noSliders)\n    {\n      auto sp = SliderProperties();\n\n      sp.valueInitial = parameters.opacity[tissue];\n      sp.title = tissue;\n\n      // Screen coordinates.\n      if (sliderCount < 7)\n      {\n        sp.p1[0] = leftPosX0;\n        sp.p1[1] = leftPosY;\n        sp.p2[0] = leftPosX1;\n        sp.p2[1] = leftPosY;\n        leftPosY += leftStepSize;\n      }\n      else\n      {\n        sp.p1[0] = rightPosX0;\n        sp.p1[1] = rightPosY;\n        sp.p2[0] = rightPosX1;\n        sp.p2[1] = rightPosY;\n        rightPosY += rightStepSize;\n      }\n\n      auto sliderWidget = MakeSliderWidget(sp, lut, parameters.indices[tissue]);\n\n      sliderWidget->SetInteractor(iRen);\n      sliderWidget->SetAnimationModeToAnimate();\n      sliderWidget->EnabledOn();\n\n      vtkNew<SliderCallbackOpacity> cb;\n      cb->property = actor->GetProperty();\n      sliderWidget->AddObserver(vtkCommand::InteractionEvent, cb);\n      sliders[tissue] = sliderWidget;\n      sliderCount += 1;\n    }\n    std::cout << std::setw(nameSize) << std::left << tissue << \" \"\n              << std::setw(intSize + 3) << std::right << indices[tissue] << \" \"\n              << std::setw(colorSize) << std::left << parameters.colors[tissue]\n              << std::endl;\n  }\n  std::cout << line << std::endl;\n\n  if (noSliders)\n  {\n    renWin->SetSize(1024, 1024);\n  }\n  else\n  {\n    renWin->SetSize(1024 + 400, 1024);\n  }\n  renWin->SetWindowName(\"FroggieView\");\n\n  ren->SetBackground(colors->GetColor3d(\"ParaViewBkg\").GetData());\n\n  auto camera = ren->GetActiveCamera();\n  // Superior Anterior Left\n  auto labels{\"sal\"};\n  if (selectFigure == 'a')\n  {\n    // Fig 12-9a in the VTK Textbook\n    camera->SetPosition(495.722368, -447.474954, -646.308030);\n    camera->SetFocalPoint(137.612066, -40.962376, -195.171023);\n    camera->SetViewUp(-0.323882, -0.816232, 0.478398);\n    camera->SetDistance(704.996499);\n    camera->SetClippingRange(319.797039, 1809.449285);\n  }\n  else if (selectFigure == 'b')\n  {\n    // Fig 12-9b in the VTK Textbook\n    camera->SetPosition(478.683494, -420.477744, -643.112038);\n    camera->SetFocalPoint(135.624874, -36.478435, -210.614440);\n    camera->SetViewUp(-0.320495, -0.820148, 0.473962);\n    camera->SetDistance(672.457328);\n    camera->SetClippingRange(307.326771, 1765.990822);\n  }\n  else if (selectFigure == 'c')\n  {\n    // Fig 12-9c in the VTK Textbook\n    camera->SetPosition(201.363313, -147.260834, -229.885066);\n    camera->SetFocalPoint(140.626206, -75.857216, -162.352531);\n    camera->SetViewUp(-0.425438, -0.786048, 0.448477);\n    camera->SetDistance(115.534047);\n    camera->SetClippingRange(7.109870, 854.091718);\n  }\n  else if (selectFigure == 'd')\n  {\n    // Fig 12-9d in the VTK Textbook\n    camera->SetPosition(115.361727, -484.656410, -6.193827);\n    camera->SetFocalPoint(49.126343, 98.501094, 1.323317);\n    camera->SetViewUp(-0.649127, -0.083475, 0.756086);\n    camera->SetDistance(586.955116);\n    camera->SetClippingRange(360.549218, 866.876230);\n  }\n  else if (selectFigure == 'l')\n  {\n    // Orient so that we look down on the anterior surface and\n    //  the superior surface faces the top of the screen.\n    // Left Superior Anterior\n    labels = \"lsa\";\n    vtkNew<vtkTransform> transform;\n    transform->SetMatrix(camera->GetModelTransformMatrix());\n    transform->RotateY(90);\n    transform->RotateZ(90);\n    camera->SetModelTransformMatrix(transform->GetMatrix());\n    ren->ResetCamera();\n  }\n  else\n  {\n    // Orient so that we look down on the posterior surface and\n    //  the superior surface faces the top of the screen.\n    // Right Superior Posterior\n    labels = \"rsp\";\n    vtkNew<vtkTransform> transform;\n    transform->SetMatrix(camera->GetModelTransformMatrix());\n    transform->RotateY(-90);\n    transform->RotateZ(90);\n    camera->SetModelTransformMatrix(transform->GetMatrix());\n    ren->ResetCamera();\n  }\n\n  vtkNew<vtkCameraOrientationWidget> cow;\n  cow->SetParentRenderer(ren);\n  if (noSliders)\n  {\n    // Turn off if you do not want it.\n    cow->On();\n    cow->EnabledOn();\n  }\n  else\n  {\n    cow->Off();\n    cow->EnabledOff();\n  }\n\n  auto axes = MakeCubeActor(labels, colors);\n  vtkNew<vtkOrientationMarkerWidget> om;\n  om->SetOrientationMarker(axes);\n  // Position upper left in the viewport.\n  // om->SetViewport(0.0, 0.8, 0.2, 1.0);\n  // Position lower left in the viewport.\n  om->SetViewport(0, 0, 0.2, 0.2);\n  om->SetInteractor(iRen);\n  om->EnabledOn();\n  om->InteractiveOn();\n\n  renWin->Render();\n\n  vtkNew<SliderToggleCallback> sliderToggle;\n  sliderToggle->SetParameters(&sliders);\n  iRen->AddObserver(vtkCommand::KeyPressEvent, sliderToggle);\n\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::string ToLowerCase(std::string s)\n{\n  std::transform(s.begin(), s.end(), s.begin(),\n                 [](unsigned char c) { return std::tolower(c); } // correct\n  );\n  return s;\n}\n\nvoid ParseJSON(const fs::path fnPath, Parameters& parameters)\n{\n  std::ifstream ifs(fnPath);\n  Json::Value root;\n\n  if (ifs)\n  {\n    std::string str;\n    std::string errors;\n    Json::CharReaderBuilder builder{};\n    auto reader = std::unique_ptr<Json::CharReader>(builder.newCharReader());\n\n    std::ostringstream ss;\n    ss << ifs.rdbuf(); // Read in the file comtents\n    str = ss.str();\n    auto parsingSuccessful =\n        reader->parse(str.c_str(), str.c_str() + str.size(), &root, &errors);\n    ifs.close();\n    if (!parsingSuccessful)\n    {\n      std::cout << errors << std::endl;\n      parameters.parsedOk = false;\n      return;\n    }\n    parameters.parsedOk = true;\n  }\n  else\n  {\n    std::cerr << \"Unable to open: \" << fnPath << std::endl;\n    parameters.parsedOk = false;\n  }\n\n  // Get the parameters that we need.\n  fs::path vtkPath;\n  std::vector<std::string> fileNames;\n  for (Json::Value::const_iterator outer = root.begin(); outer != root.end();\n       ++outer)\n  {\n    if (outer.name() == \"files\")\n    {\n      std::string path;\n      for (Json::Value::const_iterator pth = root[\"files\"].begin();\n           pth != root[\"files\"].end(); ++pth)\n      {\n        if (pth.name() == \"root\")\n        {\n          vtkPath = fs::path(pth->asString());\n        }\n        if (pth.name() == \"vtk_files\")\n        {\n          for (Json::Value::const_iterator fls =\n                   root[\"files\"][\"vtk_files\"].begin();\n               fls != root[\"files\"][\"vtk_files\"].end(); ++fls)\n          {\n            fileNames.push_back(fls->asString());\n          }\n        }\n      }\n    }\n    if (outer.name() == \"tissues\")\n    {\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"names\"].begin();\n           tc != root[\"tissues\"][\"names\"].end(); ++tc)\n      {\n        parameters.names.push_back(tc->asString());\n      }\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"indices\"].begin();\n           tc != root[\"tissues\"][\"indices\"].end(); ++tc)\n      {\n        parameters.indices[tc.name()] = tc->asInt();\n      }\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"colors\"].begin();\n           tc != root[\"tissues\"][\"colors\"].end(); ++tc)\n      {\n        parameters.colors[tc.name()] = tc->asString();\n      }\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"indices\"].begin();\n           tc != root[\"tissues\"][\"indices\"].end(); ++tc)\n      {\n        parameters.indices[tc.name()] = tc->asInt();\n      }\n      for (Json::Value::const_iterator tc =\n               root[\"tissues\"][\"orientation\"].begin();\n           tc != root[\"tissues\"][\"orientation\"].end(); ++tc)\n      {\n        parameters.orientation[tc.name()] = tc->asString();\n      }\n      for (Json::Value::const_iterator tc = root[\"tissues\"][\"opacity\"].begin();\n           tc != root[\"tissues\"][\"opacity\"].end(); ++tc)\n      {\n        parameters.opacity[tc.name()] = tc->asDouble();\n      }\n    }\n    if (outer.name() == \"figures\")\n    {\n      for (Json::Value::const_iterator c = root[\"figures\"][\"fig12-9b\"].begin();\n           c != root[\"figures\"][\"fig12-9b\"].end(); ++c)\n      {\n        parameters.fig_129b.push_back(c->asString());\n      }\n      for (Json::Value::const_iterator c = root[\"figures\"][\"fig12-9cd\"].begin();\n           c != root[\"figures\"][\"fig12-9cd\"].end(); ++c)\n      {\n        parameters.fig_129cd.push_back(c->asString());\n      }\n    }\n  }\n\n  //  Build and check the paths.\n  if (!fileNames.empty())\n  {\n    if (fileNames.size() != 17)\n    {\n      std::cerr << \"Expected seventeen file names.\";\n      parameters.parsedOk = false;\n    }\n    else\n    {\n      for (size_t i = 0; i < fileNames.size(); i++)\n      {\n        auto pth = fnPath.parent_path() / vtkPath / fs::path(fileNames[i]);\n        fileNames[i] = pth.make_preferred().string();\n        if (!(fs::is_regular_file(pth) && fs::exists(pth)))\n        {\n          std::cerr << \"Not a file or path does not exist: \" << fileNames[i]\n                    << std::endl;\n          parameters.parsedOk = false;\n        }\n        else\n        {\n          parameters.vtkFiles[pth.stem().string()] =\n              pth.make_preferred().string();\n        }\n      }\n    }\n  }\n  else\n  {\n    std::cerr << \"Expected .vtk file names in the JSON file.\";\n    parameters.parsedOk = false;\n  }\n}\n\nvtkNew<vtkLookupTable>\nCreateTissueLUT(std::map<std::string, int> const& indices,\n                std::map<std::string, std::string>& colors)\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfColors(colors.size());\n  lut->SetTableRange(0, colors.size() - 1);\n  lut->Build();\n\n  vtkNew<vtkNamedColors> nc;\n\n  for (auto const& p : indices)\n  {\n    lut->SetTableValue(p.second, nc->GetColor4d(colors[p.first]).GetData());\n  }\n\n  return lut;\n}\n\nSliceOrder::SliceOrder()\n{\n  vtkNew<vtkMatrix4x4> si_mat;\n  si_mat->Zero();\n  si_mat->SetElement(0, 0, 1);\n  si_mat->SetElement(1, 2, 1);\n  si_mat->SetElement(2, 1, -1);\n  si_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> is_mat;\n  is_mat->Zero();\n  is_mat->SetElement(0, 0, 1);\n  is_mat->SetElement(1, 2, -1);\n  is_mat->SetElement(2, 1, -1);\n  is_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> lr_mat;\n  lr_mat->Zero();\n  lr_mat->SetElement(0, 2, -1);\n  lr_mat->SetElement(1, 1, -1);\n  lr_mat->SetElement(2, 0, 1);\n  lr_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkMatrix4x4> rl_mat;\n  rl_mat->Zero();\n  rl_mat->SetElement(0, 2, 1);\n  rl_mat->SetElement(1, 1, -1);\n  rl_mat->SetElement(2, 0, 1);\n  rl_mat->SetElement(3, 3, 1);\n\n  // The previous transforms assume radiological views of the slices\n  //  (viewed from the feet).\n  // Other modalities such as physical sectioning may view from the head.\n  // The following transforms modify the original with a 180\u00b0 rotation about y\n\n  vtkNew<vtkMatrix4x4> hf_mat;\n  hf_mat->Zero();\n  hf_mat->SetElement(0, 0, -1);\n  hf_mat->SetElement(1, 1, 1);\n  hf_mat->SetElement(2, 2, -1);\n  hf_mat->SetElement(3, 3, 1);\n\n  vtkNew<vtkTransform> si_trans;\n  si_trans->SetMatrix(si_mat);\n  this->transform[\"si\"] = si_trans;\n\n  vtkNew<vtkTransform> is_trans;\n  is_trans->SetMatrix(is_mat);\n  this->transform[\"is\"] = is_trans;\n\n  vtkNew<vtkTransform> ap_trans;\n  ap_trans->Scale(1, -1, 1);\n  this->transform[\"ap\"] = ap_trans;\n\n  vtkNew<vtkTransform> pa_trans;\n  pa_trans->Scale(1, -1, -1);\n  this->transform[\"pa\"] = pa_trans;\n\n  vtkNew<vtkTransform> lr_trans;\n  lr_trans->SetMatrix(lr_mat);\n  this->transform[\"lr\"] = lr_trans;\n\n  vtkNew<vtkTransform> rl_trans;\n  lr_trans->SetMatrix(rl_mat);\n  this->transform[\"rl\"] = rl_trans;\n\n  vtkNew<vtkTransform> hf_trans;\n  hf_trans->SetMatrix(hf_mat);\n  this->transform[\"hf\"] = hf_trans;\n\n  vtkNew<vtkTransform> hf_si_trans;\n  hf_si_trans->SetMatrix(hf_mat);\n  hf_si_trans->Concatenate(si_mat);\n  this->transform[\"hfsi\"] = hf_si_trans;\n\n  vtkNew<vtkTransform> hf_is_trans;\n  hf_is_trans->SetMatrix(hf_mat);\n  hf_is_trans->Concatenate(is_mat);\n  this->transform[\"hfis\"] = hf_is_trans;\n\n  vtkNew<vtkTransform> hf_ap_trans;\n  hf_ap_trans->SetMatrix(hf_mat);\n  hf_ap_trans->Scale(1, -1, 1);\n  this->transform[\"hfap\"] = hf_ap_trans;\n\n  vtkNew<vtkTransform> hf_pa_trans;\n  hf_pa_trans->SetMatrix(hf_mat);\n  hf_pa_trans->Scale(1, -1, -1);\n  this->transform[\"hfpa\"] = hf_pa_trans;\n\n  vtkNew<vtkTransform> hf_lr_trans;\n  hf_lr_trans->SetMatrix(hf_mat);\n  hf_lr_trans->Concatenate(lr_mat);\n  this->transform[\"hflr\"] = hf_lr_trans;\n\n  vtkNew<vtkTransform> hf_rl_trans;\n  hf_rl_trans->SetMatrix(hf_mat);\n  hf_rl_trans->Concatenate(rl_mat);\n  this->transform[\"hfrl\"] = hf_rl_trans;\n\n  // Identity\n  this->transform[\"I\"] = vtkNew<vtkTransform>();\n\n  // Zero\n  vtkNew<vtkTransform> z_trans;\n  z_trans->Scale(0, 0, 0);\n  this->transform[\"Z\"] = z_trans;\n}\n\nvoid SliceOrder::PrintTransform(std::string const& order)\n{\n  auto m = this->transform[order]->GetMatrix();\n  std::ostringstream os;\n  os.setf(std::ios_base::fmtflags(), std::ios_base::floatfield);\n  os << order << '\\n';\n  for (int i = 0; i < 4; ++i)\n  {\n    for (int j = 0; j < 4; ++j)\n    {\n      if (j < 3)\n      {\n        os << std::setw(6) << std::right << std::setprecision(2)\n           << m->GetElement(i, j) << \" \";\n      }\n      else\n      {\n        os << std::setw(6) << std::right << m->GetElement(i, j) << '\\n';\n      }\n    }\n  }\n  std::cout << os.str() << '\\n';\n  os.str(\"\");\n}\n\nvoid SliceOrder::PrintAlltransforms()\n{\n  for (auto const& p : this->transform)\n  {\n    PrintTransform(p.first);\n  }\n}\n\nvtkSmartPointer<vtkTransform> SliceOrder::Get(std::string const& sliceOrder)\n{\n  return this->transform[sliceOrder];\n}\n\nvtkNew<vtkAxesActor> MakeAxesActor(std::array<double, 3>& scale,\n                                   std::array<std::string, 3> const& xyzLabels)\n{\n  vtkNew<vtkAxesActor> axes;\n  axes->SetScale(scale.data());\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(xyzLabels[0].c_str());\n  axes->SetYAxisLabelText(xyzLabels[1].c_str());\n  axes->SetZAxisLabelText(xyzLabels[2].c_str());\n  axes->SetCylinderRadius(0.5 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.025 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.5 * axes->GetSphereRadius());\n  auto tprop = axes->GetXAxisCaptionActor2D()->GetCaptionTextProperty();\n  tprop->ItalicOn();\n  tprop->ShadowOn();\n  tprop->SetFontFamilyToTimes();\n  // Use the same text properties on the other two axes.\n  axes->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  axes->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  return axes;\n}\n\nvtkNew<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(std::array<std::string, 6> const& cubeLabels,\n                       vtkNamedColors* colors)\n{\n  // A cube with labeled faces.\n  vtkNew<vtkAnnotatedCubeActor> cube;\n  cube->SetXPlusFaceText(cubeLabels[0].c_str());\n  cube->SetXMinusFaceText(cubeLabels[1].c_str());\n  cube->SetYPlusFaceText(cubeLabels[2].c_str());\n  cube->SetYMinusFaceText(cubeLabels[3].c_str());\n  cube->SetZPlusFaceText(cubeLabels[4].c_str());\n  cube->SetZMinusFaceText(cubeLabels[5].c_str());\n  cube->SetFaceTextScale(0.5);\n  cube->GetCubeProperty()->SetColor(colors->GetColor3d(\"Gainsboro\").GetData());\n\n  cube->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Change the vector text colors.\n  cube->GetXPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetXMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetYPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetYMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetZPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  cube->GetZMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  return cube;\n}\n\nvtkNew<vtkPropAssembly> MakeCubeActor(std::string const& labelSelector,\n                                      vtkNamedColors* colors)\n{\n  std::array<std::string, 3> xyzLabels;\n  std::array<std::string, 6> cubeLabels;\n  std::array<double, 3> scale;\n  if (labelSelector == \"sal\")\n  {\n    // xyzLabels = std::array<std::string,3>{\"S\", \"A\", \"L\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"S\", \"I\", \"A\", \"P\", \"L\", \"R\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else if (labelSelector == \"rsp\")\n  {\n    // xyzLabels = std::array<std::string, 3>{\"R\", \"S\", \"P\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"R\", \"L\", \"S\", \"I\", \"P\", \"A\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else if (labelSelector == \"lsa\")\n  {\n    // xyzLabels = std::array<std::string, 3>{\"L\", \"S\", \"A\"};\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"L\", \"R\", \"S\", \"I\", \"A\", \"P\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n  else\n  {\n    xyzLabels = std::array<std::string, 3>{\"+X\", \"+Y\", \"+Z\"};\n    cubeLabels = std::array<std::string, 6>{\"+X\", \"-X\", \"+Y\", \"-Y\", \"+Z\", \"-Z\"};\n    scale = std::array<double, 3>{1.5, 1.5, 1.5};\n  }\n\n  // We are combining a vtkAxesActor and a vtkAnnotatedCubeActor\n  // into a vtkPropAssembly\n  auto cube = MakeAnnotatedCubeActor(cubeLabels, colors);\n  auto axes = MakeAxesActor(scale, xyzLabels);\n\n  // Combine orientation markers into one with an assembly.\n  vtkNew<vtkPropAssembly> assembly;\n  assembly->AddPart(axes);\n  assembly->AddPart(cube);\n  return assembly;\n}\n\nvtkNew<vtkSliderWidget> MakeSliderWidget(SliderProperties const& sp,\n                                         vtkLookupTable* lut, int const& idx)\n{\n  vtkNew<vtkSliderRepresentation2D> slider;\n\n  slider->SetMinimumValue(sp.valueMinimum);\n  slider->SetMaximumValue(sp.valueMaximum);\n  slider->SetValue(sp.valueInitial);\n  slider->SetTitleText(sp.title.c_str());\n\n  slider->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint1Coordinate()->SetValue(sp.p1[0], sp.p1[1]);\n  slider->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  slider->GetPoint2Coordinate()->SetValue(sp.p2[0], sp.p2[1]);\n\n  slider->SetTubeWidth(sp.tubeWidth);\n  slider->SetSliderLength(sp.sliderLength);\n  slider->SetSliderWidth(sp.sliderWidth);\n  slider->SetEndCapLength(sp.endCapLength);\n  slider->SetEndCapWidth(sp.endCapWidth);\n  slider->SetTitleHeight(sp.titleHeight);\n  slider->SetLabelHeight(sp.labelHeight);\n\n  vtkNew<vtkNamedColors> colors;\n  // Set the colors of the slider components.\n  // Change the color of the bar.\n  slider->GetTubeProperty()->SetColor(\n      colors->GetColor3d(sp.barColor).GetData());\n  // Change the color of the ends of the bar.\n  slider->GetCapProperty()->SetColor(\n      colors->GetColor3d(sp.barEndsColor).GetData());\n  // Change the color of the knob that slides.\n  slider->GetSliderProperty()->SetColor(\n      colors->GetColor3d(sp.sliderColor).GetData());\n  // Change the color of the knob when the mouse is held on it.\n  slider->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(sp.selectedColor).GetData());\n  // Change the color of the text displaying the value.\n  slider->GetLabelProperty()->SetColor(\n      colors->GetColor3d(sp.valueColor).GetData());\n  //  Use the one color for the labels.\n  // slider->GetTitleProperty()->SetColor(colors->GetColor3d(sp.labelColor));\n  // Change the color of the text indicating what the slider controls.\n  if (idx >= 0 && idx < 16)\n  {\n    slider->GetTitleProperty()->SetColor(lut->GetTableValue(idx));\n    slider->GetTitleProperty()->ShadowOff();\n  }\n  else\n  {\n    slider->GetTitleProperty()->SetColor(\n        colors->GetColor3d(sp.titleColor).GetData());\n  }\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetRepresentation(slider);\n\n  return sliderWidget;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/FroggieView/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FroggieView)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonMath\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  IOLegacy\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  cli11\n  jsoncpp\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FroggieView: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FroggieView MACOSX_BUNDLE FroggieView.cxx )\n  target_link_libraries(FroggieView PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FroggieView\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/FroggieView/#download-and-build-froggieview","title":"Download and Build FroggieView","text":"

        Click here to download FroggieView and its CMakeLists.txt file. Once the tarball FroggieView.tar has been downloaded and extracted,

        cd FroggieView/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FroggieView\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Glyph3DImage/","title":"Glyph3DImage","text":"

        vtk-examples/Cxx/Visualization/Glyph3DImage

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/Glyph3DImage/#description","title":"Description","text":"

        Supply an image to this example and see the image points glyphed with a vtkPoint. To see the points you may have to interactively zoom the image.

        Note

        vtkGlyph3DMapper can glyph points from any type of vtkDataObject that has vtkPoints.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Glyph3DImage/#code","title":"Code","text":"

        Glyph3DImage.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  // Verify command line arguments.\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" BinaryImage e.g. \" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read file.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader;\n  reader.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader->SetFileName(argv[1]);\n\n  // Create anything you want here, we will use a point\n  // Create the geometry of a point (the coordinate).\n  vtkNew<vtkPoints> points;\n  const float p[3] = {0.0, 0.0, 0.0};\n  points->InsertNextPoint(p);\n\n  vtkNew<vtkCellArray> vertices;\n  vtkIdType pid[1];\n  pid[0] = points->InsertNextPoint(p);\n  vertices->InsertNextCell(1, pid);\n\n  // Create a polydata object.\n  vtkNew<vtkPolyData> point;\n  point->SetPoints(points);\n  point->SetVerts(vertices);\n\n  vtkNew<vtkGlyph3DMapper> glyph3Dmapper;\n  glyph3Dmapper->SetSourceData(point);\n  glyph3Dmapper->SetInputConnection(reader->GetOutputPort());\n  glyph3Dmapper->Update();\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(glyph3Dmapper);\n  actor->GetProperty()->SetPointSize(3);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Glyph3DImage\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Glyph3DImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Glyph3DImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Glyph3DImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Glyph3DImage MACOSX_BUNDLE Glyph3DImage.cxx )\n  target_link_libraries(Glyph3DImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Glyph3DImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Glyph3DImage/#download-and-build-glyph3dimage","title":"Download and Build Glyph3DImage","text":"

        Click here to download Glyph3DImage and its CMakeLists.txt file. Once the tarball Glyph3DImage.tar has been downloaded and extracted,

        cd Glyph3DImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Glyph3DImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Glyph3DMapper/","title":"Glyph3DMapper","text":"

        vtk-examples/Cxx/Visualization/Glyph3DMapper

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Glyph3DMapper/#code","title":"Code","text":"

        Glyph3DMapper.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnsignedCharArray.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(1, 1, 1);\n  points->InsertNextPoint(2, 2, 2);\n\n  vtkNew<vtkFloatArray> scaleFactors;\n  scaleFactors->SetNumberOfComponents(3);\n  scaleFactors->SetName(\"Scale Factors\");\n  scaleFactors->InsertNextTuple3(0.7, 1.0, 1.0);\n  scaleFactors->InsertNextTuple3(1.0, 0.7, 1.0);\n  scaleFactors->InsertNextTuple3(1.0, 1.0, 0.7);\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetName(\"Colors\");\n  colors->SetNumberOfComponents(3);\n  colors->InsertNextTypedTuple(namedColors->GetColor3ub(\"Red\").GetData());\n  colors->InsertNextTypedTuple(namedColors->GetColor3ub(\"Green\").GetData());\n  colors->InsertNextTypedTuple(namedColors->GetColor3ub(\"Blue\").GetData());\n\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->AddArray(colors);\n  polydata->GetPointData()->AddArray(scaleFactors);\n\n  // Create anything you want here, we will use a cube for the demo.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkGlyph3DMapper> glyph3Dmapper;\n  glyph3Dmapper->SetSourceConnection(cubeSource->GetOutputPort());\n  glyph3Dmapper->SetInputData(polydata);\n  glyph3Dmapper->SetScalarModeToUsePointFieldData();\n  glyph3Dmapper->SetScaleArray(\"Scale Factors\");\n  glyph3Dmapper->SetScaleModeToScaleByVectorComponents();\n  glyph3Dmapper->SelectColorArray(\"Colors\");\n  glyph3Dmapper->Update();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(glyph3Dmapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Glyph3DMapper\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(namedColors->GetColor3d(\"SlateGray\").GetData());\n\n  // Position the camera.\n  renderer->GetActiveCamera()->SetPosition(-10, 5, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(1, 1, 1);\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Glyph3DMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Glyph3DMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Glyph3DMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Glyph3DMapper MACOSX_BUNDLE Glyph3DMapper.cxx )\n  target_link_libraries(Glyph3DMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Glyph3DMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Glyph3DMapper/#download-and-build-glyph3dmapper","title":"Download and Build Glyph3DMapper","text":"

        Click here to download Glyph3DMapper and its CMakeLists.txt file. Once the tarball Glyph3DMapper.tar has been downloaded and extracted,

        cd Glyph3DMapper/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Glyph3DMapper\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Hanoi/","title":"Hanoi","text":"

        vtk-examples/Cxx/Visualization/Hanoi

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/Hanoi/#description","title":"Description","text":"

        This is three-dimensional implementation of the Towers of Hanoi.

        Here we visualize the operation of the recursive Towers of Hanoi puzzle. In this puzzle there are three pegs. In the initial position there are one or more disks(or pucks) of varying diameter on the pegs. The disks are sorted according to disk diameter, so that the largest disk is on the bottom, followed by the next largest, and so on. The goal of the puzzle is to move the disks from one peg to another, moving the disks one at a time, and never placing a larger disk on top of a smaller disk.

        Here we first set up the scene with the table, pegs and pucks. Then we use a function called Hanoi() to begin the recursion. A second function MovePuck() moves the puck from one peg to another.

        To give a pleasing visual effect we move the disk in small, user-specified increments, flipping the disc over as it moves from one peg to the next. Option -s controls the user-defined increments. The option -c 2 freezes a disk in mid air moving from one peg to another.

        Info

        See Figure 12-20c in Chapter 12 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Hanoi/#code","title":"Code","text":"

        Hanoi.cxx

        /*\n\nTranslated from:\n   http://www.new-npac.org/projects/sv2all/sv2/vtk/graphics/examplesCxx/Hanoi.cxx\n\n\nHanoi - application example does 3D towers of hanoi.\nUsage:\n Hanoi -p # -s # -r # -c #\n where -p is the number of starting pucks on the peg;\n       -s is the number of steps to take during animation;\n       -r is the resolution of each puck\n       -c controls output of the program.\n*/\n\n#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCylinderSource.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkVersion.h>\n#include <vtkWindowToImageFilter.h>\n\n#include <algorithm>\n#include <array>\n#include <cstdlib>\n#include <iomanip>\n#include <iostream>\n#include <iterator>\n#include <sstream>\n#include <stack>\n#include <string>\n#include <vector>\n\nnamespace {\nvoid PrintCameraOrientation(vtkCamera* cam);\n\n/**\nHere we inherit from vtkCallbackCommand and set pointers to any\nclient and/or call data as needed.\nWhen the class is implemented, it becomes the callback function.\n*/\nclass CameraModifiedCallback : public vtkCallbackCommand\n{\npublic:\n  static CameraModifiedCallback* New()\n  {\n    return new CameraModifiedCallback;\n  }\n  // Here we Create a vtkCallbackCommand and reimplement it.\n  void Execute(vtkObject* caller, unsigned long evId, void*) override\n  {\n    // Note the use of reinterpret_cast to cast the caller to the expected type.\n    vtkRenderWindowInteractor* interactor =\n        reinterpret_cast<vtkRenderWindowInteractor*>(caller);\n    // Just do this to demonstrate who called callback and the event that\n    // triggered it.\n    std::cout << interactor->GetClassName() << \"  Event Id: \" << evId\n              << std::endl;\n\n    // Now print the camera orientation.\n    PrintCameraOrientation(this->cam);\n  }\n  CameraModifiedCallback() : cam(nullptr)\n  {\n  }\n  // Set pointers to any clientData or callData here.\n  vtkCamera* cam;\n\nprivate:\n  CameraModifiedCallback(const CameraModifiedCallback&) = delete;\n  void operator=(const CameraModifiedCallback&) = delete;\n};\n\n// Find command line parameters.\nstd::vector<std::string>::iterator FindParameter(std::string const& p,\n                                                 std::vector<std::string>& v);\n\ntypedef std::array<std::stack<vtkSmartPointer<vtkActor>>, 3> PegArray;\n\n/**\n * This routine is responsible for moving pucks from peg1 to peg2.\n *\n * @param peg1 Initial peg.\n * @param peg2 Final peg.\n */\nvoid MovePuck(vtkRenderWindow* renWin, PegArray& pegStack, int peg1, int peg2);\n\n/**\n* Tower of Hanoi.\n*\n* @param n Number of disks.\n* @param peg1 Source.\n* @param peg2 Target.\n* @param peg3 Helper.\n\n*/\nvoid Hanoi(vtkRenderWindow* renWin, PegArray& pegStack, int n, int peg1,\n           int peg2, int peg3);\n\n// Save a screenshot.\nvoid Screenshot(std::string fileName, vtkRenderWindow* renWin);\n\n// Default values.\nauto numberOfPucks = 5;\nauto numberOfSteps = 5;\nauto puckResolution = 48;\nauto configuration = 0;  // Selecting output.\nauto gotFigure2 = false; // Used to bail out of recursion if configuration == 2.\nauto L = 1.0;            // Puck height.\nauto H = 1.1 * numberOfPucks * L; // Peg height.\nauto R = 0.5;                     // Peg radius.\nauto rMin = 4.0 * R;              // The minimum allowable radius of disks.\nauto rMax = 12.0 * R;             // The maximum allowable radius of disks\nauto D = 1.1 * 1.25 * rMax;       // The distance between the pegs.\nauto numberOfMoves = 0;\nauto const maxPucks = 20;\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Here we parse the command line.\n  std::vector<std::string> parameters;\n  for (auto i = 1; i < argc; ++i)\n  {\n    parameters.push_back(argv[i]);\n  }\n  auto p = FindParameter(std::string(\"?\"), parameters);\n  if (p != parameters.end())\n  {\n    std::cerr << \"Usage:   \" << argv[0] << \" [-p #] [-s #] [r #] [-c #]\"\n              << std::endl;\n    std::cerr << \"Where:        -p specifies the number of pucks.\" << std::endl;\n    std::cerr << \"              -s specifies the number of steps.\" << std::endl;\n    std::cerr << \"              -r specifies the puck resolution.\" << std::endl;\n    std::cerr << \"              -c specifies configuration.\" << std::endl;\n    std::cerr << \"                 0 final configuration.\" << std::endl;\n    std::cerr << \"                 1 initial configuration.\" << std::endl;\n    std::cerr << \"                 2 intermediate configuration.\" << std::endl;\n    std::cerr << \"                 3 final configuration and save images\"\n              << std::endl;\n    std::cerr << \"Defaults:  -p 5 -s 5 -r 48 -c 0\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  p = FindParameter(std::string(\"-p\"), parameters);\n  if (p != parameters.end() && std::next(p) != parameters.end())\n  {\n    numberOfPucks = std::abs(atoi(std::next(p)->c_str()));\n  }\n  p = FindParameter(std::string(\"-s\"), parameters);\n  if (p != parameters.end() && std::next(p) != parameters.end())\n  {\n    numberOfSteps = std::abs(atoi(std::next(p)->c_str()));\n  }\n  p = FindParameter(std::string(\"-r\"), parameters);\n  if (p != parameters.end() && std::next(p) != parameters.end())\n  {\n    puckResolution = std::abs(atoi(std::next(p)->c_str()));\n  }\n  p = FindParameter(std::string(\"-c\"), parameters);\n  if (p != parameters.end() && std::next(p) != parameters.end())\n  {\n    configuration = std::abs(atoi(std::next(p)->c_str()));\n  }\n\n  // Initialize variables and check input.\n  if (numberOfPucks < 2)\n  {\n    std::cerr << \"Please use more pucks!\\n\";\n    return EXIT_FAILURE;\n  }\n\n  if (numberOfPucks > maxPucks)\n  {\n    std::cerr << \"Too many pucks specified! Maximum is \" << maxPucks << \"\\n\";\n    return EXIT_FAILURE;\n  }\n\n  if (numberOfSteps < 3)\n  {\n    std::cerr << \"Please use more steps!\\n\";\n    return EXIT_FAILURE;\n  }\n\n  if (configuration > 3)\n  {\n    std::cerr << \"0>= configuration <= 3\\n\";\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Our rendering window.\n  vtkNew<vtkRenderWindow> renWin;\n\n  // Create renderer and render window interactor.\n  vtkNew<vtkRenderer> ren;\n  renWin->AddRenderer(ren);\n  renWin->SetSize(1200, 750);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren->SetBackground(colors->GetColor3d(\"PapayaWhip\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  camera->SetPosition(41.0433, 27.9637, 30.442);\n  camera->SetFocalPoint(11.5603, -1.51931, 0.95899);\n  camera->SetClippingRange(18.9599, 91.6042);\n  camera->SetViewUp(0, 1, 0);\n\n  ren->SetActiveCamera(camera);\n\n  // Create geometry: table, pegs, and pucks.\n  vtkNew<vtkCylinderSource> pegGeometry;\n  pegGeometry->SetResolution(8);\n  vtkNew<vtkPolyDataMapper> pegMapper;\n  pegMapper->SetInputConnection(pegGeometry->GetOutputPort());\n\n  vtkNew<vtkCylinderSource> puckGeometry;\n  puckGeometry->SetResolution(puckResolution);\n  vtkNew<vtkPolyDataMapper> puckMapper;\n  puckMapper->SetInputConnection(puckGeometry->GetOutputPort());\n\n  vtkNew<vtkPlaneSource> tableGeometry;\n  tableGeometry->SetResolution(10, 10);\n  vtkNew<vtkPolyDataMapper> tableMapper;\n  tableMapper->SetInputConnection(tableGeometry->GetOutputPort());\n\n  // Create the actors: table top, pegs, and pucks\n  // The table\n  vtkNew<vtkActor> table;\n  ren->AddActor(table);\n  table->SetMapper(tableMapper);\n  // table->GetProperty()->SetColor(0.9569, 0.6431, 0.3765);\n  table->GetProperty()->SetColor(colors->GetColor3d(\"SaddleBrown\").GetData());\n  table->AddPosition(D, 0, 0);\n  table->SetScale(4 * D, 2 * D, 3 * D);\n  table->RotateX(90);\n\n  // The pegs (using cylinder geometry).  Note that the pegs have to translated\n  // in the  y-direction because the cylinder is centered about the origin.\n  H = 1.1 * numberOfPucks * L;\n  std::vector<vtkSmartPointer<vtkActor>> peg;\n  for (auto i = 0; i < 3; ++i)\n  {\n    peg.push_back(vtkSmartPointer<vtkActor>::New());\n    ren->AddActor(peg[i]);\n    peg[i]->SetMapper(pegMapper);\n    // peg[i]->GetProperty()->SetColor(1, 1, 1);\n    peg[i]->GetProperty()->SetColor(colors->GetColor3d(\"Lavender\").GetData());\n    peg[i]->AddPosition(i * D, H / 2, 0);\n    peg[i]->SetScale(1, H, 1);\n  }\n\n  // Three pegs, each a stack of a vector of actors.\n  PegArray pegStack;\n\n  // The pucks (using cylinder geometry). Always loaded on peg# 0.\n  std::vector<vtkSmartPointer<vtkActor>> puck;\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(1);\n  for (auto i = 0; i < numberOfPucks; ++i)\n  {\n    puck.push_back(vtkSmartPointer<vtkActor>::New());\n    puck[i]->SetMapper(puckMapper);\n    std::array<double, 3> color{{0, 0, 0}};\n    for (auto j = 0; j < 3; ++j)\n    {\n      color[j] = randomSequence->GetValue();\n      randomSequence->Next();\n    }\n    puck[i]->GetProperty()->SetColor(color.data());\n    puck[i]->AddPosition(0, i * L + L / 2, 0);\n    auto scale = rMax - i * (rMax - rMin) / (numberOfPucks - 1);\n    puck[i]->SetScale(scale, 1, scale);\n    ren->AddActor(puck[i]);\n    pegStack[0].push(puck[i]);\n  }\n\n  // Reset the camera to view all actors.\n  renWin->Render();\n  renWin->SetWindowName(\"Hanoi\");\n\n  if (configuration == 3)\n  {\n    Screenshot(\"hanoi0.png\", renWin);\n  }\n  if (configuration != 1)\n  {\n    // Begin recursion.\n    Hanoi(renWin, pegStack, numberOfPucks - 1, 0, 2, 1);\n    Hanoi(renWin, pegStack, 1, 0, 1, 2);\n    if (!gotFigure2)\n    {\n      Hanoi(renWin, pegStack, numberOfPucks - 1, 2, 1, 0);\n\n      renWin->Render();\n      if (configuration == 3)\n      {\n        Screenshot(\"hanoi2.png\", renWin);\n      }\n    }\n    // Report output.\n    cout << \"Number of moves: \" << numberOfMoves << \"\\n\"\n         << \"Polygons rendered each frame: \"\n         << 3 * 8 + 1 + numberOfPucks * (2 + puckResolution) << \"\\n\"\n         << \"Total number of frames: \" << numberOfMoves * 3 * numberOfSteps\n         << \"\\n\";\n  }\n  vtkNew<CameraModifiedCallback> getOrientation;\n  // Set the camera to use.\n  getOrientation->cam = ren->GetActiveCamera();\n  iren->AddObserver(vtkCommand::EndInteractionEvent, getOrientation);\n\n  // Render the image.\n  iren->Initialize();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::vector<std::string>::iterator FindParameter(std::string const& p,\n                                                 std::vector<std::string>& v)\n{\n  return std::find(v.begin(), v.end(), p);\n}\n\nvoid MovePuck(vtkRenderWindow* renWin, PegArray& pegStack, int peg1, int peg2)\n{\n  numberOfMoves++;\n\n  // Get the actor to move\n  vtkActor* movingActor = pegStack[peg1].top();\n  pegStack[peg1].pop();\n\n  // Get the distance to move up.\n  auto distance =\n      (H - (L * (static_cast<int>(pegStack[peg1].size()) - 1)) + rMax) /\n      numberOfSteps;\n  for (auto i = 0; i < numberOfSteps; i++)\n  {\n    movingActor->AddPosition(0, distance, 0);\n    renWin->Render();\n  }\n\n  // get the distance to move across\n  distance = (peg2 - peg1) * D / numberOfSteps;\n  auto flipAngle = 180.0 / numberOfSteps;\n  for (auto i = 0; i < numberOfSteps; i++)\n  {\n    movingActor->AddPosition(distance, 0, 0);\n    movingActor->RotateX(flipAngle);\n    renWin->Render();\n    if (numberOfMoves == 13 && i == 3) // for making book image\n    {\n      if (configuration == 3 || configuration == 2)\n      {\n        vtkCamera* cam =\n            renWin->GetRenderers()->GetFirstRenderer()->GetActiveCamera();\n        vtkNew<vtkCamera> camera1;\n        camera1->SetPosition(54.7263, 41.6467, 44.125);\n        camera1->SetFocalPoint(11.5603, -1.51931, 0.95899);\n        camera1->SetClippingRange(42.4226, 115.659);\n        camera1->SetViewUp(0, 1, 0);\n        renWin->GetRenderers()->GetFirstRenderer()->SetActiveCamera(camera1);\n        renWin->Render();\n        if (configuration == 3)\n        {\n          Screenshot(\"hanoi1.png\", renWin);\n        }\n        if (configuration == 2)\n        {\n          gotFigure2 = true;\n          break;\n        }\n        renWin->GetRenderers()->GetFirstRenderer()->SetActiveCamera(cam);\n        renWin->Render();\n      }\n    }\n  }\n\n  if (gotFigure2)\n  {\n    pegStack[peg2].push(movingActor);\n    return;\n  }\n\n  // Get the distance to move down.\n  distance = ((L * (static_cast<int>(pegStack[peg2].size()) - 1)) - H - rMax) /\n      numberOfSteps;\n\n  for (auto i = 0; i < numberOfSteps; i++)\n  {\n    movingActor->AddPosition(0, distance, 0);\n    renWin->Render();\n  }\n\n  pegStack[peg2].push(movingActor);\n}\n\nvoid Hanoi(vtkRenderWindow* renWin, PegArray& pegStack, int n, int peg1,\n           int peg2, int peg3)\n{\n  // If gotFigure2 is true, we break out of the recursion.\n  if (gotFigure2)\n  {\n    return;\n  }\n  if (n != 1)\n  {\n    Hanoi(renWin, pegStack, n - 1, peg1, peg3, peg2);\n    if (gotFigure2)\n    {\n      return;\n    }\n    Hanoi(renWin, pegStack, 1, peg1, peg2, peg3);\n    Hanoi(renWin, pegStack, n - 1, peg3, peg2, peg1);\n  }\n  else\n  {\n    MovePuck(renWin, pegStack, peg1, peg2);\n  }\n  return;\n}\n\nvoid Screenshot(std::string fileName, vtkRenderWindow* renWin)\n{\n  vtkNew<vtkWindowToImageFilter> windowToImageFilter;\n  windowToImageFilter->SetInput(renWin);\n\n#if VTK_MAJOR_VERSION >= 8 || VTK_MAJOR_VERSION == 8 && VTK_MINOR_VERSION >= 90\n  windowToImageFilter->SetScale(1); // image quality\n#else\n  windowToImageFilter->SetMagnification(1); // image quality\n#endif\n\n  // We are not recording the alpha (transparency) channel.\n  // windowToImageFilter->SetInputBufferTypeToRGBA();\n  windowToImageFilter->SetInputBufferTypeToRGB();\n  // Read from the front buffer.\n  windowToImageFilter->ReadFrontBufferOff();\n  windowToImageFilter->Update();\n\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(fileName.c_str());\n  writer->SetInputConnection(windowToImageFilter->GetOutputPort());\n  writer->Write();\n}\n\n/**\nGet a comma separated list.\n*/\ntemplate <typename T> std::string CommaSeparatedList(std::vector<T> v)\n{\n  std::ostringstream os;\n  std::copy(v.begin(), v.end() - 1, std::ostream_iterator<T>(os, \", \"));\n  os << v.back();\n  return os.str();\n}\n\n/**\nPrint the camera orientation.\n*/\nvoid PrintCameraOrientation(vtkCamera* cam)\n{\n  auto width = 16;\n  double pos[3];\n  cam->GetPosition(pos);\n  double fp[3];\n  cam->GetFocalPoint(fp);\n  double vu[3];\n  cam->GetViewUp(vu);\n  double cr[2];\n  cam->GetClippingRange(cr);\n  std::cout << setw(width) << \"Position: \"\n            << CommaSeparatedList(std::vector<double>(pos, pos + 3))\n            << std::endl;\n  std::cout << setw(width) << \"Focal point: \"\n            << CommaSeparatedList(std::vector<double>(fp, fp + 3)) << std::endl;\n  std::cout << setw(width) << \"Clipping range: \"\n            << CommaSeparatedList(std::vector<double>(cr, cr + 2)) << std::endl;\n  std::cout << setw(width) << \"View up: \"\n            << CommaSeparatedList(std::vector<double>(vu, vu + 3)) << std::endl;\n  std::cout << setw(width) << \"Distance: \" << cam->GetDistance() << std::endl;\n};\n} // namespace\n
        "},{"location":"Cxx/Visualization/Hanoi/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Hanoi)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Hanoi: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Hanoi MACOSX_BUNDLE Hanoi.cxx )\n  target_link_libraries(Hanoi PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Hanoi\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Hanoi/#download-and-build-hanoi","title":"Download and Build Hanoi","text":"

        Click here to download Hanoi and its CMakeLists.txt file. Once the tarball Hanoi.tar has been downloaded and extracted,

        cd Hanoi/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Hanoi\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/HanoiInitial/","title":"HanoiInitial","text":"

        vtk-examples/Cxx/Visualization/HanoiInitial

        "},{"location":"Cxx/Visualization/HanoiInitial/#description","title":"Description","text":"

        Towers of Hanoi, initial configuration,

        Info

        See Figure 12-20a in Chapter 12 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/HanoiInitial/#code","title":"Code","text":"

        HanoiInitial.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCylinderSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkPNGWriter.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkWindowToImageFilter.h>\n\n// Start this program with the parameter: -c 1\n#include \"Hanoi.cxx\"\n
        "},{"location":"Cxx/Visualization/HanoiInitial/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HanoiInitial)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HanoiInitial: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HanoiInitial MACOSX_BUNDLE HanoiInitial.cxx )\n  target_link_libraries(HanoiInitial PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HanoiInitial\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/HanoiInitial/#download-and-build-hanoiinitial","title":"Download and Build HanoiInitial","text":"

        Click here to download HanoiInitial and its CMakeLists.txt file. Once the tarball HanoiInitial.tar has been downloaded and extracted,

        cd HanoiInitial/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HanoiInitial\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/HanoiIntermediate/","title":"HanoiIntermediate","text":"

        vtk-examples/Cxx/Visualization/HanoiIntermediate

        "},{"location":"Cxx/Visualization/HanoiIntermediate/#description","title":"Description","text":"

        Towers of Hanoi, intermediate configuration,

        Info

        See Figure 12-20b in Chapter 12 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/HanoiIntermediate/#code","title":"Code","text":"

        HanoiIntermediate.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCylinderSource.h>\n#include <vtkMath.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkPNGWriter.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRendererCollection.h>\n#include <vtkSmartPointer.h>\n#include <vtkWindowToImageFilter.h>\n\n// Start this program with the parameter: -c 2\n#include \"Hanoi.cxx\"\n
        "},{"location":"Cxx/Visualization/HanoiIntermediate/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HanoiIntermediate)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HanoiIntermediate: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HanoiIntermediate MACOSX_BUNDLE HanoiIntermediate.cxx )\n  target_link_libraries(HanoiIntermediate PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HanoiIntermediate\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/HanoiIntermediate/#download-and-build-hanoiintermediate","title":"Download and Build HanoiIntermediate","text":"

        Click here to download HanoiIntermediate and its CMakeLists.txt file. Once the tarball HanoiIntermediate.tar has been downloaded and extracted,

        cd HanoiIntermediate/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HanoiIntermediate\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Hawaii/","title":"Hawaii","text":"

        vtk-examples/Cxx/Visualization/Hawaii

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/Hawaii/#description","title":"Description","text":"

        Visualize elevations by coloring the scalar values with a lookup table.

        This is a translation of the original hawaii.tcl with a few additional enhancements. The image is centered on Honolulu. Diamond Head is the crater lower left. Punchbowl is the crater in the centre.

        Info

        See Figure 6-12 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Hawaii/#code","title":"Code","text":"

        Hawaii.cxx

        // Translated from hawaii.tcl\n\n/*\n\nProduce figure 6-12 from the VTK Textbook.\nIt is a translation of the original hawaii.tcl with a few additional\nenhancements.\nThe image is centered on Honolulu, O'ahu.\nDiamond Head is the crater lower left. Punchbowl is the crater in the centre.\n\nThe colorScheme option allows you to select a series of colour schemes.\n0: The default, a lookup using a \"Brewer\" palette.\n1: The original: A lookup table of 256 colours ranging from deep blue (water) to\nyellow-white (mountain top).\n2: A lookup table with a preset number of colours.\n\n*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkDataSetMapper.h>\n#include <vtkElevationFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nnamespace {\n//! Create a lookup table.\n/*!\n@param lut - An indexed lookup table.\n*/\nvoid MakeLUT(int const& colorScheme, vtkLookupTable* lut);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [colorScheme]\" << std::endl;\n    std::cout << \"where: filename is the file honolulu.vtk.\" << std::endl;\n    std::cout << \"       colorScheme is 0, 1, or 2, default 0\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int colorScheme = 0;\n  std::string fileName = argv[1];\n\n  if (argc == 3)\n  {\n    colorScheme = std::abs(atoi(argv[2]));\n    colorScheme = (colorScheme > 2) ? 0 : colorScheme;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color.\n  std::array<unsigned char, 4> bkg{{26, 51, 102, 255}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Read a vtk file\n  //\n  vtkNew<vtkPolyDataReader> hawaii;\n  hawaii->SetFileName(fileName.c_str());\n  hawaii->Update();\n  double bounds[6];\n  hawaii->GetOutput()->GetBounds(bounds);\n\n  vtkNew<vtkElevationFilter> elevation;\n  elevation->SetInputConnection(hawaii->GetOutputPort());\n  elevation->SetLowPoint(0, 0, 0);\n  elevation->SetHighPoint(0, 0, 1000);\n  elevation->SetScalarRange(0, 1000);\n\n  vtkNew<vtkLookupTable> lut;\n  MakeLUT(colorScheme, lut);\n\n  vtkNew<vtkDataSetMapper> hawaiiMapper;\n  hawaiiMapper->SetInputConnection(elevation->GetOutputPort());\n  hawaiiMapper->SetScalarRange(0, 1000);\n  hawaiiMapper->ScalarVisibilityOn();\n  hawaiiMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> hawaiiActor;\n  hawaiiActor->SetMapper(hawaiiMapper);\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren->AddActor(hawaiiActor);\n  // Match the window shape to the object.\n  // renWin->SetSize(500, int(500 * bounds[1] / bounds[3]));\n  renWin->SetSize(500, 500);\n  renWin->SetWindowName(\"Hawaii\");\n\n  // Render the image.\n  // Centered on Honolulu,\n  // Diamond Head is the crater lower left.\n  // Punchbowl is the crater in the centre.\n  renWin->Render();\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  ren->GetActiveCamera()->Zoom(1.5);\n  ren->GetActiveCamera()->Roll(-90);\n  ren->ResetCameraClippingRange();\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeLUT(int const& colorScheme, vtkLookupTable* lut)\n{\n  vtkNew<vtkNamedColors> colors;\n  // Select a color scheme.\n  switch (colorScheme)\n  {\n  case 0:\n  default: {\n    // Make the lookup using a Brewer palette.\n    vtkNew<vtkColorSeries> colorSeries;\n    colorSeries->SetNumberOfColors(8);\n    int colorSeriesEnum = colorSeries->BREWER_DIVERGING_BROWN_BLUE_GREEN_8;\n    colorSeries->SetColorScheme(colorSeriesEnum);\n    colorSeries->BuildLookupTable(lut, colorSeries->ORDINAL);\n    lut->SetNanColor(1, 0, 0, 1);\n    break;\n  }\n  case 1: {\n    // A lookup table of 256 colours ranging from\n    //  deep blue(water) to yellow - white(mountain top)\n    //  is used to color map this figure.\n    lut->SetHueRange(0.7, 0);\n    lut->SetSaturationRange(1.0, 0);\n    lut->SetValueRange(0.5, 1.0);\n    break;\n  }\n  case 2:\n    // Make the lookup table with a preset number of colours.\n    vtkNew<vtkColorSeries> colorSeries;\n    colorSeries->SetNumberOfColors(8);\n    colorSeries->SetColorSchemeName(\"Hawaii\");\n    colorSeries->SetColor(0, colors->GetColor3ub(\"turquoise_blue\"));\n    colorSeries->SetColor(1, colors->GetColor3ub(\"sea_green_medium\"));\n    colorSeries->SetColor(2, colors->GetColor3ub(\"sap_green\"));\n    colorSeries->SetColor(3, colors->GetColor3ub(\"green_dark\"));\n    colorSeries->SetColor(4, colors->GetColor3ub(\"tan\"));\n    colorSeries->SetColor(5, colors->GetColor3ub(\"beige\"));\n    colorSeries->SetColor(6, colors->GetColor3ub(\"light_beige\"));\n    colorSeries->SetColor(7, colors->GetColor3ub(\"bisque\"));\n    colorSeries->BuildLookupTable(lut, colorSeries->ORDINAL);\n    lut->SetNanColor(1, 0, 0, 1);\n  };\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/Hawaii/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Hawaii)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Hawaii: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Hawaii MACOSX_BUNDLE Hawaii.cxx )\n  target_link_libraries(Hawaii PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Hawaii\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Hawaii/#download-and-build-hawaii","title":"Download and Build Hawaii","text":"

        Click here to download Hawaii and its CMakeLists.txt file. Once the tarball Hawaii.tar has been downloaded and extracted,

        cd Hawaii/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Hawaii\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/HedgeHog/","title":"HedgeHog","text":"

        vtk-examples/Cxx/Visualization/HedgeHog

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/HedgeHog/#code","title":"Code","text":"

        HedgeHog.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFloatArray.h>\n#include <vtkHedgeHog.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n\nnamespace {\n\nvoid CreateData(vtkStructuredGrid* sgrid);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the structured grid.\n  vtkNew<vtkStructuredGrid> sgrid;\n  CreateData(sgrid);\n\n  // We create a simple pipeline to display the data.\n  vtkNew<vtkHedgeHog> hedgehog;\n  hedgehog->SetInputData(sgrid);\n  hedgehog->SetScaleFactor(0.1);\n\n  vtkNew<vtkPolyDataMapper> sgridMapper;\n  sgridMapper->SetInputConnection(hedgehog->GetOutputPort());\n\n  vtkNew<vtkActor> sgridActor;\n  sgridActor->SetMapper(sgridMapper);\n  sgridActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create the usual rendering stuff.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetWindowName(\"HedgeHog\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  renderer->AddActor(sgridActor);\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(60.0);\n  renderer->GetActiveCamera()->Azimuth(30.0);\n  renderer->GetActiveCamera()->Zoom(0.9);\n  renWin->SetSize(300, 300);\n\n  // interact with data\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CreateData(vtkStructuredGrid* sgrid)\n{\n  // int i, j, k, kOffset, jOffset, offset;\n  float x[3], v[3], rMin = 0.5, rMax = 1.0;\n  // float radius, theta;\n  static int dims[3]{13, 11, 11};\n  sgrid->SetDimensions(dims);\n\n  // We also create the points and vectors. The points\n  // form a hemi-cylinder of data.\n  vtkNew<vtkFloatArray> vectors;\n  vectors->SetNumberOfComponents(3);\n  vectors->SetNumberOfTuples(dims[0] * dims[1] * dims[2]);\n\n  vtkNew<vtkPoints> points;\n  points->Allocate(dims[0] * dims[1] * dims[2]);\n\n  auto deltaZ = 2.0 / (dims[2] - 1);\n  auto deltaRad = (rMax - rMin) / (dims[1] - 1);\n  v[2] = 0.0;\n  for (auto k = 0; k < dims[2]; k++)\n  {\n    x[2] = -1.0 + k * deltaZ;\n    auto kOffset = k * dims[0] * dims[1];\n    for (auto j = 0; j < dims[1]; j++)\n    {\n      auto radius = rMin + j * deltaRad;\n      auto jOffset = j * dims[0];\n      for (auto i = 0; i < dims[0]; i++)\n      {\n        auto theta = i * vtkMath::RadiansFromDegrees(15.0);\n        x[0] = radius * cos(theta);\n        x[1] = radius * sin(theta);\n        v[0] = -x[1];\n        v[1] = x[0];\n        auto offset = i + jOffset + kOffset;\n        points->InsertPoint(offset, x);\n        vectors->InsertTuple(offset, v);\n      }\n    }\n  }\n  sgrid->SetPoints(points);\n\n  sgrid->GetPointData()->SetVectors(vectors);\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/HedgeHog/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HedgeHog)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HedgeHog: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HedgeHog MACOSX_BUNDLE HedgeHog.cxx )\n  target_link_libraries(HedgeHog PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HedgeHog\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/HedgeHog/#download-and-build-hedgehog","title":"Download and Build HedgeHog","text":"

        Click here to download HedgeHog and its CMakeLists.txt file. Once the tarball HedgeHog.tar has been downloaded and extracted,

        cd HedgeHog/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HedgeHog\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/HideActor/","title":"HideActor","text":"

        vtk-examples/Cxx/Visualization/HideActor

        "},{"location":"Cxx/Visualization/HideActor/#description","title":"Description","text":"

        Display two spheres, then hide one, then hide both.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/HideActor/#code","title":"Code","text":"

        HideActor.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPropCollection.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere 1\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(4.0);\n  sphereSource1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereSource1->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere 2\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10.0, 0.0, 0.0);\n  sphereSource2->SetRadius(3.0);\n  sphereSource2->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(sphereSource2->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Honeydew\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HideActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleSwitch> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  // renderWindowInteractor->Start();\n\n  // Change the background color so we know we are done with the original two\n  // sphere display.\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Hide one actor at a time.\n  vtkPropCollection* props =\n      renderer->GetViewProps(); // iterate through and set each visibility to 0.\n  props->InitTraversal();\n  for (int i = 0; i < props->GetNumberOfItems(); i++)\n  {\n    props->GetNextProp()->VisibilityOff();\n\n    renderer->ResetCamera();\n    renderWindow->Render();\n  }\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/HideActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HideActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HideActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HideActor MACOSX_BUNDLE HideActor.cxx )\n  target_link_libraries(HideActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HideActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/HideActor/#download-and-build-hideactor","title":"Download and Build HideActor","text":"

        Click here to download HideActor and its CMakeLists.txt file. Once the tarball HideActor.tar has been downloaded and extracted,

        cd HideActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HideActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/HideAllActors/","title":"HideAllActors","text":"

        vtk-examples/Cxx/Visualization/HideAllActors

        "},{"location":"Cxx/Visualization/HideAllActors/#description","title":"Description","text":"

        Display two spheres, then hide everything and turn the screen red.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/HideAllActors/#code","title":"Code","text":"

        HideAllActors.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere 1\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(4.0);\n  sphereSource1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereSource1->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere 2\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10.0, 0.0, 0.0);\n  sphereSource2->SetRadius(3.0);\n  sphereSource2->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(sphereSource2->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Honeydew\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HideActor\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleSwitch> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  // renderWindowInteractor->Start();\n\n  renderer->RemoveAllViewProps();\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renderer->Render();\n  renderer->ResetCamera();\n\n  // Why doesn't the screen change color until I click/move the mouse?\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/HideAllActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HideAllActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HideAllActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HideAllActors MACOSX_BUNDLE HideAllActors.cxx )\n  target_link_libraries(HideAllActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HideAllActors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/HideAllActors/#download-and-build-hideallactors","title":"Download and Build HideAllActors","text":"

        Click here to download HideAllActors and its CMakeLists.txt file. Once the tarball HideAllActors.tar has been downloaded and extracted,

        cd HideAllActors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HideAllActors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/IsosurfaceSampling/","title":"IsosurfaceSampling","text":"

        vtk-examples/Cxx/Visualization/IsosurfaceSampling

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/IsosurfaceSampling/#description","title":"Description","text":"

        This example illustrates how to create an isosurface and create point data on that isosurface that is sampled from another dataset. This example creates an isosurface of a sphere and then uses the vtkProbeFilter to compute point data from a sampled cylinder.

        Note

        All point data is sampled, even the normals. This example restores the original isosurface normals after the probe. The example has one optional command line argument that controls the sample resolution of the sphere and cylinder. The default is 50.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/IsosurfaceSampling/#code","title":"Code","text":"

        IsosurfaceSampling.cxx

        #include <vtkActor.h>\n#include <vtkCylinder.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\nint main(int argc, char* argv[])\n{\n  int resolution = 50;\n  if (argc > 1)\n  {\n    resolution = atoi(argv[1]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sampled sphere.\n  vtkNew<vtkSphere> implicitSphere;\n  double radius = 1.0;\n  implicitSphere->SetRadius(radius);\n\n  vtkNew<vtkSampleFunction> sampledSphere;\n  sampledSphere->SetSampleDimensions(resolution, resolution, resolution);\n  double xMin = -radius * 2.0;\n  double xMax = radius * 2.0;\n  sampledSphere->SetModelBounds(xMin, xMax, xMin, xMax, xMin, xMax);\n  sampledSphere->SetImplicitFunction(implicitSphere);\n\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> isoSphere;\n#else\n  vtkNew<vtkMarchingCubes> isoSphere;\n#endif\n  isoSphere->SetValue(0, 1.0);\n  isoSphere->SetInputConnection(sampledSphere->GetOutputPort());\n\n  // Create a sampled cylinder.\n  vtkNew<vtkCylinder> implicitCylinder;\n  implicitCylinder->SetRadius(radius / 2.0);\n  vtkNew<vtkSampleFunction> sampledCylinder;\n  sampledCylinder->SetSampleDimensions(resolution, resolution, resolution);\n  sampledCylinder->SetModelBounds(xMin, xMax, xMin, xMax, xMin, xMax);\n  sampledCylinder->SetImplicitFunction(implicitCylinder);\n\n  // Probe cylinder with the sphere isosurface.\n  vtkNew<vtkProbeFilter> probeCylinder;\n  probeCylinder->SetInputConnection(0, isoSphere->GetOutputPort());\n  probeCylinder->SetInputConnection(1, sampledCylinder->GetOutputPort());\n  probeCylinder->Update();\n\n  // Restore the original normals.\n  probeCylinder->GetOutput()->GetPointData()->SetNormals(\n      isoSphere->GetOutput()->GetPointData()->GetNormals());\n\n  std::cout << \"Scalar range: \"\n            << probeCylinder->GetOutput()->GetScalarRange()[0] << \", \"\n            << probeCylinder->GetOutput()->GetScalarRange()[1] << std::endl;\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapSphere;\n  mapSphere->SetInputConnection(probeCylinder->GetOutputPort());\n  mapSphere->SetScalarRange(probeCylinder->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> sphere;\n  sphere->SetMapper(mapSphere);\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"IsosurfaceSampling\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(sphere);\n  renderer->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/IsosurfaceSampling/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IsosurfaceSampling)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IsosurfaceSampling: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IsosurfaceSampling MACOSX_BUNDLE IsosurfaceSampling.cxx )\n  target_link_libraries(IsosurfaceSampling PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IsosurfaceSampling\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/IsosurfaceSampling/#download-and-build-isosurfacesampling","title":"Download and Build IsosurfaceSampling","text":"

        Click here to download IsosurfaceSampling and its CMakeLists.txt file. Once the tarball IsosurfaceSampling.tar has been downloaded and extracted,

        cd IsosurfaceSampling/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IsosurfaceSampling\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Kitchen/","title":"Kitchen","text":"

        vtk-examples/Cxx/Visualization/Kitchen

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/Kitchen/#description","title":"Description","text":"

        The example shows forty streamlines in a small kitchen. The room has two windows, a door(with air leakage), and a cooking area with a hot stove. The air leakage and temperature variation combine to produce air convection currents throughout the kitchen. The starting positions of the streamlines were defined by creating a rake, or curve (and its associated points). Here the rake was a straight line modeled with a vtkLineSource. These streamlines clearly show features of the flow field. By releasing many streamlines simultaneously we obtain even more information, as the eye tends to assemble nearby streamlines into a \u201cglobal\u201d understanding of flow field features.

        Info

        See Figure 6-18 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Kitchen/#code","title":"Code","text":"

        Kitchen.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredGridReader.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" kitchen.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  double range[2];\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the furniture colors.\n  std::array<unsigned char, 4> furnColor{{204, 204, 153, 255}};\n  colors->SetColor(\"Furniture\", furnColor.data());\n\n  vtkNew<vtkRenderer> aren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  //\n  // Read data.\n  //\n  vtkNew<vtkStructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update(); // Force a read to occur.\n  reader->GetOutput()->GetLength();\n\n  double maxTime = 0.0;\n\n  if (reader->GetOutput()->GetPointData()->GetScalars())\n  {\n    reader->GetOutput()->GetPointData()->GetScalars()->GetRange(range);\n  }\n  if (reader->GetOutput()->GetPointData()->GetVectors())\n  {\n    auto maxVelocity =\n        reader->GetOutput()->GetPointData()->GetVectors()->GetMaxNorm();\n    maxTime = 4.0 * reader->GetOutput()->GetLength() / maxVelocity;\n  }\n  //\n  // Outline around data.\n  //\n  vtkNew<vtkStructuredGridOutlineFilter> outlineF;\n  outlineF->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outlineF->GetOutputPort());\n  vtkNew<vtkActor> outline;\n  outline->SetMapper(outlineMapper);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"LampBlack\").GetData());\n  //\n  // Set up shaded surfaces (i.e., supporting geometry).\n  //\n  vtkNew<vtkStructuredGridGeometryFilter> doorGeom;\n  doorGeom->SetInputConnection(reader->GetOutputPort());\n  doorGeom->SetExtent(27, 27, 14, 18, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapDoor;\n  mapDoor->SetInputConnection(doorGeom->GetOutputPort());\n  mapDoor->ScalarVisibilityOff();\n  vtkNew<vtkActor> door;\n  door->SetMapper(mapDoor);\n  door->GetProperty()->SetColor(colors->GetColor3d(\"Burlywood\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> window1Geom;\n  window1Geom->SetInputConnection(reader->GetOutputPort());\n  window1Geom->SetExtent(0, 0, 9, 18, 6, 12);\n  vtkNew<vtkPolyDataMapper> mapWindow1;\n  mapWindow1->SetInputConnection(window1Geom->GetOutputPort());\n  mapWindow1->ScalarVisibilityOff();\n  vtkNew<vtkActor> window1;\n  window1->SetMapper(mapWindow1);\n  window1->GetProperty()->SetColor(colors->GetColor3d(\"SkyBlue\").GetData());\n  window1->GetProperty()->SetOpacity(.6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> window2Geom;\n  window2Geom->SetInputConnection(reader->GetOutputPort());\n  window2Geom->SetExtent(5, 12, 23, 23, 6, 12);\n  vtkNew<vtkPolyDataMapper> mapWindow2;\n  mapWindow2->SetInputConnection(window2Geom->GetOutputPort());\n  mapWindow2->ScalarVisibilityOff();\n  vtkNew<vtkActor> window2;\n  window2->SetMapper(mapWindow2);\n  window2->GetProperty()->SetColor(colors->GetColor3d(\"SkyBlue\").GetData());\n  window2->GetProperty()->SetOpacity(.6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower1Geom;\n  klower1Geom->SetInputConnection(reader->GetOutputPort());\n  klower1Geom->SetExtent(17, 17, 0, 11, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower1;\n  mapKlower1->SetInputConnection(klower1Geom->GetOutputPort());\n  mapKlower1->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower1;\n  klower1->SetMapper(mapKlower1);\n  klower1->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower2Geom;\n  klower2Geom->SetInputConnection(reader->GetOutputPort());\n  klower2Geom->SetExtent(19, 19, 0, 11, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower2;\n  mapKlower2->SetInputConnection(klower2Geom->GetOutputPort());\n  mapKlower2->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower2;\n  klower2->SetMapper(mapKlower2);\n  klower2->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower3Geom;\n  klower3Geom->SetInputConnection(reader->GetOutputPort());\n  klower3Geom->SetExtent(17, 19, 0, 0, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower3;\n  mapKlower3->SetInputConnection(klower3Geom->GetOutputPort());\n  mapKlower3->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower3;\n  klower3->SetMapper(mapKlower3);\n  klower3->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower4Geom;\n  klower4Geom->SetInputConnection(reader->GetOutputPort());\n  klower4Geom->SetExtent(17, 19, 11, 11, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower4;\n  mapKlower4->SetInputConnection(klower4Geom->GetOutputPort());\n  mapKlower4->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower4;\n  klower4->SetMapper(mapKlower4);\n  klower4->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower5Geom;\n  klower5Geom->SetInputConnection(reader->GetOutputPort());\n  klower5Geom->SetExtent(17, 19, 0, 11, 0, 0);\n  vtkNew<vtkPolyDataMapper> mapKlower5;\n  mapKlower5->SetInputConnection(klower5Geom->GetOutputPort());\n  mapKlower5->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower5;\n  klower5->SetMapper(mapKlower5);\n  klower5->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower6Geom;\n  klower6Geom->SetInputConnection(reader->GetOutputPort());\n  klower6Geom->SetExtent(17, 19, 0, 7, 6, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower6;\n  mapKlower6->SetInputConnection(klower6Geom->GetOutputPort());\n  mapKlower6->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower6;\n  klower6->SetMapper(mapKlower6);\n  klower6->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> klower7Geom;\n  klower7Geom->SetInputConnection(reader->GetOutputPort());\n  klower7Geom->SetExtent(17, 19, 9, 11, 6, 6);\n  vtkNew<vtkPolyDataMapper> mapKlower7;\n  mapKlower7->SetInputConnection(klower7Geom->GetOutputPort());\n  mapKlower7->ScalarVisibilityOff();\n  vtkNew<vtkActor> klower7;\n  klower7->SetMapper(mapKlower7);\n  klower7->GetProperty()->SetColor(colors->GetColor3d(\"EggShell\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> hood1Geom;\n  hood1Geom->SetInputConnection(reader->GetOutputPort());\n  hood1Geom->SetExtent(17, 17, 0, 11, 11, 16);\n  vtkNew<vtkPolyDataMapper> mapHood1;\n  mapHood1->SetInputConnection(hood1Geom->GetOutputPort());\n  mapHood1->ScalarVisibilityOff();\n  vtkNew<vtkActor> hood1;\n  hood1->SetMapper(mapHood1);\n  hood1->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> hood2Geom;\n  hood2Geom->SetInputConnection(reader->GetOutputPort());\n  hood2Geom->SetExtent(19, 19, 0, 11, 11, 16);\n  vtkNew<vtkPolyDataMapper> mapHood2;\n  mapHood2->SetInputConnection(hood2Geom->GetOutputPort());\n  mapHood2->ScalarVisibilityOff();\n  vtkNew<vtkActor> hood2;\n  hood2->SetMapper(mapHood2);\n  hood2->GetProperty()->SetColor(colors->GetColor3d(\"Furniture\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> hood3Geom;\n  hood3Geom->SetInputConnection(reader->GetOutputPort());\n  hood3Geom->SetExtent(17, 19, 0, 0, 11, 16);\n  vtkNew<vtkPolyDataMapper> mapHood3;\n  mapHood3->SetInputConnection(hood3Geom->GetOutputPort());\n  mapHood3->ScalarVisibilityOff();\n  vtkNew<vtkActor> hood3;\n  hood3->SetMapper(mapHood3);\n  hood3->GetProperty()->SetColor(colors->GetColor3d(\"Furniture\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> hood4Geom;\n  hood4Geom->SetInputConnection(reader->GetOutputPort());\n  hood4Geom->SetExtent(17, 19, 11, 11, 11, 16);\n  vtkNew<vtkPolyDataMapper> mapHood4;\n  mapHood4->SetInputConnection(hood4Geom->GetOutputPort());\n  mapHood4->ScalarVisibilityOff();\n  vtkNew<vtkActor> hood4;\n  hood4->SetMapper(mapHood4);\n  hood4->GetProperty()->SetColor(colors->GetColor3d(\"Furniture\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> hood6Geom;\n  hood6Geom->SetInputConnection(reader->GetOutputPort());\n  hood6Geom->SetExtent(17, 19, 0, 11, 16, 16);\n  vtkNew<vtkPolyDataMapper> mapHood6;\n  mapHood6->SetInputConnection(hood6Geom->GetOutputPort());\n  mapHood6->ScalarVisibilityOff();\n  vtkNew<vtkActor> hood6;\n  hood6->SetMapper(mapHood6);\n  hood6->GetProperty()->SetColor(colors->GetColor3d(\"Furniture\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> cookingPlateGeom;\n  cookingPlateGeom->SetInputConnection(reader->GetOutputPort());\n  cookingPlateGeom->SetExtent(17, 19, 7, 9, 6, 6);\n  vtkNew<vtkPolyDataMapper> mapCookingPlate;\n  mapCookingPlate->SetInputConnection(cookingPlateGeom->GetOutputPort());\n  mapCookingPlate->ScalarVisibilityOff();\n  vtkNew<vtkActor> cookingPlate;\n  cookingPlate->SetMapper(mapCookingPlate);\n  cookingPlate->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> filterGeom;\n  filterGeom->SetInputConnection(reader->GetOutputPort());\n  filterGeom->SetExtent(17, 19, 7, 9, 11, 11);\n  vtkNew<vtkPolyDataMapper> mapFilter;\n  mapFilter->SetInputConnection(filterGeom->GetOutputPort());\n  mapFilter->ScalarVisibilityOff();\n  vtkNew<vtkActor> filter;\n  filter->SetMapper(mapFilter);\n  filter->GetProperty()->SetColor(colors->GetColor3d(\"Furniture\").GetData());\n  //\n  // Regular streamlines.\n  //\n  vtkNew<vtkLineSource> line;\n  line->SetResolution(39);\n  line->SetPoint1(0.08, 2.50, 0.71);\n  line->SetPoint2(0.08, 4.50, 0.71);\n  vtkNew<vtkPolyDataMapper> rakeMapper;\n  rakeMapper->SetInputConnection(line->GetOutputPort());\n  vtkNew<vtkActor> rake;\n  rake->SetMapper(rakeMapper);\n\n  vtkNew<vtkStreamTracer> streamers;\n  // streamers->DebugOn();\n  streamers->SetInputConnection(reader->GetOutputPort());\n  streamers->SetSourceConnection(line->GetOutputPort());\n  streamers->SetMaximumPropagation(maxTime);\n  streamers->SetInitialIntegrationStep(.5);\n  streamers->SetMinimumIntegrationStep(.1);\n  streamers->SetIntegratorType(2);\n  streamers->Update();\n\n  vtkNew<vtkPolyDataMapper> streamersMapper;\n  streamersMapper->SetInputConnection(streamers->GetOutputPort());\n  streamersMapper->SetScalarRange(range);\n\n  vtkNew<vtkActor> lines;\n  lines->SetMapper(streamersMapper);\n  lines->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  aren->TwoSidedLightingOn();\n\n  aren->AddActor(outline);\n  aren->AddActor(door);\n  aren->AddActor(window1);\n  aren->AddActor(window2);\n  aren->AddActor(klower1);\n  aren->AddActor(klower2);\n  aren->AddActor(klower3);\n  aren->AddActor(klower4);\n  aren->AddActor(klower5);\n  aren->AddActor(klower6);\n  aren->AddActor(klower7);\n  aren->AddActor(hood1);\n  aren->AddActor(hood2);\n  aren->AddActor(hood3);\n  aren->AddActor(hood4);\n  aren->AddActor(hood6);\n  aren->AddActor(cookingPlate);\n  aren->AddActor(filter);\n  aren->AddActor(lines);\n  aren->AddActor(rake);\n\n  aren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkCamera> aCamera;\n  aren->SetActiveCamera(aCamera);\n  aren->ResetCamera();\n\n  aCamera->SetFocalPoint(3.505, 2.505, 1.255);\n  aCamera->SetPosition(3.505, 24.6196, 1.255);\n  aCamera->SetViewUp(0, 0, 1);\n  aCamera->Azimuth(60);\n  aCamera->Elevation(30);\n  aCamera->Dolly(1.4);\n  aren->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 512);\n  renWin->Render();\n  renWin->SetWindowName(\"Kitchen\");\n\n  // Interact with the data.\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Kitchen/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Kitchen)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Kitchen: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Kitchen MACOSX_BUNDLE Kitchen.cxx )\n  target_link_libraries(Kitchen PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Kitchen\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Kitchen/#download-and-build-kitchen","title":"Download and Build Kitchen","text":"

        Click here to download Kitchen and its CMakeLists.txt file. Once the tarball Kitchen.tar has been downloaded and extracted,

        cd Kitchen/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Kitchen\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/KochSnowflake/","title":"KochSnowflake","text":"

        vtk-examples/Cxx/Visualization/KochSnowflake

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/KochSnowflake/#description","title":"Description","text":"

        This demo uses recursion to represent a Koch snowflake fractal. For more information about this fractal, there are many resources on the web: http://en.wikipedia.org/wiki/Koch_snowflake, http://mathworld.wolfram.com/KochSnowflake.html.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/KochSnowflake/#code","title":"Code","text":"

        KochSnowflake.cxx

        #include <vtkActor.h>\n#include <vtkCellData.h>\n#include <vtkIntArray.h>\n#include <vtkLookupTable.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyLine.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTriangle.h>\n\nnamespace {\n\nconstexpr int LEVEL = 6;\n\n/*----------------------------------------------------------------------------*\n *                       Koch Snowflake as vtkPolyLine                        *\n *----------------------------------------------------------------------------*/\nvtkSmartPointer<vtkPolyData> AsPolyLine(vtkSmartPointer<vtkPoints> points,\n                                        int level);\n\n/*----------------------------------------------------------------------------*\n *                Koch Snowflake as collection of vtkTriangles                *\n *----------------------------------------------------------------------------*/\nvoid AsTriangles(int start, int end, vtkCellArray* cells, int level,\n                 vtkIntArray* data);\n\n} // namespace\n\n/*----------------------------------------------------------------------------*\n *                                Main Method                                 *\n *----------------------------------------------------------------------------*/\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Initially, set up the points to be an equilateral triangle. Note that the\n  // first point is the same as the last point to make this a closed curve when\n  // I create the vtkPolyLine.\n  vtkNew<vtkPoints> points;\n  for (int i = 0; i < 4; i++)\n  {\n    points->InsertNextPoint(cos(2. * vtkMath::Pi() * i / 3),\n                            sin(2 * vtkMath::Pi() * i / 3.), 0.);\n  }\n\n  auto outline_pd = AsPolyLine(points, LEVEL);\n  // You have already gone through the trouble of putting the points in the\n  // right places - so \"all\" you need to do now is to create polygons from the\n  // points that are in the vtkPoints.\n\n  // The points that are passed in, have an overlap of the beginning and the\n  // end.\n\n  // Set this up for each of the initial sides, then call the recursive\n  // function.\n  vtkNew<vtkCellArray> triangles;\n  int stride = outline_pd->GetPoints()->GetNumberOfPoints() / 3;\n\n  // The cell data will allow us to color the triangles based on the level of\n  // the iteration of the Koch snowflake.\n  vtkNew<vtkIntArray> data;\n  data->SetNumberOfComponents(0);\n  data->SetName(\"Iteration Level\");\n\n  // This is the starting triangle.\n  vtkNew<vtkTriangle> t;\n  t->GetPointIds()->SetId(0, 0);\n  t->GetPointIds()->SetId(1, stride);\n  t->GetPointIds()->SetId(2, 2 * stride);\n  triangles->InsertNextCell(t);\n  data->InsertNextValue(0);\n\n  AsTriangles(0, stride, triangles, 1, data);\n  AsTriangles(stride, 2 * stride, triangles, 1, data);\n  AsTriangles(2 * stride, 3 * stride, triangles, 1, data);\n\n  vtkNew<vtkPolyData> triangle_pd;\n  triangle_pd->SetPoints(outline_pd->GetPoints());\n  triangle_pd->SetPolys(triangles);\n  triangle_pd->GetCellData()->SetScalars(data);\n\n  //-----------------//\n  // rendering stuff //\n  //-----------------//\n  vtkNew<vtkPolyDataMapper> outline_mapper;\n  outline_mapper->SetInputData(outline_pd);\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(256);\n  lut->SetHueRange(0.6, 0.6);\n  lut->SetSaturationRange(0., 1.);\n  lut->Build();\n\n  vtkNew<vtkPolyDataMapper> triangle_mapper;\n  triangle_mapper->SetInputData(triangle_pd);\n  triangle_mapper->SetScalarRange(0.0, LEVEL);\n  triangle_mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> outline_actor;\n  outline_actor->SetMapper(outline_mapper);\n\n  vtkNew<vtkActor> triangle_actor;\n  triangle_actor->SetMapper(triangle_mapper);\n\n  vtkNew<vtkRenderer> outline_ren;\n  outline_ren->AddActor(outline_actor);\n  outline_ren->SetViewport(0.0, 0.0, 0.5, 1.0);\n  outline_ren->SetBackground(colors->GetColor3d(\"CornFlowerBLue\").GetData());\n\n  vtkNew<vtkRenderer> triangle_ren;\n  triangle_ren->AddActor(triangle_actor);\n  triangle_ren->SetViewport(0.5, 0.0, 1.0, 1.0);\n  triangle_ren->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n  triangle_ren->SetActiveCamera(outline_ren->GetActiveCamera());\n\n  vtkNew<vtkRenderWindow> renw;\n  renw->SetMultiSamples(0);\n  renw->AddRenderer(outline_ren);\n  renw->AddRenderer(triangle_ren);\n  renw->SetSize(800, 400);\n  renw->SetWindowName(\"KochSnowflake\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renw);\n\n  outline_ren->ResetCamera();\n  renw->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkPolyData> AsPolyLine(vtkSmartPointer<vtkPoints> points,\n                                        int level)\n{\n  // Use the points from the previous iteration to create the points of the\n  // next level. There is an assumption on my part that the curve is traversed\n  // in a counterclockwise fashion. If the initial triangle above is written to\n  // describe clockwise motion, the points will face inward instead of outward.\n  for (int i = 0; i < level; i++)\n  {\n    // We're going to make the next set of points from the old one and swap\n    // them at the end. The vtkSmartPointer will go out of scope and be\n    // deleted.\n    vtkNew<vtkPoints> temp;\n    double v0[3];\n    double v1[3];\n\n    // The first point of the previous vtkPoints is the first point of the next\n    // vtkPoints.\n    points->GetPoint(0, v0);\n    temp->InsertNextPoint(v0);\n\n    // Iterate over \"edges\" in the vtkPoints\n    for (int ii = 1; ii < points->GetNumberOfPoints(); ii++)\n    {\n      points->GetPoint(ii - 1, v0);\n      points->GetPoint(ii, v1);\n      double t = sqrt(vtkMath::Distance2BetweenPoints(v0, v1));\n      double nx = (v1[0] - v0[0]) / t; // x-component of edge unit tangent\n      double ny = (v1[1] - v0[1]) / t; // y-component of edge unit tangent\n\n      v1[0] = v0[0] + nx * t / 3.;\n      v1[1] = v0[1] + ny * t / 3.;\n      v1[2] = 0.;\n      temp->InsertNextPoint(v1);\n\n      v1[0] = v0[0] + t * (nx / 2. + ny * sqrt(3.) / 6.);\n      v1[1] = v0[1] + t * (ny / 2. - nx * sqrt(3.) / 6.);\n      v1[2] = 0.;\n      temp->InsertNextPoint(v1);\n\n      v1[0] = v0[0] + 2. / 3. * nx * t;\n      v1[1] = v0[1] + 2. / 3. * ny * t;\n      v1[2] = 0.;\n      temp->InsertNextPoint(v1);\n\n      v1[0] = v0[0] + nx * t;\n      v1[1] = v0[1] + ny * t;\n      v1[2] = 0.;\n      temp->InsertNextPoint(v1);\n    }\n    points = temp;\n  }\n\n  // draw the outline\n  vtkNew<vtkCellArray> lines;\n  vtkNew<vtkPolyLine> pl;\n  pl->GetPointIds()->SetNumberOfIds(points->GetNumberOfPoints());\n  for (int i = 0; i < points->GetNumberOfPoints(); i++)\n  {\n    pl->GetPointIds()->SetId(i, i);\n  }\n  lines->InsertNextCell(pl);\n\n  // Complete the polydata.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetLines(lines);\n  polydata->SetPoints(points);\n\n  return polydata;\n}\n\nvoid AsTriangles(int start, int end, vtkCellArray* cells, int level,\n                 vtkIntArray* data)\n{\n  if (end - start >= 3)\n  {\n    int stride = (end - start + 1) / 4;\n\n    vtkNew<vtkTriangle> triangle;\n    triangle->GetPointIds()->SetId(0, start + stride);\n    triangle->GetPointIds()->SetId(1, start + 2 * stride);\n    triangle->GetPointIds()->SetId(2, start + 3 * stride);\n\n    cells->InsertNextCell(triangle);\n    data->InsertNextValue(level);\n\n    AsTriangles(start, start + stride, cells, level + 1, data);\n    AsTriangles(start + stride, start + 2 * stride, cells, level + 1, data);\n    AsTriangles(start + 2 * stride, start + 3 * stride, cells, level + 1, data);\n    AsTriangles(start + 3 * stride, start + 4 * stride, cells, level + 1, data);\n  }\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/KochSnowflake/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(KochSnowflake)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"KochSnowflake: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(KochSnowflake MACOSX_BUNDLE KochSnowflake.cxx )\n  target_link_libraries(KochSnowflake PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS KochSnowflake\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/KochSnowflake/#download-and-build-kochsnowflake","title":"Download and Build KochSnowflake","text":"

        Click here to download KochSnowflake and its CMakeLists.txt file. Once the tarball KochSnowflake.tar has been downloaded and extracted,

        cd KochSnowflake/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./KochSnowflake\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/LODProp3D/","title":"LODProp3D","text":"

        vtk-examples/Cxx/Visualization/LODProp3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/LODProp3D/#description","title":"Description","text":"

        If you have a fast graphics card, you may not see a difference.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/LODProp3D/#code","title":"Code","text":"

        LODProp3D.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkLODProp3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nvoid RefreshCallback(vtkObject* vtkNotUsed(caller),\n                     long unsigned int vtkNotUsed(eventId), void* clientData,\n                     void* vtkNotUsed(callData));\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // High res sphere.\n  vtkNew<vtkSphereSource> highResSphereSource;\n  int res = 100;\n  highResSphereSource->SetThetaResolution(res);\n  highResSphereSource->SetPhiResolution(res);\n  highResSphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> highResMapper;\n  highResMapper->SetInputConnection(highResSphereSource->GetOutputPort());\n\n  // Low res sphere.\n  vtkNew<vtkSphereSource> lowResSphereSource;\n\n  vtkNew<vtkPolyDataMapper> lowResMapper;\n  lowResMapper->SetInputConnection(lowResSphereSource->GetOutputPort());\n\n  vtkNew<vtkProperty> propertyLowRes;\n  propertyLowRes->SetDiffuseColor(\n      colors->GetColor3d(\"BlanchedAlmond\").GetData());\n  propertyLowRes->SetInterpolationToFlat();\n\n  vtkNew<vtkProperty> propertyHighRes;\n  propertyHighRes->SetDiffuseColor(colors->GetColor3d(\"MistyRose\").GetData());\n  propertyHighRes->SetInterpolationToFlat();\n\n  vtkNew<vtkLODProp3D> prop;\n  prop->AddLOD(lowResMapper, propertyLowRes, 0.0);\n  prop->AddLOD(highResMapper, propertyHighRes, 0.0);\n\n  std::cout << \"There are \" << prop->GetNumberOfLODs() << \" LODs\" << std::endl;\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LODProp3D\");\n\n  // prop->SetAllocatedRenderTime(1e-6,renderer);\n  prop->SetAllocatedRenderTime(1e-12, renderer);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(prop);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkCallbackCommand> refreshCallback;\n  refreshCallback->SetCallback(RefreshCallback);\n  refreshCallback->SetClientData(prop);\n\n  renderWindow->AddObserver(vtkCommand::ModifiedEvent, refreshCallback);\n\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid RefreshCallback(vtkObject* vtkNotUsed(caller),\n                     long unsigned int vtkNotUsed(eventId), void* clientData,\n                     void* vtkNotUsed(callData))\n{\n  auto lodProp = static_cast<vtkLODProp3D*>(clientData);\n  std::cout << \"Last rendered LOD ID: \" << lodProp->GetLastRenderedLODID()\n            << std::endl;\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/LODProp3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LODProp3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LODProp3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LODProp3D MACOSX_BUNDLE LODProp3D.cxx )\n  target_link_libraries(LODProp3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LODProp3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/LODProp3D/#download-and-build-lodprop3d","title":"Download and Build LODProp3D","text":"

        Click here to download LODProp3D and its CMakeLists.txt file. Once the tarball LODProp3D.tar has been downloaded and extracted,

        cd LODProp3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LODProp3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/LabelContours/","title":"LabelContours","text":"

        vtk-examples/Cxx/Visualization/LabelContours

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/LabelContours/#description","title":"Description","text":"

        This example labels isolines created by vtkContourFilter. After the isolines are generated, the resulting disconnected lines segments are gathered into polylines by vtkStripper. Then an appropriate position along each line is chosen to place the label for the contour. Two strategies for label placement are illustrated: a point at the midpoint of the line or a random point. vtkLabeledDataMapper places the labels for the contour lines.

        The program can be run with an input XML polydata file (.vtp) or without arguments. If a file is specified then one, two or a range of contours can be specified. If run without a file name, the example generates a random scalar field on a plane.

        Note

        The labels are represented as vtkActor2D's. If they are generated for a 3D surface, the labels that should be hidden will still be displayed.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/LabelContours/#code","title":"Code","text":"

        LabelContours.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCellArray.h>\n#include <vtkContourFilter.h>\n#include <vtkDataArray.h>\n#include <vtkDoubleArray.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStripper.h>\n#include <vtkTextProperty.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iomanip>\n#include <iostream>\n\n#ifdef VTK_CELL_ARRAY_V2\n#include <vtkCellArrayIterator.h>\n#endif // VTK_CELL_ARRAY_V2\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int pointThreshold = 10;\n\n  vtkSmartPointer<vtkPolyData> polyData;\n  vtkNew<vtkContourFilter> contours;\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(1);\n\n  // If a file is present, read it, otherwise generate some random\n  // scalars on a plane.\n  if (argc > 1)\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(argv[1]);\n    reader->Update();\n\n    double range[2];\n    reader->GetOutput()->GetScalarRange(range);\n    polyData = reader->GetOutput();\n\n    std::cout << \"range: \" << range[0] << \", \" << range[1] << std::endl;\n    contours->SetValue(0, (range[1] + range[0]) / 2.0);\n\n    contours->SetInputConnection(reader->GetOutputPort());\n    if (argc == 3)\n    {\n      contours->SetValue(0, atof(argv[2]));\n    }\n    else if (argc == 4)\n    {\n      contours->SetValue(0, atof(argv[2]));\n      contours->SetValue(1, atof(argv[3]));\n    }\n    else if (argc == 5)\n    {\n      contours->GenerateValues(atoi(argv[2]), atof(argv[3]), atof(argv[4]));\n    }\n  }\n  else\n  {\n    vtkNew<vtkPlaneSource> plane;\n    plane->SetXResolution(10);\n    plane->SetYResolution(10);\n    plane->Update();\n\n    vtkNew<vtkDoubleArray> randomScalars;\n    randomScalars->SetNumberOfComponents(1);\n    randomScalars->SetName(\"Isovalues\");\n    for (int i = 0; i < plane->GetOutput()->GetNumberOfPoints(); i++)\n    {\n      randomScalars->InsertNextTuple1(\n          randomSequence->GetRangeValue(-100.0, 100.0));\n      randomSequence->Next();\n    }\n    plane->GetOutput()->GetPointData()->SetScalars(randomScalars);\n    polyData = plane->GetOutput();\n    contours->SetInputConnection(plane->GetOutputPort());\n    contours->GenerateValues(5, -100, 100);\n    pointThreshold = 0;\n  }\n\n  // Connect the segments of the contours into polylines.\n  vtkNew<vtkStripper> contourStripper;\n  contourStripper->SetInputConnection(contours->GetOutputPort());\n  contourStripper->Update();\n\n  auto numberOfContourLines = contourStripper->GetOutput()->GetNumberOfLines();\n\n  std::cout << \"There are \" << numberOfContourLines << \" contour lines.\"\n            << std::endl;\n\n  vtkPoints* points = contourStripper->GetOutput()->GetPoints();\n  vtkCellArray* cells = contourStripper->GetOutput()->GetLines();\n  vtkDataArray* scalars =\n      contourStripper->GetOutput()->GetPointData()->GetScalars();\n\n  // Create a polydata that contains point locations for the contour\n  // line labels.\n  vtkNew<vtkPolyData> labelPolyData;\n  vtkNew<vtkPoints> labelPoints;\n  vtkNew<vtkDoubleArray> labelScalars;\n  labelScalars->SetNumberOfComponents(1);\n  labelScalars->SetName(\"Isovalues\");\n\n#ifdef VTK_CELL_ARRAY_V2\n\n  // Newer versions of vtkCellArray prefer local iterators:\n  auto cellIter = vtk::TakeSmartPointer(cells->NewIterator());\n  for (cellIter->GoToFirstCell(); !cellIter->IsDoneWithTraversal();\n       cellIter->GoToNextCell())\n  {\n    vtkIdList* cell = cellIter->GetCurrentCell();\n    if (cell->GetNumberOfIds() < pointThreshold)\n    {\n      continue;\n    }\n    std::cout << \"Line \" << cellIter->GetCurrentCellId() << \": \" << std::endl;\n\n    // Compute the point id to hold the label.\n    // Mid point or a random point.\n    // const vtkIdType samplePtIdx = cell->GetNumberOfIds() / 2;\n    const vtkIdType samplePtIdx = static_cast<vtkIdType>(\n        randomSequence->GetRangeValue(0, cell->GetNumberOfIds()));\n    randomSequence->Next();\n\n    auto midPointId = cell->GetId(samplePtIdx);\n\n    double midPoint[3];\n    points->GetPoint(midPointId, midPoint);\n    std::cout << \"\\tmidPoint is \" << midPointId << \" with coordinate \"\n              << \"(\" << std::fixed << std::setprecision(2) << midPoint[0]\n              << \", \" << midPoint[1] << \", \" << midPoint[2] << \")\"\n              << \" and value \" << scalars->GetTuple1(midPointId) << std::endl;\n    labelPoints->InsertNextPoint(midPoint);\n    labelScalars->InsertNextTuple1(scalars->GetTuple1(midPointId));\n  }\n\n#else // VTK_CELL_ARRAY_V2\n\n  // Older implementations of vtkCellArray use internal iterator APIs (not\n  // thread safe):\n  vtkIdType* indices;\n  vtkIdType numberOfPoints;\n  unsigned int lineCount = 0;\n  for (cells->InitTraversal(); cells->GetNextCell(numberOfPoints, indices);\n       lineCount++)\n  {\n    if (numberOfPoints < pointThreshold)\n    {\n      continue;\n    }\n    std::cout << \"Line \" << lineCount << \": \" << std::endl;\n\n    // Compute the point id to hold the label.\n    // Mid point or a random point.\n    // auto midPointId = indices[numberOfPoints / 2];\n    // auto midPointId =\n    //    indices[static_cast<vtkIdType>(vtkMath::Random(0, numberOfPoints))];\n    const vtkIdType samplePtIdx = static_cast<vtkIdType>(\n        randomSequence->GetRangeValue(0, cell->GetNumberOfIds()));\n    randomSequence->Next();\n\n    double midPoint[3];\n    points->GetPoint(midPointId, midPoint);\n    std::cout << \"\\tmidPoint is \" << midPointId << \" with coordinate \"\n              << \"(\" << std::fixed << std::setprecision(2) << midPoint[0]\n              << \", \" << midPoint[1] << \", \" << midPoint[2] << \")\"\n              << \" and value \" << scalars->GetTuple1(midPointId) << std::endl;\n    labelPoints->InsertNextPoint(midPoint);\n    labelScalars->InsertNextTuple1(scalars->GetTuple1(midPointId));\n  }\n\n#endif // VTK_CELL_ARRAY_V2\n\n  labelPolyData->SetPoints(labelPoints);\n  labelPolyData->GetPointData()->SetScalars(labelScalars);\n\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contourStripper->GetOutputPort());\n  contourMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isolines;\n  isolines->SetMapper(contourMapper);\n  isolines->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  isolines->GetProperty()->SetLineWidth(2);\n\n  vtkNew<vtkLookupTable> surfaceLUT;\n  surfaceLUT->SetRange(polyData->GetPointData()->GetScalars()->GetRange());\n  surfaceLUT->Build();\n\n  vtkNew<vtkPolyDataMapper> surfaceMapper;\n  surfaceMapper->SetInputData(polyData);\n  surfaceMapper->ScalarVisibilityOn();\n  surfaceMapper->SetScalarRange(\n      polyData->GetPointData()->GetScalars()->GetRange());\n  surfaceMapper->SetLookupTable(surfaceLUT);\n\n  vtkNew<vtkActor> surface;\n  surface->SetMapper(surfaceMapper);\n\n  // The labeled data mapper will place labels at the points.\n  vtkNew<vtkLabeledDataMapper> labelMapper;\n  labelMapper->SetFieldDataName(\"Isovalues\");\n  labelMapper->SetInputData(labelPolyData);\n  labelMapper->SetLabelModeToLabelScalars();\n  labelMapper->SetLabelFormat(\"%6.2f\");\n  labelMapper->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkActor2D> isolabels;\n  isolabels->SetMapper(labelMapper);\n\n  // Create a renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(600, 600);\n  renderWindow->SetWindowName(\"LabelContours\");\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(surface);\n  renderer->AddActor(isolines);\n  renderer->AddActor(isolabels);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render the scene (lights and cameras are created automatically).\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/LabelContours/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LabelContours)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LabelContours: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LabelContours MACOSX_BUNDLE LabelContours.cxx )\n  target_link_libraries(LabelContours PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LabelContours\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/LabelContours/#download-and-build-labelcontours","title":"Download and Build LabelContours","text":"

        Click here to download LabelContours and its CMakeLists.txt file. Once the tarball LabelContours.tar has been downloaded and extracted,

        cd LabelContours/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LabelContours\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/LabelPlacementMapper/","title":"LabelPlacementMapper","text":"

        vtk-examples/Cxx/Visualization/LabelPlacementMapper

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/LabelPlacementMapper/#description","title":"Description","text":"

        This example demonstrates how to add labels from an array to points. Each point is given a priority that determines which labels are visible when space is limited.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/LabelPlacementMapper/#code","title":"Code","text":"

        LabelPlacementMapper.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkIntArray.h>\n#include <vtkLabelPlacementMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPointSetToLabelHierarchy.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkStringArray.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph.\n * @param scale - The scale, used to determine the size of the glyph.\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05.\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a point set.\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(6);\n  pointSource->Update();\n\n  // Add label array.\n  vtkNew<vtkStringArray> labels;\n  labels->SetNumberOfValues(6);\n  labels->SetName(\"labels\");\n  labels->SetValue(0, \"Priority 10\");\n  labels->SetValue(1, \"Priority 7\");\n  labels->SetValue(2, \"Priority 6\");\n  labels->SetValue(3, \"Priority 4\");\n  labels->SetValue(4, \"Priority 4\");\n  labels->SetValue(5, \"Priority 4\");\n  pointSource->GetOutput()->GetPointData()->AddArray(labels);\n\n  // Add priority array.\n  vtkNew<vtkIntArray> sizes;\n  sizes->SetNumberOfValues(6);\n  sizes->SetName(\"sizes\");\n  sizes->SetValue(0, 10);\n  sizes->SetValue(1, 7);\n  sizes->SetValue(2, 6);\n  sizes->SetValue(3, 4);\n  sizes->SetValue(4, 4);\n  sizes->SetValue(5, 4);\n  pointSource->GetOutput()->GetPointData()->AddArray(sizes);\n\n  // Create a mapper and actor for the points.\n  vtkNew<vtkPolyDataMapper> pointMapper;\n  pointMapper->SetInputConnection(pointSource->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n\n  // Map the points to spheres\n  auto sphereActor = PointToGlyph(pointSource->GetOutput()->GetPoints(), 0.05);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Generate the label hierarchy.\n  vtkNew<vtkPointSetToLabelHierarchy> pointSetToLabelHierarchyFilter;\n  pointSetToLabelHierarchyFilter->SetInputConnection(\n      pointSource->GetOutputPort());\n  pointSetToLabelHierarchyFilter->SetLabelArrayName(\"labels\");\n  pointSetToLabelHierarchyFilter->SetPriorityArrayName(\"sizes\");\n  pointSetToLabelHierarchyFilter->Update();\n\n  // Create a mapper and actor for the labels.\n  vtkNew<vtkLabelPlacementMapper> labelMapper;\n  labelMapper->SetInputConnection(\n      pointSetToLabelHierarchyFilter->GetOutputPort());\n  vtkNew<vtkActor2D> labelActor;\n  labelActor->SetMapper(labelMapper);\n  // labelActor->GetProperty()->SetColor(\n  //    colors->GetColor3d(\"Yellow\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LabelPlacementMapper\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(pointActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(labelActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/LabelPlacementMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LabelPlacementMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LabelPlacementMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LabelPlacementMapper MACOSX_BUNDLE LabelPlacementMapper.cxx )\n  target_link_libraries(LabelPlacementMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LabelPlacementMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/LabelPlacementMapper/#download-and-build-labelplacementmapper","title":"Download and Build LabelPlacementMapper","text":"

        Click here to download LabelPlacementMapper and its CMakeLists.txt file. Once the tarball LabelPlacementMapper.tar has been downloaded and extracted,

        cd LabelPlacementMapper/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LabelPlacementMapper\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/LabeledDataMapper/","title":"LabeledDataMapper","text":"

        vtk-examples/Cxx/Visualization/LabeledDataMapper

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/LabeledDataMapper/#description","title":"Description","text":"

        This example demonstrates how to display the point ID at each point.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/LabeledDataMapper/#code","title":"Code","text":"

        LabeledDataMapper.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkGlyph3DMapper.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n/**\n * Convert points to glyphs.\n *\n * @param points - The points to glyph.\n * @param scale - The scale, used to determine the size of the glyph.\n * representing the point, expressed as a fraction of the largest side of the\n * bounding box surrounding the points. e.g. 0.05.\n *\n * @return The actor.\n */\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n  // Create a point set\n  vtkNew<vtkPointSource> pointSource;\n  pointSource->SetNumberOfPoints(10);\n  pointSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> pointMapper;\n  pointMapper->SetInputConnection(pointSource->GetOutputPort());\n\n  vtkNew<vtkActor> pointActor;\n  pointActor->SetMapper(pointMapper);\n  pointActor->GetProperty()->SetPointSize(1);\n  pointActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Map the points to spheres.\n  auto sphereActor = PointToGlyph(pointSource->GetOutput()->GetPoints(), 0.02);\n  sphereActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkLabeledDataMapper> labelMapper;\n  labelMapper->SetInputConnection(pointSource->GetOutputPort());\n  labelMapper->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"Magenta\").GetData());\n\n  vtkNew<vtkActor2D> labelActor;\n  labelActor->SetMapper(labelMapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LabeledDataMapper\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  // renderer->AddActor(pointActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(labelActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkActor> PointToGlyph(vtkPoints* points, double const& scale)\n{\n  auto bounds = points->GetBounds();\n  double maxLen = 0;\n  for (int i = 1; i < 3; ++i)\n  {\n    maxLen = std::max(bounds[i + 1] - bounds[i], maxLen);\n  }\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(scale * maxLen);\n\n  vtkNew<vtkPolyData> pd;\n  pd->SetPoints(points);\n\n  vtkNew<vtkGlyph3DMapper> mapper;\n  mapper->SetInputData(pd);\n  mapper->SetSourceConnection(sphereSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  mapper->ScalingOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  return actor;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/LabeledDataMapper/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LabeledDataMapper)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LabeledDataMapper: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LabeledDataMapper MACOSX_BUNDLE LabeledDataMapper.cxx )\n  target_link_libraries(LabeledDataMapper PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LabeledDataMapper\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/LabeledDataMapper/#download-and-build-labeleddatamapper","title":"Download and Build LabeledDataMapper","text":"

        Click here to download LabeledDataMapper and its CMakeLists.txt file. Once the tarball LabeledDataMapper.tar has been downloaded and extracted,

        cd LabeledDataMapper/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LabeledDataMapper\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/LabeledMesh/","title":"LabeledMesh","text":"

        vtk-examples/Cxx/Visualization/LabeledMesh

        "},{"location":"Cxx/Visualization/LabeledMesh/#description","title":"Description","text":"

        This example was translated into C++ from its TCL counterpart by Jake Nickel from the University of Iowa. It demonstrates the use of vtkLabeledDataMapper. This class is used for displaying numerical data from an underlying data set. In the case of this example, the underlying data are the point and cell ids.

        Note

        This original source code for this example is here.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/LabeledMesh/#code","title":"Code","text":"

        LabeledMesh.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkCellArray.h>\n#include <vtkCellCenters.h>\n#include <vtkIdFilter.h>\n#include <vtkLabeledDataMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSelectVisiblePoints.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nnamespace {\nint xLength;\nint yLength;\ntypedef struct\n{\n  vtkSmartPointer<vtkSelectVisiblePoints> visPts;\n  vtkSmartPointer<vtkSelectVisiblePoints> visCells;\n  vtkSmartPointer<vtkPoints> pts;\n  vtkSmartPointer<vtkRenderWindow> renWin;\n} VTKData;\n\n// Create a procedure to draw the selection window at each location it\n// is moved to.\nvoid PlaceWindow(VTKData const& data, int xmin, int ymin);\n\n// Create a procedure to move the selection window across the data set.\nvoid MoveWindow(VTKData const& data);\n\n} // namespace\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a selection window.  We will display the point and cell ids that\n  // lie within this window.\n  int xmin = 200;\n  xLength = 100;\n  int xmax = xmin + xLength;\n  int ymin = 200;\n  yLength = 100;\n  int ymax = ymin + yLength;\n\n  vtkNew<vtkPoints> pts;\n  pts->InsertPoint(0, xmin, ymin, 0);\n  pts->InsertPoint(1, xmax, ymin, 0);\n  pts->InsertPoint(2, xmax, ymax, 0);\n  pts->InsertPoint(3, xmin, ymax, 0);\n\n  vtkNew<vtkCellArray> rect;\n  rect->InsertNextCell(5);\n  rect->InsertCellPoint(0);\n  rect->InsertCellPoint(1);\n  rect->InsertCellPoint(2);\n  rect->InsertCellPoint(3);\n  rect->InsertCellPoint(0);\n\n  vtkNew<vtkPolyData> selectRect;\n  selectRect->SetPoints(pts);\n  selectRect->SetLines(rect);\n\n  vtkNew<vtkPolyDataMapper2D> rectMapper;\n  rectMapper->SetInputData(selectRect);\n\n  vtkNew<vtkActor2D> rectActor;\n  rectActor->SetMapper(rectMapper);\n  rectActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create a sphere and its associated mapper and actor.\n  vtkNew<vtkSphereSource> sphere;\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BurlyWood\").GetData());\n\n  // Generate data arrays containing point and cell ids\n  vtkNew<vtkIdFilter> ids;\n  ids->SetInputConnection(sphere->GetOutputPort());\n  ids->PointIdsOn();\n  ids->CellIdsOn();\n  ids->FieldDataOn();\n\n  // Create the renderer here because vtkSelectVisiblePoints needs it.\n  vtkNew<vtkRenderer> ren1;\n  ren1->UseHiddenLineRemovalOn();\n\n  // Create labels for points\n  vtkNew<vtkSelectVisiblePoints> visPts;\n  visPts->SetInputConnection(ids->GetOutputPort());\n  visPts->SetRenderer(ren1);\n  visPts->SelectionWindowOn();\n  visPts->SetSelection(xmin, xmin + xLength, ymin, ymin + yLength);\n\n  // Create the mapper to display the point ids.  Specify the\n  // format to use for the labels.  Also create the associated actor.\n  vtkNew<vtkLabeledDataMapper> ldm;\n  ldm->SetInputConnection(visPts->GetOutputPort());\n  ldm->SetLabelModeToLabelFieldData();\n\n  vtkNew<vtkActor2D> pointLabels;\n  pointLabels->SetMapper(ldm);\n  pointLabels->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // Create labels for cells\n  vtkNew<vtkCellCenters> cc;\n  cc->SetInputConnection(ids->GetOutputPort());\n\n  vtkNew<vtkSelectVisiblePoints> visCells;\n  visCells->SetInputConnection(cc->GetOutputPort());\n  visCells->SetRenderer(ren1);\n  visCells->SelectionWindowOn();\n  visCells->SetSelection(xmin, xmin + xLength, ymin, ymin + yLength);\n\n  // Create the mapper to display the cell ids.  Specify the\n  // format to use for the labels.  Also create the associated actor.\n  vtkNew<vtkLabeledDataMapper> cellMapper;\n  cellMapper->SetInputConnection(visCells->GetOutputPort());\n  cellMapper->SetLabelModeToLabelFieldData();\n  cellMapper->GetLabelTextProperty()->SetColor(\n      colors->GetColor3d(\"DarkGreen\").GetData());\n\n  vtkNew<vtkActor2D> cellLabels;\n  cellLabels->SetMapper(cellMapper);\n\n  // Create the RenderWindow and RenderWindowInteractor\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer; set the background and size; render\n  ren1->AddActor(sphereActor);\n  ren1->AddActor2D(rectActor);\n  ren1->AddActor2D(pointLabels);\n  ren1->AddActor2D(cellLabels);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renWin->SetSize(500, 500);\n  renWin->SetWindowName(\"LabeledMesh\");\n\n  renWin->Render();\n\n  VTKData data = {visPts, visCells, pts, renWin};\n\n  // Move the selection window across the data set.\n  MoveWindow(data);\n\n  // Put the selection window in the center of the render window.\n  // This works because the xmin = ymin = 200, xLength = yLength = 100, and\n  // the render window size is 500 x 500.\n  PlaceWindow(data, xmin, ymin);\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid PlaceWindow(VTKData const& data, int xmin, int ymin)\n{\n  int xmax = xmin + xLength;\n  int ymax = ymin + yLength;\n\n  data.visPts->SetSelection(xmin, xmax, ymin, ymax);\n  data.visCells->SetSelection(xmin, xmax, ymin, ymax);\n\n  data.pts->InsertPoint(0, xmin, ymin, 0);\n  data.pts->InsertPoint(1, xmin, ymin, 0);\n  data.pts->InsertPoint(2, xmin, ymin, 0);\n  data.pts->InsertPoint(3, xmin, ymin, 0);\n\n  // Call Modified because InsertPoints does not modify vtkPoints\n  // (for performance reasons).\n  data.pts->Modified();\n\n  data.renWin->Render();\n}\n\nvoid MoveWindow(VTKData const& data)\n{\n  for (int y = 100; y < 300; y += 25)\n  {\n    for (int x = 100; x < 300; x += 25)\n    {\n      PlaceWindow(data, x, y);\n    }\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/LabeledMesh/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LabeledMesh)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLabel\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LabeledMesh: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LabeledMesh MACOSX_BUNDLE LabeledMesh.cxx )\n  target_link_libraries(LabeledMesh PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LabeledMesh\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/LabeledMesh/#download-and-build-labeledmesh","title":"Download and Build LabeledMesh","text":"

        Click here to download LabeledMesh and its CMakeLists.txt file. Once the tarball LabeledMesh.tar has been downloaded and extracted,

        cd LabeledMesh/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LabeledMesh\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Legend/","title":"Legend","text":"

        vtk-examples/Cxx/Visualization/Legend

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Legend/#code","title":"Code","text":"

        Legend.cxx

        #include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkLegendBoxActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5000.0);\n  sphereSource->Update();\n\n  vtkPolyData* polydata = sphereSource->GetOutput();\n\n  // Create a mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(polydata);\n\n  // Create an actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Legend\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkLegendBoxActor> legend;\n  legend->SetNumberOfEntries(2);\n\n  double color[4];\n\n  vtkNew<vtkCubeSource> legendBox;\n  legendBox->Update();\n  colors->GetColor(\"Tomato\", color);\n  legend->SetEntry(0, legendBox->GetOutput(), \"Box\", color);\n\n  colors->GetColor(\"Banana\", color);\n  legend->SetEntry(1, sphereSource->GetOutput(), \"Ball\", color);\n\n  // place legend in lower right\n  legend->GetPositionCoordinate()->SetCoordinateSystemToView();\n  legend->GetPositionCoordinate()->SetValue(0.5, -1.0);\n\n  legend->GetPosition2Coordinate()->SetCoordinateSystemToView();\n  legend->GetPosition2Coordinate()->SetValue(1.0, -0.5);\n\n  legend->UseBackgroundOn();\n  double background[4];\n  colors->GetColor(\"SlateGray\", background);\n  legend->SetBackgroundColor(background);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->AddActor(legend);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->Render();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Legend/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Legend)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Legend: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Legend MACOSX_BUNDLE Legend.cxx )\n  target_link_libraries(Legend PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Legend\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Legend/#download-and-build-legend","title":"Download and Build Legend","text":"

        Click here to download Legend and its CMakeLists.txt file. Once the tarball Legend.tar has been downloaded and extracted,

        cd Legend/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Legend\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/LegendScaleActor/","title":"LegendScaleActor","text":"

        vtk-examples/Cxx/Visualization/LegendScaleActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/LegendScaleActor/#code","title":"Code","text":"

        LegendScaleActor.cxx

        #include <vtkActor.h>\n#include <vtkLegendScaleActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricEnneper.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // The source will be a parametric function.\n  vtkNew<vtkParametricEnneper> src;\n  vtkNew<vtkParametricFunctionSource> fnSrc;\n  fnSrc->SetParametricFunction(src);\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(fnSrc->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LegendScaleActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkLegendScaleActor> legendScaleActor;\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor(legendScaleActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/LegendScaleActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LegendScaleActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LegendScaleActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LegendScaleActor MACOSX_BUNDLE LegendScaleActor.cxx )\n  target_link_libraries(LegendScaleActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LegendScaleActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/LegendScaleActor/#download-and-build-legendscaleactor","title":"Download and Build LegendScaleActor","text":"

        Click here to download LegendScaleActor and its CMakeLists.txt file. Once the tarball LegendScaleActor.tar has been downloaded and extracted,

        cd LegendScaleActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LegendScaleActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/LineWidth/","title":"LineWidth","text":"

        vtk-examples/Cxx/Visualization/LineWidth

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/LineWidth/#code","title":"Code","text":"

        LineWidth.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkLineSource> lineSource;\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(lineSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetLineWidth(5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LineWidth\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"ForestGreen\").GetData());\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Roll(45);\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/LineWidth/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LineWidth)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LineWidth: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LineWidth MACOSX_BUNDLE LineWidth.cxx )\n  target_link_libraries(LineWidth PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LineWidth\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/LineWidth/#download-and-build-linewidth","title":"Download and Build LineWidth","text":"

        Click here to download LineWidth and its CMakeLists.txt file. Once the tarball LineWidth.tar has been downloaded and extracted,

        cd LineWidth/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LineWidth\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/LoopShrink/","title":"LoopShrink","text":"

        vtk-examples/Cxx/Visualization/LoopShrink

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/LoopShrink/#description","title":"Description","text":"

        A network with a loop. VTK 5.0 and later do not allow you to execute a looping visualization network; this was possible in previous versions of VTK.

        Info

        See Figure 4-22 in Chapter 4 the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/LoopShrink/#code","title":"Code","text":"

        LoopShrink.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCullerCollection.h>\n#include <vtkDataSetMapper.h>\n#include <vtkElevationFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->GetCullers()->RemoveAllItems();\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(12);\n  sphere->SetPhiResolution(12);\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(sphere->GetOutputPort());\n  shrink->SetShrinkFactor(0.9);\n\n  vtkNew<vtkElevationFilter> colorIt;\n  colorIt->SetInputConnection(shrink->GetOutputPort());\n  colorIt->SetLowPoint(0, 0, -.5);\n  colorIt->SetHighPoint(0, 0, .5);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(colorIt->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"LavenderBlush\").GetData());\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"LoopShrink\");\n\n  renWin->Render();\n\n  renderer->GetActiveCamera()->Zoom(1.5);\n\n  // Interact with the data.\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/LoopShrink/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LoopShrink)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LoopShrink: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LoopShrink MACOSX_BUNDLE LoopShrink.cxx )\n  target_link_libraries(LoopShrink PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LoopShrink\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/LoopShrink/#download-and-build-loopshrink","title":"Download and Build LoopShrink","text":"

        Click here to download LoopShrink and its CMakeLists.txt file. Once the tarball LoopShrink.tar has been downloaded and extracted,

        cd LoopShrink/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LoopShrink\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Lorenz/","title":"Lorenz","text":"

        vtk-examples/Cxx/Visualization/Lorenz

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/Lorenz/#description","title":"Description","text":"

        This example visualizes a Lorenz strange attractor by integrating the Lorenz equations in a volume. The number of visits in each voxel is recorded as a scalar function. The surface is extracted via vtkMarchingCubes using a visit value of 50. The number of integration steps is 10 million, in a volume of dimensions 200^3. The surface roughness is caused by the discrete nature of the evaluation function.

        Info

        See Figure 6-25 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Lorenz/#code","title":"Code","text":"

        Lorenz.cxx

        //\n/*\n * Create an iso-surface of the Lorenz attractor.\n *\n * Here we visualize a Lorenz strange attractor by integrating the Lorenz\n * equations in a volume. The number of visits in each voxel is recorded as a\n * scalar function. The surface is extracted via marching cubes using a visit\n * value of 50. The number of integration steps is 10 million, in a volume of\n * dimensions 200 x 200 * x 200. The surface roughness is caused by the discrete\n * nature of the evaluation function.\n */\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkMinimalStandardRandomSequence.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShortArray.h>\n#include <vtkStructuredPoints.h>\n\nint main(int, char*[])\n{\n  double Pr = 10.0; // The Lorenz parameters.\n  double b = 2.667;\n  double r = 28.0;\n  double x, y, z;       // starting (and current) x, y, z\n  double h = 0.01;      // integration step size\n  int resolution = 200; // slice resolution\n  int iter = 10000000;  // number of iterations\n  double xmin = -30.0;  // x, y, z range for voxels\n  double xmax = 30.0;\n  double ymin = -30.0;\n  double ymax = 30.0;\n  double zmin = -10.0;\n  double zmax = 60.0;\n\n  void options(int, char**);\n\n  // Take a stab at an integration step size.\n  auto xIncr = resolution / (xmax - xmin);\n  auto yIncr = resolution / (ymax - ymin);\n  auto zIncr = resolution / (zmax - zmin);\n\n  printf(\"The Lorenz Attractor\\n\");\n  printf(\"  Pr = %f\\n\", Pr);\n  printf(\"  b = %f\\n\", b);\n  printf(\"  r = %f\\n\", r);\n  printf(\"  integration step size = %f\\n\", h);\n  printf(\"  slice resolution = %d\\n\", resolution);\n  printf(\"  # of iterations = %d\\n\", iter);\n  printf(\"  specified range:\\n\");\n  printf(\"      x: %f, %f\\n\", xmin, xmax);\n  printf(\"      y: %f, %f\\n\", ymin, ymax);\n  printf(\"      z: %f, %f\\n\", zmin, zmax);\n\n  vtkNew<vtkMinimalStandardRandomSequence> randomSequence;\n  randomSequence->SetSeed(8775070);\n  x = randomSequence->GetRangeValue(xmin, xmax);\n  randomSequence->Next();\n  y = randomSequence->GetRangeValue(ymin, ymax);\n  randomSequence->Next();\n  z = randomSequence->GetRangeValue(zmin, zmax);\n  randomSequence->Next();\n  printf(\"  starting at %f, %f, %f\\n\", x, y, z);\n\n  // Allocate memory for the slices.\n  auto sliceSize = resolution * resolution;\n  auto numPts = sliceSize * resolution;\n  vtkNew<vtkShortArray> scalars;\n  auto s = scalars->WritePointer(0, numPts);\n  for (auto i = 0; i < numPts; i++)\n  {\n    s[i] = 0;\n  }\n  for (auto j = 0; j < iter; j++)\n  {\n    // Integrate to next time step.\n    auto xx = x + h * Pr * (y - x);\n    auto yy = y + h * (x * (r - z) - y);\n    auto zz = z + h * (x * y - (b * z));\n\n    x = xx;\n    y = yy;\n    z = zz;\n\n    // Calculate voxel index.\n    if (x < xmax && x > xmin && y < ymax && y > ymin && z < zmax && z > zmin)\n    {\n      auto xxx = static_cast<short>(static_cast<double>(xx - xmin) * xIncr);\n      auto yyy = static_cast<short>(static_cast<double>(yy - ymin) * yIncr);\n      auto zzz = static_cast<short>(static_cast<double>(zz - zmin) * zIncr);\n      auto index = xxx + yyy * resolution + zzz * sliceSize;\n      s[index] += 1;\n    }\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkStructuredPoints> volume;\n  volume->GetPointData()->SetScalars(scalars);\n  volume->SetDimensions(resolution, resolution, resolution);\n  volume->SetOrigin(xmin, ymin, zmin);\n  volume->SetSpacing((xmax - xmin) / resolution, (ymax - ymin) / resolution,\n                     (zmax - zmin) / resolution);\n\n  printf(\"  contouring...\\n\");\n  // Do the graphics dance.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create iso-surface.\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputData(volume);\n  contour->SetValue(0, 50);\n\n  // Create mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(contour->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // Create actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DodgerBlue\").GetData());\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"PaleGoldenrod\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"Lorenz\");\n\n  // Interact with the data.\n  renWin->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-67.645167, -25.714343, 63.483516);\n  camera->SetFocalPoint(3.224902, -4.398594, 29.552112);\n  camera->SetViewUp(-0.232264, 0.965078, 0.121151);\n  camera->SetDistance(81.414176);\n  camera->SetClippingRange(18.428905, 160.896031);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Lorenz/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Lorenz)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Lorenz: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Lorenz MACOSX_BUNDLE Lorenz.cxx )\n  target_link_libraries(Lorenz PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Lorenz\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Lorenz/#download-and-build-lorenz","title":"Download and Build Lorenz","text":"

        Click here to download Lorenz and its CMakeLists.txt file. Once the tarball Lorenz.tar has been downloaded and extracted,

        cd Lorenz/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Lorenz\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Morph3D/","title":"Morph3D","text":"

        vtk-examples/Cxx/Visualization/Morph3D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/Morph3D/#description","title":"Description","text":"

        This example uses vtkInterpolateDataSetAttributes to interpolate datasets created using vtkImplicitModeller. Then vtkContourFilter extracts the resulting isosurface. An animation loop of 100 steps shows each interpolated isosurface with a 100 millisecond delay between each frame.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Morph3D/#code","title":"Code","text":"

        Morph3D.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitModeller.h>\n#include <vtkInterpolateDataSetAttributes.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorText.h>\n\n#include <vtksys/SystemTools.hxx>\n\nint main(int argc, char* argv[])\n{\n  double t = 2.0;\n  if (argc > 1)\n  {\n    t = atof(argv[1]);\n  }\n\n  // make the letter v\n  vtkNew<vtkVectorText> letterV;\n  letterV->SetText(\"v\");\n\n  // read the geometry file containing the letter t\n  vtkNew<vtkVectorText> letterT;\n  letterT->SetText(\"t\");\n\n  // read the geometry file containing the letter k\n  vtkNew<vtkVectorText> letterK;\n  letterK->SetText(\"k\");\n\n  // create implicit models of each letter\n  vtkNew<vtkImplicitModeller> blobbyV;\n  blobbyV->SetInputConnection(letterV->GetOutputPort());\n  blobbyV->SetMaximumDistance(.2);\n  blobbyV->SetSampleDimensions(50, 50, 12);\n  blobbyV->SetModelBounds(-0.5, 1.5, -0.5, 1.5, -0.5, 0.5);\n\n  vtkNew<vtkImplicitModeller> blobbyT;\n  blobbyT->SetInputConnection(letterT->GetOutputPort());\n  blobbyT->SetMaximumDistance(.2);\n  blobbyT->SetSampleDimensions(50, 50, 12);\n  blobbyT->SetModelBounds(-0.5, 1.5, -0.5, 1.5, -0.5, 0.5);\n\n  vtkNew<vtkImplicitModeller> blobbyK;\n  blobbyK->SetInputConnection(letterK->GetOutputPort());\n  blobbyK->SetMaximumDistance(.2);\n  blobbyK->SetSampleDimensions(50, 50, 12);\n  blobbyK->SetModelBounds(-0.5, 1.5, -0.5, 1.5, -0.5, 0.5);\n\n  // Interpolate the data\n  vtkNew<vtkInterpolateDataSetAttributes> interpolate;\n  interpolate->AddInputConnection(blobbyV->GetOutputPort());\n  interpolate->AddInputConnection(blobbyT->GetOutputPort());\n  interpolate->AddInputConnection(blobbyK->GetOutputPort());\n  interpolate->SetT(0.0);\n\n  // extract an iso surface\n  vtkNew<vtkContourFilter> blobbyIso;\n  blobbyIso->SetInputConnection(interpolate->GetOutputPort());\n  blobbyIso->SetValue(0, 0.1);\n\n  // map to rendering primitives\n  vtkNew<vtkPolyDataMapper> blobbyMapper;\n  blobbyMapper->SetInputConnection(blobbyIso->GetOutputPort());\n  blobbyMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkNamedColors> colors;\n\n  // now an actor\n  vtkNew<vtkActor> blobby;\n  blobby->SetMapper(blobbyMapper);\n  blobby->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  blobby->GetProperty()->EdgeVisibilityOn();\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCamera> camera;\n  camera->SetClippingRange(0.265, 13.2);\n  camera->SetFocalPoint(0.539, 0.47464, 0);\n  camera->SetPosition(0.539, 0.474674, 2.644);\n  camera->SetViewUp(0, 1, 0);\n  camera->Azimuth(30.);\n  camera->Elevation(30.);\n  renderer->SetActiveCamera(camera);\n\n  //  now  make a renderer and tell it about lights and actors\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"Morph3D\");\n\n  renderer->AddActor(blobby);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderWindow->Render();\n  for (unsigned i = 0; i < 100; ++i)\n  {\n    interpolate->SetT(i / 99.0 * 2.0);\n    interpolate->Modified();\n    renderWindow->Render();\n    vtksys::SystemTools::Delay(100);\n  }\n  interpolate->SetT(t);\n  renderWindow->Render();\n\n  // interact\n  interactor->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Morph3D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Morph3D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Morph3D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Morph3D MACOSX_BUNDLE Morph3D.cxx )\n  target_link_libraries(Morph3D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Morph3D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Morph3D/#download-and-build-morph3d","title":"Download and Build Morph3D","text":"

        Click here to download Morph3D and its CMakeLists.txt file. Once the tarball Morph3D.tar has been downloaded and extracted,

        cd Morph3D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Morph3D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/MovableAxes/","title":"MovableAxes","text":"

        vtk-examples/Cxx/Visualization/MovableAxes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/MovableAxes/#description","title":"Description","text":"

        With vtkAxesActor, a hybrid object with 3D axes and 2D label props, it is not possible to move the labels along with the axes with vtkInteractorStyleTrackballActor. Here we create new axes labels using a different 3D prop: vtkFollower, and update their positions with a custom callback command.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/MovableAxes/#code","title":"Code","text":"

        MovableAxes.cxx

        #include <vtkActor.h>\n#include <vtkAssembly.h>\n#include <vtkAssemblyPath.h>\n#include <vtkAxesActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkFollower.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextActor.h>\n#include <vtkVectorText.h>\n\nnamespace {\n//----------------------------------------------------------------------------\nclass vtkPositionCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkPositionCallback* New()\n  {\n    return new vtkPositionCallback;\n  }\n\n  void Execute(vtkObject* vtkNotUsed(caller), unsigned long vtkNotUsed(event),\n               void* vtkNotUsed(callData))\n  {\n    this->Axes->InitPathTraversal();\n    vtkAssemblyPath* path = 0;\n    int count = 0;\n    vtkFollower* followers[3] = {this->XLabel, this->YLabel, this->ZLabel};\n    int followerId = 0;\n    while ((path = this->Axes->GetNextPath()) != NULL)\n    {\n      if (count++ > 2)\n      {\n        vtkProp3D* prop3D =\n            static_cast<vtkProp3D*>(path->GetLastNode()->GetViewProp());\n        if (prop3D)\n        {\n          prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());\n          followers[followerId]->SetPosition(prop3D->GetCenter());\n          followerId++;\n          prop3D->PokeMatrix(NULL);\n        }\n      }\n    }\n  }\n\n  vtkPositionCallback() : XLabel(0), YLabel(0), ZLabel(0), Axes(0)\n  {\n  }\n\n  vtkFollower* XLabel;\n  vtkFollower* YLabel;\n  vtkFollower* ZLabel;\n  vtkAssembly* Axes;\n};\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  //  vtkPolyData* cone = coneSource->GetOutput();\n\n  // create a mapper\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n\n  // create an actor\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MovableAxes\");\n\n  // an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(coneActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // vtkAxesActor is currently not designed to work with\n  // vtkInteractorStyleTrackballActor since it is a hybrid object containing\n  // both vtkProp3D's and vtkActor2D's, the latter of which does not have a 3D\n  // position that can be manipulated.\n  vtkNew<vtkAxesActor> axes;\n\n  // Get a copy of the axes' constituent 3D actors and put them into a\n  // vtkAssembly so they can be manipulated as one prop.\n  vtkNew<vtkPropCollection> collection;\n  axes->GetActors(collection);\n\n  collection->InitTraversal();\n\n  vtkNew<vtkAssembly> movableAxes;\n\n  for (int i = 0; i < collection->GetNumberOfItems(); ++i)\n  {\n    movableAxes->AddPart((vtkProp3D*)collection->GetNextProp());\n  }\n\n  renderer->AddActor(movableAxes);\n\n  // Create our own labels that will follow and face the camera.\n  vtkNew<vtkFollower> xLabel;\n  vtkNew<vtkVectorText> xText;\n  vtkNew<vtkPolyDataMapper> xTextMapper;\n  xText->SetText(\"X\");\n  xTextMapper->SetInputConnection(xText->GetOutputPort());\n  xLabel->SetMapper(xTextMapper);\n  xLabel->SetScale(0.3);\n  xLabel->SetCamera(renderer->GetActiveCamera());\n  xLabel->SetPosition(\n      ((vtkProp3D*)collection->GetItemAsObject(3))->GetCenter()); // XAxisTip\n  xLabel->PickableOff();\n  renderer->AddActor(xLabel);\n\n  vtkNew<vtkFollower> yLabel;\n  vtkNew<vtkVectorText> yText;\n  vtkNew<vtkPolyDataMapper> yTextMapper;\n  yText->SetText(\"Y\");\n  yTextMapper->SetInputConnection(yText->GetOutputPort());\n  yLabel->SetMapper(yTextMapper);\n  yLabel->SetScale(0.3);\n  yLabel->SetCamera(renderer->GetActiveCamera());\n  yLabel->SetPosition(\n      ((vtkProp3D*)collection->GetItemAsObject(4))->GetCenter()); // YAxisTip\n  yLabel->PickableOff();\n  renderer->AddActor(yLabel);\n\n  vtkNew<vtkFollower> zLabel;\n  vtkNew<vtkVectorText> zText;\n  vtkNew<vtkPolyDataMapper> zTextMapper;\n  zText->SetText(\"Z\");\n  zTextMapper->SetInputConnection(zText->GetOutputPort());\n  zLabel->SetMapper(zTextMapper);\n  zLabel->SetScale(0.3);\n  zLabel->SetCamera(renderer->GetActiveCamera());\n  zLabel->SetPosition(\n      ((vtkProp3D*)collection->GetItemAsObject(5))->GetCenter()); // ZAxisTip\n  zLabel->PickableOff();\n  renderer->AddActor(zLabel);\n\n  // Custom callback to set the positions of the labels.\n  vtkNew<vtkPositionCallback> callback;\n  callback->XLabel = xLabel;\n  callback->YLabel = yLabel;\n  callback->ZLabel = zLabel;\n  callback->Axes = movableAxes;\n\n  renderer->ResetCamera();\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballActor> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n  style->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/MovableAxes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MovableAxes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MovableAxes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MovableAxes MACOSX_BUNDLE MovableAxes.cxx )\n  target_link_libraries(MovableAxes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MovableAxes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/MovableAxes/#download-and-build-movableaxes","title":"Download and Build MovableAxes","text":"

        Click here to download MovableAxes and its CMakeLists.txt file. Once the tarball MovableAxes.tar has been downloaded and extracted,

        cd MovableAxes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MovableAxes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/MoveActor/","title":"MoveActor","text":"

        vtk-examples/Cxx/Visualization/MoveActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/MoveActor/#description","title":"Description","text":"

        This example creates two spheres. They can be moved/scaled/rotated independent of each other using the mouse.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/MoveActor/#code","title":"Code","text":"

        MoveActor.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere 1\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(4.0);\n  sphereSource1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereSource1->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere 2\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10.0, 0.0, 0.0);\n  sphereSource2->SetRadius(3.0);\n  sphereSource2->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(sphereSource2->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MoveActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballActor> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/MoveActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MoveActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MoveActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MoveActor MACOSX_BUNDLE MoveActor.cxx )\n  target_link_libraries(MoveActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MoveActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/MoveActor/#download-and-build-moveactor","title":"Download and Build MoveActor","text":"

        Click here to download MoveActor and its CMakeLists.txt file. Once the tarball MoveActor.tar has been downloaded and extracted,

        cd MoveActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MoveActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/MoveCamera/","title":"MoveCamera","text":"

        vtk-examples/Cxx/Visualization/MoveCamera

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/MoveCamera/#description","title":"Description","text":"

        This example creates two spheres. They will move together when the mouse is used to interact with the scene because the camera is actually what is moving causing the view of the spheres to change.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/MoveCamera/#code","title":"Code","text":"

        MoveCamera.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere 1\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(4.0);\n  sphereSource1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereSource1->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere 2\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10.0, 0.0, 0.0);\n  sphereSource2->SetRadius(3.0);\n  sphereSource2->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(sphereSource2->GetOutputPort());\n\n  // Create an actor\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MoveCamera\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =\n      vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/MoveCamera/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MoveCamera)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MoveCamera: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MoveCamera MACOSX_BUNDLE MoveCamera.cxx )\n  target_link_libraries(MoveCamera PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MoveCamera\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/MoveCamera/#download-and-build-movecamera","title":"Download and Build MoveCamera","text":"

        Click here to download MoveCamera and its CMakeLists.txt file. Once the tarball MoveCamera.tar has been downloaded and extracted,

        cd MoveCamera/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MoveCamera\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/MultipleActors/","title":"MultipleActors","text":"

        vtk-examples/Cxx/Visualization/MultipleActors

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/MultipleActors/#description","title":"Description","text":"

        This example creates two spheres and renders them. The idea is to show that each object needs its own mapper and actor and then multiple actors can be added to a renderer.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/MultipleActors/#code","title":"Code","text":"

        MultipleActors.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere 1\n  vtkNew<vtkSphereSource> sphereSource1;\n  sphereSource1->SetCenter(0.0, 0.0, 0.0);\n  sphereSource1->SetRadius(4.0);\n  sphereSource1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereSource1->GetOutputPort());\n\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere 2\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetCenter(10.0, 0.0, 0.0);\n  sphereSource2->SetRadius(3.0);\n  sphereSource2->Update();\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(sphereSource2->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"MultipleActors\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/MultipleActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultipleActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultipleActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultipleActors MACOSX_BUNDLE MultipleActors.cxx )\n  target_link_libraries(MultipleActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultipleActors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/MultipleActors/#download-and-build-multipleactors","title":"Download and Build MultipleActors","text":"

        Click here to download MultipleActors and its CMakeLists.txt file. Once the tarball MultipleActors.tar has been downloaded and extracted,

        cd MultipleActors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MultipleActors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/MultipleRenderWindows/","title":"MultipleRenderWindows","text":"

        vtk-examples/Cxx/Visualization/MultipleRenderWindows

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/MultipleRenderWindows/#description","title":"Description","text":"

        This example creates four render windows. Three of the windows will close individually and closing one window will close all the others. Guess which one!

        You can also press 'q' or 'e' to close a window.

        If the parameter 's' (C++) or '-s (Python) is specified, then updating the camera position in one window will also update the position in the other windows. Pressing 'q' or 'e' closes all windows. Note that in this mode you must use 'q' or 'e' to close the windows.

        Note

        The image you see here is the test image. When you run this program you will see an image similar to MultipleViewports however each object will be in a separate window.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/MultipleRenderWindows/#code","title":"Code","text":"

        MultipleRenderWindows.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkCylinderSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\nstd::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> GetSources();\n\n// Define interaction style\nclass KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera\n{\npublic:\n  static KeyPressInteractorStyle* New();\n  vtkTypeMacro(KeyPressInteractorStyle, vtkInteractorStyleTrackballCamera);\n\n  virtual void OnKeyPress()\n  {\n    // Get the keypress\n    vtkRenderWindowInteractor* rwi = this->Interactor;\n    std::string key = rwi->GetKeySym();\n\n    if (key == \"e\" || key == \"q\" || key == \"E\" || key == \"Q\")\n    {\n      *status = false;\n    }\n\n    // Forward events\n    vtkInteractorStyleTrackballCamera::OnKeyPress();\n  }\n\npublic:\n  bool* status = nullptr;\n};\nvtkStandardNewMacro(KeyPressInteractorStyle);\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  auto simultaneousUpdate = false;\n  if ((argc > 1) &&\n      (std::string(argv[1]) == \"s\" || std::string(argv[1]) == \"S\"))\n  {\n    simultaneousUpdate = true;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Have some fun with colors\n  std::vector<std::string> renBkg{\"AliceBlue\", \"GhostWhite\", \"WhiteSmoke\",\n                                  \"Seashell\"};\n  std::vector<std::string> actorColor{\"Bisque\", \"RosyBrown\", \"Goldenrod\",\n                                      \"Chocolate\"};\n  // Window sizes and spacing.\n  auto width = 300;\n  auto height = 300;\n  // Add extra space around each window.\n  auto dx = 20;\n  auto dy = 40;\n  auto w = width + dx;\n  auto h = height + dy;\n\n  std::vector<vtkSmartPointer<vtkRenderWindowInteractor>> interactors;\n  std::vector<vtkSmartPointer<KeyPressInteractorStyle>> styles;\n  std::array<bool, 4> running{true, true, true, true};\n\n  vtkCamera* camera = nullptr;\n  auto sources = GetSources();\n\n  for (unsigned int i = 0; i < 4; i++)\n  {\n    vtkNew<vtkRenderWindow> renderWindow;\n    renderWindow->SetSize(width, height);\n\n    vtkNew<vtkRenderer> renderer;\n\n    // Use the same initial camera for each renderer.\n    if (i == 0)\n    {\n      camera = renderer->GetActiveCamera();\n      camera->Azimuth(30);\n      camera->Elevation(30);\n    }\n    else\n    {\n      renderer->SetActiveCamera(camera);\n    }\n\n    renderWindow->AddRenderer(renderer);\n\n    vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n    interactors.push_back(renderWindowInteractor);\n\n    renderWindowInteractor->SetRenderWindow(renderWindow);\n    renderWindow->Render();\n    std::stringstream ss;\n    ss << \"MultipleRenderWindows \" << i;\n    renderWindow->SetWindowName(ss.str().c_str());\n    renderWindow->SetPosition((i % 2) * w, h - (i / 2) * h);\n\n    // Create a mapper and actor.\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sources[i]->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(actorColor[i]).GetData());\n\n    renderer->AddActor(actor);\n    renderer->SetBackground(colors->GetColor3d(renBkg[i]).GetData());\n\n    renderer->ResetCamera();\n\n    running[i] = true;\n    vtkNew<KeyPressInteractorStyle> style;\n    styles.push_back(style);\n    styles[i]->status = &running[i];\n    interactors[i]->SetInteractorStyle(styles[i]);\n    styles[i]->SetCurrentRenderer(renderer);\n  }\n\n  // Start the interaction.\n  if (simultaneousUpdate)\n  {\n    // Changes in any window will be simultaneously reflected in the other\n    // windows.\n    interactors[0]->Initialize();\n    // If all are running then process the commands.\n    while (std::all_of(running.begin(), running.end(),\n                       [](bool i) { return i == true; }))\n    {\n      for (unsigned int i = 0; i < 4; i++)\n      {\n        if (running[i])\n        {\n          interactors[i]->ProcessEvents();\n          interactors[i]->Render();\n        }\n        else\n        {\n          interactors[i]->TerminateApp();\n          std::cout << \"Window \" << i << \" has stopped running.\" << std::endl;\n        }\n      }\n    }\n  }\n  else\n  {\n    // Changes in any window will be reflected in the other\n    // windows when you click in the window.\n    interactors[0]->Start();\n  }\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nstd::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> GetSources()\n{\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> sources;\n  for (unsigned i = 0; i < 4; i++)\n  {\n    // Create a sphere.\n    vtkNew<vtkSphereSource> sphere;\n    sphere->SetCenter(0.0, 0.0, 0.0);\n    sphere->Update();\n    sources.push_back(sphere);\n    // Create a cone.\n    vtkNew<vtkConeSource> cone;\n    cone->SetCenter(0.0, 0.0, 0.0);\n    cone->SetDirection(0, 1, 0);\n    cone->Update();\n    sources.push_back(cone);\n    // Create a cube.\n    vtkNew<vtkCubeSource> cube;\n    cube->SetCenter(0.0, 0.0, 0.0);\n    cube->Update();\n    sources.push_back(cube);\n    // Create a cylinder.\n    vtkNew<vtkCylinderSource> cylinder;\n    cylinder->SetCenter(0.0, 0.0, 0.0);\n    cylinder->Update();\n    sources.push_back(cylinder);\n  }\n  return sources;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/MultipleRenderWindows/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultipleRenderWindows)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultipleRenderWindows: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultipleRenderWindows MACOSX_BUNDLE MultipleRenderWindows.cxx )\n  target_link_libraries(MultipleRenderWindows PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultipleRenderWindows\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/MultipleRenderWindows/#download-and-build-multiplerenderwindows","title":"Download and Build MultipleRenderWindows","text":"

        Click here to download MultipleRenderWindows and its CMakeLists.txt file. Once the tarball MultipleRenderWindows.tar has been downloaded and extracted,

        cd MultipleRenderWindows/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MultipleRenderWindows\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/MultipleViewports/","title":"MultipleViewports","text":"

        vtk-examples/Cxx/Visualization/MultipleViewports

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/MultipleViewports/#description","title":"Description","text":"

        This example creates a window with 4 viewports. Updating the camera position in one viewport will also update the position in the other viewports.

        See MultipleRenderWindows for an example using multiple windows.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/MultipleViewports/#code","title":"Code","text":"

        MultipleViewports.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkCylinderSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vector>\n\nnamespace {\nstd::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> GetSources();\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  double xmins[4] = {0, .5, 0, .5};\n  double xmaxs[4] = {0.5, 1, 0.5, 1};\n  double ymins[4] = {0, 0, .5, .5};\n  double ymaxs[4] = {0.5, 0.5, 1, 1};\n  // Have some fun with colors.\n  std::vector<std::string> renBkg{\"AliceBlue\", \"GhostWhite\", \"WhiteSmoke\",\n                                  \"Seashell\"};\n  std::vector<std::string> actorColor{\"Bisque\", \"RosyBrown\", \"Goldenrod\",\n                                      \"Chocolate\"};\n  vtkCamera* camera = nullptr;\n  auto sources = GetSources();\n\n  for (unsigned i = 0; i < 4; i++)\n  {\n    vtkNew<vtkRenderer> renderer;\n\n    renderWindow->AddRenderer(renderer);\n    renderer->SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i]);\n\n    // Share the camera between viewports.\n    if (i == 0)\n    {\n      camera = renderer->GetActiveCamera();\n      camera->Azimuth(30);\n      camera->Elevation(30);\n    }\n    else\n    {\n      renderer->SetActiveCamera(camera);\n    }\n\n    // Create a mapper and actor.\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sources[i]->GetOutputPort());\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(actorColor[i]).GetData());\n\n    renderer->AddActor(actor);\n    renderer->SetBackground(colors->GetColor3d(renBkg[i]).GetData());\n\n    renderer->ResetCamera();\n  }\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"MultipleViewPorts\");\n  renderWindow->SetSize(600, 600);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nstd::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> GetSources()\n{\n  std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> sources;\n  for (unsigned i = 0; i < 4; i++)\n  {\n    // Create a sphere.\n    vtkNew<vtkSphereSource> sphere;\n    sphere->SetCenter(0.0, 0.0, 0.0);\n    sphere->Update();\n    sources.push_back(sphere);\n    // Create a cone.\n    vtkNew<vtkConeSource> cone;\n    cone->SetCenter(0.0, 0.0, 0.0);\n    cone->SetDirection(0, 1, 0);\n    cone->Update();\n    sources.push_back(cone);\n    // Create a cube.\n    vtkNew<vtkCubeSource> cube;\n    cube->SetCenter(0.0, 0.0, 0.0);\n    cube->Update();\n    sources.push_back(cube);\n    // Create a cylinder.\n    vtkNew<vtkCylinderSource> cylinder;\n    cylinder->SetCenter(0.0, 0.0, 0.0);\n    cylinder->Update();\n    sources.push_back(cylinder);\n  }\n  return sources;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/MultipleViewports/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MultipleViewports)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MultipleViewports: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MultipleViewports MACOSX_BUNDLE MultipleViewports.cxx )\n  target_link_libraries(MultipleViewports PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MultipleViewports\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/MultipleViewports/#download-and-build-multipleviewports","title":"Download and Build MultipleViewports","text":"

        Click here to download MultipleViewports and its CMakeLists.txt file. Once the tarball MultipleViewports.tar has been downloaded and extracted,

        cd MultipleViewports/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MultipleViewports\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/NamedColorPatches/","title":"NamedColorPatches","text":"

        vtk-examples/Cxx/Visualization/NamedColorPatches

        "},{"location":"Cxx/Visualization/NamedColorPatches/#description","title":"Description","text":"

        This example shows how to produce a HTML page called VTKNamedColorPatches showing the available colors in vtkNamedColors.

        It also shows how to select the text color based on luminance. In this case, Digital CCIR601 is used, which gives less weight to the red and blue components of a color.

        In the class HTMLTableMaker there are four methods for generating HTML pages:

        • MakeCombinedColorPage() -- Makes an indexed page with all the colors and names in the class vtkNamedColors (the default).
        • MakeWebColorPage() -- Makes a page of just the colors and names known to Web Browsers.
        • MakeVTKColorPage() -- Makes a page of colors and names corresponding to to additional colors commonly used in VTK.
        • MakeSynonymColorPage() -- Makes a page of color names and their synonyms.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/NamedColorPatches/#code","title":"Code","text":"

        NamedColorPatches.cxx

        /*\n * Produce a HTML page called VTKNamedColorPatches.html showing the available\n * colors in vtkNamedColors.\n *\n * It also shows how to select the text color based on luminance.\n * In this case Digital CCIR601 is used which gives less weight to the red and\n * blue components of a color.\n *\n */\n\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n\n#include <algorithm>\n#include <cctype>\n#include <cstdlib>\n#include <fstream>\n#include <functional>\n#include <iostream>\n#include <iterator>\n#include <locale>\n#include <map>\n#include <regex>\n#include <sstream>\n#include <string>\n#include <vector>\n\nnamespace {\n\n//! Convert to and from HTML color strings.\nclass HTMLToFromRGBAColor\n{\npublic:\n  HTMLToFromRGBAColor() = default;\n  virtual ~HTMLToFromRGBAColor() = default;\n\npublic:\n  bool IsValidHTMLColorString(std::string const& s);\n  std::string RGBToHTMLColor(vtkColor3ub const& rgb);\n  vtkColor3ub HTMLColorToRGB(std::string const& colorString);\n  double RGBToLumaCCIR601(vtkColor3ub const& rgb);\n};\n\n/**\n * Holds the color names, grouped by color class, and information about table\n * layout and ordering.\n */\nclass ColorStructures\n{\npublic:\n  ColorStructures()\n  {\n    this->Init();\n  }\n\n  virtual ~ColorStructures() = default;\n\nprivate:\n  void Init();\n\npublic:\n  std::map<std::string, std::vector<std::string>> cn;\n  // Ordering of the tables and when to start and end a column of\n  // tables in the layout.\n  std::vector<std::string> cnOrder;\n  std::vector<std::string> cnStartTable;\n  std::vector<std::string> cnEndTable;\n\n  std::map<std::string, std::vector<std::string>> vtkcn;\n  // Ordering of the tables and when to start and end a column of\n  // tables in the layout.\n  std::vector<std::string> vtkcnOrder;\n  std::vector<std::string> vtkcnStartTable;\n  std::vector<std::string> vtkcnEndTable;\n};\n\n/**\n * This class creates HTML Tables displaying all the colors in\n * the class vtkNamedColors grouped by various categories.\n */\nclass HTMLTableMaker\n{\n\npublic:\n  HTMLTableMaker() = default;\n\n  ~HTMLTableMaker() = default;\n\npublic:\n  std::string MakeWebColorPage();\n  std::string MakeVTKColorPage();\n  std::string MakeSynonymColorPage();\n  std::string MakeCombinedColorPage();\n\nprivate:\n  std::vector<std::vector<std::string>> GetSynonyms();\n  std::string FormatRGBForHTML(vtkColor3ub const& rgb);\n  std::string MakeHTMLStyle();\n  std::string MakeHTMLHeader();\n  std::string MakeHTMLIndex();\n  std::string MakeTableHeader(std::string const& title);\n  std::string MakeTD(std::string const& name);\n  //! Use when the name is a color name known to the web browser.\n  std::string MakeTR(const std::string& name, vtkColor3ub const& rgb,\n                     const std::string& textColor);\n  //! Use when the name is not a color name known to the web browser.\n  std::string MakeTR_HTML(const std::string& name, const std::string& htmlColor,\n                          vtkColor3ub const& rgb, const std::string& textColor);\n  std::string MakeWebColorTables();\n  std::string MakeVTKColorTables();\n  std::string MakeSynonymColorTable();\n\nprivate:\n  vtkNew<vtkNamedColors> nc;\n  ColorStructures cs = ColorStructures();\n  HTMLToFromRGBAColor htmlRGBA = HTMLToFromRGBAColor();\n};\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  HTMLTableMaker ncpt;\n\n  std::ofstream outputFile;\n  outputFile.open(\"VTKNamedColorPatches.html\",\n                  ios::out | ios::trunc | ios::binary);\n  outputFile << ncpt.MakeCombinedColorPage();\n  // outputFile << ncpt.MakeWebColorPage();\n  // outputFile << ncpt.MakeVTKColorPage();\n  // outputFile << ncpt.MakeSynonymColorPage();\n  outputFile.close();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nbool HTMLToFromRGBAColor::IsValidHTMLColorString(std::string const& s)\n{\n  if (s.size() == 7 || s.size() == 9) // #rrggbb or #rrggbbaa\n  {\n    if (s.compare(0, 1, \"#\") == 0 &&\n        s.find_first_not_of(\"0123456789abcdefABCDEF\", 1) == std::string::npos)\n    {\n      return true;\n    }\n  }\n  return false;\n}\n\nstd::string HTMLToFromRGBAColor::RGBToHTMLColor(vtkColor3ub const& rgb)\n{\n  std::string s = \"#\";\n  std::ostringstream os;\n  os << std::setfill('0') << std::hex << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetRed()) << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetGreen()) << std::setw(2)\n     << static_cast<unsigned int>(rgb.GetBlue());\n  s += os.str();\n  return s;\n}\n\nvtkColor3ub HTMLToFromRGBAColor::HTMLColorToRGB(std::string const& colorString)\n{\n  vtkColor3ub c(0, 0, 0);\n  if (IsValidHTMLColorString(colorString) && colorString.size() == 7)\n  {\n    auto i = 1;\n    while (i < static_cast<int>(colorString.size()))\n    {\n      std::istringstream is(colorString.substr(i, 2));\n      int x;\n      is >> std::hex >> x;\n      c[(i - 1) / 2] = x;\n      i += 2;\n    }\n  }\n  return c;\n}\n\ndouble HTMLToFromRGBAColor::RGBToLumaCCIR601(vtkColor3ub const& rgb)\n{\n  return 0.299 * rgb.GetRed() + 0.587 * rgb.GetGreen() + 0.114 * rgb.GetBlue();\n}\n\nvoid ColorStructures::Init()\n{\n  // clang-format off\n    this->cn = {\n          {\"Red\",\n              {\"IndianRed\", \"LightCoral\", \"Salmon\", \"DarkSalmon\",\n              \"LightSalmon\", \"Red\", \"Crimson\", \"FireBrick\", \"DarkRed\"}},\n      {\"Pink\",\n        {\"Pink\", \"LightPink\", \"HotPink\", \"DeepPink\",\n        \"MediumVioletRed\", \"PaleVioletRed\"}},\n      {\"Orange\",\n        {\"LightSalmon\", \"Coral\", \"Tomato\", \"OrangeRed\",\n        \"DarkOrange\", \"Orange\"}},\n      {\"Yellow\",\n        {\"Gold\", \"Yellow\", \"LightYellow\", \"LemonChiffon\",\n        \"LightGoldenrodYellow\", \"PapayaWhip\", \"Moccasin\",\n        \"PeachPuff\", \"PaleGoldenrod\", \"Khaki\", \"DarkKhaki\"}},\n      {\"Purple\",\n        {\"Lavender\", \"Thistle\", \"Plum\", \"Violet\", \"Orchid\",\n        \"Fuchsia\", \"Magenta\", \"MediumOrchid\", \"MediumPurple\",\n        \"BlueViolet\", \"DarkViolet\", \"DarkOrchid\", \"DarkMagenta\",\n        \"Purple\", \"Indigo\", \"DarkSlateBlue\", \"SlateBlue\",\n        \"MediumSlateBlue\"}},\n      {\"Green\",\n        {\"GreenYellow\", \"Chartreuse\", \"LawnGreen\", \"Lime\",\n        \"LimeGreen\", \"PaleGreen\", \"LightGreen\",\n        \"MediumSpringGreen\", \"SpringGreen\", \"MediumSeaGreen\",\n        \"SeaGreen\", \"ForestGreen\", \"Green\", \"DarkGreen\",\n        \"YellowGreen\", \"OliveDrab\", \"Olive\", \"DarkOliveGreen\",\n        \"MediumAquamarine\", \"DarkSeaGreen\", \"LightSeaGreen\",\n        \"DarkCyan\", \"Teal\"}},\n      {\"Blue/Cyan\",\n        {\"Aqua\", \"Cyan\", \"LightCyan\", \"PaleTurquoise\",\n        \"Aquamarine\", \"Turquoise\", \"MediumTurquoise\",\n        \"DarkTurquoise\", \"CadetBlue\", \"SteelBlue\",\n        \"LightSteelBlue\", \"PowderBlue\", \"LightBlue\",\n        \"SkyBlue\", \"LightSkyBlue\", \"DeepSkyBlue\",\n        \"DodgerBlue\",  \"CornflowerBlue\", \"RoyalBlue\", \"Blue\",\n        \"MediumBlue\",  \"DarkBlue\", \"Navy\", \"MidnightBlue\"}},\n      {\"Brown\",\n        {\"Cornsilk\", \"BlanchedAlmond\", \"Bisque\", \"NavajoWhite\",\n        \"Wheat\", \"BurlyWood\", \"Tan\", \"RosyBrown\", \"SandyBrown\",\n        \"Goldenrod\", \"DarkGoldenrod\", \"Peru\", \"Chocolate\",\n        \"SaddleBrown\", \"Sienna\", \"Brown\", \"Maroon\"}},\n      {\"White\",\n        {\"White\", \"Snow\", \"Honeydew\", \"MintCream\", \"Azure\",\n        \"AliceBlue\", \"GhostWhite\", \"WhiteSmoke\", \"Seashell\",\n        \"Beige\", \"OldLace\", \"FloralWhite\", \"Ivory\",\n        \"AntiqueWhite\", \"Linen\",\n        \"LavenderBlush\", \"MistyRose\"}},\n      {\"Gray\",\n        {\"Gainsboro\", \"LightGrey\", \"Silver\", \"DarkGray\", \"Gray\",\n        \"DimGray\", \"LightSlateGray\", \"SlateGray\", \"DarkSlateGray\",\n        \"Black\"}}\n    };\n    // Ordering of the tables and when to start and end a column of tables\n    // in the layout.\n    this->cnOrder = {\n      \"Red\",   \"Pink\",      \"Orange\", \"Yellow\", \"Purple\",\n      \"Green\", \"Blue/Cyan\", \"Brown\",  \"White\",  \"Gray\"};\n    this->cnStartTable = {\"Red\", \"Green\", \"Brown\"};\n    this->cnEndTable = {\"Purple\", \"Blue/Cyan\", \"Gray\"};\n\n    this->vtkcn = {\n      {\"Whites\",\n        {\"antique_white\", \"azure\", \"bisque\",  \"blanched_almond\",\n        \"cornsilk\", \"eggshell\", \"floral_white\", \"gainsboro\",\n        \"ghost_white\", \"honeydew\", \"ivory\", \"lavender\",\n        \"lavender_blush\", \"lemon_chiffon\", \"linen\", \"mint_cream\",\n        \"misty_rose\", \"moccasin\", \"navajo_white\", \"old_lace\",\n        \"papaya_whip\", \"peach_puff\", \"seashell\", \"snow\",\n        \"thistle\", \"titanium_white\", \"wheat\", \"white\",\n        \"white_smoke\", \"zinc_white\"}},\n      {\"Greys\",\n        {\"cold_grey\", \"dim_grey\", \"grey\", \"light_grey\",\n        \"slate_grey\", \"slate_grey_dark\", \"slate_grey_light\",\n        \"warm_grey\"}},\n      {\"Blacks\",\n        {\"black\", \"ivory_black\", \"lamp_black\"}},\n      {\"Reds\",\n        {\"alizarin_crimson\", \"brick\",  \"cadmium_red_deep\",  \"coral\",\n        \"coral_light\", \"deep_pink\", \"english_red\", \"firebrick\",\n        \"geranium_lake\", \"hot_pink\", \"indian_red\", \"light_salmon\",\n        \"madder_lake_deep\", \"maroon\", \"pink\", \"pink_light\",\n        \"raspberry\", \"red\", \"rose_madder\", \"salmon\", \"tomato\",\n        \"venetian_red\"}},\n      {\"Browns\",\n        {\"beige\", \"brown\", \"brown_madder\", \"brown_ochre\",\n        \"burlywood\", \"burnt_sienna\", \"burnt_umber\", \"chocolate\",\n        \"deep_ochre\", \"flesh\", \"flesh_ochre\", \"gold_ochre\",\n        \"greenish_umber\", \"khaki\", \"khaki_dark\", \"light_beige\",\n        \"peru\", \"rosy_brown\", \"raw_sienna\", \"raw_umber\", \"sepia\",\n        \"sienna\", \"saddle_brown\", \"sandy_brown\", \"tan\",\n        \"van_dyke_brown\"}},\n      {\"Oranges\",\n        {\"cadmium_orange\", \"cadmium_red_light\", \"carrot\",\n        \"dark_orange\", \"mars_orange\", \"mars_yellow\", \"orange\",\n        \"orange_red\", \"yellow_ochre\"}},\n      {\"Yellows\",\n        {\"aureoline_yellow\", \"banana\", \"cadmium_lemon\",\n        \"cadmium_yellow\", \"cadmium_yellow_light\", \"gold\",\n        \"goldenrod\", \"goldenrod_dark\", \"goldenrod_light\",\n        \"goldenrod_pale\", \"light_goldenrod\", \"melon\",\n        \"naples_yellow_deep\", \"yellow\", \"yellow_light\"}},\n      {\"Greens\",\n        {\"chartreuse\", \"chrome_oxide_green\", \"cinnabar_green\",\n        \"cobalt_green\", \"emerald_green\", \"forest_green\", \"green\",\n        \"green_dark\", \"green_pale\", \"green_yellow\", \"lawn_green\",\n        \"lime_green\", \"mint\", \"olive\", \"olive_drab\",\n        \"olive_green_dark\", \"permanent_green\", \"sap_green\",\n        \"sea_green\", \"sea_green_dark\", \"sea_green_medium\",\n        \"sea_green_light\", \"spring_green\", \"spring_green_medium\",\n        \"terre_verte\", \"viridian_light\", \"yellow_green\"}},\n      {\"Cyans\",\n        {\"aquamarine\", \"aquamarine_medium\", \"cyan\", \"cyan_white\",\n        \"turquoise\", \"turquoise_dark\", \"turquoise_medium\",\n        \"turquoise_pale\"}},\n      {\"Blues\",\n        {\"alice_blue\", \"blue\", \"blue_light\", \"blue_medium\",\n        \"cadet\", \"cobalt\", \"cornflower\", \"cerulean\", \"dodger_blue\",\n        \"indigo\", \"manganese_blue\", \"midnight_blue\", \"navy\",\n        \"peacock\", \"powder_blue\", \"royal_blue\", \"slate_blue\",\n        \"slate_blue_dark\", \"slate_blue_light\",\n        \"slate_blue_medium\", \"sky_blue\", \"sky_blue_deep\",\n        \"sky_blue_light\", \"steel_blue\", \"steel_blue_light\",\n        \"turquoise_blue\", \"ultramarine\"}},\n      {\"Magentas\",\n        {\"blue_violet\", \"cobalt_violet_deep\", \"magenta\",\n        \"orchid\", \"orchid_dark\", \"orchid_medium\",\n        \"permanent_red_violet\", \"plum\", \"purple\",\n        \"purple_medium\", \"ultramarine_violet\", \"violet\",\n        \"violet_dark\", \"violet_red\", \"violet_red_medium\",\n        \"violet_red_pale\"}}\n    };\n    // Ordering of the tables and when to start and end a column of tables\n    // in the layout.\n    this->vtkcnOrder = {\n      \"Whites\",  \"Greys\",  \"Blacks\", \"Reds\",  \"Oranges\", \"Browns\",\n      \"Yellows\", \"Greens\", \"Cyans\",  \"Blues\", \"Magentas\"};\n    this->vtkcnStartTable = {\"Whites\", \"Browns\",  \"Cyans\"};\n    this->vtkcnEndTable = {\"Oranges\", \"Greens\", \"Magentas\"};\n  // clang-format on\n}\n\nstd::string HTMLTableMaker::MakeWebColorPage()\n{\n  std::string res = this->MakeHTMLHeader();\n  res += \"<body>\\n\";\n  res += \"<h1>Colors available in vtkNamedColors</h1>\\n\";\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"3\\\">Web Color Names</th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeWebColorTables();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"</body>\\n\";\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeVTKColorPage()\n{\n  std::string res = this->MakeHTMLHeader();\n  res += \"<body>\\n\";\n  res += \"<h1>Colors available in vtkNamedColors</h1>\\n\";\n  res += \"The web colors take precedence over colors of the same\";\n  res += \" name in VTK Color Names.\\n\";\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"3\\\">VTK Color Names</th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeVTKColorTables();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"</body>\\n\";\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeSynonymColorPage()\n{\n  std::string res = this->MakeHTMLHeader();\n  res += \"<body>\\n\";\n  res += \"<h1>Synonyms in vtkNamedColors</h1>\\n\";\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"2\\\">Synonyms</th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeSynonymColorTable();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"</body>\\n\";\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeCombinedColorPage()\n{\n  std::string res = this->MakeHTMLHeader();\n  res += \"<body>\\n\";\n  res += \"<h1>Colors available in vtkNamedColors</h1>\\n\";\n  res += \"The class vtkNamedColors provides color names and their\";\n  res += \" values for the convenience of the user.\\n\";\n  res += \"<br>The following tables show the available colors along with\";\n  res += \" their red, green and blue values.\\n\";\n  res += this->MakeHTMLIndex();\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"3\\\"><a id=\\\"WebColorNames\\\">Web color Names</a></th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeWebColorTables();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"<br>\\n\";\n\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"3\\\"><a id=\\\"VTKColorNames\\\">VTK color Names</a></th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeVTKColorTables();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"<br>\\n\";\n\n  res += \"<table>\\n\";\n  res += \"<tr>\\n\";\n  res += \"<th colspan=\\\"2\\\"><a id=\\\"Synonyms\\\">Synonyms</a></th>\\n\";\n  res += \"</tr>\\n\";\n  res += \"<tr>\\n\";\n  res += this->MakeSynonymColorTable();\n  res += \"</tr>\\n\";\n  res += \"</table>\\n\";\n  res += \"</body>\\n\";\n  return res;\n}\n\nstd::vector<std::vector<std::string>> HTMLTableMaker::GetSynonyms()\n{\n  auto ncsyn = this->nc->GetSynonyms();\n  std::stringstream ss(std::regex_replace(ncsyn, std::regex(\"\\n\\n\"), \"*\"));\n  std::string synonyms;\n  std::vector<std::vector<std::string>> sn;\n  while (std::getline(ss, synonyms, '*'))\n  {\n    std::vector<std::string> syns;\n    std::stringstream ss1(synonyms);\n    std::string color;\n    while (std::getline(ss1, color, '\\n'))\n    {\n      syns.push_back(std::move(color));\n    }\n    sn.push_back(std::move(syns));\n  }\n  return sn;\n}\n\nstd::string HTMLTableMaker::MakeHTMLStyle()\n{\n  std::string s = \"  <style>\\n\";\n  s += \"  \\n\";\n  s += \"  body {\\n\";\n  s += \"    background-color: snow\\n\";\n  s += \"  }\\n\";\n  s += \"  h1 {text-align:left;}\\n\";\n  s += \"  h2 {text-align:left;}\\n\";\n  s += \"  h3 {text-align:left;}\\n\";\n  s += \"  h4 {text-align:left;}\\n\";\n  s += \"  h5 {text-align:left;}\\n\";\n  s += \"  h6 {text-align:left;}\\n\";\n  s += \"  \\n\";\n  s += \"  p {text-align:left;}\\n\";\n  s += \"  \\n\";\n  s += \"  table {\\n\";\n  s += \"    font-family: arial, sans-serif;\\n\";\n  s += \"    border-collapse: collapse;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"    padding: 4px;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  th[colspan]:not([colspan=\\\"1\\\"]) {\\n\";\n  s += \"    background: LightSteelBlue;\\n\";\n  s += \"    font-size: x-large;\\n\";\n  s += \"    text-align : center;\";\n  s += \"    vertical-align : top;\\n\";\n  s += \"  }\\n\";\n  s += \"  th {\\n\";\n  s += \"    background: LightSteelBlue;\\n\";\n  s += \"  }\\n\";\n  s += \"  td, th {\\n\";\n  s += \"    border: 1px solid #dddddd;\\n\";\n  s += \"    text-align: left;\\n\";\n  s += \"    padding: 8px;\\n\";\n  s += \"    font-family: monospace;\\n\";\n  s += \"    font-size: medium;\\n\";\n  s += \"    font-weight: bold;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  tr {\\n\";\n  s += \"    background: WhiteSmoke;\\n\";\n  s += \"    vertical-align : top;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  td[colspan]:not([colspan=\\\"1\\\"]) {\\n\";\n  s += \"    background: MintCream;\\n\";\n  s += \"    font-size: large;\\n\";\n  s += \"    text-align : center;\";\n  s += \"    vertical-align : top;\\n\";\n  s += \"  }\\n\";\n  s += \"  td {\\n\";\n  s += \"    background: WhiteSmoke;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  .cour {\\n\";\n  s += \"    font-family: Courier;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  html, body {\\n\";\n  s += \"    height: 100%;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  html {\\n\";\n  s += \"    display: table;\\n\";\n  s += \"    margin: auto;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  body {\\n\";\n  s += \"    display: table-cell;\\n\";\n  s += \"    vertical-align: middle;\\n\";\n  s += \"  }\\n\";\n  s += \"\\n\";\n  s += \"  thead {color: DarkGreen;}\\n\";\n  s += \"  tbody {color: MidnightBlue;}\\n\";\n  s += \"  tfoot {color: SaddleBrown;}\\n\";\n  s += \"\\n\";\n  s += \"  </style>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeHTMLHeader()\n{\n  std::string s = \"<!DOCTYPE html>\\n\";\n  s += \"<html lang=\\\"en\\\">\\n\";\n  s += \"<head>\\n\";\n  s += \"<meta charset=\\\"UTF-8\\\" />\\n\";\n  s += \"<title>vtkNamedColors</title>\\n\";\n  s += this->MakeHTMLStyle();\n  s += \"</head>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeHTMLIndex()\n{\n  std::string s = \"<h2>Index</h2>\\n\";\n  s += \"<ul>\\n\";\n  s += \"\\t<li><a href=\\\"#WebColorNames\\\">Web color Names</a>\";\n  s += \" These colors correspond to those in\";\n  s += \" <a href=\\\"http://en.wikipedia.org/wiki/Web_colors\\\"\";\n  s += \" title=\\\"Web Colors\\\">Web Colors</a>.\\n\";\n  s += \"</li>\\n\";\n  s += \"\\t<li><a href=\\\"#VTKColorNames\\\">VTK color Names</a>\\n\";\n  s += \" The colors correspond to additional colors commonly used in VTK.\\n\";\n  s += \"<br>The web colors take precedence over colors with\\n\";\n  s += \" the same name (case insensitive) here.\\n\";\n  s += \"</li>\\n\";\n  s += \"\\t<li><a href=\\\"#Synonyms\\\">Synonyms</a></li>\\n\";\n  s += \"</ul>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTableHeader(std::string const& title)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<th>\";\n  s += title;\n  s += \"</th>\\n\";\n  s += \"<th>Decimal code<br>\\n\";\n  s += \"&#160;&#160;R\";\n  s += \"&#160;&#160;&#160;&#160;G\";\n  s += \"&#160;&#160;&#160;&#160;B</th>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTD(std::string const& name)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<td colspan=\\\"2\\\">\";\n  s += \"<b>\" + name + \"</b>\";\n  s += \"</td>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::FormatRGBForHTML(vtkColor3ub const& rgb)\n{\n  std::ostringstream os;\n  os << std::setw(3) << static_cast<unsigned int>(rgb.GetRed())\n     << \"&#160;&#160;\" << std::setw(3)\n     << static_cast<unsigned int>(rgb.GetGreen()) << \"&#160;&#160;\"\n     << std::setw(3) << static_cast<unsigned int>(rgb.GetBlue());\n  return std::regex_replace(os.str(), std::regex(\" \"), \"&#160;\");\n}\n\nstd::string HTMLTableMaker::MakeTR(const std::string& name,\n                                   vtkColor3ub const& rgb,\n                                   const std::string& textColor)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<td style=\\\"background:\" + name + \";color:\" + textColor;\n  s += \"\\\">\" + name + \"</td>\\n\";\n  s += \"<td style=\\\"background:\" + name + \";color:\" + textColor;\n  s += \"\\\">\" + this->FormatRGBForHTML(rgb) + \"</td>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeTR_HTML(const std::string& name,\n                                        const std::string& htmlColor,\n                                        vtkColor3ub const& rgb,\n                                        const std::string& textColor)\n{\n  std::string s = \"<tr>\\n\";\n  s += \"<td style=\\\"background:\" + htmlColor + \";color:\" + textColor;\n  s += \"\\\">\" + name + \"</td>\\n\";\n  s += \"<td style=\\\"background:\" + htmlColor + \";color:\" + textColor;\n  s += \"\\\">\" + this->FormatRGBForHTML(rgb) + \"</td>\\n\";\n  s += \"</tr>\\n\";\n  return s;\n}\n\nstd::string HTMLTableMaker::MakeWebColorTables()\n{\n  std::string res;\n  for (auto const& p : cs.cnOrder)\n  {\n    if (std::find(this->cs.cnStartTable.begin(), this->cs.cnStartTable.end(),\n                  p) != this->cs.cnStartTable.end())\n    {\n      res += \"<td>\\n\";\n      res += \"<table>\\n\";\n      res += this->MakeTableHeader(\"HTML name\");\n    }\n    // Add in the name of the group in the color table.\n    res += this->MakeTD(p + \" colors\");\n    auto values = this->cs.cn[p];\n    for (auto const& q : values)\n    {\n      auto rgb = this->nc->GetColor3ub(q);\n      auto y = this->htmlRGBA.RGBToLumaCCIR601(rgb);\n      std::string textColor{\"#000000\"}; // Black\n      if (y < 255 / 2.0)\n      {\n        textColor = \"#ffffff\"; // White\n      }\n      // Make the row for each color in the group.\n      // Here we use the name to set the background color\n      //  as it is known to the web browser.\n      res += this->MakeTR(q, rgb, textColor);\n    }\n    if (std::find(this->cs.cnEndTable.begin(), this->cs.cnEndTable.end(), p) !=\n        this->cs.cnEndTable.end())\n    {\n      res += \"</table>\\n\";\n      res += \"</td>\\n\";\n    }\n  }\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeVTKColorTables()\n{\n  std::string res;\n\n  for (auto const& p : cs.vtkcnOrder)\n  {\n    if (std::find(this->cs.vtkcnStartTable.begin(),\n                  this->cs.vtkcnStartTable.end(),\n                  p) != this->cs.vtkcnStartTable.end())\n    {\n      res += \"<td>\\n\";\n      res += \"<table>\\n\";\n      res += this->MakeTableHeader(\"HTML name\");\n    }\n    // Add in the name of the group in the color table.\n    res += this->MakeTD(p);\n    auto values = this->cs.vtkcn[p];\n    for (auto const& q : values)\n    {\n      auto rgb = this->nc->GetColor3ub(q);\n      auto y = this->htmlRGBA.RGBToLumaCCIR601(rgb);\n      std::string textColor{\"#000000\"}; // Black\n      if (y < 255 / 2.0)\n      {\n        textColor = \"#ffffff\"; // White\n      }\n      // We must set the background color to a specific\n      // HTML color as the color name may not be a standard\n      // name known to the web browser.\n      auto htmlColor = htmlRGBA.RGBToHTMLColor(rgb);\n      // Make the row for each color in the group.\n      res += this->MakeTR_HTML(q, htmlColor, rgb, textColor);\n    }\n    if (std::find(this->cs.vtkcnEndTable.begin(), this->cs.vtkcnEndTable.end(),\n                  p) != this->cs.vtkcnEndTable.end())\n    {\n      res += \"</table>\\n\";\n      res += \"</td>\\n\";\n    }\n  }\n  return res;\n}\n\nstd::string HTMLTableMaker::MakeSynonymColorTable()\n{\n  auto synonyms = this->GetSynonyms();\n  std::vector<std::string> cn;\n  for (const auto& p : this->cs.cn)\n  {\n    std::copy(p.second.begin(), p.second.end(), std::back_inserter(cn));\n  }\n  std::map<std::string, std::string> d;\n  for (const auto& p : cn)\n  {\n    // Make a lowercase key.\n    std::string key;\n    key.resize(p.size());\n    std::transform(p.begin(), p.end(), key.begin(),\n                   [](unsigned char const& c) -> unsigned char {\n                     return std::tolower(c);\n                   });\n    d[key] = p;\n  }\n  // End point of first table.\n  auto end1 = synonyms.size() / 2;\n  if (end1 * 2 < synonyms.size())\n  {\n    end1 += 1;\n  }\n  std::string res;\n  res += \"<td>\\n\";\n  res += \"<table>\\n\";\n  res += this->MakeTableHeader(\"Synonyms\");\n  size_t count = 0;\n  for (auto p : synonyms)\n  {\n    if (count == end1)\n    {\n      res += \"</table>\\n\";\n      res += \"</td>\\n\";\n      res += \"<td>\\n\";\n      res += \"<table>\\n\";\n      res += this->MakeTableHeader(\"Synonyms\");\n    }\n    for (auto& q : p)\n    {\n      // Replace the lowercase name with the proper name.\n      if (d.find(q) != d.end())\n      {\n        q = d[q];\n      }\n    }\n    std::sort(p.begin(), p.end());\n    std::string names;\n    for (auto const& q : p)\n    {\n      names += q;\n      if (q != p.back())\n      {\n        names += \", \";\n      }\n    }\n    auto rgb = this->nc->GetColor3ub(*(p.begin()));\n    auto y = this->htmlRGBA.RGBToLumaCCIR601(rgb);\n    std::string textColor{\"#000000\"}; // Black\n    if (y < 255 / 2.0)\n    {\n      textColor = \"#ffffff\"; // White\n    }\n    // We must set the background color to a specific\n    // HTML color because names is just a list of\n    // synonyms for that particular color.\n    auto htmlColor = this->htmlRGBA.RGBToHTMLColor(rgb);\n    // Make the row for each color in the group.\n    res += this->MakeTR_HTML(names, htmlColor, rgb, textColor);\n    count++;\n  }\n  res += \"</table>\\n\";\n  res += \"</td>\\n\";\n  return res;\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/NamedColorPatches/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NamedColorPatches)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NamedColorPatches: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NamedColorPatches MACOSX_BUNDLE NamedColorPatches.cxx )\n  target_link_libraries(NamedColorPatches PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NamedColorPatches\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/NamedColorPatches/#download-and-build-namedcolorpatches","title":"Download and Build NamedColorPatches","text":"

        Click here to download NamedColorPatches and its CMakeLists.txt file. Once the tarball NamedColorPatches.tar has been downloaded and extracted,

        cd NamedColorPatches/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./NamedColorPatches\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/NamedColors/","title":"NamedColors","text":"

        vtk-examples/Cxx/Visualization/NamedColors

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/NamedColors/#description","title":"Description","text":"

        This example demonstrates the usage of the vtkNamedColors class. Some helper functions are also implemented.

        A cone is created and contoured using the BandedPolyDataContourFilter, it is then colored using a LookupTable where the colors have been assigned using color names.

        A list of available color names and any synonyms are also output.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/NamedColors/#code","title":"Code","text":"

        NamedColors.cxx

        /*\nThis example demonstrates the usage of the vtNamedColor class.\n*/\n#include <vtkActor.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkConeSource.h>\n#include <vtkElevationFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <algorithm>\n#include <iostream>\n#include <regex>\n#include <sstream>\n#include <vector>\n\nnamespace {\n// Get the color names.\nstd::vector<std::string> GetColorNames(vtkNamedColors* namedColors);\n\n// Get the synonyms.\nstd::vector<std::vector<std::string>> GetSynonyms(vtkNamedColors* namedColors);\n\n// Print out the colors.\nvoid PrintColors(vtkNamedColors* namedColors);\n\n// Print out the synonyms.\nvoid PrintSynonyms(vtkNamedColors* namedColors);\n\n// Find any synonyms for a specified color.\nstd::vector<std::string> FindSynonyms(const std::string& color,\n                                      vtkNamedColors* namedColors);\n\n} // namespace\n\n// Create a cone, contour it using the banded contour filter and\n// color it with the primary additive and subtractive colors.\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> namedColors;\n\n  // We can print out the variables.\n  // The color name and RGBA values are displayed.\n  // namedColors->PrintSelf(std::cout,vtkIndent(2));\n\n  // Here we just print out the colors and any\n  // synonyms.\n  PrintColors(namedColors);\n  PrintSynonyms(namedColors);\n\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetCenter(0.0, 0.0, 0.0);\n  coneSource->SetRadius(5.0);\n  coneSource->SetHeight(10);\n  coneSource->SetDirection(0, 1, 0);\n  coneSource->SetResolution(6);\n  coneSource->Update();\n\n  double bounds[6];\n  coneSource->GetOutput()->GetBounds(bounds);\n\n  vtkNew<vtkElevationFilter> elevation;\n  elevation->SetInputConnection(coneSource->GetOutputPort());\n  elevation->SetLowPoint(0, bounds[2], 0);\n  elevation->SetHighPoint(0, bounds[3], 0);\n\n  vtkNew<vtkBandedPolyDataContourFilter> bcf;\n  bcf->SetInputConnection(elevation->GetOutputPort());\n  bcf->SetScalarModeToValue();\n  bcf->GenerateContourEdgesOn();\n  bcf->GenerateValues(7, elevation->GetScalarRange());\n\n  double rgba[4];\n  // Test setting and getting colors here.\n  // We are also modifying alpha.\n  namedColors->GetColor(\"Red\", rgba);\n  // Make it semitransparent.\n  rgba[3] = 0.5;\n  namedColors->SetColor(\"My Red\", rgba);\n  // Does \"My Red\" match anything?\n  // Demonstrates how to find synonyms.\n  auto matchingColors = FindSynonyms(\"My Red\", namedColors);\n  if (!matchingColors.empty())\n  {\n    std::cout << \"Matching colors to My Red: \";\n    size_t i = 1;\n    for (auto const& p : matchingColors)\n    {\n      std::cout << p;\n      if (i < matchingColors.size())\n      {\n        std::cout << \", \";\n        i = 1;\n      }\n      ++i;\n    }\n    std::cout << std::endl;\n  }\n  // Build a simple lookup table of\n  // primary additive and subtractive colors.\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(7);\n  lut->SetTableValue(0, namedColors->GetColor4d(\"My Red\").GetData());\n  // Let's make the dark green one partially transparent.\n  namedColors->GetColor(\"Lime\", rgba);\n  rgba[3] = 0.3;\n  lut->SetTableValue(1, rgba);\n  lut->SetTableValue(2, namedColors->GetColor4d(\"Blue\").GetData());\n  lut->SetTableValue(3, namedColors->GetColor4d(\"Cyan\").GetData());\n  lut->SetTableValue(4, namedColors->GetColor4d(\"Magenta\").GetData());\n  lut->SetTableValue(5, namedColors->GetColor4d(\"Yellow\").GetData());\n  lut->SetTableValue(6, namedColors->GetColor4d(\"White\").GetData());\n  lut->SetTableRange(elevation->GetScalarRange());\n  lut->Build();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(bcf->GetOutputPort());\n  mapper->SetScalarRange(elevation->GetScalarRange());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkPolyDataMapper> contourLineMapper;\n  contourLineMapper->SetInputData(bcf->GetContourEdgesOutput());\n  contourLineMapper->SetScalarRange(elevation->GetScalarRange());\n  contourLineMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkActor> contourLineActor;\n  contourLineActor->SetMapper(contourLineMapper);\n  contourLineActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"Black\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->AddActor(contourLineActor);\n  renderer->SetBackground2(namedColors->GetColor3d(\"RoyalBlue\").GetData());\n  renderer->SetBackground(namedColors->GetColor3d(\"MistyRose\").GetData());\n  renderer->GradientBackgroundOn();\n  renderWindow->SetSize(600, 600);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"NamedColors\");\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nstd::vector<std::string> GetColorNames(vtkNamedColors* namedColors)\n{\n  std::stringstream ss(namedColors->GetColorNames());\n  std::string color;\n  std::vector<std::string> cn;\n  while (std::getline(ss, color, '\\n'))\n  {\n    cn.push_back(std::move(color));\n  }\n  return cn;\n}\n\nstd::vector<std::vector<std::string>> GetSynonyms(vtkNamedColors* namedColors)\n{\n  auto ncsyn = namedColors->GetSynonyms();\n  std::stringstream ss(std::regex_replace(ncsyn, std::regex(\"\\n\\n\"), \"*\"));\n  std::string synonyms;\n  std::vector<std::vector<std::string>> sn;\n  while (std::getline(ss, synonyms, '*'))\n  {\n    std::vector<std::string> syns;\n    std::stringstream ss1(synonyms);\n    std::string color;\n    while (std::getline(ss1, color, '\\n'))\n    {\n      syns.push_back(std::move(color));\n    }\n    sn.push_back(std::move(syns));\n  }\n  return sn;\n}\n\nstd::vector<std::string> FindSynonyms(const std::string& color,\n                                      vtkNamedColors* namedColors)\n{\n  auto availableColors = GetColorNames(namedColors);\n  // We will be matching on RGB only.\n  auto myColor = namedColors->GetColor3ub(color);\n  // Colors are all stored as lower case, so convert color to lower case.\n  std::string lcColor;\n  std::transform(color.begin(), color.end(), std::back_inserter(lcColor),\n                 (int (*)(int))std::tolower);\n  std::vector<std::string> synonyms;\n  for (auto const& p : availableColors)\n  {\n    auto c = namedColors->GetColor3ub(p);\n    if (myColor.Compare(c, 1))\n    {\n      synonyms.push_back(p);\n    }\n  }\n  return synonyms;\n}\n\nvoid PrintColors(vtkNamedColors* namedColors)\n{\n  // Get the available colors:\n  auto colors = GetColorNames(namedColors);\n  std::cout << \"There are \" << colors.size() << \" colors:\" << std::endl;\n  auto max_str =\n      std::max_element(colors.begin(), colors.end(),\n                       [](std::string const& a, std::string const& b) {\n                         return a.size() < b.size();\n                       });\n  auto max_str_len = max_str->size();\n  auto n = 0;\n  std::ostringstream os;\n  for (auto const& p : colors)\n  {\n    ++n;\n    if (n % 5 == 0)\n    {\n      os << std::left << p << std::endl;\n    }\n    else\n    {\n      os << std::left << std::setw(max_str_len) << p << \" \";\n    }\n  }\n  std::string s = std::regex_replace(os.str(), std::regex(\"\\\\s+$\"), \"\\n\");\n  std::cout << s << std::endl;\n}\n\nvoid PrintSynonyms(vtkNamedColors* namedColors)\n{\n  // Get the synonyms:\n  auto synonyms = GetSynonyms(namedColors);\n  std::cout << \"There are \" << synonyms.size() << \" synonyms:\" << std::endl;\n  // Get the size of the longest synonym name.\n  size_t max_str_len = 0;\n  for (auto const& p : synonyms)\n  {\n    auto max_str = std::max_element(\n        p.begin(), p.end(), [](std::string const& a, std::string const& b) {\n          return a.size() < b.size();\n        });\n    max_str_len =\n        (max_str_len < max_str->size()) ? max_str->size() : max_str_len;\n  }\n  for (auto const& p : synonyms)\n  {\n    size_t n = 0;\n    for (auto const& q : p)\n    {\n      ++n;\n      if (n < p.size())\n      {\n        std::cout << std::left << std::setw(max_str_len) << q << \" \";\n      }\n      else\n      {\n        std::cout << q << std::endl;\n      }\n    }\n  }\n  std::cout << std::endl;\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/NamedColors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NamedColors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NamedColors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NamedColors MACOSX_BUNDLE NamedColors.cxx )\n  target_link_libraries(NamedColors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NamedColors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/NamedColors/#download-and-build-namedcolors","title":"Download and Build NamedColors","text":"

        Click here to download NamedColors and its CMakeLists.txt file. Once the tarball NamedColors.tar has been downloaded and extracted,

        cd NamedColors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./NamedColors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/NoShading/","title":"NoShading","text":"

        vtk-examples/Cxx/Visualization/NoShading

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/NoShading/#code","title":"Code","text":"

        NoShading.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n\n  // Create a mapper.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  // Create an actor.\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n  actor->GetProperty()->SetAmbient(1);\n  actor->GetProperty()->SetDiffuse(0);\n  actor->GetProperty()->SetSpecular(0);\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"NoShading\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/NoShading/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NoShading)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NoShading: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NoShading MACOSX_BUNDLE NoShading.cxx )\n  target_link_libraries(NoShading PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NoShading\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/NoShading/#download-and-build-noshading","title":"Download and Build NoShading","text":"

        Click here to download NoShading and its CMakeLists.txt file. Once the tarball NoShading.tar has been downloaded and extracted,

        cd NoShading/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./NoShading\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/NormalsDemo/","title":"NormalsDemo","text":"

        vtk-examples/Cxx/Visualization/NormalsDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/NormalsDemo/#description","title":"Description","text":"

        This example demonstrates the generation of normals. The left image shows the orignal faceted model. The center image shows the model with generated normals, but no consideration for sharp features. The third image shows the model with a 30 degree feature angle and splitting on.

        Theis example uses the src/Testing/Data/42400-IDGH.stl dataset.

        Info

        See Figure 9-24 in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/NormalsDemo/#code","title":"Code","text":"

        NormalsDemo.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCleanPolyData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n\n#include <vtkBYUReader.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n#include <vtksys/SystemTools.hxx>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkSmartPointer<vtkPolyData> polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"White\").GetData());\n\n  // Create background colors for each viewport\n  std::vector<vtkColor3d> backgroundColors;\n  backgroundColors.push_back(colors->GetColor3d(\"Cornsilk\"));\n  backgroundColors.push_back(colors->GetColor3d(\"NavajoWhite\"));\n  backgroundColors.push_back(colors->GetColor3d(\"Tan\"));\n\n  // Create a renderer for each view port.\n  std::vector<vtkSmartPointer<vtkRenderer>> ren;\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren[0]->SetViewport(0, 0, 1.0 / 3.0, 1);         // Input\n  ren[1]->SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1); // Normals (no split)\n  ren[2]->SetViewport(2.0 / 3.0, 0, 1, 1);         // Normals (split)\n\n  // Shared camera.\n  vtkNew<vtkCamera> camera;\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(polyData);\n  normals->SetFeatureAngle(30.0);\n  for (int i = 0; i < 3; ++i)\n  {\n    if (i == 0)\n    {\n      normals->ComputePointNormalsOff();\n    }\n    else if (i == 1)\n    {\n      normals->ComputePointNormalsOn();\n      normals->SplittingOff();\n    }\n    else\n    {\n      normals->ComputePointNormalsOn();\n      normals->SplittingOn();\n    }\n\n    normals->Update();\n\n    vtkNew<vtkPolyData> normalsPolyData;\n    normalsPolyData->DeepCopy(normals->GetOutput());\n\n    // Mapper\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputData(normalsPolyData);\n    mapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetDiffuseColor(\n        colors->GetColor3d(\"Peacock\").GetData());\n    actor->GetProperty()->SetDiffuse(.7);\n    actor->GetProperty()->SetSpecularPower(20);\n    actor->GetProperty()->SetSpecular(.5);\n\n    // Add the actor.\n    ren[i]->SetBackground(backgroundColors[i].GetData());\n    ren[i]->SetActiveCamera(camera);\n    ren[i]->AddActor(actor);\n  }\n\n  // Render window.\n  vtkNew<vtkRenderWindow> renwin;\n  renwin->AddRenderer(ren[0]);\n  renwin->AddRenderer(ren[1]);\n  renwin->AddRenderer(ren[2]);\n  renwin->SetWindowName(\"NormalsDemo\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renwin);\n\n  renwin->SetSize(900, 300);\n  ren[0]->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  ren[0]->GetActiveCamera()->SetPosition(1, 0, 0);\n  ren[0]->GetActiveCamera()->SetViewUp(0, 0, -1);\n  ren[0]->ResetCamera();\n\n  ren[0]->GetActiveCamera()->Azimuth(120);\n  ren[0]->GetActiveCamera()->Elevation(30);\n  ren[0]->GetActiveCamera()->Dolly(1.1);\n  ren[0]->ResetCameraClippingRange();\n\n  renwin->Render();\n  ren[0]->ResetCamera();\n  renwin->Render();\n\n  // Start\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> sphere;\n    sphere->SetPhiResolution(11);\n    sphere->SetThetaResolution(11);\n\n    sphere->Update();\n    polyData = sphere->GetOutput();\n  }\n  vtkNew<vtkCleanPolyData> clean;\n  clean->SetInputData(polyData);\n  clean->Update();\n  return clean->GetOutput();\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/NormalsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(NormalsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"NormalsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(NormalsDemo MACOSX_BUNDLE NormalsDemo.cxx )\n  target_link_libraries(NormalsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS NormalsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/NormalsDemo/#download-and-build-normalsdemo","title":"Download and Build NormalsDemo","text":"

        Click here to download NormalsDemo and its CMakeLists.txt file. Once the tarball NormalsDemo.tar has been downloaded and extracted,

        cd NormalsDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./NormalsDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Opacity/","title":"Opacity","text":"

        vtk-examples/Cxx/Visualization/Opacity

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Opacity/#code","title":"Code","text":"

        Opacity.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Cube\n  vtkNew<vtkCubeSource> cubeSource;\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->GetProperty()->SetOpacity(0.5);\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"LightGreen\").GetData());\n  sphereActor->GetProperty()->SetOpacity(0.7);\n  sphereActor->SetMapper(sphereMapper);\n\n  // Create renderers and add actors of plane and cube\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(cubeActor);\n  renderer->AddActor(sphereActor);\n\n  // Add renderer to renderwindow and render\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Opacity\");\n\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Azimuth(-22.5);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n\n  interactor->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Opacity/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Opacity)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Opacity: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Opacity MACOSX_BUNDLE Opacity.cxx )\n  target_link_libraries(Opacity PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Opacity\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Opacity/#download-and-build-opacity","title":"Download and Build Opacity","text":"

        Click here to download Opacity and its CMakeLists.txt file. Once the tarball Opacity.tar has been downloaded and extracted,

        cd Opacity/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Opacity\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/OrientedGlyphs/","title":"OrientedGlyphs","text":"

        vtk-examples/Cxx/Visualization/OrientedGlyphs

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/OrientedGlyphs/#code","title":"Code","text":"

        OrientedGlyphs.cxx

        #include <vtkActor.h>\n#include <vtkArrowSource.h>\n#include <vtkCamera.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyData> input;\n  input->ShallowCopy(sphereSource->GetOutput());\n\n  vtkNew<vtkArrowSource> arrowSource;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetSourceConnection(arrowSource->GetOutputPort());\n  glyph3D->SetVectorModeToUseNormal();\n  glyph3D->SetInputData(input);\n  glyph3D->SetScaleFactor(.2);\n  glyph3D->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph3D->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"OrientedGlyphs\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkGreen\").GetData());\n\n  renderWindow->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-0.399941, -1.070475, 2.931458);\n  camera->SetFocalPoint(-0.000000, -0.000000, 0.000000);\n  camera->SetViewUp(-0.028450, 0.940195, 0.339448);\n  camera->SetDistance(3.146318);\n  camera->SetClippingRange(1.182293, 5.626211);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/OrientedGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientedGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientedGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientedGlyphs MACOSX_BUNDLE OrientedGlyphs.cxx )\n  target_link_libraries(OrientedGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientedGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/OrientedGlyphs/#download-and-build-orientedglyphs","title":"Download and Build OrientedGlyphs","text":"

        Click here to download OrientedGlyphs and its CMakeLists.txt file. Once the tarball OrientedGlyphs.tar has been downloaded and extracted,

        cd OrientedGlyphs/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OrientedGlyphs\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/PointDataSubdivision/","title":"PointDataSubdivision","text":"

        vtk-examples/Cxx/Visualization/PointDataSubdivision

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/PointDataSubdivision/#description","title":"Description","text":""},{"location":"Cxx/Visualization/PointDataSubdivision/#introduction","title":"Introduction","text":"

        This example demonstrates the use of the vtkLinearSubdivisionFilter and vtkButterflySubdivisionFilter.

        In order to see the effects of these filters a triptych is created that demonstrates the effect of applying the filter.

        The user can select from a list of sources to render, specify whether normals are displayed, what type of shading to use and the number of normals to glyph.

        A representative set of sources to render are provided in the class called Sources. The user is encouraged to experiment with different sources to see the effect of the filters.

        "},{"location":"Cxx/Visualization/PointDataSubdivision/#adding-more-sources","title":"Adding more sources.","text":"

        If you add more sources, you may need to provide one or all of these filters:

        • A vtkTriangleFilter
        • A vtkPolyDataNormals filter
        • A vtkElevationFilter.
        • A vtkCleanPolyData filter.
        • For parametric sources, you may need to apply one of both of JoinUOff() or JoinVOff().

        The representative sources provided in the class Sources should provide good templates.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/PointDataSubdivision/#code","title":"Code","text":"

        PointDataSubdivision.cxx

        #include <vtkActor.h>\n#include <vtkActor2D.h>\n#include <vtkArrowSource.h>\n#include <vtkAxesActor.h>\n#include <vtkButterflySubdivisionFilter.h>\n#include <vtkCamera.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkCleanPolyData.h>\n#include <vtkColorSeries.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkConeSource.h>\n#include <vtkDataSetMapper.h>\n#include <vtkElevationFilter.h>\n#include <vtkGlyph3D.h>\n#include <vtkLinearSubdivisionFilter.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPNGWriter.h>\n#include <vtkParametricBoy.h>\n#include <vtkParametricEllipsoid.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricMobius.h>\n#include <vtkParametricRandomHills.h>\n#include <vtkParametricTorus.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderLargeImage.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextMapper.h>\n#include <vtkTextProperty.h>\n#include <vtkTriangleFilter.h>\n\n#include <algorithm>\n#include <iostream>\n#include <map>\n#include <string>\n\nnamespace {\n/**\n * If you add more sources, you may need to provide one or all of these filters:\n *  - A Triangle filter\n *  - A Normal filter\n *  - An elevation filter.\n *  - A CleanPolyData filter.\n *  - For parametric sources, we may need to apply one of both of JoinUOff() or\n * JoinVOff().\n *\n * Use the representative sources provided here as templates.\n */\n\nvoid ParametricTorusSource(vtkPolyData* src);\n\nvoid EllipsoidSource(vtkPolyData* src);\n\nvoid BoySource(vtkPolyData* src);\n\nvoid MobiusSource(vtkPolyData* src);\n\nvoid ParametricRandomHills(vtkPolyData* src);\n\nvoid SphereSource(vtkPolyData* src);\n\n/**\n * Make a torus as the source using vtkSuperquadricSource.\n */\nvoid SuperquadricSource(vtkPolyData* src);\n\nvoid ConeSource(vtkPolyData* src);\n\n/**\n * Make a lookup table using a predefined color series.\n *\n * @param scalarRange The range of the scalars to be coloured.\n *\n * @return A lookup table.\n */\nvtkSmartPointer<vtkColorTransferFunction> MakeLUT(double* scalarRange);\n\n/**\n * Create the actor for glyphing the normals.\n *\n * @param source the surface.\n * @param glyphPoints The number of points used by the mask filter.\n * @param scalarRange The range in terms of scalar minimum and maximum.\n * @param scaleFactor The scaling factor for the glyph.\n * @param lut The lookup table to use.\n *\n * @return The glyph actor.\n */\n\nvtkSmartPointer<vtkActor> GlyphActor(vtkPolyData* source, int glyphPoints,\n                                     double* scalarRange, double scaleFactor,\n                                     vtkColorTransferFunction* lut);\n\n/**\n * Create the actor for a surface.\n *\n * @param surface The surface.\n * @param scalarRange The range in terms of scalar minimum and maximum.\n * @param lut The lookup table to use.\n *\n * @return The actor for the surface.\n */\nvtkSmartPointer<vtkActor> MakeSurfaceActor(vtkPolyData* surface,\n                                           double* scalarRange,\n                                           vtkColorTransferFunction* lut);\n\n/**\n * Create a label.\n *\n * @param textLabel The label.\n * @param renWinSize The size of the render window. Used to set the font size.\n *\n * @return The actor for the text label.\n */\nvtkSmartPointer<vtkActor2D> MakeLabel(const char* textLabel, int renWinSize);\n\n/**\n * Make an axis actor.\n *\n * @return The axis actor.\n */\nvtkSmartPointer<vtkAxesActor> MakeAxesActor();\n\n/**\n * Create an orientation marker for a given renderer.\n *\n * @param renderer The renderer.\n * @param iren The interactor.\n *\n * @return: The orientation marker.\n */\nvtkSmartPointer<vtkOrientationMarkerWidget>\nMakeOrientationMarker(vtkRenderer* renderer, vtkRenderWindowInteractor* iren);\n\n/**\n * Save the image as a PNG.\n *\n * @param ren the renderer.\n * @param fn the file name.\n * @param magnification the magnification, usually 1.\n */\nvoid WritePNG(vtkRenderer* ren, char* fn, int magnification = 1);\n\n} // namespace\n\n/**\n * Demonstrates point data subdivision with the glyphing of normals on the\n * surface.\n *\n * This program takes a surface and displays three surfaces.\n *\n * The first surface is the original surface and the second and third surfaces\n * have had linear and butterfly interpolation applied respectively.\n *\n * The user can control the object to use, normal generation, type of shading\n * and number of points to use for the normals.\n */\nint main(int argc, char* argv[])\n{\n  if (argc < 1)\n  {\n    std::cerr << \"Missing parameters.\" << std::endl;\n    std::cerr << \"Usage: \" << argv[0]\n              << \"sourcetouse: (parametric_torus; parametric_ellipsoid; boy; \"\n                 \"sphere; mobius; cone; random_hills; superquadric)\"\n              << \"[displayNormals]\"\n              << \"[gouraudInterpolation]\"\n              << \"[glyphPoints]\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::map<std::string, int> availableSurfaces{{\"parametric_torus\", 0},\n                                               {\"parametric_ellipsoid\", 1},\n                                               {\"boy\", 2},\n                                               {\"sphere\", 3},\n                                               {\"mobius\", 4},\n                                               {\"cone\", 5},\n                                               {\"random_hills\", 6},\n                                               {\"superquadric\", 7}};\n\n  std::string desiredSurface{\"parametric_torus\"};\n  if (argc < 2)\n  {\n    std::cout << \"Using parametric_torus as the surface.\" << std::endl;\n  }\n  else\n  {\n    desiredSurface = argv[1];\n    std::transform(desiredSurface.begin(), desiredSurface.end(),\n                   desiredSurface.begin(),\n                   [](char c) { return std::tolower(c); });\n    if (availableSurfaces.find(desiredSurface) == availableSurfaces.end())\n    {\n      std::cout << \"The requested surface: \" << argv[1]\n                << \" not found, reverting to using parametric_torus.\"\n                << std::endl;\n      desiredSurface = \"parametric_torus\";\n    }\n  }\n\n  vtkNew<vtkPolyData> polyData;\n  switch (availableSurfaces[desiredSurface])\n  {\n  case 0:\n    ParametricTorusSource(polyData);\n    break;\n  case 1:\n    EllipsoidSource(polyData);\n    break;\n  case 2:\n    BoySource(polyData.GetPointer());\n    break;\n  case 3:\n    SphereSource(polyData);\n    break;\n  case 4:\n    MobiusSource(polyData);\n    break;\n  case 5:\n    ConeSource(polyData);\n    break;\n  case 6:\n    ParametricRandomHills(polyData);\n    break;\n  case 7:\n    SuperquadricSource(polyData);\n    break;\n  default:\n    ParametricTorusSource(polyData);\n  }\n\n  bool displayNormals = true;\n  if (argc > 2)\n  {\n    displayNormals = (atoi(argv[2]) != 0);\n  }\n\n  bool gouraudInterpolation = true;\n  if (argc > 3)\n  {\n    gouraudInterpolation = (atoi(argv[3]) != 0);\n  }\n\n  int glyphPoints = 50;\n  if (argc > 4)\n  {\n    glyphPoints = atoi(argv[4]);\n  }\n\n  // The size of the render window.\n  int renWinXSize = 1200;\n  int renWinYSize = renWinXSize / 3;\n  int minRenWinDim = std::min(renWinXSize, renWinYSize);\n\n  // [xMin, xMax, yMin, yMax, zMin, zMax]\n  double* bounds = polyData->GetBounds();\n  // Use this to scale the normal glyph.\n  std::vector<double> dims;\n  dims.push_back(std::abs(bounds[1] - bounds[0]));\n  dims.push_back(std::abs(bounds[3] - bounds[2]));\n  dims.push_back(std::abs(bounds[5] - bounds[4]));\n  double scaleFactor = *std::min_element(dims.begin(), dims.end()) * 0.2;\n\n  polyData->GetPointData()->GetScalars()->SetName(\"Elevation\");\n  double* scalarRange = polyData->GetScalarRange();\n\n  vtkNew<vtkButterflySubdivisionFilter> butterfly;\n  butterfly->SetInputData(polyData);\n  butterfly->SetNumberOfSubdivisions(3);\n  butterfly->Update();\n\n  vtkNew<vtkLinearSubdivisionFilter> linear;\n  linear->SetInputData(polyData);\n  linear->SetNumberOfSubdivisions(3);\n  linear->Update();\n\n  vtkSmartPointer<vtkColorTransferFunction> lut = MakeLUT(scalarRange);\n\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n  actors.push_back(MakeSurfaceActor(butterfly->GetOutput(), scalarRange, lut));\n  actors.push_back(MakeSurfaceActor(linear->GetOutput(), scalarRange, lut));\n  actors.push_back(MakeSurfaceActor(polyData, scalarRange, lut));\n\n  // Let's visualise the normals.\n  std::vector<vtkSmartPointer<vtkActor>> glyphActors;\n  if (displayNormals)\n  {\n    glyphActors.push_back(GlyphActor(butterfly->GetOutput(), glyphPoints,\n                                     scalarRange, scaleFactor, lut));\n    glyphActors.push_back(GlyphActor(linear->GetOutput(), glyphPoints,\n                                     scalarRange, scaleFactor, lut));\n    glyphActors.push_back(\n        GlyphActor(polyData, glyphPoints, scalarRange, scaleFactor, lut));\n  }\n\n  std::vector<vtkSmartPointer<vtkActor2D>> labelActors;\n  labelActors.push_back(MakeLabel(\"Butterfly Subdivision\", minRenWinDim));\n  labelActors.push_back(MakeLabel(\"Linear Subdivision\", minRenWinDim));\n  labelActors.push_back(MakeLabel(\"Original\", minRenWinDim));\n\n  std::vector<vtkSmartPointer<vtkRenderer>> ren;\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren.push_back(vtkSmartPointer<vtkRenderer>::New());\n  ren[2]->SetViewport(0, 0, 1.0 / 3.0, 1);         // Original\n  ren[1]->SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1); // Linear\n  ren[0]->SetViewport(2.0 / 3.0, 0, 1, 1);         // Butterfly\n\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkNamedColors> nc;\n\n  // Orientation markers.\n  std::vector<vtkSmartPointer<vtkOrientationMarkerWidget>> om;\n\n  // Shared camera.\n  vtkNew<vtkCamera> camera;\n\n  // Make the imaging pipelines.\n  for (unsigned int i = 0; i < ren.size(); ++i)\n  {\n    renWin->AddRenderer(ren[i]);\n\n    ren[i]->AddActor(actors[i]);\n    ren[i]->AddActor(labelActors[i]);\n    ren[i]->SetBackground(nc->GetColor3d(\"SlateGray\").GetData());\n    ren[i]->SetActiveCamera(camera);\n    if (displayNormals)\n    {\n      ren[i]->AddActor(glyphActors[i]);\n    }\n\n    om.push_back(MakeOrientationMarker(ren[i], iren));\n  }\n  renWin->SetSize(renWinXSize, renWinYSize);\n\n  iren->Initialize();\n\n  if (gouraudInterpolation)\n  {\n    for (unsigned int i = 0; i < actors.size(); ++i)\n    {\n      actors[i]->GetProperty()->SetInterpolationToGouraud();\n    }\n  }\n  else\n  {\n    for (unsigned int i = 0; i < actors.size(); ++i)\n    {\n      actors[i]->GetProperty()->SetInterpolationToFlat();\n    }\n  }\n\n  renWin->Render();\n  ren[0]->ResetCamera();\n  renWin->Render();\n  renWin->SetWindowName(\"PointDataSubdivision\");\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid ParametricTorusSource(vtkPolyData* src)\n{\n  vtkNew<vtkParametricTorus> torus;\n  torus->JoinUOff();\n  torus->JoinVOff();\n\n  vtkNew<vtkParametricFunctionSource> torusSource;\n  torusSource->SetParametricFunction(torus);\n  torusSource->SetScalarModeToZ();\n  torusSource->Update();\n\n  src->ShallowCopy(torusSource->GetOutput());\n}\n\nvoid EllipsoidSource(vtkPolyData* src)\n{\n  vtkNew<vtkParametricEllipsoid> ellipsoid;\n  ellipsoid->SetXRadius(0.5);\n  ellipsoid->SetYRadius(1.0);\n  ellipsoid->SetZRadius(2.0);\n  ellipsoid->JoinUOff();\n  // ellipsoid->JoinVOff();\n\n  vtkNew<vtkParametricFunctionSource> ellipsoidSource;\n  ellipsoidSource->SetParametricFunction(ellipsoid);\n  ellipsoidSource->SetScalarModeToZ();\n  ellipsoidSource->Update();\n\n  src->ShallowCopy(ellipsoidSource->GetOutput());\n}\n\nvoid BoySource(vtkPolyData* src)\n{\n  vtkNew<vtkParametricBoy> boy;\n  boy->JoinUOff();\n  // boy->JoinVOff();\n\n  vtkNew<vtkParametricFunctionSource> boySource;\n  boySource->SetParametricFunction(boy);\n  boySource->SetScalarModeToZ();\n  boySource->Update();\n  src->ShallowCopy(boySource->GetOutput());\n}\n\nvoid MobiusSource(vtkPolyData* src)\n{\n  vtkNew<vtkParametricMobius> mobius;\n  mobius->SetRadius(2);\n  mobius->SetMinimumV(-0.5);\n  mobius->SetMaximumV(0.5);\n  mobius->JoinUOff();\n\n  vtkNew<vtkParametricFunctionSource> mobiusSource;\n  mobiusSource->SetParametricFunction(mobius);\n  mobiusSource->SetScalarModeToX();\n  mobiusSource->Update();\n\n  src->ShallowCopy(mobiusSource->GetOutput());\n}\n\nvoid ParametricRandomHills(vtkPolyData* src)\n{\n  vtkNew<vtkParametricRandomHills> randomHills;\n  // randomHills->AllowRandomGenerationOff();\n  randomHills->SetRandomSeed(1);\n  randomHills->SetNumberOfHills(30);\n\n  vtkNew<vtkParametricFunctionSource> randomHillsSource;\n  randomHillsSource->SetParametricFunction(randomHills);\n  randomHillsSource->SetScalarModeToZ();\n  randomHillsSource->SetUResolution(10);\n  randomHillsSource->SetVResolution(10);\n  randomHillsSource->Update();\n\n  src->ShallowCopy(randomHillsSource->GetOutput());\n}\n\nvoid SphereSource(vtkPolyData* src)\n{\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetPhiResolution(11);\n  sphere->SetThetaResolution(11);\n  sphere->Update();\n  double* sphereBounds = sphere->GetOutput()->GetBounds();\n\n  vtkNew<vtkElevationFilter> elev;\n  elev->SetInputConnection(sphere->GetOutputPort());\n  elev->SetLowPoint(0, sphereBounds[2], 0);\n  elev->SetHighPoint(0, sphereBounds[3], 0);\n  elev->Update();\n\n  src->ShallowCopy(elev->GetPolyDataOutput());\n}\n\nvoid SuperquadricSource(vtkPolyData* src)\n{\n  vtkNew<vtkSuperquadricSource> source;\n  source->SetCenter(0.0, 0.0, 0.0);\n  source->SetScale(1.0, 1.0, 1.0);\n  source->SetPhiResolution(64);\n  source->SetThetaResolution(64);\n  source->SetThetaRoundness(1);\n  source->SetThickness(0.5);\n  source->SetSize(10);\n  source->SetToroidal(1);\n\n  // The quadric is made of strips, so pass it through a triangle filter as\n  // the curvature filter only operates on polys.\n  vtkNew<vtkTriangleFilter> tri;\n  tri->SetInputConnection(source->GetOutputPort());\n\n  // The quadric has nasty discontinuities from the way the edges are\n  // generated so let's pass it though a CleanPolyDataFilter and merge any\n  // points which are coincident, or very close.\n  vtkNew<vtkCleanPolyData> cleaner;\n  cleaner->SetInputConnection(tri->GetOutputPort());\n  cleaner->SetTolerance(0.005);\n  cleaner->Update();\n  double* cleanerBounds = cleaner->GetOutput()->GetBounds();\n\n  vtkNew<vtkElevationFilter> elev;\n  elev->SetInputConnection(cleaner->GetOutputPort());\n  elev->SetLowPoint(0, cleanerBounds[2], 0);\n  elev->SetHighPoint(0, cleanerBounds[3], 0);\n  elev->Update();\n\n  src->ShallowCopy(elev->GetPolyDataOutput());\n}\n\nvoid ConeSource(vtkPolyData* src)\n{\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(6);\n  cone->CappingOn();\n  cone->Update();\n  double* coneBounds = cone->GetOutput()->GetBounds();\n\n  vtkNew<vtkPolyDataNormals> coneNormals;\n  coneNormals->SetInputConnection(cone->GetOutputPort());\n\n  vtkNew<vtkElevationFilter> elev;\n  elev->SetInputConnection(coneNormals->GetOutputPort());\n  elev->SetLowPoint(coneBounds[0], 0, 0);\n  elev->SetHighPoint(coneBounds[1], 0, 0);\n\n  // vtkButterflySubdivisionFilter and vtkLinearSubdivisionFilter operate on\n  // triangles.\n  vtkNew<vtkTriangleFilter> tf;\n  tf->SetInputConnection(elev->GetOutputPort());\n  tf->Update();\n\n  src->ShallowCopy(tf->GetOutput());\n}\n\nvtkSmartPointer<vtkColorTransferFunction> MakeLUT(double* scalarRange)\n{\n  vtkNew<vtkColorSeries> colorSeries;\n  // Select a color scheme.\n  // for (unsigned int i = 0; i < 62; ++i)\n  //{\n  //  colorSeries->SetColorScheme(i);\n  //  std::cout << \"Colour scheme: \" << colorSeries->GetColorScheme() << \": \" <<\n  //  colorSeries->GetColorSchemeName();\n  //}\n\n  // Colour scheme 61: Brewer Qualitative Set3\n  colorSeries->SetColorScheme(61);\n  // We use this colour series to create the transfer function.\n  vtkNew<vtkColorTransferFunction> lut;\n  lut->SetColorSpaceToHSV();\n  int numColors = colorSeries->GetNumberOfColors();\n  for (int i = 0; i < numColors; ++i)\n  {\n    vtkColor3ub color = colorSeries->GetColor(i);\n    std::vector<double> c;\n    for (unsigned int j = 0; j < 3; ++j)\n    {\n      c.push_back(color[j] / 255.0);\n    }\n    double t = scalarRange[0] +\n        (scalarRange[1] - scalarRange[0]) / (numColors - 1) * i;\n    lut->AddRGBPoint(t, c[0], c[1], c[2]);\n  }\n  return lut;\n}\n\nvtkSmartPointer<vtkActor> GlyphActor(vtkPolyData* source, int glyphPoints,\n                                     double* scalarRange, double scaleFactor,\n                                     vtkColorTransferFunction* lut)\n{\n  vtkNew<vtkArrowSource> arrowSource;\n  // Subsample the dataset.\n  vtkNew<vtkMaskPoints> maskPts;\n  maskPts->SetInputData(source);\n  maskPts->SetOnRatio(source->GetNumberOfPoints() / glyphPoints);\n  maskPts->SetRandomMode(1);\n\n  vtkNew<vtkGlyph3D> arrowGlyph;\n  arrowGlyph->SetScaleFactor(scaleFactor);\n  arrowGlyph->SetVectorModeToUseNormal();\n  arrowGlyph->SetColorModeToColorByScalar();\n  arrowGlyph->SetScaleModeToScaleByVector();\n  arrowGlyph->OrientOn();\n  arrowGlyph->SetSourceConnection(arrowSource->GetOutputPort());\n  arrowGlyph->SetInputConnection(maskPts->GetOutputPort());\n  arrowGlyph->Update();\n\n  vtkNew<vtkDataSetMapper> arrowGlyphMapper;\n  // Colour by scalars.\n  arrowGlyphMapper->SetScalarRange(scalarRange);\n  arrowGlyphMapper->SetColorModeToMapScalars();\n  arrowGlyphMapper->ScalarVisibilityOn();\n  arrowGlyphMapper->SetLookupTable(lut);\n  arrowGlyphMapper->SetInputConnection(arrowGlyph->GetOutputPort());\n\n  vtkNew<vtkActor> glyphActor;\n  glyphActor->SetMapper(arrowGlyphMapper);\n  return glyphActor;\n}\n\nvtkSmartPointer<vtkActor> MakeSurfaceActor(vtkPolyData* surface,\n                                           double* scalarRange,\n                                           vtkColorTransferFunction* lut)\n{\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(surface);\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(scalarRange);\n  mapper->SetColorModeToMapScalars();\n  mapper->ScalarVisibilityOn();\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  return actor;\n}\n\nvtkSmartPointer<vtkActor2D> MakeLabel(const char* textLabel, int renWinSize)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create one text property for all\n  vtkNew<vtkTextProperty> textProperty;\n  textProperty->SetJustificationToCentered();\n  textProperty->SetFontSize(int(renWinSize / 20));\n\n  vtkNew<vtkTextMapper> mapper;\n  mapper->SetInput(textLabel);\n  mapper->SetTextProperty(textProperty);\n\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n  actor->SetPosition(renWinSize / 2.0, renWinSize / 20);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  return actor;\n}\n\nvtkSmartPointer<vtkAxesActor> MakeAxesActor()\n{\n  vtkNew<vtkAxesActor> axes;\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(\"X\");\n  axes->SetYAxisLabelText(\"Y\");\n  axes->SetZAxisLabelText(\"Z\");\n  axes->SetTotalLength(1.0, 1.0, 1.0);\n  axes->SetCylinderRadius(1.0 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.75 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.0 * axes->GetSphereRadius());\n  axes->GetXAxisCaptionActor2D()->GetTextActor()->GetScaledTextProperty();\n  axes->GetXAxisCaptionActor2D()->GetTextActor()->SetTextScaleModeToNone();\n  axes->GetYAxisCaptionActor2D()->GetTextActor()->GetScaledTextProperty();\n  axes->GetYAxisCaptionActor2D()->GetTextActor()->SetTextScaleModeToNone();\n  axes->GetZAxisCaptionActor2D()->GetTextActor()->GetScaledTextProperty();\n  axes->GetZAxisCaptionActor2D()->GetTextActor()->SetTextScaleModeToNone();\n  return axes;\n}\n\nvtkSmartPointer<vtkOrientationMarkerWidget>\nMakeOrientationMarker(vtkRenderer* renderer, vtkRenderWindowInteractor* iren)\n{\n  vtkNew<vtkOrientationMarkerWidget> om;\n  auto axesActor = MakeAxesActor();\n  om->SetOrientationMarker(axesActor);\n  // Position lower left in the viewport.\n  om->SetViewport(0, 0, 0.2, 0.2);\n  om->SetInteractor(iren);\n  om->SetDefaultRenderer(renderer);\n  om->EnabledOn();\n  om->InteractiveOn();\n  return om;\n}\n\nvoid WritePNG(vtkRenderer* ren, char* fn, int magnification)\n{\n  vtkNew<vtkRenderLargeImage> renLgeIm;\n  vtkNew<vtkPNGWriter> imgWriter;\n  renLgeIm->SetInput(ren);\n  renLgeIm->SetMagnification(magnification);\n  imgWriter->SetInputConnection(renLgeIm->GetOutputPort());\n  imgWriter->SetFileName(fn);\n  imgWriter->Write();\n}\n\n} // namespace\n
        "},{"location":"Cxx/Visualization/PointDataSubdivision/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointDataSubdivision)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersHybrid\n  FiltersModeling\n  FiltersSources\n  IOImage\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointDataSubdivision: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointDataSubdivision MACOSX_BUNDLE PointDataSubdivision.cxx )\n  target_link_libraries(PointDataSubdivision PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointDataSubdivision\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/PointDataSubdivision/#download-and-build-pointdatasubdivision","title":"Download and Build PointDataSubdivision","text":"

        Click here to download PointDataSubdivision and its CMakeLists.txt file. Once the tarball PointDataSubdivision.tar has been downloaded and extracted,

        cd PointDataSubdivision/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointDataSubdivision\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/PointSize/","title":"PointSize","text":"

        vtk-examples/Cxx/Visualization/PointSize

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/PointSize/#description","title":"Description","text":"

        This example demonstrates how to change the size of an actor's points.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/PointSize/#code","title":"Code","text":"

        PointSize.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create points.\n  vtkNew<vtkPointSource> src;\n  src->SetCenter(0, 0, 0);\n  src->SetNumberOfPoints(10);\n  src->SetRadius(5);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(src->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetPointSize(5);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PointSize\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBLue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/PointSize/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PointSize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PointSize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PointSize MACOSX_BUNDLE PointSize.cxx )\n  target_link_libraries(PointSize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PointSize\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/PointSize/#download-and-build-pointsize","title":"Download and Build PointSize","text":"

        Click here to download PointSize and its CMakeLists.txt file. Once the tarball PointSize.tar has been downloaded and extracted,

        cd PointSize/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PointSize\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ProgrammableGlyphFilter/","title":"ProgrammableGlyphFilter","text":"

        vtk-examples/Cxx/Visualization/ProgrammableGlyphFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ProgrammableGlyphFilter/#code","title":"Code","text":"

        ProgrammableGlyphFilter.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProgrammableGlyphFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nvoid CalcGlyph(void* arg);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(5, 0, 0);\n  points->InsertNextPoint(10, 0, 0);\n\n  // Combine into a polydata.\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n\n  vtkNew<vtkProgrammableGlyphFilter> glyphFilter;\n  glyphFilter->SetInputData(polydata);\n  glyphFilter->SetGlyphMethod(CalcGlyph, glyphFilter);\n  // need a default glyph, but this should not be used\n  vtkNew<vtkConeSource> coneSource;\n  glyphFilter->SetSourceConnection(coneSource->GetOutputPort());\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyphFilter->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ProgrammableGlyphFilter\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid CalcGlyph(void* arg)\n{\n\n  vtkProgrammableGlyphFilter* glyphFilter = (vtkProgrammableGlyphFilter*)arg;\n\n  if (!glyphFilter)\n  {\n    std::cerr << \"glyphFilter is not valid!\" << std::endl;\n  }\n  double pointCoords[3];\n  glyphFilter->GetPoint(pointCoords);\n\n  std::cout << \"Calling CalcGlyph for point \" << glyphFilter->GetPointId()\n            << std::endl;\n  std::cout << \"Point coords are: \" << pointCoords[0] << \" \" << pointCoords[1]\n            << \" \" << pointCoords[2] << std::endl;\n  if (glyphFilter->GetPointId() == 0)\n  {\n    vtkNew<vtkConeSource> coneSource;\n    coneSource->SetCenter(pointCoords);\n    glyphFilter->SetSourceConnection(coneSource->GetOutputPort());\n  }\n  else if (glyphFilter->GetPointId() == 1)\n  {\n    vtkNew<vtkCubeSource> cubeSource;\n    cubeSource->SetCenter(pointCoords);\n    glyphFilter->SetSourceConnection(cubeSource->GetOutputPort());\n  }\n  else if (glyphFilter->GetPointId() == 2)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetCenter(pointCoords);\n    glyphFilter->SetSourceConnection(sphereSource->GetOutputPort());\n  }\n}\n\n} // namespace```\n###CMakeLists.txt\n```cmake\ncmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProgrammableGlyphFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersProgrammable\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProgrammableGlyphFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProgrammableGlyphFilter MACOSX_BUNDLE ProgrammableGlyphFilter.cxx )\n  target_link_libraries(ProgrammableGlyphFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProgrammableGlyphFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ProgrammableGlyphFilter/#download-and-build-programmableglyphfilter","title":"Download and Build ProgrammableGlyphFilter","text":"

        Click here to download ProgrammableGlyphFilter and its CMakeLists.txt file. Once the tarball ProgrammableGlyphFilter.tar has been downloaded and extracted,

        cd ProgrammableGlyphFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ProgrammableGlyphFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ProjectSphere/","title":"ProjectSphere","text":"

        vtk-examples/Cxx/Visualization/ProjectSphere

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ProjectSphere/#code","title":"Code","text":"

        ProjectSphere.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkElevationFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSuperEllipsoid.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProjectSphereFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkParametricSuperEllipsoid> surface;\n  surface->SetN1(2.0);\n  surface->SetN2(0.5);\n\n  vtkNew<vtkParametricFunctionSource> source;\n  source->SetParametricFunction(surface);\n\n  vtkNew<vtkElevationFilter> elevationFilter;\n  elevationFilter->SetInputConnection(source->GetOutputPort());\n  elevationFilter->SetLowPoint(0.0, 0.0, -4.0);\n  elevationFilter->SetHighPoint(0.0, 0.0, 4.0);\n  elevationFilter->Update();\n\n  // Deep copy the point data since in some versions of VTK,\n  // the ProjectSphereFilter modifies the input point data.\n  vtkNew<vtkPolyData> pd1;\n  pd1->DeepCopy(elevationFilter->GetOutput());\n\n  vtkNew<vtkProjectSphereFilter> sphereProject1;\n  sphereProject1->SetInputConnection(elevationFilter->GetOutputPort());\n  sphereProject1->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(sphereProject1->GetOutputPort());\n  mapper1->SetScalarRange(\n      sphereProject1->GetOutput()->GetPointData()->GetScalars()->GetRange());\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputData(pd1);\n  mapper2->SetScalarRange(pd1->GetPointData()->GetScalars()->GetRange());\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n\n  // A render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers.\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"RosyBrown\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  leftRenderer->AddActor(actor2);\n  rightRenderer->AddActor(actor1);\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  leftRenderer->GetActiveCamera()->Azimuth(30);\n  leftRenderer->GetActiveCamera()->Elevation(-30);\n  leftRenderer->ResetCamera();\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ProjectSphere\");\n\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ProjectSphere/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProjectSphere)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProjectSphere: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProjectSphere MACOSX_BUNDLE ProjectSphere.cxx )\n  target_link_libraries(ProjectSphere PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProjectSphere\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ProjectSphere/#download-and-build-projectsphere","title":"Download and Build ProjectSphere","text":"

        Click here to download ProjectSphere and its CMakeLists.txt file. Once the tarball ProjectSphere.tar has been downloaded and extracted,

        cd ProjectSphere/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ProjectSphere\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ProteinRibbons/","title":"ProteinRibbons","text":"

        vtk-examples/Cxx/Visualization/ProteinRibbons

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ProteinRibbons/#description","title":"Description","text":"

        This example reads Protein Data Bank files. The example expects a file in .pdb format.

        Here src/Testing/Data/2j6g.pdb is the sample file.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ProteinRibbons/#code","title":"Code","text":"

        ProteinRibbons.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPDBReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProteinRibbonFilter.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.pdb e.g. 2j6g.pdb\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string fileName(argv[1]);\n\n  // read protein from pdb\n  vtkNew<vtkPDBReader> reader;\n  reader->SetFileName(fileName.c_str());\n\n  // setup ribbon filter\n  vtkNew<vtkProteinRibbonFilter> ribbonFilter;\n  ribbonFilter->SetInputConnection(reader->GetOutputPort());\n\n  // setup poly data mapper\n  vtkNew<vtkPolyDataMapper> polyDataMapper;\n  polyDataMapper->SetInputConnection(ribbonFilter->GetOutputPort());\n\n  // setup actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(polyDataMapper);\n  actor->GetProperty()->SetDiffuse(.7);\n  actor->GetProperty()->SetSpecular(.5);\n  actor->GetProperty()->SetSpecularPower(80.0);\n\n  // setup render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  vtkInteractorStyleSwitch* style =\n      dynamic_cast<vtkInteractorStyleSwitch*>(interactor->GetInteractorStyle());\n  style->SetCurrentStyleToTrackballCamera();\n\n  vtkNew<vtkNamedColors> colors;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ProteinRibbons\");\n\n  renderWindow->Render();\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(45);\n  renderer->GetActiveCamera()->Elevation(45);\n  renderer->GetActiveCamera()->Zoom(1.7);\n  renderer->ResetCameraClippingRange();\n  renderWindow->Render();\n\n  // Finally render the scene\n  renderWindow->SetMultiSamples(0);\n  interactor->Initialize();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ProteinRibbons/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProteinRibbons)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  DomainsChemistry\n  DomainsChemistryOpenGL2\n  IOChemistry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProteinRibbons: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProteinRibbons MACOSX_BUNDLE ProteinRibbons.cxx )\n  target_link_libraries(ProteinRibbons PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProteinRibbons\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ProteinRibbons/#download-and-build-proteinribbons","title":"Download and Build ProteinRibbons","text":"

        Click here to download ProteinRibbons and its CMakeLists.txt file. Once the tarball ProteinRibbons.tar has been downloaded and extracted,

        cd ProteinRibbons/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ProteinRibbons\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/QuadraticSurface/","title":"QuadraticSurface","text":"

        vtk-examples/Cxx/Visualization/QuadraticSurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/QuadraticSurface/#description","title":"Description","text":"

        This example demonstrates how to create and display a quadratic surface.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/QuadraticSurface/#code","title":"Code","text":"

        QuadraticSurface.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the quadric function definition\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0);\n\n  // Sample the quadric function\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(quadric);\n  double xmin = 0, xmax = 1, ymin = 0, ymax = 1, zmin = 0, zmax = 1;\n  sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n  vtkNew<vtkContourFilter> contourFilter;\n  contourFilter->SetInputConnection(sample->GetOutputPort());\n  contourFilter->GenerateValues(1, 1.0, 1.0);\n  contourFilter->Update();\n\n  // Visualize\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(contourFilter->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"QuadraticSurface\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"LimeGreen\").GetData());\n\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Elevation(-45);\n  renderer->GetActiveCamera()->Azimuth(45);\n  renderer->ResetCamera();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/QuadraticSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadraticSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadraticSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadraticSurface MACOSX_BUNDLE QuadraticSurface.cxx )\n  target_link_libraries(QuadraticSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadraticSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/QuadraticSurface/#download-and-build-quadraticsurface","title":"Download and Build QuadraticSurface","text":"

        Click here to download QuadraticSurface and its CMakeLists.txt file. Once the tarball QuadraticSurface.tar has been downloaded and extracted,

        cd QuadraticSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QuadraticSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/QuadricLODActor/","title":"QuadricLODActor","text":"

        vtk-examples/Cxx/Visualization/QuadricLODActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/QuadricLODActor/#description","title":"Description","text":"

        If you have a fast graphics card you may not see a difference with the sphere model.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/QuadricLODActor/#code","title":"Code","text":"

        QuadricLODActor.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadricLODActor.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // High res sphere.\n  vtkNew<vtkSphereSource> highResSphereSource;\n  highResSphereSource->SetThetaResolution(200);\n  highResSphereSource->SetPhiResolution(200);\n  highResSphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> highResMapper;\n  highResMapper->SetInputConnection(highResSphereSource->GetOutputPort());\n\n  vtkNew<vtkQuadricLODActor> actor;\n  actor->SetMapper(highResMapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"QuadricLODActor\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindowInteractor->SetDesiredUpdateRate(1e20);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/QuadricLODActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadricLODActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadricLODActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadricLODActor MACOSX_BUNDLE QuadricLODActor.cxx )\n  target_link_libraries(QuadricLODActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadricLODActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/QuadricLODActor/#download-and-build-quadriclodactor","title":"Download and Build QuadricLODActor","text":"

        Click here to download QuadricLODActor and its CMakeLists.txt file. Once the tarball QuadricLODActor.tar has been downloaded and extracted,

        cd QuadricLODActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QuadricLODActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/QuadricVisualization/","title":"QuadricVisualization","text":"

        vtk-examples/Cxx/Visualization/QuadricVisualization

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/QuadricVisualization/#description","title":"Description","text":"

        Visualizing a quadric function F(x,y,z) = c

        This example is inspired by the Figure 4-1, page 83, in the VTK Book.

        Info

        See Figure 4-1 in Chapter 4 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/QuadricVisualization/#code","title":"Code","text":"

        QuadricVisualization.cxx

        #include <vtkActor.h>\n#include <vtkAppendFilter.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractVOI.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\nnamespace {\nvoid CreateIsosurface(vtkSampleFunction* function, vtkActor* actor,\n                      unsigned int numberOfContours = 5);\n\nvoid CreatePlanes(vtkSampleFunction* function, vtkActor* actor,\n                  unsigned int numberOfPlanes);\n\nvoid CreateContours(vtkSampleFunction* function, vtkActor* actor,\n                    unsigned int numberOfPlanes, unsigned int numberOfContours);\n\nvoid CreateOutline(vtkSampleFunction* function, vtkActor* actor);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->SetSize(640, 480);\n\n  //\n  // Create the surface of the implicit function.\n  //\n  // double range[2];\n\n  // Sample the quadric function.\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(1, 2, 3, 0, 1, 0, 0, 0, 0, 0);\n\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(25, 25, 25);\n  sample->SetImplicitFunction(quadric);\n\n  vtkNew<vtkActor> isoActor;\n  CreateIsosurface(sample, isoActor);\n  vtkNew<vtkActor> outlineIsoActor;\n  CreateOutline(sample, outlineIsoActor);\n\n  vtkNew<vtkActor> planesActor;\n  CreatePlanes(sample, planesActor, 3);\n  vtkNew<vtkActor> outlinePlanesActor;\n  CreateOutline(sample, outlinePlanesActor);\n  planesActor->AddPosition(isoActor->GetBounds()[0] * 2.0, 0, 0);\n  outlinePlanesActor->AddPosition(isoActor->GetBounds()[0] * 2.0, 0, 0);\n\n  vtkNew<vtkActor> contourActor;\n  CreateContours(sample, contourActor, 3, 15);\n  vtkNew<vtkActor> outlineContourActor;\n  CreateOutline(sample, outlineContourActor);\n  contourActor->AddPosition(isoActor->GetBounds()[0] * 4.0, 0, 0);\n  outlineContourActor->AddPosition(isoActor->GetBounds()[0] * 4.0, 0, 0);\n\n  renderer->AddActor(planesActor);\n  renderer->AddActor(outlinePlanesActor);\n  renderer->AddActor(contourActor);\n  renderer->AddActor(outlineContourActor);\n  renderer->AddActor(isoActor);\n  renderer->AddActor(outlineIsoActor);\n\n  renderer->TwoSidedLightingOn();\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Try to set camera to match figure on book.\n  renderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, -1);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Elevation(20);\n  renderer->GetActiveCamera()->Azimuth(10);\n  renderer->GetActiveCamera()->Dolly(1.2);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"QuadricVisualization\");\n\n  renderWindow->Render();\n\n  // interact with data.\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateIsosurface(vtkSampleFunction* function, vtkActor* actor,\n                      unsigned int numberOfContours)\n{\n  double range[2];\n  // Generate the implicit surface.\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(function->GetOutputPort());\n  range[0] = 1.0;\n  range[1] = 6.0;\n  contour->GenerateValues(numberOfContours, range);\n\n  // Map contour\n  vtkNew<vtkPolyDataMapper> isosurfaceMapper;\n  isosurfaceMapper->SetInputConnection(contour->GetOutputPort());\n  isosurfaceMapper->SetScalarRange(0, 7);\n\n  actor->SetMapper(isosurfaceMapper);\n  return;\n}\n\nvoid CreatePlanes(vtkSampleFunction* function, vtkActor* actor,\n                  unsigned int numberOfPlanes)\n{\n  //\n  // Extract planes from the implicit function.\n  //\n\n  vtkNew<vtkAppendFilter> append;\n\n  int dims[3];\n  function->GetSampleDimensions(dims);\n  int sliceIncr = (dims[2] - 1) / (numberOfPlanes + 1);\n\n  int slice = -4;\n  for (unsigned int i = 0; i < numberOfPlanes; ++i)\n  {\n    vtkNew<vtkExtractVOI> extract;\n    extract->SetInputConnection(function->GetOutputPort());\n    extract->SetVOI(0, dims[0] - 1, 0, dims[1] - 1, slice + sliceIncr,\n                    slice + sliceIncr);\n    append->AddInputConnection(extract->GetOutputPort());\n    slice += sliceIncr;\n  }\n  append->Update();\n\n  // Map planes.\n  vtkNew<vtkDataSetMapper> planesMapper;\n  planesMapper->SetInputConnection(append->GetOutputPort());\n  planesMapper->SetScalarRange(0, 7);\n\n  actor->SetMapper(planesMapper);\n  actor->GetProperty()->SetAmbient(1.);\n  return;\n}\n\nvoid CreateContours(vtkSampleFunction* function, vtkActor* actor,\n                    unsigned int numberOfPlanes, unsigned int numberOfContours)\n{\n  //\n  // Extract planes from the implicit function.\n  //\n\n  vtkNew<vtkAppendFilter> append;\n\n  int dims[3];\n  function->GetSampleDimensions(dims);\n  int sliceIncr = (dims[2] - 1) / (numberOfPlanes + 1);\n\n  int slice = -4;\n  for (unsigned int i = 0; i < numberOfPlanes; ++i)\n  {\n    vtkNew<vtkExtractVOI> extract;\n    extract->SetInputConnection(function->GetOutputPort());\n    extract->SetVOI(0, dims[0] - 1, 0, dims[1] - 1, slice + sliceIncr,\n                    slice + sliceIncr);\n    double range[2];\n    range[0] = 1.0;\n    range[1] = 6.0;\n    vtkNew<vtkContourFilter> contour;\n    contour->SetInputConnection(extract->GetOutputPort());\n    contour->GenerateValues(numberOfContours, range);\n    append->AddInputConnection(contour->GetOutputPort());\n    slice += sliceIncr;\n  }\n  append->Update();\n\n  // Map contours.\n  vtkNew<vtkDataSetMapper> contoursMapper;\n  contoursMapper->SetInputConnection(append->GetOutputPort());\n  contoursMapper->SetScalarRange(0, 7);\n\n  actor->SetMapper(contoursMapper);\n  actor->GetProperty()->SetAmbient(1.);\n  return;\n}\n\nvoid CreateOutline(vtkSampleFunction* source, vtkActor* actor)\n{\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(source->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  actor->SetMapper(outlineMapper);\n  return;\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/QuadricVisualization/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(QuadricVisualization)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  ImagingCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"QuadricVisualization: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(QuadricVisualization MACOSX_BUNDLE QuadricVisualization.cxx )\n  target_link_libraries(QuadricVisualization PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS QuadricVisualization\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/QuadricVisualization/#download-and-build-quadricvisualization","title":"Download and Build QuadricVisualization","text":"

        Click here to download QuadricVisualization and its CMakeLists.txt file. Once the tarball QuadricVisualization.tar has been downloaded and extracted,

        cd QuadricVisualization/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./QuadricVisualization\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/RandomProbe/","title":"RandomProbe","text":"

        vtk-examples/Cxx/Visualization/RandomProbe

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/RandomProbe/#code","title":"Code","text":"

        RandomProbe.cxx

        #include <vtkActor.h>\n#include <vtkCone.h>\n#include <vtkDataSetMapper.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphereSource.h>\n#include <vtkThreshold.h>\n#include <vtkThresholdPoints.h>\n\nint main(int argc, char* argv[])\n{\n  int resolution = 50;\n  if (argc > 1)\n  {\n    resolution = atoi(argv[1]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sampled cone.\n  vtkNew<vtkCone> implicitCone;\n  implicitCone->SetAngle(30.0);\n\n  double radius = 1.0;\n  vtkNew<vtkSampleFunction> sampledCone;\n  sampledCone->SetSampleDimensions(resolution, resolution, resolution);\n  double xMin = -radius * 2.0;\n  double xMax = radius * 2.0;\n  sampledCone->SetModelBounds(xMin, xMax, xMin, xMax, xMin, xMax);\n  sampledCone->SetImplicitFunction(implicitCone);\n\n  vtkNew<vtkThreshold> thresholdCone;\n  thresholdCone->SetInputConnection(sampledCone->GetOutputPort());\n  thresholdCone->SetLowerThreshold(0);\n  thresholdCone->SetThresholdFunction(vtkThreshold::THRESHOLD_LOWER);\n\n  vtkNew<vtkPointSource> randomPoints;\n  randomPoints->SetCenter(0.0, 0.0, 0.0);\n  randomPoints->SetNumberOfPoints(10000);\n  randomPoints->SetDistributionToUniform();\n  randomPoints->SetRadius(xMax);\n\n  // Probe the cone dataset with random points.\n  vtkNew<vtkProbeFilter> randomProbe;\n  randomProbe->SetInputConnection(0, randomPoints->GetOutputPort());\n  randomProbe->SetInputConnection(1, thresholdCone->GetOutputPort());\n  randomProbe->Update();\n  randomProbe->GetOutput()->GetPointData()->SetActiveScalars(\n      \"vtkValidPointMask\");\n\n  vtkNew<vtkThresholdPoints> selectPoints;\n  selectPoints->SetInputConnection(randomProbe->GetOutputPort());\n  selectPoints->ThresholdByUpper(1.0);\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetRadius(0.025);\n\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetSourceConnection(sphere->GetOutputPort());\n  glyph->SetInputConnection(selectPoints->GetOutputPort());\n\n  // Create a mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(glyph->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RandomProbe\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"RoyalBlue\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/RandomProbe/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RandomProbe)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RandomProbe: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RandomProbe MACOSX_BUNDLE RandomProbe.cxx )\n  target_link_libraries(RandomProbe PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RandomProbe\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/RandomProbe/#download-and-build-randomprobe","title":"Download and Build RandomProbe","text":"

        Click here to download RandomProbe and its CMakeLists.txt file. Once the tarball RandomProbe.tar has been downloaded and extracted,

        cd RandomProbe/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RandomProbe\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/RenderLargeImage/","title":"RenderLargeImage","text":"

        vtk-examples/Cxx/Visualization/RenderLargeImage

        "},{"location":"Cxx/Visualization/RenderLargeImage/#description","title":"Description","text":"

        This example renders a high resolution image. The image can be much larger than the window on the screen. It is useful if you need an image for a large poster, or you can down sample the image to produce a high quality anti-aliased image.

        The example takes up to three arguments. The first, an input polydata, is required, as is the second, a .png file to hold the high res image. An optional third argument specifies the magnification of the high res image (default 4).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/RenderLargeImage/#code","title":"Code","text":"

        RenderLargeImage.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGWriter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderLargeImage.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input(.vtp) Output(.png) [Magnification]\" << std::endl;\n    std::cerr << \"e.g. Bunny.vtp Bunny.png 4\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  int magnification = 4;\n  if (argc == 4)\n  {\n    magnification = atoi(argv[3]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tan\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RenderLargeImage\");\n\n  renderer->AddActor(actor);\n\n  // Let the renderer compute good position and focal point.\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Dolly(1.4);\n  renderer->ResetCameraClippingRange();\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n\n  std::cout\n      << \"Interact with image to get desired view and then press 'e' or 'q'\"\n      << std::endl;\n\n  interactor->Start();\n\n  std::cout << \"Generating large image size: \"\n            << renderWindow->GetSize()[0] * magnification << \" by \"\n            << renderWindow->GetSize()[1] * magnification << std::endl;\n\n  vtkNew<vtkRenderLargeImage> renderLarge;\n  renderLarge->SetInput(renderer);\n  renderLarge->SetMagnification(magnification);\n\n  std::cout << \"Saving image in \" << argv[2] << std::endl;\n  vtkNew<vtkPNGWriter> writer;\n  writer->SetFileName(argv[2]);\n  writer->SetInputConnection(renderLarge->GetOutputPort());\n  writer->Write();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/RenderLargeImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RenderLargeImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersHybrid\n  IOImage\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RenderLargeImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RenderLargeImage MACOSX_BUNDLE RenderLargeImage.cxx )\n  target_link_libraries(RenderLargeImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RenderLargeImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/RenderLargeImage/#download-and-build-renderlargeimage","title":"Download and Build RenderLargeImage","text":"

        Click here to download RenderLargeImage and its CMakeLists.txt file. Once the tarball RenderLargeImage.tar has been downloaded and extracted,

        cd RenderLargeImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RenderLargeImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ReverseAccess/","title":"ReverseAccess","text":"

        vtk-examples/Cxx/Visualization/ReverseAccess

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ReverseAccess/#code","title":"Code","text":"

        ReverseAccess.cxx

        //\n// This example demonstrates how to access the source object\n// (e.g. vtkSphereSource) from the actor reversely.\n//\n// Some standard vtk headers.\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n// Additionally needed vtk header for this example.\n#include <vtkAlgorithmOutput.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Source\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetRadius(0.5);\n  // Mapper\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n  // Actor\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Renderer\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetSize(300, 300);\n  renWin->SetWindowName(\"ReverseAccess\");\n\n  // Add actor to the renderer.\n  ren1->AddActor(sphereActor);\n\n  //\n  // Now we retrieve the source object from vtkActor reversely,\n  // meaning we don't use the spheresource object we instantiated\n  // above directly,\n  // instead we retrieve a reference to the spheresource through the\n  // actor.\n  // An advantage of this concept might be that we don't need to\n  // maintain the source object anymore\n  // in a more complex application.\n  // To demonstrate that we can modify properties of the spheresource\n  // through this reference\n  // beside changing some properties of the actor (in this example we\n  // change actor's x-position),\n  // we change the radius of the spheresource as well.\n  //\n  // The next two lines are the core lines for reverse access.\n  //\n  vtkSmartPointer<vtkAlgorithm> algorithm =\n      sphereActor->GetMapper()->GetInputConnection(0, 0)->GetProducer();\n  auto srcReference = dynamic_cast<vtkSphereSource*>(algorithm.GetPointer());\n\n  float origRadius = srcReference->GetRadius();\n  for (int i = 0; i < 360; ++i)\n  {\n    // Change radius of the sphere source.\n    srcReference->SetRadius(origRadius *\n                            (1 + sin((float)i / 180.0 * vtkMath::Pi())));\n    // Change the x-position of the actor.\n    sphereActor->SetPosition(sin((float)i / 45.0 * vtkMath::Pi()) * 0.5, 0, 0);\n    renWin->Render();\n  }\n\n  //\n  // Thanks to the usage of vtkSmartPointer there is no explicit need\n  // to free any objects at this point.\n  //\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ReverseAccess/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ReverseAccess)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonExecutionModel\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ReverseAccess: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ReverseAccess MACOSX_BUNDLE ReverseAccess.cxx )\n  target_link_libraries(ReverseAccess PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ReverseAccess\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ReverseAccess/#download-and-build-reverseaccess","title":"Download and Build ReverseAccess","text":"

        Click here to download ReverseAccess and its CMakeLists.txt file. Once the tarball ReverseAccess.tar has been downloaded and extracted,

        cd ReverseAccess/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ReverseAccess\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/RotateActor/","title":"RotateActor","text":"

        vtk-examples/Cxx/Visualization/RotateActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/RotateActor/#description","title":"Description","text":"

        This example shows how to rotate an actor. It also shows how to get the current transformation of the actor so it can then be applied to the actual object if so desired.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/RotateActor/#code","title":"Code","text":"

        RotateActor.cxx

        #include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballActor.h>\n#include <vtkMatrix4x4.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\n// Define interaction style.\nclass MyInteractorStyle : public vtkInteractorStyleTrackballActor\n{\npublic:\n  static MyInteractorStyle* New();\n  vtkTypeMacro(MyInteractorStyle, vtkInteractorStyleTrackballActor);\n\n  virtual void OnLeftButtonDown()\n  {\n    std::cout << \"Pressed left mouse button.\" << std::endl;\n\n    vtkNew<vtkMatrix4x4> m;\n    this->Actor->GetMatrix(m);\n    std::cout << \"Matrix: \" << endl << *m << std::endl;\n\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnLeftButtonDown();\n  }\n\n  virtual void OnLeftButtonUp()\n  {\n    std::cout << \"Released left mouse button.\" << std::endl;\n\n    vtkNew<vtkMatrix4x4> m;\n    this->Actor->GetMatrix(m);\n    std::cout << \"Matrix: \" << endl << *m << std::endl;\n\n    // Forward events.\n    vtkInteractorStyleTrackballActor::OnLeftButtonUp();\n  }\n\n  void SetActor(vtkSmartPointer<vtkActor> actor)\n  {\n    this->Actor = actor;\n  }\n\nprivate:\n  vtkSmartPointer<vtkActor> Actor;\n};\nvtkStandardNewMacro(MyInteractorStyle);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cone.\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->RotateY(45);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RotateActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<MyInteractorStyle> style;\n  style->SetActor(actor);\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/RotateActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RotateActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonMath\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RotateActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RotateActor MACOSX_BUNDLE RotateActor.cxx )\n  target_link_libraries(RotateActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RotateActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/RotateActor/#download-and-build-rotateactor","title":"Download and Build RotateActor","text":"

        Click here to download RotateActor and its CMakeLists.txt file. Once the tarball RotateActor.tar has been downloaded and extracted,

        cd RotateActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RotateActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ScalarBarActor/","title":"ScalarBarActor","text":"

        vtk-examples/Cxx/Visualization/ScalarBarActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ScalarBarActor/#description","title":"Description","text":"

        This example demonstrates how to make a color bar to that reflects the range of values associated with a data set.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ScalarBarActor/#code","title":"Code","text":"

        ScalarBarActor.cxx

        #include <vtkActor.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere for some geometry.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetCenter(0, 0, 0);\n  sphere->SetRadius(1);\n  sphere->Update();\n\n  // Create scalar data to associate with the vertices of the sphere.\n  int numPts = sphere->GetOutput()->GetPoints()->GetNumberOfPoints();\n  vtkNew<vtkFloatArray> scalars;\n  scalars->SetNumberOfValues(numPts);\n  for (int i = 0; i < numPts; ++i)\n  {\n    scalars->SetValue(i, static_cast<float>(i) / numPts);\n  }\n  vtkNew<vtkPolyData> poly;\n  poly->DeepCopy(sphere->GetOutput());\n  poly->GetPointData()->SetScalars(scalars);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(poly);\n  mapper->ScalarVisibilityOn();\n  mapper->SetScalarModeToUsePointData();\n  mapper->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(mapper->GetLookupTable());\n  scalarBar->SetTitle(\"Title\");\n  scalarBar->SetNumberOfLabels(4);\n\n  // Create a lookup table to share between the mapper and the scalarbar.\n  vtkNew<vtkLookupTable> hueLut;\n  hueLut->SetTableRange(0, 1);\n  hueLut->SetHueRange(0, 1);\n  hueLut->SetSaturationRange(1, 1);\n  hueLut->SetValueRange(1, 1);\n  hueLut->Build();\n\n  mapper->SetLookupTable(hueLut);\n  scalarBar->SetLookupTable(hueLut);\n\n  // Create a renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"Indigo\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"LightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ScalarBarActor\");\n\n  // Create an interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor2D(scalarBar);\n\n  // Render the scene (lights and cameras are created automatically).\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ScalarBarActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScalarBarActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScalarBarActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScalarBarActor MACOSX_BUNDLE ScalarBarActor.cxx )\n  target_link_libraries(ScalarBarActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScalarBarActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ScalarBarActor/#download-and-build-scalarbaractor","title":"Download and Build ScalarBarActor","text":"

        Click here to download ScalarBarActor and its CMakeLists.txt file. Once the tarball ScalarBarActor.tar has been downloaded and extracted,

        cd ScalarBarActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ScalarBarActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ScalarBarActorColorSeries/","title":"ScalarBarActorColorSeries","text":"

        vtk-examples/Cxx/Visualization/ScalarBarActorColorSeries

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ScalarBarActorColorSeries/#code","title":"Code","text":"

        ScalarBarActorColorSeries.cxx

        #include <vtkActor.h>\n#include <vtkColorSeries.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere fora some geometry.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetCenter(0, 0, 0);\n  sphere->SetRadius(1);\n  sphere->SetPhiResolution(30);\n  sphere->SetThetaResolution(60);\n  sphere->Update();\n\n  // Create scalar data to associate with the vertices of the sphere.\n  int numPts = sphere->GetOutput()->GetPoints()->GetNumberOfPoints();\n  vtkNew<vtkFloatArray> scalars;\n  scalars->SetNumberOfValues(numPts);\n  for (int i = 0; i < numPts; ++i)\n  {\n    scalars->SetValue(i, static_cast<float>(i) / numPts);\n  }\n  vtkNew<vtkPolyData> poly;\n  poly->DeepCopy(sphere->GetOutput());\n  poly->GetPointData()->SetScalars(scalars);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(poly);\n  mapper->ScalarVisibilityOn();\n  mapper->SetScalarModeToUsePointData();\n  mapper->SetColorModeToMapScalars();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetLookupTable(mapper->GetLookupTable());\n  scalarBar->SetTitle(\"Beachball\");\n  scalarBar->SetNumberOfLabels(4);\n\n  // Create a lookup table to share between the mapper and the scalarbar.\n  vtkNew<vtkLookupTable> seriesLut;\n\n  vtkNew<vtkColorSeries> series;\n  int seriesEnum = series->BREWER_QUALITATIVE_SET3;\n  series->SetColorScheme(seriesEnum);\n  series->BuildLookupTable(seriesLut, series->ORDINAL);\n\n  mapper->SetLookupTable(seriesLut);\n  scalarBar->SetLookupTable(seriesLut);\n\n  // Create a renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground2(colors->GetColor3d(\"NavajoWhite\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ScalarBarActorColorSeries\");\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->AddActor2D(scalarBar);\n\n  // Render the scene (lights and cameras are created automatically).\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ScalarBarActorColorSeries/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScalarBarActorColorSeries)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScalarBarActorColorSeries: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScalarBarActorColorSeries MACOSX_BUNDLE ScalarBarActorColorSeries.cxx )\n  target_link_libraries(ScalarBarActorColorSeries PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScalarBarActorColorSeries\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ScalarBarActorColorSeries/#download-and-build-scalarbaractorcolorseries","title":"Download and Build ScalarBarActorColorSeries","text":"

        Click here to download ScalarBarActorColorSeries and its CMakeLists.txt file. Once the tarball ScalarBarActorColorSeries.tar has been downloaded and extracted,

        cd ScalarBarActorColorSeries/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ScalarBarActorColorSeries\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ScalarVisibility/","title":"ScalarVisibility","text":"

        vtk-examples/Cxx/Visualization/ScalarVisibility

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ScalarVisibility/#code","title":"Code","text":"

        ScalarVisibility.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPointSource> pointSource;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(pointSource->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  actor->GetProperty()->SetPointSize(2);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ScalarVisibility\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ScalarVisibility/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScalarVisibility)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScalarVisibility: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScalarVisibility MACOSX_BUNDLE ScalarVisibility.cxx )\n  target_link_libraries(ScalarVisibility PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScalarVisibility\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ScalarVisibility/#download-and-build-scalarvisibility","title":"Download and Build ScalarVisibility","text":"

        Click here to download ScalarVisibility and its CMakeLists.txt file. Once the tarball ScalarVisibility.tar has been downloaded and extracted,

        cd ScalarVisibility/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ScalarVisibility\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ScaleGlyphs/","title":"ScaleGlyphs","text":"

        vtk-examples/Cxx/Visualization/ScaleGlyphs

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ScaleGlyphs/#code","title":"Code","text":"

        ScaleGlyphs.cxx

        #include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0, 0, 0);\n  points->InsertNextPoint(5, 0, 0);\n  points->InsertNextPoint(10, 0, 0);\n\n  // Setup scales.\n  vtkNew<vtkFloatArray> scales;\n  scales->SetName(\"scales\");\n\n  scales->InsertNextValue(1.0);\n  scales->InsertNextValue(2.0);\n  scales->InsertNextValue(3.0);\n\n  // Combine into a polydata\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->GetPointData()->SetScalars(scales);\n\n  // Create anything you want here, we will use a cube for the demo.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkGlyph3D> glyph3D;\n  glyph3D->SetScaleModeToScaleByScalar();\n  glyph3D->SetSourceConnection(cubeSource->GetOutputPort());\n  glyph3D->SetInputData(polydata);\n  glyph3D->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(glyph3D->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ScaleGlyphs\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/ScaleGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScaleGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScaleGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScaleGlyphs MACOSX_BUNDLE ScaleGlyphs.cxx )\n  target_link_libraries(ScaleGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScaleGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ScaleGlyphs/#download-and-build-scaleglyphs","title":"Download and Build ScaleGlyphs","text":"

        Click here to download ScaleGlyphs and its CMakeLists.txt file. Once the tarball ScaleGlyphs.tar has been downloaded and extracted,

        cd ScaleGlyphs/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ScaleGlyphs\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/SceneBounds/","title":"SceneBounds","text":"

        vtk-examples/Cxx/Visualization/SceneBounds

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/SceneBounds/#code","title":"Code","text":"

        SceneBounds.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <iostream>\n#include <string>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->SetCenter(5.0, 0.0, 0.0);\n  cubeSource->Update();\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"Thistle\").GetData());\n\n  // Visualization.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SceneBounds\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(cubeActor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Zoom(0.9);\n\n  double bounds[6];\n  renderer->ComputeVisiblePropBounds(bounds);\n  std::cout << bounds[0] << \" \" << bounds[1] << \" \" << bounds[2] << \" \"\n            << bounds[3] << \" \" << bounds[4] << \" \" << bounds[5] << std::endl;\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/SceneBounds/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SceneBounds)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SceneBounds: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SceneBounds MACOSX_BUNDLE SceneBounds.cxx )\n  target_link_libraries(SceneBounds PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SceneBounds\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/SceneBounds/#download-and-build-scenebounds","title":"Download and Build SceneBounds","text":"

        Click here to download SceneBounds and its CMakeLists.txt file. Once the tarball SceneBounds.tar has been downloaded and extracted,

        cd SceneBounds/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SceneBounds\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/SelectWindowRegion/","title":"SelectWindowRegion","text":"

        vtk-examples/Cxx/Visualization/SelectWindowRegion

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/SelectWindowRegion/#code","title":"Code","text":"

        SelectWindowRegion.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleRubberBand2D.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nvoid SelectionChangedCallbackFunction(vtkObject* caller,\n                                      long unsigned int eventId,\n                                      void* clientData, void* callData);\n}\n\nint main(int argc, char* argv[])\n{\n  // Parse input arguments.\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: Filename e.g. Ox.jpg\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFilename = argv[1];\n\n  // Read the image.\n  vtkNew<vtkJPEGReader> jPEGReader;\n  jPEGReader->SetFileName(inputFilename.c_str());\n  jPEGReader->Update();\n\n  // Create an actor.\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(jPEGReader->GetOutputPort());\n\n  // Setup the SelectionChangedEvent callback.\n  vtkNew<vtkCallbackCommand> selectionChangedCallback;\n  selectionChangedCallback->SetCallback(SelectionChangedCallbackFunction);\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SelectWindowRegion\");\n\n  // Setup 2D interaction style.\n  vtkNew<vtkInteractorStyleRubberBand2D> style;\n  style->AddObserver(vtkCommand::SelectionChangedEvent,\n                     selectionChangedCallback);\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid SelectionChangedCallbackFunction(vtkObject* vtkNotUsed(caller),\n                                      long unsigned int vtkNotUsed(eventId),\n                                      void* vtkNotUsed(clientData),\n                                      void* callData)\n{\n  std::cout << \"Selection changed callback\" << std::endl;\n\n  unsigned int* rect = reinterpret_cast<unsigned int*>(callData);\n  unsigned int pos1X = rect[0];\n  unsigned int pos1Y = rect[1];\n  unsigned int pos2X = rect[2];\n  unsigned int pos2Y = rect[3];\n\n  std::cout << \"Start x: \" << pos1X << \" Start y: \" << pos1Y\n            << \" End x: \" << pos2X << \" End y: \" << pos2Y << std::endl;\n}\n\n/*\n//You could override this, but then you have to reimplement the functionality.\n//Instead, you should use an observer\n\nvoid vtkInteractorStyleRubberBand2D::OnLeftButtonUp()\n{\n  std::cout << \"LeftButtonUp!\" << std::endl;\n\n  std::cout << \"Start: \" << this->StartPosition[0] << \" \" <<\nthis->StartPosition[1] << std::endl; std::cout << \"End: \" <<\nthis->EndPosition[0] << \" \" << this->EndPosition[1] << std::endl;\n\n  //this->Superclass.OnLeftButtonUp(); //doesn't work\n\n  InvokeEvent(vtkCommand::EndPickEvent);\n  InvokeEvent(vtkCommand::SelectionChangedEvent);\n\n}\n*/\n} // namespace\n
        "},{"location":"Cxx/Visualization/SelectWindowRegion/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SelectWindowRegion)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SelectWindowRegion: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SelectWindowRegion MACOSX_BUNDLE SelectWindowRegion.cxx )\n  target_link_libraries(SelectWindowRegion PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SelectWindowRegion\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/SelectWindowRegion/#download-and-build-selectwindowregion","title":"Download and Build SelectWindowRegion","text":"

        Click here to download SelectWindowRegion and its CMakeLists.txt file. Once the tarball SelectWindowRegion.tar has been downloaded and extracted,

        cd SelectWindowRegion/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SelectWindowRegion\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ShadowsLightsDemo/","title":"ShadowsLightsDemo","text":"

        vtk-examples/Cxx/Visualization/ShadowsLightsDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ShadowsLightsDemo/#code","title":"Code","text":"

        ShadowsLightsDemo.cxx

        // The scene consists of:\n// 1) four actors: a rectangle, a box, a cone and a sphere.\n//    The box, the cone and the sphere are above the rectangle.\n// 2) Two spotlights, one in the direction of the box, another one in the\n//    direction of the sphere.\n//    Both lights are above the box, the cone and  the sphere.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCameraPass.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkLight.h>\n#include <vtkLightActor.h>\n#include <vtkLightCollection.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpaquePass.h>\n#include <vtkOpenGLRenderer.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderPassCollection.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkSequencePass.h>\n#include <vtkShadowMapBakerPass.h>\n#include <vtkShadowMapPass.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// For each spotlight, add a light frustum wireframe representation and a cone\n// wireframe representation, colored with the light color.\nvoid AddLightActors(vtkRenderer* r);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkRenderWindowInteractor> interactor;\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(400, 400);\n  renderWindow->SetMultiSamples(0);\n\n  renderWindow->SetAlphaBitPlanes(1);\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkOpenGLRenderer> renderer;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  vtkNew<vtkSequencePass> seq;\n\n  vtkNew<vtkRenderPassCollection> passes;\n\n  vtkNew<vtkShadowMapPass> shadows;\n  passes->AddItem(shadows->GetShadowMapBakerPass());\n  passes->AddItem(shadows);\n\n  vtkNew<vtkOpaquePass> opaque;\n  passes->AddItem(opaque);\n\n  seq->SetPasses(passes);\n\n  vtkNew<vtkCameraPass> cameraP;\n  cameraP->SetDelegatePass(seq);\n\n  // Tell the renderer to use our render pass pipeline.\n  vtkOpenGLRenderer* glrenderer =\n      dynamic_cast<vtkOpenGLRenderer*>(renderer.GetPointer());\n  glrenderer->SetPass(cameraP);\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d boxColor = colors->GetColor3d(\"Tomato\");\n  vtkColor3d rectangleColor = colors->GetColor3d(\"Beige\");\n  vtkColor3d coneColor = colors->GetColor3d(\"Peacock\");\n  vtkColor3d sphereColor = colors->GetColor3d(\"Banana\");\n\n  vtkNew<vtkPlaneSource> rectangleSource;\n  rectangleSource->SetOrigin(-5.0, 0.0, 5.0);\n  rectangleSource->SetPoint1(5.0, 0.0, 5.0);\n  rectangleSource->SetPoint2(-5.0, 0.0, -5.0);\n  rectangleSource->SetResolution(100, 100);\n\n  vtkNew<vtkPolyDataMapper> rectangleMapper;\n  rectangleMapper->SetInputConnection(rectangleSource->GetOutputPort());\n\n  rectangleMapper->SetScalarVisibility(0);\n\n  vtkNew<vtkActor> rectangleActor;\n  rectangleActor->SetMapper(rectangleMapper);\n  rectangleActor->SetVisibility(1);\n  rectangleActor->GetProperty()->SetColor(rectangleColor.GetData());\n\n  vtkNew<vtkCubeSource> boxSource;\n  boxSource->SetXLength(2.0);\n\n  vtkNew<vtkPolyDataNormals> boxNormals;\n  boxNormals->SetInputConnection(boxSource->GetOutputPort());\n  boxNormals->ComputePointNormalsOff();\n  boxNormals->ComputeCellNormalsOn();\n  boxNormals->Update();\n  boxNormals->GetOutput()->GetPointData()->SetNormals(nullptr);\n\n  vtkNew<vtkPolyDataMapper> boxMapper;\n  boxMapper->SetInputConnection(boxNormals->GetOutputPort());\n  boxMapper->SetScalarVisibility(0);\n\n  vtkNew<vtkActor> boxActor;\n  boxActor->SetMapper(boxMapper);\n  boxActor->SetVisibility(1);\n  boxActor->SetPosition(-2.0, 2.0, 0.0);\n  boxActor->GetProperty()->SetColor(boxColor.GetData());\n\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetResolution(24);\n  coneSource->SetDirection(1.0, 1.0, 1.0);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n  coneMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->VisibilityOn();\n  coneActor->SetPosition(0.0, 1.0, 1.0);\n  coneActor->GetProperty()->SetColor(coneColor.GetData());\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetThetaResolution(32);\n  sphereSource->SetPhiResolution(32);\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  sphereMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n\n  sphereActor->VisibilityOn();\n  sphereActor->SetPosition(2.0, 2.0, -1.0);\n  sphereActor->GetProperty()->SetColor(sphereColor.GetData());\n\n  renderer->AddViewProp(rectangleActor);\n  renderer->AddViewProp(boxActor);\n  renderer->AddViewProp(coneActor);\n  renderer->AddViewProp(sphereActor);\n\n  // Spotlights.\n\n  // Lighting the box.\n  vtkNew<vtkLight> l1;\n  l1->SetPosition(-4.0, 4.0, -1.0);\n  l1->SetFocalPoint(boxActor->GetPosition());\n  l1->SetColor(colors->GetColor3d(\"White\").GetData());\n  l1->PositionalOn();\n  renderer->AddLight(l1);\n  l1->SwitchOn();\n\n  // Lighting the sphere.\n  vtkNew<vtkLight> l2;\n  l2->SetPosition(4.0, 5.0, 1.0);\n  l2->SetFocalPoint(sphereActor->GetPosition());\n  l2->SetColor(colors->GetColor3d(\"Magenta\").GetData());\n  l2->PositionalOn();\n  renderer->AddLight(l2);\n  l2->SwitchOn();\n\n  AddLightActors(renderer);\n\n  renderer->SetBackground2(colors->GetColor3d(\"Black\").GetData());\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->SetGradientBackground(true);\n\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"ShadowsLightsDemo\");\n\n  renderer->ResetCamera();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->Azimuth(40.0);\n  camera->Elevation(10.0);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// For each spotlight, add a light frustum wireframe representation and a cone\n// wireframe representation, colored with the light color.\nvoid AddLightActors(vtkRenderer* r)\n{\n  vtkLightCollection* lights = r->GetLights();\n  lights->InitTraversal();\n\n  vtkLight* light = lights->GetNextItem();\n  while (light != 0)\n  {\n    double angle = light->GetConeAngle();\n    if (light->LightTypeIsSceneLight() && light->GetPositional() &&\n        angle < 180.0) // spotlight\n    {\n      vtkNew<vtkLightActor> light_actor;\n      light_actor->SetLight(light);\n      r->AddViewProp(light_actor);\n    }\n    light = lights->GetNextItem();\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/ShadowsLightsDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShadowsLightsDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShadowsLightsDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShadowsLightsDemo MACOSX_BUNDLE ShadowsLightsDemo.cxx )\n  target_link_libraries(ShadowsLightsDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShadowsLightsDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ShadowsLightsDemo/#download-and-build-shadowslightsdemo","title":"Download and Build ShadowsLightsDemo","text":"

        Click here to download ShadowsLightsDemo and its CMakeLists.txt file. Once the tarball ShadowsLightsDemo.tar has been downloaded and extracted,

        cd ShadowsLightsDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ShadowsLightsDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/ShepardInterpolation/","title":"ShepardInterpolation","text":"

        vtk-examples/Cxx/Visualization/ShepardInterpolation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/ShepardInterpolation/#description","title":"Description","text":"

        Use vtkShepardMethod to interpolate the scalars of a vtkPolyData. The zero-contour of the original and interpoltated scalars are extracted with vtkContourFilter. The original data is shown in red and the interpolated data in shown in yellow.

        Usage:

        ShepardInterpolation polydata [resolution]\n

        where: - polydata is a polydata file with scalar data. - resolution is the sampling resoluton, default 100.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/ShepardInterpolation/#code","title":"Code","text":"

        ShepardInterpolation.cxx

        #include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOBJReader.h>\n#include <vtkPLYReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSTLReader.h>\n#include <vtkShepardMethod.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName);\n}\n\nint main(int argc, char* argv[])\n{\n  // Parse input arguments.\n  if (argc < 3)\n  {\n    std::cout\n        << \"Required parameters: Filename  resolution e.g. cowHead.vtp 100\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  auto polyData = ReadPolyData(argc > 1 ? argv[1] : \"\");\n\n  unsigned int resolution = 100;\n  if (argc >= 3)\n  {\n    resolution = std::atoi(argv[2]);\n  }\n  vtkNew<vtkShepardMethod> interpolator;\n  interpolator->SetInputData(polyData);\n  interpolator->SetModelBounds(polyData->GetBounds());\n  interpolator->SetSampleDimensions(resolution, resolution, resolution);\n  interpolator->SetNullValue(-10000);\n  interpolator->Update();\n  std::cout << \"Scalar Range: \"\n            << interpolator->GetOutput()->GetScalarRange()[0] << \", \"\n            << interpolator->GetOutput()->GetScalarRange()[1] << std::endl;\n\n  vtkNew<vtkProbeFilter> probe;\n  probe->SetInputData(0, polyData);\n  probe->SetInputConnection(1, interpolator->GetOutputPort());\n\n  vtkNew<vtkContourFilter> interpolatedContour;\n  interpolatedContour->SetInputConnection(probe->GetOutputPort());\n  interpolatedContour->SetValue(0, 0.0);\n\n  vtkNew<vtkContourFilter> originalContour;\n  originalContour->SetInputData(polyData);\n  originalContour->SetValue(0, 0.0);\n\n  vtkNew<vtkPolyDataMapper> interpolatedMapper;\n  interpolatedMapper->SetInputConnection(interpolatedContour->GetOutputPort());\n  interpolatedMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> interpolatedActor;\n  interpolatedActor->SetMapper(interpolatedMapper);\n  interpolatedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Banana\").GetData());\n  interpolatedActor->GetProperty()->SetLineWidth(4.0);\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(originalContour->GetOutputPort());\n  originalMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  originalActor->GetProperty()->SetLineWidth(4.0);\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ShepardInterpolation\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(interpolatedActor);\n  renderer->AddActor(originalActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(120);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->GetActiveCamera()->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvtkSmartPointer<vtkPolyData> ReadPolyData(const char* fileName)\n{\n  vtkSmartPointer<vtkPolyData> polyData;\n  std::string extension =\n      vtksys::SystemTools::GetFilenameExtension(std::string(fileName));\n  if (extension == \".ply\")\n  {\n    vtkNew<vtkPLYReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtp\")\n  {\n    vtkNew<vtkXMLPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".obj\")\n  {\n    vtkNew<vtkOBJReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".stl\")\n  {\n    vtkNew<vtkSTLReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".vtk\")\n  {\n    vtkNew<vtkPolyDataReader> reader;\n    reader->SetFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else if (extension == \".g\")\n  {\n    vtkNew<vtkBYUReader> reader;\n    reader->SetGeometryFileName(fileName);\n    reader->Update();\n    polyData = reader->GetOutput();\n  }\n  else\n  {\n    vtkNew<vtkSphereSource> source;\n    source->Update();\n    polyData = source->GetOutput();\n  }\n  return polyData;\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/ShepardInterpolation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ShepardInterpolation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOGeometry\n  IOLegacy\n  IOPLY\n  IOXML\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ShepardInterpolation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ShepardInterpolation MACOSX_BUNDLE ShepardInterpolation.cxx )\n  target_link_libraries(ShepardInterpolation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ShepardInterpolation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/ShepardInterpolation/#download-and-build-shepardinterpolation","title":"Download and Build ShepardInterpolation","text":"

        Click here to download ShepardInterpolation and its CMakeLists.txt file. Once the tarball ShepardInterpolation.tar has been downloaded and extracted,

        cd ShepardInterpolation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ShepardInterpolation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/SideBySideViewports/","title":"SideBySideViewports","text":"

        vtk-examples/Cxx/Visualization/SideBySideViewports

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/SideBySideViewports/#description","title":"Description","text":"

        This example splits the window into a left and right side. A sphere is drawn on the left and a cube is drawn on the right.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/SideBySideViewports/#code","title":"Code","text":"

        SideBySideViewports.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkVertexGlyphFilter.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Setup a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MediumSeaGreen\").GetData());\n\n  // There will be one render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"SideBySideViewports\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges.\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.5, 1.0};\n  double rightViewport[4] = {0.5, 0.0, 1.0, 1.0};\n\n  // Setup both renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  // Add the sphere to the left and the cube to the right.\n  leftRenderer->AddActor(sphereActor);\n  rightRenderer->AddActor(cubeActor);\n\n  leftRenderer->ResetCamera();\n\n  rightRenderer->ResetCamera();\n  rightRenderer->GetActiveCamera()->Azimuth(30);\n  rightRenderer->GetActiveCamera()->Elevation(30);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/SideBySideViewports/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SideBySideViewports)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SideBySideViewports: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SideBySideViewports MACOSX_BUNDLE SideBySideViewports.cxx )\n  target_link_libraries(SideBySideViewports PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SideBySideViewports\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/SideBySideViewports/#download-and-build-sidebysideviewports","title":"Download and Build SideBySideViewports","text":"

        Click here to download SideBySideViewports and its CMakeLists.txt file. Once the tarball SideBySideViewports.tar has been downloaded and extracted,

        cd SideBySideViewports/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SideBySideViewports\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/StreamLines/","title":"StreamLines","text":"

        vtk-examples/Cxx/Visualization/StreamLines

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/StreamLines/#code","title":"Code","text":"

        StreamLines.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Required arguments: xyzFile qFile e.g. combxyz.bin combq.bin\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> namedColors;\n\n  std::string xyzFile = argv[1]; // \"combxyz.bin\";\n  std::string qFile = argv[2];   // \"combq.bin\";\n\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(xyzFile.c_str());\n  pl3d->SetQFileName(qFile.c_str());\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  // Source of the streamlines\n  vtkNew<vtkPlaneSource> seeds;\n  seeds->SetXResolution(4);\n  seeds->SetYResolution(4);\n  seeds->SetOrigin(2, -2, 26);\n  seeds->SetPoint1(2, 2, 26);\n  seeds->SetPoint2(2, -2, 32);\n\n  // Streamline itself\n  vtkNew<vtkStreamTracer> streamLine;\n  pl3d->Update();\n  streamLine->SetInputData(pl3d->GetOutput()->GetBlock(0));\n  streamLine->SetSourceConnection(seeds->GetOutputPort());\n  streamLine->SetMaximumPropagation(100);\n  streamLine->SetInitialIntegrationStep(0.1);\n  streamLine->SetIntegrationDirectionToBoth();\n\n  // streamLine->SetStartPosition(2,-2,30);\n  // as alternative to the SetSource(), which can handle multiple\n  // streamlines, you can set a SINGLE streamline from\n  // SetStartPosition()\n\n  vtkNew<vtkPolyDataMapper> streamLineMapper;\n  streamLineMapper->SetInputConnection(streamLine->GetOutputPort());\n\n  vtkNew<vtkActor> streamLineActor;\n  streamLineActor->SetMapper(streamLineMapper);\n  streamLineActor->VisibilityOn();\n\n  // Outline-Filter for the grid\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(\n      namedColors->GetColor3d(\"White\").GetData());\n\n  // Create the RenderWindow, Renderer and Actors\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"StreamLines\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  renderer->AddActor(streamLineActor);\n  renderer->AddActor(outlineActor);\n\n  // Add the actors to the renderer, set the background and size\n  renderer->SetBackground(namedColors->GetColor3d(\"MidnightBlue\").GetData());\n  renderWindow->SetSize(300, 300);\n  interactor->Initialize();\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(-32.8, -12.3, 46.3);\n  renderer->GetActiveCamera()->SetFocalPoint(8.3, 0.03, 29.8);\n  renderer->GetActiveCamera()->SetViewUp(0.2, 0.5, 0.9);\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/StreamLines/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StreamLines)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StreamLines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StreamLines MACOSX_BUNDLE StreamLines.cxx )\n  target_link_libraries(StreamLines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StreamLines\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/StreamLines/#download-and-build-streamlines","title":"Download and Build StreamLines","text":"

        Click here to download StreamLines and its CMakeLists.txt file. Once the tarball StreamLines.tar has been downloaded and extracted,

        cd StreamLines/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StreamLines\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/StructuredDataTypes/","title":"StructuredDataTypes","text":"

        vtk-examples/Cxx/Visualization/StructuredDataTypes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/StructuredDataTypes/#code","title":"Code","text":"

        StructuredDataTypes.cxx

        #include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRectilinearGrid.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkTransform.h>\n#include <vtkXMLImageDataWriter.h>\n#include <vtkXMLRectilinearGridWriter.h>\n#include <vtkXMLStructuredGridWriter.h>\n\nnamespace {\nvoid ImageData(vtkImageData* data, const int gridSize);\nvoid RectilinearGrid(vtkRectilinearGrid* data, const int gridSize);\nvoid StructuredGrid(vtkStructuredGrid* data, const int gridSize);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  int gridSize = 5;\n  vtkNew<vtkImageData> imageData;\n  ImageData(imageData, gridSize);\n  vtkNew<vtkDataSetMapper> imageDataMapper;\n  imageDataMapper->SetInputData(imageData);\n  imageDataMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> imageDataActor;\n  imageDataActor->GetProperty()->SetRepresentationToWireframe();\n  imageDataActor->SetMapper(imageDataMapper);\n  imageDataActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRectilinearGrid> rectilinearGrid;\n  RectilinearGrid(rectilinearGrid, gridSize);\n  vtkNew<vtkDataSetMapper> rectilinearGridMapper;\n  rectilinearGridMapper->SetInputData(rectilinearGrid);\n\n  vtkNew<vtkActor> rectilinearGridActor;\n  rectilinearGridActor->GetProperty()->SetRepresentationToWireframe();\n  rectilinearGridActor->SetMapper(rectilinearGridMapper);\n  rectilinearGridActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkStructuredGrid> structuredGrid;\n  StructuredGrid(structuredGrid, gridSize);\n  vtkNew<vtkDataSetMapper> structuredGridMapper;\n  structuredGridMapper->SetInputData(structuredGrid);\n\n  vtkNew<vtkActor> structuredGridActor;\n  structuredGridActor->GetProperty()->SetRepresentationToWireframe();\n  structuredGridActor->SetMapper(structuredGridMapper);\n  structuredGridActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // There will be one render window\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(600, 300);\n  renderWindow->SetWindowName(\"StructuredDataTypes\");\n\n  // And one interactor\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Define viewport ranges\n  // (xmin, ymin, xmax, ymax)\n  double leftViewport[4] = {0.0, 0.0, 0.33, 1.0};\n  double centerViewport[4] = {0.33, 0.0, 0.66, 1.0};\n  double rightViewport[4] = {0.66, 0.0, 1.0, 1.0};\n\n  // Setup three renderers\n  vtkNew<vtkRenderer> leftRenderer;\n  renderWindow->AddRenderer(leftRenderer);\n  leftRenderer->SetViewport(leftViewport);\n  leftRenderer->SetBackground(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> centerRenderer;\n  renderWindow->AddRenderer(centerRenderer);\n  centerRenderer->SetViewport(centerViewport);\n  centerRenderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  vtkNew<vtkRenderer> rightRenderer;\n  renderWindow->AddRenderer(rightRenderer);\n  rightRenderer->SetViewport(rightViewport);\n  rightRenderer->SetBackground(colors->GetColor3d(\"Plum\").GetData());\n\n  // Add the image on the left, rectilinear in the center, structured on the\n  // right\n  leftRenderer->AddActor(imageDataActor);\n  centerRenderer->AddActor(rectilinearGridActor);\n  rightRenderer->AddActor(structuredGridActor);\n\n  leftRenderer->ResetCamera();\n  centerRenderer->ResetCamera();\n  rightRenderer->ResetCamera();\n  // rightRenderer->GetActiveCamera()->Azimuth(30);\n  // rightRenderer->GetActiveCamera()->Elevation(30);\n\n  renderWindow->Render();\n  interactor->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvoid ImageData(vtkImageData* data, const int gridSize)\n{\n\n  data->SetExtent(0, gridSize - 1, 0, gridSize - 1, 0, gridSize - 1);\n  data->AllocateScalars(VTK_DOUBLE, 1);\n\n  vtkNew<vtkXMLImageDataWriter> writer;\n  writer->SetFileName(\"imagedata.vti\");\n  writer->SetInputData(data);\n  writer->Write();\n}\n\nvoid RectilinearGrid(vtkRectilinearGrid* data, const int gridSize)\n{\n\n  data->SetExtent(0, gridSize - 1, 0, gridSize - 1, 0, gridSize - 1);\n\n  vtkNew<vtkDoubleArray> xCoords;\n  xCoords->SetNumberOfComponents(1);\n  vtkNew<vtkDoubleArray> yCoords;\n  yCoords->SetNumberOfComponents(1);\n  vtkNew<vtkDoubleArray> zCoords;\n  zCoords->SetNumberOfComponents(1);\n\n  for (int i = 0; i < gridSize; i++)\n  {\n    if (i == 0)\n    {\n      xCoords->InsertNextValue(0);\n      yCoords->InsertNextValue(0);\n      zCoords->InsertNextValue(0);\n      continue;\n    }\n    double oldX = xCoords->GetValue(i - 1);\n    double oldY = xCoords->GetValue(i - 1);\n    double oldZ = xCoords->GetValue(i - 1);\n    xCoords->InsertNextValue(oldX + i * i);\n    yCoords->InsertNextValue(oldY + i * i);\n    zCoords->InsertNextValue(oldZ + i * i);\n  }\n\n  data->SetXCoordinates(xCoords);\n  data->SetYCoordinates(yCoords);\n  data->SetZCoordinates(zCoords);\n\n  vtkNew<vtkXMLRectilinearGridWriter> writer;\n  writer->SetFileName(\"rectilineargrid.vtr\");\n  writer->SetInputData(data);\n  writer->Write();\n}\n\nvoid StructuredGrid(vtkStructuredGrid* data, const int gridSize)\n{\n  data->SetExtent(0, gridSize - 1, 0, gridSize - 1, 0, gridSize - 1);\n  vtkNew<vtkPoints> points;\n\n  vtkNew<vtkTransform> transform;\n  transform->RotateZ(30);\n\n  for (int k = 0; k < gridSize; k++)\n  {\n    for (int j = 0; j < gridSize; j++)\n    {\n      for (int i = 0; i < gridSize; i++)\n      {\n        double p[4];\n        p[0] = i;\n        p[1] = j;\n        p[2] = k;\n        p[3] = 1;\n        double pout[4];\n        transform->MultiplyPoint(p, pout);\n\n        points->InsertNextPoint(pout[0], pout[1], pout[2]);\n      }\n    }\n  }\n\n  data->SetPoints(points);\n\n  vtkNew<vtkXMLStructuredGridWriter> writer;\n  writer->SetFileName(\"structuredgrid.vts\");\n  writer->SetInputData(data);\n  writer->Write();\n}\n} // namespace\n
        "},{"location":"Cxx/Visualization/StructuredDataTypes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StructuredDataTypes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StructuredDataTypes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StructuredDataTypes MACOSX_BUNDLE StructuredDataTypes.cxx )\n  target_link_libraries(StructuredDataTypes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StructuredDataTypes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/StructuredDataTypes/#download-and-build-structureddatatypes","title":"Download and Build StructuredDataTypes","text":"

        Click here to download StructuredDataTypes and its CMakeLists.txt file. Once the tarball StructuredDataTypes.tar has been downloaded and extracted,

        cd StructuredDataTypes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StructuredDataTypes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/TensorGlyph/","title":"TensorGlyph","text":"

        vtk-examples/Cxx/Visualization/TensorGlyph

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/TensorGlyph/#description","title":"Description","text":"

        This example demonstrates how to apply a rotation+scaling matrix to each point in a data set. We use a cube as the glyph so that simple rotations are easy to interpret. Specifically, we glyph one point with no rotation/scaling, and a second point with a rotation of 45 degrees around the x axis.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/TensorGlyph/#code","title":"Code","text":"

        TensorGlyph.cxx

        #include <vtkActor.h>\n#include <vtkCubeSource.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTensorGlyph.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup points.\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(5.0, 0.0, 0.0);\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n\n  vtkNew<vtkDoubleArray> tensors;\n  tensors->SetNumberOfTuples(2);\n  tensors->SetNumberOfComponents(9);\n\n  tensors->InsertTuple9(0, 1, 0, 0, 0, 1, 0, 0, 0, 1);\n  tensors->InsertTuple9(1, 1, 0, 0, 0, 0.7, 0.7, 0, -0.7, 0.7); // column major\n\n  polyData->GetPointData()->SetTensors(tensors);\n\n  vtkNew<vtkCubeSource> cubeSource;\n  cubeSource->Update();\n\n  vtkNew<vtkTensorGlyph> tensorGlyph;\n  tensorGlyph->SetInputData(polyData);\n  tensorGlyph->SetSourceConnection(cubeSource->GetOutputPort());\n  tensorGlyph->ColorGlyphsOff();\n  tensorGlyph->ThreeGlyphsOff();\n  tensorGlyph->ExtractEigenvaluesOff();\n  tensorGlyph->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(tensorGlyph->GetOutput());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"LightSalmon\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TensorGlyph\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/TensorGlyph/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TensorGlyph)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TensorGlyph: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TensorGlyph MACOSX_BUNDLE TensorGlyph.cxx )\n  target_link_libraries(TensorGlyph PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TensorGlyph\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/TensorGlyph/#download-and-build-tensorglyph","title":"Download and Build TensorGlyph","text":"

        Click here to download TensorGlyph and its CMakeLists.txt file. Once the tarball TensorGlyph.tar has been downloaded and extracted,

        cd TensorGlyph/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TensorGlyph\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/TextSource/","title":"TextSource","text":"

        vtk-examples/Cxx/Visualization/TextSource

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/TextSource/#description","title":"Description","text":"

        This example displays a 3D polygonal text saying \"Hello\", using the 9x15 font from X Windows. That is a raster (pixelized) font, so characters are formed by converting the pixels on each character into quadrilaterals. vtkVectorText generates higher quality polygonal representations of text, so it is recommended instead -- see VectorText for an example of this.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/TextSource/#code","title":"Code","text":"

        TextSource.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTextSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create text\n  vtkNew<vtkTextSource> textSource;\n  textSource->SetText(\"Hello\");\n  textSource->SetForegroundColor(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  textSource->SetBackgroundColor(colors->GetColor3d(\"NavajoWhite\").GetData());\n  // Turn off if you don't want the background drawn with the text.\n  textSource->BackingOn();\n  textSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(textSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TextSource\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Bisque\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/TextSource/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextSource)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextSource: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextSource MACOSX_BUNDLE TextSource.cxx )\n  target_link_libraries(TextSource PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextSource\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/TextSource/#download-and-build-textsource","title":"Download and Build TextSource","text":"

        Click here to download TextSource and its CMakeLists.txt file. Once the tarball TextSource.tar has been downloaded and extracted,

        cd TextSource/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TextSource\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/TextureMapImageData/","title":"TextureMapImageData","text":"

        vtk-examples/Cxx/Visualization/TextureMapImageData

        "},{"location":"Cxx/Visualization/TextureMapImageData/#description","title":"Description","text":"

        This example creates an image and texture maps it onto a plane.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/TextureMapImageData/#code","title":"Code","text":"

        TextureMapImageData.cxx

        #include <vtkImageCanvasSource2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"ForestGreen\").GetData();\n  auto color2 = colors->GetColor3ub(\"DarkMagenta\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Create an image\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetExtent(0, 20, 0, 20, 0, 0);\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(0, 20, 0, 20);\n  imageSource->SetDrawColor(drawColor2.data());\n  imageSource->DrawSegment(0, 0, 19, 19);\n  imageSource->DrawSegment(19, 0, 0, 19);\n  imageSource->Update();\n\n  // Create a plane\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetCenter(0.0, 0.0, 0.0);\n  plane->SetNormal(0.0, 0.0, 1.0);\n\n  // Apply the texture\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(plane->GetOutputPort());\n\n  vtkNew<vtkActor> texturedPlane;\n  texturedPlane->SetMapper(planeMapper);\n  texturedPlane->SetTexture(texture);\n\n  // Visualize the textured plane\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(texturedPlane);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TextureMapImageData\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/TextureMapImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureMapImageData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  ImagingSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureMapImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureMapImageData MACOSX_BUNDLE TextureMapImageData.cxx )\n  target_link_libraries(TextureMapImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureMapImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/TextureMapImageData/#download-and-build-texturemapimagedata","title":"Download and Build TextureMapImageData","text":"

        Click here to download TextureMapImageData and its CMakeLists.txt file. Once the tarball TextureMapImageData.tar has been downloaded and extracted,

        cd TextureMapImageData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TextureMapImageData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/TextureMapPlane/","title":"TextureMapPlane","text":"

        vtk-examples/Cxx/Visualization/TextureMapPlane

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/TextureMapPlane/#description","title":"Description","text":"

        This example reads a jpg image file and uses it to texture map a plane.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/TextureMapPlane/#code","title":"Code","text":"

        TextureMapPlane.cxx

        #include <vtkImageData.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n#include <vtkTextureMapToPlane.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename e.g. Yinyang.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFilename = argv[1];\n\n  // Read the image which will be the texture\n  vtkNew<vtkJPEGReader> jPEGReader;\n  jPEGReader->SetFileName(inputFilename.c_str());\n\n  // Create a plane\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetCenter(0.0, 0.0, 0.0);\n  plane->SetNormal(0.0, 0.0, 1.0);\n\n  // Apply the texture\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(jPEGReader->GetOutputPort());\n\n  vtkNew<vtkTextureMapToPlane> texturePlane;\n  texturePlane->SetInputConnection(plane->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(texturePlane->GetOutputPort());\n\n  vtkNew<vtkActor> texturedPlane;\n  texturedPlane->SetMapper(planeMapper);\n  texturedPlane->SetTexture(texture);\n  texturedPlane->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize the textured plane\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(texturedPlane);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TextureMapPlane\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/TextureMapPlane/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureMapPlane)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  FiltersTexture\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureMapPlane: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureMapPlane MACOSX_BUNDLE TextureMapPlane.cxx )\n  target_link_libraries(TextureMapPlane PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureMapPlane\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/TextureMapPlane/#download-and-build-texturemapplane","title":"Download and Build TextureMapPlane","text":"

        Click here to download TextureMapPlane and its CMakeLists.txt file. Once the tarball TextureMapPlane.tar has been downloaded and extracted,

        cd TextureMapPlane/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TextureMapPlane\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/TextureMapQuad/","title":"TextureMapQuad","text":"

        vtk-examples/Cxx/Visualization/TextureMapQuad

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/TextureMapQuad/#description","title":"Description","text":"

        This example defines 4 points (coplanar) and textures them using the input image.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/TextureMapQuad/#code","title":"Code","text":"

        TextureMapQuad.cxx

        #include <string>\n#include <vtkCellArray.h>\n#include <vtkFloatArray.h>\n#include <vtkImageData.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolygon.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments\n  if (argc != 2)\n  {\n    std::cerr << \"Usage:\" << argv[0] << \" Filename e.g. Yinyang.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFilename = argv[1];\n\n  // Read the image which will be the texture\n  vtkNew<vtkJPEGReader> jPEGReader;\n  jPEGReader->SetFileName(inputFilename.c_str());\n\n  // Create a plane\n  vtkNew<vtkPoints> points;\n  points->InsertNextPoint(0.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 0.0, 0.0);\n  points->InsertNextPoint(1.0, 1.0, 0.0);\n  points->InsertNextPoint(0.0, 2.0, 0.0);\n\n  vtkNew<vtkCellArray> polygons;\n  vtkNew<vtkPolygon> polygon;\n  polygon->GetPointIds()->SetNumberOfIds(4); // make a quad\n  polygon->GetPointIds()->SetId(0, 0);\n  polygon->GetPointIds()->SetId(1, 1);\n  polygon->GetPointIds()->SetId(2, 2);\n  polygon->GetPointIds()->SetId(3, 3);\n\n  polygons->InsertNextCell(polygon);\n\n  vtkNew<vtkPolyData> quad;\n  quad->SetPoints(points);\n  quad->SetPolys(polygons);\n\n  vtkNew<vtkFloatArray> textureCoordinates;\n  textureCoordinates->SetNumberOfComponents(2);\n  textureCoordinates->SetName(\"TextureCoordinates\");\n\n  float tuple[2] = {0.0, 0.0};\n  textureCoordinates->InsertNextTuple(tuple);\n  tuple[0] = 1.0;\n  tuple[1] = 0.0;\n  textureCoordinates->InsertNextTuple(tuple);\n  tuple[0] = 1.0;\n  tuple[1] = 1.0;\n  textureCoordinates->InsertNextTuple(tuple);\n  tuple[0] = 0.0;\n  tuple[1] = 2.0;\n  textureCoordinates->InsertNextTuple(tuple);\n\n  quad->GetPointData()->SetTCoords(textureCoordinates);\n\n  // Apply the texture\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(jPEGReader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputData(quad);\n\n  vtkNew<vtkActor> texturedQuad;\n  texturedQuad->SetMapper(mapper);\n  texturedQuad->SetTexture(texture);\n  texturedQuad->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize the textured plane\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(texturedQuad);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TextureMapQuad\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/TextureMapQuad/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextureMapQuad)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextureMapQuad: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextureMapQuad MACOSX_BUNDLE TextureMapQuad.cxx )\n  target_link_libraries(TextureMapQuad PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextureMapQuad\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/TextureMapQuad/#download-and-build-texturemapquad","title":"Download and Build TextureMapQuad","text":"

        Click here to download TextureMapQuad and its CMakeLists.txt file. Once the tarball TextureMapQuad.tar has been downloaded and extracted,

        cd TextureMapQuad/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TextureMapQuad\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/TransformActor/","title":"TransformActor","text":"

        vtk-examples/Cxx/Visualization/TransformActor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/TransformActor/#description","title":"Description","text":"

        This examples demonstrates how to transform an actor. This is different than using vtkTransformPolyDataFilter in that it doesn't actually transform the data (you can't access the transformed coordinates) - it is all done on the video card.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/TransformActor/#code","title":"Code","text":"

        TransformActor.cxx

        #include <vtkActor.h>\n#include <vtkConeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a cone\n  vtkNew<vtkConeSource> coneSource1;\n  coneSource1->Update();\n\n  vtkNew<vtkConeSource> coneSource2;\n  coneSource2->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper1;\n  mapper1->SetInputConnection(coneSource1->GetOutputPort());\n  vtkNew<vtkActor> actor1;\n  actor1->SetMapper(mapper1);\n  actor1->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a second, transformed cone\n  vtkNew<vtkPolyDataMapper> mapper2;\n  mapper2->SetInputConnection(coneSource2->GetOutputPort());\n  vtkNew<vtkActor> actor2;\n  actor2->SetMapper(mapper2);\n  actor2->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  vtkNew<vtkTransform> transform;\n  transform->PostMultiply(); // this is the key line\n  transform->RotateZ(90.0);\n\n  actor2->SetUserTransform(transform);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TransformActor\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene\n  renderer->AddActor(actor1);\n  renderer->AddActor(actor2);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/TransformActor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformActor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformActor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformActor MACOSX_BUNDLE TransformActor.cxx )\n  target_link_libraries(TransformActor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformActor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/TransformActor/#download-and-build-transformactor","title":"Download and Build TransformActor","text":"

        Click here to download TransformActor and its CMakeLists.txt file. Once the tarball TransformActor.tar has been downloaded and extracted,

        cd TransformActor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TransformActor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/TransformActorCollection/","title":"TransformActorCollection","text":"

        vtk-examples/Cxx/Visualization/TransformActorCollection

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/TransformActorCollection/#code","title":"Code","text":"

        TransformActorCollection.cxx

        #include <vtkActor.h>\n#include <vtkActorCollection.h>\n#include <vtkConeSource.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n\n  // Create a cone.\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetHeight(3);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(coneSource->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create a cube.\n  vtkNew<vtkCubeSource> cubeSource;\n\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cubeSource->GetOutputPort());\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->SetMapper(cubeMapper);\n  cubeActor->GetProperty()->SetColor(colors->GetColor3d(\"Cornsilk\").GetData());\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Lavender\").GetData());\n\n  renderer->AddActor(sphereActor);\n\n  vtkNew<vtkActorCollection> actorCollection;\n  actorCollection->AddItem(cubeActor);\n  actorCollection->AddItem(coneActor);\n  actorCollection->InitTraversal();\n\n  vtkNew<vtkTransform> transform;\n  transform->PostMultiply(); // This is the key line.\n  transform->Translate(5.0, 0, 0);\n\n  // actorCollection->SetUserTransform(transform);\n\n  for (vtkIdType i = 0; i < actorCollection->GetNumberOfItems(); i++)\n  {\n    vtkActor* actor = actorCollection->GetNextActor();\n    actor->SetUserTransform(transform);\n    renderer->AddActor(actor);\n  }\n\n  // Create a renderer, render window, and interactor.\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TransformActorCollection\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/TransformActorCollection/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TransformActorCollection)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TransformActorCollection: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TransformActorCollection MACOSX_BUNDLE TransformActorCollection.cxx )\n  target_link_libraries(TransformActorCollection PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TransformActorCollection\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/TransformActorCollection/#download-and-build-transformactorcollection","title":"Download and Build TransformActorCollection","text":"

        Click here to download TransformActorCollection and its CMakeLists.txt file. Once the tarball TransformActorCollection.tar has been downloaded and extracted,

        cd TransformActorCollection/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TransformActorCollection\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/VectorField/","title":"VectorField","text":"

        vtk-examples/Cxx/Visualization/VectorField

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/VectorField/#code","title":"Code","text":"

        VectorField.cxx

        #include <vtkArrowSource.h>\n#include <vtkGlyph2D.h>\n#include <vtkImageData.h>\n#include <vtkImageSlice.h>\n#include <vtkImageSliceMapper.h>\n// #include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image.\n  vtkNew<vtkImageData> image;\n\n  // Specify the size of the image data.\n  image->SetDimensions(50, 50, 1);\n  image->AllocateScalars(VTK_FLOAT, 3);\n\n  int* dims = image->GetDimensions();\n\n  // Zero the image.\n  for (auto z = 0; z < dims[2]; ++z)\n  {\n    for (auto y = 0; y < dims[1]; ++y)\n    {\n      for (auto x = 0; x < dims[0]; ++x)\n      {\n        auto pixel = static_cast<float*>(image->GetScalarPointer(x, y, z));\n        pixel[0] = 0.0;\n        pixel[1] = 0.0;\n        pixel[2] = 0.0;\n      }\n    }\n  }\n\n  // Set two vectors.\n  {\n    auto pixel = static_cast<float*>(image->GetScalarPointer(20, 20, 0));\n    pixel[0] = -10.0;\n    pixel[1] = 5.0;\n  }\n\n  {\n    auto pixel = static_cast<float*>(image->GetScalarPointer(30, 30, 0));\n    pixel[0] = 10.0;\n    pixel[1] = 10.0;\n  }\n\n  // A better way to do this is (should be tested for compatibility and\n  // correctness).\n  // std::cout << image->GetPointData()->GetScalars()->GetName() << std::endl;\n  image->GetPointData()->SetActiveVectors(\n      image->GetPointData()->GetScalars()->GetName());\n  // image->GetPointData()->SetActiveVectors(\"ImageScalars\");\n\n  // Setup the arrows\n  vtkNew<vtkArrowSource> arrowSource;\n  arrowSource->Update();\n\n  vtkNew<vtkGlyph2D> glyphFilter;\n  glyphFilter->SetSourceConnection(arrowSource->GetOutputPort());\n  glyphFilter->OrientOn();\n  glyphFilter->SetVectorModeToUseVector();\n  glyphFilter->SetInputData(image);\n  glyphFilter->Update();\n\n  // Create actors\n  vtkNew<vtkImageSliceMapper> imageMapper;\n  imageMapper->SetInputData(image);\n\n  vtkNew<vtkImageSlice> imageSlice;\n  imageSlice->SetMapper(imageMapper);\n\n  vtkNew<vtkPolyDataMapper> vectorMapper;\n  vectorMapper->SetInputConnection(glyphFilter->GetOutputPort());\n  vtkNew<vtkActor> vectorActor;\n  vectorActor->SetMapper(vectorMapper);\n\n  // Setup renderer.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddViewProp(imageSlice);\n  renderer->AddViewProp(vectorActor);\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Setup render window.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VectorField\");\n\n  // Setup render window interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  // vtkNew<vtkInteractorStyleImage> style;\n  // renderWindowInteractor->SetInteractorStyle(style);\n\n  // Render and start interaction.\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/VectorField/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorField)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorField: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorField MACOSX_BUNDLE VectorField.cxx )\n  target_link_libraries(VectorField PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorField\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/VectorField/#download-and-build-vectorfield","title":"Download and Build VectorField","text":"

        Click here to download VectorField and its CMakeLists.txt file. Once the tarball VectorField.tar has been downloaded and extracted,

        cd VectorField/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VectorField\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/VectorOfActors/","title":"VectorOfActors","text":"

        vtk-examples/Cxx/Visualization/VectorOfActors

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/VectorOfActors/#description","title":"Description","text":"

        This example creates multiple actors and stores them in a vector. The resulting image is 10 spheres in a line.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/VectorOfActors/#code","title":"Code","text":"

        VectorOfActors.cxx

        #include <vtkActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n\n#include <vector>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n\n  for (unsigned int i = 0; i < 10; i++)\n  {\n    vtkNew<vtkSphereSource> sphereSource;\n    sphereSource->SetCenter(i, 0.0, 0.0);\n    sphereSource->SetRadius(0.2);\n\n    vtkNew<vtkPolyDataMapper> mapper;\n    mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n    vtkNew<vtkActor> actor;\n    actor->SetMapper(mapper);\n    actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n    actors.push_back(actor);\n  }\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VectorOfActors\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  for (unsigned int i = 0; i < actors.size(); i++)\n  {\n    renderer->AddActor(actors[i]);\n  }\n\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Render\n  renderWindow->Render();\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/VectorOfActors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorOfActors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorOfActors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorOfActors MACOSX_BUNDLE VectorOfActors.cxx )\n  target_link_libraries(VectorOfActors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorOfActors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/VectorOfActors/#download-and-build-vectorofactors","title":"Download and Build VectorOfActors","text":"

        Click here to download VectorOfActors and its CMakeLists.txt file. Once the tarball VectorOfActors.tar has been downloaded and extracted,

        cd VectorOfActors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VectorOfActors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/VectorText/","title":"VectorText","text":"

        vtk-examples/Cxx/Visualization/VectorText

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/VectorText/#description","title":"Description","text":"

        This example displays a red \"Hello\" in 3D space. For an example where the text always faces the camera, see Follower.

        If you want to draw text in 2D rather than 3D, take a look at TextWidget or DrawText.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/VectorText/#code","title":"Code","text":"

        VectorText.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorText.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create text.\n  vtkNew<vtkVectorText> textSource;\n  textSource->SetText(\"Hello\");\n  textSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(textSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  // Create a renderer, render window, and interactor.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VectorText\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actor to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Bisque\").GetData());\n\n  // Render and interact.\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/VectorText/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VectorText)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VectorText: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VectorText MACOSX_BUNDLE VectorText.cxx )\n  target_link_libraries(VectorText PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VectorText\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/VectorText/#download-and-build-vectortext","title":"Download and Build VectorText","text":"

        Click here to download VectorText and its CMakeLists.txt file. Once the tarball VectorText.tar has been downloaded and extracted,

        cd VectorText/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VectorText\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Visualize2DPoints/","title":"Visualize2DPoints","text":"

        vtk-examples/Cxx/Visualization/Visualize2DPoints

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/Visualize2DPoints/#description","title":"Description","text":"

        This example shows how to render a set of points. The example reads the points from a vtp file specified as the first command line argument. Ring is an example data set.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Visualize2DPoints/#code","title":"Code","text":"

        Visualize2DPoints.cxx

        #include <vtkActor2D.h>\n#include <vtkCellArray.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n// #include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper2D.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc != 2)\n  {\n    std::cout << \"Required parameters: Filename e.g. Ring.vtp\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::string inputFilename = argv[1];\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n  vtkPolyData* polydata = reader->GetOutput();\n  // vtkPoints* Points = Polydata->GetPoints();\n\n  vtkNew<vtkPolyDataMapper2D> mapper;\n  mapper->SetInputData(polydata);\n  mapper->ScalarVisibilityOff();\n  vtkNew<vtkActor2D> actor;\n  actor->SetMapper(mapper);\n\n  vtkProperty2D* property2D = actor->GetProperty();\n  property2D->SetColor(colors->GetColor3d(\"Gold\").GetData());\n  property2D->SetPointSize(2.0);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Renderer and RenderWindow.\n  renderer->ResetCamera();\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"Visualize2DPoints\");\n\n  renderWindow->SetSize(200, 200);\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Visualize2DPoints/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Visualize2DPoints)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Visualize2DPoints: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Visualize2DPoints MACOSX_BUNDLE Visualize2DPoints.cxx )\n  target_link_libraries(Visualize2DPoints PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Visualize2DPoints\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Visualize2DPoints/#download-and-build-visualize2dpoints","title":"Download and Build Visualize2DPoints","text":"

        Click here to download Visualize2DPoints and its CMakeLists.txt file. Once the tarball Visualize2DPoints.tar has been downloaded and extracted,

        cd Visualize2DPoints/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Visualize2DPoints\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/VisualizeImageData/","title":"VisualizeImageData","text":"

        vtk-examples/Cxx/Visualization/VisualizeImageData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/VisualizeImageData/#code","title":"Code","text":"

        VisualizeImageData.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(3, 3, 2);\n  imageData->SetSpacing(1.0, 1.0, 1.0);\n  imageData->SetOrigin(0.0, 0.0, 0.0);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(imageData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderer> renderer;\n\n  // Add both renderers to the window\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VisualizeImageData\");\n\n  // Add a sphere to the left and a cube to the right\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/VisualizeImageData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeImageData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeImageData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeImageData MACOSX_BUNDLE VisualizeImageData.cxx )\n  target_link_libraries(VisualizeImageData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeImageData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/VisualizeImageData/#download-and-build-visualizeimagedata","title":"Download and Build VisualizeImageData","text":"

        Click here to download VisualizeImageData and its CMakeLists.txt file. Once the tarball VisualizeImageData.tar has been downloaded and extracted,

        cd VisualizeImageData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VisualizeImageData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/VisualizeVTP/","title":"VisualizeVTP","text":"

        vtk-examples/Cxx/Visualization/VisualizeVTP

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/VisualizeVTP/#description","title":"Description","text":"

        This example shows how to load a vtp file and render it in an interactive window. The example accepts a .vtp file on the command line.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/VisualizeVTP/#code","title":"Code","text":"

        VisualizeVTP.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtp) e.g. Bummy.vtp\"\n              << std::endl;\n    return (EXIT_FAILURE);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Create a mapper\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  // Create an actor\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Tan\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"VisualizeVTP\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"CadetBlue\").GetData());\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->Render();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/VisualizeVTP/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VisualizeVTP)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VisualizeVTP: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VisualizeVTP MACOSX_BUNDLE VisualizeVTP.cxx )\n  target_link_libraries(VisualizeVTP PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VisualizeVTP\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/VisualizeVTP/#download-and-build-visualizevtp","title":"Download and Build VisualizeVTP","text":"

        Click here to download VisualizeVTP and its CMakeLists.txt file. Once the tarball VisualizeVTP.tar has been downloaded and extracted,

        cd VisualizeVTP/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VisualizeVTP\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/WindowSize/","title":"WindowSize","text":"

        vtk-examples/Cxx/Visualization/WindowSize

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/WindowSize/#code","title":"Code","text":"

        WindowSize.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(200, 100); //(width, height)\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"WindowSize\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/WindowSize/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WindowSize)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WindowSize: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WindowSize MACOSX_BUNDLE WindowSize.cxx )\n  target_link_libraries(WindowSize PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WindowSize\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/WindowSize/#download-and-build-windowsize","title":"Download and Build WindowSize","text":"

        Click here to download WindowSize and its CMakeLists.txt file. Once the tarball WindowSize.tar has been downloaded and extracted,

        cd WindowSize/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WindowSize\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/WindowTitle/","title":"WindowTitle","text":"

        vtk-examples/Cxx/Visualization/WindowTitle

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Visualization/WindowTitle/#description","title":"Description","text":"

        This example shows how to change the title of the window.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/WindowTitle/#code","title":"Code","text":"

        WindowTitle.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(5.0);\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Visualize\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"WindowTitle\"); // Set the title.\n\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/WindowTitle/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WindowTitle)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WindowTitle: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WindowTitle MACOSX_BUNDLE WindowTitle.cxx )\n  target_link_libraries(WindowTitle PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WindowTitle\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/WindowTitle/#download-and-build-windowtitle","title":"Download and Build WindowTitle","text":"

        Click here to download WindowTitle and its CMakeLists.txt file. Once the tarball WindowTitle.tar has been downloaded and extracted,

        cd WindowTitle/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WindowTitle\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Visualization/Wireframe/","title":"Wireframe","text":"

        vtk-examples/Cxx/Visualization/Wireframe

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Visualization/Wireframe/#code","title":"Code","text":"

        Wireframe.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create an image data\n  vtkNew<vtkImageData> imageData;\n\n  // Specify the size of the image data\n  imageData->SetDimensions(3, 3, 2);\n  imageData->SetSpacing(1.0, 1.0, 1.0);\n  imageData->SetOrigin(0.0, 0.0, 0.0);\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(imageData);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetRepresentationToWireframe();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Gold\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  vtkNew<vtkRenderer> renderer;\n\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Wireframe\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Navy\").GetData());\n\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Azimuth(-30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Visualization/Wireframe/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Wireframe)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Wireframe: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Wireframe MACOSX_BUNDLE Wireframe.cxx )\n  target_link_libraries(Wireframe PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Wireframe\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Visualization/Wireframe/#download-and-build-wireframe","title":"Download and Build Wireframe","text":"

        Click here to download Wireframe and its CMakeLists.txt file. Once the tarball Wireframe.tar has been downloaded and extracted,

        cd Wireframe/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Wireframe\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/AnatomicalOrientation/","title":"AnatomicalOrientation","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/AnatomicalOrientation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/AnatomicalOrientation/#description","title":"Description","text":"

        This depicts a human figure transected by the three commonly used anatomical planes:

        • Sagittal plane \u2013 is perpendicular to the ground divides the body into a left section and a right section.
        • Coronal plane \u2013 is perpendicular to the ground and divides the body into a front (anterior) section and back (posterior) section.
        • Transverse plane \u2013 or axial plane is parallel to the ground divides the body into an upper (superior) section and a bottom (inferior) section.

        Four annotated cube actors are also provided demonstrating different coordinate systems. The annotations on the faces of the cube actors are:

        • Sagittal plane
          • L - left.
          • R - right.
        • Coronal plane
          • A - anterior.
          • P - posterior.
        • Transverse plane
          • S - superior.
          • I - inferior.

        The annotated cube actors demonstrate the various coordinate systems: - The anatomical coordinate system forming a 3D basis is defined along the anatomical axes of anterior-posterior, inferior-superior, and left-right. These are the positive directions. In a Cartesian system this is RPS (Right, Posterior, Superior). The top-left annotated cube actor shows this basis, this is a left-handed system. - RAS (Right, Anterior, Superior), left-right, posterior-anterior, and inferior-superior. This is the usual right-handed system used by VTK and Slicer. The bottom left annotated cube actor shows this basis. - LPS (Left, Posterior, Superior), right-left, anterior-posterior, and inferior-superior. This is used in DICOM images and by the ITK toolkit. The bottom right annotated cube actor shows this basis. - The upper right cube actor has no axes and simply shows the planes.

        RPS is a left-handed system whilst RAS and LPS are right-handed.

        Note that the text for the planes is carefully placed to avoid obstructing the figure and it also sits slightly above the plane.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/AnatomicalOrientation/#code","title":"Code","text":"

        AnatomicalOrientation.cxx

        /*\n * The human data file is taken from:\n * https://github.com/Slicer/Slicer/blob/master/Base/Logic/Resources/OrientationMarkers/Human.vtp\n * Thanks to the Slicer people for providing this.\n *\n */\n\n#include <vtkAnnotatedCubeActor.h>\n#include <vtkAxesActor.h>\n#include <vtkCamera.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPropAssembly.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkTextProperty.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkVectorText.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <algorithm>\n#include <array>\n#include <iomanip>\n#include <iostream>\n#include <vector>\n\nnamespace {\n\n/**\n * @param scale Sets the scale and direction of the axes.\n * @param xyzLabels Labels for the axes.\n * @return The axes actor.\n */\nvtkSmartPointer<vtkAxesActor>\nMakeAxesActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels);\n\n/**\n * @param colors Used to set the colors of the cube faces.\n * @return The annotated cube actor.\n */\nvtkSmartPointer<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(vtkNamedColors* colors);\n\n/**\n * @param scale Sets the scale and direction of the axes.\n * @param xyzLabels Labels for the axes.\n * @param colors Used to set the colors of the cube faces.\n * @return The combined axes and annotated cube prop.\n */\nvtkSmartPointer<vtkPropAssembly>\nMakeCubeActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels, vtkNamedColors* colors);\n\n/**\n * Make the traverse, coronal and saggital planes.\n *\n * @param colors Used to set the color of the planes.\n * @return The planes actors.\n */\nstd::vector<vtkSmartPointer<vtkActor>> MakePlanesActors(vtkNamedColors* colors);\n\n/**\n * Generate text to place on the planes.\n * Careful placement is needed here.\n * @return The text actors.\n */\nstd::vector<vtkSmartPointer<vtkActor>> AddTextToPlanes();\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fileName\" << std::endl;\n    std::cout << \"where: fileName is Human.vtp.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName(argv[1]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the rendering window, renderer, and interactive renderer.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(780, 780);\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Make an annotated cube actor with axes and then add it into an orientation\n  // marker widget.\n  // Three of these need to be made.\n\n  // Right Posterior Superior\n  std::array<std::string, 3> xyzLabels{{\"X\", \"Y\", \"Z\"}};\n  std::array<double, 3> scale{{1.5, -1.5, 1.5}};\n  auto axes = MakeCubeActor(scale, xyzLabels, colors);\n  vtkNew<vtkOrientationMarkerWidget> om;\n  om->SetOrientationMarker(axes);\n  // Position upper left in the viewport.\n  om->SetViewport(0.0, 0.8, 0.2, 1.0);\n  om->SetInteractor(iren);\n  om->EnabledOn();\n  om->InteractiveOn();\n\n  // Right, Anterior, Superior.\n  std::array<double, 3> scale1{{1.5, 1.5, 1.5}};\n  auto axes1 = MakeCubeActor(scale1, xyzLabels, colors);\n  vtkNew<vtkOrientationMarkerWidget> om1;\n  om1->SetOrientationMarker(axes1);\n  // Position lower left in the viewport.\n  om1->SetViewport(0, 0, 0.2, 0.2);\n  om1->SetInteractor(iren);\n  om1->EnabledOn();\n  om1->InteractiveOn();\n\n  // Left, Posterior, Superior.\n  std::array<double, 3> scale2{{-1.5, -1.5, 1.5}};\n  auto axes2 = MakeCubeActor(scale2, xyzLabels, colors);\n  vtkNew<vtkOrientationMarkerWidget> om2;\n  om2->SetOrientationMarker(axes2);\n  // Position lower right in the viewport.\n  om2->SetViewport(0.8, 0, 1.0, 0.2);\n  om2->SetInteractor(iren);\n  om2->EnabledOn();\n  om2->InteractiveOn();\n\n  // Finally create an annotated cube actor adding it into an orientation marker\n  // widget.\n  auto axes3 = MakeAnnotatedCubeActor(colors);\n  vtkNew<vtkOrientationMarkerWidget> om3;\n  om3->SetOrientationMarker(axes3);\n  // Position upper right in the viewport.\n  om3->SetViewport(0.8, 0.8, 1.0, 1.0);\n  om3->SetInteractor(iren);\n  om3->EnabledOn();\n  om3->InteractiveOn();\n\n  // Read in the model.\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkPolyDataMapper> humanMapper;\n  humanMapper->SetInputConnection(reader->GetOutputPort());\n  humanMapper->SetScalarModeToUsePointFieldData();\n  humanMapper->SelectColorArray(\"Color\");\n  humanMapper->SetColorModeToDirectScalars();\n\n  vtkNew<vtkActor> humanActor;\n  humanActor->SetMapper(humanMapper);\n  std::vector<double> bounds(6, 0);\n  humanActor->GetBounds(&bounds[0]);\n  std::vector<double>::iterator maxElt =\n      std::max_element(bounds.begin(), bounds.end());\n  // Scale the actor\n  humanActor->SetScale(1.0 / *maxElt);\n  ren->AddActor(humanActor);\n\n  // Make the planes.\n  auto actors = MakePlanesActors(colors);\n  for (auto const& actor : actors)\n  {\n    ren->AddViewProp(actor);\n  }\n\n  // Label them.\n  auto textActors = AddTextToPlanes();\n  for (auto const& actor : textActors)\n  {\n    ren->AddViewProp(actor);\n  }\n\n  // Interact\n  ren->SetBackground2(colors->GetColor3d(\"OldLace\").GetData());\n  ren->SetBackground(colors->GetColor3d(\"MistyRose\").GetData());\n  ren->GradientBackgroundOn();\n  ren->ResetCamera();\n  ren->GetActiveCamera()->Zoom(1.6);\n  ren->GetActiveCamera()->SetPosition(-2.3, 4.1, 4.2);\n  ren->GetActiveCamera()->SetViewUp(0.0, 0.0, 1.0);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n  //  Call SetWindowName after renWin.Render() is called.\n  renWin->SetWindowName(\"AnatomicalOrientation\");\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkSmartPointer<vtkAxesActor>\nMakeAxesActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels)\n{\n  vtkNew<vtkAxesActor> axes;\n  axes->SetScale(scale[0], scale[1], scale[2]);\n  axes->SetShaftTypeToCylinder();\n  axes->SetXAxisLabelText(xyzLabels[0].c_str());\n  axes->SetYAxisLabelText(xyzLabels[1].c_str());\n  axes->SetZAxisLabelText(xyzLabels[2].c_str());\n  axes->SetCylinderRadius(0.5 * axes->GetCylinderRadius());\n  axes->SetConeRadius(1.025 * axes->GetConeRadius());\n  axes->SetSphereRadius(1.5 * axes->GetSphereRadius());\n  vtkTextProperty* tprop =\n      axes->GetXAxisCaptionActor2D()->GetCaptionTextProperty();\n  tprop->ItalicOn();\n  tprop->ShadowOn();\n  tprop->SetFontFamilyToTimes();\n  // Use the same text properties on the other two axes.\n  axes->GetYAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  axes->GetZAxisCaptionActor2D()->GetCaptionTextProperty()->ShallowCopy(tprop);\n  return axes;\n}\n\nvtkSmartPointer<vtkAnnotatedCubeActor>\nMakeAnnotatedCubeActor(vtkNamedColors* colors)\n{\n  // A cube with labeled faces.\n  vtkNew<vtkAnnotatedCubeActor> cube;\n  cube->SetXPlusFaceText(\"R\");  // Right\n  cube->SetXMinusFaceText(\"L\"); // Left\n  cube->SetYPlusFaceText(\"A\");  // Anterior\n  cube->SetYMinusFaceText(\"P\"); // Posterior\n  cube->SetZPlusFaceText(\"S\");  // Superior/Cranial\n  cube->SetZMinusFaceText(\"I\"); // Inferior/Caudal\n  cube->SetFaceTextScale(0.5);\n  cube->GetCubeProperty()->SetColor(colors->GetColor3d(\"Gainsboro\").GetData());\n\n  cube->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"LightSlateGray\").GetData());\n\n  // Change the vector text colors.\n  cube->GetXPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetXMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  cube->GetYPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetYMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData());\n  cube->GetZPlusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  cube->GetZMinusFaceProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData());\n  return cube;\n}\n\nvtkSmartPointer<vtkPropAssembly>\nMakeCubeActor(std::array<double, 3>& scale,\n              std::array<std::string, 3>& xyzLabels, vtkNamedColors* colors)\n{\n  // We are combining a vtk.vtkAxesActor and a vtk.vtkAnnotatedCubeActor\n  // into a vtk.vtkPropAssembly\n  vtkSmartPointer<vtkAnnotatedCubeActor> cube = MakeAnnotatedCubeActor(colors);\n  vtkSmartPointer<vtkAxesActor> axes = MakeAxesActor(scale, xyzLabels);\n\n  // Combine orientation markers into one with an assembly.\n  vtkNew<vtkPropAssembly> assembly;\n  assembly->AddPart(axes);\n  assembly->AddPart(cube);\n  return assembly;\n}\n\nvtkSmartPointer<vtkTransformPolyDataFilter>\nMakePlane(std::array<int, 2>& resolution, std::array<double, 3>& origin,\n          std::array<double, 3>& point1, std::array<double, 3>& point2,\n          std::array<double, 4>& wxyz, std::array<double, 3>& translate)\n{\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetResolution(resolution[0], resolution[1]);\n  plane->SetOrigin(origin.data());\n  plane->SetPoint1(point1.data());\n  plane->SetPoint2(point2.data());\n  vtkNew<vtkTransform> trnf;\n  trnf->RotateWXYZ(wxyz[0], wxyz[1], wxyz[2], wxyz[3]);\n  trnf->Translate(translate.data());\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane;\n  tpdPlane->SetTransform(trnf);\n  tpdPlane->SetInputConnection(plane->GetOutputPort());\n  return tpdPlane;\n}\n\nstd::vector<vtkSmartPointer<vtkActor>> MakePlanesActors(vtkNamedColors* colors)\n{\n  std::vector<vtkSmartPointer<vtkTransformPolyDataFilter>> planes;\n  std::vector<vtkSmartPointer<vtkPolyDataMapper>> mappers;\n  std::vector<vtkSmartPointer<vtkActor>> actors;\n\n  // Parameters for a plane lying in the x-y plane.\n  std::array<int, 2> resolution{{10, 10}};\n  std::array<double, 3> origin{{0.0, 0.0, 0.0}};\n  std::array<double, 3> point1{{1, 0, 0}};\n  std::array<double, 3> point2{{0, 1, 0}};\n\n  std::array<double, 4> wxyz0{{0, 0, 0, 0}};\n  std::array<double, 3> translate{{-0.5, -0.5, 0}};\n  std::array<double, 4> wxyz1{{-90, 1, 0, 0}};\n  std::array<double, 4> wxyz2{{-90, 0, 1, 0}};\n  planes.push_back(MakePlane(resolution, origin, point1, point2, wxyz0,\n                             translate)); // x-y plane\n  planes.push_back(MakePlane(resolution, origin, point1, point2, wxyz1,\n                             translate)); // x-z plane\n  planes.push_back(MakePlane(resolution, origin, point1, point2, wxyz2,\n                             translate)); // y-z plane\n  for (size_t i = 0; i < planes.size(); ++i)\n  {\n    mappers.push_back(vtkSmartPointer<vtkPolyDataMapper>::New());\n    mappers[i]->SetInputConnection(planes[i]->GetOutputPort());\n    actors.push_back(vtkSmartPointer<vtkActor>::New());\n    actors[i]->SetMapper(mappers[i]);\n  }\n  actors[0]->GetProperty()->SetColor(\n      colors->GetColor3d(\"SeaGreen\").GetData()); // Transverse plane\n  actors[1]->GetProperty()->SetColor(\n      colors->GetColor3d(\"DeepSkyBlue\").GetData()); // Coronal plane\n  actors[2]->GetProperty()->SetColor(\n      colors->GetColor3d(\"Tomato\").GetData()); // Saggital plane\n  return actors;\n}\n\nstd::vector<vtkSmartPointer<vtkActor>> AddTextToPlanes()\n{\n  std::vector<vtkSmartPointer<vtkActor>> textActors;\n  std::array<double, 3> scale{{0.04, 0.04, 0.04}};\n\n  vtkNew<vtkVectorText> text1;\n  text1->SetText(\"Transverse\\nPlane\\n\\nSuperior\\nCranial\");\n  vtkNew<vtkTransform> trnf1;\n  trnf1->RotateZ(-90);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane1;\n  tpdPlane1->SetTransform(trnf1);\n  tpdPlane1->SetInputConnection(text1->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper1;\n  textMapper1->SetInputConnection(tpdPlane1->GetOutputPort());\n  vtkNew<vtkActor> textActor1;\n  textActor1->SetMapper(textMapper1);\n  textActor1->SetScale(scale.data());\n  textActor1->AddPosition(0.4, 0.49, 0.01);\n  textActors.push_back(textActor1);\n\n  vtkNew<vtkVectorText> text2;\n  text2->SetText(\"Transverse\\nPlane\\n\\nInferior\\n(Caudal)\");\n  vtkNew<vtkTransform> trnf2;\n  trnf2->RotateZ(270);\n  trnf2->RotateWXYZ(180, 0, 1, 0);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane2;\n  tpdPlane2->SetTransform(trnf2);\n  tpdPlane2->SetInputConnection(text2->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper2;\n  textMapper2->SetInputConnection(tpdPlane2->GetOutputPort());\n  vtkNew<vtkActor> textActor2;\n  textActor2->SetMapper(textMapper2);\n  textActor2->SetScale(scale.data());\n  textActor2->AddPosition(0.4, -0.49, -0.01);\n  textActors.push_back(textActor2);\n\n  vtkNew<vtkVectorText> text3;\n  text3->SetText(\"Sagittal\\nPlane\\n\\nLeft\");\n  vtkNew<vtkTransform> trnf3;\n  trnf3->RotateX(90);\n  trnf3->RotateWXYZ(-90, 0, 1, 0);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane3;\n  tpdPlane3->SetTransform(trnf3);\n  tpdPlane3->SetInputConnection(text3->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper3;\n  textMapper3->SetInputConnection(tpdPlane3->GetOutputPort());\n  vtkNew<vtkActor> textActor3;\n  textActor3->SetMapper(textMapper3);\n  textActor3->SetScale(scale.data());\n  textActor3->AddPosition(-0.01, 0.49, 0.4);\n  textActors.push_back(textActor3);\n\n  vtkNew<vtkVectorText> text4;\n  text4->SetText(\"Sagittal\\nPlane\\n\\nRight\");\n  vtkNew<vtkTransform> trnf4;\n  trnf4->RotateX(90);\n  trnf4->RotateWXYZ(-270, 0, 1, 0);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane4;\n  tpdPlane4->SetTransform(trnf4);\n  tpdPlane4->SetInputConnection(text4->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper4;\n  textMapper4->SetInputConnection(tpdPlane4->GetOutputPort());\n  vtkNew<vtkActor> textActor4;\n  textActor4->SetMapper(textMapper4);\n  textActor4->SetScale(scale.data());\n  textActor4->AddPosition(0.01, -0.49, 0.4);\n  textActors.push_back(textActor4);\n\n  vtkNew<vtkVectorText> text5;\n  text5->SetText(\"Coronal\\nPlane\\n\\nAnterior\");\n  vtkNew<vtkTransform> trnf5;\n  trnf5->RotateY(-180);\n  trnf5->RotateWXYZ(-90, 1, 0, 0);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane5;\n  tpdPlane5->SetTransform(trnf5);\n  tpdPlane5->SetInputConnection(text5->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper5;\n  textMapper5->SetInputConnection(tpdPlane5->GetOutputPort());\n  vtkNew<vtkActor> textActor5;\n  textActor5->SetMapper(textMapper5);\n  textActor5->SetScale(scale.data());\n  textActor5->AddPosition(0.49, 0.01, 0.20);\n  textActors.push_back(textActor5);\n\n  vtkNew<vtkVectorText> text6;\n  text6->SetText(\"Coronal\\nPlane\\n\\nPosterior\");\n  vtkNew<vtkTransform> trnf6;\n  trnf6->RotateWXYZ(90, 1, 0, 0);\n  vtkNew<vtkTransformPolyDataFilter> tpdPlane6;\n  tpdPlane6->SetTransform(trnf6);\n  tpdPlane6->SetInputConnection(text6->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> textMapper6;\n  textMapper6->SetInputConnection(tpdPlane6->GetOutputPort());\n  vtkNew<vtkActor> textActor6;\n  textActor6->SetMapper(textMapper6);\n  textActor6->SetScale(scale.data());\n  textActor6->AddPosition(-0.49, -0.01, 0.3);\n  textActors.push_back(textActor6);\n\n  return textActors;\n}\n} // namespace\n
        "},{"location":"Cxx/VisualizationAlgorithms/AnatomicalOrientation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AnatomicalOrientation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AnatomicalOrientation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AnatomicalOrientation MACOSX_BUNDLE AnatomicalOrientation.cxx )\n  target_link_libraries(AnatomicalOrientation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AnatomicalOrientation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/AnatomicalOrientation/#download-and-build-anatomicalorientation","title":"Download and Build AnatomicalOrientation","text":"

        Click here to download AnatomicalOrientation and its CMakeLists.txt file. Once the tarball AnatomicalOrientation.tar has been downloaded and extracted,

        cd AnatomicalOrientation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AnatomicalOrientation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/","title":"BandedPolyDataContourFilter","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/#description","title":"Description","text":"

        Note

        This original source code for this example is here.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/#code","title":"Code","text":"

        BandedPolyDataContourFilter.cxx

        #include <vtkActor.h>\n#include <vtkBandedPolyDataContourFilter.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkFloatArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPoints> pts;\n  pts->InsertPoint(0, 0, 0, 0);\n  pts->InsertPoint(1, 0, 1, 0);\n  pts->InsertPoint(2, 0, 2, 0);\n  pts->InsertPoint(3, 1, 0, 0);\n  pts->InsertPoint(4, 1, 1, 0);\n  pts->InsertPoint(5, 1, 2, 0);\n  pts->InsertPoint(6, 2, 0, 0);\n  pts->InsertPoint(7, 2, 2, 0);\n  pts->InsertPoint(8, 3, 0, 0);\n  pts->InsertPoint(9, 3, 1, 0);\n  pts->InsertPoint(10, 3, 2, 0);\n  pts->InsertPoint(11, 4, 0, 0);\n  pts->InsertPoint(12, 6, 0, 0);\n  pts->InsertPoint(13, 5, 2, 0);\n  pts->InsertPoint(14, 7, 0, 0);\n  pts->InsertPoint(15, 9, 0, 0);\n  pts->InsertPoint(16, 7, 2, 0);\n  pts->InsertPoint(17, 9, 2, 0);\n  pts->InsertPoint(18, 10, 0, 0);\n  pts->InsertPoint(19, 12, 0, 0);\n  pts->InsertPoint(20, 10, 1, 0);\n  pts->InsertPoint(21, 12, 1, 0);\n  pts->InsertPoint(22, 10, 2, 0);\n  pts->InsertPoint(23, 12, 2, 0);\n  pts->InsertPoint(24, 10, 3, 0);\n  pts->InsertPoint(25, 12, 3, 0);\n\n  vtkNew<vtkCellArray> polys;\n  polys->InsertNextCell(4);\n  polys->InsertCellPoint(14);\n  polys->InsertCellPoint(15);\n  polys->InsertCellPoint(17);\n  polys->InsertCellPoint(16);\n  polys->InsertNextCell(3);\n  polys->InsertCellPoint(11);\n  polys->InsertCellPoint(12);\n  polys->InsertCellPoint(13);\n\n  vtkNew<vtkFloatArray> scalars;\n  scalars->SetNumberOfTuples(26);\n  scalars->SetTuple1(0, 0);\n  scalars->SetTuple1(1, 50);\n  scalars->SetTuple1(2, 100);\n  scalars->SetTuple1(3, 0);\n  scalars->SetTuple1(4, 50);\n  scalars->SetTuple1(5, 100);\n  scalars->SetTuple1(6, 10);\n  scalars->SetTuple1(7, 90);\n  scalars->SetTuple1(8, 10);\n  scalars->SetTuple1(9, 50);\n  scalars->SetTuple1(10, 90);\n  scalars->SetTuple1(11, 10);\n  scalars->SetTuple1(12, 40);\n  scalars->SetTuple1(13, 100);\n  scalars->SetTuple1(14, 0);\n  scalars->SetTuple1(15, 60);\n  scalars->SetTuple1(16, 40);\n  scalars->SetTuple1(17, 100);\n  scalars->SetTuple1(18, 0);\n  scalars->SetTuple1(19, 25);\n  scalars->SetTuple1(20, 25);\n  scalars->SetTuple1(21, 50);\n  scalars->SetTuple1(22, 50);\n  scalars->SetTuple1(23, 75);\n  scalars->SetTuple1(24, 75);\n  scalars->SetTuple1(25, 100);\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(pts);\n  polyData->SetPolys(polys);\n  polyData->GetPointData()->SetScalars(scalars);\n\n  vtkNew<vtkBandedPolyDataContourFilter> bf;\n  bf->SetInputData(polyData);\n  bf->GenerateValues(5, 25, 75);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(bf->GetOutputPort());\n  mapper->SetScalarModeToUseCellData();\n  mapper->SetScalarRange(0, 4);\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create the RenderWindow, Renderer and both Actors.\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size.\n  renderer->AddActor(actor);\n\n  renderWindow->SetSize(1200, 400);\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"BandedPolyDataContourFilter\");\n\n  renderer->SetBackground(colors->GetColor3d(\"Melon\").GetData());\n  renderer->GetActiveCamera()->Zoom(2.5);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BandedPolyDataContourFilter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersModeling\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BandedPolyDataContourFilter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BandedPolyDataContourFilter MACOSX_BUNDLE BandedPolyDataContourFilter.cxx )\n  target_link_libraries(BandedPolyDataContourFilter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BandedPolyDataContourFilter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/#download-and-build-bandedpolydatacontourfilter","title":"Download and Build BandedPolyDataContourFilter","text":"

        Click here to download BandedPolyDataContourFilter and its CMakeLists.txt file. Once the tarball BandedPolyDataContourFilter.tar has been downloaded and extracted,

        cd BandedPolyDataContourFilter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BandedPolyDataContourFilter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/BluntStreamlines/","title":"BluntStreamlines","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/BluntStreamlines

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/BluntStreamlines/#description","title":"Description","text":"

        This example shows airflow around a blunt fin. This example consists of a wall with half a rounded fin projecting into the fluid flow. (Using arguments of symmetry, only half of the domain was modeled.) Twenty-five streamlines are released upstream of the fin. The boundary layer effects near the junction of the fin and wall are clearly evident from the streamlines. In this area, flow recirculation is apparent, as well as the reduced flow speed.

        Info

        See Figure 6-19 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/BluntStreamlines/#code","title":"Code","text":"

        BluntStreamlines.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLineSource.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc != 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" bluntfinxyz.bin bluntfinq.bin\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  double range[2], c[3];\n  double maxTime = 0.0;\n\n  auto colors = vtkSmartPointer<vtkNamedColors>::New();\n\n  auto aren = vtkSmartPointer<vtkRenderer>::New();\n  auto renWin = vtkSmartPointer<vtkRenderWindow>::New();\n  renWin->AddRenderer(aren);\n  auto iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renWin);\n\n  std::string xyzFilename = argv[1];\n  std::string qFilename = argv[2];\n\n  auto reader = vtkSmartPointer<vtkMultiBlockPLOT3DReader>::New();\n  reader->SetXYZFileName(xyzFilename.c_str());\n  reader->SetQFileName(qFilename.c_str());\n  reader->Update(); // Force a read to occur.\n\n  vtkStructuredGrid* pd =\n      dynamic_cast<vtkStructuredGrid*>(reader->GetOutput()->GetBlock(0));\n  pd->GetCenter(c);\n  if (pd->GetPointData()->GetScalars())\n  {\n    pd->GetPointData()->GetScalars()->GetRange(range);\n  }\n  if (pd->GetPointData()->GetVectors())\n  {\n    auto maxVelocity = pd->GetPointData()->GetVectors()->GetMaxNorm();\n    maxTime = 20.0 * pd->GetLength() / maxVelocity;\n  }\n\n  auto outlineF = vtkSmartPointer<vtkStructuredGridOutlineFilter>::New();\n  outlineF->SetInputData(pd);\n\n  auto outlineMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n  outlineMapper->SetInputConnection(outlineF->GetOutputPort());\n\n  auto outline = vtkSmartPointer<vtkActor>::New();\n  outline->SetMapper(outlineMapper);\n  outline->GetProperty()->SetColor(colors->GetColor3d(\"Moccasin\").GetData());\n  outline->GetProperty()->SetLineWidth(2.0);\n\n  //\n  // Some geometry for context.\n  //\n  auto wall = vtkSmartPointer<vtkStructuredGridGeometryFilter>::New();\n  wall->SetInputData(pd);\n  wall->SetExtent(0, 100, 0, 100, 0, 0);\n\n  auto wallMap = vtkSmartPointer<vtkPolyDataMapper>::New();\n  wallMap->SetInputConnection(wall->GetOutputPort());\n  wallMap->ScalarVisibilityOff();\n\n  auto wallActor = vtkSmartPointer<vtkActor>::New();\n  wallActor->SetMapper(wallMap);\n  wallActor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  auto fin = vtkSmartPointer<vtkStructuredGridGeometryFilter>::New();\n  fin->SetInputData(pd);\n  fin->SetExtent(0, 100, 0, 0, 0, 100);\n\n  auto finMap = vtkSmartPointer<vtkPolyDataMapper>::New();\n  finMap->SetInputConnection(fin->GetOutputPort());\n  finMap->ScalarVisibilityOff();\n\n  auto finActor = vtkSmartPointer<vtkActor>::New();\n  finActor->SetMapper(finMap);\n  finActor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n  //\n  // Regular streamlines.\n  //\n  auto line1 = vtkSmartPointer<vtkLineSource>::New();\n  line1->SetResolution(25);\n  line1->SetPoint1(-6.36, 0.25, 0.06);\n  line1->SetPoint2(-6.36, 0.25, 5.37);\n\n  auto rakeMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n  rakeMapper->SetInputConnection(line1->GetOutputPort());\n\n  auto rake1 = vtkSmartPointer<vtkActor>::New();\n  rake1->SetMapper(rakeMapper);\n  rake1->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  rake1->GetProperty()->SetLineWidth(5);\n\n  auto streamers = vtkSmartPointer<vtkStreamTracer>::New();\n  //  streamers->DebugOn();\n  streamers->SetInputConnection(reader->GetOutputPort());\n  streamers->SetSourceConnection(line1->GetOutputPort());\n  streamers->SetMaximumPropagation(maxTime);\n  streamers->SetInitialIntegrationStep(0.2);\n  streamers->SetMinimumIntegrationStep(0.01);\n  streamers->SetIntegratorType(2);\n  streamers->Update();\n\n  auto streamersMapper = vtkSmartPointer<vtkPolyDataMapper>::New();\n  streamersMapper->SetInputConnection(streamers->GetOutputPort());\n  streamersMapper->SetScalarRange(range);\n\n  auto lines = vtkSmartPointer<vtkActor>::New();\n  lines->SetMapper(streamersMapper);\n\n  aren->AddActor(outline);\n  aren->AddActor(wallActor);\n  aren->AddActor(finActor);\n  aren->AddActor(rake1);\n  aren->AddActor(lines);\n  aren->SetBackground(colors->GetColor3d(\"Gray\").GetData());\n\n  aren->ResetCamera();\n  aren->GetActiveCamera()->Elevation(30.0);\n  aren->GetActiveCamera()->Azimuth(30.0);\n  aren->GetActiveCamera()->Dolly(1.2);\n  aren->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"BluntStreamlines\");\n  renWin->Render();\n\n  // Interact with data.\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/BluntStreamlines/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BluntStreamlines)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BluntStreamlines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BluntStreamlines MACOSX_BUNDLE BluntStreamlines.cxx )\n  target_link_libraries(BluntStreamlines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BluntStreamlines\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/BluntStreamlines/#download-and-build-bluntstreamlines","title":"Download and Build BluntStreamlines","text":"

        Click here to download BluntStreamlines and its CMakeLists.txt file. Once the tarball BluntStreamlines.tar has been downloaded and extracted,

        cd BluntStreamlines/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BluntStreamlines\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/CarotidFlow/","title":"CarotidFlow","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/CarotidFlow

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/CarotidFlow/#description","title":"Description","text":"

        This example generates streamtubes of blood velocity. an isosurface of speed provides context. The starting positions for the streamtubes were determined by experimenting with the data. Because of the way the data was measured and the resolution of the velocity field, many streamers travel outside the artery. This is because the boundary layer of the blood flow is not captured due to limitations in data resolution. Consequently, as the blood flows around curves, there is a component of the velocity field that directs the streamtube outside the artery. As a result it is hard to find starting positions for the streamtubes that yield interesting results. The examples uses the source object vtkPointSource in combination with vtkThresholdPoints to work around this problem. vtkPointSource generates random points centered around a sphere of a specified radius. We need only find an approximate position for the starting points of the streamtubes and then generate a cloud of random seed points. vtkThresholdPoints is used to cull points that may be generated outside the regions of high flow velocity.

        Cite

        See 3D Phase Contrast MRI of Cerebral Blood Flow and Surface Anatomy for background.

        Info

        See Figure 6-44 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/CarotidFlow/#code","title":"Code","text":"

        CarotidFlow.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" carotid.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // create pipeline\n  //\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkPointSource> psource;\n  psource->SetNumberOfPoints(25);\n  psource->SetCenter(133.1, 116.3, 5.0);\n  psource->SetRadius(2.0);\n\n  vtkNew<vtkThresholdPoints> threshold;\n  threshold->SetInputConnection(reader->GetOutputPort());\n  threshold->ThresholdByUpper(275);\n\n  vtkNew<vtkStreamTracer> streamers;\n  streamers->SetInputConnection(reader->GetOutputPort());\n  streamers->SetSourceConnection(psource->GetOutputPort());\n  //  streamers->SetMaximumPropagationUnitToTimeUnit();\n  streamers->SetMaximumPropagation(100.0);\n  //  streamers->SetInitialIntegrationStepUnitToCellLengthUnit();\n  streamers->SetInitialIntegrationStep(0.2);\n  streamers->SetTerminalSpeed(.01);\n  streamers->Update();\n  double range[2];\n  range[0] =\n      streamers->GetOutput()->GetPointData()->GetScalars()->GetRange()[0];\n  range[1] =\n      streamers->GetOutput()->GetPointData()->GetScalars()->GetRange()[1];\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(streamers->GetOutputPort());\n  tubes->SetRadius(0.3);\n  tubes->SetNumberOfSides(6);\n  tubes->SetVaryRadius(0);\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(.667, 0.0);\n  lut->Build();\n\n  vtkNew<vtkPolyDataMapper> streamerMapper;\n  streamerMapper->SetInputConnection(tubes->GetOutputPort());\n  streamerMapper->SetScalarRange(range[0], range[1]);\n  streamerMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> streamerActor;\n  streamerActor->SetMapper(streamerMapper);\n\n  // contours of speed\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->SetValue(0, 175);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetRepresentationToWireframe();\n  isoActor->GetProperty()->SetOpacity(0.25);\n\n  // outline\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(streamerActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CarotidFlow\");\n\n  vtkNew<vtkCamera> cam1;\n  cam1->SetClippingRange(17.4043, 870.216);\n  cam1->SetFocalPoint(136.71, 104.025, 23);\n  cam1->SetPosition(204.747, 258.939, 63.7925);\n  cam1->SetViewUp(-0.102647, -0.210897, 0.972104);\n  cam1->Zoom(1.2);\n  ren1->SetActiveCamera(cam1);\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/CarotidFlow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CarotidFlow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersModeling\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CarotidFlow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CarotidFlow MACOSX_BUNDLE CarotidFlow.cxx )\n  target_link_libraries(CarotidFlow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CarotidFlow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/CarotidFlow/#download-and-build-carotidflow","title":"Download and Build CarotidFlow","text":"

        Click here to download CarotidFlow and its CMakeLists.txt file. Once the tarball CarotidFlow.tar has been downloaded and extracted,

        cd CarotidFlow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CarotidFlow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/","title":"CarotidFlowGlyphs","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/#description","title":"Description","text":"

        Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude.

        Info

        See Figure 6-43 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/#code","title":"Code","text":"

        CarotidFlowGlyphs.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkContourFilter.h>\n#include <vtkGlyph3D.h>\n#include <vtkLookupTable.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPoints.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkThresholdPoints.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" carotid.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkSmartPointer<vtkNamedColors> colors =\n      vtkSmartPointer<vtkNamedColors>::New();\n\n  vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();\n\n  vtkSmartPointer<vtkRenderWindow> renWin =\n      vtkSmartPointer<vtkRenderWindow>::New();\n  renWin->AddRenderer(ren1);\n\n  vtkSmartPointer<vtkRenderWindowInteractor> iren =\n      vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  iren->SetRenderWindow(renWin);\n\n  // create pipeline\n  //\n  vtkSmartPointer<vtkStructuredPointsReader> reader =\n      vtkSmartPointer<vtkStructuredPointsReader>::New();\n  reader->SetFileName(argv[1]);\n\n  vtkSmartPointer<vtkThresholdPoints> threshold =\n      vtkSmartPointer<vtkThresholdPoints>::New();\n  threshold->SetInputConnection(reader->GetOutputPort());\n  threshold->ThresholdByUpper(200);\n\n  vtkSmartPointer<vtkMaskPoints> mask = vtkSmartPointer<vtkMaskPoints>::New();\n  mask->SetInputConnection(threshold->GetOutputPort());\n  mask->SetOnRatio(5);\n\n  vtkSmartPointer<vtkConeSource> cone = vtkSmartPointer<vtkConeSource>::New();\n  cone->SetResolution(11);\n  cone->SetHeight(1);\n  cone->SetRadius(0.25);\n\n  vtkSmartPointer<vtkGlyph3D> cones = vtkSmartPointer<vtkGlyph3D>::New();\n  cones->SetInputConnection(mask->GetOutputPort());\n  cones->SetSourceConnection(cone->GetOutputPort());\n  cones->SetScaleFactor(0.4);\n  cones->SetScaleModeToScaleByVector();\n\n  vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New();\n  lut->SetHueRange(.667, 0.0);\n  lut->Build();\n\n  double range[2];\n  cones->Update();\n  range[0] = cones->GetOutput()->GetPointData()->GetScalars()->GetRange()[0];\n  range[1] = cones->GetOutput()->GetPointData()->GetScalars()->GetRange()[1];\n  std::cout << \"range: \" << range[0] << \", \" << range[1] << std::endl;\n\n  vtkSmartPointer<vtkPolyDataMapper> vectorMapper =\n      vtkSmartPointer<vtkPolyDataMapper>::New();\n  vectorMapper->SetInputConnection(cones->GetOutputPort());\n  vectorMapper->SetScalarRange(range[0], range[1]);\n  vectorMapper->SetLookupTable(lut);\n\n  vtkSmartPointer<vtkActor> vectorActor = vtkSmartPointer<vtkActor>::New();\n  vectorActor->SetMapper(vectorMapper);\n\n  // Contours of speed.\n  vtkSmartPointer<vtkContourFilter> iso =\n      vtkSmartPointer<vtkContourFilter>::New();\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->SetValue(0, 175);\n\n  vtkSmartPointer<vtkPolyDataMapper> isoMapper =\n      vtkSmartPointer<vtkPolyDataMapper>::New();\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkSmartPointer<vtkActor> isoActor = vtkSmartPointer<vtkActor>::New();\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetRepresentationToWireframe();\n  isoActor->GetProperty()->SetOpacity(0.25);\n\n  // Outline\n  vtkSmartPointer<vtkOutlineFilter> outline =\n      vtkSmartPointer<vtkOutlineFilter>::New();\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkSmartPointer<vtkPolyDataMapper> outlineMapper =\n      vtkSmartPointer<vtkPolyDataMapper>::New();\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkSmartPointer<vtkActor> outlineActor = vtkSmartPointer<vtkActor>::New();\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(vectorActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CarotidFlowGlyphs\");\n\n  vtkSmartPointer<vtkCamera> cam1 = vtkSmartPointer<vtkCamera>::New();\n  cam1->SetClippingRange(17.4043, 870.216);\n  cam1->SetFocalPoint(136.71, 104.025, 23);\n  cam1->SetPosition(204.747, 258.939, 63.7925);\n  cam1->SetViewUp(-0.102647, -0.210897, 0.972104);\n  cam1->Zoom(1.2);\n  ren1->SetActiveCamera(cam1);\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CarotidFlowGlyphs)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CarotidFlowGlyphs: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CarotidFlowGlyphs MACOSX_BUNDLE CarotidFlowGlyphs.cxx )\n  target_link_libraries(CarotidFlowGlyphs PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CarotidFlowGlyphs\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/#download-and-build-carotidflowglyphs","title":"Download and Build CarotidFlowGlyphs","text":"

        Click here to download CarotidFlowGlyphs and its CMakeLists.txt file. Once the tarball CarotidFlowGlyphs.tar has been downloaded and extracted,

        cd CarotidFlowGlyphs/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CarotidFlowGlyphs\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/ClipSphereCylinder/","title":"ClipSphereCylinder","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/ClipSphereCylinder

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/ClipSphereCylinder/#description","title":"Description","text":"

        Clipping is implemented in vtkClipPolyData . Each polygonal data primitive implements the operation in its Clip() method using case tables. vtkClipPolyData has methods to control whether an implicit function provides the scalar data or whether the dataset\u2019s scalar data will be used. ComputeScalarDataOn() uses the implicit function and ComputeScalarDataOff() uses the dataset\u2019s scalar data. Two output polygonal datasets are produced. These are accessed with GetOutput() and GetClippedOutput() methods. GetOutput() returns the polygonal data that is \u201cinside\u201d the clipping region while GetClippedOutput() returns polygonal data that is \u201coutside\u201d the region. (Note that GenerateClippedOutputOn() must be enabled if you are to get the clipped output.) The meaning of inside and outside can be reversed using the InsideOutOn().

        This example shows a plane of quadrilaterals clipped with a boolean implicit function.

        Info

        See Figure 9-48 in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/ClipSphereCylinder/#code","title":"Code","text":"

        ClipSphereCylinder.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkCylinder.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphere.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  // Demonstrate the use of clipping on polygonal data\n  //\n\n  // create pipeline\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetXResolution(25);\n  plane->SetYResolution(25);\n  plane->SetOrigin(-1, -1, 0);\n  plane->SetPoint1(1, -1, 0);\n  plane->SetPoint2(-1, 1, 0);\n\n  vtkNew<vtkTransform> transformSphere;\n  transformSphere->Identity();\n  transformSphere->Translate(.4, -.4, 0);\n  transformSphere->Inverse();\n\n  vtkNew<vtkSphere> sphere;\n  sphere->SetTransform(transformSphere);\n  sphere->SetRadius(.5);\n\n  vtkNew<vtkTransform> transformCylinder;\n  transformCylinder->Identity();\n  transformCylinder->Translate(-.4, .4, 0);\n  transformCylinder->RotateZ(30);\n  transformCylinder->RotateY(60);\n  transformCylinder->RotateX(90);\n  transformCylinder->Inverse();\n\n  vtkNew<vtkCylinder> cylinder;\n  cylinder->SetTransform(transformCylinder);\n  cylinder->SetRadius(.3);\n\n  vtkNew<vtkImplicitBoolean> boolean;\n  boolean->AddFunction(cylinder);\n  boolean->AddFunction(sphere);\n\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetInputConnection(plane->GetOutputPort());\n  clipper->SetClipFunction(boolean);\n  clipper->GenerateClippedOutputOn();\n  clipper->GenerateClipScalarsOn();\n  clipper->SetValue(0);\n\n  vtkNew<vtkPolyDataMapper> clipMapper;\n  clipMapper->SetInputConnection(clipper->GetOutputPort());\n  clipMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clipActor;\n  clipActor->SetMapper(clipMapper);\n  clipActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"MidnightBlue\").GetData());\n  clipActor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkPolyDataMapper> clipInsideMapper;\n  clipInsideMapper->SetInputData(clipper->GetClippedOutput());\n  clipInsideMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> clipInsideActor;\n  clipInsideActor->SetMapper(clipInsideMapper);\n  clipInsideActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"LightBlue\").GetData());\n\n  // Create graphics stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(clipActor);\n\n  ren1->AddActor(clipInsideActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.4);\n  ren1->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ClipSphereCylinder\");\n\n  // render the image\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/ClipSphereCylinder/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ClipSphereCylinder)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ClipSphereCylinder: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ClipSphereCylinder MACOSX_BUNDLE ClipSphereCylinder.cxx )\n  target_link_libraries(ClipSphereCylinder PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ClipSphereCylinder\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/ClipSphereCylinder/#download-and-build-clipspherecylinder","title":"Download and Build ClipSphereCylinder","text":"

        Click here to download ClipSphereCylinder and its CMakeLists.txt file. Once the tarball ClipSphereCylinder.tar has been downloaded and extracted,

        cd ClipSphereCylinder/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ClipSphereCylinder\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/ColorIsosurface/","title":"ColorIsosurface","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/ColorIsosurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/ColorIsosurface/#description","title":"Description","text":"

        This example shows how to color an isosurface with other data. Basically an isosurface is generated, and a data array is selected and used by the mapper to color the surface.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/ColorIsosurface/#code","title":"Code","text":"

        ColorIsosurface.cxx

        // This example shows how to color an isosurface with other\n// data. Basically an isosurface is generated, and a data array is\n// selected and used by the mapper to color the surface.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkLODActor.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Read some data. The important thing here is to read a function as a\n  // data array as well as the scalar and vector.  (here function 153 is\n  // named \"Velocity Magnitude\").Later this data array will be used to\n  // color the isosurface.\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->AddFunction(153);\n  pl3d->Update();\n\n  // The contour filter uses the labeled scalar (function number 100\n  // above to generate the contour surface; all other data is\n  // interpolated during the contouring process.\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputData(pl3d->GetOutput()->GetBlock(0));\n  iso->SetValue(0, .24);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(iso->GetOutputPort());\n  normals->SetFeatureAngle(45);\n\n  // We indicate to the mapper to use the velcoity magnitude, which is a\n  // vtkDataArray that makes up part of the point attribute data.\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(normals->GetOutputPort());\n  isoMapper->ScalarVisibilityOn();\n  isoMapper->SetScalarRange(0, 1500);\n  isoMapper->SetScalarModeToUsePointFieldData();\n  isoMapper->ColorByArrayComponent(\"VelocityMagnitude\", 0);\n\n  vtkNew<vtkLODActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->SetNumberOfCloudPoints(1000);\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Create the usual rendering stuff.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Add the actors to the renderer, set the background and size.\n  renderer->AddActor(outlineActor);\n  renderer->AddActor(isoActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"ColorIsosurface\");\n\n  // Pick a good view\n  vtkCamera* cam1 = renderer->GetActiveCamera();\n  cam1->SetClippingRange(3.95297, 50);\n  cam1->SetFocalPoint(9.71821, 0.458166, 29.3999);\n  cam1->SetPosition(2.7439, -37.3196, 38.7167);\n  cam1->SetViewUp(-0.16123, 0.264271, 0.950876);\n  cam1->Zoom(1.3);\n\n  interactor->Initialize();\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/ColorIsosurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ColorIsosurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingLOD\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ColorIsosurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ColorIsosurface MACOSX_BUNDLE ColorIsosurface.cxx )\n  target_link_libraries(ColorIsosurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ColorIsosurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/ColorIsosurface/#download-and-build-colorisosurface","title":"Download and Build ColorIsosurface","text":"

        Click here to download ColorIsosurface and its CMakeLists.txt file. Once the tarball ColorIsosurface.tar has been downloaded and extracted,

        cd ColorIsosurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ColorIsosurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/CombustorIsosurface/","title":"CombustorIsosurface","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/CombustorIsosurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/CombustorIsosurface/#description","title":"Description","text":"

        This example generates an isosurface of constant flow density.

        Info

        See Figure 6-11c in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/CombustorIsosurface/#code","title":"Code","text":"

        CombustorIsosurface.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create pipeline.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputData(pl3d->GetOutput()->GetBlock(0));\n  iso->SetValue(0, .38);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(iso->GetOutputPort());\n  normals->SetFeatureAngle(45);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(normals->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"WhiteSmoke\").GetData());\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputConnection(pl3d->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CombustorIsosurface\");\n\n  ren1->GetActiveCamera()->SetFocalPoint(9.71821, 0.458166, 29.3999);\n  ren1->GetActiveCamera()->SetPosition(2.7439, -37.3196, 38.7167);\n  ren1->GetActiveCamera()->SetViewUp(-0.16123, 0.264271, 0.950876);\n  ren1->GetActiveCamera()->Zoom(1.3);\n  ren1->ResetCameraClippingRange();\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/CombustorIsosurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CombustorIsosurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CombustorIsosurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CombustorIsosurface MACOSX_BUNDLE CombustorIsosurface.cxx )\n  target_link_libraries(CombustorIsosurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CombustorIsosurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/CombustorIsosurface/#download-and-build-combustorisosurface","title":"Download and Build CombustorIsosurface","text":"

        Click here to download CombustorIsosurface and its CMakeLists.txt file. Once the tarball CombustorIsosurface.tar has been downloaded and extracted,

        cd CombustorIsosurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CombustorIsosurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/ContourQuadric/","title":"ContourQuadric","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/ContourQuadric

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/ContourQuadric/#description","title":"Description","text":"

        Contouring quadric function. Pipeline topology, and C++ code

        Info

        See Figure 6-39 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/ContourQuadric/#code","title":"Code","text":"

        ContourQuadric.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> aren;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  //\n  // Create surfaces F(x,y,z) = constant\n  //\n  // Sample quadric function\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0);\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(quadric);\n\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(sample->GetOutputPort());\n  contour->GenerateValues(5, 0, 1.2);\n\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contour->GetOutputPort());\n  contourMapper->SetScalarRange(0, 1.2);\n\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n\n  // Create outline\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(sample->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Brown\").GetData());\n  outlineActor->GetProperty()->SetLineWidth(3.0);\n\n  //\n  // Rendering stuff\n  //\n  aren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  aren->AddActor(contourActor);\n  aren->AddActor(outlineActor);\n\n  aren->ResetCamera();\n  aren->GetActiveCamera()->Azimuth(30);\n  aren->GetActiveCamera()->Elevation(30);\n\n  renWin->SetSize(640, 512);\n  renWin->Render();\n  renWin->SetWindowName(\"ContourQuadric\");\n\n  // interact with data\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/ContourQuadric/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ContourQuadric)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ContourQuadric: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ContourQuadric MACOSX_BUNDLE ContourQuadric.cxx )\n  target_link_libraries(ContourQuadric PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ContourQuadric\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/ContourQuadric/#download-and-build-contourquadric","title":"Download and Build ContourQuadric","text":"

        Click here to download ContourQuadric and its CMakeLists.txt file. Once the tarball ContourQuadric.tar has been downloaded and extracted,

        cd ContourQuadric/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ContourQuadric\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/CreateBFont/","title":"CreateBFont","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/CreateBFont

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/CreateBFont/#description","title":"Description","text":"

        A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles.

        Info

        See Figure 9-10 in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/CreateBFont/#code","title":"Code","text":"

        CreateBFont.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNMReader.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" image.pgm e.g. B.pgm\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Now create the RenderWindow, Renderer and Interactor.\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkPNMReader> imageIn;\n  imageIn->SetFileName(argv[1]);\n\n  vtkNew<vtkImageGaussianSmooth> gaussian;\n  gaussian->SetStandardDeviations(2, 2);\n  gaussian->SetDimensionality(2);\n  gaussian->SetRadiusFactors(1, 1);\n  gaussian->SetInputConnection(imageIn->GetOutputPort());\n\n  vtkNew<vtkImageDataGeometryFilter> geometry;\n  geometry->SetInputConnection(gaussian->GetOutputPort());\n\n  vtkNew<vtkClipPolyData> aClipper;\n  aClipper->SetInputConnection(geometry->GetOutputPort());\n  aClipper->SetValue(127.5);\n  aClipper->GenerateClipScalarsOff();\n  aClipper->InsideOutOn();\n  aClipper->GetOutput()->GetPointData()->CopyScalarsOff();\n  aClipper->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(aClipper->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> letter;\n  letter->SetMapper(mapper);\n\n  ren1->AddActor(letter);\n  letter->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"LampBlack\").GetData());\n  letter->GetProperty()->SetRepresentationToWireframe();\n\n  ren1->SetBackground(colors->GetColor3d(\"WhiteSmoke\").GetData());\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.2);\n  ren1->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CreateBFont\");\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/CreateBFont/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CreateBFont)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  IOImage\n  ImagingGeneral\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CreateBFont: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CreateBFont MACOSX_BUNDLE CreateBFont.cxx )\n  target_link_libraries(CreateBFont PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CreateBFont\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/CreateBFont/#download-and-build-createbfont","title":"Download and Build CreateBFont","text":"

        Click here to download CreateBFont and its CMakeLists.txt file. Once the tarball CreateBFont.tar has been downloaded and extracted,

        cd CreateBFont/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CreateBFont\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/CutStructuredGrid/","title":"CutStructuredGrid","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/CutStructuredGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/CutStructuredGrid/#description","title":"Description","text":"

        This example cuts through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used.

        Info

        See Figure 6-31 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/CutStructuredGrid/#code","title":"Code","text":"

        CutStructuredGrid.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCutter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // cut data\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkStructuredGrid* sg =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(sg->GetCenter());\n  plane->SetNormal(-0.287, 0, 0.9579);\n\n  vtkNew<vtkCutter> planeCut;\n  planeCut->SetInputData(pl3d->GetOutput()->GetBlock(0));\n  planeCut->SetCutFunction(plane);\n\n  vtkNew<vtkDataSetMapper> cutMapper;\n  cutMapper->SetInputConnection(planeCut->GetOutputPort());\n  cutMapper->SetScalarRange(sg->GetPointData()->GetScalars()->GetRange());\n\n  vtkNew<vtkActor> cutActor;\n  cutActor->SetMapper(cutMapper);\n\n  // Extract plane.\n  vtkNew<vtkStructuredGridGeometryFilter> compPlane;\n  compPlane->SetInputData(sg);\n  compPlane->SetExtent(0, 100, 0, 100, 9, 9);\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(compPlane->GetOutputPort());\n  planeMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n  planeActor->GetProperty()->SetRepresentationToWireframe();\n  planeActor->GetProperty()->SetColor(colors->GetColor3d(\"Wheat\").GetData());\n\n  // Outline\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Wheat\").GetData());\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(planeActor);\n  ren1->AddActor(cutActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"CutStructuredGrid\");\n\n  auto camera = ren1->GetActiveCamera();\n  camera->SetPosition(5.02611, -23.535, 50.3979);\n  camera->SetFocalPoint(9.33614, 0.0414149, 30.112);\n  camera->SetViewUp(-0.0676794, 0.657814, 0.750134);\n  camera->SetDistance(31.3997);\n  camera->SetClippingRange(12.1468, 55.8147);\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/CutStructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CutStructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CutStructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CutStructuredGrid MACOSX_BUNDLE CutStructuredGrid.cxx )\n  target_link_libraries(CutStructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CutStructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/CutStructuredGrid/#download-and-build-cutstructuredgrid","title":"Download and Build CutStructuredGrid","text":"

        Click here to download CutStructuredGrid and its CMakeLists.txt file. Once the tarball CutStructuredGrid.tar has been downloaded and extracted,

        cd CutStructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CutStructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/CutWithCutFunction/","title":"CutWithCutFunction","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/CutWithCutFunction

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/CutWithCutFunction/#code","title":"Code","text":"

        CutWithCutFunction.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCutter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" inputFilename(.vtp) [numberOfCuts]\"\n              << std::endl;\n    std::cout << \"where: inputFilename is Torso.vtp and\";\n    std::cout << \" numberOfCuts is 20.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string inputFilename = argv[1];\n\n  int numberOfCuts = 10;\n  if (argc > 2)\n  {\n    numberOfCuts = atoi(argv[2]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \" \" << bounds[2]\n            << \", \" << bounds[3] << \" \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin((bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0,\n                   bounds[4]);\n  plane->SetNormal(0, 0, 1);\n\n  // Create cutter.\n  double high = plane->EvaluateFunction(\n      (bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0, bounds[5]);\n\n  vtkNew<vtkCutter> cutter;\n  cutter->SetInputConnection(reader->GetOutputPort());\n  cutter->SetCutFunction(plane);\n  cutter->GenerateValues(numberOfCuts, .99, .99 * high);\n\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n  cutterMapper->ScalarVisibilityOff();\n\n  // Create cut actor.\n  vtkNew<vtkActor> cutterActor;\n  cutterActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  cutterActor->GetProperty()->SetLineWidth(2);\n  cutterActor->SetMapper(cutterMapper);\n\n  // Create model actor.\n  vtkNew<vtkPolyDataMapper> modelMapper;\n  modelMapper->SetInputConnection(reader->GetOutputPort());\n  modelMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> modelActor;\n  modelActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n  modelActor->SetMapper(modelMapper);\n\n  // Create renderers and add actors of plane and model.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(cutterActor);\n  renderer->AddActor(modelActor);\n\n  // Add renderer to renderwindow and render.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(600, 600);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n  renderWindow->Render();\n  renderWindow->SetWindowName(\"CutWithCutFunction\");\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/CutWithCutFunction/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CutWithCutFunction)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CutWithCutFunction: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CutWithCutFunction MACOSX_BUNDLE CutWithCutFunction.cxx )\n  target_link_libraries(CutWithCutFunction PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CutWithCutFunction\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/CutWithCutFunction/#download-and-build-cutwithcutfunction","title":"Download and Build CutWithCutFunction","text":"

        Click here to download CutWithCutFunction and its CMakeLists.txt file. Once the tarball CutWithCutFunction.tar has been downloaded and extracted,

        cd CutWithCutFunction/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CutWithCutFunction\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/CutWithScalars/","title":"CutWithScalars","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/CutWithScalars

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/CutWithScalars/#description","title":"Description","text":"

        This example cuts a surface model of the skin with a series of planes produces contour lines. Lines are wrapped with tubes for clarity.

        Info

        See Figure 6-33 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/CutWithScalars/#code","title":"Code","text":"

        CutWithScalars.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" inputFilename(.vtp) [numberOfCuts]\"\n              << std::endl;\n    std::cout << \"where: inputFilename is Torso.vtp and\";\n    std::cout << \" numberOfCuts is 20.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string inputFilename = argv[1];\n\n  int numberOfCuts = 10;\n  if (argc > 2)\n  {\n    numberOfCuts = atoi(argv[2]);\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n  std::cout << \"Bounds: \" << bounds[0] << \", \" << bounds[1] << \" \" << bounds[2]\n            << \", \" << bounds[3] << \" \" << bounds[4] << \", \" << bounds[5]\n            << std::endl;\n\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin((bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0,\n                   (bounds[5] + bounds[4]) / 2.0);\n  plane->SetNormal(0, 0, 1);\n\n  // Create Scalars.\n  vtkNew<vtkDoubleArray> scalars;\n  int numberOfPoints = reader->GetOutput()->GetNumberOfPoints();\n  scalars->SetNumberOfTuples(numberOfPoints);\n  vtkPoints* pts = reader->GetOutput()->GetPoints();\n  for (int i = 0; i < numberOfPoints; ++i)\n  {\n    double point[3];\n    pts->GetPoint(i, point);\n    scalars->SetTuple1(i, plane->EvaluateFunction(point));\n  }\n  reader->GetOutput()->GetPointData()->SetScalars(scalars);\n  reader->GetOutput()->GetPointData()->GetScalars()->GetRange();\n\n  // Create cutter.\n  vtkNew<vtkContourFilter> cutter;\n  cutter->SetInputConnection(reader->GetOutputPort());\n  cutter->ComputeScalarsOff();\n  cutter->ComputeNormalsOff();\n  cutter->GenerateValues(\n      numberOfCuts,\n      .99 * reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[0],\n      .99 * reader->GetOutput()->GetPointData()->GetScalars()->GetRange()[1]);\n\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n  cutterMapper->ScalarVisibilityOff();\n\n  // Create cut actor.\n  vtkNew<vtkActor> cutterActor;\n  cutterActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  cutterActor->GetProperty()->SetLineWidth(2);\n  cutterActor->SetMapper(cutterMapper);\n\n  // Create model actor.\n  vtkNew<vtkPolyDataMapper> modelMapper;\n  modelMapper->SetInputConnection(reader->GetOutputPort());\n  modelMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> modelActor;\n  modelActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n  modelActor->SetMapper(modelMapper);\n\n  // Create renderers and add actors of plane and model.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(cutterActor);\n  renderer->AddActor(modelActor);\n\n  // Add renderer to renderwindow and render.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(600, 600);\n  renderWindow->SetWindowName(\"CutWithScalars\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->SetBackground(colors->GetColor3d(\"Burlywood\").GetData());\n  renderer->GetActiveCamera()->SetPosition(0, -1, 0);\n  renderer->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  renderer->GetActiveCamera()->SetViewUp(0, 0, 1);\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  renderer->ResetCamera();\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/CutWithScalars/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CutWithScalars)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CutWithScalars: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CutWithScalars MACOSX_BUNDLE CutWithScalars.cxx )\n  target_link_libraries(CutWithScalars PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CutWithScalars\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/CutWithScalars/#download-and-build-cutwithscalars","title":"Download and Build CutWithScalars","text":"

        Click here to download CutWithScalars and its CMakeLists.txt file. Once the tarball CutWithScalars.tar has been downloaded and extracted,

        cd CutWithScalars/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CutWithScalars\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/Cutter/","title":"Cutter","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/Cutter

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/Cutter/#code","title":"Code","text":"

        Cutter.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkCutter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkCubeSource> cube;\n  cube->SetXLength(40);\n  cube->SetYLength(30);\n  cube->SetZLength(20);\n  vtkNew<vtkPolyDataMapper> cubeMapper;\n  cubeMapper->SetInputConnection(cube->GetOutputPort());\n\n  // Create a plane to cut,here it cuts in the XZ direction (xz\n  // normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0)\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(10, 0, 0);\n  plane->SetNormal(1, 0, 0);\n\n  // Create cutter\n  vtkNew<vtkCutter> cutter;\n  cutter->SetCutFunction(plane);\n  cutter->SetInputConnection(cube->GetOutputPort());\n  cutter->Update();\n\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n  cutterMapper->SetResolveCoincidentTopologyToPolygonOffset();\n\n  // Create plane actor\n  vtkNew<vtkActor> planeActor;\n  planeActor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  planeActor->GetProperty()->SetLineWidth(2);\n  planeActor->GetProperty()->SetAmbient(1.0);\n  planeActor->GetProperty()->SetDiffuse(0.0);\n  planeActor->SetMapper(cutterMapper);\n\n  // Create cube actor\n  vtkNew<vtkActor> cubeActor;\n  cubeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Aquamarine\").GetData());\n  cubeActor->GetProperty()->SetOpacity(0.5);\n  cubeActor->SetMapper(cubeMapper);\n\n  // Create renderers and add actors of plane and cube\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(planeActor); // display the rectangle resulting from the\n                                  // cut\n  renderer->AddActor(cubeActor);  // display the cube\n\n  // Add renderer to renderwindow and render\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(600, 600);\n  renderWindow->SetWindowName(\"Cutter\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  renderer->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  renderWindow->Render();\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(-37.2611, -86.2155, 44.841);\n  camera->SetFocalPoint(0.569422, -1.65124, -2.49482);\n  camera->SetViewUp(0.160129, 0.42663, 0.890138);\n  camera->SetDistance(104.033);\n  camera->SetClippingRange(55.2019, 165.753);\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/Cutter/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Cutter)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Cutter: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Cutter MACOSX_BUNDLE Cutter.cxx )\n  target_link_libraries(Cutter PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Cutter\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/Cutter/#download-and-build-cutter","title":"Download and Build Cutter","text":"

        Click here to download Cutter and its CMakeLists.txt file. Once the tarball Cutter.tar has been downloaded and extracted,

        cd Cutter/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Cutter\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/DataSetSurface/","title":"DataSetSurface","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/DataSetSurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/DataSetSurface/#code","title":"Code","text":"

        DataSetSurface.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkCutter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkHexahedron.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkUnstructuredGrid.h>\n\n#include <array>\n#include <cstdlib>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Setup the coordinates of eight points\n  // (the two faces must be in counter clockwise order as viewed from the\n  // outside)\n  std::array<std::array<double, 3>, 8> pointCoords{{{{0.0, 0.0, 0.0}},\n                                                    {{1.0, 0.0, 0.0}},\n                                                    {{1.0, 1.0, 0.0}},\n                                                    {{0.0, 1.0, 0.0}},\n                                                    {{0.0, 0.0, 1.0}},\n                                                    {{1.0, 0.0, 1.0}},\n                                                    {{1.0, 1.0, 1.0}},\n                                                    {{0.0, 1.0, 1.0}}}};\n\n  // Create the points and a hexahedron from the points.\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkHexahedron> hexa;\n  for (auto i = 0; i < pointCoords.size(); ++i)\n  {\n    points->InsertNextPoint(pointCoords[i].data());\n    hexa->GetPointIds()->SetId(i, i);\n  }\n\n  // Add the hexahedron to a cell array.\n  vtkNew<vtkCellArray> hexs;\n  hexs->InsertNextCell(hexa);\n\n  // Add the points and hexahedron to an unstructured grid.\n  vtkNew<vtkUnstructuredGrid> uGrid;\n  uGrid->SetPoints(points);\n  uGrid->InsertNextCell(hexa->GetCellType(), hexa->GetPointIds());\n\n  // Extract the outer (polygonal) surface.\n  vtkNew<vtkDataSetSurfaceFilter> surface;\n  surface->SetInputData(uGrid);\n  surface->Update();\n\n  vtkNew<vtkDataSetMapper> aBeamMapper;\n  aBeamMapper->SetInputConnection(surface->GetOutputPort());\n  vtkNew<vtkActor> aBeamActor;\n  aBeamActor->SetMapper(aBeamMapper);\n  aBeamActor->AddPosition(0, 0, 0);\n  aBeamActor->GetProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  aBeamActor->GetProperty()->SetOpacity(0.60);\n  aBeamActor->GetProperty()->EdgeVisibilityOn();\n  aBeamActor->GetProperty()->SetEdgeColor(\n      colors->GetColor3d(\"Black\").GetData());\n  aBeamActor->GetProperty()->SetLineWidth(1.5);\n\n  // Create a plane to cut, here it cuts in the XZ direction\n  // (xz normal=(1,0,0); XY =(0,0,1), YZ =(0,1,0)\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(0.5, 0, 0);\n  plane->SetNormal(1, 0, 0);\n\n  // Create cutter\n  vtkNew<vtkCutter> cutter;\n  cutter->SetCutFunction(plane);\n  cutter->SetInputData(aBeamActor->GetMapper()->GetInput());\n  cutter->Update();\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n\n  // Create plane actor\n  vtkNew<vtkActor> planeActor;\n  planeActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  planeActor->GetProperty()->SetLineWidth(2);\n  planeActor->SetMapper(cutterMapper);\n\n  // Create a renderer, render window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetWindowName(\"DatasetSurface\");\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene\n  renderer->AddActor(aBeamActor);\n  renderer->AddActor(planeActor);\n  renderer->SetBackground(colors->GetColor3d(\"Seashell\").GetData());\n\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Azimuth(-25);\n  renderer->GetActiveCamera()->Elevation(30);\n\n  // Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/DataSetSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DataSetSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DataSetSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DataSetSurface MACOSX_BUNDLE DataSetSurface.cxx )\n  target_link_libraries(DataSetSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DataSetSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/DataSetSurface/#download-and-build-datasetsurface","title":"Download and Build DataSetSurface","text":"

        Click here to download DataSetSurface and its CMakeLists.txt file. Once the tarball DataSetSurface.tar has been downloaded and extracted,

        cd DataSetSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DataSetSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/DecimateFran/","title":"DecimateFran","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/DecimateFran

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/DecimateFran/#description","title":"Description","text":"

        This examples shows reduction on the order of 90 percent for a 10:1 compression ratio. the wireframe image are shown to accentuate the density of the polygonal meshes. The left-hand image is the original data; the right-hand image is the decimated mesh.

        Info

        See Figure 9-27a in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/DecimateFran/#code","title":"Code","text":"

        DecimateFran.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDecimatePro.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPNGReader.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTexture.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fran_cut.vtk fran_cut.png\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // This example shows how to use decimation to reduce a polygonal mesh. We\n  // also use mesh smoothing and generate surface normals to give a pleasing\n  // result.\n  //\n\n  // We start by reading some data that was originally captured from\n  // a Cyberware laser digitizing system.\n  //\n  vtkNew<vtkPolyDataReader> fran;\n  fran->SetFileName(argv[1]);\n\n  // Read the corresponding texture\n  vtkNew<vtkPNGReader> textureReader;\n  textureReader->SetFileName(argv[2]);\n\n  vtkNew<vtkTexture> texture;\n  texture->InterpolateOn();\n  texture->SetInputConnection(textureReader->GetOutputPort());\n\n  // We want to preserve topology (not let any cracks form). This may limit\n  // the total reduction possible, which we have specified at 90%.\n  //\n  vtkNew<vtkDecimatePro> deci;\n  deci->SetInputConnection(fran->GetOutputPort());\n  deci->SetTargetReduction(0.9);\n  deci->PreserveTopologyOn();\n\n  vtkNew<vtkPolyDataNormals> decimatedNormals;\n  decimatedNormals->SetInputConnection(deci->GetOutputPort());\n  decimatedNormals->FlipNormalsOn();\n  decimatedNormals->SetFeatureAngle(60);\n\n  vtkNew<vtkPolyDataNormals> originalNormals;\n  originalNormals->SetInputConnection(fran->GetOutputPort());\n  originalNormals->FlipNormalsOn();\n  originalNormals->SetFeatureAngle(60);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> decimatedMapper;\n  decimatedMapper->SetInputConnection(decimatedNormals->GetOutputPort());\n\n  vtkNew<vtkActor> decimatedActor;\n  decimatedActor->SetMapper(decimatedMapper);\n  decimatedActor->GetProperty()->SetAmbient(.5);\n  decimatedActor->GetProperty()->SetDiffuse(.5);\n  decimatedActor->SetTexture(texture);\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(originalNormals->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetAmbient(.5);\n  originalActor->GetProperty()->SetDiffuse(.5);\n  originalActor->SetTexture(texture);\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> renderer1;\n  renderer1->SetViewport(0.0, 0.0, 0.5, 1.0);\n\n  vtkNew<vtkRenderer> renderer2;\n  renderer2->SetViewport(0.5, 0.0, 1.0, 1.0);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer1);\n  renderWindow->AddRenderer(renderer2);\n  renderWindow->SetWindowName(\"DecimateFran\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  renderer1->AddActor(originalActor);\n  renderer2->AddActor(decimatedActor);\n  renderer1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer2->SetBackground(colors->GetColor3d(\"Papaya_Whip\").GetData());\n  renderWindow->SetSize(800, 400);\n\n  // render the image\n  //\n  vtkNew<vtkCamera> cam1;\n  cam1->SetClippingRange(0.0475572, 2.37786);\n  cam1->SetFocalPoint(0.052665, -0.129454, -0.0573973);\n  cam1->SetPosition(0.327637, -0.116299, -0.256418);\n  cam1->SetViewUp(-0.0225386, 0.999137, 0.034901);\n  renderer1->SetActiveCamera(cam1);\n  renderer2->SetActiveCamera(cam1);\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/DecimateFran/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DecimateFran)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOImage\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DecimateFran: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DecimateFran MACOSX_BUNDLE DecimateFran.cxx )\n  target_link_libraries(DecimateFran PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DecimateFran\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/DecimateFran/#download-and-build-decimatefran","title":"Download and Build DecimateFran","text":"

        Click here to download DecimateFran and its CMakeLists.txt file. Once the tarball DecimateFran.tar has been downloaded and extracted,

        cd DecimateFran/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DecimateFran\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/DecimateHawaii/","title":"DecimateHawaii","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/DecimateHawaii

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/DecimateHawaii/#description","title":"Description","text":"

        This examples shows reduction on the order of 90 percent for a 10:1 compression ratio. the wireframe image are shown to accentuate the density of the polygonal meshes. The left-hand image is the original data; the right-hand image is the decimated mesh.

        Info

        See Figure 9-27b in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/DecimateHawaii/#code","title":"Code","text":"

        DecimateHawaii.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDecimatePro.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" honolulu.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // This example shows how to use decimation to reduce a polygonal mesh. We\n  // also use mesh smoothing and generate surface normals to give a pleasing\n  // result.\n  //\n\n  vtkNew<vtkPolyDataReader> hawaii;\n  hawaii->SetFileName(argv[1]);\n\n  // We want to preserve topology (not let any cracks form). This may limit\n  // the total reduction possible, which we have specified at 90%.\n  //\n  vtkNew<vtkDecimatePro> deci;\n  deci->SetInputConnection(hawaii->GetOutputPort());\n  deci->SetTargetReduction(0.9);\n  deci->PreserveTopologyOn();\n\n  vtkNew<vtkPolyDataNormals> decimatedNormals;\n  decimatedNormals->SetInputConnection(deci->GetOutputPort());\n  decimatedNormals->FlipNormalsOn();\n  decimatedNormals->SetFeatureAngle(60);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataMapper> decimatedMapper;\n  decimatedMapper->SetInputConnection(decimatedNormals->GetOutputPort());\n\n  vtkNew<vtkActor> decimatedActor;\n  decimatedActor->SetMapper(decimatedMapper);\n  decimatedActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Sienna\").GetData());\n  decimatedActor->GetProperty()->SetRepresentationToWireframe();\n\n  vtkNew<vtkPolyDataMapper> originalMapper;\n  originalMapper->SetInputConnection(decimatedNormals->GetOutputPort());\n\n  vtkNew<vtkActor> originalActor;\n  originalActor->SetMapper(originalMapper);\n  originalActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Sienna\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> renderer1;\n  renderer1->SetViewport(0.0, 0.0, 0.5, 1.0);\n\n  vtkNew<vtkRenderer> renderer2;\n  renderer2->SetViewport(0.5, 0.0, 1.0, 1.0);\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer1);\n  renderWindow->AddRenderer(renderer2);\n  renderWindow->SetWindowName(\"DecimateHawaii\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  renderer1->AddActor(originalActor);\n  renderer2->AddActor(decimatedActor);\n  renderer1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renderer2->SetBackground(colors->GetColor3d(\"Papaya_Whip\").GetData());\n  renderWindow->SetSize(800, 400);\n\n  // Render the image.\n  //\n  vtkNew<vtkCamera> cam1;\n  renderer1->SetActiveCamera(cam1);\n  renderer2->SetActiveCamera(cam1);\n  renderer1->ResetCamera();\n  cam1->Elevation(-30);\n  cam1->Dolly(1.2);\n  renderer1->ResetCameraClippingRange();\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/DecimateHawaii/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DecimateHawaii)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DecimateHawaii: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DecimateHawaii MACOSX_BUNDLE DecimateHawaii.cxx )\n  target_link_libraries(DecimateHawaii PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DecimateHawaii\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/DecimateHawaii/#download-and-build-decimatehawaii","title":"Download and Build DecimateHawaii","text":"

        Click here to download DecimateHawaii and its CMakeLists.txt file. Once the tarball DecimateHawaii.tar has been downloaded and extracted,

        cd DecimateHawaii/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DecimateHawaii\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/DisplacementPlot/","title":"DisplacementPlot","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/DisplacementPlot

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/DisplacementPlot/#description","title":"Description","text":"

        This example shows modal lines for a vibrating rectangular beam. The vibration mode in this figure is the second torsional mode, clearly indicated by the crossing modal lines.

        The default color scheme shows cool color for maximum negative motion, warm color maximum positive motion, with white at the nodes.

        For other possible color maps see: Diverging Color Maps for Scientific Visualization.

        Info

        See Figure 6-15 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/DisplacementPlot/#code","title":"Code","text":"

        DisplacementPlot.cxx

        // Translated from dispPlot.tcl\n/*\nProduce figure 6-15(b) from the VTK Textbook.\nSurface plot of a vibrating plane.\n\nThe color_scheme option allows you to select a series of colour schemes.\n0: The default:- cool maximum negative motion,\n                 warm maximum positive motion, white at the nodes.\n1: Alternate choice:- green maximum negative motion,\n                      purple maximum positive motion, white at the nodes.\n2: The original:- white at maximum motion, black at the nodes.\n\n*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorDot.h>\n#include <vtkWarpVector.h>\n\nnamespace {\n//! Create a lookup table.\n/*!\n@param lut - An indexed lookup table.\n*/\nvoid MakeLUT(int const& colorScheme, vtkLookupTable* lut);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [colorScheme]\" << std::endl;\n    std::cout << \"where: filename is the file plate.vtk.\" << std::endl;\n    std::cout << \"       colorScheme is 0, 1, or 2, default 0\" << std::endl;\n    std::cout << \"Produces figure 6-15(b) Surface plot of vibrating plane from \"\n                 \"the VTK Textbook.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  int colorScheme = 0;\n  std::string fileName = argv[1];\n\n  if (argc == 3)\n  {\n    colorScheme = std::abs(atoi(argv[2]));\n    colorScheme = (colorScheme > 2) ? 0 : colorScheme;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read a vtk file\n  //\n  vtkNew<vtkPolyDataReader> plate;\n  plate->SetFileName(fileName.c_str());\n  plate->SetVectorsName(\"mode8\");\n  plate->Update();\n\n  vtkNew<vtkWarpVector> warp;\n  warp->SetInputConnection(plate->GetOutputPort());\n  warp->SetScaleFactor(0.5);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(warp->GetOutputPort());\n\n  vtkNew<vtkVectorDot> color;\n  color->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkLookupTable> lut;\n  MakeLUT(colorScheme, lut);\n\n  vtkNew<vtkDataSetMapper> plateMapper;\n  plateMapper->SetInputConnection(color->GetOutputPort());\n  plateMapper->SetLookupTable(lut);\n  plateMapper->SetScalarRange(-1, 1);\n\n  vtkNew<vtkActor> plateActor;\n  plateActor->SetMapper(plateMapper);\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"DisplacementPlot\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren->AddActor(plateActor);\n  ren->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  ren->GetActiveCamera()->SetPosition(13.3991, 14.0764, 9.97787);\n  ren->GetActiveCamera()->SetFocalPoint(1.50437, 0.481517, 4.52992);\n  ren->GetActiveCamera()->SetViewAngle(30);\n  ren->GetActiveCamera()->SetViewUp(-0.120861, 0.458556, -0.880408);\n  ren->GetActiveCamera()->SetClippingRange(12.5724, 26.8374);\n  // Render the image.\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeLUT(int const& colorScheme, vtkLookupTable* lut)\n{\n  // See: [Diverging Color Maps for Scientific Visualization]\n  //      (http://www.kennethmoreland.com/color-maps/)\n  auto nc = 256;\n  vtkNew<vtkColorTransferFunction> ctf;\n  switch (colorScheme)\n  {\n  case 0:\n  default:\n    // Cool to warm diverging.\n    ctf->SetColorSpaceToDiverging();\n    ctf->AddRGBPoint(0.0, 0.230, 0.299, 0.754);\n    ctf->AddRGBPoint(0.5, 0.865, 0.865, 0.865);\n    ctf->AddRGBPoint(1.0, 0.706, 0.016, 0.150);\n    lut->SetNumberOfTableValues(nc);\n    lut->Build();\n    for (auto i = 0; i < nc; ++i)\n    {\n      double rgb[4] = {0.0, 0.0, 0.0, 1.0};\n      ctf->GetColor(static_cast<double>(i) / nc, rgb);\n      lut->SetTableValue(i, rgb);\n    }\n    break;\n  case 1:\n    // Green to purple diverging.\n    ctf->SetColorSpaceToDiverging();\n    ctf->AddRGBPoint(0.0, 0.085, 0.532, 0.201);\n    ctf->AddRGBPoint(1.0, 0.436, 0.308, 0.631);\n    lut->SetNumberOfTableValues(nc);\n    lut->Build();\n    for (auto i = 0; i < nc; ++i)\n    {\n      double rgb[4] = {0.0, 0.0, 0.0, 1.0};\n      ctf->GetColor(static_cast<double>(i) / nc, rgb);\n      lut->SetTableValue(i, rgb);\n    }\n    break;\n  case 2: {\n    // Make a lookup table, black in the centre with bright areas\n    //   at the beginning and end of the table.\n    // This is from the original code.\n    auto nc2 = nc / 2;\n    lut->SetNumberOfColors(nc);\n    lut->Build();\n    for (auto i = 0; i < nc2; ++i)\n    {\n      // White to black.\n      auto v = (double(nc2) - i) / double(nc2);\n      lut->SetTableValue(i, v, v, v, 1);\n    }\n    for (auto i = nc2; i < nc; ++i)\n    {\n      // Black to white.\n      auto v = (i - double(nc2)) / double(nc2);\n      lut->SetTableValue(i, v, v, v, 1);\n    }\n    break;\n  }\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/VisualizationAlgorithms/DisplacementPlot/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DisplacementPlot)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DisplacementPlot: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DisplacementPlot MACOSX_BUNDLE DisplacementPlot.cxx )\n  target_link_libraries(DisplacementPlot PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DisplacementPlot\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/DisplacementPlot/#download-and-build-displacementplot","title":"Download and Build DisplacementPlot","text":"

        Click here to download DisplacementPlot and its CMakeLists.txt file. Once the tarball DisplacementPlot.tar has been downloaded and extracted,

        cd DisplacementPlot/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DisplacementPlot\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/ExponentialCosine/","title":"ExponentialCosine","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/ExponentialCosine

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/ExponentialCosine/#description","title":"Description","text":"

        Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values.

        Info

        See Figure 9-4a in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/ExponentialCosine/#code","title":"Code","text":"

        ExponentialCosine.cxx

        //\n// Brute force computation of Bessel functions. Might be better to create a\n// filter (or source) object. Might also consider vtkSampleFunction.\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkWarpScalar.h>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create plane to warp.\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetResolution(300, 300);\n\n  vtkNew<vtkTransform> transform;\n  transform->Scale(10.0, 10.0, 1.0);\n\n  vtkNew<vtkTransformPolyDataFilter> transF;\n  transF->SetInputConnection(plane->GetOutputPort());\n  transF->SetTransform(transform);\n  transF->Update();\n\n  // Compute Bessel function and derivatives. This portion could be\n  // encapsulated into source or filter object.\n  //\n  auto input = transF->GetOutput();\n  auto numPts = input->GetNumberOfPoints();\n\n  vtkNew<vtkPoints> newPts;\n  newPts->SetNumberOfPoints(numPts);\n\n  vtkNew<vtkDoubleArray> derivs;\n  derivs->SetNumberOfTuples(numPts);\n\n  vtkNew<vtkPolyData> bessel;\n  bessel->CopyStructure(input);\n  bessel->SetPoints(newPts);\n  bessel->GetPointData()->SetScalars(derivs);\n\n  double x[3];\n\n  for (auto i = 0; i < numPts; i++)\n  {\n    input->GetPoint(i, x);\n    auto r = sqrt(static_cast<double>(x[0] * x[0]) + x[1] * x[1]);\n    x[2] = exp(-r) * cos(10.0 * r);\n    newPts->SetPoint(i, x);\n    auto deriv = -exp(-r) * (cos(10.0 * r) + 10.0 * sin(10.0 * r));\n    derivs->SetValue(i, deriv);\n  }\n\n  // Warp plane.\n  vtkNew<vtkWarpScalar> warp;\n  warp->SetInputData(bessel);\n  warp->XYPlaneOn();\n  warp->SetScaleFactor(0.5);\n\n  // Mapper and actor.\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputConnection(warp->GetOutputPort());\n  double tmp[2];\n  bessel->GetScalarRange(tmp);\n  mapper->SetScalarRange(tmp[0], tmp[1]);\n\n  vtkNew<vtkActor> carpet;\n  carpet->SetMapper(mapper);\n\n  // Assign our actor to the renderer.\n  ren->AddActor(carpet);\n  ren->SetBackground(colors->GetColor3d(\"Beige\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ExponentialCosine\");\n\n  // Draw the resulting scene.\n  ren->ResetCamera();\n  ren->GetActiveCamera()->Zoom(1.35);\n  ren->GetActiveCamera()->Elevation(-55);\n  ren->GetActiveCamera()->Azimuth(25);\n  ren->ResetCameraClippingRange();\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/ExponentialCosine/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExponentialCosine)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExponentialCosine: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExponentialCosine MACOSX_BUNDLE ExponentialCosine.cxx )\n  target_link_libraries(ExponentialCosine PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExponentialCosine\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/ExponentialCosine/#download-and-build-exponentialcosine","title":"Download and Build ExponentialCosine","text":"

        Click here to download ExponentialCosine and its CMakeLists.txt file. Once the tarball ExponentialCosine.tar has been downloaded and extracted,

        cd ExponentialCosine/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExponentialCosine\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/ExtractData/","title":"ExtractData","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/ExtractData

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/ExtractData/#description","title":"Description","text":"

        This example takes advantage of the properties of implicit functions to select and cut data. In particular it uses the region separation property to select data. Selecting or extracting data with an implicit function means choosing cells and points (and associated attribute data) that lie within a particular region of the function. To determine whether a point x-y-z lies within a region, we simply evaluate the point and examine the sign of the result. A cell lies in a region if all its points lie in the region. Here, two ellipses are used in combination to select voxels within a volume dataset. Note that extracting data often changes the structure of the dataset. In this example the input type is a image data dataset, while the output type is an unstructured grid dataset.

        Info

        See Figure 6-24 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/ExtractData/#code","title":"Code","text":"

        ExtractData.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkExtractGeometry.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkQuadric.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkShrinkFilter.h>\n#include <vtkSphere.h>\n#include <vtkTransform.h>\n\nint main(int, char*[])\n{\n  // extract data\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkQuadric> quadric;\n  quadric->SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0);\n\n  vtkNew<vtkSampleFunction> sample;\n  sample->SetSampleDimensions(50, 50, 50);\n  sample->SetImplicitFunction(quadric);\n  sample->ComputeNormalsOff();\n\n  vtkNew<vtkTransform> trans;\n  trans->Scale(1, 0.5, 0.333);\n\n  vtkNew<vtkSphere> sphere;\n  sphere->SetRadius(0.25);\n  sphere->SetTransform(trans);\n\n  vtkNew<vtkTransform> trans2;\n  trans2->Scale(0.25, 0.5, 1.0);\n\n  vtkNew<vtkSphere> sphere2;\n  sphere2->SetRadius(0.25);\n  sphere2->SetTransform(trans2);\n\n  vtkNew<vtkImplicitBoolean> booleanUnion;\n  booleanUnion->AddFunction(sphere);\n  booleanUnion->AddFunction(sphere2);\n  booleanUnion->SetOperationType(0); // boolean Union\n\n  vtkNew<vtkExtractGeometry> extract;\n  extract->SetInputConnection(sample->GetOutputPort());\n  extract->SetImplicitFunction(booleanUnion);\n\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(extract->GetOutputPort());\n  shrink->SetShrinkFactor(0.5);\n\n  vtkNew<vtkDataSetMapper> dataMapper;\n  dataMapper->SetInputConnection(shrink->GetOutputPort());\n  vtkNew<vtkActor> dataActor;\n  dataActor->SetMapper(dataMapper);\n\n  // outline\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(sample->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(0, 0, 0);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(dataActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ExtractData\");\n  renWin->Render();\n\n  ren1->GetActiveCamera()->Azimuth(30);\n  ren1->GetActiveCamera()->Elevation(30);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/ExtractData/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ExtractData)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersExtraction\n  FiltersGeneral\n  FiltersModeling\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ExtractData: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ExtractData MACOSX_BUNDLE ExtractData.cxx )\n  target_link_libraries(ExtractData PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ExtractData\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/ExtractData/#download-and-build-extractdata","title":"Download and Build ExtractData","text":"

        Click here to download ExtractData and its CMakeLists.txt file. Once the tarball ExtractData.tar has been downloaded and extracted,

        cd ExtractData/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ExtractData\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/FilledContours/","title":"FilledContours","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/FilledContours

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/FilledContours/#description","title":"Description","text":"

        This example produces filled contours using the vtkClipPolyData filter. There is a sample data file src/Testing/Data/filledContours.vtp.

        Note

        This original source code for this example is here.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/FilledContours/#code","title":"Code","text":"

        FilledContours.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCellData.h>\n#include <vtkCleanPolyData.h>\n#include <vtkClipPolyData.h>\n#include <vtkContourFilter.h>\n#include <vtkFloatArray.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkXMLPolyDataReader.h>\n\n#include <iostream>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr\n        << \"Usage: \" << argv[0]\n        << \" InputPolyDataFile(.vtp) NumberOfContours e.g filledContours.vtp 10\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the file\n  vtkNew<vtkXMLPolyDataReader> reader;\n\n  reader->SetFileName(argv[1]);\n  reader->Update(); // Update so that we can get the scalar range.\n\n  double scalarRange[2];\n  reader->GetOutput()->GetPointData()->GetScalars()->GetRange(scalarRange);\n\n  vtkNew<vtkAppendPolyData> appendFilledContours;\n\n  int numberOfContours = atoi(argv[2]);\n\n  double delta = (scalarRange[1] - scalarRange[0]) /\n      static_cast<double>(numberOfContours - 1);\n\n  // Keep the clippers alive.\n  std::vector<vtkSmartPointer<vtkClipPolyData>> clippersLo;\n  std::vector<vtkSmartPointer<vtkClipPolyData>> clippersHi;\n\n  for (int i = 0; i < numberOfContours; i++)\n  {\n    double valueLo = scalarRange[0] + static_cast<double>(i) * delta;\n    double valueHi = scalarRange[0] + static_cast<double>(i + 1) * delta;\n    clippersLo.push_back(vtkSmartPointer<vtkClipPolyData>::New());\n    clippersLo[i]->SetValue(valueLo);\n    if (i == 0)\n    {\n      clippersLo[i]->SetInputConnection(reader->GetOutputPort());\n    }\n    else\n    {\n      clippersLo[i]->SetInputConnection(clippersHi[i - 1]->GetOutputPort(1));\n    }\n    clippersLo[i]->InsideOutOff();\n    clippersLo[i]->Update();\n\n    clippersHi.push_back(vtkSmartPointer<vtkClipPolyData>::New());\n    clippersHi[i]->SetValue(valueHi);\n    clippersHi[i]->SetInputConnection(clippersLo[i]->GetOutputPort());\n    clippersHi[i]->GenerateClippedOutputOn();\n    clippersHi[i]->InsideOutOn();\n    clippersHi[i]->Update();\n    if (clippersHi[i]->GetOutput()->GetNumberOfCells() == 0)\n    {\n      continue;\n    }\n\n    vtkNew<vtkFloatArray> cd;\n    cd->SetNumberOfComponents(1);\n    cd->SetNumberOfTuples(clippersHi[i]->GetOutput()->GetNumberOfCells());\n    cd->FillComponent(0, valueLo);\n\n    clippersHi[i]->GetOutput()->GetCellData()->SetScalars(cd);\n    appendFilledContours->AddInputConnection(clippersHi[i]->GetOutputPort());\n  }\n\n  vtkNew<vtkCleanPolyData> filledContours;\n  filledContours->SetInputConnection(appendFilledContours->GetOutputPort());\n\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(numberOfContours + 1);\n  lut->Build();\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(filledContours->GetOutputPort());\n  contourMapper->SetScalarRange(scalarRange[0], scalarRange[1]);\n  contourMapper->SetScalarModeToUseCellData();\n  contourMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> contourActor;\n  contourActor->SetMapper(contourMapper);\n  contourActor->GetProperty()->SetInterpolationToFlat();\n\n  vtkNew<vtkContourFilter> contours;\n  contours->SetInputConnection(filledContours->GetOutputPort());\n  contours->GenerateValues(numberOfContours, scalarRange[0], scalarRange[1]);\n\n  vtkNew<vtkPolyDataMapper> contourLineMapperer;\n  contourLineMapperer->SetInputConnection(contours->GetOutputPort());\n  contourLineMapperer->SetScalarRange(scalarRange[0], scalarRange[1]);\n  contourLineMapperer->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> contourLineActor;\n  contourLineActor->SetMapper(contourLineMapperer);\n  contourLineActor->GetProperty()->SetLineWidth(2);\n\n  // The usual renderer, render window and interactor.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"FilledContours\");\n\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors\n  ren1->AddActor(contourActor);\n  ren1->AddActor(contourLineActor);\n  ren1->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Begin interaction.\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/FilledContours/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FilledContours)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FilledContours: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FilledContours MACOSX_BUNDLE FilledContours.cxx )\n  target_link_libraries(FilledContours PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FilledContours\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/FilledContours/#download-and-build-filledcontours","title":"Download and Build FilledContours","text":"

        Click here to download FilledContours and its CMakeLists.txt file. Once the tarball FilledContours.tar has been downloaded and extracted,

        cd FilledContours/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FilledContours\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/FindCellIntersections/","title":"FindCellIntersections","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/FindCellIntersections

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/FindCellIntersections/#description","title":"Description","text":"

        This example shows how to use cell locator's FindCellsAlongLine method to visualize the cells that are intersected in an unstructured grid. The example uses the data file: src/Testing/Data/Disc_BiQuadraticQuads_0_0.vtu.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/FindCellIntersections/#code","title":"Code","text":"

        FindCellIntersections.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellData.h>\n#include <vtkCellLocator.h>\n#include <vtkDataSetSurfaceFilter.h>\n#include <vtkIdList.h>\n#include <vtkLineSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkFilter.h>\n#include <vtkUnsignedCharArray.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" filename.vtu e.g. Disc_BiQuadraticQuads_0_0.vtu\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Get the filename from the command line.\n  std::string inputFilename = argv[1];\n\n  // Read a xml unstructured grid dataset\n  vtkNew<vtkXMLUnstructuredGridReader> reader;\n  reader->SetFileName(inputFilename.c_str());\n  reader->Update();\n\n  // The line goes through the center of the data and runs along the x axis.\n  double center[3];\n  reader->GetOutput()->GetCenter(center);\n  double bounds[6];\n  reader->GetOutput()->GetBounds(bounds);\n\n  double startRay[3];\n  startRay[0] = bounds[0] - center[0];\n  startRay[1] = center[1];\n  startRay[2] = center[2];\n\n  double endRay[3];\n  endRay[0] = bounds[1] + center[0];\n  endRay[1] = center[1];\n  endRay[2] = center[2];\n  std::cout << \"center: \" << center[0] << \", \" << center[1] << \", \" << center[2]\n            << std::endl;\n  std::cout << \"startRay: \" << startRay[0] << \", \" << startRay[1] << \", \"\n            << startRay[2] << std::endl;\n  std::cout << \"endRay: \" << endRay[0] << \", \" << endRay[1] << \", \" << endRay[2]\n            << std::endl;\n\n  // Initialize all of the cell data colors.\n  vtkNew<vtkUnsignedCharArray> cellData;\n  cellData->SetNumberOfComponents(3);\n  cellData->SetNumberOfTuples(reader->GetOutput()->GetNumberOfCells());\n  reader->GetOutput()->GetCellData()->SetScalars(cellData);\n\n  // A lambda to scale the contents of the array x by 255.\n  auto scale = [](double* x) {\n    for (int i = 0; i < 3; ++i)\n    {\n      x[i] = x[i] * 255;\n    };\n  };\n\n  double rgb[3]{0, 0, 0};\n  colors->GetColorRGB(\"Banana\", rgb);\n  scale(rgb);\n  for (int i = 0; i < cellData->GetNumberOfTuples(); ++i)\n  {\n    cellData->InsertTuple(i, rgb);\n  }\n\n  // Find the cells that intersect the line and color those cells.\n  vtkNew<vtkIdList> cellIds;\n  vtkNew<vtkCellLocator> locator;\n  locator->SetDataSet(reader->GetOutput());\n  locator->BuildLocator();\n  locator->FindCellsAlongLine(startRay, endRay, 0.001, cellIds);\n\n  colors->GetColorRGB(\"Tomato\", rgb);\n  scale(rgb);\n  for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); ++i)\n  {\n    cellData->InsertTuple(cellIds->GetId(i), rgb);\n  }\n\n  // Shrink each cell to make them visible.\n  vtkNew<vtkShrinkFilter> shrink;\n  shrink->SetInputConnection(reader->GetOutputPort());\n  shrink->SetShrinkFactor(0.95);\n\n  // Convert the cells to polydata.\n  vtkNew<vtkDataSetSurfaceFilter> surface;\n  surface->SetInputConnection(shrink->GetOutputPort());\n  surface->SetNonlinearSubdivisionLevel(2);\n  surface->Update();\n\n  // Create a line.\n  vtkNew<vtkLineSource> lineSource;\n  lineSource->SetPoint1(startRay);\n  lineSource->SetPoint2(endRay);\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(lineSource->GetOutputPort());\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n\n  // Render the results.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(surface->GetOutputPort());\n  mapper->ScalarVisibilityOn();\n  mapper->SetScalarModeToUseCellData();\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->AddActor(lineActor);\n  renderer->SetBackground(colors->GetColor3d(\"Cobalt\").GetData());\n\n  // Make an oblique view.\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  iren->SetRenderWindow(renWin);\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"FindCellIntersections\");\n\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/FindCellIntersections/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FindCellIntersections)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersGeometry\n  FiltersSources\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FindCellIntersections: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FindCellIntersections MACOSX_BUNDLE FindCellIntersections.cxx )\n  target_link_libraries(FindCellIntersections PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FindCellIntersections\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/FindCellIntersections/#download-and-build-findcellintersections","title":"Download and Build FindCellIntersections","text":"

        Click here to download FindCellIntersections and its CMakeLists.txt file. Once the tarball FindCellIntersections.tar has been downloaded and extracted,

        cd FindCellIntersections/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FindCellIntersections\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/FireFlow/","title":"FireFlow","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/FireFlow

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/FireFlow/#description","title":"Description","text":"

        The example illustrates how to combine a geometric description of a scene with a fluid flow solution. The vtkVRMLImporter read the geometry file which is a .wrl file. The file contains 32 actors. The vtkXMLUnstructuredGridReader reads the solution.

        vtkStreamTracer generates streamline seeds with points generated by vtkPointSource. vtkContourFilter generates an isosurface of the velocity. A vtkSphereSource shows the sphere used in the vtkPointSource filter.

        For an interactive version of this example, see FireFlowDemo.

        Cite

        The solution and geometry data is from the Mayavi project. Mayavi is a python application that provides an easy to use interface to many vtk filters. Both a command-line and GUI interface are provided. If you use the Mayavi data or the Mayavi application, please use the following citation in any published work: Ramachandran, P. and Varoquaux, G., Mayavi: 3D Visualization of Scientific Data IEEE Computing in Science & Engineering, 13 (2), pp. 40-51 (2011).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/FireFlow/#code","title":"Code","text":"

        FireFlow.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkGenericOutlineFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkStreamTracer.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVRMLImporter.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \"  geometry.wrl velocity.vtu e.g. room_vis.wrl fire_ug.vtu\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d isoSurfaceColor = colors->GetColor3d(\"WhiteSmoke\");\n  vtkColor3d sphereColor = colors->GetColor3d(\"hotpink\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SlateGray\");\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Import the VRML Files that define the geometry.\n  vtkNew<vtkVRMLImporter> vrmlImport;\n  vrmlImport->SetRenderWindow(renderWindow);\n  vrmlImport->SetFileName(argv[1]);\n  vrmlImport->Update();\n\n  // Read the UnstructuredGrid define the solution.\n  vtkNew<vtkXMLUnstructuredGridReader> solution;\n  solution->SetFileName(argv[2]);\n  solution->Update();\n\n  // Create an outline.\n  vtkNew<vtkGenericOutlineFilter> outline;\n  outline->SetInputConnection(solution->GetOutputPort());\n\n  // Create Seeds.\n  vtkNew<vtkPointSource> seeds;\n  seeds->SetRadius(0.2);\n  seeds->SetCenter(3.5, 0.625, 1.25);\n  seeds->SetNumberOfPoints(50);\n\n  // Create streamlines.\n  vtkNew<vtkStreamTracer> streamTracer;\n  streamTracer->SetIntegrationDirectionToBoth();\n  streamTracer->SetInputConnection(solution->GetOutputPort());\n  streamTracer->SetSourceConnection(seeds->GetOutputPort());\n  streamTracer->SetMaximumPropagation(50);\n  streamTracer->SetInitialIntegrationStep(.2);\n  streamTracer->SetMinimumIntegrationStep(.01);\n  streamTracer->SetIntegratorType(1);\n  streamTracer->SetComputeVorticity(1);\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(streamTracer->GetOutputPort());\n  tubes->SetNumberOfSides(8);\n  tubes->SetRadius(.02);\n  tubes->SetVaryRadius(0);\n\n  vtkNew<vtkPolyDataMapper> mapTubes;\n  mapTubes->SetInputConnection(tubes->GetOutputPort());\n  mapTubes->SetScalarRange(solution->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> tubesActor;\n  tubesActor->SetMapper(mapTubes);\n\n  // Create an Isosurface.\n  vtkNew<vtkContourFilter> isoSurface;\n  isoSurface->SetValue(0, 550.0);\n  isoSurface->SetInputConnection(solution->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> isoSurfaceMapper;\n  isoSurfaceMapper->SetInputConnection(isoSurface->GetOutputPort());\n  isoSurfaceMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoSurfaceActor;\n  isoSurfaceActor->SetMapper(isoSurfaceMapper);\n  isoSurfaceActor->GetProperty()->SetOpacity(.5);\n  isoSurfaceActor->GetProperty()->SetDiffuseColor(isoSurfaceColor.GetData());\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetCenter(seeds->GetCenter());\n  sphere->SetRadius(seeds->GetRadius());\n  sphere->SetThetaResolution(20);\n  sphere->SetPhiResolution(11);\n  ;\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetOpacity(1.0);\n  sphereActor->GetProperty()->SetSpecular(.4);\n  sphereActor->GetProperty()->SetSpecularPower(80);\n  sphereActor->GetProperty()->SetDiffuseColor(sphereColor.GetData());\n\n  renderer->AddActor(tubesActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(isoSurfaceActor);\n\n  renderer->SetBackground(backgroundColor.GetData());\n  renderWindow->SetSize(640, 512);\n  renderWindow->SetWindowName(\"FireFlow\");\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Azimuth(20.0);\n  renderer->GetActiveCamera()->Elevation(10.0);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/FireFlow/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FireFlow)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeneric\n  FiltersSources\n  IOImport\n  IOXML\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FireFlow: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FireFlow MACOSX_BUNDLE FireFlow.cxx )\n  target_link_libraries(FireFlow PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FireFlow\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/FireFlow/#download-and-build-fireflow","title":"Download and Build FireFlow","text":"

        Click here to download FireFlow and its CMakeLists.txt file. Once the tarball FireFlow.tar has been downloaded and extracted,

        cd FireFlow/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FireFlow\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/FireFlowDemo/","title":"FireFlowDemo","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/FireFlowDemo

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/FireFlowDemo/#description","title":"Description","text":"

        This example adds interaction to FireFlow.

        The example uses vtkSliderWidget's to manipulate the center of the vtkPointSource that provides seed for the streamlines. As the X, Y, or Z center corrdiantes change, the streamlines are changed. The range of the x, y, and z coordinates are limited to the bounds of the solution dataset. There is a built in delay of 500 milliseconds to make the animation between selections consistent.

        Here's the embedded video

        showing the interactive movement of the seeding sphere.

        Cite

        The solution and geometry data is from the Mayavi project. Mayavi is a python application that provides an easy to use interface to many vtk filters. Both a command-line and GUI interface are provided. If you use the Mayavi data or the Mayavi application, please use the following citation in any published work: Ramachandran, P. and Varoquaux, G., Mayavi: 3D Visualization of Scientific Data IEEE Computing in Science & Engineering, 13 (2), pp. 40-51 (2011).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/FireFlowDemo/#code","title":"Code","text":"

        FireFlowDemo.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkGenericOutlineFilter.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereSource.h>\n#include <vtkStreamTracer.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVRMLImporter.h>\n#include <vtkXMLUnstructuredGridReader.h>\n\n#include <array>\n#include <chrono>\n#include <iostream>\n#include <string>\n#include <thread>\n\nnamespace {\nvoid MakeXWidget(vtkSliderWidget*, vtkPointSource*, vtkSphereSource*,\n                 vtkRenderer*, vtkRenderWindowInteractor*);\nvoid MakeYWidget(vtkSliderWidget*, vtkPointSource*, vtkSphereSource*,\n                 vtkRenderer*, vtkRenderWindowInteractor*);\nvoid MakeZWidget(vtkSliderWidget*, vtkPointSource*, vtkSphereSource*,\n                 vtkRenderer*, vtkRenderWindowInteractor*);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \"  geometry.wrl velocity.vtu e.g. room_vis.wrl fire_ug.vtu\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n  vtkColor3d isoSurfaceColor = colors->GetColor3d(\"WhiteSmoke\");\n  vtkColor3d sphereColor = colors->GetColor3d(\"hotpink\");\n  vtkColor3d backgroundColor = colors->GetColor3d(\"SlateGray\");\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Import the VRML Files that define the geometry.\n  vtkNew<vtkVRMLImporter> vrmlImport;\n  vrmlImport->SetRenderWindow(renderWindow);\n  vrmlImport->SetFileName(argv[1]);\n  vrmlImport->Update();\n\n  // Read the UnstructuredGrid define the solution.\n  vtkNew<vtkXMLUnstructuredGridReader> solution;\n  solution->SetFileName(argv[2]);\n  solution->Update();\n\n  std::array<double, 6> bounds;\n  solution->GetOutput()->GetBounds(bounds.data());\n\n  // Create an outline.\n  vtkNew<vtkGenericOutlineFilter> outline;\n  outline->SetInputConnection(solution->GetOutputPort());\n\n  // Create Seeds.\n  vtkNew<vtkPointSource> seeds;\n  seeds->SetRadius(0.2);\n  seeds->SetCenter(3.0, 1.6, 1.25);\n  seeds->SetNumberOfPoints(50);\n\n  // Create streamlines.\n  vtkNew<vtkStreamTracer> streamTracer;\n  streamTracer->SetIntegrationDirectionToBoth();\n  streamTracer->SetInputConnection(solution->GetOutputPort());\n  streamTracer->SetSourceConnection(seeds->GetOutputPort());\n  streamTracer->SetMaximumPropagation(50);\n  streamTracer->SetInitialIntegrationStep(.2);\n  streamTracer->SetMinimumIntegrationStep(.01);\n  streamTracer->SetIntegratorType(2);\n  streamTracer->SetComputeVorticity(1);\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(streamTracer->GetOutputPort());\n  tubes->SetNumberOfSides(8);\n  tubes->SetRadius(.02);\n  tubes->SetVaryRadius(0);\n\n  vtkNew<vtkPolyDataMapper> mapTubes;\n  mapTubes->SetInputConnection(tubes->GetOutputPort());\n  mapTubes->SetScalarRange(solution->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> tubesActor;\n  tubesActor->SetMapper(mapTubes);\n\n  // Create an Isosurface.\n  vtkNew<vtkContourFilter> isoSurface;\n  isoSurface->SetValue(0, 500.0);\n  isoSurface->SetInputConnection(solution->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> isoSurfaceMapper;\n  isoSurfaceMapper->SetInputConnection(isoSurface->GetOutputPort());\n  isoSurfaceMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoSurfaceActor;\n  isoSurfaceActor->SetMapper(isoSurfaceMapper);\n  isoSurfaceActor->GetProperty()->SetOpacity(.5);\n  isoSurfaceActor->GetProperty()->SetDiffuseColor(isoSurfaceColor.GetData());\n\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetCenter(seeds->GetCenter());\n  sphere->SetRadius(seeds->GetRadius());\n  sphere->SetThetaResolution(20);\n  sphere->SetPhiResolution(11);\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetOpacity(1.0);\n  sphereActor->GetProperty()->SetSpecular(.4);\n  sphereActor->GetProperty()->SetSpecularPower(80);\n  sphereActor->GetProperty()->SetDiffuseColor(sphereColor.GetData());\n\n  renderer->AddActor(tubesActor);\n  renderer->AddActor(sphereActor);\n  renderer->AddActor(isoSurfaceActor);\n\n  renderer->SetBackground(backgroundColor.GetData());\n  renderWindow->SetSize(640, 512);\n  renderWindow->SetWindowName(\"FireFlowDemo\");\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Azimuth(20.0);\n  renderer->GetActiveCamera()->Elevation(10.0);\n  renderer->GetActiveCamera()->Dolly(1.25);\n  renderer->ResetCameraClippingRange();\n\n  // Create widgets to manipulate point source center.\n  vtkNew<vtkSliderWidget> xWidget;\n  MakeXWidget(xWidget, seeds, sphere, renderer, renderWindowInteractor);\n  dynamic_cast<vtkSliderRepresentation2D*>(xWidget->GetRepresentation())\n      ->SetMinimumValue(bounds[0]);\n  dynamic_cast<vtkSliderRepresentation2D*>(xWidget->GetRepresentation())\n      ->SetMaximumValue(bounds[1]);\n  vtkNew<vtkSliderWidget> yWidget;\n  MakeYWidget(yWidget, seeds, sphere, renderer, renderWindowInteractor);\n  dynamic_cast<vtkSliderRepresentation2D*>(yWidget->GetRepresentation())\n      ->SetMinimumValue(bounds[2]);\n  dynamic_cast<vtkSliderRepresentation2D*>(yWidget->GetRepresentation())\n      ->SetMaximumValue(bounds[3]);\n  vtkNew<vtkSliderWidget> zWidget;\n  MakeZWidget(zWidget, seeds, sphere, renderer, renderWindowInteractor);\n  dynamic_cast<vtkSliderRepresentation2D*>(zWidget->GetRepresentation())\n      ->SetMinimumValue(bounds[4]);\n  dynamic_cast<vtkSliderRepresentation2D*>(zWidget->GetRepresentation())\n      ->SetMaximumValue(bounds[5]);\n\n  renderWindow->Render();\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n#define DELAY 500\n// These callbacks do the actual work.\n// Callbacks for the interactions\nclass SliderCallbackX : public vtkCallbackCommand\n{\npublic:\n  static SliderCallbackX* New()\n  {\n    return new SliderCallbackX;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    double center[3];\n    this->PointSource->GetCenter(center);\n    center[0] = value;\n    this->PointSource->SetCenter(center);\n    SphereSource->SetCenter(center);\n    PointSource->Modified();\n    PointSource->Update();\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackX() = default;\n  vtkPointSource* PointSource = nullptr;\n  vtkSphereSource* SphereSource = nullptr;\n};\n\nvoid MakeXWidget(vtkSliderWidget* widget, vtkPointSource* pointSource,\n                 vtkSphereSource* sphereSource, vtkRenderer* renderer,\n                 vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepX;\n\n  sliderRepX->SetRenderer(renderer);\n\n  sliderRepX->SetMinimumValue(-1000.0);\n  sliderRepX->SetMaximumValue(1000);\n  sliderRepX->SetValue(pointSource->GetCenter()[0]);\n  sliderRepX->SetTitleText(\"X\");\n  sliderRepX->SetRenderer(renderer);\n  sliderRepX->GetPoint1Coordinate()->SetValue(0.1, 0.1);\n  sliderRepX->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedViewport();\n  sliderRepX->GetPoint2Coordinate()->SetValue(0.3, 0.1);\n  sliderRepX->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepX->SetTubeWidth(tubeWidth);\n  sliderRepX->SetSliderLength(sliderLength);\n  sliderRepX->SetTitleHeight(titleHeight);\n  sliderRepX->SetLabelHeight(labelHeight);\n  sliderRepX->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepX->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepX->GetSliderProperty()->SetColor(0.0, 0.0, 0.0);\n  sliderRepX->BuildRepresentation();\n\n  widget->SetRepresentation(sliderRepX);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  auto callbackX = vtkSmartPointer<SliderCallbackX>::New();\n  callbackX->PointSource = pointSource;\n  callbackX->SphereSource = sphereSource;\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackX);\n}\n\nclass SliderCallbackY : public vtkCallbackCommand\n{\npublic:\n  static SliderCallbackY* New()\n  {\n    return new SliderCallbackY;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    double center[3];\n    this->PointSource->GetCenter(center);\n    center[1] = value;\n    this->PointSource->SetCenter(center);\n    this->SphereSource->SetCenter(center);\n    PointSource->Modified();\n    PointSource->Update();\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackY() = default;\n  vtkPointSource* PointSource = nullptr;\n  vtkSphereSource* SphereSource = nullptr;\n};\n\nvoid MakeYWidget(vtkSliderWidget* widget, vtkPointSource* pointSource,\n                 vtkSphereSource* sphereSource, vtkRenderer* renderer,\n                 vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepY;\n\n  sliderRepY->SetRenderer(renderer);\n\n  sliderRepY->SetMinimumValue(-1000.0);\n  sliderRepY->SetMaximumValue(1000);\n  sliderRepY->SetValue(pointSource->GetCenter()[1]);\n  sliderRepY->SetTitleText(\"Y\");\n  sliderRepY->SetRenderer(renderer);\n  sliderRepY->GetPoint1Coordinate()->SetValue(0.4, 0.1);\n  sliderRepY->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedViewport();\n  sliderRepY->GetPoint2Coordinate()->SetValue(0.6, 0.1);\n  sliderRepY->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepY->SetTubeWidth(tubeWidth);\n  sliderRepY->SetSliderLength(sliderLength);\n  sliderRepY->SetTitleHeight(titleHeight);\n  sliderRepY->SetLabelHeight(labelHeight);\n  sliderRepY->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepY->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepY->GetSliderProperty()->SetColor(0.0, 0.0, 0.0);\n  sliderRepY->BuildRepresentation();\n\n  widget->SetRepresentation(sliderRepY);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  auto callbackY = vtkSmartPointer<SliderCallbackY>::New();\n  callbackY->PointSource = pointSource;\n  callbackY->SphereSource = sphereSource;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackY);\n}\n\nclass SliderCallbackZ : public vtkCallbackCommand\n{\npublic:\n  static SliderCallbackZ* New()\n  {\n    return new SliderCallbackZ;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    double value = static_cast<vtkSliderRepresentation2D*>(\n                       sliderWidget->GetRepresentation())\n                       ->GetValue();\n    double center[3];\n    this->PointSource->GetCenter(center);\n    center[2] = value;\n    this->PointSource->SetCenter(center);\n    this->SphereSource->SetCenter(center);\n    PointSource->Modified();\n    PointSource->Update();\n    std::this_thread::sleep_for(std::chrono::milliseconds(DELAY));\n  }\n  SliderCallbackZ() = default;\n  vtkPointSource* PointSource = nullptr;\n  vtkSphereSource* SphereSource = nullptr;\n};\n\nvoid MakeZWidget(vtkSliderWidget* widget, vtkPointSource* pointSource,\n                 vtkSphereSource* sphereSource, vtkRenderer* renderer,\n                 vtkRenderWindowInteractor* interactor)\n{\n  // Setup a slider widget for each varying parameter.\n  double tubeWidth(.005);\n  double sliderLength(.02);\n  double titleHeight(.02);\n  double labelHeight(.02);\n\n  vtkNew<vtkSliderRepresentation2D> sliderRepZ;\n\n  sliderRepZ->SetRenderer(renderer);\n\n  sliderRepZ->SetMinimumValue(-1000.0);\n  sliderRepZ->SetMaximumValue(1000);\n  sliderRepZ->SetValue(pointSource->GetCenter()[2]);\n  sliderRepZ->SetTitleText(\"Z\");\n  sliderRepZ->SetRenderer(renderer);\n  sliderRepZ->GetPoint1Coordinate()->SetValue(0.7, 0.1);\n  sliderRepZ->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedViewport();\n  sliderRepZ->GetPoint2Coordinate()->SetValue(0.9, 0.1);\n  sliderRepZ->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedViewport();\n\n  sliderRepZ->SetTubeWidth(tubeWidth);\n  sliderRepZ->SetSliderLength(sliderLength);\n  sliderRepZ->SetTitleHeight(titleHeight);\n  sliderRepZ->SetLabelHeight(labelHeight);\n  sliderRepZ->SetEndCapLength(tubeWidth * 1.5);\n  sliderRepZ->SetSliderWidth(tubeWidth * 1.5);\n  sliderRepZ->GetSliderProperty()->SetColor(0.0, 0.0, 0.0);\n  sliderRepZ->BuildRepresentation();\n\n  widget->SetRepresentation(sliderRepZ);\n  widget->SetAnimationModeToAnimate();\n  widget->SetNumberOfAnimationSteps(10);\n  widget->SetInteractor(interactor);\n  widget->EnabledOn();\n\n  auto callbackZ = vtkSmartPointer<SliderCallbackZ>::New();\n  callbackZ->PointSource = pointSource;\n  callbackZ->SphereSource = sphereSource;\n\n  widget->AddObserver(vtkCommand::InteractionEvent, callbackZ);\n}\n} // namespace\n
        "},{"location":"Cxx/VisualizationAlgorithms/FireFlowDemo/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FireFlowDemo)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeneric\n  FiltersSources\n  IOImport\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FireFlowDemo: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FireFlowDemo MACOSX_BUNDLE FireFlowDemo.cxx )\n  target_link_libraries(FireFlowDemo PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FireFlowDemo\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/FireFlowDemo/#download-and-build-fireflowdemo","title":"Download and Build FireFlowDemo","text":"

        Click here to download FireFlowDemo and its CMakeLists.txt file. Once the tarball FireFlowDemo.tar has been downloaded and extracted,

        cd FireFlowDemo/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FireFlowDemo\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/FlyingHeadSlice/","title":"FlyingHeadSlice","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/FlyingHeadSlice

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/FlyingHeadSlice/#description","title":"Description","text":"

        This example generates 2D contour lines on one CT slice through the head. The contours correspond to density values of the tissues and are colored according to density value.

        This example is a modification of HeadSlice using vtkFlyingEdges2D for contouring. However there is an option to use vtkContourFilter instead.

        Info

        See Figure 6-11a in Chapter 6 of the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/FlyingHeadSlice/#code","title":"Code","text":"

        FlyingHeadSlice.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkExtractVOI.h>\n#include <vtkFlyingEdges2D.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Generate 2D contour lines, corresponding to tissue density, \"\n                 \"on one CT slice through the head.\"\n              << std::endl;\n    std::cout << \"The contour lines are colored by the tissue density.\"\n              << std::endl;\n    std::cout << \"Usage: \" << argv[0] << \" FullHead.mhd [useContourFilter]\"\n              << std::endl;\n    std::cout << \"where: filename is FullHead.mhd,\" << std::endl;\n    std::cout << \"       useContourFilter = 0|1\" << std::endl;\n    std::cout << \"Examples:\" << std::endl;\n    std::cout << \"Contouring, using vtkFlyingEdges2D: FullHead.mhd\"\n              << std::endl;\n    std::cout << \"Contouring, using vtkContourFilter: FullHead.mhd 1\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto useContourFilter = false;\n  if (argc > 2)\n  {\n    if (atoi(argv[2]) != 0)\n    {\n      useContourFilter = true;\n    }\n  }\n\n  if (useContourFilter)\n  {\n    std::cout << \"Using vtkContourFilter.\" << std::endl;\n  }\n  else\n  {\n    std::cout << \"Using vtkFlyingEdges2D.\" << std::endl;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors.\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the pipeline.\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkExtractVOI> extractVOI;\n  extractVOI->SetInputConnection(reader->GetOutputPort());\n  extractVOI->SetVOI(0, 255, 0, 255, 45, 45);\n  extractVOI->Update();\n  // double* scalarRange = extractVOI->GetOutput()->GetScalarRange();\n  std::array<double, 2> scalarRange = {{500, 1150}};\n  // std::cout << scalarRange[0] << \", \" << scalarRange[1] << std::endl;\n\n  vtkNew<vtkContourFilter> contour;\n  vtkNew<vtkFlyingEdges2D> flyingEdges;\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  if (useContourFilter)\n  {\n    contour->SetInputConnection(extractVOI->GetOutputPort());\n    contour->GenerateValues(12, scalarRange.data());\n    isoMapper->SetInputConnection(contour->GetOutputPort());\n  }\n  else\n  {\n    flyingEdges->SetInputConnection(extractVOI->GetOutputPort());\n    flyingEdges->GenerateValues(12, scalarRange.data());\n    isoMapper->SetInputConnection(flyingEdges->GetOutputPort());\n  }\n  isoMapper->ScalarVisibilityOn();\n  isoMapper->SetScalarRange(scalarRange.data());\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Wheat\").GetData());\n\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(extractVOI->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size.\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 640);\n  renWin->SetWindowName(\"FlyingHeadSlice\");\n  renWin->Render();\n\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/FlyingHeadSlice/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FlyingHeadSlice)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FlyingHeadSlice: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FlyingHeadSlice MACOSX_BUNDLE FlyingHeadSlice.cxx )\n  target_link_libraries(FlyingHeadSlice PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FlyingHeadSlice\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/FlyingHeadSlice/#download-and-build-flyingheadslice","title":"Download and Build FlyingHeadSlice","text":"

        Click here to download FlyingHeadSlice and its CMakeLists.txt file. Once the tarball FlyingHeadSlice.tar has been downloaded and extracted,

        cd FlyingHeadSlice/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FlyingHeadSlice\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/HeadBone/","title":"HeadBone","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/HeadBone

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/HeadBone/#description","title":"Description","text":"

        This example generates an isosurface of human bone.

        Info

        See Figure 6-11b in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/HeadBone/#code","title":"Code","text":"

        HeadBone.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkMergePoints.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVersion.h>\n\n// vtkFlyingEdges3D was introduced in VTK >= 8.2\n#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)\n#define USE_FLYING_EDGES\n#else\n#undef USE_FLYING_EDGES\n#endif\n\n#ifdef USE_FLYING_EDGES\n#include <vtkFlyingEdges3D.h>\n#else\n#include <vtkMarchingCubes.h>\n#endif\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" FullHead.mhd\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create pipeline.\n  //\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkMergePoints> locator;\n  locator->SetDivisions(64, 64, 92);\n  locator->SetNumberOfPointsPerBucket(2);\n  locator->AutomaticOff();\n\n#ifdef USE_FLYING_EDGES\n  vtkNew<vtkFlyingEdges3D> iso;\n#else\n  vtkNew<vtkMarchingCubes> iso;\n#endif\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->ComputeGradientsOn();\n  iso->ComputeScalarsOff();\n  iso->SetValue(0, 1150);\n#ifndef USE_FLYING_EDGES\n  iso->SetLocator(locator);\n#endif\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Ivory\").GetData());\n\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->GetActiveCamera()->SetFocalPoint(0, 0, 0);\n  ren1->GetActiveCamera()->SetPosition(0, -1, 0);\n  ren1->GetActiveCamera()->SetViewUp(0, 0, -1);\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"HeadBone\");\n\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/HeadBone/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HeadBone)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HeadBone: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HeadBone MACOSX_BUNDLE HeadBone.cxx )\n  target_link_libraries(HeadBone PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HeadBone\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/HeadBone/#download-and-build-headbone","title":"Download and Build HeadBone","text":"

        Click here to download HeadBone and its CMakeLists.txt file. Once the tarball HeadBone.tar has been downloaded and extracted,

        cd HeadBone/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HeadBone\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/HeadSlice/","title":"HeadSlice","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/HeadSlice

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/HeadSlice/#description","title":"Description","text":"

        This example generates contours on one CT slice through the head,

        Info

        See Figure 6-11a in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/HeadSlice/#code","title":"Code","text":"

        HeadSlice.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkExtractVOI.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" FullHead.mhd\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // create pipeline\n  //\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update();\n\n  vtkNew<vtkExtractVOI> extractVOI;\n  extractVOI->SetInputConnection(reader->GetOutputPort());\n  extractVOI->SetVOI(0, 255, 0, 255, 45, 45);\n\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputConnection(extractVOI->GetOutputPort());\n  iso->GenerateValues(12, 500, 1150);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Wheat\").GetData());\n\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(extractVOI->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Dolly(1.5);\n  ren1->ResetCameraClippingRange();\n\n  renWin->SetSize(640, 640);\n  renWin->SetWindowName(\"HeadSlice\");\n\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/HeadSlice/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HeadSlice)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOImage\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HeadSlice: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HeadSlice MACOSX_BUNDLE HeadSlice.cxx )\n  target_link_libraries(HeadSlice PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HeadSlice\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/HeadSlice/#download-and-build-headslice","title":"Download and Build HeadSlice","text":"

        Click here to download HeadSlice and its CMakeLists.txt file. Once the tarball HeadSlice.tar has been downloaded and extracted,

        cd HeadSlice/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HeadSlice\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/Hello/","title":"Hello","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/Hello

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/Hello/#description","title":"Description","text":"

        Implicit modelling used to thicken a stroked font. Original lines can be seen within the translucent implicit surface.

        Info

        See Figure 6-28 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/Hello/#code","title":"Code","text":"

        Hello.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitModeller.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" hello.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  vtkNew<vtkNamedColors> colors;\n\n  // Create lines which serve as the \"seed\" geometry. The lines spell the\n  // word \"hello\".\n  //\n  vtkNew<vtkPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n  lineActor->GetProperty()->SetLineWidth(3.0);\n\n  // Create implicit model with vtkImplicitModeller. This computes a scalar\n  // field which is the distance from the generating geometry. The contour\n  // filter then extracts the geometry at the distance value 0.25 from the\n  // generating geometry.\n  //\n  vtkNew<vtkImplicitModeller> imp;\n  imp->SetInputConnection(reader->GetOutputPort());\n  imp->SetSampleDimensions(110, 40, 20);\n  imp->SetMaximumDistance(0.25);\n  imp->SetModelBounds(-1.0, 10.0, -1.0, 3.0, -1.0, 1.0);\n\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(imp->GetOutputPort());\n  contour->SetValue(0, 0.25);\n\n  vtkNew<vtkPolyDataMapper> impMapper;\n  impMapper->SetInputConnection(contour->GetOutputPort());\n  impMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> impActor;\n  impActor->SetMapper(impMapper);\n  impActor->GetProperty()->SetColor(colors->GetColor3d(\"Peacock\").GetData());\n  impActor->GetProperty()->SetOpacity(0.5);\n\n  // Create the usual graphics stuff.\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(lineActor);\n  ren1->AddActor(impActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"Hello\");\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(4.5, 1, 0);\n  camera->SetPosition(4.5, 1.0, 6.73257);\n  camera->SetViewUp(0, 1, 0);\n\n  ren1->SetActiveCamera(camera);\n  ren1->ResetCamera();\n  camera->Dolly(1.3);\n  camera->SetClippingRange(1.81325, 90.6627);\n\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/Hello/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Hello)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersHybrid\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Hello: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Hello MACOSX_BUNDLE Hello.cxx )\n  target_link_libraries(Hello PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Hello\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/Hello/#download-and-build-hello","title":"Download and Build Hello","text":"

        Click here to download Hello and its CMakeLists.txt file. Once the tarball Hello.tar has been downloaded and extracted,

        cd Hello/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Hello\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/HyperStreamline/","title":"HyperStreamline","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/HyperStreamline

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/HyperStreamline/#description","title":"Description","text":"

        This is an example of hyperstreamlines. The data is from a point load applied to semi-infinite domain. Compare this image to TensorEllipsoids that used tensor ellipsoids to visualize the same data. Notice that there is less clutter and more information available from the hyperstreamline visualization.

        Info

        See Figure 9-15 in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/HyperStreamline/#code","title":"Code","text":"

        HyperStreamline.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkHyperStreamline.h>\n#include <vtkImageData.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkLogLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointLoad.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  // Create the RenderWindow, Renderer and interactive renderer.\n  //\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetMultiSamples(0);\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // set VTK_INTEGRATE_BOTH_DIRECTIONS 2\n\n  //\n  // Generate tensors.\n  vtkNew<vtkPointLoad> ptLoad;\n  ptLoad->SetLoadValue(100.0);\n  ptLoad->SetSampleDimensions(20, 20, 20);\n  ptLoad->ComputeEffectiveStressOn();\n  ptLoad->SetModelBounds(-10, 10, -10, 10, -10, 10);\n  ptLoad->Update();\n\n  // Generate hyperstreamlines.\n  vtkNew<vtkHyperStreamline> s1;\n  s1->SetInputData(ptLoad->GetOutput());\n  s1->SetStartPosition(9, 9, -9);\n  s1->IntegrateMinorEigenvector();\n  s1->SetMaximumPropagationDistance(18.0);\n  s1->SetIntegrationStepLength(0.1);\n  s1->SetStepLength(0.01);\n  s1->SetRadius(0.25);\n  s1->SetNumberOfSides(18);\n  s1->SetIntegrationDirectionToIntegrateBothDirections();\n  s1->Update();\n\n  // Map hyperstreamlines.\n  vtkNew<vtkLogLookupTable> lut;\n  lut->SetHueRange(.6667, 0.0);\n\n  vtkNew<vtkPolyDataMapper> s1Mapper;\n  s1Mapper->SetInputConnection(s1->GetOutputPort());\n  s1Mapper->SetLookupTable(lut);\n  s1Mapper->SetScalarRange(ptLoad->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> s1Actor;\n  s1Actor->SetMapper(s1Mapper);\n\n  vtkNew<vtkHyperStreamline> s2;\n  s2->SetInputData(ptLoad->GetOutput());\n  s2->SetStartPosition(-9, -9, -9);\n  s2->IntegrateMinorEigenvector();\n  s2->SetMaximumPropagationDistance(18.0);\n  s2->SetIntegrationStepLength(0.1);\n  s2->SetStepLength(0.01);\n  s2->SetRadius(0.25);\n  s2->SetNumberOfSides(18);\n  s2->SetIntegrationDirectionToIntegrateBothDirections();\n  s2->Update();\n\n  vtkNew<vtkPolyDataMapper> s2Mapper;\n  s2Mapper->SetInputConnection(s2->GetOutputPort());\n  s2Mapper->SetLookupTable(lut);\n  s2Mapper->SetScalarRange(ptLoad->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> s2Actor;\n  s2Actor->SetMapper(s2Mapper);\n\n  vtkNew<vtkHyperStreamline> s3;\n  s3->SetInputData(ptLoad->GetOutput());\n  s3->SetStartPosition(9, -9, -9);\n  s3->IntegrateMinorEigenvector();\n  s3->SetMaximumPropagationDistance(18.0);\n  s3->SetIntegrationStepLength(0.1);\n  s3->SetStepLength(0.01);\n  s3->SetRadius(0.25);\n  s3->SetNumberOfSides(18);\n  s3->SetIntegrationDirectionToIntegrateBothDirections();\n  s3->Update();\n\n  vtkNew<vtkPolyDataMapper> s3Mapper;\n  s3Mapper->SetInputConnection(s3->GetOutputPort());\n  s3Mapper->SetLookupTable(lut);\n  s3Mapper->SetScalarRange(ptLoad->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> s3Actor;\n  s3Actor->SetMapper(s3Mapper);\n\n  vtkNew<vtkHyperStreamline> s4;\n  s4->SetInputData(ptLoad->GetOutput());\n  s4->SetStartPosition(-9, 9, -9);\n  s4->IntegrateMinorEigenvector();\n  s4->SetMaximumPropagationDistance(18.0);\n  s4->SetIntegrationStepLength(0.1);\n  s4->SetStepLength(0.01);\n  s4->SetRadius(0.25);\n  s4->SetNumberOfSides(18);\n  s4->SetIntegrationDirectionToIntegrateBothDirections();\n  s4->Update();\n\n  vtkNew<vtkPolyDataMapper> s4Mapper;\n  s4Mapper->SetInputConnection(s4->GetOutputPort());\n  s4Mapper->SetLookupTable(lut);\n  s4Mapper->SetScalarRange(ptLoad->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> s4Actor;\n  s4Actor->SetMapper(s4Mapper);\n\n  // Plane for context.\n  //\n  vtkNew<vtkImageDataGeometryFilter> g;\n  g->SetInputData(ptLoad->GetOutput());\n  g->SetExtent(0, 100, 0, 100, 0, 0);\n  g->Update(); // for scalar range\n\n  vtkNew<vtkPolyDataMapper> gm;\n  gm->SetInputConnection(g->GetOutputPort());\n  gm->SetScalarRange(g->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> ga;\n  ga->SetMapper(gm);\n\n  // Create outline around data.\n  //\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputData(ptLoad->GetOutput());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create cone indicating application of load.\n  //\n  vtkNew<vtkConeSource> coneSrc;\n  coneSrc->SetRadius(0.5);\n  coneSrc->SetHeight(2);\n\n  vtkNew<vtkPolyDataMapper> coneMap;\n  coneMap->SetInputConnection(coneSrc->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMap);\n  coneActor->SetPosition(0, 0, 11);\n  coneActor->RotateY(90);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Tomato\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(0.113766, -1.13665, -1.01919);\n  camera->SetPosition(-29.4886, -63.1488, 26.5807);\n  camera->SetViewAngle(24.4617);\n  camera->SetViewUp(0.17138, 0.331163, 0.927879);\n  camera->SetClippingRange(1, 100);\n\n  ren1->AddActor(s1Actor);\n  ren1->AddActor(s2Actor);\n  ren1->AddActor(s3Actor);\n  ren1->AddActor(s4Actor);\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(coneActor);\n  ren1->AddActor(ga);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->SetActiveCamera(camera);\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"HyperStreamline\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/HyperStreamline/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HyperStreamline)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersGeneral\n  FiltersGeometry\n  FiltersModeling\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HyperStreamline: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HyperStreamline MACOSX_BUNDLE HyperStreamline.cxx )\n  target_link_libraries(HyperStreamline PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HyperStreamline\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/HyperStreamline/#download-and-build-hyperstreamline","title":"Download and Build HyperStreamline","text":"

        Click here to download HyperStreamline and its CMakeLists.txt file. Once the tarball HyperStreamline.tar has been downloaded and extracted,

        cd HyperStreamline/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HyperStreamline\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/IceCream/","title":"IceCream","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/IceCream

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/IceCream/#description","title":"Description","text":"

        This example demonstrates how to use boolean combinations of implicit functions to create a model of an ice cream cone.

        Info

        See Figure 6-23c in Chapter 6 the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/IceCream/#code","title":"Code","text":"

        IceCream.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCone.h>\n#include <vtkContourFilter.h>\n#include <vtkImplicitBoolean.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSampleFunction.h>\n#include <vtkSphere.h>\n\nint main(int, char*[])\n{\n  // This example demonstrates how to use boolean combinations of implicit\n  // functions to create a model of an ice cream cone.\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create implicit function primitives. These have been carefully placed to\n  // give the effect that we want. We are going to use various combinations of\n  // these functions to create the shape we want; for example, we use planes\n  // intersected with a cone (which is infinite in extent) to get a finite\n  // cone.\n  //\n  vtkNew<vtkCone> cone;\n  cone->SetAngle(20);\n\n  vtkNew<vtkPlane> vertPlane;\n  vertPlane->SetOrigin(.1, 0, 0);\n  vertPlane->SetNormal(-1, 0, 0);\n\n  vtkNew<vtkPlane> basePlane;\n  basePlane->SetOrigin(1.2, 0, 0);\n  basePlane->SetNormal(1, 0, 0);\n\n  vtkNew<vtkSphere> iceCream;\n  iceCream->SetCenter(1.333, 0, 0);\n  iceCream->SetRadius(0.5);\n\n  vtkNew<vtkSphere> bite;\n  bite->SetCenter(1.5, 0, 0.5);\n  bite->SetRadius(0.25);\n\n  // Combine primitives to build ice-cream cone. Clip the cone with planes.\n  vtkNew<vtkImplicitBoolean> theCone;\n  theCone->SetOperationTypeToIntersection();\n  theCone->AddFunction(cone);\n  theCone->AddFunction(vertPlane);\n  theCone->AddFunction(basePlane);\n\n  // Take a bite out of the ice cream.\n  vtkNew<vtkImplicitBoolean> theCream;\n  theCream->SetOperationTypeToDifference();\n  theCream->AddFunction(iceCream);\n  theCream->AddFunction(bite);\n\n  // The sample function generates a distance function from the\n  // implicit function (which in this case is the cone). This is\n  // then contoured to get a polygonal surface.\n  //\n  vtkNew<vtkSampleFunction> theConeSample;\n  theConeSample->SetImplicitFunction(theCone);\n  theConeSample->SetModelBounds(-1, 1.5, -1.25, 1.25, -1.25, 1.25);\n  theConeSample->SetSampleDimensions(128, 128, 128);\n  theConeSample->ComputeNormalsOff();\n\n  vtkNew<vtkContourFilter> theConeSurface;\n  theConeSurface->SetInputConnection(theConeSample->GetOutputPort());\n  theConeSurface->SetValue(0, 0.0);\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(theConeSurface->GetOutputPort());\n  coneMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"chocolate\").GetData());\n\n  // The same here for the ice cream.\n  //\n  vtkNew<vtkSampleFunction> theCreamSample;\n  theCreamSample->SetImplicitFunction(theCream);\n  theCreamSample->SetModelBounds(0, 2.5, -1.25, 1.25, -1.25, 1.25);\n  theCreamSample->SetSampleDimensions(128, 128, 128);\n  theCreamSample->ComputeNormalsOff();\n\n  vtkNew<vtkContourFilter> theCreamSurface;\n  theCreamSurface->SetInputConnection(theCreamSample->GetOutputPort());\n  theCreamSurface->SetValue(0, 0.0);\n\n  vtkNew<vtkPolyDataMapper> creamMapper;\n  creamMapper->SetInputConnection(theCreamSurface->GetOutputPort());\n  creamMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> creamActor;\n  creamActor->SetMapper(creamMapper);\n  creamActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"mint\").GetData());\n  creamActor->GetProperty()->SetSpecular(.6);\n  creamActor->GetProperty()->SetSpecularPower(50);\n\n  // Create the usual rendering stuff\n  //\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(coneActor);\n  ren1->AddActor(creamActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"IceCream\");\n\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Roll(90);\n  ren1->GetActiveCamera()->Dolly(1.25);\n  ren1->ResetCameraClippingRange();\n  iren->Initialize();\n\n  // render the image\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/IceCream/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IceCream)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IceCream: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IceCream MACOSX_BUNDLE IceCream.cxx )\n  target_link_libraries(IceCream PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IceCream\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/IceCream/#download-and-build-icecream","title":"Download and Build IceCream","text":"

        Click here to download IceCream and its CMakeLists.txt file. Once the tarball IceCream.tar has been downloaded and extracted,

        cd IceCream/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IceCream\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/ImageGradient/","title":"ImageGradient","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/ImageGradient

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/ImageGradient/#description","title":"Description","text":"

        We create an imaging pipeline to visualize gradient information.

        The gradient direction is mapped into color hue value while the gradient magnitude is mapped into the color saturation.

        Info

        See Figure 10-16 in Chapter 10 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/ImageGradient/#code","title":"Code","text":"

        ImageGradient.cxx

        /*\n * Visualization of gradient information.\n *\n */\n\n#include <vtkImageCast.h>\n#include <vtkImageConstantPad.h>\n#include <vtkImageEuclideanToPolar.h>\n#include <vtkImageExtractComponents.h>\n#include <vtkImageGaussianSmooth.h>\n#include <vtkImageGradient.h>\n#include <vtkImageHSVToRGB.h>\n#include <vtkImageMagnify.h>\n#include <vtkImageViewer.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iomanip>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fileName\" << std::endl;\n    std::cout << \"where: fileName is FullHead.mhd.\" << std::endl;\n    std::cout << \"Note: The file FullHead.raw.gz must also be present in the \"\n                 \"same folder.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the CT data of the human head.\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->Update();\n\n  vtkNew<vtkImageCast> cast;\n  cast->SetInputConnection(reader->GetOutputPort());\n  cast->SetOutputScalarTypeToFloat();\n\n  // Magnify the image.\n  vtkNew<vtkImageMagnify> magnify;\n  magnify->SetInputConnection(cast->GetOutputPort());\n  magnify->SetMagnificationFactors(2, 2, 1);\n  magnify->InterpolateOn();\n\n  // Smooth the data.\n  // Remove high frequency artifacts due to linear interpolation.\n  vtkNew<vtkImageGaussianSmooth> smooth;\n  smooth->SetInputConnection(magnify->GetOutputPort());\n  smooth->SetDimensionality(2);\n  smooth->SetStandardDeviations(1.5, 1.5, 0.0);\n  smooth->SetRadiusFactors(2.01, 2.01, 0.0);\n\n  // Compute the 2D gradient.\n  vtkNew<vtkImageGradient> gradient;\n  gradient->SetInputConnection(smooth->GetOutputPort());\n  gradient->SetDimensionality(2);\n\n  // Convert the data to polar coordinates.\n  // The image magnitude is mapped into saturation value,\n  //  whilst the gradient direction is mapped into hue value.\n  vtkNew<vtkImageEuclideanToPolar> polar;\n  polar->SetInputConnection(gradient->GetOutputPort());\n  polar->SetThetaMaximum(255.0);\n\n  // Add a third component to the data.\n  // This is needed since the gradient filter only generates two components,\n  //  and we need three components to represent color.\n  vtkNew<vtkImageConstantPad> pad;\n  pad->SetInputConnection(polar->GetOutputPort());\n  pad->SetOutputNumberOfScalarComponents(3);\n  pad->SetConstant(200.0);\n\n  // At this point we have Hue, Value, Saturation.\n  // Permute components so saturation will be constant.\n  // Re-arrange components into HSV order.\n  vtkNew<vtkImageExtractComponents> permute;\n  permute->SetInputConnection(pad->GetOutputPort());\n  permute->SetComponents(0, 2, 1);\n\n  // Convert back into RGB values.\n  vtkNew<vtkImageHSVToRGB> rgb;\n  rgb->SetInputConnection(permute->GetOutputPort());\n  rgb->SetMaximum(255.0);\n\n  // Set up a viewer for the image.\n  // Note that vtkImageViewer and vtkImageViewer2 are convenience wrappers\n  // around\n  // vtkActor2D, vtkImageMapper, vtkRenderer, and vtkRenderWindow.\n  // So all that needs to be supplied is the interactor.\n  vtkNew<vtkImageViewer> viewer;\n  viewer->SetInputConnection(rgb->GetOutputPort());\n  viewer->SetZSlice(22);\n  viewer->SetColorWindow(255.0);\n  viewer->SetColorLevel(127.0);\n  viewer->GetRenderWindow()->SetSize(512, 512);\n  viewer->GetRenderer()->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  viewer->GetRenderWindow()->SetWindowName(\"ImageGradient\");\n\n  // Create the RenderWindowInteractor.\n  vtkNew<vtkRenderWindowInteractor> iren;\n  viewer->SetupInteractor(iren);\n  viewer->Render();\n\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/ImageGradient/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageGradient)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingColor\n  ImagingCore\n  ImagingGeneral\n  InteractionImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageGradient: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageGradient MACOSX_BUNDLE ImageGradient.cxx )\n  target_link_libraries(ImageGradient PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageGradient\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/ImageGradient/#download-and-build-imagegradient","title":"Download and Build ImageGradient","text":"

        Click here to download ImageGradient and its CMakeLists.txt file. Once the tarball ImageGradient.tar has been downloaded and extracted,

        cd ImageGradient/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageGradient\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/IronIsoSurface/","title":"IronIsoSurface","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/IronIsoSurface

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/IronIsoSurface/#description","title":"Description","text":"

        This example generates an isosurface of electron potential of an iron protein molecule.

        Info

        See Figure 6-11d in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/IronIsoSurface/#code","title":"Code","text":"

        IronIsoSurface.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" ironProt.vtk\" << std::endl;\n    return EXIT_SUCCESS;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // create pipeline\n  //\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputConnection(reader->GetOutputPort());\n  iso->SetValue(0, 128);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(iso->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(isoActor);\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renWin->SetSize(640, 640);\n  renWin->SetWindowName(\"IronIsoSurface\");\n\n  // render the image\n  //\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Azimuth(30);\n  ren1->GetActiveCamera()->Elevation(30);\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/IronIsoSurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IronIsoSurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersModeling\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IronIsoSurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IronIsoSurface MACOSX_BUNDLE IronIsoSurface.cxx )\n  target_link_libraries(IronIsoSurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IronIsoSurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/IronIsoSurface/#download-and-build-ironisosurface","title":"Download and Build IronIsoSurface","text":"

        Click here to download IronIsoSurface and its CMakeLists.txt file. Once the tarball IronIsoSurface.tar has been downloaded and extracted,

        cd IronIsoSurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IronIsoSurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/LOx/","title":"LOx","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/LOx

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/LOx/#description","title":"Description","text":"

        Streamtubes created by using the computational grid just in front of the post as a source for seeds

        Info

        See Figure 12-16 in Chapter 12 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/LOx/#code","title":"Code","text":"

        LOx.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <string>\n\n//// LOx post CFD case study.\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" postxyz.bin postq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Read the data.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->AutoDetectFormatOn();\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(153);\n  pl3d->SetVectorFunctionNumber(200);\n  pl3d->Update();\n\n  vtkStructuredGrid* sg =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Blue to red lut.\n  //\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.667, 0.0);\n\n  // Computational planes.\n  vtkNew<vtkStructuredGridGeometryFilter> floorComp;\n  floorComp->SetExtent(0, 37, 0, 75, 0, 0);\n  floorComp->SetInputData(sg);\n  floorComp->Update();\n\n  vtkNew<vtkPolyDataMapper> floorMapper;\n  floorMapper->SetInputConnection(floorComp->GetOutputPort());\n  floorMapper->ScalarVisibilityOff();\n  floorMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> floorActor;\n  floorActor->SetMapper(floorMapper);\n  floorActor->GetProperty()->SetRepresentationToWireframe();\n  floorActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n  floorActor->GetProperty()->SetLineWidth(2);\n\n  vtkNew<vtkStructuredGridGeometryFilter> subFloorComp;\n\n  subFloorComp->SetExtent(0, 37, 0, 15, 22, 22);\n  subFloorComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> subFloorMapper;\n  subFloorMapper->SetInputConnection(subFloorComp->GetOutputPort());\n  subFloorMapper->SetLookupTable(lut);\n  subFloorMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> subFloorActor;\n\n  subFloorActor->SetMapper(subFloorMapper);\n\n  vtkNew<vtkStructuredGridGeometryFilter> subFloor2Comp;\n  subFloor2Comp->SetExtent(0, 37, 60, 75, 22, 22);\n  subFloor2Comp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> subFloor2Mapper;\n  subFloor2Mapper->SetInputConnection(subFloor2Comp->GetOutputPort());\n  subFloor2Mapper->SetLookupTable(lut);\n  subFloor2Mapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> subFloor2Actor;\n\n  subFloor2Actor->SetMapper(subFloor2Mapper);\n\n  vtkNew<vtkStructuredGridGeometryFilter> postComp;\n\n  postComp->SetExtent(10, 10, 0, 75, 0, 37);\n  postComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> postMapper;\n  postMapper->SetInputConnection(postComp->GetOutputPort());\n  postMapper->SetLookupTable(lut);\n  postMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> postActor;\n  postActor->SetMapper(postMapper);\n  postActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> fanComp;\n  fanComp->SetExtent(0, 37, 38, 38, 0, 37);\n  fanComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> fanMapper;\n  fanMapper->SetInputConnection(fanComp->GetOutputPort());\n  fanMapper->SetLookupTable(lut);\n  fanMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> fanActor;\n\n  fanActor->SetMapper(fanMapper);\n  fanActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  // Streamers\n  //\n  // Spherical seed points.\n  vtkNew<vtkPointSource> rake;\n  rake->SetCenter(-0.74, 0, 0.3);\n  rake->SetNumberOfPoints(10);\n\n  // A line of seed points.\n  vtkNew<vtkStructuredGridGeometryFilter> seedsComp;\n  seedsComp->SetExtent(10, 10, 37, 39, 1, 27);\n  seedsComp->SetInputData(sg);\n\n  vtkNew<vtkStreamTracer> streamers;\n  streamers->SetInputConnection(pl3d->GetOutputPort());\n\n  // streamers SetSource [rake GetOutput]\n  streamers->SetSourceConnection(seedsComp->GetOutputPort());\n  streamers->SetMaximumPropagation(250);\n  streamers->SetInitialIntegrationStep(.2);\n  streamers->SetMinimumIntegrationStep(.01);\n  streamers->SetIntegratorType(2);\n  streamers->Update();\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(streamers->GetOutputPort());\n  tubes->SetNumberOfSides(8);\n  tubes->SetRadius(0.08);\n  tubes->SetVaryRadius(0);\n\n  vtkNew<vtkPolyDataMapper> mapTubes;\n\n  mapTubes->SetInputConnection(tubes->GetOutputPort());\n  mapTubes->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> tubesActor;\n  tubesActor->SetMapper(mapTubes);\n\n  // outline\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  // Create graphics stuff\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(floorActor);\n  //  ren1->AddActor(subFloorActor);\n  //  ren1->AddActor(subFloor2Actor);\n  ren1->AddActor(postActor);\n  //  ren1->AddActor(fanActor);\n  ren1->AddActor(tubesActor);\n\n  vtkNew<vtkCamera> aCam;\n  aCam->SetFocalPoint(2.47736, -0.150024, 2.42361);\n  aCam->SetPosition(1.57547, -13.4601, 5.47872);\n  aCam->SetViewUp(0.00197003, 0.223588, 0.974682);\n  //  aCam->Dolly(4.0);\n  aCam->SetClippingRange(1, 100);\n\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->SetActiveCamera(aCam);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"LOx\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/LOx/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LOx)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LOx: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LOx MACOSX_BUNDLE LOx.cxx )\n  target_link_libraries(LOx PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LOx\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/LOx/#download-and-build-lox","title":"Download and Build LOx","text":"

        Click here to download LOx and its CMakeLists.txt file. Once the tarball LOx.tar has been downloaded and extracted,

        cd LOx/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LOx\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/LOxGrid/","title":"LOxGrid","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/LOxGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/LOxGrid/#desription","title":"Desription","text":"

        Portion of computational grid for the LOx post.

        Info

        See Figure 12-14 in Chapter 12 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/LOxGrid/#code","title":"Code","text":"

        LOxGrid.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkTubeFilter.h>\n\n//// LOx post CFD case study\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" postxyz.bin postq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Read the data.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->AutoDetectFormatOn();\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(153);\n  pl3d->SetVectorFunctionNumber(200);\n  pl3d->Update();\n\n  vtkStructuredGrid* sg =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Blue to red lut.\n  //\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.667, 0.0);\n\n  // Computational planes.\n  vtkNew<vtkStructuredGridGeometryFilter> floorComp;\n  floorComp->SetExtent(0, 37, 0, 75, 0, 0);\n  floorComp->SetInputData(sg);\n  floorComp->Update();\n\n  vtkNew<vtkPolyDataMapper> floorMapper;\n  floorMapper->SetInputConnection(floorComp->GetOutputPort());\n  floorMapper->ScalarVisibilityOff();\n  floorMapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> floorActor;\n  floorActor->SetMapper(floorMapper);\n  floorActor->GetProperty()->SetRepresentationToWireframe();\n  floorActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n  floorActor->GetProperty()->SetLineWidth(2);\n\n  vtkNew<vtkStructuredGridGeometryFilter> subFloorComp;\n\n  subFloorComp->SetExtent(0, 37, 0, 15, 22, 22);\n  subFloorComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> subFloorMapper;\n  subFloorMapper->SetInputConnection(subFloorComp->GetOutputPort());\n  subFloorMapper->SetLookupTable(lut);\n  subFloorMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> subFloorActor;\n\n  subFloorActor->SetMapper(subFloorMapper);\n\n  vtkNew<vtkStructuredGridGeometryFilter> subFloor2Comp;\n  subFloor2Comp->SetExtent(0, 37, 60, 75, 22, 22);\n  subFloor2Comp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> subFloor2Mapper;\n  subFloor2Mapper->SetInputConnection(subFloor2Comp->GetOutputPort());\n  subFloor2Mapper->SetLookupTable(lut);\n  subFloor2Mapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> subFloor2Actor;\n\n  subFloor2Actor->SetMapper(subFloor2Mapper);\n\n  vtkNew<vtkStructuredGridGeometryFilter> postComp;\n\n  postComp->SetExtent(10, 10, 0, 75, 0, 37);\n  postComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> postMapper;\n  postMapper->SetInputConnection(postComp->GetOutputPort());\n  postMapper->SetLookupTable(lut);\n  postMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> postActor;\n  postActor->SetMapper(postMapper);\n  postActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> fanComp;\n  fanComp->SetExtent(0, 37, 38, 38, 0, 37);\n  fanComp->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> fanMapper;\n  fanMapper->SetInputConnection(fanComp->GetOutputPort());\n  fanMapper->SetLookupTable(lut);\n  fanMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> fanActor;\n\n  fanActor->SetMapper(fanMapper);\n  fanActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  // streamers\n  //\n  // Spherical seed points.\n  vtkNew<vtkPointSource> rake;\n  rake->SetCenter(-0.74, 0, 0.3);\n  rake->SetNumberOfPoints(10);\n\n  // A line of seed points.\n  vtkNew<vtkStructuredGridGeometryFilter> seedsComp;\n  seedsComp->SetExtent(10, 10, 37, 39, 1, 35);\n  seedsComp->SetInputData(sg);\n\n  vtkNew<vtkStreamTracer> streamers;\n  streamers->SetInputConnection(pl3d->GetOutputPort());\n\n  //    streamers SetSource [rake GetOutput]\n  streamers->SetSourceConnection(seedsComp->GetOutputPort());\n  streamers->SetMaximumPropagation(250);\n  streamers->SetInitialIntegrationStep(.2);\n  streamers->SetMinimumIntegrationStep(.01);\n  streamers->SetIntegratorType(2);\n  streamers->Update();\n\n  vtkNew<vtkTubeFilter> tubes;\n  tubes->SetInputConnection(streamers->GetOutputPort());\n  tubes->SetNumberOfSides(8);\n  tubes->SetRadius(0.08);\n  tubes->SetVaryRadius(0);\n\n  vtkNew<vtkPolyDataMapper> mapTubes;\n\n  mapTubes->SetInputConnection(tubes->GetOutputPort());\n  mapTubes->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> tubesActor;\n  tubesActor->SetMapper(mapTubes);\n\n  // Outline\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n\n  // Create graphics stuff\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(floorActor);\n  ren1->AddActor(subFloorActor);\n  ren1->AddActor(subFloor2Actor);\n  ren1->AddActor(postActor);\n  ren1->AddActor(fanActor);\n  ren1->AddActor(tubesActor);\n\n  vtkNew<vtkCamera> aCam;\n  aCam->SetFocalPoint(0.00657892, 0, 2.41026);\n  aCam->SetPosition(-1.94838, -47.1275, 39.4607);\n  aCam->SetViewUp(0.00653193, 0.617865, 0.786257);\n  ren1->ResetCamera();\n  aCam->Dolly(1.);\n  aCam->SetClippingRange(1, 100);\n\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  ren1->SetActiveCamera(aCam);\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"LOxGrid\");\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/LOxGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LOxGrid)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LOxGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LOxGrid MACOSX_BUNDLE LOxGrid.cxx )\n  target_link_libraries(LOxGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LOxGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/LOxGrid/#download-and-build-loxgrid","title":"Download and Build LOxGrid","text":"

        Click here to download LOxGrid and its CMakeLists.txt file. Once the tarball LOxGrid.tar has been downloaded and extracted,

        cd LOxGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LOxGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/LOxSeeds/","title":"LOxSeeds","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/LOxSeeds

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/LOxSeeds/#description","title":"Description","text":"

        Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown.

        Info

        See Figure 12-15 in Chapter 12 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/LOxSeeds/#code","title":"Code","text":"

        LOxSeeds.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <string>\n\n//// LOx post CFD case study\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" postxyz.bin postq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Read the data.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->AutoDetectFormatOn();\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(153);\n  pl3d->SetVectorFunctionNumber(200);\n  pl3d->Update();\n\n  vtkStructuredGrid* sg =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Blue to red lut.\n  //\n  vtkNew<vtkLookupTable> lut;\n  lut->SetHueRange(0.667, 0.0);\n\n  std::vector<double*> seeds;\n  double seed1[3] = {-0.74, 0.0, 0.3};\n  double seed2[3] = {-0.74, 0.0, 1.0};\n  double seed3[3] = {-0.74, 0.0, 2.0};\n  double seed4[3] = {-0.74, 0.0, 3.0};\n  seeds.push_back(seed1);\n  seeds.push_back(seed2);\n  seeds.push_back(seed3);\n  seeds.push_back(seed4);\n\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n\n  for (size_t s = 0; s < seeds.size(); ++s)\n  {\n    // Computational planes.\n    vtkNew<vtkStructuredGridGeometryFilter> floorComp;\n    floorComp->SetExtent(0, 37, 0, 75, 0, 0);\n    floorComp->SetInputData(sg);\n    floorComp->Update();\n\n    vtkNew<vtkPolyDataMapper> floorMapper;\n    floorMapper->SetInputConnection(floorComp->GetOutputPort());\n    floorMapper->ScalarVisibilityOff();\n    floorMapper->SetLookupTable(lut);\n\n    vtkNew<vtkActor> floorActor;\n    floorActor->SetMapper(floorMapper);\n    floorActor->GetProperty()->SetRepresentationToWireframe();\n    floorActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n    floorActor->GetProperty()->SetLineWidth(2);\n\n    vtkNew<vtkStructuredGridGeometryFilter> postComp;\n    postComp->SetExtent(10, 10, 0, 75, 0, 37);\n    postComp->SetInputData(sg);\n\n    vtkNew<vtkPolyDataMapper> postMapper;\n    postMapper->SetInputConnection(postComp->GetOutputPort());\n    postMapper->SetLookupTable(lut);\n    postMapper->SetScalarRange(sg->GetScalarRange());\n    // postMapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> postActor;\n    postActor->SetMapper(postMapper);\n    // postActor->GetProperty()->SetRepresentationToWireframe();\n    postActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n    // streamers\n    //\n    // Spherical seed points.\n    vtkNew<vtkPointSource> rake;\n    rake->SetCenter(seeds[s]);\n    rake->SetNumberOfPoints(10);\n\n    vtkNew<vtkStreamTracer> streamers;\n    streamers->SetInputConnection(pl3d->GetOutputPort());\n\n    // streamers SetSource [rake GetOutput]\n    streamers->SetSourceConnection(rake->GetOutputPort());\n    streamers->SetMaximumPropagation(250);\n    streamers->SetInitialIntegrationStep(.2);\n    streamers->SetMinimumIntegrationStep(.01);\n    streamers->SetIntegratorType(2);\n    streamers->Update();\n\n    vtkNew<vtkTubeFilter> tubes;\n    tubes->SetInputConnection(streamers->GetOutputPort());\n    tubes->SetNumberOfSides(8);\n    tubes->SetRadius(0.08);\n    tubes->SetVaryRadius(0);\n\n    vtkNew<vtkPolyDataMapper> mapTubes;\n\n    mapTubes->SetInputConnection(tubes->GetOutputPort());\n    mapTubes->SetScalarRange(sg->GetScalarRange());\n\n    vtkNew<vtkActor> tubesActor;\n    tubesActor->SetMapper(mapTubes);\n\n    vtkNew<vtkRenderer> renderer;\n\n    renderer->AddActor(floorActor);\n    renderer->AddActor(postActor);\n    renderer->AddActor(tubesActor);\n    renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n    renderers.push_back(renderer);\n  }\n\n  vtkNew<vtkRenderWindow> renderWindow;\n\n  // Setup viewports for the renderers.\n  int rendererSize = 256;\n  unsigned int xGridDimensions = 2;\n  unsigned int yGridDimensions = 2;\n  renderWindow->SetSize(rendererSize * xGridDimensions,\n                        rendererSize * yGridDimensions);\n  for (int row = 0; row < static_cast<int>(yGridDimensions); row++)\n  {\n    for (int col = 0; col < static_cast<int>(xGridDimensions); col++)\n    {\n      int index = row * xGridDimensions + col;\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(0.918037, -0.0779233, 2.69513);\n  camera->SetPosition(0.840735, -23.6176, 8.50211);\n  camera->SetViewUp(0.00227904, 0.239501, 0.970893);\n  camera->SetClippingRange(1, 100);\n\n  renderers[0]->SetActiveCamera(camera);\n  for (size_t r = 0; r < renderers.size(); ++r)\n  {\n    renderWindow->AddRenderer(renderers[r]);\n    if (r > 0)\n    {\n      renderers[r]->SetActiveCamera(camera);\n    }\n  }\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderWindow->SetSize(512, 512);\n  renderWindow->SetWindowName(\"LOxSeeds\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/LOxSeeds/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LOxSeeds)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LOxSeeds: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LOxSeeds MACOSX_BUNDLE LOxSeeds.cxx )\n  target_link_libraries(LOxSeeds PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LOxSeeds\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/LOxSeeds/#download-and-build-loxseeds","title":"Download and Build LOxSeeds","text":"

        Click here to download LOxSeeds and its CMakeLists.txt file. Once the tarball LOxSeeds.tar has been downloaded and extracted,

        cd LOxSeeds/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LOxSeeds\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCases/","title":"MarchingCases","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/MarchingCases

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCases/#description","title":"Description","text":"

        This example will help you understand the Marching Cubes Algorithm. The example takes one optional argument, a case number. There are 15 Marching Cubes cases, 0-14. There are also 15 complementary cases where the inside/outside value is flipped. To see a complementary case, supply a negative case number. For example, -7 is the complementary case of 7.

        Note

        According to the ACM Digital Library, the Marching Cubes paper is the most cited Siggraph paper.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCases/#code","title":"Code","text":"

        MarchingCases.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkExtractEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVectorText.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\n#include <algorithm>\n#include <iostream>\n#include <iterator>\n#include <map>\n#include <sstream>\n\nnamespace {\nstd::string ProgramParameters(std::string const& programName);\n\nvoid case0(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case1(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case2(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case3(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case4(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case5(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case6(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case7(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case8(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case9(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case10(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case11(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case12(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case13(vtkFloatArray*, vtkVectorText*, int, int);\nvoid case14(vtkFloatArray*, vtkVectorText*, int, int);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  std::map<int, void (*)(vtkFloatArray*, vtkVectorText*, int, int)> cases;\n  cases[0] = &case0;\n  cases[1] = &case1;\n  cases[2] = &case2;\n  cases[3] = &case3;\n  cases[4] = &case4;\n  cases[5] = &case5;\n  cases[6] = &case6;\n  cases[7] = &case7;\n  cases[8] = &case8;\n  cases[9] = &case9;\n  cases[10] = &case10;\n  cases[11] = &case11;\n  cases[12] = &case12;\n  cases[13] = &case13;\n  cases[14] = &case14;\n\n  std::vector<int> mcCases;\n  auto mcCase = 7;\n  auto rotation = 0;\n  auto label = true;\n  if (argc > 1)\n  {\n    if (argc < 3)\n    {\n      std::cerr << ProgramParameters(argv[0]) << std::endl;\n      return EXIT_FAILURE;\n    }\n    auto numberOfCases = std::abs(atoi(argv[1]));\n    if (argc < numberOfCases + 2)\n    {\n      std::cerr << ProgramParameters(argv[0]) << std::endl;\n      return EXIT_FAILURE;\n    }\n    for (auto i = 0; i < numberOfCases; ++i)\n    {\n      mcCase = atoi(argv[i + 2]);\n      if (std::abs(mcCase) < 0 || std::abs(mcCase) > 14)\n      {\n        std::cerr << argv[0] << \" bad case number \" << mcCase << std::endl;\n        return EXIT_FAILURE;\n      }\n      mcCases.push_back(mcCase);\n    }\n    // Look for the optional parameters.\n    if (numberOfCases + 2 < argc)\n    {\n      // We have rotation.\n      rotation = std::abs(atoi(argv[numberOfCases + 2])) % 4;\n    }\n    if (numberOfCases + 3 < argc)\n    {\n      // We have a label option.\n      label = atoi(argv[numberOfCases + 3]) != 0;\n    }\n  }\n  else\n  {\n    mcCases.push_back(mcCase);\n  }\n\n  if (mcCases.size() == 1)\n  {\n    std::cout << \"Case: \" << mcCases[0] << std::endl;\n  }\n  else\n  {\n    if (!mcCases.empty())\n    {\n      std::ostringstream ss;\n      std::copy(mcCases.begin(), mcCases.end() - 1,\n                std::ostream_iterator<int>(ss, \", \"));\n      ss << mcCases.back();\n      std::cout << \"Cases: \" << ss.str() << std::endl;\n    }\n  }\n  std::cout << \"Rotated: \" << rotation * 90 << \" degrees.\" << std::endl;\n\n  vtkNew<vtkNamedColors> color;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(640, 480);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Always use a grid of four columns unless number of cases < 4.\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  int gridSize = ((static_cast<int>(mcCases.size()) + 3) / 4) * 4;\n  gridSize = static_cast<int>(mcCases.size()) < 4\n      ? static_cast<int>(mcCases.size())\n      : gridSize;\n  for (int i = 0; i < gridSize; ++i)\n  {\n    // Create the Renderer\n    vtkNew<vtkRenderer> renderer;\n    renderers.push_back(renderer);\n    // Set the background color.\n    renderers[i]->SetBackground(color->GetColor3d(\"slate_grey\").GetData());\n    renWin->AddRenderer(renderer);\n  }\n\n  for (size_t i = 0; i < mcCases.size(); ++i)\n  {\n    // Define a Single Cube\n    vtkNew<vtkFloatArray> Scalars;\n    Scalars->InsertNextValue(1.0);\n    Scalars->InsertNextValue(0.0);\n    Scalars->InsertNextValue(0.0);\n    Scalars->InsertNextValue(1.0);\n    Scalars->InsertNextValue(0.0);\n    Scalars->InsertNextValue(0.0);\n    Scalars->InsertNextValue(0.0);\n    Scalars->InsertNextValue(0.0);\n\n    vtkNew<vtkPoints> Points;\n    Points->InsertNextPoint(0, 0, 0);\n    Points->InsertNextPoint(1, 0, 0);\n    Points->InsertNextPoint(1, 1, 0);\n    Points->InsertNextPoint(0, 1, 0);\n    Points->InsertNextPoint(0, 0, 1);\n    Points->InsertNextPoint(1, 0, 1);\n    Points->InsertNextPoint(1, 1, 1);\n    Points->InsertNextPoint(0, 1, 1);\n\n    vtkNew<vtkIdList> Ids;\n    Ids->InsertNextId(0);\n    Ids->InsertNextId(1);\n    Ids->InsertNextId(2);\n    Ids->InsertNextId(3);\n    Ids->InsertNextId(4);\n    Ids->InsertNextId(5);\n    Ids->InsertNextId(6);\n    Ids->InsertNextId(7);\n\n    vtkNew<vtkUnstructuredGrid> Grid;\n    Grid->Allocate(10, 10);\n    Grid->InsertNextCell(12, Ids);\n    Grid->SetPoints(Points);\n    Grid->GetPointData()->SetScalars(Scalars);\n\n    // Find the triangles that lie along the 0.5 contour in this cube.\n    vtkNew<vtkContourFilter> Marching;\n    Marching->SetInputData(Grid);\n    Marching->SetValue(0, 0.5);\n    Marching->Update();\n\n    // Extract the edges of the triangles just found.\n    vtkNew<vtkExtractEdges> triangleEdges;\n    triangleEdges->SetInputConnection(Marching->GetOutputPort());\n\n    // Draw the edges as tubes instead of lines.  Also create the associated\n    // mapper and actor to display the tubes.\n    vtkNew<vtkTubeFilter> triangleEdgeTubes;\n    triangleEdgeTubes->SetInputConnection(triangleEdges->GetOutputPort());\n    triangleEdgeTubes->SetRadius(.005);\n    triangleEdgeTubes->SetNumberOfSides(6);\n    triangleEdgeTubes->UseDefaultNormalOn();\n    triangleEdgeTubes->SetDefaultNormal(.577, .577, .577);\n\n    vtkNew<vtkPolyDataMapper> triangleEdgeMapper;\n    triangleEdgeMapper->SetInputConnection(triangleEdgeTubes->GetOutputPort());\n    triangleEdgeMapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> triangleEdgeActor;\n    triangleEdgeActor->SetMapper(triangleEdgeMapper);\n    triangleEdgeActor->GetProperty()->SetDiffuseColor(\n        color->GetColor3d(\"lamp_black\").GetData());\n    triangleEdgeActor->GetProperty()->SetSpecular(.4);\n    triangleEdgeActor->GetProperty()->SetSpecularPower(10);\n\n    // Shrink the triangles we found earlier.  Create the associated mapper\n    // and actor.  Set the opacity of the shrunken triangles.\n    vtkNew<vtkShrinkPolyData> aShrinker;\n    aShrinker->SetShrinkFactor(1);\n    aShrinker->SetInputConnection(Marching->GetOutputPort());\n\n    vtkNew<vtkPolyDataMapper> aMapper;\n    aMapper->ScalarVisibilityOff();\n    aMapper->SetInputConnection(aShrinker->GetOutputPort());\n\n    vtkNew<vtkActor> Triangles;\n    Triangles->SetMapper(aMapper);\n    Triangles->GetProperty()->SetDiffuseColor(\n        color->GetColor3d(\"banana\").GetData());\n    Triangles->GetProperty()->SetOpacity(.6);\n\n    // Draw a cube the same size and at the same position as the one\n    // created previously.  Extract the edges because we only want to see\n    // the outline of the cube.  Pass the edges through a vtkTubeFilter so\n    // they are displayed as tubes rather than lines.\n    vtkNew<vtkCubeSource> CubeModel;\n    CubeModel->SetCenter(.5, .5, .5);\n\n    vtkNew<vtkExtractEdges> Edges;\n    Edges->SetInputConnection(CubeModel->GetOutputPort());\n\n    vtkNew<vtkTubeFilter> Tubes;\n    Tubes->SetInputConnection(Edges->GetOutputPort());\n    Tubes->SetRadius(.01);\n    Tubes->SetNumberOfSides(6);\n    Tubes->UseDefaultNormalOn();\n    Tubes->SetDefaultNormal(.577, .577, .577);\n    // Create the mapper and actor to display the cube edges.\n    vtkNew<vtkPolyDataMapper> TubeMapper;\n    TubeMapper->SetInputConnection(Tubes->GetOutputPort());\n    vtkNew<vtkActor> CubeEdges;\n    CubeEdges->SetMapper(TubeMapper);\n    CubeEdges->GetProperty()->SetDiffuseColor(\n        color->GetColor3d(\"khaki\").GetData());\n    CubeEdges->GetProperty()->SetSpecular(.4);\n    CubeEdges->GetProperty()->SetSpecularPower(10);\n\n    // Create a sphere to use as a glyph source for vtkGlyph3D.\n    vtkNew<vtkSphereSource> Sphere;\n    Sphere->SetRadius(0.04);\n    Sphere->SetPhiResolution(20);\n    Sphere->SetThetaResolution(20);\n    // Remove the part of the cube with data values below 0.5.\n    vtkNew<vtkThresholdPoints> ThresholdIn;\n    ThresholdIn->SetInputData(Grid);\n    ThresholdIn->ThresholdByUpper(.5);\n    // Display spheres at the vertices remaining in the cube data set after\n    // it was passed through vtkThresholdPoints.\n    vtkNew<vtkGlyph3D> Vertices;\n    Vertices->SetInputConnection(ThresholdIn->GetOutputPort());\n    Vertices->SetSourceConnection(Sphere->GetOutputPort());\n    // Create a mapper and actor to display the glyphs.\n    vtkNew<vtkPolyDataMapper> SphereMapper;\n    SphereMapper->SetInputConnection(Vertices->GetOutputPort());\n    SphereMapper->ScalarVisibilityOff();\n\n    vtkNew<vtkActor> CubeVertices;\n    CubeVertices->SetMapper(SphereMapper);\n    CubeVertices->GetProperty()->SetDiffuseColor(\n        color->GetColor3d(\"tomato\").GetData());\n\n    // Define the text for the label\n    vtkNew<vtkVectorText> caseLabel;\n    caseLabel->SetText(\"Case 1\");\n\n    vtkNew<vtkActor> labelActor;\n\n    if (label)\n    {\n      // Set up a transform to move the label to a new position.\n      vtkNew<vtkTransform> aLabelTransform;\n      aLabelTransform->Identity();\n      // Position the label according to the rotation of the figure.\n      switch (rotation)\n      {\n      case 0:\n      default:\n        aLabelTransform->Translate(-0.2, 0, 1.25);\n        aLabelTransform->Scale(.05, .05, .05);\n        break;\n      case 1:\n        aLabelTransform->RotateY(90);\n        aLabelTransform->Translate(-1.25, 0, 1.25);\n        aLabelTransform->Scale(.05, .05, .05);\n        break;\n      case 2:\n        aLabelTransform->RotateY(180);\n        aLabelTransform->Translate(-1.25, 0, 0.2);\n        aLabelTransform->Scale(.05, .05, .05);\n        break;\n      case 3:\n        aLabelTransform->RotateY(270);\n        aLabelTransform->Translate(-0.2, 0, 0.2);\n        aLabelTransform->Scale(.05, .05, .05);\n        break;\n      }\n\n      // Move the label to a new position.\n      vtkNew<vtkTransformPolyDataFilter> labelTransform;\n      labelTransform->SetTransform(aLabelTransform);\n      labelTransform->SetInputConnection(caseLabel->GetOutputPort());\n\n      // Create a mapper and actor to display the text.\n      vtkNew<vtkPolyDataMapper> labelMapper;\n      labelMapper->SetInputConnection(labelTransform->GetOutputPort());\n\n      labelActor->SetMapper(labelMapper);\n    }\n    // Define the base that the cube sits on.  Create its associated mapper\n    // and actor.  Set the position of the actor.\n    vtkNew<vtkCubeSource> baseModel;\n    baseModel->SetXLength(1.5);\n    baseModel->SetYLength(.01);\n    baseModel->SetZLength(1.5);\n\n    vtkNew<vtkPolyDataMapper> baseMapper;\n    baseMapper->SetInputConnection(baseModel->GetOutputPort());\n\n    vtkNew<vtkActor> base;\n    base->SetMapper(baseMapper);\n    base->SetPosition(.5, -0.09, .5);\n\n    // Set the scalar values for this case of marching cubes.\n    // A negative case number will generate a complementary case\n    mcCase = mcCases[i];\n    if (mcCase < 0)\n    {\n      cases[-mcCase](Scalars, caseLabel, 0, 1);\n    }\n    else\n    {\n      cases[mcCase](Scalars, caseLabel, 1, 0);\n    }\n    // Force the grid to update.\n    Grid->Modified();\n\n    // Add the actors to the renderer\n    renderers[i]->AddActor(triangleEdgeActor);\n    renderers[i]->AddActor(base);\n    if (label)\n    {\n      renderers[i]->AddActor(labelActor);\n    }\n    renderers[i]->AddActor(CubeEdges);\n    renderers[i]->AddActor(CubeVertices);\n    renderers[i]->AddActor(Triangles);\n\n    // Position the camera.\n    renderers[i]->GetActiveCamera()->Dolly(1.2);\n    // Rotate the camera an extra 30 degrees so the cube is not face on.\n    switch (rotation)\n    {\n    case 0:\n    default:\n      renderers[i]->GetActiveCamera()->Azimuth(30);\n      break;\n    case 1:\n      renderers[i]->GetActiveCamera()->Azimuth(30 + 90);\n      break;\n    case 2:\n      renderers[i]->GetActiveCamera()->Azimuth(30 + 180);\n      break;\n    case 3:\n      renderers[i]->GetActiveCamera()->Azimuth(30 + 270);\n      break;\n    }\n    renderers[i]->GetActiveCamera()->Elevation(20);\n    renderers[i]->ResetCamera();\n    renderers[i]->ResetCameraClippingRange();\n    if (i > 0)\n    {\n      renderers[i]->SetActiveCamera(renderers[0]->GetActiveCamera());\n    }\n  }\n  // Setup viewports for the renderers\n  int rendererSize = 300;\n  int xGridDimensions = static_cast<int>(mcCases.size()) < 4\n      ? static_cast<int>(mcCases.size())\n      : 4;\n  int yGridDimensions = (static_cast<int>(mcCases.size()) - 1) / 4 + 1;\n  std::cout << \"Grid dimensions: (x, y): (\" << xGridDimensions << \", \"\n            << yGridDimensions << \")\" << std::endl;\n  renWin->SetSize(rendererSize * xGridDimensions,\n                  rendererSize * yGridDimensions);\n  renWin->SetWindowName(\"MarchingCases\");\n\n  for (int row = 0; row < yGridDimensions; row++)\n  {\n    for (int col = 0; col < xGridDimensions; col++)\n    {\n      int index = row * xGridDimensions + col;\n\n      // (xmin, ymin, xmax, ymax)\n      double viewport[4] = {\n          static_cast<double>(col) / xGridDimensions,\n          static_cast<double>(yGridDimensions - (row + 1)) / yGridDimensions,\n          static_cast<double>(col + 1) / xGridDimensions,\n          static_cast<double>(yGridDimensions - row) / yGridDimensions};\n      renderers[index]->SetViewport(viewport);\n    }\n  }\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nstd::string ProgramParameters(std::string const& programName)\n{\n  std::string ret =\n      \"Usage: \" + programName + \" [n [cases [cases ...]] [rotation] [label]\\n\";\n  ret += \"\\nMarching cubes cases for 3D isosurface generation.\\n\";\n  ret += \"arguments:\\n\";\n  ret += \"n         The number of cases\\n\";\n  ret += \"cases     A list of integers i such that 0 <= i < 14\\n\";\n  ret += \"            corresponding to the cases desired.\\n\";\n  ret += \"rotation  Rotate camera around the cube, for i such that 0 <= abs(i) \"\n         \"< 4,\\n\";\n  ret += \"            corresponding to 0, 90, 180, 270 degrees. Default = 0\\n\";\n  ret += \"label     Display a label entering 0 corresponds to false any other \"\n         \"number is true.\\n\";\n  ret += \"            Default is  true, 0 == false.\\n\";\n  ret += \"\\nExample parameter lists:\\n\";\n  ret +=\n      \"\\n3 1 7 12 3 0 Display three cubes: 7, 12, 3 rotated by 270 degrees\\n\";\n  ret += \"               around the y-axis with no labels.\\n\";\n  ret += \"1 7         Display one cube: 7, no rotation with a label.\\n\";\n  ret += \"1 7 0 0     Display one cube: 7, no rotation, no label.\\n\";\n\n  return ret;\n}\n\nvoid case0(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 0 - 00000000\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 0 - 11111111\");\n  }\n}\n\nvoid case1(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 1 - 00000001\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 1c - 11111110\");\n  }\n}\n\nvoid case2(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 2 - 00000011\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 2c - 11111100\");\n  }\n}\n\nvoid case3(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, IN);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 3 - 00000101\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 3c - 11111010\");\n  }\n}\n\nvoid case4(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 4 - 01000001\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 4c - 10111110\");\n  }\n}\n\nvoid case5(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 5 - 00110010\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 5c - 11001101\");\n  }\n}\n\nvoid case6(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 6 - 00011010\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 6c - 11100101\");\n  }\n}\n\nvoid case7(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 7 - 01000011\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 7c - 10111100\");\n  }\n}\n\nvoid case8(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 8 - 00110011\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 8c - 11001100\");\n  }\n}\n\nvoid case9(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, IN);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 9 - 01001110\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 9c - 10110001\");\n  }\n}\nvoid case10(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 10 - 01101001\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 10c - 10010110\");\n  }\n}\n\nvoid case11(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, OUT);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 11 - 01110001\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 11c - 10001110\");\n  }\n}\n\nvoid case12(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, OUT);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 12 - 00111010\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 12c - 11000101\");\n  }\n}\n\nvoid case13(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, OUT);\n  scalars->InsertValue(1, IN);\n  scalars->InsertValue(2, OUT);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, IN);\n  scalars->InsertValue(5, OUT);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, OUT);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 13 - 01011010\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 13c - 10100101\");\n  }\n}\n\nvoid case14(vtkFloatArray* scalars, vtkVectorText* caseLabel, int IN, int OUT)\n{\n  scalars->InsertValue(0, IN);\n  scalars->InsertValue(1, OUT);\n  scalars->InsertValue(2, IN);\n  scalars->InsertValue(3, IN);\n  scalars->InsertValue(4, OUT);\n  scalars->InsertValue(5, IN);\n  scalars->InsertValue(6, IN);\n  scalars->InsertValue(7, IN);\n  if (IN == 1)\n  {\n    caseLabel->SetText(\"Case 14 - 11101101\");\n  }\n  else\n  {\n    caseLabel->SetText(\"Case 14c - 00010010\");\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCases/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCases)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCases: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCases MACOSX_BUNDLE MarchingCases.cxx )\n  target_link_libraries(MarchingCases PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCases\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCases/#download-and-build-marchingcases","title":"Download and Build MarchingCases","text":"

        Click here to download MarchingCases and its CMakeLists.txt file. Once the tarball MarchingCases.tar has been downloaded and extracted,

        cd MarchingCases/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MarchingCases\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesA/","title":"MarchingCasesA","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/MarchingCasesA

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesA/#description","title":"Description","text":"

        Marching cubes cases for 3D isosurface generation. The 256 possible cases have been reduced to 15 cases using symmetry. Red vertices are greater than the selected isosurface value.

        This example runs the example MarchingCases with the arguments 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14.

        Info

        See Figure 6-6 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesA/#code","title":"Code","text":"

        MarchingCasesA.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkExtractEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVectorText.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\n#include \"MarchingCases.cxx\"\n
        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesA/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCasesA)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCasesA: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCasesA MACOSX_BUNDLE MarchingCasesA.cxx )\n  target_link_libraries(MarchingCasesA PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCasesA\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesA/#download-and-build-marchingcasesa","title":"Download and Build MarchingCasesA","text":"

        Click here to download MarchingCasesA and its CMakeLists.txt file. Once the tarball MarchingCasesA.tar has been downloaded and extracted,

        cd MarchingCasesA/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MarchingCasesA\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesB/","title":"MarchingCasesB","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/MarchingCasesB

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesB/#description","title":"Description","text":"

        Marching cubes complementary cases.

        The example runs the example MarchingCases with the arguments 6 -3 -6 -7 -10 -12 -13

        Cases 3c, 6c, 7c, 10c, 12c and 13c are displayed.

        Info

        See Figure 6-10 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesB/#code","title":"Code","text":"

        MarchingCasesB.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkExtractEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVectorText.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\n#include \"MarchingCases.cxx\"\n
        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesB/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCasesB)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCasesB: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCasesB MACOSX_BUNDLE MarchingCasesB.cxx )\n  target_link_libraries(MarchingCasesB PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCasesB\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesB/#download-and-build-marchingcasesb","title":"Download and Build MarchingCasesB","text":"

        Click here to download MarchingCasesB and its CMakeLists.txt file. Once the tarball MarchingCasesB.tar has been downloaded and extracted,

        cd MarchingCasesB/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MarchingCasesB\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesC/","title":"MarchingCasesC","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/MarchingCasesC

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesC/#description","title":"Description","text":"

        Marching cubes cases.

        The example runs the example MarchingCases with the argument 1 3 1 0

        Case 3 is rotated 90 degrees about the y-axis with no label.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesC/#code","title":"Code","text":"

        MarchingCasesC.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkExtractEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVectorText.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\n#include \"MarchingCases.cxx\"\n
        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesC/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCasesC)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCasesC: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCasesC MACOSX_BUNDLE MarchingCasesC.cxx )\n  target_link_libraries(MarchingCasesC PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCasesC\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesC/#download-and-build-marchingcasesc","title":"Download and Build MarchingCasesC","text":"

        Click here to download MarchingCasesC and its CMakeLists.txt file. Once the tarball MarchingCasesC.tar has been downloaded and extracted,

        cd MarchingCasesC/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MarchingCasesC\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesD/","title":"MarchingCasesD","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/MarchingCasesD

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesD/#description","title":"Description","text":"

        Marching cubes cases.

        The example runs the example MarchingCases with the argument 1 7 2 0

        Case 7 is rotated 180 degrees about the y-axis with no label.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesD/#code","title":"Code","text":"

        MarchingCasesD.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCubeSource.h>\n#include <vtkExtractEdges.h>\n#include <vtkFloatArray.h>\n#include <vtkGlyph3D.h>\n#include <vtkIdList.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkShrinkPolyData.h>\n#include <vtkSphereSource.h>\n#include <vtkThresholdPoints.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkVectorText.h>\n\n// Note that:\n// vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n// VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\n\n#include \"MarchingCases.cxx\"\n
        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesD/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MarchingCasesD)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MarchingCasesD: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MarchingCasesD MACOSX_BUNDLE MarchingCasesD.cxx )\n  target_link_libraries(MarchingCasesD PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MarchingCasesD\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/MarchingCasesD/#download-and-build-marchingcasesd","title":"Download and Build MarchingCasesD","text":"

        Click here to download MarchingCasesD and its CMakeLists.txt file. Once the tarball MarchingCasesD.tar has been downloaded and extracted,

        cd MarchingCasesD/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MarchingCasesD\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/Motor/","title":"Motor","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/Motor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/Motor/#description","title":"Description","text":"

        This is an example of texture clipping using a transparent texture map. The motor shown consists of five complex parts, some of which are hidden by the outer casing. To see the inside of the motor, we define an implicit clipping function. This function is simply the intersection of two planes to form a clipping \"corner\". The object vtkImplicitTextureCoords is used in combination with this implicit function to generate texture coordinates. These objects are then rendered with the appropriate texture map and the internal parts of the motor can be seen.

        The texture map consists of three regions (as described previously in the chapter). The concealed region is transparent. The transition region is opaque but with a black (zero intensity) color. The highlighted region is full intensity and opaque. As can be seen from the result , the boundaries appear as black borders giving a nice visual effect.

        Note the use of vectors in the C++ version and lists in the Python version to reduce repetitious code.

        Info

        See Figure 9-53 in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/Motor/#code","title":"Code","text":"

        Motor.cxx

        /*\nThis code is based on the VTK file: /IO/Geometry/Testing/Python/motor.py.\n*/\n\n#include <vtkActor.h>\n#include <vtkBYUReader.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkFloatArray.h>\n#include <vtkImplicitTextureCoords.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlanes.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkTexture.h>\n\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" textureFile motorFile\" << std::endl;\n    std::cout << \"where: textureFile is the texture file: texThres2.vtk.\"\n              << std::endl;\n    std::cout << \"       motorFile is ihe motor file: motor.g.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string textureFile = argv[1];\n  std::string motorFile = argv[2];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the Renderer, RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the cutting planes.\n  vtkNew<vtkPlanes> planes;\n  vtkNew<vtkPoints> points;\n  vtkNew<vtkFloatArray> norms;\n\n  norms->SetNumberOfComponents(3);\n  points->InsertPoint(0, 0.0, 0.0, 0.0);\n  norms->InsertTuple3(0, 0.0, 0.0, 1.0);\n  points->InsertPoint(1, 0.0, 0.0, 0.0);\n  norms->InsertTuple3(1, -1.0, 0.0, 0.0);\n  planes->SetPoints(points);\n  planes->SetNormals(norms);\n\n  // Get the texture.\n  vtkNew<vtkStructuredPointsReader> texReader;\n  texReader->SetFileName(textureFile.c_str());\n  vtkNew<vtkTexture> texture;\n  texture->SetInputConnection(texReader->GetOutputPort());\n  texture->InterpolateOff();\n  texture->RepeatOff();\n\n  // Set up the pipelines for the parts of the motor.\n  // We will use lists of pipeline objects.\n  auto numberOfParts = 5;\n  std::vector<vtkSmartPointer<vtkBYUReader>> byu;\n  std::vector<vtkSmartPointer<vtkPolyDataNormals>> normals;\n  std::vector<vtkSmartPointer<vtkImplicitTextureCoords>> tex;\n  std::vector<vtkSmartPointer<vtkDataSetMapper>> byuMapper;\n  std::vector<vtkSmartPointer<vtkActor>> byuActor;\n  std::vector<std::string> partColours{\"cold_grey\", \"peacock\", \"raw_sienna\",\n                                       \"banana\", \"peach_puff\"};\n  // Use this to control which parts to display.\n  std::vector<bool> displayParts(numberOfParts, true);\n  // If displayParts[2] = false; then an image like that in the VTK tests is\n  // produced.\n\n  for (auto i = 0; i < numberOfParts; ++i)\n  {\n    byu.push_back(vtkSmartPointer<vtkBYUReader>::New());\n    byu[i]->SetGeometryFileName(motorFile.c_str());\n    byu[i]->SetPartNumber(i + 1);\n\n    normals.push_back(vtkSmartPointer<vtkPolyDataNormals>::New());\n    normals[i]->SetInputConnection(byu[i]->GetOutputPort());\n\n    tex.push_back(vtkSmartPointer<vtkImplicitTextureCoords>::New());\n    tex[i]->SetInputConnection(normals[i]->GetOutputPort());\n    tex[i]->SetRFunction(planes);\n    // tex[i]->FlipTextureOn();\n\n    byuMapper.push_back(vtkSmartPointer<vtkDataSetMapper>::New());\n    byuMapper[i]->SetInputConnection(tex[i]->GetOutputPort());\n\n    byuActor.push_back(vtkSmartPointer<vtkActor>::New());\n    byuActor[i]->SetMapper(byuMapper[i]);\n    byuActor[i]->SetTexture(texture);\n    byuActor[i]->GetProperty()->SetColor(\n        colors->GetColor3d(partColours[i]).GetData());\n\n    ren->AddActor(byuActor[i]);\n    if (displayParts[i])\n    {\n      byuActor[i]->VisibilityOn();\n    }\n    else\n    {\n      byuActor[i]->VisibilityOff();\n    }\n  }\n\n  ren->SetBackground(colors->GetColor3d(\"AliceBlue\").GetData());\n\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"Motor\");\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(0.0286334, 0.0362996, 0.0379685);\n  camera->SetPosition(1.37067, 1.08629, -1.30349);\n  camera->SetViewAngle(17.673);\n  camera->SetClippingRange(1, 10);\n  camera->SetViewUp(-0.376306, -0.5085, -0.774482);\n  ren->SetActiveCamera(camera);\n\n  // Render the image.\n  renWin->Render();\n  iren->Initialize();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/Motor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Motor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersTexture\n  IOGeometry\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Motor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Motor MACOSX_BUNDLE Motor.cxx )\n  target_link_libraries(Motor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Motor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/Motor/#download-and-build-motor","title":"Download and Build Motor","text":"

        Click here to download Motor and its CMakeLists.txt file. Once the tarball Motor.tar has been downloaded and extracted,

        cd Motor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Motor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/Office/","title":"Office","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/Office

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/Office/#description","title":"Description","text":"

        Using random point seeds to create streamlines.

        This example demonstrates the use of vtkPointSource to generate streamlines. The dataset is a structured grid representation of a CFD simulation of flow in a small office with flow velocity and a scalar pressure field. As this picture shows, there are a couple of bookcases, desks, a window, and an inlet and outlet for the ventilation system. On one of the desks is a small, intense heat source (e.g., a cigarette).

        We generate 25 streamlines that are started near the inlet using a vtkPointSource point generator. By adjusting a single parameter (e.g., the center of the point source) it is possible to quickly explore our simulation data.

        This program provides you with an optional parameter to select from one of several point source centers. The figure was created using:

        ./Office office.vtk 3\n

        Info

        See Figure 9-47 in Chapter 9 in the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/Office/#code","title":"Code","text":"

        Office.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredGridReader.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n#include <vector>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" filename [center] e.g. office.binary.vtk 3\" << std::endl;\n    std::cout\n        << \"Demonstrate the use of vtkPointSource to generate streamlines.\"\n        << std::endl;\n    std::cout << \"Where: \" << std::endl;\n    std::cout << \"       filename: office.binary.vtk\" << std::endl;\n    std::cout << \"       center: An optional parameter choosing the center for \"\n                 \"the seeds.\"\n              << std::endl;\n    std::cout\n        << \"               0 - Corresponds to Fig 9-47(a) in the VTK textbook.\"\n        << std::endl;\n    std::cout << \"               1 - A slight shift to the left.\" << std::endl;\n    std::cout << \"               2 - A slight shift to the upper left. (from \"\n                 \"the Original code).\"\n              << std::endl;\n    std::cout\n        << \"               3 - The default, a slight shift to the upper left.\"\n        << std::endl;\n    std::cout << \"                   Roughly corresponds to Fig 9-47(b) in the \"\n                 \"VTK textbook.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  auto center = 3;\n  if (argc > 2)\n  {\n    center = std::abs(atoi(argv[2]));\n  }\n  // These are the centers for the streamline seed.\n  std::vector<std::array<double, 3>> seedCenters{\n      {0.0, 2.1, 0.5}, {0.1, 2.1, 0.5}, {0.1, 2.7, 0.5}, {0.08, 2.7, 0.5}};\n  center = (center < static_cast<int>(seedCenters.size()))\n      ? center\n      : static_cast<int>(seedCenters.size()) - 1;\n\n  vtkNew<vtkNamedColors> colors;\n  std::array<double, 3> tableTopColor = {0.59, 0.427, 0.392};\n  std::array<double, 3> filingCabinetColor = {0.8, 0.8, 0.6};\n  std::array<double, 3> bookShelfColor = {0.8, 0.8, 0.6};\n  std::array<double, 3> windowColor = {0.3, 0.3, 0.5};\n  colors->SetColor(\"TableTop\", tableTopColor.data());\n  colors->SetColor(\"FilingCabinet\", filingCabinetColor.data());\n  colors->SetColor(\"BookShelf\", bookShelfColor.data());\n  colors->SetColor(\"Window\", windowColor.data());\n\n  // We read a data file that represents a CFD analysis of airflow in an office\n  // (with ventilation and a burning cigarette).\n  vtkNew<vtkStructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Create the scene.\n  // We generate a whole bunch of planes which correspond to\n  // the geometry in the analysis; tables, bookshelves and so on.\n  vtkNew<vtkStructuredGridGeometryFilter> table1;\n  table1->SetInputConnection(reader->GetOutputPort());\n  table1->SetExtent(11, 15, 7, 9, 8, 8);\n  vtkNew<vtkPolyDataMapper> mapTable1;\n  mapTable1->SetInputConnection(table1->GetOutputPort());\n  mapTable1->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> table1Actor;\n  table1Actor->SetMapper(mapTable1);\n  table1Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"TableTop\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> table2;\n  table2->SetInputConnection(reader->GetOutputPort());\n  table2->SetExtent(11, 15, 10, 12, 8, 8);\n  vtkNew<vtkPolyDataMapper> mapTable2;\n  mapTable2->SetInputConnection(table2->GetOutputPort());\n  mapTable2->ScalarVisibilityOff();\n  vtkNew<vtkActor> table2Actor;\n  table2Actor->SetMapper(mapTable2);\n  table2Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"TableTop\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> FilingCabinet1;\n  FilingCabinet1->SetInputConnection(reader->GetOutputPort());\n  FilingCabinet1->SetExtent(15, 15, 7, 9, 0, 8);\n  vtkNew<vtkPolyDataMapper> mapFilingCabinet1;\n  mapFilingCabinet1->SetInputConnection(FilingCabinet1->GetOutputPort());\n  mapFilingCabinet1->ScalarVisibilityOff();\n  vtkNew<vtkActor> FilingCabinet1Actor;\n  FilingCabinet1Actor->SetMapper(mapFilingCabinet1);\n  FilingCabinet1Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"FilingCabinet\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> FilingCabinet2;\n  FilingCabinet2->SetInputConnection(reader->GetOutputPort());\n  FilingCabinet2->SetExtent(15, 15, 10, 12, 0, 8);\n  vtkNew<vtkPolyDataMapper> mapFilingCabinet2;\n  mapFilingCabinet2->SetInputConnection(FilingCabinet2->GetOutputPort());\n  mapFilingCabinet2->ScalarVisibilityOff();\n  vtkNew<vtkActor> FilingCabinet2Actor;\n  FilingCabinet2Actor->SetMapper(mapFilingCabinet2);\n  FilingCabinet2Actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"FilingCabinet\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Top;\n  bookshelf1Top->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Top->SetExtent(13, 13, 0, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Top;\n\n  mapBookshelf1Top->SetInputConnection(bookshelf1Top->GetOutputPort());\n  mapBookshelf1Top->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1TopActor;\n  bookshelf1TopActor->SetMapper(mapBookshelf1Top);\n  bookshelf1TopActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Bottom;\n  bookshelf1Bottom->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Bottom->SetExtent(20, 20, 0, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Bottom;\n  mapBookshelf1Bottom->SetInputConnection(bookshelf1Bottom->GetOutputPort());\n  mapBookshelf1Bottom->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1BottomActor;\n  bookshelf1BottomActor->SetMapper(mapBookshelf1Bottom);\n  bookshelf1BottomActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Front;\n  bookshelf1Front->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Front->SetExtent(13, 20, 0, 0, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Front;\n  mapBookshelf1Front->SetInputConnection(bookshelf1Front->GetOutputPort());\n  mapBookshelf1Front->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1FrontActor;\n  bookshelf1FrontActor->SetMapper(mapBookshelf1Front);\n  bookshelf1FrontActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Back;\n  bookshelf1Back->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Back->SetExtent(13, 20, 4, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Back;\n  mapBookshelf1Back->SetInputConnection(bookshelf1Back->GetOutputPort());\n  mapBookshelf1Back->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1BackActor;\n  bookshelf1BackActor->SetMapper(mapBookshelf1Back);\n  bookshelf1BackActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1LHS;\n  bookshelf1LHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf1LHS->SetExtent(13, 20, 0, 4, 0, 0);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1LHS;\n  mapBookshelf1LHS->SetInputConnection(bookshelf1LHS->GetOutputPort());\n  mapBookshelf1LHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1LHSActor;\n  bookshelf1LHSActor->SetMapper(mapBookshelf1LHS);\n  bookshelf1LHSActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1RHS;\n  bookshelf1RHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf1RHS->SetExtent(13, 20, 0, 4, 11, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1RHS;\n  mapBookshelf1RHS->SetInputConnection(bookshelf1RHS->GetOutputPort());\n  mapBookshelf1RHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1RHSActor;\n  bookshelf1RHSActor->SetMapper(mapBookshelf1RHS);\n  bookshelf1RHSActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Top;\n  bookshelf2Top->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Top->SetExtent(13, 13, 15, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Top;\n  mapBookshelf2Top->SetInputConnection(bookshelf2Top->GetOutputPort());\n  mapBookshelf2Top->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2TopActor;\n  bookshelf2TopActor->SetMapper(mapBookshelf2Top);\n  bookshelf2TopActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Bottom;\n  bookshelf2Bottom->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Bottom->SetExtent(20, 20, 15, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Bottom;\n  mapBookshelf2Bottom->SetInputConnection(bookshelf2Bottom->GetOutputPort());\n  mapBookshelf2Bottom->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2BottomActor;\n  bookshelf2BottomActor->SetMapper(mapBookshelf2Bottom);\n  bookshelf2BottomActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Front;\n  bookshelf2Front->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Front->SetExtent(13, 20, 15, 15, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Front;\n  mapBookshelf2Front->SetInputConnection(bookshelf2Front->GetOutputPort());\n  mapBookshelf2Front->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2FrontActor;\n\n  bookshelf2FrontActor->SetMapper(mapBookshelf2Front);\n  bookshelf2FrontActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Back;\n  bookshelf2Back->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Back->SetExtent(13, 20, 19, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Back;\n  mapBookshelf2Back->SetInputConnection(bookshelf2Back->GetOutputPort());\n  mapBookshelf2Back->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2BackActor;\n  bookshelf2BackActor->SetMapper(mapBookshelf2Back);\n  bookshelf2BackActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2LHS;\n\n  bookshelf2LHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf2LHS->SetExtent(13, 20, 15, 19, 0, 0);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2LHS;\n  mapBookshelf2LHS->SetInputConnection(bookshelf2LHS->GetOutputPort());\n  mapBookshelf2LHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2LHSActor;\n  bookshelf2LHSActor->SetMapper(mapBookshelf2LHS);\n  bookshelf2LHSActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2RHS;\n  bookshelf2RHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf2RHS->SetExtent(13, 20, 15, 19, 11, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2RHS;\n  mapBookshelf2RHS->SetInputConnection(bookshelf2RHS->GetOutputPort());\n  mapBookshelf2RHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2RHSActor;\n  bookshelf2RHSActor->SetMapper(mapBookshelf2RHS);\n  bookshelf2RHSActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"BookShelf\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> window;\n  window->SetInputConnection(reader->GetOutputPort());\n  window->SetExtent(20, 20, 6, 13, 10, 13);\n  vtkNew<vtkPolyDataMapper> mapWindow;\n\n  mapWindow->SetInputConnection(window->GetOutputPort());\n  mapWindow->ScalarVisibilityOff();\n  vtkNew<vtkActor> windowActor;\n  windowActor->SetMapper(mapWindow);\n  windowActor->GetProperty()->SetColor(colors->GetColor3d(\"Window\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> outlet;\n  outlet->SetInputConnection(reader->GetOutputPort());\n  outlet->SetExtent(0, 0, 9, 10, 14, 16);\n  vtkNew<vtkPolyDataMapper> mapOutlet;\n  mapOutlet->SetInputConnection(outlet->GetOutputPort());\n  mapOutlet->ScalarVisibilityOff();\n  vtkNew<vtkActor> outletActor;\n  outletActor->SetMapper(mapOutlet);\n  outletActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"lamp_black\").GetData());\n\n  vtkNew<vtkStructuredGridGeometryFilter> inlet;\n  inlet->SetInputConnection(reader->GetOutputPort());\n  inlet->SetExtent(0, 0, 9, 10, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapInlet;\n  mapInlet->SetInputConnection(inlet->GetOutputPort());\n  mapInlet->ScalarVisibilityOff();\n  vtkNew<vtkActor> inletActor;\n  inletActor->SetMapper(mapInlet);\n  inletActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"lamp_black\").GetData());\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(mapOutline);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the source for the streamtubes.\n  vtkNew<vtkPointSource> seeds;\n  seeds->SetRadius(0.075);\n  seeds->SetCenter(seedCenters[center].data());\n  seeds->SetNumberOfPoints(25);\n  vtkNew<vtkStreamTracer> streamers;\n  streamers->SetInputConnection(reader->GetOutputPort());\n  streamers->SetSourceConnection(seeds->GetOutputPort());\n  streamers->SetMaximumPropagation(500);\n  streamers->SetMinimumIntegrationStep(0.1);\n  streamers->SetMaximumIntegrationStep(1.0);\n  streamers->SetInitialIntegrationStep(0.2);\n  streamers->SetIntegratorType(2);\n  streamers->Update();\n  vtkNew<vtkPolyDataMapper> mapStreamers;\n  mapStreamers->SetInputConnection(streamers->GetOutputPort());\n  mapStreamers->SetScalarRange(\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange());\n  vtkNew<vtkActor> streamersActor;\n  streamersActor->SetMapper(mapStreamers);\n\n  // Now create the usual graphics stuff.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(table1Actor);\n  renderer->AddActor(table2Actor);\n  renderer->AddActor(FilingCabinet1Actor);\n  renderer->AddActor(FilingCabinet2Actor);\n  renderer->AddActor(bookshelf1TopActor);\n  renderer->AddActor(bookshelf1BottomActor);\n  renderer->AddActor(bookshelf1FrontActor);\n  renderer->AddActor(bookshelf1BackActor);\n  renderer->AddActor(bookshelf1LHSActor);\n  renderer->AddActor(bookshelf1RHSActor);\n  renderer->AddActor(bookshelf2TopActor);\n  renderer->AddActor(bookshelf2BottomActor);\n  renderer->AddActor(bookshelf2FrontActor);\n  renderer->AddActor(bookshelf2BackActor);\n  renderer->AddActor(bookshelf2LHSActor);\n  renderer->AddActor(bookshelf2RHSActor);\n  renderer->AddActor(windowActor);\n  renderer->AddActor(outletActor);\n  renderer->AddActor(inletActor);\n  renderer->AddActor(outlineActor);\n  renderer->AddActor(streamersActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Here we specify a particular view.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetClippingRange(0.726079, 36.3039);\n  aCamera->SetFocalPoint(2.43584, 2.15046, 1.11104);\n  aCamera->SetPosition(-4.76183, -10.4426, 3.17203);\n  aCamera->SetViewUp(0.0511273, 0.132773, 0.989827);\n  aCamera->SetViewAngle(18.604);\n  aCamera->Zoom(1.2);\n\n  renderer->SetActiveCamera(aCamera);\n\n  renderWindow->SetSize(640, 400);\n  renderWindow->SetWindowName(\"Office\");\n\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/Office/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Office)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Office: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Office MACOSX_BUNDLE Office.cxx )\n  target_link_libraries(Office PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Office\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/Office/#download-and-build-office","title":"Download and Build Office","text":"

        Click here to download Office and its CMakeLists.txt file. Once the tarball Office.tar has been downloaded and extracted,

        cd Office/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Office\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/OfficeA/","title":"OfficeA","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/OfficeA

        "},{"location":"Cxx/VisualizationAlgorithms/OfficeA/#description","title":"Description","text":"

        This example runs Office.cxx as follows:

          ./OfficeA office.binary.vtk 0\n

        Info

        See Figure 9-47 in Chapter 9 in the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/OfficeA/#code","title":"Code","text":"

        OfficeA.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredGridReader.h>\n\n#include \"Office.cxx\"\n
        "},{"location":"Cxx/VisualizationAlgorithms/OfficeA/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OfficeA)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OfficeA: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OfficeA MACOSX_BUNDLE OfficeA.cxx )\n  target_link_libraries(OfficeA PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OfficeA\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/OfficeA/#download-and-build-officea","title":"Download and Build OfficeA","text":"

        Click here to download OfficeA and its CMakeLists.txt file. Once the tarball OfficeA.tar has been downloaded and extracted,

        cd OfficeA/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OfficeA\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/OfficeTube/","title":"OfficeTube","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/OfficeTube

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/OfficeTube/#description","title":"Description","text":"

        The stream polygon. (a) Planar view. (b) Aligned with vector. (c) Aligned along streamline. (d) Sweeping polygon to form tube.

        Info

        See Figure 9-12 in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/OfficeTube/#code","title":"Code","text":"

        OfficeTube.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRungeKutta4.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredGridReader.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" office.binary.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // We read a data file the is a CFD analysis of airflow in an office (with\n  // ventilation and a burning cigarette). We force an update so that we\n  // can query the output for its length, i.e., the length of the diagonal\n  // of the bounding box. This is useful for normalizing the data.\n  //\n  vtkNew<vtkStructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update(); // force a read to occur\n\n  // Now we will generate a single streamline in the data. We select the\n  // integration order to use (RungeKutta order 4) and associate it with\n  // the streamer. The start position is the position in world space where\n  // we want to begin streamline integration; and we integrate in both\n  // directions. The step length is the length of the line segments that\n  // make up the streamline (i.e., related to display). The\n  // IntegrationStepLength specifies the integration step length as a\n  // fraction of the cell size that the streamline is in.\n  vtkNew<vtkRungeKutta4> integ;\n\n  vtkNew<vtkStreamTracer> streamer;\n  streamer->SetInputConnection(reader->GetOutputPort());\n  streamer->SetStartPosition(0.1, 2.1, 0.5);\n  streamer->SetMaximumPropagation(500);\n  streamer->SetInitialIntegrationStep(0.05);\n  streamer->SetIntegrationDirectionToBoth();\n  streamer->SetIntegrator(integ);\n\n  // The tube is wrapped around the generated streamline. By varying the radius\n  // by the inverse of vector magnitude, we are creating a tube whose radius is\n  // proportional to mass flux (in incompressible flow).\n  vtkNew<vtkTubeFilter> streamTube;\n  streamTube->SetInputConnection(streamer->GetOutputPort());\n  streamTube->SetInputArrayToProcess(\n      1, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, \"vectors\");\n  streamTube->SetRadius(0.02);\n  streamTube->SetNumberOfSides(12);\n  streamTube->SetVaryRadiusToVaryRadiusByVector();\n\n  vtkNew<vtkPolyDataMapper> mapStreamTube;\n  mapStreamTube->SetInputConnection(streamTube->GetOutputPort());\n  mapStreamTube->SetScalarRange(\n      reader->GetOutput()->GetPointData()->GetScalars()->GetRange());\n\n  vtkNew<vtkActor> streamTubeActor;\n  streamTubeActor->SetMapper(mapStreamTube);\n  streamTubeActor->GetProperty()->BackfaceCullingOn();\n\n  // From here on we generate a whole bunch of planes which correspond to\n  // the geometry in the analysis; tables, bookshelves and so on.\n  vtkNew<vtkStructuredGridGeometryFilter> table1;\n  table1->SetInputConnection(reader->GetOutputPort());\n  table1->SetExtent(11, 15, 7, 9, 8, 8);\n  vtkNew<vtkPolyDataMapper> mapTable1;\n  mapTable1->SetInputConnection(table1->GetOutputPort());\n  mapTable1->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> table1Actor;\n  table1Actor->SetMapper(mapTable1);\n  table1Actor->GetProperty()->SetColor(.59, .427, .392);\n\n  vtkNew<vtkStructuredGridGeometryFilter> table2;\n  table2->SetInputConnection(reader->GetOutputPort());\n  table2->SetExtent(11, 15, 10, 12, 8, 8);\n  vtkNew<vtkPolyDataMapper> mapTable2;\n  mapTable2->SetInputConnection(table2->GetOutputPort());\n  mapTable2->ScalarVisibilityOff();\n  vtkNew<vtkActor> table2Actor;\n  table2Actor->SetMapper(mapTable2);\n  table2Actor->GetProperty()->SetColor(.59, .427, .392);\n\n  vtkNew<vtkStructuredGridGeometryFilter> FilingCabinet1;\n  FilingCabinet1->SetInputConnection(reader->GetOutputPort());\n  FilingCabinet1->SetExtent(15, 15, 7, 9, 0, 8);\n  vtkNew<vtkPolyDataMapper> mapFilingCabinet1;\n  mapFilingCabinet1->SetInputConnection(FilingCabinet1->GetOutputPort());\n  mapFilingCabinet1->ScalarVisibilityOff();\n  vtkNew<vtkActor> FilingCabinet1Actor;\n  FilingCabinet1Actor->SetMapper(mapFilingCabinet1);\n  FilingCabinet1Actor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> FilingCabinet2;\n  FilingCabinet2->SetInputConnection(reader->GetOutputPort());\n  FilingCabinet2->SetExtent(15, 15, 10, 12, 0, 8);\n  vtkNew<vtkPolyDataMapper> mapFilingCabinet2;\n  mapFilingCabinet2->SetInputConnection(FilingCabinet2->GetOutputPort());\n  mapFilingCabinet2->ScalarVisibilityOff();\n  vtkNew<vtkActor> FilingCabinet2Actor;\n  FilingCabinet2Actor->SetMapper(mapFilingCabinet2);\n  FilingCabinet2Actor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Top;\n  bookshelf1Top->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Top->SetExtent(13, 13, 0, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Top;\n\n  mapBookshelf1Top->SetInputConnection(bookshelf1Top->GetOutputPort());\n  mapBookshelf1Top->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1TopActor;\n  bookshelf1TopActor->SetMapper(mapBookshelf1Top);\n  bookshelf1TopActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Bottom;\n  bookshelf1Bottom->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Bottom->SetExtent(20, 20, 0, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Bottom;\n  mapBookshelf1Bottom->SetInputConnection(bookshelf1Bottom->GetOutputPort());\n  mapBookshelf1Bottom->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1BottomActor;\n  bookshelf1BottomActor->SetMapper(mapBookshelf1Bottom);\n  bookshelf1BottomActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Front;\n  bookshelf1Front->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Front->SetExtent(13, 20, 0, 0, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Front;\n  mapBookshelf1Front->SetInputConnection(bookshelf1Front->GetOutputPort());\n  mapBookshelf1Front->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1FrontActor;\n  bookshelf1FrontActor->SetMapper(mapBookshelf1Front);\n  bookshelf1FrontActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1Back;\n  bookshelf1Back->SetInputConnection(reader->GetOutputPort());\n  bookshelf1Back->SetExtent(13, 20, 4, 4, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1Back;\n  mapBookshelf1Back->SetInputConnection(bookshelf1Back->GetOutputPort());\n  mapBookshelf1Back->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1BackActor;\n  bookshelf1BackActor->SetMapper(mapBookshelf1Back);\n  bookshelf1BackActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1LHS;\n  bookshelf1LHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf1LHS->SetExtent(13, 20, 0, 4, 0, 0);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1LHS;\n  mapBookshelf1LHS->SetInputConnection(bookshelf1LHS->GetOutputPort());\n  mapBookshelf1LHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1LHSActor;\n  bookshelf1LHSActor->SetMapper(mapBookshelf1LHS);\n  bookshelf1LHSActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf1RHS;\n  bookshelf1RHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf1RHS->SetExtent(13, 20, 0, 4, 11, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf1RHS;\n  mapBookshelf1RHS->SetInputConnection(bookshelf1RHS->GetOutputPort());\n  mapBookshelf1RHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf1RHSActor;\n  bookshelf1RHSActor->SetMapper(mapBookshelf1RHS);\n  bookshelf1RHSActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Top;\n  bookshelf2Top->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Top->SetExtent(13, 13, 15, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Top;\n  mapBookshelf2Top->SetInputConnection(bookshelf2Top->GetOutputPort());\n  mapBookshelf2Top->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2TopActor;\n  bookshelf2TopActor->SetMapper(mapBookshelf2Top);\n  bookshelf2TopActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Bottom;\n  bookshelf2Bottom->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Bottom->SetExtent(20, 20, 15, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Bottom;\n  mapBookshelf2Bottom->SetInputConnection(bookshelf2Bottom->GetOutputPort());\n  mapBookshelf2Bottom->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2BottomActor;\n  bookshelf2BottomActor->SetMapper(mapBookshelf2Bottom);\n  bookshelf2BottomActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Front;\n  bookshelf2Front->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Front->SetExtent(13, 20, 15, 15, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Front;\n  mapBookshelf2Front->SetInputConnection(bookshelf2Front->GetOutputPort());\n  mapBookshelf2Front->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2FrontActor;\n\n  bookshelf2FrontActor->SetMapper(mapBookshelf2Front);\n  bookshelf2FrontActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2Back;\n  bookshelf2Back->SetInputConnection(reader->GetOutputPort());\n  bookshelf2Back->SetExtent(13, 20, 19, 19, 0, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2Back;\n  mapBookshelf2Back->SetInputConnection(bookshelf2Back->GetOutputPort());\n  mapBookshelf2Back->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2BackActor;\n  bookshelf2BackActor->SetMapper(mapBookshelf2Back);\n  bookshelf2BackActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2LHS;\n\n  bookshelf2LHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf2LHS->SetExtent(13, 20, 15, 19, 0, 0);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2LHS;\n  mapBookshelf2LHS->SetInputConnection(bookshelf2LHS->GetOutputPort());\n  mapBookshelf2LHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2LHSActor;\n  bookshelf2LHSActor->SetMapper(mapBookshelf2LHS);\n  bookshelf2LHSActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> bookshelf2RHS;\n  bookshelf2RHS->SetInputConnection(reader->GetOutputPort());\n  bookshelf2RHS->SetExtent(13, 20, 15, 19, 11, 11);\n  vtkNew<vtkPolyDataMapper> mapBookshelf2RHS;\n  mapBookshelf2RHS->SetInputConnection(bookshelf2RHS->GetOutputPort());\n  mapBookshelf2RHS->ScalarVisibilityOff();\n  vtkNew<vtkActor> bookshelf2RHSActor;\n  bookshelf2RHSActor->SetMapper(mapBookshelf2RHS);\n  bookshelf2RHSActor->GetProperty()->SetColor(.8, .8, .6);\n\n  vtkNew<vtkStructuredGridGeometryFilter> window;\n  window->SetInputConnection(reader->GetOutputPort());\n  window->SetExtent(20, 20, 6, 13, 10, 13);\n  vtkNew<vtkPolyDataMapper> mapWindow;\n\n  mapWindow->SetInputConnection(window->GetOutputPort());\n  mapWindow->ScalarVisibilityOff();\n  vtkNew<vtkActor> windowActor;\n  windowActor->SetMapper(mapWindow);\n  windowActor->GetProperty()->SetColor(.3, .3, .5);\n\n  vtkNew<vtkStructuredGridGeometryFilter> outlet;\n  outlet->SetInputConnection(reader->GetOutputPort());\n  outlet->SetExtent(0, 0, 9, 10, 14, 16);\n  vtkNew<vtkPolyDataMapper> mapOutlet;\n  mapOutlet->SetInputConnection(outlet->GetOutputPort());\n  mapOutlet->ScalarVisibilityOff();\n  vtkNew<vtkActor> outletActor;\n  outletActor->SetMapper(mapOutlet);\n  outletActor->GetProperty()->SetColor(0, 0, 0);\n\n  vtkNew<vtkStructuredGridGeometryFilter> inlet;\n  inlet->SetInputConnection(reader->GetOutputPort());\n  inlet->SetExtent(0, 0, 9, 10, 0, 6);\n  vtkNew<vtkPolyDataMapper> mapInlet;\n  mapInlet->SetInputConnection(inlet->GetOutputPort());\n  mapInlet->ScalarVisibilityOff();\n  vtkNew<vtkActor> inletActor;\n  inletActor->SetMapper(mapInlet);\n  inletActor->GetProperty()->SetColor(0, 0, 0);\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> mapOutline;\n  mapOutline->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(mapOutline);\n  outlineActor->GetProperty()->SetColor(0, 0, 0);\n\n  // Now create the usual graphics stuff.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  renderer->AddActor(table1Actor);\n  renderer->AddActor(table2Actor);\n  renderer->AddActor(FilingCabinet1Actor);\n  renderer->AddActor(FilingCabinet2Actor);\n  renderer->AddActor(bookshelf1TopActor);\n  renderer->AddActor(bookshelf1BottomActor);\n  renderer->AddActor(bookshelf1FrontActor);\n  renderer->AddActor(bookshelf1BackActor);\n  renderer->AddActor(bookshelf1LHSActor);\n  renderer->AddActor(bookshelf1RHSActor);\n  renderer->AddActor(bookshelf2TopActor);\n  renderer->AddActor(bookshelf2BottomActor);\n  renderer->AddActor(bookshelf2FrontActor);\n  renderer->AddActor(bookshelf2BackActor);\n  renderer->AddActor(bookshelf2LHSActor);\n  renderer->AddActor(bookshelf2RHSActor);\n  renderer->AddActor(windowActor);\n  renderer->AddActor(outletActor);\n  renderer->AddActor(inletActor);\n  renderer->AddActor(outlineActor);\n  renderer->AddActor(streamTubeActor);\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Here we specify a particular view.\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetClippingRange(0.726079, 36.3039);\n  aCamera->SetFocalPoint(2.43584, 2.15046, 1.11104);\n  aCamera->SetPosition(-4.76183, -10.4426, 3.17203);\n  aCamera->SetViewUp(0.0511273, 0.132773, 0.989827);\n  aCamera->SetViewAngle(18.604);\n  aCamera->Zoom(1.2);\n\n  renderer->SetActiveCamera(aCamera);\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"OfficeTube\");\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/OfficeTube/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OfficeTube)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonMath\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OfficeTube: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OfficeTube MACOSX_BUNDLE OfficeTube.cxx )\n  target_link_libraries(OfficeTube PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OfficeTube\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/OfficeTube/#download-and-build-officetube","title":"Download and Build OfficeTube","text":"

        Click here to download OfficeTube and its CMakeLists.txt file. Once the tarball OfficeTube.tar has been downloaded and extracted,

        cd OfficeTube/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OfficeTube\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/","title":"PineRootConnectivity","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/PineRootConnectivity

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#description","title":"Description","text":"

        Demonstrates how to apply the connectivity filter to remove noisy isosurfaces.

        To illustrate the application of connectivity analysis, we will use an MRI dataset generated by Janet MacFall at the Center for In Vivo Microscopy at Duke University. The dataset is a volume of dimensions 256^3. The data is of the root system of a small pine tree. Using the class vtkSliceCubes , an implementation of marching cubes for large volumes, we generate an initial isosurface represented by 351,536 triangles. This is a faster way of manipulating this data. If you have a large enough computer you can process the volume directly with a vtk image reader and vtkMarchingCubes. The example on this other page shows the initial dataset. Notice that there are many small, disconnected isosurfaces due to noise and isolated moisture in the data. We use vtkConnectivityFilter to remove these small, disconnected surfaces. The example on this page shows the result of applying the filter. Over 50,000 triangles were removed, leaving 299,380 triangles. The vtkConnectivityFilter is a general filter taking datasets as input, and generating an unstructured grid as output. It functions by extracting cells that are connected at points (i.e., share common points). In this example the single largest surface is extracted. It is also possible to specify cell ids and point ids and extract surfaces connected to these.

        Info

        To count the number of triangles in the polydata we do the following:

        Cite

        Comparative Water Uptake by Roots of Different Ages in Seedlings of Loblolly Pine (Pinus taeda L.) December 1991. New Phytologist 119(4):551 - 560.

        Info

        See Figure 9-51 in Chapter 9 in the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#c","title":"C++","text":"

        We use a lambda function c++ auto NumberofTriangles = [](auto *pd)

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#python","title":"Python","text":"

        We just implement: python def NumberOfTriangles(pd): within the scope of the calling function.

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#code","title":"Code","text":"

        PineRootConnectivity.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDataSetMapper.h>\n#include <vtkMCubesReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataConnectivityFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#ifdef VTK_CELL_ARRAY_V2\n#include <vtkCellArrayIterator.h>\n#endif // VTK_CELL_ARRAY_V2\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename [noConnectivity]\"\n              << std::endl;\n    std::cout << \"where: filename is pine_root.tri.\" << std::endl;\n    std::cout << \"       if noConnectivity is nonzero then the connectivity \"\n                 \"filter is ignored.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  /**\n   * Count the triangles in the polydata.\n   * @param pd: vtkPolyData.\n   * @return The number of triangles.\n   */\n  auto NumberofTriangles = [](vtkPolyData* pd) {\n    vtkCellArray* cells = pd->GetPolys();\n    vtkIdType npts = 0;\n    auto numOfTriangles = 0;\n#ifdef VTK_CELL_ARRAY_V2\n\n    // Newer versions of vtkCellArray prefer local iterators:\n    auto cellIter = vtk::TakeSmartPointer(cells->NewIterator());\n    for (cellIter->GoToFirstCell(); !cellIter->IsDoneWithTraversal();\n         cellIter->GoToNextCell())\n    {\n      auto cell = cellIter->GetCurrentCell();\n      if (cell == nullptr)\n      {\n        break;\n      }\n      // If a cell has three points it is a triangle.\n      if (cell->GetNumberOfIds() == 3)\n      {\n        numOfTriangles++;\n      }\n    }\n\n#else  // VTK_CELL_ARRAY_V2\n\n    // Older implementations of vtkCellArray use internal iterator APIs (not\n    // thread safe):\n    vtkIdType* pts;\n    for (auto i = 0; i < pd->GetNumberOfPolys(); ++i)\n    {\n      int c = cells->GetNextCell(npts, pts);\n      if (c == 0)\n      {\n        break;\n      }\n      // If a cell has three points it is a triangle.\n      if (npts == 3)\n      {\n        numOfTriangles++;\n      }\n    }\n#endif // VTK_CELL_ARRAY_V2\n\n    return numOfTriangles;\n  };\n\n  std::string fileName = argv[1];\n  auto noConnectivity = false;\n  if (argc > 2)\n  {\n    noConnectivity = atoi(argv[2]) != 0;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the pipeline.\n  vtkNew<vtkMCubesReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->FlipNormalsOff();\n  if (!noConnectivity)\n  {\n    reader->Update();\n    std::cout << \"Before Connectivity there are: \"\n              << NumberofTriangles(reader->GetOutput()) << \" triangles.\"\n              << std::endl;\n  }\n\n  vtkNew<vtkPolyDataConnectivityFilter> connect;\n  connect->SetInputConnection(reader->GetOutputPort());\n  connect->SetExtractionModeToLargestRegion();\n  if (!noConnectivity)\n  {\n    connect->Update();\n    std::cout << \"After Connectivity there are:  \"\n              << NumberofTriangles(\n                     dynamic_cast<vtkPolyData*>(connect->GetOutput()))\n              << \" triangles.\" << std::endl;\n  }\n\n  vtkNew<vtkDataSetMapper> isoMapper;\n  if (noConnectivity)\n  {\n    isoMapper->SetInputConnection(reader->GetOutputPort());\n  }\n  else\n  {\n    isoMapper->SetInputConnection(connect->GetOutputPort());\n  }\n  isoMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"raw_sienna\").GetData());\n\n  // Get an outline of the data set for context.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the Renderer, RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(outlineActor);\n  ren->AddActor(isoActor);\n  // renWin->SetSize(750, 750);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"PineRootConnectivity\");\n\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkCamera* cam = ren->GetActiveCamera();\n  cam->SetFocalPoint(40.6018, 37.2813, 50.1953);\n  cam->SetPosition(40.6018, -280.533, 47.0172);\n  cam->ComputeViewPlaneNormal();\n  cam->SetClippingRange(26.1073, 1305.36);\n  cam->SetViewAngle(20.9219);\n  cam->SetViewUp(0.0, 0.0, 1.0);\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PineRootConnectivity)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PineRootConnectivity: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PineRootConnectivity MACOSX_BUNDLE PineRootConnectivity.cxx )\n  target_link_libraries(PineRootConnectivity PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PineRootConnectivity\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivity/#download-and-build-pinerootconnectivity","title":"Download and Build PineRootConnectivity","text":"

        Click here to download PineRootConnectivity and its CMakeLists.txt file. Once the tarball PineRootConnectivity.tar has been downloaded and extracted,

        cd PineRootConnectivity/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PineRootConnectivity\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivityA/","title":"PineRootConnectivityA","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/PineRootConnectivityA

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivityA/#description","title":"Description","text":"

        This example applies connectivity filter to remove noisy isosurface. Data is from 256^3 volume data of the root system of a pine tree.

        The example runs PineRootConnectivity as follows:

        PineRootConnectivityA pine_root.tri 1\n

        Info

        See Figure 9-51a in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivityA/#code","title":"Code","text":"

        PineRootConnectivityA.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkPointData.h>\n#include <vtkPointSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkStructuredGridReader.h>\n\n#include \"PineRootConnectivity.cxx\"\n
        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivityA/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PineRootConnectivityA)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonDataModel\n  FiltersCore\n  FiltersFlowPaths\n  FiltersGeometry\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PineRootConnectivityA: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PineRootConnectivityA MACOSX_BUNDLE PineRootConnectivityA.cxx )\n  target_link_libraries(PineRootConnectivityA PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PineRootConnectivityA\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/PineRootConnectivityA/#download-and-build-pinerootconnectivitya","title":"Download and Build PineRootConnectivityA","text":"

        Click here to download PineRootConnectivityA and its CMakeLists.txt file. Once the tarball PineRootConnectivityA.tar has been downloaded and extracted,

        cd PineRootConnectivityA/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PineRootConnectivityA\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/","title":"PineRootDecimation","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/PineRootDecimation

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#description","title":"Description","text":"

        Demonstrates how to apply the decimation filter to get a reduced data size and then the connectivity filter to remove noisy isosurfaces. The data is from the root system of a pine tree.

        To count the number of triangles in the polydata we do the following:

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#c","title":"C++","text":"

        We use a lambda function

        auto NumberofTriangles = [](auto *pd)\n
        "},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#python","title":"Python","text":"

        We just implement:

        def NumberOfTriangles(pd):\n

        within the scope of the calling function.

        Info

        See Figure 9-52 in Chapter 9 in the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#code","title":"Code","text":"

        PineRootDecimation.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkConnectivityFilter.h>\n#include <vtkDataSetMapper.h>\n#include <vtkDecimatePro.h>\n#include <vtkMCubesReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#ifdef VTK_CELL_ARRAY_V2\n#include <vtkCellArrayIterator.h>\n#endif // VTK_CELL_ARRAY_V2\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename\" << std::endl;\n    std::cout << \"where: filename is pine_root.tri.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  /**\n   * Count the triangles in the polydata.\n   * @param pd: vtkPolyData.\n   * @return The number of triangles.\n   */\n  auto NumberofTriangles = [](vtkPolyData* pd) {\n    vtkCellArray* cells = pd->GetPolys();\n    vtkIdType npts = 0;\n    auto numOfTriangles = 0;\n#ifdef VTK_CELL_ARRAY_V2\n\n    // Newer versions of vtkCellArray prefer local iterators:\n    auto cellIter = vtk::TakeSmartPointer(cells->NewIterator());\n    for (cellIter->GoToFirstCell(); !cellIter->IsDoneWithTraversal();\n         cellIter->GoToNextCell())\n    {\n      auto cell = cellIter->GetCurrentCell();\n      if (cell == nullptr)\n      {\n        break;\n      }\n      // If a cell has three points it is a triangle.\n      if (cell->GetNumberOfIds() == 3)\n      {\n        numOfTriangles++;\n      }\n    }\n\n#else  // VTK_CELL_ARRAY_V2\n\n    // Older implementations of vtkCellArray use internal iterator APIs (not\n    // thread safe):\n    vtkIdType* pts;\n    for (auto i = 0; i < pd->GetNumberOfPolys(); ++i)\n    {\n      int c = cells->GetNextCell(npts, pts);\n      if (c == 0)\n      {\n        break;\n      }\n      // If a cell has three points it is a triangle.\n      if (npts == 3)\n      {\n        numOfTriangles++;\n      }\n    }\n#endif // VTK_CELL_ARRAY_V2\n\n    return numOfTriangles;\n  };\n  ///**\n  //* Count the triangles in the polydata.\n  //* @param pd: vtkPolyData.\n  //* @return The number of triangles.\n  //*/\n  // auto NumberofTriangles = [](vtkPolyData* pd) {\n  //  vtkCellArray* cells = pd->GetPolys();\n  //  vtkIdType npts = 0;\n  //  vtkIdType* pts;\n  //  auto numOfTriangles = 0;\n  //  for (auto i = 0; i < pd->GetNumberOfPolys(); ++i)\n  //  {\n  //    int c = cells->GetNextCell(npts, pts);\n  //    if (c == 0)\n  //    {\n  //      break;\n  //    }\n  //    // If a cell has three points it is a triangle.\n  //    if (npts == 3)\n  //    {\n  //      numOfTriangles++;\n  //    }\n  //  }\n  //  return numOfTriangles;\n  //};\n\n  std::string fileName = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the pipeline.\n  vtkNew<vtkMCubesReader> reader;\n  reader->SetFileName(fileName.c_str());\n  reader->FlipNormalsOff();\n  reader->Update();\n  std::cout << \"Before Decimation there are:  \"\n            << NumberofTriangles(reader->GetOutput()) << \" triangles.\"\n            << std::endl;\n\n  vtkNew<vtkDecimatePro> deci;\n  deci->SetInputConnection(reader->GetOutputPort());\n  deci->SetTargetReduction(0.9);\n  deci->SetAbsoluteError(0.0005);\n  deci->SetFeatureAngle(30);\n  deci->SetErrorIsAbsolute(1);\n  deci->AccumulateErrorOn();\n  // deci->SplittingOff();\n  deci->Update();\n  std::cout << \"After Decimation there are:   \"\n            << NumberofTriangles(deci->GetOutput()) << \" triangles.\"\n            << std::endl;\n\n  vtkNew<vtkConnectivityFilter> connect;\n  connect->SetInputConnection(deci->GetOutputPort());\n  connect->SetExtractionModeToLargestRegion();\n  connect->Update();\n  // Note the use of dynamic_cast<vtkPolyData*> here.\n  std::cout << \"After Connectivity there are: \"\n            << NumberofTriangles(\n                   dynamic_cast<vtkPolyData*>(connect->GetOutput()))\n            << \" triangles.\" << std::endl;\n\n  vtkNew<vtkDataSetMapper> isoMapper;\n  isoMapper->SetInputConnection(connect->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetColor(colors->GetColor3d(\"raw_sienna\").GetData());\n\n  // Get an outline of the data set for context.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(reader->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the Renderer, RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(outlineActor);\n  ren->AddActor(isoActor);\n  // renWin->SetSize(750, 750);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"PineRootDecimation\");\n\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkCamera* cam = ren->GetActiveCamera();\n  cam->SetFocalPoint(40.6018, 37.2813, 50.1953);\n  cam->SetPosition(40.6018, -280.533, 47.0172);\n  cam->ComputeViewPlaneNormal();\n  cam->SetClippingRange(26.1073, 1305.36);\n  cam->SetViewAngle(20.9219);\n  cam->SetViewUp(0.0, 0.0, 1.0);\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PineRootDecimation)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  IOGeometry\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PineRootDecimation: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PineRootDecimation MACOSX_BUNDLE PineRootDecimation.cxx )\n  target_link_libraries(PineRootDecimation PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PineRootDecimation\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/PineRootDecimation/#download-and-build-pinerootdecimation","title":"Download and Build PineRootDecimation","text":"

        Click here to download PineRootDecimation and its CMakeLists.txt file. Once the tarball PineRootDecimation.tar has been downloaded and extracted,

        cd PineRootDecimation/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PineRootDecimation\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/PlateVibration/","title":"PlateVibration","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/PlateVibration

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/PlateVibration/#description","title":"Description","text":"

        The motion of a vibrating beam is shown. The original undeformed outline is shown as a wireframe.

        Info

        See Figure 6-14a in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/PlateVibration/#code","title":"Code","text":"

        PlateVibration.cxx

        // Translated from vib.tcl\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVectorDot.h>\n#include <vtkWarpVector.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  auto Scale = [](std::vector<double>& v, double scale) {\n    std::transform(std::begin(v), std::end(v), std::begin(v),\n                   [=](double const& n) { return n / scale; });\n    return;\n  };\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename\" << std::endl;\n    std::cout << \"where: filename is the file plate.vtk.\" << std::endl;\n    std::cout\n        << \"Produces figure 6-14(a) Beam displacement from the VTK Textbook.\"\n        << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Set the background color and plate color.\n  std::array<unsigned char, 4> bar{{255, 160, 140}};\n  colors->SetColor(\"PlateColor\", bar.data());\n  std::array<unsigned char, 4> bkg{{65, 99, 149}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Read a vtk file.\n  //\n  vtkNew<vtkPolyDataReader> plate;\n  plate->SetFileName(fileName.c_str());\n  plate->Update();\n  double bounds[6];\n  plate->GetOutput()->GetBounds(bounds);\n  plate->SetVectorsName(\"mode2\");\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(plate->GetOutputPort());\n  vtkNew<vtkWarpVector> warp;\n  warp->SetInputConnection(normals->GetOutputPort());\n  warp->SetScaleFactor(0.5);\n  vtkNew<vtkVectorDot> color;\n  color->SetInputConnection(warp->GetOutputPort());\n  vtkNew<vtkDataSetMapper> plateMapper;\n  plateMapper->SetInputConnection(warp->GetOutputPort());\n  vtkNew<vtkActor> plateActor;\n  plateActor->SetMapper(plateMapper);\n  plateActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"PlateColor\").GetData());\n  plateActor->RotateX(-90);\n\n  // Create the outline.\n  //\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(plate->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->RotateX(-90);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"White\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren->AddActor(plateActor);\n  ren->AddActor(outlineActor);\n  renWin->SetSize(500, 500);\n  renWin->SetWindowName(\"PlateVibration\");\n\n  // Render the image.\n  renWin->Render();\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n  // This closely matches the original illustration.\n  ren->GetActiveCamera()->SetPosition(-3.7, 13, 15.5);\n  ren->ResetCameraClippingRange();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/PlateVibration/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlateVibration)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlateVibration: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlateVibration MACOSX_BUNDLE PlateVibration.cxx )\n  target_link_libraries(PlateVibration PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlateVibration\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/PlateVibration/#download-and-build-platevibration","title":"Download and Build PlateVibration","text":"

        Click here to download PlateVibration and its CMakeLists.txt file. Once the tarball PlateVibration.tar has been downloaded and extracted,

        cd PlateVibration/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PlateVibration\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/ProbeCombustor/","title":"ProbeCombustor","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/ProbeCombustor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/ProbeCombustor/#description","title":"Description","text":"

        Probing obtains dataset attributes by sampling one dataset (the input) with a set of points (the probe). Probing is also called \u201cresampling.\u201d Examples include probing an input dataset with a sequence of points along a line, on a plane, or in a volume. The result of the probing is a new dataset (the output) with the topological and geometric structure of the probe dataset, and point attributes interpolated from the input dataset. Once the probing operation is completed, the output dataset can be visualized with any of the appropriate techniques in VTK.

        This example illustrates the details of the probing process. For every point in the probe dataset, the location in the input dataset (i.e., cell, subcell, and parametric coordinates) and interpolation weights are determined. Then the data values from the cell are interpolated to the probe point. Probe points that are outside the input dataset are assigned a nil (or appropriate) value. This process repeats for all points in the probe dataset.

        Info

        See Figure 9-19 in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/ProbeCombustor/#code","title":"Code","text":"

        ProbeCombustor.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProbeFilter.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n#include <iostream>\n#include <string>\n\n// This shows how to probe a dataset with a plane. The probed data is then\n// contoured.\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // create pipeline\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkStructuredGrid* sg =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // We create three planes and position them in the correct position\n  // using transform filters. They are then appended together and used as\n  // a probe.\n  vtkNew<vtkPlaneSource> plane;\n  plane->SetResolution(50, 50);\n\n  vtkNew<vtkTransform> transP1;\n  transP1->Translate(3.7, 0.0, 28.37);\n  transP1->Scale(5, 5, 5);\n  transP1->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> tpd1;\n  tpd1->SetInputConnection(plane->GetOutputPort());\n  tpd1->SetTransform(transP1);\n\n  vtkNew<vtkOutlineFilter> outTpd1;\n  outTpd1->SetInputConnection(tpd1->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapTpd1;\n  mapTpd1->SetInputConnection(outTpd1->GetOutputPort());\n\n  vtkNew<vtkActor> tpd1Actor;\n  tpd1Actor->SetMapper(mapTpd1);\n  tpd1Actor->GetProperty()->SetColor(0, 0, 0);\n  tpd1Actor->GetProperty()->SetLineWidth(2.0);\n\n  vtkNew<vtkTransform> transP2;\n  transP2->Translate(9.2, 0.0, 31.20);\n  transP2->Scale(5, 5, 5);\n  transP2->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> tpd2;\n  tpd2->SetInputConnection(plane->GetOutputPort());\n  tpd2->SetTransform(transP2);\n\n  vtkNew<vtkOutlineFilter> outTpd2;\n  outTpd2->SetInputConnection(tpd2->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapTpd2;\n  mapTpd2->SetInputConnection(outTpd2->GetOutputPort());\n\n  vtkNew<vtkActor> tpd2Actor;\n  tpd2Actor->SetMapper(mapTpd2);\n  tpd2Actor->GetProperty()->SetColor(0, 0, 0);\n  tpd2Actor->GetProperty()->SetLineWidth(2.0);\n\n  vtkNew<vtkTransform> transP3;\n  transP3->Translate(13.27, 0.0, 33.30);\n  transP3->Scale(5, 5, 5);\n  transP3->RotateY(90);\n\n  vtkNew<vtkTransformPolyDataFilter> tpd3;\n  tpd3->SetInputConnection(plane->GetOutputPort());\n  tpd3->SetTransform(transP3);\n\n  vtkNew<vtkOutlineFilter> outTpd3;\n  outTpd3->SetInputConnection(tpd3->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> mapTpd3;\n  mapTpd3->SetInputConnection(outTpd3->GetOutputPort());\n\n  vtkNew<vtkActor> tpd3Actor;\n  tpd3Actor->SetMapper(mapTpd3);\n  tpd3Actor->GetProperty()->SetColor(0, 0, 0);\n  tpd3Actor->GetProperty()->SetLineWidth(2.0);\n\n  vtkNew<vtkAppendPolyData> appendF;\n  appendF->AddInputConnection(tpd1->GetOutputPort());\n  appendF->AddInputConnection(tpd2->GetOutputPort());\n  appendF->AddInputConnection(tpd3->GetOutputPort());\n\n  // The vtkProbeFilter takes two inputs. One is a dataset to use as the probe\n  // geometry (SetInputConnection); the other is the data to probe\n  // (SetSourceConnection). The output dataset structure (geometry and\n  // topology) of the probe is the same as the structure of the input. The\n  // probing process generates new data values resampled from the source.\n  vtkNew<vtkProbeFilter> probe;\n  probe->SetInputConnection(appendF->GetOutputPort());\n  probe->SetSourceData(sg);\n\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(probe->GetOutputPort());\n  contour->GenerateValues(50, sg->GetScalarRange());\n\n  vtkNew<vtkPolyDataMapper> contourMapper;\n  contourMapper->SetInputConnection(contour->GetOutputPort());\n  contourMapper->SetScalarRange(sg->GetScalarRange());\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(contourMapper);\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(sg);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(0, 0, 0);\n  outlineActor->GetProperty()->SetLineWidth(2.0);\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(planeActor);\n  ren1->AddActor(tpd1Actor);\n  ren1->AddActor(tpd2Actor);\n  ren1->AddActor(tpd3Actor);\n  ren1->SetBackground(colors->GetColor3d(\"Gainsboro\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"ProbeCombustor\");\n\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->SetClippingRange(3.95297, 50);\n  ren1->GetActiveCamera()->SetFocalPoint(8.88908, 0.595038, 29.3342);\n  ren1->GetActiveCamera()->SetPosition(-12.3332, 31.7479, 41.2387);\n  ren1->GetActiveCamera()->SetViewUp(0.060772, -0.319905, 0.945498);\n\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/ProbeCombustor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ProbeCombustor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  FiltersSources\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ProbeCombustor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ProbeCombustor MACOSX_BUNDLE ProbeCombustor.cxx )\n  target_link_libraries(ProbeCombustor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ProbeCombustor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/ProbeCombustor/#download-and-build-probecombustor","title":"Download and Build ProbeCombustor","text":"

        Click here to download ProbeCombustor and its CMakeLists.txt file. Once the tarball ProbeCombustor.tar has been downloaded and extracted,

        cd ProbeCombustor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ProbeCombustor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/SingleSplat/","title":"SingleSplat","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/SingleSplat

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/SingleSplat/#description","title":"Description","text":"

        This example shows a single elliptical splat.

        Info

        See Figure 9-38a in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/SingleSplat/#code","title":"Code","text":"

        SingleSplat.cxx

        #include <vtkActor.h>\n#include <vtkCellArray.h>\n#include <vtkConeSource.h>\n#include <vtkContourFilter.h>\n#include <vtkDoubleArray.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> aren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(aren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create single splat point.\n  vtkNew<vtkPoints> pts;\n  vtkNew<vtkCellArray> verts;\n  vtkNew<vtkDoubleArray> norms;\n  vtkNew<vtkDoubleArray> scalars;\n\n  std::array<double, 3> x{0.0, 0.0, 0.0};\n  pts->InsertNextPoint(x.data());\n  norms->SetNumberOfTuples(1);\n  norms->SetNumberOfComponents(3);\n  std::array<double, 3> n{0.707, 0.707, 0.0};\n  norms->InsertTuple(0, n.data());\n  scalars->SetNumberOfTuples(1);\n  scalars->SetNumberOfComponents(1);\n  scalars->InsertTuple1(0, 1.0);\n\n  verts->InsertNextCell(1);\n  verts->InsertCellPoint(0);\n\n  vtkNew<vtkPolyData> pData;\n  pData->SetPoints(pts);\n  pData->SetVerts(verts);\n  pData->GetPointData()->SetNormals(norms);\n  pData->GetPointData()->SetScalars(scalars);\n\n  // Splat point and generate isosurface.\n  vtkNew<vtkGaussianSplatter> splat;\n  splat->SetInputData(pData);\n  splat->SetModelBounds(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);\n  splat->SetSampleDimensions(75, 75, 75);\n  splat->SetRadius(0.5);\n  splat->SetEccentricity(5.0);\n  splat->SetExponentFactor(-3.25);\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(splat->GetOutputPort());\n  contour->SetValue(0, 0.9);\n  vtkNew<vtkPolyDataMapper> splatMapper;\n  splatMapper->SetInputConnection(contour->GetOutputPort());\n  vtkNew<vtkActor> splatActor;\n  splatActor->SetMapper(splatMapper);\n\n  // Create outline.\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(splat->GetOutputPort());\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Brown\").GetData());\n\n  // Create cone to indicate direction.\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(24);\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->SetScale(0.75, 0.75, 0.75);\n  coneActor->RotateZ(45.0);\n  coneActor->AddPosition(0.50, 0.50, 0.0);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"DeepPink\").GetData());\n  //\n  // Rendering stuff.\n  //\n  aren->SetBackground(colors->GetColor3d(\"Beige\").GetData());\n  aren->AddActor(splatActor);\n  aren->AddActor(outlineActor);\n  aren->AddActor(coneActor);\n\n  renWin->SetSize(640, 640);\n  renWin->SetWindowName(\"SingleSplat\");\n  renWin->Render();\n\n  // interact with data.\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/SingleSplat/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SingleSplat)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersModeling\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SingleSplat: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SingleSplat MACOSX_BUNDLE SingleSplat.cxx )\n  target_link_libraries(SingleSplat PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SingleSplat\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/SingleSplat/#download-and-build-singlesplat","title":"Download and Build SingleSplat","text":"

        Click here to download SingleSplat and its CMakeLists.txt file. Once the tarball SingleSplat.tar has been downloaded and extracted,

        cd SingleSplat/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SingleSplat\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/SpikeFran/","title":"SpikeFran","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/SpikeFran

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/SpikeFran/#description","title":"Description","text":"

        This examples uses glyphs to indicate surface normals on model of human face. Glyph positions are randomly selected.

        Info

        See Figure 6-30 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/SpikeFran/#code","title":"Code","text":"

        SpikeFran.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkGlyph3D.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n\n// This example demonstrates the use of glyphing. We also use a mask filter\n// to select a subset of points to glyph.\n\n// Read a data file. This originally was a Cyberware laser digitizer scan\n// of Fran J.'s face. Surface normals are generated based on local geometry\n// (i.e., the polygon normals surrounding each point are averaged). We flip\n// the normals because we want them to point out from Fran's face.\n//\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fran_cut.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkPolyDataReader> fran;\n  fran->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(fran->GetOutputPort());\n  normals->FlipNormalsOn();\n\n  vtkNew<vtkPolyDataMapper> franMapper;\n  franMapper->SetInputConnection(normals->GetOutputPort());\n\n  vtkNew<vtkActor> franActor;\n  franActor->SetMapper(franMapper);\n  franActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n\n  // We subsample the dataset because we want to glyph just a subset of\n  // the points. Otherwise the display is cluttered and cannot be easily\n  // read. The RandomModeOn and SetOnRatio combine to random select one out\n  // of every 10 points in the dataset.\n  //\n  vtkNew<vtkMaskPoints> ptMask;\n  ptMask->SetInputConnection(normals->GetOutputPort());\n  ptMask->SetOnRatio(10);\n  ptMask->RandomModeOn();\n\n  // In this case we are using a cone as a glyph. We transform the cone so\n  // its base is at 0,0,0. This is the point where glyph rotation occurs.\n  vtkNew<vtkConeSource> cone;\n  cone->SetResolution(6);\n\n  vtkNew<vtkTransform> transform;\n  transform->Translate(0.5, 0.0, 0.0);\n\n  vtkNew<vtkTransformPolyDataFilter> transformF;\n  transformF->SetInputConnection(cone->GetOutputPort());\n  transformF->SetTransform(transform);\n\n  // vtkGlyph3D takes two inputs: the input point set (SetInputConnection)\n  // which can be any vtkDataSet; and the glyph (SetSourceConnection) which\n  // must be a vtkPolyData.  We are interested in orienting the glyphs by the\n  // surface normals that we previously generated.\n  vtkNew<vtkGlyph3D> glyph;\n  glyph->SetInputConnection(ptMask->GetOutputPort());\n  glyph->SetSourceConnection(transformF->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleModeToScaleByVector();\n  glyph->SetScaleFactor(0.004);\n\n  vtkNew<vtkPolyDataMapper> spikeMapper;\n  spikeMapper->SetInputConnection(glyph->GetOutputPort());\n\n  vtkNew<vtkActor> spikeActor;\n  spikeActor->SetMapper(spikeMapper);\n  spikeActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Emerald_Green\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(franActor);\n  ren1->AddActor(spikeActor);\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"SpikeFran\");\n\n  ren1->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // render the image\n  //\n  renWin->Render();\n\n  ren1->GetActiveCamera()->Zoom(1.4);\n  ren1->GetActiveCamera()->Azimuth(110);\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/SpikeFran/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SpikeFran)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersSources\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SpikeFran: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SpikeFran MACOSX_BUNDLE SpikeFran.cxx )\n  target_link_libraries(SpikeFran PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SpikeFran\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/SpikeFran/#download-and-build-spikefran","title":"Download and Build SpikeFran","text":"

        Click here to download SpikeFran and its CMakeLists.txt file. Once the tarball SpikeFran.tar has been downloaded and extracted,

        cd SpikeFran/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SpikeFran\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/SplatFace/","title":"SplatFace","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/SplatFace

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/SplatFace/#description","title":"Description","text":"

        Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction. Points regularly subsampled and overlayed on original mesh.

        Info

        See Figure 9-38b in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/SplatFace/#code","title":"Code","text":"

        SplatFace.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkGaussianSplatter.h>\n#include <vtkMaskPoints.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" fran_cut.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // read cyberware file\n  //\n  vtkNew<vtkPolyDataReader> cyber;\n  cyber->SetFileName(argv[1]);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(cyber->GetOutputPort());\n\n  vtkNew<vtkMaskPoints> mask;\n  mask->SetInputConnection(normals->GetOutputPort());\n  mask->SetOnRatio(8);\n  //   mask->RandomModeOn();\n\n  vtkNew<vtkGaussianSplatter> splatter;\n  splatter->SetInputConnection(mask->GetOutputPort());\n  splatter->SetSampleDimensions(100, 100, 100);\n  splatter->SetEccentricity(2.5);\n  splatter->NormalWarpingOn();\n  splatter->SetScaleFactor(1.0);\n  splatter->SetRadius(0.025);\n\n  vtkNew<vtkContourFilter> contour;\n  contour->SetInputConnection(splatter->GetOutputPort());\n  contour->SetValue(0, 0.25);\n\n  vtkNew<vtkPolyDataMapper> splatMapper;\n  splatMapper->SetInputConnection(contour->GetOutputPort());\n  splatMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> splatActor;\n  splatActor->SetMapper(splatMapper);\n  splatActor->GetProperty()->SetColor(colors->GetColor3d(\"Flesh\").GetData());\n\n  vtkNew<vtkPolyDataMapper> cyberMapper;\n  cyberMapper->SetInputConnection(cyber->GetOutputPort());\n  cyberMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> cyberActor;\n  cyberActor->SetMapper(cyberMapper);\n  cyberActor->GetProperty()->SetRepresentationToWireframe();\n  cyberActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Turquoise\").GetData());\n\n  // Add the actors to the renderer, set the background and size\n  //\n  ren1->AddActor(cyberActor);\n  ren1->AddActor(splatActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"SplatFace\");\n\n  vtkNew<vtkCamera> camera;\n  camera->SetClippingRange(0.0332682, 1.66341);\n  camera->SetFocalPoint(0.0511519, -0.127555, -0.0554379);\n  camera->SetPosition(0.516567, -0.124763, -0.349538);\n  camera->SetViewAngle(18.1279);\n  camera->SetViewUp(-0.013125, 0.99985, -0.0112779);\n  ren1->SetActiveCamera(camera);\n\n  // render the image\n  //\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/SplatFace/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SplatFace)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  IOLegacy\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SplatFace: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SplatFace MACOSX_BUNDLE SplatFace.cxx )\n  target_link_libraries(SplatFace PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SplatFace\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/SplatFace/#download-and-build-splatface","title":"Download and Build SplatFace","text":"

        Click here to download SplatFace and its CMakeLists.txt file. Once the tarball SplatFace.tar has been downloaded and extracted,

        cd SplatFace/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SplatFace\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/Stocks/","title":"Stocks","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/Stocks

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/Stocks/#description","title":"Description","text":"

        Two views of the stock case study. Here the tube filter has been replaced by a ribbon filter followed with a linear extrusion filter.

        Info

        See Figure 12-11 in Chapter 12 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/Stocks/#code","title":"Code","text":"

        Stocks.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkFollower.h>\n#include <vtkLinearExtrusionFilter.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataReader.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRibbonFilter.h>\n#include <vtkSmartPointer.h>\n#include <vtkTransform.h>\n#include <vtkTransformPolyDataFilter.h>\n#include <vtkTubeFilter.h>\n#include <vtkVectorText.h>\n\n#include <vtksys/SystemTools.hxx>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid AddStock(std::vector<vtkSmartPointer<vtkRenderer>> renderers,\n              char* filename, std::string name, double& zPosition,\n              bool useTubes);\n}\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // set up the stocks\n  std::vector<vtkSmartPointer<vtkRenderer>> renderers;\n  vtkNew<vtkRenderer> topRenderer;\n  vtkNew<vtkRenderer> bottomRenderer;\n  renderers.push_back(topRenderer);\n  renderers.push_back(bottomRenderer);\n\n  // List of one or more filenames corresponding to stocks.\n  // e.g. GE.vtk GM.vtk IBM.vtk DEC.vtk [0|1].\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \"\\n A list of one or more filenames corresponding to\\n stocks \"\n                 \"with a flag to use tubes.\\n e.g. GE.vtk GM.vtk \"\n                 \"IBM.vtk DEC.vtk 0\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  bool useTubes = true;\n  if (atoi(argv[argc - 1]) == 1)\n  {\n    useTubes = false;\n  }\n\n  double zPosition = 0.0;\n  for (int i = 1; i < argc - 1; ++i)\n  {\n    AddStock(renderers, argv[i],\n             vtksys::SystemTools::GetFilenameWithoutExtension(argv[i]),\n             zPosition, useTubes);\n  }\n\n  // Setup render window and interactor.\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderers[0]);\n  renderWindow->AddRenderer(renderers[1]);\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  renderers[0]->SetViewport(0.0, .4, 1.0, 1.0);\n  renderers[1]->SetViewport(0.0, 0.0, 1.0, .4);\n\n  renderers[0]->GetActiveCamera()->SetViewAngle(5.0);\n  renderers[0]->ResetCamera();\n  renderers[0]->GetActiveCamera()->Zoom(1.4);\n  renderers[0]->ResetCameraClippingRange();\n  renderers[0]->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  renderers[1]->GetActiveCamera()->SetViewUp(0, 0, -1);\n  renderers[1]->GetActiveCamera()->SetPosition(0, 1, 0);\n  renderers[1]->GetActiveCamera()->SetViewAngle(5.0);\n  renderers[1]->ResetCamera();\n  renderers[1]->GetActiveCamera()->Zoom(2.2);\n  renderers[1]->ResetCameraClippingRange();\n  renderers[1]->SetBackground(colors->GetColor3d(\"LightSteelBlue\").GetData());\n\n  renderWindow->SetSize(500, 800);\n  renderWindow->SetWindowName(\"Stocks\");\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n// Create the stocks.\nvoid AddStock(std::vector<vtkSmartPointer<vtkRenderer>> renderers,\n              char* filename, std::string name, double& zPosition,\n              bool useTubes)\n{\n  std::cout << \"Adding \" << name << std::endl;\n\n  // Read the data.\n  vtkNew<vtkPolyDataReader> PolyDataRead;\n  PolyDataRead->SetFileName(filename);\n  PolyDataRead->Update();\n\n  // Create labels.\n  vtkNew<vtkVectorText> TextSrc;\n  TextSrc->SetText(name.c_str());\n\n  vtkIdType numberOfPoints = PolyDataRead->GetOutput()->GetNumberOfPoints();\n\n  double nameLocation[3];\n  double x, y, z;\n\n  vtkIdType nameIndex = (numberOfPoints - 1) * .8;\n\n  PolyDataRead->GetOutput()->GetPoint(nameIndex, nameLocation);\n\n  x = nameLocation[0] * .15;\n  y = nameLocation[1] + 5.0;\n  z = zPosition;\n\n  // Create a tube and ribbpn filter. One or the other will be used.\n\n  vtkNew<vtkTubeFilter> TubeFilter;\n  TubeFilter->SetInputConnection(PolyDataRead->GetOutputPort());\n  TubeFilter->SetNumberOfSides(8);\n  TubeFilter->SetRadius(0.5);\n  TubeFilter->SetRadiusFactor(10000);\n\n  vtkNew<vtkRibbonFilter> RibbonFilter;\n  RibbonFilter->SetInputConnection(PolyDataRead->GetOutputPort());\n  RibbonFilter->VaryWidthOn();\n  RibbonFilter->SetWidthFactor(5);\n  RibbonFilter->SetDefaultNormal(0, 1, 0);\n  RibbonFilter->UseDefaultNormalOn();\n\n  vtkNew<vtkLinearExtrusionFilter> Extrude;\n  Extrude->SetInputConnection(RibbonFilter->GetOutputPort());\n  Extrude->SetVector(0, 1, 0);\n  Extrude->SetExtrusionType(1);\n  Extrude->SetScaleFactor(0.7);\n\n  vtkNew<vtkTransform> Transform;\n  Transform->Translate(0, 0, zPosition);\n  Transform->Scale(0.15, 1, 1);\n\n  vtkNew<vtkTransformPolyDataFilter> TransformFilter;\n  TransformFilter->SetTransform(Transform);\n\n  // Select tubes or ribbons.\n  if (useTubes)\n  {\n    TransformFilter->SetInputConnection(TubeFilter->GetOutputPort());\n  }\n  else\n  {\n    TransformFilter->SetInputConnection(Extrude->GetOutputPort());\n  }\n  for (size_t r = 0; r < renderers.size(); ++r)\n  {\n    vtkNew<vtkPolyDataMapper> LabelMapper;\n    LabelMapper->SetInputConnection(TextSrc->GetOutputPort());\n\n    vtkNew<vtkFollower> LabelActor;\n    LabelActor->SetMapper(LabelMapper);\n    LabelActor->SetPosition(x, y, z);\n    LabelActor->SetScale(2, 2, 2);\n    LabelActor->SetOrigin(TextSrc->GetOutput()->GetCenter());\n\n    // Increment zPosition.\n    zPosition += 8.0;\n\n    vtkNew<vtkPolyDataMapper> StockMapper;\n    StockMapper->SetInputConnection(TransformFilter->GetOutputPort());\n    StockMapper->SetScalarRange(0, 8000);\n    vtkNew<vtkActor> StockActor;\n    StockActor->SetMapper(StockMapper);\n\n    renderers[r]->AddActor(StockActor);\n    renderers[r]->AddActor(LabelActor);\n    LabelActor->SetCamera(renderers[r]->GetActiveCamera());\n  }\n  return;\n}\n} // namespace\n
        "},{"location":"Cxx/VisualizationAlgorithms/Stocks/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Stocks)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersGeneral\n  FiltersModeling\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Stocks: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Stocks MACOSX_BUNDLE Stocks.cxx )\n  target_link_libraries(Stocks PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Stocks\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/Stocks/#download-and-build-stocks","title":"Download and Build Stocks","text":"

        Click here to download Stocks and its CMakeLists.txt file. Once the tarball Stocks.tar has been downloaded and extracted,

        cd Stocks/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Stocks\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/","title":"StreamlinesWithLineWidget","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/#description","title":"Description","text":""},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/#produce-streamlines-in-the-combustor-dataset","title":"Produce streamlines in the combustor dataset.","text":"

        This example demonstrates how to use the vtkLineWidget to seed and manipulate streamlines. Two line widgets are created. The first is invoked by pressing 'i', the second by pressing 'L' (capital). Both can exist together.

        If the fourth parameter is non-zero, it is used to generate an image with streamlines:

        1. The third parameter value is changed to 25.
        2. The camera position and first line widget are positioned differently.
        3. The streamlines are displayed running from the first line widget.
        4. The second line widget is still available.

        In the C++ version, note how we handle callbacks by first implementing a class, then instantiating it and then passing references to the needed variables to it. Finally we add it as an observer.

        For the Python version we define a class passing the needed variables in the __init__ function and then implementing a _call__ function that does the work.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/#code","title":"Code","text":"

        StreamlinesWithLineWidget.cxx

        /*\nModified from VTK/Examples/GUI/Python/StreamlinesWithLineWidget.py.\nThis program encompasses the functionality of\nStreamlinesWithLineWidget.tcl and LineWidget.tcl.\n\n        Produce streamlines in the combustor dataset.\n\nThis example demonstrates how to use the vtkLineWidget to seed and\nmanipulate streamlines. Two line widgets are created. The first is invoked\nby pressing 'i', the second by pressing 'L' (capital). Both can exist\ntogether.\n\nIf the fourth parameter is non-zero:\n 1) The third parameter value is changed to 25.\n 2) The camera position and first line widget are positioned differently.\n 3) The streamlines are displayed running from the first line widget.\n 4) The second line widget is still available.\nThis is used to test the code.\n\n*/\n\n#include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkLineWidget.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkRibbonFilter.h>\n#include <vtkRungeKutta4.h>\n#include <vtkStreamTracer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridOutlineFilter.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nclass EnableActorCallback : public vtkCallbackCommand\n{\npublic:\n  static EnableActorCallback* New()\n  {\n    return new EnableActorCallback;\n  }\n  void Execute(vtkObject* /*caller*/, unsigned long, void*) override\n  {\n    this->actor->VisibilityOn();\n  }\n  EnableActorCallback() : actor(nullptr)\n  {\n  }\n  vtkActor* actor;\n};\n\n// The Line Widget callback.\nclass LWCallback : public vtkCallbackCommand\n{\npublic:\n  static LWCallback* New()\n  {\n    return new LWCallback;\n  }\n  void Execute(vtkObject* caller, unsigned long, void*) override\n  {\n    vtkLineWidget* lineWidget = reinterpret_cast<vtkLineWidget*>(caller);\n    lineWidget->GetPolyData(this->polyData);\n    this->renWin->Render();\n  }\n  LWCallback() : polyData(nullptr), renWin(nullptr)\n  {\n  }\n  vtkPolyData* polyData;\n  vtkRenderWindow* renWin;\n};\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0]\n              << \" filename1 filename2 [numOfStreamLines] [illustration]\"\n              << std::endl;\n    std::cout << \"where: filename1 is combxyz.bin and filename2 is combq.bin.\"\n              << std::endl;\n    std::cout\n        << \"       numOfStreamLines is the number of streamlines, default 25\"\n        << std::endl;\n    std::cout << \"       illustration, if non-zero, reproduce Fig 7-39 of the \"\n                 \"VTK Textbook.\"\n              << std::endl;\n    std::cout << \"e.g. combxyz.bin combq.bin 10 1\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  auto numOfStreamLines = 25;\n  auto illustration = false;\n  std::string fileName1 = argv[1];\n  std::string fileName2 = argv[2];\n  if (argc > 3)\n  {\n    numOfStreamLines = atoi(argv[3]);\n  }\n  if (argc > 4)\n  {\n    illustration = atoi(argv[4]) != 0;\n    if (illustration)\n    {\n      numOfStreamLines = 25;\n    }\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Start by loading some data.\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(fileName1.c_str());\n  pl3d->SetQFileName(fileName2.c_str());\n  pl3d->SetScalarFunctionNumber(100); // Density\n  pl3d->SetVectorFunctionNumber(202); // Momentum\n  pl3d->Update();\n\n  vtkStructuredGrid* pl3d_output =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // Create the Renderer, RenderWindow and RenderWindowInteractor.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Needed by: vtkStreamTracer and vtkLineWidget.\n  vtkNew<vtkPolyData> seeds;\n  vtkNew<vtkActor> streamline;\n  vtkNew<vtkPolyData> seeds2;\n  vtkNew<vtkActor> streamline2;\n\n  // The line widget is used seed the streamlines.\n  vtkNew<vtkLineWidget> lineWidget;\n  lineWidget->SetResolution(numOfStreamLines);\n  lineWidget->SetInputData(pl3d_output);\n  lineWidget->GetPolyData(seeds);\n  if (illustration)\n  {\n    lineWidget->SetAlignToNone();\n    lineWidget->SetPoint1(0.974678, 5.073630, 31.217961);\n    lineWidget->SetPoint2(0.457544, -4.995921, 31.080175);\n  }\n  else\n  {\n    lineWidget->SetAlignToYAxis();\n  }\n  lineWidget->ClampToBoundsOn();\n  lineWidget->PlaceWidget();\n\n  lineWidget->SetInteractor(iren);\n\n  // Associate the line widget with the interactor and setup the callbacks.\n  vtkNew<LWCallback> GenerateStreamlines;\n  GenerateStreamlines->polyData = seeds;\n  GenerateStreamlines->renWin = renWin;\n  vtkNew<EnableActorCallback> BeginInteraction;\n  BeginInteraction->actor = streamline;\n  lineWidget->AddObserver(vtkCommand::StartInteractionEvent, BeginInteraction);\n  lineWidget->AddObserver(vtkCommand::InteractionEvent, GenerateStreamlines);\n\n  // The second line widget is used seed more streamlines.\n  vtkNew<vtkLineWidget> lineWidget2;\n  lineWidget2->SetResolution(numOfStreamLines);\n  lineWidget2->SetInputData(pl3d_output);\n  lineWidget2->GetPolyData(seeds2);\n  lineWidget2->SetKeyPressActivationValue('L');\n  lineWidget2->SetAlignToZAxis();\n  lineWidget->ClampToBoundsOn();\n  lineWidget2->PlaceWidget();\n\n  lineWidget2->SetInteractor(iren);\n\n  // Associate the line widget with the interactor and setup the callbacks.\n  vtkNew<LWCallback> GenerateStreamlines2;\n  GenerateStreamlines2->polyData = seeds2;\n  GenerateStreamlines2->renWin = renWin;\n  vtkNew<EnableActorCallback> BeginInteraction2;\n  BeginInteraction2->actor = streamline2;\n  lineWidget2->AddObserver(vtkCommand::StartInteractionEvent,\n                           BeginInteraction2);\n  lineWidget2->AddObserver(vtkCommand::InteractionEvent, GenerateStreamlines2);\n\n  // Here we set up two streamlines.\n  vtkNew<vtkRungeKutta4> rk4;\n  vtkNew<vtkStreamTracer> streamer;\n  streamer->SetInputData(pl3d_output);\n  streamer->SetSourceData(seeds);\n  streamer->SetMaximumPropagation(100);\n  streamer->SetInitialIntegrationStep(0.2);\n  streamer->SetIntegrationDirectionToForward();\n  streamer->SetComputeVorticity(1);\n  streamer->SetIntegrator(rk4);\n  vtkNew<vtkRibbonFilter> rf;\n  rf->SetInputConnection(streamer->GetOutputPort());\n  rf->SetWidth(0.1);\n  rf->SetWidthFactor(5);\n  vtkNew<vtkPolyDataMapper> streamMapper;\n  streamMapper->SetInputConnection(rf->GetOutputPort());\n  streamMapper->SetScalarRange(pl3d_output->GetScalarRange());\n  streamline->SetMapper(streamMapper);\n  streamline->VisibilityOff();\n\n  vtkNew<vtkStreamTracer> streamer2;\n  streamer2->SetInputData(pl3d_output);\n  streamer2->SetSourceData(seeds2);\n  streamer2->SetMaximumPropagation(100);\n  streamer2->SetInitialIntegrationStep(0.2);\n  streamer2->SetIntegrationDirectionToForward();\n  streamer2->SetComputeVorticity(1);\n  streamer2->SetIntegrator(rk4);\n  vtkNew<vtkRibbonFilter> rf2;\n  rf2->SetInputConnection(streamer2->GetOutputPort());\n  rf2->SetWidth(0.1);\n  rf2->SetWidthFactor(5);\n  vtkNew<vtkPolyDataMapper> streamMapper2;\n  streamMapper2->SetInputConnection(rf2->GetOutputPort());\n  streamMapper2->SetScalarRange(pl3d_output->GetScalarRange());\n  streamline2->SetMapper(streamMapper2);\n  streamline2->VisibilityOff();\n\n  // Get an outline of the data set for context.\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3d_output);\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n  outlineActor->SetMapper(outlineMapper);\n\n  // Add the actors to the renderer, set the background and size.\n  ren->AddActor(outlineActor);\n  ren->AddActor(streamline);\n  ren->AddActor(streamline2);\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"StreamlinesWithLineWidget\");\n\n  vtkCamera* cam = ren->GetActiveCamera();\n  if (illustration)\n  {\n    // We need to directly display the streamlines in this case.\n    lineWidget->EnabledOn();\n    streamline->VisibilityOn();\n    lineWidget->GetPolyData(seeds);\n    renWin->Render();\n\n    cam->SetClippingRange(14.216207, 68.382915);\n    cam->SetFocalPoint(9.718210, 0.458166, 29.399900);\n    cam->SetPosition(-15.827551, -16.997463, 54.003120);\n    cam->SetViewUp(0.616076, 0.179428, 0.766979);\n    ren->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  }\n  else\n  {\n    lineWidget->EnabledOn();\n    streamline->VisibilityOn();\n    lineWidget->GetPolyData(seeds);\n    renWin->Render();\n\n    cam->SetClippingRange(3.95297, 50);\n    cam->SetFocalPoint(9.71821, 0.458166, 29.3999);\n    cam->SetPosition(2.7439, -37.3196, 38.7167);\n    cam->SetViewUp(-0.16123, 0.264271, 0.950876);\n    ren->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n  }\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(StreamlinesWithLineWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonMath\n  FiltersCore\n  FiltersFlowPaths\n  FiltersModeling\n  IOParallel\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"StreamlinesWithLineWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(StreamlinesWithLineWidget MACOSX_BUNDLE StreamlinesWithLineWidget.cxx )\n  target_link_libraries(StreamlinesWithLineWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS StreamlinesWithLineWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/#download-and-build-streamlineswithlinewidget","title":"Download and Build StreamlinesWithLineWidget","text":"

        Click here to download StreamlinesWithLineWidget and its CMakeLists.txt file. Once the tarball StreamlinesWithLineWidget.tar has been downloaded and extracted,

        cd StreamlinesWithLineWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./StreamlinesWithLineWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/TensorAxes/","title":"TensorAxes","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/TensorAxes

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/TensorAxes/#description","title":"Description","text":"

        This example visualizes the analytical results of Boussinesq's problem from Saada. The figure shows the results by displaying the scaled and oriented principal axes of the stress tensor. (These are called tensor axes.)

        Info

        See Figure 6-22a in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/TensorAxes/#code","title":"Code","text":"

        TensorAxes.cxx

        // Translated from tenAxes.tcl\n\n#include <vtkAxes.h>\n#include <vtkCamera.h>\n#include <vtkConeSource.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointLoad.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTensorGlyph.h>\n#include <vtkTubeFilter.h>\n\nnamespace {\nvoid MakeLogLUT(vtkLookupTable* lut);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and interactive renderer.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Generate the tensors.\n  vtkNew<vtkPointLoad> ptLoad;\n  ptLoad->SetLoadValue(100.0);\n  ptLoad->SetSampleDimensions(6, 6, 6);\n  ptLoad->ComputeEffectiveStressOn();\n  ptLoad->SetModelBounds(-10, 10, -10, 10, -10, 10);\n\n  // Extract a plane of data.\n  vtkNew<vtkImageDataGeometryFilter> plane;\n  plane->SetInputConnection(ptLoad->GetOutputPort());\n  plane->SetExtent(2, 2, 0, 99, 0, 99);\n\n  // Generate the tensor axes.\n  vtkNew<vtkAxes> axes;\n  axes->SetScaleFactor(0.5);\n\n  vtkNew<vtkTubeFilter> tubeAxes;\n  tubeAxes->SetInputConnection(axes->GetOutputPort());\n  tubeAxes->SetRadius(0.1);\n  tubeAxes->SetNumberOfSides(6);\n\n  vtkNew<vtkTensorGlyph> tensorAxes;\n  tensorAxes->SetInputConnection(ptLoad->GetOutputPort());\n  tensorAxes->SetSourceConnection(axes->GetOutputPort());\n  tensorAxes->SetScaleFactor(10);\n  tensorAxes->ClampScalingOn();\n\n  // Map contour\n  vtkNew<vtkLookupTable> lut;\n  MakeLogLUT(lut);\n\n  vtkNew<vtkPolyDataMapper> tensorAxesMapper;\n  tensorAxesMapper->SetInputConnection(tensorAxes->GetOutputPort());\n  tensorAxesMapper->SetLookupTable(lut);\n  plane->Update(); // force update for scalar range\n\n  tensorAxesMapper->SetScalarRange(plane->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> tensorActor;\n  tensorActor->SetMapper(tensorAxesMapper);\n\n  // Create an outline around the data.\n  //\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(ptLoad->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  //\n  // Create a cone whose apex indicates the application of load.\n  //\n  vtkNew<vtkConeSource> coneSrc;\n  coneSrc->SetRadius(0.5);\n  coneSrc->SetHeight(2);\n  vtkNew<vtkPolyDataMapper> coneMap;\n  coneMap->SetInputConnection(coneSrc->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMap);\n  coneActor->SetPosition(0, 0, 11);\n  coneActor->RotateY(90);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(0.113766, -1.13665, -1.01919);\n  camera->SetPosition(-29.4886, -63.1488, 26.5807);\n  camera->SetViewAngle(24.4617);\n  camera->SetViewUp(0.17138, 0.331163, 0.927879);\n  camera->SetClippingRange(1, 100);\n\n  ren->AddActor(tensorActor);\n  ren->AddActor(outlineActor);\n  ren->AddActor(coneActor);\n  ren->SetBackground(colors->GetColor3d(\"WhiteSmoke\").GetData());\n  ren->SetActiveCamera(camera);\n\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"TensorAxes\");\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeLogLUT(vtkLookupTable* lut)\n{\n  // Original\n  lut->SetScaleToLog10();\n  lut->SetHueRange(.6667, 0.0);\n  lut->Build();\n}\n} // namespace\n
        "},{"location":"Cxx/VisualizationAlgorithms/TensorAxes/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TensorAxes)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  FiltersModeling\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TensorAxes: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TensorAxes MACOSX_BUNDLE TensorAxes.cxx )\n  target_link_libraries(TensorAxes PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TensorAxes\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/TensorAxes/#download-and-build-tensoraxes","title":"Download and Build TensorAxes","text":"

        Click here to download TensorAxes and its CMakeLists.txt file. Once the tarball TensorAxes.tar has been downloaded and extracted,

        cd TensorAxes/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TensorAxes\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/TensorEllipsoids/","title":"TensorEllipsoids","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/TensorEllipsoids

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/TensorEllipsoids/#description","title":"Description","text":"

        This example visualizes the analytical results of Boussinesq's problem from Saada. The figure shows the results by displaying the scaled and oriented principal axes as tensor ellipsoids representing the stress tensor. (These are called tensor axes.)

        Info

        See Figure 6-22b in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/TensorEllipsoids/#code","title":"Code","text":"

        TensorEllipsoids.cxx

        // Translated from tenEllip.tcl\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorSeries.h>\n#include <vtkConeSource.h>\n#include <vtkImageDataGeometryFilter.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOutlineFilter.h>\n#include <vtkPointLoad.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTensorGlyph.h>\n\nnamespace {\nvoid MakeLogLUT(vtkLookupTable* lut);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and interactive renderer.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Generate the tensors.\n  vtkNew<vtkPointLoad> ptLoad;\n  ptLoad->SetLoadValue(100.0);\n  ptLoad->SetSampleDimensions(6, 6, 6);\n  ptLoad->ComputeEffectiveStressOn();\n  ptLoad->SetModelBounds(-10, 10, -10, 10, -10, 10);\n\n  // Extract a plane of data.\n  vtkNew<vtkImageDataGeometryFilter> plane;\n  plane->SetInputConnection(ptLoad->GetOutputPort());\n  plane->SetExtent(2, 2, 0, 99, 0, 99);\n\n  // Generate the ellipsoids.\n  vtkNew<vtkSphereSource> sphere;\n  sphere->SetThetaResolution(8);\n  sphere->SetPhiResolution(8);\n  vtkNew<vtkTensorGlyph> tensorEllipsoids;\n  tensorEllipsoids->SetInputConnection(ptLoad->GetOutputPort());\n  tensorEllipsoids->SetSourceConnection(sphere->GetOutputPort());\n  tensorEllipsoids->SetScaleFactor(10);\n  tensorEllipsoids->ClampScalingOn();\n\n  vtkNew<vtkPolyDataNormals> ellipNormals;\n  ellipNormals->SetInputConnection(tensorEllipsoids->GetOutputPort());\n\n  // Map contour.\n  vtkNew<vtkLookupTable> lut;\n  MakeLogLUT(lut);\n  vtkNew<vtkPolyDataMapper> tensorEllipsoidsMapper;\n  tensorEllipsoidsMapper->SetInputConnection(ellipNormals->GetOutputPort());\n  tensorEllipsoidsMapper->SetLookupTable(lut);\n  plane->Update(); // force update for scalar range\n  tensorEllipsoidsMapper->SetScalarRange(plane->GetOutput()->GetScalarRange());\n\n  vtkNew<vtkActor> tensorActor;\n  tensorActor->SetMapper(tensorEllipsoidsMapper);\n\n  // Create an outline around the data.\n  //\n  vtkNew<vtkOutlineFilter> outline;\n  outline->SetInputConnection(ptLoad->GetOutputPort());\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create a cone whose apex indicates the application of load.\n  //\n  vtkNew<vtkConeSource> coneSrc;\n  coneSrc->SetRadius(0.5);\n  coneSrc->SetHeight(2);\n  vtkNew<vtkPolyDataMapper> coneMap;\n  coneMap->SetInputConnection(coneSrc->GetOutputPort());\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMap);\n  coneActor->SetPosition(0, 0, 11);\n  coneActor->RotateY(90);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  vtkNew<vtkCamera> camera;\n  camera->SetFocalPoint(0.113766, -1.13665, -1.01919);\n  camera->SetPosition(-29.4886, -63.1488, 26.5807);\n  camera->SetViewAngle(24.4617);\n  camera->SetViewUp(0.17138, 0.331163, 0.927879);\n  camera->SetClippingRange(1, 100);\n\n  ren->AddActor(tensorActor);\n  ren->AddActor(outlineActor);\n  ren->AddActor(coneActor);\n  ren->SetBackground(colors->GetColor3d(\"WhiteSmoke\").GetData());\n  ren->SetActiveCamera(camera);\n\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"TensorEllipsoids\");\n\n  iren->Initialize();\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid MakeLogLUT(vtkLookupTable* lut)\n{\n  // Make the lookup using a Brewer palette.\n  vtkNew<vtkColorSeries> colorSeries;\n  colorSeries->SetNumberOfColors(8);\n  int colorSeriesEnum = colorSeries->BREWER_DIVERGING_SPECTRAL_8;\n  colorSeries->SetColorScheme(colorSeriesEnum);\n  lut->SetScaleToLog10();\n  colorSeries->BuildLookupTable(lut, colorSeries->ORDINAL);\n  lut->SetNanColor(1, 0, 0, 1);\n  // Original\n  // lut->SetScaleToLog10();\n  // lut->SetHueRange(.6667, 0.0);\n  // lut->Build();\n}\n} // namespace\n
        "},{"location":"Cxx/VisualizationAlgorithms/TensorEllipsoids/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TensorEllipsoids)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersCore\n  FiltersGeometry\n  FiltersModeling\n  FiltersSources\n  ImagingHybrid\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TensorEllipsoids: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TensorEllipsoids MACOSX_BUNDLE TensorEllipsoids.cxx )\n  target_link_libraries(TensorEllipsoids PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TensorEllipsoids\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/TensorEllipsoids/#download-and-build-tensorellipsoids","title":"Download and Build TensorEllipsoids","text":"

        Click here to download TensorEllipsoids and its CMakeLists.txt file. Once the tarball TensorEllipsoids.tar has been downloaded and extracted,

        cd TensorEllipsoids/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TensorEllipsoids\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/TubesFromSplines/","title":"TubesFromSplines","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/TubesFromSplines

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/TubesFromSplines/#description","title":"Description","text":"

        This example shows how to interpolate a set of points and generate tubes around the resulting polyline. Scalars associated with the points are also interpolated and used to vary the radius of the tube.

        Note

        This example was inspired by a question asked by Adam Sankowski.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/TubesFromSplines/#code","title":"Code","text":"

        TubesFromSplines.cxx

        #include <vtkActor.h>\n#include <vtkDoubleArray.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkParametricFunctionSource.h>\n#include <vtkParametricSpline.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n#include <vtkTupleInterpolator.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkPoints> points;\n  points->InsertPoint(0, 1, 0, 0);\n  points->InsertPoint(1, 2, 0, 0);\n  points->InsertPoint(2, 3, 1, 0);\n  points->InsertPoint(3, 4, 1, 0);\n  points->InsertPoint(4, 5, 0, 0);\n  points->InsertPoint(5, 6, 0, 0);\n\n  // Fit a spline to the points.\n  vtkNew<vtkParametricSpline> spline;\n  spline->SetPoints(points);\n  vtkNew<vtkParametricFunctionSource> functionSource;\n  functionSource->SetParametricFunction(spline);\n  functionSource->SetUResolution(10 * points->GetNumberOfPoints());\n  functionSource->Update();\n\n  // Interpolate the scalars.\n  double rad;\n  vtkNew<vtkTupleInterpolator> interpolatedRadius;\n  interpolatedRadius->SetInterpolationTypeToLinear();\n  interpolatedRadius->SetNumberOfComponents(1);\n  rad = .2;\n  interpolatedRadius->AddTuple(0, &rad);\n  rad = .2;\n  interpolatedRadius->AddTuple(1, &rad);\n  rad = .2;\n  interpolatedRadius->AddTuple(2, &rad);\n  rad = .1;\n  interpolatedRadius->AddTuple(3, &rad);\n  rad = .1;\n  interpolatedRadius->AddTuple(4, &rad);\n  rad = .1;\n  interpolatedRadius->AddTuple(5, &rad);\n\n  // Generate the radius scalars.\n  vtkNew<vtkDoubleArray> tubeRadius;\n  unsigned int n = functionSource->GetOutput()->GetNumberOfPoints();\n  tubeRadius->SetNumberOfTuples(n);\n  tubeRadius->SetName(\"TubeRadius\");\n  auto tMin = interpolatedRadius->GetMinimumT();\n  auto tMax = interpolatedRadius->GetMaximumT();\n  double r;\n  for (unsigned int i = 0; i < n; ++i)\n  {\n    auto t = (tMax - tMin) / (n - 1) * i + tMin;\n    interpolatedRadius->InterpolateTuple(t, &r);\n    tubeRadius->SetTuple1(i, r);\n  }\n\n  // Add the scalars to the polydata.\n  auto tubePolyData = functionSource->GetOutput();\n  tubePolyData->GetPointData()->AddArray(tubeRadius);\n  tubePolyData->GetPointData()->SetActiveScalars(\"TubeRadius\");\n\n  // Create the tubes.\n  vtkNew<vtkTubeFilter> tuber;\n  tuber->SetInputData(tubePolyData);\n  tuber->SetNumberOfSides(20);\n  tuber->SetVaryRadiusToVaryRadiusByAbsoluteScalar();\n\n  //--------------\n  // Setup actors and mappers.\n  vtkNew<vtkPolyDataMapper> lineMapper;\n  lineMapper->SetInputData(tubePolyData);\n  lineMapper->SetScalarRange(tubePolyData->GetScalarRange());\n\n  vtkNew<vtkPolyDataMapper> tubeMapper;\n  tubeMapper->SetInputConnection(tuber->GetOutputPort());\n  tubeMapper->SetScalarRange(tubePolyData->GetScalarRange());\n\n  vtkNew<vtkActor> lineActor;\n  lineActor->SetMapper(lineMapper);\n  lineActor->GetProperty()->SetLineWidth(3);\n  vtkNew<vtkActor> tubeActor;\n  tubeActor->SetMapper(tubeMapper);\n  tubeActor->GetProperty()->SetOpacity(0.6);\n\n  // Setup render window, renderer, and interactor.\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  renderer->UseHiddenLineRemovalOn();\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"TubesFromSplines\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  renderer->AddActor(lineActor);\n  renderer->AddActor(tubeActor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/TubesFromSplines/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TubesFromSplines)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonComputationalGeometry\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TubesFromSplines: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TubesFromSplines MACOSX_BUNDLE TubesFromSplines.cxx )\n  target_link_libraries(TubesFromSplines PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TubesFromSplines\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/TubesFromSplines/#download-and-build-tubesfromsplines","title":"Download and Build TubesFromSplines","text":"

        Click here to download TubesFromSplines and its CMakeLists.txt file. Once the tarball TubesFromSplines.tar has been downloaded and extracted,

        cd TubesFromSplines/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TubesFromSplines\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/","title":"TubesWithVaryingRadiusAndColors","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/#description","title":"Description","text":"

        This example shows how to vary the radius of a tube with one scalar and color the tube with another.

        • Contributed by Marcus Thamson

        Note

        This original source code for this example is here.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/#code","title":"Code","text":"

        TubesWithVaryingRadiusAndColors.cxx

        #include <math.h>\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCellArray.h>\n#include <vtkDoubleArray.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointData.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTubeFilter.h>\n#include <vtkUnsignedCharArray.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> nc;\n\n  // Spiral tube\n  unsigned int nV = 256;       // No. of vertices\n  unsigned int nCyc = 5;       // No. of spiral cycles\n  double rT1 = 0.1, rT2 = 0.5; // Start/end tube radii\n  double rS = 2;               // Spiral radius\n  double h = 10;               // Height\n  unsigned int nTv = 8;        // No. of surface elements for each tube vertex\n\n  // Create points and cells for the helix.\n  vtkNew<vtkPoints> points;\n  for (unsigned int i = 0; i < nV; i++)\n  {\n    // Helcial coordinates\n    auto vX = rS * cos(2 * vtkMath::Pi() * nCyc * i / (nV - 1));\n    auto vY = rS * sin(2 * vtkMath::Pi() * nCyc * i / (nV - 1));\n    auto vZ = h * i / nV;\n    points->InsertPoint(i, vX, vY, vZ);\n  }\n\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(nV);\n  for (unsigned int i = 0; i < nV; i++)\n  {\n    lines->InsertCellPoint(i);\n  }\n\n  vtkNew<vtkPolyData> polyData;\n  polyData->SetPoints(points);\n  polyData->SetLines(lines);\n\n  // Varying tube radius using sine-function.\n  vtkNew<vtkDoubleArray> tubeRadius;\n  tubeRadius->SetName(\"TubeRadius\");\n  tubeRadius->SetNumberOfTuples(nV);\n  for (unsigned int i = 0; i < nV; i++)\n  {\n    tubeRadius->SetTuple1(\n        i, rT1 + (rT2 - rT1) * sin(vtkMath::Pi() * i / (nV - 1)));\n  }\n  polyData->GetPointData()->AddArray(tubeRadius);\n  polyData->GetPointData()->SetActiveScalars(\"TubeRadius\");\n\n  // RBG array (could add Alpha channel too I guess...).\n  // Varying from blue to red.\n  vtkNew<vtkUnsignedCharArray> colors;\n  colors->SetName(\"Colors\");\n  colors->SetNumberOfComponents(3);\n  colors->SetNumberOfTuples(nV);\n  for (unsigned int i = 0; i < nV; i++)\n  {\n    colors->InsertTuple3(i, int(255 * i / (nV - 1)), 0,\n                         int(255 * (nV - 1 - i) / (nV - 1)));\n  }\n  polyData->GetPointData()->AddArray(colors);\n\n  vtkNew<vtkTubeFilter> tube;\n  tube->SetInputData(polyData);\n  tube->SetNumberOfSides(nTv);\n  tube->SetVaryRadiusToVaryRadiusByAbsoluteScalar();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(tube->GetOutputPort());\n  mapper->ScalarVisibilityOn();\n  mapper->SetScalarModeToUsePointFieldData();\n  mapper->SelectColorArray(\"Colors\");\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(nc->GetColor3d(\"SteelBlue\").GetData());\n\n  // Make an oblique view.\n  renderer->GetActiveCamera()->Azimuth(30);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  iren->SetRenderWindow(renWin);\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(500, 500);\n  renWin->Render();\n  renWin->SetWindowName(\"TubesWithVaryingRadiusAndColors\");\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  iren->SetInteractorStyle(style);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TubesWithVaryingRadiusAndColors)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TubesWithVaryingRadiusAndColors: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TubesWithVaryingRadiusAndColors MACOSX_BUNDLE TubesWithVaryingRadiusAndColors.cxx )\n  target_link_libraries(TubesWithVaryingRadiusAndColors PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TubesWithVaryingRadiusAndColors\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/#download-and-build-tubeswithvaryingradiusandcolors","title":"Download and Build TubesWithVaryingRadiusAndColors","text":"

        Click here to download TubesWithVaryingRadiusAndColors and its CMakeLists.txt file. Once the tarball TubesWithVaryingRadiusAndColors.tar has been downloaded and extracted,

        cd TubesWithVaryingRadiusAndColors/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TubesWithVaryingRadiusAndColors\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/VelocityProfile/","title":"VelocityProfile","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/VelocityProfile

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/VelocityProfile/#description","title":"Description","text":"

        This example shows shows warped planes in a structured grid dataset. The planes are warped according to flow momentum. The relative back and forward flow are clearly visible in the deformation of the planes.

        Info

        See Figure 6-14b in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/VelocityProfile/#code","title":"Code","text":"

        VelocityProfile.cxx

        // Translated from velProf.tcl.\n\n#include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkWarpVector.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename1 filename2\" << std::endl;\n    std::cout << \"where: filename1 is combxyz.bin and filename2 is combq.bin.\"\n              << std::endl;\n    std::cout << \"Produces figure 6-14(b) Flow momentum from the VTK Textbook.\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string fileName1 = argv[1];\n  std::string fileName2 = argv[2];\n\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 4> bkg{{65, 99, 149}};\n  colors->SetColor(\"BkgColor\", bkg.data());\n\n  // Read a vtk file\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(fileName1.c_str());\n  pl3d->SetQFileName(fileName2.c_str());\n  pl3d->SetScalarFunctionNumber(100); // Density\n  pl3d->SetVectorFunctionNumber(202); // Momentum\n  pl3d->Update();\n\n  vtkStructuredGrid* pl3dOutput =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // What do we know about the data?\n  // Get the extent of the data: imin, imax, jmin, jmax, kmin, kmax\n  int extent[6] = {0, 0, 0, 0, 0, 0};\n  pl3dOutput->GetExtent(extent);\n  double scalarRange[2] = {0.0, 0.0};\n  pl3dOutput->GetScalarRange(scalarRange);\n\n  // Planes are specified using a imin, imax, jmin, jmax, kmin, kmax coordinate\n  // specification. Min and max i,j,k values are clamped to 0 and maximum value.\n  // See the variable named extent for the values.\n  //\n  vtkNew<vtkStructuredGridGeometryFilter> plane;\n  plane->SetInputData(pl3dOutput);\n  plane->SetExtent(10, 10, 1, extent[3], 1, extent[5]);\n\n  vtkNew<vtkStructuredGridGeometryFilter> plane2;\n  plane2->SetInputData(pl3dOutput);\n  plane2->SetExtent(30, 30, 1, extent[3], 1, extent[5]);\n\n  vtkNew<vtkStructuredGridGeometryFilter> plane3;\n  plane3->SetInputData(pl3dOutput);\n  plane3->SetExtent(45, 45, 1, extent[3], 1, extent[5]);\n\n  // We use an append filter because that way we can do the warping, etc. just\n  // using a single pipeline and actor.\n  //\n  vtkNew<vtkAppendPolyData> appendF;\n  appendF->AddInputConnection(plane->GetOutputPort());\n  appendF->AddInputConnection(plane2->GetOutputPort());\n  appendF->AddInputConnection(plane3->GetOutputPort());\n\n  // Warp\n  vtkNew<vtkWarpVector> warp;\n  warp->SetInputConnection(appendF->GetOutputPort());\n  warp->SetScaleFactor(0.005);\n  warp->Update();\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputData(warp->GetPolyDataOutput());\n  normals->SetFeatureAngle(45);\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(normals->GetOutputPort());\n  planeMapper->SetScalarRange(scalarRange);\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n\n  // The outline provides context for the data and the planes.\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3dOutput);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren->AddActor(planeActor);\n  ren->AddActor(outlineActor);\n  ren->SetBackground(colors->GetColor3d(\"BkgColor\").GetData());\n\n  renWin->SetSize(512, 512);\n  renWin->SetWindowName(\"VelocityProfile\");\n\n  iren->Initialize();\n\n  renWin->Render();\n\n  ren->GetActiveCamera()->SetPosition(19.8562, -31.8912, 47.0755);\n  ren->GetActiveCamera()->SetFocalPoint(8.255, 0.147815, 29.7631);\n  ren->GetActiveCamera()->SetViewUp(-0.0333325, 0.465756, 0.884285);\n  ren->GetActiveCamera()->SetClippingRange(17.3078, 64.6375);\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/VelocityProfile/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(VelocityProfile)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"VelocityProfile: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(VelocityProfile MACOSX_BUNDLE VelocityProfile.cxx )\n  target_link_libraries(VelocityProfile PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS VelocityProfile\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/VelocityProfile/#download-and-build-velocityprofile","title":"Download and Build VelocityProfile","text":"

        Click here to download VelocityProfile and its CMakeLists.txt file. Once the tarball VelocityProfile.tar has been downloaded and extracted,

        cd VelocityProfile/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./VelocityProfile\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VisualizationAlgorithms/WarpCombustor/","title":"WarpCombustor","text":"

        vtk-examples/Cxx/VisualizationAlgorithms/WarpCombustor

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VisualizationAlgorithms/WarpCombustor/#description","title":"Description","text":"

        This example demonstrates how to extract \"computational planes\" from a structured dataset. Structured data has a natural, logical coordinate system based on i-j-k indices. Specifying imin,imax, jmin,jmax, kmin,kmax pairs can indicate a point, line, plane, or volume of data.

        In this example, we extract three planes and warp them using scalar values in the direction of the local normal at each point. This gives a sort of \"velocity profile\" that indicates the nature of the flow.

        Info

        See Figure 9-4b in Chapter 9 The VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VisualizationAlgorithms/WarpCombustor/#code","title":"Code","text":"

        WarpCombustor.cxx

        #include <vtkActor.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCamera.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridGeometryFilter.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkWarpScalar.h>\n\n#include <iostream>\n#include <string>\n\n// This example demonstrates how to extract \"computational planes\" from a\n// structured dataset. Structured data has a natural, logical coordinate\n// system based on i-j-k indices. Specifying imin,imax, jmin,jmax, kmin,kmax\n// pairs can indicate a point, line, plane, or volume of data.\n//\n// In this example, we extract three planes and warp them using scalar values\n// in the direction of the local normal at each point. This gives a sort of\n// \"velocity profile\" that indicates the nature of the flow.\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  // Here we read data from a annular combustor. A combustor burns fuel and air\n  // in a gas turbine (e.g., a jet engine) and the hot gas eventually makes its\n  // way to the turbine section.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkStructuredGrid* pl3dOutput =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // Planes are specified using a imin,imax, jmin,jmax, kmin,kmax coordinate\n  // specification. Min and max i,j,k values are clamped to 0 and maximum value.\n  //\n  vtkNew<vtkStructuredGridGeometryFilter> plane;\n  plane->SetInputData(pl3dOutput);\n  plane->SetExtent(10, 10, 1, 100, 1, 100);\n\n  vtkNew<vtkStructuredGridGeometryFilter> plane2;\n  plane2->SetInputData(pl3dOutput);\n  plane2->SetExtent(30, 30, 1, 100, 1, 100);\n  vtkNew<vtkStructuredGridGeometryFilter> plane3;\n  plane3->SetInputData(pl3dOutput);\n  plane3->SetExtent(45, 45, 1, 100, 1, 100);\n\n  // We use an append filter because that way we can do the warping, etc. just\n  // using a single pipeline and actor.\n  //\n  vtkNew<vtkAppendPolyData> appendF;\n  appendF->AddInputConnection(plane->GetOutputPort());\n  appendF->AddInputConnection(plane2->GetOutputPort());\n  appendF->AddInputConnection(plane3->GetOutputPort());\n\n  vtkNew<vtkWarpScalar> warp;\n  warp->SetInputConnection(appendF->GetOutputPort());\n  warp->UseNormalOn();\n  warp->SetNormal(1.0, 0.0, 0.0);\n  warp->SetScaleFactor(2.5);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(warp->GetOutputPort());\n  normals->SetFeatureAngle(60);\n\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(normals->GetOutputPort());\n  planeMapper->SetScalarRange(pl3dOutput->GetScalarRange());\n\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n\n  // The outline provides context for the data and the planes.\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3dOutput);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Black\").GetData());\n\n  // Create the usual graphics stuff.\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  ren1->AddActor(outlineActor);\n  ren1->AddActor(planeActor);\n  ren1->SetBackground(colors->GetColor3d(\"Silver\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"WarpCombustor\");\n\n  // Create an initial view.\n  ren1->GetActiveCamera()->SetClippingRange(3.95297, 50);\n  ren1->GetActiveCamera()->SetFocalPoint(8.88908, 0.595038, 29.3342);\n  ren1->GetActiveCamera()->SetPosition(-12.3332, 31.7479, 41.2387);\n  ren1->GetActiveCamera()->SetViewUp(0.060772, -0.319905, 0.945498);\n  iren->Initialize();\n\n  // Render the image.\n  //\n  renWin->Render();\n  iren->Start();\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VisualizationAlgorithms/WarpCombustor/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(WarpCombustor)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  FiltersGeometry\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"WarpCombustor: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(WarpCombustor MACOSX_BUNDLE WarpCombustor.cxx )\n  target_link_libraries(WarpCombustor PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS WarpCombustor\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VisualizationAlgorithms/WarpCombustor/#download-and-build-warpcombustor","title":"Download and Build WarpCombustor","text":"

        Click here to download WarpCombustor and its CMakeLists.txt file. Once the tarball WarpCombustor.tar has been downloaded and extracted,

        cd WarpCombustor/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./WarpCombustor\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/","title":"FixedPointVolumeRayCastMapperCT","text":"

        vtk-examples/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT

        "},{"location":"Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/#description","title":"Description","text":"

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Note

        This original source code for this example is here.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/#code","title":"Code","text":"

        FixedPointVolumeRayCastMapperCT.cxx

        #include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkDICOMImageReader.h>\n#include <vtkFixedPointVolumeRayCastMapper.h>\n#include <vtkImageData.h>\n#include <vtkImageResample.h>\n#include <vtkInteractorObserver.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVolume.h>\n#include <vtkVolumeProperty.h>\n#include <vtkXMLImageDataReader.h>\n\n#include <iostream>\n#include <string>\n\n#define VTI_FILETYPE 1\n#define MHA_FILETYPE 2\n\nnamespace {\nvoid PrintUsage()\n{\n  std::cout << \"Usage: \" << std::endl;\n  std::cout << std::endl;\n  std::cout << \"  FixedPointVolumeRayCastMapperCT <options>\" << std::endl;\n  std::cout << std::endl;\n  std::cout << \"where options may include: \" << std::endl;\n  std::cout << std::endl;\n  std::cout << \"  -DICOM <directory>\" << std::endl;\n  std::cout << \"  -VTI <filename>\" << std::endl;\n  std::cout << \"  -MHA <filename>\" << std::endl;\n  std::cout << \"  -DependentComponents\" << std::endl;\n  std::cout << \"  -Clip\" << std::endl;\n  std::cout << \"  -MIP <window> <level>\" << std::endl;\n  std::cout << \"  -CompositeRamp <window> <level>\" << std::endl;\n  std::cout << \"  -CompositeShadeRamp <window> <level>\" << std::endl;\n  std::cout << \"  -CT_Skin\" << std::endl;\n  std::cout << \"  -CT_Bone\" << std::endl;\n  std::cout << \"  -CT_Muscle\" << std::endl;\n  std::cout << \"  -FrameRate <rate>\" << std::endl;\n  std::cout << \"  -DataReduction <factor>\" << std::endl;\n  std::cout << std::endl;\n  std::cout\n      << \"You must use either the -DICOM option to specify the directory where\"\n      << std::endl;\n  std::cout\n      << \"the data is located or the -VTI or -MHA option to specify the path \"\n         \"of a .vti file.\"\n      << std::endl;\n  std::cout << std::endl;\n  std::cout << \"By default, the program assumes that the file has independent \"\n               \"components,\"\n            << std::endl;\n  std::cout\n      << \"use -DependentComponents to specify that the file has dependent \"\n         \"components.\"\n      << std::endl;\n  std::cout << std::endl;\n  std::cout << \"Use the -Clip option to display a cube widget for clipping the \"\n               \"volume.\"\n            << std::endl;\n  std::cout\n      << \"Use the -FrameRate option with a desired frame rate (in frames per \"\n         \"second)\"\n      << std::endl;\n  std::cout << \"which will control the interactive rendering rate.\"\n            << std::endl;\n  std::cout\n      << \"Use the -DataReduction option with a reduction factor (greater than \"\n         \"zero and\"\n      << std::endl;\n  std::cout << \"less than one) to reduce the data before rendering.\"\n            << std::endl;\n  std::cout << \"Use one of the remaining options to specify the blend function\"\n            << std::endl;\n  std::cout\n      << \"and transfer functions. The -MIP option utilizes a maximum intensity\"\n      << std::endl;\n  std::cout << \"projection method, while the others utilize compositing. The\"\n            << std::endl;\n  std::cout << \"-CompositeRamp option is unshaded compositing, while the other\"\n            << std::endl;\n  std::cout << \"compositing options employ shading.\" << std::endl;\n  std::cout << std::endl;\n  std::cout << \"Note: MIP, CompositeRamp, CompositeShadeRamp, CT_Skin, CT_Bone,\"\n            << std::endl;\n  std::cout\n      << \"and CT_Muscle are appropriate for DICOM data. MIP, CompositeRamp,\"\n      << std::endl;\n  std::cout << \"and RGB_Composite are appropriate for RGB data.\" << std::endl;\n  std::cout << std::endl;\n  std::cout\n      << \"Example: FixedPointVolumeRayCastMapperCT -DICOM CTNeck -MIP 4096 1024\"\n      << std::endl;\n  std::cout << \"e.g. -MHA /FullHead.mhd -CT_Bone\" << std::endl;\n  std::cout << std::endl;\n}\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  // Parse the parameters\n\n  int count = 1;\n  char* dirname = NULL;\n  double opacityWindow = 4096;\n  double opacityLevel = 2048;\n  int blendType = 0;\n  int clip = 0;\n  double reductionFactor = 1.0;\n  double frameRate = 10.0;\n  char* fileName = 0;\n  int fileType = 0;\n\n  bool independentComponents = true;\n\n  while (count < argc)\n  {\n    if (!strcmp(argv[count], \"?\"))\n    {\n      PrintUsage();\n      exit(EXIT_SUCCESS);\n    }\n    else if (!strcmp(argv[count], \"-DICOM\"))\n    {\n      size_t size = strlen(argv[count + 1]) + 1;\n      dirname = new char[size];\n      snprintf(dirname, size, \"%s\", argv[count + 1]);\n      count += 2;\n    }\n    else if (!strcmp(argv[count], \"-VTI\"))\n    {\n      size_t size = strlen(argv[count + 1]) + 1;\n      fileName = new char[size];\n      fileType = VTI_FILETYPE;\n      snprintf(fileName, size, \"%s\", argv[count + 1]);\n      count += 2;\n    }\n    else if (!strcmp(argv[count], \"-MHA\"))\n    {\n      size_t size = strlen(argv[count + 1]) + 1;\n      fileName = new char[size];\n      fileType = MHA_FILETYPE;\n      snprintf(fileName, size, \"%s\", argv[count + 1]);\n      count += 2;\n    }\n    else if (!strcmp(argv[count], \"-Clip\"))\n    {\n      clip = 1;\n      count++;\n    }\n    else if (!strcmp(argv[count], \"-MIP\"))\n    {\n      opacityWindow = atof(argv[count + 1]);\n      opacityLevel = atof(argv[count + 2]);\n      blendType = 0;\n      count += 3;\n    }\n    else if (!strcmp(argv[count], \"-CompositeRamp\"))\n    {\n      opacityWindow = atof(argv[count + 1]);\n      opacityLevel = atof(argv[count + 2]);\n      blendType = 1;\n      count += 3;\n    }\n    else if (!strcmp(argv[count], \"-CompositeShadeRamp\"))\n    {\n      opacityWindow = atof(argv[count + 1]);\n      opacityLevel = atof(argv[count + 2]);\n      blendType = 2;\n      count += 3;\n    }\n    else if (!strcmp(argv[count], \"-CT_Skin\"))\n    {\n      blendType = 3;\n      count += 1;\n    }\n    else if (!strcmp(argv[count], \"-CT_Bone\"))\n    {\n      blendType = 4;\n      count += 1;\n    }\n    else if (!strcmp(argv[count], \"-CT_Muscle\"))\n    {\n      blendType = 5;\n      count += 1;\n    }\n    else if (!strcmp(argv[count], \"-RGB_Composite\"))\n    {\n      blendType = 6;\n      count += 1;\n    }\n    else if (!strcmp(argv[count], \"-FrameRate\"))\n    {\n      frameRate = atof(argv[count + 1]);\n      if (frameRate < 0.01 || frameRate > 60.0)\n      {\n        std::cout << \"Invalid frame rate - use a number between 0.01 and 60.0\"\n                  << std::endl;\n        std::cout << \"Using default frame rate of 10 frames per second.\"\n                  << std::endl;\n        frameRate = 10.0;\n      }\n      count += 2;\n    }\n    else if (!strcmp(argv[count], \"-ReductionFactor\"))\n    {\n      reductionFactor = atof(argv[count + 1]);\n      if (reductionFactor <= 0.0 || reductionFactor >= 1.0)\n      {\n        std::cout << \"Invalid reduction factor - use a number between 0 and 1 \"\n                     \"(exclusive)\"\n                  << std::endl;\n        std::cout << \"Using the default of no reduction.\" << std::endl;\n        reductionFactor = 1.0;\n      }\n      count += 2;\n    }\n    else if (!strcmp(argv[count], \"-DependentComponents\"))\n    {\n      independentComponents = false;\n      count += 1;\n    }\n    else\n    {\n      std::cout << \"Unrecognized option: \" << argv[count] << std::endl;\n      std::cout << std::endl;\n      PrintUsage();\n      exit(EXIT_FAILURE);\n    }\n  }\n\n  if (!dirname && !fileName)\n  {\n    std::cout\n        << \"Error: you must specify a directory of DICOM data or a .vti file \"\n           \"or a .mha!\"\n        << std::endl;\n    std::cout << std::endl;\n    PrintUsage();\n    exit(EXIT_FAILURE);\n  }\n\n  // Create the renderer, render window and interactor\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n\n  // Connect it all. Note that funny arithematic on the\n  // SetDesiredUpdateRate - the vtkRenderWindow divides it\n  // allocated time across all renderers, and the renderer\n  // divides it time across all props. If clip is\n  // true then there are two props\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  iren->SetDesiredUpdateRate(frameRate / (1 + clip));\n\n  iren->GetInteractorStyle()->SetDefaultRenderer(renderer);\n\n  // Read the data\n  vtkSmartPointer<vtkAlgorithm> reader;\n  vtkSmartPointer<vtkImageData> input;\n  if (dirname)\n  {\n    vtkNew<vtkDICOMImageReader> dicomReader;\n    dicomReader->SetDirectoryName(dirname);\n    dicomReader->Update();\n    input = dicomReader->GetOutput();\n    reader = dicomReader;\n  }\n  else if (fileType == VTI_FILETYPE)\n  {\n    vtkNew<vtkXMLImageDataReader> xmlReader;\n    xmlReader->SetFileName(fileName);\n    xmlReader->Update();\n    input = xmlReader->GetOutput();\n    reader = xmlReader;\n  }\n  else if (fileType == MHA_FILETYPE)\n  {\n    vtkNew<vtkMetaImageReader> metaReader;\n    metaReader->SetFileName(fileName);\n    metaReader->Update();\n    input = metaReader->GetOutput();\n    reader = metaReader;\n  }\n  else\n  {\n    std::cout << \"Error! Not VTI or MHA!\" << std::endl;\n    exit(EXIT_FAILURE);\n  }\n\n  // Verify that we actually have a volume\n  int dim[3];\n  input->GetDimensions(dim);\n\n  if (dim[0] < 2 || dim[1] < 2 || dim[2] < 2)\n  {\n    std::cout << \"Error loading data!\" << std::endl;\n    exit(EXIT_FAILURE);\n  }\n\n  vtkNew<vtkImageResample> resample;\n  if (reductionFactor < 1.0)\n  {\n    resample->SetInputConnection(reader->GetOutputPort());\n    resample->SetAxisMagnificationFactor(0, reductionFactor);\n    resample->SetAxisMagnificationFactor(1, reductionFactor);\n    resample->SetAxisMagnificationFactor(2, reductionFactor);\n  }\n\n  // Create our volume and mapper\n  vtkNew<vtkVolume> volume;\n  vtkNew<vtkFixedPointVolumeRayCastMapper> mapper;\n\n  if (reductionFactor < 1.0)\n  {\n    mapper->SetInputConnection(resample->GetOutputPort());\n  }\n  else\n  {\n    mapper->SetInputConnection(reader->GetOutputPort());\n  }\n\n  // Set the sample distance on the ray to be 1/2 the average spacing\n  double spacing[3];\n  if (reductionFactor < 1.0)\n  {\n    resample->GetOutput()->GetSpacing(spacing);\n  }\n  else\n  {\n    input->GetSpacing(spacing);\n  }\n\n  //  mapper->SetSampleDistance( (spacing[0]+spacing[1]+spacing[2])/6.0 );\n  //  mapper->SetMaximumImageSampleDistance(10.0);\n\n  // Create our transfer function\n  vtkNew<vtkColorTransferFunction> colorFun;\n  vtkNew<vtkPiecewiseFunction> opacityFun;\n  // Create the property and attach the transfer functions\n  vtkNew<vtkVolumeProperty> property;\n  property->SetIndependentComponents(independentComponents);\n  property->SetColor(colorFun);\n  property->SetScalarOpacity(opacityFun);\n  property->SetInterpolationTypeToLinear();\n\n  // connect up the volume to the property and the mapper\n  volume->SetProperty(property);\n  volume->SetMapper(mapper);\n\n  // Depending on the blend type selected as a command line option,\n  // adjust the transfer function\n  switch (blendType)\n  {\n  // MIP\n  // Create an opacity ramp from the window and level values.\n  // Color is white. Blending is MIP.\n  case 0:\n    colorFun->AddRGBSegment(0.0, 1.0, 1.0, 1.0, 255.0, 1.0, 1.0, 1.0);\n    opacityFun->AddSegment(opacityLevel - 0.5 * opacityWindow, 0.0,\n                           opacityLevel + 0.5 * opacityWindow, 1.0);\n    mapper->SetBlendModeToMaximumIntensity();\n    break;\n\n  // CompositeRamp\n  // Create a ramp from the window and level values. Use compositing\n  // without shading. Color is a ramp from black to white.\n  case 1:\n    colorFun->AddRGBSegment(opacityLevel - 0.5 * opacityWindow, 0.0, 0.0, 0.0,\n                            opacityLevel + 0.5 * opacityWindow, 1.0, 1.0, 1.0);\n    opacityFun->AddSegment(opacityLevel - 0.5 * opacityWindow, 0.0,\n                           opacityLevel + 0.5 * opacityWindow, 1.0);\n    mapper->SetBlendModeToComposite();\n    property->ShadeOff();\n    break;\n\n  // CompositeShadeRamp\n  // Create a ramp from the window and level values. Use compositing\n  // with shading. Color is white.\n  case 2:\n    colorFun->AddRGBSegment(0.0, 1.0, 1.0, 1.0, 255.0, 1.0, 1.0, 1.0);\n    opacityFun->AddSegment(opacityLevel - 0.5 * opacityWindow, 0.0,\n                           opacityLevel + 0.5 * opacityWindow, 1.0);\n    mapper->SetBlendModeToComposite();\n    property->ShadeOn();\n    break;\n\n  // CT_Skin\n  // Use compositing and functions set to highlight skin in CT data\n  // Not for use on RGB data\n  case 3:\n    colorFun->AddRGBPoint(-3024, 0, 0, 0, 0.5, 0.0);\n    colorFun->AddRGBPoint(-1000, .62, .36, .18, 0.5, 0.0);\n    colorFun->AddRGBPoint(-500, .88, .60, .29, 0.33, 0.45);\n    colorFun->AddRGBPoint(3071, .83, .66, 1, 0.5, 0.0);\n\n    opacityFun->AddPoint(-3024, 0, 0.5, 0.0);\n    opacityFun->AddPoint(-1000, 0, 0.5, 0.0);\n    opacityFun->AddPoint(-500, 1.0, 0.33, 0.45);\n    opacityFun->AddPoint(3071, 1.0, 0.5, 0.0);\n\n    mapper->SetBlendModeToComposite();\n    property->ShadeOn();\n    property->SetAmbient(0.1);\n    property->SetDiffuse(0.9);\n    property->SetSpecular(0.2);\n    property->SetSpecularPower(10.0);\n    property->SetScalarOpacityUnitDistance(0.8919);\n    break;\n\n  // CT_Bone\n  // Use compositing and functions set to highlight bone in CT data\n  // Not for use on RGB data\n  case 4:\n    colorFun->AddRGBPoint(-3024, 0, 0, 0, 0.5, 0.0);\n    colorFun->AddRGBPoint(-16, 0.73, 0.25, 0.30, 0.49, .61);\n    colorFun->AddRGBPoint(641, .90, .82, .56, .5, 0.0);\n    colorFun->AddRGBPoint(3071, 1, 1, 1, .5, 0.0);\n\n    opacityFun->AddPoint(-3024, 0, 0.5, 0.0);\n    opacityFun->AddPoint(-16, 0, .49, .61);\n    opacityFun->AddPoint(641, .72, .5, 0.0);\n    opacityFun->AddPoint(3071, .71, 0.5, 0.0);\n\n    mapper->SetBlendModeToComposite();\n    property->ShadeOn();\n    property->SetAmbient(0.1);\n    property->SetDiffuse(0.9);\n    property->SetSpecular(0.2);\n    property->SetSpecularPower(10.0);\n    property->SetScalarOpacityUnitDistance(0.8919);\n    break;\n\n  // CT_Muscle\n  // Use compositing and functions set to highlight muscle in CT data\n  // Not for use on RGB data\n  case 5:\n    colorFun->AddRGBPoint(-3024, 0, 0, 0, 0.5, 0.0);\n    colorFun->AddRGBPoint(-155, .55, .25, .15, 0.5, .92);\n    colorFun->AddRGBPoint(217, .88, .60, .29, 0.33, 0.45);\n    colorFun->AddRGBPoint(420, 1, .94, .95, 0.5, 0.0);\n    colorFun->AddRGBPoint(3071, .83, .66, 1, 0.5, 0.0);\n\n    opacityFun->AddPoint(-3024, 0, 0.5, 0.0);\n    opacityFun->AddPoint(-155, 0, 0.5, 0.92);\n    opacityFun->AddPoint(217, .68, 0.33, 0.45);\n    opacityFun->AddPoint(420, .83, 0.5, 0.0);\n    opacityFun->AddPoint(3071, .80, 0.5, 0.0);\n\n    mapper->SetBlendModeToComposite();\n    property->ShadeOn();\n    property->SetAmbient(0.1);\n    property->SetDiffuse(0.9);\n    property->SetSpecular(0.2);\n    property->SetSpecularPower(10.0);\n    property->SetScalarOpacityUnitDistance(0.8919);\n    break;\n\n  // RGB_Composite\n  // Use compositing and functions set to highlight red/green/blue regions\n  // in RGB data. Not for use on single component data\n  case 6:\n    opacityFun->AddPoint(0, 0.0);\n    opacityFun->AddPoint(5.0, 0.0);\n    opacityFun->AddPoint(30.0, 0.05);\n    opacityFun->AddPoint(31.0, 0.0);\n    opacityFun->AddPoint(90.0, 0.0);\n    opacityFun->AddPoint(100.0, 0.3);\n    opacityFun->AddPoint(110.0, 0.0);\n    opacityFun->AddPoint(190.0, 0.0);\n    opacityFun->AddPoint(200.0, 0.4);\n    opacityFun->AddPoint(210.0, 0.0);\n    opacityFun->AddPoint(245.0, 0.0);\n    opacityFun->AddPoint(255.0, 0.5);\n\n    mapper->SetBlendModeToComposite();\n    property->ShadeOff();\n    property->SetScalarOpacityUnitDistance(1.0);\n    break;\n  default:\n    vtkGenericWarningMacro(\"Unknown blend type.\");\n    break;\n  }\n\n  // Set the default window size\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"FixedPointVolumeRayCastMapperCT\");\n  renWin->Render();\n\n  // Add the volume to the scene\n  renderer->AddVolume(volume);\n\n  renderer->ResetCamera();\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  auto camera = renderer->GetActiveCamera();\n  camera->SetPosition(56.8656, -297.084, 78.913);\n  camera->SetFocalPoint(109.139, 120.604, 63.5486);\n  camera->SetViewUp(-0.00782421, -0.0357807, -0.999329);\n  camera->SetDistance(421.227);\n  camera->SetClippingRange(146.564, 767.987);\n\n  // interact with data\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(FixedPointVolumeRayCastMapperCT)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOImage\n  IOXML\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolume\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"FixedPointVolumeRayCastMapperCT: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(FixedPointVolumeRayCastMapperCT MACOSX_BUNDLE FixedPointVolumeRayCastMapperCT.cxx )\n  target_link_libraries(FixedPointVolumeRayCastMapperCT PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS FixedPointVolumeRayCastMapperCT\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/#download-and-build-fixedpointvolumeraycastmapperct","title":"Download and Build FixedPointVolumeRayCastMapperCT","text":"

        Click here to download FixedPointVolumeRayCastMapperCT and its CMakeLists.txt file. Once the tarball FixedPointVolumeRayCastMapperCT.tar has been downloaded and extracted,

        cd FixedPointVolumeRayCastMapperCT/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./FixedPointVolumeRayCastMapperCT\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VolumeRendering/IntermixedUnstructuredGrid/","title":"IntermixedUnstructuredGrid","text":"

        vtk-examples/Cxx/VolumeRendering/IntermixedUnstructuredGrid

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VolumeRendering/IntermixedUnstructuredGrid/#code","title":"Code","text":"

        IntermixedUnstructuredGrid.cxx

        /* converted from:\n *\nhttps://github.com/Kitware/VTK/blob/49fbbe479dfdf47c86c02d6cae48c41b9c844b04/Examples/VolumeRendering/Tcl/IntermixedUnstructuredGrid.tcl\n*\n*/\n\n#include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkContourFilter.h>\n#include <vtkDataSetTriangleFilter.h>\n#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSLCReader.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkThreshold.h>\n#include <vtkUnstructuredGridVolumeRayCastMapper.h>\n#include <vtkVolumeProperty.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" file.vtk file.slc e.g. ironProt.vtk neghip.slc\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create the reader for the data\n  // This is the data the will be volume rendered\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // create a reader for the other data that will\n  // be contoured and displayed as a polygonal mesh\n  vtkNew<vtkSLCReader> reader2;\n  reader2->SetFileName(argv[2]);\n\n  // convert from vtkImageData to vtkUnstructuredGrid, remove\n  // any cells where all values are below 80\n  vtkNew<vtkThreshold> thresh;\n  thresh->SetUpperThreshold(80);\n  thresh->SetThresholdFunction(vtkThreshold::THRESHOLD_UPPER);\n  // thresh->ThresholdByUpper(80);\n  thresh->AllScalarsOff();\n  thresh->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkDataSetTriangleFilter> trifilter;\n  trifilter->SetInputConnection(thresh->GetOutputPort());\n\n  // Create transfer mapping scalar value to opacity\n  vtkNew<vtkPiecewiseFunction> opacityTransferFunction;\n  opacityTransferFunction->AddPoint(80, 0.0);\n  opacityTransferFunction->AddPoint(120, 0.2);\n  opacityTransferFunction->AddPoint(255, 0.2);\n\n  // Create transfer mapping scalar value to color\n  vtkNew<vtkColorTransferFunction> colorTransferFunction;\n  colorTransferFunction->AddRGBPoint(80.0, 0.0, 0.0, 0.0);\n  colorTransferFunction->AddRGBPoint(120.0, 0.0, 0.0, 1.0);\n  colorTransferFunction->AddRGBPoint(160.0, 1.0, 0.0, 0.0);\n  colorTransferFunction->AddRGBPoint(200.0, 0.0, 1.0, 0.0);\n  colorTransferFunction->AddRGBPoint(255.0, 0.0, 1.0, 1.0);\n\n  // The property describes how the data will look\n  vtkNew<vtkVolumeProperty> volumeProperty;\n  volumeProperty->SetColor(colorTransferFunction);\n  volumeProperty->SetScalarOpacity(opacityTransferFunction);\n  volumeProperty->ShadeOff();\n  volumeProperty->SetInterpolationTypeToLinear();\n\n  // The mapper / ray cast function know how to render the data\n  vtkNew<vtkUnstructuredGridVolumeRayCastMapper> volumeMapper;\n  volumeMapper->SetInputConnection(trifilter->GetOutputPort());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->SetSize(640, 512);\n  vtkNew<vtkRenderer> ren1;\n\n  // contour the second dataset\n  vtkNew<vtkContourFilter> contour;\n  contour->SetValue(0, 80);\n  contour->SetInputConnection(reader2->GetOutputPort());\n\n  // create a mapper for the polygonal data\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(contour->GetOutputPort());\n  mapper->ScalarVisibilityOff();\n\n  // create an actor for the polygonal data\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  ren1->AddViewProp(actor);\n\n  ren1->SetBackground(0.1, 0.4, 0.2);\n\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"IntermixedUnstructuredGrid\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkVolume> volume;\n  volume->SetMapper(volumeMapper);\n  volume->SetProperty(volumeProperty);\n\n  ren1->AddVolume(volume);\n\n  ren1->ResetCamera();\n  ren1->GetActiveCamera()->Zoom(1.5);\n\n  // Render composite. In default mode. For coverage.\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VolumeRendering/IntermixedUnstructuredGrid/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(IntermixedUnstructuredGrid)\n\nfind_package(VTK COMPONENTS \n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersGeneral\n  IOImage\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolume\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"IntermixedUnstructuredGrid: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(IntermixedUnstructuredGrid MACOSX_BUNDLE IntermixedUnstructuredGrid.cxx )\n  target_link_libraries(IntermixedUnstructuredGrid PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS IntermixedUnstructuredGrid\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VolumeRendering/IntermixedUnstructuredGrid/#download-and-build-intermixedunstructuredgrid","title":"Download and Build IntermixedUnstructuredGrid","text":"

        Click here to download IntermixedUnstructuredGrid and its CMakeLists.txt file. Once the tarball IntermixedUnstructuredGrid.tar has been downloaded and extracted,

        cd IntermixedUnstructuredGrid/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./IntermixedUnstructuredGrid\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VolumeRendering/MinIntensityRendering/","title":"MinIntensityRendering","text":"

        vtk-examples/Cxx/VolumeRendering/MinIntensityRendering

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VolumeRendering/MinIntensityRendering/#code","title":"Code","text":"

        MinIntensityRendering.cxx

        #include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkFixedPointVolumeRayCastMapper.h>\n#include <vtkImageClip.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkVolume.h>\n#include <vtkVolumeProperty.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cerr << \"Required arguments: vtkFile e.g. ironProt.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  std::string filename = argv[1];\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the renderers, render window, and interactor.\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n  vtkNew<vtkRenderer> ren;\n  renWin->AddRenderer(ren);\n  renWin->SetWindowName(\"MinIntensityRendering\");\n\n  // Read the data from a vtk file\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(filename.c_str());\n  reader->Update();\n\n  // Create a transfer function mapping scalar value to opacity.\n  vtkNew<vtkPiecewiseFunction> oTFun;\n  oTFun->AddSegment(0, 1.0, 256, 0.1);\n\n  vtkNew<vtkColorTransferFunction> cTFun;\n  cTFun->AddRGBPoint(0, 1.0, 1.0, 1.0);\n  cTFun->AddRGBPoint(255, 1.0, 1.0, 1.0);\n\n  // Need to crop to actually see minimum intensity.\n  vtkNew<vtkImageClip> clip;\n  clip->SetInputConnection(reader->GetOutputPort());\n  clip->SetOutputWholeExtent(0, 66, 0, 66, 30, 37);\n  clip->ClipDataOn();\n\n  vtkNew<vtkVolumeProperty> property;\n  property->SetScalarOpacity(oTFun);\n  property->SetColor(cTFun);\n  property->SetInterpolationTypeToLinear();\n\n  vtkNew<vtkFixedPointVolumeRayCastMapper> mapper;\n  mapper->SetBlendModeToMinimumIntensity();\n  mapper->SetInputConnection(clip->GetOutputPort());\n\n  vtkNew<vtkVolume> volume;\n  volume->SetMapper(mapper);\n  volume->SetProperty(property);\n\n  ren->AddViewProp(volume);\n  ren->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renWin->Render();\n\n  ren->GetActiveCamera()->Zoom(1.3);\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VolumeRendering/MinIntensityRendering/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(MinIntensityRendering)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOLegacy\n  ImagingCore\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolume\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"MinIntensityRendering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(MinIntensityRendering MACOSX_BUNDLE MinIntensityRendering.cxx )\n  target_link_libraries(MinIntensityRendering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS MinIntensityRendering\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VolumeRendering/MinIntensityRendering/#download-and-build-minintensityrendering","title":"Download and Build MinIntensityRendering","text":"

        Click here to download MinIntensityRendering and its CMakeLists.txt file. Once the tarball MinIntensityRendering.tar has been downloaded and extracted,

        cd MinIntensityRendering/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./MinIntensityRendering\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VolumeRendering/OpenVRVolume/","title":"OpenVRVolume","text":"

        vtk-examples/Cxx/VolumeRendering/OpenVRVolume

        "},{"location":"Cxx/VolumeRendering/OpenVRVolume/#description","title":"Description","text":"

        This example renders a simple artificial 10x10x10 volume in OpenVR.

        Note that for the interactions to work in VTK >= 9.1, you will have to copy the .json manifest files from the subfolder Rendering/OpenVR in VTK's source to the working directory in which the tests are run!

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VolumeRendering/OpenVRVolume/#code","title":"Code","text":"

        OpenVRVolume.cxx

        #include <vtkActor.h>\n#include <vtkColorSeries.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenVRRenderWindow.h>\n#include <vtkOpenVRRenderWindowInteractor.h>\n#include <vtkOpenVRRenderer.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkSmartVolumeMapper.h>\n#include <vtkVolumeProperty.h>\n\nint main(int argc, char* argv[])\n{\n  int dim[3] = {10, 10, 10};\n  double spc[3] = {0.05, 0.05, 0.05};\n  vtkNew<vtkImageData> img;\n  img->SetDimensions(dim);\n  img->AllocateScalars(VTK_INT, 1);\n  img->SetSpacing(spc);\n  for (int x = 0; x < dim[0]; ++x)\n    for (int y = 0; y < dim[1]; ++y)\n      for (int z = 0; z < dim[2]; ++z)\n      {\n        img->SetScalarComponentFromDouble(x, y, z, 0, x);\n      }\n  vtkNew<vtkColorSeries> colors;\n  colors->SetColorScheme(vtkColorSeries::BREWER_QUALITATIVE_SET3);\n  vtkNew<vtkColorTransferFunction> ctf;\n  for (int x = 0; x < dim[0]; ++x)\n  {\n    auto c = colors->GetColor(x);\n    ctf->AddRGBPoint(x, c.GetRed() / 255.0, c.GetGreen() / 255.0,\n                     c.GetBlue() / 255.0);\n  }\n  ctf->AddRGBPoint(dim[0], 1.0, 1.0, 1.0);\n  ctf->Build();\n  vtkNew<vtkSmartVolumeMapper> volMapper;\n  vtkNew<vtkVolume> volume;\n  vtkNew<vtkVolumeProperty> volProp;\n  volMapper->SetBlendModeToComposite();\n  volume->SetMapper(volMapper);\n  volume->SetProperty(volProp);\n  volume->SetVisibility(true);\n  volMapper->SetInputData(img);\n  volProp->SetColor(0, ctf);\n  vtkNew<vtkPiecewiseFunction> otf;\n  otf->AddPoint(0.0, 1.0);\n  otf->AddPoint(dim[0], 1.0);\n  volProp->SetScalarOpacity(0, otf);\n  volProp->Modified();\n  volProp->SetScalarOpacityUnitDistance(1);\n\n  vtkNew<vtkOpenVRRenderWindow> renderWindow;\n  renderWindow->Initialize();\n  vtkNew<vtkOpenVRRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkOpenVRRenderer> renderer;\n  renderWindow->AddRenderer(renderer);\n  vtkNew<vtkNamedColors> namedColors;\n  renderer->SetBackground(namedColors->GetColor3d(\"ForestGreen\").GetData());\n  renderer->AddVolume(volume);\n  volume->SetPosition(0, 0.5, 0);\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VolumeRendering/OpenVRVolume/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OpenVRVolume)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingOpenVR\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OpenVRVolume: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OpenVRVolume MACOSX_BUNDLE OpenVRVolume.cxx )\n  target_link_libraries(OpenVRVolume PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OpenVRVolume\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VolumeRendering/OpenVRVolume/#download-and-build-openvrvolume","title":"Download and Build OpenVRVolume","text":"

        Click here to download OpenVRVolume and its CMakeLists.txt file. Once the tarball OpenVRVolume.tar has been downloaded and extracted,

        cd OpenVRVolume/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OpenVRVolume\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VolumeRendering/PseudoVolumeRendering/","title":"PseudoVolumeRendering","text":"

        vtk-examples/Cxx/VolumeRendering/PseudoVolumeRendering

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/VolumeRendering/PseudoVolumeRendering/#description","title":"Description","text":"

        This example uses 100 cut planes with opacity of 0.05. Rendered back-to-front to simulate volume rendering.

        Info

        See Figure 6-32 in Chapter 6 the VTK Textbook.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VolumeRendering/PseudoVolumeRendering/#code","title":"Code","text":"

        PseudoVolumeRendering.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkContourFilter.h>\n#include <vtkCutter.h>\n#include <vtkExtractGrid.h>\n#include <vtkLookupTable.h>\n#include <vtkMultiBlockDataSet.h>\n#include <vtkMultiBlockPLOT3DReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkPolyDataNormals.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStripper.h>\n#include <vtkStructuredGrid.h>\n#include <vtkStructuredGridOutlineFilter.h>\n#include <vtkTubeFilter.h>\n\n#include <iostream>\n#include <string>\n\n// Perform psuedo volume rendering in a structured grid by compositing\n// translucent cut planes. This same trick can be used for unstructured\n// grids. Note that for better results, more planes can be created. Also,\n// if your data is vtkImageData, there are much faster methods for volume\n// rendering.\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" combxyz.bin combq.bin\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Create pipeline. Read structured grid data.\n  //\n  vtkNew<vtkMultiBlockPLOT3DReader> pl3d;\n  pl3d->SetXYZFileName(argv[1]);\n  pl3d->SetQFileName(argv[2]);\n  pl3d->SetScalarFunctionNumber(100);\n  pl3d->SetVectorFunctionNumber(202);\n  pl3d->Update();\n\n  vtkStructuredGrid* pl3dOutput =\n      dynamic_cast<vtkStructuredGrid*>(pl3d->GetOutput()->GetBlock(0));\n\n  // A convenience, use this filter to limit data for experimentation.\n  vtkNew<vtkExtractGrid> extract;\n  extract->SetVOI(1, 55, -1000, 1000, -1000, 1000);\n  extract->SetInputData(pl3dOutput);\n\n  // The (implicit) plane is used to do the cutting.\n  vtkNew<vtkPlane> plane;\n  plane->SetOrigin(0, 4, 2);\n  plane->SetNormal(0, 1, 0);\n\n  // The cutter is set up to process each contour value over all cells\n  // (SetSortByToSortByCell). This results in an ordered output of polygons\n  // which is key to the compositing.\n  vtkNew<vtkCutter> cutter;\n  cutter->SetInputConnection(extract->GetOutputPort());\n  cutter->SetCutFunction(plane);\n  cutter->GenerateCutScalarsOff();\n  cutter->SetSortByToSortByCell();\n\n  vtkNew<vtkLookupTable> clut;\n  clut->SetHueRange(0, .67);\n  clut->Build();\n\n  vtkNew<vtkPolyDataMapper> cutterMapper;\n  cutterMapper->SetInputConnection(cutter->GetOutputPort());\n  cutterMapper->SetScalarRange(.18, .7);\n  cutterMapper->SetLookupTable(clut);\n\n  vtkNew<vtkActor> cut;\n  cut->SetMapper(cutterMapper);\n\n  // Add in some surface geometry for interest.\n  vtkNew<vtkContourFilter> iso;\n  iso->SetInputData(pl3dOutput);\n  iso->SetValue(0, .22);\n\n  vtkNew<vtkPolyDataNormals> normals;\n  normals->SetInputConnection(iso->GetOutputPort());\n  normals->SetFeatureAngle(60);\n\n  vtkNew<vtkPolyDataMapper> isoMapper;\n  isoMapper->SetInputConnection(normals->GetOutputPort());\n  isoMapper->ScalarVisibilityOff();\n\n  vtkNew<vtkActor> isoActor;\n  isoActor->SetMapper(isoMapper);\n  isoActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Tomato\").GetData());\n  isoActor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  isoActor->GetProperty()->SetDiffuse(.8);\n  isoActor->GetProperty()->SetSpecular(.5);\n  isoActor->GetProperty()->SetSpecularPower(30);\n\n  vtkNew<vtkStructuredGridOutlineFilter> outline;\n  outline->SetInputData(pl3dOutput);\n\n  vtkNew<vtkStripper> outlineStrip;\n  outlineStrip->SetInputConnection(outline->GetOutputPort());\n\n  vtkNew<vtkTubeFilter> outlineTubes;\n  outlineTubes->SetInputConnection(outline->GetOutputPort());\n  outlineTubes->SetInputConnection(outlineStrip->GetOutputPort());\n  outlineTubes->SetRadius(.1);\n\n  vtkNew<vtkPolyDataMapper> outlineMapper;\n  outlineMapper->SetInputConnection(outlineTubes->GetOutputPort());\n\n  vtkNew<vtkActor> outlineActor;\n  outlineActor->SetMapper(outlineMapper);\n\n  // Create the RenderWindow, Renderer and Interactor.\n  //\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  vtkNew<vtkRenderWindowInteractor> iren;\n\n  iren->SetRenderWindow(renWin);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(outlineActor);\n  outlineActor->GetProperty()->SetColor(colors->GetColor3d(\"Banana\").GetData());\n  ren1->AddActor(isoActor);\n  isoActor->VisibilityOn();\n  ren1->AddActor(cut);\n\n  unsigned int n = 20;\n  double opacity = 1.0 / (static_cast<double>(n)) * 5.0;\n  cut->GetProperty()->SetOpacity(1);\n  ren1->SetBackground(colors->GetColor3d(\"Slategray\").GetData());\n\n  renWin->SetSize(640, 480);\n  renWin->SetWindowName(\"PseudoVolumeRendering\");\n\n  ren1->GetActiveCamera()->SetClippingRange(3.95297, 50);\n  ren1->GetActiveCamera()->SetFocalPoint(9.71821, 0.458166, 29.3999);\n  ren1->GetActiveCamera()->SetPosition(2.7439, -37.3196, 38.7167);\n  ren1->GetActiveCamera()->ComputeViewPlaneNormal();\n  ren1->GetActiveCamera()->SetViewUp(-0.16123, 0.264271, 0.950876);\n\n  // Cut: generates n cut planes normal to camera's view plane.\n  //\n  plane->SetNormal(ren1->GetActiveCamera()->GetViewPlaneNormal());\n  plane->SetOrigin(ren1->GetActiveCamera()->GetFocalPoint());\n  cutter->GenerateValues(n, -5, 5);\n  clut->SetAlphaRange(opacity, opacity);\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VolumeRendering/PseudoVolumeRendering/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PseudoVolumeRendering)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersExtraction\n  IOParallel\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PseudoVolumeRendering: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PseudoVolumeRendering MACOSX_BUNDLE PseudoVolumeRendering.cxx )\n  target_link_libraries(PseudoVolumeRendering PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PseudoVolumeRendering\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VolumeRendering/PseudoVolumeRendering/#download-and-build-pseudovolumerendering","title":"Download and Build PseudoVolumeRendering","text":"

        Click here to download PseudoVolumeRendering and its CMakeLists.txt file. Once the tarball PseudoVolumeRendering.tar has been downloaded and extracted,

        cd PseudoVolumeRendering/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PseudoVolumeRendering\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VolumeRendering/RayCastIsosurface/","title":"RayCastIsosurface","text":"

        vtk-examples/Cxx/VolumeRendering/RayCastIsosurface

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        "},{"location":"Cxx/VolumeRendering/RayCastIsosurface/#description","title":"Description","text":"

        This examples show how volume rendering can produce isosurface-like images. Using vtkOpenGLGPUVolumeRayCastMapper with an isosurface blend mode, two isosurfaces are created using appropriate transfer functions. The effect is similar to what is shown in MedicalDemo2. The user can specify the .mhd file and the two isosurface values. The example uses 500 and 1150 for the two isosurface values. The volume rendering \"surfaces\" are fuzzier than the hard surfaces created by vtkMarchingCubes in MedicalDemo3.

        Usage

            RayCastIsosurface FullHead.mhd 500 1150\n

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VolumeRendering/RayCastIsosurface/#code","title":"Code","text":"

        RayCastIsosurface.cxx

        #include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkContourValues.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMetaImageReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOpenGLGPUVolumeRayCastMapper.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkVolume.h>\n#include <vtkVolumeProperty.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  double iso1 = 500.0;\n  double iso2 = 1150.0;\n\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" file.mnd [iso1=500] [iso2=1150]\"\n              << std::endl;\n    std::cout << \"e.g. FullHead.mhd 500 1150\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkMetaImageReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkOpenGLGPUVolumeRayCastMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n  mapper->AutoAdjustSampleDistancesOff();\n  mapper->SetSampleDistance(0.5);\n  mapper->SetBlendModeToIsoSurface();\n\n  if (argc > 3)\n  {\n    iso1 = atof(argv[2]);\n    iso2 = atof(argv[3]);\n  }\n  vtkNew<vtkColorTransferFunction> colorTransferFunction;\n  colorTransferFunction->RemoveAllPoints();\n  colorTransferFunction->AddRGBPoint(iso2,\n                                     colors->GetColor3d(\"ivory\").GetData()[0],\n                                     colors->GetColor3d(\"ivory\").GetData()[1],\n                                     colors->GetColor3d(\"ivory\").GetData()[2]);\n  colorTransferFunction->AddRGBPoint(iso1,\n                                     colors->GetColor3d(\"flesh\").GetData()[0],\n                                     colors->GetColor3d(\"flesh\").GetData()[1],\n                                     colors->GetColor3d(\"flesh\").GetData()[2]);\n\n  vtkNew<vtkPiecewiseFunction> scalarOpacity;\n  scalarOpacity->AddPoint(iso1, .3);\n  scalarOpacity->AddPoint(iso2, 0.6);\n\n  vtkNew<vtkVolumeProperty> volumeProperty;\n  volumeProperty->ShadeOn();\n  volumeProperty->SetInterpolationTypeToLinear();\n  volumeProperty->SetColor(colorTransferFunction);\n  volumeProperty->SetScalarOpacity(scalarOpacity);\n\n  vtkNew<vtkVolume> volume;\n  volume->SetMapper(mapper);\n  volume->SetProperty(volumeProperty);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddVolume(volume);\n  renderer->SetBackground(colors->GetColor3d(\"cornflower\").GetData());\n  renderer->ResetCamera();\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->SetSize(800, 600);\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"RayCastIsosurface\");\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n  interactor->SetInteractorStyle(style);\n\n  // Add some contour values to draw iso surfaces\n  volumeProperty->GetIsoSurfaceValues()->SetValue(0, iso1);\n  volumeProperty->GetIsoSurfaceValues()->SetValue(1, iso2);\n\n  // Generate a good view\n  vtkNew<vtkCamera> aCamera;\n  aCamera->SetViewUp(0, 0, -1);\n  aCamera->SetPosition(0, -1, 0);\n  aCamera->SetFocalPoint(0, 0, 0);\n\n  renderer->SetActiveCamera(aCamera);\n  renderer->ResetCamera();\n\n  aCamera->Azimuth(30.0);\n  aCamera->Elevation(30.0);\n  aCamera->Dolly(1.5);\n  renderer->ResetCameraClippingRange();\n\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VolumeRendering/RayCastIsosurface/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RayCastIsosurface)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  CommonMisc\n  IOImage\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RayCastIsosurface: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RayCastIsosurface MACOSX_BUNDLE RayCastIsosurface.cxx )\n  target_link_libraries(RayCastIsosurface PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RayCastIsosurface\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VolumeRendering/RayCastIsosurface/#download-and-build-raycastisosurface","title":"Download and Build RayCastIsosurface","text":"

        Click here to download RayCastIsosurface and its CMakeLists.txt file. Once the tarball RayCastIsosurface.tar has been downloaded and extracted,

        cd RayCastIsosurface/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RayCastIsosurface\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/VolumeRendering/SimpleRayCast/","title":"SimpleRayCast","text":"

        vtk-examples/Cxx/VolumeRendering/SimpleRayCast

        "},{"location":"Cxx/VolumeRendering/SimpleRayCast/#description","title":"Description","text":"

        Volume rendering of a high potential iron protein.

        Info

        See Figure 7-34 in Chapter 7 the VTK Textbook.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/VolumeRendering/SimpleRayCast/#code","title":"Code","text":"

        SimpleRayCast.cxx

        #include <vtkCamera.h>\n#include <vtkColorTransferFunction.h>\n#include <vtkFixedPointVolumeRayCastMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPiecewiseFunction.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkStructuredPointsReader.h>\n#include <vtkVolume.h>\n#include <vtkVolumeProperty.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" ironProt.vtk\" << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // This is a simple volume rendering example that\n  // uses a vtkFixedPointVolumeRayCastMapper\n\n  // Create the standard renderer, render window\n  // and interactor\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> ren1;\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  // Create the reader for the data\n  vtkNew<vtkStructuredPointsReader> reader;\n  reader->SetFileName(argv[1]);\n\n  // Create transfer mapping scalar value to opacity\n  vtkNew<vtkPiecewiseFunction> opacityTransferFunction;\n  opacityTransferFunction->AddPoint(20, 0.0);\n  opacityTransferFunction->AddPoint(255, 0.2);\n\n  // Create transfer mapping scalar value to color\n  vtkNew<vtkColorTransferFunction> colorTransferFunction;\n  colorTransferFunction->AddRGBPoint(0.0, 0.0, 0.0, 0.0);\n  colorTransferFunction->AddRGBPoint(64.0, 1.0, 0.0, 0.0);\n  colorTransferFunction->AddRGBPoint(128.0, 0.0, 0.0, 1.0);\n  colorTransferFunction->AddRGBPoint(192.0, 0.0, 1.0, 0.0);\n  colorTransferFunction->AddRGBPoint(255.0, 0.0, 0.2, 0.0);\n\n  // The property describes how the data will look\n  vtkNew<vtkVolumeProperty> volumeProperty;\n  volumeProperty->SetColor(colorTransferFunction);\n  volumeProperty->SetScalarOpacity(opacityTransferFunction);\n  volumeProperty->ShadeOn();\n  volumeProperty->SetInterpolationTypeToLinear();\n\n  // The mapper / ray cast function know how to render the data\n  vtkNew<vtkFixedPointVolumeRayCastMapper> volumeMapper;\n  volumeMapper->SetInputConnection(reader->GetOutputPort());\n\n  // The volume holds the mapper and the property and\n  // can be used to position/orient the volume\n  vtkNew<vtkVolume> volume;\n  volume->SetMapper(volumeMapper);\n  volume->SetProperty(volumeProperty);\n\n  ren1->AddVolume(volume);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  ren1->GetActiveCamera()->Azimuth(45);\n  ren1->GetActiveCamera()->Elevation(30);\n  ren1->ResetCameraClippingRange();\n  ren1->ResetCamera();\n\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"SimpleRayCast\");\n  renWin->Render();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/VolumeRendering/SimpleRayCast/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SimpleRayCast)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOLegacy\n  InteractionStyle\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n  RenderingVolume\n  RenderingVolumeOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SimpleRayCast: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SimpleRayCast MACOSX_BUNDLE SimpleRayCast.cxx )\n  target_link_libraries(SimpleRayCast PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SimpleRayCast\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/VolumeRendering/SimpleRayCast/#download-and-build-simpleraycast","title":"Download and Build SimpleRayCast","text":"

        Click here to download SimpleRayCast and its CMakeLists.txt file. Once the tarball SimpleRayCast.tar has been downloaded and extracted,

        cd SimpleRayCast/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SimpleRayCast\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/AffineWidget/","title":"AffineWidget","text":"

        vtk-examples/Cxx/Widgets/AffineWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/AffineWidget/#description","title":"Description","text":"

        This example demonstrates use of a vtkAffineWidget to apply transforms to a 3D prop in the x-y plane.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/AffineWidget/#code","title":"Code","text":"

        AffineWidget.cxx

        #include <vtkActor.h>\n#include <vtkAffineRepresentation2D.h>\n#include <vtkAffineWidget.h>\n#include <vtkAppendPolyData.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkInteractorStyleSwitch.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTransform.h>\n\nnamespace {\nclass vtkAffineCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkAffineCallback* New()\n  {\n    return new vtkAffineCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*);\n  vtkAffineCallback() : Actor(0), AffineRep(0)\n  {\n    this->Transform = vtkTransform::New();\n  }\n  ~vtkAffineCallback()\n  {\n    this->Transform->Delete();\n  }\n  vtkActor* Actor;\n  vtkAffineRepresentation2D* AffineRep;\n  vtkTransform* Transform;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create two spheres: a larger one and a smaller one on top of the larger one\n  // to show a reference point while rotating\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkSphereSource> sphereSource2;\n  sphereSource2->SetRadius(0.075);\n  sphereSource2->SetCenter(0, 0.5, 0);\n  sphereSource2->Update();\n\n  // Append the two spheres into one vtkPolyData\n  vtkNew<vtkAppendPolyData> append;\n  append->AddInputConnection(sphereSource->GetOutputPort());\n  append->AddInputConnection(sphereSource2->GetOutputPort());\n\n  // Create a plane centered over the larger sphere with 4x4 sub sections\n  vtkNew<vtkPlaneSource> planeSource;\n  planeSource->SetXResolution(4);\n  planeSource->SetYResolution(4);\n  planeSource->SetOrigin(-1, -1, 0);\n  planeSource->SetPoint1(1, -1, 0);\n  planeSource->SetPoint2(-1, 1, 0);\n\n  // Create a mapper and actor for the plane: show it as a wireframe\n  vtkNew<vtkPolyDataMapper> planeMapper;\n  planeMapper->SetInputConnection(planeSource->GetOutputPort());\n  vtkNew<vtkActor> planeActor;\n  planeActor->SetMapper(planeMapper);\n  planeActor->GetProperty()->SetRepresentationToWireframe();\n  planeActor->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n\n  // Create a mapper and actor for the spheres\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(append->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  // Create a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"AffineWidget\");\n\n  renderer->AddActor(actor);\n  renderer->AddActor(planeActor);\n  renderer->GradientBackgroundOn();\n  renderer->SetBackground(colors->GetColor3d(\"LightSkyBlue\").GetData());\n  renderer->SetBackground2(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n  dynamic_cast<vtkInteractorStyleSwitch*>(\n      renderWindowInteractor->GetInteractorStyle())\n      ->SetCurrentStyleToTrackballCamera();\n\n  // Create an affine widget to manipulate the actor\n  // the widget currently only has a 2D representation and therefore applies\n  // transforms in the X-Y plane only\n  vtkNew<vtkAffineWidget> affineWidget;\n  affineWidget->SetInteractor(renderWindowInteractor);\n  affineWidget->CreateDefaultRepresentation();\n  dynamic_cast<vtkAffineRepresentation2D*>(affineWidget->GetRepresentation())\n      ->PlaceWidget(actor->GetBounds());\n\n  vtkNew<vtkAffineCallback> affineCallback;\n  affineCallback->Actor = actor;\n  affineCallback->AffineRep = dynamic_cast<vtkAffineRepresentation2D*>(\n      affineWidget->GetRepresentation());\n\n  affineWidget->AddObserver(vtkCommand::InteractionEvent, affineCallback);\n  affineWidget->AddObserver(vtkCommand::EndInteractionEvent, affineCallback);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  affineWidget->On();\n\n  // begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid vtkAffineCallback::Execute(vtkObject*, unsigned long vtkNotUsed(event),\n                                void*)\n{\n  this->AffineRep->GetTransform(this->Transform);\n  this->Actor->SetUserTransform(this->Transform);\n}\n} // namespace\n
        "},{"location":"Cxx/Widgets/AffineWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AffineWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AffineWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AffineWidget MACOSX_BUNDLE AffineWidget.cxx )\n  target_link_libraries(AffineWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AffineWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/AffineWidget/#download-and-build-affinewidget","title":"Download and Build AffineWidget","text":"

        Click here to download AffineWidget and its CMakeLists.txt file. Once the tarball AffineWidget.tar has been downloaded and extracted,

        cd AffineWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AffineWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/AngleWidget/","title":"AngleWidget","text":"

        vtk-examples/Cxx/Widgets/AngleWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/AngleWidget/#description","title":"Description","text":"

        Click three points to create an angle. You can then drag the points around.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/AngleWidget/#code","title":"Code","text":"

        AngleWidget.cxx

        #include <vtkAngleWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"AngleWidget\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkAngleWidget> angleWidget;\n  angleWidget->SetInteractor(renderWindowInteractor);\n  angleWidget->CreateDefaultRepresentation();\n\n  // Render\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  angleWidget->On();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/AngleWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AngleWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AngleWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AngleWidget MACOSX_BUNDLE AngleWidget.cxx )\n  target_link_libraries(AngleWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AngleWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/AngleWidget/#download-and-build-anglewidget","title":"Download and Build AngleWidget","text":"

        Click here to download AngleWidget and its CMakeLists.txt file. Once the tarball AngleWidget.tar has been downloaded and extracted,

        cd AngleWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AngleWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/AngleWidget2D/","title":"AngleWidget2D","text":"

        vtk-examples/Cxx/Widgets/AngleWidget2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/AngleWidget2D/#description","title":"Description","text":"

        The arc is still visible?

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/AngleWidget2D/#code","title":"Code","text":"

        AngleWidget2D.cxx

        #include <vtkAngleRepresentation2D.h>\n#include <vtkAngleWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"AngleWidget2D\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  double pos1[3] = {50.0, 200.0, 0.0};\n  double pos2[3] = {200.0, 20.0, 0.0};\n  double center[3] = {100.0, 100.0, 0.0};\n  vtkNew<vtkAngleRepresentation2D> rep;\n  rep->ArcVisibilityOff();\n\n  vtkNew<vtkAngleWidget> angleWidget;\n  angleWidget->CreateDefaultRepresentation();\n  angleWidget->SetRepresentation(rep);\n  angleWidget->SetInteractor(renderWindowInteractor);\n\n  renderWindow->Render();\n\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  angleWidget->On();\n  rep->SetPoint1DisplayPosition(pos1);\n  rep->SetPoint2DisplayPosition(pos2);\n  rep->SetCenterDisplayPosition(center);\n  rep->Ray1VisibilityOn();\n  rep->Ray2VisibilityOn();\n  rep->ArcVisibilityOn();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/AngleWidget2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(AngleWidget2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"AngleWidget2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(AngleWidget2D MACOSX_BUNDLE AngleWidget2D.cxx )\n  target_link_libraries(AngleWidget2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS AngleWidget2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/AngleWidget2D/#download-and-build-anglewidget2d","title":"Download and Build AngleWidget2D","text":"

        Click here to download AngleWidget2D and its CMakeLists.txt file. Once the tarball AngleWidget2D.tar has been downloaded and extracted,

        cd AngleWidget2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./AngleWidget2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/BalloonWidget/","title":"BalloonWidget","text":"

        vtk-examples/Cxx/Widgets/BalloonWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/BalloonWidget/#description","title":"Description","text":"

        This example creates a sphere and a regular polygon. The balloon text describes each object when you hover over it.

        Note

        This original source code for this example is here.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/BalloonWidget/#code","title":"Code","text":"

        BalloonWidget.cxx

        #include <vtkActor.h>\n#include <vtkBalloonRepresentation.h>\n#include <vtkBalloonWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRegularPolygonSource.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(-4.0, 0.0, 0.0);\n  sphereSource->SetRadius(4.0);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> sphereMapper;\n  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> sphereActor;\n  sphereActor->SetMapper(sphereMapper);\n  sphereActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Regular Polygon.\n  vtkNew<vtkRegularPolygonSource> regularPolygonSource;\n  regularPolygonSource->SetCenter(4.0, 0.0, 0.0);\n  regularPolygonSource->SetRadius(4.0);\n  regularPolygonSource->Update();\n\n  vtkNew<vtkPolyDataMapper> regularPolygonMapper;\n  regularPolygonMapper->SetInputConnection(\n      regularPolygonSource->GetOutputPort());\n\n  vtkNew<vtkActor> regularPolygonActor;\n  regularPolygonActor->SetMapper(regularPolygonMapper);\n  regularPolygonActor->GetProperty()->SetColor(\n      colors->GetColor3d(\"Cornsilk\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetWindowName(\"BalloonWidget\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> iRen;\n  iRen->SetRenderWindow(renWin);\n\n  // Create the widget.\n  vtkNew<vtkBalloonRepresentation> balloonRep;\n  balloonRep->SetBalloonLayoutToImageRight();\n\n  vtkNew<vtkBalloonWidget> balloonWidget;\n  balloonWidget->SetInteractor(iRen);\n  balloonWidget->SetRepresentation(balloonRep);\n  balloonWidget->AddBalloon(sphereActor, \"This is a sphere\", nullptr);\n  balloonWidget->AddBalloon(regularPolygonActor, \"This is a regular polygon\",\n                            nullptr);\n\n  // Add the actors to the scene.\n  ren->AddActor(sphereActor);\n  ren->AddActor(regularPolygonActor);\n  ren->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render\n  renWin->Render();\n\n  balloonWidget->EnabledOn();\n\n  // Begin mouse interaction.\n  iRen->Initialize();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/BalloonWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BalloonWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BalloonWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BalloonWidget MACOSX_BUNDLE BalloonWidget.cxx )\n  target_link_libraries(BalloonWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BalloonWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/BalloonWidget/#download-and-build-balloonwidget","title":"Download and Build BalloonWidget","text":"

        Click here to download BalloonWidget and its CMakeLists.txt file. Once the tarball BalloonWidget.tar has been downloaded and extracted,

        cd BalloonWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BalloonWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/BiDimensionalWidget/","title":"BiDimensionalWidget","text":"

        vtk-examples/Cxx/Widgets/BiDimensionalWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/BiDimensionalWidget/#code","title":"Code","text":"

        BiDimensionalWidget.cxx

        #include <vtkActor.h>\n#include <vtkBiDimensionalRepresentation2D.h>\n#include <vtkBiDimensionalWidget.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass vtkBiDimensionalCallback : public vtkCommand\n{\npublic:\n  static vtkBiDimensionalCallback* New()\n  {\n    return new vtkBiDimensionalCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n\n    vtkBiDimensionalWidget* biDimensionalWidget =\n        reinterpret_cast<vtkBiDimensionalWidget*>(caller);\n\n    vtkBiDimensionalRepresentation2D* representation =\n        static_cast<vtkBiDimensionalRepresentation2D*>(\n            biDimensionalWidget->GetRepresentation());\n\n    double p1[3];\n    representation->GetPoint1DisplayPosition(p1);\n    double p2[3];\n    representation->GetPoint1DisplayPosition(p2);\n    double p3[3];\n    representation->GetPoint1DisplayPosition(p3);\n    double p4[3];\n    representation->GetPoint1DisplayPosition(p4);\n\n    // Display one of the points, just so we know it's working\n    std::cout << \"P1: \" << p1[0] << \" \" << p1[1] << \" \" << p1[2] << std::endl;\n  }\n  vtkBiDimensionalCallback()\n  {\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"DarkOliveGreen\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BiDimensionalWidget\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkBiDimensionalWidget> biDimensionalWidget;\n  biDimensionalWidget->SetInteractor(renderWindowInteractor);\n  biDimensionalWidget->CreateDefaultRepresentation();\n\n  vtkNew<vtkBiDimensionalCallback> biDimensionalCallback;\n\n  biDimensionalWidget->AddObserver(vtkCommand::InteractionEvent,\n                                   biDimensionalCallback);\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  biDimensionalWidget->On();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/BiDimensionalWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BiDimensionalWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BiDimensionalWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BiDimensionalWidget MACOSX_BUNDLE BiDimensionalWidget.cxx )\n  target_link_libraries(BiDimensionalWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BiDimensionalWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/BiDimensionalWidget/#download-and-build-bidimensionalwidget","title":"Download and Build BiDimensionalWidget","text":"

        Click here to download BiDimensionalWidget and its CMakeLists.txt file. Once the tarball BiDimensionalWidget.tar has been downloaded and extracted,

        cd BiDimensionalWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BiDimensionalWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/BorderWidget/","title":"BorderWidget","text":"

        vtk-examples/Cxx/Widgets/BorderWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/BorderWidget/#description","title":"Description","text":"

        This example draws a border around a region selected with the mouse. Note that the default border color is white - so if you have a white background you will not see anything!

        Also see the BorderWidgetQt example.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/BorderWidget/#code","title":"Code","text":"

        BorderWidget.cxx

        #include <vtkActor.h>\n#include <vtkBorderRepresentation.h>\n#include <vtkBorderWidget.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlatonicSolidSource.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkWidgetCallbackMapper.h>\n#include <vtkWidgetEvent.h>\n\nnamespace {\n/** Get a specialised lookup table for the platonic solids.\n *\n * Since each face of a vtkPlatonicSolidSource has a different\n * cell scalar, we create a lookup table with a different colour\n * for each face.\n * The colors have been carefully chosen so that adjacent cells\n * are colored distinctly.\n *\n * @return The lookup table.\n */\nvtkNew<vtkLookupTable> GetPlatonicLUT();\n\nclass vtkCustomBorderWidget : public vtkBorderWidget\n{\npublic:\n  static vtkCustomBorderWidget* New();\n  vtkTypeMacro(vtkCustomBorderWidget, vtkBorderWidget);\n\n  static void EndSelectAction(vtkAbstractWidget* w);\n\n  vtkCustomBorderWidget();\n};\n\nvtkStandardNewMacro(vtkCustomBorderWidget);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  auto lut = GetPlatonicLUT();\n\n  vtkNew<vtkPlatonicSolidSource> source;\n  source->SetSolidTypeToDodecahedron();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(source->GetOutputPort());\n  mapper->SetLookupTable(lut);\n  mapper->SetScalarRange(0, 19);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  // actor->GetProperty()->SetColor(\n  //     colors->GetColor3d(\"DarkOliveGreen\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderer->GetActiveCamera()->Elevation(30.0);\n  renderer->GetActiveCamera()->Azimuth(180.0);\n  renderWindow->SetWindowName(\"BorderWidget\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkCustomBorderWidget> borderWidget;\n  borderWidget->SetInteractor(renderWindowInteractor);\n  borderWidget->CreateDefaultRepresentation();\n  borderWidget->SelectableOff();\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SteelBlue\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindowInteractor->Initialize();\n  renderer->ResetCamera();\n  renderWindow->Render();\n  borderWidget->On();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\n\nvtkNew<vtkLookupTable> GetPlatonicLUT()\n{\n  vtkNew<vtkLookupTable> lut;\n  lut->SetNumberOfTableValues(20);\n  lut->SetTableRange(0.0, 19.0);\n  lut->Build();\n  lut->SetTableValue(0, 0.1, 0.1, 0.1);\n  lut->SetTableValue(1, 0, 0, 1);\n  lut->SetTableValue(2, 0, 1, 0);\n  lut->SetTableValue(3, 0, 1, 1);\n  lut->SetTableValue(4, 1, 0, 0);\n  lut->SetTableValue(5, 1, 0, 1);\n  lut->SetTableValue(6, 1, 1, 0);\n  lut->SetTableValue(7, 0.9, 0.7, 0.9);\n  lut->SetTableValue(8, 0.5, 0.5, 0.5);\n  lut->SetTableValue(9, 0.0, 0.0, 0.7);\n  lut->SetTableValue(10, 0.5, 0.7, 0.5);\n  lut->SetTableValue(11, 0, 0.7, 0.7);\n  lut->SetTableValue(12, 0.7, 0, 0);\n  lut->SetTableValue(13, 0.7, 0, 0.7);\n  lut->SetTableValue(14, 0.7, 0.7, 0);\n  lut->SetTableValue(15, 0, 0, 0.4);\n  lut->SetTableValue(16, 0, 0.4, 0);\n  lut->SetTableValue(17, 0, 0.4, 0.4);\n  lut->SetTableValue(18, 0.4, 0, 0);\n  lut->SetTableValue(19, 0.4, 0, 0.4);\n  return lut;\n}\n\nvtkCustomBorderWidget::vtkCustomBorderWidget()\n{\n  this->CallbackMapper->SetCallbackMethod(\n      vtkCommand::MiddleButtonReleaseEvent, vtkWidgetEvent::EndSelect, this,\n      vtkCustomBorderWidget::EndSelectAction);\n}\n\nvoid vtkCustomBorderWidget::EndSelectAction(vtkAbstractWidget* w)\n{\n  vtkBorderWidget* borderWidget = dynamic_cast<vtkBorderWidget*>(w);\n\n  // Get the actual box coordinates/planes.\n  // vtkNew<vtkPolyData> polydata;\n\n  // Get the bottom left corner.\n  auto lowerLeft =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPosition();\n  std::cout << \"Lower left: \" << lowerLeft[0] << \" \" << lowerLeft[1]\n            << std::endl;\n\n  auto upperRight =\n      static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())\n          ->GetPosition2();\n  std::cout << \"Upper right: \" << lowerLeft[0] + upperRight[0] << \" \"\n            << lowerLeft[1] + upperRight[1] << std::endl;\n\n  vtkBorderWidget::EndSelectAction(w);\n}\n\n} // namespace\n
        "},{"location":"Cxx/Widgets/BorderWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BorderWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BorderWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BorderWidget MACOSX_BUNDLE BorderWidget.cxx )\n  target_link_libraries(BorderWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BorderWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/BorderWidget/#download-and-build-borderwidget","title":"Download and Build BorderWidget","text":"

        Click here to download BorderWidget and its CMakeLists.txt file. Once the tarball BorderWidget.tar has been downloaded and extracted,

        cd BorderWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BorderWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/BoxWidget/","title":"BoxWidget","text":"

        vtk-examples/Cxx/Widgets/BoxWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/BoxWidget/#description","title":"Description","text":"

        This example uses a vtkBoxWidget to manipulate an actor. The class includes geometry to draw a box around the object, which is bound to it via SetProp3D. The box is dimensioned using the SetPlaceFactor method, and positioned with the PlaceWidget method. After the initial setup, synchronizing the box with the object is done through a custom callback class, which is passed to the box widget through the AddObserver method.

        For a widget that isn't tied to a specific vtkProp3D and has its geometric representation separate from the interaction logic, see the example BoxWidget2.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/BoxWidget/#code","title":"Code","text":"

        BoxWidget.cxx

        #include <vtkActor.h>\n#include <vtkBoxWidget.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nnamespace {\nclass vtkMyCallback : public vtkCommand\n{\npublic:\n  static vtkMyCallback* New()\n  {\n    return new vtkMyCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    // Here we use the vtkBoxWidget to transform the underlying coneActor\n    // (by manipulating its transformation matrix).\n    vtkNew<vtkTransform> t;\n    vtkBoxWidget* widget = reinterpret_cast<vtkBoxWidget*>(caller);\n    widget->GetTransform(t);\n    widget->GetProp3D()->SetUserTransform(t);\n  }\n};\n} // namespace\n\nint main(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> cone;\n\n  vtkNew<vtkPolyDataMapper> coneMapper;\n  coneMapper->SetInputConnection(cone->GetOutputPort());\n\n  vtkNew<vtkActor> coneActor;\n  coneActor->SetMapper(coneMapper);\n  coneActor->GetProperty()->SetColor(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(coneActor);\n  renderer->SetBackground(colors->GetColor3d(\"Blue\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetSize(300, 300);\n  window->SetWindowName(\"BoxWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  vtkNew<vtkBoxWidget> boxWidget;\n  boxWidget->SetInteractor(interactor);\n\n  boxWidget->SetProp3D(coneActor);\n  boxWidget->SetPlaceFactor(1.25); // Make the box 1.25x larger than the actor\n  boxWidget->PlaceWidget();\n\n  vtkNew<vtkMyCallback> callback;\n  boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  boxWidget->On();\n\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/BoxWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoxWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoxWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoxWidget MACOSX_BUNDLE BoxWidget.cxx )\n  target_link_libraries(BoxWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoxWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/BoxWidget/#download-and-build-boxwidget","title":"Download and Build BoxWidget","text":"

        Click here to download BoxWidget and its CMakeLists.txt file. Once the tarball BoxWidget.tar has been downloaded and extracted,

        cd BoxWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BoxWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/BoxWidget2/","title":"BoxWidget2","text":"

        vtk-examples/Cxx/Widgets/BoxWidget2

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/BoxWidget2/#description","title":"Description","text":"

        This example uses a vtkBoxWidget2 to manipulate an actor. The widget only contains the interaction logic; the actual box is drawn by the accompanying vtkBoxRepresentation. Contrary to the older vtkBoxWidget, this widget doesn't provide functionality to assign it to one or more actors, so that has to be implemented manually. The box is dimensioned and positioned by passing a bounding box to PlaceWidget method, with the SetPlaceFactor method providing a scaling factor in relation to that bounding box. The transformations applied to the box can be used to manipulate any number of object(s), via a custom callback class, which is passed to the box widget through the AddObserver method.

        The older implementation vtkBoxWidget provides functionality to receive a vtkProp3D for the initial positioning and sizing, but the transformation synchronization still needs to be done manually. See BoxWidget for a simple example of how to use it.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/BoxWidget2/#code","title":"Code","text":"

        BoxWidget2.cxx

        #include <vtkActor.h>\n#include <vtkBoxRepresentation.h>\n#include <vtkBoxWidget2.h>\n#include <vtkCommand.h>\n#include <vtkConeSource.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkTransform.h>\n\nnamespace {\nclass vtkBoxCallback : public vtkCommand\n{\npublic:\n  static vtkBoxCallback* New()\n  {\n    return new vtkBoxCallback;\n  }\n\n  vtkSmartPointer<vtkActor> m_actor;\n\n  void SetActor(vtkSmartPointer<vtkActor> actor)\n  {\n    m_actor = actor;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSmartPointer<vtkBoxWidget2> boxWidget =\n        dynamic_cast<vtkBoxWidget2*>(caller);\n\n    vtkNew<vtkTransform> t;\n\n    dynamic_cast<vtkBoxRepresentation*>(boxWidget->GetRepresentation())\n        ->GetTransform(t);\n    this->m_actor->SetUserTransform(t);\n  }\n\n  vtkBoxCallback()\n  {\n  }\n};\n} // namespace\n\nint main(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkConeSource> coneSource;\n  coneSource->SetHeight(1.5);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Blue\").GetData());\n  renderer->ResetCamera(); // Reposition camera so the whole scene is visible\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"BoxWidget2\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Use the \"trackball camera\" interactor style, rather than the default\n  // \"joystick camera\"\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkBoxWidget2> boxWidget;\n  boxWidget->SetInteractor(renderWindowInteractor);\n  boxWidget->GetRepresentation()->SetPlaceFactor(1); // Default is 0.5\n  boxWidget->GetRepresentation()->PlaceWidget(actor->GetBounds());\n\n  // Set up a callback for the interactor to call so we can manipulate the actor\n  vtkNew<vtkBoxCallback> boxCallback;\n  boxCallback->SetActor(actor);\n  boxWidget->AddObserver(vtkCommand::InteractionEvent, boxCallback);\n\n  boxWidget->On();\n\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/BoxWidget2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(BoxWidget2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonTransforms\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"BoxWidget2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(BoxWidget2 MACOSX_BUNDLE BoxWidget2.cxx )\n  target_link_libraries(BoxWidget2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS BoxWidget2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/BoxWidget2/#download-and-build-boxwidget2","title":"Download and Build BoxWidget2","text":"

        Click here to download BoxWidget2 and its CMakeLists.txt file. Once the tarball BoxWidget2.tar has been downloaded and extracted,

        cd BoxWidget2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./BoxWidget2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/CameraOrientationWidget/","title":"CameraOrientationWidget","text":"

        vtk-examples/Cxx/Widgets/CameraOrientationWidget

        "},{"location":"Cxx/Widgets/CameraOrientationWidget/#description","title":"Description","text":"

        This example demonstrates a 3D camera orientation gizmo.

        The widget representation has shafts and little spheres with text on them. The spheres always follow the camera.

        The widget representation's orientation is synchronized with the camera of the parent renderer.

        To look down on any particular axis, simply click on a handle.

        To rotate the camera and get a feel of the camera orientation, either move mouse in the renderer or click on a handle and move it around.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/CameraOrientationWidget/#code","title":"Code","text":"

        CameraOrientationWidget.cxx

        #include <vtkActor.h>\n#include <vtkCameraOrientationWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 2)\n  {\n    std::cout << \"Demonstrates a 3D camera orientation widget.\" << std::endl;\n    std::cout << \"Usage: \" << argv[0] << \" fileName\" << std::endl;\n    std::cout << \"where: fileName is cow.vtp.\" << std::endl;\n    return EXIT_FAILURE;\n  }\n  std::string fileName(argv[1]);\n\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renWin;\n  vtkNew<vtkRenderWindowInteractor> iRen;\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(fileName.c_str());\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"Beige\").GetData());\n  actor->SetMapper(mapper);\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DimGray\").GetData());\n\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(600, 600);\n  renWin->SetWindowName(\"CameraOrientationWidget\");\n\n  // Important: The interactor must be set prior to enabling the widget.\n  iRen->SetRenderWindow(renWin);\n\n  vtkNew<vtkCameraOrientationWidget> camOrientManipulator;\n  camOrientManipulator->SetParentRenderer(renderer);\n  // Enable the widget.\n  camOrientManipulator->On();\n\n  renWin->Render();\n  iRen->Initialize();\n  iRen->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/CameraOrientationWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CameraOrientationWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CameraOrientationWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CameraOrientationWidget MACOSX_BUNDLE CameraOrientationWidget.cxx )\n  target_link_libraries(CameraOrientationWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CameraOrientationWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/CameraOrientationWidget/#download-and-build-cameraorientationwidget","title":"Download and Build CameraOrientationWidget","text":"

        Click here to download CameraOrientationWidget and its CMakeLists.txt file. Once the tarball CameraOrientationWidget.tar has been downloaded and extracted,

        cd CameraOrientationWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CameraOrientationWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/CaptionWidget/","title":"CaptionWidget","text":"

        vtk-examples/Cxx/Widgets/CaptionWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/CaptionWidget/#code","title":"Code","text":"

        CaptionWidget.cxx

        #include <vtkActor.h>\n// #include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkCaptionActor2D.h>\n#include <vtkCaptionRepresentation.h>\n#include <vtkCaptionWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n// #include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Sphere\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(\n      colors->GetColor3d(\"DarkOliveGreen\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"CaptionWidget\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create the widget and its representation.\n  vtkNew<vtkCaptionRepresentation> captionRepresentation;\n  captionRepresentation->GetCaptionActor2D()->SetCaption(\"Test caption\");\n  captionRepresentation->GetCaptionActor2D()\n      ->GetTextActor()\n      ->GetTextProperty()\n      ->SetFontSize(100);\n\n  double pos[3] = {.5, 0, 0};\n  captionRepresentation->SetAnchorPosition(pos);\n\n  vtkNew<vtkCaptionWidget> captionWidget;\n  captionWidget->SetInteractor(renderWindowInteractor);\n  captionWidget->SetRepresentation(captionRepresentation);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Blue\").GetData());\n\n  renderWindow->Render();\n\n  // Rotate the camera to bring the point the caption is pointing to into view.\n  renderer->GetActiveCamera()->Azimuth(90);\n\n  captionWidget->On();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/CaptionWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CaptionWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CaptionWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CaptionWidget MACOSX_BUNDLE CaptionWidget.cxx )\n  target_link_libraries(CaptionWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CaptionWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/CaptionWidget/#download-and-build-captionwidget","title":"Download and Build CaptionWidget","text":"

        Click here to download CaptionWidget and its CMakeLists.txt file. Once the tarball CaptionWidget.tar has been downloaded and extracted,

        cd CaptionWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CaptionWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/CheckerboardWidget/","title":"CheckerboardWidget","text":"

        vtk-examples/Cxx/Widgets/CheckerboardWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/CheckerboardWidget/#description","title":"Description","text":"

        Compare two images with a checkerboard. The widget permits interactive control of the number of checkers in the x/y directions. Checkerboards are often used to compare the results of image registration. For an alternative image comparison widget try the RectilinearWipeWidget.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/CheckerboardWidget/#code","title":"Code","text":"

        CheckerboardWidget.cxx

        #include <vtkCheckerboardRepresentation.h>\n#include <vtkCheckerboardWidget.h>\n#include <vtkImageActor.h>\n#include <vtkImageCheckerboard.h>\n#include <vtkImageMapper3D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkJPEGReader.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input1Filename Input2Filename e.g. Gourds2.jpg, Ox.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Read the images.\n  vtkNew<vtkJPEGReader> reader1;\n  reader1->SetFileName(argv[1]);\n\n  vtkNew<vtkJPEGReader> reader2;\n  reader2->SetFileName(argv[2]);\n\n  // Create a checker pipeline.\n  vtkNew<vtkImageCheckerboard> checker;\n  checker->SetInputConnection(0, reader1->GetOutputPort());\n  checker->SetInputConnection(1, reader2->GetOutputPort());\n  checker->SetNumberOfDivisions(3, 3, 1);\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkNamedColors> colors;\n  vtkNew<vtkRenderer> ren1;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"CheckerboardWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkImageActor> checkerActor;\n  checkerActor->GetMapper()->SetInputConnection(checker->GetOutputPort());\n\n  // VTK widgets consist of two parts: the widget part that handles\n  // event processing; and the widget representation that defines how\n  // the widget appears in the scene,\n  // (i.e., matters pertaining to geometry).\n  vtkNew<vtkCheckerboardWidget> checkerWidget;\n  checkerWidget->SetInteractor(iren);\n\n  vtkCheckerboardRepresentation* checkerWidgetRep =\n      static_cast<vtkCheckerboardRepresentation*>(\n          checkerWidget->GetRepresentation());\n\n  checkerWidgetRep->SetImageActor(checkerActor);\n  checkerWidgetRep->SetCheckerboard(checker);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(checkerActor);\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n  renWin->SetSize(300, 300);\n\n  // Render the image.\n  //\n  iren->Initialize();\n  renWin->Render();\n  checkerWidget->On();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/CheckerboardWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CheckerboardWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingGeneral\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CheckerboardWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CheckerboardWidget MACOSX_BUNDLE CheckerboardWidget.cxx )\n  target_link_libraries(CheckerboardWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CheckerboardWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/CheckerboardWidget/#download-and-build-checkerboardwidget","title":"Download and Build CheckerboardWidget","text":"

        Click here to download CheckerboardWidget and its CMakeLists.txt file. Once the tarball CheckerboardWidget.tar has been downloaded and extracted,

        cd CheckerboardWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CheckerboardWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/CompassWidget/","title":"CompassWidget","text":"

        vtk-examples/Cxx/Widgets/CompassWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/CompassWidget/#description","title":"Description","text":"

        This example creates a compass widget in the top right corner of the window. The widget can be used to modify the camera position via its distance and tilt sliders and its heading compass wheel.

        Note for this example to work correctly VTK with version >= 9.2.20220831 is required.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/CompassWidget/#code","title":"Code","text":"

        CompassWidget.cxx

        #include <vtkAnnotatedCubeActor.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkCompassRepresentation.h>\n#include <vtkCompassWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#if VTK_VERSION_NUMBER >= 90220220831ULL\n#define VTK_HAS_IMPROVED_COMPASSWIDGETREPRESENTATION 1\n#endif\n\nclass vtkICWValueChangedCallback : public vtkCommand\n{\npublic:\n  static vtkICWValueChangedCallback* New()\n  {\n    return new vtkICWValueChangedCallback();\n  }\n  virtual void Execute(vtkObject* caller, unsigned long vtkNotUsed(eventId),\n                       void* vtkNotUsed(callData))\n  {\n    vtkCompassWidget* widget = vtkCompassWidget::SafeDownCast(caller);\n    vtkCamera* camera = widget->GetCurrentRenderer()->GetActiveCamera();\n\n    // calculate new camera position from compass widget parameters\n    double distance = widget->GetDistance();\n    double tilt = widget->GetTilt();\n    double heading = widget->GetHeading();\n\n    double pos[3] = {0, 0, 0};\n    pos[0] = distance * cos(vtkMath::RadiansFromDegrees(heading)) *\n        cos(vtkMath::RadiansFromDegrees(tilt));\n    pos[1] = distance * sin(vtkMath::RadiansFromDegrees(heading)) *\n        cos(vtkMath::RadiansFromDegrees(tilt));\n    pos[2] = distance * sin(vtkMath::RadiansFromDegrees(tilt));\n\n    camera->SetPosition(pos);\n    camera->SetFocalPoint(0, 0, 0);\n    camera->SetViewUp(0, 0, 1);\n    camera->SetClippingRange(0.1, distance + 1);\n\n    widget->GetCurrentRenderer()->Render();\n  }\n  vtkICWValueChangedCallback()\n  {\n  }\n};\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // a cube with text on its faces\n  vtkNew<vtkAnnotatedCubeActor> actor;\n  actor->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"Black\").GetData());\n  actor->GetCubeProperty()->SetColor(colors->GetColor3d(\"PeachPuff\").GetData());\n\n  // a renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  // an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // create the widget and its representation\n  vtkNew<vtkCompassRepresentation> compassRepresentation;\n#ifdef VTK_HAS_IMPROVED_COMPASSWIDGETREPRESENTATION\n  compassRepresentation->SetMinimumDistance(2);\n  compassRepresentation->SetMaximumDistance(10);\n#endif\n\n  vtkNew<vtkCompassWidget> compassWidget;\n  compassWidget->SetInteractor(renderWindowInteractor);\n  compassWidget->SetRepresentation(compassRepresentation);\n  compassWidget->SetDistance(5.0);\n\n  // create the callback\n  vtkNew<vtkICWValueChangedCallback> valueChangedCallback;\n  compassWidget->AddObserver(vtkCommand::WidgetValueChangedEvent,\n                             valueChangedCallback);\n\n  // add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->SetWindowName(\"CompassWidget\");\n\n  renderWindow->Render();\n  compassWidget->EnabledOn();\n\n  // no interactor style - camera is moved by widget callback\n  renderWindowInteractor->SetInteractorStyle(nullptr);\n\n  // set camera to initial position\n  compassWidget->InvokeEvent(vtkCommand::WidgetValueChangedEvent);\n\n  // begin interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/CompassWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(CompassWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"CompassWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(CompassWidget MACOSX_BUNDLE CompassWidget.cxx )\n  target_link_libraries(CompassWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS CompassWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/CompassWidget/#download-and-build-compasswidget","title":"Download and Build CompassWidget","text":"

        Click here to download CompassWidget and its CMakeLists.txt file. Once the tarball CompassWidget.tar has been downloaded and extracted,

        cd CompassWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./CompassWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/ContourWidget/","title":"ContourWidget","text":"

        vtk-examples/Cxx/Widgets/ContourWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/ContourWidget/#description","title":"Description","text":"

        This example generates a set of points which lie on a circle, and the contour through these points. This contour can be interactively warped/modified by dragging the control points.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/ContourWidget/#code","title":"Code","text":"

        ContourWidget.cxx

        #include <vtkCellArray.h>\n#include <vtkContourWidget.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientedGlyphContourRepresentation.h>\n#include <vtkPoints.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the contour widget\n  vtkNew<vtkContourWidget> contourWidget;\n\n  // Override the default representation for the contour widget to customize its\n  // look\n  vtkNew<vtkOrientedGlyphContourRepresentation> contourRepresentation;\n  contourRepresentation->GetLinesProperty()->SetColor(\n      colors->GetColor3d(\"Red\").GetData());\n  contourWidget->SetRepresentation(contourRepresentation);\n\n  // Generate a set of points arranged in a circle\n  int numPts = 10;\n  vtkNew<vtkPoints> points;\n  for (int i = 0; i < numPts; i++)\n  {\n    // Create numPts points evenly spread around a circumference of radius 0.1\n    const double angle = 2.0 * vtkMath::Pi() * i / numPts;\n    points->InsertPoint(static_cast<vtkIdType>(i), 0.1 * cos(angle),\n                        0.1 * sin(angle), 0.0);\n  }\n\n  // Create a cell array to connect the points into meaningful geometry\n  vtkIdType* vertexIndices = new vtkIdType[numPts + 1];\n  for (int i = 0; i < numPts; i++)\n  {\n    vertexIndices[i] = static_cast<vtkIdType>(i);\n  }\n  // Set the last vertex to 0; this means the last line segment will join the\n  // 19th point (vertices[19]) with the first one (vertices[0]), thus closing\n  // the circle.\n  vertexIndices[numPts] = 0;\n  vtkNew<vtkCellArray> lines;\n  lines->InsertNextCell(numPts + 1, vertexIndices);\n\n  // Create polydata to hold the geometry just created, and populate it\n  vtkNew<vtkPolyData> polydata;\n  polydata->SetPoints(points);\n  polydata->SetLines(lines);\n\n  // Create the renderer to visualize the scene\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // Create the GUI window to hold the rendered scene\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ContourWidget\");\n  renderWindow->SetSize(600, 600);\n\n  // Create the events manager for the renderer window\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Use the \"trackball camera\" interactor style, rather than the default\n  // \"joystick camera\"\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n  interactor->SetInteractorStyle(style);\n\n  // Set up the contour widget within the visualization pipeline just assembled\n  contourWidget->SetInteractor(interactor);\n  contourWidget->On(); // Turn on the interactor observer\n  contourWidget->Initialize(polydata);\n  renderer->ResetCamera(); // Reposition camera to fit the scene elements\n\n  // Start the interaction\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/ContourWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ContourWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ContourWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ContourWidget MACOSX_BUNDLE ContourWidget.cxx )\n  target_link_libraries(ContourWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ContourWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/ContourWidget/#download-and-build-contourwidget","title":"Download and Build ContourWidget","text":"

        Click here to download ContourWidget and its CMakeLists.txt file. Once the tarball ContourWidget.tar has been downloaded and extracted,

        cd ContourWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ContourWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/DistanceWidget/","title":"DistanceWidget","text":"

        vtk-examples/Cxx/Widgets/DistanceWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/DistanceWidget/#description","title":"Description","text":"
        • Contributed by Arnaud Gelas

        Click two points to see the distance between them.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/DistanceWidget/#code","title":"Code","text":"

        DistanceWidget.cxx

        #include <vtkDistanceRepresentation.h>\n#include <vtkDistanceWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"DistanceWidget\");\n\n  renderer->SetBackground(colors->GetColor3d(\"Navy\").GetData());\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkDistanceWidget> distanceWidget;\n  distanceWidget->SetInteractor(renderWindowInteractor);\n  distanceWidget->CreateDefaultRepresentation();\n  static_cast<vtkDistanceRepresentation*>(distanceWidget->GetRepresentation())\n      ->SetLabelFormat(\"%-#6.3g mm\");\n\n  // Render an image (lights and cameras are created automatically)\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  distanceWidget->On();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/DistanceWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(DistanceWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"DistanceWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(DistanceWidget MACOSX_BUNDLE DistanceWidget.cxx )\n  target_link_libraries(DistanceWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS DistanceWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/DistanceWidget/#download-and-build-distancewidget","title":"Download and Build DistanceWidget","text":"

        Click here to download DistanceWidget and its CMakeLists.txt file. Once the tarball DistanceWidget.tar has been downloaded and extracted,

        cd DistanceWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./DistanceWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/HoverWidget/","title":"HoverWidget","text":"

        vtk-examples/Cxx/Widgets/HoverWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/HoverWidget/#code","title":"Code","text":"

        HoverWidget.cxx

        #include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkHoverWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass vtkHoverCallback : public vtkCommand\n{\npublic:\n  static vtkHoverCallback* New()\n  {\n    return new vtkHoverCallback;\n  }\n\n  vtkHoverCallback()\n  {\n  }\n\n  virtual void Execute(vtkObject*, unsigned long event,\n                       void* vtkNotUsed(calldata))\n  {\n    switch (event)\n    {\n    case vtkCommand::TimerEvent:\n      std::cout\n          << \"TimerEvent -> the mouse stopped moving and the widget hovered\"\n          << std::endl;\n      break;\n    case vtkCommand::EndInteractionEvent:\n      std::cout << \"EndInteractionEvent -> the mouse started to move\"\n                << std::endl;\n      break;\n    }\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"HoverWidget\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create the widget\n  vtkNew<vtkHoverWidget> hoverWidget;\n  hoverWidget->SetInteractor(renderWindowInteractor);\n  hoverWidget->SetTimerDuration(1000);\n\n  // Create a callback to listen to the widget's two VTK events\n  vtkNew<vtkHoverCallback> hoverCallback;\n  hoverWidget->AddObserver(vtkCommand::TimerEvent, hoverCallback);\n  hoverWidget->AddObserver(vtkCommand::EndInteractionEvent, hoverCallback);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  hoverWidget->On();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/HoverWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(HoverWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"HoverWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(HoverWidget MACOSX_BUNDLE HoverWidget.cxx )\n  target_link_libraries(HoverWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS HoverWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/HoverWidget/#download-and-build-hoverwidget","title":"Download and Build HoverWidget","text":"

        Click here to download HoverWidget and its CMakeLists.txt file. Once the tarball HoverWidget.tar has been downloaded and extracted,

        cd HoverWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./HoverWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/ImagePlaneWidget/","title":"ImagePlaneWidget","text":"

        vtk-examples/Cxx/Widgets/ImagePlaneWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/ImagePlaneWidget/#code","title":"Code","text":"

        ImagePlaneWidget.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkImagePlaneWidget.h>\n// #include <vtkInteractorStyleTrackballActor.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImagePlaneWidget\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // vtkNew<vtkInteractorStyleTrackballActor> style;\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkImagePlaneWidget> planeWidget;\n  planeWidget->SetInteractor(renderWindowInteractor);\n  planeWidget->TextureVisibilityOff();\n\n  double origin[3] = {0, 1, 0};\n  planeWidget->SetOrigin(origin);\n  planeWidget->UpdatePlacement();\n\n  // Render\n  renderWindow->Render();\n\n  renderer->GetActiveCamera()->Azimuth(-45);\n  renderer->GetActiveCamera()->Zoom(0.85);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  planeWidget->On();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/ImagePlaneWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImagePlaneWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImagePlaneWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImagePlaneWidget MACOSX_BUNDLE ImagePlaneWidget.cxx )\n  target_link_libraries(ImagePlaneWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImagePlaneWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/ImagePlaneWidget/#download-and-build-imageplanewidget","title":"Download and Build ImagePlaneWidget","text":"

        Click here to download ImagePlaneWidget and its CMakeLists.txt file. Once the tarball ImagePlaneWidget.tar has been downloaded and extracted,

        cd ImagePlaneWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImagePlaneWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/ImageTracerWidget/","title":"ImageTracerWidget","text":"

        vtk-examples/Cxx/Widgets/ImageTracerWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/ImageTracerWidget/#code","title":"Code","text":"

        ImageTracerWidget.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageTracerWidget.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid CallbackFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"SlateGray\").GetData();\n  auto color2 = colors->GetColor3ub(\"Tomato\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetNumberOfScalarComponents(3);\n  imageSource->SetExtent(0, 20, 0, 50, 0, 0);\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(0, 20, 0, 50);\n  imageSource->SetDrawColor(drawColor2.data());\n  imageSource->FillBox(0, 10, 0, 30);\n  imageSource->Update();\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputConnection(imageSource->GetOutputPort());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderer->ResetCamera();\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageTracerWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  vtkNew<vtkImageTracerWidget> tracer;\n  tracer->GetLineProperty()->SetLineWidth(5);\n  tracer->SetInteractor(interactor);\n  tracer->SetViewProp(actor);\n  renderWindow->Render();\n\n  // The observer must be added BEFORE the On() call.\n  vtkNew<vtkCallbackCommand> callback;\n  callback->SetCallback(CallbackFunction);\n  tracer->AddObserver(vtkCommand::EndInteractionEvent, callback);\n\n  tracer->On();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CallbackFunction(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                      void* vtkNotUsed(clientData), void* vtkNotUsed(callData))\n{\n  vtkImageTracerWidget* tracerWidget =\n      static_cast<vtkImageTracerWidget*>(caller);\n\n  vtkNew<vtkPolyData> path;\n\n  tracerWidget->GetPath(path);\n  std::cout << \"There are \" << path->GetNumberOfPoints()\n            << \" points in the path.\" << std::endl;\n}\n} // end anonymous namespace\n
        "},{"location":"Cxx/Widgets/ImageTracerWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageTracerWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageTracerWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageTracerWidget MACOSX_BUNDLE ImageTracerWidget.cxx )\n  target_link_libraries(ImageTracerWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageTracerWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/ImageTracerWidget/#download-and-build-imagetracerwidget","title":"Download and Build ImageTracerWidget","text":"

        Click here to download ImageTracerWidget and its CMakeLists.txt file. Once the tarball ImageTracerWidget.tar has been downloaded and extracted,

        cd ImageTracerWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageTracerWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/ImageTracerWidgetInsideContour/","title":"ImageTracerWidgetInsideContour","text":"

        vtk-examples/Cxx/Widgets/ImageTracerWidgetInsideContour

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/ImageTracerWidgetInsideContour/#code","title":"Code","text":"

        ImageTracerWidgetInsideContour.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkImageAccumulate.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkImageData.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageStencilToImage.h>\n#include <vtkImageTracerWidget.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataToImageStencil.h>\n#include <vtkPolygon.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nnamespace {\nvoid CallbackFunction(vtkObject* caller, long unsigned int eventId,\n                      void* clientData, void* callData);\n\nvoid CreateImage1(vtkImageData*);\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkImageData> image;\n  CreateImage1(image);\n\n  vtkNew<vtkImageActor> actor;\n  actor->GetMapper()->SetInputData(image);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  renderer->ResetCamera();\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageTracerWidgetInsideContour\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleImage> style;\n  interactor->SetInteractorStyle(style);\n\n  vtkNew<vtkImageTracerWidget> tracer;\n  tracer->GetLineProperty()->SetLineWidth(5);\n  tracer->SetInteractor(interactor);\n  tracer->SetViewProp(actor);\n  tracer->AutoCloseOn();\n  renderWindow->Render();\n\n  // The observer must be added BEFORE the On() call.\n  vtkNew<vtkCallbackCommand> callback;\n  callback->SetCallback(CallbackFunction);\n  callback->SetClientData(image);\n  tracer->AddObserver(vtkCommand::EndInteractionEvent, callback);\n\n  tracer->On();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CallbackFunction(vtkObject* caller, long unsigned int vtkNotUsed(eventId),\n                      void* clientData, void* vtkNotUsed(callData))\n{\n  vtkImageTracerWidget* tracerWidget =\n      static_cast<vtkImageTracerWidget*>(caller);\n\n  vtkNew<vtkPolyData> path;\n\n  if (!tracerWidget->IsClosed())\n  {\n    std::cout << \"Path not closed!\" << std::endl;\n    return;\n  }\n\n  tracerWidget->GetPath(path);\n  std::cout << \"There are \" << path->GetNumberOfPoints()\n            << \" points in the path.\" << std::endl;\n\n  vtkImageData* image = static_cast<vtkImageData*>(clientData);\n\n  vtkNew<vtkPolyDataToImageStencil> polyDataToImageStencil;\n  polyDataToImageStencil->SetTolerance(0);\n  polyDataToImageStencil->SetInputData(path);\n  polyDataToImageStencil->SetOutputOrigin(image->GetOrigin());\n  polyDataToImageStencil->SetOutputSpacing(image->GetSpacing());\n  polyDataToImageStencil->SetOutputWholeExtent(image->GetExtent());\n  polyDataToImageStencil->Update();\n\n  vtkNew<vtkImageStencilToImage> imageStencilToImage;\n  imageStencilToImage->SetInputConnection(\n      polyDataToImageStencil->GetOutputPort());\n  imageStencilToImage->SetInsideValue(255);\n  imageStencilToImage->Update();\n\n  vtkNew<vtkImageAccumulate> imageAccumulate;\n  imageAccumulate->SetStencilData(polyDataToImageStencil->GetOutput());\n  imageAccumulate->SetInputData(image);\n  imageAccumulate->Update();\n  std::cout << \"Voxel count: \" << imageAccumulate->GetVoxelCount() << std::endl;\n\n  // vtkNew<vtkPNGWriter> writer;\n  // writer->SetFileName(\"selection.png\");\n  // writer->SetInputConnection(imageStencilToImage->GetOutputPort());\n  // writer->Write();\n}\n\nvoid CreateImage1(vtkImageData* image)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"DarkGray\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n  }\n\n  vtkNew<vtkImageCanvasSource2D> imageSource;\n  imageSource->SetScalarTypeToUnsignedChar();\n  imageSource->SetNumberOfScalarComponents(1);\n  imageSource->SetExtent(0, 20, 0, 50, 0, 0);\n  imageSource->SetDrawColor(drawColor1.data());\n  imageSource->FillBox(0, 20, 0, 50);\n  imageSource->Update();\n\n  image->ShallowCopy(imageSource->GetOutput());\n}\n} // end anonymous namespace\n
        "},{"location":"Cxx/Widgets/ImageTracerWidgetInsideContour/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageTracerWidgetInsideContour)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  ImagingSources\n  ImagingStatistics\n  ImagingStencil\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageTracerWidgetInsideContour: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageTracerWidgetInsideContour MACOSX_BUNDLE ImageTracerWidgetInsideContour.cxx )\n  target_link_libraries(ImageTracerWidgetInsideContour PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageTracerWidgetInsideContour\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/ImageTracerWidgetInsideContour/#download-and-build-imagetracerwidgetinsidecontour","title":"Download and Build ImageTracerWidgetInsideContour","text":"

        Click here to download ImageTracerWidgetInsideContour and its CMakeLists.txt file. Once the tarball ImageTracerWidgetInsideContour.tar has been downloaded and extracted,

        cd ImageTracerWidgetInsideContour/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageTracerWidgetInsideContour\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/ImageTracerWidgetNonPlanar/","title":"ImageTracerWidgetNonPlanar","text":"

        vtk-examples/Cxx/Widgets/ImageTracerWidgetNonPlanar

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/ImageTracerWidgetNonPlanar/#code","title":"Code","text":"

        ImageTracerWidgetNonPlanar.cxx

        #include <vtkActor.h>\n#include <vtkImageTracerWidget.h>\n#include <vtkInteractorStyleTrackballCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImageTracerWidgetNonPlanar\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkInteractorStyleTrackballCamera> style;\n\n  renderWindowInteractor->SetInteractorStyle(style);\n\n  vtkNew<vtkImageTracerWidget> tracerWidget;\n  tracerWidget->SetInteractor(renderWindowInteractor);\n  tracerWidget->SetViewProp(actor);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  tracerWidget->On();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/ImageTracerWidgetNonPlanar/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImageTracerWidgetNonPlanar)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImageTracerWidgetNonPlanar: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImageTracerWidgetNonPlanar MACOSX_BUNDLE ImageTracerWidgetNonPlanar.cxx )\n  target_link_libraries(ImageTracerWidgetNonPlanar PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImageTracerWidgetNonPlanar\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/ImageTracerWidgetNonPlanar/#download-and-build-imagetracerwidgetnonplanar","title":"Download and Build ImageTracerWidgetNonPlanar","text":"

        Click here to download ImageTracerWidgetNonPlanar and its CMakeLists.txt file. Once the tarball ImageTracerWidgetNonPlanar.tar has been downloaded and extracted,

        cd ImageTracerWidgetNonPlanar/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImageTracerWidgetNonPlanar\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/ImplicitPlaneWidget2/","title":"ImplicitPlaneWidget2","text":"

        vtk-examples/Cxx/Widgets/ImplicitPlaneWidget2

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/ImplicitPlaneWidget2/#description","title":"Description","text":"

        This example shows how to use the second generation ImplicitPlaneWidget2 to interactively define the clipping plane for a polydata. If no arguments are specified, a vtkSphereSource generates the polydata. By specifying a .vtp file, the example can operate on arbitrary polydata.

        For example, try VTKData/Data/cow.vtp.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/ImplicitPlaneWidget2/#code","title":"Code","text":"

        ImplicitPlaneWidget2.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkClipPolyData.h>\n#include <vtkCommand.h>\n#include <vtkImplicitPlaneRepresentation.h>\n#include <vtkImplicitPlaneWidget2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlane.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nnamespace {\n// Callback for the interaction\n// This does the actual work: updates the vtkPlane implicit function.\n// This in turn causes the pipeline to update and clip the object.\nclass vtkIPWCallback : public vtkCommand\n{\npublic:\n  static vtkIPWCallback* New()\n  {\n    return new vtkIPWCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkImplicitPlaneWidget2* planeWidget =\n        reinterpret_cast<vtkImplicitPlaneWidget2*>(caller);\n    vtkImplicitPlaneRepresentation* rep =\n        reinterpret_cast<vtkImplicitPlaneRepresentation*>(\n            planeWidget->GetRepresentation());\n    rep->GetPlane(this->plane);\n  }\n\n  vtkIPWCallback() = default;\n\n  vtkPlane* plane{nullptr};\n};\n\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetRadius(10.0);\n\n  vtkNew<vtkXMLPolyDataReader> reader;\n\n  // Setup a visualization pipeline.\n  vtkNew<vtkPlane> plane;\n  vtkNew<vtkClipPolyData> clipper;\n  clipper->SetClipFunction(plane);\n  clipper->InsideOutOn();\n  if (argc < 2)\n  {\n    clipper->SetInputConnection(sphereSource->GetOutputPort());\n  }\n  else\n  {\n    reader->SetFileName(argv[1]);\n    clipper->SetInputConnection(reader->GetOutputPort());\n  }\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(clipper->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkProperty> backFaces;\n  backFaces->SetDiffuseColor(colors->GetColor3d(\"Gold\").GetData());\n\n  actor->SetBackfaceProperty(backFaces);\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"ImplicitPlaneWidget2\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // The callback will do the work.\n  vtkNew<vtkIPWCallback> myCallback;\n  myCallback->plane = plane;\n\n  vtkNew<vtkImplicitPlaneRepresentation> rep;\n  rep->SetPlaceFactor(1.25); // This must be set prior to placing the widget.\n  rep->PlaceWidget(actor->GetBounds());\n  rep->SetNormal(plane->GetNormal());\n\n  vtkNew<vtkImplicitPlaneWidget2> planeWidget;\n  planeWidget->SetInteractor(renderWindowInteractor);\n  planeWidget->SetRepresentation(rep);\n  planeWidget->AddObserver(vtkCommand::InteractionEvent, myCallback);\n\n  renderer->GetActiveCamera()->Azimuth(-60);\n  renderer->GetActiveCamera()->Elevation(30);\n  renderer->ResetCamera();\n  renderer->GetActiveCamera()->Zoom(0.75);\n\n  // Render and interact.\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  planeWidget->On();\n\n  // Begin mouse interaction.\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/ImplicitPlaneWidget2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ImplicitPlaneWidget2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ImplicitPlaneWidget2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ImplicitPlaneWidget2 MACOSX_BUNDLE ImplicitPlaneWidget2.cxx )\n  target_link_libraries(ImplicitPlaneWidget2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ImplicitPlaneWidget2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/ImplicitPlaneWidget2/#download-and-build-implicitplanewidget2","title":"Download and Build ImplicitPlaneWidget2","text":"

        Click here to download ImplicitPlaneWidget2 and its CMakeLists.txt file. Once the tarball ImplicitPlaneWidget2.tar has been downloaded and extracted,

        cd ImplicitPlaneWidget2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ImplicitPlaneWidget2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/LineWidget2/","title":"LineWidget2","text":"

        vtk-examples/Cxx/Widgets/LineWidget2

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/LineWidget2/#code","title":"Code","text":"

        LineWidget2.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkCommand.h>\n#include <vtkLineRepresentation.h>\n#include <vtkLineWidget2.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// This does the actual work.\n// Callback for the interaction\nclass vtkLineCallback : public vtkCommand\n{\npublic:\n  static vtkLineCallback* New()\n  {\n    return new vtkLineCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n\n    vtkLineWidget2* lineWidget = reinterpret_cast<vtkLineWidget2*>(caller);\n\n    // Get the actual box coordinates of the line\n    vtkNew<vtkPolyData> polydata;\n    static_cast<vtkLineRepresentation*>(lineWidget->GetRepresentation())\n        ->GetPolyData(polydata);\n\n    // Display one of the points, just so we know it's working\n    double p[3];\n    polydata->GetPoint(0, p);\n    std::cout << \"P: \" << p[0] << \" \" << p[1] << \" \" << p[2] << std::endl;\n  }\n  vtkLineCallback()\n  {\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LineWidget2\");\n\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkLineWidget2> lineWidget;\n  lineWidget->SetInteractor(renderWindowInteractor);\n  lineWidget->CreateDefaultRepresentation();\n\n  // You could do this if you want to set properties at this point:\n  // vtkNew<vtkLineRepresentation> lineRepresentation;\n  // lineWidget->SetRepresentation(lineRepresentation);\n\n  vtkNew<vtkLineCallback> lineCallback;\n\n  lineWidget->AddObserver(vtkCommand::InteractionEvent, lineCallback);\n\n  // Render\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  lineWidget->On();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/LineWidget2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LineWidget2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LineWidget2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LineWidget2 MACOSX_BUNDLE LineWidget2.cxx )\n  target_link_libraries(LineWidget2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LineWidget2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/LineWidget2/#download-and-build-linewidget2","title":"Download and Build LineWidget2","text":"

        Click here to download LineWidget2 and its CMakeLists.txt file. Once the tarball LineWidget2.tar has been downloaded and extracted,

        cd LineWidget2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LineWidget2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/LogoWidget/","title":"LogoWidget","text":"

        vtk-examples/Cxx/Widgets/LogoWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/LogoWidget/#description","title":"Description","text":"

        Turn the widget on before the render. Otherwise, it won't appear until you interact with the scene.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/LogoWidget/#code","title":"Code","text":"

        LogoWidget.cxx

        #include <vtkActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkLogoRepresentation.h>\n#include <vtkLogoWidget.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n\n#include <array>\n\nint main(int, char*[])\n{\n\n  vtkNew<vtkNamedColors> colors;\n  // colors->SetColor(\"Bkg\", 0.2, 0.3, 0.4);\n\n  // A sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(4.0);\n  sphereSource->SetPhiResolution(4);\n  sphereSource->SetThetaResolution(8);\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"LogoWidget\");\n\n  renderer->AddActor(actor);\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 200, 0, 200, 0, 0);\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"Coral\").GetData();\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color2 = colors->GetColor3ub(\"Black\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n\n  // Clear the image.\n  // Note: SetDrawColour() uses double values of the rgb colors in the\n  //       range [0 ... 255]\n  //       So SetDrawColour(255, 255, 255) is white.\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(0, 200, 0, 200);\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(100, 100, 50);\n  drawing->Update();\n\n  vtkNew<vtkLogoRepresentation> logoRepresentation;\n  logoRepresentation->SetImage(drawing->GetOutput());\n  logoRepresentation->SetPosition(0, 0);\n  logoRepresentation->SetPosition2(0.4, 0.4);\n  logoRepresentation->GetImageProperty()->SetOpacity(.7);\n\n  vtkNew<vtkLogoWidget> logoWidget;\n  logoWidget->SetInteractor(renderWindowInteractor);\n  logoWidget->SetRepresentation(logoRepresentation);\n\n  renderWindow->Render();\n  logoWidget->On();\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBLue\").GetData());\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/LogoWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(LogoWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  ImagingSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"LogoWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(LogoWidget MACOSX_BUNDLE LogoWidget.cxx )\n  target_link_libraries(LogoWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS LogoWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/LogoWidget/#download-and-build-logowidget","title":"Download and Build LogoWidget","text":"

        Click here to download LogoWidget and its CMakeLists.txt file. Once the tarball LogoWidget.tar has been downloaded and extracted,

        cd LogoWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./LogoWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/OrientationMarkerWidget/","title":"OrientationMarkerWidget","text":"

        vtk-examples/Cxx/Widgets/OrientationMarkerWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/OrientationMarkerWidget/#code","title":"Code","text":"

        OrientationMarkerWidget.cxx

        #include <vtkActor.h>\n#include <vtkAnnotatedCubeActor.h>\n#include <vtkCamera.h>\n#include <vtkCubeSource.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // create a rendering window and renderer;\n  vtkNew<vtkRenderer> ren;\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren);\n  renWin->SetWindowName(\"OrientationMarkerWidget\");\n\n  // create a renderwindowinteractor;\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<vtkCubeSource> cube;\n  cube->SetXLength(200);\n  cube->SetYLength(200);\n  cube->SetZLength(200);\n  cube->Update();\n  vtkNew<vtkPolyDataMapper> cm;\n  cm->SetInputConnection(cube->GetOutputPort());\n  vtkNew<vtkActor> ca;\n  ca->SetMapper(cm);\n  ca->GetProperty()->SetColor(colors->GetColor3d(\"BurlyWood\").GetData());\n  ca->GetProperty()->EdgeVisibilityOn();\n  ca->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Red\").GetData());\n\n  // assign actor to the renderer;\n  ren->AddActor(ca);\n  ren->SetBackground(colors->GetColor3d(\"CornflowerBlue\").GetData());\n\n  vtkNew<vtkAnnotatedCubeActor> axesActor;\n  axesActor->SetXPlusFaceText(\"L\");\n  axesActor->SetXMinusFaceText(\"R\");\n  axesActor->SetYMinusFaceText(\"I\");\n  axesActor->SetYPlusFaceText(\"S\");\n  axesActor->SetZMinusFaceText(\"P\");\n  axesActor->SetZPlusFaceText(\"A\");\n  axesActor->GetTextEdgesProperty()->SetColor(\n      colors->GetColor3d(\"Yellow\").GetData());\n  axesActor->GetTextEdgesProperty()->SetLineWidth(2);\n  axesActor->GetCubeProperty()->SetColor(colors->GetColor3d(\"Blue\").GetData());\n  vtkNew<vtkOrientationMarkerWidget> axes;\n  axes->SetOrientationMarker(axesActor);\n  axes->SetInteractor(iren);\n  axes->EnabledOn();\n  axes->InteractiveOn();\n  ren->ResetCamera();\n\n  // enable user interface interactor;\n  iren->Initialize();\n  renWin->Render();\n  ren->GetActiveCamera()->Azimuth(45);\n  ren->GetActiveCamera()->Elevation(30);\n  renWin->Render();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/OrientationMarkerWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientationMarkerWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientationMarkerWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientationMarkerWidget MACOSX_BUNDLE OrientationMarkerWidget.cxx )\n  target_link_libraries(OrientationMarkerWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientationMarkerWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/OrientationMarkerWidget/#download-and-build-orientationmarkerwidget","title":"Download and Build OrientationMarkerWidget","text":"

        Click here to download OrientationMarkerWidget and its CMakeLists.txt file. Once the tarball OrientationMarkerWidget.tar has been downloaded and extracted,

        cd OrientationMarkerWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OrientationMarkerWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/OrientationMarkerWidget1/","title":"OrientationMarkerWidget1","text":"

        vtk-examples/Cxx/Widgets/OrientationMarkerWidget1

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/OrientationMarkerWidget1/#description","title":"Description","text":"

        This example uses a polydata as an orientation icon. You can get the bunny data src/Testing/Data/Bunny.vtp.

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/OrientationMarkerWidget1/#code","title":"Code","text":"

        OrientationMarkerWidget1.cxx

        #include <vtkActor.h>\n#include <vtkDataSetMapper.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkOrientationMarkerWidget.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSuperquadricSource.h>\n#include <vtkXMLPolyDataReader.h>\n\nint main(int argc, char* argv[])\n{\n  // Parse command line arguments\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtp) e.g. Bunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  // Read the polydata for the icon\n  vtkNew<vtkXMLPolyDataReader> reader;\n  reader->SetFileName(argv[1]);\n\n  vtkNew<vtkDataSetMapper> iconMapper;\n  iconMapper->SetInputConnection(reader->GetOutputPort());\n\n  vtkNew<vtkActor> iconActor;\n  iconActor->SetMapper(iconMapper);\n  iconActor->GetProperty()->SetColor(colors->GetColor3d(\"Silver\").GetData());\n\n  // Set up the renderer, window, and interactor\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(renderer);\n  renWin->SetSize(400, 400);\n  renWin->SetWindowName(\"OrientationMarkerWidget1\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  double r;\n  double g;\n  double b;\n  colors->GetColor(\"Wheat\", r, g, b);\n  // Set up the widget\n  vtkNew<vtkOrientationMarkerWidget> widget;\n  widget->SetOrientationMarker(iconActor);\n  widget->SetInteractor(iren);\n  widget->SetViewport(0.0, 0.0, 0.2, 0.2);\n  widget->SetOutlineColor(r, g, b);\n  widget->SetEnabled(1);\n  widget->InteractiveOn();\n\n  // Create a superquadric\n  vtkNew<vtkSuperquadricSource> superquadricSource;\n  superquadricSource->SetPhiRoundness(0.2);\n  superquadricSource->SetThetaRoundness(0.8);\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> superquadricMapper;\n  superquadricMapper->SetInputConnection(superquadricSource->GetOutputPort());\n\n  vtkNew<vtkActor> superquadricActor;\n  superquadricActor->SetMapper(superquadricMapper);\n  superquadricActor->GetProperty()->SetInterpolationToFlat();\n  superquadricActor->GetProperty()->SetDiffuseColor(\n      colors->GetColor3d(\"Carrot\").GetData());\n  superquadricActor->GetProperty()->SetSpecularColor(\n      colors->GetColor3d(\"White\").GetData());\n  superquadricActor->GetProperty()->SetDiffuse(.6);\n  superquadricActor->GetProperty()->SetSpecular(.5);\n  superquadricActor->GetProperty()->SetSpecularPower(5.0);\n\n  renderer->AddActor(superquadricActor);\n  renderer->ResetCamera();\n\n  renWin->Render();\n\n  iren->Initialize();\n\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/OrientationMarkerWidget1/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(OrientationMarkerWidget1)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  IOXML\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"OrientationMarkerWidget1: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(OrientationMarkerWidget1 MACOSX_BUNDLE OrientationMarkerWidget1.cxx )\n  target_link_libraries(OrientationMarkerWidget1 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS OrientationMarkerWidget1\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/OrientationMarkerWidget1/#download-and-build-orientationmarkerwidget1","title":"Download and Build OrientationMarkerWidget1","text":"

        Click here to download OrientationMarkerWidget1 and its CMakeLists.txt file. Once the tarball OrientationMarkerWidget1.tar has been downloaded and extracted,

        cd OrientationMarkerWidget1/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./OrientationMarkerWidget1\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/PlaneWidget/","title":"PlaneWidget","text":"

        vtk-examples/Cxx/Widgets/PlaneWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/PlaneWidget/#code","title":"Code","text":"

        PlaneWidget.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPlaneWidget.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"PlaneWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkPlaneWidget> planeWidget;\n  planeWidget->SetInteractor(renderWindowInteractor);\n\n  planeWidget->On();\n\n  renderWindowInteractor->Initialize();\n\n  renderer->ResetCamera();\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/PlaneWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(PlaneWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"PlaneWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(PlaneWidget MACOSX_BUNDLE PlaneWidget.cxx )\n  target_link_libraries(PlaneWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS PlaneWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/PlaneWidget/#download-and-build-planewidget","title":"Download and Build PlaneWidget","text":"

        Click here to download PlaneWidget and its CMakeLists.txt file. Once the tarball PlaneWidget.tar has been downloaded and extracted,

        cd PlaneWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./PlaneWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/RectilinearWipeWidget/","title":"RectilinearWipeWidget","text":"

        vtk-examples/Cxx/Widgets/RectilinearWipeWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/RectilinearWipeWidget/#description","title":"Description","text":"

        This example illustrates the Rectilinear Wipe widget. This widget is useful for comparing two images. There are 7 different image comparison modes. A rectilinear wipe is a 2x2 checkerboard pattern created by combining two separate images, where various combinations of the checker squares are possible. Using this widget, the user can adjust the layout of the checker pattern, such as moving the center point, moving the horizontal separator, or moving the vertical separator.

        Pressing keys 0-6 select the various wipe modes.

        For an alternative image comparison widget try the Checkerboard widget.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/RectilinearWipeWidget/#code","title":"Code","text":"

        RectilinearWipeWidget.cxx

        #include <vtkImageActor.h>\n#include <vtkImageMapper3D.h>\n#include <vtkImageReader2.h>\n#include <vtkImageReader2Factory.h>\n#include <vtkImageRectilinearWipe.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkObjectFactory.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRectilinearWipeRepresentation.h>\n#include <vtkRectilinearWipeWidget.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n// Define interaction style.\nclass WipeInteractorStyle : public vtkInteractorStyleImage\n{\npublic:\n  static WipeInteractorStyle* New();\n  vtkTypeMacro(WipeInteractorStyle, vtkInteractorStyleImage);\n\n  virtual void OnChar()\n  {\n    if (this->Wipe)\n    {\n      vtkRenderWindowInteractor* rwi = this->Interactor;\n      switch (rwi->GetKeyCode())\n      {\n      case '0':\n        this->Wipe->SetWipe(0);\n        break;\n      case '1':\n        this->Wipe->SetWipe(1);\n        break;\n      case '2':\n        this->Wipe->SetWipe(2);\n        break;\n      case '3':\n        this->Wipe->SetWipe(3);\n        break;\n      case '4':\n        this->Wipe->SetWipe(4);\n        break;\n      case '5':\n        this->Wipe->SetWipe(5);\n        break;\n      case '6':\n        this->Wipe->SetWipe(6);\n        break;\n      default:\n        this->Superclass::OnChar();\n        break;\n      }\n    }\n  }\n  void SetWipe(vtkImageRectilinearWipe* wipe)\n  {\n    this->Wipe = wipe;\n  }\n\nprotected:\n  WipeInteractorStyle()\n  {\n    this->Wipe = NULL;\n  }\n\nprivate:\n  vtkImageRectilinearWipe* Wipe;\n};\nvtkStandardNewMacro(WipeInteractorStyle);\n} // namespace\n\nint main(int argc, char* argv[])\n{\n  if (argc < 3)\n  {\n    std::cerr << \"Usage: \" << argv[0]\n              << \" Input1Filename Input2Filename e.g. Gourds2.jpg Ox.jpg\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  vtkNew<vtkNamedColors> colors;\n\n  int wipeMode = 0;\n  if (argc > 3)\n  {\n    wipeMode = atoi(argv[3]);\n  }\n  // Read the images.\n  vtkNew<vtkImageReader2Factory> readerFactory;\n  vtkSmartPointer<vtkImageReader2> reader1;\n  reader1.TakeReference(readerFactory->CreateImageReader2(argv[1]));\n  reader1->SetFileName(argv[1]);\n\n  vtkSmartPointer<vtkImageReader2> reader2;\n  reader2.TakeReference(readerFactory->CreateImageReader2(argv[2]));\n  reader2->SetFileName(argv[2]);\n\n  // Create a wipe pipeline.\n  vtkNew<vtkImageRectilinearWipe> wipe;\n  wipe->SetInputConnection(0, reader1->GetOutputPort());\n  wipe->SetInputConnection(1, reader2->GetOutputPort());\n  wipe->SetPosition(256, 256);\n  wipe->SetWipe(wipeMode);\n\n  // Create the RenderWindow, Renderer and both Actors.\n  //\n  vtkNew<vtkRenderer> ren1;\n  ren1->SetBackground(colors->GetColor3d(\"Wheat\").GetData());\n\n  vtkNew<vtkRenderWindow> renWin;\n  renWin->AddRenderer(ren1);\n  renWin->SetWindowName(\"RectilinearWipeWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> iren;\n  iren->SetRenderWindow(renWin);\n\n  vtkNew<WipeInteractorStyle> style;\n  iren->SetInteractorStyle(style);\n  style->SetWipe(wipe);\n\n  vtkNew<vtkImageActor> wipeActor;\n  wipeActor->GetMapper()->SetInputConnection(wipe->GetOutputPort());\n\n  // VTK widgets consist of two parts: the widget part that handles\n  // event processing; and the widget representation that defines how\n  // the widget appears in the scene,\n  // (i.e., matters pertaining to geometry).\n  vtkNew<vtkRectilinearWipeWidget> wipeWidget;\n  wipeWidget->SetInteractor(iren);\n\n  vtkRectilinearWipeRepresentation* wipeWidgetRep =\n      static_cast<vtkRectilinearWipeRepresentation*>(\n          wipeWidget->GetRepresentation());\n\n  wipeWidgetRep->SetImageActor(wipeActor);\n  wipeWidgetRep->SetRectilinearWipe(wipe);\n  wipeWidgetRep->GetProperty()->SetLineWidth(2.0);\n  wipeWidgetRep->GetProperty()->SetOpacity(0.75);\n\n  // Add the actors to the renderer, set the background and size.\n  //\n  ren1->AddActor(wipeActor);\n  renWin->SetSize(300, 300);\n\n  // Render the image.\n  //\n  renWin->Render();\n  wipeWidget->On();\n  iren->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/RectilinearWipeWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(RectilinearWipeWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  IOImage\n  ImagingHybrid\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"RectilinearWipeWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(RectilinearWipeWidget MACOSX_BUNDLE RectilinearWipeWidget.cxx )\n  target_link_libraries(RectilinearWipeWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS RectilinearWipeWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/RectilinearWipeWidget/#download-and-build-rectilinearwipewidget","title":"Download and Build RectilinearWipeWidget","text":"

        Click here to download RectilinearWipeWidget and its CMakeLists.txt file. Once the tarball RectilinearWipeWidget.tar has been downloaded and extracted,

        cd RectilinearWipeWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./RectilinearWipeWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/ScalarBarWidget/","title":"ScalarBarWidget","text":"

        vtk-examples/Cxx/Widgets/ScalarBarWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/ScalarBarWidget/#code","title":"Code","text":"

        ScalarBarWidget.cxx

        #include <vtkActor.h>\n#include <vtkCamera.h>\n#include <vtkDataSetMapper.h>\n#include <vtkLookupTable.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkScalarBarActor.h>\n#include <vtkScalarBarWidget.h>\n#include <vtkUnstructuredGrid.h>\n#include <vtkUnstructuredGridReader.h>\n\n#include <iostream>\n#include <string>\n\nint main(int argc, char* argv[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Parse command line arguments.\n  if (argc != 2)\n  {\n    std::cerr << \"Usage: \" << argv[0] << \" Filename(.vtk) e.g.uGridEx.vtk\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  // Create a custom lut. The lut is used for both the mapper and the\n  // scalarBar.\n  vtkNew<vtkLookupTable> lut;\n  lut->Build();\n\n  // Read the source file.\n  vtkNew<vtkUnstructuredGridReader> reader;\n  reader->SetFileName(argv[1]);\n  reader->Update(); // Needed because of GetScalarRange.\n  auto output = reader->GetOutput();\n  auto scalarRange = output->GetScalarRange();\n\n  vtkNew<vtkDataSetMapper> mapper;\n  mapper->SetInputData(output);\n  mapper->SetScalarRange(scalarRange);\n  mapper->SetLookupTable(lut);\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(300, 300);\n  renderWindow->SetWindowName(\"ScalarBarWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Create the scalarBar.\n  vtkNew<vtkScalarBarActor> scalarBar;\n  scalarBar->SetOrientationToHorizontal();\n  scalarBar->SetLookupTable(lut);\n\n  // Create the scalarBarWidget.\n  vtkNew<vtkScalarBarWidget> scalarBarWidget;\n  scalarBarWidget->SetInteractor(interactor);\n  scalarBarWidget->SetScalarBarActor(scalarBar);\n  scalarBarWidget->On();\n\n  interactor->Initialize();\n  renderWindow->Render();\n  renderer->GetActiveCamera()->SetPosition(-6.4, 10.3, 1.4);\n  renderer->GetActiveCamera()->SetFocalPoint(1.0, 0.5, 3.0);\n  renderer->GetActiveCamera()->SetViewUp(0.6, 0.4, -0.7);\n  renderWindow->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/ScalarBarWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(ScalarBarWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  IOLegacy\n  InteractionStyle\n  InteractionWidgets\n  RenderingAnnotation\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"ScalarBarWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(ScalarBarWidget MACOSX_BUNDLE ScalarBarWidget.cxx )\n  target_link_libraries(ScalarBarWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS ScalarBarWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/ScalarBarWidget/#download-and-build-scalarbarwidget","title":"Download and Build ScalarBarWidget","text":"

        Click here to download ScalarBarWidget and its CMakeLists.txt file. Once the tarball ScalarBarWidget.tar has been downloaded and extracted,

        cd ScalarBarWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./ScalarBarWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/SeedWidget/","title":"SeedWidget","text":"

        vtk-examples/Cxx/Widgets/SeedWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/SeedWidget/#description","title":"Description","text":"

        This example demonstrates how to use vtkSeedWidget, which generates (seeds) points to be placed in the scene in the locations where the user clicks.

        The points can then be used for operations like connectivity, segmentation, and region growing. For an example using a custom callback where such operations can be assembled, see SeedWidgetWithCustomCallback.

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/SeedWidget/#code","title":"Code","text":"

        SeedWidget.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointHandleRepresentation2D.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h> // For setting the color in the handles.\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSeedRepresentation.h>\n#include <vtkSeedWidget.h>\n#include <vtkSphereSource.h>\n\nint main(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor.\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> window;\n  window->AddRenderer(renderer);\n  window->SetWindowName(\"SeedWidget\");\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(window);\n\n  // Create the representation for the seed widget and for its handles.\n  vtkNew<vtkPointHandleRepresentation2D> handleRep;\n  handleRep->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  vtkNew<vtkSeedRepresentation> widgetRep;\n  widgetRep->SetHandleRepresentation(handleRep);\n\n  // Create the seed widget.\n  vtkNew<vtkSeedWidget> seedWidget;\n  seedWidget->SetInteractor(interactor);\n  seedWidget->SetRepresentation(widgetRep);\n\n  seedWidget->On();\n  window->Render();\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/SeedWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SeedWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SeedWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SeedWidget MACOSX_BUNDLE SeedWidget.cxx )\n  target_link_libraries(SeedWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SeedWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/SeedWidget/#download-and-build-seedwidget","title":"Download and Build SeedWidget","text":"

        Click here to download SeedWidget and its CMakeLists.txt file. Once the tarball SeedWidget.tar has been downloaded and extracted,

        cd SeedWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SeedWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/SeedWidgetImage/","title":"SeedWidgetImage","text":"

        vtk-examples/Cxx/Widgets/SeedWidgetImage

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/SeedWidgetImage/#code","title":"Code","text":"

        SeedWidgetImage.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkImageActor.h>\n#include <vtkImageCanvasSource2D.h>\n#include <vtkInteractorStyleImage.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointHandleRepresentation2D.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSeedRepresentation.h>\n#include <vtkSeedWidget.h>\n#include <vtkSmartPointer.h>\n\n#include <array>\n#include <iostream>\n#include <string>\n\nnamespace {\nclass vtkSeedImageCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkSeedImageCallback* New()\n  {\n    return new vtkSeedImageCallback;\n  }\n\n  vtkSeedImageCallback() = default;\n\n  virtual void Execute(vtkObject*, unsigned long event, void* calldata)\n  {\n    if (event == vtkCommand::PlacePointEvent)\n    {\n      std::cout << \"Placing point...\" << std::endl;\n      std::cout << \"There are now \"\n                << this->SeedRepresentation->GetNumberOfSeeds() << \" seeds.\"\n                << std::endl;\n      for (unsigned int seedId = 0; static_cast<int>(seedId) <\n           this->SeedRepresentation->GetNumberOfSeeds();\n           seedId++)\n      {\n        double pos[3];\n        this->SeedRepresentation->GetSeedDisplayPosition(seedId, pos);\n        std::cout << \"Seed \" << seedId << \" : (\" << pos[0] << \" \" << pos[1]\n                  << \" \" << pos[2] << \")\" << std::endl;\n      }\n      return;\n    }\n    if (event == vtkCommand::InteractionEvent)\n    {\n      std::cout << \"Interaction...\" << std::endl;\n      if (calldata)\n      {\n        double pos[3];\n        this->SeedRepresentation->GetSeedDisplayPosition(0, pos);\n        std::cout << \"Moved to (\" << pos[0] << \" \" << pos[1] << \" \" << pos[2]\n                  << \")\" << std::endl;\n      }\n      return;\n    }\n  }\n\n  void SetRepresentation(vtkSmartPointer<vtkSeedRepresentation> rep)\n  {\n    this->SeedRepresentation = rep;\n  }\n  void SetWidget(vtkSmartPointer<vtkSeedWidget> widget)\n  {\n    this->SeedWidget = widget;\n  }\n\nprivate:\n  vtkSeedRepresentation* SeedRepresentation = nullptr;\n  vtkSeedWidget* SeedWidget = nullptr;\n};\n} // namespace\n\nint main(int /* argc */, char* /* argv */[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<double, 3> drawColor1{0, 0, 0};\n  std::array<double, 3> drawColor2{0, 0, 0};\n  auto color1 = colors->GetColor3ub(\"MidnightBlue\").GetData();\n  auto color2 = colors->GetColor3ub(\"Tomato\").GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    drawColor1[i] = color1[i];\n    drawColor2[i] = color2[i];\n  }\n  // Create an image.\n  vtkNew<vtkImageCanvasSource2D> drawing;\n  drawing->SetScalarTypeToUnsignedChar();\n  drawing->SetNumberOfScalarComponents(3);\n  drawing->SetExtent(0, 20, 0, 50, 0, 0);\n  // Make a blue background.\n  drawing->SetDrawColor(drawColor1.data());\n  drawing->FillBox(0, 20, 0, 50);\n  // Make a red circle.\n  drawing->SetDrawColor(drawColor2.data());\n  drawing->DrawCircle(9, 10, 5);\n  drawing->Update();\n\n  vtkNew<vtkImageActor> imageActor;\n  imageActor->SetInputData(drawing->GetOutput());\n\n  // Create a renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->AddActor(imageActor);\n  renderer->SetBackground(colors->GetColor3d(\"DarkSlateGray\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SeedWidgetImage\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Setup interactor style.\n  vtkNew<vtkInteractorStyleImage> interactorStyleImage;\n  renderWindowInteractor->SetInteractorStyle(interactorStyleImage);\n\n  // Create the representation\n  vtkNew<vtkPointHandleRepresentation2D> handle;\n  handle->GetProperty()->SetColor(1, 0, 0);\n  vtkNew<vtkSeedRepresentation> rep;\n  rep->SetHandleRepresentation(handle);\n\n  // Seed widget.\n  vtkNew<vtkSeedWidget> seedWidget;\n  seedWidget->SetInteractor(renderWindowInteractor);\n  seedWidget->SetRepresentation(rep);\n\n  vtkNew<vtkSeedImageCallback> seedCallback;\n  seedCallback->SetRepresentation(rep);\n  seedCallback->SetWidget(seedWidget);\n  seedWidget->AddObserver(vtkCommand::PlacePointEvent, seedCallback);\n  seedWidget->AddObserver(vtkCommand::InteractionEvent, seedCallback);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  seedWidget->On();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/SeedWidgetImage/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SeedWidgetImage)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  ImagingSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SeedWidgetImage: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SeedWidgetImage MACOSX_BUNDLE SeedWidgetImage.cxx )\n  target_link_libraries(SeedWidgetImage PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SeedWidgetImage\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/SeedWidgetImage/#download-and-build-seedwidgetimage","title":"Download and Build SeedWidgetImage","text":"

        Click here to download SeedWidgetImage and its CMakeLists.txt file. Once the tarball SeedWidgetImage.tar has been downloaded and extracted,

        cd SeedWidgetImage/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SeedWidgetImage\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/SeedWidgetWithCustomCallback/","title":"SeedWidgetWithCustomCallback","text":"

        vtk-examples/Cxx/Widgets/SeedWidgetWithCustomCallback

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/SeedWidgetWithCustomCallback/#descriptionn","title":"Descriptionn","text":"

        This example demonstrates how to place seed points in the scene. The seed points can be used for operations like connectivity, segmentation, and region growing.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/SeedWidgetWithCustomCallback/#code","title":"Code","text":"

        SeedWidgetWithCustomCallback.cxx

        #include <vtkActor.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPointHandleRepresentation2D.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSeedRepresentation.h>\n#include <vtkSeedWidget.h>\n#include <vtkSphereSource.h>\n\nnamespace {\nclass vtkSeedCallback : public vtkCommand\n{\npublic:\n  static vtkSeedCallback* New()\n  {\n    return new vtkSeedCallback;\n  }\n\n  vtkSeedCallback()\n  {\n  }\n\n  virtual void Execute(vtkObject*, unsigned long event, void* calldata)\n  {\n    if (event == vtkCommand::PlacePointEvent)\n    {\n      std::cout << \"Point placed, total of: \"\n                << this->SeedRepresentation->GetNumberOfSeeds() << std::endl;\n    }\n    if (event == vtkCommand::InteractionEvent)\n    {\n      if (calldata)\n      {\n        std::cout << \"Interacting with seed : \"\n                  << *(static_cast<int*>(calldata)) << std::endl;\n      }\n    }\n\n    std::cout << \"List of seeds (Display coordinates):\" << std::endl;\n    for (vtkIdType i = 0; i < this->SeedRepresentation->GetNumberOfSeeds(); i++)\n    {\n      double pos[3];\n      this->SeedRepresentation->GetSeedDisplayPosition(i, pos);\n      std::cout << \"(\" << pos[0] << \" \" << pos[1] << \" \" << pos[2] << \")\"\n                << std::endl;\n    }\n  }\n\n  void SetRepresentation(vtkSeedRepresentation* rep)\n  {\n    this->SeedRepresentation = rep;\n  }\n\nprivate:\n  vtkSeedRepresentation* SeedRepresentation;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  // Create a mapper and actor\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SeedWidgetWithCustomCallback\");\n\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n  renderer->AddActor(actor);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create the representation\n  vtkNew<vtkPointHandleRepresentation2D> handle;\n  handle->GetProperty()->SetColor(colors->GetColor3d(\"Red\").GetData());\n  vtkNew<vtkSeedRepresentation> rep;\n  rep->SetHandleRepresentation(handle);\n\n  // Seed widget\n  vtkNew<vtkSeedWidget> seedWidget;\n  seedWidget->SetInteractor(renderWindowInteractor);\n  seedWidget->SetRepresentation(rep);\n\n  vtkNew<vtkSeedCallback> seedCallback;\n  seedCallback->SetRepresentation(rep);\n  seedWidget->AddObserver(vtkCommand::PlacePointEvent, seedCallback);\n  seedWidget->AddObserver(vtkCommand::InteractionEvent, seedCallback);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  seedWidget->On();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/SeedWidgetWithCustomCallback/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SeedWidgetWithCustomCallback)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SeedWidgetWithCustomCallback: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SeedWidgetWithCustomCallback MACOSX_BUNDLE SeedWidgetWithCustomCallback.cxx )\n  target_link_libraries(SeedWidgetWithCustomCallback PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SeedWidgetWithCustomCallback\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/SeedWidgetWithCustomCallback/#download-and-build-seedwidgetwithcustomcallback","title":"Download and Build SeedWidgetWithCustomCallback","text":"

        Click here to download SeedWidgetWithCustomCallback and its CMakeLists.txt file. Once the tarball SeedWidgetWithCustomCallback.tar has been downloaded and extracted,

        cd SeedWidgetWithCustomCallback/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SeedWidgetWithCustomCallback\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/Slider/","title":"Slider","text":"

        vtk-examples/Cxx/Widgets/Slider

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/Slider/#description","title":"Description","text":"

        This example demonstrates how to use a 3D slider widget. Here, the slider controls the resolution of the sphere. The slider is positioned in world coordinates - so if you rotate/translate/scale the scene, the slider will change orientation/position/size. Contrast this with Slider2D that remains at a fixed location in the window.

        If the callback is connected to InteractionEvent, the scene will update whenever the mouse is moved on the slider. This is not ideal if the re-rendering takes significant time as it will make the interaction very choppy. If you want to move the slider and have the scene update when the mouse button is released, connect the callback to EndInteractionEvent instead.

        Note

        This original source code for this example is here.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/Slider/#code","title":"Code","text":"

        Slider.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkCamera.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation3D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n\nnamespace {\n// The callback does the work.\n// The callback keeps a pointer to the sphere whose resolution is\n// controlled. After constructing the callback, the program sets the\n// SphereSource of the callback to the object to be controlled.\nclass vtkSliderCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->SphereSource->SetPhiResolution(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue() /\n        2);\n    this->SphereSource->SetThetaResolution(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n  }\n  vtkSliderCallback() : SphereSource(0)\n  {\n  }\n  vtkSphereSource* SphereSource;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(4.0);\n  sphereSource->SetPhiResolution(4);\n  sphereSource->SetThetaResolution(8);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n  actor->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Slider\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation3D> sliderRep;\n  sliderRep->SetMinimumValue(3.0);\n  sliderRep->SetMaximumValue(50.0);\n  sliderRep->SetValue(sphereSource->GetThetaResolution());\n  sliderRep->SetTitleText(\"Sphere Resolution\");\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToWorld();\n  sliderRep->GetPoint1Coordinate()->SetValue(-4, 6, 0);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToWorld();\n  sliderRep->GetPoint2Coordinate()->SetValue(4, 6, 0);\n  sliderRep->SetSliderLength(0.075);\n  sliderRep->SetSliderWidth(0.05);\n  sliderRep->SetEndCapLength(0.05);\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->SphereSource = sphereSource;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderer->GetActiveCamera()->Dolly(0.9);\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/Slider/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Slider)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Slider: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Slider MACOSX_BUNDLE Slider.cxx )\n  target_link_libraries(Slider PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Slider\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/Slider/#download-and-build-slider","title":"Download and Build Slider","text":"

        Click here to download Slider and its CMakeLists.txt file. Once the tarball Slider.tar has been downloaded and extracted,

        cd Slider/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Slider\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/Slider2D/","title":"Slider2D","text":"

        vtk-examples/Cxx/Widgets/Slider2D

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/Slider2D/#description","title":"Description","text":"

        This example demonstrates how to use a slider that is drawn in window coordinates - so if you move the scene the slider is not affected. Contrast this with the 3D slider widget that remains at a fixed location in the world coordinates.

        If the callback is connected to InteractionEvent, the scene will update immediately. This is not ideal if the re-rendering takes significant time as it will make the interaction very choppy. If you want to move the slider and have the scene update when the mouse button is released, connect the callback to EndInteractionEvent instead.

        Note

        This original source code for this example is here.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/Slider2D/#code","title":"Code","text":"

        Slider2D.cxx

        #include <vtkActor.h>\n#include <vtkCallbackCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkProperty2D.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSliderRepresentation2D.h>\n#include <vtkSliderWidget.h>\n#include <vtkSphereSource.h>\n#include <vtkTextProperty.h>\n\nnamespace {\n// This does the actual work.\n// Callback for the interaction.\nclass vtkSliderCallback : public vtkCallbackCommand\n{\npublic:\n  static vtkSliderCallback* New()\n  {\n    return new vtkSliderCallback;\n  }\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSliderWidget* sliderWidget = reinterpret_cast<vtkSliderWidget*>(caller);\n    this->SphereSource->SetPhiResolution(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n    this->SphereSource->SetThetaResolution(\n        static_cast<vtkSliderRepresentation*>(sliderWidget->GetRepresentation())\n            ->GetValue());\n  }\n  vtkSliderCallback() : SphereSource(0)\n  {\n  }\n  vtkSphereSource* SphereSource;\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A sphere.\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->SetCenter(0.0, 0.0, 0.0);\n  sphereSource->SetRadius(4.0);\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetInterpolationToFlat();\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n  actor->GetProperty()->SetEdgeColor(colors->GetColor3d(\"Tomato\").GetData());\n  actor->GetProperty()->EdgeVisibilityOn();\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"Slider2D\");\n  renderWindow->SetSize(640, 480);\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Add the actors to the scene.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"SlateGray\").GetData());\n\n  // Render an image (lights and cameras are created automatically).\n  renderWindow->Render();\n\n  vtkNew<vtkSliderRepresentation2D> sliderRep;\n\n  sliderRep->SetMinimumValue(3.0);\n  sliderRep->SetMaximumValue(20.0);\n  sliderRep->SetValue(5.0);\n  sliderRep->SetTitleText(\"Sphere Resolution\");\n\n  // Set color properties:\n  //   // Set color properties:\n  // Change the color of the knob that slides\n  sliderRep->GetSliderProperty()->SetColor(\n      colors->GetColor3d(\"Green\").GetData());\n  // Change the color of the text indicating what the slider controls\n  sliderRep->GetTitleProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  // Change the color of the text displaying the value\n  sliderRep->GetLabelProperty()->SetColor(\n      colors->GetColor3d(\"AliceBlue\").GetData());\n  // Change the color of the knob when the mouse is held on it\n  sliderRep->GetSelectedProperty()->SetColor(\n      colors->GetColor3d(\"DeepPink\").GetData());\n  // Change the color of the bar\n  sliderRep->GetTubeProperty()->SetColor(\n      colors->GetColor3d(\"MistyRose\").GetData());\n  // Change the color of the ends of the bar\n  sliderRep->GetCapProperty()->SetColor(colors->GetColor3d(\"Yellow\").GetData());\n  sliderRep->SetSliderLength(0.05);\n  sliderRep->SetSliderWidth(0.025);\n  sliderRep->SetEndCapLength(0.02);\n\n  // Display pixel values (640 X 480)\n  // sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToDisplay();\n  // sliderRep->GetPoint1Coordinate()->SetValue(128, 48);\n  // sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToDisplay();\n  // sliderRep->GetPoint2Coordinate()->SetValue(512, 48);\n  // Or use this - better because it scales to the window size:\n  sliderRep->GetPoint1Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint1Coordinate()->SetValue(0.2, 0.1);\n  sliderRep->GetPoint2Coordinate()->SetCoordinateSystemToNormalizedDisplay();\n  sliderRep->GetPoint2Coordinate()->SetValue(0.8, 0.1);\n\n  vtkNew<vtkSliderWidget> sliderWidget;\n  sliderWidget->SetInteractor(renderWindowInteractor);\n  sliderWidget->SetRepresentation(sliderRep);\n  sliderWidget->SetAnimationModeToAnimate();\n  sliderWidget->EnabledOn();\n\n  vtkNew<vtkSliderCallback> callback;\n  callback->SphereSource = sphereSource;\n\n  sliderWidget->AddObserver(vtkCommand::InteractionEvent, callback);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/Slider2D/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(Slider2D)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"Slider2D: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(Slider2D MACOSX_BUNDLE Slider2D.cxx )\n  target_link_libraries(Slider2D PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS Slider2D\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/Slider2D/#download-and-build-slider2d","title":"Download and Build Slider2D","text":"

        Click here to download Slider2D and its CMakeLists.txt file. Once the tarball Slider2D.tar has been downloaded and extracted,

        cd Slider2D/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./Slider2D\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/SphereWidget/","title":"SphereWidget","text":"

        vtk-examples/Cxx/Widgets/SphereWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/SphereWidget/#code","title":"Code","text":"

        SphereWidget.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereWidget.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\nclass SphereCallback : public vtkCallbackCommand\n{\npublic:\n  static SphereCallback* New()\n  {\n    return new SphereCallback;\n  }\n  SphereCallback()\n  {\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n\n    vtkSphereWidget* sphereWidget = reinterpret_cast<vtkSphereWidget*>(caller);\n\n    double center[3];\n    sphereWidget->GetCenter(center);\n    std::cout << \"Center: \" << center[0] << \" \" << center[1] << \" \" << center[2]\n              << std::endl;\n  }\n};\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SphereWidget\");\n\n  // An interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkSphereWidget> sphereWidget;\n  sphereWidget->SetInteractor(renderWindowInteractor);\n  sphereWidget->SetRepresentationToSurface();\n  sphereWidget->GetSphereProperty()->SetColor(\n      colors->GetColor3d(\"BurlyWood\").GetData());\n\n  vtkNew<SphereCallback> sphereCallback;\n\n  sphereWidget->AddObserver(vtkCommand::InteractionEvent, sphereCallback);\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  sphereWidget->On();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/SphereWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SphereWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SphereWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SphereWidget MACOSX_BUNDLE SphereWidget.cxx )\n  target_link_libraries(SphereWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SphereWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/SphereWidget/#download-and-build-spherewidget","title":"Download and Build SphereWidget","text":"

        Click here to download SphereWidget and its CMakeLists.txt file. Once the tarball SphereWidget.tar has been downloaded and extracted,

        cd SphereWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SphereWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/SphereWidget2/","title":"SphereWidget2","text":"

        vtk-examples/Cxx/Widgets/SphereWidget2

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/SphereWidget2/#description","title":"Description","text":"

        The spherical coordinates of the widget's handle match the coordinates that it displays in the window. The world coordinates of the handle are also shown.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/SphereWidget2/#code","title":"Code","text":"

        SphereWidget2.cxx

        #include <vtkCommand.h>\n#include <vtkMath.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphere.h>\n#include <vtkSphereRepresentation.h>\n#include <vtkSphereWidget2.h>\n\nnamespace {\n// Callback that displays the sphere widget's spherical handle postion\n// in both sphercial (relative to the widget's center) and cartesian global\n// coordinates\nclass vtkSphereCallback : public vtkCommand\n{\npublic:\n  static vtkSphereCallback* New()\n  {\n    return new vtkSphereCallback;\n  }\n\n  virtual void Execute(vtkObject* caller, unsigned long, void*)\n  {\n    vtkSphereWidget2* sphereWidget =\n        reinterpret_cast<vtkSphereWidget2*>(caller);\n\n    double center[3], handlePosition[3];\n    vtkSphereRepresentation* sphereRepresentation =\n        dynamic_cast<vtkSphereRepresentation*>(\n            sphereWidget->GetRepresentation());\n    sphereRepresentation->GetHandlePosition(handlePosition);\n    sphereRepresentation->GetSphere(this->Sphere);\n\n    this->Sphere->GetCenter(center);\n\n    double radius = sqrt(static_cast<double>(\n        vtkMath::Distance2BetweenPoints(center, handlePosition)));\n    radius = (radius <= 0.0 ? 1.0 : radius);\n    double theta = vtkMath::DegreesFromRadians(atan2(\n        (handlePosition[1] - center[1]), (handlePosition[0] - center[0])));\n    double phi = vtkMath::DegreesFromRadians(\n        acos((handlePosition[2] - center[2]) / radius));\n\n    std::cout << \"r, theta, phi: (\" << std::setprecision(3) << radius << \", \"\n              << theta << \", \" << phi << \") \"\n              << \"x, y, z: (\" << handlePosition[0] << \", \" << handlePosition[1]\n              << \", \" << handlePosition[2] << \") \" << std::endl;\n  }\n\n  vtkSphereCallback()\n  {\n    this->Sphere = vtkSphere::New();\n  }\n  ~vtkSphereCallback()\n  {\n    this->Sphere->Delete();\n  }\n\n  vtkSphere* Sphere;\n};\n\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create a renderer and a render window\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SphereWidget2\");\n\n  // Create an interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create a sphere widget\n  vtkNew<vtkSphereWidget2> sphereWidget;\n  sphereWidget->SetInteractor(renderWindowInteractor);\n  sphereWidget->CreateDefaultRepresentation();\n\n  vtkSphereRepresentation* sphereRepresentation =\n      dynamic_cast<vtkSphereRepresentation*>(sphereWidget->GetRepresentation());\n  sphereRepresentation->HandleVisibilityOn();\n\n  vtkNew<vtkSphereCallback> sphereCallback;\n\n  sphereWidget->AddObserver(vtkCommand::InteractionEvent, sphereCallback);\n\n  renderWindow->Render();\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  sphereWidget->On();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/SphereWidget2/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SphereWidget2)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SphereWidget2: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SphereWidget2 MACOSX_BUNDLE SphereWidget2.cxx )\n  target_link_libraries(SphereWidget2 PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SphereWidget2\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/SphereWidget2/#download-and-build-spherewidget2","title":"Download and Build SphereWidget2","text":"

        Click here to download SphereWidget2 and its CMakeLists.txt file. Once the tarball SphereWidget2.tar has been downloaded and extracted,

        cd SphereWidget2/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SphereWidget2\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/SphereWidgetEvents/","title":"SphereWidgetEvents","text":"

        vtk-examples/Cxx/Widgets/SphereWidgetEvents

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/SphereWidgetEvents/#description","title":"Description","text":"

        This example shows how to subclass a widget so that events can be further customized.

        Contributed by: Alex Malyushytskyy.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/SphereWidgetEvents/#code","title":"Code","text":"

        SphereWidgetEvents.cxx

        #include <vtkCallbackCommand.h>\n#include <vtkCommand.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSmartPointer.h>\n#include <vtkSphereWidget.h>\n\n#include <iostream>\n#include <string>\n\nnamespace {\n\nclass MySphereWidget : public vtkSphereWidget\n{\npublic:\n  static MySphereWidget* New();\n  vtkTypeMacro(MySphereWidget, vtkSphereWidget);\n\n  // Handles the events\n  static void ProcessEvents(vtkObject* object, unsigned long event,\n                            void* clientdata, void* calldata);\n\nprotected:\n  MySphereWidget();\n\n  // Create a new callback command rather than using the one defined in\n  // vtkSphereWidget. This prevents problems with unexpected behavior due\n  // to the AbortFlag being manipulated.\n  vtkSmartPointer<vtkCallbackCommand> MyEventCallbackCommand;\n};\n\nMySphereWidget::MySphereWidget()\n{\n\n  this->MyEventCallbackCommand = vtkSmartPointer<vtkCallbackCommand>::New();\n\n  // Connect our own callback command to our own ProcessEvents function.\n  // This way we do not have to deal with side effects of\n  // SphereWidget::ProcessEvents.\n  this->MyEventCallbackCommand->SetCallback(MySphereWidget::ProcessEvents);\n\n  // Connect our callback function to a few events.\n  this->AddObserver(vtkCommand::StartInteractionEvent,\n                    this->MyEventCallbackCommand);\n\n  this->AddObserver(vtkCommand::InteractionEvent, this->MyEventCallbackCommand);\n\n  this->AddObserver(vtkCommand::EndInteractionEvent,\n                    this->MyEventCallbackCommand);\n}\n\nvoid MySphereWidget::ProcessEvents(vtkObject* vtkNotUsed(object),\n                                   unsigned long event,\n                                   void* vtkNotUsed(clientdata),\n                                   void* vtkNotUsed(calldata))\n{\n  switch (event)\n  {\n  case vtkCommand::StartInteractionEvent:\n    std::cout << \"StartInteractionEvent\" << std::endl;\n    break;\n  case vtkCommand::EndInteractionEvent:\n    std::cout << \"EndInteractionEvent\" << std::endl;\n    break;\n  case vtkCommand::InteractionEvent:\n    std::cout << \"InteractionEvent\" << std::endl;\n    break;\n  }\n}\n\nvtkStandardNewMacro(MySphereWidget);\n} // namespace\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create  a renderer and render window.\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SphereWidgetEvents\");\n\n  // Create an interactor.\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<MySphereWidget> sphereWidget;\n  sphereWidget->SetInteractor(renderWindowInteractor);\n  sphereWidget->SetRepresentationToSurface();\n  sphereWidget->HandleVisibilityOn();\n\n  renderWindow->Render();\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  sphereWidget->On();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/SphereWidgetEvents/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SphereWidgetEvents)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SphereWidgetEvents: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SphereWidgetEvents MACOSX_BUNDLE SphereWidgetEvents.cxx )\n  target_link_libraries(SphereWidgetEvents PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SphereWidgetEvents\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/SphereWidgetEvents/#download-and-build-spherewidgetevents","title":"Download and Build SphereWidgetEvents","text":"

        Click here to download SphereWidgetEvents and its CMakeLists.txt file. Once the tarball SphereWidgetEvents.tar has been downloaded and extracted,

        cd SphereWidgetEvents/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SphereWidgetEvents\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/SplineWidget/","title":"SplineWidget","text":"

        vtk-examples/Cxx/Widgets/SplineWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/SplineWidget/#description","title":"Description","text":"

        Note

        This original source code for this example is here.

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/SplineWidget/#code","title":"Code","text":"

        SplineWidget.cxx

        #include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSplineWidget2.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"SplineWidget\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  vtkNew<vtkSplineWidget2> splineWidget;\n  splineWidget->SetInteractor(renderWindowInteractor);\n\n  renderWindowInteractor->Initialize();\n  renderWindow->Render();\n  splineWidget->On();\n  renderer->ResetCamera();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/SplineWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(SplineWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"SplineWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(SplineWidget MACOSX_BUNDLE SplineWidget.cxx )\n  target_link_libraries(SplineWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS SplineWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/SplineWidget/#download-and-build-splinewidget","title":"Download and Build SplineWidget","text":"

        Click here to download SplineWidget and its CMakeLists.txt file. Once the tarball SplineWidget.tar has been downloaded and extracted,

        cd SplineWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./SplineWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/TextWidget/","title":"TextWidget","text":"

        vtk-examples/Cxx/Widgets/TextWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/TextWidget/#description","title":"Description","text":"

        Seealso

        DrawText

        Other languages

        See (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/TextWidget/#code","title":"Code","text":"

        TextWidget.cxx

        #include <vtkActor.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTextActor.h>\n#include <vtkTextProperty.h>\n#include <vtkTextRepresentation.h>\n#include <vtkTextWidget.h>\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create the RenderWindow, Renderer and both Actors.\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n\n  vtkNew<vtkRenderWindowInteractor> interactor;\n  interactor->SetRenderWindow(renderWindow);\n\n  // Create a test pipeline.\n  vtkNew<vtkSphereSource> sphereSource;\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // Create the widget\n  vtkNew<vtkTextActor> textActor;\n  textActor->SetInput(\"This is a test\");\n  textActor->GetTextProperty()->SetColor(colors->GetColor3d(\"Lime\").GetData());\n\n  vtkNew<vtkTextWidget> textWidget;\n\n  vtkNew<vtkTextRepresentation> textRepresentation;\n  textRepresentation->GetPositionCoordinate()->SetValue(0.15, 0.15);\n  textRepresentation->GetPosition2Coordinate()->SetValue(0.7, 0.2);\n  textWidget->SetRepresentation(textRepresentation);\n\n  textWidget->SetInteractor(interactor);\n  textWidget->SetTextActor(textActor);\n  textWidget->SelectableOff();\n\n  // Add the actors to the renderer, set the background and size.\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBlue\").GetData());\n  renderWindow->SetSize(300, 300);\n  renderWindow->SetWindowName(\"TextWidget\");\n\n  interactor->Initialize();\n  renderWindow->Render();\n  textWidget->On();\n  renderWindow->Render();\n\n  interactor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        "},{"location":"Cxx/Widgets/TextWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TextWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TextWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TextWidget MACOSX_BUNDLE TextWidget.cxx )\n  target_link_libraries(TextWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TextWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/TextWidget/#download-and-build-textwidget","title":"Download and Build TextWidget","text":"

        Click here to download TextWidget and its CMakeLists.txt file. Once the tarball TextWidget.tar has been downloaded and extracted,

        cd TextWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TextWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Cxx/Widgets/TexturedButtonWidget/","title":"TexturedButtonWidget","text":"

        vtk-examples/Cxx/Widgets/TexturedButtonWidget

        ScreenshotInteractive example Reload example Open in new tab Show logs Documentation

        "},{"location":"Cxx/Widgets/TexturedButtonWidget/#description","title":"Description","text":"

        This example creates a textured 2D button. The button is placed in the upper right of the display.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Cxx/Widgets/TexturedButtonWidget/#code","title":"Code","text":"

        TexturedButtonWidget.cxx

        #include <vtkActor.h>\n#include <vtkButtonWidget.h>\n#include <vtkCoordinate.h>\n#include <vtkImageData.h>\n#include <vtkNamedColors.h>\n#include <vtkNew.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkSphereSource.h>\n#include <vtkTexturedButtonRepresentation2D.h>\n\n#include <array>\n\nnamespace {\nvoid CreateImage(vtkImageData* image, std::string const& color1,\n                 std::string const& color2);\n}\n\nint main(int, char*[])\n{\n  vtkNew<vtkNamedColors> colors;\n\n  // Create two images for texture\n  vtkNew<vtkImageData> image1;\n  vtkNew<vtkImageData> image2;\n  unsigned char banana[3] = {227, 207, 87};\n  unsigned char tomato[3] = {255, 99, 71};\n  CreateImage(image1, \"Banana\", \"Tomato\");\n  CreateImage(image2, \"Tomato\", \"Banana\");\n\n  // Create some geometry\n  vtkNew<vtkSphereSource> sphereSource;\n  sphereSource->Update();\n\n  vtkNew<vtkPolyDataMapper> mapper;\n  mapper->SetInputConnection(sphereSource->GetOutputPort());\n\n  vtkNew<vtkActor> actor;\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetColor(colors->GetColor3d(\"MistyRose\").GetData());\n\n  // A renderer and render window\n  vtkNew<vtkRenderer> renderer;\n  vtkNew<vtkRenderWindow> renderWindow;\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetWindowName(\"TexturedButtonWidget\");\n\n  // An interactor\n  vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  // Create the widget and its representation\n  vtkNew<vtkTexturedButtonRepresentation2D> buttonRepresentation;\n  buttonRepresentation->SetNumberOfStates(2);\n  buttonRepresentation->SetButtonTexture(0, image1);\n  buttonRepresentation->SetButtonTexture(1, image2);\n\n  vtkNew<vtkButtonWidget> buttonWidget;\n  buttonWidget->SetInteractor(renderWindowInteractor);\n  buttonWidget->SetRepresentation(buttonRepresentation);\n\n  // Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"MidnightBLue\").GetData());\n\n  renderWindow->SetSize(640, 480);\n  renderWindow->Render();\n\n  // Place the widget. Must be done after a render so that the\n  // viewport is defined..\n  // Here the widget placement is in normalized display coordinates.\n  vtkNew<vtkCoordinate> upperRight;\n  upperRight->SetCoordinateSystemToNormalizedDisplay();\n  upperRight->SetValue(1.0, 1.0);\n\n  double bds[6];\n  double sz = 50.0;\n  bds[0] = upperRight->GetComputedDisplayValue(renderer)[0] - sz;\n  bds[1] = bds[0] + sz;\n  bds[2] = upperRight->GetComputedDisplayValue(renderer)[1] - sz;\n  bds[3] = bds[2] + sz;\n  bds[4] = bds[5] = 0.0;\n\n  // Scale to 1, default is .5\n  buttonRepresentation->SetPlaceFactor(1);\n  buttonRepresentation->PlaceWidget(bds);\n\n  buttonWidget->On();\n\n  // Begin mouse interaction\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n\nnamespace {\nvoid CreateImage(vtkImageData* image, std::string const& color1,\n                 std::string const& color2)\n{\n  vtkNew<vtkNamedColors> colors;\n\n  std::array<unsigned char, 3> dc1{0, 0, 0};\n  std::array<unsigned char, 3> dc2{0, 0, 0};\n  auto c1 = colors->GetColor3ub(color1).GetData();\n  auto c2 = colors->GetColor3ub(color2).GetData();\n  for (auto i = 0; i < 3; ++i)\n  {\n    dc1[i] = c1[i];\n    dc2[i] = c2[i];\n  }\n\n  // Specify the size of the image data.\n  image->SetDimensions(10, 10, 1);\n  image->AllocateScalars(VTK_UNSIGNED_CHAR, 3);\n\n  int* dims = image->GetDimensions();\n\n  // Fill the image with\n  for (int y = 0; y < dims[1]; y++)\n  {\n    for (int x = 0; x < dims[0]; x++)\n    {\n      unsigned char* pixel =\n          static_cast<unsigned char*>(image->GetScalarPointer(x, y, 0));\n      for (int i = 0; i < 3; ++i)\n      {\n        if (x < 5)\n        {\n          pixel[i] = dc1[i];\n        }\n        else\n        {\n          pixel[i] = dc2[i];\n        }\n      }\n    }\n  }\n}\n} // namespace\n
        "},{"location":"Cxx/Widgets/TexturedButtonWidget/#cmakeliststxt","title":"CMakeLists.txt","text":"
        cmake_minimum_required(VERSION 3.12 FATAL_ERROR)\n\nproject(TexturedButtonWidget)\n\nfind_package(VTK COMPONENTS \n  CommonColor\n  CommonCore\n  CommonDataModel\n  FiltersSources\n  InteractionStyle\n  InteractionWidgets\n  RenderingContextOpenGL2\n  RenderingCore\n  RenderingFreeType\n  RenderingGL2PSOpenGL2\n  RenderingOpenGL2\n)\n\nif (NOT VTK_FOUND)\n  message(FATAL_ERROR \"TexturedButtonWidget: Unable to find the VTK build folder.\")\nendif()\n\n# Prevent a \"command line is too long\" failure in Windows.\nset(CMAKE_NINJA_FORCE_RESPONSE_FILE \"ON\" CACHE BOOL \"Force Ninja to use response files.\")\nadd_executable(TexturedButtonWidget MACOSX_BUNDLE TexturedButtonWidget.cxx )\n  target_link_libraries(TexturedButtonWidget PRIVATE ${VTK_LIBRARIES}\n)\n# vtk_module_autoinit is needed\nvtk_module_autoinit(\n  TARGETS TexturedButtonWidget\n  MODULES ${VTK_LIBRARIES}\n)\n
        "},{"location":"Cxx/Widgets/TexturedButtonWidget/#download-and-build-texturedbuttonwidget","title":"Download and Build TexturedButtonWidget","text":"

        Click here to download TexturedButtonWidget and its CMakeLists.txt file. Once the tarball TexturedButtonWidget.tar has been downloaded and extracted,

        cd TexturedButtonWidget/build\n

        If VTK is installed:

        cmake ..\n

        If VTK is not installed but compiled on your system, you will need to specify the path to your VTK build:

        cmake -DVTK_DIR:PATH=/home/me/vtk_build ..\n

        Build the project:

        make\n

        and run it:

        ./TexturedButtonWidget\n

        WINDOWS USERS

        Be sure to add the VTK bin directory to your path. This will resolve the VTK dll's at run time.

        "},{"location":"Documentation/Frog_mhd_format/","title":"Frog MHD Format","text":"

        The following keys are recognised:

        "},{"location":"Documentation/Frog_mhd_format/#keys","title":"Keys","text":"
        • title: A title.
        • files: A vector/list of paths to the *.mhd files needed.
        • tissues
        • colors: A map/dict of tissue names and colors.
        • figures
        • fig12-9b: The vector/list of tissues needed for figure 12-9b.
        • fig12-9cd: The vector/list of tissues needed for figure 12-9c and 12-9d.
        • tissue_parameters: The required parameters for each tissue are specified here.
        • parameter types: A map/dict of tissue parameters of each tissue parameter and its type. Essential for C++ code.
        • default>: The default tissue parameters, a map/dict of tissue parameters and values.
        • <tissue name>: The map/dict of tissue parameters and values for each tissue.
        "},{"location":"Documentation/Frog_vtk_format/","title":"Frog VTK Format","text":"

        The following keys are recognised:

        "},{"location":"Documentation/Frog_vtk_format/#keys","title":"Keys","text":"
        • title: A title.
        • files: A vector/list of paths to the *.vtk files needed.
        • tissues
        • names: A vector/list of the tissue names.
        • indices: A map/dict of tissue names and index.
        • colors: A map/dict of tissue names and colors.
        • orientation: A map/dict of tissue names and orientation.
        • opacity: A map/dict of tissue names and opacity.
        • figures
        • fig12-9b: The vector/list of tissues needed for figure 12-9b.
        • fig12-9cd: The vector/list of tissues needed for figure 12-9c and 12-9d.
        "},{"location":"Documentation/PBR_JSON_format/","title":"PBR JSON file format","text":"

        The following keys and values are recognised when parsing the JSON files used by the PBR examples:

        "},{"location":"Documentation/PBR_JSON_format/#keys","title":"Keys","text":""},{"location":"Documentation/PBR_JSON_format/#general","title":"General","text":"
        • title: A title, it could indicate the program using this file.
        • object: The object name.
        • objcolor: The colour of the object.
        • bkgcolor: The background colour of the scene.
        • skybox: Use the cubemap or equirectangular files as a skybox.
        "},{"location":"Documentation/PBR_JSON_format/#environment-textures","title":"Environment textures","text":"
        • cubemap: The vector of six paths to the cube maps used to generate the environment texture.
        • equirectangular: An equirectangular file used to generate the environment texture.

        You must specify at least one of these keys. If both are specified then equirectangular will be used by default.

        "},{"location":"Documentation/PBR_JSON_format/#object-textures","title":"Object Textures","text":"
        • albedo: A file setting the perceived color (base colour texture) of the object, the diffuse color for non-metallic objects or the specular color for metallic objects.
        • normal: A file setting the normal map (texture). This allows a more precise shading without the need to subdivide the geometry. Stores the normal direction {x,y,z} in the Red/Green/Blue (RGB) channels.
        • material: A file setting the ambient Occlusion/Roughness/Metallic factors in the RGB channels. Also called ORM texture.
        • coat: A file containing the Coat Normal Texture, a normal map for the clear coat layer.
        • anisotropy: A file setting the Anisotropy Texture controlling the anisotropy strength in the red channel, while the green channel holds the anisotropy rotation. The blue channel is discarded.
        • emissive: A file setting the light-emitting texture or Emissive Texture. Note that the material will not actually emit light, and the texture is ignored by OSPRay and NVidia pathtracing backends.

        Note: Generally only a subset of the available keys are used in any given application.

        "},{"location":"Documentation/PBR_JSON_format/#values","title":"Values","text":"

        The values consist of strings:

        • For the key object: The name of the object to be used is specified e.g. \"Boy\".
        • For the key skybox: true or false are the allowed values.
        • For the keys objcolor or bkgcolor: the name of a colour is the value e.g. \"MidnightBlue\". See: VTKNamedColorPatches for colour names.

        The remaining keys have values specifying paths to the needed files. These paths are relative to where the JSON file's location is in the filesystem.

        The value for cubemap is a vector of six paths with this orientation and ordering:

        • [right, left, top, bottom, front, back]

        or

        • [+x, -x, +y, -y, +z, -z]

        The cubemap key has two subkeys:

        • root: Specifying the path to the cubemaps.
        • files: The ordered list of six files corresponding to the cubemaps.
        "},{"location":"Documentation/PBR_JSON_format/#example","title":"Example","text":"
        {\n  \"title\": \"Parameters for PBR_Skybox_Anisotropy\",\n  \"object\": \"Boy\",\n  \"bkgcolor\": \"MidnightBlue\",\n  \"objcolor\": \"Seashell\",\n  \"skybox\": true,\n  \"cubemap\": {\n    \"root\": \"./Skyboxes/skybox0\",\n    \"files\": [\n      \"right.jpg\",\n      \"left.jpg\",\n      \"top.jpg\",\n      \"bottom.jpg\",\n      \"front.jpg\",\n      \"back.jpg\"\n    ]\n  },\n  \"equirectangular\": \"./Skyboxes/spiaggia_di_mondello_4k.hdr\",\n  \"xequirectangular\": \"./Skyboxes/skybox0/skybox.jpg\",\n  \"albedo\": \"./Textures/Anisotropic/CarbonFiberAniso_albedo.png\",\n  \"normal\": \"./Textures/Anisotropic/CarbonFiberAniso_normal.png\",\n  \"material\": \"./Textures/Anisotropic/CarbonFiberAniso_orm.png\",\n  \"anisotropy\": \"./Textures/Anisotropic/CarbonFiberAniso_anisotropyAngle.png\"\n}\n

        Note:

        • In the above example, the relative paths assume that the folders Skyboxes and Textures are subfolders relative to the directory where this file is located.
        • the key xequirectangular will not be loaded, to load it, change it to equirectangular and skybox.jpg will be used instead of spiaggia_di_mondello_4k.hd.
        "},{"location":"Instructions/ConvertingFiguresToExamples/","title":"ConvertingFiguresToExamples","text":""},{"location":"Instructions/ConvertingFiguresToExamples/#converting-figures-to-examples","title":"Converting Figures to Examples","text":"

        There is an ongoing effort to convert the examples in the VTK Book into VTKExamples.

        "},{"location":"Instructions/ConvertingFiguresToExamples/#the-process","title":"The process","text":"
        1. Follow the procedure ForDevelopers to contribute examples.
        2. Download a copy of the VTK Book.
        3. Look at the VTKBookFigures page and look for examples that have not been converted. These examples will not have a link to source code.
        4. Go to your VTK source checkout. Run the script getDeletedFile.sh, found in src/Admin folder, with the name of the source file (e.g. walkCow.tcl) in the figure example to be converted. This script will create a source file in the current directory and also report the URL for the original repo location of the example.
        5. Pick a source directory to contain the new example. Look at the Chapter heading in the book to guide where to put the new example.
        6. Convert the source tcl code or old C++ code to C++ code that will compile and run with the current VTK API. Follow the guidelines for coding C++ examples.
        7. If the figure example name is short, e.g. bluntStr we suggest giving it a more descriptive name e.g. BluntStreamlines. Notice the first letter is uppercase.
        8. Edit the VTKBookFigures page as follows:
          1. In the first column of the table, add a link from the Figure to the source code.
          2. In the second column of the table, add the VTK classes that are illustrated by the example.
          3. In the third column, cut and paste the caption from the VTK Book.
          4. If there is a source file mentioned in the caption, make link to the original code URL printed by the getDeletedFile.sh script.
        "},{"location":"Instructions/ForAdministrators/","title":"ForAdministrators","text":""},{"location":"Instructions/ForAdministrators/#administrators","title":"Administrators","text":"

        Administrators have write access to the VTK Examples Source and to the VTK Examples Web Source. If you are a User go here or a Developer go here.

        "},{"location":"Instructions/ForAdministrators/#organization-of-the-repositories","title":"Organization of the Repositories","text":"

        The source files for the examples and other files are stored in VTK Examples Source. The web files are stored in a separate repository VTK Examples Web Source.

        "},{"location":"Instructions/ForAdministrators/#source-repository","title":"Source Repository","text":"

        The repository contains several types of files.

        All example source code, descriptions, test data, and test baselines are stored in the src/ tree.

        The major elements of the tree are:

        |--\n  |-- CMakeLists.txt   # To build all of the examples\n  |-- _layouts         # Contains _default.html\n  |-- custom_theme     # tweaks to the material theme\n  |-- mkdocs.yml       # config file for MkDocs\n  |-- src              # all of the content to create site/\n    |-- SyncSiteWithRepo.sh  # master script to update site/\n    |-- Admin\n    |   |-- ScrapeRepo.py       # script to create docs/ in the web site folder\n    |   |-- VTKCMakeLists       # template for Cxx examples\n    |   |-- VTKQtCMakeLists     # template for Cxx Qt\n    |   |-- Trame_template      # template for Trame\n    |-- Artifacts       # Additional images, docs, etc.\n    |-- Images          # Images used in creating the static web pages.\n    |-- Instructions    # Documentation\n    |-- LANGUAGE.md     # Summary file for language\n    |-- LANGUAGE        # Language examples\n    |   |-- TOPIC\n    |-- Testing\n    |   |-- Baseline # Baselines for examples\n    |   |   |-- LANGUAGE\n    |   |   |   |-- TOPIC\n    |   |-- Data    # Data for examples\n    |-- VTKBook         # Markdown version of the VTK Book\n    |-- VTKBookLaTeX    # LaTex version of the VTK Book\n    |-- stylesheets\n        |-- extra.css # mkdocs search config\n
        "},{"location":"Instructions/ForAdministrators/#web-repository","title":"Web Repository","text":"

        This repository is separate from the vtk examples source files. It contains the generated web pages and other needed files that are copied across from the source repository.

        |--\n  |-- site\n  |-- src               # needed content for site generation and site/ operation\n    |-- Artifacts       # Additional images, docs, etc.\n    |-- Cache           # Stores cache files used by ScrapeRepo.py.\n    |-- Coverage        # Stores VTK classes used and classes used by language.\n    |-- Images          # Images used in creating the static web pages.\n    |-- Trame           # Additional files specific to this topic.\n    |-- VTKBook         # Additional files specific to this topic.\n    |-- VTKFileFormats  # Additional files specific to this topic.\n    |-- Testing\n    |   |-- Baseline # Baselines for examples\n    |   |   |-- LANGUAGE\n    |   |   |   |-- TOPIC\n    |   |-- Data    # Data for examples\n|-- Tarballs        # Tar files for each Cxx and Trame example\n
        "},{"location":"Instructions/ForAdministrators/#look-and-feel","title":"Look and Feel","text":"

        A priority in moving from the wiki media VTK Wiki Examples to the Github pages VTK Examples was to provide a modern, familiar look and feel. We also wanted to support tablet and mobile platforms. We chose MkDocs because it generated static HTML pages that can be hosted anywhere.

        "},{"location":"Instructions/ForAdministrators/#mkdocs","title":"MkDocs","text":""},{"location":"Instructions/ForAdministrators/#installing-mkdocs","title":"Installing MkDocs","text":"

        MkDocs is a python package and can be installed using conda or pip.

        "},{"location":"Instructions/ForAdministrators/#configuring-mkdocs","title":"Configuring MkDocs","text":"

        The mkdocs.yml file contains the configuration parameters:

        site_name: vtk-examples\nsite_url: https://examples.vtk.org/site/\nrepo_name: Kitware/vtk-examples\nrepo_url: https://github.com/Kitware/vtk-examples\n\ntheme:\n    name: material\n    custom_dir: custom_theme/\n\nmarkdown_extensions:\n    - pymdownx.arithmatex\n    - pymdownx.tasklist:\n        custom_checkbox: true\n    - pymdownx.magiclink\n    - admonition\n    - codehilite:\n        guess_lang: false\n        use_pygments: true\n    - footnotes\n    - toc:\n        permalink: true\ngoogle_analytics:\n    -  'UA-3660134-4'\n    -  'auto'\nextra_css:\n    -  'stylesheets/extra.css'\ncopyright: '<font color=#666>Content is available under </font><a href=\"https://creativecommons.org/licenses/by/2.5/\" title=\"Attribution2.5\">Attribution2.5</a> <font color=#666>unless otherwise noted.</font>'\nextra_javascript:\n    - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML'\n
        "},{"location":"Instructions/ForAdministrators/#markdown-extensions","title":"Markdown Extensions","text":"

        A number of markdown extensions are available.

        "},{"location":"Instructions/ForAdministrators/#admonition","title":"admonition","text":"

        Admonitions are specially marked \"topics\" that can appear anywhere an ordinary body element can. They contain arbitrary body elements. Typically, an admonition is rendered as an offset block in a document, sometimes outlined or shaded, with a title matching the admonition type. For example:

        Note

        This is a note or seealso admonition

        Summary

        This is a summary or todo admonition

        Info

        This is an info or todo admonition

        Tip

        This is a tip, hint or important admonition

        Success

        This is a success, check or done admonition

        Question

        This is a question,help faq admonition

        Warning

        This is a warning, caution or attention admonition

        Failure

        This is a failure, fail or missing admonition

        Danger

        This is a danger or error admonition

        Bug

        This is a bug admonition

        Quote

        This is a quote or cite admonition

        Cite

        This is a cite admonition

        "},{"location":"Instructions/ForAdministrators/#codehilite","title":"codehilite","text":"

        The codehilite extension highlights code depending on the language.

        "},{"location":"Instructions/ForAdministrators/#toc","title":"toc","text":"

        The toc extension generates a table of contents, like the one at the right of this page.

        "},{"location":"Instructions/ForAdministrators/#mkdocs-materials-theme","title":"MkDocs Materials theme","text":"

        The Materials theme is built using Google's Material Design guidelines. It offers a unified experience across platforms. The look and feel is a familiar one.

        "},{"location":"Instructions/ForAdministrators/#configuring-materials","title":"Configuring Materials","text":"

        The materials theme is selected in the theme section of the mkdocs.yml file.

        "},{"location":"Instructions/ForAdministrators/#google-analytics","title":"Google Analytics","text":"

        Google Analytics tracks the site usage, providing lots of useful statistics. To have Google Analytics track web usage, you need to register the URL with the Google Analytics System. After registration, an HTML snippet is provided to include on every web page to be tracked.

        "},{"location":"Instructions/ForAdministrators/#configuring-google-analytics","title":"Configuring Google Analytics","text":"

        The google_analytics keyword in the mkdocs.yml file specifies the google analytics unique code for this web site. Currently commented out as this only applies to the old site.

        The custom_theme/main.html file defines the metadata for the google site verification:

        <meta name=\"google-site-verification\" content=\"nJqh3TVb_44fMl2gS61agt_bRNFEaI496UaXYL-wLZI\" />\n
        "},{"location":"Instructions/ForAdministrators/#google-custom-search-engine","title":"Google Custom Search Engine","text":"

        The overall look and feel are established at https://cse.google.com/cse/. After setting up the search engine, you can get the code to add to the web pages.

        <script>\n  (function() {\n    var cx = '47656ffcafe2e7ab2';\n    var gcse = document.createElement('script');\n    gcse.type = 'text/javascript';\n    gcse.async = true;\n    gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;\n    var s = document.getElementsByTagName('script')[0];\n    s.parentNode.insertBefore(gcse, s);\n  })();\n</script>\n
        "},{"location":"Instructions/ForAdministrators/#configuring-gcse","title":"Configuring GCSE","text":"

        The code is added to custom_theme/main.html.

        <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<gcse:searchbox-only>Search</gcse:searchbox-only>\n
        "},{"location":"Instructions/ForAdministrators/#implementing-gcse","title":"Implementing GCSE","text":"

        The search box is added to the web pages by adding the gcse search box html to custom_theme/partials/search.html.

            <gcse:searchbox-only>Search</gcse:searchbox-only>\n
        "},{"location":"Instructions/ForAdministrators/#performance","title":"Performance","text":""},{"location":"Instructions/ForAdministrators/#lazy-image-loading","title":"Lazy Image Loading","text":"

        The first implementation had problems loading the Cxx summary. The number of embedded images exceeded the throttle limits of Github. A lazy image load solution solved the problem. Now, images are only loaded if they appear in the browser window.

        The Lazy Image Loading is implemented in javascript. The javascript is stored in custom_theme/main.html. It uses a clever trick. Images that should be lazy loaded use a tag with a class=lazy and attribute data_src. If the image is in the viewport, the data_src is removed, and the image renders.

        "},{"location":"Instructions/ForAdministrators/#tiny-urls","title":"Tiny URLs","text":"

        The web pages have many URL's that link to images and VTK doxygen pages. The long length of these URLs can increase page load times, especially on the language summary pages.

        http://tinyurl.com provides a service to map the long URL's into shorted URLs. To speed up the process, we cache the long/short URLs in a file src/Cache/TestImages.cache in the local checkout of the web repository. ScrapeRepo.py uses this cache to only convert URLs that are not in the cache. ScrapeRepo.py updates the cache after each run.

        "},{"location":"Instructions/ForAdministrators/#minify-html-pages","title":"Minify HTML pages","text":"

        mkdocs generates HTML pages from the markdown files in doc in the local checkout of the web repository. These pages have lots of white space. We use the python package htmlmin to compress the generated HTML. The compressed pages are about 30% smaller after running htmlmin. We use the command line to process each site in the local checkout of the web repository.

        htmlmin must be installed and can be installed using conda or pip

        "},{"location":"Instructions/ForAdministrators/#administrator-tasks","title":"Administrator Tasks","text":"

        They are

        • Vet new submissions making sure the guidelines are followed.
        • Merge and ...
        • Update web pages after new submissions by running src/SyncSiteWithRepo/py in the .

        In order do do this, administrators need to clone the Web Repository and follow these Web Site Maintenance Instructions.

        "},{"location":"Instructions/ForAdministrators/#some-notes-about-scraperepopy-and-syncsitewithreposh","title":"Some notes about ScrapeRepo.py and SyncSiteWithRepo.sh","text":""},{"location":"Instructions/ForAdministrators/#scraperepopy","title":"ScrapeRepo.py","text":"

        Given a repo_dir, site_url, web_site_url, web_repo_url, web_repo_dir and a vtk_src_dir, ScrapeRepo.py proceeds as follows with all files being copied in the the Web Repository:

        1. Adds thumbnails to the Cxx.md, Python.md etc. summary pages. A thumbnail is added if a src/Testing/Baseline/LANG/TOPIC/TestEXAMPLE.png image exists for the example.

        2. Copies non-example .md files like Cxx.md and Python.md files to docs/.

        3. For each example source file create docs/LANG/TOPIC/EXAMPLE.md file that contains:

          1. If src/Testing/Baseline/LANG/TOPIC/TestEXAMPLE.png exists add the image
          2. If a src/LANG/TOPIC/EXAMPLE.md description file exists, insert the description
          3. Insert the source code from src/LANG/TOPIC/EXAMPLE.EXTENSION
        4. For each Cxx source file

          1. If Cxx/TOPIC/EXAMPLE.cmake exists, add it as the CMakeLists section of the .md file, otherwise, fill in the VTKCMakelists template, including the files listed in the optional src/Cxx/TOPIC/EXAMPLE.extras file.
        5. For each Cxx source file, create a src/Tarballs/EXAMPLE.tar file containing the source and CMakeLists.txt file.

        "},{"location":"Instructions/ForAdministrators/#syncsitewithreposh","title":"SyncSiteWithRepo.sh","text":"
        1. Checks for a virtual environment called vtk-examples-web and activates it. This environment contains mkdocs-material and htmlmin. Installing mkdocs-material will automatically install compatible versions of all dependencies: MkDocs, Markdown, Pygments and Python Markdown Extensions.

          Note: There are instructions for how to setup the virtual environment in the header comments of the script.

        2. Copies across all needed files such as baseline images and other essential files like mkdocs.yml using rsync.

        3. Creates the coverage files

          The VTKClassesUsedInExamples.py python script generates two tables for each language. One table lists each class and what classes it uses. The second table lists the classes that are not used in any example.

        4. Wipes the docs and site directory

          The docs directory contains all of the md and HTML files for the site. A clean directory prevents old files from being used.

          The site directory contains all of the static html files for the site. A clean directory prevents old files from being used.

        5. Runs the ScrapeRepo.py python script.

          This script populates the docs directory.

        6. Checks for a successful scrape

          This sanity check sees if a reasonable number of files have been updated.

        7. Copies the style sheets and runs mkdocs to build the static website in the folder called site.

        8. Minifies the HTML

        "},{"location":"Instructions/ForDevelopers/","title":"ForDevelopers","text":""},{"location":"Instructions/ForDevelopers/#developers","title":"Developers","text":"

        The success of the VTK Examples depends on the contributions from the VTK user community. If you wish to contribute to this valuable resource, please follow these guidelines. If you are a VTK Example User, go here or an Example Administrator go here.

        C++, C#, Python, Java and Trame examples are welcome! Examples should illustrate a single concept.

        "},{"location":"Instructions/ForDevelopers/#follow-the-coding-guidelines","title":"Follow the Coding Guidelines","text":"

        When you write an example, please follow the coding guidelines. Create the example in your local repository, compile and run it before you generate a pull request.

        Tip

        Look at existing examples that may be similar to your one in order to get an idea of layout, formatting conventions, file naming etc.

        "},{"location":"Instructions/ForDevelopers/#setup-for-development","title":"Setup for Development","text":"

        This assumes you have VTK, CMake, git and git lfs installed.

        "},{"location":"Instructions/ForDevelopers/#fork-the-repository","title":"Fork the repository","text":"

        Go to the VTK Examples Repository, sign in/register, and then fork the repository.

        A fork is a copy of a project. Forking a repository allows you to make changes without affecting the original project.

        "},{"location":"Instructions/ForDevelopers/#clone-the-vtk-examples-repository-onto-your-local-machine-and-build-it","title":"Clone the VTK examples repository onto your local machine and build it","text":"

        If you are using SSH:

            git clone git@gitlab.kitware.com:<username>/vtk-examples.git\n

        If You are using HTTPS:

            git clone https://gitlab.kitware.com/<username>/vtk-examples.git\n
        "},{"location":"Instructions/ForDevelopers/#add-the-vtk-examples-repository-as-a-remote-called-upstream","title":"Add the vtk-examples repository as a remote called upstream","text":"
            cd vtk-examples\n    git remote add upstream https://gitlab.kitware.com/vtk/vtk-examples.git\n
        "},{"location":"Instructions/ForDevelopers/#now-build-it","title":"Now build it","text":"
            cd vtk-examples\n    cd build\n    cmake -DVTK_DIR:PATH=YOUR_VTK_BIN_DIR -DBUILD_TESTING:BOOL=ON ..\n    make\n

        where YOUR_VTK_BIN_DIR is the location of your VTK build.

        "},{"location":"Instructions/ForDevelopers/#before-adding-your-examples","title":"Before adding your examples","text":"

        Sync your repository with the vtk-examples repository. Remember that to run the following commands, you need to be in the vtk-examples directory.

            git fetch upstream\n    git switch master\n    git merge upstream/master\n    git push\n
        • Build the vtk-examples code
            cd vtk-examples\n    cd build\n    cmake -DVTK_DIR:PATH=YOUR_VTK_BIN_DIR -DBUILD_TESTING:BOOL=ON ..\n    make\n

        where YOUR_VTK_BIN_DIR is the location of your VTK build.

        "},{"location":"Instructions/ForDevelopers/#add-the-example","title":"Add the example","text":"

        Create a branch in your repository

            git checkout -b MyNewExample\n

        where MyNewExample is the name of your new example.

        "},{"location":"Instructions/ForDevelopers/#choose-a-topic","title":"Choose a Topic","text":"

        The examples are organized by topic.

        • For C++, Python Java, C#, current topics include Animation, DataStructures, Filters, GeometricObjects, Image, Meshes etc.

        • For Trame, current topics include Advanced, Applications, MiniApps etc.

        "},{"location":"Instructions/ForDevelopers/#write-the-source","title":"Write the source","text":"
        • The following snippets may be of use:

        • Cxx available snippets.

        • Python available snippets.
        • Java available snippets.

        • Save your source code in vtk-examples/src/LANGUAGE/TOPIC/

          Where LANGUAGE is Cxx, Python, CSharp or Java and TOPIC is the topic that you have chosen.

        • Trame examples are a single folder and these are saved in vtk-examples/src/Trame/TOPIC/

        "},{"location":"Instructions/ForDevelopers/#c","title":"C++","text":"
        • If you find relevant to add a WebAssembly preview to your example, follow this guide. If not, you have to add the name of your example to vtk-examples/src/Admin/exclude_wasm.txt to avoid the website build script from generating a link to an example that doesn't exist.

        • Build and test your example (NOTE: only for cxx examples)

                cd vtk-examples/build\n        cmake ..\n        make\n        ctest -V -R MyNewExample\n

        Note: If MyNewExample is not built, then in the directory where you put the file, do:

            touch CMakeLists.txt\n
        • If your C++ example does any rendering, the test will fail the first time and create an image in vtk-examples/build/Testing/Temporary. The image will be called TestMyNewExample.png.

        • Copy the image into: vtk-examples/src/Testing/Baseline/LANG/TOPIC/. For Python and other languages, create an image with the proper name using a screen capture and copy that image into the proper location.

        • Rerun ctest and the test should pass.

        At this point you are ready to push the changes to GitLab.

        "},{"location":"Instructions/ForDevelopers/#python-java-and-c","title":"Python, Java and C","text":"

        Please check the coding guidelines for Python code.

        If you are basing your code on a Cxx example use the same name as the Cxx example. This ensures that automatic cross-referencing works.

        Keep the same directory structure as that in Cxx.

        • Follow first three steps above.
        • Manually create a test image if your example does any rendering. The image should be called TestMyNewExample.png.

        The following snippets can be used to write the image out:

        • WriteImage for Python
        • WriteImage for Java
        "},{"location":"Instructions/ForDevelopers/#trame","title":"Trame","text":"

        Create a folder called MyNewExample in vtk-examples/src/Trame/TOPIC/MyNewExample

        If you have an image, either jpg or png, it must be named MyNewExample.jpg or MyNewExample.png. If both images exist the jpg one will be used.

        If you want a description it must be named MyNewExample.md with the first two lines being:

        ### Description\n

        Use markdown to format the description. Also look at existing files for layout ideas.

        Then add your Trame file(s) to the folder.

        Note

        All Python files will be picked up and rendered on the web page. A tarball will be automatically generated and a link for downloading will be provided.

        "},{"location":"Instructions/ForDevelopers/#add-the-example-to-the-language-page","title":"Add the example to the language page","text":"

        Depending on the language of your example, edit the file Cxx.md, Python.md, CSharp.md, Java.md or Trame.md.

        Find the section for your topic and add a line for your new example. The format of the line is:

        [MyNewExample](LANG/TOPIC/MyNewExample) | short description\n

        where LANG is one of Cxx, Python, CSharp, Java or Trame.

        If an image exists, it will be automatically picked up.

        "},{"location":"Instructions/ForDevelopers/#commit-your-changes-to-your-topic-branch","title":"Commit your changes to your topic branch","text":"
        git add MyNewExample.cxx\n

        and if you have a baseline image,

        git add Testing/Baseline/LANG/TOPIC/TestMyNewExample.png\n

        finally,

        git commit\n
        "},{"location":"Instructions/ForDevelopers/#push-the-changes-to-gitlab","title":"Push the changes to GitLab","text":"
        git push origin MyNewExample\n
        "},{"location":"Instructions/ForDevelopers/#go-to-your-gitlab-project","title":"Go to your GitLab project","text":"

        Then generate a merge request for review.

        See here for how to generate a merge request.

        "},{"location":"Instructions/ForDevelopers/#advanced-usage","title":"Advanced usage","text":""},{"location":"Instructions/ForDevelopers/#add-a-description","title":"Add a description","text":"

        If your example could benefit from an extended description, you can create a file MyNewExample.md. Store the file alongside your source code. Use markdown to format the description. Also look at existing files for layout ideas.

        The first two lines must be:

        ### Description\n

        In the markdown file any references to the vtk classes will be automatically converted to HTML links in the final documentation. This will cause problems when a VTK class name is used in a reference or when there are non-existent links in the documentation. To circumvent this just surround the vtk object with two question marks, for example: ?vtkTypeFloat32Array?.

        "},{"location":"Instructions/ForDevelopers/#add-arguments-to-the-test","title":"Add arguments to the test","text":"

        If your example requires arguments, you will need to edit the CMakeLists.txt in the topic directory.

        • Add the name of your example to the NEEDS_ARGS variable

        • Add an ADD_TEST line. See other CMakeLists.txt files for examples.

        "},{"location":"Instructions/ForDevelopers/#add-extra-files-to-a-c-example","title":"Add extra files to a C++ example","text":"

        Most C++ examples consist of one file. If other files are required, place them in the same directory as the example. Then add a file with the same prefix as the example name and a .extras suffix. List each extra filename in the .extras file, one filename per line.

        Warning

        If you add extra files to the example, but do not add their filenames to the .extras file, they will appear in the left-hand file menus and will not be included in the tar file for the example.

        "},{"location":"Instructions/ForUsers/","title":"ForUsers","text":""},{"location":"Instructions/ForUsers/#users","title":"Users","text":"

        This assumes you have VTK, CMake, git and git lfs installed.

        If you want to use the examples repository VTK Examples, you have several options:

        • If you want to add/update examples: go here
        • Users: Read the following instructions.
        "},{"location":"Instructions/ForUsers/#build-an-example","title":"Build an example","text":"

        For C++ examples, go to the bottom of the page for the example that you have selected and read the instructions on how to build the example. A *.tar file is provided with the code, a CMake file and a build directory. Additionally, if there are examples in other languages, these are provided also.

        For other languages, you can copy the code to your clipboard and paste into your favourite editor.

        "},{"location":"Instructions/ForUsers/#build-all-of-the-examples","title":"Build all of the examples","text":"

        If you are getting excited about learning VTK and are tired of downloading individual examples, you can build them all.

        Go to the VTK Examples and you can:

        • Download the repository and untar or unzip it as needed into a folder called vtk-examples. Then go to the folder and:
           cd vtk-examples\n   cd build\n   cmake -DVTK_DIR:PATH=YOUR_VTK_BIN_DIR -DBUILD_TESTING:BOOL=ON ..\n   make\n

        where YOUR_VTK_BIN_DIR is the location of your VTK build.

        • Clone the VTK examples repository:
           git clone https://gitlab.kitware.com/vtk/vtk-examples.git\n   cd vtk-examples\n   cd build\n   cmake -DVTK_DIR:PATH=YOUR_VTK_BIN_DIR -DBUILD_TESTING:BOOL=ON ..\n   make\n

        where YOUR_VTK_BIN_DIR is the location of your VTK build.

        "},{"location":"Instructions/ForUsers/#update-the-examples-repository","title":"Update the examples repository","text":"

        From now on, if you cloned the examples repository, you can get the latest updates:

        cd vtk-examples\ngit pull --rebase\ncd build\ncmake ../vtk-examples\nmake\n
        "},{"location":"Instructions/ForUsers/#run-all-of-the-examples","title":"Run all of the examples","text":"
        ctest\n
        "},{"location":"Instructions/Guidelines/","title":"Guidelines","text":""},{"location":"Instructions/Guidelines/#guidelines","title":"Guidelines","text":"

        Although education of new users is the main motivation, the VTK Examples should also:

        1. Encourage good programming style
        2. Promote the proper and modern way to use VTK and write VTK programs
        3. Facilitate the nightly compilation and testing of examples that reside in the VTK Examples repository.

        These requirements must be met without compromising the main goal of user education.

        "},{"location":"Instructions/Guidelines/#guidelines-for-each-language","title":"Guidelines for each language","text":"

        All examples should follow the VTK programming style and there should be a single blank line at the end of the example

        "},{"location":"Instructions/Guidelines/#c","title":"C++","text":"
        • The indentation style can be characterized as the AllmannStyle. The curly brace (scope delimiter) is on a separate line and aligns with the control statement. The control block is indented by two spaces (no tabs). A suitable .clang-format is provided in src/Cxx. Most IDE's can be be configured to use this file for formatting. See clang-format for more information.

          Example:

            if (this->Locator == locator)\n    {\n      return;\n    }\n    for (i = 0; i < this->Source->GetNumberOfPoints(); i++)\n    {\n      p1 = this->Source->GetPoint(i);\n      [...]\n    }\n
        • Where appropriate, explicitly use the std:: namespace:
            std::cout << \"Print something\" << std::endl;\n

        rather than

            cout << \"Print something\" << endl;\n
        • All includes from the toolkit should use <...> notation. This follows C++ programming conventions.

          For example: #include <vtkContourFilter.h> is preferred over #include \"vtkContourFilter.h\"

        • The main program must have the following signature:

            int main (int argc, char *argv[])\n

        or, if argc and argv are not referenced in the code,

            int main (int, char *[])\n
        • If arguments are required, a check similar to the following should be made at the start of the main program.
          float alpha = 0.5;\n  if (argc < 2)\n  {\n    std::cout << \"Usage: \" << argv[0] << \" filename.vtp [alpha] e.g. Bunny.vtp\"\n              << std::endl;\n    return EXIT_FAILURE;\n  }\n  if (argc > 2)\n  {\n    alpha = atof(argv[2]);\n  }\n
        • An example should never call exit(). If the main program executes successfully, it should
            return EXIT_SUCCESS;\n

        otherwise

            return EXIT_FAILURE;\n
        • The use of SmartPointers is preferred in VTK examples, generally use vtkNew and only use vtkSmartPointerwhere appropriate.
            vtkNew<vtkCutter> cutter;\n

        or (where needed)

            auto cutter = vtkSmartPointer<vtkCutter>::New();\n
        • When building pipelines, the new SetInputConnection(), GetOutputPort() methods should be used.

        • Input/Output filenames

          When possible, filenames should be passed on the command line. This gives the examples utility beyond the data that is used in the specific example.

        • If there are just a few parameters for the example, these should be passed in as arguments. This increases the utility of the example and facilitates testing.

          For example, this program

            Delaunay3D InputPolydataFileName(.vtp) Alpha\n
        would use the arguments in this manner\n
            reader->SetFileName (argv[1]);\n    delaunay3D->SetAlpha(atof(argv[2]));\n
        • Always provide a background for the renderers. Avoid setting the background to white.

        • Use vtkNamedColors for setting colors of actors and renderer backgrounds. VTKNamedColorPatches shows the colors that are available. If you are using a color series, then you can choose what you want from here VTKColorSeriesPatches.

        For example,

          #include <vtkNamedColors.h>\n\n  int main(int, char*[])\n  {\n\n    vtkNew<vtkNamedColors> namedColors;\n\n    renderer->SetBackground(namedColors->GetColor3d(\"Khaki\").GetData());\n

        is preferred over

            renderer->SetBackground(0.9412, 0.9020, 0.5490);\n
        • Use admonitions to warn/cite/info, etc. Here is a summary of admonitions.
        "},{"location":"Instructions/Guidelines/#python","title":"Python","text":"

        In general, Python submissions should follow the VTK Programming style and the comments outlined for C++ above (with language appropriate modifications).

        Python code styling follows PEP 8 -- Style Guide for Python Code.

        Python code is tested in a similar manner to C++ code, so it must follow this layout:

        #!/usr/bin/env python\n\nimport vtkmodules.all as vtk\n\ndef main(argv):\n    \"\"\"\n    Get parameters (if needed)\n    Instantiate your classes, call them and any defs.\n    \"\"\"\n\n\nif __name__ == '__main__':\n    import sys\n    main(sys.argv)\n

        Use argparse where needed:

        #!/usr/bin/env python\n\nimport vtkmodules.all as vtk\n\n\ndef main(argv):\n    xyz_fn, q_fn = get_program_parameters(argv)\n    colors = vtk.vtkNamedColors()\n\n    # Do the work\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Some description.'\n    epilogue = '''\n    Extra information.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('xyz_filename', help='combxyz.bin.')\n    parser.add_argument('q_filename', help='combq.bin.')\n    args = parser.parse_args()\n    return args.xyz_filename, args.q_filename\n\n\nif __name__ == '__main__':\n    # import sys\n    main(sys.argv)\n

        For the Input/Output of filenames and parameters. Use this snippet GetProgramParameters.

        It you do not know what vtk modules and classes you need use:

        import vtkmodules.all as vtk\n

        instead of:

        from vtkmodules.<SomeVTKModule> import <SomeVTKClass>\n
        "},{"location":"Instructions/Guidelines/#generatingediting-import-statements","title":"Generating/Editing Import Statements","text":"

        Finally, when you are happy with everything, make sure only the requisite VTK classes and constants that you are using in your code are loaded when your program runs. To do this, run your code through VTKImportsForPython, it will analyse your code producing a list of import statements for you.

        At the end of the list that is produced, there are a series of commented out statements consisting of imports that you may need to enable. Only enable the ones you really need and include the statement # noinspection PyUnresolvedReferences for PyCharm users, as this will prevent the statement from being removed.

        e.g The most common ones will be:

        # noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n

        Remove any unused ones.

        "},{"location":"Instructions/Guidelines/#java","title":"Java","text":"

        In general, Java submissions should follow the VTK Programming style and the comments outlined for C++ above (with language appropriate modification).

        For Java code layout, look at CylinderExample

        Java code styling follows the usual style as implemented in the IDEs.

        However note:

        • No Tabs
        "},{"location":"Instructions/WebSiteMaintenance/","title":"WebSiteMaintenance","text":""},{"location":"Instructions/WebSiteMaintenance/#maintaining-the-github-web-site","title":"Maintaining the GitHub web site","text":"

        This website will just contain the web files and any files needed by them. The repository from which these files are generated is your fork of the VTK Examples Repository. For this discussion we are assuming that you have cloned your fork of this site into a repository called vtk-examples.

        "},{"location":"Instructions/WebSiteMaintenance/#setup-for-updating-the-web-pages","title":"Setup for Updating the Web Pages","text":"

        This assumes you have VTK, CMake, git, git lfs, mkdocs, pygments and htmlmin installed along with the checkout of your fork of the VTK Examples Repository.

        "},{"location":"Instructions/WebSiteMaintenance/#fork-the-repository","title":"Fork the repository","text":"

        Go to the VTK Examples Web Site Repository sign in/register, and then fork the repository.

        A fork is a copy of a project. Forking a repository allows you to make changes without affecting the original project.

        If you want to see what your build of the web pages will look like, go to your settings. Then scroll down until you find GitHub Pages and set the Source Branch to gh-pages.

        "},{"location":"Instructions/WebSiteMaintenance/#clone-the-vtk-examples-web-site-repository","title":"Clone the VTK Examples Web Site Repository","text":"
        git clone git@github.com:<github_username>/vtk-examples.git vtk-examples-web\ncd vtk-examples-web\n
        "},{"location":"Instructions/WebSiteMaintenance/#add-the-vtk-examples-web-site-repository-as-a-remote-called-upstream","title":"Add the VTK Examples Web Site Repository as a remote called upstream","text":"
        cd vtk-examples-web\ngit remote add upstream https://github.com/Kitware/vtk-examples\n
        "},{"location":"Instructions/WebSiteMaintenance/#updating-web-pages","title":"Updating web pages","text":"

        For this discussion we are assuming a directory structure something like this:

        |--\n  |-- VTK               # The VTK Source files\n  |-- vtk-examples      # The VTK Examples source files\n  |-- vtk-examples-web  # The VTK Examples Web Source files\n
        "},{"location":"Instructions/WebSiteMaintenance/#step-1-sync-your-vtk-examples-repository","title":"Step 1: Sync your vtk-examples repository","text":"

        Remember that to run the following commands, you need to be in your vtk-examples folder.

        cd vtk-examples\ngit fetch upstream\ngit switch master\ngit merge upstream/master\ngit push\n

        Note: You can use your own unmerged branch here but do not submit a merge request as it will be out of sync with the vtk-examples master.

        "},{"location":"Instructions/WebSiteMaintenance/#step-2-sync-your-vtk-examples-web-repository-and-checkout-gh-pages","title":"Step 2: Sync your vtk-examples-web repository and checkout gh-pages","text":"

        Sync your repository with the VTK Examples Web Site Repository. Remember that to run the following commands, you need to be in your vtk-examples-web folder.

        cd vtk-examples-web\ngit fetch upstream\ngit switch master\ngit merge upstream/master\ngit push\ngit switch gh-pages\n

        Note: If you are doing this for the first time replace: git switch gh-pages with git switch -c gh-pages --track origin/gh-pages

        Important: You must be on the gh-pages branch in vtk-examples-web before doing the next steps. So remember to do git switch gh_pages!

        "},{"location":"Instructions/WebSiteMaintenance/#step-3-build-the-web-site","title":"Step 3: Build the web site","text":"

        Go to the vtk-examples folder, ensure that the file mkdocs.yml has the correct parameters.

        Then in the top-level folder of vtk-examples:

        ../src/SyncSiteWithRepo.sh SITE_URL WEB_SITE_URL WEB_REPO_URL WEB_DIR VTK_SOURCE_DIR\n

        where:

        • SITE_URL is the VTK Examples source repository URL, e.g. https://gitlab.kitware.com/vtk/vtk-examples
        • WEB_SITE_URL is the VTK Examples website site URL, e.g. https://examples.vtk.org/site/
        • WEB_REPO_URL is the VTK Examples website source URL, e.g. https://github.com/Kitware/vtk-examples
        • WEB_REPO_DIR is the local website source dir, e.g. local_path/vtk-examples-web
        • VTK_DIR is the local VTK source directory, e.g. local_path/VTK

        Remember that local paths are absolute or full paths, not relative paths.

        Then, once this script finishes:

        "},{"location":"Instructions/WebSiteMaintenance/#step-4-verify-that-the-site-works","title":"Step 4: Verify that the site works","text":"

        Go to the folder mentioned in the instructions at the end of the script and verify that the site works.

        "},{"location":"Instructions/WebSiteMaintenance/#step-5-commit-add-and-push","title":"Step 5: Commit, Add and Push","text":"
        git status\ngit commit -a -m\"Updating files\"\ngit push\n

        If there are new files:

        git status\ngit add <The files>\ngit commit -m\"Adding new files\"\ngit push\n
        "},{"location":"Instructions/WebSiteMaintenance/#step-6-check-it-all-works","title":"Step 6: Check it all works","text":"

        Verify that the links etc. are OK on https://<username>.github.io/vtk-examples/site/

        Do not submit a merge request. This needs to be done by an admisistrator.

        "},{"location":"Instructions/WebSiteMaintenance/#step-7-for-administrators","title":"Step 7: For Administrators","text":"

        If you are an administrator and:

        • You had checked out the master in step 1.
        • The web site https://<username>.github.io/vtk-examples/site/ is OK with all the links etc. working.

        Then go to your fork https://github.com/<username>/vtk-examples and submit a merge request.

        "},{"location":"Java/Snippets/","title":"Snippets","text":""},{"location":"Java/Snippets/#description","title":"Description","text":"

        Snippets are chunks of code that can be cut (snipped) and pasted into examples. We want each example to be stand-alone, so we do not keep the snippet code in a library.

        "},{"location":"Java/Snippets/#available-snippets","title":"Available snippets","text":""},{"location":"Java/Snippets/#writeimage","title":"WriteImage","text":"

        Take a screen shot and save it to a file.

        "},{"location":"Java/Annotation/MultiLineText/","title":"MultiLineText","text":"

        vtk-examples/Java/Annotation/MultiLineText

        "},{"location":"Java/Annotation/MultiLineText/#description","title":"Description","text":"

        This example demonstrates the use of multiline 2D text using vtkTextMapper. It shows several justifications as well as single-line and multiple-line text inputs.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Annotation/MultiLineText/#code","title":"Code","text":"

        MultiLineText.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkTextProperty;\nimport vtk.vtkTextMapper;\nimport vtk.vtkActor2D;\nimport vtk.vtkPoints;\nimport vtk.vtkCellArray;\nimport vtk.vtkNamedColors;\nimport vtk.vtkCoordinate;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper2D;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\n\npublic class MultiLineText  \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static\n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For singleLineTextB Actor Color\n    double singleLineTextActorBColor[] = new double[4];\n    //For singleLineTextActorC Color\n    double singleLineTextActorCColor[] = new double[4];\n    //For singleLineTextActorT Color\n    double singleLineTextActorTColor[] = new double[4];\n    //For textMapperLColor\n    double textMapperLColor[] = new double[4];\n    //For textMapperCColor\n    double textMapperCColor[] = new double[4];\n    //For textMapperRColor\n    double textMapperRColor[] = new double[4];\n    //For gridActor\n    double Grid_Actor[] = new double[4];\n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color to singleLineTextActorB Color\n    Color.GetColor(\"IndianRed\",singleLineTextActorBColor);\n    //Change Color Name to Use your own Color to singleLineTextActorC  Color\n    Color.GetColor(\"DarkBlue\",singleLineTextActorCColor);\n    //Change Color Name to Use your own Color to singleLineTextActorT  Color\n    Color.GetColor(\"Maroon\",singleLineTextActorTColor);\n    //Change Color Name to Use your own Color to textMapperLColor\n    Color.GetColor(\"Crimson\",textMapperLColor);\n    //Change Color Name to Use your own Color to textMapperCColor\n    Color.GetColor(\"Black\",textMapperCColor);\n    //Change Color Name to Use your own Color to textMapperRColor\n    Color.GetColor(\"Navy\",textMapperRColor);\n    //Change Color Name to Use your own Color to textMapperRColor\n    Color.GetColor(\"DimGray\",Grid_Actor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"BlanchedAlmond\",BgColor);\n\n\n    vtkTextProperty singleLineTextProp = new vtkTextProperty();\n    singleLineTextProp.SetFontSize(24);\n    singleLineTextProp.SetFontFamilyToArial();\n    singleLineTextProp.BoldOff();\n    singleLineTextProp.ItalicOff();\n    singleLineTextProp.ShadowOff();\n\n    vtkTextProperty multiLineTextProp = new vtkTextProperty();\n    multiLineTextProp.ShallowCopy(singleLineTextProp);\n    multiLineTextProp.BoldOn();\n    multiLineTextProp.ItalicOn();\n    multiLineTextProp.ShadowOn();\n    multiLineTextProp.SetLineSpacing(0.8);\n\n    vtkTextMapper singleLineTextB = new vtkTextMapper();\n    singleLineTextB .SetInput(\"Single Line(Bottom)\");\n    singleLineTextB.GetTextProperty().ShallowCopy(singleLineTextProp);\n    singleLineTextB.GetTextProperty().SetVerticalJustificationToBottom();\n    singleLineTextB .GetTextProperty().SetColor(singleLineTextActorBColor);\n\n    vtkActor2D singleLineTextActorB = new vtkActor2D();\n    singleLineTextActorB.SetMapper(singleLineTextB);\n    singleLineTextActorB.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    singleLineTextActorB.GetPositionCoordinate().SetValue(0.05, 0.85);\n\n\n    vtkTextMapper singleLineTextC = new vtkTextMapper();\n    singleLineTextC .SetInput(\"Single Line(centered)\");\n    singleLineTextC.GetTextProperty().ShallowCopy(singleLineTextProp);\n    singleLineTextC.GetTextProperty().SetVerticalJustificationToCentered();\n    singleLineTextC .GetTextProperty().SetColor(singleLineTextActorCColor);\n\n    vtkActor2D singleLineTextActorC = new vtkActor2D();\n    singleLineTextActorC.SetMapper(singleLineTextC);\n    singleLineTextActorC.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    singleLineTextActorC.GetPositionCoordinate().SetValue(0.05, 0.75);\n\n    vtkTextMapper singleLineTextT = new vtkTextMapper();\n    singleLineTextT .SetInput(\"Single Line(Top)\");\n    singleLineTextT.GetTextProperty().ShallowCopy(singleLineTextProp);\n    singleLineTextT.GetTextProperty().SetVerticalJustificationToTop();\n    singleLineTextT .GetTextProperty().SetColor(singleLineTextActorTColor);\n\n    vtkActor2D singleLineTextActorT = new vtkActor2D();\n    singleLineTextActorT.SetMapper(singleLineTextT);\n    singleLineTextActorT.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    singleLineTextActorT.GetPositionCoordinate().SetValue(0.05, 0.65);  \n\n    vtkTextMapper textMapperL = new vtkTextMapper();\n    textMapperL .SetInput(\"This is\\nmulti-line\\ntext output\\n(left-top)\");\n    textMapperL.GetTextProperty().ShallowCopy(multiLineTextProp);\n    textMapperL.GetTextProperty().SetJustificationToLeft();\n    textMapperL.GetTextProperty().SetVerticalJustificationToTop();\n    textMapperL .GetTextProperty().SetColor(textMapperLColor);\n\n    vtkActor2D textActorL = new vtkActor2D();\n    textActorL.SetMapper(textMapperL);\n    textActorL.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    textActorL.GetPositionCoordinate().SetValue(0.05, 0.5);\n\n    vtkTextMapper textMapperC = new vtkTextMapper();\n    textMapperC .SetInput(\"This is\\nmulti-line\\ntext output\\n(centered)\");\n    textMapperC.GetTextProperty().ShallowCopy(multiLineTextProp);\n    textMapperC.GetTextProperty().SetJustificationToCentered();\n    textMapperC.GetTextProperty().SetVerticalJustificationToCentered();\n    textMapperC .GetTextProperty().SetColor(textMapperCColor);\n\n    vtkActor2D textActorC = new vtkActor2D();\n    textActorC.SetMapper(textMapperC);\n    textActorC.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    textActorC.GetPositionCoordinate().SetValue(0.5, 0.5);\n\n    vtkTextMapper textMapperR = new vtkTextMapper();\n    textMapperR .SetInput(\"This is\\nmulti-line\\ntext output\\n(right-bottom)\");\n    textMapperR.GetTextProperty().ShallowCopy(multiLineTextProp);\n    textMapperR.GetTextProperty().SetJustificationToRight();\n    textMapperR.GetTextProperty().SetVerticalJustificationToBottom();\n    textMapperR .GetTextProperty().SetColor(textMapperRColor);\n\n    vtkActor2D textActorR = new vtkActor2D();\n    textActorR.SetMapper(textMapperR);\n    textActorR.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay();\n    textActorR.GetPositionCoordinate().SetValue(0.95, 0.5);\n\n    vtkPoints Pts = new vtkPoints();\n    Pts.InsertNextPoint(0.05, 0.0, 0.0);\n    Pts.InsertNextPoint(0.05, 1.0, 0.0);\n    Pts.InsertNextPoint(0.5, 0.0, 0.0);\n    Pts.InsertNextPoint(0.5, 1.0, 0.0);\n    Pts.InsertNextPoint(0.95, 0.0, 0.0);\n    Pts.InsertNextPoint(0.95, 1.0, 0.0);\n    Pts.InsertNextPoint(0.0, 0.5, 0.0);\n    Pts.InsertNextPoint(1.0, 0.5, 0.0);\n    Pts.InsertNextPoint(0.00, 0.85, 0.0);\n    Pts.InsertNextPoint(0.50, 0.85, 0.0);\n    Pts.InsertNextPoint(0.00, 0.75, 0.0);\n    Pts.InsertNextPoint(0.50, 0.75, 0.0);\n    Pts.InsertNextPoint(0.00, 0.65, 0.0);\n    Pts.InsertNextPoint(0.50, 0.65, 0.0);\n\n    vtkCellArray Lines = new vtkCellArray();\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(0);\n    Lines.InsertNextCell(1);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(3);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(4);\n    Lines.InsertNextCell(5);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(6);\n    Lines.InsertNextCell(7);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(8);\n    Lines.InsertNextCell(9);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(10);\n    Lines.InsertNextCell(11);\n    Lines.InsertNextCell(2);\n    Lines.InsertNextCell(12);\n    Lines.InsertNextCell(13);\n\n    vtkPolyData Grid = new vtkPolyData();\n    Grid.SetPoints(Pts);\n    Grid.SetLines(Lines);\n\n    vtkCoordinate normCoords = new vtkCoordinate();\n    normCoords.SetCoordinateSystemToNormalizedViewport();\n\n    vtkPolyDataMapper2D Mapper = new vtkPolyDataMapper2D();\n    Mapper.SetInputData(Grid);\n    Mapper.SetTransformCoordinate(normCoords);\n\n    vtkActor2D GridActor = new vtkActor2D();\n    GridActor.SetMapper(Mapper);\n    GridActor.GetProperty().SetColor(Grid_Actor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor2D(textActorL);\n    ren.AddActor2D(textActorC);\n    ren.AddActor2D(textActorR);\n    ren.AddActor2D(singleLineTextActorB);\n    ren.AddActor2D(singleLineTextActorC);\n    ren.AddActor2D(singleLineTextActorT);\n    ren.AddActor2D(GridActor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(500,500);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
        "},{"location":"Java/Annotation/TextOrigin/","title":"TextOrigin","text":"

        vtk-examples/Java/Annotation/TextOrigin

        "},{"location":"Java/Annotation/TextOrigin/#description","title":"Description","text":"

        This example demonstrates the use of vtkVectorText and vtkFollower. vtkVectorText is used to create 3D annotation. vtkFollower is used to position the 3D text and to ensure that the text always faces the renderer's active camera (i.e., the text is always readable).

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Annotation/TextOrigin/#code","title":"Code","text":"

        TextOrigin.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkActor;\nimport vtk.vtkAxes;\nimport vtk.vtkVectorText;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkFollower;\nimport vtk.vtkNamedColors;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\n\npublic class TextOrigin  {\n  // private static final long serialVersionUID = 1L;\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) {\n\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Text Actor Color\n    double TextActorColor[] = new double[4];\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"IndianRed\",TextActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"LightGrey\",BgColor);\n\n\n    // Create the axes and the associated mapper and actor.\n    vtkAxes Axes = new vtkAxes();\n    Axes.SetOrigin(0, 0, 0);\n\n    vtkPolyDataMapper AxesMapper = new vtkPolyDataMapper();\n    AxesMapper.SetInputConnection(Axes.GetOutputPort());\n\n    vtkActor AxesActor = new vtkActor();\n    AxesActor.SetMapper(AxesMapper);\n\n    // Create the 3D text and the associated mapper and follower (a type of actor).  \n    //Position the text so it is displayed over the origin of the axes.\n    vtkVectorText aText = new vtkVectorText();\n    aText.SetText(\"Origin\");\n\n\n    vtkPolyDataMapper TextMapper = new vtkPolyDataMapper();\n    TextMapper.SetInputConnection(aText.GetOutputPort());\n\n\n    vtkFollower TextActor = new vtkFollower();\n    TextActor.SetMapper(TextMapper);\n    TextActor.SetScale(0.2, 0.2, 0.2);\n    TextActor.AddPosition(0, -0.1, 0);\n    TextActor.GetProperty().SetColor(TextActorColor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(TextActor);\n    ren.AddActor(AxesActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n    ren.GetActiveCamera().Zoom(1.6);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
        "},{"location":"Java/CompositeData/CompositePolyDataMapper/","title":"CompositePolyDataMapper","text":"

        vtk-examples/Java/CompositeData/CompositePolyDataMapper

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/CompositeData/CompositePolyDataMapper/#code","title":"Code","text":"

        CompositePolyDataMapper.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkMultiBlockDataSet;\nimport vtk.vtkCompositePolyDataMapper2;\nimport vtk.vtkCompositeDataDisplayAttributes;\nimport vtk.vtkNamedColors;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\n\n\npublic class CompositePolyDataMapper  {\n  //private static final long serialVersionUID = 1L;\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Red\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",BgColor);\n\n\n    vtkSphereSource Sphere1 = new vtkSphereSource();\n    Sphere1.SetRadius(3);\n    Sphere1.SetCenter(0, 0, 0);\n    Sphere1.Update();\n\n    vtkSphereSource Sphere2 = new vtkSphereSource();\n    Sphere2.SetRadius(2);\n    Sphere2.SetCenter(2, 0, 0);\n    Sphere2.Update();\n\n    vtkMultiBlockDataSet MBDS = new vtkMultiBlockDataSet();\n    MBDS.SetNumberOfBlocks(3);\n    MBDS.SetBlock(0, Sphere1.GetOutput());\n    // Leave block 1 NULL.  \n    //NULL blocks are valid and should be handled by algorithms that process multiblock datasets.  \n    //Especially when running in parallel where the blocks owned by other processes are NULL in this process\n    MBDS.SetBlock(2, Sphere2.GetOutput());\n\n    vtkCompositePolyDataMapper2 Mapper = new vtkCompositePolyDataMapper2();\n    Mapper.SetInputDataObject(MBDS);\n\n\n    vtkCompositeDataDisplayAttributes CDSA = new vtkCompositeDataDisplayAttributes();\n    Mapper.SetCompositeDataDisplayAttributes(CDSA);\n    // You can use the vtkCompositeDataDisplayAttributes to set the color,\n    // opacity and visibiliy of individual blocks of the multiblock dataset.\n    // Attributes are mapped by block pointers (vtkDataObject*), so these can\n    // be queried by their flat index through a convenience function in the\n    // attribute class (vtkCompositeDataDisplayAttributes::DataObjectFromIndex).\n    // Alternatively, one can set attributes directly through the mapper using\n    // flat indices.\n    // This sets the block at flat index 3 red\n    // Note that the index is the flat index in the tree, so the whole multiblock\n    // is index 0 and the blocks are flat indexes 1, 2 and 3.  This affects\n    // the block returned by mbds->GetBlock(2)\n    Mapper.SetBlockColor(3, ActorColor);\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
        "},{"location":"Java/Coverage/JavaVTKClassesNotUsed/","title":"VTK Classes not used in the Examples","text":""},{"location":"Java/Coverage/JavaVTKClassesNotUsed/#java","title":"Java","text":"

        Out of 3113 available VTK classes, 2840 have not been used.

        VTK Class VTK Class VTK Class VTK Class VTK Class vtk2DHistogramItem vtk3DCursorRepresentation vtk3DCursorWidget vtk3DLinearGridCrinkleExtractor vtk3DLinearGridInternal vtk3DLinearGridPlaneCutter vtk3DWidget vtkABI vtkADIOS2CoreImageReader vtkADIOS2VTXReader vtkAMRBaseParticlesReader vtkAMRBaseReader vtkAMRBox vtkAMRCutPlane vtkAMRDataInternals vtkAMRDataSetCache vtkAMREnzoParticlesReader vtkAMREnzoReader vtkAMREnzoReaderInternal vtkAMRFlashParticlesReader vtkAMRFlashReader vtkAMRFlashReaderInternal vtkAMRGaussianPulseSource vtkAMRInformation vtkAMRInterpolatedVelocityField vtkAMRResampleFilter vtkAMRSliceFilter vtkAMRToMultiBlockFilter vtkAMRUtilities vtkAMRVelodyneReader vtkAMRVelodyneReaderInternal vtkAMRVolumeMapper vtkAMReXGridHeader vtkAMReXGridLevelHeader vtkAMReXGridReader vtkAMReXGridReaderInternal vtkAMReXParticlesReader vtkAOSDataArrayTemplate vtkASCIITextCodec vtkAVIWriter vtkAVSucdReader vtkAbstractArray vtkAbstractCellArray vtkAbstractCellLinks vtkAbstractCellLocator vtkAbstractContextBufferId vtkAbstractContextItem vtkAbstractElectronicData vtkAbstractGridConnectivity vtkAbstractHyperTreeGridMapper vtkAbstractImageInterpolator vtkAbstractInteractionDevice vtkAbstractInterpolatedVelocityField vtkAbstractMapper vtkAbstractMapper3D vtkAbstractParticleWriter vtkAbstractPicker vtkAbstractPointLocator vtkAbstractPolyDataReader vtkAbstractPolygonalHandleRepresentation3D vtkAbstractPropPicker vtkAbstractRenderDevice vtkAbstractSplineRepresentation vtkAbstractTransform vtkAbstractVolumeMapper vtkAbstractWidget vtkActor2DCollection vtkActorNode vtkAdaptiveDataSetSurfaceFilter vtkAdaptiveResampleToImage vtkAdaptiveSubdivisionFilter vtkAdaptiveTemporalInterpolator vtkAddMembershipArray vtkAdjacencyMatrixToEdgeTable vtkAdjacentVertexIterator vtkAffineRepresentation vtkAffineRepresentation2D vtkAffineWidget vtkAggregateDataSetFilter vtkAggregateToPartitionedDataSetCollection vtkAlembicExporter vtkAlgorithm vtkAlgorithmOutput vtkAlignImageDataSetFilter vtkAmoebaMinimizer vtkAnariActorNode vtkAnariCameraNode vtkAnariCompositePolyDataMapperNode vtkAnariFollowerNode vtkAnariLightNode vtkAnariPass vtkAnariPolyDataMapperNode vtkAnariProfiling vtkAnariRendererNode vtkAnariTestInteractor vtkAnariViewNodeFactory vtkAnariVolumeInterface vtkAnariVolumeMapper vtkAnariVolumeMapperNode vtkAnariVolumeNode vtkAnariWindowNode vtkAndroidOutputWindow vtkAndroidRenderWindowInteractor vtkAngleRepresentation vtkAngleRepresentation3D vtkAngularPeriodicDataArray vtkAngularPeriodicFilter vtkAnimateModes vtkAnimationCue vtkAnimationScene vtkAnnotation vtkAnnotationLayers vtkAnnotationLayersAlgorithm vtkAppendArcLength vtkAppendCompositeDataLeaves vtkAppendDataSets vtkAppendFilter vtkAppendLocationAttributes vtkAppendPartitionedDataSetCollection vtkAppendPoints vtkAppendSelection vtkApplyColors vtkApplyIcons vtkApproximatingSubdivisionFilter vtkArcGridActorPrivate vtkArcParallelEdgeStrategy vtkArcPlotter vtkArcSource vtkArchiver vtkAreaContourSpectrumFilter vtkAreaLayout vtkAreaLayoutStrategy vtkAreaPicker vtkArray vtkArrayCalculator vtkArrayCoordinates vtkArrayData vtkArrayDataAlgorithm vtkArrayDataReader vtkArrayDataWriter vtkArrayDispatch vtkArrayExtents vtkArrayExtentsList vtkArrayInterpolate vtkArrayIterator vtkArrayIteratorIncludes vtkArrayIteratorTemplate vtkArrayListTemplate vtkArrayNorm vtkArrayPrint vtkArrayRange vtkArrayReader vtkArrayRename vtkArrayRenderer vtkArraySort vtkArrayToTable vtkArrayWeights vtkArrayWriter vtkAssemblyNode vtkAssemblyPath vtkAssemblyPaths vtkAssignAttribute vtkAssignCoordinates vtkAssignCoordinatesLayoutStrategy vtkAtom vtkAtomicMutex vtkAttributeClustering2DLayoutStrategy vtkAttributeDataToFieldDataFilter vtkAttributeDataToTableFilter vtkAttributeSmoothingFilter vtkAttributesErrorMetric vtkAutoCorrelativeStatistics vtkAvatar vtkAxesTransformRepresentation vtkAxesTransformWidget vtkAxis vtkAxisActor vtkAxisActor2D vtkAxisActor2DMock vtkAxisExtended vtkAxisFollower vtkAxisGridActorPrivate vtkBMPWriter vtkBSPCuts vtkBSPIntersections vtkBSplineTransform vtkBTSReader vtkBYUReader vtkBYUWriter vtkBackgroundColorMonitor vtkBandedPolyDataContourFilter vtkBarChartActor vtkBase64InputStream vtkBase64OutputStream vtkBase64Utilities vtkBatchedSurfaceLICMapper vtkBatches vtkBezierContourLineInterpolator vtkBezierCurve vtkBezierHexahedron vtkBezierInterpolation vtkBezierQuadrilateral vtkBezierTetra vtkBezierTriangle vtkBezierWedge vtkBiDimensionalRepresentation vtkBiDimensionalRepresentation2D vtkBiDimensionalWidget vtkBiQuadraticQuad vtkBiQuadraticQuadraticHexahedron vtkBiQuadraticQuadraticWedge vtkBiQuadraticTriangle vtkBilinearQuadIntersection vtkBillboardTextActor3D vtkBinCellDataFilter vtkBinnedDecimation vtkBiomTableReader vtkBitArray vtkBitArrayIterator vtkBivariateLinearTableThreshold vtkBlankStructuredGrid vtkBlankStructuredGridWithImage vtkBlockDistribution vtkBlockIdScalars vtkBlockItem vtkBlockSelector vtkBlueObeliskData vtkBlueObeliskDataParser vtkBond vtkBooleanOperationPolyDataFilter vtkBooleanTexture vtkBoostBetweennessClustering vtkBoostBiconnectedComponents vtkBoostBrandesCentrality vtkBoostBreadthFirstSearch vtkBoostBreadthFirstSearchTree vtkBoostConnectedComponents vtkBoostDividedEdgeBundling vtkBoostExtractLargestComponent vtkBoostKruskalMinimumSpanningTree vtkBoostLogWeighting vtkBoostPrimMinimumSpanningTree vtkBoostRandomSparseArraySource vtkBoostSplitTableField vtkBorderRepresentation vtkBorderWidget vtkBoundaryMeshQuality vtkBoundedPlanePointPlacer vtkBoundingBox vtkBox vtkBoxClipDataSet vtkBoxLayoutStrategy vtkBoxMuellerRandomSequence vtkBoxRepresentation vtkBoxWidget2 vtkBreakPoint vtkBrokenLineWidget vtkBrush vtkBuffer vtkBufferedArchiver vtkButterflySubdivisionFilter vtkButtonRepresentation vtkButtonSource vtkButtonWidget vtkByteSwap vtkCGMWriter vtkCGNSCache vtkCGNSFileSeriesReader vtkCGNSReader vtkCGNSReaderInternal vtkCONVERGECFDCGNSReader vtkCONVERGECFDReader vtkCPExodusIIElementBlock vtkCPExodusIIElementBlockCellIterator vtkCPExodusIIElementBlockImpl vtkCPExodusIIInSituReader vtkCPExodusIINodalCoordinatesTemplate vtkCPExodusIIResultsArrayTemplate vtkCachedStreamingDemandDrivenPipeline vtkCallbackCommand vtkCamera3DRepresentation vtkCamera3DWidget vtkCameraHandleSource vtkCameraInterpolator vtkCameraNode vtkCameraOrientationRepresentation vtkCameraOrientationWidget vtkCameraPass vtkCameraPathRepresentation vtkCameraPathWidget vtkCameraRepresentation vtkCameraWidget vtkCapsuleSource vtkCaptionActor2D vtkCardinalSpline vtkCastToConcrete vtkCategoryLegend vtkCell vtkCell3D vtkCellArrayIterator vtkCellAttribute vtkCellAttributeCalculator vtkCellAttributeInformation vtkCellCenterDepthSort vtkCellCentersPointPlacer vtkCellData vtkCellDataToPointData vtkCellDerivatives vtkCellDistanceSelector vtkCellGraphicsPrimitiveMap vtkCellGrid vtkCellGridAlgorithm vtkCellGridBoundsQuery vtkCellGridComputeSurface vtkCellGridElevation vtkCellGridElevationQuery vtkCellGridEvaluator vtkCellGridIOQuery vtkCellGridMapper vtkCellGridPointProbe vtkCellGridQuery vtkCellGridRangeQuery vtkCellGridReader vtkCellGridRenderRequest vtkCellGridResponder vtkCellGridResponderBase vtkCellGridResponders vtkCellGridSidesQuery vtkCellGridWriter vtkCellIterator vtkCellLinks vtkCellLocator vtkCellLocatorStrategy vtkCellMetadata vtkCellQuality vtkCellSizeFilter vtkCellTreeLocator vtkCellType vtkCellTypeSource vtkCellTypes vtkCellValidator vtkCenteredSliderRepresentation vtkCenteredSliderWidget vtkCesium3DTilesReader vtkCesium3DTilesWriter vtkCesiumB3DMReader vtkCesiumPointCloudWriter vtkChacoGraphReader vtkChacoReader vtkCharArray vtkChart vtkChart2DHistogram vtkChartBox vtkChartHistogram2D vtkChartLegend vtkChartMatrix vtkChartParallelCoordinates vtkChartPie vtkChartXY vtkChartXYZ vtkCheckerboardRepresentation vtkCheckerboardSplatter vtkCheckerboardWidget vtkCirclePackFrontChainLayoutStrategy vtkCirclePackLayout vtkCirclePackLayoutStrategy vtkCirclePackToPolyData vtkCircularLayoutStrategy vtkCityGMLReader vtkCleanPolyData vtkCleanUnstructuredGrid vtkCleanUnstructuredGridCells vtkClearRGBPass vtkClearZPass vtkClientServerCompositePass vtkClientServerSynchronizedRenderers vtkClientSocket vtkClipClosedSurface vtkClipConvexPolyData vtkClipDataSet vtkClipPolyData vtkClipVolume vtkClosedSurfacePointPlacer vtkClosestNPointsStrategy vtkClosestPointStrategy vtkClustering2DLayoutStrategy vtkCocoaMacOSXSDKCompatibility vtkCocoaRenderWindow vtkCocoaRenderWindowInteractor vtkCocoaTkUtilities vtkCoincidentPoints vtkCollapseGraph vtkCollapseVerticesByArray vtkCollectGraph vtkCollectPolyData vtkCollectTable vtkCollection vtkCollectionElement vtkCollectionIterator vtkCollisionDetectionFilter vtkColor vtkColor3 vtkColor3d vtkColor3f vtkColor3ub vtkColor4 vtkColor4d vtkColor4f vtkColor4ub vtkColorLegend vtkColorTransferControlPointsItem vtkColorTransferFunctionItem vtkCommand vtkCommonInformationKeyManager vtkCommunicator vtkCommunity2DLayoutStrategy vtkCompositeCellGridMapper vtkCompositeCellGridReader vtkCompositeControlPointsItem vtkCompositeCutter vtkCompositeDataDisplayAttributesLegacy vtkCompositeDataGeometryFilter vtkCompositeDataIterator vtkCompositeDataPipeline vtkCompositeDataProbeFilter vtkCompositeDataReader vtkCompositeDataSet vtkCompositeDataSetAlgorithm vtkCompositeDataWriter vtkCompositeImplicitBackend vtkCompositeInterpolatedVelocityField vtkCompositeMapperHelper2 vtkCompositeMapperHelperData vtkCompositePolyDataMapper vtkCompositePolyDataMapperDelegator vtkCompositeRGBAPass vtkCompositeRenderManager vtkCompositeSurfaceLICMapper vtkCompositeSurfaceLICMapperDelegator vtkCompositeTransferFunctionItem vtkCompositeZPass vtkCompositedSynchronizedRenderers vtkCompositer vtkCompressCompositer vtkComputeHistogram2DOutliers vtkComputeQuantiles vtkComputeQuartiles vtkConduitArrayUtilities vtkConduitSource vtkConduitToDataObject vtkConeLayoutStrategy vtkConnectedPointsFilter vtkConnectivityFilter vtkConstrained2DLayoutStrategy vtkConstrainedPointHandleRepresentation vtkConstrainedSmoothingFilter vtkConsumerDataFilter vtkContext2D vtkContext3D vtkContextActor vtkContextArea vtkContextClip vtkContextDevice2D vtkContextDevice3D vtkContextInteractorStyle vtkContextItem vtkContextKeyEvent vtkContextMapper2D vtkContextMouseEvent vtkContextPolygon vtkContextScene vtkContextScenePrivate vtkContextTransform vtkContextView vtkContingencyStatistics vtkContinuousScatterplot vtkContinuousValueWidget vtkContinuousValueWidgetRepresentation vtkContour3DLinearGrid vtkContourGrid vtkContourHelper vtkContourLineInterpolator vtkContourLoopExtraction vtkContourRepresentation vtkContourRepresentationInternals vtkContourRepresentationNode vtkContourRepresentationPoint vtkContourTriangulator vtkContourValues vtkContourWidget vtkControlPointsItem vtkConvertSelection vtkConvertSelectionDomain vtkConvertToMultiBlockDataSet vtkConvertToPartitionedDataSetCollection vtkConvertToPointCloud vtkConvertToPolyhedra vtkConvexHull2D vtkCookieCutter vtkCoordinateFrame vtkCoordinateFrameRepresentation vtkCoordinateFrameWidget vtkCorrelativeStatistics vtkCosmicTreeLayoutStrategy vtkCountFaces vtkCountVertices vtkCubicLine vtkCuller vtkCullerCollection vtkCurvatures vtkCurveRepresentation vtkCutMaterial vtkCylinder vtkCylindricalTransform vtkDGAttributeInformation vtkDGBoundsResponder vtkDGCell vtkDGEdge vtkDGElevationResponder vtkDGEvaluator vtkDGHex vtkDGIOResponder vtkDGInterpolateCalculator vtkDGPyr vtkDGQuad vtkDGRangeResponder vtkDGRenderResponder vtkDGSidesResponder vtkDGTet vtkDGTranscribeUnstructuredCells vtkDGTri vtkDGVert vtkDGWdg vtkDIMACSGraphReader vtkDIMACSGraphWriter vtkDIYAggregateDataSetFilter vtkDIYDataExchanger vtkDIYExplicitAssigner vtkDIYGhostUtilities vtkDIYKdTreeUtilities vtkDIYUtilities vtkDIYUtilitiesCleanup vtkDSPFilterDefinition vtkDSPFilterGroup vtkDataArray vtkDataArrayCollection vtkDataArrayCollectionIterator vtkDataArraySelection vtkDataAssembly vtkDataAssemblyUtilities vtkDataAssemblyVisitor vtkDataCompressor vtkDataEncoder vtkDataObject vtkDataObjectAlgorithm vtkDataObjectCollection vtkDataObjectGenerator vtkDataObjectMeshCache vtkDataObjectReader vtkDataObjectToConduit vtkDataObjectToDataSetFilter vtkDataObjectToTable vtkDataObjectTree vtkDataObjectTreeIndex vtkDataObjectTreeInternals vtkDataObjectTreeIterator vtkDataObjectTypes vtkDataObjectWriter vtkDataReader vtkDataSet vtkDataSetAlgorithm vtkDataSetAttributes vtkDataSetAttributesFieldList vtkDataSetCellIterator vtkDataSetCollection vtkDataSetEdgeSubdivisionCriterion vtkDataSetGradient vtkDataSetGradientPrecompute vtkDataSetReader vtkDataSetRegionSurfaceFilter vtkDataSetSurfaceFilter vtkDataSetToDataObjectFilter vtkDataSetTriangleFilter vtkDataSetWriter vtkDataTransferHelper vtkDataWriter vtkDatabaseToTableReader vtkDateToNumeric vtkDeRhamCell vtkDebugLeaks vtkDebugLeaksManager vtkDebugLeaksObserver vtkDecimatePolylineFilter vtkDecimatePro vtkDefaultPass vtkDeflectNormals vtkDeformPointSet vtkDelimitedTextReader vtkDelimitedTextWriter vtkDemandDrivenPipeline vtkDendrogramItem vtkDenseArray vtkDensifyPointCloudFilter vtkDensifyPolyData vtkDependentDimensionInfo vtkDepthImageProcessingPass vtkDepthImageToPointCloud vtkDepthOfFieldPass vtkDepthPeelingPass vtkDepthSortPolyData vtkDescriptiveStatistics vtkDeserializer vtkDiagonalMatrixSource vtkDicer vtkDijkstraGraphGeodesicPath vtkDijkstraGraphInternals vtkDijkstraImageContourLineInterpolator vtkDijkstraImageGeodesicPath vtkDimensionInfo vtkDirectedAcyclicGraph vtkDirectedGraph vtkDirectedGraphAlgorithm vtkDirectionEncoder vtkDirectory vtkDiscreteFlyingEdges2D vtkDiscreteFlyingEdges3D vtkDiscreteFlyingEdgesClipper2D vtkDiscreteMarchingCubes vtkDisplaySizedImplicitPlaneRepresentation vtkDisplaySizedImplicitPlaneWidget vtkDistancePolyDataFilter vtkDistanceRepresentation vtkDistanceRepresentation2D vtkDistanceRepresentation3D vtkDistributedDataFilter vtkDistributedGraphHelper vtkDistributedPointCloudFilter vtkDotProductSimilarity vtkDrawTexturedElements vtkDualDepthPeelingPass vtkDummyCommunicator vtkDummyController vtkDummyGPUInfoList vtkDuplicatePolyData vtkDynamic2DLabelMapper vtkDynamicLoader vtkEDLShading vtkEGLRenderWindow vtkERFReader vtkEdgeCenters vtkEdgeLayout vtkEdgeLayoutStrategy vtkEdgeListIterator vtkEdgePoints vtkEdgeSubdivisionCriterion vtkEdgeTable vtkEllipseArcSource vtkEllipsoidTensorProbeRepresentation vtkEllipsoidalGaussianKernel vtkEllipticalButtonSource vtkEmptyCell vtkEmptyRepresentation vtkEnSight6BinaryReader vtkEnSight6Reader vtkEnSightGoldBinaryReader vtkEnSightGoldReader vtkEnSightMasterServerReader vtkEnSightReader vtkEnSightWriter vtkEncodedGradientEstimator vtkEncodedGradientShader vtkEndFor vtkEnsembleSource vtkEnzoReaderBlock vtkEnzoReaderInternal vtkEqualizerContextItem vtkEqualizerFilter vtkEquirectangularToCubeMapTexture vtkErrorCode vtkEuclideanClusterExtraction vtkEvenlySpacedStreamlines2D vtkEvent vtkEventData vtkEventDataDevice3D vtkEventDataForDevice vtkEventForwarderCommand vtkEventQtSlotConnect vtkExecutableRunner vtkExecutionAggregator vtkExecutionRange vtkExecutionTimer vtkExecutive vtkExodusIICache vtkExodusIICacheEntry vtkExodusIICacheKey vtkExodusIIReader vtkExodusIIReaderIntPointCheck vtkExodusIIReaderParser vtkExodusIIReaderPrivate vtkExodusIIReaderScalarCheck vtkExodusIIReaderTensorCheck vtkExodusIIReaderVariableCheck vtkExodusIIReaderVectorCheck vtkExpandMarkedElements vtkExpandSelectedGraph vtkExplicitStructuredGrid vtkExplicitStructuredGridAlgorithm vtkExplicitStructuredGridCrop vtkExplicitStructuredGridSurfaceFilter vtkExplicitStructuredGridToUnstructuredGrid vtkExporter vtkExprTkFunctionParser vtkExtentRCBPartitioner vtkExtentSplitter vtkExtentTranslator vtkExternalLight vtkExternalOpenGLCamera vtkExternalOpenGLRenderWindow vtkExternalOpenGLRenderer vtkExtractArray vtkExtractBlock vtkExtractBlockUsingDataAssembly vtkExtractCTHPart vtkExtractCells vtkExtractCellsAlongPolyLine vtkExtractCellsByType vtkExtractDataArraysOverTime vtkExtractDataOverTime vtkExtractDataSets vtkExtractEnclosedPoints vtkExtractExodusGlobalTemporalVariables vtkExtractFunctionalBagPlot vtkExtractGeometry vtkExtractGhostCells vtkExtractGrid vtkExtractHierarchicalBins vtkExtractHistogram vtkExtractHistogram2D vtkExtractLevel vtkExtractParticlesOverTime vtkExtractPiece vtkExtractPointCloudPiece vtkExtractPoints vtkExtractPolyDataGeometry vtkExtractPolyDataPiece vtkExtractRectilinearGrid vtkExtractSelectedArraysOverTime vtkExtractSelectedFrustum vtkExtractSelectedGraph vtkExtractSelectedRows vtkExtractSelectedTree vtkExtractSelection vtkExtractSelectionBase vtkExtractStructuredGridHelper vtkExtractSubsetWithSeed vtkExtractSurface vtkExtractTensorComponents vtkExtractTimeSteps vtkExtractUnstructuredGrid vtkExtractUnstructuredGridPiece vtkExtractUserDefinedPiece vtkExtractVectorComponents vtkFDSReader vtkFFMPEGVideoSource vtkFFMPEGWriter vtkFFT vtkFLUENTCFFReader vtkFLUENTReader vtkFXAAOptions vtkFacetReader vtkFacetWriter vtkFast2DLayoutStrategy vtkFastSplatter vtkFiberSurface vtkFidesReader vtkFieldData vtkFieldDataSerializer vtkFieldDataToAttributeDataFilter vtkFieldDataToDataSetAttribute vtkFileOutputWindow vtkFileResourceStream vtkFileSeriesHelper vtkFillHolesFilter vtkFilteringInformationKeyManager vtkFiltersCellGrid vtkFindCellStrategy vtkFiniteDifferenceGradientEstimator vtkFiniteElementFieldDistributor vtkFinitePlaneRepresentation vtkFinitePlaneWidget vtkFitToHeightMapFilter vtkFixedPointRayCastImage vtkFixedPointVolumeRayCastCompositeGOHelper vtkFixedPointVolumeRayCastCompositeGOShadeHelper vtkFixedPointVolumeRayCastCompositeHelper vtkFixedPointVolumeRayCastCompositeShadeHelper vtkFixedPointVolumeRayCastHelper vtkFixedPointVolumeRayCastMIPHelper vtkFixedSizeHandleRepresentation vtkFixedSizeHandleRepresentation3D vtkFixedWidthTextReader vtkFlagpoleLabel vtkFlashReaderInternal vtkFloatingPointExceptions vtkFlyingEdges2D vtkFlyingEdges3D vtkFlyingEdgesPlaneCutter vtkFocalPlaneContourRepresentation vtkFocalPlanePointPlacer vtkFontConfigFreeTypeTools vtkForEach vtkForceDirectedLayoutStrategy vtkForceStaticMesh vtkForceTime vtkFrameBufferObjectBase vtkFramebufferPass vtkFreeTypeLabelRenderStrategy vtkFreeTypeStringToImage vtkFreeTypeTools vtkFreeTypeToolsCleanup vtkFrustumCoverageCuller vtkFrustumSelector vtkFunctionSet vtkGAMBITReader vtkGDAL vtkGDALRasterConverter vtkGDALRasterReader vtkGDALRasterReprojection vtkGDALVectorReader vtkGESignaReader vtkGL2PSExporter vtkGLSLModCamera vtkGLSLModCoincidentTopology vtkGLSLModLight vtkGLSLModPixelDebugger vtkGLSLModifierBase vtkGLSLModifierFactory vtkGLTFDocumentLoader vtkGLTFDocumentLoaderInternals vtkGLTFExporter vtkGLTFImporter vtkGLTFReader vtkGLTFTexture vtkGLTFWriter vtkGLTFWriterUtils vtkGPUInfo vtkGPUInfoList vtkGPUInfoListArray vtkGPUVolumeRayCastMapper vtkGarbageCollector vtkGarbageCollectorManager vtkGaussianBlurPass vtkGaussianCubeReader vtkGaussianCubeReader2 vtkGaussianKernel vtkGaussianRandomSequence vtkGaussianSplatter vtkGeneralTransform vtkGeneralizedKernel vtkGenerateGlobalIds vtkGenerateIndexArray vtkGenerateProcessIds vtkGenerateTimeSteps vtkGenericAdaptorCell vtkGenericAttribute vtkGenericAttributeCollection vtkGenericCell vtkGenericCellIterator vtkGenericCellTessellator vtkGenericClip vtkGenericContourFilter vtkGenericCutter vtkGenericDataArray vtkGenericDataArrayLookupHelper vtkGenericDataObjectReader vtkGenericDataObjectWriter vtkGenericDataSet vtkGenericDataSetTessellator vtkGenericEdgeTable vtkGenericEnSightReader vtkGenericGeometryFilter vtkGenericGlyph3DFilter vtkGenericImageInterpolator vtkGenericInterpolatedVelocityField vtkGenericMovieWriter vtkGenericOpenGLRenderWindow vtkGenericOpenGLResourceFreeCallback vtkGenericOutlineFilter vtkGenericPointIterator vtkGenericProbeFilter vtkGenericRenderWindowInteractor vtkGenericStreamTracer vtkGenericSubdivisionErrorMetric vtkGenericVertexAttributeMapping vtkGeoEdgeStrategy vtkGeoJSONFeature vtkGeoJSONReader vtkGeoJSONWriter vtkGeoMath vtkGeoProjection vtkGeoTransform vtkGeodesicPath vtkGeometricErrorMetric vtkGeometryFilter vtkGhostCellsGenerator vtkGlobFileNames vtkGlyphSource2D vtkGradientFilter vtkGraph vtkGraphAlgorithm vtkGraphAnnotationLayersFilter vtkGraphEdge vtkGraphGeodesicPath vtkGraphHierarchicalBundleEdges vtkGraphInternals vtkGraphItem vtkGraphLayout vtkGraphLayoutFilter vtkGraphLayoutStrategy vtkGraphReader vtkGraphToGlyphs vtkGraphToPoints vtkGraphToPolyData vtkGraphWeightEuclideanDistanceFilter vtkGraphWeightFilter vtkGraphWriter vtkGraphicsFactory vtkGreedyTerrainDecimation vtkGridSynchronizedTemplates3D vtkGridTransform vtkGroupDataSetsFilter vtkGroupLeafVertices vtkGroupTimeStepsFilter vtkH5PartReader vtkH5RageReader vtkHDF5Helper vtkHDFReader vtkHDFReaderImplementation vtkHDFVersion vtkHDFWriter vtkHDFWriterImplementation vtkHDRReader vtkHandleRepresentation vtkHandleSource vtkHandleWidget vtkHardwarePicker vtkHardwareSelector vtkHardwareWindow vtkHausdorffDistancePointSetFilter vtkHeap vtkHeatmapItem vtkHexagonalPrism vtkHexahedron vtkHiddenLineRemovalPass vtkHierarchicalBinningFilter vtkHierarchicalBoxDataSet vtkHierarchicalBoxDataSetAlgorithm vtkHierarchicalDataExtractDataSets vtkHierarchicalDataExtractLevel vtkHierarchicalDataLevelFilter vtkHierarchicalDataSetGeometryFilter vtkHierarchicalGraphPipeline vtkHierarchicalGraphView vtkHierarchicalPolyDataMapper vtkHigherOrderCurve vtkHigherOrderHexahedron vtkHigherOrderInterpolation vtkHigherOrderQuadrilateral vtkHigherOrderTetra vtkHigherOrderTriangle vtkHigherOrderWedge vtkHighestDensityRegionsStatistics vtkHomogeneousTransform vtkHoudiniPolyDataWriter vtkHoverWidget vtkHull vtkHyperStreamline vtkHyperTree vtkHyperTreeGrid vtkHyperTreeGridAlgorithm vtkHyperTreeGridAxisClip vtkHyperTreeGridAxisCut vtkHyperTreeGridAxisReflection vtkHyperTreeGridCellCenters vtkHyperTreeGridContour vtkHyperTreeGridDepthLimiter vtkHyperTreeGridEntry vtkHyperTreeGridEvaluateCoarse vtkHyperTreeGridExtractGhostCells vtkHyperTreeGridFeatureEdges vtkHyperTreeGridGeometricLocator vtkHyperTreeGridGeometry vtkHyperTreeGridGeometry1DImpl vtkHyperTreeGridGeometry2DImpl vtkHyperTreeGridGeometry3DImpl vtkHyperTreeGridGeometryEntry vtkHyperTreeGridGeometryImpl vtkHyperTreeGridGeometryLevelEntry vtkHyperTreeGridGeometrySmallDimensionsImpl vtkHyperTreeGridGeometryUnlimitedEntry vtkHyperTreeGridGeometryUnlimitedLevelEntry vtkHyperTreeGridGhostCellsGenerator vtkHyperTreeGridGhostCellsGeneratorInternals vtkHyperTreeGridGradient vtkHyperTreeGridIterator vtkHyperTreeGridLevelEntry vtkHyperTreeGridLocator vtkHyperTreeGridMapper vtkHyperTreeGridNonOrientedCursor vtkHyperTreeGridNonOrientedGeometryCursor vtkHyperTreeGridNonOrientedMooreSuperCursor vtkHyperTreeGridNonOrientedMooreSuperCursorLight vtkHyperTreeGridNonOrientedSuperCursor vtkHyperTreeGridNonOrientedSuperCursorLight vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor vtkHyperTreeGridNonOrientedUnlimitedSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight vtkHyperTreeGridOrientedCursor vtkHyperTreeGridOrientedGeometryCursor vtkHyperTreeGridOutlineFilter vtkHyperTreeGridPlaneCutter vtkHyperTreeGridPreConfiguredSource vtkHyperTreeGridProbeFilter vtkHyperTreeGridScales vtkHyperTreeGridThreshold vtkHyperTreeGridToDualGrid vtkHyperTreeGridToUnstructuredGrid vtkHyperTreeGridVisibleLeavesSize vtkIOCellGrid vtkIOSRenderWindow vtkIOSRenderWindowInteractor vtkIOSSFilesScanner vtkIOSSModel vtkIOSSReader vtkIOSSReaderInternal vtkIOSSWriter vtkIOStream vtkIOStreamFwd vtkISIReader vtkIVExporter vtkIVWriter vtkIcicleView vtkIconGlyphFilter vtkIdFilter vtkIdList vtkIdListCollection vtkIdentityTransform vtkImageAccumulate vtkImageActorPointPlacer vtkImageAlgorithm vtkImageAnisotropicDiffusion2D vtkImageAnisotropicDiffusion3D vtkImageAppend vtkImageAppendComponents vtkImageBSplineCoefficients vtkImageBSplineInternals vtkImageBSplineInterpolator vtkImageButterworthHighPass vtkImageButterworthLowPass vtkImageCacheFilter vtkImageChangeInformation vtkImageCheckerboard vtkImageCityBlockDistance vtkImageClip vtkImageConnectivityFilter vtkImageConnector vtkImageConnectorSeed vtkImageConstantPad vtkImageContinuousDilate3D vtkImageContinuousErode3D vtkImageConvolve vtkImageCorrelation vtkImageCroppingRegionsWidget vtkImageCursor3D vtkImageDataLIC2D vtkImageDataOutlineFilter vtkImageDataStreamer vtkImageDataToExplicitStructuredGrid vtkImageDataToHyperTreeGrid vtkImageDataToPointSet vtkImageDataToUniformGrid vtkImageDecomposeFilter vtkImageDifference vtkImageDilateErode3D vtkImageDivergence vtkImageDotProduct vtkImageEuclideanDistance vtkImageEuclideanToPolar vtkImageExport vtkImageExtractComponents vtkImageFourierCenter vtkImageFourierFilter vtkImageGaussianSmooth vtkImageGaussianSource vtkImageGradient vtkImageGradientMagnitude vtkImageHSIToRGB vtkImageHSVToRGB vtkImageHistogram vtkImageHistogramStatistics vtkImageHybridMedian2D vtkImageIdealHighPass vtkImageIdealLowPass vtkImageImport vtkImageImportExecutive vtkImageInPlaceFilter vtkImageInterpolator vtkImageIslandRemoval2D vtkImageItem vtkImageIterateFilter vtkImageIterator vtkImageLaplacian vtkImageLogarithmicScale vtkImageLogic vtkImageLuminance vtkImageMagnify vtkImageMagnitude vtkImageMapToRGBA vtkImageMapToWindowLevelColors vtkImageMapper3D vtkImageMarchingCubes vtkImageMask vtkImageMaskBits vtkImageMathematics vtkImageMedian3D vtkImageMirrorPad vtkImageNoiseSource vtkImageNonMaximumSuppression vtkImageOpenClose3D vtkImageOrthoPlanes vtkImagePadFilter vtkImagePointDataIterator vtkImagePointIterator vtkImageProbeFilter vtkImageProcessingPass vtkImageProgressIterator vtkImageProperty vtkImageQuantizeRGBToIndex vtkImageRFFT vtkImageRGBToHSI vtkImageRGBToHSV vtkImageRGBToXYZ vtkImageRGBToYIQ vtkImageRange3D vtkImageReader vtkImageReader2Collection vtkImageRectilinearWipe vtkImageRenderManager vtkImageResample vtkImageResize vtkImageResliceMapper vtkImageResliceToColors vtkImageSSIM vtkImageSeedConnectivity vtkImageSeparableConvolution vtkImageShiftScale vtkImageShrink3D vtkImageSincInterpolator vtkImageSkeleton2D vtkImageSlab vtkImageSlabReslice vtkImageSlice vtkImageSliceCollection vtkImageSliceMapper vtkImageSobel2D vtkImageSobel3D vtkImageSpatialAlgorithm vtkImageStack vtkImageStencil vtkImageStencilAlgorithm vtkImageStencilData vtkImageStencilIterator vtkImageStencilRaster vtkImageStencilSource vtkImageStencilToImage vtkImageThreshold vtkImageThresholdConnectivity vtkImageToAMR vtkImageToImageStencil vtkImageToPoints vtkImageToPolyDataFilter vtkImageToStructuredGrid vtkImageToStructuredPoints vtkImageTransform vtkImageTranslateExtent vtkImageVariance3D vtkImageViewer vtkImageWrapPad vtkImageWriter vtkImageXYZToLAB vtkImageYIQToRGB vtkImplicitArray vtkImplicitCylinderRepresentation vtkImplicitCylinderWidget vtkImplicitFunction vtkImplicitFunctionCollection vtkImplicitFunctionToImageStencil vtkImplicitHalo vtkImplicitImageRepresentation vtkImplicitPlaneRepresentation vtkImplicitPlaneWidget vtkImplicitPlaneWidget2 vtkImplicitPolyDataDistance vtkImplicitProjectOnPlaneDistance vtkImplicitSelectionLoop vtkImplicitSum vtkImplicitTextureCoords vtkImplicitVolume vtkImplicitWindowFunction vtkImporter vtkImprintFilter vtkInEdgeIterator vtkIncrementalForceLayout vtkIncrementalOctreeNode vtkIncrementalOctreePointLocator vtkIncrementalPointLocator vtkIndent vtkIndexedImplicitBackend vtkInformation vtkInformationDataObjectKey vtkInformationDataObjectMetaDataKey vtkInformationDoubleKey vtkInformationDoubleVectorKey vtkInformationExecutivePortKey vtkInformationExecutivePortVectorKey vtkInformationIdTypeKey vtkInformationInformationKey vtkInformationInformationVectorKey vtkInformationIntegerKey vtkInformationIntegerPointerKey vtkInformationIntegerRequestKey vtkInformationIntegerVectorKey vtkInformationInternals vtkInformationIterator vtkInformationKey vtkInformationKeyLookup vtkInformationKeyVectorKey vtkInformationObjectBaseKey vtkInformationObjectBaseVectorKey vtkInformationQuadratureSchemeDefinitionVectorKey vtkInformationRequestKey vtkInformationStringKey vtkInformationStringVectorKey vtkInformationUnsignedLongKey vtkInformationVariantKey vtkInformationVariantVectorKey vtkInformationVector vtkInitialValueProblemSolver vtkInputStream vtkIntArray vtkIntegrateAttributes vtkInteractiveArea vtkInteractorEventRecorder vtkInteractorStyle3D vtkInteractorStyleAreaSelectHover vtkInteractorStyleDrawPolygon vtkInteractorStyleFlight vtkInteractorStyleJoystickActor vtkInteractorStyleJoystickCamera vtkInteractorStyleMultiTouchCamera vtkInteractorStyleRubberBand2D vtkInteractorStyleRubberBand3D vtkInteractorStyleSwitchBase vtkInteractorStyleTreeMapHover vtkInteractorStyleUnicam vtkInteractorStyleUser vtkInterpolateCalculator vtkInterpolateDataSetAttributes vtkInterpolatingSubdivisionFilter vtkInterpolationKernel vtkInterpolatorInternals vtkIntersectionCounter vtkIntersectionPolyDataFilter vtkIterativeClosestPointTransform vtkJSONDataSetWriter vtkJSONImageWriter vtkJSONRenderWindowExporter vtkJSONSceneExporter vtkJavaScriptDataWriter vtkJoinTables vtkKCoreDecomposition vtkKCoreLayout vtkKMeansAssessFunctor vtkKMeansDistanceFunctor vtkKMeansDistanceFunctorCalculator vtkKMeansStatistics vtkKdNode vtkKdTree vtkKdTreeSelector vtkLASRasterReader vtkLASReader vtkLICNoiseHelper vtkLICRandomNoise2D vtkLICRandomNumberGeneratorInterface vtkLODProp3D vtkLSDynaPart vtkLSDynaPartCollection vtkLSDynaReader vtkLSDynaSummaryParser vtkLZ4DataCompressor vtkLZMADataCompressor vtkLabelHierarchy vtkLabelHierarchyAlgorithm vtkLabelHierarchyCompositeIterator vtkLabelHierarchyIterator vtkLabelPlacementMapper vtkLabelPlacer vtkLabelRenderStrategy vtkLabelSizeCalculator vtkLabeledContourMapper vtkLabeledContourPolyDataItem vtkLabeledDataMapper vtkLabeledTreeMapDataMapper vtkLagrangeCurve vtkLagrangeHexahedron vtkLagrangeInterpolation vtkLagrangeQuadrilateral vtkLagrangeTetra vtkLagrangeTriangle vtkLagrangeWedge vtkLagrangianBasicIntegrationModel vtkLagrangianMatidaIntegrationModel vtkLagrangianParticle vtkLagrangianParticleTracker vtkLandmarkTransform vtkLargeInteger vtkLassoStencilSource vtkLeaderActor2D vtkLegacyReaderVersion vtkLengthDistribution vtkLevelIdScalars vtkLightCollection vtkLightKit vtkLightNode vtkLightRepresentation vtkLightWidget vtkLightingMapPass vtkLightsPass vtkLineIntegralConvolution2D vtkLineRepresentation vtkLineWidget vtkLineWidget2 vtkLinearCellExtrusionFilter vtkLinearContourLineInterpolator vtkLinearKernel vtkLinearSelector vtkLinearSubdivisionFilter vtkLinearToQuadraticCellsFilter vtkLinearTransform vtkLinearTransformCellLocator vtkLinkEdgels vtkLocationSelector vtkLocator vtkLogLookupTable vtkLogger vtkLongArray vtkLongLongArray vtkLookupTableItem vtkLookupTableWithEnabling vtkLoopBooleanPolyDataFilter vtkLoopSubdivisionFilter vtkMCubesReader vtkMCubesWriter vtkMFCWindow vtkMFIXReader vtkMINCImageAttributes vtkMINCImageReader vtkMINCImageWriter vtkMNIObjectReader vtkMNIObjectWriter vtkMNITagPointReader vtkMNITagPointWriter vtkMNITransformReader vtkMNITransformWriter vtkMP4Writer vtkMPASReader vtkMPI4PyCommunicator vtkMPICommunicator vtkMPIController vtkMPIEventLog vtkMPIImageReader vtkMPIMultiBlockPLOT3DReader vtkMPIPixelTT vtkMPIPixelView vtkMRCReader vtkMagnifierRepresentation vtkMagnifierWidget vtkMapArrayValues vtkMapMaskTextureId vtkMappedDataArray vtkMappedUnstructuredGrid vtkMappedUnstructuredGridCellIterator vtkMapper vtkMapper2D vtkMapperCollection vtkMapperNode vtkMarchingContourFilter vtkMarchingSquares vtkMarkBoundaryFilter vtkMarkerUtilities vtkMarshalContext vtkMaskFields vtkMaskPointsFilter vtkMaskPolyData vtkMassProperties vtkMathPrivate vtkMathTextFreeTypeTextRenderer vtkMathTextUtilities vtkMathTextUtilitiesCleanup vtkMathUtilities vtkMatplotlibMathTextUtilities vtkMatricizeArray vtkMatrixMathFilter vtkMatrixToHomogeneousTransform vtkMatrixToLinearTransform vtkMeanValueCoordinatesInterpolator vtkMeasurementCubeHandleRepresentation3D vtkMedicalImageProperties vtkMedicalImageReader2 vtkMemkindRAII vtkMemoryLimitImageDataStreamer vtkMemoryResourceStream vtkMergeArrays vtkMergeCells vtkMergeColumns vtkMergeDataObjectFilter vtkMergeFields vtkMergeFilter vtkMergeGraphs vtkMergePoints vtkMergeTables vtkMergeTimeFilter vtkMergeVectorComponents vtkMersenneTwister vtkMetaImageWriter vtkModelMetadata vtkModifiedBSPTree vtkMolecule vtkMoleculeAlgorithm vtkMoleculeAppend vtkMoleculeReaderBase vtkMoleculeToAtomBallFilter vtkMoleculeToBondStickFilter vtkMoleculeToLinesFilter vtkMoleculeToPolyDataFilter vtkMotionFXCFGReader vtkMultiBlockDataGroupFilter vtkMultiBlockDataSetAlgorithm vtkMultiBlockMergeFilter vtkMultiBlockPLOT3DReaderRecord vtkMultiBlockUnstructuredGridVolumeMapper vtkMultiBlockVolumeMapper vtkMultiCorrelativeAssessFunctor vtkMultiCorrelativeStatistics vtkMultiNewickTreeReader vtkMultiObjectMassProperties vtkMultiPieceDataSet vtkMultiProcessController vtkMultiProcessStream vtkMultiThreader vtkMultiThreshold vtkMultiTimeStepAlgorithm vtkMultiVolume vtkMutableGraphHelper vtkMySQLDatabase vtkMySQLDatabasePrivate vtkMySQLQuery vtkMySQLToTableReader vtkNIFTIImageHeader vtkNIFTIImageReader vtkNIFTIImageWriter vtkNativePartitioningStrategy vtkNeighborCells vtkNek5000Reader vtkNetCDFCAMReader vtkNetCDFCFReader vtkNetCDFCFWriter vtkNetCDFPOPReader vtkNetCDFReader vtkNetCDFUGRIDReader vtkNetCDFUGRIDeader vtkNetworkHierarchy vtkNew vtkNewickTreeReader vtkNewickTreeWriter vtkNonLinearCell vtkNonMergingPointLocator vtkNonOverlappingAMR vtkNonOverlappingAMRAlgorithm vtkNonOverlappingAMRLevelIdScalars vtkNormalizeMatrixVectors vtkNrrdReader vtkNumberToString vtkOBBDicer vtkOBBNode vtkOBBTree vtkOBJExporter vtkOBJImporter vtkOBJPolyDataProcessor vtkOBJWriter vtkOCCTReader vtkODBCDatabase vtkODBCInternals vtkODBCQuery vtkOMETIFFReader vtkOMFReader vtkOOGLExporter vtkOSOpenGLRenderWindow vtkOSPRayAMRVolumeMapperNode vtkOSPRayActorNode vtkOSPRayCache vtkOSPRayCacheItemObject vtkOSPRayCameraNode vtkOSPRayCompositePolyDataMapper2Node vtkOSPRayCompositePolyDataMapperNode vtkOSPRayLightNode vtkOSPRayMaterialHelpers vtkOSPRayMaterialLibrary vtkOSPRayMoleculeMapperNode vtkOSPRayPass vtkOSPRayPointGaussianMapperNode vtkOSPRayPolyDataMapperNode vtkOSPRayRendererNode vtkOSPRayTestInteractor vtkOSPRayUnstructuredVolumeMapperNode vtkOSPRayViewNodeFactory vtkOSPRayVolumeInterface vtkOSPRayVolumeMapper vtkOSPRayVolumeMapperNode vtkOSPRayVolumeNode vtkOSPRayWindowNode vtkOStrStreamWrapper vtkOStreamWrapper vtkOTDensityMap vtkOTFilter vtkOTKernelSmoothing vtkOTScatterPlotMatrix vtkOTUtilities vtkObjectBase vtkObjectFactory vtkObjectFactoryCollection vtkObjectFactoryRegistryCleanup vtkObjectIdMap vtkObserverMediator vtkOctreeImageToPointSetFilter vtkOctreePointLocatorNode vtkOldStyleCallbackCommand vtkOpaquePass vtkOpenFOAMReader vtkOpenGL2ContextDevice2DCellArrayHelper vtkOpenGL2ContextDevice2DPrivate vtkOpenGLActor vtkOpenGLArrayTextureBufferAdapter vtkOpenGLAvatar vtkOpenGLBatchedPolyDataMapper vtkOpenGLBillboardTextActor3D vtkOpenGLBufferObject vtkOpenGLCamera vtkOpenGLCellGridMapper vtkOpenGLCellToVTKCellMap vtkOpenGLCompositePolyDataMapperDelegator vtkOpenGLContextActor vtkOpenGLContextBufferId vtkOpenGLContextDevice2D vtkOpenGLContextDevice3D vtkOpenGLContextDeviceBufferObjectBuilder vtkOpenGLES30PolyDataMapper2D vtkOpenGLFXAAFilter vtkOpenGLFXAAPass vtkOpenGLFluidMapper vtkOpenGLFramebufferObject vtkOpenGLGL2PSExporter vtkOpenGLGL2PSHelper vtkOpenGLGL2PSHelperImpl vtkOpenGLGPUVolumeRayCastMapper vtkOpenGLGlyph3DHelper vtkOpenGLGlyph3DMapper vtkOpenGLHardwareSelector vtkOpenGLHelper vtkOpenGLHyperTreeGridMapper vtkOpenGLImageAlgorithmCallback vtkOpenGLImageAlgorithmHelper vtkOpenGLImageGradient vtkOpenGLImageMapper vtkOpenGLImageSliceMapper vtkOpenGLIndexBufferObject vtkOpenGLInstanceCulling vtkOpenGLLabeledContourMapper vtkOpenGLLight vtkOpenGLLowMemoryBatchedPolyDataMapper vtkOpenGLLowMemoryCellTypeAgent vtkOpenGLLowMemoryLinesAgent vtkOpenGLLowMemoryPolyDataMapper vtkOpenGLLowMemoryPolygonsAgent vtkOpenGLLowMemoryStripsAgent vtkOpenGLLowMemoryVerticesAgent vtkOpenGLMoleculeMapper vtkOpenGLMovieSphere vtkOpenGLPointGaussianMapper vtkOpenGLPointGaussianMapperHelper vtkOpenGLPolyDataMapper vtkOpenGLPolyDataMapper2D vtkOpenGLProjectedTetrahedraMapper vtkOpenGLPropItem vtkOpenGLProperty vtkOpenGLQuadHelper vtkOpenGLRayCastImageDisplayHelper vtkOpenGLRenderPass vtkOpenGLRenderTimer vtkOpenGLRenderTimerLog vtkOpenGLRenderUtilities vtkOpenGLRenderWindow vtkOpenGLRenderer vtkOpenGLResourceFreeCallback vtkOpenGLShaderCache vtkOpenGLShaderDeclaration vtkOpenGLShaderProperty vtkOpenGLSkybox vtkOpenGLSphereMapper vtkOpenGLState vtkOpenGLStickMapper vtkOpenGLTextActor vtkOpenGLTextActor3D vtkOpenGLTextMapper vtkOpenGLTexture vtkOpenGLUniforms vtkOpenGLVertexArrayObject vtkOpenGLVertexBufferObject vtkOpenGLVertexBufferObjectCache vtkOpenGLVertexBufferObjectGroup vtkOpenGLVolumeGradientOpacityTable vtkOpenGLVolumeLookupTable vtkOpenGLVolumeLookupTables vtkOpenGLVolumeMaskGradientOpacityTransferFunction2D vtkOpenGLVolumeMaskTransferFunction2D vtkOpenGLVolumeOpacityTable vtkOpenGLVolumeRGBTable vtkOpenGLVolumeTransferFunction2D vtkOpenQubeElectronicData vtkOpenQubeMoleculeSource vtkOpenSlideReader vtkOpenVDBReader vtkOpenVDBWriter vtkOpenVRCamera vtkOpenVRCameraPose vtkOpenVRControlsHelper vtkOpenVRDefaultOverlay vtkOpenVRInteractorStyle vtkOpenVRModel vtkOpenVROverlay vtkOpenVROverlaySpot vtkOpenVRRenderWindow vtkOpenVRRenderWindowInteractor vtkOpenVRRenderer vtkOpenXRCamera vtkOpenXRControlsHelper vtkOpenXRInteractorStyle vtkOpenXRManager vtkOpenXRManagerConnection vtkOpenXRManagerD3DGraphics vtkOpenXRManagerGraphics vtkOpenXRManagerOpenGLGraphics vtkOpenXRManagerRemoteConnection vtkOpenXRModel vtkOpenXRRemotingRenderWindow vtkOpenXRRenderWindow vtkOpenXRRenderWindowInteractor vtkOpenXRRenderer vtkOpenXRUtilities vtkOrderIndependentTranslucentPass vtkOrderStatistics vtkOrderedTriangulator vtkOrientPolyData vtkOrientationRepresentation vtkOrientationWidget vtkOrientedGlyphContourRepresentation vtkOrientedGlyphFocalPlaneContourRepresentation vtkOrientedPolygonalHandleRepresentation3D vtkOutEdgeIterator vtkOutlineCornerFilter vtkOutlineCornerSource vtkOutlineGlowPass vtkOutlineSource vtkOutputStream vtkOutputWindow vtkOutputWindowCleanup vtkOverlappingAMR vtkOverlappingAMRAlgorithm vtkOverlappingAMRLevelIdScalars vtkOverlappingCellsDetector vtkOverlayPass vtkOverrideInformation vtkOverrideInformationCollection vtkPAutoCorrelativeStatistics vtkPBRIrradianceTexture vtkPBRLUTTexture vtkPBRPrefilterTexture vtkPBivariateLinearTableThreshold vtkPCAAnalysisFilter vtkPCACurvatureEstimation vtkPCANormalEstimation vtkPCAStatistics vtkPCellDataToPointData vtkPCellSizeFilter vtkPChacoReader vtkPComputeHistogram2DOutliers vtkPComputeQuantiles vtkPComputeQuartiles vtkPConnectivityFilter vtkPContingencyStatistics vtkPConvertToMultiBlockDataSet vtkPCorrelativeStatistics vtkPDALReader vtkPDFContextDevice2D vtkPDFExporter vtkPDataSetReader vtkPDataSetWriter vtkPDescriptiveStatistics vtkPDirectory vtkPDistributedDataFilter vtkPExodusIIReader vtkPExodusIIWriter vtkPExtractDataArraysOverTime vtkPExtractExodusGlobalTemporalVariables vtkPExtractGrid vtkPExtractHistogram2D vtkPExtractRectilinearGrid vtkPExtractSelectedArraysOverTime vtkPExtractVOI vtkPHardwareSelector vtkPHyperTreeGridProbeFilter vtkPIOReader vtkPImageWriter vtkPKMeansStatisitcs vtkPKMeansStatistics vtkPKdTree vtkPLSDynaReader vtkPLagrangianParticleTracker vtkPLineIntegralConvolution2D vtkPLinearExtrusionFilter vtkPMaskPoints vtkPMergeArrays vtkPMultiCorrelativeStatistics vtkPNetCDFPOPReader vtkPNrrdReader vtkPOVExporter vtkPOpenFOAMReader vtkPOrderStatistics vtkPOutlineCornerFilter vtkPOutlineFilter vtkPOutlineFilterInternals vtkPPCAStatistics vtkPPainterCommunicator vtkPPairwiseExtractHistogram2D vtkPParticlePathFilter vtkPParticleTracer vtkPParticleTracerBase vtkPPixelTransfer vtkPPolyDataNormals vtkPProbeFilter vtkPProjectSphereFilter vtkPReflectionFilter vtkPResampleFilter vtkPResampleToImage vtkPResampleWithDataSet vtkPSLACReader vtkPSimpleBondPerceiver vtkPSphereSource vtkPStreaklineFilter vtkPStreamTracer vtkPStructuredGridConnectivity vtkPSurfaceLICComposite vtkPSurfaceLICInterface vtkPSystemTools vtkPTSReader vtkPTextureMapToSphere vtkPVWebGLExporter vtkPWindBladeReader vtkPXdmf3Writer vtkPYoungsMaterialInterface vtkPackLabels vtkPainterCommunicator vtkPairwiseExtractHistogram2D vtkPanoramicProjectionPass vtkParallelAMRUtilities vtkParallelCoordinatesActor vtkParallelCoordinatesHistogramRepresentation vtkParallelCoordinatesInteractorStyle vtkParallelCoordinatesRepresentation vtkParallelCoordinatesView vtkParallelReader vtkParallelRenderManager vtkParallelTimer vtkParallelVectors vtkParallelopipedRepresentation vtkParallelopipedWidget vtkParametricBohemianDome vtkParametricBour vtkParametricBoy vtkParametricCatalanMinimal vtkParametricConicSpiral vtkParametricCrossCap vtkParametricDini vtkParametricEllipsoid vtkParametricEnneper vtkParametricFunction vtkParametricHenneberg vtkParametricKlein vtkParametricKuen vtkParametricMobius vtkParametricPluckerConoid vtkParametricPseudosphere vtkParametricRandomHills vtkParametricRoman vtkParametricSuperToroid vtkParametricTorus vtkParticlePathFilter vtkParticleTracer vtkParticleTracerBase vtkPartitionBalancer vtkPartitionedArchiver vtkPartitionedDataSet vtkPartitionedDataSetAlgorithm vtkPartitionedDataSetCollection vtkPartitionedDataSetCollectionAlgorithm vtkPartitionedDataSetCollectionSource vtkPartitionedDataSetSource vtkPartitioningStrategy vtkPassArrays vtkPassInputTypeAlgorithm vtkPassSelectedArrays vtkPassThroughEdgeStrategy vtkPassThroughLayoutStrategy vtkPath vtkPen vtkPentagonalPrism vtkPeriodicDataArray vtkPeriodicFilter vtkPeriodicTable vtkPerturbCoincidentVertices vtkPhyloXMLTreeReader vtkPhyloXMLTreeWriter vtkPicker vtkPickingManager vtkPieChartActor vtkPieceRequestFilter vtkPieceScalars vtkPiecewiseControlPointsItem vtkPiecewiseFunctionAlgorithm vtkPiecewiseFunctionItem vtkPiecewiseFunctionShiftScale vtkPiecewisePointHandleItem vtkPipelineGraphSource vtkPipelineSize vtkPixel vtkPixelBufferObject vtkPixelExtent vtkPixelExtentIO vtkPixelTransfer vtkPlaneCollection vtkPlaneCutter vtkPlaybackRepresentation vtkPlaybackWidget vtkPlot vtkPlot3D vtkPlot3DMetaReader vtkPlotArea vtkPlotBag vtkPlotBar vtkPlotBarRangeHandlesItem vtkPlotBox vtkPlotFunctionalBag vtkPlotGrid vtkPlotHistogram2D vtkPlotLine vtkPlotLine3D vtkPlotParallelCoordinates vtkPlotPie vtkPlotPoints vtkPlotPoints3D vtkPlotRangeHandlesItem vtkPlotStacked vtkPlotSurface vtkPointCloudFilter vtkPointCloudRepresentation vtkPointCloudWidget vtkPointConnectivityFilter vtkPointData vtkPointDataToCellData vtkPointDensityFilter vtkPointFillPass vtkPointGaussianMapper vtkPointHandleRepresentation3D vtkPointHandleSource vtkPointInterpolator vtkPointInterpolator2D vtkPointLoad vtkPointLocator vtkPointOccupancyFilter vtkPointPicker vtkPointPlacer vtkPointSet vtkPointSetAlgorithm vtkPointSetCellIterator vtkPointSetStreamer vtkPointSetToLabelHierarchy vtkPointSetToMoleculeFilter vtkPointSetToOctreeImageFilter vtkPointSmoothingFilter vtkPointWidget vtkPoints2D vtkPointsProjectedHull vtkPoissonDiskSampler vtkPolarAxesActor vtkPolarAxesActor2D vtkPolyDataAlgorithm vtkPolyDataCollection vtkPolyDataContourLineInterpolator vtkPolyDataEdgeConnectivityFilter vtkPolyDataInternals vtkPolyDataItem vtkPolyDataMapperNode vtkPolyDataPlaneClipper vtkPolyDataPlaneCutter vtkPolyDataPointPlacer vtkPolyDataPointSampler vtkPolyDataSilhouette vtkPolyDataSourceWidget vtkPolyDataStreamer vtkPolyDataTangents vtkPolyDataToImageStencil vtkPolyDataToReebGraphFilter vtkPolyDataToUnstructuredGrid vtkPolyDataWriter vtkPolyLineRepresentation vtkPolyLineSource vtkPolyLineWidget vtkPolyPlane vtkPolyPointSource vtkPolyVertex vtkPolygonBuilder vtkPolygonalHandleRepresentation3D vtkPolygonalSurfaceContourLineInterpolator vtkPolygonalSurfacePointPlacer vtkPolyhedron vtkPolyhedronUtilities vtkPolynomialSolversUnivariate vtkPostScriptWriter vtkPostgreSQLDatabase vtkPostgreSQLDatabasePrivate vtkPostgreSQLQuery vtkPostgreSQLToTableReader vtkPriorityQueue vtkProStarReader vtkProbabilisticVoronoiKernel vtkProbeLineFilter vtkProbePolyhedron vtkProbeSelectedLocations vtkProcess vtkProcessGroup vtkProcessIdScalars vtkProcrustesAlignmentFilter vtkProgrammableAttributeDataFilter vtkProgrammableDataObjectSource vtkProgrammableElectronicData vtkProgrammableFilter vtkProgrammableGlyphFilter vtkProgrammableSource vtkProgressBarRepresentation vtkProgressBarWidget vtkProgressObserver vtkProjectPointsToPlane vtkProjectedTerrainPath vtkProjectedTetrahedraMapper vtkProjectedTexture vtkProp vtkProp3D vtkProp3DAxisFollower vtkProp3DButtonRepresentation vtkProp3DCollection vtkProp3DFollower vtkPropAssembly vtkPropItem vtkPropPicker vtkProperty2D vtkPruneTreeFilter vtkPythonAlgorithm vtkPythonArchiver vtkPythonItem vtkQImageToImageSource vtkQWidgetRepresentation vtkQWidgetTexture vtkQWidgetWidget vtkQtAbstractModelAdapter vtkQtAnnotationLayersModelAdapter vtkQtAnnotationView vtkQtConnection vtkQtDebugLeaksModel vtkQtDebugLeaksView vtkQtInitialization vtkQtLabelRenderStrategy vtkQtListView vtkQtRecordView vtkQtSQLDatabase vtkQtSQLQuery vtkQtStringToImage vtkQtTableModelAdapter vtkQtTableRepresentation vtkQtTableView vtkQtTimePointUtility vtkQtTreeModelAdapter vtkQtTreeRingLabelMapper vtkQtTreeView vtkQtView vtkQuadRotationalExtrusionFilter vtkQuadraticEdge vtkQuadraticHexahedron vtkQuadraticLinearQuad vtkQuadraticLinearWedge vtkQuadraticPolygon vtkQuadraticPyramid vtkQuadraticQuad vtkQuadraticTetra vtkQuadraticTriangle vtkQuadraticWedge vtkQuadraturePointInterpolator vtkQuadraturePointsGenerator vtkQuadratureSchemeDefinition vtkQuadratureSchemeDictionaryGenerator vtkQuadric vtkQuadricClustering vtkQuadricDecimation vtkQuadricLODActor vtkQuantizePolyDataPoints vtkQuaternion vtkQuaternionInterpolator vtkQuaterniond vtkQuaternionf vtkRIBExporter vtkRIBLight vtkRIBProperty vtkRISReader vtkROIStencilSource vtkRTXMLPolyDataReader vtkRadialGridActor2D vtkRadiusOutlierRemoval vtkRandomAttributeGenerator vtkRandomHyperTreeGridSource vtkRandomLayoutStrategy vtkRandomPool vtkRandomSequence vtkRangeHandlesItem vtkRasterReprojectionFilter vtkRayCastImageDisplayHelper vtkRayCastStructures vtkReaderAlgorithm vtkRearrangeFields vtkRecoverGeometryWireframe vtkRect vtkRectangularButtonSource vtkRectd vtkRectf vtkRecti vtkRectilinearGridAlgorithm vtkRectilinearGridClip vtkRectilinearGridGeometryFilter vtkRectilinearGridOutlineFilter vtkRectilinearGridPartitioner vtkRectilinearGridReader vtkRectilinearGridToPointSet vtkRectilinearGridWriter vtkRectilinearSynchronizedTemplates vtkRectilinearWipeRepresentation vtkRectilinearWipeWidget vtkRecursiveDividingCubes vtkRecursiveSphereDirectionEncoder vtkRedistributeDataSetFilter vtkReduceTable vtkReebGraph vtkReebGraphSimplificationFilter vtkReebGraphSimplificationMetric vtkReebGraphSurfaceSkeletonFilter vtkReebGraphToJoinSplitTreeFilter vtkReebGraphVolumeSkeletonFilter vtkReferenceCount vtkRemoteInteractionAdapter vtkRemoveDuplicatePolys vtkRemoveGhosts vtkRemoveHiddenData vtkRemoveIsolatedVertices vtkRemovePolyData vtkRemoveUnusedPoints vtkRenderLargeImage vtkRenderPass vtkRenderPassCollection vtkRenderState vtkRenderStepsPass vtkRenderTimerLog vtkRenderViewBase vtkRenderWidget vtkRenderWindowCollection vtkRenderWindowInteractor3D vtkRenderbuffer vtkRenderedAreaPicker vtkRenderedGraphRepresentation vtkRenderedHierarchyRepresentation vtkRenderedRepresentation vtkRenderedSurfaceRepresentation vtkRenderedTreeAreaRepresentation vtkRendererCollection vtkRendererDelegate vtkRendererNode vtkRendererSource vtkRenderingCellGrid vtkResampleToImage vtkResampleWithDataSet vtkReservoirSampler vtkReservoirSamplerBase vtkResizingWindowToImageFilter vtkResliceCursor vtkResliceCursorActor vtkResliceCursorLineRepresentation vtkResliceCursorPicker vtkResliceCursorPolyDataAlgorithm vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation vtkResliceCursorWidget vtkResliceImageViewer vtkResliceImageViewerMeasurements vtkResourceFileLocator vtkResourceParser vtkResourceStream vtkReverseSense vtkRotationFilter vtkRowQuery vtkRowQueryToTable vtkRungeKutta2 vtkRungeKutta4 vtkRungeKutta45 vtkSCurveSpline vtkSDL2OpenGL2RenderWindow vtkSDL2OpenGLRenderWindow vtkSDL2RenderWindowInteractor vtkSDL2WebGPURenderWindow vtkSEPReader vtkSILBuilder vtkSLACParticleReader vtkSLACReader vtkSMPContourGrid vtkSMPMergePoints vtkSMPMergePolyDataHelper vtkSMPProgressObserver vtkSMPThreadLocal vtkSMPThreadLocalAPI vtkSMPThreadLocalImpl vtkSMPThreadLocalImplAbstract vtkSMPThreadLocalObject vtkSMPThreadPool vtkSMPTools vtkSMPToolsAPI vtkSMPToolsAPIInitialize vtkSMPToolsImpl vtkSOADataArrayTemplate vtkSPHCubicKernel vtkSPHInterpolator vtkSPHKernel vtkSPHQuarticKernel vtkSPHQuinticKernel vtkSQLDatabase vtkSQLDatabaseGraphSource vtkSQLDatabaseSchema vtkSQLDatabaseTableSource vtkSQLGraphReader vtkSQLQuery vtkSQLiteDatabase vtkSQLiteDatabaseInternals vtkSQLiteQuery vtkSQLiteToTableReader vtkSSAAPass vtkSSAOPass vtkSVGContextDevice2D vtkSVGExporter vtkSampleImplicitFunctionFilter vtkScalarBarActorInternal vtkScalarBarRepresentation vtkScalarBarWidget vtkScalarTree vtkScalarsToColors vtkScalarsToColorsItem vtkScalarsToTextureFilter vtkScaledSOADataArrayTemplate vtkScaledTextActor vtkScatterPlotMatrix vtkScenePicker vtkSectorSource vtkSegYBinaryHeaderBytesPositions vtkSegYIOUtils vtkSegYReader vtkSegYReaderInternal vtkSegYTrace vtkSegYTraceHeaderBytesPositions vtkSegYTraceReader vtkSelectEnclosedPoints vtkSelectPolyData vtkSelectVisiblePoints vtkSelectionAlgorithm vtkSelectionSource vtkSelector vtkSequencePass vtkSerializer vtkServerSocket vtkShader vtkShaderProgram vtkShaderProperty vtkShadowMapBakerPass vtkShadowMapPass vtkSharedFuture vtkSharedFutureBase vtkShepardKernel vtkShepardMethod vtkShortArray vtkSignedCharArray vtkSignedDistance vtkSimple3DCirclesStrategy vtkSimpleBondPerceiver vtkSimpleCellTessellator vtkSimpleElevationFilter vtkSimpleImageToImageFilter vtkSimpleMotionBlurPass vtkSimpleReader vtkSimpleScalarTree vtkSingleVTPExporter vtkSkybox vtkSliceAndDiceLayoutStrategy vtkSliceCubes vtkSliderRepresentation3D vtkSmartPointer vtkSmartPointerBase vtkSmartVector vtkSmartVolumeMapper vtkSmoothErrorMetric vtkSobelGradientMagnitudePass vtkSocket vtkSocketCollection vtkSocketCommunicator vtkSocketController vtkSortDataArray vtkSortFieldData vtkSortFileNames vtkSpanSpace vtkSpanTreeLayoutStrategy vtkSparseArray vtkSparseArrayToTable vtkSpatialRepresentationFilter vtkSpatioTemporalHarmonicsAttribute vtkSpatioTemporalHarmonicsSource vtkSphereHandleRepresentation vtkSpherePuzzle vtkSpherePuzzleArrows vtkSphereRepresentation vtkSphereTree vtkSphereTreeFilter vtkSphereWidget vtkSphereWidget2 vtkSpheres vtkSphericalDirectionEncoder vtkSphericalHarmonics vtkSphericalPointIterator vtkSphericalTransform vtkSpiderPlotActor vtkSpline vtkSplineFilter vtkSplineGraphEdges vtkSplineRepresentation vtkSplineWidget vtkSplitByCellScalarFilter vtkSplitColumnComponents vtkSplitField vtkSplitSharpEdgesPolyData vtkSquarifyLayoutStrategy vtkStackedTreeLayoutStrategy vtkStateStorage vtkStaticCellLinks vtkStaticCellLinksTemplate vtkStaticCellLocator vtkStaticCleanPolyData vtkStaticCleanUnstructuredGrid vtkStaticCompositeSource vtkStaticDataSource vtkStaticEdgeLocatorTemplate vtkStaticFaceHashLinksTemplate vtkStaticPointLocator vtkStaticPointLocator2D vtkStatisticalOutlierRemoval vtkStatisticsAlgorithm vtkStatisticsAlgorithmPrivate vtkStdString vtkStereoCompositor vtkStitchImageDataWithGhosts vtkStrahlerMetric vtkStreaklineFilter vtkStreamGraph vtkStreamSurface vtkStreamTracer vtkStreamerBase vtkStreamingDemandDrivenPipeline vtkStreamingStatistics vtkStreamingTessellator vtkStringArray vtkStringOutputWindow vtkStringToCategory vtkStringToImage vtkStringToNumeric vtkStringToken vtkStructuredAMRGridConnectivity vtkStructuredAMRNeighbor vtkStructuredCellArray vtkStructuredData vtkStructuredDataPlaneCutter vtkStructuredExtent vtkStructuredGridAlgorithm vtkStructuredGridAppend vtkStructuredGridClip vtkStructuredGridConnectivity vtkStructuredGridLIC2D vtkStructuredGridPartitioner vtkStructuredGridReader vtkStructuredGridWriter vtkStructuredImplicitConnectivity vtkStructuredNeighbor vtkStructuredPointArray vtkStructuredPointBackend vtkStructuredPointsCollection vtkStructuredPointsGeometryFilter vtkStructuredPointsWriter vtkStructuredTPointBackend vtkSubCommunicator vtkSubGroup vtkSubPixelPositionEdgels vtkSubdivideTetra vtkSubdivisionFilter vtkSurfaceLICComposite vtkSurfaceLICHelper vtkSurfaceLICInterface vtkSurfaceLICMapper vtkSurfaceNets2D vtkSurfaceNets3D vtkSurfaceReconstructionFilter vtkSynchronizeTimeFilter vtkSynchronizedRenderWindows vtkSynchronizedRenderers vtkSynchronizedTemplates2D vtkSynchronizedTemplates3D vtkSynchronizedTemplatesCutter3D vtkSystemIncludes vtkTDxInteractorStyle vtkTDxInteractorStyleCamera vtkTDxInteractorStyleSettings vtkTDxMotionEventInfo vtkTDxQtUnixDevices vtkTGAReader vtkTIFFReaderInternal vtkTRUCHASReader vtkTable vtkTableAlgorithm vtkTableBasedClipCases vtkTableBasedClipDataSet vtkTableFFT vtkTableReader vtkTableToArray vtkTableToDatabaseWriter vtkTableToGraph vtkTableToMySQLWriter vtkTableToPolyData vtkTableToPostgreSQLWriter vtkTableToSQLiteWriter vtkTableToSparseArray vtkTableToStructuredGrid vtkTableToTreeFilter vtkTableWriter vtkTanglegramItem vtkTclCommand vtkTecplotReader vtkTecplotTableReader vtkTemplateAliasMacro vtkTemporalAlgorithm vtkTemporalArrayOperatorFilter vtkTemporalDataSetCache vtkTemporalDelimitedTextReader vtkTemporalFractal vtkTemporalInterpolatedVelocityField vtkTemporalInterpolator vtkTemporalPathLineFilter vtkTemporalShiftScale vtkTemporalSnapToTimeStep vtkTemporalStatistics vtkTensorGlyph vtkTensorPrincipalInvariants vtkTensorProbeRepresentation vtkTensorProbeWidget vtkTensorRepresentation vtkTensorWidget vtkTerrainContourLineInterpolator vtkTerrainDataPointPlacer vtkTessellatedBoxSource vtkTessellatorFilter vtkTestDataArray vtkTestNewVar vtkTextActor3D vtkTextCodec vtkTextCodecFactory vtkTextPropertyCollection vtkTextRenderer vtkTextRendererCleanup vtkTextRendererStringToImage vtkTextSource vtkTextureIO vtkTextureImageCache vtkTextureMapToCylinder vtkTextureMapToPlane vtkTextureMapToSphere vtkTextureObject vtkTextureUnitManager vtkTexturedActor2D vtkTexturedButtonRepresentation vtkTexturedButtonRepresentation2D vtkThreadedCallbackQueue vtkThreadedCompositeDataPipeline vtkThreadedImageAlgorithm vtkThreadedImageWriter vtkThreadedTaskQueue vtkThresholdGraph vtkThresholdTable vtkThresholdTextureCoords vtkTimeInformation vtkTimePointUtility vtkTimeRange vtkTimeSource vtkTimeStamp vtkTimerLogCleanup vtkTimerLogScope vtkToAffineArrayStrategy vtkToConstantArrayStrategy vtkToImplicitArrayFilter vtkToImplicitRamerDouglasPeuckerStrategy vtkToImplicitStrategy vtkToImplicitTypeErasureStrategy vtkToneMappingPass vtkTooltipItem vtkTransferAttributes vtkTransform2D vtkTransformCollection vtkTransformConcatenation vtkTransformConcatenationStack vtkTransformCoordinateSystems vtkTransformFeedback vtkTransformInterpolator vtkTransformPair vtkTransformToGrid vtkTranslucentPass vtkTransmitImageDataPiece vtkTransmitPolyDataPiece vtkTransmitRectilinearGridPiece vtkTransmitStructuredDataPiece vtkTransmitStructuredGridPiece vtkTransmitUnstructuredGridPiece vtkTransposeMatrix vtkTransposeTable vtkTree vtkTreeAlgorithm vtkTreeAreaView vtkTreeBFSIterator vtkTreeCompositer vtkTreeDFSIterator vtkTreeDifferenceFilter vtkTreeFieldAggregator vtkTreeHeatmapItem vtkTreeIterator vtkTreeLayoutStrategy vtkTreeLevelsFilter vtkTreeMapLayout vtkTreeMapLayoutStrategy vtkTreeMapToPolyData vtkTreeMapView vtkTreeOrbitLayoutStrategy vtkTreeReader vtkTreeRingToPolyData vtkTreeRingView vtkTreeWriter vtkTriQuadraticHexahedron vtkTriQuadraticPyramid vtkTriangleMeshPointNormals vtkTriangularTCoords vtkTriangularTexture vtkTrimmedExtrusionFilter vtkTrivialConsumer vtkTrivialProducer vtkTryDowncastHelper1 vtkTryDowncastHelper2 vtkTryDowncastHelper3 vtkTubeBender vtkTulipReader vtkTuple vtkTupleInterpolator vtkTypeList vtkTypedArray vtkTypedDataArray vtkTypedDataArrayIterator vtkURI vtkURIComponent vtkURILoader vtkUTF16TextCodec vtkUTF8TextCodec vtkUncertaintyTubeFilter vtkUndirectedGraph vtkUndirectedGraphAlgorithm vtkUniformGrid vtkUniformGridAMR vtkUniformGridAMRAlgorithm vtkUniformGridAMRDataIterator vtkUniformGridPartitioner vtkUniformHyperTreeGrid vtkUniformHyperTreeGridSource vtkUniforms vtkUnsignedDistance vtkUnsignedIntArray vtkUnsignedLongArray vtkUnsignedLongLongArray vtkUnsignedShortArray vtkUnstructuredGridAlgorithm vtkUnstructuredGridBase vtkUnstructuredGridBaseAlgorithm vtkUnstructuredGridBunykRayCastFunction vtkUnstructuredGridCellIterator vtkUnstructuredGridGeometryFilter vtkUnstructuredGridHomogeneousRayIntegrator vtkUnstructuredGridLinearRayIntegrator vtkUnstructuredGridPartialPreIntegration vtkUnstructuredGridPreIntegration vtkUnstructuredGridQuadricDecimation vtkUnstructuredGridReader vtkUnstructuredGridToCellGrid vtkUnstructuredGridToExplicitStructuredGrid vtkUnstructuredGridToReebGraphFilter vtkUnstructuredGridVolumeMapper vtkUnstructuredGridVolumeRayCastFunction vtkUnstructuredGridVolumeRayCastIterator vtkUnstructuredGridVolumeRayCastMapper vtkUnstructuredGridVolumeRayIntegrator vtkUnstructuredGridVolumeZSweepMapper vtkUnstructuredGridWriter vtkUpdateCellsV8toV9 vtkVASPAnimationReader vtkVASPTessellationReader vtkVPICReader vtkVRCamera vtkVRCollaborationClient vtkVRControlsHelper vtkVRFollower vtkVRHMDCamera vtkVRHardwarePicker vtkVRInteractorStyle vtkVRMLExporter vtkVRMLUseStruct vtkVRMLYaccData vtkVRMenuRepresentation vtkVRMenuWidget vtkVRModel vtkVRPanelRepresentation vtkVRPanelWidget vtkVRRay vtkVRRenderWindow vtkVRRenderWindowInteractor vtkVRRenderer vtkValuePass vtkValueSelector vtkVariant vtkVariantArray vtkVariantBoostSerialization vtkVariantCast vtkVariantCreate vtkVariantExtract vtkVector vtkVector2 vtkVector2d vtkVector2f vtkVector2i vtkVector3 vtkVector3d vtkVector3f vtkVector3i vtkVector4 vtkVector4d vtkVector4i vtkVectorDot vtkVectorFieldTopology vtkVectorNorm vtkVeraOutReader vtkVersion vtkVertexAdjacencyList vtkVertexDegree vtkVertexListIterator vtkVideoSource vtkView vtkViewDependentErrorMetric vtkViewNode vtkViewNodeFactory vtkViewTheme vtkViewUpdater vtkViewport vtkVisibilitySort vtkVoidArray vtkVolume16Reader vtkVolumeCollection vtkVolumeContourSpectrumFilter vtkVolumeInputHelper vtkVolumeMapper vtkVolumeMapperNode vtkVolumeMask vtkVolumeNode vtkVolumeOfRevolutionFilter vtkVolumeOutlineSource vtkVolumePicker vtkVolumeRayCastSpaceLeapingImageFilter vtkVolumeReader vtkVolumeStateRAII vtkVolumeTexture vtkVolumetricPass vtkVoronoi2D vtkVoronoiKernel vtkVortexCore vtkVoxel vtkVoxelContoursToSurfaceFilter vtkVoxelGrid vtkVoxelModeller vtkVtkJSSceneGraphSerializer vtkVtkJSViewNodeFactory vtkWGPUContext vtkWarpLens vtkWarpScalar vtkWarpTransform vtkWarpVector vtkWasmSceneManager vtkWeakPointer vtkWeakPointerBase vtkWeakReference vtkWebApplication vtkWebAssemblyRenderWindowInteractor vtkWebGLDataSet vtkWebGLExporter vtkWebGLObject vtkWebGLPolyData vtkWebGLWidget vtkWebGPUActor vtkWebGPUCamera vtkWebGPUClearPass vtkWebGPUHardwareSelector vtkWebGPUInternalsBindGroup vtkWebGPUInternalsBindGroupLayout vtkWebGPUInternalsBuffer vtkWebGPUInternalsPipelineLayout vtkWebGPUInternalsRenderPassCreateInfo vtkWebGPUInternalsRenderPassDescriptor vtkWebGPUInternalsRenderPipelineDescriptor vtkWebGPUInternalsShaderModule vtkWebGPULight vtkWebGPUPolyDataMapper vtkWebGPUProperty vtkWebGPURenderPass vtkWebGPURenderWindow vtkWebGPURenderer vtkWebInteractionEvent vtkWebUtilities vtkWedge vtkWeightedTransformFilter vtkWendlandQuinticKernel vtkWidgetCallbackMapper vtkWidgetEvent vtkWidgetEventTranslator vtkWidgetRepresentation vtkWidgetSet vtkWin32HardwareWindow vtkWin32Header vtkWin32OpenGL2RenderWindow vtkWin32OpenGLDXRenderWindow vtkWin32OpenGLRenderWindow vtkWin32OutputWindow vtkWin32ProcessOutputWindow vtkWin32RenderWindowInteractor vtkWin32VideoSource vtkWindBladeReader vtkWindow vtkWindowLevelLookupTable vtkWindowNode vtkWindowedSincPolyDataFilter vtkWordCloud vtkWorldPointPicker vtkWrappingHints vtkWriter vtkX3DExporter vtkX3DExporterFIWriter vtkX3DExporterFIWriterHelper vtkX3DExporterWriter vtkX3DExporterXMLWriter vtkXGMLReader vtkXMLCompositeDataReader vtkXMLCompositeDataSetWriterHelper vtkXMLCompositeDataWriter vtkXMLDataElement vtkXMLDataHeader vtkXMLDataHeaderImpl vtkXMLDataObjectWriter vtkXMLDataParser vtkXMLDataReader vtkXMLDataSetWriter vtkXMLDataWriterHelper vtkXMLFileOutputWindow vtkXMLFileReadTester vtkXMLGenericDataObjectReader vtkXMLHierarchicalBoxDataFileConverter vtkXMLHierarchicalBoxDataReader vtkXMLHierarchicalBoxDataWriter vtkXMLHierarchicalDataReader vtkXMLHyperTreeGridReader vtkXMLHyperTreeGridWriter vtkXMLImageDataReader vtkXMLImageDataWriter vtkXMLMultiBlockDataReader vtkXMLMultiBlockDataWriter vtkXMLMultiGroupDataReader vtkXMLPDataObjectReader vtkXMLPDataObjectWriter vtkXMLPDataReader vtkXMLPDataSetWriter vtkXMLPDataWriter vtkXMLPHierarchicalBoxDataWriter vtkXMLPHyperTreeGridReader vtkXMLPHyperTreeGridWriter vtkXMLPImageDataReader vtkXMLPMultiBlockDataWriter vtkXMLPPolyDataReader vtkXMLPPolyDataWriter vtkXMLPRectilinearGridReader vtkXMLPRectilinearGridWriter vtkXMLPStructuredDataReader vtkXMLPStructuredDataWriter vtkXMLPStructuredGridReader vtkXMLPStructuredGridWriter vtkXMLPTableReader vtkXMLPTableWriter vtkXMLPUniformGridAMRWriter vtkXMLPUnstructuredDataReader vtkXMLPUnstructuredDataWriter vtkXMLPUnstructuredGridReader vtkXMLParser vtkXMLPartitionedDataSetCollectionReader vtkXMLPartitionedDataSetCollectionWriter vtkXMLPartitionedDataSetReader vtkXMLPartitionedDataSetWriter vtkXMLReader vtkXMLReaderVersion vtkXMLRectilinearGridWriter vtkXMLStructuredDataReader vtkXMLStructuredDataWriter vtkXMLTableReader vtkXMLTableWriter vtkXMLTreeReader vtkXMLUniformGridAMRReader vtkXMLUniformGridAMRWriter vtkXMLUnstructuredDataReader vtkXMLUnstructuredDataWriter vtkXMLUtilities vtkXMLWriter vtkXMLWriter2 vtkXMLWriterBase vtkXOpenGLRenderWindow vtkXRenderWindowInteractor vtkXWebGPURenderWindow vtkXYPlotActor vtkXYPlotRepresentation vtkXYPlotWidget vtkXYZMolReader vtkXYZMolReader2 vtkXdmf3ArrayKeeper vtkXdmf3ArraySelection vtkXdmf3DataSet vtkXdmf3HeavyDataHandler vtkXdmf3LightDataHandler vtkXdmf3Reader vtkXdmf3SILBuilder vtkXdmf3Writer vtkXdmfArraySelection vtkXdmfDataArray vtkXdmfDocument vtkXdmfDomain vtkXdmfHeavyData vtkXdmfReader vtkXdmfReaderInternal vtkXdmfWriter vtkYieldCriteria vtkYoungsMaterialInterface vtkZLibDataCompressor vtkZSpaceCamera vtkZSpaceCoreCompatibilitySDKManager vtkZSpaceCoreSDKManager vtkZSpaceGenericRenderWindow vtkZSpaceHardwarePicker vtkZSpaceInteractorStyle vtkZSpaceRayActor vtkZSpaceRenderWindowInteractor vtkZSpaceRenderer vtkZSpaceSDKManager vtkZSpaceWin32RenderWindow vtkmAverageToCells vtkmAverageToPoints vtkmCleanGrid vtkmClip vtkmContour vtkmCoordinateSystemTransform vtkmDataArray vtkmDataSet vtkmExternalFaces vtkmExtractVOI vtkmFilterOverrides vtkmGradient vtkmHistogram vtkmImageConnectivity vtkmLevelOfDetail vtkmNDHistogram vtkmPointElevation vtkmPointTransform vtkmPolyDataNormals vtkmProbe vtkmSlice vtkmThreshold vtkmTriangleMeshPointNormals vtkmWarpScalar vtkmWarpVector"},{"location":"Java/Coverage/JavaVTKClassesUsed/","title":"VTK Classes used in the Examples","text":""},{"location":"Java/Coverage/JavaVTKClassesUsed/#java","title":"Java","text":"

        Out of 3113 available VTK classes, 273 are demonstrated here.

        "},{"location":"Java/Coverage/JavaVTKClassesUsed/#excluded-classes","title":"Excluded classes","text":"

        These classes are excluded since they occur in the majority of the examples:

        VTK Class VTK Class VTK Class vtkActor vtkCamera vtkNamedColors vtkPolyDataMapper vtkProperty vtkRenderer vtkRenderWindow vtkRenderWindowInteractor"},{"location":"Java/Coverage/JavaVTKClassesUsed/#classes-used","title":"Classes used","text":"VTK Class Examples vtk3DSImporter ThreeDSImporter vtkActor2D Actor2D MultiLineText ThinPlateSplineTransform vtkActorCollection ThreeDSImporter VRMLImporter vtkAngleRepresentation2D AngleWidget2D vtkAngleWidget AngleWidget AngleWidget2D vtkAnnotatedCubeActor AnnotatedCubeActor vtkAnnotationLink SelectGraphVertices vtkAppendPolyData AnimDataCone BlobbyLogo ColorDisconnectedRegions ImplicitSphere vtkArrowSource Arrow BrownianPoints DistanceToCamera OrientedArrow OrientedGlyphs TransformFilter VectorFieldExample vtkAssembly Assembly vtkAxes TextOrigin vtkAxesActor DisplayCoordinateAxes vtkBalloonRepresentation BalloonWidget vtkBalloonWidget BalloonWidget vtkBMPReader ReadBMP ThinPlateSplineTransform vtkBoundedPointSource FitImplicitFunction vtkBoxWidget Cone6 vtkBrownianPoints BrownianPoints vtkCameraActor CameraActor vtkCaptionRepresentation CaptionWidget vtkCaptionWidget CaptionWidget vtkCellArray AddCell Bottle EllipticalCylinder ImplicitSphere LongLine MultiLineText Polygon Pyramid Quad RibbonFilter RuledSurfaceFilter Spring Triangle TriangleColoredPoints TriangleStrip Vertex WriteVTU vtkCellCenters CellCenters vtkCellPicker SwingHandleMouseEvent vtkCenterOfMass CenterOfMass vtkCMLMoleculeReader ReadCML vtkColorSeries ScalarBarActorColorSeries vtkColorTransferFunction MedicalDemo4 SimpleRayCast vtkCompassRepresentation CompassWidget vtkCompassWidget CompassWidget vtkCompositeDataDisplayAttributes CompositePolyDataMapper vtkCompositePolyDataMapper2 CompositePolyDataMapper vtkCone IceCream RandomProbe vtkConeSource AnimDataCone Cone Cone6 Mace PickableOff Reflection ReportRenderWindowCapabilities RotationAroundLine SpikeFran TrackballActor TrackballCamera vtkContourFilter BlobbyLogo IceCream PerlinNoise ReadSLC SampleFunction Vol vtkConvexPointSet ConvexPointSet vtkCoordinate MultiLineText vtkCornerAnnotation CornerAnnotation vtkCubeAxesActor CubeAxesActor vtkCubeAxesActor2D CubeAxesActor2D vtkCubeSource Assembly Cutter Follower Glyph3D Legend Opacity ShrinkCube SideBySideViewports VectorFieldExample vtkCursor2D Cursor2D vtkCursor3D Cursor3D vtkCutter Cutter vtkCylinderSource CylinderExample OrientedCylinder TransformPipeline vtkDataRepresentation SelectGraphVertices vtkDataSetMapper BlankPoint CellCenters ConvexHullShrinkWrap ConvexPointSet Frustum HyperTreeGridSource LoopShrink OrientationMarkerWidget Pyramid RandomProbe ReadPolyData ReadRectilinearGrid RectilinearGrid Reflection ShrinkCube VisualizeImageData VisualizeRectilinearGrid WriteVTU vtkDelaunay2D Delaunay2D DelaunayMesh vtkDelaunay3D XMLPUnstructuredGridWriter vtkDEMReader DEMReader vtkDICOMImageReader ReadDICOM vtkDiscretizableColorTransferFunction DiscretizableColorTransferFunction vtkDiskSource BoundaryEdges Disk vtkDistanceToCamera DistanceToCamera vtkDistanceWidget DistanceWidget vtkDoubleArray GeoAssignCoordinates MeshQuality RectilinearGrid RectilinearGridToTetrahedra VisualizeRectilinearGrid Vol vtkEarthSource EarthSource vtkElevationFilter ColoredSphere LoopShrink ProjectSphere vtkExodusIIWriter ExodusIIWriter vtkExtractEdges DelaunayMesh vtkExtractVOI ReadSLC vtkFeatureEdges BoundaryEdges vtkFitImplicitFunction FitImplicitFunction vtkFixedPointVolumeRayCastMapper MedicalDemo4 SimpleRayCast vtkFloatArray ColorCells KnownLengthArray ScalarBarActor ScalarBarActorColorSeries UnknownLengthArray vtkFollower Follower TextOrigin vtkFrustumSource Frustum vtkFunctionParser FunctionParser vtkGlyph2D Glyph2D vtkGlyph3D BrownianPoints ConvexHullShrinkWrap DelaunayMesh DistanceToCamera FitImplicitFunction Glyph3D Mace OrientedGlyphs RandomProbe SpikeFran VectorFieldExample vtkGlyph3DMapper ConvexPointSet KochanekSpline vtkGraphLayoutView GraphPoints RandomGraphSource SelectGraphVertices VisualizeGraph vtkGraphMapper GeoAssignCoordinates vtkHedgeHog ComplexV vtkHyperTreeGridSource HyperTreeGridSource vtkIdTypeArray SelectGraphVertices vtkImageActor Cast DEMReader Flip ImageFFT ImageNormalize ImageOrientation ImageTest ImageWeightedSum MedicalDemo3 RTAnalyticSource WritePNM WriteTIFF vtkImageBlend ThinPlateSplineTransform vtkImageCanvasSource2D JPEGWriter LogoWidget OggTheora ShotNoise WritePNM WriteTIFF XMLPImageDataWriter vtkImageCast Cast Flip ImageFFT ImageNormalize ImageWeightedSum vtkImageData CellCenters VisualizeImageData vtkImageDataGeometryFilter StructuredPointsReader vtkImageEllipsoidSource ImageFFT ImageOrientation vtkImageFFT ImageFFT vtkImageFlip Flip vtkImageGridSource ThinPlateSplineTransform vtkImageMandelbrotSource Cast Flip ImageWeightedSum vtkImageMapper ThinPlateSplineTransform vtkImageMapToColors DEMReader MedicalDemo3 ThinPlateSplineTransform vtkImageNormalize ImageNormalize vtkImagePermute ImageOrientation vtkImagePlaneWidget ImagePlaneWidget vtkImageReader2 ImageTest StaticImage TexturedSphere TexturePlane vtkImageReader2Factory ImageTest StaticImage TexturedSphere TexturePlane vtkImageReslice ThinPlateSplineTransform vtkImageSinusoidSource ImageNormalize ImageSinusoidSource ImageWeightedSum vtkImageTracerWidget ImageTracerWidgetNonPlanar vtkImageViewer2 ImageSinusoidSource JPEGReader PNGReader ReadBMP ReadDICOM ReadPNM ReadTIFF StaticImage vtkImageWeightedSum ImageWeightedSum vtkImplicitBoolean IceCream vtkImplicitDataSet ImplicitDataSet vtkImplicitModeller BlobbyLogo vtkInteractorObserver ImageTest vtkInteractorStyle Follower vtkInteractorStyleImage Cast DEMReader Flip Glyph2D Glyph3D ImageFFT ImageOrientation ImageTest RTAnalyticSource WritePNM WriteTIFF vtkInteractorStyleRubberBandPick RubberBandPick vtkInteractorStyleRubberBandZoom RubberBandZoom vtkInteractorStyleSwitch ProteinRibbons StyleSwitch vtkInteractorStyleTerrain InteractorStyleTerrain ThinPlateSplineTransform vtkInteractorStyleTrackball ImageTracerWidgetNonPlanar vtkInteractorStyleTrackballActor MoveActor TrackballActor vtkInteractorStyleTrackballCamera AnimDataCone Cone6 DistanceToCamera ImagePlaneWidget JFrameRenderer MoveCamera MultipleActors SwingHandleMouseEvent TrackballCamera vtkJPEGReader JPEGReader vtkJPEGWriter JPEGWriter vtkKdTreePointLocator VisualizeKDTree vtkKochanekSpline KochanekSpline vtkLegendBoxActor Legend vtkLegendScaleActor LegendScaleActor vtkLight AmbientSpheres LightActor SpecularSpheres SpotLight vtkLightActor LightActor vtkLine LongLine RuledSurfaceFilter vtkLinearExtrusionFilter EllipticalCylinder vtkLineSource Line LineWidth TubeFilter WarpTo vtkLODActor CubeAxesActor2D vtkLogoRepresentation LogoWidget vtkLogoWidget LogoWidget vtkLookupTable ColorCells ColorLookupTable ComplexV DEMReader MedicalDemo3 ScalarBarActor ScalarBarActorColorSeries ThinPlateSplineTransform vtkMarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 vtkMaskPoints SpikeFran vtkMath BrownianPoints ColorCellsWithRGB DistanceBetweenPoints FitImplicitFunction NormalizeVector OrientedArrow OrientedCylinder RibbonFilter vtkMatrix3x3 MatrixInverse MatrixTranspose vtkMatrix4x4 OrientedArrow OrientedCylinder PerspectiveTransform vtkMeshQuality MeshQuality vtkMetaImageReader MedicalDemo1 MedicalDemo2 MedicalDemo3 MedicalDemo4 vtkMinimalStandardRandomSequence DelaunayMesh OrientedArrow OrientedCylinder RandomSequence vtkMoleculeMapper ReadCML vtkMultiBlockDataSet CompositePolyDataMapper vtkMultiBlockPLOT3DReader ReadPLOT3D vtkMutableDirectedGraph GeoAssignCoordinates vtkMutableUndirectedGraph GraphPoints VisualizeGraph vtkObject VectorFieldExample vtkOBJReader ReadOBJ vtkOctreePointLocator BuildOctree vtkOggTheoraWriter OggTheora vtkOrientationMarkerWidget DisplayCoordinateAxes OrientationMarkerWidget vtkOutlineFilter ComplexV CubeAxesActor2D MedicalDemo1 MedicalDemo2 MedicalDemo3 Outline ReadSLC SampleFunction vtkParametricFigure8Klein ParametricObjects vtkParametricFunctionSource KochanekSpline ParametricObjects ProjectSphere vtkParametricSpline KochanekSpline vtkParametricSuperEllipsoid ProjectSphere vtkParticleReader ParticleReader vtkPassThrough PassThrough vtkPDBReader ProteinRibbons vtkPerlinNoise PerlinNoise vtkPerspectiveTransform PerspectiveTransform vtkPiecewiseFunction MedicalDemo4 PiecewiseFunction SimpleRayCast vtkPlane Cutter IceCream ProjectPointPlane vtkPlanes Frustum vtkPlanesIntersection PlanesIntersection vtkPlaneSource ColorCells ColorCellsWithRGB SpotLight TexturePlane vtkPlaneWidget PlaneWidget vtkPlatonicSolidSource CubeAxesActor2D vtkPLYReader ReadPLY WritePLY vtkPLYWriter ConvertFile WritePLY vtkPNGReader PNGReader vtkPNGWriter Cone6 Screenshot ShotNoise vtkPNMReader ReadPNM WritePNM vtkPNMWriter WritePNM vtkPointHandleRepresentation2D SeedWidget vtkPoints Actor2D AddCell AnimDataCone BlankPoint Bottle BuildOctree CenterOfMass ColoredPoints ConvexPointSet Delaunay2D DelaunayMesh EllipticalCylinder Glyph2D Glyph3D GraphPoints ImplicitSphere KochanekSpline LongLine MultiLineText PlanesIntersection Polygon Pyramid Quad RibbonFilter RuledSurfaceFilter Spring StructuredGridOutline StructuredPointsToUnstructuredGrid ThinPlateSplineTransform Triangle TriangleColoredPoints TriangleStrip Vertex VertexGlyphFilter WriteVTP WriteVTU XMLStructuredGridWriter vtkPointSource ConvexHullShrinkWrap DistanceToCamera KochanekSpline RandomProbe ScalarVisibility VisualizeKDTree vtkPolyData Actor2D AddCell AnimDataCone Bottle BuildOctree CenterOfMass ColoredPoints ConvexPointSet Delaunay2D DelaunayMesh EllipticalCylinder Glyph2D Glyph3D ImplicitSphere KochanekSpline Legend LongLine MeshQuality MultiLineText OrientedGlyphs Polygon ProjectSphere Quad RibbonFilter RuledSurfaceFilter ScalarBarActor ScalarBarActorColorSeries Spring Triangle TriangleColoredPoints TriangleStrip VectorFieldExample Vertex VertexGlyphFilter VisualizeKDTree WriteVTP vtkPolyDataConnectivityFilter ColorDisconnectedRegions vtkPolyDataMapper2D Actor2D MultiLineText vtkPolyDataNormals BlobbyLogo CubeAxesActor2D SpikeFran Spring vtkPolyDataReader BlobbyLogo SpikeFran vtkPolygon Polygon vtkPolyLine EllipticalCylinder vtkProbeFilter RandomProbe vtkProjectSphereFilter ProjectSphere vtkPropCollection Assembly vtkProteinRibbonFilter ProteinRibbons vtkPyramid Pyramid vtkQuad Quad vtkRandomGraphSource RandomGraphSource SelectGraphVertices vtkRectilinearGrid RectilinearGrid RectilinearGridToTetrahedra VisualizeRectilinearGrid vtkRectilinearGridToTetrahedra RectilinearGridToTetrahedra vtkReflectionFilter Reflection vtkRegularPolygonSource BalloonWidget Circle Glyph2D RegularPolygonSource vtkRenderView RenderView vtkRibbonFilter RibbonFilter vtkRotationalExtrusionFilter Bottle Spring vtkRTAnalyticSource ImplicitDataSet RTAnalyticSource vtkRuledSurfaceFilter RuledSurfaceFilter vtkSampleFunction IceCream PerlinNoise RandomProbe SampleFunction vtkScalarBarActor ScalarBarActor ScalarBarActorColorSeries vtkSeedRepresentation SeedWidget vtkSeedWidget SeedWidget vtkSelection SelectGraphVertices vtkSelectionNode SelectGraphVertices vtkShrinkFilter Frustum HyperTreeGridSource LoopShrink ShrinkCube VisualizeRectilinearGrid vtkShrinkPolyData RegularPolygonSource vtkSimple2DLayoutStrategy VisualizeGraph vtkSimplePointsReader SimplePointsReader vtkSimplePointsWriter SimplePointsWriter vtkSLCReader ReadSLC vtkSliderRepresentation VisualizeKDTree vtkSliderRepresentation2D VisualizeKDTree vtkSliderWidget VisualizeKDTree vtkSmoothPolyDataFilter ConvexHullShrinkWrap vtkSphere FitImplicitFunction IceCream vtkSphereSource AmbientSpheres Animation Assembly BackfaceCulling BackgroundColor BackgroundGradient BalloonWidget BrownianPoints Camera CameraActor CaptionWidget ColorActorEdges ColorAnActor ColorDisconnectedRegions ColoredSphere CompassWidget CompositePolyDataMapper ConvexHullShrinkWrap ConvexPointSet CornerAnnotation Cursor2D Cursor3D CursorShape DelaunayMesh DisplayCoordinateAxes DistanceToCamera DrawText FitImplicitFunction FullScreen ImagePlaneWidget ImageTracerWidgetNonPlanar ImplicitSphere InteractorStyleTerrain JFrameRenderer KochanekSpline Legend LegendScaleActor LogoWidget LoopShrink Mace MeshQuality MoveActor MoveCamera MultipleActors MultipleViewports NoShading Opacity OrientedArrow OrientedCylinder OrientedGlyphs Outline PassThrough PlanesIntersection RandomProbe RenderView RubberBandPick RubberBandZoom ScalarBarActor ScalarBarActorColorSeries Screenshot SeedWidget SideBySideViewports SimplePointsWriter SpecularSpheres Stripper StyleSwitch SwingHandleMouseEvent TextWidget TrackballActor TrackballCamera TransformPolyData WindowSize WireframeSphere WritePLY WriteSTL XMLPUnstructuredGridWriter vtkSplineWidget2 SplineWidget vtkSTLReader ReadSTL WriteSTL vtkSTLWriter WriteSTL vtkStripper Bottle MedicalDemo2 MedicalDemo3 Stripper vtkStructuredGrid BlankPoint StructuredGridOutline XMLStructuredGridWriter vtkStructuredGridGeometryFilter ReadPLOT3D ReadStructuredGrid vtkStructuredGridOutlineFilter StructuredGridOutline vtkStructuredPoints StructuredPointsToUnstructuredGrid Vol vtkStructuredPointsReader ComplexV SimpleRayCast StructuredPointsReader vtkSuperquadric SampleFunction vtkSuperquadricSource CubeAxesActor OrientationMarkerWidget vtkTetra WriteVTU vtkTextActor DrawText TextActor TextWidget vtkTextMapper MultiLineText vtkTextProperty CubeAxesActor2D MultiLineText vtkTextRepresentation TextWidget vtkTexture TexturedSphere TexturePlane vtkTexturedSphereSource TexturedSphere vtkTextWidget TextWidget vtkThinPlateSplineTransform ThinPlateSplineTransform vtkThreshold RandomProbe vtkThresholdPoints RandomProbe VectorFieldExample vtkTIFFReader ReadTIFF WriteTIFF vtkTIFFWriter WriteTIFF vtkTimerLog TimerLog vtkTimeSourceExample ExodusIIWriter vtkTransform AnimDataCone Assembly BlobbyLogo Cone6 OrientedArrow OrientedCylinder PerspectiveTransform RotationAroundLine SpikeFran TransformFilter TransformPipeline TransformPolyData vtkTransformFilter TransformFilter vtkTransformPolyDataFilter BlobbyLogo OrientedArrow OrientedCylinder RotationAroundLine SpikeFran TransformPolyData vtkTransformTextureCoords TexturedSphere vtkTriangle AddCell Triangle TriangleColoredPoints vtkTriangleFilter MeshQuality vtkTriangleStrip TriangleStrip vtkTubeFilter Bottle DelaunayMesh ImplicitSphere TubeFilter WarpTo vtkUnsignedCharArray ColorCellsWithRGB ColoredPoints TriangleColoredPoints vtkUnstructuredGrid ConvexPointSet Pyramid StructuredPointsToUnstructuredGrid VectorFieldExample WriteVTU vtkVectorText Follower TextOrigin vtkVertex Vertex vtkVertexGlyphFilter Actor2D ColoredPoints Delaunay2D VertexGlyphFilter vtkVolume MedicalDemo4 SimpleRayCast vtkVolumeProperty MedicalDemo4 SimpleRayCast vtkVRMLImporter VRMLImporter vtkWarpTo WarpTo vtkWindowToImageFilter Cone6 Screenshot vtkXMLPImageDataWriter XMLPImageDataWriter vtkXMLPolyDataReader ConvertFile OrientationMarkerWidget ReadPolyData ReadVTP RotationAroundLine VisualizeVTP vtkXMLPolyDataWriter RotationAroundLine WriteVTP vtkXMLPUnstructuredGridWriter XMLPUnstructuredGridWriter vtkXMLRectilinearGridReader ReadRectilinearGrid vtkXMLStructuredGridReader ReadStructuredGrid vtkXMLStructuredGridWriter XMLStructuredGridWriter vtkXMLUnstructuredGridReader VectorFieldExample WriteVTU vtkXMLUnstructuredGridWriter RectilinearGridToTetrahedra StructuredPointsToUnstructuredGrid WriteVTU"},{"location":"Java/DataStructures/BuildOctree/","title":"BuildOctree","text":"

        vtk-examples/Java/DataStructures/BuildOctree

        "},{"location":"Java/DataStructures/BuildOctree/#description","title":"Description","text":"

        Given a vtkDataSet, create an octree that is locally refined such that all leaf octants contain less than a certain amount of points.

        Note that there is no size constraint that a leaf octant in relation to any of its neighbors.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/DataStructures/BuildOctree/#code","title":"Code","text":"

        BuildOctree.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkOctreePointLocator;\npublic class BuildOctree \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //  Setup point coordinates\n    double x[] = new double[] {1.0, 0.0, 0.0};\n    double y[] = new double[] {0.0, 1.0, 0.0};\n    double z[] = new double[] {0.0, 0.0, 1.0};\n\n    vtkPoints points = new vtkPoints();\n\n    for(int i = 0; i < 3; ++i)\n    {\n      points.InsertNextPoint ( x[i], y[i], z[i] );\n    }\n\n    System.out.println(\"There are \" + \" \" + points.GetNumberOfPoints() + \" \" + \"points.\");\n\n    vtkPolyData polydata = new vtkPolyData();\n    polydata.SetPoints(points);\n\n    //Create the tree\n    vtkOctreePointLocator octree = new vtkOctreePointLocator();\n    octree.SetDataSet(polydata);\n    octree.BuildLocator();\n    System.out.println(\"Number of points in tree: \" + \" \" + octree.GetDataSet().GetNumberOfPoints());\n\n    double p[] = new double[3];\n    octree.GetDataSet().GetPoint(0,p);\n    System.out.println(\"p: \" + \" \" + p[0] + \" \" + p[1] + \" \" +p[2]);\n  }\n}\n
        "},{"location":"Java/DataStructures/VisualizeKDTree/","title":"VisualizeKDTree","text":"

        vtk-examples/Java/DataStructures/VisualizeKDTree

        "},{"location":"Java/DataStructures/VisualizeKDTree/#description","title":"Description","text":"

        This demo shows every level of a kdTree.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/DataStructures/VisualizeKDTree/#code","title":"Code","text":"

        VisualizeKDTree.java

        import vtk.*;\n\npublic class VisualizeKDTree\n{\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  static class vtkSliderCallback\n  {\n    void Execute()\n    {\n      this.Level = (int)Math.round(((vtkSliderRepresentation)SliderWidget.GetRepresentation()).GetValue());\n      this.KdTree.GenerateRepresentation(this.Level, this.PolyData);\n      this.Renderer.Render();\n    }\n\n    vtkKdTreePointLocator KdTree;\n    int Level = 0;\n    vtkPolyData PolyData;\n    vtkRenderer Renderer;\n    vtkSliderWidget SliderWidget;\n  }\n\n  public static void main(String[] args)\n  {\n    // Create a point cloud\n    vtkPointSource pointSource = new vtkPointSource();\n    pointSource.SetRadius(4);\n    pointSource.SetNumberOfPoints(1000);\n    pointSource.Update();\n\n    vtkPolyDataMapper pointsMapper = new vtkPolyDataMapper();\n    pointsMapper.SetInputConnection(pointSource.GetOutputPort());\n\n    vtkActor pointsActor = new vtkActor();\n    pointsActor.SetMapper(pointsMapper);\n    pointsActor.GetProperty().SetInterpolationToFlat();\n\n    int maxLevel = 20;\n    // Create the tree\n    vtkKdTreePointLocator kdTree = new vtkKdTreePointLocator();\n    kdTree.SetDataSet(pointSource.GetOutput());\n    kdTree.AutomaticOff();\n    kdTree.SetMaxLevel(maxLevel);\n    kdTree.BuildLocator();\n\n    // Initialize the representation\n    vtkPolyData polydata = new vtkPolyData();\n    kdTree.GenerateRepresentation(0, polydata);\n\n    vtkPolyDataMapper octreeMapper = new vtkPolyDataMapper();\n    octreeMapper.SetInputConnection(polydata.GetProducerPort());\n\n    vtkActor octreeActor = new vtkActor();\n    octreeActor.SetMapper(octreeMapper);\n    octreeActor.GetProperty().SetInterpolationToFlat();\n    octreeActor.GetProperty().SetRepresentationToWireframe();\n\n    // A renderer and render window\n    vtkRenderer renderer = new vtkRenderer();\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.AddRenderer(renderer);\n\n    // An interactor\n    vtkRenderWindowInteractor renderWindowInteractor =\n      new vtkRenderWindowInteractor();\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n\n    // Add the actors to the scene\n    renderer.AddActor(pointsActor);\n    renderer.AddActor(octreeActor);\n\n    // Render an image (lights and cameras are created automatically)\n    renderWindow.Render();\n\n    vtkSliderRepresentation2D sliderRep = new vtkSliderRepresentation2D();\n    sliderRep.SetMinimumValue(0);\n    sliderRep.SetMaximumValue(kdTree.GetLevel());\n    sliderRep.SetValue(0);\n    sliderRep.SetTitleText(\"Level\");\n    sliderRep.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay();\n    sliderRep.GetPoint1Coordinate().SetValue(.2, .2);\n    sliderRep.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay();\n    sliderRep.GetPoint2Coordinate().SetValue(.8, .2);\n    sliderRep.SetSliderLength(0.075);\n    sliderRep.SetSliderWidth(0.05);\n    sliderRep.SetEndCapLength(0.05);\n\n    vtkSliderWidget sliderWidget = new vtkSliderWidget();\n    sliderWidget.SetInteractor(renderWindowInteractor);\n    sliderWidget.SetRepresentation(sliderRep);\n    sliderWidget.SetAnimationModeToAnimate();\n    sliderWidget.EnabledOn();\n\n    vtkSliderCallback callback = new vtkSliderCallback();\n    callback.KdTree = kdTree;\n    callback.PolyData = polydata;\n    callback.Renderer = renderer;\n    callback.SliderWidget = sliderWidget;\n\n    sliderWidget.AddObserver(\"InteractionEvent\", callback, \"Execute\");\n\n    renderWindowInteractor.Initialize();\n    renderWindow.Render();\n\n    renderWindowInteractor.Start();\n  }\n}\n
        "},{"location":"Java/Filtering/Delaunay2D/","title":"Delaunay2D","text":"

        vtk-examples/Java/Filtering/Delaunay2D

        "},{"location":"Java/Filtering/Delaunay2D/#description","title":"Description","text":"

        This example generates a set of points aligned with an XY grid with random heights (z values). The Delaunay2D filter \"magically\" knows how to triangulate this type of point set because it projects the points by default onto the XY axis and then performs a 2D Delaunay triangulation. The result is a mesh on the input points.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Filtering/Delaunay2D/#code","title":"Code","text":"

        Delaunay2D.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkDelaunay2D;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkVertexGlyphFilter;\n\npublic class Delaunay2D \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For PointActor Color \n    double PointActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n    //MeshActorColor\n    double MeshActorColor[] = new double[4];\n\n    colors.GetColor(\"Coral\", PointActorColor);\n    colors.GetColor(\"DimGray\", Bgcolor);\n    colors.GetColor(\"Aquamarine\", MeshActorColor);\n\n    //Create a set of heighs on a grid.\n    // This is often called a \"terrain map\".\n\n    vtkPoints Points = new vtkPoints();  \n\n    int GridSize = 10;\n    for(int x = 0; x < GridSize; x++)\n    {\n      for(int y = 0; y < GridSize; y++)\n      {\n        Points.InsertNextPoint(x, y, (x+y)/(y+1));\n      }\n    }\n\n    //Add the grid points to a polydata object\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n\n\n    //Triangulate the grid points\n    vtkDelaunay2D Delaunay = new vtkDelaunay2D();\n    Delaunay.SetInputData(PolyData);\n\n    vtkPolyDataMapper MeshMapper = new vtkPolyDataMapper();\n    MeshMapper.SetInputConnection(Delaunay.GetOutputPort());\n\n    vtkActor MeshActor = new vtkActor();\n    MeshActor.SetMapper(MeshMapper);\n    MeshActor.GetProperty().SetColor(MeshActorColor);\n    MeshActor.GetProperty().EdgeVisibilityOn();\n\n\n    vtkVertexGlyphFilter GlyphFilter = new vtkVertexGlyphFilter();\n    GlyphFilter.SetInputData(PolyData);\n\n    vtkPolyDataMapper PointMapper = new vtkPolyDataMapper();\n    PointMapper.SetInputConnection(GlyphFilter.GetOutputPort());\n\n    vtkActor PointActor = new vtkActor();\n    PointActor.GetProperty().SetColor(PointActorColor);\n    PointActor.GetProperty().SetPointSize(5);\n    PointActor.SetMapper(PointMapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(PointActor);\n    ren.AddActor(MeshActor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  } \n}\n
        "},{"location":"Java/Filtering/Glyph2D/","title":"Glyph2D","text":"

        vtk-examples/Java/Filtering/Glyph2D

        "},{"location":"Java/Filtering/Glyph2D/#description","title":"Description","text":"

        Copy a 2D glyph to every point in the input set. We use a hexagon for the demo.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Filtering/Glyph2D/#code","title":"Code","text":"

        Glyph2D.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkActor;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkGlyph2D;\nimport vtk.vtkInteractorStyleImage;\nimport vtk.vtkRegularPolygonSource;\n\npublic class Glyph2D \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"IndianRed\",BgColor);\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0, 0, 0);\n    Points.InsertNextPoint(1, 1, 0);\n    Points.InsertNextPoint(2, 2, 0);\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n\n    vtkRegularPolygonSource PolygonSource = new vtkRegularPolygonSource();\n\n    vtkGlyph2D Glyph2D = new vtkGlyph2D();\n    Glyph2D.SetSourceConnection(PolygonSource.GetOutputPort());\n    Glyph2D.SetInputData(PolyData);\n    Glyph2D.Update();\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Glyph2D.GetOutputPort());\n    Mapper.Update();\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise \n    ren.AddActor(Actor);\n    vtkInteractorStyleImage Style = new vtkInteractorStyleImage();\n    iren.SetInteractorStyle(Style);\n\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Filtering/Glyph3D/","title":"Glyph3D","text":"

        vtk-examples/Java/Filtering/Glyph3D

        "},{"location":"Java/Filtering/Glyph3D/#description","title":"Description","text":"

        This example applies an object at every point using vtkGlyph3D We use a cube for the demo.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Filtering/Glyph3D/#code","title":"Code","text":"

        Glyph3D.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkActor;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkInteractorStyleImage;\nimport vtk.vtkCubeSource;\n\npublic class Glyph3D \n{\n    // -----------------------------------------------------------------\n    // Load VTK library and print which library was not properly loaded\n    static \n    {\n        if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n        {\n            for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n            {\n                if (!lib.IsLoaded()) \n                {\n                    System.out.println(lib.GetLibraryName() + \" not loaded\");\n                }\n            }\n        }\n        vtkNativeLibrary.DisableOutputWindow(null);\n    }\n    // -----------------------------------------------------------------\n\n    public static void main(String s[]) \n    {\n        vtkNamedColors Color = new vtkNamedColors(); \n\n        //For Renderer Background Color\n        double BgColor[] = new double[4];\n\n        //For Actor Color\n        double ActorColor[] = new double[4];\n\n        //Change Color Name to Use your own Color for Renderer Background\n        Color.GetColor(\"DarkSeaGreen\",BgColor);\n\n        //Change Color Name to Use your own Color for Actor\n        Color.GetColor(\"Yellow\",ActorColor);\n\n        vtkPoints Points = new vtkPoints();\n        Points.InsertNextPoint(0, 0, 0);\n        Points.InsertNextPoint(1, 1, 1);\n        Points.InsertNextPoint(2, 2, 2);\n\n        vtkPolyData PolyData = new vtkPolyData();\n        PolyData.SetPoints(Points);\n\n        // Create anything you want here, we will use a cube for the demo.\n        vtkCubeSource CubeSource = new vtkCubeSource();\n\n        vtkGlyph3D Glyph3D = new vtkGlyph3D();\n        Glyph3D.SetSourceConnection(CubeSource.GetOutputPort());\n        Glyph3D.SetInputData(PolyData);\n        Glyph3D.Update();\n\n        vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n        Mapper.SetInputConnection(Glyph3D.GetOutputPort());\n        Mapper.Update();\n\n        vtkActor Actor = new vtkActor();\n        Actor.SetMapper(Mapper);\n        Actor.GetProperty().SetColor(ActorColor);\n\n        // Create the renderer, render window and interactor.\n        vtkRenderer ren = new vtkRenderer();\n        vtkRenderWindow renWin = new vtkRenderWindow();\n        renWin.AddRenderer(ren);\n        vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n        iren.SetRenderWindow(renWin);\n\n        // Visualise the arrow\n        ren.AddActor(Actor);\n        vtkInteractorStyleImage Style = new vtkInteractorStyleImage();\n        iren.SetInteractorStyle(Style);\n\n        ren.SetBackground(BgColor);\n        ren.ResetCamera();\n\n        renWin.SetSize(300,300);\n        renWin.Render();\n\n        iren.Initialize();\n        iren.Start();\n\n    }\n}\n
        "},{"location":"Java/Filtering/PerlinNoise/","title":"PerlinNoise","text":"

        vtk-examples/Java/Filtering/PerlinNoise

        "},{"location":"Java/Filtering/PerlinNoise/#description","title":"Description","text":"

        vtkPerlinNoise object computes a Perlin noise field as an implicit function.

        Perlin noise, originally described by Ken Perlin, is a non-periodic and continuous noise function useful for modeling real-world objects.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Filtering/PerlinNoise/#code","title":"Code","text":"

        PerlinNoise.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkPerlinNoise;\nimport vtk.vtkSampleFunction;\nimport vtk.vtkContourFilter;\n\npublic class PerlinNoise \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Chartreuse\", actorColor);\n    colors.GetColor(\"DarkSalmon\", Bgcolor);\n\n    vtkPerlinNoise perlinNoise = new vtkPerlinNoise();\n    perlinNoise.SetFrequency(2, 1.25,1.5);\n    perlinNoise.SetPhase(0, 0, 0);\n\n    vtkSampleFunction Sample = new vtkSampleFunction();\n    Sample.SetImplicitFunction(perlinNoise);\n    Sample.SetSampleDimensions(65, 65, 20);\n    Sample.ComputeNormalsOff();\n\n    vtkContourFilter Surface = new vtkContourFilter();\n    Surface.SetInputConnection(Sample.GetOutputPort());\n    Surface.SetValue(0, 0);\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(Surface.GetOutputPort());\n    mapper.ScalarVisibilityOff();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(actorColor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n\n}\n
        "},{"location":"Java/Filtering/TransformPolyData/","title":"TransformPolyData","text":"

        vtk-examples/Java/Filtering/TransformPolyData

        "},{"location":"Java/Filtering/TransformPolyData/#description","title":"Description","text":"

        vtkTransformPolyDataFilter object is a filter to transform point coordinates and associated point and cell normals and vectors. This filter is specialized for polygonal data.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Filtering/TransformPolyData/#code","title":"Code","text":"

        TransformPolyData.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkTransform;\nimport vtk.vtkTransformPolyDataFilter;\n\n\npublic class TransformPolyData \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For OriginalActor Color\n    double OriginalActorColor[] = new double[4];\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    //TransformedActor color\n    double TransformedActorColor[] = new double[4];\n\n    colors.GetColor(\"LightSeaGreen\", OriginalActorColor);\n    colors.GetColor(\"Sienna\", Bgcolor);\n    colors.GetColor(\"DeepSkyBlue\", TransformedActorColor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper OriginalMapper = new vtkPolyDataMapper();\n    OriginalMapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor OriginalActor = new vtkActor();\n    OriginalActor.SetMapper(OriginalMapper);\n    OriginalActor.GetProperty().SetColor(OriginalActorColor);\n\n\n    //Set up the transform filter\n    vtkTransform Translation = new vtkTransform();\n    Translation.Translate(1.0, 2.0, 3.0);\n\n    vtkTransformPolyDataFilter TransformFilter = new vtkTransformPolyDataFilter();\n    TransformFilter.SetInputConnection(Sphere.GetOutputPort());\n    TransformFilter.SetTransform(Translation);\n    TransformFilter.Update();\n\n    //Set up the actor to display the transformed polydata\n    vtkPolyDataMapper TransformedMapper = new vtkPolyDataMapper();\n    TransformedMapper.SetInputConnection(TransformFilter.GetOutputPort());\n\n    vtkActor TransformedActor = new vtkActor();\n    TransformedActor.SetMapper(TransformedMapper);\n    TransformedActor.GetProperty().SetColor(TransformedActorColor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the Actor\n    ren.AddActor(OriginalActor);\n    ren.AddActor(TransformedActor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Filtering/VertexGlyphFilter/","title":"VertexGlyphFilter","text":"

        vtk-examples/Java/Filtering/VertexGlyphFilter

        "},{"location":"Java/Filtering/VertexGlyphFilter/#description","title":"Description","text":"

        This example creates a set of points and adds a vertex at each point using vtkVertexGlyphFilter.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Filtering/VertexGlyphFilter/#code","title":"Code","text":"

        VertexGlyphFilter.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkVertexGlyphFilter;\n\npublic class VertexGlyphFilter \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n          {\n            System.out.println(lib.GetLibraryName() + \" not loaded\");\n          }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Black\", actorColor);\n    colors.GetColor(\"Gold\", Bgcolor);\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0, 0.0, 0.0);\n    Points.InsertNextPoint(1.0, 1.0, 1.0);\n    Points.InsertNextPoint(2.0, 2.0, 2.0);\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n\n    vtkVertexGlyphFilter VGF = new vtkVertexGlyphFilter();\n    VGF.AddInputData(PolyData);\n    VGF.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(VGF.GetOutputPort());\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(actorColor);\n    actor.GetProperty().SetPointSize(10);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Filtering/WarpTo/","title":"WarpTo","text":"

        vtk-examples/Java/Filtering/WarpTo

        "},{"location":"Java/Filtering/WarpTo/#description","title":"Description","text":"

        vtkWarpTo object is a filter that modifies point coordinates by moving the points towards a user specified position.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Filtering/WarpTo/#code","title":"Code","text":"

        WarpTo.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkLineSource;\nimport vtk.vtkTubeFilter;\nimport vtk.vtkWarpTo;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class WarpTo \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Silver\", actorColor);\n    colors.GetColor(\"MidnightBlue\", Bgcolor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Create a line\n    vtkLineSource LineSource = new vtkLineSource();\n    LineSource.SetPoint1(0, 0, 0);\n    LineSource.SetPoint2(0, 1, 0);\n    LineSource.SetResolution(20);\n    LineSource.Update();\n\n    //Create a tube (cylinder) around the line\n    vtkTubeFilter TubeFilter = new vtkTubeFilter();\n    TubeFilter.SetInputConnection(LineSource.GetOutputPort());\n    TubeFilter.SetRadius(0.01);\n    TubeFilter.SetNumberOfSides(50);\n    TubeFilter.Update();\n\n    vtkWarpTo WarpTo = new vtkWarpTo();\n    WarpTo.SetInputConnection(TubeFilter.GetOutputPort());\n    WarpTo.SetPosition(10, 1, 0);\n    WarpTo.SetScaleFactor(5);\n    WarpTo.AbsoluteOn();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(WarpTo.GetOutputPort());\n    mapper.ScalarVisibilityOff();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(actorColor);\n\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/GeometricObjects/Arrow/","title":"Arrow","text":"

        vtk-examples/Java/GeometricObjects/Arrow

        "},{"location":"Java/GeometricObjects/Arrow/#description","title":"Description","text":"

        vtkArrowSource object appends a cylinder to a cone to form an arrow.

        The shaft base is always at (0,0,0). The arrow tip is always at (1,0,0). If \"Invert\" is true, then the ends are flipped i.e. tip is at (0,0,0) while base is at (1, 0, 0).

        The resolution of the cone and shaft can be set and default to 6.

        The radius of the cone and shaft can be set and default to 0.03 and 0.1. The length of the tip can also be set, and defaults to 0.35.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Arrow/#code","title":"Code","text":"

        Arrow.java

        import vtk.vtkActor;\nimport vtk.vtkArrowSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Arrow  \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    colors.GetColor(\"Tomato\", actorColor);\n    colors.GetColor(\"DarkSeaGreen\", Bgcolor);\n\n    //Create a Arrow \n    vtkArrowSource ArrowSource = new vtkArrowSource();\n    ArrowSource.Update();\n    //Uncomment below lines to set properties\n    //ArrowSource.SetShaftRadius(1.0);\n    //ArrowSource.SetTipLength(1.0);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(ArrowSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n     // Create the renderer, render window and interactor.\n     vtkRenderer ren = new vtkRenderer();\n     vtkRenderWindow renWin = new vtkRenderWindow();\n     renWin.AddRenderer(ren);\n     vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n     iren.SetRenderWindow(renWin);\n\n     // Visualise the arrow\n     ren.AddActor(Actor);\n     ren.SetBackground(Bgcolor);\n\n     renWin.SetSize(300, 300);\n     renWin.Render();\n\n     iren.Initialize();\n     iren.Start();\n  }\n}\n
        "},{"location":"Java/GeometricObjects/Circle/","title":"Circle","text":"

        vtk-examples/Java/GeometricObjects/Circle

        "},{"location":"Java/GeometricObjects/Circle/#description","title":"Description","text":"

        Java Program to display a Circle.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Circle/#code","title":"Code","text":"

        Circle.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRegularPolygonSource;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\n\npublic class Circle \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    colors.GetColor(\"White\", actorColor);\n    colors.GetColor(\"DarkSeaGreen\", Bgcolor);\n\n    vtkRegularPolygonSource PolygoneSource = new vtkRegularPolygonSource();\n    PolygoneSource.SetNumberOfSides(100);\n    PolygoneSource.SetRadius(5);\n    PolygoneSource.SetCenter(0,0,0);\n    //Uncomment below line to Visualize outline of circle\n    PolygoneSource.GeneratePolygonOff();\n    PolygoneSource.Update();\n\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(PolygoneSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/GeometricObjects/Cone/","title":"Cone","text":"

        vtk-examples/Java/GeometricObjects/Cone

        "},{"location":"Java/GeometricObjects/Cone/#description","title":"Description","text":"

        vtkConeSource object creates a cone centered at a specified point and pointing in a specified direction. (By default, the center is the origin and the direction is the x-axis.)

        Depending upon the resolution of this object, different representations are created. If resolution=0 a line is created; if resolution=1, a single triangle is created; if resolution=2, two crossed triangles are created.

        For resolution > 2, a 3D cone (with resolution number of sides) is created.

        It also is possible to control whether the bottom of the cone is capped with a (resolution-sided) polygon, and to specify the height and radius of the cone.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Cone/#code","title":"Code","text":"

        Cone.java

        import vtk.vtkActor;\nimport vtk.vtkConeSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Cone \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries())\n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    colors.GetColor(\"MediumVioletRed\", actorColor);\n    colors.GetColor(\"Wheat\", Bgcolor);\n\n    //create a Cone\n    vtkConeSource ConeSource = new vtkConeSource();\n    //Uncomment below line to set the Resolution of Cone\n    // ConeSource.SetResolution(100);\n    ConeSource.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(ConeSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
        "},{"location":"Java/GeometricObjects/ConvexPointSet/","title":"ConvexPointSet","text":"

        vtk-examples/Java/GeometricObjects/ConvexPointSet

        "},{"location":"Java/GeometricObjects/ConvexPointSet/#description","title":"Description","text":"

        vtkConvexPointSet object represents a 3D cell defined by a convex set of points. An example of such a cell is an octant (from an octree).

        vtkConvexPointSet uses the ordered triangulations approach (vtkOrderedTriangulator) to create triangulations guaranteed to be compatible across shared faces.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/ConvexPointSet/#code","title":"Code","text":"

        ConvexPointSet.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkConvexPointSet;\nimport vtk.vtkPoints;\nimport vtk.vtkUnstructuredGrid;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyData;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkGlyph3DMapper;\n\n\npublic class ConvexPointSet \n{\n  //private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Point Actor Color\n    double PointActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Cyan\",ActorColor);\n    //Change Color Name to Use your own Color for Change Point Actor Color\n    Color.GetColor(\"OrangeRed\",PointActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkOrange\",BgColor);\n\n    vtkConvexPointSet CPS = new vtkConvexPointSet();\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0, 0, 0);\n    Points.InsertNextPoint(1, 0, 0);\n    Points.InsertNextPoint(1, 1, 0);\n    Points.InsertNextPoint(0, 1, 0);\n    Points.InsertNextPoint(0, 0, 1);\n    Points.InsertNextPoint(1, 0, 1);\n    Points.InsertNextPoint(1, 1, 1);\n    Points.InsertNextPoint(0, 1, 1);\n    Points.InsertNextPoint(0.5, 0, 0);\n    Points.InsertNextPoint(1, 0.5, 0);\n    Points.InsertNextPoint(0.5, 1, 0);\n    Points.InsertNextPoint(0, 0.5, 0);\n    Points.InsertNextPoint(0.5, 0.5, 0);\n\n    for (int i = 0; i < 13; ++i)\n    {\n      CPS.GetPointIds().InsertId(i, i);\n    }\n\n    vtkUnstructuredGrid UG = new vtkUnstructuredGrid();\n    UG.Allocate(1, 1);\n    UG.InsertNextCell(CPS.GetCellType(), CPS.GetPointIds());\n    UG.SetPoints(Points);\n\n\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputData(UG);   \n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(ActorColor);\n    Actor.GetProperty().SetLineWidth(3.0);\n    Actor.GetProperty().EdgeVisibilityOn();\n\n    // Glyph the points\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetRadius(0.03);\n    Sphere.SetPhiResolution(21);\n    Sphere.SetThetaResolution(21);\n\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n\n    vtkGlyph3DMapper PointMapper = new vtkGlyph3DMapper();\n    PointMapper.SetInputData(PolyData);\n    PointMapper.SetSourceConnection(Sphere.GetOutputPort());\n\n    vtkActor PointActor = new vtkActor();\n    PointActor.SetMapper(PointMapper);\n    PointActor.GetProperty().SetColor(PointActorColor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.AddActor(PointActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(210);\n    ren.GetActiveCamera().Elevation(30);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/GeometricObjects/CylinderExample/","title":"CylinderExample","text":"

        vtk-examples/Java/GeometricObjects/CylinderExample

        "},{"location":"Java/GeometricObjects/CylinderExample/#description","title":"Description","text":"

        This example creates a minimal visualization program, demonstrating VTK's basic rendering and pipeline creation.

        Note

        This original C++ source code for this example is here.

        Other languages

        See (Cxx), (Python), (PythonicAPI)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/CylinderExample/#code","title":"Code","text":"

        CylinderExample.java

        import vtk.vtkActor;\nimport vtk.vtkCylinderSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\n\n// Then we define our class.\npublic class CylinderExample {\n  private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  // now the main program\n  public static void main(String args[]) {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    // Here is how you create your own named color.\n    double bkgColor[];\n    bkgColor = new double[]{0.1, 0.2, 0.4, 1.0};\n    // This corresponds to the unsigned char array\n    // {26, 51, 102, 255} seen in C++ code for setting\n    // colors not in vtkNamedColors.\n    colors.SetColor(\"BkgColor\", bkgColor);\n\n    // Now we use our own named color.\n    double bkg[] = new double[4];\n    colors.GetColor(\"BkgColor\", bkg);\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    colors.GetColor(\"Tomato\", actorColor);\n    //Renderer Background Color\n\n    // This creates a polygonal cylinder model with eight circumferential facets\n    // (i.e, in practice an octagonal prism).\n    vtkCylinderSource cylinder = new vtkCylinderSource();\n    cylinder.SetResolution(8);\n\n    // The actor is a grouping mechanism: besides the geometry (mapper), it\n    // also has a property, transformation matrix, and/or texture map.\n    // Here we set its color and rotate it around the X and Y axes.\n    vtkPolyDataMapper cylinderMapper = new vtkPolyDataMapper();\n    cylinderMapper.SetInputConnection(cylinder.GetOutputPort());\n\n    vtkActor cylinderActor = new vtkActor();\n    cylinderActor.SetMapper(cylinderMapper);\n    cylinderActor.GetProperty().SetColor(actorColor);\n    cylinderActor.RotateX(30.0);\n    cylinderActor.RotateY(-45.0);\n\n    // The renderer generates the image\n    // which is then displayed on the render window.\n    // It can be thought of as a scene to which the actor is added\n    vtkRenderer ren = new vtkRenderer();\n    ren.AddActor(cylinderActor);\n    ren.ResetCamera();\n    ren.GetActiveCamera().Zoom(1.5);\n    ren.SetBackground(bkg);\n\n    // The render window is the actual GUI window\n    // that appears on the computer screen\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetSize(300, 300);\n    renWin.SetWindowName(\"Cylinder\");\n\n\n    // The render window interactor captures mouse events\n    // and will perform appropriate camera or actor manipulation\n    // depending on the nature of the events.\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    renWin.Render();\n\n    iren.Initialize();\n    // This starts the event loop and as a side effect causes an initial render.\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/GeometricObjects/Disk/","title":"Disk","text":"

        vtk-examples/Java/GeometricObjects/Disk

        "},{"location":"Java/GeometricObjects/Disk/#description","title":"Description","text":"

        vtkDiskSource objects creates a polygonal disk with a hole in the center.

        The disk has zero height. The user can specify the inner and outer radius of the disk, and the radial and circumferential resolution of the polygonal representation.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Disk/#code","title":"Code","text":"

        Disk.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkDiskSource;\nimport vtk.vtkNamedColors;\n\npublic class Disk  \n{\n\n  //-----------------------------------------------------------------\n  //Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    colors.GetColor(\"Gold\", actorColor);\n    colors.GetColor(\"Indigo\", Bgcolor);\n    //Create a Disk\n    vtkDiskSource Disk = new vtkDiskSource();\n\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Disk.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(1.0, 1.0, 0.5);  \n\n    Actor.GetProperty().SetColor(actorColor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/GeometricObjects/EllipticalCylinder/","title":"EllipticalCylinder","text":"

        vtk-examples/Java/GeometricObjects/EllipticalCylinder

        "},{"location":"Java/GeometricObjects/EllipticalCylinder/#description","title":"Description","text":"

        The example creates an elliptical cross-section and stores it in a vtkPolyData. Then, the vtkLinearExtrusionFilter creates an elliptical cylinder by extruding the vtkPolyLine along a vector. The example sets the back-face property of the vtkActor to show the front and back face of the cylinder.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/EllipticalCylinder/#code","title":"Code","text":"

        EllipticalCylinder.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyLine;\nimport vtk.vtkCellArray;\nimport vtk.vtkLinearExtrusionFilter;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkProperty;\nimport vtk.vtkCamera;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyData;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\n\n\npublic class EllipticalCylinder  \n{\n  //private static final long serialVersionUID = 1L;\n\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Line Actor Color\n    double LineActorColor[] = new double[4];\n    //For Back Color\n    double BackColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Cyan\",ActorColor);\n    //Change Color Name to Use your own Color for Change line Actor Color\n    Color.GetColor(\"OrangeRed\",LineActorColor);\n    //Change Color Name to Use your own Color for Back\n    Color.GetColor(\"OrangeRed\",BackColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DimGray\",BgColor);\n\n\n    double angle = 0;\n    double r1, r2;\n    double centerX, centerY;\n    r1 = 50;\n    r2 = 30;\n    centerX = 10.0;\n    centerY = 5.0;\n\n\n    vtkPoints Points = new vtkPoints();\n    int id = 0;\n    while (angle <= 2.0 * Math.PI + (Math.PI / 60.0))\n    {\n      Points.InsertNextPoint(r1 * Math.cos(angle)+centerX,r2 * Math.sin(angle)+ centerY, 0.0);\n      angle = angle + (Math.PI / 60.0);\n      ++id;\n    }\n\n    vtkPolyLine Line = new vtkPolyLine();\n    Line.GetPointIds().SetNumberOfIds(id);\n    for(int i = 0; i <id; ++i)\n    {\n      Line.GetPointIds().SetId(i, i);\n    }\n    vtkCellArray Lines = new vtkCellArray();\n    Lines.InsertNextCell(Line);\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n    PolyData.SetLines(Lines);\n\n    vtkLinearExtrusionFilter Extrude = new vtkLinearExtrusionFilter();\n    Extrude.SetInputData(PolyData);\n    Extrude.SetExtrusionTypeToNormalExtrusion();\n    Extrude.SetVector(0, 0, 100);\n    Extrude.Update();\n\n    vtkPolyDataMapper LineMapper = new vtkPolyDataMapper();\n    LineMapper.SetInputData(PolyData);\n\n    vtkActor LineActor = new vtkActor();\n    LineActor.SetMapper(LineMapper);\n    LineActor.GetProperty().SetColor(LineActorColor);\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Extrude.GetOutputPort());\n\n\n    vtkProperty Back = new vtkProperty();\n    Back.SetColor(BackColor);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(ActorColor);\n    Actor.SetBackfaceProperty(Back);\n\n    vtkCamera Camera = new vtkCamera();\n    Camera.SetPosition(0, 1, 0);\n    Camera.SetFocalPoint(0, 0, 0);\n    Camera.SetViewUp(0, 0, 1);\n    Camera.Azimuth(30);\n    Camera.Elevation(30);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.AddActor(LineActor);\n    ren.SetBackground(BgColor);\n    ren.SetActiveCamera(Camera);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/GeometricObjects/Frustum/","title":"Frustum","text":"

        vtk-examples/Java/GeometricObjects/Frustum

        "},{"location":"Java/GeometricObjects/Frustum/#description","title":"Description","text":"

        This example gets the frustum from a camera and displays it on the screen in Java

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Frustum/#code","title":"Code","text":"

        Frustum.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkPlanes;\nimport vtk.vtkFrustumSource;\nimport vtk.vtkShrinkFilter;\nimport vtk.vtkProperty;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkCamera;\nimport vtk.vtkNamedColors;\n\npublic class Frustum  \n{\n\n  //-----------------------------------------------------------------\n  //Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    //BackFace color \n    double BackColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"GreenYellow\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"RoyalBlue\",BgColor);\n    //Change Color Name to Use your own Color for BackFace Color\n    Color.GetColor(\"PeachPuff\",BackColor);\n\n    // A virtual camera for 3D rendering\n    vtkCamera Camera = new vtkCamera();\n    Camera.SetClippingRange(0.1,0.4);\n    double PlanesArray[] = new double[24];\n\n    Camera.GetFrustumPlanes(1.0, PlanesArray);\n\n    vtkPlanes Planes = new vtkPlanes();\n    Planes.SetFrustumPlanes(PlanesArray);\n\n    //To create a frustum defined by a set of planes. \n    vtkFrustumSource FrustumSource = new vtkFrustumSource();\n    FrustumSource.ShowLinesOff();\n    FrustumSource.SetPlanes(Planes);\n\n    //shrink cells composing an arbitrary data set\n    vtkShrinkFilter shrink = new vtkShrinkFilter();\n    shrink.SetInputConnection(FrustumSource.GetOutputPort());\n    shrink.SetShrinkFactor(.9);\n\n    //Create a Mapper and Actor\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputConnection(shrink.GetOutputPort());\n\n    vtkProperty Back = new vtkProperty();\n    Back.SetColor(BackColor);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetColor(ActorColor);\n    Actor.SetBackfaceProperty(Back);\n\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}  \n
        "},{"location":"Java/GeometricObjects/Line/","title":"Line","text":"

        vtk-examples/Java/GeometricObjects/Line

        "},{"location":"Java/GeometricObjects/Line/#description","title":"Description","text":"

        The line is a primary one-dimensional cell. It is defined by two points. The direction along the line is from the first point to the second point.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Line/#code","title":"Code","text":"

        Line.java

        import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkLineSource;\n\n\n\n\n//Author: Bharatesh Chakravarthi\n//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea. \n\n\npublic class Line extends JPanel implements ActionListener \n{\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public Line() \n  {\n    super(new BorderLayout());\n    double p0[] = new double[] {1.0,0.0,0.0};\n    double p1[] = new double[] {0.0,1.0,0.0};\n\n    //Create a Line\n    vtkLineSource LineSource = new vtkLineSource();\n    LineSource.SetPoint1(p0);\n    LineSource.SetPoint1(p1);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(LineSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(0.0, 0.5, 0.5); \n    Actor.GetProperty().SetLineWidth(5);\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(Actor);\n    renWin.GetRenderer().SetBackground(0.0, 0.1, 0.1);\n    renWin.resetCamera();\n\n    //Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e) \n  {\n    if (e.getSource().equals(exitButton)) \n    {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[]) \n  {\n    SwingUtilities.invokeLater(new Runnable() \n      {\n        public void run() \n        {\n          JFrame frame = new JFrame(\"Line\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new Line(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n} \n
        "},{"location":"Java/GeometricObjects/LongLine/","title":"LongLine","text":"

        vtk-examples/Java/GeometricObjects/LongLine

        "},{"location":"Java/GeometricObjects/LongLine/#description","title":"Description","text":"

        Java Program to Connect several points with a line to visualize as Long Line

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/LongLine/#code","title":"Code","text":"

        LongLine.java

        import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\n\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkLine;\nimport vtk.vtkCellArray;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\n\n\n//Author: Bharatesh Chakravarthi\n//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea. \n\n\npublic class LongLine extends JPanel implements ActionListener \n{\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public LongLine() \n  {\n    super(new BorderLayout());\n\n    double origin[] = new double[] {0.0,0.0,0.0};\n    double p0[] = new double[] {1.0,0.0,0.0};\n    double p1[] = new double[] {0.0,1.0,0.0};\n    double p2[] = new double[] {0.0,1.0,2.0};\n    double p3[] = new double[] {1.0,2.0,3.0};\n\n\n    //Create a vtkPoints object and store the points in it\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(origin);\n    Points.InsertNextPoint(p0);\n    Points.InsertNextPoint(p1);\n    Points.InsertNextPoint(p2);\n    Points.InsertNextPoint(p3);\n\n\n\n    // Create a cell array to store the lines in and add the lines to it\n\n    vtkCellArray Lines = new vtkCellArray();\n    for(int i = 0; i < 3; i++)\n    {\n      vtkLine Line = new vtkLine();\n      Line.GetPointIds().SetId(0, i);\n      Line.GetPointIds().SetId(1, i+1);\n      Lines.InsertNextCell(Line);\n    }\n\n    //// Create a polydata\n    vtkPolyData LinesPolyData = new vtkPolyData();\n    LinesPolyData.SetPoints(Points);\n    LinesPolyData.SetLines(Lines);\n\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(LinesPolyData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(1.0, 0.5, 0.5); \n    Actor.GetProperty().SetLineWidth(5);\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(Actor);\n    renWin.GetRenderer().SetBackground(0.1, 0.5, 0.1);\n    renWin.resetCamera();\n    renWin.resetCameraClippingRange();\n\n    // Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e)\n  {\n    if (e.getSource().equals(exitButton)) \n    {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[])\n  {\n    SwingUtilities.invokeLater(new Runnable()\n      {\n        public void run() \n        {\n          JFrame frame = new JFrame(\"Long Line\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new LongLine(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n}  \n
        "},{"location":"Java/GeometricObjects/OrientedArrow/","title":"OrientedArrow","text":"

        vtk-examples/Java/GeometricObjects/OrientedArrow

        "},{"location":"Java/GeometricObjects/OrientedArrow/#description","title":"Description","text":"

        This example illustrates how to create and display an arrow that passes through two points.

        It demonstrates two different ways to apply the transform:

        1) Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter. 2) Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/OrientedArrow/#code","title":"Code","text":"

        OrientedArrow.java

        import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\n\n\nimport vtk.vtkActor;\nimport vtk.vtkArrowSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkMinimalStandardRandomSequence;\nimport vtk.vtkNamedColors;\nimport vtk.vtkMath;\nimport vtk.vtkMatrix4x4;\nimport vtk.vtkTransform;\nimport vtk.vtkTransformPolyDataFilter;\nimport vtk.vtkSphereSource;\n\n\n//Author: Bharatesh Chakravarthi\n//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea. \n\n\npublic class OrientedArrow extends JPanel implements ActionListener {\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public OrientedArrow() {\n    super(new BorderLayout());\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double StartActorColor[] = new double[4];\n    double ArrowActorColor[] = new double[4];\n    double EndActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"GreenYellow\",StartActorColor);\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"Tomato\",ArrowActorColor);\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"Yellow\",EndActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    //Create a Arrow \n    vtkArrowSource ArrowSource = new vtkArrowSource();\n\n    double sp[] = new double[3];\n    double ep[] = new double[3];\n\n    // Generate a random start and end point\n    vtkMinimalStandardRandomSequence RandomNumbers = new vtkMinimalStandardRandomSequence();\n    RandomNumbers.SetSeed(8775070);\n    for(int i=0;i<3;++i) {\n      RandomNumbers.Next();\n      sp[i]=RandomNumbers.GetRangeValue(-10, 10);\n      RandomNumbers.Next();\n      ep[i]=RandomNumbers.GetRangeValue(-10, 10);\n    }\n\n    // Compute a basis\n    double normalizedX[] = new double[3];\n    double normalizedY[] = new double[3];\n    double normalizedZ[] = new double[3];\n\n    // The X axis is a vector from start to end\n    vtkMath ss = new vtkMath();\n    ss.Subtract(ep, sp, normalizedX);\n    double length;\n    length=ss.Norm(normalizedX);\n    ss.Normalize(normalizedX);\n\n    // The Z axis is an arbitrary vector cross X\n    double arbitary[] = new double[3];\n    for(int i=0;i<3;++i) {\n      RandomNumbers.Next();\n      arbitary[i]=RandomNumbers.GetRangeValue(-10, 10);\n    }\n    ss.Cross(normalizedX, arbitary, normalizedZ);\n    ss.Normalize(normalizedZ);\n    // The Y axis is Z cross X  \n    ss.Cross(normalizedZ, normalizedX, normalizedY);\n    vtkMatrix4x4 Matrix = new vtkMatrix4x4();\n\n    // Create the direction cosine matrix\n    Matrix.Identity();\n    for(int i=0;i<3;i++) {\n      Matrix.SetElement(i, 0, normalizedX[i]);\n      Matrix.SetElement(i, 1, normalizedY[i]);\n      Matrix.SetElement(i, 2, normalizedZ[i]);\n    } \n\n\n    //Apply the transforms\n    vtkTransform Transform = new vtkTransform();\n    Transform.Translate(sp);\n    Transform.Concatenate(Matrix);\n    Transform.Scale(length, length, length);\n\n    // Transform the polydata\n    vtkTransformPolyDataFilter TransformPD = new vtkTransformPolyDataFilter();\n    TransformPD.SetTransform(Transform);\n    TransformPD.SetInputConnection(ArrowSource.GetOutputPort());\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    vtkActor Actor = new vtkActor();\n    Mapper.SetInputConnection(ArrowSource.GetOutputPort());\n\n\n    Actor.SetMapper(Mapper);\n    Actor.SetUserMatrix(Transform.GetMatrix());\n    Actor.GetProperty().SetColor(ArrowActorColor);\n\n    //Create spheres for start and end point\n    vtkSphereSource SphereStartSource = new vtkSphereSource();\n    SphereStartSource.SetCenter(sp);\n    SphereStartSource.SetRadius(0.8);\n\n    vtkPolyDataMapper SphereStartMapper = new vtkPolyDataMapper();\n    SphereStartMapper.SetInputConnection(SphereStartSource.GetOutputPort());\n\n    vtkActor SphereStartActor = new vtkActor();\n    SphereStartActor.SetMapper(SphereStartMapper);\n    SphereStartActor.GetProperty().SetColor(StartActorColor);\n\n\n    vtkSphereSource SphereEndSource = new vtkSphereSource();\n    SphereEndSource.SetCenter(ep);\n    SphereEndSource.SetRadius(0.8);\n\n    vtkPolyDataMapper SphereEndMapper = new vtkPolyDataMapper();\n    SphereEndMapper.SetInputConnection(SphereEndSource.GetOutputPort());\n\n    vtkActor SphereEndActor = new vtkActor();\n    SphereEndActor.SetMapper(SphereEndMapper);\n    SphereEndActor.GetProperty().SetColor(EndActorColor);\n\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(Actor);\n    renWin.GetRenderer().AddActor(SphereStartActor);\n    renWin.GetRenderer().AddActor(SphereEndActor);\n    renWin.GetRenderer().SetBackground(BgColor);;\n    renWin.resetCamera();\n\n\n    // Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e) {\n    if (e.getSource().equals(exitButton)) {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[]) {\n    SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JFrame frame = new JFrame(\"Oriented Arrow\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new OrientedArrow(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n}\n
        "},{"location":"Java/GeometricObjects/OrientedCylinder/","title":"OrientedCylinder","text":"

        vtk-examples/Java/GeometricObjects/OrientedCylinder

        "},{"location":"Java/GeometricObjects/OrientedCylinder/#description","title":"Description","text":"

        This example illustrates how to create and display a cylinder that passes through two points.

        It demonstrates two different ways to apply the transform:

        1) Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter. 2) Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/OrientedCylinder/#code","title":"Code","text":"

        OrientedCylinder.java

        import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\n\n\nimport vtk.vtkActor;\nimport vtk.vtkCylinderSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkMinimalStandardRandomSequence;\nimport vtk.vtkNamedColors;\nimport vtk.vtkMath;\nimport vtk.vtkMatrix4x4;\nimport vtk.vtkTransform;\nimport vtk.vtkTransformPolyDataFilter;\nimport vtk.vtkSphereSource;\n\n\npublic class OrientedCylinder extends JPanel implements ActionListener {\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public OrientedCylinder() {\n    super(new BorderLayout());\n\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n\n    //For Actor Color\n    double StartActorColor[] = new double[4];\n    double CylinderActorColor[] = new double[4];\n    double EndActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"Red\",StartActorColor);\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"Lime\",CylinderActorColor);\n    //Change Color Name to Use your own Color for Change StartActor Color\n    Color.GetColor(\"Blue\",EndActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Ivory\",BgColor); \n\n    // Create a cylinder.\n    // Cylinder height vector is (0,1,0).\n    // Cylinder center is in the middle of the cylinder\n    vtkCylinderSource CylinderSource = new vtkCylinderSource();\n    CylinderSource.SetResolution(15);\n\n    double sp[] = new double[3];\n    double ep[] = new double[3];\n\n    // Generate a random start and end point\n    vtkMinimalStandardRandomSequence RandomNumbers = new vtkMinimalStandardRandomSequence();\n    RandomNumbers.SetSeed(8775070);\n    for(int i=0;i<3;++i) {\n      RandomNumbers.Next();\n      sp[i]=RandomNumbers.GetRangeValue(-10, 10);\n      RandomNumbers.Next();\n      ep[i]=RandomNumbers.GetRangeValue(-10, 10);\n    }\n\n    // Compute a basis\n    double normalizedX[] = new double[3];\n    double normalizedY[] = new double[3];\n    double normalizedZ[] = new double[3];\n\n    // The X axis is a vector from start to end\n    vtkMath ss = new vtkMath();\n    ss.Subtract(ep, sp, normalizedX);\n    double length;\n    length=ss.Norm(normalizedX);\n    ss.Normalize(normalizedX);\n\n    // The Z axis is an arbitrary vector cross X\n    double arbitary[] = new double[3];\n    for(int i=0;i<3;++i) {\n      RandomNumbers.Next();\n      arbitary[i]=RandomNumbers.GetRangeValue(-10, 10);\n    }\n    ss.Cross(normalizedX, arbitary, normalizedZ);\n    ss.Normalize(normalizedZ);\n\n    // The Y axis is Z cross X\n    ss.Cross(normalizedZ, normalizedX, normalizedY);\n    vtkMatrix4x4 Matrix = new vtkMatrix4x4();\n    // Create the direction cosine matrix\n    Matrix.Identity();\n    for(int i=0;i<3;i++) {\n      Matrix.SetElement(i, 0, normalizedX[i]);\n      Matrix.SetElement(i, 1, normalizedY[i]);\n      Matrix.SetElement(i, 2, normalizedZ[i]);\n    }\n\n    vtkTransform Transform = new vtkTransform();\n    Transform.Translate(sp);\n    Transform.Concatenate(Matrix);\n    Transform.RotateZ(-90.0);\n    Transform.Scale(1.0,length,1.0);\n    Transform.Translate(0.0,0.5,0.0);\n\n    // Apply the transforms\n    vtkTransformPolyDataFilter TransformPD = new vtkTransformPolyDataFilter();\n    TransformPD.SetTransform(Transform);\n    TransformPD.SetInputConnection(CylinderSource.GetOutputPort());\n\n    // Transform the polydata\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    vtkActor Actor = new vtkActor();\n    Mapper.SetInputConnection(CylinderSource.GetOutputPort());\n\n\n    Actor.SetMapper(Mapper);\n    Actor.SetUserMatrix(Transform.GetMatrix());\n    Actor.GetProperty().SetColor(CylinderActorColor);\n\n    vtkSphereSource SphereStartSource = new vtkSphereSource();\n    SphereStartSource.SetCenter(sp);\n    SphereStartSource.SetRadius(0.8);\n\n    vtkPolyDataMapper SphereStartMapper = new vtkPolyDataMapper();\n    SphereStartMapper.SetInputConnection(SphereStartSource.GetOutputPort());\n\n    vtkActor SphereStartActor = new vtkActor();\n    SphereStartActor.SetMapper(SphereStartMapper);\n    SphereStartActor.GetProperty().SetColor(StartActorColor);\n\n    vtkSphereSource SphereEndSource = new vtkSphereSource();\n    SphereEndSource.SetCenter(ep);\n    SphereEndSource.SetRadius(0.8);\n\n    vtkPolyDataMapper SphereEndMapper = new vtkPolyDataMapper();\n    SphereEndMapper.SetInputConnection(SphereEndSource.GetOutputPort());\n\n    vtkActor SphereEndActor = new vtkActor();\n    SphereEndActor.SetMapper(SphereEndMapper);\n    SphereEndActor.GetProperty().SetColor(EndActorColor);\n\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(Actor);\n    renWin.GetRenderer().AddActor(SphereStartActor);\n    renWin.GetRenderer().AddActor(SphereEndActor);\n    renWin.GetRenderer().SetBackground(BgColor);;\n    renWin.resetCamera();\n\n\n    // Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e) {\n    if (e.getSource().equals(exitButton)) {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[]) {\n    SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JFrame frame = new JFrame(\"Oriented Cylinder\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new OrientedCylinder(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n}\n
        "},{"location":"Java/GeometricObjects/ParametricObjects/","title":"ParametricObjects","text":"

        vtk-examples/Java/GeometricObjects/ParametricObjects

        "},{"location":"Java/GeometricObjects/ParametricObjects/#description","title":"Description","text":"

        See Parametric Equations for Surfaces by Andrew Maclean for an excellent description of these beautiful parametric surfaces. You can edit the following code by selecting any one of the functions and the corresponding object will be displayed.

        Other languages

        See (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/ParametricObjects/#code","title":"Code","text":"

        ParametricObjects.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkParametricFunctionSource;\nimport vtk.vtkProperty;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\n\n\nimport vtk.vtkParametricFigure8Klein;\n//Uncomment one of the following includes that correspond\n//import vtk.vtkParametricBoy;\n//import vtk.vtkParametricConicSpiral;\n//import vtk.vtkParametricCrossCap ;\n//import vtk.vtkParametricDini ;\n//import vtk.vtkParametricEllipsoid;\n//import vtk.vtkParametricEnneper;\n//import vtk.vtkParametricKlein;\n//import vtk.vtkParametricMobius;\n//import vtk.vtkParametricRandomHills;\n//import vtk.vtkParametricRoman;\n//import vtk.vtkParametricSpline;\n//import vtk.vtkParametricSuperEllipsoid;\n//import vtk.vtkParametricSuperToroid;\n//import vtk.vtkParametricTorus;\n\n\n\n\npublic class ParametricObjects \n{\n  //private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Back Color\n    double BackColor[] = new double[4];\n    //For Diffuse Color\n    double DiffuseColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n\n    //Change Color Name to Use your own Color for Change Back Color\n    Color.GetColor(\"Navy\",BackColor);\n    //Change Color Name to Use your own Color for Change Diffuse Color\n    Color.GetColor(\"Red\",DiffuseColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Cornsilk\",BgColor);\n\n\n    vtkParametricFigure8Klein ParametricObject = new vtkParametricFigure8Klein();\n\n    // Uncomment one of the following and\n    // ensure the matching include (above) is umcommented).\n    //vtkParametricBoy parametricObject = new vtkParametricBoy();\n    //vtkParametricConicSpiral parametricObject = new vtkParametricConicSpiral();\n    //vtkParametricCrossCap parametricObject = new vtkParametricCrossCap();\n    //vtkParametricDini parametricObject = new vtkParametricDini();\n    //vtkParametricEllipsoid parametricObject = new vtkParametricEllipsoid();\n    //vtkParametricEnneper parametricObject = new vtkParametricEnneper();\n    //vtkParametricKlein parametricObject = new vtkParametricKlein();\n    //vtkParametricMobius parametricObject = new vtkParametricMobius();\n    //vtkParametricRandomHills parametricObject = new vtkParametricRandomHills();\n    //vtkParametricRoman parametricObject = new vtkParametricRoman();\n    //vtkParametricSpline parametricObject = new vtkParametricSpline();\n    //vtkParametricSuperEllipsoid parametricObject = new vtkParametricSuperEllipsoid();\n    //vtkParametricSuperToroid parametricObject = new vtkParametricSuperToroid();\n    //vtkParametricToru parametricObject = new vtkParametricToru();\n\n\n\n    vtkParametricFunctionSource parametricFunctionSource = new vtkParametricFunctionSource();\n    parametricFunctionSource.SetParametricFunction(ParametricObject);\n    parametricFunctionSource.Update();\n\n\n    vtkProperty BackProperty = new vtkProperty();\n    BackProperty.SetColor(BackColor);\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(parametricFunctionSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetDiffuseColor(DiffuseColor);\n    Actor.GetProperty().SetSpecular(0.5);\n    Actor.GetProperty().SetSpecularPower(20);\n    Actor.SetBackfaceProperty(BackProperty);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/GeometricObjects/PlanesIntersection/","title":"PlanesIntersection","text":"

        vtk-examples/Java/GeometricObjects/PlanesIntersection

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/PlanesIntersection/#code","title":"Code","text":"

        PlanesIntersection.java

        import vtk.vtkSphereSource;\nimport vtk.vtkPoints;\nimport vtk.vtkPlanesIntersection;\nimport vtk.vtkNativeLibrary;\n\nclass PlanesIntersection{  \n\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n\n  public static void main(String args[]){  \n\n    vtkSphereSource SphereSource = new vtkSphereSource();\n    SphereSource.Update();\n\n    double bounds[] = new double[6];\n\n    SphereSource.GetOutput().GetBounds(bounds);\n    vtkPoints Box = new vtkPoints();\n    Box.SetNumberOfPoints(8);\n\n    double xMin, xMax, yMin, yMax, zMin, zMax;\n    xMin = bounds[0]; xMax = bounds[1];\n    yMin = bounds[2]; yMax = bounds[3];\n    zMin = bounds[4]; zMax = bounds[5];\n\n\n    Box.SetPoint(0, xMax, yMin, zMax);\n    Box.SetPoint(1, xMax, yMin, zMin);\n    Box.SetPoint(2, xMax, yMax, zMin);\n    Box.SetPoint(3, xMax, yMax, zMax);\n    Box.SetPoint(4, xMin, yMin, zMax);\n    Box.SetPoint(5, xMin, yMin, zMin);\n    Box.SetPoint(6, xMin, yMax, zMin);\n    Box.SetPoint(7, xMin, yMax, zMax);\n\n\n    vtkPlanesIntersection PlanesIntersection = new vtkPlanesIntersection();\n    PlanesIntersection.SetBounds(bounds);\n\n    int intersects = PlanesIntersection.IntersectsRegion(Box);\n    System.out.print(\"Intersects:\" + intersects );\n\n  }  \n}   \n
        "},{"location":"Java/GeometricObjects/Polygon/","title":"Polygon","text":"

        vtk-examples/Java/GeometricObjects/Polygon

        "},{"location":"Java/GeometricObjects/Polygon/#description","title":"Description","text":"

        Java Program to Display a polygon having n edges, where n is the number of points in the polygon.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Polygon/#code","title":"Code","text":"

        Polygon.java

        import vtk.vtkActor;\nimport vtk.vtkCellArray;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPolygon;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Polygon  \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n      }\n     }\n     vtkNativeLibrary.DisableOutputWindow(null);\n   }\n   // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Red\", actorColor);\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0,0.0,0.0);\n    Points.InsertNextPoint(1.0,0.0,0.0);\n    Points.InsertNextPoint(1.0,1.0,0.0);\n    Points.InsertNextPoint(0.0,1.0,0.0);\n\n\n    vtkPolygon Polygon = new vtkPolygon();\n    Polygon.GetPointIds().SetNumberOfIds(4);\n    Polygon.GetPointIds().SetId(0, 0);\n    Polygon.GetPointIds().SetId(1, 1);\n    Polygon.GetPointIds().SetId(2, 2);\n    Polygon.GetPointIds().SetId(3, 3);\n\n\n    vtkCellArray Polygons = new vtkCellArray();\n    Polygons.InsertNextCell(Polygon);\n\n\n    vtkPolyData PolygonPolyData = new vtkPolyData();\n    PolygonPolyData.SetPoints(Points);\n    PolygonPolyData.SetPolys(Polygons);\n\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(PolygonPolyData);\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor); \n    Actor.GetProperty().SetLineWidth(5);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();     \n\n  }\n} \n
        "},{"location":"Java/GeometricObjects/Pyramid/","title":"Pyramid","text":"

        vtk-examples/Java/GeometricObjects/Pyramid

        "},{"location":"Java/GeometricObjects/Pyramid/#description","title":"Description","text":"

        Java Program to visualize a Pyramid using vtkPyramid.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Pyramid/#code","title":"Code","text":"

        Pyramid.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkPoints;\nimport vtk.vtkPyramid;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkUnstructuredGrid;\nimport vtk.vtkCellArray;\nimport vtk.vtkNamedColors;\n\n\npublic class Pyramid  \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static\n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n      }\n     }\n     vtkNativeLibrary.DisableOutputWindow(null);\n   }\n   // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Sienna\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Ivory\",BgColor);\n\n    vtkPoints Points = new vtkPoints();\n\n    double p0[] = new double[] {1.0,1.0,1.0};\n    double p1[] = new double[] {-1.0,1.0,1.0};\n    double p2[] = new double[] {-1.0,-1.0,1.0};\n    double p3[] = new double[] {1.0,-1.0, 1.0};\n    double p4[] = new double[] {0.0,0.0, 0.0};\n\n    Points.InsertNextPoint(p0);\n    Points.InsertNextPoint(p1);\n    Points.InsertNextPoint(p2);\n    Points.InsertNextPoint(p3);\n    Points.InsertNextPoint(p4);\n\n\n    vtkPyramid Pyramid = new vtkPyramid();\n    Pyramid.GetPointIds().SetId(0, 0);\n    Pyramid.GetPointIds().SetId(1, 1);\n    Pyramid.GetPointIds().SetId(2, 2);\n    Pyramid.GetPointIds().SetId(3, 3);\n    Pyramid.GetPointIds().SetId(4, 4);\n\n    vtkCellArray Cells = new vtkCellArray();\n    Cells.InsertNextCell(Pyramid);\n\n    vtkUnstructuredGrid UG = new vtkUnstructuredGrid();\n    UG.SetPoints(Points);\n    UG.InsertNextCell(Pyramid.GetCellType(), Pyramid.GetPointIds());\n\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputData(UG);\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetColor(ActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
        "},{"location":"Java/GeometricObjects/Quad/","title":"Quad","text":"

        vtk-examples/Java/GeometricObjects/Quad

        "},{"location":"Java/GeometricObjects/Quad/#description","title":"Description","text":"

        Java Program to display a Quad.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Quad/#code","title":"Code","text":"

        Quad.java

        import vtk.vtkActor;\nimport vtk.vtkCellArray;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkQuad;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Quad \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n   }\n   // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"DarkMagenta\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Coral\",BgColor);\n\n    //Create four points (must be in counter clockwise order)\n    double p0[] = new double[] {0.0, 0.0, 0.0};\n    double p1[] = new double[] {1.0, 0.0, 0.0};\n    double p2[] = new double[] {1.0, 1.0, 0.0};\n    double p3[] = new double[] {0.0, 1.0, 0.0};\n\n\n    //// Add the points to a vtkPoints object\n    vtkPoints Points = new vtkPoints(); \n    Points.InsertNextPoint(p0);\n    Points.InsertNextPoint(p1);\n    Points.InsertNextPoint(p2);\n    Points.InsertNextPoint(p3);\n\n    //Create a quad on the four points    \n    vtkQuad Quad = new vtkQuad();\n    Quad.GetPointIds().SetId(0, 0);\n    Quad.GetPointIds().SetId(1, 1);\n    Quad.GetPointIds().SetId(2, 2);\n    Quad.GetPointIds().SetId(3, 3);\n\n    //Create a cell array to store the Quad\n    vtkCellArray Quads = new vtkCellArray();\n    Quads.InsertNextCell(Quad);\n\n    //Create a polydata to store Points and Quad\n    vtkPolyData QuadData = new vtkPolyData();\n    //Add the points and Quad to the dataset\n    QuadData.SetPoints(Points);\n    QuadData.SetPolys(Quads);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(QuadData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(ActorColor); \n    Actor.GetProperty().SetLineWidth(5);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
        "},{"location":"Java/GeometricObjects/RegularPolygonSource/","title":"RegularPolygonSource","text":"

        vtk-examples/Java/GeometricObjects/RegularPolygonSource

        "},{"location":"Java/GeometricObjects/RegularPolygonSource/#description","title":"Description","text":"

        Java Program to create a pentagon.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/RegularPolygonSource/#code","title":"Code","text":"

        RegularPolygonSource.java

        import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\n\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\nimport vtk.vtkRegularPolygonSource;\nimport vtk.vtkShrinkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkProperty;\n\n\n\npublic class RegularPolygonSource extends JPanel implements ActionListener {\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public RegularPolygonSource() {\n    super(new BorderLayout());\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    //BackFace color \n    double BackColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"DarkMagenta\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"White\",BgColor);\n    //Change Color Name to Use your own Color for BackFace Color\n    Color.GetColor(\"Yellow\",BackColor);\n\n\n\n    vtkRegularPolygonSource PolygonSource = new vtkRegularPolygonSource();\n    PolygonSource.SetNumberOfSides(5);\n    PolygonSource.SetRadius(5);\n    PolygonSource.SetCenter(0,0,0);\n\n    //shrink cells composing an arbitrary data set\n    vtkShrinkPolyData shrink = new vtkShrinkPolyData();\n    shrink.SetInputConnection(PolygonSource.GetOutputPort());\n    shrink.SetShrinkFactor(.9);\n\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(shrink.GetOutputPort());\n\n    vtkProperty Back = new vtkProperty();\n    Back.SetColor(BackColor);\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetLineWidth(5);\n    Actor.GetProperty().SetColor(ActorColor); \n    Actor.SetBackfaceProperty(Back);\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(Actor);\n    renWin.resetCamera();\n    renWin.GetRenderer().SetBackground(BgColor);\n\n\n\n    // Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e) {\n    if (e.getSource().equals(exitButton)) {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[]) {\n    SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JFrame frame = new JFrame(\"Regular Polygon Source\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new RegularPolygonSource(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n}  \n
        "},{"location":"Java/GeometricObjects/ShrinkCube/","title":"ShrinkCube","text":"

        vtk-examples/Java/GeometricObjects/ShrinkCube

        "},{"location":"Java/GeometricObjects/ShrinkCube/#description","title":"Description","text":"

        Generates a cube using vtkCubeSource, then a shrink filter is applied.

        vtkShrinkFilter object shrinks cells composing an arbitrary data set towards their centroid. The centroid of a cell is computed as the average position of the cell points. Shrinking results in disconnecting the cells from one another.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/ShrinkCube/#code","title":"Code","text":"

        ShrinkCube.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkCubeSource;\nimport vtk.vtkShrinkFilter;\nimport vtk.vtkProperty;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class Cube \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {   \n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    //BackFace color \n    double BackColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"SpringGreen\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Red\",BgColor);\n    //Change Color Name to Use your own Color for BackFace Color\n    Color.GetColor(\"Yellow\",BackColor);\n\n\n    // Create a cube.\n    vtkCubeSource Cube = new vtkCubeSource();\n\n    //shrink cells composing an arbitrary data set\n    vtkShrinkFilter shrink = new vtkShrinkFilter();\n    shrink.SetInputConnection(Cube.GetOutputPort());\n    shrink.SetShrinkFactor(.9);\n\n    //Create a Mapper and Actor\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputConnection(shrink.GetOutputPort());\n\n    vtkProperty Back = new vtkProperty();\n    Back.SetColor(BackColor);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetColor(ActorColor);\n    Actor.SetBackfaceProperty(Back);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();   \n  }\n} \n
        "},{"location":"Java/GeometricObjects/TextActor/","title":"TextActor","text":"

        vtk-examples/Java/GeometricObjects/TextActor

        "},{"location":"Java/GeometricObjects/TextActor/#description","title":"Description","text":"

        Java Program to demonstrate the use of vtkTextActor. TextActor can be set with properties such as FontSize, FontFamily, DisplayPosition and so on.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/TextActor/#code","title":"Code","text":"

        TextActor.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkTextActor;\nimport vtk.vtkNamedColors;\n\npublic class TextActor  \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  //-----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Red\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",Bgcolor);\n\n    vtkTextActor Text = new vtkTextActor();\n    Text.SetInput(\"Hello World\");\n    Text.SetDisplayPosition(20, 30);\n    Text.GetTextProperty().SetFontSize(40);\n    Text.GetTextProperty().SetFontFamilyToArial();\n    Text.GetTextProperty().BoldOn();\n    Text.GetTextProperty().ShadowOn();\n    Text.GetTextProperty().GetShadowOffset();\n    Text.GetTextProperty().SetColor(ActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the Actor\n    ren.AddActor(Text);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
        "},{"location":"Java/GeometricObjects/Triangle/","title":"Triangle","text":"

        vtk-examples/Java/GeometricObjects/Triangle

        "},{"location":"Java/GeometricObjects/Triangle/#description","title":"Description","text":"

        Java Program to visualize a Triangle The triangle is a primary two-dimensional cell. The triangle is defined by a counterclockwise ordered list of three points. The order of the points specifies the direction of the surface normal using the right-hand rule.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Triangle/#code","title":"Code","text":"

        Triangle.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkTriangle;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class Triangle  \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Gold\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SpringGreen\",BgColor);\n\n\n    // Create a triangle\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(1.0,0.0,0.0);\n    Points.InsertNextPoint(0.0,0.0,0.0);\n    Points.InsertNextPoint(0.0,1.0,0.0);\n\n    vtkTriangle Triangle = new vtkTriangle();\n    Triangle.GetPointIds().SetId(0, 0);\n    Triangle.GetPointIds().SetId(1, 1);\n    Triangle.GetPointIds().SetId(2, 2);\n\n    vtkCellArray CellArray = new vtkCellArray();\n    CellArray.InsertNextCell(Triangle);\n\n\n    // Create a polydata object\n    vtkPolyData TrianglePolyData = new vtkPolyData();\n    // Add the geometry and topology to the polydata\n    TrianglePolyData.SetPoints(Points);\n    TrianglePolyData.SetPolys(CellArray);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(TrianglePolyData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetColor(ActorColor); \n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();     \n\n  }\n}  \n
        "},{"location":"Java/GeometricObjects/TriangleStrip/","title":"TriangleStrip","text":"

        vtk-examples/Java/GeometricObjects/TriangleStrip

        "},{"location":"Java/GeometricObjects/TriangleStrip/#description","title":"Description","text":"

        Java Program to display a triangle Strip.

        The triangle strip is a composite two-dimensional cell consisting of one or more triangles. The points defining the triangle strip need not lie in a plane. The triangle strip is defined by an ordered list of n+2 points, where n is the number of triangles. The ordering of the points is such that each set of three points defines a triangle.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/TriangleStrip/#code","title":"Code","text":"

        TriangleStrip.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkTriangleStrip;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\npublic class TriangleStrip  \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {  \n\n    vtkNamedColors Color = new vtkNamedColors();\n\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Lime\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Aqua\",BgColor);\n\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0,0.0,0.0);\n    Points.InsertNextPoint(0.0,1.0,0.0);\n    Points.InsertNextPoint(1.0,0.0,0.0);\n    Points.InsertNextPoint(1.5,1.0,0.0);\n\n    vtkTriangleStrip TriangleStrip = new vtkTriangleStrip();\n    TriangleStrip.GetPointIds().SetNumberOfIds(4);\n    TriangleStrip.GetPointIds().SetId(0, 0);\n    TriangleStrip.GetPointIds().SetId(1, 1);\n    TriangleStrip.GetPointIds().SetId(2, 2);\n    TriangleStrip.GetPointIds().SetId(3, 3);\n\n\n    vtkCellArray CellArray = new vtkCellArray();\n    CellArray.InsertNextCell(TriangleStrip);\n\n    vtkPolyData TrianglePolyData = new vtkPolyData();\n    TrianglePolyData.SetPoints(Points);\n    TrianglePolyData.SetPolys(CellArray);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(TrianglePolyData);\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().EdgeVisibilityOn();\n    Actor.GetProperty().SetColor(ActorColor); \n    Actor.GetProperty().SetLineWidth(2.5);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}   \n
        "},{"location":"Java/GeometricObjects/Vertex/","title":"Vertex","text":"

        vtk-examples/Java/GeometricObjects/Vertex

        "},{"location":"Java/GeometricObjects/Vertex/#description","title":"Description","text":"

        Java Program to display a Vertex. The vertex is a primary zero-dimensional cell. It is defined by a single point.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/GeometricObjects/Vertex/#code","title":"Code","text":"

        Vertex.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkVertex;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class Vertex\n{\n  //-----------------------------------------------------------------\n  //Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"OrangeRed\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkSlateGray\",BgColor);\n\n\n    //Create a 3D Point\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0,0.0,0.0);\n\n    //Create A Vertex Which in turn represents a 3D point\n    vtkVertex Vertex = new vtkVertex();\n    Vertex.GetPointIds().SetId(0, 0);\n\n    //Create a Cell Array -  a raw integer list that explicitly represents cell connectivity\n    vtkCellArray Vertices = new vtkCellArray();\n    Vertices.InsertNextCell(Vertex);\n\n    //Create a PolyData  which represents a geometric structure \n    //consisting of vertices, lines, polygons, and/or triangle strips\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n    PolyData.SetVerts(Vertices);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(PolyData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetPointSize(15);\n    Actor.GetProperty().SetColor(ActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}  \n
        "},{"location":"Java/Geovis/CompassWidget/","title":"CompassWidget","text":"

        vtk-examples/Java/Geovis/CompassWidget

        "},{"location":"Java/Geovis/CompassWidget/#description","title":"Description","text":"

        Java Program to create a compass at top right corner of the window in VTK

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Geovis/CompassWidget/#code","title":"Code","text":"

        CompassWidget.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkActor;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkCompassRepresentation;\nimport vtk.vtkCompassWidget;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\n\n\npublic class CompassWidget  {\n  // private static final long serialVersionUID = 1L;\n\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",BgColor);\n\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(4.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n\n    vtkCompassRepresentation CompassRepresentation = new vtkCompassRepresentation();\n    vtkCompassWidget CompassWidget = new vtkCompassWidget();\n    CompassWidget.SetRepresentation(CompassRepresentation);\n    CompassWidget.EnabledOn();\n    CompassWidget.SetInteractor(iren);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetInteractor(iren);\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    CompassWidget.EnabledOn();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Start();\n    iren.Initialize();\n\n  }\n} \n
        "},{"location":"Java/Geovis/EarthSource/","title":"EarthSource","text":"

        vtk-examples/Java/Geovis/EarthSource

        "},{"location":"Java/Geovis/EarthSource/#description","title":"Description","text":"

        Java Program to Visualize Earth Source.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Geovis/EarthSource/#code","title":"Code","text":"

        EarthSource.java

        import vtk.vtkActor;\nimport vtk.vtkEarthSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class EarthSource\n{    \n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    double MyColors[] = new double[4];\n    vtkNamedColors Colors = new vtkNamedColors();\n    Colors.GetColor(\"Banana\",MyColors);\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n    Colors.GetColor(\"Black\", Bgcolor);\n\n    vtkEarthSource EarthSource = new vtkEarthSource();\n    EarthSource.OutlineOff();\n    //EarthSource.OutlineOn();\n    EarthSource.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(EarthSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(MyColors);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Geovis/GeoAssignCoordinates/","title":"GeoAssignCoordinates","text":"

        vtk-examples/Java/Geovis/GeoAssignCoordinates

        "},{"location":"Java/Geovis/GeoAssignCoordinates/#description","title":"Description","text":"

        Given latitude and longitude arrays, take the values in those arrays and convert them to x,y,z world coordinates.

        Uses a spherical model of the earth to do the conversion. The position is in meters relative to the center of the earth.

        If a transform is given, use the transform to convert latitude and longitude to the world coordinate.

        Note

        The vtkGeovisCore classes as well as the module vtkViewsGeovis have been deprecated for VTK 8.2 and will be removed in a future version. See VTK Merge Request 4395

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Geovis/GeoAssignCoordinates/#code","title":"Code","text":"

        GeoAssignCoordinates.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkMutableDirectedGraph;\nimport vtk.vtkDoubleArray;\nimport vtk.vtkGeoAssignCoordinates;\nimport vtk.vtkGraphMapper;\n\npublic class GeoAssignCoordinates \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {   \n    vtkMutableDirectedGraph g = new vtkMutableDirectedGraph();\n    vtkDoubleArray latitude = new vtkDoubleArray();\n    latitude.SetName(\"latitude\");\n\n    vtkDoubleArray longitude = new vtkDoubleArray();\n    longitude.SetName(\"longitude\");\n\n    for(int lat = -90; lat <= 90; lat += 10)\n    {\n      for(int lon = -180; lon <= 180; lon += 20)\n      {\n        g.AddVertex();\n        latitude.InsertNextValue(lat);\n        longitude.InsertNextValue(lon);\n      }\n    }\n\n    g.GetVertexData().AddArray(latitude);\n    g.GetVertexData().AddArray(longitude);\n\n    vtkGeoAssignCoordinates assign = new vtkGeoAssignCoordinates();\n    assign.SetInputData(g);\n    assign.SetLatitudeArrayName(\"latitude\");\n    assign.SetLongitudeArrayName(\"longitude\");\n    assign.SetGlobeRadius(1.0);\n    assign.Update();\n\n    vtkGraphMapper mapper = new vtkGraphMapper();\n    mapper.SetInputConnection(assign.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Graphs/RandomGraphSource/","title":"RandomGraphSource","text":"

        vtk-examples/Java/Graphs/RandomGraphSource

        "},{"location":"Java/Graphs/RandomGraphSource/#description","title":"Description","text":"

        RandomGraphSource object generates a graph with a specified number of vertices, with the density of edges specified by either an exact number of edges or the probability of an edge.

        You may additionally specify whether to begin with a random tree (which enforces graph connectivity).

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Graphs/RandomGraphSource/#code","title":"Code","text":"

        RandomGraphSource.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRandomGraphSource;\nimport vtk.vtkGraphLayoutView;\n\npublic class RandomGraphSource \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkRandomGraphSource randomGraphSource =  new vtkRandomGraphSource();\n    randomGraphSource.SetNumberOfVertices(5);\n    randomGraphSource.SetNumberOfEdges(4);\n    randomGraphSource.SetSeed(1); // This ensures repeatable results for testing. Turn this off for real use.\n    randomGraphSource.Update();\n\n    vtkGraphLayoutView graphLayoutView = new vtkGraphLayoutView();\n    graphLayoutView.AddRepresentationFromInput(randomGraphSource.GetOutput());\n    graphLayoutView.ResetCamera();\n    graphLayoutView.Render();\n    graphLayoutView.GetInteractor().Start();\n\n  }\n}\n
        "},{"location":"Java/Graphs/SelectGraphVertices/","title":"SelectGraphVertices","text":"

        vtk-examples/Java/Graphs/SelectGraphVertices

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Graphs/SelectGraphVertices/#code","title":"Code","text":"

        SelectGraphVertices.java

        import vtk.vtkAnnotationLink;\nimport vtk.vtkDataRepresentation;\nimport vtk.vtkGraphLayoutView;\nimport vtk.vtkIdTypeArray;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRandomGraphSource;\nimport vtk.vtkSelection;\nimport vtk.vtkSelectionNode;\n\n/*\n * Java language example to select edges and vertices from a generated Graph.\n */\npublic class SelectGraphVertices {\n\n  static SelectGraphVertices me;\n\n  /*\n   * The following static calls will load the respective\n   * vtkJava interface libraries on first reference to this\n   * class.\n   */\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  /**\n   * All Java programs require a host class. in addition,\n   * these two instance variables provide access to the\n   * callback data used in this example.\n   */\n  vtkGraphLayoutView view;\n  vtkAnnotationLink link;\n\n  /*\n   * primary test driver, creates an instance of this class\n   * and then runs the example function.\n   */\n  public static void main(String[] args) {\n\n    me = new SelectGraphVertices();\n    me.doit();\n  }\n\n  /*\n   * doit creates local objects and instantiates instance variables\n   */\n  public void doit() {\n    vtkRandomGraphSource source = new vtkRandomGraphSource();\n    source.Update();\n\n    view = new vtkGraphLayoutView();\n    view.AddRepresentationFromInputConnection(source.GetOutputPort());\n    /*\n     * This was described as vtkRenderedGraphRepresentation in the python example,\n     * but the java type returns it as vtkDataRepresentation.\n     */\n    vtkDataRepresentation rep = view.GetRepresentation(0);\n\n    /*\n     * The vtkDataRepresentation should already have a vtkAnnotationLink,\n     * so we just want to grab it and add an observer with our callback function attached\n     * Note that Java callbacks use the this \"pointer\" to anchor vtk objects used by the callback\n     * to establish references to required vtkobjects.\n     */\n    link = rep.GetAnnotationLink();\n    link.AddObserver(\"AnnotationChangedEvent\", this, \"selectionCallback\");\n\n    view.GetRenderWindow().SetSize(600, 600);\n    view.ResetCamera();\n    view.Render();\n    view.GetInteractor().Start();\n\n  }\n\n  /*\n   * The Java callback signature has no parameters. This complicates some\n   * vtk processes by eliminating the eventid and user data normally available\n   * to C++ logic.\n   */\n  public void selectionCallback() {\n    // In C++ there is some extra data passed to the callback, but in Python\n    // the callback data is lost...\n\n    // There can be two selection nodes, but which one is vertices and which is edges\n    // does not seem to be guaranteed...\n    System.out.println(\"in selection callback\");\n\n    vtkSelection sel = link.GetCurrentSelection();\n    vtkSelectionNode node0 = sel.GetNode(0);\n    int node0_field_type = node0.GetFieldType();\n\n    vtkIdTypeArray sel_list0 = (vtkIdTypeArray) (link.GetCurrentSelection().GetNode(0).GetSelectionList());\n\n    vtkSelectionNode node1 = sel.GetNode(1);\n    int node1_field_type = node1.GetFieldType();\n\n    vtkIdTypeArray sel_list1 = (vtkIdTypeArray) (link.GetCurrentSelection().GetNode(1).GetSelectionList());\n\n    if (sel_list0.GetNumberOfTuples() > 0) {\n      printFieldType(node0_field_type);\n      for (int ii = 0; ii < sel_list0.GetNumberOfTuples(); ii++) {\n        System.out.print(\"\\t\" + sel_list0.GetValue(ii));\n      }\n      System.out.println(\" - on list 0.\");\n    }\n    if (sel_list1.GetNumberOfTuples() > 0) {\n      printFieldType(node1_field_type);\n      for (int ii = 0; ii < sel_list1.GetNumberOfTuples(); ii++) {\n        System.out.print(\"\\t\" + sel_list1.GetValue(ii));\n      }\n      System.out.println(\" - on list 1.\");\n    }\n    System.out.println(\"- - -\");\n\n  }\n\n  public void printFieldType(int field_type) {\n    if (field_type == 3)\n      System.out.print(\"Vertices Selected:\");\n    else if (field_type == 4)\n      System.out.print(\"Edges Selected:\");\n    else\n      System.out.print(\"Unknown type:\");\n  }\n\n}\n
        "},{"location":"Java/Graphs/VisualizeGraph/","title":"VisualizeGraph","text":"

        vtk-examples/Java/Graphs/VisualizeGraph

        "},{"location":"Java/Graphs/VisualizeGraph/#description","title":"Description","text":"

        This example shows how to construct a graph and visualize it using vtkMutableUndirectedGraph which is an undirected graph with additional functions for adding vertices and edges You can select edges and vertices with the mouse.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Graphs/VisualizeGraph/#code","title":"Code","text":"

        VisualizeGraph.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkGraphLayoutView;\nimport vtk.vtkMutableUndirectedGraph;\nimport vtk.vtkSimple2DLayoutStrategy;\n\npublic class VisualizeGraph \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values())\n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n      vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkMutableUndirectedGraph G = new vtkMutableUndirectedGraph();\n    int v1 = G.AddVertex();\n    int v2 = G.AddVertex();\n\n    G.AddGraphEdge(v1, v2);\n    G.AddGraphEdge(v1, v2);\n\n    vtkGraphLayoutView GraphLayoutView = new vtkGraphLayoutView();\n    GraphLayoutView.AddRepresentationFromInput(G);\n    GraphLayoutView.SetLayoutStrategy(\"Simple 2D\");\n    GraphLayoutView.ResetCamera();\n    GraphLayoutView.Render();\n\n\n    vtkSimple2DLayoutStrategy Simple2DLayoutStrategy = new vtkSimple2DLayoutStrategy();\n    Simple2DLayoutStrategy.SetRandomSeed(0);\n    GraphLayoutView.GetLayoutStrategy();\n    GraphLayoutView.GetInteractor().Start();\n\n  }\n\n}\n
        "},{"location":"Java/HyperTreeGrid/HyperTreeGridSource/","title":"HyperTreeGridSource","text":"

        vtk-examples/Java/HyperTreeGrid/HyperTreeGridSource

        "},{"location":"Java/HyperTreeGrid/HyperTreeGridSource/#description","title":"Description","text":"

        Java Program to Demonstrate Hyper Tree Grid Source.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/HyperTreeGrid/HyperTreeGridSource/#code","title":"Code","text":"

        HyperTreeGridSource.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkActor;\nimport vtk.vtkHyperTreeGridSource;\nimport vtk.vtkShrinkFilter;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkNamedColors;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class HyperTreeGridSource  {\n\n  //private static final long serialVersionUID = 1L;\n\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Burlywood\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Teal\",BgColor);\n\n\n    // Create hyper tree grid source\n    vtkHyperTreeGridSource Source = new vtkHyperTreeGridSource();\n    Source.SetMaximumLevel(6);\n    Source.SetGridSize(3, 3, 2);\n    Source.SetGridScale(1.5, 1.0, 0.7);\n    Source.SetDimension(3);\n    Source.SetBranchFactor(4);\n    Source.SetDescriptor(\"RRR .R. .RR ..R ..R .R.|R.......................... ........................... ........................... .............R............. ....RR.RR........R......... .....RRRR.....R.RR......... ........................... ........................... ...........................|........................... ........................... ........................... ...RR.RR.......RR.......... ........................... RR......................... ........................... ........................... ........................... ........................... ........................... ........................... ........................... ............RRR............|........................... ........................... .......RR.................. ........................... ........................... ........................... ........................... ........................... ........................... ........................... ...........................|........................... ...........................\" );\n    Source.Update();\n\n    vtkShrinkFilter Shrink = new vtkShrinkFilter();\n    Shrink.SetInputConnection(Source.GetOutputPort());\n    Shrink.SetShrinkFactor(0.8);\n\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputConnection(Shrink.GetOutputPort());\n    Mapper.ScalarVisibilityOff();\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetDiffuseColor(ActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n    ren.GetActiveCamera().Azimuth(150);\n    ren.GetActiveCamera().Elevation(130);\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n\n  }\n} \n
        "},{"location":"Java/IO/ConvertFile/","title":"ConvertFile","text":"

        vtk-examples/Java/IO/ConvertFile

        "},{"location":"Java/IO/ConvertFile/#description","title":"Description","text":"

        This example demonstrates how to read a file and then write it to a different type of file.

        In this example, we read a vtp file and write a ply file, but simply by changing the reader/writer classes instantiated, different behavior can be achieved.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ConvertFile/#code","title":"Code","text":"

        ConvertFile.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkPLYWriter;\nimport vtk.vtkXMLPolyDataReader;\n\npublic class ConvertFile\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n   }\n  vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------  \n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 2) \n    {\n      System.err.println(\"Usage: java -classpath ... InputVTP Filename(.vtp) OutputFilename(.ply) e.g input.vtp output.ply\");\n      return;\n    } \n\n    String inputFileName = args[0];\n    String outputFileName = args[1];\n\n    vtkXMLPolyDataReader reader = new vtkXMLPolyDataReader();\n    reader.SetFileName(inputFileName);\n    reader.Update();\n\n    vtkPLYWriter writer = new vtkPLYWriter();\n    writer.SetFileName(outputFileName);\n    writer.SetInputConnection(reader.GetOutputPort());\n    writer.Update();\n  }\n}\n
        "},{"location":"Java/IO/DEMReader/","title":"DEMReader","text":"

        vtk-examples/Java/IO/DEMReader

        "},{"location":"Java/IO/DEMReader/#description","title":"Description","text":"

        vtkDEMReader object reads digital elevation files and creates image data.

        The reader reads the entire dem file and create a vtkImageData that contains a single scalar component that is the elevation in meters. The spacing is also expressed in meters.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/DEMReader/#code","title":"Code","text":"

        DEMReader.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkDEMReader;\nimport vtk.vtkLookupTable;\nimport vtk.vtkImageMapToColors;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\npublic class DEMReader \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.dem) e.g SainteHelens.dem\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    //Read the file\n    vtkDEMReader reader = new vtkDEMReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkLookupTable lut = new vtkLookupTable();\n    lut.SetHueRange(0.6, 0);\n    lut.SetSaturationRange(1.0, 0);\n    lut.SetValueRange(0.5, 1.0);\n    lut.SetTableRange(reader.GetOutput().GetScalarRange());\n\n    //Visualize\n    vtkImageMapToColors mapColors = new vtkImageMapToColors();\n    mapColors.SetLookupTable(lut);\n    mapColors.SetInputConnection(reader.GetOutputPort());\n\n    //Create an actor\n    vtkImageActor actor = new vtkImageActor();\n    actor.GetMapper().SetInputConnection(mapColors.GetOutputPort());\n\n    //Setup renderer\n    vtkRenderer renderer = new vtkRenderer();\n    renderer.AddActor(actor);\n    renderer.ResetCamera();\n\n    //Setup render window\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.AddRenderer(renderer);\n\n    //Setup render window interactor\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n\n    renderWindowInteractor.SetInteractorStyle(style);\n\n    //Render and start interaction\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n    renderWindow.Render();\n\n    renderWindowInteractor.Initialize();\n    renderWindowInteractor.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/JPEGReader/","title":"JPEGReader","text":"

        vtk-examples/Java/IO/JPEGReader

        "},{"location":"Java/IO/JPEGReader/#description","title":"Description","text":"

        vtkJPEGReader is a source object that reads JPEG/JPG files.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/JPEGReader/#code","title":"Code","text":"

        JPEGReader.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkJPEGReader;\nimport vtk.vtkImageViewer2;\n\npublic class JPEGReader\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.jpg) e.g Pileated.jpg \");\n      return;\n    }\n\n    String inputFilename = args[0];\n\n    //Read the image\n    vtkJPEGReader jpegReader = new vtkJPEGReader();\n    jpegReader.SetFileName (inputFilename);\n\n    // Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection( jpegReader.GetOutputPort() );\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n  }\n}\n
        "},{"location":"Java/IO/JPEGWriter/","title":"JPEGWriter","text":"

        vtk-examples/Java/IO/JPEGWriter

        "},{"location":"Java/IO/JPEGWriter/#description","title":"Description","text":"

        Example Program to demonstrate the use of vtkJPEGWriter. vtkJPEGWriter writes JPEG files. It supports 1 and 3 component data of unsigned char.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/JPEGWriter/#code","title":"Code","text":"

        JPEGWriter.java

        import vtk.vtkImageCanvasSource2D;\nimport vtk.vtkJPEGWriter;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\n\npublic class JPEGWriter \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n    double bkgColor[] = new double[] {255, 0,0,1};\n    double boxColor[] = new double[] {255,255,0,1};\n\n    colors.SetColor(\"bkgColor\", bkgColor);\n    colors.SetColor(\"boxColor\", boxColor);\n\n\n     // Provide default values.\n     String fileName = \"Output.jpg\";\n     for(int i = 0; i < args.length; ++i)\n     {\n       switch (i) \n       {\n         case 0:\n         fileName = args[i];\n     break;\n       }\n    }\n\n    vtkImageCanvasSource2D ImageSource = new vtkImageCanvasSource2D();\n    ImageSource.SetExtent(0, 99, 0, 99, 0, 0);\n\n    //vtkJPEGWriter only accepts unsigned char input\n    ImageSource.SetScalarTypeToUnsignedChar();\n\n    //3 color channels: Red, Green and Blue\n    ImageSource.SetNumberOfScalarComponents(3);\n\n    //Fill the whole image with a blue background\n    ImageSource.SetDrawColor(bkgColor);\n    ImageSource.FillBox(0, 99, 0, 99);\n\n    //Paint a 30x30 white square into the image\n    ImageSource.SetDrawColor(boxColor);\n    ImageSource.FillBox(40, 70, 20, 50);\n\n    vtkJPEGWriter Writer = new vtkJPEGWriter();\n    Writer.SetFileName(fileName);\n    Writer.SetInputConnection(ImageSource.GetOutputPort());\n    Writer.Write();\n\n  }\n}\n
        "},{"location":"Java/IO/PNGReader/","title":"PNGReader","text":"

        vtk-examples/Java/IO/PNGReader

        "},{"location":"Java/IO/PNGReader/#description","title":"Description","text":"

        vtkPNGReader is a source object that reads PNG files.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/PNGReader/#code","title":"Code","text":"

        PNGReader.java

        import vtk.vtkImageViewer2;\nimport vtk.vtkPNGReader;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class PNGReader \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) {\n      System.err.println(\"Usage: java -classpath ... Filename(.png) e.g Gourds.png\");\n      return;\n    }\n    //  Read the image\n    vtkPNGReader reader = new vtkPNGReader();\n    reader.SetFileName(args[0]);\n\n    //  Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection(reader.GetOutputPort());\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n  }\n}\n
        "},{"location":"Java/IO/ParticleReader/","title":"ParticleReader","text":"

        vtk-examples/Java/IO/ParticleReader

        "},{"location":"Java/IO/ParticleReader/#description","title":"Description","text":"

        vtkParticleReader object reads either a binary or a text file of particles.

        Each particle can have associated with it an optional scalar value. So the format is: x, y, z, scalar (all floats or doubles). The text file can consist of a comma delimited set of values.

        In most cases vtkParticleReader can automatically determine whether the file is text or binary.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ParticleReader/#code","title":"Code","text":"

        ParticleReader.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkParticleReader;\n\npublic class ParticleReader\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.raw) e.g Particles.raw\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Navy\",BgColor);\n\n    // Read the file\n    vtkParticleReader reader = new vtkParticleReader();\n    reader.SetFileName(Filename);\n    reader.SetDataByteOrderToBigEndian();\n    reader.Update();\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n    System.out.println(\"number of pieces:\" + \" \" + mapper.GetNumberOfPieces());\n    mapper.SetScalarRange(4, 9);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetPointSize(4);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/ReadBMP/","title":"ReadBMP","text":"

        vtk-examples/Java/IO/ReadBMP

        "},{"location":"Java/IO/ReadBMP/#description","title":"Description","text":"

        vtkBMPReader is a source object that reads Windows BMP files. This includes indexed and 24 bit bitmaps Usually, all BMPs are converted to 24 bit RGB, but BMPs may be output as 8 bit images with a LookupTable if they allow 8 bit BMP flag is set.

        BMPReader creates structured point datasets. The dimension of the dataset depends upon the number of files read. Reading a single file results in a 2D image, while reading more than one file results in a 3D volume.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadBMP/#code","title":"Code","text":"

        ReadBMP.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkImageViewer2;\nimport vtk.vtkBMPReader;\n\n\npublic class ReadBMP \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.bmp) e.g masonry.bmp\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkBMPReader reader = new vtkBMPReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection(reader.GetOutputPort());\n    vtkRenderWindowInteractor renderWindowInteractor =new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n\n   }\n}\n
        "},{"location":"Java/IO/ReadCML/","title":"ReadCML","text":"

        vtk-examples/Java/IO/ReadCML

        "},{"location":"Java/IO/ReadCML/#description","title":"Description","text":"

        This example uses vtkCMLMoleculeReader to read a Chemistry Markup Language file. CML has been developed by Peter Murray-Rust and Henry Rzepa since 1995. It is the de facto XML for chemistry, accepted by publishers and with more than 1 million lines of Open Source code supporting it.

        Info

        This example uses the file porphyrin.cml. A description of the molecule Porphyrin is described here.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadCML/#code","title":"Code","text":"

        ReadCML.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkCMLMoleculeReader;\nimport vtk.vtkMoleculeMapper;\n\npublic class ReadCML \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.cml) e.g porphyrin.cml\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Silver\", Bgcolor);\n\n    vtkCMLMoleculeReader cmlSource = new vtkCMLMoleculeReader();\n\n    cmlSource.SetFileName(inputFilename);\n\n    vtkMoleculeMapper molmapper = new vtkMoleculeMapper();\n    molmapper.SetInputConnection(cmlSource.GetOutputPort());\n\n    molmapper.UseBallAndStickSettings();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(molmapper);\n    actor.GetProperty().SetDiffuse(.7);\n    actor.GetProperty().SetSpecular(.5);\n    actor.GetProperty().SetSpecularPower(20.0);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.SetMultiSamples(0);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/IO/ReadDICOM/","title":"ReadDICOM","text":"

        vtk-examples/Java/IO/ReadDICOM

        "},{"location":"Java/IO/ReadDICOM/#description","title":"Description","text":"

        vtkDICOMImageReader object is used read to DICOM images.

        DICOM (stands for Digital Imaging in COmmunications and Medicine) is a medical image file format widely used to exchange data, provided by various modalities. Here is an example data set.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadDICOM/#code","title":"Code","text":"

        ReadDICOM.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkImageViewer2;\nimport vtk.vtkDICOMImageReader;\n\n\npublic class ReadDICOM \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.img) e.g prostate.img\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkDICOMImageReader reader = new vtkDICOMImageReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection(reader.GetOutputPort());\n    vtkRenderWindowInteractor renderWindowInteractor =new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n\n   }\n}\n
        "},{"location":"Java/IO/ReadOBJ/","title":"ReadOBJ","text":"

        vtk-examples/Java/IO/ReadOBJ

        "},{"location":"Java/IO/ReadOBJ/#description","title":"Description","text":"

        This example demonstrates how to read a Wavefront OBJ file. The result is displayed.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadOBJ/#code","title":"Code","text":"

        ReadOBJ.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkOBJReader;\n\npublic class ReadOBJ \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.obj) e.g trumpet.obj\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"HoneyDew\", actorColor);\n    colors.GetColor(\"SpringGreen\", Bgcolor);\n\n    vtkOBJReader reader = new vtkOBJReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetDiffuseColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(30);\n    ren.GetActiveCamera().Elevation(30);\n    ren.GetActiveCamera().Dolly(1.5);\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/IO/ReadPLOT3D/","title":"ReadPLOT3D","text":"

        vtk-examples/Java/IO/ReadPLOT3D

        "},{"location":"Java/IO/ReadPLOT3D/#description","title":"Description","text":"

        vtkMultiBlockPLOT3DReader is a reader object that reads PLOT3D formatted files and generates structured grid(s) on output.

        PLOT3D is a computer graphics program designed to visualize the grids and solutions of computational fluid dynamics.

        PLOT3D files consist of a grid file (also known as XYZ file), an optional solution file (also known as a Q file), and an optional function file that contains user created data (currently unsupported).

        The Q file contains solution information as follows: the four parameters free stream mach number (Fsmach), angle of attack (Alpha), Reynolds number (Re), and total integration time (Time). This information is stored in an array called Properties in the FieldData of each output (tuple 0: fsmach, tuple 1: alpha, tuple 2: re, tuple 3: time). In addition, the solution file contains the flow density (scalar), flow momentum (vector), and flow energy (scalar).

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadPLOT3D/#code","title":"Code","text":"

        ReadPLOT3D.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkMultiBlockPLOT3DReader;\nimport vtk.vtkStructuredGridGeometryFilter;\n\n\npublic class ReadPLOT3D\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 2) \n    {\n      System.err.println(\"Usage: java -classpath ... XYZFilename(.bin) QFileName(.bin) e.g combxyz.bin combq.bin\");\n      return;\n    }\n    String xyzFilename = args[0];\n    String qFilename = args[1];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkMultiBlockPLOT3DReader reader = new vtkMultiBlockPLOT3DReader();\n    reader.SetXYZFileName(xyzFilename);\n    reader.SetQFileName(qFilename);\n    reader.SetScalarFunctionNumber(100);\n    reader.SetVectorFunctionNumber(202);\n    reader.Update();\n\n    vtkStructuredGridGeometryFilter geometryFilter = new vtkStructuredGridGeometryFilter();\n    geometryFilter.SetInputData(reader.GetOutput().GetBlock(0));\n    geometryFilter.Update();\n\n    // Visualize\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(geometryFilter.GetOutputPort());\n    mapper.ScalarVisibilityOff();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/ReadPLY/","title":"ReadPLY","text":"

        vtk-examples/Java/IO/ReadPLY

        "},{"location":"Java/IO/ReadPLY/#description","title":"Description","text":"

        vtkPLYReader is a source object that reads polygonal data in Stanford University PLY file format (see http://graphics.stanford.edu/data/3Dscanrep). It requires that the elements \"vertex\" and \"face\" are defined.

        The \"vertex\" element must have the properties \"x\", \"y\", and \"z\". The \"face\" element must have the property \"vertex_indices\" defined.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadPLY/#code","title":"Code","text":"

        ReadPLY.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPLYReader;\n\npublic class ReadPLY \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.ply) e.g shark.ply\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkPLYReader reader = new vtkPLYReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/ReadPNM/","title":"ReadPNM","text":"

        vtk-examples/Java/IO/ReadPNM

        "},{"location":"Java/IO/ReadPNM/#description","title":"Description","text":"

        vtkPNMReader is a source object that reads pnm (portable anymap) files. This includes .pbm (bitmap), .pgm (grayscale), and .ppm (pixmap) files. (Currently this object only reads binary versions of these files.)

        PNMReader creates structured point datasets. The dimension of the dataset depends upon the number of files read. Reading a single file results in a 2D image, while reading more than one file results in a 3D volume.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadPNM/#code","title":"Code","text":"

        ReadPNM.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkPNMReader;\nimport vtk.vtkImageViewer2;\n\n\npublic class ReadPNM \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.pnm) e.g Gourds.pnm\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkPNMReader reader = new vtkPNMReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection(reader.GetOutputPort());\n    vtkRenderWindowInteractor renderWindowInteractor =new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n\n   }\n}\n
        "},{"location":"Java/IO/ReadPolyData/","title":"ReadPolyData","text":"

        vtk-examples/Java/IO/ReadPolyData

        "},{"location":"Java/IO/ReadPolyData/#description","title":"Description","text":"

        vtkXMLPolyDataReader object reads the VTK XML PolyData file format. One polygonal data file can be read to produce one output. Streaming is supported. The standard extension for this reader's file format is \"vtp\". This reader is also used to read a single piece of the parallel file format.

        An example data set can be found at src/Testing/Data/Torso.vtp.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadPolyData/#code","title":"Code","text":"

        ReadPolyData.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkXMLPolyDataReader;\nimport vtk.vtkDataSetMapper;\n\npublic class ReadPolyData {\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) {\n\n    //parse command line arguments\n    if (args.length != 1) {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtp) e.g Torso.vtp\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bkg[] = new double[4];\n    double ActorColor[] = new double[4];\n\n    Color.GetColor(\"Teal\", Bkg);\n    Color.GetColor(\"BurlyWood\", ActorColor);\n\n    vtkXMLPolyDataReader reader = new vtkXMLPolyDataReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(ActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(Bkg);\n    ren.GetActiveCamera().Pitch(90);\n    ren.GetActiveCamera().SetViewUp(0, 0, 1);\n    ren.ResetCamera();\n\n    renWin.SetSize(600, 600);\n    renWin.Render();\n    renWin.SetWindowName(\"ReadPolyData\");\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/ReadRectilinearGrid/","title":"ReadRectilinearGrid","text":"

        vtk-examples/Java/IO/ReadRectilinearGrid

        "},{"location":"Java/IO/ReadRectilinearGrid/#description","title":"Description","text":"

        vtkXMLRectilinearGridReader object reads the VTK XML RectilinearGrid file format.

        One rectilinear grid file can be read to produce one output. Streaming is supported. The standard extension for this reader's file format is \"vtr\". This reader is also used to read a single piece of the parallel file format.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadRectilinearGrid/#code","title":"Code","text":"

        ReadRectilinearGrid.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkXMLRectilinearGridReader;\nimport vtk.vtkDataSetMapper;\n\npublic class ReadRectilinearGrid\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtr) e.g RectilinearGrid.vtr\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkXMLRectilinearGridReader reader = new vtkXMLRectilinearGridReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetRepresentationToWireframe();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/ReadSLC/","title":"ReadSLC","text":"

        vtk-examples/Java/IO/ReadSLC

        "},{"location":"Java/IO/ReadSLC/#description","title":"Description","text":"

        In this example you will familiarize yourself with the stages required to read a .slc file and create a visualization pipeline in VTK. Following is the three step procedure:

        1. Read the data from .slc file using vtkSLCReader

        2. Implement Marching cubes Algorithm using vtkContourFilter

        3. Create Visualization pipeline to visualize data using an actor, mapper and rendering window

        Cite

        This example was provided by Bharatesh Chakravarthi from Virtual Environment Lab, Chung-Ang University, Seoul, South Korea

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadSLC/#code","title":"Code","text":"

        ReadSLC.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSLCReader;\nimport vtk.vtkContourFilter;\nimport vtk.vtkOutlineFilter;\nimport vtk.vtkExtractVOI;\n\n\npublic class  ReadSLC \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 2) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.slc) e.g vw_knee.slc\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    double isoValue = 72.0;\n    if (args.length != 2)\n    {\n      isoValue = 72.0;\n    }\n    else\n    {\n      isoValue = Integer.valueOf(args[1]);\n    }\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Ivory\", actorColor);\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    //Using vtkSLCReader to read Volumetric file format(<filename.slc>)\n    vtkSLCReader reader = new vtkSLCReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Implementing Marching Cubes Algorithm to create the surface using vtkContourFilter object \n    vtkContourFilter cFilter = new vtkContourFilter();\n    cFilter.SetInputConnection(reader.GetOutputPort());\n\n    // Change the range(2nd and 3rd Paramater) based on your\n    // requirement. recomended value for 1st parameter is above 1\n    // cFilter.GenerateValues(5, 80.0, 100.0); \n    cFilter.SetValue(0, isoValue);\n    cFilter.Update();\n\n    //Adding the outliner using vtkOutlineFilter object\n    vtkOutlineFilter outliner = new vtkOutlineFilter();\n    outliner.SetInputConnection(reader.GetOutputPort());\n    outliner.Update();\n\n    // Visualize\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(cFilter.GetOutputPort());\n    mapper.SetScalarVisibility(0);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetDiffuse(.8);\n    actor.GetProperty().SetDiffuseColor(actorColor);\n    actor.GetProperty().SetSpecular(.8);\n    actor.GetProperty().SetSpecularPower(120.0);\n\n    //extractVOI is used to fix the problem of subsampling of data and reduce slow interaction and increase loading speed\n    vtkExtractVOI extractVOI = new vtkExtractVOI();\n    extractVOI.SetInputConnection(reader.GetOutputPort());\n    extractVOI.SetSampleRate(2, 2, 2);\n    extractVOI.Update();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 512);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/IO/ReadSTL/","title":"ReadSTL","text":"

        vtk-examples/Java/IO/ReadSTL

        "},{"location":"Java/IO/ReadSTL/#description","title":"Description","text":"

        vtkSTLReader is a source object that reads ASCII or binary stereo lithography files (.stl files). The FileName must be specified to vtkSTLReader. The object automatically detects whether the file is ASCII or binary.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadSTL/#code","title":"Code","text":"

        ReadSTL.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSTLReader;\n\npublic class ReadSTL \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.stl) e.g 42400-IDGH.stl\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkSTLReader reader = new vtkSTLReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/ReadStructuredGrid/","title":"ReadStructuredGrid","text":"

        vtk-examples/Java/IO/ReadStructuredGrid

        "},{"location":"Java/IO/ReadStructuredGrid/#description","title":"Description","text":"

        vtkXMLStructuredGridReader object reads the VTK XML StructuredGrid file format. One structured grid file can be read to produce one output. Streaming is supported. The standard extension for this reader's file format is \"vts\". This reader is also used to read a single piece of the parallel file format.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadStructuredGrid/#code","title":"Code","text":"

        ReadStructuredGrid.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkXMLStructuredGridReader;\nimport vtk.vtkStructuredGridGeometryFilter;\n\npublic class ReadStructuredGrid \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vts) e.g StructuredGrid.vts\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkXMLStructuredGridReader reader = new vtkXMLStructuredGridReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkStructuredGridGeometryFilter geometryFilter = new vtkStructuredGridGeometryFilter();\n    geometryFilter.SetInputConnection(reader.GetOutputPort());\n    geometryFilter.Update();\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(geometryFilter.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetPointSize(3);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/ReadTIFF/","title":"ReadTIFF","text":"

        vtk-examples/Java/IO/ReadTIFF

        "},{"location":"Java/IO/ReadTIFF/#description","title":"Description","text":"

        vtkTIFFReader is a source object that reads Tagged Image File Format (TIFF) files. It should be able to read almost any TIFF file.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadTIFF/#code","title":"Code","text":"

        ReadTIFF.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkImageViewer2;\nimport vtk.vtkTIFFReader;\n\n\npublic class ReadTIFF \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.tif) e.g ColorCells.tif\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkTIFFReader reader = new vtkTIFFReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Visualize\n    vtkImageViewer2 imageViewer = new vtkImageViewer2();\n    imageViewer.SetInputConnection(reader.GetOutputPort());\n    vtkRenderWindowInteractor renderWindowInteractor =new vtkRenderWindowInteractor();\n    imageViewer.SetupInteractor(renderWindowInteractor);\n    imageViewer.Render();\n    imageViewer.GetRenderer().ResetCamera();\n    imageViewer.Render();\n\n    renderWindowInteractor.Start();\n\n   }\n}\n
        "},{"location":"Java/IO/ReadVTP/","title":"ReadVTP","text":"

        vtk-examples/Java/IO/ReadVTP

        Other languages

        See (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ReadVTP/#code","title":"Code","text":"

        ReadVTP.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkXMLPolyDataReader;\n\npublic class ReadVTP {\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args) {\n    //parse command line arguments\n    if (args.length != 1) {\n      System.err.println(\"Usage: java -classpath ... ReadVTP Filename(.vtp) e.g horse.vtp\");\n      return;\n    }\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[4];\n    double actorColor[] = new double[4];\n    colors.GetColor(\"AliceBlue\", bkg);\n    colors.GetColor(\"Tan\", actorColor);\n\n    String filename = args[0];\n\n    //read all the data from the file\n    vtkXMLPolyDataReader reader = new vtkXMLPolyDataReader();\n    reader.SetFileName(filename);\n    reader.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(actorColor);\n\n    //Create a renderer, render window, and interactor\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Add the actor to the scene\n    ren.AddActor(actor);\n    ren.SetBackground(bkg);\n\n    //Render and interact\n\n    iren.Initialize();\n    renWin.Render();\n    ren.GetActiveCamera().SetPosition(-0.5, 0.1, 0.0);\n    ren.GetActiveCamera().SetViewUp(0.1, 0.0, 1.0);\n    renWin.Render();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/IO/SimplePointsReader/","title":"SimplePointsReader","text":"

        vtk-examples/Java/IO/SimplePointsReader

        "},{"location":"Java/IO/SimplePointsReader/#description","title":"Description","text":"

        A file of XYZ coordinates is a very easy format that can be used for simple storage from many applications. This example demonstrates how to read this type of file into a polydata object. An example file of three points would look like this:

        0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0

        As a demo, save the above three lines to a file called simple.xyz

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/SimplePointsReader/#code","title":"Code","text":"

        SimplePointsReader.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSimplePointsReader;\n\npublic class SimplePointsReader \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.xyz) e.g simple.xyz\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkSimplePointsReader reader = new vtkSimplePointsReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetPointSize(5);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/SimplePointsWriter/","title":"SimplePointsWriter","text":"

        vtk-examples/Java/IO/SimplePointsWriter

        "},{"location":"Java/IO/SimplePointsWriter/#description","title":"Description","text":"

        vtkSimplePointsWriter object writes a simple file of xyz coordinates.

        Seealso

        For the opposite operation (reading a points file) see the SimplePointsReader example.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/SimplePointsWriter/#code","title":"Code","text":"

        SimplePointsWriter.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkSphereSource;\nimport vtk.vtkSimplePointsWriter;\n\npublic class SimplePointsWriter \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.xyz) e.g SimplePointWriter.xyz\");\n      return;\n    }\n    String inputFilename = args[0];\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkSimplePointsWriter writer = new vtkSimplePointsWriter();\n    writer.SetFileName(inputFilename);\n    writer.SetInputConnection(sphereSource.GetOutputPort());\n    writer.Write();\n\n  }\n}\n
        "},{"location":"Java/IO/StructuredPointsReader/","title":"StructuredPointsReader","text":"

        vtk-examples/Java/IO/StructuredPointsReader

        "},{"location":"Java/IO/StructuredPointsReader/#description","title":"Description","text":"

        vtkStructuredPointsReader is a source object that reads ASCII or binary structured points data files in vtk format.

        The output of this reader is a single vtkStructuredPoints data object.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/StructuredPointsReader/#code","title":"Code","text":"

        StructuredPointsReader.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkStructuredPointsReader;\nimport vtk.vtkImageDataGeometryFilter;\n\n\npublic class StructuredPointsReader\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtk) e.g StructuredPoints.vtk\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    // Read the file\n    vtkStructuredPointsReader reader = new vtkStructuredPointsReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    vtkImageDataGeometryFilter geometryFilter = new vtkImageDataGeometryFilter();\n    geometryFilter.SetInputConnection(reader.GetOutputPort());\n    geometryFilter.Update();\n\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(geometryFilter.GetOutputPort());\n\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetPointSize(4);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/ThreeDSImporter/","title":"ThreeDSImporter","text":"

        vtk-examples/Java/IO/ThreeDSImporter

        "},{"location":"Java/IO/ThreeDSImporter/#description","title":"Description","text":"

        vtk3DSImporter object imports 3D Studio files into vtk.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/ThreeDSImporter/#code","title":"Code","text":"

        ThreeDSImporter.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkActorCollection;\nimport vtk.vtk3DSImporter;\nimport vtk.vtkCamera;\n\npublic class ThreeDSImporter\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.3ds) e.g iflamingo.3ds\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    double BgColor2[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Gold\",BgColor);\n    Color.GetColor(\"Wheat\",BgColor2);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtk3DSImporter importer = new vtk3DSImporter();\n    importer.SetFileName(inputFilename);\n    importer.ComputeNormalsOn();\n\n    renWin.AddRenderer(ren);\n    ren.SetBackground2 (BgColor);\n    ren.SetBackground (BgColor2);\n    ren.GradientBackgroundOn();\n\n    importer.SetRenderWindow(renWin);\n    importer.Update();\n\n    vtkActorCollection actors = new vtkActorCollection();\n    actors = ren.GetActors();\n    System.out.println(\"There are\" + \" \" + actors.GetNumberOfItems() + \" \" + \"actors\");\n\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    vtkCamera camera = new vtkCamera();\n    camera.SetPosition (0, -1, 0);\n    camera.SetFocalPoint (0, 0, 0);\n    camera.SetViewUp (0, 0, 1);\n    camera.Azimuth(150);\n    camera.Elevation(30);\n\n    ren.SetActiveCamera(camera);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/VRMLImporter/","title":"VRMLImporter","text":"

        vtk-examples/Java/IO/VRMLImporter

        "},{"location":"Java/IO/VRMLImporter/#description","title":"Description","text":"

        This example loads a wrl file and displays it on the screen. An example file is src/Testing/Data/sextant.wrl.

        Warning

        The vtkVRMLImporter only imports VRML 2.0 files.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/VRMLImporter/#code","title":"Code","text":"

        VRMLImporter.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkActorCollection;\nimport vtk.vtkVRMLImporter;\n\npublic class VRMLImporter\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.wrl) e.g sextant.wrl\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Burlywood\",BgColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // VRML Import\n    vtkVRMLImporter importer = new vtkVRMLImporter();\n    importer.SetFileName (inputFilename);\n    importer.SetRenderWindow(renWin);\n    importer.Update();\n\n    vtkActorCollection actors = new vtkActorCollection();\n    actors = ren.GetActors();\n    System.out.println(\"There are\" + \" \" + actors.GetNumberOfItems() + \" actors\");\n\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/WritePLY/","title":"WritePLY","text":"

        vtk-examples/Java/IO/WritePLY

        "},{"location":"Java/IO/WritePLY/#description","title":"Description","text":"

        vtkPLYWriter object writes polygonal data in Stanford University PLY format.

        The data can be written in either binary (little or big endian) or ASCII representation. As for PointData and CellData, vtkPLYWriter cannot handle normals or vectors. It only handles RGB PointData and CellData

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/WritePLY/#code","title":"Code","text":"

        WritePLY.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPLYReader;\nimport vtk.vtkPLYWriter;\nimport vtk.vtkSphereSource;\n\npublic class WritePLY\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.ply) e.g sphere.ply\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkPLYWriter plyWriter = new vtkPLYWriter();\n    plyWriter.SetFileName(Filename);\n    plyWriter.SetInputConnection(sphereSource.GetOutputPort());\n    plyWriter.Write();\n\n    //Read and display for verification\n    vtkPLYReader reader = new vtkPLYReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/WritePNM/","title":"WritePNM","text":"

        vtk-examples/Java/IO/WritePNM

        "},{"location":"Java/IO/WritePNM/#description","title":"Description","text":"

        vtkPNMWriter objects writes Portable Any Map (PNM) file.

        The PNM format is just an abstraction of the PBM, PGM, and PPM formats.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/WritePNM/#code","title":"Code","text":"

        WritePNM.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkPNMWriter;\nimport vtk.vtkPNMReader;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\n\npublic class WritePNM\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.pnm) e.g OutputFile.pnm\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkImageCanvasSource2D imageSource = new vtkImageCanvasSource2D();\n    imageSource.SetScalarTypeToUnsignedChar();\n    imageSource.SetExtent(0,9,0,9,0,0);\n    imageSource.SetNumberOfScalarComponents(3);\n    imageSource.SetDrawColor(0, 0, 0, 0);\n    imageSource.FillBox(0,9,0,9);\n    imageSource.SetDrawColor(255, 0, 0, 0);\n    imageSource.FillBox(5,7,5,7);\n    imageSource.Update();\n\n    vtkPNMWriter pnmWriter = new vtkPNMWriter();\n    pnmWriter.SetFileName(Filename);\n    pnmWriter.SetInputConnection(imageSource.GetOutputPort());\n    pnmWriter.Write();\n\n    // Read and display for verification\n    vtkPNMReader reader = new vtkPNMReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    vtkImageActor actor = new vtkImageActor();\n    actor.GetMapper().SetInputConnection(reader.GetOutputPort());\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n    iren.SetInteractorStyle(style);\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/WriteSTL/","title":"WriteSTL","text":"

        vtk-examples/Java/IO/WriteSTL

        "},{"location":"Java/IO/WriteSTL/#description","title":"Description","text":"

        vtkSTLWriter object writes Stereo Lithography (.stl) files in either ASCII or binary form.

        An STL file describes a triangulated three-dimensional surface by the unit normal and vertices (ordered by the right-hand rule) of the triangles.

        This example saves a 3D geometric data stored in a to an STL file.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/WriteSTL/#code","title":"Code","text":"

        WriteSTL.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSTLReader;\nimport vtk.vtkSTLWriter;\nimport vtk.vtkSphereSource;\n\n\npublic class WriteSTL\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.stl) e.g sphere.stl\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Seagreen\",BgColor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkSTLWriter stlWriter = new vtkSTLWriter();\n    stlWriter.SetFileName(Filename);\n    stlWriter.SetInputConnection(sphereSource.GetOutputPort());\n    stlWriter.Write();\n\n    //Read and display for verification\n    vtkSTLReader reader = new vtkSTLReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/WriteTIFF/","title":"WriteTIFF","text":"

        vtk-examples/Java/IO/WriteTIFF

        "},{"location":"Java/IO/WriteTIFF/#description","title":"Description","text":"

        vtkTIFFWriter object writes image data as a TIFF data file. Data can be written uncompressed or compressed. Several forms of compression are supported including packed bits, JPEG, deflation, and LZW.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/WriteTIFF/#code","title":"Code","text":"

        WriteTIFF.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkTIFFWriter;\nimport vtk.vtkTIFFReader;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\npublic class WriteTIFF\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.tif) e.g OutputFile.tif\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkImageCanvasSource2D imageSource = new vtkImageCanvasSource2D();\n    imageSource.SetScalarTypeToUnsignedChar();\n    imageSource.SetExtent(0,9,0,9,0,0);\n    imageSource.SetNumberOfScalarComponents(3);\n    imageSource.SetDrawColor(0, 0, 0, 0);\n    imageSource.FillBox(0,9,0,9);\n    imageSource.SetDrawColor(255, 0, 0, 0);\n    imageSource.FillBox(5,7,5,7);\n    imageSource.Update();\n\n    vtkTIFFWriter tiffWriter = new vtkTIFFWriter();\n    tiffWriter.SetFileName(Filename);\n    tiffWriter.SetInputConnection(imageSource.GetOutputPort());\n    tiffWriter.Write();\n\n    //Read and display for verification\n    vtkTIFFReader reader = new vtkTIFFReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    vtkImageActor actor = new vtkImageActor();\n    actor.GetMapper().SetInputConnection(reader.GetOutputPort());\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n    iren.SetInteractorStyle(style);\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/IO/WriteVTP/","title":"WriteVTP","text":"

        vtk-examples/Java/IO/WriteVTP

        "},{"location":"Java/IO/WriteVTP/#description","title":"Description","text":"

        In this example, we add 10 points to a polygonal data (polydata) object and write the result to a VTP file.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/WriteVTP/#code","title":"Code","text":"

        WriteVTP.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkXMLPolyDataWriter;\n\npublic class WriteVTP {\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args) {\n    //parse command line arguments\n    if (args.length != 1) {\n      System.err.println(\"Usage: java -classpath ... WriteVTP Filename(.vtp) e.g WriteVTP.vtp\");\n      return;\n    }\n\n    String filename = args[0];\n\n    //Create 10 points.\n    vtkPoints points = new vtkPoints();\n\n    for (int i = 0; i < 10; ++i) {\n      points.InsertNextPoint(i, i, i);\n    }\n\n    //Create a polydata object and add the points to it.\n    vtkPolyData polydata = new vtkPolyData();\n    polydata.SetPoints(points);\n\n    //Write the file\n    vtkXMLPolyDataWriter writer = new vtkXMLPolyDataWriter();\n    writer.SetFileName(filename);\n    writer.SetInputData(polydata);\n\n    //Optional - set the mode. The default is binary.\n    //writer.SetDataModeToBinary();\n    //writer.SetDataModeToAscii();\n\n    writer.Write();\n  }\n}\n
        "},{"location":"Java/IO/WriteVTU/","title":"WriteVTU","text":"

        vtk-examples/Java/IO/WriteVTU

        "},{"location":"Java/IO/WriteVTU/#description","title":"Description","text":"

        vtkXMLUnstructuredGridWriter object writes the VTK XML UnstructuredGrid file format.

        One unstructured grid input can be written into one file in any number of streamed pieces (if supported by the rest of the pipeline). The standard extension for this writer's file format is \"vtu\". This writer is also used to write a single piece of the parallel file format.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/WriteVTU/#code","title":"Code","text":"

        WriteVTU.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPoints;\nimport vtk.vtkTetra;\nimport vtk.vtkCellArray;\nimport vtk.vtkUnstructuredGrid;\nimport vtk.vtkXMLUnstructuredGridWriter;\nimport vtk.vtkXMLUnstructuredGridReader;\nimport vtk.vtkDataSetMapper;\n\npublic class  WriteVTU\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtu) e.g tetra_test.vtu\");\n      return;\n    }\n    String Filename = args[0];\n    int VTK_TETRA = 10;\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Seagreen\", Bgcolor);\n\n    vtkPoints points = new vtkPoints();\n    points.InsertNextPoint(0, 0, 0);\n    points.InsertNextPoint(1, 0, 0);\n    points.InsertNextPoint(1, 1, 0);\n    points.InsertNextPoint(0, 1, 1);\n\n    vtkTetra tetra = new vtkTetra();\n\n    tetra.GetPointIds().SetId(0, 0);\n    tetra.GetPointIds().SetId(1, 1);\n    tetra.GetPointIds().SetId(2, 2);\n    tetra.GetPointIds().SetId(3, 3);\n\n    vtkCellArray cellArray = new vtkCellArray();\n    cellArray.InsertNextCell(tetra);\n\n    vtkUnstructuredGrid unstructuredGrid = new vtkUnstructuredGrid();\n    unstructuredGrid.SetPoints(points);\n    unstructuredGrid.SetCells(VTK_TETRA, cellArray);\n\n    // Write file\n    vtkXMLUnstructuredGridWriter writer = new vtkXMLUnstructuredGridWriter();\n    writer.SetFileName(Filename);\n    writer.SetInputData(unstructuredGrid);\n    writer.Write();\n\n    // Read and display file for verification that it was written correclty\n    vtkXMLUnstructuredGridReader reader = new vtkXMLUnstructuredGridReader();\n    reader.SetFileName(Filename);\n    reader.Update();\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(reader.GetOutputPort()); \n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/IO/XMLPImageDataWriter/","title":"XMLPImageDataWriter","text":"

        vtk-examples/Java/IO/XMLPImageDataWriter

        "},{"location":"Java/IO/XMLPImageDataWriter/#description","title":"Description","text":"

        vtkXMLPImageDataWriter object writes the PVTK XML ImageData file format.

        One image data input can be written into a parallel file format with any number of pieces spread across files. The standard extension for this writer's file format is \"pvti\". This writer uses vtkXMLImageDataWriter to write the individual piece files.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/XMLPImageDataWriter/#code","title":"Code","text":"

        XMLPImageDataWriter.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkXMLPImageDataWriter;\n\n\npublic class XMLPImageDataWriter\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.pvti) e.g Test.pvti\");\n      return;\n    }\n    String Filename = args[0];\n    vtkImageCanvasSource2D drawing = new vtkImageCanvasSource2D();\n    drawing.SetNumberOfScalarComponents(3);\n    drawing.SetScalarTypeToUnsignedChar();\n    drawing.SetExtent(0, 20, 0, 50, 0, 1);\n    drawing.SetDrawColor(255.0, 255.0, 255.0);\n    drawing.DrawCircle(5, 5, 3);\n\n    int numberOfPieces = 4;\n\n    vtkXMLPImageDataWriter writer = new vtkXMLPImageDataWriter();\n    writer.SetInputConnection(drawing.GetOutputPort());\n    writer.SetFileName(Filename);\n    writer.SetNumberOfPieces(numberOfPieces);\n    writer.SetEndPiece(numberOfPieces-1);\n    writer.SetStartPiece(0);\n    writer.Update();\n\n  }\n}\n
        "},{"location":"Java/IO/XMLPUnstructuredGridWriter/","title":"XMLPUnstructuredGridWriter","text":"

        vtk-examples/Java/IO/XMLPUnstructuredGridWriter

        "},{"location":"Java/IO/XMLPUnstructuredGridWriter/#description","title":"Description","text":"

        vtkXMLPUnstructuredGridWriter object writes the PVTK XML UnstructuredGrid file format.

        One unstructured grid input can be written into a parallel file format with any number of pieces spread across files.

        The standard extension for this writer's file format is \"pvtu\". This writer uses vtkXMLUnstructuredGridWriter to write the individual piece files.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/XMLPUnstructuredGridWriter/#code","title":"Code","text":"

        XMLPUnstructuredGridWriter.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkSphereSource;\nimport vtk.vtkDelaunay3D;\nimport vtk.vtkXMLPUnstructuredGridWriter;\n\npublic class XMLPUnstructuredGridWriter\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.pvtu) e.g Test.pvtu\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkDelaunay3D delaunay = new vtkDelaunay3D();\n    delaunay.SetInputConnection(sphereSource.GetOutputPort());\n    delaunay.Update();\n\n    vtkXMLPUnstructuredGridWriter writer = new vtkXMLPUnstructuredGridWriter();\n    writer.SetInputConnection(delaunay.GetOutputPort());\n    writer.SetFileName(Filename);\n    writer.SetNumberOfPieces(4);\n    writer.SetStartPiece(0);\n    writer.SetEndPiece(3);\n    writer.Update();\n\n  }\n}\n
        "},{"location":"Java/IO/XMLStructuredGridWriter/","title":"XMLStructuredGridWriter","text":"

        vtk-examples/Java/IO/XMLStructuredGridWriter

        "},{"location":"Java/IO/XMLStructuredGridWriter/#description","title":"Description","text":"

        vtkXMLStructuredGridWriter object writes the VTK XML StructuredGrid file format.

        One structured grid input can be written into one file in any number of streamed pieces.

        The standard extension for this writer's file format is \"vts\". This writer is also used to write a single piece of the parallel file format.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/IO/XMLStructuredGridWriter/#code","title":"Code","text":"

        XMLStructuredGridWriter.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkStructuredGrid;\nimport vtk.vtkPoints;\nimport vtk.vtkXMLStructuredGridWriter;\n\n\npublic class XMLStructuredGridWriter\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vts) e.g output.vts\");\n      return;\n    }\n    String Filename = args[0];\n\n    // Create a grid\n    vtkStructuredGrid structuredGrid = new vtkStructuredGrid();\n\n    vtkPoints points = new vtkPoints();\n    points.InsertNextPoint(0, 0, 0);\n    points.InsertNextPoint(1, 0, 0);\n    points.InsertNextPoint(0, 1, 0);\n    points.InsertNextPoint(1, 1, 0);\n    points.InsertNextPoint(0, 2, 0);\n    points.InsertNextPoint(1, 2, 1);\n\n    // Specify the dimensions of the grid\n    structuredGrid.SetDimensions(2,3,1);\n    structuredGrid.SetPoints(points);\n\n    // Write file\n    vtkXMLStructuredGridWriter writer = new vtkXMLStructuredGridWriter();\n    writer.SetFileName(Filename);\n    writer.SetInputData(structuredGrid);\n    writer.Write();\n\n  }\n}\n
        "},{"location":"Java/ImageData/ImageNormalize/","title":"ImageNormalize","text":"

        vtk-examples/Java/ImageData/ImageNormalize

        "},{"location":"Java/ImageData/ImageNormalize/#description","title":"Description","text":"

        For each point, vtkImageNormalize object normalizes the vector defined by the scalar components. If the magnitude of this vector is zero, the output vector is zero also.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/ImageData/ImageNormalize/#code","title":"Code","text":"

        ImageNormalize.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageSinusoidSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkImageNormalize;\nimport vtk.vtkImageCast;\nimport vtk.vtkImageActor;\n\n\npublic class ImageNormalize \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double left_bkg[] = new double[]{0.6, 0.5, 0.4, 1.0};\n    double right_bkg[] = new double[]{0.4, 0.5, 0.6, 1.0};\n\n    colors.SetColor(\"bkgColor\", left_bkg);\n    colors.SetColor(\"boxColor\", right_bkg);\n\n    //  Create an image\n    vtkImageSinusoidSource source = new vtkImageSinusoidSource();\n    source.Update();\n\n    vtkImageNormalize normalizeFilter = new vtkImageNormalize();\n\n    normalizeFilter.SetInputConnection(source.GetOutputPort());\n    normalizeFilter.Update();\n\n    vtkImageCast inputCastFilter = new vtkImageCast();\n    inputCastFilter.SetInputConnection(source.GetOutputPort());\n    inputCastFilter.SetOutputScalarTypeToUnsignedChar();\n    inputCastFilter.Update();\n\n    vtkImageCast normalizeCastFilter = new vtkImageCast();\n    normalizeCastFilter.SetInputConnection(normalizeFilter.GetOutputPort());\n    normalizeCastFilter.SetOutputScalarTypeToUnsignedChar();\n    normalizeCastFilter.Update();\n\n    //  Create actors\n    vtkImageActor inputActor = new vtkImageActor();\n    inputActor.GetMapper().SetInputConnection(inputCastFilter.GetOutputPort());\n\n    vtkImageActor normalizedActor = new vtkImageActor();\n    normalizedActor.GetMapper().SetInputConnection(normalizeCastFilter.GetOutputPort());\n\n    //  Create the render window and interactor.\n\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //  Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double leftViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};\n    double rightViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n\n    //  Setup both renderers\n    vtkRenderer leftRenderer = new vtkRenderer();\n    renWin.AddRenderer(leftRenderer);\n    leftRenderer.SetViewport(leftViewport);\n    leftRenderer.SetBackground(left_bkg);\n\n    vtkRenderer rightRenderer = new vtkRenderer();\n    renWin.AddRenderer(rightRenderer);\n    rightRenderer.SetViewport(rightViewport);\n    rightRenderer.SetBackground(right_bkg);\n\n    leftRenderer.AddActor(inputActor);\n    rightRenderer.AddActor(normalizedActor);\n\n    leftRenderer.ResetCamera();\n    rightRenderer.ResetCamera();\n\n    renWin.SetSize(600,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/ImageData/ImageWeightedSum/","title":"ImageWeightedSum","text":"

        vtk-examples/Java/ImageData/ImageWeightedSum

        "},{"location":"Java/ImageData/ImageWeightedSum/#description","title":"Description","text":"

        Sum multiple images. Images must be of the same size and type.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/ImageData/ImageWeightedSum/#code","title":"Code","text":"

        ImageWeightedSum.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkImageCast;\nimport vtk.vtkImageMandelbrotSource;\nimport vtk.vtkImageSinusoidSource;\nimport vtk.vtkImageWeightedSum;\nimport vtk.vtkImageActor;\n\npublic class ImageWeightedSum \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    double bkgL[] = new double[4] ;\n    double bkgC[] = new double[4] ;\n    double bkgR[] = new double [4] ;\n\n    Color.GetColor(\"Tan\",bkgL);\n    Color.GetColor(\"DarkCyan\",bkgC);\n    Color.GetColor(\"LightSlateGray\",bkgR);\n\n    //create an image\n    vtkImageMandelbrotSource source1 = new vtkImageMandelbrotSource();\n    source1.SetWholeExtent(0, 255, 0, 255, 0, 0);\n    source1.Update();\n\n    vtkImageCast source1Double = new vtkImageCast();\n    source1Double.SetInputConnection(0, source1.GetOutputPort());\n    source1Double.SetOutputScalarTypeToDouble();\n\n    vtkImageSinusoidSource source2 = new vtkImageSinusoidSource();\n    source2.SetWholeExtent(0, 255, 0, 255, 0, 0);\n    source2.Update();\n\n    vtkImageWeightedSum sumFilter = new vtkImageWeightedSum();\n    sumFilter.SetWeight(0, .8);\n    sumFilter.SetWeight(1, .2);\n    sumFilter.AddInputConnection(source1Double.GetOutputPort());\n    sumFilter.AddInputConnection(source2.GetOutputPort());\n\n    sumFilter.Update();\n\n    vtkImageCast source1CastFilter = new vtkImageCast();\n    source1CastFilter.SetInputConnection(source1.GetOutputPort());\n    source1CastFilter.SetOutputScalarTypeToUnsignedChar();\n    source1CastFilter.Update();\n\n    vtkImageCast source2CastFilter = new vtkImageCast();\n    source2CastFilter.SetInputConnection(source2.GetOutputPort());\n    source2CastFilter.SetOutputScalarTypeToUnsignedChar();\n    source2CastFilter.Update();\n\n    vtkImageCast summedCastFilter = new vtkImageCast();\n    summedCastFilter.SetInputConnection(sumFilter.GetOutputPort());\n    summedCastFilter.SetOutputScalarTypeToUnsignedChar();\n    summedCastFilter.Update();\n\n    //Create actors\n    vtkImageActor source1Actor = new vtkImageActor();\n    source1Actor.GetMapper().SetInputConnection(source1CastFilter.GetOutputPort());\n\n    vtkImageActor source2Actor = new vtkImageActor();\n    source2Actor.GetMapper().SetInputConnection(source2CastFilter.GetOutputPort());\n\n    vtkImageActor summedActor = new vtkImageActor();\n    summedActor.GetMapper().SetInputConnection(summedCastFilter.GetOutputPort());\n\n    // There will be one render window\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.SetSize(600, 300);\n\n    // And one interactor\n    vtkRenderWindowInteractor interactor = new vtkRenderWindowInteractor();\n    interactor.SetRenderWindow(renderWindow);\n\n    // Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double leftViewport[] = new double[] {0.0, 0.0, 0.33, 1.0};\n    double centerViewport[] = new double[]{0.33, 0.0, .66, 1.0};\n    double rightViewport[] = new double[] {0.66, 0.0, 1.0, 1.0};\n\n    // Setup renderers\n    vtkRenderer leftRenderer = new vtkRenderer();\n    renderWindow.AddRenderer(leftRenderer);\n    leftRenderer.SetViewport(leftViewport);\n    leftRenderer.SetBackground(bkgL);\n\n    vtkRenderer centerRenderer = new vtkRenderer();\n    renderWindow.AddRenderer(centerRenderer);\n    centerRenderer.SetViewport(centerViewport);\n    centerRenderer.SetBackground(bkgC);\n\n    vtkRenderer rightRenderer = new vtkRenderer();\n    renderWindow.AddRenderer(rightRenderer);\n    rightRenderer.SetViewport(rightViewport);\n    rightRenderer.SetBackground(bkgR);\n\n    leftRenderer.AddActor(source1Actor);\n    centerRenderer.AddActor(source2Actor);\n    rightRenderer.AddActor(summedActor);\n\n    leftRenderer.ResetCamera();\n    centerRenderer.ResetCamera();\n    rightRenderer.ResetCamera();\n\n    renderWindow.Render();\n    interactor.Start();\n  }\n}\n
        "},{"location":"Java/ImageProcessing/ShotNoise/","title":"ShotNoise","text":"

        vtk-examples/Java/ImageProcessing/ShotNoise

        Description:

        An Example program to Write PNG files. vtkPNGWriter writes PNG files. It supports 1 to 4 component data of unsigned char or unsigned short

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/ImageProcessing/ShotNoise/#code","title":"Code","text":"

        ShotNoise.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkPNGWriter;\n\npublic class ShotNoise \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //Provide default values.\n    String fileName = \"TestShotNoise.png\";\n    for(int i = 0; i < args.length; ++i)\n    {\n      switch (i) \n      {\n        case 0:\n                fileName = args[i];\n                break;\n      }\n    }\n\n    vtkImageCanvasSource2D ImageCanvas = new vtkImageCanvasSource2D();\n\n    ImageCanvas.SetScalarTypeToUnsignedChar();\n\n    ImageCanvas.SetExtent(1, 256, 1, 256, 0, 0);\n    ImageCanvas.SetDrawColor(0);\n    ImageCanvas.FillBox(1, 256, 1, 256);\n    ImageCanvas.SetDrawColor(255);\n    ImageCanvas.FillBox(30, 255, 30, 225);\n    ImageCanvas.SetDrawColor(0);\n    ImageCanvas.FillBox(60, 195, 60, 195);\n    ImageCanvas.SetDrawColor(255);\n    ImageCanvas.FillTube(100, 100, 154, 154, 40);\n    ImageCanvas.SetDrawColor(0);\n    ImageCanvas.DrawSegment(45, 45, 45, 210);\n    ImageCanvas.DrawSegment(45, 210, 210, 210);\n    ImageCanvas.DrawSegment(210, 210, 210, 45);\n    ImageCanvas.DrawSegment(210, 45, 45, 45);\n    ImageCanvas.DrawSegment(100, 150, 150, 100);\n    ImageCanvas.DrawSegment(110, 160, 160, 110);\n    ImageCanvas.DrawSegment(90, 140, 140, 90);\n    ImageCanvas.DrawSegment(120, 170, 170, 120);\n    ImageCanvas.DrawSegment(80, 130, 130, 80);\n    ImageCanvas.Update();\n\n    vtkPNGWriter Writer = new vtkPNGWriter();\n    Writer.SetInputConnection(ImageCanvas.GetOutputPort());\n    Writer.SetFileName(fileName);\n    Writer.Write();\n  }\n}\n
        "},{"location":"Java/Images/Actor2D/","title":"Actor2D","text":"

        vtk-examples/Java/Images/Actor2D

        "},{"location":"Java/Images/Actor2D/#description","title":"Description","text":"

        Example to demonstrate an actor that draws 2D data.

        The object [vtkActor](https://www.vtk.org/doc/nightly/html/classvtkActor.html#details)2D is similar to vtkActor, but it is made to be used with two dimensional images and annotation.

        [vtkActor](https://www.vtk.org/doc/nightly/html/classvtkActor.html#details)2D object has a position but does not use a transformation matrix like vtkActor and it has a reference to a vtkMapper2D object which does the rendering.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Images/Actor2D/#code","title":"Code","text":"

        Actor2D.java

        import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPoints;\nimport vtk.vtkVertexGlyphFilter;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper2D;\nimport vtk.vtkActor2D;\n\npublic class Actor2D \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Lime\", actorColor);\n    colors.GetColor(\"DarkSlateGray\", Bgcolor);\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(10, 10, 0);\n    Points.InsertNextPoint(100, 100, 0);\n    Points.InsertNextPoint(200, 200, 0);\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n\n    vtkVertexGlyphFilter GlyphFilter = new vtkVertexGlyphFilter();\n    GlyphFilter.SetInputData(PolyData);\n    GlyphFilter.Update();\n\n    vtkPolyDataMapper2D Mapper = new vtkPolyDataMapper2D();\n    Mapper.SetInputConnection(GlyphFilter.GetOutputPort());\n    Mapper.Update();\n\n    vtkActor2D Actor = new vtkActor2D();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n    Actor.GetProperty().SetPointSize(8);\n\n    // Create the renderer, render window and Interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actor to the scene\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Images/Cast/","title":"Cast","text":"

        vtk-examples/Java/Images/Cast

        "},{"location":"Java/Images/Cast/#description","title":"Description","text":"

        vtkImageCast object filter casts the input type to match the output type in the image processing pipeline.

        The filter does nothing if the input already has the correct type. To specify the \"CastTo\" type, use \"SetOutputScalarType\" method.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Images/Cast/#code","title":"Code","text":"

        Cast.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageMandelbrotSource;\nimport vtk.vtkImageCast;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\npublic class Cast\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------  \n\n  public static void main(String args[]) \n  {\n    //Create a float image\n    vtkImageMandelbrotSource source = new vtkImageMandelbrotSource();\n    source.Update();\n\n    System.out.println(source.GetOutput().GetScalarTypeAsString());\n\n    vtkImageCast castFilter = new vtkImageCast();\n    castFilter.SetInputConnection(source.GetOutputPort());\n    castFilter.SetOutputScalarTypeToUnsignedChar();\n    castFilter.Update();\n\n    //Create an actor\n    vtkImageActor actor = new vtkImageActor();\n    actor.GetMapper().SetInputConnection(castFilter.GetOutputPort());\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    ren.AddActor(actor);\n    ren.ResetCamera();\n\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n    iren.SetInteractorStyle(style);\n    iren.SetRenderWindow(renWin);\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Images/Flip/","title":"Flip","text":"

        vtk-examples/Java/Images/Flip

        "},{"location":"Java/Images/Flip/#description","title":"Description","text":"

        This example demonstrates how to flip an image over an axis.

        vtkImageFlip object will reflect the data along the filtered axis. This filter is actually a thin wrapper around vtkImageReslice.

        Need a better source image (non-symmetrical!).

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Images/Flip/#code","title":"Code","text":"

        Flip.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkImageMandelbrotSource;\nimport vtk.vtkImageCast;\nimport vtk.vtkImageFlip;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\n\npublic class Flip \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For inputRenderer Color\n    double inputRendererColor[] = new double[] {.4, .5, .9, 1};\n    //For xActor Color\n    double xActorColor[] = new double [] {.4, .5, .6, 1};\n    //For yActor Color\n    double yActorColor[] = new double[] {.4, .5, .7, 1};\n    //For zActor Color\n    double zActorColor[] = new double[] {.4, .5, .8, 1};\n\n\n    //Change Color Name to Use your own Color for Change inputRenderer Color\n    Color.SetColor(\"inputRendererColor\",inputRendererColor);\n    //Change Color Name to Use your own Color for Change xActorColor Color\n    Color.SetColor(\"xActorColor\",xActorColor);\n    //Change Color Name to Use your own Color for Change yActorColor Color\n    Color.SetColor(\"yActorColor\",yActorColor);\n    //Change Color Name to Use your own Color for Change zActorColor Color\n    Color.SetColor(\"zActorColor\",zActorColor);\n\n\n    //Create an image\n    vtkImageMandelbrotSource source = new vtkImageMandelbrotSource();\n    source.Update();\n\n    vtkImageCast castSource = new vtkImageCast();\n    castSource.SetOutputScalarTypeToUnsignedChar();\n    castSource.SetInputConnection(source.GetOutputPort());\n    castSource.Update();\n\n    vtkImageFlip flipXFilter = new vtkImageFlip();\n    flipXFilter.SetFilteredAxis(0); // flip x axis\n    flipXFilter.SetInputConnection(source.GetOutputPort());\n    flipXFilter.Update();\n\n    vtkImageCast castXFilter = new vtkImageCast();\n    castXFilter.SetOutputScalarTypeToUnsignedChar();\n    castXFilter.SetInputConnection(flipXFilter.GetOutputPort());\n    castXFilter.Update();\n\n    vtkImageFlip flipYFilter = new vtkImageFlip();\n    flipYFilter.SetFilteredAxis(1); // flip y axis\n    flipYFilter.SetInputConnection(source.GetOutputPort());\n    flipYFilter.Update();\n\n    vtkImageCast castYFilter = new vtkImageCast();\n    castYFilter.SetOutputScalarTypeToUnsignedChar();\n    castYFilter.SetInputConnection(flipYFilter.GetOutputPort());\n    castYFilter.Update();\n\n    vtkImageFlip flipZFilter = new vtkImageFlip();\n    flipZFilter.SetFilteredAxis(2); // flip z axis\n    flipZFilter.SetInputConnection(source.GetOutputPort());\n    flipZFilter.Update();\n\n    vtkImageCast castZFilter = new vtkImageCast();\n    castZFilter.SetOutputScalarTypeToUnsignedChar();\n    castZFilter.SetInputConnection(flipZFilter.GetOutputPort());\n    castZFilter.Update();\n\n    //Create actors\n    vtkImageActor inputActor = new vtkImageActor();\n    inputActor.GetMapper().SetInputConnection(castSource.GetOutputPort());\n\n    vtkImageActor xActor = new vtkImageActor();\n    xActor.GetMapper().SetInputConnection(castXFilter.GetOutputPort());\n\n    vtkImageActor yActor = new vtkImageActor();\n    yActor.GetMapper().SetInputConnection(castYFilter.GetOutputPort());\n\n    vtkImageActor zActor = new vtkImageActor();\n    zActor.GetMapper().SetInputConnection(castZFilter.GetOutputPort());\n\n    //Define viewport ranges\n    //(xmin, ymin, xmax, ymax)\n    double inputViewport[] = new double[] {0.0, 0.0, 0.25, 1.0};\n    double xViewport[] = new double[] {0.25, 0.0, 0.5, 1.0};\n    double yViewport[] = new double[] {0.5, 0.0, 0.75, 1.0};\n    double zViewport[] = new double[] {0.75, 0.0, 1.0, 1.0};\n\n    // Setup renderers\n    vtkRenderer inputRenderer = new vtkRenderer();\n    inputRenderer.SetViewport(inputViewport);\n    inputRenderer.AddActor(inputActor);\n    inputRenderer.ResetCamera();\n    inputRenderer.SetBackground(inputRendererColor);\n\n    vtkRenderer xRenderer = new vtkRenderer();\n    xRenderer.SetViewport(xViewport);\n    xRenderer.AddActor(xActor);\n    xRenderer.ResetCamera();\n    xRenderer.SetBackground(xActorColor);\n\n    vtkRenderer yRenderer = new vtkRenderer();\n    yRenderer.SetViewport(yViewport);\n    yRenderer.AddActor(yActor);\n    yRenderer.ResetCamera();\n    yRenderer.SetBackground(yActorColor);\n\n    vtkRenderer zRenderer = new vtkRenderer();\n    zRenderer.SetViewport(zViewport);\n    zRenderer.AddActor(zActor);\n    zRenderer.ResetCamera();\n    zRenderer.SetBackground(zActorColor);\n\n\n    // Setup render window\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.SetSize(1000, 250);\n    renderWindow.AddRenderer(inputRenderer);\n    renderWindow.AddRenderer(xRenderer);\n    renderWindow.AddRenderer(yRenderer);\n    renderWindow.AddRenderer(zRenderer);\n\n    // Setup render window interactor\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n\n    renderWindowInteractor.SetInteractorStyle(style);\n\n    // Render and start interaction\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n    renderWindow.Render();\n    renderWindowInteractor.Initialize();\n\n    renderWindowInteractor.Start();\n\n  }\n}\n
        "},{"location":"Java/Images/ImageFFT/","title":"ImageFFT","text":"

        vtk-examples/Java/Images/ImageFFT

        "},{"location":"Java/Images/ImageFFT/#description","title":"Description","text":"

        vtkImageFFT object implements a fast Fourier transform.

        The input can have real or complex data in any components and data types, but the output is always complex doubles with real values in component0, and imaginary values in component1.

        The filter is fastest for images that have power of two sizes. The filter uses a butterfly diagram for each prime factor of the dimension.

        This makes images with prime number dimensions (i.e. 17x17) much slower to compute. Multi dimensional (i.e volumes) FFT's are decomposed so that each axis executes serially.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Images/ImageFFT/#code","title":"Code","text":"

        ImageFFT.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkImageEllipsoidSource;\nimport vtk.vtkImageFFT;\nimport vtk.vtkImageCast;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\npublic class ImageFFT\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    double OriginalRendererBgColor[] = new double[] {.4, .5, .6, 1};\n    Color.SetColor(\"OriginalRendererBgColor\",OriginalRendererBgColor);\n\n    double fftRendererBgColor[] = new double[] {.4, .5, .7, 1};\n    Color.SetColor(\"fftRendererBgColor\",fftRendererBgColor);\n\n    //Create an image\n    vtkImageEllipsoidSource source = new vtkImageEllipsoidSource();\n    source.SetWholeExtent(0, 20, 0, 20, 0, 0);\n    source.SetCenter(10,10,0);\n    source.SetRadius(3,4,0);\n    source.Update();\n\n    vtkImageFFT fftFilter = new vtkImageFFT();\n    fftFilter.SetInputConnection(source.GetOutputPort());\n    fftFilter.Update();\n\n    vtkImageCast fftCastFilter = new vtkImageCast();\n    fftCastFilter.SetInputConnection(fftFilter.GetOutputPort());\n    fftCastFilter.SetOutputScalarTypeToUnsignedChar();\n    fftCastFilter.Update();\n\n    //Create actors\n    vtkImageActor originalActor = new vtkImageActor();\n    originalActor.GetMapper().SetInputConnection(source.GetOutputPort());\n\n    vtkImageActor fftActor = new vtkImageActor();\n    fftActor.GetMapper().SetInputConnection(fftCastFilter.GetOutputPort());\n\n    //Define viewport ranges\n    //(xmin, ymin, xmax, ymax)\n    double originalViewport[]= new double[] {0.0, 0.0, 0.5, 1.0};\n    double fftViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n    //Setup renderers\n    vtkRenderer originalRenderer = new vtkRenderer();\n    originalRenderer.SetViewport(originalViewport);\n    originalRenderer.AddActor(originalActor);\n    originalRenderer.ResetCamera();\n    originalRenderer.SetBackground(OriginalRendererBgColor);\n\n    vtkRenderer fftRenderer = new vtkRenderer();\n    fftRenderer.SetViewport(fftViewport);\n    fftRenderer.AddActor(fftActor);\n    fftRenderer.ResetCamera();\n    fftRenderer.SetBackground(fftRendererBgColor);\n\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.SetSize(600, 300);\n    renderWindow.AddRenderer(originalRenderer);\n    renderWindow.AddRenderer(fftRenderer);\n\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    vtkInteractorStyleImage style = new vtkInteractorStyleImage();\n\n    renderWindowInteractor.SetInteractorStyle(style);\n\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n    renderWindow.Render();\n    renderWindowInteractor.Initialize();\n\n    renderWindowInteractor.Start();\n\n  }\n}\n
        "},{"location":"Java/Images/ImageSinusoidSource/","title":"ImageSinusoidSource","text":"

        vtk-examples/Java/Images/ImageSinusoidSource

        "},{"location":"Java/Images/ImageSinusoidSource/#description","title":"Description","text":"

        vtkImageSinusoidSource object just produces images with pixel values determined by a sinusoid.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Images/ImageSinusoidSource/#code","title":"Code","text":"

        ImageSinusoidSource.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkImageSinusoidSource;\nimport vtk.vtkImageViewer2;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class ImageSinusoidSource \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\npublic static void main(String args[]) \n{\n\n  vtkImageSinusoidSource sinusoidSource = new vtkImageSinusoidSource();\n  sinusoidSource.Update();\n\n  //Visualize\n  vtkImageViewer2 imageViewer = new vtkImageViewer2();\n  imageViewer.SetInputConnection(sinusoidSource.GetOutputPort());\n  imageViewer.GetRenderWindow().SetSize( 500, 500 );\n  imageViewer.GetRenderer().ResetCamera();\n\n  vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n  imageViewer.GetRenderWindow().SetInteractor(iren);\n  iren.SetInteractorStyle(null);\n  imageViewer.Render();\n\n  iren.Initialize();\n  iren.Start();\n\n }\n}\n
        "},{"location":"Java/Images/RTAnalyticSource/","title":"RTAnalyticSource","text":"

        vtk-examples/Java/Images/RTAnalyticSource

        "},{"location":"Java/Images/RTAnalyticSource/#description","title":"Description","text":"

        Example to Create an image for regression testing.

        vtkRTAnalyticSource object just produces images with pixel values determined by a MaximumGaussianXMagsin(XFreqx)sin(YFreqy)cos(ZFreqz) Values are float scalars on point data with name \"RTData\".

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Images/RTAnalyticSource/#code","title":"Code","text":"

        RTAnalyticSource.java

        import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageActor;\nimport vtk.vtkRTAnalyticSource;\nimport vtk.vtkInteractorStyleImage;\n\npublic class RTAnalyticSource \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DarkRed\", Bgcolor);\n\n    vtkRTAnalyticSource AnalyticSource = new vtkRTAnalyticSource();\n    AnalyticSource.SetWholeExtent(-10, 10, -10, 10, 0, 0);\n\n    vtkImageActor ImageActor = new vtkImageActor();\n    ImageActor.GetMapper().SetInputConnection(AnalyticSource.GetOutputPort());\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleImage Style = new vtkInteractorStyleImage();\n    iren.SetInteractorStyle(Style);\n\n    // Visualize Actor\n    ren.AddActor(ImageActor);\n    ren.SetBackground(Bgcolor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Images/StaticImage/","title":"StaticImage","text":"

        vtk-examples/Java/Images/StaticImage

        Description:

        This example displays a 2D image in a non-interactable window. vtkImageCanvasSource2D is a source that starts as a blank image. User may add to the image with two-dimensional drawing routines. It can paint multi-spectral images. vtkImageViewer2 is a convenience class for displaying a 2D image

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Images/StaticImage/#code","title":"Code","text":"

        StaticImage.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkImageReader2;\nimport vtk.vtkImageViewer2;\nimport vtk.vtkImageReader2Factory;\n\npublic class StaticImage \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    // Read the image (Pass the Image File Name as Argument)\n    vtkImageReader2Factory ReaderFactory = new vtkImageReader2Factory();\n    vtkImageReader2 Reader = ReaderFactory.CreateImageReader2(args[0]);\n    Reader.SetFileName(args[0]);\n    Reader.Update();\n\n    // Visualize\n    vtkImageViewer2 ImageViewer = new vtkImageViewer2();\n    ImageViewer.SetInputConnection(Reader.GetOutputPort());\n    ImageViewer.GetRenderWindow().SetSize(500, 500);\n    ImageViewer.GetRenderer().ResetCamera();\n\n    // Set up an interactor that does not respond to mouse events\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    ImageViewer.GetRenderWindow().SetInteractor(iren);\n    iren.SetInteractorStyle(null);\n    ImageViewer.Render();\n\n    // Start the event loop\n    iren.Initialize();\n    iren.Start();\n\n    Reader.Delete();\n  }\n}\n
        "},{"location":"Java/Imaging/ImageTest/","title":"ImageTest","text":"

        vtk-examples/Java/Imaging/ImageTest

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Imaging/ImageTest/#code","title":"Code","text":"

        ImageTest.java

        import java.awt.FileDialog;\nimport java.awt.Frame;\nimport vtk.*;\n\npublic class ImageTest  {\n\n  /**\n     * ImageTest provides a means to test the ImageReader2Factory\n     * Image files understood by vtk are displayed, \n     * all others are reported with a message. \n     */\n  vtkRenderWindow renWin;\n  vtkRenderWindowInteractor iren;\n  vtkRenderer ren1;\n  vtkImageReader2Factory imageReaderFactory;\n  vtkImageReader2 imageReader;\n  vtkImageActor ImageActor;\n  vtkInteractorObserver imageStyle;\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args) {\n\n    ImageTest me = new ImageTest();\n    me.doit();\n\n  }\n\n\n  public void doit() {\n    /*\n         * Use a file dialog to allow selection of any file for \n         * test of the imagereaderfactory.\n         * only does one file per exection.\n         */\n    System.out.println(\"init in ImageTest\");\n    ren1 = new vtkRenderer();\n    renWin = new vtkRenderWindow();\n    iren = new vtkRenderWindowInteractor();\n    imageStyle = new vtkInteractorStyleImage();\n\n    FileDialog fd = new FileDialog( new Frame(),\"File name to load\",\n                                    FileDialog.LOAD);\n    fd.setFile(\"*.*\");\n    fd.setVisible(true);\n    String selected = fd.getFile();\n    fd.setVisible(false);\n    if (selected != null) {\n      String outname = fd.getDirectory() + selected;\n\n      imageReaderFactory = new vtkImageReader2Factory();\n      imageReader = imageReaderFactory.CreateImageReader2(outname);\n      if (imageReader != null) {\n        imageReader.SetFileName(outname);\n        imageReader.SetDataOrigin(0, 0, 0);\n        imageReader.Update();\n\n        ImageActor = new vtkImageActor();\n        ImageActor.SetInput(imageReader.GetOutput());\n        renWin.AddRenderer(ren1);\n        iren.SetRenderWindow(renWin);\n\n        iren.SetInteractorStyle(imageStyle);\n\n        ren1.AddActor(ImageActor);\n        renWin.AddRenderer(ren1);\n\n        iren.Initialize();\n        iren.Start();\n        System.out.println(\"Return from interactor\");\n        renWin.Finalize();\n      } else {\n        System.out.println(\"No reader found for \" + outname);\n      }\n\n    } else {\n      System.out.println(\"No file name selected\");\n    }\n\n  }\n}\n
        "},{"location":"Java/ImplicitFunctions/ImplicitDataSet/","title":"ImplicitDataSet","text":"

        vtk-examples/Java/ImplicitFunctions/ImplicitDataSet

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/ImplicitFunctions/ImplicitDataSet/#code","title":"Code","text":"

        ImplicitDataSet.java

        import vtk.vtkRTAnalyticSource;\nimport vtk.vtkImplicitDataSet;\nimport vtk.vtkNativeLibrary;\n\nclass ImplicitDataSet{  \n\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n\n  public static void main(String args[]){  \n\n    vtkRTAnalyticSource waveletSource = new vtkRTAnalyticSource();\n    waveletSource.Update();\n\n    vtkImplicitDataSet implicitWavelet = new vtkImplicitDataSet();\n    implicitWavelet.SetDataSet(waveletSource.GetOutput());\n\n    double x[] = new double[] {0.5,0,0};\n    // Value should roughly be 258.658.\n\n\n    System.out.print(\"x: \" + implicitWavelet.EvaluateFunction(x));\n\n  }   \n}   \n
        "},{"location":"Java/ImplicitFunctions/ImplicitSphere/","title":"ImplicitSphere","text":"

        vtk-examples/Java/ImplicitFunctions/ImplicitSphere

        "},{"location":"Java/ImplicitFunctions/ImplicitSphere/#description","title":"Description","text":"

        This example creates a polygonal model of two spheres and 3 tubes, and then renders it to the screen. It will rotate the scene 360 degrees and then exit. The basic setup of source -> mapper -> actor -> renderer -> renderwindow is typical of most VTK programs.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/ImplicitFunctions/ImplicitSphere/#code","title":"Code","text":"

        ImplicitSphere.java

        //\n// This example creates a polygonal model of two spheres and 3 tubes, and then renders it to\n// the screen. It will rotate the scene 360 degrees and then exit. The basic\n// setup of source -> mapper -> actor -> renderer -> renderwindow is \n// typical of most VTK programs.\n//\n\n// We import the vtk wrapped classes first.\nimport vtk.*;\n\n// Then we define our class.\npublic class Sphere {\n\n  // In the static contructor we load in the native code.\n  // The libraries must be in your path to work.\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  // Now the main program\n  public static void main (String []args) {\n    // \n    // Next we create an instance of vtkSphereSource and set some of its\n    // properties. The instance of vtkSphereSource \"sphere\" is part of a\n    // visualization pipeline (it is a source process object); it produces data\n    // (output type is vtkPolyData) which other filters may process.\n    //\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetRadius( 1.0 );\n    sphere.SetPhiResolution(12);\n    sphere.SetThetaResolution( 12 );\n\n    vtkSphereSource sph = new vtkSphereSource();\n    vtkAppendPolyData apf = new vtkAppendPolyData();\n    vtkPolyData pd = new vtkPolyData(); \n    vtkTubeFilter tubes = new vtkTubeFilter();\n    vtkCellArray polys = new vtkCellArray(); \n    vtkPoints points = new vtkPoints();\n    points.Allocate(10, 10);\n    polys.Allocate(10, 10);\n    pd.Allocate(10, 10);\n    sph.SetCenter(3, 0, 2);\n    sph.SetRadius(2);\n    sph.SetThetaResolution(25);\n    sph.SetPhiResolution(25);\n    sph.Update(); \n    points.InsertNextPoint(3, 0, 2);\n    points.InsertNextPoint(3, 3, 3);\n    points.InsertNextPoint(5, 3, 3);\n    points.InsertNextPoint(2, 4, 2);\n    points.InsertNextPoint(4,4,4);\n\n    polys.InsertNextCell(2);\n    polys.InsertCellPoint(0);\n    polys.InsertCellPoint(1);\n    polys.InsertNextCell(2);\n    polys.InsertCellPoint(1);\n    polys.InsertCellPoint(2);\n    polys.InsertNextCell(2);\n    polys.InsertCellPoint(2);\n    polys.InsertCellPoint(3);\n    polys.InsertNextCell(2);\n    polys.InsertCellPoint(3);\n    polys.InsertCellPoint(1);\n    pd.SetLines(polys);\n    pd.SetPoints(points);\n    tubes.AddInput(pd);\n    tubes.SetRadius(.25);\n    tubes.SetNumberOfSides(9);\n    tubes.Update();\n\n    apf.AddInput(tubes.GetOutput());\n    apf.AddInput(sphere.GetOutput());\n    apf.AddInput(sph.GetOutput());\n    // \n    // In this example we terminate the pipeline with a mapper process object.\n    // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    // between the source and the mapper.)  We create an instance of\n    // vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    // connect the output of the sphere souece to the input of this mapper.\n    //\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInput( apf.GetOutput() );\n    // \n    // Create an actor to represent the sphere. The actor orchestrates rendering\n    // of the mapper's graphics primitives. An actor also refers to properties\n    // via a vtkProperty instance, and includes an internal transformation\n    // matrix. We set this actor's mapper to be sphereMapper which we created\n    // above.\n    //\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper( sphereMapper );\n\n    //\n    // Create the Renderer and assign actors to it. A renderer is like a\n    // viewport. It is part or all of a window on the screen and it is\n    // responsible for drawing the actors it has.  We also set the background\n    // color here\n    //\n    vtkRenderer ren1 = new vtkRenderer();\n    ren1.AddActor( sphereActor );\n    ren1.SetBackground( 0.1, 0.2, 0.4 );\n\n    //\n    // Finally we create the render window which will show up on the screen\n    // We put our renderer into the render window using AddRenderer. We also\n    // set the size to be 300 pixels by 300\n    //\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer( ren1 );\n    renWin.SetSize( 300, 300 );\n\n    //\n    // Now we loop over 360 degrees and render the sphere each time\n    //\n    int i;\n    for (i = 0; i < 360; ++i)\n    {\n      // render the image\n      renWin.Render();\n      try {\n        Thread.sleep(100);\n      } catch (Throwable e) {\n        e.printStackTrace();\n      }\n      // rotate the active camera by one degree\n      ren1.GetActiveCamera().Azimuth( 1 );\n    }\n\n    try {\n      Thread.sleep(1000);\n    } catch (Throwable e1) {\n      e1.printStackTrace();\n    }\n\n  } \n}\n
        "},{"location":"Java/ImplicitFunctions/SampleFunction/","title":"SampleFunction","text":"

        vtk-examples/Java/ImplicitFunctions/SampleFunction

        "},{"location":"Java/ImplicitFunctions/SampleFunction/#description","title":"Description","text":"

        vtkSampleFunction is a source object that evaluates an implicit function and normals at each point in a vtkStructuredPoints.

        The user can specify the sample dimensions and location in space to perform the sampling. To create closed surfaces (in conjunction with the vtkContourFilter), capping can be turned on to set a particular value on the boundaries of the sample space.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/ImplicitFunctions/SampleFunction/#code","title":"Code","text":"

        SampleFunction.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSuperquadric;\nimport vtk.vtkSampleFunction;\nimport vtk.vtkContourFilter;\nimport vtk.vtkOutlineFilter;\n\n\npublic class SampleFunction\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Outline Actor Color\n    double OutlineActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Black\",OutlineActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Tan\",BgColor);\n\n    vtkSuperquadric implicitFunction = new vtkSuperquadric();\n    implicitFunction.SetPhiRoundness(2.5);\n    implicitFunction.SetThetaRoundness(.5);\n\n    //Sample the function\n    vtkSampleFunction sample = new vtkSampleFunction();\n    sample.SetSampleDimensions(50,50,50);\n    sample.SetImplicitFunction(implicitFunction);\n    double value = 2.0;\n    double xmin = -value, xmax = value, ymin = -value, ymax = value, zmin = -value, zmax = value;\n    sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);\n\n    //Create the 0 isosurface\n    vtkContourFilter contours = new vtkContourFilter();\n    contours.SetInputConnection(sample.GetOutputPort());\n    contours.GenerateValues(1, 2.0, 2.0);\n\n    //Map the contours to graphical primitives\n    vtkPolyDataMapper contourMapper = new vtkPolyDataMapper();\n    contourMapper.SetInputConnection(contours.GetOutputPort());\n    contourMapper.SetScalarRange(0.0, 1.2);\n\n    //Create an actor for the contours\n    vtkActor contourActor = new vtkActor();\n    contourActor.SetMapper(contourMapper);\n\n    //create a box around the function to indicate the sampling volume --\n\n    //Create outline\n    vtkOutlineFilter outline = new vtkOutlineFilter();\n    outline.SetInputConnection(sample.GetOutputPort());\n\n    // Map it to graphics primitives\n    vtkPolyDataMapper outlineMapper = new vtkPolyDataMapper();\n    outlineMapper.SetInputConnection(outline.GetOutputPort());\n\n    // Create an actor for it\n    vtkActor outlineActor = new vtkActor();\n    outlineActor.SetMapper(outlineMapper);\n    outlineActor.GetProperty().SetColor(OutlineActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(contourActor);\n    ren.AddActor(outlineActor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/InfoVis/GraphPoints/","title":"GraphPoints","text":"

        vtk-examples/Java/InfoVis/GraphPoints

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/InfoVis/GraphPoints/#code","title":"Code","text":"

        GraphPoints.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkGraphLayoutView;\nimport vtk.vtkMutableUndirectedGraph;\n\n\npublic class GraphPoints \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n     vtkMutableUndirectedGraph graph = new vtkMutableUndirectedGraph();\n\n     // Create 3 vertices\n     int v1 = graph.AddVertex();\n     int v2 = graph.AddVertex();\n     int v3 = graph.AddVertex();\n\n     graph.AddGraphEdge(v1, v2);\n     graph.AddGraphEdge(v1, v3);\n\n     vtkPoints points = new vtkPoints();\n     points.InsertNextPoint(0.0, 0.0, 0.0);\n     points.InsertNextPoint(1.0, 0.0, 0.0);\n     points.InsertNextPoint(0.0, 1.0, 0.0);\n\n     graph.SetPoints(points);\n\n     System.out.println(\"Number of output points: \" + \" \" + graph.GetPoints().GetNumberOfPoints());\n\n     vtkGraphLayoutView graphLayoutView = new vtkGraphLayoutView();\n     graphLayoutView.AddRepresentationFromInput(graph);\n     graphLayoutView.SetLayoutStrategy(\"Pass Through\");\n     graphLayoutView.ResetCamera();\n     graphLayoutView.Render();\n     graphLayoutView.GetInteractor().Start();\n\n  }\n}\n
        "},{"location":"Java/InfoVis/PassThrough/","title":"PassThrough","text":"

        vtk-examples/Java/InfoVis/PassThrough

        "},{"location":"Java/InfoVis/PassThrough/#description","title":"Description","text":"

        vtkPassThrough object copies the input into the output.

        The output type is always the same as the input object type.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/InfoVis/PassThrough/#code","title":"Code","text":"

        PassThrough.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkPassThrough;\nimport vtk.vtkSphereSource;\n\npublic class PassThrough \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    System.out.println(\"Points before:\" + \" \" + sphereSource.GetOutput().GetNumberOfPoints());\n\n    vtkPassThrough passThrough = new vtkPassThrough();\n    passThrough.SetInputConnection(sphereSource.GetOutputPort());\n    passThrough.Update();\n    passThrough.GetOutput();\n\n    System.out.println(\"Points after:\" + \" \" + sphereSource.GetOutput().GetNumberOfPoints());\n\n  }\n}\n
        "},{"location":"Java/Interaction/Assembly/","title":"Assembly","text":"

        vtk-examples/Java/Interaction/Assembly

        "},{"location":"Java/Interaction/Assembly/#description","title":"Description","text":"

        vtkAssembly is an object that groups vtkProp3Ds, its subclasses, and other assemblies into a tree-like hierarchy.

        The vtkProp3Ds and assemblies can then be transformed together by transforming just the root assembly of the hierarchy.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Interaction/Assembly/#code","title":"Code","text":"

        Assembly.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkCubeSource;\nimport vtk.vtkAssembly;\nimport vtk.vtkTransform;\nimport vtk.vtkPropCollection;\n\n\npublic class Assembly \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For sphereActor Color\n    double sphereActorColor[] = new double[4];\n    //For cubeActor Color\n    double cubeActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Banana\", sphereActorColor);\n    colors.GetColor(\"Tomato\", cubeActorColor);\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n    sphereActor.GetProperty().SetColor(sphereActorColor);\n\n    // Create a cube\n    vtkCubeSource cubeSource = new vtkCubeSource();\n    cubeSource.SetCenter(5.0, 0.0, 0.0);\n    cubeSource.Update();\n\n    vtkPolyDataMapper cubeMapper = new vtkPolyDataMapper();\n    cubeMapper.SetInputConnection(cubeSource.GetOutputPort());\n\n    vtkActor cubeActor = new vtkActor();\n    cubeActor.SetMapper(cubeMapper);\n    cubeActor.GetProperty().SetColor(cubeActorColor);\n\n    // Combine the sphere and cube into an assembly\n    vtkAssembly assembly = new vtkAssembly();\n    assembly.AddPart(sphereActor);\n    assembly.AddPart(cubeActor);\n\n    // Apply a transform to the whole assembly\n    vtkTransform transform = new vtkTransform();\n    transform.PostMultiply(); //this is the key line\n    transform.Translate(5.0, 0, 0);\n\n    assembly.SetUserTransform(transform);\n\n    // Extract each actor from the assembly and change its opacity\n    vtkPropCollection collection = new vtkPropCollection();\n\n    assembly.GetActors(collection);\n    collection.InitTraversal();\n    cubeActor.GetProperty().SetOpacity(0.5);\n    sphereActor.GetProperty().SetOpacity(0.5);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(assembly);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Interaction/InteractorStyleTerrain/","title":"InteractorStyleTerrain","text":"

        vtk-examples/Java/Interaction/InteractorStyleTerrain

        "},{"location":"Java/Interaction/InteractorStyleTerrain/#description","title":"Description","text":"

        vtkInteractorStyleTerrain object is used to manipulate a camera which is viewing a scene with a natural view up, e.g., terrain.

        The camera in such a scene is manipulated by specifying azimuth (angle around the view up vector) and elevation (the angle from the horizon).

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Interaction/InteractorStyleTerrain/#code","title":"Code","text":"

        InteractorStyleTerrain.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkInteractorStyleTerrain;\n\npublic class InteractorStyleTerrain\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    // Create an actor\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the scene\n    ren.AddActor(Actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleTerrain style = new vtkInteractorStyleTerrain();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Interaction/PickableOff/","title":"PickableOff","text":"

        vtk-examples/Java/Interaction/PickableOff

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Interaction/PickableOff/#code","title":"Code","text":"

        PickableOff.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkConeSource;\n\npublic class PickableOff\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For coneActor0 Color\n    double coneActor0Color[] = new double[4];\n    //For coneActor1 Color\n    double coneActor1Color[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Gold\", coneActor0Color);\n    colors.GetColor(\"Lime\", coneActor1Color);\n    colors.GetColor(\"DarkGray\", Bgcolor);\n\n    vtkConeSource ConeSource0 = new vtkConeSource();\n    ConeSource0.Update();\n\n    vtkConeSource ConeSource1 = new vtkConeSource();\n    ConeSource1.SetCenter(5, 0, 0);\n    ConeSource1.Update();\n\n    vtkPolyDataMapper coneMapper0 = new vtkPolyDataMapper();\n    coneMapper0.SetInputConnection(ConeSource0.GetOutputPort());\n\n    vtkPolyDataMapper coneMapper1 = new vtkPolyDataMapper();\n    coneMapper1.SetInputConnection(ConeSource1.GetOutputPort());\n\n    vtkActor coneActor0 = new vtkActor();\n    coneActor0.SetMapper(coneMapper0);\n    coneActor0.GetProperty().SetColor(coneActor0Color);\n\n    vtkActor coneActor1 = new vtkActor();\n    coneActor1.SetMapper(coneMapper1);\n    coneActor1.GetProperty().SetColor(coneActor1Color);\n    coneActor1.PickableOff();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(coneActor0);\n    ren.AddActor(coneActor1);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Interaction/RubberBandPick/","title":"RubberBandPick","text":"

        vtk-examples/Java/Interaction/RubberBandPick

        "},{"location":"Java/Interaction/RubberBandPick/#description","title":"Description","text":"

        vtkInteractorStyleRubberBandPick object allows the user to draw a rectangle in the render window by hitting 'r' and then using the left mouse button. When the mouse button is released, the attached picker operates on the pixel in the center of the selection rectangle.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Interaction/RubberBandPick/#code","title":"Code","text":"

        RubberBandPick.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkInteractorStyleRubberBandPick;\n\npublic class RubberBandPick \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    // Create an actor\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the scene\n    ren.AddActor(Actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleRubberBandPick style = new vtkInteractorStyleRubberBandPick();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Interaction/RubberBandZoom/","title":"RubberBandZoom","text":"

        vtk-examples/Java/Interaction/RubberBandZoom

        "},{"location":"Java/Interaction/RubberBandZoom/#description","title":"Description","text":"

        This example demonstrates how to select a region of the window to zoom in.

        vtkInteractorStyleRubberBandZoom object allows the user to draw a rectangle in the render window using the left mouse button.

        When the mouse button is released, the current camera zooms by an amount determined from the shorter side of the drawn rectangle.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Interaction/RubberBandZoom/#code","title":"Code","text":"

        RubberBandZoom.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkInteractorStyleRubberBandZoom;\n\npublic class RubberBandZoom \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    // Create an actor\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the scene\n    ren.AddActor(Actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleRubberBandZoom style = new vtkInteractorStyleRubberBandZoom();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Interaction/StyleSwitch/","title":"StyleSwitch","text":"

        vtk-examples/Java/Interaction/StyleSwitch

        "},{"location":"Java/Interaction/StyleSwitch/#description","title":"Description","text":"

        The class vtkInteractorStyleSwitch allows handles interactively switching between four interactor styles -- joystick actor, joystick camera, trackball actor, and trackball camera. Type 'j' or 't' to select joystick or trackball, and type 'c' or 'a' to select camera or actor. The default interactor style is joystick camera.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Interaction/StyleSwitch/#code","title":"Code","text":"

        StyleSwitch.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkInteractorStyleSwitch;\n\npublic class StyleSwitch \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    // Create an actor\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the scene\n    ren.AddActor(Actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleSwitch style = new vtkInteractorStyleSwitch();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Interaction/TrackballActor/","title":"TrackballActor","text":"

        vtk-examples/Java/Interaction/TrackballActor

        "},{"location":"Java/Interaction/TrackballActor/#description","title":"Description","text":"

        This example shows how to visualize data in \"trackball\" mode. That is, click and drag actors is the way to interact.

        Contrast this with TrackballCamera.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Interaction/TrackballActor/#code","title":"Code","text":"

        TrackballActor.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkConeSource;\nimport vtk.vtkInteractorStyleTrackballActor;\n\npublic class TrackballActor \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(1.0, 0.0, 0.0 );\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper  = new vtkPolyDataMapper();\n    sphereMapper .SetInputData (sphereSource.GetOutput());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create a Cone\n    vtkConeSource ConeSource = new vtkConeSource();\n\n    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();\n    coneMapper.SetInputConnection(ConeSource.GetOutputPort());\n\n    vtkActor coneActor  = new vtkActor();\n    coneActor.SetMapper(coneMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor);\n    ren.AddActor(coneActor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetWindowName(\"Trackball Actor\");\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleTrackballActor style = new vtkInteractorStyleTrackballActor();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n   }\n}\n
        "},{"location":"Java/Interaction/TrackballCamera/","title":"TrackballCamera","text":"

        vtk-examples/Java/Interaction/TrackballCamera

        "},{"location":"Java/Interaction/TrackballCamera/#description","title":"Description","text":"

        This example demonstrates the trackball camera mode. When the mouse is clicked and dragged from anywhere in the window, the camera is modified.

        Contrast this with TrackballActor.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Interaction/TrackballCamera/#code","title":"Code","text":"

        TrackballCamera.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkConeSource;\nimport vtk.vtkInteractorStyleTrackballCamera;\n\npublic class TrackballCamera \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(1.0, 0.0, 0.0 );\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper  = new vtkPolyDataMapper();\n    sphereMapper .SetInputData (sphereSource.GetOutput());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create a Cone\n    vtkConeSource ConeSource = new vtkConeSource();\n\n    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();\n    coneMapper.SetInputConnection(ConeSource.GetOutputPort());\n\n    vtkActor coneActor  = new vtkActor();\n    coneActor.SetMapper(coneMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor);\n    ren.AddActor(coneActor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetWindowName(\"Trackball Camera\");\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Lighting/LightActor/","title":"LightActor","text":"

        vtk-examples/Java/Lighting/LightActor

        "},{"location":"Java/Lighting/LightActor/#description","title":"Description","text":"

        Java Program to demonstrate the use of vtkLightActor.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Lighting/LightActor/#code","title":"Code","text":"

        LightActor.java

        import java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.SwingUtilities;\n\nimport vtk.vtkLight;\nimport vtk.vtkLightActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPanel;\n\n\npublic class LightActor extends JPanel implements ActionListener {\n  private static final long serialVersionUID = 1L;\n  private vtkPanel renWin;\n  private JButton exitButton;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public LightActor() {\n    super(new BorderLayout());\n\n    // Display where the light is  \n    vtkLight Light = new vtkLight();\n    Light.SetPositional(1);\n\n    vtkLightActor LightActor = new vtkLightActor();\n    LightActor.SetLight(Light);\n\n    renWin = new vtkPanel();\n    renWin.GetRenderer().AddActor(LightActor);\n    renWin.GetRenderer().AddViewProp(LightActor);\n    renWin.resetCamera();\n\n\n    // Add Java UI components\n    exitButton = new JButton(\"Exit\");\n    exitButton.addActionListener(this);\n\n    add(renWin, BorderLayout.CENTER);\n    add(exitButton, BorderLayout.SOUTH);\n  }\n\n  /** An ActionListener that listens to the button. */\n  public void actionPerformed(ActionEvent e) {\n    if (e.getSource().equals(exitButton)) {\n      System.exit(0);\n    }\n  }\n\n  public static void main(String s[]) {\n    SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JFrame frame = new JFrame(\"Light Actor\");\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.getContentPane().setLayout(new BorderLayout());\n          frame.getContentPane().add(new LightActor(), BorderLayout.CENTER);\n          frame.setSize(400, 400);\n          frame.setLocationRelativeTo(null);\n          frame.setVisible(true);\n        }\n      });\n  }\n} \n
        "},{"location":"Java/Lighting/SpotLight/","title":"SpotLight","text":"

        vtk-examples/Java/Lighting/SpotLight

        "},{"location":"Java/Lighting/SpotLight/#description","title":"Description","text":"

        This example places two vtkLight's with PositionalOn().

        This example was inspired by Oliver Natt's question (and python script) on the VTK Users mailing list.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Lighting/SpotLight/#code","title":"Code","text":"

        SpotLight.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPlaneSource;\nimport vtk.vtkLight;\n\npublic class SpotLight\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For greenLight \n    double greenLightColor[] = new double[4];\n    //For PinkLight \n    double pinkLightColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    //Renderer Background1 Color\n    double BgColor2[] = new double[4];\n\n    //Change Color Name to Use your own Color \n    Color.GetColor(\"Lawn_green\",greenLightColor);\n    Color.GetColor(\"DeepPink\",pinkLightColor);\n    Color.GetColor(\"RoyalBlue\",BgColor);\n    Color.GetColor(\"SkyBlue\",BgColor2);\n\n    vtkPlaneSource PlaneSource = new vtkPlaneSource();\n    PlaneSource.SetOrigin(-5.0, 0.0, 5.0);\n    PlaneSource.SetPoint1(5.0, 0.0, 5.0);\n    PlaneSource.SetPoint2(-5.0, 0.0, -5.0);\n    PlaneSource.SetResolution(100, 100);\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(PlaneSource.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    vtkLight greenLight = new vtkLight();\n    greenLight.PositionalOn();\n    greenLight.SetPosition(-4.0, 4.0, -1.0);\n    greenLight.SetColor(greenLightColor);\n    greenLight.SetIntensity(0.5);\n\n    vtkLight pinkLight = new vtkLight();\n    pinkLight.PositionalOn();\n    pinkLight.SetPosition(4.0, 5.0,1.0);\n    pinkLight.SetColor(pinkLightColor);\n    pinkLight.SetIntensity(0.6);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetSize(640, 480);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(Actor);\n\n    // set camera view\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(40.0);\n    ren.GetActiveCamera().Elevation(30.0);\n\n    // add lights to the renderer\n    ren.AddLight(pinkLight);\n    ren.AddLight(greenLight);\n\n    ren.SetBackground(BgColor);\n    ren.SetBackground2(BgColor2);\n    ren.GradientBackgroundOn();\n\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Math/MatrixInverse/","title":"MatrixInverse","text":"

        vtk-examples/Java/Math/MatrixInverse

        "},{"location":"Java/Math/MatrixInverse/#description","title":"Description","text":"

        vtkMatrix3x3 object is used to represent and manipulate 3x3 matrices. Specifically, it is designed to work on 3x3 transformation matrices found in 2D rendering using homogeneous coordinates [x y w].

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Math/MatrixInverse/#code","title":"Code","text":"

        MatrixInverse.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkMatrix3x3;\n\n\npublic class MatrixInverse \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    // For a 3x3 matrices\n    vtkMatrix3x3 Matrix = new vtkMatrix3x3();\n\n    Matrix.SetElement(2, 1, 2.0); // Set element (0,0) to 1.0\n\n    System.out.println(Matrix);\n\n    Matrix.Invert();\n\n    System.out.println(Matrix); \n  }\n}\n
        "},{"location":"Java/Math/MatrixTranspose/","title":"MatrixTranspose","text":"

        vtk-examples/Java/Math/MatrixTranspose

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Math/MatrixTranspose/#code","title":"Code","text":"

        MatrixTranspose.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkMatrix3x3;\n\npublic class MatrixTranspose \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    // For a 3x3 matrices\n    vtkMatrix3x3 Matrix = new vtkMatrix3x3();\n\n    Matrix.SetElement(2, 1, 2.0); // Set element (0,0) to 1.0\n\n    System.out.println(Matrix);\n\n    Matrix.Transpose();\n\n    System.out.println(Matrix); \n  }\n}\n
        "},{"location":"Java/Math/NormalizeVector/","title":"NormalizeVector","text":"

        vtk-examples/Java/Math/NormalizeVector

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Math/NormalizeVector/#code","title":"Code","text":"

        NormalizeVector.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkMath;\n\n\npublic class NormalizeVector\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    double a[] = new double[] {100.0, 2.0, 1.0};\n    System.out.println(a[0] + \" \" + a[1] + \" \" + a[2]);\n    vtkMath M = new vtkMath();\n    M.Normalize(a);\n    System.out.println(a[0] + \" \" + a[1] + \" \" + a[2]);\n  }\n}\n
        "},{"location":"Java/Medical/MedicalDemo1/","title":"MedicalDemo1","text":"

        vtk-examples/Java/Medical/MedicalDemo1

        "},{"location":"Java/Medical/MedicalDemo1/#description","title":"Description","text":"

        The skin extracted from a CT dataset of the head.

        usage

        MedicalDemo1 FullHead.mhd

        Note

        This original source code for this example is here.

        Info

        See Figure 12-2 in Chapter 12 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Medical/MedicalDemo1/#code","title":"Code","text":"

        MedicalDemo1.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkMetaImageReader;\nimport vtk.vtkMarchingCubes;\nimport vtk.vtkOutlineFilter;\nimport vtk.vtkCamera;\n\n\npublic class MedicalDemo1 \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.mhd) e.g FullHead.mhd\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For skin  Color\n    double skinColor[] = new double[4];\n    //For outline Color\n    double outlineColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Coral\", skinColor);\n    colors.GetColor(\"Black\", outlineColor);\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkMetaImageReader reader = new vtkMetaImageReader();\n    reader.SetFileName(inputFilename);\n\n    // An isosurface, or contour value of 500 is known to correspond to the skin of the patient.\n    vtkMarchingCubes skinExtractor = new vtkMarchingCubes();\n    skinExtractor.SetInputConnection(reader.GetOutputPort());\n    skinExtractor.SetValue(0, 500);\n\n    vtkPolyDataMapper skinMapper = new vtkPolyDataMapper();\n    skinMapper.SetInputConnection(skinExtractor.GetOutputPort());\n    skinMapper.ScalarVisibilityOff();\n\n    vtkActor skin = new vtkActor();\n    skin.SetMapper(skinMapper);\n    skin.GetProperty().SetDiffuseColor(skinColor);\n\n    // An outline provides context around the data.\n    vtkOutlineFilter outlineData = new vtkOutlineFilter();\n    outlineData.SetInputConnection(reader.GetOutputPort());\n\n    vtkPolyDataMapper mapOutline = new vtkPolyDataMapper();\n    mapOutline.SetInputConnection(outlineData.GetOutputPort());\n\n    vtkActor outline = new vtkActor();\n    outline.SetMapper(mapOutline);\n    outline.GetProperty().SetColor(outlineColor);\n\n    // It is convenient to create an initial view of the data. \n    // The FocalPoint and Position form a vector direction. \n    // Later on (ResetCamera() method) this vector is used to position the camera to look at the data in this direction.\n\n    vtkCamera aCamera = new vtkCamera();\n    aCamera.SetViewUp (0, 0, -1);\n    aCamera.SetPosition (0, -1, 0);\n    aCamera.SetFocalPoint (0, 0, 0);\n    aCamera.ComputeViewPlaneNormal();\n    aCamera.Azimuth(30.0);\n    aCamera.Elevation(30.0);\n\n    // Actors are added to the renderer. An initial camera view is created.\n    // The Dolly() method moves the camera towards the FocalPoint, thereby enlarging the image.\n\n    ren.AddActor(outline);\n    ren.AddActor(skin);\n    ren.SetActiveCamera(aCamera);\n    ren.ResetCamera ();\n    aCamera.Dolly(1.0);\n\n    // Set a background color for the renderer and set the size of the\n    // render window (expressed in pixels).\n    ren.SetBackground(Bgcolor);\n\n    // Note that when camera movement occurs (as it does in the Dolly()\n    // method), the clipping planes often need adjusting. Clipping planes\n    // consist of two planes: near and far along the view direction. The\n    // near plane clips out objects in front of the plane; the far plane\n    // clips out objects behind the plane. This way only what is drawn\n    // between the planes is actually rendered.\n    ren.ResetCameraClippingRange ();\n\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Medical/MedicalDemo2/","title":"MedicalDemo2","text":"

        vtk-examples/Java/Medical/MedicalDemo2

        "},{"location":"Java/Medical/MedicalDemo2/#description","title":"Description","text":"

        Skin and bone isosurfaces.

        Usage

        MedicalDemo2 FullHead.mhd

        Note

        This original source code for this example is here.

        Info

        See Figure 12-3 in Chapter 12 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Medical/MedicalDemo2/#code","title":"Code","text":"

        MedicalDemo2.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkMetaImageReader;\nimport vtk.vtkMarchingCubes;\nimport vtk.vtkOutlineFilter;\nimport vtk.vtkCamera;\nimport vtk.vtkStripper;\n\npublic class MedicalDemo2\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.mhd) e.g FullHead.mhd\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For bone Color\n    double boneColor[] = new double[4];\n    //For skin  Color\n    double skinColor[] = new double[4];\n    //For outline Color\n    double outlineColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Ivory\", boneColor);\n    colors.GetColor(\"Coral\", skinColor);\n    colors.GetColor(\"Black\", outlineColor);\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // The following reader is used to read a series of 2D slices (images)\n    // that compose the volume. The slice dimensions are set, and the\n    // pixel spacing. The data Endianness must also be specified. The reader\n    // uses the FilePrefix in combination with the slice number to construct\n    // filenames using the format FilePrefix.%d. (In this case the FilePrefix\n    // is the root name of the file: quarter.)\n\n    vtkMetaImageReader reader = new vtkMetaImageReader();\n    reader.SetFileName(inputFilename);\n\n    // An isosurface, or contour value of 500 is known to correspond to the\n    // skin of the patient.\n    // The triangle stripper is used to create triangle strips from the\n    // isosurface; these render much faster on many systems.\n    vtkMarchingCubes skinExtractor = new vtkMarchingCubes();\n    skinExtractor.SetInputConnection(reader.GetOutputPort());\n    skinExtractor.SetValue(0, 500);\n\n    vtkStripper skinStripper = new  vtkStripper();\n    skinStripper.SetInputConnection(skinExtractor.GetOutputPort());\n\n    vtkPolyDataMapper skinMapper = new vtkPolyDataMapper();\n    skinMapper.SetInputConnection(skinStripper.GetOutputPort());\n    skinMapper.ScalarVisibilityOff();\n\n    vtkActor skin = new vtkActor();\n    skin.SetMapper(skinMapper);\n    skin.GetProperty().SetDiffuseColor(skinColor);\n    skin.GetProperty().SetSpecular(.3);\n    skin.GetProperty().SetSpecularPower(20);\n    skin.GetProperty().SetOpacity(.5);\n\n    // An isosurface, or contour value of 1150 is known to correspond to the\n    // bone of the patient.\n    // The triangle stripper is used to create triangle strips from the\n    // isosurface; these render much faster on may systems.\n    vtkMarchingCubes boneExtractor = new vtkMarchingCubes();\n    boneExtractor.SetInputConnection(reader.GetOutputPort());\n    boneExtractor.SetValue(0, 1150);\n\n    vtkStripper boneStripper = new vtkStripper();\n    boneStripper.SetInputConnection(boneExtractor.GetOutputPort());\n\n    vtkPolyDataMapper boneMapper = new vtkPolyDataMapper();\n    boneMapper.SetInputConnection(boneStripper.GetOutputPort());\n    boneMapper.ScalarVisibilityOff();\n\n    vtkActor bone = new vtkActor();\n    bone.SetMapper(boneMapper);\n    bone.GetProperty().SetDiffuseColor(boneColor);\n\n    // An outline provides context around the data.\n    vtkOutlineFilter outlineData = new vtkOutlineFilter();\n    outlineData.SetInputConnection(reader.GetOutputPort());\n\n    vtkPolyDataMapper mapOutline = new vtkPolyDataMapper();\n    mapOutline.SetInputConnection(outlineData.GetOutputPort());\n\n    vtkActor outline = new vtkActor();\n    outline.SetMapper(mapOutline);\n    outline.GetProperty().SetColor(outlineColor);\n\n    // It is convenient to create an initial view of the data. \n    // The FocalPoint and Position form a vector direction. \n    // Later on (ResetCamera() method) this vector is used to position the camera to look at the data in this direction.\n\n    vtkCamera aCamera = new vtkCamera();\n    aCamera.SetViewUp (0, 0, -1);\n    aCamera.SetPosition (0, -1, 0);\n    aCamera.SetFocalPoint (0, 0, 0);\n    aCamera.ComputeViewPlaneNormal();\n    aCamera.Azimuth(30.0);\n    aCamera.Elevation(30.0);\n\n    // Actors are added to the renderer. An initial camera view is created.\n    // The Dolly() method moves the camera towards the FocalPoint, thereby enlarging the image.\n\n    ren.AddActor(outline);\n    ren.AddActor(skin);\n    ren.AddActor(bone);\n    ren.SetActiveCamera(aCamera);\n    ren.ResetCamera ();\n    aCamera.Dolly(1.0);\n\n    // Set a background color for the renderer and set the size of the\n    // render window (expressed in pixels).\n    ren.SetBackground(Bgcolor);\n\n    // Note that when camera movement occurs (as it does in the Dolly()\n    // method), the clipping planes often need adjusting. Clipping planes\n    // consist of two planes: near and far along the view direction. The\n    // near plane clips out objects in front of the plane; the far plane\n    // clips out objects behind the plane. This way only what is drawn\n    // between the planes is actually rendered.\n    ren.ResetCameraClippingRange ();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Medical/MedicalDemo3/","title":"MedicalDemo3","text":"

        vtk-examples/Java/Medical/MedicalDemo3

        "},{"location":"Java/Medical/MedicalDemo3/#description","title":"Description","text":"

        Composite image of three planes and translucent skin

        Usage

        MedicalDemo3 FullHead.mhd

        Note

        This original source code for this example is here.

        Info

        See Figure 12-4 in Chapter 12 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Medical/MedicalDemo3/#code","title":"Code","text":"

        MedicalDemo3.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkMetaImageReader;\nimport vtk.vtkMarchingCubes;\nimport vtk.vtkOutlineFilter;\nimport vtk.vtkCamera;\nimport vtk.vtkStripper;\nimport vtk.vtkLookupTable;\nimport vtk.vtkImageMapToColors;\nimport vtk.vtkImageActor;\n\npublic class MedicalDemo3\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.mhd) e.g FullHead.mhd\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For bone Color\n    double boneColor[] = new double[4];\n    //For skin  Color\n    double skinColor[] = new double[4];\n    //For outline Color\n    double outlineColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Ivory\", boneColor);\n    colors.GetColor(\"Coral\", skinColor);\n    colors.GetColor(\"Black\", outlineColor);\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // The following reader is used to read a series of 2D slices (images)\n    // that compose the volume. The slice dimensions are set, and the\n    // pixel spacing. The data Endianness must also be specified. The reader\n    // uses the FilePrefix in combination with the slice number to construct\n    // filenames using the format FilePrefix.%d. (In this case the FilePrefix\n    // is the root name of the file: quarter.)\n\n    vtkMetaImageReader reader = new vtkMetaImageReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    // An isosurface, or contour value of 500 is known to correspond to the\n    // skin of the patient.\n    // The triangle stripper is used to create triangle strips from the\n    // isosurface; these render much faster on many systems.\n    vtkMarchingCubes skinExtractor = new vtkMarchingCubes();\n    skinExtractor.SetInputConnection(reader.GetOutputPort());\n    skinExtractor.SetValue(0, 500);\n    skinExtractor.Update();\n\n    vtkStripper skinStripper = new  vtkStripper();\n    skinStripper.SetInputConnection(skinExtractor.GetOutputPort());\n    skinStripper.Update();\n\n    vtkPolyDataMapper skinMapper = new vtkPolyDataMapper();\n    skinMapper.SetInputConnection(skinStripper.GetOutputPort());\n    skinMapper.ScalarVisibilityOff();\n\n    vtkActor skin = new vtkActor();\n    skin.SetMapper(skinMapper);\n    skin.GetProperty().SetDiffuseColor(skinColor);\n    skin.GetProperty().SetSpecular(.3);\n    skin.GetProperty().SetSpecularPower(20);\n\n    // An isosurface, or contour value of 1150 is known to correspond to the\n    // bone of the patient.\n    // The triangle stripper is used to create triangle strips from the\n    // isosurface; these render much faster on may systems.\n    vtkMarchingCubes boneExtractor = new vtkMarchingCubes();\n    boneExtractor.SetInputConnection(reader.GetOutputPort());\n    boneExtractor.SetValue(0, 1150);\n\n    vtkStripper boneStripper = new vtkStripper();\n    boneStripper.SetInputConnection(boneExtractor.GetOutputPort());\n\n    vtkPolyDataMapper boneMapper = new vtkPolyDataMapper();\n    boneMapper.SetInputConnection(boneStripper.GetOutputPort());\n    boneMapper.ScalarVisibilityOff();\n\n    vtkActor bone = new vtkActor();\n    bone.SetMapper(boneMapper);\n    bone.GetProperty().SetDiffuseColor(boneColor);\n\n    // An outline provides context around the data.\n    vtkOutlineFilter outlineData = new vtkOutlineFilter();\n    outlineData.SetInputConnection(reader.GetOutputPort());\n\n    vtkPolyDataMapper mapOutline = new vtkPolyDataMapper();\n    mapOutline.SetInputConnection(outlineData.GetOutputPort());\n\n    vtkActor outline = new vtkActor();\n    outline.SetMapper(mapOutline);\n    outline.GetProperty().SetColor(outlineColor);\n\n    // Now we are creating three orthogonal planes passing through the volume. \n    // Each plane uses a different texture map and therefore has different coloration.\n    // Start by creating a black/white lookup table.\n\n    vtkLookupTable bwLut = new vtkLookupTable();\n    bwLut.SetTableRange (0, 2000);\n    bwLut.SetSaturationRange (0, 0);\n    bwLut.SetHueRange (0, 0);\n    bwLut.SetValueRange (0, 1);\n    bwLut.Build(); //effective built\n\n    // Now create a lookup table that consists of the full hue circle (from HSV).\n    vtkLookupTable hueLut = new vtkLookupTable();\n    hueLut.SetTableRange (0, 2000);\n    hueLut.SetHueRange (0, 1);\n    hueLut.SetSaturationRange (1, 1);\n    hueLut.SetValueRange (1, 1);\n    hueLut.Build(); //effective built\n\n    // Finally, create a lookup table with a single hue but having a range\n    // in the saturation of the hue.\n    vtkLookupTable satLut = new vtkLookupTable();\n    satLut.SetTableRange (0, 2000);\n    satLut.SetHueRange (.6, .6);\n    satLut.SetSaturationRange (0, 1);\n    satLut.SetValueRange (1, 1);\n    satLut.Build(); //effective built\n\n    // Create the first of the three planes. The filter vtkImageMapToColors\n    // maps the data through the corresponding lookup table created above.  The\n    // vtkImageActor is a type of vtkProp and conveniently displays an image on\n    // a single quadrilateral plane. It does this using texture mapping and as\n    // a result is quite fast. (Note: the input image has to be unsigned char\n    // values, which the vtkImageMapToColors produces.) Note also that by\n    // specifying the DisplayExtent, the pipeline requests data of this extent\n    // and the vtkImageMapToColors only processes a slice of data.\n\n    vtkImageMapToColors sagittalColors = new vtkImageMapToColors();\n    sagittalColors.SetInputConnection(reader.GetOutputPort());\n    sagittalColors.SetLookupTable(bwLut);\n    sagittalColors.Update();\n\n    vtkImageActor sagittal = new vtkImageActor();\n    sagittal.GetMapper().SetInputConnection(sagittalColors.GetOutputPort());\n    sagittal.SetDisplayExtent(128, 128, 0,255, 0,92);\n    sagittal.ForceOpaqueOn();\n\n    // Create the second (axial) plane of the three planes. We use the\n    // same approach as before except that the extent differs.\n    vtkImageMapToColors axialColors = new vtkImageMapToColors();\n    axialColors.SetInputConnection(reader.GetOutputPort());\n    axialColors.SetLookupTable(hueLut);\n    axialColors.Update();\n\n    vtkImageActor axial = new vtkImageActor();\n    axial.GetMapper().SetInputConnection(axialColors.GetOutputPort());\n    axial.SetDisplayExtent(0,255, 0,255, 46,46);\n    axial.ForceOpaqueOn();\n\n    // Create the third (coronal) plane of the three planes. We use\n    // the same approach as before except that the extent differs.\n    vtkImageMapToColors coronalColors = new vtkImageMapToColors();\n    coronalColors.SetInputConnection(reader.GetOutputPort());\n    coronalColors.SetLookupTable(satLut);\n    coronalColors.Update();\n\n    vtkImageActor coronal = new vtkImageActor();\n    coronal.GetMapper().SetInputConnection(coronalColors.GetOutputPort());\n    coronal.SetDisplayExtent(0,255, 128,128, 0,92);\n    coronal.ForceOpaqueOn();\n\n    // It is convenient to create an initial view of the data. \n    // The FocalPoint and Position form a vector direction. \n    // Later on (ResetCamera() method) this vector is used to position the camera to look at the data in this direction.\n\n    vtkCamera aCamera = new vtkCamera();\n    aCamera.SetViewUp (0, 0, -1);\n    aCamera.SetPosition (0, -1, 0);\n    aCamera.SetFocalPoint (0, 0, 0);\n    aCamera.ComputeViewPlaneNormal();\n    aCamera.Azimuth(30.0);\n    aCamera.Elevation(30.0);\n\n    // Actors are added to the renderer. An initial camera view is created.\n    // The Dolly() method moves the camera towards the FocalPoint, thereby enlarging the image.\n\n    ren.AddActor(outline);\n    ren.AddActor(sagittal);\n    ren.AddActor(axial);\n    ren.AddActor(coronal);\n    ren.AddActor(skin);\n    ren.AddActor(bone);\n    ren.SetActiveCamera(aCamera);\n    ren.ResetCamera ();\n    aCamera.Dolly(1.0);\n\n    // Turn off bone for this example.\n    bone.VisibilityOff();\n\n    // Set skin to semi-transparent.\n    skin.GetProperty().SetOpacity(0.5);\n\n    // Set a background color for the renderer and set the size of the\n    // render window (expressed in pixels).\n    ren.SetBackground(Bgcolor);\n\n    // Note that when camera movement occurs (as it does in the Dolly()\n    // method), the clipping planes often need adjusting. Clipping planes\n    // consist of two planes: near and far along the view direction. The\n    // near plane clips out objects in front of the plane; the far plane\n    // clips out objects behind the plane. This way only what is drawn\n    // between the planes is actually rendered.\n    ren.ResetCameraClippingRange ();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Medical/MedicalDemo4/","title":"MedicalDemo4","text":"

        vtk-examples/Java/Medical/MedicalDemo4

        "},{"location":"Java/Medical/MedicalDemo4/#description","title":"Description","text":"

        Volume rendering of the dataset.

        Usage

        MedicalDemo4 FullHead.mhd

        Note

        This original source code for this example is here.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Medical/MedicalDemo4/#code","title":"Code","text":"

        MedicalDemo4.java

        import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkMetaImageReader;\nimport vtk.vtkCamera;\nimport vtk.vtkColorTransferFunction;\nimport vtk.vtkPiecewiseFunction;\nimport vtk.vtkFixedPointVolumeRayCastMapper;\nimport vtk.vtkVolumeProperty;\nimport vtk.vtkVolume;\n\npublic class MedicalDemo4 \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.mhd) e.g FullHead.mhd\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // The following reader is used to read a series of 2D slices (images)\n    // that compose the volume. The slice dimensions are set, and the\n    // pixel spacing. The data Endianness must also be specified. The reader\n    // uses the FilePrefix in combination with the slice number to construct\n    // filenames using the format FilePrefix.%d. (In this case the FilePrefix\n    // is the root name of the file: quarter.)\n\n    vtkMetaImageReader reader = new vtkMetaImageReader();\n    reader.SetFileName(inputFilename);\n\n    // The volume will be displayed by ray-cast alpha compositing.\n    // A ray-cast mapper is needed to do the ray-casting.\n    vtkFixedPointVolumeRayCastMapper volumeMapper = new vtkFixedPointVolumeRayCastMapper();\n    volumeMapper.SetInputConnection(reader.GetOutputPort());\n\n    // The color transfer function maps voxel intensities to colors.\n    // It is modality-specific, and often anatomy-specific as well.\n    // The goal is to one color for flesh (between 500 and 1000)\n    // and another color for bone (1150 and over).\n    vtkColorTransferFunction volumeColor = new vtkColorTransferFunction();\n    volumeColor.AddRGBPoint(0,    0.0, 0.0, 0.0);\n    volumeColor.AddRGBPoint(500,  1.0, 0.5, 0.3);\n    volumeColor.AddRGBPoint(1000, 1.0, 0.5, 0.3);\n    volumeColor.AddRGBPoint(1150, 1.0, 1.0, 0.9);\n\n    // The opacity transfer function is used to control the opacity\n    // of different tissue types.\n    vtkPiecewiseFunction volumeScalarOpacity = new vtkPiecewiseFunction();\n    volumeScalarOpacity.AddPoint(0,    0.00);\n    volumeScalarOpacity.AddPoint(500,  0.15);\n    volumeScalarOpacity.AddPoint(1000, 0.15);\n    volumeScalarOpacity.AddPoint(1150, 0.85);\n\n    // The gradient opacity function is used to decrease the opacity\n    // in the \"flat\" regions of the volume while maintaining the opacity\n    // at the boundaries between tissue types.  The gradient is measured\n    // as the amount by which the intensity changes over unit distance.\n    // For most medical data, the unit distance is 1mm.\n    vtkPiecewiseFunction volumeGradientOpacity = new vtkPiecewiseFunction();\n    volumeGradientOpacity.AddPoint(0,   0.0);\n    volumeGradientOpacity.AddPoint(90,  0.5);\n    volumeGradientOpacity.AddPoint(100, 1.0);\n\n    // The VolumeProperty attaches the color and opacity functions to the\n    // volume, and sets other volume properties.  The interpolation should\n    // be set to linear to do a high-quality rendering.  The ShadeOn option\n    // turns on directional lighting, which will usually enhance the\n    // appearance of the volume and make it look more \"3D\".  However,\n    // the quality of the shading depends on how accurately the gradient\n    // of the volume can be calculated, and for noisy data the gradient\n    // estimation will be very poor.  The impact of the shading can be\n    // decreased by increasing the Ambient coefficient while decreasing\n    // the Diffuse and Specular coefficient.  To increase the impact\n    // of shading, decrease the Ambient and increase the Diffuse and Specular.\n    vtkVolumeProperty volumeProperty = new vtkVolumeProperty();\n    volumeProperty.SetColor(volumeColor);\n    volumeProperty.SetScalarOpacity(volumeScalarOpacity);\n    volumeProperty.SetGradientOpacity(volumeGradientOpacity);\n    volumeProperty.SetInterpolationTypeToLinear();\n    volumeProperty.ShadeOn();\n    volumeProperty.SetAmbient(0.4);\n    volumeProperty.SetDiffuse(0.6);\n    volumeProperty.SetSpecular(0.2);\n\n    // The vtkVolume is a vtkProp3D (like a vtkActor) and controls the position\n    // and orientation of the volume in world coordinates.\n    vtkVolume volume = new vtkVolume();\n    volume.SetMapper(volumeMapper);\n    volume.SetProperty(volumeProperty);\n    double c[] = new double[3];\n    c=volume.GetCenter();\n\n    ren.AddViewProp(volume);\n\n    // Set up an initial view of the volume.  The focal point will be the\n    // center of the volume, and the camera position will be 400mm to the\n    // patient's left (which is our right).\n\n    vtkCamera camera = new vtkCamera();\n    camera.SetViewUp (0, 0, -1);\n    camera.SetPosition (c[0], c[1] - 400, c[2]);\n    camera.SetFocalPoint (c[0], c[1], c[2]);\n    camera.Azimuth(30.0);\n    camera.Elevation(30.0);\n    camera.Dolly(0.75);\n\n    // Actors are added to the renderer. An initial camera view is created.\n    // The Dolly() method moves the camera towards the FocalPoint, thereby enlarging the image.\n\n    ren.SetActiveCamera(camera);\n\n    // Set a background color for the renderer and set the size of the\n    // render window (expressed in pixels).\n    ren.SetBackground(Bgcolor);\n\n    // Note that when camera movement occurs (as it does in the Dolly()\n    // method), the clipping planes often need adjusting. Clipping planes\n    // consist of two planes: near and far along the view direction. The\n    // near plane clips out objects in front of the plane; the far plane\n    // clips out objects behind the plane. This way only what is drawn\n    // between the planes is actually rendered.\n    ren.ResetCameraClippingRange ();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Meshes/AddCell/","title":"AddCell","text":"

        vtk-examples/Java/Meshes/AddCell

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Meshes/AddCell/#code","title":"Code","text":"

        AddCell.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkTriangle;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\n\npublic class AddCell\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //  Create a triangle\n    vtkPoints points = new vtkPoints();\n    points.InsertNextPoint ( 1.0, 0.0, 0.0 );\n    points.InsertNextPoint ( 0.0, 0.0, 0.0 );\n    points.InsertNextPoint ( 0.0, 1.0, 0.0 );\n\n    vtkTriangle triangle = new vtkTriangle();\n    triangle.GetPointIds().SetId ( 0, 0 );\n    triangle.GetPointIds().SetId ( 1, 1 );\n    triangle.GetPointIds().SetId ( 2, 2 );\n\n    vtkCellArray triangles = new vtkCellArray();\n    triangles.InsertNextCell ( triangle );\n\n    // Create a polydata object\n    vtkPolyData polyData = new vtkPolyData();\n\n    // Add the geometry and topology to the polydata\n    polyData.SetPoints ( points );\n    polyData.SetPolys ( triangles );\n\n    System.out.println(\"There are \" + \" \" + polyData.GetNumberOfCells() + \" \" + \"cells.\");\n    polyData.GetPolys().InsertNextCell(triangle);\n    System.out.println(\"There are \" + \" \" + polyData.GetNumberOfCells() + \" \" + \"cells.\");\n\n  }\n}\n
        "},{"location":"Java/Meshes/BoundaryEdges/","title":"BoundaryEdges","text":"

        vtk-examples/Java/Meshes/BoundaryEdges

        "},{"location":"Java/Meshes/BoundaryEdges/#description","title":"Description","text":"

        vtkFeatureEdges object is a filter to extract special types of edges from input polygonal data.

        These edges are either 1) boundary (used by one polygon) or a line cell 2) non-manifold (used by three or more polygons) 3) feature edges (edges used by two triangles and whose dihedral angle > FeatureAngle) or 4) manifold edges (edges used by exactly two polygons).

        Edges may also be \"colored\" (i.e., scalar values assigned) based on edge type. The cell coloring is assigned to the cell data of the extracted edges.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Meshes/BoundaryEdges/#code","title":"Code","text":"

        BoundaryEdges.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkDiskSource;\nimport vtk.vtkFeatureEdges;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\n\n\npublic class BoundaryEdges\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4]; \n\n    colors.GetColor(\"DarkSeaGreen\", Bgcolor);\n\n    vtkDiskSource diskSource = new vtkDiskSource();\n    diskSource.Update();\n    vtkFeatureEdges featureEdges = new vtkFeatureEdges();\n    featureEdges.SetInputConnection(diskSource.GetOutputPort());\n    featureEdges.BoundaryEdgesOn();\n    featureEdges.FeatureEdgesOff();\n    featureEdges.ManifoldEdgesOff();\n    featureEdges.NonManifoldEdgesOff();\n    featureEdges.Update();\n\n    //Visualize the Actor\n    vtkPolyDataMapper edgeMapper = new vtkPolyDataMapper();\n    edgeMapper.SetInputConnection(featureEdges.GetOutputPort());\n    vtkActor edgeActor = new vtkActor();\n    edgeActor.SetMapper(edgeMapper);\n\n    vtkPolyDataMapper diskMapper = new vtkPolyDataMapper();\n    diskMapper.SetInputConnection(diskSource.GetOutputPort());\n    vtkActor diskActor = new vtkActor();\n    diskActor.SetMapper(diskMapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(diskActor);\n    ren.AddActor(edgeActor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Modelling/Bottle/","title":"Bottle","text":"

        vtk-examples/Java/Modelling/Bottle

        "},{"location":"Java/Modelling/Bottle/#description","title":"Description","text":"

        vtkRotationalExtrusionFilter object is a modeling filter.

        It takes polygonal data as input and generates polygonal data on output. The input dataset is swept around the z-axis to create new polygonal primitives.

        These primitives form a \"skirt\" or swept surface. For example, sweeping a line results in a cylindrical shell, and sweeping a circle creates a torus.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Modelling/Bottle/#code","title":"Code","text":"

        Bottle.java

        import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPoints;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkRotationalExtrusionFilter;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkActor;\nimport vtk.vtkStripper;\nimport vtk.vtkTubeFilter;\n\n\npublic class Bottle\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\npublic static void main(String args[]) \n{\n\n  vtkNamedColors colors = new vtkNamedColors(); \n\n  //Bottle Actor Color\n  double Bottlecolor[] = new double[4]; \n  colors.GetColor(\"Mint\", Bottlecolor);\n  //ProfileActor Color\n  double ProfileActorcolor[] = new double[4]; \n  colors.GetColor(\"Tomato\", ProfileActorcolor);\n  //Renderer Background Color\n  double Bgcolor[] = new double[4]; \n  colors.GetColor(\"Burlywood\", Bgcolor);\n\n  //Create the renderer, render window and interactor.\n  vtkRenderer ren = new vtkRenderer();\n  vtkRenderWindow renWin = new vtkRenderWindow();\n  renWin.AddRenderer(ren);\n  vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n  iren.SetRenderWindow(renWin);\n\n  //create bottle profile\n\n  vtkPoints points = new vtkPoints();\n  points.InsertPoint(0, 0.01, 0.0, 0.0);\n  points.InsertPoint(1, 1.5, 0.0, 0.0);\n  points.InsertPoint(2, 1.5, 0.0, 3.5);\n  points.InsertPoint(3, 1.25, 0.0, 3.75);\n  points.InsertPoint(4, 0.75, 0.0, 4.00);\n  points.InsertPoint(5, 0.6, 0.0, 4.35);\n  points.InsertPoint(6, 0.7, 0.0, 4.65);\n  points.InsertPoint(7, 1.0, 0.0, 4.75);\n  points.InsertPoint(8, 1.0, 0.0, 5.0);\n  points.InsertPoint(9, 0.2, 0.0, 5.0);\n\n  vtkCellArray lines = new vtkCellArray();\n  lines.InsertNextCell(10);//number of points\n  lines.InsertCellPoint(0);\n  lines.InsertCellPoint(1);\n  lines.InsertCellPoint(2);\n  lines.InsertCellPoint(3);\n  lines.InsertCellPoint(4);\n  lines.InsertCellPoint(5);\n  lines.InsertCellPoint(6);\n  lines.InsertCellPoint(7);\n  lines.InsertCellPoint(8);\n  lines.InsertCellPoint(9);\n\n  vtkPolyData profile = new vtkPolyData();\n  profile.SetPoints(points);\n  profile.SetLines(lines);\n\n  //extrude profile to make bottle\n\n  vtkRotationalExtrusionFilter extrude = new vtkRotationalExtrusionFilter();\n  extrude.SetInputData(profile);\n  extrude.SetResolution(60);\n\n  vtkPolyDataMapper map = new vtkPolyDataMapper();\n  map.SetInputConnection(extrude.GetOutputPort());\n\n  vtkActor bottle = new vtkActor();\n  bottle.SetMapper(map);\n  bottle.GetProperty().SetColor(Bottlecolor);\n\n  //display the profile\n  vtkStripper stripper = new vtkStripper();\n  stripper.SetInputData(profile);\n\n  vtkTubeFilter tubes = new vtkTubeFilter();\n  tubes.SetInputConnection(stripper.GetOutputPort());\n  tubes.SetNumberOfSides(11);\n  tubes.SetRadius(.05);\n\n  vtkPolyDataMapper profileMapper = new vtkPolyDataMapper();\n  profileMapper.SetInputConnection(tubes.GetOutputPort());\n\n  vtkActor profileActor = new vtkActor();\n  profileActor.SetMapper(profileMapper);\n  profileActor.GetProperty().SetColor(ProfileActorcolor);\n\n  //Add the actors to the renderer, set the background and size\n  ren.AddActor(bottle);\n  ren.AddActor(profileActor);\n  ren.SetBackground(Bgcolor);\n\n  renWin.SetSize(640,480);\n  renWin.Render();\n\n  ren.GetActiveCamera().SetPosition(1, 0, 0);\n  ren.GetActiveCamera().SetFocalPoint(0, 0, 0);\n  ren.GetActiveCamera().SetViewUp(0, 0, 1);\n  ren.ResetCamera();\n  ren.GetActiveCamera().Azimuth(30);\n  ren.GetActiveCamera().Elevation(30);\n\n  iren.Initialize();\n  iren.Start();\n\n }\n}\n
        "},{"location":"Java/Modelling/DelaunayMesh/","title":"DelaunayMesh","text":"

        vtk-examples/Java/Modelling/DelaunayMesh

        "},{"location":"Java/Modelling/DelaunayMesh/#description","title":"Description","text":"

        This is two dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlited with spheres and tubes.

        Info

        See Figure 9-54 in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Modelling/DelaunayMesh/#code","title":"Code","text":"

        DelaunayMesh.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPoints;\nimport vtk.vtkMinimalStandardRandomSequence;\nimport vtk.vtkPolyData;\nimport vtk.vtkDelaunay2D;\nimport vtk.vtkExtractEdges;\nimport vtk.vtkTubeFilter;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkSphereSource;\n\npublic class DelaunayMesh \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For mesh Actor Color\n    double meshActorColor[] = new double[4];\n    //For edge Actor Color\n    double edgeActorColor[] = new double[4];\n    //For ball Actor Color\n    double ballActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change mesh Actor Color\n    Color.GetColor(\"MidnightBlue\",meshActorColor);\n    //Change Color Name to Use your own Color for Change edge Actor Color\n    Color.GetColor(\"Peacock\",edgeActorColor);\n    //Change Color Name to Use your own Color for Change ball Actor Color\n    Color.GetColor(\"hot_pink\",ballActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"AliceBlue\",BgColor);\n\n    //Generate some \"random\" points.\n    vtkPoints points = new vtkPoints();\n    vtkMinimalStandardRandomSequence randomSequence = new vtkMinimalStandardRandomSequence();\n    randomSequence.SetSeed(1);\n    double p1;\n    double p2;\n    for (int i = 0; i < 50; ++i)\n    {\n      p1 = randomSequence.GetValue();\n      randomSequence.Next();\n      p2 = randomSequence.GetValue();\n      randomSequence.Next();\n      points.InsertPoint(i, p1, p2, 0.0);\n    }\n\n    //Create a polydata with the points we just created.\n    vtkPolyData profile = new vtkPolyData();\n    profile.SetPoints(points);\n\n    //Perform a 2D Delaunay triangulation on them.\n    vtkDelaunay2D delny = new vtkDelaunay2D();\n    delny.SetInputData(profile);\n    delny.SetTolerance(0.001);\n    vtkPolyDataMapper mapMesh = new vtkPolyDataMapper();\n    mapMesh.SetInputConnection(delny.GetOutputPort());\n\n    vtkActor meshActor = new vtkActor();\n    meshActor.SetMapper(mapMesh);\n    meshActor.GetProperty().SetColor(meshActorColor);\n\n    // We will now create a nice looking mesh by wrapping the edges in tubes,\n    // and putting fat spheres at the points.\n    vtkExtractEdges extract = new vtkExtractEdges();\n    extract.SetInputConnection(delny.GetOutputPort());\n\n    vtkTubeFilter tubes = new vtkTubeFilter();\n    tubes.SetInputConnection(extract.GetOutputPort());\n    tubes.SetRadius(0.01);\n    tubes.SetNumberOfSides(6);\n\n    vtkPolyDataMapper mapEdges = new vtkPolyDataMapper();\n    mapEdges.SetInputConnection(tubes.GetOutputPort());\n\n    vtkActor edgeActor = new vtkActor();\n    edgeActor.SetMapper(mapEdges);\n    edgeActor.GetProperty().SetColor(edgeActorColor);\n    edgeActor.GetProperty().SetSpecularColor(1, 1, 1);\n    edgeActor.GetProperty().SetSpecular(0.3);\n    edgeActor.GetProperty().SetSpecularPower(20);\n    edgeActor.GetProperty().SetAmbient(0.2);\n    edgeActor.GetProperty().SetDiffuse(0.8);\n\n    vtkSphereSource ball = new vtkSphereSource();\n    ball.SetRadius(0.025);\n    ball.SetThetaResolution(12);\n    ball.SetPhiResolution(12);\n\n    vtkGlyph3D balls = new vtkGlyph3D();\n    balls.SetInputConnection(delny.GetOutputPort());\n    balls.SetSourceConnection(ball.GetOutputPort());\n\n    vtkPolyDataMapper mapBalls = new vtkPolyDataMapper();\n    mapBalls.SetInputConnection(balls.GetOutputPort());\n\n    vtkActor ballActor = new vtkActor();\n    ballActor.SetMapper(mapBalls);\n    ballActor.GetProperty().SetColor(ballActorColor);\n    ballActor.GetProperty().SetSpecularColor(1, 1, 1);\n    ballActor.GetProperty().SetSpecular(0.3);\n    ballActor.GetProperty().SetSpecularPower(20);\n    ballActor.GetProperty().SetAmbient(0.2);\n    ballActor.GetProperty().SetDiffuse(0.8);\n\n    //  Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(ballActor);\n    ren.AddActor(edgeActor);\n\n    ren.ResetCamera();\n    ren.GetActiveCamera().Zoom(1.3);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Modelling/Spring/","title":"Spring","text":"

        vtk-examples/Java/Modelling/Spring

        "},{"location":"Java/Modelling/Spring/#description","title":"Description","text":"

        vtkRotationalExtrusionFilter object is a modeling filter.

        It takes polygonal data as input and generates polygonal data on output. The input dataset is swept around the z-axis to create new polygonal primitives.

        These primitives form a \"skirt\" or swept surface. For example, sweeping a line results in a cylindrical shell, and sweeping a circle creates a torus.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Modelling/Spring/#code","title":"Code","text":"

        Spring.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPoints;\nimport vtk.vtkCellArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkRotationalExtrusionFilter;\nimport vtk.vtkPolyDataNormals;\n\n\n\npublic class Spring\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"PowderBlue\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Burlywood\",BgColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //create spring profile (a circle)\n\n    vtkPoints points = new vtkPoints();\n    points.InsertPoint(0, 1.0, 0.0, 0.0);\n    points.InsertPoint(1, 1.0732, 0.0, -0.1768);\n    points.InsertPoint(2, 1.25, 0.0, -0.25);\n    points.InsertPoint(3, 1.4268, 0.0, -0.1768);\n    points.InsertPoint(4, 1.5, 0.0, 0.00);\n    points.InsertPoint(5, 1.4268, 0.0, 0.1768);\n    points.InsertPoint(6, 1.25, 0.0, 0.25);\n    points.InsertPoint(7, 1.0732, 0.0, 0.1768);\n\n    vtkCellArray poly = new vtkCellArray();\n    poly.InsertNextCell(8);//number of points\n    poly.InsertCellPoint(0);\n    poly.InsertCellPoint(1);\n    poly.InsertCellPoint(2);\n    poly.InsertCellPoint(3);\n    poly.InsertCellPoint(4);\n    poly.InsertCellPoint(5);\n    poly.InsertCellPoint(6);\n    poly.InsertCellPoint(7);\n\n    vtkPolyData profile = new vtkPolyData();\n    profile.SetPoints(points);\n    profile.SetPolys(poly);\n\n    //extrude profile to make spring\n    vtkRotationalExtrusionFilter extrude = new vtkRotationalExtrusionFilter();\n    extrude.SetInputData(profile);\n    extrude.SetResolution(360);\n    extrude.SetTranslation(6);\n    extrude.SetDeltaRadius(1.0);\n    extrude.SetAngle(2160.0);//six revolutions\n\n    vtkPolyDataNormals normals = new vtkPolyDataNormals();\n    normals.SetInputConnection(extrude.GetOutputPort());\n    normals.SetFeatureAngle(60);\n\n    vtkPolyDataMapper map = new vtkPolyDataMapper();\n    map.SetInputConnection(normals.GetOutputPort());\n\n    vtkActor spring = new vtkActor();\n    spring.SetMapper(map);\n    spring.GetProperty().SetColor(ActorColor);\n    spring.GetProperty().SetDiffuse(0.7);\n    spring.GetProperty().SetSpecular(0.4);\n    spring.GetProperty().SetSpecularPower(20);\n    spring.GetProperty().BackfaceCullingOn();\n\n    ren.AddActor(spring);\n    ren.SetBackground(BgColor);\n\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(90);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Parallel/ExodusIIWriter/","title":"ExodusIIWriter","text":"

        vtk-examples/Java/Parallel/ExodusIIWriter

        "},{"location":"Java/Parallel/ExodusIIWriter/#description","title":"Description","text":"

        Example Program to Demonstrate the usage of vtkExodusIIWriter - a vtkWriter that writes it's vtkUnstructuredGrid input to an Exodus II file Exodus files contain much information that is not captured in a vtkUnstructuredGrid, such as time steps, information lines, node sets, and side sets.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Parallel/ExodusIIWriter/#code","title":"Code","text":"

        ExodusIIWriter.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkExodusIIWriter;\nimport vtk.vtkTimeSourceExample;\n\npublic class ExodusIIWriter \n{\n// -----------------------------------------------------------------\n// Load VTK library and print which library was not properly loaded\nstatic \n{\n  if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n  {\n    for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n    {\n      if (!lib.IsLoaded()) \n      { \n        System.out.println(lib.GetLibraryName() + \" not loaded\");\n      }\n    }\n  }\n  vtkNativeLibrary.DisableOutputWindow(null);\n}\n// -----------------------------------------------------------------\n\npublic static void main(String args[]) \n{                   \n  // Provide default values.\n  String fileName = \"Output.exii\";\n  for(int i = 0; i < args.length; ++i)\n  {\n    switch (i) \n    {\n      case 0:\n      fileName = args[i];\n      break;\n\n    }\n  }\n  vtkTimeSourceExample TimeSource = new vtkTimeSourceExample();\n  vtkExodusIIWriter ExodusWriter = new vtkExodusIIWriter();\n  ExodusWriter.SetFileName(fileName);\n  ExodusWriter.SetInputConnection(TimeSource.GetOutputPort());\n  ExodusWriter.WriteAllTimeStepsOn();\n  ExodusWriter.Write();\n }        \n}\n
        "},{"location":"Java/Points/FitImplicitFunction/","title":"FitImplicitFunction","text":"

        vtk-examples/Java/Points/FitImplicitFunction

        "},{"location":"Java/Points/FitImplicitFunction/#description","title":"Description","text":"

        vtkFitImplicitFunction object extracts the points that are on the surface of an implicit function (within some threshold).

        Implicit functions in VTK are any function of the form f(x,y,z)=c, where values c==0 are considered the surface of the implicit function.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Points/FitImplicitFunction/#code","title":"Code","text":"

        FitImplicitFunction.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkMath;\nimport vtk.vtkNamedColors;\nimport vtk.vtkBoundedPointSource;\nimport vtk.vtkSphere;\nimport vtk.vtkFitImplicitFunction;\nimport vtk.vtkSphereSource;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\n\n\npublic class FitImplicitFunction \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Renderer Background Color\n    double glyph3DActorcolor[] = new double[4];\n\n    //For Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Gray\",Bgcolor);\n\n    //Change Color Name to Use your own Color for Actor\n    Color.GetColor(\"Yellow\",glyph3DActorcolor);\n\n    vtkMath RS = new vtkMath();\n    RS.RandomSeed(4355412);\n    double radius = 1.0;\n\n    vtkBoundedPointSource points = new vtkBoundedPointSource();\n    points.SetNumberOfPoints(1000000);\n    points.SetBounds(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0);\n\n    vtkSphere sphere = new vtkSphere();\n    sphere.SetRadius(radius);\n\n    vtkFitImplicitFunction fit = new vtkFitImplicitFunction();\n    fit.SetInputConnection(points.GetOutputPort());\n    fit.SetImplicitFunction(sphere);\n    fit.SetThreshold(.01);\n    fit.Update();\n    System.out.println(fit.GetOutput().GetNumberOfPoints() + \" \" + \"out of\" + \" \" + points.GetNumberOfPoints() + \" \" + \"points are within\" + \" \" + fit.GetThreshold() + \" \" + \"of the implicit function\");  \n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetRadius(radius * .05);\n\n    vtkGlyph3D glyph3D = new vtkGlyph3D();\n    glyph3D.SetInputConnection(fit.GetOutputPort());\n    glyph3D.SetSourceConnection(sphereSource.GetOutputPort());\n    glyph3D.ScalingOff();\n    glyph3D.Update();\n\n    vtkPolyDataMapper glyph3DMapper = new vtkPolyDataMapper();\n    glyph3DMapper.SetInputConnection(glyph3D.GetOutputPort());\n\n    vtkActor glyph3DActor = new vtkActor();\n    glyph3DActor.SetMapper(glyph3DMapper);\n    glyph3DActor.GetProperty().SetColor(glyph3DActorcolor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(glyph3DActor);\n\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(120);\n    ren.GetActiveCamera().Elevation(30);\n    ren.GetActiveCamera().Dolly(1.0);\n    ren.ResetCameraClippingRange();\n\n    ren.SetBackground(Bgcolor);\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/PolyData/CellCenters/","title":"CellCenters","text":"

        vtk-examples/Java/PolyData/CellCenters

        "},{"location":"Java/PolyData/CellCenters/#description","title":"Description","text":"

        vtkCellCenters is a filter that takes as input any dataset and generates on output points at the center of the cells in the dataset.

        These points can be used for placing glyphs (vtkGlyph3D) or labeling.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/CellCenters/#code","title":"Code","text":"

        CellCenters.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageData;\nimport vtk.vtkCellCenters;\nimport vtk.vtkDataSetMapper;\n\n\npublic class CellCenters \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {  \n    // Create an image data\n    vtkImageData imageData = new vtkImageData();\n\n    // Specify the size of the image data\n    imageData.SetDimensions(3,3,2);\n    imageData.SetSpacing(1.0, 1.0, 1.0);\n    imageData.SetOrigin(0.0, 0.0, 0.0);\n\n    vtkCellCenters cellCentersFilter = new vtkCellCenters();\n    cellCentersFilter.SetInputData(imageData);\n    cellCentersFilter.VertexCellsOn();\n    cellCentersFilter.Update();\n\n    // Access the cell centers\n    for(int i = 0; i < cellCentersFilter.GetOutput().GetNumberOfPoints(); i++)\n    {\n      double p[] = new double[3];\n      cellCentersFilter.GetOutput().GetPoint(i, p);\n      System.out.print(\"Point \" + \" \" + i + \" : \" + \" \" +  p[0] + \" , \" + p[1] + \" , \" + p[2] + \"\\n\"); \n    }\n\n    // Display the cell centers\n    vtkDataSetMapper centerMapper = new vtkDataSetMapper();\n    centerMapper.SetInputConnection(cellCentersFilter.GetOutputPort());\n\n    vtkActor centerActor = new vtkActor();\n    centerActor.SetMapper(centerMapper);\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputData(imageData);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetRepresentationToWireframe();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(actor);\n    ren.AddActor(centerActor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/PolyData/CenterOfMass/","title":"CenterOfMass","text":"

        vtk-examples/Java/PolyData/CenterOfMass

        "},{"location":"Java/PolyData/CenterOfMass/#description","title":"Description","text":"

        vtkCenterOfMass object finds the \"center of mass\" of a vtkPointSet (vtkPolyData or vtkUnstructuredGrid).

        Optionally, the user can specify to use the scalars as weights in the computation.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/CenterOfMass/#code","title":"Code","text":"

        CenterOfMass.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkCenterOfMass;\nimport vtk.vtkPolyData;\nimport vtk.vtkPoints;\n\npublic class CenterOfMass \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {  \n    vtkPoints points = new vtkPoints();\n    points.InsertNextPoint(0,0,0);\n    points.InsertNextPoint(1,0,0);\n    points.InsertNextPoint(0,1,0);\n    points.InsertNextPoint(1,1,0);\n\n    vtkPolyData polydata = new vtkPolyData();\n    polydata.SetPoints(points);\n\n    // Compute the center of mass\n    vtkCenterOfMass centerOfMassFilter = new vtkCenterOfMass();\n    centerOfMassFilter.SetInputData(polydata);\n    centerOfMassFilter.SetUseScalarsAsWeights(false);\n    centerOfMassFilter.Update();\n\n    double center[] = new double[3];\n    center = centerOfMassFilter.GetCenter();\n    System.out.print(\"Center of mass is \" + \" \" + center[0] + \" \" + center[1] + \" \" + center[2]);\n  }\n}\n
        "},{"location":"Java/PolyData/ColorCells/","title":"ColorCells","text":"

        vtk-examples/Java/PolyData/ColorCells

        "},{"location":"Java/PolyData/ColorCells/#description","title":"Description","text":"

        This example shows how to assign specific colors to individual cells of a vtkPolyData using a vtkLookupTable. The vtkCellData has a vtkFloatArray that contains a scalar values.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/ColorCells/#code","title":"Code","text":"

        ColorCells.java

        import vtk.vtkActor;\nimport vtk.vtkFloatArray;\nimport vtk.vtkLookupTable;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPlaneSource;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class ColorCells {\n  private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n    // Provide some geometry\n    int xResolution = 3;\n    int yResolution = 3;\n\n    vtkPlaneSource aPlane = new vtkPlaneSource();\n    aPlane.SetXResolution(xResolution);\n    aPlane.SetYResolution(yResolution);\n\n    // Create cell data\n    vtkFloatArray cellData = new vtkFloatArray();\n    for (int i = 0; i < xResolution * yResolution; i++) {\n      cellData.InsertNextValue(i + 1);\n    }\n\n    // Fill in a few known colors, the rest will be generated if needed\n    vtkNamedColors color = new vtkNamedColors();\n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    color.GetColor(\"DarkGray\", BgColor);\n\n    // Assign some colors to an array\n    double[][] tableColors = new double[11][4];\n    color.GetColor(\"Black\", tableColors[0]);\n    color.GetColor(\"Banana\", tableColors[1]);\n    color.GetColor(\"Tomato\", tableColors[2]);\n    color.GetColor(\"Wheat\", tableColors[3]);\n    color.GetColor(\"Lavender\", tableColors[4]);\n    color.GetColor(\"Flesh\", tableColors[5]);\n    color.GetColor(\"Raspberry\", tableColors[6]);\n    color.GetColor(\"Salmon\", tableColors[7]);\n    color.GetColor(\"Mint\", tableColors[8]);\n    color.GetColor(\"Peacock\", tableColors[9]);\n    color.GetColor(\"DarkGray\", tableColors[10]);\n\n    // Create a lookup table to map cell data to colors\n    vtkLookupTable lut = new vtkLookupTable();\n    int tableSize = Math.max(xResolution * yResolution + 1, 10);\n    lut.SetNumberOfTableValues(tableSize);\n    lut.Build();\n\n    for (int i = 0; i < tableSize; ++i) {\n      lut.SetTableValue(i, tableColors[i]);\n    }\n\n    // Force an update so we can set cell data\n    aPlane.Update();\n    aPlane.GetOutput().GetCellData().SetScalars(cellData);\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(aPlane.GetOutputPort());\n    mapper.SetScalarRange(0, tableSize - 1);\n    mapper.SetLookupTable(lut);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(600, 600);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
        "},{"location":"Java/PolyData/ColorCellsWithRGB/","title":"ColorCellsWithRGB","text":"

        vtk-examples/Java/PolyData/ColorCellsWithRGB

        "},{"location":"Java/PolyData/ColorCellsWithRGB/#description","title":"Description","text":"

        This example shows how to assign specific colors to individual cells of a vtkPolyData. This example stores the vtkCellData as rgb triples in a vtkUnsignedCharArray.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/ColorCellsWithRGB/#code","title":"Code","text":"

        ColorCellsWithRGB.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkMath;\nimport vtk.vtkUnsignedCharArray;\nimport vtk.vtkPlaneSource;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class ColorCellsWithRGB  \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n    //Renderer Background Color\n    double BgColor[] = new double[4];\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkGray\",BgColor);\n\n    // Provide some geometry\n    int resolutionX = 5;\n    int resolutionY = 3;\n\n    vtkPlaneSource aPlane = new vtkPlaneSource();\n    aPlane.SetXResolution(resolutionX);\n    aPlane.SetYResolution(resolutionY);\n    aPlane.Update();\n\n    // Create cell data  \n    vtkMath RS = new vtkMath();\n    RS.RandomSeed(8775070);\n\n    vtkUnsignedCharArray CellData = new vtkUnsignedCharArray();\n    CellData.SetNumberOfComponents(3);\n    CellData.SetNumberOfTuples(aPlane.GetOutput().GetNumberOfCells());\n\n    for(int i=0;i<aPlane.GetOutput().GetNumberOfCells();i++)\n    {\n      double rgb[] = new double[3];\n      rgb[0] = RS.Random(64, 255);\n      rgb[1] = RS.Random(64, 255);\n      rgb[2] = RS.Random(64, 255);\n      CellData.InsertTuple3(i, rgb[0], rgb[1],rgb[2]);\n\n    }\n\n    aPlane.GetOutput().GetCellData().SetScalars(CellData);\n\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(aPlane.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
        "},{"location":"Java/PolyData/ColorDisconnectedRegions/","title":"ColorDisconnectedRegions","text":"

        vtk-examples/Java/PolyData/ColorDisconnectedRegions

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/ColorDisconnectedRegions/#code","title":"Code","text":"

        ColorDisconnectedRegions.java

        import vtk.vtkActor;\nimport vtk.vtkAppendPolyData;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataConnectivityFilter;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\n\n\npublic class ColorDisconnectedRegions {\n  private static final long serialVersionUID = 1L;\n\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) {\n    // Create some spheres\n    vtkSphereSource sphere1 = new vtkSphereSource();\n    sphere1.Update();\n\n    vtkSphereSource sphere2 = new vtkSphereSource();\n    sphere2.SetCenter(5.0, 0.0, 0.0);\n    sphere2.Update();\n\n    vtkSphereSource sphere3 = new vtkSphereSource();\n    sphere3.SetCenter(10.0, 0.0, 0.0);\n    sphere3.Update();\n\n    vtkAppendPolyData appendFilter = new vtkAppendPolyData();\n    appendFilter.AddInputConnection(sphere1.GetOutputPort());\n    appendFilter.AddInputConnection(sphere2.GetOutputPort());\n    appendFilter.AddInputConnection(sphere3.GetOutputPort());\n    appendFilter.Update();\n\n    vtkPolyDataConnectivityFilter connectivityFilter = new vtkPolyDataConnectivityFilter();\n    connectivityFilter.SetInputConnection(appendFilter.GetOutputPort());\n    connectivityFilter.SetExtractionModeToAllRegions();\n    connectivityFilter.ColorRegionsOn();\n    connectivityFilter.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(connectivityFilter.GetOutputPort());\n    mapper.SetScalarRange(connectivityFilter.GetOutput().GetPointData().GetArray(\"RegionId\").GetRange());\n    mapper.Update();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(actor);\n    ren.ResetCamera();\n    ren.GetActiveCamera().Zoom(0.9);\n\n    renWin.SetSize(600, 600);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/PolyData/ColoredPoints/","title":"ColoredPoints","text":"

        vtk-examples/Java/PolyData/ColoredPoints

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/ColoredPoints/#code","title":"Code","text":"

        ColoredPoints.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkVertexGlyphFilter;\nimport vtk.vtkUnsignedCharArray;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class ColoredPoints \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static\n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // ----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Snow\", Bgcolor);\n\n\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0, 0.0, 0.0);\n    Points.InsertNextPoint(1.0, 0.0, 0.0);\n    Points.InsertNextPoint(0.0, 1.0, 0.0);\n\n\n    vtkPolyData PointsPolydata = new vtkPolyData();\n    PointsPolydata.SetPoints(Points);\n\n    vtkVertexGlyphFilter VertexFilter = new vtkVertexGlyphFilter();\n    VertexFilter.SetInputData(PointsPolydata);\n    VertexFilter.Update();\n\n    vtkPolyData Polydata = new vtkPolyData();\n    Polydata.ShallowCopy(VertexFilter.GetOutput());\n\n    vtkUnsignedCharArray Colors = new vtkUnsignedCharArray();\n    Colors.SetNumberOfComponents(3);\n    Colors.SetName(\"Colors\");\n    Colors.InsertNextTuple3(0,139,0);\n    Colors.InsertNextTuple3(139,0, 0);\n    Colors.InsertNextTuple3(0, 0,139);\n\n    Polydata.GetPointData().SetScalars(Colors);\n\n    //Visualize\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(Polydata);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetPointSize(15);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the Actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/PolyData/ConvexHullShrinkWrap/","title":"ConvexHullShrinkWrap","text":"

        vtk-examples/Java/PolyData/ConvexHullShrinkWrap

        "},{"location":"Java/PolyData/ConvexHullShrinkWrap/#description","title":"Description","text":"

        This example creates a point cloud, and a sphere larger than the point cloud which fully contains the cloud. It then \"shrink wraps\" the sphere onto the points. This produces approximately a convex hull.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/ConvexHullShrinkWrap/#code","title":"Code","text":"

        ConvexHullShrinkWrap.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkSphereSource;\nimport vtk.vtkPointSource;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkSmoothPolyDataFilter;\n\npublic class ConvexHullShrinkWrap  \n{\n  // ----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Glyph3DActor Color\n    double GlyphActorColor[] = new double[4];\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double EdgeColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Banana\",GlyphActorColor);\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Tomato\",ActorColor);\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"IvoryBlack\",EdgeColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkSlateGray\",BgColor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetRadius(10.0);\n    Sphere.SetPhiResolution(50);\n    Sphere.SetThetaResolution(50);\n    vtkPointSource PointSource = new vtkPointSource();\n    PointSource.SetNumberOfPoints(60);\n    PointSource.SetRadius(2);\n\n    vtkSmoothPolyDataFilter SmoothFilter = new vtkSmoothPolyDataFilter();\n    SmoothFilter.SetInputConnection(0, Sphere.GetOutputPort());\n    SmoothFilter.SetInputConnection(1, PointSource.GetOutputPort());\n\n    vtkSphereSource GlyphSource = new vtkSphereSource();\n    GlyphSource.SetRadius(0.04);\n\n    vtkGlyph3D Glyph3D = new vtkGlyph3D();\n    Glyph3D.SetInputConnection(PointSource.GetOutputPort());\n    Glyph3D.SetSourceConnection(GlyphSource.GetOutputPort());\n    Glyph3D.ScalingOff();\n\n    vtkDataSetMapper Glyph3DMapper = new vtkDataSetMapper();\n    Glyph3DMapper.SetInputConnection(Glyph3D.GetOutputPort());\n    Glyph3DMapper.ScalarVisibilityOff();\n\n    vtkActor Glyph3DActor = new vtkActor();\n    Glyph3DActor.SetMapper(Glyph3DMapper);\n    Glyph3DActor.GetProperty().SetColor(GlyphActorColor);\n\n    vtkDataSetMapper Mapper = new vtkDataSetMapper();\n    Mapper.SetInputConnection(SmoothFilter.GetOutputPort());\n    Mapper.ScalarVisibilityOff();\n\n    // Create an actor for the surface  \n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetDiffuseColor(ActorColor);\n    Actor.GetProperty().SetEdgeColor(EdgeColor);\n    Actor.GetProperty().SetOpacity(1.0);\n    Actor.GetProperty().EdgeVisibilityOff();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.AddActor(Glyph3DActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n\n  }\n}\n
        "},{"location":"Java/PolyData/KochanekSpline/","title":"KochanekSpline","text":"

        vtk-examples/Java/PolyData/KochanekSpline

        "},{"location":"Java/PolyData/KochanekSpline/#description","title":"Description","text":"

        The vtkKochanekSpline provides three parameters to control the shape of the spline:

        1. Tension - Changes the length of the tangent vector
        2. Bias - Primarily changes the direction of the tangent vector
        3. Continuity - Changes the sharpness in change between tangents

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/KochanekSpline/#code","title":"Code","text":"

        KochanekSpline.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPointSource;\nimport vtk.vtkPoints;\nimport vtk.vtkKochanekSpline;\nimport vtk.vtkParametricSpline;\nimport vtk.vtkParametricFunctionSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPolyData;\nimport vtk.vtkSphereSource;\nimport vtk.vtkGlyph3DMapper;\n\npublic class KochanekSpline  \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Point Actor Color\n    double PointActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"DarkSlateGrey\",ActorColor);\n    //Change Color Name to Use your own Color for Change Outline Actor Color\n    Color.GetColor(\"Red\",PointActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"White\",BgColor);\n\n    int numberOfPoints = 10;\n    vtkPointSource pointSource = new vtkPointSource();\n    pointSource.SetNumberOfPoints(numberOfPoints);\n    pointSource.Update();\n\n    vtkPoints Points = pointSource.GetOutput().GetPoints();\n\n    vtkKochanekSpline xSpline = new vtkKochanekSpline();\n    vtkKochanekSpline ySpline = new vtkKochanekSpline();\n    vtkKochanekSpline zSpline = new vtkKochanekSpline();\n\n    vtkParametricSpline spline = new vtkParametricSpline();\n    spline.SetXSpline(xSpline);\n    spline.SetYSpline(ySpline);\n    spline.SetZSpline(zSpline);\n    spline.SetPoints(Points);\n\n    vtkParametricFunctionSource functionSource = new vtkParametricFunctionSource();\n    functionSource.SetParametricFunction(spline);\n    functionSource.SetUResolution(50*numberOfPoints);\n    functionSource.SetVResolution(50*numberOfPoints);\n    functionSource.SetWResolution(50*numberOfPoints);\n    functionSource.Update();\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(functionSource.GetOutputPort());\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(ActorColor);\n    Actor.GetProperty().SetLineWidth(3.0);\n\n    //Glyph the points\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetRadius(0.02);\n    Sphere.SetPhiResolution(21);\n    Sphere.SetThetaResolution(21);\n\n\n    vtkPolyData polyData = new vtkPolyData();\n    polyData.SetPoints(Points);\n\n    vtkGlyph3DMapper PointMapper = new vtkGlyph3DMapper();\n    PointMapper.SetInputData(polyData);\n    PointMapper.SetSourceConnection(Sphere.GetOutputPort());\n\n    vtkActor PointActor = new vtkActor();\n    PointActor.SetMapper(PointMapper);\n    PointActor.GetProperty().SetColor(PointActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.AddActor(PointActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/PolyData/MeshQuality/","title":"MeshQuality","text":"

        vtk-examples/Java/PolyData/MeshQuality

        "},{"location":"Java/PolyData/MeshQuality/#description","title":"Description","text":"

        This example uses one of many selectable methods to determine the quality of a mesh. In this case, we have selected to use the area of the triangles. We show how to retrieve the quality metric computed on each triangle after the process is completed.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/MeshQuality/#code","title":"Code","text":"

        MeshQuality.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkSphereSource;\nimport vtk.vtkTriangleFilter;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyData;\nimport vtk.vtkMeshQuality;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkDoubleArray;\n\npublic class MeshQuality \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"NavajoWhite\",BgColor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    //Sphere.SetCenter(0.0,0.0,0.0);\n    phere.SetRadius(5.0);\n    Sphere.Update();\n\n    //Change Phi and Theta Value for Smooth Surface\n    Sphere.SetPhiResolution(12);\n    Sphere.SetThetaResolution(14);\n\n    vtkTriangleFilter triangleFilter = new vtkTriangleFilter();\n    triangleFilter.SetInputConnection(Sphere.GetOutputPort());\n    triangleFilter.Update();\n\n    vtkPolyData Mesh = triangleFilter.GetOutput();\n    System.out.println(\"There are\" + \" \" +  Mesh.GetNumberOfCells() +\" \"  + \"Cells\");\n\n\n    vtkMeshQuality QualityFilter = new vtkMeshQuality();\n    QualityFilter.SetInputData(Mesh);\n    QualityFilter.SetTriangleQualityMeasureToArea();\n    QualityFilter.Update();\n\n\n    vtkDoubleArray QualityArray = new vtkDoubleArray().FastDownCast(QualityFilter.GetOutput().GetCellData().GetArray(\"Quality\"));\n    System.out.println(\"There are\" + QualityArray.GetNumberOfTuples() + \"values\");\n\n\n    for(int i=0;i<QualityArray.GetNumberOfTuples();i++)\n    {\n      double val = QualityArray.GetValue(i);\n      System.out.println(\"Value\" + \" \"+i + \" \" + val);\n\n    }\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.ShallowCopy(QualityFilter.GetOutput());\n\n    //Create a Mapper and Actor for Sphere\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(PolyData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/PolyData/Outline/","title":"Outline","text":"

        vtk-examples/Java/PolyData/Outline

        "},{"location":"Java/PolyData/Outline/#description","title":"Description","text":"

        This example shows how to draw the outline of the dataset.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/Outline/#code","title":"Code","text":"

        Outline.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkSphereSource;\nimport vtk.vtkOutlineFilter;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Outline \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //For Outline Actor Color\n    double OutlineActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"LightCoral\",ActorColor);\n    //Change Color Name to Use your own Color for Change Outline Actor Color\n    Color.GetColor(\"Black\",OutlineActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Cornsilk\",BgColor);\n\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(5.0);\n    Sphere.Update();\n\n    //Change Phi and Theta Value for Smooth Surface\n    Sphere.SetPhiResolution(20);\n    Sphere.SetThetaResolution(20);\n\n    //Create a Mapper and Actor for Sphere\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(ActorColor);\n\n\n    // Create the outline \n    vtkOutlineFilter OutLiner = new vtkOutlineFilter();\n    OutLiner.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkPolyDataMapper OutlineMapper = new vtkPolyDataMapper();\n    OutlineMapper.SetInputConnection(OutLiner.GetOutputPort());\n\n    vtkActor OutlineActor = new vtkActor();\n    OutlineActor.SetMapper(OutlineMapper);\n    OutlineActor.GetProperty().SetColor(OutlineActorColor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.AddActor(OutlineActor);\n    ren.SetBackground(BgColor);\n    ren.GetActiveCamera().Azimuth(40);\n    ren.GetActiveCamera().Elevation(30);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/PolyData/Reflection/","title":"Reflection","text":"

        vtk-examples/Java/PolyData/Reflection

        "},{"location":"Java/PolyData/Reflection/#description","title":"Description","text":"

        Java Program to visualize reflection in VTK.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/Reflection/#code","title":"Code","text":"

        Reflection.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkConeSource;\nimport vtk.vtkReflectionFilter;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\n\npublic class Reflection  \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Cone Actor\n    double ConeActorColor[] = new double[4];\n\n    //For Reflection Actor\n    double ReflectionActorColor[] = new double[4];\n\n    //Renderer Background Color    \n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Cone Actor\n    Color.GetColor(\"Mint\",ConeActorColor);\n\n    //Change Color Name to Use your own Color for Reflection Actor\n    Color.GetColor(\"Tomato\",ReflectionActorColor);\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Wheat\",BgColor);\n\n    // Create a Cone\n    vtkConeSource ConeSource = new vtkConeSource();\n    ConeSource.Update();\n\n    // Create a mapper and actor\n    vtkPolyDataMapper ConeMapper = new vtkPolyDataMapper();\n    ConeMapper.SetInputConnection(ConeSource.GetOutputPort());\n\n\n    vtkActor ConeActor = new vtkActor();\n    ConeActor.SetMapper(ConeMapper);\n    ConeActor.GetProperty().SetColor(ConeActorColor);\n\n    // Reflection\n    vtkReflectionFilter ReflectionFilter = new vtkReflectionFilter();\n    ReflectionFilter.SetInputConnection(ConeSource.GetOutputPort());\n    ReflectionFilter.CopyInputOff();\n    ReflectionFilter.Update();\n\n    vtkDataSetMapper ReflectionMapper = new vtkDataSetMapper();\n    ReflectionMapper.SetInputConnection(ReflectionFilter.GetOutputPort());\n\n    vtkActor ReflectionActor = new vtkActor();\n    ReflectionActor.SetMapper(ReflectionMapper);\n    ReflectionActor.GetProperty().SetColor(ReflectionActorColor);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(ConeActor);\n    ren.AddActor(ReflectionActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
        "},{"location":"Java/PolyData/RibbonFilter/","title":"RibbonFilter","text":"

        vtk-examples/Java/PolyData/RibbonFilter

        "},{"location":"Java/PolyData/RibbonFilter/#description","title":"Description","text":"

        Java Program which demonstrates how to draw a flat surface (a ribbon) along a line.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/RibbonFilter/#code","title":"Code","text":"

        RibbonFilter.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPoints;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkMath;\nimport vtk.vtkCellArray;\nimport vtk.vtkRibbonFilter;\nimport vtk.vtkNamedColors;\n\npublic class RibbonFilter \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Line Actor Color\n    double LineActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Sienna\",LineActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SteelBlue\",BgColor);\n\n    // No. of vertices\n    int nV = 256;      \n    double vX, vY, vZ;\n    // Spiral radius\n    double rS = 2;  \n    // No. of spiral cycles\n    int nCyc = 3;    \n    // Height\n    double h = 10;              \n\n    int i;\n\n    // Create points and cells for a spiral\n    vtkPoints Points = new vtkPoints();\n    vtkMath findPI = new vtkMath(); \n    for(i = 0; i < nV; i++)\n    {\n      // Spiral coordinates\n      vX = rS * Math.cos(2 * findPI.Pi()* nCyc * i / (nV - 1));\n      vY = rS * Math.sin(2 * findPI.Pi() * nCyc * i / (nV - 1));\n      vZ = h * i / nV;\n      Points.InsertPoint(i, vX, vY, vZ);\n    }\n\n    vtkCellArray Lines = new vtkCellArray();\n    Lines.InsertNextCell(nV);\n    for (i = 0; i < nV; i++)\n    {\n      Lines.InsertCellPoint(i);\n    }\n\n\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n    PolyData.SetLines(Lines);\n\n    // Create a mapper and actor\n    vtkPolyDataMapper LineMapper = new vtkPolyDataMapper();\n    LineMapper.SetInputData(PolyData);\n\n\n    vtkActor LineActor = new vtkActor();\n    LineActor.SetMapper(LineMapper);\n    LineActor.GetProperty().SetColor(LineActorColor);\n    LineActor.GetProperty().SetLineWidth(3);\n\n    // Create a ribbon around the line\n    vtkRibbonFilter RibbonFilter = new vtkRibbonFilter();\n    RibbonFilter.SetInputData(PolyData);\n    RibbonFilter.SetWidth(0.4);\n\n    // Create a mapper and actor for Ribbon\n    vtkPolyDataMapper RibbonMapper = new vtkPolyDataMapper();\n    RibbonMapper.SetInputConnection(RibbonFilter.GetOutputPort());\n\n\n    vtkActor RibbonActor = new vtkActor();\n    RibbonActor.SetMapper(RibbonMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n\n    // Visualise the arrow\n    ren.AddActor(LineActor);\n    ren.AddActor(RibbonActor);\n    ren.SetBackground(BgColor);\n    ren.GetActiveCamera().Azimuth(40);\n    ren.GetActiveCamera().Elevation(30);\n    ren.ResetCamera();\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n} \n
        "},{"location":"Java/PolyData/RotationAroundLine/","title":"RotationAroundLine","text":"

        vtk-examples/Java/PolyData/RotationAroundLine

        "},{"location":"Java/PolyData/RotationAroundLine/#description","title":"Description","text":"

        This example demonstrates how to rotate an object around an axis. For the demo, we rotate a cone by 10 degrees around the y axis.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/RotationAroundLine/#code","title":"Code","text":"

        RotationAroundLine.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkConeSource;\nimport vtk.vtkXMLPolyDataWriter;\nimport vtk.vtkTransformPolyDataFilter;\nimport vtk.vtkTransform;\nimport vtk.vtkXMLPolyDataReader;\n\npublic class RotationAroundLine \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 2) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtp) Filename(.vtp) e.g original.vtp transformed.vtp\");\n      return;\n    }\n    String inputFilename = args[0];\n    String outputFilename = args[1];\n\n    // Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double leftViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};\n    double rightViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", actorColor);\n    colors.GetColor(\"Turquoise\", Bgcolor);\n\n    //Create a cone\n    vtkConeSource coneSource = new vtkConeSource();\n\n    {\n     vtkXMLPolyDataWriter writer = new vtkXMLPolyDataWriter();\n     writer.SetInputConnection(coneSource.GetOutputPort());\n     writer.SetFileName(inputFilename);\n     writer.Write();\n    }\n\n    vtkTransform transform = new vtkTransform();\n    //transform.RotateWXYZ(double angle, double x, double y, double z);\n    transform.RotateWXYZ(10, 0, 1, 0);\n\n    vtkTransformPolyDataFilter transformFilter = new vtkTransformPolyDataFilter();\n\n    transformFilter.SetTransform(transform);\n    transformFilter.SetInputConnection(coneSource.GetOutputPort());\n    transformFilter.Update();\n\n    {\n     vtkXMLPolyDataWriter writer = new vtkXMLPolyDataWriter();\n     writer.SetInputConnection(transformFilter.GetOutputPort());\n     writer.SetFileName(outputFilename);\n     writer.Write();\n    }\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Original Actor\n    vtkXMLPolyDataReader original_reader = new vtkXMLPolyDataReader();\n    original_reader.SetFileName(inputFilename);\n    original_reader.Update();\n\n    vtkPolyDataMapper original_mapper = new vtkPolyDataMapper();\n    original_mapper.SetInputConnection(original_reader.GetOutputPort());\n\n    vtkActor original_actor = new vtkActor();\n    original_actor.SetMapper(original_mapper);\n\n    // Transformed Actor\n    vtkXMLPolyDataReader Transformed_reader = new vtkXMLPolyDataReader();\n    Transformed_reader.SetFileName(outputFilename);\n    Transformed_reader.Update();\n\n    vtkPolyDataMapper Transformed_mapper = new vtkPolyDataMapper();\n    Transformed_mapper.SetInputConnection(Transformed_reader.GetOutputPort());\n\n    vtkActor Transformed_actor = new vtkActor();\n    Transformed_actor.SetMapper(Transformed_mapper);\n\n    // Setup both renderers\n    vtkRenderer leftRenderer = new vtkRenderer();\n    renWin.AddRenderer(leftRenderer);\n    leftRenderer.SetViewport(leftViewport);\n    leftRenderer.SetBackground(Bgcolor);  \n\n    vtkRenderer rightRenderer = new vtkRenderer();\n    renWin.AddRenderer(rightRenderer);\n    rightRenderer.SetViewport(rightViewport);\n    rightRenderer.SetBackground(Bgcolor);\n\n    leftRenderer.AddActor(original_actor);\n    rightRenderer.AddActor(Transformed_actor);\n\n    leftRenderer.ResetCamera();\n    rightRenderer.ResetCamera();\n\n    renWin.SetSize(600, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/PolyData/RuledSurfaceFilter/","title":"RuledSurfaceFilter","text":"

        vtk-examples/Java/PolyData/RuledSurfaceFilter

        "},{"location":"Java/PolyData/RuledSurfaceFilter/#description","title":"Description","text":"

        vtkRuledSurfaceFilter object is a filter that generates a surface from a set of lines. The lines are assumed to be \"parallel\" in the sense that they do not intersect and remain somewhat close to one another.

        A surface is generated by connecting the points defining each pair of lines with straight lines. This creates a strip for each pair of lines (i.e., a triangulation is created from two generating lines).

        The filter can handle an arbitrary number of lines, with lines i and i+1 assumed connected.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/RuledSurfaceFilter/#code","title":"Code","text":"

        RuledSurfaceFilter.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPoints;\nimport vtk.vtkLine;\nimport vtk.vtkCellArray;\nimport vtk.vtkRuledSurfaceFilter;\nimport vtk.vtkPolyData;\n\npublic class RuledSurfaceFilter \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n   vtkNamedColors colors = new vtkNamedColors();\n   //For Actor Color\n   double actorColor[] = new double[4];\n   //Renderer Background Color\n   double Bgcolor[] = new double[4];\n\n   colors.GetColor(\"Khaki\", actorColor);\n   colors.GetColor(\"LightSlateGray\", Bgcolor);\n   // Create first line.\n   vtkPoints points = new vtkPoints();\n   points.InsertPoint(0, 0, 0, 1);\n   points.InsertPoint(1, 1, 0, 0);\n   points.InsertPoint(2, 0, 1, 0);\n   points.InsertPoint(3, 1, 1, 1);\n\n   vtkLine line1 = new vtkLine();\n   line1.GetPointIds().SetId(0, 0);\n   line1.GetPointIds().SetId(1, 1);\n\n   vtkLine line2 = new vtkLine();\n   line2.GetPointIds().SetId(0, 2);\n   line2.GetPointIds().SetId(1, 3);\n\n   vtkCellArray lines = new vtkCellArray();\n   lines.InsertNextCell(line1);\n   lines.InsertNextCell(line2);\n\n   vtkPolyData polydata = new vtkPolyData();\n   polydata.SetPoints(points);\n   polydata.SetLines(lines);\n\n   vtkRuledSurfaceFilter ruledSurfaceFilter = new vtkRuledSurfaceFilter();\n   ruledSurfaceFilter.SetInputData(polydata);\n   ruledSurfaceFilter.SetResolution(21, 21);\n   ruledSurfaceFilter.SetRuledModeToResample();\n\n   // Create the renderer, render window and interactor.\n   vtkRenderer ren = new vtkRenderer();\n   vtkRenderWindow renWin = new vtkRenderWindow();\n   renWin.AddRenderer(ren);\n   vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n   iren.SetRenderWindow(renWin);\n\n   vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n   mapper.SetInputConnection(ruledSurfaceFilter.GetOutputPort());\n\n   vtkActor actor = new vtkActor();\n   actor.SetMapper(mapper);\n   actor.GetProperty().SetColor(actorColor);\n\n   // Add the actors to the renderer, set the background and size\n   ren.AddActor(actor);\n\n   ren.ResetCamera();\n   ren.GetActiveCamera().Azimuth(60);\n   ren.GetActiveCamera().Elevation(60);\n   ren.GetActiveCamera().Dolly(1.2);\n   ren.ResetCameraClippingRange();\n\n   ren.SetBackground(Bgcolor);\n\n   renWin.SetSize(400, 400);\n   renWin.Render();\n\n   iren.Initialize();\n   iren.Start();\n  }\n}\n
        "},{"location":"Java/PolyData/Stripper/","title":"Stripper","text":"

        vtk-examples/Java/PolyData/Stripper

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/Stripper/#code","title":"Code","text":"

        Stripper.java

        import vtk.vtkSphereSource;\nimport vtk.vtkStripper;\nimport vtk.vtkNativeLibrary;\n\nclass Stripper{  \n\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n\n  public static void main(String args[]){  \n\n    vtkSphereSource SphereSource = new vtkSphereSource();\n    SphereSource.Update();\n\n    System.out.println(\"Number of cells before stripping:\" + SphereSource.GetOutput().GetNumberOfCells() );\n\n\n    vtkStripper Stripper = new vtkStripper();\n    Stripper.SetInputConnection(SphereSource.GetOutputPort());\n    Stripper.Update();\n\n\n    System.out.println(\"Number of cells after stripping:\" + Stripper.GetOutput().GetNumberOfCells() );\n\n\n  }  \n}   \n
        "},{"location":"Java/PolyData/ThinPlateSplineTransform/","title":"ThinPlateSplineTransform","text":"

        vtk-examples/Java/PolyData/ThinPlateSplineTransform

        "},{"location":"Java/PolyData/ThinPlateSplineTransform/#description","title":"Description","text":"

        vtkThinPlateSplineTransform object describes a nonlinear warp transform defined by a set of source and target landmarks.

        Any point on the mesh close to a source landmark will be moved to a place close to the corresponding target landmark. The points in between are interpolated smoothly using Bookstein's Thin Plate Spline algorithm.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/ThinPlateSplineTransform/#code","title":"Code","text":"

        ThinPlateSplineTransform.java

        import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageGridSource;\nimport vtk.vtkLookupTable;\nimport vtk.vtkImageMapToColors;\nimport vtk.vtkBMPReader;\nimport vtk.vtkImageBlend;\nimport vtk.vtkPoints;\nimport vtk.vtkThinPlateSplineTransform;\nimport vtk.vtkImageReslice;\nimport vtk.vtkImageMapper;\nimport vtk.vtkActor2D;\nimport vtk.vtkInteractorStyleTerrain;\n\npublic class ThinPlateSplineTransform \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.bmp) e.g masonry.bmp\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Black\", Bgcolor);\n\n    // First, create an image to warp\n    vtkImageGridSource imageGrid = new vtkImageGridSource();\n    imageGrid.SetGridSpacing(16, 16, 0);\n    imageGrid.SetGridOrigin(0, 0, 0);\n    imageGrid.SetDataExtent(0, 255, 0, 255, 0, 0);\n    imageGrid.SetDataScalarTypeToUnsignedChar();\n\n    vtkLookupTable table = new vtkLookupTable();\n    table.SetTableRange(0, 1);\n    table.SetAlphaRange(0.0, 1.0);\n    table.SetHueRange(0.15, 0.15);\n    table.SetSaturationRange(1, 1);\n    table.SetValueRange(0, 1 );\n    table.Build();\n\n    vtkImageMapToColors alpha = new vtkImageMapToColors();\n    alpha.SetInputConnection(imageGrid.GetOutputPort());\n    alpha.SetLookupTable( table );\n\n    vtkBMPReader reader = new vtkBMPReader();\n    reader.SetFileName(inputFilename);\n    reader.Update();\n\n    vtkImageBlend blend = new vtkImageBlend();\n    blend.AddInputConnection(0, reader.GetOutputPort());\n    blend.AddInputConnection(0, alpha.GetOutputPort());\n\n    // Next, create a ThinPlateSpline transform\n    vtkPoints p1 = new vtkPoints();\n    p1.SetNumberOfPoints( 8 );\n    p1.SetPoint(0, 0, 0, 0);\n    p1.SetPoint(1, 0, 255, 0);\n    p1.SetPoint(2, 255, 0, 0);\n    p1.SetPoint(3, 255, 255, 0);\n    p1.SetPoint(4, 96, 96, 0);\n    p1.SetPoint(5, 96, 159, 0);\n    p1.SetPoint(6, 159, 159, 0);\n    p1.SetPoint(7, 159, 96, 0);\n\n    vtkPoints p2 = new vtkPoints();\n    p2.SetNumberOfPoints( 8 );\n    p2.SetPoint(0, 0, 0, 0);\n    p2.SetPoint(1, 0, 255, 0);\n    p2.SetPoint(2, 255, 0, 0);\n    p2.SetPoint(3, 255, 255, 0);\n    p2.SetPoint(4, 96, 159, 0);\n    p2.SetPoint(5, 159, 159, 0);\n    p2.SetPoint(6, 159, 96, 0);\n    p2.SetPoint(7, 96, 96, 0);\n\n    vtkThinPlateSplineTransform transform = new vtkThinPlateSplineTransform();\n    transform.SetSourceLandmarks(p2);\n    transform.SetTargetLandmarks(p1);\n    transform.SetBasisToR2LogR();\n    // You must invert the transform before passing it to vtkImageReslice\n    transform.Inverse();\n\n    vtkImageReslice reslice = new vtkImageReslice();\n    reslice.SetInputConnection(blend.GetOutputPort());\n    reslice.SetResliceTransform(transform);\n    reslice.SetInterpolationModeToLinear();\n\n    vtkImageMapper map = new vtkImageMapper();\n    map.SetInputConnection(reslice.GetOutputPort());\n    map.SetColorWindow( 255.0);\n    map.SetColorLevel(127.5);\n    map.SetZSlice(0);\n\n    vtkActor2D  actor = new vtkActor2D();\n    actor.SetMapper(map);\n    actor.SetPosition(0.0, 0.0);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleTerrain style = new vtkInteractorStyleTerrain();\n    iren.SetInteractorStyle(style);\n\n    // Visualize\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/PolyData/TransformFilter/","title":"TransformFilter","text":"

        vtk-examples/Java/PolyData/TransformFilter

        "},{"location":"Java/PolyData/TransformFilter/#description","title":"Description","text":"

        vtkTransformFilter is an object to transform point coordinates, and associated point normals and vectors, as well as cell normals and vectors.

        Transformed data array will be stored in a float array or a double array. Other point and cel data are passed through the filter, unless TransformAllInputVectors is set to true, in this case all other 3 components arrays from point and cell data will be transformed as well.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/TransformFilter/#code","title":"Code","text":"

        TransformFilter.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkArrowSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkTransform;\nimport vtk.vtkTransformFilter;\n\n\npublic class TransformFilter \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static\n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SteelBlue\", actorColor);\n    colors.GetColor(\"BurlyWood\", Bgcolor);\n\n    //Create an Arrow\n    vtkArrowSource arrowSource = new vtkArrowSource();\n\n    vtkTransform Transform = new vtkTransform();\n    Transform.Scale(5, 1, 1);\n\n    vtkTransformFilter TransformFilter = new vtkTransformFilter();\n    TransformFilter.SetTransform(Transform);\n    TransformFilter.SetInputConnection(arrowSource.GetOutputPort());\n    TransformFilter.SetTransform(Transform);\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(TransformFilter.GetOutputPort());\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/PolyData/TransformPipeline/","title":"TransformPipeline","text":"

        vtk-examples/Java/PolyData/TransformPipeline

        "},{"location":"Java/PolyData/TransformPipeline/#description","title":"Description","text":"

        This example demonstrate how to connect a transformation for keeping coordinate one actor relative to another.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/TransformPipeline/#code","title":"Code","text":"

        TransformPipeline.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkCylinderSource;\nimport vtk.vtkTransform;\n\npublic class TransformPipeline\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n   vtkNamedColors colors = new vtkNamedColors();\n\n   //For arm Color\n   double armColor[] = new double[4];\n   //For forearm Color\n   double forearmColor[] = new double[4];\n   //For hand Color\n   double handColor[] = new double[4];\n   //Renderer Background Color\n   double Bgcolor[] = new double[4];\n\n   colors.GetColor(\"DarkKhaki\", armColor);\n   colors.GetColor(\"Blue\", forearmColor);\n   colors.GetColor(\"GreenYellow\", handColor);\n   colors.GetColor(\"MidnightBlue\", Bgcolor);\n\n   //arm\n   vtkCylinderSource arm = new vtkCylinderSource();\n   arm.SetRadius(8);\n   arm.SetHeight(20);\n   arm.SetResolution(20);\n\n   vtkPolyDataMapper armMapper = new vtkPolyDataMapper();\n   armMapper.SetInputConnection(arm.GetOutputPort());\n\n   vtkTransform armTransform = new vtkTransform();\n\n   vtkActor armActor = new vtkActor();\n   armActor.SetUserTransform(armTransform);\n   armActor.SetMapper(armMapper);\n   armActor.GetProperty().SetColor(armColor);\n\n   //forearm\n   vtkCylinderSource forearm = new vtkCylinderSource();\n   forearm.SetRadius(6);\n   forearm.SetHeight(15);\n   forearm.SetResolution(20);\n   forearm.SetCenter(0, 10.5, -2.5);;\n\n   vtkPolyDataMapper forearmMapper = new vtkPolyDataMapper();\n   forearmMapper.SetInputConnection(forearm.GetOutputPort());\n\n   vtkTransform forearmTransform = new vtkTransform();\n   forearmTransform.SetInput(armTransform);\n\n   vtkActor forearmActor = new vtkActor();\n   forearmActor.SetUserTransform(forearmTransform);\n   forearmActor.SetMapper(forearmMapper);\n   forearmActor.GetProperty().SetColor(forearmColor);\n\n   //hand\n   vtkCylinderSource hand = new vtkCylinderSource();\n   hand.SetRadius(4);\n   hand.SetHeight(10);\n   hand.SetResolution(20);\n   hand.SetCenter(0, 18.5, -2.5);\n\n   vtkPolyDataMapper handMapper = new vtkPolyDataMapper();\n   handMapper.SetInputConnection(hand.GetOutputPort());\n\n   vtkTransform handTransform = new vtkTransform();\n   handTransform.SetInput(forearmTransform);\n\n   vtkActor handActor = new vtkActor();\n   handActor.SetUserTransform(handTransform);\n   handActor.SetMapper(handMapper);\n   handActor.GetProperty().SetColor(handColor);\n\n   // Create the renderer, render window and interactor.\n   vtkRenderer ren = new vtkRenderer();\n   vtkRenderWindow renWin = new vtkRenderWindow();\n   renWin.AddRenderer(ren);\n   vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n   iren.SetRenderWindow(renWin);\n\n   ren.AddActor(armActor);\n   ren.AddActor(forearmActor);\n   ren.AddActor(handActor);\n   ren.SetBackground(Bgcolor);\n   renWin.Render();\n\n   //execution of robot arm motion\n   for (int i = 0; i<45; i++)\n   {\n    armTransform.Identity();\n    armTransform.RotateZ(-i);\n    renWin.Render();\n   }\n   //execution of robot forearm motion\n   for (int i = 0; i<45; i++)\n   {\n    forearmTransform.Identity();\n    forearmTransform.RotateZ(i);\n    renWin.Render();\n   }\n   iren.Start();\n  }\n}\n
        "},{"location":"Java/PolyData/TriangleColoredPoints/","title":"TriangleColoredPoints","text":"

        vtk-examples/Java/PolyData/TriangleColoredPoints

        "},{"location":"Java/PolyData/TriangleColoredPoints/#description","title":"Description","text":"

        This example shows how by adding a color to each vertex of a triangle, the triangle's color will be smoothly varying between the colors of the vertices.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/TriangleColoredPoints/#code","title":"Code","text":"

        TriangleColoredPoints.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkPoints;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkPolyData;\nimport vtk.vtkTriangle;\nimport vtk.vtkUnsignedCharArray;\nimport vtk.vtkCellArray;\nimport vtk.vtkNamedColors;\n\npublic class TriangleColoredPoints \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static\n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Black\", Bgcolor);\n\n    // Setup points\n    vtkPoints Points = new vtkPoints();\n    Points.InsertNextPoint(0.0, 0.0, 0.0);\n    Points.InsertNextPoint(1.0, 0.0, 0.0);\n    Points.InsertNextPoint(0.0, 1.0, 0.0);\n\n    //Setup the colors array\n    vtkUnsignedCharArray Colors = new vtkUnsignedCharArray();\n    Colors.SetNumberOfComponents(3);\n    Colors.SetName(\"Colors\");\n\n   //Add the three colors we have created to the array\n    Colors.InsertNextTuple3(255,0, 0);\n    Colors.InsertNextTuple3(0, 255, 0);\n    Colors.InsertNextTuple3(0, 0, 255);\n\n    //Create a triangle\n    vtkCellArray Triangles = new vtkCellArray();\n    vtkTriangle Triangle = new vtkTriangle();\n    Triangle.GetPointIds().SetId(0, 0);\n    Triangle.GetPointIds().SetId(1, 1);\n    Triangle.GetPointIds().SetId(2, 2);\n    Triangles.InsertNextCell(Triangle);\n\n    //Create a polydata object and add everything to it\n    vtkPolyData PolyData = new vtkPolyData();\n    PolyData.SetPoints(Points);\n    PolyData.SetPolys(Triangles);\n    PolyData.GetPointData().SetScalars(Colors);\n\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputData(PolyData);\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/PolyData/TubeFilter/","title":"TubeFilter","text":"

        vtk-examples/Java/PolyData/TubeFilter

        "},{"location":"Java/PolyData/TubeFilter/#description","title":"Description","text":"

        This example creates a tube around a line. This is helpful because when you zoom the camera, the thickness of a line remains constant, while the thickness of a tube varies.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/PolyData/TubeFilter/#code","title":"Code","text":"

        TubeFilter.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkLineSource;\nimport vtk.vtkTubeFilter;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class TubeFilter  \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n    /*\n            * This example creates a tube around a line. \n            * This is helpful because when you zoom the camera, \n            * the thickness of a line remains constant, \n            * while the thickness of a tube varies.\n            * */\n\n    vtkNamedColors Color = new vtkNamedColors(); \n    //For Actor\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Actor\n    Color.GetColor(\"Red\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Gray\",BgColor);\n\n    // Create a line\n    vtkLineSource LineSource = new vtkLineSource();\n    LineSource.SetPoint1(1.0, 0.0, 0.0);\n    LineSource.SetPoint2(.0, 1.0, 0.0);\n\n    // Create a mapper and actor\n    vtkPolyDataMapper LineMapper = new vtkPolyDataMapper();\n    LineMapper.SetInputConnection(LineSource.GetOutputPort());\n\n\n    vtkActor LineActor = new vtkActor();\n    LineActor.SetMapper(LineMapper);\n    LineActor.GetProperty().SetColor(ActorColor);\n    LineActor.GetProperty().SetLineWidth(3);\n\n    vtkTubeFilter TubeFilter = new vtkTubeFilter();\n    TubeFilter.SetInputConnection(LineSource.GetOutputPort());\n    TubeFilter.SetRadius(0.025);\n    TubeFilter.SetNumberOfSides(50);\n    TubeFilter.Update();\n\n\n    vtkPolyDataMapper TubeMapper = new vtkPolyDataMapper();\n    TubeMapper.SetInputConnection(TubeFilter.GetOutputPort());\n\n    vtkActor TubeActor = new vtkActor();\n    TubeActor.SetMapper(TubeMapper);\n    //Make the tube have some transparency.\n    TubeActor.GetProperty().SetOpacity(0.5);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(LineActor);\n    ren.AddActor(TubeActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n} \n
        "},{"location":"Java/RectilinearGrid/RectilinearGrid/","title":"RectilinearGrid","text":"

        vtk-examples/Java/RectilinearGrid/RectilinearGrid

        "},{"location":"Java/RectilinearGrid/RectilinearGrid/#description","title":"Description","text":"

        vtkRectilinearGrid object represents a geometric structure that is topologically regular with variable spacing in the three coordinate directions x-y-z.

        To define a vtkRectilinearGrid, you must specify the dimensions of the data and provide three arrays of values specifying the coordinates along the x-y-z axes. The coordinate arrays are specified using three vtkDataArray objects (one for x, one for y, one for z).

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/RectilinearGrid/RectilinearGrid/#code","title":"Code","text":"

        RectilinearGrid.java

        import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkRectilinearGrid;\nimport vtk.vtkDoubleArray;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkActor;\n\npublic class RectilinearGrid\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double Bgcolor[] = new double[] {0.3, 0.6, 0.3}; \n    colors.SetColor(\"Bgcolor\", Bgcolor);\n\n    //Create a grid\n    vtkRectilinearGrid grid = new vtkRectilinearGrid();\n\n    grid.SetDimensions(2,3,1);\n\n    vtkDoubleArray xArray = new vtkDoubleArray();\n    xArray.InsertNextValue(0.0);\n    xArray.InsertNextValue(2.0);\n\n    vtkDoubleArray yArray = new vtkDoubleArray();\n    yArray.InsertNextValue(0.0);\n    yArray.InsertNextValue(1.0);\n    yArray.InsertNextValue(2.0);\n\n    vtkDoubleArray zArray = new vtkDoubleArray();\n    zArray.InsertNextValue(0.0);\n\n    grid.SetXCoordinates(xArray);\n    grid.SetYCoordinates(yArray);\n    grid.SetZCoordinates(zArray);\n\n    System.out.println(\"There are\" + \" \" + grid.GetNumberOfPoints() + \" \" +  \"points.\"); \n    System.out.println(\"There are\" + \" \" + grid.GetNumberOfCells() + \" \" + \"cells.\");\n\n    for(int id = 0; id < grid.GetNumberOfPoints(); id++)\n    {\n      double p[] = new double[3];\n      grid.GetPoint(id, p);\n      System.out.println(\"Point \" + \" \" +  id + \" \" +  \" : (\" + \" \" +  p[0] + \" \" +  \" , \" + \" \" + p[1] + \" \" +  \" , \" + \" \" +  p[2] + \" \" + \")\" );\n    }\n\n    //Create a mapper and actor\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputData(grid);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(Bgcolor); // Background color green\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/RectilinearGrid/RectilinearGridToTetrahedra/","title":"RectilinearGridToTetrahedra","text":"

        vtk-examples/Java/RectilinearGrid/RectilinearGridToTetrahedra

        "},{"location":"Java/RectilinearGrid/RectilinearGridToTetrahedra/#description","title":"Description","text":"

        [vtkRectilinearGrid](https://www.vtk.org/doc/nightly/html/classvtkRectilinearGrid.html#details)ToTetrahedra object forms a mesh of Tetrahedra from a vtkRectilinearGrid.

        The tetrahedra can be 5 per cell, 6 per cell, or a mixture of 5 or 12 per cell. The resulting mesh is consistent, meaning that there are no edge crossings and that each tetrahedron face is shared by two tetrahedra, except those tetrahedra on the boundary. All tetrahedra are right handed.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/RectilinearGrid/RectilinearGridToTetrahedra/#code","title":"Code","text":"

        RectilinearGridToTetrahedra.java

        import vtk.vtkDoubleArray;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRectilinearGrid;\nimport vtk.vtkRectilinearGridToTetrahedra;\nimport vtk.vtkXMLUnstructuredGridWriter;\n\npublic class RectilinearGridToTetrahedra \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  { \n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtu) e.g output.vtu\");\n      return;\n    }\n    String Filename = args[0];\n\n    // Create a grid\n    vtkRectilinearGrid grid = new vtkRectilinearGrid();\n\n    grid.SetDimensions(5,4,3);\n\n    vtkDoubleArray xArray = new vtkDoubleArray();\n    xArray.InsertNextValue(0.0);\n    xArray.InsertNextValue(1.0);\n    xArray.InsertNextValue(2.0);\n    xArray.InsertNextValue(3.0);\n    xArray.InsertNextValue(4.0);\n\n    vtkDoubleArray yArray = new vtkDoubleArray();\n    yArray.InsertNextValue(0.0);\n    yArray.InsertNextValue(1.0);\n    yArray.InsertNextValue(2.0);\n    yArray.InsertNextValue(3.0);\n\n    vtkDoubleArray zArray = new vtkDoubleArray();\n    zArray.InsertNextValue(0.0);\n    zArray.InsertNextValue(1.0);\n    zArray.InsertNextValue(2.0);\n\n    grid.SetXCoordinates(xArray);\n    grid.SetYCoordinates(yArray);\n    grid.SetZCoordinates(zArray);\n\n    vtkRectilinearGridToTetrahedra rectilinearGridToTetrahedra = new vtkRectilinearGridToTetrahedra();\n    rectilinearGridToTetrahedra.SetInputData(grid);\n    rectilinearGridToTetrahedra.Update();\n\n    vtkXMLUnstructuredGridWriter writer = new vtkXMLUnstructuredGridWriter();\n    writer.SetFileName(Filename);\n    writer.SetInputConnection(rectilinearGridToTetrahedra.GetOutputPort());\n    writer.Write();\n\n    System.out.println(\"There are \" + \" \" + rectilinearGridToTetrahedra.GetOutput().GetNumberOfCells() + \" \" + \" cells.\"); \n\n  }\n}\n
        "},{"location":"Java/RectilinearGrid/VisualizeRectilinearGrid/","title":"VisualizeRectilinearGrid","text":"

        vtk-examples/Java/RectilinearGrid/VisualizeRectilinearGrid

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/RectilinearGrid/VisualizeRectilinearGrid/#code","title":"Code","text":"

        VisualizeRectilinearGrid.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkRectilinearGrid;\nimport vtk.vtkDoubleArray;\nimport vtk.vtkShrinkFilter;\nimport vtk.vtkDataSetMapper;\n\npublic class VisualizeRectilinearGrid \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    // Create a grid\n    vtkRectilinearGrid grid = new vtkRectilinearGrid();\n\n    grid.SetDimensions(2,3,2);\n\n    vtkDoubleArray xArray = new vtkDoubleArray();\n    xArray.InsertNextValue(0.0);\n    xArray.InsertNextValue(2.0);\n\n    vtkDoubleArray yArray = new vtkDoubleArray();\n    yArray.InsertNextValue(0.0);\n    yArray.InsertNextValue(1.0);\n    yArray.InsertNextValue(2.0);\n\n    vtkDoubleArray zArray = new vtkDoubleArray();\n    zArray.InsertNextValue(0.0);\n    zArray.InsertNextValue(5.0);\n\n    grid.SetXCoordinates(xArray);\n    grid.SetYCoordinates(yArray);\n    grid.SetZCoordinates(zArray);\n\n    vtkShrinkFilter shrinkFilter = new vtkShrinkFilter();\n    shrinkFilter.SetInputData(grid);\n    shrinkFilter.SetShrinkFactor(.8);\n\n    // Create a mapper and actor\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(shrinkFilter.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(actor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Rendering/AmbientSpheres/","title":"AmbientSpheres","text":"

        vtk-examples/Java/Rendering/AmbientSpheres

        "},{"location":"Java/Rendering/AmbientSpheres/#description","title":"Description","text":"

        Note

        The original source code for this example is here.

        Info

        Similar examples setting the diffuse and specular properties are: See DiffuseSpheres.cxx, DiffuseSpheres.py and SpecularSpheres.cxx, SpecularSpheres.py.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Rendering/AmbientSpheres/#code","title":"Code","text":"

        AmbientSpheres.java

        import vtk.vtkActor;\nimport vtk.vtkLight;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\n\npublic class AmbientSpheres {\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[]{0.1, 0.2, 0.4, 1.0};\n\n    double spheresColor[] = new double[4];\n    colors.GetColor(\"Red\", spheresColor);\n\n    // The following lines create a sphere represented by polygons.\n    //\n    vtkSphereSource SphereSource = new vtkSphereSource();\n    SphereSource.SetThetaResolution(100);\n    SphereSource.SetPhiResolution(50);\n\n    // The mapper is responsible for pushing the geometry into the graphics\n    // library. It may also do color mapping, if scalars or other attributes\n    // are defined.\n    //\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(SphereSource.GetOutputPort());\n\n    // The actor is a grouping mechanism: besides the geometry (mapper), it\n    // also has a property, transformation matrix, and/or texture map.\n    // In this example we create eight different spheres (two rows of four\n    // spheres) and set the specular lighting coefficients. A little ambient\n    // is turned on so the sphere is not completely black on the back side.\n\n    // Since we are using the same sphere source and mapper for all eight spheres\n    // we will use an array.\n    //\n    double ambient = 0.125;\n    double diffuse = 0.0;\n    double specular = 0.0;\n    double position[] = new double[]{0.0, 0.0, 0.0};\n    vtkActor[] Sphere = new vtkActor[8];\n    for (int i = 0; i < 8; ++i) {\n      Sphere[i] = new vtkActor();\n      Sphere[i].SetMapper(sphereMapper);\n      Sphere[i].GetProperty().SetColor(spheresColor);\n      Sphere[i].GetProperty().SetAmbient(ambient);\n      Sphere[i].GetProperty().SetDiffuse(diffuse);\n      Sphere[i].GetProperty().SetSpecular(specular);\n      Sphere[i].AddPosition(position);\n      ambient += 0.125;\n      position[0] += 1.25;\n      if (i == 3) {\n        position[0] = 0;\n        position[1] = 1.25;\n      }\n    }\n\n    // Create the graphics structure. The renderer renders into the\n    // render window. The render window interactor captures mouse events\n    // and will perform appropriate camera or actor manipulation\n    // depending on the nature of the events.\n    //\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the renderer, set the background and size.\n    for (int i = 0; i < 8; ++i) {\n      ren.AddActor(Sphere[i]);\n    }\n    ren.SetBackground(bkg);\n    renWin.SetSize(640, 480);\n\n    // Set up the lighting.\n    vtkLight Light = new vtkLight();\n    Light.SetFocalPoint(1.875, 0.6125, 0);\n    Light.SetPosition(0.875, 1.6125, 1);\n    ren.AddLight(Light);\n\n    // We want to eliminate perspective effects on the apparent lighting.\n    // Parallel camera projection will be used. To zoom in parallel projection\n    // mode, the ParallelScale is set.\n    //\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0);\n    ren.GetActiveCamera().SetPosition(0, 0, 1);\n    ren.GetActiveCamera().SetViewUp(0, 1, 0);\n    ren.GetActiveCamera().ParallelProjectionOn();\n    ren.ResetCamera();\n    ren.GetActiveCamera().SetParallelScale(2.0);\n\n    iren.Initialize();\n    renWin.Render();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Rendering/ColoredSphere/","title":"ColoredSphere","text":"

        vtk-examples/Java/Rendering/ColoredSphere

        "},{"location":"Java/Rendering/ColoredSphere/#description","title":"Description","text":"

        This demonstrates a simple visualization pipeline. A polygonal representation of a sphere is created with the source object (vtkSphereSource). The sphere is passed through a filter (vtkElevationFilter) that computes the height of each point of the sphere above a plane. The plane is perpendicular to the z-axis, and passes through the point (0,0,-1). The data is finally mapped (vtkDataSetMapper) through a lookup table. The mapping process converts height value into colors, and interfaces the sphere geometry to the rendering library. The mapper is assigned to an actor, and then the actor is displayed.

        The execution of the pipeline occurs implicitly when we render the actor. Each actor asks its mapper to update itself. The mapper in turn asks its input to update itself. This process continues until a source object is encountered. Then the source will execute if modified since the last render.

        Info

        See Figure 4-19 in Chapter 4 the VTK Textbook.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Rendering/ColoredSphere/#code","title":"Code","text":"

        ColoredSphere.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSphereSource;\nimport vtk.vtkElevationFilter;\n\npublic class ColoredSphere \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n     //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    //  Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetPhiResolution(12); \n    sphere.SetThetaResolution(12);\n\n    vtkElevationFilter colorIt = new vtkElevationFilter();\n    colorIt.SetInputConnection(sphere.GetOutputPort());\n    colorIt.SetLowPoint(0,0,-1);\n    colorIt.SetHighPoint(0,0,1);\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(colorIt.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Rendering/Cone6/","title":"Cone6","text":"

        vtk-examples/Java/Rendering/Cone6

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Rendering/Cone6/#code","title":"Code","text":"

        Cone6.java

        import vtk.vtkActor;\nimport vtk.vtkBoxWidget;\nimport vtk.vtkConeSource;\nimport vtk.vtkInteractorStyleTrackballCamera;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkTransform;\n\n// For writing an image\nimport vtk.vtkPNGWriter;\nimport vtk.vtkWindowToImageFilter;\n\npublic class Cone6 {\n  private static final long serialVersionUID = 1L;\n\n  /**\n   * @param args\n   */\n  // load the necessary interface libraries on first reference to the \n  // class.\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  // create the box widget as an instance variable so we can interact\n  // with it from the interaction call back. \n  vtkBoxWidget boxWidget = null;\n\n  public static void main(String[] args) {\n    // We will start by creating an instance of our Cone6 example\n    // This example uses callbacks, and for Java that requires an instance\n    // object to own the callback logic.\n\n    Cone6 myCone = new Cone6();\n    myCone.doit();\n  }\n\n  // Similar to Step2/Java/Cone2.java, we define a callback for\n  // interaction. In this case we will apply the box transform to the its prop3D. \n  // Java callbacks do not have parameters. \n  void myCallback() {\n    vtkTransform t = new vtkTransform();\n    boxWidget.GetTransform(t);\n    boxWidget.GetProp3D().SetUserTransform(t);\n  }\n\n  /*\n   * The doit() function is simply the instance function to perform the\n   * construction of the vtk pipeline for this example.\n   */\n  void doit() {\n\n    // This example introduces 3D widgets. 3D widgets take advantage of the\n    // event/observer design pattern introduced previously. They typically\n    // have a particular representation in the scene which can be\n    // interactively\n    // selected and manipulated using the mouse and keyboard. As the widgets\n    // are manipulated, they in turn invoke events such as\n    // StartInteractionEvent,\n    // InteractionEvent, and EndInteractionEvent which can be used to\n    // manipulate\n    // the scene that the widget is embedded in. 3D widgets work in the\n    // context\n    // of the event loop which was set up in the previous example.\n    //\n\n    // Next we create an instance of vtkConeSource and set some of its\n    // properties. The instance of vtkConeSource \"cone\" is part of a\n    // visualization pipeline (it is a source process object); it produces\n    // data (output type is vtkPolyData) which other filters may process.\n    vtkConeSource cone = new vtkConeSource();\n    cone.SetHeight(3.0);\n    cone.SetRadius(1.0);\n    cone.SetResolution(10);\n\n    // In this example we terminate the pipeline with a mapper process\n    // object.\n    // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    // between the source and the mapper.) We create an instance of\n    // vtkPolyDataMapper to map the polygonal data into graphics primitives.\n    // We\n    // connect the output of the cone souece to the input of this mapper.\n    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();\n    coneMapper.SetInputData(cone.GetOutput());\n\n    // Create an actor to represent the cone. The actor orchestrates\n    // rendering of\n    // the mapper's graphics primitives. An actor also refers to properties\n    // via a\n    // vtkProperty instance, and includes an internal transformation matrix.\n    // We\n    // set this actor's mapper to be coneMapper which we created above.\n    vtkActor coneActor = new vtkActor();\n    coneActor.SetMapper(coneMapper);\n\n    // Create the Renderer and assign actors to it. A renderer is like a\n    // viewport. It is part or all of a window on the screen and it is\n    // responsible for drawing the actors it has. We also set the\n    // background color here.\n    vtkRenderer ren1 = new vtkRenderer();\n    ren1.AddActor(coneActor);\n    ren1.SetBackground(0.1, 0.2, 0.4);\n\n    // Finally we create the render window which will show up on the screen\n    // We put our renderer into the render window using AddRenderer. We\n    // also set the size to be 300 pixels by 300.\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren1);\n    renWin.SetSize(300, 300);\n\n    // The vtkRenderWindowInteractor class watches for events (e.g.,\n    // keypress,\n    // mouse) in the vtkRenderWindow. These events are translated into\n    // event invocations that VTK understands (see VTK/Common/vtkCommand.h\n    // for all events that VTK processes). Then observers of these VTK\n    // events can process them as appropriate.\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // By default the vtkRenderWindowInteractor instantiates an instance\n    // of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n    // it observes into operations on the camera, actors, and/or properties\n    // in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n    // Here we specify a particular interactor style.\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n\n\n    // Here we use a vtkBoxWidget to transform the underlying coneActor (by\n    // manipulating its transformation matrix). Many other types of widgets\n    // are available for use, see the documentation for more details.\n    //\n    // The SetInteractor method is how 3D widgets are associated with the\n    // render\n    // window interactor. Internally, SetInteractor sets up a bunch of\n    // callbacks\n    // using the Command/Observer mechanism (AddObserver()). The place\n    // factor\n    // controls the initial size of the widget with respect to the bounding\n    // box\n    // of the input to the widget.\n    boxWidget = new vtkBoxWidget();\n    boxWidget.SetInteractor(iren);\n    boxWidget.SetPlaceFactor(1.25);\n\n    // Place the interactor initially. The input to a 3D widget is used to\n    // initially position and scale the widget. The EndInteractionEvent is\n    // observed which invokes the SelectPolygons callback.\n    boxWidget.SetProp3D(coneActor);\n    boxWidget.PlaceWidget();\n\n    // Now for every interaction event that is generated by the boxWidget,\n    // call our callback function.\n    boxWidget.AddObserver(\"InteractionEvent\", this, \"myCallback\");\n\n    // Normally the user presses the \"i\" key to bring a 3D widget to\n    // life. Here we will manually enable it so it appears with the cone.\n    boxWidget.On();\n\n    // Start the event loop.\n    iren.Initialize();\n    renWin.Render();\n    iren.Start();\n\n    // There is no explicit need to free any objects at this point.\n    // Once Java exits, memory is automatically freed.\n\n  }\n\n\n}\n
        "},{"location":"Java/Rendering/Mace/","title":"Mace","text":"

        vtk-examples/Java/Rendering/Mace

        "},{"location":"Java/Rendering/Mace/#description","title":"Description","text":"

        An example of multiple inputs and outputs.

        Info

        See Figure 4-21 in Chapter 4 the VTK Textbook.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Rendering/Mace/#code","title":"Code","text":"

        Mace.java

        import vtk.vtkActor;\nimport vtk.vtkConeSource;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\n\npublic class Mace \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors();\n\n    //For Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkSeaGreen\",Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n\n    Sphere.SetPhiResolution(8);\n    Sphere.SetThetaResolution(8);\n\n    //Create a Mapper and Actor for Sphere\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    //create a Cone\n    vtkConeSource Cone = new vtkConeSource();\n    Cone.SetResolution(6);\n\n    vtkGlyph3D Glyph = new vtkGlyph3D();\n    Glyph.SetInputConnection(Sphere.GetOutputPort());\n    Glyph.SetSourceConnection(Cone.GetOutputPort());\n\n    Glyph.SetVectorModeToUseNormal();\n    Glyph.SetScaleModeToScaleByVector();\n    Glyph.SetScaleFactor(0.25);\n\n    vtkPolyDataMapper spikeMapper = new vtkPolyDataMapper();\n    spikeMapper.SetInputConnection(Glyph.GetOutputPort());\n\n    vtkActor spikeActor = new vtkActor();\n    spikeActor.SetMapper(spikeMapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(spikeActor);\n    ren.AddActor(sphereActor);\n\n    ren.SetBackground(Bgcolor);\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Rendering/SpecularSpheres/","title":"SpecularSpheres","text":"

        vtk-examples/Java/Rendering/SpecularSpheres

        "},{"location":"Java/Rendering/SpecularSpheres/#description","title":"Description","text":"

        Note

        The original source code for this example is here.

        Info

        See Figure 3-10 in Chapter 3 the VTK Textbook.

        Info

        Similar examples setting the ambient and diffuse properties are: See AmbientSpheres.cxx, AmbientSpheres.py, AmbientSpheres.java and DiffuseSpheres.cxx, DiffuseSpheres.py.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Rendering/SpecularSpheres/#code","title":"Code","text":"

        SpecularSpheres.java

        import vtk.vtkActor;\nimport vtk.vtkLight;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\n\n\npublic class SpecularSpheres \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[]{0.1, 0.2, 0.4, 1.0};\n\n    double spheresColor[] = new double[4];\n    colors.GetColor(\"Red\", spheresColor);\n\n    double specularColor[] = new double[4];\n    colors.GetColor(\"White\", specularColor);\n\n    // The following lines create a sphere represented by polygons.\n    //\n    vtkSphereSource SphereSource = new vtkSphereSource();\n    SphereSource.SetThetaResolution(100);\n    SphereSource.SetPhiResolution(50);\n\n    // The mapper is responsible for pushing the geometry into the graphics\n    // library. It may also do color mapping, if scalars or other attributes\n    // are defined.\n    //\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(SphereSource.GetOutputPort());\n\n    // The actor is a grouping mechanism: besides the geometry (mapper), it\n    // also has a property, transformation matrix, and/or texture map.\n    // In this example we create eight different spheres (two rows of four\n    // spheres) and set the specular lighting coefficients. A little ambient\n    // is turned on so the sphere is not completely black on the back side.\n\n    // Since we are using the same sphere source and mapper for all eight spheres\n    // we will use an array.\n\n    double specularPower;\n    int numberOfSpheres = 8;\n    double ambient = 0.3;\n    double diffuse = 0.5;\n    double specular = 1.0;\n    double spBase = 5.0;\n    double spScale = 1.0;\n    double position[] = new double[]{0.0, 0.0, 0.0};\n    vtkActor[] Sphere = new vtkActor[8];\n    for (int i = 0; i < numberOfSpheres; ++i) \n    {\n      specularPower = spBase * spScale;\n      Sphere[i] = new vtkActor();\n      Sphere[i].SetMapper(sphereMapper);\n      Sphere[i].GetProperty().SetColor(spheresColor);\n      Sphere[i].GetProperty().SetAmbient(ambient);\n      Sphere[i].GetProperty().SetDiffuse(diffuse);\n      Sphere[i].GetProperty().SetSpecular(specular);\n      Sphere[i].GetProperty().SetSpecularPower(specularPower);\n      Sphere[i].GetProperty().SetSpecularColor(specularColor);\n      Sphere[i].AddPosition(position);\n      spScale = spScale * 2.0;\n      position[0] += 1.25;\n      if (i == 3)\n      {\n        specular = 0.5;\n        spScale = 1.0;\n        position[0] = 0;\n        position[1] = 1.25;\n      }\n    }\n\n    // Create the graphics structure. The renderer renders into the\n    // render window. The render window interactor captures mouse events\n    // and will perform appropriate camera or actor manipulation\n    // depending on the nature of the events.\n    //\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Add the actors to the renderer, set the background and size.\n    for (int i = 0; i < numberOfSpheres; ++i) \n    {\n      ren.AddActor(Sphere[i]);\n    }\n    ren.SetBackground(bkg);\n    renWin.SetSize(640, 480);\n\n    // Set up the lighting.\n    vtkLight Light = new vtkLight();\n    Light.SetFocalPoint(1.875, 0.6125, 0);\n    Light.SetPosition(0.875, 1.6125, 1);\n    ren.AddLight(Light);\n\n    // We want to eliminate perspective effects on the apparent lighting.\n    // Parallel camera projection will be used. To zoom in parallel projection\n    // mode, the ParallelScale is set.\n    //\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0);\n    ren.GetActiveCamera().SetPosition(0, 0, 1);\n    ren.GetActiveCamera().SetViewUp(0, 1, 0);\n    ren.GetActiveCamera().ParallelProjectionOn();\n    ren.ResetCamera();\n    ren.GetActiveCamera().SetParallelScale(2.0);\n\n    iren.Initialize();\n    renWin.Render();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/SimpleOperations/DistanceBetweenPoints/","title":"DistanceBetweenPoints","text":"

        vtk-examples/Java/SimpleOperations/DistanceBetweenPoints

        "},{"location":"Java/SimpleOperations/DistanceBetweenPoints/#description","title":"Description","text":"

        This example finds the squared distance and the Euclidean distance between two 3D points.

        Other languages

        See (Cxx), (Python), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/SimpleOperations/DistanceBetweenPoints/#code","title":"Code","text":"

        DistanceBetweenPoints.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkMath;\n\n\npublic class DistanceBetweenPoints \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n      }\n     }\n     vtkNativeLibrary.DisableOutputWindow(null);\n   }\n   // -----------------------------------------------------------------\n\npublic static void main(String s[]) \n{                     \n  // Create two points.\n  double p0[] = new double[] {0.0, 0.0, 0.0};\n  double p1[] = new double[] {1.0, 1.0, 1.0};\n\n  // Find the squared distance between the points.\n  vtkMath squaredDistance = new vtkMath();\n  double squaredDist = squaredDistance.Distance2BetweenPoints(p0, p1);\n\n  // Take the square root to get the Euclidean distance between the points.\n  double distance = Math.sqrt(squaredDist);\n\n  // Output the results.\n  System.out.println(\"Squared Distance:\" + \" \" + squaredDist);\n  System.out.println(\"Distance:\" + \" \" + distance);\n\n }\n}\n
        "},{"location":"Java/SimpleOperations/PerspectiveTransform/","title":"PerspectiveTransform","text":"

        vtk-examples/Java/SimpleOperations/PerspectiveTransform

        Description:

        The perspective transform automatically appends the \"homogeneous 1\" to the point before it is multiplied by the matrix. It then divides the first 3 coordinates of the result by the 4th coordinate of the result. For comparison, the standard projection vtkTransform) is also performed with the same matrix and the same point. Note that the results are much different.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/SimpleOperations/PerspectiveTransform/#code","title":"Code","text":"

        PerspectiveTransform.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkPerspectiveTransform;\nimport vtk.vtkTransform;\nimport vtk.vtkMatrix4x4;\n\npublic class PerspectiveTransform \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkMatrix4x4 M = new vtkMatrix4x4();\n    M.SetElement(0, 0, 1);\n    M.SetElement(0, 1, 2);\n    M.SetElement(0, 2, 3);\n    M.SetElement(0, 3, 4);\n    M.SetElement(1, 0, 2);\n    M.SetElement(1, 1, 2);\n    M.SetElement(1, 2, 3);\n    M.SetElement(1, 3, 4);\n    M.SetElement(2, 0, 3);\n    M.SetElement(2, 1, 2);\n    M.SetElement(2, 2, 1);\n    M.SetElement(2, 3, 4);\n    M.SetElement(3, 0, 4);\n    M.SetElement(3, 1, 2);\n    M.SetElement(3, 2, 3);\n    M.SetElement(3, 3, 4);\n\n    vtkPerspectiveTransform PT = new vtkPerspectiveTransform();\n    PT.SetMatrix(M);\n\n    vtkTransform Transform = new vtkTransform();\n    Transform.SetMatrix(M);\n\n    double p[] = new double[] {1.0,2.0,3.0};\n\n    double normalProjection[] = new double[3];\n    Transform.TransformPoint(p, normalProjection);\n    System.out.println(normalProjection[0] + \" \" + normalProjection[1] + \" \" + normalProjection[2]);\n\n    double perspectiveProjection[] = new double[3];\n    PT.TransformPoint(p, perspectiveProjection);\n    System.out.println(perspectiveProjection[0] + \" \" + perspectiveProjection[1] + \" \" + perspectiveProjection[2]);\n  }       \n}\n
        "},{"location":"Java/SimpleOperations/ProjectPointPlane/","title":"ProjectPointPlane","text":"

        vtk-examples/Java/SimpleOperations/ProjectPointPlane

        "},{"location":"Java/SimpleOperations/ProjectPointPlane/#description","title":"Description","text":"

        vtkPlane object provides methods for various plane computations. These include projecting points onto a plane, evaluating the plane equation, and returning plane normal.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/SimpleOperations/ProjectPointPlane/#code","title":"Code","text":"

        ProjectPointPlane.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkPlane;\n\n\npublic class ProjectPointPlane\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {         \n    vtkPlane Plane = new vtkPlane();\n    Plane.SetOrigin(0, 0, 0);\n    Plane.SetNormal(0, 0, 1.0);\n\n    double p[] = new double[] {23.1, 54.6, 9.2};\n    double origin[] = new double[] {0.0, 0.0, 0.0};\n    double normal[] = new double[] {0.0, 0.0, 1.0};\n    double projected[] = new double[3];\n\n    Plane.ProjectPoint(p, origin, normal, projected);\n    System.out.println(\"Projected:\" + \" \" + projected[0] + \" \" + projected[1] + \" \" + projected[2] );\n  }       \n}\n
        "},{"location":"Java/SimpleOperations/RandomSequence/","title":"RandomSequence","text":"

        vtk-examples/Java/SimpleOperations/RandomSequence

        "},{"location":"Java/SimpleOperations/RandomSequence/#description","title":"Description","text":"

        vtkMinimalStandardRandomSequence object is a sequence of statistically independent pseudo random numbers uniformly distributed between 0.0 and 1.0.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/SimpleOperations/RandomSequence/#code","title":"Code","text":"

        RandomSequence.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkMinimalStandardRandomSequence;\n\n\npublic class RandomSequence \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                   \n    //Create a random sequence generator.\n    vtkMinimalStandardRandomSequence Sequence = new vtkMinimalStandardRandomSequence();\n    //initialize the sequence\n    Sequence.SetSeed(1);\n\n    //Get 3 random numbers.\n    double x = Sequence.GetValue();\n    Sequence.Next();\n    double y = Sequence.GetValue();\n    Sequence.Next();\n    double z = Sequence.GetValue();\n    Sequence.Next();\n\n    // You can also use Sequence.GetRangeValue(-1.0, 1.0) to set a range on the random values.\n\n    System.out.println(\"X:\"+x + \"\\n\" + \"Y:\" + y + \"\\n\" + \"Z:\"+ z);\n\n  }       \n}\n
        "},{"location":"Java/Snippets/WriteImage/","title":"Description","text":"

        Given a filename, render window and optionally a rgba value, take a screenshot of the render window and write it to a file.

        After using it, remove the function and the corresponding call.

        Typical usage would be:

          // ...\n  renWin.Render();\n  // After creating the test image, this line must be removed.\n  writeImage(renWin, \"Test<Name of the Java File>.png\");\n\n  iren.Initialize();\n  iren.Start();\n

        These imports are needed.

        // For writing an image\nimport vtk.vtkPNGWriter;\nimport vtk.vtkWindowToImageFilter;\n

        To use the snippet, click the Copy to clipboard at the upper left of the code blocks.

        "},{"location":"Java/Snippets/WriteImage/#java","title":"Java","text":""},{"location":"Java/Snippets/WriteImage/#declaration-section","title":"Declaration Section","text":"
        /**\n  * Write the render window to a PNG file.\n  * <p>\n  * After creating the image, this function should be removed.\n  *\n  * @param renWin The render window\n  * @param fn     The name of the image file.\n  */\npublic static void writeImage(vtkRenderWindow renWin, String fn) {\n  vtkWindowToImageFilter windowToImageFilter = new vtkWindowToImageFilter();\n  windowToImageFilter.SetInput(renWin);\n  windowToImageFilter.SetScale(1);\n  windowToImageFilter.SetInputBufferTypeToRGB();\n\n  windowToImageFilter.ReadFrontBufferOff();\n  windowToImageFilter.Update();\n\n  vtkPNGWriter writer = new vtkPNGWriter();\n  writer.SetFileName(fn);\n  writer.SetInputConnection(windowToImageFilter.GetOutputPort());\n  writer.Write();\n}\n
        "},{"location":"Java/Snippets/WriteImage/#usage","title":"Usage","text":"
          // After creating the test image, this line must be removed.\n  writeImage(renWin, \"Test<Name of the Java File>.png\");\n
        "},{"location":"Java/StructuredGrid/BlankPoint/","title":"BlankPoint","text":"

        vtk-examples/Java/StructuredGrid/BlankPoint

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/StructuredGrid/BlankPoint/#code","title":"Code","text":"

        BlankPoint.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkStructuredGrid;\nimport vtk.vtkPoints;\nimport vtk.vtkDataSetMapper;\n\npublic class BlankPoint {\n\n    // -----------------------------------------------------------------\n      // Load VTK library and print which library was not properly loaded\n      static \n      {\n        if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n        {\n          for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n          {\n            if (!lib.IsLoaded()) \n            {\n              System.out.println(lib.GetLibraryName() + \" not loaded\");\n            }\n          }\n        }\n        vtkNativeLibrary.DisableOutputWindow(null);\n      }\n      // -----------------------------------------------------------------\n\n\n      public static void main(String args[]) \n      {\n\n        vtkNamedColors colors = new vtkNamedColors();\n\n        //Renderer Background Color\n        double Bgcolor[] = new double[4];\n\n        colors.GetColor(\"Seagreen\", Bgcolor);\n\n        // Create a grid\n        vtkStructuredGrid structuredGrid = new vtkStructuredGrid();\n\n        vtkPoints points = new vtkPoints();\n\n        int gridSize = 8;\n        int counter = 0;\n        // Create a 5x5 grid of points\n        for( int j = 0; j < gridSize; j++)\n        {\n          for( int i = 0; i < gridSize; i++)\n          {\n            if(i == 3 && j == 3) // Make one point higher than the rest\n            {\n              points.InsertNextPoint(i, j, 2);\n              System.out.println(\"The different point is number \" + \" \" + counter );\n            }\n            else\n            {\n              points.InsertNextPoint(i, j, 0); // Make most of the points the same height\n            }\n            counter++;\n          }\n        }\n\n        // Specify the dimensions of the grid\n        structuredGrid.SetDimensions(gridSize,gridSize,1);\n\n        structuredGrid.SetPoints(points);\n\n        structuredGrid.BlankPoint(27);\n        structuredGrid.Modified();\n\n        // Create a mapper and actor\n        vtkDataSetMapper gridMapper = new vtkDataSetMapper();\n        gridMapper.SetInputData(structuredGrid);\n\n        vtkActor gridActor = new vtkActor();\n        gridActor.SetMapper(gridMapper);\n        gridActor.GetProperty().EdgeVisibilityOn();\n        gridActor.GetProperty().SetEdgeColor(0,0,1);\n\n\n        // Create the renderer, render window and interactor.\n        vtkRenderer ren = new vtkRenderer();\n        vtkRenderWindow renWin = new vtkRenderWindow();\n        renWin.AddRenderer(ren);\n        vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n        iren.SetRenderWindow(renWin);\n\n        // Visualise\n        ren.AddActor(gridActor);\n\n        ren.SetBackground(Bgcolor);\n\n        renWin.SetSize(300, 300);\n        renWin.Render();\n\n        iren.Initialize();\n        iren.Start();\n      }\n\n}\n
        "},{"location":"Java/StructuredGrid/StructuredGridOutline/","title":"StructuredGridOutline","text":"

        vtk-examples/Java/StructuredGrid/StructuredGridOutline

        "},{"location":"Java/StructuredGrid/StructuredGridOutline/#description","title":"Description","text":"

        [vtkStructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkStructuredGrid.html#details)OutlineFilter object is a filter that generates a wireframe outline of a structured grid (vtkStructuredGrid).

        Structured data is topologically a cube, so the outline will have 12 \"edges\".

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/StructuredGrid/StructuredGridOutline/#code","title":"Code","text":"

        StructuredGridOutline.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkStructuredGrid;\nimport vtk.vtkPoints;\nimport vtk.vtkStructuredGridOutlineFilter;\nimport vtk.vtkActor;\nimport vtk.vtkPolyDataMapper;\n\npublic class StructuredGridOutline \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //  Create a grid\n    vtkStructuredGrid structuredGrid = new vtkStructuredGrid();\n\n    vtkPoints points = new vtkPoints();\n    int numi = 2;\n    int numj = 3;\n    int numk = 2;\n\n    for(int k = 0; k < numk; k++)\n    {\n      for(int j = 0; j < numj; j++)\n      {\n        for(int i = 0; i < numi; i++)\n        {\n          points.InsertNextPoint(i, j, k);\n        }\n      }\n    }\n\n    //specify the dimensions of the grid\n    structuredGrid.SetDimensions(numi, numj, numk);\n    structuredGrid.SetPoints(points);\n\n    System.out.println(\"There are \" + \" \" + structuredGrid.GetNumberOfPoints() + \" \" + \"points.\");\n    System.out.println(\"There are \" + \" \" + structuredGrid.GetNumberOfCells() + \" \" + \"cells.\");\n\n    vtkStructuredGridOutlineFilter outlineFilter = new vtkStructuredGridOutlineFilter();\n    outlineFilter.SetInputData(structuredGrid);\n    outlineFilter.Update();\n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(outlineFilter.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/StructuredPoints/StructuredPointsToUnstructuredGrid/","title":"StructuredPointsToUnstructuredGrid","text":"

        vtk-examples/Java/StructuredPoints/StructuredPointsToUnstructuredGrid

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/StructuredPoints/StructuredPointsToUnstructuredGrid/#code","title":"Code","text":"

        StructuredPointsToUnstructuredGrid.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkStructuredPoints;\nimport vtk.vtkPoints;\nimport vtk.vtkUnstructuredGrid;\nimport vtk.vtkXMLUnstructuredGridWriter;\n\npublic class StructuredPointsToUnstructuredGrid \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtu) e.g output.vtu\");\n      return;\n    }\n    String outputFilename = args[0];\n\n    // Create a structuredpoints\n    vtkStructuredPoints structuredPoints = new vtkStructuredPoints();\n\n    // Specify the size of the image data\n    structuredPoints.SetDimensions(2,3,1);\n    int VTK_DOUBLE = 11;\n    structuredPoints.AllocateScalars(VTK_DOUBLE,1);\n\n    int dims[] = new int[3];\n    dims=structuredPoints.GetDimensions();\n\n    System.out.println(\"Dims: \" + \"\\n\" + \" x: \" + \" \" + dims[0] + \" \" +  \" y: \" + dims[1] + \" z: \" + \" \" + dims[2] );\n    System.out.println(\"Number of points: \" + \" \" + structuredPoints.GetNumberOfPoints());\n    System.out.println(\"Number of cells: \" + \" \" + structuredPoints.GetNumberOfCells());\n\n    // Copy the points from the StructuredPoints to the UnstructuredGrid\n    vtkPoints points = new vtkPoints();\n\n    //retrieve the entries from the grid and print them to the screen\n    double p[] = new double[3];\n    for(int i = 0; i < structuredPoints.GetNumberOfPoints(); i++)\n    {\n      structuredPoints.GetPoint(i, p);\n      points.InsertNextPoint(p);\n    }\n\n    vtkUnstructuredGrid ug = new vtkUnstructuredGrid();\n    ug.SetPoints(points);\n\n    vtkXMLUnstructuredGridWriter writer = new vtkXMLUnstructuredGridWriter();\n    writer.SetFileName(outputFilename);\n    writer.SetInputData(ug);\n    writer.Write();\n\n  }\n}\n
        "},{"location":"Java/StructuredPoints/Vol/","title":"Vol","text":"

        vtk-examples/Java/StructuredPoints/Vol

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/StructuredPoints/Vol/#code","title":"Code","text":"

        Vol.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkStructuredPoints;\nimport vtk.vtkDoubleArray;\nimport vtk.vtkContourFilter;\n\npublic class Vol \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    int i, j, k, kOffset, jOffset, offset;\n    double x, y, z, sp;\n    double s;\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Salmon\", actorColor);\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    vtkStructuredPoints vol = new vtkStructuredPoints();\n    vol.SetDimensions(26,26,26);\n    vol.SetOrigin(-0.5,-0.5,-0.5);\n    sp = 1.0/25.0;\n    vol.SetSpacing(sp, sp, sp);\n\n    vtkDoubleArray scalars = new vtkDoubleArray();\n    scalars.SetNumberOfComponents(1);\n    scalars.SetNumberOfTuples(26*26*26);\n    for (k=0; k<26; k++)\n    {\n     z = -0.5 + k*sp;\n     kOffset = k * 26 * 26;\n     for (j=0; j<26; j++) \n     {\n      y = -0.5 + j*sp;\n      jOffset = j * 26;\n      for (i=0; i<26; i++) \n      {\n       x = -0.5 + i*sp;\n       s = x*x + y*y + z*z - (0.4*0.4);\n       offset = i + jOffset + kOffset;\n       scalars.InsertTuple1(offset, s);\n      }\n     }\n    }\n\n    vol.GetPointData().SetScalars(scalars);\n    vtkContourFilter contour = new vtkContourFilter();\n    contour.SetInputData(vol);\n    contour.SetValue(0,0.0);\n\n    vtkPolyDataMapper volMapper = new vtkPolyDataMapper();\n    volMapper.SetInputConnection(contour.GetOutputPort());\n    volMapper.ScalarVisibilityOff();\n\n    vtkActor volActor = new vtkActor();\n    volActor.SetMapper(volMapper);\n    volActor.GetProperty().EdgeVisibilityOn();\n    volActor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(volActor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/SwingIntegration/JFrameRenderer/","title":"JFrameRenderer","text":"

        vtk-examples/Java/SwingIntegration/JFrameRenderer

        "},{"location":"Java/SwingIntegration/JFrameRenderer/#description","title":"Description","text":"

        This example shows how to render a VTK scene in a JFrame using a vtkRenderWindowPanel.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/SwingIntegration/JFrameRenderer/#code","title":"Code","text":"

        JFrameRenderer.java

        import java.awt.*;\nimport javax.swing.*;\n\nimport vtk.*;\n\npublic class JFrameRenderer extends JFrame {\n\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  private vtkRenderWindowPanel renderWindowPanel;\n\n  public JFrameRenderer() {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[4];\n    double actorColor[] = new double[4];\n    colors.GetColor(\"RoyalBlue\", bkg);\n    colors.GetColor(\"LemonChiffon\", actorColor);\n\n    // Create a sphere source\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetRadius(10.0);\n\n    // Create a sphere mapper\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(sphere.GetOutputPort());\n\n    //create sphere actor\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n    sphereActor.GetProperty().SetColor(actorColor);\n\n    // Create a render window panel to display the sphere\n    renderWindowPanel = new vtkRenderWindowPanel();\n    renderWindowPanel.setPreferredSize(new Dimension(600, 600));\n    renderWindowPanel.setInteractorStyle(new vtkInteractorStyleTrackballCamera());\n\n    add(renderWindowPanel, BorderLayout.CENTER);\n\n    renderWindowPanel.GetRenderer().AddActor(sphereActor);\n    renderWindowPanel.GetRenderer().SetBackground(bkg);\n  }\n\n  public static void main(String[] args) {\n    try {\n      SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JPopupMenu.setDefaultLightWeightPopupEnabled(false);\n          ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);\n\n          JFrame frame = new JFrameRenderer();\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.pack();\n          frame.setVisible(true);\n          ((JFrameRenderer) frame).render();\n        }\n      });\n    } catch (Exception e) {\n      e.printStackTrace();\n    }\n  }\n\n  public void render() {\n    renderWindowPanel.Render();\n  }\n}\n
        "},{"location":"Java/SwingIntegration/SwingHandleMouseEvent/","title":"SwingHandleMouseEvent","text":"

        vtk-examples/Java/SwingIntegration/SwingHandleMouseEvent

        "},{"location":"Java/SwingIntegration/SwingHandleMouseEvent/#description","title":"Description","text":"

        This example shows how to display in a JLabel the point the mouse is hovering over using a mouse listener.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/SwingIntegration/SwingHandleMouseEvent/#code","title":"Code","text":"

        SwingHandleMouseEvent.java

        import java.awt.*;\nimport java.awt.event.*;\nimport javax.swing.*;\nimport javax.swing.border.*;\n\nimport vtk.*;\n\npublic class SwingHandleMouseEvent extends JFrame {\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public SwingHandleMouseEvent() {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[4];\n    double actorColor[] = new double[4];\n    colors.GetColor(\"RoyalBlue\", bkg);\n    colors.GetColor(\"LemonChiffon\", actorColor);\n\n    // Create a sphere source\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetRadius(10.0);\n\n    // Create a sphere mapper\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(sphere.GetOutputPort());\n\n    //create sphere actor\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n    sphereActor.GetProperty().SetColor(actorColor);\n\n    // Create a render window panel to display the sphere\n    final vtkRenderWindowPanel renderWindowPanel = new vtkRenderWindowPanel();\n    renderWindowPanel.setPreferredSize(new Dimension(600, 600));\n    renderWindowPanel.setInteractorStyle(new vtkInteractorStyleTrackballCamera());\n\n    add(renderWindowPanel, BorderLayout.CENTER);\n\n    renderWindowPanel.GetRenderer().AddActor(sphereActor);\n    renderWindowPanel.GetRenderer().SetBackground(bkg);\n\n    // Create a status bar\n    JPanel statusBar = new JPanel(new BorderLayout());\n    final JLabel label = new JLabel(\" \", SwingConstants.RIGHT);\n    statusBar.add(label, BorderLayout.EAST);\n    statusBar.setBorder(new BevelBorder(BevelBorder.LOWERED));\n\n    add(statusBar, BorderLayout.SOUTH);\n\n    final vtkCellPicker cellPicker = new vtkCellPicker();\n\n    // Show the point on the sphere the mouse is hovering over in the status bar\n    renderWindowPanel.addMouseMotionListener(new MouseMotionAdapter() {\n      public void mouseMoved(MouseEvent e) {\n        // The call to Pick needs to be surrounded by lock and unlock to prevent crashes.\n        renderWindowPanel.lock();\n        int pickSucceeded = cellPicker.Pick(e.getX(), renderWindowPanel.getHeight() - e.getY() - 1,\n            0.0, renderWindowPanel.GetRenderer());\n        renderWindowPanel.unlock();\n\n        if (pickSucceeded == 1) {\n          double[] p = cellPicker.GetPickPosition();\n          label.setText(\"Position: \" + p[0] + \", \" + p[1] + \", \" + p[2]);\n        } else {\n          label.setText(\" \");\n        }\n      }\n    });\n  }\n\n  public static void main(String[] args) {\n    try {\n      SwingUtilities.invokeLater(new Runnable() {\n        public void run() {\n          JPopupMenu.setDefaultLightWeightPopupEnabled(false);\n          ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);\n\n          JFrame frame = new SwingHandleMouseEvent();\n          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n          frame.pack();\n          frame.setVisible(true);\n        }\n      });\n    } catch (Exception e) {\n      e.printStackTrace();\n    }\n  }\n}\n
        "},{"location":"Java/Texture/TexturePlane/","title":"TexturePlane","text":"

        vtk-examples/Java/Texture/TexturePlane

        "},{"location":"Java/Texture/TexturePlane/#description","title":"Description","text":"

        vtkTexture is an object that handles loading and binding of texture maps.

        It obtains its data from an input image data dataset type. Thus you can create visualization pipelines to read, process, and construct textures. Note that textures will only work if texture coordinates are also defined, and if the rendering system supports texture.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Texture/TexturePlane/#code","title":"Code","text":"

        TexturePlane.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageReader2Factory;\nimport vtk.vtkImageReader2;\nimport vtk.vtkTexture;\nimport vtk.vtkPlaneSource;\n\npublic class TexturePlane \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.bmp) e.g masonry.bmp\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    vtkImageReader2Factory readerFactory = new vtkImageReader2Factory();\n    vtkImageReader2 textureFile = new vtkImageReader2();\n    textureFile = readerFactory.CreateImageReader2(inputFilename);\n    textureFile.SetFileName(inputFilename);\n    textureFile.Update();\n\n    vtkTexture atext = new vtkTexture();\n    atext.SetInputConnection(textureFile.GetOutputPort());\n    atext.InterpolateOn();\n\n    // Create a plane source and actor. The vtkPlanesSource generates texture coordinates.\n\n    vtkPlaneSource plane = new vtkPlaneSource();\n\n    vtkPolyDataMapper  planeMapper = new vtkPolyDataMapper();\n    planeMapper.SetInputConnection(plane.GetOutputPort());\n\n    vtkActor planeActor = new vtkActor();\n    planeActor.SetMapper(planeMapper);\n    planeActor.SetTexture(atext);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // VisualiZe\n    ren.AddActor(planeActor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    ren.ResetCamera();\n    ren.GetActiveCamera().Elevation(-30);\n    ren.GetActiveCamera().Roll(-20);\n    ren.ResetCameraClippingRange();\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Texture/TexturedSphere/","title":"TexturedSphere","text":"

        vtk-examples/Java/Texture/TexturedSphere

        "},{"location":"Java/Texture/TexturedSphere/#description","title":"Description","text":"

        vtkTexturedSphereSource object creates a polygonal sphere of specified radius centered at the origin.

        The resolution (polygonal discretization) in both the latitude (phi) and longitude (theta) directions can be specified. It also is possible to create partial sphere by specifying maximum phi and theta angles.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Texture/TexturedSphere/#code","title":"Code","text":"

        TexturedSphere.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkTexturedSphereSource;\nimport vtk.vtkImageReader2Factory;\nimport vtk.vtkTexture;\nimport vtk.vtkImageReader2;\nimport vtk.vtkTransformTextureCoords;\n\npublic class TexturedSphere \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length < 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.png or .ppm) translate e.g earth.ppm 0 \");\n      return;\n    }\n    double translate[] = new double[3];\n    String inputFilename = args[0];\n\n    if (args.length > 1)\n    {\n        translate[0] = Double.parseDouble(args[1]);\n    }\n    else \n    {\n        translate[0] = 0.0;\n    }\n    translate[1] = 0.0;\n    translate[2] = 0.0;\n\n    System.out.print(translate[0] + \" \" + translate[1] + \" \" + translate[2] + \"\\n\");\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    // Create a sphere with texture coordinates\n    vtkTexturedSphereSource source = new vtkTexturedSphereSource();\n    source.SetPhiResolution(40);\n    source.SetThetaResolution(40);\n\n    // Read texture file\n    vtkImageReader2Factory readerFactory = new vtkImageReader2Factory();\n    vtkImageReader2 imageReader = new vtkImageReader2();\n    imageReader = readerFactory.CreateImageReader2(inputFilename);\n    imageReader.SetFileName(inputFilename);\n\n    // Create texture\n    vtkTexture texture = new vtkTexture();\n    texture.SetInputConnection(imageReader.GetOutputPort());\n\n    vtkTransformTextureCoords transformTexture = new vtkTransformTextureCoords();\n    transformTexture.SetInputConnection(source.GetOutputPort());\n    transformTexture.SetPosition(translate);\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(transformTexture.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.SetTexture(texture);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Utilities/BrownianPoints/","title":"BrownianPoints","text":"

        vtk-examples/Java/Utilities/BrownianPoints

        "},{"location":"Java/Utilities/BrownianPoints/#description","title":"Description","text":"

        vtkBrownianPoints object is a filter object that assigns a random vector (i.e., magnitude and direction) to each point.

        The minimum and maximum speed values can be controlled by the user.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/BrownianPoints/#code","title":"Code","text":"

        BrownianPoints.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSphereSource;\nimport vtk.vtkArrowSource;\nimport vtk.vtkBrownianPoints;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkMath;\n\npublic class BrownianPoints \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Actor Color\n    double glyphActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Banana\",glyphActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    //Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n\n    //Generate random vectors\n    vtkMath math = new vtkMath( );\n    math.RandomSeed(5070); // for testing\n    vtkBrownianPoints brownianPoints = new vtkBrownianPoints();\n    brownianPoints.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkArrowSource arrowSource = new vtkArrowSource();\n\n    vtkGlyph3D glyph3D = new vtkGlyph3D();\n    glyph3D.SetSourceConnection(arrowSource.GetOutputPort());\n    glyph3D.SetInputConnection(brownianPoints.GetOutputPort());\n    glyph3D.SetScaleFactor(.3);\n\n    //Create a mapper and actor for sphere\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.GetProperty().EdgeVisibilityOn();\n    actor.GetProperty().SetInterpolationToFlat();\n    actor.SetMapper(mapper);\n\n    //Create a mapper and actor for glyphs\n    vtkPolyDataMapper glyphMapper = new vtkPolyDataMapper();\n    glyphMapper.SetInputConnection(glyph3D.GetOutputPort());\n\n    vtkActor glyphActor = new vtkActor();\n    glyphActor.GetProperty().SetColor(glyphActorColor);\n    glyphActor.SetMapper(glyphMapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.AddActor(glyphActor);\n\n    ren.ResetCamera();\n    ren.GetActiveCamera().Azimuth(30    );\n    ren.GetActiveCamera().Elevation(30);\n    ren.GetActiveCamera().Dolly(1.4);\n    ren.ResetCameraClippingRange();\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Utilities/ColorLookupTable/","title":"ColorLookupTable","text":"

        vtk-examples/Java/Utilities/ColorLookupTable

        "},{"location":"Java/Utilities/ColorLookupTable/#description","title":"Description","text":"

        This example shows how to create a table of colors that map from a continuous range of values.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/ColorLookupTable/#code","title":"Code","text":"

        ColorLookupTable.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkLookupTable;\n\npublic class ColorLookupTable\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \"not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // ------------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkLookupTable lookupTable = new vtkLookupTable();\n    lookupTable.SetTableRange(0.0, 10.0);\n    // If you don't want to use the whole color range, you can use\n    // SetValueRange, SetHueRange, and SetSaturationRange\n    lookupTable.Build();\n\n    double color[] = new double[3];\n    lookupTable.GetColor(1.0, color);\n\n    System.out.println(color[0]  + \" \" + color[1] + \" \" + color[2]);\n\n    lookupTable.GetColor(5.0, color);\n\n    System.out.println(color[0]  + \" \" + color[1] + \" \" + color[2]);\n\n  }\n}\n
        "},{"location":"Java/Utilities/DiscretizableColorTransferFunction/","title":"DiscretizableColorTransferFunction","text":"

        vtk-examples/Java/Utilities/DiscretizableColorTransferFunction

        "},{"location":"Java/Utilities/DiscretizableColorTransferFunction/#description","title":"Description","text":"

        vtkDiscretizableColorTransferFunction object is a cross between a vtkColorTransferFunction and vtkLookupTable selectively combining the functionality of both.

        This class is a vtkColorTransferFunction allowing users to specify the RGB control points that control the color transfer function. At the same time, by setting Discretize to 1 (true), one can force the transfer function to only have NumberOfValues discrete colors.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/DiscretizableColorTransferFunction/#code","title":"Code","text":"

        DiscretizableColorTransferFunction.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkDiscretizableColorTransferFunction;\n\npublic class DiscretizableColorTransferFunction \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  { \n   vtkDiscretizableColorTransferFunction discretizableColorTransferFunction = new vtkDiscretizableColorTransferFunction();\n   discretizableColorTransferFunction.DiscretizeOn();\n   discretizableColorTransferFunction.SetNumberOfValues(2);\n\n   discretizableColorTransferFunction.AddRGBPoint(0.0, 1, 0, 0);\n   discretizableColorTransferFunction.AddRGBPoint(10.0, 0, 1, 0);\n   discretizableColorTransferFunction.Build();\n\n   double color[] = new double[3];\n   discretizableColorTransferFunction.GetColor(1.0, color);\n\n   System.out.println(color[0] +\" \" + color[1] + \" \" + color[2]);\n\n   discretizableColorTransferFunction.GetColor(5.0, color);\n   System.out.println(color[0] +\" \" + color[1] + \" \" + color[2]);   \n  }\n}\n
        "},{"location":"Java/Utilities/FullScreen/","title":"FullScreen","text":"

        vtk-examples/Java/Utilities/FullScreen

        "},{"location":"Java/Utilities/FullScreen/#description","title":"Description","text":"

        Example Program to Demonstrate Full Screen Render Window.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/FullScreen/#code","title":"Code","text":"

        FullScreen.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkSphereSource;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\n\n\npublic class FullScreen \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n   }\n   vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  //-----------------------------------------------------------------\n\n public static void main(String s[]) \n {\n   // Create a sphere\n   vtkSphereSource SphereSource = new vtkSphereSource();\n   SphereSource.Update();\n\n   vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n   Mapper.SetInputConnection(SphereSource.GetOutputPort());\n\n  vtkActor Actor = new vtkActor();\n  Actor.SetMapper(Mapper);\n\n  // Create the renderer, render window and interactor.\n  vtkRenderer ren = new vtkRenderer();\n  vtkRenderWindow renWin = new vtkRenderWindow();\n  renWin.AddRenderer(ren);\n  vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n  iren.SetRenderWindow(renWin);\n\n  // Visualise Sphere in full screen window\n  ren.AddActor(Actor);\n  renWin.Render();\n  renWin.SetFullScreen(1);\n  ren.ResetCamera();\n  ren.ResetCameraClippingRange();\n\n  iren.Initialize();\n  iren.Start();\n }\n}\n
        "},{"location":"Java/Utilities/FunctionParser/","title":"FunctionParser","text":"

        vtk-examples/Java/Utilities/FunctionParser

        "},{"location":"Java/Utilities/FunctionParser/#description","title":"Description","text":"

        vtkFunctionParser object that takes in a mathematical expression as a char string, parses it, and evaluates it at the specified values of the variables in the input string.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/FunctionParser/#code","title":"Code","text":"

        FunctionParser.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkFunctionParser;\n\npublic class FunctionParser \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n   vtkFunctionParser functionParser = new vtkFunctionParser();\n   functionParser.SetFunction(\"a+b\");\n   functionParser.SetScalarVariableValue( \"a\", 2);\n   functionParser.SetScalarVariableValue( \"b\", 3);\n\n   double result = functionParser.GetScalarResult();\n\n   System.out.println(\"Result:\" +\" \" +result);\n  }\n}\n
        "},{"location":"Java/Utilities/GetDataRoot/","title":"GetDataRoot","text":"

        vtk-examples/Java/Utilities/GetDataRoot

        "},{"location":"Java/Utilities/GetDataRoot/#description","title":"Description","text":"

        vtkTesting object is a unified VTK regression testing framework.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/GetDataRoot/#code","title":"Code","text":"

        GetDataRoot.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkTesting;\n\npublic class GetDataRoot \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n   vtkTesting testHelper = new vtkTesting();\n   String dataRoot = testHelper.GetDataRoot();\n\n   System.out.print(\"DataRoot:\" + \" \" + dataRoot);\n  }\n}\n
        "},{"location":"Java/Utilities/KnownLengthArray/","title":"KnownLengthArray","text":"

        vtk-examples/Java/Utilities/KnownLengthArray

        "},{"location":"Java/Utilities/KnownLengthArray/#description","title":"Description","text":"

        This example creates a VTK style float array. This can be easily interchanged with vtkIntArray, vtkDoubleArray, etc.

        The terminology is as follows:

        • SetNumberOfComponents(): sets the number of elements that a tuple in the array will have. See VectorArrayKnownLength for an example with tuples with more than one element.

        • SetNumberOfValues(): sets the number of tuples the array will have. See UnknownLengthArray for an example where the number of values is not known in advance.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/KnownLengthArray/#code","title":"Code","text":"

        KnownLengthArray.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkFloatArray;\n\npublic class KnownLengthArray \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n //-----------------------------------------------------------------\n public static void main(String s[]) \n {  \n    vtkFloatArray Distances = new vtkFloatArray();\n    Distances.SetName(\"Distances\");\n    Distances.SetNumberOfComponents(1);\n    Distances.SetNumberOfValues(5);\n\n    //set values\n    for(int i = 0; i < Distances.GetNumberOfTuples(); i++)\n    {\n      double f = i + 0.1;\n      Distances.SetValue(i, f);\n    }\n\n    //get values\n    for(int i = 0; i < Distances.GetNumberOfTuples(); i++)\n    {\n      double f = Distances.GetValue(i);\n      System.out.println(f);\n    }       \n\n  }\n}\n
        "},{"location":"Java/Utilities/PiecewiseFunction/","title":"PiecewiseFunction","text":"

        vtk-examples/Java/Utilities/PiecewiseFunction

        "},{"location":"Java/Utilities/PiecewiseFunction/#description","title":"Description","text":"

        vtkPiecewiseFunction object defines a piecewise function mapping. This mapping allows the addition of control points, and allows the user to control the function between the control points.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/PiecewiseFunction/#code","title":"Code","text":"

        PiecewiseFunction.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkPiecewiseFunction;\n\npublic class PiecewiseFunction \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n   vtkPiecewiseFunction piecewiseFunction = new vtkPiecewiseFunction();\n   piecewiseFunction.AddPoint(0.0, 0.0);\n   piecewiseFunction.AddPoint(1.0, 2.0);\n\n   double test = piecewiseFunction.GetValue(0.25);\n\n   System.out.println( \"Test: \"  + \" \" + test); //(should be 0.5)\n  }\n}\n
        "},{"location":"Java/Utilities/ReportRenderWindowCapabilities/","title":"ReportRenderWindowCapabilities","text":"

        vtk-examples/Java/Utilities/ReportRenderWindowCapabilities

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/ReportRenderWindowCapabilities/#code","title":"Code","text":"

        ReportRenderWindowCapabilities.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\nimport vtk.vtkConeSource;\n\npublic class ReportRenderWindowCapabilities \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n   //Create a cone\n   vtkConeSource coneSource = new vtkConeSource();\n   coneSource.Update();\n\n   //Create a mapper and actor\n   vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n   mapper.SetInputConnection(coneSource.GetOutputPort());\n\n   vtkActor actor = new vtkActor();\n   actor.SetMapper(mapper);\n\n   // Create the renderer, render window\n   vtkRenderer ren = new vtkRenderer();\n   vtkRenderWindow renWin = new vtkRenderWindow();\n   renWin.AddRenderer(ren);\n\n   ren.AddActor(actor);\n\n   renWin.Render();\n\n   System.out.println(renWin.ReportCapabilities());\n  }\n}\n
        "},{"location":"Java/Utilities/Screenshot/","title":"Screenshot","text":"

        vtk-examples/Java/Utilities/Screenshot

        "},{"location":"Java/Utilities/Screenshot/#description","title":"Description","text":"

        vtkWindowToImageFilter object provides methods needed to read the data in a vtkWindow and use it as input to the imaging pipeline.

        This is useful for saving an image to a file for example. The window can be read as either RGB or RGBA pixels

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/Screenshot/#code","title":"Code","text":"

        Screenshot.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkPNGWriter;\nimport vtk.vtkWindowToImageFilter;\n\npublic class Screenshot \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void writeImage(vtkRenderWindow renWin, String fn) \n  { \n    vtkWindowToImageFilter windowToImageFilter = new vtkWindowToImageFilter();\n    windowToImageFilter.SetInput(renWin);\n    windowToImageFilter.SetScale(1);\n    windowToImageFilter.SetInputBufferTypeToRGB();\n\n    windowToImageFilter.ReadFrontBufferOff();\n    windowToImageFilter.Update();\n\n    vtkPNGWriter writer = new vtkPNGWriter();\n    writer.SetFileName(fn);\n    writer.SetInputConnection(windowToImageFilter.GetOutputPort());\n    writer.Write();\n  }\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.png) e.g screenshot.png\");\n      return;\n    }\n    String fileName = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource.SetRadius(4.0);\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper  = new vtkPolyDataMapper();\n    sphereMapper.SetInputData (sphereSource.GetOutput());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetAlphaBitPlanes(1);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    writeImage(renWin, fileName);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Utilities/TimerLog/","title":"TimerLog","text":"

        vtk-examples/Java/Utilities/TimerLog

        "},{"location":"Java/Utilities/TimerLog/#description","title":"Description","text":"

        Example to Demonstrate Timer support and logging.

        The object [vtkTimerLog](https://www.vtk.org/doc/nightly/html/classvtkTimerLog.html#details) contains walltime and cputime measurements associated with a given event.

        These results can be later analyzed when \"dumping out\" the table. In addition, vtkTimerLog allows the user to simply get the current time, and to start/stop a simple timer that is separate from the timing table logging.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/TimerLog/#code","title":"Code","text":"

        TimerLog.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkTimerLog;\n\npublic class TimerLog \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  //-----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkTimerLog TimerLog = new vtkTimerLog();\n\n    System.out.println(\"Current Time:\" + TimerLog.GetUniversalTime());\n    TimerLog.MarkEvent(\"File Opened\");\n    TimerLog.MarkEvent(\"Did Somthing\");\n    System.out.println(\"Timer Log:\" + TimerLog);         \n  }\n}\n
        "},{"location":"Java/Utilities/UnknownLengthArray/","title":"UnknownLengthArray","text":"

        vtk-examples/Java/Utilities/UnknownLengthArray

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Utilities/UnknownLengthArray/#code","title":"Code","text":"

        UnknownLengthArray.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkFloatArray;\n\npublic class UnknownLengthArray \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  //-----------------------------------------------------------------\n\n  public static void main(String s[]) \n  { \n    vtkFloatArray Distances = new vtkFloatArray();\n    Distances.SetName(\"Distances\");\n    Distances.SetNumberOfComponents(1);\n    //set values\n    for(int i = 0; i < 5; i++)\n    {\n      double f = i + 0.1;\n      //this will allocate memory as necessary\n      Distances.InsertNextValue(f);\n    }\n    //get values\n    for(int i = 0; i <Distances.GetNumberOfTuples(); i++)\n    {\n      double f = Distances.GetValue(i);\n      System.out.println(f);\n    }       \n  }\n}\n
        "},{"location":"Java/Video/OggTheora/","title":"OggTheora","text":"

        vtk-examples/Java/Video/OggTheora

        "},{"location":"Java/Video/OggTheora/#description","title":"Description","text":"

        vtkOggTheoraWriter object is an adapter that allows VTK to use the ogg and theora libraries to write movie files.

        This class creates .ogv files containing theora encoded video without audio.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Video/OggTheora/#code","title":"Code","text":"

        OggTheora.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkOggTheoraWriter;\nimport vtk.vtkNamedColors;\n\n\npublic class OggTheora \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n     //parse command line arguments\n    if (args.length != 1) \n    {\n        System.err.println(\"Usage: java -classpath ... OggTheora Filename(.avi) e.g OggTheora.avi\");\n        return;\n    }\n\n    String fileName = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkgcolor[] = new double[] {0, 0,0,1};\n    double boxcolor[] = new double[] {255,0,0,1};\n\n    colors.SetColor(\"bkgColor\", bkgcolor);\n    colors.SetColor(\"boxColor\", boxcolor);\n\n    vtkImageCanvasSource2D source = new vtkImageCanvasSource2D();\n    source.SetScalarTypeToUnsignedChar();\n    source.SetNumberOfScalarComponents(3);\n    source.SetExtent(0, 100, 0, 100, 0, 0);\n\n    vtkOggTheoraWriter writer = new vtkOggTheoraWriter();\n\n    writer.SetInputConnection(source.GetOutputPort());\n    writer.SetFileName(fileName);\n    writer.Start();\n\n    for(int i = 0; i < 100; i++)\n    {\n      source.SetDrawColor(bkgcolor); //black\n      source.FillBox(0, 100, 0, 100); //clear image\n\n      source.SetDrawColor(boxcolor); //red\n      source.FillBox(i, 20, 10, 20);\n\n      source.Update();\n      writer.Write();\n    }\n    writer.End();\n  }\n}\n
        "},{"location":"Java/Views/RenderView/","title":"RenderView","text":"

        vtk-examples/Java/Views/RenderView

        "},{"location":"Java/Views/RenderView/#description","title":"Description","text":"

        Here is a little bit easier way in Java to get your objects to appear on the screen using vtkRenderer which provides an abstract specification for renderers.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Views/RenderView/#code","title":"Code","text":"

        RenderView.java

        import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderView;\nimport vtk.vtkNamedColors;\n\npublic class RenderView\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                 \n   vtkNamedColors colors = new vtkNamedColors();\n   //For Actor Color\n   double actorColor[] = new double[4];\n   //Renderer Background Color\n   double Bgcolor[] = new double[4];\n   colors.GetColor(\"Crimson\", actorColor);\n   colors.GetColor(\"MidnightBlue\", Bgcolor);\n\n   //Create a Sphere\n   vtkSphereSource Sphere = new vtkSphereSource();\n   Sphere.SetCenter(0.0,0.0,0.0);\n   Sphere.SetRadius(1.0);\n   Sphere.Update();\n\n   //Create a Mapper and Actor\n   vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n   Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n   vtkActor Actor = new vtkActor();\n   Actor.SetMapper(Mapper);\n   Actor.GetProperty().SetColor(actorColor);\n\n   vtkRenderView RenderView = new vtkRenderView();\n   RenderView.SetInteractionModeTo3D();\n   RenderView.GetRenderer().AddActor(Actor);\n   RenderView.GetRenderer().SetBackground(Bgcolor);\n   RenderView.Update();\n\n   RenderView.ResetCamera();\n   RenderView.GetInteractor().Start();  \n\n  }       \n}\n
        "},{"location":"Java/Visualization/AnimDataCone/","title":"AnimDataCone","text":"

        vtk-examples/Java/Visualization/AnimDataCone

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/AnimDataCone/#code","title":"Code","text":"

        AnimDataCone.java

        // First we import the VTK package that will make available all\n// of the VTK commands to Java.\n\nimport vtk.*;\n\npublic class AnimDataCone {\n\n  // this is an array of transforms to apply to the vtkPolyData.\n  static double moves[][] =\n      {{1.11, 1., 1.}, // expand on x\n          {1.11, 1., 1.}, // expand on x\n          {1.11, 1., 1.}, // expand on x\n          {.9009, 1., 1.}, // contract on x\n          {.9009, 1., 1.}, // contract on x\n          {.9009, 1., 1.}, // contract on x\n          {1., 1.11, 1.}, // expand on y\n          {1., 1.11, 1.}, // expand on y\n          {1., 1.11, 1.}, // expand on y\n          {1., .9009, 1.}, // contract on y\n          {1., .9009, 1.}, // contract on y\n          {1., .9009, 1.}, // contract on y\n          {1., 1., 1.11}, // expand on z\n          {1., 1., 1.11}, // expand on z\n          {1., 1., 1.11}, // expand on z\n          {1., 1., .9009}, // contract on z\n          {1., 1., .9009}, // contract on z\n          {1., 1., .9009} // contract on z\n      };\n\n  /**\n   * @param args\n   */\n  // load the necessary interface libraries on first reference to the\n  // class.\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  // declare the interactor as an instance variable so we can refer to it\n  // in the timer callback. we will pass the instance pointer to this\n  // class for the callback to be invoked on.\n  vtkRenderWindowInteractor iren = null;\n  // create an instance polydata object to hold the animated polydata\n  vtkAppendPolyData pd = null;\n  // create the Transform as an instance variable so we can interact\n  // with it from the interaction call back.\n  vtkTransform Transform = null;\n  // animState is how we manage the transform choices.\n  // each animState is a frame of animation. in this case\n  // a selected scale transform in the array of scale settings\n  // in the moves array.\n  int animState = 0;\n\n  public static void main(String[] args) {\n    // We will start by creating an instance of our AnimDataCone example\n    // This example uses callbacks, and for Java that requires an instance\n    // object to own the callback logic.\n\n    AnimDataCone myCone = new AnimDataCone();\n    myCone.doit();\n  }\n\n  /*\n   * The TimerEvent is specified as the TimerEvent callback\n   * to the RenderWindowInteractor. The polydata modification\n   * is done here as well as the call to the renderWindow to\n   * render the updated scene.\n   */\n  void StartRender() {\n\n    vtkPolyData mpd = pd.GetPolyDataInput(0);\n    vtkPoints pts = mpd.GetPoints();\n    int ptct = pts.GetNumberOfPoints();\n    Transform.Identity();\n    Transform.Scale(AnimDataCone.moves[animState]);\n    // this would probably be better done with a property or assembly,\n    // but this clearly illustrates the modification of point data\n    // cycle through the animation frames\n    animState = (++animState) % 18;\n    // Actually, marking the polydata as modified\n    // is the key to the animation.\n    // Comment the following pd.modified() and nothing\n    // will appear to happen, inspite of all the preceding.\n    // the pipeline UpdateExtent() only processes data that\n    // a modification time stamp more recent than the last render.\n    pd.Modified();\n    // Uncomment the following to get a log of time in milliseconds \n    // for each rendered frame. \n    //  System.out.println(\"Render:\" + System.currentTimeMillis());\n  }\n\n  /*\n   * The doit() function is simply the instance function to perform the\n   * construction of the vtk pipeline for this example.\n   */\n  void doit() {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    double bkg[] = new double[]{0.1, 0.2, 0.4, 1.0};\n    double actorColor[] = new double[4];\n    colors.GetColor(\"White\", actorColor);\n\n    // This example illustrates animation via the startrender callback/\n    //\n    Transform = new vtkTransform();\n    // Next we create an instance of vtkConeSource and set some of its\n    // properties. The instance of vtkConeSource \"cone\" is part of a\n    // visualization pipeline (it is a source process object); it produces\n    // data (output type is vtkPolyData) which other filters may process.\n    vtkConeSource cone = new vtkConeSource();\n    cone.SetHeight(3.0);\n    cone.SetRadius(1.0);\n    cone.SetResolution(10);\n\n    pd = new vtkAppendPolyData();\n\n    pd.SetInputConnection(cone.GetOutputPort());\n    // In this example we terminate the pipeline with a mapper process\n    // object.\n    // (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    // between the source and the mapper.) We create an instance of\n    // vtkPolyDataMapper to map the polygonal data into graphics primitives.\n    // We connect the output of the cone source to the input of this mapper.\n    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();\n    coneMapper.SetInputConnection(pd.GetOutputPort());\n\n    // Create an actor to represent the cone. The actor orchestrates\n    // rendering of\n    // the mapper's graphics primitives. An actor also refers to properties\n    // via a\n    // vtkProperty instance, and includes an internal transformation matrix.\n    // We\n    // set this actor's mapper to be coneMapper which we created above.\n    vtkActor coneActor = new vtkActor();\n    coneActor.SetMapper(coneMapper);\n    coneActor.GetProperty().SetColor(actorColor);\n\n    // Create the Renderer and assign actors to it. A renderer is like a\n    // viewport. It is part or all of a window on the screen and it is\n    // responsible for drawing the actors it has. We also set the\n    // background color here.\n    vtkRenderer ren1 = new vtkRenderer();\n    ren1.AddActor(coneActor);\n    ren1.SetBackground(bkg);\n\n    // Finally we create the render window which will show up on the screen\n    // We put our renderer into the render window using AddRenderer. We\n    // also set the size to be 300 pixels by 300.\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren1);\n    renWin.SetSize(600, 600);\n\n    // The vtkRenderWindowInteractor class watches for events (e.g.,\n    // keypress,\n    // mouse) in the vtkRenderWindow. These events are translated into\n    // event invocations that VTK understands (see VTK/Common/vtkCommand.h\n    // for all events that VTK processes). Then observers of these VTK\n    // events can process them as appropriate.\n    iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // By default the vtkRenderWindowInteractor instantiates an instance\n    // of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n    // it observes into operations on the camera, actors, and/or properties\n    // in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n    // Here we specify a particular interactor style.\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n\n    // Start the event loop.\n    iren.Initialize();\n    ren1.Render();\n    // Now for every window render we call our callback function to update\n    // the model\n    // resulting in another render.\n    ren1.AddObserver(\"StartEvent\", this, \"StartRender\");\n    iren.CreateRepeatingTimer(50);\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/Animation/","title":"Animation","text":"

        vtk-examples/Java/Visualization/Animation

        "},{"location":"Java/Visualization/Animation/#description","title":"Description","text":"

        This example demonstrates how to create a simple animation. A timer is used to move a sphere across a scene.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/Animation/#code","title":"Code","text":"

        Animation.java

        import vtk.*;\n\npublic class Animation\n{\n\n  static\n  {\n    System.loadLibrary(\"vtkCommonCoreJava\");\n    System.loadLibrary(\"vtkFiltersSourcesJava\");\n    System.loadLibrary(\"vtkFiltersCoreJava\");\n    System.loadLibrary(\"vtkInteractionStyleJava\");\n    System.loadLibrary(\"vtkRenderingCoreJava\");\n    System.loadLibrary(\"vtkRenderingOpenGL2Java\");\n  }\n\n  static class vtkTimerCallback\n  {\n    void Execute()\n    {\n      ++this.TimerCount;\n      System.out.println(this.TimerCount);\n      actor.SetPosition(this.TimerCount, this.TimerCount,0);\n      iren.GetRenderWindow().Render();\n    }\n\n    private int TimerCount = 0;\n    public vtkActor actor;\n    public vtkRenderWindowInteractor iren;\n  }\n\n  public static void main(String[] args)\n  {\n    //Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0);\n    sphereSource.SetRadius(5.0);\n    sphereSource.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create a renderer, render window, and interactor\n    vtkRenderer renderer = new vtkRenderer();\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.AddRenderer(renderer);\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n\n    //Add the actor to the scene\n    renderer.AddActor(actor);\n    renderer.SetBackground(1,1,1); // Background color white\n\n    //Render and interact\n    renderWindow.Render();\n\n    // Initialize must be called prior to creating timer events.\n    renderWindowInteractor.Initialize();\n\n    // Sign up to receive TimerEvent\n    vtkTimerCallback cb = new vtkTimerCallback();\n    cb.actor = actor;\n    cb.iren = renderWindowInteractor;\n    renderWindowInteractor.AddObserver(\"TimerEvent\", cb, \"Execute\");\n\n    int timerId = renderWindowInteractor.CreateRepeatingTimer(100);\n    System.out.println(\"timerId: \" + timerId);\n\n    //start the interaction and timer\n    renderWindowInteractor.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/AnnotatedCubeActor/","title":"AnnotatedCubeActor","text":"

        vtk-examples/Java/Visualization/AnnotatedCubeActor

        "},{"location":"Java/Visualization/AnnotatedCubeActor/#description","title":"Description","text":"

        vtkAnnotatedCubeActor object is a hybrid 3D actor used to represent an anatomical orientation marker in a scene.

        The class consists of a 3D unit cube centered on the origin with each face labelled in correspondence to a particular coordinate direction.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/AnnotatedCubeActor/#code","title":"Code","text":"

        AnnotatedCubeActor.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkAnnotatedCubeActor;\nimport vtk.vtkCamera;\nimport vtk.vtkProperty;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class AnnotatedCubeActor \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -------------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double renBgcolor[] = new double[4];\n\n    //Renderer Background Color\n     double Cubecolor[] = new double[4];\n\n    //Renderer Cube Text Edge Color\n    double CubeTextEdge[] = new double[4];\n\n    //Renderer xText plus and Minus Color\n    double Xplus[] = new double[4];\n    double Xminus[] = new double[4];\n\n    //Renderer yText plus and Minus Color\n    double Yplus[] = new double[4];\n    double Yminus[] = new double[4];\n\n    //Renderer zText plus and Minus Color\n    double Zplus[] = new double[4];\n    double Zminus[] = new double[4];\n\n    colors.GetColor(\"DeepPink\", renBgcolor);\n    colors.GetColor(\"Aquamarine\", Cubecolor);\n    colors.GetColor(\"Gold\", CubeTextEdge);\n    colors.GetColor(\"Turquoise\", Xplus);\n    colors.GetColor(\"Turquoise\", Xminus);\n    colors.GetColor(\"Mint\", Yplus);\n    colors.GetColor(\"Mint\", Yminus);\n    colors.GetColor(\"RoyalBlue\", Yplus);\n    colors.GetColor(\"RoyalBlue\", Yminus);\n\n    vtkAnnotatedCubeActor Cube = new vtkAnnotatedCubeActor();\n    Cube.SetFaceTextScale(0.666667);\n    Cube.GetCubeProperty().SetColor(Cubecolor);\n\n    // set up the renderer, window, and interactor\n    vtkRenderer ren = new vtkRenderer();\n    ren.SetBackground(renBgcolor);\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetSize(300,300);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // anatomic labelling \n    Cube.SetXPlusFaceText(\"A\");\n    Cube.SetXMinusFaceText(\"P\");\n    Cube.SetYPlusFaceText(\"L\");\n    Cube.SetYMinusFaceText(\"R\");\n    Cube.SetZPlusFaceText(\"S\");\n    Cube.SetZMinusFaceText(\"I\");\n\n    // change the vector text colors\n    Cube.GetTextEdgesProperty().SetColor(CubeTextEdge);\n    Cube.GetTextEdgesProperty().SetLineWidth(4);\n\n    vtkProperty Property = new vtkProperty();\n    Property = Cube.GetXPlusFaceProperty();\n    Property.SetColor(Xplus);\n    Property = Cube.GetXMinusFaceProperty();\n    Property.SetColor(Xminus);\n\n    Property = Cube.GetYPlusFaceProperty();\n    Property.SetColor(Yplus);\n    Property = Cube.GetYMinusFaceProperty();\n    Property.SetColor(Yminus);\n\n    Property = Cube.GetZPlusFaceProperty();\n    Property.SetColor(Zplus);\n    Property = Cube.GetZMinusFaceProperty();\n    Property.SetColor(Zminus);\n\n    ren.AddActor(Cube);\n\n    // set up an interesting view\n    vtkCamera Camera = new vtkCamera();\n    Camera.SetViewUp(0, 0, 1);\n    Camera.SetFocalPoint(0, 0, 0);\n    Camera.SetPosition(4.5, 4.5, 2.5);\n    ren.ResetCamera();\n    Camera.Dolly(1.4);\n\n    ren.ResetCameraClippingRange();\n    ren.GetActiveCamera().Azimuth(40);\n    ren.GetActiveCamera().Elevation(30);\n    iren.Initialize();\n    iren.Start();\n\n  }   \n}\n
        "},{"location":"Java/Visualization/BackfaceCulling/","title":"BackfaceCulling","text":"

        vtk-examples/Java/Visualization/BackfaceCulling

        "},{"location":"Java/Visualization/BackfaceCulling/#description","title":"Description","text":"

        This example renders a sphere with backface culling enabled.

        If backface culling is on, polygons facing away from camera are not drawn.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/BackfaceCulling/#code","title":"Code","text":"

        BackfaceCulling.java

        import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class BackfaceCulling \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tan\", actorColor);\n    colors.GetColor(\"Aquamarine\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    //Enable BackFaceCulling\n    Actor.GetProperty().BackfaceCullingOn();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/BackgroundColor/","title":"BackgroundColor","text":"

        vtk-examples/Java/Visualization/BackgroundColor

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/BackgroundColor/#code","title":"Code","text":"

        BackgroundColor.java

        import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class BackgroundColor \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n    if (!lib.IsLoaded()) \n    {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------  \n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DarkOrange\", actorColor);\n    colors.GetColor(\"SteelBlue\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0, 0, 0);\n    Sphere.SetRadius(4.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the Sphere\n    ren.AddActor(Actor);\n\n    //Setting up the Renderer Background Color.\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/BackgroundGradient/","title":"BackgroundGradient","text":"

        vtk-examples/Java/Visualization/BackgroundGradient

        "},{"location":"Java/Visualization/BackgroundGradient/#description","title":"Description","text":"

        An Example to demonstrating a viewport having a gradient background using the Background (bottom) and Background2 (top) colors.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/BackgroundGradient/#code","title":"Code","text":"

        BackgroundGradient.java

        import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\n\nimport vtk.vtkRenderWindow;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class BackgroundGradient\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n    if (!lib.IsLoaded()) \n    {\n      System.out.println(lib.GetLibraryName() + \" not loaded\");\n    }\n       }\n      }\n      vtkNativeLibrary.DisableOutputWindow(null);\n     }\n     // -----------------------------------------------------------------   \n\n     public static void main(String args[]) \n     {\n       vtkNamedColors colors = new vtkNamedColors();\n\n       //For Actor Color\n       double actorColor[] = new double[4];\n\n       //Renderer Background Color\n       double Bgcolor[] = new double[4];\n\n       //Renderer Background Color\n       double Bgcolor_2[] = new double[4];\n\n       colors.GetColor(\"MediumSpringGreen\", actorColor);\n       colors.GetColor(\"Banana\", Bgcolor);\n       colors.GetColor(\"Tomato\", Bgcolor_2);\n\n       //Create a Sphere\n       vtkSphereSource Sphere = new vtkSphereSource();\n       Sphere.Update();\n\n       //Create a Mapper and Actor\n       vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n       Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n       vtkActor Actor = new vtkActor();\n       Actor.SetMapper(Mapper);\n       Actor.GetProperty().SetColor(actorColor);\n\n\n       // Create the renderer, render window and interactor.\n       vtkRenderer ren = new vtkRenderer();\n       vtkRenderWindow renWin = new vtkRenderWindow();\n       renWin.AddRenderer(ren);\n       vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n       iren.SetRenderWindow(renWin);\n\n       // Visualise the arrow\n       ren.AddActor(Actor);\n\n       //Setting up the background gradient\n       ren.GradientBackgroundOn();\n       ren.SetBackground(Bgcolor);\n       ren.SetBackground2(Bgcolor_2);\n\n       renWin.SetSize(300, 300);\n       renWin.Render();\n\n       iren.Initialize();\n       iren.Start();\n     }  \n}\n
        "},{"location":"Java/Visualization/BlobbyLogo/","title":"BlobbyLogo","text":"

        vtk-examples/Java/Visualization/BlobbyLogo

        "},{"location":"Java/Visualization/BlobbyLogo/#description","title":"Description","text":"

        This is the blobby vtk logo described in chapter 12 of the VTK textbook. The example uses vtkAppendPolyData to combine three vtkPolyData. A vtkImplicitModeller creates a vtkImageData of the distnaces from the polydata triangles. vtkContourFilter extracts an isosurface representing an offset surface.

        This examples uses the data src/Testing/Data/v.vtk, src/Testing/Data/t.vtk and src/Testing/Data/k.vtk.

        Info

        See Figure 12-13 in Chapter 12 the VTK Textbook.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/BlobbyLogo/#code","title":"Code","text":"

        BlobbyLogo.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkPolyDataReader;\nimport vtk.vtkTransform;\nimport vtk.vtkTransformPolyDataFilter;\nimport vtk.vtkPolyDataNormals;\nimport vtk.vtkAppendPolyData;\nimport vtk.vtkImplicitModeller;\nimport vtk.vtkContourFilter;\nimport vtk.vtkProperty;\n\npublic class BlobbyLogo \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 3) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtk) Filename(.vtk) Filename(.vtk) e.g v.vtk t.vtk k.vtk\");\n      return;\n    }\n\n    vtkRenderer aRenderer = new vtkRenderer();\n    vtkRenderWindow aRenderWindow = new vtkRenderWindow();\n    aRenderWindow.AddRenderer(aRenderer);\n    vtkRenderWindowInteractor anInteractor = new vtkRenderWindowInteractor();\n    anInteractor.SetRenderWindow(aRenderWindow);\n    aRenderWindow.SetSize( 300, 300 );\n\n    //read the geometry file containing the letter v\n    vtkPolyDataReader letterV = new vtkPolyDataReader();\n    letterV.SetFileName (args[0]);\n\n    //read the geometry file containing the letter t\n    vtkPolyDataReader letterT = new vtkPolyDataReader();\n    letterT.SetFileName (args[1]);\n\n    //read the geometry file containing the letter k\n    vtkPolyDataReader letterK = new vtkPolyDataReader();\n    letterK.SetFileName (args[2]);\n\n    //create a transform and transform filter for each letter\n    vtkTransform VTransform = new vtkTransform();\n    vtkTransformPolyDataFilter VTransformFilter = new vtkTransformPolyDataFilter();\n    VTransformFilter.SetInputConnection(letterV.GetOutputPort());\n    VTransformFilter.SetTransform (VTransform);\n\n    vtkTransform TTransform = new vtkTransform();\n    vtkTransformPolyDataFilter TTransformFilter = new vtkTransformPolyDataFilter();\n    TTransformFilter.SetInputConnection (letterT.GetOutputPort());\n    TTransformFilter.SetTransform (TTransform);\n\n    vtkTransform KTransform = new vtkTransform();\n    vtkTransformPolyDataFilter KTransformFilter = new vtkTransformPolyDataFilter();\n    KTransformFilter.SetInputConnection(letterK.GetOutputPort());\n    KTransformFilter.SetTransform (KTransform);\n\n    //now append them all\n    vtkAppendPolyData appendAll = new vtkAppendPolyData();\n    appendAll.AddInputConnection (VTransformFilter.GetOutputPort());\n    appendAll.AddInputConnection (TTransformFilter.GetOutputPort());\n    appendAll.AddInputConnection (KTransformFilter.GetOutputPort());\n\n    //create normals\n    vtkPolyDataNormals logoNormals = new vtkPolyDataNormals();\n    logoNormals.SetInputConnection (appendAll.GetOutputPort());\n    logoNormals.SetFeatureAngle (60);\n\n    //map to rendering primitives\n    vtkPolyDataMapper logoMapper = new vtkPolyDataMapper();\n    logoMapper.SetInputConnection (logoNormals.GetOutputPort());\n\n    //now an actor\n    vtkActor logo = new vtkActor();\n    logo.SetMapper (logoMapper);\n\n    //now create an implicit model of the same letter\n    vtkImplicitModeller blobbyLogoImp = new vtkImplicitModeller();\n    blobbyLogoImp.SetInputConnection(appendAll.GetOutputPort());\n    blobbyLogoImp.SetMaximumDistance (.075);\n    blobbyLogoImp.SetSampleDimensions (64,64,64); \n    blobbyLogoImp.SetAdjustDistance (0.05);\n\n    //extract an iso surface\n    vtkContourFilter blobbyLogoIso = new vtkContourFilter();\n    blobbyLogoIso.SetInputConnection(blobbyLogoImp.GetOutputPort());\n    blobbyLogoIso.SetValue (1, 1.5);\n\n    //map to rendering primitives\n    vtkPolyDataMapper blobbyLogoMapper = new vtkPolyDataMapper();\n    blobbyLogoMapper.SetInputConnection(blobbyLogoIso.GetOutputPort());\n    blobbyLogoMapper.ScalarVisibilityOff ();\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    double tomatoColor[] = new double[4];\n    double bananaColor[] = new double[4];\n    double BgColor[] = new double[4];\n\n    Color.GetColor(\"tomato\",tomatoColor);\n    Color.GetColor(\"banana\",bananaColor);\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    vtkProperty tomato = new vtkProperty();\n    tomato.SetDiffuseColor(tomatoColor);\n    tomato.SetSpecular(.3);\n    tomato.SetSpecularPower(20);\n\n    vtkProperty banana = new vtkProperty();\n    banana.SetDiffuseColor(bananaColor);\n    banana.SetDiffuse (.7);\n    banana.SetSpecular(.4);\n    banana.SetSpecularPower(20);\n\n    //An actor\n    vtkActor blobbyLogo = new vtkActor();\n    blobbyLogo.SetMapper (blobbyLogoMapper);\n    blobbyLogo.SetProperty (banana);\n\n    // position the letters\n\n    VTransform.Translate (-16.0,0.0,12.5);\n    VTransform.RotateY (40);\n\n    KTransform.Translate (14.0, 0.0, 0.0);\n    KTransform.RotateY (-40);\n\n    // move the polygonal letters to the front\n    logo.SetProperty (tomato);\n    logo.SetPosition(0,0,6);\n\n    aRenderer.AddActor(logo);\n    aRenderer.AddActor(blobbyLogo);\n\n    aRenderer.SetBackground(BgColor);\n\n    aRenderWindow.Render();\n\n    // interact with data\n    anInteractor.Start();\n\n  }\n}\n
        "},{"location":"Java/Visualization/Camera/","title":"Camera","text":"

        vtk-examples/Java/Visualization/Camera

        "},{"location":"Java/Visualization/Camera/#description","title":"Description","text":"

        vtkCamera object is a virtual camera for 3D rendering.

        It provides methods to position and orient the view point and focal point. Convenience methods for moving about the focal point also are provided.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/Camera/#code","title":"Code","text":"

        Camera.java

        import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkCamera;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class Camera \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------  \n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DeepSkyBlue\", actorColor);\n    colors.GetColor(\"Coral\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0, 0, 0);\n    Sphere.SetRadius(1.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    //Setting up Camera\n    vtkCamera Camera = new vtkCamera();\n    Camera.SetPosition(0, 0, 20);\n    Camera.SetFocalPoint(0, 0, 0);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    ren.SetActiveCamera(Camera);\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the Actor\n    ren.AddActor(Actor);\n    //Setting up the Renderer Background Color.\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/CameraActor/","title":"CameraActor","text":"

        vtk-examples/Java/Visualization/CameraActor

        "},{"location":"Java/Visualization/CameraActor/#description","title":"Description","text":"

        vtkCameraActor object is an actor used to represent a camera by its wireframe frustum.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/CameraActor/#code","title":"Code","text":"

        CameraActor.java

        import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkCamera;\nimport vtk.vtkCameraActor;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class CameraActor\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------  \n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //For Camera Actor Color\n    double CamActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DeepSkyBlue\", actorColor);\n    colors.GetColor(\"Black\", CamActorColor);\n    colors.GetColor(\"Coral\", Bgcolor);\n\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetRadius(4);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    //Setting up Camera\n    vtkCamera Camera = new vtkCamera();\n\n    //Camera Actor\n    vtkCameraActor CameraActor = new vtkCameraActor();\n    CameraActor.SetCamera(Camera);\n    CameraActor.GetProperty().SetColor(CamActorColor);\n    double bounds[] = new double[6];\n    CameraActor.GetBounds(bounds);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the Camera Actor\n    ren.AddActor(Actor);\n    ren.ResetCamera();\n    Camera.DeepCopy(ren.GetActiveCamera());\n    ren.AddActor(CameraActor);\n\n    //Setting up Camera\n\n    //ren.GetActiveCamera().SetPosition(0, 0, 1);\n    //ren.GetActiveCamera().SetFocalPoint(0, 0, 0);\n    ren.GetActiveCamera().SetViewUp(1, 0, 0);\n    ren.GetActiveCamera().Azimuth(130);\n    ren.GetActiveCamera().Elevation(130);\n    //ren.GetActiveCamera().Zoom(1);\n\n    //Setting up the Renderer Background Color.\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/ColorActorEdges/","title":"ColorActorEdges","text":"

        vtk-examples/Java/Visualization/ColorActorEdges

        "},{"location":"Java/Visualization/ColorActorEdges/#description","title":"Description","text":"

        This example colors the edges of a actor.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/ColorActorEdges/#code","title":"Code","text":"

        ColorActorEdges.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\npublic class ColorActorEdges \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n\n    colors.GetColor(\"Red\", actorColor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(5.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    //  Flat shading\n    Actor.GetProperty().SetInterpolationToFlat();\n\n    // Set the color for edges of the sphere\n    Actor.GetProperty().SetEdgeColor(actorColor);\n    Actor.GetProperty().EdgeVisibilityOn();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(Actor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/ColorAnActor/","title":"ColorAnActor","text":"

        vtk-examples/Java/Visualization/ColorAnActor

        "},{"location":"Java/Visualization/ColorAnActor/#description","title":"Description","text":"

        This example creates a red sphere.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/ColorAnActor/#code","title":"Code","text":"

        ColorAnActor.java

        import vtk.*;\n\npublic class ColorAnActor {\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args)\n  {\n    //Create a sphere\n    vtkSphereSource sphereSource = \n      new vtkSphereSource();\n    sphereSource.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = \n      new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Set the color of the sphere\n    actor.GetProperty().SetColor(1.0, 0.0, 0.0); //(R,G,B)\n\n    //Create a renderer, render window, and interactor\n    vtkRenderer renderer = \n      new vtkRenderer();\n    vtkRenderWindow renderWindow = \n      new vtkRenderWindow();\n    renderWindow.AddRenderer(renderer);\n    vtkRenderWindowInteractor renderWindowInteractor = \n      new vtkRenderWindowInteractor();\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n\n    //Add the actor to the scene\n    renderer.AddActor(actor);\n    renderer.SetBackground(1,1,1); // Background color white\n\n    //Render and interact\n    renderWindow.Render();\n    renderWindowInteractor.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/ComplexV/","title":"ComplexV","text":"

        vtk-examples/Java/Visualization/ComplexV

        "},{"location":"Java/Visualization/ComplexV/#description","title":"Description","text":"

        ComplexV from the VTK Textbook. The original example was written in TCL.

        The example shows 167,000 3D vectors (using oriented and scaled lines) in the region of the human carotid artery.

        The larger vectors lie inside the arteries, the smaller vectors lie outside the arteries and are randomly oriented (measurement error) but small in magnitude. Clearly the details of the vector field are not discernible from this image.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/ComplexV/#code","title":"Code","text":"

        ComplexV.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkStructuredPointsReader;\nimport vtk.vtkHedgeHog;\nimport vtk.vtkLookupTable;\nimport vtk.vtkOutlineFilter;\n\n\npublic class ComplexV \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtk) e.g carotid.vtk\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For outline Actor Color\n    double outlineactorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Black\", outlineactorColor);\n    colors.GetColor(\"Gray\", Bgcolor);\n\n    vtkStructuredPointsReader reader = new vtkStructuredPointsReader();\n    reader.SetFileName(inputFilename);\n\n    vtkHedgeHog hhog = new vtkHedgeHog();\n    hhog.SetInputConnection(reader.GetOutputPort());\n    hhog.SetScaleFactor(0.3);\n\n    vtkLookupTable lut = new vtkLookupTable();\n    // lut.SetHueRange(.667, 0.0);\n    lut.Build();\n\n    vtkPolyDataMapper hhogMapper = new vtkPolyDataMapper();\n    hhogMapper.SetInputConnection(hhog.GetOutputPort());\n    hhogMapper.SetScalarRange(50, 550);\n    hhogMapper.SetLookupTable(lut);\n\n    vtkActor hhogActor = new vtkActor();\n    hhogActor.SetMapper(hhogMapper);\n\n    vtkOutlineFilter outline = new vtkOutlineFilter();\n    outline.SetInputConnection(reader.GetOutputPort());\n\n    vtkPolyDataMapper outlineMapper = new vtkPolyDataMapper();\n    outlineMapper.SetInputConnection(outline.GetOutputPort());\n\n    vtkActor outlineActor = new vtkActor();\n    outlineActor.SetMapper(outlineMapper);\n    outlineActor.GetProperty().SetColor(outlineactorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(outlineActor);\n    ren.AddActor(hhogActor);\n\n    ren.SetBackground(Bgcolor);\n\n    ren.GetActiveCamera().SetFocalPoint(0,0,0);\n    ren.GetActiveCamera().SetPosition(1,0,0);\n    ren.GetActiveCamera().SetViewUp(0,0,1);\n    ren.ResetCamera();\n\n    ren.GetActiveCamera().Azimuth(60);\n    ren.GetActiveCamera().Elevation(30);\n    ren.GetActiveCamera().Dolly(1.1);\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/CornerAnnotation/","title":"CornerAnnotation","text":"

        vtk-examples/Java/Visualization/CornerAnnotation

        "},{"location":"Java/Visualization/CornerAnnotation/#description","title":"Description","text":"

        vtkCornerAnnotation is an annotation object that manages four text actors / mappers to provide annotation in the four corners of a viewport.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/CornerAnnotation/#code","title":"Code","text":"

        CornerAnnotation.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkCornerAnnotation;\n\npublic class CornerAnnotation \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Annotation Color\n    double AnnotationColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", AnnotationColor);\n    colors.GetColor(\"White\", Bgcolor);\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource.SetRadius(5.0 );\n    sphereSource.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputData (sphereSource.GetOutput());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper ( mapper );\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Annotate the image with window/level and mouse over pixel information\n    vtkCornerAnnotation cornerAnnotation = new vtkCornerAnnotation();\n    cornerAnnotation.SetLinearFontScaleFactor(2);\n    cornerAnnotation.SetNonlinearFontScaleFactor(1);\n    cornerAnnotation.SetMaximumFontSize(20);\n    cornerAnnotation.SetText(0, \"Lower left\");\n    cornerAnnotation.SetText(1, \"Lower right\");\n    cornerAnnotation.SetText(2, \"Upper left\");\n    cornerAnnotation.SetText(3, \"Upper right\");\n    cornerAnnotation.GetTextProperty().SetColor(AnnotationColor);\n\n    // Visualise\n    ren.AddViewProp( cornerAnnotation );\n    ren.AddActor( actor );\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/CubeAxesActor/","title":"CubeAxesActor","text":"

        vtk-examples/Java/Visualization/CubeAxesActor

        "},{"location":"Java/Visualization/CubeAxesActor/#description","title":"Description","text":"

        vtkCubeAxesActor object is a composite actor that draws axes of the bounding box of an input dataset.

        The axes include labels and titles for the x-y-z axes. The algorithm selects which axes to draw based on the user-defined 'fly' mode. (STATIC is default). 'STATIC' constructs axes from all edges of the bounding box. 'CLOSEST_TRIAD' consists of the three axes x-y-z forming a triad that lies closest to the specified camera. 'FURTHEST_TRIAD' consists of the three axes x-y-z forming a triad that lies furthest from the specified camera. 'OUTER_EDGES' is constructed from edges that are on the \"exterior\" of the bounding box, exterior as determined from examining outer edges of the bounding box in projection (display) space.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/CubeAxesActor/#code","title":"Code","text":"

        CubeAxesActor.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSuperquadricSource;\nimport vtk.vtkCubeAxesActor;\n\npublic class CubeAxesActor \n{\n  private static final int VTK_GRID_LINES_FURTHEST = 2;\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //For axis1 Color\n    double axis1Color[] = new double[4];\n    //For axis2 Color\n    double axis2Color[] = new double[4];\n    //For axis3 Color\n    double axis3Color[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", actorColor);\n    colors.GetColor(\"Salmon\", axis1Color);\n    colors.GetColor(\"PaleGreen\", axis2Color);\n    colors.GetColor(\"DodgerBlue\", axis3Color);\n    colors.GetColor(\"Indigo\", Bgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //  Create a superquadric\n    vtkSuperquadricSource superquadricSource = new vtkSuperquadricSource();\n    superquadricSource.SetPhiRoundness(3.1);\n    superquadricSource.SetThetaRoundness(1.0);\n    superquadricSource.Update(); // needed to GetBounds later\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(superquadricSource.GetOutputPort());\n\n    vtkActor superquadricActor = new vtkActor();\n    superquadricActor.SetMapper(mapper);\n    superquadricActor.GetProperty().SetDiffuseColor(actorColor);\n    superquadricActor.GetProperty().SetDiffuse(.7);\n    superquadricActor.GetProperty().SetSpecular(.7);\n    superquadricActor.GetProperty().SetSpecularPower(50.0);\n\n    vtkCubeAxesActor cubeAxesActor = new vtkCubeAxesActor();\n    cubeAxesActor.SetUseTextActor3D(1);\n    cubeAxesActor.SetBounds(superquadricSource.GetOutput().GetBounds());\n    cubeAxesActor.SetCamera(ren.GetActiveCamera());\n    cubeAxesActor.GetTitleTextProperty(0).SetColor(axis1Color);\n    cubeAxesActor.GetTitleTextProperty(0).SetFontSize(48);\n    cubeAxesActor.GetLabelTextProperty(0).SetColor(axis1Color);\n\n    cubeAxesActor.GetTitleTextProperty(1).SetColor(axis2Color);\n    cubeAxesActor.GetLabelTextProperty(1).SetColor(axis2Color);\n    cubeAxesActor.GetTitleTextProperty(2).SetColor(axis3Color);\n    cubeAxesActor.GetLabelTextProperty(2).SetColor(axis3Color);\n\n    cubeAxesActor.DrawXGridlinesOn();\n    cubeAxesActor.DrawYGridlinesOn();\n    cubeAxesActor.DrawZGridlinesOn();\n    cubeAxesActor.SetGridLineLocation(VTK_GRID_LINES_FURTHEST);\n\n    cubeAxesActor.XAxisMinorTickVisibilityOff();\n    cubeAxesActor.YAxisMinorTickVisibilityOff();\n    cubeAxesActor.ZAxisMinorTickVisibilityOff();\n\n    cubeAxesActor.SetFlyModeToStaticEdges();\n    ren.AddActor(cubeAxesActor);\n    ren.AddActor(superquadricActor);\n    ren.GetActiveCamera().Azimuth(30);\n    ren.GetActiveCamera().Elevation(30);\n\n    ren.ResetCamera();\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(1200, 900);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/CubeAxesActor2D/","title":"CubeAxesActor2D","text":"

        vtk-examples/Java/Visualization/CubeAxesActor2D

        "},{"location":"Java/Visualization/CubeAxesActor2D/#description","title":"Description","text":"

        vtkCubeAxesActor2D object draws axes on the bounding box of the data set and labels the axes with x-y-z coordinates.

        vtkPlatonicSolidSource object can generate each of the five Platonic solids: tetrahedron, cube, octahedron, icosahedron, and dodecahedron. Each of the solids is placed inside a sphere centered at the origin with radius 1.0.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/CubeAxesActor2D/#code","title":"Code","text":"

        CubeAxesActor2D.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPlatonicSolidSource;\nimport vtk.vtkPolyDataNormals;\nimport vtk.vtkTextProperty;\nimport vtk.vtkCubeAxesActor2D;\nimport vtk.vtkLODActor;\nimport vtk.vtkOutlineFilter;\n\n\npublic class CubeAxesActor2D \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For icosahedron_actor Color\n    double icosahedronActorColor[] = new double[4];\n    //For outline actor Color\n    double outlineActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Magenta\", icosahedronActorColor);\n    colors.GetColor(\"Black\", outlineActorColor);\n    colors.GetColor(\"DarkSlateBlue\", Bgcolor);\n\n    vtkPlatonicSolidSource icosahedron = new vtkPlatonicSolidSource();\n    icosahedron.SetSolidTypeToIcosahedron();\n\n    // Create a vtkPolyDataNormals filter to calculate the normals of the data set.\n    vtkPolyDataNormals normals = new vtkPolyDataNormals();\n    normals.SetInputConnection(icosahedron.GetOutputPort());\n\n    // Set up the associated mapper and actor.\n    vtkPolyDataMapper icosahedron_mapper = new vtkPolyDataMapper();\n    icosahedron_mapper.SetInputConnection(normals.GetOutputPort());\n    icosahedron_mapper.ScalarVisibilityOff();\n\n    vtkLODActor icosahedron_actor = new vtkLODActor();\n    icosahedron_actor.SetMapper(icosahedron_mapper);\n    icosahedron_actor.GetProperty().SetColor(icosahedronActorColor);\n\n    // Create a vtkOutlineFilter to draw the bounding box of the data set.\n    // Also create the associated mapper and actor.\n    vtkOutlineFilter outline = new vtkOutlineFilter();\n    outline.SetInputConnection(normals.GetOutputPort());\n\n    vtkPolyDataMapper map_outline = new vtkPolyDataMapper();\n    map_outline.SetInputConnection(outline.GetOutputPort());\n\n    vtkActor outline_actor = new vtkActor();\n    outline_actor.SetMapper(map_outline);\n    outline_actor.GetProperty().SetColor(outlineActorColor);\n\n    // Create the Renderers.  Assign them the appropriate viewport\n    // coordinates, active camera, and light.\n\n    vtkRenderer ren = new vtkRenderer();\n    ren.SetViewport(0.0, 0.0, 0.5, 1.0);\n\n    vtkRenderer ren2 = new vtkRenderer();\n    ren2.SetViewport(0.5, 0.0, 1.0, 1.0);;\n    ren2.SetActiveCamera(ren.GetActiveCamera());    \n\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.AddRenderer(ren2);\n    renWin.SetWindowName(\"VTK - Cube Axes\");\n    renWin.SetSize(600, 300);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddViewProp(icosahedron_actor);\n    ren.AddViewProp(outline_actor);\n    ren2.AddViewProp(icosahedron_actor);\n    ren2.AddViewProp(outline_actor);\n\n    ren.SetBackground(Bgcolor);\n    ren2.SetBackground(Bgcolor);\n\n    // Create a text property for both cube axes\n    vtkTextProperty tprop = new vtkTextProperty();\n    tprop.SetColor(1, 1, 1);\n    tprop.ShadowOn();\n    tprop.SetFontSize(20);\n\n    //  Create a vtkCubeAxesActor2D.  Use the outer edges of the bounding box to\n    // draw the axes.  Add the actor to the renderer.\n    vtkCubeAxesActor2D axes = new vtkCubeAxesActor2D();\n    axes.SetInputConnection(normals.GetOutputPort());\n    axes.SetCamera(ren.GetActiveCamera());\n    axes.SetLabelFormat(\"%6.4g\");\n    axes.SetFlyModeToOuterEdges();\n    axes.SetAxisTitleTextProperty(tprop);\n    axes.SetAxisLabelTextProperty(tprop);\n    ren.AddViewProp(axes);\n\n    //  Create a vtkCubeAxesActor2D.  Use the closest vertex to the camera to\n    // determine where to draw the axes.  Add the actor to the renderer.\n    vtkCubeAxesActor2D axes2 = new vtkCubeAxesActor2D();\n    axes2.SetViewProp(icosahedron_actor);\n    axes2.SetCamera(ren2.GetActiveCamera());\n    axes2.SetLabelFormat(\"%6.4g\");\n    axes2.SetFlyModeToClosestTriad();\n    axes2.ScalingOff();\n    axes2.SetAxisTitleTextProperty(tprop);\n    axes2.SetAxisLabelTextProperty(tprop);\n    ren2.AddViewProp(axes2);\n\n    ren.ResetCamera();\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/Cursor2D/","title":"Cursor2D","text":"

        vtk-examples/Java/Visualization/Cursor2D

        "},{"location":"Java/Visualization/Cursor2D/#description","title":"Description","text":"

        Example program to generate a 2D cursor representation.

        vtkCursor2D is a class that generates a 2D cursor representation. The cursor consists of two intersection axes lines that meet at the cursor focus.

        Several optional features are available as well. An optional 2D bounding box may be enabled.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/Cursor2D/#code","title":"Code","text":"

        Cursor2D.java

        import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkCursor2D;\n\npublic class Cursor2D\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                 \n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //For Cursor Actor Color\n    double CursorActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Crimson\", actorColor);\n    colors.GetColor(\"White\", CursorActorColor);\n    colors.GetColor(\"CadetBlue\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(5.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the Actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    //Setup 2D cursor representation\n    vtkCursor2D Cursor = new vtkCursor2D();\n    Cursor.SetModelBounds(-10, 10, -10, 10, 0, 0);\n    Cursor.AllOn();\n    Cursor.SetFocalPoint(5.0, 5.0, 5.0);\n    Cursor.OutlineOn();\n    Cursor.Update();\n\n    //Mapper for Cursor\n    vtkPolyDataMapper CursorMapper = new vtkPolyDataMapper();\n    CursorMapper.SetInputConnection(Cursor.GetOutputPort());\n\n    //Cursor Actor\n    vtkActor CursorActor = new vtkActor();\n    CursorActor.SetMapper(CursorMapper);\n    CursorActor.GetProperty().SetColor(CursorActorColor);\n    ren.AddActor(CursorActor);\n\n    ren.ResetCamera();\n    iren.Start();\n\n  }       \n}\n
        "},{"location":"Java/Visualization/Cursor3D/","title":"Cursor3D","text":"

        vtk-examples/Java/Visualization/Cursor3D

        "},{"location":"Java/Visualization/Cursor3D/#description","title":"Description","text":"

        vtkCursor3D is an object that generates 3D representation of a cursor.

        The cursor consists of a wireframe bounding box, three intersecting axes lines that meet at the cursor focus, and \"shadows\" or projections of the axes against the sides of the bounding box. Each of these components can be turned on/off.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/Cursor3D/#code","title":"Code","text":"

        Cursor3D.java

        import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\nimport vtk.vtkCursor3D;\n\npublic class Cursor3D\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                 \n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //For Cursor Actor Color\n    double CursorActorColor[] = new double[4];\n    //Renderer Background Color\n     double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"LightPink\", actorColor);\n    colors.GetColor(\"Brown\", CursorActorColor);\n    colors.GetColor(\"MediumSpringGreen\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(5.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    vtkCursor3D Cursor = new vtkCursor3D();\n    Cursor.SetModelBounds(-10, 10, -10, 10, -10, 10);\n    Cursor.AllOn();\n    Cursor.OutlineOff();\n    Cursor.Update();\n\n    vtkPolyDataMapper CursorMapper = new vtkPolyDataMapper();\n    CursorMapper.SetInputConnection(Cursor.GetOutputPort());\n    vtkActor CursorActor = new vtkActor();\n    CursorActor.SetMapper(CursorMapper);\n    CursorActor.GetProperty().SetColor(CursorActorColor);\n    ren.AddActor(CursorActor);\n\n    ren.ResetCamera();\n    iren.Start();       \n  }       \n}\n
        "},{"location":"Java/Visualization/CursorShape/","title":"CursorShape","text":"

        vtk-examples/Java/Visualization/CursorShape

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/CursorShape/#code","title":"Code","text":"

        CursorShape.java

        import java.awt.Cursor;\nimport vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\n\npublic class CursorShape\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                 \n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n\n    //For Cursor Actor Color\n    double CursorActorColor[] = new double[4];\n\n   //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"LightPink\", actorColor);\n    colors.GetColor(\"Brown\", CursorActorColor);\n    colors.GetColor(\"MediumSpringGreen\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize the actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.Render();\n    //This must occur after the above Render() call or it does not work \n    renWin.SetCurrentCursor(Cursor.HAND_CURSOR);\n\n    ren.ResetCamera();\n    iren.Start();   \n  }       \n}\n
        "},{"location":"Java/Visualization/DisplayCoordinateAxes/","title":"DisplayCoordinateAxes","text":"

        vtk-examples/Java/Visualization/DisplayCoordinateAxes

        "},{"location":"Java/Visualization/DisplayCoordinateAxes/#description","title":"Description","text":"

        This example shows how to display the coordinate axes in the render window.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/DisplayCoordinateAxes/#code","title":"Code","text":"

        DisplayCoordinateAxes.java

        import vtk.vtkActor;\nimport vtk.vtkAxesActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkOrientationMarkerWidget;\nimport vtk.vtkSphereSource;\n\npublic class DisplayCoordinateAxes\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    //Sphere1\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource.SetRadius(1.0);\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper  = new vtkPolyDataMapper();\n    sphereMapper.SetInputData (sphereSource.GetOutput());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetWindowName(\"Display Coordinate Axes\");\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(sphereActor);\n    ren.SetBackground(Bgcolor);\n\n    vtkAxesActor axes = new vtkAxesActor();\n\n    vtkOrientationMarkerWidget widget = new vtkOrientationMarkerWidget();\n    double rgba[] = new double[] {0.0, 0.0, 0.0, 0.0};\n    colors.GetColor(\"Carrot\",rgba);\n    widget.SetOutlineColor(rgba[0], rgba[1], rgba[2]);\n    widget.SetOrientationMarker(axes);\n    widget.SetInteractor(iren);\n    widget.SetViewport( 0.0, 0.0, 0.4, 0.4 );\n    widget.SetEnabled(1);\n    widget.InteractiveOn();\n\n    ren.GetActiveCamera().Azimuth(50);\n    ren.GetActiveCamera().Elevation(-30);\n    ren.ResetCamera();\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/DistanceToCamera/","title":"DistanceToCamera","text":"

        vtk-examples/Java/Visualization/DistanceToCamera

        "},{"location":"Java/Visualization/DistanceToCamera/#description","title":"Description","text":"

        This example produces two arrows whose scale stays fixed with respect to the distance from the camera (i.e. as you zoom in and out). Standard spheres are drawn for comparison.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/DistanceToCamera/#code","title":"Code","text":"

        DistanceToCamera.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPointSource;\nimport vtk.vtkDistanceToCamera;\nimport vtk.vtkArrowSource;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkInteractorStyleTrackballCamera;\nimport vtk.vtkSphereSource;\n\npublic class DistanceToCamera \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For fixedActor Color\n    double fixedActorColor[] = new double[4];\n    //For sphereActor Color\n    double sphereActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Aqua\", fixedActorColor);\n    colors.GetColor(\"Yellow\",sphereActorColor);\n    colors.GetColor(\"White\", Bgcolor);\n\n    // Draw some arrows that maintain a fixed size during zooming.\n    // Create a set of points.\n    vtkPointSource fixedPointSource = new vtkPointSource();\n    fixedPointSource.SetNumberOfPoints(2);\n\n    // Calculate the distance to the camera of each point.\n    vtkDistanceToCamera distanceToCamera = new vtkDistanceToCamera();\n    distanceToCamera.SetInputConnection(fixedPointSource.GetOutputPort());\n    distanceToCamera.SetScreenSize(100.0);\n\n    // Glyph each point with an arrow.\n    vtkArrowSource arrow = new vtkArrowSource();\n    vtkGlyph3D fixedGlyph = new vtkGlyph3D();\n    fixedGlyph.SetInputConnection(distanceToCamera.GetOutputPort());\n    fixedGlyph.SetSourceConnection(arrow.GetOutputPort());\n\n    // Scale each point.\n    fixedGlyph.SetScaleModeToScaleByScalar();\n    fixedGlyph.SetInputArrayToProcess(0, 0, 0, 0, \"DistanceToCamera\");\n\n    // Create a mapper.\n    vtkPolyDataMapper fixedMapper = new vtkPolyDataMapper();\n    fixedMapper.SetInputConnection(fixedGlyph.GetOutputPort());\n    fixedMapper.SetScalarVisibility(0);\n\n    // Create an actor.\n    vtkActor fixedActor = new vtkActor();\n    fixedActor.SetMapper(fixedMapper);\n    fixedActor.GetProperty().SetColor(fixedActorColor);\n\n    // Draw some spheres that get bigger when zooming in.\n    // Create a set of points.\n    vtkPointSource pointSource = new vtkPointSource();\n    pointSource.SetNumberOfPoints(4);\n\n    // Glyph each point with a sphere.\n    vtkSphereSource sphere = new vtkSphereSource();\n    vtkGlyph3D glyph = new vtkGlyph3D();\n    glyph.SetInputConnection(pointSource.GetOutputPort());\n    glyph.SetSourceConnection(sphere.GetOutputPort());\n    glyph.SetScaleFactor(0.1);\n\n    // Create a mapper.\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(glyph.GetOutputPort());\n    mapper.SetScalarVisibility(0);\n\n    // Create an actor.\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(sphereActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    ren.SetBackground(Bgcolor);\n\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n\n    // Give DistanceToCamera a pointer to the renderer.\n    distanceToCamera.SetRenderer(ren);\n\n    // Visualize\n    ren.AddActor(fixedActor);\n    ren.AddActor(actor);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n    iren.SetRenderWindow(renWin);\n\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/DrawText/","title":"DrawText","text":"

        vtk-examples/Java/Visualization/DrawText

        "},{"location":"Java/Visualization/DrawText/#description","title":"Description","text":"

        This example writes \"Hello world\" in the bottom left corner of the render window. The text size and color are set. There are many properties that can be set that control how the text is changed when the render window is resized, but they are not covered in this example.

        This example draws text in 2D. For an example using 3D text that can be placed on the scene like a regular vtkActor, see VectorText.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/DrawText/#code","title":"Code","text":"

        DrawText.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkTextActor;\n\npublic class DrawText \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For textActor Color\n    double textactorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", textactorColor);\n    colors.GetColor(\"White\", Bgcolor);\n\n    // Create a sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource.SetRadius(5.0 );\n    sphereSource.Update();\n\n    // Create a mapper\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputData (sphereSource.GetOutput());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper ( mapper );\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Setup the text and add it to the renderer\n    vtkTextActor textActor = new vtkTextActor();\n    textActor.SetInput(\"Hello world\");\n    textActor.SetPosition2(10, 40);\n    textActor.GetTextProperty().SetFontSize (24);\n    textActor.GetTextProperty().SetColor (textactorColor);\n    ren.AddActor2D(textActor);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/Follower/","title":"Follower","text":"

        vtk-examples/Java/Visualization/Follower

        "},{"location":"Java/Visualization/Follower/#description","title":"Description","text":"

        The text stays right side up and facing the camera, while the cube does not.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/Follower/#code","title":"Code","text":"

        Follower.java

        import vtk.*;\n\npublic class Follower\n{\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args)\n  {\n    //Create some text\n    vtkVectorText textSource = new vtkVectorText();\n    textSource.SetText( \"Hello\" );\n\n    //Create a mapper\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection( textSource.GetOutputPort() );\n\n    //Create a subclass of vtkActor: a vtkFollower that remains facing the camera\n    vtkFollower follower = new vtkFollower();\n    follower.SetMapper( mapper );\n    follower.GetProperty().SetColor( 1, 0, 0 ); // red \n\n    //Create a transparent cube that does not move around to face the camera\n    vtkCubeSource cubeSource = new vtkCubeSource();\n    vtkPolyDataMapper cubeMapper = new vtkPolyDataMapper();\n    cubeMapper.SetInputConnection( cubeSource.GetOutputPort() );\n    vtkActor cubeActor = new vtkActor();\n    cubeActor.SetMapper( cubeMapper );\n    cubeActor.GetProperty().SetColor( 0, 0, 1 ); // blue\n    cubeActor.GetProperty().SetOpacity( 0.3 );\n\n    //Create a renderer, render window, and interactor\n    vtkRenderer renderer = new vtkRenderer();\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.AddRenderer( renderer );\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n    ((vtkInteractorStyle)renderWindowInteractor.GetInteractorStyle()).AutoAdjustCameraClippingRangeOn();\n    renderWindowInteractor.SetRenderWindow( renderWindow );\n\n    //Add the actor to the scene\n    renderer.AddActor( follower );\n    renderer.AddActor( cubeActor );\n    renderer.SetBackground( 1, 1, 1 ); // Background color white\n    follower.SetCamera( renderer.GetActiveCamera() );\n\n    //Render and interact\n    renderWindow.Render();\n    renderer.ResetCamera();\n    renderWindow.Render();\n    renderWindowInteractor.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/ImageOrientation/","title":"ImageOrientation","text":"

        vtk-examples/Java/Visualization/ImageOrientation

        "},{"location":"Java/Visualization/ImageOrientation/#description","title":"Description","text":"

        vtkImagePermute object reorders the axes of the input. Filtered axes specify the input axes which become X, Y, Z. The input has to have the same scalar type of the output. The filter does copy the data when it executes.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/ImageOrientation/#code","title":"Code","text":"

        ImageOrientation.java

        import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkImageEllipsoidSource;\nimport vtk.vtkImagePermute;\nimport vtk.vtkImageActor;\nimport vtk.vtkInteractorStyleImage;\n\n\npublic class ImageOrientation \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For originalViewport Color\n    double originalViewportColor[] = new double[4];\n    //For permutedViewport Color\n    double permutedViewportColor[] = new double[4];\n\n    colors.GetColor(\"SlateGray\", originalViewportColor);\n    colors.GetColor(\"LightSteelBlue\",permutedViewportColor);\n\n    // Create an image\n    vtkImageEllipsoidSource source = new vtkImageEllipsoidSource();\n    source.SetWholeExtent(0, 20, 0, 20, 0, 0);\n    source.SetCenter(10,10,0);\n    source.SetRadius(2,5,0);\n    source.Update();\n\n    vtkImagePermute permuteFilter = new vtkImagePermute();\n    permuteFilter.SetInputConnection(source.GetOutputPort());\n    permuteFilter.SetFilteredAxes(1,0,2);\n    permuteFilter.Update();\n\n    // Create actors\n    vtkImageActor originalActor = new vtkImageActor();\n    originalActor.GetMapper().SetInputConnection(source.GetOutputPort());\n\n    vtkImageActor permutedActor = new vtkImageActor();\n    permutedActor.GetMapper().SetInputConnection(permuteFilter.GetOutputPort());\n\n    // Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double originalViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};\n    double permutedViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n    // Setup renderers\n    vtkRenderer originalRenderer = new vtkRenderer();\n    originalRenderer.SetViewport(originalViewport);\n    originalRenderer.AddActor(originalActor);\n    originalRenderer.ResetCamera();\n    originalRenderer.SetBackground(originalViewportColor);\n\n    vtkRenderer permutedRenderer = new vtkRenderer();\n    permutedRenderer.SetViewport(permutedViewport);\n    permutedRenderer.AddActor(permutedActor);\n    permutedRenderer.ResetCamera();\n    permutedRenderer.SetBackground(permutedViewportColor);\n\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n    renderWindow.SetSize(600, 300);\n    renderWindow.AddRenderer(originalRenderer);\n    renderWindow.AddRenderer(permutedRenderer);\n\n    vtkRenderWindowInteractor renderWindowInteractor = new vtkRenderWindowInteractor();\n\n    vtkInteractorStyleImage style =new vtkInteractorStyleImage();\n\n    renderWindowInteractor.SetInteractorStyle(style);\n\n    renderWindowInteractor.SetRenderWindow(renderWindow);\n    renderWindow.Render();\n    renderWindowInteractor.Initialize();\n\n    renderWindowInteractor.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/Legend/","title":"Legend","text":"

        vtk-examples/Java/Visualization/Legend

        "},{"location":"Java/Visualization/Legend/#description","title":"Description","text":"

        vtkLegendBoxActor object is used to associate a symbol with a text string.

        The user specifies a vtkPolyData to use as the symbol, and a string associated with the symbol. The actor can then be placed in the scene in the same way that any other vtkActor2D can be used.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/Legend/#code","title":"Code","text":"

        Legend.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkLegendBoxActor;\nimport vtk.vtkCubeSource;\nimport vtk.vtkPolyData;\n\n\npublic class Legend \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For boxLegendColor\n    double boxLegendColor[] = new double[4];\n    //For ballLegendColor\n    double ballLegendColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n    //Renderer legend Background Color\n    double legendBgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", boxLegendColor);\n    colors.GetColor(\"banana\", ballLegendColor);\n    colors.GetColor(\"cyan\", Bgcolor);\n    colors.GetColor(\"warm_grey\", legendBgcolor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0);\n    sphereSource.SetRadius(5000.0);\n    sphereSource.Update();\n\n    vtkPolyData polydata = sphereSource.GetOutput();\n\n    // Create a mapper\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputData(polydata);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    vtkLegendBoxActor legend = new vtkLegendBoxActor();\n    legend.SetNumberOfEntries(2);\n\n    vtkCubeSource legendBox = new vtkCubeSource();\n    legendBox.Update();\n    legend.SetEntry(0, legendBox.GetOutput(), \"Box\", boxLegendColor);\n    legend.SetEntry(1, sphereSource.GetOutput(), \"Ball\", ballLegendColor);\n\n    // place legend in lower right\n    legend.GetPositionCoordinate().SetCoordinateSystemToView();\n    legend.GetPositionCoordinate().SetValue(.5, -1.0);\n\n    legend.GetPosition2Coordinate().SetCoordinateSystemToView();\n    legend.GetPosition2Coordinate().SetValue(1.0, -0.5);\n\n    legend.UseBackgroundOn();\n    legend.SetBackgroundColor(legendBgcolor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n    ren.AddActor(legend);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/LegendScaleActor/","title":"LegendScaleActor","text":"

        vtk-examples/Java/Visualization/LegendScaleActor

        "},{"location":"Java/Visualization/LegendScaleActor/#description","title":"Description","text":"

        vtkLegendScaleActor object is used to annotate the render window. Its basic goal is to provide an indication of the scale of the scene. Four axes surrounding the render window indicate (in a variety of ways) the scale of what the camera is viewing. An option also exists for displaying a scale legend.

        The axes can be programmed either to display distance scales or x-y coordinate values. By default, the scales display a distance. However, if you know that the view is down the z-axis, the scales can be programmed to display x-y coordinate values.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/LegendScaleActor/#code","title":"Code","text":"

        LegendScaleActor.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkLegendScaleActor;\n\npublic class LegendScaleActor \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DarkSlateBlue\", Bgcolor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    vtkPolyDataMapper sphereMapper  = new vtkPolyDataMapper();\n    sphereMapper .SetInputData (sphereSource.GetOutput());\n\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkLegendScaleActor legendScaleActor = new vtkLegendScaleActor();\n\n    // Visualize\n    ren.AddActor(sphereActor);\n    ren.AddActor(legendScaleActor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/LineWidth/","title":"LineWidth","text":"

        vtk-examples/Java/Visualization/LineWidth

        "},{"location":"Java/Visualization/LineWidth/#description","title":"Description","text":"

        vtkLineSource is a source object that creates a polyline defined by two endpoints. The number of segments composing the polyline is controlled by setting the object resolution.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/LineWidth/#code","title":"Code","text":"

        LineWidth.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkLineSource;\n\npublic class LineWidth \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkLineSource lineSource = new vtkLineSource();\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(lineSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetLineWidth(5);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/LoopShrink/","title":"LoopShrink","text":"

        vtk-examples/Java/Visualization/LoopShrink

        "},{"location":"Java/Visualization/LoopShrink/#description","title":"Description","text":"

        vtkShrinkFilter object shrinks cells composing an arbitrary data set towards their centroid.

        The centroid of a cell is computed as the average position of the cell points. Shrinking results in disconnecting the cells from one another. The output of this filter is of general dataset type vtkUnstructuredGrid.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/LoopShrink/#code","title":"Code","text":"

        LoopShrink.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkShrinkFilter;\nimport vtk.vtkElevationFilter;\n\n\npublic class LoopShrink \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetThetaResolution(12); sphere.SetPhiResolution(12);\n\n    vtkShrinkFilter shrink = new vtkShrinkFilter();\n    shrink.SetInputConnection(sphere.GetOutputPort());\n    shrink.SetShrinkFactor(0.9);\n\n    vtkElevationFilter colorIt = new vtkElevationFilter();\n    colorIt.SetInputConnection(shrink.GetOutputPort());\n    colorIt.SetLowPoint(0,0,-.5);\n    colorIt.SetHighPoint(0,0,.5);\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(colorIt.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/MoveActor/","title":"MoveActor","text":"

        vtk-examples/Java/Visualization/MoveActor

        "},{"location":"Java/Visualization/MoveActor/#description","title":"Description","text":"

        This example creates two spheres. They can be moved/scaled/rotated independent of each other using the mouse.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/MoveActor/#code","title":"Code","text":"

        MoveActor.java

        import vtk.vtkActor;\nimport vtk.vtkInteractorStyleTrackballActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\npublic class MoveActor\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    //Sphere1\n    vtkSphereSource sphereSource1 = new vtkSphereSource();\n    sphereSource1.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource1.SetRadius(4.0);\n    sphereSource1.Update();\n\n    vtkPolyDataMapper sphereMapper1  = new vtkPolyDataMapper();\n    sphereMapper1 .SetInputData (sphereSource1.GetOutput());\n\n    vtkActor sphereActor1 = new vtkActor();\n    sphereActor1.SetMapper(sphereMapper1);\n\n    //Sphere2\n    vtkSphereSource sphereSource2 = new vtkSphereSource();\n    sphereSource2.SetCenter(10.0, 0.0, 0.0 );\n    sphereSource2.SetRadius(3.0);\n    sphereSource2.Update();\n\n    vtkPolyDataMapper sphereMapper2  = new vtkPolyDataMapper();\n    sphereMapper2 .SetInputData (sphereSource2.GetOutput());\n\n    vtkActor sphereActor2 = new vtkActor();\n    sphereActor2.SetMapper(sphereMapper2);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor1);\n    ren.AddActor(sphereActor2);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    vtkInteractorStyleTrackballActor style = new vtkInteractorStyleTrackballActor();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/MoveCamera/","title":"MoveCamera","text":"

        vtk-examples/Java/Visualization/MoveCamera

        "},{"location":"Java/Visualization/MoveCamera/#description","title":"Description","text":"

        This example creates two spheres. They will move together when the mouse is used to interact with the scene because the camera is actually what is moving causing the view of the spheres to change.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/MoveCamera/#code","title":"Code","text":"

        MoveCamera.java

        import vtk.vtkActor;\nimport vtk.vtkInteractorStyleTrackballCamera;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\npublic class MoveCamera\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    //Sphere1\n    vtkSphereSource sphereSource1 = new vtkSphereSource();\n    sphereSource1.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource1.SetRadius(4.0);\n    sphereSource1.Update();\n\n    vtkPolyDataMapper sphereMapper1  = new vtkPolyDataMapper();\n    sphereMapper1 .SetInputData (sphereSource1.GetOutput());\n\n    vtkActor sphereActor1 = new vtkActor();\n    sphereActor1.SetMapper(sphereMapper1);\n\n    //Sphere2\n    vtkSphereSource sphereSource2 = new vtkSphereSource();\n    sphereSource2.SetCenter(10.0, 0.0, 0.0 );\n    sphereSource2.SetRadius(3.0);\n    sphereSource2.Update();\n\n    vtkPolyDataMapper sphereMapper2  = new vtkPolyDataMapper();\n    sphereMapper2 .SetInputData (sphereSource2.GetOutput());\n\n    vtkActor sphereActor2 = new vtkActor();\n    sphereActor2.SetMapper(sphereMapper2);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor1);\n    ren.AddActor(sphereActor2);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/MultipleActors/","title":"MultipleActors","text":"

        vtk-examples/Java/Visualization/MultipleActors

        "},{"location":"Java/Visualization/MultipleActors/#description","title":"Description","text":"

        This example creates two spheres and renders them. The idea is to show that each object needs its own mapper and actor and then multiple actors can be added to a renderer.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/MultipleActors/#code","title":"Code","text":"

        MultipleActors.java

        import vtk.vtkActor;\nimport vtk.vtkInteractorStyleTrackballCamera;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\npublic class MultipleActors\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n\n    //Sphere1\n    vtkSphereSource sphereSource1 = new vtkSphereSource();\n    sphereSource1.SetCenter(0.0, 0.0, 0.0 );\n    sphereSource1.SetRadius(4.0);\n    sphereSource1.Update();\n\n    vtkPolyDataMapper sphereMapper1  = new vtkPolyDataMapper();\n    sphereMapper1 .SetInputData (sphereSource1.GetOutput());\n\n    vtkActor sphereActor1 = new vtkActor();\n    sphereActor1.SetMapper(sphereMapper1);\n\n    //Sphere2\n    vtkSphereSource sphereSource2 = new vtkSphereSource();\n    sphereSource2.SetCenter(10.0, 0.0, 0.0 );\n    sphereSource2.SetRadius(3.0);\n    sphereSource2.Update();\n\n    vtkPolyDataMapper sphereMapper2  = new vtkPolyDataMapper();\n    sphereMapper2 .SetInputData (sphereSource2.GetOutput());\n\n    vtkActor sphereActor2 = new vtkActor();\n    sphereActor2.SetMapper(sphereMapper2);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(sphereActor1);\n    ren.AddActor(sphereActor2);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(640, 480);\n    renWin.Render();\n\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle(style);\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/MultipleViewports/","title":"MultipleViewports","text":"

        vtk-examples/Java/Visualization/MultipleViewports

        "},{"location":"Java/Visualization/MultipleViewports/#description","title":"Description","text":"

        This example creates a window with 4 viewports.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/MultipleViewports/#code","title":"Code","text":"

        MultipleViewports.java

        import vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\n\npublic class MultipleViewports \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //  Define viewport ranges\n    double xmins[] = new double[] {0.0, 0.5, 0.0, 0.5};\n    double xmaxs[] = new double[] {0.5, 1.0, 0.5, 1.0};\n    double ymins[] = new double[] {0.0, 0.0, 0.5, 0.5};\n    double ymaxs[] = new double[] {0.5, 0.5, 1.0, 1.0};\n\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    for(int i = 0; i < 4; i++)\n    {\n     vtkRenderer ren = new vtkRenderer();\n     renWin.AddRenderer(ren);\n     ren.SetViewport(xmins[i],ymins[i],xmaxs[i],ymaxs[i]);\n\n     // Create a sphere\n     vtkSphereSource sphereSource = new vtkSphereSource();\n     sphereSource.SetCenter(0.0, 0.0, 0.0);\n     sphereSource.SetRadius(5);\n     sphereSource.Update();\n\n     // Create a mapper and actor\n     vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n     mapper.SetInputConnection(sphereSource.GetOutputPort());\n     vtkActor actor = new vtkActor();\n     actor.SetMapper(mapper);\n     ren.AddActor(actor);\n     ren.ResetCamera();\n\n     renWin.Render();\n     renWin.SetWindowName(\"Multiple ViewPorts\");\n    }    \n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/NoShading/","title":"NoShading","text":"

        vtk-examples/Java/Visualization/NoShading

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/NoShading/#code","title":"Code","text":"

        NoShading.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSphereSource;\n\npublic class NoShading\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Red\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"White\",BgColor);\n\n    vtkSphereSource sphereSource = new vtkSphereSource();  \n\n    // Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetColor(ActorColor); //red\n    actor.GetProperty().SetAmbient(1);\n    actor.GetProperty().SetDiffuse(0);\n    actor.GetProperty().SetSpecular(0);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor); // Background color white\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Visualization/Opacity/","title":"Opacity","text":"

        vtk-examples/Java/Visualization/Opacity

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/Opacity/#code","title":"Code","text":"

        Opacity.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkCubeSource;\nimport vtk.vtkSphereSource;\n\npublic class Opacity \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //Cube\n    vtkCubeSource cubeSource = new vtkCubeSource();\n    vtkPolyDataMapper cubeMapper = new vtkPolyDataMapper();\n    cubeMapper.SetInputConnection(cubeSource.GetOutputPort());\n\n    vtkActor cubeActor = new vtkActor();\n    cubeActor.GetProperty().SetOpacity(0.5);\n    cubeActor.SetMapper(cubeMapper);\n\n    //Sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor sphereActor =  new vtkActor();\n    sphereActor.GetProperty().SetColor(0.5,1,0.5);\n    sphereActor.GetProperty().SetOpacity(0.5);\n    sphereActor.SetMapper(sphereMapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(cubeActor);\n    ren.AddActor(sphereActor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Visualization/OrientedGlyphs/","title":"OrientedGlyphs","text":"

        vtk-examples/Java/Visualization/OrientedGlyphs

        "},{"location":"Java/Visualization/OrientedGlyphs/#description","title":"Description","text":"

        vtkGlyph3D object is a filter that copies a geometric representation (called a glyph) to every point in the input dataset.

        The glyph is defined with polygonal data from a source filter input and it may be oriented along the input vectors or normals, and it may be scaled according to scalar data or vector magnitude.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/OrientedGlyphs/#code","title":"Code","text":"

        OrientedGlyphs.java

        import vtk.vtkActor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkArrowSource;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkNamedColors;\n\npublic class OrientedGlyphs\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {                 \n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Teal\", actorColor);\n    colors.GetColor(\"Khaki\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyData Input = new vtkPolyData();\n    Input.ShallowCopy(Sphere.GetOutput());\n\n    vtkArrowSource ArrowSource = new vtkArrowSource();\n\n    vtkGlyph3D Glyph3D = new vtkGlyph3D();\n    Glyph3D.SetSourceConnection(ArrowSource.GetOutputPort());\n    Glyph3D.SetInputData(Input);\n    Glyph3D.SetScaleFactor(0.2);\n    Glyph3D.Update();\n\n    // Visualize\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Glyph3D.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.Render();\n    iren.Start();\n\n  }       \n}\n
        "},{"location":"Java/Visualization/ProjectSphere/","title":"ProjectSphere","text":"

        vtk-examples/Java/Visualization/ProjectSphere

        "},{"location":"Java/Visualization/ProjectSphere/#description","title":"Description","text":"

        vtkProjectSphereFilter object is a filter to 'unroll' a sphere. The unroll longitude is -180.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/ProjectSphere/#code","title":"Code","text":"

        ProjectSphere.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkProjectSphereFilter;\nimport vtk.vtkElevationFilter;\nimport vtk.vtkParametricSuperEllipsoid;\nimport vtk.vtkParametricFunctionSource;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\n\npublic class ProjectSphere\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double leftRenderercolor[] = new double[4];\n    double rightRenderercolor[] = new double[4];\n\n    colors.GetColor(\"Tan\", leftRenderercolor);\n    colors.GetColor(\"LightSlateGray\", rightRenderercolor);\n\n    vtkParametricSuperEllipsoid surface = new vtkParametricSuperEllipsoid();\n    surface.SetN1(2.0);\n    surface.SetN2(0.5);\n\n    vtkParametricFunctionSource source = new vtkParametricFunctionSource();\n    source.SetParametricFunction(surface);\n\n    vtkElevationFilter elevationFilter = new vtkElevationFilter();\n    elevationFilter.SetInputConnection(source.GetOutputPort());\n    elevationFilter.SetLowPoint(0.0, 0.0, -4.0);\n    elevationFilter.SetHighPoint(0.0, 0.0, 4.0);\n    elevationFilter.Update();\n\n    // Deep copy the point data since in some versions of VTK, the ProjectSphereFilter modifies the input point data \n    vtkPolyData pd1 = new vtkPolyData();\n    pd1.DeepCopy(elevationFilter.GetOutput());\n\n    vtkProjectSphereFilter sphereProject1 = new vtkProjectSphereFilter();\n    sphereProject1.SetInputConnection(elevationFilter.GetOutputPort());\n    sphereProject1.Update();\n\n    vtkPolyDataMapper mapper1 = new vtkPolyDataMapper();\n    mapper1.SetInputConnection(sphereProject1.GetOutputPort());\n    mapper1.SetScalarRange(sphereProject1.GetOutput().GetPointData().GetScalars().GetRange());\n\n    vtkActor actor1 = new vtkActor();\n    actor1.SetMapper(mapper1);\n\n    vtkPolyDataMapper mapper2 = new vtkPolyDataMapper();\n    mapper2.SetInputData(pd1);\n    mapper2.SetScalarRange(pd1.GetPointData().GetScalars().GetRange());  \n\n    vtkActor actor2 = new vtkActor();\n    actor2.SetMapper(mapper2);\n\n    // A render window\n    vtkRenderWindow renderWindow = new vtkRenderWindow();\n\n    // Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double leftViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};\n    double rightViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n    // Setup both renderers\n    vtkRenderer leftRenderer = new vtkRenderer();\n    renderWindow.AddRenderer(leftRenderer);\n    leftRenderer.SetViewport(leftViewport);\n    leftRenderer.SetBackground(.6, .5, .4);\n\n    vtkRenderer rightRenderer = new vtkRenderer();\n    renderWindow.AddRenderer(rightRenderer);\n    rightRenderer.SetViewport(rightViewport);\n    rightRenderer.SetBackground(.4, .5, .6);\n\n    leftRenderer.AddActor(actor2);\n    rightRenderer.AddActor(actor1);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renderWindow);\n\n    leftRenderer.GetActiveCamera().Azimuth(30);\n    leftRenderer.GetActiveCamera().Elevation(-30);\n    leftRenderer.ResetCamera();\n\n    renderWindow.SetSize(640, 480);\n    renderWindow.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/ProteinRibbons/","title":"ProteinRibbons","text":"

        vtk-examples/Java/Visualization/ProteinRibbons

        "},{"location":"Java/Visualization/ProteinRibbons/#description","title":"Description","text":"

        vtkProteinRibbonFilter object is a polydata algorithm that generates protein ribbons.

        vtkPDBReader is a source object that reads Molecule files.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/ProteinRibbons/#code","title":"Code","text":"

        ProteinRibbons.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkProteinRibbonFilter;\nimport vtk.vtkPDBReader;\nimport vtk.vtkInteractorStyleSwitch;\nimport vtk.vtkPolyDataMapper;\n\npublic class ProteinRibbons\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.pdb) e.g 2j6g.pdb\");\n      return;\n    }\n    String Filename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Silver\", Bgcolor);\n\n    // read protein from pdb\n    vtkPDBReader reader = new vtkPDBReader();\n    reader.SetFileName(Filename);\n\n    // setup ribbon filter\n    vtkProteinRibbonFilter ribbonFilter = new vtkProteinRibbonFilter();\n    ribbonFilter.SetInputConnection(reader.GetOutputPort());\n\n    // setup poly data mapper\n    vtkPolyDataMapper polyDataMapper = new vtkPolyDataMapper();\n    polyDataMapper.SetInputConnection(ribbonFilter.GetOutputPort());\n\n    // setup actor\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(polyDataMapper);\n    actor.GetProperty().SetDiffuse(.7);\n    actor.GetProperty().SetSpecular(.5);\n    actor.GetProperty().SetSpecularPower(80.0);\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleSwitch style = new vtkInteractorStyleSwitch();\n    style.SetCurrentStyleToTrackballCamera();\n\n    // Visualise\n    ren.AddActor(actor);\n    ren.ResetCameraClippingRange();\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.SetMultiSamples(0);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/RandomProbe/","title":"RandomProbe","text":"

        vtk-examples/Java/Visualization/RandomProbe

        "},{"location":"Java/Visualization/RandomProbe/#description","title":"Description","text":"

        vtkProbeFilter object is a filter that computes point attributes (e.g., scalars, vectors, etc.) at specified point positions.

        The filter has two inputs: the Input and Source. The Input geometric structure is passed through the filter. The point attributes are computed at the Input point positions by interpolating into the source data.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/RandomProbe/#code","title":"Code","text":"

        RandomProbe.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkCone;\nimport vtk.vtkSampleFunction;\nimport vtk.vtkThreshold;\nimport vtk.vtkPointSource;\nimport vtk.vtkProbeFilter;\nimport vtk.vtkThresholdPoints;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkSphereSource;\n\n\npublic class RandomProbe\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    int resolution = 50;\n\n    //parse command line arguments\n    if (args.length > 1) \n    {\n      String res = args[0];\n      resolution = Integer.parseInt(res);\n    }\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n    colors.GetColor(\"DeepSkyBlue\", Bgcolor);\n\n    // Create a sampled cone\n    vtkCone implicitCone = new vtkCone();\n    implicitCone.SetAngle(30.0);\n\n    double radius = 1.0;\n    vtkSampleFunction sampledCone = new vtkSampleFunction();\n    sampledCone.SetSampleDimensions(resolution, resolution, resolution);\n    double xMin = -radius * 2.0;\n    double xMax =  radius * 2.0;\n    sampledCone.SetModelBounds(xMin, xMax, xMin, xMax, xMin, xMax);\n    sampledCone.SetImplicitFunction(implicitCone);\n\n    vtkThreshold thresholdCone = new vtkThreshold();\n    thresholdCone.SetInputConnection(sampledCone.GetOutputPort());\n    thresholdCone.ThresholdByLower(0);\n\n    vtkPointSource randomPoints = new vtkPointSource();\n    randomPoints.SetCenter (0.0, 0.0, 0.0);\n    randomPoints.SetNumberOfPoints(10000);\n    randomPoints.SetDistributionToUniform();\n    randomPoints.SetRadius(xMax);\n\n    // Probe the cone dataset with random points\n    vtkProbeFilter randomProbe = new vtkProbeFilter();\n    randomProbe.SetInputConnection(0, randomPoints.GetOutputPort());\n    randomProbe.SetInputConnection(1, thresholdCone.GetOutputPort());\n    randomProbe.Update();\n    randomProbe.GetOutput().GetPointData().SetActiveScalars(\"vtkValidPointMask\");\n\n    vtkThresholdPoints selectPoints = new vtkThresholdPoints();\n    selectPoints.SetInputConnection(randomProbe.GetOutputPort());\n    selectPoints.ThresholdByUpper(1.0);\n\n    vtkSphereSource sphere =new vtkSphereSource();\n    sphere.SetRadius(.05);\n\n    vtkGlyph3D glyph = new vtkGlyph3D();\n    glyph.SetSourceConnection(sphere.GetOutputPort());\n    glyph.SetInputConnection(selectPoints.GetOutputPort());\n\n    // Create a mapper and actor\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputConnection(glyph.GetOutputPort());\n    mapper.ScalarVisibilityOff();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/ScalarBarActor/","title":"ScalarBarActor","text":"

        vtk-examples/Java/Visualization/ScalarBarActor

        "},{"location":"Java/Visualization/ScalarBarActor/#description","title":"Description","text":"

        This example demonstrates how to make a color bar to that reflects the range of values associated with a data set.

        vtkScalarBarActor object creates a scalar bar with tick marks. A scalar bar is a legend that indicates to the viewer the correspondence between color value and data value. The legend consists of a rectangular bar made of rectangular pieces each colored a constant value.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/ScalarBarActor/#code","title":"Code","text":"

        ScalarBarActor.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkFloatArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkScalarBarActor;\nimport vtk.vtkLookupTable;\n\n\npublic class ScalarBarActor \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Background  Color\n    double Bgcolor[] = new double[4];\n    //Renderer Background2 Color\n    double Bgcolor2[] = new double[4];\n\n    colors.GetColor(\"White\", Bgcolor);\n    colors.GetColor(\"Black\", Bgcolor2);\n\n    // Create a sphere for some geometry\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetCenter(0,0,0);\n    sphere.SetRadius(1);\n    sphere.Update();\n\n    // Create scalar data to associate with the vertices of the sphere\n    int numPts = sphere.GetOutput().GetPoints().GetNumberOfPoints();\n    vtkFloatArray scalars = new vtkFloatArray();\n    scalars.SetNumberOfValues( numPts );\n    for( int i = 0; i < numPts; ++i )\n    {\n      scalars.SetValue(i,(float)(i)/numPts);\n    }\n\n    vtkPolyData poly = new vtkPolyData();\n    poly.DeepCopy(sphere.GetOutput());\n    poly.GetPointData().SetScalars(scalars);\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputData(poly);\n    mapper.ScalarVisibilityOn();\n    mapper.SetScalarModeToUsePointData();\n    mapper.SetColorModeToMapScalars();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    vtkScalarBarActor scalarBar = new vtkScalarBarActor();\n    scalarBar.SetLookupTable(mapper.GetLookupTable());\n    scalarBar.SetTitle(\"Title\");\n    scalarBar.SetNumberOfLabels(4);\n\n    // Create a lookup table to share between the mapper and the scalarbar\n    vtkLookupTable hueLut = new vtkLookupTable();\n    hueLut.SetTableRange (0, 1);\n    hueLut.SetHueRange (0, 1);\n    hueLut.SetSaturationRange (1, 1);\n    hueLut.SetValueRange (1, 1);\n    hueLut.Build();\n\n    mapper.SetLookupTable( hueLut );\n    scalarBar.SetLookupTable( hueLut );\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.GradientBackgroundOn();\n    ren.AddActor(actor);\n    ren.AddActor2D(scalarBar);\n    ren.SetBackground(Bgcolor);\n    ren.SetBackground2(Bgcolor2);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/ScalarBarActorColorSeries/","title":"ScalarBarActorColorSeries","text":"

        vtk-examples/Java/Visualization/ScalarBarActorColorSeries

        "},{"location":"Java/Visualization/ScalarBarActorColorSeries/#description","title":"Description","text":"

        The vtkColorSeries object stores palettes of colors. There are several default palettes (or schemes) available and functions to control several aspects of what colors are returned. In essence a color scheme is set and then the number of colors and individual color values may be requested.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/ScalarBarActorColorSeries/#code","title":"Code","text":"

        ScalarBarActorColorSeries.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkFloatArray;\nimport vtk.vtkPolyData;\nimport vtk.vtkScalarBarActor;\nimport vtk.vtkLookupTable;\nimport vtk.vtkColorSeries;\n\n\npublic class ScalarBarActorColorSeries \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Background  Color\n    double Bgcolor[] = new double[4];\n    //Renderer Background2 Color\n    double Bgcolor2[] = new double[4];\n\n    colors.GetColor(\"Crimson\", Bgcolor);\n    colors.GetColor(\"NavajoWhite\", Bgcolor2);\n\n    // Create a sphere for some geometry\n    vtkSphereSource sphere = new vtkSphereSource();\n    sphere.SetCenter(0,0,0);\n    sphere.SetRadius(1);\n    sphere.SetPhiResolution(30);\n    sphere.SetThetaResolution(60);\n    sphere.Update();\n\n    // Create scalar data to associate with the vertices of the sphere\n    int numPts = sphere.GetOutput().GetPoints().GetNumberOfPoints();\n    vtkFloatArray scalars = new vtkFloatArray();\n    scalars.SetNumberOfValues( numPts );\n    for( int i = 0; i < numPts; ++i )\n    {\n      scalars.SetValue(i,(float)(i)/numPts);\n    }\n\n    vtkPolyData poly = new vtkPolyData();\n    poly.DeepCopy(sphere.GetOutput());\n    poly.GetPointData().SetScalars(scalars);\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputData(poly);\n    mapper.ScalarVisibilityOn();\n    mapper.SetScalarModeToUsePointData();\n    mapper.SetColorModeToMapScalars();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n    actor.GetProperty().SetInterpolationToFlat();\n\n    vtkScalarBarActor scalarBar = new vtkScalarBarActor();\n    scalarBar.SetLookupTable(mapper.GetLookupTable());\n    scalarBar.SetTitle(\"Beachball\");\n    scalarBar.SetNumberOfLabels(4);\n\n    // Create a lookup table to share between the mapper and the scalarbar\n    vtkLookupTable seriesLut = new vtkLookupTable();\n\n    vtkColorSeries series = new vtkColorSeries();\n    int seriesEnum = 16;\n    series.SetColorScheme(seriesEnum);\n    series.BuildLookupTable(seriesLut, 0);\n\n    mapper.SetLookupTable(seriesLut);\n    scalarBar.SetLookupTable(seriesLut);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.GradientBackgroundOn();\n    ren.AddActor(actor);\n    ren.AddActor2D(scalarBar);\n    ren.SetBackground(Bgcolor);\n    ren.SetBackground2(Bgcolor2);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/ScalarVisibility/","title":"ScalarVisibility","text":"

        vtk-examples/Java/Visualization/ScalarVisibility

        "},{"location":"Java/Visualization/ScalarVisibility/#description","title":"Description","text":"

        vtkPointSource is a source object that creates a user-specified number of points within a specified radius about a specified center point.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/ScalarVisibility/#code","title":"Code","text":"

        ScalarVisibility.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkPointSource;\n\n\npublic class ScalarVisibility \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    colors.GetColor(\"Red\", actorColor);\n\n    vtkPointSource pointSource = new vtkPointSource();\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(pointSource.GetOutputPort());\n    mapper.ScalarVisibilityOff();\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper( mapper );\n    actor.GetProperty().SetColor(actorColor);\n    actor.GetProperty().SetPointSize(8);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise\n    ren.AddActor(actor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/SideBySideViewports/","title":"SideBySideViewports","text":"

        vtk-examples/Java/Visualization/SideBySideViewports

        "},{"location":"Java/Visualization/SideBySideViewports/#description","title":"Description","text":"

        This example splits the window into a left and right side. A sphere is drawn on the left and a cube is drawn on the right.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/SideBySideViewports/#code","title":"Code","text":"

        SideBySideViewports.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkCubeSource;\n\npublic class SideBySideViewports \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //leftRenderer Background Color\n    double leftRenderercolor[] = new double[4];\n    //rightRenderer Background Color\n    double rightRenderercolor[] = new double[4];\n\n    colors.GetColor(\"Tan\", leftRenderercolor);\n    colors.GetColor(\"LightSlateGray\", rightRenderercolor);\n\n    // Setup sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n    vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();\n    sphereMapper.SetInputConnection(sphereSource.GetOutputPort());\n    vtkActor sphereActor = new vtkActor();\n    sphereActor.SetMapper(sphereMapper);\n\n    // Setup cube\n    vtkCubeSource cubeSource = new vtkCubeSource();\n    cubeSource.Update();\n    vtkPolyDataMapper cubeMapper = new vtkPolyDataMapper();\n    cubeMapper.SetInputConnection(cubeSource.GetOutputPort());\n    vtkActor cubeActor = new vtkActor();\n    cubeActor.SetMapper(cubeMapper);\n    cubeActor.GetProperty().SetDiffuseColor(.3, .6, .4);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Define viewport ranges\n    // (xmin, ymin, xmax, ymax)\n    double leftViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};\n    double rightViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};\n\n    // Setup both renderers\n    vtkRenderer leftRenderer = new vtkRenderer();\n    renWin.AddRenderer(leftRenderer);\n    leftRenderer.SetViewport(leftViewport);\n    leftRenderer.SetBackground(leftRenderercolor);  \n\n    vtkRenderer rightRenderer = new vtkRenderer();\n    renWin.AddRenderer(rightRenderer);\n    rightRenderer.SetViewport(rightViewport);\n    rightRenderer.SetBackground(rightRenderercolor);  \n\n    // Add the sphere to the left and the cube to the right\n    leftRenderer.AddActor(sphereActor);\n    rightRenderer.AddActor(cubeActor);\n\n    leftRenderer.ResetCamera();\n\n    rightRenderer.ResetCamera();\n    rightRenderer.GetActiveCamera().Azimuth(30);\n    rightRenderer.GetActiveCamera().Elevation(30);\n\n    renWin.SetSize(600, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Visualization/VectorFieldExample/","title":"VectorFieldExample","text":"

        vtk-examples/Java/Visualization/VectorFieldExample

        "},{"location":"Java/Visualization/VectorFieldExample/#description","title":"Description","text":"

        The code below shows how to load a vector field from a vtu file, where some data is stored and we are only interested in the vector field.

        Note

        Please make sure that you adapt the code below to your system properties, like e.g. paths to native vtk libraries.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/VectorFieldExample/#code","title":"Code","text":"

        VectorFieldExample.java

        import java.awt.BorderLayout;\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.Serializable;\nimport java.util.concurrent.TimeUnit;\nimport javax.swing.JFrame;\nimport javax.swing.SwingUtilities;\n\nimport vtk.vtkActor;\nimport vtk.vtkArrowSource;\nimport vtk.vtkCubeSource;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkObject;\nimport vtk.vtkPanel;\nimport vtk.vtkPolyData;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkThresholdPoints;\nimport vtk.vtkUnstructuredGrid;\nimport vtk.vtkXMLUnstructuredGridReader;\n\n\npublic class VectorFieldExample implements Serializable {\n\n  private static final long serialVersionUID = 1L;\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static vtkPanel showVectorField(\n      File file,\n      int elementInFile,\n      double threshold,\n      double scaleFactor) {\n\n    vtkXMLUnstructuredGridReader reader = new vtkXMLUnstructuredGridReader();\n\n    reader.SetFileName(file.getAbsolutePath());\n    reader.Update();\n    vtkUnstructuredGrid image = reader.GetOutput();\n    image.GetPointData().SetVectors(image.GetPointData().GetArray(elementInFile));\n\n    vtkThresholdPoints thresholdVector = new vtkThresholdPoints();\n    thresholdVector.SetInputData(image);\n    thresholdVector.SetInputArrayToProcess(\n        elementInFile,\n        image.GetInformation());\n\n    thresholdVector.ThresholdByUpper(threshold);\n    thresholdVector.Update();\n\n\n    // represent vector field\n    vtkGlyph3D vectorGlyph = new vtkGlyph3D();\n    vtkArrowSource arrowSource = new vtkArrowSource();\n    vtkPolyDataMapper vectorGlyphMapper = new vtkPolyDataMapper();\n\n    int n = image.GetPointData().GetNumberOfArrays();\n    for (int i = 0; i < n; i++) {\n      System.out.println(\"name of array[\" + i + \"]: \" + image.GetPointData().GetArrayName(i));\n    }\n\n    vtkPolyData tmp = thresholdVector.GetOutput();\n    System.out.println(\"number of thresholded points: \" + tmp.GetNumberOfPoints());\n\n    vectorGlyph.SetInputData(image);\n    vectorGlyph.SetSourceConnection(arrowSource.GetOutputPort());\n    vectorGlyph.SetScaleModeToScaleByVector();\n    vectorGlyph.SetVectorModeToUseVector();\n    vectorGlyph.ScalingOn();\n    vectorGlyph.OrientOn();\n    vectorGlyph.SetInputArrayToProcess(\n        elementInFile,\n        image.GetInformation());\n\n    vectorGlyph.SetScaleFactor(scaleFactor);\n\n    vectorGlyph.Update();\n\n    vectorGlyphMapper.SetInputConnection(vectorGlyph.GetOutputPort());\n    vectorGlyphMapper.Update();\n\n    vtkActor vectorActor = new vtkActor();\n    vectorActor.SetMapper(vectorGlyphMapper);\n\n\n    vtkPanel vis = new vtkPanel();\n    vis.GetRenderer().AddActor(vectorActor);\n\n    return vis;\n  }\n\n  //  public static void main(String s[]) throws IOException {\n  public static void main(String[] args) {\n    //parse command line arguments\n    if (args.length != 1) {\n      System.err.println(\"Usage: java -classpath ... VectorFieldExample Filename(.vtu) e.g tetra.vtu\");\n      return;\n    }\n\n    String filename = args[0];\n\n    SwingUtilities.invokeLater(new Runnable() {\n\n      @Override\n      public void run() {\n\n        JFrame frame = new JFrame(\"VTKJPanel Demo\");\n        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\n        File file = new File(filename); // needs to be replaced\n\n        vtkPanel panel = showVectorField(file, 2, 0.001, 0.05); // values need to be replaced\n\n        frame.add(panel, BorderLayout.CENTER);\n        frame.setSize(600, 600);\n        frame.setLocationRelativeTo(null);\n        frame.setVisible(true);\n\n        panel.repaint();\n\n      }\n    });\n  }\n}\n
        "},{"location":"Java/Visualization/VisualizeImageData/","title":"VisualizeImageData","text":"

        vtk-examples/Java/Visualization/VisualizeImageData

        "},{"location":"Java/Visualization/VisualizeImageData/#description","title":"Description","text":"

        vtkImageData is a data object that is a concrete implementation of vtkDataSet.

        vtkImageData represents a geometric structure that is a topological and geometrical regular array of points.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/VisualizeImageData/#code","title":"Code","text":"

        VisualizeImageData.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkImageData;\nimport vtk.vtkDataSetMapper;\n\npublic class VisualizeImageData \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Actor Color\n    double ActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change Actor Color\n    Color.GetColor(\"Gold\",ActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SpringGreen\",BgColor);\n\n    //  Create an image data\n    vtkImageData imageData = new vtkImageData();\n\n    // Specify the size of the image data\n    imageData.SetDimensions(3,3,2);\n    imageData.SetSpacing(1.0, 1.0, 1.0);\n    imageData.SetOrigin(0.0, 0.0, 0.0);\n\n    vtkDataSetMapper mapper = new vtkDataSetMapper();\n    mapper.SetInputData(imageData);\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Visualization/VisualizeVTP/","title":"VisualizeVTP","text":"

        vtk-examples/Java/Visualization/VisualizeVTP

        "},{"location":"Java/Visualization/VisualizeVTP/#description","title":"Description","text":"

        This example shows how to load a vtp file and render it in an interactive window.

        The example accepts a .vtp file on the command line.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/VisualizeVTP/#code","title":"Code","text":"

        VisualizeVTP.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkXMLPolyDataReader;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\n\npublic class VisualizeVTP \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"LightSlateGray\",BgColor);\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtp) e.g Bunny.vtp\");\n      return;\n    }\n\n    //Read the polydata for the icon\n    vtkXMLPolyDataReader reader =  new vtkXMLPolyDataReader();\n    reader.SetFileName(args[0]);\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Visualization/WindowSize/","title":"WindowSize","text":"

        vtk-examples/Java/Visualization/WindowSize

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/WindowSize/#code","title":"Code","text":"

        WindowSize.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\n\npublic class WindowSize \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",BgColor);\n\n    //Sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    //sphereSource.SetCenter(0.0, 0.0, 0.0);\n    sphereSource.SetRadius(5.0);\n    sphereSource.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(200,100); //(width, height)\n\n    renWin.Render();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Visualization/WireframeSphere/","title":"WireframeSphere","text":"

        vtk-examples/Java/Visualization/WireframeSphere

        "},{"location":"Java/Visualization/WireframeSphere/#description","title":"Description","text":"

        This Program demonstrates how to create a wire-frame sphere in Java using VTK.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Visualization/WireframeSphere/#code","title":"Code","text":"

        WireframeSphere.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkSphereSource;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\n\npublic class Sphere\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[])\n  {\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n\n    colors.GetColor(\"Silver\", actorColor);\n    colors.GetColor(\"PaleVioletRed\", Bgcolor);\n\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(0.0,0.0,0.0);\n    Sphere.SetRadius(1.0);\n    Sphere.Update();\n\n    //Change Phi and Theta Value for Smooth Surface\n    Sphere.SetPhiResolution(10);\n    Sphere.SetThetaResolution(10);\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n    //Setting up the wireframe property to Sphere. Comment the below line to display Solid Sphere\n    Actor.GetProperty().SetRepresentationToWireframe();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualise the arrow\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n }\n
        "},{"location":"Java/VisualizationAlgorithms/Cutter/","title":"Cutter","text":"

        vtk-examples/Java/VisualizationAlgorithms/Cutter

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/VisualizationAlgorithms/Cutter/#code","title":"Code","text":"

        Cutter.java

        import vtk.vtkActor;\nimport vtk.vtkCubeSource;\nimport vtk.vtkCutter;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPlane;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\n\npublic class Cutter {\n  private static final long serialVersionUID = 1L;\n\n  // Loading Native Libraries.\n  // Now it works in eclipse without any issues.\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n\n  public static void main(String[] args) {\n    vtkNamedColors color = new vtkNamedColors();\n    double planeColor[] = new double[4];\n    color.GetColor(\"Yellow\", planeColor);\n    double cubeColor[] = new double[4];\n    color.GetColor(\"Aquamarine\", cubeColor);\n    double bgColor[] = new double[4];\n    color.GetColor(\"Silver\", bgColor);\n\n\n    vtkCubeSource cube = new vtkCubeSource();\n    cube.SetXLength(40);\n    cube.SetYLength(30);\n    cube.SetZLength(20);\n    vtkPolyDataMapper cubeMapper = new vtkPolyDataMapper();\n    cubeMapper.SetInputConnection(cube.GetOutputPort());\n\n    // create a plane to cut,here it cuts in the XZ direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0)\n    vtkPlane plane = new vtkPlane();\n    plane.SetOrigin(10, 0, 0);\n    plane.SetNormal(1, 0, 0);\n\n    //create cutter\n    vtkCutter cutter = new vtkCutter();\n    cutter.SetCutFunction(plane);\n    cutter.SetInputData(cubeMapper.GetInput());\n    cutter.Update();\n\n    vtkPolyDataMapper cutterMapper = new vtkPolyDataMapper();\n    cutterMapper.SetInputConnection(cutter.GetOutputPort());\n\n    //create plane actor\n    vtkActor planeActor = new vtkActor();\n    planeActor.GetProperty().SetColor(planeColor);\n    planeActor.GetProperty().SetLineWidth(2);\n    planeActor.SetMapper(cutterMapper);\n\n    //create cube actor\n    vtkActor cubeActor = new vtkActor();\n    cubeActor.GetProperty().SetColor(cubeColor);\n    cubeActor.GetProperty().SetOpacity(0.3);\n    cubeActor.SetMapper(cubeMapper);\n\n    //create renderers and add actors of plane and cube\n    vtkRenderer ren = new vtkRenderer();\n    ren.AddActor(planeActor);\n    ren.AddActor(cubeActor);\n\n    //Add renderer to renderwindow and render\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetSize(600, 600);\n\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n    ren.SetBackground(bgColor);\n    renWin.Render();\n\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/VisualizationAlgorithms/IceCream/","title":"IceCream","text":"

        vtk-examples/Java/VisualizationAlgorithms/IceCream

        "},{"location":"Java/VisualizationAlgorithms/IceCream/#description","title":"Description","text":"

        This example demonstrates how to use boolean combinations of implicit functions to create a model of an ice cream cone.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/VisualizationAlgorithms/IceCream/#code","title":"Code","text":"

        IceCream.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkCone;\nimport vtk.vtkPlane;\nimport vtk.vtkSphere;\nimport vtk.vtkImplicitBoolean;\nimport vtk.vtkSampleFunction;\nimport vtk.vtkContourFilter;\n\n\npublic class IceCream \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    // This example demonstrates how to use boolean combinations of implicit \n    //functions to create a model of an ice cream cone.\n\n    // Create implicit function primitives. These have been carefully placed to\n    // give the effect that we want. We are going to use various combinations of\n    // these functions to create the shape we want; for example, we use planes\n    // intersected with a cone (which is infinite in extent) to get a finite cone.\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For coneActor Color\n    double coneActorColor[] = new double[4];\n    //For creamActor Color\n    double creamActorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"chocolate\", coneActorColor);\n    colors.GetColor(\"mint\", creamActorColor);\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    vtkCone cone = new vtkCone();\n    cone.SetAngle(20);\n\n    vtkPlane vertPlane = new vtkPlane();\n    vertPlane.SetOrigin(.1, 0, 0);\n    vertPlane.SetNormal(-1, 0, 0);\n\n    vtkPlane basePlane = new vtkPlane();\n    basePlane.SetOrigin(1.2, 0, 0);\n    basePlane.SetNormal(1, 0, 0);\n\n    vtkSphere iceCream = new vtkSphere();\n    iceCream.SetCenter(1.333, 0, 0);\n    iceCream.SetRadius(0.5);\n\n    vtkSphere bite = new vtkSphere();\n    bite.SetCenter(1.5, 0, 0.5);\n    bite.SetRadius(0.25);\n\n    // Combine primitives to build ice-cream cone. Clip the cone with planes.\n    vtkImplicitBoolean theCone = new vtkImplicitBoolean();\n    theCone.SetOperationTypeToIntersection();\n    theCone.AddFunction(cone);\n    theCone.AddFunction(vertPlane);\n    theCone.AddFunction(basePlane);\n\n    // Take a bite out of the ice cream.\n    vtkImplicitBoolean theCream = new vtkImplicitBoolean();\n    theCream.SetOperationTypeToDifference();\n    theCream.AddFunction(iceCream);\n    theCream.AddFunction(bite);\n\n    // The sample function generates a distance function from the\n    // implicit function (which in this case is the cone). \n    // This is then contoured to get a polygonal surface.\n\n    vtkSampleFunction theConeSample = new vtkSampleFunction();\n    theConeSample.SetImplicitFunction(theCone);\n    theConeSample.SetModelBounds(-1, 1.5, -1.25, 1.25, -1.25, 1.25);\n    theConeSample.SetSampleDimensions(128, 128, 128);\n    theConeSample.ComputeNormalsOff();\n\n    vtkContourFilter theConeSurface = new vtkContourFilter();\n    theConeSurface.SetInputConnection(theConeSample.GetOutputPort());\n    theConeSurface.SetValue(0, 0.0);\n\n    vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();\n    coneMapper.SetInputConnection(theConeSurface.GetOutputPort());\n    coneMapper.ScalarVisibilityOff();\n\n    vtkActor coneActor = new vtkActor();\n    coneActor.SetMapper(coneMapper);\n    coneActor.GetProperty().SetColor(coneActorColor);\n\n    //The same here for the ice cream.\n\n    vtkSampleFunction theCreamSample = new vtkSampleFunction();\n    theCreamSample.SetImplicitFunction(theCream);\n    theCreamSample.SetModelBounds(0, 2.5, -1.25, 1.25, -1.25, 1.25);\n    theCreamSample.SetSampleDimensions(128, 128, 128);\n    theCreamSample.ComputeNormalsOff();\n\n    vtkContourFilter theCreamSurface = new vtkContourFilter();\n    theCreamSurface.SetInputConnection(theCreamSample.GetOutputPort());\n    theCreamSurface.SetValue(0, 0.0);\n\n    vtkPolyDataMapper creamMapper = new vtkPolyDataMapper();\n    creamMapper.SetInputConnection(theCreamSurface.GetOutputPort());\n    creamMapper.ScalarVisibilityOff();\n\n    vtkActor creamActor = new vtkActor();\n    creamActor.SetMapper(creamMapper);\n    creamActor.GetProperty().SetDiffuseColor(creamActorColor);\n    creamActor.GetProperty().SetSpecular(.6);\n    creamActor.GetProperty().SetSpecularPower(50);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(coneActor);\n    ren.AddActor(creamActor);\n    ren.SetBackground(Bgcolor);\n    ren.ResetCamera();\n    ren.GetActiveCamera().Roll(90);\n    ren.GetActiveCamera().Dolly(1.25);\n    ren.ResetCameraClippingRange();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/VisualizationAlgorithms/SpikeFran/","title":"SpikeFran","text":"

        vtk-examples/Java/VisualizationAlgorithms/SpikeFran

        "},{"location":"Java/VisualizationAlgorithms/SpikeFran/#description","title":"Description","text":"

        This examples uses glyphs to indicate surface normals on model of human face. Glyph positions are randomly selected.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/VisualizationAlgorithms/SpikeFran/#code","title":"Code","text":"

        SpikeFran.java

        import vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkGlyph3D;\nimport vtk.vtkPolyDataReader;\nimport vtk.vtkPolyDataNormals;\nimport vtk.vtkTransformPolyDataFilter;\nimport vtk.vtkMaskPoints;\nimport vtk.vtkConeSource;\nimport vtk.vtkTransform;\n\npublic class SpikeFran\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtk) e.g fran_cut.vtk\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For franActor Color\n    double franActorColor[] = new double[4];\n    //For spikeActor Color\n    double spikeActorColor[] = new double[4];\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Flesh\", franActorColor);\n    colors.GetColor(\"Emerald_Green\", spikeActorColor);\n    colors.GetColor(\"SlateGray\", Bgcolor);\n\n    vtkPolyDataReader fran = new vtkPolyDataReader();\n    fran.SetFileName(inputFilename);\n\n    vtkPolyDataNormals normals = new vtkPolyDataNormals();\n    normals.SetInputConnection(fran.GetOutputPort());\n    normals.FlipNormalsOn();\n\n    vtkPolyDataMapper franMapper = new vtkPolyDataMapper();\n    franMapper.SetInputConnection(normals.GetOutputPort());\n\n    vtkActor franActor = new vtkActor();\n    franActor.SetMapper(franMapper);\n    franActor.GetProperty().SetColor(franActorColor);\n\n    // We subsample the dataset because we want to glyph just a subset of\n    // the points. Otherwise the display is cluttered and cannot be easily\n    // read. The RandomModeOn and SetOnRatio combine to random select one out\n    // of every 10 points in the dataset.\n\n    vtkMaskPoints ptMask = new vtkMaskPoints();\n    ptMask.SetInputConnection(normals.GetOutputPort());\n    ptMask.SetOnRatio(10);\n    ptMask.RandomModeOn();\n\n    // In this case we are using a cone as a glyph. We transform the cone so\n    // its base is at 0,0,0. This is the point where glyph rotation occurs.\n\n    vtkConeSource cone = new vtkConeSource();\n    cone.SetResolution(6);\n\n    vtkTransform transform = new vtkTransform();\n    transform.Translate(0.5, 0.0, 0.0);\n\n    vtkTransformPolyDataFilter transformF = new vtkTransformPolyDataFilter();\n    transformF.SetInputConnection(cone.GetOutputPort());\n    transformF.SetTransform(transform);\n\n    // vtkGlyph3D takes two inputs: the input point set (SetInputConnection)\n    // which can be any vtkDataSet; and the glyph (SetSourceConnection) which\n    // must be a vtkPolyData.  We are interested in orienting the glyphs by the\n    // surface normals that we previously generated.\n\n    vtkGlyph3D glyph = new vtkGlyph3D();\n    glyph.SetInputConnection(ptMask.GetOutputPort());\n    glyph.SetSourceConnection(transformF.GetOutputPort());\n    glyph.SetVectorModeToUseNormal();\n    glyph.SetScaleModeToScaleByVector();\n    glyph.SetScaleFactor(0.004);\n\n    vtkPolyDataMapper spikeMapper = new vtkPolyDataMapper();\n    spikeMapper.SetInputConnection(glyph.GetOutputPort());\n\n    vtkActor spikeActor = new vtkActor();\n    spikeActor.SetMapper(spikeMapper);\n    spikeActor.GetProperty().SetColor(spikeActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetSize(640, 480);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Visualize\n    ren.AddActor(franActor);\n    ren.AddActor(spikeActor);\n    renWin.Render();\n\n    ren.SetBackground(Bgcolor);\n    ren.GetActiveCamera().Zoom(1.4);\n    ren.GetActiveCamera().Azimuth(110);\n\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/VolumeRendering/SimpleRayCast/","title":"SimpleRayCast","text":"

        vtk-examples/Java/VolumeRendering/SimpleRayCast

        "},{"location":"Java/VolumeRendering/SimpleRayCast/#description","title":"Description","text":"

        Volume rendering of a high potential iron protein.

        Info

        See Figure 7-34 in Chapter 7 the VTK Textbook.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/VolumeRendering/SimpleRayCast/#code","title":"Code","text":"

        SimpleRayCast.java

        import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkStructuredPointsReader;\nimport vtk.vtkPiecewiseFunction;\nimport vtk.vtkColorTransferFunction;\nimport vtk.vtkVolumeProperty;\nimport vtk.vtkFixedPointVolumeRayCastMapper;\nimport vtk.vtkVolume;\n\n\npublic class SimpleRayCast \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtk) e.g ironProt.vtk\");\n      return;\n    }\n    String inputFilename = args[0];\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Tomato\", actorColor);\n    colors.GetColor(\"Wheat\", Bgcolor);\n\n    // Create the reader for the data\n    vtkStructuredPointsReader reader = new vtkStructuredPointsReader();\n    reader.SetFileName(inputFilename);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    // Create transfer mapping scalar value to opacity\n    vtkPiecewiseFunction opacityTransferFunction = new vtkPiecewiseFunction();\n    opacityTransferFunction.AddPoint(20, 0.0);\n    opacityTransferFunction.AddPoint(255, 0.2);\n\n    // Create transfer mapping scalar value to color\n    vtkColorTransferFunction colorTransferFunction = new vtkColorTransferFunction();\n    colorTransferFunction.AddRGBPoint(0.0, 0.0, 0.0, 0.0);\n    colorTransferFunction.AddRGBPoint(64.0, 1.0, 0.0, 0.0);\n    colorTransferFunction.AddRGBPoint(128.0, 0.0, 0.0, 1.0);\n    colorTransferFunction.AddRGBPoint(192.0, 0.0, 1.0, 0.0);\n    colorTransferFunction.AddRGBPoint(255.0, 0.0, 0.2, 0.0);\n\n    // The property describes how the data will look\n    vtkVolumeProperty volumeProperty = new vtkVolumeProperty();\n    volumeProperty.SetColor(colorTransferFunction);\n    volumeProperty.SetScalarOpacity(opacityTransferFunction);\n    volumeProperty.ShadeOn();\n    volumeProperty.SetInterpolationTypeToLinear();\n\n    // The mapper / ray cast function know how to render the data\n    vtkFixedPointVolumeRayCastMapper volumeMapper = new vtkFixedPointVolumeRayCastMapper();\n    volumeMapper.SetInputConnection(reader.GetOutputPort());\n\n    // The volume holds the mapper and the property and can be used to position/orient the volume\n    vtkVolume volume = new vtkVolume();\n    volume.SetMapper(volumeMapper);\n    volume.SetProperty(volumeProperty);\n\n    ren.AddVolume(volume);\n    ren.SetBackground(Bgcolor);\n    ren.GetActiveCamera().Azimuth(45);\n    ren.GetActiveCamera().Elevation(30);\n    ren.ResetCameraClippingRange();\n    ren.ResetCamera();\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Widgets/AngleWidget/","title":"AngleWidget","text":"

        vtk-examples/Java/Widgets/AngleWidget

        "},{"location":"Java/Widgets/AngleWidget/#description","title":"Description","text":"

        Click three points to create an angle. You can then drag the points around.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/AngleWidget/#code","title":"Code","text":"

        AngleWidget.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkAngleWidget;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\n\n\npublic class AngleWidget {\n  //private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",BgColor);\n\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetInteractor(iren);\n    iren.SetRenderWindow(renWin);\n    ren.ResetCamera();\n    ren.SetBackground(BgColor);\n\n    // Angle Widget  \n    vtkAngleWidget angleWidget = new vtkAngleWidget();\n    angleWidget.SetInteractor(iren);\n    angleWidget .CreateDefaultRepresentation();\n\n    angleWidget.On();\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Start();\n    iren.Initialize();\n\n\n  }\n} \n
        "},{"location":"Java/Widgets/AngleWidget2D/","title":"AngleWidget2D","text":"

        vtk-examples/Java/Widgets/AngleWidget2D

        "},{"location":"Java/Widgets/AngleWidget2D/#description","title":"Description","text":"

        The arc is still visible?

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/AngleWidget2D/#code","title":"Code","text":"

        AngleWidget2D.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkAngleRepresentation2D;\nimport vtk.vtkAngleWidget;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\n\n\npublic class AngleWidget2D  {\n  //private static final long serialVersionUID = 1L;\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {\n        if (!lib.IsLoaded()) {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) {\n\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"Black\",BgColor);\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n\n    double pos1[] = new double[] {50.0, 200.0, 0.0};\n    double pos2[] = new double[] {200.0, 20.0, 0.0};\n    double center[] =new double[] {100.0, 100.0, 0.0};\n\n    vtkAngleRepresentation2D Rep = new vtkAngleRepresentation2D();\n    Rep.ArcVisibilityOff();\n\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetInteractor(iren);\n    iren.SetRenderWindow(renWin);\n    ren.ResetCamera();\n    ren.SetBackground(BgColor);\n\n    // Angle Widget  \n    vtkAngleWidget angleWidget = new vtkAngleWidget();\n    angleWidget.SetInteractor(iren);\n    angleWidget .CreateDefaultRepresentation();\n    angleWidget.SetRepresentation(Rep);\n\n    angleWidget.On();\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n\n    Rep.SetPoint1DisplayPosition(pos1);\n    Rep.SetPoint2DisplayPosition(pos2);\n    Rep.SetCenterDisplayPosition(center);\n    Rep.Ray1VisibilityOn();\n    Rep.Ray2VisibilityOn();\n    Rep.ArcVisibilityOn();\n\n    iren.Start();\n\n  }\n} \n
        "},{"location":"Java/Widgets/BalloonWidget/","title":"BalloonWidget","text":"

        vtk-examples/Java/Widgets/BalloonWidget

        "},{"location":"Java/Widgets/BalloonWidget/#description","title":"Description","text":"

        This example creates a sphere and a regular polygon. The balloon text describes each object when you hover over it.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/BalloonWidget/#code","title":"Code","text":"

        BalloonWidget.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkRegularPolygonSource;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkBalloonRepresentation;\nimport vtk.vtkBalloonWidget;\nimport vtk.vtkSphereSource;\n\n\npublic class BalloonWidget \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double SphereactorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n    //PolygonActor color\n    double PolygonActorColor[] = new double[4];\n\n    colors.GetColor(\"OrangeRed\", SphereactorColor);\n    colors.GetColor(\"SkyBlue\", Bgcolor);\n    colors.GetColor(\"Indigo\", PolygonActorColor);\n\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.SetCenter(-4.0,0.0,0.0);\n    Sphere.SetRadius(4.0);\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor SphereActor = new vtkActor();\n    SphereActor.SetMapper(Mapper);\n    SphereActor.GetProperty().SetColor(SphereactorColor);\n\n    //Regular Polygon\n    vtkRegularPolygonSource RegularPolygon = new vtkRegularPolygonSource();\n    RegularPolygon.SetCenter(4, 0, 0);\n    RegularPolygon.SetRadius(4);\n    RegularPolygon.Update();\n\n    vtkPolyDataMapper PolygonMapper = new vtkPolyDataMapper();\n    PolygonMapper.SetInputConnection(RegularPolygon.GetOutputPort());\n\n    vtkActor PolygonActor = new vtkActor();\n    PolygonActor.SetMapper(PolygonMapper);\n    PolygonActor.GetProperty().SetColor(PolygonActorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Create the widget\n    vtkBalloonRepresentation BalloonRep = new vtkBalloonRepresentation();\n    BalloonRep.SetBalloonLayoutToImageRight();\n\n\n    vtkBalloonWidget BalloonWidget = new vtkBalloonWidget();\n    BalloonWidget.SetInteractor(iren);\n    BalloonWidget.SetRepresentation(BalloonRep);\n    BalloonWidget.AddBalloon(SphereActor,\"Sphere\");\n    BalloonWidget.AddBalloon(PolygonActor,\"Polygon\");\n\n    // Visualise the arrow\n    ren.AddActor(SphereActor);\n    ren.AddActor(PolygonActor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n    BalloonWidget.EnabledOn();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Widgets/CaptionWidget/","title":"CaptionWidget","text":"

        vtk-examples/Java/Widgets/CaptionWidget

        "},{"location":"Java/Widgets/CaptionWidget/#description","title":"Description","text":"

        vtkCaptionWidget object provides support for interactively placing a caption on the 2D overlay plane.

        A caption is defined by some text with a leader (e.g., arrow) that points from the text to a point in the scene.

        The caption is represented by a vtkCaptionRepresentation. It uses the event bindings of its superclass (vtkBorderWidget) to control the placement of the text, and adds the ability to move the attachment point around. In addition, when the caption text is selected, the widget emits a ActivateEvent that observers can watch for. This is useful for opening GUI dialogoues to adjust font characteristics, etc.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/CaptionWidget/#code","title":"Code","text":"

        CaptionWidget.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkSphereSource;\nimport vtk.vtkCaptionRepresentation;\nimport vtk.vtkCaptionWidget;\n\npublic class CaptionWidget \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"red\",BgColor);\n\n    //Sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Create the widget and its representation\n    vtkCaptionRepresentation captionRepresentation = new vtkCaptionRepresentation();\n    captionRepresentation.GetCaptionActor2D().SetCaption(\"Test Caption\");\n    captionRepresentation.GetCaptionActor2D().GetTextActor().GetTextProperty().SetFontSize(100);\n\n    double pos[] = new double[] {0.5, 0, 0};\n    captionRepresentation.SetAnchorPosition(pos);\n\n    vtkCaptionWidget captionWidget = new vtkCaptionWidget();\n    captionWidget.SetInteractor(iren);\n    captionWidget.SetRepresentation(captionRepresentation);\n\n    ren.AddActor(actor);\n    ren.SetBackground(BgColor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n    captionWidget.On();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Widgets/DistanceWidget/","title":"DistanceWidget","text":"

        vtk-examples/Java/Widgets/DistanceWidget

        "},{"location":"Java/Widgets/DistanceWidget/#description","title":"Description","text":"

        The vtkDistanceWidget object is used to measure the distance between two points.

        The two end points can be positioned independently, and when they are released, a special PlacePointEvent is invoked so that special operations may be take to reposition the point (snap to grid, etc.)

        The widget has two different modes of interaction - when initially defined (i.e., placing the two points) and then a manipulate mode (adjusting the position of the two points).

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/DistanceWidget/#code","title":"Code","text":"

        DistanceWidget.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkDistanceWidget;\n\n\npublic class DistanceWidget \n{\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"DimGray\", Bgcolor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkDistanceWidget DistanceWidget = new vtkDistanceWidget();\n    DistanceWidget.SetInteractor(iren);\n    DistanceWidget.CreateDefaultRepresentation();\n\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n    DistanceWidget.On();\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Widgets/ImagePlaneWidget/","title":"ImagePlaneWidget","text":"

        vtk-examples/Java/Widgets/ImagePlaneWidget

        "},{"location":"Java/Widgets/ImagePlaneWidget/#description","title":"Description","text":"

        This 3D widget defines a plane that can be interactively placed in an image volume.

        A nice feature of the object is that the vtkImagePlaneWidget, like any 3D widget, will work with the current interactor style.

        That is, if vtkImagePlaneWidget does not handle an event, then all other registered observers (including the interactor style) have an opportunity to process the event. Otherwise, the vtkImagePlaneWidget will terminate the processing of the event that it handles.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/ImagePlaneWidget/#code","title":"Code","text":"

        ImagePlaneWidget.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkActor;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkInteractorStyleTrackballCamera;\nimport vtk.vtkImagePlaneWidget;\n\npublic class ImagePlaneWidget\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n    //Sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.Update();\n\n    //Create a mapper and actor\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleTrackballCamera style = new vtkInteractorStyleTrackballCamera();\n    iren.SetInteractorStyle( style );\n\n    vtkImagePlaneWidget planeWidget = new vtkImagePlaneWidget();\n    planeWidget.SetInteractor(iren);\n    planeWidget.TextureVisibilityOff();\n\n    double origin[] = new double[]{0, 1, 0};\n    planeWidget.SetOrigin(origin);\n    planeWidget.UpdatePlacement();\n\n    ren.AddActor(actor);\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n    planeWidget.On();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Widgets/ImageTracerWidgetNonPlanar/","title":"ImageTracerWidgetNonPlanar","text":"

        vtk-examples/Java/Widgets/ImageTracerWidgetNonPlanar

        "},{"location":"Java/Widgets/ImageTracerWidgetNonPlanar/#description","title":"Description","text":"

        vtkImageTracerWidget object is designed for manually tracing over image data.

        The button actions and key modifiers are as follows for controlling the widget:

        1) Left button click over the image, hold and drag draws a free hand line.

        2) Left button click and release erases the widget line, if it exists, and repositions the first handle.

        3) Middle button click starts a snap drawn line. The line is terminated by clicking the middle button while depressing the ctrl key.

        4) When tracing a continuous or snap drawn line, if the last cursor position is within a specified tolerance to the first handle, the widget line will form a closed loop.

        5) Right button clicking and holding on any handle that is part of a snap drawn line allows handle dragging: existing line segments are updated accordingly. If the path is open and AutoClose is set to On, the path can be closed by repositioning the first and last points over one another.

        6) Ctrl key + right button down on any handle will erase it: existing snap drawn line segments are updated accordingly. If the line was formed by continuous tracing, the line is deleted leaving one handle.

        7) Shift key + right button down on any snap drawn line segment will insert a handle at the cursor position. The line segment is split accordingly.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/ImageTracerWidgetNonPlanar/#code","title":"Code","text":"

        ImageTracerWidgetNonPlanar.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkActor;\nimport vtk.vtkImageTracerWidget;\nimport vtk.vtkInteractorStyleTrackball;\nimport vtk.vtkSphereSource;\n\npublic class ImageTracerWidgetNonPlanar \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"LightCoral\",BgColor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    ren.AddActor(Actor);\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkInteractorStyleTrackball Style = new vtkInteractorStyleTrackball();\n    iren.SetInteractorStyle(Style);  \n\n    vtkImageTracerWidget TracerWidget = new vtkImageTracerWidget();\n    TracerWidget.SetInteractor(iren);\n    TracerWidget.SetViewProp(Actor);\n    TracerWidget.On();\n\n    ren.SetBackground(BgColor);\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Start();\n    iren.Initialize();\n\n  }\n}\n
        "},{"location":"Java/Widgets/LogoWidget/","title":"LogoWidget","text":"

        vtk-examples/Java/Widgets/LogoWidget

        "},{"location":"Java/Widgets/LogoWidget/#description","title":"Description","text":"

        vtkLogoWidget object provides support for interactively displaying and manipulating a logo.

        Logos are defined by an image and vtkLogoWidget allows you to interactively place and resize the image logo.

        To use this widget, simply create a vtkLogoRepresentation and associate it with the vtkLogoWidget. Turn the widget on before the render. Otherwise, it won't appear until you interact with the scene.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/LogoWidget/#code","title":"Code","text":"

        LogoWidget.java

        import vtk.vtkNamedColors;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkActor;\nimport vtk.vtkImageCanvasSource2D;\nimport vtk.vtkLogoRepresentation;\nimport vtk.vtkLogoWidget;  \n\npublic class LogoWidget\n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors(); \n\n    //Renderer Background Color\n    double Bgcolor[] = new double[] {0.2, 0.3, 0.4}; \n\n    //A sphere\n    vtkSphereSource sphereSource = new vtkSphereSource();\n    sphereSource.SetCenter(0.0, 0.0, 0.0);\n    sphereSource.SetRadius(4.0);\n    sphereSource.SetPhiResolution(4);\n    sphereSource.SetThetaResolution(8);\n    sphereSource.Update();\n\n    vtkPolyDataMapper mapper = new vtkPolyDataMapper();\n    mapper.SetInputConnection(sphereSource.GetOutputPort());\n\n    vtkActor actor = new vtkActor();\n    actor.SetMapper(mapper);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Create an image\n    vtkImageCanvasSource2D drawing = new vtkImageCanvasSource2D();\n    drawing.SetScalarTypeToUnsignedChar();\n    drawing.SetNumberOfScalarComponents(3);\n    drawing.SetExtent(0,200,0,200,0,0);\n\n    //Clear the image\n    // Note: SetDrawColour() uses double values of the rgb colors in the\n    //       range [0 ... 255]\n    //       So SetDrawColour(255, 255, 255) is white.\n    drawing.SetDrawColor(255, 127, 100);\n    drawing.FillBox(0,200,0,200);\n    drawing.SetDrawColor(0, 0, 0);\n    drawing.DrawCircle(100, 100, 50);\n    drawing.Update();\n\n    vtkLogoRepresentation logoRepresentation = new vtkLogoRepresentation();\n    logoRepresentation.SetImage(drawing.GetOutput());\n    logoRepresentation.SetPosition(0,0);\n    logoRepresentation.SetPosition2(.4, .4);\n    logoRepresentation.GetImageProperty().SetOpacity(.7);\n\n    vtkLogoWidget logoWidget = new vtkLogoWidget();\n    logoWidget.SetInteractor(iren);\n    logoWidget.SetRepresentation(logoRepresentation);\n    logoWidget.On();\n\n    ren.SetBackground(Bgcolor);\n    ren.AddActor(actor);\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n  }\n}\n
        "},{"location":"Java/Widgets/OrientationMarkerWidget/","title":"OrientationMarkerWidget","text":"

        vtk-examples/Java/Widgets/OrientationMarkerWidget

        "},{"location":"Java/Widgets/OrientationMarkerWidget/#description","title":"Description","text":"

        vtkOrientationMarkerWidget object provides support for interactively manipulating the position, size, and apparent orientation of a prop that represents an orientation marker.

        This class works by adding its internal renderer to an external \"parent\" renderer on a different layer. The input orientation marker is rendered as an overlay on the parent renderer and, thus, appears superposed over all props in the parent's scene.

        The camera view of the orientation the marker is made to match that of the parent's by means of an observer mechanism, giving the illusion that the orientation of the marker reflects that of the prop(s) in the parent's scene.

        The widget listens to left mouse button and mouse movement events. It will change the cursor shape based on its location. If the cursor is over the overlay renderer, it will change the cursor shape to a SIZEALL shape or to a resize corner shape (e.g., SIZENW) if the cursor is near a corner. If the left mouse button is pressed and held down while moving, the overlay renderer, and hence, the orientation marker, is resized or moved. In the case of a resize operation, releasing the left mouse button causes the widget to enforce its renderer to be square. The diagonally opposite corner to the one moved is repositioned such that all edges of the renderer have the same length: the minimum.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/OrientationMarkerWidget/#code","title":"Code","text":"

        OrientationMarkerWidget.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkRenderer;\nimport vtk.vtkActor;\nimport vtk.vtkNamedColors;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkXMLPolyDataReader;\nimport vtk.vtkDataSetMapper;\nimport vtk.vtkOrientationMarkerWidget;\nimport vtk.vtkSuperquadricSource;\n\n\npublic class OrientationMarkerWidget \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    //parse command line arguments\n    if (args.length != 1) \n    {\n      System.err.println(\"Usage: java -classpath ... Filename(.vtp) e.g Bunny.vtp\");\n      return;\n    }\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For icon Actor Color\n    double iconActorColor[] = new double[4];\n    //For superquadricActor Color\n    double superquadricActorColor[] = new double[4];\n    //Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Change icon Actor Color\n    Color.GetColor(\"Silver\",iconActorColor);\n    //Change Color Name to Use your own Color for Change icon superquadricActorColor\n    Color.GetColor(\"Carrot\",superquadricActorColor);\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    //Read the polydata for the icon\n    vtkXMLPolyDataReader reader =  new vtkXMLPolyDataReader();\n    reader.SetFileName(args[0]);\n\n    vtkDataSetMapper iconMapper = new vtkDataSetMapper();\n    iconMapper.SetInputConnection(reader.GetOutputPort());\n\n    vtkActor iconActor = new vtkActor();\n    iconActor.SetMapper(iconMapper);\n    iconActor.GetProperty().SetColor(iconActorColor);\n\n    //Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Set up the widget\n    vtkOrientationMarkerWidget widget = new vtkOrientationMarkerWidget();\n    widget.SetOrientationMarker( iconActor );\n    widget.SetInteractor( iren );\n    widget.SetViewport( 0.0, 0.0, 0.2, 0.2 );\n    widget.SetEnabled( 1 );\n    widget.InteractiveOn();\n\n    //Create a superquadric\n    vtkSuperquadricSource superquadricSource = new vtkSuperquadricSource();\n    superquadricSource.SetPhiRoundness(0.2);\n    superquadricSource.SetThetaRoundness(0.8);\n\n    //Create a mapper and actor\n    vtkPolyDataMapper superquadricMapper = new vtkPolyDataMapper();\n    superquadricMapper.SetInputConnection(superquadricSource.GetOutputPort());\n\n    vtkActor superquadricActor = new vtkActor();\n    superquadricActor.SetMapper(superquadricMapper);\n    superquadricActor.GetProperty().SetInterpolationToFlat();\n    superquadricActor.GetProperty().SetDiffuseColor(superquadricActorColor);\n    superquadricActor.GetProperty().SetSpecularColor(1.0, 1.0, 1.0);\n    superquadricActor.GetProperty().SetDiffuse(.6);\n    superquadricActor.GetProperty().SetSpecular(.5);\n    superquadricActor.GetProperty().SetSpecularPower(5.0);\n\n    ren.AddActor(superquadricActor);\n    ren.SetBackground(BgColor);\n    ren.ResetCamera();\n\n    renWin.SetSize(300,300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Widgets/PlaneWidget/","title":"PlaneWidget","text":"

        vtk-examples/Java/Widgets/PlaneWidget

        Description:

        vtkPlaneWidget defines a finite (bounded) plane that can be interactively placed in a scene. The plane has four handles (at its corner vertices), a normal vector, and the plane itself. The handles are used to resize the plane; the normal vector to rotate it, and the plane can be picked and translated.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/PlaneWidget/#code","title":"Code","text":"

        PlaneWidget.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkPlaneWidget;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\n\npublic class PlaneWidget \n{\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"SlateGray\",BgColor);\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetInteractor(iren);\n    iren.SetRenderWindow(renWin);\n    ren.ResetCamera();\n    ren.SetBackground(BgColor);\n\n    // Angle Widget  \n    vtkPlaneWidget PlaneWidget = new vtkPlaneWidget();\n    PlaneWidget.SetInteractor(iren);\n\n    PlaneWidget.On();\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Start();\n    iren.Initialize();\n\n  }\n}\n
        "},{"location":"Java/Widgets/SeedWidget/","title":"SeedWidget","text":"

        vtk-examples/Java/Widgets/SeedWidget

        "},{"location":"Java/Widgets/SeedWidget/#description","title":"Description","text":"

        This example demonstrates how to use vtkSeedWidget, which generates (seeds) points to be placed in the scene in the locations where the user clicks.

        The points can then be used for operations like connectivity, segmentation, and region growing. For an example using a custom callback where such operations can be assembled, see SeedWidgetWithCustomCallback.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/SeedWidget/#code","title":"Code","text":"

        SeedWidget.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSphereSource;\nimport vtk.vtkSeedWidget;\nimport vtk.vtkSeedRepresentation;\nimport vtk.vtkPointHandleRepresentation2D;\n\npublic class SeedWidget \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n  public static void main(String args[]) \n  {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    colors.GetColor(\"Crimson\", actorColor);\n    colors.GetColor(\"MediumAquamarine\", Bgcolor);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    vtkPointHandleRepresentation2D HandleRep = new vtkPointHandleRepresentation2D();\n    HandleRep.GetProperty().SetColor(actorColor);\n\n    vtkSeedRepresentation WidgetRep = new vtkSeedRepresentation();\n    WidgetRep.SetHandleRepresentation(HandleRep);\n\n    // Create the seed widget\n    vtkSeedWidget SeedWidget = new vtkSeedWidget();\n    SeedWidget.SetInteractor(iren);\n    SeedWidget.SetRepresentation(WidgetRep);\n\n    SeedWidget.On();\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n\n    iren.Initialize();\n    iren.Start();\n\n  }\n}\n
        "},{"location":"Java/Widgets/SplineWidget/","title":"SplineWidget","text":"

        vtk-examples/Java/Widgets/SplineWidget

        "},{"location":"Java/Widgets/SplineWidget/#description","title":"Description","text":"

        Java Program to demonstrate the SplineWidget.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/SplineWidget/#code","title":"Code","text":"

        SplineWidget.java

        import vtk.vtkNativeLibrary;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkSplineWidget2;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderWindow;\nimport vtk.vtkRenderer;\n\n\npublic class SplineWidget  \n{\n\n  // -----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n        if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n    vtkNativeLibrary.DisableOutputWindow(null);\n  }\n  // -----------------------------------------------------------------\n\n\n  public static void main(String s[]) \n  {\n\n    vtkNamedColors Color = new vtkNamedColors(); \n\n    //For Renderer Background Color\n    double BgColor[] = new double[4];\n    //Change Color Name to Use your own Color for Renderer Background\n    Color.GetColor(\"DarkSalmon\",BgColor);\n\n    // An interactor\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    renWin.SetInteractor(iren);\n    iren.SetRenderWindow(renWin);\n    ren.ResetCamera();\n    ren.SetBackground(BgColor);\n\n    vtkSplineWidget2 splineWidget = new vtkSplineWidget2();\n    splineWidget.SetInteractor(iren);\n\n\n    iren.Initialize();\n    splineWidget.On();\n    iren.Start();\n\n  }\n\n}\n
        "},{"location":"Java/Widgets/TextWidget/","title":"TextWidget","text":"

        vtk-examples/Java/Widgets/TextWidget

        "},{"location":"Java/Widgets/TextWidget/#description","title":"Description","text":"

        vtkTextWidget object provides support for interactively placing text on the 2D overlay plane.

        The text is defined by an instance of vtkTextActor object.

        Other languages

        See (Cxx), (Python)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Java/Widgets/TextWidget/#code","title":"Code","text":"

        TextWidget.java

        import vtk.vtkRenderWindow;\nimport vtk.vtkActor;\nimport vtk.vtkNativeLibrary;\nimport vtk.vtkPolyDataMapper;\nimport vtk.vtkNamedColors;\nimport vtk.vtkRenderer;\nimport vtk.vtkSphereSource;\nimport vtk.vtkRenderWindowInteractor;\nimport vtk.vtkTextActor;\nimport vtk.vtkTextRepresentation;\nimport vtk.vtkTextWidget;\n\n\npublic class TextWidget \n{\n\n  //-----------------------------------------------------------------\n  // Load VTK library and print which library was not properly loaded\n  static \n  {\n    if (!vtkNativeLibrary.LoadAllNativeLibraries()) \n    {\n      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) \n      {\n         if (!lib.IsLoaded()) \n        {\n          System.out.println(lib.GetLibraryName() + \" not loaded\");\n        }\n      }\n    }\n   vtkNativeLibrary.DisableOutputWindow(null);\n  }\n // -----------------------------------------------------------------\n\n public static void main(String args[]) \n {\n\n    vtkNamedColors colors = new vtkNamedColors();\n\n    //For Actor Color\n    double actorColor[] = new double[4];\n\n    //Renderer Background Color\n    double Bgcolor[] = new double[4];\n\n    //TextColor \n    double TextColor[] = new double[4];\n\n    colors.GetColor(\"DimGray\", actorColor);\n    colors.GetColor(\"MidnightBlue\", Bgcolor);\n    colors.GetColor(\"Yellow\", TextColor);\n\n    // Create the renderer, render window and interactor.\n    vtkRenderer ren = new vtkRenderer();\n    vtkRenderWindow renWin = new vtkRenderWindow();\n    renWin.AddRenderer(ren);\n    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();\n    iren.SetRenderWindow(renWin);\n\n    //Create a Sphere\n    vtkSphereSource Sphere = new vtkSphereSource();\n    Sphere.Update();\n\n    //Create a Mapper and Actor\n    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();\n    Mapper.SetInputConnection(Sphere.GetOutputPort());\n\n    vtkActor Actor = new vtkActor();\n    Actor.SetMapper(Mapper);\n    Actor.GetProperty().SetColor(actorColor);\n\n    // Create the text widget\n    vtkTextActor TextActor = new vtkTextActor();\n    TextActor.SetInput(\"This is a Sphere\");\n    TextActor.GetTextProperty().SetColor(TextColor);\n    TextActor.GetTextProperty().SetFontFamilyToCourier();\n\n    vtkTextWidget TextWidget = new vtkTextWidget();\n\n    vtkTextRepresentation TextRepresentation = new vtkTextRepresentation();\n    TextRepresentation.GetPositionCoordinate().SetValue(0.15, 0.15);\n    TextRepresentation.GetPosition2Coordinate().SetValue(0.7, 0.2);\n    TextWidget.SetRepresentation(TextRepresentation);\n    TextWidget.SetInteractor(iren);\n    TextWidget.SetTextActor(TextActor);\n    TextWidget.SelectableOff();\n\n\n    //Visualize the actor\n    ren.AddActor(Actor);\n    ren.SetBackground(Bgcolor);\n\n    renWin.SetSize(300, 300);\n    renWin.Render();\n    TextWidget.On();\n\n    iren.Initialize();\n    iren.Start();\n  }  \n}\n
        "},{"location":"Python/Snippets/","title":"Snippets","text":""},{"location":"Python/Snippets/#description","title":"Description","text":"

        Snippets are chunks of code that can be cut (snipped) and pasted into examples. We want each example to be stand-alone, so we do not keep the snippet code in a library.

        "},{"location":"Python/Snippets/#available-snippets","title":"Available snippets","text":""},{"location":"Python/Snippets/#cameraposition","title":"CameraPosition","text":"

        Output the camera position while moving the image.

        "},{"location":"Python/Snippets/#checkvtkversion","title":"CheckVTKVersion","text":"

        Check the VTK version returning True if the requested VTK version is >= the current version.

        "},{"location":"Python/Snippets/#pointtoglyph","title":"PointToGlyph","text":"

        Represent points as glyphs.

        "},{"location":"Python/Snippets/#getprogramparameters","title":"GetProgramParameters","text":"

        Get the program parameters.

        "},{"location":"Python/Snippets/#readpolydata","title":"ReadPolyData","text":"

        Uses the appropriate vtkPolyData reader to read any vtkPolyData file.

        "},{"location":"Python/Snippets/#writeimage","title":"WriteImage","text":"

        Take a screen shot from the render window and write it to a file. The file extension selects the writer to use.

        "},{"location":"Python/Annotation/MultiLineText/","title":"MultiLineText","text":"

        vtk-examples/Python/Annotation/MultiLineText

        "},{"location":"Python/Annotation/MultiLineText/#description","title":"Description","text":"

        This example demonstrates the use of multiline 2D text using vtkTextMapper. It shows several justifications as well as single-line and multiple-line text inputs.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Annotation/MultiLineText/#code","title":"Code","text":"

        MultiLineText.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor2D,\n    vtkCoordinate,\n    vtkPolyDataMapper2D,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    font_size = 24\n\n    # Create the text mappers and the associated Actor2Ds.\n    # The font and text properties (except justification) are the same for\n    # each single line mapper. Let's create a common text property object\n    singleLineTextProp = vtkTextProperty()\n    singleLineTextProp.SetFontSize(font_size)\n    singleLineTextProp.SetFontFamilyToArial()\n    singleLineTextProp.BoldOff()\n    singleLineTextProp.ItalicOff()\n    singleLineTextProp.ShadowOff()\n\n    # The font and text properties (except justification) are the same for\n    # each multi line mapper. Let's create a common text property object\n    multiLineTextProp = vtkTextProperty()\n    multiLineTextProp.ShallowCopy(singleLineTextProp)\n    multiLineTextProp.BoldOn()\n    multiLineTextProp.ItalicOn()\n    multiLineTextProp.ShadowOn()\n    multiLineTextProp.SetLineSpacing(0.8)\n\n    colors = vtkNamedColors()\n\n    # The text is on a single line and bottom-justified.\n    singleLineTextB = vtkTextMapper()\n    singleLineTextB.SetInput('Single line (bottom)')\n    tprop = singleLineTextB.GetTextProperty()\n    tprop.ShallowCopy(singleLineTextProp)\n    tprop.SetVerticalJustificationToBottom()\n    tprop.SetColor(colors.GetColor3d('Tomato'))\n\n    singleLineTextActorB = vtkActor2D()\n    singleLineTextActorB.SetMapper(singleLineTextB)\n    singleLineTextActorB.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    singleLineTextActorB.GetPositionCoordinate().SetValue(0.05, 0.85)\n\n    # The text is on a single line and center-justified (vertical justification).\n    singleLineTextC = vtkTextMapper()\n    singleLineTextC.SetInput('Single line (centered)')\n    tprop = singleLineTextC.GetTextProperty()\n    tprop.ShallowCopy(singleLineTextProp)\n    tprop.SetVerticalJustificationToCentered()\n    tprop.SetColor(colors.GetColor3d('DarkGreen'))\n    singleLineTextActorC = vtkActor2D()\n\n    singleLineTextActorC.SetMapper(singleLineTextC)\n    singleLineTextActorC.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    singleLineTextActorC.GetPositionCoordinate().SetValue(0.05, 0.75)\n\n    # The text is on a single line and top-justified.\n    singleLineTextT = vtkTextMapper()\n    singleLineTextT.SetInput('Single line (top)')\n    tprop = singleLineTextT.GetTextProperty()\n    tprop.ShallowCopy(singleLineTextProp)\n    tprop.SetVerticalJustificationToTop()\n    tprop.SetColor(colors.GetColor3d('Peacock'))\n\n    singleLineTextActorT = vtkActor2D()\n    singleLineTextActorT.SetMapper(singleLineTextT)\n    singleLineTextActorT.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    singleLineTextActorT.GetPositionCoordinate().SetValue(0.05, 0.65)\n\n    # The text is on multiple lines and left- and top-justified.\n    textMapperL = vtkTextMapper()\n    textMapperL.SetInput('This is\\nmulti-line\\ntext output\\n(left-top)')\n    tprop = textMapperL.GetTextProperty()\n    tprop.ShallowCopy(multiLineTextProp)\n    tprop.SetJustificationToLeft()\n    tprop.SetVerticalJustificationToTop()\n    tprop.SetColor(colors.GetColor3d('Tomato'))\n\n    textActorL = vtkActor2D()\n    textActorL.SetMapper(textMapperL)\n    textActorL.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    textActorL.GetPositionCoordinate().SetValue(0.05, 0.5)\n\n    # The text is on multiple lines and center-justified (both horizontal and vertical).\n    textMapperC = vtkTextMapper()\n    textMapperC.SetInput('This is\\nmulti-line\\ntext output\\n(centered)')\n    tprop = textMapperC.GetTextProperty()\n    tprop.ShallowCopy(multiLineTextProp)\n    tprop.SetJustificationToCentered()\n    tprop.SetVerticalJustificationToCentered()\n    tprop.SetColor(colors.GetColor3d('DarkGreen'))\n\n    textActorC = vtkActor2D()\n    textActorC.SetMapper(textMapperC)\n    textActorC.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    textActorC.GetPositionCoordinate().SetValue(0.5, 0.5)\n\n    # The text is on multiple lines and right- and bottom-justified.\n    textMapperR = vtkTextMapper()\n    textMapperR.SetInput('This is\\nmulti-line\\ntext output\\n(right-bottom)')\n    tprop = textMapperR.GetTextProperty()\n    tprop.ShallowCopy(multiLineTextProp)\n    tprop.SetJustificationToRight()\n    tprop.SetVerticalJustificationToBottom()\n    tprop.SetColor(colors.GetColor3d('Peacock'))\n\n    textActorR = vtkActor2D()\n    textActorR.SetMapper(textMapperR)\n    textActorR.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    textActorR.GetPositionCoordinate().SetValue(0.95, 0.5)\n\n    # Draw the grid to demonstrate the placement of the text.\n\n    # Set up the necessary points.\n    Pts = vtkPoints()\n    Pts.InsertNextPoint(0.05, 0.0, 0.0)\n    Pts.InsertNextPoint(0.05, 1.0, 0.0)\n    Pts.InsertNextPoint(0.5, 0.0, 0.0)\n    Pts.InsertNextPoint(0.5, 1.0, 0.0)\n    Pts.InsertNextPoint(0.95, 0.0, 0.0)\n    Pts.InsertNextPoint(0.95, 1.0, 0.0)\n    Pts.InsertNextPoint(0.0, 0.5, 0.0)\n    Pts.InsertNextPoint(1.0, 0.5, 0.0)\n    Pts.InsertNextPoint(0.00, 0.85, 0.0)\n    Pts.InsertNextPoint(0.50, 0.85, 0.0)\n    Pts.InsertNextPoint(0.00, 0.75, 0.0)\n    Pts.InsertNextPoint(0.50, 0.75, 0.0)\n    Pts.InsertNextPoint(0.00, 0.65, 0.0)\n    Pts.InsertNextPoint(0.50, 0.65, 0.0)\n\n    # Set up the lines that use these points.\n    Lines = vtkCellArray()\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(0)\n    Lines.InsertCellPoint(1)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(2)\n    Lines.InsertCellPoint(3)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(4)\n    Lines.InsertCellPoint(5)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(6)\n    Lines.InsertCellPoint(7)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(8)\n    Lines.InsertCellPoint(9)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(10)\n    Lines.InsertCellPoint(11)\n    Lines.InsertNextCell(2)\n    Lines.InsertCellPoint(12)\n    Lines.InsertCellPoint(13)\n\n    # Create a grid that uses these points and lines.\n    Grid = vtkPolyData()\n    Grid.SetPoints(Pts)\n    Grid.SetLines(Lines)\n    # Set up the coordinate system.\n    normCoords = vtkCoordinate()\n    normCoords.SetCoordinateSystemToNormalizedViewport()\n\n    # Set up the mapper and actor (2D) for the grid.\n    mapper = vtkPolyDataMapper2D()\n    mapper.SetInputData(Grid)\n    mapper.SetTransformCoordinate(normCoords)\n    gridActor = vtkActor2D()\n    gridActor.SetMapper(mapper)\n    gridActor.GetProperty().SetColor(colors.GetColor3d('DimGray'))\n\n    # Create the Renderer, RenderWindow, and RenderWindowInteractor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the renderer set the background and size zoom in closer to the image render\n    renderer.AddActor2D(textActorL)\n    renderer.AddActor2D(textActorC)\n    renderer.AddActor2D(textActorR)\n    renderer.AddActor2D(singleLineTextActorB)\n    renderer.AddActor2D(singleLineTextActorC)\n    renderer.AddActor2D(singleLineTextActorT)\n    renderer.AddActor2D(gridActor)\n\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n    renderWindow.SetSize(640, 480)\n    renderer.GetActiveCamera().Zoom(1.5)\n\n    # Enable user interface interactor\n    interactor.Initialize()\n    renderWindow.SetWindowName('MultiLineText')\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Annotation/TextOrigin/","title":"TextOrigin","text":"

        vtk-examples/Python/Annotation/TextOrigin

        "},{"location":"Python/Annotation/TextOrigin/#description","title":"Description","text":"

        This example demonstrates the use of vtkVectorText and vtkFollower. vtkVectorText is used to create 3D annotation. vtkFollower is used to position the 3D text and to ensure that the text always faces the renderer's active camera (i.e., the text is always readable).

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Annotation/TextOrigin/#code","title":"Code","text":"

        TextOrigin.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkAxes\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkFollower,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the axes and the associated mapper and actor.\n    axes = vtkAxes()\n    axes.SetOrigin(0, 0, 0)\n    axesMapper = vtkPolyDataMapper()\n    axesMapper.SetInputConnection(axes.GetOutputPort())\n    axesActor = vtkActor()\n    axesActor.SetMapper(axesMapper)\n\n    # Create the 3D text and the associated mapper and follower (a type of actor).  Position the text so it is displayed over the origin of the axes.\n    atext = vtkVectorText()\n    atext.SetText('Origin')\n    textMapper = vtkPolyDataMapper()\n    textMapper.SetInputConnection(atext.GetOutputPort())\n    textActor = vtkFollower()\n    textActor.SetMapper(textMapper)\n    textActor.SetScale(0.2, 0.2, 0.2)\n    textActor.AddPosition(0, -0.1, 0)\n    textActor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n\n    # Create the Renderer, RenderWindow, and RenderWindowInteractor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    style = vtkInteractorStyleTrackballCamera()\n    interactor.SetInteractorStyle(style)\n\n    # Add the actors to the renderer.\n    renderer.AddActor(axesActor)\n    renderer.AddActor(textActor)\n\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # Zoom in closer.\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Zoom(1.6)\n\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # Reset the clipping range of the camera; set the camera of the follower; render.\n    renderer.ResetCameraClippingRange()\n    textActor.SetCamera(renderer.GetActiveCamera())\n\n    interactor.Initialize()\n    renderWindow.SetWindowName('TextOrigin')\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Arrays/GetValues/","title":"GetValues","text":"

        vtk-examples/Python/Arrays/GetValues

        "},{"location":"Python/Arrays/GetValues/#description","title":"Description","text":"

        Get values from a vtkPolyData source, normals in this case.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Arrays/GetValues/#code","title":"Code","text":"

        GetValues.py

        #!/usr/bin/env python\n\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\n\n\ndef main():\n    # setup sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    polydata = vtkPolyData()\n    polydata.ShallowCopy(sphereSource.GetOutput())\n\n    normals = polydata.GetPointData().GetNormals()\n    normal0 = normals.GetTuple3(0)\n\n    print('Normal0: {:3.1f} {:3.1f} {:3.1f}'.format(normal0[0], normal0[1], normal0[2]))\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Arrays/RenameArray/","title":"RenameArray","text":"

        vtk-examples/Python/Arrays/RenameArray

        "},{"location":"Python/Arrays/RenameArray/#description","title":"Description","text":"

        Renaming the normals array.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Arrays/RenameArray/#code","title":"Code","text":"

        RenameArray.py

        #!/usr/bin/env python\n\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef main():\n    # setup sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    polydata = vtkPolyData()\n    polydata.ShallowCopy(sphereSource.GetOutput())\n\n    normals = polydata.GetPointData().GetNormals()\n    normals.SetName('TestN')\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName('Test.vtp')\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/CompositeData/CompositePolyDataMapper/","title":"CompositePolyDataMapper","text":"

        vtk-examples/Python/CompositeData/CompositePolyDataMapper

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/CompositeData/CompositePolyDataMapper/#code","title":"Code","text":"

        CompositePolyDataMapper.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCompositeDataDisplayAttributes,\n    vtkCompositePolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create Sphere 1.\n    sphere1 = vtkSphereSource()\n    sphere1.SetRadius(3)\n    sphere1.SetCenter(0, 0, 0)\n    sphere1.Update()\n\n    # Create Sphere 2.\n    sphere2 = vtkSphereSource()\n    sphere2.SetRadius(2)\n    sphere2.SetCenter(2, 0, 0)\n    sphere2.Update()\n\n    mbds = vtkMultiBlockDataSet()\n    mbds.SetNumberOfBlocks(3)\n    mbds.SetBlock(0, sphere1.GetOutput())\n    # Leave block 1 NULL.  NULL blocks are valid and should be handled by\n    # algorithms that process multiblock datasets.  Especially when\n    # running in parallel where the blocks owned by other processes are\n    # NULL in this process.\n    mbds.SetBlock(2, sphere2.GetOutput())\n\n    # Use vtkCompositePolyDataMapper2 if VTK Version < 90020230516\n    mapper = vtkCompositePolyDataMapper()\n    mapper.SetInputDataObject(mbds)\n    cdsa = vtkCompositeDataDisplayAttributes()\n    mapper.SetCompositeDataDisplayAttributes(cdsa)\n\n    # You can use the vtkCompositeDataDisplayAttributes to set the color,\n    # opacity and visibiliy of individual blocks of the multiblock dataset.\n    # Attributes are mapped by block pointers (vtkDataObject*), so these can\n    # be queried by their flat index through a convenience function in the\n    # attribute class (vtkCompositeDataDisplayAttributes::DataObjectFromIndex).\n    # Alternatively, one can set attributes directly through the mapper using\n    # flat indices.\n    #\n    # This sets the block at flat index 3 red\n    # Note that the index is the flat index in the tree, so the whole multiblock\n    # is index 0 and the blocks are flat indexes 1, 2 and 3.  This affects\n    # the block returned by mbds.GetBlock(2).\n    mapper.SetBlockColor(3, colors.GetColor3d('Red'))\n    # Color the spheres.\n    mapper.SetBlockColor(1, colors.GetColor3d('LavenderBlush'))\n    mapper.SetBlockColor(2, colors.GetColor3d('Lavender'))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create the Renderer, RenderWindow, and RenderWindowInteractor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Enable user interface interactor.\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SteelBlue'))\n    renderWindow.SetWindowName('CompositePolyDataMapper')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/CompositeData/MultiBlockDataSet/","title":"MultiBlockDataSet","text":"

        vtk-examples/Python/CompositeData/MultiBlockDataSet

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/CompositeData/MultiBlockDataSet/#code","title":"Code","text":"

        MultiBlockDataSet.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet\n\n# vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n# VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\ntry:\n    from vtkmodules.vtkFiltersCore import vtkExtractEdges\nexcept ImportError:\n    from vtkmodules.vtkFiltersExtraction import vtkExtractEdges\nfrom vtkmodules.vtkFiltersGeometry import vtkCompositeDataGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # PART 1 Make some Data.\n    # Make a tree.\n    root = vtkMultiBlockDataSet()\n\n    branch = vtkMultiBlockDataSet()\n    root.SetBlock(0, branch)\n\n    # Make some leaves.\n    leaf1 = vtkSphereSource()\n    leaf1.SetCenter(0, 0, 0)\n    leaf1.Update()\n    branch.SetBlock(0, leaf1.GetOutput())\n\n    leaf2 = vtkSphereSource()\n    leaf2.SetCenter(1.75, 2.5, 0)\n    leaf2.SetRadius(1.5)\n    leaf2.Update()\n    branch.SetBlock(1, leaf2.GetOutput())\n\n    leaf3 = vtkSphereSource()\n    leaf3.SetCenter(4, 0, 0)\n    leaf3.SetRadius(2)\n    leaf3.Update()\n    root.SetBlock(1, leaf3.GetOutput())\n\n    # PART 2 Do something with the data\n    # a non composite aware filter, the pipeline will iterate\n    edges = vtkExtractEdges()\n    edges.SetInputData(root)\n\n    # PART 3 Show the data\n    # also demonstrate a composite aware filter\n    # this filter aggregates all blocks into one polydata\n    # this is handy for display, although fairly limited.\n    polydata = vtkCompositeDataGeometryFilter()\n    polydata.SetInputConnection(edges.GetOutputPort())\n\n    # Create the Renderer, RenderWindow, and RenderWindowInteractor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(0, polydata.GetOutputPort(0))\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n    actor.GetProperty().SetLineWidth(2)\n    actor.SetMapper(mapper)\n\n    # Enable user interface interactor.\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('CornflowerBlue'))\n    renderWindow.SetWindowName('MultiBlockDataSet')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/CompositeData/OverlappingAMR/","title":"OverlappingAMR","text":"

        vtk-examples/Python/CompositeData/OverlappingAMR

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/CompositeData/OverlappingAMR/#code","title":"Code","text":"

        OverlappingAMR.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkAMRBox,\n    vtkOverlappingAMR,\n    vtkSphere,\n    vtkUniformGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersGeometry import vtkCompositeDataGeometryFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef MakeScalars(dims, origin, spacing, scalars):\n    # Implicit function used to compute scalars\n    sphere = vtkSphere()\n    sphere.SetRadius(3)\n    sphere.SetCenter(5, 5, 5)\n    scalars.SetNumberOfTuples(dims[0] * dims[1] * dims[2])\n    for k in range(0, dims[2]):\n        z = origin[2] + spacing[2] * k\n        for j in range(0, dims[1]):\n            y = origin[1] + spacing[1] * j\n            for i in range(0, dims[0]):\n                x = origin[0] + spacing[0] * i\n                scalars.SetValue(k * dims[0] * dims[1] + j * dims[0] + i, sphere.EvaluateFunction(x, y, z))\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create and populate the AMR dataset\n    # The dataset should look like\n    # Level 0\n    #   uniform grid, dimensions 11, 11, 11, AMR box (0, 0, 0) - (9, 9, 9) \n    # Level 1 - refinement ratio : 2\n    #   uniform grid, dimensions 11, 11, 11, AMR box (0, 0, 0) - (9, 9, 9)\n    #   uniform grid, dimensions 11, 11, 11, AMR box (10, 10, 10) - (19, 19, 19)\n    # Use MakeScalars() above to fill the scalar arrays\n\n    amr = vtkOverlappingAMR()\n    blocksPerLevel = [1, 2]\n    amr.Initialize(2, blocksPerLevel)\n\n    origin = [0.0, 0.0, 0.0]\n    spacing = [1.0, 1.0, 1.0]\n    dims = [11, 11, 11]\n\n    ug1 = vtkUniformGrid()\n    # Geometry\n    ug1.SetOrigin(origin)\n    ug1.SetSpacing(spacing)\n    ug1.SetDimensions(dims)\n\n    # Data\n    scalars = vtkFloatArray()\n    ug1.GetPointData().SetScalars(scalars)\n    MakeScalars(dims, origin, spacing, scalars)\n\n    lo = [0, 0, 0]\n    hi = [9, 9, 9]\n    box1 = vtkAMRBox()\n    amr.SetAMRBox(0, 0, box1)\n    amr.SetDataSet(0, 0, ug1)\n\n    spacing2 = [0.5, 0.5, 0.5]\n    ug2 = vtkUniformGrid()\n    # Geometry\n    ug2.SetOrigin(origin)\n    ug2.SetSpacing(spacing2)\n    ug2.SetDimensions(dims)\n\n    # Data\n    scalars2 = vtkFloatArray()\n    ug2.GetPointData().SetScalars(scalars2)\n    MakeScalars(dims, origin, spacing2, scalars2)\n\n    lo2 = [0, 0, 0]\n    hi2 = [9, 9, 9]\n    box2 = vtkAMRBox()\n    amr.SetAMRBox(1, 0, box2)\n    amr.SetDataSet(1, 0, ug2)\n\n    origin3 = [5, 5, 5]\n    ug3 = vtkUniformGrid()\n\n    # Geometry\n    ug3.SetOrigin(origin3)\n    ug3.SetSpacing(spacing2)\n    ug3.SetDimensions(dims)\n\n    # Data\n    scalars3 = vtkFloatArray()\n    ug3.GetPointData().SetScalars(scalars3)\n    MakeScalars(dims, origin3, spacing2, scalars3)\n\n    lo3 = [10, 10, 10]\n    hi3 = [19, 19, 19]\n    box3 = vtkAMRBox()\n    amr.SetAMRBox(1, 1, box3)\n    amr.SetDataSet(1, 1, ug3)\n    amr.SetRefinementRatio(0, 2)\n\n    # Render the amr data here.\n    of = vtkOutlineFilter()\n    of.SetInputData(amr)\n\n    geomFilter = vtkCompositeDataGeometryFilter()\n    geomFilter.SetInputConnection(of.GetOutputPort())\n\n    # Create an iso-surface - at 10.\n    cf = vtkContourFilter()\n    cf.SetInputData(amr)\n    cf.SetNumberOfContours(1)\n    cf.SetValue(0, 10.0)\n\n    geomFilter2 = vtkCompositeDataGeometryFilter()\n    geomFilter2.SetInputConnection(cf.GetOutputPort())\n\n    # Create the render window, renderer, and interactor.\n    aren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(aren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Associate the geometry with a mapper and the mapper to an actor.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(of.GetOutputPort())\n    actor1 = vtkActor()\n    actor1.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n    actor1.SetMapper(mapper)\n\n    # Associate the geometry with a mapper and the mapper to an actor.\n    mapper2 = vtkPolyDataMapper()\n    mapper2.SetInputConnection(geomFilter2.GetOutputPort())\n    actor2 = vtkActor()\n    actor2.SetMapper(mapper2)\n\n    # Add the actor to the renderer and start handling events.\n    aren.AddActor(actor1)\n    aren.AddActor(actor2)\n    aren.SetBackground(colors.GetColor3d('CornflowerBlue'))\n    renWin.SetWindowName('OverlappingAMR')\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Coverage/PythonVTKClassesNotUsed/","title":"VTK Classes not used in the Examples","text":""},{"location":"Python/Coverage/PythonVTKClassesNotUsed/#python","title":"Python","text":"

        Out of 3113 available VTK classes, 2660 have not been used.

        VTK Class VTK Class VTK Class VTK Class VTK Class vtk2DHistogramItem vtk3DCursorRepresentation vtk3DCursorWidget vtk3DLinearGridCrinkleExtractor vtk3DLinearGridInternal vtk3DLinearGridPlaneCutter vtk3DWidget vtkABI vtkADIOS2CoreImageReader vtkADIOS2VTXReader vtkAMRBaseParticlesReader vtkAMRBaseReader vtkAMRCutPlane vtkAMRDataInternals vtkAMRDataSetCache vtkAMREnzoParticlesReader vtkAMREnzoReader vtkAMREnzoReaderInternal vtkAMRFlashParticlesReader vtkAMRFlashReader vtkAMRFlashReaderInternal vtkAMRGaussianPulseSource vtkAMRInformation vtkAMRInterpolatedVelocityField vtkAMRResampleFilter vtkAMRSliceFilter vtkAMRToMultiBlockFilter vtkAMRUtilities vtkAMRVelodyneReader vtkAMRVelodyneReaderInternal vtkAMRVolumeMapper vtkAMReXGridHeader vtkAMReXGridLevelHeader vtkAMReXGridReader vtkAMReXGridReaderInternal vtkAMReXParticlesReader vtkAOSDataArrayTemplate vtkASCIITextCodec vtkAVIWriter vtkAVSucdReader vtkAbstractArray vtkAbstractCellArray vtkAbstractCellLinks vtkAbstractCellLocator vtkAbstractContextBufferId vtkAbstractContextItem vtkAbstractElectronicData vtkAbstractGridConnectivity vtkAbstractHyperTreeGridMapper vtkAbstractImageInterpolator vtkAbstractInteractionDevice vtkAbstractInterpolatedVelocityField vtkAbstractMapper vtkAbstractMapper3D vtkAbstractParticleWriter vtkAbstractPicker vtkAbstractPointLocator vtkAbstractPolyDataReader vtkAbstractPolygonalHandleRepresentation3D vtkAbstractPropPicker vtkAbstractRenderDevice vtkAbstractSplineRepresentation vtkAbstractTransform vtkAbstractVolumeMapper vtkAbstractWidget vtkActor2DCollection vtkActorCollection vtkActorNode vtkAdaptiveDataSetSurfaceFilter vtkAdaptiveResampleToImage vtkAdaptiveSubdivisionFilter vtkAdaptiveTemporalInterpolator vtkAddMembershipArray vtkAdjacencyMatrixToEdgeTable vtkAdjacentVertexIterator vtkAffineRepresentation vtkAffineRepresentation2D vtkAffineWidget vtkAggregateDataSetFilter vtkAggregateToPartitionedDataSetCollection vtkAlembicExporter vtkAlgorithmOutput vtkAlignImageDataSetFilter vtkAmoebaMinimizer vtkAnariActorNode vtkAnariCameraNode vtkAnariCompositePolyDataMapperNode vtkAnariFollowerNode vtkAnariLightNode vtkAnariPass vtkAnariPolyDataMapperNode vtkAnariProfiling vtkAnariRendererNode vtkAnariTestInteractor vtkAnariViewNodeFactory vtkAnariVolumeInterface vtkAnariVolumeMapper vtkAnariVolumeMapperNode vtkAnariVolumeNode vtkAnariWindowNode vtkAndroidOutputWindow vtkAndroidRenderWindowInteractor vtkAngleRepresentation vtkAngleRepresentation2D vtkAngleRepresentation3D vtkAngleWidget vtkAngularPeriodicDataArray vtkAngularPeriodicFilter vtkAnimateModes vtkAnimationCue vtkAnimationScene vtkAnnotation vtkAnnotationLayers vtkAnnotationLayersAlgorithm vtkAppendArcLength vtkAppendCompositeDataLeaves vtkAppendDataSets vtkAppendLocationAttributes vtkAppendPartitionedDataSetCollection vtkAppendPoints vtkAppendSelection vtkApplyColors vtkApplyIcons vtkApproximatingSubdivisionFilter vtkArcGridActorPrivate vtkArcParallelEdgeStrategy vtkArcPlotter vtkArcSource vtkArchiver vtkAreaContourSpectrumFilter vtkAreaLayout vtkAreaLayoutStrategy vtkAreaPicker vtkArray vtkArrayCalculator vtkArrayCoordinates vtkArrayData vtkArrayDataAlgorithm vtkArrayDataReader vtkArrayDataWriter vtkArrayDispatch vtkArrayExtents vtkArrayExtentsList vtkArrayInterpolate vtkArrayIterator vtkArrayIteratorIncludes vtkArrayIteratorTemplate vtkArrayListTemplate vtkArrayNorm vtkArrayPrint vtkArrayRange vtkArrayReader vtkArrayRename vtkArrayRenderer vtkArraySort vtkArrayToTable vtkArrayWeights vtkArrayWriter vtkAssembly vtkAssemblyNode vtkAssemblyPath vtkAssemblyPaths vtkAssignAttribute vtkAssignCoordinates vtkAssignCoordinatesLayoutStrategy vtkAtom vtkAtomicMutex vtkAttributeClustering2DLayoutStrategy vtkAttributeDataToFieldDataFilter vtkAttributeDataToTableFilter vtkAttributeSmoothingFilter vtkAttributesErrorMetric vtkAutoCorrelativeStatistics vtkAvatar vtkAxesTransformRepresentation vtkAxesTransformWidget vtkAxisActor vtkAxisActor2D vtkAxisActor2DMock vtkAxisExtended vtkAxisFollower vtkAxisGridActorPrivate vtkBSPCuts vtkBSPIntersections vtkBSplineTransform vtkBTSReader vtkBYUWriter vtkBackgroundColorMonitor vtkBarChartActor vtkBase64InputStream vtkBase64OutputStream vtkBase64Utilities vtkBatchedSurfaceLICMapper vtkBatches vtkBezierContourLineInterpolator vtkBezierCurve vtkBezierHexahedron vtkBezierInterpolation vtkBezierQuadrilateral vtkBezierTetra vtkBezierTriangle vtkBezierWedge vtkBiDimensionalRepresentation vtkBiDimensionalRepresentation2D vtkBiDimensionalWidget vtkBilinearQuadIntersection vtkBinCellDataFilter vtkBinnedDecimation vtkBiomTableReader vtkBitArray vtkBitArrayIterator vtkBivariateLinearTableThreshold vtkBlankStructuredGrid vtkBlankStructuredGridWithImage vtkBlockDistribution vtkBlockIdScalars vtkBlockItem vtkBlockSelector vtkBlueObeliskData vtkBlueObeliskDataParser vtkBond vtkBoostBetweennessClustering vtkBoostBiconnectedComponents vtkBoostBrandesCentrality vtkBoostBreadthFirstSearch vtkBoostBreadthFirstSearchTree vtkBoostConnectedComponents vtkBoostDividedEdgeBundling vtkBoostExtractLargestComponent vtkBoostKruskalMinimumSpanningTree vtkBoostLogWeighting vtkBoostPrimMinimumSpanningTree vtkBoostRandomSparseArraySource vtkBoostSplitTableField vtkBorderRepresentation vtkBorderWidget vtkBoundaryMeshQuality vtkBoundedPlanePointPlacer vtkBoundedPointSource vtkBoundingBox vtkBoxClipDataSet vtkBoxLayoutStrategy vtkBoxMuellerRandomSequence vtkBoxRepresentation vtkBoxWidget2 vtkBreakPoint vtkBrokenLineWidget vtkBrush vtkBuffer vtkBufferedArchiver vtkButtonRepresentation vtkButtonSource vtkButtonWidget vtkByteSwap vtkCGMWriter vtkCGNSCache vtkCGNSFileSeriesReader vtkCGNSReader vtkCGNSReaderInternal vtkCMLMoleculeReader vtkCONVERGECFDCGNSReader vtkCONVERGECFDReader vtkCPExodusIIElementBlock vtkCPExodusIIElementBlockCellIterator vtkCPExodusIIElementBlockImpl vtkCPExodusIIInSituReader vtkCPExodusIINodalCoordinatesTemplate vtkCPExodusIIResultsArrayTemplate vtkCachedStreamingDemandDrivenPipeline vtkCallbackCommand vtkCamera3DRepresentation vtkCamera3DWidget vtkCameraActor vtkCameraHandleSource vtkCameraInterpolator vtkCameraNode vtkCameraOrientationRepresentation vtkCameraPathRepresentation vtkCameraPathWidget vtkCameraRepresentation vtkCameraWidget vtkCapsuleSource vtkCaptionActor2D vtkCaptionRepresentation vtkCaptionWidget vtkCardinalSpline vtkCastToConcrete vtkCell3D vtkCellArrayIterator vtkCellAttribute vtkCellAttributeCalculator vtkCellAttributeInformation vtkCellCenterDepthSort vtkCellCenters vtkCellCentersPointPlacer vtkCellData vtkCellDataToPointData vtkCellDerivatives vtkCellDistanceSelector vtkCellGraphicsPrimitiveMap vtkCellGrid vtkCellGridAlgorithm vtkCellGridBoundsQuery vtkCellGridComputeSurface vtkCellGridElevation vtkCellGridElevationQuery vtkCellGridEvaluator vtkCellGridIOQuery vtkCellGridMapper vtkCellGridPointProbe vtkCellGridQuery vtkCellGridRangeQuery vtkCellGridReader vtkCellGridRenderRequest vtkCellGridResponder vtkCellGridResponderBase vtkCellGridResponders vtkCellGridSidesQuery vtkCellGridWriter vtkCellIterator vtkCellLinks vtkCellLocatorStrategy vtkCellMetadata vtkCellQuality vtkCellSizeFilter vtkCellTreeLocator vtkCellType vtkCellValidator vtkCenterOfMass vtkCenteredSliderRepresentation vtkCenteredSliderWidget vtkCesium3DTilesReader vtkCesium3DTilesWriter vtkCesiumB3DMReader vtkCesiumPointCloudWriter vtkChacoGraphReader vtkChacoReader vtkCharArray vtkChart2DHistogram vtkChartBox vtkChartHistogram2D vtkChartLegend vtkChartMatrix vtkChartParallelCoordinates vtkChartPie vtkCheckerboardRepresentation vtkCheckerboardSplatter vtkCheckerboardWidget vtkCirclePackFrontChainLayoutStrategy vtkCirclePackLayout vtkCirclePackLayoutStrategy vtkCirclePackToPolyData vtkCityGMLReader vtkCleanUnstructuredGrid vtkCleanUnstructuredGridCells vtkClearRGBPass vtkClearZPass vtkClientServerCompositePass vtkClientServerSynchronizedRenderers vtkClientSocket vtkClipClosedSurface vtkClipConvexPolyData vtkClipVolume vtkClosedSurfacePointPlacer vtkClosestNPointsStrategy vtkClosestPointStrategy vtkClustering2DLayoutStrategy vtkCocoaMacOSXSDKCompatibility vtkCocoaRenderWindow vtkCocoaRenderWindowInteractor vtkCocoaTkUtilities vtkCoincidentPoints vtkCollapseGraph vtkCollapseVerticesByArray vtkCollectGraph vtkCollectPolyData vtkCollectTable vtkCollection vtkCollectionElement vtkCollectionIterator vtkColor vtkColor3 vtkColor3d vtkColor3f vtkColor4 vtkColor4d vtkColor4f vtkColor4ub vtkColorLegend vtkColorTransferControlPointsItem vtkColorTransferFunctionItem vtkCommonInformationKeyManager vtkCommunicator vtkCommunity2DLayoutStrategy vtkCompositeCellGridMapper vtkCompositeCellGridReader vtkCompositeControlPointsItem vtkCompositeCutter vtkCompositeDataDisplayAttributesLegacy vtkCompositeDataIterator vtkCompositeDataPipeline vtkCompositeDataProbeFilter vtkCompositeDataReader vtkCompositeDataSet vtkCompositeDataSetAlgorithm vtkCompositeDataWriter vtkCompositeImplicitBackend vtkCompositeInterpolatedVelocityField vtkCompositeMapperHelper2 vtkCompositeMapperHelperData vtkCompositePolyDataMapper2 vtkCompositePolyDataMapperDelegator vtkCompositeRGBAPass vtkCompositeRenderManager vtkCompositeSurfaceLICMapper vtkCompositeSurfaceLICMapperDelegator vtkCompositeTransferFunctionItem vtkCompositeZPass vtkCompositedSynchronizedRenderers vtkCompositer vtkCompressCompositer vtkComputeHistogram2DOutliers vtkComputeQuantiles vtkComputeQuartiles vtkConduitArrayUtilities vtkConduitSource vtkConduitToDataObject vtkConeLayoutStrategy vtkConnectedPointsFilter vtkConstrained2DLayoutStrategy vtkConstrainedPointHandleRepresentation vtkConstrainedSmoothingFilter vtkConsumerDataFilter vtkContext2D vtkContext3D vtkContextArea vtkContextClip vtkContextDevice2D vtkContextDevice3D vtkContextInteractorStyle vtkContextItem vtkContextKeyEvent vtkContextMapper2D vtkContextPolygon vtkContextScenePrivate vtkContingencyStatistics vtkContinuousScatterplot vtkContinuousValueWidget vtkContinuousValueWidgetRepresentation vtkContour3DLinearGrid vtkContourGrid vtkContourHelper vtkContourLineInterpolator vtkContourLoopExtraction vtkContourRepresentation vtkContourRepresentationInternals vtkContourRepresentationNode vtkContourRepresentationPoint vtkContourValues vtkControlPointsItem vtkConvertSelection vtkConvertSelectionDomain vtkConvertToMultiBlockDataSet vtkConvertToPartitionedDataSetCollection vtkConvertToPointCloud vtkConvertToPolyhedra vtkConvexHull2D vtkCookieCutter vtkCoordinateFrame vtkCoordinateFrameRepresentation vtkCoordinateFrameWidget vtkCornerAnnotation vtkCorrelativeStatistics vtkCosmicTreeLayoutStrategy vtkCountFaces vtkCountVertices vtkCubeAxesActor2D vtkCuller vtkCullerCollection vtkCursor2D vtkCursor3D vtkCurveRepresentation vtkCutMaterial vtkCylindricalTransform vtkDEMReader vtkDGAttributeInformation vtkDGBoundsResponder vtkDGCell vtkDGEdge vtkDGElevationResponder vtkDGEvaluator vtkDGHex vtkDGIOResponder vtkDGInterpolateCalculator vtkDGPyr vtkDGQuad vtkDGRangeResponder vtkDGRenderResponder vtkDGSidesResponder vtkDGTet vtkDGTranscribeUnstructuredCells vtkDGTri vtkDGVert vtkDGWdg vtkDIMACSGraphReader vtkDIMACSGraphWriter vtkDIYAggregateDataSetFilter vtkDIYDataExchanger vtkDIYExplicitAssigner vtkDIYGhostUtilities vtkDIYKdTreeUtilities vtkDIYUtilities vtkDIYUtilitiesCleanup vtkDSPFilterDefinition vtkDSPFilterGroup vtkDataArray vtkDataArrayCollection vtkDataArrayCollectionIterator vtkDataArraySelection vtkDataAssembly vtkDataAssemblyUtilities vtkDataAssemblyVisitor vtkDataCompressor vtkDataEncoder vtkDataObjectAlgorithm vtkDataObjectCollection vtkDataObjectGenerator vtkDataObjectMeshCache vtkDataObjectToConduit vtkDataObjectToTable vtkDataObjectTree vtkDataObjectTreeIndex vtkDataObjectTreeInternals vtkDataObjectTreeIterator vtkDataObjectTypes vtkDataObjectWriter vtkDataReader vtkDataRepresentation vtkDataSet vtkDataSetAlgorithm vtkDataSetAttributesFieldList vtkDataSetCellIterator vtkDataSetCollection vtkDataSetEdgeSubdivisionCriterion vtkDataSetGradient vtkDataSetGradientPrecompute vtkDataSetRegionSurfaceFilter vtkDataSetToDataObjectFilter vtkDataSetTriangleFilter vtkDataSetWriter vtkDataTransferHelper vtkDataWriter vtkDatabaseToTableReader vtkDateToNumeric vtkDeRhamCell vtkDebugLeaks vtkDebugLeaksManager vtkDebugLeaksObserver vtkDecimatePolylineFilter vtkDefaultPass vtkDeflectNormals vtkDelimitedTextWriter vtkDemandDrivenPipeline vtkDendrogramItem vtkDenseArray vtkDensifyPointCloudFilter vtkDensifyPolyData vtkDependentDimensionInfo vtkDepthImageProcessingPass vtkDepthImageToPointCloud vtkDepthOfFieldPass vtkDepthPeelingPass vtkDepthSortPolyData vtkDescriptiveStatistics vtkDeserializer vtkDiagonalMatrixSource vtkDicer vtkDijkstraGraphGeodesicPath vtkDijkstraGraphInternals vtkDijkstraImageContourLineInterpolator vtkDijkstraImageGeodesicPath vtkDimensionInfo vtkDirectedAcyclicGraph vtkDirectedGraph vtkDirectedGraphAlgorithm vtkDirectionEncoder vtkDirectory vtkDiscreteFlyingEdges2D vtkDiscreteFlyingEdgesClipper2D vtkDisplaySizedImplicitPlaneRepresentation vtkDisplaySizedImplicitPlaneWidget vtkDistancePolyDataFilter vtkDistanceRepresentation vtkDistanceRepresentation2D vtkDistanceRepresentation3D vtkDistanceToCamera vtkDistanceWidget vtkDistributedDataFilter vtkDistributedGraphHelper vtkDistributedPointCloudFilter vtkDotProductSimilarity vtkDrawTexturedElements vtkDualDepthPeelingPass vtkDummyCommunicator vtkDummyController vtkDummyGPUInfoList vtkDuplicatePolyData vtkDynamic2DLabelMapper vtkDynamicLoader vtkEDLShading vtkEGLRenderWindow vtkERFReader vtkEdgeCenters vtkEdgeLayout vtkEdgeLayoutStrategy vtkEdgeListIterator vtkEdgePoints vtkEdgeSubdivisionCriterion vtkEdgeTable vtkEllipseArcSource vtkEllipsoidTensorProbeRepresentation vtkEllipsoidalGaussianKernel vtkEllipticalButtonSource vtkEmptyCell vtkEmptyRepresentation vtkEnSight6BinaryReader vtkEnSight6Reader vtkEnSightGoldBinaryReader vtkEnSightGoldReader vtkEnSightMasterServerReader vtkEnSightReader vtkEnSightWriter vtkEncodedGradientEstimator vtkEncodedGradientShader vtkEndFor vtkEnsembleSource vtkEnzoReaderBlock vtkEnzoReaderInternal vtkEqualizerContextItem vtkEqualizerFilter vtkEquirectangularToCubeMapTexture vtkErrorCode vtkEuclideanClusterExtraction vtkEvenlySpacedStreamlines2D vtkEvent vtkEventData vtkEventDataDevice3D vtkEventDataForDevice vtkEventForwarderCommand vtkEventQtSlotConnect vtkExecutableRunner vtkExecutionAggregator vtkExecutionRange vtkExecutionTimer vtkExecutive vtkExodusIICache vtkExodusIICacheEntry vtkExodusIICacheKey vtkExodusIIReaderIntPointCheck vtkExodusIIReaderParser vtkExodusIIReaderPrivate vtkExodusIIReaderScalarCheck vtkExodusIIReaderTensorCheck vtkExodusIIReaderVariableCheck vtkExodusIIReaderVectorCheck vtkExodusIIWriter vtkExpandMarkedElements vtkExpandSelectedGraph vtkExplicitStructuredGridAlgorithm vtkExplicitStructuredGridCrop vtkExplicitStructuredGridSurfaceFilter vtkExporter vtkExprTkFunctionParser vtkExtentRCBPartitioner vtkExtentSplitter vtkExtentTranslator vtkExternalLight vtkExternalOpenGLCamera vtkExternalOpenGLRenderWindow vtkExternalOpenGLRenderer vtkExtractArray vtkExtractBlock vtkExtractBlockUsingDataAssembly vtkExtractCTHPart vtkExtractCells vtkExtractCellsAlongPolyLine vtkExtractCellsByType vtkExtractDataArraysOverTime vtkExtractDataOverTime vtkExtractDataSets vtkExtractEnclosedPoints vtkExtractExodusGlobalTemporalVariables vtkExtractFunctionalBagPlot vtkExtractGhostCells vtkExtractHierarchicalBins vtkExtractHistogram vtkExtractHistogram2D vtkExtractLevel vtkExtractParticlesOverTime vtkExtractPiece vtkExtractPointCloudPiece vtkExtractPoints vtkExtractPolyDataGeometry vtkExtractPolyDataPiece vtkExtractRectilinearGrid vtkExtractSelectedArraysOverTime vtkExtractSelectedFrustum vtkExtractSelectedGraph vtkExtractSelectedRows vtkExtractSelectedTree vtkExtractSelectionBase vtkExtractStructuredGridHelper vtkExtractSubsetWithSeed vtkExtractSurface vtkExtractTensorComponents vtkExtractTimeSteps vtkExtractUnstructuredGrid vtkExtractUnstructuredGridPiece vtkExtractUserDefinedPiece vtkExtractVectorComponents vtkFDSReader vtkFFMPEGVideoSource vtkFFMPEGWriter vtkFFT vtkFLUENTCFFReader vtkFLUENTReader vtkFXAAOptions vtkFacetReader vtkFacetWriter vtkFast2DLayoutStrategy vtkFastSplatter vtkFiberSurface vtkFidesReader vtkFieldData vtkFieldDataSerializer vtkFieldDataToDataSetAttribute vtkFileOutputWindow vtkFileResourceStream vtkFileSeriesHelper vtkFillHolesFilter vtkFilteringInformationKeyManager vtkFiltersCellGrid vtkFindCellStrategy vtkFiniteDifferenceGradientEstimator vtkFiniteElementFieldDistributor vtkFinitePlaneRepresentation vtkFinitePlaneWidget vtkFitImplicitFunction vtkFitToHeightMapFilter vtkFixedPointRayCastImage vtkFixedPointVolumeRayCastCompositeGOHelper vtkFixedPointVolumeRayCastCompositeGOShadeHelper vtkFixedPointVolumeRayCastCompositeHelper vtkFixedPointVolumeRayCastCompositeShadeHelper vtkFixedPointVolumeRayCastHelper vtkFixedPointVolumeRayCastMIPHelper vtkFixedSizeHandleRepresentation vtkFixedSizeHandleRepresentation3D vtkFixedWidthTextReader vtkFlagpoleLabel vtkFlashReaderInternal vtkFloatingPointExceptions vtkFlyingEdgesPlaneCutter vtkFocalPlaneContourRepresentation vtkFocalPlanePointPlacer vtkFontConfigFreeTypeTools vtkForEach vtkForceStaticMesh vtkForceTime vtkFrameBufferObjectBase vtkFramebufferPass vtkFreeTypeLabelRenderStrategy vtkFreeTypeStringToImage vtkFreeTypeTools vtkFreeTypeToolsCleanup vtkFrustumCoverageCuller vtkFrustumSelector vtkFunctionParser vtkFunctionSet vtkGAMBITReader vtkGDAL vtkGDALRasterConverter vtkGDALRasterReader vtkGDALRasterReprojection vtkGDALVectorReader vtkGESignaReader vtkGL2PSExporter vtkGLSLModCamera vtkGLSLModCoincidentTopology vtkGLSLModLight vtkGLSLModPixelDebugger vtkGLSLModifierBase vtkGLSLModifierFactory vtkGLTFDocumentLoader vtkGLTFDocumentLoaderInternals vtkGLTFExporter vtkGLTFImporter vtkGLTFReader vtkGLTFTexture vtkGLTFWriter vtkGLTFWriterUtils vtkGPUInfo vtkGPUInfoList vtkGPUInfoListArray vtkGPUVolumeRayCastMapper vtkGarbageCollector vtkGarbageCollectorManager vtkGaussianBlurPass vtkGaussianCubeReader vtkGaussianCubeReader2 vtkGaussianRandomSequence vtkGeneralTransform vtkGeneralizedKernel vtkGenerateGlobalIds vtkGenerateIndexArray vtkGenerateProcessIds vtkGenerateTimeSteps vtkGenericAdaptorCell vtkGenericAttribute vtkGenericAttributeCollection vtkGenericCellIterator vtkGenericCellTessellator vtkGenericClip vtkGenericContourFilter vtkGenericCutter vtkGenericDataArray vtkGenericDataArrayLookupHelper vtkGenericDataObjectReader vtkGenericDataObjectWriter vtkGenericDataSet vtkGenericDataSetTessellator vtkGenericEdgeTable vtkGenericEnSightReader vtkGenericGeometryFilter vtkGenericGlyph3DFilter vtkGenericImageInterpolator vtkGenericInterpolatedVelocityField vtkGenericMovieWriter vtkGenericOpenGLRenderWindow vtkGenericOpenGLResourceFreeCallback vtkGenericOutlineFilter vtkGenericPointIterator vtkGenericProbeFilter vtkGenericRenderWindowInteractor vtkGenericStreamTracer vtkGenericSubdivisionErrorMetric vtkGenericVertexAttributeMapping vtkGeoEdgeStrategy vtkGeoJSONFeature vtkGeoJSONReader vtkGeoJSONWriter vtkGeoMath vtkGeoProjection vtkGeoTransform vtkGeodesicPath vtkGeometricErrorMetric vtkGhostCellsGenerator vtkGlobFileNames vtkGradientFilter vtkGraph vtkGraphAlgorithm vtkGraphAnnotationLayersFilter vtkGraphEdge vtkGraphGeodesicPath vtkGraphHierarchicalBundleEdges vtkGraphInternals vtkGraphItem vtkGraphLayoutFilter vtkGraphLayoutStrategy vtkGraphMapper vtkGraphReader vtkGraphToPoints vtkGraphWeightEuclideanDistanceFilter vtkGraphWeightFilter vtkGraphWriter vtkGraphicsFactory vtkGreedyTerrainDecimation vtkGridSynchronizedTemplates3D vtkGridTransform vtkGroupDataSetsFilter vtkGroupLeafVertices vtkGroupTimeStepsFilter vtkH5PartReader vtkH5RageReader vtkHDF5Helper vtkHDFReaderImplementation vtkHDFVersion vtkHDFWriter vtkHDFWriterImplementation vtkHandleRepresentation vtkHandleSource vtkHandleWidget vtkHardwarePicker vtkHardwareWindow vtkHeap vtkHeatmapItem vtkHiddenLineRemovalPass vtkHierarchicalBinningFilter vtkHierarchicalBoxDataSet vtkHierarchicalBoxDataSetAlgorithm vtkHierarchicalDataExtractDataSets vtkHierarchicalDataExtractLevel vtkHierarchicalDataLevelFilter vtkHierarchicalDataSetGeometryFilter vtkHierarchicalGraphPipeline vtkHierarchicalGraphView vtkHierarchicalPolyDataMapper vtkHigherOrderCurve vtkHigherOrderHexahedron vtkHigherOrderInterpolation vtkHigherOrderQuadrilateral vtkHigherOrderTetra vtkHigherOrderTriangle vtkHigherOrderWedge vtkHighestDensityRegionsStatistics vtkHomogeneousTransform vtkHoudiniPolyDataWriter vtkHoverWidget vtkHyperTree vtkHyperTreeGrid vtkHyperTreeGridAlgorithm vtkHyperTreeGridAxisClip vtkHyperTreeGridAxisCut vtkHyperTreeGridAxisReflection vtkHyperTreeGridCellCenters vtkHyperTreeGridContour vtkHyperTreeGridDepthLimiter vtkHyperTreeGridEntry vtkHyperTreeGridEvaluateCoarse vtkHyperTreeGridExtractGhostCells vtkHyperTreeGridFeatureEdges vtkHyperTreeGridGeometricLocator vtkHyperTreeGridGeometry vtkHyperTreeGridGeometry1DImpl vtkHyperTreeGridGeometry2DImpl vtkHyperTreeGridGeometry3DImpl vtkHyperTreeGridGeometryEntry vtkHyperTreeGridGeometryImpl vtkHyperTreeGridGeometryLevelEntry vtkHyperTreeGridGeometrySmallDimensionsImpl vtkHyperTreeGridGeometryUnlimitedEntry vtkHyperTreeGridGeometryUnlimitedLevelEntry vtkHyperTreeGridGhostCellsGenerator vtkHyperTreeGridGhostCellsGeneratorInternals vtkHyperTreeGridGradient vtkHyperTreeGridIterator vtkHyperTreeGridLevelEntry vtkHyperTreeGridLocator vtkHyperTreeGridMapper vtkHyperTreeGridNonOrientedCursor vtkHyperTreeGridNonOrientedGeometryCursor vtkHyperTreeGridNonOrientedMooreSuperCursor vtkHyperTreeGridNonOrientedMooreSuperCursorLight vtkHyperTreeGridNonOrientedSuperCursor vtkHyperTreeGridNonOrientedSuperCursorLight vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor vtkHyperTreeGridNonOrientedUnlimitedSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight vtkHyperTreeGridOrientedCursor vtkHyperTreeGridOrientedGeometryCursor vtkHyperTreeGridOutlineFilter vtkHyperTreeGridPlaneCutter vtkHyperTreeGridPreConfiguredSource vtkHyperTreeGridProbeFilter vtkHyperTreeGridScales vtkHyperTreeGridThreshold vtkHyperTreeGridToDualGrid vtkHyperTreeGridVisibleLeavesSize vtkIOCellGrid vtkIOSRenderWindow vtkIOSRenderWindowInteractor vtkIOSSFilesScanner vtkIOSSModel vtkIOSSReader vtkIOSSReaderInternal vtkIOSSWriter vtkIOStream vtkIOStreamFwd vtkISIReader vtkIVExporter vtkIVWriter vtkIcicleView vtkIconGlyphFilter vtkIdListCollection vtkIdentityTransform vtkImageActorPointPlacer vtkImageAlgorithm vtkImageAnisotropicDiffusion2D vtkImageAnisotropicDiffusion3D vtkImageAppendComponents vtkImageBSplineCoefficients vtkImageBSplineInternals vtkImageBSplineInterpolator vtkImageBlend vtkImageButterworthLowPass vtkImageCacheFilter vtkImageChangeInformation vtkImageCheckerboard vtkImageCityBlockDistance vtkImageClip vtkImageConnectivityFilter vtkImageConnector vtkImageConnectorSeed vtkImageContinuousDilate3D vtkImageContinuousErode3D vtkImageConvolve vtkImageCorrelation vtkImageCroppingRegionsWidget vtkImageCursor3D vtkImageDataLIC2D vtkImageDataOutlineFilter vtkImageDataStreamer vtkImageDataToExplicitStructuredGrid vtkImageDataToHyperTreeGrid vtkImageDataToPointSet vtkImageDataToUniformGrid vtkImageDecomposeFilter vtkImageDifference vtkImageDivergence vtkImageDotProduct vtkImageEllipsoidSource vtkImageEuclideanDistance vtkImageExport vtkImageFourierFilter vtkImageGaussianSource vtkImageGradientMagnitude vtkImageGridSource vtkImageHSIToRGB vtkImageHistogram vtkImageHistogramStatistics vtkImageIdealLowPass vtkImageImportExecutive vtkImageInPlaceFilter vtkImageInterpolator vtkImageItem vtkImageIterateFilter vtkImageIterator vtkImageLogic vtkImageMapToRGBA vtkImageMapper vtkImageMapper3D vtkImageMask vtkImageMaskBits vtkImageNonMaximumSuppression vtkImageOpenClose3D vtkImageOrthoPlanes vtkImagePadFilter vtkImagePermute vtkImagePlaneWidget vtkImagePointDataIterator vtkImagePointIterator vtkImageProbeFilter vtkImageProcessingPass vtkImageProgressIterator vtkImageProperty vtkImageQuantizeRGBToIndex vtkImageRGBToHSI vtkImageRGBToHSV vtkImageRGBToXYZ vtkImageRGBToYIQ vtkImageRange3D vtkImageReader vtkImageReader2 vtkImageReader2Collection vtkImageRectilinearWipe vtkImageRenderManager vtkImageResample vtkImageResize vtkImageReslice vtkImageResliceMapper vtkImageResliceToColors vtkImageSSIM vtkImageSeparableConvolution vtkImageSincInterpolator vtkImageSkeleton2D vtkImageSlab vtkImageSlabReslice vtkImageSlice vtkImageSliceCollection vtkImageSliceMapper vtkImageSobel2D vtkImageSobel3D vtkImageSpatialAlgorithm vtkImageStack vtkImageStencilAlgorithm vtkImageStencilData vtkImageStencilIterator vtkImageStencilRaster vtkImageStencilSource vtkImageStencilToImage vtkImageThresholdConnectivity vtkImageToAMR vtkImageToImageStencil vtkImageToPoints vtkImageToPolyDataFilter vtkImageToStructuredGrid vtkImageToStructuredPoints vtkImageTracerWidget vtkImageTransform vtkImageTranslateExtent vtkImageVariance3D vtkImageWriter vtkImageXYZToLAB vtkImageYIQToRGB vtkImplicitArray vtkImplicitCylinderRepresentation vtkImplicitCylinderWidget vtkImplicitDataSet vtkImplicitFunction vtkImplicitFunctionCollection vtkImplicitFunctionToImageStencil vtkImplicitHalo vtkImplicitImageRepresentation vtkImplicitPlaneWidget vtkImplicitProjectOnPlaneDistance vtkImplicitSelectionLoop vtkImplicitSum vtkImplicitVolume vtkImplicitWindowFunction vtkImporter vtkImprintFilter vtkInEdgeIterator vtkIncrementalForceLayout vtkIncrementalOctreeNode vtkIncrementalOctreePointLocator vtkIncrementalPointLocator vtkIndent vtkIndexedImplicitBackend vtkInformation vtkInformationDataObjectKey vtkInformationDataObjectMetaDataKey vtkInformationDoubleKey vtkInformationDoubleVectorKey vtkInformationExecutivePortKey vtkInformationExecutivePortVectorKey vtkInformationIdTypeKey vtkInformationInformationKey vtkInformationInformationVectorKey vtkInformationIntegerKey vtkInformationIntegerPointerKey vtkInformationIntegerRequestKey vtkInformationIntegerVectorKey vtkInformationInternals vtkInformationIterator vtkInformationKey vtkInformationKeyLookup vtkInformationKeyVectorKey vtkInformationObjectBaseKey vtkInformationObjectBaseVectorKey vtkInformationQuadratureSchemeDefinitionVectorKey vtkInformationRequestKey vtkInformationStringKey vtkInformationStringVectorKey vtkInformationUnsignedLongKey vtkInformationVariantKey vtkInformationVariantVectorKey vtkInformationVector vtkInitialValueProblemSolver vtkInputStream vtkIntegrateAttributes vtkInteractiveArea vtkInteractorEventRecorder vtkInteractorObserver vtkInteractorStyle vtkInteractorStyle3D vtkInteractorStyleAreaSelectHover vtkInteractorStyleDrawPolygon vtkInteractorStyleFlight vtkInteractorStyleJoystickActor vtkInteractorStyleJoystickCamera vtkInteractorStyleMultiTouchCamera vtkInteractorStyleRubberBand2D vtkInteractorStyleRubberBand3D vtkInteractorStyleRubberBandZoom vtkInteractorStyleSwitch vtkInteractorStyleSwitchBase vtkInteractorStyleTerrain vtkInteractorStyleTrackball vtkInteractorStyleTreeMapHover vtkInteractorStyleUnicam vtkInteractorStyleUser vtkInterpolateCalculator vtkInterpolateDataSetAttributes vtkInterpolatingSubdivisionFilter vtkInterpolationKernel vtkInterpolatorInternals vtkIntersectionCounter vtkIntersectionPolyDataFilter vtkJSONDataSetWriter vtkJSONImageWriter vtkJSONRenderWindowExporter vtkJSONSceneExporter vtkJavaScriptDataWriter vtkJoinTables vtkKCoreDecomposition vtkKCoreLayout vtkKMeansAssessFunctor vtkKMeansDistanceFunctor vtkKMeansDistanceFunctorCalculator vtkKMeansStatistics vtkKdNode vtkKdTree vtkKdTreePointLocator vtkKdTreeSelector vtkKochanekSpline vtkLASRasterReader vtkLASReader vtkLICNoiseHelper vtkLICRandomNoise2D vtkLICRandomNumberGeneratorInterface vtkLODProp3D vtkLSDynaPart vtkLSDynaPartCollection vtkLSDynaReader vtkLSDynaSummaryParser vtkLZ4DataCompressor vtkLZMADataCompressor vtkLabelHierarchy vtkLabelHierarchyAlgorithm vtkLabelHierarchyCompositeIterator vtkLabelHierarchyIterator vtkLabelPlacementMapper vtkLabelPlacer vtkLabelRenderStrategy vtkLabelSizeCalculator vtkLabeledContourMapper vtkLabeledContourPolyDataItem vtkLabeledTreeMapDataMapper vtkLagrangeCurve vtkLagrangeHexahedron vtkLagrangeInterpolation vtkLagrangeQuadrilateral vtkLagrangeTetra vtkLagrangeTriangle vtkLagrangeWedge vtkLagrangianBasicIntegrationModel vtkLagrangianMatidaIntegrationModel vtkLagrangianParticle vtkLagrangianParticleTracker vtkLargeInteger vtkLassoStencilSource vtkLeaderActor2D vtkLegacyReaderVersion vtkLegendBoxActor vtkLegendScaleActor vtkLengthDistribution vtkLevelIdScalars vtkLightCollection vtkLightKit vtkLightNode vtkLightRepresentation vtkLightWidget vtkLightingMapPass vtkLineIntegralConvolution2D vtkLineRepresentation vtkLineWidget2 vtkLinearCellExtrusionFilter vtkLinearContourLineInterpolator vtkLinearKernel vtkLinearSelector vtkLinearToQuadraticCellsFilter vtkLinearTransform vtkLinearTransformCellLocator vtkLinkEdgels vtkLocationSelector vtkLocator vtkLogger vtkLogoRepresentation vtkLogoWidget vtkLongArray vtkLongLongArray vtkLookupTableItem vtkLookupTableWithEnabling vtkLoopBooleanPolyDataFilter vtkMCubesWriter vtkMFCWindow vtkMFIXReader vtkMINCImageAttributes vtkMINCImageReader vtkMINCImageWriter vtkMNIObjectReader vtkMNIObjectWriter vtkMNITagPointReader vtkMNITagPointWriter vtkMNITransformReader vtkMNITransformWriter vtkMP4Writer vtkMPASReader vtkMPI4PyCommunicator vtkMPICommunicator vtkMPIController vtkMPIEventLog vtkMPIImageReader vtkMPIMultiBlockPLOT3DReader vtkMPIPixelTT vtkMPIPixelView vtkMRCReader vtkMagnifierRepresentation vtkMagnifierWidget vtkMapArrayValues vtkMapMaskTextureId vtkMappedDataArray vtkMappedUnstructuredGrid vtkMappedUnstructuredGridCellIterator vtkMapper vtkMapper2D vtkMapperCollection vtkMapperNode vtkMarkBoundaryFilter vtkMarkerUtilities vtkMarshalContext vtkMaskPointsFilter vtkMassProperties vtkMathPrivate vtkMathTextFreeTypeTextRenderer vtkMathTextUtilities vtkMathTextUtilitiesCleanup vtkMathUtilities vtkMatplotlibMathTextUtilities vtkMatricizeArray vtkMatrix3x3 vtkMatrixMathFilter vtkMatrixToHomogeneousTransform vtkMatrixToLinearTransform vtkMeanValueCoordinatesInterpolator vtkMeasurementCubeHandleRepresentation3D vtkMedicalImageProperties vtkMedicalImageReader2 vtkMemkindRAII vtkMemoryLimitImageDataStreamer vtkMemoryResourceStream vtkMergeArrays vtkMergeCells vtkMergeColumns vtkMergeDataObjectFilter vtkMergeFields vtkMergeGraphs vtkMergeTables vtkMergeTimeFilter vtkMergeVectorComponents vtkMersenneTwister vtkMeshQuality vtkModelMetadata vtkModifiedBSPTree vtkMolecule vtkMoleculeAlgorithm vtkMoleculeAppend vtkMoleculeMapper vtkMoleculeReaderBase vtkMoleculeToAtomBallFilter vtkMoleculeToBondStickFilter vtkMoleculeToLinesFilter vtkMoleculeToPolyDataFilter vtkMotionFXCFGReader vtkMultiBlockDataGroupFilter vtkMultiBlockDataSetAlgorithm vtkMultiBlockMergeFilter vtkMultiBlockPLOT3DReaderRecord vtkMultiBlockUnstructuredGridVolumeMapper vtkMultiBlockVolumeMapper vtkMultiCorrelativeAssessFunctor vtkMultiCorrelativeStatistics vtkMultiNewickTreeReader vtkMultiObjectMassProperties vtkMultiPieceDataSet vtkMultiProcessController vtkMultiProcessStream vtkMultiThreader vtkMultiTimeStepAlgorithm vtkMultiVolume vtkMutableGraphHelper vtkMySQLDatabase vtkMySQLDatabasePrivate vtkMySQLQuery vtkMySQLToTableReader vtkNIFTIImageHeader vtkNIFTIImageReader vtkNIFTIImageWriter vtkNativePartitioningStrategy vtkNeighborCells vtkNek5000Reader vtkNetCDFCAMReader vtkNetCDFCFReader vtkNetCDFCFWriter vtkNetCDFPOPReader vtkNetCDFReader vtkNetCDFUGRIDReader vtkNetCDFUGRIDeader vtkNetworkHierarchy vtkNewickTreeReader vtkNewickTreeWriter vtkNonLinearCell vtkNonMergingPointLocator vtkNonOverlappingAMR vtkNonOverlappingAMRAlgorithm vtkNonOverlappingAMRLevelIdScalars vtkNormalizeMatrixVectors vtkNrrdReader vtkNumberToString vtkOBBDicer vtkOBBNode vtkOBJExporter vtkOBJImporter vtkOBJPolyDataProcessor vtkOBJWriter vtkOCCTReader vtkODBCDatabase vtkODBCInternals vtkODBCQuery vtkOMETIFFReader vtkOMFReader vtkOOGLExporter vtkOSOpenGLRenderWindow vtkOSPRayAMRVolumeMapperNode vtkOSPRayActorNode vtkOSPRayCache vtkOSPRayCacheItemObject vtkOSPRayCameraNode vtkOSPRayCompositePolyDataMapper2Node vtkOSPRayCompositePolyDataMapperNode vtkOSPRayLightNode vtkOSPRayMaterialHelpers vtkOSPRayMaterialLibrary vtkOSPRayMoleculeMapperNode vtkOSPRayPass vtkOSPRayPointGaussianMapperNode vtkOSPRayPolyDataMapperNode vtkOSPRayRendererNode vtkOSPRayTestInteractor vtkOSPRayUnstructuredVolumeMapperNode vtkOSPRayViewNodeFactory vtkOSPRayVolumeInterface vtkOSPRayVolumeMapper vtkOSPRayVolumeMapperNode vtkOSPRayVolumeNode vtkOSPRayWindowNode vtkOStrStreamWrapper vtkOStreamWrapper vtkOTDensityMap vtkOTFilter vtkOTKernelSmoothing vtkOTScatterPlotMatrix vtkOTUtilities vtkObject vtkObjectBase vtkObjectFactory vtkObjectFactoryCollection vtkObjectFactoryRegistryCleanup vtkObjectIdMap vtkObserverMediator vtkOctreeImageToPointSetFilter vtkOctreePointLocator vtkOctreePointLocatorNode vtkOggTheoraWriter vtkOldStyleCallbackCommand vtkOpenFOAMReader vtkOpenGL2ContextDevice2DCellArrayHelper vtkOpenGL2ContextDevice2DPrivate vtkOpenGLActor vtkOpenGLArrayTextureBufferAdapter vtkOpenGLAvatar vtkOpenGLBatchedPolyDataMapper vtkOpenGLBillboardTextActor3D vtkOpenGLBufferObject vtkOpenGLCamera vtkOpenGLCellGridMapper vtkOpenGLCellToVTKCellMap vtkOpenGLCompositePolyDataMapperDelegator vtkOpenGLContextActor vtkOpenGLContextBufferId vtkOpenGLContextDevice2D vtkOpenGLContextDevice3D vtkOpenGLContextDeviceBufferObjectBuilder vtkOpenGLES30PolyDataMapper2D vtkOpenGLFXAAFilter vtkOpenGLFXAAPass vtkOpenGLFluidMapper vtkOpenGLFramebufferObject vtkOpenGLGL2PSExporter vtkOpenGLGL2PSHelper vtkOpenGLGL2PSHelperImpl vtkOpenGLGPUVolumeRayCastMapper vtkOpenGLGlyph3DHelper vtkOpenGLGlyph3DMapper vtkOpenGLHardwareSelector vtkOpenGLHelper vtkOpenGLHyperTreeGridMapper vtkOpenGLImageAlgorithmCallback vtkOpenGLImageAlgorithmHelper vtkOpenGLImageGradient vtkOpenGLImageMapper vtkOpenGLImageSliceMapper vtkOpenGLIndexBufferObject vtkOpenGLInstanceCulling vtkOpenGLLabeledContourMapper vtkOpenGLLight vtkOpenGLLowMemoryBatchedPolyDataMapper vtkOpenGLLowMemoryCellTypeAgent vtkOpenGLLowMemoryLinesAgent vtkOpenGLLowMemoryPolyDataMapper vtkOpenGLLowMemoryPolygonsAgent vtkOpenGLLowMemoryStripsAgent vtkOpenGLLowMemoryVerticesAgent vtkOpenGLMoleculeMapper vtkOpenGLMovieSphere vtkOpenGLPointGaussianMapper vtkOpenGLPointGaussianMapperHelper vtkOpenGLPolyDataMapper vtkOpenGLPolyDataMapper2D vtkOpenGLProjectedTetrahedraMapper vtkOpenGLPropItem vtkOpenGLProperty vtkOpenGLQuadHelper vtkOpenGLRenderPass vtkOpenGLRenderTimer vtkOpenGLRenderTimerLog vtkOpenGLRenderUtilities vtkOpenGLRenderWindow vtkOpenGLResourceFreeCallback vtkOpenGLShaderCache vtkOpenGLShaderDeclaration vtkOpenGLShaderProperty vtkOpenGLSphereMapper vtkOpenGLState vtkOpenGLStickMapper vtkOpenGLTextActor vtkOpenGLTextActor3D vtkOpenGLTextMapper vtkOpenGLTexture vtkOpenGLUniforms vtkOpenGLVertexArrayObject vtkOpenGLVertexBufferObject vtkOpenGLVertexBufferObjectCache vtkOpenGLVertexBufferObjectGroup vtkOpenGLVolumeGradientOpacityTable vtkOpenGLVolumeLookupTable vtkOpenGLVolumeLookupTables vtkOpenGLVolumeMaskGradientOpacityTransferFunction2D vtkOpenGLVolumeMaskTransferFunction2D vtkOpenGLVolumeOpacityTable vtkOpenGLVolumeRGBTable vtkOpenGLVolumeTransferFunction2D vtkOpenQubeElectronicData vtkOpenQubeMoleculeSource vtkOpenSlideReader vtkOpenVDBReader vtkOpenVDBWriter vtkOpenVRCamera vtkOpenVRCameraPose vtkOpenVRControlsHelper vtkOpenVRDefaultOverlay vtkOpenVRInteractorStyle vtkOpenVRModel vtkOpenVROverlay vtkOpenVROverlaySpot vtkOpenVRRenderWindow vtkOpenVRRenderWindowInteractor vtkOpenVRRenderer vtkOpenXRCamera vtkOpenXRControlsHelper vtkOpenXRInteractorStyle vtkOpenXRManager vtkOpenXRManagerConnection vtkOpenXRManagerD3DGraphics vtkOpenXRManagerGraphics vtkOpenXRManagerOpenGLGraphics vtkOpenXRManagerRemoteConnection vtkOpenXRModel vtkOpenXRRemotingRenderWindow vtkOpenXRRenderWindow vtkOpenXRRenderWindowInteractor vtkOpenXRRenderer vtkOpenXRUtilities vtkOrderIndependentTranslucentPass vtkOrderStatistics vtkOrderedTriangulator vtkOrientPolyData vtkOrientationRepresentation vtkOrientationWidget vtkOrientedGlyphFocalPlaneContourRepresentation vtkOrientedPolygonalHandleRepresentation3D vtkOutEdgeIterator vtkOutlineCornerFilter vtkOutlineCornerSource vtkOutlineSource vtkOutputStream vtkOutputWindow vtkOutputWindowCleanup vtkOverlappingAMRAlgorithm vtkOverlappingAMRLevelIdScalars vtkOverlappingCellsDetector vtkOverrideInformation vtkOverrideInformationCollection vtkPAutoCorrelativeStatistics vtkPBRIrradianceTexture vtkPBRLUTTexture vtkPBRPrefilterTexture vtkPBivariateLinearTableThreshold vtkPCAAnalysisFilter vtkPCACurvatureEstimation vtkPCANormalEstimation vtkPCAStatistics vtkPCellDataToPointData vtkPCellSizeFilter vtkPChacoReader vtkPComputeHistogram2DOutliers vtkPComputeQuantiles vtkPComputeQuartiles vtkPConnectivityFilter vtkPContingencyStatistics vtkPConvertToMultiBlockDataSet vtkPCorrelativeStatistics vtkPDALReader vtkPDBReader vtkPDFContextDevice2D vtkPDFExporter vtkPDataSetReader vtkPDataSetWriter vtkPDescriptiveStatistics vtkPDirectory vtkPDistributedDataFilter vtkPExodusIIReader vtkPExodusIIWriter vtkPExtractDataArraysOverTime vtkPExtractExodusGlobalTemporalVariables vtkPExtractGrid vtkPExtractHistogram2D vtkPExtractRectilinearGrid vtkPExtractSelectedArraysOverTime vtkPExtractVOI vtkPHardwareSelector vtkPHyperTreeGridProbeFilter vtkPIOReader vtkPImageWriter vtkPKMeansStatisitcs vtkPKMeansStatistics vtkPKdTree vtkPLSDynaReader vtkPLagrangianParticleTracker vtkPLineIntegralConvolution2D vtkPLinearExtrusionFilter vtkPMaskPoints vtkPMergeArrays vtkPMultiCorrelativeStatistics vtkPNetCDFPOPReader vtkPNrrdReader vtkPOVExporter vtkPOpenFOAMReader vtkPOrderStatistics vtkPOutlineCornerFilter vtkPOutlineFilter vtkPOutlineFilterInternals vtkPPCAStatistics vtkPPainterCommunicator vtkPPairwiseExtractHistogram2D vtkPParticlePathFilter vtkPParticleTracer vtkPParticleTracerBase vtkPPixelTransfer vtkPPolyDataNormals vtkPProbeFilter vtkPProjectSphereFilter vtkPReflectionFilter vtkPResampleFilter vtkPResampleToImage vtkPResampleWithDataSet vtkPSLACReader vtkPSimpleBondPerceiver vtkPSphereSource vtkPStreaklineFilter vtkPStreamTracer vtkPStructuredGridConnectivity vtkPSurfaceLICComposite vtkPSurfaceLICInterface vtkPSystemTools vtkPTSReader vtkPTextureMapToSphere vtkPVWebGLExporter vtkPWindBladeReader vtkPXdmf3Writer vtkPYoungsMaterialInterface vtkPackLabels vtkPainterCommunicator vtkPairwiseExtractHistogram2D vtkPanoramicProjectionPass vtkParallelAMRUtilities vtkParallelCoordinatesActor vtkParallelCoordinatesHistogramRepresentation vtkParallelCoordinatesInteractorStyle vtkParallelReader vtkParallelRenderManager vtkParallelTimer vtkParallelVectors vtkParallelopipedRepresentation vtkParallelopipedWidget vtkParametricFunction vtkParticlePathFilter vtkParticleReader vtkParticleTracer vtkParticleTracerBase vtkPartitionBalancer vtkPartitionedArchiver vtkPartitionedDataSet vtkPartitionedDataSetAlgorithm vtkPartitionedDataSetCollection vtkPartitionedDataSetCollectionAlgorithm vtkPartitionedDataSetCollectionSource vtkPartitionedDataSetSource vtkPartitioningStrategy vtkPassArrays vtkPassInputTypeAlgorithm vtkPassSelectedArrays vtkPassThrough vtkPassThroughEdgeStrategy vtkPassThroughLayoutStrategy vtkPath vtkPen vtkPeriodicDataArray vtkPeriodicFilter vtkPeriodicTable vtkPerspectiveTransform vtkPerturbCoincidentVertices vtkPhyloXMLTreeReader vtkPhyloXMLTreeWriter vtkPicker vtkPickingManager vtkPieChartActor vtkPieceRequestFilter vtkPieceScalars vtkPiecewiseControlPointsItem vtkPiecewiseFunctionAlgorithm vtkPiecewiseFunctionItem vtkPiecewiseFunctionShiftScale vtkPiecewisePointHandleItem vtkPipelineGraphSource vtkPipelineSize vtkPixelBufferObject vtkPixelExtent vtkPixelExtentIO vtkPixelTransfer vtkPlaneCollection vtkPlaneCutter vtkPlaneWidget vtkPlaybackRepresentation vtkPlaybackWidget vtkPlot vtkPlot3D vtkPlot3DMetaReader vtkPlotArea vtkPlotBag vtkPlotBar vtkPlotBarRangeHandlesItem vtkPlotBox vtkPlotFunctionalBag vtkPlotGrid vtkPlotHistogram2D vtkPlotLine vtkPlotLine3D vtkPlotParallelCoordinates vtkPlotPie vtkPlotPoints3D vtkPlotRangeHandlesItem vtkPlotStacked vtkPointCloudFilter vtkPointCloudRepresentation vtkPointCloudWidget vtkPointConnectivityFilter vtkPointData vtkPointDataToCellData vtkPointDensityFilter vtkPointFillPass vtkPointHandleRepresentation2D vtkPointHandleRepresentation3D vtkPointHandleSource vtkPointInterpolator2D vtkPointLocator vtkPointOccupancyFilter vtkPointPicker vtkPointPlacer vtkPointSet vtkPointSetAlgorithm vtkPointSetCellIterator vtkPointSetStreamer vtkPointSetToLabelHierarchy vtkPointSetToMoleculeFilter vtkPointSetToOctreeImageFilter vtkPointSmoothingFilter vtkPointWidget vtkPoints2D vtkPointsProjectedHull vtkPoissonDiskSampler vtkPolarAxesActor vtkPolarAxesActor2D vtkPolyDataAlgorithm vtkPolyDataCollection vtkPolyDataContourLineInterpolator vtkPolyDataEdgeConnectivityFilter vtkPolyDataInternals vtkPolyDataItem vtkPolyDataMapperNode vtkPolyDataPlaneClipper vtkPolyDataPlaneCutter vtkPolyDataPointPlacer vtkPolyDataPointSampler vtkPolyDataSourceWidget vtkPolyDataStreamer vtkPolyDataToReebGraphFilter vtkPolyDataToUnstructuredGrid vtkPolyLineRepresentation vtkPolyLineSource vtkPolyLineWidget vtkPolyPlane vtkPolyPointSource vtkPolygonBuilder vtkPolygonalHandleRepresentation3D vtkPolygonalSurfaceContourLineInterpolator vtkPolygonalSurfacePointPlacer vtkPolyhedronUtilities vtkPolynomialSolversUnivariate vtkPostgreSQLDatabase vtkPostgreSQLDatabasePrivate vtkPostgreSQLQuery vtkPostgreSQLToTableReader vtkPriorityQueue vtkProStarReader vtkProbabilisticVoronoiKernel vtkProbeLineFilter vtkProbePolyhedron vtkProbeSelectedLocations vtkProcess vtkProcessGroup vtkProcessIdScalars vtkProcrustesAlignmentFilter vtkProgrammableAttributeDataFilter vtkProgrammableDataObjectSource vtkProgrammableElectronicData vtkProgrammableFilter vtkProgrammableSource vtkProgressBarRepresentation vtkProgressBarWidget vtkProgressObserver vtkProjectPointsToPlane vtkProjectSphereFilter vtkProjectedTerrainPath vtkProjectedTetrahedraMapper vtkProjectedTexture vtkProp vtkProp3DAxisFollower vtkProp3DButtonRepresentation vtkProp3DCollection vtkProp3DFollower vtkPropCollection vtkPropItem vtkProperty2D vtkProteinRibbonFilter vtkPruneTreeFilter vtkPythonAlgorithm vtkPythonArchiver vtkPythonItem vtkQImageToImageSource vtkQWidgetRepresentation vtkQWidgetTexture vtkQWidgetWidget vtkQtAbstractModelAdapter vtkQtAnnotationLayersModelAdapter vtkQtAnnotationView vtkQtConnection vtkQtDebugLeaksModel vtkQtDebugLeaksView vtkQtInitialization vtkQtLabelRenderStrategy vtkQtListView vtkQtRecordView vtkQtSQLDatabase vtkQtSQLQuery vtkQtStringToImage vtkQtTableModelAdapter vtkQtTableRepresentation vtkQtTableView vtkQtTimePointUtility vtkQtTreeModelAdapter vtkQtTreeRingLabelMapper vtkQtTreeView vtkQtView vtkQuadRotationalExtrusionFilter vtkQuadraturePointInterpolator vtkQuadraturePointsGenerator vtkQuadratureSchemeDefinition vtkQuadratureSchemeDictionaryGenerator vtkQuadricClustering vtkQuadricDecimation vtkQuadricLODActor vtkQuantizePolyDataPoints vtkQuaternion vtkQuaternionInterpolator vtkQuaterniond vtkQuaternionf vtkRIBExporter vtkRIBLight vtkRIBProperty vtkRISReader vtkROIStencilSource vtkRTXMLPolyDataReader vtkRadialGridActor2D vtkRadiusOutlierRemoval vtkRandomAttributeGenerator vtkRandomHyperTreeGridSource vtkRandomLayoutStrategy vtkRandomPool vtkRandomSequence vtkRangeHandlesItem vtkRasterReprojectionFilter vtkRayCastImageDisplayHelper vtkRayCastStructures vtkReaderAlgorithm vtkRearrangeFields vtkRecoverGeometryWireframe vtkRect vtkRectangularButtonSource vtkRectd vtkRecti vtkRectilinearGridAlgorithm vtkRectilinearGridClip vtkRectilinearGridOutlineFilter vtkRectilinearGridPartitioner vtkRectilinearGridReader vtkRectilinearGridToPointSet vtkRectilinearGridToTetrahedra vtkRectilinearGridWriter vtkRectilinearSynchronizedTemplates vtkRectilinearWipeRepresentation vtkRectilinearWipeWidget vtkRecursiveDividingCubes vtkRecursiveSphereDirectionEncoder vtkRedistributeDataSetFilter vtkReduceTable vtkReebGraph vtkReebGraphSimplificationFilter vtkReebGraphSimplificationMetric vtkReebGraphSurfaceSkeletonFilter vtkReebGraphToJoinSplitTreeFilter vtkReebGraphVolumeSkeletonFilter vtkReferenceCount vtkReflectionFilter vtkRemoteInteractionAdapter vtkRemoveDuplicatePolys vtkRemoveGhosts vtkRemoveHiddenData vtkRemoveIsolatedVertices vtkRemovePolyData vtkRemoveUnusedPoints vtkRenderPass vtkRenderState vtkRenderTimerLog vtkRenderView vtkRenderViewBase vtkRenderWidget vtkRenderWindowCollection vtkRenderWindowInteractor3D vtkRenderbuffer vtkRenderedAreaPicker vtkRenderedHierarchyRepresentation vtkRenderedRepresentation vtkRenderedSurfaceRepresentation vtkRenderedTreeAreaRepresentation vtkRendererCollection vtkRendererDelegate vtkRendererNode vtkRendererSource vtkRenderingCellGrid vtkResampleToImage vtkReservoirSampler vtkReservoirSamplerBase vtkResizingWindowToImageFilter vtkResliceCursor vtkResliceCursorActor vtkResliceCursorLineRepresentation vtkResliceCursorPicker vtkResliceCursorPolyDataAlgorithm vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation vtkResliceCursorWidget vtkResliceImageViewer vtkResliceImageViewerMeasurements vtkResourceFileLocator vtkResourceParser vtkResourceStream vtkRotationFilter vtkRowQuery vtkRowQueryToTable vtkRungeKutta2 vtkRungeKutta45 vtkSCurveSpline vtkSDL2OpenGL2RenderWindow vtkSDL2OpenGLRenderWindow vtkSDL2RenderWindowInteractor vtkSDL2WebGPURenderWindow vtkSEPReader vtkSILBuilder vtkSLACParticleReader vtkSLACReader vtkSMPContourGrid vtkSMPMergePoints vtkSMPMergePolyDataHelper vtkSMPProgressObserver vtkSMPThreadLocal vtkSMPThreadLocalAPI vtkSMPThreadLocalImpl vtkSMPThreadLocalImplAbstract vtkSMPThreadLocalObject vtkSMPThreadPool vtkSMPTools vtkSMPToolsAPI vtkSMPToolsAPIInitialize vtkSMPToolsImpl vtkSOADataArrayTemplate vtkSPHCubicKernel vtkSPHInterpolator vtkSPHKernel vtkSPHQuarticKernel vtkSPHQuinticKernel vtkSQLDatabase vtkSQLDatabaseGraphSource vtkSQLDatabaseSchema vtkSQLDatabaseTableSource vtkSQLGraphReader vtkSQLQuery vtkSQLiteDatabase vtkSQLiteDatabaseInternals vtkSQLiteQuery vtkSQLiteToTableReader vtkSSAAPass vtkSSAOPass vtkSVGContextDevice2D vtkSVGExporter vtkSampleImplicitFunctionFilter vtkScalarBarActorInternal vtkScalarBarRepresentation vtkScalarTree vtkScalarsToColors vtkScalarsToColorsItem vtkScalarsToTextureFilter vtkScaledSOADataArrayTemplate vtkScaledTextActor vtkScatterPlotMatrix vtkScenePicker vtkSectorSource vtkSeedRepresentation vtkSeedWidget vtkSegYBinaryHeaderBytesPositions vtkSegYIOUtils vtkSegYReader vtkSegYReaderInternal vtkSegYTrace vtkSegYTraceHeaderBytesPositions vtkSegYTraceReader vtkSelectPolyData vtkSelectVisiblePoints vtkSelectionAlgorithm vtkSelectionSource vtkSelector vtkSerializer vtkServerSocket vtkShader vtkShaderProgram vtkShaderProperty vtkShadowMapBakerPass vtkSharedFuture vtkSharedFutureBase vtkShepardKernel vtkShepardMethod vtkSignedCharArray vtkSignedDistance vtkSimple3DCirclesStrategy vtkSimpleBondPerceiver vtkSimpleCellTessellator vtkSimpleElevationFilter vtkSimpleImageToImageFilter vtkSimplePointsReader vtkSimplePointsWriter vtkSimpleReader vtkSimpleScalarTree vtkSingleVTPExporter vtkSliceAndDiceLayoutStrategy vtkSliceCubes vtkSliderRepresentation vtkSliderRepresentation3D vtkSmartPointer vtkSmartPointerBase vtkSmartVector vtkSmartVolumeMapper vtkSmoothErrorMetric vtkSmoothPolyDataFilter vtkSobelGradientMagnitudePass vtkSocket vtkSocketCollection vtkSocketCommunicator vtkSocketController vtkSortDataArray vtkSortFieldData vtkSortFileNames vtkSpanSpace vtkSpanTreeLayoutStrategy vtkSparseArray vtkSparseArrayToTable vtkSpatialRepresentationFilter vtkSpatioTemporalHarmonicsAttribute vtkSpatioTemporalHarmonicsSource vtkSphereHandleRepresentation vtkSpherePuzzle vtkSpherePuzzleArrows vtkSphereRepresentation vtkSphereTree vtkSphereTreeFilter vtkSphereWidget2 vtkSpheres vtkSphericalDirectionEncoder vtkSphericalHarmonics vtkSphericalPointIterator vtkSphericalTransform vtkSpline vtkSplineFilter vtkSplineGraphEdges vtkSplineRepresentation vtkSplineWidget2 vtkSplitByCellScalarFilter vtkSplitColumnComponents vtkSplitField vtkSplitSharpEdgesPolyData vtkSquarifyLayoutStrategy vtkStackedTreeLayoutStrategy vtkStateStorage vtkStaticCellLinks vtkStaticCellLinksTemplate vtkStaticCellLocator vtkStaticCleanPolyData vtkStaticCleanUnstructuredGrid vtkStaticCompositeSource vtkStaticDataSource vtkStaticEdgeLocatorTemplate vtkStaticFaceHashLinksTemplate vtkStaticPointLocator vtkStaticPointLocator2D vtkStatisticalOutlierRemoval vtkStatisticsAlgorithm vtkStatisticsAlgorithmPrivate vtkStdString vtkStereoCompositor vtkStitchImageDataWithGhosts vtkStrahlerMetric vtkStreaklineFilter vtkStreamGraph vtkStreamSurface vtkStreamerBase vtkStreamingDemandDrivenPipeline vtkStreamingStatistics vtkStreamingTessellator vtkStringOutputWindow vtkStringToCategory vtkStringToImage vtkStringToNumeric vtkStringToken vtkStructuredAMRGridConnectivity vtkStructuredAMRNeighbor vtkStructuredCellArray vtkStructuredData vtkStructuredDataPlaneCutter vtkStructuredExtent vtkStructuredGridAlgorithm vtkStructuredGridAppend vtkStructuredGridClip vtkStructuredGridConnectivity vtkStructuredGridLIC2D vtkStructuredGridPartitioner vtkStructuredGridWriter vtkStructuredImplicitConnectivity vtkStructuredNeighbor vtkStructuredPointArray vtkStructuredPointBackend vtkStructuredPointsCollection vtkStructuredPointsGeometryFilter vtkStructuredPointsWriter vtkStructuredTPointBackend vtkSubCommunicator vtkSubGroup vtkSubPixelPositionEdgels vtkSubdivideTetra vtkSubdivisionFilter vtkSurfaceLICComposite vtkSurfaceLICHelper vtkSurfaceLICInterface vtkSurfaceLICMapper vtkSurfaceNets2D vtkSurfaceNets3D vtkSurfaceReconstructionFilter vtkSynchronizeTimeFilter vtkSynchronizedRenderWindows vtkSynchronizedRenderers vtkSynchronizedTemplates2D vtkSynchronizedTemplates3D vtkSynchronizedTemplatesCutter3D vtkSystemIncludes vtkTDxInteractorStyle vtkTDxInteractorStyleCamera vtkTDxInteractorStyleSettings vtkTDxMotionEventInfo vtkTDxQtUnixDevices vtkTGAReader vtkTIFFReader vtkTIFFReaderInternal vtkTRUCHASReader vtkTableAlgorithm vtkTableBasedClipCases vtkTableFFT vtkTableReader vtkTableToArray vtkTableToDatabaseWriter vtkTableToGraph vtkTableToMySQLWriter vtkTableToPostgreSQLWriter vtkTableToSQLiteWriter vtkTableToSparseArray vtkTableToStructuredGrid vtkTableToTreeFilter vtkTableWriter vtkTanglegramItem vtkTclCommand vtkTecplotReader vtkTecplotTableReader vtkTemplateAliasMacro vtkTemporalAlgorithm vtkTemporalArrayOperatorFilter vtkTemporalDataSetCache vtkTemporalDelimitedTextReader vtkTemporalFractal vtkTemporalInterpolatedVelocityField vtkTemporalInterpolator vtkTemporalPathLineFilter vtkTemporalShiftScale vtkTemporalSnapToTimeStep vtkTemporalStatistics vtkTensorPrincipalInvariants vtkTensorProbeRepresentation vtkTensorProbeWidget vtkTensorRepresentation vtkTensorWidget vtkTerrainContourLineInterpolator vtkTerrainDataPointPlacer vtkTestDataArray vtkTestNewVar vtkTextActor3D vtkTextCodec vtkTextCodecFactory vtkTextPropertyCollection vtkTextRenderer vtkTextRendererCleanup vtkTextRendererStringToImage vtkTextureIO vtkTextureImageCache vtkTextureMapToCylinder vtkTextureMapToPlane vtkTextureObject vtkTextureUnitManager vtkTexturedActor2D vtkTexturedButtonRepresentation vtkTexturedButtonRepresentation2D vtkThinPlateSplineTransform vtkThreadedCallbackQueue vtkThreadedCompositeDataPipeline vtkThreadedImageAlgorithm vtkThreadedImageWriter vtkThreadedTaskQueue vtkThresholdGraph vtkThresholdTable vtkTimeInformation vtkTimePointUtility vtkTimeRange vtkTimeSource vtkTimeSourceExample vtkTimeStamp vtkTimerLog vtkTimerLogCleanup vtkTimerLogScope vtkToAffineArrayStrategy vtkToConstantArrayStrategy vtkToImplicitArrayFilter vtkToImplicitRamerDouglasPeuckerStrategy vtkToImplicitStrategy vtkToImplicitTypeErasureStrategy vtkTooltipItem vtkTransferAttributes vtkTransform2D vtkTransformCollection vtkTransformConcatenation vtkTransformConcatenationStack vtkTransformCoordinateSystems vtkTransformFeedback vtkTransformInterpolator vtkTransformPair vtkTransformTextureCoords vtkTransformToGrid vtkTranslucentPass vtkTransmitImageDataPiece vtkTransmitPolyDataPiece vtkTransmitRectilinearGridPiece vtkTransmitStructuredDataPiece vtkTransmitStructuredGridPiece vtkTransmitUnstructuredGridPiece vtkTransposeMatrix vtkTransposeTable vtkTreeAlgorithm vtkTreeAreaView vtkTreeBFSIterator vtkTreeCompositer vtkTreeDFSIterator vtkTreeDifferenceFilter vtkTreeFieldAggregator vtkTreeHeatmapItem vtkTreeIterator vtkTreeLayoutStrategy vtkTreeLevelsFilter vtkTreeMapLayout vtkTreeMapLayoutStrategy vtkTreeMapToPolyData vtkTreeMapView vtkTreeOrbitLayoutStrategy vtkTreeReader vtkTreeRingToPolyData vtkTreeRingView vtkTreeWriter vtkTriQuadraticPyramid vtkTriangleMeshPointNormals vtkTriangularTCoords vtkTriangularTexture vtkTrimmedExtrusionFilter vtkTrivialConsumer vtkTrivialProducer vtkTryDowncastHelper1 vtkTryDowncastHelper2 vtkTryDowncastHelper3 vtkTubeBender vtkTulipReader vtkTuple vtkTupleInterpolator vtkTypeList vtkTypedArray vtkTypedDataArray vtkTypedDataArrayIterator vtkURI vtkURIComponent vtkURILoader vtkUTF16TextCodec vtkUTF8TextCodec vtkUncertaintyTubeFilter vtkUndirectedGraph vtkUndirectedGraphAlgorithm vtkUniformGridAMR vtkUniformGridAMRAlgorithm vtkUniformGridAMRDataIterator vtkUniformGridPartitioner vtkUniformHyperTreeGrid vtkUniformHyperTreeGridSource vtkUniforms vtkUnsignedDistance vtkUnsignedIntArray vtkUnsignedLongArray vtkUnsignedLongLongArray vtkUnsignedShortArray vtkUnstructuredGridAlgorithm vtkUnstructuredGridBase vtkUnstructuredGridBaseAlgorithm vtkUnstructuredGridBunykRayCastFunction vtkUnstructuredGridCellIterator vtkUnstructuredGridGeometryFilter vtkUnstructuredGridHomogeneousRayIntegrator vtkUnstructuredGridLinearRayIntegrator vtkUnstructuredGridPartialPreIntegration vtkUnstructuredGridPreIntegration vtkUnstructuredGridQuadricDecimation vtkUnstructuredGridToCellGrid vtkUnstructuredGridToReebGraphFilter vtkUnstructuredGridVolumeMapper vtkUnstructuredGridVolumeRayCastFunction vtkUnstructuredGridVolumeRayCastIterator vtkUnstructuredGridVolumeRayCastMapper vtkUnstructuredGridVolumeRayIntegrator vtkUnstructuredGridVolumeZSweepMapper vtkUpdateCellsV8toV9 vtkVASPAnimationReader vtkVASPTessellationReader vtkVPICReader vtkVRCamera vtkVRCollaborationClient vtkVRControlsHelper vtkVRFollower vtkVRHMDCamera vtkVRHardwarePicker vtkVRInteractorStyle vtkVRMLExporter vtkVRMLImporter vtkVRMLUseStruct vtkVRMLYaccData vtkVRMenuRepresentation vtkVRMenuWidget vtkVRModel vtkVRPanelRepresentation vtkVRPanelWidget vtkVRRay vtkVRRenderWindow vtkVRRenderWindowInteractor vtkVRRenderer vtkValuePass vtkValueSelector vtkVariantBoostSerialization vtkVector vtkVector2 vtkVector2d vtkVector2f vtkVector3 vtkVector3d vtkVector3f vtkVector3i vtkVector4 vtkVector4d vtkVector4i vtkVectorFieldTopology vtkVectorNorm vtkVeraOutReader vtkVertexAdjacencyList vtkVertexDegree vtkVertexListIterator vtkVideoSource vtkView vtkViewDependentErrorMetric vtkViewNode vtkViewNodeFactory vtkVisibilitySort vtkVoidArray vtkVolume16Reader vtkVolumeCollection vtkVolumeContourSpectrumFilter vtkVolumeInputHelper vtkVolumeMapper vtkVolumeMapperNode vtkVolumeMask vtkVolumeNode vtkVolumeOfRevolutionFilter vtkVolumeOutlineSource vtkVolumePicker vtkVolumeRayCastSpaceLeapingImageFilter vtkVolumeReader vtkVolumeStateRAII vtkVolumeTexture vtkVolumetricPass vtkVoronoi2D vtkVoronoiKernel vtkVortexCore vtkVoxelContoursToSurfaceFilter vtkVoxelGrid vtkVtkJSSceneGraphSerializer vtkVtkJSViewNodeFactory vtkWGPUContext vtkWarpLens vtkWarpTransform vtkWasmSceneManager vtkWeakPointer vtkWeakPointerBase vtkWeakReference vtkWebApplication vtkWebAssemblyRenderWindowInteractor vtkWebGLDataSet vtkWebGLExporter vtkWebGLObject vtkWebGLPolyData vtkWebGLWidget vtkWebGPUActor vtkWebGPUCamera vtkWebGPUClearPass vtkWebGPUHardwareSelector vtkWebGPUInternalsBindGroup vtkWebGPUInternalsBindGroupLayout vtkWebGPUInternalsBuffer vtkWebGPUInternalsPipelineLayout vtkWebGPUInternalsRenderPassCreateInfo vtkWebGPUInternalsRenderPassDescriptor vtkWebGPUInternalsRenderPipelineDescriptor vtkWebGPUInternalsShaderModule vtkWebGPULight vtkWebGPUPolyDataMapper vtkWebGPUProperty vtkWebGPURenderPass vtkWebGPURenderWindow vtkWebGPURenderer vtkWebInteractionEvent vtkWebUtilities vtkWeightedTransformFilter vtkWendlandQuinticKernel vtkWidgetCallbackMapper vtkWidgetEventTranslator vtkWidgetRepresentation vtkWidgetSet vtkWin32HardwareWindow vtkWin32Header vtkWin32OpenGL2RenderWindow vtkWin32OpenGLDXRenderWindow vtkWin32OpenGLRenderWindow vtkWin32OutputWindow vtkWin32ProcessOutputWindow vtkWin32RenderWindowInteractor vtkWin32VideoSource vtkWindBladeReader vtkWindow vtkWindowNode vtkWordCloud vtkWorldPointPicker vtkWrappingHints vtkWriter vtkX3DExporter vtkX3DExporterFIWriter vtkX3DExporterFIWriterHelper vtkX3DExporterWriter vtkX3DExporterXMLWriter vtkXGMLReader vtkXMLCompositeDataReader vtkXMLCompositeDataSetWriterHelper vtkXMLCompositeDataWriter vtkXMLDataElement vtkXMLDataHeader vtkXMLDataHeaderImpl vtkXMLDataObjectWriter vtkXMLDataParser vtkXMLDataReader vtkXMLDataWriterHelper vtkXMLFileOutputWindow vtkXMLFileReadTester vtkXMLGenericDataObjectReader vtkXMLHierarchicalBoxDataFileConverter vtkXMLHierarchicalBoxDataReader vtkXMLHierarchicalBoxDataWriter vtkXMLHierarchicalDataReader vtkXMLHyperTreeGridReader vtkXMLHyperTreeGridWriter vtkXMLMultiBlockDataReader vtkXMLMultiBlockDataWriter vtkXMLMultiGroupDataReader vtkXMLPDataObjectReader vtkXMLPDataObjectWriter vtkXMLPDataReader vtkXMLPDataSetWriter vtkXMLPDataWriter vtkXMLPHierarchicalBoxDataWriter vtkXMLPHyperTreeGridReader vtkXMLPHyperTreeGridWriter vtkXMLPImageDataReader vtkXMLPImageDataWriter vtkXMLPMultiBlockDataWriter vtkXMLPPolyDataReader vtkXMLPPolyDataWriter vtkXMLPRectilinearGridReader vtkXMLPRectilinearGridWriter vtkXMLPStructuredDataReader vtkXMLPStructuredDataWriter vtkXMLPStructuredGridReader vtkXMLPStructuredGridWriter vtkXMLPTableReader vtkXMLPTableWriter vtkXMLPUniformGridAMRWriter vtkXMLPUnstructuredDataReader vtkXMLPUnstructuredDataWriter vtkXMLPUnstructuredGridReader vtkXMLPUnstructuredGridWriter vtkXMLParser vtkXMLPartitionedDataSetCollectionReader vtkXMLPartitionedDataSetCollectionWriter vtkXMLPartitionedDataSetReader vtkXMLPartitionedDataSetWriter vtkXMLReader vtkXMLReaderVersion vtkXMLRectilinearGridReader vtkXMLRectilinearGridWriter vtkXMLStructuredDataReader vtkXMLStructuredDataWriter vtkXMLStructuredGridReader vtkXMLStructuredGridWriter vtkXMLTableReader vtkXMLTableWriter vtkXMLTreeReader vtkXMLUniformGridAMRReader vtkXMLUniformGridAMRWriter vtkXMLUnstructuredDataReader vtkXMLUnstructuredDataWriter vtkXMLUtilities vtkXMLWriter vtkXMLWriter2 vtkXMLWriterBase vtkXOpenGLRenderWindow vtkXRenderWindowInteractor vtkXWebGPURenderWindow vtkXYPlotActor vtkXYPlotRepresentation vtkXYPlotWidget vtkXYZMolReader vtkXYZMolReader2 vtkXdmf3ArrayKeeper vtkXdmf3ArraySelection vtkXdmf3DataSet vtkXdmf3HeavyDataHandler vtkXdmf3LightDataHandler vtkXdmf3Reader vtkXdmf3SILBuilder vtkXdmf3Writer vtkXdmfArraySelection vtkXdmfDataArray vtkXdmfDocument vtkXdmfDomain vtkXdmfHeavyData vtkXdmfReader vtkXdmfReaderInternal vtkXdmfWriter vtkYieldCriteria vtkYoungsMaterialInterface vtkZLibDataCompressor vtkZSpaceCamera vtkZSpaceCoreCompatibilitySDKManager vtkZSpaceCoreSDKManager vtkZSpaceGenericRenderWindow vtkZSpaceHardwarePicker vtkZSpaceInteractorStyle vtkZSpaceRayActor vtkZSpaceRenderWindowInteractor vtkZSpaceRenderer vtkZSpaceSDKManager vtkZSpaceWin32RenderWindow vtkmAverageToCells vtkmAverageToPoints vtkmCleanGrid vtkmClip vtkmContour vtkmCoordinateSystemTransform vtkmDataArray vtkmDataSet vtkmExternalFaces vtkmExtractVOI vtkmFilterOverrides vtkmGradient vtkmHistogram vtkmImageConnectivity vtkmLevelOfDetail vtkmNDHistogram vtkmPointElevation vtkmPointTransform vtkmPolyDataNormals vtkmProbe vtkmSlice vtkmThreshold vtkmTriangleMeshPointNormals vtkmWarpScalar vtkmWarpVector"},{"location":"Python/Coverage/PythonVTKClassesUsed/","title":"VTK Classes used in the Examples","text":""},{"location":"Python/Coverage/PythonVTKClassesUsed/#python","title":"Python","text":"

        Out of 3113 available VTK classes, 453 are demonstrated here.

        "},{"location":"Python/Coverage/PythonVTKClassesUsed/#excluded-classes","title":"Excluded classes","text":"

        These classes are excluded since they occur in the majority of the examples:

        VTK Class VTK Class VTK Class vtkActor vtkCamera vtkNamedColors vtkPolyDataMapper vtkProperty vtkRenderer vtkRenderWindow vtkRenderWindowInteractor"},{"location":"Python/Coverage/PythonVTKClassesUsed/#classes-used","title":"Classes used","text":"VTK Class Examples vtk3DSImporter 3DSImporter vtkActor2D Actor2D Cell3DDemonstration CellTypeSource CurvaturesAdjustEdges CurvaturesDemo GeometricObjectsDemo GradientBackground IsoparametricCellsDemo LinearCellDemo MultiLineText ParametricObjectsDemo Planes PlatonicSolids PointDataSubdivision QuadraticHexahedronDemo QuadraticTetraDemo ReadDICOMSeries ReadLegacyUnstructuredGrid RescaleReverseLUT SourceObjectsDemo vtkAlgorithm TessellatedBoxSource vtkAMRBox OverlappingAMR vtkAnnotatedCubeActor AnatomicalOrientation AnnotatedCubeActor ColoredAnnotatedCube CompassWidget FroggieSurface FroggieView OrientationMarkerWidget vtkAnnotationLink ParallelCoordinatesExtraction SelectedGraphIDs vtkAppendFilter AppendFilter CameraModel1 ConnectivityFilter QuadricVisualization vtkAppendPolyData BlobbyLogo CameraModel2 CombinePolyData ProbeCombustor VelocityProfile WarpCombustor vtkArrowSource Arrow CurvatureBandsWithGlyphs ElevationBandsWithGlyphs EllipticalCylinderDemo GeometricObjectsDemo OrientedArrow OrientedGlyphs OutlineGlowPass ParametricObjectsDemo PointDataSubdivision RotationAroundLine vtkAxes Finance FinanceFieldData Rotations TensorAxes TextOrigin WalkCow vtkAxesActor AlignTwoPolyDatas AnatomicalOrientation Axes CallBack ColoredAnnotatedCube CSVReadEdit CSVReadEdit1 DisplayCoordinateAxes FroggieSurface FroggieView LayeredActors PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkAxis MultiplePlots vtkBalloonRepresentation BalloonWidget vtkBalloonWidget BalloonWidget vtkBandedPolyDataContourFilter ColoredAnnotatedCube CurvatureBandsWithGlyphs ElevationBandsWithGlyphs NamedColors vtkBillboardTextActor3D BillboardTextActor3D vtkBiQuadraticQuad IsoparametricCellsDemo vtkBiQuadraticQuadraticHexahedron IsoparametricCellsDemo vtkBiQuadraticQuadraticWedge IsoparametricCellsDemo vtkBiQuadraticTriangle IsoparametricCellsDemo vtkBMPReader ImageWarp vtkBMPWriter Hanoi ImageWriter vtkBooleanOperationPolyDataFilter BooleanOperationPolyDataFilter vtkBooleanTexture TextureCutQuadric vtkBox BooleanOperationImplicitFunctions vtkBoxWidget BoxWidget Tutorial_Step6 vtkBrownianPoints ParallelCoordinatesExtraction ParallelCoordinatesView vtkButterflySubdivisionFilter PointDataSubdivision SmoothMeshGrid vtkBYUReader AlignTwoPolyDatas BooleanOperationPolyDataFilter CapClip CellsInsideObject ClosedSurface Decimation GradientBackground Motor NormalsDemo Rotations SaveSceneToFieldData SaveSceneToFile Shadows WalkCow vtkCameraOrientationWidget AlignTwoPolyDatas CameraOrientationWidget CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges ElevationBandsWithGlyphs FroggieSurface FroggieView PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing SplineWidget vtkCameraPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Shadows ShadowsLightsDemo vtkCategoryLegend ReadLegacyUnstructuredGrid vtkCell CellTypeSource vtkCellArray Bottle CameraModel1 CameraModel2 CappedSphere Cell3DDemonstration ColoredLines ColoredTriangle ConstrainedDelaunay2D ContourWidget CreateESGrid CSVReadEdit CSVReadEdit1 Cube DataSetSurface DeformPointSet EllipticalCylinder EllipticalCylinderDemo GradientBackground Hexahedron IterateOverLines IterativeClosestPoints KochSnowflake LinearCellDemo LineOnMesh LongLine MultiLineText NOVCAGraph Point Polygon PolyLine PolyLine1 Pyramid Quad RuledSurfaceFilter SingleSplat SmoothMeshGrid SolidColoredTriangle Spring Tetrahedron Triangle TriangleColoredPoints TriangleCornerVertices TriangleStrip Vertex WarpVector WriteTriangleToFile vtkCellLocator LineOnMesh vtkCellPicker CellPicking vtkCellTypes CellTypeSource ClipDataSetWithPolyData ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ReadLegacyUnstructuredGrid vtkCellTypeSource CellTypeSource vtkChart MultiplePlots ScatterPlot vtkChartXY MultiplePlots ScatterPlot vtkChartXYZ SurfacePlot vtkCircularLayoutStrategy LabelVerticesAndEdges vtkCleanPolyData BooleanOperationPolyDataFilter CombinePolyData CurvatureBandsWithGlyphs CurvaturesDemo ElevationBandsWithGlyphs LineOnMesh PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision SmoothMeshGrid vtkClipDataSet ClipDataSetWithPolyData ClipDataSetWithPolyData1 ClipUnstructuredGridWithPlane2 TissueLens vtkClipPolyData CapClip ClipSphereCylinder CreateBFont ImplicitPlaneWidget2 PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing SolidClip vtkCollisionDetectionFilter CollisionDetection vtkColor3ub PointDataSubdivision vtkColorSeries CellTypeSource ColoredAnnotatedCube ColorSeriesPatches CreateColorSeriesDemo CurvatureBandsWithGlyphs Curvatures ElevationBandsWithGlyphs Hawaii LUTUtilities PointDataSubdivision ShareCamera TensorEllipsoids vtkColorTransferFunction AssignCellColorsFromLUT CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo DisplacementPlot ElevationBandsWithGlyphs MedicalDemo4 MeshLabelImageColor PointDataSubdivision SimpleRayCast VTKWithNumpy vtkCommand BillboardTextActor3D CompassWidget ContourWidget FroggieView ImplicitPlaneWidget2 ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing QuadraticHexahedronDemo QuadraticTetraDemo SplineWidget vtkCompassRepresentation CompassWidget vtkCompassWidget CompassWidget vtkCompositeDataDisplayAttributes CompositePolyDataMapper vtkCompositeDataGeometryFilter MultiBlockDataSet OverlappingAMR ReadExodusData vtkCompositePolyDataMapper CompositePolyDataMapper vtkCone IceCream vtkConeSource BoxWidget CallBack CameraBlur CameraModel1 CameraModel2 CarotidFlowGlyphs ClampGlyphSizes ClipDataSetWithPolyData ClipDataSetWithPolyData1 ColoredAnnotatedCube ColorMapToLUT ColorMapToLUT_JSON ColorMapToLUT_XML CombinePolyData Cone Cone3 Cone4 GeometricObjectsDemo GlyphTable GradientBackground HyperStreamline Mace Model MultipleRenderWindows MultipleViewports NamedColors Outline PointDataSubdivision ProgrammableGlyphFilter ResetCameraOrientation ShadowsLightsDemo ShareCamera SingleSplat SourceObjectsDemo SpikeFran TensorAxes TensorEllipsoids TransparentBackground Tutorial_Step1 Tutorial_Step2 Tutorial_Step3 Tutorial_Step4 Tutorial_Step5 Tutorial_Step6 vtkConnectivityFilter Blow ConnectivityFilter PineRootConnectivity PineRootDecimation vtkContextActor MultiplePlots vtkContextMouseEvent SurfacePlot vtkContextScene MultiplePlots vtkContextTransform ReadLegacyUnstructuredGrid vtkContextView ReadLegacyUnstructuredGrid ScatterPlot SurfacePlot vtkContourFilter BlobbyLogo Blow BooleanOperationImplicitFunctions CameraModel1 CameraModel2 CarotidFlow CarotidFlowGlyphs CombustorIsosurface ContourQuadric CutWithScalars DisplayQuadricSurfaces Finance FlatVersusGouraud FlyingHeadSlice GaussianSplat HeadSlice Hello IceCream ImplicitQuadric ImplicitSphere ImplicitSphere1 IronIsoSurface Lorenz MarchingCases OverlappingAMR PerlinNoise ProbeCombustor PseudoVolumeRendering QuadricVisualization ReadSLC SampleFunction SingleSplat SplatFace Vol vtkContourTriangulator ContourTriangulator vtkContourWidget ContourWidget vtkConvexPointSet ConvexPointSet vtkCoordinate GradientBackground MultiLineText vtkCubeAxesActor CubeAxesActor vtkCubeSource CameraModel1 CameraModel2 ColoredAnnotatedCube Cube1 CurvaturesAdjustEdges Cutter GeometricObjectsDemo Glyph3D GlyphTable LayeredActors MarchingCases Model MultipleRenderWindows MultipleViewports OrientationMarkerWidget PBR_Clear_Coat PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ProgrammableGlyphFilter Shadows ShadowsLightsDemo ShareCamera ShrinkCube SourceObjectsDemo TransparentBackground vtkCubicLine IsoparametricCellsDemo vtkCurvatures CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo vtkCutter CutStructuredGrid Cutter CutWithCutFunction DataSetSurface ExtractPolyLinesFromPolyData FilledPolygon PolyDataContourToImageData PolyDataToImageDataStencil PseudoVolumeRendering vtkCylinder ClipSphereCylinder IsosurfaceSampling vtkCylinderSource Cylinder CylinderExample FlatVersusGouraud GeometricObjectsDemo Hanoi MultipleRenderWindows MultipleViewports OrientedCylinder RescaleReverseLUT ShareCamera SourceObjectsDemo SplineWidget vtkDataObject CellsInsideObject GenerateCubesFromLabels GenerateModelsFromLabels HardwareSelector OfficeTube SpiderPlot vtkDataObjectReader FinanceFieldData vtkDataObjectToDataSetFilter FinanceFieldData vtkDataSetAttributes GenerateCubesFromLabels GenerateModelsFromLabels vtkDataSetMapper AlignTwoPolyDatas AppendFilter BlankPoint Blow CameraModel1 CameraModel2 CapClip Cell3DDemonstration CellPicking CellsInsideObject CellTypeSource ClipDataSetWithPolyData ClipDataSetWithPolyData1 ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ColoredSphere ConnectivityFilter ContourTriangulator ConvexPointSet CreateESGrid CutStructuredGrid DataSetSurface DisplacementPlot ExponentialCosine ExtractData ExtractSelection ExtractSelectionCells Hawaii Hexahedron HyperTreeGridSource ImageWarp IsoparametricCellsDemo LinearCellDemo LoadESGrid LoopShrink Motor OrientationMarkerWidget1 ParallelCoordinatesExtraction PineRootDecimation PlateVibration PointDataSubdivision Polyhedron Pyramid QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo QuadricVisualization ReadImageData ReadLegacyUnstructuredGrid ReadUnstructuredGrid RectilinearGrid ScalarBarWidget ShrinkCube TessellatedBoxSource Tetrahedron TextureCutQuadric TextureCutSphere TextureThreshold TissueLens TransformSphere TriangleStrip UGrid VisualizeRectilinearGrid WarpTo vtkDataSetReader Blow Office OfficeTube vtkDataSetSurfaceFilter DataSetSurface vtkDecimatePro DecimateFran DecimateHawaii Decimation FroggieSurface PineRootDecimation StripFran vtkDeformPointSet DeformPointSet vtkDelaunay2D ColoredElevationMap ConstrainedDelaunay2D CurvatureBandsWithGlyphs CurvaturesAdjustEdges Delaunay2D DelaunayMesh ElevationBandsWithGlyphs TriangulateTerrainMap vtkDelaunay3D ConnectivityFilter vtkDelimitedTextReader CSVReadEdit1 PointInterpolator vtkDICOMImageReader MarchingCubes ReadDICOM ReadDICOMSeries vtkDiscreteFlyingEdges3D DiscreteMarchingCubes GenerateModelsFromLabels MeshLabelImageColor vtkDiscreteMarchingCubes DiscreteMarchingCubes GenerateModelsFromLabels MeshLabelImageColor SmoothDiscreteMarchingCubes vtkDiscretizableColorTransferFunction ColorMapToLUT ColorMapToLUT_JSON ColorMapToLUT_XML RescaleReverseLUT TransientHDFReader vtkDiskSource BoundaryEdges Disk GeometricObjectsDemo SourceObjectsDemo vtkDoubleArray CurvatureBandsWithGlyphs CurvaturesAdjustEdges CutWithScalars EdgeWeights ElevationBandsWithGlyphs ExponentialCosine LabelVerticesAndEdges RectilinearGrid RGrid SGrid SingleSplat StippledLine TextureCutSphere VisualizeRectilinearGrid Vol WarpVector vtkEarthSource EarthSource vtkElevationFilter ClampGlyphSizes ColoredAnnotatedCube ColoredSphere ColorMapToLUT ColorMapToLUT_JSON ColorMapToLUT_XML CurvatureBandsWithGlyphs DeformPointSet ElevationBandsWithGlyphs GlyphTable Hawaii LoopShrink NamedColors ParallelCoordinatesExtraction ParallelCoordinatesView PointDataSubdivision ProgrammableGlyphs RescaleReverseLUT TransformSphere vtkExodusIIReader ReadExodusData vtkExplicitStructuredGrid CreateESGrid vtkExplicitStructuredGridToUnstructuredGrid CreateESGrid vtkExtractEdges DelaunayMesh MarchingCases MultiBlockDataSet ReadLegacyUnstructuredGrid vtkExtractGeometry ExtractData vtkExtractGrid PseudoVolumeRendering vtkExtractSelection CellPicking ExtractSelection ExtractSelectionCells ParallelCoordinatesExtraction vtkExtractVOI FlyingHeadSlice HeadSlice MeshLabelImageColor QuadricVisualization vtkFeatureEdges BoundaryEdges CapClip ClosedSurface CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo FilledPolygon vtkFieldDataToAttributeDataFilter FinanceFieldData vtkFixedPointVolumeRayCastMapper MedicalDemo4 SimpleRayCast VTKWithNumpy vtkFloatArray ClipDataSetWithPolyData ClipDataSetWithPolyData1 CreateColorSeriesDemo Cube CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs Finance ImplicitPolyDataDistance MarchingCases Motor MultiplePlots OverlappingAMR PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ScaleVertices ScatterPlot SpiderPlot SurfacePlot vtkFlyingEdges2D FlyingHeadSlice vtkFlyingEdges3D ExtractLargestIsosurface FrogBrain FroggieSurface HeadBone IsosurfaceSampling MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 TissueLens vtkFollower FinanceFieldData Stocks TextOrigin vtkForceDirectedLayoutStrategy ConstructGraph EdgeWeights RandomGraphSource ScaleVertices vtkFrustumSource Frustum vtkGaussianKernel PointInterpolator vtkGaussianSplatter Finance FinanceFieldData GaussianSplat SingleSplat SplatFace vtkGenericCell QuadraticHexahedronDemo QuadraticTetraDemo ReadLegacyUnstructuredGrid vtkGeometryFilter Blow GenerateCubesFromLabels GenerateModelsFromLabels vtkGlyph2D Glyph2D vtkGlyph3D AnimateVectors CameraBlur CarotidFlowGlyphs ClampGlyphSizes CurvatureBandsWithGlyphs DelaunayMesh ElevationBandsWithGlyphs Glyph3D GlyphTable Mace MarchingCases OrientedGlyphs ParametricObjectsDemo PointDataSubdivision QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo SpikeFran VisualizeDirectedGraph vtkGlyph3DMapper AppendFilter ConvexPointSet InteractorStyleTrackballCamera IsoparametricCellsDemo LinearCellDemo ReadLegacyUnstructuredGrid vtkGlyphSource2D VisualizeDirectedGraph vtkGraphLayout VisualizeDirectedGraph vtkGraphLayoutView ColorEdges ColorVertexLabels ColorVerticesLookupTable ConstructGraph ConstructTree CreateTree EdgeWeights LabelVerticesAndEdges RandomGraphSource ScaleVertices SelectedGraphIDs SelectedVerticesAndEdges SideBySideGraphs VisualizeDirectedGraph VisualizeGraph vtkGraphToGlyphs ScaleVertices vtkGraphToPolyData GraphToPolyData VisualizeDirectedGraph vtkHardwareSelector HardwareSelector vtkHausdorffDistancePointSetFilter AlignTwoPolyDatas vtkHDFReader TransientHDFReader vtkHDRReader HDRReader PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkHedgeHog ComplexV SGrid vtkHexagonalPrism Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkHexahedron Cell3DDemonstration DataSetSurface Hexahedron LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkHull Planes vtkHyperStreamline HyperStreamline vtkHyperTreeGridSource HyperTreeGridSource vtkHyperTreeGridToUnstructuredGrid HyperTreeGridSource vtkIdFilter CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo vtkIdList Cell3DDemonstration Cube CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo ExtractPolyLinesFromPolyData IterateOverLines MarchingCases PineRootConnectivity PineRootDecimation Polyhedron vtkIdTypeArray CellPicking ExtractSelection ExtractSelectionCells vtkImageAccumulate GenerateModelsFromLabels vtkImageActor Attenuation BackgroundImage Cast EnhanceEdges GaussianSmooth HybridMedianComparison IdealHighPass ImageNormalize ImageWeightedSum MedianComparison MedicalDemo3 MorphologyComparison Pad VTKSpectrum vtkImageAppend PolyDataToImageDataStencil vtkImageButterworthHighPass IdealHighPass vtkImageCanvasSource2D BackgroundImage ImageDataGeometryFilter vtkImageCast Attenuation Cast EnhanceEdges GaussianSmooth HybridMedianComparison ImageGradient ImageNormalize ImageWeightedSum MedianComparison vtkImageConstantPad FrogSlice ImageGradient Pad vtkImageData DiscreteMarchingCubes HybridMedianComparison MarchingCubes MedianComparison PointInterpolator PolyDataContourToImageData PseudoVolumeRendering SmoothDiscreteMarchingCubes StippledLine WriteReadVtkImageData vtkImageDataGeometryFilter CreateBFont HyperStreamline ImageDataGeometryFilter ImageWarp TensorAxes TensorEllipsoids WriteReadVtkImageData vtkImageDilateErode3D MorphologyComparison vtkImageEuclideanToPolar ImageGradient vtkImageExtractComponents IdealHighPass ImageGradient vtkImageFFT IdealHighPass VTKSpectrum vtkImageFlip PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkImageFourierCenter VTKSpectrum vtkImageGaussianSmooth Attenuation CreateBFont FrogBrain FroggieSurface GaussianSmooth ImageGradient IsoSubsample MedianComparison vtkImageGradient ClampGlyphSizes GlyphTable ImageGradient ParallelCoordinatesExtraction ParallelCoordinatesView vtkImageHSVToRGB ImageGradient vtkImageHybridMedian2D HybridMedianComparison vtkImageIdealHighPass IdealHighPass vtkImageImport VTKWithNumpy vtkImageIslandRemoval2D FroggieSurface vtkImageLaplacian EnhanceEdges vtkImageLogarithmicScale VTKSpectrum vtkImageLuminance ImageWarp vtkImageMagnify ImageGradient vtkImageMagnitude VTKSpectrum vtkImageMandelbrotSource Cast ImageWeightedSum vtkImageMapToColors MedicalDemo3 VTKSpectrum vtkImageMapToWindowLevelColors EnhanceEdges IdealHighPass Pad vtkImageMarchingCubes IsoSubsample vtkImageMathematics Attenuation DiscreteMarchingCubes EnhanceEdges HybridMedianComparison MedianComparison SmoothDiscreteMarchingCubes vtkImageMedian3D HybridMedianComparison MedianComparison vtkImageMirrorPad Pad vtkImageNoiseSource HybridMedianComparison MedianComparison vtkImageNormalize ImageNormalize vtkImageReader2Factory Attenuation EnhanceEdges GaussianSmooth HybridMedianComparison IdealHighPass IsoSubsample MedianComparison MorphologyComparison Pad PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing TexturePlane VTKSpectrum vtkImageRFFT IdealHighPass vtkImageSeedConnectivity MorphologyComparison vtkImageShiftScale Attenuation vtkImageShrink3D FroggieSurface IsoSubsample vtkImageSinusoidSource ImageNormalize ImageWeightedSum vtkImageStencil PolyDataContourToImageData PolyDataToImageDataStencil vtkImageThreshold DiscreteMarchingCubes FrogBrain FroggieSurface HybridMedianComparison MedianComparison SmoothDiscreteMarchingCubes vtkImageViewer HDRReader ImageGradient PolyDataToImageDataStencil vtkImageViewer2 ReadDICOM ReadDICOMSeries vtkImageWeightedSum ImageWeightedSum SumVTKImages vtkImageWrapPad GenerateCubesFromLabels vtkImplicitBoolean BooleanOperationImplicitFunctions ClipSphereCylinder ExtractData IceCream vtkImplicitModeller BlobbyLogo CameraModel1 CameraModel2 Hello vtkImplicitPlaneRepresentation ImplicitPlaneWidget2 vtkImplicitPlaneWidget2 ImplicitPlaneWidget2 vtkImplicitPolyDataDistance ClipDataSetWithPolyData ClipDataSetWithPolyData1 ImplicitPolyDataDistance vtkImplicitTextureCoords Motor TextureCutQuadric TextureCutSphere vtkIntArray CellTypeSource ColorEdges ColorVertexLabels ColorVerticesLookupTable KochSnowflake LabelVerticesAndEdges NOVCAGraph ScaleVertices vtkInteractorStyleImage Attenuation Cast EnhanceEdges GaussianSmooth Glyph2D HybridMedianComparison IdealHighPass MedianComparison MorphologyComparison Pad ReadDICOMSeries VTKSpectrum vtkInteractorStyleRubberBandPick CreateESGrid LoadESGrid vtkInteractorStyleTrackballActor InteractorStyleTrackballActor vtkInteractorStyleTrackballCamera CellPicking ClampGlyphSizes ColorMapToLUT ColorMapToLUT_JSON ColorMapToLUT_XML CompassWidget CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs EllipticalCylinder EllipticalCylinderDemo FroggieSurface FroggieView GlyphTable GradientBackground HardwareSelector HighlightPickedActor HighlightWithSilhouette InteractorStyleTrackballCamera LayeredActors MouseEvents MouseEventsObserver MultipleRenderWindows PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing RescaleReverseLUT ResetCameraOrientation SplineWidget StreamLines TextOrigin TransientHDFReader Tutorial_Step5 Tutorial_Step6 vtkIterativeClosestPointTransform AlignTwoPolyDatas IterativeClosestPoints vtkJPEGReader BackgroundImage SphereTexture vtkJPEGWriter Hanoi ImageWriter PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkLabeledDataMapper IsoparametricCellsDemo LinearCellDemo ReadLegacyUnstructuredGrid vtkLandmarkTransform AlignTwoPolyDatas vtkLight AmbientSpheres DiffuseSpheres PBR_Clear_Coat PBR_Mapping Shadows ShadowsLightsDemo SpecularSpheres vtkLightActor ShadowsLightsDemo vtkLightsPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkLine CappedSphere ColoredLines IterateOverLines LinearCellDemo LongLine RuledSurfaceFilter WarpVector WriteLegacyLinearCells WriteXMLLinearCells vtkLinearExtrusionFilter AlphaFrequency EllipticalCylinder EllipticalCylinderDemo PolyDataContourToImageData Stocks vtkLinearSubdivisionFilter CurvaturesAdjustEdges PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkLineSource AnimateVectors BluntStreamlines GeometricObjectsDemo Kitchen Line SourceObjectsDemo StippledLine TubeFilter WarpTo vtkLineWidget StreamlinesWithLineWidget vtkLODActor CameraModel1 CameraModel2 MeshLabelImageColor vtkLogLookupTable HyperStreamline vtkLookupTable AssignCellColorsFromLUT Blow CarotidFlow CarotidFlowGlyphs CellTypeSource ColoredAnnotatedCube ColoredElevationMap ColorEdges ColorVerticesLookupTable ComplexV CreateColorSeriesDemo CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo DiscreteMarchingCubes DisplacementPlot ElevationBandsWithGlyphs FrogBrain FroggieSurface FroggieView FrogSlice Hawaii KochSnowflake LOx LOxGrid LOxSeeds LUTUtilities MedicalDemo3 MeshLabelImageColor NamedColors ParallelCoordinatesExtraction PlatonicSolids PseudoVolumeRendering Rainbow ReadLegacyUnstructuredGrid ScalarBarWidget ScaleVertices SmoothDiscreteMarchingCubes TensorAxes TensorEllipsoids TissueLens TransformSphere vtkLoopSubdivisionFilter LineOnMesh SmoothMeshGrid vtkMarchingContourFilter FinanceFieldData vtkMarchingCubes ExtractLargestIsosurface FrogBrain FroggieSurface HeadBone IsosurfaceSampling MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 TissueLens vtkMarchingSquares ContourTriangulator vtkMaskFields GenerateModelsFromLabels vtkMaskPoints CarotidFlowGlyphs CurvatureBandsWithGlyphs ElevationBandsWithGlyphs ParametricObjectsDemo PointDataSubdivision SpikeFran SplatFace vtkMaskPolyData StripFran vtkMath CompassWidget DistanceBetweenPoints EllipticalCylinder EllipticalCylinderDemo OrientedArrow OrientedCylinder ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo SGrid vtkMatrix4x4 CollisionDetection EllipticalCylinderDemo FroggieSurface FroggieView FrogSlice OrientedArrow OrientedCylinder vtkMCubesReader PineRootConnectivity PineRootDecimation vtkMergeFilter ImageWarp vtkMergePoints HeadBone vtkMetaImageReader FlyingHeadSlice FrogBrain FroggieSurface FrogSlice GenerateCubesFromLabels GenerateModelsFromLabels HeadBone HeadSlice ImageGradient MedicalDemo1 MedicalDemo2 MedicalDemo3 MedicalDemo4 MeshLabelImageColor TissueLens vtkMetaImageWriter PolyDataContourToImageData vtkMinimalStandardRandomSequence BillboardTextActor3D CellTypeSource ColoredElevationMap ConstrainedDelaunay2D DelaunayMesh DiscreteMarchingCubes EllipticalCylinderDemo Hanoi HighlightPickedActor HighlightWithSilhouette Lorenz OrientedArrow OrientedCylinder ParametricObjectsDemo QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo SmoothDiscreteMarchingCubes SmoothMeshGrid SpiderPlot TriangulateTerrainMap vtkMultiBlockDataSet CellsInsideObject CompositePolyDataMapper MultiBlockDataSet vtkMultiBlockPLOT3DReader BluntStreamlines CombustorIsosurface CutStructuredGrid LOx LOxGrid LOxSeeds ProbeCombustor PseudoVolumeRendering Rainbow ReadPLOT3D StreamLines StreamlinesWithLineWidget TextureThreshold VelocityProfile WarpCombustor vtkMultiThreshold CellsInsideObject vtkMutableDirectedGraph ColorEdges ColorVertexLabels ColorVerticesLookupTable ConstructTree CreateTree EdgeWeights VisualizeDirectedGraph VisualizeGraph vtkMutableUndirectedGraph ConstructGraph GraphToPolyData LabelVerticesAndEdges ScaleVertices SideBySideGraphs vtkNew ColorMapToLUT_JSON ColorMapToLUT_XML vtkOBBTree AlignTwoPolyDatas vtkOBJReader AlignTwoPolyDatas BooleanOperationPolyDataFilter CapClip CellsInsideObject ClosedSurface Decimation FlatVersusGouraud GradientBackground NormalsDemo Rotations SaveSceneToFieldData SaveSceneToFile Shadows vtkOpaquePass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ShadowsLightsDemo vtkOpenGLRayCastImageDisplayHelper SimpleRayCast VTKWithNumpy vtkOpenGLRenderer PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat ShadowsLightsDemo vtkOpenGLSkybox PBR_Anisotropy PBR_Materials PBR_Materials_Coat vtkOrientationMarkerWidget AlignTwoPolyDatas AnatomicalOrientation CallBack ColoredAnnotatedCube CSVReadEdit CSVReadEdit1 DisplayCoordinateAxes FroggieSurface FroggieView OrientationMarkerWidget OrientationMarkerWidget1 PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkOrientedGlyphContourRepresentation ContourWidget vtkOutlineFilter AnimateVectors CallBack CarotidFlow CarotidFlowGlyphs ComplexV ContourQuadric DisplayQuadricSurfaces ExtractData FlyingHeadSlice HeadBone HeadSlice HyperStreamline IronIsoSurface MedicalDemo1 MedicalDemo2 MedicalDemo3 Outline OverlappingAMR ParallelCoordinatesExtraction PineRootConnectivity PineRootDecimation PlateVibration ProbeCombustor QuadricVisualization ReadSLC SampleFunction SingleSplat TensorAxes TensorEllipsoids vtkOutlineGlowPass OutlineGlowPass vtkOverlappingAMR OverlappingAMR vtkOverlayPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkParallelCoordinatesRepresentation ParallelCoordinatesExtraction ParallelCoordinatesView vtkParallelCoordinatesView ParallelCoordinatesExtraction ParallelCoordinatesView vtkParametricBohemianDome ParametricObjectsDemo vtkParametricBour CurvaturesAdjustEdges ParametricObjectsDemo vtkParametricBoy ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricCatalanMinimal ParametricObjectsDemo vtkParametricConicSpiral ParametricObjectsDemo vtkParametricCrossCap ParametricObjectsDemo vtkParametricDini ParametricObjectsDemo vtkParametricEllipsoid ParametricObjectsDemo PointDataSubdivision vtkParametricEnneper CurvaturesAdjustEdges ParametricObjectsDemo vtkParametricFigure8Klein ParametricObjectsDemo vtkParametricFunctionSource CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs LineOnMesh ParametricKuenDemo ParametricObjectsDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricHenneberg ParametricObjectsDemo vtkParametricKlein ParametricObjectsDemo vtkParametricKuen ParametricKuenDemo ParametricObjectsDemo vtkParametricMobius CurvaturesAdjustEdges ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricPluckerConoid ParametricObjectsDemo vtkParametricPseudosphere ParametricObjectsDemo vtkParametricRandomHills CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkParametricRoman ParametricObjectsDemo vtkParametricSpline LineOnMesh ParametricObjectsDemo vtkParametricSuperEllipsoid ParametricObjectsDemo ParametricSuperEllipsoidDemo vtkParametricSuperToroid ParametricObjectsDemo ParametricSuperToroidDemo vtkParametricTorus CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision vtkPentagonalPrism Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPerlinNoise PerlinNoise vtkPiecewiseFunction MedicalDemo4 SimpleRayCast VTKWithNumpy vtkPixel LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPlane CapClip ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 CutStructuredGrid Cutter CutWithCutFunction CutWithScalars DataSetSurface ExtractPolyLinesFromPolyData FilledPolygon IceCream ImplicitPlaneWidget2 PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PolyDataContourToImageData PolyDataToImageDataStencil PseudoVolumeRendering SolidClip vtkPlanes Frustum Motor Planes TextureCutSphere vtkPlanesIntersection PlanesIntersection vtkPlaneSource AnatomicalOrientation AssignCellColorsFromLUT CellPicking ClipSphereCylinder CreateColorSeriesDemo CurvatureBandsWithGlyphs ElevationBandsWithGlyphs ExponentialCosine FrogSlice Hanoi Plane ProbeCombustor ProgrammableGlyphs ShadowsLightsDemo SourceObjectsDemo StreamLines TexturePlane vtkPlatonicSolidSource PlatonicSolids vtkPlotPoints MultiplePlots ScatterPlot vtkPlotSurface SurfacePlot vtkPLYReader AlignTwoPolyDatas BooleanOperationPolyDataFilter CapClip CellsInsideObject ClosedSurface Decimation GradientBackground MotionBlur NormalsDemo Rotations SaveSceneToFieldData SaveSceneToFile Shadows WritePLY vtkPLYWriter WritePLY vtkPNGReader ContourTriangulator DecimateFran PBR_Clear_Coat PBR_Mapping PolyDataToImageDataStencil vtkPNGWriter Cell3DDemonstration Hanoi ImageWriter ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision PolyDataContourToImageData Screenshot WalkCow vtkPNMReader CreateBFont vtkPNMWriter Hanoi ImageWriter vtkPointGaussianMapper PointInterpolator vtkPointInterpolator PointInterpolator vtkPointLoad HyperStreamline TensorAxes TensorEllipsoids vtkPoints Actor2D AlignTwoPolyDatas AppendFilter BlankPoint Bottle CameraModel1 CameraModel2 CappedSphere Cell3DDemonstration CellTypeSource ColoredElevationMap ColoredLines ColoredTriangle ColorVerticesLookupTable ConstrainedDelaunay2D ContourWidget ConvexPointSet CreateESGrid CSVReadEdit Cube CurvatureBandsWithGlyphs CurvaturesAdjustEdges DataSetSurface DeformPointSet Delaunay2D DelaunayMesh ElevationBandsWithGlyphs EllipticalCylinder EllipticalCylinderDemo ExponentialCosine Finance Glyph2D Glyph3D GradientBackground GraphToPolyData Hexahedron ImplicitPolyDataDistance IterateOverLines IterativeClosestPoints KochSnowflake LinearCellDemo LineOnMesh LongLine MarchingCases Motor MultiLineText NOVCAGraph ParametricObjectsDemo PlanesIntersection Point Polygon PolygonIntersection Polyhedron PolyLine PolyLine1 ProgrammableGlyphFilter Pyramid Quad QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo RuledSurfaceFilter SGrid SideBySideGraphs SingleSplat SmoothMeshGrid SolidColoredTriangle Spring Tetrahedron TextureCutSphere Triangle TriangleColoredPoints TriangleCorners TriangleCornerVertices TriangleStrip TriangulateTerrainMap UGrid Vertex VertexGlyphFilter WarpVector WriteLegacyLinearCells WriteTriangleToFile WriteXMLLinearCells vtkPointSource AppendFilter CarotidFlow ExtractSelection InteractorStyleTrackballCamera LOx LOxGrid LOxSeeds NOVCAGraph Office PointSize PointSource SourceObjectsDemo vtkPolyData Actor2D AlignTwoPolyDatas AppendFilter AssignCellColorsFromLUT BooleanOperationPolyDataFilter Bottle CameraModel1 CameraModel2 CapClip CappedSphere ColoredElevationMap ColoredLines ColoredTriangle CombinePolyData ConstrainedDelaunay2D ContourWidget ConvexPointSet CSVReadEdit Cube CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo Decimation DeformPointSet Delaunay2D DelaunayMesh ElevationBandsWithGlyphs EllipticalCylinder EllipticalCylinderDemo ExponentialCosine FilledPolygon GaussianSplat GenerateModelsFromLabels GetValues Glyph2D Glyph3D GradientBackground ImplicitPolyDataDistance InteractorStyleTrackballCamera IterateOverLines IterativeClosestPoints KochSnowflake LineOnMesh LongLine MultiLineText NormalsDemo OrientedGlyphs PineRootConnectivity PineRootDecimation Planes Point Polygon PolyLine PolyLine1 ProgrammableGlyphFilter Quad RenameArray RuledSurfaceFilter SingleSplat SmoothMeshGrid SolidColoredTriangle Spring StreamlinesWithLineWidget Triangle TriangleColoredPoints TriangleCorners TriangleCornerVertices TriangleStrip TriangulateTerrainMap Vertex VertexGlyphFilter WarpVector WriteTriangleToFile vtkPolyDataConnectivityFilter ExtractLargestIsosurface PineRootConnectivity vtkPolyDataMapper2D Actor2D GradientBackground MultiLineText vtkPolyDataNormals BlobbyLogo Blow CombustorIsosurface CurvatureBandsWithGlyphs CurvaturesAdjustEdges DecimateFran DecimateHawaii DisplacementPlot ElevationBandsWithGlyphs FrogBrain FroggieSurface FroggieView FrogSlice MeshLabelImageColor Motor NormalsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PlateVibration PointDataSubdivision PseudoVolumeRendering ShadowsLightsDemo SpikeFran SplatFace Spring StripFran TensorEllipsoids VelocityProfile WarpCombustor vtkPolyDataReader AlignTwoPolyDatas BlobbyLogo BooleanOperationPolyDataFilter CellsInsideObject ClosedSurface DecimateFran DecimateHawaii Decimation DisplacementPlot FroggieView GradientBackground Hawaii Hello PlateVibration SpikeFran SplatFace Stocks StripFran vtkPolyDataSilhouette HighlightWithSilhouette vtkPolyDataTangents CurvaturesAdjustEdges PBR_Anisotropy PBR_Clear_Coat PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkPolyDataToImageStencil PolyDataContourToImageData PolyDataToImageDataStencil vtkPolyDataWriter AlignTwoPolyDatas vtkPolygon ConstrainedDelaunay2D LinearCellDemo Polygon PolygonIntersection WriteLegacyLinearCells WriteXMLLinearCells vtkPolyhedron Dodecahedron vtkPolyLine CSVReadEdit CSVReadEdit1 EllipticalCylinder EllipticalCylinderDemo GradientBackground KochSnowflake LinearCellDemo PolyLine WriteLegacyLinearCells WriteXMLLinearCells vtkPolyVertex LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkPostScriptWriter Hanoi ImageWriter vtkProbeFilter IsosurfaceSampling ProbeCombustor TissueLens vtkProgrammableGlyphFilter ProgrammableGlyphFilter ProgrammableGlyphs vtkProp3D OrientedArrow OrientedCylinder vtkPropAssembly AnatomicalOrientation ColoredAnnotatedCube FroggieSurface FroggieView vtkPropPicker HighlightPickedActor HighlightWithSilhouette vtkPyramid Cell3DDemonstration LinearCellDemo Pyramid WriteLegacyLinearCells WriteXMLLinearCells vtkQuad LinearCellDemo Quad WriteLegacyLinearCells WriteXMLLinearCells vtkQuadraticEdge IsoparametricCellsDemo vtkQuadraticHexahedron IsoparametricCellsDemo QuadraticHexahedron QuadraticHexahedronDemo vtkQuadraticLinearQuad IsoparametricCellsDemo vtkQuadraticLinearWedge IsoparametricCellsDemo vtkQuadraticPolygon IsoparametricCellsDemo vtkQuadraticPyramid IsoparametricCellsDemo vtkQuadraticQuad IsoparametricCellsDemo vtkQuadraticTetra IsoparametricCellsDemo QuadraticTetra QuadraticTetraDemo vtkQuadraticTriangle IsoparametricCellsDemo vtkQuadraticWedge IsoparametricCellsDemo vtkQuadric ContourQuadric DisplayQuadricSurfaces ExtractData FlatVersusGouraud ImplicitQuadric QuadricVisualization TextureCutQuadric vtkRandomGraphSource RandomGraphSource SelectedGraphIDs SelectedVerticesAndEdges vtkRectf SurfacePlot vtkRectilinearGrid ClipDataSetWithPolyData ClipDataSetWithPolyData1 RectilinearGrid RGrid VisualizeRectilinearGrid vtkRectilinearGridGeometryFilter ClipDataSetWithPolyData ClipDataSetWithPolyData1 RGrid vtkRegularPolygonSource BalloonWidget Circle GeometricObjectsDemo Glyph2D RegularPolygonSource vtkRenderedGraphRepresentation ColorVertexLabels ScaleVertices vtkRenderLargeImage PointDataSubdivision vtkRenderPassCollection PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Shadows ShadowsLightsDemo vtkRenderStepsPass MotionBlur OutlineGlowPass vtkResampleWithDataSet PointInterpolator vtkReverseSense CurvatureBandsWithGlyphs ElevationBandsWithGlyphs vtkRibbonFilter Stocks StreamlinesWithLineWidget vtkRotationalExtrusionFilter Bottle CameraModel1 CameraModel2 CappedSphere Spring vtkRTAnalyticSource ClampGlyphSizes GlyphTable ParallelCoordinatesExtraction ParallelCoordinatesView vtkRuledSurfaceFilter RuledSurfaceFilter vtkRungeKutta4 OfficeTube StreamlinesWithLineWidget vtkSampleFunction Attenuation BooleanOperationImplicitFunctions ContourQuadric DiscreteMarchingCubes DisplayQuadricSurfaces ExtractData FlatVersusGouraud IceCream ImplicitQuadric ImplicitSphere ImplicitSphere1 IsosurfaceSampling PerlinNoise QuadricVisualization SampleFunction SmoothDiscreteMarchingCubes vtkScalarBarActor CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs RescaleReverseLUT ScalarBarWidget vtkScalarBarWidget ScalarBarWidget vtkSelectEnclosedPoints CellsInsideObject vtkSelection CellPicking ExtractSelection ExtractSelectionCells vtkSelectionNode CellPicking ExtractSelection ExtractSelectionCells vtkSequencePass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Shadows ShadowsLightsDemo vtkShadowMapPass Shadows ShadowsLightsDemo vtkShortArray Lorenz vtkShrinkFilter CellTypeSource ExtractData HyperTreeGridSource LoopShrink ReadLegacyUnstructuredGrid ShrinkCube TessellatedBoxSource VisualizeRectilinearGrid vtkShrinkPolyData Frustum MarchingCases RegularPolygonSource vtkSimple2DLayoutStrategy SelectedGraphIDs VisualizeDirectedGraph vtkSimpleMotionBlurPass MotionBlur vtkSkybox PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkSLCReader ReadSLC vtkSliderRepresentation2D FroggieView ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing QuadraticHexahedronDemo QuadraticTetraDemo vtkSliderWidget FroggieView ParametricKuenDemo ParametricSuperEllipsoidDemo ParametricSuperToroidDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing QuadraticHexahedronDemo QuadraticTetraDemo vtkSphere Attenuation BooleanOperationImplicitFunctions ClipSphereCylinder DiscreteMarchingCubes ExtractData IceCream ImplicitSphere ImplicitSphere1 IsosurfaceSampling OverlappingAMR SmoothDiscreteMarchingCubes TissueLens vtkSphereSource AmbientSpheres Animation AppendFilter Axes BalloonWidget BillboardTextActor3D BooleanOperationPolyDataFilter Camera CameraBlur CameraModel1 CameraModel2 CapClip CollisionDetection ColorAnActor ColoredSphere ColorMapToLUT ColorMapToLUT_JSON ColorMapToLUT_XML CombinePolyData CompositePolyDataMapper ConnectivityFilter ConvexPointSet CurvatureBandsWithGlyphs Decimation DeformPointSet DelaunayMesh DiffuseSpheres DisplayCoordinateAxes EarthSource ElevationBandsWithGlyphs EmbedInPyQt EmbedInPyQt2 ExtractPolyLinesFromPolyData ExtractSelectionCells FilledPolygon FlatVersusGouraud GaussianSplat GeometricObjectsDemo GetValues GlyphTable GradientBackground HardwareSelector HighlightPickedActor HighlightWithSilhouette ImageWriter ImplicitPlaneWidget2 ImplicitPolyDataDistance InteractorStyleTrackballActor InteractorStyleTrackballCamera IsoparametricCellsDemo LinearCellDemo LoopShrink Mace MarchingCases MarchingCubes Model MouseEvents MouseEventsObserver MultiBlockDataSet MultipleRenderWindows MultipleViewports OrientedArrow OrientedCylinder OrientedGlyphs PBR_Anisotropy PBR_Edge_Tint PBR_HDR_Environment PBR_Materials PBR_Materials_Coat Planes PlanesIntersection PointDataSubdivision PolyDataContourToImageData PolyDataToImageDataStencil ProgrammableGlyphFilter QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo ReadLegacyUnstructuredGrid RenameArray Rotations Screenshot Shadows ShadowsLightsDemo ShareCamera SourceObjectsDemo SpecularSpheres Sphere SphereTexture TensorEllipsoids TextureCutQuadric TextureCutSphere TextWidget TissueLens TransformPolyData TransformSphere WindowTitle WritePLY WriteSTL vtkSphereWidget SphereWidget vtkSpiderPlotActor SpiderPlot vtkSplineWidget SplineWidget vtkSTLReader AlignTwoPolyDatas BooleanOperationPolyDataFilter CapClip CellsInsideObject ClosedSurface Decimation GradientBackground NormalsDemo PointInterpolator ReadSTL Rotations SaveSceneToFieldData SaveSceneToFile Shadows WriteSTL vtkSTLWriter WriteSTL vtkStreamTracer BluntStreamlines CarotidFlow Kitchen LOx LOxGrid LOxSeeds Office OfficeTube StreamLines StreamlinesWithLineWidget vtkStringArray CreateTree SaveSceneToFieldData Variant vtkStripper Bottle CapClip ExtractPolyLinesFromPolyData FilledPolygon FrogBrain FroggieSurface MedicalDemo2 MedicalDemo3 PolyDataContourToImageData PolyDataToImageDataStencil PseudoVolumeRendering StripFran vtkStructuredGrid BlankPoint SGrid vtkStructuredGridGeometryFilter BlankPoint BluntStreamlines CutStructuredGrid Kitchen LOx LOxGrid LOxSeeds Office OfficeTube Rainbow ReadPLOT3D TextureThreshold VelocityProfile WarpCombustor vtkStructuredGridOutlineFilter BluntStreamlines CombustorIsosurface CutStructuredGrid Kitchen LOx LOxGrid Office OfficeTube ProbeCombustor PseudoVolumeRendering Rainbow StreamLines StreamlinesWithLineWidget TextureThreshold VelocityProfile WarpCombustor vtkStructuredGridReader Kitchen vtkStructuredPoints Lorenz Vol vtkStructuredPointsReader AnimateVectors CarotidFlow CarotidFlowGlyphs ComplexV ExtractLargestIsosurface IronIsoSurface Motor SimpleRayCast TextureCutSphere TextureThreshold vtkSuperquadric SampleFunction vtkSuperquadricSource BackgroundImage CubeAxesActor CurvatureBandsWithGlyphs CurvaturesDemo ElevationBandsWithGlyphs OrientationMarkerWidget1 PointDataSubdivision ProgrammableGlyphs SolidClip vtkTable MultiplePlots ScatterPlot SurfacePlot vtkTableBasedClipDataSet ClipUnstructuredGridWithPlane vtkTableToPolyData CSVReadEdit1 PointInterpolator vtkTensorGlyph TensorAxes TensorEllipsoids vtkTessellatedBoxSource TessellatedBoxSource vtkTessellatorFilter CellTypeSource QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo vtkTetra Cell3DDemonstration CellTypeSource LinearCellDemo Tetrahedron WriteLegacyLinearCells WriteXMLLinearCells vtkTextActor CameraModel1 CameraModel2 CollisionDetection TextActor TextWidget vtkTextMapper Cell3DDemonstration CellTypeSource CurvaturesAdjustEdges CurvaturesDemo GeometricObjectsDemo GradientBackground IsoparametricCellsDemo LinearCellDemo MultiLineText ParametricObjectsDemo Planes PlatonicSolids PointDataSubdivision QuadraticHexahedronDemo QuadraticTetraDemo ReadDICOMSeries RescaleReverseLUT SourceObjectsDemo vtkTextProperty Cell3DDemonstration CellTypeSource CurvaturesAdjustEdges CurvaturesDemo GeometricObjectsDemo GradientBackground IsoparametricCellsDemo LinearCellDemo MultiLineText ParametricObjectsDemo Planes PlatonicSolids PointDataSubdivision QuadraticHexahedronDemo QuadraticTetraDemo ReadDICOMSeries RescaleReverseLUT SourceObjectsDemo vtkTextRepresentation TextWidget vtkTextSource SourceObjectsDemo TextSource vtkTexture AnimateVectors DecimateFran FrogSlice Motor PBR_Anisotropy PBR_Clear_Coat PBR_Edge_Tint PBR_HDR_Environment PBR_Mapping PBR_Materials PBR_Materials_Coat PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing SphereTexture StippledLine TextureCutQuadric TextureCutSphere TexturePlane TextureThreshold vtkTexturedSphereSource CurvaturesAdjustEdges PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkTextureMapToSphere PBR_Anisotropy SphereTexture vtkTextWidget TextWidget vtkThreshold GenerateCubesFromLabels GenerateModelsFromLabels vtkThresholdPoints AnimateVectors CarotidFlow CarotidFlowGlyphs MarchingCases vtkThresholdTextureCoords TextureThreshold vtkTIFFWriter Hanoi ImageWriter vtkToneMappingPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing vtkTransform AlignTwoPolyDatas AnatomicalOrientation Axes BlobbyLogo BoxWidget CameraModel1 CameraModel2 CellsInsideObject ClipSphereCylinder ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 CollisionDetection ColoredAnnotatedCube CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo ElevationBandsWithGlyphs EllipticalCylinderDemo ExponentialCosine ExtractData FroggieSurface FroggieView FrogSlice GenerateCubesFromLabels LayeredActors MarchingCases OrientedArrow OrientedCylinder PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ProbeCombustor RotationAroundLine SpikeFran Stocks TransformPolyData TransformSphere Tutorial_Step6 WalkCow vtkTransformFilter CameraModel1 CameraModel2 CurvaturesDemo FroggieSurface FroggieView FrogSlice GenerateCubesFromLabels TransformSphere vtkTransformPolyDataFilter AlignTwoPolyDatas AnatomicalOrientation BlobbyLogo CameraModel1 CameraModel2 CellsInsideObject ColoredAnnotatedCube CSVReadEdit CSVReadEdit1 CurvatureBandsWithGlyphs CurvaturesAdjustEdges ElevationBandsWithGlyphs EllipticalCylinderDemo ExponentialCosine FroggieSurface FroggieView FrogSlice IterativeClosestPoints MarchingCases OrientedArrow OrientedCylinder PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing ProbeCombustor RotationAroundLine SpikeFran Stocks TransformPolyData vtkTree ConstructTree CreateTree vtkTriangle CellTypeSource ColoredTriangle KochSnowflake LinearCellDemo LineOnMesh SmoothMeshGrid SolidColoredTriangle Triangle WriteLegacyLinearCells WriteTriangleToFile WriteXMLLinearCells vtkTriangleFilter BooleanOperationPolyDataFilter CellPicking CurvatureBandsWithGlyphs CurvaturesAdjustEdges CurvaturesDemo Decimation ElevationBandsWithGlyphs PBR_Clear_Coat PBR_Mapping PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision PolyDataToImageDataStencil vtkTriangleStrip LinearCellDemo TriangleStrip WriteLegacyLinearCells WriteXMLLinearCells vtkTriQuadraticHexahedron IsoparametricCellsDemo vtkTubeFilter Bottle CarotidFlow DelaunayMesh EllipticalCylinderDemo Finance FinanceFieldData LOx LOxGrid LOxSeeds MarchingCases OfficeTube PseudoVolumeRendering ReadLegacyUnstructuredGrid Stocks TensorAxes TubeFilter WarpTo vtkUniformGrid OverlappingAMR vtkUnsignedCharArray AssignCellColorsFromLUT ColoredAnnotatedCube ColoredElevationMap ColoredLines ColoredTriangle LineOnMesh SmoothMeshGrid SolidColoredTriangle TriangleColoredPoints vtkUnstructuredGrid AppendFilter Cell3DDemonstration CellPicking ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ConvexPointSet CreateESGrid DataSetSurface ExtractSelection ExtractSelectionCells Finance Hexahedron IsoparametricCellsDemo LinearCellDemo MarchingCases NOVCAGraph Polyhedron Pyramid QuadraticHexahedron QuadraticHexahedronDemo QuadraticTetra QuadraticTetraDemo ReadLegacyUnstructuredGrid Tetrahedron UGrid WriteLegacyLinearCells WriteXMLLinearCells vtkUnstructuredGridReader ClipUnstructuredGridWithPlane ClipUnstructuredGridWithPlane2 ReadLegacyUnstructuredGrid ScalarBarWidget vtkUnstructuredGridToExplicitStructuredGrid CreateESGrid LoadESGrid vtkUnstructuredGridWriter WriteLegacyLinearCells vtkVariant CurvatureBandsWithGlyphs ElevationBandsWithGlyphs LUTUtilities Variant vtkVariantArray CurvatureBandsWithGlyphs ElevationBandsWithGlyphs LUTUtilities ReadLegacyUnstructuredGrid Variant vtkVariantCast Variant vtkVariantCreate Variant vtkVariantExtract Variant vtkVector2i SurfacePlot vtkVectorDot DisplacementPlot PlateVibration vtkVectorText AlphaFrequency AnatomicalOrientation FinanceFieldData MarchingCases Stocks TextOrigin VectorText vtkVersion AlignTwoPolyDatas AssignCellColorsFromLUT CheckVTKVersion CompassWidget CurvatureBandsWithGlyphs Curvatures CurvaturesAdjustEdges CurvaturesDemo DiscreteMarchingCubes ElevationBandsWithGlyphs ExtractLargestIsosurface FrogBrain GenerateModelsFromLabels HeadBone IsosurfaceSampling MarchingCubes MedicalDemo1 MedicalDemo2 MedicalDemo3 MeshLabelImageColor OutlineGlowPass PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing PointDataSubdivision SplineWidget TissueLens VTKImportsForPython vtkVertex LinearCellDemo Vertex WriteLegacyLinearCells WriteXMLLinearCells vtkVertexGlyphFilter Actor2D Delaunay2D ImplicitPolyDataDistance TriangulateTerrainMap VertexGlyphFilter vtkViewport GradientBackground vtkViewTheme ColorEdges ColorVerticesLookupTable CreateTree ScaleVertices SelectedGraphIDs vtkViewUpdater ParallelCoordinatesExtraction vtkVolume MedicalDemo4 SimpleRayCast VTKWithNumpy vtkVolumeProperty MedicalDemo4 SimpleRayCast VTKWithNumpy vtkVoxel Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkVoxelModeller MarchingCubes vtkWarpScalar ExponentialCosine ImageWarp WarpCombustor vtkWarpTo CameraModel1 CameraModel2 WarpTo vtkWarpVector Blow DisplacementPlot PlateVibration VelocityProfile WarpVector vtkWedge Cell3DDemonstration LinearCellDemo WriteLegacyLinearCells WriteXMLLinearCells vtkWidgetEvent ContourWidget vtkWindowedSincPolyDataFilter FrogBrain FroggieSurface GenerateModelsFromLabels MeshLabelImageColor SmoothDiscreteMarchingCubes vtkWindowLevelLookupTable FrogSlice VTKSpectrum vtkWindowToImageFilter Cell3DDemonstration Hanoi ImageWriter ParametricObjectsDemo PBR_Skybox PBR_Skybox_Anisotropy PBR_Skybox_Texturing Screenshot WalkCow vtkXMLDataSetWriter WriteXMLLinearCells vtkXMLImageDataReader ReadImageData WriteReadVtkImageData vtkXMLImageDataWriter WriteReadVtkImageData vtkXMLPolyDataReader AlignTwoPolyDatas AnatomicalOrientation AssignCellColorsFromLUT BooleanOperationPolyDataFilter CameraOrientationWidget CellsInsideObject ClosedSurface Curvatures CutWithCutFunction CutWithScalars Decimation GradientBackground ImplicitPlaneWidget2 NormalsDemo OrientationMarkerWidget1 ReadPolyData ReadVTP Rotations vtkXMLPolyDataWriter AssignCellColorsFromLUT ColoredTriangle CSVReadEdit CSVReadEdit1 Curvatures CurvaturesAdjustEdges GenerateModelsFromLabels PolyDataContourToImageData RenameArray SolidColoredTriangle TriangleColoredPoints TriangleCorners TriangleCornerVertices WriteTriangleToFile vtkXMLUnstructuredGridReader LoadESGrid ReadUnstructuredGrid vtkXMLUnstructuredGridWriter NOVCAGraph Polyhedron"},{"location":"Python/DataManipulation/LineOnMesh/","title":"LineOnMesh","text":"

        vtk-examples/Python/DataManipulation/LineOnMesh

        "},{"location":"Python/DataManipulation/LineOnMesh/#description","title":"Description","text":"

        Create a terrain with regularly spaced points and smooth the terrain (see SmoothMeshgrid. Then, a vtkCellLocator is used to find the intersection between vertical lines and the surface (using the IntersectWithLine method). Each intersection is saved as x, y, z coordinates and used to plot a spline on the surface.

        • Contributed by Michka Popoff

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/DataManipulation/LineOnMesh/#code","title":"Code","text":"

        LineOnMesh.py

        #!/usr/bin/env python\n\nimport numpy as np\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import vtkParametricSpline\nfrom vtkmodules.vtkCommonCore import (\n    mutable,\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkCellLocator,\n    vtkPolyData,\n    vtkTriangle\n)\nfrom vtkmodules.vtkFiltersCore import vtkCleanPolyData\nfrom vtkmodules.vtkFiltersModeling import vtkLoopSubdivisionFilter\nfrom vtkmodules.vtkFiltersSources import vtkParametricFunctionSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    named_colors = vtkNamedColors()\n\n    # Make a 32 x 32 grid.\n    size = 32\n\n    # Define z values for the topography.\n    # Comment out the following line if you want a different random\n    #  distribution each time the script is run.\n    np.random.seed(3)\n    topography = np.random.randint(0, 5, (size, size))\n\n    # Define points, triangles and colors\n    colors = vtkUnsignedCharArray()\n    colors.SetNumberOfComponents(3)\n    points = vtkPoints()\n    triangles = vtkCellArray()\n\n    # Build the meshgrid manually.\n    count = 0\n    for i in range(size - 1):\n        for j in range(size - 1):\n            z1 = topography[i][j]\n            z2 = topography[i][j + 1]\n            z3 = topography[i + 1][j]\n\n            # Triangle 1\n            points.InsertNextPoint(i, j, z1)\n            points.InsertNextPoint(i, (j + 1), z2)\n            points.InsertNextPoint((i + 1), j, z3)\n\n            triangle = vtkTriangle()\n            triangle.GetPointIds().SetId(0, count)\n            triangle.GetPointIds().SetId(1, count + 1)\n            triangle.GetPointIds().SetId(2, count + 2)\n\n            triangles.InsertNextCell(triangle)\n\n            z1 = topography[i][j + 1]\n            z2 = topography[i + 1][j + 1]\n            z3 = topography[i + 1][j]\n\n            # Triangle 2\n            points.InsertNextPoint(i, (j + 1), z1)\n            points.InsertNextPoint((i + 1), (j + 1), z2)\n            points.InsertNextPoint((i + 1), j, z3)\n\n            triangle = vtkTriangle()\n            triangle.GetPointIds().SetId(0, count + 3)\n            triangle.GetPointIds().SetId(1, count + 4)\n            triangle.GetPointIds().SetId(2, count + 5)\n\n            count += 6\n\n            triangles.InsertNextCell(triangle)\n\n            # Add some color.\n            r = [int(i / float(size) * 255), int(j / float(size) * 255), 0]\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n\n    # Create a polydata object.\n    trianglePolyData = vtkPolyData()\n\n    # Add the geometry and topology to the polydata.\n    trianglePolyData.SetPoints(points)\n    trianglePolyData.GetPointData().SetScalars(colors)\n    trianglePolyData.SetPolys(triangles)\n\n    # Clean the polydata so that the edges are shared!\n    cleanPolyData = vtkCleanPolyData()\n    cleanPolyData.SetInputData(trianglePolyData)\n\n    # Use a filter to smooth the data (will add triangles and smooth).\n    smooth_loop = vtkLoopSubdivisionFilter()\n    smooth_loop.SetNumberOfSubdivisions(3)\n    smooth_loop.SetInputConnection(cleanPolyData.GetOutputPort())\n\n    # Create a mapper and actor for smoothed dataset.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(smooth_loop.GetOutputPort())\n    actor_loop = vtkActor()\n    actor_loop.SetMapper(mapper)\n    actor_loop.GetProperty().SetInterpolationToFlat()\n\n    # Update the pipeline so that vtkCellLocator finds cells!\n    smooth_loop.Update()\n\n    # Define a cellLocator to be able to compute intersections between lines.\n    # and the surface\n    locator = vtkCellLocator()\n    locator.SetDataSet(smooth_loop.GetOutput())\n    locator.BuildLocator()\n\n    maxloop = 1000\n    dist = 20.0 / maxloop\n    tolerance = 0.001\n\n    # Make a list of points. Each point is the intersection of a vertical line\n    # defined by p1 and p2 and the surface.\n    points = vtkPoints()\n    for i in range(maxloop):\n        p1 = [2 + i * dist, 16, -1]\n        p2 = [2 + i * dist, 16, 6]\n\n        # Outputs (we need only pos which is the x, y, z position\n        # of the intersection)\n        t = mutable(0)\n        pos = [0.0, 0.0, 0.0]\n        pcoords = [0.0, 0.0, 0.0]\n        subId = mutable(0)\n        locator.IntersectWithLine(p1, p2, tolerance, t, pos, pcoords, subId)\n\n        # Add a slight offset in z.\n        pos[2] += 0.01\n        # Add the x, y, z position of the intersection.\n        points.InsertNextPoint(pos)\n\n    # Create a spline and add the points\n    spline = vtkParametricSpline()\n    spline.SetPoints(points)\n    functionSource = vtkParametricFunctionSource()\n    functionSource.SetUResolution(maxloop)\n    functionSource.SetParametricFunction(spline)\n\n    # Map the spline\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(functionSource.GetOutputPort())\n\n    # Define the line actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(named_colors.GetColor3d('Red'))\n    actor.GetProperty().SetLineWidth(3)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add actors and render\n    renderer.AddActor(actor)\n    renderer.AddActor(actor_loop)\n\n    renderer.SetBackground(named_colors.GetColor3d('Cornsilk'))\n    renderWindow.SetSize(800, 800)\n    renderWindow.Render()\n    renderer.GetActiveCamera().SetPosition(-32.471276, 53.258788, 61.209332)\n    renderer.GetActiveCamera().SetFocalPoint(15.500000, 15.500000, 2.000000)\n    renderer.GetActiveCamera().SetViewUp(0.348057, -0.636740, 0.688055)\n    renderer.ResetCameraClippingRange()\n    renderWindow.SetWindowName('LineOnMesh')\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/DataManipulation/MeshLabelImageColor/","title":"MeshLabelImageColor","text":"

        vtk-examples/Python/DataManipulation/MeshLabelImageColor

        "},{"location":"Python/DataManipulation/MeshLabelImageColor/#description","title":"Description","text":"

        This example takes a label image in Meta format and meshes a single label of it. It then smooths the mesh and colours the vertices according to the displacement error introduced by the smoothing. The whole thing is then displayed.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/DataManipulation/MeshLabelImageColor/#code","title":"Code","text":"

        MeshLabelImageColor.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataNormals,\n    vtkWindowedSincPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkDiscreteFlyingEdges3D,\n    vtkDiscreteMarchingCubes\n)\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkExtractVOI\nfrom vtkmodules.vtkRenderingCore import (\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingLOD import vtkLODActor\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n    ifn, index = get_program_parameters()\n\n    # Prepare to read the file.\n    reader_volume = vtkMetaImageReader()\n    reader_volume.SetFileName(ifn)\n    reader_volume.Update()\n\n    # Extract the region of interest.\n    voi = vtkExtractVOI()\n    voi.SetInputConnection(reader_volume.GetOutputPort())\n    voi.SetVOI(0, 517, 0, 228, 0, 392)\n    voi.SetSampleRate(1, 1, 1)\n    voi.Update()  # Necessary for GetScalarRange().\n    srange = voi.GetOutput().GetScalarRange()  # Needs Update() before!\n    print('Range', srange)\n\n    # Prepare surface generation.\n    # For label images.\n    if use_flying_edges:\n        try:\n            contour = vtkDiscreteFlyingEdges3D()\n        except AttributeError:\n            contour = vtkDiscreteMarchingCubes()\n    else:\n        contour = vtkDiscreteMarchingCubes()\n    contour.SetInputConnection(voi.GetOutputPort())\n    # contour.ComputeNormalsOn()\n\n    print('Doing label', index)\n\n    contour.SetValue(0, index)\n    contour.Update()  # Needed for GetNumberOfPolys()!!!\n\n    smoother = vtkWindowedSincPolyDataFilter()\n    smoother.SetInputConnection(contour.GetOutputPort())\n    smoother.SetNumberOfIterations(30)  # This has little effect on the error!\n    # smoother.BoundarySmoothingOff()\n    # smoother.FeatureEdgeSmoothingOff()\n    # smoother.SetFeatureAngle(120.0)\n    # smoother.SetPassBand(0.001)        # This increases the error a lot!\n    smoother.NonManifoldSmoothingOn()\n    smoother.NormalizeCoordinatesOn()\n    smoother.GenerateErrorScalarsOn()\n    # smoother.GenerateErrorVectorsOn()\n    smoother.Update()\n\n    # Find min and max of the smoother error.\n    se_range = smoother.GetOutput().GetPointData().GetScalars().GetRange()\n    print('Smoother error range:', se_range)\n    if se_range[1] > 1:\n        print('Big smoother error: min/max:', se_range[0], se_range[1])\n\n    lut = get_diverging_lut(4)\n\n    # Calculate cell normals.\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(smoother.GetOutputPort())\n    normals.ComputeCellNormalsOn()\n    normals.ComputePointNormalsOff()\n    normals.ConsistencyOn()\n    normals.AutoOrientNormalsOn()\n    normals.Update()  # Creates vtkPolyData.\n    normals.SetFeatureAngle(60.0)\n\n    mapper = vtkPolyDataMapper()\n    # mapper.SetInputConnection(smoother.GetOutputPort()) # This has no normals.\n    mapper.SetInputConnection(normals.GetOutputPort())  # This is better for visibility.)\n    mapper.ScalarVisibilityOn()  # Show colour.\n    mapper.SetScalarRange(se_range)\n    # mapper.SetScalarModeToUseCellData() # Contains the label eg. 31\n    mapper.SetScalarModeToUsePointData()  # The smoother error relates to the verts.\n    mapper.SetLookupTable(lut)\n\n    # Take the isosurface data and create geometry.\n    actor = vtkLODActor()\n    actor.SetNumberOfCloudPoints(100000)\n    actor.SetMapper(mapper)\n\n    # Create the renderer.\n    ren = vtkRenderer()\n    ren.SetBackground(colors.GetColor3d('DimGray'))\n    ren.AddActor(actor)\n\n    # Create a window for the renderer of size 600X600\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetSize(600, 600)\n    ren_win.SetWindowName('MeshLabelImageColor')\n    ren_win.Render()\n\n    # Set a user interface interactor for the render window.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Start the initialization and rendering.\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'MeshLabelImageColor.'\n    epilogue = '''\n        Takes a label image in Meta format and meshes a single label of it.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='labels.mhd')\n    parser.add_argument('label', nargs='?', const=1, type=int, default=31, help='The label to use e.g 31')\n    args = parser.parse_args()\n    return args.filename, args.label\n\n\ndef get_diverging_lut(ct=0):\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n\n    :param ct: The index of the color map to use.\n    :return: The lookup table.\n    \"\"\"\n\n    cm = dict()\n    # Start point = 0.0, mid point = 0.5 and end point = 1.0.\n    # Each value is a list with three sublists corresponding to the start point,\n    # mid point and end point along with the rgb color values for the respective point.\n    # cool to warm\n    cm[0] = [[0.0, 0.230, 0.299, 0.754], [0.5, 0.865, 0.865, 0.865], [1.0, 0.706, 0.016, 0.150]]\n    # purple to orange\n    cm[1] = [[0.0, 0.436, 0.308, 0.631], [0.5, 0.865, 0.865, 0.865], [1.0, 0.759, 0.334, 0.046]]\n    # green to purple\n    cm[2] = [[0.0, 0.085, 0.532, 0.201], [0.5, 0.865, 0.865, 0.865], [1.0, 0.436, 0.308, 0.631]]\n    # blue to brown\n    cm[3] = [[0.0, 0.217, 0.525, 0.910], [0.5, 0.865, 0.865, 0.865], [1.0, 0.677, 0.492, 0.093]]\n    # green to red\n    cm[4] = [[0.0, 0.085, 0.532, 0.201], [0.5, 0.865, 0.865, 0.865], [1.0, 0.758, 0.214, 0.233]]\n\n    ct = abs(ct)\n    if ct > len(cm) - 1:\n        ct = 0\n        print('The selected diverging color map is unavailable. Using the default cool to warm one.')\n\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    for scheme in cm[ct]:\n        ctf.AddRGBPoint(*scheme)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ExplicitStructuredGrid/CreateESGrid/","title":"CreateESGrid","text":"

        vtk-examples/Python/ExplicitStructuredGrid/CreateESGrid

        "},{"location":"Python/ExplicitStructuredGrid/CreateESGrid/#description","title":"Description","text":"

        This example demonstrates how (1) to create an explicit structured grid and (2) to convert an explicit structured grid into an unstructured grid or vice versa.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ExplicitStructuredGrid/CreateESGrid/#code","title":"Code","text":"

        CreateESGrid.py

        #!/usr/bin/env python\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkExplicitStructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkExplicitStructuredGridToUnstructuredGrid,\n    vtkUnstructuredGridToExplicitStructuredGrid\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleRubberBandPick\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef create_explicit_structured_grid(dimensions, spacing=(1, 1, 1)):\n    \"\"\"Create an explicit structured grid.\n\n    Parameters\n    ----------\n    dimensions : tuple(int, int, int)\n        The number of points in the I, J and K directions.\n    spacing : tuple(int, int, int)\n        The spacing between points in the I, J and K directions.\n\n    Returns\n    -------\n    grid : vtkExplicitStructuredGrid\n        An explicit structured grid.\n\n    \"\"\"\n    ni, nj, nk = dimensions\n    si, sj, sk = spacing\n\n    points = vtkPoints()\n    for z in range(0, nk * sk, sk):\n        for y in range(0, nj * sj, sj):\n            for x in range(0, ni * si, si):\n                points.InsertNextPoint((x, y, z))\n\n    cells = vtkCellArray()\n    for k in range(0, nk - 1):\n        for j in range(0, nj - 1):\n            for i in range(0, ni - 1):\n                multi_index = ([i, i + 1, i + 1, i, i, i + 1, i + 1, i],\n                               [j, j, j + 1, j + 1, j, j, j + 1, j + 1],\n                               [k, k, k, k, k + 1, k + 1, k + 1, k + 1])\n                pts = np.ravel_multi_index(multi_index, dimensions, order='F')\n                cells.InsertNextCell(8, pts)\n\n    grid = vtkExplicitStructuredGrid()\n    grid.SetDimensions(ni, nj, nk)\n    grid.SetPoints(points)\n    grid.SetCells(cells)\n    return grid\n\n\ndef convert_to_unstructured_grid(grid):\n    \"\"\"Convert explicit structured grid to unstructured grid.\n\n    Parameters\n    ----------\n    grid : vtkExplicitStructuredGrid\n        An explicit structured grid.\n\n    Returns\n    -------\n    vtkUnstructuredGrid\n        An unstructured grid.\n\n    \"\"\"\n    converter = vtkExplicitStructuredGridToUnstructuredGrid()\n    converter.SetInputData(grid)\n    converter.Update()\n    return converter.GetOutput()\n\n\ndef convert_to_explicit_structured_grid(grid):\n    \"\"\"Convert unstructured grid to explicit structured grid.\n\n    Parameters\n    ----------\n    grid : UnstructuredGrid\n        An unstructured grid.\n\n    Returns\n    -------\n    vtkExplicitStructuredGrid\n        An explicit structured grid. The ``'BLOCK_I'``, ``'BLOCK_J'`` and\n        ``'BLOCK_K'`` cell arrays are required.\n\n    \"\"\"\n    converter = vtkUnstructuredGridToExplicitStructuredGrid()\n    converter.SetInputData(grid)\n    converter.SetInputArrayToProcess(0, 0, 0, 1, 'BLOCK_I')\n    converter.SetInputArrayToProcess(1, 0, 0, 1, 'BLOCK_J')\n    converter.SetInputArrayToProcess(2, 0, 0, 1, 'BLOCK_K')\n    converter.Update()\n    return converter.GetOutput()\n\n\ndef main():\n    grid = create_explicit_structured_grid((5, 6, 7), (20, 10, 1))\n    grid = convert_to_unstructured_grid(grid)\n    grid = convert_to_explicit_structured_grid(grid)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(grid)\n\n    colors = vtkNamedColors()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().LightingOff()\n    actor.GetProperty().SetColor(colors.GetColor3d('Seashell'))\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    window = vtkRenderWindow()\n    window.AddRenderer(renderer)\n    window.SetWindowName('CreateESGrid')\n    window.SetSize(1024, 768)\n    window.Render()\n\n    camera = renderer.GetActiveCamera()\n    camera.SetPosition(8.383354, -72.468670, 94.262605)\n    camera.SetFocalPoint(42.295234, 21.111537, -0.863606)\n    camera.SetViewUp(0.152863, 0.676710, 0.720206)\n    camera.SetDistance(137.681759)\n    camera.SetClippingRange(78.173985, 211.583658)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(window)\n    interactor.SetInteractorStyle(vtkInteractorStyleRubberBandPick())\n    window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ExplicitStructuredGrid/LoadESGrid/","title":"LoadESGrid","text":"

        vtk-examples/Python/ExplicitStructuredGrid/LoadESGrid

        "},{"location":"Python/ExplicitStructuredGrid/LoadESGrid/#description","title":"Description","text":"

        This example displays the UNISIM-II-D reservoir model using the vtkExplicitStructuredGrid class.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ExplicitStructuredGrid/LoadESGrid/#code","title":"Code","text":"

        LoadESGrid.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkUnstructuredGridToExplicitStructuredGrid\nfrom vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleRubberBandPick\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Load an explicit structured grid from a file'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('fn', help='The explicit structured grid file name e.g. UNISIM-II-D.vtu.')\n    args = parser.parse_args()\n    return args.fn\n\n\ndef main(fn):\n    reader = vtkXMLUnstructuredGridReader()\n    reader.SetFileName(fn)\n    reader.Update()\n\n    converter = vtkUnstructuredGridToExplicitStructuredGrid()\n    converter.GlobalWarningDisplayOff()  # hide VTK errors\n    converter.SetInputConnection(reader.GetOutputPort())\n    converter.SetInputArrayToProcess(0, 0, 0, 1, 'BLOCK_I')\n    converter.SetInputArrayToProcess(1, 0, 0, 1, 'BLOCK_J')\n    converter.SetInputArrayToProcess(2, 0, 0, 1, 'BLOCK_K')\n    converter.Update()\n\n    grid = converter.GetOutput()\n    grid.ComputeFacesConnectivityFlagsArray()\n    grid.GetCellData().SetActiveScalars('ConnectivityFlags')\n\n    scalars = grid.GetCellData().GetArray('ConnectivityFlags')\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(grid)\n    mapper.SetColorModeToMapScalars()\n    mapper.SetScalarRange(scalars.GetRange())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DimGray'))\n\n    window = vtkRenderWindow()\n    window.AddRenderer(renderer)\n    window.SetWindowName('LoadESGrid')\n    window.SetSize(1024, 768)\n    window.Render()\n\n    camera = renderer.GetActiveCamera()\n    camera.SetPosition(312452.407650, 7474760.406373, 3507.364723)\n    camera.SetFocalPoint(314388.388434, 7481520.509575, -2287.477388)\n    camera.SetViewUp(0.089920, 0.633216, 0.768734)\n    camera.SetDistance(9111.926908)\n    camera.SetClippingRange(595.217338, 19595.429475)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(window)\n    interactor.SetInteractorStyle(vtkInteractorStyleRubberBandPick())\n    window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    import sys\n\n    fn = get_program_parameters(sys.argv)\n    main(fn)\n
        "},{"location":"Python/Filtering/AppendFilter/","title":"AppendFilter","text":"

        vtk-examples/Python/Filtering/AppendFilter

        "},{"location":"Python/Filtering/AppendFilter/#description","title":"Description","text":"

        This example loads points into a polydata and an unstructured grid then combines them.

        The example should be extended to show cells being combined as well.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/AppendFilter/#code","title":"Code","text":"

        AppendFilter.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkPolyData,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkAppendFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkPointSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkGlyph3DMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create 5 points (vtkPolyData)\n    pointSource = vtkPointSource()\n    pointSource.SetNumberOfPoints(5)\n    pointSource.Update()\n\n    polydata = pointSource.GetOutput()\n\n    print('There are', polydata.GetNumberOfPoints(), 'points in the polydata.')\n\n    # Create 2 points in a vtkUnstructuredGrid\n    points = vtkPoints()\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0, 0, 1)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    print('There are', ug.GetNumberOfPoints(), 'points in the unstructured.')\n\n    # Combine the two data sets\n    appendFilter = vtkAppendFilter()\n    appendFilter.AddInputData(polydata)\n    appendFilter.AddInputData(ug)\n    appendFilter.Update()\n\n    combined = vtkUnstructuredGrid()\n\n    combined = appendFilter.GetOutput()\n    print('There are', combined.GetNumberOfPoints(), 'points combined.')\n\n    # Create a mapper and actor\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(appendFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetPointSize(5)\n\n    # Map the points to spheres\n    sphereActor = point_to_glyph(appendFilter.GetOutput().GetPoints(), 0.05)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d(\"Gold\"))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor(sphereActor)\n    renderer.SetBackground(colors.GetColor3d('RoyalBlue'))\n\n    # Render and interact\n    renderWindow.SetWindowName('AppendFilter')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef point_to_glyph(points, scale):\n    \"\"\"\n    Convert points to glyphs.\n    :param points: The points to glyph.\n    :param scale: The scale, used to determine the size of the\n                  glyph representing the point, expressed as a\n                  fraction of the largest side of the bounding\n                  box surrounding the points. e.g. 0.05\n    :return: The actor.\n    \"\"\"\n\n    bounds = points.GetBounds()\n    max_len = 0.0\n    for i in range(0, 3):\n        max_len = max(bounds[i + 1] - bounds[i], max_len)\n\n    sphere_source = vtkSphereSource()\n    sphere_source.SetRadius(scale * max_len)\n\n    pd = vtkPolyData()\n    pd.SetPoints(points)\n\n    mapper = vtkGlyph3DMapper()\n    mapper.SetInputData(pd)\n    mapper.SetSourceConnection(sphere_source.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    mapper.ScalingOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    return actor\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/CombinePolyData/","title":"CombinePolyData","text":"

        vtk-examples/Python/Filtering/CombinePolyData

        "},{"location":"Python/Filtering/CombinePolyData/#description","title":"Description","text":"

        This example reads two .vtp files (or produces them if not specified as command line arguments), combines them, and displays the result to the screen.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/CombinePolyData/#code","title":"Code","text":"

        CombinePolyData.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkCleanPolyData\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [0.3, 0.2, 0.1, 1.0])\n\n    input1 = vtkPolyData()\n    input2 = vtkPolyData()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(5, 0, 0)\n    sphereSource.Update()\n\n    input1.ShallowCopy(sphereSource.GetOutput())\n\n    coneSource = vtkConeSource()\n    coneSource.Update()\n\n    input2.ShallowCopy(coneSource.GetOutput())\n\n    # Append the two meshes\n    appendFilter = vtkAppendPolyData()\n    appendFilter.AddInputData(input1)\n    appendFilter.AddInputData(input2)\n\n    appendFilter.Update()\n\n    #  Remove any duplicate points.\n    cleanFilter = vtkCleanPolyData()\n    cleanFilter.SetInputConnection(appendFilter.GetOutputPort())\n    cleanFilter.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(cleanFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n\n    # Render and interact\n    renderWindowInteractor.Initialize()\n    renderWindow.Render()\n    renderWindow.SetWindowName('CombinePolyData')\n    renderer.SetBackground(colors.GetColor3d('deep_ochre'))\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/ConnectivityFilter/","title":"ConnectivityFilter","text":"

        vtk-examples/Python/Filtering/ConnectivityFilter

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/ConnectivityFilter/#code","title":"Code","text":"

        ConnectivityFilter.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendFilter,\n    vtkConnectivityFilter,\n    vtkDelaunay3D\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphereSource1 = vtkSphereSource()\n    sphereSource1.Update()\n\n    delaunay1 = vtkDelaunay3D()\n    delaunay1.SetInputConnection(sphereSource1.GetOutputPort())\n    delaunay1.Update()\n\n    sphereSource2 = vtkSphereSource()\n    sphereSource2.SetCenter(5, 0, 0)\n    sphereSource2.Update()\n\n    delaunay2 = vtkDelaunay3D()\n    delaunay2.SetInputConnection(sphereSource2.GetOutputPort())\n    delaunay2.Update()\n\n    appendFilter = vtkAppendFilter()\n    appendFilter.AddInputConnection(delaunay1.GetOutputPort())\n    appendFilter.AddInputConnection(delaunay2.GetOutputPort())\n    appendFilter.Update()\n\n    connectivityFilter = vtkConnectivityFilter()\n    connectivityFilter.SetInputConnection(appendFilter.GetOutputPort())\n    connectivityFilter.SetExtractionModeToAllRegions()\n    connectivityFilter.ColorRegionsOn()\n    connectivityFilter.Update()\n\n    # Visualize\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(connectivityFilter.GetOutputPort())\n    mapper.Update()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n\n    # renWindow = vtkRenderWindow()\n    # renWindow.AddRenderer(renderer)\n    # iren = vtkRenderWindowInteractor()\n    # iren.SetRenderWindow(renWindow)\n    # iren.Initialize()\n    # iren.Start()\n    renWindow = vtkRenderWindow()\n    renWindow.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWindow)\n\n    iren.Initialize()\n    renWindow.Render()\n    renWindow.SetWindowName('ConnectivityFilter')\n    renderer.SetBackground(colors.GetColor3d('deep_ochre'))\n    renderer.GetActiveCamera().Zoom(0.9)\n    renWindow.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/ConstrainedDelaunay2D/","title":"ConstrainedDelaunay2D","text":"

        vtk-examples/Python/Filtering/ConstrainedDelaunay2D

        "},{"location":"Python/Filtering/ConstrainedDelaunay2D/#description","title":"Description","text":"

        Perform a 2D Delaunay triangulation respecting a specified boundary. This examples constructs a 10x10 grid of points. It then defines a polygon that uses the points in the grid. We want to triangulate all of the points except the region inside the boundary of the polygon. We expect a rectangular hole of size 4x3 in the resulting triangulated plane.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/ConstrainedDelaunay2D/#code","title":"Code","text":"

        ConstrainedDelaunay2D.py

        #!/usr/bin/python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolygon\n)\nfrom vtkmodules.vtkFiltersCore import vtkDelaunay2D\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Generate a 10 x 10 grid of points\n    points = vtkPoints()\n    gridSize = 10\n    seed = 0\n    randomSequence = vtkMinimalStandardRandomSequence()\n    randomSequence.Initialize(seed)\n    for x in range(gridSize):\n        for y in range(gridSize):\n            d1 = randomSequence.GetValue() / 2.0 - 0.25\n            randomSequence.Next()\n            d2 = randomSequence.GetValue() / 2.0 - 0.25\n            randomSequence.Next()\n            points.InsertNextPoint(x + d1, y + d2, 0)\n\n    aPolyData = vtkPolyData()\n    aPolyData.SetPoints(points)\n\n    # Create a cell array to store the polygon in\n    aCellArray = vtkCellArray()\n\n    # Define a polygonal hole with a clockwise polygon\n    aPolygon = vtkPolygon()\n\n    aPolygon.GetPointIds().InsertNextId(22)\n    aPolygon.GetPointIds().InsertNextId(23)\n    aPolygon.GetPointIds().InsertNextId(24)\n    aPolygon.GetPointIds().InsertNextId(25)\n    aPolygon.GetPointIds().InsertNextId(35)\n    aPolygon.GetPointIds().InsertNextId(45)\n    aPolygon.GetPointIds().InsertNextId(44)\n    aPolygon.GetPointIds().InsertNextId(43)\n    aPolygon.GetPointIds().InsertNextId(42)\n    aPolygon.GetPointIds().InsertNextId(32)\n\n    aCellArray.InsertNextCell(aPolygon)\n\n    # Create a polydata to store the boundary. The points must be the\n    # same as the points we will triangulate.\n    boundary = vtkPolyData()\n    boundary.SetPoints(aPolyData.GetPoints())\n    boundary.SetPolys(aCellArray)\n\n    # Triangulate the grid points\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(aPolyData)\n    delaunay.SetSourceData(boundary)\n\n    # Visualize\n    meshMapper = vtkPolyDataMapper()\n    meshMapper.SetInputConnection(delaunay.GetOutputPort())\n\n    meshActor = vtkActor()\n    meshActor.SetMapper(meshMapper)\n    meshActor.GetProperty().EdgeVisibilityOn()\n    meshActor.GetProperty().SetEdgeColor(colors.GetColor3d('Peacock'))\n    meshActor.GetProperty().SetInterpolationToFlat()\n\n    boundaryMapper = vtkPolyDataMapper()\n    boundaryMapper.SetInputData(boundary)\n\n    boundaryActor = vtkActor()\n    boundaryActor.SetMapper(boundaryMapper)\n    boundaryActor.GetProperty().SetColor(colors.GetColor3d('Raspberry'))\n    boundaryActor.GetProperty().SetLineWidth(3)\n    boundaryActor.GetProperty().EdgeVisibilityOn()\n    boundaryActor.GetProperty().SetEdgeColor(colors.GetColor3d('Red'))\n    boundaryActor.GetProperty().SetRepresentationToWireframe()\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(meshActor)\n    renderer.AddActor(boundaryActor)\n    renderer.SetBackground(colors.GetColor3d('Mint'))\n\n    # Render and interact\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('ConstrainedDelaunay2D')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/Delaunay2D/","title":"Delaunay2D","text":"

        vtk-examples/Python/Filtering/Delaunay2D

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/Delaunay2D/#code","title":"Code","text":"

        Delaunay2D.py

        #!/usr/bin/python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkDelaunay2D\nfrom vtkmodules.vtkFiltersGeneral import vtkVertexGlyphFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a set of heights on a grid.\n    # This is often called a \"terrain map\".\n    points = vtkPoints()\n\n    gridSize = 10\n    for x in range(gridSize):\n        for y in range(gridSize):\n            points.InsertNextPoint(x, y, int((x + y) / (y + 1)))\n\n    # Add the grid points to a polydata object\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(polydata)\n\n    # Visualize\n    meshMapper = vtkPolyDataMapper()\n    meshMapper.SetInputConnection(delaunay.GetOutputPort())\n\n    meshActor = vtkActor()\n    meshActor.SetMapper(meshMapper)\n    meshActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    meshActor.GetProperty().EdgeVisibilityOn()\n\n    glyphFilter = vtkVertexGlyphFilter()\n    glyphFilter.SetInputData(polydata)\n\n    pointMapper = vtkPolyDataMapper()\n    pointMapper.SetInputConnection(glyphFilter.GetOutputPort())\n\n    pointActor = vtkActor()\n    pointActor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n    pointActor.GetProperty().SetPointSize(5)\n    pointActor.SetMapper(pointMapper)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(meshActor)\n    renderer.AddActor(pointActor)\n    renderer.SetBackground(colors.GetColor3d('Mint'))\n\n    renderWindowInteractor.Initialize()\n    renderWindow.SetWindowName('Delaunay2D')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/GaussianSplat/","title":"GaussianSplat","text":"

        vtk-examples/Python/Filtering/GaussianSplat

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/GaussianSplat/#code","title":"Code","text":"

        GaussianSplat.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkImagingHybrid import vtkGaussianSplatter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Create points on a sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    colors = vtkNamedColors()\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(sphereSource.GetOutput().GetPoints())\n\n    splatter = vtkGaussianSplatter()\n    splatter.SetInputData(polydata)\n    splatter.SetSampleDimensions(50, 50, 50)\n    splatter.SetRadius(0.5)\n    splatter.ScalarWarpingOff()\n\n    surface = vtkContourFilter()\n    surface.SetInputConnection(splatter.GetOutputPort())\n    surface.SetValue(0, 0.01)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    renderWindow.SetWindowName('GaussianSplat')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/Glyph2D/","title":"Glyph2D","text":"

        vtk-examples/Python/Filtering/Glyph2D

        "},{"location":"Python/Filtering/Glyph2D/#description","title":"Description","text":"

        Copy a polydata to every point in the input set. We use a hexagon for the demo.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/Glyph2D/#code","title":"Code","text":"

        Glyph2D.py

        #!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkGlyph2D\nfrom vtkmodules.vtkFiltersSources import vtkRegularPolygonSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(2, 2, 0)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    # Create anything you want here, we will use a polygon for the demo.\n    polygonSource = vtkRegularPolygonSource()  # default is 6 sides\n\n    glyph2D = vtkGlyph2D()\n    glyph2D.SetSourceConnection(polygonSource.GetOutputPort())\n    glyph2D.SetInputData(polydata)\n    glyph2D.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph2D.GetOutputPort())\n    mapper.Update()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Salmon'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    style = vtkInteractorStyleImage()\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindow.SetWindowName('Glyph2D');\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/Glyph3D/","title":"Glyph3D","text":"

        vtk-examples/Python/Filtering/Glyph3D

        "},{"location":"Python/Filtering/Glyph3D/#description","title":"Description","text":"

        This example applies an object at every point. We use a cube for the demo.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/Glyph3D/#code","title":"Code","text":"

        Glyph3D.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 1, 1)\n    points.InsertNextPoint(2, 2, 2)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    # Create anything you want here, we will use a cube for the demo.\n    cubeSource = vtkCubeSource()\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetSourceConnection(cubeSource.GetOutputPort())\n    glyph3D.SetInputData(polydata)\n    glyph3D.Update()\n\n    # Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph3D.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Salmon'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))  # Background Slate Gray\n\n    renderWindow.SetWindowName('Glyph2D');\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/IterativeClosestPoints/","title":"IterativeClosestPoints","text":"

        vtk-examples/Python/Filtering/IterativeClosestPoints

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/IterativeClosestPoints/#code","title":"Code","text":"

        IterativeClosestPoints.py

        #!/usr/bin/env python\n\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkIterativeClosestPointTransform,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\n\n\ndef main():\n    # ============ create source points ==============\n    print(\"Creating source points...\")\n    sourcePoints = vtkPoints()\n    sourceVertices = vtkCellArray()\n\n    sp_id = sourcePoints.InsertNextPoint(1.0, 0.1, 0.0)\n    sourceVertices.InsertNextCell(1)\n    sourceVertices.InsertCellPoint(sp_id)\n\n    sp_id = sourcePoints.InsertNextPoint(0.1, 1.1, 0.0)\n    sourceVertices.InsertNextCell(1)\n    sourceVertices.InsertCellPoint(sp_id)\n\n    sp_id = sourcePoints.InsertNextPoint(0.0, 0.1, 1.0)\n    sourceVertices.InsertNextCell(1)\n    sourceVertices.InsertCellPoint(sp_id)\n\n    source = vtkPolyData()\n    source.SetPoints(sourcePoints)\n    source.SetVerts(sourceVertices)\n\n    print(\"Displaying source points...\")\n    # ============ display source points ==============\n    pointCount = 3\n    for index in range(pointCount):\n        point = [0, 0, 0]\n        sourcePoints.GetPoint(index, point)\n        print(\"source point[%s]=%s\" % (index, point))\n\n    # ============ create target points ==============\n    print(\"Creating target points...\")\n    targetPoints = vtkPoints()\n    targetVertices = vtkCellArray()\n\n    tp_id = targetPoints.InsertNextPoint(1.0, 0.0, 0.0)\n    targetVertices.InsertNextCell(1)\n    targetVertices.InsertCellPoint(tp_id)\n\n    tp_id = targetPoints.InsertNextPoint(0.0, 1.0, 0.0)\n    targetVertices.InsertNextCell(1)\n    targetVertices.InsertCellPoint(tp_id)\n\n    tp_id = targetPoints.InsertNextPoint(0.0, 0.0, 1.0)\n    targetVertices.InsertNextCell(1)\n    targetVertices.InsertCellPoint(tp_id)\n\n    target = vtkPolyData()\n    target.SetPoints(targetPoints)\n    target.SetVerts(targetVertices)\n\n    # ============ display target points ==============\n    print(\"Displaying target points...\")\n    pointCount = 3\n    for index in range(pointCount):\n        point = [0, 0, 0]\n        targetPoints.GetPoint(index, point)\n        print(\"target point[%s]=%s\" % (index, point))\n\n    print(\"Running ICP ----------------\")\n    # ============ run ICP ==============\n    icp = vtkIterativeClosestPointTransform()\n    icp.SetSource(source)\n    icp.SetTarget(target)\n    icp.GetLandmarkTransform().SetModeToRigidBody()\n    # icp.DebugOn()\n    icp.SetMaximumNumberOfIterations(20)\n    icp.StartByMatchingCentroidsOn()\n    icp.Modified()\n    icp.Update()\n\n    icpTransformFilter = vtkTransformPolyDataFilter()\n    icpTransformFilter.SetInputData(source)\n\n    icpTransformFilter.SetTransform(icp)\n    icpTransformFilter.Update()\n\n    transformedSource = icpTransformFilter.GetOutput()\n\n    # ============ display transformed points ==============\n    pointCount = 3\n    for index in range(pointCount):\n        point = [0, 0, 0]\n        transformedSource.GetPoint(index, point)\n        print(\"transformed source point[%s]=%s\" % (index, point))\n\n\nif __name__ == \"__main__\":\n    main()\n
        "},{"location":"Python/Filtering/PerlinNoise/","title":"PerlinNoise","text":"

        vtk-examples/Python/Filtering/PerlinNoise

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/PerlinNoise/#code","title":"Code","text":"

        PerlinNoise.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPerlinNoise\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    perlinNoise = vtkPerlinNoise()\n    perlinNoise.SetFrequency(2, 1.25, 1.5)\n    perlinNoise.SetPhase(0, 0, 0)\n\n    sample = vtkSampleFunction()\n    sample.SetImplicitFunction(perlinNoise)\n    sample.SetSampleDimensions(65, 65, 20)\n    sample.ComputeNormalsOff()\n\n    surface = vtkContourFilter()\n    surface.SetInputConnection(sample.GetOutputPort())\n    surface.SetValue(0, 0.0)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('SteelBlue'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the renderer, set the background and size\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renderWindow.SetWindowName('PerlinNoise')\n    renderWindow.SetSize(300, 300)\n    renderer.ResetCamera()\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/TransformPolyData/","title":"TransformPolyData","text":"

        vtk-examples/Python/Filtering/TransformPolyData

        "},{"location":"Python/Filtering/TransformPolyData/#description","title":"Description","text":"

        This example demonstrates how to apply a transform to a data set. It uses vtkTransformPolyDataFilter, but it can be replaced with vtkTransformFilter for different types of data sets, including vtkUnstructuredGrid and vtkStructuredGrid. vtkTransformFilter will work with vtkPolyData, too).

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/TransformPolyData/#code","title":"Code","text":"

        TransformPolyData.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the polydata geometry\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    # Set up the actor to display the untransformed polydata\n    originalMapper = vtkPolyDataMapper()\n    originalMapper.SetInputConnection(sphereSource.GetOutputPort())\n\n    originalActor = vtkActor()\n    originalActor.SetMapper(originalMapper)\n    originalActor.GetProperty().SetColor(colors.GetColor3d('Blue'))\n\n    # Set up the transform filter\n    translation = vtkTransform()\n    translation.Translate(1.0, 2.0, 3.0)\n\n    transformFilter = vtkTransformPolyDataFilter()\n    transformFilter.SetInputConnection(sphereSource.GetOutputPort())\n    transformFilter.SetTransform(translation)\n    transformFilter.Update()\n\n    # Set up the actor to display the transformed polydata\n    transformedMapper = vtkPolyDataMapper()\n    transformedMapper.SetInputConnection(transformFilter.GetOutputPort())\n\n    transformedActor = vtkActor()\n    transformedActor.SetMapper(transformedMapper)\n    transformedActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    # Set up the rest of the visualization pipeline\n    renderer = vtkRenderer()\n    renderer.AddActor(originalActor)\n    renderer.AddActor(transformedActor)\n    renderer.SetBackground(colors.GetColor3d('Green'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderWindow.SetWindowName('TransformPolyData')\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/TriangulateTerrainMap/","title":"TriangulateTerrainMap","text":"

        vtk-examples/Python/Filtering/TriangulateTerrainMap

        "},{"location":"Python/Filtering/TriangulateTerrainMap/#description","title":"Description","text":"

        This example generates heights (z-values) on a 10x10 grid (a terrain map) and triangulates the points.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/TriangulateTerrainMap/#code","title":"Code","text":"

        TriangulateTerrainMap.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkDelaunay2D\nfrom vtkmodules.vtkFiltersGeneral import vtkVertexGlyphFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Create points on an XY grid with random Z coordinate\n    points = vtkPoints()\n    gridSize = 10\n    seed = 0\n    randomSequence = vtkMinimalStandardRandomSequence()\n    randomSequence.Initialize(seed)\n    for x in range(0, gridSize):\n        for y in range(0, gridSize):\n            d = randomSequence.GetValue()\n            randomSequence.Next()\n            points.InsertNextPoint(x, y, d * 3)\n\n    # Add the grid points to a polydata object\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    glyphFilter = vtkVertexGlyphFilter()\n    glyphFilter.SetInputData(polydata)\n    glyphFilter.Update()\n\n    # Create a mapper and actor\n    pointsMapper = vtkPolyDataMapper()\n    pointsMapper.SetInputConnection(glyphFilter.GetOutputPort())\n\n    pointsActor = vtkActor()\n    pointsActor.SetMapper(pointsMapper)\n    pointsActor.GetProperty().SetPointSize(3)\n    pointsActor.GetProperty().SetColor(colors.GetColor3d(\"Red\"))\n\n    # Triangulate the grid points\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(polydata)\n    delaunay.Update()\n\n    # Create a mapper and actor\n    triangulatedMapper = vtkPolyDataMapper()\n    triangulatedMapper.SetInputConnection(delaunay.GetOutputPort())\n\n    triangulatedActor = vtkActor()\n    triangulatedActor.SetMapper(triangulatedMapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(pointsActor)\n    renderer.AddActor(triangulatedActor)\n    renderer.SetBackground(colors.GetColor3d(\"Green\"))  # Background color green\n\n    # Render and interact\n    renderWindow.SetWindowName('TriangulateTerrainMap')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/VertexGlyphFilter/","title":"VertexGlyphFilter","text":"

        vtk-examples/Python/Filtering/VertexGlyphFilter

        "},{"location":"Python/Filtering/VertexGlyphFilter/#description","title":"Description","text":"

        This example creates a set of points and adds a vertex at each point using vtkVertexGlyphFilter.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/VertexGlyphFilter/#code","title":"Code","text":"

        VertexGlyphFilter.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersGeneral import vtkVertexGlyphFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 1, 1)\n    points.InsertNextPoint(2, 2, 2)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    vertexGlyphFilter = vtkVertexGlyphFilter()\n    vertexGlyphFilter.AddInputData(polydata)\n    vertexGlyphFilter.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(vertexGlyphFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetPointSize(10)\n    actor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Green'))\n\n    # Render and interact\n    renderWindow.SetWindowName('VertexGlyphFilter')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Filtering/WarpTo/","title":"WarpTo","text":"

        vtk-examples/Python/Filtering/WarpTo

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Filtering/WarpTo/#code","title":"Code","text":"

        WarpTo.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpTo\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Create the RenderWindow, Renderer and both Actors\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Create a line\n    lineSource = vtkLineSource()\n    lineSource.SetPoint1(0.0, 0.0, 0.0)\n    lineSource.SetPoint2(0.0, 1.0, 0.0)\n    lineSource.SetResolution(20)\n    lineSource.Update()\n\n    # Create a tube (cylinder) around the line\n    tubeFilter = vtkTubeFilter()\n    tubeFilter.SetInputConnection(lineSource.GetOutputPort())\n    tubeFilter.SetRadius(.01)  # default is .5\n    tubeFilter.SetNumberOfSides(50)\n    tubeFilter.Update()\n\n    warpTo = vtkWarpTo()\n    warpTo.SetInputConnection(tubeFilter.GetOutputPort())\n    warpTo.SetPosition(10, 1, 0)\n    warpTo.SetScaleFactor(5)\n    warpTo.AbsoluteOn()\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(warpTo.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    renderer.SetBackground(colors.GetColor3d('Green'))\n    renderer.AddActor(actor)\n\n    renderWindow.SetWindowName('WarpTo')\n    renderWindow.Render()\n\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Arrow/","title":"Arrow","text":"

        vtk-examples/Python/GeometricObjects/Arrow

        "},{"location":"Python/GeometricObjects/Arrow/#description","title":"Description","text":"

        vtkArrowSource object appends a cylinder to a cone to form an arrow.

        The shaft base is always at (0,0,0). The arrow tip is always at (1,0,0). If \"Invert\" is true, then the ends are flipped i.e. tip is at (0,0,0) while base is at (1, 0, 0).

        The resolution of the cone and shaft can be set and default to 6.

        The radius of the cone and shaft can be set and default to 0.03 and 0.1. The length of the tip can also be set, and defaults to 0.35.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Arrow/#code","title":"Code","text":"

        Arrow.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkArrowSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    arrowSource = vtkArrowSource()\n    # arrowSource.SetShaftRadius(0.01)\n    # arrowSource.SetTipLength(.9)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(arrowSource.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Arrow')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    renderWindow.SetWindowName('Arrow')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Axes/","title":"Axes","text":"

        vtk-examples/Python/GeometricObjects/Axes

        "},{"location":"Python/GeometricObjects/Axes/#description","title":"Description","text":"

        This example shows how to position an vtkAxesActor in 3D. Notice that position and orientation of the vtkAxesActor is done with a user transform.

        Seealso

        DisplayCoordinateAxes.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Axes/#code","title":"Code","text":"

        Axes.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a Sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(0.5)\n\n    # create a mapper\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphereSource.GetOutputPort())\n\n    # create an actor\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n\n    # a renderer and render window\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Axes')\n    renderWindow.AddRenderer(renderer)\n\n    # an interactor\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # add the actors to the scene\n    renderer.AddActor(sphereActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    transform = vtkTransform()\n    transform.Translate(1.0, 0.0, 0.0)\n\n    axes = vtkAxesActor()\n    #  The axes are positioned with a user transform\n    axes.SetUserTransform(transform)\n\n    # properties of the axes labels can be set as follows\n    # this sets the x axis label to red\n    # axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetColor(colors.GetColor3d('Red'));\n\n    # the actual text of the axis label can be changed:\n    # axes->SetXAxisLabelText('test');\n\n    renderer.AddActor(axes)\n\n    renderer.GetActiveCamera().Azimuth(50)\n    renderer.GetActiveCamera().Elevation(-30)\n\n    renderer.ResetCamera()\n    renderWindow.SetWindowName('Axes')\n    renderWindow.Render()\n\n    # begin mouse interaction\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Cell3DDemonstration/","title":"Cell3DDemonstration","text":"

        vtk-examples/Python/GeometricObjects/Cell3DDemonstration

        "},{"location":"Python/GeometricObjects/Cell3DDemonstration/#description","title":"Description","text":"

        This is a demonstration of how to construct and display geometric objects using the classes derived from vtkCell3D. For each object we specify the points and cell Ids.

        From this we create an unstructured grid. In some cases a vtkCellArray is used and the result is added to the unstructured grid, see: MakePolyhedron() and MakeTetrahedron().

        Also demonstrated is the use of vectors to hold the unstructured grids, mappers, actors and renderers.

        The resultant objects are then displayed in a grid.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Cell3DDemonstration/#code","title":"Code","text":"

        Cell3DDemonstration.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkIdList,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_POLYHEDRON,\n    VTK_TETRA,\n    vtkCellArray,\n    vtkHexagonalPrism,\n    vtkHexahedron,\n    vtkPentagonalPrism,\n    vtkPyramid,\n    vtkTetra,\n    vtkUnstructuredGrid,\n    vtkVoxel,\n    vtkWedge\n)\nfrom vtkmodules.vtkIOImage import vtkPNGWriter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty,\n    vtkWindowToImageFilter\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    titles = list()\n    textMappers = list()\n    textActors = list()\n\n    uGrids = list()\n    mappers = list()\n    actors = list()\n    renderers = list()\n\n    uGrids.append(MakeHexagonalPrism())\n    titles.append('Hexagonal Prism')\n    uGrids.append(MakeHexahedron())\n    titles.append('Hexahedron')\n    uGrids.append(MakePentagonalPrism())\n    titles.append('Pentagonal Prism')\n\n    uGrids.append(MakePolyhedron())\n    titles.append('Polyhedron')\n    uGrids.append(MakePyramid())\n    titles.append('Pyramid')\n    uGrids.append(MakeTetrahedron())\n    titles.append('Tetrahedron')\n\n    uGrids.append(MakeVoxel())\n    titles.append('Voxel')\n    uGrids.append(MakeWedge())\n    titles.append('Wedge')\n\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName('Cell3DDemonstration')\n\n    iRen = vtkRenderWindowInteractor()\n    iRen.SetRenderWindow(renWin)\n\n    # Create one text property for all\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(16)\n    textProperty.SetJustificationToCentered()\n    textProperty.SetColor(colors.GetColor3d('LightGoldenrodYellow'))\n\n    # Create and link the mappers actors and renderers together.\n    for i in range(0, len(uGrids)):\n        textMappers.append(vtkTextMapper())\n        textActors.append(vtkActor2D())\n\n        mappers.append(vtkDataSetMapper())\n        actors.append(vtkActor())\n        renderers.append(vtkRenderer())\n\n        mappers[i].SetInputData(uGrids[i])\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n        renderers[i].AddViewProp(actors[i])\n\n        textMappers[i].SetInput(titles[i])\n        textMappers[i].SetTextProperty(textProperty)\n\n        textActors[i].SetMapper(textMappers[i])\n        textActors[i].SetPosition(120, 16)\n        renderers[i].AddViewProp(textActors[i])\n\n        renWin.AddRenderer(renderers[i])\n\n    gridDimensions = 3\n    rendererSize = 300\n\n    renWin.SetSize(rendererSize * gridDimensions,\n                   rendererSize * gridDimensions)\n\n    for row in range(0, gridDimensions):\n        for col in range(0, gridDimensions):\n            index = row * gridDimensions + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewport = [\n                float(col) * rendererSize /\n                (gridDimensions * rendererSize),\n                float(gridDimensions - (row + 1)) * rendererSize /\n                (gridDimensions * rendererSize),\n                float(col + 1) * rendererSize /\n                (gridDimensions * rendererSize),\n                float(gridDimensions - row) * rendererSize /\n                (gridDimensions * rendererSize)]\n\n            if index > len(actors) - 1:\n                # Add a renderer even if there is no actor.\n                # This makes the render window background all the same color.\n                ren = vtkRenderer()\n                ren.SetBackground(colors.GetColor3d('BkgColor'))\n                ren.SetViewport(viewport)\n                renWin.AddRenderer(ren)\n                continue\n\n            renderers[index].SetViewport(viewport)\n            renderers[index].SetBackground(colors.GetColor3d('BkgColor'))\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(30)\n            renderers[index].GetActiveCamera().Elevation(-30)\n            renderers[index].GetActiveCamera().Zoom(0.85)\n            renderers[index].ResetCameraClippingRange()\n\n    iRen.Initialize()\n    renWin.SetWindowName('Cell3DDemonstration')\n    renWin.Render()\n    iRen.Start()\n\n\ndef MakeHexagonalPrism():\n    \"\"\"\n      3D: hexagonal prism: a wedge with an hexagonal base.\n      Be careful, the base face ordering is different from wedge.\n    \"\"\"\n\n    numberOfVertices = 12\n\n    points = vtkPoints()\n\n    points.InsertNextPoint(0.0, 0.0, 1.0)\n    points.InsertNextPoint(1.0, 0.0, 1.0)\n    points.InsertNextPoint(1.5, 0.5, 1.0)\n    points.InsertNextPoint(1.0, 1.0, 1.0)\n    points.InsertNextPoint(0.0, 1.0, 1.0)\n    points.InsertNextPoint(-0.5, 0.5, 1.0)\n\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(1.5, 0.5, 0.0)\n    points.InsertNextPoint(1.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n    points.InsertNextPoint(-0.5, 0.5, 0.0)\n\n    hexagonalPrism = vtkHexagonalPrism()\n    for i in range(0, numberOfVertices):\n        hexagonalPrism.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.InsertNextCell(hexagonalPrism.GetCellType(),\n                      hexagonalPrism.GetPointIds())\n    ug.SetPoints(points)\n\n    return ug\n\n\ndef MakeHexahedron():\n    \"\"\"\n      A regular hexagon (cube) with all faces square and three squares around\n       each vertex is created below.\n\n      Setup the coordinates of eight points\n       (the two faces must be in counter clockwise\n       order as viewed from the outside).\n\n      As an exercise you can modify the coordinates of the points to create\n       seven topologically distinct convex hexahedras.\n    \"\"\"\n    numberOfVertices = 8\n\n    # Create the points\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 0.0, 1.0)\n    points.InsertNextPoint(1.0, 0.0, 1.0)\n    points.InsertNextPoint(1.0, 1.0, 1.0)\n    points.InsertNextPoint(0.0, 1.0, 1.0)\n\n    # Create a hexahedron from the points\n    hex_ = vtkHexahedron()\n    for i in range(0, numberOfVertices):\n        hex_.GetPointIds().SetId(i, i)\n\n    # Add the points and hexahedron to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(hex_.GetCellType(), hex_.GetPointIds())\n\n    return uGrid\n\n\ndef MakePentagonalPrism():\n    numberOfVertices = 10\n\n    # Create the points\n    points = vtkPoints()\n    points.InsertNextPoint(11, 10, 10)\n    points.InsertNextPoint(13, 10, 10)\n    points.InsertNextPoint(14, 12, 10)\n    points.InsertNextPoint(12, 14, 10)\n    points.InsertNextPoint(10, 12, 10)\n    points.InsertNextPoint(11, 10, 14)\n    points.InsertNextPoint(13, 10, 14)\n    points.InsertNextPoint(14, 12, 14)\n    points.InsertNextPoint(12, 14, 14)\n    points.InsertNextPoint(10, 12, 14)\n\n    # Pentagonal Prism\n    pentagonalPrism = vtkPentagonalPrism()\n    for i in range(0, numberOfVertices):\n        pentagonalPrism.GetPointIds().SetId(i, i)\n\n    # Add the points and hexahedron to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(pentagonalPrism.GetCellType(),\n                         pentagonalPrism.GetPointIds())\n\n    return uGrid\n\n\ndef MakePolyhedron():\n    \"\"\"\n      Make a regular dodecahedron. It consists of twelve regular pentagonal\n      faces with three faces meeting at each vertex.\n    \"\"\"\n    # numberOfVertices = 20\n    numberOfFaces = 12\n    # numberOfFaceVertices = 5\n\n    points = vtkPoints()\n    points.InsertNextPoint(1.21412, 0, 1.58931)\n    points.InsertNextPoint(0.375185, 1.1547, 1.58931)\n    points.InsertNextPoint(-0.982247, 0.713644, 1.58931)\n    points.InsertNextPoint(-0.982247, -0.713644, 1.58931)\n    points.InsertNextPoint(0.375185, -1.1547, 1.58931)\n    points.InsertNextPoint(1.96449, 0, 0.375185)\n    points.InsertNextPoint(0.607062, 1.86835, 0.375185)\n    points.InsertNextPoint(-1.58931, 1.1547, 0.375185)\n    points.InsertNextPoint(-1.58931, -1.1547, 0.375185)\n    points.InsertNextPoint(0.607062, -1.86835, 0.375185)\n    points.InsertNextPoint(1.58931, 1.1547, -0.375185)\n    points.InsertNextPoint(-0.607062, 1.86835, -0.375185)\n    points.InsertNextPoint(-1.96449, 0, -0.375185)\n    points.InsertNextPoint(-0.607062, -1.86835, -0.375185)\n    points.InsertNextPoint(1.58931, -1.1547, -0.375185)\n    points.InsertNextPoint(0.982247, 0.713644, -1.58931)\n    points.InsertNextPoint(-0.375185, 1.1547, -1.58931)\n    points.InsertNextPoint(-1.21412, 0, -1.58931)\n    points.InsertNextPoint(-0.375185, -1.1547, -1.58931)\n    points.InsertNextPoint(0.982247, -0.713644, -1.58931)\n\n    # Dimensions are [numberOfFaces][numberOfFaceVertices]\n    dodechedronFace = [\n        [0, 1, 2, 3, 4],\n        [0, 5, 10, 6, 1],\n        [1, 6, 11, 7, 2],\n        [2, 7, 12, 8, 3],\n        [3, 8, 13, 9, 4],\n        [4, 9, 14, 5, 0],\n        [15, 10, 5, 14, 19],\n        [16, 11, 6, 10, 15],\n        [17, 12, 7, 11, 16],\n        [18, 13, 8, 12, 17],\n        [19, 14, 9, 13, 18],\n        [19, 18, 17, 16, 15]\n    ]\n\n    dodechedronFacesIdList = vtkIdList()\n    # Number faces that make up the cell.\n    dodechedronFacesIdList.InsertNextId(numberOfFaces)\n    for face in dodechedronFace:\n        # Number of points in the face == numberOfFaceVertices\n        dodechedronFacesIdList.InsertNextId(len(face))\n        # Insert the pointIds for that face.\n        [dodechedronFacesIdList.InsertNextId(i) for i in face]\n\n    uGrid = vtkUnstructuredGrid()\n    uGrid.InsertNextCell(VTK_POLYHEDRON, dodechedronFacesIdList)\n    uGrid.SetPoints(points)\n\n    return uGrid\n\n\ndef MakePyramid():\n    \"\"\"\n      Make a regular square pyramid.\n    \"\"\"\n    numberOfVertices = 5\n\n    points = vtkPoints()\n\n    p = [\n        [1.0, 1.0, 0.0],\n        [-1.0, 1.0, 0.0],\n        [-1.0, -1.0, 0.0],\n        [1.0, -1.0, 0.0],\n        [0.0, 0.0, 1.0]\n    ]\n    for pt in p:\n        points.InsertNextPoint(pt)\n\n    pyramid = vtkPyramid()\n    for i in range(0, numberOfVertices):\n        pyramid.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(pyramid.GetCellType(), pyramid.GetPointIds())\n\n    return ug\n\n\ndef MakeTetrahedron():\n    \"\"\"\n      Make a tetrahedron.\n    \"\"\"\n    numberOfVertices = 4\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 1, 1)\n\n    tetra = vtkTetra()\n    for i in range(0, numberOfVertices):\n        tetra.GetPointIds().SetId(i, i)\n\n    cellArray = vtkCellArray()\n    cellArray.InsertNextCell(tetra)\n\n    unstructuredGrid = vtkUnstructuredGrid()\n    unstructuredGrid.SetPoints(points)\n    unstructuredGrid.SetCells(VTK_TETRA, cellArray)\n\n    return unstructuredGrid\n\n\ndef MakeVoxel():\n    \"\"\"\n      A voxel is a representation of a regular grid in 3-D space.\n    \"\"\"\n    numberOfVertices = 8\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, 1)\n    points.InsertNextPoint(0, 1, 1)\n    points.InsertNextPoint(1, 1, 1)\n\n    voxel = vtkVoxel()\n    for i in range(0, numberOfVertices):\n        voxel.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(voxel.GetCellType(), voxel.GetPointIds())\n\n    return ug\n\n\ndef MakeWedge():\n    \"\"\"\n      A wedge consists of two triangular ends and three rectangular faces.\n    \"\"\"\n\n    numberOfVertices = 6\n\n    points = vtkPoints()\n\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0, .5, .5)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(1, 0.0, 0.0)\n    points.InsertNextPoint(1, .5, .5)\n\n    wedge = vtkWedge()\n    for i in range(0, numberOfVertices):\n        wedge.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(wedge.GetCellType(), wedge.GetPointIds())\n\n    return ug\n\n\ndef WritePNG(renWin, fn, magnification=1):\n    \"\"\"\n      Screenshot\n\n      Write out a png corresponding to the render window.\n\n      :param: renWin - the render window.\n      :param: fn - the file name.\n      :param: magnification - the magnification.\n    \"\"\"\n    windowToImageFilter = vtkWindowToImageFilter()\n    windowToImageFilter.SetInput(renWin)\n    windowToImageFilter.SetMagnification(magnification)\n    # Record the alpha (transparency) channel\n    # windowToImageFilter.SetInputBufferTypeToRGBA()\n    windowToImageFilter.SetInputBufferTypeToRGB()\n    # Read from the back buffer\n    windowToImageFilter.ReadFrontBufferOff()\n    windowToImageFilter.Update()\n\n    writer = vtkPNGWriter()\n    writer.SetFileName(fn)\n    writer.SetInputConnection(windowToImageFilter.GetOutputPort())\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/CellTypeSource/","title":"CellTypeSource","text":"

        vtk-examples/Python/GeometricObjects/CellTypeSource

        "},{"location":"Python/GeometricObjects/CellTypeSource/#description","title":"Description","text":"

        This example uses [vtkCell](https://www.vtk.org/doc/nightly/html/classvtkCell.html#details)TypeSource to generate a vtkUnstructuredGrid. If a cell does not fill a rectangular area or volume, then multiple cells will be generated. For example, a vtkTetra requires 12 cells to fill a cube. A vtkTriangle requires two cells to fill a square. [vtkCell](https://www.vtk.org/doc/nightly/html/classvtkCell.html#details)TypeSource generates a uniform set of coordinates. The example perturbs those coordinates to illustrate the results of the vtkTessellatorFilter. Also, each cell is passed through vtkShrinkFilter to help identify the cells. Each generated cell also has a unique color.

        The example takes an optional argument, a vtkCell name.

        For example, to generate vtkTriangles, run

        CellTypeSource [vtkTriangle](https://www.vtk.org/doc/nightly/html/classvtkTriangle.html#details)\n

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/CellTypeSource/#code","title":"Code","text":"

        CellTypeSource.py

        # !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import (\n    vtkIntArray,\n    vtkLookupTable,\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_CUBIC_LINE,\n    VTK_HEXAHEDRON,\n    VTK_LINE,\n    VTK_PYRAMID,\n    VTK_QUAD,\n    VTK_QUADRATIC_EDGE,\n    VTK_QUADRATIC_HEXAHEDRON,\n    VTK_QUADRATIC_PYRAMID,\n    VTK_QUADRATIC_QUAD,\n    VTK_QUADRATIC_TETRA,\n    VTK_QUADRATIC_TRIANGLE,\n    VTK_QUADRATIC_WEDGE,\n    VTK_TETRA,\n    VTK_TRIANGLE,\n    VTK_WEDGE,\n    vtkCellTypes\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkShrinkFilter,\n    vtkTessellatorFilter\n)\nfrom vtkmodules.vtkFiltersSources import vtkCellTypeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    cellName = get_program_parameters()\n\n    # Store the cell class names in a dictionary.\n    cellMap = dict()\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_LINE)] = VTK_LINE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_EDGE)] = VTK_QUADRATIC_EDGE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_CUBIC_LINE)] = VTK_CUBIC_LINE\n\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_TRIANGLE)] = VTK_TRIANGLE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_TRIANGLE)] = VTK_QUADRATIC_TRIANGLE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUAD)] = VTK_QUAD\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_QUAD)] = VTK_QUADRATIC_QUAD\n\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_TETRA)] = VTK_TETRA\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_HEXAHEDRON)] = VTK_HEXAHEDRON\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_WEDGE)] = VTK_WEDGE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_PYRAMID)] = VTK_PYRAMID\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_WEDGE)] = VTK_QUADRATIC_WEDGE\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_PYRAMID)] = VTK_QUADRATIC_PYRAMID\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_HEXAHEDRON)] = VTK_QUADRATIC_HEXAHEDRON\n    cellMap[vtkCellTypes.GetClassNameFromTypeId(VTK_QUADRATIC_TETRA)] = VTK_QUADRATIC_TETRA\n\n    if cellName not in cellMap:\n        print('Cell type ', cellName, ' is not supported.')\n        return\n    source = vtkCellTypeSource()\n    source.SetCellType(cellMap[cellName])\n    source.Update()\n    print('Cell: ', cellName)\n\n    originalPoints = source.GetOutput().GetPoints()\n    points = vtkPoints()\n    points.SetNumberOfPoints(source.GetOutput().GetNumberOfPoints())\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(5070)  # for testing\n    for i in range(0, points.GetNumberOfPoints()):\n        perturbation = [0.0] * 3\n        for j in range(0, 3):\n            rng.Next()\n            perturbation[j] = rng.GetRangeValue(-0.1, 0.1)\n        currentPoint = [0.0] * 3\n        originalPoints.GetPoint(i, currentPoint)\n        points.SetPoint(i, currentPoint[0] + perturbation[0],\n                        currentPoint[1] + perturbation[1],\n                        currentPoint[2] + perturbation[2])\n    source.GetOutput().SetPoints(points)\n\n    numCells = source.GetOutput().GetNumberOfCells()\n    print('Number of cells: ', numCells)\n    idArray = vtkIntArray()\n    idArray.SetNumberOfTuples(numCells)\n    for i in range(0, numCells):\n        idArray.InsertTuple1(i, i + 1)\n    idArray.SetName('Ids')\n    source.GetOutput().GetCellData().AddArray(idArray)\n    source.GetOutput().GetCellData().SetActiveScalars('Ids')\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(source.GetOutputPort())\n    shrink.SetShrinkFactor(.8)\n\n    tessellate = vtkTessellatorFilter()\n    tessellate.SetInputConnection(shrink.GetOutputPort())\n    tessellate.SetMaximumNumberOfSubdivisions(3)\n\n    # Create a lookup table to map cell data to colors.\n    lut = vtkLookupTable()\n\n    colorSeries = vtkColorSeries()\n    seriesEnum = colorSeries.BREWER_QUALITATIVE_SET3\n    colorSeries.SetColorScheme(seriesEnum)\n    colorSeries.BuildLookupTable(lut, colorSeries.ORDINAL)\n\n    # Fill in a few known colors, the rest will be generated if needed.\n    colors = vtkNamedColors()\n\n    # Create a mapper and actor.\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n    mapper.SetInputConnection(shrink.GetOutputPort())\n    mapper.SetScalarRange(0, numCells + 1)\n    mapper.SetLookupTable(lut)\n    mapper.SetScalarModeToUseCellData()\n    mapper.SetResolveCoincidentTopologyToPolygonOffset()\n    if (source.GetCellType() == VTK_QUADRATIC_PYRAMID or\n            source.GetCellType() == VTK_QUADRATIC_WEDGE):\n        mapper.SetInputConnection(shrink.GetOutputPort())\n    else:\n        mapper.SetInputConnection(tessellate.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    #  actor.GetProperty().SetLineWidth(3)\n\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(20)\n    textProperty.SetJustificationToCentered()\n    textProperty.SetColor(colors.GetColor3d('Lamp_Black'))\n\n    textMapper = vtkTextMapper()\n    textMapper.SetInput(cellName)\n    textMapper.SetTextProperty(textProperty)\n\n    textActor = vtkActor2D()\n    textActor.SetMapper(textMapper)\n    textActor.SetPosition(320, 20)\n\n    # Create a renderer, render window, and interactor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('CellTypeSource')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene.\n    renderer.AddViewProp(textActor)\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    # Render and interact.\n    renderWindow.SetSize(640, 480)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Cell Type Source.'\n    epilogue = '''\n    You can supply an optional argument consisting of a vtkCell name e.g: vtkTriangle.\n    The default is vtkTetra.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('cell_name', nargs='?', const='vtkTetra', default='vtkTetra', type=str, help='The cell name.')\n    args = parser.parse_args()\n    return args.cell_name\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Circle/","title":"Circle","text":"

        vtk-examples/Python/GeometricObjects/Circle

        "},{"location":"Python/GeometricObjects/Circle/#description","title":"Description","text":"

        A circle is simply the limiting case of a regular polygon. We use vtkRegularPolygonSource with a large number of Sides to approximate a circle.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Circle/#code","title":"Code","text":"

        Circle.py

        #!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkRegularPolygonSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a circle\n    polygonSource = vtkRegularPolygonSource()\n    # Comment this line to generate a disk instead of a circle.\n    polygonSource.GeneratePolygonOff()\n    polygonSource.SetNumberOfSides(50)\n    polygonSource.SetRadius(5.0)\n    polygonSource.SetCenter(0.0, 0.0, 0.0)\n\n    #  Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(polygonSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Cornsilk'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Circle\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    renderWindow.SetWindowName('Circle')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/ColoredLines/","title":"ColoredLines","text":"

        vtk-examples/Python/GeometricObjects/ColoredLines

        "},{"location":"Python/GeometricObjects/ColoredLines/#description","title":"Description","text":"

        Displays two lines, each with a different color.

        Seealso

        LongLine.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/ColoredLines/#code","title":"Code","text":"

        ColoredLines.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Create the polydata where we will store all the geometric data\n    linesPolyData = vtkPolyData()\n\n    # Create three points\n    origin = [0.0, 0.0, 0.0]\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [0.0, 1.0, 0.0]\n\n    # Create a vtkPoints container and store the points in it\n    pts = vtkPoints()\n    pts.InsertNextPoint(origin)\n    pts.InsertNextPoint(p0)\n    pts.InsertNextPoint(p1)\n\n    # Add the points to the polydata container\n    linesPolyData.SetPoints(pts)\n\n    # Create the first line (between Origin and P0)\n    line0 = vtkLine()\n    line0.GetPointIds().SetId(0, 0)  # the second 0 is the index of the Origin in linesPolyData's points\n    line0.GetPointIds().SetId(1, 1)  # the second 1 is the index of P0 in linesPolyData's points\n\n    # Create the second line (between Origin and P1)\n    line1 = vtkLine()\n    line1.GetPointIds().SetId(0, 0)  # the second 0 is the index of the Origin in linesPolyData's points\n    line1.GetPointIds().SetId(1, 2)  # 2 is the index of P1 in linesPolyData's points\n\n    # Create a vtkCellArray container and store the lines in it\n    lines = vtkCellArray()\n    lines.InsertNextCell(line0)\n    lines.InsertNextCell(line1)\n\n    # Add the lines to the polydata container\n    linesPolyData.SetLines(lines)\n\n    namedColors = vtkNamedColors()\n\n    # Create a vtkUnsignedCharArray container and store the colors in it\n    colors = vtkUnsignedCharArray()\n    colors.SetNumberOfComponents(3)\n    try:\n        colors.InsertNextTupleValue(namedColors.GetColor3ub(\"Tomato\"))\n        colors.InsertNextTupleValue(namedColors.GetColor3ub(\"Mint\"))\n    except AttributeError:\n        # For compatibility with new VTK generic data arrays.\n        colors.InsertNextTypedTuple(namedColors.GetColor3ub(\"Tomato\"))\n        colors.InsertNextTypedTuple(namedColors.GetColor3ub(\"Mint\"))\n\n    # Color the lines.\n    # SetScalars() automatically associates the values in the data array passed as parameter\n    # to the elements in the same indices of the cell data array on which it is called.\n    # This means the first component (red) of the colors array\n    # is matched with the first component of the cell array (line 0)\n    # and the second component (green) of the colors array\n    # is matched with the second component of the cell array (line 1)\n    linesPolyData.GetCellData().SetScalars(colors)\n\n    # Setup the visualization pipeline\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(linesPolyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetLineWidth(4)\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(namedColors.GetColor3d(\"SlateGray\"))\n\n    window = vtkRenderWindow()\n    window.SetWindowName(\"ColoredLines\")\n    window.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(window)\n\n    # Visualize\n    window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Cone/","title":"Cone","text":"

        vtk-examples/Python/GeometricObjects/Cone

        "},{"location":"Python/GeometricObjects/Cone/#description","title":"Description","text":"

        vtkConeSource object creates a cone centered at a specified point and pointing in a specified direction. (By default, the center is the origin and the direction is the x-axis.)

        Depending upon the resolution of this object, different representations are created. If resolution=0 a line is created; if resolution=1, a single triangle is created; if resolution=2, two crossed triangles are created.

        For resolution > 2, a 3D cone (with resolution number of sides) is created.

        It also is possible to control whether the bottom of the cone is capped with a (resolution-sided) polygon, and to specify the height and radius of the cone.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Cone/#code","title":"Code","text":"

        Cone.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    coneSource = vtkConeSource()\n    # coneSource.SetResolution(60)\n    # coneSource.SetCenter(-2,0,0)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(coneSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('bisque'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Salmon'))\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('Cone')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/ConvexPointSet/","title":"ConvexPointSet","text":"

        vtk-examples/Python/GeometricObjects/ConvexPointSet

        "},{"location":"Python/GeometricObjects/ConvexPointSet/#description","title":"Description","text":"

        vtkConvexPointSet object represents a 3D cell defined by a convex set of points. An example of such a cell is an octant (from an octree).

        vtkConvexPointSet uses the ordered triangulations approach (vtkOrderedTriangulator) to create triangulations guaranteed to be compatible across shared faces.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/ConvexPointSet/#code","title":"Code","text":"

        ConvexPointSet.py

        # !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkConvexPointSet,\n    vtkPolyData,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkGlyph3DMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    cps = vtkConvexPointSet()\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, 1)\n    points.InsertNextPoint(1, 1, 1)\n    points.InsertNextPoint(0, 1, 1)\n    points.InsertNextPoint(0.5, 0, 0)\n    points.InsertNextPoint(1, 0.5, 0)\n    points.InsertNextPoint(0.5, 1, 0)\n    points.InsertNextPoint(0, 0.5, 0)\n    points.InsertNextPoint(0.5, 0.5, 0)\n\n    for i in range(0, 13):\n        cps.GetPointIds().InsertId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.Allocate(1, 1)\n    ug.InsertNextCell(cps.GetCellType(), cps.GetPointIds())\n    ug.SetPoints(points)\n\n    colors = vtkNamedColors()\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(ug)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n    actor.GetProperty().SetLineWidth(3)\n    actor.GetProperty().EdgeVisibilityOn()\n\n    # Glyph the points\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(21)\n    sphere.SetThetaResolution(21)\n    sphere.SetRadius(.03)\n\n    # Create a polydata to store everything in\n    polyData = vtkPolyData()\n    polyData.SetPoints(points)\n\n    pointMapper = vtkGlyph3DMapper()\n    pointMapper.SetInputData(polyData)\n    pointMapper.SetSourceConnection(sphere.GetOutputPort())\n\n    pointActor = vtkActor()\n    pointActor.SetMapper(pointMapper)\n    pointActor.GetProperty().SetColor(colors.GetColor3d(\"Peacock\"))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"ConvexPointSet\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor(pointActor)\n    renderer.SetBackground(colors.GetColor3d(\"Silver\"))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(210)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    # Render and interact\n    renderWindow.SetSize(640, 480)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Cube/","title":"Cube","text":"

        vtk-examples/Python/GeometricObjects/Cube

        "},{"location":"Python/GeometricObjects/Cube/#description","title":"Description","text":"

        This is based on the C++ example Examples/DataManipulation/Cxx/Cube.cxx in the VTK source distribution.

        It illustrates the manual use of vtkPolyData to construct a cube and differs from the Wiki examples Cube1.cxx and Cube1.py, which use vtkCubeSource.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Cube/#code","title":"Code","text":"

        Cube.py

        #!/usr/bin/env python\n\n\"\"\"\nThis is (almost) a direct C++ to Python transliteration of\n <VTK-root>/Examples/DataManipulation/Cxx/Cube.cxx from the VTK\n source distribution, which \"shows how to manually create vtkPolyData\"\n\nA convenience function, mkVtkIdList(), has been added and one if/else\n so the example also works in version 6 or later.\nIf your VTK version is 5.x then remove the line: colors = vtkNamedColors()\n and replace the set background parameters with (1.0, 0.9688, 0.8594)\n\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkIdList,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef mkVtkIdList(it):\n    \"\"\"\n    Makes a vtkIdList from a Python iterable. I'm kinda surprised that\n     this is necessary, since I assumed that this kind of thing would\n     have been built into the wrapper and happen transparently, but it\n     seems not.\n\n    :param it: A python iterable.\n    :return: A vtkIdList\n    \"\"\"\n    vil = vtkIdList()\n    for i in it:\n        vil.InsertNextId(int(i))\n    return vil\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # x = array of 8 3-tuples of float representing the vertices of a cube:\n    x = [(0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (1.0, 1.0, 0.0), (0.0, 1.0, 0.0),\n         (0.0, 0.0, 1.0), (1.0, 0.0, 1.0), (1.0, 1.0, 1.0), (0.0, 1.0, 1.0)]\n\n    # pts = array of 6 4-tuples of vtkIdType (int) representing the faces\n    #     of the cube in terms of the above vertices\n    pts = [(0, 3, 2, 1), (4, 5, 6, 7), (0, 1, 5, 4),\n           (1, 2, 6, 5), (2, 3, 7, 6), (3, 0, 4, 7)]\n\n    # We'll create the building blocks of polydata including data attributes.\n    cube = vtkPolyData()\n    points = vtkPoints()\n    polys = vtkCellArray()\n    scalars = vtkFloatArray()\n\n    # Load the point, cell, and data attributes.\n    for i, xi in enumerate(x):\n        points.InsertPoint(i, xi)\n    for pt in pts:\n        polys.InsertNextCell(mkVtkIdList(pt))\n    for i, _ in enumerate(x):\n        scalars.InsertTuple1(i, i)\n\n    # We now assign the pieces to the vtkPolyData.\n    cube.SetPoints(points)\n    cube.SetPolys(polys)\n    cube.GetPointData().SetScalars(scalars)\n\n    # Now we'll look at it.\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputData(cube)\n    cubeMapper.SetScalarRange(cube.GetScalarRange())\n    cubeActor = vtkActor()\n    cubeActor.SetMapper(cubeMapper)\n\n    # The usual rendering stuff.\n    camera = vtkCamera()\n    camera.SetPosition(1, 1, 1)\n    camera.SetFocalPoint(0, 0, 0)\n\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    renderer.AddActor(cubeActor)\n    renderer.SetActiveCamera(camera)\n    renderer.ResetCamera()\n    renderer.SetBackground(colors.GetColor3d(\"Cornsilk\"))\n\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName(\"Cube\")\n\n    # interact with data\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
        "},{"location":"Python/GeometricObjects/Cube1/","title":"Cube1","text":"

        vtk-examples/Python/GeometricObjects/Cube1

        "},{"location":"Python/GeometricObjects/Cube1/#description","title":"Description","text":"

        Display a cube.

        A nice simple example that demonstrates the operation of the VTK pipeline.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Cube1/#code","title":"Code","text":"

        Cube1.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a rendering window and renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName('Cube1')\n    renWin.AddRenderer(ren)\n\n    # Create a renderwindowinteractor.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create cube.\n    cube = vtkCubeSource()\n    cube.Update()\n\n    # mapper\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputData(cube.GetOutput())\n\n    # Actor.\n    cubeActor = vtkActor()\n    cubeActor.SetMapper(cubeMapper)\n    cubeActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n\n    # Assign actor to the renderer.\n    ren.AddActor(cubeActor)\n\n    ren.ResetCamera()\n    ren.GetActiveCamera().Azimuth(30)\n    ren.GetActiveCamera().Elevation(30)\n    ren.ResetCameraClippingRange()\n    ren.SetBackground(colors.GetColor3d('Silver'))\n\n    # Enable user interface interactor.\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Cylinder/","title":"Cylinder","text":"

        vtk-examples/Python/GeometricObjects/Cylinder

        "},{"location":"Python/GeometricObjects/Cylinder/#description","title":"Description","text":"

        vtkCylinderSource object creates a polygonal cylinder centered at Center.

        The axis of the cylinder is aligned along the global y-axis. The height and radius of the cylinder can be specified, as well as the number of sides.

        It is also possible to control whether the cylinder is open-ended or capped. If you have the end points of the cylinder, you should use a vtkLineSource followed by a vtkTubeFilter instead of the vtkCylinderSource.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Cylinder/#code","title":"Code","text":"

        Cylinder.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkCylinderSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a sphere\n    cylinderSource = vtkCylinderSource()\n    cylinderSource.SetCenter(0.0, 0.0, 0.0)\n    cylinderSource.SetRadius(5.0)\n    cylinderSource.SetHeight(7.0)\n    cylinderSource.SetResolution(100)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(cylinderSource.GetOutputPort())\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('Cornsilk'))\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Cylinder')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/CylinderExample/","title":"CylinderExample","text":"

        vtk-examples/Python/GeometricObjects/CylinderExample

        "},{"location":"Python/GeometricObjects/CylinderExample/#description","title":"Description","text":"

        This example creates a minimal visualization program, demonstrating VTK's basic rendering and pipeline creation.

        Note

        This original C++ source code for this example is here.

        Other languages

        See (Cxx), (PythonicAPI), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/CylinderExample/#code","title":"Code","text":"

        CylinderExample.py

        #!/usr/bin/env python\n\n# This simple example shows how to do basic rendering and pipeline\n# creation.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkCylinderSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Set the background color.\n    bkg = map(lambda x: x / 255.0, [26, 51, 102, 255])\n    colors.SetColor(\"BkgColor\", *bkg)\n\n    # This creates a polygonal cylinder model with eight circumferential\n    # facets.\n    cylinder = vtkCylinderSource()\n    cylinder.SetResolution(8)\n\n    # The mapper is responsible for pushing the geometry into the graphics\n    # library. It may also do color mapping, if scalars or other\n    # attributes are defined.\n    cylinderMapper = vtkPolyDataMapper()\n    cylinderMapper.SetInputConnection(cylinder.GetOutputPort())\n\n    # The actor is a grouping mechanism: besides the geometry (mapper), it\n    # also has a property, transformation matrix, and/or texture map.\n    # Here we set its color and rotate it -22.5 degrees.\n    cylinderActor = vtkActor()\n    cylinderActor.SetMapper(cylinderMapper)\n    cylinderActor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n    cylinderActor.RotateX(30.0)\n    cylinderActor.RotateY(-45.0)\n\n    # Create the graphics structure. The renderer renders into the render\n    # window. The render window interactor captures mouse events and will\n    # perform appropriate camera or actor manipulation depending on the\n    # nature of the events.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    ren.AddActor(cylinderActor)\n    ren.SetBackground(colors.GetColor3d(\"BkgColor\"))\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('CylinderExample')\n\n    # This allows the interactor to initalize itself. It has to be\n    # called before an event loop.\n    iren.Initialize()\n\n    # We'll zoom in a little by accessing the camera and invoking a \"Zoom\"\n    # method on it.\n    ren.ResetCamera()\n    ren.GetActiveCamera().Zoom(1.5)\n    renWin.Render()\n\n    # Start the event loop.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Disk/","title":"Disk","text":"

        vtk-examples/Python/GeometricObjects/Disk

        "},{"location":"Python/GeometricObjects/Disk/#description","title":"Description","text":"

        vtkDiskSource objects creates a polygonal disk with a hole in the center.

        The disk has zero height. The user can specify the inner and outer radius of the disk, and the radial and circumferential resolution of the polygonal representation.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Disk/#code","title":"Code","text":"

        Disk.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkDiskSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    diskSource = vtkDiskSource()\n\n    # Create a mapper and actor.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(diskSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Cornsilk\"))\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Disk\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d(\"DarkGreen\"))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Dodecahedron/","title":"Dodecahedron","text":"

        vtk-examples/Python/GeometricObjects/Dodecahedron

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Dodecahedron/#code","title":"Code","text":"

        Dodecahedron.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyhedron\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    dodecahedron = MakeDodecahedron()\n\n    # Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(dodecahedron.GetPolyData())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(\n        colors.GetColor3d('PapayaWhip'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Dodecahedron')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('CadetBlue'))\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    renderer.ResetCamera()\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef MakeDodecahedron():\n    aDodecahedron = vtkPolyhedron()\n\n    for i in range(0, 20):\n        aDodecahedron.GetPointIds().InsertNextId(i)\n\n    aDodecahedron.GetPoints().InsertNextPoint(1.21412, 0, 1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(0.375185, 1.1547, 1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.982247, 0.713644, 1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.982247, -0.713644, 1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(0.375185, -1.1547, 1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(1.96449, 0, 0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(0.607062, 1.86835, 0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(-1.58931, 1.1547, 0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(-1.58931, -1.1547, 0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(0.607062, -1.86835, 0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(1.58931, 1.1547, -0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.607062, 1.86835, -0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(-1.96449, 0, -0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.607062, -1.86835, -0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(1.58931, -1.1547, -0.375185)\n    aDodecahedron.GetPoints().InsertNextPoint(0.982247, 0.713644, -1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.375185, 1.1547, -1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(-1.21412, 0, -1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(-0.375185, -1.1547, -1.58931)\n    aDodecahedron.GetPoints().InsertNextPoint(0.982247, -0.713644, -1.58931)\n\n    faces = [12,  # number of faces\n             5, 0, 1, 2, 3, 4,  # number of ids on face, ids\n             5, 0, 5, 10, 6, 1,\n             5, 1, 6, 11, 7, 2,\n             5, 2, 7, 12, 8, 3,\n             5, 3, 8, 13, 9, 4,\n             5, 4, 9, 14, 5, 0,\n             5, 15, 10, 5, 14, 19,\n             5, 16, 11, 6, 10, 15,\n             5, 17, 12, 7, 11, 16,\n             5, 18, 13, 8, 12, 17,\n             5, 19, 14, 9, 13, 18,\n             5, 19, 18, 17, 16, 15]\n\n    aDodecahedron.SetFaces(faces)\n    aDodecahedron.Initialize()\n\n    return aDodecahedron\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/EarthSource/","title":"EarthSource","text":"

        vtk-examples/Python/GeometricObjects/EarthSource

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/EarthSource/#code","title":"Code","text":"

        EarthSource.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersHybrid import vtkEarthSource\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Earth source\n    earthSource = vtkEarthSource()\n    earthSource.OutlineOn()\n    earthSource.Update()\n    r = earthSource.GetRadius()\n\n    # Create a sphere\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(100)\n    sphere.SetPhiResolution(100)\n    sphere.SetRadius(earthSource.GetRadius())\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(earthSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor(sphereActor)\n    renderer.SetBackground(colors.GetColor3d('Black'))\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('EarthSource')\n\n    # Render and interact\n    renderWindow.Render()\n\n    # # screenshot code:\n    # w2if = vtkWindowToImageFilter()\n    # w2if.SetInput(renderWindow)\n    # w2if.Update()\n    #\n    # writer = vtkPNGWriter()\n    # writer.SetFileName('TestEarthSource.png')\n    # writer.SetInputConnection(w2if.GetOutputPort())\n    # writer.Write()\n\n    # begin interaction\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/EllipticalCylinder/","title":"EllipticalCylinder","text":"

        vtk-examples/Python/GeometricObjects/EllipticalCylinder

        "},{"location":"Python/GeometricObjects/EllipticalCylinder/#description","title":"Description","text":"

        The example creates an elliptical cross-section and stores it in a vtkPolyData. Then, the vtkLinearExtrusionFilter creates an elliptical cylinder by extruding the vtkPolyLine along a vector. The example sets the backface property of the vtkActor to show the front and back face of the cylinder.

        Seealso

        EllipticalCylinderDemo to see the vtkPolyLine and the vector represented as an oriented

        arrow.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/EllipticalCylinder/#code","title":"Code","text":"

        EllipticalCylinder.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMath,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkFiltersModeling import vtkLinearExtrusionFilter\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    angle = 0\n    r1 = 50\n    r2 = 30\n    centerX = 10.0\n    centerY = 5.0\n\n    points = vtkPoints()\n    idx = 0\n    while angle <= 2.0 * vtkMath.Pi() + (vtkMath.Pi() / 60.0):\n        points.InsertNextPoint(r1 * math.cos(angle) + centerX,\n                               r2 * math.sin(angle) + centerY,\n                               0.0)\n        angle = angle + (vtkMath.Pi() / 60.0)\n        idx += 1\n\n    line = vtkPolyLine()\n    line.GetPointIds().SetNumberOfIds(idx)\n    for i in range(0, idx):\n        line.GetPointIds().SetId(i, i)\n\n    lines = vtkCellArray()\n    lines.InsertNextCell(line)\n\n    polyData = vtkPolyData()\n    polyData.SetPoints(points)\n    polyData.SetLines(lines)\n\n    extrude = vtkLinearExtrusionFilter()\n    extrude.SetInputData(polyData)\n    extrude.SetExtrusionTypeToNormalExtrusion()\n    extrude.SetVector(0, 0, 100.0)\n    extrude.Update()\n\n    lineMapper = vtkPolyDataMapper()\n    lineMapper.SetInputData(polyData)\n\n    lineActor = vtkActor()\n    lineActor.SetMapper(lineMapper)\n    lineActor.GetProperty().SetColor(colors.GetColor3d(\"Peacock\"))\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(extrude.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d(\"Tomato\"))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n    actor.SetBackfaceProperty(back)\n\n    ren = vtkRenderer()\n    ren.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    ren.AddActor(actor)\n    ren.AddActor(lineActor)\n\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName(\"EllipticalCylinder\")\n    renWin.AddRenderer(ren)\n    renWin.SetSize(600, 600)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    camera = vtkCamera()\n    camera.SetPosition(0, 1, 0)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetViewUp(0, 0, 1)\n    camera.Azimuth(30)\n    camera.Elevation(30)\n\n    ren.SetActiveCamera(camera)\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/EllipticalCylinderDemo/","title":"EllipticalCylinderDemo","text":"

        vtk-examples/Python/GeometricObjects/EllipticalCylinderDemo

        "},{"location":"Python/GeometricObjects/EllipticalCylinderDemo/#description","title":"Description","text":"

        The example shows the vtkPolyLine that forms the base of the elliptical cylinder and an oriented arrow that represents the vector that vtkLinearExtrusionFilter uses to create the cylinder. The example takes an optional triple that defines the vector for the filter. The length of the vector is the height of the cylinder.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/EllipticalCylinderDemo/#code","title":"Code","text":"

        EllipticalCylinderDemo.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMath,\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkLinearExtrusionFilter\nfrom vtkmodules.vtkFiltersSources import vtkArrowSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    nx, ny, nz = get_program_parameters()\n    colors = vtkNamedColors()\n\n    angle = 0\n    r1 = 50\n    r2 = 30\n    centerX = 10.0\n    centerY = 5.0\n\n    points = vtkPoints()\n    idx = 0\n    while angle <= 2.0 * vtkMath.Pi() + (vtkMath.Pi() / 60.0):\n        points.InsertNextPoint(r1 * math.cos(angle) + centerX,\n                               r2 * math.sin(angle) + centerY,\n                               0.0)\n        angle = angle + (vtkMath.Pi() / 60.0)\n        idx += 1\n\n    line = vtkPolyLine()\n    line.GetPointIds().SetNumberOfIds(idx)\n    for i in range(0, idx):\n        line.GetPointIds().SetId(i, i)\n\n    lines = vtkCellArray()\n    lines.InsertNextCell(line)\n\n    polyData = vtkPolyData()\n    polyData.SetPoints(points)\n    polyData.SetLines(lines)\n\n    extrude = vtkLinearExtrusionFilter()\n    extrude.SetInputData(polyData)\n    extrude.SetExtrusionTypeToNormalExtrusion()\n    extrude.SetVector(nx, ny, nz)\n    extrude.Update()\n\n    # Create an oriented arrow\n    startPoint = [0.0] * 3\n    endPoint = [0.0] * 3\n    startPoint[0] = centerX\n    startPoint[1] = centerY\n    startPoint[2] = 0.0\n    for i in range(0, 3):\n        endPoint[i] = startPoint[i] + extrude.GetVector()[i]\n\n    # Compute a basis\n    normalizedX = [0.0] * 3\n    normalizedY = [0.0] * 3\n    normalizedZ = [0.0] * 3\n\n    # The X axis is a vector from start to end\n    vtkMath.Subtract(endPoint, startPoint, normalizedX)\n    length = vtkMath.Norm(normalizedX)\n    vtkMath.Normalize(normalizedX)\n\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(8775070)\n    max_r = 10.0\n\n    # The Z axis is an arbitrary vector cross X\n    arbitrary = [0.0] * 3\n    for i in range(0, 3):\n        arbitrary[i] = rng.GetRangeValue(-max_r, max_r)\n        rng.Next()\n    vtkMath.Cross(normalizedX, arbitrary, normalizedZ)\n    vtkMath.Normalize(normalizedZ)\n\n    # The Y axis is Z cross X\n    vtkMath.Cross(normalizedZ, normalizedX, normalizedY)\n    matrix = vtkMatrix4x4()\n\n    # Create the direction cosine matrix\n    matrix.Identity()\n    for i in range(0, 3):\n        matrix.SetElement(i, 0, normalizedX[i])\n        matrix.SetElement(i, 1, normalizedY[i])\n        matrix.SetElement(i, 2, normalizedZ[i])\n\n    # Apply the transforms\n    transform = vtkTransform()\n    transform.Translate(startPoint)\n    transform.Concatenate(matrix)\n    transform.Scale(length, length, length)\n\n    arrowSource = vtkArrowSource()\n    arrowSource.SetTipResolution(31)\n    arrowSource.SetShaftResolution(21)\n\n    # Transform the polydata\n    transformPD = vtkTransformPolyDataFilter()\n    transformPD.SetTransform(transform)\n    transformPD.SetInputConnection(arrowSource.GetOutputPort())\n\n    # Create a mapper and actor for the arrow\n    arrowMapper = vtkPolyDataMapper()\n    arrowMapper.SetInputConnection(transformPD.GetOutputPort())\n\n    arrowActor = vtkActor()\n    arrowActor.SetMapper(arrowMapper)\n    arrowActor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n\n    tubes = vtkTubeFilter()\n    tubes.SetInputData(polyData)\n    tubes.SetRadius(2.0)\n    tubes.SetNumberOfSides(21)\n\n    lineMapper = vtkPolyDataMapper()\n    lineMapper.SetInputConnection(tubes.GetOutputPort())\n\n    lineActor = vtkActor()\n    lineActor.SetMapper(lineMapper)\n    lineActor.GetProperty().SetColor(colors.GetColor3d(\"Peacock\"))\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(extrude.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n    actor.GetProperty().SetOpacity(.7)\n\n    ren = vtkRenderer()\n    ren.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    ren.AddActor(actor)\n    ren.AddActor(lineActor)\n    ren.AddActor(arrowActor)\n\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName(\"Elliptical Cylinder Demo\")\n    renWin.AddRenderer(ren)\n    renWin.SetSize(600, 600)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    camera = vtkCamera()\n    camera.SetPosition(0, 1, 0)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetViewUp(0, 0, 1)\n    camera.Azimuth(30)\n    camera.Elevation(30)\n\n    ren.SetActiveCamera(camera)\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Elliptical Cylinder Demo.'\n    epilogue = '''\nThe example shows the vtkPolyLine that forms the base of the elliptical cylinder\n and an oriented arrow that represents the vector that vtkLinearExtrusionFilter\n uses to create the cylinder.\nThe example takes an optional triple that defines the vector for the filter.\nThe length of the vector is the height of the cylinder.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-nx', nargs='?', const=0.0, default=0.0, type=float)\n    parser.add_argument('-ny', nargs='?', const=0.0, default=0.0, type=float)\n    parser.add_argument('-nz', nargs='?', const=100.0, default=100.0, type=float)\n    args = parser.parse_args()\n    return args.nx, args.ny, args.nz\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Frustum/","title":"Frustum","text":"

        vtk-examples/Python/GeometricObjects/Frustum

        "},{"location":"Python/GeometricObjects/Frustum/#description","title":"Description","text":"

        This example gets the frustum from a camera and displays it on the screen.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Frustum/#code","title":"Code","text":"

        Frustum.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPlanes\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkPolyData\nfrom vtkmodules.vtkFiltersSources import vtkFrustumSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    camera = vtkCamera()\n    camera.SetClippingRange(0.1, 0.4)\n    planesArray = [0] * 24\n\n    camera.GetFrustumPlanes(1.0, planesArray)\n\n    planes = vtkPlanes()\n    planes.SetFrustumPlanes(planesArray)\n\n    frustumSource = vtkFrustumSource()\n    frustumSource.ShowLinesOff()\n    frustumSource.SetPlanes(planes)\n\n    shrink = vtkShrinkPolyData()\n    shrink.SetInputConnection(frustumSource.GetOutputPort())\n    shrink.SetShrinkFactor(.9)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(shrink.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d(\"Tomato\"))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n    actor.SetBackfaceProperty(back)\n\n    # a renderer and render window\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Frustum\")\n    renderWindow.AddRenderer(renderer)\n\n    # an interactor\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d(\"Silver\"))\n\n    # Position the camera so that we can see the frustum\n    renderer.GetActiveCamera().SetPosition(1, 0, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 1, 0)\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCamera()\n\n    # render an image (lights and cameras are created automatically)\n    renderWindow.Render()\n\n    # begin mouse interaction\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/GeometricObjectsDemo/","title":"GeometricObjectsDemo","text":"

        vtk-examples/Python/GeometricObjects/GeometricObjectsDemo

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/GeometricObjectsDemo/#code","title":"Code","text":"

        GeometricObjectsDemo.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkConeSource,\n    vtkCubeSource,\n    vtkCylinderSource,\n    vtkDiskSource,\n    vtkLineSource,\n    vtkRegularPolygonSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor(\"BkgColor\", [51, 77, 102, 255])\n\n    # Create container to hold the 3D object generators (sources)\n    geometricObjectSources = list()\n\n    # Populate the container with the various object sources to be demonstrated\n    geometricObjectSources.append(vtkArrowSource())\n    geometricObjectSources.append(vtkConeSource())\n    geometricObjectSources.append(vtkCubeSource())\n    geometricObjectSources.append(vtkCylinderSource())\n    geometricObjectSources.append(vtkDiskSource())\n    geometricObjectSources.append(vtkLineSource())\n    geometricObjectSources.append(vtkRegularPolygonSource())\n    geometricObjectSources.append(vtkSphereSource())\n\n    # Create containers for the remaining nodes of each pipeline\n    mappers = list()\n    actors = list()\n    textmappers = list()\n    textactors = list()\n\n    # Create a common text property.\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(16)\n    textProperty.SetJustificationToCentered()\n    textProperty.SetColor(colors.GetColor3d('LightGoldenrodYellow'))\n\n    # Create a mapper and actor for each object and the corresponding text label\n    for i in range(0, len(geometricObjectSources)):\n        geometricObjectSources[i].Update()\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[i].SetInputConnection(geometricObjectSources[i].GetOutputPort())\n\n        actors.append(vtkActor())\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n        textmappers.append(vtkTextMapper())\n        textmappers[i].SetInput(\n            geometricObjectSources[i].GetClassName())  # set text label to the name of the object source\n        textmappers[i].SetTextProperty(textProperty)\n\n        textactors.append(vtkActor2D())\n        textactors[i].SetMapper(textmappers[i])\n        textactors[i].SetPosition(120, 16)  # Note: the position of an Actor2D is specified in display coordinates\n\n    # Define size of the grid that will hold the objects\n    gridCols = 3\n    gridRows = 3\n    # Define side length (in pixels) of each renderer square\n    rendererSize = 300\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('GeometricObjectsDemo')\n    renderWindow.SetSize(rendererSize * gridCols, rendererSize * gridRows)\n\n    # Set up a grid of viewports for each renderer\n    for row in range(0, gridRows):\n        for col in range(0, gridCols):\n            index = row * gridCols + col\n\n            # Create a renderer for this grid cell\n            renderer = vtkRenderer()\n            renderer.SetBackground(colors.GetColor3d('BkgColor'))\n\n            # Set the renderer's viewport dimensions (xmin, ymin, xmax, ymax) within the render window.\n            # Note that for the Y values, we need to subtract the row index from gridRows\n            # because the viewport Y axis points upwards, but we want to draw the grid from top to down\n            viewport = [\n                float(col) / gridCols,\n                float(gridRows - row - 1) / gridRows,\n                float(col + 1) / gridCols,\n                float(gridRows - row) / gridRows\n            ]\n            renderer.SetViewport(viewport)\n\n            # Add the corresponding actor and label for this grid cell, if they exist\n            if index < len(geometricObjectSources):\n                renderer.AddActor(actors[index])\n                renderer.AddActor(textactors[index])\n                renderer.ResetCameraClippingRange()\n\n            renderWindow.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Hexahedron/","title":"Hexahedron","text":"

        vtk-examples/Python/GeometricObjects/Hexahedron

        "},{"location":"Python/GeometricObjects/Hexahedron/#description","title":"Description","text":"

        The hexahedron is a primary three-dimensional cell consisting of six quadrilateral faces, twelve edges, and eight vertices. The hexahedron is defined by an ordered list of eight points. The faces and edges must not intersect any other faces and edges, and the hexahedron must be convex.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Hexahedron/#code","title":"Code","text":"

        Hexahedron.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkHexahedron,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor(\"BkgColor\", [51, 77, 102, 255])\n\n    # For the hexahedron setup the coordinates of eight points.\n    # The two faces must be in counter clockwise order as viewed from the\n    # outside.\n    pointCoordinates = list()\n    pointCoordinates.append([0.0, 0.0, 0.0])  # Face 1\n    pointCoordinates.append([1.0, 0.0, 0.0])\n    pointCoordinates.append([1.0, 1.0, 0.0])\n    pointCoordinates.append([0.0, 1.0, 0.0])\n    pointCoordinates.append([0.0, 0.0, 1.0])  # Face 2\n    pointCoordinates.append([1.0, 0.0, 1.0])\n    pointCoordinates.append([1.0, 1.0, 1.0])\n    pointCoordinates.append([0.0, 1.0, 1.0])\n\n    # Create the points.\n    points = vtkPoints()\n\n    # Create a hexahedron from the points.\n    hexahedron = vtkHexahedron()\n\n    for i in range(0, len(pointCoordinates)):\n        points.InsertNextPoint(pointCoordinates[i])\n        hexahedron.GetPointIds().SetId(i, i)\n\n    # Add the hexahedron to a cell array.\n    hexs = vtkCellArray()\n    hexs.InsertNextCell(hexahedron)\n\n    # Add the points and hexahedron to an unstructured grid.\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(hexahedron.GetCellType(), hexahedron.GetPointIds())\n\n    # Visualize.\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(uGrid)\n\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d(\"PeachPuff\"))\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Hexahedron\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d(\"BkgColor\"))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/IsoparametricCellsDemo/","title":"IsoparametricCellsDemo","text":"

        vtk-examples/Python/GeometricObjects/IsoparametricCellsDemo

        "},{"location":"Python/GeometricObjects/IsoparametricCellsDemo/#description","title":"Description","text":"

        This example shows the isoparametric cells supported by the VTK. These cells are nonlinear and contain one or more mid-side vertices. Isoparametric elements are typically used in finite element analysis. The term isoparametric is derived from the use of the same shape functions (or interpolation functions) to define the element's geometric shape as are used to define the displacements within the element.

        This example illustrates each cell's representation using its parametric coordinates (pcoords) as the vertices of the cell. In practice, the vertices will correspond to physical points in a finite element model. Use vtkTessellatorFilter to better see the shape of the cell. See for example, QuadraticHexahedronDemo and QuadraticTetraDemo.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/IsoparametricCellsDemo/#code","title":"Code","text":"

        IsoparametricCellsDemo.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkBiQuadraticQuad,\n    vtkBiQuadraticQuadraticHexahedron,\n    vtkBiQuadraticQuadraticWedge,\n    vtkBiQuadraticTriangle,\n    vtkCubicLine,\n    vtkQuadraticEdge,\n    vtkQuadraticHexahedron,\n    vtkQuadraticLinearQuad,\n    vtkQuadraticLinearWedge,\n    vtkQuadraticPolygon,\n    vtkQuadraticPyramid,\n    vtkQuadraticQuad,\n    vtkQuadraticTetra,\n    vtkQuadraticTriangle,\n    vtkQuadraticWedge,\n    vtkTriQuadraticHexahedron,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkGlyph3DMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\nfrom vtkmodules.vtkRenderingLabel import vtkLabeledDataMapper\n\n\ndef main():\n    titles = list()\n    textMappers = list()\n    textActors = list()\n\n    uGrids = list()\n    mappers = list()\n    actors = list()\n    renderers = list()\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticEdge()))\n    titles.append('VTK_QUADRATIC_EDGE (= 21)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticTriangle()))\n    titles.append('VTK_QUADRATIC_TRIANGLE (= 22)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticQuad()))\n    titles.append('VTK_QUADRATIC_QUAD (= 23)')\n\n    uGrids.append(MakeQuadraticPolygon())\n    titles.append('VTK_QUADRATIC_POLYGON (= 36)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticTetra()))\n    titles.append('VTK_QUADRATIC_TETRA (= 24)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticHexahedron()))\n    titles.append('VTK_QUADRATIC_HEXAHEDRON (= 25)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticWedge()))\n    titles.append('VTK_QUADRATIC_WEDGE (= 26)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticPyramid()))\n    titles.append('VTK_QUADRATIC_PYRAMID (= 27)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkBiQuadraticQuad()))\n    titles.append('VTK_BIQUADRATIC_QUAD (= 28)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkTriQuadraticHexahedron()))\n    titles.append('VTK_TRIQUADRATIC_HEXAHEDRON (= 29)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticLinearQuad()))\n    titles.append('VTK_QUADRATIC_LINEAR_QUAD (= 30)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkQuadraticLinearWedge()))\n    titles.append('VTK_QUADRATIC_LINEAR_WEDGE (= 31)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkBiQuadraticQuadraticWedge()))\n    titles.append('VTK_BIQUADRATIC_QUADRATIC_WEDGE (= 32)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkBiQuadraticQuadraticHexahedron()))\n    titles.append('VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON (= 33)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkBiQuadraticTriangle()))\n    titles.append('VTK_BIQUADRATIC_TRIANGLE (= 34)')\n\n    uGrids.append(MakeUnstructuredGrid(\n        vtkCubicLine()))\n    titles.append('VTK_CUBIC_LINE (= 35)')\n\n    colors = vtkNamedColors()\n\n    renWin = vtkRenderWindow()\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName('Isoparametric Cell')\n\n    iRen = vtkRenderWindowInteractor()\n    iRen.SetRenderWindow(renWin)\n\n    # Create one sphere for all\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(21)\n    sphere.SetThetaResolution(21)\n    sphere.SetRadius(.08)\n\n    # Create one text property for all\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(10)\n    textProperty.SetJustificationToCentered()\n\n    # Create and link the mappers actors and renderers together.\n    for i in range(0, len(uGrids)):\n        print('Creating:', titles[i])\n        textMappers.append(vtkTextMapper())\n        textActors.append(vtkActor2D())\n\n        textMappers[i].GetTextProperty().SetFontSize(10)\n        textMappers[i].GetTextProperty().ShadowOn()\n        mappers.append(vtkDataSetMapper())\n        actors.append(vtkActor())\n        renderers.append(vtkRenderer())\n        mappers[i].SetInputData(uGrids[i])\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('Tomato'))\n        actors[i].GetProperty().EdgeVisibilityOn()\n        actors[i].GetProperty().SetLineWidth(3)\n        actors[i].GetProperty().SetOpacity(.5)\n        renderers[i].AddViewProp(actors[i])\n\n        textMappers[i].SetInput(titles[i])\n        textActors[i].SetMapper(textMappers[i])\n        textActors[i].SetPosition(50, 10)\n        renderers[i].AddViewProp(textActors[i])\n\n        # Label the points\n        labelMapper = vtkLabeledDataMapper()\n        labelMapper.SetInputData(uGrids[i])\n        labelActor = vtkActor2D()\n        labelActor.SetMapper(labelMapper)\n        renderers[i].AddViewProp(labelActor)\n\n        # Glyph the points\n        pointMapper = vtkGlyph3DMapper()\n        pointMapper.SetInputData(uGrids[i])\n        pointMapper.SetSourceConnection(sphere.GetOutputPort())\n        pointMapper.ScalingOff()\n        pointMapper.ScalarVisibilityOff()\n\n        pointActor = vtkActor()\n        pointActor.SetMapper(pointMapper)\n        pointActor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n        pointActor.GetProperty().SetSpecular(.6)\n        pointActor.GetProperty().SetSpecularColor(1.0, 1.0, 1.0)\n        pointActor.GetProperty().SetSpecularPower(100)\n        renderers[i].AddViewProp(pointActor)\n\n        renWin.AddRenderer(renderers[i])\n\n    # Setup the viewports\n    xGridDimensions = 4\n    yGridDimensions = 4\n    rendererSize = 240\n    renWin.SetSize(rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(0, xGridDimensions):\n            index = row * xGridDimensions + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions,\n                        float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions,\n                        float(yGridDimensions - row) / yGridDimensions]\n\n            if index > (len(actors) - 1):\n                # Add a renderer even if there is no actor.\n                # This makes the render window background all the same color.\n                ren = vtkRenderer()\n                ren.SetBackground(colors.GetColor3d('SlateGray'))\n                ren.SetViewport(viewport)\n                renWin.AddRenderer(ren)\n                continue\n\n            renderers[index].SetViewport(viewport)\n            renderers[index].SetBackground(colors.GetColor3d('SlateGray'))\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(30)\n            renderers[index].GetActiveCamera().Elevation(-30)\n            renderers[index].ResetCameraClippingRange()\n\n    iRen.Initialize()\n    renWin.Render()\n    iRen.Start()\n\n\n# These functions return a vtkUnstructured grid corresponding to the object.\n\ndef MakeUnstructuredGrid(aCell):\n    pcoords = aCell.GetParametricCoords()\n    for i in range(0, aCell.GetNumberOfPoints()):\n        aCell.GetPointIds().SetId(i, i)\n        aCell.GetPoints().SetPoint(i, (pcoords[3 * i]), (pcoords[3 * i + 1]), (pcoords[3 * i + 2]))\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(aCell.GetPoints())\n    ug.InsertNextCell(aCell.GetCellType(), aCell.GetPointIds())\n    return ug\n\n\ndef MakeQuadraticPolygon():\n    quadraticPolygon = vtkQuadraticPolygon()\n\n    quadraticPolygon.GetPointIds().SetNumberOfIds(8)\n    quadraticPolygon.GetPointIds().SetId(0, 0)\n    quadraticPolygon.GetPointIds().SetId(1, 1)\n    quadraticPolygon.GetPointIds().SetId(2, 2)\n    quadraticPolygon.GetPointIds().SetId(3, 3)\n    quadraticPolygon.GetPointIds().SetId(4, 4)\n    quadraticPolygon.GetPointIds().SetId(5, 5)\n    quadraticPolygon.GetPointIds().SetId(6, 6)\n    quadraticPolygon.GetPointIds().SetId(7, 7)\n\n    quadraticPolygon.GetPoints().SetNumberOfPoints(8)\n    quadraticPolygon.GetPoints().SetPoint(0, 0.0, 0.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(1, 2.0, 0.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(2, 2.0, 2.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(3, 0.0, 2.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(4, 1.0, 0.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(5, 2.0, 1.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(6, 1.0, 2.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(7, 0.0, 1.0, 0.0)\n    quadraticPolygon.GetPoints().SetPoint(5, 3.0, 1.0, 0.0)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(quadraticPolygon.GetPoints())\n    ug.InsertNextCell(quadraticPolygon.GetCellType(), quadraticPolygon.GetPointIds())\n    return ug\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Line/","title":"Line","text":"

        vtk-examples/Python/GeometricObjects/Line

        "},{"location":"Python/GeometricObjects/Line/#description","title":"Description","text":"

        The line is a primary one-dimensional cell. It is defined by two points. The direction along the line is from the first point to the second point.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Line/#code","title":"Code","text":"

        Line.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Create two points, P0 and P1\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [0.0, 1.0, 0.0]\n\n    lineSource = vtkLineSource()\n    lineSource.SetPoint1(p0)\n    lineSource.SetPoint2(p1)\n\n    # Visualize\n    colors = vtkNamedColors()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(lineSource.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetLineWidth(4)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Peacock\"))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Line\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.SetBackground(colors.GetColor3d(\"Silver\"))\n    renderer.AddActor(actor)\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/LinearCellDemo/","title":"LinearCellDemo","text":"

        vtk-examples/Python/GeometricObjects/LinearCellDemo

        "},{"location":"Python/GeometricObjects/LinearCellDemo/#description","title":"Description","text":"

        Linear cell types found in VTK. Numbers define ordering of the defining points.

        Options are provided to show a wireframe (-w) or to colour the back face differently from the front face (-b).

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/LinearCellDemo/#code","title":"Code","text":"

        LinearCellDemo.py

        # !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    # VTK_HEXAGONAL_PRISM,\n    # VTK_HEXAHEDRON,\n    # VTK_LINE,\n    # VTK_PENTAGONAL_PRISM,\n    # VTK_PIXEL,\n    # VTK_POLY_LINE,\n    # VTK_POLY_VERTEX,\n    # VTK_POLYGON,\n    # VTK_PYRAMID,\n    # VTK_QUAD,\n    VTK_TETRA,\n    # VTK_TRIANGLE,\n    # VTK_TRIANGLE_STRIP,\n    # VTK_VERTEX,\n    # VTK_VOXEL,\n    # VTK_WEDGE,\n    vtkCellArray,\n    vtkHexagonalPrism,\n    vtkHexahedron,\n    vtkLine,\n    vtkPentagonalPrism,\n    vtkPixel,\n    vtkPolyLine,\n    vtkPolyVertex,\n    vtkPolygon,\n    vtkPyramid,\n    vtkQuad,\n    vtkTetra,\n    vtkTriangle,\n    vtkTriangleStrip,\n    vtkUnstructuredGrid,\n    vtkVertex,\n    vtkVoxel,\n    vtkWedge\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkGlyph3DMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\nfrom vtkmodules.vtkRenderingLabel import vtkLabeledDataMapper\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrate the linear cell types found in VTK. Numbers define ordering of the defining points.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    group1 = parser.add_mutually_exclusive_group()\n    group1.add_argument('-w', '--wireframe', action='store_true',\n                        help='Render a wireframe.')\n    group1.add_argument('-b', '--backface', action='store_true',\n                        help='Display the back face in a different colour.')\n    args = parser.parse_args()\n    return args.wireframe, args.backface\n\n\ndef main():\n    wireframe_on, backface_on = get_program_parameters()\n\n    titles = list()\n    text_mappers = list()\n    text_actors = list()\n\n    u_grids = list()\n    mappers = list()\n    actors = list()\n    renderers = list()\n\n    u_grids.append(make_vertex())\n    titles.append('VTK_VERTEX (=1)')\n    u_grids.append(make_poly_vertex())\n    titles.append('VTK_POLY_VERTEX (=2)')\n    u_grids.append(make_line())\n    titles.append('VTK_LINE (=3)')\n    u_grids.append(make_polyline())\n    titles.append('VTK_POLY_LINE (=4)')\n    u_grids.append(make_triangle())\n    titles.append('VTK_TRIANGLE (=5)')\n    u_grids.append(make_triangle_strip())\n    titles.append('VTK_TRIANGLE_STRIP (=6)')\n    u_grids.append(make_polygon())\n    titles.append('VTK_POLYGON (=7)')\n    u_grids.append(make_pixel())\n    titles.append('VTK_PIXEL (=8)')\n    u_grids.append(make_quad())\n    titles.append('VTK_QUAD (=9)')\n    u_grids.append(make_tetra())\n    titles.append('VTK_TETRA (=10)')\n    u_grids.append(make_voxel())\n    titles.append('VTK_VOXEL (=11)')\n    u_grids.append(make_hexahedron())\n    titles.append('VTK_HEXAHEDRON (=12)')\n    u_grids.append(make_wedge())\n    titles.append('VTK_WEDGE (=13)')\n    u_grids.append(make_pyramid())\n    titles.append('VTK_PYRAMID (=14)')\n    u_grids.append(make_pentagonal_prism())\n    titles.append('VTK_PENTAGONAL_PRISM (=15)')\n    u_grids.append(make_hexagonal_prism())\n    titles.append('VTK_HEXAGONAL_PRISM (=16)')\n\n    colors = vtkNamedColors()\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetWindowName('LinearCellDemo')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Create one sphere for all\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(21)\n    sphere.SetThetaResolution(21)\n    sphere.SetRadius(.08)\n\n    # Create one text property for all\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(10)\n    text_property.SetJustificationToCentered()\n    text_property.SetColor(colors.GetColor3d('Black'))\n\n    back_property = vtkProperty()\n    back_property.SetColor(colors.GetColor3d('MediumSeaGreen'))\n\n    # Create and link the mappers actors and renderers together.\n    for i in range(0, len(u_grids)):\n        print('Creating:', titles[i])\n        text_mappers.append(vtkTextMapper())\n        text_actors.append(vtkActor2D())\n\n        mappers.append(vtkDataSetMapper())\n        actors.append(vtkActor())\n        renderers.append(vtkRenderer())\n        mappers[i].SetInputData(u_grids[i])\n        actors[i].SetMapper(mappers[i])\n        if wireframe_on:\n            actors[i].GetProperty().SetRepresentationToWireframe()\n            actors[i].GetProperty().SetLineWidth(2)\n            actors[i].GetProperty().SetOpacity(1)\n            actors[i].GetProperty().SetColor(colors.GetColor3d('Black'))\n        else:\n            actors[i].GetProperty().EdgeVisibilityOn()\n            actors[i].GetProperty().SetLineWidth(3)\n            actors[i].GetProperty().SetColor(colors.GetColor3d('Tomato'))\n            if backface_on:\n                actors[i].SetBackfaceProperty(back_property)\n                actors[i].GetProperty().SetOpacity(1)\n            else:\n                actors[i].GetProperty().SetOpacity(0.5)\n        renderers[i].AddViewProp(actors[i])\n\n        text_mappers[i].SetInput(titles[i])\n        text_actors[i].SetMapper(text_mappers[i])\n        text_actors[i].SetPosition(50, 10)\n        if wireframe_on:\n            text_actors[i].GetProperty().SetColor(colors.GetColor3d('Black'))\n        renderers[i].AddViewProp(text_actors[i])\n\n        # Label the points\n        label_mapper = vtkLabeledDataMapper()\n        label_mapper.SetInputData(u_grids[i])\n        label_actor = vtkActor2D()\n        label_actor.SetMapper(label_mapper)\n        if wireframe_on:\n            label_actor.GetProperty().SetColor(colors.GetColor3d('Snow'))\n        renderers[i].AddViewProp(label_actor)\n\n        # Glyph the points\n        point_mapper = vtkGlyph3DMapper()\n        point_mapper.SetInputData(u_grids[i])\n        point_mapper.SetSourceConnection(sphere.GetOutputPort())\n        point_mapper.ScalingOn()\n        point_mapper.ScalarVisibilityOff()\n\n        point_actor = vtkActor()\n        point_actor.SetMapper(point_mapper)\n        if wireframe_on:\n            point_actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n        else:\n            point_actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n        point_actor.GetProperty().SetSpecular(.6)\n        point_actor.GetProperty().SetSpecularColor(1.0, 1.0, 1.0)\n        point_actor.GetProperty().SetSpecularPower(100)\n        renderers[i].AddViewProp(point_actor)\n\n        ren_win.AddRenderer(renderers[i])\n\n    # Set up the viewports\n    grid_dimensions_x = 4\n    grid_dimensions_y = 4\n    renderer_size = 300\n    ren_win.SetSize(renderer_size * grid_dimensions_x, renderer_size * grid_dimensions_y)\n    for row in range(0, grid_dimensions_y):\n        for col in range(0, grid_dimensions_x):\n            index = row * grid_dimensions_x + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / grid_dimensions_x,\n                        float(grid_dimensions_y - (row + 1)) / grid_dimensions_y,\n                        float(col + 1) / grid_dimensions_x,\n                        float(grid_dimensions_y - row) / grid_dimensions_y]\n\n            if index > (len(actors) - 1):\n                # Add a renderer even if there is no actor.\n                # This makes the render window background all the same color.\n                ren = vtkRenderer()\n                if wireframe_on:\n                    ren.SetBackground(colors.GetColor3d('LightSlateGray'))\n                else:\n                    ren.SetBackground(colors.GetColor3d('SlateGray'))\n                ren.SetViewport(viewport)\n                ren_win.AddRenderer(ren)\n                continue\n\n            if wireframe_on:\n                renderers[index].SetBackground(colors.GetColor3d('LightSlateGray'))\n            else:\n                renderers[index].SetBackground(colors.GetColor3d('SlateGray'))\n            renderers[index].SetViewport(viewport)\n            renderers[index].ResetCamera()\n            if index == 0:\n                renderers[index].GetActiveCamera().Dolly(0.1)\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 1:\n                renderers[index].GetActiveCamera().Dolly(0.8)\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 2:\n                renderers[index].GetActiveCamera().Dolly(0.4)\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 4:\n                renderers[index].GetActiveCamera().Dolly(0.7)\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 5:\n                renderers[index].GetActiveCamera().Dolly(1.1)\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 6:\n                renderers[index].GetActiveCamera().Azimuth(0)\n                renderers[index].GetActiveCamera().Elevation(-45)\n            elif index == 7:\n                renderers[index].GetActiveCamera().Azimuth(0)\n                renderers[index].GetActiveCamera().Elevation(-45)\n            elif index == 8:\n                renderers[index].GetActiveCamera().Azimuth(0)\n                renderers[index].GetActiveCamera().Elevation(-45)\n            elif index == 9:\n                renderers[index].GetActiveCamera().Azimuth(0)\n                renderers[index].GetActiveCamera().Elevation(-22.5)\n            elif index == 10:\n                renderers[index].GetActiveCamera().Azimuth(-22.5)\n                renderers[index].GetActiveCamera().Elevation(15)\n            elif index == 11:\n                renderers[index].GetActiveCamera().Azimuth(-22.5)\n                renderers[index].GetActiveCamera().Elevation(15)\n            elif index == 12:\n                renderers[index].GetActiveCamera().Azimuth(-45)\n                renderers[index].GetActiveCamera().Elevation(15)\n            elif index == 13:\n                renderers[index].GetActiveCamera().Azimuth(0)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            elif index == 14:\n                renderers[index].GetActiveCamera().Azimuth(-22.5)\n                renderers[index].GetActiveCamera().Elevation(10)\n            elif index == 15:\n                renderers[index].GetActiveCamera().Azimuth(-30)\n                renderers[index].GetActiveCamera().Elevation(15)\n            else:\n                renderers[index].GetActiveCamera().Azimuth(30)\n                renderers[index].GetActiveCamera().Elevation(-30)\n            renderers[index].ResetCameraClippingRange()\n\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\n# These functions return a vtkUnstructured grid corresponding to the object.\n\ndef make_vertex():\n    # A vertex is a cell that represents a 3D point\n    number_of_vertices = 1\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n\n    vertex = vtkVertex()\n    for i in range(0, number_of_vertices):\n        vertex.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(vertex.GetCellType(), vertex.GetPointIds())\n\n    return ug\n\n\ndef make_poly_vertex():\n    # A polyvertex is a cell represents a set of 0D vertices\n    number_of_vertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, 0.4)\n    points.InsertNextPoint(0, 1, 0.6)\n\n    poly_vertex = vtkPolyVertex()\n    poly_vertex.GetPointIds().SetNumberOfIds(number_of_vertices)\n\n    for i in range(0, number_of_vertices):\n        poly_vertex.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(poly_vertex.GetCellType(), poly_vertex.GetPointIds())\n\n    return ug\n\n\ndef make_line():\n    # A line is a cell that represents a 1D point\n    number_of_vertices = 2\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0.5, 0.5, 0)\n\n    line = vtkLine()\n    for i in range(0, number_of_vertices):\n        line.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(line.GetCellType(), line.GetPointIds())\n\n    return ug\n\n\ndef make_polyline():\n    # A polyline is a cell that represents a set of 1D lines\n    number_of_vertices = 5\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0.5, 0)\n    points.InsertNextPoint(0.5, 0, 0)\n    points.InsertNextPoint(1, 0.3, 0)\n    points.InsertNextPoint(1.5, 0.4, 0)\n    points.InsertNextPoint(2.0, 0.4, 0)\n\n    polyline = vtkPolyLine()\n    polyline.GetPointIds().SetNumberOfIds(number_of_vertices)\n\n    for i in range(0, number_of_vertices):\n        polyline.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polyline.GetCellType(), polyline.GetPointIds())\n\n    return ug\n\n\ndef make_triangle():\n    # A triangle is a cell that represents a 1D point\n    number_of_vertices = 3\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0.5, 0.5, 0)\n    points.InsertNextPoint(.2, 1, 0)\n\n    triangle = vtkTriangle()\n    for i in range(0, number_of_vertices):\n        triangle.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(triangle.GetCellType(), triangle.GetPointIds())\n\n    return ug\n\n\ndef make_triangle_strip():\n    # A triangle is a cell that represents a triangle strip\n    number_of_vertices = 10\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, -.1, 0)\n    points.InsertNextPoint(0.5, 1, 0)\n    points.InsertNextPoint(2.0, -0.1, 0)\n    points.InsertNextPoint(1.5, 0.8, 0)\n    points.InsertNextPoint(3.0, 0, 0)\n    points.InsertNextPoint(2.5, 0.9, 0)\n    points.InsertNextPoint(4.0, -0.2, 0)\n    points.InsertNextPoint(3.5, 0.8, 0)\n    points.InsertNextPoint(4.5, 1.1, 0)\n\n    trianglestrip = vtkTriangleStrip()\n    trianglestrip.GetPointIds().SetNumberOfIds(number_of_vertices)\n    for i in range(0, number_of_vertices):\n        trianglestrip.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(trianglestrip.GetCellType(), trianglestrip.GetPointIds())\n\n    return ug\n\n\ndef make_polygon():\n    # A polygon is a cell that represents a polygon\n    number_of_vertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, -0.1, 0)\n    points.InsertNextPoint(0.8, 0.5, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0.6, 1.2, 0)\n    points.InsertNextPoint(0, 0.8, 0)\n\n    polygon = vtkPolygon()\n    polygon.GetPointIds().SetNumberOfIds(number_of_vertices)\n    for i in range(0, number_of_vertices):\n        polygon.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polygon.GetCellType(), polygon.GetPointIds())\n\n    return ug\n\n\ndef make_pixel():\n    # A pixel is a cell that represents a pixel\n    pixel = vtkPixel()\n    pixel.GetPoints().SetPoint(0, 0, 0, 0)\n    pixel.GetPoints().SetPoint(1, 1, 0, 0)\n    pixel.GetPoints().SetPoint(2, 0, 1, 0)\n    pixel.GetPoints().SetPoint(3, 1, 1, 0)\n\n    pixel.GetPointIds().SetId(0, 0)\n    pixel.GetPointIds().SetId(1, 1)\n    pixel.GetPointIds().SetId(2, 2)\n    pixel.GetPointIds().SetId(3, 3)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(pixel.GetPoints())\n    ug.InsertNextCell(pixel.GetCellType(), pixel.GetPointIds())\n\n    return ug\n\n\ndef make_quad():\n    # A quad is a cell that represents a quad\n    quad = vtkQuad()\n    quad.GetPoints().SetPoint(0, 0, 0, 0)\n    quad.GetPoints().SetPoint(1, 1, 0, 0)\n    quad.GetPoints().SetPoint(2, 1, 1, 0)\n    quad.GetPoints().SetPoint(3, 0, 1, 0)\n\n    quad.GetPointIds().SetId(0, 0)\n    quad.GetPointIds().SetId(1, 1)\n    quad.GetPointIds().SetId(2, 2)\n    quad.GetPointIds().SetId(3, 3)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(quad.GetPoints())\n    ug.InsertNextCell(quad.GetCellType(), quad.GetPointIds())\n\n    return ug\n\n\ndef make_tetra():\n    # Make a tetrahedron.\n    number_of_vertices = 4\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 1, 1)\n\n    tetra = vtkTetra()\n    for i in range(0, number_of_vertices):\n        tetra.GetPointIds().SetId(i, i)\n\n    cell_array = vtkCellArray()\n    cell_array.InsertNextCell(tetra)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.SetCells(VTK_TETRA, cell_array)\n\n    return ug\n\n\ndef make_voxel():\n    # A voxel is a representation of a regular grid in 3-D space.\n    number_of_vertices = 8\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, 1)\n    points.InsertNextPoint(0, 1, 1)\n    points.InsertNextPoint(1, 1, 1)\n\n    voxel = vtkVoxel()\n    for i in range(0, number_of_vertices):\n        voxel.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(voxel.GetCellType(), voxel.GetPointIds())\n\n    return ug\n\n\ndef make_hexahedron():\n    # A regular hexagon (cube) with all faces square and three squares around\n    # each vertex is created below.\n\n    # Set up the coordinates of eight points\n    # (the two faces must be in counter-clockwise\n    # order as viewed from the outside).\n\n    number_of_vertices = 8\n\n    # Create the points\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, 1)\n    points.InsertNextPoint(1, 1, 1)\n    points.InsertNextPoint(0, 1, 1)\n\n    # Create a hexahedron from the points\n    hexhedr = vtkHexahedron()\n    for i in range(0, number_of_vertices):\n        hexhedr.GetPointIds().SetId(i, i)\n\n    # Add the points and hexahedron to an unstructured grid\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(hexhedr.GetCellType(), hexhedr.GetPointIds())\n\n    return ug\n\n\ndef make_wedge():\n    # A wedge consists of two triangular ends and three rectangular faces.\n\n    number_of_vertices = 6\n\n    points = vtkPoints()\n\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0, 0.5, 0.5)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(1, 0.0, 0.0)\n    points.InsertNextPoint(1, 0.5, 0.5)\n\n    wedge = vtkWedge()\n    for i in range(0, number_of_vertices):\n        wedge.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(wedge.GetCellType(), wedge.GetPointIds())\n\n    return ug\n\n\ndef make_pyramid():\n    # Make a regular square pyramid.\n    number_of_vertices = 5\n\n    points = vtkPoints()\n\n    p0 = [1.0, 1.0, 0.0]\n    p1 = [-1.0, 1.0, 0.0]\n    p2 = [-1.0, -1.0, 0.0]\n    p3 = [1.0, -1.0, 0.0]\n    p4 = [0.0, 0.0, 1.0]\n\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n    points.InsertNextPoint(p4)\n\n    pyramid = vtkPyramid()\n    for i in range(0, number_of_vertices):\n        pyramid.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(pyramid.GetCellType(), pyramid.GetPointIds())\n\n    return ug\n\n\ndef make_pentagonal_prism():\n    pentagonal_prism = vtkPentagonalPrism()\n\n    pentagonal_prism.GetPointIds().SetId(0, 0)\n    pentagonal_prism.GetPointIds().SetId(1, 1)\n    pentagonal_prism.GetPointIds().SetId(2, 2)\n    pentagonal_prism.GetPointIds().SetId(3, 3)\n    pentagonal_prism.GetPointIds().SetId(4, 4)\n    pentagonal_prism.GetPointIds().SetId(5, 5)\n    pentagonal_prism.GetPointIds().SetId(6, 6)\n    pentagonal_prism.GetPointIds().SetId(7, 7)\n    pentagonal_prism.GetPointIds().SetId(8, 8)\n    pentagonal_prism.GetPointIds().SetId(9, 9)\n\n    scale = 2.0\n    pentagonal_prism.GetPoints().SetPoint(0, 11 / scale, 10 / scale, 10 / scale)\n    pentagonal_prism.GetPoints().SetPoint(1, 13 / scale, 10 / scale, 10 / scale)\n    pentagonal_prism.GetPoints().SetPoint(2, 14 / scale, 12 / scale, 10 / scale)\n    pentagonal_prism.GetPoints().SetPoint(3, 12 / scale, 14 / scale, 10 / scale)\n    pentagonal_prism.GetPoints().SetPoint(4, 10 / scale, 12 / scale, 10 / scale)\n    pentagonal_prism.GetPoints().SetPoint(5, 11 / scale, 10 / scale, 14 / scale)\n    pentagonal_prism.GetPoints().SetPoint(6, 13 / scale, 10 / scale, 14 / scale)\n    pentagonal_prism.GetPoints().SetPoint(7, 14 / scale, 12 / scale, 14 / scale)\n    pentagonal_prism.GetPoints().SetPoint(8, 12 / scale, 14 / scale, 14 / scale)\n    pentagonal_prism.GetPoints().SetPoint(9, 10 / scale, 12 / scale, 14 / scale)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(pentagonal_prism.GetPoints())\n    ug.InsertNextCell(pentagonal_prism.GetCellType(), pentagonal_prism.GetPointIds())\n\n    return ug\n\n\ndef make_hexagonal_prism():\n    hexagonal_prism = vtkHexagonalPrism()\n    hexagonal_prism.GetPointIds().SetId(0, 0)\n    hexagonal_prism.GetPointIds().SetId(1, 1)\n    hexagonal_prism.GetPointIds().SetId(2, 2)\n    hexagonal_prism.GetPointIds().SetId(3, 3)\n    hexagonal_prism.GetPointIds().SetId(4, 4)\n    hexagonal_prism.GetPointIds().SetId(5, 5)\n    hexagonal_prism.GetPointIds().SetId(6, 6)\n    hexagonal_prism.GetPointIds().SetId(7, 7)\n    hexagonal_prism.GetPointIds().SetId(8, 8)\n    hexagonal_prism.GetPointIds().SetId(9, 9)\n    hexagonal_prism.GetPointIds().SetId(10, 10)\n    hexagonal_prism.GetPointIds().SetId(11, 11)\n\n    scale = 2.0\n    hexagonal_prism.GetPoints().SetPoint(0, 11 / scale, 10 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(1, 13 / scale, 10 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(2, 14 / scale, 12 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(3, 13 / scale, 14 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(4, 11 / scale, 14 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(5, 10 / scale, 12 / scale, 10 / scale)\n    hexagonal_prism.GetPoints().SetPoint(6, 11 / scale, 10 / scale, 14 / scale)\n    hexagonal_prism.GetPoints().SetPoint(7, 13 / scale, 10 / scale, 14 / scale)\n    hexagonal_prism.GetPoints().SetPoint(8, 14 / scale, 12 / scale, 14 / scale)\n    hexagonal_prism.GetPoints().SetPoint(9, 13 / scale, 14 / scale, 14 / scale)\n    hexagonal_prism.GetPoints().SetPoint(10, 11 / scale, 14 / scale, 14 / scale)\n    hexagonal_prism.GetPoints().SetPoint(11, 10 / scale, 12 / scale, 14 / scale)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(hexagonal_prism.GetPoints())\n    ug.InsertNextCell(hexagonal_prism.GetCellType(), hexagonal_prism.GetPointIds())\n\n    return ug\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/LongLine/","title":"LongLine","text":"

        vtk-examples/Python/GeometricObjects/LongLine

        "},{"location":"Python/GeometricObjects/LongLine/#description","title":"Description","text":"

        Connect several points with a line.

        Seealso

        ColoredLines.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/LongLine/#code","title":"Code","text":"

        LongLine.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Create five points.\n    origin = [0.0, 0.0, 0.0]\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [0.0, 1.0, 0.0]\n    p2 = [0.0, 1.0, 2.0]\n    p3 = [1.0, 2.0, 3.0]\n\n    # Create a vtkPoints object and store the points in it\n    points = vtkPoints()\n    points.InsertNextPoint(origin)\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n\n    # Create a cell array to store the lines in and add the lines to it\n    lines = vtkCellArray()\n\n    for i in range(0, 3):\n        line = vtkLine()\n        line.GetPointIds().SetId(0, i)\n        line.GetPointIds().SetId(1, i + 1)\n        lines.InsertNextCell(line)\n\n    # Create a polydata to store everything in\n    linesPolyData = vtkPolyData()\n\n    # Add the points to the dataset\n    linesPolyData.SetPoints(points)\n\n    # Add the lines to the dataset\n    linesPolyData.SetLines(lines)\n\n    # Setup actor and mapper\n    colors = vtkNamedColors()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(linesPolyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetLineWidth(4)\n    actor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n\n    # Setup render window, renderer, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('LongLine')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderer.AddActor(actor)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/OrientedArrow/","title":"OrientedArrow","text":"

        vtk-examples/Python/GeometricObjects/OrientedArrow

        "},{"location":"Python/GeometricObjects/OrientedArrow/#description","title":"Description","text":"

        This example illustrates how to create and display an arrow that passes through two points.

        It demonstrates two different ways to apply the transform:

        1. Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter.

        2. Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

        Switch between the two methods by #defining USER_MATRIX or leaving out the #define.

        Seealso

        Compare this example with OrientedCylinder. The transform is different because the cylinder

        height direction is along the y-axis and the arrow height is along the x axis.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/OrientedArrow/#code","title":"Code","text":"

        OrientedArrow.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMath,\n    vtkMinimalStandardRandomSequence\n)\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\"\"\"\nThere are two alternative ways to apply the transform.\n 1) Use vtkTransformPolyDataFilter to create a new transformed polydata.\n    This method is useful if the transformed polydata is needed\n      later in the pipeline\n    To do this, set USER_MATRIX = True\n 2) Apply the transform directly to the actor using vtkProp3D's SetUserMatrix.\n    No new data is produced.\n    To do this, set USER_MATRIX = False\n\"\"\"\nUSER_MATRIX = True\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 77, 255])\n\n    # Create an arrow.\n    arrowSource = vtkArrowSource()\n\n    # Generate a random start and end point\n    startPoint = [0] * 3\n    endPoint = [0] * 3\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(8775070)  # For testing.\n    for i in range(0, 3):\n        rng.Next()\n        startPoint[i] = rng.GetRangeValue(-10, 10)\n        rng.Next()\n        endPoint[i] = rng.GetRangeValue(-10, 10)\n\n    # Compute a basis\n    normalizedX = [0] * 3\n    normalizedY = [0] * 3\n    normalizedZ = [0] * 3\n\n    # The X axis is a vector from start to end\n    vtkMath.Subtract(endPoint, startPoint, normalizedX)\n    length = vtkMath.Norm(normalizedX)\n    vtkMath.Normalize(normalizedX)\n\n    # The Z axis is an arbitrary vector cross X\n    arbitrary = [0] * 3\n    for i in range(0, 3):\n        rng.Next()\n        arbitrary[i] = rng.GetRangeValue(-10, 10)\n    vtkMath.Cross(normalizedX, arbitrary, normalizedZ)\n    vtkMath.Normalize(normalizedZ)\n\n    # The Y axis is Z cross X\n    vtkMath.Cross(normalizedZ, normalizedX, normalizedY)\n    matrix = vtkMatrix4x4()\n\n    # Create the direction cosine matrix\n    matrix.Identity()\n    for i in range(0, 3):\n        matrix.SetElement(i, 0, normalizedX[i])\n        matrix.SetElement(i, 1, normalizedY[i])\n        matrix.SetElement(i, 2, normalizedZ[i])\n\n    # Apply the transforms\n    transform = vtkTransform()\n    transform.Translate(startPoint)\n    transform.Concatenate(matrix)\n    transform.Scale(length, length, length)\n\n    # Transform the polydata\n    transformPD = vtkTransformPolyDataFilter()\n    transformPD.SetTransform(transform)\n    transformPD.SetInputConnection(arrowSource.GetOutputPort())\n\n    # Create a mapper and actor for the arrow\n    mapper = vtkPolyDataMapper()\n    actor = vtkActor()\n    if USER_MATRIX:\n        mapper.SetInputConnection(arrowSource.GetOutputPort())\n        actor.SetUserMatrix(transform.GetMatrix())\n    else:\n        mapper.SetInputConnection(transformPD.GetOutputPort())\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Cyan'))\n\n    # Create spheres for start and end point\n    sphereStartSource = vtkSphereSource()\n    sphereStartSource.SetCenter(startPoint)\n    sphereStartSource.SetRadius(0.8)\n    sphereStartMapper = vtkPolyDataMapper()\n    sphereStartMapper.SetInputConnection(sphereStartSource.GetOutputPort())\n    sphereStart = vtkActor()\n    sphereStart.SetMapper(sphereStartMapper)\n    sphereStart.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n\n    sphereEndSource = vtkSphereSource()\n    sphereEndSource.SetCenter(endPoint)\n    sphereEndSource.SetRadius(0.8)\n    sphereEndMapper = vtkPolyDataMapper()\n    sphereEndMapper.SetInputConnection(sphereEndSource.GetOutputPort())\n    sphereEnd = vtkActor()\n    sphereEnd.SetMapper(sphereEndMapper)\n    sphereEnd.GetProperty().SetColor(colors.GetColor3d('Magenta'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('OrientedArrow')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor(sphereStart)\n    renderer.AddActor(sphereEnd)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/OrientedCylinder/","title":"OrientedCylinder","text":"

        vtk-examples/Python/GeometricObjects/OrientedCylinder

        "},{"location":"Python/GeometricObjects/OrientedCylinder/#description","title":"Description","text":"

        This example illustrates how to create and display a cylinder that passes through two points.

        It demonstrates two different ways to apply the transform:

        1. Use vtkTransformPolyDataFilter to create a new transformed polydata. This method is useful if the transformed polydata is needed later in the pipeline, e.g. vtkGlyph3DFilter.

        2. Apply the transform directly to the actor using vtkProp3D's SetUserMatrix. No new data is produced.

        Switch between the two methods by setting USER_MATRIX to True or False.

        Seealso

        Compare this example with OrientedArrow. The transform is different because the cylinder height

        direction is along the y-axis and the arrow height is along the x axis.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/OrientedCylinder/#code","title":"Code","text":"

        OrientedCylinder.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMath,\n    vtkMinimalStandardRandomSequence\n)\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCylinderSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\"\"\"\nThere are two alternative ways to apply the transform.\n 1) Use vtkTransformPolyDataFilter to create a new transformed polydata.\n    This method is useful if the transformed polydata is needed\n      later in the pipeline\n    To do this, set USER_MATRIX = True\n 2) Apply the transform directly to the actor using vtkProp3D's SetUserMatrix.\n    No new data is produced.\n    To do this, set USER_MATRIX = False\n\"\"\"\nUSER_MATRIX = True\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 77, 255])\n\n    # Create a cylinder.\n    # Cylinder height vector is (0,1,0).\n    # Cylinder center is in the middle of the cylinder\n    cylinderSource = vtkCylinderSource()\n    cylinderSource.SetResolution(15)\n\n    # Generate a random start and end point\n    startPoint = [0] * 3\n    endPoint = [0] * 3\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(8775070)  # For testing.\n    for i in range(0, 3):\n        rng.Next()\n        startPoint[i] = rng.GetRangeValue(-10, 10)\n        rng.Next()\n        endPoint[i] = rng.GetRangeValue(-10, 10)\n\n    # Compute a basis\n    normalizedX = [0] * 3\n    normalizedY = [0] * 3\n    normalizedZ = [0] * 3\n\n    # The X axis is a vector from start to end\n    vtkMath.Subtract(endPoint, startPoint, normalizedX)\n    length = vtkMath.Norm(normalizedX)\n    vtkMath.Normalize(normalizedX)\n\n    # The Z axis is an arbitrary vector cross X\n    arbitrary = [0] * 3\n    for i in range(0, 3):\n        rng.Next()\n        arbitrary[i] = rng.GetRangeValue(-10, 10)\n    vtkMath.Cross(normalizedX, arbitrary, normalizedZ)\n    vtkMath.Normalize(normalizedZ)\n\n    # The Y axis is Z cross X\n    vtkMath.Cross(normalizedZ, normalizedX, normalizedY)\n    matrix = vtkMatrix4x4()\n\n    # Create the direction cosine matrix\n    matrix.Identity()\n    for i in range(0, 3):\n        matrix.SetElement(i, 0, normalizedX[i])\n        matrix.SetElement(i, 1, normalizedY[i])\n        matrix.SetElement(i, 2, normalizedZ[i])\n\n    # Apply the transforms\n    transform = vtkTransform()\n    transform.Translate(startPoint)  # translate to starting point\n    transform.Concatenate(matrix)  # apply direction cosines\n    transform.RotateZ(-90.0)  # align cylinder to x axis\n    transform.Scale(1.0, length, 1.0)  # scale along the height vector\n    transform.Translate(0, .5, 0)  # translate to start of cylinder\n\n    # Transform the polydata\n    transformPD = vtkTransformPolyDataFilter()\n    transformPD.SetTransform(transform)\n    transformPD.SetInputConnection(cylinderSource.GetOutputPort())\n\n    # Create a mapper and actor for the arrow\n    mapper = vtkPolyDataMapper()\n    actor = vtkActor()\n    if USER_MATRIX:\n        mapper.SetInputConnection(cylinderSource.GetOutputPort())\n        actor.SetUserMatrix(transform.GetMatrix())\n    else:\n        mapper.SetInputConnection(transformPD.GetOutputPort())\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Cyan'))\n\n    # Create spheres for start and end point\n    sphereStartSource = vtkSphereSource()\n    sphereStartSource.SetCenter(startPoint)\n    sphereStartSource.SetRadius(0.8)\n    sphereStartMapper = vtkPolyDataMapper()\n    sphereStartMapper.SetInputConnection(sphereStartSource.GetOutputPort())\n    sphereStart = vtkActor()\n    sphereStart.SetMapper(sphereStartMapper)\n    sphereStart.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n\n    sphereEndSource = vtkSphereSource()\n    sphereEndSource.SetCenter(endPoint)\n    sphereEndSource.SetRadius(0.8)\n    sphereEndMapper = vtkPolyDataMapper()\n    sphereEndMapper.SetInputConnection(sphereEndSource.GetOutputPort())\n    sphereEnd = vtkActor()\n    sphereEnd.SetMapper(sphereEndMapper)\n    sphereEnd.GetProperty().SetColor(colors.GetColor3d('Magenta'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('Oriented Cylinder')\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor(sphereStart)\n    renderer.AddActor(sphereEnd)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/ParametricKuenDemo/","title":"ParametricKuenDemo","text":"

        vtk-examples/Python/GeometricObjects/ParametricKuenDemo

        "},{"location":"Python/GeometricObjects/ParametricKuenDemo/#description","title":"Description","text":"

        The example shows interaction with the vtkParametricKuen vtkParametricFunctionSource. The Kuen Surface This surface of constant Gaussian curvature K = -1 was discovered early. It is very popular because of its beauty.

        Here's the embedded video:

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/ParametricKuenDemo/#code","title":"Code","text":"

        ParametricKuenDemo.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import vtkParametricKuen\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkMath\n)\nfrom vtkmodules.vtkFiltersSources import vtkParametricFunctionSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    surface = vtkParametricKuen()\n    source = vtkParametricFunctionSource()\n\n    renderer = vtkRenderer()\n    mapper = vtkPolyDataMapper()\n    actor = vtkActor()\n\n    backProperty = vtkProperty()\n    backProperty.SetColor(colors.GetColor3d('Tomato'))\n\n    # Create a parametric function source, renderer, mapper, and actor\n    source.SetParametricFunction(surface)\n\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor.SetMapper(mapper)\n    actor.SetBackfaceProperty(backProperty)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n    actor.GetProperty().SetSpecular(.5)\n    actor.GetProperty().SetSpecularPower(20)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('ParametricKuenDemo')\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Setup a slider widget for each varying parameter\n    tubeWidth = 0.008\n    sliderLength = 0.008\n    titleHeight = 0.02\n    labelHeight = 0.02\n\n    sliderRepMinimumU = vtkSliderRepresentation2D()\n\n    sliderRepMinimumU.SetMinimumValue(-4.5)\n    sliderRepMinimumU.SetMaximumValue(4.5)\n    sliderRepMinimumU.SetValue(-4.5)\n    sliderRepMinimumU.SetTitleText('U min')\n\n    sliderRepMinimumU.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumU.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepMinimumU.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumU.GetPoint2Coordinate().SetValue(.9, .1)\n\n    sliderRepMinimumU.SetTubeWidth(tubeWidth)\n    sliderRepMinimumU.SetSliderLength(sliderLength)\n    sliderRepMinimumU.SetTitleHeight(titleHeight)\n    sliderRepMinimumU.SetLabelHeight(labelHeight)\n\n    sliderWidgetMinimumU = vtkSliderWidget()\n    sliderWidgetMinimumU.SetInteractor(interactor)\n    sliderWidgetMinimumU.SetRepresentation(sliderRepMinimumU)\n    sliderWidgetMinimumU.SetAnimationModeToAnimate()\n    sliderWidgetMinimumU.EnabledOn()\n\n    sliderWidgetMinimumU.AddObserver('InteractionEvent', SliderCallbackMinimumU(surface))\n\n    sliderRepMaximumU = vtkSliderRepresentation2D()\n\n    sliderRepMaximumU.SetMinimumValue(-4.5)\n    sliderRepMaximumU.SetMaximumValue(4.5)\n    sliderRepMaximumU.SetValue(4.5)\n    sliderRepMaximumU.SetTitleText('U max')\n\n    sliderRepMaximumU.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMaximumU.GetPoint1Coordinate().SetValue(.1, .9)\n    sliderRepMaximumU.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMaximumU.GetPoint2Coordinate().SetValue(.9, .9)\n\n    sliderRepMaximumU.SetTubeWidth(tubeWidth)\n    sliderRepMaximumU.SetSliderLength(sliderLength)\n    sliderRepMaximumU.SetTitleHeight(titleHeight)\n    sliderRepMaximumU.SetLabelHeight(labelHeight)\n\n    sliderWidgetMaximumU = vtkSliderWidget()\n    sliderWidgetMaximumU.SetInteractor(interactor)\n    sliderWidgetMaximumU.SetRepresentation(sliderRepMaximumU)\n    sliderWidgetMaximumU.SetAnimationModeToAnimate()\n    sliderWidgetMaximumU.EnabledOn()\n\n    sliderWidgetMaximumU.AddObserver('InteractionEvent', SliderCallbackMaximumU(surface))\n\n    sliderRepMinimumV = vtkSliderRepresentation2D()\n\n    sliderRepMinimumV.SetMinimumValue(0.05)\n    sliderRepMinimumV.SetMaximumValue(vtkMath.Pi())\n    sliderRepMinimumV.SetValue(0.0)\n    sliderRepMinimumV.SetTitleText('V min')\n\n    sliderRepMinimumV.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepMinimumV.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint2Coordinate().SetValue(.1, .9)\n\n    sliderRepMinimumV.SetTubeWidth(tubeWidth)\n    sliderRepMinimumV.SetSliderLength(sliderLength)\n    sliderRepMinimumV.SetTitleHeight(titleHeight)\n    sliderRepMinimumV.SetLabelHeight(labelHeight)\n\n    sliderWidgetMinimumV = vtkSliderWidget()\n    sliderWidgetMinimumV.SetInteractor(interactor)\n    sliderWidgetMinimumV.SetRepresentation(sliderRepMinimumV)\n    sliderWidgetMinimumV.SetAnimationModeToAnimate()\n    sliderWidgetMinimumV.EnabledOn()\n\n    sliderWidgetMinimumV.AddObserver(vtkCommand.InteractionEvent, SliderCallbackMinimumV(surface))\n\n    sliderRepMaximumV = vtkSliderRepresentation2D()\n\n    sliderRepMaximumV.SetMinimumValue(0.05)\n    sliderRepMaximumV.SetMaximumValue(vtkMath.Pi() - .05)\n    sliderRepMaximumV.SetValue(vtkMath.Pi())\n    sliderRepMaximumV.SetTitleText('V max')\n\n    sliderRepMaximumV.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMaximumV.GetPoint1Coordinate().SetValue(.9, .1)\n    sliderRepMaximumV.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMaximumV.GetPoint2Coordinate().SetValue(.9, .9)\n    sliderRepMaximumV.SetTubeWidth(tubeWidth)\n    sliderRepMaximumV.SetSliderLength(sliderLength)\n    sliderRepMaximumV.SetTitleHeight(titleHeight)\n    sliderRepMaximumV.SetLabelHeight(labelHeight)\n\n    sliderWidgetMaximumV = vtkSliderWidget()\n    sliderWidgetMaximumV.SetInteractor(interactor)\n    sliderWidgetMaximumV.SetRepresentation(sliderRepMaximumV)\n    sliderWidgetMaximumV.SetAnimationModeToAnimate()\n    sliderWidgetMaximumV.EnabledOn()\n\n    sliderWidgetMaximumV.AddObserver(vtkCommand.InteractionEvent, SliderCallbackMaximumV(surface))\n\n    surface.SetMinimumU(-4.5)\n    surface.SetMaximumU(4.5)\n    surface.SetMinimumV(0.05)\n    surface.SetMaximumV(vtkMath.Pi() - .05)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n    renderWindow.Render()\n\n    interactor.Initialize()\n\n    interactor.Start()\n\n\n# These callbacks do the actual work.\n# Callbacks for the interactions\nclass SliderCallbackMinimumU():\n    def __init__(self, kuen):\n        self.kuen = kuen\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        if value > 0.9 * self.kuen.GetMaximumU():\n            value = 0.99 * self.kuen.GetMaximumU()\n            sliderWidget.GetRepresentation().SetValue(value)\n        self.kuen.SetMinimumU(value)\n\n\nclass SliderCallbackMaximumU():\n    def __init__(self, kuen):\n        self.kuen = kuen\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        if value < self.kuen.GetMinimumU() + .01:\n            value = self.kuen.GetMinimumU() + .01\n            sliderWidget.GetRepresentation().SetValue(value)\n        self.kuen.SetMaximumU(value)\n\n\nclass SliderCallbackMinimumV():\n    def __init__(self, kuen):\n        self.kuen = kuen\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        if value > 0.9 * self.kuen.GetMaximumV():\n            value = 0.99 * self.kuen.GetMaximumV()\n            sliderWidget.GetRepresentation().SetValue(value)\n        self.kuen.SetMinimumV(value)\n\n\nclass SliderCallbackMaximumV():\n    def __init__(self, kuen):\n        self.kuen = kuen\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        if value < self.kuen.GetMinimumV() + .01:\n            value = self.kuen.GetMinimumV() + .01\n            sliderWidget.GetRepresentation().SetValue(value)\n        self.kuen.SetMaximumV(value)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/ParametricObjectsDemo/","title":"ParametricObjectsDemo","text":"

        vtk-examples/Python/GeometricObjects/ParametricObjectsDemo

        "},{"location":"Python/GeometricObjects/ParametricObjectsDemo/#description","title":"Description","text":"

        Demonstrates the Parametric classes added by Andrew Maclean and additional classes added by Tim Meehan. The parametric spline is also included.

        Options are provided to:

        • Specify a single surface (-s SURFACE_NAME)
        • Color the back-face (-b)
        • Add normals (-n)
        • Display the geometric bounds of the object (-l)

        You can save a screenshot by pressing \"k\".

        With respect to your VTK build you may need to specify one or more of:

        -DVTK_MODULE_ENABLE_VTK_cli11=WANT\n-DVTK_MODULE_ENABLE_VTK_fmt=WANT\n

        If -DVTK_BUILD_TESTING=ON is specified when building VTK then VTK:cli11 and VTK::fmt will be automatically enabled.

        Note

        To really appreciate the complexity of some of these surfaces, select a single surface, and use the options -b -n. Also try specifying wireframe (toggle \"w\" on the keyboard) and zooming in and out.

        Tip

        If you color the back face, the three-dimensional orientable surfaces will only show backface coloring inside the surface e.g ConicSpiral or Torus. For three dimensional non-orientable surfaces; backface coloring is visible because of the twisting used to generate these surfaces e.g Boy or Figure8Klein.

        Cite

        See: Parametric Equations for Surfaces, for more information. This paper provides a description of fifteen surfaces, including their parametric equations and derivatives. Also provided is an example of how to create your own surface, namely the Figure-8 Torus.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/ParametricObjectsDemo/#code","title":"Code","text":"

        ParametricObjectsDemo.py

        #!/usr/bin/env python3\n\n\"\"\"\n    Demonstrate all the parametric objects.\n\"\"\"\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBohemianDome,\n    vtkParametricBour,\n    vtkParametricBoy,\n    vtkParametricCatalanMinimal,\n    vtkParametricConicSpiral,\n    vtkParametricCrossCap,\n    vtkParametricDini,\n    vtkParametricEllipsoid,\n    vtkParametricEnneper,\n    vtkParametricFigure8Klein,\n    vtkParametricHenneberg,\n    vtkParametricKlein,\n    vtkParametricKuen,\n    vtkParametricMobius,\n    vtkParametricPluckerConoid,\n    vtkParametricPseudosphere,\n    vtkParametricRandomHills,\n    vtkParametricRoman,\n    vtkParametricSpline,\n    vtkParametricSuperEllipsoid,\n    vtkParametricSuperToroid,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkGlyph3D,\n    vtkMaskPoints\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkParametricFunctionSource\n)\nfrom vtkmodules.vtkIOImage import (\n    vtkPNGWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty,\n    vtkWindowToImageFilter\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Display the parametric surfaces.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-s', '--surface_name', default=None, help='The name of the surface.')\n    parser.add_argument('-b', '--back_face', action='store_true', help='Color the back face.')\n    parser.add_argument('-n', '--normals', action='store_true', help='Display normals.')\n    parser.add_argument('-l', '--limits', action='store_true', help='Display the geometric bounds of the object..')\n    args = parser.parse_args()\n    return args.surface_name, args.back_face, args.normals, args.limits\n\n\ndef main():\n    surface_name, back_face, normals, limits = get_program_parameters()\n\n    # Get the parametric functions and build the pipeline\n    pfn = get_parametric_functions()\n\n    # Check for a single surface.\n    single_surface = [None, False]\n    if surface_name:\n        sn = surface_name.lower()\n        for t in pfn.keys():\n            if sn == t.lower():\n                single_surface[0] = t\n                single_surface[1] = True\n    if surface_name and not single_surface[1]:\n        print('Nonexistent surface:', surface_name)\n        return\n\n    if single_surface[1]:\n        renderer_size = 1000\n        grid_column_dimensions = 1\n        grid_row_dimensions = 1\n    else:\n        renderer_size = 200\n        grid_column_dimensions = 5\n        grid_row_dimensions = 5\n\n    colors = vtkNamedColors()\n\n    # Create one text property for all.\n    text_property = vtkTextProperty()\n    text_property.SetJustificationToCentered()\n    text_property.SetFontSize(int(renderer_size / 12))\n    text_property.SetColor(colors.GetColor3d(\"LavenderBlush\"))\n\n    # Create a parametric function source, renderer, mapper, and actor\n    # for each object.\n    pfn_srcs = []\n    renderers = []\n    mappers = []\n    actors = []\n    text_mappers = []\n    text_actors = []\n\n    # Glyph the normals.\n    mask_pts = []\n    arrow = []\n    glyph = []\n    glyph_mapper = []\n    glyph_actor = []\n\n    back_property = vtkProperty()\n    if back_face:\n        back_property.SetColor(colors.GetColor3d(\"Peru\"))\n\n    # Now decide on the surfaces to build.\n    surfaces = dict()\n    if single_surface[1]:\n        surfaces[single_surface[0]] = pfn[single_surface[0]]\n    else:\n        surfaces = pfn\n\n    # The bounding boxes for each object.\n    bounding_boxes = dict()\n    indexed_names = dict()\n    # The index of each parametric object.\n    obj_idx = -1\n    sorted_names = list()\n    for obj in sorted(surfaces.keys()):\n        obj_idx += 1\n        indexed_names[obj_idx] = obj\n        pfn_srcs.append(vtkParametricFunctionSource())\n        pfn_srcs[obj_idx].SetParametricFunction(surfaces[obj])\n        pfn_srcs[obj_idx].SetUResolution(51)\n        pfn_srcs[obj_idx].SetVResolution(51)\n        pfn_srcs[obj_idx].SetWResolution(51)\n        pfn_srcs[obj_idx].Update()\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[obj_idx].SetInputConnection(pfn_srcs[obj_idx].GetOutputPort())\n\n        actors.append(vtkActor())\n        actors[obj_idx].SetMapper(mappers[obj_idx])\n        actors[obj_idx].GetProperty().SetColor(colors.GetColor3d(\"NavajoWhite\"))\n        if back_face:\n            actors[obj_idx].SetBackfaceProperty(back_property)\n\n        text_mappers.append(vtkTextMapper())\n        text_mappers[obj_idx].SetInput(obj)\n        text_mappers[obj_idx].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[obj_idx].SetMapper(text_mappers[obj_idx])\n        text_actors[obj_idx].SetPosition(renderer_size / 2.0, 8)\n\n        renderers.append(vtkRenderer())\n        renderers[obj_idx].SetBackground(colors.GetColor3d(\"MidnightBlue\"))\n\n        bounds = pfn_srcs[obj_idx].GetOutput().GetBounds()\n        bounding_boxes[obj] = bounds\n\n        if normals:\n            # Glyphing\n            mask_pts.append(vtkMaskPoints())\n            mask_pts[obj_idx].RandomModeOn()\n            mask_pts[obj_idx].SetMaximumNumberOfPoints(150)\n            mask_pts[obj_idx].SetInputConnection(pfn_srcs[obj_idx].GetOutputPort())\n\n            arrow.append(vtkArrowSource())\n            arrow[obj_idx].SetTipResolution(16)\n            arrow[obj_idx].SetTipLength(0.3)\n            arrow[obj_idx].SetTipRadius(0.1)\n\n            glyph_scale = get_maximum_length(bounding_boxes[obj])\n\n            glyph.append(vtkGlyph3D())\n            glyph[obj_idx].SetSourceConnection(arrow[obj_idx].GetOutputPort())\n            glyph[obj_idx].SetInputConnection(mask_pts[obj_idx].GetOutputPort())\n            glyph[obj_idx].SetVectorModeToUseNormal()\n            glyph[obj_idx].SetScaleFactor(glyph_scale / 10.0)\n            glyph[obj_idx].OrientOn()\n            glyph[obj_idx].Update()\n\n            glyph_mapper.append(vtkPolyDataMapper())\n            glyph_mapper[obj_idx].SetInputConnection(\n                glyph[obj_idx].GetOutputPort())\n\n            glyph_actor.append(vtkActor())\n            glyph_actor[obj_idx].SetMapper(glyph_mapper[obj_idx])\n            glyph_actor[obj_idx].GetProperty().SetColor(colors.GetColor3d(\"GreenYellow\"))\n\n    # Need a renderer even if there is no actor.\n    for i in range(obj_idx + 1, grid_column_dimensions * grid_row_dimensions):\n        renderers.append(vtkRenderer())\n        renderers[i].SetBackground(colors.GetColor3d(\"MidnightBlue\"))\n        sorted_names.append(None)\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(renderer_size * grid_column_dimensions, renderer_size * grid_row_dimensions)\n\n    for row in range(0, grid_row_dimensions):\n        for col in range(0, grid_column_dimensions):\n            index = row * grid_column_dimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [\n                float(col) * renderer_size / (grid_column_dimensions * renderer_size),\n                float(grid_row_dimensions - (row + 1)) * renderer_size / (grid_row_dimensions * renderer_size),\n                float(col + 1) * renderer_size / (grid_column_dimensions * renderer_size),\n                float(grid_row_dimensions - row) * renderer_size / (grid_row_dimensions * renderer_size)]\n            ren_win.AddRenderer(renderers[index])\n            renderers[index].SetViewport(viewport)\n            if index > obj_idx:\n                continue\n            renderers[index].AddActor(actors[index])\n            # Normals can only be computed for polygons and triangle strips.\n            # The Spline is a line.\n            if normals and indexed_names[index] != 'Spline':\n                renderers[index].AddActor(glyph_actor[index])\n            renderers[index].AddActor(text_actors[index])\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(30)\n            renderers[index].GetActiveCamera().Elevation(-30)\n            renderers[index].GetActiveCamera().Zoom(0.9)\n            renderers[index].ResetCameraClippingRange()\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    if limits:\n        for k, v in bounding_boxes.items():\n            display_bounding_box_and_center(k, v)\n\n    if surface_name:\n        fn = single_surface[0]\n    else:\n        fn = 'ParametricObjectsDemo'\n    ren_win.SetWindowName(fn)\n\n    print_callback = PrintCallback(iren, fn, 1, False)\n    iren.AddObserver('KeyPressEvent', print_callback)\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_parametric_functions():\n    \"\"\"\n    Create a map of the parametric functions and set some parameters.\n    The first key groups the parametric functions and the\n      second key is the name of the function.\n\n    :return: The map of functions.\n    \"\"\"\n    pfn = dict()\n    pfn['Boy'] = vtkParametricBoy()\n    pfn['ConicSpiral'] = vtkParametricConicSpiral()\n    pfn['CrossCap'] = vtkParametricCrossCap()\n    pfn['Dini'] = vtkParametricDini()\n    pfn['Ellipsoid'] = vtkParametricEllipsoid()\n    pfn['Enneper'] = vtkParametricEnneper()\n    pfn['Figure8Klein'] = vtkParametricFigure8Klein()\n    pfn['Klein'] = vtkParametricKlein()\n    pfn['Mobius'] = vtkParametricMobius()\n    pfn['RandomHills'] = vtkParametricRandomHills()\n    pfn['Roman'] = vtkParametricRoman()\n    pfn['SuperEllipsoid'] = vtkParametricSuperEllipsoid()\n    pfn['SuperToroid'] = vtkParametricSuperToroid()\n    pfn['Torus'] = vtkParametricTorus()\n    pfn['Spline'] = vtkParametricSpline()\n    # Extra parametric surfaces.\n    pfn['BohemianDome'] = vtkParametricBohemianDome()\n    pfn['Bour'] = vtkParametricBour()\n    pfn['CatalanMinimal'] = vtkParametricCatalanMinimal()\n    pfn['Henneberg'] = vtkParametricHenneberg()\n    pfn['Kuen'] = vtkParametricKuen()\n    pfn['PluckerConoid'] = vtkParametricPluckerConoid()\n    pfn['Pseudosphere'] = vtkParametricPseudosphere()\n    # Now set some parameters.\n    pfn[\"Ellipsoid\"].SetXRadius(0.5)\n    pfn[\"Ellipsoid\"].SetYRadius(2.0)\n    pfn[\"Mobius\"].SetRadius(2.0)\n    pfn[\"Mobius\"].SetMinimumV(-0.5)\n    pfn[\"Mobius\"].SetMaximumV(0.5)\n    pfn[\"RandomHills\"].AllowRandomGenerationOn()\n    pfn[\"RandomHills\"].SetRandomSeed(1)\n    pfn[\"RandomHills\"].SetNumberOfHills(30)\n    pfn[\"SuperEllipsoid\"].SetN1(0.5)\n    pfn[\"SuperEllipsoid\"].SetN2(0.4)\n    pfn[\"SuperToroid\"].SetN1(0.5)\n    pfn[\"SuperToroid\"].SetN2(3.0)\n    # The spline needs points\n    spline_points = vtkPoints()\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(8775070)\n    for p in range(0, 10):\n        xyz = [None] * 3\n        for idx in range(0, len(xyz)):\n            xyz[idx] = rng.GetRangeValue(-1.0, 1.0)\n            rng.Next()\n        spline_points.InsertNextPoint(xyz)\n\n    pfn[\"Spline\"].SetPoints(spline_points)\n    # Extra parametric surfaces.\n    pfn[\"BohemianDome\"].SetA(5.0)\n    pfn[\"BohemianDome\"].SetB(1.0)\n    pfn[\"BohemianDome\"].SetC(2.0)\n    pfn[\"Kuen\"].SetDeltaV0(0.001)\n\n    return pfn\n\n\ndef get_centre(bounds):\n    \"\"\"\n    Get the centre of the object from the bounding box.\n\n    :param bounds: The bounding box of the object.\n    :return:\n    \"\"\"\n    if len(bounds) != 6:\n        return None\n    return [bounds[i] - (bounds[i] - bounds[i - 1]) / 2.0 for i in range(1, len(bounds), 2)]\n\n\ndef get_maximum_length(bounds):\n    \"\"\"\n    Calculate the maximum length of the side bounding box.\n\n    :param bounds: The bounding box of the object.\n    :return:\n    \"\"\"\n    if len(bounds) != 6:\n        return None\n    return max([bounds[i] - bounds[i - 1] for i in range(1, len(bounds), 2)])\n\n\ndef display_bounding_box_and_center(name, bounds):\n    \"\"\"\n    Display the dimensions of the bounding box, maximum diagonal length\n     and coordinates of the centre.\n\n    :param name: The name of the object.\n    :param bounds: The bounding box of the object.\n    :return:\n    \"\"\"\n    if len(bounds) != 6:\n        return\n    max_len = get_maximum_length(bounds)\n    centre = get_centre(bounds)\n    s = '{:21s}\\n'.format(name)\n    s += '{:21s}{:1s}'.format('  Bounds (min, max)', ':')\n    s += '{:s}({:6.2f}, {:6.2f})'.format(' x:', bounds[0], bounds[1])\n    s += '{:s}({:6.2f}, {:6.2f})'.format(' y:', bounds[2], bounds[3])\n    s += '{:s}({:6.2f}, {:6.2f})\\n'.format(' z:', bounds[4], bounds[5])\n    if max_len:\n        s += '  Maximum side length: {:6.2f}\\n'.format(max_len)\n    if centre:\n        s += '  Centre (x, y, z)   : ({:6.2f}, {:6.2f}, {:6.2f})\\n'.format(centre[0], centre[1], centre[2])\n    print(s)\n\n\nclass PrintCallback:\n    def __init__(self, caller, file_name, image_quality=1, rgba=True):\n        self.caller = caller\n        self.image_quality = image_quality\n        # rgba is the the buffer type,\n        #  (if true, there is no background in the screenshot).\n        self.rgba = rgba\n        parent = Path(file_name).resolve().parent\n        pth = Path(parent) / file_name\n        self.path = Path(str(pth)).with_suffix('.png')\n\n    def __call__(self, caller, ev):\n        # Save the screenshot.\n        if caller.GetKeyCode() == \"k\":\n            w2if = vtkWindowToImageFilter()\n            w2if.SetInput(caller.GetRenderWindow())\n            w2if.SetScale(self.image_quality, self.image_quality)\n            if self.rgba:\n                w2if.SetInputBufferTypeToRGBA()\n            else:\n                w2if.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            w2if.ReadFrontBufferOn()\n            w2if.Update()\n            writer = vtkPNGWriter()\n            writer.SetFileName(self.path)\n            writer.SetInputData(w2if.GetOutput())\n            writer.Write()\n            print('Screenshot saved to:', self.path.name)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/ParametricSuperEllipsoidDemo/","title":"ParametricSuperEllipsoidDemo","text":"

        vtk-examples/Python/GeometricObjects/ParametricSuperEllipsoidDemo

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/ParametricSuperEllipsoidDemo/#code","title":"Code","text":"

        ParametricSuperEllipsoidDemo.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import vtkParametricSuperEllipsoid\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkMath\n)\nfrom vtkmodules.vtkFiltersSources import vtkParametricFunctionSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    surface = vtkParametricSuperEllipsoid()\n    source = vtkParametricFunctionSource()\n\n    renderer = vtkRenderer()\n    mapper = vtkPolyDataMapper()\n    actor = vtkActor()\n\n    backProperty = vtkProperty()\n    backProperty.SetColor(colors.GetColor3d('Tomato'))\n\n    # Create a parametric function source, renderer, mapper, and actor\n    source.SetParametricFunction(surface)\n\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor.SetMapper(mapper)\n    actor.SetBackfaceProperty(backProperty)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n    actor.GetProperty().SetSpecular(.5)\n    actor.GetProperty().SetSpecularPower(20)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('ParametricSuperEllipsoidDemo')\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Setup a slider widget for each varying parameter\n    tubeWidth = 0.008\n    sliderLength = 0.008\n    titleHeight = 0.04\n    labelHeight = 0.04\n\n    sliderRepN1 = vtkSliderRepresentation2D()\n\n    sliderRepN1.SetMinimumValue(0.0)\n    sliderRepN1.SetMaximumValue(4.0)\n    sliderRepN1.SetValue(1.0)\n    sliderRepN1.SetTitleText('Z squareness')\n\n    sliderRepN1.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN1.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepN1.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN1.GetPoint2Coordinate().SetValue(.9, .1)\n\n    sliderRepN1.SetTubeWidth(tubeWidth)\n    sliderRepN1.SetSliderLength(sliderLength)\n    sliderRepN1.SetTitleHeight(titleHeight)\n    sliderRepN1.SetLabelHeight(labelHeight)\n\n    sliderWidgetN1 = vtkSliderWidget()\n    sliderWidgetN1.SetInteractor(interactor)\n    sliderWidgetN1.SetRepresentation(sliderRepN1)\n    sliderWidgetN1.SetAnimationModeToAnimate()\n    sliderWidgetN1.EnabledOn()\n\n    sliderWidgetN1.AddObserver(vtkCommand.InteractionEvent, SliderCallbackN1(surface))\n\n    sliderRepN2 = vtkSliderRepresentation2D()\n\n    sliderRepN2.SetMinimumValue(0.0001)\n    sliderRepN2.SetMaximumValue(4.0)\n    sliderRepN2.SetValue(1.0)\n    sliderRepN2.SetTitleText('XY squareness')\n\n    sliderRepN2.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN2.GetPoint1Coordinate().SetValue(.1, .9)\n    sliderRepN2.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN2.GetPoint2Coordinate().SetValue(.9, .9)\n\n    sliderRepN2.SetTubeWidth(tubeWidth)\n    sliderRepN2.SetSliderLength(sliderLength)\n    sliderRepN2.SetTitleHeight(titleHeight)\n    sliderRepN2.SetLabelHeight(labelHeight)\n\n    sliderWidgetN2 = vtkSliderWidget()\n    sliderWidgetN2.SetInteractor(interactor)\n    sliderWidgetN2.SetRepresentation(sliderRepN2)\n    sliderWidgetN2.SetAnimationModeToAnimate()\n    sliderWidgetN2.EnabledOn()\n\n    sliderWidgetN2.AddObserver(vtkCommand.InteractionEvent, SliderCallbackN2(surface))\n\n    sliderRepMinimumV = vtkSliderRepresentation2D()\n\n    sliderRepN1.SetMinimumValue(.0001)\n    sliderRepMinimumV.SetMaximumValue(.9999 * vtkMath.Pi())\n    sliderRepMinimumV.SetValue(.0001)\n    sliderRepMinimumV.SetTitleText('V min')\n\n    sliderRepMinimumV.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepMinimumV.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint2Coordinate().SetValue(.1, .9)\n\n    sliderRepMinimumV.SetTubeWidth(tubeWidth)\n    sliderRepMinimumV.SetSliderLength(sliderLength)\n    sliderRepMinimumV.SetTitleHeight(titleHeight)\n    sliderRepMinimumV.SetLabelHeight(labelHeight)\n\n    surface.SetN1(1.0)\n    surface.SetN2(1.0)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n    renderWindow.Render()\n\n    interactor.Initialize()\n\n    interactor.Start()\n\n\n# These callbacks do the actual work.\n# Callbacks for the interactions\n\nclass SliderCallbackN1():\n    def __init__(self, superEllipsoid):\n        self.superEllipsoid = superEllipsoid\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.superEllipsoid.SetN1(value)\n\n\nclass SliderCallbackN2():\n    def __init__(self, superEllipsoid):\n        self.superEllipsoid = superEllipsoid\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.superEllipsoid.SetN2(value)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/ParametricSuperToroidDemo/","title":"ParametricSuperToroidDemo","text":"

        vtk-examples/Python/GeometricObjects/ParametricSuperToroidDemo

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/ParametricSuperToroidDemo/#code","title":"Code","text":"

        ParametricSuperToroidDemo.py

        # !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import vtkParametricSuperToroid\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkMath\n)\nfrom vtkmodules.vtkFiltersSources import vtkParametricFunctionSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    surface = vtkParametricSuperToroid()\n    source = vtkParametricFunctionSource()\n\n    renderer = vtkRenderer()\n    mapper = vtkPolyDataMapper()\n    actor = vtkActor()\n\n    backProperty = vtkProperty()\n    backProperty.SetColor(colors.GetColor3d('Tomato'))\n\n    # Create a parametric function source, renderer, mapper, and actor\n    source.SetParametricFunction(surface)\n\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor.SetMapper(mapper)\n    actor.SetBackfaceProperty(backProperty)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n    actor.GetProperty().SetSpecular(.5)\n    actor.GetProperty().SetSpecularPower(20)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('ParametricSuperToroidDemo')\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Setup a slider widget for each varying parameter\n    tubeWidth = 0.008\n    sliderLength = 0.008\n    titleHeight = 0.04\n    labelHeight = 0.04\n\n    sliderRepN1 = vtkSliderRepresentation2D()\n\n    sliderRepN1.SetMinimumValue(0.0)\n    sliderRepN1.SetMaximumValue(4.0)\n    sliderRepN1.SetValue(1.0)\n    sliderRepN1.SetTitleText('Z squareness')\n\n    sliderRepN1.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN1.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepN1.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN1.GetPoint2Coordinate().SetValue(.9, .1)\n\n    sliderRepN1.SetTubeWidth(tubeWidth)\n    sliderRepN1.SetSliderLength(sliderLength)\n    sliderRepN1.SetTitleHeight(titleHeight)\n    sliderRepN1.SetLabelHeight(labelHeight)\n\n    sliderWidgetN1 = vtkSliderWidget()\n    sliderWidgetN1.SetInteractor(interactor)\n    sliderWidgetN1.SetRepresentation(sliderRepN1)\n    sliderWidgetN1.SetAnimationModeToAnimate()\n    sliderWidgetN1.EnabledOn()\n\n    sliderWidgetN1.AddObserver(vtkCommand.InteractionEvent, SliderCallbackN1(surface))\n\n    sliderRepN2 = vtkSliderRepresentation2D()\n\n    sliderRepN2.SetMinimumValue(0.0001)\n    sliderRepN2.SetMaximumValue(4.0)\n    sliderRepN2.SetValue(1.0)\n    sliderRepN2.SetTitleText('XY squareness')\n\n    sliderRepN2.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN2.GetPoint1Coordinate().SetValue(.1, .9)\n    sliderRepN2.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepN2.GetPoint2Coordinate().SetValue(.9, .9)\n\n    sliderRepN2.SetTubeWidth(tubeWidth)\n    sliderRepN2.SetSliderLength(sliderLength)\n    sliderRepN2.SetTitleHeight(titleHeight)\n    sliderRepN2.SetLabelHeight(labelHeight)\n\n    sliderWidgetN2 = vtkSliderWidget()\n    sliderWidgetN2.SetInteractor(interactor)\n    sliderWidgetN2.SetRepresentation(sliderRepN2)\n    sliderWidgetN2.SetAnimationModeToAnimate()\n    sliderWidgetN2.EnabledOn()\n\n    sliderWidgetN2.AddObserver(vtkCommand.InteractionEvent, SliderCallbackN2(surface))\n\n    sliderRepMinimumV = vtkSliderRepresentation2D()\n\n    sliderRepN1.SetMinimumValue(.0001)\n    sliderRepMinimumV.SetMaximumValue(.9999 * vtkMath.Pi())\n    sliderRepMinimumV.SetValue(.0001)\n    sliderRepMinimumV.SetTitleText('V min')\n\n    sliderRepMinimumV.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint1Coordinate().SetValue(.1, .1)\n    sliderRepMinimumV.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepMinimumV.GetPoint2Coordinate().SetValue(.1, .9)\n\n    sliderRepMinimumV.SetTubeWidth(tubeWidth)\n    sliderRepMinimumV.SetSliderLength(sliderLength)\n    sliderRepMinimumV.SetTitleHeight(titleHeight)\n    sliderRepMinimumV.SetLabelHeight(labelHeight)\n\n    surface.SetN1(1.0)\n    surface.SetN2(1.0)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Zoom(0.9)\n    renderer.ResetCameraClippingRange()\n    renderWindow.Render()\n\n    interactor.Initialize()\n\n    interactor.Start()\n\n\n# These callbacks do the actual work.\n# Callbacks for the interactions\n\nclass SliderCallbackN1():\n    def __init__(self, superToroid):\n        self.superToroid = superToroid\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.superToroid.SetN1(value)\n\n\nclass SliderCallbackN2():\n    def __init__(self, superToroid):\n        self.superToroid = superToroid\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.superToroid.SetN2(value)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Plane/","title":"Plane","text":"

        vtk-examples/Python/GeometricObjects/Plane

        "},{"location":"Python/GeometricObjects/Plane/#description","title":"Description","text":"

        vtkPlaneSource object creates an m x n array of quadrilaterals arranged as a regular tiling in a plane.

        The plane is defined by specifying an origin point, and then two other points that, together with the origin, define two axes for the plane. These axes do not have to be orthogonal - so you can create a parallelogram. (The axes must not be parallel.) The resolution of the plane (i.e., number of subdivisions) is controlled by the ivars XResolution and YResolution.

        By default, the plane is centered at the origin and perpendicular to the z-axis, with width and height of length 1 and resolutions set to 1.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Plane/#code","title":"Code","text":"

        Plane.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 77, 255])\n\n    # Create a plane\n    planeSource = vtkPlaneSource()\n    planeSource.SetCenter(1.0, 0.0, 0.0)\n    planeSource.SetNormal(1.0, 0.0, 1.0)\n    planeSource.Update()\n\n    plane = planeSource.GetOutput()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(plane)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n\n    # Create a renderer, render window and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Plane')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('BkgColor'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Planes/","title":"Planes","text":"

        vtk-examples/Python/GeometricObjects/Planes

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Planes/#code","title":"Code","text":"

        Planes.py

        #!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkPlanes,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import vtkHull\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    planes = list()\n    titles = list()\n\n    # Using frustum planes.\n    titles.append('Using frustum planes')\n    camera = vtkCamera()\n    planes_array = [0] * 24\n    camera.GetFrustumPlanes(1, planes_array)\n    planes.append(vtkPlanes())\n    planes[0].SetFrustumPlanes(planes_array)\n\n    # Using bounds.\n    titles.append('Using bounds')\n    sphere_source = vtkSphereSource()\n    sphere_source.Update()\n    bounds = [0] * 6\n    sphere_source.GetOutput().GetBounds(bounds)\n    planes.append(vtkPlanes())\n    planes[1].SetBounds(bounds)\n\n    # At this point we have the planes created by both of the methods above.\n    # You can do whatever you want with them.\n\n    # For visualisation we will produce an n-sided convex hull\n    # and visualise it.\n\n    # Create a common text property.\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(16)\n    text_property.SetJustificationToCentered()\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.SetWindowName('Planes')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    hulls = list()\n    pds = list()\n    mappers = list()\n    actors = list()\n    renderers = list()\n    text_mappers = list()\n    text_actors = list()\n    for i in range(0, len(planes)):\n        hulls.append(vtkHull())\n        hulls[i].SetPlanes(planes[i])\n\n        pds.append(vtkPolyData())\n\n        # To generate the convex hull we supply a vtkPolyData object and a bounding box.\n        # We define the bounding box to be where we expect the resulting polyhedron to lie.\n        # Make it a generous fit as it is only used to create the initial\n        # polygons that are eventually clipped.\n        hulls[i].GenerateHull(pds[i], -200, 200, -200, 200, -200, 200)\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[i].SetInputData(pds[i])\n\n        actors.append(vtkActor())\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('Moccasin'))\n        actors[i].GetProperty().SetSpecular(0.8)\n        actors[i].GetProperty().SetSpecularPower(30)\n\n        renderers.append(vtkRenderer())\n        renderers[i].AddActor(actors[i])\n\n        text_mappers.append(vtkTextMapper())\n        text_mappers[i].SetInput(titles[i])\n        text_mappers[i].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[i].SetMapper(text_mappers[i])\n        text_actors[i].SetPosition(100, 10)\n        renderers[i].AddViewProp(text_actors[i])\n\n        ren_win.AddRenderer(renderers[i])\n\n    # Setup the viewports\n    x_grid_dimensions = 2\n    y_grid_dimensions = 1\n    renderer_size = 300\n    ren_win.SetSize(renderer_size * x_grid_dimensions, renderer_size * y_grid_dimensions)\n    for row in range(0, y_grid_dimensions):\n        for col in range(0, x_grid_dimensions):\n            index = row * x_grid_dimensions + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / x_grid_dimensions,\n                        float(y_grid_dimensions - (row + 1)) / y_grid_dimensions,\n                        float(col + 1) / x_grid_dimensions,\n                        float(y_grid_dimensions - row) / y_grid_dimensions]\n\n            if index > (len(actors) - 1):\n                # Add a renderer even if there is no actor.\n                # This makes the render window background all the same color.\n                ren = vtkRenderer()\n                ren.SetBackground(colors.GetColor3d('DarkSlateGray'))\n                ren.SetViewport(viewport)\n                ren_win.AddRenderer(ren)\n                continue\n\n            renderers[index].SetViewport(viewport)\n            renderers[index].SetBackground(colors.GetColor3d('DarkSlateGray'))\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(30)\n            renderers[index].GetActiveCamera().Elevation(-30)\n            renderers[index].ResetCameraClippingRange()\n\n    iren.Initialize()\n    ren_win.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/PlanesIntersection/","title":"PlanesIntersection","text":"

        vtk-examples/Python/GeometricObjects/PlanesIntersection

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/PlanesIntersection/#code","title":"Code","text":"

        PlanesIntersection.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPlanesIntersection\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\n\ndef main():\n\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    bounds = [0 for i in range(6)]\n    sphereSource.GetOutput().GetBounds(bounds)\n\n    box = vtkPoints()\n\n    box.SetNumberOfPoints(8)\n\n    xMin = bounds[0]\n    xMax = bounds[1]\n    yMin = bounds[2]\n    yMax = bounds[3]\n    zMin = bounds[4]\n    zMax = bounds[5]\n\n    box.SetPoint(0, xMax, yMin, zMax)\n    box.SetPoint(1, xMax, yMin, zMin)\n    box.SetPoint(2, xMax, yMax, zMin)\n    box.SetPoint(3, xMax, yMax, zMax)\n    box.SetPoint(4, xMin, yMin, zMax)\n    box.SetPoint(5, xMin, yMin, zMin)\n    box.SetPoint(6, xMin, yMax, zMin)\n    box.SetPoint(7, xMin, yMax, zMax)\n\n    planesIntersection = vtkPlanesIntersection()\n    planesIntersection.SetBounds(bounds)\n\n    intersects = planesIntersection.IntersectsRegion(box)\n    if intersects == 1:\n        res = 'Yes'\n    else:\n        res = 'No'\n    print('Intersects? ', res)\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/PlatonicSolids/","title":"PlatonicSolids","text":"

        vtk-examples/Python/GeometricObjects/PlatonicSolids

        "},{"location":"Python/GeometricObjects/PlatonicSolids/#description","title":"Description","text":"

        Display all five Platonic solids in a grid.

        Platonic solids are regular, convex polyhedrons. They are constructed by congruent (identical in shape and size) regular (all angles equal and all sides equal) polygonal faces with the same number of faces meeting at each vertex.

        Five solids satisfy the above criteria:

        Figure Tetrahedron Cube Octahedron Icosahedron Dodecahedron Vertices 4 8 6 (2 \u00d7 3) 12 (4 \u00d7 3) 20 (8 + 4 \u00d7 3) Edges 6 12 12 30 30 Faces 4 6 8 20 12

        The relationship between vertices, edges and faces is given by Euler's formula:

        V - E + F = 2\n

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/PlatonicSolids/#code","title":"Code","text":"

        PlatonicSolids.py

        #!/usr/bin/env python\n\nfrom collections import namedtuple\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersSources import vtkPlatonicSolidSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    mappers = list()\n    actors = list()\n    text_mappers = list()\n    text_actors = list()\n    renderers = list()\n\n    # Create a common text property.\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(16)\n    text_property.SetJustificationToCentered()\n\n    # Create the render window and interactor.\n    ren_win = vtkRenderWindow()\n    ren_win.SetWindowName('PlatonicSolids')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    name_orientation = get_name_orientation()\n    lut = get_platonic_lut()\n    platonic_solids = list()\n\n    for i in range(0, len(name_orientation)):\n        platonic_solids.append(vtkPlatonicSolidSource())\n        platonic_solids[i].SetSolidType(i)\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[i].SetInputConnection(platonic_solids[i].GetOutputPort())\n        mappers[i].SetLookupTable(lut)\n        mappers[i].SetScalarRange(0, 19)\n\n        actors.append(vtkActor())\n        actors[i].SetMapper(mappers[i])\n\n        text_mappers.append(vtkTextMapper())\n        text_mappers[i].SetInput(name_orientation[i].name)\n        text_mappers[i].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[i].SetMapper(text_mappers[i])\n        text_actors[i].SetPosition(120, 16)\n\n        renderers.append(vtkRenderer())\n        renderers[i].AddActor(actors[i])\n        renderers[i].AddViewProp(text_actors[i])\n\n        ren_win.AddRenderer(renderers[i])\n\n    # Set up the viewports.\n    grid_dimension_x = 3\n    grid_dimension_y = 2\n    renderer_size = 300\n    ren_win.SetSize(renderer_size * grid_dimension_x, renderer_size * grid_dimension_y)\n    for row in range(0, grid_dimension_y):\n        for col in range(0, grid_dimension_x):\n            index = row * grid_dimension_x + col\n\n            # (x_min, y_min, x_max, y_max)\n            viewport = [float(col) / grid_dimension_x,\n                        float(grid_dimension_y - (row + 1)) / grid_dimension_y,\n                        float(col + 1) / grid_dimension_x,\n                        float(grid_dimension_y - row) / grid_dimension_y]\n\n            if index > (len(actors) - 1):\n                # Add a renderer even if there is no actor.\n                # This makes the render window background all the same color.\n                ren = vtkRenderer()\n                ren.SetBackground(colors.GetColor3d('SlateGray'))\n                ren.SetViewport(viewport)\n                ren_win.AddRenderer(ren)\n                continue\n\n            renderers[index].SetViewport(viewport)\n            renderers[index].SetBackground(colors.GetColor3d('SlateGray'))\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(name_orientation[index].azimuth)\n            renderers[index].GetActiveCamera().Elevation(name_orientation[index].elevation)\n            renderers[index].GetActiveCamera().Zoom(name_orientation[index].zoom)\n            renderers[index].ResetCameraClippingRange()\n\n    iren.Initialize()\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_name_orientation():\n    \"\"\"\n    Get the platonic solid names and initial orientations.\n\n    :return: The solids and their initial orientations.\n    \"\"\"\n\n    # [[name, azimuth, elevation, zoom] ...]\n    res = [['Tetrahedron', 45.0, 30.0, 1.0],\n           ['Cube', -60.0, 45.0, 0.8],\n           ['Octahedron', -15.0, 10.0, 1.0],\n           ['Icosahedron', 4.5, 18.0, 1.0],\n           ['Dodecahedron', 171.0, 22.0, 1.0]]\n\n    platonic_solids = namedtuple('platonic_solids', ('name', 'azimuth', 'elevation', 'zoom'))\n    # Convert res to a list of named tuples.\n    res = [platonic_solids(*row) for row in res]\n    return res\n\n\ndef get_platonic_lut():\n    \"\"\"\n    Get a specialised lookup table for the platonic solids.\n\n    Since each face of a vtkPlatonicSolidSource has a different\n    cell scalar, we create a lookup table with a different colour\n    for each face.\n    The colors have been carefully chosen so that adjacent cells\n    are colored distinctly.\n\n    :return: The lookup table.\n    \"\"\"\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(20)\n    lut.SetTableRange(0.0, 19.0)\n    lut.Build()\n    lut.SetTableValue(0, 0.1, 0.1, 0.1)\n    lut.SetTableValue(1, 0, 0, 1)\n    lut.SetTableValue(2, 0, 1, 0)\n    lut.SetTableValue(3, 0, 1, 1)\n    lut.SetTableValue(4, 1, 0, 0)\n    lut.SetTableValue(5, 1, 0, 1)\n    lut.SetTableValue(6, 1, 1, 0)\n    lut.SetTableValue(7, 0.9, 0.7, 0.9)\n    lut.SetTableValue(8, 0.5, 0.5, 0.5)\n    lut.SetTableValue(9, 0.0, 0.0, 0.7)\n    lut.SetTableValue(10, 0.5, 0.7, 0.5)\n    lut.SetTableValue(11, 0, 0.7, 0.7)\n    lut.SetTableValue(12, 0.7, 0, 0)\n    lut.SetTableValue(13, 0.7, 0, 0.7)\n    lut.SetTableValue(14, 0.7, 0.7, 0)\n    lut.SetTableValue(15, 0, 0, 0.4)\n    lut.SetTableValue(16, 0, 0.4, 0)\n    lut.SetTableValue(17, 0, 0.4, 0.4)\n    lut.SetTableValue(18, 0.4, 0, 0)\n    lut.SetTableValue(19, 0.4, 0, 0.4)\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Point/","title":"Point","text":"

        vtk-examples/Python/GeometricObjects/Point

        "},{"location":"Python/GeometricObjects/Point/#description","title":"Description","text":"

        vtkPoints object represents 3D points. The data model for vtkPoints is an array of vx-vy-vz triplets accessible by ( point or cell) id.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Point/#code","title":"Code","text":"

        Point.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the geometry of a point (the coordinate)\n    points = vtkPoints()\n    p = [1.0, 2.0, 3.0]\n\n    # Create the topology of the point (a vertex)\n    vertices = vtkCellArray()\n    # We need an an array of point id's for InsertNextCell.\n    pid = [0]\n    pid[0] = points.InsertNextPoint(p)\n    vertices.InsertNextCell(1, pid)\n\n    # Create a polydata object\n    point = vtkPolyData()\n\n    # Set the points and vertices we created as the geometry and topology of the polydata\n    point.SetPoints(points)\n    point.SetVerts(vertices)\n\n    # Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(point)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n    actor.GetProperty().SetPointSize(20)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Point')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/PolyLine/","title":"PolyLine","text":"

        vtk-examples/Python/GeometricObjects/PolyLine

        "},{"location":"Python/GeometricObjects/PolyLine/#description","title":"Description","text":"

        The polyline is a composite one-dimensional cell consisting of one or more connected lines. The polyline is defined by an ordered list of n+1 points, where n is the number of lines in the polyline. Each pair of points (i, i+1) defines a line.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/PolyLine/#code","title":"Code","text":"

        PolyLine.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create five points.\n    origin = [0.0, 0.0, 0.0]\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [0.0, 1.0, 0.0]\n    p2 = [0.0, 1.0, 2.0]\n    p3 = [1.0, 2.0, 3.0]\n\n    # Create a vtkPoints object and store the points in it\n    points = vtkPoints()\n    points.InsertNextPoint(origin)\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n\n    polyLine = vtkPolyLine()\n    polyLine.GetPointIds().SetNumberOfIds(5)\n    for i in range(0, 5):\n        polyLine.GetPointIds().SetId(i, i)\n\n    # Create a cell array to store the lines in and add the lines to it\n    cells = vtkCellArray()\n    cells.InsertNextCell(polyLine)\n\n    # Create a polydata to store everything in\n    polyData = vtkPolyData()\n\n    # Add the points to the dataset\n    polyData.SetPoints(points)\n\n    # Add the lines to the dataset\n    polyData.SetLines(cells)\n\n    # Setup actor and mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n    # Setup render window, renderer, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('PolyLine')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkOliveGreen'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/PolyLine1/","title":"PolyLine1","text":"

        vtk-examples/Python/GeometricObjects/PolyLine1

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/PolyLine1/#code","title":"Code","text":"

        PolyLine1.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# This example demonstrates how to create a polyline through several ordered points.\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    # vtkPoints represents 3D points. The data model for vtkPoints is an array of\n    # vx-vy-vz triplets accessible by (point or cell) id.\n    points = vtkPoints()\n    points.SetNumberOfPoints(6)\n    c = math.cos(math.pi / 6)  # helper variable\n    points.SetPoint(0, 0.0, -1.0, 0.0)\n    points.SetPoint(1, c, -0.5, 0.0)\n    points.SetPoint(2, c, 0.5, 0.0)\n    points.SetPoint(3, 0.0, 1.0, 0.0)\n    points.SetPoint(4, -c, 0.5, 0.0)\n    points.SetPoint(5, -c, -0.5, 0.0)\n\n    # vtkCellArray is a supporting object that explicitly represents cell connectivity.\n    # The cell array structure is a raw integer list of the form:\n    # (n,id1,id2,...,idn, n,id1,id2,...,idn, ...) where n is the number of points in\n    # the cell, and id is a zero-offset index into an associated point list.\n    lines = vtkCellArray()\n    lines.InsertNextCell(7)\n    lines.InsertCellPoint(0)\n    lines.InsertCellPoint(1)\n    lines.InsertCellPoint(2)\n    lines.InsertCellPoint(3)\n    lines.InsertCellPoint(4)\n    lines.InsertCellPoint(5)\n    lines.InsertCellPoint(0)\n\n    # vtkPolyData is a data object that is a concrete implementation of vtkDataSet.\n    # vtkPolyData represents a geometric structure consisting of vertices, lines,\n    # polygons, and/or triangle strips\n    polygon = vtkPolyData()\n    polygon.SetPoints(points)\n    polygon.SetLines(lines)\n\n    # vtkPolyDataMapper is a class that maps polygonal data (i.e., vtkPolyData)\n    # to graphics primitives\n    polygonMapper = vtkPolyDataMapper()\n    polygonMapper.SetInputData(polygon)\n    polygonMapper.Update()\n\n    # Create an actor to represent the polygon. The actor orchestrates rendering of\n    # the mapper's graphics primitives. An actor also refers to properties via a\n    # vtkProperty instance, and includes an internal transformation matrix. We\n    # set this actor's mapper to be polygonMapper which we created above.\n    polygonActor = vtkActor()\n    polygonActor.SetMapper(polygonMapper)\n    polygonActor.GetProperty().SetColor(colors.GetColor3d('AliceBlue'))\n\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is\n    # responsible for drawing the actors it has.  We also set the\n    # background color here.\n    ren = vtkRenderer()\n    ren.AddActor(polygonActor)\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n\n    # Automatically set up the camera based on the visible actors.\n    # The camera will reposition itself to view the center point of the actors,\n    # and move along its initial view plane normal\n    # (i.e., vector defined from camera position to focal point) so that all of the\n    # actors can be seen.\n    ren.ResetCamera()\n\n    # Finally we create the render window which will show up on the screen\n    # We put our renderer into the render window using AddRenderer. We\n    # also set the size to be 300 pixels by 300.\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName('PolyLine1')\n    renWin.AddRenderer(ren)\n    renWin.SetSize(300, 300)\n\n    # The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n    # mouse) in the vtkRenderWindow. These events are translated into\n    # event invocations that VTK understands (see VTK/Common/vtkCommand.h\n    # for all events that VTK processes). Then observers of these VTK\n    # events can process them as appropriate.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Polygon/","title":"Polygon","text":"

        vtk-examples/Python/GeometricObjects/Polygon

        "},{"location":"Python/GeometricObjects/Polygon/#description","title":"Description","text":"

        The polygon is a primary two-dimensional cell. The polygon is defined by an ordered list of three or more points lying in a plane. The polygon normal is implicitly defined by a counterclockwise ordering of its points using the right-hand rule.

        The polygon may be nonconvex, but may not have internal loops, and it cannot self-intersect. The polygon has n edges, where n is the number of points in the polygon.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Polygon/#code","title":"Code","text":"

        Polygon.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolygon\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Setup four points\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    # Create the polygon\n    polygon = vtkPolygon()\n    polygon.GetPointIds().SetNumberOfIds(4)  # make a quad\n    polygon.GetPointIds().SetId(0, 0)\n    polygon.GetPointIds().SetId(1, 1)\n    polygon.GetPointIds().SetId(2, 2)\n    polygon.GetPointIds().SetId(3, 3)\n\n    # Add the polygon to a list of polygons\n    polygons = vtkCellArray()\n    polygons.InsertNextCell(polygon)\n\n    # Create a PolyData\n    polygonPolyData = vtkPolyData()\n    polygonPolyData.SetPoints(points)\n    polygonPolyData.SetPolys(polygons)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polygonPolyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Polygon')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Salmon'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/PolygonIntersection/","title":"PolygonIntersection","text":"

        vtk-examples/Python/GeometricObjects/PolygonIntersection

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/PolygonIntersection/#code","title":"Code","text":"

        PolygonIntersection.py

        #!/usr/bin/env python\nfrom __future__ import print_function\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import (\n    mutable,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolygon\n\n\ndef main():\n    # Create a square in the x-y plane.\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    # Create the polygon\n    polygon = vtkPolygon()\n    polygon.GetPoints().DeepCopy(points)\n    polygon.GetPointIds().SetNumberOfIds(4)  # The 4 corners of the square\n    for i in range(4):\n        polygon.GetPointIds().SetId(i, i)\n\n    # Inputs\n    p1 = [0.1, 0, -1.0]\n    p2 = [0.1, 0, 1.0]\n    tolerance = 0.001\n\n    # Outputs\n    t = mutable(0)  # Parametric coordinate of intersection (0 (corresponding to p1) to 1 (corresponding to p2))\n    x = [0.0, 0.0, 0.0]\n    pcoords = [0.0, 0.0, 0.0]\n    subId = mutable(0)\n    iD = polygon.IntersectWithLine(p1, p2, tolerance, t, x, pcoords, subId)\n\n    print('intersected? ', 'Yes' if iD == 1 else 'No')\n    print('intersection: ', x)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Polyhedron/","title":"Polyhedron","text":"

        vtk-examples/Python/GeometricObjects/Polyhedron

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Polyhedron/#code","title":"Code","text":"

        Polyhedron.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkIdList,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_POLYHEDRON,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkIOXML import vtkXMLUnstructuredGridWriter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create polyhedron (cube)\n    # The point Ids are: [0, 1, 2, 3, 4, 5, 6, 7]\n\n    points = vtkPoints()\n    points.InsertNextPoint(-1.0, -1.0, -1.0)\n    points.InsertNextPoint(1.0, -1.0, -1.0)\n    points.InsertNextPoint(1.0, 1.0, -1.0)\n    points.InsertNextPoint(-1.0, 1.0, -1.0)\n    points.InsertNextPoint(-1.0, -1.0, 1.0)\n    points.InsertNextPoint(1.0, -1.0, 1.0)\n    points.InsertNextPoint(1.0, 1.0, 1.0)\n    points.InsertNextPoint(-1.0, 1.0, 1.0)\n\n    # These are the point ids corresponding to each face.\n    faces = [[0, 3, 2, 1], [0, 4, 7, 3], [4, 5, 6, 7], [5, 1, 2, 6], [0, 1, 5, 4], [2, 3, 7, 6]]\n    faceId = vtkIdList()\n    faceId.InsertNextId(6)  # Six faces make up the cell.\n    for face in faces:\n        faceId.InsertNextId(len(face))  # The number of points in the face.\n        [faceId.InsertNextId(i) for i in face]\n\n    ugrid = vtkUnstructuredGrid()\n    ugrid.SetPoints(points)\n    ugrid.InsertNextCell(VTK_POLYHEDRON, faceId)\n\n    # Here we write out the cube.\n    writer = vtkXMLUnstructuredGridWriter()\n    writer.SetInputData(ugrid)\n    writer.SetFileName('polyhedron.vtu')\n    writer.SetDataModeToAscii()\n    writer.Update()\n\n    # Create a mapper and actor\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(ugrid)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(\n        colors.GetColor3d('Silver'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Polyhedron')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Salmon'))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Pyramid/","title":"Pyramid","text":"

        vtk-examples/Python/GeometricObjects/Pyramid

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Pyramid/#code","title":"Code","text":"

        Pyramid.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPyramid,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n\n    p0 = [1.0, 1.0, 1.0]\n    p1 = [-1.0, 1.0, 1.0]\n    p2 = [-1.0, -1.0, 1.0]\n    p3 = [1.0, -1.0, 1.0]\n    p4 = [0.0, 0.0, 0.0]\n\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n    points.InsertNextPoint(p4)\n\n    pyramid = vtkPyramid()\n    pyramid.GetPointIds().SetId(0, 0)\n    pyramid.GetPointIds().SetId(1, 1)\n    pyramid.GetPointIds().SetId(2, 2)\n    pyramid.GetPointIds().SetId(3, 3)\n    pyramid.GetPointIds().SetId(4, 4)\n\n    cells = vtkCellArray()\n    cells.InsertNextCell(pyramid)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(pyramid.GetCellType(), pyramid.GetPointIds())\n\n    # Create an actor and mapper\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(ug)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Pyramid\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n\n    # Create a nice view\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(180)\n    renderer.GetActiveCamera().Elevation(-20)\n    renderer.ResetCameraClippingRange()\n\n    renderer.SetBackground(colors.GetColor3d(\"Silver\"))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Quad/","title":"Quad","text":"

        vtk-examples/Python/GeometricObjects/Quad

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Quad/#code","title":"Code","text":"

        Quad.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkQuad\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create four points (must be in counter clockwise order)\n    p0 = [0.0, 0.0, 0.0]\n    p1 = [1.0, 0.0, 0.0]\n    p2 = [1.0, 1.0, 0.0]\n    p3 = [0.0, 1.0, 0.0]\n\n    # Add the points to a vtkPoints object\n    points = vtkPoints()\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n\n    # Create a quad on the four points\n    quad = vtkQuad()\n    quad.GetPointIds().SetId(0, 0)\n    quad.GetPointIds().SetId(1, 1)\n    quad.GetPointIds().SetId(2, 2)\n    quad.GetPointIds().SetId(3, 3)\n\n    # Create a cell array to store the quad in\n    quads = vtkCellArray()\n    quads.InsertNextCell(quad)\n\n    # Create a polydata to store everything in\n    polydata = vtkPolyData()\n\n    # Add the points and quads to the dataset\n    polydata.SetPoints(points)\n    polydata.SetPolys(quads)\n\n    # Setup actor and mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polydata)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    # Setup render window, renderer, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Quad')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Salmon'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/QuadraticHexahedron/","title":"QuadraticHexahedron","text":"

        vtk-examples/Python/GeometricObjects/QuadraticHexahedron

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/QuadraticHexahedron/#code","title":"Code","text":"

        QuadraticHexahedron.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkQuadraticHexahedron,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersGeneral import vtkTessellatorFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    namedColors = vtkNamedColors()\n\n    uGrid = MakeQuadraticHexahedron()\n\n    tessellate = vtkTessellatorFilter()\n    tessellate.SetInputData(uGrid)\n    tessellate.SetMaximumNumberOfSubdivisions(2)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(tessellate.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Create an actor for the grid\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(\n        namedColors.GetColor3d('Tomato'))\n    actor.GetProperty().SetEdgeColor(\n        namedColors.GetColor3d('IvoryBlack'))\n    actor.GetProperty().EdgeVisibilityOn()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetRadius(0.02)\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetInputData(uGrid)\n    glyph3D.SetSourceConnection(sphereSource.GetOutputPort())\n    glyph3D.ScalingOff()\n    glyph3D.Update()\n\n    glyph3DMapper = vtkDataSetMapper()\n    glyph3DMapper.SetInputConnection(glyph3D.GetOutputPort())\n    glyph3DMapper.ScalarVisibilityOff()\n\n    glyph3DActor = vtkActor()\n    glyph3DActor.SetMapper(glyph3DMapper)\n    glyph3DActor.GetProperty().SetColor(\n        namedColors.GetColor3d('Banana'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('QuadraticHexahedron')\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(glyph3DActor)\n    renderer.SetBackground(namedColors.GetColor3d('SlateGray'))\n\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef MakeQuadraticHexahedron():\n    aHexahedron = vtkQuadraticHexahedron()\n    points = vtkPoints()\n\n    pcoords = aHexahedron.GetParametricCoords()\n    rng = vtkMinimalStandardRandomSequence()\n    points.SetNumberOfPoints(aHexahedron.GetNumberOfPoints())\n    rng.SetSeed(5070)  # for testing\n    for i in range(0, aHexahedron.GetNumberOfPoints()):\n        perturbation = [0.0] * 3\n        for j in range(0, 3):\n            rng.Next()\n            perturbation[j] = rng.GetRangeValue(-0.1, 0.1)\n        aHexahedron.GetPointIds().SetId(i, i)\n        points.SetPoint(i, pcoords[3 * i] + perturbation[0],\n                        pcoords[3 * i + 1] + perturbation[1],\n                        pcoords[3 * i + 2] + perturbation[2])\n\n    # Add the points and hexahedron to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(aHexahedron.GetCellType(), aHexahedron.GetPointIds())\n\n    return uGrid\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/QuadraticHexahedronDemo/","title":"QuadraticHexahedronDemo","text":"

        vtk-examples/Python/GeometricObjects/QuadraticHexahedronDemo

        "},{"location":"Python/GeometricObjects/QuadraticHexahedronDemo/#description","title":"Description","text":"

        This example shows the effect of changing the chord length error for a vtkQuadraticHexahedron.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/QuadraticHexahedronDemo/#code","title":"Code","text":"

        QuadraticHexahedronDemo.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkGenericCell,\n    vtkQuadraticHexahedron,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersGeneral import vtkTessellatorFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    namedColors = vtkNamedColors()\n\n    uGrid = MakeQuadraticHexahedron()\n\n    tessellate = vtkTessellatorFilter()\n    tessellate.SetInputData(uGrid)\n    tessellate.SetChordError(0.035)\n    tessellate.Update()\n\n    cellMap = dict()\n\n    numTets = 0\n    cell = vtkGenericCell()\n    it = tessellate.GetOutput().NewCellIterator()\n    it.InitTraversal()\n    while not it.IsDoneWithTraversal():\n        it.GetCell(cell)\n        cellMap[cell.GetRepresentativeCell().GetClassName()] = numTets\n        numTets += 1\n        it.GoToNextCell()\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(tessellate.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Create an actor for the grid\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(\n        namedColors.GetColor3d('Tomato'))\n    actor.GetProperty().SetEdgeColor(\n        namedColors.GetColor3d('IvoryBlack'))\n    actor.GetProperty().EdgeVisibilityOn()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetRadius(0.02)\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetInputData(uGrid)\n    glyph3D.SetSourceConnection(sphereSource.GetOutputPort())\n    glyph3D.ScalingOff()\n    glyph3D.Update()\n\n    glyph3DMapper = vtkDataSetMapper()\n    glyph3DMapper.SetInputConnection(glyph3D.GetOutputPort())\n    glyph3DMapper.ScalarVisibilityOff()\n\n    glyph3DActor = vtkActor()\n    glyph3DActor.SetMapper(glyph3DMapper)\n    glyph3DActor.GetProperty().SetColor(\n        namedColors.GetColor3d('Banana'))\n\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(24)\n\n    ss = '# of Tetras: ' + str(numTets)\n    textMapper = vtkTextMapper()\n    textMapper.SetInput(ss)\n    textMapper.SetTextProperty(textProperty)\n\n    textActor = vtkActor2D()\n    textActor.SetMapper(textMapper)\n    textActor.SetPosition(10, 400)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('QuadraticHexahedronDemo')\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 512)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    widget = vtkSliderWidget()\n    MakeWidget(widget, tessellate, textMapper, interactor)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(glyph3DActor)\n    renderer.AddViewProp(textActor)\n    renderer.SetBackground(namedColors.GetColor3d('SlateGray'))\n\n    renderWindow.Render()\n\n    interactor.Start()\n\n\nclass SliderCallbackChordError():\n    def __init__(self, tessellate, textMapper):\n        self.tessellate = tessellate\n        self.textMapper = textMapper\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.tessellate.SetChordError(value)\n        self.tessellate.SetMaximumNumberOfSubdivisions(4)\n        self.tessellate.Update()\n\n        cellMap = dict()\n\n        numTets = 0\n        cell = vtkGenericCell()\n        it = self.tessellate.GetOutput().NewCellIterator()\n        it.InitTraversal()\n        while not it.IsDoneWithTraversal():\n            it.GetCell(cell)\n            cellMap[cell.GetRepresentativeCell().GetClassName()] = numTets\n            numTets += 1\n            it.GoToNextCell()\n        ss = '# of Tetras: ' + str(numTets)\n        self.textMapper.SetInput(ss)\n\n\ndef MakeWidget(widget, tessellate, textMapper, interactor):\n    # Setup a slider widget for each varying parameter\n    tubeWidth = 0.008\n    sliderLength = 0.008\n    titleHeight = 0.04\n    labelHeight = 0.04\n\n    sliderRepChordError = vtkSliderRepresentation2D()\n\n    sliderRepChordError.SetMinimumValue(0.0)\n    sliderRepChordError.SetMaximumValue(0.07)\n    sliderRepChordError.SetValue(tessellate.GetChordError())\n    sliderRepChordError.SetTitleText('Chord error')\n\n    sliderRepChordError.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepChordError.GetPoint1Coordinate().SetValue(0.1, 0.1)\n    sliderRepChordError.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepChordError.GetPoint2Coordinate().SetValue(0.9, 0.1)\n\n    sliderRepChordError.SetTubeWidth(tubeWidth)\n    sliderRepChordError.SetSliderLength(sliderLength)\n    sliderRepChordError.SetTitleHeight(titleHeight)\n    sliderRepChordError.SetLabelHeight(labelHeight)\n\n    widget.SetInteractor(interactor)\n    widget.SetRepresentation(sliderRepChordError)\n    widget.SetAnimationModeToAnimate()\n    widget.EnabledOn()\n\n    widget.AddObserver(vtkCommand.InteractionEvent, SliderCallbackChordError(tessellate, textMapper))\n\n\ndef MakeQuadraticHexahedron():\n    aHexahedron = vtkQuadraticHexahedron()\n    points = vtkPoints()\n\n    pcoords = aHexahedron.GetParametricCoords()\n    rng = vtkMinimalStandardRandomSequence()\n    points.SetNumberOfPoints(aHexahedron.GetNumberOfPoints())\n    rng.SetSeed(5070)  # for testing\n    for i in range(0, aHexahedron.GetNumberOfPoints()):\n        perturbation = [0.0] * 3\n        for j in range(0, 3):\n            rng.Next()\n            perturbation[j] = rng.GetRangeValue(-0.1, 0.1)\n        aHexahedron.GetPointIds().SetId(i, i)\n        points.SetPoint(i, pcoords[3 * i] + perturbation[0],\n                        pcoords[3 * i + 1] + perturbation[1],\n                        pcoords[3 * i + 2] + perturbation[2])\n\n    # Add the points and hexahedron to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(aHexahedron.GetCellType(), aHexahedron.GetPointIds())\n\n    return uGrid\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/QuadraticTetra/","title":"QuadraticTetra","text":"

        vtk-examples/Python/GeometricObjects/QuadraticTetra

        "},{"location":"Python/GeometricObjects/QuadraticTetra/#description","title":"Description","text":"

        The quadratic tetrahedron is a primary three-dimensional cell. It is defined by ten points. The first four points are located at the vertices of the tetrahedron; the next six are located in the middle of each of the six edges.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/QuadraticTetra/#code","title":"Code","text":"

        QuadraticTetra.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkQuadraticTetra,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersGeneral import vtkTessellatorFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    namedColors = vtkNamedColors()\n\n    uGrid = MakeQuadraticTetra()\n\n    tessellate = vtkTessellatorFilter()\n    tessellate.SetInputData(uGrid)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(tessellate.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Create an actor for the grid\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(\n        namedColors.GetColor3d('Tomato'))\n    actor.GetProperty().SetEdgeColor(\n        namedColors.GetColor3d('IvoryBlack'))\n    actor.GetProperty().EdgeVisibilityOn()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetRadius(0.02)\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetInputData(uGrid)\n    glyph3D.SetSourceConnection(sphereSource.GetOutputPort())\n    glyph3D.ScalingOff()\n    glyph3D.Update()\n\n    glyph3DMapper = vtkDataSetMapper()\n    glyph3DMapper.SetInputConnection(glyph3D.GetOutputPort())\n    glyph3DMapper.ScalarVisibilityOff()\n\n    glyph3DActor = vtkActor()\n    glyph3DActor.SetMapper(glyph3DMapper)\n    glyph3DActor.GetProperty().SetColor(\n        namedColors.GetColor3d('Banana'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('QuadraticTetra')\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(glyph3DActor)\n    renderer.SetBackground(namedColors.GetColor3d('SlateGray'))\n\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef MakeQuadraticTetra():\n    aTetra = vtkQuadraticTetra()\n    points = vtkPoints()\n\n    pcoords = aTetra.GetParametricCoords()\n    rng = vtkMinimalStandardRandomSequence()\n    points.SetNumberOfPoints(aTetra.GetNumberOfPoints())\n    rng.SetSeed(5070)  # for testing\n    for i in range(0, aTetra.GetNumberOfPoints()):\n        perturbation = [0.0] * 3\n        for j in range(0, 3):\n            rng.Next()\n            perturbation[j] = rng.GetRangeValue(-0.1, 0.1)\n        aTetra.GetPointIds().SetId(i, i)\n        points.SetPoint(i, pcoords[3 * i] + perturbation[0],\n                        pcoords[3 * i + 1] + perturbation[1],\n                        pcoords[3 * i + 2] + perturbation[2])\n\n    # Add the points and tetra to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(aTetra.GetCellType(), aTetra.GetPointIds())\n\n    return uGrid\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/QuadraticTetraDemo/","title":"QuadraticTetraDemo","text":"

        vtk-examples/Python/GeometricObjects/QuadraticTetraDemo

        "},{"location":"Python/GeometricObjects/QuadraticTetraDemo/#description","title":"Description","text":"

        This example shows the effect of changing the chord length error for a vtkQuadraticTetra.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/QuadraticTetraDemo/#code","title":"Code","text":"

        QuadraticTetraDemo.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkGenericCell,\n    vtkQuadraticTetra,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersGeneral import vtkTessellatorFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    namedColors = vtkNamedColors()\n\n    uGrid = MakeQuadraticTetra()\n\n    tessellate = vtkTessellatorFilter()\n    tessellate.SetInputData(uGrid)\n    tessellate.SetChordError(.035)\n    tessellate.Update()\n\n    cellMap = dict()\n\n    numTets = 0\n    cell = vtkGenericCell()\n    it = tessellate.GetOutput().NewCellIterator()\n    it.InitTraversal()\n    while not it.IsDoneWithTraversal():\n        it.GetCell(cell)\n        cellMap[cell.GetRepresentativeCell().GetClassName()] = numTets\n        numTets += 1\n        it.GoToNextCell()\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(tessellate.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Create an actor for the grid\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(\n        namedColors.GetColor3d('Tomato'))\n    actor.GetProperty().SetEdgeColor(\n        namedColors.GetColor3d('IvoryBlack'))\n    actor.GetProperty().EdgeVisibilityOn()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetRadius(0.02)\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetInputData(uGrid)\n    glyph3D.SetSourceConnection(sphereSource.GetOutputPort())\n    glyph3D.ScalingOff()\n    glyph3D.Update()\n\n    glyph3DMapper = vtkDataSetMapper()\n    glyph3DMapper.SetInputConnection(glyph3D.GetOutputPort())\n    glyph3DMapper.ScalarVisibilityOff()\n\n    glyph3DActor = vtkActor()\n    glyph3DActor.SetMapper(glyph3DMapper)\n    glyph3DActor.GetProperty().SetColor(\n        namedColors.GetColor3d('Banana'))\n\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(24)\n\n    ss = '# of Tetras: ' + str(numTets)\n    textMapper = vtkTextMapper()\n    textMapper.SetInput(ss)\n    textMapper.SetTextProperty(textProperty)\n\n    textActor = vtkActor2D()\n    textActor.SetMapper(textMapper)\n    textActor.SetPosition(10, 400)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('QuadraticTetraDemo')\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 512)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    widget = vtkSliderWidget()\n    MakeWidget(widget, tessellate, textMapper, interactor)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(glyph3DActor)\n    renderer.AddViewProp(textActor)\n    renderer.SetBackground(namedColors.GetColor3d('SlateGray'))\n\n    renderWindow.Render()\n\n    interactor.Start()\n\n\nclass SliderCallbackChordError():\n    def __init__(self, tessellate, textMapper):\n        self.tessellate = tessellate\n        self.textMapper = textMapper\n\n    def __call__(self, caller, ev):\n        sliderWidget = caller\n        value = sliderWidget.GetRepresentation().GetValue()\n        self.tessellate.SetChordError(value)\n        self.tessellate.SetMaximumNumberOfSubdivisions(5)\n        self.tessellate.Update()\n\n        cellMap = dict()\n\n        numTets = 0\n        cell = vtkGenericCell()\n        it = self.tessellate.GetOutput().NewCellIterator()\n        it.InitTraversal()\n        while not it.IsDoneWithTraversal():\n            it.GetCell(cell)\n            cellMap[cell.GetRepresentativeCell().GetClassName()] = numTets\n            numTets += 1\n            it.GoToNextCell()\n        ss = '# of Tetras: ' + str(numTets)\n        self.textMapper.SetInput(ss)\n\n\ndef MakeWidget(widget, tessellate, textMapper, interactor):\n    # Setup a slider widget for each varying parameter\n    tubeWidth = 0.008\n    sliderLength = 0.008\n    titleHeight = 0.04\n    labelHeight = 0.04\n\n    sliderRepChordError = vtkSliderRepresentation2D()\n\n    sliderRepChordError.SetMinimumValue(0.0)\n    sliderRepChordError.SetMaximumValue(0.07)\n    sliderRepChordError.SetValue(tessellate.GetChordError())\n    sliderRepChordError.SetTitleText('Chord error')\n\n    sliderRepChordError.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepChordError.GetPoint1Coordinate().SetValue(0.1, 0.1)\n    sliderRepChordError.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    sliderRepChordError.GetPoint2Coordinate().SetValue(0.9, 0.1)\n\n    sliderRepChordError.SetTubeWidth(tubeWidth)\n    sliderRepChordError.SetSliderLength(sliderLength)\n    sliderRepChordError.SetTitleHeight(titleHeight)\n    sliderRepChordError.SetLabelHeight(labelHeight)\n\n    widget.SetInteractor(interactor)\n    widget.SetRepresentation(sliderRepChordError)\n    widget.SetAnimationModeToAnimate()\n    widget.EnabledOn()\n\n    widget.AddObserver(vtkCommand.InteractionEvent, SliderCallbackChordError(tessellate, textMapper))\n\n\ndef MakeQuadraticTetra():\n    aTetra = vtkQuadraticTetra()\n    points = vtkPoints()\n\n    pcoords = aTetra.GetParametricCoords()\n    rng = vtkMinimalStandardRandomSequence()\n    points.SetNumberOfPoints(aTetra.GetNumberOfPoints())\n    rng.SetSeed(5070)  # for testing\n    for i in range(0, aTetra.GetNumberOfPoints()):\n        perturbation = [0.0] * 3\n        for j in range(0, 3):\n            rng.Next()\n            perturbation[j] = rng.GetRangeValue(-0.2, 0.2)\n        aTetra.GetPointIds().SetId(i, i)\n        points.SetPoint(i, pcoords[3 * i] + perturbation[0],\n                        pcoords[3 * i + 1] + perturbation[1],\n                        pcoords[3 * i + 2] + perturbation[2])\n\n    # Add the points and tetra to an unstructured grid\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(aTetra.GetCellType(), aTetra.GetPointIds())\n\n    return uGrid\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/RegularPolygonSource/","title":"RegularPolygonSource","text":"

        vtk-examples/Python/GeometricObjects/RegularPolygonSource

        "},{"location":"Python/GeometricObjects/RegularPolygonSource/#description","title":"Description","text":"

        This example creates a pentagon.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/RegularPolygonSource/#code","title":"Code","text":"

        RegularPolygonSource.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkPolyData\nfrom vtkmodules.vtkFiltersSources import vtkRegularPolygonSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a pentagon\n    polygonSource = vtkRegularPolygonSource()\n    polygonSource.SetNumberOfSides(5)\n    polygonSource.SetRadius(5)\n    polygonSource.SetCenter(0, 0, 0)\n\n    shrink = vtkShrinkPolyData()\n    shrink.SetInputConnection(polygonSource.GetOutputPort())\n    shrink.SetShrinkFactor(0.9)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(shrink.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d('Tomato'))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetLineWidth(5)\n    actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    actor.SetBackfaceProperty(back)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('RegularPolygonSource')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/ShrinkCube/","title":"ShrinkCube","text":"

        vtk-examples/Python/GeometricObjects/ShrinkCube

        "},{"location":"Python/GeometricObjects/ShrinkCube/#description","title":"Description","text":"

        Generates a cube using vtkCubeSource, then a shrink filter is applied.

        vtkShrinkFilter object shrinks cells composing an arbitrary data set towards their centroid. The centroid of a cell is computed as the average position of the cell points. Shrinking results in disconnecting the cells from one another.

        Seealso

        TessellatedBoxSource generates multiple quads or triangles per side.

        Info

        See Figure 5-17 in Chapter 5 the VTK Textbook.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/ShrinkCube/#code","title":"Code","text":"

        ShrinkCube.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a cube.\n    cubeSource = vtkCubeSource()\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(cubeSource.GetOutputPort())\n    shrink.SetShrinkFactor(0.9)\n\n    # Create a mapper and actor.\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(shrink.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d('Tomato'))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    actor.SetBackfaceProperty(back)\n\n    # Create a renderer, render window, and interactor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    # Render and interact\n    renderWindow.SetWindowName('ShrinkCube')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/SourceObjectsDemo/","title":"SourceObjectsDemo","text":"

        vtk-examples/Python/GeometricObjects/SourceObjectsDemo

        "},{"location":"Python/GeometricObjects/SourceObjectsDemo/#description","title":"Description","text":"

        Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source.

        Info

        See Figure 3-26 in Chapter 3 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/SourceObjectsDemo/#code","title":"Code","text":"

        SourceObjectsDemo.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkCylinderSource,\n    vtkDiskSource,\n    vtkLineSource,\n    vtkPlaneSource,\n    vtkPointSource,\n    vtkSphereSource,\n    vtkTextSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    sourceObjects = list()\n    sourceObjects.append(vtkSphereSource())\n    sourceObjects[-1].SetPhiResolution(21)\n    sourceObjects[-1].SetThetaResolution(21)\n\n    sourceObjects.append(vtkConeSource())\n    sourceObjects[-1].SetResolution(51)\n\n    sourceObjects.append(vtkCylinderSource())\n    sourceObjects[-1].SetResolution(51)\n\n    sourceObjects.append(vtkCubeSource())\n    sourceObjects.append(vtkPlaneSource())\n    sourceObjects.append(vtkTextSource())\n    sourceObjects[-1].SetText('Hello')\n    sourceObjects[-1].BackingOff()\n\n    sourceObjects.append(vtkPointSource())\n    sourceObjects[-1].SetNumberOfPoints(500)\n\n    sourceObjects.append(vtkDiskSource())\n    sourceObjects[-1].SetCircumferentialResolution(51)\n\n    sourceObjects.append(vtkLineSource())\n\n    renderers = list()\n    mappers = list()\n    actors = list()\n    textmappers = list()\n    textactors = list()\n\n    # Create one text property for all.\n    textProperty = vtkTextProperty()\n    textProperty.SetFontSize(16)\n    textProperty.SetJustificationToCentered()\n    textProperty.SetColor(colors.GetColor3d('LightGoldenrodYellow'))\n\n    backProperty = vtkProperty()\n    backProperty.SetColor(colors.GetColor3d('Tomato'))\n\n    # Create a source, renderer, mapper, and actor\n    # for each object.\n    for i in range(0, len(sourceObjects)):\n        mappers.append(vtkPolyDataMapper())\n        mappers[i].SetInputConnection(sourceObjects[i].GetOutputPort())\n\n        actors.append(vtkActor())\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n        actors[i].SetBackfaceProperty(backProperty)\n\n        textmappers.append(vtkTextMapper())\n        textmappers[i].SetInput(sourceObjects[i].GetClassName())\n        textmappers[i].SetTextProperty(textProperty)\n\n        textactors.append(vtkActor2D())\n        textactors[i].SetMapper(textmappers[i])\n        textactors[i].SetPosition(120, 16)\n        renderers.append(vtkRenderer())\n\n    gridDimensions = 3\n\n    # We need a renderer even if there is no actor.\n    for i in range(len(sourceObjects), gridDimensions ** 2):\n        renderers.append(vtkRenderer())\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('SourceObjectsDemo')\n    rendererSize = 300\n    renderWindow.SetSize(rendererSize * gridDimensions, rendererSize * gridDimensions)\n\n    for row in range(0, gridDimensions):\n        for col in range(0, gridDimensions):\n            index = row * gridDimensions + col\n            x0 = float(col) / gridDimensions\n            y0 = float(gridDimensions - row - 1) / gridDimensions\n            x1 = float(col + 1) / gridDimensions\n            y1 = float(gridDimensions - row) / gridDimensions\n            renderWindow.AddRenderer(renderers[index])\n            renderers[index].SetViewport(x0, y0, x1, y1)\n\n            if index > (len(sourceObjects) - 1):\n                continue\n\n            renderers[index].AddActor(actors[index])\n            renderers[index].AddActor(textactors[index])\n            renderers[index].SetBackground(colors.GetColor3d('BkgColor'))\n            renderers[index].ResetCamera()\n            renderers[index].GetActiveCamera().Azimuth(30)\n            renderers[index].GetActiveCamera().Elevation(30)\n            renderers[index].GetActiveCamera().Zoom(0.8)\n            renderers[index].ResetCameraClippingRange()\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Sphere/","title":"Sphere","text":"

        vtk-examples/Python/GeometricObjects/Sphere

        "},{"location":"Python/GeometricObjects/Sphere/#description","title":"Description","text":"

        vtkSphereSource object creates a sphere (represented by polygons) of specified radius centered at the origin.

        The resolution (polygonal discretization) in both the latitude (phi) and longitude (theta) directions can be specified.

        It also is possible to create partial spheres by specifying maximum phi and theta angles. By default, the surface tessellation of the sphere uses triangles; however you can set LatLongTessellation to produce a tessellation using quadrilaterals.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Sphere/#code","title":"Code","text":"

        Sphere.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(5.0)\n    # Make the surface smooth.\n    sphereSource.SetPhiResolution(100)\n    sphereSource.SetThetaResolution(100)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphereSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Cornsilk\"))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Sphere\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d(\"DarkGreen\"))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/TessellatedBoxSource/","title":"TessellatedBoxSource","text":"

        vtk-examples/Python/GeometricObjects/TessellatedBoxSource

        "},{"location":"Python/GeometricObjects/TessellatedBoxSource/#description","title":"Description","text":"

        Generates a box(cube) using vtkTessellatedBoxSource with 6 sides. The faces of the box can be subdivided into multiple triangles or quads.

        Seealso

        Cube generates multiple quads or triangles per side.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/TessellatedBoxSource/#code","title":"Code","text":"

        TessellatedBoxSource.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonExecutionModel import vtkAlgorithm\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersSources import vtkTessellatedBoxSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    bounds = [-10.0, 10.0, 10.0, 20.0, -5.0, 5.0]\n\n    boxSource = vtkTessellatedBoxSource()\n    boxSource.SetLevel(3)\n    boxSource.QuadsOn()\n    boxSource.SetBounds(bounds)\n    boxSource.SetOutputPointsPrecision(vtkAlgorithm.SINGLE_PRECISION)\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(boxSource.GetOutputPort())\n    shrink.SetShrinkFactor(.8)\n\n    # Create a mapper and actor.\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(shrink.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d('Tomato'))\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    actor.SetBackfaceProperty(back)\n\n    # Create a renderer, render window, and interactor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene.\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    # Render and interact.\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('TessellatedBoxSource')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Tetrahedron/","title":"Tetrahedron","text":"

        vtk-examples/Python/GeometricObjects/Tetrahedron

        "},{"location":"Python/GeometricObjects/Tetrahedron/#description","title":"Description","text":"

        Tetrahedron. The tetrahedron is a primary three-dimensional cell. The tetrahedron is defined by a list of four nonplanar points. The tetrahedron has six edges and four triangular faces.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Tetrahedron/#code","title":"Code","text":"

        Tetrahedron.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_TETRA,\n    vtkCellArray,\n    vtkTetra,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(0, 1, 1)\n\n    points.InsertNextPoint(2, 2, 2)\n    points.InsertNextPoint(3, 2, 2)\n    points.InsertNextPoint(3, 3, 2)\n    points.InsertNextPoint(2, 3, 3)\n\n    # The first tetrahedron\n    unstructuredGrid1 = vtkUnstructuredGrid()\n    unstructuredGrid1.SetPoints(points)\n\n    tetra = vtkTetra()\n\n    tetra.GetPointIds().SetId(0, 0)\n    tetra.GetPointIds().SetId(1, 1)\n    tetra.GetPointIds().SetId(2, 2)\n    tetra.GetPointIds().SetId(3, 3)\n\n    cellArray = vtkCellArray()\n    cellArray.InsertNextCell(tetra)\n    unstructuredGrid1.SetCells(VTK_TETRA, cellArray)\n\n    # The second tetrahedron\n    unstructuredGrid2 = vtkUnstructuredGrid()\n    unstructuredGrid2.SetPoints(points)\n\n    tetra = vtkTetra()\n\n    tetra.GetPointIds().SetId(0, 4)\n    tetra.GetPointIds().SetId(1, 5)\n    tetra.GetPointIds().SetId(2, 6)\n    tetra.GetPointIds().SetId(3, 7)\n\n    cellArray = vtkCellArray()\n    cellArray.InsertNextCell(tetra)\n    unstructuredGrid2.SetCells(VTK_TETRA, cellArray)\n\n    # Create a mapper and actor\n    mapper1 = vtkDataSetMapper()\n    mapper1.SetInputData(unstructuredGrid1)\n\n    actor1 = vtkActor()\n    actor1.SetMapper(mapper1)\n    actor1.GetProperty().SetColor(colors.GetColor3d(\"Cyan\"))\n\n    # Create a mapper and actor\n    mapper2 = vtkDataSetMapper()\n    mapper2.SetInputData(unstructuredGrid2)\n\n    actor2 = vtkActor()\n    actor2.SetMapper(mapper2)\n    actor2.GetProperty().SetColor(colors.GetColor3d(\"Yellow\"))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Tetrahedron\")\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor1)\n    renderer.AddActor(actor2)\n    renderer.SetBackground(colors.GetColor3d(\"DarkGreen\"))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(-10)\n    renderer.GetActiveCamera().Elevation(-20)\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/TextActor/","title":"TextActor","text":"

        vtk-examples/Python/GeometricObjects/TextActor

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/TextActor/#code","title":"Code","text":"

        TextActor.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextActor\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a rendering window and renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName('TextActor')\n    renWin.AddRenderer(ren)\n\n    # Create a render window interactor.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create a text actor.\n    txt = vtkTextActor()\n    txt.SetInput('Hello World!')\n    txtprop = txt.GetTextProperty()\n    txtprop.SetFontFamilyToArial()\n    txtprop.BoldOn()\n    txtprop.SetFontSize(36)\n    txtprop.ShadowOn()\n    txtprop.SetShadowOffset(4, 4)\n    txtprop.SetColor(colors.GetColor3d('Cornsilk'))\n    txt.SetDisplayPosition(20, 30)\n\n    # Assign actor to the renderer.\n    ren.AddActor(txt)\n    ren.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    # Enable user interface interactor.\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Triangle/","title":"Triangle","text":"

        vtk-examples/Python/GeometricObjects/Triangle

        "},{"location":"Python/GeometricObjects/Triangle/#description","title":"Description","text":"

        The triangle is a primary two-dimensional cell. The triangle is defined by a counterclockwise ordered list of three points. The order of the points specifies the direction of the surface normal using the right-hand rule.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Triangle/#code","title":"Code","text":"

        Triangle.py

        # !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangle\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a triangle\n    points = vtkPoints()\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    triangle = vtkTriangle()\n    triangle.GetPointIds().SetId(0, 0)\n    triangle.GetPointIds().SetId(1, 1)\n    triangle.GetPointIds().SetId(2, 2)\n\n    triangles = vtkCellArray()\n    triangles.InsertNextCell(triangle)\n\n    # Create a polydata object\n    trianglePolyData = vtkPolyData()\n\n    # Add the geometry and topology to the polydata\n    trianglePolyData.SetPoints(points)\n    trianglePolyData.SetPolys(triangles)\n\n    # Create mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(trianglePolyData)\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and an interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Triangle')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/TriangleStrip/","title":"TriangleStrip","text":"

        vtk-examples/Python/GeometricObjects/TriangleStrip

        "},{"location":"Python/GeometricObjects/TriangleStrip/#description","title":"Description","text":"

        The triangle strip is a composite two-dimensional cell consisting of one or more triangles. The points defining the triangle strip need not lie in a plane. The triangle strip is defined by an ordered list of n+2 points, where n is the number of triangles. The ordering of the points is such that each set of three points defines a triangle.

        Info

        See this wikipedia article for an explanation.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/TriangleStrip/#code","title":"Code","text":"

        TriangleStrip.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangleStrip\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(1.5, 1, 0)\n\n    triangleStrip = vtkTriangleStrip()\n    triangleStrip.GetPointIds().SetNumberOfIds(4)\n    triangleStrip.GetPointIds().SetId(0, 0)\n    triangleStrip.GetPointIds().SetId(1, 1)\n    triangleStrip.GetPointIds().SetId(2, 2)\n    triangleStrip.GetPointIds().SetId(3, 3)\n\n    cells = vtkCellArray()\n    cells.InsertNextCell(triangleStrip)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n    polydata.SetStrips(cells)\n\n    # Create an actor and mapper\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(polydata)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n    actor.GetProperty().SetRepresentationToWireframe()\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('TriangleStrip')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/GeometricObjects/Vertex/","title":"Vertex","text":"

        vtk-examples/Python/GeometricObjects/Vertex

        "},{"location":"Python/GeometricObjects/Vertex/#description","title":"Description","text":"

        The vertex is a primary zero-dimensional cell. It is defined by a single point.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/GeometricObjects/Vertex/#code","title":"Code","text":"

        Vertex.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkVertex\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n\n    vertex = vtkVertex()\n    vertex.GetPointIds().SetId(0, 0)\n\n    vertices = vtkCellArray()\n    vertices.InsertNextCell(vertex)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n    polydata.SetVerts(vertices)\n\n    # Setup actor and mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polydata)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetPointSize(30)\n    actor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # Setup render window, renderer, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('Vertex')\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/ColorEdges/","title":"ColorEdges","text":"

        vtk-examples/Python/Graphs/ColorEdges

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/ColorEdges/#code","title":"Code","text":"

        ColorEdges.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkIntArray,\n    vtkLookupTable\n)\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkViewsCore import vtkViewTheme\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    graph = vtkMutableDirectedGraph()\n    # Create a graph\n    v1 = graph.AddVertex()\n    v2 = graph.AddVertex()\n    v3 = graph.AddVertex()\n\n    graph.AddGraphEdge(v1, v2)\n    graph.AddGraphEdge(v2, v3)\n\n    # Create the color array\n    edgeColors = vtkIntArray()\n    edgeColors.SetNumberOfComponents(1)\n    edgeColors.SetName('Color')\n\n    lookupTable = vtkLookupTable()\n    lookupTable.SetNumberOfTableValues(2)\n    lookupTable.SetTableValue(0, colors.GetColor4d('Red'))\n    lookupTable.SetTableValue(1, colors.GetColor4d('Lime'))\n    lookupTable.Build()\n\n    edgeColors.InsertNextValue(0)\n    edgeColors.InsertNextValue(1)\n\n    # Add the color array to the graph\n    graph.GetEdgeData().AddArray(edgeColors)\n\n    graphLayoutView = vtkGraphLayoutView()\n    graphLayoutView.AddRepresentationFromInput(graph)\n    graphLayoutView.SetLayoutStrategy('Simple 2D')\n    graphLayoutView.GetLayoutStrategy().SetEdgeWeightField('Graphs')\n    graphLayoutView.GetLayoutStrategy().SetWeightEdges(1)\n    graphLayoutView.SetEdgeColorArrayName('Color')\n    graphLayoutView.SetEdgeLabelVisibility(1)\n    graphLayoutView.ColorEdgesOn()\n\n    theme = vtkViewTheme()\n    theme.SetCellLookupTable(lookupTable)\n\n    graphLayoutView.ApplyViewTheme(theme)\n    graphLayoutView.ResetCamera()\n    graphLayoutView.GetRenderer().GetActiveCamera().Zoom(0.8)\n    graphLayoutView.Render()\n    graphLayoutView.GetLayoutStrategy().SetRandomSeed(0)\n    graphLayoutView.GetInteractor().Initialize()\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/ColorVertexLabels/","title":"ColorVertexLabels","text":"

        vtk-examples/Python/Graphs/ColorVertexLabels

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/ColorVertexLabels/#code","title":"Code","text":"

        ColorVertexLabels.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIntArray\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkViewsInfovis import (\n    vtkGraphLayoutView,\n    vtkRenderedGraphRepresentation\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a graph\n    graph = vtkMutableDirectedGraph()\n\n    v1 = graph.AddVertex()\n    v2 = graph.AddVertex()\n    graph.AddEdge(v1, v2)\n\n    # Create an array for the vertex labels\n    vertexIDs = vtkIntArray()\n    vertexIDs.SetNumberOfComponents(1)\n    vertexIDs.SetName('VertexIDs')\n\n    # Set the vertex labels\n    vertexIDs.InsertNextValue(0)\n    vertexIDs.InsertNextValue(1)\n\n    # Add the array to the graph\n    graph.GetVertexData().AddArray(vertexIDs)\n\n    graphLayoutView = vtkGraphLayoutView()\n    graphLayoutView.AddRepresentationFromInput(graph)\n    graphLayoutView.SetVertexLabelVisibility(1)\n\n    rGraph = vtkRenderedGraphRepresentation()\n    rGraph.SafeDownCast(graphLayoutView.GetRepresentation()).GetVertexLabelTextProperty().SetColor(\n        colors.GetColor3d('Red'))\n    graphLayoutView.SetLayoutStrategyToSimple2D()\n    graphLayoutView.SetVertexLabelArrayName('VertexIDs')\n    graphLayoutView.SetVertexLabelVisibility(True)\n    graphLayoutView.ResetCamera()\n    graphLayoutView.GetRenderer().GetActiveCamera().Zoom(0.8)\n    graphLayoutView.Render()\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/ColorVerticesLookupTable/","title":"ColorVerticesLookupTable","text":"

        vtk-examples/Python/Graphs/ColorVerticesLookupTable

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/ColorVerticesLookupTable/#code","title":"Code","text":"

        ColorVerticesLookupTable.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkIntArray,\n    vtkLookupTable,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkViewsCore import vtkViewTheme\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a graph\n    graph = vtkMutableDirectedGraph()\n\n    v1 = graph.AddVertex()\n    v2 = graph.AddVertex()\n    v3 = graph.AddVertex()\n    graph.AddEdge(v1, v2)\n    graph.AddEdge(v2, v3)\n\n    # Manually set the position of the vertices\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(2, 0, 0)\n\n    graph.SetPoints(points)\n\n    # Create the color array\n    vertexColors = vtkIntArray()\n    vertexColors.SetNumberOfComponents(1)\n    vertexColors.SetName('Color')\n\n    lookupTable = vtkLookupTable()\n    lookupTable.SetNumberOfTableValues(3)\n    lookupTable.SetTableValue(0, colors.GetColor4d('Red'))\n    lookupTable.SetTableValue(1, colors.GetColor4d('White'))\n    lookupTable.SetTableValue(2, colors.GetColor4d('Lime'))\n    lookupTable.Build()\n\n    vertexColors.InsertNextValue(0)\n    vertexColors.InsertNextValue(1)\n    vertexColors.InsertNextValue(2)\n\n    # Add the color array to the graph\n    graph.GetVertexData().AddArray(vertexColors)\n\n    # Visualize\n    graphLayoutView = vtkGraphLayoutView()\n    graphLayoutView.AddRepresentationFromInput(graph)\n    graphLayoutView.SetLayoutStrategyToPassThrough()\n    graphLayoutView.SetVertexColorArrayName('Color')\n    graphLayoutView.ColorVerticesOn()\n\n    theme = vtkViewTheme()\n    theme.SetPointLookupTable(lookupTable)\n\n    graphLayoutView.ApplyViewTheme(theme)\n    graphLayoutView.ResetCamera()\n    graphLayoutView.GetInteractor().Initialize()\n    graphLayoutView.GetRenderer().GetActiveCamera().Zoom(0.8)\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/ConstructGraph/","title":"ConstructGraph","text":"

        vtk-examples/Python/Graphs/ConstructGraph

        "},{"location":"Python/Graphs/ConstructGraph/#description","title":"Description","text":"

        This example shows how to construct a simple graph.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/ConstructGraph/#code","title":"Code","text":"

        ConstructGraph.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkMutableUndirectedGraph\nfrom vtkmodules.vtkInfovisLayout import vtkForceDirectedLayoutStrategy\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    g = vtkMutableUndirectedGraph()\n\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n\n    g.AddEdge(v1, v2)\n    print('Number of vertices:', g.GetNumberOfVertices())\n    print('Number of edges:', g.GetNumberOfEdges())\n\n    g.AddEdge(v1, v2)\n    print('Number of vertices:', g.GetNumberOfVertices())\n    print('Number of edges:', g.GetNumberOfEdges())\n\n    force_directed = vtkForceDirectedLayoutStrategy()\n\n    graph_layout_view = vtkGraphLayoutView()\n    graph_layout_view.AddRepresentationFromInput(g)\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view.SetLayoutStrategy(force_directed)\n    graph_layout_view.SetLayoutStrategyToForceDirected()\n    graph_layout_view.ResetCamera()\n    graph_layout_view.GetRenderer().SetBackground(colors.GetColor3d('Navy'))\n    graph_layout_view.GetRenderer().SetBackground2(colors.GetColor3d('MidnightBlue'))\n    graph_layout_view.GetRenderWindow().SetWindowName('ConstructGraph')\n    graph_layout_view.Render()\n    graph_layout_view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/ConstructTree/","title":"ConstructTree","text":"

        vtk-examples/Python/Graphs/ConstructTree

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/ConstructTree/#code","title":"Code","text":"

        ConstructTree.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkMutableDirectedGraph,\n    vtkTree\n)\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    graph = vtkMutableDirectedGraph()\n\n    v1 = graph.AddVertex()\n    v2 = graph.AddChild(v1)\n    graph.AddChild(v1)\n    graph.AddChild(v2)\n\n    # equivalent to:\n    # V1 = g.AddVertex()\n    # V2 = g.AddVertex()\n    # V3 = g.AddVertex()\n    # V4 = g.AddVertex()\n\n    # g.AddEdge ( V1, V2 )\n    # g.AddEdge ( V1, V3 )\n    # g.AddEdge ( V2, V4 )\n\n    tree = vtkTree()\n    success = tree.CheckedShallowCopy(graph)\n    print('Success?', success)\n    # std::cout << 'Success? ' << success << std::endl\n\n    treeLayoutView = vtkGraphLayoutView()\n    treeLayoutView.AddRepresentationFromInput(tree)\n    treeLayoutView.SetLayoutStrategyToTree()\n    treeLayoutView.ResetCamera()\n    treeLayoutView.Render()\n    treeLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/CreateTree/","title":"CreateTree","text":"

        vtk-examples/Python/Graphs/CreateTree

        "},{"location":"Python/Graphs/CreateTree/#description","title":"Description","text":"

        We create the tree, and label the vertices and edges.

        Info

        This is an update of the original example found in vtk/Examples/Infovis/Cxx/CreateTree.cxx.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/CreateTree/#code","title":"Code","text":"

        CreateTree.py

        #!/usr/bin/env python\n\n# This example creates a tree and labels the vertices and edges.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkStringArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkMutableDirectedGraph,\n    vtkTree\n)\nfrom vtkmodules.vtkViewsCore import vtkViewTheme\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    graph = vtkMutableDirectedGraph()\n\n    a = graph.AddVertex()\n    b = graph.AddChild(a)\n    c = graph.AddChild(a)\n    d = graph.AddChild(b)\n    e = graph.AddChild(c)\n    f = graph.AddChild(c)\n\n    vertex_labels = vtkStringArray()\n    vertex_labels.SetName('VertexLabel')\n    vertex_labels.InsertValue(a, 'a')\n    vertex_labels.InsertValue(b, 'b')\n    vertex_labels.InsertValue(c, 'c')\n    vertex_labels.InsertValue(d, 'd')\n    vertex_labels.InsertValue(e, 'e')\n    vertex_labels.InsertValue(f, 'f')\n    graph.GetVertexData().AddArray(vertex_labels)\n    edge_labels = vtkStringArray()\n    edge_labels.SetName('EdgeLabel')\n    edge_labels.InsertValue(graph.GetEdgeId(a, b), 'a -> b')\n    edge_labels.InsertValue(graph.GetEdgeId(a, c), 'a -> c')\n    edge_labels.InsertValue(graph.GetEdgeId(b, d), 'b -> d')\n    edge_labels.InsertValue(graph.GetEdgeId(c, e), 'c -> e')\n    edge_labels.InsertValue(graph.GetEdgeId(c, f), 'c -> f')\n    graph.GetEdgeData().AddArray(edge_labels)\n\n    tree = vtkTree()\n    valid_tree = tree.CheckedShallowCopy(graph)\n    if not valid_tree:\n        print('Invalid tree')\n        return\n\n    view = vtkGraphLayoutView()\n    view.SetRepresentationFromInput(tree)\n    # Apply a theme to the views\n    theme = vtkViewTheme()\n    view.ApplyViewTheme(theme.CreateMellowTheme())\n    view.SetVertexColorArrayName('VertexDegree')\n    view.SetColorVertices(True)\n    view.SetVertexLabelArrayName('VertexLabel')\n    view.SetVertexLabelVisibility(True)\n    view.SetEdgeLabelArrayName('EdgeLabel')\n    view.SetEdgeLabelVisibility(True)\n    view.SetLayoutStrategyToTree()\n\n    view.ResetCamera()\n    view.GetRenderWindow().SetSize(600, 600)\n    view.GetRenderWindow().SetWindowName('CreateTree')\n    view.GetRenderWindow().Render()\n    view.GetInteractor().Initialize()\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/EdgeWeights/","title":"EdgeWeights","text":"

        vtk-examples/Python/Graphs/EdgeWeights

        "},{"location":"Python/Graphs/EdgeWeights/#description","title":"Description","text":"
        • Contributed by Jim McCusker

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/EdgeWeights/#code","title":"Code","text":"

        EdgeWeights.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkInfovisLayout import vtkForceDirectedLayoutStrategy\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    g = vtkMutableDirectedGraph()\n\n    # Create 3 vertices\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n    v3 = g.AddVertex()\n\n    # Create a fully connected graph\n    g.AddGraphEdge(v1, v2)\n    g.AddGraphEdge(v2, v3)\n    g.AddGraphEdge(v1, v3)\n\n    # Create the edge weight array\n    weights = vtkDoubleArray()\n    weights.SetNumberOfComponents(1)\n    weights.SetName('Weights')\n\n    # Set the edge weights\n    weights.InsertNextValue(1.0)\n    weights.InsertNextValue(1.0)\n    weights.InsertNextValue(2.0)\n\n    # Add the edge weight array to the graph\n    g.GetEdgeData().AddArray(weights)\n\n    print('Number of edges:', g.GetNumberOfEdges())\n\n    force_directed = vtkForceDirectedLayoutStrategy()\n\n    graph_layout_view = vtkGraphLayoutView()\n    graph_layout_view.AddRepresentationFromInput(g)\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view.SetLayoutStrategy(force_directed)\n    graph_layout_view.SetLayoutStrategyToForceDirected()\n    graph_layout_view.AddRepresentationFromInput(g)\n    graph_layout_view.GetLayoutStrategy().SetEdgeWeightField('Weights')\n    graph_layout_view.GetLayoutStrategy().SetWeightEdges(1)\n    graph_layout_view.SetEdgeLabelArrayName('Weights')\n    graph_layout_view.EdgeLabelVisibilityOn()\n    graph_layout_view.GetRenderer().SetBackground(colors.GetColor3d('Navy'))\n    graph_layout_view.GetRenderer().SetBackground2(colors.GetColor3d('MidnightBlue'))\n    graph_layout_view.GetRenderWindow().SetWindowName('EdgeWeights')\n    graph_layout_view.ResetCamera()\n    graph_layout_view.Render()\n    graph_layout_view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/GraphToPolyData/","title":"GraphToPolyData","text":"

        vtk-examples/Python/Graphs/GraphToPolyData

        "},{"location":"Python/Graphs/GraphToPolyData/#description","title":"Description","text":"

        This example creates a simple graph and then converts it to a polydata for visualization using Paraview.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/GraphToPolyData/#code","title":"Code","text":"

        GraphToPolyData.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkMutableUndirectedGraph\nfrom vtkmodules.vtkFiltersSources import vtkGraphToPolyData\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Create a graph\n    g = vtkMutableUndirectedGraph()\n\n    # Add 4 vertices to the graph\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n    v3 = g.AddVertex()\n    v4 = g.AddVertex()\n\n    # Add 3 edges to the graph\n    g.AddEdge(v1, v2)\n    g.AddEdge(v1, v3)\n    g.AddEdge(v1, v4)\n\n    # Create 4 points - one for each vertex\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n    points.InsertNextPoint(0.0, 0.0, 1.0)\n\n    # Add the coordinates of the points to the graph\n    g.SetPoints(points)\n\n    # Convert the graph to a polydata\n    graphToPolyData = vtkGraphToPolyData()\n    graphToPolyData.SetInputData(g)\n    graphToPolyData.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(graphToPolyData.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Green'))\n\n    # Render and interact\n    renderWindow.SetWindowName('GraphToPolyData')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/LabelVerticesAndEdges/","title":"LabelVerticesAndEdges","text":"

        vtk-examples/Python/Graphs/LabelVerticesAndEdges

        "},{"location":"Python/Graphs/LabelVerticesAndEdges/#description","title":"Description","text":"

        This example sets and displays labels of vertices and edges of a graph.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/LabelVerticesAndEdges/#code","title":"Code","text":"

        LabelVerticesAndEdges.py

        #!/usr/bin/env python\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkIntArray\n)\nfrom vtkmodules.vtkCommonDataModel import vtkMutableUndirectedGraph\nfrom vtkmodules.vtkInfovisLayout import vtkCircularLayoutStrategy\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    g = vtkMutableUndirectedGraph()\n\n    # Create 3 vertices\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n    v3 = g.AddVertex()\n\n    # Create a fully connected graph\n    g.AddEdge(v1, v2)\n    g.AddEdge(v2, v3)\n    g.AddEdge(v1, v3)\n\n    # Create the edge weight array\n    weights = vtkDoubleArray()\n    weights.SetNumberOfComponents(1)\n    weights.SetName('Weights')\n\n    # Set the edge weights\n    weights.InsertNextValue(1.0)\n    weights.InsertNextValue(1.0)\n    weights.InsertNextValue(2.0)\n\n    # Create an array for the vertex labels\n    vertexIDs = vtkIntArray()\n    vertexIDs.SetNumberOfComponents(1)\n    vertexIDs.SetName('VertexIDs')\n\n    # Set the vertex labels\n    vertexIDs.InsertNextValue(0)\n    vertexIDs.InsertNextValue(1)\n    vertexIDs.InsertNextValue(2)\n\n    # Add the edge weight array to the graph\n    g.GetEdgeData().AddArray(weights)\n    g.GetVertexData().AddArray(vertexIDs)\n\n    circularLayoutStrategy = vtkCircularLayoutStrategy()\n\n    graphLayoutView = vtkGraphLayoutView()\n    graphLayoutView.AddRepresentationFromInput(g)\n\n    graphLayoutView.SetLayoutStrategy(circularLayoutStrategy)\n    graphLayoutView.SetVertexLabelVisibility(1)\n    graphLayoutView.SetEdgeLabelVisibility(1)\n    graphLayoutView.SetEdgeLabelArrayName('Weights')  # default is 'labels'\n    graphLayoutView.SetVertexLabelArrayName('VertexIDs')  # default is 'labels'\n    graphLayoutView.GetRepresentation().GetVertexLabelTextProperty().SetColor(\n        colors.GetColor3d('Yellow'))\n    graphLayoutView.GetRepresentation().GetEdgeLabelTextProperty().SetColor(\n        colors.GetColor3d('Lime'))\n    graphLayoutView.ResetCamera()\n    graphLayoutView.Render()\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/NOVCAGraph/","title":"NOVCAGraph","text":"

        vtk-examples/Python/Graphs/NOVCAGraph

        "},{"location":"Python/Graphs/NOVCAGraph/#description","title":"Description","text":"
        • This example shows how to construct a graph to visualize it in ParaView/VisIt using the VTK output file testVertex.vtu.

        • Contributed by Sanjaya Gajurel, Case Western Reserve University

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/NOVCAGraph/#code","title":"Code","text":"

        NOVCAGraph.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import (\n    vtkIntArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_LINE,\n    vtkCellArray,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOXML import vtkXMLUnstructuredGridWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Building a graph using Unstructured Grid & dumping it into a vtk file.'\n    epilogue = '''\n        Building a graph using Unstructured Grid & dumping it into a vtk file, to be visualized using ParaView.\n\n        The generated file can then be used in ParaView/VisIt.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtk filename, e.g. vertex.vtu.', nargs='?', const='vertex.vtu',\n                        type=str, default='testVertex.vtu')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    fn = get_program_parameters()\n\n    pointSource = vtkPointSource()\n    pointSource.Update()\n\n    # Create an integer array to store vertex id data & link it with its degree value as a scalar.\n    degree = vtkIntArray()\n    degree.SetNumberOfComponents(1)\n    degree.SetName('degree')\n    degree.SetNumberOfTuples(7)\n    degree.SetValue(0, 2)\n    degree.SetValue(1, 1)\n    degree.SetValue(2, 3)\n    degree.SetValue(3, 3)\n    degree.SetValue(4, 4)\n    degree.SetValue(5, 2)\n    degree.SetValue(6, 1)\n\n    pointSource.GetOutput().GetPointData().AddArray(degree)\n\n    # Assign co-ordinates for vertices\n    Points = vtkPoints()\n    Points.InsertNextPoint(0, 1, 0)\n    Points.InsertNextPoint(0, 0, 0)\n    Points.InsertNextPoint(1, 1, 0)\n    Points.InsertNextPoint(1, 0, 0)\n    Points.InsertNextPoint(2, 1, 0)\n    Points.InsertNextPoint(2, 0, 0)\n    Points.InsertNextPoint(3, 0, 0)\n\n    # Establish the specified edges using CellArray\n    line = vtkCellArray()\n    line.Allocate(8)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(0)\n    line.InsertCellPoint(1)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(0)\n    line.InsertCellPoint(2)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(2)\n    line.InsertCellPoint(3)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(2)\n    line.InsertCellPoint(4)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(3)\n    line.InsertCellPoint(4)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(3)\n    line.InsertCellPoint(5)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(4)\n    line.InsertCellPoint(5)\n    line.InsertNextCell(2)\n    line.InsertCellPoint(4)\n    line.InsertCellPoint(6)\n\n    # Add the vertices and edges to unstructured Grid\n    G = vtkUnstructuredGrid()\n    G.GetPointData().SetScalars(degree)\n    G.SetPoints(Points)\n    G.SetCells(VTK_LINE, line)\n\n    # Dump the graph in VTK unstructured format (.vtu)\n    gw = vtkXMLUnstructuredGridWriter()\n    gw.SetFileName(fn)\n    gw.SetInputData(G)\n    gw.Write()\n    print('---> ')\n\n    print('Feed the vertex.vtu file in ParaView/VisIt.')\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/RandomGraphSource/","title":"RandomGraphSource","text":"

        vtk-examples/Python/Graphs/RandomGraphSource

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/RandomGraphSource/#code","title":"Code","text":"

        RandomGraphSource.py

        #!/usr/bin/env python\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkInfovisCore import vtkRandomGraphSource\nfrom vtkmodules.vtkInfovisLayout import vtkForceDirectedLayoutStrategy\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    random_graph_source = vtkRandomGraphSource()\n    random_graph_source.SetNumberOfVertices(5)\n    random_graph_source.SetNumberOfEdges(4)\n    # This ensures repeatable results for testing. Turn this off for real use.\n    random_graph_source.SetSeed(123)\n    random_graph_source.Update()\n\n    force_directed = vtkForceDirectedLayoutStrategy()\n\n    graph_layout_view = vtkGraphLayoutView()\n    graph_layout_view.AddRepresentationFromInput(random_graph_source.GetOutput())\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view.SetLayoutStrategy(force_directed)\n    graph_layout_view.SetLayoutStrategyToForceDirected()\n    graph_layout_view.GetRenderer().SetBackground(colors.GetColor3d('Navy'))\n    graph_layout_view.GetRenderer().SetBackground2(colors.GetColor3d('MidnightBlue'))\n    graph_layout_view.GetRenderWindow().SetWindowName('RandomGraphSource')\n    graph_layout_view.Render()\n    graph_layout_view.ResetCamera()\n    graph_layout_view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/ScaleVertices/","title":"ScaleVertices","text":"

        vtk-examples/Python/Graphs/ScaleVertices

        "},{"location":"Python/Graphs/ScaleVertices/#description","title":"Description","text":"

        Scale the vertices based on a data array.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/ScaleVertices/#code","title":"Code","text":"

        ScaleVertices.py

        #!/usr/bin/env python\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkIntArray,\n    vtkLookupTable\n)\nfrom vtkmodules.vtkCommonDataModel import vtkMutableUndirectedGraph\nfrom vtkmodules.vtkInfovisLayout import vtkForceDirectedLayoutStrategy\nfrom vtkmodules.vtkRenderingCore import vtkGraphToGlyphs\nfrom vtkmodules.vtkViewsCore import vtkViewTheme\nfrom vtkmodules.vtkViewsInfovis import (\n    vtkGraphLayoutView,\n    vtkRenderedGraphRepresentation\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    g = vtkMutableUndirectedGraph()\n\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n\n    g.AddEdge(v1, v2)\n    g.AddEdge(v1, v2)\n\n    scales = vtkFloatArray()\n    scales.SetNumberOfComponents(1)\n    scales.SetName('Scales')\n    scales.InsertNextValue(2.0)\n    scales.InsertNextValue(5.0)\n\n    # Add the scale array to the graph\n    g.GetVertexData().AddArray(scales)\n\n    # Create the color array\n    vertexColors = vtkIntArray()\n    vertexColors.SetNumberOfComponents(1)\n    vertexColors.SetName('Color')\n\n    lookupTable = vtkLookupTable()\n    lookupTable.SetNumberOfTableValues(2)\n    lookupTable.SetTableValue(0, colors.GetColor4d('Yellow'))\n    lookupTable.SetTableValue(1, colors.GetColor4d('Lime'))\n    lookupTable.Build()\n\n    vertexColors.InsertNextValue(0)\n    vertexColors.InsertNextValue(1)\n\n    # Add the color array to the graph\n    g.GetVertexData().AddArray(vertexColors)\n\n    theme = vtkViewTheme()\n    theme.SetPointLookupTable(lookupTable)\n\n    force_directed = vtkForceDirectedLayoutStrategy()\n\n    layout_view = vtkGraphLayoutView()\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view.SetLayoutStrategy(force_directed)\n    layout_view.SetLayoutStrategyToForceDirected()\n    layout_view.AddRepresentationFromInput(g)\n    layout_view.ApplyViewTheme(theme)\n    layout_view.ScaledGlyphsOn()\n    layout_view.SetScalingArrayName('Scales')\n    layout_view.SetVertexColorArrayName('Color')\n    layout_view.ColorVerticesOn()\n    rGraph = vtkRenderedGraphRepresentation()\n    gGlyph = vtkGraphToGlyphs()\n    rGraph.SafeDownCast(layout_view.GetRepresentation()).SetGlyphType(gGlyph.CIRCLE)\n    layout_view.GetRenderer().SetBackground(colors.GetColor3d('Navy'))\n    layout_view.GetRenderer().SetBackground2(colors.GetColor3d('MidnightBlue'))\n    layout_view.GetRenderWindow().SetWindowName('ScaleVertices')\n    layout_view.Render()\n    layout_view.ResetCamera()\n    layout_view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/SelectedVerticesAndEdges/","title":"SelectedVerticesAndEdges","text":"

        vtk-examples/Python/Graphs/SelectedVerticesAndEdges

        "},{"location":"Python/Graphs/SelectedVerticesAndEdges/#description","title":"Description","text":"
        • Contributed by Eric Monson

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/SelectedVerticesAndEdges/#code","title":"Code","text":"

        SelectedVerticesAndEdges.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkInfovisCore import vtkRandomGraphSource\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\nsource = vtkRandomGraphSource()\nsource.Update()\n\nview = vtkGraphLayoutView()\nview.AddRepresentationFromInputConnection(source.GetOutputPort())\n\n\ndef selectionCallback(caller, event):\n    # In C++ there is some extra data passed to the callback, but in Python\n    # the callback data is lost...\n\n    # There should be two selection nodes, but which one is vertices and which\n    # is edges does not seem to be guaranteed...\n    sel = caller.GetCurrentSelection()\n    node0 = sel.GetNode(0)\n    node0_field_type = node0.GetFieldType()\n    sel_list0 = caller.GetCurrentSelection().GetNode(0).GetSelectionList()\n    node1 = sel.GetNode(1)\n    node1_field_type = node1.GetFieldType()\n    sel_list1 = caller.GetCurrentSelection().GetNode(1).GetSelectionList()\n\n    if (sel_list0.GetNumberOfTuples() > 0):\n        printFieldType(node0_field_type)\n        for ii in range(sel_list0.GetNumberOfTuples()):\n            print('\\t', sel_list0.GetValue(ii))\n\n    if (sel_list1.GetNumberOfTuples() > 0):\n        printFieldType(node1_field_type)\n        for ii in range(sel_list1.GetNumberOfTuples()):\n            print('\\t', sel_list1.GetValue(ii))\n\n        print('- - -')\n\n\ndef printFieldType(field_type):\n    if field_type == 3:\n        print('Vertices Selected:')\n    elif field_type == 4:\n        print('Edges Selected:')\n    else:\n        print('Unknown type:')\n\n\ndef main():\n    rep = view.GetRepresentation(0)\n\n    # The vtkRenderedGraphRepresentation should already have a vtkAnnotationLink,\n    # so we just want to grab it and add an observer with our callback function\n    # attached\n    link = rep.GetAnnotationLink()\n    link.AddObserver('AnnotationChangedEvent', selectionCallback)\n\n    view.GetRenderWindow().SetSize(600, 600)\n    view.ResetCamera()\n    view.Render()\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/SideBySideGraphs/","title":"SideBySideGraphs","text":"

        vtk-examples/Python/Graphs/SideBySideGraphs

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/SideBySideGraphs/#code","title":"Code","text":"

        SideBySideGraphs.py

        #!/usr/bin/env python\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkMutableUndirectedGraph\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor\n)\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the first graph\n    g0 = vtkMutableUndirectedGraph()\n\n    v1 = g0.AddVertex()\n    v2 = g0.AddVertex()\n    v3 = g0.AddVertex()\n\n    g0.AddEdge(v1, v2)\n    g0.AddEdge(v2, v3)\n    g0.AddEdge(v1, v3)\n\n    # Create points\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    # Add the coordinates of the points to the graph\n    g0.SetPoints(points)\n\n    # Create the second graph\n    g1 = vtkMutableUndirectedGraph()\n\n    v1 = g1.AddVertex()\n    v2 = g1.AddVertex()\n\n    g1.AddEdge(v1, v2)\n\n    # Create points\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n\n    # Add the coordinates of the points to the graph\n    g1.SetPoints(points)\n\n    # There will be one render window\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 300)\n    ren_win.SetWindowName('SideBySideGraphs')\n\n    iren = vtkRenderWindowInteractor()\n\n    # Define viewport ranges\n    # (xmin, ymin, xmax, ymax)\n    left_viewport = [0.0, 0.0, 0.5, 1.0]\n    right_viewport = [0.5, 0.0, 1.0, 1.0]\n\n    graph_layout_view0 = vtkGraphLayoutView()\n    graph_layout_view0.SetRenderWindow(ren_win)\n    graph_layout_view0.SetInteractor(iren)\n    graph_layout_view0.GetRenderer().SetViewport(left_viewport)\n    graph_layout_view0.AddRepresentationFromInput(g0)\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view0.SetLayoutStrategy(force_directed)\n    graph_layout_view0.SetLayoutStrategyToForceDirected()\n    graph_layout_view0.GetRenderer().SetBackground(colors.GetColor3d('Navy'))\n    graph_layout_view0.GetRenderer().SetBackground2(colors.GetColor3d('MidnightBlue'))\n    graph_layout_view0.Render()\n    graph_layout_view0.ResetCamera()\n\n    graph_layout_view1 = vtkGraphLayoutView()\n    graph_layout_view1.SetRenderWindow(ren_win)\n    graph_layout_view1.SetInteractor(iren)\n    graph_layout_view1.GetRenderer().SetViewport(right_viewport)\n    graph_layout_view1.AddRepresentationFromInput(g0)\n    # If we create a layout object directly, just set the pointer through this method.\n    # graph_layout_view1.SetLayoutStrategy(force_directed)\n    graph_layout_view1.SetLayoutStrategyToForceDirected()\n    graph_layout_view1.AddRepresentationFromInput(g1)\n    graph_layout_view1.GetRenderer().SetBackground(colors.GetColor3d('DarkGreen'))\n    graph_layout_view1.GetRenderer().SetBackground2(colors.GetColor3d('ForestGreen'))\n    graph_layout_view1.Render()\n    graph_layout_view1.ResetCamera()\n\n    # graph_layout_view0.GetInteractor().Start()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/VisualizeDirectedGraph/","title":"VisualizeDirectedGraph","text":"

        vtk-examples/Python/Graphs/VisualizeDirectedGraph

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/VisualizeDirectedGraph/#code","title":"Code","text":"

        VisualizeDirectedGraph.py

        #!/usr/bin/env python\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersSources import (\n    vtkGlyphSource2D,\n    vtkGraphToPolyData\n)\nfrom vtkmodules.vtkInfovisLayout import (\n    vtkGraphLayout,\n    vtkSimple2DLayoutStrategy\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper\n)\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    g = vtkMutableDirectedGraph()\n\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n    v3 = g.AddVertex()\n\n    g.AddEdge(v1, v2)\n    g.AddEdge(v2, v3)\n    g.AddEdge(v3, v1)\n\n    # Do layout manually before handing graph to the view.\n    # This allows us to know the positions of edge arrows.\n    graphLayoutView = vtkGraphLayoutView()\n\n    layout = vtkGraphLayout()\n    strategy = vtkSimple2DLayoutStrategy()\n    layout.SetInputData(g)\n    layout.SetLayoutStrategy(strategy)\n\n    # Tell the view to use the vertex layout we provide\n    graphLayoutView.SetLayoutStrategyToPassThrough()\n    # The arrows will be positioned on a straight line between two\n    # vertices so tell the view not to draw arcs for parallel edges\n    graphLayoutView.SetEdgeLayoutStrategyToPassThrough()\n\n    # Add the graph to the view. This will render vertices and edges,\n    # but not edge arrows.\n    graphLayoutView.AddRepresentationFromInputConnection(layout.GetOutputPort())\n\n    # Manually create an actor containing the glyphed arrows.\n    graphToPoly = vtkGraphToPolyData()\n    graphToPoly.SetInputConnection(layout.GetOutputPort())\n    graphToPoly.EdgeGlyphOutputOn()\n\n    # Set the position (0: edge start, 1: edge end) where\n    # the edge arrows should go.\n    graphToPoly.SetEdgeGlyphPosition(0.98)\n\n    # Make a simple edge arrow for glyphing.\n    arrowSource = vtkGlyphSource2D()\n    arrowSource.SetGlyphTypeToEdgeArrow()\n    arrowSource.SetScale(0.1)\n    arrowSource.Update()\n\n    # Use Glyph3D to repeat the glyph on all edges.\n    arrowGlyph = vtkGlyph3D()\n    arrowGlyph.SetInputConnection(0, graphToPoly.GetOutputPort(1))\n    arrowGlyph.SetInputConnection(1, arrowSource.GetOutputPort())\n\n    # Add the edge arrow actor to the view.\n    arrowMapper = vtkPolyDataMapper()\n    arrowMapper.SetInputConnection(arrowGlyph.GetOutputPort())\n    arrowActor = vtkActor()\n    arrowActor.SetMapper(arrowMapper)\n    graphLayoutView.GetRenderer().AddActor(arrowActor)\n\n    graphLayoutView.ResetCamera()\n    graphLayoutView.Render()\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Graphs/VisualizeGraph/","title":"VisualizeGraph","text":"

        vtk-examples/Python/Graphs/VisualizeGraph

        "},{"location":"Python/Graphs/VisualizeGraph/#description","title":"Description","text":"
        • Contributed by Jim McCusker

        Note

        AddEdge() is not enabled through python, but AddGraphEdge() is.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Graphs/VisualizeGraph/#code","title":"Code","text":"

        VisualizeGraph.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    g = vtkMutableDirectedGraph()\n\n    v1 = g.AddVertex()\n    v2 = g.AddVertex()\n\n    g.AddGraphEdge(v1, v2)\n    g.AddGraphEdge(v1, v2)\n\n    graphLayoutView = vtkGraphLayoutView()\n    graphLayoutView.AddRepresentationFromInput(g)\n    graphLayoutView.SetLayoutStrategy('Simple 2D')\n    graphLayoutView.ResetCamera()\n    graphLayoutView.Render()\n\n    graphLayoutView.GetLayoutStrategy().SetRandomSeed(0)\n\n    graphLayoutView.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/HyperTreeGrid/HyperTreeGridSource/","title":"HyperTreeGridSource","text":"

        vtk-examples/Python/HyperTreeGrid/HyperTreeGridSource

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/HyperTreeGrid/HyperTreeGridSource/#code","title":"Code","text":"

        HyperTreeGridSource.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersHyperTree import vtkHyperTreeGridToUnstructuredGrid\nfrom vtkmodules.vtkFiltersSources import vtkHyperTreeGridSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Create hyper tree grid source\n\n    descriptor = 'RRR .R. .RR ..R ..R .R.|R.......................... ' \\\n                 '........................... ........................... ' \\\n                 '.............R............. ....RR.RR........R......... ' \\\n                 '.....RRRR.....R.RR......... ........................... ' \\\n                 '........................... ' \\\n                 '...........................|........................... ' \\\n                 '........................... ........................... ' \\\n                 '...RR.RR.......RR.......... ........................... ' \\\n                 'RR......................... ........................... ' \\\n                 '........................... ........................... ' \\\n                 '........................... ........................... ' \\\n                 '........................... ........................... ' \\\n                 '............RRR............|........................... ' \\\n                 '........................... .......RR.................. ' \\\n                 '........................... ........................... ' \\\n                 '........................... ........................... ' \\\n                 '........................... ........................... ' \\\n                 '........................... ' \\\n                 '...........................|........................... ' \\\n                 '...........................'\n\n    source = vtkHyperTreeGridSource()\n    source.SetMaximumLevel(6)\n    source.SetDimensions(4, 4, 3)  # GridCell 3, 3, 2\n    source.SetGridScale(1.5, 1.0, 0.7)\n    source.SetBranchFactor(4)\n    source.SetDescriptor(descriptor)\n    source.Update()\n\n    # Hyper tree grid to unstructured grid filter\n    htg2ug = vtkHyperTreeGridToUnstructuredGrid()\n    htg2ug.SetInputConnection(source.GetOutputPort())\n    htg2ug.Update()\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(htg2ug.GetOutputPort())\n    shrink.SetShrinkFactor(.8)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(shrink.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Burlywood'))\n\n    # Create the RenderWindow, Renderer and Interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderer.AddActor(actor)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(150)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCameraClippingRange()\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.Render()\n    renderWindow.SetWindowName('HyperTreeGridSource')\n\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/3DSImporter/","title":"3DSImporter","text":"

        vtk-examples/Python/IO/3DSImporter

        "},{"location":"Python/IO/3DSImporter/#description","title":"Description","text":"

        This example illustrates Importing files in VTK. An importer creates a vtkRenderWindow that describes the scene.

        Info

        See Figure 4-13 in Chapter 4 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/3DSImporter/#code","title":"Code","text":"

        3DSImporter.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImport import vtk3DSImporter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkCamera,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    importer = vtk3DSImporter()\n    importer.SetFileName(fileName)\n    importer.ComputeNormalsOn()\n\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n\n    renWin.AddRenderer(renderer)\n    renderer.SetBackground2(colors.GetColor3d('Gold'))\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renderer.GradientBackgroundOn()\n\n    iren.SetRenderWindow(renWin)\n    importer.SetRenderWindow(renWin)\n    importer.Update()\n\n    # actors = vtkActorCollection()\n    actors = renderer.GetActors()\n    print('There are', actors.GetNumberOfItems(), 'actors.')\n\n    renWin.SetWindowName('3DSImporter')\n    renWin.Render()\n    camera = vtkCamera()\n    camera.SetPosition(0, -1, 0)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetViewUp(0, 0, 1)\n    camera.Azimuth(150)\n    camera.Elevation(30)\n\n    renderer.SetActiveCamera(camera)\n    renderer.ResetCamera()\n    renderer.ResetCameraClippingRange()\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Importing a 3ds file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='iflamingo.3ds.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/CSVReadEdit/","title":"CSVReadEdit","text":"

        vtk-examples/Python/IO/CSVReadEdit

        "},{"location":"Python/IO/CSVReadEdit/#description","title":"Description","text":"

        This example loads a CSV file, edits it and visualises the result.

        It demonstrates the use of pandas to read and edit the CSV input file, then use numpy and the vtk-numpy interface for building the resultant vtkPolyData object based on the options selected.

        The key thing about pandas is it can read/write data in various formats: CSV and text files, Microsoft Excel, SQL databases, and the fast HDF5 format. It is highly optimized for performance and the DataFrame object allows for extensive row/column manipulation. So we can edit the data, creating new columns, and, finally, select only relevant columns for further analysis by VTK.

        In this case we select columns using numpy to create the three-dimensional point data array data. The numpy objects are then converted to vtk data structures and integrated into a vtkPolyData object.

        The process is this:

        CSV->pandas(read/edit/select)->numpy->numpy_to_vtk->[vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)\n

        Note how easy it is the get the three-dimensional coordinates using numpy.

        The files used to generate the example are:

        <DATA>/LakeGininderra.csv\n<DATA>/LakeGininderra.kmz\n

        Where:

        • <DATA> is the path to vtk-examples/src/Testing/Data
        • LakeGininderra.csv is the CSV file used by this program.
        • LakeGininderra.kmz can be loaded into Google Earth to display the track.

        The parameters for typical usage are something like this:

        <DATA>/LakeGininderra.csv -u -c -pResults\n
        A Google Earth image of the track.

        Further information:

        • Easy Data Conversion to VTK with Python.
        • Installing pandas.
        • VTK Examples - New CSV Examples

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/CSVReadEdit/#code","title":"Code","text":"

        CSVReadEdit.py

        #!/usr/bin/env python3\n\nfrom pathlib import Path\n\nimport pandas as pd\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtk.util import numpy_support\nfrom vtkmodules.vtkCommonColor import (\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import vtkLookupTable, vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget, vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor, vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Edit data from a CSV file and visualise it.'\n    epilogue = '''\n    This program selects ECEF, Geographic or UTM coordinates from the input file and:\n       1) Visualises the resultant ECEF or UTM points and lines.\n       2) If ECEF or UTM is selected, optionally creates and saves a VTP file for further analysis.\n       3) Optionally saves the CSV file.\n    If Geographic coordinates are selected, only the resultant CSV file can be saved.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('file_name', help='The CSV file containing the data.')\n    parser.add_argument('-c', '--csv', action='store_true', help='Save the resultant CSV file.')\n    parser.add_argument('-v', '--vtp', action='store_true', help='Save the .vtp file.')\n    parser.add_argument('-p', '--path', default='.',\n                        help='The path to be appended to the .vtp and optional .csv file')\n\n    group = parser.add_mutually_exclusive_group(required=True)\n    group.add_argument('-e', '--ecef', action='store_true', help='Use ECEF coordinates.')\n    group.add_argument('-u', '--utm', action='store_true', help='Use UTM coordinates.')\n    group.add_argument('-g', '--geo', action='store_true', help='Use geographic coordinates (latitude/longitude).')\n\n    args = parser.parse_args()\n    return args.file_name, args.csv, args.vtp, args.path, args.ecef, args.utm, args.geo\n\n\ndef main():\n    ifn, csv, vtp, sp, ecef, utm, geo = get_program_parameters()\n    file_name = Path(ifn)\n    if not file_name.is_file():\n        print('Unable to read:', file_name)\n        return\n    pth = Path(sp)\n    if not pth.is_dir():\n        if pth.is_file():\n            print(sp, ' must be a path')\n            return\n    pth.mkdir(parents=True, exist_ok=True)\n\n    # Build the output paths.\n    csv_fn = Path(pth / Path(ifn).stem).with_suffix('.csv')\n    vtp_fn = Path(pth / Path(ifn).stem).with_suffix('.vtp')\n    if ecef:\n        vtp_fn = vtp_fn.with_stem(vtp_fn.stem + '_ecef')\n    if utm:\n        vtp_fn = vtp_fn.with_stem(vtp_fn.stem + '_utm')\n\n    # Create a DataFrame from the csv file.\n    df = pd.read_csv(file_name)\n\n    # Use the column called 'Index' as the index.\n    # This ensures that we can trace back each row to the original data.\n    df.set_index('Index', inplace=True)\n\n    # For ECEF coordinates, we want to look down from the zenith.\n    # So calculate the mid-point of the latitude.\n    lat_details = df['Latitude'].describe()\n    lat_mid_pt = (lat_details['max'] + lat_details['min']) / 2\n\n    dfv = None\n    # Copy what we want to a new DataFrame and drop any rows with missing values.\n    if ecef:\n        dfv = df[['X(m)', 'Y(m)', 'Z(m)', 'Elevation(m)']].dropna(\n            subset=['X(m)', 'Y(m)', 'Z(m)'])\n        if csv:\n            ecef_csv_fn = csv_fn.with_stem(csv_fn.stem + '_ecef')\n            dfv.to_csv(ecef_csv_fn, index=True, index_label='Index', header=True)\n    elif utm:\n        dfv = df[['Easting(m)', 'Northing(m)', 'Elevation(m)']].dropna(\n            subset=['Easting(m)', 'Northing(m)', 'Elevation(m)'])\n        # Duplicate the elevation column, this will become the z-coordinate when UTM is selected.\n        dfv['Elev'] = dfv.loc[:, 'Elevation(m)']\n        if csv:\n            utm_csv_fn = csv_fn.with_stem(csv_fn.stem + '_utm')\n            dfv.to_csv(utm_csv_fn, index=True, index_label='Index', header=True)\n    else:\n        df_geo = df[['Longitude', 'Latitude', 'Elevation(m)']].dropna(\n            subset=['Longitude', 'Latitude', 'Elevation(m)'])\n        geo_csv_fn = csv_fn.with_stem(csv_fn.stem + '_geo')\n        df_geo.to_csv(geo_csv_fn, index=True, index_label='Index', header=True)\n\n    if ecef:\n        xyz = dfv[['X(m)', 'Y(m)', 'Z(m)']].to_numpy()\n    elif utm:\n        xyz = dfv[['Easting(m)', 'Northing(m)', 'Elevation(m)']].to_numpy()\n    else:\n        print('Only ECEF or UTM coordinates can be visualised.')\n        return\n\n    elev = df[['Elevation(m)']].to_numpy()\n\n    # Create the poly data.\n    poly_data = vtkPolyData()\n    points = vtkPoints()\n    points.SetData(numpy_support.numpy_to_vtk(xyz))\n    poly_data.SetPoints(points)\n\n    # Set an index\n    idx = numpy_support.numpy_to_vtk(elev)\n    idx.SetName('Index')\n    poly_data.GetPointData().AddArray(idx)\n\n    # We use the elevation as the active scalars.\n    scal = numpy_support.numpy_to_vtk(elev)\n    scal.SetName('Elevation(m)')\n    poly_data.GetPointData().SetScalars(scal)\n    poly_data.GetPointData().SetActiveScalars('Elevation(m)')\n    elev_range = poly_data.GetPointData().GetScalars().GetRange()\n\n    num_pts = poly_data.GetNumberOfPoints()\n    poly_line = vtkPolyLine()\n    poly_line.GetPointIds().SetNumberOfIds(num_pts)\n    for i in range(0, num_pts):\n        poly_line.GetPointIds().SetId(i, i)\n\n    # Create a cell array to store the lines in and add the lines to it.\n    cells = vtkCellArray()\n    cells.InsertNextCell(poly_line)\n\n    # Add the lines to the dataset\n    poly_data.SetLines(cells)\n\n    poly_data.Modified()\n\n    # Rotate the ECEF coordinates\n    # into VTK coordinates so that on the screen:\n    # Y points North, X points East and Z points up.\n    transform = vtkTransform()\n    if utm:\n        # Scale the elevation.\n        transform.Scale(1, 1, 1)\n    if ecef:\n        # Rotate the ECEF coordinates\n        # into VTK coordinates so that on the screen:\n        # Y points North, X points East and Z points up.\n        transform.RotateX(-(90 - lat_mid_pt))\n        transform.RotateY(0)\n        transform.RotateZ(90 - lat_mid_pt)\n\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputDataObject(poly_data)\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    if vtp:\n        writer = vtkXMLPolyDataWriter()\n        writer.SetFileName(vtp_fn)\n        writer.SetInputConnection(transform_filter.GetOutputPort())\n        writer.SetDataModeToBinary()\n        writer.Write()\n\n    colors = vtkNamedColors()\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    lut = get_diverging_lut('cool_warm')\n    # lut = get_diverging_lut1('DarkRed', 'Gainsboro', 'Green')\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(transform_filter.GetOutputPort())\n    mapper.SetScalarRange(elev_range)\n    mapper.SetLookupTable(lut)\n    mapper.ScalarVisibilityOn()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    window_width = 1024\n    window_height = 1024\n\n    # Create a scalar bar\n    scalar_bar = vtkScalarBarActor()\n    scalar_bar.SetLookupTable(mapper.GetLookupTable())\n    scalar_bar.SetTitle('Elevation')\n    scalar_bar.UnconstrainedFontSizeOff()\n    scalar_bar.SetNumberOfLabels(6)\n    scalar_bar.SetVerticalTitleSeparation(50)\n    scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar.SetMaximumHeightInPixels(window_height // 2)\n    scalar_bar.SetBarRatio(scalar_bar.GetBarRatio() * 0.5)\n    scalar_bar.SetPosition(0.87, 0.1)\n\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(window_width, window_height)\n    if ecef:\n        ren_win.SetWindowName('ECEF')\n    elif utm:\n        ren_win.SetWindowName('UTM')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(scalar_bar)\n    renderer.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    cam_orient_manipulator = vtkCameraOrientationWidget()\n    cam_orient_manipulator.SetParentRenderer(renderer)\n    cam_orient_manipulator.On()\n\n    axes = vtkAxesActor()\n    axes.SetXAxisLabelText('East')\n    axes.SetYAxisLabelText('North')\n    # Zenith\n    axes.SetZAxisLabelText('Zenith')\n\n    widget = vtkOrientationMarkerWidget()\n    rgba = [0] * 4\n    colors.GetColor('Carrot', rgba)\n    widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n    widget.SetOrientationMarker(axes)\n    widget.SetInteractor(iren)\n    widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n    widget.SetEnabled(1)\n    widget.InteractiveOn()\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(0)\n\n    iren.Initialize()\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_diverging_lut(color_map: str, table_size: int = 256):\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start-point         mid-point           end-point\\n\n    cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\\n\n    purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\\n\n    green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\\n\n    blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\\n\n    green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\\n\n\n    :param color_map: The color map to use e.g. cool_warm.\n    :param table_size: The table size.\n    :return:\n    \"\"\"\n    color_maps = dict()\n    color_maps['cool_warm'] = {'start': (0.230, 0.299, 0.754), 'mid': (0.865, 0.865, 0.865),\n                               'end': (0.706, 0.016, 0.150)}\n    color_maps['purple_orange'] = {'start': (0.436, 0.308, 0.631), 'mid': (0.865, 0.865, 0.865),\n                                   'end': (0.759, 0.334, 0.046)}\n    color_maps['green_purple'] = {'start': (0.085, 0.532, 0.201), 'mid': (0.865, 0.865, 0.865),\n                                  'end': (0.436, 0.308, 0.631)}\n    color_maps['blue_brown'] = {'start': (0.217, 0.525, 0.910), 'mid': (0.865, 0.865, 0.865),\n                                'end': (0.677, 0.492, 0.093)}\n    color_maps['green_red'] = {'start': (0.085, 0.532, 0.201), 'mid': (0.865, 0.865, 0.865),\n                               'end': (0.758, 0.214, 0.233)}\n\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    cm = color_maps[color_map]\n\n    ctf.AddRGBPoint(0.0, *cm['start'])\n    ctf.AddRGBPoint(0.5, *cm['mid'])\n    ctf.AddRGBPoint(1.0, *cm['end'])\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef get_diverging_lut1(start: str, mid: str, end: str, table_size: int = 256):\n    \"\"\"\n    Create a diverging lookup table from three named colors.\n\n    :param start: The start-point point color.\n    :param mid: The mid-point color.\n    :param end: The end-point color.\n    :param table_size:  The table size.\n    :return:\n    \"\"\"\n    colors = vtkNamedColors()\n    # Colour transfer function.\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    p1 = [0.0] + list(colors.GetColor3d(start))\n    p2 = [0.5] + list(colors.GetColor3d(mid))\n    p3 = [1.0] + list(colors.GetColor3d(end))\n    ctf.AddRGBPoint(*p1)\n    ctf.AddRGBPoint(*p2)\n    ctf.AddRGBPoint(*p3)\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/CSVReadEdit1/","title":"CSVReadEdit1","text":"

        vtk-examples/Python/IO/CSVReadEdit1

        "},{"location":"Python/IO/CSVReadEdit1/#description","title":"Description","text":"

        This example loads a CSV file, edits it and visualises the result.

        It demonstrates the use of pandas to read and edit the CSV input file, then create a temporary file containing the desired columns. This temporary file is subsequently read and parsed using vtkDelimitedTextReader.

        The key thing about pandas is it can read/write data in various formats: CSV and text files, Microsoft Excel, SQL databases, and the fast HDF5 format. It is highly optimized for performance and the DataFrame object allows for extensive row/column manipulation. So we can edit the data, creating new columns, and, finally, select only relevant columns for further analysis by VTK.

        In this case we create a temporary CSV file of selected columns and read this with vtkDelimitedTextReader.

        The process is this:

        CSV->pandas(read/edit/select)->CSV->[vtkDelimitedTextReader](https://www.vtk.org/doc/nightly/html/classvtkDelimitedTextReader.html#details)->[vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)\n

        By going down this route we don't overload the delimited text reader with the effort of processing any unneeded columns of data.

        The files used to generate the example are:

        <DATA>/LakeGininderra.csv\n<DATA>/LakeGininderra.kmz\n

        Where:

        • <DATA> is the path to vtk-examples/src/Testing/Data
        • LakeGininderra.csv is the CSV file used by this program.
        • LakeGininderra.kmz can be loaded into Google Earth to display the track.

        The parameters for typical usage are something like this:

        <DATA>/LakeGininderra.csv -e -c -pResults\n
        A Google Earth image of the track.

        Further information:

        • Easy Data Conversion to VTK with Python.
        • Installing pandas.
        • VTK Examples - New CSV Examples

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/CSVReadEdit1/#code","title":"Code","text":"

        CSVReadEdit1.py

        #!/usr/bin/env python3\n\nimport tempfile\nfrom pathlib import Path\n\nimport pandas as pd\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTableToPolyData, vtkTransformPolyDataFilter\nfrom vtkmodules.vtkIOInfovis import vtkDelimitedTextReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget, vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor, vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Edit data from a CSV file and visualise it.'\n    epilogue = '''\n    This program selects ECEF, Geographic or UTM coordinates from the input file and:\n       1) Visualises the resultant ECEF or UTM points and lines.\n       2) If ECEF or UTM is selected, optionally creates and saves a VTP file for further analysis.\n       3) Optionally saves the CSV file.\n    If Geographic coordinates are selected, only the resultant CSV file can be saved.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('file_name', help='The CSV file containing the data.')\n    parser.add_argument('-c', '--csv', action='store_true', help='Save the resultant CSV file.')\n    parser.add_argument('-v', '--vtp', action='store_true', help='Save the .vtp file.')\n    parser.add_argument('-p', '--path', default='.',\n                        help='The path to be appended to the .vtp and optional .csv file')\n\n    group = parser.add_mutually_exclusive_group(required=True)\n    group.add_argument('-e', '--ecef', action='store_true', help='Use ECEF coordinates.')\n    group.add_argument('-u', '--utm', action='store_true', help='Use UTM coordinates.')\n    group.add_argument('-g', '--geo', action='store_true', help='Use geographic coordinates (latitude/longitude).')\n\n    args = parser.parse_args()\n    return args.file_name, args.csv, args.vtp, args.path, args.ecef, args.utm, args.geo\n\n\ndef main():\n    ifn, csv, vtp, sp, ecef, utm, geo = get_program_parameters()\n    file_name = Path(ifn)\n    if not file_name.is_file():\n        print('Unable to read:', file_name)\n        return\n    pth = Path(sp)\n    if not pth.is_dir():\n        if pth.is_file():\n            print(sp, ' must be a path')\n            return\n    pth.mkdir(parents=True, exist_ok=True)\n\n    # Build the output paths.\n    csv_fn = Path(pth / Path(ifn).stem).with_suffix('.csv')\n    vtp_fn = Path(pth / Path(ifn).stem).with_suffix('.vtp')\n    if ecef:\n        vtp_fn = vtp_fn.with_stem(vtp_fn.stem + '_ecef')\n    if utm:\n        vtp_fn = vtp_fn.with_stem(vtp_fn.stem + '_utm')\n\n    # Create a DataFrame from the csv file.\n    df = pd.read_csv(file_name)\n\n    # Use the column called 'Index' as the index.\n    # This ensures that we can trace back each row to the original data.\n    df.set_index('Index', inplace=True)\n\n    # For ECEF coordinates, we want to look down from the zenith.\n    # So calculate the mid-point of the latitude.\n    lat_details = df['Latitude'].describe()\n    lat_mid_pt = (lat_details['max'] + lat_details['min']) / 2\n\n    # Create a temporary csv file with just the needed columns.\n    tmp_dir = tempfile.gettempdir()\n    if tmp_dir is None:\n        print('Unable to find', tmp_dir)\n        return\n    tmp_path = Path(tmp_dir, f'tmp_{file_name.name}')\n\n    dfv = None\n    # Copy what we want to a new DataFrame and drop any rows with missing values.\n    if ecef:\n        dfv = df[['X(m)', 'Y(m)', 'Z(m)', 'Elevation(m)']].dropna(\n            subset=['X(m)', 'Y(m)', 'Z(m)'])\n        if csv:\n            ecef_csv_fn = csv_fn.with_stem(csv_fn.stem + '_ecef')\n            dfv.to_csv(ecef_csv_fn, index=True, index_label='Index', header=True)\n    elif utm:\n        dfv = df[['Easting(m)', 'Northing(m)', 'Elevation(m)']].dropna(\n            subset=['Easting(m)', 'Northing(m)', 'Elevation(m)'])\n        # Duplicate the elevation column, this will become the z-coordinate when UTM is selected.\n        dfv['Elev'] = dfv.loc[:, 'Elevation(m)']\n        if csv:\n            utm_csv_fn = csv_fn.with_stem(csv_fn.stem + '_utm')\n            dfv.to_csv(utm_csv_fn, index=True, index_label='Index', header=True)\n    else:\n        df_geo = df[['Longitude', 'Latitude', 'Elevation(m)']].dropna(\n            subset=['Longitude', 'Latitude', 'Elevation(m)'])\n        geo_csv_fn = csv_fn.with_stem(csv_fn.stem + '_geo')\n        df_geo.to_csv(geo_csv_fn, index=True, index_label='Index', header=True)\n\n    if ecef or utm:\n        # Write out the DataFrame.\n        dfv.to_csv(tmp_path, index=True, index_label='Index', header=True)\n\n    points_reader = vtkDelimitedTextReader()\n    points_reader.SetFileName(tmp_path)\n    points_reader.DetectNumericColumnsOn()\n    points_reader.SetFieldDelimiterCharacters(',')\n    points_reader.SetHaveHeaders(True)\n\n    table_pd = vtkTableToPolyData()\n    table_pd.SetInputConnection(points_reader.GetOutputPort())\n    if ecef:\n        table_pd.SetXColumn('X(m)')\n        table_pd.SetYColumn('Y(m)')\n        table_pd.SetZColumn('Z(m)')\n    elif utm:\n        table_pd.SetXColumn('Easting(m)')\n        table_pd.SetYColumn('Northing(m)')\n        table_pd.SetZColumn('Elev')\n    else:\n        # Remove the temporary file, it is not needed any more.\n        tmp_path.unlink(missing_ok=True)\n        print('Only ECEF or UTM coordinates can be visualised.')\n        return\n    table_pd.Update()\n\n    # Remove the temporary file, it is not needed any more.\n    tmp_path.unlink(missing_ok=True)\n\n    poly_data = table_pd.GetOutput()\n    # poly_data = transform_filter.GetOutput()\n    # We use the elevation as the active scalars.\n    poly_data.GetPointData().SetActiveScalars('Elevation(m)')\n    elev_range = poly_data.GetPointData().GetScalars().GetRange()\n\n    num_pts = poly_data.GetNumberOfPoints()\n\n    poly_line = vtkPolyLine()\n    poly_line.GetPointIds().SetNumberOfIds(num_pts)\n    for i in range(0, num_pts):\n        poly_line.GetPointIds().SetId(i, i)\n\n    # Create a cell array to store the lines in and add the lines to it.\n    cells = vtkCellArray()\n    cells.InsertNextCell(poly_line)\n\n    # Add the lines to the dataset\n    poly_data.SetLines(cells)\n\n    poly_data.Modified()\n\n    transform = vtkTransform()\n    if utm:\n        # Scale the elevation.\n        transform.Scale(1, 1, 1)\n    if ecef:\n        # Rotate the ECEF coordinates\n        # into VTK coordinates so that on the screen:\n        # Y points North, X points East and Z points up.\n        transform.RotateX(-(90 - lat_mid_pt))\n        transform.RotateY(0)\n        transform.RotateZ(90 - lat_mid_pt)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputData(table_pd.GetOutput())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    if vtp:\n        writer = vtkXMLPolyDataWriter()\n        writer.SetFileName(vtp_fn)\n        writer.SetInputConnection(transform_filter.GetOutputPort())\n        writer.SetDataModeToBinary()\n        writer.Write()\n\n    colors = vtkNamedColors()\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    lut = get_diverging_lut('cool_warm')\n    # lut = get_diverging_lut1('DarkRed', 'Gainsboro', 'Green')\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(transform_filter.GetOutputPort())\n    mapper.SetScalarRange(elev_range)\n    mapper.SetLookupTable(lut)\n    mapper.ScalarVisibilityOn()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    window_width = 1024\n    window_height = 1024\n\n    # Create a scalar bar\n    scalar_bar = vtkScalarBarActor()\n    scalar_bar.SetLookupTable(mapper.GetLookupTable())\n    scalar_bar.SetTitle('Elevation')\n    scalar_bar.UnconstrainedFontSizeOff()\n    scalar_bar.SetNumberOfLabels(6)\n    scalar_bar.SetVerticalTitleSeparation(50)\n    scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar.SetMaximumHeightInPixels(window_height // 2)\n    scalar_bar.SetBarRatio(scalar_bar.GetBarRatio() * 0.6)\n    scalar_bar.SetPosition(0.87, 0.1)\n\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(window_width, window_height)\n    if ecef:\n        ren_win.SetWindowName('ECEF')\n    elif utm:\n        ren_win.SetWindowName('UTM')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(scalar_bar)\n    renderer.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    cam_orient_manipulator = vtkCameraOrientationWidget()\n    cam_orient_manipulator.SetParentRenderer(renderer)\n    cam_orient_manipulator.On()\n\n    axes = vtkAxesActor()\n    axes.SetXAxisLabelText('East')\n    axes.SetYAxisLabelText('North')\n    # Zenith\n    axes.SetZAxisLabelText('Zenith')\n\n    widget = vtkOrientationMarkerWidget()\n    rgba = [0] * 4\n    colors.GetColor('Carrot', rgba)\n    widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n    widget.SetOrientationMarker(axes)\n    widget.SetInteractor(iren)\n    widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n    widget.SetEnabled(1)\n    widget.InteractiveOn()\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(0)\n\n    iren.Initialize()\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_diverging_lut(color_map: str, table_size: int = 256):\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start-point         mid-point           end-point\\n\n    cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\\n\n    purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\\n\n    green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\\n\n    blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\\n\n    green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\\n\n\n    :param color_map: The color map to use e.g. cool_warm.\n    :param table_size: The table size.\n    :return:\n    \"\"\"\n    color_maps = dict()\n    color_maps['cool_warm'] = {'start': (0.230, 0.299, 0.754), 'mid': (0.865, 0.865, 0.865),\n                               'end': (0.706, 0.016, 0.150)}\n    color_maps['purple_orange'] = {'start': (0.436, 0.308, 0.631), 'mid': (0.865, 0.865, 0.865),\n                                   'end': (0.759, 0.334, 0.046)}\n    color_maps['green_purple'] = {'start': (0.085, 0.532, 0.201), 'mid': (0.865, 0.865, 0.865),\n                                  'end': (0.436, 0.308, 0.631)}\n    color_maps['blue_brown'] = {'start': (0.217, 0.525, 0.910), 'mid': (0.865, 0.865, 0.865),\n                                'end': (0.677, 0.492, 0.093)}\n    color_maps['green_red'] = {'start': (0.085, 0.532, 0.201), 'mid': (0.865, 0.865, 0.865),\n                               'end': (0.758, 0.214, 0.233)}\n\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    cm = color_maps[color_map]\n\n    ctf.AddRGBPoint(0.0, *cm['start'])\n    ctf.AddRGBPoint(0.5, *cm['mid'])\n    ctf.AddRGBPoint(1.0, *cm['end'])\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef get_diverging_lut1(start: str, mid: str, end: str, table_size: int = 256):\n    \"\"\"\n    Create a diverging lookup table from three named colors.\n\n    :param start: The start-point point color.\n    :param mid: The mid-point color.\n    :param end: The end-point color.\n    :param table_size:  The table size.\n    :return:\n    \"\"\"\n    colors = vtkNamedColors()\n    # Colour transfer function.\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    p1 = [0.0] + list(colors.GetColor3d(start))\n    p2 = [0.5] + list(colors.GetColor3d(mid))\n    p3 = [1.0] + list(colors.GetColor3d(end))\n    ctf.AddRGBPoint(*p1)\n    ctf.AddRGBPoint(*p2)\n    ctf.AddRGBPoint(*p3)\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/HDRReader/","title":"HDRReader","text":"

        vtk-examples/Python/IO/HDRReader

        "},{"location":"Python/IO/HDRReader/#description","title":"Description","text":"

        Demonstrates how to read high-dynamic-range imaging files.

        A callback is used to print out the color window (move the mouse horizontally over the image) and color level (move the mouse vertically over the image).

        This is based on IO/Image/Testing/Cxx/TestHDRReader.cxx in the VTK source files.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/HDRReader/#code","title":"Code","text":"

        HDRReader.py

        ##!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkIOImage import vtkHDRReader\nfrom vtkmodules.vtkInteractionImage import vtkImageViewer\nfrom vtkmodules.vtkRenderingCore import vtkRenderWindowInteractor\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrate the use of HDRReader'\n    epilogue = '''\nThis example shows how to read in an HDR file.\nA callback is used to print out the color window (move the mouse horizontally over the image)\n and color level (move the mouse vertically over the image).\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='Path to the hdr file e.g. Skyboxes/spiaggia_di_mondello_1k.hdr.')\n    args = parser.parse_args()\n    return args.file_name\n\n\ndef main():\n    file_name = get_program_parameters()\n\n    reader = vtkHDRReader()\n\n    # Check the image can be read\n    if not reader.CanReadFile(file_name):\n        print('CanReadFile failed for ', file_name)\n        return\n\n    reader.SetFileName(file_name)\n    reader.UpdateInformation()\n\n    # Whole extent\n    we = reader.GetDataExtent()\n    extents = [we[0], we[1], we[2], we[3], 0, 0]\n    reader.UpdateExtent(extents)\n    # Visualize\n    image_viewer = vtkImageViewer()\n    image_viewer.SetInputData(reader.GetOutput())\n\n    image_viewer.SetColorWindow(1)\n    image_viewer.SetColorLevel(1)\n    image_viewer.SetPosition(0, 100)\n\n    iren = vtkRenderWindowInteractor()\n    image_viewer.SetupInteractor(iren)\n    image_viewer.GetRenderWindow().SetWindowName('HDRReader')\n    image_viewer.Render()\n\n    iren.AddObserver('EndInteractionEvent', ColorCallback(image_viewer))\n\n    iren.Start()\n\n\nclass ColorCallback(object):\n    def __init__(self, image_viewer):\n        self.image_viewer = image_viewer\n\n    def __call__(self, caller, ev):\n        # Just do this to demonstrate who called callback and the event that triggered it.\n        # print(caller.GetClassName(), 'Event Id:', ev)\n\n        res = 'Color window: {} level: {}'.format(self.image_viewer.GetColorWindow(),\n                                                  self.image_viewer.GetColorLevel())\n        print(res)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ImageWriter/","title":"ImageWriter","text":"

        vtk-examples/Python/IO/ImageWriter

        "},{"location":"Python/IO/ImageWriter/#description","title":"Description","text":"

        A generic function WriteImage() is provided that selects what image writer to use based on the file extension and then writes the render window to the file. The following formats are supported: BMP, JPEG, PNM, PNG, PostScript, TIFF.

        If no file extension is specified, PNG is assumed.

        The function WriteImage() is also available in the Snippets.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ImageWriter/#code","title":"Code","text":"

        ImageWriter.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkBMPWriter,\n    vtkJPEGWriter,\n    vtkPNGWriter,\n    vtkPNMWriter,\n    vtkPostScriptWriter,\n    vtkTIFFWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create source\n    source = vtkSphereSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(5.0)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # color the actor\n    actor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n\n    renWin.SetWindowName('ImageWriter')\n    renWin.Render()\n\n    ext = ['', '.png', '.jpg', '.ps', '.tiff', '.bmp', '.pnm']\n    filenames = list(map(lambda x: 'ImageWriter' + x, ext))\n    filenames[0] = filenames[0] + '1'\n    for f in filenames:\n        WriteImage(f, renWin, rgba=False)\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef WriteImage(fileName, renWin, rgba=True):\n    '''\n    Write the render window view to an image file.\n\n    Image types supported are:\n     BMP, JPEG, PNM, PNG, PostScript, TIFF.\n    The default parameters are used for all writers, change as needed.\n\n    :param fileName: The file name, if no extension then PNG is assumed.\n    :param renWin: The render window.\n    :param rgba: Used to set the buffer type.\n    :return:\n    '''\n\n    import os\n\n    if fileName:\n        # Select the writer to use.\n        path, ext = os.path.splitext(fileName)\n        ext = ext.lower()\n        if not ext:\n            ext = '.png'\n            fileName = fileName + ext\n        if ext == '.bmp':\n            writer = vtkBMPWriter()\n        elif ext == '.jpg':\n            writer = vtkJPEGWriter()\n        elif ext == '.pnm':\n            writer = vtkPNMWriter()\n        elif ext == '.ps':\n            if rgba:\n                rgba = False\n            writer = vtkPostScriptWriter()\n        elif ext == '.tiff':\n            writer = vtkTIFFWriter()\n        else:\n            writer = vtkPNGWriter()\n\n        windowto_image_filter = vtkWindowToImageFilter()\n        windowto_image_filter.SetInput(renWin)\n        windowto_image_filter.SetScale(1)  # image quality\n        if rgba:\n            windowto_image_filter.SetInputBufferTypeToRGBA()\n        else:\n            windowto_image_filter.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            windowto_image_filter.ReadFrontBufferOff()\n            windowto_image_filter.Update()\n\n        writer.SetFileName(fileName)\n        writer.SetInputConnection(windowto_image_filter.GetOutputPort())\n        writer.Write()\n    else:\n        raise RuntimeError('Need a filename.')\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ReadDICOM/","title":"ReadDICOM","text":"

        vtk-examples/Python/IO/ReadDICOM

        "},{"location":"Python/IO/ReadDICOM/#description","title":"Description","text":"

        This example reads a DICOM file and displays it on the screen. DICOM_Prostate is an example data set.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadDICOM/#code","title":"Code","text":"

        ReadDICOM.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkDICOMImageReader\nfrom vtkmodules.vtkInteractionImage import vtkImageViewer2\nfrom vtkmodules.vtkRenderingCore import vtkRenderWindowInteractor\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read Dicom image data'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='prostate.img')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    input_filename = get_program_parameters()\n\n    # Read the DICOM file\n    reader = vtkDICOMImageReader()\n    reader.SetFileName(input_filename)\n    reader.Update()\n\n    # Visualize\n    image_viewer = vtkImageViewer2()\n    image_viewer.SetInputConnection(reader.GetOutputPort())\n    render_window_interactor = vtkRenderWindowInteractor()\n    image_viewer.SetupInteractor(render_window_interactor)\n    image_viewer.Render()\n    image_viewer.GetRenderer().SetBackground(colors.GetColor3d(\"SlateGray\"))\n    image_viewer.GetRenderWindow().SetWindowName(\"ReadDICOM\")\n    image_viewer.GetRenderer().ResetCamera()\n    image_viewer.Render()\n\n    render_window_interactor.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
        "},{"location":"Python/IO/ReadDICOMSeries/","title":"ReadDICOMSeries","text":"

        vtk-examples/Python/IO/ReadDICOMSeries

        "},{"location":"Python/IO/ReadDICOMSeries/#description","title":"Description","text":"

        This example demonstates how to read a series of DICOM images and how to scroll with the mousewheel or the up/down keys through all slices. Sample data are available as a zipped file (977 kB, 40 slices): DicomTestImages

        Seealso

        ReadDICOM.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadDICOMSeries/#code","title":"Code","text":"

        ReadDICOMSeries.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkDICOMImageReader\nfrom vtkmodules.vtkInteractionImage import vtkImageViewer2\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor2D,\n    vtkRenderWindowInteractor,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\n# Helper class to format slice status message\nclass StatusMessage:\n    @staticmethod\n    def format(slice: int, max_slice: int):\n        return f'Slice Number {slice + 1}/{max_slice + 1}'\n\n\n# Define own interaction style\nclass MyVtkInteractorStyleImage(vtkInteractorStyleImage):\n    def __init__(self, parent=None):\n        super().__init__()\n        self.AddObserver('key_press_event', self.key_press_event)\n        self.AddObserver('mouse_wheel_forward_event', self.mouse_wheel_forward_event)\n        self.AddObserver('mouse_wheel_backward_event', self.mouse_wheel_backward_event)\n        self.image_viewer = None\n        self.status_mapper = None\n        self.slice = 0\n        self.min_slice = 0\n        self.max_slice = 0\n\n    def set_image_viewer(self, image_viewer):\n        self.image_viewer = image_viewer\n        self.min_slice = image_viewer.GetSliceMin()\n        self.max_slice = image_viewer.GetSliceMax()\n        self.slice = self.min_slice\n        print(f'Slicer: Min = {self.min_slice}, Max= {self.max_slice}')\n\n    def set_status_mapper(self, status_mapper):\n        self.status_mapper = status_mapper\n\n    def move_slice_forward(self):\n        if self.slice < self.max_slice:\n            self.slice += 1\n            print(f'MoveSliceForward::Slice = {self.slice}')\n            self.imageviewer.SetSlice(self.slice)\n            msg = StatusMessage.format(self.slice, self.max_slice)\n            self.status_mapper.SetInput(msg)\n            self.imageviewer.Render()\n\n    def move_slice_backward(self):\n        if self.slice > self.min_slice:\n            self.slice -= 1\n            print(f'MoveSliceBackward::Slice = {self.slice}')\n            self.imageviewer.SetSlice(self.slice)\n            msg = StatusMessage.format(self.slice, self.max_slice)\n            self.status_mapper.SetInput(msg)\n            self.imageviewer.Render()\n\n    def key_press_event(self, obj, event):\n        key = self.GetInteractor().GetKeySym()\n        if key == 'Up':\n            self.move_slice_forward()\n        elif key == 'Down':\n            self.move_slice_backward()\n\n    def mouse_wheel_forward_event(self, obj, event):\n        self.move_slice_forward()\n\n    def mouse_wheel_backward_event(self, obj, event):\n        self.move_slice_backward()\n\n\n# Read all the DICOM files in the specified directory.\ndef get_program_parameters():\n    import argparse\n    description = 'Read DICOM series data'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('dirname', help='DicomTestImages.zip')\n    args = parser.parse_args()\n    return args.dirname\n\n\ndef main():\n    colors = vtkNamedColors()\n    reader = vtkDICOMImageReader()\n    folder = get_program_parameters()\n    # Read DICOM files in the specified directory\n    reader.SetDirectoryName(folder)\n    reader.Update()\n\n    # Visualilze\n    image_viewer = vtkImageViewer2()\n    image_viewer.SetInputConnection(reader.GetOutputPort())\n    # Slice status message\n    slice_text_prop = vtkTextProperty()\n    slice_text_prop.SetFontFamilyToCourier()\n    slice_text_prop.SetFontSize(20)\n    slice_text_prop.SetVerticalJustificationToBottom()\n    slice_text_prop.SetJustificationToLeft()\n    # Slice status message\n    slice_text_mapper = vtkTextMapper()\n    msg = StatusMessage.format(image_viewer.GetSliceMin(), image_viewer.GetSliceMax())\n    slice_text_mapper.SetInput(msg)\n    slice_text_mapper.SetTextProperty(slice_text_prop)\n\n    slice_text_actor = vtkActor2D()\n    slice_text_actor.SetMapper(slice_text_mapper)\n    slice_text_actor.SetPosition(15, 10)\n\n    # Usage hint message\n    usage_text_prop = vtkTextProperty()\n    usage_text_prop.SetFontFamilyToCourier()\n    usage_text_prop.SetFontSize(14)\n    usage_text_prop.SetVerticalJustificationToTop()\n    usage_text_prop.SetJustificationToLeft()\n    usage_text_mapper = vtkTextMapper()\n    usage_text_mapper.SetInput(\n        'Slice with mouse wheel\\n  or Up/Down-Key\\n- Zoom with pressed right\\n '\n        ' mouse button while dragging'\n    )\n    usage_text_mapper.SetTextProperty(usage_text_prop)\n\n    usage_text_actor = vtkActor2D()\n    usage_text_actor.SetMapper(usage_text_mapper)\n    usage_text_actor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()\n    usage_text_actor.GetPositionCoordinate().SetValue(0.05, 0.95)\n\n    # Create an interactor with our own style (inherit from\n    # vtkInteractorStyleImage in order to catch mousewheel and key events.\n    render_window_interactor = vtkRenderWindowInteractor()\n    my_interactor_style = MyVtkInteractorStyleImage()\n\n    # Make imageviewer2 and sliceTextMapper visible to our interactorstyle\n    # to enable slice status message updates when  scrolling through the slices.\n    my_interactor_style.set_image_viewer(image_viewer)\n    my_interactor_style.set_status_mapper(slice_text_mapper)\n\n    # Make the interactor use our own interactor style\n    # because SetupInteractor() is defining it's own default interator style\n    # this must be called after SetupInteractor().\n    # renderWindowInteractor.SetInteractorStyle(myInteractorStyle);\n    image_viewer.SetupInteractor(render_window_interactor)\n    render_window_interactor.SetInteractorStyle(my_interactor_style)\n    render_window_interactor.Render()\n\n    # Add slice status message and usage hint message to the renderer.\n    image_viewer.GetRenderer().AddActor2D(slice_text_actor)\n    image_viewer.GetRenderer().AddActor2D(usage_text_actor)\n\n    # Initialize rendering and interaction.\n    image_viewer.Render()\n    image_viewer.GetRenderer().ResetCamera()\n    image_viewer.GetRenderer().SetBackground(colors.GetColor3d('SlateGray'))\n    image_viewer.GetRenderWindow().SetSize(800, 800)\n    image_viewer.GetRenderWindow().SetWindowName('ReadDICOMSeries')\n    image_viewer.Render()\n    render_window_interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ReadExodusData/","title":"ReadExodusData","text":"

        vtk-examples/Python/IO/ReadExodusData

        "},{"location":"Python/IO/ReadExodusData/#description","title":"Description","text":"

        The example uses vtkExodusIIReader to read an ExodusII file. The nodal variable to read is the second argument. The nodal variable is displayed with a color map.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadExodusData/#code","title":"Code","text":"

        ReadExodusData.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeometry import vtkCompositeDataGeometryFilter\nfrom vtkmodules.vtkIOExodus import vtkExodusIIReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read and display ExodusII data.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required filename e.g mug.e.')\n    parser.add_argument('nodal_var', help='The nodal variable e,g, convected.')\n    args = parser.parse_args()\n    return args.filename, args.nodal_var\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Input file and variable\n    filename, nodal_var = get_program_parameters()\n\n    # Read Exodus Data\n    reader = vtkExodusIIReader()\n    reader.SetFileName(filename)\n    reader.UpdateInformation()\n    reader.SetTimeStep(10)\n    reader.SetAllArrayStatus(vtkExodusIIReader.NODAL, 1)  # enables all NODAL variables\n    reader.Update()\n    # print(reader)  # uncomment this to show the file information\n\n    # Create Geometry\n    geometry = vtkCompositeDataGeometryFilter()\n    geometry.SetInputConnection(0, reader.GetOutputPort(0))\n    geometry.Update()\n\n    # Mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(geometry.GetOutputPort())\n    mapper.SelectColorArray(nodal_var)\n    mapper.SetScalarModeToUsePointFieldData()\n    mapper.InterpolateScalarsBeforeMappingOn()\n\n    # Actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Renderer\n    renderer = vtkRenderer()\n    renderer.AddViewProp(actor)\n    renderer.SetBackground(colors.GetColor3d('DimGray'))\n\n    renderer.GetActiveCamera().SetPosition(9.0, 9.0, 7.0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0.2, -0.7, 0.7)\n    renderer.GetActiveCamera().SetDistance(14.5)\n\n    # Window and Interactor\n    window = vtkRenderWindow()\n    window.AddRenderer(renderer)\n    window.SetSize(600, 600)\n    window.SetWindowName('ReadExodusData')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(window)\n    interactor.Initialize()\n\n    # Show the result\n    window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ReadImageData/","title":"ReadImageData","text":"

        vtk-examples/Python/IO/ReadImageData

        "},{"location":"Python/IO/ReadImageData/#description","title":"Description","text":"

        This example reads an image data (.vti) file.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadImageData/#code","title":"Code","text":"

        ReadImageData.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOXML import vtkXMLImageDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a VTK image data file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='vase.vti')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    # Read the source file.\n    reader = vtkXMLImageDataReader()\n    reader.SetFileName(file_name)\n\n    # Create the mapper that creates graphics elements\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    # Create the Actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    # show the edges of the image grid\n    actor.GetProperty().SetRepresentationToWireframe()\n\n    # Create the Renderer\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.ResetCamera()\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # Create the RendererWindow\n    renderer_window = vtkRenderWindow()\n    renderer_window.AddRenderer(renderer)\n    renderer_window.SetWindowName('ReadImageData')\n\n    # Create the RendererWindowInteractor and display the vti file\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderer_window)\n    interactor.Initialize()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ReadLegacyUnstructuredGrid/","title":"ReadLegacyUnstructuredGrid","text":"

        vtk-examples/Python/IO/ReadLegacyUnstructuredGrid

        "},{"location":"Python/IO/ReadLegacyUnstructuredGrid/#description","title":"Description","text":"

        This example displays a vtkUnstructuredGrid that contains eleven linear cells. We use a number of techniques to visualize the cells.

        1. vtkUnstructuredGridReader reads in the file src/Testing/Data/VTKCellTypes.vtk.
        2. vtkExtractEdges extracts the edges of the 2 and 3 dimensional cells. vtkTubeFilter wraps each edge with tubes.
        3. vtkGlyph3DMapper displays each point as a vtkSphere.
        4. vtkShrinkFilter highlights the cell faces by pulling them in towards their centroid.
        5. vtkLabeledDataMapper shows the point ids.
        6. vtkProperty::EdgeVisibilityOn() shows the edges of the cells after shrinking.
        7. vtkCellData colors each cell with a different color.

        The example also shows how to add a vtkCategoryLegend to a visualization. The vtkCategoryLegend has a vtkLookupTable that must be Indexed for categorical data. Since the vtkDataSetMapper for the geometry uses the lookup table to color each cell, we use vtkLookupTable::DeepCopy to copy the input vtkLookupTable and apply vtkLookupTable::IndexedLookupOn().

        The sample file is taken from the VTKFileFormats document.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadLegacyUnstructuredGrid/#code","title":"Code","text":"

        ReadLegacyUnstructuredGrid.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkChartsCore import vtkCategoryLegend\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkVariantArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellTypes,\n    vtkGenericCell\n)\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\n\n# vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n# VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\ntry:\n    from vtkmodules.vtkFiltersCore import vtkExtractEdges\nexcept ImportError:\n    from vtkmodules.vtkFiltersExtraction import vtkExtractEdges\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOLegacy import vtkUnstructuredGridReader\nfrom vtkmodules.vtkRenderingContext2D import vtkContextTransform\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkGlyph3DMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindowInteractor\n)\nfrom vtkmodules.vtkRenderingLabel import vtkLabeledDataMapper\nfrom vtkmodules.vtkViewsContext2D import vtkContextView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    # Create the reader for the data.\n    print('Loading ', filename)\n    reader = vtkUnstructuredGridReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    extractEdges = vtkExtractEdges()\n    extractEdges.SetInputConnection(reader.GetOutputPort())\n\n    legendValues = vtkVariantArray()\n    it = reader.GetOutput().NewCellIterator()\n    it.InitTraversal()\n    while not it.IsDoneWithTraversal():\n        cell = vtkGenericCell()\n        it.GetCell(cell)\n        cellName = vtkCellTypes.GetClassNameFromTypeId(cell.GetCellType())\n        print(cellName, 'NumberOfPoints:', cell.GetNumberOfPoints(), 'CellDimension:', cell.GetCellDimension())\n        legendValues.InsertNextValue(cellName)\n        it.GoToNextCell()\n\n    # Tube the edges\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(extractEdges.GetOutputPort())\n    tubes.SetRadius(.05)\n    tubes.SetNumberOfSides(21)\n\n    edgeMapper = vtkPolyDataMapper()\n    edgeMapper.SetInputConnection(tubes.GetOutputPort())\n    edgeMapper.SetScalarRange(0, 26)\n\n    edgeActor = vtkActor()\n    edgeActor.SetMapper(edgeMapper)\n    edgeActor.GetProperty().SetSpecular(0.6)\n    edgeActor.GetProperty().SetSpecularPower(30)\n\n    # Glyph the points\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(21)\n    sphere.SetThetaResolution(21)\n    sphere.SetRadius(0.08)\n\n    pointMapper = vtkGlyph3DMapper()\n    pointMapper.SetInputConnection(reader.GetOutputPort())\n    pointMapper.SetSourceConnection(sphere.GetOutputPort())\n    pointMapper.ScalingOff()\n    pointMapper.ScalarVisibilityOff()\n\n    pointActor = vtkActor()\n    pointActor.SetMapper(pointMapper)\n    pointActor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n    pointActor.GetProperty().SetSpecular(0.6)\n    pointActor.GetProperty().SetSpecularColor(1.0, 1.0, 1.0)\n    pointActor.GetProperty().SetSpecularPower(100)\n\n    # Label the points\n    labelMapper = vtkLabeledDataMapper()\n    labelMapper.SetInputConnection(reader.GetOutputPort())\n    labelActor = vtkActor2D()\n    labelActor.SetMapper(labelMapper)\n\n    # The geometry\n    geometryShrink = vtkShrinkFilter()\n    geometryShrink.SetInputConnection(reader.GetOutputPort())\n    geometryShrink.SetShrinkFactor(0.8)\n\n    # NOTE: We must copy the originalLut because the CategoricalLegend\n    # needs an indexed lookup table, but the geometryMapper uses a\n    # non-index lookup table\n    categoricalLut = vtkLookupTable()\n    originalLut = reader.GetOutput().GetCellData().GetScalars().GetLookupTable()\n\n    categoricalLut.DeepCopy(originalLut)\n    categoricalLut.IndexedLookupOn()\n\n    geometryMapper = vtkDataSetMapper()\n    geometryMapper.SetInputConnection(geometryShrink.GetOutputPort())\n    geometryMapper.SetScalarModeToUseCellData()\n    geometryMapper.SetScalarRange(0, 11)\n\n    geometryActor = vtkActor()\n    geometryActor.SetMapper(geometryMapper)\n    geometryActor.GetProperty().SetLineWidth(3)\n    geometryActor.GetProperty().EdgeVisibilityOn()\n    geometryActor.GetProperty().SetEdgeColor(0, 0, 0)\n\n    # Legend\n    for v in range(0, legendValues.GetNumberOfTuples()):\n        categoricalLut.SetAnnotation(legendValues.GetValue(v), legendValues.GetValue(v).ToString())\n    legend = vtkCategoryLegend()\n    legend.SetScalarsToColors(categoricalLut)\n    legend.SetValues(legendValues)\n    legend.SetTitle('Cell Type')\n    legend.GetBrush().SetColor(colors.GetColor4ub('Silver'))\n\n    placeLegend = vtkContextTransform()\n    placeLegend.AddItem(legend)\n    placeLegend.Translate(640 - 20, 480 - 12 * 16)\n\n    contextView = vtkContextView()\n    contextView.GetScene().AddItem(placeLegend)\n\n    renderer = contextView.GetRenderer()\n\n    renderWindow = contextView.GetRenderWindow()\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(geometryActor)\n    renderer.AddActor(labelActor)\n    renderer.AddActor(edgeActor)\n    renderer.AddActor(pointActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    aCamera = vtkCamera()\n    aCamera.Azimuth(-40.0)\n    aCamera.Elevation(50.0)\n\n    renderer.SetActiveCamera(aCamera)\n    renderer.ResetCamera()\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('ReadLegacyUnstructuredGrid')\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Display a vtkUnstructuredGrid that contains eleven linear cells.'\n    epilogue = '''\n    This example also shows how to add a vtkCategoryLegend to a visualization.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='VTKCellTypes.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ReadPLOT3D/","title":"ReadPLOT3D","text":"

        vtk-examples/Python/IO/ReadPLOT3D

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadPLOT3D/#code","title":"Code","text":"

        ReadPLOT3D.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFile, qFile = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    reader = vtkMultiBlockPLOT3DReader()\n    reader.SetXYZFileName(xyzFile)\n    reader.SetQFileName(qFile)\n    reader.SetScalarFunctionNumber(100)\n    reader.SetVectorFunctionNumber(202)\n    reader.Update()\n\n    geometry = vtkStructuredGridGeometryFilter()\n    geometry.SetInputData(reader.GetOutput().GetBlock(0))\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(geometry.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    render = vtkRenderer()\n    render.AddActor(actor)\n    render.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    render_win = vtkRenderWindow()\n    render_win.AddRenderer(render)\n    render_win.SetSize(640, 480)\n    render_win.SetWindowName('ReadPLOT3D')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(render_win)\n\n    camera = render.GetActiveCamera()\n    camera.SetPosition(5.02611, -23.535, 50.3979)\n    camera.SetFocalPoint(9.33614, 0.0414149, 30.112)\n    camera.SetViewUp(-0.0676794, 0.657814, 0.750134)\n    camera.SetDistance(31.3997)\n    camera.SetClippingRange(12.1468, 55.8147)\n\n    render_win.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read PLOT3D data files'\n    epilogue = '''\n    vtkMultiBlockPLOT3DReader is a reader object that reads PLOT3D formatted files \n    and generates structured grid(s) on output.\n    PLOT3D is a computer graphics program designed to visualize the grids \n    and solutions of computational fluid dynamics.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ReadPolyData/","title":"ReadPolyData","text":"

        vtk-examples/Python/IO/ReadPolyData

        "},{"location":"Python/IO/ReadPolyData/#description","title":"Description","text":"

        This example reads a polygonal data (.vtp) file, for example src/Testing/Data/Torso.vtp.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadPolyData/#code","title":"Code","text":"

        ReadPolyData.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a polydata file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Torso.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    # Read all the data from the file\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    # Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('NavajoWhite'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkOliveGreen'))\n    renderer.GetActiveCamera().Pitch(90)\n    renderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    renderer.ResetCamera()\n\n    renderWindow.SetSize(600, 600)\n    renderWindow.Render()\n    renderWindow.SetWindowName('ReadPolyData')\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ReadSLC/","title":"ReadSLC","text":"

        vtk-examples/Python/IO/ReadSLC

        "},{"location":"Python/IO/ReadSLC/#description","title":"Description","text":"

        In this example you will familiarize yourself with the stages required to read a .slc file and create a visualization pipeline in VTK. Following is the three step procedure:

        1. Read the data from .slc file using vtkSLCReader

        2. Implement Marching cubes Algorithm using vtkContourFilter

        3. Create Visualization pipeline to visualize data using an actor, mapper and rendering window

        Cite

        This example was provided by Bharatesh Chakravarthi from Virtual Environment Lab, Chung-Ang University, Seoul, South Korea

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadSLC/#code","title":"Code","text":"

        ReadSLC.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkSLCReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    InputFilename, iso_value = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # vtkSLCReader to read.\n    reader = vtkSLCReader()\n    reader.SetFileName(InputFilename)\n    reader.Update()\n\n    # Create a mapper.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    # Implementing Marching Cubes Algorithm to create the surface using vtkContourFilter object.\n    contourFilter = vtkContourFilter()\n    contourFilter.SetInputConnection(reader.GetOutputPort())\n    # Change the range(2nd and 3rd Paramater) based on your\n    # requirement. recomended value for 1st parameter is above 1\n    # contourFilter.GenerateValues(5, 80.0, 100.0)\n    contourFilter.SetValue(0, iso_value)\n\n    outliner = vtkOutlineFilter()\n    outliner.SetInputConnection(reader.GetOutputPort())\n    outliner.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(contourFilter.GetOutputPort())\n    mapper.SetScalarVisibility(0)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuse(0.8)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Ivory'))\n    actor.GetProperty().SetSpecular(0.8)\n    actor.GetProperty().SetSpecularPower(120.0)\n\n    # Create a rendering window and renderer.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(500, 500)\n\n    # Create a renderwindowinteractor.\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Assign actor to the renderer.\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Pick a good view\n    cam1 = renderer.GetActiveCamera()\n    cam1.SetFocalPoint(0.0, 0.0, 0.0)\n    cam1.SetPosition(0.0, -1.0, 0.0)\n    cam1.SetViewUp(0.0, 0.0, -1.0)\n    cam1.Azimuth(-90.0)\n    renderer.ResetCamera()\n    renderer.ResetCameraClippingRange()\n\n    renderWindow.SetWindowName('ReadSLC')\n    renderWindow.SetSize(640, 512)\n    renderWindow.Render()\n\n    # Enable user interface interactor.\n    renderWindowInteractor.Initialize()\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a .slc file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='vw_knee.slc.')\n    parser.add_argument('iso_value', nargs='?', type=float, default=72.0, help='Defaullt 72.')\n    args = parser.parse_args()\n    return args.filename, args.iso_value\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ReadSTL/","title":"ReadSTL","text":"

        vtk-examples/Python/IO/ReadSTL

        "},{"location":"Python/IO/ReadSTL/#description","title":"Description","text":"

        Read an STL file and create a PolyData output

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadSTL/#code","title":"Code","text":"

        ReadSTL.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOGeometry import vtkSTLReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a .stl file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='42400-IDGH.stl')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    reader = vtkSTLReader()\n    reader.SetFileName(filename)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuse(0.8)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('LightSteelBlue'))\n    actor.GetProperty().SetSpecular(0.3)\n    actor.GetProperty().SetSpecularPower(60.0)\n\n    # Create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('ReadSTL')\n\n    # Create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('DarkOliveGreen'))\n\n    # Enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ReadUnstructuredGrid/","title":"ReadUnstructuredGrid","text":"

        vtk-examples/Python/IO/ReadUnstructuredGrid

        "},{"location":"Python/IO/ReadUnstructuredGrid/#description","title":"Description","text":"

        This example demonstrates how to read an unstructured grid (VTU) file. The front facing faces are colored Misty Rose, while the back facing faces are colored Tomato.

        An example file to use is src/Testing/Data/tetra.vtu.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadUnstructuredGrid/#code","title":"Code","text":"

        ReadUnstructuredGrid.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport vtkmodules.all as vtk\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read an unstructured grid file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='tetra.vtu.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtk.vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    # Read the source file.\n    reader = vtk.vtkXMLUnstructuredGridReader()\n    reader.SetFileName(file_name)\n    reader.Update()  # Needed because of GetScalarRange\n    output = reader.GetOutput()\n    # scalar_range = output.GetScalarRange()\n\n    # Create the mapper that corresponds the objects of the vtk.vtk file\n    # into graphics elements\n    mapper = vtk.vtkDataSetMapper()\n    mapper.SetInputData(output)\n    # mapper.SetScalarRange(scalar_range)\n    mapper.ScalarVisibilityOff()\n\n    # Create the Actor\n    actor = vtk.vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetLineWidth(2.0)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"MistyRose\"))\n\n    backface = vtk.vtkProperty()\n    backface.SetColor(colors.GetColor3d('Tomato'))\n    actor.SetBackfaceProperty(backface)\n\n    # Create the Renderer\n    renderer = vtk.vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n\n    # Create the RendererWindow\n    renderer_window = vtk.vtkRenderWindow()\n    renderer_window.SetSize(640, 480)\n    renderer_window.AddRenderer(renderer)\n    renderer_window.SetWindowName('ReadUnstructuredGrid')\n\n    # Create the RendererWindowInteractor and display the vtk_file\n    interactor = vtk.vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderer_window)\n    interactor.Initialize()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/ReadVTP/","title":"ReadVTP","text":"

        vtk-examples/Python/IO/ReadVTP

        Other languages

        See (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/ReadVTP/#code","title":"Code","text":"

        ReadVTP.py

        # noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a VTK XML PolyData file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='horse.vtp.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Tan'))\n\n    # Create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('ReadVTP')\n\n    # Create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Assign actor to the renderer\n    ren.AddActor(actor)\n\n    # Enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n\n    ren.SetBackground(colors.GetColor3d('AliceBlue'))\n    ren.GetActiveCamera().SetPosition(-0.5, 0.1, 0.0)\n    ren.GetActiveCamera().SetViewUp(0.1, 0.0, 1.0)\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/TransientHDFReader/","title":"TransientHDFReader","text":"

        vtk-examples/Python/IO/TransientHDFReader

        "},{"location":"Python/IO/TransientHDFReader/#description","title":"Description","text":"

        That example uses a feature of vtk_hdf5 that is only available in vtk/master and will be released with VTK 9.3. See this blog post for more information.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/TransientHDFReader/#code","title":"Code","text":"

        TransientHDFReader.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOHDF import vtkHDFReader\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDiscretizableColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read transient data writen inside a vtkhdf file.'\n    epilogue = ''''''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='warping_spheres.vtkhdf')\n    args = parser.parse_args()\n    return args.file_name\n\n\ndef main():\n    fn = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Read the dataset.\n    reader = vtkHDFReader()\n    reader.SetFileName(fn)\n    reader.Update()\n    print('Number of steps: ', reader.GetNumberOfSteps())\n    polydata = reader.GetOutput()\n\n    # Render the dataset.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polydata)\n    mapper.SetLookupTable(get_ctf())\n    mapper.SetScalarModeToUsePointFieldData()\n    mapper.SelectColorArray('SpatioTemporalHarmonics')\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renderer.UseHiddenLineRemovalOn()\n    renderer.AddActor(actor)\n\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetWindowName('TransientHDFReader')\n    ren_win.SetSize(1024, 512)\n    ren_win.Render()\n\n    # Add the interactor.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Add the animation callback.\n    observer = AnimationObserver(iren, reader)\n\n    # You must initialize the vtkRenderWindowInteractor\n    # before adding the observer and setting the repeating timer.\n    iren.Initialize()\n    iren.AddObserver('TimerEvent', observer)\n    iren.CreateRepeatingTimer(50)\n\n    i_style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(i_style)\n\n    iren.Start()\n\n\ndef get_ctf():\n    ctf = vtkDiscretizableColorTransferFunction()\n    ctf.SetColorSpaceToLab()\n    ctf.SetScaleToLinear()\n\n    ctf.AddRGBPoint(-30.3399130649763, 0.0862745098039216, 0.00392156862745098, 0.298039215686275)\n    ctf.AddRGBPoint(-29.3502559661865, 0.113725, 0.0235294, 0.45098)\n    ctf.AddRGBPoint(-28.5283393859863, 0.105882, 0.0509804, 0.509804)\n    ctf.AddRGBPoint(-27.958028793335, 0.0392157, 0.0392157, 0.560784)\n    ctf.AddRGBPoint(-27.4044914245605, 0.0313725, 0.0980392, 0.6)\n    ctf.AddRGBPoint(-26.8677291870117, 0.0431373, 0.164706, 0.639216)\n    ctf.AddRGBPoint(-26.096134185791, 0.054902, 0.243137, 0.678431)\n    ctf.AddRGBPoint(-25.0729293823242, 0.054902, 0.317647, 0.709804)\n    ctf.AddRGBPoint(-23.8148933330084, 0.0509804, 0.396078, 0.741176)\n    ctf.AddRGBPoint(-22.9992658665124, 0.0392157, 0.466667, 0.768627)\n    ctf.AddRGBPoint(-22.1836384000164, 0.0313725, 0.537255, 0.788235)\n    ctf.AddRGBPoint(-21.3323650360107, 0.0313725, 0.615686, 0.811765)\n    ctf.AddRGBPoint(-20.4601268768311, 0.0235294, 0.709804, 0.831373)\n    ctf.AddRGBPoint(-19.5878868103027, 0.0509804, 0.8, 0.85098)\n    ctf.AddRGBPoint(-18.8666133880615, 0.0705882, 0.854902, 0.870588)\n    ctf.AddRGBPoint(-18.1956596374512, 0.262745, 0.901961, 0.862745)\n    ctf.AddRGBPoint(-17.6085758209229, 0.423529, 0.941176, 0.87451)\n    ctf.AddRGBPoint(-16.7027893066406, 0.572549, 0.964706, 0.835294)\n    ctf.AddRGBPoint(-16.0989303588867, 0.658824, 0.980392, 0.843137)\n    ctf.AddRGBPoint(-15.6628112792969, 0.764706, 0.980392, 0.866667)\n    ctf.AddRGBPoint(-15.1931447982788, 0.827451, 0.980392, 0.886275)\n    ctf.AddRGBPoint(-14.2705841064453, 0.913725, 0.988235, 0.937255)\n    ctf.AddRGBPoint(-13.9854288101196, 1, 1, 0.972549019607843)\n    ctf.AddRGBPoint(-13.7002735137939, 0.988235, 0.980392, 0.870588)\n    ctf.AddRGBPoint(-13.2809276580811, 0.992156862745098, 0.972549019607843, 0.803921568627451)\n    ctf.AddRGBPoint(-12.9622249603271, 0.992157, 0.964706, 0.713725)\n    ctf.AddRGBPoint(-12.4254627227783, 0.988235, 0.956863, 0.643137)\n    ctf.AddRGBPoint(-11.5699977874756, 0.980392, 0.917647, 0.509804)\n    ctf.AddRGBPoint(-10.8487224578857, 0.968627, 0.87451, 0.407843)\n    ctf.AddRGBPoint(-10.1106739044189, 0.94902, 0.823529, 0.321569)\n    ctf.AddRGBPoint(-9.57391166687012, 0.929412, 0.776471, 0.278431)\n    ctf.AddRGBPoint(-8.78554153442383, 0.909804, 0.717647, 0.235294)\n    ctf.AddRGBPoint(-8.08104133605957, 0.890196, 0.658824, 0.196078)\n    ctf.AddRGBPoint(-7.50234400308847, 0.878431, 0.619608, 0.168627)\n    ctf.AddRGBPoint(-6.68671653659248, 0.870588, 0.54902, 0.156863)\n    ctf.AddRGBPoint(-5.87108907009648, 0.85098, 0.47451, 0.145098)\n    ctf.AddRGBPoint(-5.05546160360049, 0.831373, 0.411765, 0.133333)\n    ctf.AddRGBPoint(-4.23983413710449, 0.811765, 0.345098, 0.113725)\n    ctf.AddRGBPoint(-3.4242066706085, 0.788235, 0.266667, 0.0941176)\n    ctf.AddRGBPoint(-2.6085792041125, 0.741176, 0.184314, 0.0745098)\n    ctf.AddRGBPoint(-1.79295173761651, 0.690196, 0.12549, 0.0627451)\n    ctf.AddRGBPoint(-0.977324271120517, 0.619608, 0.0627451, 0.0431373)\n    ctf.AddRGBPoint(-0.214114964008331, 0.54902, 0.027451, 0.0705882)\n    ctf.AddRGBPoint(0.456838220357895, 0.470588, 0.0156863, 0.0901961)\n    ctf.AddRGBPoint(1.21166050434113, 0.4, 0.00392157, 0.101961)\n    ctf.AddRGBPoint(2.28518559486346, 0.188235294117647, 0, 0.0705882352941176)\n\n    ctf.SetNumberOfValues(46)\n    ctf.DiscretizeOff()\n\n    return ctf\n\n\nclass AnimationObserver(object):\n    def __init__(self, interactor, reader):\n        self.interactor = interactor\n        self.reader = reader\n\n    def __call__(self, caller, ev):\n        step = 0 if (self.reader.GetStep() == self.reader.GetNumberOfSteps() - 1) else self.reader.GetStep() + 1\n        self.reader.SetStep(step)\n        print('Current step: ', self.reader.GetStep())\n        self.reader.Update()\n        self.interactor.Render()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/WriteLegacyLinearCells/","title":"WriteLegacyLinearCells","text":"

        vtk-examples/Python/IO/WriteLegacyLinearCells

        "},{"location":"Python/IO/WriteLegacyLinearCells/#description","title":"Description","text":"

        This example uses vtkUnstructuredGridWriter to write each linear cell into a .vtk file. The files are written into the current directory.

        Seealso

        WriteXMLLinearCells writes the same files using the VTK XML format.

        Cite

        The VTK File Formats document discusses the XML file format.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/WriteLegacyLinearCells/#code","title":"Code","text":"

        WriteLegacyLinearCells.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkHexagonalPrism,\n    vtkHexahedron,\n    vtkLine,\n    vtkPentagonalPrism,\n    vtkPixel,\n    vtkPolyLine,\n    vtkPolyVertex,\n    vtkPolygon,\n    vtkPyramid,\n    vtkQuad,\n    vtkTetra,\n    vtkTriangle,\n    vtkTriangleStrip,\n    vtkUnstructuredGrid,\n    vtkVertex,\n    vtkVoxel,\n    vtkWedge\n)\nfrom vtkmodules.vtkIOLegacy import vtkUnstructuredGridWriter\n\n\ndef main():\n    filenames = list()\n    uGrids = list()\n\n    uGrids.append(MakeUnstructuredGrid(vtkVertex()))\n    filenames.append('Vertex.vtk')\n\n    uGrids.append(MakePolyVertex())\n    filenames.append('PolyVertex.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkLine()))\n    filenames.append('Line.vtk')\n\n    uGrids.append(MakePolyLine())\n    filenames.append('PolyLine.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkTriangle()))\n    filenames.append('Triangle.vtk')\n\n    uGrids.append(MakeTriangleStrip())\n    filenames.append('TriangleStrip.vtk')\n\n    uGrids.append(MakePolygon())\n    filenames.append('Polygon.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPixel()))\n    filenames.append('Pixel.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkQuad()))\n    filenames.append('Quad.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkTetra()))\n    filenames.append('Tetra.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkVoxel()))\n    filenames.append('Voxel.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkHexahedron()))\n    filenames.append('Hexahedron.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkWedge()))\n    filenames.append('Wedge.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPyramid()))\n    filenames.append('Pyramid.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPentagonalPrism()))\n    filenames.append('PentagonalPrism.vtk')\n\n    uGrids.append(MakeUnstructuredGrid(vtkHexagonalPrism()))\n    filenames.append('HexagonalPrism.vtk')\n\n    # Write each grid into  a file\n    for i in range(0, len(uGrids)):\n        print('Writing: ', filenames[i])\n        writer = vtkUnstructuredGridWriter()\n        writer.SetFileName(filenames[i])\n        writer.SetInputData(uGrids[i])\n        writer.Write()\n\n\ndef MakeUnstructuredGrid(aCell):\n    pcoords = aCell.GetParametricCoords()\n    for i in range(0, aCell.GetNumberOfPoints()):\n        aCell.GetPointIds().SetId(i, i)\n        aCell.GetPoints().SetPoint(i, (pcoords[3 * i]), (pcoords[3 * i + 1]), (pcoords[3 * i + 2]))\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(aCell.GetPoints())\n    ug.InsertNextCell(aCell.GetCellType(), aCell.GetPointIds())\n    return ug\n\n\ndef MakePolyVertex():\n    # A polyvertex is a cell represents a set of 0D vertices\n    numberOfVertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, .4)\n    points.InsertNextPoint(0, 1, .6)\n\n    polyVertex = vtkPolyVertex()\n    polyVertex.GetPointIds().SetNumberOfIds(numberOfVertices)\n\n    for i in range(0, numberOfVertices):\n        polyVertex.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polyVertex.GetCellType(), polyVertex.GetPointIds())\n\n    return ug\n\n\ndef MakePolyLine():\n    # A polyline is a cell that represents a set of 1D lines\n    numberOfVertices = 5\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, .5, 0)\n    points.InsertNextPoint(.5, 0, 0)\n    points.InsertNextPoint(1, .3, 0)\n    points.InsertNextPoint(1.5, .4, 0)\n    points.InsertNextPoint(2.0, .4, 0)\n\n    polyline = vtkPolyLine()\n    polyline.GetPointIds().SetNumberOfIds(numberOfVertices)\n\n    for i in range(0, numberOfVertices):\n        polyline.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polyline.GetCellType(), polyline.GetPointIds())\n\n    return ug\n\n\ndef MakeTriangleStrip():\n    # A triangle is a cell that represents a triangle strip\n    numberOfVertices = 10\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(.5, 1, 0)\n    points.InsertNextPoint(1, -.1, 0)\n    points.InsertNextPoint(1.5, .8, 0)\n    points.InsertNextPoint(2.0, -.1, 0)\n    points.InsertNextPoint(2.5, .9, 0)\n    points.InsertNextPoint(3.0, 0, 0)\n    points.InsertNextPoint(3.5, .8, 0)\n    points.InsertNextPoint(4.0, -.2, 0)\n    points.InsertNextPoint(4.5, 1.1, 0)\n\n    trianglestrip = vtkTriangleStrip()\n    trianglestrip.GetPointIds().SetNumberOfIds(numberOfVertices)\n    for i in range(0, numberOfVertices):\n        trianglestrip.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(trianglestrip.GetCellType(), trianglestrip.GetPointIds())\n\n    return ug\n\n\ndef MakePolygon():\n    # A polygon is a cell that represents a polygon\n    numberOfVertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, -.1, 0)\n    points.InsertNextPoint(.8, .5, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(.6, 1.2, 0)\n    points.InsertNextPoint(0, .8, 0)\n\n    polygon = vtkPolygon()\n    polygon.GetPointIds().SetNumberOfIds(numberOfVertices)\n    for i in range(0, numberOfVertices):\n        polygon.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polygon.GetCellType(), polygon.GetPointIds())\n\n    return ug\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/WritePLY/","title":"WritePLY","text":"

        vtk-examples/Python/IO/WritePLY

        "},{"location":"Python/IO/WritePLY/#description","title":"Description","text":"

        Note

        Unlike vtkPolyDataXMLWriter and most other VTK writers, to write colors to the .ply file you must specify to the vtkPLYWriter:

        plyWriter->SetArrayName(\"Colors\");

        where your color array was created/named like this:

        vtkNew<vtkUnsignedCharArray> colors; colors->SetNumberOfComponents(3); colors->SetName(\"Colors\");

        (This was found in response to a user question on StackOverflow: http://stackoverflow.com/questions/17783612/save-mesh-with-rgb-in-vtk/19525938)

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/WritePLY/#code","title":"Code","text":"

        WritePLY.py

        # noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOPLY import (\n    vtkPLYReader,\n    vtkPLYWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate image data, then write a .ply file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required ply filename.', nargs='?',\n                        const='TestWritePLY.ply',\n                        type=str, default='TestWritePLY.ply')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    plyWriter = vtkPLYWriter()\n    plyWriter.SetFileName(filename)\n    plyWriter.SetInputConnection(sphereSource.GetOutputPort())\n    plyWriter.Write()\n\n    # Read and display for verification\n    reader = vtkPLYReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('WritePLY')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('cobalt_green'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/WriteSTL/","title":"WriteSTL","text":"

        vtk-examples/Python/IO/WriteSTL

        "},{"location":"Python/IO/WriteSTL/#description","title":"Description","text":"

        An STL file describes a triangulated three-dimensional surface by the unit normal and vertices (ordered by the right-hand rule) of the triangles. This example saves 3D geometric data stored in a vtkPolyData object to an STL file using vtkSTLWriter.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/WriteSTL/#code","title":"Code","text":"

        WriteSTL.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOGeometry import (\n    vtkSTLReader,\n    vtkSTLWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate image data, then write a .stl file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required stl filename.', nargs='?',\n                        const='TestWriteSTL.ply',\n                        type=str, default='TestWriteSTL.ply')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    # Write the stl file to disk\n    stlWriter = vtkSTLWriter()\n    stlWriter.SetFileName(filename)\n    stlWriter.SetInputConnection(sphereSource.GetOutputPort())\n    stlWriter.Write()\n\n    # Read and display for verification\n    reader = vtkSTLReader()\n    reader.SetFileName(filename)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # Create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('WriteSTL')\n\n    # Create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('cobalt_green'))\n\n    # Enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/WriteTriangleToFile/","title":"WriteTriangleToFile","text":"

        vtk-examples/Python/IO/WriteTriangleToFile

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/WriteTriangleToFile/#code","title":"Code","text":"

        WriteTriangleToFile.py

        # noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangle\n)\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate image data, then write a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestWriteTriangleToFile.vtp',\n                        type=str, default='TestWriteTriangleToFile.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filename = get_program_parameters()\n\n    Points = vtkPoints()\n    Triangles = vtkCellArray()\n    Triangle = vtkTriangle()\n\n    Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    Triangle.GetPointIds().SetId(0, 0)\n    Triangle.GetPointIds().SetId(1, 1)\n    Triangle.GetPointIds().SetId(2, 2)\n    Triangles.InsertNextCell(Triangle)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.SetPolys(Triangles)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/IO/WriteXMLLinearCells/","title":"WriteXMLLinearCells","text":"

        vtk-examples/Python/IO/WriteXMLLinearCells

        "},{"location":"Python/IO/WriteXMLLinearCells/#description","title":"Description","text":"

        This example uses vtkXMLDataSetWriter to write each linear cell into a .vtu file. The files are written into the current directory.

        Seealso

        WriteLegacyLinearCells writes the same files using the VTK legacy format.

        Cite

        The VTK File Formats document discusses the XML file format.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/IO/WriteXMLLinearCells/#code","title":"Code","text":"

        WriteXMLLinearCells.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkHexagonalPrism,\n    vtkHexahedron,\n    vtkLine,\n    vtkPentagonalPrism,\n    vtkPixel,\n    vtkPolyLine,\n    vtkPolyVertex,\n    vtkPolygon,\n    vtkPyramid,\n    vtkQuad,\n    vtkTetra,\n    vtkTriangle,\n    vtkTriangleStrip,\n    vtkUnstructuredGrid,\n    vtkVertex,\n    vtkVoxel,\n    vtkWedge\n)\nfrom vtkmodules.vtkIOXML import vtkXMLDataSetWriter\n\n\ndef main():\n    filenames = list()\n    uGrids = list()\n\n    uGrids.append(MakeUnstructuredGrid(vtkVertex()))\n    filenames.append('Vertex.vtu')\n\n    uGrids.append(MakePolyVertex())\n    filenames.append('PolyVertex.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkLine()))\n    filenames.append('Line.vtu')\n\n    uGrids.append(MakePolyLine())\n    filenames.append('PolyLine.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkTriangle()))\n    filenames.append('Triangle.vtu')\n\n    uGrids.append(MakeTriangleStrip())\n    filenames.append('TriangleStrip.vtu')\n\n    uGrids.append(MakePolygon())\n    filenames.append('Polygon.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPixel()))\n    filenames.append('Pixel.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkQuad()))\n    filenames.append('Quad.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkTetra()))\n    filenames.append('Tetra.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkVoxel()))\n    filenames.append('Voxel.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkHexahedron()))\n    filenames.append('Hexahedron.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkWedge()))\n    filenames.append('Wedge.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPyramid()))\n    filenames.append('Pyramid.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkPentagonalPrism()))\n    filenames.append('PentagonalPrism.vtu')\n\n    uGrids.append(MakeUnstructuredGrid(vtkHexagonalPrism()))\n    filenames.append('HexagonalPrism.vtu')\n\n    # Write each grid into  a file\n    for i in range(0, len(uGrids)):\n        print('Writing: ', filenames[i])\n        writer = vtkXMLDataSetWriter()\n        writer.SetFileName(filenames[i])\n        writer.SetInputData(uGrids[i])\n        writer.Write()\n\n\ndef MakeUnstructuredGrid(aCell):\n    pcoords = aCell.GetParametricCoords()\n    for i in range(0, aCell.GetNumberOfPoints()):\n        aCell.GetPointIds().SetId(i, i)\n        aCell.GetPoints().SetPoint(i, (pcoords[3 * i]), (pcoords[3 * i + 1]), (pcoords[3 * i + 2]))\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(aCell.GetPoints())\n    ug.InsertNextCell(aCell.GetCellType(), aCell.GetPointIds())\n    return ug\n\n\ndef MakePolyVertex():\n    # A polyvertex is a cell represents a set of 0D vertices\n    numberOfVertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, 0, 0)\n    points.InsertNextPoint(0, 1, 0)\n    points.InsertNextPoint(0, 0, 1)\n    points.InsertNextPoint(1, 0, .4)\n    points.InsertNextPoint(0, 1, .6)\n\n    polyVertex = vtkPolyVertex()\n    polyVertex.GetPointIds().SetNumberOfIds(numberOfVertices)\n\n    for i in range(0, numberOfVertices):\n        polyVertex.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polyVertex.GetCellType(), polyVertex.GetPointIds())\n\n    return ug\n\n\ndef MakePolyLine():\n    # A polyline is a cell that represents a set of 1D lines\n    numberOfVertices = 5\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, .5, 0)\n    points.InsertNextPoint(.5, 0, 0)\n    points.InsertNextPoint(1, .3, 0)\n    points.InsertNextPoint(1.5, .4, 0)\n    points.InsertNextPoint(2.0, .4, 0)\n\n    polyline = vtkPolyLine()\n    polyline.GetPointIds().SetNumberOfIds(numberOfVertices)\n\n    for i in range(0, numberOfVertices):\n        polyline.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polyline.GetCellType(), polyline.GetPointIds())\n\n    return ug\n\n\ndef MakeTriangleStrip():\n    # A triangle is a cell that represents a triangle strip\n    numberOfVertices = 10\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(.5, 1, 0)\n    points.InsertNextPoint(1, -.1, 0)\n    points.InsertNextPoint(1.5, .8, 0)\n    points.InsertNextPoint(2.0, -.1, 0)\n    points.InsertNextPoint(2.5, .9, 0)\n    points.InsertNextPoint(3.0, 0, 0)\n    points.InsertNextPoint(3.5, .8, 0)\n    points.InsertNextPoint(4.0, -.2, 0)\n    points.InsertNextPoint(4.5, 1.1, 0)\n\n    trianglestrip = vtkTriangleStrip()\n    trianglestrip.GetPointIds().SetNumberOfIds(numberOfVertices)\n    for i in range(0, numberOfVertices):\n        trianglestrip.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(trianglestrip.GetCellType(), trianglestrip.GetPointIds())\n\n    return ug\n\n\ndef MakePolygon():\n    # A polygon is a cell that represents a polygon\n    numberOfVertices = 6\n\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(1, -.1, 0)\n    points.InsertNextPoint(.8, .5, 0)\n    points.InsertNextPoint(1, 1, 0)\n    points.InsertNextPoint(.6, 1.2, 0)\n    points.InsertNextPoint(0, .8, 0)\n\n    polygon = vtkPolygon()\n    polygon.GetPointIds().SetNumberOfIds(numberOfVertices)\n    for i in range(0, numberOfVertices):\n        polygon.GetPointIds().SetId(i, i)\n\n    ug = vtkUnstructuredGrid()\n    ug.SetPoints(points)\n    ug.InsertNextCell(polygon.GetCellType(), polygon.GetPointIds())\n\n    return ug\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageData/ImageDataGeometryFilter/","title":"ImageDataGeometryFilter","text":"

        vtk-examples/Python/ImageData/ImageDataGeometryFilter

        "},{"location":"Python/ImageData/ImageDataGeometryFilter/#description","title":"Description","text":"

        Convert a vtkImageData to a vtkPolyData.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageData/ImageDataGeometryFilter/#code","title":"Code","text":"

        ImageDataGeometryFilter.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkImagingSources import vtkImageCanvasSource2D\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create an image\n    source1 = vtkImageCanvasSource2D()\n    source1.SetScalarTypeToUnsignedChar()\n    source1.SetNumberOfScalarComponents(3)\n    source1.SetExtent(0, 100, 0, 100, 0, 0)\n    source1.SetDrawColor(colors.GetColor4ub('SteelBlue'))\n    source1.FillBox(0, 100, 0, 100)\n    source1.SetDrawColor(colors.GetColor4ub('PaleGoldenrod'))\n    source1.FillBox(10, 20, 10, 20)\n    source1.FillBox(40, 50, 20, 30)\n    source1.Update()\n\n    # Convert the image to a polydata\n    imageDataGeometryFilter = vtkImageDataGeometryFilter()\n    imageDataGeometryFilter.SetInputConnection(source1.GetOutputPort())\n    imageDataGeometryFilter.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(imageDataGeometryFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Visualization\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('RosyBrown'))\n    renderWindow.SetWindowName('ImageDataGeometryFilter')\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageData/ImageNormalize/","title":"ImageNormalize","text":"

        vtk-examples/Python/ImageData/ImageNormalize

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageData/ImageNormalize/#code","title":"Code","text":"

        ImageNormalize.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkImagingCore import vtkImageCast\nfrom vtkmodules.vtkImagingGeneral import vtkImageNormalize\nfrom vtkmodules.vtkImagingSources import vtkImageSinusoidSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create an image\n    source = vtkImageSinusoidSource()\n    source.Update()\n\n    normalizeFilter = vtkImageNormalize()\n\n    normalizeFilter.SetInputConnection(source.GetOutputPort())\n    normalizeFilter.Update()\n\n    inputCastFilter = vtkImageCast()\n    inputCastFilter.SetInputConnection(source.GetOutputPort())\n    inputCastFilter.SetOutputScalarTypeToUnsignedChar()\n    inputCastFilter.Update()\n\n    normalizeCastFilter = vtkImageCast()\n    normalizeCastFilter.SetInputConnection(normalizeFilter.GetOutputPort())\n    normalizeCastFilter.SetOutputScalarTypeToUnsignedChar()\n    normalizeCastFilter.Update()\n\n    # Create actors\n    inputActor = vtkImageActor()\n    inputActor.GetMapper().SetInputConnection(inputCastFilter.GetOutputPort())\n\n    normalizedActor = vtkImageActor()\n    normalizedActor.GetMapper().SetInputConnection(normalizeCastFilter.GetOutputPort())\n\n    # There will be one render window\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n\n    # And one interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Define viewport ranges\n    # (xmin, ymin, xmax, ymax)\n    leftViewport = [0.0, 0.0, 0.5, 1.0]\n    rightViewport = [0.5, 0.0, 1.0, 1.0]\n\n    # Setup both renderers\n    leftRenderer = vtkRenderer()\n    renderWindow.AddRenderer(leftRenderer)\n    leftRenderer.SetViewport(leftViewport)\n    leftRenderer.SetBackground(colors.GetColor3d('Sienna'))\n\n    rightRenderer = vtkRenderer()\n    renderWindow.AddRenderer(rightRenderer)\n    rightRenderer.SetViewport(rightViewport)\n    rightRenderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    leftRenderer.AddActor(inputActor)\n    rightRenderer.AddActor(normalizedActor)\n\n    leftRenderer.ResetCamera()\n\n    rightRenderer.ResetCamera()\n\n    renderWindow.SetWindowName('ImageNormalize')\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageData/ImageWeightedSum/","title":"ImageWeightedSum","text":"

        vtk-examples/Python/ImageData/ImageWeightedSum

        "},{"location":"Python/ImageData/ImageWeightedSum/#description","title":"Description","text":"

        Sum multiple images. Images must be of the same size and type.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageData/ImageWeightedSum/#code","title":"Code","text":"

        ImageWeightedSum.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkImagingCore import vtkImageCast\nfrom vtkmodules.vtkImagingMath import vtkImageWeightedSum\nfrom vtkmodules.vtkImagingSources import (\n    vtkImageMandelbrotSource,\n    vtkImageSinusoidSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create image 1\n    source1 = vtkImageMandelbrotSource()\n    source1.SetWholeExtent(0, 255, 0, 255, 0, 0)\n    source1.Update()\n\n    source1Double = vtkImageCast()\n    source1Double.SetInputConnection(0, source1.GetOutputPort())\n    source1Double.SetOutputScalarTypeToDouble()\n\n    # Create image 2\n    source2 = vtkImageSinusoidSource()\n    source2.SetWholeExtent(0, 255, 0, 255, 0, 0)\n    source2.Update()\n\n    # Do the sum\n    sumFilter = vtkImageWeightedSum()\n    sumFilter.SetWeight(0, 0.8)\n    sumFilter.SetWeight(1, 0.2)\n    sumFilter.AddInputConnection(source1Double.GetOutputPort())\n    sumFilter.AddInputConnection(source2.GetOutputPort())\n    sumFilter.Update()\n\n    # Display the images\n    source1CastFilter = vtkImageCast()\n    source1CastFilter.SetInputConnection(source1.GetOutputPort())\n    source1CastFilter.SetOutputScalarTypeToUnsignedChar()\n    source1CastFilter.Update()\n\n    source2CastFilter = vtkImageCast()\n    source2CastFilter.SetInputConnection(source2.GetOutputPort())\n    source2CastFilter.SetOutputScalarTypeToUnsignedChar()\n    source2CastFilter.Update()\n\n    summedCastFilter = vtkImageCast()\n    summedCastFilter.SetInputConnection(sumFilter.GetOutputPort())\n    summedCastFilter.SetOutputScalarTypeToUnsignedChar()\n    summedCastFilter.Update()\n\n    # Create actors\n    source1Actor = vtkImageActor()\n    source1Actor.GetMapper().SetInputConnection(source1CastFilter.GetOutputPort())\n\n    source2Actor = vtkImageActor()\n    source2Actor.GetMapper().SetInputConnection(source2CastFilter.GetOutputPort())\n\n    summedActor = vtkImageActor()\n    summedActor.GetMapper().SetInputConnection(summedCastFilter.GetOutputPort())\n\n    # There will be one render window\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n\n    # And one interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Define viewport ranges\n    # (xmin, ymin, xmax, ymax)\n    leftViewport = [0.0, 0.0, 0.33, 1.0]\n    centerViewport = [0.33, 0.0, .66, 1.0]\n    rightViewport = [0.66, 0.0, 1.0, 1.0]\n\n    # Setup renderers\n    leftRenderer = vtkRenderer()\n    renderWindow.AddRenderer(leftRenderer)\n    leftRenderer.SetViewport(leftViewport)\n    leftRenderer.SetBackground(colors.GetColor3d('Peru'))\n\n    centerRenderer = vtkRenderer()\n    renderWindow.AddRenderer(centerRenderer)\n    centerRenderer.SetViewport(centerViewport)\n    centerRenderer.SetBackground(colors.GetColor3d('DarkTurquoise'))\n\n    rightRenderer = vtkRenderer()\n    renderWindow.AddRenderer(rightRenderer)\n    rightRenderer.SetViewport(rightViewport)\n    rightRenderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    leftRenderer.AddActor(source1Actor)\n    centerRenderer.AddActor(source2Actor)\n    rightRenderer.AddActor(summedActor)\n\n    leftRenderer.ResetCamera()\n    centerRenderer.ResetCamera()\n    rightRenderer.ResetCamera()\n\n    renderWindow.SetWindowName('ImageWeightedSum')\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageData/SumVTKImages/","title":"SumVTKImages","text":"

        vtk-examples/Python/ImageData/SumVTKImages

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageData/SumVTKImages/#code","title":"Code","text":"

        SumVTKImages.py

        #!/usr/bin/env python\n\nfrom vtkmodules.vtkImagingMath import vtkImageWeightedSum\n\n\n# ImageSets = List of Image sets\n# Weights  = List of weights e.g [1, 1, 1]\n\ndef SumVTKImages(ImageSets, Weights):\n    NumOfImages = len(ImageSets)\n    SumFilter = vtkImageWeightedSum()\n    for x in range(0, NumOfImages, 1):\n        SumFilter.AddInputConnection(ImageSets[x])\n        SumFilter.SetWeight(x, Weights[x])\n    SumFilter.Update()\n\n    # Return summed Image as vtkImageData\n    return SumFilter.GetOutput()\n
        "},{"location":"Python/ImageData/WriteReadVtkImageData/","title":"WriteReadVtkImageData","text":"

        vtk-examples/Python/ImageData/WriteReadVtkImageData

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageData/WriteReadVtkImageData/#code","title":"Code","text":"

        WriteReadVtkImageData.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import VTK_DOUBLE\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkIOXML import (\n    vtkXMLImageDataReader,\n    vtkXMLImageDataWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate image data, edit data points, store and reload it.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtk filename, e.g. writeImageData.vti.', nargs='?',\n                        const='writeImageData.vti',\n                        type=str, default='writeImageData.vti')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    imageData = vtkImageData()\n    imageData.SetDimensions(3, 4, 5)\n    imageData.AllocateScalars(VTK_DOUBLE, 1)\n\n    dims = imageData.GetDimensions()\n\n    # Fill every entry of the image data with '2.0'\n    for z in range(dims[2]):\n        for y in range(dims[1]):\n            for x in range(dims[0]):\n                imageData.SetScalarComponentFromDouble(x, y, z, 0, 2.0)\n\n    writer = vtkXMLImageDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(imageData)\n    writer.Write()\n\n    # Read the file (to test that it was written correctly)\n    reader = vtkXMLImageDataReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    # Convert the image to a polydata\n    imageDataGeometryFilter = vtkImageDataGeometryFilter()\n    imageDataGeometryFilter.SetInputConnection(reader.GetOutputPort())\n    imageDataGeometryFilter.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(imageDataGeometryFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetPointSize(3)\n\n    # Setup rendering\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('White'))\n    renderer.ResetCamera()\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageProcessing/Attenuation/","title":"Attenuation","text":"

        vtk-examples/Python/ImageProcessing/Attenuation

        "},{"location":"Python/ImageProcessing/Attenuation/#description","title":"Description","text":"

        This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. This histograms shows how the artifact hides information in the form of scalar value clusters.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageProcessing/Attenuation/#code","title":"Code","text":"

        Attenuation.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkSphere\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageCast,\n    vtkImageShiftScale\n)\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToDouble()\n\n    # Get rid of the discrete scalars.\n    smooth = vtkImageGaussianSmooth()\n    smooth.SetInputConnection(cast.GetOutputPort())\n    smooth.SetStandardDeviations(0.8, 0.8, 0)\n\n    m1 = vtkSphere()\n    m1.SetCenter(310, 130, 0)\n    m1.SetRadius(0)\n\n    m2 = vtkSampleFunction()\n    m2.SetImplicitFunction(m1)\n    m2.SetModelBounds(0, 264, 0, 264, 0, 1)\n    m2.SetSampleDimensions(264, 264, 1)\n\n    m3 = vtkImageShiftScale()\n    m3.SetInputConnection(m2.GetOutputPort())\n    m3.SetScale(0.000095)\n\n    div = vtkImageMathematics()\n    div.SetInputConnection(0, smooth.GetOutputPort())\n    div.SetInputConnection(1, m3.GetOutputPort())\n    div.SetOperationToMultiply()\n\n    # Create the actors.\n    colorWindow = 256.0\n    colorLevel = 127.5\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputConnection(cast.GetOutputPort())\n    originalActor.GetProperty().SetColorWindow(colorWindow)\n    originalActor.GetProperty().SetColorLevel(colorLevel)\n\n    filteredActor = vtkImageActor()\n    filteredActor.GetMapper().SetInputConnection(div.GetOutputPort())\n\n    # Define the viewport ranges.\n    # (xmin, ymin, xmax, ymax)\n    originalViewport = [0.0, 0.0, 0.5, 1.0]\n    filteredViewport = [0.5, 0.0, 1.0, 1.0]\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.SetViewport(originalViewport)\n    originalRenderer.AddActor(originalActor)\n    originalRenderer.ResetCamera()\n    originalRenderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    filteredRenderer = vtkRenderer()\n    filteredRenderer.SetViewport(filteredViewport)\n    filteredRenderer.AddActor(filteredActor)\n    filteredRenderer.ResetCamera()\n    filteredRenderer.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.AddRenderer(originalRenderer)\n    renderWindow.AddRenderer(filteredRenderer)\n    renderWindow.SetWindowName('Attenuation')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindowInteractor.Initialize()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This MRI image illustrates attenuation that can occur due to sensor position.'\n    epilogue = '''\n    The artifact is removed by dividing by the attenuation profile determined manually.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='AttenuationArtifact.pgm.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageProcessing/EnhanceEdges/","title":"EnhanceEdges","text":"

        vtk-examples/Python/ImageProcessing/EnhanceEdges

        "},{"location":"Python/ImageProcessing/EnhanceEdges/#description","title":"Description","text":"

        High-pass filters can also be used to compress the range of an image. Since low frequencies account for much of the dynamic range of an image but carry little information, a high-pass filter can significantly decrease an image\u2019s scalar range and emphasize hidden details. The Laplacian filter, which is a second derivative operation, is one implementation of a high-pass filter. It eliminates constant and low frequencies leaving only high-frequency edges. The output of the Laplacian can be subtracted from the original image to produce edge enhancement or sharpening of an image.

        This example subtracts the Laplacian (middle) from the original image (left) resulting in edge enhancement or a sharpening operation (right).

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageProcessing/EnhanceEdges/#code","title":"Code","text":"

        EnhanceEdges.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingColor import vtkImageMapToWindowLevelColors\nfrom vtkmodules.vtkImagingCore import vtkImageCast\nfrom vtkmodules.vtkImagingGeneral import vtkImageLaplacian\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    scalarRange = [0] * 2\n    scalarRange[0] = reader.GetOutput().GetPointData().GetScalars().GetRange()[0]\n    scalarRange[1] = reader.GetOutput().GetPointData().GetScalars().GetRange()[1]\n    print(\"Range:\", scalarRange)\n    middleSlice = 22\n\n    # Work with triple images.\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToDouble()\n    cast.Update()\n\n    laplacian = vtkImageLaplacian()\n    laplacian.SetInputConnection(cast.GetOutputPort())\n    laplacian.SetDimensionality(3)\n\n    enhance = vtkImageMathematics()\n    enhance.SetInputConnection(0, cast.GetOutputPort())\n    enhance.SetInputConnection(1, laplacian.GetOutputPort())\n    enhance.SetOperationToSubtract()\n\n    colorWindow = (scalarRange[1] - scalarRange[0])\n    colorLevel = colorWindow / 2\n\n    # Map the image through the lookup table.\n    originalColor = vtkImageMapToWindowLevelColors()\n    originalColor.SetWindow(colorWindow)\n    originalColor.SetLevel(colorLevel)\n    originalColor.SetInputConnection(reader.GetOutputPort())\n\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputConnection(originalColor.GetOutputPort())\n    originalActor.GetProperty().SetInterpolationTypeToNearest()\n    originalActor.SetDisplayExtent(\n        reader.GetDataExtent()[0], reader.GetDataExtent()[1],\n        reader.GetDataExtent()[2], reader.GetDataExtent()[3],\n        middleSlice, middleSlice)\n\n    laplacianColor = vtkImageMapToWindowLevelColors()\n    laplacianColor.SetWindow(1000)\n    laplacianColor.SetLevel(0)\n    laplacianColor.SetInputConnection(laplacian.GetOutputPort())\n\n    laplacianActor = vtkImageActor()\n    laplacianActor.GetMapper().SetInputConnection(laplacianColor.GetOutputPort())\n    laplacianActor.GetProperty().SetInterpolationTypeToNearest()\n    laplacianActor.SetDisplayExtent(originalActor.GetDisplayExtent())\n\n    enhancedColor = vtkImageMapToWindowLevelColors()\n    enhancedColor.SetWindow(colorWindow)\n    enhancedColor.SetLevel(colorLevel)\n    enhancedColor.SetInputConnection(enhance.GetOutputPort())\n\n    enhancedActor = vtkImageActor()\n    enhancedActor.GetMapper().SetInputConnection(enhancedColor.GetOutputPort())\n    enhancedActor.GetProperty().SetInterpolationTypeToNearest()\n    enhancedActor.SetDisplayExtent(originalActor.GetDisplayExtent())\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.AddActor(originalActor)\n    laplacianRenderer = vtkRenderer()\n    laplacianRenderer.AddActor(laplacianActor)\n    enhancedRenderer = vtkRenderer()\n    enhancedRenderer.AddActor(enhancedActor)\n\n    renderers = list()\n    renderers.append(originalRenderer)\n    renderers.append(laplacianRenderer)\n    renderers.append(enhancedRenderer)\n\n    # Setup viewports for the renderers.\n    rendererSize = 400\n    xGridDimensions = 3\n    yGridDimensions = 1\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(xGridDimensions):\n            index = row * xGridDimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions, float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions, float(yGridDimensions - row) / yGridDimensions]\n            renderers[index].SetViewport(viewport)\n            renderWindow.AddRenderer(renderers[index])\n    renderWindow.SetWindowName('EnhanceEdges')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Renderers share one camera.\n    renderWindow.Render()\n    renderers[0].GetActiveCamera().Dolly(1.5)\n    renderers[0].ResetCameraClippingRange()\n\n    for r in range(1, len(renderers)):\n        renderers[r].SetActiveCamera(renderers[0].GetActiveCamera())\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'High-pass filters can extract and enhance edges in an image.'\n    epilogue = '''\n    Subtraction of the Laplacian (middle) from the original image (left) results\n     in edge enhancement or a sharpening operation (right).\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageProcessing/GaussianSmooth/","title":"GaussianSmooth","text":"

        vtk-examples/Python/ImageProcessing/GaussianSmooth

        "},{"location":"Python/ImageProcessing/GaussianSmooth/#description","title":"Description","text":"

        Low-pass filters can be implemented as convolution with a Gaussian kernel. The Gaussian kernel displayed on top has been magnified for this figure.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageProcessing/GaussianSmooth/#code","title":"Code","text":"

        GaussianSmooth.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import vtkImageCast\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    # Process the image.\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToFloat()\n\n    smoothing_filter = vtkImageGaussianSmooth()\n    smoothing_filter.SetDimensionality(2)\n    smoothing_filter.SetInputConnection(cast.GetOutputPort())\n    smoothing_filter.SetStandardDeviations(4.0, 4.0)\n    smoothing_filter.SetRadiusFactors(2.0, 2.0)\n\n    # Create the actors.\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputConnection(\n        reader.GetOutputPort())\n\n    filteredActor = vtkImageActor()\n    filteredActor.GetMapper().SetInputConnection(\n        smoothing_filter.GetOutputPort())\n\n    # Define the viewport ranges.\n    # (xmin, ymin, xmax, ymax)\n    originalViewport = [0.0, 0.0, 0.5, 1.0]\n    filteredViewport = [0.5, 0.0, 1.0, 1.0]\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.SetViewport(originalViewport)\n    originalRenderer.AddActor(originalActor)\n    originalRenderer.ResetCamera()\n    originalRenderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    filteredRenderer = vtkRenderer()\n    filteredRenderer.SetViewport(filteredViewport)\n    filteredRenderer.AddActor(filteredActor)\n    filteredRenderer.ResetCamera()\n    filteredRenderer.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.SetWindowName('GaussianSmooth')\n    renderWindow.AddRenderer(originalRenderer)\n    renderWindow.AddRenderer(filteredRenderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindowInteractor.Initialize()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Low-pass filters can be implemented as convolution with a Gaussian kernel.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Gourds.png.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageProcessing/HybridMedianComparison/","title":"HybridMedianComparison","text":"

        vtk-examples/Python/ImageProcessing/HybridMedianComparison

        "},{"location":"Python/ImageProcessing/HybridMedianComparison/#description","title":"Description","text":"

        Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. The lower patterns represent the three neighborhoods used to compute the hybrid median.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageProcessing/HybridMedianComparison/#code","title":"Code","text":"

        HybridMedianComparison.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageCast,\n    vtkImageThreshold\n)\nfrom vtkmodules.vtkImagingGeneral import (\n    vtkImageHybridMedian2D,\n    vtkImageMedian3D\n)\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkImagingSources import vtkImageNoiseSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    scalarRange = [0] * 2\n    scalarRange[0] = reader.GetOutput().GetPointData().GetScalars().GetRange()[0]\n    scalarRange[1] = reader.GetOutput().GetPointData().GetScalars().GetRange()[1]\n    print(\"Range:\", scalarRange)\n    middleSlice = (reader.GetOutput().GetExtent()[5] - reader.GetOutput().GetExtent()[4]) // 2\n\n    # Work with double images.\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToDouble()\n    cast.Update()\n\n    originalData = vtkImageData()\n    originalData.DeepCopy(cast.GetOutput())\n\n    noisyData = vtkImageData()\n\n    AddShotNoise(originalData, noisyData, 2000.0, 0.1, reader.GetOutput().GetExtent())\n    median = vtkImageMedian3D()\n    median.SetInputData(noisyData)\n    median.SetKernelSize(5, 5, 1)\n\n    hybridMedian1 = vtkImageHybridMedian2D()\n    hybridMedian1.SetInputData(noisyData)\n    hybridMedian = vtkImageHybridMedian2D()\n    hybridMedian.SetInputConnection(hybridMedian1.GetOutputPort())\n\n    colorWindow = (scalarRange[1] - scalarRange[0]) * 0.8\n    colorLevel = colorWindow / 2\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputData(originalData)\n    originalActor.GetProperty().SetColorWindow(colorWindow)\n    originalActor.GetProperty().SetColorLevel(colorLevel)\n    originalActor.GetProperty().SetInterpolationTypeToNearest()\n    originalActor.SetDisplayExtent(reader.GetDataExtent()[0], reader.GetDataExtent()[1], reader.GetDataExtent()[2],\n                                   reader.GetDataExtent()[3], middleSlice, middleSlice)\n\n    noisyActor = vtkImageActor()\n    noisyActor.GetMapper().SetInputData(noisyData)\n    noisyActor.GetProperty().SetColorWindow(colorWindow)\n    noisyActor.GetProperty().SetColorLevel(colorLevel)\n    noisyActor.GetProperty().SetInterpolationTypeToNearest()\n    noisyActor.SetDisplayExtent(originalActor.GetDisplayExtent())\n\n    hybridMedianActor = vtkImageActor()\n    hybridMedianActor.GetMapper().SetInputConnection(hybridMedian.GetOutputPort())\n    hybridMedianActor.GetProperty().SetColorWindow(colorWindow)\n    hybridMedianActor.GetProperty().SetColorLevel(colorLevel)\n    hybridMedianActor.GetProperty().SetInterpolationTypeToNearest()\n    hybridMedianActor.SetDisplayExtent(originalActor.GetDisplayExtent())\n\n    medianActor = vtkImageActor()\n    medianActor.GetMapper().SetInputConnection(median.GetOutputPort())\n    medianActor.GetProperty().SetColorWindow(colorWindow)\n    medianActor.GetProperty().SetColorLevel(colorLevel)\n    medianActor.GetProperty().SetInterpolationTypeToNearest()\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.AddActor(originalActor)\n    noisyRenderer = vtkRenderer()\n    noisyRenderer.AddActor(noisyActor)\n    hybridRenderer = vtkRenderer()\n    hybridRenderer.AddActor(hybridMedianActor)\n    medianRenderer = vtkRenderer()\n    medianRenderer.AddActor(medianActor)\n\n    renderers = list()\n    renderers.append(originalRenderer)\n    renderers.append(noisyRenderer)\n    renderers.append(hybridRenderer)\n    renderers.append(medianRenderer)\n\n    # Setup viewports for the renderers.\n    rendererSize = 400\n    xGridDimensions = 2\n    yGridDimensions = 2\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(\n        rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(xGridDimensions):\n            index = row * xGridDimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions, float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions, float(yGridDimensions - row) / yGridDimensions]\n            renderers[index].SetViewport(viewport)\n            renderWindow.AddRenderer(renderers[index])\n    renderWindow.SetWindowName('HybridMedianComparison')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # The renderers share one camera.\n    renderWindow.Render()\n    renderers[0].GetActiveCamera().Dolly(1.5)\n    renderers[0].ResetCameraClippingRange()\n    for r in range(1, len(renderers)):\n        renderers[r].SetActiveCamera(renderers[0].GetActiveCamera())\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Comparison of median and hybrid-median filters.'\n    epilogue = '''\n    The hybrid filter preserves corners and thin lines, better than the median filter.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='TestPattern.png.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef AddShotNoise(inputImage, outputImage, noiseAmplitude, noiseFraction, extent):\n    shotNoiseSource = vtkImageNoiseSource()\n    shotNoiseSource.SetWholeExtent(extent)\n    shotNoiseSource.SetMinimum(0.0)\n    shotNoiseSource.SetMaximum(1.0)\n\n    shotNoiseThresh1 = vtkImageThreshold()\n    shotNoiseThresh1.SetInputConnection(shotNoiseSource.GetOutputPort())\n    shotNoiseThresh1.ThresholdByLower(1.0 - noiseFraction)\n    shotNoiseThresh1.SetInValue(0)\n    shotNoiseThresh1.SetOutValue(noiseAmplitude)\n    shotNoiseThresh2 = vtkImageThreshold()\n    shotNoiseThresh2.SetInputConnection(shotNoiseSource.GetOutputPort())\n    shotNoiseThresh2.ThresholdByLower(noiseFraction)\n    shotNoiseThresh2.SetInValue(1.0 - noiseAmplitude)\n    shotNoiseThresh2.SetOutValue(0.0)\n\n    shotNoise = vtkImageMathematics()\n    shotNoise.SetInputConnection(0, shotNoiseThresh1.GetOutputPort())\n    shotNoise.SetInputConnection(1, shotNoiseThresh2.GetOutputPort())\n    shotNoise.SetOperationToAdd()\n\n    add = vtkImageMathematics()\n    add.SetInputData(0, inputImage)\n    add.SetInputConnection(1, shotNoise.GetOutputPort())\n    add.SetOperationToAdd()\n    add.Update()\n    outputImage.DeepCopy(add.GetOutput())\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageProcessing/IdealHighPass/","title":"IdealHighPass","text":"

        vtk-examples/Python/ImageProcessing/IdealHighPass

        "},{"location":"Python/ImageProcessing/IdealHighPass/#description","title":"Description","text":"

        Low-pass and high-pass filtering become trivial in the frequency domain. A portion of the pixels are simply masked or attenuated. This example shows a high pass Butterworth filter that attenuates the frequency domain image with the function out(i, j) = 1 / (1 + pow(CutOff/Freq(i,j), 2*Order)).

        The gradual attenuation of the filter is important. The ideal high-pass filter, shown in the same exaample, simply masks a set of pixels in the frequency domain. The abrupt transition causes a ringing effect in the spatial domain.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageProcessing/IdealHighPass/#code","title":"Code","text":"

        IdealHighPass.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingColor import vtkImageMapToWindowLevelColors\nfrom vtkmodules.vtkImagingCore import vtkImageExtractComponents\nfrom vtkmodules.vtkImagingFourier import (\n    vtkImageButterworthHighPass,\n    vtkImageFFT,\n    vtkImageIdealHighPass,\n    vtkImageRFFT\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    fft = vtkImageFFT()\n    fft.SetInputConnection(reader.GetOutputPort())\n\n    idealHighPass = vtkImageIdealHighPass()\n    idealHighPass.SetInputConnection(fft.GetOutputPort())\n    idealHighPass.SetXCutOff(0.1)\n    idealHighPass.SetYCutOff(0.1)\n\n    idealRfft = vtkImageRFFT()\n    idealRfft.SetInputConnection(idealHighPass.GetOutputPort())\n\n    idealReal = vtkImageExtractComponents()\n    idealReal.SetInputConnection(idealRfft.GetOutputPort())\n    idealReal.SetComponents(0)\n\n    butterworthHighPass = vtkImageButterworthHighPass()\n    butterworthHighPass.SetInputConnection(fft.GetOutputPort())\n    butterworthHighPass.SetXCutOff(0.1)\n    butterworthHighPass.SetYCutOff(0.1)\n\n    butterworthRfft = vtkImageRFFT()\n    butterworthRfft.SetInputConnection(butterworthHighPass.GetOutputPort())\n\n    butterworthReal = vtkImageExtractComponents()\n    butterworthReal.SetInputConnection(butterworthRfft.GetOutputPort())\n    butterworthReal.SetComponents(0)\n\n    # Create the actors.\n    idealColor = vtkImageMapToWindowLevelColors()\n    idealColor.SetWindow(500)\n    idealColor.SetLevel(0)\n    idealColor.SetInputConnection(idealReal.GetOutputPort())\n\n    idealActor = vtkImageActor()\n    idealActor.GetMapper().SetInputConnection(idealColor.GetOutputPort())\n    idealActor.GetProperty().SetInterpolationTypeToNearest()\n\n    butterworthColor = vtkImageMapToWindowLevelColors()\n    butterworthColor.SetWindow(500)\n    butterworthColor.SetLevel(0)\n    butterworthColor.SetInputConnection(butterworthReal.GetOutputPort())\n\n    butterworthActor = vtkImageActor()\n    butterworthActor.GetMapper().SetInputConnection(butterworthColor.GetOutputPort())\n    butterworthActor.GetProperty().SetInterpolationTypeToNearest()\n\n    # Setup the renderers.\n    idealRenderer = vtkRenderer()\n    idealRenderer.SetViewport(0.0, 0.0, 0.5, 1.0)\n    idealRenderer.AddActor(idealActor)\n    idealRenderer.ResetCamera()\n    idealRenderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    butterworthRenderer = vtkRenderer()\n    butterworthRenderer.SetViewport(0.5, 0.0, 1.0, 1.0)\n    butterworthRenderer.AddActor(butterworthActor)\n    butterworthRenderer.SetActiveCamera(idealRenderer.GetActiveCamera())\n    butterworthRenderer.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.SetWindowName('IdealHighPass')\n    renderWindow.AddRenderer(idealRenderer)\n    renderWindow.AddRenderer(butterworthRenderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    idealRenderer.GetActiveCamera().Dolly(1.4)\n    idealRenderer.ResetCameraClippingRange()\n    renderWindowInteractor.Initialize()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This figure shows two high-pass filters in the frequency domain.'\n    epilogue = '''\n    The Butterworth high-pass filter has a gradual attenuation that avoids ringing\n     produced by the ideal high-pass filter with an abrupt transition.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='fullhead15.png.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageProcessing/IsoSubsample/","title":"IsoSubsample","text":"

        vtk-examples/Python/ImageProcessing/IsoSubsample

        "},{"location":"Python/ImageProcessing/IsoSubsample/#description","title":"Description","text":"

        An artifact called aliasing occurs when sub-sampling and is often associated with stair-stepping edges. Sampling theory proves that discrete sampled signals with spacing S, completely describe continuous functions composed of frequencies less than S/2. When a signal is sub-sampled, its capacity to hold high frequency information is reduced. However, the high frequency energy does not disappear. It wraps around the frequency spectrum appearing as a low frequency alias artifact. The solution, which eliminates this artifact, is to low-pass filter before sub-sampling.

        Low-pass smoothing reduces the high frequency range of an image that would cause aliasing. The same aliasing phenomena occurs when acquiring data. If a signal from an analog source contains high frequencies, saving the analog data in a discrete form requires sub-sampling that will introduce alias artifacts. For this reason, it is common practice to acquire data at high resolutions,then smooth and subsample to reduce the image to a manageable size.

        This example demonstrates aliasing that occurs when a high-frequency signal is sub-sampled. High frequencies appear as low frequency artifacts. The left image is an isosurface of a skull after sub-sampling. The right image used a low-pass filter before sub-sampling to reduce aliasing.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageProcessing/IsoSubsample/#code","title":"Code","text":"

        IsoSubsample.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkImageMarchingCubes\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import vtkImageShrink3D\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    # Read the image.\n    reader_factory = vtkImageReader2Factory()\n    reader = reader_factory.CreateImageReader2(file_name)\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    # Smoothed pipeline.\n    smooth = vtkImageGaussianSmooth()\n    smooth.SetDimensionality(3)\n    smooth.SetInputConnection(reader.GetOutputPort())\n    smooth.SetStandardDeviations(1.75, 1.75, 0.0)\n    smooth.SetRadiusFactor(2)\n\n    subsample_smoothed = vtkImageShrink3D()\n    subsample_smoothed.SetInputConnection(smooth.GetOutputPort())\n    subsample_smoothed.SetShrinkFactors(4, 4, 1)\n\n    iso_smoothed = vtkImageMarchingCubes()\n    iso_smoothed.SetInputConnection(smooth.GetOutputPort())\n    iso_smoothed.SetValue(0, 1150)\n\n    iso_smoothed_mapper = vtkPolyDataMapper()\n    iso_smoothed_mapper.SetInputConnection(iso_smoothed.GetOutputPort())\n    iso_smoothed_mapper.ScalarVisibilityOff()\n\n    iso_smoothed_actor = vtkActor()\n    iso_smoothed_actor.SetMapper(iso_smoothed_mapper)\n    iso_smoothed_actor.GetProperty().SetColor(colors.GetColor3d(\"Ivory\"))\n\n    # Unsmoothed pipeline.\n    # Sub sample the data.\n    subsample = vtkImageShrink3D()\n    subsample.SetInputConnection(reader.GetOutputPort())\n    subsample.SetShrinkFactors(4, 4, 1)\n\n    iso = vtkImageMarchingCubes()\n    iso.SetInputConnection(subsample.GetOutputPort())\n    iso.SetValue(0, 1150)\n\n    iso_mapper = vtkPolyDataMapper()\n    iso_mapper.SetInputConnection(iso.GetOutputPort())\n    iso_mapper.ScalarVisibilityOff()\n\n    iso_actor = vtkActor()\n    iso_actor.SetMapper(iso_mapper)\n    iso_actor.GetProperty().SetColor(colors.GetColor3d(\"Ivory\"))\n\n    # The rendering Pipeline.\n\n    # Setup the render window, renderer, and interactor.\n    left_viewport = [0.0, 0.0, 0.5, 1.0]\n    right_viewport = [0.5, 0.0, 1.0, 1.0]\n\n    renderer_left = vtkRenderer()\n    renderer_left.SetViewport(left_viewport)\n\n    renderer_right = vtkRenderer()\n    renderer_right.SetViewport(right_viewport)\n\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer_left)\n    render_window.AddRenderer(renderer_right)\n\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    renderer_left.AddActor(iso_actor)\n    renderer_right.AddActor(iso_smoothed_actor)\n\n    renderer_left.GetActiveCamera().SetFocalPoint(0.0, 0.0, 0.0)\n    renderer_left.GetActiveCamera().SetPosition(0.0, -1.0, 0.0)\n    renderer_left.GetActiveCamera().SetViewUp(0.0, 0.0, -1.0)\n    renderer_left.ResetCamera()\n    renderer_left.GetActiveCamera().Azimuth(-20.0)\n    renderer_left.GetActiveCamera().Elevation(20.0)\n    renderer_left.ResetCameraClippingRange()\n\n    renderer_left.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    renderer_right.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n    renderer_right.SetActiveCamera(renderer_left.GetActiveCamera())\n\n    render_window.SetSize(640, 480)\n    render_window.SetWindowName('IsoSubsample')\n    render_window.Render()\n\n    render_window_interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This figure demonstrates aliasing that occurs when a high-frequency signal is subsampled.'\n    epilogue = '''\n    High frequencies appear as low frequency artifacts.\n    The left image is an isosurface of a skull after subsampling.\n    The right image used a low-pass filter before subsampling to reduce aliasing.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageProcessing/MedianComparison/","title":"MedianComparison","text":"

        vtk-examples/Python/ImageProcessing/MedianComparison

        "},{"location":"Python/ImageProcessing/MedianComparison/#description","title":"Description","text":"

        Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageProcessing/MedianComparison/#code","title":"Code","text":"

        MedianComparison.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageCast,\n    vtkImageThreshold\n)\nfrom vtkmodules.vtkImagingGeneral import (\n    vtkImageGaussianSmooth,\n    vtkImageMedian3D\n)\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkImagingSources import vtkImageNoiseSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    scalarRange = [0] * 2\n    scalarRange[0] = reader.GetOutput().GetPointData().GetScalars().GetRange()[0]\n    scalarRange[1] = reader.GetOutput().GetPointData().GetScalars().GetRange()[1]\n    print(\"Range:\", scalarRange)\n    middleSlice = (reader.GetOutput().GetExtent()[5] - reader.GetOutput().GetExtent()[4]) // 2\n\n    # Work with double images\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToDouble()\n    cast.Update()\n\n    originalData = vtkImageData()\n    originalData.DeepCopy(cast.GetOutput())\n\n    noisyData = vtkImageData()\n\n    AddShotNoise(originalData, noisyData, 2000.0, 0.1, reader.GetOutput().GetExtent())\n    median = vtkImageMedian3D()\n    median.SetInputData(noisyData)\n    median.SetKernelSize(5, 5, 1)\n\n    gaussian = vtkImageGaussianSmooth()\n    gaussian.SetDimensionality(2)\n    gaussian.SetInputData(noisyData)\n    gaussian.SetStandardDeviations(2.0, 2.0)\n    gaussian.SetRadiusFactors(2.0, 2.0)\n\n    colorWindow = (scalarRange[1] - scalarRange[0]) * 0.8\n    colorLevel = colorWindow / 2\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputData(originalData)\n    originalActor.GetProperty().SetColorWindow(colorWindow)\n    originalActor.GetProperty().SetColorLevel(colorLevel)\n    originalActor.GetProperty().SetInterpolationTypeToNearest()\n    originalActor.SetZSlice(middleSlice)\n\n    noisyActor = vtkImageActor()\n    noisyActor.GetMapper().SetInputData(noisyData)\n    noisyActor.GetProperty().SetColorWindow(colorWindow)\n    noisyActor.GetProperty().SetColorLevel(colorLevel)\n    noisyActor.GetProperty().SetInterpolationTypeToNearest()\n    noisyActor.SetZSlice(middleSlice)\n\n    gaussianActor = vtkImageActor()\n    gaussianActor.GetMapper().SetInputConnection(gaussian.GetOutputPort())\n    gaussianActor.GetProperty().SetColorWindow(colorWindow)\n    gaussianActor.GetProperty().SetColorLevel(colorLevel)\n    gaussianActor.GetProperty().SetInterpolationTypeToNearest()\n    gaussianActor.SetZSlice(middleSlice)\n\n    medianActor = vtkImageActor()\n    medianActor.GetMapper().SetInputConnection(median.GetOutputPort())\n    medianActor.GetProperty().SetColorWindow(colorWindow)\n    medianActor.GetProperty().SetColorLevel(colorLevel)\n    medianActor.GetProperty().SetInterpolationTypeToNearest()\n    medianActor.SetZSlice(middleSlice)\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.AddActor(originalActor)\n    noisyRenderer = vtkRenderer()\n    noisyRenderer.AddActor(noisyActor)\n    gaussRenderer = vtkRenderer()\n    gaussRenderer.AddActor(gaussianActor)\n    medianRenderer = vtkRenderer()\n    medianRenderer.AddActor(medianActor)\n\n    renderers = list()\n    renderers.append(originalRenderer)\n    renderers.append(noisyRenderer)\n    renderers.append(gaussRenderer)\n    renderers.append(medianRenderer)\n\n    # Setup viewports for the renderers.\n    rendererSize = 400\n    xGridDimensions = 2\n    yGridDimensions = 2\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(\n        rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(xGridDimensions):\n            index = row * xGridDimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions, float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions, float(yGridDimensions - row) / yGridDimensions]\n            renderers[index].SetViewport(viewport)\n            renderWindow.AddRenderer(renderers[index])\n    renderWindow.SetWindowName('MedianComparison')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # The renderers share one camera.\n    renderWindow.Render()\n    renderers[0].GetActiveCamera().Dolly(1.5)\n    renderers[0].ResetCameraClippingRange()\n    for r in range(1, len(renderers)):\n        renderers[r].SetActiveCamera(renderers[0].GetActiveCamera())\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef AddShotNoise(inputImage, outputImage, noiseAmplitude, noiseFraction, extent):\n    shotNoiseSource = vtkImageNoiseSource()\n    shotNoiseSource.SetWholeExtent(extent)\n    shotNoiseSource.SetMinimum(0.0)\n    shotNoiseSource.SetMaximum(1.0)\n\n    shotNoiseThresh1 = vtkImageThreshold()\n    shotNoiseThresh1.SetInputConnection(shotNoiseSource.GetOutputPort())\n    shotNoiseThresh1.ThresholdByLower(1.0 - noiseFraction)\n    shotNoiseThresh1.SetInValue(0)\n    shotNoiseThresh1.SetOutValue(noiseAmplitude)\n    shotNoiseThresh2 = vtkImageThreshold()\n    shotNoiseThresh2.SetInputConnection(shotNoiseSource.GetOutputPort())\n    shotNoiseThresh2.ThresholdByLower(noiseFraction)\n    shotNoiseThresh2.SetInValue(1.0 - noiseAmplitude)\n    shotNoiseThresh2.SetOutValue(0.0)\n\n    shotNoise = vtkImageMathematics()\n    shotNoise.SetInputConnection(0, shotNoiseThresh1.GetOutputPort())\n    shotNoise.SetInputConnection(1, shotNoiseThresh2.GetOutputPort())\n    shotNoise.SetOperationToAdd()\n\n    add = vtkImageMathematics()\n    add.SetInputData(0, inputImage)\n    add.SetInputConnection(1, shotNoise.GetOutputPort())\n    add.SetOperationToAdd()\n    add.Update()\n    outputImage.DeepCopy(add.GetOutput())\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageProcessing/MorphologyComparison/","title":"MorphologyComparison","text":"

        vtk-examples/Python/ImageProcessing/MorphologyComparison

        "},{"location":"Python/ImageProcessing/MorphologyComparison/#description","title":"Description","text":"

        Although preprocessing can do a lot to improve segmentation results, postprocessing can also be useful. Morphological filters, which operate on binary or discrete images, can be useful for manipulating the shape of the segmented regions. In this brief discussion we will only consider operations that use circular footprints, even though these morphological filters can be defined much more generally.

        Erosion is implemented by removing pixels within a specified distance of a border. For each pixel not in the segmented region, all the neighbors in a circular region around the pixels are turned off. This erosion filter shrinks the segmented region and small isolated regions disappear.

        The opposite of erosion is dilation. This filter grows the area of segmented regions. Small holes in the segmented region are completely closed. Any pixel not in the segmented region but near the region is turned on.

        Dilation and erosion are dual filters with nearly identical implementations. Dilating the \u201con\u201d pixels is equivalent to eroding \u201coff\u201d pixels in a binary image. Holes in the map disappear. However, dilation alone also grows the boundaries of the segmented regions. When dilation is followed by erosion in a closing operation, small holes are removed; however, the boundary of the segmented regions remain in the same general location.

        Opening is the dual of closing. Opening removes small islands of pixels. It is implemented with an initial erosion, followed by a dilation.

        Connectivity filters can also remove small regions without affecting the remaining boundaries of segmented regions. This set of filters separate the segmented pixels into equivalence classes based on a neighbor relation. Two pixels belong to the same class if they are touching. There are two common neighbor relations in two-dimensional images: four connectivity considers pixels neighbors if they are edge neighbors, and eight connectivity considers pixels neighbors if pixels share any vertex.

        This example demonstrates various binary filters that can alter the shape of segmented regions. From left to right, top to bottom: original image, connectivity, erosion, dilation, opening, closing.

        Info

        See this figure in Chapter 10 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageProcessing/MorphologyComparison/#code","title":"Code","text":"

        MorphologyComparison.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingMorphological import (\n    vtkImageDilateErode3D,\n    vtkImageSeedConnectivity\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    # Dilate\n    dilate = vtkImageDilateErode3D()\n    dilate.SetInputConnection(reader.GetOutputPort())\n    dilate.SetDilateValue(0)\n    dilate.SetErodeValue(255)\n    dilate.SetKernelSize(31, 31, 1)\n\n    # Erode\n    erode = vtkImageDilateErode3D()\n    erode.SetInputConnection(reader.GetOutputPort())\n    erode.SetDilateValue(255)\n    erode.SetErodeValue(0)\n    erode.SetKernelSize(31, 31, 1)\n\n    # Opening - dilate then erode.\n    dilate1 = vtkImageDilateErode3D()\n    dilate1.SetInputConnection(reader.GetOutputPort())\n    dilate1.SetDilateValue(0)\n    dilate1.SetErodeValue(255)\n    dilate1.SetKernelSize(31, 31, 1)\n\n    erode1 = vtkImageDilateErode3D()\n    erode1.SetInputConnection(dilate1.GetOutputPort())\n    erode1.SetDilateValue(255)\n    erode1.SetErodeValue(0)\n    erode1.SetKernelSize(31, 31, 1)\n\n    # Closing - erode then dilate.\n    erode2 = vtkImageDilateErode3D()\n    erode2.SetInputConnection(reader.GetOutputPort())\n    erode2.SetDilateValue(255)\n    erode2.SetErodeValue(0)\n    erode2.SetKernelSize(31, 31, 1)\n\n    dilate2 = vtkImageDilateErode3D()\n    dilate2.SetInputConnection(erode2.GetOutputPort())\n    dilate2.SetDilateValue(0)\n    dilate2.SetErodeValue(255)\n    dilate2.SetKernelSize(31, 31, 1)\n\n    # Connectivity\n    con = vtkImageSeedConnectivity()\n    con.SetInputConnection(reader.GetOutputPort())\n    con.AddSeed(300, 200)\n    con.SetInputConnectValue(0)\n    con.SetOutputConnectedValue(0)\n    con.SetOutputUnconnectedValue(255)\n\n    # Actors\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputConnection(reader.GetOutputPort())\n    originalActor.GetProperty().SetInterpolationTypeToNearest()\n\n    connectedActor = vtkImageActor()\n    connectedActor.GetMapper().SetInputConnection(con.GetOutputPort())\n    connectedActor.GetProperty().SetInterpolationTypeToNearest()\n\n    erodeActor = vtkImageActor()\n    erodeActor.GetMapper().SetInputConnection(erode.GetOutputPort())\n    erodeActor.GetProperty().SetInterpolationTypeToNearest()\n\n    dilateActor = vtkImageActor()\n    dilateActor.GetMapper().SetInputConnection(dilate.GetOutputPort())\n    dilateActor.GetProperty().SetInterpolationTypeToNearest()\n\n    openingActor = vtkImageActor()\n    openingActor.GetMapper().SetInputConnection(dilate2.GetOutputPort())\n    openingActor.GetProperty().SetInterpolationTypeToNearest()\n\n    closingActor = vtkImageActor()\n    closingActor.GetMapper().SetInputConnection(erode1.GetOutputPort())\n    closingActor.GetProperty().SetInterpolationTypeToNearest()\n\n    # Setup renderers\n    originalRenderer = vtkRenderer()\n    originalRenderer.AddActor(originalActor)\n    connectedRenderer = vtkRenderer()\n    connectedRenderer.AddActor(connectedActor)\n    dilateRenderer = vtkRenderer()\n    dilateRenderer.AddActor(dilateActor)\n    erodeRenderer = vtkRenderer()\n    erodeRenderer.AddActor(erodeActor)\n    closingRenderer = vtkRenderer()\n    closingRenderer.AddActor(closingActor)\n    openingRenderer = vtkRenderer()\n    openingRenderer.AddActor(openingActor)\n\n    renderers = list()\n    renderers.append(originalRenderer)\n    renderers.append(connectedRenderer)\n    renderers.append(erodeRenderer)\n    renderers.append(dilateRenderer)\n    renderers.append(openingRenderer)\n    renderers.append(closingRenderer)\n\n    # Setup viewports for the renderers\n    rendererSize = 300\n    xGridDimensions = 2\n    yGridDimensions = 3\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(\n        rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(xGridDimensions):\n            index = row * xGridDimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions, float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions, float(yGridDimensions - row) / yGridDimensions]\n            renderers[index].SetViewport(viewport)\n            renderWindow.AddRenderer(renderers[index])\n    renderWindow.SetWindowName('MorphologyComparison')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # The renderers share one camera.\n    renderWindow.Render()\n    renderers[0].GetActiveCamera().Dolly(1.5)\n    renderers[0].ResetCameraClippingRange()\n\n    for r in range(1, len(renderers)):\n        renderers[r].SetActiveCamera(renderers[0].GetActiveCamera())\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrate various binary filters that can alter the shape of segmented regions.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='binary.pgm.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageProcessing/Pad/","title":"Pad","text":"

        vtk-examples/Python/ImageProcessing/Pad

        "},{"location":"Python/ImageProcessing/Pad/#description","title":"Description","text":"

        An important point about the discrete Fourier transform is that it treats the image as a periodic function. This means the pixels on the right border are adjacent to pixels on the left border. Since there is usually no physical relationship between these pixels, the artificial horizontal and vertical edges can distort the frequency spectrum and subsequent processing. To reduce these artifacts, the original image can be multiplied by a window function that becomes zero at the borders.

        Another approach removes these artificial edges by smoothing only along the borders.

        In both of these approaches, a portion of the original image is lost, so only the central portion of an image can be processed. If this is unacceptable, another solution is to double the dimensions of the original image with a mirror-padding filter. The intermediate image is periodic and continuous.

        The lower-left image has been padded with a constant (800). On the right, mirror padding has been used to remove artificial edges introduced by borders.

        Info

        See Figure 10-12 in Chapter 10 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageProcessing/Pad/#code","title":"Code","text":"

        Pad.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingColor import vtkImageMapToWindowLevelColors\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageConstantPad,\n    vtkImageMirrorPad\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    # Pipelines\n    constantPad = vtkImageConstantPad()\n    constantPad.SetInputConnection(reader.GetOutputPort())\n    constantPad.SetConstant(800)\n    constantPad.SetOutputWholeExtent(-127, 383, -127, 383, 22, 22)\n\n    mirrorPad = vtkImageMirrorPad()\n    mirrorPad.SetInputConnection(reader.GetOutputPort())\n    mirrorPad.SetOutputWholeExtent(constantPad.GetOutputWholeExtent())\n\n    # Create actors\n    constantPadColor = vtkImageMapToWindowLevelColors()\n    constantPadColor.SetWindow(2000)\n    constantPadColor.SetLevel(1000)\n    constantPadColor.SetInputConnection(constantPad.GetOutputPort())\n\n    constantPadActor = vtkImageActor()\n    constantPadActor.GetMapper().SetInputConnection(\n        constantPadColor.GetOutputPort())\n    constantPadActor.GetProperty().SetInterpolationTypeToNearest()\n\n    mirrorPadColor = vtkImageMapToWindowLevelColors()\n    mirrorPadColor.SetWindow(2000)\n    mirrorPadColor.SetLevel(1000)\n    mirrorPadColor.SetInputConnection(mirrorPad.GetOutputPort())\n\n    mirrorPadActor = vtkImageActor()\n    mirrorPadActor.GetMapper().SetInputConnection(\n        mirrorPadColor.GetOutputPort())\n    mirrorPadActor.GetProperty().SetInterpolationTypeToNearest()\n\n    # Setup the renderers.\n    constantPadRenderer = vtkRenderer()\n    constantPadRenderer.SetViewport(0.0, 0.0, 0.5, 1.0)\n    constantPadRenderer.AddActor(constantPadActor)\n    constantPadRenderer.ResetCamera()\n    constantPadRenderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    mirrorPadRenderer = vtkRenderer()\n    mirrorPadRenderer.SetViewport(0.5, 0.0, 1.0, 1.0)\n    mirrorPadRenderer.AddActor(mirrorPadActor)\n    mirrorPadRenderer.SetActiveCamera(constantPadRenderer.GetActiveCamera())\n    mirrorPadRenderer.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.SetWindowName('Pad')\n    renderWindow.AddRenderer(constantPadRenderer)\n    renderWindow.AddRenderer(mirrorPadRenderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    constantPadRenderer.GetActiveCamera().Dolly(1.2)\n    constantPadRenderer.ResetCameraClippingRange()\n    renderWindowInteractor.Initialize()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Convolution in frequency space treats the image as a periodic function.'\n    epilogue = '''\n     A large kernel can pick up features from both sides of the image.\n     The lower-left image has been padded with zeros to eliminate wraparound during convolution.\n     On the right, mirror padding has been used to remove artificial edges introduced by borders.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImageProcessing/VTKSpectrum/","title":"VTKSpectrum","text":"

        vtk-examples/Python/ImageProcessing/VTKSpectrum

        "},{"location":"Python/ImageProcessing/VTKSpectrum/#description","title":"Description","text":"

        The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This example shows an image and its power spectrum displayed using a logarithmic transfer function.

        Info

        See Figure 10-10 in Chapter 10 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImageProcessing/VTKSpectrum/#code","title":"Code","text":"

        VTKSpectrum.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkImagingCore import vtkImageMapToColors\nfrom vtkmodules.vtkImagingFourier import (\n    vtkImageFFT,\n    vtkImageFourierCenter\n)\nfrom vtkmodules.vtkImagingMath import (\n    vtkImageLogarithmicScale,\n    vtkImageMagnitude\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkWindowLevelLookupTable\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Read the image.\n    readerFactory = vtkImageReader2Factory()\n    reader = readerFactory.CreateImageReader2(fileName)\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    fft = vtkImageFFT()\n    fft.SetInputConnection(reader.GetOutputPort())\n\n    mag = vtkImageMagnitude()\n    mag.SetInputConnection(fft.GetOutputPort())\n\n    center = vtkImageFourierCenter()\n    center.SetInputConnection(mag.GetOutputPort())\n\n    compress = vtkImageLogarithmicScale()\n    compress.SetInputConnection(center.GetOutputPort())\n    compress.SetConstant(15)\n    compress.Update()\n\n    # Create the actors.\n    originalActor = vtkImageActor()\n    originalActor.GetMapper().SetInputConnection(reader.GetOutputPort())\n    originalActor.GetProperty().SetInterpolationTypeToNearest()\n\n    compressedActor = vtkImageActor()\n    compressedActor.GetMapper().SetInputConnection(compress.GetOutputPort())\n    compressedActor.GetProperty().SetInterpolationTypeToNearest()\n    CreateImageActor(compressedActor, 160, 120)\n\n    # Define the viewport ranges.\n    # (xmin, ymin, xmax, ymax)\n    originalViewport = [0.0, 0.0, 0.5, 1.0]\n    compressedViewport = [0.5, 0.0, 1.0, 1.0]\n\n    # Setup the renderers.\n    originalRenderer = vtkRenderer()\n    originalRenderer.SetViewport(originalViewport)\n    originalRenderer.AddActor(originalActor)\n    originalRenderer.ResetCamera()\n    originalRenderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    compressedRenderer = vtkRenderer()\n    compressedRenderer.SetViewport(compressedViewport)\n    compressedRenderer.AddActor(compressedActor)\n    compressedRenderer.ResetCamera()\n    compressedRenderer.SetBackground(colors.GetColor3d(\"LightSlateGray\"))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.SetWindowName('VTKSpectrum')\n    renderWindow.AddRenderer(originalRenderer)\n    renderWindow.AddRenderer(compressedRenderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindowInteractor.Initialize()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The discrete Fourier transform.'\n    epilogue = '''\n    This changes an image from the spatial domain into the frequency domain,\n     where each pixel represents a sinusoidal function.\n    This figure shows an image and its power spectrum displayed using a logarithmic transfer function.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='vtks.pgm.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef CreateImageActor(actor, colorWindow, colorLevel):\n    wlut = vtkWindowLevelLookupTable()\n    wlut.SetWindow(colorWindow)\n    wlut.SetLevel(colorLevel)\n    wlut.Build()\n\n    # Map the image through the lookup table.\n    color = vtkImageMapToColors()\n    color.SetLookupTable(wlut)\n    color.SetInputData(actor.GetMapper().GetInput())\n\n    actor.GetMapper().SetInputConnection(color.GetOutputPort())\n    return\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Images/Actor2D/","title":"Actor2D","text":"

        vtk-examples/Python/Images/Actor2D

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Images/Actor2D/#code","title":"Code","text":"

        Actor2D.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersGeneral import vtkVertexGlyphFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor2D,\n    vtkPolyDataMapper2D,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    points = vtkPoints()\n    points.InsertNextPoint(10, 10, 0)\n    points.InsertNextPoint(100, 100, 0)\n    points.InsertNextPoint(200, 200, 0)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    glyphFilter = vtkVertexGlyphFilter()\n    glyphFilter.SetInputData(polydata)\n    glyphFilter.Update()\n\n    mapper = vtkPolyDataMapper2D()\n    mapper.SetInputConnection(glyphFilter.GetOutputPort())\n    mapper.Update()\n\n    actor = vtkActor2D()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n    actor.GetProperty().SetPointSize(8)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderWindow.SetSize(300, 300)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    renderWindow.SetWindowName('Actor2D')\n\n    # Render and interact\n    renderWindow.Render()\n    # w2if = vtkWindowToImageFilter()\n    # w2if.SetInput(renderWindow)\n    # w2if.Update()\n    #\n    # writer = vtkPNGWriter()\n    # writer.SetFileName('TestActor2D.png')\n    # writer.SetInputConnection(w2if.GetOutputPort())\n    # writer.Write()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Images/BackgroundImage/","title":"BackgroundImage","text":"

        vtk-examples/Python/Images/BackgroundImage

        "},{"location":"Python/Images/BackgroundImage/#description","title":"Description","text":"

        This example displays an image as the \"background\" of a scene, and renders a superquadric in front of it.

        The example accepts a jpeg file on the command line to use as a background image. If there is no file, it generates a simple background.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Images/BackgroundImage/#code","title":"Code","text":"

        BackgroundImage.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSuperquadricSource\nfrom vtkmodules.vtkIOImage import vtkJPEGReader\nfrom vtkmodules.vtkImagingSources import vtkImageCanvasSource2D\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkImageActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Add a background image at a render window.'\n    epilogue = '''\n        Add a background image to a render window.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', default=None, type=str, nargs='?', help='A required filename.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    #  Verify input arguments\n    fn = get_program_parameters()\n    if fn:\n        # Read the image\n        jpeg_reader = vtkJPEGReader()\n        if not jpeg_reader.CanReadFile(fn):\n            print('Error reading file:', fn)\n            return\n\n        jpeg_reader.SetFileName(fn)\n        jpeg_reader.Update()\n        image_data = jpeg_reader.GetOutput()\n    else:\n        canvas_source = vtkImageCanvasSource2D()\n        canvas_source.SetExtent(0, 100, 0, 100, 0, 0)\n        canvas_source.SetScalarTypeToUnsignedChar()\n        canvas_source.SetNumberOfScalarComponents(3)\n        canvas_source.SetDrawColor(colors.GetColor4ub('warm_grey'))\n        canvas_source.FillBox(0, 100, 0, 100)\n        canvas_source.SetDrawColor(colors.GetColor4ub('DarkCyan'))\n        canvas_source.FillTriangle(10, 10, 25, 10, 25, 25)\n        canvas_source.SetDrawColor(colors.GetColor4ub('LightCoral'))\n        canvas_source.FillTube(75, 75, 0, 75, 5.0)\n        canvas_source.Update()\n        image_data = canvas_source.GetOutput()\n\n    # Create an image actor to display the image\n    image_actor = vtkImageActor()\n    image_actor.SetInputData(image_data)\n\n    # Create a renderer to display the image in the background\n    background_renderer = vtkRenderer()\n\n    # Create a superquadric\n    superquadric_source = vtkSuperquadricSource()\n    superquadric_source.SetPhiRoundness(1.1)\n    superquadric_source.SetThetaRoundness(.2)\n\n    # Create a mapper and actor\n    superquadric_mapper = vtkPolyDataMapper()\n    superquadric_mapper.SetInputConnection(superquadric_source.GetOutputPort())\n\n    superquadric_actor = vtkActor()\n    superquadric_actor.SetMapper(superquadric_mapper)\n    superquadric_actor.GetProperty().SetColor(colors.GetColor3d('NavajoWhite'))\n\n    scene_renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n\n    # Set up the render window and renderers such that there is\n    # a background layer and a foreground layer\n    background_renderer.SetLayer(0)\n    background_renderer.InteractiveOff()\n    scene_renderer.SetLayer(1)\n    render_window.SetNumberOfLayers(2)\n    render_window.AddRenderer(background_renderer)\n    render_window.AddRenderer(scene_renderer)\n    render_window.SetWindowName('BackgroundImage')\n\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    # Add actors to the renderers\n    scene_renderer.AddActor(superquadric_actor)\n    background_renderer.AddActor(image_actor)\n\n    # Render once to figure out where the background camera will be\n    render_window.Render()\n\n    # Set up the background camera to fill the renderer with the image\n    origin = image_data.GetOrigin()\n    spacing = image_data.GetSpacing()\n    extent = image_data.GetExtent()\n\n    camera = background_renderer.GetActiveCamera()\n    camera.ParallelProjectionOn()\n\n    xc = origin[0] + 0.5 * (extent[0] + extent[1]) * spacing[0]\n    yc = origin[1] + 0.5 * (extent[2] + extent[3]) * spacing[1]\n    # xd = (extent[1] - extent[0] + 1) * spacing[0]\n    yd = (extent[3] - extent[2] + 1) * spacing[1]\n    d = camera.GetDistance()\n    camera.SetParallelScale(0.5 * yd)\n    camera.SetFocalPoint(xc, yc, 0.0)\n    camera.SetPosition(xc, yc, d)\n\n    # Render again to set the correct view\n    render_window.Render()\n\n    # Interact with the window\n    render_window_interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Images/Cast/","title":"Cast","text":"

        vtk-examples/Python/Images/Cast

        "},{"location":"Python/Images/Cast/#description","title":"Description","text":"

        Cast an image to a different type.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Images/Cast/#code","title":"Code","text":"

        Cast.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkImagingCore import vtkImageCast\nfrom vtkmodules.vtkImagingSources import vtkImageMandelbrotSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleImage\nfrom vtkmodules.vtkRenderingCore import (\n    vtkImageActor,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a float image\n    source = vtkImageMandelbrotSource()\n    source.Update()\n\n    print(source.GetOutput().GetScalarTypeAsString())\n\n    castFilter = vtkImageCast()\n    castFilter.SetInputConnection(source.GetOutputPort())\n    castFilter.SetOutputScalarTypeToUnsignedChar()\n    castFilter.Update()\n\n    # Create an actor\n    actor = vtkImageActor()\n    actor.GetMapper().SetInputConnection(castFilter.GetOutputPort())\n\n    # Setup renderer\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renderer.ResetCamera()\n\n    # Setup render window\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('Cast')\n\n    # Setup render window interactor\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleImage()\n    renderWindowInteractor.SetInteractorStyle(style)\n\n    # Render and start interaction\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindow.Render()\n    renderWindowInteractor.Initialize()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Images/ImageWarp/","title":"ImageWarp","text":"

        vtk-examples/Python/Images/ImageWarp

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Images/ImageWarp/#code","title":"Code","text":"

        ImageWarp.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkMergeFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpScalar\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkIOImage import vtkBMPReader\nfrom vtkmodules.vtkImagingColor import vtkImageLuminance\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [60, 93, 144, 255])\n\n    # Read in an image and compute a luminance value. The image is extracted\n    # as a set of polygons (vtkImageDataGeometryFilter). We then will\n    # warp the plane using the scalar (luminance) values.\n    #\n    reader = vtkBMPReader()\n    reader.SetFileName(fileName)\n    # Convert the image to a grey scale.\n    luminance = vtkImageLuminance()\n    luminance.SetInputConnection(reader.GetOutputPort())\n    # Pass the data to the pipeline as polygons.\n    geometry = vtkImageDataGeometryFilter()\n    geometry.SetInputConnection(luminance.GetOutputPort())\n    # Warp the data in a direction perpendicular to the image plane.\n    warp = vtkWarpScalar()\n    warp.SetInputConnection(geometry.GetOutputPort())\n    warp.SetScaleFactor(-0.1)\n\n    # Use vtkMergeFilter to combine the original image with the warped geometry.\n    merge = vtkMergeFilter()\n    merge.SetGeometryConnection(warp.GetOutputPort())\n    merge.SetScalarsConnection(reader.GetOutputPort())\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(merge.GetOutputPort())\n    mapper.SetScalarRange(0, 255)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create the rendering window, renderer, and interactive renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(actor)\n    ren.ResetCamera()\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n    # ren.GetActiveCamera().Azimuth(20)\n    # ren.GetActiveCamera().Elevation(30)\n    # ren.ResetCameraClippingRange()\n    # ren.GetActiveCamera().Zoom(1.3)\n    ren.GetActiveCamera().SetPosition(-100, -130, 325)\n    ren.GetActiveCamera().SetFocalPoint(105, 114, -29)\n    ren.GetActiveCamera().SetViewUp(0.51, 0.54, 0.67)\n    ren.ResetCameraClippingRange()\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('ImageWarp')\n\n    # Render the image.\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'ImageWarp.'\n    epilogue = '''\nThis example shows how to combine data from both the imaging\n and graphics pipelines. The vtkMergeData filter is used to\n merge the data from each together.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filePrefix', help='Path to the masonry.bmp file.')\n    args = parser.parse_args()\n    return args.filePrefix\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImplicitFunctions/BooleanOperationImplicitFunctions/","title":"BooleanOperationImplicitFunctions","text":"

        vtk-examples/Python/ImplicitFunctions/BooleanOperationImplicitFunctions

        "},{"location":"Python/ImplicitFunctions/BooleanOperationImplicitFunctions/#description","title":"Description","text":"

        Demonstration on how to perform boolean operations with implicit functions.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImplicitFunctions/BooleanOperationImplicitFunctions/#code","title":"Code","text":"

        BooleanOperationImplicitFunctions.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkBox,\n    vtkImplicitBoolean,\n    vtkSphere\n)\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a sphere\n    sphere = vtkSphere()\n    sphere.SetRadius(1)\n    sphere.SetCenter(1, 0, 0)\n\n    # create a box\n    box = vtkBox()\n    box.SetBounds(-1, 1, -1, 1, -1, 1)\n\n    # combine the two implicit functions\n    boolean = vtkImplicitBoolean()\n    boolean.SetOperationTypeToDifference()\n    # boolean.SetOperationTypeToUnion()\n    # boolean.SetOperationTypeToIntersection()\n    boolean.AddFunction(box)\n    boolean.AddFunction(sphere)\n\n    # The sample function generates a distance function from the implicit\n    # function. This is then contoured to get a polygonal surface.\n    sample = vtkSampleFunction()\n    sample.SetImplicitFunction(boolean)\n    sample.SetModelBounds(-1, 2, -1, 1, -1, 1)\n    sample.SetSampleDimensions(40, 40, 40)\n    sample.ComputeNormalsOff()\n\n    # contour\n    surface = vtkContourFilter()\n    surface.SetInputConnection(sample.GetOutputPort())\n    surface.SetValue(0, 0.0)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d('AliceBlue'))\n    actor.GetProperty().SetEdgeColor(colors.GetColor3d('SteelBlue'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # add the actor\n    renderer.AddActor(actor)\n\n    # render window\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('BooleanOperationImplicitFunctions')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    # renderer.GetActiveCamera().AddObserver('ModifiedEvent', CameraModifiedCallback)\n    renderer.GetActiveCamera().SetPosition(5.0, -4.0, 1.6)\n    renderer.GetActiveCamera().SetViewUp(0.1, 0.5, 0.9)\n    renderer.GetActiveCamera().SetDistance(6.7)\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImplicitFunctions/ImplicitQuadric/","title":"ImplicitQuadric","text":"

        vtk-examples/Python/ImplicitFunctions/ImplicitQuadric

        "},{"location":"Python/ImplicitFunctions/ImplicitQuadric/#description","title":"Description","text":"

        Create an ellipsoid by using the implicit quadric.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImplicitFunctions/ImplicitQuadric/#code","title":"Code","text":"

        ImplicitQuadric.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create an ellipsoid using a implicit quadric\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0)\n\n    # The sample function generates a distance function from the implicit\n    # function. This is then contoured to get a polygonal surface.\n    sample = vtkSampleFunction()\n    sample.SetImplicitFunction(quadric)\n    sample.SetModelBounds(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5)\n    sample.SetSampleDimensions(40, 40, 40)\n    sample.ComputeNormalsOff()\n\n    # contour\n    surface = vtkContourFilter()\n    surface.SetInputConnection(sample.GetOutputPort())\n    surface.SetValue(0, 0.0)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d('AliceBlue'))\n    actor.GetProperty().SetEdgeColor(colors.GetColor3d('SteelBlue'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # add the actor\n    renderer.AddActor(actor)\n\n    # render window\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('ImplicitQuadric')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImplicitFunctions/ImplicitSphere/","title":"ImplicitSphere","text":"

        vtk-examples/Python/ImplicitFunctions/ImplicitSphere

        "},{"location":"Python/ImplicitFunctions/ImplicitSphere/#description","title":"Description","text":"

        This example creates an isosurface of sampled sphere.

        Info

        See Figure 6-23b in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImplicitFunctions/ImplicitSphere/#code","title":"Code","text":"

        ImplicitSphere.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkSphere\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor(\"BkgColor\", [51, 77, 102, 255])\n\n    sphere = vtkSphere()\n\n    # Sample the function\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(50, 50, 50)\n    sample.SetImplicitFunction(sphere)\n    value = 2.0\n    xmin = -value\n    xmax = value\n    ymin = -value\n    ymax = value\n    zmin = -value\n    zmax = value\n    sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax)\n\n    # Create the 0 isosurface\n    contours = vtkContourFilter()\n    contours.SetInputConnection(sample.GetOutputPort())\n    contours.GenerateValues(1, 1, 1)\n\n    # Map the contours to graphical primitives\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contours.GetOutputPort())\n    contourMapper.ScalarVisibilityOff()\n\n    # Create an actor for the contours\n    contourActor = vtkActor()\n    contourActor.SetMapper(contourMapper)\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('ImplicitSphere')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(contourActor)\n    renderer.SetBackground(colors.GetColor3d(\"BkgColor\"))\n\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImplicitFunctions/ImplicitSphere1/","title":"ImplicitSphere1","text":"

        vtk-examples/Python/ImplicitFunctions/ImplicitSphere1

        "},{"location":"Python/ImplicitFunctions/ImplicitSphere1/#description","title":"Description","text":"

        Shows how to create a surface representing a sphere by creating an implicit sphere, sampling the implicit function, and finally contouring the sampled data to produce the surface.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImplicitFunctions/ImplicitSphere1/#code","title":"Code","text":"

        ImplicitSphere1.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkSphere\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphere = vtkSphere()\n    sphere.SetCenter(0, 0, 0)\n    sphere.SetRadius(0.5)\n\n    # The sample function generates a distance function from the implicit\n    # function. This is then contoured to get a polygonal surface.\n    sample = vtkSampleFunction()\n    sample.SetImplicitFunction(sphere)\n    sample.SetModelBounds(-.5, .5, -.5, .5, -.5, .5)\n    sample.SetSampleDimensions(20, 20, 20)\n    sample.ComputeNormalsOff()\n\n    # contour\n    surface = vtkContourFilter()\n    surface.SetInputConnection(sample.GetOutputPort())\n    surface.SetValue(0, 0.0)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n    actor.GetProperty().SetColor(colors.GetColor3d('AliceBlue'))\n    actor.GetProperty().SetEdgeColor(colors.GetColor3d('SteelBlue'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # add the actor\n    renderer.AddActor(actor)\n\n    # render window\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('ImplicitSphere1')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/ImplicitFunctions/SampleFunction/","title":"SampleFunction","text":"

        vtk-examples/Python/ImplicitFunctions/SampleFunction

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/ImplicitFunctions/SampleFunction/#code","title":"Code","text":"

        SampleFunction.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkSuperquadric\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    value = 2.0\n    colors = vtkNamedColors()\n\n    implicitFunction = vtkSuperquadric()\n    implicitFunction.SetPhiRoundness(2.5)\n    implicitFunction.SetThetaRoundness(.5)\n\n    # Sample the function.\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(50, 50, 50)\n    sample.SetImplicitFunction(implicitFunction)\n\n    xmin, xmax, ymin, ymax, zmin, zmax = -value, value, -value, value, -value, value\n    sample.SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax)\n\n    # Create the 0 isosurface.\n    contours = vtkContourFilter()\n    contours.SetInputConnection(sample.GetOutputPort())\n    contours.GenerateValues(1, 2.0, 2.0)\n\n    # Map the contours to graphical primitives.\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contours.GetOutputPort())\n    contourMapper.SetScalarRange(0.0, 1.2)\n\n    # Create an actor for the contours.\n    contourActor = vtkActor()\n    contourActor.SetMapper(contourMapper)\n\n    # Create a box around the function to indicate the sampling volume. \n\n    # Create outline.\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(sample.GetOutputPort())\n\n    # Map it to graphics primitives.\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    # Create an actor.\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d(\"Black\"))\n\n    # Visualize.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('ImplicitSphere1')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(contourActor)\n    renderer.AddActor(outlineActor)\n    renderer.SetBackground(colors.GetColor3d(\"Tan\"))\n\n    # Enable user interface interactor\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/InfoVis/ParallelCoordinatesExtraction/","title":"ParallelCoordinatesExtraction","text":"

        vtk-examples/Python/InfoVis/ParallelCoordinatesExtraction

        "},{"location":"Python/InfoVis/ParallelCoordinatesExtraction/#description","title":"Description","text":"

        Using Parallel Coordinates View to plot and compare data set attributes, and then using selections in the parallel coordinates view to extract and view data points associated with those selections.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/InfoVis/ParallelCoordinatesExtraction/#code","title":"Code","text":"

        ParallelCoordinatesExtraction.py

        #!/usr/bin/env python\n\n# Example of how to use Parallel Coordinates View to plot and compare\n# data set attributes, and then to use selections in the parallel coordinates\n# view to extract and view data points associated with those selections\n# Use the 'u' character to toggle between 'inspect modes' on the parallel\n# coordinates view (i.e. between selecting data and manipulating axes)\n# Note that no points will show up inside of the 3d box outline until you\n# select some lines/curves in the parallel coordinates view\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractSelection\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkAnnotationLink,\n    vtkBrownianPoints\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingCore import vtkRTAnalyticSource\nfrom vtkmodules.vtkImagingGeneral import vtkImageGradient\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkViewsInfovis import (\n    vtkParallelCoordinatesRepresentation,\n    vtkParallelCoordinatesView\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Generate an image data set with multiple attribute arrays to probe and view\n    rt = vtkRTAnalyticSource()\n    rt.SetWholeExtent(-3, 3, -3, 3, -3, 3)\n    grad = vtkImageGradient()\n    grad.SetDimensionality(3)\n    grad.SetInputConnection(rt.GetOutputPort())\n    brown = vtkBrownianPoints()\n    brown.SetMinimumSpeed(0.5)\n    brown.SetMaximumSpeed(1.0)\n    brown.SetInputConnection(grad.GetOutputPort())\n    elev = vtkElevationFilter()\n    elev.SetLowPoint(-3, -3, -3)\n    elev.SetHighPoint(3, 3, 3)\n    elev.SetInputConnection(brown.GetOutputPort())\n\n    # Updating here because I will need to probe scalar ranges before\n    # the render window updates the pipeline\n    elev.Update()\n\n    # Set up parallel coordinates representation to be used in View\n    rep = vtkParallelCoordinatesRepresentation()\n    rep.SetInputConnection(elev.GetOutputPort())\n    rep.SetInputArrayToProcess(0, 0, 0, 0, 'RTDataGradient')\n    rep.SetInputArrayToProcess(1, 0, 0, 0, 'RTData')\n    rep.SetInputArrayToProcess(2, 0, 0, 0, 'Elevation')\n    rep.SetInputArrayToProcess(3, 0, 0, 0, 'BrownianVectors')\n    rep.SetUseCurves(0)  # set to 1 to use smooth curves\n    rep.SetLineOpacity(0.5)\n    rep.SetAxisColor(colors.GetColor3d('Gold'))\n    rep.SetLineColor(colors.GetColor3d('MistyRose'))\n\n    # Set up the Parallel Coordinates View and hook in representation\n    view = vtkParallelCoordinatesView()\n    view.SetRepresentation(rep)\n    view.SetInspectMode(view.VTK_INSPECT_SELECT_DATA)\n    view.SetBrushOperatorToReplace()\n    view.SetBrushModeToLasso()\n\n    # Create a annotation link to access selection in parallel coordinates view\n    annotationLink = vtkAnnotationLink()\n    # If you don't set the FieldType explicitly it ends up as UNKNOWN\n    # (as of 21 Feb 2010)\n    # See vtkSelectionNode doc for field and content type enum values\n    annotationLink.GetCurrentSelection().GetNode(0).SetFieldType(1)  # Point\n    annotationLink.GetCurrentSelection().GetNode(0).SetContentType(4)  # Indices\n    # Update before passing annotationLink to vtkExtractSelection\n    annotationLink.Update()\n    # Connect the annotation link to the parallel coordinates representation\n    rep.SetAnnotationLink(annotationLink)\n\n    # Extract portion of data corresponding to parallel coordinates selection\n    extract = vtkExtractSelection()\n    extract.SetInputConnection(0, elev.GetOutputPort())\n    extract.SetInputConnection(1, annotationLink.GetOutputPort(2))\n\n    def update_render_windows(obj, event):\n        '''\n        Handle updating of RenderWindow since it's not a 'View'\n        and so not covered by vtkViewUpdater\n\n        :param obj:\n        :param event:\n        :return:\n        '''\n        # ren.ResetCamera()\n        renWin.Render()\n\n    # Set up callback to update 3d render window when selections are changed in\n    # parallel coordinates view\n    annotationLink.AddObserver('AnnotationChangedEvent', update_render_windows)\n\n    def toggle_inspectors(obj, event):\n\n        if view.GetInspectMode() == 0:\n            view.SetInspectMode(1)\n        else:\n            view.SetInspectMode(0)\n\n    # Set up callback to toggle between inspect modes (manip axes & select data)\n    view.GetInteractor().AddObserver('UserEvent', toggle_inspectors)\n\n    # 3D outline of image data bounds\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(elev.GetOutputPort())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Build the lookup table for the 3d data scalar colors (brown to white)\n    lut = vtkLookupTable()\n    lut.SetTableRange(0, 256)\n    lut.SetHueRange(0.1, 0.1)\n    lut.SetSaturationRange(1.0, 0.1)\n    lut.SetValueRange(0.4, 1.0)\n    lut.Build()\n\n    # Set up the 3d rendering parameters\n    # of the image data which is selected in parallel coordinates\n    coloring_by = 'Elevation'\n    dataMapper = vtkDataSetMapper()\n    dataMapper.SetInputConnection(extract.GetOutputPort())\n    dataMapper.SetScalarModeToUsePointFieldData()\n    dataMapper.SetColorModeToMapScalars()\n    data = elev.GetOutputDataObject(0).GetPointData()\n    dataMapper.ScalarVisibilityOn()\n    dataMapper.SetScalarRange(data.GetArray(coloring_by).GetRange())\n    dataMapper.SetLookupTable(lut)\n    dataMapper.SelectColorArray(coloring_by)\n    dataActor = vtkActor()\n    dataActor.SetMapper(dataMapper)\n    dataActor.GetProperty().SetRepresentationToPoints()\n    dataActor.GetProperty().SetPointSize(10)\n\n    # Set up the 3d render window and add both actors\n    ren = vtkRenderer()\n    ren.AddActor(outlineActor)\n    ren.AddActor(dataActor)\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('ParallelCoordinatesExtraction')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    ren.ResetCamera()\n    renWin.Render()\n\n    # Finalize parallel coordinates view and start interaction event loop\n    view.GetRenderWindow().SetSize(600, 300)\n    view.GetRenderWindow().SetWindowName('ParallelCoordinatesExtraction')\n    view.GetRenderer().GradientBackgroundOn()\n    view.GetRenderer().SetBackground2(colors.GetColor3d('DarkBlue'))\n    view.GetRenderer().SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    view.ResetCamera()\n    view.Render()\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/InfoVis/ParallelCoordinatesView/","title":"ParallelCoordinatesView","text":"

        vtk-examples/Python/InfoVis/ParallelCoordinatesView

        "},{"location":"Python/InfoVis/ParallelCoordinatesView/#description","title":"Description","text":"

        Using Parallel Coordinates View to plot and compare data set attributes.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/InfoVis/ParallelCoordinatesView/#code","title":"Code","text":"

        ParallelCoordinatesView.py

        #!/usr/bin/env python\n\n# Example of how to use Parallel Coordinates View to plot and compare\n# data set attributes.\n# Use the 'u' character to toggle between 'inspect modes' on the parallel\n# coordinates view (i.e. between selecting data and manipulating axes).\n# Lines which are commented out show alternative options.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkBrownianPoints\nfrom vtkmodules.vtkImagingCore import vtkRTAnalyticSource\nfrom vtkmodules.vtkImagingGeneral import vtkImageGradient\nfrom vtkmodules.vtkViewsInfovis import (\n    vtkParallelCoordinatesRepresentation,\n    vtkParallelCoordinatesView\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Generate an example image data set with multiple attribute arrays to probe\n    # and view.\n    # This is where you would put your reader instead of this rt->elev pipeline...\n    rt = vtkRTAnalyticSource()\n    rt.SetWholeExtent(-3, 3, -3, 3, -3, 3)\n    grad = vtkImageGradient()\n    grad.SetDimensionality(3)\n    grad.SetInputConnection(rt.GetOutputPort())\n    brown = vtkBrownianPoints()\n    brown.SetMinimumSpeed(0.5)\n    brown.SetMaximumSpeed(1.0)\n    brown.SetInputConnection(grad.GetOutputPort())\n    elev = vtkElevationFilter()\n    elev.SetLowPoint(-3, -3, -3)\n    elev.SetHighPoint(3, 3, 3)\n    elev.SetInputConnection(brown.GetOutputPort())\n\n    # Set up the parallel coordinates Representation to be used in the View\n    rep = vtkParallelCoordinatesRepresentation()\n\n    # Plug your reader in here for your own data\n    rep.SetInputConnection(elev.GetOutputPort())\n\n    # List all of the attribute arrays you want plotted in parallel coordinates\n    rep.SetInputArrayToProcess(0, 0, 0, 0, 'RTDataGradient')\n    rep.SetInputArrayToProcess(1, 0, 0, 0, 'RTData')\n    rep.SetInputArrayToProcess(2, 0, 0, 0, 'Elevation')\n    rep.SetInputArrayToProcess(3, 0, 0, 0, 'BrownianVectors')\n\n    rep.SetUseCurves(0)  # set to 1 to use smooth curves\n    rep.SetLineOpacity(0.5)\n    rep.SetAxisColor(colors.GetColor3d('Gold'))\n    rep.SetLineColor(colors.GetColor3d('MistyRose'))\n\n    # Set up the Parallel Coordinates View and hook in the Representation\n    view = vtkParallelCoordinatesView()\n    view.SetRepresentation(rep)\n\n    # Inspect Mode determines whether your interactions manipulate the axes or\n    # select data\n    # view.SetInspectMode(view.VTK_INSPECT_MANIPULATE_AXES)    # VTK_INSPECT_MANIPULATE_AXES = 0,\n    view.SetInspectMode(view.VTK_INSPECT_SELECT_DATA)  # VTK_INSPECT_SELECT_DATA = 1\n\n    # Brush Mode determines the type of interaction you perform to select data\n    view.SetBrushModeToLasso()\n    # view.SetBrushModeToAngle()\n    # view.SetBrushModeToFunction()\n    # view.SetBrushModeToAxisThreshold()  # not implemented yet (as of 21 Feb 2010)\n\n    # Brush Operator determines how each new selection interaction changes\n    # selected lines\n    # view.SetBrushOperatorToAdd()\n    # view.SetBrushOperatorToSubtract()\n    # view.SetBrushOperatorToIntersect()\n    view.SetBrushOperatorToReplace()\n\n    def ToggleInspectors(obj, event):\n        # Define the callback routine which toggles between 'Inspect Modes'\n        if view.GetInspectMode() == 0:\n            view.SetInspectMode(1)\n        else:\n            view.SetInspectMode(0)\n\n    # Hook up the callback to toggle between inspect modes\n    # (manip axes & select data)\n    view.GetInteractor().AddObserver('UserEvent', ToggleInspectors)\n\n    # Set up render window\n    view.GetRenderWindow().SetSize(600, 300)\n    view.GetRenderWindow().SetWindowName('ParallelCoordinatesView')\n    view.GetRenderer().GradientBackgroundOn()\n    view.GetRenderer().SetBackground2(colors.GetColor3d('DarkBlue'))\n    view.GetRenderer().SetBackground(colors.GetColor3d('MidnightBlue'))\n    view.ResetCamera()\n    view.Render()\n\n    # Start interaction event loop\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/InfoVis/SelectedGraphIDs/","title":"SelectedGraphIDs","text":"

        vtk-examples/Python/InfoVis/SelectedGraphIDs

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/InfoVis/SelectedGraphIDs/#code","title":"Code","text":"

        SelectedGraphIDs.py

        #!/usr/bin/env python\n\n# This is a variation on VTK/Examples/Infovis/Python/selection.py\n# which shows how to use a vtkAnnotationLink to view the contents\n# of a selection from a vtkGraphLayoutView\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkAnnotationLink\nfrom vtkmodules.vtkInfovisCore import vtkRandomGraphSource\nfrom vtkmodules.vtkInfovisLayout import vtkSimple2DLayoutStrategy\nfrom vtkmodules.vtkViewsCore import vtkViewTheme\nfrom vtkmodules.vtkViewsInfovis import vtkGraphLayoutView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    source = vtkRandomGraphSource()\n    source.DirectedOff()\n    source.SetNumberOfVertices(100)\n    source.SetEdgeProbability(0)  # Basically generates a tree\n    source.SetUseEdgeProbability(True)\n    source.SetStartWithTree(True)\n    source.IncludeEdgeWeightsOn()\n\n    # Create force directed layout\n    strategy = vtkSimple2DLayoutStrategy()\n    strategy.SetInitialTemperature(5)\n\n    # Create a graph layout view\n    view = vtkGraphLayoutView()\n    view.AddRepresentationFromInputConnection(source.GetOutputPort())\n    view.SetVertexLabelArrayName('vertex id')\n    view.SetVertexLabelVisibility(True)\n    view.SetVertexColorArrayName('vertex id')\n    view.SetColorVertices(True)\n    view.SetEdgeColorArrayName('edge weight')\n    view.SetColorEdges(True)\n    view.SetLayoutStrategy(strategy)\n\n    # Make sure the views are using a pedigree id selection\n    view.GetRepresentation(0).SetSelectionType(2)\n\n    # Create a selection link and set both view to use it\n    annotationLink = vtkAnnotationLink()\n    view.GetRepresentation(0).SetAnnotationLink(annotationLink)\n\n    def select_callback(caller, event):\n        '''\n        In this particular data representation the current selection in the\n         annotation link should always contain two nodes: one for the edges and\n         one for the vertices. Which is which is not consistent, so you need to\n         check the FieldType of each SelectionNode\n\n        :param caller:\n        :param event:\n        :return:\n        '''\n\n        sel = caller.GetCurrentSelection()\n\n        for nn in range(sel.GetNumberOfNodes()):\n            sel_ids = sel.GetNode(nn).GetSelectionList()\n            field_type = sel.GetNode(nn).GetFieldType()\n            if field_type == 3:\n                print('Vertex selection Pedigree IDs')\n            if field_type == 4:\n                print('Edge selection Pedigree IDs')\n            if sel_ids.GetNumberOfTuples() > 0:\n                for ii in range(sel_ids.GetNumberOfTuples()):\n                    print(int(sel_ids.GetTuple1(ii)))\n            else:\n                print('-- empty')\n\n        print('')\n\n    # AnnotationChangedEvent will fire when the selection is changed\n    annotationLink.AddObserver('AnnotationChangedEvent', select_callback)\n\n    # Set the theme on the view\n    theme = vtkViewTheme.CreateMellowTheme()\n    theme.SetLineWidth(5)\n    theme.SetPointSize(10)\n    theme.SetCellOpacity(0.99)\n    theme.SetOutlineColor(colors.GetColor3d('Gray'))\n    # Vertices\n    theme.SetSelectedPointColor(colors.GetColor3d('DodgerBlue'))\n    theme.SetPointHueRange(1.0, 1.0)\n    theme.SetPointSaturationRange(1.0, 1.0)\n    theme.SetPointValueRange(0.0, 1.0)\n    # theme.SetPointAlphaRange(0.2, 0.8)\n    # Edges\n    theme.SetSelectedCellColor(colors.GetColor3d('LavenderBlush'))\n    theme.SetCellHueRange(0.1, 0.1)\n    theme.SetCellSaturationRange(0.2, 1.0)\n    theme.SetCellValueRange(0.5, 1.0)\n    # theme.SetPointAlphaRange(0.2, 0.8)\n    view.ApplyViewTheme(theme)\n    theme.FastDelete()\n\n    view.GetRenderWindow().SetSize(600, 600)\n    view.GetRenderWindow().SetWindowName('SelectedGraphIDs')\n    view.ResetCamera()\n    view.Render()\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Interaction/CallBack/","title":"CallBack","text":"

        vtk-examples/Python/Interaction/CallBack

        "},{"location":"Python/Interaction/CallBack/#description","title":"Description","text":""},{"location":"Python/Interaction/CallBack/#demonstrate-how-to-set-up-a-callback-with-client-data","title":"Demonstrate how to set up a callback with client data","text":"

        Getting the camera orientation after interacting with the image is used as an example.

        We define a callback passing the active camera as client data and linking the callback to the EndInteractionEvent of the vtkRenderWindowInteractor class. This allows us to get the camera orientation after we manipulate the image. We can then copy/paste this data as needed into our camera to set up a nice initial orientation as shown in the example.

        To help orient the cone, we use a vtkOrientationMarkerWidget and a vtkOutlineFilter.

        "},{"location":"Python/Interaction/CallBack/#c","title":"C++","text":"

        There are two methodologies in C++.

        1. Create a class that inherits from vtkCallbackCommand reimplementing Execute( vtkObject *caller, unsigned long evId, void*) and setting pointers to a client and/or call data as needed. When the class is implemented, it becomes the callback function.
        2. Create a function with this signature: void f( vtkObject * caller, long unsigned int evId, void* clientData, void* callData) and, where needed, create a vtkCallbackCommand setting its callback to the function we have created.

        The example demonstrates both approaches.

        In the function PrintCameraOrientation note how we convert an array to a vector and get a comma-separated list.

        "},{"location":"Python/Interaction/CallBack/#python","title":"Python","text":"

        In Python the approach is even simpler. We simply define a function to use as the callback with this signature: def MyCallback(obj, ev):. Then, to pass client data to it, we simply do: MyCallback.myClientData = myClientData. This relies on the fact that Python functions are in fact objects and we are simply adding new attributes such as myClientData in this case.

        An alternative method is to define a class passsing the needed variables in the __init__ function and then implement a _call__ function that does the work.

        Both approaches are demonstrated in the example.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Interaction/CallBack/#code","title":"Code","text":"

        CallBack.py

        #!/usr/bin/env python\n\n'''\nDemonstrate the use of a callback.\n\nWe also add call data.\n'''\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    #  Decide what approach to use.\n    use_function_callback = True\n\n    colors = vtkNamedColors()\n\n    # Create the Renderer, RenderWindow and RenderWindowInteractor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Use a cone as a source.\n    source = vtkConeSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(1)\n    # Use the golden ratio for the height. Because we can!\n    source.SetHeight(1.6180339887498948482)\n    source.SetResolution(128)\n    source.Update()\n\n    # Pipeline\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('peacock'))\n    # Lighting\n    actor.GetProperty().SetAmbient(0.3)\n    actor.GetProperty().SetDiffuse(0.0)\n    actor.GetProperty().SetSpecular(1.0)\n    actor.GetProperty().SetSpecularPower(20.0)\n\n    # Get an outline of the data set for context.\n    outline = vtkOutlineFilter()\n    outline.SetInputData(source.GetOutput())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(actor)\n    ren.AddActor(outlineActor)\n    ren.SetBackground(colors.GetColor3d('AliceBlue'))\n    renWin.SetSize(512, 512)\n\n    # Set up a nice camera position.\n    camera = vtkCamera()\n    camera.SetPosition(4.6, -2.0, 3.8)\n    camera.SetFocalPoint(0.0, 0.0, 0.0)\n    camera.SetClippingRange(3.2, 10.2)\n    camera.SetViewUp(0.3, 1.0, 0.13)\n    ren.SetActiveCamera(camera)\n\n    renWin.Render()\n    renWin.SetWindowName('CallBack')\n\n    axes1 = MakeAxesActor()\n    om1 = vtkOrientationMarkerWidget()\n    om1.SetOrientationMarker(axes1)\n    # Position lower left in the viewport.\n    om1.SetViewport(0, 0, 0.2, 0.2)\n    om1.SetInteractor(iren)\n    om1.EnabledOn()\n    om1.InteractiveOn()\n\n    # Set up the callback.\n    if use_function_callback:\n        # We are going to output the camera position when the event is triggered\n        #  so we add the active camera as an attribute.\n        GetOrientation.cam = ren.GetActiveCamera()\n        # Register the callback with the object that is observing.\n        iren.AddObserver('EndInteractionEvent', GetOrientation)\n    else:\n        iren.AddObserver('EndInteractionEvent', OrientationObserver(ren.GetActiveCamera()))\n        # Or:\n        # observer = OrientationObserver(ren.GetActiveCamera())\n        # iren.AddObserver('EndInteractionEvent', observer)\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef GetOrientation(caller, ev):\n    '''\n    Print out the orientation.\n\n    We must do this before we register the callback in the calling function.\n        GetOrientation.cam = ren.GetActiveCamera()\n\n    :param caller:\n    :param ev: The event.\n    :return:\n    '''\n    # Just do this to demonstrate who called callback and the event that triggered it.\n    print(caller.GetClassName(), 'Event Id:', ev)\n    # Now print the camera orientation.\n    CameraOrientation(GetOrientation.cam)\n\n\nclass OrientationObserver(object):\n    def __init__(self, cam):\n        self.cam = cam\n\n    def __call__(self, caller, ev):\n        # Just do this to demonstrate who called callback and the event that triggered it.\n        print(caller.GetClassName(), 'Event Id:', ev)\n        # Now print the camera orientation.\n        CameraOrientation(self.cam)\n\n\ndef CameraOrientation(cam):\n    fmt1 = '{:>15s}'\n    fmt2 = '{:9.6g}'\n    print(fmt1.format('Position:'), ', '.join(map(fmt2.format, cam.GetPosition())))\n    print(fmt1.format('Focal point:'), ', '.join(map(fmt2.format, cam.GetFocalPoint())))\n    print(fmt1.format('Clipping range:'), ', '.join(map(fmt2.format, cam.GetClippingRange())))\n    print(fmt1.format('View up:'), ', '.join(map(fmt2.format, cam.GetViewUp())))\n    print(fmt1.format('Distance:'), fmt2.format(cam.GetDistance()))\n\n\ndef MakeAxesActor():\n    axes = vtkAxesActor()\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText('X')\n    axes.SetYAxisLabelText('Y')\n    axes.SetZAxisLabelText('Z')\n    axes.SetTotalLength(1.0, 1.0, 1.0)\n    axes.SetCylinderRadius(0.5 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.025 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.5 * axes.GetSphereRadius())\n    return axes\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Interaction/InteractorStyleTrackballActor/","title":"InteractorStyleTrackballActor","text":"

        vtk-examples/Python/Interaction/InteractorStyleTrackballActor

        "},{"location":"Python/Interaction/InteractorStyleTrackballActor/#description","title":"Description","text":"

        Move, rotate, and scale an object in 3D.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Interaction/InteractorStyleTrackballActor/#code","title":"Code","text":"

        InteractorStyleTrackballActor.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('InteractorStyleTrackballActor')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    style = vtkInteractorStyleTrackballActor()\n    iren.SetInteractorStyle(style)\n\n    # create source\n    sphereSource = vtkSphereSource()\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphereSource.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Chartreuse'))\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('PaleGoldenrod'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Interaction/InteractorStyleTrackballCamera/","title":"InteractorStyleTrackballCamera","text":"

        vtk-examples/Python/Interaction/InteractorStyleTrackballCamera

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Interaction/InteractorStyleTrackballCamera/#code","title":"Code","text":"

        InteractorStyleTrackballCamera.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersSources import (\n    vtkPointSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkGlyph3DMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('InteractorStyleTrackballCamera')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    # create source\n    src = vtkPointSource()\n    src.SetCenter(0, 0, 0)\n    src.SetNumberOfPoints(50)\n    src.SetRadius(5)\n    src.Update()\n\n    actor = point_to_glyph(src.GetOutput().GetPoints(), 0.05)\n    actor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('RoyalBLue'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef point_to_glyph(points, scale):\n    \"\"\"\n    Convert points to glyphs.\n    :param points: The points to glyph.\n    :param scale: The scale, used to determine the size of the\n                  glyph representing the point, expressed as a\n                  fraction of the largest side of the bounding\n                  box surrounding the points. e.g. 0.05\n    :return: The actor.\n    \"\"\"\n\n    bounds = points.GetBounds()\n    max_len = 0.0\n    for i in range(0, 3):\n        max_len = max(bounds[i + 1] - bounds[i], max_len)\n\n    sphere_source = vtkSphereSource()\n    sphere_source.SetRadius(scale * max_len)\n\n    pd = vtkPolyData()\n    pd.SetPoints(points)\n\n    mapper = vtkGlyph3DMapper()\n    mapper.SetInputData(pd)\n    mapper.SetSourceConnection(sphere_source.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    mapper.ScalingOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    return actor\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Interaction/MouseEvents/","title":"MouseEvents","text":"

        vtk-examples/Python/Interaction/MouseEvents

        "},{"location":"Python/Interaction/MouseEvents/#description","title":"Description","text":"

        This example creates a new vtkInteractorStyle which can be used to implement custom reactions on user events. If you just want to disable single events you can also have a look at MouseEventsObserver. This specific example just prints a simple message and then calls the original eventhandler of the vtkInteractorStyleTrackballCamera.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Interaction/MouseEvents/#code","title":"Code","text":"

        MouseEvents.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\nclass MyInteractorStyle(vtkInteractorStyleTrackballCamera):\n\n    def __init__(self, parent=None):\n        self.AddObserver('MiddleButtonPressEvent', self.middle_button_press_event)\n        self.AddObserver('MiddleButtonReleaseEvent', self.middle_button_release_event)\n\n    def middle_button_press_event(self, obj, event):\n        print('Middle Button pressed')\n        self.OnMiddleButtonDown()\n        return\n\n    def middle_button_release_event(self, obj, event):\n        print('Middle Button released')\n        self.OnMiddleButtonUp()\n        return\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    source = vtkSphereSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(1)\n    source.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderer.AddActor(actor)\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('MouseEvents')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetInteractorStyle(MyInteractorStyle())\n    interactor.SetRenderWindow(renwin)\n\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Interaction/MouseEventsObserver/","title":"MouseEventsObserver","text":"

        vtk-examples/Python/Interaction/MouseEventsObserver

        "},{"location":"Python/Interaction/MouseEventsObserver/#description","title":"Description","text":"

        This example directly changes the observers of the vtkInteractor, which is an easy way to disable events or to add some simple callback functions. For a more general framework using vtkInteractorStyle see MouseEvents. This specific example just disables the left mouse button of the vtkInteractorStyleTrackballCamera and prints a simple message instead.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Interaction/MouseEventsObserver/#code","title":"Code","text":"

        MouseEventsObserver.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    source = vtkSphereSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(1)\n    source.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderer.AddActor(actor)\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('MouseEventsObserver')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetInteractorStyle(vtkInteractorStyleTrackballCamera())\n    interactor.SetRenderWindow(renwin)\n\n    def DummyFunc1(obj, ev):\n        print('Before Event')\n\n    def DummyFunc2(obj, ev):\n        print('After Event')\n\n    # Print interator gives you a list of registered observers of the current\n    # interactor style\n    # print(interactor)\n\n    # adding priorities allow to control the order of observer execution\n    # (highest value first! if equal the first added observer is called first)\n    interactor.RemoveObservers('LeftButtonPressEvent')\n    interactor.AddObserver('LeftButtonPressEvent', DummyFunc1, 1.0)\n    interactor.AddObserver('LeftButtonPressEvent', DummyFunc2, -1.0)\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Medical/GenerateCubesFromLabels/","title":"GenerateCubesFromLabels","text":"

        vtk-examples/Python/Medical/GenerateCubesFromLabels

        "},{"location":"Python/Medical/GenerateCubesFromLabels/#description","title":"Description","text":"

        Sometimes it is helpful to view the results of a segmentation without any post processing. This example converts the point data from a labeled volume into cell data. The surfaces are displayed as vtkPolydata. If you want to created smoothed polydata models from your segmented volumes, see the example GenerateModelsFromLabels. The input volume must be in MetaIO format.

         Usage: GenerateCubesFromLabels InputVolume.mhd StartLabel EndLabel\n      where\n        InputVolume is a meta file containing a 3 volume of discrete labels.\n        StartLabel is the first label to be processed\n        EndLabel is the last label to be processed\n        NOTE: There can be gaps in the labeling. If a label does not exist in the volume, it will be skipped.\n

        Note

        This original source code for this example is here.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Medical/GenerateCubesFromLabels/#code","title":"Code","text":"

        GenerateCubesFromLabels.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkDataObject,\n    vtkDataSetAttributes\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkThreshold\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformFilter\nfrom vtkmodules.vtkFiltersGeometry import vtkGeometryFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkImageWrapPad\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    file_name, start_label, end_label = get_program_parameters()\n    if start_label > end_label:\n        end_label, start_label = start_label, end_label\n\n    # Generate cubes from labels\n    # 1) Read the meta file\n    # 2) Convert point data to cell data\n    # 3) Convert to geometry and display\n\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    # Pad the volume so that we can change the point data into cell\n    # data.\n    extent = reader.GetOutput().GetExtent()\n    pad = vtkImageWrapPad()\n    pad.SetInputConnection(reader.GetOutputPort())\n    pad.SetOutputWholeExtent(extent[0], extent[1] + 1, extent[2], extent[3] + 1, extent[4], extent[5] + 1)\n    pad.Update()\n\n    # Copy the scalar point data of the volume into the scalar cell data\n    pad.GetOutput().GetCellData().SetScalars(reader.GetOutput().GetPointData().GetScalars())\n\n    selector = vtkThreshold()\n    selector.SetInputArrayToProcess(0, 0, 0, vtkDataObject().FIELD_ASSOCIATION_CELLS,\n                                    vtkDataSetAttributes().SCALARS)\n    selector.SetInputConnection(pad.GetOutputPort())\n    selector.SetLowerThreshold(start_label)\n    selector.SetUpperThreshold(end_label)\n    selector.Update()\n\n    # Shift the geometry by 1/2\n    transform = vtkTransform()\n    transform.Translate(-0.5, -0.5, -0.5)\n\n    transform_model = vtkTransformFilter()\n    transform_model.SetTransform(transform)\n    transform_model.SetInputConnection(selector.GetOutputPort())\n\n    geometry = vtkGeometryFilter()\n    geometry.SetInputConnection(transform_model.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(geometry.GetOutputPort())\n    mapper.SetScalarRange(start_label, end_label)\n    mapper.SetScalarModeToUseCellData()\n    mapper.SetColorModeToMapScalars()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetSize(640, 480)\n    render_window.SetWindowName('GenerateCubesFromLabels')\n\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateBlue'))\n    render_window.Render()\n\n    camera = renderer.GetActiveCamera()\n    camera.SetPosition(42.301174, 939.893457, -124.005030)\n    camera.SetFocalPoint(224.697134, 221.301653, 146.823706)\n    camera.SetViewUp(0.262286, -0.281321, -0.923073)\n    camera.SetDistance(789.297581)\n    camera.SetClippingRange(168.744328, 1509.660206)\n\n    render_window_interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Convert the point data from a labeled volume into cell data.'\n    epilogue = '''\n The surfaces are displayed as vtkPolydata.\n     '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Input volume e.g. Frog/frogtissue.mhd.')\n    parser.add_argument('startlabel', type=int, help='The starting label in the input volume, e,g, 1.')\n    parser.add_argument('endlabel', type=int, help='The ending label in the input volume e.g. 29')\n    args = parser.parse_args()\n    return args.filename, args.startlabel, args.endlabel\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Medical/GenerateModelsFromLabels/","title":"GenerateModelsFromLabels","text":"

        vtk-examples/Python/Medical/GenerateModelsFromLabels

        "},{"location":"Python/Medical/GenerateModelsFromLabels/#description","title":"Description","text":"

        This example uses vtkDiscreteFlyingEdges3D or vtkDiscreteMarchingCubes to create vtkPolyData models from a 3D volume that contains discrete labels. These volumes are normally the output of a segmentation algorithm. The polydata for each label will be output into a separate file.

        You can load these files into ParaView, where they will appear as a series of time steps. You can then single step through displaying the polydate from each file making up the series.

        If you want to see the segmentation results as cube models, see the example GenerateCubesFromLabels

        The input volume must be in MetaIO format.

        Once you generate the models, you can view them with Paraview

        Note

        This original source code for this example is here.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Medical/GenerateModelsFromLabels/#code","title":"Code","text":"

        GenerateModelsFromLabels.py

        #!/usr/bin/env python\n\nimport os\nimport sys\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkDataObject,\n    vtkDataSetAttributes\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkMaskFields,\n    vtkThreshold,\n    vtkWindowedSincPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkDiscreteFlyingEdges3D,\n    vtkDiscreteMarchingCubes\n)\nfrom vtkmodules.vtkFiltersGeometry import vtkGeometryFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\nfrom vtkmodules.vtkImagingStatistics import vtkImageAccumulate\n\n\ndef main():\n    # vtkDiscreteFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    file_name, start_label, end_label = get_program_parameters()\n    if start_label > end_label:\n        end_label, start_label = start_label, end_label\n\n    # Create all of the classes we will need\n    reader = vtkMetaImageReader()\n    histogram = vtkImageAccumulate()\n    if use_flying_edges:\n        try:\n            using_marching_cubes = False\n            discrete_cubes = vtkDiscreteFlyingEdges3D()\n        except AttributeError:\n            using_marching_cubes = True\n            discrete_cubes = vtkDiscreteMarchingCubes()\n    else:\n        using_marching_cubes = True\n        discrete_cubes = vtkDiscreteMarchingCubes()\n    smoother = vtkWindowedSincPolyDataFilter()\n    selector = vtkThreshold()\n    scalars_off = vtkMaskFields()\n    geometry = vtkGeometryFilter()\n    writer = vtkXMLPolyDataWriter()\n\n    # Define all of the variables\n    file_prefix = 'Label'\n    smoothing_iterations = 15\n    pass_band = 0.001\n    feature_angle = 120.0\n\n    # Generate models from labels\n    # 1) Read the meta file\n    # 2) Generate a histogram of the labels\n    # 3) Generate models from the labeled volume\n    # 4) Smooth the models\n    # 5) Output each model into a separate file\n\n    reader.SetFileName(file_name)\n\n    histogram.SetInputConnection(reader.GetOutputPort())\n    histogram.SetComponentExtent(0, end_label, 0, 0, 0, 0)\n    histogram.SetComponentOrigin(0, 0, 0)\n    histogram.SetComponentSpacing(1, 1, 1)\n    histogram.Update()\n\n    discrete_cubes.SetInputConnection(reader.GetOutputPort())\n    discrete_cubes.GenerateValues(end_label - start_label + 1, start_label, end_label)\n\n    smoother.SetInputConnection(discrete_cubes.GetOutputPort())\n    smoother.SetNumberOfIterations(smoothing_iterations)\n    smoother.BoundarySmoothingOff()\n    smoother.FeatureEdgeSmoothingOff()\n    smoother.SetFeatureAngle(feature_angle)\n    smoother.SetPassBand(pass_band)\n    smoother.NonManifoldSmoothingOn()\n    smoother.NormalizeCoordinatesOn()\n    smoother.Update()\n\n    selector.SetInputConnection(smoother.GetOutputPort())\n    if use_flying_edges:\n        if using_marching_cubes:\n            selector.SetInputArrayToProcess(0, 0, 0, vtkDataObject().FIELD_ASSOCIATION_CELLS,\n                                            vtkDataSetAttributes().SCALARS)\n        else:\n            selector.SetInputArrayToProcess(0, 0, 0, vtkDataObject().FIELD_ASSOCIATION_POINTS,\n                                            vtkDataSetAttributes().SCALARS)\n    else:\n        selector.SetInputArrayToProcess(0, 0, 0, vtkDataObject().FIELD_ASSOCIATION_CELLS,\n                                        vtkDataSetAttributes().SCALARS)\n\n    # Strip the scalars from the output\n    scalars_off.SetInputConnection(selector.GetOutputPort())\n    scalars_off.CopyAttributeOff(vtkMaskFields().POINT_DATA,\n                                 vtkDataSetAttributes().SCALARS)\n    scalars_off.CopyAttributeOff(vtkMaskFields().CELL_DATA,\n                                 vtkDataSetAttributes().SCALARS)\n\n    geometry.SetInputConnection(scalars_off.GetOutputPort())\n\n    writer.SetInputConnection(geometry.GetOutputPort())\n\n    for i in range(start_label, end_label + 1):\n        # see if the label exists, if not skip it\n        frequency = histogram.GetOutput().GetPointData().GetScalars().GetTuple1(i)\n        if frequency == 0.0:\n            continue\n\n        # select the cells for a given label\n        selector.SetLowerThreshold(i)\n        selector.SetUpperThreshold(i)\n\n        # output the polydata\n        output_fn = '{:s}{:d}.vtp'.format(file_prefix, i)\n        print('{:s} writing {:s}'.format(os.path.basename(sys.argv[0]), output_fn))\n\n        writer.SetFileName(output_fn)\n        writer.Write()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Creates vtkPolyData models from a 3D volume that contains discrete labels.'\n    epilogue = '''\nThese volumes are normally the output of a segmentation algorithm.\nThe polydata for each label will be output into a separate file.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Input volume e.g. Frog/frogtissue.mhd.')\n    parser.add_argument('startlabel', type=int, help='The starting label in the input volume, e,g, 1.')\n    parser.add_argument('endlabel', type=int, help='The ending label in the input volume e.g. 29')\n    args = parser.parse_args()\n    return args.filename, args.startlabel, args.endlabel\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Medical/MedicalDemo1/","title":"MedicalDemo1","text":"

        vtk-examples/Python/Medical/MedicalDemo1

        "},{"location":"Python/Medical/MedicalDemo1/#description","title":"Description","text":"

        The skin extracted from a CT dataset of the head.

        usage

        MedicalDemo1 FullHead.mhd

        Note

        The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

        Note

        This original source code for this example is here.

        Info

        See Figure 12-2 in Chapter 12 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Medical/MedicalDemo1/#code","title":"Code","text":"

        MedicalDemo1.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    colors.SetColor('SkinColor', [240, 184, 160, 255])\n    colors.SetColor('BackfaceColor', [255, 229, 200, 255])\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    # Create the renderer, the render window, and the interactor. The renderer\n    # draws into the render window, the interactor enables mouse- and\n    # keyboard-based interaction with the data within the render window.\n    #\n    a_renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(a_renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n\n    # An isosurface, or contour value of 500 is known to correspond to the\n    # skin of the patient.\n    if use_flying_edges:\n        try:\n            skin_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            skin_extractor = vtkMarchingCubes()\n    else:\n        skin_extractor = vtkMarchingCubes()\n    skin_extractor.SetInputConnection(reader.GetOutputPort())\n    skin_extractor.SetValue(0, 500)\n\n    skin_mapper = vtkPolyDataMapper()\n    skin_mapper.SetInputConnection(skin_extractor.GetOutputPort())\n    skin_mapper.ScalarVisibilityOff()\n\n    skin = vtkActor()\n    skin.SetMapper(skin_mapper)\n    skin.GetProperty().SetDiffuseColor(colors.GetColor3d('SkinColor'))\n\n    back_prop = vtkProperty()\n    back_prop.SetDiffuseColor(colors.GetColor3d('BackfaceColor'))\n    skin.SetBackfaceProperty(back_prop)\n\n    # An outline provides context around the data.\n    #\n    outline_data = vtkOutlineFilter()\n    outline_data.SetInputConnection(reader.GetOutputPort())\n\n    map_outline = vtkPolyDataMapper()\n    map_outline.SetInputConnection(outline_data.GetOutputPort())\n\n    outline = vtkActor()\n    outline.SetMapper(map_outline)\n    outline.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # It is convenient to create an initial view of the data. The FocalPoint\n    # and Position form a vector direction. Later on (ResetCamera() method)\n    # this vector is used to position the camera to look at the data in\n    # this direction.\n    a_camera = vtkCamera()\n    a_camera.SetViewUp(0, 0, -1)\n    a_camera.SetPosition(0, -1, 0)\n    a_camera.SetFocalPoint(0, 0, 0)\n    a_camera.ComputeViewPlaneNormal()\n    a_camera.Azimuth(30.0)\n    a_camera.Elevation(30.0)\n\n    # Actors are added to the renderer. An initial camera view is created.\n    # The Dolly() method moves the camera towards the FocalPoint,\n    # thereby enlarging the image.\n    a_renderer.AddActor(outline)\n    a_renderer.AddActor(skin)\n    a_renderer.SetActiveCamera(a_camera)\n    a_renderer.ResetCamera()\n    a_camera.Dolly(1.5)\n\n    # Set a background color for the renderer and set the size of the\n    # render window (expressed in pixels).\n    a_renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('MedicalDemo1')\n\n    # Note that when camera movement occurs (as it does in the Dolly()\n    # method), the clipping planes often need adjusting. Clipping planes\n    # consist of two planes: near and far along the view direction. The\n    # near plane clips out objects in front of the plane the far plane\n    # clips out objects behind the plane. This way only what is drawn\n    # between the planes is actually rendered.\n    a_renderer.ResetCameraClippingRange()\n\n    # Initialize the event loop and then start it.\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The skin extracted from a CT dataset of the head.'\n    epilogue = '''\n    Derived from VTK/Examples/Cxx/Medical1.cxx\n    This example reads a volume dataset, extracts an isosurface that\n     represents the skin and displays it.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Medical/MedicalDemo2/","title":"MedicalDemo2","text":"

        vtk-examples/Python/Medical/MedicalDemo2

        "},{"location":"Python/Medical/MedicalDemo2/#description","title":"Description","text":"

        Skin and bone isosurfaces.

        Usage

        MedicalDemo2 FullHead.mhd

        Note

        The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

        Note

        This original source code for this example is here.

        Info

        See Figure 12-3 in Chapter 12 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Medical/MedicalDemo2/#code","title":"Code","text":"

        MedicalDemo2.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    colors.SetColor('SkinColor', [240, 184, 160, 255])\n    colors.SetColor('BackfaceColor', [255, 229, 200, 255])\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    # Create the renderer, the render window, and the interactor. The renderer\n    # draws into the render window, the interactor enables mouse- and\n    # keyboard-based interaction with the data within the render window.\n    #\n    a_renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(a_renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # The following reader is used to read a series of 2D slices (images)\n    # that compose the volume. The slice dimensions are set, and the\n    # pixel spacing. The data Endianness must also be specified. The reader\n    # uses the FilePrefix in combination with the slice number to construct\n    # filenames using the format FilePrefix.%d. (In this case the FilePrefix\n    # is the root name of the file: quarter.)\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n\n    # An isosurface, or contour value of 500 is known to correspond to the\n    # skin of the patient.\n    # The triangle stripper is used to create triangle strips from the\n    # isosurface these render much faster on many systems.\n    if use_flying_edges:\n        try:\n            skin_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            skin_extractor = vtkMarchingCubes()\n    else:\n        skin_extractor = vtkMarchingCubes()\n    skin_extractor.SetInputConnection(reader.GetOutputPort())\n    skin_extractor.SetValue(0, 500)\n\n    skin_stripper = vtkStripper()\n    skin_stripper.SetInputConnection(skin_extractor.GetOutputPort())\n\n    skin_mapper = vtkPolyDataMapper()\n    skin_mapper.SetInputConnection(skin_stripper.GetOutputPort())\n    skin_mapper.ScalarVisibilityOff()\n\n    skin = vtkActor()\n    skin.SetMapper(skin_mapper)\n    skin.GetProperty().SetDiffuseColor(colors.GetColor3d('SkinColor'))\n    skin.GetProperty().SetSpecular(0.3)\n    skin.GetProperty().SetSpecularPower(20)\n    skin.GetProperty().SetOpacity(0.5)\n\n    back_prop = vtkProperty()\n    back_prop.SetDiffuseColor(colors.GetColor3d('BackfaceColor'))\n    skin.SetBackfaceProperty(back_prop)\n\n    # An isosurface, or contour value of 1150 is known to correspond to the\n    # bone of the patient.\n    # The triangle stripper is used to create triangle strips from the\n    # isosurface these render much faster on may systems.\n    if use_flying_edges:\n        try:\n            bone_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            bone_extractor = vtkMarchingCubes()\n    else:\n        bone_extractor = vtkMarchingCubes()\n    bone_extractor.SetInputConnection(reader.GetOutputPort())\n    bone_extractor.SetValue(0, 1150)\n\n    bone_stripper = vtkStripper()\n    bone_stripper.SetInputConnection(bone_extractor.GetOutputPort())\n\n    bone_mapper = vtkPolyDataMapper()\n    bone_mapper.SetInputConnection(bone_stripper.GetOutputPort())\n    bone_mapper.ScalarVisibilityOff()\n\n    bone = vtkActor()\n    bone.SetMapper(bone_mapper)\n    bone.GetProperty().SetDiffuseColor(colors.GetColor3d('Ivory'))\n\n    # An outline provides context around the data.\n    #\n    outline_data = vtkOutlineFilter()\n    outline_data.SetInputConnection(reader.GetOutputPort())\n\n    map_outline = vtkPolyDataMapper()\n    map_outline.SetInputConnection(outline_data.GetOutputPort())\n\n    outline = vtkActor()\n    outline.SetMapper(map_outline)\n    outline.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # It is convenient to create an initial view of the data. The FocalPoint\n    # and Position form a vector direction. Later on (ResetCamera() method)\n    # this vector is used to position the camera to look at the data in\n    # this direction.\n    a_camera = vtkCamera()\n    a_camera.SetViewUp(0, 0, -1)\n    a_camera.SetPosition(0, -1, 0)\n    a_camera.SetFocalPoint(0, 0, 0)\n    a_camera.ComputeViewPlaneNormal()\n    a_camera.Azimuth(30.0)\n    a_camera.Elevation(30.0)\n\n    # Actors are added to the renderer. An initial camera view is created.\n    # The Dolly() method moves the camera towards the FocalPoint,\n    # thereby enlarging the image.\n    a_renderer.AddActor(outline)\n    a_renderer.AddActor(skin)\n    a_renderer.AddActor(bone)\n    a_renderer.SetActiveCamera(a_camera)\n    a_renderer.ResetCamera()\n    a_camera.Dolly(1.5)\n\n    # Set a background color for the renderer and set the size of the\n    # render window (expressed in pixels).\n    a_renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('MedicalDemo2')\n\n    # Note that when camera movement occurs (as it does in the Dolly()\n    # method), the clipping planes often need adjusting. Clipping planes\n    # consist of two planes: near and far along the view direction. The\n    # near plane clips out objects in front of the plane the far plane\n    # clips out objects behind the plane. This way only what is drawn\n    # between the planes is actually rendered.\n    a_renderer.ResetCameraClippingRange()\n\n    # Initialize the event loop and then start it.\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The skin and bone is extracted from a CT dataset of the head.'\n    epilogue = '''\n    Derived from VTK/Examples/Cxx/Medical2.cxx\n    This example reads a volume dataset, extracts two isosurfaces that\n     represent the skin and bone, and then displays it.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Medical/MedicalDemo3/","title":"MedicalDemo3","text":"

        vtk-examples/Python/Medical/MedicalDemo3

        "},{"location":"Python/Medical/MedicalDemo3/#description","title":"Description","text":"

        Composite image of three planes and translucent skin

        Usage

        MedicalDemo3 FullHead.mhd

        Note

        The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

        Note

        This original source code for this example is here.

        Info

        See Figure 12-4 in Chapter 12 the VTK Textbook.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Medical/MedicalDemo3/#code","title":"Code","text":"

        MedicalDemo3.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkLookupTable,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkImageMapToColors\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkImageActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    colors.SetColor('SkinColor', [240, 184, 160, 255])\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    # Create the renderer, the render window, and the interactor. The\n    # renderer draws into the render window, the interactor enables\n    # mouse- and keyboard-based interaction with the data within the\n    # render window.\n    #\n    a_renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(a_renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Set a background color for the renderer and set the size of the\n    # render window (expressed in pixels).\n    a_renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    ren_win.SetSize(640, 480)\n\n    # The following reader is used to read a series of 2D slices (images)\n    # that compose the volume. The slice dimensions are set, and the\n    # pixel spacing. The data Endianness must also be specified. The\n    # reader uses the FilePrefix in combination with the slice number to\n    # construct filenames using the format FilePrefix.%d. (In this case\n    # the FilePrefix is the root name of the file: quarter.)\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    # An isosurface, or contour value of 500 is known to correspond to\n    # the skin of the patient.\n    # The triangle stripper is used to create triangle\n    # strips from the isosurface these render much faster on may\n    # systems.\n    if use_flying_edges:\n        try:\n            skin_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            skin_extractor = vtkMarchingCubes()\n    else:\n        skin_extractor = vtkMarchingCubes()\n    skin_extractor.SetInputConnection(reader.GetOutputPort())\n    skin_extractor.SetValue(0, 500)\n    skin_extractor.Update()\n\n    skin_stripper = vtkStripper()\n    skin_stripper.SetInputConnection(skin_extractor.GetOutputPort())\n    skin_stripper.Update()\n\n    skin_mapper = vtkPolyDataMapper()\n    skin_mapper.SetInputConnection(skin_stripper.GetOutputPort())\n    skin_mapper.ScalarVisibilityOff()\n\n    skin = vtkActor()\n    skin.SetMapper(skin_mapper)\n    skin.GetProperty().SetDiffuseColor(colors.GetColor3d('SkinColor'))\n    skin.GetProperty().SetSpecular(0.3)\n    skin.GetProperty().SetSpecularPower(20)\n\n    # An isosurface, or contour value of 1150 is known to correspond to\n    # the bone of the patient.\n    # The triangle stripper is used to create triangle\n    # strips from the isosurface these render much faster on may\n    # systems.\n    if use_flying_edges:\n        try:\n            bone_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            bone_extractor = vtkMarchingCubes()\n    else:\n        bone_extractor = vtkMarchingCubes()\n    bone_extractor.SetInputConnection(reader.GetOutputPort())\n    bone_extractor.SetValue(0, 1150)\n\n    bone_stripper = vtkStripper()\n    bone_stripper.SetInputConnection(bone_extractor.GetOutputPort())\n\n    bone_mapper = vtkPolyDataMapper()\n    bone_mapper.SetInputConnection(bone_stripper.GetOutputPort())\n    bone_mapper.ScalarVisibilityOff()\n\n    bone = vtkActor()\n    bone.SetMapper(bone_mapper)\n    bone.GetProperty().SetDiffuseColor(colors.GetColor3d('Ivory'))\n\n    # An outline provides context around the data.\n    #\n    outline_data = vtkOutlineFilter()\n    outline_data.SetInputConnection(reader.GetOutputPort())\n    outline_data.Update()\n\n    map_outline = vtkPolyDataMapper()\n    map_outline.SetInputConnection(outline_data.GetOutputPort())\n\n    outline = vtkActor()\n    outline.SetMapper(map_outline)\n    outline.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Now we are creating three orthogonal planes passing through the\n    # volume. Each plane uses a different texture map and therefore has\n    # different coloration.\n\n    # Start by creating a black/white lookup table.\n    bw_lut = vtkLookupTable()\n    bw_lut.SetTableRange(0, 2000)\n    bw_lut.SetSaturationRange(0, 0)\n    bw_lut.SetHueRange(0, 0)\n    bw_lut.SetValueRange(0, 1)\n    bw_lut.Build()  # effective built\n\n    # Now create a lookup table that consists of the full hue circle\n    # (from HSV).\n    hue_lut = vtkLookupTable()\n    hue_lut.SetTableRange(0, 2000)\n    hue_lut.SetHueRange(0, 1)\n    hue_lut.SetSaturationRange(1, 1)\n    hue_lut.SetValueRange(1, 1)\n    hue_lut.Build()  # effective built\n\n    # Finally, create a lookup table with a single hue but having a range\n    # in the saturation of the hue.\n    sat_lut = vtkLookupTable()\n    sat_lut.SetTableRange(0, 2000)\n    sat_lut.SetHueRange(0.6, 0.6)\n    sat_lut.SetSaturationRange(0, 1)\n    sat_lut.SetValueRange(1, 1)\n    sat_lut.Build()  # effective built\n\n    # Create the first of the three planes. The filter vtkImageMapToColors\n    # maps the data through the corresponding lookup table created above.  The\n    # vtkImageActor is a type of vtkProp and conveniently displays an image on\n    # a single quadrilateral plane. It does this using texture mapping and as\n    # a result is quite fast. (Note: the input image has to be unsigned char\n    # values, which the vtkImageMapToColors produces.) Note also that by\n    # specifying the DisplayExtent, the pipeline requests data of this extent\n    # and the vtkImageMapToColors only processes a slice of data.\n    sagittal_colors = vtkImageMapToColors()\n    sagittal_colors.SetInputConnection(reader.GetOutputPort())\n    sagittal_colors.SetLookupTable(bw_lut)\n    sagittal_colors.Update()\n\n    sagittal = vtkImageActor()\n    sagittal.GetMapper().SetInputConnection(sagittal_colors.GetOutputPort())\n    sagittal.SetDisplayExtent(128, 128, 0, 255, 0, 92)\n    sagittal.ForceOpaqueOn()\n\n    # Create the second (axial) plane of the three planes. We use the\n    # same approach as before except that the extent differs.\n    axial_colors = vtkImageMapToColors()\n    axial_colors.SetInputConnection(reader.GetOutputPort())\n    axial_colors.SetLookupTable(hue_lut)\n    axial_colors.Update()\n\n    axial = vtkImageActor()\n    axial.GetMapper().SetInputConnection(axial_colors.GetOutputPort())\n    axial.SetDisplayExtent(0, 255, 0, 255, 46, 46)\n    axial.ForceOpaqueOn()\n\n    # Create the third (coronal) plane of the three planes. We use\n    # the same approach as before except that the extent differs.\n    coronal_colors = vtkImageMapToColors()\n    coronal_colors.SetInputConnection(reader.GetOutputPort())\n    coronal_colors.SetLookupTable(sat_lut)\n    coronal_colors.Update()\n\n    coronal = vtkImageActor()\n    coronal.GetMapper().SetInputConnection(coronal_colors.GetOutputPort())\n    coronal.SetDisplayExtent(0, 255, 128, 128, 0, 92)\n    coronal.ForceOpaqueOn()\n\n    # It is convenient to create an initial view of the data. The\n    # FocalPoint and Position form a vector direction. Later on\n    # (ResetCamera() method) this vector is used to position the camera\n    # to look at the data in this direction.\n    a_camera = vtkCamera()\n    a_camera.SetViewUp(0, 0, -1)\n    a_camera.SetPosition(0, -1, 0)\n    a_camera.SetFocalPoint(0, 0, 0)\n    a_camera.ComputeViewPlaneNormal()\n    a_camera.Azimuth(30.0)\n    a_camera.Elevation(30.0)\n\n    # Actors are added to the renderer.\n    a_renderer.AddActor(outline)\n    a_renderer.AddActor(sagittal)\n    a_renderer.AddActor(axial)\n    a_renderer.AddActor(coronal)\n    a_renderer.AddActor(skin)\n    a_renderer.AddActor(bone)\n\n    # Turn off bone for this example.\n    bone.VisibilityOff()\n\n    # Set skin to semi-transparent.\n    skin.GetProperty().SetOpacity(0.5)\n\n    # An initial camera view is created.  The Dolly() method moves\n    # the camera towards the FocalPoint, thereby enlarging the image.\n    a_renderer.SetActiveCamera(a_camera)\n\n    # Calling Render() directly on a vtkRenderer is strictly forbidden.\n    # Only calling Render() on the vtkRenderWindow is a valid call.\n    ren_win.SetWindowName('MedicalDemo3')\n    ren_win.Render()\n\n    a_renderer.ResetCamera()\n    a_camera.Dolly(1.5)\n\n    # Note that when camera movement occurs (as it does in the Dolly()\n    # method), the clipping planes often need adjusting. Clipping planes\n    # consist of two planes: near and far along the view direction. The\n    # near plane clips out objects in front of the plane; the far plane\n    # clips out objects behind the plane. This way only what is drawn\n    # between the planes is actually rendered.\n    a_renderer.ResetCameraClippingRange()\n\n    # Interact with the data.\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The skin and bone is extracted from a CT dataset of the head.'\n    epilogue = '''\n    Derived from VTK/Examples/Cxx/Medical3.cxx\n    This example reads a volume dataset, extracts two isosurfaces that\n     represent the skin and bone, creates three orthogonal planes\n     (sagittal, axial, coronal), and displays them.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Medical/MedicalDemo4/","title":"MedicalDemo4","text":"

        vtk-examples/Python/Medical/MedicalDemo4

        "},{"location":"Python/Medical/MedicalDemo4/#description","title":"Description","text":"

        Volume rendering of the dataset.

        Usage

        MedicalDemo4 FullHead.mhd

        Note

        This original source code for this example is here.

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Medical/MedicalDemo4/#code","title":"Code","text":"

        MedicalDemo4.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingVolumeOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPiecewiseFunction\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkColorTransferFunction,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkVolume,\n    vtkVolumeProperty\n)\nfrom vtkmodules.vtkRenderingVolume import vtkFixedPointVolumeRayCastMapper\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    # Create the renderer, the render window, and the interactor. The renderer\n    # draws into the render window, the interactor enables mouse- and\n    # keyboard-based interaction with the scene.\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # The following reader is used to read a series of 2D slices (images)\n    # that compose the volume. The slice dimensions are set, and the\n    # pixel spacing. The data Endianness must also be specified. The reader\n    # uses the FilePrefix in combination with the slice number to construct\n    # filenames using the format FilePrefix.%d. (In this case the FilePrefix\n    # is the root name of the file: quarter.)\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n\n    # The volume will be displayed by ray-cast alpha compositing.\n    # A ray-cast mapper is needed to do the ray-casting.\n    volume_mapper = vtkFixedPointVolumeRayCastMapper()\n    volume_mapper.SetInputConnection(reader.GetOutputPort())\n\n    # The color transfer function maps voxel intensities to colors.\n    # It is modality-specific, and often anatomy-specific as well.\n    # The goal is to one color for flesh (between 500 and 1000)\n    # and another color for bone (1150 and over).\n    volume_color = vtkColorTransferFunction()\n    volume_color.AddRGBPoint(0, 0.0, 0.0, 0.0)\n    volume_color.AddRGBPoint(500, 240.0 / 255.0, 184.0 / 255.0, 160.0 / 255.0)\n    volume_color.AddRGBPoint(1000, 240.0 / 255.0, 184.0 / 255.0, 160.0 / 255.0)\n    volume_color.AddRGBPoint(1150, 1.0, 1.0, 240.0 / 255.0)  # Ivory\n\n    # The opacity transfer function is used to control the opacity\n    # of different tissue types.\n    volume_scalar_opacity = vtkPiecewiseFunction()\n    volume_scalar_opacity.AddPoint(0, 0.00)\n    volume_scalar_opacity.AddPoint(500, 0.15)\n    volume_scalar_opacity.AddPoint(1000, 0.15)\n    volume_scalar_opacity.AddPoint(1150, 0.85)\n\n    # The gradient opacity function is used to decrease the opacity\n    # in the 'flat' regions of the volume while maintaining the opacity\n    # at the boundaries between tissue types.  The gradient is measured\n    # as the amount by which the intensity changes over unit distance.\n    # For most medical data, the unit distance is 1mm.\n    volume_gradient_opacity = vtkPiecewiseFunction()\n    volume_gradient_opacity.AddPoint(0, 0.0)\n    volume_gradient_opacity.AddPoint(90, 0.5)\n    volume_gradient_opacity.AddPoint(100, 1.0)\n\n    # The VolumeProperty attaches the color and opacity functions to the\n    # volume, and sets other volume properties.  The interpolation should\n    # be set to linear to do a high-quality rendering.  The ShadeOn option\n    # turns on directional lighting, which will usually enhance the\n    # appearance of the volume and make it look more '3D'.  However,\n    # the quality of the shading depends on how accurately the gradient\n    # of the volume can be calculated, and for noisy data the gradient\n    # estimation will be very poor.  The impact of the shading can be\n    # decreased by increasing the Ambient coefficient while decreasing\n    # the Diffuse and Specular coefficient.  To increase the impact\n    # of shading, decrease the Ambient and increase the Diffuse and Specular.\n    volume_property = vtkVolumeProperty()\n    volume_property.SetColor(volume_color)\n    volume_property.SetScalarOpacity(volume_scalar_opacity)\n    volume_property.SetGradientOpacity(volume_gradient_opacity)\n    volume_property.SetInterpolationTypeToLinear()\n    volume_property.ShadeOn()\n    volume_property.SetAmbient(0.4)\n    volume_property.SetDiffuse(0.6)\n    volume_property.SetSpecular(0.2)\n\n    # The vtkVolume is a vtkProp3D (like a vtkActor) and controls the position\n    # and orientation of the volume in world coordinates.\n    volume = vtkVolume()\n    volume.SetMapper(volume_mapper)\n    volume.SetProperty(volume_property)\n\n    # Finally, add the volume to the renderer\n    ren.AddViewProp(volume)\n\n    # Set up an initial view of the volume.  The focal point will be the\n    # center of the volume, and the camera position will be 400mm to the\n    # patient's left (which is our right).\n    camera = ren.GetActiveCamera()\n    c = volume.GetCenter()\n    camera.SetViewUp(0, 0, -1)\n    camera.SetPosition(c[0], c[1] - 400, c[2])\n    camera.SetFocalPoint(c[0], c[1], c[2])\n    camera.Azimuth(30.0)\n    camera.Elevation(30.0)\n\n    # Set a background color for the renderer\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n\n    # Increase the size of the render window\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('MedicalDemo4')\n\n    # Interact with the data.\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a volume dataset and displays it via volume rendering.'\n    epilogue = '''\n    Derived from VTK/Examples/Cxx/Medical4.cxx\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Medical/TissueLens/","title":"TissueLens","text":"

        vtk-examples/Python/Medical/TissueLens

        "},{"location":"Python/Medical/TissueLens/#description","title":"Description","text":"

        This example uses two vtkClipDataSet filters to achieve a \"tissue lens\" effect. First, a vtkSphere implicit function is used to clip a spherical hole in the isosurface extracted with vtkFlyingEdges3D or vtkMarchingCubes. Then a geometric [vtkSphere](https://www.vtk.org/doc/nightly/html/classvtkSphere.html#details)Source samples the original volume data using a vtkProbeFilter. vtkClipDataSet uses the resulting scalar point data to clip the sphere surface with the isosurface value.

        Usage

        TissueLens FullHead.mhd

        Note

        The skin color was selected from Table 7 in Improvement of Haar Feature Based Face Detection in OpenCV Incorporating Human Skin Color Characteristic

        Info

        The example uses src/Testing/Data/FullHead.mhd which references src/Testing/Data/FullHead.raw.gz.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Medical/TissueLens/#code","title":"Code","text":"

        TissueLens.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkLookupTable,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkSphere\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkProbeFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkClipDataSet\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    colors.SetColor('SkinColor', [240, 184, 160, 255])\n    colors.SetColor('BackfaceColor', [255, 229, 200, 255])\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    # Read the volume data\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    # An isosurface, or contour value of 500 is known to correspond to the\n    # skin of the patient.\n    if use_flying_edges:\n        try:\n            skin_extractor = vtkFlyingEdges3D()\n        except AttributeError:\n            skin_extractor = vtkMarchingCubes()\n    else:\n        skin_extractor = vtkMarchingCubes()\n    skin_extractor.SetInputConnection(reader.GetOutputPort())\n    skin_extractor.SetValue(0, 500)\n\n    # Define a spherical clip function to clip the isosurface\n    clip_function = vtkSphere()\n    clip_function.SetRadius(50)\n    clip_function.SetCenter(73, 52, 15)\n\n    # Clip the isosurface with a sphere\n    skin_clip = vtkClipDataSet()\n    skin_clip.SetInputConnection(skin_extractor.GetOutputPort())\n    skin_clip.SetClipFunction(clip_function)\n    skin_clip.SetValue(0)\n    skin_clip.GenerateClipScalarsOn()\n    skin_clip.Update()\n\n    skin_mapper = vtkDataSetMapper()\n    skin_mapper.SetInputConnection(skin_clip.GetOutputPort())\n    skin_mapper.ScalarVisibilityOff()\n\n    skin = vtkActor()\n    skin.SetMapper(skin_mapper)\n    skin.GetProperty().SetDiffuseColor(colors.GetColor3d('SkinColor'))\n\n    back_prop = vtkProperty()\n    back_prop.SetDiffuseColor(colors.GetColor3d('BackfaceColor'))\n    skin.SetBackfaceProperty(back_prop)\n\n    # Define a model for the \"lens\". Its geometry matches the implicit\n    # sphere used to clip the isosurface\n    lens_model = vtkSphereSource()\n    lens_model.SetRadius(50)\n    lens_model.SetCenter(73, 52, 15)\n    lens_model.SetPhiResolution(201)\n    lens_model.SetThetaResolution(101)\n\n    # Sample the input volume with the lens model geometry\n    lens_probe = vtkProbeFilter()\n    lens_probe.SetInputConnection(lens_model.GetOutputPort())\n    lens_probe.SetSourceConnection(reader.GetOutputPort())\n\n    # Clip the lens data with the isosurface value\n    lens_clip = vtkClipDataSet()\n    lens_clip.SetInputConnection(lens_probe.GetOutputPort())\n    lens_clip.SetValue(500)\n    lens_clip.GenerateClipScalarsOff()\n    lens_clip.Update()\n\n    # Define a suitable grayscale lut\n    bw_lut = vtkLookupTable()\n    bw_lut.SetTableRange(0, 2048)\n    bw_lut.SetSaturationRange(0, 0)\n    bw_lut.SetHueRange(0, 0)\n    bw_lut.SetValueRange(0.2, 1)\n    bw_lut.Build()\n\n    lens_mapper = vtkDataSetMapper()\n    lens_mapper.SetInputConnection(lens_clip.GetOutputPort())\n    lens_mapper.SetScalarRange(lens_clip.GetOutput().GetScalarRange())\n    lens_mapper.SetLookupTable(bw_lut)\n\n    lens = vtkActor()\n    lens.SetMapper(lens_mapper)\n\n    # It is convenient to create an initial view of the data. The FocalPoint\n    # and Position form a vector direction. Later on (ResetCamera() method)\n    # this vector is used to position the camera to look at the data in\n    # this direction.\n    a_camera = vtkCamera()\n    a_camera.SetViewUp(0, 0, -1)\n    a_camera.SetPosition(0, -1, 0)\n    a_camera.SetFocalPoint(0, 0, 0)\n    a_camera.ComputeViewPlaneNormal()\n    a_camera.Azimuth(30.0)\n    a_camera.Elevation(30.0)\n\n    # Create the renderer, the render window, and the interactor. The renderer\n    # draws into the render window, the interactor enables mouse- and\n    # keyboard-based interaction with the data within the render window.\n    #\n    a_renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(a_renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Actors are added to the renderer. An initial camera view is created.\n    # The Dolly() method moves the camera towards the FocalPoint,\n    # thereby enlarging the image.\n    a_renderer.AddActor(lens)\n    a_renderer.AddActor(skin)\n    a_renderer.SetActiveCamera(a_camera)\n    a_renderer.ResetCamera()\n    a_camera.Dolly(1.5)\n\n    # Set a background color for the renderer and set the size of the\n    # render window (expressed in pixels).\n    a_renderer.SetBackground(colors.GetColor3d('BkgColor'))\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('TissueLens')\n\n    # Note that when camera movement occurs (as it does in the Dolly()\n    # method), the clipping planes often need adjusting. Clipping planes\n    # consist of two planes: near and far along the view direction. The\n    # near plane clips out objects in front of the plane the far plane\n    # clips out objects behind the plane. This way only what is drawn\n    # between the planes is actually rendered.\n    a_renderer.ResetCameraClippingRange()\n\n    # Initialize the event loop and then start it.\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The skin and bone is extracted from a CT dataset of the head and a \"tissue lens\" effect is applied.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Meshes/BoundaryEdges/","title":"BoundaryEdges","text":"

        vtk-examples/Python/Meshes/BoundaryEdges

        "},{"location":"Python/Meshes/BoundaryEdges/#description","title":"Description","text":"

        This filter will extract the boundary edges of a mesh. The original mesh is shown with the feature edges shown in red.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Meshes/BoundaryEdges/#code","title":"Code","text":"

        BoundaryEdges.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkFeatureEdges\nfrom vtkmodules.vtkFiltersSources import vtkDiskSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    diskSource = vtkDiskSource()\n    diskSource.Update()\n\n    featureEdges = vtkFeatureEdges()\n    featureEdges.SetInputConnection(diskSource.GetOutputPort())\n    featureEdges.BoundaryEdgesOn()\n    featureEdges.FeatureEdgesOff()\n    featureEdges.ManifoldEdgesOff()\n    featureEdges.NonManifoldEdgesOff()\n    featureEdges.ColoringOn()\n    featureEdges.Update()\n\n    # Visualize\n    edgeMapper = vtkPolyDataMapper()\n    edgeMapper.SetInputConnection(featureEdges.GetOutputPort())\n    edgeActor = vtkActor()\n    edgeActor.SetMapper(edgeMapper)\n\n    diskMapper = vtkPolyDataMapper()\n    diskMapper.SetInputConnection(diskSource.GetOutputPort())\n    diskActor = vtkActor()\n    diskActor.SetMapper(diskMapper)\n    diskActor.GetProperty().SetColor(colors.GetColor3d('Gray'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('BoundaryEdges')\n\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(edgeActor)\n    renderer.AddActor(diskActor)\n    renderer.SetBackground(colors.GetColor3d('DimGray'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Meshes/CapClip/","title":"CapClip","text":"

        vtk-examples/Python/Meshes/CapClip

        "},{"location":"Python/Meshes/CapClip/#description","title":"Description","text":"

        This example shows how to generate a \"cap\" on a clipped vtkPolyData. After clipping with vtkClipPolyData, it uses a clever ''trick'' to convert polylines into polygons. If a polydata file is provided, it will cap it. Otherwise it caps a clipped sphere.

        Warning

        The clipping is done with a scalar field provided by vtkPlane and results may depend on the resolution of the input vtkPolyData.

        Style

        This example collects all of the color definition in the beginning of the example. This makes it easier to make changes to the colors without having to search the code.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Meshes/CapClip/#code","title":"Code","text":"

        CapClip.py

        #!/usr/bin/env python\n\nimport os.path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkPlane,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkClipPolyData,\n    vtkFeatureEdges,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Clip polydata using a plane.'\n    epilogue = '''\n    This is an example using vtkClipPolyData to clip input polydata, if provided, or a sphere otherwise.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', nargs='?', default=None, help='Optional input filename e.g cow.g.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filePath = get_program_parameters()\n\n    # Define colors\n    colors = vtkNamedColors()\n    backgroundColor = colors.GetColor3d('steel_blue')\n    boundaryColor = colors.GetColor3d('Banana')\n    clipColor = colors.GetColor3d('Tomato')\n\n    if filePath and os.path.isfile(filePath):\n        polyData = ReadPolyData(filePath)\n        if not polyData:\n            polyData = GetSpherePD()\n    else:\n        polyData = GetSpherePD()\n\n    plane = vtkPlane()\n    plane.SetOrigin(polyData.GetCenter())\n    plane.SetNormal(1.0, -1.0, -1.0)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputData(polyData)\n    clipper.SetClipFunction(plane)\n    clipper.SetValue(0)\n    clipper.Update()\n\n    polyData = clipper.GetOutput()\n\n    clipMapper = vtkDataSetMapper()\n    clipMapper.SetInputData(polyData)\n\n    clipActor = vtkActor()\n    clipActor.SetMapper(clipMapper)\n    clipActor.GetProperty().SetDiffuseColor(clipColor)\n    clipActor.GetProperty().SetInterpolationToFlat()\n    clipActor.GetProperty().EdgeVisibilityOn()\n\n    # Now extract feature edges\n    boundaryEdges = vtkFeatureEdges()\n    boundaryEdges.SetInputData(polyData)\n    boundaryEdges.BoundaryEdgesOn()\n    boundaryEdges.FeatureEdgesOff()\n    boundaryEdges.NonManifoldEdgesOff()\n    boundaryEdges.ManifoldEdgesOff()\n\n    boundaryStrips = vtkStripper()\n    boundaryStrips.SetInputConnection(boundaryEdges.GetOutputPort())\n    boundaryStrips.Update()\n\n    # Change the polylines into polygons\n    boundaryPoly = vtkPolyData()\n    boundaryPoly.SetPoints(boundaryStrips.GetOutput().GetPoints())\n    boundaryPoly.SetPolys(boundaryStrips.GetOutput().GetLines())\n\n    boundaryMapper = vtkPolyDataMapper()\n    boundaryMapper.SetInputData(boundaryPoly)\n\n    boundaryActor = vtkActor()\n    boundaryActor.SetMapper(boundaryMapper)\n    boundaryActor.GetProperty().SetDiffuseColor(boundaryColor)\n\n    # create renderer render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # set background color and size\n    renderer.SetBackground(backgroundColor)\n    renderWindow.SetSize(640, 480)\n\n    # add our actor to the renderer\n    renderer.AddActor(clipActor)\n    renderer.AddActor(boundaryActor)\n\n    # Generate an interesting view\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.GetActiveCamera().Dolly(1.2)\n    renderer.ResetCameraClippingRange()\n\n    renderWindow.Render()\n    renderWindow.SetWindowName('CapClip')\n    renderWindow.Render()\n\n    interactor.Start()\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef GetSpherePD():\n    '''\n    :return: The PolyData representation of a sphere.\n    '''\n    source = vtkSphereSource()\n    source.SetThetaResolution(20)\n    source.SetPhiResolution(11)\n    source.Update()\n    return source.GetOutput()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Meshes/ClipDataSetWithPolyData/","title":"ClipDataSetWithPolyData","text":"

        vtk-examples/Python/Meshes/ClipDataSetWithPolyData

        "},{"location":"Python/Meshes/ClipDataSetWithPolyData/#description","title":"Description","text":"

        The example that shows how to use the vtkClipDataSet to clip a vtkRectilinearGrid with an arbitrary polydata. vtkImplicitPolyDataDistance is used to turn the polydata into an implicit function. Every point of the grid is evaluated before sending to vtkClipDataSet. This example uses a vtkConeSource to generate polydata to use, however any polydata could be used, including stl files.

        The left part of the image shows the inside clip and the distance field on a center slice. The right side shows the outside clip. When the program exits using the \"e: key, the example will report the cell type for both the inside and outside clips.

        Note

        vtkClipDataSet tetrahedralizes the volume before clipping. Contrast this with the vtkTableBasedClipDataSet example: TableBasedClipDataSetWithPolyData.

        Here is the summary reported when the example exits:

        The clipped dataset(inside) contains a vtkUnstructuredGrid that has 49514 cells Cell type vtkTetra occurs 41034 times. Cell type vtkWedge occurs 8480 times.

        The clipped dataset(outside) contains a vtkUnstructuredGrid that has 714434 cells Cell type vtkTetra occurs 705090 times. Cell type vtkWedge occurs 9344 times.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Meshes/ClipDataSetWithPolyData/#code","title":"Code","text":"

        ClipDataSetWithPolyData.py

        #!/usr/bin/env python\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellTypes,\n    vtkRectilinearGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkImplicitPolyDataDistance\nfrom vtkmodules.vtkFiltersGeneral import vtkClipDataSet\nfrom vtkmodules.vtkFiltersGeometry import vtkRectilinearGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create polydata to slice the grid with. In this case, use a cone. This\n    # could\n    # be any polydata including a stl file.\n    cone = vtkConeSource()\n    cone.SetResolution(50)\n    cone.SetDirection(0, 0, -1)\n    cone.SetHeight(3.0)\n    cone.CappingOn()\n    cone.Update()\n\n    # Implicit function that will be used to slice the mesh\n    implicitPolyDataDistance = vtkImplicitPolyDataDistance()\n    implicitPolyDataDistance.SetInput(cone.GetOutput())\n\n    # create a grid\n    dimension = 51\n    xCoords = vtkFloatArray()\n    for x, i in enumerate(np.linspace(-1.0, 1.0, dimension)):\n        xCoords.InsertNextValue(i)\n\n    yCoords = vtkFloatArray()\n    for y, i in enumerate(np.linspace(-1.0, 1.0, dimension)):\n        yCoords.InsertNextValue(i)\n\n    zCoords = vtkFloatArray()\n    for z, i in enumerate(np.linspace(-1.0, 1.0, dimension)):\n        zCoords.InsertNextValue(i)\n\n    # # create a grid - if not using numpy\n    # dimension = 51\n    # xCoords = vtkFloatArray()\n    # for i in range(0, dimension):\n    #     xCoords.InsertNextValue(-1.0 + i * 2.0 / (dimension - 1))\n    #\n    # yCoords = vtkFloatArray()\n    # for i in range(0, dimension):\n    #     yCoords.InsertNextValue(-1.0 + i * 2.0 / (dimension - 1))\n    #\n    # zCoords = vtkFloatArray()\n    # for i in range(0, dimension):\n    #     zCoords.InsertNextValue(-1.0 + i * 2.0 / (dimension - 1))\n\n    # The coordinates are assigned to the rectilinear grid. Make sure that\n    # the number of values in each of the XCoordinates, YCoordinates,\n    # and ZCoordinates is equal to what is defined in SetDimensions().\n    rgrid = vtkRectilinearGrid()\n    rgrid.SetDimensions(xCoords.GetNumberOfTuples(),\n                        yCoords.GetNumberOfTuples(),\n                        zCoords.GetNumberOfTuples())\n    rgrid.SetXCoordinates(xCoords)\n    rgrid.SetYCoordinates(yCoords)\n    rgrid.SetZCoordinates(zCoords)\n\n    # Create an array to hold distance information\n    signedDistances = vtkFloatArray()\n    signedDistances.SetNumberOfComponents(1)\n    signedDistances.SetName('SignedDistances')\n\n    # Evaluate the signed distance function at all of the grid points\n    for pointId in range(0, rgrid.GetNumberOfPoints()):\n        p = rgrid.GetPoint(pointId)\n        signedDistance = implicitPolyDataDistance.EvaluateFunction(p)\n        signedDistances.InsertNextValue(signedDistance)\n\n    # Add the SignedDistances to the grid\n    rgrid.GetPointData().SetScalars(signedDistances)\n\n    # Use vtkClipDataSet to slice the grid with the polydata\n    clipper = vtkClipDataSet()\n    clipper.SetInputData(rgrid)\n    clipper.InsideOutOn()\n    clipper.SetValue(0.0)\n    clipper.GenerateClippedOutputOn()\n    clipper.Update()\n\n    # --- mappers, actors, render, etc. ---\n    # mapper and actor to view the cone\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n\n    # geometry filter to view the background grid\n    geometryFilter = vtkRectilinearGridGeometryFilter()\n    geometryFilter.SetInputData(rgrid)\n    geometryFilter.SetExtent(0, dimension, 0, dimension, int(dimension / 2), int(dimension / 2))\n    geometryFilter.Update()\n\n    rgridMapper = vtkPolyDataMapper()\n    rgridMapper.SetInputConnection(geometryFilter.GetOutputPort())\n    rgridMapper.SetScalarRange(\n        rgrid.GetPointData().GetArray('SignedDistances').GetRange())\n\n    wireActor = vtkActor()\n    wireActor.SetMapper(rgridMapper)\n    wireActor.GetProperty().SetRepresentationToWireframe()\n\n    # mapper and actor to view the clipped mesh\n    clipperMapper = vtkDataSetMapper()\n    clipperMapper.SetInputConnection(clipper.GetOutputPort())\n    clipperMapper.ScalarVisibilityOff()\n\n    clipperOutsideMapper = vtkDataSetMapper()\n    clipperOutsideMapper.SetInputConnection(clipper.GetOutputPort(1))\n    clipperOutsideMapper.ScalarVisibilityOff()\n\n    clipperActor = vtkActor()\n    clipperActor.SetMapper(clipperMapper)\n    clipperActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n\n    clipperOutsideActor = vtkActor()\n    clipperOutsideActor.SetMapper(clipperOutsideMapper)\n    clipperOutsideActor.GetProperty().SetColor(\n        colors.GetColor3d('Banana'))\n\n    # A renderer and render window\n    # Create a renderer, render window, and interactor\n    leftViewport = [0.0, 0.0, 0.5, 1.0]\n    leftRenderer = vtkRenderer()\n    leftRenderer.SetViewport(leftViewport)\n    leftRenderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    rightViewport = [0.5, 0.0, 1.0, 1.0]\n    rightRenderer = vtkRenderer()\n    rightRenderer.SetViewport(rightViewport)\n    rightRenderer.SetBackground(colors.GetColor3d('CadetBlue'))\n\n    # add the actors\n    leftRenderer.AddActor(wireActor)\n    leftRenderer.AddActor(clipperActor)\n    rightRenderer.AddActor(clipperOutsideActor)\n\n    renwin = vtkRenderWindow()\n    renwin.SetSize(640, 480)\n    renwin.AddRenderer(leftRenderer)\n    renwin.AddRenderer(rightRenderer)\n    renwin.SetWindowName('ClipDataSetWithPolyData')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # Share the camera\n\n    leftRenderer.GetActiveCamera().SetPosition(0, -1, 0)\n    leftRenderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    leftRenderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    leftRenderer.GetActiveCamera().Azimuth(30)\n    leftRenderer.GetActiveCamera().Elevation(30)\n    leftRenderer.ResetCamera()\n    rightRenderer.SetActiveCamera(leftRenderer.GetActiveCamera())\n\n    renwin.Render()\n    interactor.Start()\n\n    # Generate a report\n    ct = vtkCellTypes()\n\n    numberOfCells = clipper.GetOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The clipped dataset(inside) contains a\\n', clipper.GetOutput().GetClassName(), 'that has', numberOfCells,\n          'cells')\n    cellMap = dict()\n    for i in range(0, numberOfCells):\n        cellMap[clipper.GetOutput().GetCellType(i)] = cellMap.get(clipper.GetOutput().GetCellType(i), 0) + 1\n\n    for k, v in cellMap.items():\n        print('\\tCell type ', ct.GetClassNameFromTypeId(k), 'occurs', v, 'times.')\n\n    numberOfCells = clipper.GetClippedOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The clipped dataset(outside) contains a\\n', clipper.GetClippedOutput().GetClassName(), 'that has',\n          numberOfCells, 'cells')\n    outsideCellMap = dict()\n    for i in range(0, numberOfCells):\n        outsideCellMap[clipper.GetClippedOutput().GetCellType(i)] = outsideCellMap.get(\n            clipper.GetClippedOutput().GetCellType(i), 0) + 1\n\n    for k, v in outsideCellMap.items():\n        print('\\tCell type ', ct.GetClassNameFromTypeId(k), 'occurs', v, 'times.')\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Meshes/ClipDataSetWithPolyData1/","title":"ClipDataSetWithPolyData1","text":"

        vtk-examples/Python/Meshes/ClipDataSetWithPolyData1

        "},{"location":"Python/Meshes/ClipDataSetWithPolyData1/#description","title":"Description","text":"

        An example that shows how to use the vtkClipDataSet to clip a vtkRectilinearGrid with an arbitrary polydata. vtkImplicitPolyDataDistance is used to turn the polydata into an implicit function. Every point of the grid is evaluated before sending to vtkClipDataSet. This example uses a vtkConeSource to generate polydata to use, however any polydata could be used, including stl files.

        Note

        This was the original code used to make the C++ example ClipDataSetWithPolyData

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Meshes/ClipDataSetWithPolyData1/#code","title":"Code","text":"

        ClipDataSetWithPolyData1.py

        #!/usr/bin/env python\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import vtkRectilinearGrid\nfrom vtkmodules.vtkFiltersCore import vtkImplicitPolyDataDistance\nfrom vtkmodules.vtkFiltersGeneral import vtkClipDataSet\nfrom vtkmodules.vtkFiltersGeometry import vtkRectilinearGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create polydata to slice the grid with. In this case, use a cone. This could\n    # be any polydata including a stl file.\n    cone = vtkConeSource()\n    cone.SetResolution(20)\n    cone.Update()\n\n    # implicit function that will be used to slice the mesh\n    implicitPolyDataDistance = vtkImplicitPolyDataDistance()\n    implicitPolyDataDistance.SetInput(cone.GetOutput())\n\n    # create a grid\n    xCoords = vtkFloatArray()\n    for x, i in enumerate(np.linspace(-1.0, 1.0, 15)):\n        xCoords.InsertNextValue(i)\n\n    yCoords = vtkFloatArray()\n    for y, i in enumerate(np.linspace(-1.0, 1.0, 15)):\n        yCoords.InsertNextValue(i)\n\n    zCoords = vtkFloatArray()\n    for z, i in enumerate(np.linspace(-1.0, 1.0, 15)):\n        zCoords.InsertNextValue(i)\n\n    # The coordinates are assigned to the rectilinear grid. Make sure that\n    # the number of values in each of the XCoordinates, YCoordinates,\n    # and ZCoordinates is equal to what is defined in SetDimensions().\n    rgrid = vtkRectilinearGrid()\n    rgrid.SetDimensions(x + 1, y + 1, z + 1)\n    rgrid.SetXCoordinates(xCoords)\n    rgrid.SetYCoordinates(yCoords)\n    rgrid.SetZCoordinates(zCoords)\n\n    # Create an array to hold distance information\n    signedDistances = vtkFloatArray()\n    signedDistances.SetNumberOfComponents(1)\n    signedDistances.SetName('SignedDistances')\n\n    # Evaluate the signed distance function at all of the grid points\n    for pointId in range(rgrid.GetNumberOfPoints()):\n        p = rgrid.GetPoint(pointId)\n        signedDistance = implicitPolyDataDistance.EvaluateFunction(p)\n        signedDistances.InsertNextValue(signedDistance)\n\n    # add the SignedDistances to the grid\n    rgrid.GetPointData().SetScalars(signedDistances)\n\n    # use vtkClipDataSet to slice the grid with the polydata\n    clipper = vtkClipDataSet()\n    clipper.SetInputData(rgrid)\n    clipper.InsideOutOn()\n    clipper.SetValue(0.0)\n    clipper.Update()\n\n    # --- mappers, actors, render, etc. ---\n    # mapper and actor to view the cone\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n\n    # geometry filter to view the background grid\n    geometryFilter = vtkRectilinearGridGeometryFilter()\n    geometryFilter.SetInputData(rgrid)\n    geometryFilter.SetExtent(0, x + 1, 0, y + 1, (z + 1) // 2, (z + 1) // 2)\n    geometryFilter.Update()\n\n    rgridMapper = vtkPolyDataMapper()\n    rgridMapper.SetInputConnection(geometryFilter.GetOutputPort())\n\n    wireActor = vtkActor()\n    wireActor.SetMapper(rgridMapper)\n    wireActor.GetProperty().SetRepresentationToWireframe()\n    wireActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # mapper and actor to view the clipped mesh\n    clipperMapper = vtkDataSetMapper()\n    clipperMapper.SetInputConnection(clipper.GetOutputPort())\n\n    clipperActor = vtkActor()\n    clipperActor.SetMapper(clipperMapper)\n    clipperActor.GetProperty().SetRepresentationToWireframe()\n    clipperActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Snow'))\n\n    # add the actors\n    # renderer.AddActor(coneActor)\n    renderer.AddActor(wireActor)\n    renderer.AddActor(clipperActor)\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('ClipDataSetWithPolyData')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    renderer.GetActiveCamera().SetPosition(0, -1, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCamera()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Meshes/ColoredElevationMap/","title":"ColoredElevationMap","text":"

        vtk-examples/Python/Meshes/ColoredElevationMap

        "},{"location":"Python/Meshes/ColoredElevationMap/#description","title":"Description","text":"

        This example creates a elevation map with different color based on height.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Meshes/ColoredElevationMap/#code","title":"Code","text":"

        ColoredElevationMap.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkMinimalStandardRandomSequence,\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkDelaunay2D\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    named_colors = vtkNamedColors()\n\n    # Create a grid points\n    points = vtkPoints()\n    GridSize = 20;\n    xx = 0.0\n    yy = 0.0\n    zz = 0.0\n    rng = vtkMinimalStandardRandomSequence()\n    rng.SetSeed(8775586)  # For testing.\n    for x in range(0, GridSize):\n        for y in range(0, GridSize):\n            rng.Next()\n            xx = x + rng.GetRangeValue(-0.2, 0.2)\n            rng.Next()\n            yy = y + rng.GetRangeValue(-0.2, 0.2)\n            rng.Next()\n            zz = rng.GetRangeValue(-0.5, 0.5)\n            points.InsertNextPoint(xx, yy, zz)\n\n    # Add the grid points to a polydata object\n    inputPolyData = vtkPolyData()\n    inputPolyData.SetPoints(points)\n\n    # Triangulate the grid points\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(inputPolyData)\n    delaunay.Update()\n    outputPolyData = delaunay.GetOutput()\n\n    bounds = 6 * [0.0]\n    outputPolyData.GetBounds(bounds)\n\n    # Find min and max z\n    minz = bounds[4]\n    maxz = bounds[5]\n\n    print('minz: {:< 6.3}'.format(minz))\n    print('maxz: {:< 6.3}'.format(maxz))\n\n    # Create the color map\n    colorLookupTable = vtkLookupTable()\n    colorLookupTable.SetTableRange(minz, maxz)\n    colorLookupTable.Build()\n\n    # Generate the colors for each point based on the color map\n    colors = vtkUnsignedCharArray()\n    colors.SetNumberOfComponents(3)\n    colors.SetName('Colors')\n\n    print('There are ' + str(outputPolyData.GetNumberOfPoints()) + ' points.')\n\n    for i in range(0, outputPolyData.GetNumberOfPoints()):\n        p = 3 * [0.0]\n        outputPolyData.GetPoint(i, p)\n\n        dcolor = 3 * [0.0]\n        colorLookupTable.GetColor(p[2], dcolor);\n        # print( 'dcolor: {:<8.6} {:<8.6} {:<8.6}'.format(*dcolor))\n        color = 3 * [0.0]\n        for j in range(0, 3):\n            color[j] = int(255.0 * dcolor[j])\n        # print('color:  {:<8} {:<8} {:<8}'.format(*color))\n\n        try:\n            colors.InsertNextTupleValue(color)\n        except AttributeError:\n            # For compatibility with new VTK generic data arrays.\n            colors.InsertNextTypedTuple(color)\n\n    outputPolyData.GetPointData().SetScalars(colors)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(outputPolyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('ColoredElevationMap')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(named_colors.GetColor3d('DarkSlateGray'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Meshes/Decimation/","title":"Decimation","text":"

        vtk-examples/Python/Meshes/Decimation

        "},{"location":"Python/Meshes/Decimation/#description","title":"Description","text":"

        This example decimates a mesh using progressive decimation. The SetTargetReduction function specifies how many triangles should reduced by specifying the percentage (0,1) of triangles to be removed. For example, if the mesh contains 100 triangles and SetTargetReduction(.90) is called, after the decimation there will be approximately 10 triangles - a 90% reduction.

        The implementation of vtkDecimatePro is similar to the algorithm originally described in \"Decimation of Triangle Meshes\", Proc Siggraph `92, with three major differences. First, this algorithm does not necessarily preserve the topology of the mesh. Second, it is guaranteed to give the a mesh reduction factor specified by the user (as long as certain constraints are not set - see Caveats). Third, it is set up generate progressive meshes, that is a stream of operations that can be easily transmitted and incrementally updated (see Hugues Hoppe's Siggraph '96 paper on progressive meshes).

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Meshes/Decimation/#code","title":"Code","text":"

        Decimation.py

        #!/usr/bin/env python\n\nimport os.path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDecimatePro,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Decimate polydata.'\n    epilogue = '''\n    This is an example using vtkDecimatePro to decimate input polydata, if provided, or a sphere otherwise.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', nargs='?', default=None, help='Optional input filename e.g Torso.vtp.')\n    parser.add_argument('reduction', nargs='?', type=float, default=.9,\n                        help='Sets the decimation target reduction, (default is 0.9).')\n    args = parser.parse_args()\n    return args.filename, args.reduction\n\n\ndef main():\n    filePath, reduction = get_program_parameters()\n\n    # Define colors\n    colors = vtkNamedColors()\n    backFaceColor = colors.GetColor3d('Gold')\n    inputActorColor = colors.GetColor3d('NavajoWhite')\n    decimatedActorColor = colors.GetColor3d('NavajoWhite')\n    # colors.SetColor('leftBkg', [0.6, 0.5, 0.4, 1.0])\n    # colors.SetColor('rightBkg', [0.4, 0.5, 0.6, 1.0])\n\n    if filePath and os.path.isfile(filePath):\n        readerPD = ReadPolyData(filePath)\n        if not readerPD:\n            inputPolyData = GetSpherePD()\n        else:\n            triangles = vtkTriangleFilter()\n            triangles.SetInputData(readerPD)\n            triangles.Update()\n            inputPolyData = triangles.GetOutput()\n    else:\n        inputPolyData = GetSpherePD()\n\n    print('Before decimation')\n    print(f'There are {inputPolyData.GetNumberOfPoints()} points.')\n    print(f'There are {inputPolyData.GetNumberOfPolys()} polygons.')\n\n    decimate = vtkDecimatePro()\n    decimate.SetInputData(inputPolyData)\n    decimate.SetTargetReduction(reduction)\n    decimate.PreserveTopologyOn()\n    decimate.Update()\n\n    decimated = vtkPolyData()\n    decimated.ShallowCopy(decimate.GetOutput())\n\n    print('After decimation')\n    print(f'There are {decimated.GetNumberOfPoints()} points.')\n    print(f'There are {decimated.GetNumberOfPolys()} polygons.')\n    print(\n        f'Reduction: {(inputPolyData.GetNumberOfPolys() - decimated.GetNumberOfPolys()) / inputPolyData.GetNumberOfPolys()}')\n\n    inputMapper = vtkPolyDataMapper()\n    inputMapper.SetInputData(inputPolyData)\n\n    backFace = vtkProperty()\n    backFace.SetColor(backFaceColor)\n\n    inputActor = vtkActor()\n    inputActor.SetMapper(inputMapper)\n    inputActor.GetProperty().SetInterpolationToFlat()\n    inputActor.GetProperty().SetColor(inputActorColor)\n    inputActor.SetBackfaceProperty(backFace)\n\n    decimatedMapper = vtkPolyDataMapper()\n    decimatedMapper.SetInputData(decimated)\n\n    decimatedActor = vtkActor()\n    decimatedActor.SetMapper(decimatedMapper)\n    decimatedActor.GetProperty().SetColor(decimatedActorColor)\n    decimatedActor.GetProperty().SetInterpolationToFlat()\n    decimatedActor.SetBackfaceProperty(backFace)\n\n    # There will be one render window\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(600, 300)\n    renderWindow.SetWindowName('Decimation');\n\n    # And one interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Define viewport ranges\n    # (xmin, ymin, xmax, ymax)\n    leftViewport = [0.0, 0.0, 0.5, 1.0]\n    rightViewport = [0.5, 0.0, 1.0, 1.0]\n\n    # Setup both renderers\n    leftRenderer = vtkRenderer()\n    renderWindow.AddRenderer(leftRenderer)\n    leftRenderer.SetViewport(leftViewport)\n    # leftRenderer.SetBackground((colors.GetColor3d('leftBkg')))\n    leftRenderer.SetBackground((colors.GetColor3d('Peru')))\n\n    rightRenderer = vtkRenderer()\n    renderWindow.AddRenderer(rightRenderer)\n    rightRenderer.SetViewport(rightViewport)\n    # rightRenderer.SetBackground((colors.GetColor3d('rightBkg')))\n    rightRenderer.SetBackground((colors.GetColor3d('CornflowerBlue')))\n\n    # Add the sphere to the left and the cube to the right\n    leftRenderer.AddActor(inputActor)\n    rightRenderer.AddActor(decimatedActor)\n\n    # Shared camera\n    # Shared camera looking down the -y axis\n    camera = vtkCamera()\n    camera.SetPosition(0, -1, 0)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetViewUp(0, 0, 1)\n    camera.Elevation(30)\n    camera.Azimuth(30)\n\n    leftRenderer.SetActiveCamera(camera)\n    rightRenderer.SetActiveCamera(camera)\n\n    leftRenderer.ResetCamera()\n    leftRenderer.ResetCameraClippingRange()\n\n    renderWindow.Render()\n    renderWindow.SetWindowName('Decimation')\n\n    interactor.Start()\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef GetSpherePD():\n    '''\n    :return: The PolyData representation of a sphere.\n    '''\n    source = vtkSphereSource()\n    source.SetThetaResolution(30)\n    source.SetPhiResolution(15)\n    source.Update()\n    return source.GetOutput()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Meshes/DeformPointSet/","title":"DeformPointSet","text":"

        vtk-examples/Python/Meshes/DeformPointSet

        "},{"location":"Python/Meshes/DeformPointSet/#description","title":"Description","text":"

        An example that shows how to use the vtkDeformPointSet filter to deform a sphere with arbitrary polydata. This example uses a vtkSphereSource to generate polydata to use, however any polydata could be used, including stl files.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Meshes/DeformPointSet/#code","title":"Code","text":"

        DeformPointSet.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkDeformPointSet\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    # colors.SetColor('bkg', [0.2, 0.3, 0.4, 1.0])\n\n    # Create a sphere to deform\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(51)\n    sphere.SetPhiResolution(17)\n    sphere.Update()\n    bounds = sphere.GetOutput().GetBounds()\n\n    # Create a filter to color the sphere\n    ele = vtkElevationFilter()\n    ele.SetInputConnection(sphere.GetOutputPort())\n    ele.SetLowPoint(0, 0, -0.5);\n    ele.SetHighPoint(0, 0, 0.5);\n    ele.SetLowPoint((bounds[1] + bounds[0]) / 2.0,\n                    (bounds[3] + bounds[2]) / 2.0,\n                    -bounds[5]);\n    ele.SetHighPoint((bounds[1] + bounds[0]) / 2.0,\n                     (bounds[3] + bounds[2]) / 2.0,\n                     bounds[5]);\n    ele.Update()\n\n    # Create a mesh to deform the sphere\n    pts = vtkPoints()\n    pts.SetNumberOfPoints(6)\n    pts.SetPoint(0,\n                 bounds[0] - 0.1 * (bounds[1] - bounds[0]),\n                 (bounds[3] + bounds[2]) / 2.0,\n                 (bounds[5] + bounds[4]) / 2.0)\n    pts.SetPoint(1,\n                 bounds[1] + 0.1 * (bounds[1] - bounds[0]),\n                 (bounds[3] + bounds[2]) / 2.0,\n                 (bounds[5] + bounds[4]) / 2.0)\n    pts.SetPoint(2,\n                 (bounds[1] + bounds[0]) / 2.0,\n                 bounds[2] - 0.1 * (bounds[3] - bounds[2]),\n                 (bounds[5] + bounds[4]) / 2.0)\n    pts.SetPoint(3,\n                 (bounds[1] + bounds[0]) / 2.0,\n                 bounds[3] + 0.1 * (bounds[3] - bounds[2]),\n                 (bounds[5] + bounds[4]) / 2.0)\n    pts.SetPoint(4,\n                 (bounds[1] + bounds[0]) / 2.0,\n                 (bounds[3] + bounds[2]) / 2.0,\n                 bounds[4] - 0.1 * (bounds[5] - bounds[4]))\n    pts.SetPoint(5,\n                 (bounds[1] + bounds[0]) / 2.0,\n                 (bounds[3] + bounds[2]) / 2.0,\n                 bounds[5] + 0.1 * (bounds[5] - bounds[4]))\n    tris = vtkCellArray()\n\n    cells = [[2, 0, 4], [1, 2, 4], [3, 1, 4], [0, 3, 4], [0, 2, 5], [2, 1, 5], [1, 3, 5], [3, 0, 5]]\n\n    for cell in cells:\n        tris.InsertNextCell(3)\n        for c in cell:\n            tris.InsertCellPoint(c)\n\n    pd = vtkPolyData()\n    pd.SetPoints(pts)\n    pd.SetPolys(tris)\n\n    meshMapper = vtkPolyDataMapper()\n    meshMapper.SetInputData(pd)\n    meshActor = vtkActor()\n    meshActor.SetMapper(meshMapper)\n    meshActor.GetProperty().SetRepresentationToWireframe()\n    meshActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    deform = vtkDeformPointSet()\n    deform.SetInputData(ele.GetOutput())\n    deform.SetControlMeshData(pd)\n    deform.Update()\n\n    controlPoint = pts.GetPoint(5)\n    pts.SetPoint(5, controlPoint[0],\n                 controlPoint[1],\n                 bounds[5] + .8 * (bounds[5] - bounds[4]))\n    pts.Modified()\n\n    polyMapper = vtkPolyDataMapper()\n    polyMapper.SetInputConnection(deform.GetOutputPort())\n    polyActor = vtkActor()\n    polyActor.SetMapper(polyMapper)\n\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    renderer.AddActor(polyActor)\n    renderer.AddActor(meshActor)\n\n    renderer.GetActiveCamera().SetPosition(1, 1, 1)\n    renderer.ResetCamera()\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('DeformPointSet')\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Meshes/PointInterpolator/","title":"PointInterpolator","text":"

        vtk-examples/Python/Meshes/PointInterpolator

        "},{"location":"Python/Meshes/PointInterpolator/#description","title":"Description","text":"

        This example uses vtkPointInterpolator with a Gaussian Kernel (or other kernel) to interpolate and extrapolate more smoothly the fields inside and outside the probed area.

        Info

        This C++ code is translated from the python code that Kenichiro Yoshimi wrote to respond to Hosam. See the discourse discussion.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Meshes/PointInterpolator/#code","title":"Code","text":"

        PointInterpolator.py

        #!/usr/bin/env python\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkFiltersCore import vtkResampleWithDataSet\nfrom vtkmodules.vtkFiltersGeneral import vtkTableToPolyData\nfrom vtkmodules.vtkFiltersPoints import (\n    vtkGaussianKernel,\n    vtkPointInterpolator\n)\nfrom vtkmodules.vtkIOGeometry import vtkSTLReader\nfrom vtkmodules.vtkIOInfovis import vtkDelimitedTextReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPointGaussianMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Plot the scalar field of points onto a PolyData surface.'\n    epilogue = '''\nThis example uses vtkPointInterpolator with a Gaussian Kernel (or other kernel)\n to interpolate and extrapolate more smoothly the fields inside and outside the probed area.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('points_fn', help='sparsePoints.txt.')\n    parser.add_argument('probe_fn', help='InterpolatingOnSTL_final.stl.')\n\n    args = parser.parse_args()\n    return args.points_fn, args.probe_fn\n\n\ndef main():\n    points_fn, probe_fn = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    points_reader = vtkDelimitedTextReader()\n    points_reader.SetFileName(points_fn)\n    points_reader.DetectNumericColumnsOn()\n    points_reader.SetFieldDelimiterCharacters('\\t')\n    points_reader.SetHaveHeaders(True)\n\n    table_points = vtkTableToPolyData()\n    table_points.SetInputConnection(points_reader.GetOutputPort())\n    table_points.SetXColumn('x')\n    table_points.SetYColumn('y')\n    table_points.SetZColumn('z')\n    table_points.Update()\n\n    points = table_points.GetOutput()\n    points.GetPointData().SetActiveScalars('val')\n    range = points.GetPointData().GetScalars().GetRange()\n\n    # Read a probe surface\n    stl_reader = vtkSTLReader()\n    stl_reader.SetFileName(probe_fn)\n    stl_reader.Update()\n\n    surface = stl_reader.GetOutput()\n    bounds = np.array(surface.GetBounds())\n\n    dims = np.array([101, 101, 101])\n    box = vtkImageData()\n    box.SetDimensions(dims)\n    box.SetSpacing((bounds[1::2] - bounds[:-1:2]) / (dims - 1))\n    box.SetOrigin(bounds[::2])\n\n    # Gaussian kernel\n    gaussian_kernel = vtkGaussianKernel()\n    gaussian_kernel.SetSharpness(2)\n    gaussian_kernel.SetRadius(12)\n\n    interpolator = vtkPointInterpolator()\n    interpolator.SetInputData(box)\n    interpolator.SetSourceData(points)\n    interpolator.SetKernel(gaussian_kernel)\n\n    resample = vtkResampleWithDataSet()\n    resample.SetInputData(surface)\n    resample.SetSourceConnection(interpolator.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(resample.GetOutputPort())\n    mapper.SetScalarRange(range)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    point_mapper = vtkPointGaussianMapper()\n    point_mapper.SetInputData(points)\n    point_mapper.SetScalarRange(range)\n    point_mapper.SetScaleFactor(0.6)\n    point_mapper.EmissiveOff();\n    point_mapper.SetSplatShaderCode(\n        \"//VTK::Color::Impl\\n\"\n        \"float dist = dot(offsetVCVSOutput.xy,offsetVCVSOutput.xy);\\n\"\n        \"if (dist > 1.0) {\\n\"\n        \"  discard;\\n\"\n        \"} else {\\n\"\n        \"  float scale = (1.0 - dist);\\n\"\n        \"  ambientColor *= scale;\\n\"\n        \"  diffuseColor *= scale;\\n\"\n        \"}\\n\"\n    )\n\n    point_actor = vtkActor()\n    point_actor.SetMapper(point_mapper)\n\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(point_actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('PointInterpolator')\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(-45)\n\n    iren.Initialize()\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Meshes/SolidClip/","title":"SolidClip","text":"

        vtk-examples/Python/Meshes/SolidClip

        "},{"location":"Python/Meshes/SolidClip/#description","title":"Description","text":"

        This example clips a mesh and applies a backface property to that mesh so that it appears to have a solid interior.

        The \"ghost\" of the part clipped away is also shown.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Meshes/SolidClip/#code","title":"Code","text":"

        SolidClip.py

        # !/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import vtkClipPolyData\nfrom vtkmodules.vtkFiltersSources import vtkSuperquadricSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Create a superquadric\n    superquadric_source = vtkSuperquadricSource()\n    superquadric_source.SetPhiRoundness(3.1)\n    superquadric_source.SetThetaRoundness(2.2)\n\n    # Define a clipping plane\n    clip_plane = vtkPlane()\n    clip_plane.SetNormal(1.0, -1.0, -1.0)\n    clip_plane.SetOrigin(0.0, 0.0, 0.0)\n\n    # Clip the source with the plane\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(superquadric_source.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    # This will give us the polygonal data that is clipped away\n    clipper.GenerateClippedOutputOn()\n\n    # Create a mapper and actor\n    superquadric_mapper = vtkPolyDataMapper()\n    superquadric_mapper.SetInputConnection(clipper.GetOutputPort())\n\n    superquadric_actor = vtkActor()\n    superquadric_actor.SetMapper(superquadric_mapper)\n\n    colors = vtkNamedColors()\n\n    # Create a property to be used for the back faces. Turn off all\n    # shading by specifying 0 weights for specular and diffuse. Max the\n    # ambient.\n    back_faces = vtkProperty()\n    back_faces.SetSpecular(0.0)\n    back_faces.SetDiffuse(0.0)\n    back_faces.SetAmbient(1.0)\n    back_faces.SetAmbientColor(colors.GetColor3d('Tomato'))\n\n    superquadric_actor.SetBackfaceProperty(back_faces)\n\n    # Here we get the the polygonal data that is clipped away\n    clipped_away_mapper = vtkPolyDataMapper()\n    clipped_away_mapper.SetInputData(clipper.GetClippedOutput())\n    clipped_away_mapper.ScalarVisibilityOff()\n\n    # Let us display it as a faint object\n    clipped_away_actor = vtkActor()\n    clipped_away_actor.SetMapper(clipped_away_mapper)\n    clipped_away_actor.GetProperty().SetDiffuseColor(colors.GetColor3d(\"Silver\"))\n    clipped_away_actor.GetProperty().SetOpacity(0.1)\n\n    # Create a renderer\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    render_window = vtkRenderWindow()\n\n    render_window.AddRenderer(renderer)\n\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    # Add the actor to the renderer\n    renderer.AddActor(superquadric_actor)\n    renderer.AddActor(clipped_away_actor)\n    render_window.SetSize(600, 600)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Dolly(1.5)\n    renderer.ResetCameraClippingRange()\n    render_window.Render()\n    render_window.SetWindowName('SolidClip')\n\n    # Interact with the window\n    render_window_interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/Bottle/","title":"Bottle","text":"

        vtk-examples/Python/Modelling/Bottle

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/Bottle/#code","title":"Code","text":"

        Bottle.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkStripper,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkRotationalExtrusionFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the bottle profile.\n    #\n    points = vtkPoints()\n    points.InsertPoint(0, 0.01, 0.0, 0.0)\n    points.InsertPoint(1, 1.5, 0.0, 0.0)\n    points.InsertPoint(2, 1.5, 0.0, 3.5)\n    points.InsertPoint(3, 1.25, 0.0, 3.75)\n    points.InsertPoint(4, 0.75, 0.0, 4.00)\n    points.InsertPoint(5, 0.6, 0.0, 4.35)\n    points.InsertPoint(6, 0.7, 0.0, 4.65)\n    points.InsertPoint(7, 1.0, 0.0, 4.75)\n    points.InsertPoint(8, 1.0, 0.0, 5.0)\n    points.InsertPoint(9, 0.2, 0.0, 5.0)\n\n    lines = vtkCellArray()\n    lines.InsertNextCell(10)  # The number of points.\n    lines.InsertCellPoint(0)\n    lines.InsertCellPoint(1)\n    lines.InsertCellPoint(2)\n    lines.InsertCellPoint(3)\n    lines.InsertCellPoint(4)\n    lines.InsertCellPoint(5)\n    lines.InsertCellPoint(6)\n    lines.InsertCellPoint(7)\n    lines.InsertCellPoint(8)\n    lines.InsertCellPoint(9)\n\n    profile = vtkPolyData()\n    profile.SetPoints(points)\n    profile.SetLines(lines)\n\n    # Extrude the profile to make the bottle.\n    #\n    extrude = vtkRotationalExtrusionFilter()\n    extrude.SetInputData(profile)\n    extrude.SetResolution(60)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(extrude.GetOutputPort())\n\n    bottle = vtkActor()\n    bottle.SetMapper(mapper)\n    bottle.GetProperty().SetColor(colors.GetColor3d('Mint'))\n\n    # Sisplay the profile.\n    stripper = vtkStripper()\n    stripper.SetInputData(profile)\n\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(stripper.GetOutputPort())\n    tubes.SetNumberOfSides(11)\n    tubes.SetRadius(0.05)\n\n    profileMapper = vtkPolyDataMapper()\n    profileMapper.SetInputConnection(tubes.GetOutputPort())\n\n    profileActor = vtkActor()\n    profileActor.SetMapper(profileMapper)\n    profileActor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    renderer.AddActor(bottle)\n    renderer.AddActor(profileActor)\n    renderer.SetBackground(colors.GetColor3d('Burlywood'))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('Bottle');\n    renWin.Render()\n\n    renderer.GetActiveCamera().SetPosition(1, 0, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/CappedSphere/","title":"CappedSphere","text":"

        vtk-examples/Python/Modelling/CappedSphere

        "},{"location":"Python/Modelling/CappedSphere/#description","title":"Description","text":"

        Demonstrates how to create a capped sphere.

        Firstly a line is created in the x-z plane corresponding to an arc from +z to -z in the +x direction in the x-z plane, the length of the arc is specified in degrees.

        Then the line is extended by dropping a perpendicular to the x-axis.

        The points generated are then converted to a line and passed through to the vtkRotationalExtrusionFilter to generate the resultant 3D surface.

        The parameters are:

        • angle - the arc length in degrees default 90\u00b0 (a hemisphere)
        • step -the step size of the arc in degrees, default 1\u00b0
        • radius - the radius of the arc default 1

        Options are provided to:

        • Uncap the sphere (-u, --uncapped)
        • Display the line that was rotationally extruded (-s, --show_line)

        Note

        The coordinate system for specifying the arc is left-handed with 0\u00b0 aligned with the positive z-axis, 90\u00b0 aligned with the positive x-axis.

        Note

        You can substitute different parametric equations for x and z in the line generating function to get other shapes.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/CappedSphere/#code","title":"Code","text":"

        CappedSphere.py

        #!/usr/bin/env python\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersModeling import vtkRotationalExtrusionFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Display a capped sphere.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('angle', default=90, type=float, nargs='?',\n                        help='The length of the arc in degrees from +z to -z in the +x direction in the x-z plane.')\n    parser.add_argument('step', default=1, type=float, nargs='?', help='Step size in degrees.')\n    parser.add_argument('radius', default=1, type=float, nargs='?', help='Radius of the arc.')\n    parser.add_argument('-u', '--uncapped', action='store_true', help='Uncap the sphere.')\n    parser.add_argument('-s', '--show_line', action='store_true',\n                        help='Show the line that is rotationally extruded to make the surface.')\n    args = parser.parse_args()\n    return args.angle, args.step, args.radius, args.uncapped, args.show_line\n\n\ndef main():\n    angle, step, radius, uncapped, show_line = get_program_parameters()\n    angle = math.radians(abs(angle))\n    step = math.radians(abs(step))\n    radius = abs(radius)\n    # With default settings set this to 45 and you get a bowl with a flat bottom.\n    start = math.radians(90)\n\n    pts = get_line(angle, step, radius, uncapped, start)\n\n    # Setup points and lines\n    points = vtkPoints()\n    lines = vtkCellArray()\n    for pt in pts:\n        pt_id = points.InsertNextPoint(pt)\n        if pt_id < len(pts) - 1:\n            line = vtkLine()\n            line.GetPointIds().SetId(0, pt_id)\n            line.GetPointIds().SetId(1, pt_id + 1)\n            lines.InsertNextCell(line)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n    polydata.SetLines(lines)\n\n    # Extrude the profile to make the capped sphere\n    extrude = vtkRotationalExtrusionFilter()\n    extrude.SetInputData(polydata)\n    extrude.SetResolution(60)\n\n    #  Visualize\n    colors = vtkNamedColors()\n\n    # To see the line\n    lineMapper = vtkPolyDataMapper()\n    lineMapper.SetInputData(polydata)\n\n    lineActor = vtkActor()\n    lineActor.SetMapper(lineMapper)\n    lineActor.GetProperty().SetLineWidth(4)\n    lineActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    # To see the surface\n    surfaceMapper = vtkPolyDataMapper()\n    surfaceMapper.SetInputConnection(extrude.GetOutputPort())\n\n    surfaceActor = vtkActor()\n    surfaceActor.SetMapper(surfaceMapper)\n    surfaceActor.GetProperty().SetColor(colors.GetColor3d('Khaki'))\n\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    ren.AddActor(surfaceActor)\n    if show_line:\n        ren.AddActor(lineActor)\n    ren.SetBackground(colors.GetColor3d('LightSlateGray'))\n\n    ren.ResetCamera()\n    ren.GetActiveCamera().Azimuth(0)\n    ren.GetActiveCamera().Elevation(60)\n    ren.ResetCameraClippingRange()\n\n    renWin.SetSize(600, 600)\n    renWin.Render()\n    renWin.SetWindowName('CappedSphere')\n    iren.Start()\n\n\ndef get_line(angle, step, radius, uncapped, start):\n    '''\n    Get the points for a line.\n\n    :param angle: Length of the arc in degrees.\n    :param step: Step size in degrees.\n    :param radius: Radius of the arc.\n    :param uncapped: True if uncapped.\n    :param start: Starting angle.\n    :return: A vector of points.\n    '''\n    precision = 1.0e-6\n    pts = list()\n    # Do the curved line\n    theta = 0.0\n    while theta <= angle:\n        x = radius * math.cos(start - theta)\n        z = radius * math.sin(theta - start)\n        if x < 0:\n            x = 0\n            pts.append((x, 0, z))\n            break\n        if abs(x) < precision:\n            x = 0\n        if abs(z) < precision:\n            z = 0\n        pts.append((x, 0, z))\n        theta += step\n\n    if not uncapped:\n        # Drop a perpendicular from the last point to the x-axis\n        if len(pts) > 1:\n            if pts[-1][0] > 0:\n                last_point = pts[-1]\n                num_pts = 10\n                interval = float(num_pts) / radius\n                for i in range(1, num_pts):\n                    x = last_point[0] - i / interval\n                    z = last_point[2]\n                    if x < 0:\n                        x = 0\n                        pts.append((x, 0, z))\n                        break\n                    if abs(x) < precision:\n                        x = 0\n                    if abs(z) < precision:\n                        z = 0\n                    pts.append((x, 0, z))\n            if pts[-1][0] > precision:\n                pts.append((0, 0, pts[-1][2]))\n    return pts\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/ContourTriangulator/","title":"ContourTriangulator","text":"

        vtk-examples/Python/Modelling/ContourTriangulator

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/ContourTriangulator/#code","title":"Code","text":"

        ContourTriangulator.py

        #!/usr/bin/env python3\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkMarchingSquares\nfrom vtkmodules.vtkFiltersGeneral import vtkContourTriangulator\nfrom vtkmodules.vtkIOImage import vtkPNGReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Create a contour from a structured point set (image) and triangulate it.'\n    epilogue = '''\n    Try with different iso values e.g. -i1000.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('file_name', help='The path to the image file to use e.g fullhead15.png.')\n    parser.add_argument('-i', '--iso_value', help='The contour value for generating the isoline.', default=500,\n                        type=int)\n    args = parser.parse_args()\n    return args.file_name, args.iso_value\n\n\ndef main():\n    file_name, iso_value = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    reader = vtkPNGReader()\n    if not reader.CanReadFile(file_name):\n        print('Error: Could not read', file_name)\n        return\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    iso = vtkMarchingSquares()\n    iso.SetInputConnection(reader.GetOutputPort())\n    iso.SetValue(0, iso_value)\n\n    iso_mapper = vtkDataSetMapper()\n    iso_mapper.SetInputConnection(iso.GetOutputPort())\n    iso_mapper.ScalarVisibilityOff()\n\n    iso_actor = vtkActor()\n    iso_actor.SetMapper(iso_mapper)\n    iso_actor.GetProperty().SetColor(\n        colors.GetColor3d('MediumOrchid'))\n\n    poly = vtkContourTriangulator()\n    poly.SetInputConnection(iso.GetOutputPort())\n\n    poly_mapper = vtkDataSetMapper()\n    poly_mapper.SetInputConnection(poly.GetOutputPort())\n    poly_mapper.ScalarVisibilityOff()\n\n    poly_actor = vtkActor()\n    poly_actor.SetMapper(poly_mapper)\n    poly_actor.GetProperty().SetColor(colors.GetColor3d('Gray'))\n\n    # Standard rendering classes.\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.SetMultiSamples(0)\n    ren_win.AddRenderer(renderer)\n    ren_win.SetWindowName('ContourTriangulator')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    renderer.AddActor(poly_actor)\n    renderer.AddActor(iso_actor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    ren_win.SetSize(300, 300)\n\n    camera = renderer.GetActiveCamera()\n    renderer.ResetCamera()\n    camera.Azimuth(180)\n\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/DelaunayMesh/","title":"DelaunayMesh","text":"

        vtk-examples/Python/Modelling/DelaunayMesh

        "},{"location":"Python/Modelling/DelaunayMesh/#description","title":"Description","text":"

        This is two dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with spheres and tubes.

        Info

        See Figure 9-54 in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/DelaunayMesh/#code","title":"Code","text":"

        DelaunayMesh.py

        #!/usr/bin/env python\n\n\"\"\"\nThis code is based on the VTK file: Examples/Modelling/Tcl/DelMesh.py.\n\nThis example demonstrates how to use 2D Delaunay triangulation.\nWe create a fancy image of a 2D Delaunay triangulation. Points are\n randomly generated.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDelaunay2D,\n    vtkGlyph3D,\n    vtkTubeFilter\n)\n\n# vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n# VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\ntry:\n    from vtkmodules.vtkFiltersCore import vtkExtractEdges\nexcept ImportError:\n    from vtkmodules.vtkFiltersExtraction import vtkExtractEdges\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Generate some \"random\" points.\n    points = vtkPoints()\n    randomSequence = vtkMinimalStandardRandomSequence()\n    randomSequence.SetSeed(1)\n    for i in range(0, 50):\n        p1 = randomSequence.GetValue()\n        randomSequence.Next()\n        p2 = randomSequence.GetValue()\n        randomSequence.Next()\n        points.InsertPoint(i, p1, p2, 0.0)\n\n    # Create a polydata with the points we just created.\n    profile = vtkPolyData()\n    profile.SetPoints(points)\n\n    # Perform a 2D Delaunay triangulation on them.\n    delny = vtkDelaunay2D()\n    delny.SetInputData(profile)\n    delny.SetTolerance(0.001)\n    mapMesh = vtkPolyDataMapper()\n    mapMesh.SetInputConnection(delny.GetOutputPort())\n    meshActor = vtkActor()\n    meshActor.SetMapper(mapMesh)\n    meshActor.GetProperty().SetColor(colors.GetColor3d('MidnightBlue'))\n\n    # We will now create a nice looking mesh by wrapping the edges in tubes,\n    # and putting fat spheres at the points.\n    extract = vtkExtractEdges()\n    extract.SetInputConnection(delny.GetOutputPort())\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(extract.GetOutputPort())\n    tubes.SetRadius(0.01)\n    tubes.SetNumberOfSides(6)\n    mapEdges = vtkPolyDataMapper()\n    mapEdges.SetInputConnection(tubes.GetOutputPort())\n    edgeActor = vtkActor()\n    edgeActor.SetMapper(mapEdges)\n    edgeActor.GetProperty().SetColor(colors.GetColor3d('peacock'))\n    edgeActor.GetProperty().SetSpecularColor(1, 1, 1)\n    edgeActor.GetProperty().SetSpecular(0.3)\n    edgeActor.GetProperty().SetSpecularPower(20)\n    edgeActor.GetProperty().SetAmbient(0.2)\n    edgeActor.GetProperty().SetDiffuse(0.8)\n\n    ball = vtkSphereSource()\n    ball.SetRadius(0.025)\n    ball.SetThetaResolution(12)\n    ball.SetPhiResolution(12)\n    balls = vtkGlyph3D()\n    balls.SetInputConnection(delny.GetOutputPort())\n    balls.SetSourceConnection(ball.GetOutputPort())\n    mapBalls = vtkPolyDataMapper()\n    mapBalls.SetInputConnection(balls.GetOutputPort())\n    ballActor = vtkActor()\n    ballActor.SetMapper(mapBalls)\n    ballActor.GetProperty().SetColor(colors.GetColor3d('hot_pink'))\n    ballActor.GetProperty().SetSpecularColor(1, 1, 1)\n    ballActor.GetProperty().SetSpecular(0.3)\n    ballActor.GetProperty().SetSpecularPower(20)\n    ballActor.GetProperty().SetAmbient(0.2)\n    ballActor.GetProperty().SetDiffuse(0.8)\n\n    # Create the rendering window, renderer, and interactive renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(ballActor)\n    ren.AddActor(edgeActor)\n    ren.SetBackground(colors.GetColor3d('AliceBlue'))\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('DelaunayMesh')\n\n    ren.ResetCamera()\n    ren.GetActiveCamera().Zoom(1.3)\n\n    # Interact with the data.\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/DiscreteMarchingCubes/","title":"DiscreteMarchingCubes","text":"

        vtk-examples/Python/Modelling/DiscreteMarchingCubes

        "},{"location":"Python/Modelling/DiscreteMarchingCubes/#description","title":"Description","text":"

        Creates surfaces from labeled data. Volume data does not always contain samples of continuous data. A volume may contain discrete integer values, often the result of segmentation. vtkDiscreteFlyingEdges3D or vtkDiscreteMarchingCubes create surfaces from these segmented volumes using a modified flying edges or marching cubes algorithm. The algorithm generates one or more models representing the boundaries between the specified label and the adjacent structures. One or more label values must be specified to generate the models. The boundary positions are always defined to be half-way between adjacent voxels.

        Seealso

        SmoothDiscreteMarchingCubes produces smooth models.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/DiscreteMarchingCubes/#code","title":"Code","text":"

        DiscreteMarchingCubes.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkLookupTable,\n    vtkMinimalStandardRandomSequence,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkImageData,\n    vtkSphere\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkDiscreteFlyingEdges3D,\n    vtkDiscreteMarchingCubes\n)\nfrom vtkmodules.vtkImagingCore import vtkImageThreshold\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkDiscreteFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    n = 20\n    radius = 8\n    blob = make_blob(n, radius)\n\n    if use_flying_edges:\n        try:\n            discrete = vtkDiscreteFlyingEdges3D()\n        except AttributeError:\n            discrete = vtkDiscreteMarchingCubes()\n    else:\n        discrete = vtkDiscreteMarchingCubes()\n    discrete.SetInputData(blob)\n    discrete.GenerateValues(n, 1, n)\n\n    lut = make_colors(n)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(discrete.GetOutputPort())\n    mapper.SetLookupTable(lut)\n    mapper.SetScalarRange(0, lut.GetNumberOfColors())\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetWindowName('DiscreteMarchingCubes')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    ren.AddActor(actor)\n\n    colors = vtkNamedColors()\n    ren.SetBackground(colors.GetColor3d('Burlywood'))\n\n    ren_win.Render()\n\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef make_blob(n, radius):\n    blob_image = vtkImageData()\n\n    max_r = 50 - 2.0 * radius\n    random_sequence = vtkMinimalStandardRandomSequence()\n    random_sequence.SetSeed(5071)\n    for i in range(0, n):\n\n        sphere = vtkSphere()\n        sphere.SetRadius(radius)\n\n        x = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n        y = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n        z = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n\n        sphere.SetCenter(int(x), int(y), int(z))\n\n        sampler = vtkSampleFunction()\n        sampler.SetImplicitFunction(sphere)\n        sampler.SetOutputScalarTypeToFloat()\n        sampler.SetSampleDimensions(100, 100, 100)\n        sampler.SetModelBounds(-50, 50, -50, 50, -50, 50)\n\n        thres = vtkImageThreshold()\n        thres.SetInputConnection(sampler.GetOutputPort())\n        thres.ThresholdByLower(radius * radius)\n        thres.ReplaceInOn()\n        thres.ReplaceOutOn()\n        thres.SetInValue(i + 1)\n        thres.SetOutValue(0)\n        thres.Update()\n        if i == 0:\n            blob_image.DeepCopy(thres.GetOutput())\n\n        max_value = vtkImageMathematics()\n        max_value.SetInputData(0, blob_image)\n        max_value.SetInputData(1, thres.GetOutput())\n        max_value.SetOperationToMax()\n        max_value.Modified()\n        max_value.Update()\n\n        blob_image.DeepCopy(max_value.GetOutput())\n\n    return blob_image\n\n\ndef make_colors(n):\n    \"\"\"\n    Generate some random colors\n    :param n: The number of colors.\n    :return: The lookup table.\n    \"\"\"\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(n)\n    lut.SetTableRange(0, n - 1)\n    lut.SetScaleToLinear()\n    lut.Build()\n    lut.SetTableValue(0, 0, 0, 0, 1)\n\n    random_sequence = vtkMinimalStandardRandomSequence()\n    random_sequence.SetSeed(5071)\n    for i in range(1, n):\n        r = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        g = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        b = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        lut.SetTableValue(i, r, g, b, 1.0)\n\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/ExtractLargestIsosurface/","title":"ExtractLargestIsosurface","text":"

        vtk-examples/Python/Modelling/ExtractLargestIsosurface

        "},{"location":"Python/Modelling/ExtractLargestIsosurface/#description","title":"Description","text":"
        • Contributed by: Jinyoung Hwang

        This example reads a structured points dataset stored in a .vtk file and constructs a 3D model using vtkFlyingEdges3D or vtkMarchingCubes, vtkPolyDataConnectivityFilter is used to extract the largest isosurface.

        Data is available at:

        1. test.vtk: http://web.kaist.ac.kr/~hjy/test.vtk

        2. brainweb.img: http://web.kaist.ac.kr/~hjy/brainweb.img

        3. brainweb.hdr: http://web.kaist.ac.kr/~hjy/brainweb.hdr

        Second and third datasets can be downloaded from BrainWeb, which is free of charge in use for a research. \"test.vtk\" was converted from \"brainweb.img\" using a program by Erik Vidholm (http://www.cb.uu.se/~erik/vtk/rawToVTK.cpp).

        The examples expects 2 or 3 argments:

         ExtractLargestIsosurface InputFilename Threshold (ExtractLargest)\n

        if ExtractLargest is omitted or 1, the largest isosurface is extracted

        if ExtractLargest is 0 (or -a in Python), all of the isosurfaces are extracted

        Try

        ExtractLargestIsosurface test.vtk 50

        and compare the results to

        ExtractLargestIsosurface test.vtk 50 0

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/ExtractLargestIsosurface/#code","title":"Code","text":"

        ExtractLargestIsosurface.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkPolyDataConnectivityFilter\n)\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    colors.SetColor('SkinColor', [240, 184, 160, 255])\n    colors.SetColor('BackfaceColor', [255, 229, 200, 255])\n    colors.SetColor('BkgColor', [51, 77, 102, 255])\n\n    file_name, threshold, largest_surface = get_program_parameters()\n\n    # Load data\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(file_name)\n\n    # Create a 3D model using flying edges or marching cubes\n    if use_flying_edges:\n        try:\n            mc = vtkFlyingEdges3D()\n        except AttributeError:\n            mc = vtkMarchingCubes()\n    else:\n        mc = vtkMarchingCubes()\n\n    mc.SetInputConnection(reader.GetOutputPort())\n    mc.ComputeNormalsOn()\n    mc.ComputeGradientsOn()\n    mc.SetValue(0, threshold)  # second value acts as threshold\n\n    # To remain largest region\n    confilter = vtkPolyDataConnectivityFilter()\n    confilter.SetInputConnection(mc.GetOutputPort())\n    confilter.SetExtractionModeToLargestRegion()\n\n    # Create a mapper\n    mapper = vtkPolyDataMapper()\n    if largest_surface:\n        mapper.SetInputConnection(confilter.GetOutputPort())\n    else:\n        mapper.SetInputConnection(mc.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Visualize\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('SkinColor'))\n    back_prop = vtkProperty()\n    back_prop.SetDiffuseColor(colors.GetColor3d('BackfaceColor'))\n    actor.SetBackfaceProperty(back_prop)\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderer.GetActiveCamera().SetViewUp(0.0, 0.0, 1.0)\n    renderer.GetActiveCamera().SetPosition(0.0, 1.0, 0.0)\n    renderer.GetActiveCamera().SetFocalPoint(0.0, 0.0, 0.0)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.GetActiveCamera().Elevation(30.0)\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('ExtractLargestIsosurface')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Reads a structured points dataset stored in a .vtk file and constructs a 3D model.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='E.g. brain.vtk.')\n    parser.add_argument('threshold', type=int, help='The threshold, e.g. 50.')\n    parser.add_argument('-a', action='store_false', default=True, help='Extract all surfaces.')\n    args = parser.parse_args()\n    return args.filename, args.threshold, args.a\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/Finance/","title":"Finance","text":"

        vtk-examples/Python/Modelling/Finance

        "},{"location":"Python/Modelling/Finance/#description","title":"Description","text":"

        The first step is to choose dependent and independent variables. This choice is essentially a mapping from multidimensional data into an unstructured point dataset. This example chooses MONTHLY_PAYMENT, INTEREST_RATE, and LOAN_AMOUNT as (x, y, z) point coordinates, and TIME_LATE as a scalar value. This maps four of six variables. For now we will ignore the other two variables.

        The example uses vtkGaussianSplatter to perform the splatting operation (i.e., conversion from unstructured points to volume dataset). This is followed by an isosurface extraction. We splat the data two times. The first time we splat the entire population. This is to show context and appears as gray/ wireframe in the figure. The second time we splat the data and scale it by the value of TIME_LATE . As a result, only payments that are late contribute to the second isosurface. The results of this visualization are interesting. First, we see that there is a strong correlation between the two independent variables MONTHLY_PAYMENT and LOAN_AMOUNT . (This is more evident when viewing the data interactively.) We see that the data falls roughly on a plane at a 45 degree angle between these two axes. With a little reflection this is evident: the monthly payment is strongly a function of loan amount (as well as interest rate and payment period). Second, we see that there is a clustering of delinquent accounts within the total population. The cluster tends to grow with larger interest rates and shrink with smaller monthly payments and loan amounts. Although the relationship with interest rate is expected, the clustering towards smaller monthly payments is not. Thus our visualization has provided a clue into the data. Further exploration may reveal the reason(s), or we may perform additional data analysis and acquisition to understand the phenomena.

        One important note about multidimensional visualization. Because we tend to combine variables in odd ways (e.g., the use of MONTHLY_PAYMENT , INTEREST_RATE , and LOAN_AMOUNT as (x, y, z) coordinates), normalization of the data is usually required. To normalize data we simply adjust data values to lie between (0,1). Otherwise our data can be badly skewed and result in poor visualizations.

        Info

        See Figure 9-50 in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/Finance/#code","title":"Code","text":"

        Finance.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkAxes\nfrom vtkmodules.vtkImagingHybrid import vtkGaussianSplatter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    colors.SetColor('PopColor', [230, 230, 230, 255])\n\n    fileName = get_program_parameters()\n\n    keys = ['NUMBER_POINTS', 'MONTHLY_PAYMENT', 'INTEREST_RATE', 'LOAN_AMOUNT', 'TIME_LATE']\n\n    # Read in the data and make an unstructured data set.\n    dataSet = make_dataset(fileName, keys)\n\n    # Construct the pipeline for the original population.\n    popSplatter = vtkGaussianSplatter()\n    popSplatter.SetInputData(dataSet)\n    popSplatter.SetSampleDimensions(100, 100, 100)\n    popSplatter.SetRadius(0.05)\n    popSplatter.ScalarWarpingOff()\n\n    popSurface = vtkContourFilter()\n    popSurface.SetInputConnection(popSplatter.GetOutputPort())\n    popSurface.SetValue(0, 0.01)\n\n    popMapper = vtkPolyDataMapper()\n    popMapper.SetInputConnection(popSurface.GetOutputPort())\n    popMapper.ScalarVisibilityOff()\n\n    popActor = vtkActor()\n    popActor.SetMapper(popMapper)\n    popActor.GetProperty().SetOpacity(0.3)\n    popActor.GetProperty().SetColor(colors.GetColor3d('PopColor'))\n\n    # Construct the pipeline for the delinquent population.\n    lateSplatter = vtkGaussianSplatter()\n    lateSplatter.SetInputData(dataSet)\n    lateSplatter.SetSampleDimensions(50, 50, 50)\n    lateSplatter.SetRadius(0.05)\n    lateSplatter.SetScaleFactor(0.005)\n\n    lateSurface = vtkContourFilter()\n    lateSurface.SetInputConnection(lateSplatter.GetOutputPort())\n    lateSurface.SetValue(0, 0.01)\n\n    lateMapper = vtkPolyDataMapper()\n    lateMapper.SetInputConnection(lateSurface.GetOutputPort())\n    lateMapper.ScalarVisibilityOff()\n\n    lateActor = vtkActor()\n    lateActor.SetMapper(lateMapper)\n    lateActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    # Create axes.\n    popSplatter.Update()\n    bounds = popSplatter.GetOutput().GetBounds()\n\n    axes = vtkAxes()\n    axes.SetOrigin(bounds[0], bounds[2], bounds[4])\n    axes.SetScaleFactor(popSplatter.GetOutput().GetLength() / 5)\n\n    axesTubes = vtkTubeFilter()\n    axesTubes.SetInputConnection(axes.GetOutputPort())\n    axesTubes.SetRadius(axes.GetScaleFactor() / 25.0)\n    axesTubes.SetNumberOfSides(6)\n\n    axesMapper = vtkPolyDataMapper()\n    axesMapper.SetInputConnection(axesTubes.GetOutputPort())\n\n    axesActor = vtkActor()\n    axesActor.SetMapper(axesMapper)\n\n    # Graphics stuff.\n    renderer = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renWin)\n\n    # Set up the renderer.\n    renderer.AddActor(lateActor)\n    renderer.AddActor(axesActor)\n    renderer.AddActor(popActor)\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('Finance')\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Dolly(1.3)\n    renderer.ResetCameraClippingRange()\n\n    # Interact with the data.\n    renWin.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Visualization of multidimensional financial data.'\n    epilogue = '''\n    The gray/wireframe surface represents the total data population.\n    The red surface represents data points delinquent on loan payment.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='financial.txt.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef normalise(maximum, minimum, x):\n    return minimum + x / (maximum - minimum)\n\n\ndef read_file(filename):\n    '''\n    Read in the data set.\n    :param filename:\n    :return:\n    '''\n    res = dict()\n\n    with open(filename) as ifn:\n        k = ''\n        v = list()\n        for line in ifn:\n            cl = ' '.join(line.split()).split()  # Clean the line.\n            if cl:\n                if len(cl) == 2 and cl[0] == 'NUMBER_POINTS':\n                    k = cl[0]\n                    v = [int(cl[1])]\n                    has_key = True\n                    continue\n                if len(cl) == 1 and not has_key:\n                    has_key = True\n                    k = cl[0]\n                    v = list()\n                else:\n                    v += map(float, cl)\n            else:\n                if has_key:\n                    # Normalise the data.\n                    minimum = min(v)\n                    maximum = max(v)\n                    # Emulate the bug in the C++ code.\n                    for i in v:\n                        if i > minimum:\n                            maximum = i\n                    if maximum != minimum:\n                        res[k] = list(map(lambda x: minimum + x / (maximum - minimum), v))\n                    else:\n                        res[k] = v\n                    has_key = False\n    return res\n\n\ndef make_dataset(filename, keys):\n    res = read_file(filename)\n    if res:\n        newPts = vtkPoints()\n        newScalars = vtkFloatArray()\n        xyz = list(zip(res[keys[1]], res[keys[2]], res[keys[3]]))\n        for i in range(0, res[keys[0]][0]):\n            # print(xyz[i])\n            newPts.InsertPoint(i, xyz[i])\n            newScalars.InsertValue(i, res[keys[4]][i])\n\n        dataset = vtkUnstructuredGrid()\n        dataset.SetPoints(newPts)\n        dataset.GetPointData().SetScalars(newScalars)\n        return dataset\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/FinanceFieldData/","title":"FinanceFieldData","text":"

        vtk-examples/Python/Modelling/FinanceFieldData

        "},{"location":"Python/Modelling/FinanceFieldData/#description","title":"Description","text":"

        This example is similar to Finance, but here we read a .vtk file with vtkDataObjectReader. The file is: src/Testing/Data/financial.vtk.

        The generated image is Figure 5 in VTKFileFormats.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/FinanceFieldData/#code","title":"Code","text":"

        FinanceFieldData.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDataObjectToDataSetFilter,\n    vtkFieldDataToAttributeDataFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkAxes,\n    vtkMarchingContourFilter\n)\nfrom vtkmodules.vtkIOLegacy import vtkDataObjectReader\nfrom vtkmodules.vtkImagingHybrid import vtkGaussianSplatter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkFollower,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    ifn = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    reader = vtkDataObjectReader()\n    reader.SetFileName(ifn)\n\n    size = 3187  # maximum number possible\n\n    xAxis = 'INTEREST_RATE'\n    yAxis = 'MONTHLY_PAYMENT'\n    zAxis = 'MONTHLY_INCOME'\n    scalar = 'TIME_LATE'\n\n    # Extract data from field as a polydata (just points), then extract scalars.\n    do2ds = vtkDataObjectToDataSetFilter()\n    do2ds.SetInputConnection(reader.GetOutputPort())\n    do2ds.SetDataSetTypeToPolyData()\n    # format: component#, arrayname, arraycomp, minArrayId, maxArrayId, normalize\n    do2ds.DefaultNormalizeOn()\n    do2ds.SetPointComponent(0, xAxis, 0)\n    do2ds.SetPointComponent(1, yAxis, 0, 0, size, 1)\n    do2ds.SetPointComponent(2, zAxis, 0)\n    do2ds.Update()\n    fd2ad = vtkFieldDataToAttributeDataFilter()\n    fd2ad.SetInputConnection(do2ds.GetOutputPort())\n    fd2ad.SetInputFieldToDataObjectField()\n    fd2ad.SetOutputAttributeDataToPointData()\n    fd2ad.DefaultNormalizeOn()\n    fd2ad.SetScalarComponent(0, scalar, 0)\n\n    # Construct the pipeline for the original population.\n    popSplatter = vtkGaussianSplatter()\n    popSplatter.SetInputConnection(fd2ad.GetOutputPort())\n    popSplatter.SetSampleDimensions(150, 150, 150)\n    popSplatter.SetRadius(0.05)\n    popSplatter.ScalarWarpingOff()\n\n    popSurface = vtkMarchingContourFilter()\n    popSurface.SetInputConnection(popSplatter.GetOutputPort())\n    popSurface.SetValue(0, 0.01)\n    popMapper = vtkPolyDataMapper()\n    popMapper.SetInputConnection(popSurface.GetOutputPort())\n    popMapper.ScalarVisibilityOff()\n    popActor = vtkActor()\n    popActor.SetMapper(popMapper)\n    popActor.GetProperty().SetOpacity(0.3)\n    popActor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    # Construct the pipeline for the delinquent population.\n    lateSplatter = vtkGaussianSplatter()\n    lateSplatter.SetInputConnection(fd2ad.GetOutputPort())\n    lateSplatter.SetSampleDimensions(150, 150, 150)\n    lateSplatter.SetRadius(0.05)\n    lateSplatter.SetScaleFactor(0.05)\n\n    lateSurface = vtkMarchingContourFilter()\n    lateSurface.SetInputConnection(lateSplatter.GetOutputPort())\n    lateSurface.SetValue(0, 0.01)\n    lateMapper = vtkPolyDataMapper()\n    lateMapper.SetInputConnection(lateSurface.GetOutputPort())\n    lateMapper.ScalarVisibilityOff()\n    lateActor = vtkActor()\n    lateActor.SetMapper(lateMapper)\n    lateActor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n    # Create the axes.\n    popSplatter.Update()\n    bounds = popSplatter.GetOutput().GetBounds()\n    axes = vtkAxes()\n    axes.SetOrigin(bounds[0], bounds[2], bounds[4])\n    axes.SetScaleFactor(popSplatter.GetOutput().GetLength() / 5.0)\n    axesTubes = vtkTubeFilter()\n    axesTubes.SetInputConnection(axes.GetOutputPort())\n    axesTubes.SetRadius(axes.GetScaleFactor() / 25.0)\n    axesTubes.SetNumberOfSides(6)\n    axesMapper = vtkPolyDataMapper()\n    axesMapper.SetInputConnection(axesTubes.GetOutputPort())\n    axesActor = vtkActor()\n    axesActor.SetMapper(axesMapper)\n\n    # Label the axes.\n    XText = vtkVectorText()\n    XText.SetText(xAxis)\n    XTextMapper = vtkPolyDataMapper()\n    XTextMapper.SetInputConnection(XText.GetOutputPort())\n\n    XActor = vtkFollower()\n    XActor.SetMapper(XTextMapper)\n    XActor.SetScale(0.02, .02, .02)\n    XActor.SetPosition(0.35, -0.05, -0.05)\n    XActor.GetProperty().SetColor(0, 0, 0)\n\n    YText = vtkVectorText()\n    YText.SetText(yAxis)\n\n    YTextMapper = vtkPolyDataMapper()\n    YTextMapper.SetInputConnection(YText.GetOutputPort())\n    YActor = vtkFollower()\n    YActor.SetMapper(YTextMapper)\n    YActor.SetScale(0.02, .02, .02)\n    YActor.SetPosition(-0.05, 0.35, -0.05)\n    YActor.GetProperty().SetColor(0, 0, 0)\n\n    ZText = vtkVectorText()\n    ZText.SetText(zAxis)\n    ZTextMapper = vtkPolyDataMapper()\n    ZTextMapper.SetInputConnection(ZText.GetOutputPort())\n    ZActor = vtkFollower()\n    ZActor.SetMapper(ZTextMapper)\n    ZActor.SetScale(0.02, .02, .02)\n    ZActor.SetPosition(-0.05, -0.05, 0.35)\n    ZActor.GetProperty().SetColor(0, 0, 0)\n\n    # Graphics stuff.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('FinanceFieldData')\n\n    # Add the actors to the renderer, set the background and size.\n    renderer.AddActor(axesActor)\n    renderer.AddActor(lateActor)\n    renderer.AddActor(XActor)\n    renderer.AddActor(YActor)\n    renderer.AddActor(ZActor)\n    renderer.AddActor(popActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderWindow.SetSize(650, 480)\n\n    camera = vtkCamera()\n    camera.SetClippingRange(.274, 13.72)\n    camera.SetFocalPoint(0.433816, 0.333131, 0.449)\n    camera.SetPosition(-1.96987, 1.15145, 1.49053)\n    camera.SetViewUp(0.378927, 0.911821, 0.158107)\n    renderer.SetActiveCamera(camera)\n    XActor.SetCamera(camera)\n    YActor.SetCamera(camera)\n    ZActor.SetCamera(camera)\n\n    # Render and interact with the data.\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Visualization of multidimensional financial data.'\n    epilogue = '''\n    This example is similar to /Python/Modelling/Finance.py, but here we read a .vtk file with vtkDataObjectReader.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('filename', help='financial.')\n\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/MarchingCubes/","title":"MarchingCubes","text":"

        vtk-examples/Python/Modelling/MarchingCubes

        "},{"location":"Python/Modelling/MarchingCubes/#description","title":"Description","text":"

        Creates a surface from a volume using Flying Edges or Marching Cubes.

        Without arguments, the examples generates a voxelized sphere with vtkVoxelModeller.

        Note

        vtkVoxelModeller by default produces a VTK_BIT scalar image. Marching Cubes does not support this type. The scalar output is set to float for this example.

        To generate a surface from a DICOM series, provide a folder containing the series and specify an isovalue for the surface.

        This Midas Repository contains a number of DICOM datasets.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/MarchingCubes/#code","title":"Code","text":"

        MarchingCubes.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import vtkDICOMImageReader\nfrom vtkmodules.vtkImagingHybrid import vtkVoxelModeller\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    dicom_dir, iso_value = get_program_parameters()\n    if iso_value is None and dicom_dir is not None:\n        print('An ISO value is needed.')\n        return ()\n\n    volume = vtkImageData()\n    if dicom_dir is None:\n        sphere_source = vtkSphereSource()\n        sphere_source.SetPhiResolution(20)\n        sphere_source.SetThetaResolution(20)\n        sphere_source.Update()\n\n        bounds = list(sphere_source.GetOutput().GetBounds())\n        for i in range(0, 6, 2):\n            dist = bounds[i + 1] - bounds[i]\n            bounds[i] = bounds[i] - 0.1 * dist\n            bounds[i + 1] = bounds[i + 1] + 0.1 * dist\n        voxel_modeller = vtkVoxelModeller()\n        voxel_modeller.SetSampleDimensions(50, 50, 50)\n        voxel_modeller.SetModelBounds(bounds)\n        voxel_modeller.SetScalarTypeToFloat()\n        voxel_modeller.SetMaximumDistance(0.1)\n\n        voxel_modeller.SetInputConnection(sphere_source.GetOutputPort())\n        voxel_modeller.Update()\n        iso_value = 0.5\n        volume.DeepCopy(voxel_modeller.GetOutput())\n    else:\n        reader = vtkDICOMImageReader()\n        reader.SetDirectoryName(dicom_dir)\n        reader.Update()\n        volume.DeepCopy(reader.GetOutput())\n\n    if use_flying_edges:\n        try:\n            surface = vtkFlyingEdges3D()\n        except AttributeError:\n            surface = vtkMarchingCubes()\n    else:\n        surface = vtkMarchingCubes()\n    surface.SetInputData(volume)\n    surface.ComputeNormalsOn()\n    surface.SetValue(0, iso_value)\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetWindowName('MarchingCubes')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    renderer.AddActor(actor)\n\n    render_window.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The skin extracted from a CT dataset of the head.'\n    epilogue = '''\n    Derived from VTK/Examples/Cxx/Medical1.cxx\n    This example reads a volume dataset, extracts an isosurface that\n     represents the skin and displays it.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-d', default=None, help='A DICOM Image directory.')\n    parser.add_argument('-i', type=float, default=None, help='The iso value to use.')\n    args = parser.parse_args()\n    return args.d, args.i\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/SmoothDiscreteMarchingCubes/","title":"SmoothDiscreteMarchingCubes","text":"

        vtk-examples/Python/Modelling/SmoothDiscreteMarchingCubes

        "},{"location":"Python/Modelling/SmoothDiscreteMarchingCubes/#description","title":"Description","text":"

        Creates surfaces from labeled data. Volume data does not always contain samples of continuous data. A volume may contain discrete integer values, often the result of segmentation. This example smooths the discrete models generated by vtkDiscreteMarchingCubes with vtkWindowedSincPolyDataFilter.

        Seealso

        DiscreteMarchingCubes produces rough models.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/SmoothDiscreteMarchingCubes/#code","title":"Code","text":"

        SmoothDiscreteMarchingCubes.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkMinimalStandardRandomSequence\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkImageData,\n    vtkSphere\n)\nfrom vtkmodules.vtkFiltersCore import vtkWindowedSincPolyDataFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkDiscreteMarchingCubes\nfrom vtkmodules.vtkImagingCore import vtkImageThreshold\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkImagingMath import vtkImageMathematics\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    n = 20\n    radius = 8\n    blob = make_blob(n, radius)\n\n    discrete = vtkDiscreteMarchingCubes()\n    discrete.SetInputData(blob)\n    discrete.GenerateValues(n, 1, n)\n\n    smoothing_iterations = 15\n    pass_band = 0.001\n    feature_angle = 120.0\n\n    smoother = vtkWindowedSincPolyDataFilter()\n    smoother.SetInputConnection(discrete.GetOutputPort())\n    smoother.SetNumberOfIterations(smoothing_iterations)\n    smoother.BoundarySmoothingOff()\n    smoother.FeatureEdgeSmoothingOff()\n    smoother.SetFeatureAngle(feature_angle)\n    smoother.SetPassBand(pass_band)\n    smoother.NonManifoldSmoothingOn()\n    smoother.NormalizeCoordinatesOn()\n    smoother.Update()\n\n    lut = make_colors(n)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(smoother.GetOutputPort())\n    mapper.SetLookupTable(lut)\n    mapper.SetScalarRange(0, lut.GetNumberOfColors())\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetWindowName('SmoothDiscreteMarchingCubes')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    ren.AddActor(actor)\n\n    colors = vtkNamedColors()\n    ren.SetBackground(colors.GetColor3d('Burlywood'))\n\n    ren_win.Render()\n\n    iren.Start()\n\n\ndef make_blob(n, radius):\n    blob_image = vtkImageData()\n\n    max_r = 50 - 2.0 * radius\n    random_sequence = vtkMinimalStandardRandomSequence()\n    random_sequence.SetSeed(5071)\n    for i in range(0, n):\n\n        sphere = vtkSphere()\n        sphere.SetRadius(radius)\n\n        x = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n        y = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n        z = random_sequence.GetRangeValue(-max_r, max_r)\n        random_sequence.Next()\n\n        sphere.SetCenter(int(x), int(y), int(z))\n\n        sampler = vtkSampleFunction()\n        sampler.SetImplicitFunction(sphere)\n        sampler.SetOutputScalarTypeToFloat()\n        sampler.SetSampleDimensions(100, 100, 100)\n        sampler.SetModelBounds(-50, 50, -50, 50, -50, 50)\n\n        thres = vtkImageThreshold()\n        thres.SetInputConnection(sampler.GetOutputPort())\n        thres.ThresholdByLower(radius * radius)\n        thres.ReplaceInOn()\n        thres.ReplaceOutOn()\n        thres.SetInValue(i + 1)\n        thres.SetOutValue(0)\n        thres.Update()\n        if i == 0:\n            blob_image.DeepCopy(thres.GetOutput())\n\n        max_value = vtkImageMathematics()\n        max_value.SetInputData(0, blob_image)\n        max_value.SetInputData(1, thres.GetOutput())\n        max_value.SetOperationToMax()\n        max_value.Modified()\n        max_value.Update()\n\n        blob_image.DeepCopy(max_value.GetOutput())\n\n    return blob_image\n\n\ndef make_colors(n):\n    \"\"\"\n    Generate some random colors\n    :param n: The number of colors.\n    :return: The lookup table.\n    \"\"\"\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(n)\n    lut.SetTableRange(0, n - 1)\n    lut.SetScaleToLinear()\n    lut.Build()\n    lut.SetTableValue(0, 0, 0, 0, 1)\n\n    random_sequence = vtkMinimalStandardRandomSequence()\n    random_sequence.SetSeed(5071)\n    for i in range(1, n):\n        r = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        g = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        b = random_sequence.GetRangeValue(0.4, 1)\n        random_sequence.Next()\n        lut.SetTableValue(i, r, g, b, 1.0)\n\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Modelling/Spring/","title":"Spring","text":"

        vtk-examples/Python/Modelling/Spring

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Modelling/Spring/#code","title":"Code","text":"

        Spring.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkFiltersModeling import vtkRotationalExtrusionFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the spring profile (a circle).\n    #\n    points = vtkPoints()\n    points.InsertPoint(0, 1.0, 0.0, 0.0)\n    points.InsertPoint(1, 1.0732, 0.0, -0.1768)\n    points.InsertPoint(2, 1.25, 0.0, -0.25)\n    points.InsertPoint(3, 1.4268, 0.0, -0.1768)\n    points.InsertPoint(4, 1.5, 0.0, 0.00)\n    points.InsertPoint(5, 1.4268, 0.0, 0.1768)\n    points.InsertPoint(6, 1.25, 0.0, 0.25)\n    points.InsertPoint(7, 1.0732, 0.0, 0.1768)\n\n    poly = vtkCellArray()\n    poly.InsertNextCell(8)  # The number of points.\n    poly.InsertCellPoint(0)\n    poly.InsertCellPoint(1)\n    poly.InsertCellPoint(2)\n    poly.InsertCellPoint(3)\n    poly.InsertCellPoint(4)\n    poly.InsertCellPoint(5)\n    poly.InsertCellPoint(6)\n    poly.InsertCellPoint(7)\n\n    profile = vtkPolyData()\n    profile.SetPoints(points)\n    profile.SetPolys(poly)\n\n    # Extrude the profile to make a spring.\n    #\n    extrude = vtkRotationalExtrusionFilter()\n    extrude.SetInputData(profile)\n    extrude.SetResolution(360)\n    extrude.SetTranslation(6)\n    extrude.SetDeltaRadius(1.0)\n    extrude.SetAngle(2160.0)  # six revolutions\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(extrude.GetOutputPort())\n    normals.SetFeatureAngle(60)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(normals.GetOutputPort())\n\n    spring = vtkActor()\n    spring.SetMapper(mapper)\n    spring.GetProperty().SetColor(colors.GetColor3d(\"PowderBlue\"))\n    spring.GetProperty().SetDiffuse(0.7)\n    spring.GetProperty().SetSpecular(0.4)\n    spring.GetProperty().SetSpecularPower(20)\n    spring.GetProperty().BackfaceCullingOn()\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    renderer.AddActor(spring)\n    renderer.SetBackground(colors.GetColor3d(\"Burlywood\"))\n    renWin.SetSize(640, 512)\n    renWin.SetWindowName('Spring')\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(90)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Picking/CellPicking/","title":"CellPicking","text":"

        vtk-examples/Python/Picking/CellPicking

        "},{"location":"Python/Picking/CellPicking/#description","title":"Description","text":"

        This example demonstrates how to get the coordinates of the point on an actor that is clicked with the left mouse button. It also indicates which cell the selected point belongs to by highlighting the edges of that cell.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Picking/CellPicking/#code","title":"Code","text":"

        CellPicking.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdTypeArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkSelection,\n    vtkSelectionNode,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkTriangleFilter\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractSelection\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCellPicker,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\n# Catch mouse events\nclass MouseInteractorStyle(vtkInteractorStyleTrackballCamera):\n    def __init__(self, data):\n        self.AddObserver('LeftButtonPressEvent', self.left_button_press_event)\n        self.data = data\n        self.selected_mapper = vtkDataSetMapper()\n        self.selected_actor = vtkActor()\n\n    def left_button_press_event(self, obj, event):\n        colors = vtkNamedColors()\n\n        # Get the location of the click (in window coordinates)\n        pos = self.GetInteractor().GetEventPosition()\n\n        picker = vtkCellPicker()\n        picker.SetTolerance(0.0005)\n\n        # Pick from this location.\n        picker.Pick(pos[0], pos[1], 0, self.GetDefaultRenderer())\n\n        world_position = picker.GetPickPosition()\n        print(f'Cell id is: {picker.GetCellId()}')\n\n        if picker.GetCellId() != -1:\n            print(f'Pick position is: ({world_position[0]:.6g}, {world_position[1]:.6g}, {world_position[2]:.6g})')\n\n            ids = vtkIdTypeArray()\n            ids.SetNumberOfComponents(1)\n            ids.InsertNextValue(picker.GetCellId())\n\n            selection_node = vtkSelectionNode()\n            selection_node.SetFieldType(vtkSelectionNode.CELL)\n            selection_node.SetContentType(vtkSelectionNode.INDICES)\n            selection_node.SetSelectionList(ids)\n\n            selection = vtkSelection()\n            selection.AddNode(selection_node)\n\n            extract_selection = vtkExtractSelection()\n            extract_selection.SetInputData(0, self.data)\n            extract_selection.SetInputData(1, selection)\n            extract_selection.Update()\n\n            # In selection\n            selected = vtkUnstructuredGrid()\n            selected.ShallowCopy(extract_selection.GetOutput())\n\n            print(f'Number of points in the selection: {selected.GetNumberOfPoints()}')\n            print(f'Number of cells in the selection : {selected.GetNumberOfCells()}')\n\n            self.selected_mapper.SetInputData(selected)\n            self.selected_actor.SetMapper(self.selected_mapper)\n            self.selected_actor.GetProperty().EdgeVisibilityOn()\n            self.selected_actor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n            self.selected_actor.GetProperty().SetLineWidth(3)\n\n            self.GetInteractor().GetRenderWindow().GetRenderers().GetFirstRenderer().AddActor(self.selected_actor)\n\n        # Forward events\n        self.OnLeftButtonDown()\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    plane_source = vtkPlaneSource()\n    plane_source.Update()\n\n    triangle_filter = vtkTriangleFilter()\n    triangle_filter.SetInputConnection(plane_source.GetOutputPort())\n    triangle_filter.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(triangle_filter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetWindowName('CellPicking')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    renderer.AddActor(actor)\n    # renderer.ResetCamera()\n    renderer.SetBackground(colors.GetColor3d('PaleTurquoise'))\n\n    # Add the custom style.\n    style = MouseInteractorStyle(triangle_filter.GetOutput())\n    style.SetDefaultRenderer(renderer)\n    iren.SetInteractorStyle(style)\n\n    ren_win.Render()\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Picking/HighlightPickedActor/","title":"HighlightPickedActor","text":"

        vtk-examples/Python/Picking/HighlightPickedActor

        "},{"location":"Python/Picking/HighlightPickedActor/#description","title":"Description","text":"

        Click on a sphere to highlight it. The picked sphere color changes to red, and its EdgeVisibity is On. The example subclasses vtkInteractorStyleTrackballCamera with a local class called MouseInteractorHighLightActor. The new interactor overrides the OnLeftButtonDown of vtkInteractorStyleTrackballCamera.

        Seealso

        HighlightWithSilhouette generates a silhouette of the picked actor.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Picking/HighlightPickedActor/#code","title":"Code","text":"

        HighlightPickedActor.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkMinimalStandardRandomSequence\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropPicker,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\ncolors = vtkNamedColors()\nNUMBER_OF_SPHERES = 10\n\n\nclass MouseInteractorHighLightActor(vtkInteractorStyleTrackballCamera):\n\n    def __init__(self, parent=None):\n        self.AddObserver(\"LeftButtonPressEvent\", self.leftButtonPressEvent)\n\n        self.LastPickedActor = None\n        self.LastPickedProperty = vtkProperty()\n\n    def leftButtonPressEvent(self, obj, event):\n        clickPos = self.GetInteractor().GetEventPosition()\n\n        picker = vtkPropPicker()\n        picker.Pick(clickPos[0], clickPos[1], 0, self.GetDefaultRenderer())\n\n        # get the new\n        self.NewPickedActor = picker.GetActor()\n\n        # If something was selected\n        if self.NewPickedActor:\n            # If we picked something before, reset its property\n            if self.LastPickedActor:\n                self.LastPickedActor.GetProperty().DeepCopy(self.LastPickedProperty)\n\n            # Save the property of the picked actor so that we can\n            # restore it next time\n            self.LastPickedProperty.DeepCopy(self.NewPickedActor.GetProperty())\n            # Highlight the picked actor by changing its properties\n            self.NewPickedActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n            self.NewPickedActor.GetProperty().SetDiffuse(1.0)\n            self.NewPickedActor.GetProperty().SetSpecular(0.0)\n            self.NewPickedActor.GetProperty().EdgeVisibilityOn()\n\n            # save the last picked actor\n            self.LastPickedActor = self.NewPickedActor\n\n        self.OnLeftButtonDown()\n        return\n\n\ndef main():\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetSize(640, 480)\n    renwin.SetWindowName('HighlightPickedActor')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # add the custom style\n    style = MouseInteractorHighLightActor()\n    style.SetDefaultRenderer(renderer)\n    interactor.SetInteractorStyle(style)\n\n    randomSequence = vtkMinimalStandardRandomSequence()\n    # randomSequence.SetSeed(1043618065)\n    # randomSequence.SetSeed(5170)\n    randomSequence.SetSeed(8775070)\n    # Add spheres to play with\n    for i in range(NUMBER_OF_SPHERES):\n        source = vtkSphereSource()\n\n        # random position and radius\n        x = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        y = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        z = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        radius = randomSequence.GetRangeValue(0.5, 1.0)\n        randomSequence.Next()\n\n        source.SetRadius(radius)\n        source.SetCenter(x, y, z)\n        source.SetPhiResolution(11)\n        source.SetThetaResolution(21)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(source.GetOutputPort())\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        r = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n        g = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n        b = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n\n        actor.GetProperty().SetDiffuseColor(r, g, b)\n        actor.GetProperty().SetDiffuse(.8)\n        actor.GetProperty().SetSpecular(.5)\n        actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n        actor.GetProperty().SetSpecularPower(30.0)\n\n        renderer.AddActor(actor)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Picking/HighlightWithSilhouette/","title":"HighlightWithSilhouette","text":"

        vtk-examples/Python/Picking/HighlightWithSilhouette

        "},{"location":"Python/Picking/HighlightWithSilhouette/#description","title":"Description","text":"

        Click on a sphere to highlight it. vtkPolyDataSilhoutte creates a silhouette of the picked vtkActor. The example subclasses vtkInteractorStyleTrackballCamera with a local class called MouseInteractorHighLightActor. The new interactor overrides the OnLeftButtonDown of vtkInteractorStyleTrackballCamera.

        Watch this video showing the picking of several spheres.

        Seealso

        HighlightPickedActor C++ or Python where the color and edge visibility of the picked actor is changed.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Picking/HighlightWithSilhouette/#code","title":"Code","text":"

        HighlightWithSilhouette.py

        # !/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkMinimalStandardRandomSequence\nfrom vtkmodules.vtkFiltersHybrid import vtkPolyDataSilhouette\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropPicker,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Highlighting a selected object with a silhouette.'\n    epilogue = '''\nClick on the object to highlight it.\nThe selected object is highlighted with a silhouette.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('numberOfSpheres', nargs='?', type=int, default=10,\n                        help='The number of spheres, default is 10.')\n    args = parser.parse_args()\n    return args.numberOfSpheres\n\n\nclass MouseInteractorHighLightActor(vtkInteractorStyleTrackballCamera):\n\n    def __init__(self, silhouette=None, silhouetteActor=None):\n        self.AddObserver(\"LeftButtonPressEvent\", self.onLeftButtonDown)\n        self.LastPickedActor = None\n        self.Silhouette = silhouette\n        self.SilhouetteActor = silhouetteActor\n\n    def onLeftButtonDown(self, obj, event):\n        clickPos = self.GetInteractor().GetEventPosition()\n\n        #  Pick from this location.\n        picker = vtkPropPicker()\n        picker.Pick(clickPos[0], clickPos[1], 0, self.GetDefaultRenderer())\n        self.LastPickedActor = picker.GetActor()\n\n        # If we picked something before, remove the silhouette actor and\n        # generate a new one.\n        if self.LastPickedActor:\n            self.GetDefaultRenderer().RemoveActor(self.SilhouetteActor)\n\n            # Highlight the picked actor by generating a silhouette\n            self.Silhouette.SetInputData(self.LastPickedActor.GetMapper().GetInput())\n            self.GetDefaultRenderer().AddActor(self.SilhouetteActor)\n\n        #  Forward events\n        self.OnLeftButtonDown()\n        return\n\n    def SetSilhouette(self, silhouette):\n        self.Silhouette = silhouette\n\n    def SetSilhouetteActor(self, silhouetteActor):\n        self.SilhouetteActor = silhouetteActor\n\n\ndef main():\n    numberOfSpheres = get_program_parameters()\n    colors = vtkNamedColors()\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SteelBlue'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(640, 480)\n    renderWindow.AddRenderer(renderer)\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    randomSequence = vtkMinimalStandardRandomSequence()\n    # randomSequence.SetSeed(1043618065)\n    # randomSequence.SetSeed(5170)\n    randomSequence.SetSeed(8775070)\n    # Add spheres to play with\n    for i in range(numberOfSpheres):\n        source = vtkSphereSource()\n\n        # random position and radius\n        x = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        y = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        z = randomSequence.GetRangeValue(-5.0, 5.0)\n        randomSequence.Next()\n        radius = randomSequence.GetRangeValue(0.5, 1.0)\n        randomSequence.Next()\n\n        source.SetRadius(radius)\n        source.SetCenter(x, y, z)\n        source.SetPhiResolution(11)\n        source.SetThetaResolution(21)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(source.GetOutputPort())\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        r = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n        g = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n        b = randomSequence.GetRangeValue(0.4, 1.0)\n        randomSequence.Next()\n\n        actor.GetProperty().SetDiffuseColor(r, g, b)\n        actor.GetProperty().SetDiffuse(0.8)\n        actor.GetProperty().SetSpecular(0.5)\n        actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n        actor.GetProperty().SetSpecularPower(30.0)\n\n        renderer.AddActor(actor)\n\n    # Render and interact\n    renderWindow.Render()\n\n    # Create the silhouette pipeline, the input data will be set in the\n    # interactor\n    silhouette = vtkPolyDataSilhouette()\n    silhouette.SetCamera(renderer.GetActiveCamera())\n\n    # Create mapper and actor for silhouette\n    silhouetteMapper = vtkPolyDataMapper()\n    silhouetteMapper.SetInputConnection(silhouette.GetOutputPort())\n\n    silhouetteActor = vtkActor()\n    silhouetteActor.SetMapper(silhouetteMapper)\n    silhouetteActor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n    silhouetteActor.GetProperty().SetLineWidth(5)\n\n    # Set the custom type to use for interaction.\n    style = MouseInteractorHighLightActor(silhouette, silhouetteActor)\n    style.SetDefaultRenderer(renderer)\n\n    # Start\n    interactor.Initialize()\n    interactor.SetInteractorStyle(style)\n    renderWindow.SetWindowName('HighlightWithSilhouette')\n    renderWindow.Render()\n\n    interactor.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
        "},{"location":"Python/Plotting/MultiplePlots/","title":"MultiplePlots","text":"

        vtk-examples/Python/Plotting/MultiplePlots

        "},{"location":"Python/Plotting/MultiplePlots/#description","title":"Description","text":"

        Display multiple plots by using viewports in a single render window.

        In this case, we display two graphs side-by-side.

        The difference between setting a background in the renderer and setting the chart background is shown.

        Note

        This example was prompted by this discussion vtk chart background shifted towards origin.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Plotting/MultiplePlots/#code","title":"Code","text":"

        MultiplePlots.py

        import math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkChartsCore import (\n    vtkAxis,\n    vtkChart,\n    vtkChartXY,\n    vtkPlotPoints\n)\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import vtkTable\nfrom vtkmodules.vtkRenderingContext2D import (\n    vtkContextActor,\n    vtkContextScene\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renwin = vtkRenderWindow()\n    renwin.SetWindowName('MultiplePlots')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renwin)\n\n    # Setup the viewports\n    grid_dimensions_x = 2\n    grid_dimensions_y = 1\n    renderer_sz_x = 320\n    renderer_sz_y = 240\n    renwin.SetSize(renderer_sz_x * grid_dimensions_x, renderer_sz_y * grid_dimensions_y)\n\n    viewports = list()\n    for row in range(0, grid_dimensions_y):\n        for col in range(0, grid_dimensions_x):\n            # index = row * grid_dimensions_x + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewports.append([float(col) / grid_dimensions_x,\n                              float(grid_dimensions_y - (row + 1)) / grid_dimensions_y,\n                              float(col + 1) / grid_dimensions_x,\n                              float(grid_dimensions_y - row) / grid_dimensions_y])\n\n    # Link the renderers to the viewports.\n    left_renderer = vtkRenderer()\n    left_renderer.SetBackground(colors.GetColor3d('AliceBlue'))\n    left_renderer.SetViewport(viewports[0])\n    renwin.AddRenderer(left_renderer)\n\n    right_renderer = vtkRenderer()\n    right_renderer.SetBackground(colors.GetColor3d('Lavender'))\n    right_renderer.SetViewport(viewports[1])\n    renwin.AddRenderer(right_renderer)\n\n    # Create the charts.\n    left_chart = vtkChartXY()\n    left_chart_scene = vtkContextScene()\n    left_chart_actor = vtkContextActor()\n\n    left_chart_scene.AddItem(left_chart)\n    left_chart_actor.SetScene(left_chart_scene)\n\n    left_renderer.AddActor(left_chart_actor)\n    left_chart_scene.SetRenderer(left_renderer)\n\n    x_axis = left_chart.GetAxis(vtkAxis.BOTTOM)\n    x_axis.GetGridPen().SetColor(colors.GetColor4ub(\"LightGrey\"))\n    x_axis.SetTitle('x')\n    y_axis = left_chart.GetAxis(vtkAxis.LEFT)\n    y_axis.GetGridPen().SetColor(colors.GetColor4ub(\"LightGrey\"))\n    y_axis.SetTitle('cos(x)')\n    left_chart.GetBackgroundBrush().SetColorF(*colors.GetColor4d('MistyRose'))\n    left_chart.GetBackgroundBrush().SetOpacityF(0.4)\n    left_chart.SetTitle('Cosine')\n\n    right_chart = vtkChartXY()\n    right_chart_scene = vtkContextScene()\n    right_chart_actor = vtkContextActor()\n\n    right_chart_scene.AddItem(right_chart)\n    right_chart_actor.SetScene(right_chart_scene)\n\n    right_renderer.AddActor(right_chart_actor)\n    right_chart_scene.SetRenderer(right_renderer)\n\n    x_axis = right_chart.GetAxis(vtkAxis.BOTTOM)\n    x_axis.GetGridPen().SetColor(colors.GetColor4ub(\"LightCyan\"))\n    x_axis.SetTitle('x')\n    y_axis = right_chart.GetAxis(vtkAxis.LEFT)\n    y_axis.GetGridPen().SetColor(colors.GetColor4ub(\"LightCyan\"))\n    y_axis.SetTitle('sin(x)')\n    right_chart.GetBackgroundBrush().SetColorF(*colors.GetColor4d('Thistle'))\n    right_chart.GetBackgroundBrush().SetOpacityF(0.4)\n    right_chart.SetTitle('Sine')\n\n    # Create the data.\n    table = vtkTable()\n    array_x = vtkFloatArray()\n    array_x.SetName('X Axis')\n    table.AddColumn(array_x)\n\n    array_cos = vtkFloatArray()\n    array_cos.SetName('Cosine')\n    table.AddColumn(array_cos)\n\n    array_sin = vtkFloatArray()\n    array_sin.SetName('Sine')\n    table.AddColumn(array_sin)\n\n    # Fill in the table with some example values.\n    num_points = 40\n    inc = 7.5 / (num_points - 1.0)\n    table.SetNumberOfRows(num_points)\n    for i in range(num_points):\n        table.SetValue(i, 0, i * inc)\n        table.SetValue(i, 1, math.cos(i * inc))\n        table.SetValue(i, 2, math.sin(i * inc))\n\n    points = left_chart.AddPlot(vtkChart.POINTS)\n    points.SetInputData(table, 0, 1)\n    points.SetColor(*colors.GetColor4ub('Black'))\n    points.SetWidth(1.0)\n    points.SetMarkerStyle(vtkPlotPoints.CROSS)\n\n    points = right_chart.AddPlot(vtkChart.POINTS)\n    points.SetInputData(table, 0, 2)\n    points.SetColor(*colors.GetColor4ub('Black'))\n    points.SetWidth(1.0)\n    points.SetMarkerStyle(vtkPlotPoints.PLUS)\n\n    renwin.Render()\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Plotting/ScatterPlot/","title":"ScatterPlot","text":"

        vtk-examples/Python/Plotting/ScatterPlot

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Plotting/ScatterPlot/#code","title":"Code","text":"

        ScatterPlot.py

        #!/usr/bin/env python\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkChartsCore import (\n    vtkChart,\n    vtkChartXY,\n    vtkPlotPoints\n)\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import vtkTable\nfrom vtkmodules.vtkViewsContext2D import vtkContextView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    view = vtkContextView()\n    view.GetRenderer().SetBackground(colors.GetColor3d('SlateGray'))\n    view.GetRenderWindow().SetSize(400, 300)\n\n    chart = vtkChartXY()\n    view.GetScene().AddItem(chart)\n    chart.SetShowLegend(True)\n\n    table = vtkTable()\n\n    arrX = vtkFloatArray()\n    arrX.SetName('X Axis')\n\n    arrC = vtkFloatArray()\n    arrC.SetName('Cosine')\n\n    arrS = vtkFloatArray()\n    arrS.SetName('Sine')\n\n    arrT = vtkFloatArray()\n    arrT.SetName('Sine-Cosine')\n\n    table.AddColumn(arrC)\n    table.AddColumn(arrS)\n    table.AddColumn(arrX)\n    table.AddColumn(arrT)\n\n    numPoints = 40\n\n    inc = 7.5 / (numPoints - 1)\n    table.SetNumberOfRows(numPoints)\n    for i in range(numPoints):\n        table.SetValue(i, 0, i * inc)\n        table.SetValue(i, 1, math.cos(i * inc))\n        table.SetValue(i, 2, math.sin(i * inc))\n        table.SetValue(i, 3, math.sin(i * inc) - math.cos(i * inc))\n\n    points = chart.AddPlot(vtkChart.POINTS)\n    points.SetInputData(table, 0, 1)\n    points.SetColor(0, 0, 0, 255)\n    points.SetWidth(1.0)\n    points.SetMarkerStyle(vtkPlotPoints.CROSS)\n\n    points = chart.AddPlot(vtkChart.POINTS)\n    points.SetInputData(table, 0, 2)\n    points.SetColor(0, 0, 0, 255)\n    points.SetWidth(1.0)\n    points.SetMarkerStyle(vtkPlotPoints.PLUS)\n\n    points = chart.AddPlot(vtkChart.POINTS)\n    points.SetInputData(table, 0, 3)\n    points.SetColor(0, 0, 255, 255)\n    points.SetWidth(1.0)\n    points.SetMarkerStyle(vtkPlotPoints.CIRCLE)\n\n    view.GetRenderWindow().SetMultiSamples(0)\n    view.GetRenderWindow().SetWindowName('ScatterPlot')\n    view.GetInteractor().Initialize()\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Plotting/SpiderPlot/","title":"SpiderPlot","text":"

        vtk-examples/Python/Plotting/SpiderPlot

        "},{"location":"Python/Plotting/SpiderPlot/#description","title":"Description","text":"

        A spider plot is used to display multivariate data. See this wikipedia article for more information.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Plotting/SpiderPlot/#code","title":"Code","text":"

        SpiderPlot.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkMinimalStandardRandomSequence\n)\nfrom vtkmodules.vtkCommonDataModel import vtkDataObject\nfrom vtkmodules.vtkRenderingAnnotation import vtkSpiderPlotActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    numTuples = 12\n\n    bitter = vtkFloatArray()\n    bitter.SetNumberOfTuples(numTuples)\n\n    crispy = vtkFloatArray()\n    crispy.SetNumberOfTuples(numTuples)\n\n    crunchy = vtkFloatArray()\n    crunchy.SetNumberOfTuples(numTuples)\n\n    salty = vtkFloatArray()\n    salty.SetNumberOfTuples(numTuples)\n\n    oily = vtkFloatArray()\n    oily.SetNumberOfTuples(numTuples)\n\n    rand_seq = vtkMinimalStandardRandomSequence()\n    rand_seq.SetSeed(8775070)\n\n    for i in range(numTuples):\n        bitter.SetTuple1(i, rand_seq.GetRangeValue(1, 10))\n        rand_seq.Next()\n        crispy.SetTuple1(i, rand_seq.GetRangeValue(-1, 1))\n        rand_seq.Next()\n        crunchy.SetTuple1(i, rand_seq.GetRangeValue(1, 100))\n        rand_seq.Next()\n        salty.SetTuple1(i, rand_seq.GetRangeValue(0, 10))\n        rand_seq.Next()\n        oily.SetTuple1(i, rand_seq.GetRangeValue(5, 25))\n        rand_seq.Next()\n\n    dobj = vtkDataObject()\n    dobj.GetFieldData().AddArray(bitter)\n    dobj.GetFieldData().AddArray(crispy)\n    dobj.GetFieldData().AddArray(crunchy)\n    dobj.GetFieldData().AddArray(salty)\n    dobj.GetFieldData().AddArray(oily)\n\n    actor = vtkSpiderPlotActor()\n    actor.SetInputData(dobj)\n    actor.SetTitle(\"Spider Plot\")\n    actor.SetIndependentVariablesToColumns()\n    actor.GetPositionCoordinate().SetValue(0.05, 0.1, 0.0)\n    actor.GetPosition2Coordinate().SetValue(0.95, 0.85, 0.0)\n    actor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    actor.SetAxisLabel(0, \"Bitter\")\n    actor.SetAxisRange(0, 1, 10)\n\n    actor.SetAxisLabel(1, \"Crispy\")\n    actor.SetAxisRange(1, -1, 1)\n\n    actor.SetAxisLabel(2, \"Crunchy\")\n    actor.SetAxisRange(2, 1, 100)\n\n    actor.SetAxisLabel(3, \"Salty\")\n    actor.SetAxisRange(3, 0, 10)\n\n    actor.SetAxisLabel(4, \"Oily\")\n    actor.SetAxisRange(4, 5, 25)\n    actor.GetLegendActor().SetNumberOfEntries(numTuples)\n\n    for i in range(numTuples):\n        r = rand_seq.GetRangeValue(0.4, 1.0)\n        rand_seq.Next()\n        g = rand_seq.GetRangeValue(0.4, 1.0)\n        rand_seq.Next()\n        b = rand_seq.GetRangeValue(0.4, 1.0)\n        rand_seq.Next()\n        actor.SetPlotColor(i, r, g, b)\n\n    actor.LegendVisibilityOn()\n\n    actor.GetTitleTextProperty().SetColor(colors.GetColor3d('MistyRose'))\n    actor.GetLabelTextProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    ren1.AddActor(actor)\n    ren1.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renWin.SetSize(600, 500)\n    renWin.SetWindowName('SpiderPlot')\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Plotting/SurfacePlot/","title":"SurfacePlot","text":"

        vtk-examples/Python/Plotting/SurfacePlot

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Plotting/SurfacePlot/#code","title":"Code","text":"

        SurfacePlot.py

        #!/usr/bin/env python\n\nfrom math import sin, sqrt\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingContextOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkChartsCore import (\n    vtkChartXYZ,\n    vtkPlotSurface\n)\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkFloatArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkRectf,\n    vtkTable,\n    vtkVector2i\n)\nfrom vtkmodules.vtkRenderingContext2D import vtkContextMouseEvent\nfrom vtkmodules.vtkViewsContext2D import vtkContextView\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    chart = vtkChartXYZ()\n    chart.SetGeometry(vtkRectf(10.0, 10.0, 630, 470))\n\n    plot = vtkPlotSurface()\n\n    view = vtkContextView()\n    view.GetRenderer().SetBackground(colors.GetColor3d(\"Silver\"))\n    view.GetRenderWindow().SetSize(640, 480)\n    view.GetScene().AddItem(chart)\n\n    # Create a surface\n    table = vtkTable()\n    numPoints = 70\n    inc = 9.424778 / (numPoints - 1)\n    for i in range(numPoints):\n        arr = vtkFloatArray()\n        table.AddColumn(arr)\n\n    table.SetNumberOfRows(numPoints)\n    for i in range(numPoints):\n        x = i * inc\n        for j in range(numPoints):\n            y = j * inc\n            table.SetValue(i, j, sin(sqrt(x * x + y * y)))\n\n    # Set up the surface plot we wish to visualize and add it to the chart\n    plot.SetXRange(0, 10.0)\n    plot.SetYRange(0, 10.0)\n    plot.SetInputData(table)\n    plot.GetPen().SetColorF(colors.GetColor3d(\"Tomato\"))\n    chart.AddPlot(plot)\n\n    view.GetRenderWindow().SetMultiSamples(0)\n    view.GetInteractor().Initialize()\n    view.GetRenderWindow().SetWindowName(\"SurfacePlot\")\n    view.GetRenderWindow().Render()\n\n    # Rotate\n    mouseEvent = vtkContextMouseEvent()\n    mouseEvent.SetInteractor(view.GetInteractor())\n\n    pos = vtkVector2i()\n\n    lastPos = vtkVector2i()\n    mouseEvent.SetButton(vtkContextMouseEvent.LEFT_BUTTON)\n    lastPos.Set(100, 50)\n    mouseEvent.SetLastScreenPos(lastPos)\n    pos.Set(150, 100)\n    mouseEvent.SetScreenPos(pos)\n\n    sP = [float(x) for x in pos]\n    lSP = [float(x) for x in lastPos]\n    screenPos = [float(x) for x in mouseEvent.GetScreenPos()]\n    lastScreenPos = [float(x) for x in mouseEvent.GetLastScreenPos()]\n\n    chart.MouseMoveEvent(mouseEvent)\n\n    view.GetInteractor().Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/AlignTwoPolyDatas/","title":"AlignTwoPolyDatas","text":"

        vtk-examples/Python/PolyData/AlignTwoPolyDatas

        "},{"location":"Python/PolyData/AlignTwoPolyDatas/#description","title":"Description","text":"

        This example shows how to align two vtkPolyData's. Typically, the two datasets are related. For example, aligning a CT head isosurface with an MRI head isosurface of the same patient. Or two steps in a time series of an evolving surface. These cases usually reside in the same coordinate system, and the initial alignment is \"close\" to the desired results.

        Another case is when the two datasets are from the \"same\" family of objects - for example, running the example with two types of sharks that exist in different coordinate systems.

        The algorithm proceeds as follows:

        1. Read the two vtkPolyData's that exist in the example's command line. The first file contains the source vtkPolyData to be aligned with the second file's vtkPolyData called the target. Another naming convention is moving and fixed.

        2. Compute a measure of fit of the two original files. We use the recently added vtkHausdorffDistancePointSetFilter to compute the measure. See Hausdorff Distance.

        3. Align the bounding boxes of the two datasets. Here we use a vtkOBBTree locator to create oriented bounding boxes. See Oriented Bounding Boxes. Use the bounding box corner coordinates to create source and target vtkLandmarkTransform's. vtkTransformPolyData uses this transform to create a new source vtkPolyData. Since the orientations of the bounding boxes may differ, the AlignBoundingBoxes function tries ten different rotations. For each rotation, it computes the Hausdorff distance between the target's OBB corners and the transformed source's OBB corners. Finally, transform the original source using the smallest distance.

        4. Improve the alignment with vtkIterativeClosestPointTransform with a RigidBody transform. Compute the distance metric again.

        5. Display the source and target vtkPolyData's with the transform that has the best distance metric.

        Info

        The example is run with src/Testing/Data/thingiverse/Grey_Nurse_Shark.stl and src/Testing/Data/greatWhite.stl, in this case, we reorient the target using a rotation. vtkTransformPolyDataFilter is used to get a better fit in this case.

        Info

        If example is run with src/Testing/Data/thingiverse/Grey_Nurse_Shark.stl and src/Testing/Data/shark.ply the fit is really poor and the Iterative Closest Point algotithm fails. So we fallback and use oriented bounding boxes.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/AlignTwoPolyDatas/#code","title":"Code","text":"

        AlignTwoPolyDatas.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport math\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_DOUBLE_MAX,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkIterativeClosestPointTransform,\n    vtkPolyData\n)\nfrom vtkmodules.vtkCommonTransforms import (\n    vtkLandmarkTransform,\n    vtkTransform\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkOBBTree,\n    vtkTransformPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkHausdorffDistancePointSetFilter\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import (\n    vtkPolyDataReader,\n    vtkPolyDataWriter\n    )\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'How to align two vtkPolyData\\'s.'\n    epilogue = '''\n\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('src_fn', help='The polydata source file name,e.g. thingiverse/Grey_Nurse_Shark.stl.')\n    parser.add_argument('tgt_fn', help='The polydata target file name, e.g. greatWhite.stl.')\n\n    args = parser.parse_args()\n\n    return args.src_fn, args.tgt_fn\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    src_fn, tgt_fn = get_program_parameters()\n    print('Loading source:', src_fn)\n    source_polydata = read_poly_data(src_fn)\n    # Save the source polydata in case the alignment process does not improve\n    # segmentation.\n    original_source_polydata = vtkPolyData()\n    original_source_polydata.DeepCopy(source_polydata)\n\n    print('Loading target:', tgt_fn)\n    target_polydata = read_poly_data(tgt_fn)\n\n    # If the target orientation is markedly different, you may need to apply a\n    # transform to orient the target with the source.\n    # For example, when using Grey_Nurse_Shark.stl as the source and\n    # greatWhite.stl as the target, you need to transform the target.\n    trnf = vtkTransform()\n    if Path(src_fn).name == 'Grey_Nurse_Shark.stl' and Path(tgt_fn).name == 'greatWhite.stl':\n        trnf.RotateY(90)\n\n    tpd = vtkTransformPolyDataFilter()\n    tpd.SetTransform(trnf)\n    tpd.SetInputData(target_polydata)\n    tpd.Update()\n\n    renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n\n    distance = vtkHausdorffDistancePointSetFilter()\n    distance.SetInputData(0, tpd.GetOutput())\n    distance.SetInputData(1, source_polydata)\n    distance.Update()\n\n    distance_before_align = distance.GetOutput(0).GetFieldData().GetArray('HausdorffDistance').GetComponent(0, 0)\n\n    # Get initial alignment using oriented bounding boxes.\n    align_bounding_boxes(source_polydata, tpd.GetOutput())\n\n    distance.SetInputData(0, tpd.GetOutput())\n    distance.SetInputData(1, source_polydata)\n    distance.Modified()\n    distance.Update()\n    distance_after_align = distance.GetOutput(0).GetFieldData().GetArray('HausdorffDistance').GetComponent(0, 0)\n\n    best_distance = min(distance_before_align, distance_after_align)\n\n    if distance_after_align > distance_before_align:\n        source_polydata.DeepCopy(original_source_polydata)\n\n    # Refine the alignment using IterativeClosestPoint.\n    icp = vtkIterativeClosestPointTransform()\n    icp.SetSource(source_polydata)\n    icp.SetTarget(tpd.GetOutput())\n    icp.GetLandmarkTransform().SetModeToRigidBody()\n    icp.SetMaximumNumberOfLandmarks(100)\n    icp.SetMaximumMeanDistance(.00001)\n    icp.SetMaximumNumberOfIterations(500)\n    icp.CheckMeanDistanceOn()\n    icp.StartByMatchingCentroidsOn()\n    icp.Update()\n    icp_mean_distance = icp.GetMeanDistance()\n\n    # print(icp)\n\n    lm_transform = icp.GetLandmarkTransform()\n    transform = vtkTransformPolyDataFilter()\n    transform.SetInputData(source_polydata)\n    transform.SetTransform(lm_transform)\n    transform.SetTransform(icp)\n    transform.Update()\n\n    distance.SetInputData(0, tpd.GetOutput())\n    distance.SetInputData(1, transform.GetOutput())\n    distance.Update()\n\n    # Note: If there is an error extracting eigenfunctions, then this will be zero.\n    distance_after_icp = distance.GetOutput(0).GetFieldData().GetArray('HausdorffDistance').GetComponent(0, 0)\n\n    # Check if ICP worked.\n    if not (math.isnan(icp_mean_distance) or math.isinf(icp_mean_distance)):\n        if distance_after_icp < best_distance:\n            best_distance = distance_after_icp\n\n    print('Distances:')\n    print('  Before aligning:                        {:0.5f}'.format(distance_before_align))\n    print('  Aligning using oriented bounding boxes: {:0.5f}'.format(distance_before_align))\n    print('  Aligning using IterativeClosestPoint:   {:0.5f}'.format(distance_after_icp))\n    print('  Best distance:                          {:0.5f}'.format(best_distance))\n\n    # Select the source to use.\n    source_mapper = vtkDataSetMapper()\n    if best_distance == distance_before_align:\n        source_mapper.SetInputData(original_source_polydata)\n        print('Using original alignment')\n    elif best_distance == distance_after_align:\n        source_mapper.SetInputData(source_polydata)\n        print('Using alignment by OBB')\n    else:\n        source_mapper.SetInputConnection(transform.GetOutputPort())\n        print('Using alignment by ICP')\n    source_mapper.ScalarVisibilityOff()\n\n\n    writer = vtkPolyDataWriter()\n    if best_distance == distance_before_align:\n        writer.SetInputData(original_source_polydata)\n    elif best_distance == distance_after_align:\n        writer.SetInputData(source_polydata)\n    else:\n        writer.SetInputData(transform.GetOutput())\n    writer.SetFileName('AlignedSource.vtk')\n    writer.Write()\n    writer.SetInputData(tpd.GetOutput())\n    writer.SetFileName('Target.vtk')\n    writer.Write()\n\n    source_actor = vtkActor()\n    source_actor.SetMapper(source_mapper)\n    source_actor.GetProperty().SetOpacity(0.6)\n    source_actor.GetProperty().SetDiffuseColor(\n        colors.GetColor3d('White'))\n    renderer.AddActor(source_actor)\n\n    target_mapper = vtkDataSetMapper()\n    target_mapper.SetInputData(tpd.GetOutput())\n    target_mapper.ScalarVisibilityOff()\n\n    target_actor = vtkActor()\n    target_actor.SetMapper(target_mapper)\n    target_actor.GetProperty().SetDiffuseColor(\n        colors.GetColor3d('Tomato'))\n    renderer.AddActor(target_actor)\n\n    render_window.AddRenderer(renderer)\n    renderer.SetBackground(colors.GetColor3d(\"sea_green_light\"))\n    renderer.UseHiddenLineRemovalOn()\n\n    if vtk_version_ok(9, 0, 20210718):\n        try:\n            cam_orient_manipulator = vtkCameraOrientationWidget()\n            cam_orient_manipulator.SetParentRenderer(renderer)\n            # Enable the widget.\n            cam_orient_manipulator.On()\n        except AttributeError:\n            pass\n    else:\n        axes = vtkAxesActor()\n        widget = vtkOrientationMarkerWidget()\n        rgba = [0.0, 0.0, 0.0, 0.0]\n        colors.GetColor(\"Carrot\", rgba)\n        widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n        widget.SetOrientationMarker(axes)\n        widget.SetInteractor(interactor)\n        widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n        widget.EnabledOn()\n        widget.InteractiveOn()\n\n    render_window.SetSize(640, 480)\n    render_window.Render()\n    render_window.SetWindowName('AlignTwoPolyDatas')\n\n    interactor.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef read_poly_data(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == \".ply\":\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".vtp\":\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".obj\":\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".stl\":\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".vtk\":\n        reader = vtkPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".g\":\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef align_bounding_boxes(source, target):\n    # Use OBBTree to create an oriented bounding box for target and source\n    source_obb_tree = vtkOBBTree()\n    source_obb_tree.SetDataSet(source)\n    source_obb_tree.SetMaxLevel(1)\n    source_obb_tree.BuildLocator()\n\n    target_obb_tree = vtkOBBTree()\n    target_obb_tree.SetDataSet(target)\n    target_obb_tree.SetMaxLevel(1)\n    target_obb_tree.BuildLocator()\n\n    source_landmarks = vtkPolyData()\n    source_obb_tree.GenerateRepresentation(0, source_landmarks)\n\n    target_landmarks = vtkPolyData()\n    target_obb_tree.GenerateRepresentation(0, target_landmarks)\n\n    lm_transform = vtkLandmarkTransform()\n    lm_transform.SetModeToSimilarity()\n    lm_transform.SetTargetLandmarks(target_landmarks.GetPoints())\n    best_distance = VTK_DOUBLE_MAX\n    best_points = vtkPoints()\n    best_distance = best_bounding_box(\n        \"X\",\n        target,\n        source,\n        target_landmarks,\n        source_landmarks,\n        best_distance,\n        best_points)\n    best_distance = best_bounding_box(\n        \"Y\",\n        target,\n        source,\n        target_landmarks,\n        source_landmarks,\n        best_distance,\n        best_points)\n    best_distance = best_bounding_box(\n        \"Z\",\n        target,\n        source,\n        target_landmarks,\n        source_landmarks,\n        best_distance,\n        best_points)\n\n    lm_transform.SetSourceLandmarks(best_points)\n    lm_transform.Modified()\n\n    lm_transform_pd = vtkTransformPolyDataFilter()\n    lm_transform_pd.SetInputData(source)\n    lm_transform_pd.SetTransform(lm_transform)\n    lm_transform_pd.Update()\n\n    source.DeepCopy(lm_transform_pd.GetOutput())\n\n    return\n\n\ndef best_bounding_box(axis, target, source, target_landmarks, source_landmarks, best_distance, best_points):\n    distance = vtkHausdorffDistancePointSetFilter()\n    test_transform = vtkTransform()\n    test_transform_pd = vtkTransformPolyDataFilter()\n    lm_transform = vtkLandmarkTransform()\n    lm_transform_pd = vtkTransformPolyDataFilter()\n\n    lm_transform.SetModeToSimilarity()\n    lm_transform.SetTargetLandmarks(target_landmarks.GetPoints())\n\n    source_center = source_landmarks.GetCenter()\n\n    delta = 90.0\n    for i in range(0, 4):\n        angle = delta * i\n        # Rotate about center\n        test_transform.Identity()\n        test_transform.Translate(source_center[0], source_center[1], source_center[2])\n        if axis == \"X\":\n            test_transform.RotateX(angle)\n        elif axis == \"Y\":\n            test_transform.RotateY(angle)\n        else:\n            test_transform.RotateZ(angle)\n        test_transform.Translate(-source_center[0], -source_center[1], -source_center[2])\n\n        test_transform_pd.SetTransform(test_transform)\n        test_transform_pd.SetInputData(source_landmarks)\n        test_transform_pd.Update()\n\n        lm_transform.SetSourceLandmarks(test_transform_pd.GetOutput().GetPoints())\n        lm_transform.Modified()\n\n        lm_transform_pd.SetInputData(source)\n        lm_transform_pd.SetTransform(lm_transform)\n        lm_transform_pd.Update()\n\n        distance.SetInputData(0, target)\n        distance.SetInputData(1, lm_transform_pd.GetOutput())\n        distance.Update()\n\n        test_distance = distance.GetOutput(0).GetFieldData().GetArray(\"HausdorffDistance\").GetComponent(0, 0)\n        if test_distance < best_distance:\n            best_distance = test_distance\n            best_points.DeepCopy(test_transform_pd.GetOutput().GetPoints())\n\n    return best_distance\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/BooleanOperationPolyDataFilter/","title":"BooleanOperationPolyDataFilter","text":"

        vtk-examples/Python/PolyData/BooleanOperationPolyDataFilter

        "},{"location":"Python/PolyData/BooleanOperationPolyDataFilter/#description","title":"Description","text":"

        The vtkBooleanOperationPolyDataFilter works best with \"clean\" data, so this examples first runs vtkTriangleFilter and then vtkCleanPolyData.

        This example can be run in three ways:

        1. BooleanOperationPolyDataFilter - Computes the intersection of two spheres
        2. BooleanOperationPolyDataFilter -o intersection|difference|union - Computes the intersection(difference or union) of two spheres
        3. BooleanOperationPolyDataFilter -o intersection|difference|union input1.vtk input2.vtk - Computes the intersection(difference or union) of two vtkPolyData's

        Cite

        See Boolean Operations on Surfaces in VTK Without External Libraries for details on the algorithm.

        Seealso

        LoopBooleanPolyDataFilter, it uses an alternative algorithm to do the boolean operations.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/BooleanOperationPolyDataFilter/#code","title":"Code","text":"

        BooleanOperationPolyDataFilter.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkBooleanOperationPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'How to align two vtkPolyData\\'s.'\n    epilogue = '''\n\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('-o', '--operation', nargs='?', default='intersection', help='The type of  ')\n    parser.add_argument('fn1', nargs='?', default=None, help='The polydata source file name,e.g. Grey_Nurse_Shark.stl.')\n    parser.add_argument('fn2', nargs='?', default=None, help='The polydata target file name, e.g. shark.ply.')\n\n    args = parser.parse_args()\n\n    return args.operation, args.fn1, args.fn2\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    operation, fn1, fn2 = get_program_parameters()\n    if fn1 and fn2:\n        poly1 = ReadPolyData(fn1)\n        tri1 = vtkTriangleFilter()\n        tri1.SetInputData(poly1)\n        clean1 = vtkCleanPolyData()\n        clean1.SetInputConnection(tri1.GetOutputPort())\n        clean1.Update()\n        input1 = clean1.GetOutput()\n\n        poly2 = ReadPolyData(fn2)\n        tri2 = vtkTriangleFilter()\n        tri2.SetInputData(poly2)\n        tri2.Update()\n        clean2 = vtkCleanPolyData()\n        clean2.SetInputConnection(tri2.GetOutputPort())\n        clean2.Update()\n        input2 = clean2.GetOutput()\n    else:\n        sphereSource1 = vtkSphereSource()\n        sphereSource1.SetCenter(0.25, 0, 0)\n        sphereSource1.SetPhiResolution(21)\n        sphereSource1.SetThetaResolution(21)\n        sphereSource1.Update()\n        input1 = sphereSource1.GetOutput()\n\n        sphereSource2 = vtkSphereSource()\n        sphereSource2.Update()\n        input2 = sphereSource2.GetOutput()\n\n    input1Mapper = vtkPolyDataMapper()\n    input1Mapper.SetInputData(input1)\n    input1Mapper.ScalarVisibilityOff()\n    input1Actor = vtkActor()\n    input1Actor.SetMapper(input1Mapper)\n    input1Actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Tomato'))\n    input1Actor.GetProperty().SetSpecular(0.6)\n    input1Actor.GetProperty().SetSpecularPower(20)\n    input1Actor.SetPosition(input1.GetBounds()[1] - input1.GetBounds()[0], 0, 0)\n\n    input2Mapper = vtkPolyDataMapper()\n    input2Mapper.SetInputData(input2)\n    input2Mapper.ScalarVisibilityOff()\n    input2Actor = vtkActor()\n    input2Actor.SetMapper(input2Mapper)\n    input2Actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Mint'))\n    input2Actor.GetProperty().SetSpecular(0.6)\n    input2Actor.GetProperty().SetSpecularPower(20)\n    input2Actor.SetPosition(-(input1.GetBounds()[1] - input1.GetBounds()[0]), 0, 0)\n\n    booleanOperation = vtkBooleanOperationPolyDataFilter()\n    if operation.lower() == 'union':\n        booleanOperation.SetOperationToUnion()\n    elif operation.lower() == 'intersection':\n        booleanOperation.SetOperationToIntersection()\n    elif operation.lower() == 'difference':\n        booleanOperation.SetOperationToDifference()\n    else:\n        print('Unknown operation:', operation)\n        return\n\n    booleanOperation.SetInputData(0, input1)\n    booleanOperation.SetInputData(1, input2)\n\n    booleanOperationMapper = vtkPolyDataMapper()\n    booleanOperationMapper.SetInputConnection(booleanOperation.GetOutputPort())\n    booleanOperationMapper.ScalarVisibilityOff()\n\n    booleanOperationActor = vtkActor()\n    booleanOperationActor.SetMapper(booleanOperationMapper)\n    booleanOperationActor.GetProperty().SetDiffuseColor(colors.GetColor3d('Banana'))\n    booleanOperationActor.GetProperty().SetSpecular(0.6)\n    booleanOperationActor.GetProperty().SetSpecularPower(20)\n\n    renderer = vtkRenderer()\n    renderer.AddViewProp(input1Actor)\n    renderer.AddViewProp(input2Actor)\n    renderer.AddViewProp(booleanOperationActor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('BooleanOperationPolyDataFilter')\n\n    viewUp = [0.0, 0.0, 1.0]\n    position = [0.0, -1.0, 0.0]\n    PositionCamera(renderer, viewUp, position)\n    renderer.GetActiveCamera().Dolly(1.4)\n    renderer.ResetCameraClippingRange()\n\n    renWinInteractor = vtkRenderWindowInteractor()\n    renWinInteractor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    renWinInteractor.Start()\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef PositionCamera(renderer, viewUp, position):\n    renderer.GetActiveCamera().SetViewUp(viewUp)\n    renderer.GetActiveCamera().SetPosition(position)\n    renderer.ResetCamera()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/CellsInsideObject/","title":"CellsInsideObject","text":"

        vtk-examples/Python/PolyData/CellsInsideObject

        "},{"location":"Python/PolyData/CellsInsideObject/#description","title":"Description","text":"

        This example illustrates how to extract the cells that exist inside a closed surface. It uses vtkSelectEnclosedPoints to mark points that are inside and outside the surface. vtkMultiThreshold is used to extract the three meshes into three vtkMultiBlockDataSet's. The cells completely outside are shown in crimson, completely inside are yellow and border cells are green. A translucent copy of the closed surface helps illustrate the selection process.

        If two polydata datasets are provided, the example uses the second as the closed surface. If only one dataset is provided, the closed surface is generated by rotating the first dataset by 90 degrees around its Y axis.

        Info

        The example is run with src/Testing/Data/cow.g.

        Warning

        The surface that contains cells must be closed and manifold. The example does not check for this. Run ClosedSurface (C++) or (Python) to check your surface.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/CellsInsideObject/#code","title":"Code","text":"

        CellsInsideObject.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkDataObject\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkMultiThreshold,\n    vtkTransformPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkSelectEnclosedPoints\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a polydata file of a surface and determine if it is a closed surface.'\n    epilogue = '''\nThis example illustrates how to extract the cells that exist inside a closed surface.\nIt uses vtkSelectEnclosedPoints to mark points that are inside and outside the surface.\nvtkMultiThreshold is used to extract the three meshes into three vtkMultiBlockDataSet's.\nThe cells completely outside are shown in crimson, completely inside are yellow and\n border cells are green.\nA translucent copy of the closed surface helps illustrate the selection process.\n\nIf two polydata datasets are provided, the example uses the second as the closed surface.\nIf only one dataset is provided, the closed surface is generated by rotating the\n first dataset by 90 degrees around its Y axis.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='Enter a polydata file e.g cow.g.')\n    parser.add_argument('filename2', default=None, nargs='?', help='Enter another polydata file e.g cow.g.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\ndef main():\n    fn1, fn2 = get_program_parameters()\n    polyData1 = ReadPolyData(fn1)\n    if fn2:\n        polyData2 = ReadPolyData(fn2)\n    else:\n        # If only one polydata is present, generate a second polydata by\n        # rotating the original about its center.\n        print('Generating modified polyData1')\n        center = polyData1.GetCenter()\n        transform = vtkTransform()\n        transform.Translate(center[0], center[1], center[2])\n        transform.RotateY(90.0)\n        transform.Translate(-center[0], -center[1], -center[2])\n        transformPD = vtkTransformPolyDataFilter()\n        transformPD.SetTransform(transform)\n        transformPD.SetInputData(polyData1)\n        transformPD.Update()\n        polyData2 = transformPD.GetOutput()\n\n    # Mark points inside with 1 and outside with a 0\n    select = vtkSelectEnclosedPoints()\n    select.SetInputData(polyData1)\n    select.SetSurfaceData(polyData2)\n\n    # Extract three meshes, one completely inside, one completely\n    # outside and on the border between the inside and outside.\n\n    threshold = vtkMultiThreshold()\n    # Outside points have a 0 value in ALL points of a cell\n    outsideId = threshold.AddBandpassIntervalSet(\n        0, 0,\n        vtkDataObject.FIELD_ASSOCIATION_POINTS, 'SelectedPoints',\n        0, 1)\n    # Inside points have a 1 value in ALL points of a cell\n    insideId = threshold.AddBandpassIntervalSet(\n        1, 1,\n        vtkDataObject.FIELD_ASSOCIATION_POINTS, 'SelectedPoints',\n        0, 1)\n    # Border points have a 0 or a 1 in at least one point of a cell\n    borderId = threshold.AddIntervalSet(\n        0, 1,\n        vtkMultiThreshold.OPEN, vtkMultiThreshold.OPEN,\n        vtkDataObject.FIELD_ASSOCIATION_POINTS, 'SelectedPoints',\n        0, 0)\n\n    threshold.SetInputConnection(select.GetOutputPort())\n\n    # Select the intervals to be output\n    threshold.OutputSet(outsideId)\n    threshold.OutputSet(insideId)\n    threshold.OutputSet(borderId)\n    threshold.Update()\n\n    # Visualize\n    colors = vtkNamedColors()\n    outsideColor = colors.GetColor3d('Crimson')\n    insideColor = colors.GetColor3d('Banana')\n    borderColor = colors.GetColor3d('Mint')\n    surfaceColor = colors.GetColor3d('Peacock')\n    backgroundColor = colors.GetColor3d('Silver')\n\n    # Outside\n    outsideMapper = vtkDataSetMapper()\n    outsideMapper.SetInputData(threshold.GetOutput().GetBlock(outsideId).GetBlock(0))\n    outsideMapper.ScalarVisibilityOff()\n\n    outsideActor = vtkActor()\n    outsideActor.SetMapper(outsideMapper)\n    outsideActor.GetProperty().SetDiffuseColor(outsideColor)\n    outsideActor.GetProperty().SetSpecular(.6)\n    outsideActor.GetProperty().SetSpecularPower(30)\n\n    # Inside\n    insideMapper = vtkDataSetMapper()\n    insideMapper.SetInputData(threshold.GetOutput().GetBlock(insideId).GetBlock(0))\n    insideMapper.ScalarVisibilityOff()\n\n    insideActor = vtkActor()\n    insideActor.SetMapper(insideMapper)\n    insideActor.GetProperty().SetDiffuseColor(insideColor)\n    insideActor.GetProperty().SetSpecular(.6)\n    insideActor.GetProperty().SetSpecularPower(30)\n    insideActor.GetProperty().EdgeVisibilityOn()\n\n    # Border\n    borderMapper = vtkDataSetMapper()\n    borderMapper.SetInputData(threshold.GetOutput().GetBlock(borderId).GetBlock(0))\n    borderMapper.ScalarVisibilityOff()\n\n    borderActor = vtkActor()\n    borderActor.SetMapper(borderMapper)\n    borderActor.GetProperty().SetDiffuseColor(borderColor)\n    borderActor.GetProperty().SetSpecular(.6)\n    borderActor.GetProperty().SetSpecularPower(30)\n    borderActor.GetProperty().EdgeVisibilityOn()\n\n    surfaceMapper = vtkDataSetMapper()\n    surfaceMapper.SetInputData(polyData2)\n    surfaceMapper.ScalarVisibilityOff()\n\n    # Surface of object containing cell\n    surfaceActor = vtkActor()\n    surfaceActor.SetMapper(surfaceMapper)\n    surfaceActor.GetProperty().SetDiffuseColor(surfaceColor)\n    surfaceActor.GetProperty().SetOpacity(.1)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.SetBackground(backgroundColor)\n    renderer.UseHiddenLineRemovalOn()\n\n    renderer.AddActor(surfaceActor)\n    renderer.AddActor(outsideActor)\n    renderer.AddActor(insideActor)\n    renderer.AddActor(borderActor)\n\n    renderWindow.SetWindowName('CellsInsideObject')\n    renderWindow.Render()\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.GetActiveCamera().Dolly(1.25)\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/ClosedSurface/","title":"ClosedSurface","text":"

        vtk-examples/Python/PolyData/ClosedSurface

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/ClosedSurface/#code","title":"Code","text":"

        ClosedSurface.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkFiltersCore import vtkFeatureEdges\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a polydata file of a surface and determine if it is a closed surface.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Enter a polydata file e.g cow.g.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    fn = get_program_parameters()\n    polyData = ReadPolyData(fn)\n    featureEdges = vtkFeatureEdges()\n    featureEdges.FeatureEdgesOff()\n    featureEdges.BoundaryEdgesOn()\n    featureEdges.NonManifoldEdgesOn()\n    featureEdges.SetInputData(polyData)\n    featureEdges.Update()\n\n    numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfCells()\n\n    if numberOfOpenEdges > 0:\n        print(fn, ': Surface is not closed')\n    else:\n        print(fn, ': Surface is closed')\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/ColoredTriangle/","title":"ColoredTriangle","text":"

        vtk-examples/Python/PolyData/ColoredTriangle

        "},{"location":"Python/PolyData/ColoredTriangle/#decription","title":"Decription","text":"

        Creates a file called TestTriangleColored.vtp.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/ColoredTriangle/#code","title":"Code","text":"

        ColoredTriangle.py

        #!/usr/bin/env python\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkPoints,\n    vtkUnsignedCharArray\n    )\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangle\n    )\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate a colored triangle, then write a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestColoredTriangle.vtp',\n                        type=str, default='TestColoredTriangle.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    # setup points and vertices\n    Points = vtkPoints()\n    Triangles = vtkCellArray()\n\n    Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    Triangle = vtkTriangle()\n    Triangle.GetPointIds().SetId(0, 0)\n    Triangle.GetPointIds().SetId(1, 1)\n    Triangle.GetPointIds().SetId(2, 2)\n    Triangles.InsertNextCell(Triangle)\n\n    # setup colors\n    Colors = vtkUnsignedCharArray()\n    Colors.SetNumberOfComponents(3)\n    Colors.SetName('Colors')\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Red'))\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Lime'))\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Blue'))\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.SetPolys(Triangles)\n\n    polydata.GetPointData().SetScalars(Colors)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/Curvatures/","title":"Curvatures","text":"

        vtk-examples/Python/PolyData/Curvatures

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/Curvatures/#code","title":"Code","text":"

        Curvatures.py

        #!/usr/bin/env python\n\nfrom pathlib import Path\n\nimport numpy as np\nfrom vtkmodules.numpy_interface import dataset_adapter as dsa\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_DOUBLE,\n    vtkIdList,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFeatureEdges,\n    vtkIdFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkCurvatures\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkIOXML import (\n    vtkXMLPolyDataReader,\n    vtkXMLPolyDataWriter\n)\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtk.util import numpy_support\n\n\ndef get_program_parameters(argv):\n    import argparse\n    import textwrap\n\n    description = 'Calculate Gauss or Mean Curvature.'\n    epilogue = textwrap.dedent('''\n    ''')\n    parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=description,\n                                     epilog=epilogue)\n    parser.add_argument('file_name', help=' e.g. cowHead.vtp.')\n    parser.add_argument('-i', default=16, type=int, help='The color map index e.g. 16.')\n    parser.add_argument('-g', help='Use Gaussian Curvature.', action='store_true')\n\n    args = parser.parse_args()\n    return args.file_name, args.i, args.g\n\n\ndef main(argv):\n    file_name, color_map_idx, gaussian_curvature = get_program_parameters(argv)\n\n    if not Path(file_name).is_file():\n        print(f'The path: {file_name} does not exist.')\n        return\n    if gaussian_curvature:\n        curvature = 'Gauss_Curvature'\n    else:\n        curvature = 'Mean_Curvature'\n\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    source = reader.GetOutput()\n\n    cc = vtkCurvatures()\n    cc.SetInputData(source)\n    if gaussian_curvature:\n        cc.SetCurvatureTypeToGaussian()\n        cc.Update()\n    else:\n        cc.SetCurvatureTypeToMean()\n        cc.Update()\n    adjust_edge_curvatures(cc.GetOutput(), curvature)\n    source.GetPointData().AddArray(cc.GetOutput().GetPointData().GetAbstractArray(curvature))\n    scalar_range = source.GetPointData().GetScalars(curvature).GetRange()\n\n    # Uncomment the following lines if you want to write out the polydata.\n    # writer = vtkXMLPolyDataWriter()\n    # writer.SetFileName('Source.vtp')\n    # writer.SetInputData(source)\n    # writer.SetDataModeToAscii()\n    # writer.Write()\n\n    # Build a lookup table\n    color_series = vtkColorSeries()\n    color_series.SetColorScheme(color_map_idx)\n    print(f'Using color scheme #: {color_series.GetColorScheme()}, {color_series.GetColorSchemeName()}')\n\n    lut = vtkColorTransferFunction()\n    lut.SetColorSpaceToHSV()\n\n    # Use a color series to create a transfer function\n    for i in range(0, color_series.GetNumberOfColors()):\n        color = color_series.GetColor(i)\n        double_color = list(map(lambda x: x / 255.0, color))\n        t = scalar_range[0] + (scalar_range[1] - scalar_range[0]) / (color_series.GetNumberOfColors() - 1) * i\n        lut.AddRGBPoint(t, double_color[0], double_color[1], double_color[2])\n\n    colors = vtkNamedColors()\n\n    # Create a mapper and actor.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(source)\n    mapper.SetScalarModeToUsePointFieldData()\n    mapper.SelectColorArray(curvature)\n    mapper.SetScalarRange(scalar_range)\n    mapper.SetLookupTable(lut)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    window_width = 800\n    window_height = 800\n\n    # Create a scalar bar\n    scalar_bar = vtkScalarBarActor()\n    scalar_bar.SetLookupTable(mapper.GetLookupTable())\n    scalar_bar.SetTitle(curvature.replace('_', '\\n'))\n    scalar_bar.UnconstrainedFontSizeOn()\n    scalar_bar.SetNumberOfLabels(5)\n    scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar.SetMaximumHeightInPixels(window_height // 3)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(window_width, window_height)\n    ren_win.SetWindowName('Curvatures')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    # Important: The interactor must be set prior to enabling the widget.\n    iren.SetRenderWindow(ren_win)\n\n    if vtk_version_ok(9, 0, 20210718):\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        cam_orient_manipulator.SetParentRenderer(renderer)\n        # Enable the widget.\n        cam_orient_manipulator.On()\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.AddActor2D(scalar_bar)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    # Render and interact\n    ren_win.Render()\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\ndef adjust_edge_curvatures(source, curvature_name, epsilon=1.0e-08):\n    \"\"\"\n    This function adjusts curvatures along the edges of the surface by replacing\n     the value with the average value of the curvatures of points in the neighborhood.\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param epsilon: Absolute curvature values less than this will be set to zero.\n    :return:\n    \"\"\"\n\n    def point_neighbourhood(pt_id):\n        \"\"\"\n        Find the ids of the neighbours of pt_id.\n\n        :param pt_id: The point id.\n        :return: The neighbour ids.\n        \"\"\"\n        \"\"\"\n        Extract the topological neighbors for point pId. In two steps:\n        1) source.GetPointCells(pt_id, cell_ids)\n        2) source.GetCellPoints(cell_id, cell_point_ids) for all cell_id in cell_ids\n        \"\"\"\n        cell_ids = vtkIdList()\n        source.GetPointCells(pt_id, cell_ids)\n        neighbour = set()\n        for cell_idx in range(0, cell_ids.GetNumberOfIds()):\n            cell_id = cell_ids.GetId(cell_idx)\n            cell_point_ids = vtkIdList()\n            source.GetCellPoints(cell_id, cell_point_ids)\n            for cell_pt_idx in range(0, cell_point_ids.GetNumberOfIds()):\n                neighbour.add(cell_point_ids.GetId(cell_pt_idx))\n        return neighbour\n\n    def compute_distance(pt_id_a, pt_id_b):\n        \"\"\"\n        Compute the distance between two points given their ids.\n\n        :param pt_id_a:\n        :param pt_id_b:\n        :return:\n        \"\"\"\n        pt_a = np.array(source.GetPoint(pt_id_a))\n        pt_b = np.array(source.GetPoint(pt_id_b))\n        return np.linalg.norm(pt_a - pt_b)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    #  Get the boundary point IDs.\n    array_name = 'ids'\n    id_filter = vtkIdFilter()\n    id_filter.SetInputData(source)\n    id_filter.SetPointIds(True)\n    id_filter.SetCellIds(False)\n    id_filter.SetPointIdsArrayName(array_name)\n    id_filter.SetCellIdsArrayName(array_name)\n    id_filter.Update()\n\n    edges = vtkFeatureEdges()\n    edges.SetInputConnection(id_filter.GetOutputPort())\n    edges.BoundaryEdgesOn()\n    edges.ManifoldEdgesOff()\n    edges.NonManifoldEdgesOff()\n    edges.FeatureEdgesOff()\n    edges.Update()\n\n    edge_array = edges.GetOutput().GetPointData().GetArray(array_name)\n    boundary_ids = []\n    for i in range(edges.GetOutput().GetNumberOfPoints()):\n        boundary_ids.append(edge_array.GetValue(i))\n    # Remove duplicate Ids.\n    p_ids_set = set(boundary_ids)\n\n    # Iterate over the edge points and compute the curvature as the weighted\n    # average of the neighbours.\n    count_invalid = 0\n    for p_id in boundary_ids:\n        p_ids_neighbors = point_neighbourhood(p_id)\n        # Keep only interior points.\n        p_ids_neighbors -= p_ids_set\n        # Compute distances and extract curvature values.\n        curvs = [curvatures[p_id_n] for p_id_n in p_ids_neighbors]\n        dists = [compute_distance(p_id_n, p_id) for p_id_n in p_ids_neighbors]\n        curvs = np.array(curvs)\n        dists = np.array(dists)\n        curvs = curvs[dists > 0]\n        dists = dists[dists > 0]\n        if len(curvs) > 0:\n            weights = 1 / np.array(dists)\n            weights /= weights.sum()\n            new_curv = np.dot(curvs, weights)\n        else:\n            # Corner case.\n            count_invalid += 1\n            # Assuming the curvature of the point is planar.\n            new_curv = 0.0\n        # Set the new curvature value.\n        curvatures[p_id] = new_curv\n\n    #  Set small values to zero.\n    if epsilon != 0.0:\n        curvatures = np.where(abs(curvatures) < epsilon, 0, curvatures)\n        # Curvatures is now an ndarray\n        curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                          deep=True,\n                                          array_type=VTK_DOUBLE)\n        curv.SetName(curvature_name)\n        source.GetPointData().RemoveArray(curvature_name)\n        source.GetPointData().AddArray(curv)\n        source.GetPointData().SetActiveScalars(curvature_name)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/PolyData/CurvaturesAdjustEdges/","title":"CurvaturesAdjustEdges","text":"

        vtk-examples/Python/PolyData/CurvaturesAdjustEdges

        "},{"location":"Python/PolyData/CurvaturesAdjustEdges/#description","title":"Description","text":"

        This example demonstrates how to calculate Gaussian and Mean curvatures for a vtkPolyData source. Since edges can produce large discrepancies to curvatures, edge adjustment can be applied. If we know the geometry of the surface we can also modify the curvatures.

        Functions are provided to achieve these aims.

        A histogram of the frequencies is also output to the console. This is useful if you want to get an idea of the distribution of the scalars in each band.

        This example was inspired by these discussions:

        • vtkCurvatures yields unreasonably large values along borders
        • How to extract the ids of the boundary points of a surface?

        Thanks to everyone involved in these discussions.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/CurvaturesAdjustEdges/#code","title":"Code","text":"

        CurvaturesAdjustEdges.py

        #!/usr/bin/env python\n\nimport math\n\nimport numpy as np\nfrom vtkmodules.numpy_interface import dataset_adapter as dsa\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBour,\n    vtkParametricEnneper,\n    vtkParametricMobius,\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_DOUBLE,\n    vtkDoubleArray,\n    vtkFloatArray,\n    vtkIdList,\n    vtkLookupTable,\n    vtkPoints,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDelaunay2D,\n    vtkFeatureEdges,\n    vtkIdFilter,\n    vtkPolyDataNormals,\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkCurvatures,\n    vtkTransformPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkLinearSubdivisionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkParametricFunctionSource,\n    vtkTexturedSphereSource\n)\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\nfrom vtk.util import numpy_support\n\n\ndef main(argv):\n    # desired_surface = 'Bour'\n    # desired_surface = 'Cube'\n    # desired_surface = 'Hills'\n    # desired_surface = 'Enneper'\n    # desired_surface = 'Mobius'\n    desired_surface = 'RandomHills'\n    # desired_surface = 'Sphere'\n    # desired_surface = 'Torus'\n    source = get_source(desired_surface)\n    if not source:\n        print('The surface is not available.')\n        return\n\n    gc = vtkCurvatures()\n    gc.SetInputData(source)\n    gc.SetCurvatureTypeToGaussian()\n    gc.Update()\n    if desired_surface in ['Bour', 'Enneper', 'Hills', 'RandomHills', 'Torus']:\n        adjust_edge_curvatures(gc.GetOutput(), 'Gauss_Curvature')\n    if desired_surface == 'Bour':\n        # Gaussian curvature is -1/(r(r+1)^4))\n        constrain_curvatures(gc.GetOutput(), 'Gauss_Curvature', -0.0625, -0.0625)\n    if desired_surface == 'Enneper':\n        # Gaussian curvature is -4/(1 + r^2)^4\n        constrain_curvatures(gc.GetOutput(), 'Gauss_Curvature', -0.25, -0.25)\n    if desired_surface == 'Cube':\n        constrain_curvatures(gc.GetOutput(), 'Gauss_Curvature', 0.0, 0.0)\n    if desired_surface == 'Mobius':\n        constrain_curvatures(gc.GetOutput(), 'Gauss_Curvature', 0.0, 0.0)\n    if desired_surface == 'Sphere':\n        # Gaussian curvature is 1/r^2\n        constrain_curvatures(gc.GetOutput(), 'Gauss_Curvature', 4.0, 4.0)\n    source.GetPointData().AddArray(\n        gc.GetOutput().GetPointData().GetAbstractArray('Gauss_Curvature'))\n\n    mc = vtkCurvatures()\n    mc.SetInputData(source)\n    mc.SetCurvatureTypeToMean()\n    mc.Update()\n    if desired_surface in ['Bour', 'Enneper', 'Hills', 'RandomHills', 'Torus']:\n        adjust_edge_curvatures(mc.GetOutput(), 'Mean_Curvature')\n    if desired_surface == 'Bour':\n        # Mean curvature is 0\n        constrain_curvatures(mc.GetOutput(), 'Mean_Curvature', 0.0, 0.0)\n    if desired_surface == 'Enneper':\n        # Mean curvature is 0\n        constrain_curvatures(mc.GetOutput(), 'Mean_Curvature', 0.0, 0.0)\n    if desired_surface == 'Sphere':\n        # Mean curvature is 1/r\n        constrain_curvatures(mc.GetOutput(), 'Mean_Curvature', 2.0, 2.0)\n    source.GetPointData().AddArray(\n        mc.GetOutput().GetPointData().GetAbstractArray('Mean_Curvature'))\n\n    # Uncomment the following lines if you want to write out the polydata.\n    # writer = vtkXMLPolyDataWriter()\n    # writer.SetFileName('Source.vtp')\n    # writer.SetInputData(source)\n    # writer.SetDataModeToBinary()\n    # writer.Write()\n\n    # Let's visualise what we have done.\n\n    colors = vtkNamedColors()\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    window_width = 1024\n    window_height = 512\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(window_width, window_height)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    # Create a common text property.\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(24)\n    text_property.SetJustificationToCentered()\n\n    lut = get_diverging_lut()\n    # lut = get_diverging_lut1()\n\n    # Define viewport ranges\n    xmins = [0, 0.5]\n    xmaxs = [0.5, 1]\n    ymins = [0, 0]\n    ymaxs = [1.0, 1.0]\n\n    camera = None\n\n    has_cow = False\n    if vtk_version_ok(9, 0, 20210718):\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        has_cow = True\n\n    curvature_types = ['Gauss_Curvature', 'Mean_Curvature']\n    for idx, curvature_name in enumerate(curvature_types):\n\n        curvature_title = curvature_name.replace('_', '\\n')\n\n        source.GetPointData().SetActiveScalars(curvature_name)\n        scalar_range = source.GetPointData().GetScalars(curvature_name).GetRange()\n\n        bands = get_bands(scalar_range, 10)\n        freq = get_frequencies(bands, source)\n        bands, freq = adjust_ranges(bands, freq)\n        print(curvature_name)\n        print_bands_frequencies(bands, freq)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputData(source)\n        mapper.SetScalarModeToUsePointFieldData()\n        mapper.SelectColorArray(curvature_name)\n        mapper.SetScalarRange(scalar_range)\n        mapper.SetLookupTable(lut)\n\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        # Create a scalar bar\n        scalar_bar = vtkScalarBarActor()\n        scalar_bar.SetLookupTable(mapper.GetLookupTable())\n        scalar_bar.SetTitle(curvature_title)\n        scalar_bar.UnconstrainedFontSizeOn()\n        scalar_bar.SetNumberOfLabels(min(5, len(freq)))\n        scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n        scalar_bar.SetMaximumHeightInPixels(window_height // 3)\n        scalar_bar.SetBarRatio(scalar_bar.GetBarRatio() * 0.5)\n        scalar_bar.SetPosition(0.85, 0.1)\n\n        text_mapper = vtkTextMapper()\n        text_mapper.SetInput(curvature_title)\n        text_mapper.SetTextProperty(text_property)\n\n        text_actor = vtkActor2D()\n        text_actor.SetMapper(text_mapper)\n        text_actor.SetPosition(250, 16)\n\n        renderer = vtkRenderer()\n        renderer.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n        renderer.AddActor(actor)\n        renderer.AddActor(text_actor)\n        renderer.AddActor(scalar_bar)\n\n        ren_win.AddRenderer(renderer)\n\n        if idx == 0:\n            if has_cow:\n                cam_orient_manipulator.SetParentRenderer(renderer)\n            camera = renderer.GetActiveCamera()\n            camera.Elevation(60)\n        else:\n            renderer.SetActiveCamera(camera)\n        renderer.SetViewport(xmins[idx], ymins[idx], xmaxs[idx], ymaxs[idx])\n        renderer.ResetCamera()\n\n    if has_cow:\n        # Enable the widget.\n        cam_orient_manipulator.On()\n\n    ren_win.Render()\n    ren_win.SetWindowName('CurvaturesAdjustEdges')\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\ndef adjust_edge_curvatures(source, curvature_name, epsilon=1.0e-08):\n    \"\"\"\n    This function adjusts curvatures along the edges of the surface by replacing\n     the value with the average value of the curvatures of points in the neighborhood.\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param epsilon: Absolute curvature values less than this will be set to zero.\n    :return:\n    \"\"\"\n\n    def point_neighbourhood(pt_id):\n        \"\"\"\n        Find the ids of the neighbours of pt_id.\n\n        :param pt_id: The point id.\n        :return: The neighbour ids.\n        \"\"\"\n        \"\"\"\n        Extract the topological neighbors for point pId. In two steps:\n        1) source.GetPointCells(pt_id, cell_ids)\n        2) source.GetCellPoints(cell_id, cell_point_ids) for all cell_id in cell_ids\n        \"\"\"\n        cell_ids = vtkIdList()\n        source.GetPointCells(pt_id, cell_ids)\n        neighbour = set()\n        for cell_idx in range(0, cell_ids.GetNumberOfIds()):\n            cell_id = cell_ids.GetId(cell_idx)\n            cell_point_ids = vtkIdList()\n            source.GetCellPoints(cell_id, cell_point_ids)\n            for cell_pt_idx in range(0, cell_point_ids.GetNumberOfIds()):\n                neighbour.add(cell_point_ids.GetId(cell_pt_idx))\n        return neighbour\n\n    def compute_distance(pt_id_a, pt_id_b):\n        \"\"\"\n        Compute the distance between two points given their ids.\n\n        :param pt_id_a:\n        :param pt_id_b:\n        :return:\n        \"\"\"\n        pt_a = np.array(source.GetPoint(pt_id_a))\n        pt_b = np.array(source.GetPoint(pt_id_b))\n        return np.linalg.norm(pt_a - pt_b)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    #  Get the boundary point IDs.\n    array_name = 'ids'\n    id_filter = vtkIdFilter()\n    id_filter.SetInputData(source)\n    id_filter.SetPointIds(True)\n    id_filter.SetCellIds(False)\n    id_filter.SetPointIdsArrayName(array_name)\n    id_filter.SetCellIdsArrayName(array_name)\n    id_filter.Update()\n\n    edges = vtkFeatureEdges()\n    edges.SetInputConnection(id_filter.GetOutputPort())\n    edges.BoundaryEdgesOn()\n    edges.ManifoldEdgesOff()\n    edges.NonManifoldEdgesOff()\n    edges.FeatureEdgesOff()\n    edges.Update()\n\n    edge_array = edges.GetOutput().GetPointData().GetArray(array_name)\n    boundary_ids = []\n    for i in range(edges.GetOutput().GetNumberOfPoints()):\n        boundary_ids.append(edge_array.GetValue(i))\n    # Remove duplicate Ids.\n    p_ids_set = set(boundary_ids)\n\n    # Iterate over the edge points and compute the curvature as the weighted\n    # average of the neighbours.\n    count_invalid = 0\n    for p_id in boundary_ids:\n        p_ids_neighbors = point_neighbourhood(p_id)\n        # Keep only interior points.\n        p_ids_neighbors -= p_ids_set\n        # Compute distances and extract curvature values.\n        curvs = [curvatures[p_id_n] for p_id_n in p_ids_neighbors]\n        dists = [compute_distance(p_id_n, p_id) for p_id_n in p_ids_neighbors]\n        curvs = np.array(curvs)\n        dists = np.array(dists)\n        curvs = curvs[dists > 0]\n        dists = dists[dists > 0]\n        if len(curvs) > 0:\n            weights = 1 / np.array(dists)\n            weights /= weights.sum()\n            new_curv = np.dot(curvs, weights)\n        else:\n            # Corner case.\n            count_invalid += 1\n            # Assuming the curvature of the point is planar.\n            new_curv = 0.0\n        # Set the new curvature value.\n        curvatures[p_id] = new_curv\n\n    #  Set small values to zero.\n    if epsilon != 0.0:\n        curvatures = np.where(abs(curvatures) < epsilon, 0, curvatures)\n        # Curvatures is now an ndarray\n        curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                          deep=True,\n                                          array_type=VTK_DOUBLE)\n        curv.SetName(curvature_name)\n        source.GetPointData().RemoveArray(curvature_name)\n        source.GetPointData().AddArray(curv)\n        source.GetPointData().SetActiveScalars(curvature_name)\n\n\ndef constrain_curvatures(source, curvature_name, lower_bound=0.0, upper_bound=0.0):\n    \"\"\"\n    This function constrains curvatures to the range [lower_bound ... upper_bound].\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param lower_bound: The lower bound.\n    :param upper_bound: The upper bound.\n    :return:\n    \"\"\"\n\n    bounds = list()\n    if lower_bound < upper_bound:\n        bounds.append(lower_bound)\n        bounds.append(upper_bound)\n    else:\n        bounds.append(upper_bound)\n        bounds.append(lower_bound)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    # Set upper and lower bounds.\n    curvatures = np.where(curvatures < bounds[0], bounds[0], curvatures)\n    curvatures = np.where(curvatures > bounds[1], bounds[1], curvatures)\n    # Curvatures is now an ndarray\n    curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                      deep=True,\n                                      array_type=VTK_DOUBLE)\n    curv.SetName(curvature_name)\n    source.GetPointData().RemoveArray(curvature_name)\n    source.GetPointData().AddArray(curv)\n    source.GetPointData().SetActiveScalars(curvature_name)\n\n\ndef get_diverging_lut():\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start point         midPoint            end point\n     cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n     purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n     green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n     blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n     green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n\n    :return:\n    \"\"\"\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    # Cool to warm.\n    ctf.AddRGBPoint(0.0, 0.230, 0.299, 0.754)\n    ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n    ctf.AddRGBPoint(1.0, 0.706, 0.016, 0.150)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef get_diverging_lut1():\n    colors = vtkNamedColors()\n    # Colour transfer function.\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    p1 = [0.0] + list(colors.GetColor3d('MidnightBlue'))\n    p2 = [0.5] + list(colors.GetColor3d('Gainsboro'))\n    p3 = [1.0] + list(colors.GetColor3d('DarkOrange'))\n    ctf.AddRGBPoint(*p1)\n    ctf.AddRGBPoint(*p2)\n    ctf.AddRGBPoint(*p3)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef get_bour():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricBour()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(0.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(3)\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(subdivide.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_hills():\n    # Create four hills on a plane.\n    # This will have regions of negative, zero and positive Gsaussian curvatures.\n\n    x_res = 50\n    y_res = 50\n    x_min = -5.0\n    x_max = 5.0\n    dx = (x_max - x_min) / (x_res - 1)\n    y_min = -5.0\n    y_max = 5.0\n    dy = (y_max - y_min) / (x_res - 1)\n\n    # Make a grid.\n    points = vtkPoints()\n    for i in range(0, x_res):\n        x = x_min + i * dx\n        for j in range(0, y_res):\n            y = y_min + j * dy\n            points.InsertNextPoint(x, y, 0)\n\n    # Add the grid points to a polydata object.\n    plane = vtkPolyData()\n    plane.SetPoints(points)\n\n    # Triangulate the grid.\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(plane)\n    delaunay.Update()\n\n    polydata = delaunay.GetOutput()\n\n    elevation = vtkDoubleArray()\n    elevation.SetNumberOfTuples(points.GetNumberOfPoints())\n\n    #  We define the parameters for the hills here.\n    # [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n    hd = [[-2.5, -2.5, 2.5, 6.5, 3.5], [2.5, 2.5, 2.5, 2.5, 2],\n          [5.0, -2.5, 1.5, 1.5, 2.5], [-5.0, 5, 2.5, 3.0, 3]]\n    xx = [0.0] * 2\n    for i in range(0, points.GetNumberOfPoints()):\n        x = list(polydata.GetPoint(i))\n        for j in range(0, len(hd)):\n            xx[0] = (x[0] - hd[j][0] / hd[j][2]) ** 2.0\n            xx[1] = (x[1] - hd[j][1] / hd[j][3]) ** 2.0\n            x[2] += hd[j][4] * math.exp(-(xx[0] + xx[1]) / 2.0)\n            polydata.GetPoints().SetPoint(i, x)\n            elevation.SetValue(i, x[2])\n\n    textures = vtkFloatArray()\n    textures.SetNumberOfComponents(2)\n    textures.SetNumberOfTuples(2 * polydata.GetNumberOfPoints())\n    textures.SetName(\"Textures\")\n\n    for i in range(0, x_res):\n        tc = [i / (x_res - 1.0), 0.0]\n        for j in range(0, y_res):\n            # tc[1] = 1.0 - j / (y_res - 1.0)\n            tc[1] = j / (y_res - 1.0)\n            textures.SetTuple(i * y_res + j, tc)\n\n    polydata.GetPointData().SetScalars(elevation)\n    polydata.GetPointData().GetScalars().SetName(\"Elevation\")\n    polydata.GetPointData().SetTCoords(textures)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputData(polydata)\n    normals.SetInputData(polydata)\n    normals.SetFeatureAngle(30)\n    normals.SplittingOff()\n\n    tr1 = vtkTransform()\n    tr1.RotateX(-90)\n\n    tf1 = vtkTransformPolyDataFilter()\n    tf1.SetInputConnection(normals.GetOutputPort())\n    tf1.SetTransform(tr1)\n    tf1.Update()\n\n    return tf1.GetOutput()\n\n\ndef get_enneper():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricEnneper()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(0.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_mobius():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricMobius()\n    surface.SetMinimumV(-0.25)\n    surface.SetMaximumV(0.25)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_random_hills():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricRandomHills()\n    surface.SetRandomSeed(1)\n    surface.SetNumberOfHills(30)\n    # If you want a plane\n    # surface.SetHillAmplitude(0)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(surface.GetOutputPort())\n    tangents.Update()\n\n    return tangents.GetOutput()\n\n\ndef get_torus():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricTorus()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_source(source):\n    surface = source.lower()\n    available_surfaces = ['bour', 'cube', 'enneper', 'hills', 'mobius', 'randomhills', 'sphere', 'torus']\n    if surface not in available_surfaces:\n        return None\n    elif surface == 'bour':\n        return get_bour()\n    elif surface == 'cube':\n        return get_cube()\n    elif surface == 'enneper':\n        return get_enneper()\n    elif surface == 'hills':\n        return get_hills()\n    elif surface == 'mobius':\n        return get_mobius()\n    elif surface == 'randomhills':\n        return get_random_hills()\n    elif surface == 'sphere':\n        return get_sphere()\n    elif surface == 'torus':\n        return get_torus()\n    return None\n\n\ndef get_frequencies(bands, src):\n    \"\"\"\n    Count the number of scalars in each band.\n    The scalars used are the active scalars in the polydata.\n\n    :param: bands - The bands.\n    :param: src - The vtkPolyData source.\n    :return: The frequencies of the scalars in each band.\n    \"\"\"\n    freq = dict()\n    for i in range(len(bands)):\n        freq[i] = 0\n    tuples = src.GetPointData().GetScalars().GetNumberOfTuples()\n    for i in range(tuples):\n        x = src.GetPointData().GetScalars().GetTuple1(i)\n        for j in range(len(bands)):\n            if x <= bands[j][2]:\n                freq[j] += 1\n                break\n    return freq\n\n\ndef adjust_ranges(bands, freq):\n    \"\"\"\n    The bands and frequencies are adjusted so that the first and last\n     frequencies in the range are non-zero.\n    :param bands: The bands dictionary.\n    :param freq: The frequency dictionary.\n    :return: Adjusted bands and frequencies.\n    \"\"\"\n    # Get the indices of the first and last non-zero elements.\n    first = 0\n    for k, v in freq.items():\n        if v != 0:\n            first = k\n            break\n    rev_keys = list(freq.keys())[::-1]\n    last = rev_keys[0]\n    for idx in list(freq.keys())[::-1]:\n        if freq[idx] != 0:\n            last = idx\n            break\n    # Now adjust the ranges.\n    min_key = min(freq.keys())\n    max_key = max(freq.keys())\n    for idx in range(min_key, first):\n        freq.pop(idx)\n        bands.pop(idx)\n    for idx in range(last + 1, max_key + 1):\n        freq.popitem()\n        bands.popitem()\n    old_keys = freq.keys()\n    adj_freq = dict()\n    adj_bands = dict()\n\n    for idx, k in enumerate(old_keys):\n        adj_freq[idx] = freq[k]\n        adj_bands[idx] = bands[k]\n\n    return adj_bands, adj_freq\n\n\ndef get_bands(d_r, number_of_bands, precision=2, nearest_integer=False):\n    \"\"\"\n    Divide a range into bands\n    :param: d_r - [min, max] the range that is to be covered by the bands.\n    :param: number_of_bands - The number of bands, a positive integer.\n    :param: precision - The decimal precision of the bounds.\n    :param: nearest_integer - If True then [floor(min), ceil(max)] is used.\n    :return: A dictionary consisting of the band number and [min, midpoint, max] for each band.\n    \"\"\"\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    bands = dict()\n    if (d_r[1] < d_r[0]) or (number_of_bands <= 0):\n        return bands\n    x = list(d_r)\n    if nearest_integer:\n        x[0] = math.floor(x[0])\n        x[1] = math.ceil(x[1])\n    dx = (x[1] - x[0]) / float(number_of_bands)\n    b = [x[0], x[0] + dx / 2.0, x[0] + dx]\n    i = 0\n    while i < number_of_bands:\n        b = list(map(lambda ele_b: round(ele_b, prec), b))\n        if i == 0:\n            b[0] = x[0]\n        bands[i] = b\n        b = [b[0] + dx, b[1] + dx, b[2] + dx]\n        i += 1\n    return bands\n\n\ndef print_bands_frequencies(bands, freq, precision=2):\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    if len(bands) != len(freq):\n        print('Bands and Frequencies must be the same size.')\n        return\n    s = f'Bands & Frequencies:\\n'\n    total = 0\n    width = prec + 6\n    for k, v in bands.items():\n        total += freq[k]\n        for j, q in enumerate(v):\n            if j == 0:\n                s += f'{k:4d} ['\n            if j == len(v) - 1:\n                s += f'{q:{width}.{prec}f}]: {freq[k]:8d}\\n'\n            else:\n                s += f'{q:{width}.{prec}f}, '\n    width = 3 * width + 13\n    s += f'{\"Total\":{width}s}{total:8d}\\n'\n    print(s)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/PolyData/CurvaturesDemo/","title":"CurvaturesDemo","text":"

        vtk-examples/Python/PolyData/CurvaturesDemo

        "},{"location":"Python/PolyData/CurvaturesDemo/#description","title":"Description","text":"

        How to get the Gaussian and Mean curvatures of a surface.

        Two different surfaces are used in this demonstration with each surface coloured according to its Gaussian and Mean curvatures.

        • The first surface is a superquadric surface, this demonstrates the use of extra filters that are needed to get a nice smooth surface.

        • The second surface is a parametric surface, in this case the surface has already been triangulated so no extra processing is necessary.

        In order to get a nice coloured image, a vtkColorTransferFunction has been used to generate a set of colours for the vtkLookupTable tables. We have used a diverging colour space. Because of the symmetry of the ranges selected for the lookup tables, the white colouration represents a midpoint value whilst the blue represents values less than the midpoint value and orange represents colours greater than the midpoint value.

        In the case of the Random Hills Gaussian curvature surface, this colouration shows the nature of the surface quite nicely. The blue areas are saddle points (negative Gaussian curvature) and the orange areas have a positive Gaussian curvature.

        In the case of the mean curvature the blue colouration represents negative curvature perpendicular to one of the principal axes.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/CurvaturesDemo/#code","title":"Code","text":"

        CurvaturesDemo.py

        #!/usr/bin/env python\n\n\"\"\"\nThe purpose of this is to demonstrate how to get the Gaussian and Mean curvatures of a surface.\n\nTwo different surfaces are used in this demonstration with each surface coloured according\n to its Gaussian and Mean curvatures.\n\nThe first surface is a superquadric surface, this demonstrates the use of extra filters\n that are needed to get a nice smooth surface.\n\nThe second surface is a parametric surface, in this case the surface has already been triangulated\nso no extra processing is necessary.\n\nIn order to get a nice coloured image, a vtkColorTransferFunction has been used to generate\n a set of colours for the vtkLookUp tables. We have used a diverging colour space.\nBecause of the symmetry of the ranges selected for the lookup tables, the white colouration\n represents a midpoint value whilst the blue represents values less than the midopoint value\n and orange represents colours greater than the midpoint value.\n\nIn the case of the Random Hills Gaussian Curvature surface, this colouration shows the nature\n of the surface quite nicely. The blue areas are saddle points (negative Gaussian curvature)\n and the orange areas have a positive Gaussian curvature.\nIn the case of the mean curvature the blue colouration is representing negative curvature\n perpendicular to one of the principal axes.\n\nThis example also demonstrates the use of lists and the linking of the elements of the\n lists together to form a pipeline.\n\n\"\"\"\n\nimport numpy as np\nfrom vtkmodules.numpy_interface import dataset_adapter as dsa\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import vtkParametricRandomHills\nfrom vtkmodules.vtkCommonCore import (\n    VTK_DOUBLE,\n    vtkIdList,\n    vtkLookupTable,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkFeatureEdges,\n    vtkIdFilter,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkCurvatures,\n    vtkTransformFilter\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkParametricFunctionSource,\n    vtkSuperquadricSource\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\nfrom vtk.util import numpy_support\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    # We are going to handle two different sources.\n    # The first source is a superquadric source.\n    torus = vtkSuperquadricSource()\n    torus.SetCenter(0.0, 0.0, 0.0)\n    torus.SetScale(1.0, 1.0, 1.0)\n    torus.SetPhiResolution(64)\n    torus.SetThetaResolution(64)\n    torus.SetThetaRoundness(1)\n    torus.SetThickness(0.5)\n    torus.SetSize(0.5)\n    torus.SetToroidal(1)\n\n    # Rotate the torus towards the observer (around the x-axis)\n    toroid_transform = vtkTransform()\n    toroid_transform.RotateX(55)\n\n    toroid_transform_filter = vtkTransformFilter()\n    toroid_transform_filter.SetInputConnection(torus.GetOutputPort())\n    toroid_transform_filter.SetTransform(toroid_transform)\n\n    # The quadric is made of strips, so pass it through a triangle filter as\n    # the curvature filter only operates on polys\n    tri = vtkTriangleFilter()\n    tri.SetInputConnection(toroid_transform_filter.GetOutputPort())\n\n    # The quadric has nasty discontinuities from the way the edges are generated\n    # so let's pass it though a CleanPolyDataFilter and merge any points which\n    # are coincident, or very close\n\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(tri.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    # The next source will be a parametric function\n    rh = vtkParametricRandomHills()\n    rh_fn_src = vtkParametricFunctionSource()\n    rh_fn_src.SetParametricFunction(rh)\n    rh_fn_src.Update()\n\n    sources = list()\n    for i in range(0, 4):\n        cc = vtkCurvatures()\n        if i < 2:\n            cc.SetInputConnection(cleaner.GetOutputPort())\n        else:\n            cc.SetInputConnection(rh_fn_src.GetOutputPort())\n        if i % 2 == 0:\n            cc.SetCurvatureTypeToGaussian()\n            curvature_name = 'Gauss_Curvature'\n        else:\n            cc.SetCurvatureTypeToMean()\n            curvature_name = 'Mean_Curvature'\n        cc.Update()\n        adjust_edge_curvatures(cc.GetOutput(), curvature_name)\n        sources.append(cc.GetOutput())\n\n    curvatures = {\n        0: 'Gauss_Curvature',\n        1: 'Mean_Curvature',\n        2: 'Gauss_Curvature',\n        3: 'Mean_Curvature',\n    }\n\n    # lut = get_diverging_lut()\n    lut = get_diverging_lut1()\n\n    renderers = list()\n    mappers = list()\n    actors = list()\n    text_mappers = list()\n    text_actors = list()\n    scalar_bars = list()\n\n    # Create a common text property.\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(24)\n    text_property.SetJustificationToCentered()\n\n    # RenderWindow Dimensions\n    #\n    renderer_size = 512\n    grid_dimensions = 2\n    window_width = renderer_size * grid_dimensions\n    window_height = renderer_size * grid_dimensions\n\n    # Link the pipeline together.\n    for idx, source in enumerate(sources):\n        curvature_name = curvatures[idx].replace('_', '\\n')\n\n        source.GetPointData().SetActiveScalars(curvatures[idx])\n        scalar_range = source.GetPointData().GetScalars(curvatures[idx]).GetRange()\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[idx].SetInputData(source)\n        mappers[idx].SetScalarModeToUsePointFieldData()\n        mappers[idx].SelectColorArray(curvatures[idx])\n        mappers[idx].SetScalarRange(scalar_range)\n        mappers[idx].SetLookupTable(lut)\n\n        actors.append(vtkActor())\n        actors[idx].SetMapper(mappers[idx])\n\n        text_mappers.append(vtkTextMapper())\n        text_mappers[idx].SetInput(curvature_name)\n        text_mappers[idx].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[idx].SetMapper(text_mappers[idx])\n        text_actors[idx].SetPosition(250, 16)\n\n        # Create a scalar bar\n        scalar_bars.append(vtkScalarBarActor())\n        scalar_bars[idx].SetLookupTable(mappers[idx].GetLookupTable())\n        scalar_bars[idx].SetTitle(curvature_name)\n        scalar_bars[idx].UnconstrainedFontSizeOn()\n        scalar_bars[idx].SetNumberOfLabels(5)\n        scalar_bars[idx].SetMaximumWidthInPixels(window_width // 8)\n        scalar_bars[idx].SetMaximumHeightInPixels(window_height // 3)\n        scalar_bars[idx].SetBarRatio(scalar_bars[idx].GetBarRatio() * 0.5)\n        scalar_bars[idx].SetPosition(0.85, 0.1)\n\n        renderers.append(vtkRenderer())\n\n    for idx in range(len(sources)):\n        if idx < grid_dimensions * grid_dimensions:\n            renderers.append(vtkRenderer)\n\n    # Create the RenderWindow\n    #\n    render_window = vtkRenderWindow()\n    render_window.SetSize(renderer_size * grid_dimensions, renderer_size * grid_dimensions)\n    render_window.SetWindowName('CurvaturesDemo')\n\n    # Add and position the renders to the render window.\n    viewport = list()\n    for row in range(grid_dimensions):\n        for col in range(grid_dimensions):\n            idx = row * grid_dimensions + col\n\n            viewport[:] = []\n            viewport.append(float(col) / grid_dimensions)\n            viewport.append(float(grid_dimensions - (row + 1)) / grid_dimensions)\n            viewport.append(float(col + 1) / grid_dimensions)\n            viewport.append(float(grid_dimensions - row) / grid_dimensions)\n\n            if idx > (len(sources) - 1):\n                continue\n\n            renderers[idx].SetViewport(viewport)\n            render_window.AddRenderer(renderers[idx])\n\n            renderers[idx].AddActor(actors[idx])\n            renderers[idx].AddActor(text_actors[idx])\n            renderers[idx].AddActor(scalar_bars[idx])\n            renderers[idx].SetBackground(colors.GetColor3d('SlateGray'))\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n    style = vtkInteractorStyleTrackballCamera()\n    interactor.SetInteractorStyle(style)\n\n    render_window.Render()\n\n    interactor.Start()\n\n\ndef get_diverging_lut():\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start point         midPoint            end point\n     cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n     purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n     green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n     blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n     green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n\n    :return:\n    \"\"\"\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    # Cool to warm.\n    ctf.AddRGBPoint(0.0, 0.230, 0.299, 0.754)\n    ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n    ctf.AddRGBPoint(1.0, 0.706, 0.016, 0.150)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef get_diverging_lut1():\n    colors = vtkNamedColors()\n    # Colour transfer function.\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    p1 = [0.0] + list(colors.GetColor3d('MidnightBlue'))\n    p2 = [0.5] + list(colors.GetColor3d('Gainsboro'))\n    p3 = [1.0] + list(colors.GetColor3d('DarkOrange'))\n    ctf.AddRGBPoint(*p1)\n    ctf.AddRGBPoint(*p2)\n    ctf.AddRGBPoint(*p3)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\ndef adjust_edge_curvatures(source, curvature_name, epsilon=1.0e-08):\n    \"\"\"\n    This function adjusts curvatures along the edges of the surface by replacing\n     the value with the average value of the curvatures of points in the neighborhood.\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param epsilon: Absolute curvature values less than this will be set to zero.\n    :return:\n    \"\"\"\n\n    def point_neighbourhood(pt_id):\n        \"\"\"\n        Find the ids of the neighbours of pt_id.\n\n        :param pt_id: The point id.\n        :return: The neighbour ids.\n        \"\"\"\n        \"\"\"\n        Extract the topological neighbors for point pId. In two steps:\n        1) source.GetPointCells(pt_id, cell_ids)\n        2) source.GetCellPoints(cell_id, cell_point_ids) for all cell_id in cell_ids\n        \"\"\"\n        cell_ids = vtkIdList()\n        source.GetPointCells(pt_id, cell_ids)\n        neighbour = set()\n        for cell_idx in range(0, cell_ids.GetNumberOfIds()):\n            cell_id = cell_ids.GetId(cell_idx)\n            cell_point_ids = vtkIdList()\n            source.GetCellPoints(cell_id, cell_point_ids)\n            for cell_pt_idx in range(0, cell_point_ids.GetNumberOfIds()):\n                neighbour.add(cell_point_ids.GetId(cell_pt_idx))\n        return neighbour\n\n    def compute_distance(pt_id_a, pt_id_b):\n        \"\"\"\n        Compute the distance between two points given their ids.\n\n        :param pt_id_a:\n        :param pt_id_b:\n        :return:\n        \"\"\"\n        pt_a = np.array(source.GetPoint(pt_id_a))\n        pt_b = np.array(source.GetPoint(pt_id_b))\n        return np.linalg.norm(pt_a - pt_b)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    #  Get the boundary point IDs.\n    array_name = 'ids'\n    id_filter = vtkIdFilter()\n    id_filter.SetInputData(source)\n    id_filter.SetPointIds(True)\n    id_filter.SetCellIds(False)\n    id_filter.SetPointIdsArrayName(array_name)\n    id_filter.SetCellIdsArrayName(array_name)\n    id_filter.Update()\n\n    edges = vtkFeatureEdges()\n    edges.SetInputConnection(id_filter.GetOutputPort())\n    edges.BoundaryEdgesOn()\n    edges.ManifoldEdgesOff()\n    edges.NonManifoldEdgesOff()\n    edges.FeatureEdgesOff()\n    edges.Update()\n\n    edge_array = edges.GetOutput().GetPointData().GetArray(array_name)\n    boundary_ids = []\n    for i in range(edges.GetOutput().GetNumberOfPoints()):\n        boundary_ids.append(edge_array.GetValue(i))\n    # Remove duplicate Ids.\n    p_ids_set = set(boundary_ids)\n\n    # Iterate over the edge points and compute the curvature as the weighted\n    # average of the neighbours.\n    count_invalid = 0\n    for p_id in boundary_ids:\n        p_ids_neighbors = point_neighbourhood(p_id)\n        # Keep only interior points.\n        p_ids_neighbors -= p_ids_set\n        # Compute distances and extract curvature values.\n        curvs = [curvatures[p_id_n] for p_id_n in p_ids_neighbors]\n        dists = [compute_distance(p_id_n, p_id) for p_id_n in p_ids_neighbors]\n        curvs = np.array(curvs)\n        dists = np.array(dists)\n        curvs = curvs[dists > 0]\n        dists = dists[dists > 0]\n        if len(curvs) > 0:\n            weights = 1 / np.array(dists)\n            weights /= weights.sum()\n            new_curv = np.dot(curvs, weights)\n        else:\n            # Corner case.\n            count_invalid += 1\n            # Assuming the curvature of the point is planar.\n            new_curv = 0.0\n        # Set the new curvature value.\n        curvatures[p_id] = new_curv\n\n    #  Set small values to zero.\n    if epsilon != 0.0:\n        curvatures = np.where(abs(curvatures) < epsilon, 0, curvatures)\n        # Curvatures is now an ndarray\n        curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                          deep=True,\n                                          array_type=VTK_DOUBLE)\n        curv.SetName(curvature_name)\n        source.GetPointData().RemoveArray(curvature_name)\n        source.GetPointData().AddArray(curv)\n        source.GetPointData().SetActiveScalars(curvature_name)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/PolyData/ExtractPolyLinesFromPolyData/","title":"ExtractPolyLinesFromPolyData","text":"

        vtk-examples/Python/PolyData/ExtractPolyLinesFromPolyData

        "},{"location":"Python/PolyData/ExtractPolyLinesFromPolyData/#description","title":"Description","text":"

        This example uses vtkCutter to create contour lines. It processes these lines with vtkStripper to create continuous poly lines. After exiting the example with the \"e\" key, the lines are printed.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/ExtractPolyLinesFromPolyData/#code","title":"Code","text":"

        ExtractPolyLinesFromPolyData.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdList\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCutter,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    lineColor = colors.GetColor3d('peacock')\n    modelColor = colors.GetColor3d('silver')\n    backgroundColor = colors.GetColor3d('wheat')\n\n    modelSource = vtkSphereSource()\n\n    plane = vtkPlane()\n\n    cutter = vtkCutter()\n    cutter.SetInputConnection(modelSource.GetOutputPort())\n    cutter.SetCutFunction(plane)\n    cutter.GenerateValues(10, -0.5, 0.5)\n\n    modelMapper = vtkPolyDataMapper()\n    modelMapper.SetInputConnection(modelSource.GetOutputPort())\n\n    model = vtkActor()\n    model.SetMapper(modelMapper)\n    model.GetProperty().SetDiffuseColor(modelColor)\n    model.GetProperty().SetInterpolationToFlat()\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(cutter.GetOutputPort())\n    stripper.JoinContiguousSegmentsOn()\n\n    linesMapper = vtkPolyDataMapper()\n    linesMapper.SetInputConnection(stripper.GetOutputPort())\n\n    lines = vtkActor()\n    lines.SetMapper(linesMapper)\n    lines.GetProperty().SetDiffuseColor(lineColor)\n    lines.GetProperty().SetLineWidth(3.)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('ExtractPolyLinesFromPolyData')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the renderer.\n    renderer.AddActor(model)\n    renderer.AddActor(lines)\n    renderer.SetBackground(backgroundColor)\n    renderer.GetActiveCamera().Azimuth(-45)\n    renderer.GetActiveCamera().Elevation(-22.5)\n    renderer.ResetCamera()\n\n    # This starts the event loop and as a side effect causes an\n    # initial render.\n    renderWindow.Render()\n    interactor.Start()\n\n    # Extract the lines from the polydata.\n    numberOfLines = cutter.GetOutput().GetNumberOfLines()\n\n    print('-----------Lines without using vtkStripper')\n    print('There are {0} lines in the polydata'.format(numberOfLines))\n\n    numberOfLines = stripper.GetOutput().GetNumberOfLines()\n    points = stripper.GetOutput().GetPoints()\n    cells = stripper.GetOutput().GetLines()\n    cells.InitTraversal()\n\n    print('-----------Lines using vtkStripper')\n    print('There are {0} lines in the polydata'.format(numberOfLines))\n\n    indices = vtkIdList()\n    lineCount = 0\n\n    while cells.GetNextCell(indices):\n        print('Line {0}:'.format(lineCount))\n        for i in range(indices.GetNumberOfIds()):\n            point = points.GetPoint(indices.GetId(i))\n            print('\\t({0:0.6f} ,{1:0.6f}, {2:0.6f})'.format(point[0], point[1], point[2]))\n        lineCount += 1\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/ExtractSelection/","title":"ExtractSelection","text":"

        vtk-examples/Python/PolyData/ExtractSelection

        "},{"location":"Python/PolyData/ExtractSelection/#description","title":"Description","text":"

        This example creates 50 random points and extracts 10 of them (the points with ids 10-19).

        Also demonstrated is how to invert the selection.

        The three actors in the render window display from left to right:

        • all the points
        • the selected points
        • the points not selected.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/ExtractSelection/#code","title":"Code","text":"

        ExtractSelection.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdTypeArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkSelection,\n    vtkSelectionNode,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractSelection\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    point_source = vtkPointSource()\n\n    point_source.SetNumberOfPoints(50)\n    point_source.Update()\n\n    print('There are', point_source.GetOutput().GetNumberOfPoints(), 'input points.')\n\n    ids = vtkIdTypeArray()\n    ids.SetNumberOfComponents(1)\n\n    # Set values.\n    for i in range(10, 20):\n        ids.InsertNextValue(i)\n\n    selection_node = vtkSelectionNode()\n    selection_node.SetFieldType(vtkSelectionNode.POINT)\n    selection_node.SetContentType(vtkSelectionNode.INDICES)\n    selection_node.SetSelectionList(ids)\n\n    selection = vtkSelection()\n    selection.AddNode(selection_node)\n\n    extract_selection = vtkExtractSelection()\n    extract_selection.SetInputConnection(0, point_source.GetOutputPort())\n    extract_selection.SetInputData(1, selection)\n    extract_selection.Update()\n\n    # In selection.\n    selected = vtkUnstructuredGrid()\n    selected.ShallowCopy(extract_selection.GetOutput())\n\n    print('There are', selected.GetNumberOfPoints(), 'points and', selected.GetNumberOfCells(),\n          'cells in the selection.')\n\n    # Get points that are NOT in the selection.\n    selection_node.GetProperties().Set(vtkSelectionNode().INVERSE(), 1)  # invert the selection.\n    extract_selection.Update()\n\n    not_selected = vtkUnstructuredGrid()\n    not_selected.ShallowCopy(extract_selection.GetOutput())\n\n    print('There are', not_selected.GetNumberOfPoints(), 'points and', not_selected.GetNumberOfCells(),\n          'cells NOT in the selection.')\n\n    input_mapper = vtkDataSetMapper()\n    input_mapper.SetInputConnection(point_source.GetOutputPort())\n    input_actor = vtkActor()\n    input_actor.SetMapper(input_mapper)\n    input_actor.GetProperty().SetColor(colors.GetColor3d(\"MidnightBlue\"))\n    input_actor.GetProperty().SetPointSize(5)\n\n    selected_mapper = vtkDataSetMapper()\n    selected_mapper.SetInputData(selected)\n\n    selected_actor = vtkActor()\n    selected_actor.SetMapper(selected_mapper)\n    selected_actor.GetProperty().SetColor(colors.GetColor3d(\"MidnightBlue\"))\n    selected_actor.GetProperty().SetPointSize(5)\n\n    not_selected_mapper = vtkDataSetMapper()\n    not_selected_mapper.SetInputData(not_selected)\n\n    not_selected_actor = vtkActor()\n    not_selected_actor.SetMapper(not_selected_mapper)\n    not_selected_actor.GetProperty().SetColor(colors.GetColor3d(\"MidnightBlue\"))\n    not_selected_actor.GetProperty().SetPointSize(5)\n\n    # There will be one render window.\n    render_window = vtkRenderWindow()\n    render_window.SetSize(900, 300)\n    render_window.SetWindowName(\"ExtractSelectedIds\")\n\n    # And one interactor.\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n\n    # Define viewport ranges.\n    # (xmin, ymin, xmax, ymax)\n    left_viewport = [0.0, 0.0, 0.33, 1.0]\n    center_viewport = [0.33, 0.0, 0.66, 1.0]\n    right_viewport = [0.66, 0.0, 1.0, 1.0]\n\n    # Create a camera for all renderers.\n    camera = vtkCamera()\n\n    # Setup the renderers\n    left_renderer = vtkRenderer()\n    render_window.AddRenderer(left_renderer)\n    left_renderer.SetViewport(left_viewport)\n    left_renderer.SetBackground(colors.GetColor3d(\"BurlyWood\"))\n    left_renderer.SetActiveCamera(camera)\n\n    center_renderer = vtkRenderer()\n    render_window.AddRenderer(center_renderer)\n    center_renderer.SetViewport(center_viewport)\n    center_renderer.SetBackground(colors.GetColor3d(\"orchid_dark\"))\n    center_renderer.SetActiveCamera(camera)\n\n    right_renderer = vtkRenderer()\n    render_window.AddRenderer(right_renderer)\n    right_renderer.SetViewport(right_viewport)\n    right_renderer.SetBackground(colors.GetColor3d(\"CornflowerBlue\"))\n    right_renderer.SetActiveCamera(camera)\n\n    left_renderer.AddActor(input_actor)\n    center_renderer.AddActor(selected_actor)\n    right_renderer.AddActor(not_selected_actor)\n\n    left_renderer.ResetCamera()\n\n    render_window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/PolyData/ExtractSelectionCells/","title":"ExtractSelectionCells","text":"

        vtk-examples/Python/PolyData/ExtractSelectionCells

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/ExtractSelectionCells/#code","title":"Code","text":"

        ExtractSelectionCells.py

        #!/usr/bin/env python\n\n'''\nconverted from:\n - http://www.org/Wiki/VTK/Examples/Cxx/PolyData/ExtractSelectionCells\n'''\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdTypeArray\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkSelection,\n    vtkSelectionNode,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractSelection\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('leftBkg', [0.6, 0.5, 0.4, 1.0])\n    # colors.SetColor('centreBkg', [0.3, 0.1, 0.4, 1.0])\n    # colors.SetColor('rightBkg', [0.4, 0.5, 0.6, 1.0])\n\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    print('There are %s input points' % sphereSource.GetOutput().GetNumberOfPoints())\n    print('There are %s input cells' % sphereSource.GetOutput().GetNumberOfCells())\n\n    ids = vtkIdTypeArray()\n    ids.SetNumberOfComponents(1)\n\n    # Specify that we want to extract cells 10 through 19\n    i = 10\n    while i < 20:\n        ids.InsertNextValue(i)\n        i += 1\n\n    selectionNode = vtkSelectionNode()\n    selectionNode.SetFieldType(vtkSelectionNode.CELL)\n    selectionNode.SetContentType(vtkSelectionNode.INDICES)\n    selectionNode.SetSelectionList(ids)\n\n    selection = vtkSelection()\n    selection.AddNode(selectionNode)\n\n    extractSelection = vtkExtractSelection()\n    extractSelection.SetInputConnection(0, sphereSource.GetOutputPort())\n    extractSelection.SetInputData(1, selection)\n    extractSelection.Update()\n\n    # In selection\n    selected = vtkUnstructuredGrid()\n    selected.ShallowCopy(extractSelection.GetOutput())\n\n    print('There are %s points in the selection' % selected.GetNumberOfPoints())\n    print('There are %s cells in the selection' % selected.GetNumberOfCells())\n\n    # Get points that are NOT in the selection\n    selectionNode.GetProperties().Set(vtkSelectionNode.INVERSE(), 1)  # invert the selection\n    extractSelection.Update()\n\n    notSelected = vtkUnstructuredGrid()\n    notSelected.ShallowCopy(extractSelection.GetOutput())\n\n    print('There are %s points NOT in the selection' % notSelected.GetNumberOfPoints())\n    print('There are %s cells NOT in the selection' % notSelected.GetNumberOfCells())\n\n    backfaces = vtkProperty()\n    backfaces.SetColor(colors.GetColor3d('Gold'))\n\n    inputMapper = vtkDataSetMapper()\n    inputMapper.SetInputConnection(sphereSource.GetOutputPort())\n    inputActor = vtkActor()\n    inputActor.SetMapper(inputMapper)\n    inputActor.SetBackfaceProperty(backfaces)\n    inputActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    selectedMapper = vtkDataSetMapper()\n    selectedMapper.SetInputData(selected)\n\n    selectedActor = vtkActor()\n    selectedActor.SetMapper(selectedMapper)\n    selectedActor.SetBackfaceProperty(backfaces)\n    selectedActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    notSelectedMapper = vtkDataSetMapper()\n    notSelectedMapper.SetInputData(notSelected)\n\n    notSelectedActor = vtkActor()\n    notSelectedActor.SetMapper(notSelectedMapper)\n    notSelectedActor.SetBackfaceProperty(backfaces)\n    notSelectedActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # There will be one render window\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(900, 300)\n    renderWindow.SetWindowName('ExtractSelectionCells')\n\n    # And one interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Define viewport ranges\n    # (xmin, ymin, xmax, ymax)\n    leftViewport = [0.0, 0.0, 0.33, 1.0]\n    centerViewport = [0.33, 0.0, 0.66, 1.0]\n    rightViewport = [0.66, 0.0, 1.0, 1.0]\n\n    # Create a camera for all renderers\n    camera = vtkCamera()\n\n    # Setup the renderers\n    leftRenderer = vtkRenderer()\n    renderWindow.AddRenderer(leftRenderer)\n    leftRenderer.SetViewport(leftViewport)\n    leftRenderer.SetBackground(colors.GetColor3d('BurlyWood'))\n    leftRenderer.SetActiveCamera(camera)\n\n    centerRenderer = vtkRenderer()\n    renderWindow.AddRenderer(centerRenderer)\n    centerRenderer.SetViewport(centerViewport)\n    centerRenderer.SetBackground(colors.GetColor3d('orchid_dark'))\n    centerRenderer.SetActiveCamera(camera)\n\n    rightRenderer = vtkRenderer()\n    renderWindow.AddRenderer(rightRenderer)\n    rightRenderer.SetViewport(rightViewport)\n    rightRenderer.SetBackground(colors.GetColor3d('CornflowerBlue'))\n    rightRenderer.SetActiveCamera(camera)\n\n    leftRenderer.AddActor(inputActor)\n    centerRenderer.AddActor(selectedActor)\n    rightRenderer.AddActor(notSelectedActor)\n\n    leftRenderer.ResetCamera()\n\n    renderWindow.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/FilledPolygon/","title":"FilledPolygon","text":"

        vtk-examples/Python/PolyData/FilledPolygon

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/FilledPolygon/#code","title":"Code","text":"

        FilledPolygon.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkPlane,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCutter,\n    vtkFeatureEdges,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a cube\n    cube = vtkSphereSource()\n    cube.SetRadius(50)\n    cube.SetThetaResolution(100)\n    cube.SetPhiResolution(100)\n\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputConnection(cube.GetOutputPort())\n\n    # create a plane to cut,here it cuts in the XZ direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0)\n    plane = vtkPlane()\n    plane.SetOrigin(20, 0, 0)\n    plane.SetNormal(1, 0, 0)\n\n    # create cutter\n    cutter = vtkCutter()\n    cutter.SetCutFunction(plane)\n    cutter.SetInputConnection(cube.GetOutputPort())\n    cutter.Update()\n\n    FeatureEdges = vtkFeatureEdges()\n    FeatureEdges.SetInputConnection(cutter.GetOutputPort())\n    FeatureEdges.BoundaryEdgesOn()\n    FeatureEdges.FeatureEdgesOff()\n    FeatureEdges.NonManifoldEdgesOff()\n    FeatureEdges.ManifoldEdgesOff()\n    FeatureEdges.Update()\n\n    cutStrips = vtkStripper()  # Forms loops (closed polylines) from cutter\n    cutStrips.SetInputConnection(cutter.GetOutputPort())\n    cutStrips.Update()\n    cutPoly = vtkPolyData()  # This trick defines polygons as polyline loop\n    cutPoly.SetPoints((cutStrips.GetOutput()).GetPoints())\n    cutPoly.SetPolys((cutStrips.GetOutput()).GetLines())\n\n    cutMapper = vtkPolyDataMapper()\n    # cutMapper.SetInput(FeatureEdges.GetOutput())\n    cutMapper.SetInputData(cutPoly)\n\n    backface = vtkProperty()\n    backface.SetColor(colors.GetColor3d('Gold'))\n\n    cutActor = vtkActor()\n    cutActor.SetMapper(cutMapper)\n    cutActor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n    cutActor.GetProperty().SetEdgeColor(colors.GetColor3d('Red'))\n    cutActor.GetProperty().SetLineWidth(2)\n    cutActor.GetProperty().EdgeVisibilityOn()\n    # cutActor.GetProperty().SetOpacity(0.7)\n    cutActor.SetBackfaceProperty(backface)\n\n    # create renderers and add actors of plane and cube\n    ren = vtkRenderer()\n    ren.AddActor(cutActor)\n\n    # Add renderer to renderwindow and render\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(600, 400)\n    renWin.SetWindowName('FilledPolygon')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    ren.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    ren.GetActiveCamera().SetPosition(223, -122, -91)\n    renWin.Render()\n\n    camera = ren.GetActiveCamera()\n    camera.SetPosition(151.519511, 12.795117, -223.586044)\n    camera.SetFocalPoint(12.518283, 1.963242, 7.618042)\n    camera.SetViewUp(0.740690, -0.523767, 0.420769)\n    camera.SetDistance(269.988889)\n    camera.SetClippingRange(175.347580, 366.490816)\n    camera.Zoom(1.5)\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/ImplicitPolyDataDistance/","title":"ImplicitPolyDataDistance","text":"

        vtk-examples/Python/PolyData/ImplicitPolyDataDistance

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/ImplicitPolyDataDistance/#code","title":"Code","text":"

        ImplicitPolyDataDistance.py

        #!/usr/bin/env python\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkImplicitPolyDataDistance\nfrom vtkmodules.vtkFiltersGeneral import vtkVertexGlyphFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(1.0)\n    sphereSource.Update()\n\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphereSource.GetOutputPort())\n    sphereMapper.ScalarVisibilityOff()\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor.GetProperty().SetOpacity(0.3)\n    sphereActor.GetProperty().SetColor(1, 0, 0)\n\n    implicitPolyDataDistance = vtkImplicitPolyDataDistance()\n    implicitPolyDataDistance.SetInput(sphereSource.GetOutput())\n\n    # Setup a grid\n    points = vtkPoints()\n    step = 0.1\n    for x in np.arange(-2, 2, step):\n        for y in np.arange(-2, 2, step):\n            for z in np.arange(-2, 2, step):\n                points.InsertNextPoint(x, y, z)\n\n    # Add distances to each point\n    signedDistances = vtkFloatArray()\n    signedDistances.SetNumberOfComponents(1)\n    signedDistances.SetName('SignedDistances')\n\n    # Evaluate the signed distance function at all of the grid points\n    for pointId in range(points.GetNumberOfPoints()):\n        p = points.GetPoint(pointId)\n        signedDistance = implicitPolyDataDistance.EvaluateFunction(p)\n        signedDistances.InsertNextValue(signedDistance)\n\n    polyData = vtkPolyData()\n    polyData.SetPoints(points)\n    polyData.GetPointData().SetScalars(signedDistances)\n\n    vertexGlyphFilter = vtkVertexGlyphFilter()\n    vertexGlyphFilter.SetInputData(polyData)\n    vertexGlyphFilter.Update()\n\n    signedDistanceMapper = vtkPolyDataMapper()\n    signedDistanceMapper.SetInputConnection(vertexGlyphFilter.GetOutputPort())\n    signedDistanceMapper.ScalarVisibilityOn()\n\n    signedDistanceActor = vtkActor()\n    signedDistanceActor.SetMapper(signedDistanceMapper)\n\n    renderer = vtkRenderer()\n    renderer.AddViewProp(sphereActor)\n    renderer.AddViewProp(signedDistanceActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('ImplicitPolyDataDistance')\n\n    renWinInteractor = vtkRenderWindowInteractor()\n    renWinInteractor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    renWinInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/IterateOverLines/","title":"IterateOverLines","text":"

        vtk-examples/Python/PolyData/IterateOverLines

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/IterateOverLines/#code","title":"Code","text":"

        IterateOverLines.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import (\n    vtkIdList,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\n\n\ndef main():\n    origin = [0.0, 0.0, 0.0]\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [0.0, 1.0, 0.0]\n    p2 = [0.0, 1.0, 2.0]\n    p3 = [1.0, 2.0, 3.0]\n\n    # Create a vtkPoints object and store the points in it.\n    points = vtkPoints()\n    points.InsertNextPoint(origin)\n    points.InsertNextPoint(p0)\n    points.InsertNextPoint(p1)\n    points.InsertNextPoint(p2)\n    points.InsertNextPoint(p3)\n\n    # Create a cell array to store the lines in and add the lines to it.\n    lines = vtkCellArray()\n\n    # Create four lines.\n    for i in range(4):\n        line = vtkLine()\n        line.GetPointIds().SetId(0, i)\n        line.GetPointIds().SetId(1, i + 1)\n        lines.InsertNextCell(line)\n\n    # Create a polydata to store everything in.\n    linesPolyData = vtkPolyData()\n\n    # Add the points to the dataset.\n    linesPolyData.SetPoints(points)\n\n    # Add the lines to the dataset.\n    linesPolyData.SetLines(lines)\n\n    print('There are {0} lines.'.format(linesPolyData.GetNumberOfLines()))\n\n    linesPolyData.GetLines().InitTraversal()\n    idList = vtkIdList()\n    while (linesPolyData.GetLines().GetNextCell(idList)):\n        print('Line has {0} points'.format(idList.GetNumberOfIds()))\n        for pointId in range(idList.GetNumberOfIds() - 1):\n            print('{0} {1}'.format(idList.GetId(pointId), idList.GetId(pointId + 1)))\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/Outline/","title":"Outline","text":"

        vtk-examples/Python/PolyData/Outline

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/Outline/#code","title":"Code","text":"

        Outline.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.SetWindowName('Outline')\n\n    renWin.AddRenderer(ren)\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create source\n    source = vtkConeSource()\n    source.SetCenter(0, 0, 0)\n    source.SetResolution(100)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    # actor\n    actor1 = vtkActor()\n    actor1.SetMapper(mapper)\n    actor1.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(source.GetOutputPort())\n    mapper2 = vtkPolyDataMapper()\n    mapper2.SetInputConnection(outline.GetOutputPort())\n\n    actor2 = vtkActor()\n    actor2.SetMapper(mapper2)\n    actor2.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    # assign actor to the renderer\n    ren.AddActor(actor1)\n    ren.AddActor(actor2)\n    ren.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/PointSource/","title":"PointSource","text":"

        vtk-examples/Python/PolyData/PointSource

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/PointSource/#code","title":"Code","text":"

        PointSource.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('PointSource')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create a point cloud\n    src = vtkPointSource()\n    src.SetCenter(0, 0, 0)\n    src.SetNumberOfPoints(50)\n    src.SetRadius(5)\n    src.Update()\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(src.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n    actor.GetProperty().SetPointSize(4)\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/PolyDataContourToImageData/","title":"PolyDataContourToImageData","text":"

        vtk-examples/Python/PolyData/PolyDataContourToImageData

        "},{"location":"Python/PolyData/PolyDataContourToImageData/#description","title":"Description","text":"
        • Contributed by: Lars Friedrich, Peter Gruber

        This example generates a sphere, cuts it with a plane and, therefore, generates a circlular contour (vtkPolyData). Subsequently a binary image representation (vtkImageData) is extracted from it. Internally [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)ToImageStencil and vtkLinearExtrusionFilter are utilized. Both the circular poly data (circle.vtp) and the resultant image (labelImage.mhd) are saved to disk.

        Note

        Similarily to example PolyDataToImageStencil, I am not really sure whether or not the image origin needs to be adjusted as the sphere-image-overlay shows some offset in paraview visualization (at least I think ...). Maybe someone could verify that. Thanks!

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/PolyDataContourToImageData/#code","title":"Code","text":"

        PolyDataContourToImageData.py

        #!/usr/bin/env python\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import VTK_UNSIGNED_CHAR\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkImageData,\n    vtkPlane\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCutter,\n    vtkStripper\n)\nfrom vtkmodules.vtkFiltersModeling import vtkLinearExtrusionFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkMetaImageWriter,\n    vtkPNGWriter\n)\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\nfrom vtkmodules.vtkImagingStencil import (\n    vtkImageStencil,\n    vtkPolyDataToImageStencil\n)\n\n\ndef main():\n    # 3D source sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.SetPhiResolution(30)\n    sphereSource.SetThetaResolution(30)\n    sphereSource.SetCenter(40, 40, 0)\n    sphereSource.SetRadius(20)\n\n    # generate circle by cutting the sphere with an implicit plane\n    # (through its center, axis-aligned)\n    circleCutter = vtkCutter()\n    circleCutter.SetInputConnection(sphereSource.GetOutputPort())\n    cutPlane = vtkPlane()\n    cutPlane.SetOrigin(sphereSource.GetCenter())\n    cutPlane.SetNormal(0, 0, 1)\n    circleCutter.SetCutFunction(cutPlane)\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(circleCutter.GetOutputPort())  # valid circle\n    stripper.Update()\n\n    # that's our circle\n    circle = stripper.GetOutput()\n\n    # write circle out\n    polyDataWriter = vtkXMLPolyDataWriter()\n    polyDataWriter.SetInputData(circle)\n\n    polyDataWriter.SetFileName('circle.vtp')\n    polyDataWriter.SetCompressorTypeToNone()\n    polyDataWriter.SetDataModeToAscii()\n    polyDataWriter.Write()\n\n    # prepare the binary image's voxel grid\n    whiteImage = vtkImageData()\n    bounds = [0] * 6\n    circle.GetBounds(bounds)\n    spacing = [0] * 3  # desired volume spacing\n    spacing[0] = 0.5\n    spacing[1] = 0.5\n    spacing[2] = 0.5\n    whiteImage.SetSpacing(spacing)\n\n    # compute dimensions\n    dim = [0] * 3\n    for i in range(3):\n        dim[i] = int(math.ceil((bounds[i * 2 + 1] - bounds[i * 2]) / spacing[i])) + 1\n        if dim[i] < 1:\n            dim[i] = 1\n    whiteImage.SetDimensions(dim)\n    whiteImage.SetExtent(0, dim[0] - 1, 0, dim[1] - 1, 0, dim[2] - 1)\n    origin = [0] * 3\n    # NOTE: I am not sure whether or not we had to add some offset!\n    origin[0] = bounds[0]  # + spacing[0] / 2\n    origin[1] = bounds[2]  # + spacing[1] / 2\n    origin[2] = bounds[4]  # + spacing[2] / 2\n    whiteImage.SetOrigin(origin)\n    whiteImage.AllocateScalars(VTK_UNSIGNED_CHAR, 1)\n\n    # fill the image with foreground voxels:\n    inval = 255\n    outval = 0\n    count = whiteImage.GetNumberOfPoints()\n    # for (vtkIdType i = 0 i < count ++i)\n    for i in range(count):\n        whiteImage.GetPointData().GetScalars().SetTuple1(i, inval)\n\n    # sweep polygonal data (this is the important thing with contours!)\n    extruder = vtkLinearExtrusionFilter()\n    extruder.SetInputData(circle)\n    extruder.SetScaleFactor(1.0)\n    # extruder.SetExtrusionTypeToNormalExtrusion()\n    extruder.SetExtrusionTypeToVectorExtrusion()\n    extruder.SetVector(0, 0, 1)\n    extruder.Update()\n\n    # polygonal data -. image stencil:\n    pol2stenc = vtkPolyDataToImageStencil()\n    pol2stenc.SetTolerance(0)  # important if extruder.SetVector(0, 0, 1) !!!\n    pol2stenc.SetInputConnection(extruder.GetOutputPort())\n    pol2stenc.SetOutputOrigin(origin)\n    pol2stenc.SetOutputSpacing(spacing)\n    pol2stenc.SetOutputWholeExtent(whiteImage.GetExtent())\n    pol2stenc.Update()\n\n    # cut the corresponding white image and set the background:\n    imgstenc = vtkImageStencil()\n    imgstenc.SetInputData(whiteImage)\n    imgstenc.SetStencilConnection(pol2stenc.GetOutputPort())\n    imgstenc.ReverseStencilOff()\n    imgstenc.SetBackgroundValue(outval)\n    imgstenc.Update()\n\n    imageWriter = vtkMetaImageWriter()\n    imageWriter.SetFileName('labelImage.mhd')\n    imageWriter.SetInputConnection(imgstenc.GetOutputPort())\n    imageWriter.Write()\n\n    imageWriter = vtkPNGWriter()\n    imageWriter.SetFileName('labelImage.png')\n    imageWriter.SetInputConnection(imgstenc.GetOutputPort())\n    imageWriter.Write()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/PolyDataToImageDataStencil/","title":"PolyDataToImageDataStencil","text":"

        vtk-examples/Python/PolyData/PolyDataToImageDataStencil

        "},{"location":"Python/PolyData/PolyDataToImageDataStencil/#description","title":"Description","text":"

        This is an example from the vtkPolyDataToImageStencil tests. It converts polydata to imagedata and masks the given imagedata.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/PolyDataToImageDataStencil/#code","title":"Code","text":"

        PolyDataToImageDataStencil.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCutter,\n    vtkImageAppend,\n    vtkStripper,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import vtkPNGReader\nfrom vtkmodules.vtkImagingStencil import (\n    vtkImageStencil,\n    vtkPolyDataToImageStencil\n)\nfrom vtkmodules.vtkInteractionImage import vtkImageViewer\nfrom vtkmodules.vtkRenderingCore import vtkRenderWindowInteractor\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Converts the polydata to imagedata and masks the given imagedata.'\n    epilogue = '''\n        Contributed by: Peter Gruber\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A filename e.g. fullhead15.png.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    fn = get_program_parameters()\n    # A script to test the stencil filter with a polydata stencil.\n    # Image pipeline\n    reader = vtkPNGReader()\n    reader.SetDataSpacing(0.8, 0.8, 1.5)\n    reader.SetDataOrigin(0.0, 0.0, 0.0)\n    reader.SetFileName(fn)\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(12)\n    sphere.SetThetaResolution(12)\n    sphere.SetCenter(102, 102, 0)\n    sphere.SetRadius(60)\n    triangle = vtkTriangleFilter()\n    triangle.SetInputConnection(sphere.GetOutputPort())\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(triangle.GetOutputPort())\n    dataToStencil = vtkPolyDataToImageStencil()\n    dataToStencil.SetInputConnection(stripper.GetOutputPort())\n    dataToStencil.SetOutputSpacing(0.8, 0.8, 1.5)\n    dataToStencil.SetOutputOrigin(0.0, 0.0, 0.0)\n\n    stencil = vtkImageStencil()\n    stencil.SetInputConnection(reader.GetOutputPort())\n    stencil.SetStencilConnection(dataToStencil.GetOutputPort())\n    stencil.ReverseStencilOn()\n    stencil.SetBackgroundValue(500)\n\n    # test again with a contour\n    reader2 = vtkPNGReader()\n    reader2.SetDataSpacing(0.8, 0.8, 1.5)\n    reader2.SetDataOrigin(0.0, 0.0, 0.0)\n    reader2.SetFileName(fn)\n    plane = vtkPlane()\n    plane.SetOrigin(0, 0, 0)\n    plane.SetNormal(0, 0, 1)\n    cutter = vtkCutter()\n    cutter.SetInputConnection(sphere.GetOutputPort())\n    cutter.SetCutFunction(plane)\n    stripper2 = vtkStripper()\n    stripper2.SetInputConnection(cutter.GetOutputPort())\n    dataToStencil2 = vtkPolyDataToImageStencil()\n    dataToStencil2.SetInputConnection(stripper2.GetOutputPort())\n    dataToStencil2.SetOutputSpacing(0.8, 0.8, 1.5)\n    dataToStencil2.SetOutputOrigin(0.0, 0.0, 0.0)\n    stencil2 = vtkImageStencil()\n    stencil2.SetInputConnection(reader2.GetOutputPort())\n    stencil2.SetStencilConnection(dataToStencil2.GetOutputPort())\n    stencil2.SetBackgroundValue(500)\n\n    imageAppend = vtkImageAppend()\n    imageAppend.SetInputConnection(stencil.GetOutputPort())\n    imageAppend.AddInputConnection(stencil2.GetOutputPort())\n\n    viewer = vtkImageViewer()\n    interator = vtkRenderWindowInteractor()\n    viewer.SetInputConnection(imageAppend.GetOutputPort())\n    viewer.SetupInteractor(interator)\n    viewer.SetZSlice(0)\n    viewer.SetColorWindow(2000)\n    viewer.SetColorLevel(1000)\n    viewer.GetRenderWindow().SetWindowName('PolyDataToImageDataStencil')\n    viewer.Render()\n\n    interator.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/RotationAroundLine/","title":"RotationAroundLine","text":"

        vtk-examples/Python/PolyData/RotationAroundLine

        "},{"location":"Python/PolyData/RotationAroundLine/#description","title":"Description","text":"

        NOTE: this example shows both the original and the rotated object using different colors. Not exactly equivalent to the C++ example with the same name.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/RotationAroundLine/#code","title":"Code","text":"

        RotationAroundLine.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkArrowSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('RotationAroundLine')\n\n    # Create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create arrow\n    source = vtkArrowSource()\n\n    # Create a transform that rotates the arrow 45\u00b0 around the z-axis\n    transform = vtkTransform()\n    transform.RotateWXYZ(45, 0, 0, 1)\n    transformFilter = vtkTransformPolyDataFilter()\n    transformFilter.SetTransform(transform)\n    transformFilter.SetInputConnection(source.GetOutputPort())\n    transformFilter.Update()\n\n    # Mapper for the original arrow\n    coneMapper1 = vtkPolyDataMapper()\n    coneMapper1.SetInputConnection(source.GetOutputPort())\n\n    # Another mapper for the rotated arrow\n    coneMapper2 = vtkPolyDataMapper()\n    coneMapper2.SetInputConnection(transformFilter.GetOutputPort())\n\n    # Actor for original arrow\n    actor1 = vtkActor()\n    actor1.SetMapper(coneMapper1)\n\n    # Actor for rotated arrow\n    actor2 = vtkActor()\n    actor2.SetMapper(coneMapper2)\n\n    # Color the original arrow\n    actor1.GetProperty().SetColor(colors.GetColor3d('LightCoral'))\n    # Color rotated arrow\n    actor2.GetProperty().SetColor(colors.GetColor3d('PaleTurquoise'))\n\n    # Assign actor to the renderer\n    ren.AddActor(actor1)\n    ren.AddActor(actor2)\n    ren.SetBackground(colors.GetColor3d('SlateGray'));\n\n    # Enable the user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/RuledSurfaceFilter/","title":"RuledSurfaceFilter","text":"

        vtk-examples/Python/PolyData/RuledSurfaceFilter

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/RuledSurfaceFilter/#code","title":"Code","text":"

        RuledSurfaceFilter.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersModeling import vtkRuledSurfaceFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    # Create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the points fot the lines.\n    points = vtkPoints()\n    points.InsertPoint(0, 0, 0, 1)\n    points.InsertPoint(1, 1, 0, 0)\n    points.InsertPoint(2, 0, 1, 0)\n    points.InsertPoint(3, 1, 1, 1)\n\n    # Create line1\n    line1 = vtkLine()\n    line1.GetPointIds().SetId(0, 0)\n    line1.GetPointIds().SetId(1, 1)\n\n    # Create line2\n    line2 = vtkLine()\n    line2.GetPointIds().SetId(0, 2)\n    line2.GetPointIds().SetId(1, 3)\n\n    # Create a cellArray containing the lines\n    lines = vtkCellArray()\n    lines.InsertNextCell(line1)\n    lines.InsertNextCell(line2)\n\n    # Create the vtkPolyData to contain the points and cellArray with the lines\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n    polydata.SetLines(lines)\n\n    # Create the ruledSurfaceFilter from the polydata containing the lines\n    ruledSurfaceFilter = vtkRuledSurfaceFilter()\n    ruledSurfaceFilter.SetInputData(polydata)\n    ruledSurfaceFilter.SetResolution(21, 21)\n    ruledSurfaceFilter.SetRuledModeToResample()\n\n    # Create the mapper with the ruledSurfaceFilter as input\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(ruledSurfaceFilter.GetOutputPort())\n\n    # Create the actor with the mapper\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n    actor.GetProperty().SetSpecular(0.6)\n    actor.GetProperty().SetSpecularPower(30)\n\n    # Add the actor to the display\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d(\"SteelBlue\"))\n    renWin.SetWindowName('RuledSurfaceFilter')\n\n    # Enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    # ren.GetActiveCamera().SetPosition(3.7, -0.5, -0.5)\n    # ren.GetActiveCamera().SetFocalPoint(0.5, 0.5, 0.5)\n    # ren.GetActiveCamera().SetViewUp(-0.3, 0.1, -1.0)\n    ren.GetActiveCamera().Azimuth(60)\n    ren.GetActiveCamera().Elevation(60)\n    ren.ResetCamera()\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/SmoothMeshGrid/","title":"SmoothMeshGrid","text":"

        vtk-examples/Python/PolyData/SmoothMeshGrid

        "},{"location":"Python/PolyData/SmoothMeshGrid/#description","title":"Description","text":"

        Create a terrain with regularly spaced points. The triangles are created manually. Then different types of smoothing filters are used to smooth the terrain.

        Left : initial terrain, middle : vtkLoopSubdivisionFilter, right : vtkButterflySubdivisionFilter

        • Contributed by Michka Popoff, with the help of Bill Lorensen and madz (madaramh).

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/SmoothMeshGrid/#code","title":"Code","text":"

        SmoothMeshGrid.py

        #!/usr/bin/env python\n\nimport numpy\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangle\n)\nfrom vtkmodules.vtkFiltersCore import vtkCleanPolyData\nfrom vtkmodules.vtkFiltersModeling import (\n    vtkButterflySubdivisionFilter,\n    vtkLoopSubdivisionFilter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    nc = vtkNamedColors()\n\n    # Make a 32 x 32 grid\n    size = 32\n\n    rn = vtkMinimalStandardRandomSequence()\n    rn.SetSeed(1)\n\n    # Define z values for the topography (random height)\n    topography = numpy.zeros([size, size])\n    for i in range(size):\n        for j in range(size):\n            topography[i][j] = rn.GetRangeValue(0, 5)\n            rn.Next()\n\n    # Define points, triangles and colors\n    colors = vtkUnsignedCharArray()\n    colors.SetNumberOfComponents(3)\n    points = vtkPoints()\n    triangles = vtkCellArray()\n\n    # Build the meshgrid manually\n    count = 0\n    for i in range(size - 1):\n        for j in range(size - 1):\n            z1 = topography[i][j]\n            z2 = topography[i][j + 1]\n            z3 = topography[i + 1][j]\n\n            # Triangle 1\n            points.InsertNextPoint(i, j, z1)\n            points.InsertNextPoint(i, (j + 1), z2)\n            points.InsertNextPoint((i + 1), j, z3)\n\n            triangle = vtkTriangle()\n            triangle.GetPointIds().SetId(0, count)\n            triangle.GetPointIds().SetId(1, count + 1)\n            triangle.GetPointIds().SetId(2, count + 2)\n\n            triangles.InsertNextCell(triangle)\n\n            z1 = topography[i][j + 1]\n            z2 = topography[i + 1][j + 1]\n            z3 = topography[i + 1][j]\n\n            # Triangle 2\n            points.InsertNextPoint(i, (j + 1), z1)\n            points.InsertNextPoint((i + 1), (j + 1), z2)\n            points.InsertNextPoint((i + 1), j, z3)\n\n            triangle = vtkTriangle()\n            triangle.GetPointIds().SetId(0, count + 3)\n            triangle.GetPointIds().SetId(1, count + 4)\n            triangle.GetPointIds().SetId(2, count + 5)\n\n            count += 6\n\n            triangles.InsertNextCell(triangle)\n\n            # Add some color\n            r = [int(i / float(size) * 255), int(j / float(size) * 255), 0]\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n            colors.InsertNextTypedTuple(r)\n\n    # Create a polydata object\n    trianglePolyData = vtkPolyData()\n\n    # Add the geometry and topology to the polydata\n    trianglePolyData.SetPoints(points)\n    trianglePolyData.GetPointData().SetScalars(colors)\n    trianglePolyData.SetPolys(triangles)\n\n    # Clean the polydata so that the edges are shared !\n    cleanPolyData = vtkCleanPolyData()\n    cleanPolyData.SetInputData(trianglePolyData)\n\n    # Use a filter to smooth the data (will add triangles and smooth)\n    # Use two different filters to show the difference\n    smooth_loop = vtkLoopSubdivisionFilter()\n    smooth_loop.SetNumberOfSubdivisions(3)\n    smooth_loop.SetInputConnection(cleanPolyData.GetOutputPort())\n    smooth_butterfly = vtkButterflySubdivisionFilter()\n    smooth_butterfly.SetNumberOfSubdivisions(3)\n    smooth_butterfly.SetInputConnection(cleanPolyData.GetOutputPort())\n\n    # Create a mapper and actor for initial dataset\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(trianglePolyData)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create a mapper and actor for smoothed dataset (vtkLoopSubdivisionFilter)\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(smooth_loop.GetOutputPort())\n    actor_loop = vtkActor()\n    actor_loop.SetMapper(mapper)\n    actor_loop.SetPosition(32, 0, 0)\n\n    # Create a mapper and actor for smoothed dataset (vtkButterflySubdivisionFilter)\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(smooth_butterfly.GetOutputPort())\n    actor_butterfly = vtkActor()\n    actor_butterfly.SetMapper(mapper)\n    actor_butterfly.SetPosition(64, 0, 0)\n\n    # Visualise\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add actors and render\n    renderer.AddActor(actor)\n    renderer.AddActor(actor_loop)\n    renderer.AddActor(actor_butterfly)\n    renderer.SetBackground(nc.GetColor3d('AliceBlue'))\n\n    renderWindow.SetSize(900, 300)\n    renderWindow.Render()\n    renderer.GetActiveCamera().Elevation(-45)\n    renderer.GetActiveCamera().Zoom(3)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/SolidColoredTriangle/","title":"SolidColoredTriangle","text":"

        vtk-examples/Python/PolyData/SolidColoredTriangle

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/SolidColoredTriangle/#code","title":"Code","text":"

        SolidColoredTriangle.py

        #!/usr/bin/env python\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkTriangle\n)\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate a solid colored triangle and write it to a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestSolidColorTriangle.vtp',\n                        type=str, default='TestSolidColorTriangle.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    # setup points and vertices\n    Points = vtkPoints()\n    Triangles = vtkCellArray()\n\n    Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    Triangle = vtkTriangle()\n    Triangle.GetPointIds().SetId(0, 0)\n    Triangle.GetPointIds().SetId(1, 1)\n    Triangle.GetPointIds().SetId(2, 2)\n    Triangles.InsertNextCell(Triangle)\n\n    # Setup colors (setting the name to \"Colors\" is nice but not necessary)\n    Colors = vtkUnsignedCharArray()\n    Colors.SetNumberOfComponents(3)\n    Colors.SetName(\"Colors\")\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Red'))\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.SetPolys(Triangles)\n\n    polydata.GetCellData().SetScalars(Colors)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/TriangleColoredPoints/","title":"TriangleColoredPoints","text":"

        vtk-examples/Python/PolyData/TriangleColoredPoints

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/TriangleColoredPoints/#code","title":"Code","text":"

        TriangleColoredPoints.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkPoints,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate a triangle with colored points and write it to a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestTriangleColoredPoints.vtp',\n                        type=str, default='TestTriangleColoredPoints.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    filename = get_program_parameters()\n\n    # setup points and vertices\n    Points = vtkPoints()\n    Vertices = vtkCellArray()\n\n    id = Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n    id = Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n    id = Points.InsertNextPoint(0.0, 1.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n\n    # setup colors\n    Colors = vtkUnsignedCharArray()\n    Colors.SetNumberOfComponents(3)\n    Colors.SetName(\"Colors\")\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Red'))\n    Colors.InsertNextTuple3(*colors.GetColor3ub('LimeGreen'))\n    Colors.InsertNextTuple3(*colors.GetColor3ub('Blue'))\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.SetVerts(Vertices)\n    polydata.GetPointData().SetScalars(Colors)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/TriangleCornerVertices/","title":"TriangleCornerVertices","text":"

        vtk-examples/Python/PolyData/TriangleCornerVertices

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/TriangleCornerVertices/#code","title":"Code","text":"

        TriangleCornerVertices.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate triangle polydata, then write a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestTriangleCornerVertices.vtp',\n                        type=str, default='TestTriangleCornerVertices.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filename = get_program_parameters()\n\n    Points = vtkPoints()\n    Vertices = vtkCellArray()\n\n    id = Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n    id = Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n    id = Points.InsertNextPoint(0.0, 1.0, 0.0)\n    Vertices.InsertNextCell(1)\n    Vertices.InsertCellPoint(id)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.SetVerts(Vertices)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/TriangleCorners/","title":"TriangleCorners","text":"

        vtk-examples/Python/PolyData/TriangleCorners

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/TriangleCorners/#code","title":"Code","text":"

        TriangleCorners.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataWriter\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Generate triangle points, then write a .vtp file.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required vtp filename.', nargs='?',\n                        const='TestTriangleCorners.vtp',\n                        type=str, default='TestTriangleCorners.vtp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filename = get_program_parameters()\n\n    Points = vtkPoints()\n    Points.InsertNextPoint(1.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 0.0, 0.0)\n    Points.InsertNextPoint(0.0, 1.0, 0.0)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(Points)\n    polydata.Modified()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName(filename)\n    writer.SetInputData(polydata)\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/TubeFilter/","title":"TubeFilter","text":"

        vtk-examples/Python/PolyData/TubeFilter

        "},{"location":"Python/PolyData/TubeFilter/#description","title":"Description","text":"

        This example creates a tube around a line. This is helpful because when you zoom the camera, the thickness of a line remains constant, while the thickness of a tube varies.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/TubeFilter/#code","title":"Code","text":"

        TubeFilter.py

        #!/usr/bin/env python\n\n# This example creates a tube around a line.\n# This is helpful because when you zoom the camera, \n# the thickness of a line remains constant, \n# while the thickness of a tube varies.\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a line\n    lineSource = vtkLineSource()\n    lineSource.SetPoint1(1.0, 0.0, 0.0)\n    lineSource.SetPoint2(.0, 1.0, 0.0)\n\n    # Setup actor and mapper\n    lineMapper = vtkPolyDataMapper()\n    lineMapper.SetInputConnection(lineSource.GetOutputPort())\n\n    lineActor = vtkActor()\n    lineActor.SetMapper(lineMapper)\n    lineActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    # Create tube filter\n    tubeFilter = vtkTubeFilter()\n    tubeFilter.SetInputConnection(lineSource.GetOutputPort())\n    tubeFilter.SetRadius(0.025)\n    tubeFilter.SetNumberOfSides(50)\n    tubeFilter.Update()\n\n    # Setup actor and mapper\n    tubeMapper = vtkPolyDataMapper()\n    tubeMapper.SetInputConnection(tubeFilter.GetOutputPort())\n\n    tubeActor = vtkActor()\n    tubeActor.SetMapper(tubeMapper)\n    # Make the tube have some transparency.\n    tubeActor.GetProperty().SetOpacity(0.5)\n\n    # Setup render window, renderer, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('TubeFilter')\n    renderWindow.AddRenderer(renderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    # Visualise the arrow\n    renderer.AddActor(lineActor)\n    renderer.AddActor(tubeActor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renderer.ResetCamera()\n\n    renderWindow.SetSize(300, 300)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/PolyData/WarpVector/","title":"WarpVector","text":"

        vtk-examples/Python/PolyData/WarpVector

        "},{"location":"Python/PolyData/WarpVector/#description","title":"Description","text":"

        This script creates a vtkLine and deflects it using a vtkWarpVector.

        Other languages

        See (Cxx), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/PolyData/WarpVector/#code","title":"Code","text":"

        WarpVector.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkLine,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpVector\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n    points.InsertNextPoint(0.0, 0.0, 0.0)\n    points.InsertNextPoint(1.0, 0.0, 0.0)\n    points.InsertNextPoint(2.0, 0.0, 0.0)\n    points.InsertNextPoint(3.0, 0.0, 0.0)\n    points.InsertNextPoint(4.0, 0.0, 0.0)\n\n    lines = vtkCellArray()\n    line = vtkLine()\n    line.GetPointIds().SetId(0, 0)\n    line.GetPointIds().SetId(1, 1)\n    lines.InsertNextCell(line)\n    line.GetPointIds().SetId(0, 1)\n    line.GetPointIds().SetId(1, 2)\n    lines.InsertNextCell(line)\n    line.GetPointIds().SetId(0, 2)\n    line.GetPointIds().SetId(1, 3)\n    lines.InsertNextCell(line)\n    line.GetPointIds().SetId(0, 3)\n    line.GetPointIds().SetId(1, 4)\n    lines.InsertNextCell(line)\n\n    warpData = vtkDoubleArray()\n    warpData.SetNumberOfComponents(3)\n    warpData.SetName(\"warpData\")\n    warp = [0.0, 0.0, 0.0]\n    warp[1] = 0.0\n    warpData.InsertNextTuple(warp)\n    warp[1] = 0.1\n    warpData.InsertNextTuple(warp)\n    warp[1] = 0.3\n    warpData.InsertNextTuple(warp)\n    warp[1] = 0.0\n    warpData.InsertNextTuple(warp)\n    warp[1] = 0.1\n    warpData.InsertNextTuple(warp)\n\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n    polydata.SetLines(lines)\n    polydata.GetPointData().AddArray(warpData)\n    polydata.GetPointData().SetActiveVectors(warpData.GetName())\n\n    # WarpVector will use the array marked as active vector in polydata\n    # it has to be a 3 component array\n    # with the same number of tuples as points in polydata\n    warpVector = vtkWarpVector()\n    warpVector.SetInputData(polydata)\n    warpVector.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(warpVector.GetPolyDataOutput())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('cobalt_green'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('WarpVector')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/RectilinearGrid/RGrid/","title":"RGrid","text":"

        vtk-examples/Python/RectilinearGrid/RGrid

        "},{"location":"Python/RectilinearGrid/RGrid/#description","title":"Description","text":"

        Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray.

        Info

        See Figure 5-20 in Chapter 5 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/RectilinearGrid/RGrid/#code","title":"Code","text":"

        RGrid.py

        #!/usr/bin/env python\n\n\"\"\"\nThis example shows how to create a rectilinear grid.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkRectilinearGrid\nfrom vtkmodules.vtkFiltersGeometry import vtkRectilinearGridGeometryFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    x = [-1.22396, -1.17188, -1.11979, -1.06771, -1.01562, -0.963542, -0.911458, -0.859375, -0.807292, -0.755208,\n         -0.703125, -0.651042, -0.598958, -0.546875, -0.494792, -0.442708, -0.390625, -0.338542, -0.286458, -0.234375,\n         -0.182292, -0.130209, -0.078125, -0.026042, 0.0260415, 0.078125, 0.130208, 0.182291, 0.234375, 0.286458,\n         0.338542, 0.390625, 0.442708, 0.494792, 0.546875, 0.598958, 0.651042, 0.703125, 0.755208, 0.807292, 0.859375,\n         0.911458, 0.963542, 1.01562, 1.06771, 1.11979, 1.17188]\n    y = [-1.25, -1.17188, -1.09375, -1.01562, -0.9375, -0.859375, -0.78125, -0.703125, -0.625, -0.546875, -0.46875,\n         -0.390625, -0.3125, -0.234375, -0.15625, -0.078125, 0, 0.078125, 0.15625, 0.234375, 0.3125, 0.390625, 0.46875,\n         0.546875, 0.625, 0.703125, 0.78125, 0.859375, 0.9375, 1.01562, 1.09375, 1.17188, 1.25]\n    z = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.75, 1.8, 1.9, 2,\n         2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.75, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.75, 3.8, 3.9]\n    print(len(x), len(y), len(z))\n\n    # Create a rectilinear grid by defining three arrays specifying the\n    # coordinates in the x-y-z directions.\n    xCoords = vtkDoubleArray()\n    for i in range(0, len(x)):\n        xCoords.InsertNextValue(x[i])\n    yCoords = vtkDoubleArray()\n    for i in range(0, len(y)):\n        yCoords.InsertNextValue(y[i])\n    zCoords = vtkDoubleArray()\n    for i in range(0, len(z)):\n        zCoords.InsertNextValue(z[i])\n\n    # The coordinates are assigned to the rectilinear grid. Make sure that\n    # the number of values in each of the XCoordinates, YCoordinates,\n    # and ZCoordinates is equal to what is defined in SetDimensions().\n    #\n    rgrid = vtkRectilinearGrid()\n    rgrid.SetDimensions(len(x), len(y), len(z))\n    rgrid.SetXCoordinates(xCoords)\n    rgrid.SetYCoordinates(yCoords)\n    rgrid.SetZCoordinates(zCoords)\n\n    # Extract a plane from the grid to see what we've got.\n    plane = vtkRectilinearGridGeometryFilter()\n    plane.SetInputData(rgrid)\n    plane.SetExtent(0, len(x) - 1, 16, 16, 0, len(z) - 1)\n\n    rgridMapper = vtkPolyDataMapper()\n    rgridMapper.SetInputConnection(plane.GetOutputPort())\n\n    wireActor = vtkActor()\n    wireActor.SetMapper(rgridMapper)\n    wireActor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n    wireActor.GetProperty().EdgeVisibilityOn()\n\n    # Create the usual rendering stuff.\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    renderer.AddActor(wireActor)\n    renderer.SetBackground(colors.GetColor3d(\"Beige\"))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(60.0)\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.GetActiveCamera().Zoom(1.0)\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('RGrid')\n\n    # Interact with the data.\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
        "},{"location":"Python/RectilinearGrid/RectilinearGrid/","title":"RectilinearGrid","text":"

        vtk-examples/Python/RectilinearGrid/RectilinearGrid

        "},{"location":"Python/RectilinearGrid/RectilinearGrid/#description","title":"Description","text":"

        Shows how to create a vtkRectilinearGrid.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/RectilinearGrid/RectilinearGrid/#code","title":"Code","text":"

        RectilinearGrid.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkRectilinearGrid\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a grid\n    grid = vtkRectilinearGrid()\n    grid.SetDimensions(2, 3, 1)\n\n    xArray = vtkDoubleArray()\n    xArray.InsertNextValue(0.0)\n    xArray.InsertNextValue(2.0)\n\n    yArray = vtkDoubleArray()\n    yArray.InsertNextValue(0.0)\n    yArray.InsertNextValue(1.0)\n    yArray.InsertNextValue(2.0)\n\n    zArray = vtkDoubleArray()\n    zArray.InsertNextValue(0.0)\n\n    grid.SetXCoordinates(xArray)\n    grid.SetYCoordinates(yArray)\n    grid.SetZCoordinates(zArray)\n\n    print('There are', grid.GetNumberOfPoints(), 'points.')\n    print('There are', grid.GetNumberOfCells(), 'cells.')\n\n    for id in range(0, grid.GetNumberOfPoints()):\n        p = [0] * 3\n        p = grid.GetPoint(id)\n        print('Point', id, ':(', p[0], ',', p[1], ',', p[2], ')')\n\n    # Create a mapper and actor\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(grid)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('RectilinearGrid')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/RectilinearGrid/VisualizeRectilinearGrid/","title":"VisualizeRectilinearGrid","text":"

        vtk-examples/Python/RectilinearGrid/VisualizeRectilinearGrid

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/RectilinearGrid/VisualizeRectilinearGrid/#code","title":"Code","text":"

        VisualizeRectilinearGrid.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkRectilinearGrid\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a grid    \n    grid = vtkRectilinearGrid()\n\n    grid.SetDimensions(2, 3, 2)\n\n    xArray = vtkDoubleArray()\n    xArray.InsertNextValue(0.0)\n    xArray.InsertNextValue(2.0)\n\n    yArray = vtkDoubleArray()\n    yArray.InsertNextValue(0.0)\n    yArray.InsertNextValue(1.0)\n    yArray.InsertNextValue(2.0)\n\n    zArray = vtkDoubleArray()\n    zArray.InsertNextValue(0.0)\n    zArray.InsertNextValue(5.0)\n\n    grid.SetXCoordinates(xArray)\n    grid.SetYCoordinates(yArray)\n    grid.SetZCoordinates(zArray)\n\n    shrinkFilter = vtkShrinkFilter()\n    shrinkFilter.SetInputData(grid)\n    shrinkFilter.SetShrinkFactor(.8)\n\n    # Create a mapper and actor\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(shrinkFilter.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('VisualizeRectilinearGrid')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderer.GetActiveCamera().Roll(10.0)\n    renderer.GetActiveCamera().Elevation(60.0)\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.ResetCamera()\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/AmbientSpheres/","title":"AmbientSpheres","text":"

        vtk-examples/Python/Rendering/AmbientSpheres

        "},{"location":"Python/Rendering/AmbientSpheres/#description","title":"Description","text":"

        Note

        This original source code for this example is here.

        Info

        Similar examples setting the diffuse and specular properties are: See DiffuseSpheres.cxx, DiffuseSpheres.py and SpecularSpheres.cxx, SpecularSpheres.py.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/AmbientSpheres/#code","title":"Code","text":"

        AmbientSpheres.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('bkg', [26, 51, 102, 255])\n\n    # The following lines create a sphere represented by polygons.\n    #\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(100)\n    sphere.SetPhiResolution(50)\n\n    # The mapper is responsible for pushing the geometry into the graphics\n    # library. It may also do color mapping, if scalars or other attributes\n    # are defined.\n    #\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    # The actor is a grouping mechanism: besides the geometry (mapper), it\n    # also has a property, transformation matrix, and/or texture map.\n    # In this example we create eight different spheres (two rows of four\n    # spheres) and set the ambient lighting coefficients. A little ambient\n    # is turned on so the sphere is not completely black on the back side.\n    #\n    numberOfSpheres = 8\n    spheres = list()\n    ambient = 0.125\n    diffuse = 0.0\n    specular = 0.0\n    position = [0, 0, 0]\n    for i in range(0, numberOfSpheres):\n        spheres.append(vtkActor())\n        spheres[i].SetMapper(sphereMapper)\n        spheres[i].GetProperty().SetColor(colors.GetColor3d('Red'))\n        spheres[i].GetProperty().SetAmbient(ambient)\n        spheres[i].GetProperty().SetDiffuse(diffuse)\n        spheres[i].GetProperty().SetSpecular(specular)\n        spheres[i].AddPosition(position)\n        ambient += 0.125\n        position[0] += 1.25\n        if i == 3:\n            position[0] = 0\n            position[1] = 1.25\n\n    # Create the graphics structure. The renderer renders into the\n    # render window. The render window interactor captures mouse events\n    # and will perform appropriate camera or actor manipulation\n    # depending on the nature of the events.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    for i in range(0, numberOfSpheres):\n        ren.AddActor(spheres[i])\n\n    ren.SetBackground(colors.GetColor3d('bkg'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('AmbientSpheres')\n\n    # Set up the lighting.\n    #\n    light = vtkLight()\n    light.SetFocalPoint(1.875, 0.6125, 0)\n    light.SetPosition(0.875, 1.6125, 1)\n    ren.AddLight(light)\n\n    # We want to eliminate perspective effects on the apparent lighting.\n    # Parallel camera projection will be used. To zoom in parallel projection\n    # mode, the ParallelScale is set.\n    #\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    ren.GetActiveCamera().SetPosition(0, 0, 1)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.GetActiveCamera().ParallelProjectionOn()\n    ren.ResetCamera()\n    ren.GetActiveCamera().SetParallelScale(2.0)\n    # This starts the event loop and invokes an initial render.\n    #\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/CameraBlur/","title":"CameraBlur","text":"

        vtk-examples/Python/Rendering/CameraBlur

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/CameraBlur/#code","title":"Code","text":"

        CameraBlur.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('Bkg', [26, 51, 102, 255])\n\n    # Create the rendering objects.\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline, ball and spikes.\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(7)\n    sphere.SetThetaResolution(7)\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor2 = vtkActor()\n    sphereActor2.SetMapper(sphereMapper)\n\n    cone = vtkConeSource()\n    cone.SetResolution(5)\n    glyph = vtkGlyph3D()\n    glyph.SetInputConnection(sphere.GetOutputPort())\n    glyph.SetSourceConnection(cone.GetOutputPort())\n    glyph.SetVectorModeToUseNormal()\n    glyph.SetScaleModeToScaleByVector()\n    glyph.SetScaleFactor(0.25)\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(glyph.GetOutputPort())\n    spikeActor = vtkActor()\n    spikeActor.SetMapper(spikeMapper)\n    spikeActor2 = vtkActor()\n    spikeActor2.SetMapper(spikeMapper)\n\n    spikeActor.SetPosition(0, 0.7, 0)\n    sphereActor.SetPosition(0, 0.7, 0)\n    spikeActor2.SetPosition(0, -1.0, -10)\n    sphereActor2.SetPosition(0, -1.0, -10)\n    spikeActor2.SetScale(1.5, 1.5, 1.5)\n    sphereActor2.SetScale(1.5, 1.5, 1.5)\n\n    ren1.AddActor(sphereActor)\n    ren1.AddActor(spikeActor)\n    ren1.AddActor(sphereActor2)\n    ren1.AddActor(spikeActor2)\n    ren1.SetBackground(colors.GetColor3d('Bkg'))\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('CameraBlur')\n\n    # Do the first render and then zoom in a little.\n    renWin.Render()\n    ren1.GetActiveCamera().SetFocalPoint(0, 0, 0.0)\n    ren1.GetActiveCamera().Zoom(1.8)\n    ren1.GetActiveCamera().SetFocalDisk(0.05)\n\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/ColoredSphere/","title":"ColoredSphere","text":"

        vtk-examples/Python/Rendering/ColoredSphere

        "},{"location":"Python/Rendering/ColoredSphere/#description","title":"Description","text":"

        This demonstrates a simple visualization pipeline. A polygonal representation of a sphere is created with the source object (vtkSphereSource). The sphere is passed through a filter (vtkElevationFilter) that computes the height of each point of the sphere above a plane. The plane is perpendicular to the z-axis, and passes through the point (0,0,-1). The data is finally mapped (vtkDataSetMapper) through a lookup table. The mapping process converts height value into colors, and interfaces the sphere geometry to the rendering library. The mapper is assigned to an actor, and then the actor is displayed.

        The execution of the pipeline occurs implicitly when we render the actor. Each actor asks its mapper to update itself. The mapper in turn asks its input to update itself. This process continues until a source object is encountered. Then the source will execute if modified since the last render.

        Info

        See Figure 4-19 in Chapter 4 the VTK Textbook.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/ColoredSphere/#code","title":"Code","text":"

        ColoredSphere.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    sphere = vtkSphereSource()\n    sphere.SetPhiResolution(12)\n    sphere.SetThetaResolution(12)\n\n    colorIt = vtkElevationFilter()\n    colorIt.SetInputConnection(sphere.GetOutputPort())\n    colorIt.SetLowPoint(0, 0, -1)\n    colorIt.SetHighPoint(0, 0, 1)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(colorIt.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('ColoredSphere')\n\n    renWin.Render()\n\n    # Interact with the data.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/Cone3/","title":"Cone3","text":"

        vtk-examples/Python/Rendering/Cone3

        "},{"location":"Python/Rendering/Cone3/#description","title":"Description","text":"

        Info

        See Figure 3-27 in Chapter 3 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/Cone3/#code","title":"Code","text":"

        Cone3.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#\n# This example demonstrates how to use multiple renderers within a\n# render window. It is a variation of the Cone1.py example. Please\n# refer to that example for additional documentation.\n#\n\nimport time\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource 'cone' is part of a visualization\n    # pipeline (it is a source process object); it produces data (output type is\n    # vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the cone. The actor orchestrates rendering of\n    # the mapper's graphics primitives. An actor also refers to properties via a\n    # vtkProperty instance, and includes an internal transformation matrix. We\n    # set this actor's mapper to be coneMapper which we created above.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n\n    #\n    # Create two renderers and assign actors to them. A renderer renders into a\n    # viewport within the vtkRenderWindow. It is part or all of a window on the\n    # screen and it is responsible for drawing the actors it has.  We also set\n    # the background color here. In this example we are adding the same actor\n    # to two different renderers; it is okay to add different actors to\n    # different renderers as well.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    ren2 = vtkRenderer()\n    ren2.AddActor(coneActor)\n    ren2.SetBackground(colors.GetColor3d('LightSlateGray'))\n    ren2.SetViewport(0.5, 0.0, 1.0, 1.0)\n\n    #\n    # Finally we create the render window which will show up on the screen.\n    # We add our two renderers into the render window using AddRenderer. We also\n    # set the size to be 600 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.AddRenderer(ren2)\n    renWin.SetSize(600, 300)\n    renWin.SetWindowName('Cone3')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # Make one camera view 90 degrees from the other.\n    #\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Azimuth(90)\n\n    #\n    # Now we loop over 60 degrees and render the cone each time.\n    #\n    for i in range(0, 60):\n        time.sleep(0.03)\n\n        renWin.Render()\n        ren1.GetActiveCamera().Azimuth(1)\n        ren2.GetActiveCamera().Azimuth(1)\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/Cone4/","title":"Cone4","text":"

        vtk-examples/Python/Rendering/Cone4

        "},{"location":"Python/Rendering/Cone4/#description","title":"Description","text":"

        This example modifies vtkActor's properties and transformation matrix.

        Info

        See Figure 3-28 in Chapter 3 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/Cone4/#code","title":"Code","text":"

        Cone4.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport time\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource 'cone' is part of a visualization\n    # pipeline (it is a source process object); it produces data (output type is\n    # vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the first cone. The actor's properties are\n    # modified to give it different surface properties. By default, an actor\n    # is create with a property so the GetProperty() method can be used.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n    coneActor.GetProperty().SetDiffuse(0.7)\n    coneActor.GetProperty().SetSpecular(0.4)\n    coneActor.GetProperty().SetSpecularPower(20)\n\n    #\n    # Create a property and directly manipulate it. Assign it to the\n    # second actor.\n    #\n    property = vtkProperty()\n    property.SetColor(colors.GetColor3d('Tomato'))\n    property.SetDiffuse(0.7)\n    property.SetSpecular(0.4)\n    property.SetSpecularPower(20)\n\n    #\n    # Create a second actor and a property. The property is directly\n    # manipulated and then assigned to the actor. In this way, a single\n    # property can be shared among many actors. Note also that we use the\n    # same mapper as the first actor did. This way we avoid duplicating\n    # geometry, which may save lots of memory if the geometry is large.\n    coneActor2 = vtkActor()\n    coneActor2.SetMapper(coneMapper)\n    # coneActor2.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n    coneActor2.SetProperty(property)\n    coneActor2.SetPosition(0, 2, 0)\n\n    #\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is responsible\n    # for drawing the actors it has.  We also set the background color here.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.AddActor(coneActor2)\n    ren1.SetBackground(colors.GetColor3d('LightSlateGray'))\n\n    #\n    # Finally we create the render window which will show up on the screen\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('Cone4')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # Now we loop over 60 degrees and render the cone each time.\n    #\n    ren1.GetActiveCamera().Elevation(30)\n    ren1.ResetCamera()\n    for i in range(0, 60):\n        time.sleep(0.03)\n\n        renWin.Render()\n        ren1.GetActiveCamera().Azimuth(1)\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/DiffuseSpheres/","title":"DiffuseSpheres","text":"

        vtk-examples/Python/Rendering/DiffuseSpheres

        "},{"location":"Python/Rendering/DiffuseSpheres/#description","title":"Description","text":"

        Note

        This original source code for this example is here.

        Info

        Similar examples setting the ambient and specular properties are: See AmbientSpheres.cxx, AmbientSpheres.py, AmbientSpheres.java and SpecularSpheres.cxx, SpecularSpheres.py.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/DiffuseSpheres/#code","title":"Code","text":"

        DiffuseSpheres.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('bkg', [26, 51, 102, 255])\n\n    # The following lines create a sphere represented by polygons.\n    #\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(100)\n    sphere.SetPhiResolution(50)\n\n    # The mapper is responsible for pushing the geometry into the graphics\n    # library. It may also do color mapping, if scalars or other attributes\n    # are defined.\n    #\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    # The actor is a grouping mechanism: besides the geometry (mapper), it\n    # also has a property, transformation matrix, and/or texture map.\n    # In this example we create eight different spheres (two rows of four\n    # spheres) and set the diffuse lighting coefficients. A little ambient\n    # is turned on so the sphere is not completely black on the back side.\n    #\n    numberOfSpheres = 8\n    spheres = list()\n    ambient = 0.3\n    diffuse = 0.0\n    specular = 0.0\n    position = [0, 0, 0]\n    for i in range(0, numberOfSpheres):\n        spheres.append(vtkActor())\n        spheres[i].SetMapper(sphereMapper)\n        spheres[i].GetProperty().SetColor(colors.GetColor3d('Red'))\n        spheres[i].GetProperty().SetAmbient(ambient)\n        spheres[i].GetProperty().SetDiffuse(diffuse)\n        spheres[i].GetProperty().SetSpecular(specular)\n        spheres[i].AddPosition(position)\n        diffuse += 0.125\n        position[0] += 1.25\n        if i == 3:\n            position[0] = 0\n            position[1] = 1.25\n\n    # Create the graphics structure. The renderer renders into the\n    # render window. The render window interactor captures mouse events\n    # and will perform appropriate camera or actor manipulation\n    # depending on the nature of the events.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    for i in range(0, numberOfSpheres):\n        ren.AddActor(spheres[i])\n\n    ren.SetBackground(colors.GetColor3d('bkg'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('DiffuseSpheres')\n\n    # Set up the lighting.\n    #\n    light = vtkLight()\n    light.SetFocalPoint(1.875, 0.6125, 0)\n    light.SetPosition(0.875, 1.6125, 1)\n    ren.AddLight(light)\n\n    # We want to eliminate perspective effects on the apparent lighting.\n    # Parallel camera projection will be used. To zoom in parallel projection\n    # mode, the ParallelScale is set.\n    #\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    ren.GetActiveCamera().SetPosition(0, 0, 1)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.GetActiveCamera().ParallelProjectionOn()\n    ren.ResetCamera()\n    ren.GetActiveCamera().SetParallelScale(2.0)\n    # This starts the event loop and invokes an initial render.\n    #\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/FlatVersusGouraud/","title":"FlatVersusGouraud","text":"

        vtk-examples/Python/Rendering/FlatVersusGouraud

        "},{"location":"Python/Rendering/FlatVersusGouraud/#description","title":"Description","text":"

        Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look.

        In this example, the flat and gouraud images for each pair have linked cameras. Rotate and zoom a pair to get a better look at the differences.

        Info

        See Figure 3-7 in Chapter 3 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/FlatVersusGouraud/#code","title":"Code","text":"

        FlatVersusGouraud.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom collections import OrderedDict\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCylinderSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkIOGeometry import vtkOBJReader\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Create the renderers.\n    renderers = OrderedDict()\n    renderers['flatSphereRenderer'] = CreateSphere(True)\n    renderers['flatCylinderRenderer'] = CreateCylinder(True)\n    renderers['flatIsoSurfaceRenderer'] = CreateIsoSurface(True)\n    renderers['flatModelRenderer'] = CreateModel(True, fileName)\n\n    renderers['smoothSphereRenderer'] = CreateSphere(False)\n    renderers['smoothCylinderRenderer'] = CreateCylinder(False)\n    renderers['smoothIsoSurfaceRenderer'] = CreateIsoSurface(False)\n    renderers['smoothModelRenderer'] = CreateModel(False, fileName)\n\n    # Get the keys\n    keys = list(renderers.keys())\n\n    renderWindow = vtkRenderWindow()\n\n    # Setup the viewports for the renderers.\n    rendererSize = 256\n    xGridDimensions = 4\n    yGridDimensions = 2\n\n    renderWindow.SetSize(rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    renderWindow.SetWindowName('FlatVersusGouraud')\n\n    for row in range(0, yGridDimensions):\n        for col in range(0, xGridDimensions):\n            # (xmin, ymin, xmax, ymax)\n            viewport = [0] * 4\n            viewport[0] = col / xGridDimensions\n            viewport[1] = (yGridDimensions - (row + 1)) / yGridDimensions\n            viewport[2] = (col + 1) / xGridDimensions\n            viewport[3] = (yGridDimensions - row) / yGridDimensions\n            index = row * xGridDimensions + col\n            renderers[keys[index]].SetViewport(viewport)\n\n    for r in range(0, len(renderers)):\n        renderers[keys[r]].SetBackground(colors.GetColor3d('SlateGray'))\n        renderers[keys[r]].GetActiveCamera().Azimuth(20)\n        renderers[keys[r]].GetActiveCamera().Elevation(30)\n        renderers[keys[r]].ResetCamera()\n        if r > 3:\n            renderers[keys[r]].SetActiveCamera(renderers[keys[r - 4]].GetActiveCamera())\n\n        renderWindow.AddRenderer(renderers[keys[r]])\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Flat and Gouraud shading.'\n    epilogue = '''\n    Flat and Gouraud shading.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='cow.obj.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef CreateSphere(flat):\n    '''\n\n    :param flat: The interpolation to use (flat or Gouraud).\n    :return: the renderer\n    '''\n    colors = vtkNamedColors()\n    sphere = vtkSphereSource()\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphere.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n    if flat:\n        actor.GetProperty().SetInterpolationToFlat()\n    else:\n        actor.GetProperty().SetInterpolationToGouraud()\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    return renderer\n\n\ndef CreateCylinder(flat):\n    '''\n\n    :param flat: The interpolation to use (flat or Gouraud).\n    :return: the renderer\n    '''\n    colors = vtkNamedColors()\n    cylinder = vtkCylinderSource()\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(cylinder.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n    if flat:\n        actor.GetProperty().SetInterpolationToFlat()\n    else:\n        actor.GetProperty().SetInterpolationToGouraud()\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    return renderer\n\n\ndef CreateIsoSurface(flat):\n    '''\n\n    :param flat: The interpolation to use (flat or Gouraud).\n    :return: the renderer\n    '''\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 2, 3, 0, 1, 0, 0, 0, 0, 0)\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(25, 25, 25)\n    sample.SetImplicitFunction(quadric)\n    # Generate the implicit surface.\n    contour = vtkContourFilter()\n    contour.SetInputConnection(sample.GetOutputPort())\n    range = [1.0, 6.0]\n    contour.GenerateValues(5, range)\n    # Map the contour.\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contour.GetOutputPort())\n    contourMapper.SetScalarRange(0, 7)\n    actor = vtkActor()\n    actor.SetMapper(contourMapper)\n    if flat:\n        actor.GetProperty().SetInterpolationToFlat()\n    else:\n        actor.GetProperty().SetInterpolationToGouraud()\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    return renderer\n\n\ndef CreateModel(flat, fileName):\n    '''\n\n    :param flat: The interpolation to use (flat or Gouraud).\n    :param fileName: The file name.\n    :return: the renderer\n    '''\n    colors = vtkNamedColors()\n    reader = vtkOBJReader()\n    reader.SetFileName(fileName)\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Tan'))\n    if flat:\n        actor.GetProperty().SetInterpolationToFlat()\n    else:\n        actor.GetProperty().SetInterpolationToGouraud()\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    return renderer\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/GradientBackground/","title":"GradientBackground","text":"

        vtk-examples/Python/Rendering/GradientBackground

        "},{"location":"Python/Rendering/GradientBackground/#description","title":"Description","text":"

        Demonstrates the gradient backgrounds available in VTK.

        The gradient background modes are:

        • Vertical
        • Horizontal
        • Radial Farthest Side
        • Radial Farthest Corner

        The user can also edit the code to change the stop colors marking the beginning and end points in a gradient.

        An option is provided for the user to read in a data file so that more interesting objects can be viewed.

        The viewport border can also be set and colored.

        For more information, see New in VTK 9.3: Radial Gradient Background

        !!! note VTK 9.3 or later is required.

        !!! note The C++ version requires C++ 17 or later as std::filesystem is used.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/GradientBackground/#code","title":"Code","text":"

        GradientBackground.py

        #!/usr/bin/env python\n\n# Based on:\n#  https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/Core/Testing/Cxx/TestGradientBackground.cxx?ref_type=heads\n# See:\n#  [New in VTK 9.3: Radial Gradient Background](https://www.kitware.com/new-in-vtk-9-3-radial-gradient-background/)\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkCoordinate,\n    vtkPolyDataMapper,\n    vtkPolyDataMapper2D,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty,\n    vtkViewport\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Demonstrates the background shading options.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-f', '--file_name', default=None,\n                        help='An optional file name, e.g. star-wars-vader-tie-fighter.obj.')\n    args = parser.parse_args()\n    return args.file_name\n\n\ndef main(fn):\n    if fn:\n        fp = Path(fn)\n        if not fp.is_file():\n            print(f'The path: {fp} does not exist.')\n            return\n    else:\n        fp = None\n\n    pd = read_polydata_(fp)\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetWindowName('GradientBackground')\n\n    iren = vtkRenderWindowInteractor()\n    renderers = []\n\n    # For each gradient specify the mode.\n    modes = [\n        vtkViewport.GradientModes.VTK_GRADIENT_VERTICAL,\n        vtkViewport.GradientModes.VTK_GRADIENT_HORIZONTAL,\n        vtkViewport.GradientModes.VTK_GRADIENT_RADIAL_VIEWPORT_FARTHEST_SIDE,\n        vtkViewport.GradientModes.VTK_GRADIENT_RADIAL_VIEWPORT_FARTHEST_CORNER,\n    ]\n\n    colors = vtkNamedColors()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(pd)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Honeydew'))\n    actor.GetProperty().SetSpecular(0.3)\n    actor.GetProperty().SetSpecularPower(60.0)\n\n    ren_width = 640\n    ren_height = 480\n\n    # The bounds for each view port.\n    xmins = [0.0, 0.5, 0.0, 0.5]\n    ymins = [0.0, 0.0, 0.5, 0.5]\n    xmaxs = [0.5, 1.0, 0.5, 1.0]\n    ymaxs = [0.5, 0.5, 1.0, 1.0]\n\n    # Here we select and name the colors.\n    # Feel free to change colors.\n    bottom_color = colors.GetColor3d('Gold')\n    top_color = colors.GetColor3d('OrangeRed')\n    left_color = colors.GetColor3d('Gold')\n    right_color = colors.GetColor3d('OrangeRed')\n    center_color = colors.GetColor3d('Gold')\n    side_color = colors.GetColor3d('OrangeRed')\n    corner_color = colors.GetColor3d('OrangeRed')\n\n    viewport_title = [\"Vertical\",\n                      \"Horizontal\",\n                      \"Radial Farthest Side\",\n                      \"Radial Farthest Corner\",\n                      ]\n\n    # Create one text property for all.\n    text_property = vtkTextProperty()\n    text_property.SetJustificationToCentered()\n    text_property.SetFontSize(ren_height // 12)\n    text_property.SetColor(colors.GetColor3d('MidnightBlue'))\n\n    text_mappers = []\n    text_actors = []\n\n    # Define borders for the viewports  = [top, left, bottom, right].\n    lb = [False, True, True, False]\n    lbr = [False, True, True, True]\n    tlb = [True, True, True, False]\n    tlbr = [True, True, True, True]\n    border_color = 'DarkGreen'\n    border_width = 4.0\n\n    for i in range(0, 4):\n        text_mappers.append(vtkTextMapper())\n        text_mappers[i].SetInput(viewport_title[i])\n        text_mappers[i].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[i].SetMapper(text_mappers[i])\n        text_actors[i].SetPosition(ren_width / 2, 8)\n\n        renderers.append(vtkRenderer())\n        renderers[i].AddActor(text_actors[i])\n        renderers[i].AddActor(actor)\n        renderers[i].GradientBackgroundOn()\n        renderers[i].SetGradientMode(modes[i])\n\n        renderers[i].SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i])\n\n        if i == 1:\n            # Horizontal\n            renderers[i].SetBackground(left_color)\n            renderers[i].SetBackground2(right_color)\n            viewport_border(renderers[i], lbr, border_color, border_width)\n        elif i == 2:\n            # Radial Farthest Side\n            renderers[i].SetBackground(center_color)\n            renderers[i].SetBackground2(side_color)\n            viewport_border(renderers[i], tlb, border_color, border_width)\n        elif i == 3:\n            # Radial Farthest Corner\n            renderers[i].SetBackground(center_color)\n            renderers[i].SetBackground2(corner_color)\n            viewport_border(renderers[i], tlbr, border_color, border_width)\n        else:\n            # Vertical\n            renderers[i].SetBackground(bottom_color)\n            renderers[i].SetBackground2(top_color)\n            viewport_border(renderers[i], lb, border_color, border_width)\n\n        ren_win.AddRenderer(renderers[i])\n\n    ren_win.SetInteractor(iren)\n    ren_win.Render()\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    iren.Initialize()\n    iren.UpdateSize(ren_width * 2, ren_height * 2)\n\n    iren.Start()\n\n\ndef read_polydata_(path):\n    \"\"\"\n    Read from a file containing vtkPolyData.\n\n    If the path is empty a cone is returned.\n    If the extension is unknown a sphere is returned.\n\n    :param path: The path to the file.\n    :return: The vtkPolyData.\n    \"\"\"\n\n    poly_data = vtkPolyData()\n\n    if path is None:\n        # Default to a cone if the path is empty.\n        source = vtkConeSource()\n        source.SetResolution(25)\n        source.SetDirection(0, 1, 0)\n        source.SetHeight(1)\n        source.Update()\n        poly_data.DeepCopy(source.GetOutput())\n        return poly_data\n\n    valid_suffixes = ['.g', '.obj', '.stl', '.ply', '.vtk', '.vtp']\n    ext = path.suffix.lower()\n    if path.suffix not in valid_suffixes:\n        print('Warning:', path, 'unknown extension, using a sphere instead.')\n        source = vtkSphereSource()\n        source.SetPhiResolution(50)\n        source.SetThetaResolution(50)\n        source.Update()\n        poly_data.DeepCopy(source.GetOutput())\n    else:\n        if ext == '.ply':\n            reader = vtkPLYReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n        elif ext == '.vtp':\n            reader = vtkXMLPolyDataReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n        elif ext == '.obj':\n            reader = vtkOBJReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n        elif ext == '.stl':\n            reader = vtkSTLReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n        elif ext == '.vtk':\n            reader = vtkPolyDataReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n        elif ext == '.g':\n            reader = vtkBYUReader()\n            reader.SetGeometryFileName(file_name)\n            reader.Update()\n            poly_data.DeepCopy(reader.GetOutput())\n\n    return poly_data\n\n\ndef viewport_border(renderer, sides, border_color, border_width):\n    \"\"\"\n    Set a border around a viewport.\n\n    :param renderer: The renderer corresponding to the viewport.\n    :param sides: An array of boolean corresponding to [top, left, bottom, right]\n    :param border_color: The color of the border.\n    :param border_width: The width of the border.\n    :return:\n    \"\"\"\n    colors = vtkNamedColors()\n\n    # Points start at upper right and proceed anti-clockwise.\n    points = vtkPoints()\n    points.SetNumberOfPoints(4)\n    points.InsertPoint(0, 1, 1, 0)\n    points.InsertPoint(1, 0, 1, 0)\n    points.InsertPoint(2, 0, 0, 0)\n    points.InsertPoint(3, 1, 0, 0)\n\n    cells = vtkCellArray()\n    cells.Initialize()\n\n    if sides[0]:\n        # Top\n        top = vtkPolyLine()\n        top.GetPointIds().SetNumberOfIds(2)\n        top.GetPointIds().SetId(0, 0)\n        top.GetPointIds().SetId(1, 1)\n        cells.InsertNextCell(top)\n    if sides[1]:\n        # Left\n        left = vtkPolyLine()\n        left.GetPointIds().SetNumberOfIds(2)\n        left.GetPointIds().SetId(0, 1)\n        left.GetPointIds().SetId(1, 2)\n        cells.InsertNextCell(left)\n    if sides[2]:\n        # Bottom\n        bottom = vtkPolyLine()\n        bottom.GetPointIds().SetNumberOfIds(2)\n        bottom.GetPointIds().SetId(0, 2)\n        bottom.GetPointIds().SetId(1, 3)\n        cells.InsertNextCell(bottom)\n    if sides[3]:\n        # Right\n        right = vtkPolyLine()\n        right.GetPointIds().SetNumberOfIds(2)\n        right.GetPointIds().SetId(0, 3)\n        right.GetPointIds().SetId(1, 0)\n        cells.InsertNextCell(right)\n\n    # Now make the polydata and display it.\n    poly = vtkPolyData()\n    poly.Initialize()\n    poly.SetPoints(points)\n    poly.SetLines(cells)\n\n    # Use normalized viewport coordinates since\n    # they are independent of window size.\n    coordinate = vtkCoordinate()\n    coordinate.SetCoordinateSystemToNormalizedViewport()\n\n    mapper = vtkPolyDataMapper2D()\n    mapper.SetInputData(poly)\n    mapper.SetTransformCoordinate(coordinate)\n\n    actor = vtkActor2D()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d(border_color))\n\n    # Line width should be at least 2 to be visible at extremes.\n    actor.GetProperty().SetLineWidth(border_width)\n\n    renderer.AddViewProp(actor)\n\n\nif __name__ == '__main__':\n    import sys\n\n    file_name = get_program_parameters(sys.argv)\n    main(file_name)\n
        "},{"location":"Python/Rendering/LayeredActors/","title":"LayeredActors","text":"

        vtk-examples/Python/Rendering/LayeredActors

        "},{"location":"Python/Rendering/LayeredActors/#description","title":"Description","text":"

        Demonstrates the use of two renderers in a render window. Notice that the second (and subsequent) renderers will have a transparent background.

        The first layer (layer 0) contains the base object, a slab in this case. The second layer (layer 1) contains an object (axes in this case). This axes object will always be in front of the base layer object. When the program runs, the top-most layer will be the active layer, layer 1 in this case.

        Two callbacks are provided, the first callback selects which layer is active:

        • Pressing 0 on the keyboard will let you manipulate the objects in layer 0.
        • Pressing 1 on the keyboard will let you manipulate the objects in layer 1.

        The second callback allows you to orient objects in all layers using the object in the active layer.

        Note

        Objects in the top-most layer will always be in front of any objects in other layers.

        Info

        This is an extension of the TransparentBackground.cxx and TransparentBackground.py examples, extended by adding an extra callback so that the non-active layer objects move in conjunction with the active layer objects.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/LayeredActors/#code","title":"Code","text":"

        LayeredActors.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef generate_and_display_cube_and_axes():\n    colors = vtkNamedColors()\n\n    # Make the slab and axes actors.\n    cube_source = vtkCubeSource()\n    cube_source.SetXLength(4.0)\n    cube_source.SetYLength(9.0)\n    cube_source.SetZLength(1.0)\n    cube_source.SetCenter(0.0, 0.0, 0.0)\n\n    cube_mapper = vtkPolyDataMapper()\n    cube_mapper.SetInputConnection(cube_source.GetOutputPort())\n\n    back = vtkProperty()\n    back.SetColor(colors.GetColor3d('Sienna'))\n\n    cube_actor = vtkActor()\n    cube_actor.GetProperty().SetDiffuseColor(colors.GetColor3d('BurlyWood'))\n    cube_actor.SetMapper(cube_mapper)\n    cube_actor.GetProperty().EdgeVisibilityOn()\n    cube_actor.GetProperty().SetLineWidth(2.0)\n    cube_actor.GetProperty().SetEdgeColor(colors.GetColor3d('PapayaWhip'))\n    cube_actor.SetBackfaceProperty(back)\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 0.0, 0.0)\n\n    axes = vtkAxesActor()\n    # The axes can be positioned with a user transform.\n    axes.SetUserTransform(transform)\n\n    # The renderers, render window and interactor.\n    renderers = list()\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(800, 800)\n    ren_win.SetWindowName('LayeredActors')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    # Define the renderers and allocate them to layers.\n    for i in range(0, 2):\n        renderers.append(vtkRenderer())\n        ren_win.AddRenderer(renderers[i])\n        renderers[i].SetLayer(i)\n\n    # Layer 0 - background not transparent.\n    renderers[0].SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renderers[0].AddActor(cube_actor)\n    renderers[0].SetLayer(0)\n    # Layer 1 - the background is transparent,\n    #           so we only see the layer 0 background color\n    renderers[1].AddActor(axes)\n    renderers[1].SetBackground(colors.GetColor3d('MidnightBlue'))\n    renderers[1].SetLayer(1)\n\n    # Set a common camera view for each layer.\n    for renderer in renderers:\n        camera = renderer.GetActiveCamera()\n        camera.Elevation(-30)\n        camera.Azimuth(-30)\n        renderer.ResetCamera()\n\n    #  We have two layers.\n    ren_win.SetNumberOfLayers(len(renderers))\n\n    ren_win.Render()\n\n    iren.AddObserver('KeyPressEvent', select_layer)\n    iren.AddObserver('EndInteractionEvent', orient_layer)\n\n    iren.Start()\n\n\ndef select_layer(caller, ev):\n    \"\"\"\n    Select the layer to manipulate.\n    :param caller:\n    :param ev:\n    :return:\n    \"\"\"\n    iren = caller\n    renderers = iren.GetRenderWindow().GetRenderers()\n    if renderers.GetNumberOfItems() < 2:\n        print('We need at least two renderers, we have only', renderers.GetNumberOfItems())\n        return\n    renderers.InitTraversal()\n    # Top item.\n    ren0 = renderers.GetNextItem()\n    # Bottom item.\n    ren1 = renderers.GetNextItem()\n\n    key = iren.GetKeySym()\n\n    if key == '0':\n        print('Selected layer:', key)\n        iren.GetRenderWindow().GetInteractor().GetInteractorStyle().SetDefaultRenderer(ren0)\n        ren0.InteractiveOn()\n        ren1.InteractiveOff()\n    if key == '1':\n        print('Selected layer:', key)\n        iren.GetRenderWindow().GetInteractor().GetInteractorStyle().SetDefaultRenderer(ren1)\n        ren0.InteractiveOff()\n        ren1.InteractiveOn()\n\n\ndef orient_layer(caller, ev):\n    \"\"\"\n    Orient layer 0 based on the camera orientation in layer 1 or vice versa.\n\n    :param caller:\n    :param ev:\n    :return:\n    \"\"\"\n\n    iren = caller\n    renderers = iren.GetRenderWindow().GetRenderers()\n    if renderers.GetNumberOfItems() < 2:\n        print('We need at least two renderers, we have only', renderers.GetNumberOfItems())\n        return\n    renderers.InitTraversal()\n    # Top item.\n    ren0 = renderers.GetNextItem()\n    # Bottom item.\n    ren1 = renderers.GetNextItem()\n\n    if ren1.GetInteractive():\n        orient1 = get_orientation(ren1)\n        set_orientation(ren0, orient1)\n        ren0.ResetCamera()\n    else:\n        orient0 = get_orientation(ren0)\n        set_orientation(ren1, orient0)\n        ren1.ResetCamera()\n\n\ndef get_orientation(ren):\n    \"\"\"\n    Get the camera orientation.\n    :param ren: The renderer.\n    :return: The orientation parameters.\n    \"\"\"\n    p = dict()\n    camera = ren.GetActiveCamera()\n    p['position'] = camera.GetPosition()\n    p['focal point'] = camera.GetFocalPoint()\n    p['view up'] = camera.GetViewUp()\n    p['distance'] = camera.GetDistance()\n    p['clipping range'] = camera.GetClippingRange()\n    p['orientation'] = camera.GetOrientation()\n    return p\n\n\ndef set_orientation(ren, p):\n    \"\"\"\n    Set the orientation of the camera.\n    :param ren: The renderer.\n    :param p: The orientation parameters.\n    :return:\n    \"\"\"\n    camera = ren.GetActiveCamera()\n    camera.SetPosition(p['position'])\n    camera.SetFocalPoint(p['focal point'])\n    camera.SetViewUp(p['view up'])\n    camera.SetDistance(p['distance'])\n    camera.SetClippingRange(p['clipping range'])\n\n\ndef main():\n    generate_and_display_cube_and_axes()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/Mace/","title":"Mace","text":"

        vtk-examples/Python/Rendering/Mace

        "},{"location":"Python/Rendering/Mace/#description","title":"Description","text":"

        An example of multiple inputs and outputs.

        Info

        See Figure 4-21 in Chapter 4 the VTK Textbook.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/Mace/#code","title":"Code","text":"

        Mace.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(8)\n    sphere.SetPhiResolution(8)\n\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    cone = vtkConeSource()\n    cone.SetResolution(6)\n\n    glyph = vtkGlyph3D()\n    glyph.SetInputConnection(sphere.GetOutputPort())\n    glyph.SetSourceConnection(cone.GetOutputPort())\n    glyph.SetVectorModeToUseNormal()\n    glyph.SetScaleModeToScaleByVector()\n    glyph.SetScaleFactor(0.25)\n\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(glyph.GetOutputPort())\n\n    spikeActor = vtkActor()\n    spikeActor.SetMapper(spikeMapper)\n    spikeActor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    renderer.AddActor(sphereActor)\n    renderer.AddActor(spikeActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('Mace')\n\n    # Interact with the data.\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/Model/","title":"Model","text":"

        vtk-examples/Python/Rendering/Model

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/Model/#code","title":"Code","text":"

        Model.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the colors.\n    colors.SetColor('CubeColor', [250, 128, 114, 255])\n    colors.SetColor('BkgColor', [230, 230, 230, 255])\n\n    # Create the rendering windows and three renderers.\n\n    ren1 = vtkRenderer()\n    ren2 = vtkRenderer()\n    renWindow1 = vtkRenderWindow()\n    renWindow1.AddRenderer(ren1)\n    renWindow1.AddRenderer(ren2)\n    renWindow1.SetWindowName('Model')\n\n    iren1 = vtkRenderWindowInteractor()\n    iren1.SetRenderWindow(renWindow1)\n    ren3 = vtkRenderer()\n    renWindow2 = vtkRenderWindow()\n    renWindow2.SetWindowName('Model')\n\n    renWindow2.AddRenderer(ren3)\n    iren2 = vtkRenderWindowInteractor()\n    iren2.SetRenderWindow(renWindow2)\n\n    # Create an actor and give it cone geometry.\n    cone = vtkConeSource()\n    cone.SetResolution(8)\n\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n\n    # Create an actor and give it cube geometry.\n    cube = vtkCubeSource()\n\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputConnection(cube.GetOutputPort())\n\n    cubeActor = vtkActor()\n    cubeActor.SetMapper(cubeMapper)\n    cubeActor.GetProperty().SetColor(colors.GetColor3d('CubeColor'))\n\n    # Create an actor and give it sphere geometry.\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(16)\n    sphere.SetPhiResolution(16)\n\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d('Melon'))\n\n    # Assign our actors to both renderers.\n    ren1.AddActor(coneActor)\n    ren2.AddActor(sphereActor)\n    ren3.AddActor(cubeActor)\n\n    # set the size of our window\n    renWindow1.SetSize(300, 150)\n    renWindow1.SetPosition(0, 50)\n    renWindow2.SetSize(300, 300)\n    renWindow2.SetPosition(0, 300)\n\n    # Set the viewports and backgrounds of the renderers.\n    ren1.SetViewport(0, 0, 0.5, 1)\n    ren1.SetBackground(colors.GetColor3d('BkgColor'))\n    ren2.SetViewport(0.5, 0, 1, 1)\n    ren2.SetBackground(colors.GetColor3d('Linen'))\n    ren3.SetBackground(colors.GetColor3d('Honeydew'))\n\n    # Draw the resulting scene.\n    renWindow1.Render()\n    renWindow2.Render()\n\n    iren1.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/MotionBlur/","title":"MotionBlur","text":"

        vtk-examples/Python/Rendering/MotionBlur

        "},{"location":"Python/Rendering/MotionBlur/#description","title":"Description","text":"

        Example of motion blur.

        Info

        See Figure 7-36 in Chapter 7 in the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/MotionBlur/#code","title":"Code","text":"

        MotionBlur.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkRenderStepsPass,\n    vtkSimpleMotionBlurPass\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    colors.SetColor('A1Diff', [255, 204, 77, 255])\n    colors.SetColor('A2Amb', [51, 51, 255, 255])\n    colors.SetColor('A2Diff', [51, 255, 204, 255])\n    colors.SetColor('A3Amb', [128, 166, 255, 255])\n    colors.SetColor('Bkg', [77, 102, 153, 255])\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Bkg'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(500, 500)\n    renderWindow.SetWindowName('MotionBlur')\n\n    renderWindow.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renderWindow)\n\n    reader = vtkPLYReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    # create three models\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetAmbientColor(colors.GetColor3d('Red'))\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('A1Diff'))\n    actor.GetProperty().SetSpecular(0.0)\n    actor.GetProperty().SetDiffuse(0.5)\n    actor.GetProperty().SetAmbient(0.3)\n    actor.SetPosition(-0.1, 0.0, -0.1)\n    renderer.AddActor(actor)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetAmbientColor(colors.GetColor3d('A2Amb'))\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('A2Diff'))\n    actor.GetProperty().SetSpecularColor(colors.GetColor3d('Black'))\n    actor.GetProperty().SetSpecular(0.2)\n    actor.GetProperty().SetDiffuse(0.9)\n    actor.GetProperty().SetAmbient(0.1)\n    actor.GetProperty().SetSpecularPower(10.0)\n    renderer.AddActor(actor)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('A3Amb'))\n    actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    actor.GetProperty().SetSpecular(0.7)\n    actor.GetProperty().SetDiffuse(0.4)\n    actor.GetProperty().SetSpecularPower(60.0)\n    actor.SetPosition(0.1, 0.0, 0.1)\n    renderer.AddActor(actor)\n\n    renderWindow.SetMultiSamples(0)\n\n    # create the basic VTK render steps\n    basicPasses = vtkRenderStepsPass()\n\n    motion = vtkSimpleMotionBlurPass()\n    motion.SetDelegatePass(basicPasses)\n\n    # Tell the renderer to use our render pass pipeline.\n    renderer.SetPass(motion)\n\n    numRenders = 30\n\n    renderer.GetActiveCamera().SetPosition(0, 0, -1)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 1, 0)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(15.0)\n    renderer.GetActiveCamera().Zoom(1.2)\n\n    renderWindow.Render()\n\n    for i in range(0, numRenders):\n        renderer.GetActiveCamera().Azimuth(10.0 / numRenders)\n        renderer.GetActiveCamera().Elevation(10.0 / numRenders)\n        renderWindow.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Example of motion blur.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Armadillo.ply.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/OutlineGlowPass/","title":"OutlineGlowPass","text":"

        vtk-examples/Python/Rendering/OutlineGlowPass

        "},{"location":"Python/Rendering/OutlineGlowPass/#description","title":"Description","text":"

        Demonstrates how to render an object in a scene with a glowing outline.

        The class vtkOutlineGlowPass is designed to highlight parts of a scene by applying the render pass to a layered renderer on top of the main scene. For optimal results, actors that form the outline should be brightly colored with lighting disabled. The outline will have the color of the actors. There is only one outline around all objects rendered by the delegate.

        When combined with layered renderers, this creates a very visible highlight without altering the highlighted object.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/OutlineGlowPass/#code","title":"Code","text":"

        OutlineGlowPass.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersSources import vtkArrowSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkOutlineGlowPass,\n    vtkRenderStepsPass\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'How to render an object in a scene with a glowing outline.'\n    epilogue = '''\nParts of a scene are highlighted by applying the render pass to a layered renderer\n on top of the main scene. For optimal results, actors that form the outline\n should be brightly colored with lighting disabled. The outline will have the\n color of the actors. There is only one outline around all objects rendered by the delegate.\n\nWhen combined with layered renderers, this creates a very visible highlight without\n altering the highlighted object.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.parse_args()\n    return\n\n\ndef main():\n    if not vtk_version_ok(9, 0, 20200909):\n        print('You need VTK version 9.0.20200909 or greater to run this program.')\n        return\n    get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    iren = vtkRenderWindowInteractor()\n    renWin = vtkRenderWindow()\n    renWin.SetMultiSamples(0)\n\n    iren.SetRenderWindow(renWin)\n\n    # Set up the renderers\n    # One for the object and the other for the outline\n    renderer = vtkRenderer()\n    rendererOutline = vtkRenderer()\n    rendererOutline.SetLayer(1)\n    renWin.SetNumberOfLayers(2)\n    renWin.AddRenderer(rendererOutline)\n    renWin.AddRenderer(renderer)\n\n    # Create an arrow.\n    arrowSource = vtkArrowSource()\n    # arrowSource.SetShaftRadius(1.0)\n    # arrowSource.SetTipLength(1.0)\n    arrowSource.Update()\n\n    # Create mapper and actor for the main renderer\n    coneMapperMain = vtkPolyDataMapper()\n    coneMapperMain.SetInputConnection(arrowSource.GetOutputPort())\n\n    coneActorMain = vtkActor()\n    coneActorMain.SetMapper(coneMapperMain)\n    coneActorMain.GetProperty().SetDiffuseColor(colors.GetColor3d(\"LimeGreen\"))\n\n    renderer.AddActor(coneActorMain)\n\n    # Lets make the outline glow!\n    # Create the render pass\n    basicPasses = vtkRenderStepsPass()\n    glowPass = vtkOutlineGlowPass()\n    glowPass.SetDelegatePass(basicPasses)\n\n    # Apply the render pass to the highlight renderer\n    rendererOutline.SetPass(glowPass)\n\n    # Create mapper and actor for the outline\n    coneMapperOutline = vtkPolyDataMapper()\n    coneMapperOutline.SetInputConnection(arrowSource.GetOutputPort())\n\n    coneActorOutline = vtkActor()\n    coneActorOutline.SetMapper(coneMapperOutline)\n    coneActorOutline.GetProperty().SetColor(colors.GetColor3d(\"Magenta\"))\n    coneActorOutline.GetProperty().LightingOff()\n\n    rendererOutline.AddActor(coneActorOutline)\n\n    renWin.SetSize(600, 600)\n\n    renderer.GradientBackgroundOn()\n    renderer.SetBackground(colors.GetColor3d(\"DarkSlateGray\"))\n    renderer.SetBackground2(colors.GetColor3d(\"DarkSlateBlue\"))\n\n    renderer.ResetCamera()\n    camera = renderer.GetActiveCamera()\n    camera.Roll(45.0)\n    camera.Azimuth(-30.0)\n    camera.Elevation(-15.0)\n    renderer.ResetCamera()\n    # Now set the active camera for the outline\n    rendererOutline.SetActiveCamera(camera)\n\n    renWin.SetWindowName('OutlineGlowPass')\n\n    renWin.Render()\n\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/PBR_Anisotropy/","title":"PBR Anisotropy","text":"

        vtk-examples/Python/Rendering/PBR_Anisotropy

        "},{"location":"Python/Rendering/PBR_Anisotropy/#description","title":"Description","text":"

        This example is based on TestPBRAnisotropy.cxx and renders spheres with different anisotropy values.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Python/Rendering/PBR_Anisotropy/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/PBR_Anisotropy/#code","title":"Code","text":"

        PBR_Anisotropy.py

        #!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataTangents\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkFiltersTexture import vtkTextureMapToSphere\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkOpenGLRenderer,\n    vtkOpenGLSkybox\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Render spheres with different anisotropy values.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-e', '--use_equirectangular', action='store_true',\n                        help='Use the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_equirectangular\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    use_cubemap = not use_cubemap\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n    colors.SetColor('Brass', [184, 115, 51, 255])\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkOpenGLSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(75)\n    sphere.SetPhiResolution(75)\n\n    pd_sphere = vtkPolyDataMapper()\n    pd_sphere.SetInputConnection(sphere.GetOutputPort())\n\n    texture_map = vtkTextureMapToSphere()\n    texture_map.SetInputConnection(sphere.GetOutputPort())\n    texture_map.PreventSeamOff()\n\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(texture_map.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(tangents.GetOutputPort())\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 0.0, 0.0)\n        actor_sphere.RotateX(20)\n        actor_sphere.RotateY(20)\n        actor_sphere.SetMapper(mapper)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetAnisotropy(1.0)\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 1.0, 0.0)\n        actor_sphere.RotateX(20)\n        actor_sphere.RotateY(20)\n        actor_sphere.SetMapper(mapper)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(0.1)\n        actor_sphere.GetProperty().SetAnisotropy(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 2.0, 0.0)\n        actor_sphere.RotateX(20)\n        actor_sphere.RotateY(20)\n        actor_sphere.SetMapper(mapper)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(0.1)\n        actor_sphere.GetProperty().SetAnisotropy(1.0)\n        actor_sphere.GetProperty().SetAnisotropyRotation(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Anisotropy')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/PBR_Clear_Coat/","title":"PBR Clear Coat","text":"

        vtk-examples/Python/Rendering/PBR_Clear_Coat

        "},{"location":"Python/Rendering/PBR_Clear_Coat/#description","title":"Description","text":"

        This example is based on TestPBRClearCoat.cxx and renders a cube with custom texture mapping and a coat normal texture.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Python/Rendering/PBR_Clear_Coat/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/PBR_Clear_Coat/#code","title":"Code","text":"

        PBR_Clear_Coat.py

        #!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory,\n    vtkPNGReader\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import vtkOpenGLRenderer\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Render a cube with custom texture mapping and a coat normal texture.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-e', '--use_equirectangular', action='store_true',\n                        help='Use the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_equirectangular\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    use_cubemap = not use_cubemap\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n    ren.AutomaticLightCreationOff()\n\n    light = vtkLight()\n    light.SetPosition(2.0, 0.0, 2.0)\n    light.SetFocalPoint(0.0, 0.0, 0.0)\n\n    ren.AddLight(light)\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    cube = vtkCubeSource()\n\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(cube.GetOutputPort())\n\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(triangulation.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(tangents.GetOutputPort())\n\n    material_reader = vtkPNGReader()\n    material_reader.SetFileName(parameters['material'])\n\n    material = vtkTexture()\n    material.InterpolateOn()\n    material.SetInputConnection(material_reader.GetOutputPort())\n\n    albedo_reader = vtkPNGReader()\n    albedo_reader.SetFileName(parameters['albedo'])\n\n    albedo = vtkTexture()\n    albedo.UseSRGBColorSpaceOn()\n    albedo.InterpolateOn()\n    albedo.SetInputConnection(albedo_reader.GetOutputPort())\n\n    normal_reader = vtkPNGReader()\n    normal_reader.SetFileName(parameters['normal'])\n\n    # Uncomment this if you want a similar image to the VTK test image.\n    # flip = vtkImageFlip()\n    # flip.SetInputConnection(normal_reader.GetOutputPort())\n    # flip.SetFilteredAxes(0)\n\n    normal = vtkTexture()\n    normal.InterpolateOn()\n    normal.SetInputConnection(normal_reader.GetOutputPort())\n\n    coat_normal = vtkTexture()\n    coat_normal.InterpolateOn()\n    coat_normal.SetInputConnection(normal_reader.GetOutputPort())\n    # Uncomment this if you want a similar image to the VTK test image.\n    # coat_normal.SetInputConnection(flip.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetOrientation(0.0, 25.0, 0.0)\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetInterpolationToPBR()\n\n    # Set metallic, roughness and coat strength to 1.0 as they act as multipliers\n    # with texture value.\n    actor.GetProperty().SetMetallic(1.0)\n    actor.GetProperty().SetRoughness(1.0)\n    actor.GetProperty().SetCoatStrength(1.0)\n    actor.GetProperty().SetCoatColor(colors.GetColor3d('Red'))\n\n    actor.GetProperty().SetBaseColorTexture(albedo)\n    actor.GetProperty().SetORMTexture(material)\n    actor.GetProperty().SetNormalTexture(normal)\n    actor.GetProperty().SetCoatNormalTexture(coat_normal)\n\n    ren.AddActor(actor)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Clear_Coat')\n\n    ren_win.Render()\n    ren.GetActiveCamera().Zoom(1.5)\n\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/PBR_Edge_Tint/","title":"PBR Edge Tint","text":"

        vtk-examples/Python/Rendering/PBR_Edge_Tint

        "},{"location":"Python/Rendering/PBR_Edge_Tint/#description","title":"Description","text":"

        This example is based on TestPBREdgeTint.cxx and renders spheres with different edge colors using a skybox as image based lighting.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Python/Rendering/PBR_Edge_Tint/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/PBR_Edge_Tint/#code","title":"Code","text":"

        PBR_Edge_Tint.py

        #!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import vtkOpenGLRenderer\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Render spheres with different edge colors using a skybox as image based lighting.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-c', '--use_cubemap', action='store_true',\n                        help='Build the cubemap from the six cubemap files.'\n                             ' Overrides the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_cubemap\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(75)\n    sphere.SetPhiResolution(75)\n\n    pd_sphere = vtkPolyDataMapper()\n    pd_sphere.SetInputConnection(sphere.GetOutputPort())\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 0.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetEdgeTint(colors.GetColor3d('Black'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 1.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Black'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetEdgeTint(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 2.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Blue'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetEdgeTint(colors.GetColor3d('Red'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 3.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Red'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetEdgeTint(colors.GetColor3d('Blue'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 4.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Black'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetEdgeTint(colors.GetColor3d('Yellow'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Edge_Tint')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/PBR_HDR_Environment/","title":"PBR HDR Environment","text":"

        vtk-examples/Python/Rendering/PBR_HDR_Environment

        "},{"location":"Python/Rendering/PBR_HDR_Environment/#description","title":"Description","text":"

        This example is based on TestPBRHdrEnvironment.cxx and renders spheres with different materials using a skybox as image based lighting.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Python/Rendering/PBR_HDR_Environment/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/PBR_HDR_Environment/#code","title":"Code","text":"

        PBR_HDR_Environment.py

        #!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import vtkOpenGLRenderer\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Renders spheres with different materials using a skybox as image based lighting.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-c', '--use_cubemap', action='store_true',\n                        help='Build the cubemap from the six cubemap files.'\n                             ' Overrides the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_cubemap\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(75)\n    sphere.SetPhiResolution(75)\n\n    pd_sphere = vtkPolyDataMapper()\n    pd_sphere.SetInputConnection(sphere.GetOutputPort())\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 0.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_HDR_Environment')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/PBR_Mapping/","title":"PBR Mapping","text":"

        vtk-examples/Python/Rendering/PBR_Mapping

        "},{"location":"Python/Rendering/PBR_Mapping/#description","title":"Description","text":"

        This example is based on TestPBRMapping.cxx and renders spheres with different edge colors using a skybox as image based lighting.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Python/Rendering/PBR_Mapping/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/PBR_Mapping/#code","title":"Code","text":"

        PBR_Mapping.py

        #!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory,\n    vtkPNGReader\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import vtkOpenGLRenderer\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Render a cube with custom texture mapping.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-e', '--use_equirectangular', action='store_true',\n                        help='Use the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_equirectangular\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    use_cubemap = not use_cubemap\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n    ren.AutomaticLightCreationOff()\n\n    light = vtkLight()\n    light.SetPosition(2.0, 0.0, 2.0)\n    light.SetFocalPoint(0.0, 0.0, 0.0)\n\n    ren.AddLight(light)\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    cube = vtkCubeSource()\n\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(cube.GetOutputPort())\n\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(triangulation.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(tangents.GetOutputPort())\n\n    material_reader = vtkPNGReader()\n    material_reader.SetFileName(parameters['material'])\n\n    material = vtkTexture()\n    material.InterpolateOn()\n    material.SetInputConnection(material_reader.GetOutputPort())\n\n    albedo_reader = vtkPNGReader()\n    albedo_reader.SetFileName(parameters['albedo'])\n\n    albedo = vtkTexture()\n    albedo.UseSRGBColorSpaceOn()\n    albedo.InterpolateOn()\n    albedo.SetInputConnection(albedo_reader.GetOutputPort())\n\n    normal_reader = vtkPNGReader()\n    normal_reader.SetFileName(parameters['normal'])\n\n    normal = vtkTexture()\n    normal.InterpolateOn()\n    normal.SetInputConnection(normal_reader.GetOutputPort())\n\n    anisotropy_reader = vtkPNGReader()\n    anisotropy_reader.SetFileName(parameters['anisotropy'])\n\n    anisotropy = vtkTexture()\n    anisotropy.InterpolateOn()\n    anisotropy.SetInputConnection(anisotropy_reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetOrientation(0.0, 25.0, 0.0)\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetInterpolationToPBR()\n\n    # Set metallic, roughness, anisotropy and anisotropyRotation\n    #  to 1.0 as they act as multipliers with texture value.\n    actor.GetProperty().SetMetallic(1.0)\n    actor.GetProperty().SetRoughness(1.0)\n    actor.GetProperty().SetAnisotropy(1.0)\n    actor.GetProperty().SetAnisotropyRotation(1.0)\n    actor.GetProperty().SetColor(colors.GetColor3d('White'))\n\n    actor.GetProperty().SetBaseColorTexture(albedo)\n    actor.GetProperty().SetORMTexture(material)\n    actor.GetProperty().SetNormalTexture(normal)\n    actor.GetProperty().SetAnisotropyTexture(anisotropy)\n\n    ren.AddActor(actor)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Mapping')\n\n    ren_win.Render()\n    ren.GetActiveCamera().Zoom(1.5)\n\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/PBR_Materials/","title":"PBR Materials","text":"

        vtk-examples/Python/Rendering/PBR_Materials

        "},{"location":"Python/Rendering/PBR_Materials/#description","title":"Description","text":"

        This example is based on TestPBRMaterials.cxx and renders spheres with different materials using a skybox as image based lighting. Red, cyan and black spheres are dielectric, brass and white spheres are metallic. Roughness ranges from 0 to 1 in steps of 0.2.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Python/Rendering/PBR_Materials/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/PBR_Materials/#code","title":"Code","text":"

        PBR_Materials.py

        #!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkOpenGLRenderer,\n    vtkOpenGLSkybox\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Renders spheres with different materials using a skybox as image based lighting.'\n    epilogue = '''\nRed, cyan and black spheres are dielectric, brass and white spheres are metallic.\nRoughness ranges from 0 to 1 in steps of 0.2.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-e', '--use_equirectangular', action='store_true',\n                        help='Use the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_equirectangular\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    use_cubemap = not use_cubemap\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n    colors.SetColor('Brass', [184, 115, 51, 255])\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkOpenGLSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(100)\n    sphere.SetPhiResolution(100)\n\n    pd_sphere = vtkPolyDataMapper()\n    pd_sphere.SetInputConnection(sphere.GetOutputPort())\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 0.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 1.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Brass'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 2.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Black'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 3.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Cyan'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 4.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Red'))\n        actor_sphere.GetProperty().SetRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Materials')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/PBR_Materials_Coat/","title":"PBR Materials Coat","text":"

        vtk-examples/Python/Rendering/PBR_Materials_Coat

        "},{"location":"Python/Rendering/PBR_Materials_Coat/#description","title":"Description","text":"

        This example is based on TestPBRMaterialsCoat.cxx and renders spheres with different coat materials using a skybox as image based lighting.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from a HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a generic JSON file, not all the parameters are used:

        <DATA>/PBR_Examples.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Python/Rendering/PBR_Materials_Coat/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Examples.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/PBR_Materials_Coat/#code","title":"Code","text":"

        PBR_Materials_Coat.py

        #!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkImageReader2Factory\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkOpenGLRenderer,\n    vtkOpenGLSkybox\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Render spheres with different coat materials using a skybox as image based lighting.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-e', '--use_equirectangular', action='store_true',\n                        help='Use the equirectangular entry in the json file.')\n    args = parser.parse_args()\n    return args.file_name, args.use_equirectangular\n\n\ndef main():\n    fn, use_cubemap = get_program_parameters()\n    use_cubemap = not use_cubemap\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    colors = vtkNamedColors()\n    colors.SetColor('Brass', [184, 115, 51, 255])\n    colors.SetColor('DarkTeal', [0, 128, 77, 255])\n\n    ren = vtkOpenGLRenderer()\n    ren.SetBackground(colors.GetColor3d('Black'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(600, 600)\n    ren_win.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    skybox = vtkOpenGLSkybox()\n\n    irradiance = ren.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    ren.UseImageBasedLightingOn()\n    if is_hdr:\n        ren.UseSphericalHarmonicsOn()\n        ren.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren.UseSphericalHarmonicsOff()\n        ren.SetEnvironmentTexture(env_texture, True)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(75)\n    sphere.SetPhiResolution(75)\n\n    pd_sphere = vtkPolyDataMapper()\n    pd_sphere.SetInputConnection(sphere.GetOutputPort())\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 0.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Brass'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(0.1)\n        actor_sphere.GetProperty().SetCoatStrength(1.0)\n        actor_sphere.GetProperty().SetCoatRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 1.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('Brass'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(1.0)\n        actor_sphere.GetProperty().SetCoatStrength(1.0)\n        actor_sphere.GetProperty().SetCoatRoughness(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 2.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetMetallic(1.0)\n        actor_sphere.GetProperty().SetRoughness(0.1)\n        actor_sphere.GetProperty().SetCoatColor(colors.GetColor3d('Red'))\n        actor_sphere.GetProperty().SetCoatRoughness(0.1)\n        actor_sphere.GetProperty().SetCoatStrength(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 3.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('White'))\n        actor_sphere.GetProperty().SetRoughness(0.1)\n        actor_sphere.GetProperty().SetCoatColor(colors.GetColor3d('Red'))\n        actor_sphere.GetProperty().SetCoatRoughness(1.0)\n        actor_sphere.GetProperty().SetCoatStrength(i / 5.0)\n        ren.AddActor(actor_sphere)\n\n    for i in range(0, 6):\n        actor_sphere = vtkActor()\n        actor_sphere.SetPosition(i, 4.0, 0.0)\n        actor_sphere.SetMapper(pd_sphere)\n        actor_sphere.GetProperty().SetInterpolationToPBR()\n        actor_sphere.GetProperty().SetColor(colors.GetColor3d('DarkTeal'))\n        actor_sphere.GetProperty().SetBaseIOR(1.0 + i / 3.0)\n        ren.AddActor(actor_sphere)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren.AddActor(skybox)\n\n    ren_win.SetWindowName('PBR_Materials_Coat')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/PBR_Skybox/","title":"PBR Skybox","text":"

        vtk-examples/Python/Rendering/PBR_Skybox

        "},{"location":"Python/Rendering/PBR_Skybox/#description","title":"Description","text":"

        Demonstrates physically based rendering using image based lighting and a skybox.

        Physically based rendering sets color, metallicity and roughness of the object, sliders are provided so that you can experiment with the various parameters.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

        <DATA>/PBR_Skybox.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Python/Rendering/PBR_Skybox/#options","title":"Options","text":"
        Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

        Additionally, you can save a screenshot by pressing \"k\".

        "},{"location":"Python/Rendering/PBR_Skybox/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Skybox.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/PBR_Skybox/#code","title":"Code","text":"

        PBR_Skybox.py

        #!/usr/bin/env python3\n\nimport json\nimport sys\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBoy,\n    vtkParametricMobius,\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkCommand,\n    vtkFloatArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkClipPolyData,\n    vtkPolyDataNormals,\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkLinearSubdivisionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkParametricFunctionSource,\n    vtkTexturedSphereSource\n)\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkJPEGWriter,\n    vtkImageReader2Factory,\n    vtkPNGWriter\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget,\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkCameraPass,\n    vtkLightsPass,\n    vtkOpaquePass,\n    vtkOverlayPass,\n    vtkRenderPassCollection,\n    vtkSequencePass,\n    vtkToneMappingPass\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrates physically based rendering, image based lighting and a skybox.'\n    epilogue = '''\nPhysically based rendering sets color, metallicity and roughness of the object.\nImage based lighting uses a cubemap texture to specify the environment.\nA Skybox is used to create the illusion of distant three-dimensional surroundings.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-s', '--surface', default='',\n                        help='The name of the surface. Overrides the surface entry in the json file.')\n    parser.add_argument('-c', '--use_cubemap', action='store_true',\n                        help='Build the cubemap from the six cubemap files.'\n                             ' Overrides the equirectangular entry in the json file.')\n    parser.add_argument('-t', '--use_tonemapping', action='store_true',\n                        help='Use tone mapping.')\n    args = parser.parse_args()\n    return args.file_name, args.surface, args.use_cubemap, args.use_tonemapping\n\n\ndef main():\n    if not vtk_version_ok(9, 0, 0):\n        print('You need VTK version 9.0 or greater to run this program.')\n        return\n\n    colors = vtkNamedColors()\n\n    # Default background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    fn, surface_name, use_cubemap, use_tonemapping = get_program_parameters()\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n\n    # Check for missing parameters.\n    if 'bkgcolor' not in parameters.keys():\n        parameters['bkgcolor'] = 'BkgColor'\n    if 'objcolor' not in parameters.keys():\n        parameters['objcolor'] = 'White'\n    if 'skybox' not in parameters.keys():\n        parameters['skybox'] = False\n    if surface_name:\n        parameters['object'] = surface_name\n\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    # Build the pipeline.\n    # ren1 is for the slider rendering,\n    # ren2 is for the object rendering.\n    ren1 = vtkRenderer()\n    # ren2 = vtkOpenGLRenderer()\n    ren2 = vtkRenderer()\n    ren1.SetBackground(colors.GetColor3d('Snow'))\n    ren2.SetBackground(colors.GetColor3d(parameters['bkgcolor']))\n\n    render_window = vtkRenderWindow()\n    # The order here is important.\n    # This ensures that the sliders will be in ren1.\n    render_window.AddRenderer(ren2)\n    render_window.AddRenderer(ren1)\n    ren1.SetViewport(0.0, 0.0, 0.2, 1.0)\n    ren2.SetViewport(0.2, 0.0, 1, 1)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n    style = vtkInteractorStyleTrackballCamera()\n    interactor.SetInteractorStyle(style)\n\n    # Set up tone mapping, so we can vary the exposure.\n    # Custom Passes.\n    camera_p = vtkCameraPass()\n    seq = vtkSequencePass()\n    opaque = vtkOpaquePass()\n    lights = vtkLightsPass()\n    overlay = vtkOverlayPass()\n\n    passes = vtkRenderPassCollection()\n    passes.AddItem(lights)\n    passes.AddItem(opaque)\n    passes.AddItem(overlay)\n    seq.SetPasses(passes)\n    camera_p.SetDelegatePass(seq)\n\n    tone_mapping_p = vtkToneMappingPass()\n    tone_mapping_p.SetDelegatePass(camera_p)\n\n    if use_tonemapping:\n        ren2.SetPass(tone_mapping_p)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren2.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    # Turn off the default lighting and use image based lighting.\n    ren2.AutomaticLightCreationOff()\n    ren2.UseImageBasedLightingOn()\n    if is_hdr:\n        ren2.UseSphericalHarmonicsOn()\n        ren2.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren2.UseSphericalHarmonicsOff()\n        ren2.SetEnvironmentTexture(env_texture, True)\n\n    # Get the surface.\n    surface = parameters['object'].lower()\n    available_surfaces = {'boy', 'mobius', 'randomhills', 'torus', 'sphere', 'clippedsphere', 'cube', 'clippedcube'}\n    if surface not in available_surfaces:\n        print(f'The requested surface: {parameters[\"object\"]} not found, reverting to Boys Surface.')\n        surface = 'boy'\n    if surface == 'mobius':\n        source = get_mobius()\n    elif surface == 'randomhills':\n        source = get_random_hills()\n    elif surface == 'torus':\n        source = get_torus()\n    elif surface == 'sphere':\n        source = get_sphere()\n    elif surface == 'clippedsphere':\n        source = get_clipped_sphere()\n    elif surface == 'cube':\n        source = get_cube()\n    elif surface == 'clippedcube':\n        source = get_clipped_cube()\n    else:\n        source = get_boy()\n\n    # Let's use a metallic surface\n    diffuse_coefficient = 1.0\n    roughness_coefficient = 0.0\n    metallic_coefficient = 1.0\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(source)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    # Enable PBR on the model.\n    actor.GetProperty().SetInterpolationToPBR()\n    # Configure the basic properties.\n    actor.GetProperty().SetColor(colors.GetColor3d(parameters['objcolor']))\n    actor.GetProperty().SetDiffuse(diffuse_coefficient)\n    actor.GetProperty().SetRoughness(roughness_coefficient)\n    actor.GetProperty().SetMetallic(metallic_coefficient)\n    ren2.AddActor(actor)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren2.AddActor(skybox)\n\n    # Create the slider callbacks to manipulate various parameters.\n    step_size = 1.0 / 3\n    pos_y = 0.1\n    pos_x0 = 0.02\n    pos_x1 = 0.18\n\n    sw_p = SliderProperties()\n\n    sw_p.initial_value = 1.0\n    sw_p.maximum_value = 5.0\n    sw_p.title = 'Exposure'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_exposure = make_slider_widget(sw_p)\n    sw_exposure.SetInteractor(interactor)\n    sw_exposure.SetAnimationModeToAnimate()\n    if use_tonemapping:\n        sw_exposure.EnabledOn()\n    else:\n        sw_exposure.EnabledOff()\n    sw_exposure.SetCurrentRenderer(ren1)\n    sw_exposure_cb = SliderCallbackExposure(tone_mapping_p)\n    sw_exposure.AddObserver(vtkCommand.InteractionEvent, sw_exposure_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = metallic_coefficient\n    sw_p.maximum_value = 1.0\n    sw_p.title = 'Metallicity'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_metallic = make_slider_widget(sw_p)\n    sw_metallic.SetInteractor(interactor)\n    sw_metallic.SetAnimationModeToAnimate()\n    sw_metallic.EnabledOn()\n    sw_metallic.SetCurrentRenderer(ren1)\n    sw_metallic_cb = SliderCallbackMetallic(actor.GetProperty())\n    sw_metallic.AddObserver(vtkCommand.InteractionEvent, sw_metallic_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = roughness_coefficient\n    sw_p.title = 'Roughness'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_roughnesss = make_slider_widget(sw_p)\n    sw_roughnesss.SetInteractor(interactor)\n    sw_roughnesss.SetAnimationModeToAnimate()\n    sw_roughnesss.EnabledOn()\n    sw_roughnesss.SetCurrentRenderer(ren1)\n    sw_roughnesss_cb = SliderCallbackRoughness(actor.GetProperty())\n    sw_roughnesss.AddObserver(vtkCommand.InteractionEvent, sw_roughnesss_cb)\n\n    name = Path(sys.argv[0]).stem\n    render_window.SetSize(1000, 625)\n    render_window.Render()\n    render_window.SetWindowName(name)\n\n    if vtk_version_ok(9, 0, 20210718):\n        try:\n            cam_orient_manipulator = vtkCameraOrientationWidget()\n            cam_orient_manipulator.SetParentRenderer(ren2)\n            # Enable the widget.\n            cam_orient_manipulator.On()\n        except AttributeError:\n            pass\n    else:\n        axes = vtkAxesActor()\n        widget = vtkOrientationMarkerWidget()\n        rgba = [0.0, 0.0, 0.0, 0.0]\n        colors.GetColor(\"Carrot\", rgba)\n        widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n        widget.SetOrientationMarker(axes)\n        widget.SetInteractor(interactor)\n        widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n        widget.EnabledOn()\n        widget.InteractiveOn()\n\n    print_callback = PrintCallback(interactor, name, 1, False)\n    # print_callback = PrintCallback(interactor, name + '.jpg', 1, False)\n    interactor.AddObserver('KeyPressEvent', print_callback)\n\n    interactor.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\ndef get_boy():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricBoy()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_mobius():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricMobius()\n    surface.SetMinimumV(-0.25)\n    surface.SetMaximumV(0.25)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_random_hills():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricRandomHills()\n    surface.SetRandomSeed(1)\n    surface.SetNumberOfHills(30)\n    # If you want a plane\n    # surface.SetHillAmplitude(0)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_torus():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricTorus()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(surface.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, 0)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(surface.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(clipper.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(3)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(subdivide.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(5)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, -1)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(subdivide.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(clipper.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(cleaner.GetOutputPort())\n    normals.FlipNormalsOn()\n    normals.SetFeatureAngle(60)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(normals.GetOutputPort())\n    tangents.ComputeCellTangentsOn()\n    tangents.ComputePointTangentsOn()\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef uv_tcoords(u_resolution, v_resolution, pd):\n    \"\"\"\n    Generate u, v texture coordinates on a parametric surface.\n    :param u_resolution: u resolution\n    :param v_resolution: v resolution\n    :param pd: The polydata representing the surface.\n    :return: The polydata with the texture coordinates added.\n    \"\"\"\n    u0 = 1.0\n    v0 = 0.0\n    du = 1.0 / (u_resolution - 1)\n    dv = 1.0 / (v_resolution - 1)\n    num_pts = pd.GetNumberOfPoints()\n    t_coords = vtkFloatArray()\n    t_coords.SetNumberOfComponents(2)\n    t_coords.SetNumberOfTuples(num_pts)\n    t_coords.SetName('Texture Coordinates')\n    pt_id = 0\n    u = u0\n    for i in range(0, u_resolution):\n        v = v0\n        for j in range(0, v_resolution):\n            tc = [u, v]\n            t_coords.SetTuple(pt_id, tc)\n            v += dv\n            pt_id += 1\n        u -= du\n    pd.GetPointData().SetTCoords(t_coords)\n    return pd\n\n\nclass SliderProperties:\n    tube_width = 0.008\n    slider_length = 0.075\n    slider_width = 0.025\n    end_cap_length = 0.025\n    end_cap_width = 0.025\n    title_height = 0.025\n    label_height = 0.020\n\n    minimum_value = 0.0\n    maximum_value = 1.0\n    initial_value = 0.0\n\n    p1 = [0.02, 0.1]\n    p2 = [0.18, 0.1]\n\n    title = None\n\n    title_color = 'Black'\n    label_color = 'Black'\n    value_color = 'DarkSlateGray'\n    slider_color = 'BurlyWood'\n    selected_color = 'Lime'\n    bar_color = 'Black'\n    bar_ends_color = 'Indigo'\n\n\ndef make_slider_widget(properties):\n    colors = vtkNamedColors()\n\n    slider = vtkSliderRepresentation2D()\n\n    slider.SetMinimumValue(properties.minimum_value)\n    slider.SetMaximumValue(properties.maximum_value)\n    slider.SetValue(properties.initial_value)\n    slider.SetTitleText(properties.title)\n\n    slider.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint1Coordinate().SetValue(properties.p1[0], properties.p1[1])\n    slider.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint2Coordinate().SetValue(properties.p2[0], properties.p2[1])\n\n    slider.SetTubeWidth(properties.tube_width)\n    slider.SetSliderLength(properties.slider_length)\n    slider.SetSliderWidth(properties.slider_width)\n    slider.SetEndCapLength(properties.end_cap_length)\n    slider.SetEndCapWidth(properties.end_cap_width)\n    slider.SetTitleHeight(properties.title_height)\n    slider.SetLabelHeight(properties.label_height)\n\n    # Set the color properties\n    # Change the color of the title.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.title_color))\n    # Change the color of the label.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.label_color))\n    # Change the color of the bar.\n    slider.GetTubeProperty().SetColor(colors.GetColor3d(properties.bar_color))\n    # Change the color of the ends of the bar.\n    slider.GetCapProperty().SetColor(colors.GetColor3d(properties.bar_ends_color))\n    # Change the color of the knob that slides.\n    slider.GetSliderProperty().SetColor(colors.GetColor3d(properties.slider_color))\n    # Change the color of the knob when the mouse is held on it.\n    slider.GetSelectedProperty().SetColor(colors.GetColor3d(properties.selected_color))\n    # Change the color of the text displaying the value.\n    slider.GetLabelProperty().SetColor(colors.GetColor3d(properties.value_color))\n\n    slider_widget = vtkSliderWidget()\n    slider_widget.SetRepresentation(slider)\n\n    return slider_widget\n\n\nclass SliderCallbackExposure:\n    def __init__(self, tone_mapping_property):\n        self.tone_mapping_property = tone_mapping_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.tone_mapping_property.SetExposure(value)\n\n\nclass SliderCallbackMetallic:\n    def __init__(self, actor_property):\n        self.actor_property = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actor_property.SetMetallic(value)\n\n\nclass SliderCallbackRoughness:\n    def __init__(self, actor_property):\n        self.actor_property = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actor_property.SetRoughness(value)\n\n\nclass PrintCallback:\n    def __init__(self, caller, file_name, image_quality=1, rgba=True):\n        \"\"\"\n        Set the parameters for writing the\n         render window view to an image file.\n\n        :param caller: The caller for the callback.\n        :param file_name: The image file name.\n        :param image_quality: The image quality.\n        :param rgba: The buffer type, (if true, there is no background in the screenshot).\n        \"\"\"\n        self.caller = caller\n        self.image_quality = image_quality\n        self.rgba = rgba\n        if not file_name:\n            self.path = None\n            print(\"A file name is required.\")\n            return\n        pth = Path(file_name).absolute()\n        valid_suffixes = ['.jpeg', '.jpg', '.png']\n        if pth.suffix:\n            ext = pth.suffix.lower()\n        else:\n            ext = '.png'\n        if ext not in valid_suffixes:\n            ext = '.png'\n        self.suffix = ext\n        self.path = Path(str(pth)).with_suffix(ext)\n\n    def __call__(self, caller, ev):\n        if not self.path:\n            print(\"A file name is required.\")\n            return\n        # Save the screenshot.\n        if caller.GetKeyCode() == \"k\":\n            w2if = vtkWindowToImageFilter()\n            w2if.SetInput(caller.GetRenderWindow())\n            w2if.SetScale(self.image_quality, self.image_quality)\n            if self.rgba:\n                w2if.SetInputBufferTypeToRGBA()\n            else:\n                w2if.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            w2if.ReadFrontBufferOn()\n            w2if.Update()\n            if self.suffix in ['.jpeg', '.jpg']:\n                writer = vtkJPEGWriter()\n            else:\n                writer = vtkPNGWriter()\n            writer.SetFileName(self.path)\n            writer.SetInputData(w2if.GetOutput())\n            writer.Write()\n            print('Screenshot saved to:', self.path)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/PBR_Skybox_Anisotropy/","title":"PBR Skybox Anisotropy","text":"

        vtk-examples/Python/Rendering/PBR_Skybox_Anisotropy

        "},{"location":"Python/Rendering/PBR_Skybox_Anisotropy/#description","title":"Description","text":"

        Demonstrates physically based rendering (PBR) using image based lighting, anisotropic texturing and a skybox.

        Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

        <DATA>/PBR_Skybox_Anisotropy.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Python/Rendering/PBR_Skybox_Anisotropy/#options","title":"Options","text":"
        Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

        Additionally, you can save a screenshot by pressing \"k\".

        "},{"location":"Python/Rendering/PBR_Skybox_Anisotropy/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Skybox_Anisotropy.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/PBR_Skybox_Anisotropy/#code","title":"Code","text":"

        PBR_Skybox_Anisotropy.py

        #!/usr/bin/env python3\n\nimport json\nimport sys\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBoy,\n    vtkParametricMobius,\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkCommand,\n    vtkFloatArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkClipPolyData,\n    vtkPolyDataNormals,\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkLinearSubdivisionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkParametricFunctionSource,\n    vtkTexturedSphereSource\n)\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkJPEGWriter,\n    vtkImageReader2Factory,\n    vtkPNGWriter\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget,\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkCameraPass,\n    vtkLightsPass,\n    vtkOpaquePass,\n    vtkOverlayPass,\n    vtkRenderPassCollection,\n    vtkSequencePass,\n    vtkToneMappingPass\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrates physically based rendering, image based lighting, anisotropic texturing and a skybox.'\n    epilogue = '''\nPhysically based rendering sets color, metallicity and roughness of the object.\nImage based lighting uses a cubemap texture to specify the environment.\nTexturing is used to generate lighting effects.\nA Skybox is used to create the illusion of distant three-dimensional surroundings.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-s', '--surface', default='',\n                        help='The name of the surface. Overrides the surface entry in the json file.')\n    parser.add_argument('-c', '--use_cubemap', action='store_true',\n                        help='Build the cubemap from the six cubemap files.'\n                             ' Overrides the equirectangular entry in the json file.')\n    parser.add_argument('-t', '--use_tonemapping', action='store_true',\n                        help='Use tone mapping.')\n    args = parser.parse_args()\n    return args.file_name, args.surface, args.use_cubemap, args.use_tonemapping\n\n\ndef main():\n    if not vtk_version_ok(9, 0, 0):\n        print('You need VTK version 9.0 or greater to run this program.')\n        return\n\n    colors = vtkNamedColors()\n\n    # Default background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    # Default background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    fn, surface_name, use_cubemap, use_tonemapping = get_program_parameters()\n\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n\n    # Check for missing parameters.\n    if 'bkgcolor' not in parameters.keys():\n        parameters['bkgcolor'] = 'BkgColor'\n    if 'objcolor' not in parameters.keys():\n        parameters['objcolor'] = 'White'\n    if 'skybox' not in parameters.keys():\n        parameters['skybox'] = False\n    if surface_name:\n        parameters['object'] = surface_name\n\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    if not check_for_missing_textures(parameters, ['albedo', 'normal', 'material', 'anisotropy']):\n        return\n\n    # Build the pipeline.\n    # ren1 is for the slider rendering,\n    # ren2 is for the object rendering.\n    ren1 = vtkRenderer()\n    # ren2 = vtkOpenGLRenderer()\n    ren2 = vtkRenderer()\n    ren1.SetBackground(colors.GetColor3d('Snow'))\n    ren2.SetBackground(colors.GetColor3d(parameters['bkgcolor']))\n\n    render_window = vtkRenderWindow()\n    # The order here is important.\n    # This ensures that the sliders will be in ren1.\n    render_window.AddRenderer(ren2)\n    render_window.AddRenderer(ren1)\n    ren1.SetViewport(0.0, 0.0, 0.2, 1.0)\n    ren2.SetViewport(0.2, 0.0, 1, 1)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n    style = vtkInteractorStyleTrackballCamera()\n    interactor.SetInteractorStyle(style)\n\n    # Set up tone mapping, so we can vary the exposure.\n    # Custom Passes.\n    camera_p = vtkCameraPass()\n    seq = vtkSequencePass()\n    opaque = vtkOpaquePass()\n    lights = vtkLightsPass()\n    overlay = vtkOverlayPass()\n\n    passes = vtkRenderPassCollection()\n    passes.AddItem(lights)\n    passes.AddItem(opaque)\n    passes.AddItem(overlay)\n    seq.SetPasses(passes)\n    camera_p.SetDelegatePass(seq)\n\n    tone_mapping_p = vtkToneMappingPass()\n    tone_mapping_p.SetDelegatePass(camera_p)\n\n    if use_tonemapping:\n        ren2.SetPass(tone_mapping_p)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren2.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    # Turn off the default lighting and use image based lighting.\n    ren2.AutomaticLightCreationOff()\n    ren2.UseImageBasedLightingOn()\n    if is_hdr:\n        ren2.UseSphericalHarmonicsOn()\n        ren2.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren2.UseSphericalHarmonicsOff()\n        ren2.SetEnvironmentTexture(env_texture, True)\n\n    # Get the textures\n    base_color = read_texture(parameters['albedo'])\n    base_color.SetColorModeToDirectScalars()\n    base_color.UseSRGBColorSpaceOn()\n    normal = read_texture(parameters['normal'])\n    normal.SetColorModeToDirectScalars()\n    material = read_texture(parameters['material'])\n    material.SetColorModeToDirectScalars()\n    anisotropy = read_texture(parameters['anisotropy'])\n    anisotropy.SetColorModeToDirectScalars()\n\n    # Get the surface.\n    surface = parameters['object'].lower()\n    available_surfaces = {'boy', 'mobius', 'randomhills', 'torus', 'sphere', 'clippedsphere', 'cube', 'clippedcube'}\n    if surface not in available_surfaces:\n        print(f'The requested surface: {parameters[\"object\"]} not found, reverting to Boys Surface.')\n        surface = 'boy'\n    if surface == 'mobius':\n        source = get_mobius()\n    elif surface == 'randomhills':\n        source = get_random_hills()\n    elif surface == 'torus':\n        source = get_torus()\n    elif surface == 'sphere':\n        source = get_sphere()\n    elif surface == 'clippedsphere':\n        source = get_clipped_sphere()\n    elif surface == 'cube':\n        source = get_cube()\n    elif surface == 'clippedcube':\n        source = get_clipped_cube()\n    else:\n        source = get_boy()\n\n    # Let's use a nonmetallic surface\n    diffuse_coefficient = 1.0\n    roughness_coefficient = 0.3\n    metallic_coefficient = 0.0\n    # Other parameters.\n    occlusion_strength = 1.0\n    normal_scale = 1.0\n    anisotropy_coefficient = 1.0\n    anisotropy_rotation = 0.0\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(source)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    # Enable PBR on the model.\n    actor.GetProperty().SetInterpolationToPBR()\n    # Configure the basic properties.\n    # Set the model colour.\n    actor.GetProperty().SetColor(colors.GetColor3d('White'))\n    actor.GetProperty().SetDiffuse(diffuse_coefficient)\n    actor.GetProperty().SetRoughness(roughness_coefficient)\n    actor.GetProperty().SetMetallic(metallic_coefficient)\n    # Configure textures (needs tcoords on the mesh).\n    actor.GetProperty().SetBaseColorTexture(base_color)\n    actor.GetProperty().SetORMTexture(material)\n    actor.GetProperty().SetOcclusionStrength(occlusion_strength)\n    # Needs tcoords, normals and tangents on the mesh.\n    actor.GetProperty().SetNormalTexture(normal)\n    actor.GetProperty().SetNormalScale(normal_scale)\n    actor.GetProperty().SetAnisotropyTexture(anisotropy)\n    actor.GetProperty().SetAnisotropy(anisotropy_coefficient)\n    actor.GetProperty().SetAnisotropyRotation(anisotropy_rotation)\n    ren2.AddActor(actor)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren2.AddActor(skybox)\n\n    # Create the slider callbacks to manipulate various parameters.\n    step_size = 1.0 / 7\n    pos_y = 0.1\n    pos_x0 = 0.02\n    pos_x1 = 0.18\n\n    sw_p = SliderProperties()\n\n    sw_p.initial_value = 1.0\n    sw_p.maximum_value = 5.0\n    sw_p.title = 'Exposure'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_exposure = make_slider_widget(sw_p)\n    sw_exposure.SetInteractor(interactor)\n    sw_exposure.SetAnimationModeToAnimate()\n    if use_tonemapping:\n        sw_exposure.EnabledOn()\n    else:\n        sw_exposure.EnabledOff()\n    sw_exposure.SetCurrentRenderer(ren1)\n    sw_exposure_cb = SliderCallbackExposure(tone_mapping_p)\n    sw_exposure.AddObserver(vtkCommand.InteractionEvent, sw_exposure_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = metallic_coefficient\n    sw_p.maximum_value = 1.0\n    sw_p.title = 'Metallicity'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_metallic = make_slider_widget(sw_p)\n    sw_metallic.SetInteractor(interactor)\n    sw_metallic.SetAnimationModeToAnimate()\n    sw_metallic.EnabledOn()\n    sw_metallic.SetCurrentRenderer(ren1)\n    sw_metallic_cb = SliderCallbackMetallic(actor.GetProperty())\n    sw_metallic.AddObserver(vtkCommand.InteractionEvent, sw_metallic_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = roughness_coefficient\n    sw_p.title = 'Roughness'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_roughnesss = make_slider_widget(sw_p)\n    sw_roughnesss.SetInteractor(interactor)\n    sw_roughnesss.SetAnimationModeToAnimate()\n    sw_roughnesss.EnabledOn()\n    sw_roughnesss.SetCurrentRenderer(ren1)\n    sw_roughnesss_cb = SliderCallbackRoughness(actor.GetProperty())\n    sw_roughnesss.AddObserver(vtkCommand.InteractionEvent, sw_roughnesss_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = occlusion_strength\n    sw_p.maximum_value = 5\n    sw_p.title = 'Occlusion'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_occlusion_strength = make_slider_widget(sw_p)\n    sw_occlusion_strength.SetInteractor(interactor)\n    sw_occlusion_strength.SetAnimationModeToAnimate()\n    sw_occlusion_strength.EnabledOn()\n    sw_occlusion_strength.SetCurrentRenderer(ren1)\n    sw_occlusion_strength_cb = SliderCallbackOcclusionStrength(actor.GetProperty())\n    sw_occlusion_strength.AddObserver(vtkCommand.InteractionEvent, sw_occlusion_strength_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = normal_scale\n    sw_p.maximum_value = 5\n    sw_p.title = 'Normal'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_normal = make_slider_widget(sw_p)\n    sw_normal.SetInteractor(interactor)\n    sw_normal.SetAnimationModeToAnimate()\n    sw_normal.EnabledOn()\n    sw_normal.SetCurrentRenderer(ren1)\n    sw_normal_cb = SliderCallbackNormalScale(actor.GetProperty())\n    sw_normal.AddObserver(vtkCommand.InteractionEvent, sw_normal_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = anisotropy_coefficient\n    sw_p.maximum_value = 1\n    sw_p.title = 'Anisotropy'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_anisotropy = make_slider_widget(sw_p)\n    sw_anisotropy.SetInteractor(interactor)\n    sw_anisotropy.SetAnimationModeToAnimate()\n    sw_anisotropy.EnabledOn()\n    sw_anisotropy.SetCurrentRenderer(ren1)\n    sw_anisotropy_cb = SliderCallbackAnisotropy(actor.GetProperty())\n    sw_anisotropy.AddObserver(vtkCommand.InteractionEvent, sw_anisotropy_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = anisotropy_rotation\n    sw_p.maximum_value = 1\n    sw_p.title = 'Anisotropy Rotation'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_anisotropy_rotation = make_slider_widget(sw_p)\n    sw_anisotropy_rotation.SetInteractor(interactor)\n    sw_anisotropy_rotation.SetAnimationModeToAnimate()\n    sw_anisotropy_rotation.EnabledOn()\n    sw_anisotropy_rotation.SetCurrentRenderer(ren1)\n    sw_anisotropy_rotation_cb = SliderCallbackAnisotropyRotation(actor.GetProperty())\n    sw_anisotropy_rotation.AddObserver(vtkCommand.InteractionEvent, sw_anisotropy_rotation_cb)\n\n    name = Path(sys.argv[0]).stem\n    render_window.SetSize(1000, 625)\n    render_window.Render()\n    render_window.SetWindowName(name)\n\n    if vtk_version_ok(9, 0, 20210718):\n        try:\n            cam_orient_manipulator = vtkCameraOrientationWidget()\n            cam_orient_manipulator.SetParentRenderer(ren2)\n            # Enable the widget.\n            cam_orient_manipulator.On()\n        except AttributeError:\n            pass\n    else:\n        axes = vtkAxesActor()\n        widget = vtkOrientationMarkerWidget()\n        rgba = [0.0, 0.0, 0.0, 0.0]\n        colors.GetColor(\"Carrot\", rgba)\n        widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n        widget.SetOrientationMarker(axes)\n        widget.SetInteractor(interactor)\n        widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n        widget.EnabledOn()\n        widget.InteractiveOn()\n\n    print_callback = PrintCallback(interactor, name, 1, False)\n    # print_callback = PrintCallback(interactor, name + '.jpg', 1, False)\n    interactor.AddObserver('KeyPressEvent', print_callback)\n\n    interactor.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\ndef read_texture(image_path):\n    \"\"\"\n    Read an image and convert it to a texture\n    :param image_path: The image path.\n    :return: The texture.\n    \"\"\"\n\n    suffix = image_path.suffix.lower()\n    valid_extensions = ['.jpg', '.png', '.bmp', '.tiff', '.pnm', '.pgm', '.ppm']\n    if suffix not in valid_extensions:\n        print('Unable to read the texture file (wrong extension):', image_path)\n        return None\n\n    # Read the images\n    reader_factory = vtkImageReader2Factory()\n    img_reader = reader_factory.CreateImageReader2(str(image_path))\n    img_reader.SetFileName(str(image_path))\n\n    texture = vtkTexture()\n    texture.InterpolateOn()\n    texture.SetInputConnection(img_reader.GetOutputPort())\n    texture.Update()\n\n    return texture\n\n\ndef check_for_missing_textures(parameters, wanted_textures):\n    \"\"\"\n    Check that the needed textures exist.\n\n    :param parameters: The parameters.\n    :param wanted_textures: The wanted textures.\n    :return: True if all the wanted textures are present.\n    \"\"\"\n    have_textures = True\n    for texture_name in wanted_textures:\n        if texture_name not in parameters:\n            print('Missing texture:', texture_name)\n            have_textures = False\n        elif not parameters[texture_name]:\n            print('No texture path for:', texture_name)\n            have_textures = False\n\n    return have_textures\n\n\ndef get_boy():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricBoy()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_mobius():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricMobius()\n    surface.SetMinimumV(-0.25)\n    surface.SetMaximumV(0.25)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_random_hills():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricRandomHills()\n    surface.SetRandomSeed(1)\n    surface.SetNumberOfHills(30)\n    # If you want a plane\n    # surface.SetHillAmplitude(0)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_torus():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricTorus()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(surface.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, 0)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(surface.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(clipper.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(3)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(subdivide.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(5)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, -1)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(subdivide.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(clipper.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(cleaner.GetOutputPort())\n    normals.FlipNormalsOn()\n    normals.SetFeatureAngle(60)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(normals.GetOutputPort())\n    tangents.ComputeCellTangentsOn()\n    tangents.ComputePointTangentsOn()\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef uv_tcoords(u_resolution, v_resolution, pd):\n    \"\"\"\n    Generate u, v texture coordinates on a parametric surface.\n    :param u_resolution: u resolution\n    :param v_resolution: v resolution\n    :param pd: The polydata representing the surface.\n    :return: The polydata with the texture coordinates added.\n    \"\"\"\n    u0 = 1.0\n    v0 = 0.0\n    du = 1.0 / (u_resolution - 1)\n    dv = 1.0 / (v_resolution - 1)\n    num_pts = pd.GetNumberOfPoints()\n    t_coords = vtkFloatArray()\n    t_coords.SetNumberOfComponents(2)\n    t_coords.SetNumberOfTuples(num_pts)\n    t_coords.SetName('Texture Coordinates')\n    pt_id = 0\n    u = u0\n    for i in range(0, u_resolution):\n        v = v0\n        for j in range(0, v_resolution):\n            tc = [u, v]\n            t_coords.SetTuple(pt_id, tc)\n            v += dv\n            pt_id += 1\n        u -= du\n    pd.GetPointData().SetTCoords(t_coords)\n    return pd\n\n\nclass SliderProperties:\n    tube_width = 0.008\n    slider_length = 0.075\n    slider_width = 0.025\n    end_cap_length = 0.025\n    end_cap_width = 0.025\n    title_height = 0.025\n    label_height = 0.020\n\n    minimum_value = 0.0\n    maximum_value = 1.0\n    initial_value = 0.0\n\n    p1 = [0.02, 0.1]\n    p2 = [0.18, 0.1]\n\n    title = None\n\n    title_color = 'Black'\n    label_color = 'Black'\n    value_color = 'DarkSlateGray'\n    slider_color = 'BurlyWood'\n    selected_color = 'Lime'\n    bar_color = 'Black'\n    bar_ends_color = 'Indigo'\n\n\ndef make_slider_widget(properties):\n    colors = vtkNamedColors()\n\n    slider = vtkSliderRepresentation2D()\n\n    slider.SetMinimumValue(properties.minimum_value)\n    slider.SetMaximumValue(properties.maximum_value)\n    slider.SetValue(properties.initial_value)\n    slider.SetTitleText(properties.title)\n\n    slider.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint1Coordinate().SetValue(properties.p1[0], properties.p1[1])\n    slider.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint2Coordinate().SetValue(properties.p2[0], properties.p2[1])\n\n    slider.SetTubeWidth(properties.tube_width)\n    slider.SetSliderLength(properties.slider_length)\n    slider.SetSliderWidth(properties.slider_width)\n    slider.SetEndCapLength(properties.end_cap_length)\n    slider.SetEndCapWidth(properties.end_cap_width)\n    slider.SetTitleHeight(properties.title_height)\n    slider.SetLabelHeight(properties.label_height)\n\n    # Set the color properties\n    # Change the color of the title.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.title_color))\n    # Change the color of the label.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.label_color))\n    # Change the color of the bar.\n    slider.GetTubeProperty().SetColor(colors.GetColor3d(properties.bar_color))\n    # Change the color of the ends of the bar.\n    slider.GetCapProperty().SetColor(colors.GetColor3d(properties.bar_ends_color))\n    # Change the color of the knob that slides.\n    slider.GetSliderProperty().SetColor(colors.GetColor3d(properties.slider_color))\n    # Change the color of the knob when the mouse is held on it.\n    slider.GetSelectedProperty().SetColor(colors.GetColor3d(properties.selected_color))\n    # Change the color of the text displaying the value.\n    slider.GetLabelProperty().SetColor(colors.GetColor3d(properties.value_color))\n\n    slider_widget = vtkSliderWidget()\n    slider_widget.SetRepresentation(slider)\n\n    return slider_widget\n\n\nclass SliderCallbackExposure:\n    def __init__(self, tone_mapping_property):\n        self.tone_mapping_property = tone_mapping_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.tone_mapping_property.SetExposure(value)\n\n\nclass SliderCallbackMetallic:\n    def __init__(self, actor_property):\n        self.actor_property = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actor_property.SetMetallic(value)\n\n\nclass SliderCallbackRoughness:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetRoughness(value)\n\n\nclass SliderCallbackOcclusionStrength:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetOcclusionStrength(value)\n\n\nclass SliderCallbackNormalScale:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetNormalScale(value)\n\n\nclass SliderCallbackAnisotropy:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetAnisotropy(value)\n\n\nclass SliderCallbackAnisotropyRotation:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetAnisotropyRotation(value)\n\n\nclass PrintCallback:\n    def __init__(self, caller, file_name, image_quality=1, rgba=True):\n        \"\"\"\n        Set the parameters for writing the\n         render window view to an image file.\n\n        :param caller: The caller for the callback.\n        :param file_name: The image file name.\n        :param image_quality: The image quality.\n        :param rgba: The buffer type, (if true, there is no background in the screenshot).\n        \"\"\"\n        self.caller = caller\n        self.image_quality = image_quality\n        self.rgba = rgba\n        if not file_name:\n            self.path = None\n            print(\"A file name is required.\")\n            return\n        pth = Path(file_name).absolute()\n        valid_suffixes = ['.jpeg', '.jpg', '.png']\n        if pth.suffix:\n            ext = pth.suffix.lower()\n        else:\n            ext = '.png'\n        if ext not in valid_suffixes:\n            ext = '.png'\n        self.suffix = ext\n        self.path = Path(str(pth)).with_suffix(ext)\n\n    def __call__(self, caller, ev):\n        if not self.path:\n            print(\"A file name is required.\")\n            return\n        # Save the screenshot.\n        if caller.GetKeyCode() == \"k\":\n            w2if = vtkWindowToImageFilter()\n            w2if.SetInput(caller.GetRenderWindow())\n            w2if.SetScale(self.image_quality, self.image_quality)\n            if self.rgba:\n                w2if.SetInputBufferTypeToRGBA()\n            else:\n                w2if.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            w2if.ReadFrontBufferOn()\n            w2if.Update()\n            if self.suffix in ['.jpeg', '.jpg']:\n                writer = vtkJPEGWriter()\n            else:\n                writer = vtkPNGWriter()\n            writer.SetFileName(self.path)\n            writer.SetInputData(w2if.GetOutput())\n            writer.Write()\n            print('Screenshot saved to:', self.path)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/PBR_Skybox_Texturing/","title":"PBR Skybox Texturing","text":"

        vtk-examples/Python/Rendering/PBR_Skybox_Texturing

        "},{"location":"Python/Rendering/PBR_Skybox_Texturing/#description","title":"Description","text":"

        Demonstrates physically based rendering (PBR) using image based lighting, texturing and a skybox.

        Physically based rendering sets metallicity, roughness, occlusion strength, the emissive factor and normal scaling of the object. Textures are used to set base color, ORM, emissivity and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.

        Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings. Textures for the image based lighting and the skybox are supplied from an HDR or JPEG equirectangular Environment map or cubemap consisting of six image files.

        A good source for Skybox HDRs and Textures is Poly Haven. Start with the 4K HDR versions of Skyboxes.

        The parameters used to generate the example image are loaded from a JSON file with the same name as the example. In this case:

        <DATA>/PBR_Skybox_Texturing.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        By default we use the equirectangular file to generate the texture for the lighting and skybox. We have optionally provided six individual cubemap files to generate lighting and a skybox.

        For information about the parameters in the JSON file, please see PBR_JSON_format.

        "},{"location":"Python/Rendering/PBR_Skybox_Texturing/#options","title":"Options","text":"
        Positionals:\n fileName              The path to the JSON file containing the parameters.\n\nOptions:\n -h,--help             Print this help message and exit\n -s,--surface          The name of the surface. Overrides the surface entry in the json file.\n -c,--use_cubemap      Build the cubemap from the six cubemap files. Overrides the equirectangular entry in the json file.\n -t, --use_tonemapping Use tone mapping.\n

        Additionally, you can save a screenshot by pressing \"k\".

        "},{"location":"Python/Rendering/PBR_Skybox_Texturing/#further-reading","title":"Further Reading","text":"
        • Introducing Physically Based Rendering with VTK
        • PBR Journey Part 1: High Dynamic Range Image Based Lighting with VTK
        • PBR Journey Part 2 : Anisotropy model with VTK
        • PBR Journey Part 3 : Clear Coat Model with VTK
        • Object Shading Properties

        Note

        • <DATA>/PBR_Skybox_Texturing.json assumes that the skyboxes and textures are in the subfolders Skyboxes and Textures relative to this file. This allows you to copy this JSON file and the associated subfolders to any other location on your computer.
        • You can turn off the skybox in the JSON file by setting \"skybox\":false. Image based lighting will still be active.

        Note

        • The C++ example requires C++17 as std::filesystem is used. If your compiler does not support C++17 comment out the filesystem stuff.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/PBR_Skybox_Texturing/#code","title":"Code","text":"

        PBR_Skybox_Texturing.py

        #!/usr/bin/env python3\n\nimport json\nimport sys\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBoy,\n    vtkParametricMobius,\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkCommand,\n    vtkFloatArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkClipPolyData,\n    vtkPolyDataNormals,\n    vtkPolyDataTangents,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkLinearSubdivisionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkParametricFunctionSource,\n    vtkTexturedSphereSource\n)\nfrom vtkmodules.vtkIOImage import (\n    vtkHDRReader,\n    vtkJPEGWriter,\n    vtkImageReader2Factory,\n    vtkPNGWriter\n)\nfrom vtkmodules.vtkImagingCore import vtkImageFlip\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget,\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkSkybox,\n    vtkTexture,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkCameraPass,\n    vtkLightsPass,\n    vtkOpaquePass,\n    vtkOverlayPass,\n    vtkRenderPassCollection,\n    vtkSequencePass,\n    vtkToneMappingPass\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrates physically based rendering, image based lighting, texturing and a skybox.'\n    epilogue = '''\nPhysically based rendering sets color, metallicity and roughness of the object.\nImage based lighting uses a cubemap texture to specify the environment.\nTexturing is used to generate lighting effects.\nA Skybox is used to create the illusion of distant three-dimensional surroundings.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='The path to the JSON file.')\n    parser.add_argument('-s', '--surface', default='',\n                        help='The name of the surface. Overrides the surface entry in the json file.')\n    parser.add_argument('-c', '--use_cubemap', action='store_true',\n                        help='Build the cubemap from the six cubemap files.'\n                             ' Overrides the equirectangular entry in the json file.')\n    parser.add_argument('-t', '--use_tonemapping', action='store_true',\n                        help='Use tone mapping.')\n    args = parser.parse_args()\n    return args.file_name, args.surface, args.use_cubemap, args.use_tonemapping\n\n\ndef main():\n    if not vtk_version_ok(9, 0, 0):\n        print('You need VTK version 9.0 or greater to run this program.')\n        return\n\n    colors = vtkNamedColors()\n\n    # Default background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n    colors.SetColor('VTKBlue', [6, 79, 141, 255])\n    # Let's make a complementary colour to VTKBlue.\n    colors.SetColor('VTKBlueComp', [249, 176, 114, 255])\n\n    fn, surface_name, use_cubemap, use_tonemapping = get_program_parameters()\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    paths_ok, parameters = get_parameters(fn_path)\n    if not paths_ok:\n        return\n\n    # Check for missing parameters.\n    if 'bkgcolor' not in parameters.keys():\n        parameters['bkgcolor'] = 'BkgColor'\n    if 'objcolor' not in parameters.keys():\n        parameters['objcolor'] = 'White'\n    if 'skybox' not in parameters.keys():\n        parameters['skybox'] = False\n    if surface_name:\n        parameters['object'] = surface_name\n\n    res = display_parameters(parameters)\n    print('\\n'.join(res))\n    print()\n\n    if not check_for_missing_textures(parameters, ['albedo', 'normal', 'material', 'emissive']):\n        return\n\n    # Build the pipeline.\n    # ren1 is for the slider rendering,\n    # ren2 is for the object rendering.\n    ren1 = vtkRenderer()\n    # ren2 = vtkOpenGLRenderer()\n    ren2 = vtkRenderer()\n    ren1.SetBackground(colors.GetColor3d('Snow'))\n    ren2.SetBackground(colors.GetColor3d(parameters['bkgcolor']))\n\n    render_window = vtkRenderWindow()\n    # The order here is important.\n    # This ensures that the sliders will be in ren1.\n    render_window.AddRenderer(ren2)\n    render_window.AddRenderer(ren1)\n    ren1.SetViewport(0.0, 0.0, 0.2, 1.0)\n    ren2.SetViewport(0.2, 0.0, 1, 1)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n    style = vtkInteractorStyleTrackballCamera()\n    interactor.SetInteractorStyle(style)\n\n    # Set up tone mapping, so we can vary the exposure.\n    # Custom Passes.\n    camera_p = vtkCameraPass()\n    seq = vtkSequencePass()\n    opaque = vtkOpaquePass()\n    lights = vtkLightsPass()\n    overlay = vtkOverlayPass()\n\n    passes = vtkRenderPassCollection()\n    passes.AddItem(lights)\n    passes.AddItem(opaque)\n    passes.AddItem(overlay)\n    seq.SetPasses(passes)\n    camera_p.SetDelegatePass(seq)\n\n    tone_mapping_p = vtkToneMappingPass()\n    tone_mapping_p.SetDelegatePass(camera_p)\n\n    if use_tonemapping:\n        ren2.SetPass(tone_mapping_p)\n\n    skybox = vtkSkybox()\n\n    irradiance = ren2.GetEnvMapIrradiance()\n    irradiance.SetIrradianceStep(0.3)\n\n    # Choose how to generate the skybox.\n    is_hdr = False\n    has_skybox = False\n    gamma_correct = False\n\n    if use_cubemap and 'cubemap' in parameters.keys():\n        print('Using the cubemap files to generate the environment texture.')\n        env_texture = read_cubemap(parameters['cubemap'])\n        if parameters['skybox']:\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    elif 'equirectangular' in parameters.keys():\n        print('Using the equirectangular file to generate the environment texture.')\n        env_texture = read_equirectangular_file(parameters['equirectangular'])\n        if parameters['equirectangular'].suffix.lower() in '.hdr .pic':\n            gamma_correct = True\n            is_hdr = True\n        if parameters['skybox']:\n            # Generate a skybox.\n            skybox.SetFloorRight(0, 0, 1)\n            skybox.SetProjection(vtkSkybox.Sphere)\n            skybox.SetTexture(env_texture)\n            has_skybox = True\n    else:\n        print('An environment texture is required,\\n'\n              'please add the necessary equirectangular'\n              ' or cubemap file paths to the json file.')\n        return\n\n    # Turn off the default lighting and use image based lighting.\n    ren2.AutomaticLightCreationOff()\n    ren2.UseImageBasedLightingOn()\n    if is_hdr:\n        ren2.UseSphericalHarmonicsOn()\n        ren2.SetEnvironmentTexture(env_texture, False)\n    else:\n        ren2.UseSphericalHarmonicsOff()\n        ren2.SetEnvironmentTexture(env_texture, True)\n\n    # Get the textures\n    base_color = read_texture(parameters['albedo'])\n    base_color.UseSRGBColorSpaceOn()\n    normal = read_texture(parameters['normal'])\n    material = read_texture(parameters['material'])\n    emissive = read_texture(parameters['emissive'])\n    emissive.UseSRGBColorSpaceOn()\n\n    # Get the surface\n    surface = parameters['object'].lower()\n    available_surfaces = {'boy', 'mobius', 'randomhills', 'torus', 'sphere', 'clippedsphere', 'cube', 'clippedcube'}\n    if surface not in available_surfaces:\n        print(f'The requested surface: {parameters[\"object\"]} not found, reverting to Boys Surface.')\n        surface = 'boy'\n    if surface == 'mobius':\n        source = get_mobius()\n    elif surface == 'randomhills':\n        source = get_random_hills()\n    elif surface == 'torus':\n        source = get_torus()\n    elif surface == 'sphere':\n        source = get_sphere()\n    elif surface == 'clippedsphere':\n        source = get_clipped_sphere()\n    elif surface == 'cube':\n        source = get_cube()\n    elif surface == 'clippedcube':\n        source = get_clipped_cube()\n    else:\n        source = get_boy()\n\n    # Let's use a nonmetallic surface.\n    diffuse_coefficient = 1.0\n    roughness_coefficient = 0.3\n    metallic_coefficient = 0.0\n    # Other parameters.\n    occlusion_strength = 1.0\n    normal_scale = 1.0\n    # emissive_col = colors.GetColor3d('VTKBlueComp')\n    # emissive_factor = emissive_col\n    # Make VTK silvery in appearance.\n    emissive_factor = [1.0, 1.0, 1.0]\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(source)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    # Enable PBR on the model.\n    actor.GetProperty().SetInterpolationToPBR()\n    # Configure the basic properties.\n    actor.GetProperty().SetColor(colors.GetColor3d(parameters['objcolor']))\n    actor.GetProperty().SetDiffuse(diffuse_coefficient)\n    actor.GetProperty().SetRoughness(roughness_coefficient)\n    actor.GetProperty().SetMetallic(metallic_coefficient)\n    # Configure textures (needs tcoords on the mesh).\n    actor.GetProperty().SetBaseColorTexture(base_color)\n    actor.GetProperty().SetORMTexture(material)\n    actor.GetProperty().SetOcclusionStrength(occlusion_strength)\n    actor.GetProperty().SetEmissiveTexture(emissive)\n    actor.GetProperty().SetEmissiveFactor(emissive_factor)\n    # Needs tcoords, normals and tangents on the mesh.\n    actor.GetProperty().SetNormalTexture(normal)\n    actor.GetProperty().SetNormalScale(normal_scale)\n    ren2.AddActor(actor)\n\n    if has_skybox:\n        if gamma_correct:\n            skybox.GammaCorrectOn()\n        else:\n            skybox.GammaCorrectOff()\n        ren2.AddActor(skybox)\n\n    # Create the slider callbacks to manipulate various parameters.\n    step_size = 1.0 / 5\n    pos_y = 0.1\n    pos_x0 = 0.02\n    pos_x1 = 0.18\n\n    sw_p = SliderProperties()\n\n    sw_p.initial_value = 1.0\n    sw_p.maximum_value = 5.0\n    sw_p.title = 'Exposure'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_exposure = make_slider_widget(sw_p)\n    sw_exposure.SetInteractor(interactor)\n    sw_exposure.SetAnimationModeToAnimate()\n    if use_tonemapping:\n        sw_exposure.EnabledOn()\n    else:\n        sw_exposure.EnabledOff()\n    sw_exposure.SetCurrentRenderer(ren1)\n    sw_exposure_cb = SliderCallbackExposure(tone_mapping_p)\n    sw_exposure.AddObserver(vtkCommand.InteractionEvent, sw_exposure_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = metallic_coefficient\n    sw_p.maximum_value = 1.0\n    sw_p.title = 'Metallicity'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_metallic = make_slider_widget(sw_p)\n    sw_metallic.SetInteractor(interactor)\n    sw_metallic.SetAnimationModeToAnimate()\n    sw_metallic.EnabledOn()\n    sw_metallic.SetCurrentRenderer(ren1)\n    sw_metallic_cb = SliderCallbackMetallic(actor.GetProperty())\n    sw_metallic.AddObserver(vtkCommand.InteractionEvent, sw_metallic_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = roughness_coefficient\n    sw_p.title = 'Roughness'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_roughnesss = make_slider_widget(sw_p)\n    sw_roughnesss.SetInteractor(interactor)\n    sw_roughnesss.SetAnimationModeToAnimate()\n    sw_roughnesss.EnabledOn()\n    sw_roughnesss.SetCurrentRenderer(ren1)\n    sw_roughnesss_cb = SliderCallbackRoughness(actor.GetProperty())\n    sw_roughnesss.AddObserver(vtkCommand.InteractionEvent, sw_roughnesss_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = occlusion_strength\n    sw_p.maximum_value = 1\n    sw_p.title = 'Occlusion'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_occlusion_strength = make_slider_widget(sw_p)\n    sw_occlusion_strength.SetInteractor(interactor)\n    sw_occlusion_strength.SetAnimationModeToAnimate()\n    sw_occlusion_strength.EnabledOn()\n    sw_occlusion_strength.SetCurrentRenderer(ren1)\n    sw_occlusion_strength_cb = SliderCallbackOcclusionStrength(actor.GetProperty())\n    sw_occlusion_strength.AddObserver(vtkCommand.InteractionEvent, sw_occlusion_strength_cb)\n\n    pos_y += step_size\n\n    sw_p.initial_value = normal_scale\n    sw_p.maximum_value = 5\n    sw_p.title = 'Normal'\n    # Screen coordinates.\n    sw_p.p1 = [pos_x0, pos_y]\n    sw_p.p2 = [pos_x1, pos_y]\n\n    sw_normal = make_slider_widget(sw_p)\n    sw_normal.SetInteractor(interactor)\n    sw_normal.SetAnimationModeToAnimate()\n    sw_normal.EnabledOn()\n    sw_normal.SetCurrentRenderer(ren1)\n    sw_normal_cb = SliderCallbackNormalScale(actor.GetProperty())\n    sw_normal.AddObserver(vtkCommand.InteractionEvent, sw_normal_cb)\n\n    name = Path(sys.argv[0]).stem\n    render_window.SetSize(1000, 625)\n    render_window.Render()\n    render_window.SetWindowName(name)\n\n    if vtk_version_ok(9, 0, 20210718):\n        try:\n            cam_orient_manipulator = vtkCameraOrientationWidget()\n            cam_orient_manipulator.SetParentRenderer(ren2)\n            # Enable the widget.\n            cam_orient_manipulator.On()\n        except AttributeError:\n            pass\n    else:\n        axes = vtkAxesActor()\n        widget = vtkOrientationMarkerWidget()\n        rgba = [0.0, 0.0, 0.0, 0.0]\n        colors.GetColor(\"Carrot\", rgba)\n        widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n        widget.SetOrientationMarker(axes)\n        widget.SetInteractor(interactor)\n        widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n        widget.EnabledOn()\n        widget.InteractiveOn()\n\n    print_callback = PrintCallback(interactor, name, 1, False)\n    # print_callback = PrintCallback(interactor, name + '.jpg', 1, False)\n    interactor.AddObserver('KeyPressEvent', print_callback)\n\n    interactor.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef get_parameters(fn_path):\n    \"\"\"\n    Read the parameters from a JSON file and check that the file paths exist.\n\n    :param fn_path: The path to the JSON file.\n    :return: True if the paths correspond to files and the parameters.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    parameters = dict()\n\n    # Extract the values.\n    keys_no_paths = {'title', 'object', 'objcolor', 'bkgcolor', 'skybox'}\n    keys_with_paths = {'cubemap', 'equirectangular', 'albedo', 'normal', 'material', 'coat', 'anisotropy', 'emissive'}\n    paths_ok = True\n    for k, v in json_data.items():\n        if k in keys_no_paths:\n            parameters[k] = v\n            continue\n        if k in keys_with_paths:\n            if k == 'cubemap':\n                if ('root' in v) and ('files' in v):\n                    root = Path(v['root'])\n                    if not root.exists():\n                        print(f'Bad cubemap path: {root}')\n                        paths_ok = False\n                    elif len(v['files']) != 6:\n                        print(f'Expect six cubemap file names.')\n                        paths_ok = False\n                    else:\n                        cm = list(map(lambda p: root / p, v['files']))\n                        for fn in cm:\n                            if not fn.is_file():\n                                paths_ok = False\n                                print(f'Not a file {fn}')\n                        if paths_ok:\n                            parameters['cubemap'] = cm\n                else:\n                    paths_ok = False\n                    print('Missing the key \"root\" and/or the key \"f\u00edles\" for the cubemap.')\n            else:\n                fn = Path(v)\n                if not fn.exists():\n                    print(f'Bad {k} path: {fn}')\n                    paths_ok = False\n                else:\n                    parameters[k] = fn\n\n    # Set Boy as the default surface.\n    if ('object' in parameters.keys() and not parameters['object']) or 'object' not in parameters.keys():\n        parameters['object'] = 'Boy'\n\n    return paths_ok, parameters\n\n\ndef display_parameters(parameters):\n    res = list()\n    parameter_keys = ['title', 'object', 'objcolor', 'bkgcolor', 'skybox', 'cubemap', 'equirectangular', 'albedo',\n                      'normal', 'material', 'coat', 'anisotropy', 'emissive']\n    for k in parameter_keys:\n        if k != 'cubemap':\n            if k in parameters:\n                res.append(f'{k:15}: {parameters[k]}')\n        else:\n            if k in parameters:\n                for idx in range(len(parameters[k])):\n                    if idx == 0:\n                        res.append(f'{k:15}: {parameters[k][idx]}')\n                    else:\n                        res.append(f'{\" \" * 17}{parameters[k][idx]}')\n    return res\n\n\n\ndef read_cubemap(cubemap):\n    \"\"\"\n    Read six images forming a cubemap.\n\n    :param cubemap: The paths to the six cubemap files.\n    :return: The cubemap texture.\n    \"\"\"\n    cube_map = vtkTexture()\n    cube_map.CubeMapOn()\n\n    i = 0\n    for fn in cubemap:\n        # Read the images.\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn))\n        img_reader.SetFileName(str(fn))\n\n        # Each image must be flipped in Y due to canvas\n        #  versus vtk ordering.\n        flip = vtkImageFlip()\n        flip.SetInputConnection(img_reader.GetOutputPort(0))\n        flip.SetFilteredAxis(1)  # flip y axis\n        cube_map.SetInputConnection(i, flip.GetOutputPort())\n        i += 1\n\n    cube_map.MipmapOn()\n    cube_map.InterpolateOn()\n\n    return cube_map\n\n\ndef read_equirectangular_file(fn_path):\n    \"\"\"\n    Read an equirectangular environment file and convert to a texture.\n\n    :param fn_path: The equirectangular file path.\n    :return: The texture.\n    \"\"\"\n    texture = vtkTexture()\n\n    suffix = fn_path.suffix.lower()\n    if suffix in ['.jpeg', '.jpg', '.png']:\n        reader_factory = vtkImageReader2Factory()\n        img_reader = reader_factory.CreateImageReader2(str(fn_path))\n        img_reader.SetFileName(str(fn_path))\n\n        texture.SetInputConnection(img_reader.GetOutputPort(0))\n\n    else:\n        reader = vtkHDRReader()\n        extensions = reader.GetFileExtensions()\n        # Check the image can be read.\n        if not reader.CanReadFile(str(fn_path)):\n            print('CanReadFile failed for ', fn_path)\n            return None\n        if suffix not in extensions:\n            print('Unable to read this file extension: ', suffix)\n            return None\n        reader.SetFileName(str(fn_path))\n\n        texture.SetColorModeToDirectScalars()\n        texture.SetInputConnection(reader.GetOutputPort())\n\n    texture.MipmapOn()\n    texture.InterpolateOn()\n\n    return texture\n\n\ndef read_texture(image_path):\n    \"\"\"\n    Read an image and convert it to a texture\n    :param image_path: The image path.\n    :return: The texture.\n    \"\"\"\n\n    suffix = image_path.suffix.lower()\n    valid_extensions = ['.jpg', '.png', '.bmp', '.tiff', '.pnm', '.pgm', '.ppm']\n    if suffix not in valid_extensions:\n        print('Unable to read the texture file (wrong extension):', image_path)\n        return None\n\n    # Read the images\n    reader_factory = vtkImageReader2Factory()\n    img_reader = reader_factory.CreateImageReader2(str(image_path))\n    img_reader.SetFileName(str(image_path))\n\n    texture = vtkTexture()\n    texture.InterpolateOn()\n    texture.SetInputConnection(img_reader.GetOutputPort(0))\n    texture.Update()\n\n    return texture\n\n\ndef check_for_missing_textures(parameters, wanted_textures):\n    \"\"\"\n    Check that the needed textures exist.\n\n    :param parameters: The parameters.\n    :param wanted_textures: The wanted textures.\n    :return: True if all the wanted textures are present.\n    \"\"\"\n    have_textures = True\n    for texture_name in wanted_textures:\n        if texture_name not in parameters:\n            print('Missing texture:', texture_name)\n            have_textures = False\n        elif not parameters[texture_name]:\n            print('No texture path for:', texture_name)\n            have_textures = False\n\n    return have_textures\n\n\ndef get_boy():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricBoy()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_mobius():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricMobius()\n    surface.SetMinimumV(-0.25)\n    surface.SetMaximumV(0.25)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_random_hills():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricRandomHills()\n    surface.SetRandomSeed(1)\n    surface.SetNumberOfHills(30)\n    # If you want a plane\n    # surface.SetHillAmplitude(0)\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_torus():\n    u_resolution = 51\n    v_resolution = 51\n    surface = vtkParametricTorus()\n\n    source = vtkParametricFunctionSource()\n    source.SetUResolution(u_resolution)\n    source.SetVResolution(v_resolution)\n    source.GenerateTextureCoordinatesOn()\n    source.SetParametricFunction(surface)\n    source.Update()\n\n    # Build the tangents\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(source.GetOutputPort())\n    tangents.Update()\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(tangents.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(surface.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_sphere():\n    theta_resolution = 32\n    phi_resolution = 32\n    surface = vtkTexturedSphereSource()\n    surface.SetThetaResolution(theta_resolution)\n    surface.SetPhiResolution(phi_resolution)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, 0)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(surface.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(clipper.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(3)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(subdivide.GetOutputPort())\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef get_clipped_cube():\n    surface = vtkCubeSource()\n\n    # Triangulate.\n    triangulation = vtkTriangleFilter()\n    triangulation.SetInputConnection(surface.GetOutputPort())\n\n    # Subdivide the triangles\n    subdivide = vtkLinearSubdivisionFilter()\n    subdivide.SetInputConnection(triangulation.GetOutputPort())\n    subdivide.SetNumberOfSubdivisions(5)\n\n    clip_plane = vtkPlane()\n    clip_plane.SetOrigin(0, 0.3, 0)\n    clip_plane.SetNormal(0, -1, -1)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(subdivide.GetOutputPort())\n    clipper.SetClipFunction(clip_plane)\n    clipper.GenerateClippedOutputOn()\n\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(clipper.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(cleaner.GetOutputPort())\n    normals.FlipNormalsOn()\n    normals.SetFeatureAngle(60)\n\n    # Now the tangents.\n    tangents = vtkPolyDataTangents()\n    tangents.SetInputConnection(normals.GetOutputPort())\n    tangents.ComputeCellTangentsOn()\n    tangents.ComputePointTangentsOff()\n    tangents.Update()\n    return tangents.GetOutput()\n\n\ndef uv_tcoords(u_resolution, v_resolution, pd):\n    \"\"\"\n    Generate u, v texture coordinates on a parametric surface.\n    :param u_resolution: u resolution\n    :param v_resolution: v resolution\n    :param pd: The polydata representing the surface.\n    :return: The polydata with the texture coordinates added.\n    \"\"\"\n    u0 = 1.0\n    v0 = 0.0\n    du = 1.0 / (u_resolution - 1)\n    dv = 1.0 / (v_resolution - 1)\n    num_pts = pd.GetNumberOfPoints()\n    t_coords = vtkFloatArray()\n    t_coords.SetNumberOfComponents(2)\n    t_coords.SetNumberOfTuples(num_pts)\n    t_coords.SetName('Texture Coordinates')\n    pt_id = 0\n    u = u0\n    for i in range(0, u_resolution):\n        v = v0\n        for j in range(0, v_resolution):\n            tc = [u, v]\n            t_coords.SetTuple(pt_id, tc)\n            v += dv\n            pt_id += 1\n        u -= du\n    pd.GetPointData().SetTCoords(t_coords)\n    return pd\n\n\nclass SliderProperties:\n    tube_width = 0.008\n    slider_length = 0.075\n    slider_width = 0.025\n    end_cap_length = 0.025\n    end_cap_width = 0.025\n    title_height = 0.025\n    label_height = 0.020\n\n    minimum_value = 0.0\n    maximum_value = 1.0\n    initial_value = 0.0\n\n    p1 = [0.02, 0.1]\n    p2 = [0.18, 0.1]\n\n    title = None\n\n    title_color = 'Black'\n    label_color = 'Black'\n    value_color = 'DarkSlateGray'\n    slider_color = 'BurlyWood'\n    selected_color = 'Lime'\n    bar_color = 'Black'\n    bar_ends_color = 'Indigo'\n\n\ndef make_slider_widget(properties):\n    colors = vtkNamedColors()\n\n    slider = vtkSliderRepresentation2D()\n\n    slider.SetMinimumValue(properties.minimum_value)\n    slider.SetMaximumValue(properties.maximum_value)\n    slider.SetValue(properties.initial_value)\n    slider.SetTitleText(properties.title)\n\n    slider.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint1Coordinate().SetValue(properties.p1[0], properties.p1[1])\n    slider.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint2Coordinate().SetValue(properties.p2[0], properties.p2[1])\n\n    slider.SetTubeWidth(properties.tube_width)\n    slider.SetSliderLength(properties.slider_length)\n    slider.SetSliderWidth(properties.slider_width)\n    slider.SetEndCapLength(properties.end_cap_length)\n    slider.SetEndCapWidth(properties.end_cap_width)\n    slider.SetTitleHeight(properties.title_height)\n    slider.SetLabelHeight(properties.label_height)\n\n    # Set the color properties\n    # Change the color of the title.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.title_color))\n    # Change the color of the label.\n    slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.label_color))\n    # Change the color of the bar.\n    slider.GetTubeProperty().SetColor(colors.GetColor3d(properties.bar_color))\n    # Change the color of the ends of the bar.\n    slider.GetCapProperty().SetColor(colors.GetColor3d(properties.bar_ends_color))\n    # Change the color of the knob that slides.\n    slider.GetSliderProperty().SetColor(colors.GetColor3d(properties.slider_color))\n    # Change the color of the knob when the mouse is held on it.\n    slider.GetSelectedProperty().SetColor(colors.GetColor3d(properties.selected_color))\n    # Change the color of the text displaying the value.\n    slider.GetLabelProperty().SetColor(colors.GetColor3d(properties.value_color))\n\n    slider_widget = vtkSliderWidget()\n    slider_widget.SetRepresentation(slider)\n\n    return slider_widget\n\n\nclass SliderCallbackExposure:\n    def __init__(self, tone_mapping_property):\n        self.tone_mapping_property = tone_mapping_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.tone_mapping_property.SetExposure(value)\n\n\nclass SliderCallbackMetallic:\n    def __init__(self, actor_property):\n        self.actor_property = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actor_property.SetMetallic(value)\n\n\nclass SliderCallbackRoughness:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetRoughness(value)\n\n\nclass SliderCallbackOcclusionStrength:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetOcclusionStrength(value)\n\n\nclass SliderCallbackNormalScale:\n    def __init__(self, actor_property):\n        self.actorProperty = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actorProperty.SetNormalScale(value)\n\n\nclass PrintCallback:\n    def __init__(self, caller, file_name, image_quality=1, rgba=True):\n        \"\"\"\n        Set the parameters for writing the\n         render window view to an image file.\n\n        :param caller: The caller for the callback.\n        :param file_name: The image file name.\n        :param image_quality: The image quality.\n        :param rgba: The buffer type, (if true, there is no background in the screenshot).\n        \"\"\"\n        self.caller = caller\n        self.image_quality = image_quality\n        self.rgba = rgba\n        if not file_name:\n            self.path = None\n            print(\"A file name is required.\")\n            return\n        pth = Path(file_name).absolute()\n        valid_suffixes = ['.jpeg', '.jpg', '.png']\n        if pth.suffix:\n            ext = pth.suffix.lower()\n        else:\n            ext = '.png'\n        if ext not in valid_suffixes:\n            ext = '.png'\n        self.suffix = ext\n        self.path = Path(str(pth)).with_suffix(ext)\n\n    def __call__(self, caller, ev):\n        if not self.path:\n            print(\"A file name is required.\")\n            return\n        # Save the screenshot.\n        if caller.GetKeyCode() == \"k\":\n            w2if = vtkWindowToImageFilter()\n            w2if.SetInput(caller.GetRenderWindow())\n            w2if.SetScale(self.image_quality, self.image_quality)\n            if self.rgba:\n                w2if.SetInputBufferTypeToRGBA()\n            else:\n                w2if.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            w2if.ReadFrontBufferOn()\n            w2if.Update()\n            if self.suffix in ['.jpeg', '.jpg']:\n                writer = vtkJPEGWriter()\n            else:\n                writer = vtkPNGWriter()\n            writer.SetFileName(self.path)\n            writer.SetInputData(w2if.GetOutput())\n            writer.Write()\n            print('Screenshot saved to:', self.path)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/Rainbow/","title":"Rainbow","text":"

        vtk-examples/Python/Rendering/Rainbow

        "},{"location":"Python/Rendering/Rainbow/#description","title":"Description","text":"

        This example demonstrates the use and manipulation of vtkLookupTable's.

        First a simple pipeline that reads a vtkStructuredGrid and then extracts a plane using vtkStructuredGeometryFilter from the grid. The plane will be colored differently by using different vtkLookupTable's.

        Note

        The Update method is manually invoked because it causes the reader to read; later on we use the output of the reader to set a range for the scalar values.

        Note

        This original tcl source code for this example is here.

        Info

        See Figure 6-3 in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/Rainbow/#code","title":"Code","text":"

        Rainbow.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFn, qFn = get_program_parameters()\n    colors = vtkNamedColors()\n\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(xyzFn)\n    pl3d.SetQFileName(qFn)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    pl3dOutput = pl3d.GetOutput().GetBlock(0)\n\n    plane = vtkStructuredGridGeometryFilter()\n    plane.SetInputData(pl3dOutput)\n    plane.SetExtent(1, 100, 1, 100, 7, 7)\n\n    lut = vtkLookupTable()\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetLookupTable(lut)\n    planeMapper.SetInputConnection(plane.GetOutputPort())\n    planeMapper.SetScalarRange(pl3dOutput.GetScalarRange())\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n\n    # This creates an outline around the data.\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3dOutput)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Much of the following is commented out. To try different lookup tables,\n    # uncomment the appropriate portions.\n    #\n\n    # This creates a black to white lut.\n    # lut.SetHueRange(0, 0)\n    # lut.SetSaturationRange(0, 0)\n    # lut.SetValueRange(0.2, 1.0)\n\n    # This creates a red to blue lut.\n    # lut.SetHueRange(0.0, 0.667)\n\n    # This creates a blue to red lut.\n    # lut.SetHueRange(0.667, 0.0)\n\n    # This creates a weird effect. The Build() method causes the lookup table\n    # to allocate memory and create a table based on the correct hue, saturation,\n    # value, and alpha (transparency) range. Here we then manually overwrite the\n    # values generated by the Build() method.\n    lut.SetNumberOfColors(256)\n    lut.SetHueRange(0.0, 0.667)\n    lut.Build()\n\n    # Create the RenderWindow, Renderer and both Actors.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(planeActor)\n\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.TwoSidedLightingOff()\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('Rainbow')\n\n    iren.Initialize()\n\n    cam1 = ren1.GetActiveCamera()\n    cam1.SetClippingRange(3.95297, 50)\n    cam1.SetFocalPoint(8.88908, 0.595038, 29.3342)\n    cam1.SetPosition(-12.3332, 31.7479, 41.2387)\n    cam1.SetViewUp(0.060772, -0.319905, 0.945498)\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrates the use and manipulation of lookup tables.'\n    epilogue = '''\n    First create a simple pipeline that reads a structured grid\n    and then extracts a plane from the grid. The plane will be colored\n    differently by using different lookup tables.\n\n    Note: The Update method is manually invoked because it causes the\n    reader to read; later on we use the output of the reader to set\n    a range for the scalar values.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('xyzFilename', help='combxyz.bin.')\n    parser.add_argument('qFilename', help='combq.bin.')\n    args = parser.parse_args()\n    return args.xyzFilename, args.qFilename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/Rotations/","title":"Rotations","text":"

        vtk-examples/Python/Rendering/Rotations

        "},{"location":"Python/Rendering/Rotations/#description","title":"Description","text":"

        Rotations of a cow about her axes. In this model, the x axis is from the left to right; the y axis is from bottom to top; and the z axis emerges from the image. The camera location is the same in all four images.

        Info

        See Figure 3-31 in Chapter 3 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/Rotations/#code","title":"Code","text":"

        Rotations.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkAxes\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    \"\"\"\n        To match the illustrations in VTKTextbook.pdf, use BkgColor as the background and\n          Wheat as the cow colour.\n        Also comment out the lines:\n          modelActor->GetProperty()->SetSpecular(.6);\n          modelActor->GetProperty()->SetSpecularPower(30);\n        and use cow.g as the input data.\n\n    \"\"\"\n    file_name, figure, actor_color = get_program_parameters()\n    rotate(file_name, figure, actor_color)\n\n\ndef rotate(file_name, figure, actor_color):\n    \"\"\"\n    This is where we do the rotations.\n\n    \"\"\"\n    # Create renderer stuff\n    #\n    colors = vtkNamedColors()\n    # Set the background color.\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n    # colors.SetColor('BkgColor', [60, 93, 144, 255])\n\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    #\n    polyData = ReadPolyData(file_name)\n\n    modelMapper = vtkPolyDataMapper()\n    modelMapper.SetInputData(polyData)\n\n    modelActor = vtkActor()\n    modelActor.SetMapper(modelMapper)\n    modelActor.GetProperty().SetDiffuseColor(colors.GetColor3d(actor_color))\n    if actor_color != 'Wheat':\n        modelActor.GetProperty().SetSpecular(0.6)\n        modelActor.GetProperty().SetSpecularPower(30)\n\n    modelAxesSource = vtkAxes()\n    modelAxesSource.SetScaleFactor(10)\n    modelAxesSource.SetOrigin(0, 0, 0)\n\n    modelAxesMapper = vtkPolyDataMapper()\n    modelAxesMapper.SetInputConnection(modelAxesSource.GetOutputPort())\n\n    modelAxes = vtkActor()\n    modelAxes.SetMapper(modelAxesMapper)\n\n    ren1.AddActor(modelAxes)\n    modelAxes.VisibilityOff()\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(modelActor)\n    if actor_color == 'Wheat':\n        ren1.SetBackground(colors.GetColor3d('BkgColor'))\n    else:\n        ren1.SetBackground(colors.GetColor3d('Silver'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('Rotations')\n\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Azimuth(0)\n    ren1.GetActiveCamera().SetClippingRange(0.1, 1000.0)\n\n    modelAxes.VisibilityOn()\n\n    renWin.Render()\n    renWin.Render()\n\n    if figure == 1:\n        RotateX(renWin, modelActor)\n    elif figure == 2:\n        RotateY(renWin, modelActor)\n    elif figure == 3:\n        RotateZ(renWin, modelActor)\n    else:\n        RotateXY(renWin, modelActor)\n\n    renWin.EraseOff()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Perform rotations about the X, Y, Z and X then Y axes.'\n    epilogue = '''\n        Perform rotations about the X, Y, Z and X then Y axes.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='The file cow.obj.')\n    parser.add_argument('figure', default=0, type=int, nargs='?',\n                        help='The particular rotation that you want to view.')\n    parser.add_argument('actor_color', default='Wheat', type=str, nargs='?',\n                        help='If the color is Wheat then the vtk textbook colors are used.')\n    args = parser.parse_args()\n    return args.filename, args.figure, args.actor_color\n\n\ndef RotateX(renWin, actor):\n    actor.SetOrientation(0, 0, 0)\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n\n    for i in range(0, 6):\n        actor.RotateX(60)\n        renWin.Render()\n        renWin.Render()\n    renWin.EraseOn()\n\n\ndef RotateY(renWin, actor):\n    actor.SetOrientation(0, 0, 0)\n    renWin.Render()\n    renWin.EraseOff()\n\n    for i in range(0, 6):\n        actor.RotateY(60)\n        renWin.Render()\n        renWin.Render()\n    renWin.EraseOn()\n\n\ndef RotateZ(renWin, actor):\n    actor.SetOrientation(0, 0, 0)\n    renWin.Render()\n    renWin.EraseOff()\n\n    for i in range(0, 6):\n        actor.RotateZ(60)\n        renWin.Render()\n        renWin.Render()\n    renWin.EraseOn()\n\n\ndef RotateXY(renWin, actor):\n    actor.SetOrientation(0, 0, 0)\n    actor.RotateX(60)\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n\n    for i in range(0, 6):\n        actor.RotateY(60)\n        renWin.Render()\n        renWin.Render()\n    renWin.EraseOn()\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a sphere if the extension is unknown.\n        source = vtkSphereSource()\n        source.Update()\n        poly_data = source.GetOutput()\n    return poly_data\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/RotationsA/","title":"RotationsA","text":"

        vtk-examples/Python/Rendering/RotationsA

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/RotationsA/#code","title":"Code","text":"

        RotationsA.py

        #!/usr/bin/env python\n\n\"\"\"\nRotations, VTK Textbook figure 3-31a.\n\nNote: Make sure Rotations.py is in the same directory as this program.\n\"\"\"\n\nimport Rotations\n\n\ndef main():\n    file_name, figure, book_color = Rotations.get_program_parameters()\n    # Set up for six rotations about the x-axis.\n    figure = 1\n    book_color = True\n    Rotations.rotate(file_name, figure, book_color)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/RotationsB/","title":"RotationsB","text":"

        vtk-examples/Python/Rendering/RotationsB

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/RotationsB/#code","title":"Code","text":"

        RotationsB.py

        #!/usr/bin/env python\n\n\"\"\"\nRotations, VTK Textbook figure 3-31b.\n\nNote: Make sure Rotations.py is in the same directory as this program.\n\"\"\"\n\nimport Rotations\n\n\ndef main():\n    file_name, figure, book_color = Rotations.get_program_parameters()\n    # Set up for six rotations about the y-axis.\n    figure = 2\n    book_color = True\n    Rotations.rotate(file_name, figure, book_color)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/RotationsC/","title":"RotationsC","text":"

        vtk-examples/Python/Rendering/RotationsC

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/RotationsC/#code","title":"Code","text":"

        RotationsC.py

        #!/usr/bin/env python\n\n\"\"\"\nRotations, VTK Textbook figure 3-31c.\n\nNote: Make sure Rotations.py is in the same directory as this program.\n\"\"\"\n\nimport Rotations\n\n\ndef main():\n    file_name, figure, book_color = Rotations.get_program_parameters()\n    # Set up for six rotations about the z-axis.\n    figure = 3\n    book_color = True\n    Rotations.rotate(file_name, figure, book_color)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/RotationsD/","title":"RotationsD","text":"

        vtk-examples/Python/Rendering/RotationsD

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/RotationsD/#code","title":"Code","text":"

        RotationsD.py

        #!/usr/bin/env python\n\n\"\"\"\nRotations, VTK Textbook figure 3-31d.\n\nNote: Make sure Rotations.py is in the same directory as this program.\n\"\"\"\n\nimport Rotations\n\n\ndef main():\n    file_name, figure, book_color = Rotations.get_program_parameters()\n    # First a rotation about the x-axis, then six rotations about the y-axis.\n    figure = 4\n    book_color = True\n    Rotations.rotate(file_name, figure, book_color)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/Shadows/","title":"Shadows","text":"

        vtk-examples/Python/Rendering/Shadows

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/Shadows/#code","title":"Code","text":"

        Shadows.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkCameraPass,\n    vtkRenderPassCollection,\n    vtkSequencePass,\n    vtkShadowMapPass\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Read a polydata file of a surface and display it with shadows.'\n    epilogue = '''\nIf no file is entered a sphere is used.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', default=None, nargs='?', help='Enter a polydata file e.g cow.g.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef main():\n    fn = get_program_parameters()\n    if fn:\n        polyData = ReadPolyData(fn)\n    else:\n        # Use a sphere\n        source = vtkSphereSource()\n        source.SetThetaResolution(100)\n        source.SetPhiResolution(100)\n        source.Update()\n        polyData = source.GetOutput()\n\n    colors = vtkNamedColors()\n    colors.SetColor('HighNoonSun', [255, 255, 251, 255])  # Color temp. 5400\u00b0K\n    colors.SetColor('100W Tungsten', [255, 214, 170, 255])  # Color temp. 2850\u00b0K\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(640, 480)\n    renderWindow.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    light1 = vtkLight()\n    light1.SetFocalPoint(0, 0, 0)\n    light1.SetPosition(0, 1, 0.2)\n    light1.SetColor(colors.GetColor3d('HighNoonSun'))\n    light1.SetIntensity(0.3)\n    renderer.AddLight(light1)\n\n    light2 = vtkLight()\n    light2.SetFocalPoint(0, 0, 0)\n    light2.SetPosition(1.0, 1.0, 1.0)\n    light2.SetColor(colors.GetColor3d('100W Tungsten'))\n    light2.SetIntensity(0.8)\n    renderer.AddLight(light2)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetAmbientColor(colors.GetColor3d('SaddleBrown'))\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Sienna'))\n    actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    actor.GetProperty().SetSpecular(0.51)\n    actor.GetProperty().SetDiffuse(0.7)\n    actor.GetProperty().SetAmbient(0.7)\n    actor.GetProperty().SetSpecularPower(30.0)\n    actor.GetProperty().SetOpacity(1.0)\n    renderer.AddActor(actor)\n\n    # Add a plane\n    bounds = polyData.GetBounds()\n\n    rnge = [0] * 3\n    rnge[0] = bounds[1] - bounds[0]\n    rnge[1] = bounds[3] - bounds[2]\n    rnge[2] = bounds[5] - bounds[4]\n    print('range: ', ', '.join(['{0:0.6f}'.format(i) for i in rnge]))\n    expand = 1.0\n    thickness = rnge[2] * 0.1\n    plane = vtkCubeSource()\n    plane.SetCenter((bounds[1] + bounds[0]) / 2.0,\n                    bounds[2] - thickness / 2.0,\n                    (bounds[5] + bounds[4]) / 2.0)\n    plane.SetXLength(bounds[1] - bounds[0] + (rnge[0] * expand))\n    plane.SetYLength(thickness)\n    plane.SetZLength(bounds[5] - bounds[4] + (rnge[2] * expand))\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputConnection(plane.GetOutputPort())\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n    renderer.AddActor(planeActor)\n\n    renderWindow.SetMultiSamples(0)\n\n    shadows = vtkShadowMapPass()\n\n    seq = vtkSequencePass()\n\n    passes = vtkRenderPassCollection()\n    passes.AddItem(shadows.GetShadowMapBakerPass())\n    passes.AddItem(shadows)\n    seq.SetPasses(passes)\n\n    cameraP = vtkCameraPass()\n    cameraP.SetDelegatePass(seq)\n\n    # Tell the renderer to use our render pass pipeline\n    glrenderer = renderer\n    glrenderer.SetPass(cameraP)\n\n    renderer.GetActiveCamera().SetPosition(-0.2, 0.2, 1)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 1, 0)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Dolly(2.25)\n    renderer.ResetCameraClippingRange()\n    renderWindow.SetWindowName('Shadows')\n    renderWindow.Render()\n    renderWindow.SetWindowName('Shadows')\n\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/SpecularSpheres/","title":"SpecularSpheres","text":"

        vtk-examples/Python/Rendering/SpecularSpheres

        "},{"location":"Python/Rendering/SpecularSpheres/#description","title":"Description","text":"

        Note

        The original source code for this example is here.

        Info

        See Figure 3-10 in Chapter 3 the VTK Textbook.

        Info

        Similar examples setting the ambient and diffuse properties are: See AmbientSpheres.cxx, AmbientSpheres.py, AmbientSpheres.java and DiffuseSpheres.cxx, DiffuseSpheres.py.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/SpecularSpheres/#code","title":"Code","text":"

        SpecularSpheres.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('bkg', [26, 51, 102, 255])\n\n    # The following lines create a sphere represented by polygons.\n    #\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(100)\n    sphere.SetPhiResolution(50)\n\n    # The mapper is responsible for pushing the geometry into the graphics\n    # library. It may also do color mapping, if scalars or other attributes\n    # are defined.\n    #\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    # The actor is a grouping mechanism: besides the geometry (mapper), it\n    # also has a property, transformation matrix, and/or texture map.\n    # In this example we create eight different spheres (two rows of four\n    # spheres) and set the specular lighting coefficients. A little ambient\n    # is turned on so the sphere is not completely black on the back side.\n    #\n    numberOfSpheres = 8\n    spheres = list()\n    ambient = 0.3\n    diffuse = 0.5\n    specular = 1.0\n    spBase = 5.0\n    spScale = 1.0\n    position = [0, 0, 0]\n    for i in range(0, numberOfSpheres):\n        specularPower = spBase * spScale\n        spheres.append(vtkActor())\n        spheres[i].SetMapper(sphereMapper)\n        spheres[i].GetProperty().SetColor(colors.GetColor3d('Red'))\n        spheres[i].GetProperty().SetAmbient(ambient)\n        spheres[i].GetProperty().SetDiffuse(diffuse)\n        spheres[i].GetProperty().SetSpecular(specular)\n        spheres[i].GetProperty().SetSpecularPower(specularPower)\n        spheres[i].GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n        spheres[i].AddPosition(position)\n        spScale = spScale * 2.0\n        position[0] += 1.25\n        if i == 3:\n            specular = 0.5\n            spScale = 1.0\n            position[0] = 0\n            position[1] = 1.25\n\n    # Create the graphics structure. The renderer renders into the\n    # render window. The render window interactor captures mouse events\n    # and will perform appropriate camera or actor manipulation\n    # depending on the nature of the events.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    for i in range(0, numberOfSpheres):\n        ren.AddActor(spheres[i])\n\n    ren.SetBackground(colors.GetColor3d('bkg'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('SpecularSpheres')\n\n    # Set up the lighting.\n    #\n    light = vtkLight()\n    light.SetFocalPoint(1.875, 0.6125, 0)\n    light.SetPosition(0.875, 1.6125, 1)\n    ren.AddLight(light)\n\n    # We want to eliminate perspective effects on the apparent lighting.\n    # Parallel camera projection will be used. To zoom in parallel projection\n    # mode, the ParallelScale is set.\n    #\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    ren.GetActiveCamera().SetPosition(0, 0, 1)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.GetActiveCamera().ParallelProjectionOn()\n    ren.ResetCamera()\n    ren.GetActiveCamera().SetParallelScale(2.0)\n    # This starts the event loop and invokes an initial render.\n    #\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/StippledLine/","title":"StippledLine","text":"

        vtk-examples/Python/Rendering/StippledLine

        "},{"location":"Python/Rendering/StippledLine/#description","title":"Description","text":"

        VTK OpenGL2 no longer supports Stippled Lines. This example uses texture mapping to created stippled lines. Two parameters, StipplePattern and StippleRepeat, control the pattern of the stippled lines.

        StipplePattern is a 16-bit binary pattern, 1 = pixel on, 0 = pixel off.

        StippleRepeat is the stippling repeat factor of a Line, which specifies how many times each bit in the pattern is to be repeated.

        It can be tricky to set the proper pattern and repeat, so experiment.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/StippledLine/#code","title":"Code","text":"

        StippledLine.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_UNSIGNED_CHAR,\n    vtkDoubleArray\n)\nfrom vtkmodules.vtkCommonDataModel import vtkImageData\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    lines = vtkLineSource()\n    # Create two points, P0 and P1\n    p0 = [1.0, 0.0, 0.0]\n    p1 = [5.0, 0.0, 0.0]\n\n    lines.SetResolution(11)\n    lines.SetPoint1(p0)\n    lines.SetPoint2(p1)\n    lines.Update()\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(lines.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetLineWidth(5)\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n\n    StippledLine(actor, 0xA1A1, 2)\n\n    ren1 = vtkRenderer()\n    ren1.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    renWin = vtkRenderWindow()\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('StippledLine')\n\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    ren1.AddActor(actor)\n    renWin.Render()\n    iren.Start()\n\n\ndef StippledLine(actor, lineStipplePattern, lineStippleRepeat):\n    tcoords = vtkDoubleArray()\n    image = vtkImageData()\n    texture = vtkTexture()\n\n    # Create texture\n    dimension = 16 * lineStippleRepeat\n\n    image.SetDimensions(dimension, 1, 1)\n    image.AllocateScalars(VTK_UNSIGNED_CHAR, 4)\n    image.SetExtent(0, dimension - 1, 0, 0, 0, 0)\n    on = 255\n    off = 0\n    i_dim = 0\n    while i_dim < dimension:\n        for i in range(0, 16):\n            mask = (1 << i)\n            bit = (lineStipplePattern & mask) >> i\n            value = bit\n            if value == 0:\n                for j in range(0, lineStippleRepeat):\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 0, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 1, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 2, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 3, off)\n                    i_dim += 1\n            else:\n                for j in range(0, lineStippleRepeat):\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 0, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 1, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 2, on)\n                    image.SetScalarComponentFromFloat(i_dim, 0, 0, 3, on)\n                    i_dim += 1\n    polyData = actor.GetMapper().GetInput()\n    # Create texture coordinates\n    tcoords.SetNumberOfComponents(1)\n    tcoords.SetNumberOfTuples(polyData.GetNumberOfPoints())\n    for i in range(0, polyData.GetNumberOfPoints()):\n        value = i * 0.5\n        tcoords.SetTypedTuple(i, [value])\n    polyData.GetPointData().SetTCoords(tcoords)\n    texture.SetInputData(image)\n    texture.InterpolateOff()\n    texture.RepeatOn()\n\n    actor.SetTexture(texture)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/StripFran/","title":"StripFran","text":"

        vtk-examples/Python/Rendering/StripFran

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/StripFran/#code","title":"Code","text":"

        StripFran.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDecimatePro,\n    vtkMaskPolyData,\n    vtkPolyDataNormals,\n    vtkStripper\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    renderer1 = vtkRenderer()\n    renderer1.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    renderer2 = vtkRenderer()\n    renderer2.SetViewport(0.5, 0.0, 1.0, 1.0)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer1)\n    renderWindow.AddRenderer(renderer2)\n    renderWindow.SetWindowName('StripFran')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Create a cyberware source.\n    #\n    cyber = vtkPolyDataReader()\n    cyber.SetFileName(fileName)\n\n    deci = vtkDecimatePro()\n    deci.SetInputConnection(cyber.GetOutputPort())\n    deci.SetTargetReduction(0.7)\n    deci.PreserveTopologyOn()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(deci.GetOutputPort())\n\n    mask = vtkMaskPolyData()\n    mask.SetInputConnection(deci.GetOutputPort())\n    mask.SetOnRatio(2)\n\n    cyberMapper = vtkPolyDataMapper()\n    cyberMapper.SetInputConnection(mask.GetOutputPort())\n\n    cyberActor = vtkActor()\n    cyberActor.SetMapper(cyberMapper)\n    cyberActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(cyber.GetOutputPort())\n\n    stripperMask = vtkMaskPolyData()\n    stripperMask.SetInputConnection(stripper.GetOutputPort())\n    stripperMask.SetOnRatio(2)\n\n    stripperMapper = vtkPolyDataMapper()\n    stripperMapper.SetInputConnection(stripperMask.GetOutputPort())\n\n    stripperActor = vtkActor()\n    stripperActor.SetMapper(stripperMapper)\n    stripperActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    renderer1.AddActor(stripperActor)\n    renderer2.AddActor(cyberActor)\n    renderer1.SetBackground(colors.GetColor3d('Wheat'))\n    renderer2.SetBackground(colors.GetColor3d('Papaya_Whip'))\n    renderWindow.SetSize(1024, 640)\n\n    # Render the image.\n    #\n    cam1 = vtkCamera()\n    cam1.SetFocalPoint(0, 0, 0)\n    cam1.SetPosition(1, 0, 0)\n    cam1.SetViewUp(0, 1, 0)\n    renderer1.SetActiveCamera(cam1)\n    renderer2.SetActiveCamera(cam1)\n    renderer1.ResetCamera()\n    cam1.Azimuth(30)\n    cam1.Elevation(30)\n    cam1.Dolly(1.4)\n    renderer1.ResetCameraClippingRange()\n\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Triangle strip examples.'\n    epilogue = '''\n    a) Structured triangle mesh consisting of 134 strips each of 390 triangles (stripF.tcl).\n\n    b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94,\n        longest strip 101 triangles.\n        Images are generated by displaying every other triangle strip (uStripeF.tcl).\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='fran_cut.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/TransformSphere/","title":"TransformSphere","text":"

        vtk-examples/Python/Rendering/TransformSphere

        "},{"location":"Python/Rendering/TransformSphere/#description","title":"Description","text":"

        This example extends the pipeline of the ColoredSphere.py example and shows the effects of type checking on the connectivity of process objects. We add a transform filter (vtkTransformFilter) to nonuniformly scale the sphere in the x-y-z directions. The transform filter only operates on objects with explicit point coordinate representation (i.e., a subclass of vtkPointSet ). However, the elevation filter generates the more general form vtkDataSet as output. Hence we cannot connect the transform filter to the elevation filter. But we can connect the transform filter to the sphere source, and then the elevation filter to the transform filter. (Note: an alternative method is to use vtkCastToConcrete to perform run-time casting.)

        Info

        See Figure 4-20 in Chapter 4 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/TransformSphere/#code","title":"Code","text":"

        TransformSphere.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(12)\n    sphere.SetPhiResolution(12)\n\n    aTransform = vtkTransform()\n    aTransform.Scale(1, 1.5, 2)\n\n    transFilter = vtkTransformFilter()\n    transFilter.SetInputConnection(sphere.GetOutputPort())\n    transFilter.SetTransform(aTransform)\n\n    colorIt = vtkElevationFilter()\n    colorIt.SetInputConnection(transFilter.GetOutputPort())\n    colorIt.SetLowPoint(0, 0, -1)\n    colorIt.SetHighPoint(0, 0, 1)\n\n    lut = vtkLookupTable()\n    lut.SetHueRange(0.667, 0)\n    lut.SetSaturationRange(1, 1)\n    lut.SetValueRange(1, 1)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetLookupTable(lut)\n    mapper.SetInputConnection(colorIt.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(60.0)\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('TransformSphere')\n\n    renWin.Render()\n\n    # Interact with the data.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/TransparentBackground/","title":"TransparentBackground","text":"

        vtk-examples/Python/Rendering/TransparentBackground

        "},{"location":"Python/Rendering/TransparentBackground/#description","title":"Description","text":"

        Demonstrates the use of two renderers. Notice that the second (and subsequent) renderers will have a transparent background.

        You can manipulate the object in the second layer/renderer whilst the objects in the first layer/renderer form the background.

        • Pressing 0 on the keyboard will let you manipulate the objects in layer 0.
        • Pressing 1 on the keyboard will let you manipulate the objects in layer 1.

        Info

        Also see the LayeredActors.cxx and LayeredActors.py examples, where we have added an extra callback so that the non-active layer objects move in conjunction with the active layer objects.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/TransparentBackground/#code","title":"Code","text":"

        TransparentBackground.py

        #!/usr/bin/env python\n\n\"\"\"\n    1. Create a cube and cone source.\n    2. Render it with the cube in layer 0 and the cone in layer 1 of the render window.\n    3. Interact with it.\n    4. Notice that the cube and the cone are both visible and the layer 1 background is transparent.\n    5. Pressing '0' on the keyboard will let you manipulate the objects in layer 0.\n    6. Pressing '1' on the keyboard will let you manipulate the objects in layer 1.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef GenerateAndDisplayCubeAndSphere():\n    colors = vtkNamedColors()\n\n    cubeSource = vtkCubeSource()\n    cubeSource.SetXLength(4.0)\n    cubeSource.SetYLength(9.0)\n    cubeSource.SetZLength(1.0)\n    cubeSource.SetCenter(0.0, 0.0, 0.0)\n\n    # Render the cube\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputConnection(cubeSource.GetOutputPort())\n\n    cubeActor = vtkActor()\n    cubeActor.GetProperty().SetDiffuseColor(colors.GetColor3d(\"DarkGreen\"))\n    cubeActor.SetMapper(cubeMapper)\n\n    coneSource = vtkConeSource()\n    coneSource.SetCenter(0.0, 0.0, 0.0)\n    coneSource.SetHeight(1.0)\n    coneSource.SetRadius(0.25)\n    coneSource.SetDirection(0.0, 1.0, 0.0)\n    coneSource.SetResolution(60)\n    coneSource.CappingOn()\n\n    # Render the cone\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(coneSource.GetOutputPort())\n\n    coneActor = vtkActor()\n    coneActor.GetProperty().SetDiffuseColor(colors.GetColor3d(\"DarkTurquoise\"))\n    # Make the cone slightly transparent for fun\n    coneActor.GetProperty().SetOpacity(0.75)\n    coneActor.SetMapper(coneMapper)\n\n    # The renderers, render window and interactor\n    renderers = list()\n    renWin = vtkRenderWindow()\n    for i in range(0, 2):\n        renderers.append(vtkRenderer())\n        renWin.AddRenderer(renderers[i])\n    renWin.SetSize(800, 800)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Layer 0 - background not transparent\n    renderers[0].SetBackground(colors.GetColor3d(\"Silver\"))\n    renderers[0].AddActor(cubeActor)\n    renderers[0].SetLayer(0)\n    # Layer 1 - the background is transparent\n    #           so we only see the layer 0 background color\n    renderers[1].AddActor(coneActor)\n    renderers[1].SetLayer(1)\n    renderers[1].SetBackground(colors.GetColor3d(\"MidnightBlue\"))\n\n    #  We have two layers\n    renWin.SetNumberOfLayers(2)\n    renWin.Render()\n    renWin.SetWindowName('TransparentBackground')\n\n    iren.AddObserver('KeyPressEvent', KeypressCallbackFunction)\n\n    iren.Start()\n\n\ndef KeypressCallbackFunction(caller, ev):\n    iren = caller\n    renderers = iren.GetRenderWindow().GetRenderers()\n    if renderers.GetNumberOfItems() < 2:\n        print('We need at least two renderers, we have only', renderers.GetNumberOfItems())\n        return\n    renderers.InitTraversal()\n    # Top item\n    ren0 = renderers.GetNextItem()\n    # Bottom item\n    ren1 = renderers.GetNextItem()\n\n    key = iren.GetKeySym()\n\n    if key == '0':\n        print('Pressed:', key)\n        iren.GetRenderWindow().GetInteractor().GetInteractorStyle().SetDefaultRenderer(ren0)\n        ren0.InteractiveOn()\n        ren1.InteractiveOff()\n    if key == '1':\n        print('Pressed:', key)\n        iren.GetRenderWindow().GetInteractor().GetInteractorStyle().SetDefaultRenderer(ren1)\n        ren0.InteractiveOff()\n        ren1.InteractiveOn()\n\n\ndef main():\n    GenerateAndDisplayCubeAndSphere()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/WalkCow/","title":"WalkCow","text":"

        vtk-examples/Python/Rendering/WalkCow

        "},{"location":"Python/Rendering/WalkCow/#description","title":"Description","text":"

        This generates Fig. 3-32: The cow \"walking\" around the global origin; Fig. 3-33: The cow rotating about a vector passing through her nose. (a) With origin (0,0,0). (b) With origin at (6.1,1.3,.02). found in VTKTextbook.

        The example allows an optional second argument that selects the figure to be generated. A 0 generates Fig 3-32, 1 generates Fig 3-33a and 2 generates Fig 3-33b.

        Info

        See Figure 3-32 in Chapter 3 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/WalkCow/#code","title":"Code","text":"

        WalkCow.py

        #!/usr/local/bin/python\n\n#  Translated from walkCow.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkAxes\nfrom vtkmodules.vtkIOGeometry import vtkBYUReader\nfrom vtkmodules.vtkIOImage import vtkPNGWriter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\n\n\ndef walk_cow(file_name, figure):\n    figure = abs(figure)\n    if figure > 2:\n        figure = 0\n\n    colors = vtkNamedColors()\n    # Set the background color.\n    colors.SetColor('BkgColor1', [60, 93, 144, 255])\n    colors.SetColor('BkgColor2', [26, 51, 102, 255])\n\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('WalkCow');\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # The cow pipeline.\n    cow = vtkBYUReader()\n    cow.SetGeometryFileName(file_name)\n    cow.Update()\n\n    cowMapper = vtkPolyDataMapper()\n    cowMapper.SetInputConnection(cow.GetOutputPort())\n    cowMapper.ScalarVisibilityOff()\n\n    cowActor = vtkActor()\n    cowActor.SetMapper(cowMapper)\n    cowActor.GetProperty().SetColor(colors.GetColor3d('Wheat'))\n\n    ren.AddActor(cowActor)\n\n    # Axes pipeline.\n    cowAxesSource = vtkAxes()\n    cowAxesSource.SetScaleFactor(10.0)\n    cowAxesSource.SetOrigin(0, 0, 0)\n\n    cowAxesMapper = vtkPolyDataMapper()\n    cowAxesMapper.SetInputConnection(cowAxesSource.GetOutputPort())\n\n    cowAxes = vtkActor()\n    cowAxes.SetMapper(cowAxesMapper)\n    cowAxes.VisibilityOff()\n\n    ren.AddActor(cowAxes)\n\n    ren.SetBackground(colors.GetColor3d('BkgColor1'))\n    renWin.SetSize(600, 480)\n\n    iren.Initialize()\n    cowAxes.VisibilityOn()\n    renWin.Render()\n\n    # Activate this if you want to see the Position and Focal point.\n    # ren.GetActiveCamera().AddObserver('ModifiedEvent', CameraModifiedCallback)\n\n    # These four walks use the same camera position.\n    Rotate_X(cowActor, ren, renWin)\n    Rotate_Y(cowActor, ren, renWin)\n    Rotate_Z(cowActor, ren, renWin)\n    Rotate_XY(cowActor, ren, renWin)\n\n    ren.SetBackground(colors.GetColor3d('BkgColor2'))\n    if figure == 1:\n        Rotate_V_0(cowActor, ren, renWin)\n    elif figure == 2:\n        Rotate_V_V(cowActor, ren, renWin)\n    else:\n        Rotate_V_0(cowActor, ren, renWin)\n        Rotate_V_V(cowActor, ren, renWin)\n        # Walk() needs to go after Rotate_V_0() or Rotate_V_V().\n        Walk(cowActor, ren, renWin)\n\n    # Interact with data.\n    renWin.EraseOff()\n    iren.Start()\n\n\ndef main():\n    file_name, figure = get_program_parameters()\n    walk_cow(file_name, figure)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce figures: 3-32, 3-33a, 3-33b from the VTK Textbook.'\n    epilogue = '''\n        It is a translation of the original WalkCow.tcl with a few additional enhancements.\n\n        If the parameter figure is 0, 1 or 2 then these correspond to\n        the VTK Textbook figures 3-32, 3-33a, 3-33b in that order.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='The file cow.g.')\n    parser.add_argument('figure', default=0, type=int, nargs='?', help='The particular rotation that you want to view.')\n    args = parser.parse_args()\n    return args.filename, args.figure\n\n\n'''\n  These Rotate* and Walk functions create a scene where multiple\n     views of the object exist.\n\n    They all operate in a similar manner, namely:\n    1) Accept vtkActor, vtkRenderer, vtkRenderWindow as parameters.\n    2) Position the object.\n    3) Position the observer with the focal point sent to the centre\n        of the object.\n    4) Render and set EraseOff() in the render window.\n       Note that:\n        EraseOff() has to be called after a Render() call\n         to work in the desired way.\n    5) Then rotate or Walk the object around the scene.\n    6) Optionally write out the scene using Screenshot().\n    6) Set EraseOff() in the render window.\n    7) Reset the object position.\n\n'''\n\n\ndef Rotate_X(cowActor, ren, renWin):\n    # Six rotations about the x axis.\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(2, 25, 0)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.GetActiveCamera().SetViewUp(0, 0, -1)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(0, 6):\n        cowActor.RotateX(60)\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-31a.png', renWin)\n    renWin.EraseOn()\n\n\ndef Rotate_Y(cowActor, ren, renWin):\n    # Six rotations about the y axis.\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(2, 0, 25)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(0, 6):\n        cowActor.RotateY(60)\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-31b.png', renWin)\n    renWin.EraseOn()\n\n\ndef Rotate_Z(cowActor, ren, renWin):\n    # Six rotations about the z axis.\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    # This closely matches the original illustration.\n    # ren.GetActiveCamera().SetPosition(2, 0, 25)\n    ren.GetActiveCamera().SetPosition(2, 0, 25)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(0, 6):\n        cowActor.RotateZ(60)\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-31c.png', renWin)\n    renWin.EraseOn()\n\n\ndef Rotate_XY(cowActor, ren, renWin):\n    # First a rotation about the x axis, then six rotations about the y axis.\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    # This closely matches the original illustration.\n    # ren.GetActiveCamera().SetPosition(2, 0, 24)\n    ren.GetActiveCamera().SetPosition(2, 0, 25)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    cowActor.RotateX(60)\n    for idx in range(0, 6):\n        cowActor.RotateY(60)\n        renWin.Render()\n        renWin.Render()\n    cowActor.RotateX(-60)\n    # Screenshot('Fig3-31d.png', renWin)\n    renWin.EraseOn()\n\n\ndef Rotate_V_0(cowActor, ren, renWin):\n    # The cow rotating about a vector passing through her nose.\n    # With the origin at (0, 0, 0).\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    cowPos = vtkTransform()\n    cowPos.Identity()\n    cowPos.SetMatrix(cowActor.GetMatrix())\n    cowTransform = vtkTransform()\n    cowTransform.Identity()\n    cowActor.SetUserMatrix(cowTransform.GetMatrix())\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(16, 9, -12)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(0, 6):\n        cowActor.RotateWXYZ(60, 2.19574, -1.42455, -0.0331036)\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-33a.png', renWin)\n    renWin.EraseOn()\n    # Put the cow back on the origin.\n    # for idx in range(0, 6):\n    #     cowActor.RotateWXYZ(-60, 2.19574, -1.42455, -0.0331036)\n    # cowActor.SetUserMatrix(cowPos.GetMatrix())\n    # ren.GetActiveCamera().SetPosition(0, 0, 1)\n    # ren.GetActiveCamera().SetViewUp(0, 1, 0)\n    # ren.ResetCamera()\n\n\ndef Rotate_V_V(cowActor, ren, renWin):\n    # The cow rotating about a vector passing through her nose.\n    # With the origin at (6.11414, 1.27386, 0.015175).\n    ren.ResetCamera()\n    ren.ResetCameraClippingRange()\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0)\n    cowActor.SetPosition(0, 0, 0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    cowPos = vtkTransform()\n    cowPos.Identity()\n    cowPos.SetMatrix(cowActor.GetMatrix())\n    cowActor.SetOrigin(6.11414, 1.27386, 0.015175)  # The cow's nose\n    cowTransform = vtkTransform()\n    cowTransform.Identity()\n    cowActor.SetUserMatrix(cowTransform.GetMatrix())\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(31, 23, -21)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(0, 6):\n        cowActor.RotateWXYZ(60, 2.19574, -1.42455, -0.0331036)\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-33b.png', renWin)\n    renWin.EraseOn()\n    # Put the cow back on the origin.\n    # for idx in range(0, 6):\n    #     cowActor.RotateWXYZ(-60, 2.19574, -1.42455, -0.0331036)\n    # cowActor.SetUserMatrix(cowPos.GetMatrix())\n\n\ndef Walk(cowActor, ren, renWin):\n    # The cow 'walking' around the global origin\n    cowPos = vtkTransform()\n    cowPos.Identity()\n    cowPos.SetMatrix(cowActor.GetMatrix())\n    cowActor.SetOrientation(0.0, 0.0, 0.0)\n    cowActor.SetOrigin(0.0, 0.0, 0.0)\n    # Get the focal point.\n    bounds = cowActor.GetBounds()\n    fp = [0.0] * 3\n    for i in range(0, 3):\n        fp[i] = (bounds[i * 2 + 1] + bounds[i * 2]) / 2.0\n    cowTransform = vtkTransform()\n    cowTransform.Identity()\n    cowTransform.Translate(0, 0, 5)\n    cowActor.SetUserMatrix(cowTransform.GetMatrix())\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(1, 24, 16)\n    ren.GetActiveCamera().SetFocalPoint(fp)\n    ren.GetActiveCamera().SetViewUp(0, 0, -1)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    renWin.Render()\n    renWin.EraseOff()\n    for idx in range(1, 7):\n        cowTransform.Identity()\n        cowTransform.RotateY(idx * 60)\n        cowTransform.Translate(0, 0, 5)\n        cowActor.SetUserMatrix(cowTransform.GetMatrix())\n        renWin.Render()\n        renWin.Render()\n    # Screenshot('Fig3-32.png', renWin)\n    renWin.EraseOn()\n    # Walkies are over, put the cow back on the origin.\n    # cowActor.SetUserMatrix(cowPos.GetMatrix())\n\n\ndef CameraModifiedCallback(caller, ev):\n    '''\n     Used to estimate positions similar to the book illustrations.\n    :param caller:\n    :return:\n    '''\n    print(caller.GetClassName(), 'modified')\n    # Print the interesting stuff.\n    print('\\tPosition: ',\n          caller.GetPosition()[0], ', ',\n          caller.GetPosition()[1], ', ',\n          caller.GetPosition()[2])\n    print('\\tFocal point: ',\n          caller.GetFocalPoint()[0], ', ',\n          caller.GetFocalPoint()[1], ', ',\n          caller.GetFocalPoint()[2])\n\n\ndef Screenshot(fileName, renWin):\n    '''\n    Save a screenshot.\n    :param fileName:\n    :param renWin:\n    :return:\n    '''\n    windowToImageFilter = vtkWindowToImageFilter()\n    windowToImageFilter.SetInput(renWin)\n    windowToImageFilter.SetScale(1)  # image quality\n    # We are not recording the alpha (transparency) channel.\n    # windowToImageFilter.SetInputBufferTypeToRGBA()\n    windowToImageFilter.SetInputBufferTypeToRGB()\n    # Read from the front buffer.\n    windowToImageFilter.ReadFrontBufferOff()\n    windowToImageFilter.Update()\n\n    writer = vtkPNGWriter()\n    writer.SetFileName(fileName)\n    writer.SetInputConnection(windowToImageFilter.GetOutputPort())\n    writer.Write()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/WalkCowA/","title":"WalkCowA","text":"

        vtk-examples/Python/Rendering/WalkCowA

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/WalkCowA/#code","title":"Code","text":"

        WalkCowA.py

        #!/usr/bin/env python\n\n\"\"\"\nWalkCow, VTK Textbook figure 3-33a.\n\nNote: Make sure WalkCow.py is in the same directory as this program.\n\"\"\"\n\nimport WalkCow\n\n\ndef main():\n    file_name, figure = WalkCow.get_program_parameters()\n    figure = 1\n    WalkCow.walk_cow(file_name, figure)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Rendering/WalkCowB/","title":"WalkCowB","text":"

        vtk-examples/Python/Rendering/WalkCowB

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Rendering/WalkCowB/#code","title":"Code","text":"

        WalkCowB.py

        #!/usr/bin/env python\n\n\"\"\"\nWalkCow, VTK Textbook figure 3-33b.\n\nNote: Make sure WalkCow.py is in the same directory as this program.\n\"\"\"\n\nimport WalkCow\n\n\ndef main():\n    file_name, figure = WalkCow.get_program_parameters()\n    figure = 2\n    WalkCow.walk_cow(file_name, figure)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/SimpleOperations/DistanceBetweenPoints/","title":"DistanceBetweenPoints","text":"

        vtk-examples/Python/SimpleOperations/DistanceBetweenPoints

        "},{"location":"Python/SimpleOperations/DistanceBetweenPoints/#description","title":"Description","text":"

        This example finds the squared distance and the Euclidean distance between two 3D points.

        Other languages

        See (Cxx), (Java), (CSharp)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/SimpleOperations/DistanceBetweenPoints/#code","title":"Code","text":"

        DistanceBetweenPoints.py

        # !/usr/bin/env python\n\nimport math\n\nfrom vtkmodules.vtkCommonCore import vtkMath\n\n\ndef main():\n    p0 = (0, 0, 0)\n    p1 = (1, 1, 1)\n\n    distSquared = vtkMath.Distance2BetweenPoints(p0, p1)\n\n    dist = math.sqrt(distSquared)\n\n    print('p0 = ', p0)\n    print('p1 = ', p1)\n    print('distance squared = ', distSquared)\n    print('distance = ', dist)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Snippets/CameraPosition/","title":"CameraPosition","text":""},{"location":"Python/Snippets/CameraPosition/#description","title":"Description","text":"

        A callback that gives you the camera position and focal point.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Python/Snippets/CameraPosition/#implementation","title":"Implementation","text":"
        def camera_modified_callback(caller, event):\n    \"\"\"\n     Used to estimate positions similar to the book illustrations.\n    :param caller:\n    :param event:\n    :return:\n    \"\"\"\n    print(caller.GetClassName(), \"modified\")\n    # Print the interesting stuff.\n    res = f'\\tcamera = renderer.GetActiveCamera()\\n'\n    res += f'\\tcamera.SetPosition({\", \".join(map(\"{0:0.6f}\".format, caller.GetPosition()))})\\n'\n    res += f'\\tcamera.SetFocalPoint({\", \".join(map(\"{0:0.6f}\".format, caller.GetFocalPoint()))})\\n'\n    res += f'\\tcamera.SetViewUp({\", \".join(map(\"{0:0.6f}\".format, caller.GetViewUp()))})\\n'\n    res += f'\\tcamera.SetDistance({\"{0:0.6f}\".format(caller.GetDistance())})\\n'\n    res += f'\\tcamera.SetClippingRange({\", \".join(map(\"{0:0.6f}\".format, caller.GetClippingRange()))})\\n'\n    print(res)\n
        "},{"location":"Python/Snippets/CameraPosition/#usage","title":"Usage","text":"
            renWin.Render()\n    ren.GetActiveCamera().AddObserver('ModifiedEvent', camera_modified_callback)\n

        Once you have the output, replace the ren.GetActiveCamera().AddObserver... line with the output data.

        "},{"location":"Python/Snippets/CheckVTKVersion/","title":"CheckVTKVersion","text":""},{"location":"Python/Snippets/CheckVTKVersion/#description","title":"Description","text":"

        This enables us to check the VTK version and provide alternatives for different VTK versions.

        True is returned if the requested VTK version is >= the current version.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Python/Snippets/CheckVTKVersion/#implementation","title":"Implementation","text":"
        from vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major)\\\n                     + 100000000 * int(minor)\\\n                     + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:\n        # Expand component-wise comparisons for VTK versions < 8.90.\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion()\\\n                             + 100000000 * ver.GetVTKMinorVersion()\\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n
        "},{"location":"Python/Snippets/CheckVTKVersion/#typical-usage","title":"Typical usage","text":"
            if vtk_version_ok(*ver):\n        try:\n            print('Our newest version of the code.')\n        except AttributeError:\n            pass\n    else:\n        print('This is code for older versions of VTK.')\n    print('Rest of the code.')\n

        See:

        • PBR_Skybox for a typical usage example. Here we are deciding to use vtkCameraOrientationWidget instead of vtkOrientationMarkerWidget if the VTK version is >= 9.0.20210718.
        • CheckVTKVersion for a test/example.
        "},{"location":"Python/Snippets/GetProgramParameters/","title":"GetProgramParameters","text":""},{"location":"Python/Snippets/GetProgramParameters/#description","title":"Description","text":"

        Get the program parameters.

        This particular snippet requires a file name and an optional figure number.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Python/Snippets/GetProgramParameters/#implementation","title":"Implementation","text":"
        def get_program_parameters():\n    import argparse\n    description = 'What the program does.'\n    epilogue = '''\n        An expanded description of what the program does.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='A required filename.')\n    parser.add_argument('figure', default=0, type=int, nargs='?', help='An optional figure number.')\n    args = parser.parse_args()\n    return args.filename, args.figure\n
        "},{"location":"Python/Snippets/GetProgramParameters/#typical-usage","title":"Typical usage","text":"
        file_name, figure = get_program_parameters()\n
        "},{"location":"Python/Snippets/PointToGlyph/","title":"PointToGlyph","text":""},{"location":"Python/Snippets/PointToGlyph/#description","title":"Description","text":"

        Represent points as glyphs. The point is represented as a sphere.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Python/Snippets/PointToGlyph/#implementation","title":"Implementation","text":"
        # from vtkmodules.vtkCommonDataModel import vtkPolyData\n# from vtkmodules.vtkFiltersSources import vtkSphereSource\n# from vtkmodules.vtkRenderingCore import (\n#     vtkActor,\n#     vtkGlyph3DMapper\n# )\n\n\ndef point_to_glyph(points, scale):\n    \"\"\"\n    Convert points to glyphs.\n    :param points: The points to glyph.\n    :param scale: The scale, used to determine the size of the\n                  glyph representing the point, expressed as a\n                  fraction of the largest side of the bounding\n                  box surrounding the points. e.g. 0.05\n    :return: The actor.\n    \"\"\"\n\n    bounds = points.GetBounds()\n    max_len = 0.0\n    for i in range(0, 3):\n        max_len = max(bounds[i + 1] - bounds[i], max_len)\n\n    sphere_source = vtkSphereSource()\n    sphere_source.SetRadius(scale * max_len)\n\n    pd = vtkPolyData()\n    pd.SetPoints(points)\n\n    mapper = vtkGlyph3DMapper()\n    mapper.SetInputData(pd)\n    mapper.SetSourceConnection(sphere_source.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n    mapper.ScalingOff()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    return actor\n
        "},{"location":"Python/Snippets/PointToGlyph/#usage","title":"Usage","text":"
            # Map the points to spheres\n    sphereActor = point_to_glyph(someFilter.GetOutput().GetPoints(), 0.05)\n    # Set the actor color here\n
        "},{"location":"Python/Snippets/ReadPolyData/","title":"ReadPolyData","text":""},{"location":"Python/Snippets/ReadPolyData/#description","title":"Description","text":"

        Given a filename, uses the appropriate vtkPolyData reader to read any vtkPolyData file.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Python/Snippets/ReadPolyData/#implementation","title":"Implementation","text":"
        # from pathlib import Path\n\n# from vtkmodules.vtkIOGeometry import (\n#     vtkBYUReader,\n#     vtkOBJReader,\n#     vtkSTLReader\n# )\n# from vtkmodules.vtkIOLegacy import vtkPolyDataReader\n# from vtkmodules.vtkIOPLY import vtkPLYReader\n# from vtkmodules.vtkIOXML import vtkXMLPolyDataReader\n\n\ndef ReadPolyData(file_name):\n    valid_suffixes = ['.g', '.obj', '.stl', '.ply', '.vtk', '.vtp']\n    path = Path(file_name)\n    if path.suffix:\n        ext = path.suffix.lower()\n    if path.suffix not in valid_suffixes:\n        print(f'No reader for this file suffix: {ext}')\n        return None\n    else:\n        if ext == \".ply\":\n            reader = vtkPLYReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n        elif ext == \".vtp\":\n            reader = vtkXMLPolyDataReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n        elif ext == \".obj\":\n            reader = vtkOBJReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n        elif ext == \".stl\":\n            reader = vtkSTLReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n        elif ext == \".vtk\":\n            reader = vtkPolyDataReader()\n            reader.SetFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n        elif ext == \".g\":\n            reader = vtkBYUReader()\n            reader.SetGeometryFileName(file_name)\n            reader.Update()\n            poly_data = reader.GetOutput()\n\n        return poly_data\n
        "},{"location":"Python/Snippets/WriteImage/","title":"WriteImage","text":""},{"location":"Python/Snippets/WriteImage/#description","title":"Description","text":"

        Given a filename, render window and optionally a rgba value, take a screenshot of the render window and write it to a file. The extension of the filename determines what writer to use.

        To use the snippet, click the Copy to clipboard at the upper right of the code blocks.

        "},{"location":"Python/Snippets/WriteImage/#implementation","title":"Implementation","text":"
        # from pathlib import Path\n# \n# from vtkmodules.vtkIOImage import (\n#     vtkBMPWriter,\n#     vtkJPEGWriter,\n#     vtkPNGWriter,\n#     vtkPNMWriter,\n#     vtkPostScriptWriter,\n#     vtkTIFFWriter\n# )\n# from vtkmodules.vtkRenderingCore import vtkWindowToImageFilter\n\n\ndef write_image(file_name, ren_win, rgba=True):\n    \"\"\"\n    Write the render window view to an image file.\n\n    Image types supported are:\n     BMP, JPEG, PNM, PNG, PostScript, TIFF.\n    The default parameters are used for all writers, change as needed.\n\n    :param file_name: The file name, if no extension then PNG is assumed.\n    :param ren_win: The render window.\n    :param rgba: Used to set the buffer type.\n    :return:\n    \"\"\"\n\n    if file_name:\n        valid_suffixes = ['.bmp', '.jpg', '.png', '.pnm', '.ps', '.tiff']\n        # Select the writer to use.\n        parent = Path(file_name).resolve().parent\n        path = Path(parent) / file_name\n        if path.suffix:\n            ext = path.suffix.lower()\n        else:\n            ext = '.png'\n            path = Path(str(path)).with_suffix(ext)\n        if path.suffix not in valid_suffixes:\n            print(f'No writer for this file suffix: {ext}')\n            return\n        if ext == '.bmp':\n            writer = vtkBMPWriter()\n        elif ext == '.jpg':\n            writer = vtkJPEGWriter()\n        elif ext == '.pnm':\n            writer = vtkPNMWriter()\n        elif ext == '.ps':\n            if rgba:\n                rgba = False\n            writer = vtkPostScriptWriter()\n        elif ext == '.tiff':\n            writer = vtkTIFFWriter()\n        else:\n            writer = vtkPNGWriter()\n\n        windowto_image_filter = vtkWindowToImageFilter()\n        windowto_image_filter.SetInput(ren_win)\n        windowto_image_filter.SetScale(1)  # image quality\n        if rgba:\n            windowto_image_filter.SetInputBufferTypeToRGBA()\n        else:\n            windowto_image_filter.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            windowto_image_filter.ReadFrontBufferOff()\n            windowto_image_filter.Update()\n\n        writer.SetFileName(path)\n        writer.SetInputConnection(windowto_image_filter.GetOutputPort())\n        writer.Write()\n    else:\n        raise RuntimeError('Need a filename.')\n
        "},{"location":"Python/Snippets/WriteImage/#usage","title":"Usage","text":"
          write_image(file_name, ren_win, rgba=False)\n
        "},{"location":"Python/StructuredGrid/BlankPoint/","title":"BlankPoint","text":"

        vtk-examples/Python/StructuredGrid/BlankPoint

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/StructuredGrid/BlankPoint/#code","title":"Code","text":"

        BlankPoint.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkStructuredGrid\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    points = vtkPoints()\n\n    grid_size = 8\n    counter = 0\n    pt_idx = 0\n    # Create a 5x5 grid of points\n    for j in range(0, grid_size):\n        for i in range(0, grid_size):\n            if i == 3 and j == 3:  # Make one point higher than the rest.\n                points.InsertNextPoint(i, j, 2)\n                print(f'The different point is number {counter}.')\n                pt_idx = counter\n            else:\n                # Make most of the points the same height.\n                points.InsertNextPoint(i, j, 0)\n            counter += 1\n\n    structured_grid = vtkStructuredGrid()\n    # Specify the dimensions of the grid, set the points and blank one point.\n    structured_grid.SetDimensions(grid_size, grid_size, 1)\n    structured_grid.SetPoints(points)\n    structured_grid.BlankPoint(pt_idx)\n\n    # Check.\n    def is_visible(pt_num):\n        if structured_grid.IsPointVisible(pt_num):\n            return f'Point {pt_num:2d} is visible.'\n        else:\n            return f'Point {pt_num:2d} is not visible.'\n\n    # Should not be visible.\n    print(is_visible(pt_idx))\n    # Should be visible.\n    print(is_visible(7))\n\n    # We need the geometry filter to ensure that the\n    # blanked point and surrounding faces is missing.\n    geometry_filter = vtkStructuredGridGeometryFilter()\n    geometry_filter.SetInputData(structured_grid)\n\n    # Create a mapper and actor.\n    grid_mapper = vtkDataSetMapper()\n    grid_mapper.SetInputConnection(geometry_filter.GetOutputPort())\n\n    grid_actor = vtkActor()\n    grid_actor.SetMapper(grid_mapper)\n    grid_actor.GetProperty().EdgeVisibilityOn()\n    grid_actor.GetProperty().SetEdgeColor(colors.GetColor3d('Blue'))\n\n    # Visualize\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    renderer.AddActor(grid_actor)\n    renderer.SetBackground(colors.GetColor3d('ForestGreen'))\n\n    # ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('BlankPoint')\n    ren_win.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/StructuredGrid/SGrid/","title":"SGrid","text":"

        vtk-examples/Python/StructuredGrid/SGrid

        "},{"location":"Python/StructuredGrid/SGrid/#description","title":"Description","text":"

        Creating a structured grid dataset of a semicylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction.

        Info

        See Figure 5-19 in Chapter 5 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/StructuredGrid/SGrid/#code","title":"Code","text":"

        SGrid.py

        #!/usr/bin/env python\n\n'''\nThis example shows how to manually create a structured grid.\nThe basic idea is to instantiate vtkStructuredGrid, set its dimensions,\n and then assign points defining the grid coordinate. The number of\n points must equal the number of points implicit in the dimensions\n (i.e., dimX*dimY*dimZ). Also, data attributes (either point or cell)\n can be added to the dataset.\n'''\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkMath,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkStructuredGrid\nfrom vtkmodules.vtkFiltersCore import vtkHedgeHog\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    rMin = 0.5\n    rMax = 1.0\n    dims = [13, 11, 11]\n\n    # Create the structured grid.\n    sgrid = vtkStructuredGrid()\n    sgrid.SetDimensions(dims)\n\n    # We also create the points and vectors. The points\n    # form a hemi-cylinder of data.\n    vectors = vtkDoubleArray()\n    vectors.SetNumberOfComponents(3)\n    vectors.SetNumberOfTuples(dims[0] * dims[1] * dims[2])\n    points = vtkPoints()\n    points.Allocate(dims[0] * dims[1] * dims[2])\n\n    deltaZ = 2.0 / (dims[2] - 1)\n    deltaRad = (rMax - rMin) / (dims[1] - 1)\n    x = [0.0] * 3\n    v = [0.0] * 3\n    for k in range(0, dims[2]):\n        x[2] = -1.0 + k * deltaZ\n        kOffset = k * dims[0] * dims[1]\n        for j in range(0, dims[1]):\n            radius = rMin + j * deltaRad\n            jOffset = j * dims[0]\n            for i in range(0, dims[0]):\n                theta = i * vtkMath.RadiansFromDegrees(15.0)\n                x[0] = radius * math.cos(theta)\n                x[1] = radius * math.sin(theta)\n                v[0] = -x[1]\n                v[1] = x[0]\n                offset = i + jOffset + kOffset\n                points.InsertPoint(offset, x)\n                vectors.InsertTuple(offset, v)\n    sgrid.SetPoints(points)\n    sgrid.GetPointData().SetVectors(vectors)\n\n    # We create a simple pipeline to display the data.\n    hedgehog = vtkHedgeHog()\n    hedgehog.SetInputData(sgrid)\n    hedgehog.SetScaleFactor(0.1)\n\n    sgridMapper = vtkPolyDataMapper()\n    sgridMapper.SetInputConnection(hedgehog.GetOutputPort())\n    sgridActor = vtkActor()\n    sgridActor.SetMapper(sgridMapper)\n    sgridActor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    # Create the usual rendering stuff\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    renWin.SetWindowName('SGrid')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    renderer.AddActor(sgridActor)\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(60.0)\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.GetActiveCamera().Dolly(1.0)\n    renWin.SetSize(640, 480)\n\n    # Interact with the data.\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/StructuredPoints/Vol/","title":"Vol","text":"

        vtk-examples/Python/StructuredPoints/Vol

        "},{"location":"Python/StructuredPoints/Vol/#description","title":"Description","text":"

        Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26^3.

        Info

        See Figure 5-18 in Chapter 5 the VTK Textbook.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/StructuredPoints/Vol/#code","title":"Code","text":"

        Vol.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkStructuredPoints\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    vol = vtkStructuredPoints()\n    vol.SetDimensions(26, 26, 26)\n    vol.SetOrigin(-0.5, -0.5, -0.5)\n    sp = 1.0 / 25.0\n    vol.SetSpacing(sp, sp, sp)\n\n    scalars = vtkDoubleArray()\n    scalars.SetNumberOfComponents(1)\n    scalars.SetNumberOfTuples(26 * 26 * 26)\n    for k in range(0, 26):\n        z = -0.5 + k * sp\n        kOffset = k * 26 * 26\n        for j in range(0, 26):\n            y = -0.5 + j * sp\n            jOffset = j * 26\n            for i in range(0, 26):\n                x = -0.5 + i * sp\n                s = x * x + y * y + z * z - (0.4 * 0.4)\n                offset = i + jOffset + kOffset\n                scalars.InsertTuple1(offset, s)\n    vol.GetPointData().SetScalars(scalars)\n\n    contour = vtkContourFilter()\n    contour.SetInputData(vol)\n    contour.SetValue(0, 0.0)\n\n    volMapper = vtkPolyDataMapper()\n    volMapper.SetInputConnection(contour.GetOutputPort())\n    volMapper.ScalarVisibilityOff()\n    volActor = vtkActor()\n    volActor.SetMapper(volMapper)\n    volActor.GetProperty().EdgeVisibilityOn()\n    volActor.GetProperty().SetColor(colors.GetColor3d('Salmon'))\n    renderer.AddActor(volActor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('Vol')\n\n    # Interact with the data.\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Texture/AnimateVectors/","title":"AnimateVectors","text":"

        vtk-examples/Python/Texture/AnimateVectors

        "},{"location":"Python/Texture/AnimateVectors/#description","title":"Description","text":"

        Texture maps can be animated as a function of time. By choosing a texture map whose intensity varies monotonically from dark to light, and then \u201cmoving\u201d the texture along an object,the object appears to crawl in the direction of the texture map motion. We can use this technique to add apparent motion to things like hedgehogs to show vector magnitude. This example uses texture map animation to simulate vector field motion.

        Cite

        See B. Yamrom and K. M. Martin. Vector Field Animation with Texture Maps. IEEE Computer Graphics and Applications. 15(2):22\u201324, 1995 for background.

        Info

        See Figure 7-3 in Chapter 7 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Texture/AnimateVectors/#code","title":"Code","text":"

        AnimateVectors.py

        #!/usr/bin/env python\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkGlyph3D,\n    vtkThresholdPoints\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    vec_anim_paths = [''] * 2\n    fn1, fn2 = get_program_parameters()\n    vec_anim_paths[0] = Path(fn1)\n    vec_anim_paths[1] = Path(fn2)\n\n    # Generate the other vecAnim file names. There are 8 of them.\n    tmp = str(vec_anim_paths[1])\n    old_stem = vec_anim_paths[1].stem\n    for i in range(2, 9):\n        new_stem = old_stem[:-1] + str(i)\n        vec_anim_paths.append(Path(tmp.replace(old_stem, new_stem)))\n\n    colors = vtkNamedColors()\n\n    # Setup the render window, renderer, and interactor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Read the data.\n\n    # Create the pipeline.\n\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(vec_anim_paths[0])\n\n    threshold = vtkThresholdPoints()\n    threshold.SetInputConnection(reader.GetOutputPort())\n    threshold.ThresholdByUpper(200)\n\n    line = vtkLineSource()\n    line.SetResolution(1)\n\n    lines = vtkGlyph3D()\n    lines.SetInputConnection(threshold.GetOutputPort())\n    lines.SetSourceConnection(line.GetOutputPort())\n    lines.SetScaleFactor(0.005)\n    lines.SetScaleModeToScaleByScalar()\n    lines.Update()\n\n    vectorMapper = vtkPolyDataMapper()\n    vectorMapper.SetInputConnection(lines.GetOutputPort())\n    vectorMapper.SetScalarRange(lines.GetOutput().GetScalarRange())\n\n    vectorActor = vtkActor()\n    vectorActor.SetMapper(vectorMapper)\n    vectorActor.GetProperty().SetOpacity(0.99)\n    vectorActor.GetProperty().SetLineWidth(1.5)\n\n    # Outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    #  Texture maps.\n    textureMaps = list()\n    for i in range(2, len(vec_anim_paths)):\n        tmap = vtkStructuredPointsReader()\n        tmap.SetFileName(vec_anim_paths[i])\n\n        texture = vtkTexture()\n        texture.SetInputConnection(tmap.GetOutputPort())\n        texture.InterpolateOff()\n        texture.RepeatOff()\n        textureMaps.append(texture)\n\n    vectorActor.SetTexture(textureMaps[0])\n\n    # Add the actors to the renderer, set the background and size.\n\n    renderer.AddActor(vectorActor)\n    renderer.AddActor(outlineActor)\n\n    cam1 = vtkCamera()\n    cam1.SetClippingRange(17.4043, 870.216)\n    cam1.SetFocalPoint(136.71, 104.025, 23)\n    cam1.SetPosition(204.747, 258.939, 63.7925)\n    cam1.SetViewUp(-0.102647, -0.210897, 0.972104)\n    cam1.Zoom(1.2)\n    renderer.SetActiveCamera(cam1)\n\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('AnimateVectors')\n\n    # Go into a loop.\n    for j in range(0, 100):\n        for i in range(0, len(textureMaps)):\n            vectorActor.SetTexture(textureMaps[i])\n            renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Texture maps can be animated as a function of time.'\n    epilogue = '''\n    This example uses texture map animation to simulate vector field motion.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='carotid.')\n    parser.add_argument('filename2', help='VectorAnimation/vecAnim1.vtk.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Texture/TextureCutQuadric/","title":"TextureCutQuadric","text":"

        vtk-examples/Python/Texture/TextureCutQuadric

        "},{"location":"Python/Texture/TextureCutQuadric/#description","title":"Description","text":"

        Clip geometry using a 2D texture map and two implicit functions. The technique is described in : Geometric Clipping Using Boolean Textures.

        Info

        See Figure 9-45b in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Texture/TextureCutQuadric/#code","title":"Code","text":"

        TextureCutQuadric.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkFiltersTexture import vtkImplicitTextureCoords\nfrom vtkmodules.vtkImagingHybrid import vtkBooleanTexture\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\npositions = [\n    [-4, 4, 0], [-2, 4, 0], [0, 4, 0], [2, 4, 0],\n    [-4, 2, 0], [-2, 2, 0], [0, 2, 0], [2, 2, 0],\n    [-4, 0, 0], [-2, 0, 0], [0, 0, 0], [2, 0, 0],\n    [-4, -2, 0], [-2, -2, 0], [0, -2, 0], [2, -2, 0]\n]\n\nsolid = [255, 255]\nclear = [255, 0]\nedge = [0, 255]\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renWin = vtkRenderWindow()\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    aren = vtkRenderer()\n\n    # define two elliptical cylinders\n    quadric1 = vtkQuadric()\n    quadric1.SetCoefficients(1, 2, 0, 0, 0, 0, 0, 0, 0, -.07)\n\n    quadric2 = vtkQuadric()\n    quadric2.SetCoefficients(2, 1, 0, 0, 0, 0, 0, 0, 0, -.07)\n\n    # Create a sphere for all to use.\n    aSphere = vtkSphereSource()\n    aSphere.SetPhiResolution(21)\n    aSphere.SetThetaResolution(21)\n\n    # Create texture coordinates for all.\n    tcoords = vtkImplicitTextureCoords()\n    tcoords.SetInputConnection(aSphere.GetOutputPort())\n    tcoords.SetRFunction(quadric1)\n    tcoords.SetSFunction(quadric2)\n\n    aMapper = vtkDataSetMapper()\n    aMapper.SetInputConnection(tcoords.GetOutputPort())\n\n    # Create a mapper, sphere and texture map for each case.\n    for i in range(0, 16):\n        aBoolean = MakeBooleanTexture(i, 64, 0)\n\n        aTexture2 = vtkTexture()\n        aTexture2.SetInputConnection(aBoolean.GetOutputPort())\n        aTexture2.InterpolateOff()\n        aTexture2.RepeatOff()\n\n        anActor2 = vtkActor()\n\n        anActor2.SetMapper(aMapper)\n        anActor2.SetTexture(aTexture2)\n        anActor2.SetPosition(positions[i])\n        anActor2.SetScale(2.0, 2.0, 2.0)\n        anActor2.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n        aren.AddActor(anActor2)\n\n    aren.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(500, 500)\n    renWin.AddRenderer(aren)\n    renWin.SetWindowName('TextureCutQuadric')\n\n    # Interact with the data.\n    renWin.Render()\n\n    iren.Start()\n\n\ndef MakeBooleanTexture(caseNumber, resolution, thickness):\n    booleanTexture = vtkBooleanTexture()\n\n    booleanTexture.SetXSize(resolution)\n    booleanTexture.SetYSize(resolution)\n    booleanTexture.SetThickness(thickness)\n\n    if caseNumber == 0:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(solid)\n        booleanTexture.SetOnIn(solid)\n        booleanTexture.SetOnOut(solid)\n        booleanTexture.SetInOn(solid)\n        booleanTexture.SetOutOn(solid)\n    elif caseNumber == 1:  # cut inside 1\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(solid)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(solid)\n    elif caseNumber == 2:  # cut outside 1\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(solid)\n        booleanTexture.SetInOn(solid)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 3:  # cut all 1\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(clear)\n        booleanTexture.SetOnOut(solid)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 4:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(solid)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(solid)\n    elif caseNumber == 5:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(clear)\n        booleanTexture.SetOutOn(solid)\n    elif caseNumber == 6:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 7:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutOut(solid)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(clear)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(clear)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 8:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(solid)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(solid)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 9:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 10:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(solid)\n        booleanTexture.SetOutOn(clear)\n    elif caseNumber == 11:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetInOut(solid)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(clear)\n        booleanTexture.SetOnOut(edge)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(clear)\n    elif caseNumber == 12:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(solid)\n        booleanTexture.SetOnOut(clear)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 13:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutIn(solid)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(clear)\n        booleanTexture.SetInOn(clear)\n        booleanTexture.SetOutOn(edge)\n    elif caseNumber == 14:\n        booleanTexture.SetInIn(solid)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(edge)\n        booleanTexture.SetOnIn(edge)\n        booleanTexture.SetOnOut(clear)\n        booleanTexture.SetInOn(edge)\n        booleanTexture.SetOutOn(clear)\n    else:  # caseNumber ==  15:\n        booleanTexture.SetInIn(clear)\n        booleanTexture.SetInOut(clear)\n        booleanTexture.SetOutIn(clear)\n        booleanTexture.SetOutOut(clear)\n        booleanTexture.SetOnOn(clear)\n        booleanTexture.SetOnIn(clear)\n        booleanTexture.SetOnOut(clear)\n        booleanTexture.SetInOn(clear)\n        booleanTexture.SetOutOn(clear)\n\n    return booleanTexture\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Texture/TextureCutSphere/","title":"TextureCutSphere","text":"

        vtk-examples/Python/Texture/TextureCutSphere

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Texture/TextureCutSphere/#code","title":"Code","text":"

        TextureCutSphere.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPlanes\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkFiltersTexture import vtkImplicitTextureCoords\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # hidden sphere\n    sphere1 = vtkSphereSource()\n    sphere1.SetRadius(0.5)\n\n    innerMapper = vtkPolyDataMapper()\n    innerMapper.SetInputConnection(sphere1.GetOutputPort())\n\n    innerSphere = vtkActor()\n    innerSphere.SetMapper(innerMapper)\n    innerSphere.GetProperty().SetColor(colors.GetColor3d('BlanchedAlmond'))\n\n    # sphere to texture\n    sphere2 = vtkSphereSource()\n    sphere2.SetRadius(1.0)\n    sphere2.SetPhiResolution(21)\n    sphere2.SetThetaResolution(21)\n\n    pts = [0.0] * 6\n    points = vtkPoints()\n    points.SetNumberOfPoints(2)\n    points.SetPoint(0, pts[:3])\n    points.SetPoint(1, pts[3:])\n\n    nrms = [0.0] * 6\n    nrms[0] = 1.0\n    nrms[4] = 1.0\n    normals = vtkDoubleArray()\n    normals.SetNumberOfComponents(3)\n    normals.SetNumberOfTuples(2)\n    normals.SetTuple(0, nrms[:3])\n    normals.SetTuple(1, nrms[3:])\n\n    planes = vtkPlanes()\n    planes.SetPoints(points)\n    planes.SetNormals(normals)\n\n    tcoords = vtkImplicitTextureCoords()\n    tcoords.SetInputConnection(sphere2.GetOutputPort())\n    tcoords.SetRFunction(planes)\n\n    outerMapper = vtkDataSetMapper()\n    outerMapper.SetInputConnection(tcoords.GetOutputPort())\n\n    tmap = vtkStructuredPointsReader()\n    tmap.SetFileName(fileName)\n\n    texture = vtkTexture()\n    texture.SetInputConnection(tmap.GetOutputPort())\n    texture.InterpolateOff()\n    texture.RepeatOff()\n\n    outerSphere = vtkActor()\n    outerSphere.SetMapper(outerMapper)\n    outerSphere.SetTexture(texture)\n    outerSphere.GetProperty().SetColor(colors.GetColor3d('LightSalmon'))\n\n    renWin = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    aren = vtkRenderer()\n    iren.SetRenderWindow(renWin)\n    renWin.AddRenderer(aren)\n\n    aren.AddActor(innerSphere)\n    aren.AddActor(outerSphere)\n    aren.SetBackground(colors.GetColor3d('SlateGray'))\n    aren.GetActiveCamera().Azimuth(-30)\n    aren.GetActiveCamera().Elevation(-30)\n    aren.ResetCamera()\n\n    renWin.SetSize(500, 500)\n    renWin.SetWindowName('TextureCutSphere')\n\n    # interact with data\n    renWin.Render()\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Cut an outer sphere to reveal an inner sphere.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='texThres.vtk.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Texture/TexturePlane/","title":"TexturePlane","text":"

        vtk-examples/Python/Texture/TexturePlane

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Texture/TexturePlane/#code","title":"Code","text":"

        TexturePlane.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOImage import vtkImageReader2Factory\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Load in the texture map. A texture is any unsigned char image. If it\n    # is not of this type, you will have to map it through a lookup table\n    # or by using vtkImageShiftScale.\n    #\n    readerFactory = vtkImageReader2Factory()\n    textureFile = readerFactory.CreateImageReader2(fileName)\n    textureFile.SetFileName(fileName)\n    textureFile.Update()\n\n    atext = vtkTexture()\n    atext.SetInputConnection(textureFile.GetOutputPort())\n    atext.InterpolateOn()\n\n    # Create a plane source and actor. The vtkPlanesSource generates\n    # texture coordinates.\n    #\n    plane = vtkPlaneSource()\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputConnection(plane.GetOutputPort())\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n    planeActor.SetTexture(atext)\n\n    # Create the RenderWindow, Renderer and Interactor.\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    renderer.AddActor(planeActor)\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('TexturePlane')\n\n    # render the image\n    renWin.Render()\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(-30)\n    renderer.GetActiveCamera().Roll(-20)\n    renderer.ResetCameraClippingRange()\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'How to do basic texture mapping.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='masonry.bmp.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Texture/TextureThreshold/","title":"TextureThreshold","text":"

        vtk-examples/Python/Texture/TextureThreshold

        "},{"location":"Python/Texture/TextureThreshold/#description","title":"Description","text":"

        Demonstrating texture thresholding applied to scalar data from a simulation of fluid flow.

        There are three planes cutting the blunt fin with different thresholds set. From the left, the scalar threshold is set so that:

        1. Only data with a scalar value greater than or equal to 1.5 is shown.
        2. Only data with a scalar value less than or equal to 1.5 is shown.
        3. Only data with a scalar value between 1.5 and 1.8 inclusive is shown.

        Info

        See Figure 9-43a in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Texture/TextureThreshold/#code","title":"Code","text":"

        TextureThreshold.py

        #!/usr/bin/env python\n\n# Modified from VTK/Filters/Texture/Testing/Python/textureThreshold.py.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersTexture import vtkThresholdTextureCoords\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    dataFn1, dataFn2, textureFn = get_program_parameters()\n    colors = vtkNamedColors()\n\n    # Read the data.\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(dataFn1)\n    pl3d.SetQFileName(dataFn2)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n    output = pl3d.GetOutput().GetBlock(0)\n\n    # Make the wall (floor).\n    wall = vtkStructuredGridGeometryFilter()\n    wall.SetInputData(output)\n    wall.SetExtent(0, 100, 0, 0, 0, 100)\n    wallMap = vtkPolyDataMapper()\n    wallMap.SetInputConnection(wall.GetOutputPort())\n    wallMap.ScalarVisibilityOff()\n    wallActor = vtkActor()\n    wallActor.SetMapper(wallMap)\n    wallActor.GetProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # Make the fin (rear wall)\n    fin = vtkStructuredGridGeometryFilter()\n    fin.SetInputData(output)\n    fin.SetExtent(0, 100, 0, 100, 0, 0)\n    finMap = vtkPolyDataMapper()\n    finMap.SetInputConnection(fin.GetOutputPort())\n    finMap.ScalarVisibilityOff()\n    finActor = vtkActor()\n    finActor.SetMapper(finMap)\n    finActor.GetProperty().SetColor(colors.GetColor3d('DarkSlateGray'))\n\n    # Get the texture.\n    tmap = vtkStructuredPointsReader()\n    tmap.SetFileName(textureFn)\n    texture = vtkTexture()\n    texture.SetInputConnection(tmap.GetOutputPort())\n    texture.InterpolateOff()\n    texture.RepeatOff()\n\n    # Create the rendering window, renderer, and interactive renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Make the planes to threshold and texture.\n    plane = list()\n    thresh = list()\n    planeMap = list()\n    planeActor = list()\n    # Define the extents of planes that we will use.\n    planeExtents = [[10, 10, 0, 100, 0, 100],\n                    [30, 30, 0, 100, 0, 100],\n                    [35, 35, 0, 100, 0, 100]]\n    # Now set up the pipeline.\n    for i in range(0, len(planeExtents)):\n        plane.append(vtkStructuredGridGeometryFilter())\n        plane[i].SetInputData(output)\n        plane[i].SetExtent(*planeExtents[i])\n        thresh.append(vtkThresholdTextureCoords())\n        thresh[i].SetInputConnection(plane[i].GetOutputPort())\n        thresh[i].SetInputConnection(plane[i].GetOutputPort())\n        # If you want an image similar to Fig 9-43(a) in the VTK textbook,\n        # set thresh[i].ThresholdByUpper(1.5) for all planes.\n        if i == 1:\n            thresh[i].ThresholdByLower(1.5)\n        elif i == 2:\n            thresh[i].ThresholdBetween(1.5, 1.8)\n        else:\n            thresh[i].ThresholdByUpper(1.5)\n        planeMap.append(vtkDataSetMapper())\n        planeMap[i].SetInputConnection(thresh[i].GetOutputPort())\n        planeMap[i].SetScalarRange(output.GetScalarRange())\n        planeActor.append(vtkActor())\n        planeActor[i].SetMapper(planeMap[i])\n        planeActor[i].SetTexture(texture)\n        #  The slight transparency gives a nice effect.\n        planeActor[i].GetProperty().SetOpacity(0.999)\n        ren.AddActor(planeActor[i])\n\n    # Get an outline of the data set for context.\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(output)\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineProp = outlineActor.GetProperty()\n    outlineProp.SetColor(colors.GetColor3d('Black'))\n\n    # Add the remaining actors to the renderer, set the background and size.\n    ren.AddActor(outlineActor)\n    ren.AddActor(wallActor)\n    ren.AddActor(finActor)\n    ren.SetBackground(colors.GetColor3d('MistyRose'))\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('TextureThreshold')\n\n    cam = vtkCamera()\n    cam.SetClippingRange(1.51176, 75.5879)\n    cam.SetFocalPoint(2.33749, 2.96739, 3.61023)\n    cam.SetPosition(10.8787, 5.27346, 15.8687)\n    cam.SetViewAngle(30)\n    cam.SetViewUp(-0.0610856, 0.987798, -0.143262)\n    ren.SetActiveCamera(cam)\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrating texture thresholding applied to scalar data from a simulation of fluid flow.'\n    epilogue = '''\n    There are three planes cutting the blunt fin with different thresholds set. \n     From the left, the scalar threshold is set so that:\n       1) Only data with a scalar value greater than or equal to 1.5 is shown.\n       2) Only data with a scalar value less than or equal to 1.5 is shown.\n       3) Only data with a scalar value between 1.5 and 1.8 inclusive is shown.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('dataFn1', help='bluntfinxyz.bin.')\n    parser.add_argument('dataFn2', help='bluntfinq.bin.')\n    parser.add_argument('textureFn', help='texThres2.bmp')\n    args = parser.parse_args()\n    return args.dataFn1, args.dataFn2, args.textureFn\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Tutorial/Tutorial_Step1/","title":"Tutorial Step1","text":"

        vtk-examples/Python/Tutorial/Tutorial_Step1

        "},{"location":"Python/Tutorial/Tutorial_Step1/#description","title":"Description","text":"

        This example creates a polygonal model of a cone, and then renders it to the screen. It will rotate the cone 360 degrees and then exit. The basic setup of source -> mapper -> actor -> renderer -> renderwindow is typical of most VTK programs.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Tutorial/Tutorial_Step1/#code","title":"Code","text":"

        Tutorial_Step1.py

        #!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    #\n    # Next we create an instance of vtkNamedColors and we will use\n    # this to select colors for the object and background.\n    #\n    colors = vtkNamedColors()\n\n    #\n    # Now we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource \"cone\" is part of a\n    # visualization pipeline (it is a source process object) it produces data\n    # (output type is vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the cone. The actor orchestrates rendering\n    # of the mapper's graphics primitives. An actor also refers to properties\n    # via a vtkProperty instance, and includes an internal transformation\n    # matrix. We set this actor's mapper to be coneMapper which we created\n    # above.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    #\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is\n    # responsible for drawing the actors it has.  We also set the background\n    # color here.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    # Finally we create the render window which will show up on the screen.\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('Tutorial_Step1')\n\n    #\n    # Now we loop over 360 degrees and render the cone each time.\n    #\n    for i in range(0, 360):\n        # Render the image\n        renWin.Render()\n        # Rotate the active camera by one degree.\n        ren1.GetActiveCamera().Azimuth(1)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Tutorial/Tutorial_Step2/","title":"Tutorial Step2","text":"

        vtk-examples/Python/Tutorial/Tutorial_Step2

        "},{"location":"Python/Tutorial/Tutorial_Step2/#description","title":"Description","text":"

        This example shows how to add an observer to a Python program. It extends the Tutorial_Step1 example (see that example for information on the basic setup).

        VTK uses a command/observer design pattern. That is, observers watch for particular events that any vtkObject (or subclass) may invoke on itself. For example, the vtkRenderer invokes a \"StartEvent\" as it begins to render. Here we add an observer that invokes a command when this event is observed.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Tutorial/Tutorial_Step2/#code","title":"Code","text":"

        Tutorial_Step2.py

        #!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    #\n    # The pipeline creation is documented in Tutorial_Step1.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('MidnightBlue'))\n    ren1.ResetCamera()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('Tutorial_Step2')\n\n    # Here is where we setup the observer.\n    mo1 = vtkMyCallback(ren1)\n    ren1.AddObserver('StartEvent', mo1)\n\n    #\n    # Now we loop over 360 degrees and render the cone each time.\n    #\n    for i in range(0, 360):\n        # Render the image.\n        renWin.Render()\n        # Rotate the active camera by one degree.\n        ren1.GetActiveCamera().Azimuth(1)\n\n\nclass vtkMyCallback(object):\n    \"\"\"\n    Callback for the interaction.\n    \"\"\"\n\n    def __init__(self, renderer):\n        self.renderer = renderer\n\n    def __call__(self, caller, ev):\n        position = self.renderer.GetActiveCamera().GetPosition()\n        print('({:5.2f}, {:5.2f}, {:5.2f})'.format(*position))\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Tutorial/Tutorial_Step3/","title":"Tutorial Step3","text":"

        vtk-examples/Python/Tutorial/Tutorial_Step3

        "},{"location":"Python/Tutorial/Tutorial_Step3/#description","title":"Description","text":"

        This example demonstrates how to use multiple renderers within a render window.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Tutorial/Tutorial_Step3/#code","title":"Code","text":"

        Tutorial_Step3.py

        #!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource 'cone' is part of a\n    # visualization pipeline (it is a source process object) it produces data\n    # (output type is vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the cone. The actor orchestrates rendering\n    # of the mapper's graphics primitives. An actor also refers to properties\n    # via a vtkProperty instance, and includes an internal transformation\n    # matrix. We set this actor's mapper to be coneMapper which we created\n    # above.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    #\n    # Create two renderers and assign actors to them. A renderer renders into\n    # a viewport within the vtkRenderWindow. It is part or all of a window on\n    # the screen and it is responsible for drawing the actors it has.  We also\n    # set the background color here. In this example we are adding the same\n    # actor to two different renderers it is okay to add different actors to\n    # different renderers as well.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('RoyalBlue'))\n\n    ren1.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    ren2 = vtkRenderer()\n    ren2.AddActor(coneActor)\n    ren2.SetBackground(colors.GetColor3d('DodgerBlue'))\n    ren2.SetViewport(0.5, 0.0, 1.0, 1.0)\n\n    #\n    # Finally we create the render window which will show up on the screen.\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.AddRenderer(ren2)\n    renWin.SetSize(600, 300)\n    renWin.SetWindowName('Tutorial_Step3')\n\n    #\n    # Make one view 90 degrees from other.\n    #\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Azimuth(90)\n\n    #\n    # Now we loop over 360 degrees and render the cones each time.\n    #\n    for i in range(0, 360):  # render the image\n        renWin.Render()\n        # rotate the active camera by one degree\n        ren1.GetActiveCamera().Azimuth(1)\n        ren2.GetActiveCamera().Azimuth(1)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Tutorial/Tutorial_Step4/","title":"Tutorial Step4","text":"

        vtk-examples/Python/Tutorial/Tutorial_Step4

        "},{"location":"Python/Tutorial/Tutorial_Step4/#description","title":"Description","text":"

        This example demonstrates the creation of multiple actors and the manipulation of their properties and transformations.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Tutorial/Tutorial_Step4/#code","title":"Code","text":"

        Tutorial_Step4.py

        #!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource \"cone\" is part of a\n    # visualization pipeline (it is a source process object) it produces data\n    # (output type is vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the first cone. The actor's properties are\n    # modified to give it different surface properties. By default, an actor\n    # is create with a property so the GetProperty() method can be used.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(0.2, 0.63, 0.79)\n    coneActor.GetProperty().SetDiffuse(0.7)\n    coneActor.GetProperty().SetSpecular(0.4)\n    coneActor.GetProperty().SetSpecularPower(20)\n\n    #\n    # Create a property and directly manipulate it. Assign it to the\n    # second actor.\n    #\n    property = vtkProperty()\n    property.SetColor(colors.GetColor3d(\"Tomato\"))\n    property.SetDiffuse(0.7)\n    property.SetSpecular(0.4)\n    property.SetSpecularPower(20)\n\n    #\n    # Create a second actor and a property. The property is directly\n    # manipulated and then assigned to the actor. In this way, a single\n    # property can be shared among many actors. Note also that we use the\n    # same mapper as the first actor did. This way we avoid duplicating\n    # geometry, which may save lots of memory if the geometry is large.\n    coneActor2 = vtkActor()\n    coneActor2.SetMapper(coneMapper)\n    coneActor2.GetProperty().SetColor(colors.GetColor3d(\"LightSeaGreen\"))\n    coneActor2.SetProperty(property)\n    coneActor2.SetPosition(0, 2, 0)\n\n    #\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is\n    # responsible for drawing the actors it has.  We also set the background\n    # color here.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.AddActor(coneActor2)\n    ren1.SetBackground(colors.GetColor3d(\"CornflowerBlue\"))\n\n    #\n    # Finally we create the render window which will show up on the screen.\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName(\"Tutorial_Step4\")\n\n    #\n    # Now we loop over 360 degrees and render the cones each time.\n    #\n    for i in range(0, 360):  # render the image\n        # render the image\n        renWin.Render()\n        # rotate the active camera by one degree\n        ren1.GetActiveCamera().Azimuth(1)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Tutorial/Tutorial_Step5/","title":"Tutorial Step5","text":"

        vtk-examples/Python/Tutorial/Tutorial_Step5

        "},{"location":"Python/Tutorial/Tutorial_Step5/#description","title":"Description","text":"

        This example introduces the concepts of interaction into the Python environment. A different interaction style (than the default) is defined.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Tutorial/Tutorial_Step5/#code","title":"Code","text":"

        Tutorial_Step5.py

        #!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource 'cone' is part of a\n    # visualization pipeline (it is a source process object) it produces data\n    # (output type is vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the cone. The actor orchestrates rendering\n    # of the mapper's graphics primitives. An actor also refers to properties\n    # via a vtkProperty instance, and includes an internal transformation\n    # matrix. We set this actor's mapper to be coneMapper which we created\n    # above.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Bisque'))\n\n    #\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is\n    # responsible for drawing the actors it has.  We also set the background\n    # color here.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    #\n    # Finally we create the render window which will show up on the screen.\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('Tutorial_Step5')\n\n    #\n    # The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n    # mouse) in the vtkRenderWindow. These events are translated into\n    # event invocations that VTK understands (see VTK/Common/vtkCommand.h\n    # for all events that VTK processes). Then observers of these VTK\n    # events can process them as appropriate.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # By default the vtkRenderWindowInteractor instantiates an instance\n    # of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n    # it observes into operations on the camera, actors, and/or properties\n    # in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n    # Here we specify a particular interactor style.\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    #\n    # Unlike the previous scripts where we performed some operations and then\n    # exited, here we leave an event loop running. The user can use the mouse\n    # and keyboard to perform the operations on the scene according to the\n    # current interaction style. When the user presses the 'e' key, by default\n    # an ExitEvent is invoked by the vtkRenderWindowInteractor which is caught\n    # and drops out of the event loop (triggered by the Start() method that\n    # follows.\n    #\n    iren.Initialize()\n    iren.Start()\n\n    #\n    # Final note: recall that observers can watch for particular events and\n    # take appropriate action. Pressing 'u' in the render window causes the\n    # vtkRenderWindowInteractor to invoke a UserEvent. This can be caught to\n    # popup a GUI, etc. See the Tcl Cone5.tcl example for an idea of how this\n    # works.\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Tutorial/Tutorial_Step6/","title":"Tutorial Step6","text":"

        vtk-examples/Python/Tutorial/Tutorial_Step6

        "},{"location":"Python/Tutorial/Tutorial_Step6/#description","title":"Description","text":"

        This example introduces 3D widgets. 3D widgets take advantage of the event/observer design pattern introduced previously. They typically have a particular representation in the scene which can be interactively selected and manipulated using the mouse and keyboard. As the widgets are manipulated, they in turn invoke events such as StartInteractionEvent, InteractionEvent, and EndInteractionEvent which can be used to manipulate the scene that the widget is embedded in. 3D widgets work in the context of the event loop which was set up in the previous example.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Tutorial/Tutorial_Step6/#code","title":"Code","text":"

        Tutorial_Step6.py

        #!/usr/bin/env python\n\n\"\"\"\n=========================================================================\n\n  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n  All rights reserved.\n  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n     This software is distributed WITHOUT ANY WARRANTY; without even\n     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n     PURPOSE.  See the above copyright notice for more information.\n\n=========================================================================*/\n\n\"\"\"\n\n# First access the VTK module (and any other needed modules) by importing them.\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkBoxWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    #\n    # Next we create an instance of vtkConeSource and set some of its\n    # properties. The instance of vtkConeSource 'cone' is part of a\n    # visualization pipeline (it is a source process object) it produces data\n    # (output type is vtkPolyData) which other filters may process.\n    #\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    #\n    # In this example we terminate the pipeline with a mapper process object.\n    # (Intermediate filters such as vtkShrinkPolyData could be inserted in\n    # between the source and the mapper.)  We create an instance of\n    # vtkPolyDataMapper to map the polygonal data into graphics primitives. We\n    # connect the output of the cone source to the input of this mapper.\n    #\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n\n    #\n    # Create an actor to represent the cone. The actor orchestrates rendering\n    # of the mapper's graphics primitives. An actor also refers to properties\n    # via a vtkProperty instance, and includes an internal transformation\n    # matrix. We set this actor's mapper to be coneMapper which we created\n    # above.\n    #\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Bisque'))\n\n    #\n    # Create the Renderer and assign actors to it. A renderer is like a\n    # viewport. It is part or all of a window on the screen and it is\n    # responsible for drawing the actors it has.  We also set the background\n    # color here.\n    #\n    ren1 = vtkRenderer()\n    ren1.AddActor(coneActor)\n    ren1.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    #\n    # Finally we create the render window which will show up on the screen.\n    # We put our renderer into the render window using AddRenderer. We also\n    # set the size to be 300 pixels by 300.\n    #\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('Tutorial_Step6')\n\n    #\n    # The vtkRenderWindowInteractor class watches for events (e.g., keypress,\n    # mouse) in the vtkRenderWindow. These events are translated into\n    # event invocations that VTK understands (see VTK/Common/vtkCommand.h\n    # for all events that VTK processes). Then observers of these VTK\n    # events can process them as appropriate.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # By default the vtkRenderWindowInteractor instantiates an instance\n    # of vtkInteractorStyle. vtkInteractorStyle translates a set of events\n    # it observes into operations on the camera, actors, and/or properties\n    # in the vtkRenderWindow associated with the vtkRenderWinodwInteractor.\n    # Here we specify a particular interactor style.\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    #\n    # Here we use a vtkBoxWidget to transform the underlying coneActor (by\n    # manipulating its transformation matrix). Many other types of widgets\n    # are available for use, see the documentation for more details.\n    #\n    # The SetInteractor method is how 3D widgets are associated with the render\n    # window interactor. Internally, SetInteractor sets up a bunch of callbacks\n    # using the Command/Observer mechanism (AddObserver()). The place factor\n    # controls the initial size of the widget with respect to the bounding box\n    # of the input to the widget.\n    boxWidget = vtkBoxWidget()\n    boxWidget.SetInteractor(iren)\n    boxWidget.SetPlaceFactor(1.25)\n    boxWidget.GetOutlineProperty().SetColor(colors.GetColor3d('Gold'))\n\n    #\n    # Place the interactor initially. The input to a 3D widget is used to\n    # initially position and scale the widget. The EndInteractionEvent is\n    # observed which invokes the SelectPolygons callback.\n    #\n    boxWidget.SetProp3D(coneActor)\n    boxWidget.PlaceWidget()\n    callback = vtkMyCallback()\n    boxWidget.AddObserver('InteractionEvent', callback)\n\n    #\n    # Normally the user presses the 'i' key to bring a 3D widget to life. Here\n    # we will manually enable it so it appears with the cone.\n    #\n    boxWidget.On()\n\n    #\n    # Start the event loop.\n    #\n    iren.Initialize()\n    iren.Start()\n\n\nclass vtkMyCallback(object):\n    \"\"\"\n    Callback for the interaction.\n    \"\"\"\n\n    def __call__(self, caller, ev):\n        t = vtkTransform()\n        widget = caller\n        widget.GetTransform(t)\n        widget.GetProp3D().SetUserTransform(t)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane/","title":"ClipUnstructuredGridWithPlane","text":"

        vtk-examples/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane

        "},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane/#description","title":"Description","text":"

        The example uses vtkTableBasedClipDataSet to clip a vtkUnstructuredGrid. The resulting output and clipped output are presented in yellow and red respectively. To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each output about their centers.

        Note that unlike other clipping filters (except for vtkClipPolyData), vtkTableBasedClipDataSet retains the original cells if they are not clipped.

        After exiting, the example reports the number of each cell type for each output:

        The inside dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 26116 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3751 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 17361 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 628 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 4376 times.\nThe clipped dataset contains a \n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 25655 cells\n    Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 3715 times.\n    Cell type [vtkHexahedron](https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details) occurs 16984 times.\n    Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 616 times.\n    Cell type [vtkPyramid](https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details) occurs 4340 times.\n

        Compare these results with ClipUnstructuredGridWithPlane2 (C++), ClipUnstructuredGridWithPlane2 (Python). Also, the resulting vtkUnstructuredGrid's has 1/4 the number of cells.

        usage

        ClipUnstructuredGridWithPlane treemesh.vtk

        thanks

        Thanks to Bane Sullivan for sharing the treemesh.vtk unstructured grid dataset.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane/#code","title":"Code","text":"

        ClipUnstructuredGridWithPlane.py

        #!/usr/bin/env python\n\nimport collections\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellTypes,\n    vtkPlane\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTableBasedClipDataSet\nfrom vtkmodules.vtkIOLegacy import vtkUnstructuredGridReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Use a vtkTableBasedClipDataSet to clip a vtkUnstructuredGrid.'\n    epilogue = '''\n Use a vtkTableBasedClipDataSet to clip a vtkUnstructuredGrid.\n The resulting output and clipped output are presented in yellow and red respectively.\n To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each\n    output about their centers.\n Note: This clipping filter does retain the original cells if they are not clipped.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='treemesh.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filename = get_program_parameters()\n\n    # Create the reader for the data.\n    reader = vtkUnstructuredGridReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    bounds = reader.GetOutput().GetBounds()\n    center = reader.GetOutput().GetCenter()\n\n    colors = vtkNamedColors()\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renderer.UseHiddenLineRemovalOn()\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    xnorm = [-1.0, -1.0, 1.0]\n\n    clipPlane = vtkPlane()\n    clipPlane.SetOrigin(reader.GetOutput().GetCenter())\n    clipPlane.SetNormal(xnorm)\n\n    clipper = vtkTableBasedClipDataSet()\n    clipper.SetClipFunction(clipPlane)\n    clipper.SetInputData(reader.GetOutput())\n    clipper.SetValue(0.0)\n    clipper.GenerateClippedOutputOn()\n    clipper.Update()\n\n    insideMapper = vtkDataSetMapper()\n    insideMapper.SetInputData(clipper.GetOutput())\n    insideMapper.ScalarVisibilityOff()\n\n    insideActor = vtkActor()\n    insideActor.SetMapper(insideMapper)\n    insideActor.GetProperty().SetDiffuseColor(colors.GetColor3d('banana'))\n    insideActor.GetProperty().SetAmbient(.3)\n    insideActor.GetProperty().EdgeVisibilityOn()\n\n    clippedMapper = vtkDataSetMapper()\n    clippedMapper.SetInputData(clipper.GetClippedOutput())\n    clippedMapper.ScalarVisibilityOff()\n\n    clippedActor = vtkActor()\n    clippedActor.SetMapper(clippedMapper)\n    clippedActor.GetProperty().SetDiffuseColor(colors.GetColor3d('tomato'))\n    insideActor.GetProperty().SetAmbient(.3)\n    clippedActor.GetProperty().EdgeVisibilityOn()\n\n    # Create transforms to make a better visualization\n    insideTransform = vtkTransform()\n    insideTransform.Translate(-(bounds[1] - bounds[0]) * 0.75, 0, 0)\n    insideTransform.Translate(center[0], center[1], center[2])\n    insideTransform.RotateY(-120.0)\n    insideTransform.Translate(-center[0], -center[1], -center[2])\n    insideActor.SetUserTransform(insideTransform)\n\n    clippedTransform = vtkTransform()\n    clippedTransform.Translate((bounds[1] - bounds[0]) * 0.75, 0, 0)\n    clippedTransform.Translate(center[0], center[1], center[2])\n    clippedTransform.RotateY(60.0)\n    clippedTransform.Translate(-center[0], -center[1], -center[2])\n    clippedActor.SetUserTransform(clippedTransform)\n\n    renderer.AddViewProp(clippedActor)\n    renderer.AddViewProp(insideActor)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Dolly(1.4)\n    renderer.ResetCameraClippingRange()\n    renderWindow.Render()\n    renderWindow.SetWindowName('ClipUnstructuredGridWithPlane')\n    renderWindow.Render()\n\n    interactor.Start()\n\n    # Generate a report\n    numberOfCells = clipper.GetOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The inside dataset contains a \\n', clipper.GetOutput().GetClassName(), ' that has ', numberOfCells, ' cells')\n    cellMap = dict()\n    for i in range(0, numberOfCells):\n        cellMap.setdefault(clipper.GetOutput().GetCellType(i), 0)\n        cellMap[clipper.GetOutput().GetCellType(i)] += 1\n    # Sort by key and put into an OrderedDict.\n    # An OrderedDict remembers the order in which the keys have been inserted.\n    for k, v in collections.OrderedDict(sorted(cellMap.items())).items():\n        print('\\tCell type ', vtkCellTypes.GetClassNameFromTypeId(k), ' occurs ', v, ' times.')\n\n    numberOfCells = clipper.GetClippedOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The clipped dataset contains a \\n', clipper.GetClippedOutput().GetClassName(), ' that has ', numberOfCells,\n          ' cells')\n    outsideCellMap = dict()\n    for i in range(0, numberOfCells):\n        outsideCellMap.setdefault(clipper.GetClippedOutput().GetCellType(i), 0)\n        outsideCellMap[clipper.GetClippedOutput().GetCellType(i)] += 1\n    for k, v in collections.OrderedDict(sorted(outsideCellMap.items())).items():\n        print('\\tCell type ', vtkCellTypes.GetClassNameFromTypeId(k), ' occurs ', v, ' times.')\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2/","title":"ClipUnstructuredGridWithPlane2","text":"

        vtk-examples/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2

        "},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#description","title":"Description","text":"

        The example uses vtkClipDataSet to clip a vtkUnstructuredGrid. The resulting output and clipped output are presented in yellow and red respectively. To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each output about their centers.

        Note that this clipping filter does not retain the original cells if they are not clipped.

        After exiting, the example reports the number of each cell type for each output:

        The inside dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 110148 cells\n        Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 106998 times.\n        Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 3150 times.\nThe clipped dataset contains a\n  [vtkUnstructuredGrid](https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details) that has 111824 cells\n        Cell type [vtkTetra](https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details) occurs 107420 times.\n        Cell type [vtkWedge](https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details) occurs 4404 times.\n

        Compare these results with ClipUnstructuredGridWithPlane2 (C++), ClipUnstructuredGridWithPlane2 (Python). Notice that in this example, the original vtkHexahedron in the unclipped regions are converted to vtkTetra. Also, the resulting vtkUnstructuredGrid's have more than 4 times the number of cells.

        usage

        ClipUnstructuredGridWithPlane2 treemesh.vtk

        thanks

        Thanks to Bane Sullivan for sharing the treemesh.vtk unstructured grid dataset.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2/#code","title":"Code","text":"

        ClipUnstructuredGridWithPlane2.py

        #!/usr/bin/env python\n\nimport collections\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellTypes,\n    vtkPlane\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkClipDataSet\nfrom vtkmodules.vtkIOLegacy import vtkUnstructuredGridReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Use a vtkClipDataSet to clip a vtkUnstructuredGrid..'\n    epilogue = '''\n Use a vtkClipDataSet to clip a vtkUnstructuredGrid..\n The resulting output and clipped output are presented in yellow and red respectively.\n To illustrate the clipped interfaces, the example uses a vtkTransform to rotate each\n    output about their centers.\n Note: This clipping filter does not retain the original cells if they are not clipped.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='treemesh.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    filename = get_program_parameters()\n\n    # Create the reader for the data.\n    reader = vtkUnstructuredGridReader()\n    reader.SetFileName(filename)\n    reader.Update()\n\n    bounds = reader.GetOutput().GetBounds()\n    center = reader.GetOutput().GetCenter()\n\n    colors = vtkNamedColors()\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Wheat'))\n    renderer.UseHiddenLineRemovalOn()\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    xnorm = [-1.0, -1.0, 1.0]\n\n    clipPlane = vtkPlane()\n    clipPlane.SetOrigin(reader.GetOutput().GetCenter())\n    clipPlane.SetNormal(xnorm)\n\n    clipper = vtkClipDataSet()\n    clipper.SetClipFunction(clipPlane)\n    clipper.SetInputData(reader.GetOutput())\n    clipper.SetValue(0.0)\n    clipper.GenerateClippedOutputOn()\n    clipper.Update()\n\n    insideMapper = vtkDataSetMapper()\n    insideMapper.SetInputData(clipper.GetOutput())\n    insideMapper.ScalarVisibilityOff()\n\n    insideActor = vtkActor()\n    insideActor.SetMapper(insideMapper)\n    insideActor.GetProperty().SetDiffuseColor(colors.GetColor3d('banana'))\n    insideActor.GetProperty().SetAmbient(.3)\n    insideActor.GetProperty().EdgeVisibilityOn()\n\n    clippedMapper = vtkDataSetMapper()\n    clippedMapper.SetInputData(clipper.GetClippedOutput())\n    clippedMapper.ScalarVisibilityOff()\n\n    clippedActor = vtkActor()\n    clippedActor.SetMapper(clippedMapper)\n    clippedActor.GetProperty().SetDiffuseColor(colors.GetColor3d('tomato'))\n    insideActor.GetProperty().SetAmbient(.3)\n    clippedActor.GetProperty().EdgeVisibilityOn()\n\n    # Create transforms to make a better visualization\n    insideTransform = vtkTransform()\n    insideTransform.Translate(-(bounds[1] - bounds[0]) * 0.75, 0, 0)\n    insideTransform.Translate(center[0], center[1], center[2])\n    insideTransform.RotateY(-120.0)\n    insideTransform.Translate(-center[0], -center[1], -center[2])\n    insideActor.SetUserTransform(insideTransform)\n\n    clippedTransform = vtkTransform()\n    clippedTransform.Translate((bounds[1] - bounds[0]) * 0.75, 0, 0)\n    clippedTransform.Translate(center[0], center[1], center[2])\n    clippedTransform.RotateY(60.0)\n    clippedTransform.Translate(-center[0], -center[1], -center[2])\n    clippedActor.SetUserTransform(clippedTransform)\n\n    renderer.AddViewProp(clippedActor)\n    renderer.AddViewProp(insideActor)\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Dolly(1.4)\n    renderer.ResetCameraClippingRange()\n    renderWindow.Render()\n    renderWindow.SetWindowName('ClipUnstructuredGridWithPlane2')\n    renderWindow.Render()\n\n    interactor.Start()\n\n    # Generate a report\n    numberOfCells = clipper.GetOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The inside dataset contains a \\n', clipper.GetOutput().GetClassName(), ' that has ', numberOfCells, ' cells')\n    cellMap = dict()\n    for i in range(0, numberOfCells):\n        cellMap.setdefault(clipper.GetOutput().GetCellType(i), 0)\n        cellMap[clipper.GetOutput().GetCellType(i)] += 1\n    # Sort by key and put into an OrderedDict.\n    # An OrderedDict remembers the order in which the keys have been inserted.\n    for k, v in collections.OrderedDict(sorted(cellMap.items())).items():\n        print('\\tCell type ', vtkCellTypes.GetClassNameFromTypeId(k), ' occurs ', v, ' times.')\n\n    numberOfCells = clipper.GetClippedOutput().GetNumberOfCells()\n    print('------------------------')\n    print('The clipped dataset contains a \\n', clipper.GetClippedOutput().GetClassName(), ' that has ', numberOfCells,\n          ' cells')\n    outsideCellMap = dict()\n    for i in range(0, numberOfCells):\n        outsideCellMap.setdefault(clipper.GetClippedOutput().GetCellType(i), 0)\n        outsideCellMap[clipper.GetClippedOutput().GetCellType(i)] += 1\n    for k, v in collections.OrderedDict(sorted(outsideCellMap.items())).items():\n        print('\\tCell type ', vtkCellTypes.GetClassNameFromTypeId(k), ' occurs ', v, ' times.')\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/UnstructuredGrid/UGrid/","title":"UGrid","text":"

        vtk-examples/Python/UnstructuredGrid/UGrid

        "},{"location":"Python/UnstructuredGrid/UGrid/#description","title":"Description","text":"

        Creation of an unstructured grid.

        Info

        See Figure 5-21 in Chapter 05 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/UnstructuredGrid/UGrid/#code","title":"Code","text":"

        UGrid.py

        #!/usr/bin/env python\n\n'''\nThis example shows how to create an unstructured grid.\n'''\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    VTK_HEXAHEDRON,\n    VTK_LINE,\n    VTK_POLYGON,\n    VTK_QUAD,\n    VTK_TETRA,\n    VTK_TRIANGLE,\n    VTK_TRIANGLE_STRIP,\n    VTK_VERTEX,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    x = [[0, 0, 0], [1, 0, 0], [2, 0, 0], [0, 1, 0], [1, 1, 0], [2, 1, 0], [0, 0, 1], [1, 0, 1], [2, 0, 1], [0, 1, 1],\n         [1, 1, 1], [2, 1, 1], [0, 1, 2], [1, 1, 2], [2, 1, 2], [0, 1, 3], [1, 1, 3], [2, 1, 3], [0, 1, 4], [1, 1, 4],\n         [2, 1, 4], [0, 1, 5], [1, 1, 5], [2, 1, 5], [0, 1, 6], [1, 1, 6], [2, 1, 6]]\n    # Here we have kept consistency with the Cxx example of the same name.\n    # This means we will use slicing in ugrid.InsertNextCell to ensure that the correct\n    #  number of points are used.\n    pts = [[0, 1, 4, 3, 6, 7, 10, 9], [1, 2, 5, 4, 7, 8, 11, 10], [6, 10, 9, 12, 0, 0, 0, 0],\n           [8, 11, 10, 14, 0, 0, 0, 0], [16, 17, 14, 13, 12, 15, 0, 0], [18, 15, 19, 16, 20, 17, 0, 0],\n           [22, 23, 20, 19, 0, 0, 0, 0], [21, 22, 18, 0, 0, 0, 0, 0], [22, 19, 18, 0, 0, 0, 0, 0],\n           [23, 26, 0, 0, 0, 0, 0, 0], [21, 24, 0, 0, 0, 0, 0, 0], [25, 0, 0, 0, 0, 0, 0, 0]]\n    print(len(x), len(pts))\n\n    renderer = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    points = vtkPoints()\n    for i in range(0, len(x)):\n        points.InsertPoint(i, x[i])\n\n    ugrid = vtkUnstructuredGrid()\n    ugrid.Allocate(100)\n    ugrid.InsertNextCell(VTK_HEXAHEDRON, 8, pts[0])\n    ugrid.InsertNextCell(VTK_HEXAHEDRON, 8, pts[1])\n    ugrid.InsertNextCell(VTK_TETRA, 4, pts[2][:4])\n    ugrid.InsertNextCell(VTK_TETRA, 4, pts[3][:4])\n    ugrid.InsertNextCell(VTK_POLYGON, 6, pts[4][:6])\n    ugrid.InsertNextCell(VTK_TRIANGLE_STRIP, 6, pts[5][:6])\n    ugrid.InsertNextCell(VTK_QUAD, 4, pts[6][:4])\n    ugrid.InsertNextCell(VTK_TRIANGLE, 3, pts[7][:3])\n    ugrid.InsertNextCell(VTK_TRIANGLE, 3, pts[8][:3])\n    ugrid.InsertNextCell(VTK_LINE, 2, pts[9][:2])\n    ugrid.InsertNextCell(VTK_LINE, 2, pts[10][:2])\n    ugrid.InsertNextCell(VTK_VERTEX, 1, pts[11][:1])\n\n    ugrid.SetPoints(points)\n\n    ugridMapper = vtkDataSetMapper()\n    ugridMapper.SetInputData(ugrid)\n\n    ugridActor = vtkActor()\n    ugridActor.SetMapper(ugridMapper)\n    ugridActor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n    ugridActor.GetProperty().EdgeVisibilityOn()\n\n    renderer.AddActor(ugridActor)\n    renderer.SetBackground(colors.GetColor3d('Beige'))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(60.0)\n    renderer.GetActiveCamera().Azimuth(30.0)\n    renderer.GetActiveCamera().Dolly(1.0)\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('UGrid')\n\n    # Interact with the data.\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/Animation/","title":"Animation","text":"

        vtk-examples/Python/Utilities/Animation

        "},{"location":"Python/Utilities/Animation/#description","title":"Description","text":"

        This example demonstrates how to create a simple animation. A timer is used to move a sphere across a scene.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/Animation/#code","title":"Code","text":"

        Animation.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\nclass vtkTimerCallback():\n    def __init__(self, steps, actor, iren):\n        self.timer_count = 0\n        self.steps = steps\n        self.actor = actor\n        self.iren = iren\n        self.timerId = None\n\n    def execute(self, obj, event):\n        step = 0\n        while step < self.steps:\n            print(self.timer_count)\n            self.actor.SetPosition(self.timer_count / 100.0, self.timer_count / 100.0, 0)\n            iren = obj\n            iren.GetRenderWindow().Render()\n            self.timer_count += 1\n            step += 1\n        if self.timerId:\n            iren.DestroyTimer(self.timerId)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(2)\n    sphereSource.SetPhiResolution(30)\n    sphereSource.SetThetaResolution(30)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphereSource.GetOutputPort())\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d(\"Peacock\"))\n    actor.GetProperty().SetSpecular(0.6)\n    actor.GetProperty().SetSpecularPower(30)\n    actor.SetMapper(mapper)\n    # actor.SetPosition(-5, -5, 0)\n\n    # Setup a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d(\"MistyRose\"))\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName(\"Animation\")\n    renderWindow.AddRenderer(renderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n\n    # Render and interact\n    renderWindow.Render()\n    renderer.GetActiveCamera().Zoom(0.8)\n    renderWindow.Render()\n\n    # Initialize must be called prior to creating timer events.\n    renderWindowInteractor.Initialize()\n\n    # Sign up to receive TimerEvent\n    cb = vtkTimerCallback(200, actor, renderWindowInteractor)\n    renderWindowInteractor.AddObserver('TimerEvent', cb.execute)\n    cb.timerId = renderWindowInteractor.CreateRepeatingTimer(500)\n\n    # start the interaction and timer\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/CheckVTKVersion/","title":"CheckVTKVersion","text":"

        vtk-examples/Python/Utilities/CheckVTKVersion

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/CheckVTKVersion/#code","title":"Code","text":"

        CheckVTKVersion.py

        #!/usr/bin/env python3\n\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) \\\n                     + 100000000 * int(minor) \\\n                     + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:\n        # Expand component-wise comparisons for VTK versions < 8.90.\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() \\\n                             + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\ndef main():\n    print('VTK Version:',vtkVersion.GetVTKVersion())\n    if not vtk_version_ok(9, 0, 0):\n        print('You need VTK version 9.0.0 or greater to run this program.')\n        return\n\n    test_versions = ((9, 2, 20220831), (9, 19, 0))\n    for ver in test_versions:\n        if vtk_version_ok(*ver):\n            print('This code works for VTK Versions >=', '.'.join(map(str, ver)))\n        else:\n            print('You need VTK Version', '.'.join(map(str, ver)), 'or greater.')\n    print()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/ColorMapToLUT/","title":"ColorMapToLUT","text":"

        vtk-examples/Python/Utilities/ColorMapToLUT

        "},{"location":"Python/Utilities/ColorMapToLUT/#description","title":"Description","text":"

        Demonstrate a cone using the vtkDiscretizableColorTransferFunction to generate the colormap.

        These two Python functions can be used to generate C++ and Python functions from a JSON or XML colormap. They can then be copied into ColorMapToLUT.cxx, ColorMapToLUT.py or into your own code.

        • ColorMapToLUT_XML
        • ColorMapToLUT_JSON

        Feel free to use either of these programs to generate different colormaps until you find one you like.

        A good initial source for color maps is: SciVisColor -- this will provide you with plenty of XML examples.

        ColorMapToLUT_JSON will allow you to select colormaps by name from ParaView Default Colormaps.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/ColorMapToLUT/#code","title":"Code","text":"

        ColorMapToLUT.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource, vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDiscretizableColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    colors.SetColor('ParaViewBkg', 82, 87, 110, 255)\n\n    ren = vtkRenderer()\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('ColorMapToLUT')\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(64)\n    sphere.SetPhiResolution(32)\n\n    cone = vtkConeSource()\n    cone.SetResolution(6)\n    cone.SetDirection(0, 1, 0)\n    cone.SetHeight(1)\n    cone.Update()\n    bounds = cone.GetOutput().GetBounds()\n\n    elevation_filter = vtkElevationFilter()\n    elevation_filter.SetLowPoint(0, bounds[2], 0)\n    elevation_filter.SetHighPoint(0, bounds[3], 0)\n    elevation_filter.SetInputConnection(cone.GetOutputPort())\n    # elevation_filter.SetInputConnection(sphere.GetOutputPort())\n\n    ctf = get_ctf()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(elevation_filter.GetOutputPort())\n    mapper.SetLookupTable(ctf)\n    mapper.SetColorModeToMapScalars()\n    mapper.InterpolateScalarsBeforeMappingOn()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    ren.AddActor(actor)\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_ctf():\n    # name: Fast, creator: Francesca Samsel and Alan W. Scott\n    # interpolationspace: RGB, space: rgb\n    # file name: Fast.json\n\n    ctf = vtkDiscretizableColorTransferFunction()\n\n    ctf.SetColorSpaceToRGB()\n    ctf.SetScaleToLinear()\n\n    ctf.SetNanColor(0.0, 0.0, 0.0)\n\n    ctf.AddRGBPoint(0, 0.05639999999999999, 0.05639999999999999, 0.47)\n    ctf.AddRGBPoint(0.17159223942480895, 0.24300000000000013, 0.4603500000000004, 0.81)\n    ctf.AddRGBPoint(0.2984914818394138, 0.3568143826543521, 0.7450246485363142, 0.954367702893722)\n    ctf.AddRGBPoint(0.4321287371255907, 0.6882, 0.93, 0.9179099999999999)\n    ctf.AddRGBPoint(0.5, 0.8994959551205902, 0.944646394975174, 0.7686567142818399)\n    ctf.AddRGBPoint(0.5882260353170073, 0.957107977357604, 0.8338185108985666, 0.5089156299842102)\n    ctf.AddRGBPoint(0.7061412605695164, 0.9275207599610714, 0.6214389091739178, 0.31535705838676426)\n    ctf.AddRGBPoint(0.8476395308725272, 0.8, 0.3520000000000001, 0.15999999999999998)\n    ctf.AddRGBPoint(1, 0.59, 0.07670000000000013, 0.11947499999999994)\n\n    ctf.SetNumberOfValues(9)\n    ctf.DiscretizeOff()\n\n    return ctf\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/ColorMapToLUT_JSON/","title":"ColorMapToLUT JSON","text":"

        vtk-examples/Python/Utilities/ColorMapToLUT_JSON

        "},{"location":"Python/Utilities/ColorMapToLUT_JSON/#description","title":"Description","text":"

        Generate a VTK colormap from a ParaView JSON description of a colormap.

        This script will let you choose a colormap by name from ParaView Default Colormaps.

        A cone is rendered to demonstrate the resultant colormap.

        C++ and Python functions can also be generated which implement the colormap. You can copy/paste these directly into your code. Or they can replace the existing function in:

        • ColorMapToLUT.py
        • ColorMapToLUT.cxx

        This program was inspired by this discussion: Replacement default color map and background palette, the Fast colormap from this discussion is used as test data here.

        A good initial source for color maps is: SciVisColor -- this will provide you with plenty of XML examples.

        Further information:

        • VTK Examples - Some ColorMap to LookupTable tools
        • How to export ParaView colormap into a format that could be read by matplotlib
        • How to export ParaView colormap into a format that could be read by matplotlib?
        • Color map advice and resources

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/ColorMapToLUT_JSON/#code","title":"Code","text":"

        ColorMapToLUT_JSON.py

        #!/usr/bin/env python3\n\nimport json\nimport sys\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource, vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkDiscretizableColorTransferFunction\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Take a JSON description of a colormap and convert it to a VTK colormap.'\n    epilogue = '''\n    A color transfer function in C++ or Python can be optionally generated.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    parser.add_argument('file_name', help='The path to the JSONL file e.g Fast.xml.')\n    parser.add_argument('-d', action='store_true', dest='discretize', help='Discretize the colormap.')\n    parser.add_argument('-n', dest='name', default=None, type=str,\n                        help='Specify the name of the colormap,'\n                             ' needed if there is more than one colormap in the JSON file.')\n    parser.add_argument('-s', dest='size', default=None, type=int,\n                        help='Specify the size of the colormap.')\n    parser.add_argument('-g', dest='generate_function', default=None,\n                        help='Generate code for the color transfer function,'\n                             ' specify the desired language one of: Cxx, Python.')\n\n    args = parser.parse_args()\n    return args.file_name, args.discretize, args.name, args.size, args.generate_function\n\n\ndef main(file_name, discretize, colormap_name, table_size, generate_function):\n    if file_name:\n        fn_path = Path(file_name)\n        if not fn_path.suffix:\n            fn_path = fn_path.with_suffix(\".json\")\n        if not fn_path.is_file():\n            print('Unable to find: ', fn_path)\n            return\n    else:\n        print('Please enter a path to the JSON file.')\n        return\n    parameters = parse_json(fn_path)\n    if len(parameters) == 0:\n        print('No named colormaps found.')\n        return\n    if len(parameters) == 1:\n        colormap_name = list(parameters.keys())[0]\n    else:\n        names = list(parameters.keys())\n        if len(parameters) > 1 and colormap_name is None:\n            print(f'A colormap name is required, choose one of:\\n{layout(sorted(names), order=\"row\")}')\n            return\n        if colormap_name not in names:\n            print(f'Unknown colormap name {colormap_name}, choose one of:\\n{layout(sorted(names), order=\"row\")}')\n            return\n\n    if generate_function is not None:\n        generate_function = generate_function.lower()\n        available_languages = {k.lower(): k for k in ['Cxx', 'Python']}\n        available_languages.update({'cpp': 'Cxx', 'c++': 'Cxx', 'py': 'Python'})\n        if generate_function not in available_languages:\n            print(f'The language: {generate_function} is not available.')\n            tmp = ', '.join(sorted([lang for lang in set(available_languages.values())]))\n            print(f'Choose one of these: {tmp}.')\n            return\n        else:\n            language = available_languages[generate_function]\n    else:\n        language = None\n\n    ctf = make_ctf(parameters[colormap_name], discretize, table_size)\n\n    # Generate code for Python or C++ if needed.\n    if language is not None and language in ['Cxx', 'Python']:\n        if language == 'Python':\n            generate_ctf_python(parameters[colormap_name], discretize, table_size)\n        else:\n            generate_ctf_cpp(parameters[colormap_name], discretize, table_size)\n\n    colors = vtkNamedColors()\n    colors.SetColor('ParaViewBkg', 82, 87, 110, 255)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(64)\n    sphere.SetPhiResolution(32)\n    sphere.SetRadius(0.5)\n    sphere.Update()\n\n    cone = vtkConeSource()\n    cone.SetResolution(6)\n    cone.SetDirection(0, 1, 0)\n    cone.SetHeight(1)\n    cone.Update()\n\n    # bounds = sphere.GetOutput().GetBounds()\n    bounds = cone.GetOutput().GetBounds()\n\n    elevation_filter = vtkElevationFilter()\n    elevation_filter.SetLowPoint(0, bounds[2], 0)\n    elevation_filter.SetHighPoint(0, bounds[3], 0)\n    # elevation_filter.SetInputConnection(sphere.GetOutputPort())\n    elevation_filter.SetInputConnection(cone.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(elevation_filter.GetOutputPort())\n    mapper.SetLookupTable(ctf)\n    mapper.SetColorModeToMapScalars()\n    mapper.InterpolateScalarsBeforeMappingOn()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Visualize\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('ColorMapToLUT_JSON')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef parse_json(fn_path):\n    \"\"\"\n    Parse the exported ParaView JSON file of a colormap.\n    :param fn_path: The path to the JSON file.\n    :return: A dict of colormaps indexed by name.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n\n    def extract(d):\n        \"\"\"\n        Pull out the data we need.\n\n        :param d: The parsed JSON data.\n        :return: The extracted data.\n        \"\"\"\n        data_values = list()\n        color_values = list()\n        opacity_values = list()\n        color_map_details = dict()\n        nan = None\n        above = None\n        below = None\n        for k, v in d.items():\n            if 'Points' in k:\n                n = 4\n                data_color = [v[i * n:(i + 1) * n] for i in range((len(v) + n - 1) // n)]\n                for dc in data_color:\n                    if len(dc) == 4:\n                        data_values.append(dc[0])\n                        color_values.append(tuple(dc[1:]))\n                if 'hsv' in k.lower():\n                    color_map_details['space'] = 'hsv'\n                else:\n                    color_map_details['space'] = 'rgb'\n\n            if k == 'ColorSpace':\n                color_map_details['interpolationspace'] = v\n            if k == 'Creator':\n                color_map_details['creator'] = v\n            if k == 'Name':\n                color_map_details['name'] = v\n            if k == 'NanColor':\n                nan = tuple(v[0:3])\n        return {'color_map_details': color_map_details, 'data_values': data_values,\n                'color_values': color_values, 'opacity_values': opacity_values, 'NaN': nan, 'Above': above,\n                'Below': below}\n\n    res = dict()\n    for jd in json_data:\n        if 'ColorSpace' in jd:\n            parameters = extract(jd)\n            parameters['path'] = fn_path.name\n            cm_name = parameters['color_map_details']['name']\n            # Do some checks.\n            if cm_name is not None:\n                if len(parameters['data_values']) != len(parameters['color_values']):\n                    sys.exit(f'{parameters[\"path\"]}: The data values length must be the same as colors.')\n                if len(parameters['opacity_values']) > 0:\n                    if len(parameters['opacity_values']) != len(parameters['color_values']):\n                        sys.exit(f'{parameters[\"path\"]}: The opacity values length must be the same as colors.')\n                res[cm_name] = parameters\n    return res\n\n\ndef layout(targets, columns=None, width=120, order='column'):\n    \"\"\"\n    Layout a sorted list of targets into columns.\n\n    :param targets: A list of targets.\n    :param columns: The number of columns, if None, then the width is used.\n    :param width: Width of the page, used if the number of columns is zero or None.\n    :param order: Ordering either by row or column (default).\n    :return A list of lists of available targets.\n    \"\"\"\n\n    order = order.lower()\n    if order not in ['row', 'column']:\n        print('The order must be either row or column, row is the default.')\n        return\n\n    def fmt_v(v):\n        return f'{v:<{max_len}s}'\n\n    max_len = max(map(len, targets))\n    # Split into rows.\n    if columns:\n        number_of_columns = columns\n    else:\n        number_of_columns = width // max_len\n    step_size = divmod(len(targets), number_of_columns)\n    step = step_size[0]\n    if step_size[1] != 0:\n        step += 1\n    if order == 'row':\n        rows = [targets[i:i + number_of_columns] for i in range(0, len(targets), number_of_columns)]\n    else:\n        rows = list()\n        for i in range(step):\n            row = list()\n            for j in range(number_of_columns):\n                idx = j * step + i\n                if idx < len(targets):\n                    row.append(targets[idx])\n            rows.append(row)\n    res = list()\n    for row in rows:\n        res.append(' '.join(map(fmt_v, row)))\n    return '\\n'.join(res)\n\n\ndef make_ctf(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate the discretizable color transfer function\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n\n    ctf = vtkDiscretizableColorTransferFunction()\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            ctf.SetColorSpaceToHSV()\n        elif interp_space == 'lab':\n            ctf.SetColorSpaceToLab()\n        elif interp_space == 'cielab':\n            ctf.SetColorSpaceToLab()\n        elif interp_space == 'ciede2000':\n            ctf.SetColorSpaceToLabCIEDE2000()\n        elif interp_space == 'diverging':\n            ctf.SetColorSpaceToDiverging()\n        elif interp_space == 'step':\n            ctf.SetColorSpaceToStep()\n        else:\n            ctf.SetColorSpaceToRGB()\n    else:\n        ctf.SetColorSpaceToRGB()\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            ctf.SetScaleToLog10()\n        else:\n            ctf.SetScaleToLinear()\n    else:\n        ctf.SetScaleToLinear()\n\n    if parameters['NaN'] is not None:\n        ctf.SetNanColor(*parameters['NaN'])\n\n    if parameters['Above'] is not None:\n        ctf.SetAboveRangeColor(*parameters['Above'])\n        ctf.UseAboveRangeColorOn()\n\n    if parameters['Below'] is not None:\n        ctf.SetBelowRangeColor(*parameters['Below'])\n        ctf.UseBelowRangeColorOn()\n\n    space = parameters['color_map_details']['space'].lower()\n    ctf_sz = len(parameters[\"data_values\"])\n    for i in range(0, ctf_sz):\n        idx = parameters['data_values'][i]\n        rgb = parameters['color_values'][i]\n        if space == 'hsv':\n            ctf.AddHSVPoint(idx, *rgb)\n        else:\n            ctf.AddRGBPoint(idx, *rgb)\n\n    if table_size is not None:\n        ctf.SetNumberOfValues(max(table_size, ctf_sz))\n    else:\n        ctf.SetNumberOfValues(ctf_sz)\n\n    if discretize:\n        ctf.DiscretizeOn()\n    else:\n        ctf.DiscretizeOff()\n\n    return ctf\n\n\ndef generate_ctf_python(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate a function for the ctf.\n\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n    indent = ' ' * 4\n\n    comment = f'{indent}#'\n    if 'name' in parameters['color_map_details']:\n        comment += f' name: {parameters[\"color_map_details\"][\"name\"]},'\n    if 'creator' in parameters['color_map_details']:\n        comment += f' creator: {parameters[\"color_map_details\"][\"creator\"]}'\n    if 'interpolationspace' in parameters['color_map_details']:\n        comment += f'\\n{indent}# interpolationspace: {parameters[\"color_map_details\"][\"interpolationspace\"]},'\n    if 'interpolationtype' in parameters['color_map_details']:\n        comment += f' interpolationtype: {parameters[\"color_map_details\"][\"interpolationtype\"]},'\n    if 'space' in parameters['color_map_details']:\n        comment += f' space: {parameters[\"color_map_details\"][\"space\"]}'\n    comment += f'\\n{indent}# file name: {parameters[\"path\"]}\\n'\n\n    s = ['', f'def get_ctf():', comment, f'{indent}ctf = vtkDiscretizableColorTransferFunction()', '']\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            s.append(f'{indent}ctf.SetColorSpaceToHSV()')\n        elif interp_space == 'lab':\n            s.append(f'{indent}ctf.SetColorSpaceToLab()')\n        elif interp_space == 'cielab':\n            s.append(f'{indent}ctf.SetColorSpaceToLab()')\n        elif interp_space == 'ciede2000':\n            s.append(f'{indent}ctf.SetColorSpaceToLabCIEDE2000()')\n        elif interp_space == 'diverging':\n            s.append(f'{indent}ctf.SetColorSpaceToDiverging()')\n        elif interp_space == 'step':\n            s.append(f'{indent}ctf.SetColorSpaceToStep()')\n        else:\n            s.append(f'{indent}ctf.SetColorSpaceToRGB()')\n    else:\n        s.append(f'{indent}ctf.SetColorSpaceToRGB()')\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            s.append(f'{indent}ctf.SetScaleToLog10()')\n        else:\n            s.append(f'{indent}ctf.SetScaleToLinear()')\n    else:\n        s.append(f'{indent}ctf.SetScaleToLinear()')\n    s.append('')\n\n    if parameters['NaN'] is not None:\n        color = ', '.join(list(map(str, parameters['NaN'])))\n        s.append(f'{indent}ctf.SetNanColor({color})')\n\n    if parameters['Above'] is not None:\n        color = ', '.join(list(map(str, parameters['Above'])))\n        s.append(f'{indent}ctf.SetAboveRangeColor({color})')\n        s.append(f'{indent}ctf.UseAboveRangeColorOn()')\n\n    if parameters['Below'] is not None:\n        color = ', '.join(list(map(str, parameters['Below'])))\n        s.append(f'{indent}ctf.SetBelowRangeColor({color})')\n        s.append(f'{indent}ctf.UseBelowRangeColorOn()')\n    s.append('')\n\n    space = parameters['color_map_details']['space'].lower()\n    ctf_sz = len(parameters[\"data_values\"])\n    for i in range(0, ctf_sz):\n        rgb = ', '.join(list(map(str, parameters['color_values'][i])))\n        idx = parameters['data_values'][i]\n        if space == 'hsv':\n            s.append(f'{indent}ctf.AddHSVPoint({idx}, {rgb})')\n        else:\n            s.append(f'{indent}ctf.AddRGBPoint({idx}, {rgb})')\n    s.append('')\n\n    if table_size is not None:\n        s.append(f'{indent}ctf.SetNumberOfValues({max(table_size, ctf_sz)})')\n    else:\n        s.append(f'{indent}ctf.SetNumberOfValues({ctf_sz})')\n\n    if discretize:\n        s.append(f'{indent}ctf.DiscretizeOn()')\n    else:\n        s.append(f'{indent}ctf.DiscretizeOff()')\n    s.append('')\n\n    s.append(f'{indent}return ctf')\n    s.append('')\n\n    print('\\n'.join(s))\n\n\ndef generate_ctf_cpp(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate a function for the ctf.\n\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n    indent = ' ' * 2\n\n    comment = f'{indent}//'\n    if 'name' in parameters['color_map_details']:\n        comment += f' name: {parameters[\"color_map_details\"][\"name\"]},'\n    if 'creator' in parameters['color_map_details']:\n        comment += f' creator: {parameters[\"color_map_details\"][\"creator\"]}'\n    if 'interpolationspace' in parameters['color_map_details']:\n        comment += f'\\n{indent}// interpolationspace: {parameters[\"color_map_details\"][\"interpolationspace\"]},'\n    if 'interpolationtype' in parameters['color_map_details']:\n        comment += f' interpolationtype: {parameters[\"color_map_details\"][\"interpolationtype\"]},'\n    if 'space' in parameters['color_map_details']:\n        comment += f' space: {parameters[\"color_map_details\"][\"space\"]}'\n    comment += f'\\n{indent}// file name: {parameters[\"path\"]}\\n'\n\n    s = ['', f'vtkNew<vtkDiscretizableColorTransferFunction> GetCTF()', '{', comment,\n         f'{indent}vtkNew<vtkDiscretizableColorTransferFunction> ctf;', '']\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            s.append(f'{indent}ctf->SetColorSpaceToHSV();')\n        elif interp_space == 'lab':\n            s.append(f'{indent}ctf->SetColorSpaceToLab();')\n        elif interp_space == 'cielab':\n            s.append(f'{indent}ctf->SetColorSpaceToLab();')\n        elif interp_space == 'ciede2000':\n            s.append(f'{indent}ctf->SetColorSpaceToLabCIEDE2000();')\n        elif interp_space == 'diverging':\n            s.append(f'{indent}ctf->SetColorSpaceToDiverging();')\n        elif interp_space == 'step':\n            s.append(f'{indent}ctf->SetColorSpaceToStep();')\n        else:\n            s.append(f'{indent}ctf->SetColorSpaceToRGB();')\n    else:\n        s.append(f'{indent}ctf->SetColorSpaceToRGB();')\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            s.append(f'{indent}ctf->SetScaleToLog10();')\n        else:\n            s.append(f'{indent}ctf->SetScaleToLinear();')\n    else:\n        s.append(f'{indent}ctf->SetScaleToLinear();')\n    s.append('')\n\n    if parameters['NaN'] is not None:\n        color = ', '.join(list(map(str, parameters['NaN'])))\n        s.append(f'{indent}ctf->SetNanColor({color});')\n\n    if parameters['Above'] is not None:\n        color = ', '.join(list(map(str, parameters['Above'])))\n        s.append(f'{indent}ctf->SetAboveRangeColor({color});')\n        s.append(f'{indent}ctf->UseAboveRangeColorOn();')\n\n    if parameters['Below'] is not None:\n        color = ', '.join(list(map(str, parameters['Below'])))\n        s.append(f'{indent}ctf->SetBelowRangeColor({color});')\n        s.append(f'{indent}ctf->UseBelowRangeColorOn();')\n    s.append('')\n\n    space = parameters['color_map_details']['space'].lower()\n    ctf_sz = len(parameters[\"data_values\"])\n    for i in range(0, ctf_sz):\n        rgb = ', '.join(list(map(str, parameters['color_values'][i])))\n        idx = parameters['data_values'][i]\n        if space == 'hsv':\n            s.append(f'{indent}ctf->AddHSVPoint({idx}, {rgb});')\n        else:\n            s.append(f'{indent}ctf->AddRGBPoint({idx}, {rgb});')\n    s.append('')\n\n    if table_size is not None:\n        s.append(f'{indent}ctf->SetNumberOfValues({max(table_size, ctf_sz)});')\n    else:\n        s.append(f'{indent}ctf->SetNumberOfValues({ctf_sz});')\n\n    if discretize:\n        s.append(f'{indent}ctf->DiscretizeOn();')\n    else:\n        s.append(f'{indent}ctf->DiscretizeOff();')\n    s.append('')\n\n    s.append(f'{indent}return ctf;')\n    s.append('}')\n    s.append('')\n\n    print('\\n'.join(s))\n\n\nif __name__ == '__main__':\n    file, discretise, name, size, generate = get_program_parameters(sys.argv)\n    main(file, discretise, name, size, generate)\n
        "},{"location":"Python/Utilities/ColorMapToLUT_XML/","title":"ColorMapToLUT XML","text":"

        vtk-examples/Python/Utilities/ColorMapToLUT_XML

        "},{"location":"Python/Utilities/ColorMapToLUT_XML/#description","title":"Description","text":"

        Generate a VTK colormap from an XML description of a colormap.

        A cone is rendered to demonstrate the resultant colormap.

        C++ and Python functions can also be generated which implement the colormap. You can copy/paste these directly into your code. Or they can replace the existing function in:

        • ColorMapToLUT.py
        • ColorMapToLUT.cxx

        This program was inspired by this discussion: Replacement default color map and background palette, and, the Fast colormap from this discussion is used as test data here.

        A good initial source for color maps is: SciVisColor -- this will provide you with plenty of XML examples.

        Note:

        • The XML parser is lxml
        • Currently, the parsing only works for XML colormaps with no Section key.

        Further information:

        • VTK Examples - Some ColorMap to LookupTable tools
        • Color maps and transfer functions
        • How to export ParaView colormap into a format that could be read by matplotlib
        • How to export ParaView colormap into a format that could be read by matplotlib?
        • Color map advice and resources
        • ParaView Default Colormaps will provide you with lots of colormaps.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/ColorMapToLUT_XML/#code","title":"Code","text":"

        ColorMapToLUT_XML.py

        #!/usr/bin/env python3\n\nimport sys\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom lxml import etree\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource, vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkDiscretizableColorTransferFunction,\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Take an XML description of a colormap and convert it to a VTK colormap.'\n    epilogue = '''\n    A color transfer function in C++ or Python can be optionally generated.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    parser.add_argument('file_name', help='The path to the XML file e.g Fast.xml.')\n    parser.add_argument('-d', action='store_true', dest='discretize', help='Discretize the colormap.')\n    parser.add_argument('-s', dest='size', default=None, type=int,\n                        help='Specify the size of the colormap.')\n    parser.add_argument('-g', dest='generate_function', default=None,\n                        help='Generate code for the color transfer function,'\n                             ' specify the desired language one of: Cxx, Python.')\n\n    args = parser.parse_args()\n    return args.file_name, args.discretize, args.size, args.generate_function\n\n\ndef main(file_name, discretize, table_size, generate_function):\n    if file_name:\n        fn_path = Path(file_name)\n        if not fn_path.suffix:\n            fn_path = fn_path.with_suffix(\".xml\")\n        if not fn_path.is_file():\n            print('Unable to find: ', fn_path)\n            return\n    else:\n        print('Please enter a path to the XML file.')\n        return\n    parameters = parse_xml(fn_path)\n\n    if generate_function is not None:\n        generate_function = generate_function.lower()\n        available_languages = {k.lower(): k for k in ['Cxx', 'Python']}\n        available_languages.update({'cpp': 'Cxx', 'c++': 'Cxx', 'py': 'Python'})\n        if generate_function not in available_languages:\n            print(f'The language: {generate_function} is not available.')\n            tmp = ', '.join(sorted([lang for lang in set(available_languages.values())]))\n            print(f'Choose one of these: {tmp}.')\n            return\n        else:\n            language = available_languages[generate_function]\n    else:\n        language = None\n\n    # There is just one entry in the parameters dict.\n    colormap_name = list(parameters.keys())[0]\n    ctf = make_ctf(parameters[colormap_name], discretize, table_size)\n\n    if language is not None and language in ['Cxx', 'Python']:\n        if language == 'Python':\n            generate_ctf_python(parameters[colormap_name], discretize, table_size)\n        else:\n            generate_ctf_cpp(parameters[colormap_name], discretize, table_size)\n\n    colors = vtkNamedColors()\n    colors.SetColor('ParaViewBkg', 82, 87, 110, 255)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(64)\n    sphere.SetPhiResolution(32)\n\n    cone = vtkConeSource()\n    cone.SetResolution(6)\n    cone.SetDirection(0, 1, 0)\n    cone.SetHeight(1)\n    cone.Update()\n\n    # bounds = sphere.GetOutput().GetBounds()\n    bounds = cone.GetOutput().GetBounds()\n\n    elevation_filter = vtkElevationFilter()\n    elevation_filter.SetLowPoint(0, bounds[2], 0)\n    elevation_filter.SetHighPoint(0, bounds[3], 0)\n    # elevation_filter.SetInputConnection(sphere.GetOutputPort())\n    elevation_filter.SetInputConnection(cone.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(elevation_filter.GetOutputPort())\n    mapper.SetLookupTable(ctf)\n    mapper.SetColorModeToMapScalars()\n    mapper.InterpolateScalarsBeforeMappingOn()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Visualize\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('ColorMapToLUT_XML')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef parse_xml(fn_path):\n    \"\"\"\n    Parse the XML file of a colormap.\n\n    Check out: https://sciviscolor.org/colormaps/ for some good XML files.\n    :param fn_path: The path to the XML file.\n    :return: The parameters for the color map.\n    \"\"\"\n    with open(fn_path) as data_file:\n        xml_doc = etree.parse(data_file)\n\n    def extract(d):\n        \"\"\"\n        Pull out the data we need.\n\n        :param d: The parsed XML data.\n        :return: The extracted data.\n        \"\"\"\n        color_map_details = dict()\n        data_values = list()\n        color_values = list()\n        opacity_values = list()\n        nan = None\n        above = None\n        below = None\n        if d is not None:\n            color_map_details = dict(d.attrib)\n            if 'space' in color_map_details:\n                # Some XML files use space instead of interpolation space.\n                if color_map_details['space'].lower() not in ['rgb', 'hsv']:\n                    color_map_details['interpolationspace'] = color_map_details['space']\n                    # Assume RGB\n                    color_map_details['space'] = 'RGB'\n        for pt in d.findall('.//Point'):\n            # \"o\" is opacity it (along with \"cms\" and \"isMoT\") are ignored.\n            # \"x\" is the scalar value associated with the color (specified by \"r\", \"g\", and \"b\").\n            data_values.append(pt.attrib['x'])\n            color_values.append((pt.attrib['r'], pt.attrib['g'], pt.attrib['b']))\n            if pt.attrib['o']:\n                opacity_values.append(pt.attrib['o'])\n        val = d.find('.//NaN')\n        if val is not None:\n            nan = (val.attrib['r'], val.attrib['g'], val.attrib['b'])\n        val = d.find('.//Above')\n        if val is not None:\n            above = (val.attrib['r'], val.attrib['g'], val.attrib['b'])\n        val = d.find('.//Below')\n        if val is not None:\n            below = (val.attrib['r'], val.attrib['g'], val.attrib['b'])\n        return {'color_map_details': color_map_details, 'data_values': data_values,\n                'color_values': color_values, 'opacity_values': opacity_values, 'NaN': nan, 'Above': above,\n                'Below': below}\n\n    s = xml_doc.getroot().find('ColorMap')\n    if s is None:\n        sys.exit('The attribute \"ColorMap\" is not found.')\n    res = dict()\n    parameters = extract(s)\n    parameters['path'] = fn_path.name\n    cm_name = parameters['color_map_details']['name']\n    # Do some checks.\n    if cm_name is not None:\n        if len(parameters['data_values']) != len(parameters['color_values']):\n            sys.exit(f'{parameters[\"path\"]}: The data values length must be the same as colors.')\n        if len(parameters['opacity_values']) > 0:\n            if len(parameters['opacity_values']) != len(parameters['color_values']):\n                sys.exit(f'{parameters[\"path\"]}: The opacity values length must be the same as colors.')\n        res[cm_name] = parameters\n    return res\n\n\ndef make_ctf(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate the discretizable color transfer function\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n\n    ctf = vtkDiscretizableColorTransferFunction()\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            ctf.SetColorSpaceToHSV()\n        elif interp_space == 'lab':\n            ctf.SetColorSpaceToLab()\n        elif interp_space == 'cielab':\n            ctf.SetColorSpaceToLab()\n        elif interp_space == 'ciede2000':\n            ctf.SetColorSpaceToLabCIEDE2000()\n        elif interp_space == 'diverging':\n            ctf.SetColorSpaceToDiverging()\n        elif interp_space == 'step':\n            ctf.SetColorSpaceToStep()\n        else:\n            ctf.SetColorSpaceToRGB()\n    else:\n        ctf.SetColorSpaceToRGB()\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            ctf.SetScaleToLog10()\n        else:\n            ctf.SetScaleToLinear()\n    else:\n        ctf.SetScaleToLinear()\n\n    if parameters['NaN'] is not None:\n        color = list(map(float, parameters['NaN']))\n        ctf.SetNanColor(*color)\n\n    if parameters['Above'] is not None:\n        color = list(map(float, parameters['Above']))\n        ctf.SetAboveRangeColor(*color)\n        ctf.UseAboveRangeColorOn()\n\n    if parameters['Below'] is not None:\n        color = list(map(float, parameters['Below']))\n        ctf.SetBelowRangeColor(*color)\n        ctf.UseBelowRangeColorOn()\n\n    space = parameters['color_map_details'].get('space', None)\n    if space:\n        space = space.lower()\n        for i in range(0, len(parameters['data_values'])):\n            color = list(map(float, parameters['color_values'][i]))\n            idx = float(parameters['data_values'][i])\n            if space == 'hsv':\n                ctf.AddHSVPoint(idx, *color)\n            else:\n                ctf.AddRGBPoint(idx, *color)\n\n    if table_size is not None:\n        ctf.SetNumberOfValues(table_size)\n    else:\n        ctf.SetNumberOfValues(len(parameters[\"data_values\"]))\n\n    if discretize:\n        ctf.DiscretizeOn()\n    else:\n        ctf.DiscretizeOff()\n\n    return ctf\n\n\ndef generate_ctf_python(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate a function for the ctf.\n\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n    indent = ' ' * 4\n\n    comment = f'{indent}#'\n    if 'name' in parameters['color_map_details']:\n        comment += f' name: {parameters[\"color_map_details\"][\"name\"]},'\n    if 'creator' in parameters['color_map_details']:\n        comment += f' creator: {parameters[\"color_map_details\"][\"creator\"]}'\n    if 'interpolationspace' in parameters['color_map_details']:\n        comment += f'\\n{indent}# interpolationspace: {parameters[\"color_map_details\"][\"interpolationspace\"]},'\n    if 'interpolationtype' in parameters['color_map_details']:\n        comment += f' interpolationtype: {parameters[\"color_map_details\"][\"interpolationtype\"]},'\n    if 'space' in parameters['color_map_details']:\n        comment += f' space: {parameters[\"color_map_details\"][\"space\"]}'\n    comment += f'\\n{indent}# file name: {parameters[\"path\"]}\\n'\n\n    s = ['', f'def get_ctf():', comment, f'{indent}ctf = vtkDiscretizableColorTransferFunction()', '']\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            s.append(f'{indent}ctf.SetColorSpaceToHSV()')\n        elif interp_space == 'lab':\n            s.append(f'{indent}ctf.SetColorSpaceToLab()')\n        elif interp_space == 'cielab':\n            s.append(f'{indent}ctf.SetColorSpaceToLab()')\n        elif interp_space == 'ciede2000':\n            s.append(f'{indent}ctf.SetColorSpaceToLabCIEDE2000()')\n        elif interp_space == 'diverging':\n            s.append(f'{indent}ctf.SetColorSpaceToDiverging()')\n        elif interp_space == 'step':\n            s.append(f'{indent}ctf.SetColorSpaceToStep()')\n        else:\n            s.append(f'{indent}ctf.SetColorSpaceToRGB()')\n    else:\n        s.append(f'{indent}ctf.SetColorSpaceToRGB()')\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            s.append(f'{indent}ctf.SetScaleToLog10()')\n        else:\n            s.append(f'{indent}ctf.SetScaleToLinear()')\n    else:\n        s.append(f'{indent}ctf.SetScaleToLinear()')\n    s.append('')\n\n    if parameters['NaN'] is not None:\n        color = ', '.join(parameters['NaN'])\n        s.append(f'{indent}ctf.SetNanColor({color})')\n\n    if parameters['Above'] is not None:\n        color = ', '.join(parameters['Above'])\n        s.append(f'{indent}ctf.SetAboveRangeColor({color})')\n        s.append(f'{indent}ctf.UseAboveRangeColorOn()')\n\n    if parameters['Below'] is not None:\n        color = ', '.join(parameters['Below'])\n        s.append(f'{indent}ctf.SetBelowRangeColor({color})')\n        s.append(f'{indent}ctf.UseBelowRangeColorOn()')\n    s.append('')\n\n    space = parameters['color_map_details'].get('space', None)\n    if space:\n        space = space.lower()\n        for i in range(0, len(parameters['data_values'])):\n            color = ', '.join(parameters['color_values'][i])\n            idx = parameters['data_values'][i]\n            if space == 'hsv':\n                s.append(f'{indent}ctf.AddHSVPoint({idx}, {color})')\n            else:\n                s.append(f'{indent}ctf.AddRGBPoint({idx}, {color})')\n        s.append('')\n\n    if table_size is not None:\n        s.append(f'{indent}ctf.SetNumberOfValues({table_size})')\n    else:\n        s.append(f'{indent}ctf.SetNumberOfValues({len(parameters[\"data_values\"])})')\n\n    if discretize:\n        s.append(f'{indent}ctf.DiscretizeOn()')\n    else:\n        s.append(f'{indent}ctf.DiscretizeOff()')\n    s.append('')\n\n    s.append(f'{indent}return ctf')\n    s.append('')\n\n    print('\\n'.join(s))\n\n\ndef generate_ctf_cpp(parameters, discretize, table_size=None):\n    \"\"\"\n    Generate a function for the ctf.\n\n    :param parameters: The parameters.\n    :param discretize: True if the values are to be mapped after discretization.\n    :param table_size: The table size.\n    :return: The discretizable color transfer function.\n    \"\"\"\n    indent = ' ' * 2\n\n    comment = f'{indent}//'\n    if 'name' in parameters['color_map_details']:\n        comment += f' name: {parameters[\"color_map_details\"][\"name\"]},'\n    if 'creator' in parameters['color_map_details']:\n        comment += f' creator: {parameters[\"color_map_details\"][\"creator\"]}'\n    if 'interpolationspace' in parameters['color_map_details']:\n        comment += f'\\n{indent}// interpolationspace: {parameters[\"color_map_details\"][\"interpolationspace\"]},'\n    if 'interpolationtype' in parameters['color_map_details']:\n        comment += f' interpolationtype: {parameters[\"color_map_details\"][\"interpolationtype\"]},'\n    if 'space' in parameters['color_map_details']:\n        comment += f' space: {parameters[\"color_map_details\"][\"space\"]}'\n    comment += f'\\n{indent}// file name: {parameters[\"path\"]}\\n'\n\n    s = ['', f'vtkNew<vtkDiscretizableColorTransferFunction> GetCTF()', '{', comment,\n         f'{indent}vtkNew<vtkDiscretizableColorTransferFunction> ctf;', '']\n\n    interp_space = parameters['color_map_details'].get('interpolationspace', None)\n    if interp_space:\n        interp_space = interp_space.lower()\n        if interp_space == 'hsv':\n            s.append(f'{indent}ctf->SetColorSpaceToHSV();')\n        elif interp_space == 'lab':\n            s.append(f'{indent}ctf->SetColorSpaceToLab();')\n        elif interp_space == 'cielab':\n            s.append(f'{indent}ctf->SetColorSpaceToLab();')\n        elif interp_space == 'ciede2000':\n            s.append(f'{indent}ctf->SetColorSpaceToLabCIEDE2000();')\n        elif interp_space == 'diverging':\n            s.append(f'{indent}ctf->SetColorSpaceToDiverging();')\n        elif interp_space == 'step':\n            s.append(f'{indent}ctf->SetColorSpaceToStep();')\n        else:\n            s.append(f'{indent}ctf->SetColorSpaceToRGB();')\n    else:\n        s.append(f'{indent}ctf->SetColorSpaceToRGB();')\n\n    scale = parameters['color_map_details'].get('interpolationtype', None)\n    if scale:\n        scale = scale.lower()\n        if scale == 'log10':\n            s.append(f'{indent}ctf->SetScaleToLog10();')\n        else:\n            s.append(f'{indent}ctf->SetScaleToLinear();')\n    else:\n        s.append(f'{indent}ctf->SetScaleToLinear();')\n    s.append('')\n\n    if parameters['NaN'] is not None:\n        color = ', '.join(parameters['NaN'])\n        s.append(f'{indent}ctf->SetNanColor({color});')\n\n    if parameters['Above'] is not None:\n        color = ', '.join(parameters['Above'])\n        s.append(f'{indent}ctf->SetAboveRangeColor({color});')\n        s.append(f'{indent}ctf->UseAboveRangeColorOn();')\n\n    if parameters['Below'] is not None:\n        color = ', '.join(parameters['Below'])\n        s.append(f'{indent}ctf->SetBelowRangeColor({color});')\n        s.append(f'{indent}ctf->UseBelowRangeColorOn();')\n    s.append('')\n\n    space = parameters['color_map_details'].get('space', None)\n    if space:\n        space = space.lower()\n        for i in range(0, len(parameters['data_values'])):\n            color = ', '.join(parameters['color_values'][i])\n            idx = parameters['data_values'][i]\n            if space == 'hsv':\n                s.append(f'{indent}ctf->AddHSVPoint({idx}, {color});')\n            else:\n                s.append(f'{indent}ctf->AddRGBPoint({idx}, {color});')\n        s.append('')\n\n    if table_size is not None:\n        s.append(f'{indent}ctf->SetNumberOfValues({table_size});')\n    else:\n        s.append(f'{indent}ctf->SetNumberOfValues({len(parameters[\"data_values\"])});')\n\n    if discretize:\n        s.append(f'{indent}ctf->DiscretizeOn();')\n    else:\n        s.append(f'{indent}ctf->DiscretizeOff();')\n    s.append('')\n\n    s.append(f'{indent}return ctf;')\n    s.append('}')\n    s.append('')\n\n    print('\\n'.join(s))\n\n\nif __name__ == '__main__':\n    file, discretise, size, generate = get_program_parameters(sys.argv)\n    main(file, discretise, size, generate)\n
        "},{"location":"Python/Utilities/LUTUtilities/","title":"LUTUtilities","text":"

        vtk-examples/Python/Utilities/LUTUtilities

        "},{"location":"Python/Utilities/LUTUtilities/#description","title":"Description","text":"

        A class called LUTUtilities is demonstrated along with a test harness that shows you how to use the class.

        This class allows you to:

        • Print the contents of the lookup table
        • Compare two lookup tables to see if they are the same.

        The test harness is a function called: TestLookupTables that tests pairs of lookup tables against each other.

        The program will not display any output if all tests are successful.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/LUTUtilities/#code","title":"Code","text":"

        LUTUtilities.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport sys\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkColorSeries\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkVariant,\n    vtkVariantArray\n)\n\n\nclass LUTUtilities(object):\n    \"\"\"\n    Utilities for displaying and comparing lookup tables.\n    \"\"\"\n\n    def __init__(self):\n        pass\n\n    def DisplayLUTAsString(self, lut):\n        \"\"\"\n        Display the contents of the lookup table.\n        :param: lut - the lookup table.\n        :return: a string containing the table data.\n        \"\"\"\n        str = ''\n        tv = lut.GetNumberOfTableValues()\n        dR = lut.GetTableRange()\n        if lut.GetIndexedLookup():\n            av = lut.GetNumberOfAnnotatedValues()\n            str = \"Categorical Lookup Table\\n\" + \\\n                  \"Number of annotated values: {:d}\".format(av) + \\\n                  \" Number of table values: {:d}\".format(tv) + \\\n                  \"\\nTable Range: {:8.6f} to {:8.6f}\\n\".format(dR[0], dR[1])\n            if av > 0:\n                for i in range(av):\n                    rgba = [0.0, 0.0, 0.0, 0.0]\n                    lut.GetAnnotationColor(lut.GetAnnotatedValue(i), rgba)\n                    str += \"{:>5}: \".format(lut.GetAnnotation(i))\n                    str += self.AssembleRGBAString(rgba)\n            else:\n                for i in range(tv):\n                    rgba = [0.0, 0.0, 0.0, 0.0]\n                    rgba = lut.GetTableValue(i)\n                    str += \"{:5d}: \".format(i)\n                    str += self.AssembleRGBAString(rgba)\n        else:\n            str = \"Ordinal Lookup Table\\n\" + \\\n                  \" Number of table values: {:d}\".format(tv) + \\\n                  \"\\nTable Range: {:8.6f} to {:8.6f}\\n\".format(dR[0], dR[1])\n            indices = [(dR[1] - dR[0]) *\n                       float(x) / tv + dR[0] for x in range(0, tv)]\n            for i, v in enumerate(indices):\n                rgb = [0.0, 0.0, 0.0]\n                lut.GetColor(v, rgb)\n                rgba = rgb + [lut.GetOpacity(v)]\n                str += \"{:5.2f}: \".format(v)\n                str += self.AssembleRGBAString(rgba)\n        return str\n\n    def AssembleRGBAString(self, rgba):\n        \"\"\"\n        Display the contents of the rgba as a series of strings:\n        decimal [r g b a], integer [r g b a] where r,g ,b a are\n        in the range 0..255 and 0xrrggba .\n        :param: The rgba string.\n        :return: A string in the above format.\n        \"\"\"\n        s = '[' + ', '.join(['{:0.6f}'.format(x) for x in rgba]) + ']'\n        ucrgb = [int(x * 255) for x in rgba]\n        t = '[' + ', '.join(['{:3d}'.format(x) for x in ucrgb]) + ']'\n        # u = '0x'+''.join(map(lambda x: '{:02X}'.format(x),ucrgb[:3]))\n        u = '0x' + ''.join(['{:02x}'.format(x) for x in ucrgb])\n        res = '{:s} {:s} {:s}\\n'.format(s, t, u)\n        return res\n\n    def CompareLUTs(self, lut1, lut2):\n        \"\"\"\n        Compare two lookup tables.\n        :param: lut1 - the lookup table.\n        :param: lut2 - the lookup table.\n        :return: True if the tables are the same.\n        \"\"\"\n        res = [True, '']\n        if lut1.GetIndexedLookup() != lut2.GetIndexedLookup():\n            res[0] = False\n            res[1] = \"One table is ordinal and the other is categorical.\"\n            return res\n        if lut1.GetIndexedLookup() and \\\n                lut1.GetNumberOfAnnotatedValues() != \\\n                lut2.GetNumberOfAnnotatedValues():\n            res[0] = False\n            res[1] = \"The number of annotated values do not match.\"\n            return res\n        if lut1.GetNumberOfTableValues() != lut2.GetNumberOfTableValues():\n            res[0] = False\n            res[1] = \"Table values do not match.\"\n            return res\n        dR1 = lut1.GetTableRange()\n        dR2 = lut2.GetTableRange()\n        if dR1[0] != dR2[0] and dR1[1] != dR2[1]:\n            res[0] = False\n            res[1] = \"Table ranges do not match.\"\n            return res\n        if lut1.GetIndexedLookup():\n            av = lut1.GetNumberOfAnnotatedValues()\n            if av > 0:\n                for i in range(av):\n                    if lut1.GetAnnotation(i) != lut1.GetAnnotation(i):\n                        res[0] = False\n                        res[1] = \"Annotations do not match.\"\n                        return res\n                for i in range(av):\n                    rgba1 = [0.0, 0.0, 0.0, 0.0]\n                    lut1.GetAnnotationColor(lut1.GetAnnotatedValue(i), rgba1)\n                    rgba2 = [0.0, 0.0, 0.0, 0.0]\n                    lut2.GetAnnotationColor(lut2.GetAnnotatedValue(i), rgba2)\n                    if not self.CompareRGBA(rgba1, rgba2):\n                        res[0] = False\n                        res[1] = \"Colors do not match.\"\n                        return res\n            else:\n                tv = lut1.GetNumberOfTableValues()\n                for i in range(tv):\n                    rgba1 = lut1.GetTableValue(i)\n                    rgba2 = lut2.GetTableValue(i)\n                    if not self.CompareRGBA(rgba1, rgba2):\n                        res[0] = False\n                        res[1] = \"Colors do not match.\"\n                        return res\n        else:\n            tv = lut1.GetNumberOfTableValues()\n            indices = [(dR1[1] - dR1[0]) *\n                       float(x) / tv + dR1[0] for x in range(0, tv)]\n            for i, v in enumerate(indices):\n                rgb1 = [0.0, 0.0, 0.0]\n                lut1.GetColor(v, rgb1)\n                rgba1 = rgb1 + [lut1.GetOpacity(v)]\n                rgb2 = [0.0, 0.0, 0.0]\n                lut2.GetColor(v, rgb2)\n                rgba2 = rgb2 + [lut2.GetOpacity(v)]\n                if not self.CompareRGBA(rgba1, rgba2):\n                    res[0] = False\n                    res[1] = \"Colors do not match.\"\n                    return res\n\n        return res\n\n    def CompareRGBA(self, rgba1, rgba2):\n        \"\"\"\n        Compare two rgba lists.\n        rgba can be a hexadecimal string, or a\n        list of rgb or rgba colors.\n        :param: rgba1 - the color.\n        :param: rgba2 - the color.\n        :return: True if the colors are the same.\n        \"\"\"\n        if len(rgba1) != len(rgba2):\n            return False\n        if isinstance(rgba1, str):\n            return rgba1 == rgba2\n        if len(rgba1) == 3 or len(rgba1) == 4:\n            for i in range(0, len(rgba1)):\n                if rgba1[i] != rgba2[i]:\n                    return False\n            return True\n        return False\n\n\ndef GetAllColorSchemes():\n    \"\"\"\n    Get all the color scheme names.\n    :return: a map of the names keyed on their index.\n    \"\"\"\n    colorSchemes = dict()\n    colorSeries = vtkColorSeries()\n    for i in range(colorSeries.GetNumberOfColorSchemes()):\n        colorSeries.SetColorScheme(i)\n        colorSchemes[i] = colorSeries.GetColorSchemeName()\n    return colorSchemes\n\n\ndef AvailableColorSchemes(colorSchemes):\n    \"\"\"\n    The available color scheme indexes and names.\n    :param: colorSchemes - a map of the names keyed on their index.\n    :return:  a string if the indexes and names.\n    \"\"\"\n    str = ''\n    for k, v in colorSchemes.items():\n        str += '{:3d}\\t{:s}\\n'.format(k, v)\n    return str\n\n\ndef DisplayAvailableColorSchemes():\n    \"\"\"\n    Display the available color schemes.\n    \"\"\"\n    line = \"-----------------------------------------------------------------------------\\n\"\n    colorSchemes = GetAllColorSchemes()\n    print(line + AvailableColorSchemes(colorSchemes) + line)\n\n\ndef DisplayResults(reason, lut1, lut2):\n    \"\"\"\n    Display the lookup tables and reason for failure.\n    :param: reason - the reason.\n    :param: lut1 - the first lookup table.\n    :param: lut2 - the second lookup table.\n    \"\"\"\n    lutUtilities = LUTUtilities()\n    line = \"-----------------------------------------------------------------------------\\n\"\n    print(line + reason + \"\\n\")\n    print(lutUtilities.DisplayLUTAsString(lut1))\n    print(lutUtilities.DisplayLUTAsString(lut2))\n    print(line)\n\n\ndef TestTables(lut1, lut2, expected=True):\n    \"\"\"\n    Test pairs of lookup tables.\n    :param: lut1 - the first lookup table.\n    :param: lut2 - the second lookup table.\n    :param: expected - if False a fail is expected.\n    :return: True/False.\n    \"\"\"\n    lutUtilities = LUTUtilities()\n    comparison = lutUtilities.CompareLUTs(lut1, lut2)\n    if comparison[0] != expected:\n        DisplayResults(comparison[1], lut1, lut2)\n    if expected:\n        return comparison[0]\n    return not comparison[0]\n\n\ndef TestLookupTables(lutMode):\n    \"\"\"\n    Test various combinations of lookup tables.\n    :param: lutMode - if True the tables are ordinal, categorical otherwise.\n    :return: True if all tests passed.\n    \"\"\"\n    lut1 = vtkLookupTable()\n    lut2 = vtkLookupTable()\n    colorSeries = vtkColorSeries()\n    colorSeriesEnum = colorSeries.SPECTRUM\n    colorSeries.SetColorScheme(colorSeriesEnum)\n\n    colorSeries.BuildLookupTable(lut1)\n    colorSeries.BuildLookupTable(lut2)\n    if lutMode:\n        lut1.IndexedLookupOff()\n        lut2.IndexedLookupOff()\n    lut1.SetNanColor(1, 0, 0, 1)\n    lut2.SetNanColor(1, 0, 0, 1)\n    if not lutMode:\n        # For the annotation just use a letter of the alphabet.\n        values1 = vtkVariantArray()\n        values2 = vtkVariantArray()\n        str = \"abcdefghijklmnopqrstuvwxyz\"\n        for i in range(lut1.GetNumberOfTableValues()):\n            values1.InsertNextValue(vtkVariant(str[i]))\n        for i in range(lut2.GetNumberOfTableValues()):\n            values2.InsertNextValue(vtkVariant(str[i]))\n        for i in range(values1.GetNumberOfTuples()):\n            lut1.SetAnnotation(i, values1.GetValue(i).ToString())\n        for i in range(values2.GetNumberOfTuples()):\n            lut2.SetAnnotation(i, values2.GetValue(i).ToString())\n    # Are they the same?\n    res = True\n    res &= TestTables(lut1, lut2)\n\n    # Different size\n    lut2.SetNumberOfTableValues(5)\n    res &= TestTables(lut1, lut2, False)\n    lut2.SetNumberOfTableValues(lut1.GetNumberOfTableValues())\n    res &= TestTables(lut1, lut2)\n\n    if lutMode:\n        # Different range\n        lut2.SetTableRange(1, 2)\n        res &= TestTables(lut1, lut2, False)\n        tr = lut1.GetTableRange()\n        lut2.SetTableRange(tr)\n        res &= TestTables(lut1, lut2)\n\n        # Different color\n        colorSeriesEnum = colorSeries.COOL\n        colorSeries.SetColorScheme(colorSeriesEnum)\n        lut3 = vtkLookupTable()\n        colorSeries.BuildLookupTable(lut3)\n        lut3.IndexedLookupOff()\n        res &= TestTables(lut1, lut3, False)\n\n        # One indexed, the other ordinal.\n        lut1.IndexedLookupOn()\n        res &= TestTables(lut1, lut2, False)\n\n    else:\n        # Different color\n        colorSeriesEnum = colorSeries.COOL\n        colorSeries.SetColorScheme(colorSeriesEnum)\n        lut3 = vtkLookupTable()\n        colorSeries.BuildLookupTable(lut3)\n        values = vtkVariantArray()\n        str = \"abcdefghijklmnopqrstuvwxyz\"\n        for i in range(lut3.GetNumberOfTableValues()):\n            values.InsertNextValue(vtkVariant(str[i]))\n        for i in range(values.GetNumberOfTuples()):\n            lut3.SetAnnotation(i, values.GetValue(i).ToString())\n        colorSeries.BuildLookupTable(lut3)\n        res &= TestTables(lut1, lut3, False)\n\n        # Different annotations.\n        lut2.ResetAnnotations()\n        for i in range(values.GetNumberOfTuples()):\n            if i % 3 == 0:\n                continue\n            lut2.SetAnnotation(i, values.GetValue(i).ToString())\n        res &= TestTables(lut1, lut2, False)\n\n        # No annotations\n        lut1.ResetAnnotations()\n        lut2.ResetAnnotations()\n        res &= TestTables(lut1, lut2)\n\n        # One indexed, the other ordinal.\n        lut1.IndexedLookupOff()\n        res &= TestTables(lut1, lut2, False)\n\n    return res\n\n\ndef main():\n    # DisplayAvailableColorSchemes()\n    # Test ordinal LUTS.\n    res = TestLookupTables(True)\n    # Test categorical LUTs.\n    res &= TestLookupTables(False)\n    return res\n\n\nif __name__ == '__main__':\n    res = main()\n    if res:\n        sys.exit(0)\n    else:\n        print('Ordinal or Categorical LookupTable tests failed.')\n        sys.exit(1)\n
        "},{"location":"Python/Utilities/RescaleReverseLUT/","title":"RescaleReverseLUT","text":"

        vtk-examples/Python/Utilities/RescaleReverseLUT

        "},{"location":"Python/Utilities/RescaleReverseLUT/#description","title":"Description","text":"

        This example shows how to adjust a colormap so that the colormap scalar range matches the scalar range on the object. This is done by adjusting the colormap so that the colormap scalar range matches the scalar range of the object by rescaling the control points and, optionally, reversing the order of the colors.

        Of course, if you are generating the scalars, it may be easier to just change the scalar range of your filter. However, this may not be possible in some cases.

        Here, we generate the original Color Transfer Function (CTF) corresponding to the seven colors that Isaac Newton labeled when dividing the spectrum of visible light in 1672. There are seven colors and the scalar range is [-1, 1].

        The cylinder has a vtkElevationFilter applied to it with a scalar range of [0, 1].

        There are four images:

        • Original - The cylinder is colored by only the top four colors from the CTF. This is because the elevation scalar range on the cylinder is [0, 1] and the CTF scalar range is [-1, 1]. So the coloring is green->violet.
        • Reversed - We have reversed the colors from the original CTF and the lower four colors in the original CTF are now the top four colors used to color the cylinder. The coloring is now green->red.
        • Rescaled - The original CTF is rescaled to the range [0, 1] to match the scalar range of the elevation filter. The coloring is red->violet.
        • Rescaled and Reversed - The original CTF is rescaled to the range [0, 1] and the colors reversed. The coloring is violet->red.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/RescaleReverseLUT/#code","title":"Code","text":"

        RescaleReverseLUT.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersSources import vtkCylinderSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkDiscretizableColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    colors.SetColor('ParaViewBkg', 82, 87, 110, 255)\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(640 * 2, 480 * 2)\n    ren_win.SetWindowName('RescaleReverseLUT')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    ctf = list()\n    ctf.append(get_ctf(False))\n    ctf.append(rescale_ctf(ctf[0], 0, 1, False))\n    ctf.append(rescale_ctf(ctf[0], *ctf[0].GetRange(), True))\n    ctf.append(rescale_ctf(ctf[0], 0, 1, True))\n\n    # Define viewport ranges.\n    xmins = [0.0, 0.0, 0.5, 0.5]\n    xmaxs = [0.5, 0.5, 1.0, 1.0]\n    ymins = [0.5, 0.0, 0.5, 0.0]\n    ymaxs = [1.0, 0.5, 1.0, 0.5]\n\n    # Define titles.\n    titles = ['Original', 'Rescaled', 'Reversed', 'Rescaled and Reversed']\n\n    # Create a common text property.\n    text_property = vtkTextProperty()\n    text_property.SetFontSize(36)\n    text_property.SetJustificationToCentered()\n    text_property.SetColor(colors.GetColor3d('LightGoldenrodYellow'))\n\n    sources = list()\n    elevation_filters = list()\n    mappers = list()\n    actors = list()\n    scalar_bars = list()\n    renderers = list()\n    text_mappers = list()\n    text_actors = list()\n\n    for i in range(0, 4):\n        cylinder = vtkCylinderSource()\n        cylinder.SetCenter(0.0, 0.0, 0.0)\n        cylinder.SetResolution(6)\n        cylinder.Update()\n        bounds = cylinder.GetOutput().GetBounds()\n        sources.append(cylinder)\n\n        elevation_filter = vtkElevationFilter()\n        elevation_filter.SetScalarRange(0, 1)\n        elevation_filter.SetLowPoint(0, bounds[2], 0)\n        elevation_filter.SetHighPoint(0, bounds[3], 0)\n        elevation_filter.SetInputConnection(sources[i].GetOutputPort())\n        elevation_filters.append(elevation_filter)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(elevation_filters[i].GetOutputPort())\n        mapper.SetLookupTable(ctf[i])\n        mapper.SetColorModeToMapScalars()\n        mapper.InterpolateScalarsBeforeMappingOn()\n        mappers.append(mapper)\n\n        actor = vtkActor()\n        actor.SetMapper(mappers[i])\n        actors.append(actor)\n\n        # Add a scalar bar.\n        scalar_bar = vtkScalarBarActor()\n        scalar_bar.SetLookupTable(ctf[i])\n        scalar_bars.append(scalar_bar)\n\n        text_mappers.append(vtkTextMapper())\n        text_mappers[i].SetInput(titles[i])\n        text_mappers[i].SetTextProperty(text_property)\n\n        text_actors.append(vtkActor2D())\n        text_actors[i].SetMapper(text_mappers[i])\n        # Note: The position of an Actor2D is specified in display coordinates.\n        text_actors[i].SetPosition(300, 16)\n\n        ren = vtkRenderer()\n        ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n        ren.AddActor(actors[i])\n        ren.AddActor(scalar_bars[i])\n        ren.AddActor(text_actors[i])\n        ren.SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i])\n        renderers.append(ren)\n\n        ren_win.AddRenderer(renderers[i])\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_ctf(modern=False):\n    \"\"\"\n    Generate the color transfer function.\n\n    The seven colors corresponding to the colors that Isaac Newton labelled\n        when dividing the spectrum of visible light in 1672 are used.\n\n    The modern variant of these colors can be selected and used instead.\n\n    See: [Rainbow](https://en.wikipedia.org/wiki/Rainbow)\n\n    :param modern: Selects either Newton's original seven colors or modern version.\n    :return: The color transfer function.\n    \"\"\"\n\n    # name: Rainbow, creator: Andrew Maclean\n    # interpolationspace: RGB, space: rgb\n    # file name:\n\n    ctf = vtkDiscretizableColorTransferFunction()\n\n    ctf.SetColorSpaceToRGB()\n    ctf.SetScaleToLinear()\n    ctf.SetNanColor(0.5, 0.5, 0.5)\n    ctf.SetBelowRangeColor(0.0, 0.0, 0.0)\n    ctf.UseBelowRangeColorOn()\n    ctf.SetAboveRangeColor(1.0, 1.0, 1.0)\n    ctf.UseAboveRangeColorOn()\n\n    if modern:\n        ctf.AddRGBPoint(-1.0, 1.0, 0.0, 0.0)  # Red\n        ctf.AddRGBPoint(-2.0 / 3.0, 1.0, 128.0 / 255.0, 0.0)  # Orange #ff8000\n        ctf.AddRGBPoint(-1.0 / 3.0, 1.0, 1.0, 0.0)  # Yellow\n        ctf.AddRGBPoint(0.0, 0.0, 1.0, 0.0)  # Green #00ff00\n        ctf.AddRGBPoint(1.0 / 3.0, 0.0, 1.0, 1.0)  # Cyan\n        ctf.AddRGBPoint(2.0 / 3.0, 0.0, 0.0, 1.0)  # Blue\n        ctf.AddRGBPoint(1.0, 128.0 / 255.0, 0.0, 1.0)  # Violet #8000ff\n    else:\n        ctf.AddRGBPoint(-1.0, 1.0, 0.0, 0.0)  # Red\n        ctf.AddRGBPoint(-2.0 / 3.0, 1.0, 165.0 / 255.0, 0.0)  # Orange #00a500\n        ctf.AddRGBPoint(-1.0 / 3.0, 1.0, 1.0, 0.0)  # Yellow\n        ctf.AddRGBPoint(0.0, 0.0, 125.0 / 255.0, 0.0)  # Green #008000\n        ctf.AddRGBPoint(1.0 / 3.0, 0.0, 153.0 / 255.0, 1.0)  # Blue #0099ff\n        ctf.AddRGBPoint(2.0 / 3.0, 68.0 / 255.0, 0, 153.0 / 255.0)  # Indigo #4400ff\n        ctf.AddRGBPoint(1.0, 153.0 / 255.0, 0.0, 1.0)  # Violet #9900ff\n\n    ctf.SetNumberOfValues(7)\n    ctf.DiscretizeOn()\n\n    return ctf\n\n\ndef generate_new_ctf(old_ctf, new_x, new_rgb, reverse=False):\n    \"\"\"\n    Generate a new color transfer function from the old one,\n    adding in the new x and rgb values.\n\n    :param old_ctf: The old color transfer function.\n    :param new_x: The new color x-values.\n    :param new_rgb: The color RGB values.\n    :param reverse: If true, reverse the colors.\n    :return: The new color transfer function.\n    \"\"\"\n    new_ctf = vtkDiscretizableColorTransferFunction()\n    new_ctf.SetScale(old_ctf.GetScale())\n    new_ctf.SetColorSpace(old_ctf.GetColorSpace())\n    new_ctf.SetNanColor(old_ctf.GetNanColor())\n    if not reverse:\n        new_ctf.SetBelowRangeColor(old_ctf.GetBelowRangeColor())\n        new_ctf.SetUseBelowRangeColor(old_ctf.GetUseBelowRangeColor())\n        new_ctf.SetAboveRangeColor(old_ctf.GetAboveRangeColor())\n        new_ctf.SetUseAboveRangeColor(old_ctf.GetUseAboveRangeColor())\n    else:\n        new_ctf.SetBelowRangeColor(old_ctf.GetAboveRangeColor())\n        new_ctf.SetUseBelowRangeColor(old_ctf.GetUseAboveRangeColor())\n        new_ctf.SetAboveRangeColor(old_ctf.GetBelowRangeColor())\n        new_ctf.SetUseAboveRangeColor(old_ctf.GetUseBelowRangeColor())\n    new_ctf.SetNumberOfValues(len(new_x))\n    new_ctf.SetDiscretize(old_ctf.GetDiscretize())\n    if not reverse:\n        for i in range(0, len(new_x)):\n            new_ctf.AddRGBPoint(new_x[i], *new_rgb[i])\n    else:\n        sz = len(new_x)\n        for i in range(0, sz):\n            j = sz - (i + 1)\n            new_ctf.AddRGBPoint(new_x[i], *new_rgb[j])\n    new_ctf.Build()\n    return new_ctf\n\n\ndef rescale(values, new_min=0, new_max=1):\n    \"\"\"\n    Rescale the values.\n\n    See: https://stats.stackexchange.com/questions/25894/changing-the-scale-of-a-variable-to-0-100\n\n    :param values: The values to be rescaled.\n    :param new_min: The new minimum value.\n    :param new_max: The new maximum value.\n    :return: The rescaled values.\n    \"\"\"\n    res = list()\n    old_min, old_max = min(values), max(values)\n    for v in values:\n        new_v = (new_max - new_min) / (old_max - old_min) * (v - old_min) + new_min\n        # new_v1 = (new_max - new_min) / (old_max - old_min) * (v - old_max) + new_max\n        res.append(new_v)\n    return res\n\n\ndef rescale_ctf(ctf, new_min=0, new_max=1, reverse=False):\n    \"\"\"\n    Rescale and, optionally, reverse the colors in the color transfer function.\n\n    :param ctf: The color transfer function to rescale.\n    :param new_min: The new minimum value.\n    :param new_max: The new maximum value.\n    :param reverse: If true, reverse the colors.\n    :return: The rescaled color transfer function.\n    \"\"\"\n    if new_min > new_max:\n        r0 = new_max\n        r1 = new_min\n    else:\n        r0 = new_min\n        r1 = new_max\n\n    xv = list()\n    rgbv = list()\n    nv = [0] * 6\n    for i in range(0, ctf.GetNumberOfValues()):\n        ctf.GetNodeValue(i, nv)\n        x = nv[0]\n        rgb = nv[1:4]\n        xv.append(x)\n        rgbv.append(rgb)\n    xvr = rescale(xv, r0, r1)\n\n    return generate_new_ctf(ctf, xvr, rgbv, reverse=reverse)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/ResetCameraOrientation/","title":"ResetCameraOrientation","text":"

        vtk-examples/Python/Utilities/ResetCameraOrientation

        "},{"location":"Python/Utilities/ResetCameraOrientation/#description","title":"Description","text":"

        This example demonstrates how to reset the camera orientation.

        In this case, the original orientation is stored, a new orientation calculated, and, finally the original orientation is restored. The original, new and restored orientations of the cone are displayed in one second intervals. After this you can interact with the scene.

        To set the camera position, you can use:

        • SetPosition, SetFocalPoint, SetViewUp, SetDistance, SetClippingRange
        • Roll, Elevation, Azimuth
        • SetRoll, Pitch, Yaw

        If you haven't used SetDistance or SetClippingRange remember to ren->ResetCamera(); or ren.ResetCamera().

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/ResetCameraOrientation/#code","title":"Code","text":"

        ResetCameraOrientation.py

        from time import sleep\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkInteractionStyle import (\n    vtkInteractorStyleTrackballCamera)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef comma_separated_list(v, precision=6, width=10):\n    \"\"\"\n    Produce a comma-separated string of numbers from a list.\n    :param v: The list of floats.\n    :param precision: Number of decimal places.\n    :param width: The width.\n    :return: A comma-separated string.\n    \"\"\"\n    res = list()\n    for p in v:\n        res.append(f'{p:{width}.{precision}f}')\n    return ','.join(res)\n\n\ndef get_orientation(ren):\n    \"\"\"\n    Get the camera orientation.\n    :param ren: The renderer.\n    :return: The orientation parameters.\n    \"\"\"\n    p = dict()\n    camera = ren.GetActiveCamera()\n    p['position'] = camera.GetPosition()\n    p['focal point'] = camera.GetFocalPoint()\n    p['view up'] = camera.GetViewUp()\n    p['distance'] = camera.GetDistance()\n    p['clipping range'] = camera.GetClippingRange()\n    p['orientation'] = camera.GetOrientation()\n    return p\n\n\ndef set_orientation(ren, p):\n    \"\"\"\n    Set the orientation of the camera.\n    :param ren: The renderer.\n    :param p: The orientation parameters.\n    :return:\n    \"\"\"\n    camera = ren.GetActiveCamera()\n    camera.SetPosition(p['position'])\n    camera.SetFocalPoint(p['focal point'])\n    camera.SetViewUp(p['view up'])\n    camera.SetDistance(p['distance'])\n    camera.SetClippingRange(p['clipping range'])\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    cone = vtkConeSource()\n    cone.SetHeight(3.0)\n    cone.SetRadius(1.0)\n    cone.SetResolution(10)\n\n    cone_mapper = vtkPolyDataMapper()\n    cone_mapper.SetInputConnection(cone.GetOutputPort())\n\n    cone_actor = vtkActor()\n    cone_actor.SetMapper(cone_mapper)\n    cone_actor.GetProperty().SetColor(colors.GetColor3d('Bisque'))\n\n    ren = vtkRenderer()\n    ren.AddActor(cone_actor)\n    ren.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetSize(600, 600)\n    ren_win.SetWindowName('ResetCameraOrientation')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    camera = ren.GetActiveCamera()\n    camera.SetRoll(15)\n    camera.Elevation(-15)\n    camera.Azimuth(30)\n    ren.ResetCamera()\n\n    ren_win.Render()\n    original_orient = get_orientation(ren)\n    s = f'{\"Original orientation:\":23s}'\n    s += comma_separated_list(original_orient[\"orientation\"])\n    print(s)\n    sleep(1)\n\n    camera.SetPosition(-3.568189, 5.220048, 2.352639)\n    camera.SetFocalPoint(-0.399044, -0.282865, 0.131438)\n    camera.SetViewUp(0.623411, 0.573532, -0.531431)\n    camera.SetDistance(6.727500)\n    camera.SetClippingRange(3.001430, 11.434082)\n    # No need to use ren.ResetCamera() as we have all the parameters.\n    ren_win.Render()\n    new_orient = get_orientation(ren)\n    s = f'{\"New orientation:\":23s}'\n    s += comma_separated_list(new_orient[\"orientation\"])\n    print(s)\n    sleep(1)\n\n    print('Reloading the original orientation.')\n    set_orientation(ren, original_orient)\n    ren_win.Render()\n    check = get_orientation(ren)\n    s = f'{\"Final orientation:\":23s}'\n    s += comma_separated_list(check[\"orientation\"])\n    print(s)\n    sleep(1)\n\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Utilities/SaveSceneToFieldData/","title":"SaveSceneToFieldData","text":"

        vtk-examples/Python/Utilities/SaveSceneToFieldData

        "},{"location":"Python/Utilities/SaveSceneToFieldData/#description","title":"Description","text":"

        This example saves a vtkCamera's parameters in the vtkFieldData of a vkDataSet.

        To see how the scene is saved and restored,

        1. Interact with the scene. Press the e key to exit the first iteractor. The current state of the scene's vtkCamera will be saved in the vtkDataSet's vtkFieldData.

        2. Interact with the scene again. Press the e key to exit the second interactor. The scene will be restored to the previous state.

        3. Press the e key to exit the example.

        Info

        This example uses snippets.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/SaveSceneToFieldData/#code","title":"Code","text":"

        SaveSceneToFieldData.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkStringArray\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    pd_fn = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    polyData = ReadPolyData(pd_fn)\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Crimson'))\n    actor.GetProperty().SetSpecular(.6)\n    actor.GetProperty().SetSpecularPower(30)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('SaveSceneToFieldData')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # Interact to change camera.\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n    # After the interaction is done, save the scene.\n    SaveSceneToFieldData(polyData, actor, renderer.GetActiveCamera())\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n    # After interaction , restore the scene.\n    RestoreSceneFromFieldData(polyData, actor, renderer.GetActiveCamera())\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Saving a scene to field data.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('data_file', help='A polydata file e.g. Armadillo.ply.')\n    args = parser.parse_args()\n    return args.data_file\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef SaveSceneToFieldData(data, actor, camera):\n    # Actor\n    #   Position, orientation, origin, scale, usrmatrix, usertransform\n    # Camera\n    #   FocalPoint, Position, ViewUp, ViewAngle, ClippingRange\n\n    fp_format = '{0:.6f}'\n    res = dict()\n    res['Camera:FocalPoint'] = ', '.join(fp_format.format(n) for n in camera.GetFocalPoint())\n    res['Camera:Position'] = ', '.join(fp_format.format(n) for n in camera.GetPosition())\n    res['Camera:ViewUp'] = ', '.join(fp_format.format(n) for n in camera.GetViewUp())\n    res['Camera:ViewAngle'] = fp_format.format(camera.GetViewAngle())\n    res['Camera:ClippingRange'] = ', '.join(fp_format.format(n) for n in camera.GetClippingRange())\n    buffer = ''\n    for k, v in res.items():\n        buffer += k + ' ' + v + '\\n'\n    cameraArray = vtkStringArray()\n    cameraArray.SetNumberOfValues(1)\n    cameraArray.SetValue(0, buffer)\n    cameraArray.SetName('Camera')\n    data.GetFieldData().AddArray(cameraArray)\n\n\ndef RestoreSceneFromFieldData(data, actor, camera):\n    import re\n\n    # Some regular expressions.\n\n    reCP = re.compile(r'^Camera:Position')\n    reCFP = re.compile(r'^Camera:FocalPoint')\n    reCVU = re.compile(r'^Camera:ViewUp')\n    reCVA = re.compile(r'^Camera:ViewAngle')\n    reCCR = re.compile(r'^Camera:ClippingRange')\n    keys = [reCP, reCFP, reCVU, reCVA, reCCR]\n\n    # float_number = re.compile(r'[^0-9.\\-]*([0-9e.\\-]*[^,])[^0-9.\\-]*([0-9e.\\-]*[^,])[^0-9.\\-]*([0-9e.\\-]*[^,])')\n    # float_scalar = re.compile(r'[^0-9.\\-]*([0-9.\\-e]*[^,])')\n\n    buffer = data.GetFieldData().GetAbstractArray('Camera').GetValue(0).split('\\n')\n    res = dict()\n    for line in buffer:\n        if not line.strip():\n            continue\n        line = line.strip().replace(',', '').split()\n        for i in keys:\n            m = re.match(i, line[0])\n            if m:\n                k = m.group(0)\n                if m:\n                    #  Convert the rest of the line to floats.\n                    v = list(map(lambda x: float(x), line[1:]))\n                    if len(v) == 1:\n                        res[k] = v[0]\n                    else:\n                        res[k] = v\n    for k, v in res.items():\n        if re.match(reCP, k):\n            camera.SetPosition(v)\n        elif re.match(reCFP, k):\n            camera.SetFocalPoint(v)\n        elif re.match(reCVU, k):\n            camera.SetViewUp(v)\n        elif re.match(reCVA, k):\n            camera.SetViewAngle(v)\n        elif re.match(reCCR, k):\n            camera.SetClippingRange(v)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/SaveSceneToFile/","title":"SaveSceneToFile","text":"

        vtk-examples/Python/Utilities/SaveSceneToFile

        "},{"location":"Python/Utilities/SaveSceneToFile/#description","title":"Description","text":"

        This example saves a vtkCamera's parameters in a file.

        To see how the scene is saved and restored,

        1. Interact with the scene. Press the e key to exit the first iteractor. The current state of the scene's vtkCamera will be saved in the file.
        2. Interact with the scene again. Press the e key to exit the second interactor. The saved file is read and the scene will be restored to the previous state.
        3. Press the e key to exit the example.

        Info

        This example uses snippets.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/SaveSceneToFile/#code","title":"Code","text":"

        SaveSceneToFile.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    pd_fn, scene_fn = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    polyData = ReadPolyData(pd_fn)\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polyData)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Crimson'))\n    actor.GetProperty().SetSpecular(.6)\n    actor.GetProperty().SetSpecularPower(30)\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('SaveSceneToFile')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n\n    # Interact to change camera.\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n    # After the interaction is done, save the scene.\n    SaveSceneToFile(scene_fn, actor, renderer.GetActiveCamera())\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n    # After interaction , restore the scene.\n    RestoreSceneFromFile(scene_fn, actor, renderer.GetActiveCamera())\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Saving a scene to a file.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('data_file', help='A polydata file e.g. Armadillo.ply.')\n    parser.add_argument('scene_file', help='The file to save the scene to.')\n    args = parser.parse_args()\n    return args.data_file, args.scene_file\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == '.ply':\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtp':\n        reader = vtkXMLpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.obj':\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.stl':\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.vtk':\n        reader = vtkpoly_dataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == '.g':\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\ndef SaveSceneToFile(file_name, actor, camera):\n    # Actor\n    #   Position, orientation, origin, scale, usrmatrix, usertransform\n    # Camera\n    #   FocalPoint, Position, ViewUp, ViewAngle, ClippingRange\n\n    fp_format = '{0:.6f}'\n    res = dict()\n    res['Camera:FocalPoint'] = ', '.join(fp_format.format(n) for n in camera.GetFocalPoint())\n    res['Camera:Position'] = ', '.join(fp_format.format(n) for n in camera.GetPosition())\n    res['Camera:ViewUp'] = ', '.join(fp_format.format(n) for n in camera.GetViewUp())\n    res['Camera:ViewAngle'] = fp_format.format(camera.GetViewAngle())\n    res['Camera:ClippingRange'] = ', '.join(fp_format.format(n) for n in camera.GetClippingRange())\n    with open(file_name, 'w') as f:\n        for k, v in res.items():\n            f.write(k + ' ' + v + '\\n')\n\n\ndef RestoreSceneFromFile(file_name, actor, camera):\n    import re\n\n    # Some regular expressions.\n\n    reCP = re.compile(r'^Camera:Position')\n    reCFP = re.compile(r'^Camera:FocalPoint')\n    reCVU = re.compile(r'^Camera:ViewUp')\n    reCVA = re.compile(r'^Camera:ViewAngle')\n    reCCR = re.compile(r'^Camera:ClippingRange')\n    keys = [reCP, reCFP, reCVU, reCVA, reCCR]\n\n    # float_number = re.compile(r'[^0-9.\\-]*([0-9e.\\-]*[^,])[^0-9.\\-]*([0-9e.\\-]*[^,])[^0-9.\\-]*([0-9e.\\-]*[^,])')\n    # float_scalar = re.compile(r'[^0-9.\\-]*([0-9.\\-e]*[^,])')\n\n    res = dict()\n    with open(file_name, 'r') as f:\n        for cnt, line in enumerate(f):\n            if not line.strip():\n                continue\n            line = line.strip().replace(',', '').split()\n            for i in keys:\n                m = re.match(i, line[0])\n                if m:\n                    k = m.group(0)\n                    if m:\n                        #  Convert the rest of the line to floats.\n                        v = list(map(lambda x: float(x), line[1:]))\n                        if len(v) == 1:\n                            res[k] = v[0]\n                        else:\n                            res[k] = v\n    for k, v in res.items():\n        if re.match(reCP, k):\n            camera.SetPosition(v)\n        elif re.match(reCFP, k):\n            camera.SetFocalPoint(v)\n        elif re.match(reCVU, k):\n            camera.SetViewUp(v)\n        elif re.match(reCVA, k):\n            camera.SetViewAngle(v)\n        elif re.match(reCCR, k):\n            camera.SetClippingRange(v)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/Screenshot/","title":"Screenshot","text":"

        vtk-examples/Python/Utilities/Screenshot

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/Screenshot/#code","title":"Code","text":"

        Screenshot.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOImage import vtkPNGWriter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('Screenshot')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create source\n    source = vtkSphereSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(5.0)\n    source.SetPhiResolution(30)\n    source.SetThetaResolution(30)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('IndianRed'))\n    actor.GetProperty().SetSpecular(0.6)\n    actor.GetProperty().SetSpecularPower(30)\n    actor.SetMapper(mapper)\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('MistyRose'))\n\n    renWin.Render()\n\n    # screenshot code:\n    w2if = vtkWindowToImageFilter()\n    w2if.SetInput(renWin)\n    w2if.SetInputBufferTypeToRGB()\n    w2if.ReadFrontBufferOff()\n    w2if.Update()\n\n    writer = vtkPNGWriter()\n    writer.SetFileName('TestScreenshot.png')\n    writer.SetInputConnection(w2if.GetOutputPort())\n    writer.Write()\n\n    # enable user interface interactor\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/SelectExamples/","title":"SelectExamples","text":"

        vtk-examples/Python/Utilities/SelectExamples

        "},{"location":"Python/Utilities/SelectExamples/#description","title":"Description","text":"

        This script allows you to obtain a list of examples corresponding to a particular VTK Class and a given language.

        In order to do this, a JSON file listing the vtk examples by VTK class is obtained from the gh-pages branch of the vtk-examples GitHub site. When this script runs, it checks for the existence of this JSON file in your temporary folder, downloading it if it doesn't exist. If it already exists, then it is updated if the file is more than ten minutes old.

        When you run this script by specifying the VTK Class and Language (one of: CSharp, Cxx, Java, Python, PythonicAPI), a list of links to the respective examples containing that class is returned. By default five or fewer examples are returned. If there are more than five examples for a class then five examples are randomly selected. You can override the maximum number of examples (e.g. -n20) or select all examples -a.

        Note

        Options are also provided to force an overwrite of downloaded the JSON file (-o) or to change the URL to the JSON file (-j)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/SelectExamples/#code","title":"Code","text":"

        SelectExamples.py

        #!/usr/bin/env python\n\nimport json\nimport os\nimport random\nimport tempfile\nfrom datetime import datetime\nfrom operator import itemgetter\nfrom pathlib import Path\nfrom urllib.error import HTTPError\nfrom urllib.request import urlretrieve\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Get examples that use a particular VTK class for a given language.'\n    epilogue = '''\nThe JSON file needed by this script is obtained from the gh-pages branch\n of the vtk-examples GitHub site.\nIt is stored in your tempfile directory.\nIf you change the URL to the JSON file, remember that there is a ten minute\nwait before you can overwrite the last downloaded file. To force the download\nspecify -o on the command line.\n\nHere is the URL for an alternative site for testing:\n\"https://raw.githubusercontent.com/ajpmaclean/web-test/gh-pages/src/Coverage/vtk_vtk-examples_xref.json\"\n\n'''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('vtk_class', help='The desired VTK class.')\n    parser.add_argument('language', help='The desired language, one of: CSharp, Cxx, Java, Python.')\n    parser.add_argument('-a', '--all_values', action=\"store_true\",\n                        help='All examples (Warning: Can be a very long list).')\n    parser.add_argument('-n', '--number', type=int, default=5, help='The maximum number of examples.')\n    parser.add_argument('-m', '--md', action=\"store_true\",\n                        help='Display links in markdown inline format e.g. [label](URL).')\n    parser.add_argument('-j', '--json_xref_url',\n                        default='https://raw.githubusercontent.com/Kitware/vtk-examples/gh-pages/src/Coverage/vtk_vtk-examples_xref.json',\n                        help='The URL for the JSON cross-reference file.')\n    parser.add_argument('-o', '--overwrite', action=\"store_true\",\n                        help='Force an initial download of the JSON cross-reference file.')\n\n    args = parser.parse_args()\n    return args.vtk_class, args.language, args.all_values, args.md, args.number, args.json_xref_url, args.overwrite\n\n\ndef download_file(dl_path, dl_url, overwrite=False):\n    \"\"\"\n    Use the URL to get a file.\n\n    :param dl_path: The path to download the file to.\n    :param dl_url: The URL of the file.\n    :param overwrite: If true, do a download even if the file exists.\n    :return: The path to the file as a pathlib Path.\n    \"\"\"\n    file_name = dl_url.split('/')[-1]\n\n    # Create necessary subdirectories in the dl_path\n    # (if they don't exist).\n    Path(dl_path).mkdir(parents=True, exist_ok=True)\n    # Download if it doesn't exist in the directory overriding if overwrite is True.\n    path = Path(dl_path, file_name)\n    if not path.is_file() or overwrite:\n        try:\n            urlretrieve(dl_url, path)\n        except HTTPError as e:\n            raise RuntimeError(f'Failed to download {dl_url}. {e.reason}')\n    return path\n\n\ndef get_examples(d, vtk_class, lang, all_values=False, number=5, md_fmt=False):\n    \"\"\"\n    For the VTK Class and language return the\n     total number of examples and a list of examples.\n\n    :param d: The dictionary.\n    :param vtk_class: The VTK Class e.g. vtkActor.\n    :param lang: The language, e.g. Cxx.\n    :param all_values: True if all examples are needed.\n    :param number: The number of values.\n    :param md_fmt: Use Markdown format with label and URL defined together.\n    :return: Total number of examples and a list of examples.\n    \"\"\"\n    try:\n        kv = d[vtk_class][lang].items()\n    except KeyError:\n        return None, None\n    if len(kv) > number:\n        if all_values:\n            samples = list(kv)\n        else:\n            samples = random.sample(list(kv), number)\n    else:\n        samples = kv\n    if md_fmt:\n        links = [f'[{s.rsplit(\"/\", 1)[1]}]({s})' for s in sorted(map(itemgetter(1), samples))]\n    else:\n        links = sorted(map(itemgetter(1), samples))\n    return len(links), links\n\n\ndef get_crossref_dict(ref_dir, xref_url, overwrite=False):\n    \"\"\"\n    Download and return the json cross-reference file.\n\n    This function ensures that the dictionary is recent.\n\n    :param ref_dir: The directory where the file will be downloaded.\n    :param xref_url: The URL for the JSON cross-reference file.\n    :param overwrite: If true, do a download even if the file exists.\n    :return: The dictionary cross-referencing vtk classes to examples.\n    \"\"\"\n    path = download_file(ref_dir, xref_url, overwrite=overwrite)\n    if not path.is_file():\n        print(f'The path: {str(path)} does not exist.')\n        return None\n    dt = datetime.today().timestamp() - os.path.getmtime(path)\n    # Force a new download if the time difference is > 10 minutes.\n    if dt > 600:\n        path = download_file(ref_dir, xref_url, overwrite=True)\n    with open(path) as json_file:\n        return json.load(json_file)\n\n\ndef main():\n    vtk_class, language, all_values, md, number, xref_url, overwrite = get_program_parameters()\n    language = language.lower()\n    available_languages = {k.lower(): k for k in ['CSharp', 'Cxx', 'Java', 'Python', 'PythonicAPI']}\n    available_languages.update({'cpp': 'Cxx', 'c++': 'Cxx', 'c#': 'CSharp'})\n    if language not in available_languages:\n        print(f'The language: {language} is not available.')\n        tmp = ', '.join(sorted([lang for lang in set(available_languages.values())]))\n        print(f'Choose one of these: {tmp}.')\n        return\n    else:\n        language = available_languages[language]\n    xref_dict = get_crossref_dict(tempfile.gettempdir(), xref_url, overwrite)\n    if xref_dict is None:\n        print('The dictionary cross-referencing vtk classes to examples was not downloaded.')\n        return\n\n    total_number, examples = get_examples(xref_dict, vtk_class, language, all_values=all_values, number=number,\n                                          md_fmt=md)\n    if examples:\n        if total_number <= number or all_values:\n            print(f'VTK Class: {vtk_class}, language: {language}\\n'\n                  f'Number of example(s): {total_number}.')\n        else:\n            print(f'VTK Class: {vtk_class}, language: {language}\\n'\n                  f'Number of example(s): {total_number} with {number} random sample(s) shown.')\n        print('\\n'.join(examples))\n    else:\n        print(f'No examples for the VTK Class: {vtk_class} and language: {language}')\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/ShareCamera/","title":"ShareCamera","text":"

        vtk-examples/Python/Utilities/ShareCamera

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/ShareCamera/#code","title":"Code","text":"

        ShareCamera.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkCylinderSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # We store background colors in a vector. Then we extract the red, green and\n    # blue components later when coloring the reneder background.\n    rendererColors = list()\n    colorSeries = vtkColorSeries()\n    colorSeries.SetColorSchemeByName('Brewer Qualitative Pastel2')\n    rendererColors.append(colorSeries.GetColor(0))\n    rendererColors.append(colorSeries.GetColor(1))\n    rendererColors.append(colorSeries.GetColor(2))\n    rendererColors.append(colorSeries.GetColor(3))\n\n    renderWindow = vtkRenderWindow()\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Define viewport ranges\n    xmins = [0, 0.5, 0, 0.5]\n    xmaxs = [0.5, 1, 0.5, 1]\n    ymins = [0, 0, 0.5, 0.5]\n    ymaxs = [0.5, 0.5, 1, 1]\n\n    # Using the superclass for the sources\n    sources = list()\n\n    for i in range(0, 4):\n        if i == 0:\n            # Create a sphere\n            sphereSource = vtkSphereSource()\n            sphereSource.SetCenter(0.0, 0.0, 0.0)\n            sphereSource.Update()\n            sources.append(sphereSource)\n        elif i == 1:\n            # Create a cone\n            coneSource = vtkConeSource()\n            coneSource.SetCenter(0.0, 0.0, 0.0)\n            coneSource.Update()\n            sources.append(coneSource)\n        elif i == 2:\n            # Create a cube\n            cubeSource = vtkCubeSource()\n            cubeSource.SetCenter(0.0, 0.0, 0.0)\n            cubeSource.Update()\n            sources.append(cubeSource)\n        else:\n            # Create a cylinder\n            cylinderSource = vtkCylinderSource()\n            cylinderSource.SetCenter(0.0, 0.0, 0.0)\n            cylinderSource.Update()\n            sources.append(cylinderSource)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(sources[i].GetOutputPort())\n\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n        actor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n        renderer = vtkRenderer()\n        renderer.AddActor(actor)\n        r = rendererColors[i].GetRed() / 255.0\n        g = rendererColors[i].GetGreen() / 255.0\n        b = rendererColors[i].GetBlue() / 255.0\n        renderer.SetBackground(r, g, b)\n\n        renderWindow.AddRenderer(renderer)\n\n        if i == 0:\n            camera = renderer.GetActiveCamera()\n            camera.Azimuth(30)\n            camera.Elevation(30)\n        else:\n            renderer.SetActiveCamera(camera)\n\n        renderer.SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i])\n\n        renderer.ResetCamera()\n\n    renderWindow.Render()\n    renderWindow.SetWindowName('ShareCamera')\n\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/VTKImportsForPython/","title":"VTKImportsForPython","text":"

        vtk-examples/Python/Utilities/VTKImportsForPython

        "},{"location":"Python/Utilities/VTKImportsForPython/#description","title":"Description","text":"

        Use this to generate a series of import statements for your Python code.

        The imports are generated using the VTK modules, along with the VTK classes and constants in your Python source file(s). For older versions of VTK, modules.json is required, this is found in your VTK build directory.

        When this script is run against your code, a series of from ... import statements are generated, based on the classes you have used. The result will be output to the console, or, alternatively to a text file with extension .txt. The first line is the program name and subsequent lines are the import statements.

        At the end of the list there is a series of commented out statements consisting of imports that you may need to enable. Only enable the ones you really need and include the statement # noinspection PyUnresolvedReferences for PyCharm users, as this will prevent the statement from being removed.

        e.g The most common ones will be:

            # noinspection PyUnresolvedReferences\n    import vtkmodules.vtkInteractionStyle\n    # noinspection PyUnresolvedReferences\n    import vtkmodules.vtkRenderingOpenGL2\n

        Make sure that any of these statements are placed after the last from ... import ... statement. Also remove any unused ones.

        As an example, if you have used import vtk, you can replace it with with these statements. This means that only the relevant VTK modules are loaded when the Python program runs.

        Of course after adding these statements you may need to edit your code e.g. changing x = vtk.vtkSomeClass() to x = vtkSomeClass().

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/VTKImportsForPython/#code","title":"Code","text":"

        VTKImportsForPython.py

        #!/usr/bin/env python\n\nimport collections\nimport importlib\nimport json\nimport re\nfrom pathlib import Path\n\nfrom vtkmodules.vtkCommonCore import vtkVersion\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Generate import statements for the VTK classes in your Python code.'\n    epilogue = '''\nThe output will contain program name(s) followed by the import statements.\nYou can specify a folder for the Python sources or paths to several sources.\n\nNote: If there are spaces in the paths, enclose the path in quotes.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('-j', '--json',\n                        help='The path to the VTK JSON file (modules.json).')\n    parser.add_argument('sources', nargs='+', help='The path to a folder of Python files or to a Python file.')\n    parser.add_argument('-f', '--file', help='The file name to write the output too.')\n    args = parser.parse_args()\n    return args.json, args.sources, args.file\n\n\nclass Patterns:\n    vtk_patterns = [\n        # Class pattern.\n        re.compile(r'(vtk[a-zA-Z0-9]+)\\('),\n        # Constants pattern.\n        re.compile(r'(VTK_[A-Z_]+)'),\n        # Special patterns ...\n        re.compile(r'(mutable)\\('),\n        # Handle vtkClass.yyy\n        re.compile(r'(vtk[a-zA-Z0-9]+)\\.'),\n        # Handle class xx(vtkClass):\n        re.compile(r'\\( ?(vtk[a-zA-Z0-9]+) ?\\)'),\n    ]\n    skip_patterns = [\n        # Empty lines\n        re.compile(r'^ *$'),\n        # import ...\n        re.compile(r'^ *import'),\n        # from ... import ...\n        re.compile(r'^ *from[ \\S]+import'),\n        # Any vtk class on its own\n        re.compile(r'^ *vtk[a-zA-Z0-9]+,*$'),\n        # Single closing bracket\n        re.compile(r'^ *\\)+$'),\n    ]\n\n\ndef get_available_modules(jpath):\n    \"\"\"\n    From the parsed JSON data file make a list of the VTK modules.\n\n    :param jpath: The JSON file path.\n    :return: VTK Classes and modules.\n    \"\"\"\n    with open(jpath) as data_file:\n        json_data = json.load(data_file)\n\n    res = list()\n    for k in json_data['modules'].keys():\n        m = k.split('::')\n        if len(m) > 1:\n            res.append(f'vtk{m[1]}')\n    return sorted(res)\n\n\ndef get_classes_constants(paths):\n    \"\"\"\n    Extract the vtk class names and constants from the path.\n\n    :param paths: The path(s) to the Python file(s).\n    :return: The file name, the VTK classes and any VTK constants.\n    \"\"\"\n\n    res = collections.defaultdict(set)\n    for path in paths:\n        content = path.read_text().split('\\n')\n        for line in content:\n            for pattern in Patterns.skip_patterns:\n                m = pattern.search(line)\n                if m:\n                    continue\n            for pattern in Patterns.vtk_patterns:\n                m = pattern.search(line)\n                if m:\n                    for g in m.groups():\n                        res[str(path)].add(g)\n    return res\n\n\ndef format_imports(imports):\n    name_keys = sorted(imports.keys())\n    res = list()\n    for name in name_keys:\n        res.append(f'\\n{name}')\n        module_keys = sorted(imports[name].keys())\n        for module in module_keys:\n            classes = sorted(list(imports[name][module]))\n            if len(classes) == 1:\n                res.append(f'from vtkmodules.{module} import {classes[0]}')\n            else:\n                c_list = list()\n                for c in classes:\n                    c_list.append(f'    {c}')\n                s = '(\\n'\n                s += ',\\n'.join(c_list)\n                s += '\\n    )'\n                res.append(f'from vtkmodules.{module} import {s}')\n        additional_modules = ['vtkInteractionStyle', 'vtkRenderingFreeType',\n                              'vtkRenderingContextOpenGL2', 'vtkRenderingOpenGL2', 'vtkRenderingVolumeOpenGL2',\n                              'vtkRenderingUI']\n        comments = [\n            '',\n            '# You may need to uncomment one or more of the following imports.',\n            '# If vtkRenderWindow is used and you want to use OpenGL,',\n            '#   you also need the vtkRenderingOpenGL2 module.',\n            '# If vtkRenderWindowInteractor is used, uncomment vtkInteractionStyle',\n            '# If text rendering is used, uncomment vtkRenderingFreeType.',\n            '#',\n            '# If using PyCharm, preface each one you select with this line:',\n            '# noinspection PyUnresolvedReferences',\n            '#',\n        ]\n        res += comments\n        for module in sorted(additional_modules):\n            res.append(f'# import vtkmodules.{module}')\n        res.append('')\n    return res\n\n\ndef main(json_path, src_paths, ofn):\n    use_json = not vtk_version_ok(9, 0, 20210918)\n    if use_json:\n        if not json_path:\n            print('modules.json (from your VTK build directory) is needed.')\n            return\n        jpath = Path(json_path)\n        if jpath.is_dir():\n            jpath = jpath / 'modules.json'\n        if not jpath.is_file():\n            print(f'Non existent JSON file: {jpath}')\n    else:\n        jpath = None\n\n    paths = list()\n    for fn in src_paths:\n        path = Path(fn)\n        if path.is_file() and path.suffix == '.py':\n            paths.append(path)\n        elif path.is_dir():\n            path_list = list(Path(fn).rglob('*.py'))\n            program_path = Path(__file__)\n            for path in path_list:\n                if path.resolve() != program_path.resolve():\n                    paths.append(path)\n        else:\n            print(f'Non existent path: {path}')\n\n    classes_constants = get_classes_constants(paths)\n    if not classes_constants:\n        print('No classes or constants were present.')\n        return\n\n    if use_json:\n        vtk_modules = get_available_modules(jpath)\n    else:\n        vtklib = importlib.__import__('vtkmodules')\n        vtk_modules = sorted(vtklib.__all__)\n\n    name_to_module = dict()\n    for module in vtk_modules:\n        try:\n            module_dict = importlib.import_module('vtkmodules.' + module).__dict__\n            for name in module_dict:\n                name_to_module[name] = module\n        except ModuleNotFoundError:\n            # print(module, ' not found.')\n            continue\n\n    imports = collections.defaultdict(lambda: collections.defaultdict(set))\n    for name, classes_constants in classes_constants.items():\n        for vtk_class in classes_constants:\n            if vtk_class in name_to_module:\n                module = name_to_module[vtk_class]\n                imports[name][module].add(vtk_class)\n\n    res = format_imports(imports)\n    if ofn:\n        path = Path(ofn)\n        if path.suffix == '':\n            path = Path(ofn).with_suffix('.txt')\n        path.write_text('\\n'.join(res))\n    else:\n        print('\\n'.join(res))\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    import sys\n\n    json_path, src_paths, ofn = get_program_parameters(sys.argv)\n    main(json_path, src_paths, ofn)\n
        "},{"location":"Python/Utilities/VTKModulesForCxx/","title":"VTKModulesForCxx","text":"

        vtk-examples/Python/Utilities/VTKModulesForCxx

        "},{"location":"Python/Utilities/VTKModulesForCxx/#description","title":"Description","text":"

        Use this to generate a find_package(VTK COMPONENTS ...) command for CMake.

        It requires modules.json, found in your VTK build folder, and your source files. After running, it will generate a find_package(VTK COMPONENTS ...) command listing all the vtk modules needed by the C++ source and header files in your code.

        Paths for more than one source path can be specified. If there are spaces in the paths, enclose the path in quotes.

        If it is unable to find modules for your headers then a list of these, along with the files they are in, is produced so you can manually add the corresponding modules or rebuild VTK to include the missing modules.

        You will need to manually add any third-party modules (if used) to the find_package command.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/VTKModulesForCxx/#code","title":"Code","text":"

        VTKModulesForCxx.py

        #!/usr/bin/env python\n\nimport collections\nimport json\nimport os\nimport re\nfrom pathlib import Path\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Generate a find_package(VTK COMPONENTS ...) command for CMake.'\n    epilogue = '''\nUses modules.json and your source files to generate a\n  find_package(VTK COMPONENTS ...) command listing all the vtk modules\n  needed by the C++ source and header files in your code.\n\nPaths for more than one source path can be specified.\n\nNote than if there are spaces in the paths, enclose the path in quotes.\n\nIf it is unable to find modules for your headers then\n  a list of these, along with the files they are in, is produced\n  so you can manually add the corresponding modules or rebuild VTK\n  to include the missing modules.\n\nYou will need to manually add any third-party modules\n   (if used) to the find_package command.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('json', default=['modules.json'], help='The path to the VTK JSON file (modules.json).')\n    parser.add_argument('sources', nargs='+', help='The path to the source files.')\n    parser.add_argument('-f', '--file', help='The file name to write the output too.')\n    args = parser.parse_args()\n    return args.json, args.sources, args.file\n\n\nclass Patterns:\n    header_pattern = re.compile(r'^#include *[<\\\"](\\S+)[>\\\"]')\n    vtk_include_pattern = re.compile(r'^(vtk\\S+)')\n    vtk_qt_include_pattern = re.compile(r'^(QVTK\\S+)')\n\n\ndef get_headers_modules(json_data):\n    \"\"\"\n    From the parsed JSON data file make a dictionary whose key is the\n     header filename and value is the module.\n    :param json_data: The parsed JSON file modules.json.\n    :return:\n    \"\"\"\n\n    # The headers should be unique to a module, however we will not assume this.\n    res = collections.defaultdict(set)\n    for k, v in json_data['modules'].items():\n        if 'headers' in v:\n            for k1 in v['headers']:\n                res[k1].add(k)\n    return res\n\n\ndef get_vtk_components(jpath, paths):\n    \"\"\"\n    Get the VTK components\n    :param jpath: The path to the JSON file.\n    :param paths: The C++ file paths.\n    :return:\n    \"\"\"\n\n    with open(jpath) as data_file:\n        json_data = json.load(data_file)\n    vtk_headers_modules = get_headers_modules(json_data)\n\n    modules = set()\n    inc_no_mod = set()\n    inc_no_mod_headers = collections.defaultdict(set)\n    mod_implements = collections.defaultdict(set)\n    headers = collections.defaultdict(set)\n\n    for path in paths:\n        if path.is_file():\n            content = path.read_text().split('\\n')\n            for line in content:\n                m = Patterns.header_pattern.match(line.strip())\n                if m:\n                    # We have a header name, split it from its path (if the path exists).\n                    header_parts = os.path.split(m.group(1))\n                    m = Patterns.vtk_include_pattern.match(header_parts[1])\n                    if m:\n                        headers[m.group(1)].add(path)\n                        continue\n                    m = Patterns.vtk_qt_include_pattern.match(header_parts[1])\n                    if m:\n                        headers[m.group(1)].add(path)\n    for incl in headers:\n        if incl in vtk_headers_modules:\n            m = vtk_headers_modules[incl]\n            for v in m:\n                modules.add(v)\n        else:\n            inc_no_mod.add(incl)\n            inc_no_mod_headers[incl] = headers[incl]\n\n    if headers:\n        for m in modules:\n            if not json_data['modules'][m]['implementable']:\n                continue\n            for i in json_data['modules']:\n                if i in modules:\n                    continue\n                if m in json_data['modules'][i]['implements']:\n                    # Suggest module i since it implements m\n                    mod_implements[i].add(m)\n\n    return modules, mod_implements, inc_no_mod, inc_no_mod_headers\n\n\ndef disp_components(modules, module_implements):\n    \"\"\"\n    For the found modules display them in a form that the user can\n     copy/paste into their CMakeLists.txt file.\n    :param modules: The modules.\n    :param module_implements: Modules implementing other modules.\n    :return:\n    \"\"\"\n    res = ['find_package(VTK\\n COMPONENTS']\n    for m in sorted(modules):\n        res.append('    {:s}'.format(m.split('::')[1]))\n    if module_implements:\n        keys = sorted(module_implements)\n        max_width = len(max(keys, key=len).split('::')[1])\n        comments = [\n            '    #',\n            '    # These modules are suggested since they implement an existing module.',\n            '    # You may need to uncomment one or more of these.',\n            '    # If vtkRenderWindow is used and you want to use OpenGL,',\n            '    #   you also need the RenderingOpenGL2 module.',\n            '    # If vtkRenderWindowInteractor is used,',\n            '    #    uncomment RenderingUI and possibly InteractionStyle.',\n            '    # If text rendering is used, uncomment RenderingFreeType',\n            '    #'\n        ]\n        res.extend(comments)\n        for key in keys:\n            res.append(\n                f'    # {key.split(\"::\")[1]:<{max_width}} # implements {\", \".join(sorted(module_implements[key]))}')\n    res.append(')\\n')\n\n    return res\n\n\ndef disp_missing_components(inc_no_mod, inc_no_mod_headers):\n    \"\"\"\n    Display the headers along with the missing VTK modules.\n\n    :param inc_no_mod: Missing modules.\n    :param inc_no_mod_headers: Headers with missing modules.\n    :return:\n    \"\"\"\n    if inc_no_mod:\n        res = [''\n               '*' * 64,\n               'You will need to manually add the modules that',\n               '  use these headers to the find_package command.',\n               'These could be external modules not in the modules.json file.',\n               'Or you may need to rebuild VTK to include the missing modules.',\n               '',\n               'Here are the vtk headers and corresponding files:']\n        sinmd = sorted(inc_no_mod)\n        for i in sinmd:\n            sh = sorted(list(inc_no_mod_headers[i]))\n            res.append(f'in {i}:')\n            for j in sh:\n                res.append(f'   {j}')\n        res.append('*' * 64)\n\n        return res\n    else:\n        return None\n\n\ndef main(json_path, src_paths, ofn):\n    jpath = Path(json_path)\n    if jpath.is_dir():\n        jpath = jpath / 'modules.json'\n    if not jpath.is_file():\n        print(f'Non existent JSON file: {jpath}')\n        return\n\n    paths = list()\n    valid_ext = ['.h', '.hxx', '.cxx', '.cpp', '.txx']\n    path_list = list()\n    for fn in src_paths:\n        path = Path(fn)\n        if path.is_file() and path.suffix in valid_ext:\n            paths.append(path)\n        elif path.is_dir():\n            for e in valid_ext:\n                path_list += list(Path(fn).rglob(f'*{e}'))\n            program_path = Path(__file__)\n            for path in path_list:\n                if path.resolve() != program_path.resolve():\n                    paths.append(path)\n        else:\n            print(f'Non existent path: {path}')\n\n    modules, mod_implements, inc_no_mod, inc_no_mod_headers = get_vtk_components(jpath, paths)\n\n    res = '\\n'.join(disp_components(modules, mod_implements))\n    if inc_no_mod:\n        res += '\\n'.join(disp_missing_components(inc_no_mod, inc_no_mod_headers))\n\n    if ofn:\n        path = Path(ofn)\n        if path.suffix == '':\n            path = Path(ofn).with_suffix('.txt')\n        path.write_text(res)\n    else:\n        print(res)\n\n\nif __name__ == '__main__':\n    import sys\n\n    json_paths, src_paths, ofn = get_program_parameters(sys.argv)\n    main(json_paths, src_paths, ofn)\n
        "},{"location":"Python/Utilities/VTKWithNumpy/","title":"VTKWithNumpy","text":"

        vtk-examples/Python/Utilities/VTKWithNumpy

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/VTKWithNumpy/#code","title":"Code","text":"

        VTKWithNumpy.py

        # An example from scipy cookbook demonstrating the use of numpy arrays in vtk\n\nimport numpy as np\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPiecewiseFunction\nfrom vtkmodules.vtkIOImage import vtkImageImport\nfrom vtkmodules.vtkRenderingCore import (\n    vtkColorTransferFunction,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkVolume,\n    vtkVolumeProperty\n)\nfrom vtkmodules.vtkRenderingVolume import vtkFixedPointVolumeRayCastMapper\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkRenderingVolumeOpenGL2 import vtkOpenGLRayCastImageDisplayHelper\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # We begin by creating the data we want to render.\n    # For this tutorial, we create a 3D-image containing three overlaping cubes.\n    # This data can of course easily be replaced by data from a medical CT-scan or anything else three dimensional.\n    # The only limit is that the data must be reduced to unsigned 8 bit or 16 bit integers.\n    data_matrix = np.zeros([75, 75, 75], dtype=np.uint8)\n    data_matrix[0:35, 0:35, 0:35] = 50\n    data_matrix[25:55, 25:55, 25:55] = 100\n    data_matrix[45:74, 45:74, 45:74] = 150\n\n    # For VTK to be able to use the data, it must be stored as a VTK-image.\n    #  This can be done by the vtkImageImport-class which\n    # imports raw data and stores it.\n    dataImporter = vtkImageImport()\n    # The previously created array is converted to a string of chars and imported.\n    data_string = data_matrix.tobytes()\n    dataImporter.CopyImportVoidPointer(data_string, len(data_string))\n    # The type of the newly imported data is set to unsigned char (uint8)\n    dataImporter.SetDataScalarTypeToUnsignedChar()\n    # Because the data that is imported only contains an intensity value\n    #  (it isnt RGB-coded or someting similar), the importer must be told this is the case.\n    dataImporter.SetNumberOfScalarComponents(1)\n    # The following two functions describe how the data is stored and the dimensions of the array it is stored in.\n    #  For this simple case, all axes are of length 75 and begins with the first element.\n    #  For other data, this is probably not the case.\n    # I have to admit however, that I honestly dont know the difference between SetDataExtent()\n    #  and SetWholeExtent() although VTK complains if not both are used.\n    dataImporter.SetDataExtent(0, 74, 0, 74, 0, 74)\n    dataImporter.SetWholeExtent(0, 74, 0, 74, 0, 74)\n\n    # The following class is used to store transparency-values for later retrival.\n    #  In our case, we want the value 0 to be\n    # completely opaque whereas the three different cubes are given different transparency-values to show how it works.\n    alphaChannelFunc = vtkPiecewiseFunction()\n    alphaChannelFunc.AddPoint(0, 0.0)\n    alphaChannelFunc.AddPoint(50, 0.05)\n    alphaChannelFunc.AddPoint(100, 0.1)\n    alphaChannelFunc.AddPoint(150, 0.2)\n\n    # This class stores color data and can create color tables from a few color points.\n    #  For this demo, we want the three cubes to be of the colors red green and blue.\n    colorFunc = vtkColorTransferFunction()\n    colorFunc.AddRGBPoint(50, 1.0, 0.0, 0.0)\n    colorFunc.AddRGBPoint(100, 0.0, 1.0, 0.0)\n    colorFunc.AddRGBPoint(150, 0.0, 0.0, 1.0)\n\n    # The previous two classes stored properties.\n    #  Because we want to apply these properties to the volume we want to render,\n    # we have to store them in a class that stores volume properties.\n    volumeProperty = vtkVolumeProperty()\n    volumeProperty.SetColor(colorFunc)\n    volumeProperty.SetScalarOpacity(alphaChannelFunc)\n\n    volumeMapper = vtkFixedPointVolumeRayCastMapper()\n    volumeMapper.SetInputConnection(dataImporter.GetOutputPort())\n\n    # The class vtkVolume is used to pair the previously declared volume as well as the properties\n    #  to be used when rendering that volume.\n    volume = vtkVolume()\n    volume.SetMapper(volumeMapper)\n    volume.SetProperty(volumeProperty)\n\n    # With almost everything else ready, its time to initialize the renderer and window, as well as\n    #  creating a method for exiting the application\n    renderer = vtkRenderer()\n    renderWin = vtkRenderWindow()\n    renderWin.AddRenderer(renderer)\n    renderInteractor = vtkRenderWindowInteractor()\n    renderInteractor.SetRenderWindow(renderWin)\n\n    # We add the volume to the renderer ...\n    renderer.AddVolume(volume)\n    renderer.SetBackground(colors.GetColor3d(\"MistyRose\"))\n\n    # ... and set window size.\n    renderWin.SetSize(400, 400)\n    renderWin.SetWindowName('VTKWithNumpy')\n\n    # A simple function to be called when the user decides to quit the application.\n    def exitCheck(obj, event):\n        if obj.GetEventPending() != 0:\n            obj.SetAbortRender(1)\n\n    # Tell the application to use the function as an exit check.\n    renderWin.AddObserver(\"AbortCheckEvent\", exitCheck)\n\n    renderInteractor.Initialize()\n    # Because nothing will be rendered without any input, we order the first render manually\n    #  before control is handed over to the main-loop.\n    renderWin.Render()\n    renderInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Utilities/Variant/","title":"Variant","text":"

        vtk-examples/Python/Utilities/Variant

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Utilities/Variant/#code","title":"Code","text":"

        Variant.py

        from __future__ import print_function\n\nimport sys\n\nimport vtkmodules.all as vtk\n\n# Unicode string for demonstration (etre with circumflex)\nif sys.hexversion >= 0x03000000:\n    unicodeEtre = '\\xeatre'  # unicode in Python 3\nelse:\n    unicodeEtre = unicode('\\xeatre', 'latin1')  # noqa: F821\n\n#\n# Basic vtkVariant usage\n#\n\n# Default constructor\nv = vtk.vtkVariant()\nprint(\"Invalid variant: %r, '%s'\" % (v, v.GetTypeAsString()))\n\n# Copy constructor\nv = vtk.vtkVariant(vtk.vtkVariant(\"variant\"))\nprint(\"Copied variant: %r, '%s'\" % (v, v.GetTypeAsString()))\n\n# Conversion constructors\nv = vtk.vtkVariant(1)\nprint(\"Integer variant: %r, '%s'\" % (v, v.GetTypeAsString()))\nv = vtk.vtkVariant(1.0)\nprint(\"Float variant: %r, '%s'\" % (v, v.GetTypeAsString()))\nv = vtk.vtkVariant(\"hello\")\nprint(\"String variant: %r, '%s'\" % (v, v.GetTypeAsString()))\nv = vtk.vtkVariant(unicodeEtre)\nprint(\"Unicode variant: %r, '%s'\" % (v, v.GetTypeAsString()))\nv = vtk.vtkVariant(vtk.vtkStringArray())\nprint(\"Object variant: %r, '%s'\" % (v, v.GetTypeAsString()))\n\n# Explicit type constructor\nv1 = vtk.vtkVariant(1, vtk.VTK_UNSIGNED_SHORT)\nv2 = vtk.vtkVariant(2, v1.GetType())\nprint(\"UShort variant: %r, '%s'\" % (v2, v2.GetTypeAsString()))\n\n# Type checking\nif v2.IsUnsignedShort():\n    print(\"v2 is UnsignedShort\")\nelse:\n    print(\"v2 is not UnsignedShort, it is\", v2.GetTypeAsString())\n\n# Explicit value extraction\ns = v2.ToString()\nprint(\"String value: %s, %s\" % (s, type(s)))\ni = v2.ToInt()\nprint(\"Int value: %i, %s\" % (i, type(i)))\n\n# Automatic argument conversion\na = vtk.vtkVariantArray()\na.InsertNextValue(vtk.vtkVariant())\na.InsertNextValue(1)\na.InsertNextValue(2.0)\na.InsertNextValue(\"hello\")\na.InsertNextValue(unicodeEtre)\na.InsertNextValue(vtk.vtkVariantArray())\nprint(\"Variant array:\")\nfor i in range(a.GetNumberOfValues()):\n    v = a.GetValue(i)\n    print(\"%i: %r, '%s'\" % (i, v, v.GetTypeAsString()))\n\n# Comparison\nif v2 == vtk.vtkVariant(2):\n    print(\"v2 is equal to 2\")\nif v2 > vtk.vtkVariant(1):\n    print(\"v2 is greater than 1\")\nif v2 < vtk.vtkVariant(3):\n    print(\"v2 is less than 3\")\nif v2 == vtk.vtkVariant(\"2\"):\n    print(\"v2 is equal to '2'\")\n\n# Use as a dict key (hashed as a string)\nd = {}\nd[vtk.vtkVariant(1)] = 0\nd[vtk.vtkVariant('1')] = 1\nd[vtk.vtkVariant()] = 3\nprint(\"Index is %i\" % d[vtk.vtkVariant(1.0)])\n\n#\n# Extra functionality from vtk.util.vtkVariant\n#\n# These are templated functions in C++, but in Python\n# they take the template arg as a string instead,\n# e.g. vtkVariantCreate<unsigned int>(1) becomes\n#      vtkVariantCreate(1, 'unsigned int')\n\n# Creation\nv = vtk.vtkVariantCreate(1, 'unsigned int')\n\n# Value extraction\nv = vtk.vtkVariant(6.0)\nf = vtk.vtkVariantExtract(v)\n\n# Value extraction with type specified\nf = vtk.vtkVariantExtract(v, 'double')\n\n# Casting a variant\nv = vtk.vtkVariant(\"10\")\ni = vtk.vtkVariantCast(v, 'int')\nprint(\"Valid cast result: %r\" % i)\n\n# A failed cast returns None\nv = vtk.vtkVariant(\"hello\")\ni = vtk.vtkVariantCast(v, 'int')\nprint(\"Invalid cast result: %r\" % i)\n\n#\n# Comparisons and sorting: See VTK docs for more info\n#\n\n# Special function vtk.vtkVariantStrictWeakOrder:\n# Compare variants by type first, and then by value.  For Python 2, the\n# return values are -1, 0, 1 like the Python 2 \"cmp()\" method.  This is\n# in contrast with the Python 3 and C++ versions of this function, which\n# check if (v1 < v2) and return True or False.\nv1 = vtk.vtkVariant(10)\nv2 = vtk.vtkVariant(\"10\")\nr = vtk.vtkVariantStrictWeakOrder(v1, v2)\nprint(\"Strict weak order (10, '10') ->\", r)\n\n# Sorting by strict weak order, using a key function:\nunsorted = [1, 2.5, vtk.vtkVariant(), \"0\", unicodeEtre]\nl = [vtk.vtkVariant(x) for x in unsorted]\nl.sort(key=vtk.vtkVariantStrictWeakOrderKey)\nprint(\"Sort by weak order ->\", l)\n\n# Check two variants for strict equality of type and value.\nb = vtk.vtkVariantStrictEquality(v1, v2)\nprint(\"Strict equality (10, '10') -> %s\" % b)\n\n# Two special-purpose methods.\n# First is identical to (v1 < v2)\nb = vtk.vtkVariantLessThan(v1, v2)\n# Second is identical to (v1 == v2)\nb = vtk.vtkVariantEqual(v1, v2)\n
        "},{"location":"Python/Visualization/AlphaFrequency/","title":"AlphaFrequency","text":"

        vtk-examples/Python/Visualization/AlphaFrequency

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/AlphaFrequency/#code","title":"Code","text":"

        AlphaFrequency.py

        #!/usr/bin/env python\n\nimport re\nfrom collections import Counter\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersModeling import vtkLinearExtrusionFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Here we read the file keeping only the alpha characters\n    #  and calculate the frequency of each letter.\n    with open(fileName) as f:\n        freq = Counter()\n        for x in f:\n            remove_digits = re.sub('[\\d_]', '', x.strip().lower())\n            freq += Counter(re.findall('\\w', remove_digits, re.UNICODE))\n    maxFreq = max(list(freq.values()))\n    keys = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.lower())\n\n    #\n    # graphics stuff\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    #\n    # Setup letters\n    #\n    letters = list()\n    extrude = list()\n    mappers = list()\n    actors = list()\n    i = 0\n    for k in keys:\n        letters.append(vtkVectorText())\n        letters[i].SetText(k.upper())\n\n        extrude.append(vtkLinearExtrusionFilter())\n        extrude[i].SetInputConnection(letters[i].GetOutputPort())\n        extrude[i].SetExtrusionTypeToVectorExtrusion()\n        extrude[i].SetVector(0, 0, 1.0)\n        extrude[i].SetScaleFactor(float(freq[k]) / maxFreq * 2.50)\n\n        mappers.append(vtkPolyDataMapper())\n        mappers[i].SetInputConnection(extrude[i].GetOutputPort())\n        mappers[i].ScalarVisibilityOff()\n\n        actors.append(vtkActor())\n        actors[i].SetMapper(mappers[i])\n        actors[i].GetProperty().SetColor(colors.GetColor3d('Peacock'))\n\n        if freq[k] <= 0:\n            actors[i].VisibilityOff()\n        ren.AddActor(actors[i])\n        i += 1\n\n    # Position the actors.\n    y = 0.0\n    for j in range(0, 2):\n        x = 0.0\n        for i in range(0, 13):\n            actors[j * 13 + i].SetPosition(x, y, 0.0)\n            x += 1.5\n        y += -3.0\n\n    ren.ResetCamera()\n    ren.SetBackground(colors.GetColor3d('Silver'))\n    ren.GetActiveCamera().Elevation(30.0)\n    ren.GetActiveCamera().Azimuth(-30.0)\n    ren.GetActiveCamera().Dolly(1.25)\n    ren.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('AlphaFrequency')\n\n    # Interact with the data.\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Linearly extruded fonts to show letter frequency in text.'\n    epilogue = '''\n    Any file containing text can be used. \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Gettysburg.txt.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/AnnotatedCubeActor/","title":"AnnotatedCubeActor","text":"

        vtk-examples/Python/Visualization/AnnotatedCubeActor

        "},{"location":"Python/Visualization/AnnotatedCubeActor/#description","title":"Description","text":"

        The example demonstrates how to create and label an annotated cube actor.

        To colour the individual cube faces, see: ColoredAnnotatedCube.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/AnnotatedCubeActor/#code","title":"Code","text":"

        AnnotatedCubeActor.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkRenderingAnnotation import vtkAnnotatedCubeActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set up the renderer, window, and interactor.\n    #\n    ren = vtkRenderer()\n    ren.SetBackground(colors.GetColor3d('Wheat'))\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('AnnotatedCubeActor')\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    cube = vtkAnnotatedCubeActor()\n    cube.SetFaceTextScale(2.0 / 3.0)\n\n    # Anatomic labelling.\n    #\n    cube.SetXPlusFaceText('A')\n    cube.SetXMinusFaceText('P')\n    cube.SetYPlusFaceText('L')\n    cube.SetYMinusFaceText('R')\n    cube.SetZPlusFaceText('S')\n    cube.SetZMinusFaceText('I')\n\n    # Change the vector text colors.\n    #\n    cube.GetTextEdgesProperty().SetColor(\n        colors.GetColor3d('Black'))\n    cube.GetTextEdgesProperty().SetLineWidth(4)\n\n    cube.GetXPlusFaceProperty().SetColor(\n        colors.GetColor3d('Turquoise'))\n    cube.GetXMinusFaceProperty().SetColor(\n        colors.GetColor3d('Turquoise'))\n    cube.GetYPlusFaceProperty().SetColor(\n        colors.GetColor3d('Mint'))\n    cube.GetYMinusFaceProperty().SetColor(\n        colors.GetColor3d('Mint'))\n    cube.GetZPlusFaceProperty().SetColor(\n        colors.GetColor3d('Tomato'))\n    cube.GetZMinusFaceProperty().SetColor(\n        colors.GetColor3d('Tomato'))\n\n    ren.AddActor(cube)\n\n    # Set up an interesting view.\n    #\n    camera = ren.GetActiveCamera()\n    camera.SetViewUp(0, 0, 1)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetPosition(4.5, 4.5, 2.5)\n    ren.ResetCamera()\n    camera.Dolly(1.0)\n    ren.ResetCameraClippingRange()\n\n    ren_win.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/AssignCellColorsFromLUT/","title":"AssignCellColorsFromLUT","text":"

        vtk-examples/Python/Visualization/AssignCellColorsFromLUT

        "},{"location":"Python/Visualization/AssignCellColorsFromLUT/#description","title":"Description","text":"

        Demonstrates how to assign colors to cells in a vtkPolyData structure using lookup tables. Two techniques are demonstrated:

        1. Using a lookup table of predefined colors.
        2. Using a lookup table generated from a color transfer function.

        The resultant display shows in the left-hand column, the cells in a plane colored by the two lookup tables and in the right-hand column, the same polydata that has been read in from a file demonstrating that the structures are identical.

        The top row of the display uses the color transfer function to create a green to tan transition in a diverging color space. Note that the central square is white indicating the midpoint.

        The bottom row of the display uses a lookup table of predefined colors.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/AssignCellColorsFromLUT/#code","title":"Code","text":"

        AssignCellColorsFromLUT.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nDemonstrates how to assign colors to cells in a vtkPolyData structure using\n lookup tables.\nTwo techniques are demonstrated:\n1) Using a lookup table of predefined colors.\n2) Using a lookup table generated from a color transfer function.\n\nThe resultant display shows in the left-hand column, the cells in a plane\ncolored by the two lookup tables and in the right-hand column, the same\npolydata that has been read in from a file demonstrating that the structures\nare identical.\n\nThe top row of the display uses the color transfer function to create a\n green to tan transition in a diverging color space.\n Note that the central square is white indicating the midpoint.\nThe bottom row of the display uses a lookup table of predefined colors.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkUnsignedCharArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOXML import (\n    vtkXMLPolyDataReader,\n    vtkXMLPolyDataWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef MakeLUT(tableSize):\n    \"\"\"\n    Make a lookup table from a set of named colors.\n    :param: tableSize - The table size\n    :return: The lookup table.\n    \"\"\"\n    nc = vtkNamedColors()\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(tableSize)\n    lut.Build()\n\n    # Fill in a few known colors, the rest will be generated if needed\n    lut.SetTableValue(0, nc.GetColor4d(\"Black\"))\n    lut.SetTableValue(1, nc.GetColor4d(\"Banana\"))\n    lut.SetTableValue(2, nc.GetColor4d(\"Tomato\"))\n    lut.SetTableValue(3, nc.GetColor4d(\"Wheat\"))\n    lut.SetTableValue(4, nc.GetColor4d(\"Lavender\"))\n    lut.SetTableValue(5, nc.GetColor4d(\"Flesh\"))\n    lut.SetTableValue(6, nc.GetColor4d(\"Raspberry\"))\n    lut.SetTableValue(7, nc.GetColor4d(\"Salmon\"))\n    lut.SetTableValue(8, nc.GetColor4d(\"Mint\"))\n    lut.SetTableValue(9, nc.GetColor4d(\"Peacock\"))\n\n    return lut\n\n\ndef MakeLUTFromCTF(tableSize):\n    \"\"\"\n    Use a color transfer Function to generate the colors in the lookup table.\n    See: http://www.org/doc/nightly/html/classvtkColorTransferFunction.html\n    :param: tableSize - The table size\n    :return: The lookup table.\n    \"\"\"\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    # Green to tan.\n    ctf.AddRGBPoint(0.0, 0.085, 0.532, 0.201)\n    ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n    ctf.AddRGBPoint(1.0, 0.677, 0.492, 0.093)\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(tableSize)\n    lut.Build()\n\n    for i in range(0, tableSize):\n        rgb = list(ctf.GetColor(float(i) / tableSize)) + [1]\n        lut.SetTableValue(i, rgb)\n\n    return lut\n\n\ndef MakeCellData(tableSize, lut, colors):\n    \"\"\"\n    Create the cell data using the colors from the lookup table.\n    :param: tableSize - The table size\n    :param: lut - The lookup table.\n    :param: colors - A reference to a vtkUnsignedCharArray().\n    \"\"\"\n    for i in range(1, tableSize):\n        rgb = [0.0, 0.0, 0.0]\n        lut.GetColor(float(i) / (tableSize - 1), rgb)\n        ucrgb = list(map(int, [x * 255 for x in rgb]))\n        colors.InsertNextTuple3(ucrgb[0], ucrgb[1], ucrgb[2])\n        s = '[' + ', '.join(['{:0.6f}'.format(x) for x in rgb]) + ']'\n        print(s, ucrgb)\n\n\ndef main():\n    \"\"\"\n    :return: The render window interactor.\n    \"\"\"\n\n    nc = vtkNamedColors()\n\n    # Provide some geometry\n    resolution = 3\n\n    plane11 = vtkPlaneSource()\n    plane11.SetXResolution(resolution)\n    plane11.SetYResolution(resolution)\n\n    plane12 = vtkPlaneSource()\n    plane12.SetXResolution(resolution)\n    plane12.SetYResolution(resolution)\n\n    tableSize = max(resolution * resolution + 1, 10)\n\n    #  Force an update so we can set cell data\n    plane11.Update()\n    plane12.Update()\n\n    #  Get the lookup tables mapping cell data to colors\n    lut1 = MakeLUT(tableSize)\n    lut2 = MakeLUTFromCTF(tableSize)\n\n    colorData1 = vtkUnsignedCharArray()\n    colorData1.SetName('colors')  # Any name will work here.\n    colorData1.SetNumberOfComponents(3)\n    print('Using a lookup table from a set of named colors.')\n    MakeCellData(tableSize, lut1, colorData1)\n    # Then use SetScalars() to add it to the vtkPolyData structure,\n    # this will then be interpreted as a color table.\n    plane11.GetOutput().GetCellData().SetScalars(colorData1)\n\n    colorData2 = vtkUnsignedCharArray()\n    colorData2.SetName('colors')  # Any name will work here.\n    colorData2.SetNumberOfComponents(3)\n    print('Using a lookup table created from a color transfer function.')\n    MakeCellData(tableSize, lut2, colorData2)\n    plane12.GetOutput().GetCellData().SetScalars(colorData2)\n\n    # Set up actor and mapper\n    mapper11 = vtkPolyDataMapper()\n    mapper11.SetInputConnection(plane11.GetOutputPort())\n    # Now, instead of doing this:\n    # mapper11.SetScalarRange(0, tableSize - 1)\n    # mapper11.SetLookupTable(lut1)\n    # We can just use the color data that we created from the lookup table and\n    # assigned to the cells:\n    mapper11.SetScalarModeToUseCellData()\n    mapper11.Update()\n\n    mapper12 = vtkPolyDataMapper()\n    mapper12.SetInputConnection(plane12.GetOutputPort())\n    mapper12.SetScalarModeToUseCellData()\n    mapper12.Update()\n\n    writer = vtkXMLPolyDataWriter()\n    writer.SetFileName('pdlut.vtp')\n    writer.SetInputData(mapper11.GetInput())\n    # This is set so we can see the data in a text editor.\n    writer.SetDataModeToAscii()\n    writer.Write()\n    writer.SetFileName('pdctf.vtp')\n    writer.SetInputData(mapper12.GetInput())\n    writer.Write()\n\n    actor11 = vtkActor()\n    actor11.SetMapper(mapper11)\n    actor12 = vtkActor()\n    actor12.SetMapper(mapper12)\n\n    # Let's read in the data we wrote out.\n    reader1 = vtkXMLPolyDataReader()\n    reader1.SetFileName(\"pdlut.vtp\")\n\n    reader2 = vtkXMLPolyDataReader()\n    reader2.SetFileName(\"pdctf.vtp\")\n\n    mapper21 = vtkPolyDataMapper()\n    mapper21.SetInputConnection(reader1.GetOutputPort())\n    mapper21.SetScalarModeToUseCellData()\n    mapper21.Update()\n    actor21 = vtkActor()\n    actor21.SetMapper(mapper11)\n\n    mapper22 = vtkPolyDataMapper()\n    mapper22.SetInputConnection(reader2.GetOutputPort())\n    mapper22.SetScalarModeToUseCellData()\n    mapper22.Update()\n    actor22 = vtkActor()\n    actor22.SetMapper(mapper22)\n\n    # Define viewport ranges.\n    # (xmin, ymin, xmax, ymax)\n    viewport11 = [0.0, 0.0, 0.5, 0.5]\n    viewport12 = [0.0, 0.5, 0.5, 1.0]\n    viewport21 = [0.5, 0.0, 1.0, 0.5]\n    viewport22 = [0.5, 0.5, 1.0, 1.0]\n\n    # Set up the renderers.\n    ren11 = vtkRenderer()\n    ren12 = vtkRenderer()\n    ren21 = vtkRenderer()\n    ren22 = vtkRenderer()\n\n    # Setup the render windows\n    renWin = vtkRenderWindow()\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName('AssignCellColorsFromLUT');\n\n    renWin.AddRenderer(ren11)\n    renWin.AddRenderer(ren12)\n    renWin.AddRenderer(ren21)\n    renWin.AddRenderer(ren22)\n    ren11.SetViewport(viewport11)\n    ren12.SetViewport(viewport12)\n    ren21.SetViewport(viewport21)\n    ren22.SetViewport(viewport22)\n    ren11.SetBackground(nc.GetColor3d('MidnightBlue'))\n    ren12.SetBackground(nc.GetColor3d('MidnightBlue'))\n    ren21.SetBackground(nc.GetColor3d('MidnightBlue'))\n    ren22.SetBackground(nc.GetColor3d('MidnightBlue'))\n    ren11.AddActor(actor11)\n    ren12.AddActor(actor12)\n    ren21.AddActor(actor21)\n    ren22.AddActor(actor22)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    renWin.Render()\n\n    return iren\n\n\nif __name__ == '__main__':\n    requiredMajorVersion = 6\n    print(vtkVersion().GetVTKMajorVersion())\n    if vtkVersion().GetVTKMajorVersion() < requiredMajorVersion:\n        print(\"You need VTK Version 6 or greater.\")\n        print(\"The class vtkNamedColors is in VTK version 6 or greater.\")\n        exit(0)\n    iren = main()\n    iren.Start()\n
        "},{"location":"Python/Visualization/BillboardTextActor3D/","title":"BillboardTextActor3D","text":"

        vtk-examples/Python/Visualization/BillboardTextActor3D

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/BillboardTextActor3D/#code","title":"Code","text":"

        BillboardTextActor3D.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkCommonCore import vtkCommand\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkBillboardTextActor3D,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # For testing\n    rng = vtkMinimalStandardRandomSequence()\n    # rng.SetSeed(8775070)\n    rng.SetSeed(5127)\n\n    # Create a renderer\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('DarkSlateGray'))\n\n    # Create a render window\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetWindowName('BillboardTextActor3D')\n\n    # Create an interactor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(render_window)\n\n    # Create a sphere\n    sphere_source = vtkSphereSource()\n    sphere_source.SetCenter(0.0, 0.0, 0.0)\n    sphere_source.SetRadius(1.0)\n\n    min_r = -10.0\n    max_r = 10.0\n\n    for i in range(0, 10):\n        if i == 0:\n            # Create an actor representing the origin\n            mapper = vtkPolyDataMapper()\n            mapper.SetInputConnection(sphere_source.GetOutputPort())\n\n            actor = vtkActor()\n            actor.SetMapper(mapper)\n            actor.SetPosition(0, 0, 0)\n            actor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n\n            renderer.AddActor(actor)\n\n        # Create a mapper\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(sphere_source.GetOutputPort())\n\n        # Create an actor\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n        actor.SetPosition(0, 0, 0)\n        actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n        # Set up the text and add it to the renderer\n        text_actor = vtkBillboardTextActor3D()\n        text_actor.SetInput('')\n        text_actor.SetPosition(actor.GetPosition())\n        text_actor.GetTextProperty().SetFontSize(12)\n        text_actor.GetTextProperty().SetColor(colors.GetColor3d('Gold'))\n        text_actor.GetTextProperty().SetJustificationToCentered()\n\n        position = random_position(min_r, max_r, rng)\n        actor.SetPosition(position)\n        # If you want to use a callback, do this:\n        # observer = ActorCallback(text_actor)\n        # actor.AddObserver(vtkCommand.NoEvent, observer(actor))\n        # Otherwise do this:\n        label = f'{position[0]:0.3g}, {position[1]:0.3g}, {position[2]:0.3g}'\n        text_actor.SetPosition(position)\n        text_actor.SetInput(label)\n\n        renderer.AddActor(actor)\n        renderer.AddActor(text_actor)\n\n    render_window.Render()\n    render_window.SetWindowName('BillboardTextActor3D')\n    iren.Start()\n\n\nclass ActorCallback:\n    def __init__(self, text_actor):\n        self.text_actor = text_actor\n\n    def __call__(self, caller):\n        position = caller.GetPosition()\n        label = f'{position[0]:0.3g}, {position[1]:0.3g}, {position[2]:0.3g}'\n        self.text_actor.SetPosition(position)\n        self.text_actor.SetInput(label)\n\n\ndef random_position(min_r, max_r, rng):\n    p = list()\n    for i in range(0, 3):\n        p.append(rng.GetRangeValue(min_r, max_r))\n        rng.Next()\n    return p\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/BlobbyLogo/","title":"BlobbyLogo","text":"

        vtk-examples/Python/Visualization/BlobbyLogo

        "},{"location":"Python/Visualization/BlobbyLogo/#description","title":"Description","text":"

        This is the blobby vtk logo described in chapter 12 of the VTK textbook. The example uses vtkAppendPolyData to combine three vtkPolyData. A vtkImplicitModeller creates a vtkImageData of the distnaces from the polydata triangles. vtkContourFilter extracts an isosurface representing an offset surface.

        This examples uses the data src/Testing/Data/v.vtk, src/Testing/Data/t.vtk and src/Testing/Data/k.vtk.

        Info

        See Figure 12-13 in Chapter 12 the VTK Textbook.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/BlobbyLogo/#code","title":"Code","text":"

        BlobbyLogo.py

        #!/usr/bin/env python\n\n'''\n'''\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkContourFilter,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersHybrid import vtkImplicitModeller\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName1, fileName2, fileName3 = get_program_parameters()\n    aRenderer = vtkRenderer()\n    aRenderWindow = vtkRenderWindow()\n    aRenderWindow.AddRenderer(aRenderer)\n    anInteractor = vtkRenderWindowInteractor()\n    anInteractor.SetRenderWindow(aRenderWindow)\n    aRenderWindow.SetSize(300, 300)\n    aRenderWindow.SetWindowName('BlobbyLogo')\n\n    # Read the geometry file containing the letter v.\n    letterV = vtkPolyDataReader()\n    letterV.SetFileName(fileName1)\n\n    # Read the geometry file containing the letter t.\n    letterT = vtkPolyDataReader()\n    letterT.SetFileName(fileName2)\n\n    # Read the geometry file containing the letter k.\n    letterK = vtkPolyDataReader()\n    letterK.SetFileName(fileName3)\n\n    # Create a transform and transform filter for each letter.\n    VTransform = vtkTransform()\n    VTransformFilter = vtkTransformPolyDataFilter()\n    VTransformFilter.SetInputConnection(letterV.GetOutputPort())\n    VTransformFilter.SetTransform(VTransform)\n\n    TTransform = vtkTransform()\n    TTransformFilter = vtkTransformPolyDataFilter()\n    TTransformFilter.SetInputConnection(letterT.GetOutputPort())\n    TTransformFilter.SetTransform(TTransform)\n\n    KTransform = vtkTransform()\n    KTransformFilter = vtkTransformPolyDataFilter()\n    KTransformFilter.SetInputConnection(letterK.GetOutputPort())\n    KTransformFilter.SetTransform(KTransform)\n\n    # Now append them all.\n    appendAll = vtkAppendPolyData()\n    appendAll.AddInputConnection(VTransformFilter.GetOutputPort())\n    appendAll.AddInputConnection(TTransformFilter.GetOutputPort())\n    appendAll.AddInputConnection(KTransformFilter.GetOutputPort())\n\n    # Create normals.\n    logoNormals = vtkPolyDataNormals()\n    logoNormals.SetInputConnection(appendAll.GetOutputPort())\n    logoNormals.SetFeatureAngle(60)\n\n    # Map to rendering primitives.\n    logoMapper = vtkPolyDataMapper()\n    logoMapper.SetInputConnection(logoNormals.GetOutputPort())\n\n    # Now an actor.\n    logo = vtkActor()\n    logo.SetMapper(logoMapper)\n\n    # Now create an implicit model of the same letter.\n    blobbyLogoImp = vtkImplicitModeller()\n    blobbyLogoImp.SetInputConnection(appendAll.GetOutputPort())\n    blobbyLogoImp.SetMaximumDistance(.075)\n    blobbyLogoImp.SetSampleDimensions(64, 64, 64)\n    blobbyLogoImp.SetAdjustDistance(0.05)\n\n    # Extract an iso surface.\n    blobbyLogoIso = vtkContourFilter()\n    blobbyLogoIso.SetInputConnection(blobbyLogoImp.GetOutputPort())\n    blobbyLogoIso.SetValue(1, 1.5)\n\n    # Map to rendering primitives.\n    blobbyLogoMapper = vtkPolyDataMapper()\n    blobbyLogoMapper.SetInputConnection(blobbyLogoIso.GetOutputPort())\n    blobbyLogoMapper.ScalarVisibilityOff()\n\n    tomato = vtkProperty()\n    tomato.SetDiffuseColor(colors.GetColor3d('tomato'))\n    tomato.SetSpecular(.3)\n    tomato.SetSpecularPower(20)\n\n    banana = vtkProperty()\n    banana.SetDiffuseColor(colors.GetColor3d('banana'))\n    banana.SetDiffuse(.7)\n    banana.SetSpecular(.4)\n    banana.SetSpecularPower(20)\n\n    # Now an actor.\n    blobbyLogo = vtkActor()\n    blobbyLogo.SetMapper(blobbyLogoMapper)\n    blobbyLogo.SetProperty(banana)\n\n    # Position the letters.\n\n    VTransform.Translate(-16.0, 0.0, 12.5)\n    VTransform.RotateY(40)\n\n    KTransform.Translate(14.0, 0.0, 0.0)\n    KTransform.RotateY(-40)\n\n    # Move the polygonal letters to the front.\n    logo.SetProperty(tomato)\n    logo.SetPosition(0, 0, 6)\n\n    aRenderer.AddActor(logo)\n    aRenderer.AddActor(blobbyLogo)\n\n    aRenderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    aRenderWindow.Render()\n\n    # Interact with the data.\n    anInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Use implicit modeller to create the VTK logo.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename1', help='v.vtk')\n    parser.add_argument('filename2', help='t.vtk')\n    parser.add_argument('filename3', help='k.vtk')\n    args = parser.parse_args()\n    return args.filename1, args.filename2, args.filename3\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/Blow/","title":"Blow","text":"

        vtk-examples/Python/Visualization/Blow

        "},{"location":"Python/Visualization/Blow/#description","title":"Description","text":"

        Extrusion blow molding process.

        In the extrusion blow molding process, a material is extruded through an annular die to form a hollow cylinder. This cylinder is called a parison. Two mold halves are then closed on the parison, while at the same time the parison is inflated with air. Some of the parison material remains within the mold while some becomes waste material. The material is typically a polymer plastic softened with heat, but blow molding has been used to form metal parts. Plastic bottles are often manufactured using a blow molding process.

        In this example the polymer was molded using an isothermal, nonlinear-elastic, incompressible (rubber-like) material. Triangular membrane finite elements were used to model the parison, while a combination of triangular and quadrilateral finite elements were used to model the mold. The mold surface is assumed to be rigid, and the parison is assumed to attach to the mold upon contact. Thus the thinning of the parison is controlled by its stretching during inflation and the sequence in which it contacts the mold.

        Ten steps of the analysis are illustrated. The color of the parison indicates its thickness. Using a rainbow scale, red areas are thinnest while blue regions are thickest. Our visualization shows clearly one problem with the analysis technique we are using. Note that while the nodes (i.e., points) of the finite element mesh are prevented from passing through the mold, the interior of the triangular elements are not. This is apparent from the occlusion of the mold wireframe by the parison mesh.

        You can also view the individual steps.

        Info

        See Figure 12-17 in Chapter 12 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/Blow/#code","title":"Code","text":"

        Blow.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkConnectivityFilter,\n    vtkContourFilter,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpVector\nfrom vtkmodules.vtkFiltersGeometry import vtkGeometryFilter\nfrom vtkmodules.vtkIOLegacy import vtkDataSetReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName, dataPoint = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    thickness = list()\n    displacement = list()\n    for i in range(0, 10):\n        thickness.append('thickness' + str(i))\n        displacement.append('displacement' + str(i))\n\n    reader = list()\n    warp = list()\n    connect = list()\n    mold = list()\n    moldMapper = list()\n    moldActor = list()\n    connect2 = list()\n    parison = list()\n    normals2 = list()\n    parisonMapper = list()\n    parisonActor = list()\n    cf = list()\n    contourMapper = list()\n    contours = list()\n    ren = list()\n\n    lut = vtkLookupTable()\n    lut.SetHueRange(0.0, 0.66667)\n\n    for i in range(0, 10):\n        # Create the reader and warp the data vith vectors.\n        reader.append(vtkDataSetReader())\n        reader[i].SetFileName(fileName)\n        reader[i].SetScalarsName(thickness[i])\n        reader[i].SetVectorsName(displacement[i])\n        reader[i].Update()\n\n        warp.append(vtkWarpVector())\n        warp[i].SetInputData(reader[i].GetUnstructuredGridOutput())\n\n        # Extract the mold from the mesh using connectivity.\n        connect.append(vtkConnectivityFilter())\n        connect[i].SetInputConnection(warp[i].GetOutputPort())\n        connect[i].SetExtractionModeToSpecifiedRegions()\n        connect[i].AddSpecifiedRegion(0)\n        connect[i].AddSpecifiedRegion(1)\n        mold.append(vtkGeometryFilter())\n        mold[i].SetInputConnection(connect[i].GetOutputPort())\n        moldMapper.append(vtkDataSetMapper())\n        moldMapper[i].SetInputConnection(mold[i].GetOutputPort())\n        moldMapper[i].ScalarVisibilityOff()\n        moldActor.append(vtkActor())\n        moldActor[i].SetMapper(moldMapper[i])\n        moldActor[i].GetProperty().SetColor(colors.GetColor3d(\"ivory_black\"))\n        moldActor[i].GetProperty().SetRepresentationToWireframe()\n\n        # Extract the parison from the mesh using connectivity.\n        connect2.append(vtkConnectivityFilter())\n        connect2[i].SetInputConnection(warp[i].GetOutputPort())\n        connect2[i].SetExtractionModeToSpecifiedRegions()\n        connect2[i].AddSpecifiedRegion(2)\n        parison.append(vtkGeometryFilter())\n        parison[i].SetInputConnection(connect2[i].GetOutputPort())\n        normals2.append(vtkPolyDataNormals())\n        normals2[i].SetInputConnection(parison[i].GetOutputPort())\n        normals2[i].SetFeatureAngle(60)\n        parisonMapper.append(vtkPolyDataMapper())\n        parisonMapper[i].SetInputConnection(normals2[i].GetOutputPort())\n        parisonMapper[i].SetLookupTable(lut)\n        parisonMapper[i].SetScalarRange(0.12, 1.0)\n        parisonActor.append(vtkActor())\n        parisonActor[i].SetMapper(parisonMapper[i])\n\n        cf.append(vtkContourFilter())\n        cf[i].SetInputConnection(connect2[i].GetOutputPort())\n        cf[i].SetValue(0, 0.5)\n        contourMapper.append(vtkPolyDataMapper())\n        contourMapper[i].SetInputConnection(cf[i].GetOutputPort())\n        contours.append(vtkActor())\n        contours[i].SetMapper(contourMapper[i])\n\n        ren.append(vtkRenderer())\n        ren[i].AddActor(moldActor[i])\n        ren[i].AddActor(parisonActor[i])\n        ren[i].AddActor(contours[i])\n        ren[i].SetBackground(colors.GetColor3d(\"AliceBlue\"))\n        ren[i].GetActiveCamera().SetPosition(50.973277, 12.298821, 29.102547)\n        ren[i].GetActiveCamera().SetFocalPoint(0.141547, 12.298821, -0.245166)\n        ren[i].GetActiveCamera().SetViewUp(-0.500000, 0.000000, 0.866025)\n        ren[i].GetActiveCamera().SetClippingRange(36.640827, 78.614680)\n\n    # Create the RenderWindow and RenderWindowInteractor.\n    renWin = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    rendererSizeX = 750\n    rendererSizeY = 400\n    renWinScale = 0.5\n    renWin.SetWindowName(\"Blow\")\n    if 0 <= dataPoint < 10:\n        renWin.AddRenderer(ren[dataPoint])\n        renWin.SetSize(rendererSizeX, rendererSizeY)\n    else:\n        gridDimensionsX = 2\n        gridDimensionsY = 5\n        renWin.SetSize(int(rendererSizeX * gridDimensionsX * renWinScale),\n                       int(rendererSizeY * gridDimensionsY * renWinScale))\n        # Add and position the renders to the render window.\n        viewPort = list()\n        for row in range(0, gridDimensionsY):\n            for col in range(0, gridDimensionsX):\n                idx = row * gridDimensionsX + col\n                x0 = float(col) / gridDimensionsX\n                y0 = float(gridDimensionsY - row - 1) / gridDimensionsY\n                x1 = float(col + 1) / gridDimensionsX\n                y1 = float(gridDimensionsY - row) / gridDimensionsY\n                viewPort[:] = []\n                viewPort.append(x0)\n                viewPort.append(y0)\n                viewPort.append(x1)\n                viewPort.append(y1)\n                renWin.AddRenderer(ren[idx])\n                ren[idx].SetViewport(viewPort)\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce figure 12-17 from the VTK Textbook.'\n    epilogue = '''\n\n        It is a translation of the original blow.tcl.\n\n        data_point allows you to specify which frame is to be displayed.\n        If data_point < 0 or data_point > 9 all ten frames are then displayed.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='blow.vtk')\n    parser.add_argument('data_point', default=-1, type=int, nargs='?', help='The particular color scheme to use.')\n    args = parser.parse_args()\n    return args.filename, args.data_point\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/Camera/","title":"Camera","text":"

        vtk-examples/Python/Visualization/Camera

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/Camera/#code","title":"Code","text":"

        Camera.py

        from vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a sphere\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(10)\n    sphereSource.SetPhiResolution(30)\n    sphereSource.SetThetaResolution(30)\n    sphereSource.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphereSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetSpecular(0.6)\n    actor.GetProperty().SetSpecularPower(30)\n    actor.GetProperty().SetColor(colors.GetColor3d('LightSkyBlue'))\n\n    camera = vtkCamera()\n    camera.SetPosition(0, 0, 100)\n    camera.SetFocalPoint(0, 0, 0)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderer.SetActiveCamera(camera)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('Camera')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('MistyRose'))\n\n    # Render and interact\n    renderWindowInteractor.Initialize()\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/CameraModel1/","title":"CameraModel1","text":"

        vtk-examples/Python/Visualization/CameraModel1

        "},{"location":"Python/Visualization/CameraModel1/#description","title":"Description","text":"

        This example illustrates the camera movement around the focal point.

        Note

        For camera movement centered at the camera position see CameraModel2.

        Note

        This is an adaptation of the code written by Chung Kai Lun Pete.

        Note

        This example corresponds to Figure 3-12 in the VTK Text.

        Info

        See Figure 3-12 in Chapter 3 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/CameraModel1/#code","title":"Code","text":"

        CameraModel1.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendFilter,\n    vtkContourFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkTransformFilter,\n    vtkTransformPolyDataFilter,\n    vtkWarpTo\n)\nfrom vtkmodules.vtkFiltersHybrid import vtkImplicitModeller\nfrom vtkmodules.vtkFiltersModeling import vtkRotationalExtrusionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextActor\n)\nfrom vtkmodules.vtkRenderingLOD import vtkLODActor\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the colors.\n    colors.SetColor('AzimuthArrowColor', [255, 77, 77, 255])\n    colors.SetColor('ElevationArrowColor', [77, 255, 77, 255])\n    colors.SetColor('RollArrowColor', [255, 255, 77, 255])\n    colors.SetColor('SpikeColor', [255, 77, 255, 255])\n    colors.SetColor('BkgColor', [26, 51, 102, 255])\n\n    # Create a rendering window, renderer and interactor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create a camera model.\n    camCS = vtkConeSource()\n    camCS.SetHeight(1.5)\n    camCS.SetResolution(12)\n    camCS.SetRadius(0.4)\n\n    camCBS = vtkCubeSource()\n    camCBS.SetXLength(1.5)\n    camCBS.SetZLength(0.8)\n    camCBS.SetCenter(0.4, 0, 0)\n\n    camAPD = vtkAppendFilter()\n    camAPD.AddInputConnection(camCBS.GetOutputPort())\n    camAPD.AddInputConnection(camCS.GetOutputPort())\n\n    camMapper = vtkPolyDataMapper()\n    camMapper.SetInputConnection(camAPD.GetOutputPort())\n    camActor = vtkLODActor()\n    camActor.SetMapper(camMapper)\n    camActor.SetScale(2, 2, 2)\n\n    # Draw the arrows.\n    pd = vtkPolyData()\n    ca = vtkCellArray()\n    fp = vtkPoints()\n    fp.InsertNextPoint(0, 1, 0)\n    fp.InsertNextPoint(8, 1, 0)\n    fp.InsertNextPoint(8, 2, 0)\n    fp.InsertNextPoint(10, 0.01, 0)\n    fp.InsertNextPoint(8, -2, 0)\n    fp.InsertNextPoint(8, -1, 0)\n    fp.InsertNextPoint(0, -1, 0)\n    ca.InsertNextCell(7)\n    ca.InsertCellPoint(0)\n    ca.InsertCellPoint(1)\n    ca.InsertCellPoint(2)\n    ca.InsertCellPoint(3)\n    ca.InsertCellPoint(4)\n    ca.InsertCellPoint(5)\n    ca.InsertCellPoint(6)\n    pd.SetPoints(fp)\n    pd.SetPolys(ca)\n\n    pd2 = vtkPolyData()\n    ca2 = vtkCellArray()\n    fp2 = vtkPoints()\n    fp2.InsertNextPoint(0, 1, 0)\n    fp2.InsertNextPoint(8, 1, 0)\n    fp2.InsertNextPoint(8, 2, 0)\n    fp2.InsertNextPoint(10, 0.01, 0)\n    ca2.InsertNextCell(4)\n    ca2.InsertCellPoint(0)\n    ca2.InsertCellPoint(1)\n    ca2.InsertCellPoint(2)\n    ca2.InsertCellPoint(3)\n    pd2.SetPoints(fp2)\n    pd2.SetLines(ca2)\n\n    arrowIM = vtkImplicitModeller()\n    arrowIM.SetInputData(pd)\n    arrowIM.SetSampleDimensions(50, 20, 8)\n\n    arrowCF = vtkContourFilter()\n    arrowCF.SetInputConnection(arrowIM.GetOutputPort())\n    arrowCF.SetValue(0, 0.2)\n\n    arrowWT = vtkWarpTo()\n    arrowWT.SetInputConnection(arrowCF.GetOutputPort())\n    arrowWT.SetPosition(5, 0, 5)\n    arrowWT.SetScaleFactor(0.85)\n    arrowWT.AbsoluteOn()\n\n    arrowT = vtkTransform()\n    arrowT.RotateY(60)\n    arrowT.Translate(-1.33198, 0, -1.479)\n    arrowT.Scale(1, 0.5, 1)\n\n    arrowTF = vtkTransformFilter()\n    arrowTF.SetInputConnection(arrowWT.GetOutputPort())\n    arrowTF.SetTransform(arrowT)\n\n    arrowMapper = vtkDataSetMapper()\n    arrowMapper.SetInputConnection(arrowTF.GetOutputPort())\n    arrowMapper.ScalarVisibilityOff()\n\n    # Draw the azimuth arrows.\n    a1Actor = vtkLODActor()\n    a1Actor.SetMapper(arrowMapper)\n    a1Actor.RotateZ(180)\n    a1Actor.SetPosition(1, 0, -1)\n    a1Actor.GetProperty().SetColor(colors.GetColor3d('AzimuthArrowColor'))\n    a1Actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    a1Actor.GetProperty().SetSpecular(0.3)\n    a1Actor.GetProperty().SetSpecularPower(20)\n    a1Actor.GetProperty().SetAmbient(0.2)\n    a1Actor.GetProperty().SetDiffuse(0.8)\n\n    a2Actor = vtkLODActor()\n    a2Actor.SetMapper(arrowMapper)\n    a2Actor.RotateZ(180)\n    a2Actor.RotateX(180)\n    a2Actor.SetPosition(1, 0, 1)\n    a2Actor.GetProperty().SetColor(colors.GetColor3d('AzimuthArrowColor'))\n    a2Actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    a2Actor.GetProperty().SetSpecular(0.3)\n    a2Actor.GetProperty().SetSpecularPower(20)\n    a2Actor.GetProperty().SetAmbient(0.2)\n    a2Actor.GetProperty().SetDiffuse(0.8)\n\n    # Draw the elevation arrows.\n    a3Actor = vtkLODActor()\n    a3Actor.SetMapper(arrowMapper)\n    a3Actor.RotateZ(180)\n    a3Actor.RotateX(90)\n    a3Actor.SetPosition(1, -1, 0)\n    a3Actor.GetProperty().SetColor(colors.GetColor3d('ElevationArrowColor'))\n    a3Actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    a3Actor.GetProperty().SetSpecular(0.3)\n    a3Actor.GetProperty().SetSpecularPower(20)\n    a3Actor.GetProperty().SetAmbient(0.2)\n    a3Actor.GetProperty().SetDiffuse(0.8)\n\n    a4Actor = vtkLODActor()\n    a4Actor.SetMapper(arrowMapper)\n    a4Actor.RotateZ(180)\n    a4Actor.RotateX(-90)\n    a4Actor.SetPosition(1, 1, 0)\n    a4Actor.GetProperty().SetColor(colors.GetColor3d('ElevationArrowColor'))\n    a4Actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    a4Actor.GetProperty().SetSpecular(0.3)\n    a4Actor.GetProperty().SetSpecularPower(20)\n    a4Actor.GetProperty().SetAmbient(0.2)\n    a4Actor.GetProperty().SetDiffuse(0.8)\n\n    # Draw the DOP.\n    arrowT2 = vtkTransform()\n    arrowT2.Scale(1, 0.6, 1)\n    arrowT2.RotateY(90)\n\n    arrowTF2 = vtkTransformPolyDataFilter()\n    arrowTF2.SetInputData(pd2)\n    arrowTF2.SetTransform(arrowT2)\n\n    arrowREF = vtkRotationalExtrusionFilter()\n    arrowREF.SetInputConnection(arrowTF2.GetOutputPort())\n    arrowREF.CappingOff()\n    arrowREF.SetResolution(30)\n\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(arrowREF.GetOutputPort())\n\n    a5Actor = vtkLODActor()\n    a5Actor.SetMapper(spikeMapper)\n    a5Actor.SetScale(.3, .3, .6)\n    a5Actor.RotateY(90)\n    a5Actor.SetPosition(-2, 0, 0)\n    a5Actor.GetProperty().SetColor(colors.GetColor3d('SpikeColor'))\n    a5Actor.GetProperty().SetAmbient(0.2)\n    a5Actor.GetProperty().SetDiffuse(0.8)\n\n    # Focal point.\n    fps = vtkSphereSource()\n    fps.SetRadius(0.5)\n    fpMapper = vtkPolyDataMapper()\n    fpMapper.SetInputConnection(fps.GetOutputPort())\n    fpActor = vtkLODActor()\n    fpActor.SetMapper(fpMapper)\n    fpActor.SetPosition(-9, 0, 0)\n    fpActor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    fpActor.GetProperty().SetSpecular(0.3)\n    fpActor.GetProperty().SetAmbient(0.2)\n    fpActor.GetProperty().SetDiffuse(0.8)\n    fpActor.GetProperty().SetSpecularPower(20)\n\n    # Create the roll arrows.\n    arrowWT2 = vtkWarpTo()\n    arrowWT2.SetInputConnection(arrowCF.GetOutputPort())\n    arrowWT2.SetPosition(5, 0, 2.5)\n    arrowWT2.SetScaleFactor(0.95)\n    arrowWT2.AbsoluteOn()\n\n    arrowT3 = vtkTransform()\n    arrowT3.Translate(-2.50358, 0, -1.70408)\n    arrowT3.Scale(0.5, 0.3, 1)\n\n    arrowTF3 = vtkTransformFilter()\n    arrowTF3.SetInputConnection(arrowWT2.GetOutputPort())\n    arrowTF3.SetTransform(arrowT3)\n\n    arrowMapper2 = vtkDataSetMapper()\n    arrowMapper2.SetInputConnection(arrowTF3.GetOutputPort())\n    arrowMapper2.ScalarVisibilityOff()\n\n    # Draw the roll arrows.\n    a6Actor = vtkLODActor()\n    a6Actor.SetMapper(arrowMapper2)\n    a6Actor.RotateZ(90)\n    a6Actor.SetPosition(-4, 0, 0)\n    a6Actor.SetScale(1.5, 1.5, 1.5)\n    a6Actor.GetProperty().SetColor(colors.GetColor3d('RollArrowColor'))\n    a6Actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    a6Actor.GetProperty().SetSpecular(0.3)\n    a6Actor.GetProperty().SetSpecularPower(20)\n    a6Actor.GetProperty().SetAmbient(0.2)\n    a6Actor.GetProperty().SetDiffuse(0.8)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(camActor)\n    ren.AddActor(a1Actor)\n    ren.AddActor(a2Actor)\n    ren.AddActor(a3Actor)\n    ren.AddActor(a4Actor)\n    ren.AddActor(a5Actor)\n    ren.AddActor(a6Actor)\n    ren.AddActor(fpActor)\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CameraModel1')\n\n    # Render the image.\n\n    cam1 = (ren.GetActiveCamera())\n    ren.ResetCamera()\n    cam1.Azimuth(150)\n    cam1.Elevation(30)\n    cam1.Dolly(1.5)\n    ren.ResetCameraClippingRange()\n\n    # Create a TextActor for azimuth  (a1 and a2 actor's color).\n    text = vtkTextActor()\n    text.SetInput('Azimuth')\n    tprop = text.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a1Actor.GetProperty().GetColor())\n    text.SetDisplayPosition(20, 50)\n    ren.AddActor2D(text)\n\n    # Create a TextActor for elevation  (a3 and a4 actor's color).\n    text2 = vtkTextActor()\n    text2.SetInput('Elevation')\n    tprop = text2.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a3Actor.GetProperty().GetColor())\n    text2.SetDisplayPosition(20, 100)\n    ren.AddActor2D(text2)\n\n    # Create a TextActor for roll (a6 actor's color).\n    text3 = vtkTextActor()\n    text3.SetInput('Roll')\n    tprop = text3.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a6Actor.GetProperty().GetColor())\n    text3.SetDisplayPosition(20, 150)\n    ren.AddActor2D(text3)\n\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/CameraModel2/","title":"CameraModel2","text":"

        vtk-examples/Python/Visualization/CameraModel2

        "},{"location":"Python/Visualization/CameraModel2/#description","title":"Description","text":"

        This example illustrates the camera movement centered at the camera position.

        Note

        For camera movement around the focal point see CameraModel1.

        Note

        This is an adaptation of the code written by Chung Kai Lun Pete.

        Info

        See Figure 3-13 in Chapter 3 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/CameraModel2/#code","title":"Code","text":"

        CameraModel2.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkContourFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkTransformFilter,\n    vtkTransformPolyDataFilter,\n    vtkWarpTo\n)\nfrom vtkmodules.vtkFiltersHybrid import vtkImplicitModeller\nfrom vtkmodules.vtkFiltersModeling import vtkRotationalExtrusionFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextActor\n)\nfrom vtkmodules.vtkRenderingLOD import vtkLODActor\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Set the colors.\n    colors.SetColor(\"AzimuthArrowColor\", [255, 77, 77, 255])\n    colors.SetColor(\"ElevationArrowColor\", [77, 255, 77, 255])\n    colors.SetColor(\"RollArrowColor\", [255, 255, 77, 255])\n    colors.SetColor(\"SpikeColor\", [255, 77, 255, 255])\n    colors.SetColor(\"UpSpikeColor\", [77, 255, 255, 255])\n\n    # Create a rendering window, renderer and interactor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create a camera model.\n    camCS = vtkConeSource()\n    camCS.SetHeight(1.5)\n    camCS.SetResolution(12)\n    camCS.SetRadius(0.4)\n\n    camCBS = vtkCubeSource()\n    camCBS.SetXLength(1.5)\n    camCBS.SetZLength(0.8)\n    camCBS.SetCenter(0.4, 0, 0)\n\n    camAPD = vtkAppendPolyData()\n    camAPD.AddInputConnection(camCBS.GetOutputPort())\n    camAPD.AddInputConnection(camCS.GetOutputPort())\n\n    camMapper = vtkPolyDataMapper()\n    camMapper.SetInputConnection(camAPD.GetOutputPort())\n    camActor = vtkLODActor()\n    camActor.SetMapper(camMapper)\n    camActor.SetScale(2, 2, 2)\n\n    # Draw the arrows.\n    pd = vtkPolyData()\n    ca = vtkCellArray()\n    pts = vtkPoints()\n    pts.InsertNextPoint(0, 1, 0)\n    pts.InsertNextPoint(8, 1, 0)\n    pts.InsertNextPoint(8, 2, 0)\n    pts.InsertNextPoint(10, 0, 0)\n    pts.InsertNextPoint(8, -2, 0)\n    pts.InsertNextPoint(8, -1, 0)\n    pts.InsertNextPoint(0, -1, 0)\n    ca.InsertNextCell(7)\n    ca.InsertCellPoint(0)\n    ca.InsertCellPoint(1)\n    ca.InsertCellPoint(2)\n    ca.InsertCellPoint(3)\n    ca.InsertCellPoint(4)\n    ca.InsertCellPoint(5)\n    ca.InsertCellPoint(6)\n    pd.SetPoints(pts)\n    pd.SetPolys(ca)\n\n    pd2 = vtkPolyData()\n    ca2 = vtkCellArray()\n    pts2 = vtkPoints()\n    pts2.InsertNextPoint(0, 1, 0)\n    pts2.InsertNextPoint(8, 1, 0)\n    pts2.InsertNextPoint(8, 2, 0)\n    pts2.InsertNextPoint(10, 0.01, 0)\n    ca2.InsertNextCell(4)\n    ca2.InsertCellPoint(0)\n    ca2.InsertCellPoint(1)\n    ca2.InsertCellPoint(2)\n    ca2.InsertCellPoint(3)\n    pd2.SetPoints(pts2)\n    pd2.SetLines(ca2)\n\n    arrowIM = vtkImplicitModeller()\n    arrowIM.SetInputData(pd)\n    arrowIM.SetSampleDimensions(50, 20, 8)\n\n    arrowCF = vtkContourFilter()\n    arrowCF.SetInputConnection(arrowIM.GetOutputPort())\n    arrowCF.SetValue(0, 0.2)\n\n    arrowWT = vtkWarpTo()\n    arrowWT.SetInputConnection(arrowCF.GetOutputPort())\n    arrowWT.SetPosition(5, 0, 5)\n    arrowWT.SetScaleFactor(0.85)\n    arrowWT.AbsoluteOn()\n\n    arrowT = vtkTransform()\n    arrowT.RotateY(60)\n    arrowT.Translate(-1.33198, 0, -1.479)\n    arrowT.Scale(1, 0.5, 1)\n\n    arrowTF = vtkTransformFilter()\n    arrowTF.SetInputConnection(arrowWT.GetOutputPort())\n    arrowTF.SetTransform(arrowT)\n\n    arrowMapper = vtkDataSetMapper()\n    arrowMapper.SetInputConnection(arrowTF.GetOutputPort())\n    arrowMapper.ScalarVisibilityOff()\n\n    # Draw the azimuth arrows.\n    a1Actor = vtkLODActor()\n    a1Actor.SetMapper(arrowMapper)\n    a1Actor.SetPosition(-9, 0, -1)\n    a1Actor.GetProperty().SetColor(colors.GetColor3d(\"AzimuthArrowColor\"))\n    a1Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a1Actor.GetProperty().SetSpecular(0.3)\n    a1Actor.GetProperty().SetSpecularPower(20)\n    a1Actor.GetProperty().SetAmbient(0.2)\n    a1Actor.GetProperty().SetDiffuse(0.8)\n\n    a2Actor = vtkLODActor()\n    a2Actor.SetMapper(arrowMapper)\n    a2Actor.RotateX(180)\n    a2Actor.SetPosition(-9, 0, 1)\n    a2Actor.GetProperty().SetColor(colors.GetColor3d(\"AzimuthArrowColor\"))\n    a2Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a2Actor.GetProperty().SetSpecular(0.3)\n    a2Actor.GetProperty().SetSpecularPower(20)\n    a2Actor.GetProperty().SetAmbient(0.2)\n    a2Actor.GetProperty().SetDiffuse(0.8)\n\n    # Draw the elevation arrows.\n    a3Actor = vtkLODActor()\n    a3Actor.SetMapper(arrowMapper)\n    a3Actor.RotateX(-90)\n    a3Actor.SetPosition(-9, -1, 0)\n    a3Actor.GetProperty().SetColor(colors.GetColor3d(\"ElevationArrowColor\"))\n    a3Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a3Actor.GetProperty().SetSpecular(0.3)\n    a3Actor.GetProperty().SetSpecularPower(20)\n    a3Actor.GetProperty().SetAmbient(0.2)\n    a3Actor.GetProperty().SetDiffuse(0.8)\n\n    a4Actor = vtkLODActor()\n    a4Actor.SetMapper(arrowMapper)\n    a4Actor.RotateX(90)\n    a4Actor.SetPosition(-9, 1, 0)\n    a4Actor.GetProperty().SetColor(colors.GetColor3d(\"ElevationArrowColor\"))\n    a4Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a4Actor.GetProperty().SetSpecular(0.3)\n    a4Actor.GetProperty().SetSpecularPower(20)\n    a4Actor.GetProperty().SetAmbient(0.2)\n    a4Actor.GetProperty().SetDiffuse(0.8)\n\n    # Draw the DOP.\n    arrowT2 = vtkTransform()\n    arrowT2.Scale(1, 0.6, 1)\n    arrowT2.RotateY(90)\n\n    arrowTF2 = vtkTransformPolyDataFilter()\n    arrowTF2.SetInputData(pd2)\n    arrowTF2.SetTransform(arrowT2)\n\n    arrowREF = vtkRotationalExtrusionFilter()\n    arrowREF.SetInputConnection(arrowTF2.GetOutputPort())\n    arrowREF.CappingOff()\n    arrowREF.SetResolution(30)\n\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(arrowREF.GetOutputPort())\n\n    a5Actor = vtkLODActor()\n    a5Actor.SetMapper(spikeMapper)\n    a5Actor.SetScale(0.3, 0.3, 0.6)\n    a5Actor.RotateY(-90)\n    a5Actor.SetPosition(-8, 0, 0)\n    a5Actor.GetProperty().SetColor(colors.GetColor3d(\"SpikeColor\"))\n    a5Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a5Actor.GetProperty().SetSpecular(0.3)\n    a5Actor.GetProperty().SetAmbient(0.2)\n    a5Actor.GetProperty().SetDiffuse(0.8)\n    a5Actor.GetProperty().SetSpecularPower(20)\n\n    a7Actor = vtkLODActor()\n    a7Actor.SetMapper(spikeMapper)\n    a7Actor.SetScale(0.2, 0.2, 0.7)\n    a7Actor.RotateZ(90)\n    a7Actor.RotateY(-90)\n    a7Actor.SetPosition(-9, 1, 0)\n    a7Actor.GetProperty().SetColor(colors.GetColor3d(\"UpSpikeColor\"))\n    a7Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a7Actor.GetProperty().SetSpecular(0.3)\n    a7Actor.GetProperty().SetAmbient(0.2)\n    a7Actor.GetProperty().SetDiffuse(0.8)\n    a7Actor.GetProperty().SetSpecularPower(20)\n\n    # Focal point.\n    ss = vtkSphereSource()\n    ss.SetRadius(0.5)\n    fpMapper = vtkPolyDataMapper()\n    fpMapper.SetInputConnection(ss.GetOutputPort())\n    fpActor = vtkLODActor()\n    fpActor.SetMapper(fpMapper)\n    fpActor.SetPosition(-9, 0, 0)\n    fpActor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    fpActor.GetProperty().SetSpecular(0.3)\n    fpActor.GetProperty().SetAmbient(0.2)\n    fpActor.GetProperty().SetDiffuse(0.8)\n    fpActor.GetProperty().SetSpecularPower(20)\n\n    # Create the roll arrows.\n    arrowWT2 = vtkWarpTo()\n    arrowWT2.SetInputConnection(arrowCF.GetOutputPort())\n    arrowWT2.SetPosition(5, 0, 2.5)\n    arrowWT2.SetScaleFactor(0.95)\n    arrowWT2.AbsoluteOn()\n\n    arrowT3 = vtkTransform()\n    arrowT3.Translate(-2.50358, 0, -1.70408)\n    arrowT3.Scale(0.5, 0.3, 1)\n\n    arrowTF3 = vtkTransformFilter()\n    arrowTF3.SetInputConnection(arrowWT2.GetOutputPort())\n    arrowTF3.SetTransform(arrowT3)\n\n    arrowMapper2 = vtkDataSetMapper()\n    arrowMapper2.SetInputConnection(arrowTF3.GetOutputPort())\n    arrowMapper2.ScalarVisibilityOff()\n\n    # Draw the roll arrows.\n    a6Actor = vtkLODActor()\n    a6Actor.SetMapper(arrowMapper2)\n    a6Actor.RotateZ(90)\n    a6Actor.SetPosition(-4, 0, 0)\n    a6Actor.SetScale(1.5, 1.5, 1.5)\n    a6Actor.GetProperty().SetColor(colors.GetColor3d(\"RollArrowColor\"))\n    a6Actor.GetProperty().SetSpecularColor(colors.GetColor3d(\"White\"))\n    a6Actor.GetProperty().SetSpecular(0.3)\n    a6Actor.GetProperty().SetSpecularPower(20)\n    a6Actor.GetProperty().SetAmbient(0.2)\n    a6Actor.GetProperty().SetDiffuse(0.8)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(camActor)\n    ren.AddActor(a1Actor)\n    ren.AddActor(a2Actor)\n    ren.AddActor(a3Actor)\n    ren.AddActor(a4Actor)\n    ren.AddActor(a5Actor)\n    ren.AddActor(a6Actor)\n    ren.AddActor(a7Actor)\n    ren.AddActor(fpActor)\n    ren.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CameraModel2')\n\n    # Render the image.\n\n    cam1 = (ren.GetActiveCamera())\n    ren.ResetCamera()\n    cam1.Azimuth(150)\n    cam1.Elevation(30)\n    cam1.Dolly(1.5)\n    ren.ResetCameraClippingRange()\n\n    # Create a TextActor for Yaw  (a1 and a2 actor's color).\n    text = vtkTextActor()\n    text.SetInput(\"Yaw\")\n    tprop = text.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a1Actor.GetProperty().GetColor())\n    text.SetDisplayPosition(20, 50)\n    ren.AddActor2D(text)\n\n    # Create a TextActor for Pitch  (a3 and a4 actor's color).\n    text2 = vtkTextActor()\n    text2.SetInput(\"Pitch\")\n    tprop = text2.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a3Actor.GetProperty().GetColor())\n    text2.SetDisplayPosition(20, 100)\n    ren.AddActor2D(text2)\n\n    # Create a TextActor for roll (a6 actor's color).\n    text3 = vtkTextActor()\n    text3.SetInput(\"Roll\")\n    tprop = text3.GetTextProperty()\n    tprop.SetFontFamilyToArial()\n    tprop.ShadowOff()\n    tprop.SetLineSpacing(1.0)\n    tprop.SetFontSize(36)\n    tprop.SetColor(a6Actor.GetProperty().GetColor())\n    text3.SetDisplayPosition(20, 150)\n    ren.AddActor2D(text3)\n\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
        "},{"location":"Python/Visualization/ClampGlyphSizes/","title":"ClampGlyphSizes","text":"

        vtk-examples/Python/Visualization/ClampGlyphSizes

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/ClampGlyphSizes/#code","title":"Code","text":"

        ClampGlyphSizes.py

        #!/usr/bin/env python\n\n# Example of how to use range clamping with vtkGlyph3D filter.\n#\n# Note that the internal algorithm does this to figure out the eventual scale\n# of your data (say, if you're scaling by a scalar or vector magnitude):\n#\n#   scale = (scalar value of that particular data index);\n#   denominator = Range[1] - Range[0];\n#   scale = (scale < Range[0] ? Range[0] : (scale > Range[1] ? Range[1] : scale));\n#   scale = (scale - Range[0]) / denominator;\n#   scale *= scaleFactor;\n#\n# So, step 4 is the unintuitive one. Say your data varies from [0, 1] and you set the\n# Range to [0.5, 1]. Everything below 0.5 will be mapped to 0. If you want to set a\n# minimum size to your glyphs, then you can set the Range as something like [-0.5, 1]\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkElevationFilter,\n    vtkGlyph3D\n)\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkImagingCore import vtkRTAnalyticSource\nfrom vtkmodules.vtkImagingGeneral import vtkImageGradient\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Generate an image data set with multiple attribute arrays to probe and view\n    # We will glyph these points with cones and scale/orient/color them with the\n    # various attributes\n\n    # The Wavelet Source is nice for generating a test vtkImageData set\n    rt = vtkRTAnalyticSource()\n    rt.SetWholeExtent(-2, 2, -2, 2, 0, 0)\n\n    # Take the gradient of the only scalar 'RTData' to get a vector attribute\n    grad = vtkImageGradient()\n    grad.SetDimensionality(3)\n    grad.SetInputConnection(rt.GetOutputPort())\n\n    # Elevation just to generate another scalar attribute that varies nicely over the data range\n    elev = vtkElevationFilter()\n    # Elevation values will range from 0 to 1 between the Low and High Points\n    elev.SetLowPoint(-2, 0, 0)\n    elev.SetHighPoint(2, 0, 0)\n    elev.SetInputConnection(grad.GetOutputPort())\n\n    # Generate the cone for the glyphs\n    sph = vtkConeSource()\n    sph.SetRadius(0.1)\n    sph.SetHeight(0.5)\n\n    # Set up the glyph filter\n    glyph = vtkGlyph3D()\n    glyph.SetInputConnection(elev.GetOutputPort())\n    glyph.SetSourceConnection(sph.GetOutputPort())\n    glyph.ScalingOn()\n    glyph.SetScaleModeToScaleByScalar()\n    glyph.SetVectorModeToUseVector()\n    glyph.OrientOn()\n\n    # Tell the filter to 'clamp' the scalar range\n    glyph.ClampingOn()\n\n    # Set the overall (multiplicative) scaling factor\n    glyph.SetScaleFactor(1)\n\n    # Set the Range to 'clamp' the data to\n    #   -- see equations above for nonintuitive definition of 'clamping'\n    # The fact that I'm setting the minimum value of the range below\n    #   the minimum of my data (real min=0.0) with the equations above\n    #   forces a minimum non-zero glyph size.\n\n    glyph.SetRange(-0.5, 1)  # Change these values to see effect on cone sizes\n\n    # Tell glyph which attribute arrays to use for what\n    glyph.SetInputArrayToProcess(0, 0, 0, 0, 'Elevation')  # scalars\n    glyph.SetInputArrayToProcess(1, 0, 0, 0, 'RTDataGradient')  # vectors\n    # glyph.SetInputArrayToProcess(2,0,0,0,'nothing')       # normals\n    glyph.SetInputArrayToProcess(3, 0, 0, 0, 'RTData')  # colors\n\n    # Calling update because I'm going to use the scalar range to set the color map range\n    glyph.Update()\n\n    coloring_by = 'RTData'\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph.GetOutputPort())\n    mapper.SetScalarModeToUsePointFieldData()\n    mapper.SetColorModeToMapScalars()\n    mapper.ScalarVisibilityOn()\n    mapper.SetScalarRange(glyph.GetOutputDataObject(0).GetPointData().GetArray(coloring_by).GetRange())\n    mapper.SelectColorArray(coloring_by)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    ren = vtkRenderer()\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('MidnightBlue'))\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('ClampGlyphSizes')\n\n    iren = vtkRenderWindowInteractor()\n    istyle = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(istyle)\n    iren.SetRenderWindow(renWin)\n    ren.ResetCamera()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/CollisionDetection/","title":"CollisionDetection","text":"

        vtk-examples/Python/Visualization/CollisionDetection

        "},{"location":"Python/Visualization/CollisionDetection/#description","title":"Description","text":"

        This examples uses vtkCollisionDetectionFilter to find the intersection between a fixed (solid white) and moving (red wireframe) sphere. The animation places the moving sphere some distance from the fixed sphere and moves the moving sphere until it contacts the fixed sphere.

        Three collision modes are available and can be set as the first argument on the command line.

        1. All contacts (0) finds all the contacting cell pairs with two points per collision.
        2. First contact (1) quickly find the first contact point.
        3. Half contacts (2) finds all the contacting cell pairs with one points per collision.

        The animation pauses between each frame. The total animation should be 3 seconds.

        Three videos on the VTK Examples Project youtube playlist show each of the collision modes.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/CollisionDetection/#code","title":"Code","text":"

        CollisionDetection.py

        #!/usr/bin/env python\n\nimport time\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersModeling import vtkCollisionDetectionFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextActor\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Collision detection.'\n    epilogue = '''\nThis examples uses vtkCollisionDetectionFilter to find the intersection between a\n fixed (solid white) and moving (red wireframe) sphere.\nThe animation places the moving sphere some distance from the fixed sphere and\n moves the moving sphere until it contacts the fixed sphere.\n\nThree collision modes are available and can be set as the first argument on the command line.\n\n1. All contacts (0) finds all the contacting cell pairs with two points per collision.\n2. First contact (1) quickly find the first contact point.\n3. Half contacts (2) finds all the contacting cell pairs with one points per collision.\n\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('contactMode', nargs='?', default=0, type=int, help='Contact mode 0 (default), 1, or 2.')\n    args = parser.parse_args()\n    return args.contactMode\n\n\ndef main():\n    contactMode = get_program_parameters()\n\n    # Define colors\n    colors = vtkNamedColors()\n\n    sphere0 = vtkSphereSource()\n    sphere0.SetRadius(0.29)\n    sphere0.SetPhiResolution(31)\n    sphere0.SetThetaResolution(31)\n    sphere0.SetCenter(0.0, 0, 0)\n\n    sphere1 = vtkSphereSource()\n    sphere1.SetPhiResolution(30)\n    sphere1.SetThetaResolution(30)\n    sphere1.SetRadius(0.3)\n\n    matrix1 = vtkMatrix4x4()\n    transform0 = vtkTransform()\n\n    collide = vtkCollisionDetectionFilter()\n    collide.SetInputConnection(0, sphere0.GetOutputPort())\n    collide.SetTransform(0, transform0)\n    collide.SetInputConnection(1, sphere1.GetOutputPort())\n    collide.SetMatrix(1, matrix1)\n    collide.SetBoxTolerance(0.0)\n    collide.SetCellTolerance(0.0)\n    collide.SetNumberOfCellsPerNode(2)\n    if contactMode == 0:\n        collide.SetCollisionModeToAllContacts()\n    elif contactMode == 1:\n        collide.SetCollisionModeToFirstContact()\n    else:\n        collide.SetCollisionModeToHalfContacts()\n    collide.GenerateScalarsOn()\n\n    # Visualize\n    mapper1 = vtkPolyDataMapper()\n    mapper1.SetInputConnection(collide.GetOutputPort(0))\n    mapper1.ScalarVisibilityOff()\n    actor1 = vtkActor()\n    actor1.SetMapper(mapper1)\n    actor1.GetProperty().BackfaceCullingOn()\n    actor1.SetUserTransform(transform0)\n    actor1.GetProperty().SetDiffuseColor(colors.GetColor3d(\"Tomato\"))\n    actor1.GetProperty().SetRepresentationToWireframe()\n\n    mapper2 = vtkPolyDataMapper()\n    mapper2.SetInputConnection(collide.GetOutputPort(1))\n\n    actor2 = vtkActor()\n    actor2.SetMapper(mapper2)\n    actor2.GetProperty().BackfaceCullingOn()\n    actor2.SetUserMatrix(matrix1)\n\n    mapper3 = vtkPolyDataMapper()\n    mapper3.SetInputConnection(collide.GetContactsOutputPort())\n    mapper3.SetResolveCoincidentTopologyToPolygonOffset()\n\n    actor3 = vtkActor()\n    actor3.SetMapper(mapper3)\n    actor3.GetProperty().SetColor(colors.GetColor3d(\"Black\"))\n    actor3.GetProperty().SetLineWidth(3.0)\n\n    txt = vtkTextActor()\n    txt.GetTextProperty().SetFontSize(18)\n\n    renderer = vtkRenderer()\n    renderer.UseHiddenLineRemovalOn()\n    renderer.AddActor(actor1)\n    renderer.AddActor(actor2)\n    renderer.AddActor(actor3)\n    renderer.AddActor(txt)\n    renderer.SetBackground(colors.GetColor3d(\"Gray\"))\n    renderer.UseHiddenLineRemovalOn()\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetSize(640, 480)\n    renderWindow.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Move the first object\n    numSteps = 100\n    dx = 1.0 / float(numSteps) * 2.0\n    transform0.Translate(-numSteps * dx - .3, 0.0, 0.0)\n    renderWindow.Render()\n    renderer.GetActiveCamera().Azimuth(-60)\n    renderer.GetActiveCamera().Elevation(45)\n    renderer.GetActiveCamera().Dolly(1.2)\n\n    renderWindow.SetWindowName('CollisionDetection')\n    renderWindow.Render()\n\n    for i in range(0, numSteps):\n        transform0.Translate(dx, 0.0, 0.0)\n        renderer.ResetCameraClippingRange()\n        s = '{:s}: Number of contact cells is {:d}'.format(collide.GetCollisionModeAsString(),\n                                                           collide.GetNumberOfContacts())\n        txt.SetInput(s)\n        renderWindow.Render()\n        if collide.GetNumberOfContacts() > 0:\n            break\n        # The total animation time is 3 seconds\n        time.sleep(3.0 / numSteps)\n\n    renderer.ResetCamera()\n    renderWindow.Render()\n    renderWindow.Render()\n    interactor.Start()\n    # In Field Data there will be an array named \"ContactCells\".\n    # This array indexes contacting cells (e.g.) index 10 of array 0\n    #  points to a cell (triangle) which contacts/intersects a cell\n    #  at index 10 of array 1.\n    # You can directly obtain these, see GetContactCells(int i)\n    #  in the documentation.\n    # print(collide.GetOutput(0))\n    # print(collide.GetOutput(1))\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/ColorAnActor/","title":"ColorAnActor","text":"

        vtk-examples/Python/Visualization/ColorAnActor

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/ColorAnActor/#code","title":"Code","text":"

        ColorAnActor.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('ColorAnActor')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create source\n    source = vtkSphereSource()\n    source.SetCenter(0, 0, 0)\n    source.SetRadius(5.0)\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Bisque'))\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('Navy'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/ColorSeriesPatches/","title":"ColorSeriesPatches","text":"

        vtk-examples/Python/Visualization/ColorSeriesPatches

        "},{"location":"Python/Visualization/ColorSeriesPatches/#description","title":"Description","text":"

        This example shows how to produce a HTML page called VTKColorSeriesPatches showing the available colors series in vtkColorSeries.

        It also shows how to select the text color based on luminance. In this case, Digital CCIR601 is used, which gives less weight to the red and blue components of a color.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/ColorSeriesPatches/#code","title":"Code","text":"

        ColorSeriesPatches.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nProduce a HTML page called VTKColorSeriesPatches.html showing the available\n color series in vtkColorSeries.\n\nIt also shows how to select the text color based on luminance.\nIn this case Digital CCIR601 is used which gives less weight to the\n red and blue components of a color.\n\n\"\"\"\n\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\n\n\ndef main():\n    ncpt = HTMLTableMaker()\n    res = ncpt.MakeHTMLTable()\n    f = open(\"VTKColorSeriesPatches.html\", \"w\", newline=\"\\n\")\n    f.write(res)\n    f.close()\n\n\nclass HTMLToFromRGBAColor:\n\n    @staticmethod\n    def RGBToHTMLColor(rgb):\n        \"\"\"\n        Convert an [R, G, B] list to #RRGGBB.\n        :param: rgb - The elements of the array rgb are unsigned chars (0..255).\n        :return: The html color.\n        \"\"\"\n        hexcolor = \"#\" + ''.join(['{:02x}'.format(x) for x in rgb])\n        return hexcolor\n\n    @staticmethod\n    def HTMLColorToRGB(colorString):\n        \"\"\"\n        Convert #RRGGBB to a [R, G, B] list.\n        :param: colorString a string in the form: #RRGGBB where RR, GG, BB are hexadecimal.\n        The elements of the array rgb are unsigned chars (0..255).\n        :return: The red, green and blue components as a list.\n        \"\"\"\n        colorString = colorString.strip()\n        if colorString[0] == '#':\n            colorString = colorString[1:]\n        if len(colorString) != 6:\n            raise ValueError(\"Input #%s is not in #RRGGBB format\" % colorString)\n        r, g, b = colorString[:2], colorString[2:4], colorString[4:]\n        r, g, b = [int(n, 16) for n in (r, g, b)]\n        return [r, g, b]\n\n    @staticmethod\n    def RGBToLumaCCIR601(rgb):\n        \"\"\"\n        RGB -> Luma conversion\n        Digital CCIR601 (gives less weight to the R and B components)\n        :param: rgb - The elements of the array rgb are unsigned chars (0..255).\n        :return: The luminance.\n        \"\"\"\n        Y = 0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]\n        return Y\n\n\nclass ColorStructures:\n    \"\"\"\n    Holds the color series id, name and colors.\n    \"\"\"\n\n    cs_colors = dict()\n    max_colors = 0\n\n    def __init__(self):\n        cs = vtkColorSeries()\n        sizes = list()\n        for i in range(0, cs.GetNumberOfColorSchemes()):\n            cs.SetColorScheme(i)\n            sizes.append(cs.GetNumberOfColors())\n            vc = list()\n            for j in range(0, cs.GetNumberOfColors()):\n                vc.append(cs.GetColor(j))\n            self.cs_colors[i] = [cs.GetColorSchemeName(), vc]\n        self.max_colors = max(sizes)\n\n\nclass HTMLTableMaker:\n    \"\"\"\n      This class creates HTML Tables displaying all the colors in\n      the class vtkNamedColors grouped by various categories.\n    \"\"\"\n\n    def __init__(self):\n        self.cs = ColorStructures()\n        self.nc = vtkNamedColors()\n        self.htmlRGBA = HTMLToFromRGBAColor()\n\n    @staticmethod\n    def MakeHTMLStyle():\n        s = '  <style>\\n'\n        s += '\\n'\n        s += '  body {\\n'\n        s += '    background-color: snow\\n'\n        s += '  }\\n'\n        s += '  h1 {text-align:left;}\\n'\n        s += '  h2 {text-align:left;}\\n'\n        s += '  h3 {text-align:left;}\\n'\n        s += '  h4 {text-align:left;}\\n'\n        s += '  h5 {text-align:left;}\\n'\n        s += '  h6 {text-align:left;}\\n'\n        s += '\\n'\n        s += '  p {text-align:left;}\\n'\n        s += '\\n'\n        s += '  table {\\n'\n        s += '    font-family: arial, sans-serif;\\n'\n        s += '    border-collapse: collapse;\\n'\n        s += '    font-size: medium;\\n'\n        s += '    padding: 4px;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  th {\\n'\n        s += '    background: LightSteelBlue;\\n'\n        s += '    font-size: medium;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  th[colspan]:not([colspan=\"1\"]) {\\n'\n        s += '    background: LightSteelBlue;\\n'\n        s += '    font-size: medium;\\n'\n        s += '    text-align : center;\\n'\n        s += '    vertical-align : top;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  tr {\\n'\n        s += '    background: MintCream;\\n'\n        s += '    vertical-align : top;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  td {\\n'\n        s += '    background: MintCream;\\n'\n        s += '    border: 1px solid #dddddd;\\n'\n        s += '    text-align: left;\\n'\n        s += '    padding: 8px;\\n'\n        s += '    font-family: monospace;\\n'\n        s += '    font-size: medium;\\n'\n        s += '    font-weight: bold;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  td[colspan]:not([colspan=\"1\"]) {\\n'\n        s += '    text-align : center;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  .cour {\\n'\n        s += '    font-family: Courier;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  html, body {\\n'\n        s += '    height: 100%;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  html {\\n'\n        s += '    display: table;\\n'\n        s += '    margin: auto;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  body {\\n'\n        s += '    display: table-cell;\\n'\n        s += '    vertical-align: middle;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  thead {color: DarkGreen;}\\n'\n        s += '  tbody {color: MidnightBlue;}\\n'\n        s += '  tfoot {color: SaddleBrown;}\\n'\n        s += '\\n'\n        s += '  </style>\\n'\n        return s\n\n    def MakeHTMLHeader(self):\n        s = '<!DOCTYPE html>\\n'\n        s += '<html lang=\"en\">\\n'\n        s += '<head>\\n'\n        s += '<meta charset=\"UTF-8\" />\\n'\n        s += '<title>vtkColorSeries</title>\\n'\n        s += self.MakeHTMLStyle()\n        s += '</head>\\n'\n        return s\n\n    def MakeTableHeader(self):\n        s = '<tr>\\n'\n        s += '<th>Index</th>\\n'\n        s += '<th colspan=\"' + str(self.cs.max_colors) + '\">Name</th>\\n'\n        s += '</tr>\\n'\n        s += '<tr>\\n'\n        s += '<th></th>\\n'\n        s += '<th colspan=\"' + str(self.cs.max_colors) + '\">Colors in the Series</th>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def MakeTD1(self, idx, name):\n        s = '<tr>\\n'\n        s += '<td>'\n        s += '<b>' + str(idx) + '</b>'\n        s += '</td>\\n'\n        s += '<td colspan=\"' + str(self.cs.max_colors) + '\">'\n        s += '<b>' + name + '</b>'\n        s += '</td>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def MakeTD2(self, rgbs):\n        s = '<tr>\\n'\n        s += '<td></td>\\n'\n\n        cnt = 0\n        for p in rgbs:\n            ss = '{:3d}  '.format(cnt)\n            ss = ss.replace(' ', '&#160;')\n            y = self.htmlRGBA.RGBToLumaCCIR601(p)\n            textColor = '#000000'  # Black\n            if y < 255 / 2.0:\n                textColor = '#ffffff'  # White\n            s += '<td style=\"background:' + self.htmlRGBA.RGBToHTMLColor(p) + ';color:'\n            s += textColor + '\">' + ss + '</td>\\n'\n            cnt += 1\n        if cnt < self.cs.max_colors:\n            s += '<td colspan=\"' + str(self.cs.max_colors - cnt) + '\"> &#160; </td>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def MakeTable(self):\n        res = self.MakeTableHeader()\n        for idx, v in self.cs.cs_colors.items():\n            name = v[0]\n            res += self.MakeTD1(idx, name)\n            res += self.MakeTD2(v[1])\n\n        return res\n\n    def MakeHTMLTable(self):\n\n        res = self.MakeHTMLHeader()\n        res += '<body>\\n'\n        res += '<h1>Color series available in vtkColorSeries</h1>\\n'\n        res += '<table>\\n'\n        res += self.MakeTable()\n        res += '</table>\\n'\n        res += '</body>\\n'\n        return res\n\n\nif __name__ == \"__main__\":\n    main()\n
        "},{"location":"Python/Visualization/ColoredAnnotatedCube/","title":"ColoredAnnotatedCube","text":"

        vtk-examples/Python/Visualization/ColoredAnnotatedCube

        "},{"location":"Python/Visualization/ColoredAnnotatedCube/#description","title":"Description","text":"

        This example demonstrates how to color the individual faces of an annotated cube.

        This is based on a very nice example by Rodrigo Figueiredo in this discussion.

        The process is:

        • Create the annotated cube actor using vtkAnnotatedCubeActor.
        • Select the names on the faces, text colors and, if needed, any rotations of the text.
        • Make the annotated cube transparent.
        • Create a cube actor with colored faces.
        • Combine the annotated cube actor and cube actor into a prop assembly using vtkPropAssembly. Since the annotated cube and the cube are the same size you get an assembly with colored cube faces and the requisite text.
        • Create a vtkOrientationMarkerWidget and set the set the orientation marker to be the prop assembly.

        The function MakeAnnotatedCubeActor generates the annotated cube with different colored faces which is then added to a vtkOrientationMarkerWidget.

        The colored annotated cube is then placed in the lower left of the view (default). Additionally, a vtkOrientationMarkerWidget containing an axes actor has been added to the lower right of the view.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/ColoredAnnotatedCube/#code","title":"Code","text":"

        ColoredAnnotatedCube.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import (\n    vtkLookupTable,\n    vtkUnsignedCharArray\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkBandedPolyDataContourFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource\n)\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import (\n    vtkAnnotatedCubeActor,\n    vtkAxesActor\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropAssembly,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # Basic stuff setup\n    # Set up the renderer, window, and interactor\n    colors = vtkNamedColors()\n\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(640, 480)\n    iRen = vtkRenderWindowInteractor()\n    iRen.SetRenderWindow(renWin)\n\n    # Create a cone with an elliptical base whose major axis is in the\n    # X-direction.\n    coneSource = vtkConeSource()\n    coneSource.SetCenter(0.0, 0.0, 0.0)\n    coneSource.SetRadius(5.0)\n    coneSource.SetHeight(15.0)\n    coneSource.SetDirection(0, 1, 0)\n    coneSource.SetResolution(60)\n    coneSource.Update()\n\n    transform = vtkTransform()\n    transform.Scale(1.0, 1.0, 0.75)\n\n    transF = vtkTransformPolyDataFilter()\n    transF.SetInputConnection(coneSource.GetOutputPort())\n    transF.SetTransform(transform)\n\n    bounds = transF.GetOutput().GetBounds()\n\n    elevation = vtkElevationFilter()\n    elevation.SetInputConnection(transF.GetOutputPort())\n    elevation.SetLowPoint(0, bounds[2], 0)\n    elevation.SetHighPoint(0, bounds[3], 0)\n\n    bandedContours = vtkBandedPolyDataContourFilter()\n    bandedContours.SetInputConnection(elevation.GetOutputPort())\n    bandedContours.SetScalarModeToValue()\n    bandedContours.GenerateContourEdgesOn()\n    bandedContours.GenerateValues(11, elevation.GetScalarRange())\n\n    # Make a lookup table using a color series.\n    colorSeries = vtkColorSeries()\n    colorSeries.SetColorScheme(vtkColorSeries.BREWER_DIVERGING_SPECTRAL_11)\n\n    lut = vtkLookupTable()\n    colorSeries.BuildLookupTable(lut, vtkColorSeries.ORDINAL)\n\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(bandedContours.GetOutputPort())\n    coneMapper.SetScalarRange(elevation.GetScalarRange())\n    coneMapper.SetLookupTable(lut)\n\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n\n    # Contouring\n    contourLineMapper = vtkPolyDataMapper()\n    contourLineMapper.SetInputData(bandedContours.GetContourEdgesOutput())\n    contourLineMapper.SetScalarRange(elevation.GetScalarRange())\n    contourLineMapper.SetResolveCoincidentTopologyToPolygonOffset()\n\n    contourLineActor = vtkActor()\n    contourLineActor.SetMapper(contourLineMapper)\n    contourLineActor.GetProperty().SetColor(\n        colors.GetColor3d('DimGray'))\n\n    # Set up the Orientation Marker Widget.\n    prop_assembly = MakeAnnotatedCubeActor(colors)\n    om1 = vtkOrientationMarkerWidget()\n    om1.SetOrientationMarker(prop_assembly)\n    om1.SetInteractor(iRen)\n    om1.SetDefaultRenderer(ren)\n    om1.On()\n    om1.InteractiveOn()\n\n    xyzLabels = ['X', 'Y', 'Z']\n    scale = [1.0, 1.0, 1.0]\n    axes = MakeAxesActor(scale, xyzLabels)\n\n    om2 = vtkOrientationMarkerWidget()\n    om2.SetOrientationMarker(axes)\n    # Position lower right in the viewport.\n    om2.SetViewport(0.8, 0, 1.0, 0.2)\n    om2.SetInteractor(iRen)\n    om2.EnabledOn()\n    om2.InteractiveOn()\n\n    ren.AddActor(coneActor)\n    ren.AddActor(contourLineActor)\n    ren.SetBackground2(colors.GetColor3d('RoyalBlue'))\n    ren.SetBackground(colors.GetColor3d('MistyRose'))\n    ren.GradientBackgroundOn()\n    ren.GetActiveCamera().Azimuth(45)\n    ren.GetActiveCamera().Pitch(-22.5)\n    ren.ResetCamera()\n\n    renWin.SetSize(600, 600)\n    renWin.Render()\n    renWin.SetWindowName('ColoredAnnotatedCube')\n    renWin.Render()\n    iRen.Start()\n\n\ndef MakeAnnotatedCubeActor(colors):\n    # Annotated Cube setup\n    annotated_cube = vtkAnnotatedCubeActor()\n    annotated_cube.SetFaceTextScale(0.366667)\n\n    # Anatomic labeling\n    annotated_cube.SetXPlusFaceText('X+')\n    annotated_cube.SetXMinusFaceText('X-')\n    annotated_cube.SetYPlusFaceText('Y+')\n    annotated_cube.SetYMinusFaceText('Y-')\n    annotated_cube.SetZPlusFaceText('Z+')\n    annotated_cube.SetZMinusFaceText('Z-')\n\n    # Change the vector text colors\n    annotated_cube.GetTextEdgesProperty().SetColor(\n        colors.GetColor3d('Black'))\n    annotated_cube.GetTextEdgesProperty().SetLineWidth(1)\n\n    annotated_cube.GetXPlusFaceProperty().SetColor(\n        colors.GetColor3d('Turquoise'))\n    annotated_cube.GetXMinusFaceProperty().SetColor(\n        colors.GetColor3d('Turquoise'))\n    annotated_cube.GetYPlusFaceProperty().SetColor(\n        colors.GetColor3d('Mint'))\n    annotated_cube.GetYMinusFaceProperty().SetColor(\n        colors.GetColor3d('Mint'))\n    annotated_cube.GetZPlusFaceProperty().SetColor(\n        colors.GetColor3d('Tomato'))\n    annotated_cube.GetZMinusFaceProperty().SetColor(\n        colors.GetColor3d('Tomato'))\n    annotated_cube.SetXFaceTextRotation(90)\n    annotated_cube.SetYFaceTextRotation(180)\n    annotated_cube.SetZFaceTextRotation(-90)\n    # Make the annotated cube transparent\n    annotated_cube.GetCubeProperty().SetOpacity(0)\n\n    # Colored faces cube setup\n    cube_source = vtkCubeSource()\n    cube_source.Update()\n\n    face_colors = vtkUnsignedCharArray()\n    face_colors.SetNumberOfComponents(3)\n    face_x_plus = colors.GetColor3ub('Red')\n    face_x_minus = colors.GetColor3ub('Green')\n    face_y_plus = colors.GetColor3ub('Blue')\n    face_y_minus = colors.GetColor3ub('Yellow')\n    face_z_plus = colors.GetColor3ub('Cyan')\n    face_z_minus = colors.GetColor3ub('Magenta')\n    face_colors.InsertNextTypedTuple(face_x_minus)\n    face_colors.InsertNextTypedTuple(face_x_plus)\n    face_colors.InsertNextTypedTuple(face_y_minus)\n    face_colors.InsertNextTypedTuple(face_y_plus)\n    face_colors.InsertNextTypedTuple(face_z_minus)\n    face_colors.InsertNextTypedTuple(face_z_plus)\n\n    cube_source.GetOutput().GetCellData().SetScalars(face_colors)\n    cube_source.Update()\n\n    cube_mapper = vtkPolyDataMapper()\n    cube_mapper.SetInputData(cube_source.GetOutput())\n    cube_mapper.Update()\n\n    cube_actor = vtkActor()\n    cube_actor.SetMapper(cube_mapper)\n\n    # Assemble the colored cube and annotated cube texts into a composite prop.\n    prop_assembly = vtkPropAssembly()\n    prop_assembly.AddPart(annotated_cube)\n    prop_assembly.AddPart(cube_actor)\n    return prop_assembly\n\n\ndef MakeAxesActor(scale, xyzLabels):\n    axes = vtkAxesActor()\n    axes.SetScale(scale[0], scale[1], scale[2])\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText(xyzLabels[0])\n    axes.SetYAxisLabelText(xyzLabels[1])\n    axes.SetZAxisLabelText(xyzLabels[2])\n    axes.SetCylinderRadius(0.5 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.025 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.5 * axes.GetSphereRadius())\n    tprop = axes.GetXAxisCaptionActor2D().GetCaptionTextProperty()\n    tprop.ItalicOn()\n    tprop.ShadowOn()\n    tprop.SetFontFamilyToTimes()\n    # Use the same text properties on the other two axes.\n    axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    return axes\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/ComplexV/","title":"ComplexV","text":"

        vtk-examples/Python/Visualization/ComplexV

        "},{"location":"Python/Visualization/ComplexV/#description","title":"Description","text":"

        ComplexV from the VTK Textbook. The original example was written in TCL.

        The example shows 167,000 3D vectors (using oriented and scaled lines) in the region of the human carotid artery. The larger vectors lie inside the arteries, the smaller vectors lie outside the arteries and are randomly oriented (measurement error) but small in magnitude. Clearly the details of the vector field are not discernible from this image.

        Info

        See Figure 6-13 in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/ComplexV/#code","title":"Code","text":"

        ComplexV.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkHedgeHog\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(fileName)\n\n    hhog = vtkHedgeHog()\n    hhog.SetInputConnection(reader.GetOutputPort())\n    hhog.SetScaleFactor(0.3)\n\n    lut = vtkLookupTable()\n    # lut.SetHueRange(.667, 0.0)\n    lut.Build()\n\n    hhogMapper = vtkPolyDataMapper()\n    hhogMapper.SetInputConnection(hhog.GetOutputPort())\n    hhogMapper.SetScalarRange(50, 550)\n    hhogMapper.SetLookupTable(lut)\n\n    hhogActor = vtkActor()\n    hhogActor.SetMapper(hhogMapper)\n\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    aRenderer = vtkRenderer()\n    aRenderWindow = vtkRenderWindow()\n    aRenderWindow.AddRenderer(aRenderer)\n    anInteractor = vtkRenderWindowInteractor()\n    anInteractor.SetRenderWindow(aRenderWindow)\n    aRenderWindow.SetSize(640, 480)\n    aRenderWindow.SetWindowName('ComplexV')\n\n    aRenderer.AddActor(outlineActor)\n    aRenderer.AddActor(hhogActor)\n\n    aRenderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Generate an interesting view.\n\n    aRenderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    aRenderer.GetActiveCamera().SetPosition(1, 0, 0)\n    aRenderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    aRenderer.ResetCamera()\n\n    aRenderer.GetActiveCamera().Azimuth(60)\n    aRenderer.GetActiveCamera().Elevation(30)\n    aRenderer.GetActiveCamera().Dolly(1.1)\n    aRenderer.ResetCameraClippingRange()\n\n    aRenderWindow.Render()\n\n    # Interact with the data.\n    anInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Vector visualization techniques.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='carotid.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/CreateColorSeriesDemo/","title":"CreateColorSeriesDemo","text":"

        vtk-examples/Python/Visualization/CreateColorSeriesDemo

        "},{"location":"Python/Visualization/CreateColorSeriesDemo/#description","title":"Description","text":"

        This example demonstrates how to create a custom vtkColorSeries. The examples produces a vtkLookupTable explicitly. The vtkLookupTable is populated with colors from the vtkColorSeries using GetColorRepeating, since the size of the vtkLookupTable may be larger than the colors in the vtkColorSeries.

        A vtkPlaneSource generates the geometry. The vtkCellData is populated with increasing integers starting at 1.

        Ten different color series are generated from VTK color names in vtkNamedColors. The first argument of the example is one of \"Blue\", \"Brown\", \"Red\", \"Orange\", \"White\", \"Grey\", \"Magenta\", \"Cyan\", \"Yellow\" and \"Green\".

        The colors are added from left to right, row by row, from the bottom left-hand corner of the table.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/CreateColorSeriesDemo/#code","title":"Code","text":"

        CreateColorSeriesDemo.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkLookupTable\n)\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'how to create a custom vtkColorSeries.'\n    epilogue = '''\nA vtkLookupTable is explicitly produced, it is populated with colors from the vtkColorSeries\n   using GetColorRepeating, since the size of the vtkLookupTable may be larger than the\n   colors in the vtkColorSeries.\n\nTen different color series are generated from VTK color names in vtkNamedColors.\nChoose from one of: Blue, Brown, Red, Orange, White, Grey, Magenta, Cyan, Yellow and Green.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('seriesName', default='Red', nargs='?',\n                        help='The name of the color series to use (default is Red).')\n    args = parser.parse_args()\n    return args.seriesName\n\n\ndef CreateLookupTableVTKBlue(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKBlueColors')\n\n    myColors.AddColor(nc.GetColor3ub('alice_blue'))\n    myColors.AddColor(nc.GetColor3ub('blue'))\n    myColors.AddColor(nc.GetColor3ub('blue_light'))\n    myColors.AddColor(nc.GetColor3ub('blue_medium'))\n    myColors.AddColor(nc.GetColor3ub('cadet'))\n    myColors.AddColor(nc.GetColor3ub('cobalt'))\n    myColors.AddColor(nc.GetColor3ub('cornflower'))\n    myColors.AddColor(nc.GetColor3ub('cerulean'))\n    myColors.AddColor(nc.GetColor3ub('dodger_blue'))\n    myColors.AddColor(nc.GetColor3ub('indigo'))\n    myColors.AddColor(nc.GetColor3ub('manganese_blue'))\n    myColors.AddColor(nc.GetColor3ub('midnight_blue'))\n    myColors.AddColor(nc.GetColor3ub('navy'))\n    myColors.AddColor(nc.GetColor3ub('peacock'))\n    myColors.AddColor(nc.GetColor3ub('powder_blue'))\n    myColors.AddColor(nc.GetColor3ub('royal_blue'))\n    myColors.AddColor(nc.GetColor3ub('slate_blue'))\n    myColors.AddColor(nc.GetColor3ub('slate_blue_dark'))\n    myColors.AddColor(nc.GetColor3ub('slate_blue_light'))\n    myColors.AddColor(nc.GetColor3ub('slate_blue_medium'))\n    myColors.AddColor(nc.GetColor3ub('sky_blue'))\n    myColors.AddColor(nc.GetColor3ub('sky_blue_deep'))\n    myColors.AddColor(nc.GetColor3ub('sky_blue_light'))\n    myColors.AddColor(nc.GetColor3ub('steel_blue'))\n    myColors.AddColor(nc.GetColor3ub('steel_blue_light'))\n    myColors.AddColor(nc.GetColor3ub('turquoise_blue'))\n    myColors.AddColor(nc.GetColor3ub('ultramarine'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKBrown(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKBrownColors')\n\n    myColors.AddColor(nc.GetColor3ub('beige'))\n    myColors.AddColor(nc.GetColor3ub('brown'))\n    myColors.AddColor(nc.GetColor3ub('brown_madder'))\n    myColors.AddColor(nc.GetColor3ub('brown_ochre'))\n    myColors.AddColor(nc.GetColor3ub('burlywood'))\n    myColors.AddColor(nc.GetColor3ub('burnt_sienna'))\n    myColors.AddColor(nc.GetColor3ub('burnt_umber'))\n    myColors.AddColor(nc.GetColor3ub('chocolate'))\n    myColors.AddColor(nc.GetColor3ub('deep_ochre'))\n    myColors.AddColor(nc.GetColor3ub('flesh'))\n    myColors.AddColor(nc.GetColor3ub('flesh_ochre'))\n    myColors.AddColor(nc.GetColor3ub('gold_ochre'))\n    myColors.AddColor(nc.GetColor3ub('greenish_umber'))\n    myColors.AddColor(nc.GetColor3ub('khaki'))\n    myColors.AddColor(nc.GetColor3ub('khaki_dark'))\n    myColors.AddColor(nc.GetColor3ub('light_beige'))\n    myColors.AddColor(nc.GetColor3ub('peru'))\n    myColors.AddColor(nc.GetColor3ub('rosy_brown'))\n    myColors.AddColor(nc.GetColor3ub('raw_sienna'))\n    myColors.AddColor(nc.GetColor3ub('raw_umber'))\n    myColors.AddColor(nc.GetColor3ub('sepia'))\n    myColors.AddColor(nc.GetColor3ub('sienna'))\n    myColors.AddColor(nc.GetColor3ub('saddle_brown'))\n    myColors.AddColor(nc.GetColor3ub('sandy_brown'))\n    myColors.AddColor(nc.GetColor3ub('tan'))\n    myColors.AddColor(nc.GetColor3ub('van_dyke_brown'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKRed(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKRedColors')\n\n    myColors.AddColor(nc.GetColor3ub('alizarin_crimson'))\n    myColors.AddColor(nc.GetColor3ub('brick'))\n    myColors.AddColor(nc.GetColor3ub('cadmium_red_deep'))\n    myColors.AddColor(nc.GetColor3ub('coral'))\n    myColors.AddColor(nc.GetColor3ub('coral_light'))\n    myColors.AddColor(nc.GetColor3ub('deep_pink'))\n    myColors.AddColor(nc.GetColor3ub('english_red'))\n    myColors.AddColor(nc.GetColor3ub('firebrick'))\n    myColors.AddColor(nc.GetColor3ub('geranium_lake'))\n    myColors.AddColor(nc.GetColor3ub('hot_pink'))\n    myColors.AddColor(nc.GetColor3ub('indian_red'))\n    myColors.AddColor(nc.GetColor3ub('light_salmon'))\n    myColors.AddColor(nc.GetColor3ub('madder_lake_deep'))\n    myColors.AddColor(nc.GetColor3ub('maroon'))\n    myColors.AddColor(nc.GetColor3ub('pink'))\n    myColors.AddColor(nc.GetColor3ub('pink_light'))\n    myColors.AddColor(nc.GetColor3ub('raspberry'))\n    myColors.AddColor(nc.GetColor3ub('red'))\n    myColors.AddColor(nc.GetColor3ub('rose_madder'))\n    myColors.AddColor(nc.GetColor3ub('salmon'))\n    myColors.AddColor(nc.GetColor3ub('tomato'))\n    myColors.AddColor(nc.GetColor3ub('venetian_red'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKOrange(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKOrangeColors')\n\n    myColors.AddColor(nc.GetColor3ub('cadmium_orange'))\n    myColors.AddColor(nc.GetColor3ub('cadmium_red_light'))\n    myColors.AddColor(nc.GetColor3ub('carrot'))\n    myColors.AddColor(nc.GetColor3ub('dark_orange'))\n    myColors.AddColor(nc.GetColor3ub('mars_orange'))\n    myColors.AddColor(nc.GetColor3ub('mars_yellow'))\n    myColors.AddColor(nc.GetColor3ub('orange'))\n    myColors.AddColor(nc.GetColor3ub('orange_red'))\n    myColors.AddColor(nc.GetColor3ub('yellow_ochre'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKWhite(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKWhiteColors')\n\n    myColors.AddColor(nc.GetColor3ub('antique_white'))\n    myColors.AddColor(nc.GetColor3ub('azure'))\n    myColors.AddColor(nc.GetColor3ub('bisque'))\n    myColors.AddColor(nc.GetColor3ub('blanched_almond'))\n    myColors.AddColor(nc.GetColor3ub('cornsilk'))\n    myColors.AddColor(nc.GetColor3ub('eggshell'))\n    myColors.AddColor(nc.GetColor3ub('floral_white'))\n    myColors.AddColor(nc.GetColor3ub('gainsboro'))\n    myColors.AddColor(nc.GetColor3ub('ghost_white'))\n    myColors.AddColor(nc.GetColor3ub('honeydew'))\n    myColors.AddColor(nc.GetColor3ub('ivory'))\n    myColors.AddColor(nc.GetColor3ub('lavender'))\n    myColors.AddColor(nc.GetColor3ub('lavender_blush'))\n    myColors.AddColor(nc.GetColor3ub('lemon_chiffon'))\n    myColors.AddColor(nc.GetColor3ub('linen'))\n    myColors.AddColor(nc.GetColor3ub('mint_cream'))\n    myColors.AddColor(nc.GetColor3ub('misty_rose'))\n    myColors.AddColor(nc.GetColor3ub('moccasin'))\n    myColors.AddColor(nc.GetColor3ub('navajo_white'))\n    myColors.AddColor(nc.GetColor3ub('old_lace'))\n    myColors.AddColor(nc.GetColor3ub('papaya_whip'))\n    myColors.AddColor(nc.GetColor3ub('peach_puff'))\n    myColors.AddColor(nc.GetColor3ub('seashell'))\n    myColors.AddColor(nc.GetColor3ub('snow'))\n    myColors.AddColor(nc.GetColor3ub('thistle'))\n    myColors.AddColor(nc.GetColor3ub('titanium_white'))\n    myColors.AddColor(nc.GetColor3ub('wheat'))\n    myColors.AddColor(nc.GetColor3ub('white'))\n    myColors.AddColor(nc.GetColor3ub('white_smoke'))\n    myColors.AddColor(nc.GetColor3ub('zinc_white'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKGrey(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKGreyColors')\n\n    myColors.AddColor(nc.GetColor3ub('cold_grey'))\n    myColors.AddColor(nc.GetColor3ub('dim_grey'))\n    myColors.AddColor(nc.GetColor3ub('grey'))\n    myColors.AddColor(nc.GetColor3ub('light_grey'))\n    myColors.AddColor(nc.GetColor3ub('slate_grey'))\n    myColors.AddColor(nc.GetColor3ub('slate_grey_dark'))\n    myColors.AddColor(nc.GetColor3ub('slate_grey_light'))\n    myColors.AddColor(nc.GetColor3ub('warm_grey'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKMagenta(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKMagentaColors')\n\n    myColors.AddColor(nc.GetColor3ub('blue_violet'))\n    myColors.AddColor(nc.GetColor3ub('cobalt_violet_deep'))\n    myColors.AddColor(nc.GetColor3ub('magenta'))\n    myColors.AddColor(nc.GetColor3ub('orchid'))\n    myColors.AddColor(nc.GetColor3ub('orchid_dark'))\n    myColors.AddColor(nc.GetColor3ub('orchid_medium'))\n    myColors.AddColor(nc.GetColor3ub('permanent_red_violet'))\n    myColors.AddColor(nc.GetColor3ub('plum'))\n    myColors.AddColor(nc.GetColor3ub('purple'))\n    myColors.AddColor(nc.GetColor3ub('purple_medium'))\n    myColors.AddColor(nc.GetColor3ub('ultramarine_violet'))\n    myColors.AddColor(nc.GetColor3ub('violet'))\n    myColors.AddColor(nc.GetColor3ub('violet_dark'))\n    myColors.AddColor(nc.GetColor3ub('violet_red'))\n    myColors.AddColor(nc.GetColor3ub('violet_red_medium'))\n    myColors.AddColor(nc.GetColor3ub('violet_red_pale'))\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKCyan(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKCyanColors')\n\n    myColors.AddColor(nc.GetColor3ub('aquamarine'))\n    myColors.AddColor(nc.GetColor3ub('aquamarine_medium'))\n    myColors.AddColor(nc.GetColor3ub('cyan'))\n    myColors.AddColor(nc.GetColor3ub('cyan_white'))\n    myColors.AddColor(nc.GetColor3ub('turquoise'))\n    myColors.AddColor(nc.GetColor3ub('turquoise_dark'))\n    myColors.AddColor(nc.GetColor3ub('turquoise_medium'))\n    myColors.AddColor(nc.GetColor3ub('turquoise_pale'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKYellow(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKYellowColors')\n\n    myColors.AddColor(nc.GetColor3ub('aureoline_yellow'))\n    myColors.AddColor(nc.GetColor3ub('banana'))\n    myColors.AddColor(nc.GetColor3ub('cadmium_lemon'))\n    myColors.AddColor(nc.GetColor3ub('cadmium_yellow'))\n    myColors.AddColor(nc.GetColor3ub('cadmium_yellow_light'))\n    myColors.AddColor(nc.GetColor3ub('gold'))\n    myColors.AddColor(nc.GetColor3ub('goldenrod'))\n    myColors.AddColor(nc.GetColor3ub('goldenrod_dark'))\n    myColors.AddColor(nc.GetColor3ub('goldenrod_light'))\n    myColors.AddColor(nc.GetColor3ub('goldenrod_pale'))\n    myColors.AddColor(nc.GetColor3ub('light_goldenrod'))\n    myColors.AddColor(nc.GetColor3ub('melon'))\n    myColors.AddColor(nc.GetColor3ub('naples_yellow_deep'))\n    myColors.AddColor(nc.GetColor3ub('yellow'))\n    myColors.AddColor(nc.GetColor3ub('yellow_light'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef CreateLookupTableVTKGreen(size):\n    nc = vtkNamedColors()\n    myColors = vtkColorSeries()\n    myColors.SetColorSchemeByName('VTKGreenColors')\n\n    myColors.AddColor(nc.GetColor3ub('chartreuse'))\n    myColors.AddColor(nc.GetColor3ub('chrome_oxide_green'))\n    myColors.AddColor(nc.GetColor3ub('cinnabar_green'))\n    myColors.AddColor(nc.GetColor3ub('cobalt_green'))\n    myColors.AddColor(nc.GetColor3ub('emerald_green'))\n    myColors.AddColor(nc.GetColor3ub('forest_green'))\n    myColors.AddColor(nc.GetColor3ub('green'))\n    myColors.AddColor(nc.GetColor3ub('green_dark'))\n    myColors.AddColor(nc.GetColor3ub('green_pale'))\n    myColors.AddColor(nc.GetColor3ub('green_yellow'))\n    myColors.AddColor(nc.GetColor3ub('lawn_green'))\n    myColors.AddColor(nc.GetColor3ub('lime_green'))\n    myColors.AddColor(nc.GetColor3ub('mint'))\n    myColors.AddColor(nc.GetColor3ub('olive'))\n    myColors.AddColor(nc.GetColor3ub('olive_drab'))\n    myColors.AddColor(nc.GetColor3ub('olive_green_dark'))\n    myColors.AddColor(nc.GetColor3ub('permanent_green'))\n    myColors.AddColor(nc.GetColor3ub('sap_green'))\n    myColors.AddColor(nc.GetColor3ub('sea_green'))\n    myColors.AddColor(nc.GetColor3ub('sea_green_dark'))\n    myColors.AddColor(nc.GetColor3ub('sea_green_medium'))\n    myColors.AddColor(nc.GetColor3ub('sea_green_light'))\n    myColors.AddColor(nc.GetColor3ub('spring_green'))\n    myColors.AddColor(nc.GetColor3ub('spring_green_medium'))\n    myColors.AddColor(nc.GetColor3ub('terre_verte'))\n    myColors.AddColor(nc.GetColor3ub('viridian_light'))\n    myColors.AddColor(nc.GetColor3ub('yellow_green'))\n\n    numberOfColors = myColors.GetNumberOfColors()\n    print('Number of colors:', numberOfColors)\n\n    lut = vtkLookupTable()\n    if size == 0:\n        lut.SetNumberOfTableValues(numberOfColors)\n    else:\n        lut.SetNumberOfTableValues(size)\n    lut.SetTableRange(0, lut.GetNumberOfTableValues())\n    for i in range(lut.GetNumberOfTableValues()):\n        color = myColors.GetColorRepeating(i)\n        c = [color.GetRed(), color.GetGreen(), color.GetBlue(), 255]\n        lut.SetTableValue(i, [x / 255.0 for x in c])\n    return lut\n\n\ndef main():\n    seriesName = get_program_parameters()\n    seriesName = seriesName.capitalize()\n    available_color_series = ['Blue', 'Brown', 'Red', 'Orange', 'White', 'Grey', 'Magenta', 'Cyan', 'Yellow', 'Green']\n    if seriesName not in available_color_series:\n        print('Available color maps are:', \", \".join(available_color_series))\n        return\n\n    colors = vtkNamedColors()\n\n    # Provide some geometry.\n    xResolution = 6\n    yResolution = 6\n    aPlane = vtkPlaneSource()\n    aPlane.SetXResolution(xResolution)\n    aPlane.SetYResolution(yResolution)\n    size = xResolution * yResolution + 1\n\n    # Create cell data.\n    cellData = vtkFloatArray()\n    for i in range(0, xResolution * yResolution):\n        cellData.InsertNextValue(i)\n    aPlane.Update()  # Force an update so we can set cell data.\n    aPlane.GetOutput().GetCellData().SetScalars(cellData)\n\n    # Get the lookup table.\n    lut = eval('CreateLookupTableVTK' + seriesName + '(size)')\n\n    # Set up the actor and mapper.\n    mapper = vtkPolyDataMapper()\n    mapper.SetLookupTable(lut)\n    mapper.SetInputConnection(aPlane.GetOutputPort())\n    mapper.SetScalarModeToUseCellData()\n    mapper.SetScalarRange(0, size)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().EdgeVisibilityOn()\n\n    # Setup render window, renderer, and interactor.\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('CreateColorSeriesDemo')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/CubeAxesActor/","title":"CubeAxesActor","text":"

        vtk-examples/Python/Visualization/CubeAxesActor

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/CubeAxesActor/#code","title":"Code","text":"

        CubeAxesActor.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSuperquadricSource\nfrom vtkmodules.vtkRenderingAnnotation import vtkCubeAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    backgroundColor = colors.GetColor3d(\"DarkSlateGray\")\n    actorColor = colors.GetColor3d(\"Tomato\")\n    axis1Color = colors.GetColor3d(\"Salmon\")\n    axis2Color = colors.GetColor3d(\"PaleGreen\")\n    axis3Color = colors.GetColor3d(\"LightSkyBlue\")\n\n    # Create a superquadric\n    superquadricSource = vtkSuperquadricSource()\n    superquadricSource.SetPhiRoundness(3.1)\n    superquadricSource.SetThetaRoundness(1.0)\n    superquadricSource.Update()  # needed to GetBounds later\n\n    renderer = vtkRenderer()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(superquadricSource.GetOutputPort())\n\n    superquadricActor = vtkActor()\n    superquadricActor.SetMapper(mapper)\n    superquadricActor.GetProperty().SetDiffuseColor(actorColor)\n    superquadricActor.GetProperty().SetDiffuse(.7)\n    superquadricActor.GetProperty().SetSpecular(.7)\n    superquadricActor.GetProperty().SetSpecularPower(50.0)\n\n    cubeAxesActor = vtkCubeAxesActor()\n    cubeAxesActor.SetUseTextActor3D(1)\n    cubeAxesActor.SetBounds(superquadricSource.GetOutput().GetBounds())\n    cubeAxesActor.SetCamera(renderer.GetActiveCamera())\n    cubeAxesActor.GetTitleTextProperty(0).SetColor(axis1Color)\n    cubeAxesActor.GetTitleTextProperty(0).SetFontSize(48)\n    cubeAxesActor.GetLabelTextProperty(0).SetColor(axis1Color)\n\n    cubeAxesActor.GetTitleTextProperty(1).SetColor(axis2Color)\n    cubeAxesActor.GetLabelTextProperty(1).SetColor(axis2Color)\n\n    cubeAxesActor.GetTitleTextProperty(2).SetColor(axis3Color)\n    cubeAxesActor.GetLabelTextProperty(2).SetColor(axis3Color)\n\n    cubeAxesActor.DrawXGridlinesOn()\n    cubeAxesActor.DrawYGridlinesOn()\n    cubeAxesActor.DrawZGridlinesOn()\n    cubeAxesActor.SetGridLineLocation(cubeAxesActor.VTK_GRID_LINES_FURTHEST)\n\n    cubeAxesActor.XAxisMinorTickVisibilityOff()\n    cubeAxesActor.YAxisMinorTickVisibilityOff()\n    cubeAxesActor.ZAxisMinorTickVisibilityOff()\n\n    cubeAxesActor.SetFlyModeToStaticEdges()\n    renderer.AddActor(cubeAxesActor)\n    renderer.AddActor(superquadricActor)\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    renderer.ResetCamera()\n    renderer.SetBackground(backgroundColor)\n\n    renderWindow = vtkRenderWindow()\n\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('CubeAxesActor')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderWindow.Render()\n    renderer.GetActiveCamera().Zoom(0.8)\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/CurvatureBandsWithGlyphs/","title":"CurvatureBandsWithGlyphs","text":"

        vtk-examples/Python/Visualization/CurvatureBandsWithGlyphs

        "},{"location":"Python/Visualization/CurvatureBandsWithGlyphs/#description","title":"Description","text":"

        In this example we are coloring the surface by partitioning the gaussian curvature into bands and using arrows to display the normals on the surface.

        Rather beautiful surfaces are generated.

        The banded contour filter and an indexed lookup table are used to generate the curvature bands on the surface. To further enhance the surface, the surface normals are glyphed and colored by elevation using a diverging lookup table.

        Note that:

        • If the regions on a surface have zero Gaussian curvature, then they can be flattened into a plane with no distortion, and the geometry of the region is Euclidean geometry.

        • If the regions on a surface have positive Gaussian curvature, then the geometry of the surface is spherical geometry.

        • If the regions on the surface have a negative Gaussian curvature, then the geometry of the surface is hyperbolic geometry.

        In the above image you can see that the random hills incorporate all of these geometries.

        The surface selected is the parametric random hills surface. The problem with the random hills surface is:

        • Most of the gaussian curvatures will lie in the range -1 to 0.2 (say) with a few large values say 20 to 40 at the peaks of the hills.
        • The edges of the random hills surface also have large irregular values so we need to handle these also. In order to fix this, a function is provided to adjust the edges.

        So we need to manually generate custom bands to group the curvatures. The bands selected in the examples show that the surface is mostly planar with some hyperbolic regions (saddle points) and some spherical regions.

        Feel free to experiment with different color schemes and/or the other sources from the parametric function group or the torus etc.

        You will usually need to adjust the parameters for maskPts, arrow and glyph for a nice appearance.

        A histogram of the frequencies is also output to the console. This is useful if you want to get an idea of the distribution of the scalars in each band.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/CurvatureBandsWithGlyphs/#code","title":"Code","text":"

        CurvatureBandsWithGlyphs.py

        #!/usr/bin/env python\n\nimport math\n\nimport numpy as np\nfrom vtkmodules.numpy_interface import dataset_adapter as dsa\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    VTK_DOUBLE,\n    vtkDoubleArray,\n    vtkFloatArray,\n    vtkIdList,\n    vtkLookupTable,\n    vtkPoints,\n    vtkVariant,\n    vtkVariantArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkDelaunay2D,\n    vtkElevationFilter,\n    vtkFeatureEdges,\n    vtkGlyph3D,\n    vtkIdFilter,\n    vtkMaskPoints,\n    vtkPolyDataNormals,\n    vtkReverseSense,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkCurvatures,\n    vtkTransformPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkBandedPolyDataContourFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkParametricFunctionSource,\n    vtkPlaneSource,\n    vtkSphereSource,\n    vtkSuperquadricSource\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtk.util import numpy_support\n\n\ndef main(argv):\n    # ------------------------------------------------------------\n    # Create the surface, lookup tables, contour filter etc.\n    # ------------------------------------------------------------\n    # desired_surface = 'Hills'\n    # desired_surface = 'ParametricTorus'\n    # desired_surface = 'Plane'\n    desired_surface = 'RandomHills'\n    # desired_surface = 'Sphere'\n    # desired_surface = 'Torus'\n    source = get_source(desired_surface)\n    if not source:\n        print('The surface is not available.')\n        return\n\n    # The length of the normal arrow glyphs.\n    scale_factor = 1.0\n    if desired_surface == 'Hills':\n        scale_factor = 0.5\n    elif desired_surface == 'Sphere':\n        scale_factor = 2.0\n    print(desired_surface)\n\n    gaussian_curvature = True\n    if gaussian_curvature:\n        curvature = 'Gauss_Curvature'\n    else:\n        curvature = 'Mean_Curvature'\n\n    cc = vtkCurvatures()\n    cc.SetInputData(source)\n    needs_adjusting = ['Hills', 'ParametricTorus', 'Plane', 'RandomHills', 'Torus']\n    if gaussian_curvature:\n        cc.SetCurvatureTypeToGaussian()\n        cc.Update()\n        if desired_surface in needs_adjusting:\n            adjust_edge_curvatures(cc.GetOutput(), curvature)\n        if desired_surface == 'Plane':\n            constrain_curvatures(cc.GetOutput(), curvature, 0.0, 0.0)\n        if desired_surface == 'Sphere':\n            # Gaussian curvature is 1/r^2\n            constrain_curvatures(cc.GetOutput(), curvature, 4.0, 4.0)\n    else:\n        cc.SetCurvatureTypeToMean()\n        cc.Update()\n        if desired_surface in needs_adjusting:\n            adjust_edge_curvatures(cc.GetOutput(), curvature)\n        if desired_surface == 'Plane':\n            constrain_curvatures(cc.GetOutput(), curvature, 0.0, 0.0)\n        if desired_surface == 'Sphere':\n            # Mean curvature is 1/r\n            constrain_curvatures(cc.GetOutput(), curvature, 2.0, 2.0)\n\n    cc.GetOutput().GetPointData().SetActiveScalars(curvature)\n    scalar_range_curvatures = cc.GetOutput().GetPointData().GetScalars(curvature).GetRange()\n    scalar_range_elevation = cc.GetOutput().GetPointData().GetScalars('Elevation').GetRange()\n\n    lut = get_categorical_lut()\n    lut1 = get_diverging_lut()\n    lut.SetTableRange(scalar_range_curvatures)\n    lut1.SetTableRange(scalar_range_elevation)\n    number_of_bands = lut.GetNumberOfTableValues()\n    bands = get_bands(scalar_range_curvatures, number_of_bands, 10)\n    if desired_surface == 'RandomHills':\n        # These are my custom bands.\n        # Generated by first running:\n        # bands = get_bands(scalar_range_curvatures, number_of_bands, False)\n        # then:\n        #  freq = frequencies(bands, src)\n        #  print_bands_frequencies(bands, freq)\n        # Finally using the output to create this table:\n        # my_bands = [\n        #     [-0.630, -0.190], [-0.190, -0.043], [-0.043, -0.0136],\n        #     [-0.0136, 0.0158], [0.0158, 0.0452], [0.0452, 0.0746],\n        #     [0.0746, 0.104], [0.104, 0.251], [0.251, 1.131]]\n        #  This demonstrates that the gaussian curvature of the surface\n        #   is mostly planar with some hyperbolic regions (saddle points)\n        #   and some spherical regions.\n        my_bands = [\n            [-0.630, -0.190], [-0.190, -0.043], [-0.043, 0.0452], [0.0452, 0.0746],\n            [0.0746, 0.104], [0.104, 0.251], [0.251, 1.131]]\n        # Comment this out if you want to see how allocating\n        # equally spaced bands works.\n        bands = get_custom_bands(scalar_range_curvatures, number_of_bands, my_bands)\n        # Adjust the number of table values\n        lut.SetNumberOfTableValues(len(bands))\n    elif desired_surface == 'Hills':\n        my_bands = [\n            [-2.104, -0.15], [-0.15, -0.1], [-0.1, -0.05],\n            [-0.05, -0.02], [-0.02, -0.005], [-0.005, -0.0005],\n            [-0.0005, 0.0005], [0.0005, 0.09], [0.09, 4.972]]\n        # Comment this out if you want to see how allocating\n        # equally spaced bands works.\n        bands = get_custom_bands(scalar_range_curvatures, number_of_bands, my_bands)\n        # Adjust the number of table values\n        lut.SetNumberOfTableValues(len(bands))\n\n    # Let's do a frequency table.\n    # The number of scalars in each band.\n    freq = get_frequencies(bands, cc.GetOutput())\n    bands, freq = adjust_ranges(bands, freq)\n    print_bands_frequencies(bands, freq)\n\n    lut.SetTableRange(scalar_range_curvatures)\n    lut.SetNumberOfTableValues(len(bands))\n\n    # We will use the midpoint of the band as the label.\n    labels = []\n    for k in bands:\n        labels.append('{:4.2f}'.format(bands[k][1]))\n\n    # Annotate\n    values = vtkVariantArray()\n    for i in range(len(labels)):\n        values.InsertNextValue(vtkVariant(labels[i]))\n    for i in range(values.GetNumberOfTuples()):\n        lut.SetAnnotation(i, values.GetValue(i).ToString())\n\n    # Create a lookup table with the colors reversed.\n    lutr = reverse_lut(lut)\n\n    # Create the contour bands.\n    bcf = vtkBandedPolyDataContourFilter()\n    bcf.SetInputData(cc.GetOutput())\n    # Use either the minimum or maximum value for each band.\n    for k in bands:\n        bcf.SetValue(k, bands[k][2])\n    # We will use an indexed lookup table.\n    bcf.SetScalarModeToIndex()\n    bcf.GenerateContourEdgesOn()\n\n    # Generate the glyphs on the original surface.\n    glyph = get_glyphs(cc.GetOutput(), scale_factor, False)\n\n    # ------------------------------------------------------------\n    # Create the mappers and actors\n    # ------------------------------------------------------------\n\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [179, 204, 255, 255])\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    src_mapper = vtkPolyDataMapper()\n    src_mapper.SetInputConnection(bcf.GetOutputPort())\n    src_mapper.SetScalarRange(scalar_range_curvatures)\n    src_mapper.SetLookupTable(lut)\n    src_mapper.SetScalarModeToUseCellData()\n\n    src_actor = vtkActor()\n    src_actor.SetMapper(src_mapper)\n\n    # Create contour edges\n    edge_mapper = vtkPolyDataMapper()\n    edge_mapper.SetInputData(bcf.GetContourEdgesOutput())\n    edge_mapper.SetResolveCoincidentTopologyToPolygonOffset()\n\n    edge_actor = vtkActor()\n    edge_actor.SetMapper(edge_mapper)\n    edge_actor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    glyph_mapper = vtkPolyDataMapper()\n    glyph_mapper.SetInputConnection(glyph.GetOutputPort())\n    glyph_mapper.SetScalarModeToUsePointFieldData()\n    glyph_mapper.SetColorModeToMapScalars()\n    glyph_mapper.ScalarVisibilityOn()\n    glyph_mapper.SelectColorArray('Elevation')\n    # Colour by scalars.\n    glyph_mapper.SetLookupTable(lut1)\n    glyph_mapper.SetScalarRange(scalar_range_elevation)\n\n    glyph_actor = vtkActor()\n    glyph_actor.SetMapper(glyph_mapper)\n\n    window_width = 800\n    window_height = 800\n\n    # Add scalar bars.\n    scalar_bar = vtkScalarBarActor()\n    # This LUT puts the lowest value at the top of the scalar bar.\n    # scalar_bar->SetLookupTable(lut);\n    # Use this LUT if you want the highest value at the top.\n    scalar_bar.SetLookupTable(lutr)\n    scalar_bar.SetTitle(curvature.replace('_', '\\n'))\n    scalar_bar.GetTitleTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.GetLabelTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.GetAnnotationTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.UnconstrainedFontSizeOn()\n    scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar.SetMaximumHeightInPixels(window_height // 3)\n    scalar_bar.SetPosition(0.85, 0.05)\n\n    scalar_bar_elev = vtkScalarBarActor()\n    # This LUT puts the lowest value at the top of the scalar bar.\n    # scalar_bar_elev->SetLookupTable(lut);\n    # Use this LUT if you want the highest value at the top.\n    scalar_bar_elev.SetLookupTable(lut1)\n    scalar_bar_elev.SetTitle('Elevation')\n    scalar_bar_elev.GetTitleTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar_elev.GetLabelTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar_elev.GetAnnotationTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar_elev.UnconstrainedFontSizeOn()\n    if desired_surface == 'Plane':\n        scalar_bar_elev.SetNumberOfLabels(1)\n    else:\n        scalar_bar_elev.SetNumberOfLabels(5)\n    scalar_bar_elev.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar_elev.SetMaximumHeightInPixels(window_height // 3)\n    # scalar_bar_elev.SetBarRatio(scalar_bar_elev.GetBarRatio() * 0.5)\n    scalar_bar_elev.SetPosition(0.85, 0.4)\n\n    # ------------------------------------------------------------\n    # Create the RenderWindow, Renderer and Interactor\n    # ------------------------------------------------------------\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    ren_win.AddRenderer(ren)\n    # Important: The interactor must be set prior to enabling the widget.\n    iren.SetRenderWindow(ren_win)\n    if vtk_version_ok(9, 0, 20210718):\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        cam_orient_manipulator.SetParentRenderer(ren)\n        # Enable the widget.\n        cam_orient_manipulator.On()\n\n    # add actors\n    ren.AddViewProp(src_actor)\n    ren.AddViewProp(edge_actor)\n    ren.AddViewProp(glyph_actor)\n    ren.AddActor2D(scalar_bar)\n    ren.AddActor2D(scalar_bar_elev)\n\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n    ren_win.SetSize(window_width, window_height)\n    ren_win.SetWindowName('CurvatureBandsWithGlyphs')\n\n    if desired_surface == \"RandomHills\":\n        camera = ren.GetActiveCamera()\n        camera.SetPosition(10.9299, 59.1505, 24.9823)\n        camera.SetFocalPoint(2.21692, 7.97545, 7.75135)\n        camera.SetViewUp(-0.230136, 0.345504, -0.909761)\n        camera.SetDistance(54.6966)\n        camera.SetClippingRange(36.3006, 77.9852)\n        ren_win.Render()\n\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\ndef adjust_edge_curvatures(source, curvature_name, epsilon=1.0e-08):\n    \"\"\"\n    This function adjusts curvatures along the edges of the surface by replacing\n     the value with the average value of the curvatures of points in the neighborhood.\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param epsilon: Absolute curvature values less than this will be set to zero.\n    :return:\n    \"\"\"\n\n    def point_neighbourhood(pt_id):\n        \"\"\"\n        Find the ids of the neighbours of pt_id.\n\n        :param pt_id: The point id.\n        :return: The neighbour ids.\n        \"\"\"\n        \"\"\"\n        Extract the topological neighbors for point pId. In two steps:\n        1) source.GetPointCells(pt_id, cell_ids)\n        2) source.GetCellPoints(cell_id, cell_point_ids) for all cell_id in cell_ids\n        \"\"\"\n        cell_ids = vtkIdList()\n        source.GetPointCells(pt_id, cell_ids)\n        neighbour = set()\n        for cell_idx in range(0, cell_ids.GetNumberOfIds()):\n            cell_id = cell_ids.GetId(cell_idx)\n            cell_point_ids = vtkIdList()\n            source.GetCellPoints(cell_id, cell_point_ids)\n            for cell_pt_idx in range(0, cell_point_ids.GetNumberOfIds()):\n                neighbour.add(cell_point_ids.GetId(cell_pt_idx))\n        return neighbour\n\n    def compute_distance(pt_id_a, pt_id_b):\n        \"\"\"\n        Compute the distance between two points given their ids.\n\n        :param pt_id_a:\n        :param pt_id_b:\n        :return:\n        \"\"\"\n        pt_a = np.array(source.GetPoint(pt_id_a))\n        pt_b = np.array(source.GetPoint(pt_id_b))\n        return np.linalg.norm(pt_a - pt_b)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    #  Get the boundary point IDs.\n    array_name = 'ids'\n    id_filter = vtkIdFilter()\n    id_filter.SetInputData(source)\n    id_filter.SetPointIds(True)\n    id_filter.SetCellIds(False)\n    id_filter.SetPointIdsArrayName(array_name)\n    id_filter.SetCellIdsArrayName(array_name)\n    id_filter.Update()\n\n    edges = vtkFeatureEdges()\n    edges.SetInputConnection(id_filter.GetOutputPort())\n    edges.BoundaryEdgesOn()\n    edges.ManifoldEdgesOff()\n    edges.NonManifoldEdgesOff()\n    edges.FeatureEdgesOff()\n    edges.Update()\n\n    edge_array = edges.GetOutput().GetPointData().GetArray(array_name)\n    boundary_ids = []\n    for i in range(edges.GetOutput().GetNumberOfPoints()):\n        boundary_ids.append(edge_array.GetValue(i))\n    # Remove duplicate Ids.\n    p_ids_set = set(boundary_ids)\n\n    # Iterate over the edge points and compute the curvature as the weighted\n    # average of the neighbours.\n    count_invalid = 0\n    for p_id in boundary_ids:\n        p_ids_neighbors = point_neighbourhood(p_id)\n        # Keep only interior points.\n        p_ids_neighbors -= p_ids_set\n        # Compute distances and extract curvature values.\n        curvs = [curvatures[p_id_n] for p_id_n in p_ids_neighbors]\n        dists = [compute_distance(p_id_n, p_id) for p_id_n in p_ids_neighbors]\n        curvs = np.array(curvs)\n        dists = np.array(dists)\n        curvs = curvs[dists > 0]\n        dists = dists[dists > 0]\n        if len(curvs) > 0:\n            weights = 1 / np.array(dists)\n            weights /= weights.sum()\n            new_curv = np.dot(curvs, weights)\n        else:\n            # Corner case.\n            count_invalid += 1\n            # Assuming the curvature of the point is planar.\n            new_curv = 0.0\n        # Set the new curvature value.\n        curvatures[p_id] = new_curv\n\n    #  Set small values to zero.\n    if epsilon != 0.0:\n        curvatures = np.where(abs(curvatures) < epsilon, 0, curvatures)\n        # Curvatures is now an ndarray\n        curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                          deep=True,\n                                          array_type=VTK_DOUBLE)\n        curv.SetName(curvature_name)\n        source.GetPointData().RemoveArray(curvature_name)\n        source.GetPointData().AddArray(curv)\n        source.GetPointData().SetActiveScalars(curvature_name)\n\n\ndef constrain_curvatures(source, curvature_name, lower_bound=0.0, upper_bound=0.0):\n    \"\"\"\n    This function constrains curvatures to the range [lower_bound ... upper_bound].\n\n    Remember to update the vtkCurvatures object before calling this.\n\n    :param source: A vtkPolyData object corresponding to the vtkCurvatures object.\n    :param curvature_name: The name of the curvature, 'Gauss_Curvature' or 'Mean_Curvature'.\n    :param lower_bound: The lower bound.\n    :param upper_bound: The upper bound.\n    :return:\n    \"\"\"\n\n    bounds = list()\n    if lower_bound < upper_bound:\n        bounds.append(lower_bound)\n        bounds.append(upper_bound)\n    else:\n        bounds.append(upper_bound)\n        bounds.append(lower_bound)\n\n    # Get the active scalars\n    source.GetPointData().SetActiveScalars(curvature_name)\n    np_source = dsa.WrapDataObject(source)\n    curvatures = np_source.PointData[curvature_name]\n\n    # Set upper and lower bounds.\n    curvatures = np.where(curvatures < bounds[0], bounds[0], curvatures)\n    curvatures = np.where(curvatures > bounds[1], bounds[1], curvatures)\n    # Curvatures is now an ndarray\n    curv = numpy_support.numpy_to_vtk(num_array=curvatures.ravel(),\n                                      deep=True,\n                                      array_type=VTK_DOUBLE)\n    curv.SetName(curvature_name)\n    source.GetPointData().RemoveArray(curvature_name)\n    source.GetPointData().AddArray(curv)\n    source.GetPointData().SetActiveScalars(curvature_name)\n\n\ndef get_elevations(src):\n    \"\"\"\n    Generate elevations over the surface.\n    :param: src - the vtkPolyData source.\n    :return: - vtkPolyData source with elevations.\n    \"\"\"\n    bounds = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]\n    src.GetBounds(bounds)\n    if abs(bounds[2]) < 1.0e-8 and abs(bounds[3]) < 1.0e-8:\n        bounds[3] = bounds[2] + 1\n    elev_filter = vtkElevationFilter()\n    elev_filter.SetInputData(src)\n    elev_filter.SetLowPoint(0, bounds[2], 0)\n    elev_filter.SetHighPoint(0, bounds[3], 0)\n    elev_filter.SetScalarRange(bounds[2], bounds[3])\n    elev_filter.Update()\n    return elev_filter.GetPolyDataOutput()\n\n\ndef get_hills():\n    # Create four hills on a plane.\n    # This will have regions of negative, zero and positive Gsaussian curvatures.\n\n    x_res = 50\n    y_res = 50\n    x_min = -5.0\n    x_max = 5.0\n    dx = (x_max - x_min) / (x_res - 1)\n    y_min = -5.0\n    y_max = 5.0\n    dy = (y_max - y_min) / (x_res - 1)\n\n    # Make a grid.\n    points = vtkPoints()\n    for i in range(0, x_res):\n        x = x_min + i * dx\n        for j in range(0, y_res):\n            y = y_min + j * dy\n            points.InsertNextPoint(x, y, 0)\n\n    # Add the grid points to a polydata object.\n    plane = vtkPolyData()\n    plane.SetPoints(points)\n\n    # Triangulate the grid.\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(plane)\n    delaunay.Update()\n\n    polydata = delaunay.GetOutput()\n\n    elevation = vtkDoubleArray()\n    elevation.SetNumberOfTuples(points.GetNumberOfPoints())\n\n    #  We define the parameters for the hills here.\n    # [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n    hd = [[-2.5, -2.5, 2.5, 6.5, 3.5], [2.5, 2.5, 2.5, 2.5, 2],\n          [5.0, -2.5, 1.5, 1.5, 2.5], [-5.0, 5, 2.5, 3.0, 3]]\n    xx = [0.0] * 2\n    for i in range(0, points.GetNumberOfPoints()):\n        x = list(polydata.GetPoint(i))\n        for j in range(0, len(hd)):\n            xx[0] = (x[0] - hd[j][0] / hd[j][2]) ** 2.0\n            xx[1] = (x[1] - hd[j][1] / hd[j][3]) ** 2.0\n            x[2] += hd[j][4] * math.exp(-(xx[0] + xx[1]) / 2.0)\n            polydata.GetPoints().SetPoint(i, x)\n            elevation.SetValue(i, x[2])\n\n    textures = vtkFloatArray()\n    textures.SetNumberOfComponents(2)\n    textures.SetNumberOfTuples(2 * polydata.GetNumberOfPoints())\n    textures.SetName(\"Textures\")\n\n    for i in range(0, x_res):\n        tc = [i / (x_res - 1.0), 0.0]\n        for j in range(0, y_res):\n            # tc[1] = 1.0 - j / (y_res - 1.0)\n            tc[1] = j / (y_res - 1.0)\n            textures.SetTuple(i * y_res + j, tc)\n\n    polydata.GetPointData().SetScalars(elevation)\n    polydata.GetPointData().GetScalars().SetName(\"Elevation\")\n    polydata.GetPointData().SetTCoords(textures)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputData(polydata)\n    normals.SetInputData(polydata)\n    normals.SetFeatureAngle(30)\n    normals.SplittingOff()\n\n    tr1 = vtkTransform()\n    tr1.RotateX(-90)\n\n    tf1 = vtkTransformPolyDataFilter()\n    tf1.SetInputConnection(normals.GetOutputPort())\n    tf1.SetTransform(tr1)\n    tf1.Update()\n\n    return tf1.GetOutput()\n\n\ndef get_parametric_hills():\n    \"\"\"\n    Make a parametric hills surface as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n    fn = vtkParametricRandomHills()\n    fn.AllowRandomGenerationOn()\n    fn.SetRandomSeed(1)\n    fn.SetNumberOfHills(30)\n    # Make the normals face out of the surface.\n    # Not needed with VTK 8.0 or later.\n    # if fn.GetClassName() == 'vtkParametricRandomHills':\n    #    fn.ClockwiseOrderingOff()\n\n    source = vtkParametricFunctionSource()\n    source.SetParametricFunction(fn)\n    source.SetUResolution(50)\n    source.SetVResolution(50)\n    source.SetScalarModeToZ()\n    source.Update()\n    # Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n    # source.GetOutput().GetPointData().GetNormals().SetName('Normals')\n    # source.GetOutput().GetPointData().GetScalars().SetName('Scalars')\n    # Rename the scalars to 'Elevation' since we are using the Z-scalars as elevations.\n    source.GetOutput().GetPointData().GetScalars().SetName('Elevation')\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_parametric_torus():\n    \"\"\"\n    Make a parametric torus as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n\n    fn = vtkParametricTorus()\n    fn.SetRingRadius(5)\n    fn.SetCrossSectionRadius(2)\n\n    source = vtkParametricFunctionSource()\n    source.SetParametricFunction(fn)\n    source.SetUResolution(50)\n    source.SetVResolution(50)\n    source.SetScalarModeToZ()\n    source.Update()\n\n    # Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n    # source.GetOutput().GetPointData().GetNormals().SetName('Normals')\n    # source.GetOutput().GetPointData().GetScalars().SetName('Scalars')\n    # Rename the scalars to 'Elevation' since we are using the Z-scalars as elevations.\n    source.GetOutput().GetPointData().GetScalars().SetName('Elevation')\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_plane():\n    \"\"\"\n    Make a plane as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n\n    source = vtkPlaneSource()\n    source.SetOrigin(-10.0, -10.0, 0.0)\n    source.SetPoint2(-10.0, 10.0, 0.0)\n    source.SetPoint1(10.0, -10.0, 0.0)\n    source.SetXResolution(20)\n    source.SetYResolution(20)\n    source.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 0.0, 0.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    # We have a m x n array of quadrilaterals arranged as a regular tiling in a\n    # plane. So pass it through a triangle filter since the curvature filter only\n    # operates on polys.\n    tri = vtkTriangleFilter()\n    tri.SetInputConnection(transform_filter.GetOutputPort())\n\n    # Pass it though a CleanPolyDataFilter and merge any points which\n    # are coincident, or very close\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(tri.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    return cleaner.GetOutput()\n\n\ndef get_sphere():\n    source = vtkSphereSource()\n    source.SetCenter(0.0, 0.0, 0.0)\n    source.SetRadius(10.0)\n    source.SetThetaResolution(32)\n    source.SetPhiResolution(32)\n    source.Update()\n\n    return source.GetOutput()\n\n\ndef get_torus():\n    \"\"\"\n    Make a torus as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n    source = vtkSuperquadricSource()\n    source.SetCenter(0.0, 0.0, 0.0)\n    source.SetScale(1.0, 1.0, 1.0)\n    source.SetPhiResolution(64)\n    source.SetThetaResolution(64)\n    source.SetThetaRoundness(1)\n    source.SetThickness(0.5)\n    source.SetSize(10)\n    source.SetToroidal(1)\n\n    # The quadric is made of strips, so pass it through a triangle filter as\n    # the curvature filter only operates on polys\n    tri = vtkTriangleFilter()\n    tri.SetInputConnection(source.GetOutputPort())\n\n    # The quadric has nasty discontinuities from the way the edges are generated\n    # so let's pass it though a CleanPolyDataFilter and merge any points which\n    # are coincident, or very close\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(tri.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    return cleaner.GetOutput()\n\n\ndef get_source(source):\n    surface = source.lower()\n    available_surfaces = ['hills', 'parametrictorus', 'plane', 'randomhills', 'sphere', 'torus']\n    if surface not in available_surfaces:\n        return None\n    elif surface == 'hills':\n        return get_hills()\n    elif surface == 'parametrictorus':\n        return get_parametric_torus()\n    elif surface == 'plane':\n        return get_elevations(get_plane())\n    elif surface == 'randomhills':\n        return get_parametric_hills()\n    elif surface == 'sphere':\n        return get_elevations(get_sphere())\n    elif surface == 'torus':\n        return get_elevations(get_torus())\n    return None\n\n\ndef get_color_series():\n    color_series = vtkColorSeries()\n    # Select a color scheme.\n    # color_series_enum = color_series.BREWER_DIVERGING_BROWN_BLUE_GREEN_9\n    # color_series_enum = color_series.BREWER_DIVERGING_SPECTRAL_10\n    # color_series_enum = color_series.BREWER_DIVERGING_SPECTRAL_3\n    # color_series_enum = color_series.BREWER_DIVERGING_PURPLE_ORANGE_9\n    # color_series_enum = color_series.BREWER_SEQUENTIAL_BLUE_PURPLE_9\n    # color_series_enum = color_series.BREWER_SEQUENTIAL_BLUE_GREEN_9\n    color_series_enum = color_series.BREWER_QUALITATIVE_SET3\n    # color_series_enum = color_series.CITRUS\n    color_series.SetColorScheme(color_series_enum)\n    return color_series\n\n\ndef get_categorical_lut():\n    \"\"\"\n    Make a lookup table using vtkColorSeries.\n    :return: An indexed (categorical) lookup table.\n    \"\"\"\n    color_series = get_color_series()\n    # Make the lookup table.\n    lut = vtkLookupTable()\n    color_series.BuildLookupTable(lut, color_series.CATEGORICAL)\n    lut.SetNanColor(0, 0, 0, 1)\n    return lut\n\n\ndef get_ordinal_lut():\n    \"\"\"\n    Make a lookup table using vtkColorSeries.\n    :return: An ordinal (not indexed) lookup table.\n    \"\"\"\n    color_series = get_color_series()\n    # Make the lookup table.\n    lut = vtkLookupTable()\n    color_series.BuildLookupTable(lut, color_series.ORDINAL)\n    lut.SetNanColor(0, 0, 0, 1)\n    return lut\n\n\ndef get_diverging_lut():\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start point         midPoint            end point\n     cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n     purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n     green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n     blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n     green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n\n    :return:\n    \"\"\"\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    # Cool to warm.\n    ctf.AddRGBPoint(0.0, 0.085, 0.532, 0.201)\n    ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n    ctf.AddRGBPoint(1.0, 0.758, 0.214, 0.233)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef reverse_lut(lut):\n    \"\"\"\n    Create a lookup table with the colors reversed.\n    :param: lut - An indexed lookup table.\n    :return: The reversed indexed lookup table.\n    \"\"\"\n    lutr = vtkLookupTable()\n    lutr.DeepCopy(lut)\n    t = lut.GetNumberOfTableValues() - 1\n    rev_range = reversed(list(range(t + 1)))\n    for i in rev_range:\n        rgba = [0.0] * 3\n        v = float(i)\n        lut.GetColor(v, rgba)\n        rgba.append(lut.GetOpacity(v))\n        lutr.SetTableValue(t - i, rgba)\n    t = lut.GetNumberOfAnnotatedValues() - 1\n    rev_range = reversed(list(range(t + 1)))\n    for i in rev_range:\n        lutr.SetAnnotation(t - i, lut.GetAnnotation(i))\n    return lutr\n\n\ndef get_glyphs(src, scale_factor=1.0, reverse_normals=False):\n    \"\"\"\n    Glyph the normals on the surface.\n\n    You may need to adjust the parameters for mask_pts, arrow and glyph for a\n    nice appearance.\n\n    :param: src - the surface to glyph.\n    :param: reverse_normals - if True the normals on the surface are reversed.\n    :return: The glyph object.\n\n    \"\"\"\n    # Sometimes the contouring algorithm can create a volume whose gradient\n    # vector and ordering of polygon (using the right hand rule) are\n    # inconsistent. vtkReverseSense cures this problem.\n    reverse = vtkReverseSense()\n\n    # Choose a random subset of points.\n    mask_pts = vtkMaskPoints()\n    mask_pts.SetOnRatio(5)\n    mask_pts.RandomModeOn()\n    if reverse_normals:\n        reverse.SetInputData(src)\n        reverse.ReverseCellsOn()\n        reverse.ReverseNormalsOn()\n        mask_pts.SetInputConnection(reverse.GetOutputPort())\n    else:\n        mask_pts.SetInputData(src)\n\n    # Source for the glyph filter\n    arrow = vtkArrowSource()\n    arrow.SetTipResolution(16)\n    arrow.SetTipLength(0.3)\n    arrow.SetTipRadius(0.1)\n\n    glyph = vtkGlyph3D()\n    glyph.SetSourceConnection(arrow.GetOutputPort())\n    glyph.SetInputConnection(mask_pts.GetOutputPort())\n    glyph.SetVectorModeToUseNormal()\n    glyph.SetScaleFactor(scale_factor)\n    glyph.SetColorModeToColorByVector()\n    glyph.SetScaleModeToScaleByVector()\n    glyph.OrientOn()\n    glyph.Update()\n    return glyph\n\n\ndef get_bands(d_r, number_of_bands, precision=2, nearest_integer=False):\n    \"\"\"\n    Divide a range into bands\n    :param: d_r - [min, max] the range that is to be covered by the bands.\n    :param: number_of_bands - The number of bands, a positive integer.\n    :param: precision - The decimal precision of the bounds.\n    :param: nearest_integer - If True then [floor(min), ceil(max)] is used.\n    :return: A dictionary consisting of the band number and [min, midpoint, max] for each band.\n    \"\"\"\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    bands = dict()\n    if (d_r[1] < d_r[0]) or (number_of_bands <= 0):\n        return bands\n    x = list(d_r)\n    if nearest_integer:\n        x[0] = math.floor(x[0])\n        x[1] = math.ceil(x[1])\n    dx = (x[1] - x[0]) / float(number_of_bands)\n    b = [x[0], x[0] + dx / 2.0, x[0] + dx]\n    i = 0\n    while i < number_of_bands:\n        b = list(map(lambda ele_b: round(ele_b, prec), b))\n        if i == 0:\n            b[0] = x[0]\n        bands[i] = b\n        b = [b[0] + dx, b[1] + dx, b[2] + dx]\n        i += 1\n    return bands\n\n\ndef get_custom_bands(d_r, number_of_bands, my_bands):\n    \"\"\"\n    Divide a range into custom bands.\n\n    You need to specify each band as an list [r1, r2] where r1 < r2 and\n    append these to a list.\n    The list should ultimately look\n    like this: [[r1, r2], [r2, r3], [r3, r4]...]\n\n    :param: d_r - [min, max] the range that is to be covered by the bands.\n    :param: number_of_bands - the number of bands, a positive integer.\n    :return: A dictionary consisting of band number and [min, midpoint, max] for each band.\n    \"\"\"\n    bands = dict()\n    if (d_r[1] < d_r[0]) or (number_of_bands <= 0):\n        return bands\n    x = my_bands\n    # Determine the index of the range minimum and range maximum.\n    idx_min = 0\n    for idx in range(0, len(my_bands)):\n        if my_bands[idx][1] > d_r[0] >= my_bands[idx][0]:\n            idx_min = idx\n            break\n\n    idx_max = len(my_bands) - 1\n    for idx in range(len(my_bands) - 1, -1, -1):\n        if my_bands[idx][1] > d_r[1] >= my_bands[idx][0]:\n            idx_max = idx\n            break\n\n    # Set the minimum to match the range minimum.\n    x[idx_min][0] = d_r[0]\n    x[idx_max][1] = d_r[1]\n    x = x[idx_min: idx_max + 1]\n    for idx, e in enumerate(x):\n        bands[idx] = [e[0], e[0] + (e[1] - e[0]) / 2, e[1]]\n    return bands\n\n\ndef get_frequencies(bands, src):\n    \"\"\"\n    Count the number of scalars in each band.\n    The scalars used are the active scalars in the polydata.\n\n    :param: bands - The bands.\n    :param: src - The vtkPolyData source.\n    :return: The frequencies of the scalars in each band.\n    \"\"\"\n    freq = dict()\n    for i in range(len(bands)):\n        freq[i] = 0\n    tuples = src.GetPointData().GetScalars().GetNumberOfTuples()\n    for i in range(tuples):\n        x = src.GetPointData().GetScalars().GetTuple1(i)\n        for j in range(len(bands)):\n            if x <= bands[j][2]:\n                freq[j] += 1\n                break\n    return freq\n\n\ndef adjust_ranges(bands, freq):\n    \"\"\"\n    The bands and frequencies are adjusted so that the first and last\n     frequencies in the range are non-zero.\n    :param bands: The bands dictionary.\n    :param freq: The frequency dictionary.\n    :return: Adjusted bands and frequencies.\n    \"\"\"\n    # Get the indices of the first and last non-zero elements.\n    first = 0\n    for k, v in freq.items():\n        if v != 0:\n            first = k\n            break\n    rev_keys = list(freq.keys())[::-1]\n    last = rev_keys[0]\n    for idx in list(freq.keys())[::-1]:\n        if freq[idx] != 0:\n            last = idx\n            break\n    # Now adjust the ranges.\n    min_key = min(freq.keys())\n    max_key = max(freq.keys())\n    for idx in range(min_key, first):\n        freq.pop(idx)\n        bands.pop(idx)\n    for idx in range(last + 1, max_key + 1):\n        freq.popitem()\n        bands.popitem()\n    old_keys = freq.keys()\n    adj_freq = dict()\n    adj_bands = dict()\n\n    for idx, k in enumerate(old_keys):\n        adj_freq[idx] = freq[k]\n        adj_bands[idx] = bands[k]\n\n    return adj_bands, adj_freq\n\n\ndef print_bands_frequencies(bands, freq, precision=2):\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    if len(bands) != len(freq):\n        print('Bands and Frequencies must be the same size.')\n        return\n    s = f'Bands & Frequencies:\\n'\n    total = 0\n    width = prec + 6\n    for k, v in bands.items():\n        total += freq[k]\n        for j, q in enumerate(v):\n            if j == 0:\n                s += f'{k:4d} ['\n            if j == len(v) - 1:\n                s += f'{q:{width}.{prec}f}]: {freq[k]:8d}\\n'\n            else:\n                s += f'{q:{width}.{prec}f}, '\n    width = 3 * width + 13\n    s += f'{\"Total\":{width}s}{total:8d}\\n'\n    print(s)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Visualization/DisplayCoordinateAxes/","title":"DisplayCoordinateAxes","text":"

        vtk-examples/Python/Visualization/DisplayCoordinateAxes

        "},{"location":"Python/Visualization/DisplayCoordinateAxes/#description","title":"Description","text":"

        This example shows how to display the coordinate axes in the render window.

        Seealso

        Axes.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/DisplayCoordinateAxes/#code","title":"Code","text":"

        DisplayCoordinateAxes.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(1.0)\n    sphereSource.Update()\n\n    polydata = sphereSource.GetOutput()\n\n    # Create a mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputData(polydata)\n\n    # Create an actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('DisplayCoordinateAxes')\n    renderWindow.AddRenderer(renderer)\n\n    # An interactor\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    axes = vtkAxesActor()\n\n    widget = vtkOrientationMarkerWidget()\n    rgba = [0] * 4\n    colors.GetColor('Carrot', rgba)\n    widget.SetOutlineColor(rgba[0], rgba[1], rgba[2])\n    widget.SetOrientationMarker(axes)\n    widget.SetInteractor(renderWindowInteractor)\n    widget.SetViewport(0.0, 0.0, 0.4, 0.4)\n    widget.SetEnabled(1)\n    widget.InteractiveOn()\n\n    renderer.GetActiveCamera().Azimuth(50)\n    renderer.GetActiveCamera().Elevation(-30)\n\n    renderer.ResetCamera()\n    renderWindow.Render()\n\n    # Begin mouse interaction\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/DisplayQuadricSurfaces/","title":"DisplayQuadricSurfaces","text":"

        vtk-examples/Python/Visualization/DisplayQuadricSurfaces

        "},{"location":"Python/Visualization/DisplayQuadricSurfaces/#description","title":"Description","text":"

        This example demonstrates how to create and display a quadratic surface.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/DisplayQuadricSurfaces/#code","title":"Code","text":"

        DisplayQuadricSurfaces.py

        #!/usr/bin/python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef Sphere():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, 1, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2 + 1*z^2\n\n    PlotFunction(quadric, 1.0)\n\n\ndef EllipticParaboloid():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, 0, 0, 0, 0, 0, 0, -1, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2\n\n    PlotFunction(quadric, 10.0)\n\n\ndef HyperbolicParaboloid():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, -1, 0, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 - 1*y^2\n\n    PlotFunction(quadric, 10.0)\n\n\ndef Cylinder():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, 0, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2\n\n    PlotFunction(quadric, 1.0)\n\n\ndef HyperboloidOneSheet():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2\n\n    PlotFunction(quadric, 1.0)\n\n\ndef HyperboloidTwoSheets():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2\n\n    PlotFunction(quadric, -1.0)\n\n\ndef Ellipsoid():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, 2, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2 + 1*z^2\n\n    PlotFunction(quadric, 1.0)\n\n\ndef Cone():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 1, -1, 0, 0, 0, 0, 0, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 1*x^2 + 1*y^2 - 1*z^2\n    PlotFunction(quadric, 0.0)\n\n\ndef Other():\n    # create the quadric function definition\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0)\n\n    # F(x,y,z) = a0*x^2 + a1*y^2 + a2*z^2 + a3*x*y + a4*y*z + a5*x*z + a6*x + a7*y + a8*z + a9\n    # F(x,y,z) = 0.5*x^2 + 1*y^2 + 0.2*z^2 + 0*x*y + 0.1*y*z + 0*x*z + 0*x + 0.2*y + 0*z + 0\n    PlotFunction(quadric, 1.0)\n\n\ndef PlotFunction(quadric, value):\n    colors = vtkNamedColors()\n\n    # sample the quadric function\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(50, 50, 50)\n    sample.SetImplicitFunction(quadric)\n    # double xmin = 0, xmax=1, ymin=0, ymax=1, zmin=0, zmax=1\n    bounds = [-10, 11, -10, 10, -10, 10]\n    sample.SetModelBounds(bounds)\n\n    # create the 0 isosurface\n    contours = vtkContourFilter()\n    contours.SetInputConnection(sample.GetOutputPort())\n    contours.GenerateValues(1, value, value)\n\n    # map the contours to graphical primitives\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contours.GetOutputPort())\n    contourMapper.SetScalarRange(0.0, 1.2)\n\n    # create an actor for the contours\n    contourActor = vtkActor()\n    contourActor.SetMapper(contourMapper)\n\n    # -- create a box around the function to indicate the sampling volume --\n\n    # create outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(sample.GetOutputPort())\n\n    # map it to graphics primitives\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    # create an actor for it\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # setup the window\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetWindowName('DisplayQuadricSurfaces')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # add the actors to the scene\n    ren1.AddActor(contourActor)\n    ren1.AddActor(outlineActor)\n    ren1.SetBackground(colors.GetColor3d('AliceBlue'))\n\n    # render and interact\n    renWin.Render()\n    ren1.GetActiveCamera().Azimuth(-55)\n    ren1.GetActiveCamera().Elevation(15)\n\n    iren.Start()\n\n\ndef main():\n    #  Choose one!\n\n    # Other()\n    # Sphere()\n    # Cone()\n    # Ellipsoid()\n    # Cylinder()\n    # HyperboloidOneSheet()\n    # HyperboloidTwoSheets()\n    # HyperbolicParaboloid()\n    EllipticParaboloid()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/ElevationBandsWithGlyphs/","title":"ElevationBandsWithGlyphs","text":"

        vtk-examples/Python/Visualization/ElevationBandsWithGlyphs

        "},{"location":"Python/Visualization/ElevationBandsWithGlyphs/#description","title":"Description","text":"

        In this example we are coloring the surface by partitioning the elevation into bands and using arrows to display the normals on the surface.

        Rather beautiful surfaces are generated.

        The banded contour filter and an indexed lookup table are used along with the elevation filter to generate the banding on the surface. To further enhance the surface, the surface normals are glyphed and colored by elevation using an ordinal lookup table.

        Feel free to experiment with different color schemes and/or the other sources from the parametric function group or a cone etc.

        You will usually need to adjust the parameters for mask_p_ts, arrow and glyph for a nice appearance. Do this in the function make_glyphs().

        You may also need to add an elevation filter to generate the scalars as demonstrated in make_sphere().

        print_bands_frequencies() allows you to inspect the bands and the number of scalars in each band. This are useful if you want to get an idea of the distribution of the scalars in each band.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/ElevationBandsWithGlyphs/#code","title":"Code","text":"

        ElevationBandsWithGlyphs.py

        #!/usr/bin/env python\n\nimport math\n\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkFloatArray,\n    vtkLookupTable,\n    vtkPoints,\n    vtkVariant,\n    vtkVariantArray,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkDelaunay2D,\n    vtkElevationFilter,\n    vtkGlyph3D,\n    vtkMaskPoints,\n    vtkPolyDataNormals,\n    vtkReverseSense,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkBandedPolyDataContourFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkParametricFunctionSource,\n    vtkPlaneSource,\n    vtkSphereSource,\n    vtkSuperquadricSource\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n\n\ndef main(argv):\n    # ------------------------------------------------------------\n    # Create the surface, lookup tables, contour filter etc.\n    # ------------------------------------------------------------\n    # desired_surface = 'Hills'\n    # desired_surface = 'ParametricTorus'\n    # desired_surface = 'Plane'\n    desired_surface = 'RandomHills'\n    # desired_surface = 'Sphere'\n    # desired_surface = 'Torus'\n    source = get_source(desired_surface)\n    if not source:\n        print('The surface is not available.')\n        return\n\n    # The length of the normal arrow glyphs.\n    scale_factor = 1.0\n    if desired_surface == 'Hills':\n        scale_factor = 0.5\n    elif desired_surface == 'Sphere':\n        scale_factor = 2.0\n    print(desired_surface)\n\n    source.GetPointData().SetActiveScalars('Elevation')\n    scalar_range = source.GetPointData().GetScalars('Elevation').GetRange()\n\n    lut = get_categorical_lut()\n    lut1 = get_ordinal_lut()\n    lut.SetTableRange(scalar_range)\n    lut1.SetTableRange(scalar_range)\n    number_of_bands = lut.GetNumberOfTableValues()\n    lut.SetNumberOfTableValues(number_of_bands)\n    precision = 10\n    bands = get_bands(scalar_range, number_of_bands, precision, False)\n\n    if desired_surface == 'RandomHills':\n        # These are my custom bands.\n        # Generated by first running:\n        # bands = get_bands(scalar_range, number_of_bands, precision, False)\n        # then:\n        #  freq = get_frequencies(bands, source)\n        #  print_bands_frequencies(bands, freq)\n        # Finally using the output to create this table:\n        my_bands = [\n            [0, 1.0], [1.0, 2.0], [2.0, 3.0],\n            [3.0, 4.0], [4.0, 5.0], [5.0, 6.0],\n            [6.0, 7.0], [7.0, 8.0]]\n        # Comment this out if you want to see how allocating\n        # equally spaced bands works.\n        bands = get_custom_bands(scalar_range, number_of_bands, my_bands)\n        # bands = get_bands(scalar_range, number_of_bands, precision, False)\n\n    # Let's do a frequency table.\n    # The number of scalars in each band.\n    freq = get_frequencies(bands, source)\n    bands, freq = adjust_ranges(bands, freq)\n    print_bands_frequencies(bands, freq)\n\n    scalar_range = (bands[0][0], bands[len(bands) - 1][2])\n    lut.SetTableRange(scalar_range)\n    lut.SetNumberOfTableValues(len(bands))\n    lut1.SetNumberOfTableValues(len(bands))\n\n    # We will use the midpoint of the band as the label.\n    labels = []\n    for k in bands:\n        labels.append('{:4.2f}'.format(bands[k][1]))\n\n    # Annotate\n    values = vtkVariantArray()\n    for i in range(len(labels)):\n        values.InsertNextValue(vtkVariant(labels[i]))\n    for i in range(values.GetNumberOfTuples()):\n        lut.SetAnnotation(i, values.GetValue(i).ToString())\n\n    # Create a lookup table with the colors reversed.\n    lutr = reverse_lut(lut)\n\n    # Create the contour bands.\n    bcf = vtkBandedPolyDataContourFilter()\n    bcf.SetInputData(source)\n    # Use either the minimum or maximum value for each band.\n    for i in range(len(bands)):\n        bcf.SetValue(i, bands[i][2])\n    # We will use an indexed lookup table.\n    bcf.SetScalarModeToIndex()\n    bcf.GenerateContourEdgesOn()\n\n    # Generate the glyphs on the original surface.\n    glyph = get_glyphs(source, scale_factor, False)\n\n    # ------------------------------------------------------------\n    # Create the mappers and actors\n    # ------------------------------------------------------------\n\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [179, 204, 255, 255])\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    src_mapper = vtkPolyDataMapper()\n    src_mapper.SetInputConnection(bcf.GetOutputPort())\n    src_mapper.SetScalarRange(scalar_range)\n    src_mapper.SetLookupTable(lut)\n    src_mapper.SetScalarModeToUseCellData()\n\n    src_actor = vtkActor()\n    src_actor.SetMapper(src_mapper)\n\n    # Create contour edges\n    edge_mapper = vtkPolyDataMapper()\n    edge_mapper.SetInputData(bcf.GetContourEdgesOutput())\n    edge_mapper.SetResolveCoincidentTopologyToPolygonOffset()\n\n    edge_actor = vtkActor()\n    edge_actor.SetMapper(edge_mapper)\n    edge_actor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    glyph_mapper = vtkPolyDataMapper()\n    glyph_mapper.SetInputConnection(glyph.GetOutputPort())\n    glyph_mapper.SetScalarModeToUsePointFieldData()\n    glyph_mapper.SetColorModeToMapScalars()\n    glyph_mapper.ScalarVisibilityOn()\n    glyph_mapper.SelectColorArray('Elevation')\n    # Colour by scalars.\n    glyph_mapper.SetLookupTable(lut1)\n    glyph_mapper.SetScalarRange(scalar_range)\n\n    glyph_actor = vtkActor()\n    glyph_actor.SetMapper(glyph_mapper)\n\n    window_width = 800\n    window_height = 800\n\n    # Add a scalar bar.\n    scalar_bar = vtkScalarBarActor()\n    # This LUT puts the lowest value at the top of the scalar bar.\n    # scalar_bar->SetLookupTable(lut);\n    # Use this LUT if you want the highest value at the top.\n    scalar_bar.SetLookupTable(lutr)\n    scalar_bar.SetTitle('Elevation')\n    scalar_bar.GetTitleTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.GetLabelTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.GetAnnotationTextProperty().SetColor(\n        colors.GetColor3d('AliceBlue'))\n    scalar_bar.UnconstrainedFontSizeOn()\n    scalar_bar.SetMaximumWidthInPixels(window_width // 8)\n    scalar_bar.SetMaximumHeightInPixels(window_height // 3)\n    scalar_bar.SetPosition(0.85, 0.05)\n\n    # ------------------------------------------------------------\n    # Create the RenderWindow, Renderer and Interactor\n    # ------------------------------------------------------------\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    ren_win.AddRenderer(ren)\n    # Important: The interactor must be set prior to enabling the widget.\n    iren.SetRenderWindow(ren_win)\n    if vtk_version_ok(9, 0, 20210718):\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        cam_orient_manipulator.SetParentRenderer(ren)\n        # Enable the widget.\n        cam_orient_manipulator.On()\n\n    # add actors\n    ren.AddViewProp(src_actor)\n    ren.AddViewProp(edge_actor)\n    ren.AddViewProp(glyph_actor)\n    ren.AddActor2D(scalar_bar)\n\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n    ren_win.SetSize(window_width, window_height)\n    ren_win.SetWindowName('ElevationBandsWithGlyphs')\n\n    if desired_surface == \"RandomHills\":\n        camera = ren.GetActiveCamera()\n        camera.SetPosition(10.9299, 59.1505, 24.9823)\n        camera.SetFocalPoint(2.21692, 7.97545, 7.75135)\n        camera.SetViewUp(-0.230136, 0.345504, -0.909761)\n        camera.SetDistance(54.6966)\n        camera.SetClippingRange(36.3006, 77.9852)\n        ren_win.Render()\n\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\ndef get_elevations(src):\n    \"\"\"\n    Generate elevations over the surface.\n    :param: src - the vtkPolyData source.\n    :return: - vtkPolyData source with elevations.\n    \"\"\"\n    bounds = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]\n    src.GetBounds(bounds)\n    if abs(bounds[2]) < 1.0e-8 and abs(bounds[3]) < 1.0e-8:\n        bounds[3] = bounds[2] + 1\n    elev_filter = vtkElevationFilter()\n    elev_filter.SetInputData(src)\n    elev_filter.SetLowPoint(0, bounds[2], 0)\n    elev_filter.SetHighPoint(0, bounds[3], 0)\n    elev_filter.SetScalarRange(bounds[2], bounds[3])\n    elev_filter.Update()\n    return elev_filter.GetPolyDataOutput()\n\n\ndef get_hills():\n    # Create four hills on a plane.\n    # This will have regions of negative, zero and positive Gsaussian curvatures.\n\n    x_res = 50\n    y_res = 50\n    x_min = -5.0\n    x_max = 5.0\n    dx = (x_max - x_min) / (x_res - 1)\n    y_min = -5.0\n    y_max = 5.0\n    dy = (y_max - y_min) / (x_res - 1)\n\n    # Make a grid.\n    points = vtkPoints()\n    for i in range(0, x_res):\n        x = x_min + i * dx\n        for j in range(0, y_res):\n            y = y_min + j * dy\n            points.InsertNextPoint(x, y, 0)\n\n    # Add the grid points to a polydata object.\n    plane = vtkPolyData()\n    plane.SetPoints(points)\n\n    # Triangulate the grid.\n    delaunay = vtkDelaunay2D()\n    delaunay.SetInputData(plane)\n    delaunay.Update()\n\n    polydata = delaunay.GetOutput()\n\n    elevation = vtkDoubleArray()\n    elevation.SetNumberOfTuples(points.GetNumberOfPoints())\n\n    #  We define the parameters for the hills here.\n    # [[0: x0, 1: y0, 2: x variance, 3: y variance, 4: amplitude]...]\n    hd = [[-2.5, -2.5, 2.5, 6.5, 3.5], [2.5, 2.5, 2.5, 2.5, 2],\n          [5.0, -2.5, 1.5, 1.5, 2.5], [-5.0, 5, 2.5, 3.0, 3]]\n    xx = [0.0] * 2\n    for i in range(0, points.GetNumberOfPoints()):\n        x = list(polydata.GetPoint(i))\n        for j in range(0, len(hd)):\n            xx[0] = (x[0] - hd[j][0] / hd[j][2]) ** 2.0\n            xx[1] = (x[1] - hd[j][1] / hd[j][3]) ** 2.0\n            x[2] += hd[j][4] * math.exp(-(xx[0] + xx[1]) / 2.0)\n            polydata.GetPoints().SetPoint(i, x)\n            elevation.SetValue(i, x[2])\n\n    textures = vtkFloatArray()\n    textures.SetNumberOfComponents(2)\n    textures.SetNumberOfTuples(2 * polydata.GetNumberOfPoints())\n    textures.SetName(\"Textures\")\n\n    for i in range(0, x_res):\n        tc = [i / (x_res - 1.0), 0.0]\n        for j in range(0, y_res):\n            # tc[1] = 1.0 - j / (y_res - 1.0)\n            tc[1] = j / (y_res - 1.0)\n            textures.SetTuple(i * y_res + j, tc)\n\n    polydata.GetPointData().SetScalars(elevation)\n    polydata.GetPointData().GetScalars().SetName(\"Elevation\")\n    polydata.GetPointData().SetTCoords(textures)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputData(polydata)\n    normals.SetInputData(polydata)\n    normals.SetFeatureAngle(30)\n    normals.SplittingOff()\n\n    tr1 = vtkTransform()\n    tr1.RotateX(-90)\n\n    tf1 = vtkTransformPolyDataFilter()\n    tf1.SetInputConnection(normals.GetOutputPort())\n    tf1.SetTransform(tr1)\n    tf1.Update()\n\n    return tf1.GetOutput()\n\n\ndef get_parametric_hills():\n    \"\"\"\n    Make a parametric hills surface as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n    fn = vtkParametricRandomHills()\n    fn.AllowRandomGenerationOn()\n    fn.SetRandomSeed(1)\n    fn.SetNumberOfHills(30)\n    # Make the normals face out of the surface.\n    # Not needed with VTK 8.0 or later.\n    # if fn.GetClassName() == 'vtkParametricRandomHills':\n    #    fn.ClockwiseOrderingOff()\n\n    source = vtkParametricFunctionSource()\n    source.SetParametricFunction(fn)\n    source.SetUResolution(50)\n    source.SetVResolution(50)\n    source.SetScalarModeToZ()\n    source.Update()\n    # Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n    # source.GetOutput().GetPointData().GetNormals().SetName('Normals')\n    # source.GetOutput().GetPointData().GetScalars().SetName('Scalars')\n    # Rename the scalars to 'Elevation' since we are using the Z-scalars as elevations.\n    source.GetOutput().GetPointData().GetScalars().SetName('Elevation')\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 5.0, 15.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_parametric_torus():\n    \"\"\"\n    Make a parametric torus as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n\n    fn = vtkParametricTorus()\n    fn.SetRingRadius(5)\n    fn.SetCrossSectionRadius(2)\n\n    source = vtkParametricFunctionSource()\n    source.SetParametricFunction(fn)\n    source.SetUResolution(50)\n    source.SetVResolution(50)\n    source.SetScalarModeToZ()\n    source.Update()\n\n    # Name the arrays (not needed in VTK 6.2+ for vtkParametricFunctionSource).\n    # source.GetOutput().GetPointData().GetNormals().SetName('Normals')\n    # source.GetOutput().GetPointData().GetScalars().SetName('Scalars')\n    # Rename the scalars to 'Elevation' since we are using the Z-scalars as elevations.\n    source.GetOutput().GetPointData().GetScalars().SetName('Elevation')\n\n    transform = vtkTransform()\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    return transform_filter.GetOutput()\n\n\ndef get_plane():\n    \"\"\"\n    Make a plane as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n\n    source = vtkPlaneSource()\n    source.SetOrigin(-10.0, -10.0, 0.0)\n    source.SetPoint2(-10.0, 10.0, 0.0)\n    source.SetPoint1(10.0, -10.0, 0.0)\n    source.SetXResolution(20)\n    source.SetYResolution(20)\n    source.Update()\n\n    transform = vtkTransform()\n    transform.Translate(0.0, 0.0, 0.0)\n    transform.RotateX(-90.0)\n    transform_filter = vtkTransformPolyDataFilter()\n    transform_filter.SetInputConnection(source.GetOutputPort())\n    transform_filter.SetTransform(transform)\n    transform_filter.Update()\n\n    # We have a m x n array of quadrilaterals arranged as a regular tiling in a\n    # plane. So pass it through a triangle filter since the curvature filter only\n    # operates on polys.\n    tri = vtkTriangleFilter()\n    tri.SetInputConnection(transform_filter.GetOutputPort())\n\n    # Pass it though a CleanPolyDataFilter and merge any points which\n    # are coincident, or very close\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(tri.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    return cleaner.GetOutput()\n\n\ndef get_sphere():\n    source = vtkSphereSource()\n    source.SetCenter(0.0, 0.0, 0.0)\n    source.SetRadius(10.0)\n    source.SetThetaResolution(32)\n    source.SetPhiResolution(32)\n    source.Update()\n\n    return source.GetOutput()\n\n\ndef get_torus():\n    \"\"\"\n    Make a torus as the source.\n    :return: vtkPolyData with normal and scalar data.\n    \"\"\"\n    source = vtkSuperquadricSource()\n    source.SetCenter(0.0, 0.0, 0.0)\n    source.SetScale(1.0, 1.0, 1.0)\n    source.SetPhiResolution(64)\n    source.SetThetaResolution(64)\n    source.SetThetaRoundness(1)\n    source.SetThickness(0.5)\n    source.SetSize(10)\n    source.SetToroidal(1)\n\n    # The quadric is made of strips, so pass it through a triangle filter as\n    # the curvature filter only operates on polys\n    tri = vtkTriangleFilter()\n    tri.SetInputConnection(source.GetOutputPort())\n\n    # The quadric has nasty discontinuities from the way the edges are generated\n    # so let's pass it though a CleanPolyDataFilter and merge any points which\n    # are coincident, or very close\n    cleaner = vtkCleanPolyData()\n    cleaner.SetInputConnection(tri.GetOutputPort())\n    cleaner.SetTolerance(0.005)\n    cleaner.Update()\n\n    return cleaner.GetOutput()\n\n\ndef get_source(source):\n    surface = source.lower()\n    available_surfaces = ['hills', 'parametrictorus', 'plane', 'randomhills', 'sphere', 'torus']\n    if surface not in available_surfaces:\n        return None\n    elif surface == 'hills':\n        return get_hills()\n    elif surface == 'parametrictorus':\n        return get_parametric_torus()\n    elif surface == 'plane':\n        return get_elevations(get_plane())\n    elif surface == 'randomhills':\n        return get_parametric_hills()\n    elif surface == 'sphere':\n        return get_elevations(get_sphere())\n    elif surface == 'torus':\n        return get_elevations(get_torus())\n    return None\n\n\ndef get_color_series():\n    color_series = vtkColorSeries()\n    # Select a color scheme.\n    # color_series_enum = color_series.BREWER_DIVERGING_BROWN_BLUE_GREEN_9\n    # color_series_enum = color_series.BREWER_DIVERGING_SPECTRAL_10\n    # color_series_enum = color_series.BREWER_DIVERGING_SPECTRAL_3\n    # color_series_enum = color_series.BREWER_DIVERGING_PURPLE_ORANGE_9\n    # color_series_enum = color_series.BREWER_SEQUENTIAL_BLUE_PURPLE_9\n    # color_series_enum = color_series.BREWER_SEQUENTIAL_BLUE_GREEN_9\n    color_series_enum = color_series.BREWER_QUALITATIVE_SET3\n    # color_series_enum = color_series.CITRUS\n    color_series.SetColorScheme(color_series_enum)\n    return color_series\n\n\ndef get_categorical_lut():\n    \"\"\"\n    Make a lookup table using vtkColorSeries.\n    :return: An indexed (categorical) lookup table.\n    \"\"\"\n    color_series = get_color_series()\n    # Make the lookup table.\n    lut = vtkLookupTable()\n    color_series.BuildLookupTable(lut, color_series.CATEGORICAL)\n    lut.SetNanColor(0, 0, 0, 1)\n    return lut\n\n\ndef get_ordinal_lut():\n    \"\"\"\n    Make a lookup table using vtkColorSeries.\n    :return: An ordinal (not indexed) lookup table.\n    \"\"\"\n    color_series = get_color_series()\n    # Make the lookup table.\n    lut = vtkLookupTable()\n    color_series.BuildLookupTable(lut, color_series.ORDINAL)\n    lut.SetNanColor(0, 0, 0, 1)\n    return lut\n\n\ndef get_diverging_lut():\n    \"\"\"\n    See: [Diverging Color Maps for Scientific Visualization](https://www.kennethmoreland.com/color-maps/)\n                       start point         midPoint            end point\n     cool to warm:     0.230, 0.299, 0.754 0.865, 0.865, 0.865 0.706, 0.016, 0.150\n     purple to orange: 0.436, 0.308, 0.631 0.865, 0.865, 0.865 0.759, 0.334, 0.046\n     green to purple:  0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.436, 0.308, 0.631\n     blue to brown:    0.217, 0.525, 0.910 0.865, 0.865, 0.865 0.677, 0.492, 0.093\n     green to red:     0.085, 0.532, 0.201 0.865, 0.865, 0.865 0.758, 0.214, 0.233\n\n    :return:\n    \"\"\"\n    ctf = vtkColorTransferFunction()\n    ctf.SetColorSpaceToDiverging()\n    # Cool to warm.\n    ctf.AddRGBPoint(0.0, 0.085, 0.532, 0.201)\n    ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n    ctf.AddRGBPoint(1.0, 0.758, 0.214, 0.233)\n\n    table_size = 256\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(table_size)\n    lut.Build()\n\n    for i in range(0, table_size):\n        rgba = list(ctf.GetColor(float(i) / table_size))\n        rgba.append(1)\n        lut.SetTableValue(i, rgba)\n\n    return lut\n\n\ndef reverse_lut(lut):\n    \"\"\"\n    Create a lookup table with the colors reversed.\n    :param: lut - An indexed lookup table.\n    :return: The reversed indexed lookup table.\n    \"\"\"\n    lutr = vtkLookupTable()\n    lutr.DeepCopy(lut)\n    t = lut.GetNumberOfTableValues() - 1\n    rev_range = reversed(list(range(t + 1)))\n    for i in rev_range:\n        rgba = [0.0] * 3\n        v = float(i)\n        lut.GetColor(v, rgba)\n        rgba.append(lut.GetOpacity(v))\n        lutr.SetTableValue(t - i, rgba)\n    t = lut.GetNumberOfAnnotatedValues() - 1\n    rev_range = reversed(list(range(t + 1)))\n    for i in rev_range:\n        lutr.SetAnnotation(t - i, lut.GetAnnotation(i))\n    return lutr\n\n\ndef get_glyphs(src, scale_factor=1.0, reverse_normals=False):\n    \"\"\"\n    Glyph the normals on the surface.\n\n    You may need to adjust the parameters for mask_pts, arrow and glyph for a\n    nice appearance.\n\n    :param: src - the surface to glyph.\n    :param: reverse_normals - if True the normals on the surface are reversed.\n    :return: The glyph object.\n\n    \"\"\"\n    # Sometimes the contouring algorithm can create a volume whose gradient\n    # vector and ordering of polygon (using the right hand rule) are\n    # inconsistent. vtkReverseSense cures this problem.\n    reverse = vtkReverseSense()\n\n    # Choose a random subset of points.\n    mask_pts = vtkMaskPoints()\n    mask_pts.SetOnRatio(5)\n    mask_pts.RandomModeOn()\n    if reverse_normals:\n        reverse.SetInputData(src)\n        reverse.ReverseCellsOn()\n        reverse.ReverseNormalsOn()\n        mask_pts.SetInputConnection(reverse.GetOutputPort())\n    else:\n        mask_pts.SetInputData(src)\n\n    # Source for the glyph filter\n    arrow = vtkArrowSource()\n    arrow.SetTipResolution(16)\n    arrow.SetTipLength(0.3)\n    arrow.SetTipRadius(0.1)\n\n    glyph = vtkGlyph3D()\n    glyph.SetSourceConnection(arrow.GetOutputPort())\n    glyph.SetInputConnection(mask_pts.GetOutputPort())\n    glyph.SetVectorModeToUseNormal()\n    glyph.SetScaleFactor(scale_factor)\n    glyph.SetColorModeToColorByVector()\n    glyph.SetScaleModeToScaleByVector()\n    glyph.OrientOn()\n    glyph.Update()\n    return glyph\n\n\ndef get_bands(d_r, number_of_bands, precision=2, nearest_integer=False):\n    \"\"\"\n    Divide a range into bands\n    :param: d_r - [min, max] the range that is to be covered by the bands.\n    :param: number_of_bands - The number of bands, a positive integer.\n    :param: precision - The decimal precision of the bounds.\n    :param: nearest_integer - If True then [floor(min), ceil(max)] is used.\n    :return: A dictionary consisting of the band number and [min, midpoint, max] for each band.\n    \"\"\"\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    bands = dict()\n    if (d_r[1] < d_r[0]) or (number_of_bands <= 0):\n        return bands\n    x = list(d_r)\n    if nearest_integer:\n        x[0] = math.floor(x[0])\n        x[1] = math.ceil(x[1])\n    dx = (x[1] - x[0]) / float(number_of_bands)\n    b = [x[0], x[0] + dx / 2.0, x[0] + dx]\n    i = 0\n    while i < number_of_bands:\n        b = list(map(lambda ele_b: round(ele_b, prec), b))\n        if i == 0:\n            b[0] = x[0]\n        bands[i] = b\n        b = [b[0] + dx, b[1] + dx, b[2] + dx]\n        i += 1\n    return bands\n\n\ndef get_custom_bands(d_r, number_of_bands, my_bands):\n    \"\"\"\n    Divide a range into custom bands.\n\n    You need to specify each band as an list [r1, r2] where r1 < r2 and\n    append these to a list.\n    The list should ultimately look\n    like this: [[r1, r2], [r2, r3], [r3, r4]...]\n\n    :param: d_r - [min, max] the range that is to be covered by the bands.\n    :param: number_of_bands - the number of bands, a positive integer.\n    :return: A dictionary consisting of band number and [min, midpoint, max] for each band.\n    \"\"\"\n    bands = dict()\n    if (d_r[1] < d_r[0]) or (number_of_bands <= 0):\n        return bands\n    x = my_bands\n    # Determine the index of the range minimum and range maximum.\n    idx_min = 0\n    for idx in range(0, len(my_bands)):\n        if my_bands[idx][1] > d_r[0] >= my_bands[idx][0]:\n            idx_min = idx\n            break\n\n    idx_max = len(my_bands) - 1\n    for idx in range(len(my_bands) - 1, -1, -1):\n        if my_bands[idx][1] > d_r[1] >= my_bands[idx][0]:\n            idx_max = idx\n            break\n\n    # Set the minimum to match the range minimum.\n    x[idx_min][0] = d_r[0]\n    x[idx_max][1] = d_r[1]\n    x = x[idx_min: idx_max + 1]\n    for idx, e in enumerate(x):\n        bands[idx] = [e[0], e[0] + (e[1] - e[0]) / 2, e[1]]\n    return bands\n\n\ndef get_frequencies(bands, src):\n    \"\"\"\n    Count the number of scalars in each band.\n    The scalars used are the active scalars in the polydata.\n\n    :param: bands - The bands.\n    :param: src - The vtkPolyData source.\n    :return: The frequencies of the scalars in each band.\n    \"\"\"\n    freq = dict()\n    for i in range(len(bands)):\n        freq[i] = 0\n    tuples = src.GetPointData().GetScalars().GetNumberOfTuples()\n    for i in range(tuples):\n        x = src.GetPointData().GetScalars().GetTuple1(i)\n        for j in range(len(bands)):\n            if x <= bands[j][2]:\n                freq[j] += 1\n                break\n    return freq\n\n\ndef adjust_ranges(bands, freq):\n    \"\"\"\n    The bands and frequencies are adjusted so that the first and last\n     frequencies in the range are non-zero.\n    :param bands: The bands dictionary.\n    :param freq: The frequency dictionary.\n    :return: Adjusted bands and frequencies.\n    \"\"\"\n    # Get the indices of the first and last non-zero elements.\n    first = 0\n    for k, v in freq.items():\n        if v != 0:\n            first = k\n            break\n    rev_keys = list(freq.keys())[::-1]\n    last = rev_keys[0]\n    for idx in list(freq.keys())[::-1]:\n        if freq[idx] != 0:\n            last = idx\n            break\n    # Now adjust the ranges.\n    min_key = min(freq.keys())\n    max_key = max(freq.keys())\n    for idx in range(min_key, first):\n        freq.pop(idx)\n        bands.pop(idx)\n    for idx in range(last + 1, max_key + 1):\n        freq.popitem()\n        bands.popitem()\n    old_keys = freq.keys()\n    adj_freq = dict()\n    adj_bands = dict()\n\n    for idx, k in enumerate(old_keys):\n        adj_freq[idx] = freq[k]\n        adj_bands[idx] = bands[k]\n\n    return adj_bands, adj_freq\n\n\ndef print_bands_frequencies(bands, freq, precision=2):\n    prec = abs(precision)\n    if prec > 14:\n        prec = 14\n\n    if len(bands) != len(freq):\n        print('Bands and Frequencies must be the same size.')\n        return\n    s = f'Bands & Frequencies:\\n'\n    total = 0\n    width = prec + 6\n    for k, v in bands.items():\n        total += freq[k]\n        for j, q in enumerate(v):\n            if j == 0:\n                s += f'{k:4d} ['\n            if j == len(v) - 1:\n                s += f'{q:{width}.{prec}f}]: {freq[k]:8d}\\n'\n            else:\n                s += f'{q:{width}.{prec}f}, '\n    width = 3 * width + 13\n    s += f'{\"Total\":{width}s}{total:8d}\\n'\n    print(s)\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Visualization/FrogBrain/","title":"FrogBrain","text":"

        vtk-examples/Python/Visualization/FrogBrain

        "},{"location":"Python/Visualization/FrogBrain/#description","title":"Description","text":"

        The frog's brain. Model extracted without smoothing (left) and with smoothing (right).

        Info

        See Figure 12-7 in Chapter 12 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/FrogBrain/#code","title":"Code","text":"

        FrogBrain.py

        #!/usr/bin/env python\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkLookupTable,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkPolyDataNormals,\n    vtkStripper,\n    vtkWindowedSincPolyDataFilter\n)\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkImageThreshold\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'The frog\\'s brain.'\n    epilogue = '''\n    Model extracted without smoothing (left) and with smoothing (right).\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('data_folder', help='The path to the file: frogtissue.mhd.')\n    parser.add_argument('tissue', default='brain', nargs='?', help='The tissue to use.')\n    args = parser.parse_args()\n    return args.data_folder, args.tissue\n\n\ndef main(data_folder, tissue):\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    path = Path(data_folder)\n    if path.is_dir():\n        s = ''\n        file_name = path.joinpath('frogtissue').with_suffix('.mhd')\n        if not file_name.is_file():\n            s += 'The file: {:s} does not exist.'.format(str(file_name))\n        if s:\n            print(s)\n            return\n    else:\n        print('Expected a path to frogtissue.mhd')\n        return\n\n    tissue_map = create_tissue_map()\n    lut = create_frog_lut(colors)\n\n    # Setup render window, renderer, and interactor.\n    renderer_left = vtkRenderer()\n    renderer_left.SetViewport(0, 0, 0.5, 1)\n    renderer_right = vtkRenderer()\n    renderer_right.SetViewport(0.5, 0, 1, 1)\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer_left)\n    render_window.AddRenderer(renderer_right)\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    actor = create_frog_actor(file_name, tissue_map[tissue], use_flying_edges)\n    actor.GetProperty().SetDiffuseColor(lut.GetTableValue(tissue_map[tissue])[:3])\n    renderer_left.AddActor(actor)\n\n    actor_smooth = create_smooth_frog_actor(file_name, tissue_map[tissue], use_flying_edges)\n    actor_smooth.GetProperty().SetDiffuseColor(lut.GetTableValue(tissue_map[tissue])[:3])\n    actor_smooth.GetProperty().SetDiffuse(1.0)\n    actor_smooth.GetProperty().SetSpecular(.5)\n    actor_smooth.GetProperty().SetSpecularPower(100)\n\n    renderer_right.AddActor(actor_smooth)\n\n    renderer_left.ResetCamera()\n    renderer_left.GetActiveCamera().SetViewUp(-1, 0, 0)\n    renderer_left.GetActiveCamera().Azimuth(180)\n    renderer_left.ResetCameraClippingRange()\n\n    renderer_left.SetBackground(colors.GetColor3d('LightSteelBlue'))\n    renderer_right.SetBackground(colors.GetColor3d('LightSteelBlue'))\n    renderer_right.SetActiveCamera(renderer_left.GetActiveCamera())\n\n    render_window.SetSize(640, 480)\n    render_window.SetWindowName('FrogBrain')\n    render_window.Render()\n\n    render_window_interactor.Start()\n\n\ndef create_smooth_frog_actor(file_name, tissue, use_flying_edges):\n    reader = vtkMetaImageReader()\n    reader.SetFileName(str(file_name))\n    reader.Update()\n\n    select_tissue = vtkImageThreshold()\n    select_tissue.ThresholdBetween(tissue, tissue)\n    select_tissue.SetInValue(255)\n    select_tissue.SetOutValue(0)\n    select_tissue.SetInputConnection(reader.GetOutputPort())\n\n    gaussian_radius = 1\n    gaussian_standard_deviation = 2.0\n    gaussian = vtkImageGaussianSmooth()\n    gaussian.SetStandardDeviations(gaussian_standard_deviation, gaussian_standard_deviation,\n                                   gaussian_standard_deviation)\n    gaussian.SetRadiusFactors(gaussian_radius, gaussian_radius, gaussian_radius)\n    gaussian.SetInputConnection(select_tissue.GetOutputPort())\n\n    # iso_value = 63.5\n    iso_value = 127.5\n    if use_flying_edges:\n        try:\n            iso_surface = vtkFlyingEdges3D()\n        except AttributeError:\n            iso_surface = vtkMarchingCubes()\n    else:\n        iso_surface = vtkMarchingCubes()\n    iso_surface.SetInputConnection(gaussian.GetOutputPort())\n    iso_surface.ComputeScalarsOff()\n    iso_surface.ComputeGradientsOff()\n    iso_surface.ComputeNormalsOff()\n    iso_surface.SetValue(0, iso_value)\n\n    smoothing_iterations = 20\n    pass_band = 0.001\n    feature_angle = 60.0\n    smoother = vtkWindowedSincPolyDataFilter()\n    smoother.SetInputConnection(iso_surface.GetOutputPort())\n    smoother.SetNumberOfIterations(smoothing_iterations)\n    smoother.BoundarySmoothingOff()\n    smoother.FeatureEdgeSmoothingOff()\n    smoother.SetFeatureAngle(feature_angle)\n    smoother.SetPassBand(pass_band)\n    smoother.NonManifoldSmoothingOn()\n    smoother.NormalizeCoordinatesOff()\n    smoother.Update()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(smoother.GetOutputPort())\n    normals.SetFeatureAngle(feature_angle)\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(normals.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(stripper.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    return actor\n\n\ndef create_frog_actor(file_name, tissue, use_flying_edges):\n    reader = vtkMetaImageReader()\n    reader.SetFileName(str(file_name))\n    reader.Update()\n\n    select_tissue = vtkImageThreshold()\n    select_tissue.ThresholdBetween(tissue, tissue)\n    select_tissue.SetInValue(255)\n    select_tissue.SetOutValue(0)\n    select_tissue.SetInputConnection(reader.GetOutputPort())\n\n    iso_value = 63.5\n    if use_flying_edges:\n        try:\n            iso_surface = vtkFlyingEdges3D()\n        except AttributeError:\n            iso_surface = vtkMarchingCubes()\n    else:\n        iso_surface = vtkMarchingCubes()\n    iso_surface.SetInputConnection(select_tissue.GetOutputPort())\n    iso_surface.ComputeScalarsOff()\n    iso_surface.ComputeGradientsOff()\n    iso_surface.ComputeNormalsOn()\n    iso_surface.SetValue(0, iso_value)\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(iso_surface.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(stripper.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    return actor\n\n\ndef create_frog_lut(colors):\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(16)\n    lut.SetTableRange(0, 15)\n    lut.Build()\n\n    lut.SetTableValue(0, colors.GetColor4d('Black'))\n    lut.SetTableValue(1, colors.GetColor4d('salmon'))  # blood\n    lut.SetTableValue(2, colors.GetColor4d('beige'))  # brain\n    lut.SetTableValue(3, colors.GetColor4d('orange'))  # duodenum\n    lut.SetTableValue(4, colors.GetColor4d('misty_rose'))  # eye_retina\n    lut.SetTableValue(5, colors.GetColor4d('white'))  # eye_white\n    lut.SetTableValue(6, colors.GetColor4d('tomato'))  # heart\n    lut.SetTableValue(7, colors.GetColor4d('raspberry'))  # ileum\n    lut.SetTableValue(8, colors.GetColor4d('banana'))  # kidney\n    lut.SetTableValue(9, colors.GetColor4d('peru'))  # l_intestine\n    lut.SetTableValue(10, colors.GetColor4d('pink'))  # liver\n    lut.SetTableValue(11, colors.GetColor4d('powder_blue'))  # lung\n    lut.SetTableValue(12, colors.GetColor4d('carrot'))  # nerve\n    lut.SetTableValue(13, colors.GetColor4d('wheat'))  # skeleton\n    lut.SetTableValue(14, colors.GetColor4d('violet'))  # spleen\n    lut.SetTableValue(15, colors.GetColor4d('plum'))  # stomach\n\n    return lut\n\n\ndef create_tissue_map():\n    tissue_map = dict()\n    tissue_map['blood'] = 1\n    tissue_map['brain'] = 2\n    tissue_map['duodenum'] = 3\n    tissue_map['eyeRetina'] = 4\n    tissue_map['eyeWhite'] = 5\n    tissue_map['heart'] = 6\n    tissue_map['ileum'] = 7\n    tissue_map['kidney'] = 8\n    tissue_map['intestine'] = 9\n    tissue_map['liver'] = 10\n    tissue_map['lung'] = 11\n    tissue_map['nerve'] = 12\n    tissue_map['skeleton'] = 13\n    tissue_map['spleen'] = 14\n    tissue_map['stomach'] = 15\n\n    return tissue_map\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    import sys\n\n    data_folder, tissue = get_program_parameters(sys.argv)\n\n    main(data_folder, tissue)\n
        "},{"location":"Python/Visualization/FrogSlice/","title":"FrogSlice","text":"

        vtk-examples/Python/Visualization/FrogSlice

        "},{"location":"Python/Visualization/FrogSlice/#description","title":"Description","text":"

        This example uses a dataset derived from a frog. This data was prepared at Lawrence Berkeley National Laboratories and is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels.

        To accommodate the volume readers we have in VTK, we processed the mask files and combined them all into one vtkMetaImageReader .mhd file. Integer numbers 1\u201315 to represent the 15 tissues. A similar process was done for the frog skin.

        This example shows a photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/FrogSlice/#code","title":"Code","text":"

        FrogSlice.py

        #!/usr/bin/env python\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkImageConstantPad\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture,\n    vtkWindowLevelLookupTable\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Visualization of a frog.'\n    epilogue = '''\nPhotographic slice of frog (upper left), segmented frog (upper right) and\n composite of photo and segmentation (bottom).\nThe purple color represents the stomach and the kidneys are yellow.\nIf slice = 39 it matches Figure 12-6 in the VTK Book.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('data_folder', help='The path to the files: frog.mhd and frogtissue.mhd.')\n    parser.add_argument('slice_number', default=39, type=int, nargs='?', help='Slice number.')\n    args = parser.parse_args()\n    return args.data_folder, args.slice_number\n\n\ndef main(data_folder, slice_number):\n    colors = vtkNamedColors()\n\n    path = Path(data_folder)\n    if path.is_dir():\n        s = ''\n        fn_1 = path.joinpath('frog').with_suffix('.mhd')\n        if not fn_1.is_file():\n            s += 'The file: {:s} does not exist.\\n'.format(str(fn_1))\n            print(s)\n        fn_2 = path.joinpath('frogtissue').with_suffix('.mhd')\n        if not fn_2.is_file():\n            s += 'The file: {:s} does not exist.'.format(str(fn_2))\n        if s:\n            print(s)\n            return\n    else:\n        print('Expected a path to frog.mhs and frogtissue.mhd')\n        return\n\n    so = SliceOrder()\n\n    # Now create the RenderWindow, Renderer and Interactor\n    #\n    ren1 = vtkRenderer()\n    ren2 = vtkRenderer()\n    ren3 = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren1)\n    ren_win.AddRenderer(ren2)\n    ren_win.AddRenderer(ren3)\n    ren_win.SetWindowName('FrogSlice')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    grey_reader = vtkMetaImageReader()\n    grey_reader.SetFileName(str(fn_1))\n    grey_reader.Update()\n\n    grey_padder = vtkImageConstantPad()\n    grey_padder.SetInputConnection(grey_reader.GetOutputPort())\n    grey_padder.SetOutputWholeExtent(0, 511, 0, 511, slice_number, slice_number)\n    grey_padder.SetConstant(0)\n\n    grey_plane = vtkPlaneSource()\n\n    grey_transform = vtkTransformPolyDataFilter()\n    grey_transform.SetTransform(so.get('hfsi'))\n    grey_transform.SetInputConnection(grey_plane.GetOutputPort())\n\n    grey_normals = vtkPolyDataNormals()\n    grey_normals.SetInputConnection(grey_transform.GetOutputPort())\n    grey_normals.FlipNormalsOff()\n\n    wllut = vtkWindowLevelLookupTable()\n    wllut.SetWindow(255)\n    wllut.SetLevel(128)\n    wllut.SetTableRange(0, 255)\n    wllut.Build()\n\n    grey_mapper = vtkPolyDataMapper()\n    grey_mapper.SetInputConnection(grey_plane.GetOutputPort())\n\n    grey_texture = vtkTexture()\n    grey_texture.SetInputConnection(grey_padder.GetOutputPort())\n    grey_texture.SetLookupTable(wllut)\n    grey_texture.SetColorModeToMapScalars()\n    grey_texture.InterpolateOn()\n\n    grey_actor = vtkActor()\n    grey_actor.SetMapper(grey_mapper)\n    grey_actor.SetTexture(grey_texture)\n\n    segment_reader = vtkMetaImageReader()\n    segment_reader.SetFileName(str(fn_2))\n    segment_reader.Update()\n\n    segment_padder = vtkImageConstantPad()\n    segment_padder.SetInputConnection(segment_reader.GetOutputPort())\n    segment_padder.SetOutputWholeExtent(0, 511, 0, 511, slice_number, slice_number)\n    segment_padder.SetConstant(0)\n\n    segment_plane = vtkPlaneSource()\n\n    segment_transform = vtkTransformPolyDataFilter()\n    segment_transform.SetTransform(so.get('hfsi'))\n    segment_transform.SetInputConnection(segment_plane.GetOutputPort())\n\n    segment_normals = vtkPolyDataNormals()\n    segment_normals.SetInputConnection(segment_transform.GetOutputPort())\n    segment_normals.FlipNormalsOn()\n\n    lut = create_frog_lut(colors)\n\n    segment_mapper = vtkPolyDataMapper()\n    segment_mapper.SetInputConnection(segment_plane.GetOutputPort())\n\n    segment_texture = vtkTexture()\n    segment_texture.SetInputConnection(segment_padder.GetOutputPort())\n    segment_texture.SetLookupTable(lut)\n    segment_texture.SetColorModeToMapScalars()\n    segment_texture.InterpolateOff()\n\n    segment_actor = vtkActor()\n    segment_actor.SetMapper(segment_mapper)\n    segment_actor.SetTexture(segment_texture)\n\n    segment_overlay_actor = vtkActor()\n    segment_overlay_actor.SetMapper(segment_mapper)\n    segment_overlay_actor.SetTexture(segment_texture)\n\n    segment_overlay_actor.GetProperty().SetOpacity(.5)\n    ren1.SetBackground(0, 0, 0)\n    ren1.SetViewport(0, 0.5, 0.5, 1)\n    ren_win.SetSize(640, 480)\n    ren1.AddActor(grey_actor)\n\n    ren2.SetBackground(0, 0, 0)\n    ren2.SetViewport(0.5, 0.5, 1, 1)\n    ren2.AddActor(segment_actor)\n\n    cam1 = vtkCamera()\n    cam1.SetViewUp(0, -1, 0)\n    cam1.SetPosition(0, 0, -1)\n    ren1.SetActiveCamera(cam1)\n    ren1.ResetCamera()\n    cam1.SetViewUp(0, -1, 0)\n    cam1.SetPosition(0.0554068, -0.0596001, -0.491383)\n    cam1.SetFocalPoint(0.0554068, -0.0596001, 0)\n    ren1.ResetCameraClippingRange()\n\n    ren3.AddActor(grey_actor)\n    ren3.AddActor(segment_overlay_actor)\n    segment_overlay_actor.SetPosition(0, 0, -0.01)\n\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren2.SetBackground(colors.GetColor3d('SlateGray'))\n    ren3.SetBackground(colors.GetColor3d('SlateGray'))\n\n    ren3.SetViewport(0, 0, 1, 0.5)\n\n    ren2.SetActiveCamera(ren1.GetActiveCamera())\n    ren3.SetActiveCamera(ren1.GetActiveCamera())\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef create_frog_lut(colors):\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(16)\n    lut.SetTableRange(0, 15)\n    lut.Build()\n\n    lut.SetTableValue(0, colors.GetColor4d('Black'))\n    lut.SetTableValue(1, colors.GetColor4d('salmon'))  # blood\n    lut.SetTableValue(2, colors.GetColor4d('beige'))  # brain\n    lut.SetTableValue(3, colors.GetColor4d('orange'))  # duodenum\n    lut.SetTableValue(4, colors.GetColor4d('misty_rose'))  # eye_retina\n    lut.SetTableValue(5, colors.GetColor4d('white'))  # eye_white\n    lut.SetTableValue(6, colors.GetColor4d('tomato'))  # heart\n    lut.SetTableValue(7, colors.GetColor4d('raspberry'))  # ileum\n    lut.SetTableValue(8, colors.GetColor4d('banana'))  # kidney\n    lut.SetTableValue(9, colors.GetColor4d('peru'))  # l_intestine\n    lut.SetTableValue(10, colors.GetColor4d('pink'))  # liver\n    lut.SetTableValue(11, colors.GetColor4d('powder_blue'))  # lung\n    lut.SetTableValue(12, colors.GetColor4d('carrot'))  # nerve\n    lut.SetTableValue(13, colors.GetColor4d('wheat'))  # skeleton\n    lut.SetTableValue(14, colors.GetColor4d('violet'))  # spleen\n    lut.SetTableValue(15, colors.GetColor4d('plum'))  # stomach\n\n    return lut\n\n\nclass SliceOrder:\n    \"\"\"\n    These transformations permute image and other geometric data to maintain proper\n     orientation regardless of the acquisition order. After applying these transforms with\n    vtkTransformFilter, a view up of 0,-1,0 will result in the body part\n    facing the viewer.\n    NOTE: some transformations have a -1 scale factor for one of the components.\n          To ensure proper polygon orientation and normal direction, you must\n          apply the vtkPolyDataNormals filter.\n\n    Naming (the nomenclature is medical):\n    si - superior to inferior (top to bottom)\n    is - inferior to superior (bottom to top)\n    ap - anterior to posterior (front to back)\n    pa - posterior to anterior (back to front)\n    lr - left to right\n    rl - right to left\n    \"\"\"\n\n    def __init__(self):\n        self.si_mat = vtkMatrix4x4()\n        self.si_mat.Zero()\n        self.si_mat.SetElement(0, 0, 1)\n        self.si_mat.SetElement(1, 2, 1)\n        self.si_mat.SetElement(2, 1, -1)\n        self.si_mat.SetElement(3, 3, 1)\n\n        self.is_mat = vtkMatrix4x4()\n        self.is_mat.Zero()\n        self.is_mat.SetElement(0, 0, 1)\n        self.is_mat.SetElement(1, 2, -1)\n        self.is_mat.SetElement(2, 1, -1)\n        self.is_mat.SetElement(3, 3, 1)\n\n        self.lr_mat = vtkMatrix4x4()\n        self.lr_mat.Zero()\n        self.lr_mat.SetElement(0, 2, -1)\n        self.lr_mat.SetElement(1, 1, -1)\n        self.lr_mat.SetElement(2, 0, 1)\n        self.lr_mat.SetElement(3, 3, 1)\n\n        self.rl_mat = vtkMatrix4x4()\n        self.rl_mat.Zero()\n        self.rl_mat.SetElement(0, 2, 1)\n        self.rl_mat.SetElement(1, 1, -1)\n        self.rl_mat.SetElement(2, 0, 1)\n        self.rl_mat.SetElement(3, 3, 1)\n\n        \"\"\"\n        The previous transforms assume radiological views of the slices (viewed from the feet). other\n        modalities such as physical sectioning may view from the head. These transforms modify the original\n        with a 180\u00b0 rotation about y\n        \"\"\"\n\n        self.hf_mat = vtkMatrix4x4()\n        self.hf_mat.Zero()\n        self.hf_mat.SetElement(0, 0, -1)\n        self.hf_mat.SetElement(1, 1, 1)\n        self.hf_mat.SetElement(2, 2, -1)\n        self.hf_mat.SetElement(3, 3, 1)\n\n    def s_i(self):\n        t = vtkTransform()\n        t.SetMatrix(self.si_mat)\n        return t\n\n    def i_s(self):\n        t = vtkTransform()\n        t.SetMatrix(self.is_mat)\n        return t\n\n    @staticmethod\n    def a_p():\n        t = vtkTransform()\n        return t.Scale(1, -1, 1)\n\n    @staticmethod\n    def p_a():\n        t = vtkTransform()\n        return t.Scale(1, -1, -1)\n\n    def l_r(self):\n        t = vtkTransform()\n        t.SetMatrix(self.lr_mat)\n        t.Update()\n        return t\n\n    def r_l(self):\n        t = vtkTransform()\n        t.SetMatrix(self.lr_mat)\n        return t\n\n    def h_f(self):\n        t = vtkTransform()\n        t.SetMatrix(self.hf_mat)\n        return t\n\n    def hf_si(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Concatenate(self.si_mat)\n        return t\n\n    def hf_is(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Concatenate(self.is_mat)\n        return t\n\n    def hf_ap(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Scale(1, -1, 1)\n        return t\n\n    def hf_pa(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Scale(1, -1, -1)\n        return t\n\n    def hf_lr(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Concatenate(self.lr_mat)\n        return t\n\n    def hf_rl(self):\n        t = vtkTransform()\n        t.Concatenate(self.hf_mat)\n        t.Concatenate(self.rl_mat)\n        return t\n\n    def get(self, order):\n        \"\"\"\n        Returns the vtkTransform corresponding to the slice order.\n\n        :param order: The slice order\n        :return: The vtkTransform to use\n        \"\"\"\n        if order == 'si':\n            return self.s_i()\n        elif order == 'is':\n            return self.i_s()\n        elif order == 'ap':\n            return self.a_p()\n        elif order == 'pa':\n            return self.p_a()\n        elif order == 'lr':\n            return self.l_r()\n        elif order == 'rl':\n            return self.r_l()\n        elif order == 'hf':\n            return self.h_f()\n        elif order == 'hfsi':\n            return self.hf_si()\n        elif order == 'hfis':\n            return self.hf_is()\n        elif order == 'hfap':\n            return self.hf_ap()\n        elif order == 'hfpa':\n            return self.hf_pa()\n        elif order == 'hflr':\n            return self.hf_lr()\n        elif order == 'hfrl':\n            return self.hf_rl()\n        else:\n            s = 'No such transform \"{:s}\" exists.'.format(order)\n            raise Exception(s)\n\n\nif __name__ == '__main__':\n    import sys\n\n    data_folder, slice_number = get_program_parameters(sys.argv)\n    main(data_folder, slice_number)\n
        "},{"location":"Python/Visualization/FroggieSurface/","title":"FroggieSurface","text":"

        vtk-examples/Python/Visualization/FroggieSurface

        "},{"location":"Python/Visualization/FroggieSurface/#description","title":"Description","text":"

        Construct surfaces from a segmented frog dataset. Up to fifteen different surfaces may be extracted. The example, FroggieView is similar to this example and uses sliders to control the opacities of the tissues.

        By default the frog is oriented so that we look down on the dorsal (posterior) surface and the superior surface faces the top of the screen. The frog is rendered with the skin being translucent so that you can see the internal organs.

        In the lower left of the image there is a prop assembly with labelled XYZ axes and a cube labelled with anatomical orientations:

        • Sagittal plane
        • L - left
        • R - right
        • Coronal plane
        • A - anterior
        • P - posterior
        • Transverse plane
        • S - superior
        • I - inferior

        This prop assembly can be moved and resized.

        Individual tissues can be specified by using the \"-t\" option e.g. \"-t skin skeleton\".

        We use vtkFlyingEdges3D to take the 3D structured point set and generate the iso-surfaces. However, if desired, you can specify vtkMarchingCubes instead, use the option \"-m\".

        The parameters used to generate the example image are loaded from a JSON file containing the data needed to access and generate the actors for each tissue along with other supplementary data such as the data file names. This means that the user need only load this one file in order to generate the data for rendering. This file is called:

        <DATA>/Frog_mhd.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see Frog_mhd_format.

        The code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder.

        The dataset was prepared at the Lawrence Berkeley National Laboratories and is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels.

        To accommodate the volume readers in VTK, the mask files were processed and combined into one vtkMetaImageReader file, called frogtissue.mhd. Integer numbers 1-15 are used to represent the 15 tissues. A similar process was done for the frog skin with the result being stored in a file called frog.mhd.

        Further information:

        • VTK Examples - FroggieSurface and FroggieView

        Info

        Mutually exclusive options \"-a, -b, -c, -d\" are provided to let you generate approximations to the following figures: Figure 12-9a, Figure 12-9b, Figure 12-9c, and Figure 12-9d in Chapter 12 of the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/FroggieSurface/#code","title":"Code","text":"

        FroggieSurface.py

        #!/usr/bin/env python3\n\nimport copy\nimport json\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDecimatePro,\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkPolyDataNormals,\n    vtkStripper,\n    vtkWindowedSincPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageShrink3D,\n    vtkImageThreshold\n)\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkImagingMorphological import vtkImageIslandRemoval2D\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import (\n    vtkAnnotatedCubeActor,\n    vtkAxesActor\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropAssembly,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'Construct surfaces from a segmented frog dataset.'\n    epilogue = '''\nUp to fifteen different surfaces may be extracted.\n\nNote:\n   If you want to use brainbin (the brain with no gaussian smoothing),\n    instead of brain, then request it with -t brainbin\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    group = parser.add_mutually_exclusive_group()\n    group.add_argument('-a', action='store_const', dest='view', const='a',\n                       help='The view corresponds to Fig 12-9a in the VTK Textbook')\n    group.add_argument('-b', action='store_const', dest='view', const='b',\n                       help='The view corresponds to Fig 12-9b in the VTK Textbook')\n    group.add_argument('-c', action='store_const', dest='view', const='c',\n                       help='The view corresponds to Fig 12-9c in the VTK Textbook')\n    group.add_argument('-d', action='store_const', dest='view', const='d',\n                       help='The view corresponds to Fig 12-9d in the VTK Textbook')\n    group.add_argument('-l', action='store_const', dest='view', const='l',\n                       help='The view corresponds to looking down on the anterior surface')\n    group.add_argument('-p', action='store_const', dest='view', const='p',\n                       help='The view corresponds to looking down on the posterior surface (the default)')\n    parser.set_defaults(type=None)\n\n    parser.add_argument('file_name', help='The path to the JSON file e.g. Frog_mhd.json.')\n    parser.add_argument('-t', nargs='+', dest='tissues', action='append', help='Select one or more tissues.')\n    parser.add_argument('-m', action='store_false', dest='flying_edges',\n                        help='Use flying edges by default, marching cubes if set.')\n    # -o: obliterate a synonym for decimation.\n    parser.add_argument('-o', action='store_true', dest='decimation', help='Decimate if set.')\n    args = parser.parse_args()\n    return args.file_name, args.view, args.tissues, args.flying_edges, args.decimation\n\n\ndef main(fn, select_figure, chosen_tissues, flying_edges, decimate):\n    if not select_figure:\n        select_figure = 'p'\n\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    parsed_ok, parameters = parse_json(fn_path)\n    if not parsed_ok:\n        print('Unable to parse the JSON file.')\n        return\n\n    tissues = list()\n    indices = dict()\n    for n in parameters['names']:\n        if n != 'brainbin':\n            tissues.append(n)\n            indices[n] = parameters[n]['tissue']\n    color_lut = create_tissue_lut(indices, parameters['colors'])\n\n    if select_figure:\n        if select_figure == 'b':\n            # No skin.\n            tissues = parameters['fig12-9b']\n        if select_figure in ['c', 'd']:\n            # No skin, blood and skeleton.\n            tissues = parameters['fig12-9cd']\n\n    if chosen_tissues:\n        chosen_tissues = [x.lower() for x in chosen_tissues[0]]\n        res = list()\n        has_brainbin = False\n        if 'brainbin' in chosen_tissues:\n            print('Using brainbin instead of brain.')\n            res.append('brainbin')\n            indices.pop('brain', None)\n            indices['brainbin'] = 2\n            parameters['colors'].pop('brain', None)\n            parameters['colors']['brainbin'] = 'beige'\n            has_brainbin = True\n        for ct in chosen_tissues:\n            if has_brainbin and ct in ['brain', 'brainbin']:\n                continue\n            if ct in tissues:\n                res.append(ct)\n            else:\n                print(f'Tissue: {ct} is not available.')\n                print(f'Available tissues are: {\", \".join(tissues)} and brainbin')\n                return\n        if len(res) == 1 and 'skin' in res:\n            parameters['skin']['opacity'] = 1.0\n        tissues = res\n\n    colors = vtkNamedColors()\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    # Setup render window, renderer, and interactor.\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    color_size = len(max(parameters['colors'].values(), key=len))\n    name_size = len(max(parameters['names'], key=len))\n    int_size = 2\n    line = '-' * (7 + name_size + color_size)\n    res = [line,\n           f'{\"Tissue\":<{name_size}s}{\" Label \"}{\"Color\"}',\n           line]\n\n    so = SliceOrder()\n\n    for name in tissues:\n        actor = create_tissue_actor(name, parameters[name], parameters['mhd_files'], flying_edges, decimate,\n                                    color_lut, so)\n        ren.AddActor(actor)\n        res.append(f'{name:<{name_size}s} {indices[name]:{int_size + 3}d} {parameters[\"colors\"][name]:<{color_size}s}')\n\n    res.append(line)\n    print('\\n'.join(res))\n\n    ren_win.SetSize(1024, 1024)\n    ren_win.SetWindowName('FroggieSurface')\n\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    #  Final view.\n    camera = ren.GetActiveCamera()\n    # Superior Anterior Left\n    labels = 'sal'\n    if select_figure == 'a':\n        # Fig 12-9a in the VTK Textbook\n        camera.SetPosition(742.731237, -441.329635, -877.192015)\n        camera.SetFocalPoint(247.637687, 120.680880, -253.487473)\n        camera.SetViewUp(-0.323882, -0.816232, 0.478398)\n        camera.SetDistance(974.669585)\n        camera.SetClippingRange(311.646383, 1803.630763)\n    elif select_figure == 'b':\n        # Fig 12-9b in the VTK Textbook\n        camera.SetPosition(717.356065, -429.889054, -845.381584)\n        camera.SetFocalPoint(243.071719, 100.996487, -247.446340)\n        camera.SetViewUp(-0.320495, -0.820148, 0.473962)\n        camera.SetDistance(929.683631)\n        camera.SetClippingRange(293.464446, 1732.794957)\n    elif select_figure == 'c':\n        # Fig 12-9c in the VTK Textbook\n        camera.SetPosition(447.560023, -136.611491, -454.753689)\n        camera.SetFocalPoint(253.142277, 91.949451, -238.583973)\n        camera.SetViewUp(-0.425438, -0.786048, 0.448477)\n        camera.SetDistance(369.821187)\n        camera.SetClippingRange(0.829116, 829.115939)\n    elif select_figure == 'd':\n        # Fig 12-9d in the VTK Textbook\n        camera.SetPosition(347.826249, -469.633647, -236.234262)\n        camera.SetFocalPoint(296.893207, 89.307704, -225.156581)\n        camera.SetViewUp(-0.687345, -0.076948, 0.722244)\n        camera.SetDistance(561.366478)\n        camera.SetClippingRange(347.962064, 839.649856)\n    elif select_figure == 'l':\n        # Orient so that we look down on the anterior surface and\n        #   the superior surface faces the top of the screen.\n        #  Left Superior Anterior\n        labels = 'lsa'\n        transform = vtkTransform()\n        transform.SetMatrix(camera.GetModelTransformMatrix())\n        transform.RotateY(90)\n        transform.RotateZ(90)\n        camera.SetModelTransformMatrix(transform.GetMatrix())\n        ren.ResetCamera()\n    else:\n        # The default.\n        # Orient so that we look down on the posterior surface and\n        #   the superior surface faces the top of the screen.\n        # Right Superior Posterior\n        labels = 'rsp'\n        transform = vtkTransform()\n        transform.SetMatrix(camera.GetModelTransformMatrix())\n        transform.RotateY(-90)\n        transform.RotateZ(90)\n        camera.SetModelTransformMatrix(transform.GetMatrix())\n        ren.ResetCamera()\n\n    cow = vtkCameraOrientationWidget()\n    cow.SetParentRenderer(ren)\n    # Turn off if you do not want it.\n    cow.On()\n    cow.EnabledOn()\n\n    axes = make_cube_actor(labels, colors)\n    om = vtkOrientationMarkerWidget()\n    om.SetOrientationMarker(axes)\n    # Position upper left in the viewport.\n    # om.SetViewport(0.0, 0.8, 0.2, 1.0)\n    # Position lower left in the viewport.\n    om.SetViewport(0, 0, 0.2, 0.2)\n    om.SetInteractor(iren)\n    om.EnabledOn()\n    om.InteractiveOn()\n\n    ren_win.Render()\n\n    iren.Start()\n\n\ndef parse_json(fn_path):\n    \"\"\"\n    Parse the JSON file selecting the components that we want.\n\n    We also check that the file paths are valid.\n\n    :param fn_path: The path the JSON file.\n    :return: A dictionary of the parameters that we require.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    paths_ok = True\n    parameters = dict()\n    # The names of the tissues as a list.\n    parameters['names'] = list()\n    for k, v in json_data.items():\n        if k == 'files':\n            if 'root' in v:\n                root = Path(v['root'])\n                if not root.exists():\n                    print(f'Bad path: {root}')\n                    paths_ok = False\n                else:\n                    if 'mhd_files' not in v:\n                        print('Expected mhd files.')\n                        paths_ok = False\n                        continue\n                    for kk in v:\n                        if kk == 'mhd_files':\n                            if len(v[kk]) != 2:\n                                print(f'Expected two file names.')\n                                paths_ok = False\n                            # The stem of the file path becomes the key.\n                            path_map = dict()\n                            for p in list(map(lambda pp: root / pp, v[kk])):\n                                path_map[p.stem] = p\n                                if not p.is_file():\n                                    paths_ok = False\n                                    print(f'Not a file {p}')\n                            if paths_ok:\n                                parameters[kk] = path_map\n            else:\n                paths_ok = False\n                print('Missing the key \"root\" and/or the key \"files\" for the files.')\n        else:\n            if k in ['tissues', 'figures']:\n                for kk, vv in v.items():\n                    parameters[kk] = vv\n            if k == \"tissue_parameters\":\n                # Assemble the parameters for each tissue.\n                # Create the base parameters.\n                bp = dict()\n                for kk, vv in v['default'].items():\n                    bp[kk.lower()] = vv\n                frog = copy.deepcopy(bp)\n                for kk, vv in v['frog'].items():\n                    frog[kk.lower()] = vv\n                for kk, vv in v.items():\n                    if kk not in ['default', 'frog', 'parameter types']:\n                        if kk == 'skin':\n                            parameters[kk] = copy.deepcopy(bp)\n                        else:\n                            parameters[kk] = copy.deepcopy(frog)\n                        for kkk, vvv in vv.items():\n                            parameters[kk][kkk.lower()] = vvv\n                            if kkk == 'NAME':\n                                parameters['names'].append(vvv)\n    return paths_ok, parameters\n\n\ndef create_tissue_actor(name, tissue, files, flying_edges, decimate, lut, so):\n    \"\"\"\n    Create the actor for a specific tissue.\n\n    :param name: The tissue name.\n    :param tissue: The tissue parameters.\n    :param files: The path to the tissue files.\n    :param flying_edges: If true use flying edges.\n    :param decimate: If true decimate.\n    :param lut: The color lookup table for the tissues.\n    :param so: The transforms corresponding to the slice order.\n    :return: The actor.\n    \"\"\"\n\n    pixel_size = tissue['pixel_size']\n    spacing = tissue['spacing']\n    start_slice = tissue['start_slice']\n    data_spacing = [pixel_size, pixel_size, spacing]\n    columns = tissue['columns']\n    rows = tissue['rows']\n    data_origin = [-(columns / 2.0) * pixel_size, -(rows / 2.0) * pixel_size, start_slice * spacing]\n\n    voi = [\n        tissue['start_column'],\n        tissue['end_column'],\n        tissue['start_row'],\n        tissue['end_row'],\n        tissue['start_slice'],\n        tissue['end_slice'],\n    ]\n    # Adjust y bounds for PNM coordinate system.\n    tmp = voi[2]\n    voi[2] = rows - voi[3] - 1\n    voi[3] = rows - tmp - 1\n\n    if name == 'skin':\n        fn = files['frog']\n    else:\n        fn = files['frogtissue']\n\n    reader = vtkMetaImageReader()\n    reader.SetFileName(str(fn))\n    reader.SetDataSpacing(data_spacing)\n    reader.SetDataOrigin(data_origin)\n    reader.SetDataExtent(voi)\n    reader.Update()\n\n    last_connection = reader\n\n    if not name == 'skin':\n        if tissue['island_replace'] >= 0:\n            island_remover = vtkImageIslandRemoval2D()\n            island_remover.SetAreaThreshold(tissue['island_area'])\n            island_remover.SetIslandValue(tissue['island_replace'])\n            island_remover.SetReplaceValue(tissue['tissue'])\n            island_remover.SetInput(last_connection.GetOutput())\n            island_remover.Update()\n            last_connection = island_remover\n\n        select_tissue = vtkImageThreshold()\n        select_tissue.ThresholdBetween(tissue['tissue'], tissue['tissue'])\n        select_tissue.SetInValue(255)\n        select_tissue.SetOutValue(0)\n        select_tissue.SetInputConnection(last_connection.GetOutputPort())\n        last_connection = select_tissue\n\n    sample_rate = [\n        tissue['sample_rate_column'],\n        tissue['sample_rate_row'],\n        tissue['sample_rate_slice'],\n    ]\n\n    shrinker = vtkImageShrink3D()\n    shrinker.SetInputConnection(last_connection.GetOutputPort())\n    shrinker.SetShrinkFactors(sample_rate)\n    shrinker.AveragingOn()\n    last_connection = shrinker\n\n    gsd = [\n        tissue['gaussian_standard_deviation_column'],\n        tissue['gaussian_standard_deviation_row'],\n        tissue['gaussian_standard_deviation_slice'],\n    ]\n\n    if not all(v == 0 for v in gsd):\n        grf = [\n            tissue['gaussian_radius_factor_column'],\n            tissue['gaussian_radius_factor_row'],\n            tissue['gaussian_radius_factor_slice'],\n        ]\n\n        gaussian = vtkImageGaussianSmooth()\n        gaussian.SetStandardDeviation(*gsd)\n        gaussian.SetRadiusFactors(*grf)\n        gaussian.SetInputConnection(shrinker.GetOutputPort())\n        last_connection = gaussian\n\n    iso_value = tissue['value']\n    if flying_edges:\n        iso_surface = vtkFlyingEdges3D()\n        iso_surface.SetInputConnection(last_connection.GetOutputPort())\n        iso_surface.ComputeScalarsOff()\n        iso_surface.ComputeGradientsOff()\n        iso_surface.ComputeNormalsOff()\n        iso_surface.SetValue(0, iso_value)\n        iso_surface.Update()\n    else:\n        iso_surface = vtkMarchingCubes()\n        iso_surface.SetInputConnection(last_connection.GetOutputPort())\n        iso_surface.ComputeScalarsOff()\n        iso_surface.ComputeGradientsOff()\n        iso_surface.ComputeNormalsOff()\n        iso_surface.SetValue(0, iso_value)\n        iso_surface.Update()\n\n    transform = so.get(tissue['slice_order'])\n    tf = vtkTransformPolyDataFilter()\n    tf.SetTransform(transform)\n    tf.SetInputConnection(iso_surface.GetOutputPort())\n    last_connection = tf\n\n    if decimate:\n        decimator = vtkDecimatePro()\n        decimator.SetInputConnection(last_connection.GetOutputPort())\n        decimator.SetFeatureAngle(tissue['decimate_angle'])\n        decimator.PreserveTopologyOn()\n        decimator.SetErrorIsAbsolute(1)\n        decimator.SetAbsoluteError(tissue['decimate_error'])\n        decimator.SetTargetReduction(tissue['decimate_reduction'])\n        last_connection = decimator\n\n    smooth_iterations = tissue['smooth_iterations']\n    if smooth_iterations != 0:\n        smoother = vtkWindowedSincPolyDataFilter()\n        smoother.SetInputConnection(last_connection.GetOutputPort())\n        smoother.BoundarySmoothingOff()\n        smoother.FeatureEdgeSmoothingOff()\n        smoother.SetFeatureAngle(tissue['smooth_angle'])\n        smoother.SetPassBand(tissue['smooth_factor'])\n        smoother.NonManifoldSmoothingOn()\n        smoother.NormalizeCoordinatesOff()\n        last_connection = smoother\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(last_connection.GetOutputPort())\n    normals.SetFeatureAngle(tissue['feature_angle'])\n\n    stripper = vtkStripper()\n    stripper.SetInputConnection(normals.GetOutputPort())\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(stripper.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetOpacity(tissue['opacity'])\n    actor.GetProperty().SetDiffuseColor(lut.GetTableValue(tissue['tissue'])[:3])\n    actor.GetProperty().SetSpecular(0.5)\n    actor.GetProperty().SetSpecularPower(10)\n\n    return actor\n\n\nclass SliceOrder:\n    \"\"\"\n    These transformations permute image and other geometric data to maintain proper\n     orientation regardless of the acquisition order. After applying these transforms with\n    vtkTransformFilter, a view up of 0, -1, 0 will result in the body part\n    facing the viewer.\n    NOTE: some transformations have a -1 scale factor for one of the components.\n          To ensure proper polygon orientation and normal direction, you must\n          apply the vtkPolyDataNormals filter.\n\n    Naming (the nomenclature is medical):\n    si - superior to inferior (top to bottom)\n    is - inferior to superior (bottom to top)\n    ap - anterior to posterior (front to back)\n    pa - posterior to anterior (back to front)\n    lr - left to right\n    rl - right to left\n    \"\"\"\n\n    def __init__(self):\n        self.si_mat = vtkMatrix4x4()\n        self.si_mat.Zero()\n        self.si_mat.SetElement(0, 0, 1)\n        self.si_mat.SetElement(1, 2, 1)\n        self.si_mat.SetElement(2, 1, -1)\n        self.si_mat.SetElement(3, 3, 1)\n\n        self.is_mat = vtkMatrix4x4()\n        self.is_mat.Zero()\n        self.is_mat.SetElement(0, 0, 1)\n        self.is_mat.SetElement(1, 2, -1)\n        self.is_mat.SetElement(2, 1, -1)\n        self.is_mat.SetElement(3, 3, 1)\n\n        self.lr_mat = vtkMatrix4x4()\n        self.lr_mat.Zero()\n        self.lr_mat.SetElement(0, 2, -1)\n        self.lr_mat.SetElement(1, 1, -1)\n        self.lr_mat.SetElement(2, 0, 1)\n        self.lr_mat.SetElement(3, 3, 1)\n\n        self.rl_mat = vtkMatrix4x4()\n        self.rl_mat.Zero()\n        self.rl_mat.SetElement(0, 2, 1)\n        self.rl_mat.SetElement(1, 1, -1)\n        self.rl_mat.SetElement(2, 0, 1)\n        self.rl_mat.SetElement(3, 3, 1)\n\n        \"\"\"\n        The previous transforms assume radiological views of the slices\n         (viewed from the feet).\n        Other modalities such as physical sectioning may view from the head.\n        The following transforms modify the original with a 180\u00b0 rotation about y\n        \"\"\"\n\n        self.hf_mat = vtkMatrix4x4()\n        self.hf_mat.Zero()\n        self.hf_mat.SetElement(0, 0, -1)\n        self.hf_mat.SetElement(1, 1, 1)\n        self.hf_mat.SetElement(2, 2, -1)\n        self.hf_mat.SetElement(3, 3, 1)\n\n        self.transform = dict()\n\n        si_trans = vtkTransform()\n        si_trans.SetMatrix(self.si_mat)\n        self.transform['si'] = si_trans\n\n        is_trans = vtkTransform()\n        is_trans.SetMatrix(self.is_mat)\n        self.transform['is'] = is_trans\n\n        ap_trans = vtkTransform()\n        ap_trans.Scale(1, -1, 1)\n        self.transform['ap'] = ap_trans\n\n        pa_trans = vtkTransform()\n        pa_trans.Scale(1, -1, -1)\n        self.transform['pa'] = pa_trans\n\n        lr_trans = vtkTransform()\n        lr_trans.SetMatrix(self.lr_mat)\n        self.transform['lr'] = lr_trans\n\n        rl_trans = vtkTransform()\n        rl_trans.SetMatrix(self.rl_mat)\n        self.transform['rl'] = rl_trans\n\n        hf_trans = vtkTransform()\n        hf_trans.SetMatrix(self.hf_mat)\n        self.transform['hf'] = hf_trans\n\n        hf_si_trans = vtkTransform()\n        hf_si_trans.SetMatrix(self.hf_mat)\n        hf_si_trans.Concatenate(self.si_mat)\n        self.transform['hfsi'] = hf_si_trans\n\n        hf_is_trans = vtkTransform()\n        hf_is_trans.SetMatrix(self.hf_mat)\n        hf_is_trans.Concatenate(self.is_mat)\n        self.transform['hfis'] = hf_is_trans\n\n        hf_ap_trans = vtkTransform()\n        hf_ap_trans.SetMatrix(self.hf_mat)\n        hf_ap_trans.Scale(1, -1, 1)\n        self.transform['hfap'] = hf_ap_trans\n\n        hf_pa_trans = vtkTransform()\n        hf_pa_trans.SetMatrix(self.hf_mat)\n        hf_pa_trans.Scale(1, -1, -1)\n        self.transform['hfpa'] = hf_pa_trans\n\n        hf_lr_trans = vtkTransform()\n        hf_lr_trans.SetMatrix(self.hf_mat)\n        hf_lr_trans.Concatenate(self.lr_mat)\n        self.transform['hflr'] = hf_lr_trans\n\n        hf_rl_trans = vtkTransform()\n        hf_rl_trans.SetMatrix(self.hf_mat)\n        hf_rl_trans.Concatenate(self.rl_mat)\n        self.transform['hfrl'] = hf_rl_trans\n\n    def print_transform(self, order):\n        \"\"\"\n        Print the homogenous matrix corresponding to the slice order.\n        :param order: The slice order.\n        :return:\n        \"\"\"\n        print(order)\n        m = self.transform[order].GetMatrix()\n        for i in range(0, 4):\n            row = list()\n            for j in range(0, 4):\n                row.append(f'{m.GetElement(i, j):6.2g}')\n            print(' '.join(row))\n\n    def print_all_transforms(self):\n        \"\"\"\n        Print all the homogenous matrices corresponding to the slice orders.\n        :return:\n        \"\"\"\n        for k in self.transform.keys():\n            self.print_transform(k)\n\n    def get(self, order):\n        \"\"\"\n        Returns the vtkTransform corresponding to the slice order.\n\n        :param order: The slice order.\n        :return: The vtkTransform to use.\n        \"\"\"\n        if order in self.transform.keys():\n            return self.transform[order]\n        else:\n            s = 'No such transform \"{:s}\" exists.'.format(order)\n            raise Exception(s)\n\n\ndef create_tissue_lut(indices, colors):\n    \"\"\"\n    Create the lookup table for the frog tissues.\n\n    Each table value corresponds the color of one of the frog tissues.\n\n    :param indices: The tissue name and index.\n    :param colors: The tissue name and color.\n    :return: The lookup table.\n    \"\"\"\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(len(colors))\n    lut.SetTableRange(0, len(colors) - 1)\n    lut.Build()\n\n    nc = vtkNamedColors()\n\n    for k in indices.keys():\n        lut.SetTableValue(indices[k], nc.GetColor4d(colors[k]))\n\n    return lut\n\n\ndef make_axes_actor(scale, xyz_labels):\n    \"\"\"\n    :param scale: Sets the scale and direction of the axes.\n    :param xyz_labels: Labels for the axes.\n    :return: The axes actor.\n    \"\"\"\n    axes = vtkAxesActor()\n    axes.SetScale(scale)\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText(xyz_labels[0])\n    axes.SetYAxisLabelText(xyz_labels[1])\n    axes.SetZAxisLabelText(xyz_labels[2])\n    axes.SetCylinderRadius(0.5 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.025 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.5 * axes.GetSphereRadius())\n    tprop = axes.GetXAxisCaptionActor2D().GetCaptionTextProperty()\n    tprop.ItalicOn()\n    tprop.ShadowOn()\n    tprop.SetFontFamilyToTimes()\n    # Use the same text properties on the other two axes.\n    axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    return axes\n\n\ndef make_annotated_cube_actor(cube_labels, colors):\n    \"\"\"\n    :param cube_labels: The labels for the cube faces.\n    :param colors: Used to determine the cube color.\n    :return: The annotated cube actor.\n    \"\"\"\n    # A cube with labeled faces.\n    cube = vtkAnnotatedCubeActor()\n    cube.SetXPlusFaceText(cube_labels[0])\n    cube.SetXMinusFaceText(cube_labels[1])\n    cube.SetYPlusFaceText(cube_labels[2])\n    cube.SetYMinusFaceText(cube_labels[3])\n    cube.SetZPlusFaceText(cube_labels[4])\n    cube.SetZMinusFaceText(cube_labels[5])\n    cube.SetFaceTextScale(0.5)\n    cube.GetCubeProperty().SetColor(colors.GetColor3d('Gainsboro'))\n\n    cube.GetTextEdgesProperty().SetColor(colors.GetColor3d('LightSlateGray'))\n\n    # Change the vector text colors.\n    cube.GetXPlusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetXMinusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetYPlusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetYMinusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetZPlusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    cube.GetZMinusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    return cube\n\n\ndef make_cube_actor(label_selector, colors):\n    \"\"\"\n    :param label_selector: The selector used to define labels for the axes and cube.\n    :param colors: Used to set the colors of the cube faces.\n    :return: The combined axes and annotated cube prop.\n    \"\"\"\n    if label_selector == 'sal':\n        # xyz_labels = ['S', 'A', 'L']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['S', 'I', 'A', 'P', 'L', 'R']\n        scale = [1.5, 1.5, 1.5]\n    elif label_selector == 'rsp':\n        # xyz_labels = ['R', 'S', 'P']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['R', 'L', 'S', 'I', 'P', 'A']\n        scale = [1.5, 1.5, 1.5]\n    elif label_selector == 'lsa':\n        # xyz_labels = ['L', 'S', 'A']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['L', 'R', 'S', 'I', 'A', 'P']\n        scale = [1.5, 1.5, 1.5]\n    else:\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['+X', '-X', '+Y', '-Y', '+Z', '-Z']\n        scale = [1.5, 1.5, 1.5]\n\n    # We are combining a vtkAxesActor and a vtkAnnotatedCubeActor\n    # into a vtkPropAssembly\n    cube = make_annotated_cube_actor(cube_labels, colors)\n    axes = make_axes_actor(scale, xyz_labels)\n\n    # Combine orientation markers into one with an assembly.\n    assembly = vtkPropAssembly()\n    assembly.AddPart(axes)\n    assembly.AddPart(cube)\n    return assembly\n\n\nif __name__ == '__main__':\n    import sys\n\n    data_folder, view, selected_tissues, use_flying_edges, use_decimate = get_program_parameters(sys.argv)\n    main(data_folder, view, selected_tissues, use_flying_edges, use_decimate)\n
        "},{"location":"Python/Visualization/FroggieView/","title":"FroggieView","text":"

        vtk-examples/Python/Visualization/FroggieView

        "},{"location":"Python/Visualization/FroggieView/#description","title":"Description","text":"

        View surfaces of a segmented frog dataset using preprocessed *.vtk tissue files. This means that loading and processing is much faster when comapred with FroggieSurface.

        FroggieView provides the ability to turn on and off surfaces, control their opacity through the use of sliders and control the camera position.

        By default the frog is oriented so that we look down on the dorsal (posterior) surface and the superior surface faces the top of the screen. The frog is rendered with the skin being translucent so that you can see the internal organs.

        In the lower left of the image there is a prop assembly with labelled XYZ axes and a cube labelled with anatomical orientations:

        • Sagittal plane
        • L - left
        • R - right
        • Coronal plane
        • A - anterior
        • P - posterior
        • Transverse plane
        • S - superior
        • I - inferior

        This prop assembly can be moved and resized.

        The opacity of each tissue is controlled by a slider, additionally you can turn all the sliders on or off by pressing the \"n\" key.

        If the option \"-n\" is selected, no sliders will displayed.

        Individual tissues can be specified by using the \"-t\" option e.g. \"-t skin skeleton\".

        The parameters used to generate the example image are loaded from a JSON file containing the data needed to access and generate the actors for each tissue along with other supplementary data such as the data file names. This means that the user need only load this one file in order to generate the data for rendering. This file is called:

        <DATA>/Frog_vtk.json\n

        Where <DATA> is the path to vtk-examples/src/Testing/Data.

        For information about the parameters in the JSON file, please see Frog_vtk_format.

        The code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder.

        The dataset was prepared at the Lawrence Berkeley National Laboratories. It is included with their permission. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels.

        Further information:

        • VTK Examples - FroggieSurface and FroggieView

        Info

        Mutually exclusive options \"-a -b -c -d\" are provided to let you generate approximations to the following figures: Figure 12-9a, Figure 12-9b, Figure 12-9c, and Figure 12-9d in Chapter 12 of the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/FroggieView/#code","title":"Code","text":"

        FroggieView.py

        #!/usr/bin/env python3\n\nimport json\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkLookupTable\n)\nfrom vtkmodules.vtkCommonMath import vtkMatrix4x4\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkOrientationMarkerWidget,\n    vtkSliderRepresentation2D,\n    vtkSliderWidget\n)\nfrom vtkmodules.vtkRenderingAnnotation import (\n    vtkAxesActor,\n    vtkAnnotatedCubeActor,\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropAssembly,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters(argv):\n    import argparse\n    description = 'View surfaces of a segmented frog dataset using preprocessed VTK tissue files.'\n    epilogue = '''\nSliders are provided to control the opacity of the displayed tissues.\nUp to fifteen different surfaces may be viewed.\n\nNote:\n   If you want to use brainbin (the brain with no gaussian smoothing),\n    instead of brain, then request it with -t brainbin\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n\n    group = parser.add_mutually_exclusive_group()\n    group.add_argument('-a', action='store_const', dest='view', const='a',\n                       help='The view corresponds to Fig 12-9a in the VTK Textbook')\n    group.add_argument('-b', action='store_const', dest='view', const='b',\n                       help='The view corresponds to Fig 12-9b in the VTK Textbook')\n    group.add_argument('-c', action='store_const', dest='view', const='c',\n                       help='The view corresponds to Fig 12-9c in the VTK Textbook')\n    group.add_argument('-d', action='store_const', dest='view', const='d',\n                       help='The view corresponds to Fig 12-9d in the VTK Textbook')\n    group.add_argument('-l', action='store_const', dest='view', const='l',\n                       help='The view corresponds to looking down on the anterior surface')\n    group.add_argument('-p', action='store_const', dest='view', const='p',\n                       help='The view corresponds to looking down on the posterior surface (the default)')\n    parser.set_defaults(type=None)\n\n    parser.add_argument('file_name', help='The path to the JSON file e.g. Frog_vtk.json.')\n    parser.add_argument('-n', action='store_true', dest='omit_sliders', help='No sliders.')\n    parser.add_argument('-t', nargs='+', dest='tissues', action='append', help='Select one or more tissues.')\n    args = parser.parse_args()\n    return args.file_name, args.view, args.omit_sliders, args.tissues\n\n\ndef main(fn, select_figure, no_sliders, chosen_tissues):\n    if not select_figure:\n        select_figure = 'p'\n\n    fn_path = Path(fn)\n    if not fn_path.suffix:\n        fn_path = fn_path.with_suffix(\".json\")\n    if not fn_path.is_file():\n        print('Unable to find: ', fn_path)\n    parsed_ok, parameters = parse_json(fn_path)\n    if not parsed_ok:\n        print('Unable to parse the JSON file.')\n        return\n\n    color_lut = create_tissue_lut(parameters['indices'], parameters['colors'])\n\n    tissues = parameters['names']\n    if select_figure:\n        if select_figure == 'b':\n            # No skin.\n            tissues = parameters['fig12-9b']\n        if select_figure in ['c', 'd']:\n            # No skin, blood and skeleton.\n            tissues = parameters['fig12-9cd']\n\n    if chosen_tissues:\n        chosen_tissues = [x.lower() for x in chosen_tissues[0]]\n        res = list()\n        has_brainbin = False\n        if 'brainbin' in chosen_tissues:\n            print('Using brainbin instead of brain.')\n            res.append('brainbin')\n            parameters['indices'].pop('brain', None)\n            parameters['indices']['brainbin'] = 2\n            parameters['colors'].pop('brain', None)\n            parameters['colors']['brainbin'] = 'beige'\n            has_brainbin = True\n        for ct in chosen_tissues:\n            if has_brainbin and ct in ['brain', 'brainbin']:\n                continue\n            if ct in tissues:\n                res.append(ct)\n            else:\n                print(f'Tissue: {ct} is not available.')\n                print(f'Available tissues are: {\", \".join(tissues)} and brainbin')\n                return\n        if len(res) == 1 and 'skin' in res:\n            parameters['opacity']['skin'] = 1.0\n        tissues = res\n\n    colors = vtkNamedColors()\n    colors.SetColor(\"ParaViewBkg\", [82, 87, 110, 255])\n\n    # Setup render window, renderers, and interactor.\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    sliders = dict()\n    left_step_size = 1.0 / 9\n    left_pos_y = 0.275\n    left_pos_x0 = 0.02\n    left_pos_x1 = 0.18\n    right_step_size = 1.0 / 9\n    right_pos_y = 0.05\n    right_pos_x0 = 0.8 + 0.02\n    right_pos_x1 = 0.8 + 0.18\n\n    slider_count = 0\n\n    color_size = len(max(parameters['colors'].values(), key=len))\n    name_size = len(max(parameters['names'], key=len))\n    int_size = 2\n    line = '-' * (7 + name_size + color_size)\n    res = [line,\n           f'{\"Tissue\":<{name_size}s}{\" Label \"}{\"Color\"}',\n           line]\n\n    for tissue in tissues:\n        reader = vtkPolyDataReader()\n        reader.SetFileName(parameters['vtk_files'][tissue])\n        reader.Update()\n\n        trans = SliceOrder().get(parameters['orientation'][tissue])\n        trans.Scale(1, -1, -1)\n\n        tf = vtkTransformPolyDataFilter()\n        tf.SetInputConnection(reader.GetOutputPort())\n        tf.SetTransform(trans)\n        tf.SetInputConnection(reader.GetOutputPort())\n\n        normals = vtkPolyDataNormals()\n        normals.SetInputConnection(tf.GetOutputPort())\n        normals.SetFeatureAngle(60.0)\n\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(normals.GetOutputPort())\n\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        actor.GetProperty().SetOpacity(parameters['opacity'][tissue])\n        actor.GetProperty().SetDiffuseColor(color_lut.GetTableValue(parameters['indices'][tissue])[:3])\n        actor.GetProperty().SetSpecular(0.2)\n        actor.GetProperty().SetSpecularPower(10)\n\n        ren.AddActor(actor)\n\n        if not no_sliders:\n            slider_properties = SliderProperties()\n            slider_properties.value_initial = parameters['opacity'][tissue]\n            slider_properties.title = tissue\n\n            # Screen coordinates.\n            if slider_count < 7:\n                slider_properties.p1 = [left_pos_x0, left_pos_y]\n                slider_properties.p2 = [left_pos_x1, left_pos_y]\n                left_pos_y += left_step_size\n            else:\n                slider_properties.p1 = [right_pos_x0, right_pos_y]\n                slider_properties.p2 = [right_pos_x1, right_pos_y]\n                right_pos_y += right_step_size\n\n            slider_widget = make_slider_widget(slider_properties, color_lut, parameters['indices'][tissue])\n            slider_widget.SetInteractor(iren)\n            slider_widget.SetAnimationModeToAnimate()\n            slider_widget.EnabledOn()\n\n            cb = SliderCallback(actor.GetProperty())\n            slider_widget.AddObserver(vtkCommand.InteractionEvent, cb)\n            sliders[tissue] = slider_widget\n            slider_count += 1\n\n        res.append(\n            f'{tissue:<{name_size}s} {parameters[\"indices\"][tissue]:{int_size + 3}d}'\n            f' {parameters[\"colors\"][tissue]:<{color_size}s}')\n\n    res.append(line)\n    print('\\n'.join(res))\n\n    if no_sliders:\n        ren_win.SetSize(1024, 1024)\n    else:\n        ren_win.SetSize(1024 + 400, 1024)\n    ren_win.SetWindowName('FroggieView')\n\n    ren.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    #  Final view.\n    camera = ren.GetActiveCamera()\n    # Superior Anterior Left\n    labels = 'sal'\n    if select_figure == 'a':\n        # Fig 12-9a in the VTK Textbook\n        camera.SetPosition(495.722368, -447.474954, -646.308030)\n        camera.SetFocalPoint(137.612066, -40.962376, -195.171023)\n        camera.SetViewUp(-0.323882, -0.816232, 0.478398)\n        camera.SetDistance(704.996499)\n        camera.SetClippingRange(319.797039, 1809.449285)\n    elif select_figure == 'b':\n        # Fig 12-9b in the VTK Textbook\n        camera.SetPosition(478.683494, -420.477744, -643.112038)\n        camera.SetFocalPoint(135.624874, -36.478435, -210.614440)\n        camera.SetViewUp(-0.320495, -0.820148, 0.473962)\n        camera.SetDistance(672.457328)\n        camera.SetClippingRange(307.326771, 1765.990822)\n    elif select_figure == 'c':\n        # Fig 12-9c in the VTK Textbook\n        camera.SetPosition(201.363313, -147.260834, -229.885066)\n        camera.SetFocalPoint(140.626206, -75.857216, -162.352531)\n        camera.SetViewUp(-0.425438, -0.786048, 0.448477)\n        camera.SetDistance(115.534047)\n        camera.SetClippingRange(7.109870, 854.091718)\n    elif select_figure == 'd':\n        # Fig 12-9d in the VTK Textbook\n        camera.SetPosition(115.361727, -484.656410, -6.193827)\n        camera.SetFocalPoint(49.126343, 98.501094, 1.323317)\n        camera.SetViewUp(-0.649127, -0.083475, 0.756086)\n        camera.SetDistance(586.955116)\n        camera.SetClippingRange(360.549218, 866.876230)\n    elif select_figure == 'l':\n        # Orient so that we look down on the anterior surface and\n        #   the superior surface faces the top of the screen.\n        #  Left Superior Anterior\n        labels = 'lsa'\n        transform = vtkTransform()\n        transform.SetMatrix(camera.GetModelTransformMatrix())\n        transform.RotateY(90)\n        transform.RotateZ(90)\n        camera.SetModelTransformMatrix(transform.GetMatrix())\n        ren.ResetCamera()\n    else:\n        # The default.\n        # Orient so that we look down on the posterior surface and\n        #   the superior surface faces the top of the screen.\n        # Right Superior Posterior\n        labels = 'rsp'\n        transform = vtkTransform()\n        transform.SetMatrix(camera.GetModelTransformMatrix())\n        transform.RotateY(-90)\n        transform.RotateZ(90)\n        camera.SetModelTransformMatrix(transform.GetMatrix())\n        ren.ResetCamera()\n\n    cow = vtkCameraOrientationWidget()\n    cow.SetParentRenderer(ren)\n    if no_sliders:\n        # Turn off if you do not want it.\n        cow.On()\n        cow.EnabledOn()\n    else:\n        cow.Off()\n        cow.EnabledOff()\n\n    axes = make_cube_actor(labels, colors)\n    om = vtkOrientationMarkerWidget()\n    om.SetOrientationMarker(axes)\n    # Position upper left in the viewport.\n    # om.SetViewport(0.0, 0.8, 0.2, 1.0)\n    # Position lower left in the viewport.\n    om.SetViewport(0, 0, 0.2, 0.2)\n    om.SetInteractor(iren)\n    om.EnabledOn()\n    om.InteractiveOn()\n\n    ren_win.Render()\n\n    slider_toggle = SliderToggleCallback(sliders)\n    iren.AddObserver('KeyPressEvent', slider_toggle)\n\n    iren.Start()\n\n\ndef parse_json(fn_path):\n    \"\"\"\n    Parse the JSON file selecting the components that we want.\n\n    We also check that the file paths are valid.\n\n    :param fn_path: The path the JSON file.\n    :return: A dictionary of the parameters that we require.\n    \"\"\"\n    with open(fn_path) as data_file:\n        json_data = json.load(data_file)\n    paths_ok = True\n    parameters = dict()\n    for k, v in json_data.items():\n        if k == 'files':\n            if 'root' in v:\n                root = Path(v['root'])\n                if not root.exists():\n                    print(f'Bad path: {root}')\n                    paths_ok = False\n                else:\n                    if 'vtk_files' not in v:\n                        print('Expected vtk files.')\n                        paths_ok = False\n                        continue\n                    for kk in v:\n                        if kk == 'vtk_files':\n                            if len(v[kk]) != 17:\n                                print(f'Expected seventeen file names.')\n                                paths_ok = False\n                            # The stem of the file path becomes the key.\n                            path_map = dict()\n                            for p in list(map(lambda pp: root / pp, v[kk])):\n                                path_map[p.stem] = p\n                                if not p.is_file():\n                                    paths_ok = False\n                                    print(f'Not a file {p}')\n                            if paths_ok:\n                                parameters[kk] = path_map\n            else:\n                paths_ok = False\n                print('Missing the key \"root\" and/or the key \"files\" for the files.')\n        else:\n            if k in ['tissues', 'figures']:\n                for kk, vv in v.items():\n                    parameters[kk] = vv\n    return paths_ok, parameters\n\n\nclass SliceOrder:\n    \"\"\"\n    These transformations permute image and other geometric data to maintain proper\n     orientation regardless of the acquisition order. After applying these transforms with\n    vtkTransformFilter, a view up of 0, -1, 0 will result in the body part\n    facing the viewer.\n    NOTE: some transformations have a -1 scale factor for one of the components.\n          To ensure proper polygon orientation and normal direction, you must\n          apply the vtkPolyDataNormals filter.\n\n    Naming (the nomenclature is medical):\n    si - superior to inferior (top to bottom)\n    is - inferior to superior (bottom to top)\n    ap - anterior to posterior (front to back)\n    pa - posterior to anterior (back to front)\n    lr - left to right\n    rl - right to left\n    \"\"\"\n\n    def __init__(self):\n        self.si_mat = vtkMatrix4x4()\n        self.si_mat.Zero()\n        self.si_mat.SetElement(0, 0, 1)\n        self.si_mat.SetElement(1, 2, 1)\n        self.si_mat.SetElement(2, 1, -1)\n        self.si_mat.SetElement(3, 3, 1)\n\n        self.is_mat = vtkMatrix4x4()\n        self.is_mat.Zero()\n        self.is_mat.SetElement(0, 0, 1)\n        self.is_mat.SetElement(1, 2, -1)\n        self.is_mat.SetElement(2, 1, -1)\n        self.is_mat.SetElement(3, 3, 1)\n\n        self.lr_mat = vtkMatrix4x4()\n        self.lr_mat.Zero()\n        self.lr_mat.SetElement(0, 2, -1)\n        self.lr_mat.SetElement(1, 1, -1)\n        self.lr_mat.SetElement(2, 0, 1)\n        self.lr_mat.SetElement(3, 3, 1)\n\n        self.rl_mat = vtkMatrix4x4()\n        self.rl_mat.Zero()\n        self.rl_mat.SetElement(0, 2, 1)\n        self.rl_mat.SetElement(1, 1, -1)\n        self.rl_mat.SetElement(2, 0, 1)\n        self.rl_mat.SetElement(3, 3, 1)\n\n        \"\"\"\n        The previous transforms assume radiological views of the slices\n         (viewed from the feet).\n        Other modalities such as physical sectioning may view from the head.\n        The following transforms modify the original with a 180\u00b0 rotation about y\n        \"\"\"\n\n        self.hf_mat = vtkMatrix4x4()\n        self.hf_mat.Zero()\n        self.hf_mat.SetElement(0, 0, -1)\n        self.hf_mat.SetElement(1, 1, 1)\n        self.hf_mat.SetElement(2, 2, -1)\n        self.hf_mat.SetElement(3, 3, 1)\n\n        self.transform = dict()\n\n        si_trans = vtkTransform()\n        si_trans.SetMatrix(self.si_mat)\n        self.transform['si'] = si_trans\n\n        is_trans = vtkTransform()\n        is_trans.SetMatrix(self.is_mat)\n        self.transform['is'] = is_trans\n\n        ap_trans = vtkTransform()\n        ap_trans.Scale(1, -1, 1)\n        self.transform['ap'] = ap_trans\n\n        pa_trans = vtkTransform()\n        pa_trans.Scale(1, -1, -1)\n        self.transform['pa'] = pa_trans\n\n        lr_trans = vtkTransform()\n        lr_trans.SetMatrix(self.lr_mat)\n        self.transform['lr'] = lr_trans\n\n        rl_trans = vtkTransform()\n        rl_trans.SetMatrix(self.rl_mat)\n        self.transform['rl'] = rl_trans\n\n        hf_trans = vtkTransform()\n        hf_trans.SetMatrix(self.hf_mat)\n        self.transform['hf'] = hf_trans\n\n        hf_si_trans = vtkTransform()\n        hf_si_trans.SetMatrix(self.hf_mat)\n        hf_si_trans.Concatenate(self.si_mat)\n        self.transform['hfsi'] = hf_si_trans\n\n        hf_is_trans = vtkTransform()\n        hf_is_trans.SetMatrix(self.hf_mat)\n        hf_is_trans.Concatenate(self.is_mat)\n        self.transform['hfis'] = hf_is_trans\n\n        hf_ap_trans = vtkTransform()\n        hf_ap_trans.SetMatrix(self.hf_mat)\n        hf_ap_trans.Scale(1, -1, 1)\n        self.transform['hfap'] = hf_ap_trans\n\n        hf_pa_trans = vtkTransform()\n        hf_pa_trans.SetMatrix(self.hf_mat)\n        hf_pa_trans.Scale(1, -1, -1)\n        self.transform['hfpa'] = hf_pa_trans\n\n        hf_lr_trans = vtkTransform()\n        hf_lr_trans.SetMatrix(self.hf_mat)\n        hf_lr_trans.Concatenate(self.lr_mat)\n        self.transform['hflr'] = hf_lr_trans\n\n        hf_rl_trans = vtkTransform()\n        hf_rl_trans.SetMatrix(self.hf_mat)\n        hf_rl_trans.Concatenate(self.rl_mat)\n        self.transform['hfrl'] = hf_rl_trans\n\n        # Identity\n        self.transform['I'] = vtkTransform()\n\n        # Zero\n        z_trans = vtkTransform()\n        z_trans.Scale(0, 0, 0)\n        self.transform['Z'] = z_trans\n\n    def print_transform(self, order):\n        \"\"\"\n        Print the homogenous matrix corresponding to the slice order.\n        :param order: The slice order.\n        :return:\n        \"\"\"\n        print(order)\n        m = self.transform[order].GetMatrix()\n        for i in range(0, 4):\n            row = list()\n            for j in range(0, 4):\n                row.append(f'{m.GetElement(i, j):6.2g}')\n            print(' '.join(row))\n\n    def print_all_transforms(self):\n        \"\"\"\n        Print all the homogenous matrices corresponding to the slice orders.\n        :return:\n        \"\"\"\n        for k in self.transform.keys():\n            self.print_transform(k)\n\n    def get(self, order):\n        \"\"\"\n        Returns the vtkTransform corresponding to the slice order.\n\n        :param order: The slice order.\n        :return: The vtkTransform to use.\n        \"\"\"\n        if order in self.transform.keys():\n            return self.transform[order]\n        else:\n            s = 'No such transform \"{:s}\" exists.'.format(order)\n            raise Exception(s)\n\n\ndef create_tissue_lut(indices, colors):\n    \"\"\"\n    Create the lookup table for the frog tissues.\n\n    Each table value corresponds the color of one of the frog tissues.\n\n    :param indices: The tissue name and index.\n    :param colors: The tissue name and color.\n    :return: The lookup table.\n    \"\"\"\n    lut = vtkLookupTable()\n    lut.SetNumberOfColors(len(colors))\n    lut.SetTableRange(0, len(colors) - 1)\n    lut.Build()\n\n    nc = vtkNamedColors()\n\n    for k in indices.keys():\n        lut.SetTableValue(indices[k], nc.GetColor4d(colors[k]))\n\n    return lut\n\n\ndef make_axes_actor(scale, xyz_labels):\n    \"\"\"\n    :param scale: Sets the scale and direction of the axes.\n    :param xyz_labels: Labels for the axes.\n    :return: The axes actor.\n    \"\"\"\n    axes = vtkAxesActor()\n    axes.SetScale(scale)\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText(xyz_labels[0])\n    axes.SetYAxisLabelText(xyz_labels[1])\n    axes.SetZAxisLabelText(xyz_labels[2])\n    axes.SetCylinderRadius(0.5 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.025 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.5 * axes.GetSphereRadius())\n    tprop = axes.GetXAxisCaptionActor2D().GetCaptionTextProperty()\n    tprop.ItalicOn()\n    tprop.ShadowOn()\n    tprop.SetFontFamilyToTimes()\n    # Use the same text properties on the other two axes.\n    axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    return axes\n\n\ndef make_annotated_cube_actor(cube_labels, colors):\n    \"\"\"\n    :param cube_labels: The labels for the cube faces.\n    :param colors: Used to determine the cube color.\n    :return: The annotated cube actor.\n    \"\"\"\n    # A cube with labeled faces.\n    cube = vtkAnnotatedCubeActor()\n    cube.SetXPlusFaceText(cube_labels[0])\n    cube.SetXMinusFaceText(cube_labels[1])\n    cube.SetYPlusFaceText(cube_labels[2])\n    cube.SetYMinusFaceText(cube_labels[3])\n    cube.SetZPlusFaceText(cube_labels[4])\n    cube.SetZMinusFaceText(cube_labels[5])\n    cube.SetFaceTextScale(0.5)\n    cube.GetCubeProperty().SetColor(colors.GetColor3d('Gainsboro'))\n\n    cube.GetTextEdgesProperty().SetColor(colors.GetColor3d('LightSlateGray'))\n\n    # Change the vector text colors.\n    cube.GetXPlusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetXMinusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetYPlusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetYMinusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetZPlusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    cube.GetZMinusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    return cube\n\n\ndef make_cube_actor(label_selector, colors):\n    \"\"\"\n    :param label_selector: The selector used to define labels for the axes and cube.\n    :param colors: Used to set the colors of the cube faces.\n    :return: The combined axes and annotated cube prop.\n    \"\"\"\n    if label_selector == 'sal':\n        # xyz_labels = ['S', 'A', 'L']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['S', 'I', 'A', 'P', 'L', 'R']\n        scale = [1.5, 1.5, 1.5]\n    elif label_selector == 'rsp':\n        # xyz_labels = ['R', 'S', 'P']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['R', 'L', 'S', 'I', 'P', 'A']\n        scale = [1.5, 1.5, 1.5]\n    elif label_selector == 'lsa':\n        # xyz_labels = ['R', 'S', 'P']\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['L', 'R', 'S', 'I', 'A', 'P']\n        scale = [1.5, 1.5, 1.5]\n    else:\n        xyz_labels = ['+X', '+Y', '+Z']\n        cube_labels = ['+X', '-X', '+Y', '-Y', '+Z', '-Z']\n        scale = [1.5, 1.5, 1.5]\n\n    # We are combining a vtkAxesActor and a vtkAnnotatedCubeActor\n    # into a vtkPropAssembly\n    cube = make_annotated_cube_actor(cube_labels, colors)\n    axes = make_axes_actor(scale, xyz_labels)\n\n    # Combine orientation markers into one with an assembly.\n    assembly = vtkPropAssembly()\n    assembly.AddPart(axes)\n    assembly.AddPart(cube)\n    return assembly\n\n\nclass SliderProperties:\n    tube_width = 0.004\n    slider_length = 0.015\n    slider_width = 0.008\n    end_cap_length = 0.008\n    end_cap_width = 0.02\n    title_height = 0.02\n    label_height = 0.02\n\n    value_minimum = 0.0\n    value_maximum = 1.0\n    value_initial = 1.0\n\n    p1 = [0.02, 0.1]\n    p2 = [0.18, 0.1]\n\n    title = None\n\n    title_color = 'Black'\n    label_color = 'Black'\n    value_color = 'DarkSlateGray'\n    slider_color = 'BurlyWood'\n    selected_color = 'Lime'\n    bar_color = 'Black'\n    bar_ends_color = 'Indigo'\n\n\ndef make_slider_widget(properties, lut, idx):\n    \"\"\"\n    Make the slider widget.\n\n    :param properties: The slider properties.\n    :param lut: The color lookup table.\n    :param idx: The tissue index.\n    :return: The slider widget.\n    \"\"\"\n    slider = vtkSliderRepresentation2D()\n\n    slider.SetMinimumValue(properties.value_minimum)\n    slider.SetMaximumValue(properties.value_maximum)\n    slider.SetValue(properties.value_initial)\n    slider.SetTitleText(properties.title)\n\n    slider.GetPoint1Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint1Coordinate().SetValue(properties.p1[0], properties.p1[1])\n    slider.GetPoint2Coordinate().SetCoordinateSystemToNormalizedDisplay()\n    slider.GetPoint2Coordinate().SetValue(properties.p2[0], properties.p2[1])\n\n    slider.SetTubeWidth(properties.tube_width)\n    slider.SetSliderLength(properties.slider_length)\n    slider.SetSliderWidth(properties.slider_width)\n    slider.SetEndCapLength(properties.end_cap_length)\n    slider.SetEndCapWidth(properties.end_cap_width)\n    slider.SetTitleHeight(properties.title_height)\n    slider.SetLabelHeight(properties.label_height)\n\n    colors = vtkNamedColors()\n    # Set the colors of the slider components.\n    # Change the color of the bar.\n    slider.GetTubeProperty().SetColor(colors.GetColor3d(properties.bar_color))\n    # Change the color of the ends of the bar.\n    slider.GetCapProperty().SetColor(colors.GetColor3d(properties.bar_ends_color))\n    # Change the color of the knob that slides.\n    slider.GetSliderProperty().SetColor(colors.GetColor3d(properties.slider_color))\n    # Change the color of the knob when the mouse is held on it.\n    slider.GetSelectedProperty().SetColor(colors.GetColor3d(properties.selected_color))\n    # Change the color of the text displaying the value.\n    slider.GetLabelProperty().SetColor(colors.GetColor3d(properties.value_color))\n    #  Use the one color for the labels.\n    # slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.label_color))\n    # Change the color of the text indicating what the slider controls\n    if idx in range(0, 16):\n        slider.GetTitleProperty().SetColor(lut.GetTableValue(idx)[:3])\n        slider.GetTitleProperty().ShadowOff()\n    else:\n        slider.GetTitleProperty().SetColor(colors.GetColor3d(properties.title_color))\n\n    slider_widget = vtkSliderWidget()\n    slider_widget.SetRepresentation(slider)\n\n    return slider_widget\n\n\nclass SliderCallback:\n    def __init__(self, actor_property):\n        self.actor_property = actor_property\n\n    def __call__(self, caller, ev):\n        slider_widget = caller\n        value = slider_widget.GetRepresentation().GetValue()\n        self.actor_property.SetOpacity(value)\n\n\nclass SliderToggleCallback:\n    def __init__(self, sliders):\n        self.sliders = sliders\n\n    def __call__(self, caller, ev):\n        if caller.GetKeyCode() == \"n\":\n            for k, v in self.sliders.items():\n                if v.GetEnabled():\n                    v.Off()\n                else:\n                    v.On()\n\n\nif __name__ == '__main__':\n    import sys\n\n    data_folder, view, omit_sliders, selected_tissues = get_program_parameters(sys.argv)\n    main(data_folder, view, omit_sliders, selected_tissues)\n
        "},{"location":"Python/Visualization/GlyphTable/","title":"GlyphTable","text":"

        vtk-examples/Python/Visualization/GlyphTable

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/GlyphTable/#code","title":"Code","text":"

        GlyphTable.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkElevationFilter,\n    vtkGlyph3D\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkImagingCore import vtkRTAnalyticSource\nfrom vtkmodules.vtkImagingGeneral import vtkImageGradient\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\n# This example uses a \"glyph table\" to change the shape of the 3d glyphs\n# according to a scalar value.\n\n# NOTE: The vtkGlyph3D filter doesn't copy over scalars to the glyphs\n# generated by a table like this for some reason...\n\ndef main():\n    colors = vtkNamedColors()\n\n    # The Wavelet Source is nice for generating a test vtkImageData set\n    rt = vtkRTAnalyticSource()\n    rt.SetWholeExtent(-2, 2, -2, 2, 0, 0)\n\n    # Take the gradient of the only scalar 'RTData' to get a vector attribute\n    grad = vtkImageGradient()\n    grad.SetDimensionality(3)\n    grad.SetInputConnection(rt.GetOutputPort())\n\n    # Elevation just to generate another scalar attribute that varies nicely over the data range\n    elev = vtkElevationFilter()\n    # Elevation values will range from 0 to 1 between the Low and High Points\n    elev.SetLowPoint(-2, -2, 0)\n    elev.SetHighPoint(2, 2, 0)\n    elev.SetInputConnection(grad.GetOutputPort())\n\n    # Create simple PolyData for glyph table\n    cs = vtkCubeSource()\n    cs.SetXLength(0.5)\n    cs.SetYLength(1)\n    cs.SetZLength(2)\n    ss = vtkSphereSource()\n    ss.SetRadius(0.25)\n    cs2 = vtkConeSource()\n    cs2.SetRadius(0.25)\n    cs2.SetHeight(0.5)\n\n    # Set up the glyph filter\n    glyph = vtkGlyph3D()\n    glyph.SetInputConnection(elev.GetOutputPort())\n\n    # Here is where we build the glyph table\n    # that will be indexed into according to the IndexMode\n    glyph.SetSourceConnection(0, cs.GetOutputPort())\n    glyph.SetSourceConnection(1, ss.GetOutputPort())\n    glyph.SetSourceConnection(2, cs2.GetOutputPort())\n\n    glyph.ScalingOn()\n    glyph.SetScaleModeToScaleByScalar()\n    glyph.SetVectorModeToUseVector()\n    glyph.OrientOn()\n    glyph.SetScaleFactor(1)  # Overall scaling factor\n    glyph.SetRange(0, 1)  # Default is (0,1)\n\n    # Tell it to index into the glyph table according to scalars\n    glyph.SetIndexModeToScalar()\n\n    # Tell glyph which attribute arrays to use for what\n    glyph.SetInputArrayToProcess(0, 0, 0, 0, 'Elevation')  # scalars\n    glyph.SetInputArrayToProcess(1, 0, 0, 0, 'RTDataGradient')  # vectors\n\n    coloring_by = 'Elevation'\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph.GetOutputPort())\n    mapper.SetScalarModeToUsePointFieldData()\n    mapper.SetColorModeToMapScalars()\n    mapper.ScalarVisibilityOn()\n\n    # GetRange() call doesn't work because attributes weren't copied to glyphs\n    # as they should have been...\n    # mapper.SetScalarRange(glyph.GetOutputDataObject(0).GetPointData().GetArray(coloring_by).GetRange())\n\n    mapper.SelectColorArray(coloring_by)\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    ren = vtkRenderer()\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d(\"DarkGray\"))\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('GlyphTable')\n\n    iren = vtkRenderWindowInteractor()\n    istyle = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(istyle)\n    iren.SetRenderWindow(renWin)\n    ren.ResetCamera()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/Hanoi/","title":"Hanoi","text":"

        vtk-examples/Python/Visualization/Hanoi

        "},{"location":"Python/Visualization/Hanoi/#description","title":"Description","text":"

        This is three-dimensional implementation of the Towers of Hanoi.

        Here we visualize the operation of the recursive Towers of Hanoi puzzle. In this puzzle there are three pegs. In the initial position there are one or more disks(or pucks) of varying diameter on the pegs. The disks are sorted according to disk diameter, so that the largest disk is on the bottom, followed by the next largest, and so on. The goal of the puzzle is to move the disks from one peg to another, moving the disks one at a time, and never placing a larger disk on top of a smaller disk.

        Here we first set up the scene with the table, pegs and pucks. Then we use a function called Hanoi() to begin the recursion. A second function MovePuck() moves the puck from one peg to another.

        To give a pleasing visual effect we move the disk in small, user-specified increments, flipping the disc over as it moves from one peg to the next. Option -s controls the user-defined increments. The option -c 2 freezes a disk in mid air moving from one peg to another.

        Info

        See Figure 12-20c in Chapter 12 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/Hanoi/#code","title":"Code","text":"

        Hanoi.py

        #!/usr/bin/env python\n\n#  Translated from Hanoi.cxx.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkMinimalStandardRandomSequence\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCylinderSource,\n    vtkPlaneSource\n)\nfrom vtkmodules.vtkIOImage import (\n    vtkBMPWriter,\n    vtkJPEGWriter,\n    vtkPNGWriter,\n    vtkPNMWriter,\n    vtkPostScriptWriter,\n    vtkTIFFWriter\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkWindowToImageFilter\n)\n\n\nclass GV(object):\n    \"\"\"\n    Used to store global variables.\n    \"\"\"\n\n    def __init__(self, numberOfPucks=5, numberOfSteps=5, puckResolution=48, configuration=0):\n        self.numberOfPucks = numberOfPucks\n        self.numberOfSteps = numberOfSteps\n        self.puckResolution = puckResolution\n        self.configuration = configuration\n        self.gotFigure2 = False  # Used to bail out of recursion if configuration == 2.\n        self.L = 1.0  # Puck height.\n        self.H = 1.1 * self.numberOfPucks * self.L  # Peg height.\n        self.R = 0.5  # Peg radius.\n        self.rMin = 4.0 * self.R  # The minimum allowable radius of disks.\n        self.rMax = 12.0 * self.R  # The maximum allowable radius of disks\n        self.D = 1.1 * 1.25 * self.rMax  # The distance between the pegs.\n        self.numberOfMoves = 0\n\n    def update(self, numberOfPucks, numberOfSteps, puckResolution, configuration):\n        self.numberOfPucks = numberOfPucks\n        self.numberOfSteps = numberOfSteps\n        self.puckResolution = puckResolution\n        self.configuration = configuration\n        self.H = 1.1 * self.numberOfPucks * self.L  # Peg height.\n\n\n# Globals\ngv = GV()\nrenWin = vtkRenderWindow()\n\"\"\"\n   For pegStack we use a list of lists where the sublists correspond to the\n      source, target and helper pegs.\n   Python lists can be used as a stack since they have append() (corresponding\n      to push()) and pop().\n\"\"\"\npegStack = [[], [], []]\n\n\ndef hanoi():\n    colors = vtkNamedColors()\n\n    # Create the renderer and render window interactor.\n    ren = vtkRenderer()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(1200, 750)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    ren.SetBackground(colors.GetColor3d('PapayaWhip'))\n\n    camera = vtkCamera()\n    camera.SetPosition(41.0433, 27.9637, 30.442)\n    camera.SetFocalPoint(11.5603, -1.51931, 0.95899)\n    camera.SetClippingRange(18.9599, 91.6042)\n    camera.SetViewUp(0, 1, 0)\n\n    ren.SetActiveCamera(camera)\n\n    # Create geometry: table, pegs, and pucks.\n    pegGeometry = vtkCylinderSource()\n    pegGeometry.SetResolution(8)\n    pegMapper = vtkPolyDataMapper()\n    pegMapper.SetInputConnection(pegGeometry.GetOutputPort())\n\n    puckGeometry = vtkCylinderSource()\n    puckGeometry.SetResolution(gv.puckResolution)\n    puckMapper = vtkPolyDataMapper()\n    puckMapper.SetInputConnection(puckGeometry.GetOutputPort())\n\n    tableGeometry = vtkPlaneSource()\n    tableGeometry.SetResolution(10, 10)\n    tableMapper = vtkPolyDataMapper()\n    tableMapper.SetInputConnection(tableGeometry.GetOutputPort())\n\n    # Create the actors: table top, pegs, and pucks\n    # The table\n    table = vtkActor()\n    ren.AddActor(table)\n    table.SetMapper(tableMapper)\n    # table.GetProperty().SetColor(0.9569, 0.6431, 0.3765)\n    table.GetProperty().SetColor(colors.GetColor3d('SaddleBrown'))\n    table.AddPosition(gv.D, 0, 0)\n    table.SetScale(4 * gv.D, 2 * gv.D, 3 * gv.D)\n    table.RotateX(90)\n\n    # The pegs (using cylinder geometry).  Note that the pegs have to translated\n    # in the  y-direction because the cylinder is centered about the origin.\n    gv.H = 1.1 * gv.numberOfPucks * gv.L\n    peg = list()\n    for i in range(0, 3):\n        peg.append(vtkActor())\n        ren.AddActor(peg[i])\n        peg[i].SetMapper(pegMapper)\n        # peg[i].GetProperty().SetColor(1, 1, 1)\n        peg[i].GetProperty().SetColor(colors.GetColor3d('Lavender'))\n        peg[i].AddPosition(i * gv.D, gv.H / 2, 0)\n        peg[i].SetScale(1, gv.H, 1)\n\n    # The pucks (using cylinder geometry). Always loaded on peg# 0.\n    puck = list()\n    randomSequence = vtkMinimalStandardRandomSequence()\n    randomSequence.SetSeed(1)\n    for i in range(0, gv.numberOfPucks):\n        puck.append(vtkActor())\n        puck[i].SetMapper(puckMapper)\n        color = [0, 0, 0]\n        for j in range(0, 3):\n            color[j] = randomSequence.GetValue()\n            randomSequence.Next()\n        puck[i].GetProperty().SetColor(*color)\n        puck[i].AddPosition(0, i * gv.L + gv.L / 2, 0)\n        scale = gv.rMax - i * (gv.rMax - gv.rMin) / (gv.numberOfPucks - 1)\n        puck[i].SetScale(scale, 1, scale)\n        ren.AddActor(puck[i])\n        pegStack[0].append(puck[i])\n\n    # Reset the camera to view all actors.\n    renWin.Render()\n    renWin.SetWindowName('Hanoi')\n\n    if gv.configuration == 3:\n        WriteImage('hanoi0.png', renWin, rgba=False)\n\n    if gv.configuration != 1:\n        # Begin recursion.\n        Hanoi(gv.numberOfPucks - 1, 0, 2, 1)\n        Hanoi(1, 0, 1, 2)\n        if not gv.gotFigure2:\n            Hanoi(gv.numberOfPucks - 1, 2, 1, 0)\n\n            renWin.Render()\n            if gv.configuration == 3:\n                WriteImage('hanoi2.png', renWin, rgba=False)\n        # Report output.\n        s = 'Number of moves: {:d}\\nPolygons rendered each frame: {:d}\\nTotal number of frames: {:d}'\n        print(s.format(gv.numberOfMoves, 3 * 8 + 1 + gv.numberOfPucks * (2 + gv.puckResolution),\n                       gv.numberOfMoves * 3 * gv.numberOfSteps))\n\n    iren.AddObserver('EndInteractionEvent', OrientationObserver(ren.GetActiveCamera()))\n\n    # Render the image.\n    iren.Initialize()\n    iren.Start()\n\n\ndef main():\n    maxPucks = 20\n    if not verify_parameters(maxPucks):\n        return\n    hanoi()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Towers of Hanoi. .'\n    epilogue = '''\nWhere:  -p specifies the number of pucks.\n        -s specifies the number of steps.\n        -r specifies the puck resolution.\n        -c specifies configuration.\n            0 final configuration.\n            1 initial configuration.\n            2 intermediate configuration.\n            3 final configuration and save images\nDefaults:  -p 5 -s 5 -r 48 -c 0\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('--numberOfPucks', '-p', default=5, type=int, nargs='?', help='The number of pucks.')\n    parser.add_argument('--numberOfSteps', '-s', default=5, type=int, nargs='?', help='The number of steps.')\n    parser.add_argument('--puckResolution', '-r', default=48, type=int, nargs='?', help='The puck resolution.')\n    parser.add_argument('--configuration', '-c', default=0, type=int, nargs='?', help='The configuration.')\n    args = parser.parse_args()\n    return args.numberOfPucks, args.numberOfSteps, args.puckResolution, args.configuration\n\n\ndef verify_parameters(maxPucks):\n    numberOfPucks, numberOfSteps, puckResolution, configuration = get_program_parameters()\n    numberOfPucks = abs(numberOfPucks)\n    numberOfSteps = abs(numberOfSteps)\n    puckResolution = abs(puckResolution)\n    configuration = abs(configuration)\n    check = True\n    if numberOfPucks < 2:\n        print('Please use more pucks!')\n        check = False\n    if numberOfPucks > maxPucks:\n        print('Too many pucks specified! Maximum is', maxPucks)\n        check = False\n    if numberOfSteps < 3:\n        print('Please use more steps!')\n        check = False\n    if configuration > 3:\n        print('0 >= configuration <= 3')\n        check = False\n    if check:\n        gv.update(numberOfPucks, numberOfSteps, puckResolution, configuration)\n    return check\n\n\ndef MovePuck(peg1, peg2):\n    \"\"\"\n    This routine is responsible for moving pucks from peg1 to peg2.\n    :param peg1: Initial peg.\n    :param peg2: Final peg.\n    :return:\n    \"\"\"\n    gv.numberOfMoves += 1\n\n    # Get the actor to move\n    movingActor = pegStack[peg1].pop()\n\n    # Get the distance to move up.\n    distance = (gv.H - (gv.L * (len(pegStack[peg1]) - 1)) + gv.rMax) / gv.numberOfSteps\n\n    for i in range(0, gv.numberOfSteps):\n        movingActor.AddPosition(0, distance, 0)\n        renWin.Render()\n\n    # Get the distance to move across\n    distance = (peg2 - peg1) * gv.D / gv.numberOfSteps\n    flipAngle = 180.0 / gv.numberOfSteps\n    for i in range(0, gv.numberOfSteps):\n        movingActor.AddPosition(distance, 0, 0)\n        movingActor.RotateX(flipAngle)\n        renWin.Render()\n        if gv.numberOfMoves == 13 and i == 3:  # for making book image\n            if gv.configuration == 3 or gv.configuration == 2:\n                cam = renWin.GetRenderers().GetFirstRenderer().GetActiveCamera()\n                camera1 = vtkCamera()\n                camera1.SetPosition(54.7263, 41.6467, 44.125)\n                camera1.SetFocalPoint(11.5603, -1.51931, 0.95899)\n                camera1.SetClippingRange(42.4226, 115.659)\n                camera1.SetViewUp(0, 1, 0)\n                renWin.GetRenderers().GetFirstRenderer().SetActiveCamera(camera1)\n                renWin.Render()\n                if gv.configuration == 3:\n                    WriteImage('hanoi1.png', renWin, rgba=False)\n                if gv.configuration == 2:\n                    gv.gotFigure2 = True\n                    break\n                renWin.GetRenderers().GetFirstRenderer().SetActiveCamera(cam)\n                renWin.Render()\n    if gv.gotFigure2:\n        pegStack[peg2].append(movingActor)\n        return\n\n    # Get the distance to move down.\n    distance = ((gv.L * (len(pegStack[peg2]) - 1)) - gv.H - gv.rMax) / gv.numberOfSteps\n\n    for i in range(0, gv.numberOfSteps):\n        movingActor.AddPosition(0, distance, 0)\n        renWin.Render()\n    pegStack[peg2].append(movingActor)\n\n\ndef Hanoi(n, peg1, peg2, peg3):\n    \"\"\"\n    Tower of Hanoi.\n    :param n: Number of disks.\n    :param peg1: Source\n    :param peg2: Target\n    :param peg3: Helper\n    :return:\n    \"\"\"\n    # If gotFigure2 is true, we break out of the recursion.\n    if gv.gotFigure2:\n        return\n    if n != 1:\n        Hanoi(n - 1, peg1, peg3, peg2)\n        if gv.gotFigure2:\n            return\n        Hanoi(1, peg1, peg2, peg3)\n        Hanoi(n - 1, peg3, peg2, peg1)\n    else:\n        MovePuck(peg1, peg2)\n\n\nclass OrientationObserver(object):\n    def __init__(self, cam):\n        self.cam = cam\n\n    def __call__(self, caller, ev):\n        # Just do this to demonstrate who called callback and the event that triggered it.\n        print(caller.GetClassName(), 'Event Id:', ev)\n        # Now print the camera orientation.\n        CameraOrientation(self.cam)\n\n\ndef CameraOrientation(cam):\n    fmt1 = '{:>15s}'\n    fmt2 = '{:9.6g}'\n    print(fmt1.format('Position:'), ', '.join(map(fmt2.format, cam.GetPosition())))\n    print(fmt1.format('Focal point:'), ', '.join(map(fmt2.format, cam.GetFocalPoint())))\n    print(fmt1.format('Clipping range:'), ', '.join(map(fmt2.format, cam.GetClippingRange())))\n    print(fmt1.format('View up:'), ', '.join(map(fmt2.format, cam.GetViewUp())))\n    print(fmt1.format('Distance:'), fmt2.format(cam.GetDistance()))\n\n\ndef WriteImage(fileName, renWin1, rgba=True):\n    \"\"\"\n    Write the render window view to an image file.\n\n    Image types supported are:\n     BMP, JPEG, PNM, PNG, PostScript, TIFF.\n    The default parameters are used for all writers, change as needed.\n\n    :param fileName: The file name, if no extension then PNG is assumed.\n    :param renWin1: The render window.\n    :param rgba: Used to set the buffer type.\n    :return:\n    \"\"\"\n\n    import os\n\n    if fileName:\n        # Select the writer to use.\n        path, ext = os.path.splitext(fileName)\n        ext = ext.lower()\n        if not ext:\n            ext = '.png'\n            fileName = fileName + ext\n        if ext == '.bmp':\n            writer = vtkBMPWriter()\n        elif ext == '.jpg':\n            writer = vtkJPEGWriter()\n        elif ext == '.pnm':\n            writer = vtkPNMWriter()\n        elif ext == '.ps':\n            if rgba:\n                rgba = False\n            writer = vtkPostScriptWriter()\n        elif ext == '.tiff':\n            writer = vtkTIFFWriter()\n        else:\n            writer = vtkPNGWriter()\n\n        windowto_image_filter = vtkWindowToImageFilter()\n        windowto_image_filter.SetInput(renWin1)\n        windowto_image_filter.SetScale(1)  # image quality\n        if rgba:\n            windowto_image_filter.SetInputBufferTypeToRGBA()\n        else:\n            windowto_image_filter.SetInputBufferTypeToRGB()\n            # Read from the front buffer.\n            windowto_image_filter.ReadFrontBufferOff()\n            windowto_image_filter.Update()\n\n        writer.SetFileName(fileName)\n        writer.SetInputConnection(windowto_image_filter.GetOutputPort())\n        writer.Write()\n    else:\n        raise RuntimeError('Need a filename.')\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/HanoiInitial/","title":"HanoiInitial","text":"

        vtk-examples/Python/Visualization/HanoiInitial

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/HanoiInitial/#code","title":"Code","text":"

        HanoiInitial.py

        #!/usr/bin/env python\n\n\"\"\"\nHanoiInitial\n\nNote: Make sure Hanoi.py is in the same directory as this program.\n\"\"\"\n\nimport Hanoi\n\n\ndef main():\n    Hanoi.gv.configuration = 1\n    Hanoi.hanoi()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/HanoiIntermediate/","title":"HanoiIntermediate","text":"

        vtk-examples/Python/Visualization/HanoiIntermediate

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/HanoiIntermediate/#code","title":"Code","text":"

        HanoiIntermediate.py

        #!/usr/bin/env python\n\n\"\"\"\nHanoiIntermediate\n\nNote: Make sure Hanoi.py is in the same directory as this program.\n\"\"\"\n\nimport Hanoi\n\n\ndef main():\n    Hanoi.gv.configuration = 2\n    Hanoi.hanoi()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/HardwareSelector/","title":"HardwareSelector","text":"

        vtk-examples/Python/Visualization/HardwareSelector

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/HardwareSelector/#code","title":"Code","text":"

        HardwareSelector.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkDataObject\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkHardwareSelector,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n# Callback for when selection is changed\n\n# This is global - fix later.\nren1 = vtkRenderer()\n\n\ndef selectionCallback(caller, eventId):\n    hsel = vtkHardwareSelector()\n    hsel.SetFieldAssociation(vtkDataObject.FIELD_ASSOCIATION_CELLS)\n    hsel.SetRenderer(ren1)\n\n    x, y = caller.GetRenderWindow().GetSize()\n\n    # Create a small area around clicked point for selector area\n    hsel.SetArea(0, 0, x, y)\n    res = hsel.Select()\n\n    numNodes = res.GetNumberOfNodes()\n    if (numNodes < 1):\n        print(\"No visible cells\")\n    else:\n        sel_node = res.GetNode(0)\n        print('Visible cell IDs: ', VN.vtk_to_numpy(sel_node.GetSelectionList()).tolist())\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphere = vtkSphereSource()\n    sphere.SetCenter(0, 0, 0)\n    sphere.SetRadius(5.0)\n\n    sphereMapper = vtkPolyDataMapper()\n    sphereMapper.SetInputConnection(sphere.GetOutputPort())\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphereMapper)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d('Bisque'))\n\n    ren1.AddActor(sphereActor)\n    ren1.GetActiveCamera().ParallelProjectionOn()\n    ren1.SetBackground(colors.GetColor3d('Navy'))\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('HardwareSelector')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    iren.AddObserver(\"UserEvent\", selectionCallback)\n\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n    renWin.GetInteractor().SetInteractorStyle(style)\n\n    ren1.ResetCamera()\n    renWin.Render()\n\n    iren.Initialize()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/Hawaii/","title":"Hawaii","text":"

        vtk-examples/Python/Visualization/Hawaii

        "},{"location":"Python/Visualization/Hawaii/#description","title":"Description","text":"

        Visualize elevations by coloring the scalar values with a lookup table.

        This is a translation of the original hawaii.tcl with a few additional enhancements. The image is centered on Honolulu. Diamond Head is the crater lower left. Punchbowl is the crater in the centre.

        Info

        See Figure 6-12 in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/Hawaii/#code","title":"Code","text":"

        Hawaii.py

        #!/usr/bin/env python\n\n#  Translated from hawaii.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    file_name, color_scheme = get_program_parameters()\n\n    color_scheme = abs(color_scheme)\n    if color_scheme > 2:\n        color_scheme = 0;\n\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor(\"BkgColor\", [26, 51, 102, 255])\n\n    # Read a vtk file\n    #\n    hawaii = vtkPolyDataReader()\n    hawaii.SetFileName(file_name)\n    hawaii.Update()\n    bounds = [0.0] * 6\n    hawaii.GetOutput().GetBounds(bounds)\n\n    elevation = vtkElevationFilter()\n    elevation.SetInputConnection(hawaii.GetOutputPort())\n    elevation.SetLowPoint(0, 0, 0)\n    elevation.SetHighPoint(0, 0, 1000)\n    elevation.SetScalarRange(0, 1000)\n\n    lut = MakeLUT(color_scheme)\n\n    hawaiiMapper = vtkDataSetMapper()\n    hawaiiMapper.SetInputConnection(elevation.GetOutputPort())\n    hawaiiMapper.SetScalarRange(0, 1000)\n    hawaiiMapper.ScalarVisibilityOn()\n    hawaiiMapper.SetLookupTable(lut)\n\n    hawaiiActor = vtkActor()\n    hawaiiActor.SetMapper(hawaiiMapper)\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren.AddActor(hawaiiActor)\n    # Match the window shape to the object.\n    # renWin.SetSize(500, int(500 * bounds[1] / bounds[3]))\n    renWin.SetSize(500, 500)\n    renWin.SetWindowName('Hawaii')\n\n    iren.Initialize()\n\n    # Render the image.\n    # Centered on Honolulu.\n    # Diamond Head is the crater lower left.\n    # Punchbowl is the crater in the centre.\n    renWin.Render()\n    ren.SetBackground(colors.GetColor3d(\"BkgColor\"))\n    ren.GetActiveCamera().Zoom(1.5)\n    ren.GetActiveCamera().Roll(-90)\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce figure 6\u201312 from the VTK Textbook.'\n    epilogue = '''\n        Produce figure 6\u201312 from the VTK Textbook.\n        It is a translation of the original hawaii.tcl with a few additional enhancements.\n        The image is centered on Honolulu, O'ahu.\n        Diamond Head is the crater lower left. Punchbowl is the crater in the centre.\n\n        The color_scheme option allows you to select a series of colour schemes.\n        0: The default, a lookup using a \"Brewer\" palette.\n        1: The original: A lookup table of 256 colours ranging from deep blue (water) to yellow-white (mountain top).\n        2: A lookup table with a preset number of colours.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='honolulu.vtk')\n    parser.add_argument('color_scheme', default=0, type=int, nargs='?', help='The particular color scheme to use.')\n    args = parser.parse_args()\n    return args.filename, args.color_scheme\n\n\ndef MakeLUT(color_scheme=0):\n    \"\"\"\n    Make a lookup table.\n    :param color_scheme: Select the type of lookup table.\n    :return: The lookup table.\n    \"\"\"\n    colors = vtkNamedColors()\n    if color_scheme == 1:\n        # A lookup table of 256 colours ranging from\n        #  deep blue (water) to yellow-white (mountain top)\n        #  is used to color map this figure.\n        lut = vtkLookupTable()\n        lut.SetHueRange(0.7, 0)\n        lut.SetSaturationRange(1.0, 0)\n        lut.SetValueRange(0.5, 1.0)\n    elif color_scheme == 2:\n        # Make the lookup table with a preset number of colours.\n        colorSeries = vtkColorSeries()\n        colorSeries.SetNumberOfColors(8)\n        colorSeries.SetColorSchemeName('Hawaii')\n        colorSeries.SetColor(0, colors.GetColor3ub(\"turquoise_blue\"))\n        colorSeries.SetColor(1, colors.GetColor3ub(\"sea_green_medium\"))\n        colorSeries.SetColor(2, colors.GetColor3ub(\"sap_green\"))\n        colorSeries.SetColor(3, colors.GetColor3ub(\"green_dark\"))\n        colorSeries.SetColor(4, colors.GetColor3ub(\"tan\"))\n        colorSeries.SetColor(5, colors.GetColor3ub(\"beige\"))\n        colorSeries.SetColor(6, colors.GetColor3ub(\"light_beige\"))\n        colorSeries.SetColor(7, colors.GetColor3ub(\"bisque\"))\n        lut = vtkLookupTable()\n        colorSeries.BuildLookupTable(lut, colorSeries.ORDINAL)\n        lut.SetNanColor(1, 0, 0, 1)\n    else:\n        # Make the lookup using a Brewer palette.\n        colorSeries = vtkColorSeries()\n        colorSeries.SetNumberOfColors(8)\n        colorSeriesEnum = colorSeries.BREWER_DIVERGING_BROWN_BLUE_GREEN_8\n        colorSeries.SetColorScheme(colorSeriesEnum)\n        lut = vtkLookupTable()\n        colorSeries.BuildLookupTable(lut, colorSeries.ORDINAL)\n        lut.SetNanColor(1, 0, 0, 1)\n    return lut\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/IsosurfaceSampling/","title":"IsosurfaceSampling","text":"

        vtk-examples/Python/Visualization/IsosurfaceSampling

        "},{"location":"Python/Visualization/IsosurfaceSampling/#description","title":"Description","text":"

        This example illustrates how to create an isosurface and create point data on that isosurface that is sampled from another dataset. This example creates an isosurface of a sphere and then uses the vtkProbeFilter to compute point data from a sampled cylinder.

        Note

        All point data is sampled, even the normals. This example restores the original isosurface normals after the probe. The example has one optional command line argument that controls the sample resolution of the sphere and cylinder. The default is 50.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/IsosurfaceSampling/#code","title":"Code","text":"

        IsosurfaceSampling.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCylinder,\n    vtkSphere\n)\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes,\n    vtkProbeFilter\n)\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    colors = vtkNamedColors()\n\n    sample_resolution = get_program_parameters()\n\n    # Create a sampled sphere\n    implicit_sphere = vtkSphere()\n    radius = 1.0\n    implicit_sphere.SetRadius(radius)\n\n    sampled_sphere = vtkSampleFunction()\n    sampled_sphere.SetSampleDimensions(sample_resolution, sample_resolution, sample_resolution)\n    x_min = -radius * 2.0\n    x_max = radius * 2.0\n    sampled_sphere.SetModelBounds(x_min, x_max, x_min, x_max, x_min, x_max)\n    sampled_sphere.SetImplicitFunction(implicit_sphere)\n\n    if use_flying_edges:\n        try:\n            iso_sphere = vtkFlyingEdges3D()\n        except AttributeError:\n            iso_sphere = vtkMarchingCubes()\n    else:\n        iso_sphere = vtkMarchingCubes()\n    iso_sphere.SetValue(0, 1.0)\n    iso_sphere.SetInputConnection(sampled_sphere.GetOutputPort())\n\n    # Create a sampled cylinder\n    implicit_cylinder = vtkCylinder()\n    implicit_cylinder.SetRadius(radius / 2.0)\n    sampled_cylinder = vtkSampleFunction()\n    sampled_cylinder.SetSampleDimensions(sample_resolution, sample_resolution, sample_resolution)\n    sampled_cylinder.SetModelBounds(x_min, x_max, x_min, x_max, x_min, x_max)\n    sampled_cylinder.SetImplicitFunction(implicit_cylinder)\n\n    # Probe cylinder with the sphere isosurface\n    probe_cylinder = vtkProbeFilter()\n    probe_cylinder.SetInputConnection(0, iso_sphere.GetOutputPort())\n    probe_cylinder.SetInputConnection(1, sampled_cylinder.GetOutputPort())\n    probe_cylinder.Update()\n\n    # Restore the original normals\n    probe_cylinder.GetOutput().GetPointData().SetNormals(\n        iso_sphere.GetOutput().GetPointData().GetNormals())\n\n    print('Scalar range: {:6.3f}, {:6.3f}'.format(probe_cylinder.GetOutput().GetScalarRange()[0],\n                                                  probe_cylinder.GetOutput().GetScalarRange()[1]))\n\n    # Create a mapper and actor\n    map_sphere = vtkPolyDataMapper()\n    map_sphere.SetInputConnection(probe_cylinder.GetOutputPort())\n    map_sphere.SetScalarRange(probe_cylinder.GetOutput().GetScalarRange())\n\n    sphere = vtkActor()\n    sphere.SetMapper(map_sphere)\n\n    # Visualize\n    renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetWindowName('IsosurfaceSampling')\n\n    render_window_interactor = vtkRenderWindowInteractor()\n    render_window_interactor.SetRenderWindow(render_window)\n\n    renderer.AddActor(sphere)\n    renderer.SetBackground(colors.GetColor3d('AliceBlue'))\n\n    render_window.Render()\n    render_window_interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Create an isosurface and create point data on that isosurface that is sampled from another dataset.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-r', '--resolution', type=int, default=50,\n                        help='The sample resolution of the sphere and cylinder')\n    args = parser.parse_args()\n    return args.resolution\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/Kitchen/","title":"Kitchen","text":"

        vtk-examples/Python/Visualization/Kitchen

        "},{"location":"Python/Visualization/Kitchen/#description","title":"Description","text":"

        The example shows forty streamlines in a small kitchen. The room has two windows, a door(with air leakage), and a cooking area with a hot stove. The air leakage and temperature variation combine to produce air convection currents throughout the kitchen. The starting positions of the streamlines were defined by creating a rake, or curve (and its associated points). Here the rake was a straight line modeled with a vtkLineSource. These streamlines clearly show features of the flow field. By releasing many streamlines simultaneously we obtain even more information, as the eye tends to assemble nearby streamlines into a \u201cglobal\u201d understanding of flow field features.

        Info

        See Figure 6-18 in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/Kitchen/#code","title":"Code","text":"

        Kitchen.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkIOLegacy import vtkStructuredGridReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Set the furniture colors.\n    colors.SetColor('Furniture', [204, 204, 153, 255])\n\n    scalarRange = [0.0, 0.0]\n    maxTime = 0\n\n    aren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(aren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # Read the data.\n    #\n    reader = vtkStructuredGridReader()\n    reader.SetFileName(fileName)\n    reader.Update()  # Force a read to occur.\n    reader.GetOutput().GetLength()\n\n    if reader.GetOutput().GetPointData().GetScalars():\n        reader.GetOutput().GetPointData().GetScalars().GetRange(scalarRange)\n\n    if reader.GetOutput().GetPointData().GetVectors():\n        maxVelocity = reader.GetOutput().GetPointData().GetVectors().GetMaxNorm()\n        maxTime = 4.0 * reader.GetOutput().GetLength() / maxVelocity\n\n    #\n    # Outline around the data.\n    #\n    outlineF = vtkStructuredGridOutlineFilter()\n    outlineF.SetInputConnection(reader.GetOutputPort())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outlineF.GetOutputPort())\n    outline = vtkActor()\n    outline.SetMapper(outlineMapper)\n    outline.GetProperty().SetColor(colors.GetColor3d('LampBlack'))\n\n    #\n    # Set up shaded surfaces (i.e., supporting geometry).\n    #\n    doorGeom = vtkStructuredGridGeometryFilter()\n    doorGeom.SetInputConnection(reader.GetOutputPort())\n    doorGeom.SetExtent(27, 27, 14, 18, 0, 11)\n    mapDoor = vtkPolyDataMapper()\n    mapDoor.SetInputConnection(doorGeom.GetOutputPort())\n    mapDoor.ScalarVisibilityOff()\n    door = vtkActor()\n    door.SetMapper(mapDoor)\n    door.GetProperty().SetColor(colors.GetColor3d('Burlywood'))\n\n    window1Geom = vtkStructuredGridGeometryFilter()\n    window1Geom.SetInputConnection(reader.GetOutputPort())\n    window1Geom.SetExtent(0, 0, 9, 18, 6, 12)\n    mapWindow1 = vtkPolyDataMapper()\n    mapWindow1.SetInputConnection(window1Geom.GetOutputPort())\n    mapWindow1.ScalarVisibilityOff()\n    window1 = vtkActor()\n    window1.SetMapper(mapWindow1)\n    window1.GetProperty().SetColor(colors.GetColor3d('SkyBlue'))\n    window1.GetProperty().SetOpacity(.6)\n\n    window2Geom = vtkStructuredGridGeometryFilter()\n    window2Geom.SetInputConnection(reader.GetOutputPort())\n    window2Geom.SetExtent(5, 12, 23, 23, 6, 12)\n    mapWindow2 = vtkPolyDataMapper()\n    mapWindow2.SetInputConnection(window2Geom.GetOutputPort())\n    mapWindow2.ScalarVisibilityOff()\n    window2 = vtkActor()\n    window2.SetMapper(mapWindow2)\n    window2.GetProperty().SetColor(colors.GetColor3d('SkyBlue'))\n    window2.GetProperty().SetOpacity(.6)\n\n    klower1Geom = vtkStructuredGridGeometryFilter()\n    klower1Geom.SetInputConnection(reader.GetOutputPort())\n    klower1Geom.SetExtent(17, 17, 0, 11, 0, 6)\n    mapKlower1 = vtkPolyDataMapper()\n    mapKlower1.SetInputConnection(klower1Geom.GetOutputPort())\n    mapKlower1.ScalarVisibilityOff()\n    klower1 = vtkActor()\n    klower1.SetMapper(mapKlower1)\n    klower1.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower2Geom = vtkStructuredGridGeometryFilter()\n    klower2Geom.SetInputConnection(reader.GetOutputPort())\n    klower2Geom.SetExtent(19, 19, 0, 11, 0, 6)\n    mapKlower2 = vtkPolyDataMapper()\n    mapKlower2.SetInputConnection(klower2Geom.GetOutputPort())\n    mapKlower2.ScalarVisibilityOff()\n    klower2 = vtkActor()\n    klower2.SetMapper(mapKlower2)\n    klower2.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower3Geom = vtkStructuredGridGeometryFilter()\n    klower3Geom.SetInputConnection(reader.GetOutputPort())\n    klower3Geom.SetExtent(17, 19, 0, 0, 0, 6)\n    mapKlower3 = vtkPolyDataMapper()\n    mapKlower3.SetInputConnection(klower3Geom.GetOutputPort())\n    mapKlower3.ScalarVisibilityOff()\n    klower3 = vtkActor()\n    klower3.SetMapper(mapKlower3)\n    klower3.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower4Geom = vtkStructuredGridGeometryFilter()\n    klower4Geom.SetInputConnection(reader.GetOutputPort())\n    klower4Geom.SetExtent(17, 19, 11, 11, 0, 6)\n    mapKlower4 = vtkPolyDataMapper()\n    mapKlower4.SetInputConnection(klower4Geom.GetOutputPort())\n    mapKlower4.ScalarVisibilityOff()\n    klower4 = vtkActor()\n    klower4.SetMapper(mapKlower4)\n    klower4.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower5Geom = vtkStructuredGridGeometryFilter()\n    klower5Geom.SetInputConnection(reader.GetOutputPort())\n    klower5Geom.SetExtent(17, 19, 0, 11, 0, 0)\n    mapKlower5 = vtkPolyDataMapper()\n    mapKlower5.SetInputConnection(klower5Geom.GetOutputPort())\n    mapKlower5.ScalarVisibilityOff()\n    klower5 = vtkActor()\n    klower5.SetMapper(mapKlower5)\n    klower5.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower6Geom = vtkStructuredGridGeometryFilter()\n    klower6Geom.SetInputConnection(reader.GetOutputPort())\n    klower6Geom.SetExtent(17, 19, 0, 7, 6, 6)\n    mapKlower6 = vtkPolyDataMapper()\n    mapKlower6.SetInputConnection(klower6Geom.GetOutputPort())\n    mapKlower6.ScalarVisibilityOff()\n    klower6 = vtkActor()\n    klower6.SetMapper(mapKlower6)\n    klower6.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    klower7Geom = vtkStructuredGridGeometryFilter()\n    klower7Geom.SetInputConnection(reader.GetOutputPort())\n    klower7Geom.SetExtent(17, 19, 9, 11, 6, 6)\n    mapKlower7 = vtkPolyDataMapper()\n    mapKlower7.SetInputConnection(klower7Geom.GetOutputPort())\n    mapKlower7.ScalarVisibilityOff()\n    klower7 = vtkActor()\n    klower7.SetMapper(mapKlower7)\n    klower7.GetProperty().SetColor(colors.GetColor3d('EggShell'))\n\n    hood1Geom = vtkStructuredGridGeometryFilter()\n    hood1Geom.SetInputConnection(reader.GetOutputPort())\n    hood1Geom.SetExtent(17, 17, 0, 11, 11, 16)\n    mapHood1 = vtkPolyDataMapper()\n    mapHood1.SetInputConnection(hood1Geom.GetOutputPort())\n    mapHood1.ScalarVisibilityOff()\n    hood1 = vtkActor()\n    hood1.SetMapper(mapHood1)\n    hood1.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    hood2Geom = vtkStructuredGridGeometryFilter()\n    hood2Geom.SetInputConnection(reader.GetOutputPort())\n    hood2Geom.SetExtent(19, 19, 0, 11, 11, 16)\n    mapHood2 = vtkPolyDataMapper()\n    mapHood2.SetInputConnection(hood2Geom.GetOutputPort())\n    mapHood2.ScalarVisibilityOff()\n    hood2 = vtkActor()\n    hood2.SetMapper(mapHood2)\n    hood2.GetProperty().SetColor(colors.GetColor3d('Furniture'))\n\n    hood3Geom = vtkStructuredGridGeometryFilter()\n    hood3Geom.SetInputConnection(reader.GetOutputPort())\n    hood3Geom.SetExtent(17, 19, 0, 0, 11, 16)\n    mapHood3 = vtkPolyDataMapper()\n    mapHood3.SetInputConnection(hood3Geom.GetOutputPort())\n    mapHood3.ScalarVisibilityOff()\n    hood3 = vtkActor()\n    hood3.SetMapper(mapHood3)\n    hood3.GetProperty().SetColor(colors.GetColor3d('Furniture'))\n\n    hood4Geom = vtkStructuredGridGeometryFilter()\n    hood4Geom.SetInputConnection(reader.GetOutputPort())\n    hood4Geom.SetExtent(17, 19, 11, 11, 11, 16)\n    mapHood4 = vtkPolyDataMapper()\n    mapHood4.SetInputConnection(hood4Geom.GetOutputPort())\n    mapHood4.ScalarVisibilityOff()\n    hood4 = vtkActor()\n    hood4.SetMapper(mapHood4)\n    hood4.GetProperty().SetColor(colors.GetColor3d('Furniture'))\n\n    hood6Geom = vtkStructuredGridGeometryFilter()\n    hood6Geom.SetInputConnection(reader.GetOutputPort())\n    hood6Geom.SetExtent(17, 19, 0, 11, 16, 16)\n    mapHood6 = vtkPolyDataMapper()\n    mapHood6.SetInputConnection(hood6Geom.GetOutputPort())\n    mapHood6.ScalarVisibilityOff()\n    hood6 = vtkActor()\n    hood6.SetMapper(mapHood6)\n    hood6.GetProperty().SetColor(colors.GetColor3d('Furniture'))\n\n    cookingPlateGeom = vtkStructuredGridGeometryFilter()\n    cookingPlateGeom.SetInputConnection(reader.GetOutputPort())\n    cookingPlateGeom.SetExtent(17, 19, 7, 9, 6, 6)\n    mapCookingPlate = vtkPolyDataMapper()\n    mapCookingPlate.SetInputConnection(cookingPlateGeom.GetOutputPort())\n    mapCookingPlate.ScalarVisibilityOff()\n    cookingPlate = vtkActor()\n    cookingPlate.SetMapper(mapCookingPlate)\n    cookingPlate.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n    filterGeom = vtkStructuredGridGeometryFilter()\n    filterGeom.SetInputConnection(reader.GetOutputPort())\n    filterGeom.SetExtent(17, 19, 7, 9, 11, 11)\n    mapFilter = vtkPolyDataMapper()\n    mapFilter.SetInputConnection(filterGeom.GetOutputPort())\n    mapFilter.ScalarVisibilityOff()\n    sgfilter = vtkActor()\n    sgfilter.SetMapper(mapFilter)\n    sgfilter.GetProperty().SetColor(colors.GetColor3d('Furniture'))\n    #\n    # regular streamlines\n    #\n    line = vtkLineSource()\n    line.SetResolution(39)\n    line.SetPoint1(0.08, 2.50, 0.71)\n    line.SetPoint2(0.08, 4.50, 0.71)\n    rakeMapper = vtkPolyDataMapper()\n    rakeMapper.SetInputConnection(line.GetOutputPort())\n    rake = vtkActor()\n    rake.SetMapper(rakeMapper)\n\n    streamers = vtkStreamTracer()\n    # streamers.DebugOn()\n    streamers.SetInputConnection(reader.GetOutputPort())\n    streamers.SetSourceConnection(line.GetOutputPort())\n    streamers.SetMaximumPropagation(maxTime)\n    streamers.SetInitialIntegrationStep(.5)\n    streamers.SetMinimumIntegrationStep(.1)\n    streamers.SetIntegratorType(2)\n    streamers.Update()\n\n    streamersMapper = vtkPolyDataMapper()\n    streamersMapper.SetInputConnection(streamers.GetOutputPort())\n    streamersMapper.SetScalarRange(scalarRange)\n\n    lines = vtkActor()\n    lines.SetMapper(streamersMapper)\n    lines.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    aren.TwoSidedLightingOn()\n\n    aren.AddActor(outline)\n    aren.AddActor(door)\n    aren.AddActor(window1)\n    aren.AddActor(window2)\n    aren.AddActor(klower1)\n    aren.AddActor(klower2)\n    aren.AddActor(klower3)\n    aren.AddActor(klower4)\n    aren.AddActor(klower5)\n    aren.AddActor(klower6)\n    aren.AddActor(klower7)\n    aren.AddActor(hood1)\n    aren.AddActor(hood2)\n    aren.AddActor(hood3)\n    aren.AddActor(hood4)\n    aren.AddActor(hood6)\n    aren.AddActor(cookingPlate)\n    aren.AddActor(sgfilter)\n    aren.AddActor(lines)\n    aren.AddActor(rake)\n\n    aren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    aCamera = vtkCamera()\n    aren.SetActiveCamera(aCamera)\n    aren.ResetCamera()\n\n    aCamera.SetFocalPoint(3.505, 2.505, 1.255)\n    aCamera.SetPosition(3.505, 24.6196, 1.255)\n    aCamera.SetViewUp(0, 0, 1)\n    aCamera.Azimuth(60)\n    aCamera.Elevation(30)\n    aCamera.Dolly(1.4)\n    aren.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 512)\n    renWin.Render()\n    renWin.SetWindowName('Kitchen')\n\n    # interact with data\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Flow velocity computed for a small kitchen (top and side view).'\n    epilogue = '''\n    Forty streamlines start along the rake positioned under the window.\n    Some eventually travel over the hot stove and are convected upwards.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='kitchen.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/KochSnowflake/","title":"KochSnowflake","text":"

        vtk-examples/Python/Visualization/KochSnowflake

        "},{"location":"Python/Visualization/KochSnowflake/#description","title":"Description","text":"

        This demo uses recursion to represent a Koch snowflake fractal. For more information about this fractal, there are many resources on the web: http://en.wikipedia.org/wiki/Koch_snowflake, http://mathworld.wolfram.com/KochSnowflake.html.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/KochSnowflake/#code","title":"Code","text":"

        KochSnowflake.py

        #!/usr/bin/env python\n\nfrom math import pi, cos, sin, sqrt\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkIntArray,\n    vtkLookupTable,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData,\n    vtkPolyLine,\n    vtkTriangle\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\nLEVEL = 6\n\n\ndef as_polyline(points, level):\n    '''\n    Koch Snowflake as a vtkPolyLine\n    '''\n    # Use the points from the previous iteration to create the points of the next\n    # level. There is an assumption on my part that the curve is traversed in a\n    # counterclockwise fashion. If the initial triangle above is written to\n    # describe clockwise motion, the points will face inward instead of outward.\n    for i in range(level):\n        temp = vtkPoints()\n        # The first point of the previous vtkPoints is the first point of the next vtkPoints.\n        temp.InsertNextPoint(*points.GetPoint(0))\n\n        # Iterate over 'edges' in the vtkPoints\n        for i in range(1, points.GetNumberOfPoints()):\n            x0, y0, z0 = points.GetPoint(i - 1)\n            x1, y1, z1 = points.GetPoint(i)\n            t = sqrt((x1 - x0) ** 2 + (y1 - y0) ** 2)\n            nx = (x1 - x0) / t  # x-component of edge unit tangent\n            ny = (y1 - y0) / t  # y-component of edge unit tangent\n\n            # the points describing the Koch snowflake edge\n            temp.InsertNextPoint(x0 + nx * t / 3, y0 + ny * t / 3, 0.)\n            temp.InsertNextPoint(x0 + nx * t / 2 + ny * t * sqrt(3) / 6, y0 + ny * t / 2 - nx * t * sqrt(3) / 6, 0.)\n            temp.InsertNextPoint(x0 + nx * 2 * t / 3, y0 + ny * 2 * t / 3, 0.)\n            temp.InsertNextPoint(x0 + nx * t, y0 + ny * t, 0.)\n\n        points = temp\n\n    # draw the outline\n    lines = vtkCellArray()\n    pl = vtkPolyLine()\n    pl.GetPointIds().SetNumberOfIds(points.GetNumberOfPoints())\n    for i in range(points.GetNumberOfPoints()):\n        pl.GetPointIds().SetId(i, i)\n    lines.InsertNextCell(pl)\n\n    # complete the polydata\n    polydata = vtkPolyData()\n    polydata.SetLines(lines)\n    polydata.SetPoints(points)\n\n    return polydata\n\n\ndef as_triangles(indices, cellarray, level, data):\n    '''\n    Koch Snowflake as a collection of vtkTriangles\n    '''\n    if len(indices) >= 3:\n        stride = len(indices) // 4\n        indices.append(indices[-1] + 1)\n\n        triangle = vtkTriangle()\n        triangle.GetPointIds().SetId(0, indices[stride])\n        triangle.GetPointIds().SetId(1, indices[2 * stride])\n        triangle.GetPointIds().SetId(2, indices[3 * stride])\n\n        cellarray.InsertNextCell(triangle)\n        data.InsertNextValue(level)\n\n        as_triangles(indices[0: stride], cellarray, level + 1, data)\n        as_triangles(indices[stride: 2 * stride], cellarray, level + 1, data)\n        as_triangles(indices[2 * stride: 3 * stride], cellarray, level + 1, data)\n        as_triangles(indices[3 * stride: -1], cellarray, level + 1, data)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Initially, set up the points to be an equilateral triangle. Note that the\n    # first point is the same as the last point to make this a closed curve when\n    # I create the vtkPolyLine.\n    points = vtkPoints()\n    for i in range(4):\n        points.InsertNextPoint(cos(2.0 * pi * i / 3), sin(2 * pi * i / 3.0), 0.0)\n\n    outline_pd = as_polyline(points, LEVEL)\n    # You have already gone through the trouble of putting the points in the\n    # right places - so 'all' you need to do now is to create polygons from the\n    # points that are in the vtkPoints.\n\n    # The points that are passed in, have an overlap of the beginning and the\n    # end. For this next trick, I will need a list of the indices in the\n    # vtkPoints. They're consecutive, so thats pretty straightforward.\n\n    indices = [i for i in range(outline_pd.GetPoints().GetNumberOfPoints() + 1)]\n    triangles = vtkCellArray()\n\n    # Set this up for each of the initial sides, then call the recursive function.\n    stride = (len(indices) - 1) // 3\n\n    # The cell data will allow us to color the triangles based on the level of\n    # the iteration of the Koch snowflake.\n    data = vtkIntArray()\n    data.SetNumberOfComponents(0)\n    data.SetName('Iteration Level')\n\n    # This is the starting triangle.\n    t = vtkTriangle()\n    t.GetPointIds().SetId(0, 0)\n    t.GetPointIds().SetId(1, stride)\n    t.GetPointIds().SetId(2, 2 * stride)\n    triangles.InsertNextCell(t)\n    data.InsertNextValue(0)\n\n    as_triangles(indices[0: stride + 1], triangles, 1, data)\n    as_triangles(indices[stride: 2 * stride + 1], triangles, 1, data)\n    as_triangles(indices[2 * stride: -1], triangles, 1, data)\n\n    triangle_pd = vtkPolyData()\n    triangle_pd.SetPoints(outline_pd.GetPoints())\n    triangle_pd.SetPolys(triangles)\n    triangle_pd.GetCellData().SetScalars(data)\n\n    # ---------------- #\n    # rendering stuff  #\n    # ---------------- #\n    outline_mapper = vtkPolyDataMapper()\n    outline_mapper.SetInputData(outline_pd)\n\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(256)\n    lut.SetHueRange(0.6, 0.6)\n    lut.SetSaturationRange(0.0, 1.0)\n    lut.Build()\n\n    triangle_mapper = vtkPolyDataMapper()\n    triangle_mapper.SetInputData(triangle_pd)\n    triangle_mapper.SetScalarRange(0.0, LEVEL)\n    triangle_mapper.SetLookupTable(lut)\n\n    outline_actor = vtkActor()\n    outline_actor.SetMapper(outline_mapper)\n\n    triangle_actor = vtkActor()\n    triangle_actor.SetMapper(triangle_mapper)\n\n    outline_ren = vtkRenderer()\n    outline_ren.AddActor(outline_actor)\n    outline_ren.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    triangle_ren = vtkRenderer()\n    triangle_ren.AddActor(triangle_actor)\n    triangle_ren.SetViewport(0.5, 0.0, 1.0, 1.0)\n    triangle_ren.SetActiveCamera(outline_ren.GetActiveCamera())\n\n    renw = vtkRenderWindow()\n    renw.AddRenderer(outline_ren)\n    renw.AddRenderer(triangle_ren)\n    renw.SetSize(800, 400)\n    renw.SetWindowName('KochSnowflake')\n\n    outline_ren.SetBackground(colors.GetColor3d('CornFlowerBLue'))\n    triangle_ren.SetBackground(colors.GetColor3d('MistyRose'))\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renw)\n\n    outline_ren.ResetCamera()\n    renw.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/LoopShrink/","title":"LoopShrink","text":"

        vtk-examples/Python/Visualization/LoopShrink

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/LoopShrink/#code","title":"Code","text":"

        LoopShrink.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n    renderer.GetCullers().RemoveAllItems()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(12)\n    sphere.SetPhiResolution(12)\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(sphere.GetOutputPort())\n    shrink.SetShrinkFactor(0.9)\n\n    colorIt = vtkElevationFilter()\n    colorIt.SetInputConnection(shrink.GetOutputPort())\n    colorIt.SetLowPoint(0, 0, -.5)\n    colorIt.SetHighPoint(0, 0, .5)\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(colorIt.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('LavenderBlush'))\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName('LoopShrink')\n\n    renWin.Render()\n\n    renderer.GetActiveCamera().Zoom(1.5)\n\n    #  Interact with the data.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/Lorenz/","title":"Lorenz","text":"

        vtk-examples/Python/Visualization/Lorenz

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/Lorenz/#code","title":"Code","text":"

        Lorenz.py

        #!/usr/bin/env python\n\n\"\"\"\nCreate an iso-surface of the Lorenz attractor.\n\nHere we visualize a Lorenz strange attractor by integrating the Lorenz equations in a volume.\nThe number of visits in each voxel is recorded as a scalar function.\nThe surface is extracted via marching cubes using a visit value of 50.\nThe number of integration steps is 10 million, in a volume of dimensions 200 x 200 x 200.\nThe surface roughness is caused by the discrete nature of the evaluation function.\n\n\"\"\"\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkMinimalStandardRandomSequence,\n    vtkShortArray\n)\nfrom vtkmodules.vtkCommonDataModel import vtkStructuredPoints\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    Pr = 10.0  # The Lorenz parameters\n    b = 2.667\n    r = 28.0\n    # x = 0.0\n    # y = 0.0\n    # z = 0.0  # starting (and current) x, y, z\n    h = 0.01  # integration step size\n    resolution = 200  # slice resolution\n    iterations = 10000000  # number of iterations\n    xmin = -30.0  # x, y, z range for voxels\n    xmax = 30.0\n    ymin = -30.0\n    ymax = 30.0\n    zmin = -10.0\n    zmax = 60.0\n\n    # Take a stab at an integration step size.\n    xIncr = resolution / (xmax - xmin)\n    yIncr = resolution / (ymax - ymin)\n    zIncr = resolution / (zmax - zmin)\n\n    print('The Lorenz Attractor\\n')\n    print(' Pr =', Pr)\n    print(' b =', b)\n    print(' r =', r)\n    print(' integration step size =', h)\n    print(' slice resolution =', resolution)\n    print(' # of iterations =', iter)\n    print(' specified range:')\n    print('     x: {:f}, {:f}'.format(xmin, xmax))\n    print('     y: {:f}, {:f}'.format(ymin, ymax))\n    print('     z: {:f}, {:f}'.format(zmin, zmax))\n\n    randomSequence = vtkMinimalStandardRandomSequence()\n    randomSequence.SetSeed(8775070)\n    x = randomSequence.GetRangeValue(xmin, xmax)\n    randomSequence.Next()\n    y = randomSequence.GetRangeValue(ymin, ymax)\n    randomSequence.Next()\n    z = randomSequence.GetRangeValue(zmin, zmax)\n    randomSequence.Next()\n    print(' starting at {:f}, {:f}, {:f}'.format(x, y, z))\n    # allocate memory for the slices\n    sliceSize = resolution * resolution\n    numPts = sliceSize * resolution\n    scalars = vtkShortArray()\n    for i in range(0, numPts):\n        scalars.InsertTuple1(i, 0)\n    for j in range(0, iterations):\n        # Integrate to the next time step.\n        xx = x + h * Pr * (y - x)\n        yy = y + h * (x * (r - z) - y)\n        zz = z + h * (x * y - (b * z))\n\n        x = xx\n        y = yy\n        z = zz\n\n        # Calculate the voxel index.\n        if xmax > x > xmin and ymax > y > ymin and zmax > z > zmin:\n            xxx = int(float(xx - xmin) * xIncr)\n            yyy = int(float(yy - ymin) * yIncr)\n            zzz = int(float(zz - zmin) * zIncr)\n            index = xxx + yyy * resolution + zzz * sliceSize\n            scalars.SetTuple1(index, scalars.GetTuple1(index) + 1)\n\n    volume = vtkStructuredPoints()\n    volume.GetPointData().SetScalars(scalars)\n    volume.SetDimensions(resolution, resolution, resolution)\n    volume.SetOrigin(xmin, ymin, zmin)\n    volume.SetSpacing((xmax - xmin) / resolution, (ymax - ymin) / resolution, (zmax - zmin) / resolution)\n\n    print(' contouring...')\n    # Do the graphics dance.\n    renderer = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(renderer)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create iso-surface\n    contour = vtkContourFilter()\n    contour.SetInputData(volume)\n    contour.SetValue(0, 50)\n\n    # Create mapper.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(contour.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    # Create actor.\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('DodgerBlue'))\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('PaleGoldenrod'))\n\n    renWin.SetSize(640, 480)\n\n    # interact with data\n    renWin.Render()\n    renWin.SetWindowName('Lorenz')\n\n    camera = renderer.GetActiveCamera()\n    camera.SetPosition(-67.645167, -25.714343, 63.483516)\n    camera.SetFocalPoint(3.224902, -4.398594, 29.552112)\n    camera.SetViewUp(-0.232264, 0.965078, 0.121151)\n    camera.SetDistance(81.414176)\n    camera.SetClippingRange(18.428905, 160.896031)\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/MultipleRenderWindows/","title":"MultipleRenderWindows","text":"

        vtk-examples/Python/Visualization/MultipleRenderWindows

        "},{"location":"Python/Visualization/MultipleRenderWindows/#description","title":"Description","text":"

        This example creates four render windows. Three of the windows will close individually and closing one window will close all the others. Guess which one!

        You can also press 'q' or 'e' to close a window.

        If the parameter 's' (C++) or '-s (Python) is specified, then updating the camera position in one window will also update the position in the other windows. Pressing 'q' or 'e' closes all windows. Note that in this mode you must use 'q' or 'e' to close the windows.

        Note

        The image you see here is the test image. When you run this program you will see an image similar to MultipleViewports however each object will be in a separate window.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/MultipleRenderWindows/#code","title":"Code","text":"

        MultipleRenderWindows.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkCylinderSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Display multiple render windows.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('-s', default=False, action='store_true',\n                        help='Simultaneous camera position updating.')\n    args = parser.parse_args()\n    return args.s\n\n\ndef main():\n    simultaneous_update = get_program_parameters()\n\n    colors = vtkNamedColors()\n    # Have some fun with colors\n    ren_bkg = ['AliceBlue', 'GhostWhite', 'WhiteSmoke', 'Seashell']\n    actor_color = ['Bisque', 'RosyBrown', 'Goldenrod', 'Chocolate']\n\n    # Window sizes and spacing.\n    width = 300\n    height = 300\n    # Add extra space around each window.\n    dx = 20\n    dy = 40\n    w = width + dx\n    h = height + dy\n\n    interactors = list()\n    running = [True, True, True, True]\n\n    camera = None\n    sources = get_sources()\n\n    kpis = list()\n    for i in range(0, 4):\n        ren_win = vtkRenderWindow()\n        ren_win.SetSize(width, height)\n\n        renderer = vtkRenderer()\n\n        # Share the camera between viewports.\n        if i == 0:\n            camera = renderer.GetActiveCamera()\n            camera.Azimuth(30)\n            camera.Elevation(30)\n        else:\n            renderer.SetActiveCamera(camera)\n\n        ren_win.AddRenderer(renderer)\n\n        iren = vtkRenderWindowInteractor()\n\n        interactors.append(iren)\n\n        iren.SetRenderWindow(ren_win)\n        ren_win.Render()\n        ren_win.SetWindowName('MultipleRenderWindows {:d}'.format(i))\n        ren_win.SetPosition((i % 2) * w, h - (i // 2) * h)\n\n        # Create a mapper and actor.\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(sources[i].GetOutputPort())\n\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n        actor.GetProperty().SetColor(colors.GetColor3d(actor_color[i]))\n\n        renderer.AddActor(actor)\n        renderer.SetBackground(colors.GetColor3d(ren_bkg[i]))\n\n        renderer.ResetCamera()\n\n        running[i] = True\n        kpis.append(KeyPressInteractorStyle(parent=iren))\n        interactors[i].SetInteractorStyle(kpis[i])\n        kpis[i].status = running[i]\n\n    if simultaneous_update:\n        interactors[0].Initialize()\n        while all(x is True for x in running):\n            for i in range(0, 4):\n                running[i] = kpis[i].status\n                if running[i]:\n                    interactors[i].ProcessEvents()\n                    interactors[i].Render()\n                else:\n                    interactors[i].TerminateApp()\n                    print('Window', i, 'has stopped running.')\n    else:\n        interactors[0].Start()\n\n\ndef get_sources():\n    sources = list()\n\n    # Create a sphere\n    sphere = vtkSphereSource()\n    sphere.SetCenter(0.0, 0.0, 0.0)\n    sphere.Update()\n    sources.append(sphere)\n    # Create a cone\n    cone = vtkConeSource()\n    cone.SetCenter(0.0, 0.0, 0.0)\n    cone.SetDirection(0, 1, 0)\n    cone.Update()\n    sources.append(cone)\n    # Create a cube\n    cube = vtkCubeSource()\n    cube.SetCenter(0.0, 0.0, 0.0)\n    cube.Update()\n    sources.append(cube)\n    # Create a cylinder\n    cylinder = vtkCylinderSource()\n    cylinder.SetCenter(0.0, 0.0, 0.0)\n    cylinder.Update()\n    sources.append(cylinder)\n\n    return sources\n\n\nclass KeyPressInteractorStyle(vtkInteractorStyleTrackballCamera):\n\n    def __init__(self, parent=None, status=True):\n        self.parent = vtkRenderWindowInteractor()\n        self.status = status\n        if parent is not None:\n            self.parent = parent\n\n        self.AddObserver('KeyPressEvent', self.key_press_event)\n\n    def key_press_event(self, obj, event):\n        key = self.parent.GetKeySym().lower()\n        if key == 'e' or key == 'q':\n            self.status = False\n        return\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/MultipleViewports/","title":"MultipleViewports","text":"

        vtk-examples/Python/Visualization/MultipleViewports

        "},{"location":"Python/Visualization/MultipleViewports/#description","title":"Description","text":"

        This example creates a window with 4 viewports. Updating the camera position in one viewport will also update the position in the other viewports.

        See MultipleRenderWindows for an example using multiple windows.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/MultipleViewports/#code","title":"Code","text":"

        MultipleViewports.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkCylinderSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # One render window, multiple viewports.\n    rw = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(rw)\n\n    # Define viewport ranges.\n    xmins = [0, .5, 0, .5]\n    xmaxs = [0.5, 1, 0.5, 1]\n    ymins = [0, 0, .5, .5]\n    ymaxs = [0.5, 0.5, 1, 1]\n\n    # Have some fun with colors.\n    ren_bkg = ['AliceBlue', 'GhostWhite', 'WhiteSmoke', 'Seashell']\n    actor_color = ['Bisque', 'RosyBrown', 'Goldenrod', 'Chocolate']\n\n    sources = get_sources()\n    for i in range(4):\n        ren = vtkRenderer()\n        rw.AddRenderer(ren)\n        ren.SetViewport(xmins[i], ymins[i], xmaxs[i], ymaxs[i])\n\n        # Share the camera between viewports.\n        if i == 0:\n            camera = ren.GetActiveCamera()\n            camera.Azimuth(30)\n            camera.Elevation(30)\n        else:\n            ren.SetActiveCamera(camera)\n\n        # Create a mapper and actor\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(sources[i].GetOutputPort())\n        actor = vtkActor()\n        actor.GetProperty().SetColor(colors.GetColor3d(actor_color[i]))\n        actor.SetMapper(mapper)\n        ren.AddActor(actor)\n        ren.SetBackground(colors.GetColor3d(ren_bkg[i]))\n\n        ren.ResetCamera()\n\n    rw.Render()\n    rw.SetWindowName('MultipleViewPorts')\n    rw.SetSize(600, 600)\n    iren.Start()\n\n\ndef get_sources():\n    sources = list()\n\n    # Create a sphere\n    sphere = vtkSphereSource()\n    sphere.SetCenter(0.0, 0.0, 0.0)\n    sphere.Update()\n    sources.append(sphere)\n    # Create a cone\n    cone = vtkConeSource()\n    cone.SetCenter(0.0, 0.0, 0.0)\n    cone.SetDirection(0, 1, 0)\n    cone.Update()\n    sources.append(cone)\n    # Create a cube\n    cube = vtkCubeSource()\n    cube.SetCenter(0.0, 0.0, 0.0)\n    cube.Update()\n    sources.append(cube)\n    # Create a cylinder\n    cylinder = vtkCylinderSource()\n    cylinder.SetCenter(0.0, 0.0, 0.0)\n    cylinder.Update()\n    sources.append(cylinder)\n\n    return sources\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/NamedColorPatches/","title":"NamedColorPatches","text":"

        vtk-examples/Python/Visualization/NamedColorPatches

        "},{"location":"Python/Visualization/NamedColorPatches/#description","title":"Description","text":"

        This example shows how to produce a HTML page called VTKNamedColorPatches showing the available colors in vtkNamedColors.

        It also shows how to select the text color based on luminance. In this case, Digital CCIR601 is used, which gives less weight to the red and blue components of a color.

        In the class HTMLTableMaker there are four methods for generating HTML pages:

        • MakeCombinedColorPage() -- Makes an indexed page with all the colors and names in the class vtkNamedColors (the default).
        • MakeWebColorPage() -- Makes a page of just the colors and names known to Web Browsers.
        • MakeVTKColorPage() -- Makes a page of colors and names corresponding to to additional colors commonly used in VTK.
        • MakeSynonymColorPage() -- Makes a page of color names and their synonyms.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/NamedColorPatches/#code","title":"Code","text":"

        NamedColorPatches.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nProduce a HTML page called VTKNamedColorPatches.html showing the available\n colors in vtkNamedColors.\n\nIt also shows how to select the text color based on luminance.\nIn this case Digital CCIR601 is used which gives less weight to the\n red and blue components of a color.\n\n\"\"\"\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\n\n\ndef main():\n    ncp = HTMLTableMaker()\n    res = ncp.MakeCombinedColorPage()\n    # res = ncp.MakeWebColorPage()\n    # res = ncp.MakeVTKColorPage()\n    # res = ncp.MakeSynonymColorPage()\n    f = open(\"VTKNamedColorPatches.html\", \"w\", newline=\"\\n\")\n    f.write(res)\n    f.close()\n\n\nclass HTMLToFromRGBAColor:\n\n    @staticmethod\n    def RGBToHTMLColor(rgb):\n        \"\"\"\n        Convert an [R, G, B] list to #RRGGBB.\n        :param: rgb - The elements of the array rgb are unsigned chars (0..255).\n        :return: The html color.\n        \"\"\"\n        hexcolor = \"#\" + ''.join(['{:02x}'.format(x) for x in rgb])\n        return hexcolor\n\n    @staticmethod\n    def HTMLColorToRGB(colorString):\n        \"\"\"\n        Convert #RRGGBB to a [R, G, B] list.\n        :param: colorString a string in the form: #RRGGBB where RR, GG, BB are hexadecimal.\n        The elements of the array rgb are unsigned chars (0..255).\n        :return: The red, green and blue components as a list.\n        \"\"\"\n        colorString = colorString.strip()\n        if colorString[0] == '#':\n            colorString = colorString[1:]\n        if len(colorString) != 6:\n            raise ValueError(\"Input #%s is not in #RRGGBB format\" % colorString)\n        r, g, b = colorString[:2], colorString[2:4], colorString[4:]\n        r, g, b = [int(n, 16) for n in (r, g, b)]\n        return [r, g, b]\n\n    @staticmethod\n    def RGBToLumaCCIR601(rgb):\n        \"\"\"\n        RGB -> Luma conversion\n        Digital CCIR601 (gives less weight to the R and B components)\n        :param: rgb - The elements of the array rgb are unsigned chars (0..255).\n        :return: The luminance.\n        \"\"\"\n        Y = 0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]\n        return Y\n\n    @staticmethod\n    def FormatRGBForHTML(rgb):\n        \"\"\"\n        Format the rgb colors for display on a html table.\n        :param: rgb - The elements of the array rgb are unsigned chars (0..255).\n        :return: A formatted string for the html table.\n        \"\"\"\n        s = ','.join(['{:3d}'.format(x) for x in rgb])\n        s = s.replace(' ', '&#160;')\n        s = s.replace(',', '&#160;&#160;')\n        return s\n\n\nclass ColorStructures:\n    \"\"\"\n    Holds the color names, grouped by color class, and information about table\n    layout and ordering.\n    \"\"\"\n\n    def __init__(self):\n        self.cn = {\n            'Red': ['IndianRed', 'LightCoral', 'Salmon', 'DarkSalmon',\n                    'LightSalmon', 'Red', 'Crimson', 'FireBrick', 'DarkRed'],\n            'Pink': ['Pink', 'LightPink', 'HotPink', 'DeepPink',\n                     'MediumVioletRed', 'PaleVioletRed'],\n            'Orange': ['LightSalmon', 'Coral', 'Tomato', 'OrangeRed',\n                       'DarkOrange', 'Orange'],\n            'Yellow': ['Gold', 'Yellow', 'LightYellow', 'LemonChiffon',\n                       'LightGoldenrodYellow', 'PapayaWhip', 'Moccasin',\n                       'PeachPuff', 'PaleGoldenrod', 'Khaki', 'DarkKhaki'],\n            'Purple': ['Lavender', 'Thistle', 'Plum', 'Violet', 'Orchid',\n                       'Fuchsia', 'Magenta', 'MediumOrchid', 'MediumPurple',\n                       'BlueViolet', 'DarkViolet', 'DarkOrchid', 'DarkMagenta',\n                       'Purple', 'Indigo', 'DarkSlateBlue', 'SlateBlue',\n                       'MediumSlateBlue'],\n            'Green': ['GreenYellow', 'Chartreuse', 'LawnGreen', 'Lime',\n                      'LimeGreen', 'PaleGreen', 'LightGreen',\n                      'MediumSpringGreen', 'SpringGreen', 'MediumSeaGreen',\n                      'SeaGreen', 'ForestGreen', 'Green', 'DarkGreen',\n                      'YellowGreen', 'OliveDrab', 'Olive', 'DarkOliveGreen',\n                      'MediumAquamarine', 'DarkSeaGreen', 'LightSeaGreen',\n                      'DarkCyan', 'Teal'],\n            'Blue/Cyan': ['Aqua', 'Cyan', 'LightCyan', 'PaleTurquoise',\n                          'Aquamarine', 'Turquoise', 'MediumTurquoise',\n                          'DarkTurquoise', 'CadetBlue', 'SteelBlue',\n                          'LightSteelBlue', 'PowderBlue', 'LightBlue',\n                          'SkyBlue', 'LightSkyBlue', 'DeepSkyBlue',\n                          'DodgerBlue', 'CornflowerBlue', 'RoyalBlue', 'Blue',\n                          'MediumBlue', 'DarkBlue', 'Navy', 'MidnightBlue'],\n            'Brown': ['Cornsilk', 'BlanchedAlmond', 'Bisque', 'NavajoWhite',\n                      'Wheat', 'BurlyWood', 'Tan', 'RosyBrown', 'SandyBrown',\n                      'Goldenrod', 'DarkGoldenrod', 'Peru', 'Chocolate',\n                      'SaddleBrown', 'Sienna', 'Brown', 'Maroon'],\n            'White': ['White', 'Snow', 'Honeydew', 'MintCream', 'Azure',\n                      'AliceBlue', 'GhostWhite', 'WhiteSmoke', 'Seashell',\n                      'Beige', 'OldLace', 'FloralWhite', 'Ivory',\n                      'AntiqueWhite', 'Linen',\n                      'LavenderBlush', 'MistyRose'],\n            'Gray': ['Gainsboro', 'LightGrey', 'Silver', 'DarkGray', 'Gray',\n                     'DimGray', 'LightSlateGray', 'SlateGray', 'DarkSlateGray',\n                     'Black']\n        }\n        # Ordering of the tables and when to start and end a column of tables\n        # in the layout.\n        self.cnOrder = ['Red', 'Pink', 'Orange', 'Yellow', 'Purple', 'Green',\n                        'Blue/Cyan', 'Brown', 'White', 'Gray']\n        self.cnStartTable = ['Red', 'Green', 'Brown']\n        self.cnEndTable = ['Purple', 'Blue/Cyan', 'Gray']\n\n        self.vtkcn = {\n            'Whites': ['antique_white', 'azure', 'bisque', 'blanched_almond',\n                       'cornsilk', 'eggshell', 'floral_white', 'gainsboro',\n                       'ghost_white', 'honeydew', 'ivory', 'lavender',\n                       'lavender_blush', 'lemon_chiffon', 'linen', 'mint_cream',\n                       'misty_rose', 'moccasin', 'navajo_white', 'old_lace',\n                       'papaya_whip', 'peach_puff', 'seashell', 'snow',\n                       'thistle', 'titanium_white', 'wheat', 'white',\n                       'white_smoke', 'zinc_white'],\n            'Greys': ['cold_grey', 'dim_grey', 'grey', 'light_grey',\n                      'slate_grey', 'slate_grey_dark', 'slate_grey_light',\n                      'warm_grey'],\n            'Blacks': ['black', 'ivory_black', 'lamp_black'],\n            'Reds': ['alizarin_crimson', 'brick', 'cadmium_red_deep', 'coral',\n                     'coral_light', 'deep_pink', 'english_red', 'firebrick',\n                     'geranium_lake', 'hot_pink', 'indian_red', 'light_salmon',\n                     'madder_lake_deep', 'maroon', 'pink', 'pink_light',\n                     'raspberry', 'red', 'rose_madder', 'salmon', 'tomato',\n                     'venetian_red'],\n            'Browns': ['beige', 'brown', 'brown_madder', 'brown_ochre',\n                       'burlywood', 'burnt_sienna', 'burnt_umber', 'chocolate',\n                       'deep_ochre', 'flesh', 'flesh_ochre', 'gold_ochre',\n                       'greenish_umber', 'khaki', 'khaki_dark', 'light_beige',\n                       'peru', 'rosy_brown', 'raw_sienna', 'raw_umber', 'sepia',\n                       'sienna', 'saddle_brown', 'sandy_brown', 'tan',\n                       'van_dyke_brown'],\n            'Oranges': ['cadmium_orange', 'cadmium_red_light', 'carrot',\n                        'dark_orange', 'mars_orange', 'mars_yellow', 'orange',\n                        'orange_red', 'yellow_ochre'],\n            'Yellows': ['aureoline_yellow', 'banana', 'cadmium_lemon',\n                        'cadmium_yellow', 'cadmium_yellow_light', 'gold',\n                        'goldenrod', 'goldenrod_dark', 'goldenrod_light',\n                        'goldenrod_pale', 'light_goldenrod', 'melon',\n                        'naples_yellow_deep', 'yellow', 'yellow_light'],\n            'Greens': ['chartreuse', 'chrome_oxide_green', 'cinnabar_green',\n                       'cobalt_green', 'emerald_green', 'forest_green', 'green',\n                       'green_dark', 'green_pale', 'green_yellow', 'lawn_green',\n                       'lime_green', 'mint', 'olive', 'olive_drab',\n                       'olive_green_dark', 'permanent_green', 'sap_green',\n                       'sea_green', 'sea_green_dark', 'sea_green_medium',\n                       'sea_green_light', 'spring_green', 'spring_green_medium',\n                       'terre_verte', 'viridian_light', 'yellow_green'],\n            'Cyans': ['aquamarine', 'aquamarine_medium', 'cyan', 'cyan_white',\n                      'turquoise', 'turquoise_dark', 'turquoise_medium',\n                      'turquoise_pale'],\n            'Blues': ['alice_blue', 'blue', 'blue_light', 'blue_medium',\n                      'cadet', 'cobalt', 'cornflower', 'cerulean', 'dodger_blue',\n                      'indigo', 'manganese_blue', 'midnight_blue', 'navy',\n                      'peacock', 'powder_blue', 'royal_blue', 'slate_blue',\n                      'slate_blue_dark', 'slate_blue_light',\n                      'slate_blue_medium', 'sky_blue', 'sky_blue_deep',\n                      'sky_blue_light', 'steel_blue', 'steel_blue_light',\n                      'turquoise_blue', 'ultramarine'],\n            'Magentas': ['blue_violet', 'cobalt_violet_deep', 'magenta',\n                         'orchid', 'orchid_dark', 'orchid_medium',\n                         'permanent_red_violet', 'plum', 'purple',\n                         'purple_medium', 'ultramarine_violet', 'violet',\n                         'violet_dark', 'violet_red', 'violet_red_medium',\n                         'violet_red_pale']\n        }\n        # Ordering of the tables and when to start and end a column of tables\n        # in the layout.\n        self.vtkcnOrder = ['Whites', 'Greys', 'Blacks', 'Reds', 'Oranges', 'Browns', 'Yellows', 'Greens', 'Cyans',\n                           'Blues',\n                           'Magentas']\n        self.vtkcnStartTable = ['Whites', 'Browns', 'Cyans']\n        self.vtkcnEndTable = ['Oranges', 'Greens', 'Magentas']\n\n\nclass HTMLTableMaker:\n    \"\"\"\n      This class creates HTML Tables displaying all the colors in\n      the class vtkNamedColors grouped by various categories.\n    \"\"\"\n\n    def __init__(self):\n        self.cs = ColorStructures()\n        self.nc = vtkNamedColors()\n        self.htmlRGBA = HTMLToFromRGBAColor()\n\n    @staticmethod\n    def MakeHTMLStyle():\n        s = '  <style>\\n'\n        s += '  \\n'\n        s += '  body {\\n'\n        s += '    background-color: snow\\n'\n        s += '  }\\n'\n        s += '  h1 {text-align:left;}\\n'\n        s += '  h2 {text-align:left;}\\n'\n        s += '  h3 {text-align:left;}\\n'\n        s += '  h4 {text-align:left;}\\n'\n        s += '  h5 {text-align:left;}\\n'\n        s += '  h6 {text-align:left;}\\n'\n        s += '  \\n'\n        s += '  p {text-align:left;}\\n'\n        s += '  \\n'\n        s += '  table {\\n'\n        s += '    font-family: arial, sans-serif;\\n'\n        s += '    border-collapse: collapse;\\n'\n        s += '    font-size: medium;\\n'\n        s += '    padding: 4px;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  th[colspan]:not([colspan=\"1\"]) {\\n'\n        s += '    background: LightSteelBlue;\\n'\n        s += '    font-size: x-large;\\n'\n        s += '    text-align : center;'\n        s += '    vertical-align : top;\\n'\n        s += '  }\\n'\n        s += '  th {\\n'\n        s += '    background: LightSteelBlue;\\n'\n        s += '  }\\n'\n        s += '  td, th {\\n'\n        s += '    border: 1px solid #dddddd;\\n'\n        s += '    text-align: left;\\n'\n        s += '    padding: 8px;\\n'\n        s += '    font-family: monospace;\\n'\n        s += '    font-size: medium;\\n'\n        s += '    font-weight: bold;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  tr {\\n'\n        s += '    background: WhiteSmoke;\\n'\n        s += '    vertical-align : top;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  td[colspan]:not([colspan=\"1\"]) {\\n'\n        s += '    background: MintCream;\\n'\n        s += '    font-size: large;\\n'\n        s += '    text-align : center;'\n        s += '    vertical-align : top;\\n'\n        s += '  }\\n'\n        s += '  td {\\n'\n        s += '    background: WhiteSmoke;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  .cour {\\n'\n        s += '    font-family: Courier;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  html, body {\\n'\n        s += '    height: 100%;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  html {\\n'\n        s += '    display: table;\\n'\n        s += '    margin: auto;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  body {\\n'\n        s += '    display: table-cell;\\n'\n        s += '    vertical-align: middle;\\n'\n        s += '  }\\n'\n        s += '\\n'\n        s += '  thead {color: DarkGreen;}\\n'\n        s += '  tbody {color: MidnightBlue;}\\n'\n        s += '  tfoot {color: SaddleBrown;}\\n'\n        s += '\\n'\n        s += '  </style>\\n'\n        return s\n\n    @staticmethod\n    def MakeHTMLHeader():\n        s = '<!DOCTYPE html>\\n'\n        s += '<html lang=\"en\">\\n'\n        s += '<head>\\n'\n        s += '<meta charset=\"UTF-8\" />\\n'\n        s += '<title>vtkNamedColors</title>\\n'\n        s += HTMLTableMaker.MakeHTMLStyle()\n        s += '</head>\\n'\n        return s\n\n    @staticmethod\n    def MakeHTMLIndex():\n        s = '<h2>Index</h2>\\n'\n        s += '<ul>\\n'\n        s += '\\t<li><a href=\"#WebColorNames\">Web color Names</a>'\n        s += ' These colors correspond to those in'\n        s += ' <a href=\"http://en.wikipedia.org/wiki/Web_colors\"'\n        s += ' title=\"Web Colors\">Web Colors</a>.\\n'\n        s += '</li>\\n'\n        s += '\\t<li><a href=\"#VTKColorNames\">VTK color Names</a>\\n'\n        s += ' The colors correspond to additional colors commonly used in VTK.\\n'\n        s += '<br>The web colors take precedence over colors with\\n'\n        s += ' the same name (case insensitive) here.\\n'\n        s += '</li>\\n'\n        s += '\\t<li><a href=\"#Synonyms\">Synonyms</a></li>\\n'\n        s += '</ul>\\n'\n        return s\n\n    @staticmethod\n    def MakeTableHeader(title):\n        s = '<tr>\\n'\n        s += '<th>'\n        s += title\n        s += '</th>\\n'\n        s += '<th>Decimal code<br>\\n'\n        s += '&#160;&#160;R'\n        s += '&#160;&#160;&#160;&#160;G'\n        s += '&#160;&#160;&#160;&#160;B</th>\\n'\n        s += '</tr>\\n'\n        return s\n\n    @staticmethod\n    def MakeTD(name):\n        s = '<tr>\\n'\n        s += '<td colspan=\"2\">'\n        s += '<b>' + name + '</b>'\n        s += '</td>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def MakeTR(self, name, rgb, textColor):\n        \"\"\"\n          Use when the name is a color name known to the web browser.\n        \"\"\"\n        s = '<tr>\\n'\n        s += '<td style=\"background:' + name + ';color:' + textColor\n        s += '\">' + name + '</td>\\n'\n        s += '<td style=\"background:' + name + ';color:' + textColor\n        s += '\">' + self.htmlRGBA.FormatRGBForHTML(rgb) + '</td>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def MakeTR_HTML(self, name, htmlColor, rgb, textColor):\n        \"\"\"\n          Use when the name is not a color name known to the web browser.\n        \"\"\"\n        s = '<tr>\\n'\n        s += '<td style=\"background:' + htmlColor + ';color:'\n        s += textColor + '\">' + name + '</td>\\n'\n        s += '<td style=\"background:' + htmlColor + ';color:'\n        s += textColor + '\">' + self.htmlRGBA.FormatRGBForHTML(rgb) + '</td>\\n'\n        s += '</tr>\\n'\n        return s\n\n    def FindLongestColorName(self):\n        \"\"\" Find the longest color name. \"\"\"\n        maxLength = -1\n        for key, value in self.cs.cn.items():\n            for val in value:\n                if len(val) > maxLength:\n                    maxLength = len(val)\n        for key, value in self.cs.vtkcn.items():\n            for val in value:\n                if len(val) > maxLength:\n                    maxLength = len(val)\n        return maxLength\n\n    def MakeWebColorTables(self):\n        res = ''\n        for key in self.cs.cnOrder:\n            if key in self.cs.cnStartTable:\n                res += '<td>\\n'\n                res += '<table>\\n'\n                res += self.MakeTableHeader('HTML name')\n            # Add in the name of the group in the color table.\n            res += self.MakeTD(key + ' colors')\n            values = self.cs.cn[key]\n            for name in values:\n                rgb = self.nc.GetColor3ub(name)\n                Y = self.htmlRGBA.RGBToLumaCCIR601(rgb)\n                textColor = '#000000'  # Black\n                if Y < 255 / 2.0:\n                    textColor = '#ffffff'  # White\n                # Make the row for each color in the group.\n                # Here we use the name to set the background color\n                #  as it is known to the web browser.\n                res += self.MakeTR(name, rgb, textColor)\n            if key in self.cs.cnEndTable:\n                res += '</table>\\n'\n                res += '</td>\\n'\n        return res\n\n    def MakeVTKColorTables(self):\n        res = ''\n        for key in self.cs.vtkcnOrder:\n            if key in self.cs.vtkcnStartTable:\n                res += '<td>\\n'\n                res += '<table>\\n'\n                res += self.MakeTableHeader('HTML name')\n            # Add in the name of the group in the color table.\n            res += self.MakeTD(key)\n            values = self.cs.vtkcn[key]\n            for name in values:\n                rgb = self.nc.GetColor3ub(name)\n                Y = self.htmlRGBA.RGBToLumaCCIR601(rgb)\n                textColor = '#000000'  # Black\n                if Y < 255 / 2.0:\n                    textColor = '#ffffff'  # White\n                # We must set the background color to a specific\n                # HTML color as the color name may not be a standard\n                # name known to the web browser.\n                htmlColor = self.htmlRGBA.RGBToHTMLColor(rgb)\n                # Make the row for each color in the group.\n                res += self.MakeTR_HTML(name, htmlColor, rgb, textColor)\n            if key in self.cs.vtkcnEndTable:\n                res += '</table>\\n'\n                res += '</td>\\n'\n        return res\n\n    def MakeSynonymColorTable(self):\n        syn = self.nc.GetSynonyms()\n        # Convert to a list where each element is a list of the\n        #  color and its synonyms.\n        syn = syn.split('\\n\\n')\n        synonyms = []\n        for ele in syn:\n            synonyms.append(ele.split('\\n'))\n        cn = list()\n        for key, value in self.cs.cn.items():\n            cn = cn + value\n        # Create a dictionary where the key is the lowercase name.\n        d = dict()\n        for n in cn:\n            d.update({n.lower(): n})\n        #  End point of first table.\n        end1 = len(synonyms) // 2\n        if end1 * 2 < len(synonyms):\n            end1 += 1\n        res = '<td>\\n'\n        res += '<table>\\n'\n        res += self.MakeTableHeader('Synonyms')\n        count = 0\n        for colorNames in synonyms:\n            if count == end1:\n                res += '</table>\\n'\n                res += '</td>\\n'\n                res += '<td>\\n'\n                res += '<table>\\n'\n                res += self.MakeTableHeader('Synonyms')\n            for idx, name in enumerate(colorNames):\n                if name in d:\n                    colorNames[idx] = d[name]\n            colorNames.sort()\n            name = \", \".join(colorNames)\n            rgb = self.nc.GetColor3ub(colorNames[0])\n            Y = self.htmlRGBA.RGBToLumaCCIR601(rgb)\n            textColor = '#000000'  # Black\n            if Y < 255 / 2.0:\n                textColor = '#ffffff'  # White\n            # We must set the background color to a specific\n            # HTML color  names is just a list of\n            # synonyms for that particular color.\n            htmlColor = self.htmlRGBA.RGBToHTMLColor(rgb)\n            # Make the row for each color in the group.\n            res += self.MakeTR_HTML(name, htmlColor, rgb, textColor)\n            count += 1\n        res += '</table>\\n'\n        res += '</td>\\n'\n        return res\n\n    def MakeWebColorPage(self):\n        res = self.MakeHTMLHeader()\n        res += '<body>\\n'\n        res += '<h1>Colors available in vtkNamedColors</h1>\\n'\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"3\">Web Color Names</th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeWebColorTables()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '</body>\\n'\n        return res\n\n    def MakeVTKColorPage(self):\n        res = self.MakeHTMLHeader()\n        res += '<body>\\n'\n        res += '<h1>Colors available in vtkNamedColors</h1>\\n'\n        res += 'The web colors take precedence over colors of the same'\n        res += ' name in VTK Color Names.\\n'\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"3\">VTK Color Names</th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeVTKColorTables()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '</body>\\n'\n        return res\n\n    def MakeSynonymColorPage(self):\n        res = self.MakeHTMLHeader()\n        res += '<body>\\n'\n        res += '<h1>Synonyms in vtkNamedColors</h1>\\n'\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"2\">Synonyms</th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeSynonymColorTable()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '</body>\\n'\n        return res\n\n    def MakeCombinedColorPage(self):\n        res = self.MakeHTMLHeader()\n        res += '<body>\\n'\n        res += '<h1>Colors available in vtkNamedColors</h1>\\n'\n        res += 'The class vtkNamedColors provides color names and their'\n        res += ' values for the convenience of the user.\\n'\n        res += '<br>The following tables show the available colors along with'\n        res += ' their red, green and blue values.\\n'\n        res += self.MakeHTMLIndex()\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"3\"><a id=\"WebColorNames\">Web color Names</a></th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeWebColorTables()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '<br>\\n'\n\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"3\"><a id=\"VTKColorNames\">VTK color Names</a></th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeVTKColorTables()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '<br>\\n'\n\n        res += '<table>\\n'\n        res += '<tr>\\n'\n        res += '<th colspan=\"2\"><a id=\"Synonyms\">Synonyms</a></th>\\n'\n        res += '</tr>\\n'\n        res += '<tr>\\n'\n        res += self.MakeSynonymColorTable()\n        res += '</tr>\\n'\n        res += '</table>\\n'\n        res += '</body>\\n'\n        return res\n\n\nif __name__ == \"__main__\":\n    main()\n
        "},{"location":"Python/Visualization/NamedColors/","title":"NamedColors","text":"

        vtk-examples/Python/Visualization/NamedColors

        "},{"location":"Python/Visualization/NamedColors/#description","title":"Description","text":"

        This example demonstrates the usage of the vtkNamedColors class. Some helper functions are also implemented.

        A cone is created and contoured using the BandedPolyDataContourFilter, it is then colored using a LookupTable where the colors have been assigned using color names.

        A list of available color names and any synonyms are also output.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/NamedColors/#code","title":"Code","text":"

        NamedColors.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\n    This example demonstrates the usage of the vtNamedColor class.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersModeling import vtkBandedPolyDataContourFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    nc = vtkNamedColors()\n    # We can print out the variables.\n    # The color name and RGBA values are displayed.\n    print(nc)\n\n    # Here we just print out the colors and any\n    # synonyms.\n    PrintColors(nc)\n    PrintSynonyms(nc)\n\n    \"\"\"\n    Create a cone, contour it using the banded contour filter and\n        color it with the primary additive and subtractive colors.\n    \"\"\"\n    # Create a cone\n    coneSource = vtkConeSource()\n    coneSource.SetCenter(0.0, 0.0, 0.0)\n    coneSource.SetRadius(5.0)\n    coneSource.SetHeight(10)\n    coneSource.SetDirection(0, 1, 0)\n    coneSource.SetResolution(6)\n    coneSource.Update()\n\n    bounds = [1.0, -1.0, 1.0, -1.0, 1.0, -1.0]\n    coneSource.GetOutput().GetBounds(bounds)\n\n    elevation = vtkElevationFilter()\n    elevation.SetInputConnection(coneSource.GetOutputPort())\n    elevation.SetLowPoint(0, bounds[2], 0)\n    elevation.SetHighPoint(0, bounds[3], 0)\n\n    bcf = vtkBandedPolyDataContourFilter()\n    bcf.SetInputConnection(elevation.GetOutputPort())\n    bcf.SetScalarModeToValue()\n    bcf.GenerateContourEdgesOn()\n    bcf.GenerateValues(7, elevation.GetScalarRange())\n\n    # Test setting and getting a color here.\n    # We are also modifying alpha.\n    # Convert to a list so that\n    # SetColor(name,rgba) works.\n    rgba = list(nc.GetColor4d(\"Red\"))\n    rgba[3] = 0.5\n    nc.SetColor(\"My Red\", rgba)\n    # Does \"My Red\" match anything?\n    match = FindSynonyms(nc, \"My Red\")\n    print(\"Matching colors to My Red:\", ', '.join(match))\n    # Build a simple lookup table of\n    # primary additive and subtractive colors.\n    lut = vtkLookupTable()\n    lut.SetNumberOfTableValues(7)\n    lut.SetTableValue(0, nc.GetColor4d(\"My Red\"))\n    # Let's make the dark green one partially transparent.\n    rgba = nc.GetColor4d(\"Lime\")\n    rgba[3] = 0.3\n    lut.SetTableValue(1, rgba)\n    lut.SetTableValue(2, nc.GetColor4d(\"Blue\"))\n    lut.SetTableValue(3, nc.GetColor4d(\"Cyan\"))\n    lut.SetTableValue(4, nc.GetColor4d(\"Magenta\"))\n    lut.SetTableValue(5, nc.GetColor4d(\"Yellow\"))\n    lut.SetTableValue(6, nc.GetColor4d(\"White\"))\n    lut.SetTableRange(elevation.GetScalarRange())\n    lut.Build()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(bcf.GetOutputPort())\n    mapper.SetLookupTable(lut)\n    mapper.SetScalarModeToUseCellData()\n\n    contourLineMapper = vtkPolyDataMapper()\n    contourLineMapper.SetInputData(bcf.GetContourEdgesOutput())\n    contourLineMapper.SetScalarRange(elevation.GetScalarRange())\n    contourLineMapper.SetResolveCoincidentTopologyToPolygonOffset()\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    contourLineActor = vtkActor()\n    actor.SetMapper(mapper)\n    contourLineActor.SetMapper(contourLineMapper)\n    contourLineActor.GetProperty().SetColor(\n        nc.GetColor3d(\"black\"))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.AddActor(contourLineActor)\n    renderer.SetBackground2(nc.GetColor3d('RoyalBlue'))\n    renderer.SetBackground(nc.GetColor3d('MistyRose'))\n    renderer.GradientBackgroundOn()\n    renderWindow.SetSize(600, 600)\n    renderWindow.Render()\n    renderWindow.SetWindowName('NamedColors')\n    renderWindow.Render()\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\ndef FindSynonyms(nc, colorName):\n    \"\"\"\n    Find any synonyms for a specified color.\n    :param: nc: The vtkNamedColor class\n    :param: colorName: the name of the color to find the synonyms for.\n    :return: The synonyms for colorName.\n    \"\"\"\n    availableColors = nc.GetColorNames()\n    # Make a list\n    availableColors = availableColors.split('\\n')\n    synonyms = []\n    # We use lower case for comparison and\n    # just the red, green, and blue components\n    # of the color.\n    myColor = nc.GetColor3ub(colorName)\n    for color in availableColors:\n        rgb = nc.GetColor3ub(color)\n        if list(myColor) == list(rgb):\n            synonyms.append(color)\n    return synonyms\n\n\ndef PrintColors(nc):\n    colorNames = nc.GetColorNames().split('\\n')\n    print(\"There are\", len(colorNames), \"colors:\")\n    max_str_len = len(max(colorNames, key=len))\n    n = 0\n    s = ''\n    for p in colorNames:\n        n += 1\n        if n % 5 == 0:\n            s += '{:s}\\n'.format(p)\n        else:\n            s += '{:s} '.format(p.ljust(max_str_len))\n    s = s.strip() + '\\n'\n    print(s)\n\n\ndef PrintSynonyms(nc):\n    syn = nc.GetSynonyms().split('\\n\\n')\n    print(\"There are\", len(syn), \"synonyms:\")\n    synonyms = []\n    for ele in syn:\n        synonyms.append(ele.split('\\n'))\n    max_str_len = 0\n    for p in synonyms:\n        max_len = len(max(p, key=len))\n        if max_len > max_str_len:\n            max_str_len = max_len\n    s = ''\n    for p in synonyms:\n        n = 0\n        for q in p:\n            n += 1\n            if n < len(p):\n                s += '{:s} '.format(q.ljust(max_str_len))\n            else:\n                s += '{:s}\\n'.format(q)\n    s = s.strip() + '\\n'\n    print(s)\n\n\nif __name__ == \"__main__\":\n    main()\n
        "},{"location":"Python/Visualization/NormalsDemo/","title":"NormalsDemo","text":"

        vtk-examples/Python/Visualization/NormalsDemo

        "},{"location":"Python/Visualization/NormalsDemo/#description","title":"Description","text":"

        This example demonstrates the generation of normals. The left image shows the orignal faceted model. The center image shows the model with generated normals, but no consideration for sharp features. The third image shows the model with a 30 degree feature angle and splitting on.

        Theis example uses the src/Testing/Data/42400-IDGH.stl dataset.

        Info

        See Figure 9-24 in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/NormalsDemo/#code","title":"Code","text":"

        NormalsDemo.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkIOGeometry import (\n    vtkBYUReader,\n    vtkOBJReader,\n    vtkSTLReader\n)\nfrom vtkmodules.vtkIOPLY import vtkPLYReader\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    polyData = ReadPolyData(fileName)\n\n    # A renderer.\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d(\"White\"))\n\n    # Create background colors for each viewport.\n    backgroundColors = list()\n    backgroundColors.append(colors.GetColor3d(\"Cornsilk\"))\n    backgroundColors.append(colors.GetColor3d(\"NavajoWhite\"))\n    backgroundColors.append(colors.GetColor3d(\"Tan\"))\n\n    # Create a renderer for each view port.\n    ren = list()\n    ren.append(vtkRenderer())\n    ren.append(vtkRenderer())\n    ren.append(vtkRenderer())\n    ren[0].SetViewport(0, 0, 1.0 / 3.0, 1)  # Input\n    ren[1].SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1)  # Normals (no split)\n    ren[2].SetViewport(2.0 / 3.0, 0, 1, 1)  # Normals (split)\n\n    # Shared camera.\n    camera = vtkCamera()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputData(polyData)\n    normals.SetFeatureAngle(30.0)\n    for i in range(0, 3):\n        if i == 0:\n            normals.ComputePointNormalsOff()\n        elif i == 1:\n            normals.ComputePointNormalsOn()\n            normals.SplittingOff()\n        else:\n            normals.ComputePointNormalsOn()\n            normals.SplittingOn()\n\n        normals.Update()\n\n        normalsPolyData = vtkPolyData()\n        normalsPolyData.DeepCopy(normals.GetOutput())\n\n        # mapper\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputData(normalsPolyData)\n        mapper.ScalarVisibilityOff()\n\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n        actor.GetProperty().SetDiffuseColor(colors.GetColor3d(\"Peacock\"))\n        actor.GetProperty().SetDiffuse(.7)\n        actor.GetProperty().SetSpecularPower(20)\n        actor.GetProperty().SetSpecular(.5)\n\n        # add the actor\n        ren[i].SetBackground(backgroundColors[i])\n        ren[i].SetActiveCamera(camera)\n        ren[i].AddActor(actor)\n\n    # Render window.\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(ren[0])\n    renwin.AddRenderer(ren[1])\n    renwin.AddRenderer(ren[2])\n    renwin.SetWindowName('NormalsDemo')\n\n    # An interactor.\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    renwin.SetSize(900, 300)\n    ren[0].GetActiveCamera().SetFocalPoint(0, 0, 0)\n    ren[0].GetActiveCamera().SetPosition(1, 0, 0)\n    ren[0].GetActiveCamera().SetViewUp(0, 0, -1)\n    ren[0].ResetCamera()\n\n    ren[0].GetActiveCamera().Azimuth(120)\n    ren[0].GetActiveCamera().Elevation(30)\n    ren[0].GetActiveCamera().Dolly(1.1)\n    ren[0].ResetCameraClippingRange()\n\n    renwin.Render()\n    ren[0].ResetCamera()\n    renwin.Render()\n\n    # Start.\n    interactor.Initialize()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Surface normal generation.'\n    epilogue = '''\n    (a) Faceted model without normals.\n    (b) Polygons must be consistently oriented to accurately compute normals.\n    (c) Sharp edges are poorly represented using shared normals as shown on the corners of this model.\n    (d) Normal generation with sharp edges split.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='42400-IDGH.stl.')\n    args = parser.parse_args()\n    return args.filename1\n\n\ndef ReadPolyData(file_name):\n    import os\n    path, extension = os.path.splitext(file_name)\n    extension = extension.lower()\n    if extension == \".ply\":\n        reader = vtkPLYReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".vtp\":\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".obj\":\n        reader = vtkOBJReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".stl\":\n        reader = vtkSTLReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".vtk\":\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    elif extension == \".g\":\n        reader = vtkBYUReader()\n        reader.SetGeometryFileName(file_name)\n        reader.Update()\n        poly_data = reader.GetOutput()\n    else:\n        # Return a None if the extension is unknown.\n        poly_data = None\n    return poly_data\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/OrientedGlyphs/","title":"OrientedGlyphs","text":"

        vtk-examples/Python/Visualization/OrientedGlyphs

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/OrientedGlyphs/#code","title":"Code","text":"

        OrientedGlyphs.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersCore import vtkGlyph3D\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.Update()\n\n    input_data = vtkPolyData()\n    input_data.ShallowCopy(sphereSource.GetOutput())\n\n    arrowSource = vtkArrowSource()\n\n    glyph3D = vtkGlyph3D()\n    glyph3D.SetSourceConnection(arrowSource.GetOutputPort())\n    glyph3D.SetVectorModeToUseNormal()\n    glyph3D.SetInputData(input_data)\n    glyph3D.SetScaleFactor(.2)\n    glyph3D.Update()\n\n    # Visualize\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph3D.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('OrientedGlyphs')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DarkGreen'))\n\n    renderWindow.Render()\n\n    camera = renderer.GetActiveCamera()\n    camera.SetPosition(-0.399941, -1.070475, 2.931458)\n    camera.SetFocalPoint(-0.000000, -0.000000, 0.000000)\n    camera.SetViewUp(-0.028450, 0.940195, 0.339448)\n    camera.SetDistance(3.146318)\n    camera.SetClippingRange(1.182293, 5.626211)\n\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/PointDataSubdivision/","title":"PointDataSubdivision","text":"

        vtk-examples/Python/Visualization/PointDataSubdivision

        "},{"location":"Python/Visualization/PointDataSubdivision/#description","title":"Description","text":""},{"location":"Python/Visualization/PointDataSubdivision/#introduction","title":"Introduction","text":"

        This example demonstrates the use of the vtkLinearSubdivisionFilter and vtkButterflySubdivisionFilter.

        In order to see the effects of these filters a triptych is created that demonstrates the effect of applying the filter.

        The user can select from a list of sources to render, specify whether normals are displayed, what type of shading to use and the number of normals to glyph.

        A representative set of sources to render are provided in the class called Sources. The user is encouraged to experiment with different sources to see the effect of the filters.

        "},{"location":"Python/Visualization/PointDataSubdivision/#adding-more-sources","title":"Adding more sources.","text":"

        If you add more sources, you may need to provide one or all of these filters:

        • A vtkTriangleFilter
        • A vtkPolyDataNormals filter
        • A vtkElevationFilter.
        • A vtkCleanPolyData filter.
        • For parametric sources, you may need to apply one of both of JoinUOff() or JoinVOff().

        The representative sources provided in the class Sources should provide good templates.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/PointDataSubdivision/#code","title":"Code","text":"

        PointDataSubdivision.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonComputationalGeometry import (\n    vtkParametricBoy,\n    vtkParametricEllipsoid,\n    vtkParametricMobius,\n    vtkParametricRandomHills,\n    vtkParametricTorus\n)\nfrom vtkmodules.vtkCommonCore import vtkVersion\nfrom vtkmodules.vtkCommonDataModel import vtkColor3ub\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCleanPolyData,\n    vtkElevationFilter,\n    vtkGlyph3D,\n    vtkMaskPoints,\n    vtkPolyDataNormals,\n    vtkTriangleFilter\n)\nfrom vtkmodules.vtkFiltersHybrid import vtkRenderLargeImage\nfrom vtkmodules.vtkFiltersModeling import (\n    vtkButterflySubdivisionFilter,\n    vtkLinearSubdivisionFilter\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkArrowSource,\n    vtkConeSource,\n    vtkParametricFunctionSource,\n    vtkSphereSource,\n    vtkSuperquadricSource\n)\nfrom vtkmodules.vtkIOImage import vtkPNGWriter\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAxesActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkActor2D,\n    vtkColorTransferFunction,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextMapper,\n    vtkTextProperty\n)\n\nnc = vtkNamedColors()\n\n\ndef GetProgramParameters():\n    import argparse\n    description = 'Demonstrates point data subdivision with the glyphing of normals on the surface.'\n    epilogue = '''\n        This program takes a surface and displays three surfaces.\n\n        The first surface is the original surface and the second and third surfaces have\n         had linear and butterfly interpolation applied respectively.\n        The user can control the object to use, normal generation, type of shading\n         and number of points to use for the normals.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('sourceToUse', help='The surface to use.', nargs='?', default='Boy')\n    parser.add_argument('-g', '--glyphPoints', help='Number of points to be used for glyphing.', nargs='?', default=50,\n                        type=int)\n    parser.add_argument('--no-normals', help='Do not display normals.', dest='displayNormals', action='store_false')\n    parser.add_argument('--no-gouraud', help='Use flat interpolation. Gouraud interpolation is used by default.',\n                        dest='gouraudInterpolation', action='store_false')\n    parser.set_defaults(displayNormals=True)\n    parser.set_defaults(gouraudInterpolation=True)\n    args = parser.parse_args()\n    return args.sourceToUse, args.displayNormals, args.gouraudInterpolation, args.glyphPoints\n\n\nclass Sources(object):\n    \"\"\"\n    This class acts as a storage vehicle for the various sources.\n\n    If you add more sources, you may need to provide one or all of these filters:\n     - A Triangle filter\n     - A Normal filter\n     - An elevation filter.\n     - A CleanPolyData filter.\n     - For parametric sources, we may need to apply one of both of JoinUOff() or JoinVOff().\n\n    Use the representative sources provided here as templates.\n    \"\"\"\n\n    def __init__(self):\n        # If you add more sources update this dictionary.\n        self.sources = {'ParametricTorus': self.ParametricTorusSource(), 'ParametricEllipsoid': self.EllipsoidSource(),\n                        'Boy': self.BoySource(), 'Sphere': self.SphereSource(), 'Mobius': self.MobiusSource(),\n                        'Cone': self.ConeSource(), 'RandomHills': self.ParametricRandomHills(),\n                        'Superquadric': self.SuperquadricSource()}\n\n    @staticmethod\n    def ParametricTorusSource():\n        torus = vtkParametricTorus()\n        torus.JoinUOff()\n        torus.JoinVOff()\n        torusSource = vtkParametricFunctionSource()\n        torusSource.SetParametricFunction(torus)\n        torusSource.SetScalarModeToZ()\n        return torusSource\n\n    @staticmethod\n    def EllipsoidSource():\n        ellipsoid = vtkParametricEllipsoid()\n        ellipsoid.SetXRadius(0.5)\n        ellipsoid.SetYRadius(1.0)\n        ellipsoid.SetZRadius(2.0)\n        ellipsoid.JoinUOff()\n        # ellipsoid.JoinVOff()\n        ellipsoidSource = vtkParametricFunctionSource()\n        ellipsoidSource.SetParametricFunction(ellipsoid)\n        ellipsoidSource.SetScalarModeToZ()\n        return ellipsoidSource\n\n    @staticmethod\n    def BoySource():\n        boy = vtkParametricBoy()\n        boy.JoinUOff()\n        # boy.JoinVOff()\n        boySource = vtkParametricFunctionSource()\n        boySource.SetParametricFunction(boy)\n        boySource.SetScalarModeToZ()\n        return boySource\n\n    @staticmethod\n    def MobiusSource():\n        mobius = vtkParametricMobius()\n        mobius.SetRadius(2)\n        mobius.SetMinimumV(-0.5)\n        mobius.SetMaximumV(0.5)\n        mobius.JoinUOff()\n        mobiusSource = vtkParametricFunctionSource()\n        mobiusSource.SetParametricFunction(mobius)\n        mobiusSource.SetScalarModeToX()\n        return mobiusSource\n\n    @staticmethod\n    def ParametricRandomHills():\n        randomHills = vtkParametricRandomHills()\n        # randomHills.AllowRandomGenerationOff()\n        randomHills.SetRandomSeed(1)\n        randomHills.SetNumberOfHills(30)\n        randomHillsSource = vtkParametricFunctionSource()\n        randomHillsSource.SetParametricFunction(randomHills)\n        randomHillsSource.SetScalarModeToZ()\n        randomHillsSource.SetUResolution(10)\n        randomHillsSource.SetVResolution(10)\n        return randomHillsSource\n\n    @staticmethod\n    def SphereSource():\n        sphere = vtkSphereSource()\n        sphere.SetPhiResolution(11)\n        sphere.SetThetaResolution(11)\n        sphere.Update()\n        sphereBounds = sphere.GetOutput().GetBounds()\n\n        elev = vtkElevationFilter()\n        elev.SetInputConnection(sphere.GetOutputPort())\n        elev.SetLowPoint(0, sphereBounds[2], 0)\n        elev.SetHighPoint(0, sphereBounds[3], 0)\n        elev.Update()\n        return elev\n\n    @staticmethod\n    def SuperquadricSource():\n        \"\"\"\n        Make a torus as the source.\n        \"\"\"\n        source = vtkSuperquadricSource()\n        source.SetCenter(0.0, 0.0, 0.0)\n        source.SetScale(1.0, 1.0, 1.0)\n        source.SetPhiResolution(64)\n        source.SetThetaResolution(64)\n        source.SetThetaRoundness(1)\n        source.SetThickness(0.5)\n        source.SetSize(10)\n        source.SetToroidal(1)\n\n        # The quadric is made of strips, so pass it through a triangle filter as\n        # the curvature filter only operates on polys\n        tri = vtkTriangleFilter()\n        tri.SetInputConnection(source.GetOutputPort())\n\n        # The quadric has nasty discontinuities from the way the edges are generated\n        # so let's pass it though a CleanPolyDataFilter and merge any points which\n        # are coincident, or very close\n        cleaner = vtkCleanPolyData()\n        cleaner.SetInputConnection(tri.GetOutputPort())\n        cleaner.SetTolerance(0.005)\n        cleaner.Update()\n        cleanerBounds = cleaner.GetOutput().GetBounds()\n\n        elev = vtkElevationFilter()\n        elev.SetInputConnection(cleaner.GetOutputPort())\n        elev.SetLowPoint(0, cleanerBounds[2], 0)\n        elev.SetHighPoint(0, cleanerBounds[3], 0)\n        elev.Update()\n        return elev\n\n    @staticmethod\n    def ConeSource():\n        cone = vtkConeSource()\n        cone.SetResolution(6)\n        cone.CappingOn()\n        cone.Update()\n        coneBounds = cone.GetOutput().GetBounds()\n\n        coneNormals = vtkPolyDataNormals()\n        coneNormals.SetInputConnection(cone.GetOutputPort())\n\n        elev = vtkElevationFilter()\n        elev.SetInputConnection(coneNormals.GetOutputPort())\n        elev.SetLowPoint(coneBounds[0], 0, 0)\n        elev.SetHighPoint(coneBounds[1], 0, 0)\n\n        # vtkButterflySubdivisionFilter and vtkLinearSubdivisionFilter operate on triangles.\n        tf = vtkTriangleFilter()\n        tf.SetInputConnection(elev.GetOutputPort())\n        tf.Update()\n        return tf\n\n\ndef MakeLUT(scalarRange):\n    \"\"\"\n    Make a lookup table using a predefined color series.\n\n    :param scalarRange: The range of the scalars to be coloured.\n    :return:  A lookup table.\n    \"\"\"\n    colorSeries = vtkColorSeries()\n    # Select a color scheme.\n    # for i in range(0,62):\n    #     colorSeries.SetColorScheme(i)\n    #     print('Colour scheme {:2d}: {:s}'.format(colorSeries.GetColorScheme(), colorSeries.GetColorSchemeName()))\n\n    # Colour scheme 61: Brewer Qualitative Set3\n    colorSeries.SetColorScheme(61)\n    # We use this colour series to create the transfer function.\n    lut = vtkColorTransferFunction()\n    lut.SetColorSpaceToHSV()\n    numColors = colorSeries.GetNumberOfColors()\n    for i in range(0, numColors):\n        color = vtkColor3ub(colorSeries.GetColor(i))\n        c = list()\n        for j in range(0, 3):\n            c.append(color[j] / 255.0)\n        t = scalarRange[0] + (scalarRange[1] - scalarRange[0]) / (numColors - 1) * i\n        lut.AddRGBPoint(t, *c)\n    return lut\n\n\ndef GlyphActor(source, glyphPoints, scalarRange, scaleFactor, lut):\n    \"\"\"\n    Create the actor for glyphing the normals.\n\n    :param: source: the surface.\n    :param: glyphPoints: The number of points used by the mask filter.\n    :param: scalarRange: The range in terms of scalar minimum and maximum.\n    :param: scaleFactor: The scaling factor for the glyph.\n    :param: lut: The lookup table to use.\n\n    :return: The glyph actor.\n    \"\"\"\n    arrowSource = vtkArrowSource()\n    # Subsample the dataset.\n    maskPts = vtkMaskPoints()\n    maskPts.SetInputConnection(source.GetOutputPort())\n    maskPts.SetOnRatio(source.GetOutput().GetNumberOfPoints() // glyphPoints)\n    maskPts.SetRandomMode(1)\n\n    arrowGlyph = vtkGlyph3D()\n    arrowGlyph.SetScaleFactor(scaleFactor)\n    arrowGlyph.SetVectorModeToUseNormal()\n    arrowGlyph.SetColorModeToColorByScalar()\n    arrowGlyph.SetScaleModeToScaleByVector()\n    arrowGlyph.OrientOn()\n    arrowGlyph.SetSourceConnection(arrowSource.GetOutputPort())\n    arrowGlyph.SetInputConnection(maskPts.GetOutputPort())\n    arrowGlyph.Update()\n\n    arrowGlyphMapper = vtkDataSetMapper()\n    # Colour by scalars.\n    arrowGlyphMapper.SetScalarRange(scalarRange)\n    arrowGlyphMapper.SetColorModeToMapScalars()\n    arrowGlyphMapper.ScalarVisibilityOn()\n    arrowGlyphMapper.SetLookupTable(lut)\n    arrowGlyphMapper.SetInputConnection(arrowGlyph.GetOutputPort())\n\n    glyphActor = vtkActor()\n    glyphActor.SetMapper(arrowGlyphMapper)\n    return glyphActor\n\n\ndef MakeSurfaceActor(surface, scalarRange, lut):\n    \"\"\"\n    Create the actor for a surface.\n\n    :param: surface: The surface.\n    :param: scalarRange: The range in terms of scalar minimum and maximum.\n    :param: lut: The lookup table to use.\n\n    :return: The actor for the surface.\n    \"\"\"\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(surface.GetOutputPort())\n    mapper.SetLookupTable(lut)\n    mapper.SetScalarRange(scalarRange)\n    mapper.SetColorModeToMapScalars()\n    mapper.ScalarVisibilityOn()\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    return actor\n\n\ndef MakeLabel(textLabel, renWinSize):\n    \"\"\"\n    Create a label.\n\n    :param textLabel: The label.\n    :param renWinSize: The size of the render window. Used to set the font size.\n\n    :return: The actor for the text label.\n    \"\"\"\n    # Create one text property for all\n    textProperty = vtkTextProperty()\n    textProperty.SetJustificationToCentered()\n    textProperty.SetFontSize(int(renWinSize / 20))\n\n    mapper = vtkTextMapper()\n    mapper.SetInput(textLabel)\n    mapper.SetTextProperty(textProperty)\n\n    actor = vtkActor2D()\n    actor.SetMapper(mapper)\n    actor.SetPosition(renWinSize / 2.0, 16)\n    actor.GetProperty().SetColor(nc.GetColor3d(\"Gold\"))\n    return actor\n\n\ndef MakeAxesActor():\n    \"\"\"\n    Make an axis actor.\n\n    :return: The axis actor.\n    \"\"\"\n    axes = vtkAxesActor()\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText('X')\n    axes.SetYAxisLabelText('Y')\n    axes.SetZAxisLabelText('Z')\n    axes.SetTotalLength(1.0, 1.0, 1.0)\n    axes.SetCylinderRadius(1.0 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.75 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.0 * axes.GetSphereRadius())\n    axes.GetXAxisCaptionActor2D().GetTextActor().GetScaledTextProperty()\n    axes.GetXAxisCaptionActor2D().GetTextActor().SetTextScaleModeToNone()\n    axes.GetYAxisCaptionActor2D().GetTextActor().GetScaledTextProperty()\n    axes.GetYAxisCaptionActor2D().GetTextActor().SetTextScaleModeToNone()\n    axes.GetZAxisCaptionActor2D().GetTextActor().GetScaledTextProperty()\n    axes.GetZAxisCaptionActor2D().GetTextActor().SetTextScaleModeToNone()\n    return axes\n\n\ndef MakeOrientationMarker(renderer, iren):\n    \"\"\"\n    Create an orientation marker for a given renderer.\n\n    :param renderer: The renderer.\n    :param iren: The interactor.\n\n    :return: The orientation marker.\n    \"\"\"\n    om = vtkOrientationMarkerWidget()\n    om.SetOrientationMarker(MakeAxesActor())\n    # Position lower left in the viewport.\n    om.SetViewport(0, 0, 0.2, 0.2)\n    om.SetInteractor(iren)\n    om.SetDefaultRenderer(renderer)\n    om.EnabledOn()\n    om.InteractiveOn()\n    renderer.ResetCamera()\n    return om\n\n\ndef WritePNG(ren, fn, magnification=1):\n    \"\"\"\n    Save the image as a PNG\n    :param: ren - the renderer.\n    :param: fn - the file name.\n    :param: magnification - the magnification, usually 1.\n    \"\"\"\n    renLgeIm = vtkRenderLargeImage()\n    renLgeIm.SetInput(ren)\n    renLgeIm.SetMagnification(magnification)\n    imgWriter = vtkPNGWriter()\n    imgWriter.SetInputConnection(renLgeIm.GetOutputPort())\n    imgWriter.SetFileName(fn)\n    imgWriter.Write()\n\n\ndef main():\n    def FlatInterpolation():\n        for actor in actors:\n            actor.GetProperty().SetInterpolationToFlat()\n        renWin.Render()\n\n    def GouraudInterpolation():\n        for actor in actors:\n            actor.GetProperty().SetInterpolationToGouraud()\n        renWin.Render()\n\n    sourceToUse, displayNormals, gouraudInterpolation, glyphPoints = GetProgramParameters()\n\n    if sourceToUse in Sources().sources:\n        src = Sources().sources[sourceToUse]\n    else:\n        print('The source {:s} is not available.'.format(sourceToUse))\n        print('Available sources are:\\n', ', '.join(sorted(list(Sources().sources.keys()))))\n        return\n\n    src.Update()\n\n    # The size of the render window.\n    renWinXSize = 1200\n    renWinYSize = renWinXSize // 3\n    minRenWinDim = min(renWinXSize, renWinYSize)\n\n    # [xMin, xMax, yMin, yMax, zMin, zMax]\n    bounds = src.GetOutput().GetBounds()\n    # Use this to scale the normal glyph.\n    scaleFactor = min(map(lambda x, y: x - y, bounds[1::2], bounds[::2])) * 0.2\n    src.GetOutput().GetPointData().GetScalars().SetName(\"Elevation\")\n    scalarRange = src.GetOutput().GetScalarRange()\n\n    butterfly = vtkButterflySubdivisionFilter()\n    butterfly.SetInputConnection(src.GetOutputPort())\n    butterfly.SetNumberOfSubdivisions(3)\n    butterfly.Update()\n\n    linear = vtkLinearSubdivisionFilter()\n    linear.SetInputConnection(src.GetOutputPort())\n    linear.SetNumberOfSubdivisions(3)\n    linear.Update()\n\n    lut = MakeLUT(scalarRange)\n\n    actors = list()\n    actors.append(MakeSurfaceActor(butterfly, scalarRange, lut))\n    actors.append(MakeSurfaceActor(linear, scalarRange, lut))\n    actors.append(MakeSurfaceActor(src, scalarRange, lut))\n\n    # Let's visualise the normals.\n    glyphActors = list()\n    if displayNormals:\n        glyphActors.append(GlyphActor(butterfly, glyphPoints, scalarRange, scaleFactor, lut))\n        glyphActors.append(GlyphActor(linear, glyphPoints, scalarRange, scaleFactor, lut))\n        glyphActors.append(GlyphActor(src, glyphPoints, scalarRange, scaleFactor, lut))\n\n    labelActors = list()\n    labelActors.append(MakeLabel('Butterfly Subdivision', minRenWinDim))\n    labelActors.append(MakeLabel('Linear Subdivision', minRenWinDim))\n    labelActors.append(MakeLabel('Original', minRenWinDim))\n\n    ren = list()\n    ren.append(vtkRenderer())\n    ren.append(vtkRenderer())\n    ren.append(vtkRenderer())\n    ren[2].SetViewport(0, 0, 1.0 / 3.0, 1)  # Original\n    ren[1].SetViewport(1.0 / 3.0, 0, 2.0 / 3.0, 1)  # Linear\n    ren[0].SetViewport(2.0 / 3.0, 0, 1, 1)  # Butterfly\n\n    renWin = vtkRenderWindow()\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Orientation markers.\n    om = list()\n    # Make the imaging pipelines.\n    for i in range(0, len(ren)):\n        renWin.AddRenderer(ren[i])\n\n        ren[i].AddActor(actors[i])\n        ren[i].AddActor(labelActors[i])\n        ren[i].SetBackground(nc.GetColor3d('SlateGray'))\n\n        if displayNormals:\n            ren[i].AddActor(glyphActors[i])\n\n        om.append(MakeOrientationMarker(ren[i], iren))\n\n    if gouraudInterpolation:\n        GouraudInterpolation()\n    else:\n        FlatInterpolation()\n\n    renWin.SetSize(renWinXSize, renWinYSize)\n    renWin.Render()\n    # renWin.SetWindowName() needs to be called after renWin.Render()\n    renWin.SetWindowName('PointDataSubdivision')\n\n    iren.Initialize()\n    # WritePNG(iren.GetRenderWindow().GetRenderers().GetFirstRenderer(), \"TestPointDataSubdivision.png\")\n    iren.Start()\n\n\nif __name__ == '__main__':\n    requiredMajorVersion = 6\n    # print(vtkVersion().GetVTKMajorVersion())\n    if vtkVersion().GetVTKMajorVersion() < requiredMajorVersion:\n        print(\"You need VTK Version 6 or greater.\")\n        print(\"The class vtkNamedColors is in VTK version 6 or greater.\")\n        exit(0)\n\n    main()\n
        "},{"location":"Python/Visualization/PointSize/","title":"PointSize","text":"

        vtk-examples/Python/Visualization/PointSize

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/PointSize/#code","title":"Code","text":"

        PointSize.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('PointSize')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create source\n    src = vtkPointSource()\n    src.SetCenter(0, 0, 0)\n    src.SetNumberOfPoints(10)\n    src.SetRadius(5)\n    src.Update()\n\n    # mapper\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(src.GetOutputPort())\n\n    # actor\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n\n    actor.GetProperty().SetPointSize(5)\n\n    # assign actor to the renderer\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('RoyalBLue'))\n\n    # enable user interface interactor\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/ProgrammableGlyphFilter/","title":"ProgrammableGlyphFilter","text":"

        vtk-examples/Python/Visualization/ProgrammableGlyphFilter

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/ProgrammableGlyphFilter/#code","title":"Code","text":"

        ProgrammableGlyphFilter.py

        #!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkFiltersProgrammable import vtkProgrammableGlyphFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n\n    # Create points.\n    points = vtkPoints()\n    points.InsertNextPoint(0, 0, 0)\n    points.InsertNextPoint(5, 0, 0)\n    points.InsertNextPoint(10, 0, 0)\n\n    # Combine into a polydata.\n    polydata = vtkPolyData()\n    polydata.SetPoints(points)\n\n    glyph_filter = vtkProgrammableGlyphFilter()\n    glyph_filter.SetInputData(polydata)\n    # Create the observer.\n    observer = CalcGlyph(glyph_filter)\n    glyph_filter.SetGlyphMethod(observer)\n    # It needs a default glyph, but this should not be used.\n    cone_source = vtkConeSource()\n    glyph_filter.SetSourceConnection(cone_source.GetOutputPort())\n\n    # Create a mapper and actor.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(glyph_filter.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('Gold'))\n\n    # Create a renderer, render window, and interactor.\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetWindowName('ProgrammableGlyphFilter')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Add the actor to the scene.\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Render and interact.\n    ren_win.Render()\n    renderer.GetActiveCamera().Zoom(0.9)\n    iren.Start()\n\n\nclass CalcGlyph(object):\n    def __init__(self, glyph_filter):\n        self.glyph_filter = glyph_filter\n\n    def __call__(self):\n        point_coords = self.glyph_filter.GetPoint()\n\n        print('Calling CalcGlyph for point ', self.glyph_filter.GetPointId())\n        print('Point coords are: ', point_coords[0], point_coords[1], point_coords[2])\n        if self.glyph_filter.GetPointId() == 0:\n            cone_source = vtkConeSource()\n            cone_source.SetCenter(point_coords)\n            self.glyph_filter.SetSourceConnection(cone_source.GetOutputPort())\n        elif self.glyph_filter.GetPointId() == 1:\n            cube_source = vtkCubeSource()\n            cube_source.SetCenter(point_coords)\n            self.glyph_filter.SetSourceConnection(cube_source.GetOutputPort())\n        elif self.glyph_filter.GetPointId() == 2:\n            sphere_source = vtkSphereSource()\n            sphere_source.SetCenter(point_coords)\n            self.glyph_filter.SetSourceConnection(sphere_source.GetOutputPort())\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Visualization/ProgrammableGlyphs/","title":"ProgrammableGlyphs","text":"

        vtk-examples/Python/Visualization/ProgrammableGlyphs

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/ProgrammableGlyphs/#code","title":"Code","text":"

        ProgrammableGlyphs.py

        #!/usr/bin/env python\n\n# Python example translated directly from Tcl test\n# [vtk_source]/Graphics/Testing/Tcl/progGlyphs.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkElevationFilter\nfrom vtkmodules.vtkFiltersProgrammable import vtkProgrammableGlyphFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkPlaneSource,\n    vtkSuperquadricSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    res = 6\n    plane = vtkPlaneSource()\n    plane.SetResolution(res, res)\n    colors = vtkElevationFilter()\n    colors.SetInputConnection(plane.GetOutputPort())\n    colors.SetLowPoint(-0.25, -0.25, -0.25)\n    colors.SetHighPoint(0.25, 0.25, 0.25)\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputData(colors.GetPolyDataOutput())\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n    planeActor.GetProperty().SetRepresentationToWireframe()\n\n    # create simple poly data so we can apply glyph\n    squad = vtkSuperquadricSource()\n\n    def Glyph():\n        \"\"\"\n        # procedure for generating glyphs\n        :return:\n        \"\"\"\n        xyz = glypher.GetPoint()\n        x = xyz[0]\n        y = xyz[1]\n        length = glypher.GetInput(0).GetLength()\n        scale = length / (2.0 * res)\n\n        squad.SetScale(scale, scale, scale)\n        squad.SetCenter(xyz)\n        squad.SetPhiRoundness(abs(x) * 5.0)\n        squad.SetThetaRoundness(abs(y) * 5.0)\n\n    glypher = vtkProgrammableGlyphFilter()\n    glypher.SetInputConnection(colors.GetOutputPort())\n    glypher.SetSourceConnection(squad.GetOutputPort())\n    glypher.SetGlyphMethod(Glyph)\n    glyphMapper = vtkPolyDataMapper()\n    glyphMapper.SetInputConnection(glypher.GetOutputPort())\n    glyphActor = vtkActor()\n    glyphActor.SetMapper(glyphMapper)\n\n    colors = vtkNamedColors()\n\n    # Create the rendering stuff\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.SetMultiSamples(0)\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n    ren1.AddActor(planeActor)\n    ren1.AddActor(glyphActor)\n    ren1.SetBackground(colors.GetColor3d('Silver'))\n\n    renWin.SetSize(450, 450)\n    renWin.SetWindowName('ProgrammableGlyphs')\n    renWin.Render()\n\n    ren1.GetActiveCamera().Zoom(1.3)\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/QuadricVisualization/","title":"QuadricVisualization","text":"

        vtk-examples/Python/Visualization/QuadricVisualization

        "},{"location":"Python/Visualization/QuadricVisualization/#description","title":"Description","text":"

        Visualizing a quadric function F(x,y,z) = c

        This example is inspired by the Figure 4-1, page 83, in the VTK Book.

        Info

        See Figure 4-1 in Chapter 4 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/QuadricVisualization/#code","title":"Code","text":"

        QuadricVisualization.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendFilter,\n    vtkContourFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingCore import vtkExtractVOI\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    renderer = vtkRenderer()\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n    renderWindow.SetSize(640, 480)\n\n    #\n    # Create surface of implicit function.\n    #\n\n    # Sample quadric function.\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(1, 2, 3, 0, 1, 0, 0, 0, 0, 0)\n\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(25, 25, 25)\n    sample.SetImplicitFunction(quadric)\n\n    isoActor = vtkActor()\n    CreateIsosurface(sample, isoActor)\n    outlineIsoActor = vtkActor()\n    CreateOutline(sample, outlineIsoActor)\n\n    planesActor = vtkActor()\n    CreatePlanes(sample, planesActor, 3)\n    outlinePlanesActor = vtkActor()\n    CreateOutline(sample, outlinePlanesActor)\n    planesActor.AddPosition(isoActor.GetBounds()[0] * 2.0, 0, 0)\n    outlinePlanesActor.AddPosition(isoActor.GetBounds()[0] * 2.0, 0, 0)\n\n    contourActor = vtkActor()\n    CreateContours(sample, contourActor, 3, 15)\n    outlineContourActor = vtkActor()\n    CreateOutline(sample, outlineContourActor)\n    contourActor.AddPosition(isoActor.GetBounds()[0] * 4.0, 0, 0)\n    outlineContourActor.AddPosition(isoActor.GetBounds()[0] * 4.0, 0, 0)\n\n    renderer.AddActor(planesActor)\n    renderer.AddActor(outlinePlanesActor)\n    renderer.AddActor(contourActor)\n    renderer.AddActor(outlineContourActor)\n    renderer.AddActor(isoActor)\n    renderer.AddActor(outlineIsoActor)\n\n    renderer.TwoSidedLightingOn()\n\n    renderer.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    # Try to set camera to match figure on book\n    renderer.GetActiveCamera().SetPosition(0, -1, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 0, -1)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Elevation(20)\n    renderer.GetActiveCamera().Azimuth(10)\n    renderer.GetActiveCamera().Dolly(1.2)\n    renderer.ResetCameraClippingRange()\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('QuadricVisualization');\n\n    renderWindow.Render()\n\n    # interact with data\n    interactor.Start()\n\n\ndef CreateIsosurface(func, actor, numberOfContours=5):\n    # Generate implicit surface.\n    contour = vtkContourFilter()\n    contour.SetInputConnection(func.GetOutputPort())\n    ranges = [1.0, 6.0]\n    contour.GenerateValues(numberOfContours, ranges)\n\n    # Map contour\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contour.GetOutputPort())\n    contourMapper.SetScalarRange(0, 7)\n\n    actor.SetMapper(contourMapper)\n    return\n\n\ndef CreatePlanes(func, actor, numberOfPlanes):\n    #\n    # Extract planes from implicit function.\n    #\n\n    append = vtkAppendFilter()\n\n    dims = func.GetSampleDimensions()\n    sliceIncr = (dims[2] - 1) // (numberOfPlanes + 1)\n    sliceNum = -4\n    for i in range(0, numberOfPlanes):\n        extract = vtkExtractVOI()\n        extract.SetInputConnection(func.GetOutputPort())\n        extract.SetVOI(0, dims[0] - 1,\n                       0, dims[1] - 1,\n                       sliceNum + sliceIncr, sliceNum + sliceIncr)\n        append.AddInputConnection(extract.GetOutputPort())\n        sliceNum += sliceIncr\n    append.Update()\n\n    # Map planes\n    planesMapper = vtkDataSetMapper()\n    planesMapper.SetInputConnection(append.GetOutputPort())\n    planesMapper.SetScalarRange(0, 7)\n\n    actor.SetMapper(planesMapper)\n    actor.GetProperty().SetAmbient(1.)\n    return\n\n\ndef CreateContours(func, actor, numberOfPlanes, numberOfContours):\n    #\n    # Extract planes from implicit function\n    #\n\n    append = vtkAppendFilter()\n\n    dims = func.GetSampleDimensions()\n    sliceIncr = (dims[2] - 1) // (numberOfPlanes + 1)\n\n    sliceNum = -4\n    for i in range(0, numberOfPlanes):\n        extract = vtkExtractVOI()\n        extract.SetInputConnection(func.GetOutputPort())\n        extract.SetVOI(0, dims[0] - 1,\n                       0, dims[1] - 1,\n                       sliceNum + sliceIncr, sliceNum + sliceIncr)\n        ranges = [1.0, 6.0]\n        contour = vtkContourFilter()\n        contour.SetInputConnection(extract.GetOutputPort())\n        contour.GenerateValues(numberOfContours, ranges)\n        append.AddInputConnection(contour.GetOutputPort())\n        sliceNum += sliceIncr\n    append.Update()\n\n    # Map planes\n    planesMapper = vtkDataSetMapper()\n    planesMapper.SetInputConnection(append.GetOutputPort())\n    planesMapper.SetScalarRange(0, 7)\n\n    actor.SetMapper(planesMapper)\n    actor.GetProperty().SetAmbient(1.)\n    return\n\n\ndef CreateOutline(source, actor):\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(source.GetOutputPort())\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(outline.GetOutputPort())\n    actor.SetMapper(mapper)\n    return\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/ShadowsLightsDemo/","title":"ShadowsLightsDemo","text":"

        vtk-examples/Python/Visualization/ShadowsLightsDemo

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/ShadowsLightsDemo/#code","title":"Code","text":"

        ShadowsLightsDemo.py

        #!/usr/bin/env python3\n\n\"\"\"\nThe scene consists of:\n1) four actors: a rectangle, a box, a cone and a sphere.\n   The box, the cone and the sphere are above the rectangle.\n2) Two spotlights, one in the direction of the box, another one in the\n   direction of the sphere.\n   Both lights are above the box, the cone and  the sphere.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkCubeSource,\n    vtkPlaneSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkLight,\n    vtkLightActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor\n)\nfrom vtkmodules.vtkRenderingOpenGL2 import (\n    vtkCameraPass,\n    vtkOpaquePass,\n    vtkOpenGLRenderer,\n    vtkRenderPassCollection,\n    vtkSequencePass,\n    vtkShadowMapPass\n)\n\n\ndef main():\n    iren = vtkRenderWindowInteractor()\n\n    renwin = vtkRenderWindow()\n    renwin.SetSize(400, 400)\n    renwin.SetMultiSamples(0)\n\n    renwin.SetAlphaBitPlanes(1)\n    iren.SetRenderWindow(renwin)\n\n    renderer = vtkOpenGLRenderer()\n    renwin.AddRenderer(renderer)\n    renwin.SetSize(640, 480)\n\n    seq = vtkSequencePass()\n\n    passes = vtkRenderPassCollection()\n\n    shadows = vtkShadowMapPass()\n    passes.AddItem(shadows.GetShadowMapBakerPass())\n    passes.AddItem(shadows)\n\n    opaque = vtkOpaquePass()\n    passes.AddItem(opaque)\n\n    seq.SetPasses(passes)\n\n    camera_p = vtkCameraPass()\n    camera_p.SetDelegatePass(seq)\n\n    # Tell the renderer to use our render pass pipeline.\n    renderer.SetPass(camera_p)\n\n    colors = vtkNamedColors()\n    box_color = colors.GetColor3d('Tomato')\n    rectangle_color = colors.GetColor3d('Beige')\n    cone_color = colors.GetColor3d('Peacock')\n    sphere_color = colors.GetColor3d('Banana')\n\n    rectangle_source = vtkPlaneSource()\n    rectangle_source.SetOrigin(-5.0, 0.0, 5.0)\n    rectangle_source.SetPoint1(5.0, 0.0, 5.0)\n    rectangle_source.SetPoint2(-5.0, 0.0, -5.0)\n    rectangle_source.SetResolution(100, 100)\n\n    rectangle_mapper = vtkPolyDataMapper()\n    rectangle_mapper.SetInputConnection(rectangle_source.GetOutputPort())\n\n    rectangle_mapper.SetScalarVisibility(0)\n\n    rectangle_actor = vtkActor()\n    rectangle_actor.SetMapper(rectangle_mapper)\n    rectangle_actor.VisibilityOn()\n    rectangle_actor.GetProperty().SetColor(rectangle_color)\n\n    box_source = vtkCubeSource()\n    box_source.SetXLength(2.0)\n\n    box_normals = vtkPolyDataNormals()\n    box_normals.SetInputConnection(box_source.GetOutputPort())\n    box_normals.ComputePointNormalsOff()\n    box_normals.ComputeCellNormalsOn()\n    box_normals.Update()\n    box_normals.GetOutput().GetPointData().SetNormals(None)\n\n    box_mapper = vtkPolyDataMapper()\n    box_mapper.SetInputConnection(box_normals.GetOutputPort())\n    box_mapper.ScalarVisibilityOff()\n\n    box_actor = vtkActor()\n    box_actor.SetMapper(box_mapper)\n    box_actor.VisibilityOn()\n    box_actor.SetPosition(-2.0, 2.0, 0.0)\n    box_actor.GetProperty().SetColor(box_color)\n\n    cone_source = vtkConeSource()\n    cone_source.SetResolution(24)\n    cone_source.SetDirection(1.0, 1.0, 1.0)\n\n    cone_mapper = vtkPolyDataMapper()\n    cone_mapper.SetInputConnection(cone_source.GetOutputPort())\n    cone_mapper.SetScalarVisibility(0)\n\n    cone_actor = vtkActor()\n    cone_actor.SetMapper(cone_mapper)\n    cone_actor.VisibilityOn()\n    cone_actor.SetPosition(0.0, 1.0, 1.0)\n    cone_actor.GetProperty().SetColor(cone_color)\n\n    sphere_source = vtkSphereSource()\n    sphere_source.SetThetaResolution(32)\n    sphere_source.SetPhiResolution(32)\n\n    sphere_mapper = vtkPolyDataMapper()\n    sphere_mapper.SetInputConnection(sphere_source.GetOutputPort())\n    sphere_mapper.ScalarVisibilityOff()\n\n    sphere_actor = vtkActor()\n    sphere_actor.SetMapper(sphere_mapper)\n\n    sphere_actor.VisibilityOn()\n    sphere_actor.SetPosition(2.0, 2.0, -1.0)\n    sphere_actor.GetProperty().SetColor(sphere_color)\n\n    renderer.AddViewProp(rectangle_actor)\n    renderer.AddViewProp(box_actor)\n    renderer.AddViewProp(cone_actor)\n    renderer.AddViewProp(sphere_actor)\n\n    # Spotlights.\n\n    # Lighting the box.\n    l1 = vtkLight()\n    l1.SetPosition(-4.0, 4.0, -1.0)\n    l1.SetFocalPoint(box_actor.GetPosition())\n    l1.SetColor(colors.GetColor3d('White'))\n    l1.PositionalOn()\n    renderer.AddLight(l1)\n    l1.SwitchOn()\n\n    # Lighting the sphere.\n    l2 = vtkLight()\n    l2.SetPosition(4.0, 5.0, 1.0)\n    l2.SetFocalPoint(sphere_actor.GetPosition())\n    l2.SetColor(colors.GetColor3d('Magenta'))\n    l2.PositionalOn()\n    renderer.AddLight(l2)\n    l2.SwitchOn()\n\n    # For each spotlight, add a light frustum wireframe representation and a cone\n    # wireframe representation, colored with the light color.\n    angle = l1.GetConeAngle()\n    if l1.LightTypeIsSceneLight() and l1.GetPositional() and angle < 180.0:  # spotlight\n        la = vtkLightActor()\n        la.SetLight(l1)\n        renderer.AddViewProp(la)\n    angle = l2.GetConeAngle()\n    if l2.LightTypeIsSceneLight() and l2.GetPositional() and angle < 180.0:  # spotlight\n        la = vtkLightActor()\n        la.SetLight(l2)\n        renderer.AddViewProp(la)\n\n    renderer.SetBackground2(colors.GetColor3d('Black'))\n    renderer.SetBackground(colors.GetColor3d('Silver'))\n    renderer.SetGradientBackground(True)\n\n    renwin.Render()\n    renwin.SetWindowName('ShadowsLightsDemo')\n\n    renderer.ResetCamera()\n\n    camera = renderer.GetActiveCamera()\n    camera.Azimuth(40.0)\n    camera.Elevation(10.0)\n\n    renwin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/SphereTexture/","title":"SphereTexture","text":"

        vtk-examples/Python/Visualization/SphereTexture

        "},{"location":"Python/Visualization/SphereTexture/#description","title":"Description","text":"

        This example shows how to apply an vtkImageData texture to an sphere vtkPolyData object. There is a sample data file src/Testing/Data/masonry-wide.jpg.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/SphereTexture/#code","title":"Code","text":"

        SphereTexture.py

        #!/usr/bin/env python\n\n##\n# This example shows how to apply an vtkImageData texture to an sphere\n# vtkPolyData object.\n# Note: Input jpg file can be located in the VTKData repository.\n#\n# @author JBallesteros\n##\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkFiltersTexture import vtkTextureMapToSphere\nfrom vtkmodules.vtkIOImage import vtkJPEGReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Texture an object with an image.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='masonry-wide.jpg.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    jpegfile = get_program_parameters()\n\n    # Create a render window\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(480, 480)\n    renWin.SetWindowName('SphereTexture')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Generate an sphere polydata\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(12)\n    sphere.SetPhiResolution(12)\n\n    # Read the image data from a file\n    reader = vtkJPEGReader()\n    reader.SetFileName(jpegfile)\n\n    # Create texture object\n    texture = vtkTexture()\n    texture.SetInputConnection(reader.GetOutputPort())\n\n    # Map texture coordinates\n    map_to_sphere = vtkTextureMapToSphere()\n    map_to_sphere.SetInputConnection(sphere.GetOutputPort())\n    map_to_sphere.PreventSeamOn()\n\n    # Create mapper and set the mapped texture as input\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(map_to_sphere.GetOutputPort())\n\n    # Create actor and set the mapper and the texture\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.SetTexture(texture)\n\n    ren.AddActor(actor)\n    ren.SetBackground(colors.GetColor3d('RosyBrown'))\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/StreamLines/","title":"StreamLines","text":"

        vtk-examples/Python/Visualization/StreamLines

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/StreamLines/#code","title":"Code","text":"

        StreamLines.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Streamlines.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('xyz_file', help='combxyz.bin.')\n    parser.add_argument('q_file', help='combq.bin.')\n    args = parser.parse_args()\n    return args.xyz_file, args.q_file\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])\n\n    xyz_file, q_file = get_program_parameters()\n\n    # Read the data.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(xyz_file)\n    pl3d.SetQFileName(q_file)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    seeds = vtkPlaneSource()\n    seeds.SetXResolution(4)\n    seeds.SetYResolution(4)\n    seeds.SetOrigin(2, -2, 26)\n    seeds.SetPoint1(2, 2, 26)\n    seeds.SetPoint2(2, -2, 32)\n\n    streamline = vtkStreamTracer()\n    streamline.SetInputData(pl3d.GetOutput().GetBlock(0))\n    streamline.SetSourceConnection(seeds.GetOutputPort())\n    streamline.SetMaximumPropagation(200)\n    streamline.SetInitialIntegrationStep(.2)\n    streamline.SetIntegrationDirectionToForward()\n\n    streamline_mapper = vtkPolyDataMapper()\n    streamline_mapper.SetInputConnection(streamline.GetOutputPort())\n    streamline_actor = vtkActor()\n    streamline_actor.SetMapper(streamline_mapper)\n    streamline_actor.VisibilityOn()\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3d.GetOutput().GetBlock(0))\n    outline_mapper = vtkPolyDataMapper()\n    outline_mapper.SetInputConnection(outline.GetOutputPort())\n    outline_actor = vtkActor()\n    outline_actor.SetMapper(outline_mapper)\n    outline_actor.GetProperty().SetColor(colors.GetColor3d('White'))\n\n    renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetWindowName('StreamLines')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetInteractorStyle(vtkInteractorStyleTrackballCamera())\n    render_window.SetInteractor(interactor)\n\n    renderer.AddActor(streamline_actor)\n    renderer.AddActor(outline_actor)\n\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n    interactor.Initialize()\n    render_window.Render()\n    renderer.GetActiveCamera().SetPosition(-32.8, -12.3, 46.3)\n    renderer.GetActiveCamera().SetFocalPoint(8.3, 0.03, 29.8)\n    renderer.GetActiveCamera().SetViewUp(0.2, 0.5, 0.9)\n    render_window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/TextSource/","title":"TextSource","text":"

        vtk-examples/Python/Visualization/TextSource

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/TextSource/#code","title":"Code","text":"

        TextSource.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkTextSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    textSource = vtkTextSource()\n    textSource.SetText(\"Hello\")\n    textSource.SetForegroundColor(colors.GetColor3d('DarkSlateGray'))\n    textSource.SetBackgroundColor(colors.GetColor3d('NavajoWhite'))\n    # Turn off if you don't want the background drawn with the text.\n    textSource.BackingOn()\n    textSource.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(textSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('TextSource')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Bisque'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/VectorText/","title":"VectorText","text":"

        vtk-examples/Python/Visualization/VectorText

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/VectorText/#code","title":"Code","text":"

        VectorText.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    textSource = vtkVectorText()\n    textSource.SetText('Hello')\n    textSource.Update()\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(textSource.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('DarkSlateGray'))\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('VectorText')\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('Bisque'))\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Visualization/WindowTitle/","title":"WindowTitle","text":"

        vtk-examples/Python/Visualization/WindowTitle

        "},{"location":"Python/Visualization/WindowTitle/#description","title":"Description","text":"

        This example demonstrates how to change the title of a render window.

        • Contributed by Bryan P. Conrad

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Visualization/WindowTitle/#code","title":"Code","text":"

        WindowTitle.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    sphereSource = vtkSphereSource()\n    sphereSource.SetCenter(0.0, 0.0, 0.0)\n    sphereSource.SetRadius(5)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(sphereSource.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # Setup a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    # renderWindow.SetWindowName('Test')\n\n    renderWindow.AddRenderer(renderer)\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Render and interact\n    renderWindow.Render()\n    # *** SetWindowName after renderWindow.Render() is called ***\n    renderWindow.SetWindowName('WindowTitle')\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/AnatomicalOrientation/","title":"AnatomicalOrientation","text":"

        vtk-examples/Python/VisualizationAlgorithms/AnatomicalOrientation

        "},{"location":"Python/VisualizationAlgorithms/AnatomicalOrientation/#description","title":"Description","text":"

        This depicts a human figure transected by the three commonly used anatomical planes:

        • Sagittal plane \u2013 is perpendicular to the ground divides the body into a left section and a right section.
        • Coronal plane \u2013 is perpendicular to the ground and divides the body into a front (anterior) section and back (posterior) section.
        • Transverse plane \u2013 or axial plane is parallel to the ground divides the body into an upper (superior) section and a bottom (inferior) section.

        Four annotated cube actors are also provided demonstrating different coordinate systems. The annotations on the faces of the cube actors are:

        • Sagittal plane
          • L - left.
          • R - right.
        • Coronal plane
          • A - anterior.
          • P - posterior.
        • Transverse plane
          • S - superior.
          • I - inferior.

        The annotated cube actors demonstrate the various coordinate systems: - The anatomical coordinate system forming a 3D basis is defined along the anatomical axes of anterior-posterior, inferior-superior, and left-right. These are the positive directions. In a Cartesian system this is RPS (Right, Posterior, Superior). The top-left annotated cube actor shows this basis, this is a left-handed system. - RAS (Right, Anterior, Superior), left-right, posterior-anterior, and inferior-superior. This is the usual right-handed system used by VTK and Slicer. The bottom left annotated cube actor shows this basis. - LPS (Left, Posterior, Superior), right-left, anterior-posterior, and inferior-superior. This is used in DICOM images and by the ITK toolkit. The bottom right annotated cube actor shows this basis. - The upper right cube actor has no axes and simply shows the planes.

        RPS is a left-handed system whilst RAS and LPS are right-handed.

        Note that the text for the planes is carefully placed to avoid obstructing the figure and it also sits slightly above the plane.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/AnatomicalOrientation/#code","title":"Code","text":"

        AnatomicalOrientation.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nThe human data file is taken from:\n  https://github.com/Slicer/Slicer/blob/master/Base/Logic/Resources/OrientationMarkers/Human.vtp\n  Thanks to the Slicer people for providing this.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import (\n    vtkAnnotatedCubeActor,\n    vtkAxesActor\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkPropAssembly,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Create a rendering window, renderer and interactor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.SetSize(780, 780)\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Make an annotated cube actor with axes and then add it into an orientation marker widget.\n    # Three of these need to be made.\n\n    # Right Posterior Superior\n    xyzLabels = ['X', 'Y', 'Z']\n    scale = [1.5, -1.5, 1.5]\n    axes = MakeCubeActor(scale, xyzLabels, colors)\n    om = vtkOrientationMarkerWidget()\n    om.SetOrientationMarker(axes)\n    # Position upper left in the viewport.\n    om.SetViewport(0.0, 0.8, 0.2, 1.0)\n    om.SetInteractor(iren)\n    om.EnabledOn()\n    om.InteractiveOn()\n\n    # Right, Anterior, Superior.\n    scale = [1.5, 1.5, 1.5]\n    axes1 = MakeCubeActor(scale, xyzLabels, colors)\n    om1 = vtkOrientationMarkerWidget()\n    om1.SetOrientationMarker(axes1)\n    # Position lower left in the viewport.\n    om1.SetViewport(0, 0, 0.2, 0.2)\n    om1.SetInteractor(iren)\n    om1.EnabledOn()\n    om1.InteractiveOn()\n\n    # Left, Posterior, Superior.\n    scale = (-1.5, -1.5, 1.5)\n    axes2 = MakeCubeActor(scale, xyzLabels, colors)\n    om2 = vtkOrientationMarkerWidget()\n    om2.SetOrientationMarker(axes2)\n    # Position lower right in the viewport.\n    om2.SetViewport(0.8, 0, 1.0, 0.2)\n    om2.SetInteractor(iren)\n    om2.EnabledOn()\n    om2.InteractiveOn()\n\n    # Finally create an annotated cube actor adding it into an orientation marker widget.\n    axes3 = MakeAnnotatedCubeActor(colors)\n    om3 = vtkOrientationMarkerWidget()\n    om3.SetOrientationMarker(axes3)\n    # Position upper right in the viewport.\n    om3.SetViewport(0.8, 0.8, 1.0, 1.0)\n    om3.SetInteractor(iren)\n    om3.EnabledOn()\n    om3.InteractiveOn()\n\n    # Read in the model.\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    humanMapper = vtkPolyDataMapper()\n    humanMapper.SetInputConnection(reader.GetOutputPort())\n    humanMapper.SetScalarModeToUsePointFieldData()\n    humanMapper.SelectColorArray('Color')\n    humanMapper.SetColorModeToDirectScalars()\n\n    humanActor = vtkActor()\n    humanActor.SetMapper(humanMapper)\n    bounds = humanActor.GetBounds()\n    # Scale the actor\n    humanActor.SetScale(1.0 / max(bounds))\n    ren.AddActor(humanActor)\n\n    # Make the planes.\n    actors = MakePlanesActors(colors)\n    for actor in actors:\n        ren.AddViewProp(actor)\n    # Label them.\n    textActors = AddTextToPlanes()\n    for actor in textActors:\n        ren.AddViewProp(actor)\n\n    # Interact\n    ren.SetBackground2(colors.GetColor3d('OldLace'))\n    ren.SetBackground(colors.GetColor3d('MistyRose'))\n    ren.GradientBackgroundOn()\n    ren.ResetCamera()\n    ren.GetActiveCamera().Zoom(1.6)\n    ren.GetActiveCamera().SetPosition(-2.3, 4.1, 4.2)\n    # ren.GetActiveCamera().SetPosition(-3.4, 5.5, 0.0)\n    ren.GetActiveCamera().SetViewUp(0.0, 0.0, 1.0)\n    ren.ResetCameraClippingRange()\n    renWin.Render()\n    # Call SetWindowName after renWin.Render() is called.\n    renWin.SetWindowName('AnatomicalOrientation')\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Show a labelled set of anatomical planes transecting a human figure.'\n    epilogue = '''\n    Show a labelled set of anatomical planes transecting a human figure.\n    Annotated cube actors and axes for the various coordinate systems are also shown.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Human.vtp.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef MakeAxesActor(scale, xyzLabels):\n    \"\"\"\n    :param scale: Sets the scale and direction of the axes.\n    :param xyzLabels: Labels for the axes.\n    :return: The axes actor.\n    \"\"\"\n    axes = vtkAxesActor()\n    axes.SetScale(scale)\n    axes.SetShaftTypeToCylinder()\n    axes.SetXAxisLabelText(xyzLabels[0])\n    axes.SetYAxisLabelText(xyzLabels[1])\n    axes.SetZAxisLabelText(xyzLabels[2])\n    axes.SetCylinderRadius(0.5 * axes.GetCylinderRadius())\n    axes.SetConeRadius(1.025 * axes.GetConeRadius())\n    axes.SetSphereRadius(1.5 * axes.GetSphereRadius())\n    tprop = axes.GetXAxisCaptionActor2D().GetCaptionTextProperty()\n    tprop.ItalicOn()\n    tprop.ShadowOn()\n    tprop.SetFontFamilyToTimes()\n    # Use the same text properties on the other two axes.\n    axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().ShallowCopy(tprop)\n    return axes\n\n\ndef MakeAnnotatedCubeActor(colors):\n    \"\"\"\n    :param colors: Used to determine the cube color.\n    :return: The annotated cube actor.\n    \"\"\"\n    # A cube with labeled faces.\n    cube = vtkAnnotatedCubeActor()\n    cube.SetXPlusFaceText('R')  # Right\n    cube.SetXMinusFaceText('L')  # Left\n    cube.SetYPlusFaceText('A')  # Anterior\n    cube.SetYMinusFaceText('P')  # Posterior\n    cube.SetZPlusFaceText('S')  # Superior/Cranial\n    cube.SetZMinusFaceText('I')  # Inferior/Caudal\n    cube.SetFaceTextScale(0.5)\n    cube.GetCubeProperty().SetColor(colors.GetColor3d('Gainsboro'))\n\n    cube.GetTextEdgesProperty().SetColor(colors.GetColor3d('LightSlateGray'))\n\n    # Change the vector text colors.\n    cube.GetXPlusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetXMinusFaceProperty().SetColor(colors.GetColor3d('Tomato'))\n    cube.GetYPlusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetYMinusFaceProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))\n    cube.GetZPlusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    cube.GetZMinusFaceProperty().SetColor(colors.GetColor3d('SeaGreen'))\n    return cube\n\n\ndef MakeCubeActor(scale, xyzLabels, colors):\n    \"\"\"\n    :param scale: Sets the scale and direction of the axes.\n    :param xyzLabels: Labels for the axes.\n    :param colors: Used to set the colors of the cube faces.\n    :return: The combined axes and annotated cube prop.\n    \"\"\"\n    # We are combining a vtkAxesActor and a vtkAnnotatedCubeActor\n    # into a vtkPropAssembly\n    cube = MakeAnnotatedCubeActor(colors)\n    axes = MakeAxesActor(scale, xyzLabels)\n\n    # Combine orientation markers into one with an assembly.\n    assembly = vtkPropAssembly()\n    assembly.AddPart(axes)\n    assembly.AddPart(cube)\n    return assembly\n\n\ndef MakePlane(resolution, origin, point1, point2, wxyz, translate):\n    plane = vtkPlaneSource()\n    plane.SetResolution(*resolution)\n    plane.SetOrigin(origin)\n    plane.SetPoint1(point1)\n    plane.SetPoint2(point2)\n    trnf = vtkTransform()\n    trnf.RotateWXYZ(*wxyz)\n    trnf.Translate(translate)\n    tpdPlane = vtkTransformPolyDataFilter()\n    tpdPlane.SetTransform(trnf)\n    tpdPlane.SetInputConnection(plane.GetOutputPort())\n    return tpdPlane\n\n\ndef MakePlanesActors(colors):\n    \"\"\"\n    Make the traverse, coronal and saggital planes.\n    :param colors: Used to set the color of the planes.\n    :return: The planes actors.\n    \"\"\"\n    planes = list()\n    mappers = list()\n    actors = list()\n\n    # Parameters for a plane lying in the x-y plane.\n    resolution = [10, 10]\n    origin = [0.0, 0.0, 0.0]\n    point1 = [1, 0, 0]\n    point2 = [0, 1, 0]\n\n    planes.append(MakePlane(resolution, origin, point1, point2, [0, 0, 0, 0], [-0.5, -0.5, 0]))  # x-y plane\n    planes.append(MakePlane(resolution, origin, point1, point2, [-90, 1, 0, 0], [-0.5, -0.5, 0.0]))  # x-z plane\n    planes.append(MakePlane(resolution, origin, point1, point2, [-90, 0, 1, 0], [-0.5, -0.5, 0.0]))  # y-z plane\n    for plane in planes:\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(plane.GetOutputPort())\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n        mappers.append(mapper)\n        actors.append(actor)\n    actors[0].GetProperty().SetColor(colors.GetColor3d('SeaGreen'))  # Transverse plane\n    actors[1].GetProperty().SetColor(colors.GetColor3d('DeepSkyBlue'))  # Coronal plane\n    actors[2].GetProperty().SetColor(colors.GetColor3d('Tomato'))  # Saggital plane\n    return actors\n\n\ndef AddTextToPlanes():\n    \"\"\"\n    Generate text to place on the planes.\n    Careful placement is needed here.\n    :return: The text actors.\n    \"\"\"\n    textActors = list()\n    scale = [0.04, 0.04, 0.04]\n\n    text1 = vtkVectorText()\n    text1.SetText('Transverse\\nPlane\\n\\nSuperior\\nCranial')\n    trnf1 = vtkTransform()\n    trnf1.RotateZ(-90)\n    tpdPlane1 = vtkTransformPolyDataFilter()\n    tpdPlane1.SetTransform(trnf1)\n    tpdPlane1.SetInputConnection(text1.GetOutputPort())\n    textMapper1 = vtkPolyDataMapper()\n    textMapper1.SetInputConnection(tpdPlane1.GetOutputPort())\n    textActor1 = vtkActor()\n    textActor1.SetMapper(textMapper1)\n    textActor1.SetScale(scale)\n    textActor1.AddPosition(0.4, 0.49, 0.01)\n    textActors.append(textActor1)\n\n    text2 = vtkVectorText()\n    text2.SetText('Transverse\\nPlane\\n\\nInferior\\n(Caudal)')\n    trnf2 = vtkTransform()\n    trnf2.RotateZ(270)\n    trnf2.RotateWXYZ(*[180, 0, 1, 0])\n    tpdPlane2 = vtkTransformPolyDataFilter()\n    tpdPlane2.SetTransform(trnf2)\n    tpdPlane2.SetInputConnection(text2.GetOutputPort())\n    textMapper2 = vtkPolyDataMapper()\n    textMapper2.SetInputConnection(tpdPlane2.GetOutputPort())\n    textActor2 = vtkActor()\n    textActor2.SetMapper(textMapper2)\n    textActor2.SetScale(scale)\n    textActor2.AddPosition(0.4, -0.49, -0.01)\n    textActors.append(textActor2)\n\n    text3 = vtkVectorText()\n    text3.SetText('Sagittal\\nPlane\\n\\nLeft')\n    trnf3 = vtkTransform()\n    trnf3.RotateX(90)\n    trnf3.RotateWXYZ(*[-90, 0, 1, 0])\n    tpdPlane3 = vtkTransformPolyDataFilter()\n    tpdPlane3.SetTransform(trnf3)\n    tpdPlane3.SetInputConnection(text3.GetOutputPort())\n    textMapper3 = vtkPolyDataMapper()\n    textMapper3.SetInputConnection(tpdPlane3.GetOutputPort())\n    textActor3 = vtkActor()\n    textActor3.SetMapper(textMapper3)\n    textActor3.SetScale(scale)\n    textActor3.AddPosition(-0.01, 0.49, 0.4)\n    textActors.append(textActor3)\n\n    text4 = vtkVectorText()\n    text4.SetText('Sagittal\\nPlane\\n\\nRight')\n    trnf4 = vtkTransform()\n    trnf4.RotateX(90)\n    trnf4.RotateWXYZ(*[-270, 0, 1, 0])\n    tpdPlane4 = vtkTransformPolyDataFilter()\n    tpdPlane4.SetTransform(trnf4)\n    tpdPlane4.SetInputConnection(text4.GetOutputPort())\n    textMapper4 = vtkPolyDataMapper()\n    textMapper4.SetInputConnection(tpdPlane4.GetOutputPort())\n    textActor4 = vtkActor()\n    textActor4.SetMapper(textMapper4)\n    textActor4.SetScale(scale)\n    textActor4.AddPosition(0.01, -0.49, 0.4)\n    textActors.append(textActor4)\n\n    text5 = vtkVectorText()\n    text5.SetText('Coronal\\nPlane\\n\\nAnterior')\n    trnf5 = vtkTransform()\n    trnf5.RotateY(-180)\n    trnf5.RotateWXYZ(*[-90, 1, 0, 0])\n    tpdPlane5 = vtkTransformPolyDataFilter()\n    tpdPlane5.SetTransform(trnf5)\n    tpdPlane5.SetInputConnection(text5.GetOutputPort())\n    textMapper5 = vtkPolyDataMapper()\n    textMapper5.SetInputConnection(tpdPlane5.GetOutputPort())\n    textActor5 = vtkActor()\n    textActor5.SetMapper(textMapper5)\n    textActor5.SetScale(scale)\n    textActor5.AddPosition(0.49, 0.01, 0.20)\n    textActors.append(textActor5)\n\n    text6 = vtkVectorText()\n    text6.SetText('Coronal\\nPlane\\n\\nPosterior')\n    trnf6 = vtkTransform()\n    trnf6.RotateWXYZ(*[90, 1, 0, 0])\n    tpdPlane6 = vtkTransformPolyDataFilter()\n    tpdPlane6.SetTransform(trnf6)\n    tpdPlane6.SetInputConnection(text6.GetOutputPort())\n    textMapper6 = vtkPolyDataMapper()\n    textMapper6.SetInputConnection(tpdPlane6.GetOutputPort())\n    textActor6 = vtkActor()\n    textActor6.SetMapper(textMapper6)\n    textActor6.SetScale(scale)\n    textActor6.AddPosition(-0.49, -0.01, 0.3)\n    textActors.append(textActor6)\n    return textActors\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/BluntStreamlines/","title":"BluntStreamlines","text":"

        vtk-examples/Python/VisualizationAlgorithms/BluntStreamlines

        "},{"location":"Python/VisualizationAlgorithms/BluntStreamlines/#description","title":"Description","text":"

        This example shows airflow around a blunt fin. This example consists of a wall with half a rounded fin projecting into the fluid flow. (Using arguments of symmetry, only half of the domain was modeled.) Twenty-five streamlines are released upstream of the fin. The boundary layer effects near the junction of the fin and wall are clearly evident from the streamlines. In this area, flow recirculation is apparent, as well as the reduced flow speed.

        Info

        See Figure 6-19 in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/BluntStreamlines/#code","title":"Code","text":"

        BluntStreamlines.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkLineSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFilename, qFilename = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    aren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(aren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    scalarRange = [0.0] * 2\n    c = [0.0] * 3\n    maxTime = 0.0\n\n    reader = vtkMultiBlockPLOT3DReader()\n    reader.SetXYZFileName(xyzFilename)\n    reader.SetQFileName(qFilename)\n    reader.Update()  # Force a read to occur.\n\n    pd = reader.GetOutput().GetBlock(0)\n    pd.GetCenter(c)\n    if pd.GetPointData().GetScalars():\n        pd.GetPointData().GetScalars().GetRange(scalarRange)\n    if pd.GetPointData().GetVectors():\n        maxVelocity = pd.GetPointData().GetVectors().GetMaxNorm()\n        maxTime = 20.0 * pd.GetLength() / maxVelocity\n\n    outlineF = vtkStructuredGridOutlineFilter()\n    outlineF.SetInputData(pd)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outlineF.GetOutputPort())\n\n    outline = vtkActor()\n    outline.SetMapper(outlineMapper)\n    outline.GetProperty().SetColor(colors.GetColor3d('Moccasin'))\n    outline.GetProperty().SetLineWidth(2.0)\n\n    #\n    # Some geometry for context\n    #\n    wall = vtkStructuredGridGeometryFilter()\n    wall.SetInputData(pd)\n    wall.SetExtent(0, 100, 0, 100, 0, 0)\n\n    wallMap = vtkPolyDataMapper()\n    wallMap.SetInputConnection(wall.GetOutputPort())\n    wallMap.ScalarVisibilityOff()\n\n    wallActor = vtkActor()\n    wallActor.SetMapper(wallMap)\n    wallActor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    fin = vtkStructuredGridGeometryFilter()\n    fin.SetInputData(pd)\n    fin.SetExtent(0, 100, 0, 0, 0, 100)\n\n    finMap = vtkPolyDataMapper()\n    finMap.SetInputConnection(fin.GetOutputPort())\n    finMap.ScalarVisibilityOff()\n\n    finActor = vtkActor()\n    finActor.SetMapper(finMap)\n    finActor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n    #\n    # regular streamlines\n    #\n    line1 = vtkLineSource()\n    line1.SetResolution(25)\n    line1.SetPoint1(-6.36, 0.25, 0.06)\n    line1.SetPoint2(-6.36, 0.25, 5.37)\n\n    rakeMapper = vtkPolyDataMapper()\n    rakeMapper.SetInputConnection(line1.GetOutputPort())\n\n    rake1 = vtkActor()\n    rake1.SetMapper(rakeMapper)\n    rake1.GetProperty().SetColor(colors.GetColor3d('Black'))\n    rake1.GetProperty().SetLineWidth(5)\n\n    streamers = vtkStreamTracer()\n    # streamers.DebugOn()\n    streamers.SetInputConnection(reader.GetOutputPort())\n    streamers.SetSourceConnection(line1.GetOutputPort())\n    streamers.SetMaximumPropagation(maxTime)\n    streamers.SetInitialIntegrationStep(0.2)\n    streamers.SetMinimumIntegrationStep(0.01)\n    streamers.SetIntegratorType(2)\n    streamers.Update()\n\n    streamersMapper = vtkPolyDataMapper()\n    streamersMapper.SetInputConnection(streamers.GetOutputPort())\n    streamersMapper.SetScalarRange(scalarRange)\n\n    lines = vtkActor()\n    lines.SetMapper(streamersMapper)\n\n    aren.AddActor(outline)\n    aren.AddActor(wallActor)\n    aren.AddActor(finActor)\n    aren.AddActor(rake1)\n    aren.AddActor(lines)\n    aren.SetBackground(colors.GetColor3d('Gray'))\n\n    aren.ResetCamera()\n    aren.GetActiveCamera().Elevation(30.0)\n    aren.GetActiveCamera().Azimuth(30.0)\n    aren.GetActiveCamera().Dolly(1.2)\n    aren.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('BluntStreamlines')\n    renWin.Render()\n\n    # Interact with the data.\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This example shows airflow around a blunt fin.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='bluntfinxyz.bin.')\n    parser.add_argument('filename2', help='bluntfinq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/CarotidFlow/","title":"CarotidFlow","text":"

        vtk-examples/Python/VisualizationAlgorithms/CarotidFlow

        "},{"location":"Python/VisualizationAlgorithms/CarotidFlow/#description","title":"Description","text":"

        This example generates streamtubes of blood velocity. an isosurface of speed provides context. The starting positions for the streamtubes were determined by experimenting with the data. Because of the way the data was measured and the resolution of the velocity field, many streamers travel outside the artery. This is because the boundary layer of the blood flow is not captured due to limitations in data resolution. Consequently, as the blood flows around curves, there is a component of the velocity field that directs the streamtube outside the artery. As a result it is hard to find starting positions for the streamtubes that yield interesting results. The examples uses the source object vtkPointSource in combination with vtkThresholdPoints to work around this problem. vtkPointSource generates random points centered around a sphere of a specified radius. We need only find an approximate position for the starting points of the streamtubes and then generate a cloud of random seed points. vtkThresholdPoints is used to cull points that may be generated outside the regions of high flow velocity.

        Cite

        See 3D Phase Contrast MRI of Cerebral Blood Flow and Surface Anatomy for background.

        Info

        See Figure 6-44 in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/CarotidFlow/#code","title":"Code","text":"

        CarotidFlow.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkThresholdPoints,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    #\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(fileName)\n\n    psource = vtkPointSource()\n    psource.SetNumberOfPoints(25)\n    psource.SetCenter(133.1, 116.3, 5.0)\n    psource.SetRadius(2.0)\n\n    threshold = vtkThresholdPoints()\n    threshold.SetInputConnection(reader.GetOutputPort())\n    threshold.ThresholdByUpper(275)\n\n    streamers = vtkStreamTracer()\n    streamers.SetInputConnection(reader.GetOutputPort())\n    streamers.SetSourceConnection(psource.GetOutputPort())\n    # streamers.SetMaximumPropagationUnitToTimeUnit()\n    streamers.SetMaximumPropagation(100.0)\n    # streamers.SetInitialIntegrationStepUnitToCellLengthUnit()\n    streamers.SetInitialIntegrationStep(0.2)\n    streamers.SetTerminalSpeed(.01)\n    streamers.Update()\n    scalarRange = [0] * 2\n    scalarRange[0] = streamers.GetOutput().GetPointData().GetScalars().GetRange()[0]\n    scalarRange[1] = streamers.GetOutput().GetPointData().GetScalars().GetRange()[1]\n    print(\"range: \", scalarRange[0], \", \", scalarRange[1])\n\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(streamers.GetOutputPort())\n    tubes.SetRadius(0.3)\n    tubes.SetNumberOfSides(6)\n    tubes.SetVaryRadius(0)\n\n    lut = vtkLookupTable()\n    lut.SetHueRange(.667, 0.0)\n    lut.Build()\n\n    streamerMapper = vtkPolyDataMapper()\n    streamerMapper.SetInputConnection(tubes.GetOutputPort())\n    streamerMapper.SetScalarRange(scalarRange[0], scalarRange[1])\n    streamerMapper.SetLookupTable(lut)\n\n    streamerActor = vtkActor()\n    streamerActor.SetMapper(streamerMapper)\n\n    # Speed contours.\n    iso = vtkContourFilter()\n    iso.SetInputConnection(reader.GetOutputPort())\n    iso.SetValue(0, 175)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(iso.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetRepresentationToWireframe()\n    isoActor.GetProperty().SetOpacity(0.25)\n\n    # Outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d(\"Black\"))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(streamerActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d(\"Wheat\"))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CarotidFlow')\n\n    cam1 = vtkCamera()\n    cam1.SetClippingRange(17.4043, 870.216)\n    cam1.SetFocalPoint(136.71, 104.025, 23)\n    cam1.SetPosition(204.747, 258.939, 63.7925)\n    cam1.SetViewUp(-0.102647, -0.210897, 0.972104)\n    cam1.Zoom(1.2)\n    ren1.SetActiveCamera(cam1)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Visualizing blood flow in human carotid arteries.'\n    epilogue = '''\n    Streamtubes of blood velocity are generated. \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='carotid.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/CarotidFlowGlyphs/","title":"CarotidFlowGlyphs","text":"

        vtk-examples/Python/VisualizationAlgorithms/CarotidFlowGlyphs

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/CarotidFlowGlyphs/#code","title":"Code","text":"

        CarotidFlowGlyphs.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkGlyph3D,\n    vtkMaskPoints,\n    vtkThresholdPoints\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    #\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(fileName)\n\n    threshold = vtkThresholdPoints()\n    threshold.SetInputConnection(reader.GetOutputPort())\n    threshold.ThresholdByUpper(200)\n\n    mask = vtkMaskPoints()\n    mask.SetInputConnection(threshold.GetOutputPort())\n    mask.SetOnRatio(5)\n\n    cone = vtkConeSource()\n    cone.SetResolution(11)\n    cone.SetHeight(1)\n    cone.SetRadius(0.25)\n\n    cones = vtkGlyph3D()\n    cones.SetInputConnection(mask.GetOutputPort())\n    cones.SetSourceConnection(cone.GetOutputPort())\n    cones.SetScaleFactor(0.4)\n    cones.SetScaleModeToScaleByVector()\n\n    lut = vtkLookupTable()\n    lut.SetHueRange(.667, 0.0)\n    lut.Build()\n\n    scalarRange = [0] * 2\n    cones.Update()\n    scalarRange[0] = cones.GetOutput().GetPointData().GetScalars().GetRange()[0]\n    scalarRange[1] = cones.GetOutput().GetPointData().GetScalars().GetRange()[1]\n    print(\"range: \", scalarRange[0], \", \", scalarRange[1])\n\n    vectorMapper = vtkPolyDataMapper()\n    vectorMapper.SetInputConnection(cones.GetOutputPort())\n    vectorMapper.SetScalarRange(scalarRange[0], scalarRange[1])\n    vectorMapper.SetLookupTable(lut)\n\n    vectorActor = vtkActor()\n    vectorActor.SetMapper(vectorMapper)\n\n    # Speed contours.\n    iso = vtkContourFilter()\n    iso.SetInputConnection(reader.GetOutputPort())\n    iso.SetValue(0, 175)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(iso.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetRepresentationToWireframe()\n    isoActor.GetProperty().SetOpacity(0.25)\n\n    # Outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d(\"Black\"))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(vectorActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d(\"Wheat\"))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CarotidFlowGlyphs')\n\n    cam1 = vtkCamera()\n    cam1.SetClippingRange(17.4043, 870.216)\n    cam1.SetFocalPoint(136.71, 104.025, 23)\n    cam1.SetPosition(204.747, 258.939, 63.7925)\n    cam1.SetViewUp(-0.102647, -0.210897, 0.972104)\n    cam1.Zoom(1.2)\n    ren1.SetActiveCamera(cam1)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Visualizing blood flow in human carotid arteries.'\n    epilogue = '''\n    Cone glyphs indicate flow direction and magnitude. \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='carotid.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/ClipSphereCylinder/","title":"ClipSphereCylinder","text":"

        vtk-examples/Python/VisualizationAlgorithms/ClipSphereCylinder

        "},{"location":"Python/VisualizationAlgorithms/ClipSphereCylinder/#description","title":"Description","text":"

        Clipping is implemented in vtkClipPolyData . Each polygonal data primitive implements the operation in its Clip() method using case tables. vtkClipPolyData has methods to control whether an implicit function provides the scalar data or whether the dataset\u2019s scalar data will be used. ComputeScalarDataOn() uses the implicit function and ComputeScalarDataOff() uses the dataset\u2019s scalar data. Two output polygonal datasets are produced. These are accessed with GetOutput() and GetClippedOutput() methods. GetOutput() returns the polygonal data that is \u201cinside\u201d the clipping region while GetClippedOutput() returns polygonal data that is \u201coutside\u201d the region. (Note that GenerateClippedOutputOn() must be enabled if you are to get the clipped output.) The meaning of inside and outside can be reversed using the InsideOutOn().

        This example shows a plane of quadrilaterals clipped with a boolean implicit function.

        Info

        See Figure 9-48 in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/ClipSphereCylinder/#code","title":"Code","text":"

        ClipSphereCylinder.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCylinder,\n    vtkImplicitBoolean,\n    vtkSphere\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkClipPolyData\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Demonstrate the use of clipping on polygonal data\n    #\n\n    # create pipeline\n    #\n    plane = vtkPlaneSource()\n    plane.SetXResolution(25)\n    plane.SetYResolution(25)\n    plane.SetOrigin(-1, -1, 0)\n    plane.SetPoint1(1, -1, 0)\n    plane.SetPoint2(-1, 1, 0)\n\n    transformSphere = vtkTransform()\n    transformSphere.Identity()\n    transformSphere.Translate(0.4, -0.4, 0)\n    transformSphere.Inverse()\n\n    sphere = vtkSphere()\n    sphere.SetTransform(transformSphere)\n    sphere.SetRadius(.5)\n\n    transformCylinder = vtkTransform()\n    transformCylinder.Identity()\n    transformCylinder.Translate(-0.4, 0.4, 0)\n    transformCylinder.RotateZ(30)\n    transformCylinder.RotateY(60)\n    transformCylinder.RotateX(90)\n    transformCylinder.Inverse()\n\n    cylinder = vtkCylinder()\n    cylinder.SetTransform(transformCylinder)\n    cylinder.SetRadius(.3)\n\n    boolean = vtkImplicitBoolean()\n    boolean.AddFunction(cylinder)\n    boolean.AddFunction(sphere)\n\n    clipper = vtkClipPolyData()\n    clipper.SetInputConnection(plane.GetOutputPort())\n    clipper.SetClipFunction(boolean)\n    clipper.GenerateClippedOutputOn()\n    clipper.GenerateClipScalarsOn()\n    clipper.SetValue(0)\n\n    clipMapper = vtkPolyDataMapper()\n    clipMapper.SetInputConnection(clipper.GetOutputPort())\n    clipMapper.ScalarVisibilityOff()\n\n    clipActor = vtkActor()\n    clipActor.SetMapper(clipMapper)\n    clipActor.GetProperty().SetDiffuseColor(colors.GetColor3d('MidnightBlue'))\n    clipActor.GetProperty().SetRepresentationToWireframe()\n\n    clipInsideMapper = vtkPolyDataMapper()\n    clipInsideMapper.SetInputData(clipper.GetClippedOutput())\n    clipInsideMapper.ScalarVisibilityOff()\n\n    clipInsideActor = vtkActor()\n    clipInsideActor.SetMapper(clipInsideMapper)\n    clipInsideActor.GetProperty().SetDiffuseColor(colors.GetColor3d('LightBlue'))\n\n    # Create graphics stuff\n    #\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetWindowName('ClipSphereCylinder')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren1.AddActor(clipActor)\n\n    ren1.AddActor(clipInsideActor)\n    ren1.SetBackground(colors.GetColor3d('Wheat'))\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Dolly(1.4)\n    ren1.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 480)\n\n    # render the image\n    #\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/CombustorIsosurface/","title":"CombustorIsosurface","text":"

        vtk-examples/Python/VisualizationAlgorithms/CombustorIsosurface

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/CombustorIsosurface/#code","title":"Code","text":"

        CombustorIsosurface.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkPolyDataNormals,\n    vtkStructuredGridOutlineFilter\n)\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFile, qFile = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    #\n\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(xyzFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    iso = vtkContourFilter()\n    iso.SetInputData(pl3d.GetOutput().GetBlock(0))\n    iso.SetValue(0, 0.38)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(iso.GetOutputPort())\n    normals.SetFeatureAngle(45)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(normals.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d('WhiteSmoke'))\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputConnection(pl3d.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d('DarkSlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CombustorIsosurface')\n\n    ren1.GetActiveCamera().SetFocalPoint(9.71821, 0.458166, 29.3999)\n    ren1.GetActiveCamera().SetPosition(2.7439, -37.3196, 38.7167)\n    ren1.GetActiveCamera().SetViewUp(-0.16123, 0.264271, 0.950876)\n    ren1.GetActiveCamera().Zoom(1.3)\n    ren1.ResetCameraClippingRange()\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Marching cubes surface of flow density.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/ContourQuadric/","title":"ContourQuadric","text":"

        vtk-examples/Python/VisualizationAlgorithms/ContourQuadric

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/ContourQuadric/#code","title":"Code","text":"

        ContourQuadric.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkQuadric\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    aren = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(aren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    #\n    # Create surfaces F(x,y,z) = constant\n    #\n    # Sample quadric function\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0)\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(50, 50, 50)\n    sample.SetImplicitFunction(quadric)\n\n    contour = vtkContourFilter()\n    contour.SetInputConnection(sample.GetOutputPort())\n    contour.GenerateValues(5, 0, 1.2)\n\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contour.GetOutputPort())\n    contourMapper.SetScalarRange(0, 1.2)\n\n    contourActor = vtkActor()\n    contourActor.SetMapper(contourMapper)\n\n    # Create outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(sample.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d(\"Brown\"))\n    outlineActor.GetProperty().SetLineWidth(3.0)\n\n    #\n    # Rendering stuff\n    #\n    aren.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    aren.AddActor(contourActor)\n    aren.AddActor(outlineActor)\n\n    aren.ResetCamera()\n    aren.GetActiveCamera().Azimuth(30)\n    aren.GetActiveCamera().Elevation(30)\n\n    renWin.SetSize(640, 512)\n    renWin.SetWindowName('ContourQuadric')\n    renWin.Render()\n\n    # interact with data\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/CreateBFont/","title":"CreateBFont","text":"

        vtk-examples/Python/VisualizationAlgorithms/CreateBFont

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/CreateBFont/#code","title":"Code","text":"

        CreateBFont.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkClipPolyData\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkIOImage import vtkPNMReader\nfrom vtkmodules.vtkImagingGeneral import vtkImageGaussianSmooth\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Now create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    imageIn = vtkPNMReader()\n    imageIn.SetFileName(fileName)\n\n    gaussian = vtkImageGaussianSmooth()\n    gaussian.SetStandardDeviations(2, 2)\n    gaussian.SetDimensionality(2)\n    gaussian.SetRadiusFactors(1, 1)\n    gaussian.SetInputConnection(imageIn.GetOutputPort())\n\n    geometry = vtkImageDataGeometryFilter()\n    geometry.SetInputConnection(gaussian.GetOutputPort())\n\n    aClipper = vtkClipPolyData()\n    aClipper.SetInputConnection(geometry.GetOutputPort())\n    aClipper.SetValue(127.5)\n    aClipper.GenerateClipScalarsOff()\n    aClipper.InsideOutOn()\n    aClipper.GetOutput().GetPointData().CopyScalarsOff()\n    aClipper.Update()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(aClipper.GetOutputPort())\n    mapper.ScalarVisibilityOff()\n\n    letter = vtkActor()\n    letter.SetMapper(mapper)\n\n    ren1.AddActor(letter)\n    letter.GetProperty().SetDiffuseColor(colors.GetColor3d(\"LampBlack\"))\n    letter.GetProperty().SetRepresentationToWireframe()\n\n    ren1.SetBackground(colors.GetColor3d(\"WhiteSmoke\"))\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Dolly(1.2)\n    ren1.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CreateBFont')\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'A scanned image clipped with a scalar value.'\n    epilogue = '''\n    A scanned image clipped with a scalar value of 1/2 its maximum intensity\n     produces a mixture of quadrilaterals and triangles.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='B.pgm.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/CutStructuredGrid/","title":"CutStructuredGrid","text":"

        vtk-examples/Python/VisualizationAlgorithms/CutStructuredGrid

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/CutStructuredGrid/#code","title":"Code","text":"

        CutStructuredGrid.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import (\n    vtkCutter,\n    vtkStructuredGridOutlineFilter\n)\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFile, qFile = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # The cut data.\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(xyzFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    sg = pl3d.GetOutput().GetBlock(0)\n\n    plane = vtkPlane()\n    plane.SetOrigin(sg.GetCenter())\n    plane.SetNormal(-0.287, 0, 0.9579)\n\n    planeCut = vtkCutter()\n    planeCut.SetInputData(pl3d.GetOutput().GetBlock(0))\n    planeCut.SetCutFunction(plane)\n\n    cutMapper = vtkDataSetMapper()\n    cutMapper.SetInputConnection(planeCut.GetOutputPort())\n    cutMapper.SetScalarRange(sg.GetPointData().GetScalars().GetRange())\n\n    cutActor = vtkActor()\n    cutActor.SetMapper(cutMapper)\n\n    # Extract the plane.\n    compPlane = vtkStructuredGridGeometryFilter()\n    compPlane.SetInputData(sg)\n    compPlane.SetExtent(0, 100, 0, 100, 9, 9)\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputConnection(compPlane.GetOutputPort())\n    planeMapper.ScalarVisibilityOff()\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n    planeActor.GetProperty().SetRepresentationToWireframe()\n    planeActor.GetProperty().SetColor(colors.GetColor3d('Wheat'))\n\n    # Outline.\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3d.GetOutput().GetBlock(0))\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Wheat'))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(planeActor)\n    ren1.AddActor(cutActor)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('CutStructuredGrid')\n\n    camera = ren1.GetActiveCamera()\n    camera.SetPosition(5.02611, -23.535, 50.3979)\n    camera.SetFocalPoint(9.33614, 0.0414149, 30.112)\n    camera.SetViewUp(-0.0676794, 0.657814, 0.750134)\n    camera.SetDistance(31.3997)\n    camera.SetClippingRange(12.1468, 55.8147)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Cut through structured grid with plane.'\n    epilogue = '''\n    The cut plane is shown solid shaded.\n    A computational plane of constant k value is shown in wireframe for comparison.\n    The colors correspond to flow density.\n    Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders,\n     and quadrics can also be used.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/CutWithCutFunction/","title":"CutWithCutFunction","text":"

        vtk-examples/Python/VisualizationAlgorithms/CutWithCutFunction

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/CutWithCutFunction/#code","title":"Code","text":"

        CutWithCutFunction.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import vtkCutter\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName, numberOfCuts = get_program_parameters()\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    bounds = reader.GetOutput().GetBounds()\n    print('Bounds:', ', '.join(['{:.3f}'.format(f) for f in bounds]))\n\n    plane = vtkPlane()\n    plane.SetOrigin((bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0, bounds[4])\n    plane.SetNormal(0, 0, 1)\n\n    # Create cutter\n    high = plane.EvaluateFunction((bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2]) / 2.0, bounds[5])\n\n    cutter = vtkCutter()\n    cutter.SetInputConnection(reader.GetOutputPort())\n    cutter.SetCutFunction(plane)\n    cutter.GenerateValues(numberOfCuts, 0.99, 0.99 * high)\n\n    cutterMapper = vtkPolyDataMapper()\n    cutterMapper.SetInputConnection(cutter.GetOutputPort())\n    cutterMapper.ScalarVisibilityOff()\n\n    # Create cut actor\n    cutterActor = vtkActor()\n    cutterActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    cutterActor.GetProperty().SetLineWidth(2)\n    cutterActor.SetMapper(cutterMapper)\n\n    # Create model actor\n    modelMapper = vtkPolyDataMapper()\n    modelMapper.SetInputConnection(reader.GetOutputPort())\n    modelMapper.ScalarVisibilityOff()\n\n    modelActor = vtkActor()\n    modelActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n    modelActor.SetMapper(modelMapper)\n\n    # Create renderers and add actors of plane and model\n    renderer = vtkRenderer()\n    renderer.AddActor(cutterActor)\n    renderer.AddActor(modelActor)\n\n    # Add renderer to renderwindow and render\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(600, 600)\n    renderWindow.SetWindowName('CutWithCutFunction')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.SetBackground(colors.GetColor3d('Burlywood'))\n    renderer.GetActiveCamera().SetPosition(0, -1, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    renderer.ResetCamera()\n    renderWindow.Render()\n\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Cut with a cut function.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='Torso.vtp')\n    parser.add_argument('numberOfCuts', default=10, type=int, nargs='?', help='The number of cuts e.g 10.')\n    args = parser.parse_args()\n    return args.filename, args.numberOfCuts\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/CutWithScalars/","title":"CutWithScalars","text":"

        vtk-examples/Python/VisualizationAlgorithms/CutWithScalars

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/CutWithScalars/#code","title":"Code","text":"

        CutWithScalars.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkDoubleArray\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    inputFilename, numberOfCuts = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(inputFilename)\n    reader.Update()\n\n    bounds = reader.GetOutput().GetBounds()\n    print(bounds)\n\n    plane = vtkPlane()\n    plane.SetOrigin((bounds[1] + bounds[0]) / 2.0,\n                    (bounds[3] + bounds[2]) / 2.0,\n                    (bounds[5] + bounds[4]) / 2.0)\n    plane.SetNormal(0, 0, 1)\n\n    # Create Scalars.\n    scalars = vtkDoubleArray()\n    numberOfPoints = reader.GetOutput().GetNumberOfPoints()\n    scalars.SetNumberOfTuples(numberOfPoints)\n    pts = reader.GetOutput().GetPoints()\n    for i in range(0, numberOfPoints):\n        point = pts.GetPoint(i)\n        scalars.SetTuple1(i, plane.EvaluateFunction(point))\n    reader.GetOutput().GetPointData().SetScalars(scalars)\n    reader.GetOutput().GetPointData().GetScalars().GetRange()\n\n    # Create the cutter.\n    cutter = vtkContourFilter()\n    cutter.SetInputConnection(reader.GetOutputPort())\n    cutter.ComputeScalarsOff()\n    cutter.ComputeNormalsOff()\n    cutter.GenerateValues(\n        numberOfCuts,\n        0.99 * reader.GetOutput().GetPointData().GetScalars().GetRange()[0],\n        0.99 * reader.GetOutput().GetPointData().GetScalars().GetRange()[1])\n\n    cutterMapper = vtkPolyDataMapper()\n    cutterMapper.SetInputConnection(cutter.GetOutputPort())\n    cutterMapper.ScalarVisibilityOff()\n\n    # Create the cut actor.\n    cutterActor = vtkActor()\n    cutterActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    cutterActor.GetProperty().SetLineWidth(2)\n    cutterActor.SetMapper(cutterMapper)\n\n    # Create the model actor\n    modelMapper = vtkPolyDataMapper()\n    modelMapper.SetInputConnection(reader.GetOutputPort())\n    modelMapper.ScalarVisibilityOff()\n\n    modelActor = vtkActor()\n    modelActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n    modelActor.SetMapper(modelMapper)\n\n    # Create renderers and add the plane and model actors.\n    renderer = vtkRenderer()\n    renderer.AddActor(cutterActor)\n    renderer.AddActor(modelActor)\n\n    # Add renderer to renderwindow and render\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetSize(600, 600)\n    renderWindow.SetWindowName('CutWithCutScalars')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderer.SetBackground(colors.GetColor3d('Burlywood'))\n    renderer.GetActiveCamera().SetPosition(0, -1, 0)\n    renderer.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    renderer.GetActiveCamera().SetViewUp(0, 0, 1)\n    renderer.GetActiveCamera().Azimuth(30)\n    renderer.GetActiveCamera().Elevation(30)\n\n    renderer.ResetCamera()\n    renderWindow.Render()\n\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Cutting a surface model of the skin with a series of planes produces contour lines.'\n    epilogue = '''\n    Lines are wrapped with tubes for visual clarity.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='Torso.vtp.')\n    parser.add_argument('-n', type=int, default=20, help='Number of cuts.')\n    args = parser.parse_args()\n    return args.filename1, args.n\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/Cutter/","title":"Cutter","text":"

        vtk-examples/Python/VisualizationAlgorithms/Cutter

        "},{"location":"Python/VisualizationAlgorithms/Cutter/#description","title":"Description","text":"

        This example demonstrates how to use vtkCutter by cutting through a cube.

        • Contributed by Jothy

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/Cutter/#code","title":"Code","text":"

        Cutter.py

        #!/usr/bin/env python\n\n# A simple script to demonstrate the vtkCutter function\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import vtkCutter\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a cube\n    cube = vtkCubeSource()\n    cube.SetXLength(40)\n    cube.SetYLength(30)\n    cube.SetZLength(20)\n    cubeMapper = vtkPolyDataMapper()\n    cubeMapper.SetInputConnection(cube.GetOutputPort())\n\n    # create a plane to cut,here it cuts in the XZ direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0)\n    plane = vtkPlane()\n    plane.SetOrigin(10, 0, 0)\n    plane.SetNormal(1, 0, 0)\n\n    # create cutter\n    cutter = vtkCutter()\n    cutter.SetCutFunction(plane)\n    cutter.SetInputConnection(cube.GetOutputPort())\n    cutter.Update()\n    cutterMapper = vtkPolyDataMapper()\n    cutterMapper.SetInputConnection(cutter.GetOutputPort())\n\n    # create plane actor\n    planeActor = vtkActor()\n    planeActor.GetProperty().SetColor(colors.GetColor3d('Yellow'))\n    planeActor.GetProperty().SetLineWidth(2)\n    planeActor.GetProperty().SetAmbient(1.0)\n    planeActor.GetProperty().SetDiffuse(0.0)\n    planeActor.SetMapper(cutterMapper)\n\n    # create cube actor\n    cubeActor = vtkActor()\n    cubeActor.GetProperty().SetColor(colors.GetColor3d('Aquamarine'))\n    cubeActor.GetProperty().SetOpacity(0.5)\n    cubeActor.SetMapper(cubeMapper)\n\n    # create renderers and add actors of plane and cube\n    ren = vtkRenderer()\n    ren.AddActor(planeActor)\n    ren.AddActor(cubeActor)\n    ren.SetBackground(colors.GetColor3d('Silver'))\n\n    # Add renderer to renderwindow and render\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName('Cutter')\n    renWin.Render()\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    camera = ren.GetActiveCamera()\n    camera.SetPosition(-37.2611, -86.2155, 44.841)\n    camera.SetFocalPoint(0.569422, -1.65124, -2.49482)\n    camera.SetViewUp(0.160129, 0.42663, 0.890138)\n    camera.SetDistance(104.033)\n    camera.SetClippingRange(55.2019, 165.753)\n\n    renWin.Render()\n\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/DataSetSurface/","title":"DataSetSurface","text":"

        vtk-examples/Python/VisualizationAlgorithms/DataSetSurface

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/DataSetSurface/#code","title":"Code","text":"

        DataSetSurface.py

        #!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkPoints\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkHexahedron,\n    vtkPlane,\n    vtkUnstructuredGrid\n)\nfrom vtkmodules.vtkFiltersCore import vtkCutter\nfrom vtkmodules.vtkFiltersGeometry import vtkDataSetSurfaceFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Setup the coordinates of eight points\n    # (the two faces must be in counter clockwise order as viewed from the\n    # outside)\n    pointCoords = [\n        [0.0, 0.0, 0.0],\n        [1.0, 0.0, 0.0],\n        [1.0, 1.0, 0.0],\n        [0.0, 1.0, 0.0],\n        [0.0, 0.0, 1.0],\n        [1.0, 0.0, 1.0],\n        [1.0, 1.0, 1.0],\n        [0.0, 1.0, 1.0]\n    ]\n\n    # Create the points and a hexahedron from the points.\n    points = vtkPoints()\n    hexa = vtkHexahedron()\n    for i, pointCoord in enumerate(pointCoords):\n        points.InsertNextPoint(pointCoord)\n        hexa.GetPointIds().SetId(i, i)\n\n    # Add the hexahedron to a cell array.\n    hexs = vtkCellArray()\n    hexs.InsertNextCell(hexa)\n\n    # Add the points and hexahedron to an unstructured grid.\n    uGrid = vtkUnstructuredGrid()\n    uGrid.SetPoints(points)\n    uGrid.InsertNextCell(hexa.GetCellType(), hexa.GetPointIds())\n\n    # Extract the outer (polygonal) surface.\n    surface = vtkDataSetSurfaceFilter()\n    surface.SetInputData(uGrid)\n    surface.Update()\n\n    aBeamMapper = vtkDataSetMapper()\n    aBeamMapper.SetInputConnection(surface.GetOutputPort())\n    aBeamActor = vtkActor()\n    aBeamActor.SetMapper(aBeamMapper)\n    aBeamActor.AddPosition(0, 0, 0)\n    aBeamActor.GetProperty().SetColor(\n        colors.GetColor3d('Yellow'))\n    aBeamActor.GetProperty().SetOpacity(0.60)\n    aBeamActor.GetProperty().EdgeVisibilityOn()\n    aBeamActor.GetProperty().SetEdgeColor(\n        colors.GetColor3d('Black'))\n    aBeamActor.GetProperty().SetLineWidth(1.5)\n\n    # Create a plane to cut, here it cuts in the XZ direction\n    # (xz normal=(1,0,0) XY =(0,0,1), YZ =(0,1,0)\n    plane = vtkPlane()\n    plane.SetOrigin(0.5, 0, 0)\n    plane.SetNormal(1, 0, 0)\n\n    # Create cutter\n    cutter = vtkCutter()\n    cutter.SetCutFunction(plane)\n    cutter.SetInputData(aBeamActor.GetMapper().GetInput())\n    cutter.Update()\n    cutterMapper = vtkPolyDataMapper()\n    cutterMapper.SetInputConnection(cutter.GetOutputPort())\n\n    # Create plane actor\n    planeActor = vtkActor()\n    planeActor.GetProperty().SetColor(\n        colors.GetColor3d('Red'))\n    planeActor.GetProperty().SetLineWidth(2)\n    planeActor.SetMapper(cutterMapper)\n\n    # Create a renderer, render window, and interactor\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.SetWindowName('DatasetSurface')\n    renderWindow.AddRenderer(renderer)\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the scene\n    renderer.AddActor(aBeamActor)\n    renderer.AddActor(planeActor)\n    renderer.SetBackground(\n        colors.GetColor3d('Seashell'))\n\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Azimuth(-25)\n    renderer.GetActiveCamera().Elevation(30)\n\n    # Render and interact\n    renderWindow.Render()\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/DecimateFran/","title":"DecimateFran","text":"

        vtk-examples/Python/VisualizationAlgorithms/DecimateFran

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/DecimateFran/#code","title":"Code","text":"

        DecimateFran.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDecimatePro,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkIOImage import vtkPNGReader\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName1, fileName2 = get_program_parameters()\n\n    # This example shows how to use decimation to reduce a polygonal mesh. We also\n    # use mesh smoothing and generate surface normals to give a pleasing result.\n    #\n\n    # We start by reading some data that was originally captured from\n    # a Cyberware laser digitizing system.\n    #\n    fran = vtkPolyDataReader()\n    fran.SetFileName(fileName1)\n\n    # Read the corresponding texture.\n    textureReader = vtkPNGReader()\n    textureReader.SetFileName(fileName2)\n\n    texture = vtkTexture()\n    texture.InterpolateOn()\n    texture.SetInputConnection(textureReader.GetOutputPort())\n\n    # We want to preserve topology (not let any cracks form). This may limit\n    # the total reduction possible, which we have specified at 90%.\n    #\n    deci = vtkDecimatePro()\n    deci.SetInputConnection(fran.GetOutputPort())\n    deci.SetTargetReduction(0.9)\n    deci.PreserveTopologyOn()\n\n    decimatedNormals = vtkPolyDataNormals()\n    decimatedNormals.SetInputConnection(deci.GetOutputPort())\n    decimatedNormals.FlipNormalsOn()\n    decimatedNormals.SetFeatureAngle(60)\n\n    originalNormals = vtkPolyDataNormals()\n    originalNormals.SetInputConnection(fran.GetOutputPort())\n    originalNormals.FlipNormalsOn()\n    originalNormals.SetFeatureAngle(60)\n\n    decimatedMapper = vtkPolyDataMapper()\n    decimatedMapper.SetInputConnection(decimatedNormals.GetOutputPort())\n\n    decimatedActor = vtkActor()\n    decimatedActor.SetMapper(decimatedMapper)\n    decimatedActor.GetProperty().SetAmbient(.5)\n    decimatedActor.GetProperty().SetDiffuse(.5)\n    decimatedActor.SetTexture(texture)\n\n    originalMapper = vtkPolyDataMapper()\n    originalMapper.SetInputConnection(originalNormals.GetOutputPort())\n\n    originalActor = vtkActor()\n    originalActor.SetMapper(originalMapper)\n    originalActor.GetProperty().SetAmbient(.5)\n    originalActor.GetProperty().SetDiffuse(.5)\n    originalActor.SetTexture(texture)\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    renderer1 = vtkRenderer()\n    renderer1.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    renderer2 = vtkRenderer()\n    renderer2.SetViewport(0.5, 0.0, 1.0, 1.0)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer1)\n    renderWindow.AddRenderer(renderer2)\n    renderWindow.SetWindowName('DecimateFran')\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    renderer1.AddActor(originalActor)\n    renderer2.AddActor(decimatedActor)\n    renderer1.SetBackground(colors.GetColor3d(\"Wheat\"))\n    renderer2.SetBackground(colors.GetColor3d(\"Papaya_Whip\"))\n    renderWindow.SetSize(800, 400)\n\n    # Render the image.\n    #\n    cam1 = vtkCamera()\n    cam1.SetClippingRange(0.0475572, 2.37786)\n    cam1.SetFocalPoint(0.052665, -0.129454, -0.0573973)\n    cam1.SetPosition(0.327637, -0.116299, -0.256418)\n    cam1.SetViewUp(-0.0225386, 0.999137, 0.034901)\n    renderer1.SetActiveCamera(cam1)\n    renderer2.SetActiveCamera(cam1)\n\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Examples of the decimation algorithm.'\n    epilogue = '''\n    (a) Decimation of laser digitizer.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='fran_cut.vtk')\n    parser.add_argument('filename2', help='fran_cut.png.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/DecimateHawaii/","title":"DecimateHawaii","text":"

        vtk-examples/Python/VisualizationAlgorithms/DecimateHawaii

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/DecimateHawaii/#code","title":"Code","text":"

        DecimateHawaii.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkDecimatePro,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # This example shows how to use decimation to reduce a polygonal mesh. We also\n    # use mesh smoothing and generate surface normals to give a pleasing result.\n    #\n\n    hawaii = vtkPolyDataReader()\n    hawaii.SetFileName(fileName)\n\n    # We want to preserve topology (not let any cracks form). This may limit\n    # the total reduction possible, which we have specified at 90%.\n    #\n    deci = vtkDecimatePro()\n    deci.SetInputConnection(hawaii.GetOutputPort())\n    deci.SetTargetReduction(0.9)\n    deci.PreserveTopologyOn()\n\n    decimatedNormals = vtkPolyDataNormals()\n    decimatedNormals.SetInputConnection(deci.GetOutputPort())\n    decimatedNormals.FlipNormalsOn()\n    decimatedNormals.SetFeatureAngle(60)\n\n    decimatedMapper = vtkPolyDataMapper()\n    decimatedMapper.SetInputConnection(decimatedNormals.GetOutputPort())\n\n    decimatedActor = vtkActor()\n    decimatedActor.SetMapper(decimatedMapper)\n    decimatedActor.GetProperty().SetColor(colors.GetColor3d('Sienna'))\n    decimatedActor.GetProperty().SetRepresentationToWireframe()\n\n    originalMapper = vtkPolyDataMapper()\n    originalMapper.SetInputConnection(decimatedNormals.GetOutputPort())\n\n    originalActor = vtkActor()\n    originalActor.SetMapper(originalMapper)\n    originalActor.GetProperty().SetColor(colors.GetColor3d('Sienna'))\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    renderer1 = vtkRenderer()\n    renderer1.SetViewport(0.0, 0.0, 0.5, 1.0)\n\n    renderer2 = vtkRenderer()\n    renderer2.SetViewport(0.5, 0.0, 1.0, 1.0)\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer1)\n    renderWindow.AddRenderer(renderer2)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    renderer1.AddActor(originalActor)\n    renderer2.AddActor(decimatedActor)\n    renderer1.SetBackground(colors.GetColor3d('Wheat'))\n    renderer2.SetBackground(colors.GetColor3d('Papaya_Whip'))\n    renderWindow.SetSize(800, 400)\n    renderWindow.SetWindowName('DecimateHawaii')\n\n    # Render the image.\n    #\n    cam1 = vtkCamera()\n    renderer1.SetActiveCamera(cam1)\n    renderer2.SetActiveCamera(cam1)\n    renderer1.ResetCamera()\n    cam1.Elevation(-30)\n    cam1.Dolly(1.2)\n    renderer1.ResetCameraClippingRange()\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Examples of decimation algorithm.'\n    epilogue = '''\n    Decimation of terrain data.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='honolulu.vtk')\n    args = parser.parse_args()\n    return args.filename1\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/DisplacementPlot/","title":"DisplacementPlot","text":"

        vtk-examples/Python/VisualizationAlgorithms/DisplacementPlot

        "},{"location":"Python/VisualizationAlgorithms/DisplacementPlot/#description","title":"Description","text":"

        This example shows modal lines for a vibrating rectangular beam. The vibration mode in this figure is the second torsional mode, clearly indicated by the crossing modal lines.

        The default color scheme shows cool color for maximum negative motion, warm color maximum positive motion, with white at the nodes.

        For other possible color maps see: Diverging Color Maps for Scientific Visualization.

        Info

        See Figure 6-15 in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/DisplacementPlot/#code","title":"Code","text":"

        DisplacementPlot.py

        #!/usr/bin/env python\n\n# Translated from dispPlot.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataNormals,\n    vtkVectorDot\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpVector\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkColorTransferFunction,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    file_name, color_scheme = get_program_parameters()\n\n    color_scheme = abs(color_scheme)\n    if color_scheme > 2:\n        color_scheme = 0\n\n    colors = vtkNamedColors()\n\n    # Read a vtk file\n    #\n    plate = vtkPolyDataReader()\n    plate.SetFileName(file_name)\n    plate.SetVectorsName(\"mode8\")\n    plate.Update()\n\n    warp = vtkWarpVector()\n    warp.SetInputConnection(plate.GetOutputPort())\n    warp.SetScaleFactor(0.5)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(warp.GetOutputPort())\n\n    color = vtkVectorDot()\n    color.SetInputConnection(normals.GetOutputPort())\n\n    lut = vtkLookupTable()\n    MakeLUT(color_scheme, lut)\n\n    plateMapper = vtkDataSetMapper()\n    plateMapper.SetInputConnection(color.GetOutputPort())\n    plateMapper.SetLookupTable(lut)\n    plateMapper.SetScalarRange(-1, 1)\n\n    plateActor = vtkActor()\n    plateActor.SetMapper(plateMapper)\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren.AddActor(plateActor)\n    ren.SetBackground(colors.GetColor3d(\"Wheat\"))\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('DisplacementPlot')\n\n    ren.GetActiveCamera().SetPosition(13.3991, 14.0764, 9.97787)\n    ren.GetActiveCamera().SetFocalPoint(1.50437, 0.481517, 4.52992)\n    ren.GetActiveCamera().SetViewAngle(30)\n    ren.GetActiveCamera().SetViewUp(- 0.120861, 0.458556, - 0.880408)\n    ren.GetActiveCamera().SetClippingRange(12.5724, 26.8374)\n    # Render the image.\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce figure 6\u201315(b) from the VTK Textbook.'\n    epilogue = '''\n        Produce figure 6\u201315(b) from the VTK Textbook.\n        Surface plot of a vibrating plane.\n\n        The color_scheme option allows you to select a series of colour schemes.\n        0: The default:- cool maximum negative motion, warm maximum positive motion, white at the nodes.\n        1: An alternative:- green maximum negative motion, purple maximum positive motion, white at the nodes.\n        2: The original:- white at maximum motion, black at the nodes.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='plate.vtk')\n    parser.add_argument('color_scheme', default=0, type=int, nargs='?', help='The particular color scheme to use.')\n    args = parser.parse_args()\n    return args.filename, args.color_scheme\n\n\ndef MakeLUT(colorScheme, lut):\n    # See: [Diverging Color Maps for Scientific Visualization]\n    #      (http:#www.kennethmoreland.com/color-maps/)\n    nc = 256\n    ctf = vtkColorTransferFunction()\n\n    if colorScheme == 1:\n        # Green to purple diverging.\n        ctf.SetColorSpaceToDiverging()\n        ctf.AddRGBPoint(0.0, 0.085, 0.532, 0.201)\n        ctf.AddRGBPoint(0.5, 0.865, 0.865, 0.865)\n        ctf.AddRGBPoint(1.0, 0.436, 0.308, 0.631)\n        lut.SetNumberOfTableValues(nc)\n        lut.Build()\n        for i in range(0, nc):\n            rgb = list(ctf.GetColor(float(i) / nc))\n            rgb.append(1.0)\n            lut.SetTableValue(i, *rgb)\n    elif colorScheme == 2:\n        # Make a lookup table, black in the centre with bright areas\n        #   at the beginning and end of the table.\n        # This is from the original code.\n        nc2 = nc / 2.0\n        lut.SetNumberOfColors(nc)\n        lut.Build()\n        for i in range(0, int(nc2)):\n            # White to black.\n            v = (nc2 - i) / nc2\n            lut.SetTableValue(i, v, v, v, 1)\n        for i in range(int(nc2), nc):\n            # Black to white.\n            v = (i - nc2) / nc2\n            lut.SetTableValue(i, v, v, v, 1)\n    else:\n        # Cool to warm diverging.\n        ctf.SetColorSpaceToDiverging()\n        ctf.AddRGBPoint(0.0, 0.230, 0.299, 0.754)\n        ctf.AddRGBPoint(1.0, 0.706, 0.016, 0.150)\n        lut.SetNumberOfTableValues(nc)\n        lut.Build()\n        for i in range(0, nc):\n            rgb = list(ctf.GetColor(float(i) / nc))\n            rgb.append(1.0)\n            lut.SetTableValue(i, *rgb)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/ExponentialCosine/","title":"ExponentialCosine","text":"

        vtk-examples/Python/VisualizationAlgorithms/ExponentialCosine

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/ExponentialCosine/#code","title":"Code","text":"

        ExponentialCosine.py

        #!/usr/bin/env python\n\nimport math\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkTransformPolyDataFilter,\n    vtkWarpScalar\n)\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # create plane to warp\n    plane = vtkPlaneSource()\n    plane.SetResolution(300, 300)\n\n    transform = vtkTransform()\n    transform.Scale(10.0, 10.0, 1.0)\n\n    transF = vtkTransformPolyDataFilter()\n    transF.SetInputConnection(plane.GetOutputPort())\n    transF.SetTransform(transform)\n    transF.Update()\n\n    # Compute the Bessel function and derivatives. This portion could be\n    # encapsulated into source or filter object.\n    #\n    inputPd = transF.GetOutput()\n    numPts = inputPd.GetNumberOfPoints()\n\n    newPts = vtkPoints()\n    newPts.SetNumberOfPoints(numPts)\n\n    derivs = vtkDoubleArray()\n    derivs.SetNumberOfTuples(numPts)\n\n    bessel = vtkPolyData()\n    bessel.CopyStructure(inputPd)\n    bessel.SetPoints(newPts)\n    bessel.GetPointData().SetScalars(derivs)\n\n    x = [0.0] * 3\n    for i in range(0, numPts):\n        inputPd.GetPoint(i, x)\n        r = math.sqrt(float(x[0] * x[0]) + x[1] * x[1])\n        x[2] = math.exp(-r) * math.cos(10.0 * r)\n        newPts.SetPoint(i, x)\n        deriv = -math.exp(-r) * (math.cos(10.0 * r) + 10.0 * math.sin(10.0 * r))\n        derivs.SetValue(i, deriv)\n\n    # Warp the plane.\n    warp = vtkWarpScalar()\n    warp.SetInputData(bessel)\n    warp.XYPlaneOn()\n    warp.SetScaleFactor(0.5)\n\n    # Mapper and actor.\n    mapper = vtkDataSetMapper()\n    mapper.SetInputConnection(warp.GetOutputPort())\n    tmp = bessel.GetScalarRange()\n    mapper.SetScalarRange(tmp[0], tmp[1])\n\n    carpet = vtkActor()\n    carpet.SetMapper(mapper)\n\n    # Assign our actor to the renderer.\n    ren.AddActor(carpet)\n    ren.SetBackground(colors.GetColor3d('Beige'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('ExponentialCosine')\n\n    # draw the resulting scene\n    ren.ResetCamera()\n    ren.GetActiveCamera().Zoom(1.35)\n    ren.GetActiveCamera().Elevation(-55)\n    ren.GetActiveCamera().Azimuth(25)\n    ren.ResetCameraClippingRange()\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/ExtractData/","title":"ExtractData","text":"

        vtk-examples/Python/VisualizationAlgorithms/ExtractData

        "},{"location":"Python/VisualizationAlgorithms/ExtractData/#description","title":"Description","text":"

        This example takes advantage of the properties of implicit functions to select and cut data. In particular it uses the region separation property to select data. Selecting or extracting data with an implicit function means choosing cells and points (and associated attribute data) that lie within a particular region of the function. To determine whether a point x-y-z lies within a region, we simply evaluate the point and examine the sign of the result. A cell lies in a region if all its points lie in the region. Here, two ellipses are used in combination to select voxels within a volume dataset. Note that extracting data often changes the structure of the dataset. In this example the input type is a image data dataset, while the output type is an unstructured grid dataset.

        Info

        See Figure 6-24 in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/ExtractData/#code","title":"Code","text":"

        ExtractData.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkImplicitBoolean,\n    vtkQuadric,\n    vtkSphere\n)\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractGeometry\nfrom vtkmodules.vtkFiltersGeneral import vtkShrinkFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    quadric = vtkQuadric()\n    quadric.SetCoefficients(0.5, 1, 0.2, 0, 0.1, 0, 0, 0.2, 0, 0)\n\n    sample = vtkSampleFunction()\n    sample.SetSampleDimensions(50, 50, 50)\n    sample.SetImplicitFunction(quadric)\n    sample.ComputeNormalsOff()\n\n    trans = vtkTransform()\n    trans.Scale(1, 0.5, 0.333)\n\n    sphere = vtkSphere()\n    sphere.SetRadius(0.25)\n    sphere.SetTransform(trans)\n\n    trans2 = vtkTransform()\n    trans2.Scale(0.25, 0.5, 1.0)\n\n    sphere2 = vtkSphere()\n    sphere2.SetRadius(0.25)\n    sphere2.SetTransform(trans2)\n\n    booleanUnion = vtkImplicitBoolean()\n    booleanUnion.AddFunction(sphere)\n    booleanUnion.AddFunction(sphere2)\n    booleanUnion.SetOperationType(0)  # boolean Union\n\n    extract = vtkExtractGeometry()\n    extract.SetInputConnection(sample.GetOutputPort())\n    extract.SetImplicitFunction(booleanUnion)\n\n    shrink = vtkShrinkFilter()\n    shrink.SetInputConnection(extract.GetOutputPort())\n    shrink.SetShrinkFactor(0.5)\n\n    dataMapper = vtkDataSetMapper()\n    dataMapper.SetInputConnection(shrink.GetOutputPort())\n    dataActor = vtkActor()\n    dataActor.SetMapper(dataMapper)\n\n    # outline\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(sample.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(0, 0, 0)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(dataActor)\n    ren1.SetBackground(colors.GetColor3d(\"SlateGray\"))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('ExtractData')\n\n    renWin.Render()\n    ren1.GetActiveCamera().Azimuth(30)\n    ren1.GetActiveCamera().Elevation(30)\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/FlyingHeadSlice/","title":"FlyingHeadSlice","text":"

        vtk-examples/Python/VisualizationAlgorithms/FlyingHeadSlice

        "},{"location":"Python/VisualizationAlgorithms/FlyingHeadSlice/#description","title":"Description","text":"

        This example generates 2D contour lines on one CT slice through the head. The contours correspond to density values of the tissues and are colored according to density value.

        This example is a modification of HeadSlice using vtkFlyingEdges2D for contouring. However there is an option to use vtkContourFilter instead.

        Info

        See Figure 6-11a in Chapter 6 of the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/FlyingHeadSlice/#code","title":"Code","text":"

        FlyingHeadSlice.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkFlyingEdges2D\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkExtractVOI\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName, useContouring = get_program_parameters()\n    if useContouring:\n        print('Using vtkContourFilter.')\n    else:\n        print('Using vtkFlyingEdges2D.')\n\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    reader = vtkMetaImageReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    extractVOI = vtkExtractVOI()\n    extractVOI.SetInputConnection(reader.GetOutputPort())\n    extractVOI.SetVOI(0, 255, 0, 255, 45, 45)\n    # scalarRange = extractVOI.GetOutput().GetScalarRange()\n    scalarRange = [500, 1150]\n    # print(scalarRange)\n\n    contour = vtkContourFilter()\n    flyingEdges = vtkFlyingEdges2D()\n    isoMapper = vtkPolyDataMapper()\n    if useContouring:\n        contour.SetInputConnection(extractVOI.GetOutputPort())\n        contour.GenerateValues(12, scalarRange)\n        isoMapper.SetInputConnection(contour.GetOutputPort())\n    else:\n        flyingEdges.SetInputConnection(extractVOI.GetOutputPort())\n        flyingEdges.GenerateValues(12, scalarRange)\n        isoMapper.SetInputConnection(flyingEdges.GetOutputPort())\n\n    isoMapper.ScalarVisibilityOn()\n    isoMapper.SetScalarRange(scalarRange)\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d('Wheat'))\n\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(extractVOI.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Dolly(1.5)\n    ren1.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 640)\n    renWin.SetWindowName('FlyingHeadSlice')\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Either vtkFlyingEdges2D or vtkContourFilter is used to generate contour lines.'\n    epilogue = '''\n    Generate 2D contour lines, corresponding to tissue density, on one CT slice through the head.\n    The contour lines are colored by the tissue density.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    parser.add_argument('-useContouring', '--useContouring', action='store_true',\n                        help='Use vtkContourFilter instead of vtkFlyingEdges2D.')\n    args = parser.parse_args()\n    return args.filename, args.useContouring\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/HeadBone/","title":"HeadBone","text":"

        vtk-examples/Python/VisualizationAlgorithms/HeadBone

        "},{"location":"Python/VisualizationAlgorithms/HeadBone/#description","title":"Description","text":"

        This example generates an isosurface of human bone.

        Info

        See Figure 6-11b in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/HeadBone/#code","title":"Code","text":"

        HeadBone.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonDataModel import vtkMergePoints\nfrom vtkmodules.vtkFiltersCore import (\n    vtkFlyingEdges3D,\n    vtkMarchingCubes\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    # vtkFlyingEdges3D was introduced in VTK >= 8.2\n    use_flying_edges = vtk_version_ok(8, 2, 0)\n\n    file_name = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Create the pipeline.\n    reader = vtkMetaImageReader()\n    reader.SetFileName(file_name)\n    reader.Update()\n\n    locator = vtkMergePoints()\n    locator.SetDivisions(64, 64, 92)\n    locator.SetNumberOfPointsPerBucket(2)\n    locator.AutomaticOff()\n\n    if use_flying_edges:\n        try:\n            using_marching_cubes = False\n            iso = vtkFlyingEdges3D()\n        except AttributeError:\n            using_marching_cubes = True\n            iso = vtkMarchingCubes()\n    else:\n        using_marching_cubes = True\n        iso = vtkMarchingCubes()\n    iso.SetInputConnection(reader.GetOutputPort())\n    iso.ComputeGradientsOn()\n    iso.ComputeScalarsOff()\n    iso.SetValue(0, 1150)\n    if using_marching_cubes:\n        iso.SetLocator(locator)\n\n    iso_mapper = vtkPolyDataMapper()\n    iso_mapper.SetInputConnection(iso.GetOutputPort())\n    iso_mapper.ScalarVisibilityOff()\n\n    iso_actor = vtkActor()\n    iso_actor.SetMapper(iso_mapper)\n    iso_actor.GetProperty().SetColor(colors.GetColor3d('Ivory'))\n\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outline_mapper = vtkPolyDataMapper()\n    outline_mapper.SetInputConnection(outline.GetOutputPort())\n\n    outline_actor = vtkActor()\n    outline_actor.SetMapper(outline_mapper)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren.AddActor(outline_actor)\n    ren.AddActor(iso_actor)\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n    ren.GetActiveCamera().SetFocalPoint(0, 0, 0)\n    ren.GetActiveCamera().SetPosition(0, -1, 0)\n    ren.GetActiveCamera().SetViewUp(0, 0, -1)\n    ren.ResetCamera()\n    ren.GetActiveCamera().Dolly(1.5)\n    ren.ResetCameraClippingRange()\n\n    ren_win.SetSize(640, 480)\n    ren_win.SetWindowName('HeadBone')\n\n    ren_win.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Marching cubes surface of human bone.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) + 100000000 * int(minor) + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:  # as error:\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/HeadSlice/","title":"HeadSlice","text":"

        vtk-examples/Python/VisualizationAlgorithms/HeadSlice

        "},{"location":"Python/VisualizationAlgorithms/HeadSlice/#description","title":"Description","text":"

        This example generates contours on one CT slice through the head,

        Info

        See Figure 6-11a in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/HeadSlice/#code","title":"Code","text":"

        HeadSlice.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingCore import vtkExtractVOI\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    #\n\n    reader = vtkMetaImageReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    extractVOI = vtkExtractVOI()\n    extractVOI.SetInputConnection(reader.GetOutputPort())\n    extractVOI.SetVOI(0, 255, 0, 255, 45, 45)\n\n    iso = vtkContourFilter()\n    iso.SetInputConnection(extractVOI.GetOutputPort())\n    iso.GenerateValues(12, 500, 1150)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(iso.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d('Wheat'))\n\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(extractVOI.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Dolly(1.5)\n    ren1.ResetCameraClippingRange()\n\n    renWin.SetSize(640, 640)\n    renWin.SetWindowName('HeadSlice')\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Marching squares are used to generate contour lines.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='FullHead.mhd.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/Hello/","title":"Hello","text":"

        vtk-examples/Python/VisualizationAlgorithms/Hello

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/Hello/#code","title":"Code","text":"

        Hello.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersHybrid import vtkImplicitModeller\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create lines which serve as the 'seed' geometry. The lines spell the\n    # word 'hello'.\n    #\n    reader = vtkPolyDataReader()\n    reader.SetFileName(fileName)\n\n    lineMapper = vtkPolyDataMapper()\n    lineMapper.SetInputConnection(reader.GetOutputPort())\n\n    lineActor = vtkActor()\n    lineActor.SetMapper(lineMapper)\n    lineActor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n    lineActor.GetProperty().SetLineWidth(3.0)\n\n    # Create implicit model with vtkImplicitModeller. This computes a scalar\n    # field which is the distance from the generating geometry. The contour\n    # filter then extracts the geometry at the distance value 0.25 from the\n    # generating geometry.\n    #\n    imp = vtkImplicitModeller()\n    imp.SetInputConnection(reader.GetOutputPort())\n    imp.SetSampleDimensions(110, 40, 20)\n    imp.SetMaximumDistance(0.25)\n    imp.SetModelBounds(-1.0, 10.0, -1.0, 3.0, -1.0, 1.0)\n\n    contour = vtkContourFilter()\n    contour.SetInputConnection(imp.GetOutputPort())\n    contour.SetValue(0, 0.25)\n\n    impMapper = vtkPolyDataMapper()\n    impMapper.SetInputConnection(contour.GetOutputPort())\n    impMapper.ScalarVisibilityOff()\n\n    impActor = vtkActor()\n    impActor.SetMapper(impMapper)\n    impActor.GetProperty().SetColor(colors.GetColor3d('Peacock'))\n    impActor.GetProperty().SetOpacity(0.5)\n\n    # Create the usual graphics stuff.\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    renWin.SetWindowName('Hello')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren1.AddActor(lineActor)\n    ren1.AddActor(impActor)\n    ren1.SetBackground(colors.GetColor3d('Wheat'))\n    renWin.SetSize(640, 480)\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(4.5, 1, 0)\n    camera.SetPosition(4.5, 1.0, 6.73257)\n    camera.SetViewUp(0, 1, 0)\n\n    ren1.SetActiveCamera(camera)\n    ren1.ResetCamera()\n    camera.Dolly(1.3)\n    camera.SetClippingRange(1.81325, 90.6627)\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Implicit modelling is used to thicken a stroked font.'\n    epilogue = '''\n    Implicit modelling is used to thicken a stroked font.\n     The original lines can be seen within the translucent implicit surface. \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='hello.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/HyperStreamline/","title":"HyperStreamline","text":"

        vtk-examples/Python/VisualizationAlgorithms/HyperStreamline

        "},{"location":"Python/VisualizationAlgorithms/HyperStreamline/#description","title":"Description","text":"

        This is an example of hyperstreamlines. The data is from a point load applied to semi-infinite domain. Compare this image to TensorEllipsoids that used tensor ellipsoids to visualize the same data. Notice that there is less clutter and more information available from the hyperstreamline visualization.

        Info

        See Figure 9-15 in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/HyperStreamline/#code","title":"Code","text":"

        HyperStreamline.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersGeneral import vtkHyperStreamline\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkImagingHybrid import vtkPointLoad\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkLogLookupTable,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Generate the tensors.\n    ptLoad = vtkPointLoad()\n    ptLoad.SetLoadValue(100.0)\n    ptLoad.SetSampleDimensions(20, 20, 20)\n    ptLoad.ComputeEffectiveStressOn()\n    ptLoad.SetModelBounds(-10, 10, -10, 10, -10, 10)\n    ptLoad.Update()\n\n    # Generate the hyperstreamlines.\n    s1 = vtkHyperStreamline()\n    s1.SetInputData(ptLoad.GetOutput())\n    s1.SetStartPosition(9, 9, -9)\n    s1.IntegrateMinorEigenvector()\n    s1.SetMaximumPropagationDistance(18.0)\n    s1.SetIntegrationStepLength(0.1)\n    s1.SetStepLength(0.01)\n    s1.SetRadius(0.25)\n    s1.SetNumberOfSides(18)\n    s1.SetIntegrationDirectionToIntegrateBothDirections()\n    s1.Update()\n\n    # Map the hyperstreamlines.\n    lut = vtkLogLookupTable()\n    lut.SetHueRange(.6667, 0.0)\n\n    s1Mapper = vtkPolyDataMapper()\n    s1Mapper.SetInputConnection(s1.GetOutputPort())\n    s1Mapper.SetLookupTable(lut)\n    s1Mapper.SetScalarRange(ptLoad.GetOutput().GetScalarRange())\n\n    s1Actor = vtkActor()\n    s1Actor.SetMapper(s1Mapper)\n\n    s2 = vtkHyperStreamline()\n    s2.SetInputData(ptLoad.GetOutput())\n    s2.SetStartPosition(-9, -9, -9)\n    s2.IntegrateMinorEigenvector()\n    s2.SetMaximumPropagationDistance(18.0)\n    s2.SetIntegrationStepLength(0.1)\n    s2.SetStepLength(0.01)\n    s2.SetRadius(0.25)\n    s2.SetNumberOfSides(18)\n    s2.SetIntegrationDirectionToIntegrateBothDirections()\n    s2.Update()\n\n    s2Mapper = vtkPolyDataMapper()\n    s2Mapper.SetInputConnection(s2.GetOutputPort())\n    s2Mapper.SetLookupTable(lut)\n    s2Mapper.SetScalarRange(ptLoad.GetOutput().GetScalarRange())\n\n    s2Actor = vtkActor()\n    s2Actor.SetMapper(s2Mapper)\n\n    s3 = vtkHyperStreamline()\n    s3.SetInputData(ptLoad.GetOutput())\n    s3.SetStartPosition(9, -9, -9)\n    s3.IntegrateMinorEigenvector()\n    s3.SetMaximumPropagationDistance(18.0)\n    s3.SetIntegrationStepLength(0.1)\n    s3.SetStepLength(0.01)\n    s3.SetRadius(0.25)\n    s3.SetNumberOfSides(18)\n    s3.SetIntegrationDirectionToIntegrateBothDirections()\n    s3.Update()\n\n    s3Mapper = vtkPolyDataMapper()\n    s3Mapper.SetInputConnection(s3.GetOutputPort())\n    s3Mapper.SetLookupTable(lut)\n    s3Mapper.SetScalarRange(ptLoad.GetOutput().GetScalarRange())\n\n    s3Actor = vtkActor()\n    s3Actor.SetMapper(s3Mapper)\n\n    s4 = vtkHyperStreamline()\n    s4.SetInputData(ptLoad.GetOutput())\n    s4.SetStartPosition(-9, 9, -9)\n    s4.IntegrateMinorEigenvector()\n    s4.SetMaximumPropagationDistance(18.0)\n    s4.SetIntegrationStepLength(0.1)\n    s4.SetStepLength(0.01)\n    s4.SetRadius(0.25)\n    s4.SetNumberOfSides(18)\n    s4.SetIntegrationDirectionToIntegrateBothDirections()\n    s4.Update()\n\n    s4Mapper = vtkPolyDataMapper()\n    s4Mapper.SetInputConnection(s4.GetOutputPort())\n    s4Mapper.SetLookupTable(lut)\n    s4Mapper.SetScalarRange(ptLoad.GetOutput().GetScalarRange())\n\n    s4Actor = vtkActor()\n    s4Actor.SetMapper(s4Mapper)\n\n    # A plane for context.\n    #\n    g = vtkImageDataGeometryFilter()\n    g.SetInputData(ptLoad.GetOutput())\n    g.SetExtent(0, 100, 0, 100, 0, 0)\n    g.Update()  # for scalar range\n\n    gm = vtkPolyDataMapper()\n    gm.SetInputConnection(g.GetOutputPort())\n    gm.SetScalarRange(g.GetOutput().GetScalarRange())\n\n    ga = vtkActor()\n    ga.SetMapper(gm)\n\n    # Create an outline around the data.\n    #\n    outline = vtkOutlineFilter()\n    outline.SetInputData(ptLoad.GetOutput())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create a cone indicating the application of the load.\n    #\n    coneSrc = vtkConeSource()\n    coneSrc.SetRadius(0.5)\n    coneSrc.SetHeight(2)\n\n    coneMap = vtkPolyDataMapper()\n    coneMap.SetInputConnection(coneSrc.GetOutputPort())\n\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMap)\n    coneActor.SetPosition(0, 0, 11)\n    coneActor.RotateY(90)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Tomato'))\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(0.113766, -1.13665, -1.01919)\n    camera.SetPosition(-29.4886, -63.1488, 26.5807)\n    camera.SetViewAngle(24.4617)\n    camera.SetViewUp(0.17138, 0.331163, 0.927879)\n    camera.SetClippingRange(1, 100)\n\n    ren1.AddActor(s1Actor)\n    ren1.AddActor(s2Actor)\n    ren1.AddActor(s3Actor)\n    ren1.AddActor(s4Actor)\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(coneActor)\n    ren1.AddActor(ga)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.SetActiveCamera(camera)\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('HyperStreamline')\n\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/IceCream/","title":"IceCream","text":"

        vtk-examples/Python/VisualizationAlgorithms/IceCream

        "},{"location":"Python/VisualizationAlgorithms/IceCream/#description","title":"Description","text":"

        This example demonstrates how to use boolean combinations of implicit functions to create a model of an ice cream cone.

        Info

        See Figure 6-23c in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/IceCream/#code","title":"Code","text":"

        IceCream.py

        #!/usr/bin/env python\n\n\"\"\"\nThis example demonstrates how to use boolean combinations of implicit\n functions to create a model of an ice cream cone.\n\n\"\"\"\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCone,\n    vtkImplicitBoolean,\n    vtkPlane,\n    vtkSphere\n)\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkImagingHybrid import vtkSampleFunction\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create implicit function primitives. These have been carefully placed to\n    # give the effect that we want. We are going to use various combinations of\n    # these functions to create the shape we want for example, we use planes\n    # intersected with a cone (which is infinite in extent) to get a finite\n    # cone.\n    #\n    cone = vtkCone()\n    cone.SetAngle(20)\n\n    vertPlane = vtkPlane()\n    vertPlane.SetOrigin(.1, 0, 0)\n    vertPlane.SetNormal(-1, 0, 0)\n\n    basePlane = vtkPlane()\n    basePlane.SetOrigin(1.2, 0, 0)\n    basePlane.SetNormal(1, 0, 0)\n\n    iceCream = vtkSphere()\n    iceCream.SetCenter(1.333, 0, 0)\n    iceCream.SetRadius(0.5)\n\n    bite = vtkSphere()\n    bite.SetCenter(1.5, 0, 0.5)\n    bite.SetRadius(0.25)\n\n    # Combine primitives to build ice-cream cone. Clip the cone with planes.\n    theCone = vtkImplicitBoolean()\n    theCone.SetOperationTypeToIntersection()\n    theCone.AddFunction(cone)\n    theCone.AddFunction(vertPlane)\n    theCone.AddFunction(basePlane)\n\n    # Take a bite out of the ice cream.\n    theCream = vtkImplicitBoolean()\n    theCream.SetOperationTypeToDifference()\n    theCream.AddFunction(iceCream)\n    theCream.AddFunction(bite)\n\n    # The sample function generates a distance function from the\n    # implicit function (which in this case is the cone). This is\n    # then contoured to get a polygonal surface.\n    #\n    theConeSample = vtkSampleFunction()\n    theConeSample.SetImplicitFunction(theCone)\n    theConeSample.SetModelBounds(-1, 1.5, -1.25, 1.25, -1.25, 1.25)\n    theConeSample.SetSampleDimensions(128, 128, 128)\n    theConeSample.ComputeNormalsOff()\n\n    theConeSurface = vtkContourFilter()\n    theConeSurface.SetInputConnection(theConeSample.GetOutputPort())\n    theConeSurface.SetValue(0, 0.0)\n\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(theConeSurface.GetOutputPort())\n    coneMapper.ScalarVisibilityOff()\n\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Chocolate'))\n\n    # The same here for the ice cream.\n    #\n    theCreamSample = vtkSampleFunction()\n    theCreamSample.SetImplicitFunction(theCream)\n    theCreamSample.SetModelBounds(0, 2.5, -1.25, 1.25, -1.25, 1.25)\n    theCreamSample.SetSampleDimensions(128, 128, 128)\n    theCreamSample.ComputeNormalsOff()\n\n    theCreamSurface = vtkContourFilter()\n    theCreamSurface.SetInputConnection(theCreamSample.GetOutputPort())\n    theCreamSurface.SetValue(0, 0.0)\n\n    creamMapper = vtkPolyDataMapper()\n    creamMapper.SetInputConnection(theCreamSurface.GetOutputPort())\n    creamMapper.ScalarVisibilityOff()\n\n    creamActor = vtkActor()\n    creamActor.SetMapper(creamMapper)\n    creamActor.GetProperty().SetDiffuseColor(colors.GetColor3d('Mint'))\n    creamActor.GetProperty().SetSpecular(.6)\n    creamActor.GetProperty().SetSpecularPower(50)\n\n    # Create the usual rendering stuff.\n    #\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(coneActor)\n    ren1.AddActor(creamActor)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('IceCream')\n\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Roll(90)\n    ren1.GetActiveCamera().Dolly(1.25)\n    ren1.ResetCameraClippingRange()\n    iren.Initialize()\n\n    # render the image\n    #\n    renWin.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/ImageGradient/","title":"ImageGradient","text":"

        vtk-examples/Python/VisualizationAlgorithms/ImageGradient

        "},{"location":"Python/VisualizationAlgorithms/ImageGradient/#description","title":"Description","text":"

        We create an imaging pipeline to visualize gradient information.

        The gradient direction is mapped into color hue value while the gradient magnitude is mapped into the color saturation.

        Info

        See Figure 10-16 in Chapter 10 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/ImageGradient/#code","title":"Code","text":"

        ImageGradient.py

        #!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOImage import vtkMetaImageReader\nfrom vtkmodules.vtkImagingColor import vtkImageHSVToRGB\nfrom vtkmodules.vtkImagingCore import (\n    vtkImageCast,\n    vtkImageConstantPad,\n    vtkImageExtractComponents,\n    vtkImageMagnify\n)\nfrom vtkmodules.vtkImagingGeneral import (\n    vtkImageEuclideanToPolar,\n    vtkImageGaussianSmooth,\n    vtkImageGradient\n)\nfrom vtkmodules.vtkInteractionImage import vtkImageViewer\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindowInteractor\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n    colors = vtkNamedColors()\n\n    # Read the CT data of the human head.\n    reader = vtkMetaImageReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    cast = vtkImageCast()\n    cast.SetInputConnection(reader.GetOutputPort())\n    cast.SetOutputScalarTypeToFloat()\n\n    # Magnify the image.\n    magnify = vtkImageMagnify()\n    magnify.SetInputConnection(cast.GetOutputPort())\n    magnify.SetMagnificationFactors(2, 2, 1)\n    magnify.InterpolateOn()\n\n    # Smooth the data.\n    # Remove high frequency artifacts due to linear interpolation.\n    smooth = vtkImageGaussianSmooth()\n    smooth.SetInputConnection(magnify.GetOutputPort())\n    smooth.SetDimensionality(2)\n    smooth.SetStandardDeviations(1.5, 1.5, 0.0)\n    smooth.SetRadiusFactors(2.01, 2.01, 0.0)\n\n    # Compute the 2D gradient.\n    gradient = vtkImageGradient()\n    gradient.SetInputConnection(smooth.GetOutputPort())\n    gradient.SetDimensionality(2)\n\n    # Convert the data to polar coordinates.\n    # The image magnitude is mapped into saturation value,\n    # whilst the gradient direction is mapped into hue value.\n    polar = vtkImageEuclideanToPolar()\n    polar.SetInputConnection(gradient.GetOutputPort())\n    polar.SetThetaMaximum(255.0)\n\n    # Add a third component to the data.\n    # This is needed since the gradient filter only generates two components,\n    #  and we need three components to represent color.\n    pad = vtkImageConstantPad()\n    pad.SetInputConnection(polar.GetOutputPort())\n    pad.SetOutputNumberOfScalarComponents(3)\n    pad.SetConstant(200.0)\n\n    # At this point we have Hue, Value, Saturation.\n    # Permute components so saturation will be constant.\n    # Re-arrange components into HSV order.\n    permute = vtkImageExtractComponents()\n    permute.SetInputConnection(pad.GetOutputPort())\n    permute.SetComponents(0, 2, 1)\n\n    # Convert back into RGB values.\n    rgb = vtkImageHSVToRGB()\n    rgb.SetInputConnection(permute.GetOutputPort())\n    rgb.SetMaximum(255.0)\n\n    # Set up a viewer for the image.\n    # Note that vtkImageViewer and vtkImageViewer2 are convenience wrappers around\n    # vtkActor2D, vtkImageMapper, vtkRenderer, and vtkRenderWindow.\n    # So all that needs to be supplied is the interactor.\n    viewer = vtkImageViewer()\n    viewer.SetInputConnection(rgb.GetOutputPort())\n    viewer.SetZSlice(22)\n    viewer.SetColorWindow(255.0)\n    viewer.SetColorLevel(127.0)\n    viewer.GetRenderWindow().SetSize(512, 512)\n    viewer.GetRenderer().SetBackground(colors.GetColor3d('Silver'))\n    viewer.GetRenderWindow().SetWindowName('ImageGradient')\n\n    # Create the RenderWindowInteractor.\n    iren = vtkRenderWindowInteractor()\n    viewer.SetupInteractor(iren)\n    viewer.Render()\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'ImageGradient.'\n    epilogue = '''\nVisualization of gradient information.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('fileName',\n                        help='The file FullHead.mhd. Note: file FullHead.raw.gz must also be present in the same folder.')\n    args = parser.parse_args()\n    return args.fileName\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/IronIsoSurface/","title":"IronIsoSurface","text":"

        vtk-examples/Python/VisualizationAlgorithms/IronIsoSurface

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/IronIsoSurface/#code","title":"Code","text":"

        IronIsoSurface.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the pipeline.\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(fileName)\n\n    iso = vtkContourFilter()\n    iso.SetInputConnection(reader.GetOutputPort())\n    iso.SetValue(0, 128)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(iso.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d(\"Banana\"))\n\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(isoActor)\n    ren1.SetBackground(colors.GetColor3d(\"SlateGray\"))\n    renWin.SetSize(640, 640)\n    renWin.SetWindowName('IronIsoSurface')\n\n    # Render the image.\n    #\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().Azimuth(30)\n    ren1.GetActiveCamera().Elevation(30)\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Marching cubes surface of iron-protein.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='ironProt.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/LOx/","title":"LOx","text":"

        vtk-examples/Python/VisualizationAlgorithms/LOx

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/LOx/#code","title":"Code","text":"

        LOx.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkStructuredGridOutlineFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    xyxFile, qFile = get_program_parameters()\n\n    # Read the data.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.AutoDetectFormatOn()\n    pl3d.SetXYZFileName(xyxFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(153)\n    pl3d.SetVectorFunctionNumber(200)\n    pl3d.Update()\n\n    sg = pl3d.GetOutput().GetBlock(0)\n\n    # blue to red lut\n    #\n    lut = vtkLookupTable()\n    lut.SetHueRange(0.667, 0.0)\n\n    # Computational planes.\n    floorComp = vtkStructuredGridGeometryFilter()\n    floorComp.SetExtent(0, 37, 0, 75, 0, 0)\n    floorComp.SetInputData(sg)\n    floorComp.Update()\n\n    floorMapper = vtkPolyDataMapper()\n    floorMapper.SetInputConnection(floorComp.GetOutputPort())\n    floorMapper.ScalarVisibilityOff()\n    floorMapper.SetLookupTable(lut)\n\n    floorActor = vtkActor()\n    floorActor.SetMapper(floorMapper)\n    floorActor.GetProperty().SetRepresentationToWireframe()\n    floorActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n    floorActor.GetProperty().SetLineWidth(2)\n\n    subFloorComp = vtkStructuredGridGeometryFilter()\n\n    subFloorComp.SetExtent(0, 37, 0, 15, 22, 22)\n    subFloorComp.SetInputData(sg)\n\n    subFloorMapper = vtkPolyDataMapper()\n    subFloorMapper.SetInputConnection(subFloorComp.GetOutputPort())\n    subFloorMapper.SetLookupTable(lut)\n    subFloorMapper.SetScalarRange(sg.GetScalarRange())\n\n    subFloorActor = vtkActor()\n\n    subFloorActor.SetMapper(subFloorMapper)\n\n    subFloor2Comp = vtkStructuredGridGeometryFilter()\n    subFloor2Comp.SetExtent(0, 37, 60, 75, 22, 22)\n    subFloor2Comp.SetInputData(sg)\n\n    subFloor2Mapper = vtkPolyDataMapper()\n    subFloor2Mapper.SetInputConnection(subFloor2Comp.GetOutputPort())\n    subFloor2Mapper.SetLookupTable(lut)\n    subFloor2Mapper.SetScalarRange(sg.GetScalarRange())\n\n    subFloor2Actor = vtkActor()\n\n    subFloor2Actor.SetMapper(subFloor2Mapper)\n\n    postComp = vtkStructuredGridGeometryFilter()\n    postComp.SetExtent(10, 10, 0, 75, 0, 37)\n    postComp.SetInputData(sg)\n\n    postMapper = vtkPolyDataMapper()\n    postMapper.SetInputConnection(postComp.GetOutputPort())\n    postMapper.SetLookupTable(lut)\n    postMapper.SetScalarRange(sg.GetScalarRange())\n\n    postActor = vtkActor()\n    postActor.SetMapper(postMapper)\n    postActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    fanComp = vtkStructuredGridGeometryFilter()\n    fanComp.SetExtent(0, 37, 38, 38, 0, 37)\n    fanComp.SetInputData(sg)\n\n    fanMapper = vtkPolyDataMapper()\n    fanMapper.SetInputConnection(fanComp.GetOutputPort())\n    fanMapper.SetLookupTable(lut)\n    fanMapper.SetScalarRange(sg.GetScalarRange())\n\n    fanActor = vtkActor()\n\n    fanActor.SetMapper(fanMapper)\n    fanActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    # streamers\n    #\n    # spherical seed points\n    rake = vtkPointSource()\n    rake.SetCenter(-0.74, 0, 0.3)\n    rake.SetNumberOfPoints(10)\n\n    # a line of seed points\n    seedsComp = vtkStructuredGridGeometryFilter()\n    seedsComp.SetExtent(10, 10, 37, 39, 1, 27)\n    seedsComp.SetInputData(sg)\n\n    streamers = vtkStreamTracer()\n    streamers.SetInputConnection(pl3d.GetOutputPort())\n\n    # streamers SetSource [rake GetOutput]\n    streamers.SetSourceConnection(seedsComp.GetOutputPort())\n    streamers.SetMaximumPropagation(250)\n    streamers.SetInitialIntegrationStep(.2)\n    streamers.SetMinimumIntegrationStep(.01)\n    streamers.SetIntegratorType(2)\n    streamers.Update()\n\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(streamers.GetOutputPort())\n    tubes.SetNumberOfSides(8)\n    tubes.SetRadius(0.08)\n    tubes.SetVaryRadius(0)\n\n    mapTubes = vtkPolyDataMapper()\n\n    mapTubes.SetInputConnection(tubes.GetOutputPort())\n    mapTubes.SetScalarRange(sg.GetScalarRange())\n\n    tubesActor = vtkActor()\n    tubesActor.SetMapper(mapTubes)\n\n    # outline\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(sg)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    # Create graphics stuff.\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(floorActor)\n    # ren1.AddActor(subFloorActor)\n    # ren1.AddActor(subFloor2Actor)\n    ren1.AddActor(postActor)\n    # ren1.AddActor(fanActor)\n    ren1.AddActor(tubesActor)\n\n    aCam = vtkCamera()\n    aCam.SetFocalPoint(2.47736, -0.150024, 2.42361)\n    aCam.SetPosition(1.57547, -13.4601, 5.47872)\n    aCam.SetViewUp(0.00197003, 0.223588, 0.974682)\n    #  aCam.Dolly(4.0)\n    aCam.SetClippingRange(1, 100)\n\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.SetActiveCamera(aCam)\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('LOx')\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Streamtubes created by using the computational grid just in front of the post as a source for seeds.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('xyz_file', help='postxyz.bin.')\n    parser.add_argument('q_file', help='postq.bin.')\n    args = parser.parse_args()\n    return args.xyz_file, args.q_file\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/LOxGrid/","title":"LOxGrid","text":"

        vtk-examples/Python/VisualizationAlgorithms/LOxGrid

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/LOxGrid/#code","title":"Code","text":"

        LOxGrid.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkStructuredGridOutlineFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    xyxFile, qFile = get_program_parameters()\n\n    # Read the data.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.AutoDetectFormatOn()\n    pl3d.SetXYZFileName(xyxFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(153)\n    pl3d.SetVectorFunctionNumber(200)\n    pl3d.Update()\n\n    sg = pl3d.GetOutput().GetBlock(0)\n\n    # blue to red lut\n    #\n    lut = vtkLookupTable()\n    lut.SetHueRange(0.667, 0.0)\n\n    # Computational planes.\n    floorComp = vtkStructuredGridGeometryFilter()\n    floorComp.SetExtent(0, 37, 0, 75, 0, 0)\n    floorComp.SetInputData(sg)\n    floorComp.Update()\n\n    floorMapper = vtkPolyDataMapper()\n    floorMapper.SetInputConnection(floorComp.GetOutputPort())\n    floorMapper.ScalarVisibilityOff()\n    floorMapper.SetLookupTable(lut)\n\n    floorActor = vtkActor()\n    floorActor.SetMapper(floorMapper)\n    floorActor.GetProperty().SetRepresentationToWireframe()\n    floorActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n    floorActor.GetProperty().SetLineWidth(2)\n\n    subFloorComp = vtkStructuredGridGeometryFilter()\n\n    subFloorComp.SetExtent(0, 37, 0, 15, 22, 22)\n    subFloorComp.SetInputData(sg)\n\n    subFloorMapper = vtkPolyDataMapper()\n    subFloorMapper.SetInputConnection(subFloorComp.GetOutputPort())\n    subFloorMapper.SetLookupTable(lut)\n    subFloorMapper.SetScalarRange(sg.GetScalarRange())\n\n    subFloorActor = vtkActor()\n\n    subFloorActor.SetMapper(subFloorMapper)\n\n    subFloor2Comp = vtkStructuredGridGeometryFilter()\n    subFloor2Comp.SetExtent(0, 37, 60, 75, 22, 22)\n    subFloor2Comp.SetInputData(sg)\n\n    subFloor2Mapper = vtkPolyDataMapper()\n    subFloor2Mapper.SetInputConnection(subFloor2Comp.GetOutputPort())\n    subFloor2Mapper.SetLookupTable(lut)\n    subFloor2Mapper.SetScalarRange(sg.GetScalarRange())\n\n    subFloor2Actor = vtkActor()\n\n    subFloor2Actor.SetMapper(subFloor2Mapper)\n\n    postComp = vtkStructuredGridGeometryFilter()\n\n    postComp.SetExtent(10, 10, 0, 75, 0, 37)\n    postComp.SetInputData(sg)\n\n    postMapper = vtkPolyDataMapper()\n    postMapper.SetInputConnection(postComp.GetOutputPort())\n    postMapper.SetLookupTable(lut)\n    postMapper.SetScalarRange(sg.GetScalarRange())\n\n    postActor = vtkActor()\n    postActor.SetMapper(postMapper)\n    postActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    fanComp = vtkStructuredGridGeometryFilter()\n    fanComp.SetExtent(0, 37, 38, 38, 0, 37)\n    fanComp.SetInputData(sg)\n\n    fanMapper = vtkPolyDataMapper()\n    fanMapper.SetInputConnection(fanComp.GetOutputPort())\n    fanMapper.SetLookupTable(lut)\n    fanMapper.SetScalarRange(sg.GetScalarRange())\n\n    fanActor = vtkActor()\n\n    fanActor.SetMapper(fanMapper)\n    fanActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    # streamers\n    #\n    # spherical seed points\n    rake = vtkPointSource()\n    rake.SetCenter(-0.74, 0, 0.3)\n    rake.SetNumberOfPoints(10)\n\n    # a line of seed points\n    seedsComp = vtkStructuredGridGeometryFilter()\n    seedsComp.SetExtent(10, 10, 37, 39, 1, 35)\n    seedsComp.SetInputData(sg)\n\n    streamers = vtkStreamTracer()\n    streamers.SetInputConnection(pl3d.GetOutputPort())\n\n    # streamers SetSource [rake GetOutput]\n    streamers.SetSourceConnection(seedsComp.GetOutputPort())\n    streamers.SetMaximumPropagation(250)\n    streamers.SetInitialIntegrationStep(.2)\n    streamers.SetMinimumIntegrationStep(.01)\n    streamers.SetIntegratorType(2)\n    streamers.Update()\n\n    tubes = vtkTubeFilter()\n    tubes.SetInputConnection(streamers.GetOutputPort())\n    tubes.SetNumberOfSides(8)\n    tubes.SetRadius(0.08)\n    tubes.SetVaryRadius(0)\n\n    mapTubes = vtkPolyDataMapper()\n\n    mapTubes.SetInputConnection(tubes.GetOutputPort())\n    mapTubes.SetScalarRange(sg.GetScalarRange())\n\n    tubesActor = vtkActor()\n    tubesActor.SetMapper(mapTubes)\n\n    # outline\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(sg)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n\n    # Create graphics stuff.\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(floorActor)\n    ren1.AddActor(subFloorActor)\n    ren1.AddActor(subFloor2Actor)\n    ren1.AddActor(postActor)\n    ren1.AddActor(fanActor)\n    ren1.AddActor(tubesActor)\n\n    aCam = vtkCamera()\n    aCam.SetFocalPoint(0.00657892, 0, 2.41026)\n    aCam.SetPosition(-1.94838, -47.1275, 39.4607)\n    aCam.SetViewUp(0.00653193, 0.617865, 0.786257)\n    ren1.ResetCamera()\n    aCam.Dolly(1.)\n    aCam.SetClippingRange(1, 100)\n\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n    ren1.SetActiveCamera(aCam)\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('LOxGrid')\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'LOx post CFD case study.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('xyz_file', help='postxyz.bin.')\n    parser.add_argument('q_file', help='postq.bin.')\n    args = parser.parse_args()\n    return args.xyz_file, args.q_file\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/LOxSeeds/","title":"LOxSeeds","text":"

        vtk-examples/Python/VisualizationAlgorithms/LOxSeeds

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/LOxSeeds/#code","title":"Code","text":"

        LOxSeeds.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    xyxFile, qFile = get_program_parameters()\n\n    # Read the data.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.AutoDetectFormatOn()\n    pl3d.SetXYZFileName(xyxFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(153)\n    pl3d.SetVectorFunctionNumber(200)\n    pl3d.Update()\n\n    sg = pl3d.GetOutput().GetBlock(0)\n\n    # blue to red lut\n    #\n    lut = vtkLookupTable()\n    lut.SetHueRange(0.667, 0.0)\n\n    seeds = [[-0.74, 0.0, 0.3], [-0.74, 0.0, 1.0], [-0.74, 0.0, 2.0], [-0.74, 0.0, 3.0]]\n\n    renderers = list()\n\n    for s in range(0, len(seeds)):\n        # computational planes\n        floorComp = vtkStructuredGridGeometryFilter()\n        floorComp.SetExtent(0, 37, 0, 75, 0, 0)\n        floorComp.SetInputData(sg)\n        floorComp.Update()\n\n        floorMapper = vtkPolyDataMapper()\n        floorMapper.SetInputConnection(floorComp.GetOutputPort())\n        floorMapper.ScalarVisibilityOff()\n        floorMapper.SetLookupTable(lut)\n\n        floorActor = vtkActor()\n        floorActor.SetMapper(floorMapper)\n        floorActor.GetProperty().SetRepresentationToWireframe()\n        floorActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n        floorActor.GetProperty().SetLineWidth(2)\n\n        postComp = vtkStructuredGridGeometryFilter()\n        postComp.SetExtent(10, 10, 0, 75, 0, 37)\n        postComp.SetInputData(sg)\n\n        postMapper = vtkPolyDataMapper()\n        postMapper.SetInputConnection(postComp.GetOutputPort())\n        postMapper.SetLookupTable(lut)\n        postMapper.SetScalarRange(sg.GetScalarRange())\n\n        postActor = vtkActor()\n        postActor.SetMapper(postMapper)\n        postActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n        # streamers\n        #\n        # spherical seed points\n        rake = vtkPointSource()\n        rake.SetCenter(seeds[s])\n        rake.SetNumberOfPoints(10)\n\n        streamers = vtkStreamTracer()\n        streamers.SetInputConnection(pl3d.GetOutputPort())\n\n        # streamers SetSource [rake GetOutput]\n        streamers.SetSourceConnection(rake.GetOutputPort())\n        streamers.SetMaximumPropagation(250)\n        streamers.SetInitialIntegrationStep(.2)\n        streamers.SetMinimumIntegrationStep(.01)\n        streamers.SetIntegratorType(2)\n        streamers.Update()\n\n        tubes = vtkTubeFilter()\n        tubes.SetInputConnection(streamers.GetOutputPort())\n        tubes.SetNumberOfSides(8)\n        tubes.SetRadius(0.08)\n        tubes.SetVaryRadius(0)\n\n        mapTubes = vtkPolyDataMapper()\n\n        mapTubes.SetInputConnection(tubes.GetOutputPort())\n        mapTubes.SetScalarRange(sg.GetScalarRange())\n\n        tubesActor = vtkActor()\n        tubesActor.SetMapper(mapTubes)\n\n        renderer = vtkRenderer()\n\n        renderer.AddActor(floorActor)\n        renderer.AddActor(postActor)\n        renderer.AddActor(tubesActor)\n        renderer.SetBackground(colors.GetColor3d('SlateGray'))\n        renderers.append(renderer)\n\n    renderWindow = vtkRenderWindow()\n\n    # Setup viewports for the renderers\n    rendererSize = 256\n    xGridDimensions = 2\n    yGridDimensions = 2\n    renderWindow.SetSize(rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    for row in range(0, yGridDimensions):\n        for col in range(xGridDimensions):\n            index = row * xGridDimensions + col\n            # (xmin, ymin, xmax, ymax)\n            viewport = [float(col) / xGridDimensions, float(yGridDimensions - (row + 1)) / yGridDimensions,\n                        float(col + 1) / xGridDimensions, float(yGridDimensions - row) / yGridDimensions]\n            renderers[index].SetViewport(viewport)\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(0.918037, -0.0779233, 2.69513)\n    camera.SetPosition(0.840735, -23.6176, 8.50211)\n    camera.SetViewUp(0.00227904, 0.239501, 0.970893)\n    camera.SetClippingRange(1, 100)\n\n    renderers[0].SetActiveCamera(camera)\n    for r in range(0, len(renderers)):\n        renderWindow.AddRenderer(renderers[r])\n        if r > 0:\n            renderers[r].SetActiveCamera(camera)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    renderWindow.SetSize(512, 512)\n    renderWindow.SetWindowName('LOxSeeds')\n\n    renderWindow.Render()\n    interactor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown.'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('xyz_file', help='postxyz.bin.')\n    parser.add_argument('q_file', help='postq.bin.')\n    args = parser.parse_args()\n    return args.xyz_file, args.q_file\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/MarchingCases/","title":"MarchingCases","text":"

        vtk-examples/Python/VisualizationAlgorithms/MarchingCases

        "},{"location":"Python/VisualizationAlgorithms/MarchingCases/#description","title":"Description","text":"

        This example will help you understand the Marching Cubes Algorithm. The example takes one optional argument, a case number. There are 15 Marching Cubes cases, 0-14. There are also 15 complementary cases where the inside/outside value is flipped. To see a complementary case, supply a negative case number. For example, -7 is the complementary case of 7.

        Note

        According to the ACM Digital Library, the Marching Cubes paper is the most cited Siggraph paper.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/MarchingCases/#code","title":"Code","text":"

        MarchingCases.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkIdList,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkGlyph3D,\n    vtkThresholdPoints,\n    vtkTubeFilter\n)\n\n# vtkExtractEdges moved from vtkFiltersExtraction to vtkFiltersCore in\n# VTK commit d9981b9aeb93b42d1371c6e295d76bfdc18430bd\ntry:\n    from vtkmodules.vtkFiltersCore import vtkExtractEdges\nexcept ImportError:\n    from vtkmodules.vtkFiltersExtraction import vtkExtractEdges\nfrom vtkmodules.vtkFiltersGeneral import (\n    vtkShrinkPolyData,\n    vtkTransformPolyDataFilter\n)\nfrom vtkmodules.vtkFiltersSources import (\n    vtkCubeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    mc_cases, rotation, label = get_program_parameters()\n    if not mc_cases:\n        mc_cases = [7]\n    else:\n        # Ensure that they are unique.\n        mc_cases = list(set(mc_cases))\n        # Check that they lie in the correct range.\n        badCases = []\n        for item in mc_cases:\n            if abs(int(item) > 14):\n                badCases.append(item)\n        if badCases:\n            print('Bad case number(s)', ','.join(map(str, badCases)))\n            for item in badCases:\n                mc_cases.remove(item)\n            if not mc_cases:\n                print('No cases.')\n                return\n    marching_cubes(mc_cases, rotation, label)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Marching cubes cases for 3D isosurface generation.'\n    epilogue = '''\n    Marching cubes cases for 3D isosurface generation.\n    The 256 possible cases have been reduced to 15 cases using symmetry.\n    Dark vertices are greater than the selected isosurface value.\n\n    For the cases, enter them as integers separated by a space e.g: 1 2 3  \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('cases', nargs='*', type=int, default=[],\n                        help='A list of integers i such that 0 <= abs(i) < 14,  corresponding to the cases desired.')\n    parser.add_argument('-r', '--rotation', type=int, default=0,\n                        help='Rotate camera around the cube, for i such that 0 <= abs(i) < 4,\\\n                          corresponding to 0, 90, 180, 270 degrees.')\n    # Use a mutually exclusive group.\n    label_parser = parser.add_mutually_exclusive_group(required=False)\n    label_parser.add_argument('-l', '--label', action='store_true', dest='label',\n                              help='Display a label, true by default.')\n    label_parser.add_argument('-n', '--no_label', action='store_false', dest='label',\n                              help='Supress diaplaying a label.')\n    parser.set_defaults(label=True)\n    args = parser.parse_args()\n    return args.cases, args.rotation, args.label\n\n\ndef marching_cubes(mcCases, rotation=0, label=True):\n    color = vtkNamedColors()\n\n    # Rotate the final figure 0, 90, 180, 270 degrees.\n    rotation = abs(int(rotation))\n    if rotation > 3:\n        rotation = 0\n\n    if len(mcCases) > 1:\n        print('Cases', ', '.join(map(str, mcCases)))\n    else:\n        print('Cases', ','.join(map(str, mcCases)))\n    print('Rotated', rotation * 90, 'degrees.')\n\n    renWin = vtkRenderWindow()\n    renWin.SetSize(640, 480)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Always use a grid of four columns unless number of cases < 4.\n    renderers = list()\n    gridSize = ((len(mcCases) + 3) // 4) * 4\n    if len(mcCases) < 4:\n        gridSize = len(mcCases)\n    for i in range(0, gridSize):\n        # Create the Renderer\n        renderer = vtkRenderer()\n        renderers.append(renderer)\n        # Set the background color.\n        renderers[i].SetBackground(color.GetColor3d('slate_grey'))\n        renWin.AddRenderer(renderer)\n\n    for i in range(0, len(mcCases)):\n        # Define a Single Cube\n        Scalars = vtkFloatArray()\n        Scalars.InsertNextValue(1.0)\n        Scalars.InsertNextValue(0.0)\n        Scalars.InsertNextValue(0.0)\n        Scalars.InsertNextValue(1.0)\n        Scalars.InsertNextValue(0.0)\n        Scalars.InsertNextValue(0.0)\n        Scalars.InsertNextValue(0.0)\n        Scalars.InsertNextValue(0.0)\n\n        Points = vtkPoints()\n        Points.InsertNextPoint(0, 0, 0)\n        Points.InsertNextPoint(1, 0, 0)\n        Points.InsertNextPoint(1, 1, 0)\n        Points.InsertNextPoint(0, 1, 0)\n        Points.InsertNextPoint(0, 0, 1)\n        Points.InsertNextPoint(1, 0, 1)\n        Points.InsertNextPoint(1, 1, 1)\n        Points.InsertNextPoint(0, 1, 1)\n\n        Ids = vtkIdList()\n        Ids.InsertNextId(0)\n        Ids.InsertNextId(1)\n        Ids.InsertNextId(2)\n        Ids.InsertNextId(3)\n        Ids.InsertNextId(4)\n        Ids.InsertNextId(5)\n        Ids.InsertNextId(6)\n        Ids.InsertNextId(7)\n\n        Grid = vtkUnstructuredGrid()\n        Grid.Allocate(10, 10)\n        Grid.InsertNextCell(12, Ids)\n        Grid.SetPoints(Points)\n        Grid.GetPointData().SetScalars(Scalars)\n\n        # Find the triangles that lie along the 0.5 contour in this cube.\n        Marching = vtkContourFilter()\n        Marching.SetInputData(Grid)\n        Marching.SetValue(0, 0.5)\n        Marching.Update()\n\n        # Extract the edges of the triangles just found.\n        triangleEdges = vtkExtractEdges()\n        triangleEdges.SetInputConnection(Marching.GetOutputPort())\n\n        # Draw the edges as tubes instead of lines.  Also create the associated\n        # mapper and actor to display the tubes.\n        triangleEdgeTubes = vtkTubeFilter()\n        triangleEdgeTubes.SetInputConnection(triangleEdges.GetOutputPort())\n        triangleEdgeTubes.SetRadius(.005)\n        triangleEdgeTubes.SetNumberOfSides(6)\n        triangleEdgeTubes.UseDefaultNormalOn()\n        triangleEdgeTubes.SetDefaultNormal(.577, .577, .577)\n\n        triangleEdgeMapper = vtkPolyDataMapper()\n        triangleEdgeMapper.SetInputConnection(triangleEdgeTubes.GetOutputPort())\n        triangleEdgeMapper.ScalarVisibilityOff()\n\n        triangleEdgeActor = vtkActor()\n        triangleEdgeActor.SetMapper(triangleEdgeMapper)\n        triangleEdgeActor.GetProperty().SetDiffuseColor(\n            color.GetColor3d('lamp_black'))\n        triangleEdgeActor.GetProperty().SetSpecular(.4)\n        triangleEdgeActor.GetProperty().SetSpecularPower(10)\n\n        # Shrink the triangles we found earlier.  Create the associated mapper\n        # and actor.  Set the opacity of the shrunken triangles.\n        aShrinker = vtkShrinkPolyData()\n        aShrinker.SetShrinkFactor(1)\n        aShrinker.SetInputConnection(Marching.GetOutputPort())\n\n        aMapper = vtkPolyDataMapper()\n        aMapper.ScalarVisibilityOff()\n        aMapper.SetInputConnection(aShrinker.GetOutputPort())\n\n        Triangles = vtkActor()\n        Triangles.SetMapper(aMapper)\n        Triangles.GetProperty().SetDiffuseColor(\n            color.GetColor3d('banana'))\n        Triangles.GetProperty().SetOpacity(.6)\n\n        # Draw a cube the same size and at the same position as the one\n        # created previously.  Extract the edges because we only want to see\n        # the outline of the cube.  Pass the edges through a vtkTubeFilter so\n        # they are displayed as tubes rather than lines.\n        CubeModel = vtkCubeSource()\n        CubeModel.SetCenter(.5, .5, .5)\n\n        Edges = vtkExtractEdges()\n        Edges.SetInputConnection(CubeModel.GetOutputPort())\n\n        Tubes = vtkTubeFilter()\n        Tubes.SetInputConnection(Edges.GetOutputPort())\n        Tubes.SetRadius(.01)\n        Tubes.SetNumberOfSides(6)\n        Tubes.UseDefaultNormalOn()\n        Tubes.SetDefaultNormal(.577, .577, .577)\n        # Create the mapper and actor to display the cube edges.\n        TubeMapper = vtkPolyDataMapper()\n        TubeMapper.SetInputConnection(Tubes.GetOutputPort())\n        CubeEdges = vtkActor()\n        CubeEdges.SetMapper(TubeMapper)\n        CubeEdges.GetProperty().SetDiffuseColor(\n            color.GetColor3d('khaki'))\n        CubeEdges.GetProperty().SetSpecular(.4)\n        CubeEdges.GetProperty().SetSpecularPower(10)\n\n        # Create a sphere to use as a glyph source for vtkGlyph3D.\n        Sphere = vtkSphereSource()\n        Sphere.SetRadius(0.04)\n        Sphere.SetPhiResolution(20)\n        Sphere.SetThetaResolution(20)\n        # Remove the part of the cube with data values below 0.5.\n        ThresholdIn = vtkThresholdPoints()\n        ThresholdIn.SetInputData(Grid)\n        ThresholdIn.ThresholdByUpper(.5)\n        # Display spheres at the vertices remaining in the cube data set after\n        # it was passed through vtkThresholdPoints.\n        Vertices = vtkGlyph3D()\n        Vertices.SetInputConnection(ThresholdIn.GetOutputPort())\n        Vertices.SetSourceConnection(Sphere.GetOutputPort())\n        # Create a mapper and actor to display the glyphs.\n        SphereMapper = vtkPolyDataMapper()\n        SphereMapper.SetInputConnection(Vertices.GetOutputPort())\n        SphereMapper.ScalarVisibilityOff()\n\n        CubeVertices = vtkActor()\n        CubeVertices.SetMapper(SphereMapper)\n        CubeVertices.GetProperty().SetDiffuseColor(\n            color.GetColor3d('tomato'))\n\n        # Define the text for the label\n        caseLabel = vtkVectorText()\n        caseLabel.SetText('Case 1')\n\n        if label:\n            # Set up a transform to move the label to a new position.\n            aLabelTransform = vtkTransform()\n            aLabelTransform.Identity()\n            # Position the label according to the rotation of the figure.\n            if rotation == 0:\n                aLabelTransform.Translate(-0.2, 0, 1.25)\n                aLabelTransform.Scale(.05, .05, .05)\n            elif rotation == 1:\n                aLabelTransform.RotateY(90)\n                aLabelTransform.Translate(-1.25, 0, 1.25)\n                aLabelTransform.Scale(.05, .05, .05)\n            elif rotation == 2:\n                aLabelTransform.RotateY(180)\n                aLabelTransform.Translate(-1.25, 0, 0.2)\n                aLabelTransform.Scale(.05, .05, .05)\n            else:\n                aLabelTransform.RotateY(270)\n                aLabelTransform.Translate(-0.2, 0, 0.2)\n                aLabelTransform.Scale(.05, .05, .05)\n\n            # Move the label to a new position.\n            labelTransform = vtkTransformPolyDataFilter()\n            labelTransform.SetTransform(aLabelTransform)\n            labelTransform.SetInputConnection(caseLabel.GetOutputPort())\n\n            # Create a mapper and actor to display the text.\n            labelMapper = vtkPolyDataMapper()\n            labelMapper.SetInputConnection(labelTransform.GetOutputPort())\n\n            labelActor = vtkActor()\n            labelActor.SetMapper(labelMapper)\n\n        # Define the base that the cube sits on.  Create its associated mapper\n        # and actor.  Set the position of the actor.\n        baseModel = vtkCubeSource()\n        baseModel.SetXLength(1.5)\n        baseModel.SetYLength(.01)\n        baseModel.SetZLength(1.5)\n\n        baseMapper = vtkPolyDataMapper()\n        baseMapper.SetInputConnection(baseModel.GetOutputPort())\n\n        base = vtkActor()\n        base.SetMapper(baseMapper)\n        base.SetPosition(.5, -0.09, .5)\n\n        # Set the scalar values for this case of marching cubes.\n        # A negative case number will generate a complementary case\n        mcCase = mcCases[i]\n        if mcCase < 0:\n            cases[-mcCase](Scalars, caseLabel, 0, 1)\n        else:\n            cases[mcCase](Scalars, caseLabel, 1, 0)\n        # Force the grid to update.\n        Grid.Modified()\n\n        # Add the actors to the renderer\n        renderers[i].AddActor(triangleEdgeActor)\n        renderers[i].AddActor(base)\n        if label:\n            renderers[i].AddActor(labelActor)\n        renderers[i].AddActor(CubeEdges)\n        renderers[i].AddActor(CubeVertices)\n        renderers[i].AddActor(Triangles)\n\n        # Position the camera.\n        renderers[i].GetActiveCamera().Dolly(1.2)\n        # Rotate the camera an extra 30 degrees so the cube is not face on.\n        if rotation == 0:\n            renderers[i].GetActiveCamera().Azimuth(30)\n        elif rotation == 1:\n            renderers[i].GetActiveCamera().Azimuth(30 + 90)\n        elif rotation == 2:\n            renderers[i].GetActiveCamera().Azimuth(30 + 180)\n        else:\n            renderers[i].GetActiveCamera().Azimuth(30 + 270)\n\n        renderers[i].GetActiveCamera().Elevation(20)\n        renderers[i].ResetCamera()\n        renderers[i].ResetCameraClippingRange()\n        if i > 0:\n            renderers[i].SetActiveCamera(renderers[0].GetActiveCamera())\n\n    # Setup viewports for the renderers\n    rendererSize = 300\n    xGridDimensions = 4\n    if len(mcCases) < 4:\n        xGridDimensions = len(mcCases)\n    yGridDimensions = (len(mcCases) - 1) // 4 + 1\n    print('Grid dimensions, (x, y): ({:d}, {:d})'.format(xGridDimensions, yGridDimensions))\n    renWin.SetSize(\n        rendererSize * xGridDimensions, rendererSize * yGridDimensions)\n    renWin.SetWindowName('MarchingCases')\n    for row in range(0, yGridDimensions):\n        for col in range(0, xGridDimensions):\n            index = row * xGridDimensions + col\n\n            # (xmin, ymin, xmax, ymax)\n            viewport = [\n                float(col) / xGridDimensions,\n                float(yGridDimensions - (row + 1)) / yGridDimensions,\n                float(col + 1) / xGridDimensions,\n                float(yGridDimensions - row) / yGridDimensions]\n\n            renderers[index].SetViewport(viewport)\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef case0(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 0 - 00000000')\n    else:\n        caseLabel.SetText('Case 0c - 11111111')\n\n\ndef case1(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 1 - 00000001')\n    else:\n        caseLabel.SetText('Case 1c - 11111110')\n\n\ndef case2(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 2 - 00000011')\n    else:\n        caseLabel.SetText('Case 2c - 11111100')\n\n\ndef case3(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, IN)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 3 - 00000101')\n    else:\n        caseLabel.SetText('Case 3c - 11111010')\n\n\ndef case4(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 4 - 01000001')\n    else:\n        caseLabel.SetText('Case 4c - 10111110')\n\n\ndef case5(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 5 - 00110010')\n    else:\n        caseLabel.SetText('Case 5c - 11001101')\n\n\ndef case6(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 6 - 00011010')\n    else:\n        caseLabel.SetText('Case 6c - 11100101')\n\n\ndef case7(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 7 - 01000011')\n    else:\n        caseLabel.SetText('Case 7c - 10111100')\n\n\ndef case8(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 8 - 00110011')\n    else:\n        caseLabel.SetText('Case 8c - 11001100')\n\n\ndef case9(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, IN)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 9 - 01001110')\n    else:\n        caseLabel.SetText('Case 9c - 10110001')\n\n\ndef case10(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 10 - 01101001')\n    else:\n        caseLabel.SetText('Case 10c - 10010110')\n\n\ndef case11(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, OUT)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 11 - 01110001')\n    else:\n        caseLabel.SetText('Case 11c - 10001110')\n\n\ndef case12(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, OUT)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 12 - 00111010')\n    else:\n        caseLabel.SetText('Case 12c - 11000101')\n\n\ndef case13(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, OUT)\n    scalars.InsertValue(1, IN)\n    scalars.InsertValue(2, OUT)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, IN)\n    scalars.InsertValue(5, OUT)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, OUT)\n    if IN == 1:\n        caseLabel.SetText('Case 13 - 01011010')\n    else:\n        caseLabel.SetText('Case 13c - 10100101')\n\n\ndef case14(scalars, caseLabel, IN, OUT):\n    scalars.InsertValue(0, IN)\n    scalars.InsertValue(1, OUT)\n    scalars.InsertValue(2, IN)\n    scalars.InsertValue(3, IN)\n    scalars.InsertValue(4, OUT)\n    scalars.InsertValue(5, IN)\n    scalars.InsertValue(6, IN)\n    scalars.InsertValue(7, IN)\n    if IN == 1:\n        caseLabel.SetText('Case 14 - 11101101')\n    else:\n        caseLabel.SetText('Case 14c - 00010010')\n\n\ncases = [case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10, case11, case12, case13, case14]\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/MarchingCasesA/","title":"MarchingCasesA","text":"

        vtk-examples/Python/VisualizationAlgorithms/MarchingCasesA

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/MarchingCasesA/#code","title":"Code","text":"

        MarchingCasesA.py

        #!/usr/bin/env python\n\n\"\"\"\nMarching cubes cases for 3D isosurface generation.\nThe 256 possible cases have been reduced to 15 cases using symmetry.\nDark vertices are greater than the selected isosurface value.\n\nNote: Make sure MarchingCases.py is in the same directory as this program.\n\"\"\"\n\nimport MarchingCases\n\n\ndef main():\n    mc_cases = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n    MarchingCases.marching_cubes(mc_cases)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/MarchingCasesB/","title":"MarchingCasesB","text":"

        vtk-examples/Python/VisualizationAlgorithms/MarchingCasesB

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/MarchingCasesB/#code","title":"Code","text":"

        MarchingCasesB.py

        #!/usr/bin/env python\n\n\"\"\"\nMarching cubes complementary cases.\n\nCases 3c, 6c, 7c, 10c, 12c and 13c are displayed.\n\nNote: Make sure MarchingCases.py is in the same directory as this program.\n\"\"\"\n\nimport MarchingCases\n\n\ndef main():\n    mc_cases = [-3, -6, -7, -10, -12, -13]\n    MarchingCases.marching_cubes(mc_cases)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/MarchingCasesC/","title":"MarchingCasesC","text":"

        vtk-examples/Python/VisualizationAlgorithms/MarchingCasesC

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/MarchingCasesC/#code","title":"Code","text":"

        MarchingCasesC.py

        #!/usr/bin/env python\n\n\"\"\"\nMarching cubes cases.\n\nCase 3 is rotated 90 degrees about the y-axis with no label.\n\nNote: Make sure MarchingCases.py is in the same directory as this program.\n\"\"\"\n\nimport MarchingCases\n\n\ndef main():\n    mc_cases = [3]\n    rotation = 1\n    label = False\n    MarchingCases.marching_cubes(mc_cases, rotation, label)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/MarchingCasesD/","title":"MarchingCasesD","text":"

        vtk-examples/Python/VisualizationAlgorithms/MarchingCasesD

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/MarchingCasesD/#code","title":"Code","text":"

        MarchingCasesD.py

        #!/usr/bin/env python\n\n\"\"\"\nMarching cubes cases.\n\nCase 7 is rotated 180 degrees about the y-axis with no label.\n\nNote: Make sure MarchingCases.py is in the same directory as this program.\n\"\"\"\n\nimport MarchingCases\n\n\ndef main():\n    mc_cases = [7]\n    rotation = 2\n    label = False\n    MarchingCases.marching_cubes(mc_cases, rotation, label)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/Motor/","title":"Motor","text":"

        vtk-examples/Python/VisualizationAlgorithms/Motor

        "},{"location":"Python/VisualizationAlgorithms/Motor/#description","title":"Description","text":"

        This is an example of texture clipping using a transparent texture map. The motor shown consists of five complex parts, some of which are hidden by the outer casing. To see the inside of the motor, we define an implicit clipping function. This function is simply the intersection of two planes to form a clipping \"corner\". The object vtkImplicitTextureCoords is used in combination with this implicit function to generate texture coordinates. These objects are then rendered with the appropriate texture map and the internal parts of the motor can be seen.

        The texture map consists of three regions (as described previously in the chapter). The concealed region is transparent. The transition region is opaque but with a black (zero intensity) color. The highlighted region is full intensity and opaque. As can be seen from the result , the boundaries appear as black borders giving a nice visual effect.

        Note the use of vectors in the C++ version and lists in the Python version to reduce repetitious code.

        Info

        See Figure 9-53 in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/Motor/#code","title":"Code","text":"

        Motor.py

        #!/usr/bin/env python\n\n# This code is based on the VTK file: /IO/Geometry/Testing/Python/motor.py.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkFloatArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import vtkPlanes\nfrom vtkmodules.vtkFiltersCore import vtkPolyDataNormals\nfrom vtkmodules.vtkFiltersTexture import vtkImplicitTextureCoords\nfrom vtkmodules.vtkIOGeometry import vtkBYUReader\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTexture\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    textureFile, motorFile = get_program_parameters()\n\n    # Create the Renderer, RenderWindow and RenderWindowInteractor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the cutting planes.\n    planes = vtkPlanes()\n    points = vtkPoints()\n    norms = vtkFloatArray()\n\n    norms.SetNumberOfComponents(3)\n    points.InsertPoint(0, 0.0, 0.0, 0.0)\n    norms.InsertTuple3(0, 0.0, 0.0, 1.0)\n    points.InsertPoint(1, 0.0, 0.0, 0.0)\n    norms.InsertTuple3(1, -1.0, 0.0, 0.0)\n    planes.SetPoints(points)\n    planes.SetNormals(norms)\n\n    # Get the texture.\n    texReader = vtkStructuredPointsReader()\n    texReader.SetFileName(textureFile)\n    texture = vtkTexture()\n    texture.SetInputConnection(texReader.GetOutputPort())\n    texture.InterpolateOff()\n    texture.RepeatOff()\n\n    # Set up the pipelines for the parts of the motor.\n    # We will use lists of pipeline objects.\n    numberOfParts = 5\n    byu = list()\n    normals = list()\n    tex = list()\n    byuMapper = list()\n    byuActor = list()\n    partColours = ['cold_grey', 'peacock', 'raw_sienna', 'banana', 'peach_puff']\n    # Use this to control which parts to display.\n    displayParts = [True] * numberOfParts\n    # If displayParts[2] = False then an image like that in the VTK tests is produced.\n\n    # Build the pipelines.\n    for i in range(0, numberOfParts):\n        byu.append(vtkBYUReader())\n        byu[i].SetGeometryFileName(motorFile)\n        byu[i].SetPartNumber(i + 1)\n\n        normals.append(vtkPolyDataNormals())\n        normals[i].SetInputConnection(byu[i].GetOutputPort())\n\n        tex.append(vtkImplicitTextureCoords())\n        tex[i].SetInputConnection(normals[i].GetOutputPort())\n        tex[i].SetRFunction(planes)\n        # tex[i].FlipTextureOn()\n\n        byuMapper.append(vtkDataSetMapper())\n        byuMapper[i].SetInputConnection(tex[i].GetOutputPort())\n\n        byuActor.append(vtkActor())\n        byuActor[i].SetMapper(byuMapper[i])\n        byuActor[i].SetTexture(texture)\n        byuActor[i].GetProperty().SetColor(colors.GetColor3d(partColours[i]))\n\n        ren.AddActor(byuActor[i])\n        if displayParts[i]:\n            byuActor[i].VisibilityOn()\n        else:\n            byuActor[i].VisibilityOff()\n\n    ren.SetBackground(colors.GetColor3d('AliceBlue'))\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('Motor')\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(0.0286334, 0.0362996, 0.0379685)\n    camera.SetPosition(1.37067, 1.08629, -1.30349)\n    camera.SetViewAngle(17.673)\n    camera.SetClippingRange(1, 10)\n    camera.SetViewUp(-0.376306, -0.5085, -0.774482)\n    ren.SetActiveCamera(camera)\n\n    # Render the image.\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Texture clipping using a transparent texture map.'\n    epilogue = '''\n        Texture clipping using a transparent texture map.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('textureFile', help='The texture file: texThres2.vtk')\n    parser.add_argument('motorFile', help='The motor file: motor.g.')\n    args = parser.parse_args()\n    return args.textureFile, args.motorFile\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/Office/","title":"Office","text":"

        vtk-examples/Python/VisualizationAlgorithms/Office

        "},{"location":"Python/VisualizationAlgorithms/Office/#description","title":"Description","text":"

        Using random point seeds to create streamlines.

        This example demonstrates the use of vtkPointSource to generate streamlines. The dataset is a structured grid representation of a CFD simulation of flow in a small office with flow velocity and a scalar pressure field. As this picture shows, there are a couple of bookcases, desks, a window, and an inlet and outlet for the ventilation system. On one of the desks is a small, intense heat source (e.g., a cigarette).

        We generate 25 streamlines that are started near the inlet using a vtkPointSource point generator. By adjusting a single parameter (e.g., the center of the point source) it is possible to quickly explore our simulation data.

        This program provides you with an optional parameter to select from one of several point source centers. The figure was created using:

        ./Office office.vtk 3\n

        Info

        See Figure 9-47 in Chapter 9 in the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/Office/#code","title":"Code","text":"

        Office.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkFiltersSources import vtkPointSource\nfrom vtkmodules.vtkIOLegacy import vtkDataSetReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef office(fileName, center):\n    # These are the centers for the streamline seed.\n    seedCenters = [\n        [0.0, 2.1, 0.5],\n        [0.1, 2.1, 0.5],\n        [0.1, 2.7, 0.5],\n        [0.08, 2.7, 0.5]\n    ]\n    center = abs(center)\n    if center >= len(seedCenters):\n        center = len(seedCenters) - 1\n\n    colors = vtkNamedColors()\n    # Set the furniture colors, matching those in the VTKTextBook.\n    tableTopColor = [0.59, 0.427, 0.392]\n    filingCabinetColor = [0.8, 0.8, 0.6]\n    bookShelfColor = [0.8, 0.8, 0.6]\n    windowColor = [0.3, 0.3, 0.5]\n    colors.SetColor('TableTop', *tableTopColor)\n    colors.SetColor('FilingCabinet', *filingCabinetColor)\n    colors.SetColor('BookShelf', *bookShelfColor)\n    colors.SetColor('WindowColor', *windowColor)\n\n    # We read a data file that represents a CFD analysis of airflow in an office\n    # (with ventilation and a burning cigarette).\n    reader = vtkDataSetReader()\n    reader.SetFileName(fileName)\n\n    # Create the scene.\n    # We generate a whole bunch of planes which correspond to\n    # the geometry in the analysis; tables, bookshelves and so on.\n    table1 = vtkStructuredGridGeometryFilter()\n    table1.SetInputData(reader.GetStructuredGridOutput())\n    table1.SetExtent(11, 15, 7, 9, 8, 8)\n    mapTable1 = vtkPolyDataMapper()\n    mapTable1.SetInputConnection(table1.GetOutputPort())\n    mapTable1.ScalarVisibilityOff()\n    table1Actor = vtkActor()\n    table1Actor.SetMapper(mapTable1)\n    table1Actor.GetProperty().SetColor(colors.GetColor3d('TableTop'))\n\n    table2 = vtkStructuredGridGeometryFilter()\n    table2.SetInputData(reader.GetStructuredGridOutput())\n    table2.SetExtent(11, 15, 10, 12, 8, 8)\n    mapTable2 = vtkPolyDataMapper()\n    mapTable2.SetInputConnection(table2.GetOutputPort())\n    mapTable2.ScalarVisibilityOff()\n    table2Actor = vtkActor()\n    table2Actor.SetMapper(mapTable2)\n    table2Actor.GetProperty().SetColor(colors.GetColor3d('TableTop'))\n\n    FilingCabinet1 = vtkStructuredGridGeometryFilter()\n    FilingCabinet1.SetInputData(reader.GetStructuredGridOutput())\n    FilingCabinet1.SetExtent(15, 15, 7, 9, 0, 8)\n    mapFilingCabinet1 = vtkPolyDataMapper()\n    mapFilingCabinet1.SetInputConnection(FilingCabinet1.GetOutputPort())\n    mapFilingCabinet1.ScalarVisibilityOff()\n    FilingCabinet1Actor = vtkActor()\n    FilingCabinet1Actor.SetMapper(mapFilingCabinet1)\n    FilingCabinet1Actor.GetProperty().SetColor(colors.GetColor3d('FilingCabinet'))\n\n    FilingCabinet2 = vtkStructuredGridGeometryFilter()\n    FilingCabinet2.SetInputData(reader.GetStructuredGridOutput())\n    FilingCabinet2.SetExtent(15, 15, 10, 12, 0, 8)\n    mapFilingCabinet2 = vtkPolyDataMapper()\n    mapFilingCabinet2.SetInputConnection(FilingCabinet2.GetOutputPort())\n    mapFilingCabinet2.ScalarVisibilityOff()\n    FilingCabinet2Actor = vtkActor()\n    FilingCabinet2Actor.SetMapper(mapFilingCabinet2)\n    FilingCabinet2Actor.GetProperty().SetColor(colors.GetColor3d('FilingCabinet'))\n\n    bookshelf1Top = vtkStructuredGridGeometryFilter()\n    bookshelf1Top.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Top.SetExtent(13, 13, 0, 4, 0, 11)\n    mapBookshelf1Top = vtkPolyDataMapper()\n    mapBookshelf1Top.SetInputConnection(bookshelf1Top.GetOutputPort())\n    mapBookshelf1Top.ScalarVisibilityOff()\n    bookshelf1TopActor = vtkActor()\n    bookshelf1TopActor.SetMapper(mapBookshelf1Top)\n    bookshelf1TopActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Bottom = vtkStructuredGridGeometryFilter()\n    bookshelf1Bottom.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Bottom.SetExtent(20, 20, 0, 4, 0, 11)\n    mapBookshelf1Bottom = vtkPolyDataMapper()\n    mapBookshelf1Bottom.SetInputConnection(bookshelf1Bottom.GetOutputPort())\n    mapBookshelf1Bottom.ScalarVisibilityOff()\n    bookshelf1BottomActor = vtkActor()\n    bookshelf1BottomActor.SetMapper(mapBookshelf1Bottom)\n    bookshelf1BottomActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Front = vtkStructuredGridGeometryFilter()\n    bookshelf1Front.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Front.SetExtent(13, 20, 0, 0, 0, 11)\n    mapBookshelf1Front = vtkPolyDataMapper()\n    mapBookshelf1Front.SetInputConnection(bookshelf1Front.GetOutputPort())\n    mapBookshelf1Front.ScalarVisibilityOff()\n    bookshelf1FrontActor = vtkActor()\n    bookshelf1FrontActor.SetMapper(mapBookshelf1Front)\n    bookshelf1FrontActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Back = vtkStructuredGridGeometryFilter()\n    bookshelf1Back.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Back.SetExtent(13, 20, 4, 4, 0, 11)\n    mapBookshelf1Back = vtkPolyDataMapper()\n    mapBookshelf1Back.SetInputConnection(bookshelf1Back.GetOutputPort())\n    mapBookshelf1Back.ScalarVisibilityOff()\n    bookshelf1BackActor = vtkActor()\n    bookshelf1BackActor.SetMapper(mapBookshelf1Back)\n    bookshelf1BackActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1LHS = vtkStructuredGridGeometryFilter()\n    bookshelf1LHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1LHS.SetExtent(13, 20, 0, 4, 0, 0)\n    mapBookshelf1LHS = vtkPolyDataMapper()\n    mapBookshelf1LHS.SetInputConnection(bookshelf1LHS.GetOutputPort())\n    mapBookshelf1LHS.ScalarVisibilityOff()\n    bookshelf1LHSActor = vtkActor()\n    bookshelf1LHSActor.SetMapper(mapBookshelf1LHS)\n    bookshelf1LHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1RHS = vtkStructuredGridGeometryFilter()\n    bookshelf1RHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1RHS.SetExtent(13, 20, 0, 4, 11, 11)\n    mapBookshelf1RHS = vtkPolyDataMapper()\n    mapBookshelf1RHS.SetInputConnection(bookshelf1RHS.GetOutputPort())\n    mapBookshelf1RHS.ScalarVisibilityOff()\n    bookshelf1RHSActor = vtkActor()\n    bookshelf1RHSActor.SetMapper(mapBookshelf1RHS)\n    bookshelf1RHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Top = vtkStructuredGridGeometryFilter()\n    bookshelf2Top.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Top.SetExtent(13, 13, 15, 19, 0, 11)\n    mapBookshelf2Top = vtkPolyDataMapper()\n    mapBookshelf2Top.SetInputConnection(bookshelf2Top.GetOutputPort())\n    mapBookshelf2Top.ScalarVisibilityOff()\n    bookshelf2TopActor = vtkActor()\n    bookshelf2TopActor.SetMapper(mapBookshelf2Top)\n    bookshelf2TopActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Bottom = vtkStructuredGridGeometryFilter()\n    bookshelf2Bottom.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Bottom.SetExtent(20, 20, 15, 19, 0, 11)\n    mapBookshelf2Bottom = vtkPolyDataMapper()\n    mapBookshelf2Bottom.SetInputConnection(bookshelf2Bottom.GetOutputPort())\n    mapBookshelf2Bottom.ScalarVisibilityOff()\n    bookshelf2BottomActor = vtkActor()\n    bookshelf2BottomActor.SetMapper(mapBookshelf2Bottom)\n    bookshelf2BottomActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Front = vtkStructuredGridGeometryFilter()\n    bookshelf2Front.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Front.SetExtent(13, 20, 15, 15, 0, 11)\n    mapBookshelf2Front = vtkPolyDataMapper()\n    mapBookshelf2Front.SetInputConnection(bookshelf2Front.GetOutputPort())\n    mapBookshelf2Front.ScalarVisibilityOff()\n    bookshelf2FrontActor = vtkActor()\n    bookshelf2FrontActor.SetMapper(mapBookshelf2Front)\n    bookshelf2FrontActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Back = vtkStructuredGridGeometryFilter()\n    bookshelf2Back.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Back.SetExtent(13, 20, 19, 19, 0, 11)\n    mapBookshelf2Back = vtkPolyDataMapper()\n    mapBookshelf2Back.SetInputConnection(bookshelf2Back.GetOutputPort())\n    mapBookshelf2Back.ScalarVisibilityOff()\n    bookshelf2BackActor = vtkActor()\n    bookshelf2BackActor.SetMapper(mapBookshelf2Back)\n    bookshelf2BackActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2LHS = vtkStructuredGridGeometryFilter()\n    bookshelf2LHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2LHS.SetExtent(13, 20, 15, 19, 0, 0)\n    mapBookshelf2LHS = vtkPolyDataMapper()\n    mapBookshelf2LHS.SetInputConnection(bookshelf2LHS.GetOutputPort())\n    mapBookshelf2LHS.ScalarVisibilityOff()\n    bookshelf2LHSActor = vtkActor()\n    bookshelf2LHSActor.SetMapper(mapBookshelf2LHS)\n    bookshelf2LHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2RHS = vtkStructuredGridGeometryFilter()\n    bookshelf2RHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2RHS.SetExtent(13, 20, 15, 19, 11, 11)\n    mapBookshelf2RHS = vtkPolyDataMapper()\n    mapBookshelf2RHS.SetInputConnection(bookshelf2RHS.GetOutputPort())\n    mapBookshelf2RHS.ScalarVisibilityOff()\n    bookshelf2RHSActor = vtkActor()\n    bookshelf2RHSActor.SetMapper(mapBookshelf2RHS)\n    bookshelf2RHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    window = vtkStructuredGridGeometryFilter()\n    window.SetInputData(reader.GetStructuredGridOutput())\n    window.SetExtent(20, 20, 6, 13, 10, 13)\n    mapWindow = vtkPolyDataMapper()\n    mapWindow.SetInputConnection(window.GetOutputPort())\n    mapWindow.ScalarVisibilityOff()\n    windowActor = vtkActor()\n    windowActor.SetMapper(mapWindow)\n    windowActor.GetProperty().SetColor(colors.GetColor3d('WindowColor'))\n\n    outlet = vtkStructuredGridGeometryFilter()\n    outlet.SetInputData(reader.GetStructuredGridOutput())\n    outlet.SetExtent(0, 0, 9, 10, 14, 16)\n    mapOutlet = vtkPolyDataMapper()\n    mapOutlet.SetInputConnection(outlet.GetOutputPort())\n    mapOutlet.ScalarVisibilityOff()\n    outletActor = vtkActor()\n    outletActor.SetMapper(mapOutlet)\n    outletActor.GetProperty().SetColor(colors.GetColor3d('lamp_black'))\n\n    inlet = vtkStructuredGridGeometryFilter()\n    inlet.SetInputData(reader.GetStructuredGridOutput())\n    inlet.SetExtent(0, 0, 9, 10, 0, 6)\n    mapInlet = vtkPolyDataMapper()\n    mapInlet.SetInputConnection(inlet.GetOutputPort())\n    mapInlet.ScalarVisibilityOff()\n    inletActor = vtkActor()\n    inletActor.SetMapper(mapInlet)\n    inletActor.GetProperty().SetColor(colors.GetColor3d('lamp_black'))\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(reader.GetStructuredGridOutput())\n    mapOutline = vtkPolyDataMapper()\n    mapOutline.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(mapOutline)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create the source for the streamtubes.\n    seeds = vtkPointSource()\n    seeds.SetRadius(0.075)\n    seeds.SetCenter(seedCenters[center])\n    seeds.SetNumberOfPoints(25)\n    streamers = vtkStreamTracer()\n    streamers.SetInputConnection(reader.GetOutputPort())\n    streamers.SetSourceConnection(seeds.GetOutputPort())\n    streamers.SetMaximumPropagation(500)\n    streamers.SetMinimumIntegrationStep(0.1)\n    streamers.SetMaximumIntegrationStep(1.0)\n    streamers.SetInitialIntegrationStep(0.2)\n    streamers.SetIntegratorType(2)\n    streamers.Update()\n    mapStreamers = vtkPolyDataMapper()\n    mapStreamers.SetInputConnection(streamers.GetOutputPort())\n    mapStreamers.SetScalarRange(reader.GetOutput().GetPointData().GetScalars().GetRange())\n    streamersActor = vtkActor()\n    streamersActor.SetMapper(mapStreamers)\n\n    # Create the rendering window, renderer, and interactive renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    renWin.SetWindowName('Office')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the remaining actors to the renderer, set the background and size.\n    ren.AddActor(table1Actor)\n    ren.AddActor(table2Actor)\n    ren.AddActor(FilingCabinet1Actor)\n    ren.AddActor(FilingCabinet2Actor)\n    ren.AddActor(bookshelf1TopActor)\n    ren.AddActor(bookshelf1BottomActor)\n    ren.AddActor(bookshelf1FrontActor)\n    ren.AddActor(bookshelf1BackActor)\n    ren.AddActor(bookshelf1LHSActor)\n    ren.AddActor(bookshelf1RHSActor)\n    ren.AddActor(bookshelf2TopActor)\n    ren.AddActor(bookshelf2BottomActor)\n    ren.AddActor(bookshelf2FrontActor)\n    ren.AddActor(bookshelf2BackActor)\n    ren.AddActor(bookshelf2LHSActor)\n    ren.AddActor(bookshelf2RHSActor)\n    ren.AddActor(windowActor)\n    ren.AddActor(outletActor)\n    ren.AddActor(inletActor)\n    ren.AddActor(outlineActor)\n    ren.AddActor(streamersActor)\n\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    aCamera = vtkCamera()\n    aCamera.SetClippingRange(0.726079, 36.3039)\n    aCamera.SetFocalPoint(2.43584, 2.15046, 1.11104)\n    aCamera.SetPosition(-4.76183, -10.4426, 3.17203)\n    aCamera.ComputeViewPlaneNormal()\n    aCamera.SetViewUp(0.0511273, 0.132773, 0.989827)\n    aCamera.SetViewAngle(18.604)\n    aCamera.Zoom(1.2)\n\n    ren.SetActiveCamera(aCamera)\n\n    renWin.SetSize(640, 400)\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrate the use of vtkPointSource to generate streamlines.'\n    epilogue = '''\n    center: An optional parameter choosing the center for the seeds.\n        0 - Corresponds to Fig 9-47(a) in the VTK textbook.\n        1 - A slight shift to the left.\n        2 - A slight shift to the upper left (from the original code).\n        3 - The default, a slight shift to the upper left.\n            Roughly corresponds to Fig 9-47(b) in the VTK textbook.\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('fileName', help='office.binary.vtk')\n    parser.add_argument('center', default=3, type=int, nargs='?', help='seed center.')\n    args = parser.parse_args()\n    return args.fileName, args.center\n\n\ndef main():\n    fileName, center = get_program_parameters()\n    office(fileName, center)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/OfficeA/","title":"OfficeA","text":"

        vtk-examples/Python/VisualizationAlgorithms/OfficeA

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/OfficeA/#code","title":"Code","text":"

        OfficeA.py

        #!/usr/bin/env python\n\n\"\"\"\nOfficeA.\n\nNote: Make sure Office.py is in the same directory as this program.\n\"\"\"\n\nimport Office\n\n\ndef main():\n    file_name, center = Office.get_program_parameters()\n    center = 0\n    Office.office(file_name, center)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/OfficeTube/","title":"OfficeTube","text":"

        vtk-examples/Python/VisualizationAlgorithms/OfficeTube

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/OfficeTube/#code","title":"Code","text":"

        OfficeTube.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkDataObject\nfrom vtkmodules.vtkCommonMath import vtkRungeKutta4\nfrom vtkmodules.vtkFiltersCore import (\n    vtkStructuredGridOutlineFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOLegacy import vtkDataSetReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n    # Set the furniture colors, matching those in the VTKTextBook.\n    tableTopColor = [0.59, 0.427, 0.392]\n    filingCabinetColor = [0.8, 0.8, 0.6]\n    bookShelfColor = [0.8, 0.8, 0.6]\n    windowColor = [0.3, 0.3, 0.5]\n    colors.SetColor('TableTop', *tableTopColor)\n    colors.SetColor('FilingCabinet', *filingCabinetColor)\n    colors.SetColor('BookShelf', *bookShelfColor)\n    colors.SetColor('WindowColor', *windowColor)\n\n    # We read a data file that represents a CFD analysis of airflow in an office\n    # (with ventilation and a burning cigarette). We force an update so that we\n    # can query the output for its length, i.e., the length of the diagonal\n    # of the bounding box. This is useful for normalizing the data.\n    reader = vtkDataSetReader()\n    reader.SetFileName(fileName)\n    reader.Update()\n\n    # Now we will generate a single streamline in the data. We select the\n    # integration order to use (RungeKutta order 4) and associate it with\n    # the streamer. The start position is the position in world space where\n    # we want to begin streamline integration; and we integrate in both\n    # directions. The step length is the length of the line segments that\n    # make up the streamline (i.e., related to display). The\n    # IntegrationStepLength specifies the integration step length as a\n    # fraction of the cell size that the streamline is in.\n    integ = vtkRungeKutta4()\n\n    streamer = vtkStreamTracer()\n    streamer.SetInputConnection(reader.GetOutputPort())\n    streamer.SetStartPosition(0.1, 2.1, 0.5)\n    streamer.SetMaximumPropagation(500)\n    streamer.SetInitialIntegrationStep(0.05)\n    streamer.SetIntegrationDirectionToBoth()\n    streamer.SetIntegrator(integ)\n\n    # The tube is wrapped around the generated streamline. By varying the radius\n    # by the inverse of vector magnitude, we are creating a tube whose radius is\n    # proportional to mass flux (in incompressible flow).\n    streamTube = vtkTubeFilter()\n    streamTube.SetInputConnection(streamer.GetOutputPort())\n    streamTube.SetInputArrayToProcess(1, 0, 0, vtkDataObject.FIELD_ASSOCIATION_POINTS, 'vectors')\n    streamTube.SetRadius(0.02)\n    streamTube.SetNumberOfSides(12)\n    streamTube.SetVaryRadiusToVaryRadiusByVector()\n\n    mapStreamTube = vtkPolyDataMapper()\n    mapStreamTube.SetInputConnection(streamTube.GetOutputPort())\n    mapStreamTube.SetScalarRange(reader.GetOutput().GetPointData().GetScalars().GetRange())\n\n    streamTubeActor = vtkActor()\n    streamTubeActor.SetMapper(mapStreamTube)\n    streamTubeActor.GetProperty().BackfaceCullingOn()\n\n    # Create the scene.\n    # We generate a whole bunch of planes which correspond to\n    # the geometry in the analysis; tables, bookshelves and so on.\n    table1 = vtkStructuredGridGeometryFilter()\n    table1.SetInputData(reader.GetStructuredGridOutput())\n    table1.SetExtent(11, 15, 7, 9, 8, 8)\n    mapTable1 = vtkPolyDataMapper()\n    mapTable1.SetInputConnection(table1.GetOutputPort())\n    mapTable1.ScalarVisibilityOff()\n    table1Actor = vtkActor()\n    table1Actor.SetMapper(mapTable1)\n    table1Actor.GetProperty().SetColor(colors.GetColor3d('TableTop'))\n\n    table2 = vtkStructuredGridGeometryFilter()\n    table2.SetInputData(reader.GetStructuredGridOutput())\n    table2.SetExtent(11, 15, 10, 12, 8, 8)\n    mapTable2 = vtkPolyDataMapper()\n    mapTable2.SetInputConnection(table2.GetOutputPort())\n    mapTable2.ScalarVisibilityOff()\n    table2Actor = vtkActor()\n    table2Actor.SetMapper(mapTable2)\n    table2Actor.GetProperty().SetColor(colors.GetColor3d('TableTop'))\n\n    FilingCabinet1 = vtkStructuredGridGeometryFilter()\n    FilingCabinet1.SetInputData(reader.GetStructuredGridOutput())\n    FilingCabinet1.SetExtent(15, 15, 7, 9, 0, 8)\n    mapFilingCabinet1 = vtkPolyDataMapper()\n    mapFilingCabinet1.SetInputConnection(FilingCabinet1.GetOutputPort())\n    mapFilingCabinet1.ScalarVisibilityOff()\n    FilingCabinet1Actor = vtkActor()\n    FilingCabinet1Actor.SetMapper(mapFilingCabinet1)\n    FilingCabinet1Actor.GetProperty().SetColor(colors.GetColor3d('FilingCabinet'))\n\n    FilingCabinet2 = vtkStructuredGridGeometryFilter()\n    FilingCabinet2.SetInputData(reader.GetStructuredGridOutput())\n    FilingCabinet2.SetExtent(15, 15, 10, 12, 0, 8)\n    mapFilingCabinet2 = vtkPolyDataMapper()\n    mapFilingCabinet2.SetInputConnection(FilingCabinet2.GetOutputPort())\n    mapFilingCabinet2.ScalarVisibilityOff()\n    FilingCabinet2Actor = vtkActor()\n    FilingCabinet2Actor.SetMapper(mapFilingCabinet2)\n    FilingCabinet2Actor.GetProperty().SetColor(colors.GetColor3d('FilingCabinet'))\n\n    bookshelf1Top = vtkStructuredGridGeometryFilter()\n    bookshelf1Top.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Top.SetExtent(13, 13, 0, 4, 0, 11)\n    mapBookshelf1Top = vtkPolyDataMapper()\n    mapBookshelf1Top.SetInputConnection(bookshelf1Top.GetOutputPort())\n    mapBookshelf1Top.ScalarVisibilityOff()\n    bookshelf1TopActor = vtkActor()\n    bookshelf1TopActor.SetMapper(mapBookshelf1Top)\n    bookshelf1TopActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Bottom = vtkStructuredGridGeometryFilter()\n    bookshelf1Bottom.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Bottom.SetExtent(20, 20, 0, 4, 0, 11)\n    mapBookshelf1Bottom = vtkPolyDataMapper()\n    mapBookshelf1Bottom.SetInputConnection(bookshelf1Bottom.GetOutputPort())\n    mapBookshelf1Bottom.ScalarVisibilityOff()\n    bookshelf1BottomActor = vtkActor()\n    bookshelf1BottomActor.SetMapper(mapBookshelf1Bottom)\n    bookshelf1BottomActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Front = vtkStructuredGridGeometryFilter()\n    bookshelf1Front.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Front.SetExtent(13, 20, 0, 0, 0, 11)\n    mapBookshelf1Front = vtkPolyDataMapper()\n    mapBookshelf1Front.SetInputConnection(bookshelf1Front.GetOutputPort())\n    mapBookshelf1Front.ScalarVisibilityOff()\n    bookshelf1FrontActor = vtkActor()\n    bookshelf1FrontActor.SetMapper(mapBookshelf1Front)\n    bookshelf1FrontActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1Back = vtkStructuredGridGeometryFilter()\n    bookshelf1Back.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1Back.SetExtent(13, 20, 4, 4, 0, 11)\n    mapBookshelf1Back = vtkPolyDataMapper()\n    mapBookshelf1Back.SetInputConnection(bookshelf1Back.GetOutputPort())\n    mapBookshelf1Back.ScalarVisibilityOff()\n    bookshelf1BackActor = vtkActor()\n    bookshelf1BackActor.SetMapper(mapBookshelf1Back)\n    bookshelf1BackActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1LHS = vtkStructuredGridGeometryFilter()\n    bookshelf1LHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1LHS.SetExtent(13, 20, 0, 4, 0, 0)\n    mapBookshelf1LHS = vtkPolyDataMapper()\n    mapBookshelf1LHS.SetInputConnection(bookshelf1LHS.GetOutputPort())\n    mapBookshelf1LHS.ScalarVisibilityOff()\n    bookshelf1LHSActor = vtkActor()\n    bookshelf1LHSActor.SetMapper(mapBookshelf1LHS)\n    bookshelf1LHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf1RHS = vtkStructuredGridGeometryFilter()\n    bookshelf1RHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf1RHS.SetExtent(13, 20, 0, 4, 11, 11)\n    mapBookshelf1RHS = vtkPolyDataMapper()\n    mapBookshelf1RHS.SetInputConnection(bookshelf1RHS.GetOutputPort())\n    mapBookshelf1RHS.ScalarVisibilityOff()\n    bookshelf1RHSActor = vtkActor()\n    bookshelf1RHSActor.SetMapper(mapBookshelf1RHS)\n    bookshelf1RHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Top = vtkStructuredGridGeometryFilter()\n    bookshelf2Top.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Top.SetExtent(13, 13, 15, 19, 0, 11)\n    mapBookshelf2Top = vtkPolyDataMapper()\n    mapBookshelf2Top.SetInputConnection(bookshelf2Top.GetOutputPort())\n    mapBookshelf2Top.ScalarVisibilityOff()\n    bookshelf2TopActor = vtkActor()\n    bookshelf2TopActor.SetMapper(mapBookshelf2Top)\n    bookshelf2TopActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Bottom = vtkStructuredGridGeometryFilter()\n    bookshelf2Bottom.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Bottom.SetExtent(20, 20, 15, 19, 0, 11)\n    mapBookshelf2Bottom = vtkPolyDataMapper()\n    mapBookshelf2Bottom.SetInputConnection(bookshelf2Bottom.GetOutputPort())\n    mapBookshelf2Bottom.ScalarVisibilityOff()\n    bookshelf2BottomActor = vtkActor()\n    bookshelf2BottomActor.SetMapper(mapBookshelf2Bottom)\n    bookshelf2BottomActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Front = vtkStructuredGridGeometryFilter()\n    bookshelf2Front.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Front.SetExtent(13, 20, 15, 15, 0, 11)\n    mapBookshelf2Front = vtkPolyDataMapper()\n    mapBookshelf2Front.SetInputConnection(bookshelf2Front.GetOutputPort())\n    mapBookshelf2Front.ScalarVisibilityOff()\n    bookshelf2FrontActor = vtkActor()\n    bookshelf2FrontActor.SetMapper(mapBookshelf2Front)\n    bookshelf2FrontActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2Back = vtkStructuredGridGeometryFilter()\n    bookshelf2Back.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2Back.SetExtent(13, 20, 19, 19, 0, 11)\n    mapBookshelf2Back = vtkPolyDataMapper()\n    mapBookshelf2Back.SetInputConnection(bookshelf2Back.GetOutputPort())\n    mapBookshelf2Back.ScalarVisibilityOff()\n    bookshelf2BackActor = vtkActor()\n    bookshelf2BackActor.SetMapper(mapBookshelf2Back)\n    bookshelf2BackActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2LHS = vtkStructuredGridGeometryFilter()\n    bookshelf2LHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2LHS.SetExtent(13, 20, 15, 19, 0, 0)\n    mapBookshelf2LHS = vtkPolyDataMapper()\n    mapBookshelf2LHS.SetInputConnection(bookshelf2LHS.GetOutputPort())\n    mapBookshelf2LHS.ScalarVisibilityOff()\n    bookshelf2LHSActor = vtkActor()\n    bookshelf2LHSActor.SetMapper(mapBookshelf2LHS)\n    bookshelf2LHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    bookshelf2RHS = vtkStructuredGridGeometryFilter()\n    bookshelf2RHS.SetInputData(reader.GetStructuredGridOutput())\n    bookshelf2RHS.SetExtent(13, 20, 15, 19, 11, 11)\n    mapBookshelf2RHS = vtkPolyDataMapper()\n    mapBookshelf2RHS.SetInputConnection(bookshelf2RHS.GetOutputPort())\n    mapBookshelf2RHS.ScalarVisibilityOff()\n    bookshelf2RHSActor = vtkActor()\n    bookshelf2RHSActor.SetMapper(mapBookshelf2RHS)\n    bookshelf2RHSActor.GetProperty().SetColor(colors.GetColor3d('BookShelf'))\n\n    window = vtkStructuredGridGeometryFilter()\n    window.SetInputData(reader.GetStructuredGridOutput())\n    window.SetExtent(20, 20, 6, 13, 10, 13)\n    mapWindow = vtkPolyDataMapper()\n    mapWindow.SetInputConnection(window.GetOutputPort())\n    mapWindow.ScalarVisibilityOff()\n    windowActor = vtkActor()\n    windowActor.SetMapper(mapWindow)\n    windowActor.GetProperty().SetColor(colors.GetColor3d('WindowColor'))\n\n    outlet = vtkStructuredGridGeometryFilter()\n    outlet.SetInputData(reader.GetStructuredGridOutput())\n    outlet.SetExtent(0, 0, 9, 10, 14, 16)\n    mapOutlet = vtkPolyDataMapper()\n    mapOutlet.SetInputConnection(outlet.GetOutputPort())\n    mapOutlet.ScalarVisibilityOff()\n    outletActor = vtkActor()\n    outletActor.SetMapper(mapOutlet)\n    outletActor.GetProperty().SetColor(colors.GetColor3d('lamp_black'))\n\n    inlet = vtkStructuredGridGeometryFilter()\n    inlet.SetInputData(reader.GetStructuredGridOutput())\n    inlet.SetExtent(0, 0, 9, 10, 0, 6)\n    mapInlet = vtkPolyDataMapper()\n    mapInlet.SetInputConnection(inlet.GetOutputPort())\n    mapInlet.ScalarVisibilityOff()\n    inletActor = vtkActor()\n    inletActor.SetMapper(mapInlet)\n    inletActor.GetProperty().SetColor(colors.GetColor3d('lamp_black'))\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(reader.GetStructuredGridOutput())\n    mapOutline = vtkPolyDataMapper()\n    mapOutline.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(mapOutline)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create the rendering window, renderer, and interactive renderer.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the remaining actors to the renderer, set the background and size.\n    ren.AddActor(table1Actor)\n    ren.AddActor(table2Actor)\n    ren.AddActor(FilingCabinet1Actor)\n    ren.AddActor(FilingCabinet2Actor)\n    ren.AddActor(bookshelf1TopActor)\n    ren.AddActor(bookshelf1BottomActor)\n    ren.AddActor(bookshelf1FrontActor)\n    ren.AddActor(bookshelf1BackActor)\n    ren.AddActor(bookshelf1LHSActor)\n    ren.AddActor(bookshelf1RHSActor)\n    ren.AddActor(bookshelf2TopActor)\n    ren.AddActor(bookshelf2BottomActor)\n    ren.AddActor(bookshelf2FrontActor)\n    ren.AddActor(bookshelf2BackActor)\n    ren.AddActor(bookshelf2LHSActor)\n    ren.AddActor(bookshelf2RHSActor)\n    ren.AddActor(windowActor)\n    ren.AddActor(outletActor)\n    ren.AddActor(inletActor)\n    ren.AddActor(outlineActor)\n    ren.AddActor(streamTubeActor)\n\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    aCamera = vtkCamera()\n    aCamera.SetClippingRange(0.726079, 36.3039)\n    aCamera.SetFocalPoint(2.43584, 2.15046, 1.11104)\n    aCamera.SetPosition(-4.76183, -10.4426, 3.17203)\n    aCamera.ComputeViewPlaneNormal()\n    aCamera.SetViewUp(0.0511273, 0.132773, 0.989827)\n    aCamera.SetViewAngle(18.604)\n    aCamera.Zoom(1.2)\n\n    ren.SetActiveCamera(aCamera)\n\n    renWin.SetSize(640, 400)\n    renWin.SetWindowName('OfficeTube')\n\n    iren.Initialize()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'The stream polygon. Sweeping a polygon to form a tube..'\n    epilogue = '''\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('fileName', help='office.binary.')\n    args = parser.parse_args()\n    return args.fileName\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/PineRootConnectivity/","title":"PineRootConnectivity","text":"

        vtk-examples/Python/VisualizationAlgorithms/PineRootConnectivity

        "},{"location":"Python/VisualizationAlgorithms/PineRootConnectivity/#description","title":"Description","text":"

        Demonstrates how to apply the connectivity filter to remove noisy isosurfaces.

        To illustrate the application of connectivity analysis, we will use an MRI dataset generated by Janet MacFall at the Center for In Vivo Microscopy at Duke University. The dataset is a volume of dimensions 256^3. The data is of the root system of a small pine tree. Using the class vtkSliceCubes , an implementation of marching cubes for large volumes, we generate an initial isosurface represented by 351,536 triangles. This is a faster way of manipulating this data. If you have a large enough computer you can process the volume directly with a vtk image reader and vtkMarchingCubes. The example on this other page shows the initial dataset. Notice that there are many small, disconnected isosurfaces due to noise and isolated moisture in the data. We use vtkConnectivityFilter to remove these small, disconnected surfaces. The example on this page shows the result of applying the filter. Over 50,000 triangles were removed, leaving 299,380 triangles. The vtkConnectivityFilter is a general filter taking datasets as input, and generating an unstructured grid as output. It functions by extracting cells that are connected at points (i.e., share common points). In this example the single largest surface is extracted. It is also possible to specify cell ids and point ids and extract surfaces connected to these.

        Info

        To count the number of triangles in the polydata we do the following:

        Cite

        Comparative Water Uptake by Roots of Different Ages in Seedlings of Loblolly Pine (Pinus taeda L.) December 1991. New Phytologist 119(4):551 - 560.

        Info

        See Figure 9-51 in Chapter 9 in the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/PineRootConnectivity/#c","title":"C++","text":"

        We use a lambda function c++ auto NumberofTriangles = [](auto *pd)

        "},{"location":"Python/VisualizationAlgorithms/PineRootConnectivity/#python","title":"Python","text":"

        We just implement: python def NumberOfTriangles(pd): within the scope of the calling function.

        "},{"location":"Python/VisualizationAlgorithms/PineRootConnectivity/#code","title":"Code","text":"

        PineRootConnectivity.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdList\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataConnectivityFilter\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOGeometry import vtkMCubesReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef pine_root_connectivity(fileName, noConnectivity):\n    def NumberOfTriangles(pd):\n        \"\"\"\n        Count the number of triangles.\n        :param pd: vtkPolyData.\n        :return: The number of triangles.\n        \"\"\"\n        cells = pd.GetPolys()\n        numOfTriangles = 0\n        idList = vtkIdList()\n        for i in range(0, cells.GetNumberOfCells()):\n            cells.GetNextCell(idList)\n            # If a cell has three points it is a triangle.\n            if idList.GetNumberOfIds() == 3:\n                numOfTriangles += 1\n        return numOfTriangles\n\n    colors = vtkNamedColors()\n\n    # Create the pipeline.\n    reader = vtkMCubesReader()\n    reader.SetFileName(fileName)\n    if not noConnectivity:\n        reader.Update()\n        print('Before Connectivity.')\n        print('There are: ', NumberOfTriangles(reader.GetOutput()), 'triangles')\n\n    connect = vtkPolyDataConnectivityFilter()\n    connect.SetInputConnection(reader.GetOutputPort())\n    connect.SetExtractionModeToLargestRegion()\n    if not noConnectivity:\n        connect.Update()\n        print('After Connectivity.')\n        print('There are: ', NumberOfTriangles(connect.GetOutput()), 'triangles')\n\n    isoMapper = vtkPolyDataMapper()\n    if noConnectivity:\n        isoMapper.SetInputConnection(reader.GetOutputPort())\n    else:\n        isoMapper.SetInputConnection(connect.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d('raw_sienna'))\n\n    #  Get an outline of the data set for context.\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create the Renderer, RenderWindow and RenderWindowInteractor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(outlineActor)\n    ren.AddActor(isoActor)\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('PineRootConnectivity')\n\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # render the image\n    #\n    # iren AddObserver UserEvent {wm deiconify .vtkInteract}\n    cam = ren.GetActiveCamera()\n    cam.SetFocalPoint(40.6018, 37.2813, 50.1953)\n    cam.SetPosition(40.6018, -280.533, 47.0172)\n    cam.ComputeViewPlaneNormal()\n    cam.SetClippingRange(26.1073, 1305.36)\n    cam.SetViewAngle(20.9219)\n    cam.SetViewUp(0.0, 0.0, 1.0)\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef main():\n    fileName, noConnectivity = get_program_parameters()\n    noConnectivity = noConnectivity != 0\n    pine_root_connectivity(fileName, noConnectivity)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Applying connectivity filter to remove noisy isosurfaces.'\n    epilogue = '''\n        Applying connectivity filter to remove noisy isosurfaces.\n\nThis example demonstrates how to use the vtkConnectivityFilter.\nIf the extra parameter 'noConnectivity' is non zero, the connectivity filter will not be used.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='pine_root.tri.')\n    parser.add_argument('noConnectivity', default=0, type=int, nargs='?',\n                        help='If non-zero do not use the connectivity filter.')\n    args = parser.parse_args()\n    return args.filename, args.noConnectivity\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/PineRootConnectivityA/","title":"PineRootConnectivityA","text":"

        vtk-examples/Python/VisualizationAlgorithms/PineRootConnectivityA

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/PineRootConnectivityA/#code","title":"Code","text":"

        PineRootConnectivityA.py

        #!/usr/bin/env python\n\n\"\"\"\nPineRootConnectivityA\n\nNote: Make sure PineRootConnectivity.py is in the same directory as this program.\n\"\"\"\n\nimport PineRootConnectivity\n\n\ndef main():\n    fileName, noConnectivity = PineRootConnectivity.get_program_parameters()\n    noConnectivity = 1\n    PineRootConnectivity.pine_root_connectivity(fileName, noConnectivity)\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/PineRootDecimation/","title":"PineRootDecimation","text":"

        vtk-examples/Python/VisualizationAlgorithms/PineRootDecimation

        "},{"location":"Python/VisualizationAlgorithms/PineRootDecimation/#description","title":"Description","text":"

        Demonstrates how to apply the decimation filter to get a reduced data size and then the connectivity filter to remove noisy isosurfaces. The data is from the root system of a pine tree.

        To count the number of triangles in the polydata we do the following:

        "},{"location":"Python/VisualizationAlgorithms/PineRootDecimation/#c","title":"C++","text":"

        We use a lambda function

        auto NumberofTriangles = [](auto *pd)\n
        "},{"location":"Python/VisualizationAlgorithms/PineRootDecimation/#python","title":"Python","text":"

        We just implement:

        def NumberOfTriangles(pd):\n

        within the scope of the calling function.

        Info

        See Figure 9-52 in Chapter 9 in the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/PineRootDecimation/#code","title":"Code","text":"

        PineRootDecimation.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkIdList\nfrom vtkmodules.vtkFiltersCore import (\n    vtkConnectivityFilter,\n    vtkDecimatePro\n)\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOGeometry import vtkMCubesReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    def NumberOfTriangles(pd):\n        \"\"\"\n        Count the number of triangles.\n        :param pd: vtkPolyData.\n        :return: The number of triangles.\n        \"\"\"\n        cells = pd.GetPolys()\n        numOfTriangles = 0\n        idList = vtkIdList()\n        for i in range(0, cells.GetNumberOfCells()):\n            cells.GetNextCell(idList)\n            # If a cell has three points it is a triangle.\n            if idList.GetNumberOfIds() == 3:\n                numOfTriangles += 1\n        return numOfTriangles\n\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Create the pipeline.\n    reader = vtkMCubesReader()\n    reader.SetFileName(fileName)\n    reader.FlipNormalsOff()\n    reader.Update()\n    print('Before Decimation.')\n    print('There are: ', NumberOfTriangles(reader.GetOutput()), 'triangles')\n\n    deci = vtkDecimatePro()\n    deci.SetInputConnection(reader.GetOutputPort())\n    deci.SetTargetReduction(0.9)\n    deci.SetAbsoluteError(0.0005)\n    deci.MaximumIterations = 6\n    deci.SetFeatureAngle(30)\n    deci.SetErrorIsAbsolute(1)\n    deci.AccumulateErrorOn()\n    # deci.SplittingOff()\n    deci.Update()\n    print('After Decimation.')\n    print('There are: ', NumberOfTriangles(deci.GetOutput()), 'triangles')\n\n    connect = vtkConnectivityFilter()\n    connect.SetInputConnection(deci.GetOutputPort())\n    connect.SetExtractionModeToLargestRegion()\n    connect.Update()\n    print('After Connectivity.')\n    print('There are: ', NumberOfTriangles(connect.GetOutput()), 'triangles')\n\n    isoMapper = vtkDataSetMapper()\n    isoMapper.SetInputConnection(connect.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetColor(colors.GetColor3d('raw_sienna'))\n\n    #  Get an outline of the data set for context.\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(reader.GetOutputPort())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    #  Create the Renderer, RenderWindow and RenderWindowInteractor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(outlineActor)\n    ren.AddActor(isoActor)\n    ren.SetBackground(1, 1, 1)\n    # renWin.SetSize(750, 750)\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('PineRootDecimation')\n\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # render the image\n\n    cam = ren.GetActiveCamera()\n    cam.SetFocalPoint(40.6018, 37.2813, 50.1953)\n    cam.SetPosition(40.6018, -280.533, 47.0172)\n    cam.ComputeViewPlaneNormal()\n    cam.SetClippingRange(26.1073, 1305.36)\n    cam.SetViewAngle(20.9219)\n    cam.SetViewUp(0.0, 0.0, 1.0)\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Applying connectivity and decimation filters to remove noisy isosurfaces and reduce data size.'\n    epilogue = '''\n        Applying connectivity and decimation filters to remove noisy isosurfaces and reduce data size..\n\nThis example demonstrates how to use the vtkConnectivityFilter and vtkDecimate.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='pine_root.tri.')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/PlateVibration/","title":"PlateVibration","text":"

        vtk-examples/Python/VisualizationAlgorithms/PlateVibration

        "},{"location":"Python/VisualizationAlgorithms/PlateVibration/#description","title":"Description","text":"

        The motion of a vibrating beam is shown. The original undeformed outline is shown as a wireframe.

        Info

        See Figure 6-14a in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/PlateVibration/#code","title":"Code","text":"

        PlateVibration.py

        # Translated from vib.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataNormals,\n    vtkVectorDot\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpVector\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    file_name = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Set the colors.\n    colors.SetColor('PlateColor', [255, 160, 140, 255])\n    colors.SetColor('BkgColor', [65, 99, 149, 255])\n\n    # Read a vtk file\n    #\n    plate = vtkPolyDataReader()\n    plate.SetFileName(file_name)\n    plate.Update()\n    bounds = [0] * 6\n    plate.GetOutput().GetBounds(bounds)\n    plate.SetVectorsName('mode2')\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(plate.GetOutputPort())\n    warp = vtkWarpVector()\n    warp.SetInputConnection(normals.GetOutputPort())\n    warp.SetScaleFactor(0.5)\n    color = vtkVectorDot()\n    color.SetInputConnection(warp.GetOutputPort())\n    plateMapper = vtkDataSetMapper()\n    plateMapper.SetInputConnection(warp.GetOutputPort())\n    plateActor = vtkActor()\n    plateActor.SetMapper(plateMapper)\n    plateActor.GetProperty().SetColor(\n        colors.GetColor3d('PlateColor'))\n    plateActor.RotateX(-90)\n\n    # Create the outline.\n    #\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(plate.GetOutputPort())\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(spikeMapper)\n    outlineActor.RotateX(-90)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('White'))\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren.AddActor(plateActor)\n    ren.AddActor(outlineActor)\n    renWin.SetSize(500, 500)\n    renWin.SetWindowName('PlateVibration')\n\n    # Render the image.\n    renWin.Render()\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n    # This closely matches the original illustration.\n    ren.GetActiveCamera().SetPosition(-3.7, 13, 15.5)\n    ren.ResetCameraClippingRange()\n\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produces figure 6-14(a) Beam displacement from the VTK Textbook.'\n    epilogue = '''\n        Produce figure 6\u201314(a) Beam displacement from the VTK Textbook..\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename', help='plate.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/ProbeCombustor/","title":"ProbeCombustor","text":"

        vtk-examples/Python/VisualizationAlgorithms/ProbeCombustor

        "},{"location":"Python/VisualizationAlgorithms/ProbeCombustor/#description","title":"Description","text":"

        Probing obtains dataset attributes by sampling one dataset (the input) with a set of points (the probe). Probing is also called \u201cresampling.\u201d Examples include probing an input dataset with a sequence of points along a line, on a plane, or in a volume. The result of the probing is a new dataset (the output) with the topological and geometric structure of the probe dataset, and point attributes interpolated from the input dataset. Once the probing operation is completed, the output dataset can be visualized with any of the appropriate techniques in VTK.

        This example illustrates the details of the probing process. For every point in the probe dataset, the location in the input dataset (i.e., cell, subcell, and parametric coordinates) and interpolation weights are determined. Then the data values from the cell are interpolated to the probe point. Probe points that are outside the input dataset are assigned a nil (or appropriate) value. This process repeats for all points in the probe dataset.

        Info

        See Figure 9-19 in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/ProbeCombustor/#code","title":"Code","text":"

        ProbeCombustor.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkContourFilter,\n    vtkProbeFilter,\n    vtkStructuredGridOutlineFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkPlaneSource\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName1, fileName2 = get_program_parameters()\n\n    # Create the pipeline.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(fileName1)\n    pl3d.SetQFileName(fileName2)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    sg = pl3d.GetOutput().GetBlock(0)\n\n    # We create three planes and position them in the correct position\n    # using transform filters. They are then appended together and used as\n    # a probe.\n    plane = vtkPlaneSource()\n    plane.SetResolution(50, 50)\n\n    transP1 = vtkTransform()\n    transP1.Translate(3.7, 0.0, 28.37)\n    transP1.Scale(5, 5, 5)\n    transP1.RotateY(90)\n\n    tpd1 = vtkTransformPolyDataFilter()\n    tpd1.SetInputConnection(plane.GetOutputPort())\n    tpd1.SetTransform(transP1)\n\n    outTpd1 = vtkOutlineFilter()\n    outTpd1.SetInputConnection(tpd1.GetOutputPort())\n\n    mapTpd1 = vtkPolyDataMapper()\n    mapTpd1.SetInputConnection(outTpd1.GetOutputPort())\n\n    tpd1Actor = vtkActor()\n    tpd1Actor.SetMapper(mapTpd1)\n    tpd1Actor.GetProperty().SetColor(0, 0, 0)\n    tpd1Actor.GetProperty().SetLineWidth(2.0)\n\n    transP2 = vtkTransform()\n    transP2.Translate(9.2, 0.0, 31.20)\n    transP2.Scale(5, 5, 5)\n    transP2.RotateY(90)\n\n    tpd2 = vtkTransformPolyDataFilter()\n    tpd2.SetInputConnection(plane.GetOutputPort())\n    tpd2.SetTransform(transP2)\n\n    outTpd2 = vtkOutlineFilter()\n    outTpd2.SetInputConnection(tpd2.GetOutputPort())\n\n    mapTpd2 = vtkPolyDataMapper()\n    mapTpd2.SetInputConnection(outTpd2.GetOutputPort())\n\n    tpd2Actor = vtkActor()\n    tpd2Actor.SetMapper(mapTpd2)\n    tpd2Actor.GetProperty().SetColor(0, 0, 0)\n    tpd2Actor.GetProperty().SetLineWidth(2.0)\n\n    transP3 = vtkTransform()\n    transP3.Translate(13.27, 0.0, 33.30)\n    transP3.Scale(5, 5, 5)\n    transP3.RotateY(90)\n\n    tpd3 = vtkTransformPolyDataFilter()\n    tpd3.SetInputConnection(plane.GetOutputPort())\n    tpd3.SetTransform(transP3)\n\n    outTpd3 = vtkOutlineFilter()\n    outTpd3.SetInputConnection(tpd3.GetOutputPort())\n\n    mapTpd3 = vtkPolyDataMapper()\n    mapTpd3.SetInputConnection(outTpd3.GetOutputPort())\n\n    tpd3Actor = vtkActor()\n    tpd3Actor.SetMapper(mapTpd3)\n    tpd3Actor.GetProperty().SetColor(0, 0, 0)\n    tpd3Actor.GetProperty().SetLineWidth(2.0)\n\n    appendF = vtkAppendPolyData()\n    appendF.AddInputConnection(tpd1.GetOutputPort())\n    appendF.AddInputConnection(tpd2.GetOutputPort())\n    appendF.AddInputConnection(tpd3.GetOutputPort())\n\n    # The vtkProbeFilter takes two inputs. One is a dataset to use as the probe\n    # geometry (SetInputConnection) the other is the data to probe\n    # (SetSourceConnection). The output dataset structure (geometry and\n    # topology) of the probe is the same as the structure of the input. The\n    # probing process generates new data values resampled from the source.\n    probe = vtkProbeFilter()\n    probe.SetInputConnection(appendF.GetOutputPort())\n    probe.SetSourceData(sg)\n\n    contour = vtkContourFilter()\n    contour.SetInputConnection(probe.GetOutputPort())\n    contour.GenerateValues(50, sg.GetScalarRange())\n\n    contourMapper = vtkPolyDataMapper()\n    contourMapper.SetInputConnection(contour.GetOutputPort())\n    contourMapper.SetScalarRange(sg.GetScalarRange())\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(contourMapper)\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(sg)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(0, 0, 0)\n    outlineActor.GetProperty().SetLineWidth(2.0)\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(planeActor)\n    ren1.AddActor(tpd1Actor)\n    ren1.AddActor(tpd2Actor)\n    ren1.AddActor(tpd3Actor)\n    ren1.SetBackground(colors.GetColor3d('Gainsboro'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('ProbeCombustor')\n\n    ren1.ResetCamera()\n    ren1.GetActiveCamera().SetClippingRange(3.95297, 50)\n    ren1.GetActiveCamera().SetFocalPoint(8.88908, 0.595038, 29.3342)\n    ren1.GetActiveCamera().SetPosition(-12.3332, 31.7479, 41.2387)\n    ren1.GetActiveCamera().SetViewUp(0.060772, -0.319905, 0.945498)\n\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This shows how to probe a dataset with a plane. The probed data is then contoured. '\n    epilogue = '''\n\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/SingleSplat/","title":"SingleSplat","text":"

        vtk-examples/Python/VisualizationAlgorithms/SingleSplat

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/SingleSplat/#code","title":"Code","text":"

        SingleSplat.py

        #!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkDoubleArray,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkImagingHybrid import vtkGaussianSplatter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    aren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(aren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create single splat point\n    pts = vtkPoints()\n    verts = vtkCellArray()\n    norms = vtkDoubleArray()\n    scalars = vtkDoubleArray()\n\n    x = [0.0] * 3\n    pts.InsertNextPoint(x)\n    norms.SetNumberOfTuples(1)\n    norms.SetNumberOfComponents(3)\n    n = [0] * 3\n    n[0] = 0.707\n    n[1] = 0.707\n    n[2] = 0.0\n    norms.InsertTuple(0, n)\n    scalars.SetNumberOfTuples(1)\n    scalars.SetNumberOfComponents(1)\n    scalars.InsertTuple1(0, 1.0)\n\n    verts.InsertNextCell(1)\n    verts.InsertCellPoint(0)\n\n    pData = vtkPolyData()\n    pData.SetPoints(pts)\n    pData.SetVerts(verts)\n    pData.GetPointData().SetNormals(norms)\n    pData.GetPointData().SetScalars(scalars)\n\n    # Splat point and generate isosurface.\n    splat = vtkGaussianSplatter()\n    splat.SetInputData(pData)\n    splat.SetModelBounds(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0)\n    splat.SetSampleDimensions(75, 75, 75)\n    splat.SetRadius(0.5)\n    splat.SetEccentricity(5.0)\n    splat.SetExponentFactor(-3.25)\n    contour = vtkContourFilter()\n    contour.SetInputConnection(splat.GetOutputPort())\n    contour.SetValue(0, 0.9)\n    splatMapper = vtkPolyDataMapper()\n    splatMapper.SetInputConnection(contour.GetOutputPort())\n    splatActor = vtkActor()\n    splatActor.SetMapper(splatMapper)\n\n    # Create outline.\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(splat.GetOutputPort())\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Brown'))\n\n    # Create cone to indicate direction.\n    cone = vtkConeSource()\n    cone.SetResolution(24)\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.SetScale(0.75, 0.75, 0.75)\n    coneActor.RotateZ(45.0)\n    coneActor.AddPosition(0.50, 0.50, 0.0)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('DeepPink'))\n    #\n    # Rendering stuff.\n    #\n    aren.SetBackground(colors.GetColor3d('Beige'))\n    aren.AddActor(splatActor)\n    aren.AddActor(outlineActor)\n    aren.AddActor(coneActor)\n\n    renWin.SetSize(640, 640)\n    renWin.SetWindowName('SingleSplat')\n    renWin.Render()\n\n    # Interact with the data.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/SpikeFran/","title":"SpikeFran","text":"

        vtk-examples/Python/VisualizationAlgorithms/SpikeFran

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/SpikeFran/#code","title":"Code","text":"

        SpikeFran.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import (\n    vtkGlyph3D,\n    vtkMaskPoints,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    fran = vtkPolyDataReader()\n    fran.SetFileName(fileName)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(fran.GetOutputPort())\n    normals.FlipNormalsOn()\n\n    franMapper = vtkPolyDataMapper()\n    franMapper.SetInputConnection(normals.GetOutputPort())\n\n    franActor = vtkActor()\n    franActor.SetMapper(franMapper)\n    franActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n\n    # We subsample the dataset because we want to glyph just a subset of\n    # the points. Otherwise the display is cluttered and cannot be easily\n    # read. The RandomModeOn and SetOnRatio combine to random select one out\n    # of every 10 points in the dataset.\n    #\n    ptMask = vtkMaskPoints()\n    ptMask.SetInputConnection(normals.GetOutputPort())\n    ptMask.SetOnRatio(10)\n    ptMask.RandomModeOn()\n\n    # In this case we are using a cone as a glyph. We transform the cone so\n    # its base is at 0,0,0. This is the point where glyph rotation occurs.\n    cone = vtkConeSource()\n    cone.SetResolution(6)\n\n    transform = vtkTransform()\n    transform.Translate(0.5, 0.0, 0.0)\n\n    transformF = vtkTransformPolyDataFilter()\n    transformF.SetInputConnection(cone.GetOutputPort())\n    transformF.SetTransform(transform)\n\n    # vtkGlyph3D takes two inputs: the input point set (SetInputConnection)\n    # which can be any vtkDataSet and the glyph (SetSourceConnection) which\n    # must be a vtkPolyData.  We are interested in orienting the glyphs by the\n    # surface normals that we previously generated.\n    glyph = vtkGlyph3D()\n    glyph.SetInputConnection(ptMask.GetOutputPort())\n    glyph.SetSourceConnection(transformF.GetOutputPort())\n    glyph.SetVectorModeToUseNormal()\n    glyph.SetScaleModeToScaleByVector()\n    glyph.SetScaleFactor(0.004)\n\n    spikeMapper = vtkPolyDataMapper()\n    spikeMapper.SetInputConnection(glyph.GetOutputPort())\n\n    spikeActor = vtkActor()\n    spikeActor.SetMapper(spikeMapper)\n    spikeActor.GetProperty().SetColor(colors.GetColor3d('Emerald_Green'))\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(franActor)\n    ren1.AddActor(spikeActor)\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('SpikeFran')\n\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Render the image.\n    #\n    renWin.Render()\n\n    ren1.GetActiveCamera().Zoom(1.4)\n    ren1.GetActiveCamera().Azimuth(110)\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'This example demonstrates the use of glyphing.'\n    epilogue = '''\n    We also use a mask filter to select a subset of points to glyph.\n\n    About the data file:\n      This originally was a Cyberware laser digitizer scan\n      of Fran J.'s face. Surface normals are generated based on local geometry\n      (i.e., the polygon normals surrounding each point are averaged). We flip\n      the normals because we want them to point out from Fran's face.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='fran_cut.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/SplatFace/","title":"SplatFace","text":"

        vtk-examples/Python/VisualizationAlgorithms/SplatFace

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/SplatFace/#code","title":"Code","text":"

        SplatFace.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkMaskPoints,\n    vtkPolyDataNormals\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkImagingHybrid import vtkGaussianSplatter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName = get_program_parameters()\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Read cyberware file.\n    #\n    cyber = vtkPolyDataReader()\n    cyber.SetFileName(fileName)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(cyber.GetOutputPort())\n\n    mask = vtkMaskPoints()\n    mask.SetInputConnection(normals.GetOutputPort())\n    mask.SetOnRatio(8)\n    # mask.RandomModeOn()\n\n    splatter = vtkGaussianSplatter()\n    splatter.SetInputConnection(mask.GetOutputPort())\n    splatter.SetSampleDimensions(100, 100, 100)\n    splatter.SetEccentricity(2.5)\n    splatter.NormalWarpingOn()\n    splatter.SetScaleFactor(1.0)\n    splatter.SetRadius(0.025)\n\n    contour = vtkContourFilter()\n    contour.SetInputConnection(splatter.GetOutputPort())\n    contour.SetValue(0, 0.25)\n\n    splatMapper = vtkPolyDataMapper()\n    splatMapper.SetInputConnection(contour.GetOutputPort())\n    splatMapper.ScalarVisibilityOff()\n\n    splatActor = vtkActor()\n    splatActor.SetMapper(splatMapper)\n    splatActor.GetProperty().SetColor(colors.GetColor3d('Flesh'))\n\n    cyberMapper = vtkPolyDataMapper()\n    cyberMapper.SetInputConnection(cyber.GetOutputPort())\n    cyberMapper.ScalarVisibilityOff()\n\n    cyberActor = vtkActor()\n    cyberActor.SetMapper(cyberMapper)\n    cyberActor.GetProperty().SetRepresentationToWireframe()\n    cyberActor.GetProperty().SetColor(colors.GetColor3d('Turquoise'))\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(cyberActor)\n    ren1.AddActor(splatActor)\n    ren1.SetBackground(colors.GetColor3d('Wheat'))\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('SplatFace')\n\n    camera = vtkCamera()\n    camera.SetClippingRange(0.0332682, 1.66341)\n    camera.SetFocalPoint(0.0511519, -0.127555, -0.0554379)\n    camera.SetPosition(0.516567, -0.124763, -0.349538)\n    camera.SetViewAngle(18.1279)\n    camera.SetViewUp(-0.013125, 0.99985, -0.0112779)\n    ren1.SetActiveCamera(camera)\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Elliptical splatting.'\n    epilogue = '''\n    b) Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction.\n       Points regularly subsampled and overlaid on original mesh.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='fran_cut.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/Stocks/","title":"Stocks","text":"

        vtk-examples/Python/VisualizationAlgorithms/Stocks

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/Stocks/#code","title":"Code","text":"

        Stocks.py

        #!/usr/bin/env python\n\n\nimport os\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersCore import vtkTubeFilter\nfrom vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter\nfrom vtkmodules.vtkFiltersModeling import (\n    vtkLinearExtrusionFilter,\n    vtkRibbonFilter\n)\nfrom vtkmodules.vtkIOLegacy import vtkPolyDataReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkFollower,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\nfrom vtkmodules.vtkRenderingFreeType import vtkVectorText\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileNames, useRibbons = get_program_parameters()\n    useTubes = not useRibbons\n\n    # Set up the stocks\n    renderers = list()\n    topRenderer = vtkRenderer()\n    bottomRenderer = vtkRenderer()\n    renderers.append(topRenderer)\n    renderers.append(bottomRenderer)\n\n    zPosition = 0.0\n    for fn in fileNames:\n        zPosition = AddStock(renderers, fn, os.path.basename((os.path.splitext(fn)[0])), zPosition, useTubes)\n\n    # Setup the render window and interactor.\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderers[0])\n    renderWindow.AddRenderer(renderers[1])\n\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderers[0].SetViewport(0.0, 0.4, 1.0, 1.0)\n    renderers[1].SetViewport(0.0, 0.0, 1.0, 0.4)\n\n    renderers[0].GetActiveCamera().SetViewAngle(5.0)\n    renderers[0].ResetCamera()\n    renderers[0].GetActiveCamera().Zoom(1.4)\n    renderers[0].ResetCameraClippingRange()\n    renderers[0].SetBackground(colors.GetColor3d(\"SteelBlue\"))\n\n    renderers[1].GetActiveCamera().SetViewUp(0, 0, -1)\n    renderers[1].GetActiveCamera().SetPosition(0, 1, 0)\n    renderers[1].GetActiveCamera().SetViewAngle(5.0)\n    renderers[1].ResetCamera()\n    renderers[1].GetActiveCamera().Zoom(2.2)\n    renderers[1].ResetCameraClippingRange()\n    renderers[1].SetBackground(colors.GetColor3d(\"LightSteelBlue\"))\n\n    renderWindow.SetSize(500, 800)\n    renderWindow.SetWindowName('Stocks')\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Two views from the stock visualization script.'\n    epilogue = '''\n    The top shows closing price over time; the bottom shows volume over time.  \n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filenames', nargs='+',\n                        help='List of one or more filenames corresponding to stocks. e.g. GE.vtk GM.vtk IBM.vtk DEC.vtk')\n    parser.add_argument('-r', dest='useRibbons', action='store_true', help='Use ribbons instead of tubes.')\n\n    args = parser.parse_args()\n    return args.filenames, args.useRibbons\n\n\ndef AddStock(renderers, filename, name, zPosition, useTubes):\n    print(\"Adding\", name)\n\n    # Read the data\n    PolyDataRead = vtkPolyDataReader()\n    PolyDataRead.SetFileName(filename)\n    PolyDataRead.Update()\n\n    # Create the labels.\n    TextSrc = vtkVectorText()\n    TextSrc.SetText(name)\n\n    numberOfPoints = PolyDataRead.GetOutput().GetNumberOfPoints()\n\n    nameIndex = int((numberOfPoints - 1) * 0.8)\n\n    nameLocation = PolyDataRead.GetOutput().GetPoint(nameIndex)\n\n    x = nameLocation[0] * 0.15\n    y = nameLocation[1] + 5.0\n    z = zPosition\n\n    # Create a tube and ribbpn filter. One or the other will be used\n    TubeFilter = vtkTubeFilter()\n    TubeFilter.SetInputConnection(PolyDataRead.GetOutputPort())\n    TubeFilter.SetNumberOfSides(8)\n    TubeFilter.SetRadius(0.5)\n    TubeFilter.SetRadiusFactor(10000)\n\n    RibbonFilter = vtkRibbonFilter()\n    RibbonFilter.SetInputConnection(PolyDataRead.GetOutputPort())\n    RibbonFilter.VaryWidthOn()\n    RibbonFilter.SetWidthFactor(5)\n    RibbonFilter.SetDefaultNormal(0, 1, 0)\n    RibbonFilter.UseDefaultNormalOn()\n\n    Extrude = vtkLinearExtrusionFilter()\n    Extrude.SetInputConnection(RibbonFilter.GetOutputPort())\n    Extrude.SetVector(0, 1, 0)\n    Extrude.SetExtrusionType(1)\n    Extrude.SetScaleFactor(0.7)\n\n    Transform = vtkTransform()\n    Transform.Translate(0, 0, zPosition)\n    Transform.Scale(0.15, 1, 1)\n\n    TransformFilter = vtkTransformPolyDataFilter()\n    TransformFilter.SetInputConnection(Extrude.GetOutputPort())\n    TransformFilter.SetTransform(Transform)\n\n    # Select tubes or ribbons\n    if useTubes:\n        TransformFilter.SetInputConnection(TubeFilter.GetOutputPort())\n    else:\n        TransformFilter.SetInputConnection(Extrude.GetOutputPort())\n\n    for r in range(0, len(renderers)):\n        LabelMapper = vtkPolyDataMapper()\n        LabelMapper.SetInputConnection(TextSrc.GetOutputPort())\n\n        LabelActor = vtkFollower()\n        LabelActor.SetMapper(LabelMapper)\n        LabelActor.SetPosition(x, y, z)\n        LabelActor.SetScale(2, 2, 2)\n        LabelActor.SetOrigin(TextSrc.GetOutput().GetCenter())\n\n        # Increment zPosition.\n        zPosition += 8.0\n\n        StockMapper = vtkPolyDataMapper()\n        StockMapper.SetInputConnection(TransformFilter.GetOutputPort())\n        StockMapper.SetScalarRange(0, 8000)\n        StockActor = vtkActor()\n        StockActor.SetMapper(StockMapper)\n\n        renderers[r].AddActor(StockActor)\n        renderers[r].AddActor(LabelActor)\n        LabelActor.SetCamera(renderers[r].GetActiveCamera())\n    return zPosition\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/StreamlinesWithLineWidget/","title":"StreamlinesWithLineWidget","text":"

        vtk-examples/Python/VisualizationAlgorithms/StreamlinesWithLineWidget

        "},{"location":"Python/VisualizationAlgorithms/StreamlinesWithLineWidget/#description","title":"Description","text":""},{"location":"Python/VisualizationAlgorithms/StreamlinesWithLineWidget/#produce-streamlines-in-the-combustor-dataset","title":"Produce streamlines in the combustor dataset.","text":"

        This example demonstrates how to use the vtkLineWidget to seed and manipulate streamlines. Two line widgets are created. The first is invoked by pressing 'i', the second by pressing 'L' (capital). Both can exist together.

        If the fourth parameter is non-zero, it is used to generate an image with streamlines:

        1. The third parameter value is changed to 25.
        2. The camera position and first line widget are positioned differently.
        3. The streamlines are displayed running from the first line widget.
        4. The second line widget is still available.

        In the C++ version, note how we handle callbacks by first implementing a class, then instantiating it and then passing references to the needed variables to it. Finally we add it as an observer.

        For the Python version we define a class passing the needed variables in the __init__ function and then implementing a _call__ function that does the work.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/StreamlinesWithLineWidget/#code","title":"Code","text":"

        StreamlinesWithLineWidget.py

        #!/usr/bin/env python\n\n\"\"\"\nModified from VTK/Examples/GUI/Python/StreamlinesWithLineWidget.py.\nThis program encompasses the functionality of\n  StreamlinesWithLineWidget.tcl and LineWidget.tcl.\n\"\"\"\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPolyData\nfrom vtkmodules.vtkCommonMath import vtkRungeKutta4\nfrom vtkmodules.vtkFiltersCore import vtkStructuredGridOutlineFilter\nfrom vtkmodules.vtkFiltersFlowPaths import vtkStreamTracer\nfrom vtkmodules.vtkFiltersModeling import vtkRibbonFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkInteractionWidgets import vtkLineWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName1, fileName2, numOfStreamLines, illustration = get_program_parameters()\n    if illustration:\n        numOfStreamLines = 25\n\n    # Start by loading some data.\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(fileName1)\n    pl3d.SetQFileName(fileName2)\n    pl3d.SetScalarFunctionNumber(100)  # Density\n    pl3d.SetVectorFunctionNumber(202)  # Momentum\n    pl3d.Update()\n\n    pl3d_output = pl3d.GetOutput().GetBlock(0)\n\n    # Create the Renderer, RenderWindow and RenderWindowInteractor.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Needed by: vtkStreamTracer and vtkLineWidget.\n    seeds = vtkPolyData()\n    streamline = vtkActor()\n    seeds2 = vtkPolyData()\n    streamline2 = vtkActor()\n\n    # The line widget is used seed the streamlines.\n    lineWidget = vtkLineWidget()\n    lineWidget.SetResolution(numOfStreamLines)\n    lineWidget.SetInputData(pl3d_output)\n    lineWidget.GetPolyData(seeds)\n    if illustration:\n        lineWidget.SetAlignToNone()\n        lineWidget.SetPoint1(0.974678, 5.073630, 31.217961)\n        lineWidget.SetPoint2(0.457544, -4.995921, 31.080175)\n    else:\n        lineWidget.SetAlignToYAxis()\n    lineWidget.ClampToBoundsOn()\n    lineWidget.PlaceWidget()\n    # Associate the line widget with the interactor and setup callbacks.\n    lineWidget.SetInteractor(iren)\n    lineWidget.AddObserver(\"StartInteractionEvent\", EnableActorCallback(streamline))\n    lineWidget.AddObserver(\"InteractionEvent\", GenerateStreamlinesCallback(seeds, renWin))\n\n    # The second line widget is used seed more streamlines.\n    lineWidget2 = vtkLineWidget()\n    lineWidget2.SetResolution(numOfStreamLines)\n    lineWidget2.SetInputData(pl3d_output)\n    lineWidget2.GetPolyData(seeds2)\n    lineWidget2.SetKeyPressActivationValue('L')\n    lineWidget2.SetAlignToZAxis()\n    lineWidget.ClampToBoundsOn()\n    lineWidget2.PlaceWidget()\n    # Associate the line widget with the interactor and setup callbacks.\n    lineWidget2.SetInteractor(iren)\n    lineWidget2.AddObserver(\"StartInteractionEvent\", EnableActorCallback(streamline2))\n    lineWidget2.AddObserver(\"InteractionEvent\", GenerateStreamlinesCallback(seeds2, renWin))\n\n    # Here we set up two streamlines.\n    rk4 = vtkRungeKutta4()\n    streamer = vtkStreamTracer()\n    streamer.SetInputData(pl3d_output)\n    streamer.SetSourceData(seeds)\n    streamer.SetMaximumPropagation(100)\n    streamer.SetInitialIntegrationStep(0.2)\n    streamer.SetIntegrationDirectionToForward()\n    streamer.SetComputeVorticity(1)\n    streamer.SetIntegrator(rk4)\n    rf = vtkRibbonFilter()\n    rf.SetInputConnection(streamer.GetOutputPort())\n    rf.SetWidth(0.1)\n    rf.SetWidthFactor(5)\n    streamMapper = vtkPolyDataMapper()\n    streamMapper.SetInputConnection(rf.GetOutputPort())\n    streamMapper.SetScalarRange(pl3d_output.GetScalarRange())\n    streamline.SetMapper(streamMapper)\n    streamline.VisibilityOff()\n\n    streamer2 = vtkStreamTracer()\n    streamer2.SetInputData(pl3d_output)\n    streamer2.SetSourceData(seeds2)\n    streamer2.SetMaximumPropagation(100)\n    streamer2.SetInitialIntegrationStep(0.2)\n    streamer2.SetIntegrationDirectionToForward()\n    streamer2.SetComputeVorticity(1)\n    streamer2.SetIntegrator(rk4)\n    rf2 = vtkRibbonFilter()\n    rf2.SetInputConnection(streamer2.GetOutputPort())\n    rf2.SetWidth(0.1)\n    rf2.SetWidthFactor(5)\n    streamMapper2 = vtkPolyDataMapper()\n    streamMapper2.SetInputConnection(rf2.GetOutputPort())\n    streamMapper2.SetScalarRange(pl3d_output.GetScalarRange())\n    streamline2.SetMapper(streamMapper2)\n    streamline2.VisibilityOff()\n\n    # Get an outline of the data set for context.\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3d_output)\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n    outlineActor = vtkActor()\n    outlineActor.GetProperty().SetColor(colors.GetColor3d(\"Black\"))\n    outlineActor.SetMapper(outlineMapper)\n\n    # Add the actors to the renderer, set the background and size.\n    ren.AddActor(outlineActor)\n    ren.AddActor(streamline)\n    ren.AddActor(streamline2)\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('StreamlinesWithLineWidget')\n\n    cam = ren.GetActiveCamera()\n    if illustration:\n        # We need to directly display the streamlines in this case.\n        lineWidget.EnabledOn()\n        streamline.VisibilityOn()\n        lineWidget.GetPolyData(seeds)\n        renWin.Render()\n\n        cam.SetClippingRange(14.216207, 68.382915)\n        cam.SetFocalPoint(9.718210, 0.458166, 29.399900)\n        cam.SetPosition(-15.827551, -16.997463, 54.003120)\n        cam.SetViewUp(0.616076, 0.179428, 0.766979)\n        ren.SetBackground(colors.GetColor3d(\"Silver\"))\n    else:\n        cam.SetClippingRange(3.95297, 50)\n        cam.SetFocalPoint(9.71821, 0.458166, 29.3999)\n        cam.SetPosition(2.7439, -37.3196, 38.7167)\n        cam.SetViewUp(-0.16123, 0.264271, 0.950876)\n        ren.SetBackground(colors.GetColor3d(\"Silver\"))\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce streamlines in the combustor dataset.'\n    epilogue = '''\n        Produce streamlines in the combustor dataset.\n\nThis example demonstrates how to use the vtkLineWidget to seed and\nmanipulate streamlines. Two line widgets are created. The first is invoked\nby pressing 'i', the second by pressing 'L' (capital). Both can exist\ntogether.\n\nIf the fourth parameter is non-zero, it is used to generate\n an image with streamlines:\n 1) The third parameter value is changed to 25.\n 2) The camera position and first line widget are positioned differently.\n 3) The streamlines are displayed running from the first line widget.\n 4) The second line widget is still available.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    parser.add_argument('numOfStreamLines', default=25, type=int, nargs='?', help='The number of stream lines.')\n    parser.add_argument('illustration', default=0, type=int, nargs='?',\n                        help='If non-zero, reproduce Fig 7-39 of the VTK Textbook.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2, args.numOfStreamLines, args.illustration\n\n\nclass EnableActorCallback(object):\n    def __init__(self, actor):\n        self.actor = actor\n\n    def __call__(self, caller, ev):\n        self.actor.VisibilityOn()\n\n\nclass GenerateStreamlinesCallback(object):\n    def __init__(self, polyData, renWin):\n        self.polyData = polyData\n        self.renWin = renWin\n\n    def __call__(self, caller, ev):\n        caller.GetPolyData(self.polyData)\n        self.renWin.Render()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/TensorAxes/","title":"TensorAxes","text":"

        vtk-examples/Python/VisualizationAlgorithms/TensorAxes

        "},{"location":"Python/VisualizationAlgorithms/TensorAxes/#description","title":"Description","text":"

        This example visualizes the analytical results of Boussinesq's problem from Saada. The figure shows the results by displaying the scaled and oriented principal axes of the stress tensor. (These are called tensor axes.)

        Info

        See Figure 6-22a in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/TensorAxes/#code","title":"Code","text":"

        TensorAxes.py

        #!/usr/bin/env python\n\n# Translated from TenAxes.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkTensorGlyph,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkAxes\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkImagingHybrid import vtkPointLoad\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and interactive renderer.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Generate the tensors.\n    ptLoad = vtkPointLoad()\n    ptLoad.SetLoadValue(100.0)\n    ptLoad.SetSampleDimensions(6, 6, 6)\n    ptLoad.ComputeEffectiveStressOn()\n    ptLoad.SetModelBounds(-10, 10, -10, 10, -10, 10)\n\n    # Extract a plane of data.\n    plane = vtkImageDataGeometryFilter()\n    plane.SetInputConnection(ptLoad.GetOutputPort())\n    plane.SetExtent(2, 2, 0, 99, 0, 99)\n\n    # Generate the tensor axes.\n    axes = vtkAxes()\n    axes.SetScaleFactor(0.5)\n\n    tubeAxes = vtkTubeFilter()\n    tubeAxes.SetInputConnection(axes.GetOutputPort())\n    tubeAxes.SetRadius(0.1)\n    tubeAxes.SetNumberOfSides(6)\n\n    tensorAxes = vtkTensorGlyph()\n    tensorAxes.SetInputConnection(ptLoad.GetOutputPort())\n    tensorAxes.SetSourceConnection(axes.GetOutputPort())\n    tensorAxes.SetScaleFactor(10)\n    tensorAxes.ClampScalingOn()\n\n    # Map contour\n    lut = vtkLookupTable()\n    MakeLogLUT(lut)\n    # lut.SetHueRange(.6667, 0.0)\n    tensorAxesMapper = vtkPolyDataMapper()\n    tensorAxesMapper.SetInputConnection(tensorAxes.GetOutputPort())\n    tensorAxesMapper.SetLookupTable(lut)\n    plane.Update()  # force update for scalar range\n    # This is deprecated from vtk 8.1 onwards.\n    # tensorAxesMapper.ImmediateModeRenderingOn()\n    tensorAxesMapper.SetScalarRange(plane.GetOutput().GetScalarRange())\n\n    tensorActor = vtkActor()\n    tensorActor.SetMapper(tensorAxesMapper)\n\n    # Create an outline around the data.\n    #\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(ptLoad.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    #\n    # Create a cone whose apex indicates the application of load.\n    #\n    coneSrc = vtkConeSource()\n    coneSrc.SetRadius(.5)\n    coneSrc.SetHeight(2)\n    coneMap = vtkPolyDataMapper()\n    coneMap.SetInputConnection(coneSrc.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMap)\n    coneActor.SetPosition(0, 0, 11)\n    coneActor.RotateY(90)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('BurlyWood'))\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(0.113766, -1.13665, -1.01919)\n    camera.SetPosition(-29.4886, -63.1488, 26.5807)\n    camera.SetViewAngle(24.4617)\n    camera.SetViewUp(0.17138, 0.331163, 0.927879)\n    camera.SetClippingRange(1, 100)\n\n    ren.AddActor(tensorActor)\n    ren.AddActor(outlineActor)\n    ren.AddActor(coneActor)\n    ren.SetBackground(colors.GetColor3d('WhiteSmoke'))\n    ren.SetActiveCamera(camera)\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('TensorAxes')\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef MakeLogLUT(lut):\n    # Original\n    lut.SetScaleToLog10()\n    lut.SetHueRange(.6667, 0.0)\n    lut.Build()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/TensorEllipsoids/","title":"TensorEllipsoids","text":"

        vtk-examples/Python/VisualizationAlgorithms/TensorEllipsoids

        "},{"location":"Python/VisualizationAlgorithms/TensorEllipsoids/#description","title":"Description","text":"

        This example visualizes the analytical results of Boussinesq's problem from Saada. The figure shows the results by displaying the scaled and oriented principal axes as tensor ellipsoids representing the stress tensor. (These are called tensor axes.)

        Info

        See Figure 6-22b in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/TensorEllipsoids/#code","title":"Code","text":"

        TensorEllipsoids.py

        #!/usr/bin/env python\n\n# Translated from TenEllip.tcl\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import (\n    vtkColorSeries,\n    vtkNamedColors\n)\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkFiltersCore import (\n    vtkPolyDataNormals,\n    vtkTensorGlyph\n)\nfrom vtkmodules.vtkFiltersGeometry import vtkImageDataGeometryFilter\nfrom vtkmodules.vtkFiltersModeling import vtkOutlineFilter\nfrom vtkmodules.vtkFiltersSources import (\n    vtkConeSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkImagingHybrid import vtkPointLoad\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkCamera,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create the RenderWindow, Renderer and interactive renderer.\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Generate the tensors.\n    ptLoad = vtkPointLoad()\n    ptLoad.SetLoadValue(100.0)\n    ptLoad.SetSampleDimensions(6, 6, 6)\n    ptLoad.ComputeEffectiveStressOn()\n    ptLoad.SetModelBounds(-10, 10, -10, 10, -10, 10)\n\n    # Extract a plane of data.\n    plane = vtkImageDataGeometryFilter()\n    plane.SetInputConnection(ptLoad.GetOutputPort())\n    plane.SetExtent(2, 2, 0, 99, 0, 99)\n\n    # Generate the ellipsoids.\n    sphere = vtkSphereSource()\n    sphere.SetThetaResolution(8)\n    sphere.SetPhiResolution(8)\n    tensorEllipsoids = vtkTensorGlyph()\n    tensorEllipsoids.SetInputConnection(ptLoad.GetOutputPort())\n    tensorEllipsoids.SetSourceConnection(sphere.GetOutputPort())\n    tensorEllipsoids.SetScaleFactor(10)\n    tensorEllipsoids.ClampScalingOn()\n\n    ellipNormals = vtkPolyDataNormals()\n    ellipNormals.SetInputConnection(tensorEllipsoids.GetOutputPort())\n\n    # Map contour\n    lut = vtkLookupTable()\n    MakeLogLUT(lut)\n    # lut.SetHueRange(.6667, 0.0)\n    tensorEllipsoidsMapper = vtkPolyDataMapper()\n    tensorEllipsoidsMapper.SetInputConnection(ellipNormals.GetOutputPort())\n    tensorEllipsoidsMapper.SetLookupTable(lut)\n    plane.Update()  # force update for scalar range\n    tensorEllipsoidsMapper.SetScalarRange(plane.GetOutput().GetScalarRange())\n\n    tensorActor = vtkActor()\n    tensorActor.SetMapper(tensorEllipsoidsMapper)\n\n    # Create an outline around the data.\n    #\n    outline = vtkOutlineFilter()\n    outline.SetInputConnection(ptLoad.GetOutputPort())\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create a cone whose apex indicates the application of load.\n    #\n    coneSrc = vtkConeSource()\n    coneSrc.SetRadius(.5)\n    coneSrc.SetHeight(2)\n    coneMap = vtkPolyDataMapper()\n    coneMap.SetInputConnection(coneSrc.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMap)\n    coneActor.SetPosition(0, 0, 11)\n    coneActor.RotateY(90)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('Red'))\n\n    camera = vtkCamera()\n    camera.SetFocalPoint(0.113766, -1.13665, -1.01919)\n    camera.SetPosition(-29.4886, -63.1488, 26.5807)\n    camera.SetViewAngle(24.4617)\n    camera.SetViewUp(0.17138, 0.331163, 0.927879)\n    camera.SetClippingRange(1, 100)\n\n    ren.AddActor(tensorActor)\n    ren.AddActor(outlineActor)\n    ren.AddActor(coneActor)\n    ren.SetBackground(colors.GetColor3d('WhiteSmoke'))\n    ren.SetActiveCamera(camera)\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('TensorEllipsoids')\n\n    iren.Initialize()\n    renWin.Render()\n    iren.Start()\n\n\ndef MakeLogLUT(lut):\n    # Make the lookup using a Brewer palette.\n    colorSeries = vtkColorSeries()\n    colorSeries.SetNumberOfColors(8)\n    colorSeriesEnum = colorSeries.BREWER_DIVERGING_SPECTRAL_8\n    colorSeries.SetColorScheme(colorSeriesEnum)\n    lut.SetScaleToLog10()\n    colorSeries.BuildLookupTable(lut, colorSeries.ORDINAL)\n    lut.SetNanColor(1, 0, 0, 1)\n    # Original\n    # lut.SetScaleToLog10()\n    # lut.SetHueRange(.6667, 0.0)\n    # lut.Build()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/VelocityProfile/","title":"VelocityProfile","text":"

        vtk-examples/Python/VisualizationAlgorithms/VelocityProfile

        "},{"location":"Python/VisualizationAlgorithms/VelocityProfile/#description","title":"Description","text":"

        This example shows shows warped planes in a structured grid dataset. The planes are warped according to flow momentum. The relative back and forward flow are clearly visible in the deformation of the planes.

        Info

        See Figure 6-14b in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/VelocityProfile/#code","title":"Code","text":"

        VelocityProfile.py

        #!/usr/bin/env python\n\n# Translated from velProf.tcl.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkPolyDataNormals,\n    vtkStructuredGridOutlineFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpVector\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    fileName1, fileName2 = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Set the background color.\n    colors.SetColor('BkgColor', [65, 99, 149, 255])\n\n    # Read a vtk file\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(fileName1)\n    pl3d.SetQFileName(fileName2)\n    pl3d.SetScalarFunctionNumber(100)  # Density\n    pl3d.SetVectorFunctionNumber(202)  # Momentum\n    pl3d.Update()\n\n    pl3dOutput = pl3d.GetOutput().GetBlock(0)\n\n    # What do we know about the data?\n    # Get the extent of the data: imin,imax, jmin,jmax, kmin,kmax\n    extent = pl3dOutput.GetExtent()\n    scalarRange = pl3dOutput.GetScalarRange()\n\n    # Planes are specified using a imin,imax, jmin,jmax, kmin,kmax coordinate\n    # specification. Min and max i,j,k values are clamped to 0 and maximum value.\n    # See the variable named extent for the values.\n    #\n    plane = vtkStructuredGridGeometryFilter()\n    plane.SetInputData(pl3dOutput)\n    plane.SetExtent(10, 10, 1, extent[3], 1, extent[5])\n\n    plane2 = vtkStructuredGridGeometryFilter()\n    plane2.SetInputData(pl3dOutput)\n    plane2.SetExtent(30, 30, 1, extent[3], 1, extent[5])\n\n    plane3 = vtkStructuredGridGeometryFilter()\n    plane3.SetInputData(pl3dOutput)\n    plane3.SetExtent(45, 45, 1, extent[3], 1, extent[5])\n\n    # We use an append filter because that way we can do the warping, etc. just\n    # using a single pipeline and actor.\n    #\n    appendF = vtkAppendPolyData()\n    appendF.AddInputConnection(plane.GetOutputPort())\n    appendF.AddInputConnection(plane2.GetOutputPort())\n    appendF.AddInputConnection(plane3.GetOutputPort())\n\n    # Warp\n    warp = vtkWarpVector()\n    warp.SetInputConnection(appendF.GetOutputPort())\n    warp.SetScaleFactor(0.005)\n    warp.Update()\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputData(warp.GetPolyDataOutput())\n    normals.SetFeatureAngle(45)\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputConnection(normals.GetOutputPort())\n    planeMapper.SetScalarRange(scalarRange)\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n\n    # The outline provides context for the data and the planes.\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3dOutput)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create the RenderWindow, Renderer and both Actors\n    #\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    #\n    ren.AddActor(planeActor)\n    ren.AddActor(outlineActor)\n    ren.SetBackground(colors.GetColor3d('BkgColor'))\n\n    renWin.SetSize(512, 512)\n    renWin.SetWindowName('VelocityProfile')\n\n    iren.Initialize()\n\n    renWin.Render()\n\n    ren.GetActiveCamera().SetPosition(19.8562, -31.8912, 47.0755)\n    ren.GetActiveCamera().SetFocalPoint(8.255, 0.147815, 29.7631)\n    ren.GetActiveCamera().SetViewUp(-0.0333325, 0.465756, 0.884285)\n    ren.GetActiveCamera().SetClippingRange(17.3078, 64.6375)\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Produce figure 6\u201314(b) Flow momentum from the VTK Textbook.'\n    epilogue = '''\n        Produce figure 6\u201314(b) Flow momentum from the VTK Textbook.\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VisualizationAlgorithms/WarpCombustor/","title":"WarpCombustor","text":"

        vtk-examples/Python/VisualizationAlgorithms/WarpCombustor

        "},{"location":"Python/VisualizationAlgorithms/WarpCombustor/#description","title":"Description","text":"

        This example demonstrates how to extract \"computational planes\" from a structured dataset. Structured data has a natural, logical coordinate system based on i-j-k indices. Specifying imin,imax, jmin,jmax, kmin,kmax pairs can indicate a point, line, plane, or volume of data.

        In this example, we extract three planes and warp them using scalar values in the direction of the local normal at each point. This gives a sort of \"velocity profile\" that indicates the nature of the flow.

        Info

        See Figure 9-4b in Chapter 9 The VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VisualizationAlgorithms/WarpCombustor/#code","title":"Code","text":"

        WarpCombustor.py

        #!/usr/bin/env python\n\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersCore import (\n    vtkAppendPolyData,\n    vtkPolyDataNormals,\n    vtkStructuredGridOutlineFilter\n)\nfrom vtkmodules.vtkFiltersGeneral import vtkWarpScalar\nfrom vtkmodules.vtkFiltersGeometry import vtkStructuredGridGeometryFilter\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    fileName1, fileName2 = get_program_parameters()\n\n    # Here we read data from a annular combustor. A combustor burns fuel and air\n    # in a gas turbine (e.g., a jet engine) and the hot gas eventually makes its\n    # way to the turbine section.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(fileName1)\n    pl3d.SetQFileName(fileName2)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    pl3dOutput = pl3d.GetOutput().GetBlock(0)\n\n    # Planes are specified using a imin,imax, jmin,jmax, kmin,kmax coordinate\n    # specification. Min and max i,j,k values are clamped to 0 and maximum value.\n    #\n    plane = vtkStructuredGridGeometryFilter()\n    plane.SetInputData(pl3dOutput)\n    plane.SetExtent(10, 10, 1, 100, 1, 100)\n\n    plane2 = vtkStructuredGridGeometryFilter()\n    plane2.SetInputData(pl3dOutput)\n    plane2.SetExtent(30, 30, 1, 100, 1, 100)\n    plane3 = vtkStructuredGridGeometryFilter()\n    plane3.SetInputData(pl3dOutput)\n    plane3.SetExtent(45, 45, 1, 100, 1, 100)\n\n    # We use an append filter because that way we can do the warping, etc. just\n    # using a single pipeline and actor.\n    #\n    appendF = vtkAppendPolyData()\n    appendF.AddInputConnection(plane.GetOutputPort())\n    appendF.AddInputConnection(plane2.GetOutputPort())\n    appendF.AddInputConnection(plane3.GetOutputPort())\n\n    warp = vtkWarpScalar()\n    warp.SetInputConnection(appendF.GetOutputPort())\n    warp.UseNormalOn()\n    warp.SetNormal(1.0, 0.0, 0.0)\n    warp.SetScaleFactor(2.5)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(warp.GetOutputPort())\n    normals.SetFeatureAngle(60)\n\n    planeMapper = vtkPolyDataMapper()\n    planeMapper.SetInputConnection(normals.GetOutputPort())\n    planeMapper.SetScalarRange(pl3dOutput.GetScalarRange())\n\n    planeActor = vtkActor()\n    planeActor.SetMapper(planeMapper)\n\n    # The outline provides context for the data and the planes.\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3dOutput)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outline.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Black'))\n\n    # Create the usual graphics stuff.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    ren1.AddActor(outlineActor)\n    ren1.AddActor(planeActor)\n    ren1.SetBackground(colors.GetColor3d('Silver'))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('WarpCombustor')\n\n    # Create an initial view.\n    ren1.GetActiveCamera().SetClippingRange(3.95297, 50)\n    ren1.GetActiveCamera().SetFocalPoint(8.88908, 0.595038, 29.3342)\n    ren1.GetActiveCamera().SetPosition(-12.3332, 31.7479, 41.2387)\n    ren1.GetActiveCamera().SetViewUp(0.060772, -0.319905, 0.945498)\n    iren.Initialize()\n\n    # Render the image.\n    #\n    renWin.Render()\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Extract \"computational planes\" from a structured dataset. '\n    epilogue = '''\n\n   '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VolumeRendering/PseudoVolumeRendering/","title":"PseudoVolumeRendering","text":"

        vtk-examples/Python/VolumeRendering/PseudoVolumeRendering

        "},{"location":"Python/VolumeRendering/PseudoVolumeRendering/#description","title":"Description","text":"

        This example uses 100 cut planes with opacity of 0.05. Rendered back-to-front to simulate volume rendering.

        Info

        See Figure 6-32 in Chapter 6 the VTK Textbook.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VolumeRendering/PseudoVolumeRendering/#code","title":"Code","text":"

        PseudoVolumeRendering.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import (\n    vtkContourFilter,\n    vtkCutter,\n    vtkPolyDataNormals,\n    vtkStripper,\n    vtkStructuredGridOutlineFilter,\n    vtkTubeFilter\n)\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractGrid\nfrom vtkmodules.vtkIOParallel import vtkMultiBlockPLOT3DReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    xyzFile, qFile = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # Create pipeline. Read structured grid data.\n    #\n    pl3d = vtkMultiBlockPLOT3DReader()\n    pl3d.SetXYZFileName(xyzFile)\n    pl3d.SetQFileName(qFile)\n    pl3d.SetScalarFunctionNumber(100)\n    pl3d.SetVectorFunctionNumber(202)\n    pl3d.Update()\n\n    pl3dOutput = pl3d.GetOutput().GetBlock(0)\n\n    # A convenience, use this filter to limit data for experimentation.\n    extract = vtkExtractGrid()\n    extract.SetVOI(1, 55, -1000, 1000, -1000, 1000)\n    extract.SetInputData(pl3dOutput)\n\n    # The (implicit) plane is used to do the cutting\n    plane = vtkPlane()\n    plane.SetOrigin(0, 4, 2)\n    plane.SetNormal(0, 1, 0)\n\n    # The cutter is set up to process each contour value over all cells\n    # (SetSortByToSortByCell). This results in an ordered output of polygons\n    # which is key to the compositing.\n    cutter = vtkCutter()\n    cutter.SetInputConnection(extract.GetOutputPort())\n    cutter.SetCutFunction(plane)\n    cutter.GenerateCutScalarsOff()\n    cutter.SetSortByToSortByCell()\n\n    clut = vtkLookupTable()\n    clut.SetHueRange(0, 0.67)\n    clut.Build()\n\n    cutterMapper = vtkPolyDataMapper()\n    cutterMapper.SetInputConnection(cutter.GetOutputPort())\n    cutterMapper.SetScalarRange(0.18, 0.7)\n    cutterMapper.SetLookupTable(clut)\n\n    cut = vtkActor()\n    cut.SetMapper(cutterMapper)\n\n    # Add in some surface geometry for interest.\n    iso = vtkContourFilter()\n    iso.SetInputData(pl3dOutput)\n    iso.SetValue(0, .22)\n\n    normals = vtkPolyDataNormals()\n    normals.SetInputConnection(iso.GetOutputPort())\n    normals.SetFeatureAngle(60)\n\n    isoMapper = vtkPolyDataMapper()\n    isoMapper.SetInputConnection(normals.GetOutputPort())\n    isoMapper.ScalarVisibilityOff()\n\n    isoActor = vtkActor()\n    isoActor.SetMapper(isoMapper)\n    isoActor.GetProperty().SetDiffuseColor(colors.GetColor3d('Tomato'))\n    isoActor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    isoActor.GetProperty().SetDiffuse(0.8)\n    isoActor.GetProperty().SetSpecular(0.5)\n    isoActor.GetProperty().SetSpecularPower(30)\n\n    outline = vtkStructuredGridOutlineFilter()\n    outline.SetInputData(pl3dOutput)\n\n    outlineStrip = vtkStripper()\n    outlineStrip.SetInputConnection(outline.GetOutputPort())\n\n    outlineTubes = vtkTubeFilter()\n    outlineTubes.SetInputConnection(outline.GetOutputPort())\n    outlineTubes.SetInputConnection(outlineStrip.GetOutputPort())\n    outlineTubes.SetRadius(0.1)\n\n    outlineMapper = vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(outlineTubes.GetOutputPort())\n\n    outlineActor = vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    # Create the RenderWindow, Renderer and Interactor.\n    #\n    ren1 = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n    iren = vtkRenderWindowInteractor()\n\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size.\n    #\n    ren1.AddActor(outlineActor)\n    outlineActor.GetProperty().SetColor(colors.GetColor3d('Banana'))\n    ren1.AddActor(isoActor)\n    isoActor.VisibilityOn()\n    ren1.AddActor(cut)\n\n    n = 20\n    opacity = 1.0 / float(n) * 5.0\n    cut.GetProperty().SetOpacity(1)\n    ren1.SetBackground(colors.GetColor3d('SlateGray'))\n\n    renWin.SetSize(640, 480)\n    renWin.SetWindowName('PseudoVolumeRendering')\n\n    ren1.GetActiveCamera().SetClippingRange(3.95297, 50)\n    ren1.GetActiveCamera().SetFocalPoint(9.71821, 0.458166, 29.3999)\n    ren1.GetActiveCamera().SetPosition(2.7439, -37.3196, 38.7167)\n    ren1.GetActiveCamera().ComputeViewPlaneNormal()\n    ren1.GetActiveCamera().SetViewUp(-0.16123, 0.264271, 0.950876)\n\n    # Cut: generates n cut planes normal to camera's view plane.\n    #\n    plane.SetNormal(ren1.GetActiveCamera().GetViewPlaneNormal())\n    plane.SetOrigin(ren1.GetActiveCamera().GetFocalPoint())\n    cutter.GenerateValues(n, -5, 5)\n    clut.SetAlphaRange(opacity, opacity)\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Perform psuedo volume rendering in a structured grid by compositing translucent cut planes.'\n    epilogue = '''\n    This same trick can be used for unstructured grids.\n    Note that for better results, more planes can be created.\n    Also, if your data is vtkImageData, there are much faster\n     methods for volume rendering.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename1', help='combxyz.bin.')\n    parser.add_argument('filename2', help='combq.bin.')\n    args = parser.parse_args()\n    return args.filename1, args.filename2\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/VolumeRendering/SimpleRayCast/","title":"SimpleRayCast","text":"

        vtk-examples/Python/VolumeRendering/SimpleRayCast

        "},{"location":"Python/VolumeRendering/SimpleRayCast/#description","title":"Description","text":"

        Volume rendering of a high potential iron protein.

        Info

        See Figure 7-34 in Chapter 7 the VTK Textbook.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/VolumeRendering/SimpleRayCast/#code","title":"Code","text":"

        SimpleRayCast.py

        #!/usr/bin/env python\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonDataModel import vtkPiecewiseFunction\nfrom vtkmodules.vtkIOLegacy import vtkStructuredPointsReader\nfrom vtkmodules.vtkRenderingCore import (\n    vtkColorTransferFunction,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkVolume,\n    vtkVolumeProperty\n)\nfrom vtkmodules.vtkRenderingVolume import vtkFixedPointVolumeRayCastMapper\n# noinspection PyUnresolvedReferences\nfrom vtkmodules.vtkRenderingVolumeOpenGL2 import vtkOpenGLRayCastImageDisplayHelper\n\n\ndef main():\n    fileName = get_program_parameters()\n\n    colors = vtkNamedColors()\n\n    # This is a simple volume rendering example that\n    # uses a vtkFixedPointVolumeRayCastMapper\n\n    # Create the standard renderer, render window\n    # and interactor.\n    ren1 = vtkRenderer()\n\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren1)\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Create the reader for the data.\n    reader = vtkStructuredPointsReader()\n    reader.SetFileName(fileName)\n\n    # Create transfer mapping scalar value to opacity.\n    opacityTransferFunction = vtkPiecewiseFunction()\n    opacityTransferFunction.AddPoint(20, 0.0)\n    opacityTransferFunction.AddPoint(255, 0.2)\n\n    # Create transfer mapping scalar value to color.\n    colorTransferFunction = vtkColorTransferFunction()\n    colorTransferFunction.AddRGBPoint(0.0, 0.0, 0.0, 0.0)\n    colorTransferFunction.AddRGBPoint(64.0, 1.0, 0.0, 0.0)\n    colorTransferFunction.AddRGBPoint(128.0, 0.0, 0.0, 1.0)\n    colorTransferFunction.AddRGBPoint(192.0, 0.0, 1.0, 0.0)\n    colorTransferFunction.AddRGBPoint(255.0, 0.0, 0.2, 0.0)\n\n    # The property describes how the data will look.\n    volumeProperty = vtkVolumeProperty()\n    volumeProperty.SetColor(colorTransferFunction)\n    volumeProperty.SetScalarOpacity(opacityTransferFunction)\n    volumeProperty.ShadeOn()\n    volumeProperty.SetInterpolationTypeToLinear()\n\n    # The mapper / ray cast function know how to render the data.\n    volumeMapper = vtkFixedPointVolumeRayCastMapper()\n    volumeMapper.SetInputConnection(reader.GetOutputPort())\n\n    # The volume holds the mapper and the property and\n    # can be used to position/orient the volume.\n    volume = vtkVolume()\n    volume.SetMapper(volumeMapper)\n    volume.SetProperty(volumeProperty)\n\n    ren1.AddVolume(volume)\n    ren1.SetBackground(colors.GetColor3d('Wheat'))\n    ren1.GetActiveCamera().Azimuth(45)\n    ren1.GetActiveCamera().Elevation(30)\n    ren1.ResetCameraClippingRange()\n    ren1.ResetCamera()\n\n    renWin.SetSize(600, 600)\n    renWin.SetWindowName('SimpleRayCast')\n    renWin.Render()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Volume rendering of a high potential iron protein.'\n    epilogue = '''\n    This is a simple volume rendering example that uses a vtkFixedPointVolumeRayCastMapper.\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='ironProt.vtk')\n    args = parser.parse_args()\n    return args.filename\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Widgets/BalloonWidget/","title":"BalloonWidget","text":"

        vtk-examples/Python/Widgets/BalloonWidget

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/BalloonWidget/#code","title":"Code","text":"

        BalloonWidget.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import (\n    vtkRegularPolygonSource,\n    vtkSphereSource\n)\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkBalloonRepresentation,\n    vtkBalloonWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Sphere.\n    sphere_source = vtkSphereSource()\n    sphere_source.SetCenter(-4.0, 0.0, 0.0)\n    sphere_source.SetRadius(4.0)\n\n    sphere_mapper = vtkPolyDataMapper()\n    sphere_mapper.SetInputConnection(sphere_source.GetOutputPort())\n\n    sphereActor = vtkActor()\n    sphereActor.SetMapper(sphere_mapper)\n    sphereActor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    # Regular Polygon.\n    regular_polygon_source = vtkRegularPolygonSource()\n    regular_polygon_source.SetCenter(4.0, 0.0, 0.0)\n    regular_polygon_source.SetRadius(4.0)\n\n    regular_polygon_mapper = vtkPolyDataMapper()\n    regular_polygon_mapper.SetInputConnection(regular_polygon_source.GetOutputPort())\n\n    regularPolygonActor = vtkActor()\n    regularPolygonActor.SetMapper(regular_polygon_mapper)\n    regularPolygonActor.GetProperty().SetColor(colors.GetColor3d('Cornsilk'))\n\n    # A renderer and render window.\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetWindowName('BalloonWidget')\n\n    # An interactor.\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # Create the widget.\n    balloonRep = vtkBalloonRepresentation()\n    balloonRep.SetBalloonLayoutToImageRight()\n\n    balloonWidget = vtkBalloonWidget()\n    balloonWidget.SetInteractor(iren)\n    balloonWidget.SetRepresentation(balloonRep)\n    balloonWidget.AddBalloon(sphereActor, 'This is a sphere')\n    balloonWidget.AddBalloon(regularPolygonActor, 'This is a regular polygon')\n\n    # Add the actors to the scene.\n    ren.AddActor(sphereActor)\n    ren.AddActor(regularPolygonActor)\n    ren.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # Render an image (lights and cameras are created automatically).\n    ren_win.Render()\n    balloonWidget.EnabledOn()\n\n    # Begin mouse interaction.\n    iren.Start()\n    iren.Initialize()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Widgets/BoxWidget/","title":"BoxWidget","text":"

        vtk-examples/Python/Widgets/BoxWidget

        "},{"location":"Python/Widgets/BoxWidget/#description","title":"Description","text":"

        This example uses a vtkBoxWidget to manipulate an actor. The class includes geometry to draw a box around the object, which is bound to it via SetProp3D. The box is dimensioned using the SetPlaceFactor method, and positioned with the PlaceWidget method. After the initial setup, synchronizing the box with the object is done through a custom callback class, which is passed to the box widget through the AddObserver method.

        For a widget that isn't tied to a specific vtkProp3D and has its geometric representation separate from the interaction logic, see the example BoxWidget2 - to be written.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/BoxWidget/#code","title":"Code","text":"

        BoxWidget.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonTransforms import vtkTransform\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkInteractionWidgets import vtkBoxWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\n# Call back function to resize the cone\n\n\ndef boxCallback(obj, event):\n    t = vtkTransform()\n    obj.GetTransform(t)\n    obj.GetProp3D().SetUserTransform(t)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # Create a Cone\n    cone = vtkConeSource()\n    cone.SetResolution(20)\n    coneMapper = vtkPolyDataMapper()\n    coneMapper.SetInputConnection(cone.GetOutputPort())\n    coneActor = vtkActor()\n    coneActor.SetMapper(coneMapper)\n    coneActor.GetProperty().SetColor(colors.GetColor3d('BurlyWood'))\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('Blue'))\n    renderer.AddActor(coneActor)\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName('BoxWidget')\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # A Box widget\n    boxWidget = vtkBoxWidget()\n    boxWidget.SetInteractor(interactor)\n    boxWidget.SetProp3D(coneActor)\n    boxWidget.SetPlaceFactor(1.25)  # Make the box 1.25x larger than the actor\n    boxWidget.PlaceWidget()\n    boxWidget.On()\n\n    # Connect the event to a function\n    boxWidget.AddObserver('InteractionEvent', boxCallback)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Widgets/CameraOrientationWidget/","title":"CameraOrientationWidget","text":"

        vtk-examples/Python/Widgets/CameraOrientationWidget

        "},{"location":"Python/Widgets/CameraOrientationWidget/#description","title":"Description","text":"

        This example demonstrates a 3D camera orientation gizmo.

        The widget representation has shafts and little spheres with text on them. The spheres always follow the camera.

        The widget representation's orientation is synchronized with the camera of the parent renderer.

        To look down on any particular axis, simply click on a handle.

        To rotate the camera and get a feel of the camera orientation, either move mouse in the renderer or click on a handle and move it around.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/CameraOrientationWidget/#code","title":"Code","text":"

        CameraOrientationWidget.py

        #!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# This example demonstrates how to use the vtkCameraOrientationWidget to control\n# a renderer's camera orientation.\n\nfrom pathlib import Path\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionWidgets import vtkCameraOrientationWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Demonstrates a 3D camera orientation widget.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('path', help='The path to the file to render e.g. cow.vtp.')\n    args = parser.parse_args()\n    return args.path\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    path = get_program_parameters()\n    if not Path(path).is_file():\n        print('Unable to find the file:', path)\n        return\n\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    interactor = vtkRenderWindowInteractor()\n\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(path)\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(reader.GetOutputPort())\n\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('Beige'))\n    actor.SetMapper(mapper)\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('DimGray'))\n\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(600, 600)\n    ren_win.SetWindowName('CameraOrientationWidget')\n\n    # Important: The interactor must be set prior to enabling the widget.\n    interactor.SetRenderWindow(ren_win)\n\n    cam_orient_manipulator = vtkCameraOrientationWidget()\n    cam_orient_manipulator.SetParentRenderer(renderer)\n    # Enable the widget.\n    cam_orient_manipulator.On()\n\n    ren_win.Render()\n    interactor.Initialize()\n    interactor.Start()\n\n\nif __name__ == \"__main__\":\n    main()\n
        "},{"location":"Python/Widgets/CompassWidget/","title":"CompassWidget","text":"

        vtk-examples/Python/Widgets/CompassWidget

        "},{"location":"Python/Widgets/CompassWidget/#description","title":"Description","text":"

        This example creates a compass widget in the top right corner of the window. The widget can be used to modify the camera position via its distance and tilt sliders and its heading compass wheel.

        Note for this example to work correctly VTK with version >= 9.2.20220831 is required.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/CompassWidget/#code","title":"Code","text":"

        CompassWidget.py

        #!/usr/bin/env python3\n\nimport math\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonCore import (\n    VTK_VERSION_NUMBER,\n    vtkCommand,\n    vtkMath,\n    vtkVersion\n)\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkRenderingAnnotation import vtkAnnotatedCubeActor\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\ntry:\n    from vtkmodules.vtkInteractionWidgets import (\n        vtkCompassRepresentation,\n        vtkCompassWidget\n    )\nexcept:\n    from vtkmodules.vtkGeovisCore import (\n        vtkCompassRepresentation,\n        vtkCompassWidget\n    )\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Major version.\n    :param minor: Minor version.\n    :param build: Build version.\n    :return: True if the requested VTK version is greater or equal to the actual VTK version.\n    \"\"\"\n    needed_version = 10000000000 * int(major) \\\n                     + 100000000 * int(minor) \\\n                     + int(build)\n    try:\n        vtk_version_number = VTK_VERSION_NUMBER\n    except AttributeError:\n        # Expand component-wise comparisons for VTK versions < 8.90.\n        ver = vtkVersion()\n        vtk_version_number = 10000000000 * ver.GetVTKMajorVersion() \\\n                             + 100000000 * ver.GetVTKMinorVersion() \\\n                             + ver.GetVTKBuildVersion()\n    if vtk_version_number >= needed_version:\n        return True\n    else:\n        return False\n\ndef CompassWidgetValueChangedCallback(widget, event):\n    \"\"\"\n    Callback to set the camera position according to the position parameters given by the vtkCompassWidget.\n    \"\"\"\n    try:\n        camera = widget.GetCurrentRenderer().GetActiveCamera()\n    except AttributeError:\n        return\n\n    # calculate new camera position from compass widget parameters\n    distance = widget.GetDistance()\n    tilt = widget.GetTilt()\n    heading = widget.GetHeading()\n\n    x = distance * math.cos(vtkMath.RadiansFromDegrees(heading)) * math.cos(vtkMath.RadiansFromDegrees(tilt))\n    y = distance * math.sin(vtkMath.RadiansFromDegrees(heading)) * math.cos(vtkMath.RadiansFromDegrees(tilt))\n    z = distance * math.sin(vtkMath.RadiansFromDegrees(tilt))\n\n    camera.SetPosition(x, y, z)\n    camera.SetFocalPoint(0, 0, 0)\n    camera.SetViewUp(0, 0, 1)\n    camera.SetClippingRange(0.1, distance + 1)\n\n    widget.GetCurrentRenderer().Render()\n\n\n\ndef main():\n    use_improved_compass_widget = vtk_version_ok(9, 2, 20220831)\n\n    colors = vtkNamedColors()\n\n    actor = vtkAnnotatedCubeActor()\n    actor.GetCubeProperty().SetColor(colors.GetColor3d('PeachPuff'))\n\n    # a renderer and render window\n    renderer = vtkRenderer()\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n\n    # an interactor\n    renderWindowInteractor = vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    # create the widget and its representation\n    compassRepresentation = vtkCompassRepresentation()\n\n    compassWidget = vtkCompassWidget()\n    compassWidget.SetInteractor(renderWindowInteractor)\n    compassWidget.SetRepresentation(compassRepresentation)\n\n    # add a callback to update the camera position on vtkCommand::WidgetValueChangedEvent\n    compassWidget.AddObserver(vtkCommand.WidgetValueChangedEvent, CompassWidgetValueChangedCallback)\n\n    if use_improved_compass_widget:\n        compassRepresentation.SetMinimumDistance(2)\n        compassRepresentation.SetMaximumDistance(10)\n        compassWidget.SetDistance(5)\n        compassWidget.SetTiltSpeed(45)\n        compassWidget.SetDistanceSpeed(2)\n\n    # add the actors to the scene\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    renderWindow.SetSize(640, 480)\n    renderWindow.SetWindowName('CompassWidget')\n\n    renderWindow.Render()\n    compassWidget.EnabledOn()\n\n    if use_improved_compass_widget:\n        # no interactor style - camera is moved by widget callback\n        renderWindowInteractor.SetInteractorStyle(None)\n        # set camera to initial position\n        compassWidget.InvokeEvent(vtkCommand.WidgetValueChangedEvent)\n\n    # begin interaction\n    renderWindowInteractor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Widgets/ContourWidget/","title":"ContourWidget","text":"

        vtk-examples/Python/Widgets/ContourWidget

        "},{"location":"Python/Widgets/ContourWidget/#description","title":"Description","text":"

        This example generates a set of points which lie on a circle, and the contour through these points. This contour can be interactively warped/modified by dragging the control points.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/ContourWidget/#code","title":"Code","text":"

        ContourWidget.py

        #!/usr/bin/python3\n\nimport math\nimport sys\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkPoints\n)\nfrom vtkmodules.vtkCommonDataModel import (\n    vtkCellArray,\n    vtkPolyData\n)\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkContourWidget,\n    vtkOrientedGlyphContourRepresentation,\n    vtkWidgetEvent\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])\n\n    # Create the RenderWindow, Renderer and both Actors\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    renderWindow = vtkRenderWindow()\n    renderWindow.AddRenderer(renderer)\n    renderWindow.SetWindowName('ContourWidget')\n    renderWindow.SetSize(600, 600)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renderWindow)\n\n    contourRep = vtkOrientedGlyphContourRepresentation()\n    contourRep.GetLinesProperty().SetColor(colors.GetColor3d('Red'))\n\n    contourWidget = vtkContourWidget()\n    contourWidget.SetInteractor(interactor)\n    contourWidget.SetRepresentation(contourRep)\n    contourWidget.On()\n\n    for arg in sys.argv:\n        if '-Shift' == arg:\n            contourWidget.GetEventTranslator().RemoveTranslation(\n                vtkCommand.LeftButtonPressEvent)\n            contourWidget.GetEventTranslator().SetTranslation(\n                vtkCommand.LeftButtonPressEvent,\n                vtkWidgetEvent.Translate)\n        elif '-Scale' == arg:\n            contourWidget.GetEventTranslator().RemoveTranslation(\n                vtkCommand.LeftButtonPressEvent)\n            contourWidget.GetEventTranslator().SetTranslation(\n                vtkCommand.LeftButtonPressEvent,\n                vtkWidgetEvent.Scale)\n\n    pd = vtkPolyData()\n\n    points = vtkPoints()\n\n    num_pts = 21\n    for i in range(0, num_pts):\n        angle = 2.0 * math.pi * i / 20.0\n        points.InsertPoint(i, 0.1 * math.cos(angle),\n                           0.1 * math.sin(angle), 0.0)\n        # lines.InsertNextCell(i)\n    vertex_indices = list(range(0, num_pts))\n    vertex_indices.append(0)\n    lines = vtkCellArray()\n    lines.InsertNextCell(num_pts + 1, vertex_indices)\n\n    pd.SetPoints(points)\n    pd.SetLines(lines)\n\n    # contourWidget.Initialize(pd, 1)\n    contourWidget.Initialize(pd, 1)\n    contourWidget.Render()\n    renderer.ResetCamera()\n    renderWindow.Render()\n\n    interactor.Initialize()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Widgets/EmbedInPyQt/","title":"EmbedInPyQt","text":"

        vtk-examples/Python/Widgets/EmbedInPyQt

        "},{"location":"Python/Widgets/EmbedInPyQt/#description","title":"Description","text":"

        '''Minimal working example of vtk embedding in PyQt.'''

        Contributed by Michka Popoff, inspired by the example from Eric E Monson See notes at the end for more details.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/EmbedInPyQt/#code","title":"Code","text":"

        EmbedInPyQt.py

        #!/usr/bin/env python3\n\nimport sys\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom PyQt4 import QtGui\nfrom qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderer\n)\n\n\nclass MainWindow(QtGui.QMainWindow):\n\n    def __init__(self, parent=None):\n        QtGui.QMainWindow.__init__(self, parent)\n\n        self.frame = QtGui.QFrame()\n\n        self.vl = QtGui.QVBoxLayout()\n        self.vtkWidget = QVTKRenderWindowInteractor(self.frame)\n        self.vl.addWidget(self.vtkWidget)\n\n        self.ren = vtkRenderer()\n        self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)\n        self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()\n\n        # Create source\n        source = vtkSphereSource()\n        source.SetCenter(0, 0, 0)\n        source.SetRadius(5.0)\n\n        # Create a mapper\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(source.GetOutputPort())\n\n        # Create an actor\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        self.ren.AddActor(actor)\n\n        self.ren.ResetCamera()\n\n        self.frame.setLayout(self.vl)\n        self.setCentralWidget(self.frame)\n\n        self.show()\n        self.iren.Initialize()\n\n\nif __name__ == \"__main__\":\n    app = QtGui.QApplication(sys.argv)\n\n    window = MainWindow()\n\n    sys.exit(app.exec_())\n
        "},{"location":"Python/Widgets/EmbedInPyQt2/","title":"EmbedInPyQt2","text":"

        vtk-examples/Python/Widgets/EmbedInPyQt2

        "},{"location":"Python/Widgets/EmbedInPyQt2/#description","title":"Description","text":"

        Another example on how to embed VTK in PyQT, with a QVTKRenderWindowInteractor

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/EmbedInPyQt2/#code","title":"Code","text":"

        EmbedInPyQt2.py

        #!/usr/bin/env python3\n# Contributed by Eric E Monson\n\nimport sys\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom PyQt4 import QtGui\nfrom PyQt4.QtGui import QApplication\nfrom qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderer\n)\n\n\nclass Ui_MainWindow(object):\n    def setupUi(self, MainWindow):\n        MainWindow.setObjectName(\"MainWindow\")\n        MainWindow.resize(603, 553)\n        self.centralWidget = QtGui.QWidget(MainWindow)\n        self.gridlayout = QtGui.QGridLayout(self.centralWidget)\n        self.vtkWidget = QVTKRenderWindowInteractor(self.centralWidget)\n        self.gridlayout.addWidget(self.vtkWidget, 0, 0, 1, 1)\n        MainWindow.setCentralWidget(self.centralWidget)\n\n\nclass SimpleView(QtGui.QMainWindow):\n\n    def __init__(self, parent=None):\n        QtGui.QMainWindow.__init__(self, parent)\n        self.ui = Ui_MainWindow()\n        self.ui.setupUi(self)\n        self.ren = vtkRenderer()\n        self.ui.vtkWidget.GetRenderWindow().AddRenderer(self.ren)\n        self.iren = self.ui.vtkWidget.GetRenderWindow().GetInteractor()\n\n        # Create source\n        source = vtkSphereSource()\n        source.SetCenter(0, 0, 0)\n        source.SetRadius(5.0)\n\n        # Create a mapper\n        mapper = vtkPolyDataMapper()\n        mapper.SetInputConnection(source.GetOutputPort())\n\n        # Create an actor\n        actor = vtkActor()\n        actor.SetMapper(mapper)\n\n        self.ren.AddActor(actor)\n\n\nif __name__ == \"__main__\":\n    app = QApplication(sys.argv)\n    window = SimpleView()\n    window.show()\n    window.iren.Initialize()  # Need this line to actually show the render inside Qt\n    sys.exit(app.exec_())\n
        "},{"location":"Python/Widgets/ImplicitPlaneWidget2/","title":"ImplicitPlaneWidget2","text":"

        vtk-examples/Python/Widgets/ImplicitPlaneWidget2

        "},{"location":"Python/Widgets/ImplicitPlaneWidget2/#description","title":"Description","text":"

        This example shows how to use the second generation ImplicitPlaneWidget2 to interactively define the clipping plane for a polydata. If no arguments are specified, a vtkSphereSource generates the polydata. By specifying a .vtp file, the example can operate on arbitrary polydata.

        For example, try VTKData/Data/cow.vtp.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/ImplicitPlaneWidget2/#code","title":"Code","text":"

        ImplicitPlaneWidget2.py

        #!/usr/bin/env python3\n\nfrom pathlib import Path\n\n# You may need to uncomment one or more of the following imports.\n# If vtkRenderWindow is used and you want to use OpenGL,\n#   you also need the vtkRenderingOpenGL2 module.\n# If vtkRenderWindowInteractor is used, uncomment vtkInteractionStyle\n# If text rendering is used, uncomment vtkRenderingFreeType.\n#\n# If using PyCharm, preface each one you select with this line:\n# noinspection PyUnresolvedReferences\n#\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\n# import vtkmodules.vtkRenderingContextOpenGL2\n# import vtkmodules.vtkRenderingFreeType\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingUI\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkCommand\nfrom vtkmodules.vtkCommonDataModel import vtkPlane\nfrom vtkmodules.vtkFiltersCore import (\n    vtkClipPolyData\n)\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkImplicitPlaneRepresentation,\n    vtkImplicitPlaneWidget2\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkProperty,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(fn):\n    colors = vtkNamedColors()\n    sphere_source = vtkSphereSource()\n    sphere_source.SetRadius(10.0)\n\n    fp = None\n    if fn:\n        fp = Path(fn)\n        if not (fp.is_file() and fp.suffix == '.vtp'):\n            print('Expected an existing file name with extension .vtp:')\n            print('Got', fp)\n            return\n\n    # Setup a visualization pipeline.\n    plane = vtkPlane()\n    clipper = vtkClipPolyData()\n    clipper.SetClipFunction(plane)\n    clipper.InsideOutOn()\n    if fn:\n        reader = vtkXMLPolyDataReader()\n        reader.SetFileName(fp)\n        clipper.SetInputConnection(reader.GetOutputPort())\n    else:\n        clipper.SetInputConnection(sphere_source.GetOutputPort())\n\n    # Create a mapper and actor.\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(clipper.GetOutputPort())\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    back_faces = vtkProperty()\n    back_faces.SetDiffuseColor(colors.GetColor3d('Gold'))\n\n    actor.SetBackfaceProperty(back_faces)\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetWindowName('ImplicitPlaneWidget2')\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    # An interactor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    # The callback will do the work.\n    my_callback = IPWCallback(plane)\n\n    rep = vtkImplicitPlaneRepresentation()\n    rep.SetPlaceFactor(1.25)  # This must be set prior to placing the widget\n    rep.PlaceWidget(actor.GetBounds())\n    rep.SetNormal(plane.GetNormal())\n\n    plane_widget = vtkImplicitPlaneWidget2()\n    plane_widget.SetInteractor(iren)\n    plane_widget.SetRepresentation(rep)\n    plane_widget.AddObserver(vtkCommand.InteractionEvent, my_callback)\n\n    renderer.GetActiveCamera().Azimuth(-60)\n    renderer.GetActiveCamera().Elevation(30)\n    renderer.ResetCamera()\n    renderer.GetActiveCamera().Zoom(0.75)\n\n    # Render and interact.\n    iren.Initialize()\n    ren_win.Render()\n    plane_widget.On()\n\n    # Begin mouse interaction.\n    iren.Start()\n\n\nclass IPWCallback:\n    def __init__(self, plane):\n        self.plane = plane\n\n    def __call__(self, caller, ev):\n        rep = caller.GetRepresentation()\n        rep.GetPlane(self.plane)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'How to use the second generation ImplicitPlaneWidget2 to interactively' \\\n                  ' define the clipping plane for a polydata.'\n    epilogue = '''\n    If no arguments are specified, a vtkSphereSource generates the polydata.\n    By specifying a .vtp file, the example can operate on arbitrary polydata.\n'''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawTextHelpFormatter)\n    parser.add_argument('file_name', nargs='?', default=None, help='A VTK Poly Data file e.g. cow.vtp')\n\n    args = parser.parse_args()\n    return args.file_name\n\n\nif __name__ == '__main__':\n    file_name = get_program_parameters()\n    main(file_name)\n
        "},{"location":"Python/Widgets/OrientationMarkerWidget/","title":"OrientationMarkerWidget","text":"

        vtk-examples/Python/Widgets/OrientationMarkerWidget

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/OrientationMarkerWidget/#code","title":"Code","text":"

        OrientationMarkerWidget.py

        #!/usr/bin/env python3\n# Contributed by Eric E Monson\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkCubeSource\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkAnnotatedCubeActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.2, 0.3, 0.7, 1.0])\n\n    # create a rendering window and renderer\n    ren = vtkRenderer()\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(ren)\n    ren_win.SetWindowName('OrientationMarkerWidget')\n\n    # create a renderwindowinteractor\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    cube = vtkCubeSource()\n    cube.SetXLength(200)\n    cube.SetYLength(200)\n    cube.SetZLength(200)\n    cube.Update()\n    cm = vtkPolyDataMapper()\n    cm.SetInputConnection(cube.GetOutputPort())\n    ca = vtkActor()\n    ca.SetMapper(cm)\n    ca.GetProperty().SetColor(colors.GetColor3d(\"BurlyWood\"))\n    ca.GetProperty().EdgeVisibilityOn()\n    ca.GetProperty().SetEdgeColor(colors.GetColor3d(\"Red\"))\n\n    # assign actor to the renderer\n    ren.AddActor(ca)\n    ren.SetBackground(colors.GetColor3d('CornflowerBlue'))\n\n    axes_actor = vtkAnnotatedCubeActor()\n    axes_actor.SetXPlusFaceText('L')\n    axes_actor.SetXMinusFaceText('R')\n    axes_actor.SetYMinusFaceText('I')\n    axes_actor.SetYPlusFaceText('S')\n    axes_actor.SetZMinusFaceText('P')\n    axes_actor.SetZPlusFaceText('A')\n    axes_actor.GetTextEdgesProperty().SetColor(colors.GetColor3d(\"Yellow\"))\n    axes_actor.GetTextEdgesProperty().SetLineWidth(2)\n    axes_actor.GetCubeProperty().SetColor(colors.GetColor3d(\"Blue\"))\n    axes = vtkOrientationMarkerWidget()\n    axes.SetOrientationMarker(axes_actor)\n    axes.SetInteractor(iren)\n    axes.EnabledOn()\n    axes.InteractiveOn()\n    ren.ResetCamera()\n\n    # enable user interface interactor\n    iren.Initialize()\n    ren_win.Render()\n    ren.GetActiveCamera().Azimuth(45)\n    ren.GetActiveCamera().Elevation(30)\n    ren_win.Render()\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Widgets/OrientationMarkerWidget1/","title":"OrientationMarkerWidget1","text":"

        vtk-examples/Python/Widgets/OrientationMarkerWidget1

        "},{"location":"Python/Widgets/OrientationMarkerWidget1/#description","title":"Description","text":"

        This example uses a polydata as an orientation icon. You can get the bunny data src/Testing/Data/Bunny.vtp.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/OrientationMarkerWidget1/#code","title":"Code","text":"

        OrientationMarkerWidget1.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSuperquadricSource\nfrom vtkmodules.vtkIOXML import vtkXMLPolyDataReader\nfrom vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    file_name = get_program_parameters()\n\n    # Read the polydata for the icon\n    reader = vtkXMLPolyDataReader()\n    reader.SetFileName(file_name)\n\n    icon_mapper = vtkDataSetMapper()\n    icon_mapper.SetInputConnection(reader.GetOutputPort())\n\n    icon_actor = vtkActor()\n    icon_actor.SetMapper(icon_mapper)\n    icon_actor.GetProperty().SetColor(colors.GetColor3d('Silver'))\n\n    # Set up the renderer, window, and interactor\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('SlateGray'))\n\n    ren_win = vtkRenderWindow()\n    ren_win.AddRenderer(renderer)\n    ren_win.SetSize(400, 400)\n    ren_win.SetWindowName('OrientationMarkerWidget1')\n\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n\n    rgb = [0.0, 0.0, 0.0]\n    colors.GetColorRGB('Wheat', rgb)\n    # Set up the widget\n    widget = vtkOrientationMarkerWidget()\n    widget.SetOrientationMarker(icon_actor)\n    widget.SetInteractor(iren)\n    widget.SetViewport(0.0, 0.0, 0.2, 0.2)\n    widget.SetOutlineColor(*rgb)\n    widget.SetEnabled(1)\n    widget.InteractiveOn()\n\n    # Create a superquadric\n    superquadric_source = vtkSuperquadricSource()\n    superquadric_source.SetPhiRoundness(.2)\n    superquadric_source.SetThetaRoundness(.8)\n\n    # Create a mapper and actor\n    superquadric_mapper = vtkPolyDataMapper()\n    superquadric_mapper.SetInputConnection(superquadric_source.GetOutputPort())\n\n    superquadric_actor = vtkActor()\n    superquadric_actor.SetMapper(superquadric_mapper)\n    superquadric_actor.GetProperty().SetInterpolationToFlat()\n    superquadric_actor.GetProperty().SetDiffuseColor(colors.GetColor3d('Carrot'))\n    superquadric_actor.GetProperty().SetSpecularColor(colors.GetColor3d('White'))\n    superquadric_actor.GetProperty().SetDiffuse(0.6)\n    superquadric_actor.GetProperty().SetSpecular(0.5)\n    superquadric_actor.GetProperty().SetSpecularPower(5.0)\n\n    renderer.AddActor(superquadric_actor)\n    renderer.ResetCamera()\n\n    ren_win.Render()\n\n    iren.Initialize()\n\n    iren.Start()\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'OrientationMarkerWidget1'\n    epilogue = \"\"\"\n   \"\"\"\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('file_name', help='Bunny.vtp')\n    args = parser.parse_args()\n    return args.file_name\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Widgets/ScalarBarWidget/","title":"ScalarBarWidget","text":"

        vtk-examples/Python/Widgets/ScalarBarWidget

        "},{"location":"Python/Widgets/ScalarBarWidget/#description","title":"Description","text":"

        Display a movable and resizable scalar bar.

        An example input file is uGridEx.vtk (folder Data at VTKData).

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/ScalarBarWidget/#code","title":"Code","text":"

        ScalarBarWidget.py

        #!/usr/bin/env python3\n\n# by Panos Mavrogiorgos, email : pmav99 >a< gmail\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import vtkLookupTable\nfrom vtkmodules.vtkIOLegacy import vtkUnstructuredGridReader\nfrom vtkmodules.vtkInteractionWidgets import vtkScalarBarWidget\nfrom vtkmodules.vtkRenderingAnnotation import vtkScalarBarActor\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef get_program_parameters():\n    import argparse\n    description = 'Scalar bar widget.'\n    epilogue = '''\n    '''\n    parser = argparse.ArgumentParser(description=description, epilog=epilogue,\n                                     formatter_class=argparse.RawDescriptionHelpFormatter)\n    parser.add_argument('filename', help='uGridEx.vtkp')\n    args = parser.parse_args()\n    return args.filename\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])\n\n    # The source file\n    file_name = get_program_parameters()\n\n    # Create a custom lut. The lut is used for both at the mapper and at the\n    # scalar_bar\n    lut = vtkLookupTable()\n    lut.Build()\n\n    # Read the source file.\n    reader = vtkUnstructuredGridReader()\n    reader.SetFileName(file_name)\n    reader.Update()  # Needed because of GetScalarRange\n    output = reader.GetOutput()\n    scalar_range = output.GetScalarRange()\n\n    mapper = vtkDataSetMapper()\n    mapper.SetInputData(output)\n    mapper.SetScalarRange(scalar_range)\n    mapper.SetLookupTable(lut)\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n\n    renderer = vtkRenderer()\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('MidnightBLue'))\n\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n    render_window.SetSize(300, 300)\n    render_window.SetWindowName(\"ScalarBarWidget\")\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n\n    # create the scalar_bar\n    scalar_bar = vtkScalarBarActor()\n    scalar_bar.SetOrientationToHorizontal()\n    scalar_bar.SetLookupTable(lut)\n\n    # create the scalar_bar_widget\n    scalar_bar_widget = vtkScalarBarWidget()\n    scalar_bar_widget.SetInteractor(interactor)\n    scalar_bar_widget.SetScalarBarActor(scalar_bar)\n    scalar_bar_widget.On()\n\n    interactor.Initialize()\n    render_window.Render()\n    renderer.GetActiveCamera().SetPosition(-6.4, 10.3, 1.4)\n    renderer.GetActiveCamera().SetFocalPoint(1.0, 0.5, 3.0)\n    renderer.GetActiveCamera().SetViewUp(0.6, 0.4, -0.7)\n    render_window.Render()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Widgets/SphereWidget/","title":"SphereWidget","text":"

        vtk-examples/Python/Widgets/SphereWidget

        "},{"location":"Python/Widgets/SphereWidget/#description","title":"Description","text":"

        This example shows how to use the SphereWidget.

        Other languages

        See (Cxx)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/SphereWidget/#code","title":"Code","text":"

        SphereWidget.py

        #!/usr/bin/env python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkInteractionWidgets import vtkSphereWidget\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\n# Call back function\n\n\ndef sphereCallback(obj, event):\n    print('Center: {}, {}, {}'.format(*obj.GetCenter()))\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])\n\n    # A renderer and render window\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('MidnightBlue'))\n\n    renwin = vtkRenderWindow()\n    renwin.AddRenderer(renderer)\n    renwin.SetWindowName(\"SphereWidget\")\n\n    # An interactor\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(renwin)\n\n    # A Sphere widget\n    sphereWidget = vtkSphereWidget()\n    sphereWidget.SetInteractor(interactor)\n    sphereWidget.SetRepresentationToSurface()\n    sphereWidget.GetSphereProperty().SetColor(colors.GetColor3d(\"BurlyWood\"))\n\n    # Connect the event to a function\n    sphereWidget.AddObserver(\"InteractionEvent\", sphereCallback)\n\n    # Start\n    interactor.Initialize()\n    renwin.Render()\n    sphereWidget.On()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Python/Widgets/SplineWidget/","title":"SplineWidget","text":"

        vtk-examples/Python/Widgets/SplineWidget

        "},{"location":"Python/Widgets/SplineWidget/#description","title":"Description","text":"

        This example shows how to use vtkSplineWidget with a callback being used to get the length of the spline widget.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/SplineWidget/#code","title":"Code","text":"

        SplineWidget.py

        #!/usr/bin/python3\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\n\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkCommonCore import (\n    vtkCommand,\n    vtkVersion\n)\nfrom vtkmodules.vtkFiltersSources import vtkCylinderSource\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkCameraOrientationWidget,\n    vtkSplineWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main(argv):\n    colors = vtkNamedColors()\n    colors.SetColor('ParaViewBkg', [82, 87, 110, 255])\n\n    has_cow = False\n    if vtk_version_ok(9, 0, 20210718):\n        cam_orient_manipulator = vtkCameraOrientationWidget()\n        has_cow = True\n\n    window_width = 1024\n    window_height = 1024\n\n    ren_win = vtkRenderWindow()\n    ren_win.SetSize(window_width, window_height)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(ren_win)\n    style = vtkInteractorStyleTrackballCamera()\n    iren.SetInteractorStyle(style)\n\n    renderer = vtkRenderer()\n    renderer.SetBackground(colors.GetColor3d('ParaViewBkg'))\n\n    # Create a cylinder.\n    cylinder = vtkCylinderSource()\n    cylinder.SetCenter(0.0, 0.0, 0.0)\n    cylinder.SetRadius(3.0)\n    cylinder.SetHeight(5.0)\n    cylinder.SetResolution(100)\n\n    # Create a mapper and actor\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(cylinder.GetOutputPort())\n    actor = vtkActor()\n    actor.GetProperty().SetColor(colors.GetColor3d('Cornsilk'))\n    actor.SetMapper(mapper)\n    # Add the actor to the scene\n    renderer.AddActor(actor)\n\n    ren_win.AddRenderer(renderer)\n\n    # A spline widget\n    spline_widget = vtkSplineWidget()\n    spline_widget.SetInteractor(iren)\n    spline_widget.SetProp3D(actor)\n    spline_widget.PlaceWidget(-2.5, 2.5, 3.5, 3.5, 0, 0, )\n    spline_widget.On()\n\n    spline_widget.AddObserver(vtkCommand.EndInteractionEvent, SplineCallback(spline_widget))\n    # Important: The interactor must be set prior to enabling the widget.\n    iren.SetRenderWindow(ren_win)\n\n    if has_cow:\n        cam_orient_manipulator.SetParentRenderer(renderer)\n        # Enable the widget.\n        cam_orient_manipulator.On()\n\n    ren_win.Render()\n    ren_win.SetWindowName('SplineWidget')\n    iren.Start()\n\n\ndef vtk_version_ok(major, minor, build):\n    \"\"\"\n    Check the VTK version.\n\n    :param major: Requested major version.\n    :param minor: Requested minor version.\n    :param build: Requested build version.\n    :return: True if the requested VTK version is >= the actual VTK version.\n    \"\"\"\n    requested_version = (100 * int(major) + int(minor)) * 100000000 + int(build)\n    ver = vtkVersion()\n    actual_version = (100 * ver.GetVTKMajorVersion() + ver.GetVTKMinorVersion()) \\\n                     * 100000000 + ver.GetVTKBuildVersion()\n    if actual_version >= requested_version:\n        return True\n    else:\n        return False\n\n\nclass SplineCallback:\n    def __init__(self, spline_widget):\n        self.spline = spline_widget\n\n    def __call__(self, caller, ev):\n        spline_widget = caller\n        length = spline_widget.GetSummedLength()\n        print(f'Length: {length}')\n\n\nif __name__ == '__main__':\n    import sys\n\n    main(sys.argv)\n
        "},{"location":"Python/Widgets/TextWidget/","title":"TextWidget","text":"

        vtk-examples/Python/Widgets/TextWidget

        "},{"location":"Python/Widgets/TextWidget/#description","title":"Description","text":"

        A simple example of annotating a VTK image with movable and resizable text.

        Other languages

        See (Cxx), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Python/Widgets/TextWidget/#code","title":"Code","text":"

        TextWidget.py

        #!/usr/bin/env python3\n\n# by Panos Mavrogiorgos, email : pmav99 >a< gmail\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkSphereSource\nfrom vtkmodules.vtkInteractionWidgets import (\n    vtkTextRepresentation,\n    vtkTextWidget\n)\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer,\n    vtkTextActor\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n\n    # colors.SetColor('bkg', [0.1, 0.2, 0.4, 1.0])\n\n    source = vtkSphereSource()\n\n    mapper = vtkPolyDataMapper()\n    mapper.SetInputConnection(source.GetOutputPort())\n\n    actor = vtkActor()\n    actor.SetMapper(mapper)\n    actor.GetProperty().SetColor(colors.GetColor3d('MistyRose'))\n\n    renderer = vtkRenderer()\n    render_window = vtkRenderWindow()\n    render_window.AddRenderer(renderer)\n\n    interactor = vtkRenderWindowInteractor()\n    interactor.SetRenderWindow(render_window)\n\n    # Create the TextActor\n    text_actor = vtkTextActor()\n    text_actor.SetInput('This is a test')\n    text_actor.GetTextProperty().SetColor(colors.GetColor3d('Lime'))\n\n    # Create the text representation. Used for positioning the text_actor\n    text_representation = vtkTextRepresentation()\n    text_representation.GetPositionCoordinate().SetValue(0.15, 0.15)\n    text_representation.GetPosition2Coordinate().SetValue(0.7, 0.2)\n\n    # Create the TextWidget\n    # Note that the SelectableOff method MUST be invoked!\n    # According to the documentation :\n    #\n    # SelectableOn/Off indicates whether the interior region of the widget can be\n    # selected or not. If not, then events (such as left mouse down) allow the user\n    # to 'move' the widget, and no selection is possible. Otherwise the\n    # SelectRegion() method is invoked.\n    text_widget = vtkTextWidget()\n    text_widget.SetRepresentation(text_representation)\n\n    text_widget.SetInteractor(interactor)\n    text_widget.SetTextActor(text_actor)\n    text_widget.SelectableOff()\n\n    renderer.AddActor(actor)\n    renderer.SetBackground(colors.GetColor3d('MidnightBLue'))\n    render_window.SetSize(300, 300)\n    render_window.SetWindowName('TextWidget')\n\n    interactor.Initialize()\n    render_window.Render()\n    text_widget.On()\n    interactor.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesNotUsed/","title":"VTK Classes not used in the Examples","text":""},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesNotUsed/#pythonicapi","title":"PythonicAPI","text":"

        Out of 3113 available VTK classes, 3106 have not been used.

        VTK Class VTK Class VTK Class VTK Class VTK Class vtk2DHistogramItem vtk3DCursorRepresentation vtk3DCursorWidget vtk3DLinearGridCrinkleExtractor vtk3DLinearGridInternal vtk3DLinearGridPlaneCutter vtk3DSImporter vtk3DWidget vtkABI vtkADIOS2CoreImageReader vtkADIOS2VTXReader vtkAMRBaseParticlesReader vtkAMRBaseReader vtkAMRBox vtkAMRCutPlane vtkAMRDataInternals vtkAMRDataSetCache vtkAMREnzoParticlesReader vtkAMREnzoReader vtkAMREnzoReaderInternal vtkAMRFlashParticlesReader vtkAMRFlashReader vtkAMRFlashReaderInternal vtkAMRGaussianPulseSource vtkAMRInformation vtkAMRInterpolatedVelocityField vtkAMRResampleFilter vtkAMRSliceFilter vtkAMRToMultiBlockFilter vtkAMRUtilities vtkAMRVelodyneReader vtkAMRVelodyneReaderInternal vtkAMRVolumeMapper vtkAMReXGridHeader vtkAMReXGridLevelHeader vtkAMReXGridReader vtkAMReXGridReaderInternal vtkAMReXParticlesReader vtkAOSDataArrayTemplate vtkASCIITextCodec vtkAVIWriter vtkAVSucdReader vtkAbstractArray vtkAbstractCellArray vtkAbstractCellLinks vtkAbstractCellLocator vtkAbstractContextBufferId vtkAbstractContextItem vtkAbstractElectronicData vtkAbstractGridConnectivity vtkAbstractHyperTreeGridMapper vtkAbstractImageInterpolator vtkAbstractInteractionDevice vtkAbstractInterpolatedVelocityField vtkAbstractMapper vtkAbstractMapper3D vtkAbstractParticleWriter vtkAbstractPicker vtkAbstractPointLocator vtkAbstractPolyDataReader vtkAbstractPolygonalHandleRepresentation3D vtkAbstractPropPicker vtkAbstractRenderDevice vtkAbstractSplineRepresentation vtkAbstractTransform vtkAbstractVolumeMapper vtkAbstractWidget vtkActor2D vtkActor2DCollection vtkActorCollection vtkActorNode vtkAdaptiveDataSetSurfaceFilter vtkAdaptiveResampleToImage vtkAdaptiveSubdivisionFilter vtkAdaptiveTemporalInterpolator vtkAddMembershipArray vtkAdjacencyMatrixToEdgeTable vtkAdjacentVertexIterator vtkAffineRepresentation vtkAffineRepresentation2D vtkAffineWidget vtkAggregateDataSetFilter vtkAggregateToPartitionedDataSetCollection vtkAlembicExporter vtkAlgorithm vtkAlgorithmOutput vtkAlignImageDataSetFilter vtkAmoebaMinimizer vtkAnariActorNode vtkAnariCameraNode vtkAnariCompositePolyDataMapperNode vtkAnariFollowerNode vtkAnariLightNode vtkAnariPass vtkAnariPolyDataMapperNode vtkAnariProfiling vtkAnariRendererNode vtkAnariTestInteractor vtkAnariViewNodeFactory vtkAnariVolumeInterface vtkAnariVolumeMapper vtkAnariVolumeMapperNode vtkAnariVolumeNode vtkAnariWindowNode vtkAndroidOutputWindow vtkAndroidRenderWindowInteractor vtkAngleRepresentation vtkAngleRepresentation2D vtkAngleRepresentation3D vtkAngleWidget vtkAngularPeriodicDataArray vtkAngularPeriodicFilter vtkAnimateModes vtkAnimationCue vtkAnimationScene vtkAnnotatedCubeActor vtkAnnotation vtkAnnotationLayers vtkAnnotationLayersAlgorithm vtkAnnotationLink vtkAppendArcLength vtkAppendCompositeDataLeaves vtkAppendDataSets vtkAppendFilter vtkAppendLocationAttributes vtkAppendPartitionedDataSetCollection vtkAppendPoints vtkAppendPolyData vtkAppendSelection vtkApplyColors vtkApplyIcons vtkApproximatingSubdivisionFilter vtkArcGridActorPrivate vtkArcParallelEdgeStrategy vtkArcPlotter vtkArcSource vtkArchiver vtkAreaContourSpectrumFilter vtkAreaLayout vtkAreaLayoutStrategy vtkAreaPicker vtkArray vtkArrayCalculator vtkArrayCoordinates vtkArrayData vtkArrayDataAlgorithm vtkArrayDataReader vtkArrayDataWriter vtkArrayDispatch vtkArrayExtents vtkArrayExtentsList vtkArrayInterpolate vtkArrayIterator vtkArrayIteratorIncludes vtkArrayIteratorTemplate vtkArrayListTemplate vtkArrayNorm vtkArrayPrint vtkArrayRange vtkArrayReader vtkArrayRename vtkArrayRenderer vtkArraySort vtkArrayToTable vtkArrayWeights vtkArrayWriter vtkArrowSource vtkAssembly vtkAssemblyNode vtkAssemblyPath vtkAssemblyPaths vtkAssignAttribute vtkAssignCoordinates vtkAssignCoordinatesLayoutStrategy vtkAtom vtkAtomicMutex vtkAttributeClustering2DLayoutStrategy vtkAttributeDataToFieldDataFilter vtkAttributeDataToTableFilter vtkAttributeSmoothingFilter vtkAttributesErrorMetric vtkAutoCorrelativeStatistics vtkAvatar vtkAxes vtkAxesActor vtkAxesTransformRepresentation vtkAxesTransformWidget vtkAxis vtkAxisActor vtkAxisActor2D vtkAxisActor2DMock vtkAxisExtended vtkAxisFollower vtkAxisGridActorPrivate vtkBMPReader vtkBMPWriter vtkBSPCuts vtkBSPIntersections vtkBSplineTransform vtkBTSReader vtkBYUReader vtkBYUWriter vtkBackgroundColorMonitor vtkBalloonRepresentation vtkBalloonWidget vtkBandedPolyDataContourFilter vtkBarChartActor vtkBase64InputStream vtkBase64OutputStream vtkBase64Utilities vtkBatchedSurfaceLICMapper vtkBatches vtkBezierContourLineInterpolator vtkBezierCurve vtkBezierHexahedron vtkBezierInterpolation vtkBezierQuadrilateral vtkBezierTetra vtkBezierTriangle vtkBezierWedge vtkBiDimensionalRepresentation vtkBiDimensionalRepresentation2D vtkBiDimensionalWidget vtkBiQuadraticQuad vtkBiQuadraticQuadraticHexahedron vtkBiQuadraticQuadraticWedge vtkBiQuadraticTriangle vtkBilinearQuadIntersection vtkBillboardTextActor3D vtkBinCellDataFilter vtkBinnedDecimation vtkBiomTableReader vtkBitArray vtkBitArrayIterator vtkBivariateLinearTableThreshold vtkBlankStructuredGrid vtkBlankStructuredGridWithImage vtkBlockDistribution vtkBlockIdScalars vtkBlockItem vtkBlockSelector vtkBlueObeliskData vtkBlueObeliskDataParser vtkBond vtkBooleanOperationPolyDataFilter vtkBooleanTexture vtkBoostBetweennessClustering vtkBoostBiconnectedComponents vtkBoostBrandesCentrality vtkBoostBreadthFirstSearch vtkBoostBreadthFirstSearchTree vtkBoostConnectedComponents vtkBoostDividedEdgeBundling vtkBoostExtractLargestComponent vtkBoostKruskalMinimumSpanningTree vtkBoostLogWeighting vtkBoostPrimMinimumSpanningTree vtkBoostRandomSparseArraySource vtkBoostSplitTableField vtkBorderRepresentation vtkBorderWidget vtkBoundaryMeshQuality vtkBoundedPlanePointPlacer vtkBoundedPointSource vtkBoundingBox vtkBox vtkBoxClipDataSet vtkBoxLayoutStrategy vtkBoxMuellerRandomSequence vtkBoxRepresentation vtkBoxWidget vtkBoxWidget2 vtkBreakPoint vtkBrokenLineWidget vtkBrownianPoints vtkBrush vtkBuffer vtkBufferedArchiver vtkButterflySubdivisionFilter vtkButtonRepresentation vtkButtonSource vtkButtonWidget vtkByteSwap vtkCGMWriter vtkCGNSCache vtkCGNSFileSeriesReader vtkCGNSReader vtkCGNSReaderInternal vtkCMLMoleculeReader vtkCONVERGECFDCGNSReader vtkCONVERGECFDReader vtkCPExodusIIElementBlock vtkCPExodusIIElementBlockCellIterator vtkCPExodusIIElementBlockImpl vtkCPExodusIIInSituReader vtkCPExodusIINodalCoordinatesTemplate vtkCPExodusIIResultsArrayTemplate vtkCachedStreamingDemandDrivenPipeline vtkCallbackCommand vtkCamera vtkCamera3DRepresentation vtkCamera3DWidget vtkCameraActor vtkCameraHandleSource vtkCameraInterpolator vtkCameraNode vtkCameraOrientationRepresentation vtkCameraOrientationWidget vtkCameraPass vtkCameraPathRepresentation vtkCameraPathWidget vtkCameraRepresentation vtkCameraWidget vtkCapsuleSource vtkCaptionActor2D vtkCaptionRepresentation vtkCaptionWidget vtkCardinalSpline vtkCastToConcrete vtkCategoryLegend vtkCell vtkCell3D vtkCellArray vtkCellArrayIterator vtkCellAttribute vtkCellAttributeCalculator vtkCellAttributeInformation vtkCellCenterDepthSort vtkCellCenters vtkCellCentersPointPlacer vtkCellData vtkCellDataToPointData vtkCellDerivatives vtkCellDistanceSelector vtkCellGraphicsPrimitiveMap vtkCellGrid vtkCellGridAlgorithm vtkCellGridBoundsQuery vtkCellGridComputeSurface vtkCellGridElevation vtkCellGridElevationQuery vtkCellGridEvaluator vtkCellGridIOQuery vtkCellGridMapper vtkCellGridPointProbe vtkCellGridQuery vtkCellGridRangeQuery vtkCellGridReader vtkCellGridRenderRequest vtkCellGridResponder vtkCellGridResponderBase vtkCellGridResponders vtkCellGridSidesQuery vtkCellGridWriter vtkCellIterator vtkCellLinks vtkCellLocator vtkCellLocatorStrategy vtkCellMetadata vtkCellPicker vtkCellQuality vtkCellSizeFilter vtkCellTreeLocator vtkCellType vtkCellTypeSource vtkCellTypes vtkCellValidator vtkCenterOfMass vtkCenteredSliderRepresentation vtkCenteredSliderWidget vtkCesium3DTilesReader vtkCesium3DTilesWriter vtkCesiumB3DMReader vtkCesiumPointCloudWriter vtkChacoGraphReader vtkChacoReader vtkCharArray vtkChart vtkChart2DHistogram vtkChartBox vtkChartHistogram2D vtkChartLegend vtkChartMatrix vtkChartParallelCoordinates vtkChartPie vtkChartXY vtkChartXYZ vtkCheckerboardRepresentation vtkCheckerboardSplatter vtkCheckerboardWidget vtkCirclePackFrontChainLayoutStrategy vtkCirclePackLayout vtkCirclePackLayoutStrategy vtkCirclePackToPolyData vtkCircularLayoutStrategy vtkCityGMLReader vtkCleanPolyData vtkCleanUnstructuredGrid vtkCleanUnstructuredGridCells vtkClearRGBPass vtkClearZPass vtkClientServerCompositePass vtkClientServerSynchronizedRenderers vtkClientSocket vtkClipClosedSurface vtkClipConvexPolyData vtkClipDataSet vtkClipPolyData vtkClipVolume vtkClosedSurfacePointPlacer vtkClosestNPointsStrategy vtkClosestPointStrategy vtkClustering2DLayoutStrategy vtkCocoaMacOSXSDKCompatibility vtkCocoaRenderWindow vtkCocoaRenderWindowInteractor vtkCocoaTkUtilities vtkCoincidentPoints vtkCollapseGraph vtkCollapseVerticesByArray vtkCollectGraph vtkCollectPolyData vtkCollectTable vtkCollection vtkCollectionElement vtkCollectionIterator vtkCollisionDetectionFilter vtkColor vtkColor3 vtkColor3d vtkColor3f vtkColor3ub vtkColor4 vtkColor4d vtkColor4f vtkColor4ub vtkColorLegend vtkColorSeries vtkColorTransferControlPointsItem vtkColorTransferFunction vtkColorTransferFunctionItem vtkCommand vtkCommonInformationKeyManager vtkCommunicator vtkCommunity2DLayoutStrategy vtkCompassRepresentation vtkCompassWidget vtkCompositeCellGridMapper vtkCompositeCellGridReader vtkCompositeControlPointsItem vtkCompositeCutter vtkCompositeDataDisplayAttributes vtkCompositeDataDisplayAttributesLegacy vtkCompositeDataGeometryFilter vtkCompositeDataIterator vtkCompositeDataPipeline vtkCompositeDataProbeFilter vtkCompositeDataReader vtkCompositeDataSet vtkCompositeDataSetAlgorithm vtkCompositeDataWriter vtkCompositeImplicitBackend vtkCompositeInterpolatedVelocityField vtkCompositeMapperHelper2 vtkCompositeMapperHelperData vtkCompositePolyDataMapper vtkCompositePolyDataMapper2 vtkCompositePolyDataMapperDelegator vtkCompositeRGBAPass vtkCompositeRenderManager vtkCompositeSurfaceLICMapper vtkCompositeSurfaceLICMapperDelegator vtkCompositeTransferFunctionItem vtkCompositeZPass vtkCompositedSynchronizedRenderers vtkCompositer vtkCompressCompositer vtkComputeHistogram2DOutliers vtkComputeQuantiles vtkComputeQuartiles vtkConduitArrayUtilities vtkConduitSource vtkConduitToDataObject vtkCone vtkConeLayoutStrategy vtkConeSource vtkConnectedPointsFilter vtkConnectivityFilter vtkConstrained2DLayoutStrategy vtkConstrainedPointHandleRepresentation vtkConstrainedSmoothingFilter vtkConsumerDataFilter vtkContext2D vtkContext3D vtkContextActor vtkContextArea vtkContextClip vtkContextDevice2D vtkContextDevice3D vtkContextInteractorStyle vtkContextItem vtkContextKeyEvent vtkContextMapper2D vtkContextMouseEvent vtkContextPolygon vtkContextScene vtkContextScenePrivate vtkContextTransform vtkContextView vtkContingencyStatistics vtkContinuousScatterplot vtkContinuousValueWidget vtkContinuousValueWidgetRepresentation vtkContour3DLinearGrid vtkContourFilter vtkContourGrid vtkContourHelper vtkContourLineInterpolator vtkContourLoopExtraction vtkContourRepresentation vtkContourRepresentationInternals vtkContourRepresentationNode vtkContourRepresentationPoint vtkContourTriangulator vtkContourValues vtkContourWidget vtkControlPointsItem vtkConvertSelection vtkConvertSelectionDomain vtkConvertToMultiBlockDataSet vtkConvertToPartitionedDataSetCollection vtkConvertToPointCloud vtkConvertToPolyhedra vtkConvexHull2D vtkConvexPointSet vtkCookieCutter vtkCoordinate vtkCoordinateFrame vtkCoordinateFrameRepresentation vtkCoordinateFrameWidget vtkCornerAnnotation vtkCorrelativeStatistics vtkCosmicTreeLayoutStrategy vtkCountFaces vtkCountVertices vtkCubeAxesActor vtkCubeAxesActor2D vtkCubeSource vtkCubicLine vtkCuller vtkCullerCollection vtkCursor2D vtkCursor3D vtkCurvatures vtkCurveRepresentation vtkCutMaterial vtkCutter vtkCylinder vtkCylindricalTransform vtkDEMReader vtkDGAttributeInformation vtkDGBoundsResponder vtkDGCell vtkDGEdge vtkDGElevationResponder vtkDGEvaluator vtkDGHex vtkDGIOResponder vtkDGInterpolateCalculator vtkDGPyr vtkDGQuad vtkDGRangeResponder vtkDGRenderResponder vtkDGSidesResponder vtkDGTet vtkDGTranscribeUnstructuredCells vtkDGTri vtkDGVert vtkDGWdg vtkDICOMImageReader vtkDIMACSGraphReader vtkDIMACSGraphWriter vtkDIYAggregateDataSetFilter vtkDIYDataExchanger vtkDIYExplicitAssigner vtkDIYGhostUtilities vtkDIYKdTreeUtilities vtkDIYUtilities vtkDIYUtilitiesCleanup vtkDSPFilterDefinition vtkDSPFilterGroup vtkDataArray vtkDataArrayCollection vtkDataArrayCollectionIterator vtkDataArraySelection vtkDataAssembly vtkDataAssemblyUtilities vtkDataAssemblyVisitor vtkDataCompressor vtkDataEncoder vtkDataObject vtkDataObjectAlgorithm vtkDataObjectCollection vtkDataObjectGenerator vtkDataObjectMeshCache vtkDataObjectReader vtkDataObjectToConduit vtkDataObjectToDataSetFilter vtkDataObjectToTable vtkDataObjectTree vtkDataObjectTreeIndex vtkDataObjectTreeInternals vtkDataObjectTreeIterator vtkDataObjectTypes vtkDataObjectWriter vtkDataReader vtkDataRepresentation vtkDataSet vtkDataSetAlgorithm vtkDataSetAttributes vtkDataSetAttributesFieldList vtkDataSetCellIterator vtkDataSetCollection vtkDataSetEdgeSubdivisionCriterion vtkDataSetGradient vtkDataSetGradientPrecompute vtkDataSetMapper vtkDataSetReader vtkDataSetRegionSurfaceFilter vtkDataSetSurfaceFilter vtkDataSetToDataObjectFilter vtkDataSetTriangleFilter vtkDataSetWriter vtkDataTransferHelper vtkDataWriter vtkDatabaseToTableReader vtkDateToNumeric vtkDeRhamCell vtkDebugLeaks vtkDebugLeaksManager vtkDebugLeaksObserver vtkDecimatePolylineFilter vtkDecimatePro vtkDefaultPass vtkDeflectNormals vtkDeformPointSet vtkDelaunay2D vtkDelaunay3D vtkDelimitedTextReader vtkDelimitedTextWriter vtkDemandDrivenPipeline vtkDendrogramItem vtkDenseArray vtkDensifyPointCloudFilter vtkDensifyPolyData vtkDependentDimensionInfo vtkDepthImageProcessingPass vtkDepthImageToPointCloud vtkDepthOfFieldPass vtkDepthPeelingPass vtkDepthSortPolyData vtkDescriptiveStatistics vtkDeserializer vtkDiagonalMatrixSource vtkDicer vtkDijkstraGraphGeodesicPath vtkDijkstraGraphInternals vtkDijkstraImageContourLineInterpolator vtkDijkstraImageGeodesicPath vtkDimensionInfo vtkDirectedAcyclicGraph vtkDirectedGraph vtkDirectedGraphAlgorithm vtkDirectionEncoder vtkDirectory vtkDiscreteFlyingEdges2D vtkDiscreteFlyingEdges3D vtkDiscreteFlyingEdgesClipper2D vtkDiscreteMarchingCubes vtkDiscretizableColorTransferFunction vtkDiskSource vtkDisplaySizedImplicitPlaneRepresentation vtkDisplaySizedImplicitPlaneWidget vtkDistancePolyDataFilter vtkDistanceRepresentation vtkDistanceRepresentation2D vtkDistanceRepresentation3D vtkDistanceToCamera vtkDistanceWidget vtkDistributedDataFilter vtkDistributedGraphHelper vtkDistributedPointCloudFilter vtkDotProductSimilarity vtkDoubleArray vtkDrawTexturedElements vtkDualDepthPeelingPass vtkDummyCommunicator vtkDummyController vtkDummyGPUInfoList vtkDuplicatePolyData vtkDynamic2DLabelMapper vtkDynamicLoader vtkEDLShading vtkEGLRenderWindow vtkERFReader vtkEarthSource vtkEdgeCenters vtkEdgeLayout vtkEdgeLayoutStrategy vtkEdgeListIterator vtkEdgePoints vtkEdgeSubdivisionCriterion vtkEdgeTable vtkElevationFilter vtkEllipseArcSource vtkEllipsoidTensorProbeRepresentation vtkEllipsoidalGaussianKernel vtkEllipticalButtonSource vtkEmptyCell vtkEmptyRepresentation vtkEnSight6BinaryReader vtkEnSight6Reader vtkEnSightGoldBinaryReader vtkEnSightGoldReader vtkEnSightMasterServerReader vtkEnSightReader vtkEnSightWriter vtkEncodedGradientEstimator vtkEncodedGradientShader vtkEndFor vtkEnsembleSource vtkEnzoReaderBlock vtkEnzoReaderInternal vtkEqualizerContextItem vtkEqualizerFilter vtkEquirectangularToCubeMapTexture vtkErrorCode vtkEuclideanClusterExtraction vtkEvenlySpacedStreamlines2D vtkEvent vtkEventData vtkEventDataDevice3D vtkEventDataForDevice vtkEventForwarderCommand vtkEventQtSlotConnect vtkExecutableRunner vtkExecutionAggregator vtkExecutionRange vtkExecutionTimer vtkExecutive vtkExodusIICache vtkExodusIICacheEntry vtkExodusIICacheKey vtkExodusIIReader vtkExodusIIReaderIntPointCheck vtkExodusIIReaderParser vtkExodusIIReaderPrivate vtkExodusIIReaderScalarCheck vtkExodusIIReaderTensorCheck vtkExodusIIReaderVariableCheck vtkExodusIIReaderVectorCheck vtkExodusIIWriter vtkExpandMarkedElements vtkExpandSelectedGraph vtkExplicitStructuredGrid vtkExplicitStructuredGridAlgorithm vtkExplicitStructuredGridCrop vtkExplicitStructuredGridSurfaceFilter vtkExplicitStructuredGridToUnstructuredGrid vtkExporter vtkExprTkFunctionParser vtkExtentRCBPartitioner vtkExtentSplitter vtkExtentTranslator vtkExternalLight vtkExternalOpenGLCamera vtkExternalOpenGLRenderWindow vtkExternalOpenGLRenderer vtkExtractArray vtkExtractBlock vtkExtractBlockUsingDataAssembly vtkExtractCTHPart vtkExtractCells vtkExtractCellsAlongPolyLine vtkExtractCellsByType vtkExtractDataArraysOverTime vtkExtractDataOverTime vtkExtractDataSets vtkExtractEdges vtkExtractEnclosedPoints vtkExtractExodusGlobalTemporalVariables vtkExtractFunctionalBagPlot vtkExtractGeometry vtkExtractGhostCells vtkExtractGrid vtkExtractHierarchicalBins vtkExtractHistogram vtkExtractHistogram2D vtkExtractLevel vtkExtractParticlesOverTime vtkExtractPiece vtkExtractPointCloudPiece vtkExtractPoints vtkExtractPolyDataGeometry vtkExtractPolyDataPiece vtkExtractRectilinearGrid vtkExtractSelectedArraysOverTime vtkExtractSelectedFrustum vtkExtractSelectedGraph vtkExtractSelectedRows vtkExtractSelectedTree vtkExtractSelection vtkExtractSelectionBase vtkExtractStructuredGridHelper vtkExtractSubsetWithSeed vtkExtractSurface vtkExtractTensorComponents vtkExtractTimeSteps vtkExtractUnstructuredGrid vtkExtractUnstructuredGridPiece vtkExtractUserDefinedPiece vtkExtractVOI vtkExtractVectorComponents vtkFDSReader vtkFFMPEGVideoSource vtkFFMPEGWriter vtkFFT vtkFLUENTCFFReader vtkFLUENTReader vtkFXAAOptions vtkFacetReader vtkFacetWriter vtkFast2DLayoutStrategy vtkFastSplatter vtkFeatureEdges vtkFiberSurface vtkFidesReader vtkFieldData vtkFieldDataSerializer vtkFieldDataToAttributeDataFilter vtkFieldDataToDataSetAttribute vtkFileOutputWindow vtkFileResourceStream vtkFileSeriesHelper vtkFillHolesFilter vtkFilteringInformationKeyManager vtkFiltersCellGrid vtkFindCellStrategy vtkFiniteDifferenceGradientEstimator vtkFiniteElementFieldDistributor vtkFinitePlaneRepresentation vtkFinitePlaneWidget vtkFitImplicitFunction vtkFitToHeightMapFilter vtkFixedPointRayCastImage vtkFixedPointVolumeRayCastCompositeGOHelper vtkFixedPointVolumeRayCastCompositeGOShadeHelper vtkFixedPointVolumeRayCastCompositeHelper vtkFixedPointVolumeRayCastCompositeShadeHelper vtkFixedPointVolumeRayCastHelper vtkFixedPointVolumeRayCastMIPHelper vtkFixedPointVolumeRayCastMapper vtkFixedSizeHandleRepresentation vtkFixedSizeHandleRepresentation3D vtkFixedWidthTextReader vtkFlagpoleLabel vtkFlashReaderInternal vtkFloatArray vtkFloatingPointExceptions vtkFlyingEdges2D vtkFlyingEdges3D vtkFlyingEdgesPlaneCutter vtkFocalPlaneContourRepresentation vtkFocalPlanePointPlacer vtkFollower vtkFontConfigFreeTypeTools vtkForEach vtkForceDirectedLayoutStrategy vtkForceStaticMesh vtkForceTime vtkFrameBufferObjectBase vtkFramebufferPass vtkFreeTypeLabelRenderStrategy vtkFreeTypeStringToImage vtkFreeTypeTools vtkFreeTypeToolsCleanup vtkFrustumCoverageCuller vtkFrustumSelector vtkFrustumSource vtkFunctionParser vtkFunctionSet vtkGAMBITReader vtkGDAL vtkGDALRasterConverter vtkGDALRasterReader vtkGDALRasterReprojection vtkGDALVectorReader vtkGESignaReader vtkGL2PSExporter vtkGLSLModCamera vtkGLSLModCoincidentTopology vtkGLSLModLight vtkGLSLModPixelDebugger vtkGLSLModifierBase vtkGLSLModifierFactory vtkGLTFDocumentLoader vtkGLTFDocumentLoaderInternals vtkGLTFExporter vtkGLTFImporter vtkGLTFReader vtkGLTFTexture vtkGLTFWriter vtkGLTFWriterUtils vtkGPUInfo vtkGPUInfoList vtkGPUInfoListArray vtkGPUVolumeRayCastMapper vtkGarbageCollector vtkGarbageCollectorManager vtkGaussianBlurPass vtkGaussianCubeReader vtkGaussianCubeReader2 vtkGaussianKernel vtkGaussianRandomSequence vtkGaussianSplatter vtkGeneralTransform vtkGeneralizedKernel vtkGenerateGlobalIds vtkGenerateIndexArray vtkGenerateProcessIds vtkGenerateTimeSteps vtkGenericAdaptorCell vtkGenericAttribute vtkGenericAttributeCollection vtkGenericCell vtkGenericCellIterator vtkGenericCellTessellator vtkGenericClip vtkGenericContourFilter vtkGenericCutter vtkGenericDataArray vtkGenericDataArrayLookupHelper vtkGenericDataObjectReader vtkGenericDataObjectWriter vtkGenericDataSet vtkGenericDataSetTessellator vtkGenericEdgeTable vtkGenericEnSightReader vtkGenericGeometryFilter vtkGenericGlyph3DFilter vtkGenericImageInterpolator vtkGenericInterpolatedVelocityField vtkGenericMovieWriter vtkGenericOpenGLRenderWindow vtkGenericOpenGLResourceFreeCallback vtkGenericOutlineFilter vtkGenericPointIterator vtkGenericProbeFilter vtkGenericRenderWindowInteractor vtkGenericStreamTracer vtkGenericSubdivisionErrorMetric vtkGenericVertexAttributeMapping vtkGeoEdgeStrategy vtkGeoJSONFeature vtkGeoJSONReader vtkGeoJSONWriter vtkGeoMath vtkGeoProjection vtkGeoTransform vtkGeodesicPath vtkGeometricErrorMetric vtkGeometryFilter vtkGhostCellsGenerator vtkGlobFileNames vtkGlyph2D vtkGlyph3D vtkGlyph3DMapper vtkGlyphSource2D vtkGradientFilter vtkGraph vtkGraphAlgorithm vtkGraphAnnotationLayersFilter vtkGraphEdge vtkGraphGeodesicPath vtkGraphHierarchicalBundleEdges vtkGraphInternals vtkGraphItem vtkGraphLayout vtkGraphLayoutFilter vtkGraphLayoutStrategy vtkGraphLayoutView vtkGraphMapper vtkGraphReader vtkGraphToGlyphs vtkGraphToPoints vtkGraphToPolyData vtkGraphWeightEuclideanDistanceFilter vtkGraphWeightFilter vtkGraphWriter vtkGraphicsFactory vtkGreedyTerrainDecimation vtkGridSynchronizedTemplates3D vtkGridTransform vtkGroupDataSetsFilter vtkGroupLeafVertices vtkGroupTimeStepsFilter vtkH5PartReader vtkH5RageReader vtkHDF5Helper vtkHDFReader vtkHDFReaderImplementation vtkHDFVersion vtkHDFWriter vtkHDFWriterImplementation vtkHDRReader vtkHandleRepresentation vtkHandleSource vtkHandleWidget vtkHardwarePicker vtkHardwareSelector vtkHardwareWindow vtkHausdorffDistancePointSetFilter vtkHeap vtkHeatmapItem vtkHedgeHog vtkHexagonalPrism vtkHexahedron vtkHiddenLineRemovalPass vtkHierarchicalBinningFilter vtkHierarchicalBoxDataSet vtkHierarchicalBoxDataSetAlgorithm vtkHierarchicalDataExtractDataSets vtkHierarchicalDataExtractLevel vtkHierarchicalDataLevelFilter vtkHierarchicalDataSetGeometryFilter vtkHierarchicalGraphPipeline vtkHierarchicalGraphView vtkHierarchicalPolyDataMapper vtkHigherOrderCurve vtkHigherOrderHexahedron vtkHigherOrderInterpolation vtkHigherOrderQuadrilateral vtkHigherOrderTetra vtkHigherOrderTriangle vtkHigherOrderWedge vtkHighestDensityRegionsStatistics vtkHomogeneousTransform vtkHoudiniPolyDataWriter vtkHoverWidget vtkHull vtkHyperStreamline vtkHyperTree vtkHyperTreeGrid vtkHyperTreeGridAlgorithm vtkHyperTreeGridAxisClip vtkHyperTreeGridAxisCut vtkHyperTreeGridAxisReflection vtkHyperTreeGridCellCenters vtkHyperTreeGridContour vtkHyperTreeGridDepthLimiter vtkHyperTreeGridEntry vtkHyperTreeGridEvaluateCoarse vtkHyperTreeGridExtractGhostCells vtkHyperTreeGridFeatureEdges vtkHyperTreeGridGeometricLocator vtkHyperTreeGridGeometry vtkHyperTreeGridGeometry1DImpl vtkHyperTreeGridGeometry2DImpl vtkHyperTreeGridGeometry3DImpl vtkHyperTreeGridGeometryEntry vtkHyperTreeGridGeometryImpl vtkHyperTreeGridGeometryLevelEntry vtkHyperTreeGridGeometrySmallDimensionsImpl vtkHyperTreeGridGeometryUnlimitedEntry vtkHyperTreeGridGeometryUnlimitedLevelEntry vtkHyperTreeGridGhostCellsGenerator vtkHyperTreeGridGhostCellsGeneratorInternals vtkHyperTreeGridGradient vtkHyperTreeGridIterator vtkHyperTreeGridLevelEntry vtkHyperTreeGridLocator vtkHyperTreeGridMapper vtkHyperTreeGridNonOrientedCursor vtkHyperTreeGridNonOrientedGeometryCursor vtkHyperTreeGridNonOrientedMooreSuperCursor vtkHyperTreeGridNonOrientedMooreSuperCursorLight vtkHyperTreeGridNonOrientedSuperCursor vtkHyperTreeGridNonOrientedSuperCursorLight vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor vtkHyperTreeGridNonOrientedUnlimitedSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursor vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight vtkHyperTreeGridOrientedCursor vtkHyperTreeGridOrientedGeometryCursor vtkHyperTreeGridOutlineFilter vtkHyperTreeGridPlaneCutter vtkHyperTreeGridPreConfiguredSource vtkHyperTreeGridProbeFilter vtkHyperTreeGridScales vtkHyperTreeGridSource vtkHyperTreeGridThreshold vtkHyperTreeGridToDualGrid vtkHyperTreeGridToUnstructuredGrid vtkHyperTreeGridVisibleLeavesSize vtkIOCellGrid vtkIOSRenderWindow vtkIOSRenderWindowInteractor vtkIOSSFilesScanner vtkIOSSModel vtkIOSSReader vtkIOSSReaderInternal vtkIOSSWriter vtkIOStream vtkIOStreamFwd vtkISIReader vtkIVExporter vtkIVWriter vtkIcicleView vtkIconGlyphFilter vtkIdFilter vtkIdList vtkIdListCollection vtkIdTypeArray vtkIdentityTransform vtkImageAccumulate vtkImageActor vtkImageActorPointPlacer vtkImageAlgorithm vtkImageAnisotropicDiffusion2D vtkImageAnisotropicDiffusion3D vtkImageAppend vtkImageAppendComponents vtkImageBSplineCoefficients vtkImageBSplineInternals vtkImageBSplineInterpolator vtkImageBlend vtkImageButterworthHighPass vtkImageButterworthLowPass vtkImageCacheFilter vtkImageCanvasSource2D vtkImageCast vtkImageChangeInformation vtkImageCheckerboard vtkImageCityBlockDistance vtkImageClip vtkImageConnectivityFilter vtkImageConnector vtkImageConnectorSeed vtkImageConstantPad vtkImageContinuousDilate3D vtkImageContinuousErode3D vtkImageConvolve vtkImageCorrelation vtkImageCroppingRegionsWidget vtkImageCursor3D vtkImageData vtkImageDataGeometryFilter vtkImageDataLIC2D vtkImageDataOutlineFilter vtkImageDataStreamer vtkImageDataToExplicitStructuredGrid vtkImageDataToHyperTreeGrid vtkImageDataToPointSet vtkImageDataToUniformGrid vtkImageDecomposeFilter vtkImageDifference vtkImageDilateErode3D vtkImageDivergence vtkImageDotProduct vtkImageEllipsoidSource vtkImageEuclideanDistance vtkImageEuclideanToPolar vtkImageExport vtkImageExtractComponents vtkImageFFT vtkImageFlip vtkImageFourierCenter vtkImageFourierFilter vtkImageGaussianSmooth vtkImageGaussianSource vtkImageGradient vtkImageGradientMagnitude vtkImageGridSource vtkImageHSIToRGB vtkImageHSVToRGB vtkImageHistogram vtkImageHistogramStatistics vtkImageHybridMedian2D vtkImageIdealHighPass vtkImageIdealLowPass vtkImageImport vtkImageImportExecutive vtkImageInPlaceFilter vtkImageInterpolator vtkImageIslandRemoval2D vtkImageItem vtkImageIterateFilter vtkImageIterator vtkImageLaplacian vtkImageLogarithmicScale vtkImageLogic vtkImageLuminance vtkImageMagnify vtkImageMagnitude vtkImageMandelbrotSource vtkImageMapToColors vtkImageMapToRGBA vtkImageMapToWindowLevelColors vtkImageMapper vtkImageMapper3D vtkImageMarchingCubes vtkImageMask vtkImageMaskBits vtkImageMathematics vtkImageMedian3D vtkImageMirrorPad vtkImageNoiseSource vtkImageNonMaximumSuppression vtkImageNormalize vtkImageOpenClose3D vtkImageOrthoPlanes vtkImagePadFilter vtkImagePermute vtkImagePlaneWidget vtkImagePointDataIterator vtkImagePointIterator vtkImageProbeFilter vtkImageProcessingPass vtkImageProgressIterator vtkImageProperty vtkImageQuantizeRGBToIndex vtkImageRFFT vtkImageRGBToHSI vtkImageRGBToHSV vtkImageRGBToXYZ vtkImageRGBToYIQ vtkImageRange3D vtkImageReader vtkImageReader2 vtkImageReader2Collection vtkImageReader2Factory vtkImageRectilinearWipe vtkImageRenderManager vtkImageResample vtkImageResize vtkImageReslice vtkImageResliceMapper vtkImageResliceToColors vtkImageSSIM vtkImageSeedConnectivity vtkImageSeparableConvolution vtkImageShiftScale vtkImageShrink3D vtkImageSincInterpolator vtkImageSinusoidSource vtkImageSkeleton2D vtkImageSlab vtkImageSlabReslice vtkImageSlice vtkImageSliceCollection vtkImageSliceMapper vtkImageSobel2D vtkImageSobel3D vtkImageSpatialAlgorithm vtkImageStack vtkImageStencil vtkImageStencilAlgorithm vtkImageStencilData vtkImageStencilIterator vtkImageStencilRaster vtkImageStencilSource vtkImageStencilToImage vtkImageThreshold vtkImageThresholdConnectivity vtkImageToAMR vtkImageToImageStencil vtkImageToPoints vtkImageToPolyDataFilter vtkImageToStructuredGrid vtkImageToStructuredPoints vtkImageTracerWidget vtkImageTransform vtkImageTranslateExtent vtkImageVariance3D vtkImageViewer vtkImageViewer2 vtkImageWeightedSum vtkImageWrapPad vtkImageWriter vtkImageXYZToLAB vtkImageYIQToRGB vtkImplicitArray vtkImplicitBoolean vtkImplicitCylinderRepresentation vtkImplicitCylinderWidget vtkImplicitDataSet vtkImplicitFunction vtkImplicitFunctionCollection vtkImplicitFunctionToImageStencil vtkImplicitHalo vtkImplicitImageRepresentation vtkImplicitModeller vtkImplicitPlaneRepresentation vtkImplicitPlaneWidget vtkImplicitPlaneWidget2 vtkImplicitPolyDataDistance vtkImplicitProjectOnPlaneDistance vtkImplicitSelectionLoop vtkImplicitSum vtkImplicitTextureCoords vtkImplicitVolume vtkImplicitWindowFunction vtkImporter vtkImprintFilter vtkInEdgeIterator vtkIncrementalForceLayout vtkIncrementalOctreeNode vtkIncrementalOctreePointLocator vtkIncrementalPointLocator vtkIndent vtkIndexedImplicitBackend vtkInformation vtkInformationDataObjectKey vtkInformationDataObjectMetaDataKey vtkInformationDoubleKey vtkInformationDoubleVectorKey vtkInformationExecutivePortKey vtkInformationExecutivePortVectorKey vtkInformationIdTypeKey vtkInformationInformationKey vtkInformationInformationVectorKey vtkInformationIntegerKey vtkInformationIntegerPointerKey vtkInformationIntegerRequestKey vtkInformationIntegerVectorKey vtkInformationInternals vtkInformationIterator vtkInformationKey vtkInformationKeyLookup vtkInformationKeyVectorKey vtkInformationObjectBaseKey vtkInformationObjectBaseVectorKey vtkInformationQuadratureSchemeDefinitionVectorKey vtkInformationRequestKey vtkInformationStringKey vtkInformationStringVectorKey vtkInformationUnsignedLongKey vtkInformationVariantKey vtkInformationVariantVectorKey vtkInformationVector vtkInitialValueProblemSolver vtkInputStream vtkIntArray vtkIntegrateAttributes vtkInteractiveArea vtkInteractorEventRecorder vtkInteractorObserver vtkInteractorStyle vtkInteractorStyle3D vtkInteractorStyleAreaSelectHover vtkInteractorStyleDrawPolygon vtkInteractorStyleFlight vtkInteractorStyleImage vtkInteractorStyleJoystickActor vtkInteractorStyleJoystickCamera vtkInteractorStyleMultiTouchCamera vtkInteractorStyleRubberBand2D vtkInteractorStyleRubberBand3D vtkInteractorStyleRubberBandPick vtkInteractorStyleRubberBandZoom vtkInteractorStyleSwitch vtkInteractorStyleSwitchBase vtkInteractorStyleTerrain vtkInteractorStyleTrackball vtkInteractorStyleTrackballActor vtkInteractorStyleTrackballCamera vtkInteractorStyleTreeMapHover vtkInteractorStyleUnicam vtkInteractorStyleUser vtkInterpolateCalculator vtkInterpolateDataSetAttributes vtkInterpolatingSubdivisionFilter vtkInterpolationKernel vtkInterpolatorInternals vtkIntersectionCounter vtkIntersectionPolyDataFilter vtkIterativeClosestPointTransform vtkJPEGReader vtkJPEGWriter vtkJSONDataSetWriter vtkJSONImageWriter vtkJSONRenderWindowExporter vtkJSONSceneExporter vtkJavaScriptDataWriter vtkJoinTables vtkKCoreDecomposition vtkKCoreLayout vtkKMeansAssessFunctor vtkKMeansDistanceFunctor vtkKMeansDistanceFunctorCalculator vtkKMeansStatistics vtkKdNode vtkKdTree vtkKdTreePointLocator vtkKdTreeSelector vtkKochanekSpline vtkLASRasterReader vtkLASReader vtkLICNoiseHelper vtkLICRandomNoise2D vtkLICRandomNumberGeneratorInterface vtkLODActor vtkLODProp3D vtkLSDynaPart vtkLSDynaPartCollection vtkLSDynaReader vtkLSDynaSummaryParser vtkLZ4DataCompressor vtkLZMADataCompressor vtkLabelHierarchy vtkLabelHierarchyAlgorithm vtkLabelHierarchyCompositeIterator vtkLabelHierarchyIterator vtkLabelPlacementMapper vtkLabelPlacer vtkLabelRenderStrategy vtkLabelSizeCalculator vtkLabeledContourMapper vtkLabeledContourPolyDataItem vtkLabeledDataMapper vtkLabeledTreeMapDataMapper vtkLagrangeCurve vtkLagrangeHexahedron vtkLagrangeInterpolation vtkLagrangeQuadrilateral vtkLagrangeTetra vtkLagrangeTriangle vtkLagrangeWedge vtkLagrangianBasicIntegrationModel vtkLagrangianMatidaIntegrationModel vtkLagrangianParticle vtkLagrangianParticleTracker vtkLandmarkTransform vtkLargeInteger vtkLassoStencilSource vtkLeaderActor2D vtkLegacyReaderVersion vtkLegendBoxActor vtkLegendScaleActor vtkLengthDistribution vtkLevelIdScalars vtkLight vtkLightActor vtkLightCollection vtkLightKit vtkLightNode vtkLightRepresentation vtkLightWidget vtkLightingMapPass vtkLightsPass vtkLine vtkLineIntegralConvolution2D vtkLineRepresentation vtkLineSource vtkLineWidget vtkLineWidget2 vtkLinearCellExtrusionFilter vtkLinearContourLineInterpolator vtkLinearExtrusionFilter vtkLinearKernel vtkLinearSelector vtkLinearSubdivisionFilter vtkLinearToQuadraticCellsFilter vtkLinearTransform vtkLinearTransformCellLocator vtkLinkEdgels vtkLocationSelector vtkLocator vtkLogLookupTable vtkLogger vtkLogoRepresentation vtkLogoWidget vtkLongArray vtkLongLongArray vtkLookupTable vtkLookupTableItem vtkLookupTableWithEnabling vtkLoopBooleanPolyDataFilter vtkLoopSubdivisionFilter vtkMCubesReader vtkMCubesWriter vtkMFCWindow vtkMFIXReader vtkMINCImageAttributes vtkMINCImageReader vtkMINCImageWriter vtkMNIObjectReader vtkMNIObjectWriter vtkMNITagPointReader vtkMNITagPointWriter vtkMNITransformReader vtkMNITransformWriter vtkMP4Writer vtkMPASReader vtkMPI4PyCommunicator vtkMPICommunicator vtkMPIController vtkMPIEventLog vtkMPIImageReader vtkMPIMultiBlockPLOT3DReader vtkMPIPixelTT vtkMPIPixelView vtkMRCReader vtkMagnifierRepresentation vtkMagnifierWidget vtkMapArrayValues vtkMapMaskTextureId vtkMappedDataArray vtkMappedUnstructuredGrid vtkMappedUnstructuredGridCellIterator vtkMapper vtkMapper2D vtkMapperCollection vtkMapperNode vtkMarchingContourFilter vtkMarchingCubes vtkMarchingSquares vtkMarkBoundaryFilter vtkMarkerUtilities vtkMarshalContext vtkMaskFields vtkMaskPoints vtkMaskPointsFilter vtkMaskPolyData vtkMassProperties vtkMath vtkMathPrivate vtkMathTextFreeTypeTextRenderer vtkMathTextUtilities vtkMathTextUtilitiesCleanup vtkMathUtilities vtkMatplotlibMathTextUtilities vtkMatricizeArray vtkMatrix3x3 vtkMatrix4x4 vtkMatrixMathFilter vtkMatrixToHomogeneousTransform vtkMatrixToLinearTransform vtkMeanValueCoordinatesInterpolator vtkMeasurementCubeHandleRepresentation3D vtkMedicalImageProperties vtkMedicalImageReader2 vtkMemkindRAII vtkMemoryLimitImageDataStreamer vtkMemoryResourceStream vtkMergeArrays vtkMergeCells vtkMergeColumns vtkMergeDataObjectFilter vtkMergeFields vtkMergeFilter vtkMergeGraphs vtkMergePoints vtkMergeTables vtkMergeTimeFilter vtkMergeVectorComponents vtkMersenneTwister vtkMeshQuality vtkMetaImageReader vtkMetaImageWriter vtkMinimalStandardRandomSequence vtkModelMetadata vtkModifiedBSPTree vtkMolecule vtkMoleculeAlgorithm vtkMoleculeAppend vtkMoleculeMapper vtkMoleculeReaderBase vtkMoleculeToAtomBallFilter vtkMoleculeToBondStickFilter vtkMoleculeToLinesFilter vtkMoleculeToPolyDataFilter vtkMotionFXCFGReader vtkMultiBlockDataGroupFilter vtkMultiBlockDataSet vtkMultiBlockDataSetAlgorithm vtkMultiBlockMergeFilter vtkMultiBlockPLOT3DReader vtkMultiBlockPLOT3DReaderRecord vtkMultiBlockUnstructuredGridVolumeMapper vtkMultiBlockVolumeMapper vtkMultiCorrelativeAssessFunctor vtkMultiCorrelativeStatistics vtkMultiNewickTreeReader vtkMultiObjectMassProperties vtkMultiPieceDataSet vtkMultiProcessController vtkMultiProcessStream vtkMultiThreader vtkMultiThreshold vtkMultiTimeStepAlgorithm vtkMultiVolume vtkMutableDirectedGraph vtkMutableGraphHelper vtkMutableUndirectedGraph vtkMySQLDatabase vtkMySQLDatabasePrivate vtkMySQLQuery vtkMySQLToTableReader vtkNIFTIImageHeader vtkNIFTIImageReader vtkNIFTIImageWriter vtkNativePartitioningStrategy vtkNeighborCells vtkNek5000Reader vtkNetCDFCAMReader vtkNetCDFCFReader vtkNetCDFCFWriter vtkNetCDFPOPReader vtkNetCDFReader vtkNetCDFUGRIDReader vtkNetCDFUGRIDeader vtkNetworkHierarchy vtkNew vtkNewickTreeReader vtkNewickTreeWriter vtkNonLinearCell vtkNonMergingPointLocator vtkNonOverlappingAMR vtkNonOverlappingAMRAlgorithm vtkNonOverlappingAMRLevelIdScalars vtkNormalizeMatrixVectors vtkNrrdReader vtkNumberToString vtkOBBDicer vtkOBBNode vtkOBBTree vtkOBJExporter vtkOBJImporter vtkOBJPolyDataProcessor vtkOBJReader vtkOBJWriter vtkOCCTReader vtkODBCDatabase vtkODBCInternals vtkODBCQuery vtkOMETIFFReader vtkOMFReader vtkOOGLExporter vtkOSOpenGLRenderWindow vtkOSPRayAMRVolumeMapperNode vtkOSPRayActorNode vtkOSPRayCache vtkOSPRayCacheItemObject vtkOSPRayCameraNode vtkOSPRayCompositePolyDataMapper2Node vtkOSPRayCompositePolyDataMapperNode vtkOSPRayLightNode vtkOSPRayMaterialHelpers vtkOSPRayMaterialLibrary vtkOSPRayMoleculeMapperNode vtkOSPRayPass vtkOSPRayPointGaussianMapperNode vtkOSPRayPolyDataMapperNode vtkOSPRayRendererNode vtkOSPRayTestInteractor vtkOSPRayUnstructuredVolumeMapperNode vtkOSPRayViewNodeFactory vtkOSPRayVolumeInterface vtkOSPRayVolumeMapper vtkOSPRayVolumeMapperNode vtkOSPRayVolumeNode vtkOSPRayWindowNode vtkOStrStreamWrapper vtkOStreamWrapper vtkOTDensityMap vtkOTFilter vtkOTKernelSmoothing vtkOTScatterPlotMatrix vtkOTUtilities vtkObject vtkObjectBase vtkObjectFactory vtkObjectFactoryCollection vtkObjectFactoryRegistryCleanup vtkObjectIdMap vtkObserverMediator vtkOctreeImageToPointSetFilter vtkOctreePointLocator vtkOctreePointLocatorNode vtkOggTheoraWriter vtkOldStyleCallbackCommand vtkOpaquePass vtkOpenFOAMReader vtkOpenGL2ContextDevice2DCellArrayHelper vtkOpenGL2ContextDevice2DPrivate vtkOpenGLActor vtkOpenGLArrayTextureBufferAdapter vtkOpenGLAvatar vtkOpenGLBatchedPolyDataMapper vtkOpenGLBillboardTextActor3D vtkOpenGLBufferObject vtkOpenGLCamera vtkOpenGLCellGridMapper vtkOpenGLCellToVTKCellMap vtkOpenGLCompositePolyDataMapperDelegator vtkOpenGLContextActor vtkOpenGLContextBufferId vtkOpenGLContextDevice2D vtkOpenGLContextDevice3D vtkOpenGLContextDeviceBufferObjectBuilder vtkOpenGLES30PolyDataMapper2D vtkOpenGLFXAAFilter vtkOpenGLFXAAPass vtkOpenGLFluidMapper vtkOpenGLFramebufferObject vtkOpenGLGL2PSExporter vtkOpenGLGL2PSHelper vtkOpenGLGL2PSHelperImpl vtkOpenGLGPUVolumeRayCastMapper vtkOpenGLGlyph3DHelper vtkOpenGLGlyph3DMapper vtkOpenGLHardwareSelector vtkOpenGLHelper vtkOpenGLHyperTreeGridMapper vtkOpenGLImageAlgorithmCallback vtkOpenGLImageAlgorithmHelper vtkOpenGLImageGradient vtkOpenGLImageMapper vtkOpenGLImageSliceMapper vtkOpenGLIndexBufferObject vtkOpenGLInstanceCulling vtkOpenGLLabeledContourMapper vtkOpenGLLight vtkOpenGLLowMemoryBatchedPolyDataMapper vtkOpenGLLowMemoryCellTypeAgent vtkOpenGLLowMemoryLinesAgent vtkOpenGLLowMemoryPolyDataMapper vtkOpenGLLowMemoryPolygonsAgent vtkOpenGLLowMemoryStripsAgent vtkOpenGLLowMemoryVerticesAgent vtkOpenGLMoleculeMapper vtkOpenGLMovieSphere vtkOpenGLPointGaussianMapper vtkOpenGLPointGaussianMapperHelper vtkOpenGLPolyDataMapper vtkOpenGLPolyDataMapper2D vtkOpenGLProjectedTetrahedraMapper vtkOpenGLPropItem vtkOpenGLProperty vtkOpenGLQuadHelper vtkOpenGLRayCastImageDisplayHelper vtkOpenGLRenderPass vtkOpenGLRenderTimer vtkOpenGLRenderTimerLog vtkOpenGLRenderUtilities vtkOpenGLRenderWindow vtkOpenGLRenderer vtkOpenGLResourceFreeCallback vtkOpenGLShaderCache vtkOpenGLShaderDeclaration vtkOpenGLShaderProperty vtkOpenGLSkybox vtkOpenGLSphereMapper vtkOpenGLState vtkOpenGLStickMapper vtkOpenGLTextActor vtkOpenGLTextActor3D vtkOpenGLTextMapper vtkOpenGLTexture vtkOpenGLUniforms vtkOpenGLVertexArrayObject vtkOpenGLVertexBufferObject vtkOpenGLVertexBufferObjectCache vtkOpenGLVertexBufferObjectGroup vtkOpenGLVolumeGradientOpacityTable vtkOpenGLVolumeLookupTable vtkOpenGLVolumeLookupTables vtkOpenGLVolumeMaskGradientOpacityTransferFunction2D vtkOpenGLVolumeMaskTransferFunction2D vtkOpenGLVolumeOpacityTable vtkOpenGLVolumeRGBTable vtkOpenGLVolumeTransferFunction2D vtkOpenQubeElectronicData vtkOpenQubeMoleculeSource vtkOpenSlideReader vtkOpenVDBReader vtkOpenVDBWriter vtkOpenVRCamera vtkOpenVRCameraPose vtkOpenVRControlsHelper vtkOpenVRDefaultOverlay vtkOpenVRInteractorStyle vtkOpenVRModel vtkOpenVROverlay vtkOpenVROverlaySpot vtkOpenVRRenderWindow vtkOpenVRRenderWindowInteractor vtkOpenVRRenderer vtkOpenXRCamera vtkOpenXRControlsHelper vtkOpenXRInteractorStyle vtkOpenXRManager vtkOpenXRManagerConnection vtkOpenXRManagerD3DGraphics vtkOpenXRManagerGraphics vtkOpenXRManagerOpenGLGraphics vtkOpenXRManagerRemoteConnection vtkOpenXRModel vtkOpenXRRemotingRenderWindow vtkOpenXRRenderWindow vtkOpenXRRenderWindowInteractor vtkOpenXRRenderer vtkOpenXRUtilities vtkOrderIndependentTranslucentPass vtkOrderStatistics vtkOrderedTriangulator vtkOrientPolyData vtkOrientationMarkerWidget vtkOrientationRepresentation vtkOrientationWidget vtkOrientedGlyphContourRepresentation vtkOrientedGlyphFocalPlaneContourRepresentation vtkOrientedPolygonalHandleRepresentation3D vtkOutEdgeIterator vtkOutlineCornerFilter vtkOutlineCornerSource vtkOutlineFilter vtkOutlineGlowPass vtkOutlineSource vtkOutputStream vtkOutputWindow vtkOutputWindowCleanup vtkOverlappingAMR vtkOverlappingAMRAlgorithm vtkOverlappingAMRLevelIdScalars vtkOverlappingCellsDetector vtkOverlayPass vtkOverrideInformation vtkOverrideInformationCollection vtkPAutoCorrelativeStatistics vtkPBRIrradianceTexture vtkPBRLUTTexture vtkPBRPrefilterTexture vtkPBivariateLinearTableThreshold vtkPCAAnalysisFilter vtkPCACurvatureEstimation vtkPCANormalEstimation vtkPCAStatistics vtkPCellDataToPointData vtkPCellSizeFilter vtkPChacoReader vtkPComputeHistogram2DOutliers vtkPComputeQuantiles vtkPComputeQuartiles vtkPConnectivityFilter vtkPContingencyStatistics vtkPConvertToMultiBlockDataSet vtkPCorrelativeStatistics vtkPDALReader vtkPDBReader vtkPDFContextDevice2D vtkPDFExporter vtkPDataSetReader vtkPDataSetWriter vtkPDescriptiveStatistics vtkPDirectory vtkPDistributedDataFilter vtkPExodusIIReader vtkPExodusIIWriter vtkPExtractDataArraysOverTime vtkPExtractExodusGlobalTemporalVariables vtkPExtractGrid vtkPExtractHistogram2D vtkPExtractRectilinearGrid vtkPExtractSelectedArraysOverTime vtkPExtractVOI vtkPHardwareSelector vtkPHyperTreeGridProbeFilter vtkPIOReader vtkPImageWriter vtkPKMeansStatisitcs vtkPKMeansStatistics vtkPKdTree vtkPLSDynaReader vtkPLYReader vtkPLYWriter vtkPLagrangianParticleTracker vtkPLineIntegralConvolution2D vtkPLinearExtrusionFilter vtkPMaskPoints vtkPMergeArrays vtkPMultiCorrelativeStatistics vtkPNGReader vtkPNGWriter vtkPNMReader vtkPNMWriter vtkPNetCDFPOPReader vtkPNrrdReader vtkPOVExporter vtkPOpenFOAMReader vtkPOrderStatistics vtkPOutlineCornerFilter vtkPOutlineFilter vtkPOutlineFilterInternals vtkPPCAStatistics vtkPPainterCommunicator vtkPPairwiseExtractHistogram2D vtkPParticlePathFilter vtkPParticleTracer vtkPParticleTracerBase vtkPPixelTransfer vtkPPolyDataNormals vtkPProbeFilter vtkPProjectSphereFilter vtkPReflectionFilter vtkPResampleFilter vtkPResampleToImage vtkPResampleWithDataSet vtkPSLACReader vtkPSimpleBondPerceiver vtkPSphereSource vtkPStreaklineFilter vtkPStreamTracer vtkPStructuredGridConnectivity vtkPSurfaceLICComposite vtkPSurfaceLICInterface vtkPSystemTools vtkPTSReader vtkPTextureMapToSphere vtkPVWebGLExporter vtkPWindBladeReader vtkPXdmf3Writer vtkPYoungsMaterialInterface vtkPackLabels vtkPainterCommunicator vtkPairwiseExtractHistogram2D vtkPanoramicProjectionPass vtkParallelAMRUtilities vtkParallelCoordinatesActor vtkParallelCoordinatesHistogramRepresentation vtkParallelCoordinatesInteractorStyle vtkParallelCoordinatesRepresentation vtkParallelCoordinatesView vtkParallelReader vtkParallelRenderManager vtkParallelTimer vtkParallelVectors vtkParallelopipedRepresentation vtkParallelopipedWidget vtkParametricBohemianDome vtkParametricBour vtkParametricBoy vtkParametricCatalanMinimal vtkParametricConicSpiral vtkParametricCrossCap vtkParametricDini vtkParametricEllipsoid vtkParametricEnneper vtkParametricFigure8Klein vtkParametricFunction vtkParametricFunctionSource vtkParametricHenneberg vtkParametricKlein vtkParametricKuen vtkParametricMobius vtkParametricPluckerConoid vtkParametricPseudosphere vtkParametricRandomHills vtkParametricRoman vtkParametricSpline vtkParametricSuperEllipsoid vtkParametricSuperToroid vtkParametricTorus vtkParticlePathFilter vtkParticleReader vtkParticleTracer vtkParticleTracerBase vtkPartitionBalancer vtkPartitionedArchiver vtkPartitionedDataSet vtkPartitionedDataSetAlgorithm vtkPartitionedDataSetCollection vtkPartitionedDataSetCollectionAlgorithm vtkPartitionedDataSetCollectionSource vtkPartitionedDataSetSource vtkPartitioningStrategy vtkPassArrays vtkPassInputTypeAlgorithm vtkPassSelectedArrays vtkPassThrough vtkPassThroughEdgeStrategy vtkPassThroughLayoutStrategy vtkPath vtkPen vtkPentagonalPrism vtkPeriodicDataArray vtkPeriodicFilter vtkPeriodicTable vtkPerlinNoise vtkPerspectiveTransform vtkPerturbCoincidentVertices vtkPhyloXMLTreeReader vtkPhyloXMLTreeWriter vtkPicker vtkPickingManager vtkPieChartActor vtkPieceRequestFilter vtkPieceScalars vtkPiecewiseControlPointsItem vtkPiecewiseFunction vtkPiecewiseFunctionAlgorithm vtkPiecewiseFunctionItem vtkPiecewiseFunctionShiftScale vtkPiecewisePointHandleItem vtkPipelineGraphSource vtkPipelineSize vtkPixel vtkPixelBufferObject vtkPixelExtent vtkPixelExtentIO vtkPixelTransfer vtkPlane vtkPlaneCollection vtkPlaneCutter vtkPlaneSource vtkPlaneWidget vtkPlanes vtkPlanesIntersection vtkPlatonicSolidSource vtkPlaybackRepresentation vtkPlaybackWidget vtkPlot vtkPlot3D vtkPlot3DMetaReader vtkPlotArea vtkPlotBag vtkPlotBar vtkPlotBarRangeHandlesItem vtkPlotBox vtkPlotFunctionalBag vtkPlotGrid vtkPlotHistogram2D vtkPlotLine vtkPlotLine3D vtkPlotParallelCoordinates vtkPlotPie vtkPlotPoints vtkPlotPoints3D vtkPlotRangeHandlesItem vtkPlotStacked vtkPlotSurface vtkPointCloudFilter vtkPointCloudRepresentation vtkPointCloudWidget vtkPointConnectivityFilter vtkPointData vtkPointDataToCellData vtkPointDensityFilter vtkPointFillPass vtkPointGaussianMapper vtkPointHandleRepresentation2D vtkPointHandleRepresentation3D vtkPointHandleSource vtkPointInterpolator vtkPointInterpolator2D vtkPointLoad vtkPointLocator vtkPointOccupancyFilter vtkPointPicker vtkPointPlacer vtkPointSet vtkPointSetAlgorithm vtkPointSetCellIterator vtkPointSetStreamer vtkPointSetToLabelHierarchy vtkPointSetToMoleculeFilter vtkPointSetToOctreeImageFilter vtkPointSmoothingFilter vtkPointSource vtkPointWidget vtkPoints vtkPoints2D vtkPointsProjectedHull vtkPoissonDiskSampler vtkPolarAxesActor vtkPolarAxesActor2D vtkPolyData vtkPolyDataAlgorithm vtkPolyDataCollection vtkPolyDataConnectivityFilter vtkPolyDataContourLineInterpolator vtkPolyDataEdgeConnectivityFilter vtkPolyDataInternals vtkPolyDataItem vtkPolyDataMapper2D vtkPolyDataMapperNode vtkPolyDataNormals vtkPolyDataPlaneClipper vtkPolyDataPlaneCutter vtkPolyDataPointPlacer vtkPolyDataPointSampler vtkPolyDataReader vtkPolyDataSilhouette vtkPolyDataSourceWidget vtkPolyDataStreamer vtkPolyDataTangents vtkPolyDataToImageStencil vtkPolyDataToReebGraphFilter vtkPolyDataToUnstructuredGrid vtkPolyDataWriter vtkPolyLine vtkPolyLineRepresentation vtkPolyLineSource vtkPolyLineWidget vtkPolyPlane vtkPolyPointSource vtkPolyVertex vtkPolygon vtkPolygonBuilder vtkPolygonalHandleRepresentation3D vtkPolygonalSurfaceContourLineInterpolator vtkPolygonalSurfacePointPlacer vtkPolyhedron vtkPolyhedronUtilities vtkPolynomialSolversUnivariate vtkPostScriptWriter vtkPostgreSQLDatabase vtkPostgreSQLDatabasePrivate vtkPostgreSQLQuery vtkPostgreSQLToTableReader vtkPriorityQueue vtkProStarReader vtkProbabilisticVoronoiKernel vtkProbeFilter vtkProbeLineFilter vtkProbePolyhedron vtkProbeSelectedLocations vtkProcess vtkProcessGroup vtkProcessIdScalars vtkProcrustesAlignmentFilter vtkProgrammableAttributeDataFilter vtkProgrammableDataObjectSource vtkProgrammableElectronicData vtkProgrammableFilter vtkProgrammableGlyphFilter vtkProgrammableSource vtkProgressBarRepresentation vtkProgressBarWidget vtkProgressObserver vtkProjectPointsToPlane vtkProjectSphereFilter vtkProjectedTerrainPath vtkProjectedTetrahedraMapper vtkProjectedTexture vtkProp vtkProp3D vtkProp3DAxisFollower vtkProp3DButtonRepresentation vtkProp3DCollection vtkProp3DFollower vtkPropAssembly vtkPropCollection vtkPropItem vtkPropPicker vtkProperty vtkProperty2D vtkProteinRibbonFilter vtkPruneTreeFilter vtkPyramid vtkPythonAlgorithm vtkPythonArchiver vtkPythonItem vtkQImageToImageSource vtkQWidgetRepresentation vtkQWidgetTexture vtkQWidgetWidget vtkQtAbstractModelAdapter vtkQtAnnotationLayersModelAdapter vtkQtAnnotationView vtkQtConnection vtkQtDebugLeaksModel vtkQtDebugLeaksView vtkQtInitialization vtkQtLabelRenderStrategy vtkQtListView vtkQtRecordView vtkQtSQLDatabase vtkQtSQLQuery vtkQtStringToImage vtkQtTableModelAdapter vtkQtTableRepresentation vtkQtTableView vtkQtTimePointUtility vtkQtTreeModelAdapter vtkQtTreeRingLabelMapper vtkQtTreeView vtkQtView vtkQuad vtkQuadRotationalExtrusionFilter vtkQuadraticEdge vtkQuadraticHexahedron vtkQuadraticLinearQuad vtkQuadraticLinearWedge vtkQuadraticPolygon vtkQuadraticPyramid vtkQuadraticQuad vtkQuadraticTetra vtkQuadraticTriangle vtkQuadraticWedge vtkQuadraturePointInterpolator vtkQuadraturePointsGenerator vtkQuadratureSchemeDefinition vtkQuadratureSchemeDictionaryGenerator vtkQuadric vtkQuadricClustering vtkQuadricDecimation vtkQuadricLODActor vtkQuantizePolyDataPoints vtkQuaternion vtkQuaternionInterpolator vtkQuaterniond vtkQuaternionf vtkRIBExporter vtkRIBLight vtkRIBProperty vtkRISReader vtkROIStencilSource vtkRTAnalyticSource vtkRTXMLPolyDataReader vtkRadialGridActor2D vtkRadiusOutlierRemoval vtkRandomAttributeGenerator vtkRandomGraphSource vtkRandomHyperTreeGridSource vtkRandomLayoutStrategy vtkRandomPool vtkRandomSequence vtkRangeHandlesItem vtkRasterReprojectionFilter vtkRayCastImageDisplayHelper vtkRayCastStructures vtkReaderAlgorithm vtkRearrangeFields vtkRecoverGeometryWireframe vtkRect vtkRectangularButtonSource vtkRectd vtkRectf vtkRecti vtkRectilinearGrid vtkRectilinearGridAlgorithm vtkRectilinearGridClip vtkRectilinearGridGeometryFilter vtkRectilinearGridOutlineFilter vtkRectilinearGridPartitioner vtkRectilinearGridReader vtkRectilinearGridToPointSet vtkRectilinearGridToTetrahedra vtkRectilinearGridWriter vtkRectilinearSynchronizedTemplates vtkRectilinearWipeRepresentation vtkRectilinearWipeWidget vtkRecursiveDividingCubes vtkRecursiveSphereDirectionEncoder vtkRedistributeDataSetFilter vtkReduceTable vtkReebGraph vtkReebGraphSimplificationFilter vtkReebGraphSimplificationMetric vtkReebGraphSurfaceSkeletonFilter vtkReebGraphToJoinSplitTreeFilter vtkReebGraphVolumeSkeletonFilter vtkReferenceCount vtkReflectionFilter vtkRegularPolygonSource vtkRemoteInteractionAdapter vtkRemoveDuplicatePolys vtkRemoveGhosts vtkRemoveHiddenData vtkRemoveIsolatedVertices vtkRemovePolyData vtkRemoveUnusedPoints vtkRenderLargeImage vtkRenderPass vtkRenderPassCollection vtkRenderState vtkRenderStepsPass vtkRenderTimerLog vtkRenderView vtkRenderViewBase vtkRenderWidget vtkRenderWindowCollection vtkRenderWindowInteractor3D vtkRenderbuffer vtkRenderedAreaPicker vtkRenderedGraphRepresentation vtkRenderedHierarchyRepresentation vtkRenderedRepresentation vtkRenderedSurfaceRepresentation vtkRenderedTreeAreaRepresentation vtkRendererCollection vtkRendererDelegate vtkRendererNode vtkRendererSource vtkRenderingCellGrid vtkResampleToImage vtkResampleWithDataSet vtkReservoirSampler vtkReservoirSamplerBase vtkResizingWindowToImageFilter vtkResliceCursor vtkResliceCursorActor vtkResliceCursorLineRepresentation vtkResliceCursorPicker vtkResliceCursorPolyDataAlgorithm vtkResliceCursorRepresentation vtkResliceCursorThickLineRepresentation vtkResliceCursorWidget vtkResliceImageViewer vtkResliceImageViewerMeasurements vtkResourceFileLocator vtkResourceParser vtkResourceStream vtkReverseSense vtkRibbonFilter vtkRotationFilter vtkRotationalExtrusionFilter vtkRowQuery vtkRowQueryToTable vtkRuledSurfaceFilter vtkRungeKutta2 vtkRungeKutta4 vtkRungeKutta45 vtkSCurveSpline vtkSDL2OpenGL2RenderWindow vtkSDL2OpenGLRenderWindow vtkSDL2RenderWindowInteractor vtkSDL2WebGPURenderWindow vtkSEPReader vtkSILBuilder vtkSLACParticleReader vtkSLACReader vtkSLCReader vtkSMPContourGrid vtkSMPMergePoints vtkSMPMergePolyDataHelper vtkSMPProgressObserver vtkSMPThreadLocal vtkSMPThreadLocalAPI vtkSMPThreadLocalImpl vtkSMPThreadLocalImplAbstract vtkSMPThreadLocalObject vtkSMPThreadPool vtkSMPTools vtkSMPToolsAPI vtkSMPToolsAPIInitialize vtkSMPToolsImpl vtkSOADataArrayTemplate vtkSPHCubicKernel vtkSPHInterpolator vtkSPHKernel vtkSPHQuarticKernel vtkSPHQuinticKernel vtkSQLDatabase vtkSQLDatabaseGraphSource vtkSQLDatabaseSchema vtkSQLDatabaseTableSource vtkSQLGraphReader vtkSQLQuery vtkSQLiteDatabase vtkSQLiteDatabaseInternals vtkSQLiteQuery vtkSQLiteToTableReader vtkSSAAPass vtkSSAOPass vtkSTLReader vtkSTLWriter vtkSVGContextDevice2D vtkSVGExporter vtkSampleFunction vtkSampleImplicitFunctionFilter vtkScalarBarActor vtkScalarBarActorInternal vtkScalarBarRepresentation vtkScalarBarWidget vtkScalarTree vtkScalarsToColors vtkScalarsToColorsItem vtkScalarsToTextureFilter vtkScaledSOADataArrayTemplate vtkScaledTextActor vtkScatterPlotMatrix vtkScenePicker vtkSectorSource vtkSeedRepresentation vtkSeedWidget vtkSegYBinaryHeaderBytesPositions vtkSegYIOUtils vtkSegYReader vtkSegYReaderInternal vtkSegYTrace vtkSegYTraceHeaderBytesPositions vtkSegYTraceReader vtkSelectEnclosedPoints vtkSelectPolyData vtkSelectVisiblePoints vtkSelection vtkSelectionAlgorithm vtkSelectionNode vtkSelectionSource vtkSelector vtkSequencePass vtkSerializer vtkServerSocket vtkShader vtkShaderProgram vtkShaderProperty vtkShadowMapBakerPass vtkShadowMapPass vtkSharedFuture vtkSharedFutureBase vtkShepardKernel vtkShepardMethod vtkShortArray vtkShrinkFilter vtkShrinkPolyData vtkSignedCharArray vtkSignedDistance vtkSimple2DLayoutStrategy vtkSimple3DCirclesStrategy vtkSimpleBondPerceiver vtkSimpleCellTessellator vtkSimpleElevationFilter vtkSimpleImageToImageFilter vtkSimpleMotionBlurPass vtkSimplePointsReader vtkSimplePointsWriter vtkSimpleReader vtkSimpleScalarTree vtkSingleVTPExporter vtkSkybox vtkSliceAndDiceLayoutStrategy vtkSliceCubes vtkSliderRepresentation vtkSliderRepresentation2D vtkSliderRepresentation3D vtkSliderWidget vtkSmartPointer vtkSmartPointerBase vtkSmartVector vtkSmartVolumeMapper vtkSmoothErrorMetric vtkSmoothPolyDataFilter vtkSobelGradientMagnitudePass vtkSocket vtkSocketCollection vtkSocketCommunicator vtkSocketController vtkSortDataArray vtkSortFieldData vtkSortFileNames vtkSpanSpace vtkSpanTreeLayoutStrategy vtkSparseArray vtkSparseArrayToTable vtkSpatialRepresentationFilter vtkSpatioTemporalHarmonicsAttribute vtkSpatioTemporalHarmonicsSource vtkSphere vtkSphereHandleRepresentation vtkSpherePuzzle vtkSpherePuzzleArrows vtkSphereRepresentation vtkSphereSource vtkSphereTree vtkSphereTreeFilter vtkSphereWidget vtkSphereWidget2 vtkSpheres vtkSphericalDirectionEncoder vtkSphericalHarmonics vtkSphericalPointIterator vtkSphericalTransform vtkSpiderPlotActor vtkSpline vtkSplineFilter vtkSplineGraphEdges vtkSplineRepresentation vtkSplineWidget vtkSplineWidget2 vtkSplitByCellScalarFilter vtkSplitColumnComponents vtkSplitField vtkSplitSharpEdgesPolyData vtkSquarifyLayoutStrategy vtkStackedTreeLayoutStrategy vtkStateStorage vtkStaticCellLinks vtkStaticCellLinksTemplate vtkStaticCellLocator vtkStaticCleanPolyData vtkStaticCleanUnstructuredGrid vtkStaticCompositeSource vtkStaticDataSource vtkStaticEdgeLocatorTemplate vtkStaticFaceHashLinksTemplate vtkStaticPointLocator vtkStaticPointLocator2D vtkStatisticalOutlierRemoval vtkStatisticsAlgorithm vtkStatisticsAlgorithmPrivate vtkStdString vtkStereoCompositor vtkStitchImageDataWithGhosts vtkStrahlerMetric vtkStreaklineFilter vtkStreamGraph vtkStreamSurface vtkStreamTracer vtkStreamerBase vtkStreamingDemandDrivenPipeline vtkStreamingStatistics vtkStreamingTessellator vtkStringArray vtkStringOutputWindow vtkStringToCategory vtkStringToImage vtkStringToNumeric vtkStringToken vtkStripper vtkStructuredAMRGridConnectivity vtkStructuredAMRNeighbor vtkStructuredCellArray vtkStructuredData vtkStructuredDataPlaneCutter vtkStructuredExtent vtkStructuredGrid vtkStructuredGridAlgorithm vtkStructuredGridAppend vtkStructuredGridClip vtkStructuredGridConnectivity vtkStructuredGridGeometryFilter vtkStructuredGridLIC2D vtkStructuredGridOutlineFilter vtkStructuredGridPartitioner vtkStructuredGridReader vtkStructuredGridWriter vtkStructuredImplicitConnectivity vtkStructuredNeighbor vtkStructuredPointArray vtkStructuredPointBackend vtkStructuredPoints vtkStructuredPointsCollection vtkStructuredPointsGeometryFilter vtkStructuredPointsReader vtkStructuredPointsWriter vtkStructuredTPointBackend vtkSubCommunicator vtkSubGroup vtkSubPixelPositionEdgels vtkSubdivideTetra vtkSubdivisionFilter vtkSuperquadric vtkSuperquadricSource vtkSurfaceLICComposite vtkSurfaceLICHelper vtkSurfaceLICInterface vtkSurfaceLICMapper vtkSurfaceNets2D vtkSurfaceNets3D vtkSurfaceReconstructionFilter vtkSynchronizeTimeFilter vtkSynchronizedRenderWindows vtkSynchronizedRenderers vtkSynchronizedTemplates2D vtkSynchronizedTemplates3D vtkSynchronizedTemplatesCutter3D vtkSystemIncludes vtkTDxInteractorStyle vtkTDxInteractorStyleCamera vtkTDxInteractorStyleSettings vtkTDxMotionEventInfo vtkTDxQtUnixDevices vtkTGAReader vtkTIFFReader vtkTIFFReaderInternal vtkTIFFWriter vtkTRUCHASReader vtkTable vtkTableAlgorithm vtkTableBasedClipCases vtkTableBasedClipDataSet vtkTableFFT vtkTableReader vtkTableToArray vtkTableToDatabaseWriter vtkTableToGraph vtkTableToMySQLWriter vtkTableToPolyData vtkTableToPostgreSQLWriter vtkTableToSQLiteWriter vtkTableToSparseArray vtkTableToStructuredGrid vtkTableToTreeFilter vtkTableWriter vtkTanglegramItem vtkTclCommand vtkTecplotReader vtkTecplotTableReader vtkTemplateAliasMacro vtkTemporalAlgorithm vtkTemporalArrayOperatorFilter vtkTemporalDataSetCache vtkTemporalDelimitedTextReader vtkTemporalFractal vtkTemporalInterpolatedVelocityField vtkTemporalInterpolator vtkTemporalPathLineFilter vtkTemporalShiftScale vtkTemporalSnapToTimeStep vtkTemporalStatistics vtkTensorGlyph vtkTensorPrincipalInvariants vtkTensorProbeRepresentation vtkTensorProbeWidget vtkTensorRepresentation vtkTensorWidget vtkTerrainContourLineInterpolator vtkTerrainDataPointPlacer vtkTessellatedBoxSource vtkTessellatorFilter vtkTestDataArray vtkTestNewVar vtkTetra vtkTextActor vtkTextActor3D vtkTextCodec vtkTextCodecFactory vtkTextMapper vtkTextProperty vtkTextPropertyCollection vtkTextRenderer vtkTextRendererCleanup vtkTextRendererStringToImage vtkTextRepresentation vtkTextSource vtkTextWidget vtkTexture vtkTextureIO vtkTextureImageCache vtkTextureMapToCylinder vtkTextureMapToPlane vtkTextureMapToSphere vtkTextureObject vtkTextureUnitManager vtkTexturedActor2D vtkTexturedButtonRepresentation vtkTexturedButtonRepresentation2D vtkTexturedSphereSource vtkThinPlateSplineTransform vtkThreadedCallbackQueue vtkThreadedCompositeDataPipeline vtkThreadedImageAlgorithm vtkThreadedImageWriter vtkThreadedTaskQueue vtkThreshold vtkThresholdGraph vtkThresholdPoints vtkThresholdTable vtkThresholdTextureCoords vtkTimeInformation vtkTimePointUtility vtkTimeRange vtkTimeSource vtkTimeSourceExample vtkTimeStamp vtkTimerLog vtkTimerLogCleanup vtkTimerLogScope vtkToAffineArrayStrategy vtkToConstantArrayStrategy vtkToImplicitArrayFilter vtkToImplicitRamerDouglasPeuckerStrategy vtkToImplicitStrategy vtkToImplicitTypeErasureStrategy vtkToneMappingPass vtkTooltipItem vtkTransferAttributes vtkTransform vtkTransform2D vtkTransformCollection vtkTransformConcatenation vtkTransformConcatenationStack vtkTransformCoordinateSystems vtkTransformFeedback vtkTransformFilter vtkTransformInterpolator vtkTransformPair vtkTransformPolyDataFilter vtkTransformTextureCoords vtkTransformToGrid vtkTranslucentPass vtkTransmitImageDataPiece vtkTransmitPolyDataPiece vtkTransmitRectilinearGridPiece vtkTransmitStructuredDataPiece vtkTransmitStructuredGridPiece vtkTransmitUnstructuredGridPiece vtkTransposeMatrix vtkTransposeTable vtkTree vtkTreeAlgorithm vtkTreeAreaView vtkTreeBFSIterator vtkTreeCompositer vtkTreeDFSIterator vtkTreeDifferenceFilter vtkTreeFieldAggregator vtkTreeHeatmapItem vtkTreeIterator vtkTreeLayoutStrategy vtkTreeLevelsFilter vtkTreeMapLayout vtkTreeMapLayoutStrategy vtkTreeMapToPolyData vtkTreeMapView vtkTreeOrbitLayoutStrategy vtkTreeReader vtkTreeRingToPolyData vtkTreeRingView vtkTreeWriter vtkTriQuadraticHexahedron vtkTriQuadraticPyramid vtkTriangle vtkTriangleFilter vtkTriangleMeshPointNormals vtkTriangleStrip vtkTriangularTCoords vtkTriangularTexture vtkTrimmedExtrusionFilter vtkTrivialConsumer vtkTrivialProducer vtkTryDowncastHelper1 vtkTryDowncastHelper2 vtkTryDowncastHelper3 vtkTubeBender vtkTubeFilter vtkTulipReader vtkTuple vtkTupleInterpolator vtkTypeList vtkTypedArray vtkTypedDataArray vtkTypedDataArrayIterator vtkURI vtkURIComponent vtkURILoader vtkUTF16TextCodec vtkUTF8TextCodec vtkUncertaintyTubeFilter vtkUndirectedGraph vtkUndirectedGraphAlgorithm vtkUniformGrid vtkUniformGridAMR vtkUniformGridAMRAlgorithm vtkUniformGridAMRDataIterator vtkUniformGridPartitioner vtkUniformHyperTreeGrid vtkUniformHyperTreeGridSource vtkUniforms vtkUnsignedCharArray vtkUnsignedDistance vtkUnsignedIntArray vtkUnsignedLongArray vtkUnsignedLongLongArray vtkUnsignedShortArray vtkUnstructuredGrid vtkUnstructuredGridAlgorithm vtkUnstructuredGridBase vtkUnstructuredGridBaseAlgorithm vtkUnstructuredGridBunykRayCastFunction vtkUnstructuredGridCellIterator vtkUnstructuredGridGeometryFilter vtkUnstructuredGridHomogeneousRayIntegrator vtkUnstructuredGridLinearRayIntegrator vtkUnstructuredGridPartialPreIntegration vtkUnstructuredGridPreIntegration vtkUnstructuredGridQuadricDecimation vtkUnstructuredGridReader vtkUnstructuredGridToCellGrid vtkUnstructuredGridToExplicitStructuredGrid vtkUnstructuredGridToReebGraphFilter vtkUnstructuredGridVolumeMapper vtkUnstructuredGridVolumeRayCastFunction vtkUnstructuredGridVolumeRayCastIterator vtkUnstructuredGridVolumeRayCastMapper vtkUnstructuredGridVolumeRayIntegrator vtkUnstructuredGridVolumeZSweepMapper vtkUnstructuredGridWriter vtkUpdateCellsV8toV9 vtkVASPAnimationReader vtkVASPTessellationReader vtkVPICReader vtkVRCamera vtkVRCollaborationClient vtkVRControlsHelper vtkVRFollower vtkVRHMDCamera vtkVRHardwarePicker vtkVRInteractorStyle vtkVRMLExporter vtkVRMLImporter vtkVRMLUseStruct vtkVRMLYaccData vtkVRMenuRepresentation vtkVRMenuWidget vtkVRModel vtkVRPanelRepresentation vtkVRPanelWidget vtkVRRay vtkVRRenderWindow vtkVRRenderWindowInteractor vtkVRRenderer vtkValuePass vtkValueSelector vtkVariant vtkVariantArray vtkVariantBoostSerialization vtkVariantCast vtkVariantCreate vtkVariantExtract vtkVector vtkVector2 vtkVector2d vtkVector2f vtkVector2i vtkVector3 vtkVector3d vtkVector3f vtkVector3i vtkVector4 vtkVector4d vtkVector4i vtkVectorDot vtkVectorFieldTopology vtkVectorNorm vtkVectorText vtkVeraOutReader vtkVersion vtkVertex vtkVertexAdjacencyList vtkVertexDegree vtkVertexGlyphFilter vtkVertexListIterator vtkVideoSource vtkView vtkViewDependentErrorMetric vtkViewNode vtkViewNodeFactory vtkViewTheme vtkViewUpdater vtkViewport vtkVisibilitySort vtkVoidArray vtkVolume vtkVolume16Reader vtkVolumeCollection vtkVolumeContourSpectrumFilter vtkVolumeInputHelper vtkVolumeMapper vtkVolumeMapperNode vtkVolumeMask vtkVolumeNode vtkVolumeOfRevolutionFilter vtkVolumeOutlineSource vtkVolumePicker vtkVolumeProperty vtkVolumeRayCastSpaceLeapingImageFilter vtkVolumeReader vtkVolumeStateRAII vtkVolumeTexture vtkVolumetricPass vtkVoronoi2D vtkVoronoiKernel vtkVortexCore vtkVoxel vtkVoxelContoursToSurfaceFilter vtkVoxelGrid vtkVoxelModeller vtkVtkJSSceneGraphSerializer vtkVtkJSViewNodeFactory vtkWGPUContext vtkWarpLens vtkWarpScalar vtkWarpTo vtkWarpTransform vtkWarpVector vtkWasmSceneManager vtkWeakPointer vtkWeakPointerBase vtkWeakReference vtkWebApplication vtkWebAssemblyRenderWindowInteractor vtkWebGLDataSet vtkWebGLExporter vtkWebGLObject vtkWebGLPolyData vtkWebGLWidget vtkWebGPUActor vtkWebGPUCamera vtkWebGPUClearPass vtkWebGPUHardwareSelector vtkWebGPUInternalsBindGroup vtkWebGPUInternalsBindGroupLayout vtkWebGPUInternalsBuffer vtkWebGPUInternalsPipelineLayout vtkWebGPUInternalsRenderPassCreateInfo vtkWebGPUInternalsRenderPassDescriptor vtkWebGPUInternalsRenderPipelineDescriptor vtkWebGPUInternalsShaderModule vtkWebGPULight vtkWebGPUPolyDataMapper vtkWebGPUProperty vtkWebGPURenderPass vtkWebGPURenderWindow vtkWebGPURenderer vtkWebInteractionEvent vtkWebUtilities vtkWedge vtkWeightedTransformFilter vtkWendlandQuinticKernel vtkWidgetCallbackMapper vtkWidgetEvent vtkWidgetEventTranslator vtkWidgetRepresentation vtkWidgetSet vtkWin32HardwareWindow vtkWin32Header vtkWin32OpenGL2RenderWindow vtkWin32OpenGLDXRenderWindow vtkWin32OpenGLRenderWindow vtkWin32OutputWindow vtkWin32ProcessOutputWindow vtkWin32RenderWindowInteractor vtkWin32VideoSource vtkWindBladeReader vtkWindow vtkWindowLevelLookupTable vtkWindowNode vtkWindowToImageFilter vtkWindowedSincPolyDataFilter vtkWordCloud vtkWorldPointPicker vtkWrappingHints vtkWriter vtkX3DExporter vtkX3DExporterFIWriter vtkX3DExporterFIWriterHelper vtkX3DExporterWriter vtkX3DExporterXMLWriter vtkXGMLReader vtkXMLCompositeDataReader vtkXMLCompositeDataSetWriterHelper vtkXMLCompositeDataWriter vtkXMLDataElement vtkXMLDataHeader vtkXMLDataHeaderImpl vtkXMLDataObjectWriter vtkXMLDataParser vtkXMLDataReader vtkXMLDataSetWriter vtkXMLDataWriterHelper vtkXMLFileOutputWindow vtkXMLFileReadTester vtkXMLGenericDataObjectReader vtkXMLHierarchicalBoxDataFileConverter vtkXMLHierarchicalBoxDataReader vtkXMLHierarchicalBoxDataWriter vtkXMLHierarchicalDataReader vtkXMLHyperTreeGridReader vtkXMLHyperTreeGridWriter vtkXMLImageDataReader vtkXMLImageDataWriter vtkXMLMultiBlockDataReader vtkXMLMultiBlockDataWriter vtkXMLMultiGroupDataReader vtkXMLPDataObjectReader vtkXMLPDataObjectWriter vtkXMLPDataReader vtkXMLPDataSetWriter vtkXMLPDataWriter vtkXMLPHierarchicalBoxDataWriter vtkXMLPHyperTreeGridReader vtkXMLPHyperTreeGridWriter vtkXMLPImageDataReader vtkXMLPImageDataWriter vtkXMLPMultiBlockDataWriter vtkXMLPPolyDataReader vtkXMLPPolyDataWriter vtkXMLPRectilinearGridReader vtkXMLPRectilinearGridWriter vtkXMLPStructuredDataReader vtkXMLPStructuredDataWriter vtkXMLPStructuredGridReader vtkXMLPStructuredGridWriter vtkXMLPTableReader vtkXMLPTableWriter vtkXMLPUniformGridAMRWriter vtkXMLPUnstructuredDataReader vtkXMLPUnstructuredDataWriter vtkXMLPUnstructuredGridReader vtkXMLPUnstructuredGridWriter vtkXMLParser vtkXMLPartitionedDataSetCollectionReader vtkXMLPartitionedDataSetCollectionWriter vtkXMLPartitionedDataSetReader vtkXMLPartitionedDataSetWriter vtkXMLPolyDataReader vtkXMLPolyDataWriter vtkXMLReader vtkXMLReaderVersion vtkXMLRectilinearGridReader vtkXMLRectilinearGridWriter vtkXMLStructuredDataReader vtkXMLStructuredDataWriter vtkXMLStructuredGridReader vtkXMLStructuredGridWriter vtkXMLTableReader vtkXMLTableWriter vtkXMLTreeReader vtkXMLUniformGridAMRReader vtkXMLUniformGridAMRWriter vtkXMLUnstructuredDataReader vtkXMLUnstructuredDataWriter vtkXMLUnstructuredGridReader vtkXMLUnstructuredGridWriter vtkXMLUtilities vtkXMLWriter vtkXMLWriter2 vtkXMLWriterBase vtkXOpenGLRenderWindow vtkXRenderWindowInteractor vtkXWebGPURenderWindow vtkXYPlotActor vtkXYPlotRepresentation vtkXYPlotWidget vtkXYZMolReader vtkXYZMolReader2 vtkXdmf3ArrayKeeper vtkXdmf3ArraySelection vtkXdmf3DataSet vtkXdmf3HeavyDataHandler vtkXdmf3LightDataHandler vtkXdmf3Reader vtkXdmf3SILBuilder vtkXdmf3Writer vtkXdmfArraySelection vtkXdmfDataArray vtkXdmfDocument vtkXdmfDomain vtkXdmfHeavyData vtkXdmfReader vtkXdmfReaderInternal vtkXdmfWriter vtkYieldCriteria vtkYoungsMaterialInterface vtkZLibDataCompressor vtkZSpaceCamera vtkZSpaceCoreCompatibilitySDKManager vtkZSpaceCoreSDKManager vtkZSpaceGenericRenderWindow vtkZSpaceHardwarePicker vtkZSpaceInteractorStyle vtkZSpaceRayActor vtkZSpaceRenderWindowInteractor vtkZSpaceRenderer vtkZSpaceSDKManager vtkZSpaceWin32RenderWindow vtkmAverageToCells vtkmAverageToPoints vtkmCleanGrid vtkmClip vtkmContour vtkmCoordinateSystemTransform vtkmDataArray vtkmDataSet vtkmExternalFaces vtkmExtractVOI vtkmFilterOverrides vtkmGradient vtkmHistogram vtkmImageConnectivity vtkmLevelOfDetail vtkmNDHistogram vtkmPointElevation vtkmPointTransform vtkmPolyDataNormals vtkmProbe vtkmSlice vtkmThreshold vtkmTriangleMeshPointNormals vtkmWarpScalar vtkmWarpVector"},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesUsed/","title":"VTK Classes used in the Examples","text":""},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesUsed/#pythonicapi","title":"PythonicAPI","text":"

        Out of 3113 available VTK classes, 7 are demonstrated here.

        "},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesUsed/#excluded-classes","title":"Excluded classes","text":"

        These classes are excluded since they occur in the majority of the examples:

        VTK Class VTK Class VTK Class vtkActor vtkCamera vtkNamedColors vtkPolyDataMapper vtkProperty vtkRenderer vtkRenderWindow vtkRenderWindowInteractor"},{"location":"PythonicAPI/Coverage/PythonicAPIVTKClassesUsed/#classes-used","title":"Classes used","text":"VTK Class Examples vtkCylinderSource CylinderExample"},{"location":"PythonicAPI/GeometricObjects/CylinderExample/","title":"CylinderExample","text":"

        vtk-examples/PythonicAPI/GeometricObjects/CylinderExample

        "},{"location":"PythonicAPI/GeometricObjects/CylinderExample/#description","title":"Description","text":"

        This example creates a minimal visualization program, demonstrating VTK's basic rendering and pipeline creation.

        Note

        This original C++ source code for this example is here.

        Note

        The code here has not been updated yet to use the new improved VTK Python Interface.

        Other languages

        See (Cxx), (Python), (Java)

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"PythonicAPI/GeometricObjects/CylinderExample/#code","title":"Code","text":"

        CylinderExample.py

        #!/usr/bin/env python\n\n# This simple example shows how to do basic rendering and pipeline\n# creation.\n\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkInteractionStyle\n# noinspection PyUnresolvedReferences\nimport vtkmodules.vtkRenderingOpenGL2\nfrom vtkmodules.vtkCommonColor import vtkNamedColors\nfrom vtkmodules.vtkFiltersSources import vtkCylinderSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkPolyDataMapper,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkRenderer\n)\n\n\ndef main():\n    colors = vtkNamedColors()\n    # Set the background color.\n    bkg = map(lambda x: x / 255.0, [26, 51, 102, 255])\n    colors.SetColor(\"BkgColor\", *bkg)\n\n    # This creates a polygonal cylinder model with eight circumferential\n    # facets.\n    cylinder = vtkCylinderSource()\n    cylinder.SetResolution(8)\n\n    # The mapper is responsible for pushing the geometry into the graphics\n    # library. It may also do color mapping, if scalars or other\n    # attributes are defined.\n    cylinderMapper = vtkPolyDataMapper()\n    cylinderMapper.SetInputConnection(cylinder.GetOutputPort())\n\n    # The actor is a grouping mechanism: besides the geometry (mapper), it\n    # also has a property, transformation matrix, and/or texture map.\n    # Here we set its color and rotate it -22.5 degrees.\n    cylinderActor = vtkActor()\n    cylinderActor.SetMapper(cylinderMapper)\n    cylinderActor.GetProperty().SetColor(colors.GetColor3d(\"Tomato\"))\n    cylinderActor.RotateX(30.0)\n    cylinderActor.RotateY(-45.0)\n\n    # Create the graphics structure. The renderer renders into the render\n    # window. The render window interactor captures mouse events and will\n    # perform appropriate camera or actor manipulation depending on the\n    # nature of the events.\n    ren = vtkRenderer()\n    renWin = vtkRenderWindow()\n    renWin.AddRenderer(ren)\n    iren = vtkRenderWindowInteractor()\n    iren.SetRenderWindow(renWin)\n\n    # Add the actors to the renderer, set the background and size\n    ren.AddActor(cylinderActor)\n    ren.SetBackground(colors.GetColor3d(\"BkgColor\"))\n    renWin.SetSize(300, 300)\n    renWin.SetWindowName('CylinderExample')\n\n    # This allows the interactor to initalize itself. It has to be\n    # called before an event loop.\n    iren.Initialize()\n\n    # We'll zoom in a little by accessing the camera and invoking a \"Zoom\"\n    # method on it.\n    ren.ResetCamera()\n    ren.GetActiveCamera().Zoom(1.5)\n    renWin.Render()\n\n    # Start the event loop.\n    iren.Start()\n\n\nif __name__ == '__main__':\n    main()\n
        "},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/","title":"FiniteElementAnalysis","text":"

        vtk-examples/Trame/Applications/FiniteElementAnalysis

        "},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#description","title":"Description","text":"

        This example is a translation from a dash-vtk code described in that repository using trame.

        In trame we are exposing 3 approaches:

        • client view: This application simulate what dash-vtk is doing by defining the 3D scene in plain HTML structure.
        • remote/local view: Those applications focus on the VTK/Python part by creating and configuring your vtkRenderWindow directly and letting the VtkRemoteView or VtkLocalView do their job of presenting it on the client side. In the case of the VtkRemoteView, the rendering is happening on the server side and images are sent to the client. For the VtkLocalView use case, the geometry is sent instead and the client is doing the rendering using vtk.js under the cover.

        The data files can be found here in the original project.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#download-and-build-finiteelementanalysis","title":"Download and Build FiniteElementAnalysis","text":"

        Click here to download FiniteElementAnalysis. Once the tarball FiniteElementAnalysis.tar has been downloaded and extracted,

        cd FiniteElementAnalysis\n

        and run the application.

        See this trame tutorial for instructions on how to setup trame and run the application.

        "},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#code","title":"Code","text":""},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#app_local_viewpy","title":"app_local_view.py","text":"
        \"\"\"\nVersion for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/VTK/Applications/FiniteElementAnalysis/app_local_view.py\nDelta v1..v2          - https://github.com/Kitware/trame/commit/03f28bb0084490acabf218264b96a1dbb3a17f19\n\"\"\"\n\nimport os\nimport io\nimport numpy as np\nimport pandas as pd\n\nfrom vtkmodules.vtkCommonCore import vtkPoints, vtkIdList, vtkLookupTable\nfrom vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid, vtkCellArray\nfrom vtkmodules.vtkFiltersCore import vtkThreshold\n\nfrom vtkmodules.numpy_interface.dataset_adapter import numpyTovtkDataArray as np2da\nfrom vtkmodules.util import vtkConstants\n\n# Add import for the rendering\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch  # noqa\nimport vtkmodules.vtkRenderingOpenGL2  # noqa\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n)\n\nfrom trame.app import get_server\nfrom trame.ui.vuetify import SinglePageLayout\nfrom trame.widgets import vuetify, vtk\n\n# -----------------------------------------------------------------------------\n# Trame setup\n# -----------------------------------------------------------------------------\n\nserver = get_server()\nstate, ctrl = server.state, server.controller\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nvtk_idlist = vtkIdList()\nvtk_grid = vtkUnstructuredGrid()\nvtk_filter = vtkThreshold()\nvtk_filter.SetInputData(vtk_grid)\nfield_to_keep = \"my_array\"\n\nrenderer = vtkRenderer()\nrenderer.SetBackground(0.8, 0.8, 0.8)\nrenderWindow = vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n\nrenderWindowInteractor = vtkRenderWindowInteractor()\nrenderWindowInteractor.SetRenderWindow(renderWindow)\nrenderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\nfilter_mapper = vtkDataSetMapper()\nfilter_mapper.SetInputConnection(vtk_filter.GetOutputPort())\nfilter_actor = vtkActor()\nfilter_actor.SetMapper(filter_mapper)\nrenderer.AddActor(filter_actor)\n\nlut = vtkLookupTable()\nlut.SetHueRange(0.667, 0)\nlut.Build()\nfilter_mapper.SetLookupTable(lut)\n\nmesh_mapper = vtkDataSetMapper()\nmesh_mapper.SetInputData(vtk_grid)\nmesh_mapper.SetScalarVisibility(0)\nmesh_actor = vtkActor()\nmesh_actor.SetMapper(mesh_mapper)\nrenderer.AddActor(mesh_actor)\n\n\n@state.change(\"nodes_file\", \"elems_file\", \"field_file\")\ndef update_grid(nodes_file, elems_file, field_file, **kwargs):\n    if not nodes_file:\n        return\n\n    if not elems_file:\n        return\n\n    nodes_bytes = nodes_file.get(\"content\")\n    elems_bytes = elems_file.get(\"content\")\n\n    df_nodes = pd.read_csv(\n        io.StringIO(nodes_bytes.decode(\"utf-8\")),\n        delim_whitespace=True,\n        header=None,\n        skiprows=1,\n        names=[\"id\", \"x\", \"y\", \"z\"],\n    )\n\n    df_nodes[\"id\"] = df_nodes[\"id\"].astype(int)\n    df_nodes = df_nodes.set_index(\"id\", drop=True)\n    # fill missing ids in range as VTK uses position (index) to map cells to points\n    df_nodes = df_nodes.reindex(\n        np.arange(df_nodes.index.min(), df_nodes.index.max() + 1), fill_value=0\n    )\n\n    df_elems = pd.read_csv(\n        io.StringIO(elems_bytes.decode(\"utf-8\")),\n        skiprows=1,\n        header=None,\n        delim_whitespace=True,\n        engine=\"python\",\n        index_col=None,\n    ).sort_values(0)\n    # order: 0: eid, 1: eshape, 2+: nodes, iloc[:,0] is index\n    df_elems.iloc[:, 0] = df_elems.iloc[:, 0].astype(int)\n\n    n_nodes = df_elems.iloc[:, 1].map(\n        lambda x: int(\"\".join(i for i in x if i.isdigit()))\n    )\n    df_elems.insert(2, \"n_nodes\", n_nodes)\n    # fill missing ids in range as VTK uses position (index) to map data to cells\n    new_range = np.arange(df_elems.iloc[:, 0].min(), df_elems.iloc[:, 0].max() + 1)\n    df_elems = df_elems.set_index(0, drop=False).reindex(new_range, fill_value=0)\n\n    # mapping specific to Ansys Mechanical data\n    vtk_shape_id_map = {\n        \"Tet4\": vtkConstants.VTK_TETRA,\n        \"Tet10\": vtkConstants.VTK_QUADRATIC_TETRA,\n        \"Hex8\": vtkConstants.VTK_HEXAHEDRON,\n        \"Hex20\": vtkConstants.VTK_QUADRATIC_HEXAHEDRON,\n        \"Tri6\": vtkConstants.VTK_QUADRATIC_TRIANGLE,\n        \"Quad8\": vtkConstants.VTK_QUADRATIC_QUAD,\n        \"Tri3\": vtkConstants.VTK_TRIANGLE,\n        \"Quad4\": vtkConstants.VTK_QUAD,\n        \"Wed15\": vtkConstants.VTK_QUADRATIC_WEDGE,\n    }\n    df_elems[\"cell_types\"] = np.nan\n    df_elems.loc[df_elems.loc[:, 0] > 0, \"cell_types\"] = df_elems.loc[\n        df_elems.loc[:, 0] > 0, 1\n    ].map(\n        lambda x: vtk_shape_id_map[x.strip()]\n        if x.strip() in vtk_shape_id_map.keys()\n        else np.nan\n    )\n    df_elems = df_elems.dropna(subset=[\"cell_types\"], axis=0)\n\n    # convert dataframes to vtk-desired format\n    points = df_nodes[[\"x\", \"y\", \"z\"]].to_numpy()\n    cell_types = df_elems[\"cell_types\"].to_numpy()\n    n_nodes = df_elems.loc[:, \"n_nodes\"].to_numpy()\n    # subtract starting node id from all grid references in cells to avoid filling from 0 to first used node (in case mesh doesnt start at 1)\n    p = df_elems.iloc[:, 3:-1].to_numpy() - df_nodes.index.min()\n    # if you need to, re-order nodes here-ish\n    a = np.hstack((n_nodes.reshape((len(n_nodes), 1)), p))\n    # convert to flat numpy array\n    cells = a.ravel()\n    # remove nans (due to elements with different no. of nodes)\n    cells = cells[np.logical_not(np.isnan(cells))]\n    cells = cells.astype(int)\n\n    # update grid\n    vtk_pts = vtkPoints()\n    vtk_pts.SetData(np2da(points))\n    vtk_grid.SetPoints(vtk_pts)\n\n    vtk_cells = vtkCellArray()\n    vtk_cells.SetCells(\n        cell_types.shape[0], np2da(cells, array_type=vtkConstants.VTK_ID_TYPE)\n    )\n    vtk_grid.SetCells(\n        np2da(cell_types, array_type=vtkConstants.VTK_UNSIGNED_CHAR), vtk_cells\n    )\n    state.mesh_status = 1\n\n    # Add field if any\n    if field_file:\n        field_bytes = field_file.get(\"content\")\n        df_elem_data = pd.read_csv(\n            io.StringIO(field_bytes.decode(\"utf-8\")),\n            delim_whitespace=True,\n            header=None,\n            skiprows=1,\n            names=[\"id\", \"val\"],\n        )\n        df_elem_data = df_elem_data.sort_values(\"id\").set_index(\"id\", drop=True)\n        # fill missing ids in range as VTK uses position (index) to map data to cells\n        df_elem_data = df_elem_data.reindex(\n            np.arange(df_elems.index.min(), df_elems.index.max() + 1), fill_value=0.0\n        )\n        np_val = df_elem_data[\"val\"].to_numpy()\n        # assign data to grid with the name 'my_array'\n        vtk_array = np2da(np_val, name=field_to_keep)\n        vtk_grid.GetCellData().SetScalars(vtk_array)\n        full_min, full_max = vtk_array.GetRange()\n        state.full_min = full_min\n        state.full_max = full_max\n        state.threshold_range = list(vtk_array.GetRange())\n        state.mesh_status = 2\n\n        # Color handling in plain VTK\n        filter_mapper.SetScalarRange(full_min, full_max)\n\n    renderer.ResetCamera()\n    ctrl.view_update()\n\n\n@state.change(\"threshold_range\")\ndef update_filter(threshold_range, **kwargs):\n    filter_mapper.SetScalarRange(\n        threshold_range\n    )  # Comment if you want to have a fix color range\n    vtk_filter.SetLowerThreshold(threshold_range[0])\n    vtk_filter.SetUpperThreshold(threshold_range[1])\n    ctrl.view_update()\n\n\n@state.change(\"mesh_status\")\ndef update_mesh_representations(**kwargs):\n    # defaults\n    color = [1, 1, 1]\n    representation = 2\n    opacity = 1\n\n    if state.mesh_status == 2:\n        color = [0.3, 0.3, 0.3]\n        representation = 1\n        opacity = 0.2\n\n    property = mesh_actor.GetProperty()\n    property.SetRepresentation(representation)\n    property.SetColor(color)\n    property.SetOpacity(opacity)\n    ctrl.view_update()\n\n\ndef reset():\n    state.update(\n        {\n            \"nodes_file\": None,\n            \"elems_file\": None,\n            \"field_file\": None,\n            \"mesh_status\": 0,\n        }\n    )\n\n\n# -----------------------------------------------------------------------------\n# Web App setup\n# -----------------------------------------------------------------------------\n\nfile_style = {\n    \"dense\": True,\n    \"hide_details\": True,\n    \"style\": \"max-width: 200px\",\n    \"class\": \"mx-2\",\n    \"small_chips\": True,\n    \"clearable\": (\"false\",),\n    \"accept\": \".txt\",\n}\n\nstate.trame__title = \"FEA - Mesh viewer\"\n\nwith SinglePageLayout(server) as layout:\n    layout.icon.click = reset\n    layout.title.set_text(\"Mesh Viewer\")\n\n    # Toolbar ----------------------------------------\n    with layout.toolbar:\n        vuetify.VSpacer()\n        vuetify.VRangeSlider(\n            thumb_size=16,\n            thumb_label=True,\n            label=\"Threshold\",\n            v_if=(\"mesh_status > 1\",),\n            v_model=(\"threshold_range\", [0, 1]),\n            min=(\"full_min\", 0),\n            max=(\"full_max\", 1),\n            dense=True,\n            hide_details=True,\n            style=\"max-width: 400px\",\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 1\",),\n            prepend_icon=\"mdi-vector-triangle\",\n            v_model=(\"nodes_file\", None),\n            placeholder=\"Nodes\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 1\",),\n            prepend_icon=\"mdi-dots-triangle\",\n            v_model=(\"elems_file\", None),\n            placeholder=\"Elements\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 2\",),\n            prepend_icon=\"mdi-gradient\",\n            v_model=(\"field_file\", None),\n            placeholder=\"Field\",\n            **file_style,\n        )\n        with vuetify.VBtn(\n            v_if=(\"mesh_status\",), icon=True, click=ctrl.view_reset_camera\n        ):\n            vuetify.VIcon(\"mdi-crop-free\")\n\n        vuetify.VProgressLinear(\n            indeterminate=True, absolute=True, bottom=True, active=(\"trame__busy\",)\n        )\n\n    # Content ----------------------------------------\n    with layout.content:\n        with vuetify.VContainer(\n            fluid=True,\n            classes=\"pa-0 fill-height\",\n            style=\"position: relative\",\n        ):\n            html_view = vtk.VtkLocalView(renderWindow)\n            ctrl.view_update = html_view.update\n            ctrl.view_reset_camera = html_view.reset_camera\n\n\n# Variables not defined within HTML but used\nstate.mesh_status = 0  # 0: empty / 1: mesh / 2: mesh+filter\n\n# -----------------------------------------------------------------------------\n# Use --data to skip file upload\n# -----------------------------------------------------------------------------\n\nparser = server.cli\nparser.add_argument(\"--data\", help=\"Unstructured file path\", dest=\"data\")\nargs = parser.parse_args()\nif args.data:\n    from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\n\n    reader = vtkXMLUnstructuredGridReader()\n    reader.SetFileName(os.path.abspath(args.data))\n    reader.Update()\n    vtu = reader.GetOutput()\n    vtk_grid.ShallowCopy(vtu)\n\n    vtk_array = vtu.GetCellData().GetScalars()\n    full_min, full_max = vtk_array.GetRange()\n    state.full_min = full_min\n    state.full_max = full_max\n    state.threshold_range = [full_min, full_max]\n    state.mesh_status = 2\n    update_mesh_representations()\n\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    server.start()\n
        "},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#code_1","title":"Code","text":""},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#app_remote_viewpy","title":"app_remote_view.py","text":"
        \"\"\"\nVersion for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/VTK/Applications/FiniteElementAnalysis/app_remote_view.py\nDelta v1..v2          - https://github.com/Kitware/trame/commit/03f28bb0084490acabf218264b96a1dbb3a17f19\n\"\"\"\n\nimport os\nimport io\nimport numpy as np\nimport pandas as pd\n\nfrom vtkmodules.vtkCommonCore import vtkPoints, vtkIdList, vtkLookupTable\nfrom vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid, vtkCellArray\nfrom vtkmodules.vtkFiltersCore import vtkThreshold\nfrom vtkmodules.numpy_interface.dataset_adapter import numpyTovtkDataArray as np2da\nfrom vtkmodules.util import vtkConstants\n\n# Add import for the rendering\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch  # noqa\nimport vtkmodules.vtkRenderingOpenGL2  # noqa\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n)\n\nfrom trame.app import get_server\nfrom trame.ui.vuetify import SinglePageLayout\nfrom trame.widgets import vuetify, vtk\n\n# -----------------------------------------------------------------------------\n# Trame setup\n# -----------------------------------------------------------------------------\n\nserver = get_server()\nstate, ctrl = server.state, server.controller\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nvtk_idlist = vtkIdList()\nvtk_grid = vtkUnstructuredGrid()\nvtk_filter = vtkThreshold()\nvtk_filter.SetInputData(vtk_grid)\nfield_to_keep = \"my_array\"\n\nrenderer = vtkRenderer()\nrenderer.SetBackground(0.8, 0.8, 0.8)\nrenderWindow = vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n\nrenderWindowInteractor = vtkRenderWindowInteractor()\nrenderWindowInteractor.SetRenderWindow(renderWindow)\nrenderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\nfilter_mapper = vtkDataSetMapper()\nfilter_mapper.SetInputConnection(vtk_filter.GetOutputPort())\nfilter_actor = vtkActor()\nfilter_actor.SetMapper(filter_mapper)\nrenderer.AddActor(filter_actor)\n\nlut = vtkLookupTable()\nlut.SetHueRange(0.667, 0)\nlut.Build()\nfilter_mapper.SetLookupTable(lut)\n\nmesh_mapper = vtkDataSetMapper()\nmesh_mapper.SetInputData(vtk_grid)\nmesh_mapper.SetScalarVisibility(0)\nmesh_actor = vtkActor()\nmesh_actor.SetMapper(mesh_mapper)\nrenderer.AddActor(mesh_actor)\n\n\n@state.change(\"nodes_file\", \"elems_file\", \"field_file\")\ndef update_grid(nodes_file, elems_file, field_file, **kwargs):\n    if not nodes_file:\n        return\n\n    if not elems_file:\n        return\n\n    nodes_bytes = nodes_file.get(\"content\")\n    elems_bytes = elems_file.get(\"content\")\n\n    df_nodes = pd.read_csv(\n        io.StringIO(nodes_bytes.decode(\"utf-8\")),\n        delim_whitespace=True,\n        header=None,\n        skiprows=1,\n        names=[\"id\", \"x\", \"y\", \"z\"],\n    )\n\n    df_nodes[\"id\"] = df_nodes[\"id\"].astype(int)\n    df_nodes = df_nodes.set_index(\"id\", drop=True)\n    # fill missing ids in range as VTK uses position (index) to map cells to points\n    df_nodes = df_nodes.reindex(\n        np.arange(df_nodes.index.min(), df_nodes.index.max() + 1), fill_value=0\n    )\n\n    df_elems = pd.read_csv(\n        io.StringIO(elems_bytes.decode(\"utf-8\")),\n        skiprows=1,\n        header=None,\n        delim_whitespace=True,\n        engine=\"python\",\n        index_col=None,\n    ).sort_values(0)\n    # order: 0: eid, 1: eshape, 2+: nodes, iloc[:,0] is index\n    df_elems.iloc[:, 0] = df_elems.iloc[:, 0].astype(int)\n\n    n_nodes = df_elems.iloc[:, 1].map(\n        lambda x: int(\"\".join(i for i in x if i.isdigit()))\n    )\n    df_elems.insert(2, \"n_nodes\", n_nodes)\n    # fill missing ids in range as VTK uses position (index) to map data to cells\n    new_range = np.arange(df_elems.iloc[:, 0].min(), df_elems.iloc[:, 0].max() + 1)\n    df_elems = df_elems.set_index(0, drop=False).reindex(new_range, fill_value=0)\n\n    # mapping specific to Ansys Mechanical data\n    vtk_shape_id_map = {\n        \"Tet4\": vtkConstants.VTK_TETRA,\n        \"Tet10\": vtkConstants.VTK_QUADRATIC_TETRA,\n        \"Hex8\": vtkConstants.VTK_HEXAHEDRON,\n        \"Hex20\": vtkConstants.VTK_QUADRATIC_HEXAHEDRON,\n        \"Tri6\": vtkConstants.VTK_QUADRATIC_TRIANGLE,\n        \"Quad8\": vtkConstants.VTK_QUADRATIC_QUAD,\n        \"Tri3\": vtkConstants.VTK_TRIANGLE,\n        \"Quad4\": vtkConstants.VTK_QUAD,\n        \"Wed15\": vtkConstants.VTK_QUADRATIC_WEDGE,\n    }\n    df_elems[\"cell_types\"] = np.nan\n    df_elems.loc[df_elems.loc[:, 0] > 0, \"cell_types\"] = df_elems.loc[\n        df_elems.loc[:, 0] > 0, 1\n    ].map(\n        lambda x: vtk_shape_id_map[x.strip()]\n        if x.strip() in vtk_shape_id_map.keys()\n        else np.nan\n    )\n    df_elems = df_elems.dropna(subset=[\"cell_types\"], axis=0)\n\n    # convert dataframes to vtk-desired format\n    points = df_nodes[[\"x\", \"y\", \"z\"]].to_numpy()\n    cell_types = df_elems[\"cell_types\"].to_numpy()\n    n_nodes = df_elems.loc[:, \"n_nodes\"].to_numpy()\n    # subtract starting node id from all grid references in cells to avoid filling from 0 to first used node (in case mesh doesnt start at 1)\n    p = df_elems.iloc[:, 3:-1].to_numpy() - df_nodes.index.min()\n    # if you need to, re-order nodes here-ish\n    a = np.hstack((n_nodes.reshape((len(n_nodes), 1)), p))\n    # convert to flat numpy array\n    cells = a.ravel()\n    # remove nans (due to elements with different no. of nodes)\n    cells = cells[np.logical_not(np.isnan(cells))]\n    cells = cells.astype(int)\n\n    # update grid\n    vtk_pts = vtkPoints()\n    vtk_pts.SetData(np2da(points))\n    vtk_grid.SetPoints(vtk_pts)\n\n    vtk_cells = vtkCellArray()\n    vtk_cells.SetCells(\n        cell_types.shape[0], np2da(cells, array_type=vtkConstants.VTK_ID_TYPE)\n    )\n    vtk_grid.SetCells(\n        np2da(cell_types, array_type=vtkConstants.VTK_UNSIGNED_CHAR), vtk_cells\n    )\n    state.mesh_status = 1\n\n    # Add field if any\n    if field_file:\n        field_bytes = field_file.get(\"content\")\n        df_elem_data = pd.read_csv(\n            io.StringIO(field_bytes.decode(\"utf-8\")),\n            delim_whitespace=True,\n            header=None,\n            skiprows=1,\n            names=[\"id\", \"val\"],\n        )\n        df_elem_data = df_elem_data.sort_values(\"id\").set_index(\"id\", drop=True)\n        # fill missing ids in range as VTK uses position (index) to map data to cells\n        df_elem_data = df_elem_data.reindex(\n            np.arange(df_elems.index.min(), df_elems.index.max() + 1), fill_value=0.0\n        )\n        np_val = df_elem_data[\"val\"].to_numpy()\n        # assign data to grid with the name 'my_array'\n        vtk_array = np2da(np_val, name=field_to_keep)\n        vtk_grid.GetCellData().SetScalars(vtk_array)\n        full_min, full_max = vtk_array.GetRange()\n        state.full_min = full_min\n        state.full_max = full_max\n        state.threshold_range = [full_min, full_max]\n        state.mesh_status = 2\n\n        # Color handling in plain VTK\n        filter_mapper.SetScalarRange(full_min, full_max)\n\n        # Write dataset as VTU\n        # from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridWriter\n        # writer = vtkXMLUnstructuredGridWriter()\n        # writer.SetFileName(\"fea.vtu\")\n        # writer.SetInputData(vtk_grid)\n        # writer.SetCompressorTypeToZLib()\n        # writer.SetCompressionLevel(6)\n        # writer.SetDataModeToAppended()\n        # writer.Write()\n\n    renderer.ResetCamera()\n    ctrl.view_update()\n\n\n@state.change(\"threshold_range\")\ndef update_filter(threshold_range, **kwargs):\n    # Comment if you want to have a fix color range\n    filter_mapper.SetScalarRange(threshold_range)\n    vtk_filter.SetLowerThreshold(threshold_range[0])\n    vtk_filter.SetUpperThreshold(threshold_range[1])\n    ctrl.view_update()\n\n\n@state.change(\"mesh_status\")\ndef update_mesh_representations(**kwargs):\n    # defaults\n    color = [1, 1, 1]\n    representation = 2\n    opacity = 1\n\n    if state.mesh_status == 2:\n        color = [0.3, 0.3, 0.3]\n        representation = 1\n        opacity = 0.2\n\n    property = mesh_actor.GetProperty()\n    property.SetRepresentation(representation)\n    property.SetColor(color)\n    property.SetOpacity(opacity)\n    ctrl.view_update()\n\n\ndef reset():\n    state.update(\n        {\n            \"nodes_file\": None,\n            \"elems_file\": None,\n            \"field_file\": None,\n            \"mesh_status\": 0,\n        }\n    )\n\n\n# -----------------------------------------------------------------------------\n# Web App setup\n# -----------------------------------------------------------------------------\nfile_style = {\n    \"dense\": True,\n    \"hide_details\": True,\n    \"style\": \"max-width: 200px\",\n    \"class\": \"mx-2\",\n    \"small_chips\": True,\n    \"clearable\": (\"false\",),\n    \"accept\": \".txt\",\n}\n\nstate.trame__title = \"FEA - Mesh viewer\"\n\n\nwith SinglePageLayout(server) as layout:\n    layout.icon.click = reset\n    layout.title.set_text(\"Mesh Viewer\")\n\n    # Toolbar ----------------------------------------\n    with layout.toolbar:\n        vuetify.VSpacer()\n        vuetify.VRangeSlider(\n            thumb_size=16,\n            thumb_label=True,\n            label=\"Threshold\",\n            v_if=(\"mesh_status > 1\",),\n            v_model=(\"threshold_range\", [0, 1]),\n            min=(\"full_min\", 0),\n            max=(\"full_max\", 1),\n            dense=True,\n            hide_details=True,\n            style=\"max-width: 400px\",\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 1\",),\n            prepend_icon=\"mdi-vector-triangle\",\n            v_model=(\"nodes_file\", None),\n            placeholder=\"Nodes\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 1\",),\n            prepend_icon=\"mdi-dots-triangle\",\n            v_model=(\"elems_file\", None),\n            placeholder=\"Elements\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"mesh_status < 2\",),\n            prepend_icon=\"mdi-gradient\",\n            v_model=(\"field_file\", None),\n            placeholder=\"Field\",\n            **file_style,\n        )\n        with vuetify.VBtn(\n            v_if=(\"mesh_status\",), icon=True, click=ctrl.view_reset_camera\n        ):\n            vuetify.VIcon(\"mdi-crop-free\")\n\n        vuetify.VProgressLinear(\n            indeterminate=True, absolute=True, bottom=True, active=(\"trame__busy\",)\n        )\n\n    # Content ----------------------------------------\n    with layout.content:\n        with vuetify.VContainer(\n            fluid=True,\n            classes=\"pa-0 fill-height\",\n            style=\"position: relative\",\n        ):\n            html_view = vtk.VtkRemoteView(renderWindow, interactive_ratio=(\"1\",))\n            ctrl.view_update = html_view.update\n            ctrl.view_reset_camera = html_view.reset_camera\n\n\n# Variables not defined within HTML but used\nstate.mesh_status = 0  # 0: empty / 1: mesh / 2: mesh+filter\n\n# -----------------------------------------------------------------------------\n# Use --data to skip file upload\n# -----------------------------------------------------------------------------\n\nparser = server.cli\nparser.add_argument(\"--data\", help=\"Unstructured file path\", dest=\"data\")\nargs = parser.parse_args()\nif args.data:\n    from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\n\n    reader = vtkXMLUnstructuredGridReader()\n    reader.SetFileName(os.path.abspath(args.data))\n    reader.Update()\n    vtu = reader.GetOutput()\n    vtk_grid.ShallowCopy(vtu)\n\n    vtk_array = vtu.GetCellData().GetScalars()\n    full_min, full_max = vtk_array.GetRange()\n    state.full_min = full_min\n    state.full_max = full_max\n    state.threshold_range = [full_min, full_max]\n    state.mesh_status = 2\n    update_mesh_representations()\n\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    server.start()\n
        "},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#code_2","title":"Code","text":""},{"location":"Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/#app_client_viewpy","title":"app_client_view.py","text":"
        \"\"\"\nVersion for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/VTK/Applications/FiniteElementAnalysis/app_client_view.py\nDelta v1..v2          - https://github.com/Kitware/trame/commit/03f28bb0084490acabf218264b96a1dbb3a17f19\n\"\"\"\n\nimport os\nimport io\nimport numpy as np\nimport pandas as pd\n\nfrom vtkmodules.vtkCommonCore import vtkPoints, vtkIdList\nfrom vtkmodules.vtkCommonDataModel import vtkUnstructuredGrid, vtkCellArray\nfrom vtkmodules.vtkFiltersCore import vtkThreshold\nfrom vtkmodules.numpy_interface.dataset_adapter import numpyTovtkDataArray as np2da\nfrom vtkmodules.util import vtkConstants\n\nfrom trame.app import get_server\nfrom trame.ui.vuetify import SinglePageLayout\nfrom trame.widgets import vuetify, vtk, trame\n\n# -----------------------------------------------------------------------------\n# Constants\n# -----------------------------------------------------------------------------\n\nVIEW_INTERACT = [\n    {\"button\": 1, \"action\": \"Rotate\"},\n    {\"button\": 2, \"action\": \"Pan\"},\n    {\"button\": 3, \"action\": \"Zoom\", \"scrollEnabled\": True},\n    {\"button\": 1, \"action\": \"Pan\", \"alt\": True},\n    {\"button\": 1, \"action\": \"Zoom\", \"control\": True},\n    {\"button\": 1, \"action\": \"Pan\", \"shift\": True},\n    {\"button\": 1, \"action\": \"Roll\", \"alt\": True, \"shift\": True},\n]\n\n# -----------------------------------------------------------------------------\n# Trame setup\n# -----------------------------------------------------------------------------\n\nserver = get_server()\nstate, ctrl = server.state, server.controller\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nvtk_idlist = vtkIdList()\nvtk_grid = vtkUnstructuredGrid()\nvtk_filter = vtkThreshold()\nvtk_filter.SetInputData(vtk_grid)\nfield_to_keep = \"my_array\"\n\n\n@state.change(\"nodes_file\", \"elems_file\", \"field_file\")\ndef update_grid(nodes_file, elems_file, field_file, **kwargs):\n    state.picking_modes = []\n    if not nodes_file:\n        return\n\n    if not elems_file:\n        return\n\n    nodes_bytes = nodes_file.get(\"content\")\n    elems_bytes = elems_file.get(\"content\")\n\n    df_nodes = pd.read_csv(\n        io.StringIO(nodes_bytes.decode(\"utf-8\")),\n        delim_whitespace=True,\n        header=None,\n        skiprows=1,\n        names=[\"id\", \"x\", \"y\", \"z\"],\n    )\n\n    df_nodes[\"id\"] = df_nodes[\"id\"].astype(int)\n    df_nodes = df_nodes.set_index(\"id\", drop=True)\n    # fill missing ids in range as VTK uses position (index) to map cells to points\n    df_nodes = df_nodes.reindex(\n        np.arange(df_nodes.index.min(), df_nodes.index.max() + 1), fill_value=0\n    )\n\n    df_elems = pd.read_csv(\n        io.StringIO(elems_bytes.decode(\"utf-8\")),\n        skiprows=1,\n        header=None,\n        delim_whitespace=True,\n        engine=\"python\",\n        index_col=None,\n    ).sort_values(0)\n    # order: 0: eid, 1: eshape, 2+: nodes, iloc[:,0] is index\n    df_elems.iloc[:, 0] = df_elems.iloc[:, 0].astype(int)\n\n    n_nodes = df_elems.iloc[:, 1].map(\n        lambda x: int(\"\".join(i for i in x if i.isdigit()))\n    )\n    df_elems.insert(2, \"n_nodes\", n_nodes)\n    # fill missing ids in range as VTK uses position (index) to map data to cells\n    new_range = np.arange(df_elems.iloc[:, 0].min(), df_elems.iloc[:, 0].max() + 1)\n    df_elems = df_elems.set_index(0, drop=False).reindex(new_range, fill_value=0)\n\n    # mapping specific to Ansys Mechanical data\n    vtk_shape_id_map = {\n        \"Tet4\": vtkConstants.VTK_TETRA,\n        \"Tet10\": vtkConstants.VTK_QUADRATIC_TETRA,\n        \"Hex8\": vtkConstants.VTK_HEXAHEDRON,\n        \"Hex20\": vtkConstants.VTK_QUADRATIC_HEXAHEDRON,\n        \"Tri6\": vtkConstants.VTK_QUADRATIC_TRIANGLE,\n        \"Quad8\": vtkConstants.VTK_QUADRATIC_QUAD,\n        \"Tri3\": vtkConstants.VTK_TRIANGLE,\n        \"Quad4\": vtkConstants.VTK_QUAD,\n        \"Wed15\": vtkConstants.VTK_QUADRATIC_WEDGE,\n    }\n    df_elems[\"cell_types\"] = np.nan\n    df_elems.loc[df_elems.loc[:, 0] > 0, \"cell_types\"] = df_elems.loc[\n        df_elems.loc[:, 0] > 0, 1\n    ].map(\n        lambda x: vtk_shape_id_map[x.strip()]\n        if x.strip() in vtk_shape_id_map.keys()\n        else np.nan\n    )\n    df_elems = df_elems.dropna(subset=[\"cell_types\"], axis=0)\n\n    # convert dataframes to vtk-desired format\n    points = df_nodes[[\"x\", \"y\", \"z\"]].to_numpy()\n    cell_types = df_elems[\"cell_types\"].to_numpy()\n    n_nodes = df_elems.loc[:, \"n_nodes\"].to_numpy()\n    # subtract starting node id from all grid references in cells to avoid filling from 0 to first used node (in case mesh doesnt start at 1)\n    p = df_elems.iloc[:, 3:-1].to_numpy() - df_nodes.index.min()\n    # if you need to, re-order nodes here-ish\n    a = np.hstack((n_nodes.reshape((len(n_nodes), 1)), p))\n    # convert to flat numpy array\n    cells = a.ravel()\n    # remove nans (due to elements with different no. of nodes)\n    cells = cells[np.logical_not(np.isnan(cells))]\n    cells = cells.astype(int)\n\n    # update grid\n    vtk_pts = vtkPoints()\n    vtk_pts.SetData(np2da(points))\n    vtk_grid.SetPoints(vtk_pts)\n\n    vtk_cells = vtkCellArray()\n    vtk_cells.SetCells(\n        cell_types.shape[0], np2da(cells, array_type=vtkConstants.VTK_ID_TYPE)\n    )\n    vtk_grid.SetCells(\n        np2da(cell_types, array_type=vtkConstants.VTK_UNSIGNED_CHAR), vtk_cells\n    )\n\n    # Add field if any\n    if field_file:\n        field_bytes = field_file.get(\"content\")\n        df_elem_data = pd.read_csv(\n            io.StringIO(field_bytes.decode(\"utf-8\")),\n            delim_whitespace=True,\n            header=None,\n            skiprows=1,\n            names=[\"id\", \"val\"],\n        )\n        df_elem_data = df_elem_data.sort_values(\"id\").set_index(\"id\", drop=True)\n        # fill missing ids in range as VTK uses position (index) to map data to cells\n        df_elem_data = df_elem_data.reindex(\n            np.arange(df_elems.index.min(), df_elems.index.max() + 1), fill_value=0.0\n        )\n        np_val = df_elem_data[\"val\"].to_numpy()\n        # assign data to grid with the name 'my_array'\n        vtk_array = np2da(np_val, name=field_to_keep)\n        vtk_grid.GetCellData().SetScalars(vtk_array)\n        state.full_range = vtk_array.GetRange()\n        state.threshold_range = list(vtk_array.GetRange())\n        state.picking_modes = [\"hover\"]\n\n    ctrl.mesh_update()\n\n\n@state.change(\"threshold_range\")\ndef update_filter(threshold_range, **kwargs):\n    vtk_filter.SetLowerThreshold(threshold_range[0])\n    vtk_filter.SetUpperThreshold(threshold_range[1])\n    ctrl.threshold_update()\n\n\ndef reset():\n    state.update(\n        {\n            \"mesh\": None,\n            \"threshold\": None,\n            \"nodes_file\": None,\n            \"elems_file\": None,\n            \"field_file\": None,\n        }\n    )\n\n\n@state.change(\"pick_data\")\ndef update_tooltip(pick_data, pixel_ratio, **kwargs):\n    state.tooltip = \"\"\n    state.tooltip_style = {\"display\": \"none\"}\n    data = pick_data\n\n    if data:\n        xyx = data[\"worldPosition\"]\n        idx = vtk_grid.FindPoint(xyx)\n        field = vtk_grid.GetCellData().GetArray(0)\n        if idx > -1 and field:\n            messages = []\n            vtk_grid.GetPointCells(idx, vtk_idlist)\n            for i in range(vtk_idlist.GetNumberOfIds()):\n                cell_idx = vtk_idlist.GetId(i)\n                value = field.GetValue(cell_idx)\n                value_str = f\"{value:.2f}\"\n                messages.append(f\"Scalar: {value_str}\")\n\n            if len(messages):\n                x, y, z = data[\"displayPosition\"]\n                state.tooltip = messages[0]\n                state.tooltip_style = {\n                    \"position\": \"absolute\",\n                    \"left\": f\"{(x / pixel_ratio) + 10}px\",\n                    \"bottom\": f\"{(y / pixel_ratio) + 10}px\",\n                    \"zIndex\": 10,\n                    \"pointerEvents\": \"none\",\n                }\n\n\n# -----------------------------------------------------------------------------\n# Web App setup\n# -----------------------------------------------------------------------------\n\nfile_style = {\n    \"dense\": True,\n    \"hide_details\": True,\n    \"style\": \"max-width: 200px\",\n    \"class\": \"mx-2\",\n    \"small_chips\": True,\n    \"clearable\": (\"false\",),\n    \"accept\": \".txt\",\n}\n\nstate.trame__title = \"FEA - Mesh viewer\"\n\nwith SinglePageLayout(server) as layout:\n    layout.title.set_text(\"Mesh Viewer\")\n    layout.icon.click = reset\n\n    # Let the server know the browser pixel ratio\n    trame.ClientTriggers(mounted=\"pixel_ratio = window.devicePixelRatio\")\n\n    # Toolbar ----------------------------------------\n    with layout.toolbar:\n        vuetify.VSpacer()\n        vuetify.VRangeSlider(\n            thumb_size=16,\n            thumb_label=True,\n            label=\"Threshold\",\n            v_if=(\"threshold\",),\n            v_model=(\"threshold_range\", [0, 1]),\n            min=(\"full_range[0]\",),\n            max=(\"full_range[1]\",),\n            dense=True,\n            hide_details=True,\n            style=\"max-width: 400px\",\n        )\n        vuetify.VFileInput(\n            v_show=(\"!mesh\",),\n            prepend_icon=\"mdi-vector-triangle\",\n            v_model=(\"nodes_file\", None),\n            placeholder=\"Nodes\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"!mesh\",),\n            prepend_icon=\"mdi-dots-triangle\",\n            v_model=(\"elems_file\", None),\n            placeholder=\"Elements\",\n            **file_style,\n        )\n        vuetify.VFileInput(\n            v_show=(\"!threshold\",),\n            prepend_icon=\"mdi-gradient\",\n            v_model=(\"field_file\", None),\n            placeholder=\"Field\",\n            **file_style,\n        )\n        with vuetify.VBtn(v_if=(\"mesh\",), icon=True, click=ctrl.view_reset_camera):\n            vuetify.VIcon(\"mdi-crop-free\")\n\n        vuetify.VProgressLinear(\n            indeterminate=True, absolute=True, bottom=True, active=(\"trame__busy\",)\n        )\n\n        trame.ClientStateChange(value=\"mesh\", change=ctrl.view_reset_camera)\n\n    # Content ----------------------------------------\n    with layout.content:\n        with vuetify.VContainer(\n            fluid=True,\n            classes=\"pa-0 fill-height\",\n            style=\"position: relative\",\n        ):\n            with vtk.VtkView(\n                ref=\"view\",\n                background=(\"[0.8, 0.8, 0.8]\",),\n                hover=\"pick_data = $event\",\n                picking_modes=(\"picking_modes\", []),\n                interactor_settings=(\"interactor_settings\", VIEW_INTERACT),\n            ) as view:\n                ctrl.view_update = view.update\n                ctrl.view_reset_camera = view.reset_camera\n                with vtk.VtkGeometryRepresentation(\n                    v_if=(\"mesh\",),\n                    property=(\n                        \"\"\"{\n                            representation: threshold ? 1 : 2,\n                            color: threshold ? [0.3, 0.3, 0.3] : [1, 1, 1],\n                            opacity: threshold ? 0.2 : 1\n                            }\"\"\",\n                    ),\n                ):\n                    mesh = vtk.VtkMesh(\"mesh\", dataset=vtk_grid)\n                    ctrl.mesh_update = mesh.update\n\n                with vtk.VtkGeometryRepresentation(\n                    v_if=(\"threshold\",),\n                    color_data_range=(\"full_range\", [0, 1]),\n                ):\n                    threshold = vtk.VtkMesh(\n                        \"threshold\", dataset=vtk_filter, field_to_keep=field_to_keep\n                    )\n                    ctrl.threshold_update = threshold.update\n            with vuetify.VCard(\n                style=(\"tooltip_style\", {\"display\": \"none\"}),\n                elevation=2,\n                outlined=True,\n            ):\n                vuetify.VCardText(\"<pre>{{ tooltip }}</pre>\"),\n\n\n# Variables not defined within HTML but used\nstate.update(\n    {\n        \"pixel_ratio\": 1,\n        \"pick_data\": None,\n        \"tooltip\": \"\",\n    }\n)\n\n# -----------------------------------------------------------------------------\n# Use --data to skip file upload\n# -----------------------------------------------------------------------------\n\nparser = server.cli\nparser.add_argument(\"--data\", help=\"Unstructured file path\", dest=\"data\")\nargs = parser.parse_args()\nif args.data:\n    from vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\n\n    reader = vtkXMLUnstructuredGridReader()\n    reader.SetFileName(os.path.abspath(args.data))\n    reader.Update()\n    vtu = reader.GetOutput()\n    vtk_grid.ShallowCopy(vtu)\n\n    vtk_array = vtu.GetCellData().GetScalars()\n    full_min, full_max = vtk_array.GetRange()\n    state.full_range = [full_min, full_max]\n    state.threshold_range = [full_min, full_max]\n    state.picking_modes = [\"hover\"]\n    ctrl.mesh_update()\n    ctrl.threshold_update()\n\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    server.start()\n
        "},{"location":"Trame/Applications/MultiFilter/MultiFilter/","title":"MultiFilter","text":"

        vtk-examples/Trame/Applications/MultiFilter

        "},{"location":"Trame/Applications/MultiFilter/MultiFilter/#description","title":"Description","text":"

        VTK Mutli Filter Example

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Trame/Applications/MultiFilter/MultiFilter/#download-and-build-multifilter","title":"Download and Build MultiFilter","text":"

        Click here to download MultiFilter. Once the tarball MultiFilter.tar has been downloaded and extracted,

        cd MultiFilter\n

        and run the application.

        See this trame tutorial for instructions on how to setup trame and run the application.

        "},{"location":"Trame/Applications/MultiFilter/MultiFilter/#code","title":"Code","text":""},{"location":"Trame/Applications/MultiFilter/MultiFilter/#apppy","title":"app.py","text":"
        \"\"\"\nVersion for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/VTK/Applications/MultiFilter/app.py\nDelta v1..v2          - https://github.com/Kitware/trame/commit/7b3cda7c45b8a60132892f762e16ed28cb709481\n\"\"\"\n\nfrom trame.app import get_server\nfrom trame.ui.vuetify import SinglePageWithDrawerLayout\nfrom trame.widgets import vtk, vuetify, trame\nfrom trame.assets.remote import HttpFile\n\nfrom vtkmodules.vtkCommonDataModel import vtkDataObject\nfrom vtkmodules.vtkFiltersCore import vtkContourFilter\nfrom vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\nfrom vtkmodules.vtkRenderingAnnotation import vtkCubeAxesActor\n\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n)\n\n# Required for interactor initialization\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch  # noqa\n\n# Required for rendering initialization, not necessary for\n# local rendering, but doesn't hurt to include it\nimport vtkmodules.vtkRenderingOpenGL2  # noqa\n\n# -----------------------------------------------------------------------------\n# Data file information\n# -----------------------------------------------------------------------------\n\ndataset_file = HttpFile(\n    \"./data/disk_out_ref.vtu\",\n    \"https://github.com/Kitware/trame/raw/master/examples/data/disk_out_ref.vtu\",\n    __file__\n)\n\n# -----------------------------------------------------------------------------\n# Constants\n# -----------------------------------------------------------------------------\n\n\nclass Representation:\n    Points = 0\n    Wireframe = 1\n    Surface = 2\n    SurfaceWithEdges = 3\n\n\nclass LookupTable:\n    Rainbow = 0\n    Inverted_Rainbow = 1\n    Greyscale = 2\n    Inverted_Greyscale = 3\n\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nrenderer = vtkRenderer()\nrenderWindow = vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n\nrenderWindowInteractor = vtkRenderWindowInteractor()\nrenderWindowInteractor.SetRenderWindow(renderWindow)\nrenderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\n# Read Data\nreader = vtkXMLUnstructuredGridReader()\nreader.SetFileName(dataset_file.path)\nreader.Update()\n\n# Extract Array/Field information\ndataset_arrays = []\nfields = [\n    (reader.GetOutput().GetPointData(), vtkDataObject.FIELD_ASSOCIATION_POINTS),\n    (reader.GetOutput().GetCellData(), vtkDataObject.FIELD_ASSOCIATION_CELLS),\n]\nfor field in fields:\n    field_arrays, association = field\n    for i in range(field_arrays.GetNumberOfArrays()):\n        array = field_arrays.GetArray(i)\n        array_range = array.GetRange()\n        dataset_arrays.append(\n            {\n                \"text\": array.GetName(),\n                \"value\": i,\n                \"range\": list(array_range),\n                \"type\": association,\n            }\n        )\ndefault_array = dataset_arrays[0]\ndefault_min, default_max = default_array.get(\"range\")\n\n# Mesh\nmesh_mapper = vtkDataSetMapper()\nmesh_mapper.SetInputConnection(reader.GetOutputPort())\nmesh_actor = vtkActor()\nmesh_actor.SetMapper(mesh_mapper)\nrenderer.AddActor(mesh_actor)\n\n# Mesh: Setup default representation to surface\nmesh_actor.GetProperty().SetRepresentationToSurface()\nmesh_actor.GetProperty().SetPointSize(1)\nmesh_actor.GetProperty().EdgeVisibilityOff()\n\n# Mesh: Apply rainbow color map\nmesh_lut = mesh_mapper.GetLookupTable()\nmesh_lut.SetHueRange(0.666, 0.0)\nmesh_lut.SetSaturationRange(1.0, 1.0)\nmesh_lut.SetValueRange(1.0, 1.0)\nmesh_lut.Build()\n\n# Mesh: Color by default array\nmesh_mapper.SelectColorArray(default_array.get(\"text\"))\nmesh_mapper.GetLookupTable().SetRange(default_min, default_max)\nif default_array.get(\"type\") == vtkDataObject.FIELD_ASSOCIATION_POINTS:\n    mesh_mapper.SetScalarModeToUsePointFieldData()\nelse:\n    mesh_mapper.SetScalarModeToUseCellFieldData()\nmesh_mapper.SetScalarVisibility(True)\nmesh_mapper.SetUseLookupTableScalarRange(True)\n\n# Contour\ncontour = vtkContourFilter()\ncontour.SetInputConnection(reader.GetOutputPort())\ncontour_mapper = vtkDataSetMapper()\ncontour_mapper.SetInputConnection(contour.GetOutputPort())\ncontour_actor = vtkActor()\ncontour_actor.SetMapper(contour_mapper)\nrenderer.AddActor(contour_actor)\n\n# Contour: ContourBy default array\ncontour_value = 0.5 * (default_max + default_min)\ncontour.SetInputArrayToProcess(\n    0, 0, 0, default_array.get(\"type\"), default_array.get(\"text\")\n)\ncontour.SetValue(0, contour_value)\n\n# Contour: Setup default representation to surface\ncontour_actor.GetProperty().SetRepresentationToSurface()\ncontour_actor.GetProperty().SetPointSize(1)\ncontour_actor.GetProperty().EdgeVisibilityOff()\n\n# Contour: Apply rainbow color map\ncontour_lut = contour_mapper.GetLookupTable()\ncontour_lut.SetHueRange(0.666, 0.0)\ncontour_lut.SetSaturationRange(1.0, 1.0)\ncontour_lut.SetValueRange(1.0, 1.0)\ncontour_lut.Build()\n\n# Contour: Color by default array\ncontour_mapper.SelectColorArray(default_array.get(\"text\"))\ncontour_mapper.GetLookupTable().SetRange(default_min, default_max)\nif default_array.get(\"type\") == vtkDataObject.FIELD_ASSOCIATION_POINTS:\n    contour_mapper.SetScalarModeToUsePointFieldData()\nelse:\n    contour_mapper.SetScalarModeToUseCellFieldData()\ncontour_mapper.SetScalarVisibility(True)\ncontour_mapper.SetUseLookupTableScalarRange(True)\n\n# Cube Axes\ncube_axes = vtkCubeAxesActor()\nrenderer.AddActor(cube_axes)\n\n# Cube Axes: Boundaries, camera, and styling\ncube_axes.SetBounds(mesh_actor.GetBounds())\ncube_axes.SetCamera(renderer.GetActiveCamera())\ncube_axes.SetXLabelFormat(\"%6.1f\")\ncube_axes.SetYLabelFormat(\"%6.1f\")\ncube_axes.SetZLabelFormat(\"%6.1f\")\ncube_axes.SetFlyModeToOuterEdges()\n\nrenderer.ResetCamera()\n\n# -----------------------------------------------------------------------------\n# Trame setup\n# -----------------------------------------------------------------------------\n\nserver = get_server()\nstate, ctrl = server.state, server.controller\n\nstate.setdefault(\"active_ui\", None)\n\n# -----------------------------------------------------------------------------\n# Callbacks\n# -----------------------------------------------------------------------------\n\n\n@state.change(\"cube_axes_visibility\")\ndef update_cube_axes_visibility(cube_axes_visibility, **kwargs):\n    cube_axes.SetVisibility(cube_axes_visibility)\n    ctrl.view_update()\n\n\n# Selection Change\ndef actives_change(ids):\n    _id = ids[0]\n    if _id == \"1\":  # Mesh\n        state.active_ui = \"mesh\"\n    elif _id == \"2\":  # Contour\n        state.active_ui = \"contour\"\n    else:\n        state.active_ui = \"nothing\"\n\n\n# Visibility Change\ndef visibility_change(event):\n    _id = event[\"id\"]\n    _visibility = event[\"visible\"]\n\n    if _id == \"1\":  # Mesh\n        mesh_actor.SetVisibility(_visibility)\n    elif _id == \"2\":  # Contour\n        contour_actor.SetVisibility(_visibility)\n    ctrl.view_update()\n\n\n# Representation Callbacks\ndef update_representation(actor, mode):\n    property = actor.GetProperty()\n    if mode == Representation.Points:\n        property.SetRepresentationToPoints()\n        property.SetPointSize(5)\n        property.EdgeVisibilityOff()\n    elif mode == Representation.Wireframe:\n        property.SetRepresentationToWireframe()\n        property.SetPointSize(1)\n        property.EdgeVisibilityOff()\n    elif mode == Representation.Surface:\n        property.SetRepresentationToSurface()\n        property.SetPointSize(1)\n        property.EdgeVisibilityOff()\n    elif mode == Representation.SurfaceWithEdges:\n        property.SetRepresentationToSurface()\n        property.SetPointSize(1)\n        property.EdgeVisibilityOn()\n\n\n@state.change(\"mesh_representation\")\ndef update_mesh_representation(mesh_representation, **kwargs):\n    update_representation(mesh_actor, mesh_representation)\n    ctrl.view_update()\n\n\n@state.change(\"contour_representation\")\ndef update_contour_representation(contour_representation, **kwargs):\n    update_representation(contour_actor, contour_representation)\n    ctrl.view_update()\n\n\n# Color By Callbacks\ndef color_by_array(actor, array):\n    _min, _max = array.get(\"range\")\n    mapper = actor.GetMapper()\n    mapper.SelectColorArray(array.get(\"text\"))\n    mapper.GetLookupTable().SetRange(_min, _max)\n    if array.get(\"type\") == vtkDataObject.FIELD_ASSOCIATION_POINTS:\n        mesh_mapper.SetScalarModeToUsePointFieldData()\n    else:\n        mesh_mapper.SetScalarModeToUseCellFieldData()\n    mapper.SetScalarVisibility(True)\n    mapper.SetUseLookupTableScalarRange(True)\n\n\n@state.change(\"mesh_color_array_idx\")\ndef update_mesh_color_by_name(mesh_color_array_idx, **kwargs):\n    array = dataset_arrays[mesh_color_array_idx]\n    color_by_array(mesh_actor, array)\n    ctrl.view_update()\n\n\n@state.change(\"contour_color_array_idx\")\ndef update_contour_color_by_name(contour_color_array_idx, **kwargs):\n    array = dataset_arrays[contour_color_array_idx]\n    color_by_array(contour_actor, array)\n    ctrl.view_update()\n\n\n# Color Map Callbacks\ndef use_preset(actor, preset):\n    lut = actor.GetMapper().GetLookupTable()\n    if preset == LookupTable.Rainbow:\n        lut.SetHueRange(0.666, 0.0)\n        lut.SetSaturationRange(1.0, 1.0)\n        lut.SetValueRange(1.0, 1.0)\n    elif preset == LookupTable.Inverted_Rainbow:\n        lut.SetHueRange(0.0, 0.666)\n        lut.SetSaturationRange(1.0, 1.0)\n        lut.SetValueRange(1.0, 1.0)\n    elif preset == LookupTable.Greyscale:\n        lut.SetHueRange(0.0, 0.0)\n        lut.SetSaturationRange(0.0, 0.0)\n        lut.SetValueRange(0.0, 1.0)\n    elif preset == LookupTable.Inverted_Greyscale:\n        lut.SetHueRange(0.0, 0.666)\n        lut.SetSaturationRange(0.0, 0.0)\n        lut.SetValueRange(1.0, 0.0)\n    lut.Build()\n\n\n@state.change(\"mesh_color_preset\")\ndef update_mesh_color_preset(mesh_color_preset, **kwargs):\n    use_preset(mesh_actor, mesh_color_preset)\n    ctrl.view_update()\n\n\n@state.change(\"contour_color_preset\")\ndef update_contour_color_preset(contour_color_preset, **kwargs):\n    use_preset(contour_actor, contour_color_preset)\n    ctrl.view_update()\n\n\n# Opacity Callbacks\n@state.change(\"mesh_opacity\")\ndef update_mesh_opacity(mesh_opacity, **kwargs):\n    mesh_actor.GetProperty().SetOpacity(mesh_opacity)\n    ctrl.view_update()\n\n\n@state.change(\"contour_opacity\")\ndef update_contour_opacity(contour_opacity, **kwargs):\n    contour_actor.GetProperty().SetOpacity(contour_opacity)\n    ctrl.view_update()\n\n\n# Contour Callbacks\n@state.change(\"contour_by_array_idx\")\ndef update_contour_by(contour_by_array_idx, **kwargs):\n    array = dataset_arrays[contour_by_array_idx]\n    contour_min, contour_max = array.get(\"range\")\n    contour_step = 0.01 * (contour_max - contour_min)\n    contour_value = 0.5 * (contour_max + contour_min)\n    contour.SetInputArrayToProcess(0, 0, 0, array.get(\"type\"), array.get(\"text\"))\n    contour.SetValue(0, contour_value)\n\n    # Update UI\n    state.contour_min = contour_min\n    state.contour_max = contour_max\n    state.contour_value = contour_value\n    state.contour_step = contour_step\n\n    # Update View\n    ctrl.view_update()\n\n\n@state.change(\"contour_value\")\ndef update_contour_value(contour_value, **kwargs):\n    contour.SetValue(0, float(contour_value))\n    ctrl.view_update()\n\n\n# -----------------------------------------------------------------------------\n# GUI elements\n# -----------------------------------------------------------------------------\n\n\ndef standard_buttons():\n    vuetify.VCheckbox(\n        v_model=(\"cube_axes_visibility\", True),\n        on_icon=\"mdi-cube-outline\",\n        off_icon=\"mdi-cube-off-outline\",\n        classes=\"mx-1\",\n        hide_details=True,\n        dense=True,\n    )\n    vuetify.VCheckbox(\n        v_model=\"$vuetify.theme.dark\",\n        on_icon=\"mdi-lightbulb-off-outline\",\n        off_icon=\"mdi-lightbulb-outline\",\n        classes=\"mx-1\",\n        hide_details=True,\n        dense=True,\n    )\n    vuetify.VCheckbox(\n        v_model=(\"viewMode\", \"local\"),\n        on_icon=\"mdi-lan-disconnect\",\n        off_icon=\"mdi-lan-connect\",\n        true_value=\"local\",\n        false_value=\"remote\",\n        classes=\"mx-1\",\n        hide_details=True,\n        dense=True,\n    )\n    with vuetify.VBtn(icon=True, click=\"$refs.view.resetCamera()\"):\n        vuetify.VIcon(\"mdi-crop-free\")\n\n\ndef pipeline_widget():\n    trame.GitTree(\n        sources=(\n            \"pipeline\",\n            [\n                {\"id\": \"1\", \"parent\": \"0\", \"visible\": 1, \"name\": \"Mesh\"},\n                {\"id\": \"2\", \"parent\": \"1\", \"visible\": 1, \"name\": \"Contour\"},\n            ],\n        ),\n        actives_change=(actives_change, \"[$event]\"),\n        visibility_change=(visibility_change, \"[$event]\"),\n    )\n\n\ndef ui_card(title, ui_name):\n    with vuetify.VCard(v_show=f\"active_ui == '{ui_name}'\"):\n        vuetify.VCardTitle(\n            title,\n            classes=\"grey lighten-1 py-1 grey--text text--darken-3\",\n            style=\"user-select: none; cursor: pointer\",\n            hide_details=True,\n            dense=True,\n        )\n        content = vuetify.VCardText(classes=\"py-2\")\n    return content\n\n\ndef mesh_card():\n    with ui_card(title=\"Mesh\", ui_name=\"mesh\"):\n        vuetify.VSelect(\n            # Representation\n            v_model=(\"mesh_representation\", Representation.Surface),\n            items=(\n                \"representations\",\n                [\n                    {\"text\": \"Points\", \"value\": 0},\n                    {\"text\": \"Wireframe\", \"value\": 1},\n                    {\"text\": \"Surface\", \"value\": 2},\n                    {\"text\": \"SurfaceWithEdges\", \"value\": 3},\n                ],\n            ),\n            label=\"Representation\",\n            hide_details=True,\n            dense=True,\n            outlined=True,\n            classes=\"pt-1\",\n        )\n        with vuetify.VRow(classes=\"pt-2\", dense=True):\n            with vuetify.VCol(cols=\"6\"):\n                vuetify.VSelect(\n                    # Color By\n                    label=\"Color by\",\n                    v_model=(\"mesh_color_array_idx\", 0),\n                    items=(\"array_list\", dataset_arrays),\n                    hide_details=True,\n                    dense=True,\n                    outlined=True,\n                    classes=\"pt-1\",\n                )\n            with vuetify.VCol(cols=\"6\"):\n                vuetify.VSelect(\n                    # Color Map\n                    label=\"Colormap\",\n                    v_model=(\"mesh_color_preset\", LookupTable.Rainbow),\n                    items=(\n                        \"colormaps\",\n                        [\n                            {\"text\": \"Rainbow\", \"value\": 0},\n                            {\"text\": \"Inv Rainbow\", \"value\": 1},\n                            {\"text\": \"Greyscale\", \"value\": 2},\n                            {\"text\": \"Inv Greyscale\", \"value\": 3},\n                        ],\n                    ),\n                    hide_details=True,\n                    dense=True,\n                    outlined=True,\n                    classes=\"pt-1\",\n                )\n        vuetify.VSlider(\n            # Opacity\n            v_model=(\"mesh_opacity\", 1.0),\n            min=0,\n            max=1,\n            step=0.1,\n            label=\"Opacity\",\n            classes=\"mt-1\",\n            hide_details=True,\n            dense=True,\n        )\n\n\ndef contour_card():\n    with ui_card(title=\"Contour\", ui_name=\"contour\"):\n        vuetify.VSelect(\n            # Contour By\n            label=\"Contour by\",\n            v_model=(\"contour_by_array_idx\", 0),\n            items=(\"array_list\", dataset_arrays),\n            hide_details=True,\n            dense=True,\n            outlined=True,\n            classes=\"pt-1\",\n        )\n        vuetify.VSlider(\n            # Contour Value\n            v_model=(\"contour_value\", contour_value),\n            min=(\"contour_min\", default_min),\n            max=(\"contour_max\", default_max),\n            step=(\"contour_step\", 0.01 * (default_max - default_min)),\n            label=\"Value\",\n            classes=\"my-1\",\n            hide_details=True,\n            dense=True,\n        )\n        vuetify.VSelect(\n            # Representation\n            v_model=(\"contour_representation\", Representation.Surface),\n            items=(\n                \"representations\",\n                [\n                    {\"text\": \"Points\", \"value\": 0},\n                    {\"text\": \"Wireframe\", \"value\": 1},\n                    {\"text\": \"Surface\", \"value\": 2},\n                    {\"text\": \"SurfaceWithEdges\", \"value\": 3},\n                ],\n            ),\n            label=\"Representation\",\n            hide_details=True,\n            dense=True,\n            outlined=True,\n            classes=\"pt-1\",\n        )\n        with vuetify.VRow(classes=\"pt-2\", dense=True):\n            with vuetify.VCol(cols=\"6\"):\n                vuetify.VSelect(\n                    # Color By\n                    label=\"Color by\",\n                    v_model=(\"contour_color_array_idx\", 0),\n                    items=(\"array_list\", dataset_arrays),\n                    hide_details=True,\n                    dense=True,\n                    outlined=True,\n                    classes=\"pt-1\",\n                )\n            with vuetify.VCol(cols=\"6\"):\n                vuetify.VSelect(\n                    # Color Map\n                    label=\"Colormap\",\n                    v_model=(\"contour_color_preset\", LookupTable.Rainbow),\n                    items=(\n                        \"colormaps\",\n                        [\n                            {\"text\": \"Rainbow\", \"value\": 0},\n                            {\"text\": \"Inv Rainbow\", \"value\": 1},\n                            {\"text\": \"Greyscale\", \"value\": 2},\n                            {\"text\": \"Inv Greyscale\", \"value\": 3},\n                        ],\n                    ),\n                    hide_details=True,\n                    dense=True,\n                    outlined=True,\n                    classes=\"pt-1\",\n                )\n        vuetify.VSlider(\n            # Opacity\n            v_model=(\"contour_opacity\", 1.0),\n            min=0,\n            max=1,\n            step=0.1,\n            label=\"Opacity\",\n            classes=\"mt-1\",\n            hide_details=True,\n            dense=True,\n        )\n\n\n# -----------------------------------------------------------------------------\n# GUI\n# -----------------------------------------------------------------------------\n\nwith SinglePageWithDrawerLayout(server) as layout:\n    layout.title.set_text(\"Viewer\")\n\n    with layout.toolbar:\n        # toolbar components\n        vuetify.VSpacer()\n        vuetify.VDivider(vertical=True, classes=\"mx-2\")\n        standard_buttons()\n\n    with layout.drawer as drawer:\n        # drawer components\n        drawer.width = 325\n        pipeline_widget()\n        vuetify.VDivider(classes=\"mb-2\")\n        mesh_card()\n        contour_card()\n\n    with layout.content:\n        # content components\n        with vuetify.VContainer(\n            fluid=True,\n            classes=\"pa-0 fill-height\",\n        ):\n            # view = vtk.VtkRemoteView(renderWindow, interactive_ratio=1)\n            # view = vtk.VtkLocalView(renderWindow)\n            view = vtk.VtkRemoteLocalView(\n                renderWindow, namespace=\"view\", mode=\"local\", interactive_ratio=1\n            )\n            ctrl.view_update = view.update\n            ctrl.view_reset_camera = view.reset_camera\n            ctrl.on_server_ready.add(view.update)\n\n# -----------------------------------------------------------------------------\n# Main\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    server.start()\n
        "},{"location":"Trame/Applications/RemoteSelection/RemoteSelection/","title":"RemoteSelection","text":"

        vtk-examples/Trame/Applications/RemoteSelection

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Trame/Applications/RemoteSelection/RemoteSelection/#download-and-build-remoteselection","title":"Download and Build RemoteSelection","text":"

        Click here to download RemoteSelection. Once the tarball RemoteSelection.tar has been downloaded and extracted,

        cd RemoteSelection\n

        and run the application.

        See this trame tutorial for instructions on how to setup trame and run the application.

        "},{"location":"Trame/Applications/RemoteSelection/RemoteSelection/#code","title":"Code","text":""},{"location":"Trame/Applications/RemoteSelection/RemoteSelection/#apppy","title":"app.py","text":"
        \"\"\"\nVersion for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/VTK/Applications/RemoteSelection/app.py\nDelta v1..v2          - https://github.com/Kitware/trame/commit/03f28bb0084490acabf218264b96a1dbb3a17f19\n\"\"\"\n\nimport pandas as pd\n\n# Plotly/chart imports\nimport plotly.graph_objects as go\nimport plotly.express as px\n\n# Trame imports\nfrom trame.app import get_server\nfrom trame.assets.remote import HttpFile\nfrom trame.ui.vuetify import SinglePageLayout\nfrom trame.widgets import vuetify, plotly, vtk, trame\n\n# VTK imports\nfrom vtkmodules.vtkIOXML import vtkXMLUnstructuredGridReader\nfrom vtkmodules.numpy_interface import dataset_adapter as dsa\nfrom vtkmodules.vtkCommonDataModel import vtkSelection, vtkSelectionNode, vtkDataObject\nfrom vtkmodules.vtkCommonCore import vtkIdTypeArray\nfrom vtkmodules.vtkFiltersExtraction import vtkExtractSelection\nfrom vtkmodules.vtkFiltersGeometry import vtkGeometryFilter\nfrom vtkmodules.vtkRenderingCore import (\n    vtkActor,\n    vtkDataSetMapper,\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkHardwareSelector,\n    vtkRenderedAreaPicker,\n)\n\nfrom vtkmodules.vtkInteractionStyle import (\n    vtkInteractorStyleRubberBandPick,\n    vtkInteractorStyleSwitch,\n)  # noqa\nimport vtkmodules.vtkRenderingOpenGL2  # noqa\n\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleRubberBandPick\n\n# -----------------------------------------------------------------------------\n# Data file information\n# -----------------------------------------------------------------------------\n\ndataset_file = HttpFile(\n    \"./data/disk_out_ref.vtu\",\n    \"https://github.com/Kitware/trame/raw/master/examples/data/disk_out_ref.vtu\",\n    __file__,\n)\n\n# -----------------------------------------------------------------------------\n# Trame setup\n# -----------------------------------------------------------------------------\n\nserver = get_server()\nstate, ctrl = server.state, server.controller\n\n\n# -----------------------------------------------------------------------------\n# VTK\n# -----------------------------------------------------------------------------\n\nreader = vtkXMLUnstructuredGridReader()\nreader.SetFileName(dataset_file.path)\nreader.Update()\ndataset = reader.GetOutput()\n\nrenderer = vtkRenderer()\nrenderer.SetBackground(1, 1, 1)\nrender_window = vtkRenderWindow()\nrender_window.AddRenderer(renderer)\n\nrw_interactor = vtkRenderWindowInteractor()\nrw_interactor.SetRenderWindow(render_window)\nrw_interactor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\ninteractor_trackball = rw_interactor.GetInteractorStyle()\ninteractor_selection = vtkInteractorStyleRubberBandPick()\narea_picker = vtkRenderedAreaPicker()\nrw_interactor.SetPicker(area_picker)\n\nsurface_filter = vtkGeometryFilter()\nsurface_filter.SetInputConnection(reader.GetOutputPort())\nsurface_filter.SetPassThroughPointIds(True)\n\nmapper = vtkDataSetMapper()\nmapper.SetInputConnection(surface_filter.GetOutputPort())\nactor = vtkActor()\nactor.GetProperty().SetOpacity(0.5)\nactor.SetMapper(mapper)\n\n# Selection\nselection_extract = vtkExtractSelection()\nselection_mapper = vtkDataSetMapper()\nselection_mapper.SetInputConnection(selection_extract.GetOutputPort())\nselection_actor = vtkActor()\nselection_actor.GetProperty().SetColor(1, 0, 1)\nselection_actor.GetProperty().SetPointSize(5)\nselection_actor.SetMapper(selection_mapper)\nselection_actor.SetVisibility(0)\n\nrenderer.AddActor(actor)\nrenderer.AddActor(selection_actor)\nrenderer.ResetCamera()\n\nselector = vtkHardwareSelector()\nselector.SetRenderer(renderer)\nselector.SetFieldAssociation(vtkDataObject.FIELD_ASSOCIATION_POINTS)\n\n# vtkDataSet to DataFrame\npy_ds = dsa.WrapDataObject(dataset)\npt_data = py_ds.PointData\ncols = {}\nfor name in pt_data.keys():\n    array = pt_data[name]\n    shp = array.shape\n    if len(shp) == 1:\n        cols[name] = array\n    else:\n        for i in range(shp[1]):\n            cols[name + \"_%d\" % i] = array[:, i]\nDATAFRAME = pd.DataFrame(cols)\nFIELD_NAMES = list(cols.keys())\nSELECTED_IDX = []\n\n# -----------------------------------------------------------------------------\n# Callbacks\n# -----------------------------------------------------------------------------\n\n\n@state.change(\"figure_size\", \"scatter_x\", \"scatter_y\")\ndef update_figure(figure_size, scatter_x, scatter_y, **kwargs):\n    if figure_size is None:\n        return\n\n    # Generate figure\n    bounds = figure_size.get(\"size\", {})\n    fig = px.scatter(\n        DATAFRAME,\n        x=scatter_x,\n        y=scatter_y,\n        width=bounds.get(\"width\", 200),\n        height=bounds.get(\"height\", 200),\n    )\n\n    # Update selection settings\n    fig.data[0].update(\n        selectedpoints=SELECTED_IDX,\n        selected={\"marker\": {\"color\": \"red\"}},\n        unselected={\"marker\": {\"opacity\": 0.5}},\n    )\n\n    # Update chart\n    ctrl.update_figure(fig)\n\n\n# -----------------------------------------------------------------------------\n\n\n@state.change(\"vtk_selection\")\ndef update_interactor(vtk_selection, **kwargs):\n    if vtk_selection:\n        rw_interactor.SetInteractorStyle(interactor_selection)\n        interactor_selection.StartSelect()\n    else:\n        rw_interactor.SetInteractorStyle(interactor_trackball)\n\n\n# -----------------------------------------------------------------------------\n\n\ndef on_chart_selection(selected_point_idxs):\n    global SELECTED_IDX\n    SELECTED_IDX = selected_point_idxs if selected_point_idxs else []\n    npts = len(SELECTED_IDX)\n\n    ids = vtkIdTypeArray()\n    ids.SetNumberOfTuples(npts)\n    for idx, p_id in enumerate(SELECTED_IDX):\n        ids.SetTuple1(idx, p_id)\n        idx += 1\n\n    sel_node = vtkSelectionNode()\n    sel_node.GetProperties().Set(\n        vtkSelectionNode.CONTENT_TYPE(), vtkSelectionNode.INDICES\n    )\n    sel_node.GetProperties().Set(vtkSelectionNode.FIELD_TYPE(), vtkSelectionNode.POINT)\n    sel_node.SetSelectionList(ids)\n    sel = vtkSelection()\n    sel.AddNode(sel_node)\n\n    selection_extract.SetInputDataObject(0, py_ds.VTKObject)\n    selection_extract.SetInputDataObject(1, sel)\n    selection_extract.Update()\n    selection_actor.SetVisibility(1)\n\n    # Update 3D view\n    ctrl.view_update()\n\n\ndef on_box_selection_change(selection):\n    global SELECTED_IDX\n\n    actor.GetProperty().SetOpacity(1)\n    selector.SetArea(\n        int(renderer.GetPickX1()),\n        int(renderer.GetPickY1()),\n        int(renderer.GetPickX2()),\n        int(renderer.GetPickY2()),\n    )\n    s = selector.Select()\n    n = s.GetNode(0)\n    ids = dsa.vtkDataArrayToVTKArray(n.GetSelectionData().GetArray(\"SelectedIds\"))\n    surface = dsa.WrapDataObject(surface_filter.GetOutput())\n    SELECTED_IDX = surface.PointData[\"vtkOriginalPointIds\"][ids].tolist()\n\n    selection_extract.SetInputConnection(surface_filter.GetOutputPort())\n    selection_extract.SetInputDataObject(1, s)\n    selection_extract.Update()\n    selection_actor.SetVisibility(1)\n\n    actor.GetProperty().SetOpacity(0.5)\n\n    # Update scatter plot with selection\n    update_figure(**state.to_dict())\n\n    # Update 3D view\n    ctrl.view_update()\n\n    # disable selection mode\n    state.vtk_selection = False\n\n\n# -----------------------------------------------------------------------------\n# Settings\n# -----------------------------------------------------------------------------\n\nDROPDOWN_STYLES = {\n    \"dense\": True,\n    \"hide_details\": True,\n    \"classes\": \"px-2\",\n    \"style\": \"max-width: calc(25vw - 10px);\",\n}\n\nCHART_STYLE = {\n    \"style\": \"position: absolute; left: 50%; transform: translateX(-50%);\",\n    \"display_mode_bar\": (\"true\",),\n    \"mode_bar_buttons_to_remove\": (\n        \"chart_buttons\",\n        [\n            \"toImage\",\n            \"resetScale2d\",\n            \"zoomIn2d\",\n            \"zoomOut2d\",\n            \"toggleSpikelines\",\n            \"hoverClosestCartesian\",\n            \"hoverCompareCartesian\",\n        ],\n    ),\n    \"display_logo\": (\"false\",),\n}\n\nVTK_VIEW_SETTINGS = {\n    \"interactive_ratio\": 1,\n    \"interactive_quality\": 80,\n}\n\n# -----------------------------------------------------------------------------\n# UI\n# -----------------------------------------------------------------------------\n\nstate.trame__title = \"VTK selection\"\nctrl.on_server_ready.add(ctrl.view_update)\n\nwith SinglePageLayout(server) as layout:\n    layout.title.set_text(\"VTK & plotly\")\n    layout.icon.click = ctrl.view_reset_camera\n\n    with layout.toolbar as tb:\n        tb.dense = True\n        vuetify.VSpacer()\n        vuetify.VSelect(\n            v_model=(\"scatter_y\", FIELD_NAMES[1]),\n            items=(\"fields\", FIELD_NAMES),\n            **DROPDOWN_STYLES,\n        )\n        vuetify.VSelect(\n            v_model=(\"scatter_x\", FIELD_NAMES[0]),\n            items=(\"fields\", FIELD_NAMES),\n            **DROPDOWN_STYLES,\n        )\n\n    with layout.content:\n        with vuetify.VContainer(fluid=True, classes=\"fill-height pa-0 ma-0\"):\n            with vuetify.VRow(dense=True, style=\"height: 100%;\"):\n                with vuetify.VCol(\n                    classes=\"pa-0\",\n                    style=\"border-right: 1px solid #ccc; position: relative;\",\n                ):\n                    view = vtk.VtkRemoteView(\n                        render_window,\n                        box_selection=(\"vtk_selection\",),\n                        box_selection_change=(on_box_selection_change, \"[$event]\"),\n                        **VTK_VIEW_SETTINGS,\n                    )\n                    # view = vtk.VtkLocalView(\n                    #     render_window,\n                    #     box_selection=(\"vtk_selection\",),\n                    #     box_selection_change=(on_box_selection_change, \"[$event]\"),\n                    #     **VTK_VIEW_SETTINGS,\n                    # )\n                    ctrl.view_update = view.update\n                    ctrl.view_reset_camera = view.reset_camera\n                    vuetify.VCheckbox(\n                        small=True,\n                        on_icon=\"mdi-selection-drag\",\n                        off_icon=\"mdi-rotate-3d\",\n                        v_model=(\"vtk_selection\", False),\n                        style=\"position: absolute; top: 0; right: 0; z-index: 1;\",\n                        dense=True,\n                        hide_details=True,\n                    )\n                with vuetify.VCol(classes=\"pa-0\"):\n                    with trame.SizeObserver(\"figure_size\"):\n                        html_plot = plotly.Figure(\n                            selected=(\n                                on_chart_selection,\n                                \"[$event?.points.map(({pointIndex}) => pointIndex)]\",\n                            ),\n                            **CHART_STYLE,\n                        )\n                        ctrl.update_figure = html_plot.update\n\n# -----------------------------------------------------------------------------\n# Main\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    server.start()\n
        "},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/","title":"SimpleCone","text":"

        vtk-examples/Trame/MiniApps/SimpleCone

        "},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#description","title":"Description","text":"

        This example illustrates basic usage of VTK with trame.

        Things you can do:

        • Add some color using vtkNamedColors to the actor and background.
        • Use a different source e.g. vtkCylinderSource instead of vtkConeSource.

        See: Cone for some ideas.

        Question

        If you have a question about this example, please use the VTK Discourse Forum

        "},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#download-and-build-simplecone","title":"Download and Build SimpleCone","text":"

        Click here to download SimpleCone. Once the tarball SimpleCone.tar has been downloaded and extracted,

        cd SimpleCone\n

        and run the application.

        See this trame tutorial for instructions on how to setup trame and run the application.

        "},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#code","title":"Code","text":""},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#remoterenderingpy","title":"RemoteRendering.py","text":"
        from trame import state\nfrom trame.html import vuetify, vtk\nfrom trame.layouts import SinglePage\n\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkPolyDataMapper,\n    vtkActor,\n)\n\n# VTK factory initialization\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch  # noqa\nimport vtkmodules.vtkRenderingOpenGL2  # noqa\n\n# -----------------------------------------------------------------------------\n# VTK code\n# -----------------------------------------------------------------------------\n\nDEFAULT_RESOLUTION = 6\n\nrenderer = vtkRenderer()\nrenderWindow = vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n\nrenderWindowInteractor = vtkRenderWindowInteractor()\nrenderWindowInteractor.SetRenderWindow(renderWindow)\nrenderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\ncone_source = vtkConeSource()\nmapper = vtkPolyDataMapper()\nactor = vtkActor()\nmapper.SetInputConnection(cone_source.GetOutputPort())\nactor.SetMapper(mapper)\nrenderer.AddActor(actor)\nrenderer.ResetCamera()\nrenderWindow.Render()\n\n\n@state.change(\"resolution\")\ndef update_cone(resolution=DEFAULT_RESOLUTION, **kwargs):\n    cone_source.SetResolution(resolution)\n    html_view.update()\n\n\ndef update_reset_resolution():\n    state.resolution = DEFAULT_RESOLUTION\n\n\n# -----------------------------------------------------------------------------\n# GUI\n# -----------------------------------------------------------------------------\n\nhtml_view = vtk.VtkRemoteView(renderWindow, ref=\"view\")\n\nlayout = SinglePage(\"VTK Remote rendering\", on_ready=update_cone)\nlayout.logo.click = html_view.reset_camera\nlayout.title.set_text(\"Cone Application\")\n\nwith layout.toolbar:\n    vuetify.VSpacer()\n    vuetify.VSlider(\n        v_model=(\"resolution\", DEFAULT_RESOLUTION),\n        min=3,\n        max=60,\n        step=1,\n        hide_details=True,\n        dense=True,\n        style=\"max-width: 300px\",\n    )\n    vuetify.VDivider(vertical=True, classes=\"mx-2\")\n    with vuetify.VBtn(icon=True, click=update_reset_resolution):\n        vuetify.VIcon(\"mdi-undo-variant\")\n\nwith layout.content:\n    vuetify.VContainer(\n        fluid=True,\n        classes=\"pa-0 fill-height\",\n        children=[html_view],\n    )\n\n# Uncomment following line to hide footer\n# layout.footer.hide()\n\n# Uncomment following line to change logo to use mdi icon\n# layout.logo.children = [vuetify.VIcon('mdi-menu')]\n\n# -----------------------------------------------------------------------------\n# Main\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    layout.start()\n
        "},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#code_1","title":"Code","text":""},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#localrenderingpy","title":"LocalRendering.py","text":"
        from trame import state\nfrom trame.html import vuetify, vtk\nfrom trame.layouts import SinglePage\n\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\nfrom vtkmodules.vtkRenderingCore import (\n    vtkRenderer,\n    vtkRenderWindow,\n    vtkRenderWindowInteractor,\n    vtkPolyDataMapper,\n    vtkActor,\n)\nfrom vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch  # noqa\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nDEFAULT_RESOLUTION = 6\n\nrenderer = vtkRenderer()\nrenderWindow = vtkRenderWindow()\nrenderWindow.AddRenderer(renderer)\n\nrenderWindowInteractor = vtkRenderWindowInteractor()\nrenderWindowInteractor.SetRenderWindow(renderWindow)\nrenderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()\n\ncone_source = vtkConeSource()\nmapper = vtkPolyDataMapper()\nactor = vtkActor()\nmapper.SetInputConnection(cone_source.GetOutputPort())\nactor.SetMapper(mapper)\nrenderer.AddActor(actor)\nrenderer.ResetCamera()\nrenderWindow.Render()\n\n# -----------------------------------------------------------------------------\n# Callbacks\n# -----------------------------------------------------------------------------\n\n\n@state.change(\"resolution\")\ndef update_cone(resolution=DEFAULT_RESOLUTION, **kwargs):\n    cone_source.SetResolution(resolution)\n    html_view.update()\n\n\ndef update_reset_resolution():\n    state.resolution = DEFAULT_RESOLUTION\n\n\n# -----------------------------------------------------------------------------\n# GUI\n# -----------------------------------------------------------------------------\n\nhtml_view = vtk.VtkLocalView(renderWindow, ref=\"view\")\n\nlayout = SinglePage(\"VTK Remote View - Local Rendering\", on_ready=update_cone)\nlayout.logo.click = html_view.reset_camera\nlayout.title.set_text(\"Cone Application\")\n\nwith layout.toolbar:\n    vuetify.VSpacer()\n    vuetify.VSlider(\n        v_model=(\"resolution\", DEFAULT_RESOLUTION),\n        min=3,\n        max=60,\n        step=1,\n        hide_details=True,\n        dense=True,\n        style=\"max-width: 300px\",\n    )\n    vuetify.VDivider(vertical=True, classes=\"mx-2\")\n    with vuetify.VBtn(icon=True, click=update_reset_resolution):\n        vuetify.VIcon(\"mdi-undo-variant\")\n\n\nwith layout.content:\n    vuetify.VContainer(\n        fluid=True,\n        classes=\"pa-0 fill-height\",\n        children=[html_view],\n    )\n\n\n# -----------------------------------------------------------------------------\n# Main\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    layout.start()\n
        "},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#code_2","title":"Code","text":""},{"location":"Trame/MiniApps/SimpleCone/SimpleCone/#clientviewpy","title":"ClientView.py","text":"
        from trame import state\nfrom trame.html import vuetify, vtk\nfrom trame.layouts import SinglePage\n\nfrom vtkmodules.vtkFiltersSources import vtkConeSource\n\n# -----------------------------------------------------------------------------\n# VTK pipeline\n# -----------------------------------------------------------------------------\n\nDEFAULT_RESOLUTION = 6\n\ncone_generator = vtkConeSource()\n\n# -----------------------------------------------------------------------------\n# Callbacks\n# -----------------------------------------------------------------------------\n\n\n@state.change(\"resolution\")\ndef update_cone(resolution=DEFAULT_RESOLUTION, **kwargs):\n    cone_generator.SetResolution(resolution)\n    html_polydata.update()\n\n\ndef update_reset_resolution():\n    state.resolution = DEFAULT_RESOLUTION\n\n\n# -----------------------------------------------------------------------------\n# GUI\n# -----------------------------------------------------------------------------\n\nhtml_polydata = vtk.VtkPolyData(\"cone\", dataset=cone_generator)\n\nlayout = SinglePage(\"VTK Local rendering\", on_ready=update_cone)\nlayout.logo.click = \"$refs.view.resetCamera()\"\nlayout.title.set_text(\"Cone Application\")\n\nwith layout.toolbar:\n    vuetify.VSpacer()\n    vuetify.VSlider(\n        v_model=(\"resolution\", DEFAULT_RESOLUTION),\n        min=3,\n        max=60,\n        step=1,\n        hide_details=True,\n        dense=True,\n        style=\"max-width: 300px\",\n    )\n    vuetify.VDivider(vertical=True, classes=\"mx-2\")\n\n    with vuetify.VBtn(icon=True, click=update_reset_resolution):\n        vuetify.VIcon(\"mdi-undo-variant\")\n\n\nwith layout.content:\n    with vuetify.VContainer(fluid=True, classes=\"pa-0 fill-height\"):\n        with vtk.VtkView():\n            vtk.VtkGeometryRepresentation(html_polydata)\n\n\n# -----------------------------------------------------------------------------\n# Main\n# -----------------------------------------------------------------------------\n\nif __name__ == \"__main__\":\n    layout.start()\n
        "},{"location":"VTKBook/00Preface/","title":"Preface","text":"

        Visualization is a great field to work in these days. Advances in computer hardware and software have brought this technology into the reach of nearly every computer system. Even the ubiquitous personal computer now offers specialized 3D graphics hardware at discount prices. And with recent releases of the Windows operating systems such as XP, OpenGL has become the de facto standard API for 3D graphics.

        We view visualization and visual computing as nothing less than a new form of communication. All of us have long known the power of images to convey information, ideas, and feelings. Recent trends have brought us 2D images and graphics as evidenced by the variety of graphical user interfaces and business plotting software. But 3D images have been used sparingly, and often by specialists using specialized systems. Now this is changing. We believe we are entering a new era where 3D images, visualizations, and animations will begin to extend, and in some cases, replace the current communication paradigm based on words, mathematical symbols, and 2D images. Our hope is that along the way the human imagination will be freed like never before.

        This text and companion software offers one view of visualization. The field is broad, including elements of computer graphics, imaging, computer science, computational geometry, numerical analysis, statistical methods, data analysis, and studies in human perception. We certainly do not pretend to cover the field in its entirety. However, we feel that this text does offer you a great opportunity to learn about the fundamentals of visualization. Not only can you learn from the written word and companion images, but the included software will allow you to practice visualization. You can start by using the sample data we have provided here, and then move on to your own data and applications. We believe that you will soon appreciate visualization as much as we do.

        In this, the third edition of Visualization Toolkit textbook, we have added several new features since the first and second editions. Volume rendering is now extensively supported, including the ability to combine opaque surface graphics with volumes. We have added an extensive image processing pipeline that integrates conventional 3D visualization and graphics with imaging. Besides several new filters such as clipping, smoothing, 2D/3D Delaunay triangulation, and new decimation algorithms, we have added several readers and writers, and better support net-based tools such as Java and VRML. VTK now supports cell attributes, and attributes have been generalized into data arrays that are labeled as being scalars, vectors, and so on. Parallel processing, both shared-memory and distributed models, is a major addition. For example, VTK has been used on a large 1024-processor computer at the US National Labs to process nearly a pit-a-pat of data. A suite of 3D widgets is now available in VTK, enabling powerful data interaction techniques. Finally, VTK's cross-platform support has greatly improved with the addition of CMake---a very nice tool for managing the compile process ( http://www.cmake.org ).

        The additions of these features required the support of three special contributors to the text: Lisa Sobierajski Avila, Rick Avila, and C. Charles Law. Rick and Lisa worked hard to create an object-oriented design for volume rendering, and to insure that the design and software is fully compatible with the surface-based rendering system. Charles is the principle architect and implementor for the imaging pipeline. We are proud of the streaming and caching capability of the architecture: It allows us to handle large data sets despite limited memory resources.

        Especially satisfying has been the response from users of the text and software. Not only have we received a warm welcome from these wonderful people, but many of them have contributed code, bug fixes, data, and ideas that greatly improved the system. In fact, it would be best to categorize these people as co-developers rather than users of the system. We would like to encourage anyone else who is interested in sharing their ideas, code, or data to contact the VTK user community at http://www.vtk.org , or one of the authors. We would very much welcome any contributions you have to make. Contact us at http://www.kitware.com.

        "},{"location":"VTKBook/00Preface/#acknowledgments","title":"Acknowledgments","text":"

        During the creation of the Visualization Toolkit we were fortunate to have the help of many people. Without their aid this book and the associated software might never have existed. Their contributions included performing book reviews, discussing software ideas, creating a supportive environment, and providing key suggestions for some of our algorithms and software implementations.

        We would like to first thank our management at the General Electric Corporate R&D Center who allowed us to pursue this project and utilize company facilities: Peter Meenan, Manager of the Computer Graphics and Systems Program, and Kirby Vosburgh, Manager of the Electronic Systems Laboratory. We would also like to thank management at GE Medical Systems who worked with us on the public versus proprietary software issues: John Lalonde, John Heinen, and Steve Roehm.

        We thank our co-workers at the R&D Center who have all been supportive: Matt Turek, for proof reading much of the second edition; also Majeid Alyassin, Russell Blue, Jeanette Bruno, Shane Chang, Nelson Corby, Rich Hammond, Margaret Kelliher, Tim Kelliher, Joyce Langan, Paul Miller, Chris Nafis, Bob Tatar, Chris Volpe, Boris Yamrom, Bill Hoffman (now at Kitware), Harvey Cline and Siegwalt Ludke. We thank former co-workers Skip Montanaro (who created a FAQ for us), Dan McLachlan and Michelle Barry. We'd also like to thank our friends and co-workers at GE Medical Systems: Ted Hudacko (who managed the first VTK users mailing list), Darin Okerlund, and John Skinner. Many ideas, helpful hints, and suggestions to improve the system came from this delightful group of people.

        The third edition is now published by Kitware, Inc. We very much appreciate the efforts of the many contributors at Kitware who have helped make VTK one of the leading visualization systems in the world today. S\u00e9bastien Barr\u00e9, Andy Cedilnik, Berk Geveci, Amy Henderson, and Brad King have each made significant contributions. Thank also to the folks at GE Global Research such as Jim Miller who continue to push the quality of the system, particularly with the creation of the DART system for regression testing. The US National Labs, led by Jim Ahrens of Los Alamos, has been instrumental in adding parallel processing support to VTK. An additional special thanks to Kitware for accepting the challenge of publishing this book.

        Many of the bug fixes and improvements found in the second and third editions came from talented people located around the world. Some of these people are acknowledged in the software and elsewhere in the text, but most of them have contributed their time, knowledge, code, and data without regard for recognition and acknowledgment. It is this exchange of ideas and information with people like this that makes the Visualization Toolkit such a fun and exciting project to work on. In particular we would like to thank John Biddiscombe, Charl P. Botha, David Gobbi, Tim Hutton, Dean Inglis, and Prabhu Ramachandran. Thank you very much.

        A special thanks to the software and text reviewers who spent their own time to track down some nasty bugs, provide examples, and offer suggestions and improvements. Thank you Tom Citriniti, Mark Miller, George Petras, Hansong Zhang, Penny Rheingans, Paul Hinker, Richard Ellson, and Roger Crawfis. We'd also like to mention that Tom Citriniti at Rensselaer, and Penny Rheingans at the University of Mississippi (now at the University of Maryland Baltimore County) were the first faculty members to teach from early versions of this text. Thank you Penny and Tom for your feedback and extra effort.

        Most importantly we would like to thank our friends and loved ones who supported us patiently during this project. We know that you shouldered extra load for us. You certainly saw a lot less of us! But we're happy to say that we're back. Thank you.

        "},{"location":"VTKBook/01Chapter1/","title":"Chapter 1 - Introduction","text":"

        Visualization transforms numbers to images.

        Visualization --- \"2: the act or process of interpreting in visual terms or of putting into visual form,\" Webster's Ninth New Collegiate Dictionary.

        "},{"location":"VTKBook/01Chapter1/#11-what-is-visualization","title":"1.1 What Is Visualization?","text":"

        Visualization is a part of our everyday life. From weather maps to the exciting computer graphics of the entertainment industry, examples of visualization abound. But what is visualization? Informally, visualization is the transformation of data or information into pictures. Visualization engages the primary human sensory apparatus, vision, as well as the processing power of the human mind. The result is a simple and effective medium for communicating complex and/or voluminous information.

        "},{"location":"VTKBook/01Chapter1/#terminology","title":"Terminology","text":"

        Different terminology is used to describe visualization. Scientific visualization is the formal name given to the field in computer science that encompasses user interface, data representation and processing algorithms, visual representations, and other sensory presentation such as sound or touch [McCormick87]. The term data visualization is another phrase used to describe visualization. Data visualization is generally interpreted to be more general than scientific visualization, since it implies treatment of data sources beyond the sciences and engineering. Such data sources include financial, marketing, or business data. In addition, the term data visualization is broad enough to include application of statistical methods and other standard data analysis techniques [Rosenblum94]. Another recently emerging term is information visualization. This field endeavors to visualize abstract information such as hypertext documents on the World Wide Web, directory/ file structures on a computer, or abstract data structures [InfoVis95]. A major challenge facing information visualization researchers is to develop coordinate systems, transformation methods, or structures that meaningfully organize and represent data.

        Another way to classify visualization technology is to examine the context in which the data exists. If the data is spatial-temporal in nature (up to three spatial coordinates and the time dimension) then typically methods from scientific visualization are used. If the data exists in higher-dimensional spaces, or abstract spaces, then methods from information visualization are used. This distinction is important, because the human perceptual system is highly tuned to space-time relationships. Data expressed in this coordinate system is inherently understood with little need for explanation. Visualization of abstract data typically requires extensive explanations as to what is being viewed. This is not to say that there is no overlap between scientific and information visualization---often the first step in the information visualization process is to project abstract data into the spatial-temporal domain, and then use the methods of scientific visualization to view the results. The projection process can be quite complex, involving methods of statistical graphics, data mining, and other techniques, or it may be as simple as selecting a lower-dimensional subset of the original data.

        In this text we use the term data visualization instead of the more specific terms scientific visualization or information visualization. We feel that scientific visualization is too narrow a description of the field, since visualization techniques have moved beyond the scientific domain and into areas of business, social science, demographics, and information management in general. We also feel that the term data visualization is broad enough to encompass the term information visualization.

        "},{"location":"VTKBook/01Chapter1/#examples-of-visualization","title":"Examples of Visualization","text":"

        Perhaps the best definition of visualization is offered by example. In many cases visualization is influencing peoples' lives and performing feats that a few years ago would have been unimaginable. A prime example of this is its application to modern medicine.

        Computer imaging techniques have become an important diagnostic tool in the practice of modern medicine. These include techniques such as X-ray Computed Tomography (CT) and Magnetic Resonance Imaging (MRI). These techniques use a sampling or data acquisition process to capture information about the internal anatomy of a living patient. This information is in the form of slice-planes or cross-sectional images of a patient, similar to conventional photographic X-rays. CT imaging uses many pencil thin X-rays to acquire the data, while MRI combines large magnetic fields with pulsed radio waves. Sophisticated mathematical techniques are used to reconstruct the slice-planes. Typically, many such closely spaced slices are gathered together into a volume of data to complete the study.

        As acquired from the imaging system, a slice is a series of numbers representing the attenuation of X-rays (CT) or the relaxation of nuclear spin magnetization (MRI) [Krestel90]. On any given slice these numbers are arranged in a matrix, or regular array. The amount of data is large, so large that it is not possible to understand the data in its raw form. However, by assigning to these numbers a gray scale value, and then displaying the data on a computer screen, structure emerges. This structure results from the interaction of the human visual system with the spatial organization of the data and the gray-scale values we have chosen. What the computer represents as a series of numbers, we see as a cross section through the human body: skin, bone, and muscle. Even more impressive results are possible when we extend these techniques into three dimensions. Image slices can be gathered into volumes and the volumes can be processed to reveal complete anatomical structures. Using modern techniques, we can view the entire brain, skeletal system, and vascular system on a living patient without interventional surgery. Such capability has revolutionized modern medical diagnostics, and will increase in importance as imaging and visualization technology matures.

        Another everyday application of visualization is in the entertainment industry. Movie and television producers routinely use computer graphics and visualization to create entire worlds that we could never visit in our physical bodies. In these cases we are visualizing other worlds as we imagine them, or past worlds we suppose existed. It's hard to watch the movies such as Jurassic Park and Toy Story and not gain a deeper appreciation for the awesome Tyrannosaurus Rex, or to be charmed by Toy Story 's heroic Buzz Lightyear.

        Morphing is another popular visualization technique widely used in the entertainment industry. Morphing is a smooth blending of one object into another. One common application is to morph between two faces. Morphing has also been used effectively to illustrate car design changes from one year to the next. While this may seem like an esoteric application, visualization techniques are used routinely to present the daily weather report. The use of isovalue, or contour, lines to display areas of constant temperature, rainfall, and barometric pressure has become a standard tool in the daily weather report.

        Many early uses of visualization were in the engineering and scientific community. From its inception the computer has been used as a tool to simulate physical processes such as ballistic trajectories, fluid flow, and structural mechanics. As the size of the computer simulations grew, it became necessary to transform the resulting calculations into pictures. The amount of data overwhelmed the ability of the human to assimilate and understand it. In fact, pictures were so important that early visualizations were created by manually plotting data. Today, we can take advantage of advances in computer graphics and computer hardware. But, whatever the technology, the application of visualization is the same: to display the results of simulations, experiments, measured data, and fantasy; and to use these pictures to communicate, understand, and entertain.

        "},{"location":"VTKBook/01Chapter1/#12-why-visualize","title":"1.2 Why Visualize?","text":"

        Visualization is a necessary tool to make sense of the flood of information in today's world of computers. Satellites, supercomputers, laser digitizing systems, and digital data acquisition systems acquire, generate, and transmit data at prodigious rates. The Earth-Orbiting Satellite (EOS) transmits terabytes of data every day. Laser scanning systems generate over 500,000 points in a 15 second scan [Waters91]. Supercomputers model weather patterns over the entire earth [Chen93]. In the first four months of 1995, the New York Stock Exchange processed, on average, 333 million transactions per day [NYTimes]. Without visualization, most of this data would sit unseen on computer disks and tapes. Visualization offers some hope that we can extract the important information hidden within the data.

        There is another important element to visualization: It takes advantage of the natural abilities of the human vision system. Our vision system is a complex and powerful part of our bodies. We use it and rely on it in almost everything we do. Given the environment in which our ancestors lived, it is not surprising that certain senses developed to help them survive. As we described earlier in the example of a 2D MRI scan, visual representations are easier to work with. Not only do we have strong 2D visual abilities, but also we are adept at integrating different viewpoints and other visual clues into a mental image of a 3D object or plot. This leads to interactive visualization, where we can manipulate our viewpoint. Rotating about the object helps to achieve a better understanding. Likewise, we have a talent for recognizing temporal changes in an image. Given an animation consisting of hundreds of frames, we have an uncanny ability to recognize trends and spot areas of rapid change.

        With the introduction of computers and the ability to generate enormous amounts of data, visualization offers the technology to make the best use of our highly developed visual senses. Certainly other technologies such as statistical analysis, artificial intelligence, mathematical filtering, and sampling theory will play a role in large-scale data processing. However, because visualization directly engages the vision system and human brain, it remains an unequaled technology for understanding and communicating data.

        Visualization offers significant financial advantages as well. In today's competitive markets, computer simulation teamed with visualization can reduce product cost and improve time to market. A large cost of product design has been the expense and time required to create and test design prototypes. Current design methods strive to eliminate these physical prototypes, and replace them with digital equivalents. This digital prototyping requires the ability to create and manipulate product geometry, simulate the design under a variety of operating conditions, develop manufacturing techniques, demonstrate product maintenance and service procedures, and even train operators on the proper use of the product before it is built. Visualization plays a role in each case. Already CAD systems are used routinely to model product geometry and design manufacturing procedures. Visualization enables us to view the geometry, and see special characteristics such as surface curvature. For instance, analysis techniques such as finite element, finite difference, and boundary element techniques are used to simulate product performance; and visualization is used to view the results. Recently, human ergonomics and anthropometry are being analyzed using computer techniques in combination with visualization [MDHMS]. Three-dimensional graphics and visualization are being used to create training sequences. Often these are incorporated into a hypertext document or World Wide Web (WWW) pages. Another practical use of graphics and visualization has been in-flight simulators. This has been shown to be a significant cost savings as compared to flying real airplanes and is an effective training method.

        "},{"location":"VTKBook/01Chapter1/#13-imaging-computer-graphics-and-visualization","title":"1.3 Imaging, Computer Graphics, and Visualization","text":"

        There is confusion surrounding the difference between imaging, computer graphics, and visualization. We offer these definitions.

        • Imaging, or image processing, is the study of 2D pictures, or images. This includes techniques to transform (e.g., rotate, scale, shear), extract information from, analyze, and enhance images.
        Figure 1-1. The visualization process. Data from various sources is repeatedly transformed to extract, derive, and enhance information. The resulting data is mapped to a graphics system for display.
        • Computer graphics is the process of creating images using a computer. This includes both 2D paint-and-draw techniques as well as more sophisticated 3D drawing (or rendering) techniques.

        • Visualization is the process of exploring, transforming, and viewing data as images (or other sensory forms) to gain understanding and insight into the data.

        Based on these definitions we see that there is overlap between these fields. The output of computer graphics is an image, while the output of visualization is often produced using computer graphics. Sometimes visualization data is in the form of an image, or we wish to visualize object geometry using realistic rendering techniques from computer graphics.

        Generally speaking we distinguish visualization from computer graphics and image processing in three ways.

        1. The dimensionality of data is three dimensions or greater. Many well-known methods are available for data of two dimensions or less; visualization serves best when applied to data of higher dimension.

        2. Visualization concerns itself with data transformation. That is, information is repeatedly created and modified to enhance the meaning of the data.

        3. Visualization is naturally interactive, including the human directly in the process of creating, transforming, and viewing data.

        Another perspective is that visualization is an activity that encompasses the process of exploring and understanding data. This includes both imaging and computer graphics as well as data processing and filtering, user interface methodology, computational techniques, and software design. Figure 1-1 depicts this process.

        As this figure illustrates we see that the visualization process focuses on data. In the first step data is acquired from some source. Next, the data is transformed by various methods, and then mapped to a form appropriate for presentation to the user. Finally, the data is rendered or displayed, completing the process. Often, the process repeats as the data is better understood or new models are developed. Sometimes the results of the visualization can directly control the generation of the data. This is often referred to as analysis steering. Analysis steering is an important goal of visualization because it enhances the interactivity of the overall process.

        "},{"location":"VTKBook/01Chapter1/#14-origins-of-data-visualization","title":"1.4 Origins of Data Visualization","text":"

        The origin of visualization as a formal discipline dates to the 1987 NSF report Visualization in Scientific Computing [McCormick87]. That report coined the term scientific visualization. Since then the field has grown rapidly with major conferences, such as IEEE Visualization, becoming well established. Many large computer graphics conferences, for example ACM SIGGRAPH, devote large portions of their program to visualization technology.

        Of course, data visualization technology had existed for many years before the 1987 report referenced [Tufte83]. The first practitioners recognized the value of presenting data as images. Early pictorial data representations were created during the eighteenth century with the arrival of statistical graphics. It was only with the arrival of the digital computer and the development of the field of computer graphics, that visualization became a practicable discipline.

        The future of data visualization and graphics appears to be explosive. Just a few decades ago, the field of data visualization did not exist and computer graphics was viewed as an offshoot of the more formal discipline of computer science. As techniques were created and computer power increased, engineers, scientists, and other researchers began to use graphics to understand and communicate data. At the same time, user interface tools were being developed. These forces have now converged to the point where we expect computers to adapt to humans rather than the other way around. As such, computer graphics and data visualization serve as the window into the computer, and more importantly, into the data that computers manipulate. Now, with the visualization window, we can extract information from data and analyze, understand, and manage more complex systems than ever before.

        Dr. Fred Brooks, Kenan Professor of Computer Science at the University of North Carolina at Chapel Hill and recipient of the John von Neumann Medal of the IEEE, puts it another way. At the award presentation at the ACM SIGGRAPH '94, Dr. Brooks stated that computer graphics and visualization offer \"intelligence amplification\" (IA) as compared to artificial intelligence (AI). Besides the deeper philosophical issues surrounding this issue (e.g., human before computer), it is a pragmatic observation. While the long-term goal of AI has been to develop computer systems that could replace humans in certain applications, the lack of real progress in this area has lead some researchers to view the role of computers as amplifiers and assistants to humans. In this view, computer graphics and visualization play a significant role, since arguably the most effective human/ computer interface is visual. Recent gains in computer power and memory are only accelerating this trend, since it is the interface between the human and the computer that often is the obstacle to the effective application of the computer.

        "},{"location":"VTKBook/01Chapter1/#15-purpose-of-this-book","title":"1.5 Purpose of This Book","text":"

        There currently exist texts that define and describe data visualization, many of them using case studies to illustrate techniques and typical applications. Some provide high-level descriptions of algorithms or visualization system architectures. Detailed descriptions are left to academic journals or conference proceedings. What these texts lack is a way to practice visualization. Our aim in this text is to go beyond descriptions and provide tools to learn about and apply visualization to your own application area. In short, the purpose of the book is fourfold.

        1. Describe visualization algorithms and architectures in detail.

        2. Demonstrate the application of data visualization to a broad selection of case studies.

        3. Provide a working architecture and software design for application of data visualization to real-world problems.

        4. Provide effective software tools packaged in a C++ class library. We also provide language bindings for the interpreted languages Tcl, Python, and Java.

        Taken together, we refer to the text and software as the Visualization Toolkit, or VTK for short. Our hope is that you can use the text to learn about the fundamental concepts of visualization, and then adapt the computer code to your own applications and data.

        "},{"location":"VTKBook/01Chapter1/#16-what-this-book-is-not","title":"1.6 What This Book Is Not","text":"

        The purpose of this book is not to provide a rigorous academic treatise on data visualization. Nor do we intend to include an exhaustive survey of visualization technology. Our goal is to bridge the formal discipline of data visualization with practical application, and to provide a solid technical overview of this emerging technology. In many cases we refer you to the included software to understand implementation details. You may also wish to refer to the appropriate references for further information.

        "},{"location":"VTKBook/01Chapter1/#17-intended-audience","title":"1.7 Intended Audience","text":"

        Our primary audience is computer users who create, analyze, quantify, and/or process data. We assume a minimal level of programming skill. If you can write simple computer code to import data and know how to run a computer program, you can practice data visualization with the software accompanying this book.

        As we wrote this book we also had in mind educators and students of introductory computer graphics and visualization courses. In more advanced courses this text may not be rigorous enough to serve as sole reference. In these instances, this book will serve well as a companion text, and the software is well suited as a foundation for programming projects and class exercises.

        Educators and students in other disciplines may also find the text and software to be valuable tools for presenting results. Courses in numerical analysis, computer science, business simulation, chemistry, dynamic systems, and engineering simulations, to name a few, often require large-scale programming projects that create large amounts of data. The software tools provided here are easy to learn and readily adapted to different data sources. Students can incorporate this software into their work to display and analyze their results.

        "},{"location":"VTKBook/01Chapter1/#18-how-to-use-this-book","title":"1.8 How to Use This Book","text":"

        There are a number of approaches you can take to make effective use of this book. The particular approach depends on your skill level and goals. Three likely paths are as follows:

        Novice. You're a novice if you lack basic knowledge of graphics, visualization, or object-oriented principles. Start by reading Chapter 2 if you are unfamiliar with object-oriented principles, Chapter 3 if you are unfamiliar with computer graphics, and Chapter 4 if you are unfamiliar with visualization. Continue by reading the application studies in Chapter 12. You can then move on to the CD-ROM and try out some programming examples. Leave the more detailed treatment of algorithms and data representation until you are familiar with the basics and plan to develop your own applications.

        Hacker. You're a hacker if you are comfortable writing your own code and editing other's. Review the examples in Chapter 3, Chapter 4, and Chapter 12. At this point you will want to acquire the companion software guide to this text ( The VTK User's Guide ) or become familiar with the programming resources at http://www.vtk.org. Then retrieve the examples from the CD-ROM and start practicing.

        Researcher/Educator. You're a researcher if you develop computer graphics and/or visualization algorithms or if you are actively involved in using and evaluating such systems. You're an educator if you cover aspects of computer graphics and/or visualization within your courses. Start by reading Chapter 2, Chapter 3, and Chapter 4. Select appropriate algorithms from the text and examine the associated source code. If you wish to extend the system, we recommend that you acquire the companion software guide to this text ( The VTK User's Guide ) or become familiar with the programming resources at http://www.vtk.org.

        "},{"location":"VTKBook/01Chapter1/#19-software-considerations-and-example-code","title":"1.9 Software Considerations and Example Code","text":"

        In writing this book we have attempted to strike a balance between practice and theory. We did not want the book to become a user manual, yet we did want a strong correspondence between algorithmic presentation and software implementation. (Note: The VTK User's Guide published by Kitware, Inc. http://www.kitware.com is recommended as a companion text to this book.) As a result of this philosophy, we have adopted the following approach:

        Application versus Design. The book's focus is the application of visualization techniques to real-world problems. We devote less attention to software design issues. Some of these important design issues include: memory management, deriving new classes, shallow versus deep object copy, single versus multiple inheritance, and interfaces to other graphics libraries. Software issues are covered in the companion text The VTK User's Guide published by Kitware, Inc.

        Theory versus Implementation. Whenever possible, we separate the theory of data visualization from our implementation of it. We felt that the book would serve best as a reference tool if the theory sections were independent of software issues and terminology. Toward the end of each chapter there are separate implementation or example sections that are implementation specific. Earlier sections are implementation free.

        Documentation. This text contains documentation considered essential to understanding the software architecture, including object diagrams and condensed object descriptions. More extensive documentation of object methods and data members is embedded in the software (in the.h header files) and on CD-ROM or online at http://www.vtk.org. In particular, the Doxygen generated manual pages contain detailed descriptions of class relationships, methods, and other attributes.

        We use a number of conventions in this text. Imported computer code is denoted with a typewriter font, as are external programs and computer files. To avoid conflict with other C++ class libraries, all class names in VTK begin with the \" vtk\" prefix. Methods are differentiated from variables with the addition of the \" ()\" postfix. (Other conventions are listed in VTK User's Guide.)

        All images in this text have been created using the Visualization Toolkit software and data found on the included CD-ROM or from the Web site http://www.vtk.org. In addition, every image has source code (sometimes in C++ and sometimes a Tcl script). We decided against using images from other researchers because we wanted you to be able to practice visualization with every example we present. Each computer generated image indicates the originating file. Files ending in.cxx are C++ code, files ending in.tcl are Tcl scripts. Hopefully these examples can serve as a starting point for you to create your own applications.

        To find the example code you will want to search in one of three areas. The standard VTK distribution includes an VTK/Examples directory where many well-documented examples are found. The VTK testing directories VTK/*/Testing, for example, VTK/Graphics/Testing/ Tcl, contain some of the example code used in this text. These examples use the data found in the VTKData distribution. Finally, a separate software distribution, the VTKTextbook distribution, contains examples and data that do not exist in the standard VTK distribution. The VTK, VTKData, and VTKTextbook distributions are found on the included CD-ROM and/or on the web site at http://www.vtk.org.

        "},{"location":"VTKBook/01Chapter1/#110-chapter-by-chapter-overview","title":"1.10 Chapter-by-Chapter Overview","text":""},{"location":"VTKBook/01Chapter1/#chapter-2-object-oriented-design","title":"Chapter 2: Object-Oriented Design","text":"

        This chapter discusses some of the problems with developing large and/or complex software systems and describes how object-oriented design addresses many of these problems. This chapter defines the key terms used in object-oriented modelling and design and works through a real-world example. The chapter concludes with a brief look at some object-oriented languages and some of the issues associated with object-oriented visualization.

        "},{"location":"VTKBook/01Chapter1/#chapter-3-computer-graphics-primer","title":"Chapter 3: Computer Graphics Primer*","text":"

        Computer graphics is the means by which our visualizations are created. This chapter covers the fundamental concepts of computer graphics from an application viewpoint. Common graphical entities such as cameras, lights, and geometric primitives are described along with some of the underlying physical equations that govern lighting and image generation. Issues related to currently available graphics hardware are presented, as they affect how and what we choose to render. Methods for interacting with data are introduced.

        "},{"location":"VTKBook/01Chapter1/#chapter-4-the-visualization-pipeline","title":"Chapter 4: The Visualization Pipeline","text":"

        This chapter explains our methodology for transforming raw data into a meaningful representation that can than be rendered by the graphics system. We introduce the notion of a visualization pipeline, which is similar to a data flow diagram from software engineering. The differences between process objects and data objects are covered, as well as how we resolved issues between performance and memory usage. We explain the advantages to a pipeline network topology regarding execution ordering, result caching, and reference counting.

        "},{"location":"VTKBook/01Chapter1/#chapter-5-basic-data-representation","title":"Chapter 5: Basic Data Representation","text":"

        There are many types of data produced by the variety of fields that apply visualization. This chapter describes the data objects that we use to represent and access such data. A flexible design is introduced where the programmer can interact with most any type of data using one consistent interface. The three high level components of data (structure, cells, and data attributes) are introduced, and their specific subclasses and components are discussed.

        "},{"location":"VTKBook/01Chapter1/#chapter-6-fundamental-algorithms","title":"Chapter 6: Fundamental Algorithms","text":"

        Where the preceding chapter deals with data objects, this one introduces process objects. These objects encompass the algorithms that transform and manipulate data. This chapter looks at commonly used techniques for isocontour extraction, scalar generation, color mapping, and vector field display, among others. The emphasis of this chapter is to provide the reader with a basic understanding of the more common and important visualization algorithms.

        "},{"location":"VTKBook/01Chapter1/#chapter-7-advanced-computer-graphics","title":"Chapter 7: Advanced Computer Graphics","text":"

        This chapter covers advanced topics in computer graphics. The chapter begins by introducing transparency and texture mapping, two topics important to the main thrust of the chapter: volume rendering. Volume rendering is a powerful technique to see inside of 3D objects, and is used to visualize volumetric data. We conclude the chapter with other advanced topics such as stereoscopic rendering, special camera effects, and 3D widgets.

        "},{"location":"VTKBook/01Chapter1/#chapter-8-advanced-data-representation","title":"Chapter 8: Advanced Data Representation","text":"

        Part of the function of a data object is to store the data. The first chapter on data representation discusses this aspect of data objects. This chapter focuses on basic geometric and topological access methods, and computational operations implemented by the various data objects. The chapter covers such methods as coordinate transformations for data sets, interpolation functions, derivative calculations, topological adjacency operations, and geometric operations such as line intersection and searching.

        "},{"location":"VTKBook/01Chapter1/#chapter-9-advanced-algorithms","title":"Chapter 9: Advanced Algorithms","text":"

        This chapter is a continuation of Fundamental Algorithms and covers algorithms that are either more complex or less widely used. Scalar algorithms such as dividing cubes are covered along with vector algorithms such as stream ribbons. A large collection of modelling algorithms is discussed, including triangle strip generation, polygon decimation, feature extraction, and implicit modelling. We conclude with a look at some visualization algorithms that utilize texture mapping.

        "},{"location":"VTKBook/01Chapter1/#chapter-10-image-processing","title":"Chapter 10: Image Processing","text":"

        While 3D graphics and visualization is the focus of the book, image processing is an important tool for preprocessing and manipulating data. In this chapter we focus on several important image processing algorithms, as well as describe how we use a streaming data representation to process large datasets.

        "},{"location":"VTKBook/01Chapter1/#chapter-11-visualization-on-the-web","title":"Chapter 11: Visualization on the Web","text":"

        The Web is one of the best places to share your visualizations. In this chapter we show you how to write Java-based visualization applications, and how to create VRML (Virtual Reality Modelling Language) data files for inclusion in your own Web content.

        "},{"location":"VTKBook/01Chapter1/#chapter-12-application","title":"Chapter 12: Application","text":"

        In this chapter we tie the previous chapters together by working through a series of case studies from a variety of application areas. For each case, we briefly describe the application and what information we expect to obtain through the use of visualization. Then, we walk through the design and resulting source code to demonstrate the use of the tools described earlier in the text.

        "},{"location":"VTKBook/01Chapter1/#111-legal-considerations","title":"1.11 Legal Considerations","text":"

        We make no warranties, expressly or implied, that the computer code contained in this text is free of error or will meet your requirements for any particular application. Do not use this code in any application where coding errors could result in injury to a person or loss of property. If you do use the code in this way, it is at your own risk. The authors and publisher disclaim all liability for direct or consequential damages resulting from your use of this code.

        The computer code contained in this text is copyrighted. We grant permission for you to use, copy, and distribute this software for any purpose. However, you may not modify and then redistribute the software. Some of the algorithms presented here are implementations of patented software. If you plan to use this software for commercial purposes, please insure that applicable patent laws are observed.

        Some of the data on the CD-ROM may be freely distributed or used (with appropriate acknowledgment). Refer to the local README files or other documentation for details.

        Several registered trademarks are used in this text. UNIX is a trademark of UNIX System Laboratories. Sun Workstation and XGL are trademarks of Sun Microsystems, Inc. Microsoft, MS, MS-DOS, and Windows are trademarks of Microsoft Corporation. The X Window System is a trademark of the Massachusetts Institute of Technology. Starbase and HP are trademarks of Hewlett-Packard Inc. Silicon Graphics and OpenGL, are trademarks of Silicon Graphics, Inc. Macintosh is a trademark of Apple Computer. RenderMan is a trademark of Pixar.

        "},{"location":"VTKBook/01Chapter1/#112-bibliographic-notes","title":"1.12 Bibliographic Notes","text":"

        A number of visualization texts are available. The first six texts listed in the reference section are good general references ( [Nielson90], [Patrikalakis91], [Brodlie92], [Wolff93], [Rosenblum94], and [Gallagher95] ). Gallagher [Gallagher95] is particularly valuable if you are from a computational background. Wolff and Yaeger [Wolff93] contains many beautiful images and is oriented towards Apple Macintosh users. The text includes a CD-ROM with images and software.

        You may also wish to learn more about computer graphics and imaging. Foley and van Dam [FoleyVanDam90] is the basic reference for computer graphics. Another recommended text is [BurgerGillies89]. Suggested reference books on computer imaging are [Pavlidis82] and [Wolberg90].

        Two texts by Tufte [Tufte83] [Tufte90] are particularly impressive. Not only are the graphics superbly done, but the fundamental philosophy of data visualization is articulated. He also describes the essence of good and bad visualization techniques.

        Another interesting text is available from Siemens, a large company offering medical imaging systems [Krestel90]. This text describes the basic concepts of imaging technology, including MRI and CT. This text is only for those users with a strong mathematical background. A less mathematical overview of MRI is available from [SmithRanallo89].

        To learn more about programming with Visualization Toolkit, we recommend the text The VTK User's Guide [UsersGuide]. This text has an extensive example suite as well as descriptions of the internals of the software. Programming resources including a detailed description of API's, VTK file formats, and class descriptions are provided.

        "},{"location":"VTKBook/01Chapter1/#113-references","title":"1.13 References","text":"

        [Brodlie92]1 K. W. Brodlie et al. Scientific Visualization Techniques and Applications. Springer-Verlag, Berlin, 1992.

        [BurgerGillies89] P. Burger and D. Gillies. Interactive Computer Graphics Functional, Procedural and Device-Level Methods. Addison-Wesley Publishing Company, Reading, MA, 1989.

        [Chen93] P. C. Chen. \"A Climate Simulation Case Study.\" In Proceedings of Visualization '93. pp. 397--401, IEEE Computer Society Press, Los Alamitos, CA, 1993.

        [FoleyVanDam90] J. D. Foley, A. van Dam, S. K. Feiner, and J. F. Hughes. Computer Graphics Principles and Practice (2d Ed). Addison-Wesley, Reading, MA, 1990.

        [Gallagher95] R. S. Gallagher (ed). Computer Visualization Graphics Techniques for Scientific and Engineering Analysis. CRC Press, Boca Raton, FL, 1995.

        [Krestel90] E. Krestel (ed). Imaging Systems for Medical Diagnostics. Siemens-Aktienges, Munich, 1990.

        [InfoVis95] The First Information Visualization Symposium. IEEE Computer Society Press, Los Alamitos, CA, 1995.

        [McCormick87] B. H. McCormick, T. A. DeFanti, and M. D. Brown. \"Visualization in Scientific Computing.\" Report of the NSF Advisory Panel on Graphics, Image Processing and Workstations , 1987.

        [MDHMS] McDonnell Douglas Human Modeling System Reference Manual. Report MDC 93K0281. McDonnell Douglas Corporation, Human Factors Technology, Version 2.1, July 1993.

        [Nielson90] G. M. Nielson and B. Shriver (eds). Visualization in Scientific Computing. IEEE Computer Society Press, Los Alamitos, CA, 1990.

        [NYTimes] The New York Times Business Day, Tuesday, May 2, 1995.

        [Patrikalakis91] N. M. Patrikalakis (ed). Scientific Visualization of Physical Phenomena. Springer-Verlag, Berlin, 1991.

        [Pavlidis82] T. Pavlidis. Graphics and Image Processing. Computer Science Press, Rockville, MD, 1982.

        [Rosenblum94] L. Rosenblum et al. Scientific Visualization Advances and Challenges. Harcourt Brace & Company, London, 1994.

        [SmithRanallo89] H. J. Smith and F. N. Ranallo. A Non-Mathematical Approach to Basic MRI. Medical Physics Publishing Corporation, Madison, WI, 1989.

        [Tufte83] E. R. Tufte. The Visual Display of Quantitative Information. Graphics Press, Cheshire, CT, 1990.

        [Tufte90] E. R. Tufte. Envisioning Information. Graphics Press, Cheshire, CT, 1990.

        [UsersGuide] W. Schroeder, ed. The VTK User's Guide. Kitware, Inc. http://www.kitware.com.

        [Waters91] K. Waters and D. Terzopoulos. \"Modeling and Animating Faces Using Scanned Data.\" Visualization and Computer Animation. 2:123--128, 1991.

        [Wolberg90] G. Wolberg. Digital Image Warping. IEEE Computer Society Press, Los Alamitos, CA, 1990.

        [Wolff93] R. S. Wolff and L. Yaeger. Visualization of Natural Phenomena. TELOS, Springer-Verlag, Santa Clara, CA, 1993.

        "},{"location":"VTKBook/02Chapter2/","title":"Chapter 2 - Object-Oriented Design","text":"

        Object-oriented systems are becoming widespread in the computer industry for good reason. Object-oriented systems are more modular, easier to maintain, and easier to describe than traditional procedural systems. Since the Visualization Toolkit has been designed and implemented using object-oriented design, we devote this chapter to summarizing the concepts and practice of object-oriented design and implementation.

        "},{"location":"VTKBook/02Chapter2/#21-introduction","title":"2.1 Introduction","text":"

        Today's software systems try to solve complex, real-world problems. A rigorous software design and implementation methodology can ease the burden of this complexity. Without such a methodology, software developers can find it difficult to meet a system's specifications. Furthermore, as specifications change and grow, a software system that does not have a solid, underlying architecture and design will have difficulty adapting to these expanding requirements.

        Our visualization system is a good example of complex software that needs to be designed with extensibility in mind. Data visualization is a rapidly expanding field, with visualization techniques being introduced each year. Any system that hopes to incorporate future innovations must have an underlying design that supports the addition of new material without a significant impact on the existing system.

        Object-oriented design is a software engineering methodology that deals comfortably with complexity and provides a framework for later changes and additions. The object-oriented design process attempts to divide a complex task into small and simple pieces called objects. The objects are computer abstractions that model physical or abstract pieces of the system being simulated. Object-oriented design methodologies provide mechanisms to identify the abstractions that exist within a system and to model the behavior of the objects.

        "},{"location":"VTKBook/02Chapter2/#22-goals-of-good-software-design","title":"2.2 Goals of Good Software Design","text":"

        The quality of a software design is difficult to measure, but some qualitative aspects can guide us. A good software design should be robust, understandable, extensible, modular, maintainable, and reusable.

        A robust system handles exceptional conditions gracefully and behaves consistently. Robustness gives software developers confidence that the underlying components of the system will behave as expected, even when the system is used under different circumstances than the original implementor intended.

        An understandable system can be used by someone other than the original implementor. The use of the system should seem logical and sensible. The names of the components of the system should be derived from the problem domain.

        Extendible systems accept new tasks while still doing the tasks they were originally intended to perform. A system should accept new forms of data and new algorithms without disrupting existing software. Adding a new primitive to the system should not cause large portions of the system to be modified. Experience shows that the more existing code that is modified in a system, the more likely errors will be introduced.

        Modular software systems minimize the number of relationships that exist between components of a system. System components that are tightly coupled should be grouped together logically and obey common naming conventions and protocols.

        Software maintenance is often ignored during system design. Nevertheless, the total cost of a system includes maintenance as well as the original development. A software system is maintainable if problems are easily isolated and the repair of one problem does not introduce problems in unrelated parts of the system.

        Finally, the economics of software development require that we leverage as much of our past work as possible. In an ideal world, the implementation of a new technique in an existing system should be a simple task. This is seldom the case in software systems. Creation of reusable software components can reduce duplication of effort and promote consistent interfaces within a system. However, as we see throughout this book, creating software that can be reused often takes extra effort. A short-term view of productivity by one individual conflicts with the long-term view of the productivity of a software development organization.

        "},{"location":"VTKBook/02Chapter2/#23-object-oriented-concepts","title":"2.3 Object-Oriented Concepts","text":"

        Objects are the dominating concepts in object-oriented systems. Objects are abstractions that encapsulate the properties and behavior of the entities within a system. Each object has an identity that distinguishes it from other objects in the system. Often, the distinguishable aspects of an object are obvious. For example, a difference in color, location on a screen, size, or contents distinguishes one window from another on a computer desktop. But, appearances can be deceiving, and even two objects that share all the same characteristics may still have different identities. Two automobiles may have the same manufacturer, model, options and colors, but remain two different cars. The real world distinguishes the two cars by a vehicle identification number. Likewise, programming systems that deal with multiple entities need an identity mechanism. A pointer to allocated memory or a variable name in a system-managed symbol table are often used to distinguish objects in a system. In a database system, a set of identifier keys (called an n-tuple) identifies an entity in a system.

        But, how do object-oriented systems differ from conventional, procedural programming systems? The major difference is in the way the two approaches treat data abstraction. Conventional systems limit abstraction to data typing, while object-oriented systems create abstractions for both the data and the operations that can be applied to the data. In fact, an object-oriented system keeps the data and operations together in one programming construct called an object. Together, the data and operations comprise an object's properties. When an operation is applied to an object, the programming language's dynamic-binding mechanism executes the procedure that is appropriate for that object. This is not the case in procedure-oriented systems. The programmer must supply logic to decide which procedure to call. Systems that handle multiple types are often littered with case statements to select the appropriate procedure for an operation. As new types are added to these systems, the code that dispatches operations based on data type must be extended to handle the new type. For example, in a program to display different types of primitives, the following pseudo code shows how a procedure-oriented system differs from an object-oriented system.

        Procedure oriented (in C):

        Primitive *aPrim;\n...\nDrawPrimitive (aPrim)\n...\nprocedure DrawPrimitive (aPrim)\n  {\n  if (aPrim->type == TRIANGLE) then DrawTriangle (aPrim)\n  else if (aPrim->type == SQUARE) then DrawSquare (aPrim)\n  else if (aPrim->type == CIRCLE) then DrawCircle (aPrim)\n  ...\n  }\n

        Object-oriented (in C++):

        ...\naPrim->Draw ();\n...\n

        Later in this project's existence, someone may want to add a new primitive, let's say a quadratic. The person assigned with such a formidable task must search the existing system for all occurrences of the if statements in the first example and add a test for the new quadratic type. Of course, a good programmer will have isolated the code in one location, as we have done here, so the task is easier. Nevertheless, that programmer must first realize that the original programmer was skilled enough to modularize the drawing code, then find the code (without necessarily knowing the procedure name) and modify the code. To complicate matters, a system built by more than one programmer will undoubtedly be under a configuration management system, requiring a check-out, edit, and check-in cycle.

        The object-oriented programmer has an easier task. Consulting the design document that defines the object properties for a primitive, this programmer adds a draw operation to the quadratic object. The new primitive is available to the system without changing any existing code! Of course, this is an oversimplified example. But think about past programs you have written and remember how hard it was to add a new data type. Were your changes isolated to the new code you added? Did you have to edit code that you did not write and maybe did not understand? Keep this example in mind as you read our object-oriented implementation of a data visualization library.

        Before describing object-oriented design and programming in more detail, we provide an observation and prediction. Over the several years that we have designed and implemented software using an object-oriented methodology, we have observed that newcomers to the technique will say, \"But this is how I already write programs. My systems are modular; they're robust; I can easily add to them.\" If you still feel that way after reading this book, do not fault the object-oriented approach. Rather, we have failed as authors. However, such a negative response is unlikely. In our experience, users become comfortable with this approach in a short time. Especially when they are introduced to objects through an existing, well-designed object-oriented system. You will reach the \"aha\" stage, after which it will be difficult to begin a software project without looking for the objects in the problem.

        "},{"location":"VTKBook/02Chapter2/#24-object-oriented-terminology","title":"2.4 Object-Oriented Terminology","text":"

        As with any software engineering design methodology, object-oriented design has its own terminology. Unfortunately, not everyone agrees on what that is. We adopt much of our terminology from Rumbaugh [Rumbaugh91] and, since the Visualization Toolkit is written in C++, from Stroustrup [Stroustrup84]. For the most part, Rumbaugh's terminology is independent of programming language, while Stroustrup is specific to implementation in C++. The transition from design to programming will be painless though, and the mappings between the two terminologies are mostly obvious. Where we think there might be confusion, we will point out the correspondences.

        "},{"location":"VTKBook/02Chapter2/#what-is-an-object","title":"What Is an Object?","text":"

        An object is an abstraction that models the state and behavior of entities in a system. Abstraction is a mental process that extracts the essential aspects of a situation for a particular purpose. Entities are things in the system that have identity. Chairs, airplanes, and cameras are objects that correspond to physical entities in the real world. Binary trees, symbol tables, and ordered collections are objects that exist only within the world of computer science.

        Figure 2-1 is an example of the abstraction that occurs when we map the state and behavior of a system component to an object. Here, the object is a particular type of tree: a pin oak. In this application we desire to simulate the growth of various types of trees over the course of a season. For our purpose we have decided that the important state variables are the tree's age, trunk diameter, height, and habit (i.e., growing form). To capture the behavior of the pin oak we have methods to simulate growth and seasonal effects corresponding to spring, summer, fall, and winter. There are also methods (not shown) for setting and getting current state variables. Figure 2-1. Mapping a real-world object into an object abstraction. The real-world objects are various types of trees. One of these objects (a pin oak tree) is mapped into the computer object we call PinOak.

        We call the state of an object its attributes (also called instance variables ) and define its behavior by the operations that can be applied to it. Attributes have a name, a data type, and a data value. The data type of an attribute may be a primitive type in the programming language (such as a char or float in C++), or another object. For example, the vtkTransform object in our visualization system has an attribute of type vtkMatrix4x4 , another object. vtkMatrix4x4 in turn has attributes that are an array of primitive values declared as float values in C++.

        Operations are functions or transformations that can be applied to an object. Operations define the behavior of the object. The operations for a particular object are implemented in procedures we call methods.

        Together, the attributes and operations of an object comprise its properties. A two-dimensional line graph could have attributes that include an x and y axis, a legend, and a connected set of points. This graph has methods that draw the graph in a window. It also has methods that let a user specify the axes, data to draw, and legend to use.

        Objects that share the same properties can be grouped using the process of classification. An object class, usually just called a class, specifies the properties that all objects in the class have. The class only specifies the names of the properties, not their specific values. Different classes can (and usually do) have properties with names that exist in other classes. Many classes in our visualization system have an attribute named Position. Although both a camera and actor in our visualization system have this attribute, the effect on each is different because they are different classes. Attribute names are shared by all objects in a given class, but separate storage is allocated for each object's attribute values.

        When an operation with the same name is applied to objects of different classes we call the operation polymorphic. For example, our visualization system has an operation named Render() that can be applied to many different objects. The implementation of an operation for a particular class is called a method. The print operation for a vtkMatrix4x4 object is implemented in its print method. That is, there exists code that knows how to print objects of class vtkMatrix4x4 and not objects of other classes. Objects know which method to use because they are kept within each object's data structure. In most systems the code for the methods is shared by all objects in the same class. Some programming languages, including C++, define a method by combining an operation name with its argument types. This process is called overloading an operation and is a powerful technique that permits the same name to be used for logically similar operations. For example, the class definition below defines three methods for calculating the square of a number. Even though these methods have the same operation name, they are unique because C++ uses both the operation name and the operations argument types.

        class math\n{\n  float square(float x);\n  int square(int x);\n  double square(double x);\n}\n

        To use a member of a class for some purpose, we create an instance of the class (the process of instantiation ). Instance creation establishes the identity of the instance including specifying its initial state. The instance's class serves as a template for the instance during creation, defining the names of each of its attributes and operations. Creation establishes the similarities and differences between this instance and other instances of the same class. The similarities are the names and type of its attributes and the methods that implement its operations. The differences are the specific values of the attributes. The details of how one creates an instance of a class vary from programming language to programming language. In C++, a program creates an instance using a declarative form such as

        vtkActor aBall;\n

        which creates an object from the program stack, or by applying the new operation

        vtkActor *aBall = new vtkActor;\n

        which creates the object from the program heap.

        "},{"location":"VTKBook/02Chapter2/#inheritance","title":"Inheritance","text":"

        Inheritance is a programming mechanism that simplifies adding new classes to a system when they differ in small ways from currently existing classes. The notion of inheritance is adopted from the observation that most systems can be specified using a hierarchical classification system. A fine example of a classification system is the phyla of life on earth.

        Earlier we created an object corresponding to a pin oak tree. The properties of the tree can be more thoroughly described using inheritance ( Figure 2-2 ). The classification shown here is based on the five kingdom system of Margulis and Schwartz [Margulis88]. In this system, biota is classified as belonging to one of the five kingdoms Prokaryotae (bacteria), Protoctista (algae, protozoans and slime molds), Fungi (mushrooms, molds, lichens), Plantae (mosses, ferns, cone-bearing, and flowering plants), and Animalia (animals with and without backbones). Below this level we have the classifications division, class, order, family, genus, and species. The figure shows the kingdom, division, class, genus, and species of the pin oak.

        Organizing objects into an inheritance hierarchy provides many benefits. Properties of a general classification are also properties of its sub-classification. For example, we know that all species of genus Quercus form acorns. From the software point of view this means any instance variables and methods of a superclass are automatically inherited by its subclass. This allows us to make changes to a number of objects simultaneously by modifying their superclass. Furthermore, if we desire to add a new class (say a red oak tree) to the hierarchy we can do so without duplicating existing functionality. We need only differentiate the new class from the others by adding new instance variables or overloading existing methods.

        Figure 2-2. Inheritance hierarchy for pin oak tree.

        The ability to quickly add new classes that are slightly different from currently existing classes promotes the extensibility of a system. Inheritance can be derived top-down using a process called specialization , or it can be created bottom-up, combining similar classes during a process called generalization. The use of inheritance implies a class hierarchy with one or more classes being the superclasses of one or more subclasses. A subclass inherits the operations and attributes of its superclasses. In C++, subclasses are called derived classes and superclasses are called base classes. A subclass can add additional operations and attributes that modify the properties it inherited from its superclasses. Through this inheritance, an object can exhibit its superclass's behavior plus any additional behavior it wishes. It can also restrict, or override, operations implemented by its superclass.

        Classes that exist only to act as superclasses for their subclasses are called abstract classes. Instance creation of an abstract class is generally prohibited. Abstract classes are useful for gathering attributes and methods that all subclasses will use. They can also define protocols for behavior for their subclasses. This is a powerful use of inheritance that will show up in the design of our visualization system. Abstract classes can enforce complex sequence, control protocols, and ensure uniform behavior. They remove the responsibility of complex protocols from the individual sub-classes and isolate the protocol in the superclass.

        An example of a simple plotting package illustrates the power of abstract classes. Consider a data presentation application that allows for a variety of two-dimensional plotting. This application must support line charts and horizontal and vertical bar charts. The design process identifies properties common to all plots including title, axes, and legend. We then create an abstract class called TwoDPlot to contain these common attributes. Common behavior can also be captured in TwoDPlot within its plot method:

        Method Plot\n{\n  Draw the border\n  Scale the data\n  Draw the axes\n  Draw the data\n  Draw the title\n  Draw the legend\n}\n

        An abstract class may or may not provide default behavior for each operation. In this example, default behavior for border and title drawing might be provided. Then subclasses of TwoDPlot would define their own functions for the other methods. The protocol specification explicitly spells out what methods a subclass of TwoDPlot should respond to. In the above example, subclasses will need to define their own methods for drawing the axis, data, and legend. Some subclasses might use TwoDPlot 's methods for drawing the border, others might require their own version of this method. The abstract interface defined in TwoDPlot makes it easier to add new classes of 2D plots and the resulting subclasses tend to be more uniform and consistent.

        Another mechanism, delegation , is useful for isolating and reusing behavior. Using delegation, an object applies operations to one of its attributes that is an object. As an example, in the Visualization Toolkit the vtkTransform object delegates its Identity() operation to its vtkMatrix4x4 attribute. This instance of vtkMatrix4x4 then performs the operation. There are many more useful object-oriented concepts, but for the time being we have enough information to describe how we can use objects to design a system.

        "},{"location":"VTKBook/02Chapter2/#25-object-oriented-modelling-and-design","title":"2.5 Object-Oriented Modelling and Design","text":"

        The design of any large software system is a formidable task and the first steps in system design are often the most challenging. No matter what design technique we choose, we must have a thorough understanding of the system's application domain. It would be difficult to see how one could design a fly-by-wire airplane control system without a detailed knowledge of the underlying hardware control systems. Of course, all flight system software is not designed by aeronautical engineers, so some form of system specification must exist. The depth of information in the specifications varies from application to application.

        Object-oriented system design begins with a modelling step that extracts objects and their relationships with other objects from a problem statement or software requirement specification. First, the designer must completely understand the problem being solved. This often requires an in-depth knowledge of the problem domain or access to detailed specifications of the problem being solved. Then, major abstractions must be identified within the system. The abstractions will become, at this high level of design, the first set of objects. For example, a system that keeps track of an investment portfolio will need objects such as stocks, bonds, and mutual funds. In a computer animation system we might need actors, cameras, and lights. A medical computed tomography system will have a table, X-ray source, detectors, and gantry. Our visualization system will have models, isosurfaces, streamlines, and cut planes. During this modelling step, we search the problem domain for objects, properties, and relationships. Later, during multiple passes through the design, the model will be expanded.

        Modelling is a step in most design processes regardless of whether we are designing a ship, house, electronics system, or software. Each discipline follows a methodology that uses techniques specifically created to make the design process efficient and worthwhile. These techniques are so-called \"tools of the trade.\" An electrical engineer uses schematics and logic diagrams, an architect uses drawings and mock-ups, and a ship builder uses scale models. Likewise, software designers need tools that can help create a model of the system. The software tools should have enough expressive power to help the software designer evaluate a design against a specification and help communicate that design to others on the software team.

        We use the Object Modeling Technique (OMT) developed at GE by Jim Rumbaugh and his colleagues [Rumbaugh91]. OMT uses three models to specify an object-oriented design: an object model, a dynamic model, and a functional model. Each model describes a different aspect of the system and each has a corresponding diagramming technique that helps us analyze, design, and implement software systems.

        "},{"location":"VTKBook/02Chapter2/#the-object-model","title":"The Object Model","text":"

        The object model identifies each object in the system, its properties, and its relationships to other objects in the system. For most software systems, the object model dominates the design. The OMT graphical technique uses rectangles to depict object classes, and a variety of connectors to depict inheritance and other object-object relations. Object classes are represented as solid rectangles. Instances are represented as dotted rectangles. The name of the class or instance occupies the top of the rectangle. A line separates the class name from the next section that contains the attributes; a third section describes the methods. Relationships between objects are shown with line segments connecting the two related objects. In OMT, relationships are called associations and they can have various cardinalities: one-to-one, one-to-many, and many-to-many. Special associations that represent containers of other objects are called aggregations. Associations can be labeled with roles. (Roles are names given to associations and are used to further describe the nature of the association.) OMT represents inheritance with a triangle, with the superclass attached to the apex, and sub-classes attached to the base of the triangle. Figure 2-3 shows an object model for locator devices in a virtual reality system.

        The first object in the class hierarchy is locator. This abstract class specifies common attributes and methods for all locators. The subclasses of locator are locator2D and locator3D . In the current rendition of this object model, the locator only has one attribute, a device and two methods, open() and close(). The two subclasses of locator, locator2D and locator3D are also abstract classes, containing attributes and methods that distinguish them from each other based on their spatial dimensionality. For example, locator3D has an x, y, z position while locator2D has an x, y position. Both locators have a locate() method that updates the current position. In the 3D locator class, locate() also updates the orientation. The subclasses of locator3D include hardware from three different manufacturers: flock, pixsys, and logitek, as well as an articulated positioner abstract class. The three object classes for the hardware contain methods specific to each device. Each method knows how to convert the hardware specific codes returned by the device. They know that to be considered a locator3D subclass, they must implement a position and orientation operation that will provide x, y, z coordinates and three angular rotations that can be composed into a transformation matrix. The object model also shows us that the articulated locator has angles and linkages. Two specific articulated locators are immersion and phantom. An object model diagrammed in this fashion serves as a starting point for design and discussion. It reveals common methods and attributes as well as the distinguishing characteristics of each class.

        Later, during implementation, we will convert these object models into software objects. The particular computer language we choose for implementation will dictate the details of the conversion.

        Figure 2-3. Object model for locator devices."},{"location":"VTKBook/02Chapter2/#the-dynamic-model","title":"The Dynamic Model","text":"

        The object model describes the static portion of a system while the dynamic model details the sequences of events and time dependencies of the system. OMT uses state diagrams to model system dynamics. Dynamic models are frequently used to design control systems and user interfaces. Our visualization system has limited sequence and control aspects, so we will not dwell on state diagrams. But, if we were designing a user-friendly interface for a digital wristwatch, the state diagram in Figure2-4 would be useful. Figure 2-4. State diagram for a wristwatch.

        The ovals in the diagram show a state; the arrows show a transition from one state to another; and the labels on the arrows show an event that causes the state transition. This example shows three display states and multiple setting states. The event b1 means button one is pressed. This watch has three buttons. The diagram shows what happens in each state when any of the three buttons is pressed. The diagram clearly shows that b1 is used to move between display modes for time, date, and alarm. B2 changes from display mode into setting mode or selects the field to change in a given mode. B3 increments the selected field by one unit. The state diagram also shows what happens when illegal buttons are pressed. If the watch is displaying time and button 3 is pressed, nothing happens. If button 3 is pressed when the watch is displaying the alarm, the alarm on/off is toggled.

        "},{"location":"VTKBook/02Chapter2/#the-functional-model","title":"The Functional Model","text":"

        The functional model shows how data flows through the system and how processes and algorithms transform the data. It also shows functional dependencies between processes. Exposing these relationships will affect the associations in the object model. The major components of a data flow diagram (DFD) are data sources, data sinks, and processes. Data sources and sinks are represented as rectangles. Ellipses show processes. Data stores are shown within two horizontal lines. DFDs are useful to describe the overall flow in the system. They can also be used to describe any process that transforms one data representation into another. Processes identified in the DFD during function modelling may turn up as operations or objects in the object model.

        Figure2-5 shows a data flow diagram for a 3D medical imaging system. The diagram shows the data acquisition on the computed tomography (CT) or magnetic resonance imaging (MRI) scanner. The series of cross-sectional slices provided by the scanner is first processed by image processing filters to enhance features in the gray scale slices. A segment process identifies tissues and produces labels for the various tissues present in the slices. These labeled slices are then passed through a surface extraction process to create triangles that lie on the surface of each tissue. The render process transforms the geometry into an image. Alternatively, the write process stores the triangles in a file. Later, the triangles can be read and rendered into an image. We defer the decision whether to make the processes objects or operations until later. Chapter 4 uses DFDs to model the visualization pipeline. Figure 2-5. Data flow diagram."},{"location":"VTKBook/02Chapter2/#26-object-oriented-programming-languages","title":"2.6 Object-Oriented Programming Languages","text":"

        The choice of computer programming language is a religious issue. Every computer language has its evangelists and followers. Most of our experience in object-oriented languages is with C and C++. C itself does not have object-oriented facilities, but an object-oriented methodology and strict coding guidelines permit the development of object-oriented code. We chose C++ for the Visualization Toolkit because it has built-in support for the notion of classes, dynamic binding of methods to objects, and inheritance. C++ is also widely available on many UNIX platforms and personal computers.

        Simula [Birtwistle79] is usually acknowledged as the first object-oriented language, but Smalltalk [Goldberg83] is probably the best-known language. Smalltalk was developed at the Xerox Palo Alto Research Center (PARC) in the seventies and eighties. Well before its time, Smalltalk provided not just a language, but also an operating system and programming environment built with objects. When you use Smalltalk, you live and breathe objects. For the object-oriented purist, there is no substitute. Smalltalk spin-offs include window systems, workstations, and the desktop paradigm. Both Apple Computer and Microsoft acknowledge the influence that Smalltalk and Xerox PARC had on the Macintosh and Windows. Smalltalk was probably conceived 10 years too early for widespread commercial acceptance. During Smalltalk's infancy and adolescence, the complexity of software was much lower than today's systems. FORTRAN served the scientific and engineering community, COBOL was the choice for business applications and the computer science community embraced C. The use of abstractions was limited to mathematicians and other abstract thinkers. Programming was considered an art form and programmers concentrated on clever implementations of algorithms. Each new task often required a new program. Technical programmers did use numerical libraries for common mathematical operations, but any notions of common abstractions at a higher level were relatively few.

        "},{"location":"VTKBook/02Chapter2/#27-object-oriented-visualization","title":"2.7 Object-Oriented Visualization","text":"

        Don't underestimate the investment required to design a system. Although object-oriented technologies have tremendous potential to produce good software designs, these techniques do not guarantee a good design. The visualization system we present in this text has its roots in an animation [Lorensen89] and visualization system [Schroeder92] that we developed over a 10-year period. The initial design, which identified 25 classes for computer animation of industrial applications, took four software professionals 10 months (almost 3.5 person years) to complete. During this design stage the developers produced zero (!) lines of code. The subsequent implementation took one month, or ten percent of the effort. This system still serves our visualization group even after 20 other software developers have added over 500 classes to the system. The original 25 classes still exist in the system today.

        As a reader, we hope that you can benefit from our experience in visualization system design. We have tried to assist you by describing the properties (attributes and methods) of many of the Visualization Toolkit classes in each chapter's \"Putting It All Together \" section. There are also included a series of object diagrams generated by the Doxygen documentation system that will give you a quick overview of object relationships such as superclass and subclass. This documentation can be found on the CD-ROM or on-line at http://www.vtk.org. In the next chapter we will also explain the decisions we made to design the VTK object-oriented toolkit.

        "},{"location":"VTKBook/02Chapter2/#28-chapter-summary","title":"2.8 Chapter Summary","text":"

        This chapter introduced object-oriented concepts and terminology. The emphasis was on dealing with complexity and how object-oriented technology provides mechanisms to reduce the complexity of software.

        Model building is an important part of any design methodology. We introduced three models and notations. The object model describes the objects in a system and their static relationships, attributes, and methods. Object diagrams succinctly present this static information. The dynamic model focuses on the time dependent aspects of the system. State transition diagrams are used to model the sequence and control portions of the system. The functional model shows how objects in the system transform data or other objects. The data flow diagram is a convenient notation for showing functional dependencies.

        There are several choices available today for object-oriented implementations. Although it is possible to implement an object-oriented system in a non-object-oriented language such as C, the methodology is best served by an object-oriented language. We have chosen C++ to implement the Visualization Toolkit.

        The emphasis in this book is on architecture, data structure design, and algorithms. The object-oriented aspects of the system are important, but what the system does is far more important.

        "},{"location":"VTKBook/02Chapter2/#29-bibliographic-notes","title":"2.9 Bibliographic Notes","text":"

        There are several excellent textbooks on object-oriented design. Both [Rumbaugh91] and [Birtwistle79] present language-independent design methodologies. Both books emphasize modelling and diagramming as key aspects of design. [Meyer88] also describes the OO design process in the context of Eiffel, an OO language. Another popular book has been authored by Booch [Booch91].

        Anyone who wants to be a serious user of object-oriented design and implementation should read the books on Smalltalk [Goldberg83] [Goldberg84] by the developers of Smalltalk at Xerox Parc. In another early object-oriented programming book, [Cox86] describes OO techniques and the programming language Objective-C. Objective-C is a mix of C and Smalltalk and was used by Next Computer in the implementation of their operating system and user interface.

        There are many texts on object-oriented languages. CLOS [Keene89] describes the Common List Object System. Eiffel, a strongly typed OO language is described by [Meyer88]. Objective-C [Cox86] is a weakly typed language.

        Since C++ has become a popular programming language, there now many class libraries available for use in applications. [Gorlen90] describes an extensive class library for collections and arrays modeled after the Smalltalk classes described in [Goldberg83]. [Stepanov94] and [Musser94] describe the Standard Template Library, a framework of data structures and algorithms that is now a part of the ANSI C++ standard. Open Inventor [Inventor] is a C++ library supporting interactive 3D computer graphics. The Insight Segmentation and Registration Toolkit (ITK) is a relatively new class library often used in combination with VTK [ITK] for medical data processing. VXL is a C++ library for computer vision research and implementation [VXL]. Several mathematical libraries such as VNL (a part of VXL) and Blitz++ [Blitz] are also available. A wide variety of other C++ toolkits are available, Google searches [Google] are the best way to find them.

        C++ texts abound. The original description by the author of C++ [Stroustrup84] is a must for any serious C++ programmer. Another book [Ellis90] describes standard extensions to the language. These days the UML book series of which [Booch98] and [Rumbaugh98] are quite popular and are highly recommended resources. Several books on generic programming [Austern99] and STL [Musser96] are also useful. Check with your colleagues for their favorite C++ book.

        To keep in touch with new developments there are conferences, journals, and Web sites. The strongest technical conference on object-oriented topics is the annual Object-Oriented Programming Systems, Languages, and Applications ( OOPSLA ) conference. This is where researchers in the field describe, teach and debate the latest techniques in object-oriented technology. The bimonthly Journal of Object-Oriented Programming (JOOP) published by SIGS Publications, NY, presents technical papers, columns, and tutorials on the field. Resources on the World Wide Web include the Usenet newsgroups comp.object and comp.lang.c++.

        "},{"location":"VTKBook/02Chapter2/#210-references","title":"2.10 References","text":"

        [Austern99] M. H. Austern. Generic Programming and the STL. Addison-Wesley 1999. ISBN 0-2-1-30956-4.

        [Birtwistle79] G. M. Birtwistle, O. Dahl, B. Myhrhaug, and K. Nygaard. Simula Begin. Chartwell-Bratt Ltd, England, 1979.

        [Blitz] http://www.oonumerics.org/blitz/.

        [Booch91] G. Booch. Object-Oriented Design with Applications. Benjamin/Cummings Publishing Co., Redwood City, CA, 1991.

        [Booch98] G. Booch, I. Jacobson, J. Rumbaugh. The Unified Modeling Language User Guide. Addison-Wesley 1998, ISBN 0201571684.

        [Cox86] B. J. Cox. Object-Oriented Programming: An Evolutionary Approach. Addison-Wesley, Reading, MA, 1986.

        [Ellis90] M. Ellis and B. Stroustrup. The Annotated C++ Reference Manual. Addison-Wesley, Reading, MA, 1990.

        [Goldberg83] A. Goldberg, D. Robson. Smalltalk-80: The Language and Its Implementation. Addison-Wesley, Reading, MA, 1983.

        [Goldberg84] A. Goldberg. Smalltalk-80: The Interactive Programming Environment. Addison-Wesley, Reading, MA, 1984.

        [Google] http://www.google.com.

        [Gorlen90] K. Gorlen, S. Orlow, and P. Plexico. Data Abstraction and Object-Oriented Programming. John Wiley & Sons, Ltd., Chichester, England, 1990.

        [Inventor] http://oss.sgi.com/projects/inventor/.

        [ITK] The Insight Software Consortium. http://www.itk.org.

        [Keene89] S. Keene. Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS. Addison-Wesley, Reading, MA, 1989.

        [Lorensen89] W. E. Lorensen, B. Yamrom. \"Object-Oriented Computer Animation.\" Proceedings of IEEE NAE-CON, 2:588-595, Dayton, Ohio, May 1989.

        [Margulis88] L. Margulis and K. V. Schwartz. Five Kingdoms an Illustrated Guide to the Phyla of Life on Earth. H. Freeman & Co., New York, 1988.

        [Meyer88] B. Meyer. Object-Oriented Software Construction. Prentice Hall International, Hertfordshire, England, 1988.

        [Musser94] D. Musser and A. Stepanov. \"Algorithm-Oriented Generic Libraries.\" Software Practice and Experience. 24(7):623--642, July 1994.

        [Musser96] D. R. Musser and A. Saini. STL Tutorial and Reference Guide. Addison-Wesley 1996.ISBN 0-201-63398-1.

        [Rumbaugh91] J. Rumbaugh, M. Blaha, W. Premerlani, F. Eddy, and W. Lorensen. Object-Oriented Modeling and Design. Prentice Hall, Englewood Cliffs, NJ, 1991.

        [Rumbaugh98] J. Rumbaugh, G. Booch, and I. Jacobson. The Unified Modeling Language Reference Manual. Addison-Wesley 1998, ISBN: 020130998X.

        [Schroeder92] W. J. Schroeder, W. E. Lorensen, G. Montanaro, and C. Volpe. \"Visage: An Object-Oriented Scientific Visualization System.\" In Proceedings of Visualization '92. pp. 219--226, IEEE Computer Society Press, Los Alamitos, CA, October 1992.

        [Stepanov94] A. Stepanov and M. Lee. The Standard Template Library. ISO Programming Language C++ Project. Doc. No. X3J16/94-0095, WG21/N0482, May 1994.

        [Stroustrup84] B. Stroustrup. The C++ Programming Language. Addison-Wesley, Reading, MA, 1986.

        [VXL] http://vxl.sourceforge.net/.

        "},{"location":"VTKBook/02Chapter2/#211-exercises","title":"2.11 Exercises","text":"

        2.1 Answer the following questions about a program you have written.

        a) How much time did you spend on design and implementation?

        b) What methodology, if any, did you use?

        c) Could you easily extend the system?

        d) Could anyone extend the system?

        2.2 Identify the major objects and operations for the following applications.

        a) An airline reservation system.

        b) An adventure game.

        c) A 2D plotting package.

        d) An automatic teller machine.

        2.3 Draw an object diagram for each example in Exercise 2.2.

        2.4 Computer animation uses concepts from graphics and movie making. Identify the major objects and operations in a computer animation system.

        2.5 For the animation system in Exercise 2.4, design control and looping objects that will allow flexible control of the properties of the actors in the system. If we call these control and looping objects scenes and cues, how would you expect them to look?

        2.6 Draw a state diagram for your wristwatch using Figure 2-4 as an example.

        2.7 Draw a data flow diagram for calculating the surface area and volume of a sphere and cylinder.

        LocalWords: Austern

        "},{"location":"VTKBook/03Chapter3/","title":"Chapter 3 - Computer Graphics Primer","text":"

        Computer graphics is the foundation of data visualization. Practically speaking, visualization is the process that transforms data into a set of graphics primitives. The methods of computer graphics are then used to convert these primitives into pictures or animations. This chapter discusses basic computer graphics principles. We begin by describing how lights and physical objects interact to form what we see. Next we examine how to simulate these interactions using computer graphics techniques. Hardware issues play an important role here since modern computers have built-in hardware support for graphics. The chapter concludes with a series of examples that illustrate our object-oriented model for 3D computer graphics.

        "},{"location":"VTKBook/03Chapter3/#31-introduction","title":"3.1 Introduction","text":"

        Computer graphics is the process of generating images using computers. We call this process rendering. There are many types of rendering processes, ranging from 2D paint programs to sophisticated 3D techniques. In this chapter we focus on basic 3D techniques for visualization.

        We can view rendering as the process of converting graphical data into an image. In data visualization our goal is to transform data into graphical data, or graphics primitives, that are then rendered. The goal of our rendering is not so much photo realism as it is information content. We also strive for interactive graphical displays with which it is possible to directly manipulate the underlying data. This chapter explains the process of rendering an image from graphical data. We begin by looking at the way lights, cameras, and objects (or actors) interact in the world around us. From this foundation we explain how to simulate this process on a computer.

        "},{"location":"VTKBook/03Chapter3/#a-physical-description-of-rendering","title":"A Physical Description of Rendering","text":"Figure 3-1. Physical generation of an image.

        Figure 3-1 presents a simplified view of what happens when we look at an object, in this case a cube. Rays of light are emitted from a light source in all directions. (In this example we assume that the light source is the sun.) Some of these rays happen to strike the cube whose surface absorbs some of the incident light and reflects the rest of it. Some of this reflected light may head towards us and enter our eyes. If this happens, then we \"see\" the object. Likewise, some of the light from the sun will strike the ground and some small percentage of it will be reflected into our eyes.

        As you can imagine, the chances of a ray of light traveling from the sun through space to hit a small object on a relatively small planet are low. This is compounded by the slim odds that the ray of light will reflect off the object and into our eyes. The only reason we can see is that the sun produces such an enormous amount of light that it overwhelms the odds. While this may work in real life, trying to simulate it with a computer can be difficult. Fortunately, there are other ways to look at this problem.

        A common and effective technique for 3D computer graphics is called ray-tracing or ray-casting. Ray-tracing simulates the interaction of light with objects by following the path of each light ray. Typically, we follow the ray backwards from the viewer's eyes and into the world to determine what the ray strikes. The direction of the ray is in the direction we are looking (i.e., the view direction) including effects of perspective (if desired). When a ray intersects an object, we can determine if that point is being lit by our light source. This is done by tracing a ray from the point of intersection towards the light. If the ray intersects the light, then the point is being lit. If the ray intersects something else before it gets to the light, then that light will not contribute to illuminating the point. For multiple light sources we just repeat this process for each light source. The total contributions from all the light sources, plus any ambient scattered light, will determine the total lighting or shadow for that point. By following the light's path backwards, ray tracing only looks at rays that end up entering the viewer's eyes. This dramatically reduces the number of rays that must be computed by a simulation program.

        Having described ray tracing as a rendering process, it may be surprising that many members of the graphics community do not use it. This is because ray tracing is a relatively slow image generation method since it is typically implemented in software. Other graphics techniques have been developed that generate images using dedicated computer hardware. To understand why this situation has emerged, it is instructive to briefly examine the taxonomy and history of computer graphics.

        "},{"location":"VTKBook/03Chapter3/#image-order-and-object-order-methods","title":"Image-Order and Object-Order Methods","text":"

        Rendering processes can be broken into two categories: image-order and object-order. Ray tracing is an image-order process. It works by determining what happens to each ray of light, one at a time. An object-order process works by rendering each object, one at a time. In the above example, an object-order technique would proceed by first rendering the ground and then the cube.

        To look at it another way consider painting a picture of a barn. Using an image-order algorithm you would start at the upper left corner of the canvas and put down a drop of the correct color paint. (Each paint drop is called a picture element or pixel.) Then you would move a little to the right and put down another drop of paint. You would continue until you reached the right edge of the canvas, then you would move down a little and start on the next row. Each time you put down a drop of paint you make certain it is the correct color for each pixel on the canvas. When you are done you will have a painting of a barn.

        An alternative approach is based on the more natural (at least for many people) object-order process. We work by painting the different objects in our scene, independent of where the objects actually are located on the scene. We may paint from back to front, front-to-back, or in arbitrary order. For example, we could start by painting the sky and then add in the ground. After these two objects were painted we would then add in the barn. In the image-order process we worked on the canvas in a very orderly fashion; left to right, top to bottom. With an object-order process we tend to jump from one part of the canvas to another, depending on what object we are drawing.

        The field of computer graphics started out using object-order processes. Much of the early work was closely tied to the hardware display device, initially a vector display. This was little more than an oscilloscope, but it encouraged graphical data to be drawn as a series of line segments. As the original vector displays gave way to the currently ubiquitous raster displays, the notion of representing graphical data as a series of objects to be drawn was preserved. Much of the early work pioneered by Bresenham [Bresenham65] at IBM focused on how to properly convert line segments into a form that would be suitable for line plotters. The same work was applied to the task of rendering lines onto the raster displays that replaced the oscilloscope. Since then the hardware has become more powerful and capable of displaying much more complex primitives than lines.

        It wasn't until the early 1980s that a paper by Turner Whitted [Whitted80] prompted many people to look at rendering from a more physical perspective. Eventually ray tracing became a serious competitor to the traditional object-order rendering techniques, due in part to the highly realistic images it can produce. Object-order rendering has maintained its popularity because there is a wealth of graphics hardware designed to quickly render objects. Ray tracing tends to be done without any specialized hardware and therefore is a time-consuming process.

        "},{"location":"VTKBook/03Chapter3/#surface-versus-volume-rendering","title":"Surface versus Volume Rendering","text":"

        The discussion to this point in the text has tacitly assumed that when we render an object, we are viewing the surfaces of objects and their interactions with light. However, common objects such as clouds, water, and fog, are translucent, or scatter light that passes through them. Such objects cannot be rendered using a model based exclusively on surface interactions. Instead, we need to consider the changing properties inside the object to properly render them. We refer to these two rendering models as surface rendering (i.e., render the surfaces of an object) and volume rendering (i.e., render the surface and interior of an object).

        Generally speaking, when we render an object using surface rendering techniques, we mathematically model the object with a surface description such as points, lines, triangles, polygons, or 2D and 3D splines. The interior of the object is not described, or only implicitly represented from the surface representation (i.e., surface is the boundary of the volume). Although techniques do exist that allow us to make the surface transparent or translucent, there are still many phenomena that cannot be simulated using surface rendering techniques alone (e.g., scattering or light emission). This is particularly true if we are trying to render data interior to an object, such as X-ray intensity from a CT scan.

        Volume rendering techniques allow us to see the inhomogeneity inside objects. In the prior CT example, we can realistically reproduce X-ray images by considering the intensity values from both the surface and interior of the data. Although it is premature to describe this process at this point in the text, you can imagine extending our ray tracing example from the previous section. Thus rays not only interact with the surface of an object, they also interact with the interior.

        In this chapter we focus on surface rendering techniques. While not as powerful as volume rendering, surface rendering is widely used because it is relatively fast compared to volumetric techniques, and allows us to create images for a wide variety of data and objects. Chapter 7 - Advanced Computer Graphics describes volume rendering in more detail.

        "},{"location":"VTKBook/03Chapter3/#visualization-not-graphics","title":"Visualization Not Graphics","text":"

        Although the authors would enjoy providing a thorough treatise on computer graphics, such a discourse is beyond the scope of this text. Instead we make the distinction between visualization (exploring, transforming, and mapping data) and computer graphics (mapping and rendering). The focus will be on the principles and practice of visualization, and not on 3D computer graphics. In this chapter and Chapter 7 - Advanced Computer Graphics we introduce basic concepts and provide a working knowledge of 3D computer graphics. For those more interested in this field, we refer you to the texts recommended in the \"Bibliographic Notes\" at the end of this chapter.

        One of the regrets we have regarding this posture is that certain rendering techniques are essentially visualization techniques. We see this hinted at in the previous paragraph, where we use the term \"mapping\" to describe both visualization and computer graphics. There is not currently and will likely never be a firm distinction between visualization and graphics. For example, many researchers consider volume rendering to be squarely in the field of visualization because it addresses one of the most important forms of visualization data. Our distinction is mostly for our own convenience, and offers us the opportunity to finish this text. We recommend that a serious student of visualization supplement the material presented here with deeper books on computer graphics and volume rendering.

        In the next few pages we describe the rendering process in more detail. We start by describing several color models. Next we examine the primary components of the rendering process. There are sources of light such as the sun, objects we wish to render such as a cube or sphere (we refer to these objects as actors), and there is a camera that looks out into the world. These terms are taken from the movie industry and tend to be familiar to most people. Actors represent graphical data or objects, lights illuminate the actors, and the camera constructs a picture by projecting the actors onto a view plane. We call the combination of lights, camera, and actors the scene, and refer to the rendering process as rendering the scene.

        "},{"location":"VTKBook/03Chapter3/#32-color","title":"3.2 Color","text":"

        The electromagnetic spectrum visible to humans contains wavelengths ranging from about 400 to 700 nanometers. The light that enters our eyes consists of different intensities of these wavelengths, an example of which is shown in Figure 3-2. This intensity plot defines the color of the light, therefore a different plot results in a different color. Unfortunately, we may not notice the difference since the human eye throws out most of this information. There are three types of color receptors in the human eye called cones. Each type responds to a subset of the 400 to 700 nanometer wavelength range as shown in Figure 3-3. Any color we see is encoded by our eyes into these three overlapping responses. This is a great reduction from the amount of information that actually comes into our eyes. As a result, the human eye is incapable of recognizing differences in any colors whose intensity curves, when applied to the human eye's response curves, result in the same triplet of responses. This also implies that we can store and represent colors in a computer using a simplified form without the human eye being able to recognize the difference. Figure 3-2. Wavelength versus Intensity plot.

        The two simplified component systems that we use to describe colors are RGB and HSV color systems. The RGB system represents colors based on their red, green, and blue intensities. This can be thought of as a three dimensional space with the axes being red, green, and blue. Some common colors and their RGB components are shown in Figure 3-4.

        The HSV system represents colors based on their hue, saturation, and value. The value component is also known as the brightness or intensity component, and represents how much light is in the color. A value of 0.0 will always give you black and a value of 1.0 will give you something bright. The hue represents the dominant wavelength of the color and is often illustrated using a circle as in Figure 3-5. Each location on the circumference of this circle represents a different hue and can be specified using an angle. When we specify a hue we use the range from zero to one, where zero corresponds to zero degrees on the hue circle and one corresponds to 360 degrees. The saturation indicates how much of the hue is mixed into the color. For example, we can set the value to one, which gives us a bright color, and the hue to 0.66, to give us a dominant wavelength of blue. Now if we set the saturation to one, the color will be a bright primary blue. If we set the saturation to 0.5, the color will be sky blue, a blue with more white mixed in. If we set the saturation to zero, this indicates that there is no more of the dominant wavelength (hue) in the color than any other wavelength. As a result, the final color will be white (regardless of hue value). Figure 3-4 lists HSV values for some common colors. Figure 3-3. Relative absorbance of light by the three types of cones in the human retina. Color RGB HSV Black 0,0,0 ,,0 White 1,1,1 *,0,1 Red 1,0,0 0,1,1 Green 0,1,0 1/3,1,1 Blue 0,0,1 2/3,1,1 Yellow 1,1,0 1/6,1,1 Cyan 0,1,1 1/2,1,1 Magenta 1,0,1 5/6,1,1 Sky Blue 1/2,1/2,1 2/3,1/2,1 Figure 3-4. Common colors in RGB and HSV space. s Figure 3-5. On the top, circular representation of hue. The other two images on the bottom are slices through the HSV color space. The first slice has a value of 1.0, the other has a value of 0.5."},{"location":"VTKBook/03Chapter3/#33-lights","title":"3.3 Lights","text":"

        One of the major factors controlling the rendering process is the interaction of light with the actors in the scene. If there are no lights, the resulting image will be black and rather uninformative. To a great extent it is the interaction between the emitted light and the surface (and in some cases the interior) of the actors in the scene that defines what we see. Once rays of light interact with the actors in a scene, we have something for our camera to view.

        Of the many different types of lights used in computer graphics, we will discuss the simplest, the infinitely distant, point light source. This is a simplified model compared to the lights we use at home and work. The light sources that we are accustomed to typically radiate from a region in space (a filament in an incandescent bulb, or a light-emitting gas in a fluorescent light). The point source lighting model assumes that the light is emitted in all directions from a single point in space. For an infinite light source, we assume that it is positioned infinitely far away from what it is illuminating. This is significant because it implies that the incoming rays from such a source will be parallel to each other. The emissions of a local light source, such as a lamp in a room, are not parallel. Figure 3-6 illustrates the differences between a local light source with a finite volume, versus an infinite point light source. The intensity of the light emitted by our infinite light sources also remains constant as it travels, in contrast to the actual 1/ distance2 relationship physical lights obey. As you can see this is a great simplification, which later will allow us to use less complex lighting equations. Figure 3-6. Local light source with a finite volume versus an infinite point light source."},{"location":"VTKBook/03Chapter3/#34-surface-properties","title":"3.4 Surface Properties","text":"

        As rays of light travel through space, some of them intersect our actors. When this happens, the rays of light interact with the surface of the actor to produce a color. Part of this resulting color is actually not due to direct light, but rather from ambient light that is being reflected or scattered from other objects. An ambient lighting model accounts for this and is a simple approximation of the complex scattering of light that occurs in the real world. It applies the intensity curve of the light source to the color of the object, also expressed as an intensity curve. The result is the color of the light we see when we look at that object. With such a model, it is important to realize that a white light shining on a blue ball is indistinguishable from a blue light shining on a white ball. The ambient lighting equation is

        R_a = L_c \\cdot O_a \\bf\\tag{3-1}

        where R_a is the resulting intensity curve due to ambient lighting, L_c is the intensity curve of the ambient light, and O_a is the color curve of the object. To help keep the equations simple we assume that all of the direction vectors are normalized (i.e., have a magnitude of one).

        Two components of the resulting color depend on direct lighting. Diffuse lighting, which is also known as Lambertian reflection, takes into account the angle of incidence of the light onto an object. Figure 3-7 shows the image of a cylinder that becomes darker as you move laterally from its center. The cylinder's color is constant; the amount of light hitting the surface of the cylinder changes. At the center, where the incoming light is nearly perpendicular to the surface of the cylinder, it receives more rays of light per surface area. As we move towards the side, this drops until finally the incoming light is parallel to the side of the cylinder and the resulting intensity is zero. Figure 3-7. Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look. See FlatVersusGouraud.cxx and FlatVersusGouraud.py.

        The contribution from diffuse lighting is expressed in Equation3-2 and illustrated in Figure 3-8. R_d = L_cO_d[\\overrightarrow{O}_n \\cdot (-\\overrightarrow{L}_n)] \\bf\\tag{3-2}

        where R_d is the resulting intensity curve due to diffuse lighting, L_c is the intensity curve for the light, and O_c is the color curve for the object. Notice that the diffuse light is a function of the relative angle between incident light vector and the surface normal of the object. As a result diffuse lighting is independent of viewer position.

        Specular lighting represents direct reflections of a light source off a shiny object. Figure 3-10 shows a diffusely lit ball with varying specular reflection. The specular intensity (which varies between the top and bottom rows) controls the intensity of the specular lighting. The specular power, O_{sp}, indicates how shiny an object is, more specifically it indicates how quickly specular sp reflections diminish as the reflection angles deviate from a perfect reflection. Higher values indicate a faster dropoff, and therefore a shinier surface. Referring to Figure 3-9, the equation for specular lighting is R_s . = L_cO_s[\\overrightarrow{S} \\cdot (-\\overrightarrow{C}_n)] ^{O_{sp}}\\\\ \\overrightarrow{S} = 2[\\overrightarrow{O}_n \\cdot (-\\overrightarrow{L}_n)]\\overrightarrow{O}_n + \\overrightarrow{L}_n \\bf\\tag{3-3}

        where \\vec{C_n} is the direction of projection for the camera and is the \\vec{S} is the direction of specular reflection.

        Figure 3-8. Diffuse lighting. Figure 3-9. Specular lighting.

        We have presented the equations for the different lighting models independently. We can apply all lighting models simultaneously or in combination. Equation3-4 combines ambient, diffuse and specular lighting into one equation.

        R_c = O_{ai}O_{ac}L_c - O_{di}O_{dc}L_c(\\overrightarrow{O}_n \\cdot \\overrightarrow{L}_n) + O_{si}O_{sc}L_c[\\overrightarrow{S} \\cdot(-\\overrightarrow{C}_n)]^{O_{sp}} \\bf\\tag{3-4}

        The result is a color at a point on the surface of the object. The constants O_{ai}, O_{di}, and O_{si} control the relative amounts of ambient, diffuse and specular lighting for an object. The constants O_{ac}, O_{dc} and O_{sc} specify the colors to be used for each type of lighting. These six constants along with the specular power are part of the surface material properties. (Other properties such as transparency will be covered in later sections of the text.) Different combinations of these property values can simulate dull plastic and polished metal. The equation assumes an infinite point light source as described in \"Lights\". However the equation can be easily modified to incorporate other types of directional lighting.

        Figure 3-10. Effects of specular coefficients. Specular coefficients control the apparent \"shininess\" of objects. The top row has a specular intensity value of 0.5; the bottom row 1.0. Along the horizontal direction the specular power changes. The values (from left to right) are 5, 10, 20, and 40. See SpecularSpheres.cxx and SpecularSpheres.py."},{"location":"VTKBook/03Chapter3/#35-cameras","title":"3.5 Cameras","text":"

        We have light sources that are emitting rays of light and actors with surface properties. At every point on the surface of our actors this interaction results in some composite color (i.e., combined color from light, object surface, specular, and ambient effects). All we need now to render the scene is a camera. There are a number of important factors that determine how a 3D scene gets projected onto a plane to form a 2D image (see Figure 3-11). These are the position, orientation, and focal point of the camera, the method of camera projection, and the location of the camera clipping planes. Figure 3-11 Camera attributes..

        The position and focal point of the camera define the location of the camera and where it points. The vector defined from the camera position to the focal point is called the direction of projection. The camera image plane is located at the focal point and is typically perpendicular to the projection vector. The camera orientation is controlled by the position and focal point plus the camera view-up vector. Together these completely define the camera view.

        The method of projection controls how the actors are mapped to the image plane. Orthographic projection is a parallel mapping process. In orthographic projection (or parallel projection) all rays of light entering the camera are parallel to the projection vector. Perspective projection occurs when all light rays go through a common point (i.e., the viewpoint or center of projection). To apply perspective projection we must specify a perspective angle or camera view angle.

        The front and back clipping planes intersect the projection vector, and are usually perpendicular to it. The clipping planes are used to eliminate data either too close to the camera or too far away. As a result only actors or portions of actors within the clipping planes are (potentially) visible. Clipping planes are typically perpendicular to the direction of projection. Their locations can be set using the camera's clipping range. The location of the planes are measured from the camera's position along the direction of projection. The front clipping plane is at the minimum range value, and the back clipping plane is at the maximum range value. Later on in Chapter 7 - Advanced Computer Graphics, when we discuss stereo rendering, we will see examples of clipping planes that are not perpendicular to the direction of projection.

        Taken together these camera parameters define a rectangular pyramid, with its apex at the camera's position and extending along the direction of projection. The pyramid is truncated at the top with the front clipping plane and at the bottom by the back clipping plane. The resulting view frustum defines the region of 3D space visible to the camera.

        While a camera can be manipulated by directly setting the attributes mentioned above, there are some common operations that make the job easier. Figure 3-12 and Figure 3-13 will help illustrate these operations. Changing the azimuth of a camera rotates its position around its view up vector, centered at the focal point. Think of this as moving the camera to the left or right while always keeping the distance to the focal point constant. Changing a camera's elevation rotates its position around the cross product of its direction of projection and view up centered at the focal point. This corresponds to moving the camera up and down. To roll the camera, we rotate the view up vector about the view plane normal. Roll is sometimes called twist.

        The next two motions keep the camera's position constant and instead modify the focal point. Changing the yaw rotates the focal point about the view up centered at the camera's position. This is like an azimuth, except that the focal point moves instead of the position. Changes in pitch rotate the focal point about the cross product of the direction of projection and view up centered at the camera's position. Dollying in and out moves the camera's position along the direction of projection, either closer or farther from the focal point. This operation is specified as the ratio of its current distance to its new distance. A value greater than one will dolly in, while a value less than one will dolly out. Finally, zooming changes the camera's view angle, so that more or less of the scene falls within the view frustum.

        Figure 3-12. Camera movements around focal point. See CameraModel1.cxx and CameraModel1.py. Figure 3-13. Camera movements around camera position. See CameraModel2.cxx and CameraModel2.py.

        Once we have the camera situated, we can generate our 2D image. Some of the rays of light traveling through our 3D space will pass through the lens on the camera. These rays then strike a flat surface to produce an image. This effectively projects our 3D scene into a 2D image. The camera's position and other properties determine which rays of light get captured and projected. More specifically, only rays of light that intersect the camera's position, and are within its viewing frustum, will affect the resulting 2D image.

        This concludes our brief rendering overview. The light has traveled from its sources to the actors, where it is reflected and scattered. Some of this light gets captured by the camera and produces a 2D image. Now we will look at some of the details of this process.

        "},{"location":"VTKBook/03Chapter3/#36-coordinate-systems","title":"3.6 Coordinate Systems","text":"

        There are four coordinate systems commonly used in computer graphics and two different ways of representing points within them (Figure 3-14). While this may seem excessive, each one serves a purpose. The four coordinate systems we use are: model, world, view, and display.

        The model coordinate system is the coordinate system in which the model is defined, typically a local Cartesian coordinate system. If one of our actors represents a football, it will be based on a coordinate system natural to the football geometry (e.g., a cylindrical system). This model has an inherent coordinate system determined by the decisions of whoever generated it. They may have used inches or meters as their units, and the football may have been modeled with any arbitrary axis as its major axis.

        The world coordinate system is the 3D space in which the actors are positioned. One of the actor's responsibilities is to convert from the model's coordinates into world coordinates. Each model may have its own coordinate system but there is only one world coordinate system. Each actor must scale, rotate, and translate its model into the world coordinate system. (It may also be necessary for the modeller to transform from its natural coordinate system into a local Cartesian system. This is because actors typically assume that the model coordinate system is a local Cartesian system.) The world coordinate system is also the system in which the position and orientation of cameras and lights are specified.

        The view coordinate system represents what is visible to the camera. This consists of a pair of x and y values, ranging between (-1,1), and a z depth coordinate. The x, y values specify location in the image plane, while the z coordinate represents the distance, or range, from the camera. The camera's properties are represented by a four by four transformation matrix (to be described shortly), which is used to convert from world coordinates into view coordinates. This is where the perspective effects of a camera are introduced.

        The display coordinate system uses the same basis as the view coordinate system, but instead of using negative one to one as the range, the coordinates are actual x, y pixel locations on the image plane. Factors such as the window's size on the display determine how the view coordinate range of (-1,1) is mapped into pixel locations. This is also where the viewport comes into effect.

        Figure 3-14. Modelling, world, view and display coordinate system.

        You may want to render two different scenes, but display them in the same window. This can be done by dividing the window into rectangular viewports. Then, each renderer can be told what portion of the window it should use for rendering. The viewport ranges from (0,1) in both the x and y axis. Similar to the view coordinate system, the z-value in the display coordinate system also represents depth into the window. The meaning of this z-value will be further described in the section titled \"Z-Buffer\".

        "},{"location":"VTKBook/03Chapter3/#37-coordinate-transformation","title":"3.7 Coordinate Transformation","text":"

        When we create images with computer graphics, we project objects defined in three dimensions onto a two-dimensional image plane. As we saw earlier, this projection naturally includes perspective. To include projection effects such as vanishing points we use a special coordinate system called homogeneous coordinates.

        The usual way of representing a point in 3D is the three element Cartesian vector (x, y, z). Homogeneous coordinates are represented by a four element vector ( x_h, y_h, z_h, w_h). The conversion between Cartesian coordinates and homogeneous coordinates is given by:

        x = \\frac{x_h}{w_h}\\ \\ \\ \\ y = \\frac{y_h}{w_h}\\ \\ \\ \\ z = \\frac{z_h}{w_h} \\bf\\tag{3-5}

        Using homogeneous coordinates we can represent an infinite point by setting w h to zero. This capability is used by the camera for perspective transformations. The transformations are applied by using a 4x4 transformation matrix. Transformation matrices are widely used in computer graphics because they allow us to perform translation, scaling, and rotation of objects by repeated matrix multiplication. Not all of these operations can be performed using a 3x3 matrix.

        For example, suppose we wanted to create a transformation matrix that translates a point (x, y, z) in Cartesian space by the vector (t_x, t_y, t_z). We need only construct the translation matrix given by

        T_T = \\left[\\begin{array}{cccc} 1 & 0 & 0 & t_x \\\\ 0 & 1 & 0 & t_y \\\\ 0 & 0 & 1 & t_z \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-6}

        and then postmultiply it with the homogeneous coordinate (x_h, y_h, z_h, w_h). To carry this example through, we construct the homogeneous coordinate from the Cartesian coordinate ( x, y, z) by setting w_h = 1 to yield (x, y, z, 1). Then to determine the translated point (x', y', z') we premultiply current position by the transformation matrix T_T to yield the translated coordinate. Substituting into Equation3-6 we have the result

        \\left[\\begin{array}{c} x' \\\\ y' \\\\ z' \\\\ w' \\end{array}\\right] =\\left[\\begin{array}{cccc} 1 & 0 & 0 & t_x \\\\ 0 & 1 & 0 & t_y \\\\ 0 & 0 & 1 & t_z \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\cdot \\left[\\begin{array}{c} x \\\\ y \\\\ z \\\\ 1 \\end{array}\\right] \\bf\\tag{3-7}

        Converting back to Cartesian coordinates via Equation3-5 we have the expected solution

        x' = x + t_x \\\\ y' = y + t_y \\\\ z' = z + t_z \\bf\\tag{3-8}

        The same procedure is used to scale or rotate an object. To scale an object we use the transformation matrix

        T_s = \\left[\\begin{array}{cccc} s_x & 0 & 0 & 0 \\\\ 0 & s_y & 0 & 0 \\\\ 0 & 0 & s_z & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-9}

        where the parameters s_x, s_y, and s_z are scale factors along the x, y, z axes. Similaryly we can rotate an object around the x axes by angle \\theta using the matrix

        T_{R_x} = \\left[\\begin{array}{cccc} 1 & 0 & 0 & 0 \\\\ 0 & \\cos\\theta & -\\sin\\theta & 0 \\\\ 0 & \\sin\\theta & \\cos\\theta & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-10}

        Around the y axis we use

        TT_{R_y} = \\left[\\begin{array}{cccc} \\cos\\theta & 0 & \\sin\\theta0 & 0 \\\\ 0 & 1 & 0 & 0 \\\\ -\\sin\\theta & 0 & \\cos\\theta & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-11}

        and around the z axis we use

        T_{R_z} = \\left[\\begin{array}{cccc} \\cos\\theta & -\\sin\\theta & 0 & 0 \\\\ \\sin\\theta & \\cos\\theta & 0 & 0 \\\\ 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-12}

        Another useful rotation matrix is used to transform one coordinate axes x-y-z to another coordinate axes x'-y'-z'. To derive the transformation matrix we assume that the unit x' axis make the angles (\\theta_{x'x},\\theta_{x'y},\\theta_{x'z}) around the x-y-z axes (these are called direction cosines). Similarly, the unit y' axis makes the angles (\\theta_{y'x},\\theta_{y'y},\\theta_{y'z}) and the unit z' axis makes the angles (\\theta_{z'x},\\theta_{z'y},\\theta_{z'z}). The resulting rotation matrix is formed by placing the direction cosines along the rows of the transformation matrix as follows

        T_R = \\left[\\begin{array}{cccc} \\cos\\theta_{x'x} & \\cos\\theta_{x'y} & \\cos\\theta_{x'z} & 0 \\\\ \\cos\\theta_{y'x} & \\cos\\theta_{y'y} & \\cos\\theta_{y'z} & 0 \\\\ \\cos\\theta_{z'x} & \\cos\\theta_{z'y} & \\cos\\theta_{z'z} & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right] \\bf\\tag{3-13}

        Rotations occur about the coordinate origin. It is often more convenient to rotate around the center of the object (or a user-specified point). Assume that we call this point the object's center. To rotate around O_c we must first translate the object from O_c to the origin, apply rotations, and then translate the object back to O_c.

        Transformation matrices can be combined by matrix multiplication to achieve combinations of translation, rotation, and scaling. It is possible for a single transformation matrix to represent all types of transformation simultaneously. This matrix is the result of repeated matrix multiplications. A word of warning: The order of the multiplication is important. For example, multiplying a translation matrix by a rotation matrix will not yield the same result as multiplying the rotation matrix by the translation matrix.

        "},{"location":"VTKBook/03Chapter3/#38-actor-geometry","title":"3.8 Actor Geometry","text":"

        We have seen how lighting properties control the appearance of an actor, and how the camera in combination with transformation matrices is used to project an actor to the image plane. What is left to define is the geometry of the actor, and how we position it in the world coordinate system.

        "},{"location":"VTKBook/03Chapter3/#modelling","title":"Modelling","text":"

        A major topic in the study of computer graphics is modelling or representing the geometry of physical objects. Various mathematical techniques have been applied including combinations of points, lines, polygons, curves, and splines of various forms, and even implicit mathematical functions.

        This topic is beyond the scope of the text. The important point here is that there is an underlying geometric model that specifies what the object's shape is and where it is located in the model coordinate system.

        In data visualization, modelling takes a different role. Instead of directly creating geometry to represent an object, visualization algorithms compute these forms. Often the geometry is abstract (like a contour line) and has little relationship to real world geometry. We will see how these models are computed when we describe visualization algorithms in Chapter 6 - Fundamental Algorithms and Chapter 9 - Advanced Algorithms.

        The representation of geometry for data visualization tends to be simple, even though computing the representations is not. These forms are most often primitives like points, lines, and polygons, or visualization data such as volume data. We use simple forms because we desire high performance and interactive systems. Thus we take advantage of computer hardware (to be covered in \"Graphics Hardware\") or special rendering techniques like volume rendering (see \"Volume Rendering\" in Chapter 7).

        "},{"location":"VTKBook/03Chapter3/#actor-location-and-orientation","title":"Actor Location and Orientation","text":"

        Every actor has a transformation matrix that controls its location and scaling in world space. The actor's geometry is defined by a model in model coordinates. We specify the actor's location using orientation, position, and scale factors along the coordinate axes. In addition, we can define an origin around which the actor rotates. This feature is useful because we can rotate the actor around its center or some other meaningful point.

        The orientation of an actor is determined by rotations stored in an orientation vector (Ox,Roy,Oz). This vector defines a series of rotational transformation matrices. As we saw in the previous section on transformation matrices, the order of application of the transformations is not arbitrary. We have chosen a fixed order based on what we think is natural to users. The order of transformation is a rotation by O y around the y axis, then by around Ox the x axis, and finally by O z around the z axis. This ordering is arbitrary and is based on the standard camera operations. These operations (in order) are a camera azimuth, followed by an elevation, and then a roll (Figure 3-15).

        All of these rotations take place around the origin of the actor. Typically this is set to the center of its bounding box, but it can be set to any convenient point. There are many different methods for changing an actor's orientation. RotateX(), RotateY(), and RotateZ() are common methods that rotate about their respective axes. Many systems also include a method to rotate about a userdefined axis. In the Visualization Toolkit the RotateXYZ() method is used to rotate around an arbitrary vector passing through the origin.

        Figure 3-15. Actor coordinate system."},{"location":"VTKBook/03Chapter3/#39-graphics-hardware","title":"3.9 Graphics Hardware","text":"

        Earlier we mentioned that advances in graphics hardware have had a large impact on how rendering is performed. Now that we have covered the fundamentals of rendering a scene, we look at some of the hardware issues. First, we discuss raster devices that have replaced vector displays as the primary output device. Then, we look at how our programs communicate to the graphics hardware. We also examine the different coordinate systems used in computer graphics, hidden line/surface removal, and z-buffering.

        "},{"location":"VTKBook/03Chapter3/#raster-devices","title":"Raster Devices","text":"

        The results of computer graphics is pervasive in today's world---digital images (generated with computer graphics) may be found on cell phones, displayed on computer monitors, broadcast on TV, shown at the movie theatre and presented on electronic billboards. All of these, and many more, display mediums are raster devices. A raster device represents an image using a two dimensional array of picture elements called pixels. For example, the word \"hello\" can be represented as an array of pixels. as shown in Figure 3-16. Here the word \"hello\" is written within a pixel array that is twenty-five pixels wide and ten pixels high. Each pixel stores one bit of information, whether it is black or white. This is how a black and white laser printer works, for each point on the paper it either prints a black dot or leaves it the color of the paper. Due to hardware limitations, raster devices such as laser printers and computer monitors do not actually draw accurate square pixels like those in Figure 3-16. Instead, they tend to be slightly blurred and overlapping. Another hardware limitation of raster devices is their resolution. This is what causes a 300 dpi (dots per inch) laser printer to produce more detailed output than a nine pin dot matrix printer. A 300 dpi laser printer has a resolution of 300 pixels per inch compared to roughly 50 dpi for the dot matrix printer. Figure 3-16. A pixel array for the word \"hello.\" Figure 3-17. Black and white dithering.

        Color computer monitors typically have a resolution of about 80 pixels per inch, making the screen a pixel array roughly one thousand pixels in width and height. This results in over one million pixels, each with a value that indicates what color it should be. Since the hardware in color monitors uses the RGB system, it makes sense to use that to describe the colors in the pixels. Unfortunately, having over one million pixels, each with a red, green, and blue component, can take up a lot of memory. This is part of what differentiates the variety of graphics hardware on the market. Some companies use 24 bits of storage per pixel, others use eight, some advanced systems use more than 100 bits of storage per pixel. Typically, the more bits per pixel the more accurate the colors will be.

        One way to work around color limitations in the graphics hardware is by using a technique called dithering. Say, for example, that you want to use some different shades of gray, but your graphics hardware only supports black and white. Dithering lets you approximate shades of gray by using a mixture of both black and white pixels. In Figure 3-17, seven gray squares are drawn using a mixture of black and white pixels. From a distance the seven squares look like different shades of gray even though up close, it's clear that they are just different mixtures of black and white pixels. This same technique works just as well for other colors. For example, if your graphics hardware supports primary blue, primary green, and white but not a pastel sea green, you can approximate this color by dithering the green, blue, and white that the hardware does support."},{"location":"VTKBook/03Chapter3/#interfacing-to-the-hardware","title":"Interfacing to the Hardware","text":"

        Now that we have covered the basics of display hardware, the good news is that you rarely need to worry about them. Most graphics programming is done using higher-level primitives than individual pixels. Figure 3-18 shows a typical arrangement for a visualization program. At the bottom of the hierarchy is the display hardware that we already discussed; chances are your programs will not interact directly with it. The top three layers above the hardware are the layers you may need to be concerned with.

        Many programs take advantage of application libraries as a high-level interface to the graphics capabilities of a system. The Visualization Toolkit accompanying this book is a prime example of this. It allows you to display a complex object or graph using just a few commands. It is also possible to interface to a number of different graphics libraries, since different libraries may be supported on different hardware platforms.

        The graphics library and graphics hardware layers both perform similar functions. They are responsible for taking high-level commands from an application library or program, and executing them. This makes programming much easier by providing more complex primitives to work with. Instead of drawing pixels one at a time, we can draw primitives like polygons, triangles, and lines, without worrying about the details of which pixels are being set to which colors. Figure 3-19 illustrates some high-level primitives that all mainstream graphics libraries support.

        This functionality is broken into two different layers because different machines may have vastly different graphics hardware. If you write a program that draws a red polygon, either the graphics library or the graphics hardware must be able to execute that command. On high-end systems, this may be done in the graphics hardware, on others it will be done by the graphics library in software. So the same commands can be used with a wide variety of machines, without worrying about the underlying graphics hardware.

        The fundamental building block of the primitives in Figure 3-19 is a point (or vertex). A vertex has a position, normal, and color, each of which is a three element vector. The position specifies where the vertex is located, its normal specifies which direction the vertex is facing, and its color specifies the vertex's red, green, and blue components.

        A polygon is built by connecting a series of points or vertices as shown in Figure 3-20. You may be wondering why each vertex has a normal, instead of having just one normal for the entire polygon. A planar polygon can only be facing one direction regardless of what the normals of its vertices indicate. The reason is that sometimes a polygon is used as an approximation of something else, like a curve. Figure 3-21 shows a top-down view of a cylinder. As you can see, it's not really a cylinder but rather a polygonal approximation of the cylinder drawn in gray. Each vertex is shared by two polygons and the correct normal for the vertex is not the same as the normal for the polygon. Similar logic explains why each vertex has a color instead of just having one color for an entire polygon. Figure 3-18. Typical graphics interface hierarchy. Figure 3-19. Graphics primitives.

        When you limit yourself to the types of primitives described above, there are some additional properties that many graphics systems support. Edge color and edge visibility can be used to highlight the polygon primitives that make up an actor. Another way to do this is by adjusting the representation from surface to wireframe or points. This replaces surfaces such as polygons with either their boundary edges or points respectively. While this may not make much sense from a physical perspective, it can help in some illustrations. Using edge visibility when rendering a CAD model can help to show the different pieces that comprise the model.

        "},{"location":"VTKBook/03Chapter3/#rasterization","title":"Rasterization","text":"

        At this point in the text we have described how to represent graphics data using rendering primitives, and we have described how to represent images using raster display devices. The question remains, how do we convert graphics primitives into a raster image? This is the topic we address in this section. Although a thorough treatise on this topic is beyond the scope of this text, we will do our best to provide a high-level overview.

        Figure 3-20. An example polygon. Figure 3-21. Vertex and polygon normals.

        The process of converting a geometric representation into a raster image is called rasterization or scan conversion. In the description that follows we assume that the graphics primitives are triangle polygons. This is not as limiting as you might think, because any general polygon can be tessellated into a set of triangles. Moreover, other surface representations such as splines are usually tessellated by the graphics system into triangles or polygons. (The method described here is actually applicable to convex polygons.)

        Most of today's hardware is based on object-order rasterization techniques. As we saw earlier in this chapter, this means processing our actors in order. And since our actors are represented by polygon primitives, we process polygons one at a time. So although we describe the processing of one polygon, bear in mind that many polygons and possibly many actors are processed.

        The first step is to transform the polygon using the appropriate transformation matrix. We also project the polygon to the image plane using either parallel or orthographic projection. Part of this process involves clipping the polygons. Not only do we use the front and back clipping planes to clip polygons too close or too far, but we must also clip polygons crossing the boundaries of the image plane. Clipping polygons that cross the boundary of the view frustum means we have to generate new polygonal boundaries.

        Figure 3-22. Rasterizing a convex polygon. Pixels are processed in horizontal spans (or scan-lines) in the image plane. Data values $d_i$ at point $p_i$ are interpolated along the edges and then along the scan-line using delta data values. Typical data values are RGB components of color.

        With the polygon clipped and projected to the image plane, we can begin scan-line processing (Figure 3-22). The first step identifies the initial scan-line intersected by the projected polygon. This is found by sorting the vertices' y values. We then find the two edges joining the vertex on the left and right sides. Using the slopes of the edges along with the data values we compute delta data values. These data are typically the R, G, and B color components. Other data values include transparency values and z depth values. (The z values are necessary if we are using a z-buffer, described in the next section.) The row of pixels within the polygon (i.e., starting at the left and right edges) is called a span. Data values are interpolated from the edges on either side of the span to compute the internal pixel values. This process continues span-by-span, until the entire polygon is filled. Note that as new vertices are encountered, it is necessary to recompute the delta data values.

        The shading of the polygon (i.e., color interpolation across the polygon) varies depending on the actor's interpolation attribute. There are three possibilities: flat, Gouraud, or Phong shading. Figure 3-7 illustrates the difference between flat and Gouraud interpolation. Flat shading calculates the color of a polygon by applying the lighting equations to just one normal (typically the surface normal) of the polygon. Gouraud shading calculates the color of a polygon at all of its vertices using the vertices' normals and the standard lighting equations. The interior and edges of the poly-gon are then filled in by applying the scan-line interpolation process. Phong shading is the most realistic of the three. It calculates a normal at every location on the polygon by interpolating the vertex normals. These are then used in the lighting equations to determine the resulting pixel colors. Both flat and Gouraud shading are commonly used methods. The complexity of Phong shading has prevented it from being widely supported in hardware."},{"location":"VTKBook/03Chapter3/#z-buffer","title":"Z-Buffer","text":"

        In our earlier description of the rendering process, we followed rays of light from our eye through a pixel in the image plane to the actors and back to the light source. A nice side effect of ray tracing is that viewing rays strike the first actor they encounter and ignore any actors that are hidden behind it. When rendering actors using the polygonal methods described above, we have no such method of computing which polygons are hidden and which are not. We cannot generally count on the polygons being ordered correctly. Instead, we can use a number of hidden-surface methods for polygon rendering.

        One method is to sort all of our polygons from back to front (along the camera's view vector) and then render them in that order. This is called the painter's algorithm or painter's sort, and has one major weakness illustrated in Figure 3-23. Regardless of the order in which we draw these three triangles, we cannot obtain the desired result, since each triangle is both in front of, and behind, another triangle. There are algorithms that sort and split polygons as necessary to treat such a situation [Carlson85]. This requires more initial processing to perform the sorting and splitting. If the geometric primitives change between images or the camera view changes, then this processing must be performed before each render. Figure 3-23. Problem with Painter's algorithm.

        Another hidden surface algorithm, z-buffering, takes care of this problem and does not require sorting. Z-buffering takes advantage of the z-value (i.e., depth value along direction of projection) in the view coordinate system. Before a new pixel is drawn, its z-value is compared against the current z-value for that pixel location. If the new pixel would be in front of the current pixel, then it is drawn and the z-value for that pixel location is updated. Otherwise the current pixel remains and the new pixel is ignored. Z-buffering has been widely implemented in hardware because of its simplicity and robustness. The downside to z-buffering is that it requires a large amount of memory, called a z-buffer, to store a z-value of every pixel. Most systems use a z-buffer with a depth of 24 or 32 bits. For a 1000 by 1000 display that translates into three to four megabytes just for the z-buffer. Another problem with z-buffering is that its accuracy is limited depending on its depth. A 24-bit z-buffer yields a precision of one part in 16,777,216 over the height of the viewing frustum. This resolution is often insufficient if objects are close together. If you do run into situations with z-buffering accuracy, make sure that the front and back clipping planes are as close to the visible geometry as possible.

        "},{"location":"VTKBook/03Chapter3/#310-putting-it-all-together","title":"3.10 Putting It All Together","text":"

        This section provides an overview of the graphics objects and how to use them in VTK.

        "},{"location":"VTKBook/03Chapter3/#the-graphics-model","title":"The Graphics Model","text":"Figure 3-24. Illustrative diagram of graphics objects. See Model.cxx and Model.py.

        We have discussed many of the objects that play a part in the rendering of a scene. Now it's time to put them together into a comprehensive object model for graphics and visualization.

        In the Visualization Toolkit there are seven basic objects that we use to render a scene. There are many more objects behind the scenes, but these seven are the ones we use most frequently. The objects are listed in the following and illustrated in Figure 3-24.

        1. vtkRenderWindow --- manages a window on the display device; one or more renderers draw into an instance of vtkRenderWindow.

        2. vtkRenderer --- coordinates the rendering process involving lights, cameras, and actors.

        3. vtkLight --- a source of light to illuminate the scene.

        4. vtkCamera --- defines the view position, focal point, and other viewing properties of the scene.

        5. vtkActor --- represents an object rendered in the scene, including its properties and position in the world coordinate system. (Note: vtkActor is a subclass of vtkProp. vtkProp is a more general form of actor that includes annotation and 2D drawing classes. See \"Assemblies and Other Types of vtkProp\" for more information.)

        6. vtkProperty --- defines the appearance properties of an actor including color, transparency, and lighting properties such as specular and diffuse. Also representational properties like wireframe and solid surface.

        7. vtkMapper --- the geometric representation for an actor. More than one actor may refer to the same mapper.

        The class vtkRenderWindow ties the rendering process together. It is responsible for managing a window on the display device. For PCs running Windows, this will be a Microsoft display window, for Linux and UNIX systems this will be an X window, and on the Mac (OSX) a Quartz window. In VTK, instances of vtkRenderWindow are device independent. This means that you do not need to be concerned about what underlying graphics hardware or software is being used, the software automatically adapts to your computer as instances of vtkRenderWindow are created. (See \"Achieving Device Independence\" for more information.)

        In addition to window management, vtkRenderWindow objects are used to manage renderers and store graphics specific characteristics of the display window such as size, position, window title, window depth, and the double buffering flag. The depth of a window indicates how many bits are allocated per pixel. Double buffering is a technique where a window is logically divided into two buffers. At any given time one buffer is currently visible to the user. Meanwhile, the second buffer can be used to draw the next image in an animation. Once the rendering is complete, the two buffers can be swapped so that the new image is visible. This common technique allows animations to be displayed without the user seeing the actual rendering of the primitives. High-end graphics systems perform double buffering in hardware. A typical system would have a rendering window with a depth of 72 bits. The first 24 bits are used to store the red, green, and blue (RGB) pixel components for the front buffer. The next 24 bits store the RGB values for the back buffer. The last 24 bits are used as a z-buffer.

        The class vtkRenderer is responsible for coordinating its lights, camera, and actors to produce an image. Each instance maintains a list of the actors, lights, and an active camera in a particular scene. At least one actor must be defined, but if lights and a camera are not defined, they will be created automatically by the renderer. In such a case the actors are centered in the image and the default camera view is down the z-axis. Instances of the class vtkRenderer also provide methods to specify the background and ambient lighting colors. Methods are also available to convert to and from world, view, and display coordinate systems.

        One important aspect of a renderer is that it must be associated with an instance of the vtkRenderWindow class into which it is to draw, and the area in the render window into which it draws must be defined by a rectangular viewport. The viewport is defined by normalized coordinates (0,1) in both the x and y image coordinate axes. By default, the renderer draws into the full extent of the rendering window (viewpoint coordinates (0,0,1,1)). It is possible to specify a smaller viewport. and to have more than one renderer draw into the same rendering window.

        Instances of the class vtkLight illuminate the scene. Various instance variables for orienting and positioning the light are available. It is also possible to turn on/off lights as well as setting their color. Normally at least one light is \"on\" to illuminate the scene. If no lights are defined and turned on, the renderer constructs a light automatically. Lights in VTK can be either positional or infinite. Positional lights have an associated cone angle and attenuation factors. Infinite lights project light rays parallel to one another.

        Cameras are constructed by the class vtkCamera. Important parameters include camera position, focal point, location of front and back clipping planes, view up vector, and field of view. Cameras also have special methods to simplify manipulation as described previously in this chapter.

        These include elevation, azimuth, zoom, and roll. Similar to vtkLight, an instance of vtkCamera will be created automatically by the renderer if none is defined.

        Instances of the class vtkActor represent objects in the scene. In particular, vtkActor combines object properties (color, shading type, etc.), geometric definition, and orientation in the world coordinate system. This is implemented behind the scenes by maintaining instance variables that refer to instances of vtkProperty, vtkMapper, and vtkTransform. Normally you need not create properties or transformations explicitly, since these are automatically created and manipulated using vtkActor 's methods. You do need to create an instance of vtkMapper (or one of its subclasses). The mapper ties the data visualization pipeline to the graphics device. (We will say more about the pipeline in the next chapter.)

        In VTK, actors are actually subclasses of vtkProp (arbitrary props) and vtkProp3D (those that can be transformed in 3D space. (The word \"prop\" is derived from the stage, where a prop is an object in the scene.) There are other subclasses of props and actors with specialized behavior (see \"Assemblies and Other Types of vtkProp\" for more information). One example is vtkFollower. Instances of this class always face the active camera. This is useful when designing signs or text that must be readable from any camera position in the scene.

        Instances of the class vtkProperty affect the rendered appearance of an actor. When actors are created, a property instance is automatically created with them. It is also possible to create property objects directly and then associate the property object with one or more actors. In this way actors can share common properties.

        Finally, vtkMapper (and its subclasses) defines object geometry and, optionally, vertex colors. In addition, vtkMapper refers to a table of colors (i.e., vtkLookupTable) that are used to color the geometry. (We discuss mapping of data to colors in \"Color Mapping\" in Chapter 6.) We will examine the mapping process in more detail in \"Mapper Design\" in Chapter 6. For now assume that vtkMapper is an object that represents geometry and other types of visualization data.

        There is another important object, vtkRenderWindowInteractor, that captures events (such as mouse clicks and mouse motion) for a renderer in the rendering window. vtkRenderWindowInteractor captures these events and then triggers certain operations like camera dolly, pan, and rotate, actor picking, into/out of stereo mode, and so on. Instances of this class are associated with a rendering window using the SetRenderWindow() method.

        "},{"location":"VTKBook/03Chapter3/#achieving-device-independence","title":"Achieving Device Independence","text":"

        A desirable property of applications built with VTK is that they are device independent. This means that computer code that runs on one operating system with a particular software/hardware configuration runs unchanged on a different operating system and software/hardware configuration. The advantage of this is that the programmer does not need to expend effort porting an application between different computer systems. Also, existing applications do not need to be rewritten to take advantage of new developments in hardware or software technology. Instead, VTK handles this transparently by a combination of inheritance and a technique known as object factories.

        (a) Inheritance of device classes. (Note: in VTK 4.2 the Starbase and XGL graphics libraries are no longer supported.) (b) Code fragment from vtkActor::New() (c) Code fragment from vtkGraphicsFactory::CreateInstance(vtkclassname). Figure 3-25. Achieving device independence using (a) inheritance and object factories (b) and (c).

        Figure 3-25a illustrates the use of inheritance to achieve device independence. Certain classes like vtkActor are broken into two parts: a device independent superclass and a device dependent subclass. The trick here is that the user creates a device dependent subclass by invoking the special constructor New() in the device independent superclass. For example we would use (in C++)

        vtkActor *anActor = vtkActor::New()\n

        to create a device dependent instance of vtkActor. The user sees no device dependent code, but in actuality anActor is a pointer to a device dependent subclass of vtkActor. Figure 3-25b is a code fragment of the constructor method New() which uses VTK's object factory mechanism. In turn, the vtkGraphicsFactory (used to instantiate graphical classes) produces the appropriate concrete subclass when requested to instantiate an actor as shown in Figure 3-25c.

        The use of object factories as implemented using the New() method allows us to create device independent code that can move from computer to computer and adapt to changing technology. For example, if a new graphics library became available, we would only have to create a new device dependent subclass, and then modify the graphics factory to instantiate the appropriate sub-class based on environment variables or other system information. This extension would be localized and only done once, and all applications based on these object factories would be automatically ported without change.

        "},{"location":"VTKBook/03Chapter3/#examples","title":"Examples","text":"

        This section works through some simple applications implemented with VTK graphics objects. The focus is on the basics: how to create renderers, lights, cameras, and actors. Later chapters tie together these basic principles to create applications for data visualization.

        . The following C++ code uses most of the objects introduced in this section to create an image of a cone. The vtkConeSource generates a polygonal representation of a cone and vtkPolyDataMapper maps the geometry (in conjunction with the actor) to the underlying graphics library. (The source code to this example can be found in Cone.cxx. The source code contains additional documentation as well.) 2

        #include <vtkSmartPointer.h>\n#include <vtkConeSource.h>\n\n#include <vtkActor.h>\n#include <vtkPolyData.h>\n#include <vtkPolyDataMapper.h>\n#include <vtkProperty.h>\n#include <vtkRenderWindow.h>\n#include <vtkRenderWindowInteractor.h>\n#include <vtkRenderer.h>\n#include <vtkNamedColors.h>\n\nint main(int, char *[])\n{\n  //Create a cone\n  auto coneSource =\n    vtkSmartPointer<vtkConeSource>::New();\n  coneSource->SetHeight( 3.0);\n  coneSource->SetRadius( 1.0);\n  coneSource->SetResolution( 10);\n  coneSource->Update();\n\n  //Create a mapper and actor\n  auto mapper =\n    vtkSmartPointer<vtkPolyDataMapper>::New();\n  mapper->SetInputConnection(coneSource->GetOutputPort());\n\n  auto colors =\n    vtkSmartPointer<vtkNamedColors>::New();\n\n  auto actor =\n    vtkSmartPointer<vtkActor>::New();\n  actor->SetMapper(mapper);\n  actor->GetProperty()->SetDiffuseColor(colors->GetColor3d(\"bisque\").GetData());\n\n  //Create a renderer, render window, and interactor\n  auto renderer =\n    vtkSmartPointer<vtkRenderer>::New();\n  auto renderWindow =\n    vtkSmartPointer<vtkRenderWindow>::New();\n  renderWindow->AddRenderer(renderer);\n  renderWindow->SetSize(640, 480);\n\n  auto renderWindowInteractor =\n    vtkSmartPointer<vtkRenderWindowInteractor>::New();\n  renderWindowInteractor->SetRenderWindow(renderWindow);\n\n  //Add the actors to the scene\n  renderer->AddActor(actor);\n  renderer->SetBackground(colors->GetColor3d(\"Salmon\").GetData());\n\n  //Render and interact\n  renderWindow->Render();\n  renderWindowInteractor->Start();\n\n  return EXIT_SUCCESS;\n}\n
        Figure 3-26. Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source. Other polygonal source objects are available; check subclasses of vtkPolyDataAlgorithm. See SourceObjectsDemo.cxx and SourceObjectsDemo.py.

        Some comments about this example. The include files vtk__.h include class definitions for the objects in VTK necessary to compile this example. We use the constructor New() to create the objects in this example, and the method Delete() to destroy the objects. In VTK the use of New() and Delete() is mandatory to insure device independence and properly manage reference counting. (See VTK User's Guide for details.) In this example the use of Delete() is really not necessary because the objects are automatically deleted upon program termination. But generally speaking, you should always use a Delete() for every invocation of New(). (Future examples will not show the Delete() methods in the scope of the main() program to conserve space, nor show the required #include statements.)

        The data representing the cone (a set of polygons) in this example is created by linking together a series of objects into a pipeline (which is the topic of the next chapter). First a polygonal representation of the cone is created with a vtkConeSource and serves as input to the data mapper as specified with the SetInput() method. The SetMapper() method associates the mapper's data with the coneActor. The next line adds coneActor to the renderer's list of actors. The cone is rendered in a loop running over 360 o. Since there are no cameras or lights defined in the above example, VTK automatically generates a default light and camera as a convenience to the user. The camera is accessed through the GetActiveCamera() method, and a one degree azimuth is applied as shown. Each time a change is made to any objects a Render() method is invoked to produce the corresponding image. Once the loop is complete all allocated objects are destroyed and the program exits.

        There are many different types of source objects in VTK similar to vtkConeSource as shown in Figure 3-26. In the next chapter we will learn more about source and other types of filters.

        Events and Observers. A visualization toolkit like VTK is frequently used in interactive applications or may be required to provide status during operation. In addition, integration with other packages such as GUI toolkits is a common task. Supporting such features requires a mechanism for inserting user functionality into the software. In VTK, the command/observer design pattern [Gamma95] is used for this purpose.

        Fundamental to this design pattern as implemented in VTK is the concept of events. An event signals that an important operation has occurred in the software. For example, if the user presses the left mouse button in the render window, VTK will invoke the LeftButtonPressEvent. Observers are objects that register their interest in a particular event or events. When one of these events is invoked, the observer receives notification and may perform any valid operation at that point; that is, execute the command associated with the observer. The benefit of the command/observer design pattern is that is simple in concept and implementation, yet provides significant power to the user. However it does require the software implementation to invoke events as it operates.

        In the next example, an observer watches for the StartEvent invoked by the renderer just as it begins the rendering process. The observer in turn executes its associated command which simply prints out the camera's current position.

        #include \"vtkCommand.h\"\n// Callback for the interaction\nclass vtkMyCallback : public vtkCommand\n{\npublic:\n  static vtkMyCallback *New()\n    { return new vtkMyCallback; }\n  virtual void Execute(vtkObject *caller, unsigned long, void*)\n    {\n      vtkRenderer *ren =\n               reinterpret_cast<vtkRenderer*>(caller);\n      cout << ren->GetActiveCamera()->GetPosition()[0] << \" \"\n      ren->GetActiveCamera()->GetPosition()[1] << \" \"\n      ren->GetActiveCamera()->GetPosition()[2] << \"n\";\n    }\n};\n\nint main( int argc, char *argv[] )\n{\n  vtkConeSource *cone = vtkConeSource::New();\n  cone->SetHeight( 3.0 );\n  cone->SetRadius( 1.0 );\n  cone->SetResolution( 10 );\n\n  vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();\n  coneMapper->SetInputConnection( cone->GetOutputPort() ); vtkActor\n  *coneActor = vtkActor::New(); coneActor->SetMapper( coneMapper );\n\n  vtkRenderer *ren1= vtkRenderer::New();\n  ren1->AddActor( coneActor );\n  ren1->SetBackground( 0.1, 0.2, 0.4 );\n\n  vtkRenderWindow *renWin = vtkRenderWindow::New();\n  renWin->AddRenderer( ren1 ); renWin->SetSize( 300, 300 );\n\n  vtkMyCallback *mo1 = vtkMyCallback::New();\n  ren1->AddObserver(vtkCommand::StartEvent,mo1); mo1->Delete();\n\n  int i;\n  for (i = 0; i < 360; ++i)\n  {\n  //   render the image\n    renWin->Render();\n  // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth( 1 );\n  }\n\n  cone->Delete();\n  coneMapper->Delete();\n  coneActor->Delete();\n  ren1->Delete();\n  renWin->Delete();\n  return 0;\n}\n

        The observer is created by deriving from the class vtkCommand. The Execute() method is required to be implemented by any concrete subclass of vtkCommand (i.e., the method is pure virtual). The resulting subclass, vtkMyCommand, is instantiated and registered with the renderer instance ren1 using the AddObserver() method. In this case the StartEvent is the observed event.

        This simple example does not demonstrate the true power of the command/observer design pattern. Later in this chapter ( \"Interpreted Code\") we will see how this functionality is used to integrate a simple GUI into VTK. In Chapter 7 - Advanced Computer Graphics three-dimensional interaction widgets will be introduced ( [\"3D Widgets and User Interaction\"]/VTKBook/07Chapter7/#718-3d-widgets-and-user-interaction).

        Creating Multiple Renderers. The next example is a bit more complex and uses multiple renderers that share a single rendering window. We use viewports to define where the renderers should draw in the render window. (This C++ code can be found in Cone3.cxx.)

        Figure 3-27. Four frames of output from Cone3.cxx. See Cone3.cxx and Cone3.py.
        vtkRenderer *ren1= vtkRenderer::New();\nren1->AddActor( coneActor );\nren1->SetBackground( 0.1, 0.2, 0.4 );\nren1->SetViewport(0.0, 0.0, 0.5, 1.0);\n\nvtkRenderer *ren2= vtkRenderer::New();\nren2->AddActor( coneActor );\nren2->SetBackground( 0.2, 0.3, 0.5 );\nren2->SetViewport(0.5, 0.0, 1.0, 1.0);\n\nvtkRenderWindow *renWin = vtkRenderWindow::New();\nrenWin->AddRenderer( ren1 ); renWin->AddRenderer( ren2 );\nrenWin->SetSize( 600, 300 );\n\nren1->GetActiveCamera()->Azimuth(90);\n\nint i;\nfor (i = 0; i < 360; ++i)\n  {\n  // render the image renWin->Render();\n  // rotate the active camera by one degree\n    ren1->GetActiveCamera()->Azimuth( 1 );\n    ren2->GetActiveCamera()->Azimuth( 1 );\n  }\n

        As you can see, much of the code is the same as the previous example. The first difference is that we create two renderers instead of one. We assign the same actor to both renderers, but set each renderer's background to a different color. We set the viewport of the two renderers so that one is on the left half of the rendering window and the other is on the right. The rendering window's size is specified as 600 by 300 pixels, which results in each renderer drawing into a viewport of 300 by 300 pixels.

        A good application of multiple renderers is to display different views of the same world as demonstrated in this example. Here we adjust the first renderer's camera with a 90 degree azimuth. We then start a loop that rotates the two cameras around the cone. Figure 3-27 shows four frames from this animation.

        Properties and Transformations. The previous examples did not explicitly create property or transformation objects or apply actor methods that affect these objects. Instead, we accepted default instance variable values. This procedure is typical of VTK applications. Most instance variables have been preset to generate acceptable results, but methods are always available for you to overide the default values.

        Figure 3-28. Modifying properties and transformation matrix. See Cone4.cxx and Cone4.py.

        This example creates an image of two cones of different colors and specular properties. In addition, we transform one of the objects to lay next to the other. The C++ source code for this example can be found in Cone4.cxx.

        vtkActor *coneActor = vtkActor::New();\nconeActor->SetMapper(coneMapper);\nconeActor->GetProperty()->SetColor(0.2, 0.63, 0.79);\nconeActor->GetProperty()->SetDiffuse(0.7);\nconeActor->GetProperty()->SetSpecular(0.4);\nconeActor->GetProperty()->SetSpecularPower(20);\n\nvtkProperty *property = vtkProperty::New();\nproperty->SetColor(1.0, 0.3882, 0.2784);\nproperty->SetDiffuse(0.7);\nproperty->SetSpecular(0.4);\nproperty->SetSpecularPower(20);\n\nvtkActor *coneActor2 = vtkActor::New();\nconeActor2->SetMapper(coneMapper);\nconeActor2->GetProperty()->SetColor(0.2, 0.63, 0.79);\nconeActor2->SetProperty(property); coneActor2->SetPosition(0, 2, 0);\n\nvtkRenderer *ren1= vtkRenderer::New();\nren1->AddActor( coneActor );\nren1->AddActor( coneActor2 );\nren1->SetBackground( 0.1, 0.2, 0.4 );\n

        We set the actor coneActor properties by modifying the property object automatically created by the actor. This differs from actor coneActor2, where we create a property directly and then assign it to the actor. ConeActor2 is moved from its default position by applying the SetPosition() method. This method affects the transformation matrix that is an instance variable of the actor. The resulting image is shown in Figure 3-28.

        Introducing vtkRenderWindowInteractor. The previous examples are not interactive. That is, it is not possible to directly interact with the data without modifying and recompiling the C++ code. One common type of interaction is to change camera position so that we can view our scene from different vantage points. In the Visualization Toolkit we have provided a suite of convenient objects to do this: vtkRenderWindowInteractor, vtkInteractorStyle and their derived classes.

        Instances of the class vtkRenderWindowInteractor capture windowing system specific mouse and keyboard events in the rendering window, and then translate these events into VTK events. For example, mouse motion in an X11 or Windows application (occurring in a render window) would be translated by vtkRenderWindowInteractor into VTK's MouseMoveEvent. Any observers regis- tered for this event would be notified (see \"Events and Observers\"). Typically an instance of vtkInteractorStyle is used in combination with vtkRenderWindowInteractor to define a behavior associated with particular events. For example, we can perform camera dolly, pan, and rotation by using different mouse button and motion combinations. The following code fragment shows how to instantiate and use these objects. This example is the same as our first example with the addition of the interactor and interactor style. The complete example C++ code is in Cone5.cxx.

        vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();\niren->SetRenderWindow(renWin);\n\nvtkInteractorStyleTrackballCamera *style =\n vtkInteractorStyleTrackballCamera::New();\n\niren->SetInteractorStyle(style);\niren->Initialize();\niren->Start();\n

        After the interactor is created using its New() method, we must tell it what render window to capture events in using the SetRenderWindow() method. In order to use the interactor we have to initialize and start the event loop using the Initialize() and Start() methods, which works with the event loop of the windowing system to begin to catch events. Some of the more useful events include the \" w\" key, which draws all actors in wireframe; the \" s\" key, which draws the actors in surface form; the \" 3\" key, which toggles in and out of 3D stereo for those systems that support this; the \"r\" key, which resets camera view; and the \" e\" key, which exits the application. In addition, the mouse buttons rotate, pan, and dolly about the camera's focal point. Two advanced features are the \"u\" key, which executes a user-defined function; and the \" p\" key, which picks the actor under the mouse pointer.

        Interpreted Code. In the previous example we saw how to create an interactor style object in conjunction with vtkRenderWindowInteractor to enable us to manipulate the camera by mousing in the render window. Although this provides flexibility and interactivity for a large number of applications, there are examples throughout this text where we want to modify other parameters. These parameters range from actor properties, such as color, to the name of an input file. Of course we can always write or modify C++ code to do this, but in many cases the turn-around time between making the change and seeing the result is too long. One way to improve the overall interactivity of the system is to use an interpreted interface. Interpreted systems allow us to modify objects and immediately see the result, without the need to recompile and relink source code. Interpreted languages also provide many tools, such as GUI (Graphical User Interface) tools, that simplify the creation of applications.

        The Visualization Toolkit has built into its compilation process the ability to automatically generate language bindings to the [Ousterhout94]. This so-called wrapping process automatically creates a layer between the C++ VTK library and the interpreter as illustrated in Figure 3-29. There is a one-to-one mapping between C++ methods and Python C++ functions for most objects and methods in the system. To demonstrate this, the following example repeats the previous C++ example except that it is implemented with a Python script. (The script can be found in Cone5.py.) Figure 3-29. In VTK the C++ library is automatically wrapped with the interpreted languages Python and Java.

        !/usr/bin/env python\nimport vtk\ncolors = vtk.vtkNamedColors ()\n\ncone = vtk.vtkConeSource ()\ncone.SetHeight ( 3.0 )\ncone.SetRadius ( 1.0 )\ncone.SetResolution ( 10 )\n\nconeMapper = vtk.vtkPolyDataMapper ()\nconeMapper.SetInputConnection (cone.GetOutputPort ())\n\nconeActor = vtk.vtkActor ()\nconeActor.SetMapper ( coneMapper )\n\nren1 = vtk.vtkRenderer ()\nren1.AddActor( coneActor )\nren1.SetBackground (colors.GetColor3d (\"MidnightBlue\"))\n\nrenWin = vtk.vtkRenderWindow ()\nrenWin.AddRenderer (ren1)\nrenWin.SetSize (300 , 300)\n\niren = vtk.vtkRenderWindowInteractor ()\niren.SetRenderWindow (renWin)\n\nstyle = vtk.vtkInteractorStyleTrackballCamera ()\niren.SetInteractorStyle (style)\n\niren.Initialize ()\niren.Start ()\n
        Figure 3-30. Using Tcl and Tk to build an interpreted application.

        The example begins by loading some shared libraries defining various VTK classes. Next the standard visualization pipeline is created from the vtkConeSource and vtkPolyDataMapper. The rendering classes are created exactly the same as with the C++ example. One major addition is an observer to watch for a UserEvent in the rendering window (by default a \"keypress-u\"). The observer triggers the invocation of a Tcl script to raise a Tk interactor GUI widget called.vtkInteract. This GUI, which allows the direct typing of Tcl statements, is shown in Figure 3-30 and is defined by the Tcl command package require vtkinteraction which was executed earlier in the script. (Note: Tk is a popular GUI toolkit for interpreted languages and is distributed as part of Tcl.)

        As we can see from this example, the number of lines of code is less for the Tcl example than for equivalent C++ code. Also, many of the complexities of C++ are hidden using the interpreted language. Using this user-interface GUI we can create, modify, and delete objects, and modify their instance variables. The resulting changes appear as soon as a Render() method is applied or mouse events in the rendering window cause a render to occur. We encourage you to use Tcl (or one of the other interpreters) for rapid creation of graphics and visualization examples. C++ is best used when you desire higher performing applications.

        "},{"location":"VTKBook/03Chapter3/#transform-matrices","title":"Transform Matrices","text":"

        Transformation matrices are used throughout Visualization Toolkit. Actors (subclasses of vtkProp3D) see \"Assemblies and Other Types of vtkProp\" use them to position and orient themselves. Various filters, including vtkGlyph3D and vtkTransformFilter, use transformation matrices to implement their own functionality. As a user you may never use transformation matrices directly, but understanding them is important to successful use of many VTK classes.

        The most important aspect to applying transformation matrices is to understand the order in which the transformations are applied. If you break down a complex series of transformations into simple combinations of translation, scaling, and rotation, and keep careful track of the order of application, you will have gone a long way to mastering their use.

        A good demonstration example of transformation matrices is to examine how vtkActor uses its internal matrix. vtkActor has an internal instance variable Transform to which it delegates many of its methods or uses the matrix to implement its methods. For example, the RotateX(), RotateY(),and RotateZ() methods are all delegated to Transform. The method SetOrientation() uses Transform to orient the actor. The vtkActor class applies transformations in an order that we feel is natural to most users.

        The vtkActor class applies transformations in an order that we feel is natural to most users. As a convenience, we have created instance variables that abstract the transformation matrices. The Origin (o_x,o_y,o_z) specifies the point that is the center of rotation and scaling. The Position (p_x, p_y, p_z) specifies a final translation of the object. Orientation (r_x, r_y, r_z) defines the rotation about the x, y and z axes. Scale (s_x, s_y, s_z) defines scale factors for the x, y, and z axes. Internally, the actor uses these instance variables to create the following sequence of transformations (see Equation3-6, Equation3-9, Equation3-13).

        T = T_T(p_x + o_{x'}p_y + o_{y'}p_y + o_z)T_{R_z}T_{R_x}T_{R_z}T_ST_T(-o_x,-o_y,-o_z) \\bf\\tag{3-14}

        The term T_T(x, y, z) denotes the translations in the x,y and z direction. Recall that we premultiply the transformation matrix times the position vector. This means the transformations are read from right to left. In other words, Equation3-14 proceeds as follows:

        1. Translate the actor to its origin. Scaling and rotation will occur about this point. The initial translation will be countered by a translation in the opposite direction after scaling and rotations are applied.

        2. Scale the geometry.

        3. Rotate the actor about the y, then x, and then z axes.

        4. Undo the translation of step 1 and move the actor to its final location.

        The order of the transformations is important. In VTK the rotations are ordered to what is natural in most cases. We recommend that you spend some time with the software to learn how these transfor-mations work with your own data.

        Probably the most confusing aspect of transformations are rotations and their effect on the Orientation instance variable. Generally orientations are not set directly by the user, and most users will prefer to specify rotations with the RotateX(), RotateY(), and RotateZ() methods. These methods perform rotations about the x, y, and z axes in an order specified by the user. New rotations are applied to the right of the rotation transformation. If you need to rotate your actor about a single axis, the actor will rotate exactly as you expect it will, and the resulting orientation vector will be as expected. For example, the operation RotateY(20) will produce an orientation of (0,20,0) and a RotateZ(20) will produce (0,0,20). However, a RotateY(20) followed by a RotateZ(20) will not produce (0,20,20) but produce an orientation of (6.71771, 18.8817, 18.8817)! This is because the rotation portion of Equation3-14 is built from the rotation order z, then x, and then y. To verify this, a RotateZ(20) followed by a RotateY(20) does produce an orientation of (0,20,20). Adding a third rotation can be even more confusing.

        A good rule of thumb is to only use the SetOrientation() method to either reset the orientation to (0,0,0) or to set just one of the rotations. The RotateX(), RotateY(), and RotateZ() methods are preferred to SetOrientation() when multiple angles are needed. Remember that these rotations are applied in reverse order. Figure 3-31 illustrates the use of the rotation methods. We turn off the erase between frames using the render window's EraseOff() method so we can see the effects of the rotations. Note that in the fourth image the cow still rotates about her own y axis even though an x axis rotation preceded the y rotation. Figure 3-31. Rotations of a cow about her axes. In this model, the *x* axis is from the left to right; the *y* axis is from bottom to top; and the *z* axis emerges from the image. The camera location is the same in all four images. See Rotations.cxx and Rotations.py.

        We have seen that VTK hides some of the complexities of matrix transformations by using instance variables that are more natural than a transformation matrix. But there will be times when the predefined order of transformations performed by the actor will not be sufficient. vtkActor has an instance variable UserMatrix that contains a 4 x 4 transformation matrix. This matrix is applied before the transformation composed by the actor. As you become more comfortable with 4 x 4 transformation matrices you may want to build your own matrix. The object vtkTransform creates and manipulates these matrices. Unlike an actor, an instance of vtkTransform does not have an instance variable for position, scale, origin, etc. You control the composition of the matrix directly.

        The following statements create an identical 4 x 4 matrix that the actor creates:

        vtkTransform *myTrans = vtkTransform::New ();\nmyTrans->Translate(position[0],position[1],position[2]);\nmyTrans->Translate(origin[0],origin[1],origin[2]);\nmyTrans->RotateZ(orientation[2]);\n\nmyTrans->RotateX (orientation[0]);\nmyTrans->RotateZ(orientation[1];\nmyTrans->Scale (scale[0],scale[1],scale[2]);\nmyTrans->Translate (-origin[0],-origin[1],-origin[2]);\n

        Compare this sequence of transform operations with the transformation in Equation3-14.

        Our final example shows how the transform built with vtkTransform compares with a transform built by vtkActor. In this example, we will transform our cow so that she rotates about the world coordinate origin (0,0,0). She will appear to be walking around the origin. We accomplish this in two ways: one using vtkTransform and the actor's UserMatrix, then using the actor's instance variables.

        First, we will move the cow five feet along the z axis then rotate her about the origin. We always specify transformations in the reverse order of their application:

        vtkTransform *walk = vtkTransform::New();\nwalk->RotateY(0,20,0);\nwalk->Translate(0,0,5);\n\nvtkActor *cow=vtkActor::New();\ncow->SetUserMatrix(walk->GetMatrix());\n

        These operations produce the transformation sequence:

        T=T_{R_y}T_ST_T(0, 0, 5) \\bf\\tag{3-15}

        Now we do the same using the cow's instance variables:

        vtkActor *cow=vtkActor::New();\ncow->SetOrigin(0,0,-5);\ncow->RotateY(20);\ncow->SetPosition(0,0,5);\n

        When the actor builds its transform it will be:

        T=T_T(0,0,5-(-5))T_{R_y}T_ST_T(0,0,-(-5)) \\bf\\tag{3-16}

        Canceling the minus signs in the right-most translation matrix and combining the position and origin translation produce the equivalent transform that we built with vtkTranform. Figure 3-32 shows the cow rotating with the specified transformation order. Your preference is a matter of taste and how comfortable you are with matrix transformations. As you become more skilled (and your demands are greater) you may prefer to always build your transformations. VTK gives you the choice.

        There is one final and powerful operation that affects an actor's orientation. You can rotate an actor about an arbitrary vector positioned at the actor's origin. This is done with the actor's (and transform's) RotateWXYZ() method. The first argument of the operation specifies the number of degrees to rotate about the vector specified by the next three arguments. Figure 3-33 shows how to rotate the cow about a vector passing through her nose. At first, we leave the origin at (0,0,0). This is obviously not what we wanted. The second figure shows the rotation when we change the cow's rotation origin to the tip of her nose. Figure 3-32. The cow \"walking\" around the global origin. See WalkCow.cxx and WalkCow.py. (a) (b) Figure 3-33. The cow rotating about a vector passing through her nose. (a) With origin (0,0,0). (b) With origin at (6.1,1.3,.02). See WalkCowA.cxx and WalkCowA.py.; (b). See WalkCowB.cxx and WalkCowB.py."},{"location":"VTKBook/03Chapter3/#assemblies-and-other-types-of-vtkprop","title":"Assemblies and Other Types of vtkProp","text":"

        Often it is desirable to collect actors into a hierarchy of transform-dependent groups. For example, a robot arm may be represented by rigid links connected at joints such as the shoulder joint, upper arm, elbow, lower arm, wrist joint, and hand. In such a configuration, when the shoulder joint rotates, the expected behavior is that the entire arm rotates since the links are connected together. This is an example of what is referred to as an assembly in VTK. vtkAssembly is just one of many actor-like classes in VTK. As Figure 3-34 shows, these classes are arranged into a hierarchy of vtkProps. (In stage and film terminology, a prop is something that appears or is used on stage.) Assemblies are formed in VTK by instantiating a vtkAssembly and then adding parts to it. A part is any instance of vtkProp3D ---including other assemblies. This means that assemblies can be formed into hierarchies (as long as they do not contain self-referencing loops). Assemblies obey the rules of transformation concatenation illustrated in the previous section (see \"Transformation Matrices\"). Here is an example of how to create a simple assembly hierarchy (from assembly.tcl).

        vtkSphereSource sphere\nvtkPolyDataMapper sphereMapper\n   sphereMapper SetInputConnection [sphere GetOutputPort]\nvtkActor sphereActor\n  sphereActor SetMapper sphereMapper\n  sphereActor SetOrigin 2 1 3\n  sphereActor RotateY 6\n  sphereActor SetPosition 2.25 0 0\n  [sphereActor GetProperty] SetColor 1 0 1\n\nvtkCubeSource cube\nvtkPolyDataMapper cubeMapper\n  cubeMapper SetInputConnection [cube GetOutputPort]\nvtkActor cubeActor\n  cubeActor SetMapper cubeMapper\n  cubeActor SetPosition 0.0 .25 0\n  [cubeActor GetProperty] SetColor 0 0 1\n\nvtkConeSource cone\nvtkPolyDataMapper coneMapper\n  coneMapper SetInputConnection [cone GetOutputPort]\nvtkActor coneActor\n  coneActor SetMapper coneMapper\n  coneActor SetPosition 0 0 .25\n  [coneActor GetProperty] SetColor 0 1 0\n\nvtkCylinderSource cylinder\nvtkPolyDataMapper cylinderMapper\n  cylinderMapper SetInputConnection [cylinder GetOutputPort]\n  cylinderMapper SetResolveCoincidentTopologyToPolygonOffset\n\nvtkActor cylinderActor\n  cylinderActor SetMapper cylinderMapper\n  [cylinderActor GetProperty] SetColor 1 0 0\n\nvtkAssembly assembly\n  assembly AddPart cylinderActor\n  assembly AddPart sphereActor\n  assembly AddPart cubeActor\n  assembly AddPart coneActor\n  assembly SetOrigin 5 10 15\n\n# allows faces a specified camera and is used for billboards.\n  assembly AddPosition 5 0 0\n  assembly RotateX 15\n\nren1 AddActor assembly\nren1 AddActor coneActor\n
        Figure 3-34. Figure 3-34 The vtkProp hierarchy. Props that can be transformed in 3D space are a subclass of vtkProp3D. Images can be drawn effectively with vtkImageActor. Overlay text and graphics use vtkActor2D. Hierarchical groups of vtkProps are gathered into a vtkPropAssembly. Volume rendering uses vtkVolume. Collections of transformable props create a vtkAssembly. Level-of-detail rendering uses vtkLODProp3D and vtkLODActor. A vtkFollower allows faces a specified camera and is used for billboards.

        Note that in this example various actors are added to the assembly with the AddPart() method. The top-level element of the assembly is the only prop in the hierarchy added to the renderer (with AddActor()). Note also that the coneActor appears twice: once as a part of the assembly, and once as a separate actor added to the renderer with AddActor(). As you might imagine, this means that the rendering of assemblies requires concatenation of transformation matrices to insure the correct positioning of each vtkProp3D. Furthermore, hierarchical assemblies require special treatment during picking (i.e., graphically selecting props) since a vtkProp can appear more than once in differ-ent assembly hierarchies. Picking issues are discussed in more detail in \"Picking\" in Chapter 8.

        As Figure 3-34 indicates, there are other types of vtkProp as well. Most of these will be informally described in the many examples found in this book. In particular, extensive coverage is given to vtkVolume when we describe volume rendering (see \"Volume Rendering\" in Chapter 7)."},{"location":"VTKBook/03Chapter3/#311-chapter-summary","title":"3.11 Chapter Summary","text":"

        Rendering is the process of generating an image using a computer. Computer graphics is the field of study that encompasses rendering techniques, and forms the foundation of data visualization.

        Three-dimensional rendering techniques simulate the interaction of lights and cameras with objects, or actors, to generate images. A scene consists of a combination of lights, cameras, and actors. Object-order rendering techniques generate images by rendering actors in a scene in order. Image-order techniques render the image one pixel at a time. Polygonbased graphics hardware is based on object-order techniques. Ray tracing or ray-casting is an image-order technique.

        Lighting models require a specification of color. We saw both the RGB (red-green-blue) and HSV (hue-saturation-value) color models. The HSV model is a more natural model than the RGB model for most users. Lighting models also include effects due to ambient, diffuse, and specular lighting.

        There are four important coordinate systems in computer graphics. The model system is the 3D coordinate system where our geometry is defined. The world system is the global Cartesian system. All modeled data is eventually transformed into the world system. The view coordinate system represents what is visible to the camera. It is a 2D system scaled from (-1,1). The display coordinate system uses actual pixel locations on the computer display.

        Homogeneous coordinates are a 4D coordinate system in which we can include the effects of perspective transformation. Transformation matrices are 4x4 matrices that operate on homogeneous coordinates. Transformation matrices can represent the effects of translation, scaling, and rotation of an actor. These matrices can be multiplied together to give combined transformations.

        Graphics programming is usually implemented using higher-level graphics libraries and specialized hardware systems. These dedicated systems offer better performance and easier implemen-tation of graphics applications. Common techniques implemented in these systems include dithering and z-buffering. Dithering is a technique to simulate colors by mixing combinations of available colors . Z-buffering is a technique to perform hidden-line and hidden-surface removal.

        The Visualization Toolkit uses a graphics model based on lights, cameras, actors, and render-ers. The renderers draw into rendering windows. Actor properties are represented by a property object and their geometry by a mapper object. Taken together, the instantiations of these various classes form a scene. Interaction with the objects in a scene is facilitated by the vtkRenderWindowInteractor and vtkInteractorStyle classes. These use the command/observer design pattern that triggers and responds to events. Users can observe particular events and write callbacks that can perform arbitrary tasks, easily extending the toolkit for a particular application.

        "},{"location":"VTKBook/03Chapter3/#312-bibliographic-notes","title":"3.12 Bibliographic Notes","text":"

        This chapter provides the reader with enough information to understand the basic issues and terms used in computer graphics. There are a number of good text books that cover computer graphics in more detail and are recommended to readers who would like a more thorough understanding. The bible of computer graphics is [FoleyVanDam90]. For those wishing for less intimidating books [BurgerGillies89] and [Watt93] are also useful references. You also may wish to peruse proceedings of the ACM SIGGRAPH conferences. These include papers and references to other papers for some of the most important work in computer graphics. [Carlson85] provides a good introduction for those who wish to learn more about the human vision system.

        "},{"location":"VTKBook/03Chapter3/#313-references","title":"3.13 References","text":"

        [Bresenham65] J. E. Bresenham.\"Algorithm for Computer Control of a Digital Plotter.\" IBM Systems Journal, 4(1): 25--30, January 1965.

        [BurgerGillies89] P. Burger and D. Gillies. Interactive Compute Graphics Functional, Procedural and Device-Level Methods. Addison-Wesley, Reading, MA, 1989.

        [Carlson85] N. R. Carlson. Physiology of Behaviour (3d Edition). Allyn and Bacon Inc., Newton, MA, 1985.

        [Dartnall83] H. J. A. Dartnall, J. K. Bowmaker, and J. D. Mollon. \"Human Visual Pigments: Microspectropho-tometric Results from the Eyes of Seven Persons.\" Proceedings of the Royal Society, London, 1983.

        [FoleyVanDam90] J. D. Foley, A. van Dam, S. K. Feiner, and J. F. Hughes. Computer Graphics Principles and Practice (2d Edition). Addison-Wesley, Reading, MA, 1990.

        [Fuchs80] H. Fuchs, Z. M. Kedem, and B. F. Naylor. \"On Visible Surface Generation By A Priori Tree Structure.\" Computer Graphics (SIGGRAPH '80), 14(3):124--133, 1980.

        [Gamma95] E. Gamma, R. Helm, R. Johnson, J. Vlissides. Design Patterns Elements of Reusable Object-Oriented Software. Addison-Wesley 1995. ISBN0-201-63361-2.

        [Ousterhout94] J. K.Ousterhout. Tcl and the Tk Toolkit. Addison-Wesley Publishing Company, Reading, MA, 1994.

        [Watt93] A. Watt. 3D Computer Graphics (2d Edition). Addison-Wesley, Reading, MA, 1993.

        [Whitted80] T. Whitted. \"An Improved Illumination Model for Shaded Display.\" Communications of the ACM, 23(6):343-349, 1980.

        "},{"location":"VTKBook/03Chapter3/#314-exercises","title":"3.14 Exercises","text":"

        3.1 Estimate the odds of a ray of light being emitted from the sun, traveling to earth and hitting a one meter square picnic blanket. You can assume that the sun is a point light source that emits light uniformly in all directions. The approximate distance from the sun to the earth is 150,000,000 km.

        a) What are the odds when the sun is directly overhead?

        b) What are the odds when the sun is inclined 45 degrees relative to the surface normal of the picnic blanket?

        c) What assumptions or approximations did you make?

        3.2 Proceeding from your result of Exercise 3.1, what are the difficulties in determining the odds of a ray of light traveling from the sun to hit the picnic blanket and then entering a viewer's eye?

        3.3 The color cyan can be represented in both the HSV and RGB color spaces as shown in Figure 3-4. These two representations for cyan do not yield the same wavelength intensity plots. How do they differ?

        3.4 The vtkSphereSource class generates a polygonal model of a sphere. Using the examples at the end of this chapter as starting points, create a program to display a white sphere. Set the ambient and diffuse intensities to 0.5. Then add a for-loop to this program that adjusts the ambient and diffuse color of this sphere so that as the loop progresses, the diffuse color goes from red to blue, and the ambient color goes from blue to green. You might also try adjusting other lighting parameters such as specular color, ambient, diffuse, and specular intensity.

        3.5 Using the vtkSphereSource as described in Exercise 3.4, create a program to display the sphere with a light source positioned at (1,1,1). Then extend this program by adding a forloop that will adjust the active camera's clipping range so that increasing portions of the interior of the sphere can be seen. By increasing the first value of the clipping range, you will be adjusting the position of the front clipping plane. Once the front clipping plane starts intersecting the sphere, you should be able to see inside of it. The default radius of the vtkSphereSource is 0.5, so make sure that you adjust the clipping range in increments less than 1.0.

        3.6 Modify the program presented in \"Render a Cone\" so that the user can enter in a world coordinate in homogenous coordinates and the program will print out the resulting display coordinate. Refer to the reference page for vtkRenderer for some useful methods.

        a) Are there any world coordinates that you would expect to be undefined in display coordinates?

        b) What happens when the world coordinates are behind the camera?

        3.7 Consider rasterizing a ten by ten pixel square. Contrast the approximate difference in the number of arithmetic operations that would need to be done for the cases where it is flat, Gouraud, or Phong shaded.

        3.8 When using a z-buffer, we must also interpolate the z-values (or depth) when rasterizing a primitive. Working from Exercise 3.7, what is the additional burden of computing z-buffer values while rasterizing our square?

        3.9 vtkTransform has a method GetOrientation() that looks at the resulting transformation matrix built from a series of rotations and provides the single x, y, and z rotations that will reproduce the matrix. Specify a series of rotations in a variety of orders and request the orientation with GetOrientation(). Then apply the rotations in the same order that vtkActor does and verify that the resulting 4 x 4 transformation matrix is the same.

        3.10 vtkTransform, by default, applies new transformations at the right of the current transformation. The method PostMultiply() changes the behavior so that the transformations are applied to the left.

        a) Use vtkTransform to create a transform using a variety of transformation operators including Scale(), RotateXYZ(), and Translate(). Then create the same matrix with PostMultiplyOn().

        b) Applying rotations at the right of a series of transformations in effect rotates the object about its own coordinate system. Use the rotations.tcl script to verify this. Can you explain this?

        c) Applying rotations at the left of a series of transformations in effect rotates the object about the world coordinate system. Modify the rotations.tcl script to illustrate this. (Hint: you will have to create an explicit transform with vtkTransform and set the actor's transform with SetUserMatrix().)

        LocalWords: sp postmultiply premultiply Similaryly TT userdefined RotateXYZ LocalWords: theatre

        "},{"location":"VTKBook/04Chapter4/","title":"Chapter 4 - The Visualization Pipeline","text":"

        In the previous chapter we created graphical images using simple mathematical models for lighting, viewing, and geometry. The lighting model included ambient, diffuse, and specular effects. Viewing included the effects of perspective and projection. Geometry was defined as a static collection of graphics primitives such as points and polygons. In order to describe the process of visualization we need to extend our understanding of geometry to include more complex forms. We will see that the visualization process transforms data into graphics primitives. This chapter examines the process of data transformation and develops a model of data flow for visualization systems.

        "},{"location":"VTKBook/04Chapter4/#41-overview","title":"4.1 Overview","text":"

        Visualization transforms data into images that efficiently and accurately convey information about the data. Thus, visualization addresses the issues of transformation and representation.

        Transformation is the process of converting data from its original form into graphics primitives, and eventually into computer images. This is our working definition of the visualization process. An example of such a transformation is the process of extracting stock prices and creating an x-y plot depicting stock price as a function of time.

        Representation includes both the internal data structures used to depict the data and the graphics primitives used to display the data. For example, an array of stock prices and an array of times are the computational representation of the data, while the x-y plot is the graphical representation. Visualization transforms a computational form into a graphical form.

        From an object-oriented viewpoint, transformations are processes in the functional model, while representations are the objects in the object model. Therefore, we characterize the visualization model with both functional models and object models.

        "},{"location":"VTKBook/04Chapter4/#a-data-visualization-example","title":"A Data Visualization Example","text":"

        A simple mathematical function for a quadric will clarify these concepts. The function

        \\begin{equation*} F(x,y,z) = a_0 x^2 + a_1 y^2 + a_2 z^2 + a_3 x y + a_4 y z + a_5 x z + a_6 x + a_7 y + a_8 z + a_9 \\end{equation*} \\bf\\tag{4-1}

        is the mathematical representation of a quadric. Figure 4-1a shows a visualization of Equation 4-1 in the region -1 \\leq x, y, z \\leq 1. The visualization process is as follows. We sample the data on a regular grid at a resolution of 50 \\times 50 \\times 50. Three different visualization techniques are then used. On the left, we generate 3D surfaces corresponding to the function F(x, y, z) = c where c is an arbitrary constant (i.e., the isosurface value). In the center, we show three different planes that cut through the data and are colored by function value. On the right we show the same three planes that have been contoured with constant valued lines. Around each we place a wireframe outline."},{"location":"VTKBook/04Chapter4/#the-functional-model","title":"The Functional Model","text":"

        The functional model in Figure 4-1b illustrates the steps to create the visualization. The oval blocks indicate operations (processes) we performed on the data, and the rectangular blocks represent data stores (objects) that represent and provide access to data. Arrows indicate the direction of data movement. Arrows that point into a block are inputs; data flowing out of a block indicate outputs. The blocks also may have local parameters that serve as additional input. Processes that create data with no input are called data source objects, or simply sources. Processes that consume data with no output are called sinks (the are also called mappers because these processes map data to a final image or output). Processes with both an input and an output are called filters. The functional model shows how data flows through the system. It also describes the dependency of the various parts upon one another. For any given process to execute correctly, all the inputs must be up to date. This suggests that functional models require a synchronization mechanism to insure that the correct output will be generated.

        The functional model shows how data flows through the system. It also describes the dependency of the various parts upon one another. For any given process to execute correctly, all the inputs must be up to date. This suggests that functional models require a synchronization mechanism to insure that the correct output will be generated.

        "},{"location":"VTKBook/04Chapter4/#the-visualization-model","title":"The Visualization Model","text":"

        In the examples that follow we will frequently use a simplified representation of the functional model to describe visualization processes ( Figure 4-1c). We will not explicitly distinguish between sources, sinks, data stores, and process objects. Sources and sinks are implied based on the number of inputs or outputs. Sources will be process objects with no input. Sinks will be process objects with no output. Filters will be process objects with at least one input and one output. Intermediate data stores will not be represented. Instead we will assume that they exist as necessary to support the data flow. Thus, as Figure 4-1c shows, the Lines data store that the Outline object generates ( Figure 4-1b are combined into the single object Outline. We use oval shapes to represent objects in the visualization model. (b) Functional model Sample F(x,y,z) See QuadricVisualization.cxx and QuadricVisualization.py. (b) Functional model (c) Visualization network Figure 4-1. Visualizing a quadric function F(x,y,z) = c.."},{"location":"VTKBook/04Chapter4/#the-object-model","title":"The Object Model","text":"

        The functional model describes the flow of data in our visualization, the object model describes which modules operate on it. But what are the objects in the system? At first glance, we have two choices (Figure 4-2). Figure 4-2. Object model design choices. One basic choice is to combine processes and data stores into a single object. This is the usual object-oriented choice. Another choice creates separate data objects and process objects.

        The first choice combines data stores (object attributes) with processes (object methods) into a single object. In the second choice we use separate objects for data stores and processes. There is actually a third alternative: a hybrid combination of these two choices.

        The conventional object-oriented approach (our first choice above) combines data stores and processes into a single object. This view follows the standard definition that objects contain a data representation combined with procedures to operate on the data. One advantage of this approach is that the processes, which are the data visualization algorithms, have complete access to the data structures, resulting in good computational performance. But this choice suffers from several drawbacks.

        • From a user's perspective, processes are often viewed as independent of data representation. In other words, processes are naturally viewed as objects in the system. For example, we often say we want to \"contour\" data, meaning creating lines or surfaces corresponding to a constant data value. To the user it is convenient to have a single contour object to operate on different data representations.

        • We must duplicate algorithm implementation. As in the previous contouring example, if we bind data stores and processes into a single object, the contour operation must be recreated for each data type. This results in duplicating code even though the implementations of an algorithm may be functionally and structurally similar. Modifying such algorithms also means modifying a large amount of code, since they are implemented across many objects.

        • Binding data stores and algorithms together results in complex, data dependent code. Some algorithms may be much more complex than the data they operate on, with large numbers of instance variables and elaborate data structures. By combining many such algorithms with a data store, the complexity of the object greatly increases, and the simple meaning of the object becomes lost.

        The second choice separates the data stores and processes. That is, one set of objects represents and provides access to the data, while another set of objects implements all operations on the data. Our experience shows that this is natural to users, although it may be considered unconventional to the object-oriented purist. We also have found that the resulting code is simple, modular, and easy for developers to understand, maintain, and extend.

        One disadvantage to the second choice is that the interface between data representation and process is more formal. Thus the interface must be carefully designed to insure good performance and flexibility. Another disadvantage is that strong separation of data and process results in duplicate code. That is, we may implement operations that duplicate algorithms and that cannot be considered strictly data access methods. One example of such a situation is computing data derivatives. This operation is more than simple data access, so strictly speaking it doesn't belong in the data object methods. So to compute derivatives we would have to duplicate the code each time we needed derivatives computed. (Or create a procedural library of functions or macros!)

        As a result of these concerns we use the hybrid approach in the Visualization Toolkit. Our approach is closest to the second choice described above, but we have selected a small set of critical operations that we implement within the data objects. These operations have been identified based on our experience implementing visualization algorithms. This effectively combines the first two choices to receive the maximum benefit and fewest disadvantages of each.

        "},{"location":"VTKBook/04Chapter4/#42-the-visualization-pipeline","title":"4.2 The Visualization Pipeline","text":"

        In the context of data visualization, the functional model of Figure 4-1c is referred to as the visualization pipeline or visualization network. The pipeline consists of objects to represent data (data objects), objects to operate on data (process objects), and an indicated direction of data flow (arrow connections between objects). In the text that follows, we will frequently use visualization networks to describe the implementation of a particular visualization technique."},{"location":"VTKBook/04Chapter4/#data-objects","title":"Data Objects","text":"

        Data objects represent information. Data objects also provide methods to create, access, and delete this information. Direct modification of the data represented by the data objects is not allowed except through formal object methods. This capability is reserved for process objects. Additional methods are also available to obtain characteristic features of the data. This includes determining the minimum and maximum data values, or determining the size or the number of data values in the object.

        Data objects differ depending upon their internal representation. The internal representation has significant impact on the access methods to the data, as well as on the storage efficiency or computational performance of process objects that interact with the data object. Hence, different data objects may be used to represent the same data depending on demands for efficiency and process generality.

        "},{"location":"VTKBook/04Chapter4/#process-objects","title":"Process Objects","text":"

        Process objects operate on input data to generate output data. A process object either derives new data from its inputs, or transforms the input data into a new form. For example, a process object might derive pressure gradient data from a pressure field or transform the pressure field into constant value pressure contours. The input to a process object includes both one or more data objects as well as local parameters to control its operation. Local parameters include both instance variables or associations and references to other objects. For example, the center and radius are local parameters to control the generation of sphere primitives.

        Process objects are further characterized as source objects, filter objects, or mapper objects. This categorization is based on whether the objects initiate, maintain, or terminate visualization data flow.

        Source objects interface to external data sources or generate data from local parameters. Source objects that generate data from local parameters are called procedural objects. The previous example of Figure 4-1 uses a procedural object to generate function values for the quadric function of Equation4-1. Source objects that interface to external data are called reader objects since the external file must be read and converted to an internal form. Source objects may also interface to external data communication ports and devices. Possible examples include simulation or modelling programs, or data acquisition systems to measure temperature, pressure, or other similar physical attributes.

        Filter objects require one or more input data objects and generate one or more output data objects. Local parameters control the operation of the process object. Computing weekly stock market averages, representing a data value as a scaled icon, or performing union set operations on two input data sources are typical example processes of filter objects.

        Mapper objects correspond to the sinks in the functional model. Mapper objects require one or more input data objects and terminate the visualization pipeline data flow. Usually mapper objects are used to convert data into graphical primitives, but they may write out data to a file or interface with another software system or devices. Mapper objects that write data to a computer file are termed writer objects.

        "},{"location":"VTKBook/04Chapter4/#43-pipeline-topology","title":"4.3 Pipeline Topology","text":"

        In this section we describe how to connect data and process objects to form visualization networks.

        "},{"location":"VTKBook/04Chapter4/#pipeline-connections","title":"Pipeline Connections","text":"

        The elements of the pipeline (sources, filters, and mappers) can be connected in a variety of ways to create visualization networks. However, there are two important issues that arise when we try to assemble these networks: type and multiplicity.

        Type means the form or type of data that process objects take as input or generate as output. For example, a sphere source object may generate as output a polygonal or faceted representation, an implicit representation (e.g., parameters of a conic equation), or a set of occupancy values in a discretized representation of 3D space. Mapper objects might take as input polygonal, triangle strip, line, or point geometric representations. The input to a process object must be specified correctly for successful operation.

        Figure 4-3. Maintaining compatible data type. (a) Single-type systems require no type checking. In multiple-type systems only compatible types can be connected together.

        There are two general approaches to maintain proper input type. One approach is to design with type-less or single-type systems. That is, create a single type of data object and create filters that operate only on this one type ( Figure 4-3). For example, we could design a general DataSet that represents any form of data that we're interested in, and the process objects would only input DataSets and generate DataSets. This approach is simple and elegant, but inflexible. Often, particularly useful algorithms (i.e., process objects) will operate only on specific types of data and generalizing them results in large inefficiencies in representation or data access. A typical example is a data object that represents structured data such as pixmaps or 3D volumes. Because the data is structured it can easily be accessed as planes or lines. However, a general representation will not include this capability since typically data is not structured.

        Another approach to maintain proper input type is to design typed systems. In typed systems only objects of compatible type are allowed to be connected together. That is, more than one type is designed, but type checking is performed on the input to insure proper connection. Depending on the particular computer language, type checking can be performed at compile, link, or run time. Although type checking does insure correct input type, this approach often suffers from an explosion of types. If not careful, the designers of a visualization system may create too many types, resulting in a fragmented, hard to use and understand system. In addition, the system may require a large number of type-converter filters. (Type-converter filters serve only to transform data from one form to another.) Carried to extremes, excessive type conversion results in computationally and memory wasteful systems.

        The issue of multiplicity deals with the number of input data objects allowed, and the number of output data objects created during the operation of a process object (Figure 4-4). We know that all filter and mapper objects require at minimum one input data object, but in general these filters can operate sequentially across a list of input. Some filters may naturally require a specific number of inputs. A filter implementing boolean operations is one example. Boolean operations such as union or intersection are implemented on data values two at a time. However, even here more than two inputs may be defined as a recursive application of the operation to each input. Figure 4-4. Multiplicity of input and output. (a) Definition of source, filter, and mapper objects. (b) Various types of input and output..

        We need to distinguish what is meant by multiplicity of output. Most sources and filters generate a single output. Multiple fan-out occurs when an object generates an output that is used for input by more than one object. This would occur, for example, when a source object is used to read a data file, and the resulting data is used to generate a wireframe outline of the data, plus contours of the data (e.g., Figure 4-1a). Multiple output occurs when an object generates two or more output data objects. An example of multiple output is generating x, y, and z components of a gradient function as distinct data objects. Combinations of multiple fan-out and multiple output are possible."},{"location":"VTKBook/04Chapter4/#loops","title":"Loops","text":"

        In the examples described so far, the visualization networks have been free of cycles. In graph theory these are termed directed, acyclic graphs. However, in some cases it is desirable to introduce feedback loops into our visualization networks. Feedback loops in a visualization network allow us to direct the output of a process object upstream to affect its input.

        Figure 4-5 shows an example of a feedback loop in a visualization network. We seed a velocity field with an initial set of random points. A probe filter is used to determine the velocity (and possibly other data) at each point. Each point is then repositioned in the direction of its associated vector value, possibly using a scale factor to control the magnitude of motion. The process continues until the points exit the data set or until a maximum iteration count is exceeded. Figure 4-5. Looping in a visualization network. This example implements linear integration. The sample points are created to initialize the looping process. The output of the integration filter is used in place of the sample points once the process begins.

        We will discuss the control and execution of visualization networks in the next section. However, suffice it to say that loops can pose special problem in visualization networks depending on the design of the execution model. The design must insure that the loop does not enter an infinite loop or nonterminating recursive state. Typically, the number of executions of the loop is limited in order to view intermediate results. However, it is possible to execute the loop repeatedly to process data as required.

        "},{"location":"VTKBook/04Chapter4/#44-executing-the-pipeline","title":"4.4 Executing the Pipeline","text":"

        So far we have seen the basic elements of the visualization network and ways to connect these elements together. In this section we discuss how to control the execution of the network.

        To be useful, a visualization network must process data to generate a desired result. The complete process of causing each process object to operate is called the execution of the network.

        Most often the visualization network is executed more than once. For example, we may change the parameters of, or the input to, a process object. This is typically due to user interaction: The user may be exploring or methodically varying input to observe results. After one or more changes to the process object or its input, we must execute the network to generate up-to-date results.

        For highest performance, the process objects in the visualization network must execute only if a change occurs to their input. In some networks, as shown in Figure 4-6, we may have parallel branches that need not execute if objects are modified local to a particular branch. In this figure, we see that object D and the downstream objects E and F must execute because D's input parameter is changed, and objects E and F depend on D for their input. The other objects need not execute because there is no change to their input.

        We can control the execution of the network using either a demand-driven or event-driven approach. In the demand-driven approach, we execute the network only when output is requested, and only that portion of the network affecting the result. In the event-driven approach, every change to a process object or its input causes the network to re-execute. The advantage of the event driven approach is that the output is always up to date (except during short periods of computation). The advantage of the demand-driven approach is that large numbers of changes can be processed without intermediate computation (i.e., data is processed only after the request for data is received). The demand-driven approach minimizes computation and results in more interactive visualization networks.

        Figure 4-6. Network execution. Parallel branches need not execute.

        The execution of the network requires synchronization between process objects. We want to execute a process object only when all of its input objects are up to date. There are generally two ways to synchronize network execution: explicit or implicit control (Figure 4-7)."},{"location":"VTKBook/04Chapter4/#explicit-execution","title":"Explicit Execution","text":"

        Explicit control means directly tracking the changes to the network, and then directly controlling the execution of the process objects based on an explicit dependency analysis. The major characteristic of this approach is that a centralized executive is used to coordinate network execution. This executive must track changes to the parameters and inputs of each object, including subsequent changes to the network topology (Figure 4-7a).

        The advantage of this approach is that synchronization analysis and update methods are local to the single executive object. In addition, we can create dependency graphs and perform analysis of data flow each time output is requested. This capability is particularly important if we wish to decompose the network for parallel computing or to distribute execution across a network of computers.

        The disadvantage of the explicit approach is that each process object becomes dependent upon the executive, since the executive must be notified of any change. Also, the executive cannot easily control execution if the network execution is conditional, since whether to execute or not depends on the local results of one or more process objects. Finally, a centralized executive can create non-scalable bottlenecks in parallel computing environments.

        The explicit approach may be either demand-driven or event-driven. In the event-driven approach, the executive is notified whenever a change to an object occurs (typically in response to a user-interface event), and the network is immediately executed. In the demand-driven approach, the executive accumulates changes to object inputs and executes the network based on explicit user demand.

        Figure 4-7. Explicit and implicit network execution.

        The explicit approach with a central executive is typical of many commercial visualization systems such as AVS, Irix Explorer, and IBM Data Explorer. Typically these systems use a visual-programming interface to construct the visualization network. Often these systems are implemented on parallel computers, and the ability to distribute computation is essential.

        "},{"location":"VTKBook/04Chapter4/#implicit-execution","title":"Implicit Execution","text":"

        Implicit control means that a process object executes only if its local input or parameters change (Figure 4-7). Implicit control is implemented using a two-pass process. First, when output is requested from a particular object, that object requests input from its input objects. This process is recursively repeated until source objects are encountered. The source objects then execute if they have changed or their external inputs have changed. Then the recursion unwinds as each process object examines its inputs and determines whether to execute. This procedure repeats until the initial requesting object executes and terminates the process. These two steps are called the update and execution passes.

        Implicit network execution is naturally implemented using demand-driven control. Here network execution occurs only when output data is requested. Implicit network execution may also be event-driven if we simply request output each time an appropriate event is encountered (such as change to object parameter).

        Figure 4-8. Examples of conditional execution. Depending upon range, data is mapped through different color lookup tables.

        The primary advantage of the implicit control scheme is its simplicity. Each object only need keep track of its internal modification time. When output is requested, the object compares its modification time with that of its inputs, and executes if out of date. Furthermore, process objects need only know about their direct input, so no global knowledge of other objects (such as a network executive) is required.

        The disadvantage of implicit control is that it is harder to distribute network execution across computers or to implement sophisticated execution strategies. One simple approach is to create a queue that executes process objects in order of network execution (possibly in a distributed fashion). Of course, once a central object is introduced back into the system, the lines between implicit and explicit control are blurred.

        "},{"location":"VTKBook/04Chapter4/#conditional-execution","title":"Conditional Execution","text":"

        Another important capability of visualization networks is conditional execution. For example, we may wish to map data through different color lookup tables depending upon the variation of range in the data. Small variations can be amplified by assigning more colors within the data range, while we may compress our color display by assigning a small number of colors to the data range (Figure 4-8 ).

        The conditional execution of visualization models (such as that shown Figure 4-1c) can be realized in principle. However, in practice we must supplement the visualization network with a conditional language to express the rules for network execution. Hence, conditional execution of visualization networks is a function of implementation language. Many visualization systems are programmed using the visual programming style. This approach is basically a visual editor to construct data flow diagrams directly. It is difficult to express conditional execution of networks using this approach. Alternatively, in a procedural programming language, conditional execution of networks is straightforward. We defer discussions of the topic until \"Putting It All Together\"."},{"location":"VTKBook/04Chapter4/#45-memory-and-computation-trade-off","title":"4.5 Memory and Computation Trade-off","text":"

        Visualization is a demanding application, both in terms of computer memory and computational requirements. Data streams on the order of one megabyte to one gigabyte are not uncommon. Many visualization algorithms are computationally expensive, in part due to input size, but also due to the inherent algorithm complexity. In order to create applications that have reasonable performance, most visualization systems have various mechanisms to trade off memory and computation costs.

        Figure 4-9. Comparison of static versus dynamic memory models for typical network. Execution begins when output is requested from objects *C* and *D*. In more complex dynamic models, we can prevent *B* from executing twice by performing a more thorough dependency analysis image."},{"location":"VTKBook/04Chapter4/#static-and-dynamic-memory-models","title":"Static and Dynamic Memory Models","text":"

        Memory and computation trade-offs are important performance issues when executing visualization networks. In the networks presented thus far, the output of a process object is assumed to be available to downstream process objects at all times. Thus, network computation is minimized. However, the computer memory requirement to preserve filter output can be huge. Networks of only a few objects can tie up extensive computer memory resources.

        An alternative approach is to save intermediate results only as long as they are needed by other objects. Once these objects finish processing, the intermediate result can be discarded. This approach results in extra computation each time output is requested. The memory resources required are greatly reduced at the expense of increased computation. Like all trade-offs, the proper solution depends upon the particular application and the nature of the computer system executing the visualization network.

        We term these two approaches as static and dynamic memory models. In the static model intermediate data is saved to reduce overall computation. In the dynamic model intermediate data is discarded when it is no longer needed. The static model serves best when small, variable portions of the network re-execute, and when the data sizes are manageable by the computer system. The dynamic model serves best when the data flows are large, or the same part of the network executes each time. Often, it is desirable to combine both the static and dynamic models into the same network. If an entire leg of the network must execute each time, it makes no sense to store intermediate results, since they are never reused. On the other hand, we may wish to save an intermediate result at a branch point in the network, since the data will more likely be reused. A comparison of the static and dynamic memory model for a specific network is shown in Figure 4-9. Figure 4-10. Reference counting to conserve memory resource. Each filter A, B, and C shares a common point representation. Other data is local to each object.

        As this figure shows, the static model executes each process object only once, storing intermediate results. In the dynamic model, each process object releases memory after downstream objects complete execution. Depending upon the implementation of the dynamic model, process object B may execute once or twice. If a thorough dependency analysis is performed, process B will release memory only after both objects C and D execute. In a simpler implementation, object B will release memory after C and subsequently, D executes.

        "},{"location":"VTKBook/04Chapter4/#reference-counting-garbage-collection","title":"Reference Counting & Garbage Collection","text":"

        Another valuable tool to minimize memory cost is to share storage using reference counting. To use reference counting, we allow more than one process object to refer to the same data object and keep track of the number of references. For example, assume that we have three objects A, B, and C that form a portion of a visualization network as shown in Figure 4-10. Also assume that these objects modify only part of their input data, leaving the data object that specifies x-y-z coordinate position unchanged. Then to conserve memory resources we can allow the output of each process object to refer to the single data object representing these points. Data that is changed remains local to each filter and is not shared. It is only when the reference count goes to zero that the object is deleted.

        Garbage collection is an alternative memory management strategy that is not well suited to visualization applications. The garbage collection process is automatic; it attempts to reclaim memory used by objects that will never again be accessed by the running application. While convenient due to its automated nature, in general garbage collection introduces overhead that may inadvertently introduce pauses into software execution at inopportune times (during an interactive process). Of more concern, however, is that released, unused memory may not be reclaimed by the system until some time after the last reference to the memory is dropped, and in visualization pipelines this memory may be too large to leave around for any length of time. That is, in some applications if memory usage in a filter is not released immediately, downstream filters may not have enough memory resource available to them to successfully execute.

        "},{"location":"VTKBook/04Chapter4/#46-advanced-visualization-pipeline-models","title":"4.6 Advanced Visualization Pipeline Models","text":"

        The preceding sections have provided a general framework for the implementation of a useful visualization pipeline model. However, there are several advanced capabilities that complex applications often require. These capabilities are driven by deficiencies in the simpler design described previously. The principle drivers for developing advanced models include: processing unknown dataset types, managing complex execution strategies including processing pieces of data, and extending the visualization pipeline to propagate new information. These concerns are discussed in the following three sections.

        "},{"location":"VTKBook/04Chapter4/#processing-unknown-dataset-types","title":"Processing Unknown Dataset Types","text":"

        There exist data files and data sources where the type of dataset represented by the file or source is unknown until run-time. For example, consider a general purpose VTK reader that can read any type of VTK data file. Such a class is convenient because the user need not concern himself with the type of dataset, instead the user may want to set up a single pipeline that processes whatever type is found. As indicated by Figure 4-3, such an approach works well if the system is of a single dataset type, however in practice, and due to performance/efficiency concerns, there typically exist many different types of data in a visualization system. The other alternative shown in Figure 4-3 is enforced type checking. However, in situations like the reader example described above, it is not possible to enforce type checking at compile-time because the type is determined by the data. As a result, type checking must be performed at run-time.

        Run-time type checking of a multiple dataset type visualization system requires that the data passed between filters is a generic dataset container (i.e., it appears like a single type but contains the actual data and methods to determine what type of data it is). Run-time type checking has the advantage of flexibility, but the trade-off is that a pipeline may not execute properly until the program executes. For example, a generic pipeline may be designed that can process structured data (see \"Types of Datasets\" in Chapter 5), but the data file may contain unstructured data. In this case, the pipeline will be unable to execute at run-time, producing empty output. Thus pipelines designed to process any type of data must be carefully assembled to create robust applications.

        "},{"location":"VTKBook/04Chapter4/#extending-the-data-object-representation","title":"Extending the Data Object Representation","text":"

        As described earlier in this chapter, a pipeline consists of data objects that are operated on by process objects. Further, because the process objects are separate from the data objects on which they operate, there is necessarily an expected interface through which these objects exchange information. Defining this interface has the side effect of cementing the data representation, implying that it is difficult to extend it without modifying the corresponding interface, and hence all the classes that depend on the interface (of which there are many). Fortunately what tends to change is not the basic data representations (these are generally well established), rather the metadata associated with the dataset itself changes. (In the context of visualization, metadata are data that describe datasets.) While it is feasible to represent new datasets by creating new classes (since the addition of new dataset types occurs infrequently); the diversity of metadata precludes creating new classes because the resulting explosion of data types, and the potential change to programming interfaces, would adversely affect the stability of the visualization system. Hence a general mechanism to support metadata is required. Packaging metadata into a generic container that contains both the dataset and metadata is a obvious design, and is compatible with the design described in the previous section.

        Examples of metadata include time step information, data ranges or other data characteristics, acquisition protocols, patient names, and annotation. In an extensible visualization pipeline, a specific data reader (or other data source) may read such information and associate it with the output data that it produces. While many filters may ignore the metadata, they can be configured to pass the information along the pipeline. Alternatively, a pipeline sink (or mapper) may request that specific metadata be passed through the pipeline so it can be processed appropriately. For example, a mapper may request annotations, and if available, place them on the final image.

        "},{"location":"VTKBook/04Chapter4/#managing-complex-execution-strategies","title":"Managing Complex Execution Strategies","text":"

        In real-world applications the pipeline design described thus far may not adequately support complex execution strategies, or may fail to execute successfully when data sizes become large. In the next sections we address these issues by considering alternative design possibilities.

        Large Data. Previous discussions relative to the visualization pipeline have assumed that the size of a particular dataset does not exceed the total memory resource of a computer system. However, with modern dataset sizes pushing into the terabyte and even petabyte range, a typical desktop computer system is incapable of processing such datasets. Thus alternative strategies must be adopted when processing large data. One such approach is based on breaking data into pieces, and then streaming the pieces through the visualization pipeline [Martin2001]. Figure 4-11 illustrates how a dataset can be divided into pieces. Figure 4-11. Dividing a sphere into a piece (red) with ghost level cells and points (blue and green).

        Streaming data through a visualization pipeline offers two major benefits. The first is that visualization data that would not normally fit into memory can be processed. The second is that visualizations can be run with a smaller memory footprint resulting in higher cache hits, and little or no swapping to disk. To realize these benefits the visualization software must support breaking the dataset into pieces and correctly processing those pieces. This requires that the dataset and the algorithms that operate on it are separable, mappable, and result invariant as described in the following [Law99].

        1. Separable. The data must be separable. That is, the data can be broken into pieces. Ideally, each piece should be coherent in geometry, topology, and/or data structure. The separation of the data should be simple and efficient. In addition, the algorithms in this architecture must be able to correctly process pieces of data.

        2. Mappable. In order to control the streaming of the data through a pipeline, we must be able to determine what portion of the input data is required to generate a given portion of the output. This allows us to control the size of the data through the pipeline, and configure the algorithms.

        3. Result Invariant. The results should be independent of the number of pieces, and independent of the execution mode (i.e., single- or multi-threaded). This means proper handling of boundaries and developing algorithms that are multi-thread safe across pieces that may overlap on their boundaries.

        Separating data into pieces is relatively straightforward if the data is structured, i.e., topologically regular ((see \"Types of Datasets\" in Chapter 5). Such datasets can be topological described by a rectangular extent in a regularly x-y-z subdivided cubical domain (see Figure5-7(a)-(c)). However, if the data is unstructured (e.g. a mesh of triangles or polygons), then specifying pieces is difficult. Generally an unstructured extent is defined by grouping adjacent data (e.g., cells) into pieces, and then addressing each piece using a N of M notation, where N is the n ^th^ piece out of a total of M pieces. The exact organizational structure of a piece is left unspecified and depends on the particular application and algorithm used to group the data.

        To satisfy the third requirement of results invariance, processing pieces also requires the ability to generate boundary data, or ghost levels. Boundary information is necessary when information from the neighbors of a piece is needed to perform a computation. For example, gradient calculations or boundary analysis (e.g., do I have a cell face neighbor?) require one level of boundary information. In rare cases, two or more levels are required. Figure 4-11 illustrates boundary cells and points corresponding to the central red piece of the sphere.

        Finally, it should be noted that the ability to divide data into pieces for streaming is exactly the same capability required for data parallel processing. In such methods, data is subdivided and sent to different processors to be operated on in parallel. Boundary information may also be required to perform certain computations. Parallel processing has the added complexity that the data must be communicated to processors (in the case of distributed computing) or mutual exclusion (i.e., mutexing) must be employed to avoid simultaneous write operations. Thus streaming and parallel processing are complementary technologies used in large data computing.

        Complex Execution Strategies. In many cases the simple execution model of Figure 4-7 is not suitable for complex data processing tasks. For example, as discussed in the previous section, streaming data is a complex execution strategy required when a dataset becomes too large to fit into memory, or when parallel computing is used. In some cases event-driven (see \"Executing the Pipeline\") or \"push\" pipelines (i.e., those that receive data and push the data through the pipeline for processing) may be preferred. Finally, there exist hierarchical data structures such as multi-block or adaptive mesh refinement (AMR) [Berger84] grids. Processing such datasets in a pipeline requires hierarchical traversal as filters process each block in the grid (an advanced research topic in the visualization field and not covered in this edition of the book).

        Addressing these requirements implies that the execution model must be extended. Thus we revisit the object-oriented design in the next section.

        Object-Oriented Design Revisited. Figure 4-2 illustrates two choices relative to the design of the visualization object model. The first choice, which was discarded, was to combine data and operations on the data into a single object, a typical object-oriented design pattern. The second choice, which was advocated, was to create a design consisting of two classes---data objects and process objects---which were then combined into visualization pipelines. While this second strategy works well for simple pipelines, when complex execution strategies are introduced, this design begins to break down. This is because the execution strategy is necessarily, and implicitly, distributed across the data objects and process objects; there is no explicit mechanism to implement a particular strategy. Thus the design is problematic because new strategies cannot be introduced without modifying the interface to both the data and process objects. Good design demands that the execution strategy is separated from the data objects and process objects. The benefits of such a design include reducing the complexity of the data and process objects, encapsulating execution strategies, performing run-time type checking (see \"Processing Unknown Dataset Types\") and even managing metadata (see \"Extending the Data Object Representation\").

        As the execution model becomes more complex, execution strategies are separated from the data and process objects as separate classes.

        The advanced design re-introduces the notion of an executive (see \"Executing the Pipeline\"). However, the design differs from that of Figure 4-7. As that figure illustrated, a single, centralized executive introduces dependencies into the pipeline that will not scale as pipeline complexity increases, or in parallel processing applications. In the advanced design, we assume multiple executives, typically one per filter. In some cases the executive may control multiple filters. This is particularly useful if the filters are interdependent or complex execution strategies are required. Different classes of executive can implement different execution strategies, for example a demand-driven, streaming pipeline is one such strategy. Other important classes include executives that coordinate the execution of filters on composite datasets. Figure 4-12. As the execution model becomes more complex, execution strategies are separated from the data and process objects as separate classes.

        Figure 4-12 is a high-level view of the executive and its relationship to data and process objects. In \"Pipeline Design and Implementation\" the design is explored in more detail."},{"location":"VTKBook/04Chapter4/#47-programming-models","title":"4.7 Programming Models","text":"

        Visualization systems are by their very nature designed for human interaction. As a result they must be easy to use. On the other hand, visualization systems must readily adapt to new data, and must be flexible enough to allow rapid data exploration. To meet these demands, a variety of programming models have been developed.

        "},{"location":"VTKBook/04Chapter4/#visualization-models","title":"Visualization Models","text":"

        At the highest level are applications. Visualization applications have finely tailored user-interfaces that are specific to an application area, e.g., fluid flow visualization. Applications are the easiest to use, but are the least flexible. It is very difficult or impossible for the user to extend applications into a new domain because of inherent logistical issues. Commercial turn-key visualization software is generally considered to be application software.

        At the opposite end of the spectrum are programming libraries. A conventional programming library is a collection of procedures that operate on a library-specific data structure. Often these libraries are written in conventional programming languages such as C or FORTRAN. These offer great flexibility and can be easily combined with other programming tools and techniques. Programming libraries can be extended or modified by the addition of user-written code. Unfortunately, the effective use of programming libraries requires skilled programmers. Furthermore, non graphics/visualization experts cannot easily use programming libraries because there is no notion of how to fit (or order) the procedures together correctly. These libraries also require extensive synchronization schemes to control execution as input parameters are varied.

        Many visualization systems lie between these two extremes. These typically use a visual programming approach to construct visualization networks. The basic idea is to provide graphical tools and libraries of modules or process objects. Modules may be connected subject to input/output type constraints, using simple graphical layout tools. In addition, user interface tools allow association of interface widgets with object input parameters. System execution is generally transparent to the user by way of an internal execution executive.

        "},{"location":"VTKBook/04Chapter4/#alternative-visual-programming-models","title":"Alternative Visual Programming Models","text":"

        There are two other graphics and visualization programming models that bear mentioning. These are scene graphs and the spreadsheet model.

        Scene graphs are typically found in 3D graphics systems such as Open Inventor [Wernecke94]. Scene graphs are acyclic tree-structures that represent objects, or nodes, in an order defined by the tree layout. The nodes may be geometry (called shape nodes), graphics properties, transformations, manipulators, lights, cameras, and so forth, that define a complete scene. The parent/child relationship controls how properties and transformations are applied to the nodes as they are rendered, or how the objects relate to other objects in the scene (e.g., which objects the lights shine on). Scene graphs are not used to control the execution of a visualization pipeline, rather they are used to control the rendering process. Scene graphs and visualization pipelines may be used together in the same application. In such a case the visualization pipeline is the generator of the shape nodes, and the scene graph controls the rendering of the scene including the shapes.

        Scene graphs have found wide use in the graphics community because of their ability to compactly and graphically represent a scene. In addition, scene graphs have been popularized by their recent use in Web tools such as VRML and Java3D. See Chapter 11 - Visualization on the Web for more information.

        Another recently introduced technique for visual programming is the spreadsheet technique of Levoy [Levoy94]. In the spreadsheet model, we arrange operations on a regular grid similar to the common electronic accounting spreadsheets. The grid consists of rows and columns of cells, where each cell is expressed as a computational combination of other cells. The combination is expressed for each cell by using a simple programming language to add, subtract, or perform other more complex operations. The result of the computation (i.e., a visual output) is displayed in the cell. A recent extension to the spreadsheet approach is exemplified by VisTrails [Bavoil2005], a system that enables interactive multiple-view visualizations by simplifying the creation and maintenance of visualization pipelines, and by optimizing the execution of the pipelines. VisTrails has the further benefit that it tracks changes to the visualization pipeline so that it is straightforward to create extensive design studies.

        Although visual programming systems are widely successful, they suffer two drawbacks. First, they are not as tailored as an application and require extensive programming, albeit visual, to be so. Second, visual programming is too limited for detailed control, so constructing complex low-level algorithms and user-interfaces is not feasible. What is required is a visualization system that provides the \"modularity\" and automatic execution control of a visual system, and the low-level programming capability of a programming library. Object-oriented systems have the potential to provide these capabilities. Carefully crafted object libraries provide the ease of use of visual systems with the control of programming libraries. That is a major goal of the described in this text.

        "},{"location":"VTKBook/04Chapter4/#48-data-interface-issues","title":"4.8 Data Interface Issues","text":"

        At this point in the text you may be wondering how to apply a visualization pipeline towards your own data. The answer depends on the type of data you have, preferences in programming style, and required complexity. Although we have not yet described particular types of data (we will in the next chapter), there are two general approaches you may wish to consider when interfacing your data to a visualization system: a programming interface and an application interface.

        "},{"location":"VTKBook/04Chapter4/#programming-interface","title":"Programming Interface","text":"

        The most powerful and flexible approach is to directly program your application to read, write, and process data. There is almost no limit to what you can achieve using this approach. Unfortunately, in a complex system like VTK this requires a level of expertise that may be beyond your time budget to obtain. (If you are interested in this approach using VTK, you'll have to become familiar with the objects in the system. You will also want to refer to the Doxygen-generated manual pages ---on-line at http://www.vtk.org or CD-ROM. The companion text The VTK User's Guide is also helpful.)

        Typical applications requiring a programming interface are interfacing to data files that are not currently supported by the system or generating synthetic data (e.g., from a mathematical relationship) where no data file is available. Also, sometimes it is useful to directly code your data in the form of a program, and then execute the program to visualize the results. (This is exactly what many of the VTK examples do.)

        In general, programming a complex system such as VTK is a difficult undertaking because of the initial learning curve. There are, however, simpler ways to interface to data. While skilled developers may be required to create sophisticated applications, the points of an object-oriented toolkit like VTK is that it provides many of the pieces required to interface to common data forms. Thus focusing on those objects that import and export data is a good start towards interfacing with data. In VTK, these objects are known as readers, writers, importers and exporters.

        File Interface (Readers / Writers). In this chapter we saw that readers are source objects, and writers are mappers. What this means from a practical point of view is that readers will ingest data from a file, create a data object, and then pass the object down the pipeline for processing. Similarly, writers ingest a data object and then write the data object to a file. Thus, readers and writers will interface to your data well if VTK supports your format, and you only need to read or write a single data object. If your data file format is not supported by the system, you will need to interface to your data via a general programming interface described above. Or, if you wish to interface to a collection of objects, you will probably want to see whether an exporter or importer object (described in the next section) exists to support your application.

        Examples of readers include vtkSTLReader (read stereo-lithography files) and vtkBYUReader (read MOVIE.BYU format data files). Similarly the objects vtkSTLWriter and vtkBYUWriter can be used to write data files. To see which readers and writers are supported by VTK, see the VTK User's Guide or refer to the Web pages at http://www.vtk.org for the current Doxygen manual pages.

        File Interface (Importers / Exporters). Importers and exporters are objects in the system that read or write data files consisting of more than one object. Typically importers and exporters are used to save or restore an entire scene (i.e., lights, cameras, actors, data, transformations, etc.). When an importer is executed, it reads one or more files and may create several objects. For example, in VTK the vtk3DSImporter imports a 3D Studio file and creates a rendering window, renderer, lights, cameras, and actors. Similarly, the vtkVRMLExporter creates a VRML file given a VTK render window. The VRML file contains cameras, lights, actors, geometry, transformations, and the like, indirectly referred to by the rendering window provided.

        In the Visualization Toolkit, there are several importers and exporters. To see which importers and exporters are supported by VTK, see the VTK User's Guide. You may also want to check the Web pages at http://www.vtk.org for the current Doxygen manual pages. If the exporter you are looking for does not exist, you will have to develop your own using the programming interface.

        Figure 4-13. Importing and exporting files in VTK. An importer creates a vtkRenderWindow that describes the scene. Exporters use an instance of vtkRenderWindow to obtain a description of the scene. See 3DSImporter.cxx and 3DSImporter.py.

        Figure 4-13 shows an image created from a 3D Studio model and saved as a Renderman RIB file."},{"location":"VTKBook/04Chapter4/#application-interface","title":"Application Interface","text":"

        The majority of users interface to their data by using an existing application. Rather than programming pipelines or writing their own readers and writers, users acquire an application that suits their particular visualization needs. Then to interface to their data, users simply identify the reader, writer, importer, and/or exporter that can successfully process it. In some cases, users may have to modify the program used to generate the data so that it exports it in a standard data format. The advantage of using existing applications is that the user interface and pipeline are pre-programmed, insuring that the user can focus on their data, rather than expending the significant resources required to write visualization programs. The disadvantage of using existing applications is that necessary features are often missing, and applications typically lack the flexibility that a general purpose tool can provide.

        Selecting the right application is not always simple. The application must support the correct dataset types, and support suitable rendering devices, for example generating images on large displays [Humphreys99] or in a Cave [CruzNeira93] environment. In some cases user interaction is required, and demands on parallel processing or data handling capacities further complicates the selection. For example, while a general purpose tool like ParaView ( Figure 4-14a) can be used to visualize most types of data, including providing support for large data and parallel computing, a specialized tool such as VolView (Figure 4-14b)may be better suited for the a particular type task such as viewing medical data shown in the figure. It is imperative that users have a familiarity with the visualization process if they are to successfully choose the right application for their data."},{"location":"VTKBook/04Chapter4/#49-putting-it-all-together","title":"4.9 Putting It All Together","text":"

        In the previous sections we have treated a variety of topics relating to the visualization model. In this section we describe the particular implementation details that we have adopted in the Visualization Toolkit.

        #   import from 3d Studio vtk3DSImporter importer\nimporter ComputeNormalsOn\nimporter SetFileName \"$VTK_DATA_ROOT/Data/iflamigm.3ds\"\nimporter Read\n#   export to rib format\n\nvtkRIBExporter exporter\nexporter SetFilePrefix importExport\nexporter SetRenderWindow [importer GetRenderWindow]\nexporter BackgroundOn\nexporter Write\n
        "},{"location":"VTKBook/04Chapter4/#procedural-language-implementation","title":"Procedural Language Implementation","text":"

        The Visualization Toolkit is implemented in the procedural language C++. Automated wrapping technology creates language bindings to the Python, Tcl and Java interpretive programming languages [King03]. The class library contains data objects, filters (i.e., process objects) and executives to facilitate the construction of visualization applications. A variety of supporting abstract super-classes are available to derive new objects including data objects and filters. The visualization pipe-line is designed to connect directly to the graphics subsystem described in the previous chapter. This connection is via VTK's mappers, which are the sinks of the pipeline and interface to the VTK's actors.

        A visual programming interface could be (and has been) implemented using the class library provided. However, for real-world applications the procedural language implementation provides several advantages. This includes straightforward implementation of conditional network execution and looping, ease of interface to other systems, and the ability to create custom applications with sophisticated graphical user interfaces. The VTK community has created several visual programming and visualization applications from the toolkit. Many of these are available as open-source software (e.g., ParaView at paraview.org) or as commercial applications (e.g., VolView at www.volview.com).

        Figure 4-14a. ParaView parallel visualization application. Figure 4-14b. VolView volume rendering application. Figure 4-14. The choice of an appropriate visualization application depends on the type of dataset(s) it must support, required interaction techniques, rendering capabilities, and support for large data, including parallel processing. While both applications above are built using the VTK visualization toolkit, they provide very different user experiences. ParaView (paraview.org) is a general purpose visualization system that can process large data in a distributed, parallel environment (as well as on single processor systems), with the ability to display on a Cave or tiled display. VolView (volview.com) focuses on volumetric and image data and uses multi-threading and sophisticated level-of-detail methods to achieve interactive performance."},{"location":"VTKBook/04Chapter4/#pipeline-design-and-implementation","title":"Pipeline Design and Implementation","text":"

        The Visualization Toolkit implements a general execution mechanism. Filters are divided into two basic parts: algorithm and executive objects. An algorithm object, whose class is derived from vtkAlgorithm, is responsible for processing information and data. An executive object, whose class is derived from vtkExecutive, is responsible for telling an algorithm when to execute and what information and data to process. The executive component of a filter may be created independently of the algorithm component allowing custom pipeline execution mechanisms without modifying core VTK classes.

        Information and data produced by a filter are stored in one or more output ports. An output port corresponds to one logical output of the filter. For example, a filter producing a color image and a corresponding binary mask image would define two output ports, each holding one of the images. Pipeline-related information is stored in an instance of vtkInformation on each output port. The data for an output port is stored in an instance of a class derived from vtkDataObject.

        Information and data consumed by a filter are retrieved through one or more input ports. An input port corresponds to one logical input of the filter. For example, a glyph filter would define one input port for the glyph itself and another input port defining the glyph positions. Input ports store input connections that reference the output ports of other filters; these output ports eventually provide information and data to the filter. Each input connection provides one data object and its corresponding information obtained from the output port to which the connection is made. Since connections are stored through logical ports and not in the data flowing through those ports, the data type need not be known when the connection is made. This is particularly useful when creating pipelines whose source is a reader that does not know its output data type until the file is read (see \"Pipeline Connections\" and \"Processing Unknown Dataset Types\").

        Figure 4-15. Description of implicit execution process implemented in VTK. The Update() method is initiated via the Render() method from the actor. Data flows back to the mapper via the RequestData() method. Arrows connecting filter and data objects indicate direction of the Update() process.

        To understand the execution of the VTK pipeline, it is useful to view the process from several different vantage points. Note that each of the following figures is not completely accurate, rather they are presented as depictions whose purpose is to describe the important features of the process.

        Figure 4-15 shows a simplified description of VTK's execution process. Generally the execution of the pipeline is triggered by a mapper's Render() method invocation, typically in response to a Render() method invocation on an associated vtkActor (which in turn receives it from the render window). Next, the Update() method is called on the input to the mapper (resulting in a cascade of method invocations requesting information and data). Eventually, data must be computed and returned to the object initiating the request, in this case the mapper. The RequestData() method actually executes the filter(s) in the pipeline and produces output data. Note the direction of flow---here we define the direction of data flow as the downstream direction, and the direction of the Update() invocation the upstream direction. Figure 4-16. The logical relationship of the algorithm, executive and ports constituting a filter. The executive is responsible for managing the execution of the algorithm, and coordinating with information requests traveling through the pipeline. Ports correspond to logical, distinct inputs and outputs.

        The next figure, Figure 4-16, shows the relationship between the executive and the algorithm, which are paired to form a filter. This view of the filter is independent of the pipeline and contains all the information about the interface of the algorithm, namely the number and availability of inputs and outputs. Finally Figure 4-17 shows the connections between filters. Notice that the output data object is not directly wired to the input connection. Rather the downstream filters's input connection is associated with the upstream filter's output port. This separation of data object from the input port means that data type checking can be deferred until run-time, when the consuming filter requests data from the producer of the data. Thus the producer can generate different types of data (e.g., it is a reader that produces different data types), and as long as the consumer supports these different data types, the pipeline will execute without error."},{"location":"VTKBook/04Chapter4/#connecting-pipeline-objects","title":"Connecting Pipeline Objects","text":"

        This leads us to the method of making connections between filters and data objects to form a visualization pipeline. As is evident from the previous figures, the Visualization Toolkit pipeline architecture has been designed to support multiple inputs and outputs. In practice, you will find that most filters and sources actually generate a single output and filters accept a single input. This is because most algorithms tend to be single input/output in nature. There are exceptions and we will describe some of these shortly. However, first we would like to provide a brief history lesson relative to the evolution of VTK's pipeline architecture. This lesson is instructive because it sheds light on the evolution of the pipeline design in response to new requirements.

        Prior to VTK 5.0. In earlier versions of VTK (i.e., prior to version 5.0), the visualization pipeline architecture was accurately depicted by Figure4-15. In this figure, which shows how filters and data objects were connected to form a visualization network, the input data was represented by the Input instance variable and was set using the SetInput() method. The output data was represented by the Output instance variable and was accessed using the GetOutput() method. To connect filters together, the C++ statement

        filter2->SetInput(filter1->GetOutput()); //Prior to VTK5.0\n

        was typically used with filter1 and filter2 filter objects of compatible type. In this design, compile time type checking was performed (i.e., the C++ compiler would enforce proper type.) Obviously, this meant that correcting filters together producing output of unknown type was problematic. Several other issues with this design remained as well, many of which have been alluded to earlier, but are summarized here to motivate the use of the newer pipeline architecture.

        Figure 4-17. The logical relationship of ports and connections An input port may have more than one connection associated with it. Multiple connections are possible in certain filters such as the append filter, where a single logical input port represents all the data to be \"appended\" together, and each input is represented by a different connection.
        • The older design did not support deferred dataset type checking. It was difficult to support arbitrary reader types or filters that could produce different types of output.

        • The strategy for updating and managing the execution of the pipeline were implicitly embedded in the process objects and data objects. As the strategy became more complex, or needed to change, this required modifying data and/or process objects.

        • In the older design it was difficult to abort pipeline execution during an update pass. Further, it was not possible to centralize the error checking; each filter had to do some checking thereby duplicating code.

        • Introducing metadata into the pipeline required changing the API to the data and process objects. It was desirable to support the ability of a reader to add metadata to a data stream and have a filter in the pipeline retrieve it, without having to modify the API.

        For this, and other reasons related to parallel processing, the original VTK pipeline design was reworked. While the transition was difficult, such changes are often necessary if a software system is to change and grow with advances in technology.

        VTK 5.0 and Beyond. While VTK 5.0 still supports the use of SetInput()/GetOutput(), its use in Figure 4-16 and Figure 4-17 is discouraged. Rather, the newer pipeline architecture should be used. Referring to Figure 4-17, we use connections and ports to configure VTK's visualization pipeline:

        filter2->SetInputConnection(filter1->GetOutputPort()); //VTK 5.0\n

        You probably have already guessed how this approach can be extended to multiple inputs and multiple outputs. Let's look at some concrete examples. vtkGlyph3D is an example of a filter that accepts multiple inputs and generates a single output. The inputs to vtkGlyph3D are represented by the Input and Source instance variables. The purpose of vtkGlyph3D is to copy the geometry defined by the data in Source to each point defined by Input. The geometry is modified according to the Source data values (e.g., scalars and vectors). (For more information about glyphs see \"Glyphs\".) To use the vtkGlyph3D object in C++ code you would do the following:

        glyph = vtkGlyph3D::New();\n glyph->SetInputConnection(foo->GetOutputPort());\n glyph->SetSourceConnection(bar->GetOutputPort());...\n

        where foo and bar are filters returning the appropriate type of output. The class vtkExtractVectorComponents is an example of a filter with a single input and multiple outputs. This filter extracts the three components of a 3D vector into separate scalar components. Its three outputs are available on output ports 0, 1, and 2. An example use of the filter follows:

        vz = vtkExtractVectorComponents::New();\nfoo = vtkDataSetMapper::New();\nfoo->SetInputConnection(vz->GetOutputPort(2));\n

        Several other special objects having multiple inputs or outputs are also available. Some of the more notable classes are vtkMergeFilter, vtkAppendFilter, and vtkAppendPolyData. These filters combine multiple pipeline streams and generate a single output. Note, however, that while vtkMergeFilter has multiple input ports (i.e., different logical inputs), vtkAppendFilter has only one logical input, but presumes multiple connections are made to that one input. This is because in the case of vtkMergeFilter, each input has a distinct and separate purpose, while in vtkAppendFilter all the inputs have the same meaning (i.e., just one more input in a list to append together). Here are some code fragments:

        merge = vtkMergeFilter::New();\nmerge->SetGeometryConnection(foo->GetOutputPort());\nmerge->SetScalarsConnection(bar->GetOutputPort());\n

        and

        append = vtkAppendFilter::New();\nappend->AddInputConnection(foo->GetOutputPort());\nappend->AddInputConnection(bar->GetOutputPort());\n

        Notice the use of the method AddInputConnection(). This method adds to the list of connections, whereas SetInputConnection() clears the list and specifies the single connection to the port.

        Another important filtering class is vtkProbeFilter. This filter takes two inputs. The first input is the data we wish to probe. The second input supplies a set of points that are used as probe points. Some process objects take a list of input data. Another interesting filter is the vtkBooleanStructuredPoints class which performs set operations on volume datasets. The first data item in the list is used to initialize the set operation. Each subsequent item in the list is combined with the result of previous operations using a boolean operation specified by the user.

        For more details regarding the object design of filters and data objects, please see Chapter 5 - Data Representation and Chapter 6 - Fundamental Algorithms .

        "},{"location":"VTKBook/04Chapter4/#pipeline-execution-and-information-objects","title":"Pipeline Execution and Information Objects","text":"

        Until now, we have used the terms metadata and information objects rather informally. As described previously, in the context of VTK, these terms refer to data that describes datasets. In this section, we show how these objects, which are subclasses of vtkInformation, are used to facilitate the execution of the VTK pipeline.

        Information Objects. Information objects are the basic containers used throughout the VTK pipeline to hold a wide variety of metadata. They are heterogeneous key-to-value maps in which the type of the key determines the type of the value. The following is an enumeration of the places information objects are used.

        • Pipeline information objects hold information for pipeline execution. They are stored in instances of vtkExecutive or subclasses and are accessible via the method vtkExecutive::GetOutputInformation(). There is one pipeline information object per output port. It contains an entry pointing to the output vtkDataObject on the corresponding port (if it has been created). The vtkDataObject contains a pointer back to its corresponding pipeline information object, accessible via vtkDataObject::GetPipelineInformation(). The pipeline information object also holds information about what will populate the data object when the filter executes and generates the output. The actual information contained is determined by the output data type and the execution model in use. Pipeline information objects for input connections are accessible via the method vtkExecutive::GetInputInformation(), and they are the pipeline information objects on the output ports to which the input ports are connected.

        • Port information objects hold information about the data types produced on output ports and consumed by input ports. They are stored by instances of vtkAlgorithm. There is one input port information object per input port and one output port information object per output port. They are accessible via the methods vtkAlgorithm::GetInputPortInformation() and vtkAlgorithm::GetOutputPortInformation(). Port information objects are usually created and populated by subclasses of vtkAlgorithm in order to specify the interface of the filter.

        • Request information objects hold information about a specific request being sent to an executive or algorithm. There is one entry indicating what request is being sent and possibly other entries giving additional details about the specific request. These information objects are not accessible via any public method but are passed to ProcessRequest() methods that implement the requests.

        • Data information objects hold information about what is currently stored in a vtkDataObject. There is one data information object in each data object, accessible via vtkDataObject::GetInformation(). The actual information contained is determined by the data object type.

        • Algorithm information objects hold information about an instance of vtkAlgorithm. There is one algorithm information object per algorithm object, accessible via vtkAlgorithm::GetInformation(). The actual information contained is determined by the algorithm object type.

        The importance of the information objects in VTK is that they are flexible (e.g., new key-value pairs can be easily added) and extensible. That is, readers, filters and mappers can add new information to the containers without requiring the API of the pipeline-related classes to change.

        ** Pipeline Execution Models. In VTK, the fundamental pipeline update mechanism is based on the request. A request is the basic pipeline operation (or \"pipeline pass\") that generally asks for particular piece of information to be propagated through the pipeline. An execution model is a set of requests defined by a specific executive. Refer to Figure 4-18** in the following description of the execution process.

        Figure 4-18. Path of a request sent through a pipeline. For example, assume the consumer (at the far right) needs only a single piece of this data (e.g., piece 1 of 4); also assume that the producer (on the far left) is a reader that can partition its data into pieces. The consumer passes this request upstream, and it continues upstream (via executives) until it reaches a producer that can fulfill the request. When the reader algorithm is asked for a piece of the data, it provides it, and passes the new data back (with the information that it is piece 1 of 4) down the pipeline. It stops when it reaches the consumer who made the request.

        Requests are generated by the executive object of a filter that has been explicitly asked to update by its algorithm due to some user call. For example, when the Write() method of a writer is called, the algorithm object asks its executive to update the pipeline, and execute the writer, by calling this->GetExecutive()->Update(). Several requests may be sent through the pipeline in order to bring it up to date.

        A request is implemented as an information object. There is one key of type vtkInformationRequestKey specifying the request itself. This key is typically defined by the executive's class. Additional information about the request may also be stored in the request information object.

        Requests are propagated through the pipeline by the executives of each filter. The vtkExecutive::ProcessRequest() method is invoked on an executive given the request information object. This method is implemented by each executive and is responsible for fulfilling the request as it sees fit. Many requests may be fulfilled for a filter only after it has been fulfilled for the filters providing its inputs. For these requests the executive will pass the request on to the executives of these upstream filters and then handle the request itself.

        An executive often asks its algorithm object for help in fulfilling a request. It sends the request to the algorithm object by invoking the vtkAlgorithm::ProcessRequest() method. This method is implemented by all algorithms and is responsible for handling the request. Input and output pipeline information objects are provided as arguments to the method. The algorithm must handle the request using only its own filter parameter settings and the pipeline information objects given. An algorithm is not allowed to ask its executive for any additional information. This insures that the algorithms are independent of the executives. Figure 4-18 shows a typical path taken by a request as it is sent through a pipeline. Typically the request originates in a consumer at the end of the pipeline. It is sent back through the pipeline by the executives. Each executive asks its algorithm to help handle the request."},{"location":"VTKBook/04Chapter4/#flexible-computation-memory-trade-off","title":"Flexible Computation / Memory Trade-off","text":"

        By default, networks constructed using the Visualization Toolkit store intermediate computational results (i.e., favor computation). However, a single class variable can be set to discard intermediate data when they are no longer needed (i.e., favor memory). In addition, a local parameter can be set within each process object to control this trade-off at object level.

        This global variable is set as follows. Given the data object O, (or the output of a filter obtained using O=filter->GetOutput()), invoke O->SetGlobalReleaseDataFlagOn() to enable data release. To enable data release for a particular object use O->SetReleaseDataFlagOn(). Appropriate methods exist to disable memory release as well.

        "},{"location":"VTKBook/04Chapter4/#high-level-object-design","title":"High-Level Object Design","text":"

        At this point in the text it is premature to describe design details of the various objects making up the visualization pipeline. However, there are two important classes that affect many of the objects in the text. These are the classes vtkObject and vtkObjectBase.

        vtkObjectBase is the base object for almost all inheritance hierarchies found in VTK. vtkObjectBase implements data object reference counting (see \"Reference Counting & Garbage Collection\"). Subclasses of vtkObjectBase may be shared by other objects, without duplicating memory. It also defines an API for objects to print information about themselves.

        vtkObject is a subclass of vtkObjectBase. It provides methods and instance variables to control run-time debugging and maintains internal object modification time. In particular, the method Modified() is used to update the modification time, and the method GetMTime() is used to retrieve it. vtkObject also provides a framework for the event callbacks that we saw in the previous chapter (see \"Events and Observers\" in Chapter 3).

        Note that we do not always include vtkObject and vtkObjectBase in object diagrams to conserve space. Refer to the source code for a definitive statement.

        "},{"location":"VTKBook/04Chapter4/#examples","title":"Examples","text":"

        We will now demonstrate some of the features of the visualization pipeline with four examples. Some of the objects used here will be unfamiliar to you. Please overlook missing details until we cover the information later in the book. The goal here is to provide a flavor and familiarity with the software architecture and its use.

        ** Simple Sphere. The first example demonstrates a simple visualization pipeline. A polygonal representation of a sphere is created with the source object (vtkSphereSource). The sphere is passed through a filter (vtkElevationFilter) that computes the height of each point of the sphere above a plane. The plane is perpendicular to the z-axis, and passes through the point (0,0,-1). The data is finally mapped (vtkDataSetMapper) through a lookup table. The mapping process converts height value into colors, and interfaces the sphere geometry to the rendering library. The mapper is assigned to an actor, and then the actor is displayed. The visualization network, a portion of code, and output image are shown in Figure 4-19**.

        Figure 4-19. A simple sphere example. See ColoredSphere.cxx and ColoredSphere.py.

        The execution of the pipeline occurs implicitly when we render the actor. Each actor asks its mapper to update itself. The mapper in turn asks its input to update itself. This process continues until a source object is encountered. Then the source will execute if modified since the last render.

        Then the system walks through the network and executes each object if its input or instance variables are out of date. When completed, the actor's mapper is up to date and an image is generated.

        Now let's reexamine the same process of pipeline execution by following method invocation. The process begins when the actor receives a Render() message from a renderer. The actor in turn sends a Render() message to its mapper. The mapper begins network execution by asking its input to update itself via the Update() operation. This causes a cascade of Update() methods as each filter in turn asks its input to update itself. If branching in the pipeline is present, the update method will branch as well. Finally, the cascade terminates when a source object is encountered. If the source object is out of date, it will send itself an RequestData() command. Each filter will send itself an RequestData() as necessary to bring itself up to date. Finally, the mapper will perform operations to transform its input into rendering primitives.

        In the Visualization Toolkit, the Update() method is public while the RequestData() method is protected. Thus, you can manually cause network execution to occur by invoking the Update() operation. This can be useful when you want to set instance variables in the network based on the results of upstream execution, but do not want the whole network to update. The RequestData() method is protected because it requires a certain object state to exist. The Update() method insures that this state exists.

        One final note. The indentation of the code serves to indicate where objects are instantiated and modified. The first line (i.e., the New() operator) is where the object is created. The indented lines that follow indicate that various operations are being performed on the object. We encourage you to use a similar indenting scheme in your own work.

        Warped Sphere. This example extends the pipeline of the previous example and shows the effects of type checking on the connectivity of process objects. We add a transform filter (vtkTransformFilter) to non-uniformly scale the sphere in the x-y-z directions.

        The transform filter only operates on objects with explicit point coordinate representation (i.e., a subclass of vtkPointSet). However, the elevation filter generates the more general form vtkDataSet as output. Hence we cannot connect the transform filter to the elevation filter. But we can connect the transform filter to the sphere source, and then the elevation filter to the transform filter. The result is shown in Figure 4-20. (Note: an alternative method is to use vtkCastToConcrete to perform run-time casting.) Figure 4-20. The addition of a transform filter to the previous example. See TransformSphere.cxx and TransformSphere.py.

        The C++ compiler enforces the proper connections of sources, filters, and mappers. To decide which objects are compatible, we check the type specification of the SetInput() method. If the input object returns an output object or a subclass of that type, the two objects are compatible and may be connected.

        Generating Oriented Glyphs. This example demonstrates the use of an object with multiple inputs. vtkGlyph3D places 3D icons or glyphs (i.e., any polygonal geometry) at every input point. The icon geometry is specified with the instance variable Source, and the input points are obtained from the Input instance variable. Each glyph may be oriented and scaled in a variety of ways, depending upon the input and instance variables. In our example we place cones oriented in the direction of the point normals (Figure 4-21). Figure 4-21. An example of multiple inputs and outputs. See Mace.cxx and Mace.py.

        The visualization network branches at vtkGlyph3D. If either branch is modified, then this filter will re-execute. Network updates must branch in both directions, and both branches must be up to date when vtkGlyph3D executes. These requirements are enforced by the Update() method, and pose no problem to the implicit execution method.

        Disappearing Sphere. In our last example we construct a visualization network with a feedback loop, and show how we can use procedural programming to change the topology of the network. The network consists of four objects: vtkSphereSource to create an initial polygonal geometry, vtkShrinkFilter to shrink the polygons and create a gap or space between neighbors, vtkElevationFilter to color the geometry according to height above the x-y plane, and vtkDataSetMapper to map the data through a lookup table and interface to the rendering library. The network topology, a portion of the C++ code, and output are shown in Figure 4-22. Figure 4-22. A network with a loop (LoopShrk.cxx). VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK. See LoopShrink.cxx and LoopShrink.py.

        After vtkSphereSource generates an initial geometry (in response to a render request), the input of vtkShrinkFilter is changed to the output of the vtkElevationFilter. Because of the feedback loop, vtkShrinkFilter will always re-execute. Thus, the behavior of the network is to re-execute each time a render is performed. Because the shrink filter is reapplied to the same data, the polygons become smaller and smaller and eventually disappear.

        "},{"location":"VTKBook/04Chapter4/#410-chapter-summary","title":"4.10 Chapter Summary","text":"

        The visualization process is naturally modelled using a combination of functional and object models. The functional model can be simplified and used to describe visualization networks. The object model specifies the components of the visualization network. Visualization networks consist of process objects and data objects. Data objects represent information; process objects transform the data from one form to another. There are three types of process objects sources have no input and at least one output; filters have at least one input and output; sinks, or mappers, terminate the visualization network. The execution of the network can be controlled implicitly or explicitly. Implicit control means that each object must insure its input is up to date, thereby distributing the control mechanism. Explicit control means that there is a centralized executive to coordinate the execution of each object. Many techniques are available to program visualization networks. Direct visual programming is most common in commercial systems. At a higher level, applications provide tailored but more rigid interfaces to visualize information. At the lowest level, subroutine or object libraries provide the greatest flexibility. The Visualization Toolkit contains an object library implemented in C++ for constructing visualization networks.

        "},{"location":"VTKBook/04Chapter4/#411-bibliographic-notes","title":"4.11 Bibliographic Notes","text":"

        The practical way to learn about the visualization process is to study commercially available systems. These systems can be categorized as either direct visual programming environments or as applications. Common visual programming systems include AVS [AVS89], Iris Explorer [IrisExplorer], IBM Data Explorer [DataExplorer], aPE [aPE90], and Khoros [Rasure91]. Application systems generally provide less flexibility than visual programming systems, but are better tailored to a particular problem domain. PLOT3D [PLOT3D] is an early example of a tool for CFD visualization. This has since been superseded by FAST [FAST90]. FieldView is another popular CFD visualizer [FieldView91]. VISUAL3 [VISUAL3] is a general tool for unstructured or structured grid visualization. PV-WAVE [Charal90] can be considered a hybrid system, since it has both simple visual programming techniques to interface to data files as well as a more structured user-interface than the visual programming environments. Wavefront's DataVisualizer [DataVisualizer] is a general-purpose visualization tool. It is unique in that it is part of a powerful rendering and animation package. A nice system for visualizing 3D gridded data (such as that produced by numerical weather models) is VIS5D. Find out more at the VIS5D Web site.

        Although many visualization systems claim to be object-oriented, this is often more in appearance than implementation. Little has been written on object-oriented design issues for visualization. VISAGE [VISAGE92] presents an architecture similar to that described in this chapter. Favre [Favre94] describes a more conventional object-oriented approach. His dataset classes are based on topological dimension and both data and methods are combined into classes.

        "},{"location":"VTKBook/04Chapter4/#412-references","title":"4.12 References","text":"

        [aPE90] D. S. Dyer. \"A Dataflow Toolkit For Visualization.\" IEEE Computer Graphics and Applications. 10(4):60-69, July 1990.

        [AVS89] C. Upson, T. Faulhaber Jr., D. Kamins and others. \"The Application Visualization System: A Computational Environment for Scientific Visualization.\" IEEE Computer Graphics and Applications. 9(4):30-42, July 1989.

        [Bavoil2005] L. Bavoil, S.P. Callahan, P.J. Crossno, J. Freire, C.E. Scheidegger, C.T. Silva and H.T. Vo. \"VisTrails: Enabling Interactive Multiple-View Visualizations.\" In Proceedings of IEEE Visualization 2005. IEEE Computer Society Press, 2005.

        [Berger84] M. Berger and J. Oliger. Adaptive Mesh Refinement for Hyperbolic Partial Differential Equations. Journal of Computational Physics, 53:484-512, March 1984.

        [Charal90] S. Charalamides. \"New Wave Technical Graphics Is Welcome.\" DEC USER , August 1990.

        [CruzNeira93] C. CruzNeira, D.J. Sandin, and T. DeFanti. \"Surround-screen projection-based virtual reality: The design and implementation of the CAVE.\" In Proceedings of SIGGRAPH 93, pp. 135--142, August 1993.

        [DataExplorer] Data Explorer Reference Manual. IBM Corp, Armonk, NY, 1991.

        [DataVisualizer] Data Visualizer User Manual. Wavefront Technologies, Santa Barbara, CA, 1990.

        [FAST90] G. V. Bancroft, F. J. Merritt, T. C. Plessell, P. G. Kelaita, R. K. McCabe, and A.Globus. \"FAST: A Multi-Processed Environment for Visualization.\" In Proceedings of Visualization '90. pp. 14-27, IEEE Computer Society Press, Los Alamitos, CA, 1990.

        [Favre94] J. M. Favre and J. Hahn. \"An Object-Oriented Design for the Visualization of Multi-Variate Data Objects.\" In Proceedings of Visualization '94. pp. 319-325, IEEE Computer Society Press, Los Alamitos, CA, 1994.

        [FieldView91] S. M. Legensky. \"Advanced Visualization on Desktop Workstations.\" In Proceedings of Visualization '91. pp. 372-378, IEEE Computer Society Press, Los Alamitos, CA, 1991.

        [Haeberli88] P. E. Haeberli. \"ConMan: A Visual Programming Language for Interactive Graphics.\" Computer Graphics (SIGGRAPH '88). 22(4):103-11, 1988.

        [Humphreys99] G. Humphreys and P. Hanrahan. \"A Distributed Graphics System for Large Tiled Displays.\" In Proc. IEEE Visualization '99, pp. 215-224, IEEE Computer Society Press, October 1999.

        [IrisExplorer] Iris Explorer User's Guide. Silicon Graphics Inc., Mountain View, CA, 1991.

        [King03] B. King and W. Schroeder. \"Automated Wrapping of Complex C++ Code.\" C/C++ Users Journal, January 2003.

        [Law99] C. Charles Law, K. M. Martin, W. J. Schroeder, J. E. Temkin. \"A Multi-Threaded Streaming Pipe-line Architecture for Large Structured Data Sets.\" In Proc. of Visualization \\'99. IEEE Computer Society Press, 1999.

        [Levoy94] M. Levoy. \"Spreadsheets for Images.\" In Proceedings of SIGGRAPH '94 . pp. 139--146, 1994.

        [Martin2001] K.M. Martin, B. Geveci, J. Ahrens, C. Law. \"Large Scale Data Visualization Using Parallel Data Streaming.\" IEEE Computer Graphics & Applications, 21(4):34-41, July 2001.

        [PLOT3D] P. P. Walatka and P. G. Buning. PLOT3D User's Manual. NASA Fluid Dynamics Division, 1988.

        [Rasure91] J. Rasure, D. Argiro, T. Sauer, and C. Williams. \"A Visual Language and Software Development Environment for Image Processing.\" International Journal of Imaging Systems and Technology. 1991.

        [VISAGE92] W. J. Schroeder, W. E. Lorensen, G. D. Montanaro, and C. R. Volpe. \"VISAGE: An Object-Oriented Visualization System.\" In Proceedings of Visualization '92. pp. 219-226, IEEE Computer Society Press, Los Alamitos, CA, 1992.

        [VISUAL3] R. Haimes and M. Giles. \"VISUAL3: Interactive Unsteady Unstructured 3D Visualization.\" AIAA Report No. AIAA-91-0794. January 1991.

        [Wernecke94] J. Wernecke. The Inventor Mentor. Addison-Wesley Publishing Company, ISBN 0-201-62495-8, 1994.

        "},{"location":"VTKBook/04Chapter4/#413-exercises","title":"4.13 Exercises","text":"

        4.1 Consider the following 2D visualization techniques: x-y plotting, bar charts, and pie charts.

        For each technique:

        a) Construct functional models.

        b) Construct object models.

        4.2 A height field is a regular array of 2D points where h = f(x,y), h is an altitude above the point (x,y). Height fields are often used to represent terrain data. Design an object-oriented system to visualize height fields.

        a) How would you represent the height field?

        b) What methods would you use to access this data?

        c) Develop one process object (i.e., visualization technique) to visualize a height field. Describe the methods used by the object to access and manipulate the height field.

        4.3 Describe how you would implement an explicit control mechanism for network execution.

        a) How do process objects register their input data with the executive?

        b) How is the executive notified of object modification?

        c) By what method is the executive notified that network execution is necessary?

        d) Describe an approach for network dependency analysis. How does the executive invoke execution of the process objects?

        4.4 Visual programming environments enable the user to construct visualization applications by graphically connecting process objects.

        a) Design a graphical notation to represent process objects, their input and output, and data flow direction.

        b) How would you modify instance variables of process objects (using a graphical technique)?

        c) By what mechanism would network execution be initiated?

        d) How would you control conditional execution and looping in your network?

        e) How would you take advantage of parallel computing?

        f) How would you distribute network execution across two or more computers sharing a network connection?

        4.5 Place oriented cylinders (instead of cones) on the mace in Figure 4-20. (Hint: use vtkCylinderSource.)

        4.6 The implicit update method for the visualization network used by VTK is simple to implement and understand. However, it is prone to a common programming error. What is this error?

        4.7 Experiment with the transformation object in Figure 4-20.

        a) Translate the actor with vtkTransform's Translate() method.

        b) Rotate the actor with the RotateX(), RotateY(), and RotateZ() methods.

        c) Scale the actor with the Scale() method.

        d) Try combinations of these methods. Does the actor transform in ways that you expect?

        4.8 Visualize the following functions. (Hint: use vtkSampleFunction and refer to Figure 4.1.)

        a) F(x,y,z)=x^2

        b) F(x,y,z) = x_2 + 2 y + 3 z +1

        c) F(x,y,z) = x+2 + y^2 - \\cos (z) + 1

        "},{"location":"VTKBook/05Chapter5/","title":"Chapter 5 - Data Representation","text":"

        In Chapter 4 - The Visualization Pipeline we developed a pragmatic definition of the visualization process: mapping information into graphics primitives. We saw how this mapping proceeds through one or more steps, each step transforming data from one form, or data representation, into another. In this chapter we examine common data forms for visualization. The goal is to familiarize you with these forms, so that you can visualize your own data using the tools and techniques provided in this text.

        "},{"location":"VTKBook/05Chapter5/#51-introduction","title":"5.1 Introduction","text":"

        To design representational schemes for data we need to know something about the data we might encounter. We also need to keep in mind design goals, so that we can design efficient data structures and access methods. The next two sections address these issues.

        "},{"location":"VTKBook/05Chapter5/#characterizing-visualization-data","title":"Characterizing Visualization Data","text":"

        Since our aim is to visualize data, clearly we need to know something about the character of the data. This knowledge will help us create useful data models and powerful visualization systems. Without a clear understanding of the data, we risk designing inflexible and limited visualization systems. In the following we describe important characteristics of data. These characteristics are the discrete nature of data, whether it is regular or irregular, and its topological dimension.

        First, visualization data is discrete. This is because we use digital computers to acquire, analyze, and represent our data, and typically measure or sample information at a finite number of points. Hence, all information is necessarily represented in discrete form.

        Consider visualizing the simple continuous function y = x^2. If we are using a conventional digital computer, we must discretize this equation to operate on the data it represents (we are ignoring symbolic/analog computers and methods). For example, to plot this equation we would sample the function in some interval, say (-1,1), and then compute the value y of the function at a series of discrete points x = x_i in this interval. The resulting points ((x_0,y_0), (x_1,y_1), (x_2,y_2), ... (x_n,y_n)) connect the points with straight line segments. Thus, our (continuous) data is represented by a discrete sampling.

        Because of the discrete character of the data we do not know anything about regions in between data values. In our previous example, we know that data is generated from the function y = x^2, but, generally speaking, when we measure and even compute data, we cannot infer data values between points. This poses a serious problem, because an important visualization activity is to determine data values at arbitrary positions. For example, we might probe our data and desire data values even though the probe position does not fall on a known point.

        There is an obvious solution to this problem: interpolation. We presume a relationship between neighboring data values. Often this is a linear function, but we can use quadratic, cubic, spline, or other interpolation functions. Chapter 8 - Advanced Data Representation discusses interpolation functions in greater detail, but for now suffice it to say that interpolation functions generate data values in between known points.

        A second important characteristic of visualization data is that its structure may be regular or irregular (alternatively, structured or unstructured). Regular data has an inherent relationship between data points. For example, if we sample on an evenly spaced set of points, we do not need to store all the point coordinates, only the beginning position of the interval, the spacing between points, and the total number of points. The point positions are then known implicitly, which can be taken of advantage of to save computer memory.

        Data that is not regular is irregular data. The advantage of irregular data is that we can represent information more densely where it changes quickly and less densely where the change is not so great. Thus, irregular data allows us to create adaptive representational forms, which can be beneficial given limited computing resources.

        Characterizing data as regular or irregular allows us to make useful assumptions about the data. As we saw a moment ago, we can store regular data more compactly. Typically, we can also compute with regular data more efficiently relative to irregular data. On the other hand, irregular data gives us more freedom in representing data and can represent data that has no regular patterns.

        Finally, data has a topological dimension. In our example y = x^2, the dimension of the data is one, since we have the single independent variable x. Data is potentially of any dimension from 0D points, to 1D curves, 2D surfaces, 3D volumes, and even higher dimensional regions.

        The dimension of the data is important because it implies appropriate methods for visualization and data representation. For example, in 1D we naturally use x-y plots, bar charts, or pie charts, and store the data as a 1D list of values. For 2D data we might store the data in a matrix, and visualize it with a deformed surface plot (i.e., a height field - see Exercise 4.2).

        In this chapter and Chapter 8 - Advanced Data Representation, we show how these characteristics: discrete, regular/irregular, and data dimension, shape our model of visualization data. Keep these features in mind as you read these chapters.

        Figure 5-1. The architecture of a dataset. A dataset consists of an organizing structure, with both topological and geometric properties, and attribute data associated with the structure."},{"location":"VTKBook/05Chapter5/#design-criterion","title":"Design Criterion","text":"

        Visualizing data involves interfacing to external data, mapping into internal form, processing the data, and generating images on a computer display device. We pose the question: What form or forms should we use to represent data? Certainly many choices are available to us. The choice of representation is important because it affects the ability to interface to external data and the performance of the overall visualization system. To decide this issue we use the following design criteria:

        Compact. Visualization data tends to be large, so we need compact storage schemes to minimize computer memory requirements.

        Efficient. Data must be computationally accessible. We want to retrieve and store data in constant time (i.e., independent of data size). This requirement offers us the opportunity to develop algorithms that are linear, or O(n), in time complexity.

        Mappable. There are two types of mappings. First, data representations need to efficiently map into graphics primitives. This ensures fast, interactive display of our data. Second, we must be able to easily convert external data into internal visualization data structures. Otherwise, we suffer the burden of complex conversion processes or inflexible software

        Minimal Coverage. A single data representation cannot efficiently describe all possible data types. Nor do we want different data representations for every data type we encounter. Therefore, we need a minimal set of data representations that balances efficiency against the number of data types.

        Simple. A major lesson of applied computation is that simple designs are preferable to complex designs. Simple designs are easier to understand, and therefore, optimize. The value of simplicity cannot be overemphasized. Many of the algorithms and data representations in this text assign high priority to this design criterion.

        The remainder of this chapter describes common visualization data forms based on these design criteria. Our basic abstraction is the data object, a general term for the various concrete visualization data types which are the subclasses of data object.

        "},{"location":"VTKBook/05Chapter5/#52-the-data-object","title":"5.2 The Data Object","text":"

        The most general form of data found in VTK is the data object. A data object can be thought of as a collection of data without any form. Data objects represent the data that is processed by the visualization pipeline (see the previous chapter and Figure 4-2). Taken by themselves, data objects carry little useful information. It is only when they are organized into some structure that they provide a form that we can operate on with visualization algorithms.

        "},{"location":"VTKBook/05Chapter5/#53-the-dataset","title":"5.3 The Dataset","text":"

        Data objects with an organizing structure and associated data attributes (Figure 5-11) form datasets. The dataset is an abstract form; we leave the representation and implementation of the structure to its concrete subclasses. Most algorithms (or process objects) in VTK operate on datasets.

        The structure has two parts: topology and geometry. Topology is the set of properties invariant under certain geometric transformations [Weiler86]. Here we consider the transformations: rotation, translation, and nonuniform scaling. Geometry is the instantiation of the topology, the specification of position in 3D space. For example, saying that a polygon is a \"triangle,\" specifies topology. By providing point coordinates, we specify geometry.

        Dataset attributes are supplemental information associated with geometry and/or topology. This information might be a temperature value at a point or the inertial mass of a cell.

        Our model of a dataset assumes that the structure consists of cells and points. The cells specify the topology, while the points specify the geometry. Typical attributes include scalars, vectors, normals, texture coordinates, and tensors.

        The definition of the structure of a dataset as a collection of cells and points is a direct consequence of the discrete nature of our data. Points are located where data is known and the cells allow us to interpolate between points. We give detailed descriptions of dataset structure and attributes in the following sections.

        "},{"location":"VTKBook/05Chapter5/#54-cell-types","title":"5.4 Cell Types","text":"

        A dataset consists of one or more cells (Figure 5-2 and Figure 5-4). Cells are the fundamental building blocks of visualization systems. Cells are defined by specifying a type in combination with an ordered list of points. The ordered list, often referred to as the connectivity list, combined with the type specification, implicitly defines the topology of the cell. The x-y-z point coordinates define the cell geometry.

        Figure 5-3 shows one cell type, a hexahedron. The ordered list is a sequence of point ids that index into a point coordinate list. The topology of this cell is implicitly known: we know that (8,10) is one of the 12 edges of the hexahedron, and that (8,10,22,21) is one of its six faces.

        Mathematically, we represent a cell by the symbol C_i. Then the cell is an ordered set of points C_1 = {p_1, p_2,..., p_n} with p_i \\in P is a set of n-dimensional points (here n=3). The number of points n using the cell is the size of the cell. U(p_i) is the collection of all cells using p_i:

        U(p_i) = {C_i:p_i \\in C_i} Figure 5-2. Linear cell types found in VTK. Numbers define ordering of the defining points. Figure 5-3. Example of a hexahedron cell. The topology is implicitly defined by the ordering of the point list. Physical generation of an image.

        The importance of \"uses\" and \"use sets\" will become evident in Chapter 8 - Advanced Data Representation when we explore the topology of datasets.

        Although we define points in three dimensions, cells may vary in topological dimension. Vertices, lines, triangles, and tetrahedron are examples of topologically 0, 1, 2, and 3-D cells, respectively, embedded in three-dimensional geometric space. Cells can also be primary or composite. Composite cells consist of one or more primary cells, while primary cells cannot be decomposed into combinations of other primary cell types. A triangle strip, for example, consists of one or more triangles arranged in compact form. The triangle strip is a composite cell because it can be broken down into triangles, which are primary cells.

        Certainly there are an infinite variety of possible cell types. In the Visualization Toolkit each cell type has been chosen based on application need. We have seen how some cell types: vertex, line, polygon, and triangle strip (Figure 3-19) are used to represent geometry to the graphics subsystem or library. Other cell types such as the tetrahedron and hexahedron are common in numerical simulation. The utility of each cell type will become evident through the practice of visualization throughout this book. A description of the cell types found in the Visualization Toolkit-including their classification as linear, nonlinear, or other-is given in the following sections.

        "},{"location":"VTKBook/05Chapter5/#linear-cells","title":"Linear Cells","text":"

        Linear cells are characterized by linear or constant interpolation functions (see \"Interpolation Functions\" in Chapter 8 for more information). As a result, cells of dimension one or greater are characterized by straight edges. Thus any edge may be characterized by two vertex id's (v_1,v_2). The following are the linear cells currently found in VTK.

        Vertex. The vertex is a primary zero-dimensional cell. It is defined by a single point.

        Polyvertex. The polyvertex is a composite zero-dimensional cell. The polyvertex is defined by an arbitrarily ordered list of points.

        Line. The line is a primary one-dimensional cell. It is defined by two points. The direction along the line is from the first point to the second point.

        Polyline. The polyline is a composite one-dimensional cell consisting of one or more connected lines. The polyline is defined by an ordered list of n+1 points, where n is the number of lines in the polyline. Each pair of points (i, i+1) defines a line.

        Triangle. The triangle is a primary two-dimensional cell. The triangle is defined by a counterclockwise ordered list of three points. The order of the points specifies the direction of the surface normal using the right-hand rule.

        Triangle Strip. The triangle strip is a composite two-dimensional cell consisting of one or more triangles. The points defining the triangle strip need not lie in a plane. The triangle strip is defined by an ordered list of n+2 points, where n is the number of triangles. The ordering of the points is such that each set of three points (i,i+1,i+2) with 0 \\leq i \\leq n defines a triangle.

        Quadrilateral. The quadrilateral is a primary two-dimensional cell. It is defined by an ordered list of four points lying in a plane. The quadrilateral is convex and its edges must not intersect. The points are ordered counterclockwise around the quadrilateral, defining a surface normal using the right-hand rule.

        Pixel. The pixel is a primary two-dimensional cell defined by an ordered list of four points. The cell is topologically equivalent to the quadrilateral with the addition of geometric constraints. Each edge of the pixel is perpendicular to its adjacent edges, and lies parallel to one of the coordinate axes x-y-z. Hence, the normal to the pixel is also parallel to one of the coordinate axes.

        The ordering of the points defining the pixel is different from the quadrilateral cell. The points are ordered in the direction of increasing axis coordinate, starting with x, then y, then z. The pixel is a special case of the quadrilateral and is used to improve computational performance.

        One important note is that the definition of the pixel cell given here is different from the usual definition for a pixel. Normally pixels are thought of as constant-valued \"picture-elements\" in an image (see [\"Graphics Hardware\"]/VTKBook/03Chapter3/#39-graphics-hardware) in Chapter 3). The definition given here implies that four picture elements form the four corner points of the pixel cell. We normally use the term pixel to describe a pixel cell, but the meaning of the term will vary depending on context.

        Polygon. The polygon is a primary two-dimensional cell. The polygon is defined by an ordered list of three or more points lying in a plane. The polygon normal is implicitly defined by a counterclockwise ordering of its points using the right-hand rule.

        The polygon may be non-convex, but may not have internal loops, and it cannot self-intersect. The polygon has n edges, where n is the number of points in the polygon.

        Tetrahedron. The tetrahedron is a primary three-dimensional cell. The tetrahedron is defined by a list of four non-planar points. The tetrahedron has six edges and four triangular faces as shown in Figure 5-2.

        Hexahedron. The hexahedron is a primary three-dimensional cell consisting of six quadrilateral faces, twelve edges, and eight vertices. The hexahedron is defined by an ordered list of eight points as shown in Figure 5-2. The faces and edges must not intersect any other faces and edges, and the hexahedron must be convex.

        Voxel. The voxel is a primary three-dimensional cell. The voxel is topologically equivalent to the hexahedron with additional geometric constraints. Each face of the voxel is perpendicular to one of the coordinate x-y-z axes. The defining point list is ordered in the direction of increasing coordinate value as shown in Figure 5-2. The voxel is a special case of the hexahedron and is used to improve computational performance.

        Similar to pixels, our definition of a voxel cell differs from the conventional definition of the term voxel. Typically, a voxel is referred to as a constant-valued \"volume element\". Using our definition, eight volume elements form the eight corner points of the voxel cell. We normally use the term voxel to describe a voxel cell, but the meaning of the term will vary depending on the context.

        Wedge. The wedge is a primary three-dimensional cell consisting of three quadrilateral faces, two triangular faces, nine edges, and six vertices. The wedge is defined by an ordered list of six points as shown in Figure 5-2. The faces and edges must not intersect any other faces and edges, and the wedge must be convex.

        Pyramid. The pyramid is a primary three-dimensional cell consisting of one quadrilateral face, four triangular faces, eight edges, and five vertices. The pyramid is defined by an ordered list of five points as shown in Figure 5-2. The four points defining the quadrilateral base plane must be convex; the fifth apex point must not be co-planar with the base points.

        Pentagonal Prism. The pentagonal prism is a primary three-dimensional cell consisting of five quadrilateral faces, two pentagonal faces, fifteen edges, and ten vertices. The pentagonal prism is defined by an ordered list of ten points as shown in Figure 5-2. The faces and edges must not intersect any other faces and edges and the pentagon must be convex.

        Hexagonal Prism. The hexagonal prism is a primary three-dimensional cell consisting of six quadrilateral faces, two hexagonal faces, eighteen edges, and twelve vertices. The hexagonal prism is defined by an ordered list of twelve points as shown in Figure 5-2. The faces and edges must not intersect any other faces and edges and the hexagon must be convex."},{"location":"VTKBook/05Chapter5/#nonlinear-types","title":"NonLinear Types","text":"

        It is common in numerical analysis to use nonlinear cells, i.e., cell formulations that use nonlinear basis functions. These basis functions are generally formed by combinations of polynomials. Nonlinear cells provide more accurate interpolation functions (see \"Interpolation Functions\" in Chapter 8 for more information) and better approximate curved geometry. However, the number of possible nonlinear basis functions is unlimited, which poses a combinatorial problem to any visualization system (i.e., it is not possible to implement all non-linear cell types). To address this problem, VTK takes a dual approach. First, VTK directly supports nonlinear cell types with quadratic interpolation functions(see Figure 5-4). Such cells are constructed by adding mid-edge nodes, and occasionally mid-face and interior nodes, requiring extending the connectivity list to reflect the addition of these extra entries. Second, VTK has a sophisticated cell adaptor framework, enabling users to interface any basis function to VTK as long as the basis function can be uniquely characterized in an r-s-t parametric coordinates system. (Note: we will describe the cell adaptor framework in more detail in Chapter 8 - Advanced Data Representation.) Figure 5-4. Nonlinear cell types found in VTK.

        One significant difference between linear and nonlinear cells is the way they are rendered and operated on by various visualization algorithms. Linear cells are readily converted to linear graphics primitives, which are then processed by the graphics library. Nonlinear cells, on the other hand, do not often have direct support in graphics libraries. (One exception are the family of non-uniform rational B-splines or NURBS. And even these are generally tessellated by the graphics library into linear primitives.) Therefore, nonlinear cells must be treated specially by the visualization system. Some possibilities include:

        1. Tessellating nonlinear cells into linear cells and then operating on the linear cells.

        2. Develop custom rendering and visualization algorithms to operate directly on nonlinear cells.

        3. Program custom rendering operations in the graphics library. These issues are active topics in visualization research [Schroeder05]. In VTK, tessellation methods are currently employed since once tessellated, a cell can be processed by existing linear algorithms. The difficulty with solutions 2) and 3) above is that the effort to create new rendering and visualization algorithms is significant, possibly requiring different solutions for each type of nonlinear cell. Furthermore, it is likely that the performance found in dedicated rendering hardware (e.g., processing linear cells) would far outstrip any software rendering solution for higher order cells. The difficulty with 1) above is that the tessellation must be performed carefully or unacceptable error can be introduced into visualization. Or, if the cell is over-tessellated, an excessive number of linear primitives will result. Future research points to developing adaptive methods that tessellate on a selected error metric (please see Chapter 8 - Advanced Data Representation for more information).

        VTK tessellates nonlinear quadratic cells using a fixed subdivision as shown in Figure 5-5. This generally works well for quadratic cells due to the lower order of interpolation, and the few number of points defining the cell.

        Quadratic Edge. The quadratic edge is a primary one-dimensional cell. It is defined by three points. The first two points define the endpoints of the edge; the third point is located in the center of the edge as shown in Figure 5-4. The direction along the line is from the first point to the second point.

        Quadratic Triangle. The quadratic triangle is a primary two-dimensional cell. It is defined by six points. The first three points are located at the vertices of the triangle; the next three are located in the middle of each of the three edges as shown in Figure 5-4.

        Quadratic Linear Quadrilateral. The quadratic linear quadrilateral is a primary two-dimensional cell. It is defined by six points. The first four points are located at the vertices of the quadrilateral; the next two are located in the middle of each of the first and third edge as shown in Figure 5-4. Figure 5-5. Decomposing quadratic nonlinear cells into linear cells. The quadratic tetrahedron is tessellated into six linear tetrahedron; the quadratic hexahedron is tessellated into eight linear hexahedra. Note that some tessellations require the addition of new points. In VTK, a cell adaptor framework is available for tessellating cells with basis functions of arbitrary complexity, see [Chapter 8 - Advanced Data Representation](../08Chapter8) for more information.

        Quadratic Quadrilateral. The quadratic quadrilateral is a primary two-dimensional cell. It is defined by eight points. The first four points are located at the vertices of the quadrilateral; the next four are located in the middle of each of the four edges as shown in Figure 5-4.

        Bi-Quadratic Quadrilateral. The bi-quadratic quadrilateral is a primary two-dimensional cell. It is defined by nine points. The first four points are located at the vertices of the quadrilateral; the next four are located in the middle of each of the four edges; and the last one is located at the center of the quadrilateral as shown in Figure 5-4.

        Quadratic Tetrahedron. The quadratic tetrahedron is a primary three-dimensional cell. It is defined by ten points. The first four points are located at the vertices of the tetrahedron; the next six are located in the middle of each of the six edges as shown in Figure 5-4.

        Quadratic Pyramid. The quadratic pyramid is a primary three-dimensional cell. It is defined by thirteen points. The first five points are located at the vertices of the pyramid; the next eight are located in the middle of each of the eight edges as shown in Figure 5-4.

        Quadratic Linear Wedge. The quadratic linear wedge is a primary three-dimensional cell. It is defined by twelve points. The first six points are located at the vertices of the wedge; the next six are located in the middle of each of the six edges that belong to a triangle face as shown in Figure 5-4.

        Quadratic Wedge. The quadratic wedge is a primary three-dimensional cell. It is defined by fifteen points. The first six points are located at the vertices of the wedge; the next nine are located in the middle of each of the nine edges as shown in Figure 5-4.

        Bi-Quadratic Wedge. The bi-quadratic wedge is a primary three-dimensional cell. It is defined by eighteen points. The first six points are located at the vertices of the wedge; the next nine are located in the middle of each of the nine edges; and the next three are located in the center of each quadrilateral faces as shown in Figure 5-4.

        Quadratic Hexahedron. The quadratic hexahedron is a primary three-dimensional cell. It is defined by twenty points. The first eight points are located at the vertices of the hexahedron; the next twelve are located in the middle of each of the twelve edges as shown in Figure 5-4.

        Bi-Quadratic Hexahedron. The bi-quadratic hexahedron is a primary three-dimensional cell. It is defined by twenty-four points. The first eight points are located at the vertices of the hexahedron; the next twelve are located in the middle of each of the twelve edges; and the next four points are located in the center of the first four faces as shown in Figure 5-4.

        Tri-Quadratic Hexahedron. The tri-quadratic hexahedron is a primary three-dimensional cell. It is defined by twenty-seven points. The first eight points are located at the vertices of the hexahedron; the next twelve are located in the middle of each of the twelves edges; the next six are located in the center of each faces; and the last one is located in the center of the hexahedron as shown in Figure 5-4."},{"location":"VTKBook/05Chapter5/#55-attribute-data","title":"5.5 Attribute Data","text":"

        Attribute data is information associated with the structure of the dataset. This structure includes both the dataset geometry and topology. Most often, attribute data is associated with dataset points or cells, but sometimes attribute data may be assigned to cell components such as edges or faces. Attribute data may also be assigned across the entire dataset, or across a group of cells or points. We refer to this information as attribute data because it is an attribute to the structure of the dataset. Typical examples include temperature or velocity at a point, mass of a cell, or heat flux into and out of a cell face.

        Figure 5-6. Attribute data.

        Attribute data is often categorized into specific types of data. These categories have been created in response to common data forms. Visualization algorithms are also categorized according to the type of data they operate on.

        Single-valued functions, such as temperature or pressure, are examples of scalar data, which is one attribute type. More generally, attribute data can be treated as n-dimensional data arrays. For example, the single-valued function temperature can be treated as a 1 x 1 array, while velocity can be treated as a 3 x 1 array of components in the x, y, and z directions. This abstract model for data attribute can be extended throughout the visualization system. Some systems extend this model to include the structure of the data. For example, a 3D image dataset (i.e., a volume) can be represented as a 3D array of l x m x n data values. Unstructured data can be represented as a 3D vector of position, plus an array of connectivity. We refer to this general approach as the hyperdata model for visualization data (see [\"Other Data Abstractions\"]VTKBook/05Chapter5/#57-other-data-abstractions)).

        In the following sections we describe data attributes using the simpler type-specific model (Figure 5-6). We also limit ourselves to three-dimensional structure, since the dataset structure and graphics are assumed to be three-dimensional."},{"location":"VTKBook/05Chapter5/#scalars","title":"Scalars","text":"

        Scalar data is data that is single valued at each location in a dataset. Examples of scalar data are temperature, pressure, density, elevation, and stock price. Scalar data is the simplest and most common form of visualization data.

        "},{"location":"VTKBook/05Chapter5/#vectors","title":"Vectors","text":"

        Vector data is data with a magnitude and direction. In three dimensions this is represented as a triplet of values (u, v, w). Examples of vector data include flow velocity, particle trajectory, wind motion, and gradient function.

        "},{"location":"VTKBook/05Chapter5/#normals","title":"Normals","text":"

        Normals are direction vectors: that is, they are vectors of magnitude |n|=1. Normals are often used by the graphics system to control the shading of objects. Normals also may be used by some algorithms to control the orientation or generation of cell primitives, such as creating ribbons from oriented lines.

        "},{"location":"VTKBook/05Chapter5/#texture-coordinates","title":"Texture Coordinates","text":"

        Texture coordinates are used to map a point from Cartesian space into a 1-, 2-, or 3-dimensional texture space. The texture space is usually referred to as a texture map. Texture maps are regular arrays of color, intensity, and/or transparency values that provide extra detail to rendered objects.

        One application of texturing in two dimensions is to \"paste\" a photograph onto one or more polygons, yielding a detailed image without a large number of graphics primitives. (Texture mapping is covered in more detail in Chapter 7 - Advanced Computer Graphics.)

        "},{"location":"VTKBook/05Chapter5/#tensors","title":"Tensors","text":"

        Tensors are complex mathematical generalizations of vectors and matrices. A tensor of rank k can be considered a k-dimensional table. A tensor of rank 0 is a scalar, rank 1 is a vector, rank 2 is a matrix, and a tensor of rank 3 is a three-dimensional rectangular array. Tensors of higher rank are k-dimensional rectangular arrays.

        General tensor visualization is an area of current research. Efforts thus far have been focused on two-dimensional, rank 2 tensors, which are 3 x 3 matrices. The most common form of such tensors are the stress and strain tensors, which represent the stress and strain at a point in an object under load. VTK only treats real-valued, symmetric 3 x 3 tensors.

        "},{"location":"VTKBook/05Chapter5/#56-types-of-datasets","title":"5.6 Types of Datasets","text":"

        A dataset consists of an organizing structure plus associated attribute data. The structure has both topological and geometric properties and is composed of one or more points and cells. The type of a dataset is derived from the organizing structure, and specifies the relationship that the cells and points have with one another. Common dataset types are shown in Figure 5-7. A dataset is characterized according to whether its structure is regular or irregular. A dataset is regular if there is a single mathematical relationship within the composing points and cells. If the points are regular, then the geometry of the dataset is regular. If the topological relationship of cells is regular, then the topology of the dataset is regular. Regular (or structured) data can be implicitly represented, at great savings in memory and computation. Irregular (or unstructured) data must be explicitly represented, since there is no inherent pattern that can be compactly described. Unstructured data tends to be more general, but requires greater memory and computational resources."},{"location":"VTKBook/05Chapter5/#polygonal-data","title":"Polygonal Data","text":"

        We have already seen how graphics libraries are designed to render such geometric primitives as lines and polygons. These primitives also are frequently generated or consumed by computational geometry and visualization algorithms. In the Visualization Toolkit, we call this collection of graphics primitives polygonal data. The polygonal dataset consists of vertices, polyvertices, lines, polylines, polygons, and triangle strips. The topology and geometry of polygonal data is unstructured, and the cells that compose that dataset vary in topological dimension. The polygonal dataset forms a bridge between data, algorithms, and high-speed computer graphics.

        Vertices, lines, and polygons form a minimal set of primitives to represent 0-, 1-, and 2-dimensional geometry. We have included polyvertex, polyline, and triangle strip cells for convenience, compactness, and performance. Triangle strips in particular are high-performing primitives. To represent n triangles with a triangle strip requires just n+2 points, compared to the 3n points for conventional representations. In addition, many graphics libraries can render triangle strips at higher speeds than triangle polygons.

        Figure 5-7. Dataset types. The unstructured grid consists of all cell types.

        Our minimal selection of cells is based on common application and performance, representing a subset of the cells available in some graphics libraries. Other types include quadrilateral meshes, Bezier curves and surfaces, and other spline types such as NURBS (Non-Uniform Rational B-Splines) [Mortenson85]. Spline surfaces are generally used to accurately model and visualize geometry. Few visualization algorithms (other than geometry visualization) have been developed that require spline surfaces.

        "},{"location":"VTKBook/05Chapter5/#image-data","title":"Image Data","text":"

        An image dataset is a collection of points and cells arranged on a regular, rectangular lattice. The rows, columns, and planes of the lattice are parallel to the global x-y-z coordinate system. If the points and cells are arranged on a plane (i.e., two-dimensional) the dataset is referred to as a pixmap, bitmap, or image. If the points and cells are arranged as stacked planes (i.e., three-dimensional) the dataset is referred to as a volume. Keep in mind that the term image data refers to images, volumes, or one-dimensional point arrays collectively. Note that some authors have referred to image data as uniform grids and structured points. (Structured points was the terminology used in earlier versions of VTK.)

        Image data consist of line elements (1D), pixels (2D), or voxels (3D). Image data is regular in both geometry and topology and can be implicitly represented. The representational scheme requires only data dimensions, an origin point, and the data spacing. The dimension of the data is a 3-vector (n_x,n_y,n_z)), specifying the number of points in the x, y, and z directions. The origin point is the position in three-dimensional space of the minimum x-y-z point. Each pixel (2D) or voxel (3D) in a image dataset is identical in shape, the spacing specifying the length in the x-y-z directions.

        The regular nature of the topology and geometry of the image dataset suggests a natural i-j-k coordinate system. The number of points in the dataset is n_x \\times n_y \\times n_z while the number of cells is (n_x - 1) \\times (n_y - 1) \\times (n_z - 1). A particular point or cell can be selected by specifying the three indices i-j-k. Similarly, a line is defined by specifying two out of three indices, and a plane by specifying a single index.

        The simplicity and compactness of representation are desirable features of image data. It is an efficient structure to traverse and compute with. For this reason image data is rivaled only by polygonal data as the most common form of visualization dataset. The major disadvantage with image data is the so-called \"curse of dimensionality.\" To obtain greater data resolution we must increase the dimensions of the dataset. Increasing the dimensions of an image results in an O(n2) increase in memory requirement, while volumes require an O(n3) increase. Therefore, to resolve a small feature using image data may require more disk space or computer memory than is available.

        Image datasets are often used in imaging and computer graphics. Volumes are frequently generated from medical imaging technologies such as Computed Tomography (CT) and Magnetic Resonance Imaging (MRI). Sometimes volumes are used to sample mathematical functions or numerical solutions.

        "},{"location":"VTKBook/05Chapter5/#rectilinear-grid","title":"Rectilinear Grid","text":"

        The rectilinear grid dataset is a collection of points and cells arranged on a regular lattice. The rows, columns, and planes of the lattice are parallel to the global x-y-z coordinate system. While the topology of the dataset is regular, the geometry is only partially regular. That is, the points are aligned along the coordinate axis, but the spacing between points may vary.

        Like the image dataset, rectilinear grids consist of pixels (2D) or voxels (3D). The topology is represented implicitly by specifying grid dimensions. The geometry is represented by maintaining a list of separate x, y, and z coordinates. To obtain the coordinates of a particular point, values from each of the three lists must be appropriately combined.

        "},{"location":"VTKBook/05Chapter5/#structured-grid","title":"Structured Grid","text":"

        A structured grid is a dataset with regular topology and irregular geometry. The grid may be warped into any configuration in which the cells do not overlap or self-intersect.

        The topology of the structured grid is represented implicitly by specifying a 3-vector of dimensions (n_x, n_y, n_z). The geometry is explicitly represented by maintaining an array of point coordinates. The composing cells of a structured grid are quadrilaterals (2D) or hexahedron (3D). Like image data, the structured grid has a natural coordinate system that allows us to refer to a particular point or cell using topological i-j-k coordinates.

        Structured grids are commonly found in finite difference analysis. Finite difference is a numerical analysis technique to approximate the solution to partial differential equations. Typical applications include fluid flow, heat transfer, and combustion.

        "},{"location":"VTKBook/05Chapter5/#unstructured-points","title":"Unstructured Points","text":"

        Unstructured points are points irregularly located in space. There is no topology in an unstructured point dataset, and the geometry is completely unstructured. The vertex and polyvertex cells are used to represent unstructured points.

        Unstructured points are a simple but important type of dataset. Often data has no inherent structure, and part of the visualization task is to discover or create it. For example, consider a piston in a car instrumented with temperature gauges. The number of gauges and their location is chosen at a finite set of points, resulting in temperature values at \"unrelated\" (at least in terms of visualization topology) positions on the surface of the piston. To visualize the surface temperature, we have to create an interpolation surface and scheme to fill in intermediate values.

        Unstructured points serve to represent such unstructured data. Typically, this data form is transformed into another more structured form for the purposes of visualization. Algorithms for transforming unstructured points into other forms are described in \"Visualizing Unstructured Points\" in Chapter 9.

        "},{"location":"VTKBook/05Chapter5/#unstructured-grid","title":"Unstructured Grid","text":"

        The most general form of dataset is the unstructured grid. Both the topology and geometry are completely unstructured. Any cell type can be combined in arbitrary combinations in an unstructured grid. Hence the topology of the cells ranges from 0D (vertex, polyvertex) to 3D (tetrahedron, hexahedron, voxel). In the Visualization Toolkit any dataset type can be expressed as an unstructured grid. We typically use unstructured grids to represent data only when absolutely necessary, because this dataset type requires the most memory and computational resources to represent and operate on.

        "},{"location":"VTKBook/05Chapter5/#57-other-data-abstractions","title":"5.7 Other Data Abstractions","text":"

        Other data models have been proposed besides the dataset model presented here. We briefly examine two other models that have been applied successfully. These are the AVS field model and the model of Haber, Lucas, and Collins, adapted in modified form by the commercial IBM Data Explorer system. The section concludes with a brief comparison between these two models and VTK's data model.

        "},{"location":"VTKBook/05Chapter5/#the-application-visualization-systems","title":"The Application Visualization Systems","text":"

        AVS (the Application Visualization System) was the first large-scale, commercial visualization system [AVS89]. Much of the early growth, visibility, and successful application of visualization technology was achieved because of the direct application of AVS or the influence of AVS on other researchers. AVS is a data-flow visualization system with a crisp user interface to create, edit, and manipulate visualization networks. Using an explicit executive to control execution of networks, AVS can run distributed and parallel visualization applications. Since the AVS architecture is open, researchers and developers can and have donated filters for use by others.

        The AVS data model consists of primitive data and aggregate data. Primitive data are fundamental representations of data such as byte, integer, real, and string. Aggregate types are complex organizations of primitive types and include fields, colormaps, geometries, and pixel maps. Fields can be considered AVS' fundamental data type, and will be described in detail shortly. Colormaps are used to map functional values (i.e., scalar values) into color and transparency values. Geometries consist of graphics primitives such as points, lines, and polygons, and are used by the geometric renderer to display objects. A pixel map is the rendered image, or output, of a visualization.

        The field is the most interesting part of the AVS data model. In general, it is an n-dimensional array with scalar or vector data at each point. A scalar is a single value, while a vector is two or more values (not necessarily three). The field array can have any number of dimensions, and the dimensions can be of any size. There is no implicit structure to the field, instead, a mapping function is defined. That is, either an implicit or explicit relationship from data elements to coordinate points is specified. Thus a field is a mapping between two kinds of space: the computational space of the field data and the coordinate space, which is typically the global coordinate system. AVS supports three types of mappings: uniform (i.e., structured), rectilinear, and irregular (i.e., unstructured).

        "},{"location":"VTKBook/05Chapter5/#the-data-explorer","title":"The Data Explorer","text":"

        The data model of Haber, Lucas, and Collins [Haber91] is based on the mathematics of fiber bundles. The goal of their work is to create a general model for piecewise representations of fields on regular and irregular grids. They refer to their model as the field data model, but their definition of the word field is different from the AVS model. A field is an object composed of a base and dependent data. Informally, the base is a manifold whose coordinates are the independent variables for the field, and the dependent data relate the values of dependent variables to the independent variables of the base. Visualization data consists of field elements that describe the base and dependent variables over a local region.

        "},{"location":"VTKBook/05Chapter5/#the-visualization-toolkit","title":"The Visualization Toolkit","text":"

        There are similarities and differences between these data models and VTK's dataset model. The greatest difference is that these other models are more abstract. They are capable of representing a wider range of data and are more flexible. In particular, the AVS field model is capable of representing arbitrary streams of numbers in a simple and elegant manner. The field data model of Haber et al. is also powerful: The authors show how this data representation can be used to exploit regularity in data to obtain compact representations. On the other hand, all these models (including VTK's) share the notion of structure versus data. The AVS field model introduces structure by using a mapping function. The field data of the Haber et al. model resembles VTK's dataset model, in that the base is equivalent to VTK's cells, and the field data model's dependent data is analogous to VTK's attribute data.

        The difference in abstraction level raises important issues in the design of visualization systems. In the following discussion we refer to data models as abstract or concrete, where the relative level of abstraction is lower in concrete models. Abstract and concrete classes compare as follows:

        • Abstract models are more flexible and capable of representing a wider range of data forms than concrete models.

        • Abstract models lend themselves to compact computer code.

        • Concrete models are easier to describe, interface, and implement than abstract models.

        • The level of abstraction influences the computer code and/or database interface to the data model. Abstract models result in abstract code and data representations; concrete models result in concrete code and data representations.

        • The complexity of abstract models can be hidden by creating simpler, application-specific interfaces. However, this requires extra effort. Concrete models, on the other hand, cannot be made more abstract by modifying interfaces.

        The design of computer systems demands careful attention to the balance between abstract and concrete systems. Visualization systems, in particular, must be carefully designed because they interface to other systems and data models. Models that are too abstract can result in confusing computer code and interfaces, and can be misused because of user misunderstanding. On the other hand, concrete models are limited in flexibility and capability, but tend to be easier to learn and apply.

        In the design of the Visualization Toolkit, we chose to use a more concrete data model relative to the AVS and field data models. Our decision was based on the premise that the system was to be informative as well as functional, and we wanted to clearly demonstrate basic concepts. On the other hand, VTK's data model is general enough to support our practice of visualization. Our experience with users also has shown us that VTK's data model is easier for the casual visualization user to understand than the more abstract models. If you decide to design your own system, we recommend that you examine other data models. However, we feel that the clarity of code manifested in the Visualization Toolkit is an example of a well-balanced trade-off between design abstraction and simplicity.

        Figure 5-8. Implementation of contiguous array. This example is a fragment of the class definition vtkFloatArray."},{"location":"VTKBook/05Chapter5/#58-putting-it-all-together","title":"5.8 Putting It All Together","text":"

        In this section we will describe the implementation details of the dataset types covered previously. We will also show you how to create these datasets through a variety of C++ examples.

        "},{"location":"VTKBook/05Chapter5/#memory-allocation-and-data-arrays","title":"Memory Allocation and Data Arrays","text":"

        Because of the size and scope of data, memory must be carefully managed to create efficient visualization systems. In the Visualization Toolkit, we use contiguous data arrays as the basis for most data structures. Contiguous arrays can be created, deleted, and traversed faster than alternative data structures, such as linked lists or arrays of pointers to structures. In VTK, we refer to these as data arrays, and represent them with the class vtkDataArray.

        Contiguous arrays also can be easily transmitted across a network, particularly if the information in the array is independent of computer memory address. Memory independence avoids the overhead of mapping information from one memory location to another. Therefore, in VTK we access information based on an \"id\", an integer index into an array-like object. Data arrays are 0offset just like C++ arrays. That is, given n data values, we successively access these values using the ids (0, 1, 2, ..., n - 1).

        An important design decision was to not represent data using arrays of objects (e.g., a separate class for cells and/or points). Our experience has shown that such designs severely impact performance due to the cost of construction and deletion. Instead, we focus on designing classes at a higher level of abstraction. From the perspective of performance, the object-oriented approach serves best at the application level, not at the level of implementation.

        The class vtkFloatArray is an example of a contiguous array. We will use this class to describe how contiguous arrays are implemented in VTK. As shown in Figure 5-8, the instance variable Array is a pointer to memory of type float. The allocated length of the array is given by Size. The array is dynamic, so an attempt to insert data beyond the allocated size automatically generates a Resize() operation. When resized, the array approximately doubles in size each time. The MaxId field is an integer offset defining the end of inserted data. If no data has been inserted, then MaxId is equal to -1. Otherwise, MaxId is an integer value where 0 \\leq MaxId < Size."},{"location":"VTKBook/05Chapter5/#the-tuple-abstraction","title":"The Tuple Abstraction","text":"

        Many visualization data are defined by multiple component values. An x-y-z coordinate triplet or RGBA color pixel value are two such examples. To represent such data in a contiguous data array, the tuple data abstraction is introduced. As Figure 5-8 illustrates, the contiguous array is grouped into smaller subarrays with NumberOfComponents components. These subarrays are called tuples, and for a given array the tuple size, or NumberOfComponents, is constant for all tuples as shown in Figure 5-9."},{"location":"VTKBook/05Chapter5/#representing-data-with-data-arrays","title":"Representing Data With Data Arrays","text":"

        Attribute data and points, as well as several other data objects, are represented with data arrays in VTK. Certain attribute data, such as points, vectors, normals, and tensors, are required to have a tuple size consistent with their definition. For example, points, vectors and normals require a data array with a tuple size of three; tensors a tuple size of nine (i.e., a 3 x 3 matrix). Scalars do not place any requirement on the tuple size. Algorithms that process such scalar data generally operate on the first component of each tuple. (Filters exist in VTK to split multi-component data arrays into separate arrays, and to combine separate data arrays into a single array. See vtkSplitField and vtkMergeFields.)

        Figure 5-9. Data array structure. In this example, each tuple has 3 components."},{"location":"VTKBook/05Chapter5/#abstractconcrete-data-array-objects","title":"Abstract/Concrete Data Array Objects","text":"

        Visualization data comes in many forms-floating point, integer, byte, and double precision-to name just a few simple types. More complex types such as character strings or multidimensional identifiers also are possible. Given this variety of types, how do we represent and manipulate such data using data arrays? The answer is to provide run-time solutions via abstract data objects, and compile-time solutions using templated C++ code.

        Abstract data objects are objects that provide uniform methods to create, manipulate, and delete data using dynamic binding. In C++ we use the virtual keyword to declare methods as dynamically bound. Dynamic binding allows us to execute a method belonging to a concrete object by manipulating that object's abstract superclass (see Figure 5-10).

        Consider the abstract class vtkDataArray. We can access the data value at associated point id 129 by executing the method double s = GetTuple1(129). Since the virtual GetTuple1() method returns a floating-point data value, each subclass of vtkDataArray must also return a floating-point value. Although the subclass is free to represent data in any possible form, it must transform its data representation into a floating-point value. This process may be as simple as a cast from a built-in type to floating-point value, or it may be a complex mapping of data. For example, if our data consists of character strings, we could conceivably create an alphabetical list and map the string into a location in the list, and then cast the location into a double value.

        Figure 5-10. Data array object diagram. vtkDataArray is an abstract base class. Subclasses of vtkDataArray implement type specific representation and operations. Note: not all concrete data array subclasses are shown in this diagram.

        While this run-time oriented interface is convenient for writing general algorithms that do not depend on a particular data type, the conversion of native representation to double type is problematic. First, the conversion operation can affect performance adversely, since the data access methods are called frequently, virtual functions are slower than in-line or non-virtual invocations, and the cast operator is slow in many cases. Second, a complex type such as double loses precision during conversion to double. To remedy these problems, it is possible to access data in its native form and process it accordingly. In this approach C++ templates are used.

        To use templates it is necessary to obtain raw, typed pointers to data, and to know the type of data. vtkDataArray and its associated subclasses provides this functionality. With this information it is possible to switch on the type of data into a function templated over that type. A typical code fragment using this functionality is found in most imaging filters, almost all of which are templated as follows:

        switch (outData->GetScalarType())\n  {\n  case VTK_CHAR:\n  { typedef char VTK_TT;\n    func(arg1, arg2, arg3, VTK_TT* arg4, VTK_TT* arg5); }\n    break;\n  case VTK_UNSIGNED_CHAR:\n  { typedef unsigned char VTK_TT;\n    func(arg1, arg2, arg3, VTK_TT* arg4, VTK_TT* arg5); }\n    break;\n\n    ...for all types.....\n
        Figure 5-11. Data object representation as field data. A field can be represented as an array of arrays. Each array has a specified type, length, tuple size, and name. The association of a data array with points or cells, and its labeling as a particular attribute type, forms point and cell attribute data.

        In practice this code is simplified using macros, and the static_cast<> C++ operator is used to perform the cast. Note that the function func is a templated function. The compiler will instantiate the function for the appropriate type. In most cases all native types are represented in the switch statement, so func is expanded accordingly.

        Using compile-time oriented methods such as templates avoids the need to cast each data access into a particular type (e.g., double). While it does complicate the code somewhat and result in larger object code, it is generally faster than run-time virtual methods. This approach becomes problematic as the number of types increases. For example, some filters such as vtkImageShiftScale use doubly nested templates to resolve the potential difference in input and output types. The code is more complex and much larger than the generic run-time approach.

        "},{"location":"VTKBook/05Chapter5/#data-object-representation","title":"Data Object Representation","text":"

        Data objects are implemented in VTK as an array of vtkDataArrays as shown in Figure 5-11. vtkDataObject is an general representation of visualization data. It serves to encapsulate instance variables and methods for visualization network execution (see previous chapter), as well as representing data. Internally, data is represented with an instance of the class vtkFieldData. Very few algorithms directly operate on data objects; rather most algorithms require the specification of an organizing structure in order to process the data. The dataset specifies that organizing structure as described in the following section."},{"location":"VTKBook/05Chapter5/#dataset-representation","title":"Dataset Representation","text":"

        Five datasets are implemented in VTK: vtkPolyData, vtkImageData, vtkStructuredGrid, vtkRectilinearGrid, and vtkUnstructuredGrid. The unstructured points dataset is not implemented, but can be represented using either vtkPolyData or vtkUnstructuredGrid.

        We use a different internal data representation for each dataset type. By using different representations we minimize data structure memory requirements and implement efficient access methods. It would have been possible to use vtkUnstructuredGrid to represent all dataset types, but the memory and computational overhead are unacceptable for large data. The following sections describe how we represent the dataset.

        vtkImageData. The simplest and most compact representation is vtkImageData. Both the dataset points and cells are represented implicitly by specifying the dimensions, data spacing, and origin. The dimensions define the topology of the dataset, while the origin and spacing specify the geometry. The vtkImageData dataset type can represent 1D line samples, 2D images, and 3D volumes. (Note: in earlier versions of VTK, vtkImageData was known as vtkStructuredPoints. There are still remnants of this terminology in the code base.)

        There is an implicit ordering of both the points and cells composing vtkImageData. Both the cells and points are numbered in the direction of increasing x, then y, then z. The total number of points is n_x \\times n_y \\times n_z where n_x, n_y, and n_zz are the dimensions of vtkImageData. The total number of cells is (n_x - 1) \\times (n_y - 1) \\times (n_z - 1).

        vtkRectilinearGrid. While the topology of vtkRectilinearGrid is regular, the geometry can be described as \"semi-regular.\" The topology is implicitly represented by specifying data dimensions along the x, y, and z coordinate axes. The geometry is defined using three arrays of coordinate values along these axes. These three coordinate arrays can be combined to determine the coordinates of any point in the dataset. In VTK, we represent the arrays using three instances of vtkDataArray. The numbering of points and cells is implicit in exactly the same way as described for vtkImageData.

        vtkStructuredGrid. Like vtkImageData, the topology of vtkStructuredGrid is regular and is defined by specifying dimensions in the topological i-j-k coordinate system. However, the geometry of vtkStructuredGrid is realized by specifying point coordinates in the global x-y-z coordinate system.

        The abstract data class vtkPoints is used to represent the point coordinates. vtkPoints refers to an underlying instance of vtkDataArray which actually holds the representation of the points as a contiguous array of three-component tuples. A particular point coordinate may be retrieved or inserted by specifying a particular point id. The numbering of the points and cells is implicit in the same fashion as vtkImageData. Care must be taken to insure that the number of points in the data array is the same as that implied by the dimensions of the grid.

        vtkPolyData. Unlike vtkImageData and vtkStructuredGrid, the topology of vtkPolyData is not regular, so both the topology and geometry of the dataset must be explicitly represented. The point data in vtkPolyData is represented using the vtkPoints class similar to vtkStructuredGrid.

        The Visualization Toolkit uses the class vtkCellArray to explicitly represent cell topology. This class is a list of connectivity for each cell. The structure of the list is a sequence of integer numbers (Figure 5-12). The first number in the list is a count (the number of points in the cell connectivity), and the next series of numbers is the cell connectivity. (Each number in the connectivity list is an index into an instance of a point coordinate list.) Sequences of count followed by the connectivity list are repeated until each cell is enumerated. Additional information such as the number of cells in the list and current position in the list (for traversal purposes) is also maintained by vtkCellArray. Figure 5-12. vtkCellArray structure to represent cell topology.

        Notice that type information is not directly represented in this structure. Instead, vtkPolyData maintains four separate lists to vertices, lines, polygons, and triangle strips. The vertex list represents cells of type vtkVertex and vtkPolyVertex. The lines list represents cells of type vtkLine and vtkPolyLine. The polygon list represents cells of type vtkTriangle, vtkQuad, and vtkPolygon. The triangle strip list represents cells of the single type vtkTriangleStrip. As a result, the cell type is known from the particular list the cell is defined in, plus the number of points that define the cell.

        Our design of the vtkPolyData class is based on two important requirements. First, we want an efficient interface to external graphics libraries. Second, we wish to aggregate cells according to topology. The four separate lists provide efficient interface because graphics libraries have separate vertex, line, polygon, and triangle strip primitives. As a result, in VTK no run-time checking is required to match the different cell types with the appropriate \"load primitive\" function, since the type is known from the list in which the primitive resides. The four lists also separate cells into 0-, 1-, and 2-dimensional types. This is useful because visualization algorithms often treat data of varying topological order differently.

        vtkUnstructuredGrid. The dataset type vtkUnstructuredGrid is the most general in terms of its ability to represent topological and geometric structure. Both points and cells are explicitly represented using derived classes of vtkPoints and vtkCellArray. The class vtkUnstructuredGrid is similar to vtkPolyData except that vtkUnstructuredGrid must be capable of representing all cell types, not just the limited graphics types (i.e., vertices, lines, polygons, and triangle strips) of vtkPolyData.

        Another distinguishing characteristic of vtkUnstructuredGrid is that we represent type information differently. In vtkPolyData we categorized cells into four separate lists, thereby representing cell type indirectly. In vtkUnstructuredGrid we add the additional class vtkCellTypes to represent cell type explicitly.

        The vtkCellTypes is an array of supplemental information. For each cell, an integer flag defines the cell type. Another variable is used to record the location of the cell definition in the corresponding vtkCellArray (Figure 5-13).

        Besides representing cell type, this design also enables random access to cells. Because the length of a cell connectivity list varies, the vtkCellArray class cannot locate a particular cell without traversing its data structure from the origin. With the added class vtkCellTypes, however, it is possible to directly access a cell with a single dereference (i.e., using the offset value).

        The vtkCellTypes may also be added to the vtkPolyData data representation - and indeed it has. However, our reasons for this addition are not to represent type explicitly, but rather to provide random access to the cells and enable many topological operations. We will expand on this idea in Chapter 8 - Advanced Data Representation.

        Object Model. The five datasets are implemented as shown in Figure 5-14. As this object diagram illustrates, these concrete datasets are subclasses of the abstract class vtkDataSet. Two additional classes are introduced as well. The class vtkStructuredData contributes instance variables and methods for structured data. vtkStructuredData is not in an inheritance relationship with the datasets; rather the structured datasets shown delegate to it in order to implement some of their methods. (This was done to avoid multiple inheritance.) Subclasses of the class vtkPointSet represent their points explicitly, that is, through an instance of vtkPoints or its subclasses. vtkPointSet provides methods and instance variables to manipulate the point data, as well as a general searching capability to find points and cells. (See \"Searching\" in Chapter 8 for more information.) Figure 5-13. The data structure of the class vtkUnstructuredGrid. (This is a subset of the complete structure. See [Chapter 8 - Advanced Data Representation](../08Chapter8) for complete details.) Figure 5-14. Dataset object diagram. The five datasets (shaded) are implemented in VTK. Figure 5-15. Object diagram for twenty concrete cell types in VTK. vtkEmptyCell represents NULL cells. vtkGenericCell can represent any type of cell. Three-dimensional cells are subclasses of vtkCell3D. Higher order cells are subclasses of vtkNonLinearCell."},{"location":"VTKBook/05Chapter5/#cell-representation","title":"Cell Representation","text":"

        In the Visualization Toolkit each cell type has been implemented by creating specific classes. Each cell is a subclass of the abstract type vtkCell. Cell topology is represented by a list of ordered point ids, and cell geometry is represented by a list of point coordinates. The object diagram for vtkCell and its subclasses is shown in Figure 5-15.

        The abstract class vtkCell specifies methods that each cell must implement. These methods provide a defined interface to the cell's geometry and topology. Additional methods perform computation on the cell. These methods will be discussed in detail in Chapter 8 - Advanced Data Representation.

        "},{"location":"VTKBook/05Chapter5/#data-attributes","title":"Data Attributes","text":"

        Data attributes are associated with the structure of a dataset. The dataset model is built on points and cells, so it is natural to associate data attributes with points and cells as well. Intermediate structure features, such as cell edges or faces, are not explicitly represented so we cannot easily associate data attributes with them.

        In VTK data attributes are associated with the points and cells of the dataset. There is no association of data attributes to intermediate topological features such as triangle edges or hexahedron faces. (Here we refer to data attributes associated with points as point attributes, and data attributes associated with cells as cell attributes.) Our design choice is based on the following rationale.

        • Data acquisition and numerical simulation systems typically measure and/or compute the results at point locations, or at the center of cells.

        • Boundary attribute information (e.g., on faces and edges) can be maintained as cell data ordered according to the topology of the cell.

        • The VTK data model is based on points and cells for reasons of compactness and efficiency. Representing attribute data on cell boundaries would require expanding this representation to support a small number of situations requiring direct support of attribute data on cell boundaries. If in the future a more complex data structure is required to represent boundary attribute data, this is best encapsulated into a single class rather than forcing the abstraction throughout the system.

        One difficulty with maintaining both cell data and point data representations is that possible inconsistencies in the data may arise. For example, if a cell's scalar value is 0.5, and its points have scalar values other than 0.5, which is the correct value? Priority schemes can be devised to resolve such situations although the user must recognize that such inconsistencies may exist.

        Figure 5-16.Inheritance hierarchy for representing dataset attributes.

        To represent dataset attributes we use the organizing classes vtkPointData and vtkCellData, both of which are subclasses of the class vtkFieldData as shown in Figure 5-16. The class vtkDataSetAttributes serves to coordinate the movement of data from one process object to the next. It provides methods for copying, interpolating, and moving data between input and output.

        Another important feature of vtkDataSetAttributes is that it provides the ability to assign a data array to represent a particular data attribute. For example, the method SetScalars() is used to specify which data array is to be treated as the scalars in the field.

        There is a one-to-one correspondence between each dataset point and its attribute data. Point attributes are accessed by way of the point id. For example, to access the scalar value of point id 129 in the dataset instance aDataSet, we use aDataSet->GetPointData()->GetScalars()->GetTuple(129);

        This statement assumes that the scalar data has been defined for this dataset and is non-NULL.

        "},{"location":"VTKBook/05Chapter5/#examples","title":"Examples","text":"

        In the examples that follow we show manual creation and manipulation of datasets. Typically, these operations are not performed directly by users of VTK. Instead, source objects are used to read data files or generate data. This is more convenient than the manual techniques shown here and should be used whenever possible.

        Creation of datasets is a two step process. First the geometry and topology of the dataset must be defined. Depending on the type of dataset, the geometry and topology definition will proceed differently. Then the point and/or cell attribute data is created and associated with the dataset. Remember that there is a one-to-one relationship between the attribute data and the points and cells in the dataset.

        Figure 5-17. Creation of polygonal cube. See Cube.cxx and Cube.py.

        Create a Polygonal Dataset. In our first example we create a polygonal representation of a cube. The cube is defined by eight points and six quadrilateral faces. We also create eight scalar values associated with the eight vertices of the cube. Figure 5-17 shows the key C++ code fragments used to create the data, and the resulting image.

        The geometry of the cube is defined using an instance of the class vtkPoints. By default, the underlying type of vtkPoints is a vtkFloatArray. The topology of the cube (i.e., polygons) is defined with an instance of the class vtkCellArray. These define the points and polygons of the cube, respectively. Scalar data is represented by an instance of the class vtkIntArray.

        As this example shows, polygonal data is created by constructing pieces (e.g., points, cells, and point attribute data), and then assembling the pieces to form the complete dataset. If the name of the instance of vtkPolyData is cube, we can summarize these three steps as follows:

        1. Create instance of subclass of vtkPoints to define geometry(i.e.,point coordinates). Use the operator cube->SetPoints() to associate the points with the dataset.

        2. Create instances of vtkCellArray to define topology for vertices, lines, polygons, and triangle strips. Use the operators cube->SetVerts(), cube->SetLines(), cube->SetPolys(), and cube->SetStrips() to associate the cells with the dataset.

        3. Create point and/or attribute data. Every dataset has two fields representing vtkPointDataand vtkCellData. Use the operator pd=cube->GetPointData() to retrieve the pointer to the point attribute data. Use the operator pd=cube->GetCellData() to retrieve the pointer to the cell attribute data. Associate the attribute data with the dataset using the operators pd->SetScalars(), pd->SetVectors(), pd->SetNormals(), pd->SetTensors(), and pd->SetTCoords() (and similar for cell data).

        Polygonal data supports the following cell types: vertices, polyvertices, lines, polylines, triangles, quadrilaterals, polygons, and triangle strips. Point and cell attribute data does not need to be defined - you can create none, some, or all of the point and cell attributes in any combination.

        The most confusing aspect of this example is the Delete() method. To prevent memory leaks we must use a Delete() method (VTK's destructor) after every New() method. It is apparent from the example that the instance's points, polys, and scalars are referred to by another object (e.g., cube). So doesn't invocation of the Delete() method pose a problem?

        The answer is no. Certain data objects in VTK are reference counted to conserve memory resources (i.e., subclasses of vtkObjectBase). That means they can be shared between objects. For most objects the Delete() will invoke the destructor. Reference counted objects act a little differently. The Delete() method simply decrements the reference count. This may or may not destroy the object depending on whether it is being used by another object. In this example the points, polys, and scalars are used by the polygonal dataset cube, so they are not deleted when Delete() is invoked. They will be freed once we free the dataset cube, that is, when their reference count drops to zero. (See the VTK User's Guide for more information about memory management.)

        Create an Image Data Dataset. In this example, we create an image dataset (i.e., an instance of vtkImageData). The topology of the dataset is defined by specifying the data dimensions. The geometry is defined by the data spacing and origin. The spacing specifies the length, width, and height of each voxel. The origin specifies the position in 3D space of the \"lower-left\" corner of the data. In our example we set the origin and spacing of the dataset so that its center lies at the origin, and the bounds of the dataset are (-0.5,0.5, -0.5,0.5, -0.5,0.5).

        Figure 5-18. Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26^3. See Vol.cxx and Vol.py.

        In this example we create scalar data along with the image data dataset. The scalar values are computed from the implicit function for a sphere

        \\begin{equation*} F(x,y,z) = (x^2 + y^2 + z^2)-R^2 \\end{equation*} \\bf\\tag{5-2}

        with the radius R = 0.4. The scalar data is stored in an instance of vtkFloatArray and assigned to the point attribute data of the dataset.

        To complete this example, a contour filter is used to generate a surface of scalar value F(x, y, z) = 0. Note that this functionality (in a more general form) is available from the source object vtkSampleFunction in combination with vtkSphere. Figure 5-18 shows the key C++ code fragment used to create the data and contour the scalar field, and the resulting image.

        Image data datasets are easy to construct because both the geometry and topology are implicitly defined. If the name of the instance of vtkImageData is vol, we can summarize the steps to create the dataset as follows:

        1. Define the topology of the dataset using the operator vol->SetDimensions().

        2. Define the geometry of the dataset using the operators vol->SetOrigin()and vol->SetSpacing().

        3. Create point and/or attribute data and associate it with the dataset.

        You do not need to specify origin and data spacing. By default the data spacing is (1,1,1) in the x-y-z directions, and the origin is (0,0,0). Thus if the dimensions of the dataset are (n_x \\times n_y \\times n_z), the default length, width, and height of the dataset will be (n_x - 1, n_y - 1, n_z - 1).

        The topological dimension of the dataset is implicitly known from its instance variables. For example, if any of the dimensions (n_x, n_y, n_z) is equal to one (and the other two are greater than one), the topological dimension of the dataset is two.

        Create a Structured Grid Dataset. In the next example we create a vtkStructuredGrid dataset. Topology is implicitly defined from the dimensions of the dataset. The geometry is explicitly defined by providing an object to represent the point coordinates. In this example we use an instance of vtkPoints and assume that the structured grid is warped according to the equation for a cylinder

        \\begin{equation*} x = r_i \\cos\\theta, y = r_i \\sin\\theta, z = z_i \\end{equation*} \\bf\\tag{5-3} Figure 5-19. Creating a structured grid dataset of a semicylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction. See SGrid.cxx and SGrid.py.

        We arbitrarily choose the number of points in the tangential direction to be thirteen, the number of points in the radial direction to be eleven, and the number of points in the axis direction to be eleven (i.e., dimensions are 13 \\times 11 \\times 11).

        Vectors are generated tangential to the cylinder and of magnitude proportional to the radius. To display the data we draw small, oriented lines at each point as shown in Figure 5-19. (This technique is called a hedgehog. See \"Hedgehogs and Oriented Glyphs\" in Chapter 6 for more information.)

        The creation of a structured grid dataset is partially explicit and partially implicit. Geometry is created explicitly be creating an instance of vtkPoints, while the topology is created implicitly by specifying dataset dimensions. If the name of the instance of vtkStructuredGrid is sgrid, the following three steps are used to create it.

        1. Specify the dataset geometry by creating an instance of vtkPoints.Use the operators grid->SetPoints() to associate the points with the dataset.

        2. The dataset topology is specified using the operators grid->SetDimensions(). Make sure the number of points created in item number 1 above is equal to the implied number of points nx \\cdot ny \\cdot nz.

        3. Create point and/or cell attribute data and associate it with the dataset.The topological dimension of the dataset is implied by the specified dimensions. For example, if any of the dimensions (n_x, n_y, n_z) is equal to one, the topological dimension of the dataset is two. If two of the three dimensions (nx, ny, nz) are equal to one, the topological dimension of the dataset is one.

        Create a Rectilinear Grid Dataset. A rectilinear grid is regular in topology and semi-regular in geometry. Similar to a structured grid or image data dataset, topology is implicitly represented by specifying grid dimensions. Because the grid is axis-aligned but the point coordinates along each axis may vary, we need three data arrays to represent the geometry of the dataset, one array for each of the x-y-z axes. Note that the cell types of the rectilinear dataset are pixels and voxels.

        Figure 5-20. Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray. See RGrid.cxx and RGrid.py.

        For maximum flexibility when creating rectilinear grids, in VTK we use three vtkDataArray objects to define the axes arrays. This means that different native data type (e.g., unsigned char, int, float, and so on) can be used for each axes.

        To summarize the process of creating an instance of vtkRectilinearGrid, we follow four steps. In this example (shown in Figure 5-20), we assume that the name of the vtkRectilinearGrid instance is rgrid.

        1. Create the dataset geometry by creating three instances of vtkDataArray, one for each of the x-y-z coordinate axes. We will assume that the number of values in each scalar is n_x, n_y, and n_z.

        2. Each of the three instances is assigned to the x, y,and z axes using ther grid->SetXCoordinates(), rgrid->SetYCoordinates(), and rgrid->SetZCoordinates() methods, respectively.

        3. The dataset topology is specified using the operatorr grid->SetDimensions(). Make sure the number of points created in item number 1 above is equal to the implied number of points n_x \\cdot n_y \\cdot n_z.

        4. Create point and/or cell attribute data and associate it with the dataset.

        The topological dimension of the dataset is implied by the specified dimensions. For example, if any of the dimensions (n_x, n_y, n_z) is equal to one, the topological dimension of the dataset is two. If two of the three dimensions (n_x, n_y, n_z) are equal to one, the topological dimension of the dataset is one.

        Create an Unstructured Grid Dataset. Unstructured grid datasets are the most general dataset type in both topology and geometry. In this example we \"artificially\" create an unstructured grid using an instance of vtkUnstructuredGrid (Figure 5-21). The grid contains examples of each cell type except for pixels and voxels. (Pixels and voxels are generally used internally to process image data datasets. They can be explicitly created and manipulated as long as the required relationship of point geometry is observed.) Creating the dataset structure requires creating points to define the geometry and various cells to define the topology. (Note that in the finite element world we would refer to these as nodes and elements.) Figure 5-21. Creating a structured grid dataset of a semicylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction. See UGrid.cxx and UGrid.py.

        To summarize the process of creating an instance of vtkUnstructuredGrid, we follow five steps. We assume the name of vtkUnstructuredGrid instance is ugrid.

        1. Allocate memory for the dataset. Use the operator ugrid->Allocate(). This operator takes two optional parameters related to the size of the data. The first is the size of the connectivity list, and the second is the amount to extend storage (if necessary). As a rule of thumb, use the number of cells times the average number of points defining each cell for both parameters. Exact values for these parameters are not important, although the choice may affect performance. If you fail to execute this operation before inserting data, the software will break.

        2. Create an instance of a subclass of vtkPoints to define the dataset geometry. Use the operator ugrid->SetPoints() to associate the points with the dataset.

        3. Create the data set topology on a cell by cell basis by using the cell insertion operator ugrid->InsertNextCell(). There are various flavors of this operator, use the appropriate one.

        4. Create point and/or cell attribute data and associate it with the dataset.

        5. Complete the creation process by executing the ugrid->Squeeze() operator.This operator reclaims any extra memory consumed by the data structures. Although this step is not required, it will return memory resource back to the computer system.

        The creation of unstructured grid datasets is somewhat different from the creation of the other dataset types. This is because of the unstructured nature of the data, and the complex nature of the internal data structures.

        "},{"location":"VTKBook/05Chapter5/#59-chapter-summary","title":"5.9 Chapter Summary","text":"

        A dataset represents visualization data. The dataset has an organizing structure, with topological and geometric components, and associated attribute data. The structure of a dataset consists of cells (topology) and points (geometry). An important characteristic of the structure is whether its geometry and topology are regular or irregular (or equivalently, structured or unstructured). Regular data is more compact and usually more computationally efficient than irregular data. However, irregular data is more flexible in representation capability than regular data.

        Important dataset types include polygonal data, rectilinear grid, image data, structured grids, and unstructured grids. The polygonal dataset type is used to represent graphics data, as well as many kinds of visualization data. The unstructured grid is the most general type, consisting of arbitrary combinations of all possible cell types.

        Attribute data consists of scalars, vectors, tensors, texture coordinates, and normals. Other arrays may also be includes as part of attribute data since it is a type of field data. In the Visualization Toolkit, attribute data is associated with both the dataset point and cells.

        "},{"location":"VTKBook/05Chapter5/#510-bibliographic-notes","title":"5.10 Bibliographic Notes","text":"

        A variety of representation schemes have been proposed for each dataset type described here. These schemes vary depending on design goals. For example, even the simple volume representation has been implemented with other more complex schemes such as run-length encoding and octrees [Bloomenthal88]. A description of more general representation schemes is available in [Haber91], the AVS field model [AVS89], and the compact cell structure [Schroeder94]. An overview of dataset types can be found in [Gelberg90]. Some structures for those mathematically oriented can be found in [Brisson90] and [Poluzzi93]. Haimes [VISUAL3] describes an efficient data structure for unstructured grid visualization.

        If you are interested in more details on finite element methods see the classic Zienkiewicz [Zienkiewicz87] or [Gallagher75]. Information about both finite difference and finite element methods is available in [Lapidus82].

        "},{"location":"VTKBook/05Chapter5/#511-references","title":"5.11 References","text":"

        [AVS89] C. Upson, T. Faulhaber, Jr., D. Kamins, and others. \"The Application Visualization System: A Computational Environment for Scientific Visualization.\" IEEE Computer Graphics and Applications. 9(4):30-42, July 1989.

        [Bloomenthal88] J. Bloomenthal. \"Polygonization of Implicit Surfaces.\" Computer Aided Geometric Design. 5(4):341-355, November 1988.

        [Brisson90] E. Brisson. \"Representing Geometric Structures in d-Dimensions: Topology and Order.\" ACM Symposium on Computational Geometry. ACM Press, NY, 1989.

        [Gallagher75] R. H. Gallagher. Finite Element Analysis: Fundamentals. Prentice Hall, Upper Saddle River, NJ, 1975.

        [Gelberg90] L. Gelberg, D. Kamins, D. Parker, and J. Stacks. \"Visualization Techniques for Structured and Unstructured Scientific Data.\" SIGGRAPH '90 Course Notes for State of the Art Data Visualization. August 1990.

        [Haber91] R. B. Haber, B. Lucas, N. Collins. \"A Data Model for Scientific Visualization with Provisions for Regular and Irregular Grids.\" In Proceedings of Visualization '91. pp. 298-395, IEEE Computer Society Press, Los Alamitos, CA, 1991.

        [Lapidus82] L. Lapidus and G. F. Pinder. Numerical Solution of Partial Differential Equations in Science and Engineering. John Wiley and Sons, New York, 1987.

        [Mortenson85] M. E. Mortenson. Geometric Modeling. John Wiley and Sons, New York, 1985.

        [Poluzzi93] A. Paoluzzi, F. Bernardini, C. Cattani, and V. Ferrucci. \"Dimension-Independent Modeling with Simplicial Complexes.\" ACM Transactions on Graphics. 12(1):56-102, 1993.

        [Schroeder94] W. J. Schroeder and B. Yamrom. \"A Compact Cell Structure for Scientific Visualization.\" SIGGRAPH '93 and '94 Course Notes for Advanced Techniques for Scientific Visualization.

        [Schroeder05]W. J. Schroeder, F. Bertel, M. Malaterre, D. Thompson, P. P. Pe\u0301bay, R. O'Bara and S. Tendulkar. \"Framework for Visualizing Higher-Order Basis Functions.\" In Proceedings of IEEE Visualization 2005, pp. 43-50, Minneapolis, MN, IEEE Computer Society Press, October 2005.

        [VISUAL3] R. Haimes and M. Giles. \"VISUAL3: Interactive Unsteady Unstructured 3D Visualization.\"AIAA Report No. AIAA-91-0794. January 1991.

        [Weiler86] K. J. Weiler. Topological Structures for Geometric Modeling. PhD thesis, Rensselaer Polytechnic Institute, Troy, NY, May 1986.

        [Zienkiewicz87] O. C. Zienkiewicz and R. L. Taylor. The Finite Element Method, vol. 1. McGraw-Hill Book Co., New York, 4th ed. 1987.

        "},{"location":"VTKBook/05Chapter5/#512-exercises","title":"5.12 Exercises","text":"

        5.1 Consider a pixmap of dimensions 1002. Compare the memory requirements to represent this data using:

        a) an image dataset,

        b) a structured grid dataset,

        c) a polygonal mesh of quadrilaterals,

        d) an unstructured grid of quadrilateral cells,

        e) and a triangle strip mesh of 100 strips of 200 triangles each.

        5.2 Consider a volume of dimensions 1003. Compare the memory requirements to represent this data using:

        a) an image dataset,

        b) a structured grid dataset,

        c) and an unstructured grid of hexahedral cells.

        5.3 Develop a representational scheme for a rectilinear grid. How does this compare (in memory requirement) to a structured grid?

        5.4 Consider a volume of dimensions 1003. Compute the memory requirements for the following point attribute types:

        a) unsigned character scalars (1 byte per scalar),

        b) float scalars (4 bytes per scalar),

        c) float vectors,

        d) and double-precision tensors (3x3 tensors).

        5.5 List three examples of scalar data.

        5.6 List three examples of vector data.

        5.7 List three examples of tensor data.

        5.8 Is it possible to have more than one scalar field in a dataset? If so, how would this information be represented?

        5.9 A common method to represent cell connectivity is to list point ids with the last id negated. For example, triangle (8,7,3) would be represented (8,7,-3). The negative index represents end of cell definition. What are the advantages and disadvantages of this scheme as compared to the VTK cell array structure?

        5.10 How many different ways can a hexahedral cell be decomposed into tetrahedron? Are there compatibility issues between neighboring hexahedra?

        5.11 Write a program to create and display a structured grid in the form of a hollow cylinder (i.e., cylinder with a hole through it).

        5.12 Write a program to create and display an unstructured grid in the form of a hollow cylinder.

        5.13 Write a program to create and display a polygonal octahedron.

        "},{"location":"VTKBook/06Chapter6/","title":"Chapter 6 - Fundamental Algorithms","text":"

        We have seen how to represent basic types of visualization data such as image data, structured grids, unstructured grids, and polygonal data. This chapter explores methods to transform this data to and from these various representations, eventually generating graphics primitives that we can render. These methods are called algorithms, and are of special interest to those working in the field of visualization. Algorithms are the verbs that allow us to express our data in visual form. By combining these verbs appropriately, we can reduce complex data into simple, readily comprehensible sentences that are the power of data visualization.

        "},{"location":"VTKBook/06Chapter6/#61-introduction","title":"6.1 Introduction","text":"

        The algorithms that transform data are the heart of data visualization. To describe the various transformations available, we need to categorize algorithms according to the structure and type of transformation. By structure we mean the effects that transformation has on the topology and geometry of the dataset. By type we mean the type of dataset that the algorithm operates on.

        Structural transformations can be classified in four ways, depending on how they affect the geometry, topology, and attributes of a dataset.

        • Geometric transformations alter input geometry but do not changed the topology of the dataset. For example, if we translate, rotate, and/or scale the points of a polygonal dataset, the topology does not change, but the point coordinates, and therefore the geometry, does.

        • Topological transformations alter input topology but do not change geometry and attribute data. Converting a dataset type from polygonal data to unstructured grid data, or from image data to unstructured grid, changes the topology but not the geometry. More often, however, the geometry changes whenever the topology does, so topological transformation is uncommon.

        • Attribute transformations convert data attributes from one form to another, or create new attributes from the input data. The structure of the dataset remains unaffected. Computing vector magnitude or creating scalars based on elevation are data attribute transformations.

        • Combined transformations change both dataset structure and attribute data. For example, computing contour lines or surfaces is a combined transformation.

        We also may classify algorithms according to the type of data they operate on, or the type of data they generate. By type, we most often mean the type of attribute data, such as scalars or vectors. Typical categories include:

        • Scalar algorithms operate on scalar data. For example, the generation of contour lines of temperature on a weather map.

        • Vector algorithms operate on vector data. Showing oriented arrows of airflow (direction and magnitude) is an example of vector visualization.

        • Tensor algorithms operate on tensor matrices. An example of a tensor algorithm is to show the components of stress or strain in a material using oriented icons.

        • Modelling algorithms generate dataset topology or geometry, or surface normals or texture data. Modelling algorithms tend to be the catch-all category for many algorithms, since some do not fit neatly into any single category mentioned above. For example, generating glyphs oriented according to the vector direction and then scaled according to the scalar value, is a combined scalar/vector algorithm. For convenience we classify such an algorithm as a modelling algorithm, because it does not fit squarely into any other category.

        Algorithms also can be classified according to the type of data they process. This is the most common scheme found in the visualization literature. However, this scheme is not without its problems. Often the categories overlap, resulting in confusion. For example, a category (not mentioned above) is volume visualization, which refers to the visualization of volume data (or in our terminology, image data). This category was initially created to describe the visualization of scalar data arranged on a volume, but more recently, vector (and even tensor) data has been visualized on a volume. Hence, we have to qualify our techniques to volume vector visualization, or other potentially confusing combinations.

        In the text that follows, we will use the attribute type classification scheme: scalar, vector, tensor, and modelling. In cases where the algorithms operate on a particular dataset type, we place them in the appropriate category according to our best judgment. Be forewarned, though, that alternative classification schemes do exist, and may be better suited to describing the true nature of the algorithm.

        Figure 6-1 Mapping scalars to colors via a lookup table."},{"location":"VTKBook/06Chapter6/#generality-versus-efficiency","title":"Generality Versus Efficiency","text":"

        Most algorithms can be written specifically for a particular dataset type, or more generally, treating any dataset type. The advantage of a specific algorithm is that it is usually faster than a comparable general algorithm. (See \"Other Data Abstractions\" in Chapter 5 where we discussed the tradeoff between abstract and concrete forms.) An implementation of a specific algorithm also may be more memory efficient and its implementation may better reflect the relationship between the algorithm and the dataset type it operates on.

        One example of this is contour surface creation. Algorithms for extracting contour surfaces were originally developed for volume data, mainly for medical applications. The regularity of volumes lends itself to efficient algorithms. However, the specialization of volume-based algorithms precludes their use for more general datasets such as structured or unstructured grids. Although the contour algorithms can be adapted to these other dataset types, they are less efficient than those for volume datasets.

        Our presentation of algorithms favors the more general implementations. In some special cases we will describe performance improving techniques for particular dataset types. Refer to the bibliography at the end of each chapter for detailed descriptions of specialized algorithms.

        "},{"location":"VTKBook/06Chapter6/#62-scalar-algorithms","title":"6.2 Scalar Algorithms","text":"

        Scalars are single data values associated with each point and/or cell of a dataset. (Recall that in the Visualization Toolkit we associate data with points.) Because scalar data is commonly found in real-world applications, and because scalar data is so easy to work with, there are many different algorithms to visualize it.

        "},{"location":"VTKBook/06Chapter6/#color-mapping","title":"Color Mapping","text":"

        Color mapping is a common scalar visualization technique that maps scalar data to colors, and displays the colors on the computer system. The scalar mapping is implemented by indexing into a color lookup table. Scalar values serve as indices into the lookup table.

        The mapping proceeds as follows. The lookup table holds an array of colors (e.g., red, green, blue components or other comparable representations). Associated with the table is a minimum and maximum scalar range (min, max) into which the scalar values are mapped. Scalar values greater than the maximum range are clamped to the maximum color, scalar values less than the minimum range are clamped to the minimum color value. Then, for each scalar value x_i, the index i into the color table with n entries (and 0-offset) is given by Figure 6-1.

        A more general form of the lookup table is called a transfer function. A transfer function is Figure 6-2 maps any expression that maps scalar value into a color specification. For example, scalar values into separate intensity values for the red, green, and blue color components. We can also use transfer functions to map scalar data into other information such as local transparency. (Transfer functions are discussed in more detail in \"Transparency and Alpha Values\" in Chapter 7. Figure 6-2 maps any expression that maps scalar value into a color specification. For example, scalar values into separate intensity values for the red, green, and blue color components. We can also use transfer functions to map scalar data into other information such as local transparency. (Transfer functions are discussed in more detail in \"Transparency and Alpha Values\" in Chapter 7 and \"Volume Rendering\" in Chapter 7.) A lookup table is a discrete sampling of a transfer function. We can create a lookup table from any transfer function by sampling the transfer function at a set of discrete points.

        Color mapping is a one-dimensional visualization technique. It maps one piece of information (i.e., a scalar value) into a color specification. However, the display of color information is not limited to one-dimensional displays. Often we use color information mapped onto 1D, 2D, or 3D objects. This is a simple way to increase the information content of our visualizations.

        The key to color mapping for scalar visualization is to choose the lookup table entries carefully. Figure 6-3 shows four different lookup tables used to visualize gas density as fluid flows through a combustion chamber. The first lookup table is gray-scale. Gray-scale tables often provide better structural detail to the eye. The other three images in Figure 6-3 use different color lookup tables. The second uses rainbow hues from blue to red. The third uses rainbow hues arranged from red to blue. The last table uses a table designed to enhance contrast. Careful use of colors can often enhance important features of a dataset. However, any type of lookup table can exaggerate unimportant details or create visual artifacts because of unforeseen interactions between data, color choice, and human physiology.

        Designing lookup tables is as much art as it is science. From a practical point of view, tables should accentuate important features, while minimizing less important or extraneous details. It is also desirable to use palettes that inherently contain scaling information. For example, a color rainbow scale from blue to red is often used to represent temperature scale, since many people associate \"blue\" with cold temperatures, and \"red\" with hot temperatures. However, even this scale is problematic: a physicist would say that blue is hotter than red, since hotter objects emit more blue light (i.e., shorter wavelength) than red. Also, there is no need to limit ourselves to \"linear\" lookup tables. Even though the mapping of scalars into colors has been presented as a linear operation (Figure 6-1), the table itself need not be linear. That is, tables can be designed to enhance small variations in scalar value using logarithmic or other schemes, improving the comfort level and engaging the human observer more deeply in the presentation of data improves the effectiveness of communication. Figure 6-2. Transfer function for color components red, green and blue as a function of scalar value. Figure 6-3. Flow density colored with different lookup tables. Top-left: grayscale; Top-right rainbow (blue to red); lower-left rainbow (red to blue); lower-right large contrast. See Rainbow.cxx and Rainbow.py. Figure 6-4. Contouring a 2D structured grid with contour line value = 5."},{"location":"VTKBook/06Chapter6/#contouring","title":"Contouring","text":"

        A natural extension to color mapping is contouring. When we see a surface colored with data values, the eye often separates similarly colored areas into distinct regions. When we contour data, we are effectively constructing the boundary between these regions. These boundaries correspond to contour lines (2D) or surfaces (3D) of constant scalar value.

        Examples of 2D contour displays include weather maps annotated with lines of constant temperature (isotherms), or topological maps drawn with lines of constant elevation. Three-dimensional contours are called isosurfaces, and can be approximated by many polygonal primitives. Examples of isosurfaces include constant medical image intensity corresponding to body tissues such as skin, bone, or other organs. Other abstract isosurfaces such as surfaces of constant pressure or temperature in fluid flow also may be created.

        Consider the 2D structured grid shown in Figure 6-4. Scalar values are shown next to the points that define the grid. Contouring always begins by selecting a scalar value, or contour value, that corresponds to the contour lines or surfaces generated. To generate the contours, some form of interpolation must be used. This is because we have scalar values at a finite set of points in the dataset, and our contour value may lie between the point values. Since the most common interpolation technique is linear, we generate points on the contour surface by linear interpolation along the edges. If an edge has scalar values 10 and 0 at its two endpoints, and if we are trying to generate a contour line of value 5, then edge interpolation computes that the contour passes through the midpoint of the edge.

        Once the points on cell edges are generated, we can connect these points into contours using a few different approaches. One approach detects an edge intersection (i.e., the contour passes through an edge) and then \"tracks\" this contour as it moves across cell boundaries. We know that if a contour edge enters a cell, it must exit a cell as well. The contour is tracked until it closes back on itself, or exits a dataset boundary. If it is known that only a single contour exists, then the process stops. Otherwise, every edge in the dataset must be checked to see whether other contour lines exist. Another approach uses a divide and conquer technique, treating cells independently. This is the marching squares algorithm in 2D, and marching cubes [Lorensen87] in 3D. The basic assumption of these techniques is that a contour can only pass through a cell in a finite number of ways. A case table is constructed that enumerates all possible topological states of a cell, given combinations of scalar values at the cell points. The number of topological states depends on the number of cell vertices, and the number of inside / outside relationships a vertex can have with respect to the contour value. A vertex is considered inside a contour if its scalar value is larger than the scalar value of the contour line. Vertices with scalar values less than the contour value are said to be outside the contour. For example, if a cell has four vertices and each vertex can be either inside or outside the contour, there are 2^4 = 16 possible ways that the contour passes through the cell. In the case table we are not interested in where the contour passes through the cell (e.g., geometric intersection), just how it passes through the cell (i.e., topology of the contour in the cell).

        Figure 6-5 shows the sixteen combinations for a square cell. An index into the case table can be computed by encoding the state of each vertex as a binary digit. For 2D data represented on a rectangular grid, we can represent the 16 cases with 4 bit index. Once the proper case is selected, the location of the contour line / cell edge intersection can be calculated using interpolation. The algorithm processes a cell and then moves, or marches t o the next cell. After all cells are visited, the contour will be completed. In summary, the marching algorithms proceed as follows:

        1. Select a cell.

        2. Calculate the inside / outside state of each vertex of the cell.

        3. Create an index by storing the binary state of each vertex in a separate bit.

        4. Use the index to look up the topological state of the cell in a case table.

        5. Calculate the contour location (via interpolation) for each edge in the case table.

        This procedure will construct independent geometric primitives in each cell. At the cell boundaries duplicate vertices and edges may be created. These duplicates can be eliminated by using a special coincident point merging operation. Note that interpolation along each edge should be done in the same direction. If not, numerical roundoff will likely cause points to be generated that are not precisely coincident, and will not merge properly.

        There are advantages and disadvantages to both the edge-tracking and marching cubes approaches. The marching squares algorithm is easy to implement. This is particularly important when we extend the technique into three dimensions, where isosurface tracking becomes much more difficult. On the other hand, the algorithm creates disconnected line segments and points, and the required merging operation requires extra computation resources. The tracking algorithm can be implemented to generate a single polyline per contour line, avoiding the need to merge coincident points.

        Figure 6-5. Sixteen different marching squares cases. Dark vertices indicate scalar value is above contour value. Cases 5 and 10 are ambiguous. Figure 6-6. Marching Cubes cases for 3D isosurface generation. The 256 possible cases have been reduced to 15 cases using symmetry. Red vertices are greater than the selected isosurface value. See MarchingCasesA.cxx and See MarchingCasesA.py. Figure 6-7. Using marching triangles or marching tetrahedra to resolve ambiguous cases on rectangular lattice (only face of cube is shown). Choice of diagonal orientation may result in \"bumps\" in contour surface. In 2D, diagonal orientation can be chosen arbitrarily, but in 3D diagonal is constrained by neighbor.

        As mentioned previously, the 3D analogy of marching squares is marching cubes. Here, there are 256 different combinations of scalar value, given that there are eight points in a cubical cell (i.e., 2^8 combinations). Figure 6-6 shows these combinations reduced to 15 cases by using arguments of symmetry. We use combinations of rotation and mirroring to produce topologically equivalent cases. Figure 6-10 Marching Cubes complementary cases. See MarchingCasesB.cxx and MarchingCasesB.py.

        An important issue is contouring ambiguity. Careful observation of marching squares cases numbered 5 and 10 and marching cubes cases numbered 3, 6, 7, 10, 12, and 13 show that there are configurations where a cell can be contoured in more than one way. (This ambiguity also exists when using an edge tracking approach to contouring.) Contouring ambiguity arises on a 2D square or the face of a 3D cube when adjacent edge points are in different states, but diagonal vertices are in the same state.

        In two dimensions, contour ambiguity is simple to treat: for each ambiguous case we implement one of the two possible cases. The choice for a particular case is independent of all other choices. Depending on the choice, the contour may either extend or break the current contour as illustrated in Figure 6-8. Either choice is acceptable since the resulting contour lines will be continuous and closed (or will end at the dataset boundary).

        In three dimensions the problem is more complex. We cannot simply choose an ambiguous case independent of all other ambiguous cases. For example Figure 6-9 shows what happens if we carelessly implement two cases independent of one another. In this figure we have used the usual case 3 but replaced case 6 with its complementary case. Complementary cases are formed by exchanging the \"dark\" vertices with \"light\" vertices. (This is equivalent to swapping vertex scalar value from above the isosurface value to below the isosurface value, and vice versa.) The result of pairing these two cases is that a hole is left in the isosurface.

        Several different approaches have been taken to remedy this problem. One approach tessellates the cubes with tetrahedron, and uses a marching tetrahedra technique . This works because the marching tetrahedra exhibit no ambiguous cases. Unfortunately, the marching tetrahedra algorithm generates isosurfaces consisting of more triangles, and the tessellation of a cube with tetrahedra requires making a choice regarding the orientation of the tetrahedra. This choice may result in artificial \"bumps\" in the isosurface because of interpolation along the face diagonals as shown in Figure 6-7. Another approach evaluates the asymptotic behavior of the surface, and then chooses the cases to either join or break the contour. Nielson and Hamann [Nielson91] have developed a technique based on this approach they call the asymptotic decider. It is based on an analysis of the variation of the scalar variable across an ambiguous face. The analysis determines how the edges of isosurface polygons should be connected. Figure 6-8. Choosing a particular contour case will break (a) or join (b) the current contour. Case shown is marching squares case 10. Figure 6-9. Arbitrarily choosing marching cubes cases leads to holes in the isosurface.

        A simple and effective solution extends the original 15 marching cubes cases by adding additional complementary cases. These cases are designed to be compatible with neighboring cases and prevent the creation of holes in the isosurface. There are six complementary cases required, corresponding to the marching cubes cases 3, 6, 7, 10, 12, and 13. The complementary marching cubes cases are shown in Figure 6-10.

        We can extend the general approach of marching squares and marching cubes to other topological types. In VTK we use marching lines, triangles, and tetrahedra to contour cells of these types (or composite cells that are composed of these types). In addition, although we speak of regular types such as squares and cubes, marching cubes can be applied to any cell type topologically equivalent to a cube (e.g., hexahedron or non-cubical voxel).

        Figure 6-11 shows four applications of contouring. In Figure 6-11a (a) we see 2D contour lines of CT density value corresponding to different tissue types. These lines were generated using marching squares. Figure 6-11b (b) through Figure 6-11d (d) are isosurfaces created by marching cubes. Figure 6-11b (b) is a surface of constant image intensity from a computed tomography (CT) Xray imaging system. (Figure 6-11a (a) is a 2D subset of this data.) The intensity level corresponds to human bone. Figure 6-11c (c) is an isosurface of constant flow density. Figure 6-11d (d) is an isosurface of electron potential of an iron protein molecule. The image shown in Figure 6-11b (b) is immediately recognizable because of our familiarity with human anatomy. However, for those practitioners in the fields of computational fluid dynamics and molecular biology, Figure 6-11c (c) and Figure 6-11d (d) are equally familiar. As these examples show, methods for contouring are powerful yet general techniques for visualizing data from a variety of fields. (a) Marching squares used to generate contour lines. (b) Marching Cubes surface of human bone (c) Marching Cubes surface of flow density. (d) Marching Cubes surface of iron-protein Figure 6-11. Contouring examples. (a) Marching squares used to generate contour lines See HeadSlice.cxx and HeadSlice.py; (b) Marching Cubes surface of human bone. See HeadBone.cxx and HeadBone.py; (c) Marching Cubes surface of flow density See CombustorIsosurface.cxx and CombustorIsosurface.py; (d) Marching Cubes surface of ironprotein. See IronIsoSurface.cxx and IronIsoSurface.py."},{"location":"VTKBook/06Chapter6/#scalar-generation","title":"Scalar Generation","text":"

        The two visualization techniques presented thus far, color mapping and contouring, are simple, effective methods to display scalar information. It is natural to turn to these techniques first when visualizing data. However, often our data is not in a form convenient to these techniques. The data may not be single-valued (i.e., a scalar), or it may be a mathematical or other complex relationship. That is part of the fun and creative challenge of visualization: We must tap our creative resources to convert data into a form we can visualize.

        For example, consider terrain data. We assume that the data is xyz coordinates, where x and y represent the coordinates in the plane, and z represents the elevation above sea level. Our desired visualization is to color the terrain according to elevation. This requires creating a color map --- possibly using white for high altitudes, blue for sea level and below, and various shades of green and brown corresponding to elevation between sea level and high altitude. We also need scalars to index into the color map. The obvious choice here is to extract the z coordinate. That is, scalars are simply the z-coordinate value.

        This example can be made more interesting by generalizing the problem. Although we could easily create a filter to extract the z-coordinate, we can create a filter that produces elevation scalar values where the elevation is measured along any axis. Given an oriented line starting at the (low) point p_l (e.g., sea level) and ending at the (high) point p_h (e.g., mountain top), we compute the elevation scalar s_i at point p_i = (x_i, y_i,z_i) using the dot product as shown in Figure 6-12. The scalar is normalized using the magnitude of the oriented line, and may be clamped between minimum and maximum scalar values (if necessary). The bottom half of this figure shows the results of applying this technique to a terrain model of Honolulu, Hawaii. A lookup table of 256 ranging from deep blue (water) to yellow-white (mountain top) is used to color map this figure. Figure 6-12. Computing scalars using normalized dot product. Bottom half of figure illustrates technique applied to terrain data from Honolulu, Hawaii. See Hawaii.cxx and Hawaii.py.

        Part of the creative practice of visualization is selecting the best technique for given data from the palette of available techniques. Often this requires creative mapping by the user of the visualization system. In particular, to use scalar visualization techniques we need only to create a relationship to generate a unique scalar value. Other examples of scalar mapping include an index value into a list of data, computing vector magnitude or matrix determinate, evaluating surface curvature, or determining distance between points. Scalar generation, when coupled with color mapping or contouring, is a simple, yet effective, technique for visualizing many types of data.

        "},{"location":"VTKBook/06Chapter6/#63-vector-algorithms","title":"6.3 Vector Algorithms","text":"

        Vector data is a three-dimensional representation of direction and magnitude. Vector data often results from the study of fluid flow, or when examining derivatives (i.e., rate of change) of some quantity.

        "},{"location":"VTKBook/06Chapter6/#hedgehogs-and-oriented-glyphs","title":"Hedgehogs and Oriented Glyphs","text":"

        A natural vector visualization technique is to draw an oriented, scaled line for each vector (Figure 6-13 (a)). The line begins at the point with which the vector is associated and is oriented in the direction of the vector components (v_x, v_y, v_z). Typically, the resulting line must be scaled up or down to control the size of its visual representation. This technique is often referred to as a hedgehog because of the bristly result.

        There are many variations of this technique (Figure 6-13 (b)). Arrows may be added to indicate the direction of the line. The lines may be colored according to vector magnitude, or some other scalar quantity (e.g., pressure or temperature). Also, instead of using a line, oriented \"glyphs\" can be used. By glyph we mean any 2D or 3D geometric representation such as an oriented triangle or cone. (c) Complex display. Figure 6-13. Vector visualization techniques: (a) oriented lines; (b) using oriented glyphs; (c) complex vector visualization. See ComplexV.cxx and ComplexV.py.

        Care should be used in applying these techniques. In 3D it is often difficult to understand the position and orientation of a vector because of its projection into a 2D image. Also, using large numbers of vectors can clutter the display to the point where the visualization becomes meaningless. Figure 6-13 (c) shows 167,000 3D vectors (using oriented and scaled lines) in the region of the human carotid artery. The larger vectors lie inside the arteries, the smaller vectors lie outside the arteries and are randomly oriented (measurement error) but small in magnitude. Clearly the details of the vector field are not discernible from this image.

        Scaling glyphs also poses interesting problems. In what Tufte has termed a \"visualization lie,\" [Tufte83] scaling a 2D or 3D glyph results in nonlinear differences in appearance. The surface area of an object increases with the square of its scale factor, so two vectors differing by a factor of two in magnitude may appear up to four times different based on surface area. Such scaling issues are common in data visualization, and great care must be taken to avoiding misleading viewers.

        "},{"location":"VTKBook/06Chapter6/#warping","title":"Warping","text":"

        Vector data is often associated with \"motion.\" The motion is in the form of velocity or displacement. An effective technique for displaying such vector data is to \"warp\" or deform geometry according to the vector field. For example, imagine representing the displacement of a structure under load by deforming the structure. Or if we are visualizing the flow of fluid, we can create a flow profile by distorting a straight line inserted perpendicular to the flow.

        (a) Vibration of beam. (b) Momentum profiles. Figure 6-14. Warping geometry to show vector field. (a) Beam displacement See PlateVibration.cxx and PlateVibration.py.); (b) See VelocityProfile.cxx and VelocityProfile.py.

        Figure 6-14 shows two examples of vector warping. In the first example the motion of a vibrating beam is shown. The original undeformed outline is shown in wireframe. The second example shows warped planes in a structured grid dataset. The planes are warped according to flow momentum. The relative back and forward flow are clearly visible in the deformation of the planes.

        Typically, we must scale the vector field to control geometric distortion. Too small a distortion may not be visible, while too large a distortion can cause the structure to turn inside out or self-intersect. In such a case the viewer of the visualization is likely to lose context, and the visualization will become ineffective.

        "},{"location":"VTKBook/06Chapter6/#displacement-plots","title":"Displacement Plots","text":"

        Vector displacement on the surface of an object can be visualized with displacement plots. A displacement plot shows the motion of an object in the direction perpendicular to its surface. The object motion is caused by an applied vector field. In a typical application the vector field is a displacement or strain field.

        Vector displacement plots draw on the ideas in \"Scalar Generation\". Vectors are converted to scalars by computing the dot product between the surface normal and vector at each point (Figure 6-15 (a)). If positive values result, the motion at the point is in the direction of the surface normal (i.e., positive displacement). Negative values indicate that the motion is opposite the surface normal (i.e., negative displacement).

        A useful application of this technique is the study of vibration. In vibration analysis, we are interested in the eigenvalues (i.e., natural resonant frequencies) and eigenvectors (i.e., mode shapes) of a structure. To understand mode shapes we can use displacement plots to indicate regions of motion. There are special regions in the structure where positive displacement changes to negative displacement. These are regions of zero displacement. When plotted on the surface of the structure, these regions appear as the so-called modal lines of vibration. The study of modal lines has long been an important visualization tool for understanding mode shapes.

        Figure 6-15. (a) Scalar Computation. Figure 6-15. Vector displacement plots. (a) Vector converted to scalar via dot product computation; (b) Surface plot of vibrating plate. Dark areas show nodal lines. Bright areas show maximum motion. See DisplacementPlot.cxx and DisplacementPlot.py.

        Figure 6-15 (b) shows modal lines for a vibrating rectangular beam. The vibration mode in this figure is the second torsional mode, clearly indicated by the crossing modal lines. (The aliasing in the figure is because of the coarseness of the analysis mesh.) To create the figure we combined the procedure of Figure 6-15 (a) with a special lookup table. The lookup table was arranged with dark areas in the center (i.e., corresponds to zero dot product) and bright areas at the beginning and end of the table (corresponds to 1 or -1 dot product). As a result, regions of large normal displacement are bright and regions near the modal lines are dark."},{"location":"VTKBook/06Chapter6/#time-animation","title":"Time Animation","text":"

        Some of the techniques described so far can be thought of as moving a point or object over a small time step. The hedgehog line is an approximation of a point's motion over a time period whose duration is given by the scale factor. In other words, if velocity \\vec{V} = dx/dt, then displacement of a point is

        \\begin{equation*} \\text{d}\\vec{x} = \\vec{V} \\text{d}t \\end{equation*} \\bf\\tag{6-1}

        This suggests an extension to our previous techniques: repeatedly displace points over many time steps. Figure 6-16 shows such an approach. Beginning with a sphere S centered about some point C, we move S repeatedly to generate the bubbles shown. The eye tends to trace out a path by connecting the bubbles, giving the observer a qualitative understanding of the fluid flow in that area. The bubbles may be displayed as an animation over time (giving the illusion of motion) or as a multiple exposure sequence (giving the appearance of a path). Figure 6-16. Time animation of a point C. Although the spacing between points varies, the time increment between each point is constant.

        Such an approach can be misused. For one thing, the velocity at a point is instantaneous.

        Once we move away from the point the velocity is likely to change. Using Equation6-1 above assumes that the velocity is constant over the entire step. By taking large steps we are likely to jump over changes in the velocity. Using smaller steps we will end in a different position. Thus the choice of step size is a critical parameter in constructing accurate visualization of particle paths in a vector field.

        To evaluate Equation6-1 we can express it as an integral:

        \\vec{x}(t) = \\int_{t}\\vec{V}dt \\bf\\tag{6-2}

        Although this form cannot be solved analytically for most real world data, its solution can be approximated using numerical integration techniques. Accurate numerical integration is a topic beyond the scope of this book, but it is known that the accuracy of the integration is a function of the step size dt. Since the path is an integration throughout the dataset, the accuracy of the cell interpolation functions, as well as the accuracy of the original vector data, plays an important role in realizing accurate solutions. No definitive study is yet available that relates cell size or interpolation function characteristics to visualization error. But the lesson is clear: the result of numerical integration must be examined carefully, especially in regions of large vector field gradient. However, as with many other visualization algorithms, the insight gained by using vector integration techniques is qualitatively beneficial, despite the unavoidable numerical errors.

        The simplest form of numerical integration is Euler's method,

        \\vec{x}_{i+1} = \\vec{x}_i + \\vec{V}_i\\Delta{t} \\bf\\tag{6-3}

        where the position at time is the \\vec{x}_{i+} vector sum of the previous position plus the instantaneous velocity times the incremental time step \\Delta{t}.

        Euler's method has error on the order of O(\\Delta{t}^2), which is not accurate enough for some applications. One such example is shown in Figure 6-17. The velocity field describes perfect rotation about a central point. Using Euler's method we find that we will always diverge and, instead of generating circles, will generate spirals instead. Figure 6-17. Euler's integration (b) and RungeKutta integration of order 2 (c) applied to uniform rotational vector field (a). Euler's method will always diverge.

        In this text we will use the RungeKutta technique of order 2 [Conte72]. This is given by the expression

        \\vec{x}_{i+1} = \\vec{x}_i +\\frac{\\Delta t}{2}(\\vec{V}_i + \\vec{V}_{i+1}) \\bf\\tag{6-4}

        where the velocity \\vec{V}_{i+1} is computed using Euler's method. The error of this method is O(\\Delta{t^3}). Compared to Euler's method, the RungeKutta technique allows us to take a larger integration step at the expense of one additional function evaluation. Generally this tradeoff is beneficial, but like any numerical technique, the best method to use depends on the particular nature of the data. Higherorder techniques are also available, but generally not necessary, because the higher accuracy is countered by error in interpolation function or inherent in the data values. If you are interested in other integration formulas, please check the references at the end of the chapter.

        One final note about accuracy concerns. The errors involved in either perception or computation of visualizations is an open research area. The discussion in the preceding paragraph is a good example of this. There we characterized the error in streamline integration using conventional numerical integration arguments. But there is a problem with this argument. In visualization applications, we are integrating across cells whose function values are continuous, but whose derivatives are not. As the streamline crosses the cell boundary, subtle effects may occur that are not treated by the standard numerical analysis. Thus the standard arguments need to be extended for visualization applications.

        Integration formulas require repeated transformation from global to local coordinates. Consider moving a point through a dataset under the influence of a vector field. The first step is to identify the cell that contains the point. This operation is a search (see \"Searching\" in Chapter 8), plus a conversion to local coordinates. Once the cell is found, then the next step is to compute the velocity at that point by interpolating the velocity from the cell points. The point is then incrementally repositioned (using the integration formula Equation6-4). The process is then repeated until the point exits the dataset or the distance or time traversed exceeds some specified value.

        This process can be computationally demanding. There are two important steps we can take to improve performance.

        1. Improving search procedures. There are two distinct types of searches. Initially, the starting location of the particle must be determined by a global search procedure. Once the initial location of the point is determined in the dataset, an incremental search procedure can then be used. Incremental searching is efficient because the motion of the point is limited within a single cell, or at most across a cell boundary. Thus, the search space is greatly limited, and the incremental search is faster relative to the global search.

        2. Coordinate transformation. The cost of a coordinate transformation from global to local coordinates can be reduced if either of the following conditions are true: the local and global coordinate systems are identical with one another (or vary by xyz translation), or if the vector field is transformed from global space to local coordinate space. The image data coordinate system is an example of a local coordinates which are parallel to global coordinates, hence global to local coordinate transformation can be greatly accelerated. If the vector field is transformed into local coordinates (either as a preprocessing step or on a cellbycell basis), then the integration can proceed completely in local space. Once the integration path is computed, selected points along the path can be transformed into global space for the sake of visualization.

        "},{"location":"VTKBook/06Chapter6/#streamlines","title":"Streamlines","text":"

        A natural extension of the previous time animation techniques is to connect the point position over many time steps. The result is a numerical approximation to a particle trace represented as a line.

        Borrowing terminology from the study of fluid flow, we can define three related line representation schemes for vector fields.

        • Particle traces are trajectories traced by fluid particles over time.

        • Streaklines are the set of particle traces at a particular time t_ithrough a specified point x_i.

        • Streamlines are integral curves along a curve s satisfying the equation

        \\vec{s}(t) = \\int_{\\tau = t_0}^{t} \\vec{V}\\left(\\vec{s}\\left(\\tau\\right)\\right)\\text{d}\\tau \\bf\\tag{6-5}

        for a particular time t.

        Streamlines, streaklines, and particle traces are equivalent to one another if the flow is steady. In time varying flow, a given streamline exists only at one moment in time. Visualization systems generally provide facilities to compute particle traces. However, if time is fixed, the same facility can be used to compute streamlines. In general, we will use the term streamline to refer to the method of tracing trajectories in a vector field. Please bear in mind the differences in these representations if the flow is time varying.

        Figure 6-18 shows forty streamlines in a small kitchen. The room has two windows, a door (with air leakage), and a cooking area with a hot stove. The air leakage and temperature variation combine to produce air convection currents throughout the kitchen. The starting positions of the streamlines were defined by creating a rake, or curve (and its associated points). Here the rake was a straight line. These streamlines clearly show features of the flow field. By releasing many streamlines simultaneously we obtain even more information, as the eye tends to assemble nearby streamlines into a \"global\" understanding of flow field features. Figure 6-18. Flow velocity computed for a small kitchen (top and side view). Forty streamlines start along the rake positioned under the window. Some eventually travel over the hot stove and are convected upwards. See Kitchen.cxx and Kitchen.py.

        Many enhancements of streamline visualization exist. Lines can be colored according to velocity magnitude to indicate speed of flow. Other scalar quantities such as temperature or pressure also may be used to color the lines. We also may create constant time dashed lines. Each dash represents a constant time increment. Thus, in areas of high velocity, the length of the dash will be greater relative to regions of lower velocity. These techniques are illustrated in Figure 6-19 for airflow around a blunt fin. This example consists of a wall with half a rounded fin projecting into the fluid flow. (Using arguments of symmetry, only half of the domain was modeled.) Twenty five streamlines are released upstream of the fin. The boundary layer effects near the junction of the fin and wall are clearly evident from the streamlines. In this area, flow recirculation is apparent, as well as the reduced flow speed."},{"location":"VTKBook/06Chapter6/#64-tensor-algorithms","title":"6.4 Tensor Algorithms","text":"

        As we mentioned earlier, tensor visualization is an active area of research. However there are a few simple techniques that we can use to visualize real 3 \\times 3 symmetric tensors. Such tensors are used to describe the state of displacement or stress in a 3D material. The stress and strain tensors for an elastic material are shown in Figure 6-20.

        In these tensors the diagonal coefficients are the so-called normal stresses and strains, and the off diagonal terms are the shear stresses and strains. Normal stresses and strains act perpendicular to a specified surface, while shear stresses and strains act tangentially to the surface. Normal stress is either compression or tension, depending on the sign of the coefficient.

        Figure 6-19. Vector visualization techniques. See BluntStreamlines.cxx and See BluntStreamlines.py.

        A 3 \\times 3 real symmetric matrix can be characterized by three vectors in 3D called the eigenvectors, and three numbers called the eigenvalues of the matrix. The eigenvectors form a 3D coordinate system whose axes are mutually perpendicular. In some applications, particularly the study of materials, these axes also are referred to as the principle axes of the tensor and are physically significant. For example, if the tensor is a stress tensor, then the principle axes are the directions of normal stress and no shear stress. Associated with each eigenvector is an eigenvalue. The eigenvalues are often physically significant as well. In the study of vibration, eigenvalues correspond to the resonant frequencies of a structure, and the eigenvectors are the associated mode shapes.

        Mathematically we can represent eigenvalues and eigenvectors as follows. Given a matrix the eigenvector and eigenvalue must satisfy the relation

        A \\cdot \\vec{x} = \\lambda \\vec{x} \\bf\\tag{6-6}

        For Equation6-6 to hold, the matrix determinate must satisfy

        det |A-\\lambda I| = 0 \\bf\\tag{6-7}

        Expanding this equation yields a n^{th} degree polynomial in \\lambda whose roots are the eigenvalues. Thus, there are always n eigenvalues, although they may not be distinct. In general, Equation6-7 is not solved using polynomial root searching because of poor computational performance. (For matrices of order 3 root searching is acceptable because we can solve for the eigenvalues analytically.) Once we determine the eigenvalues, we can substitute each into Equation6-7 to solve for the associated eigenvectors.

        Figure 6-20. Stress and strain tensors. Normal stresses in the x-y-z coordinate directions indicated as *sigma*, shear stresses indicated as *tau*. Material displacement represented by (u, v, w) components.

        We can express the eigenvectors of the 3 \\times 3 system as

        \\vec{v_i} = \\lambda _i \\vec{e_i} \\ with\\ i = 1,2,3 \\bf\\tag{6-8}

        \\vec{e_i} a unit vector in the direction of the eigenvalue, and \\lambda{_i} the eigenvalues of the system. If we order eigenvalues such that

        \\lambda{_1} \\geq \\lambda{_2} \\geq \\lambda{_3} \\bf\\tag{6-9}

        then we refer to the corresponding eigenvectors \\vec{v_1}, \\vec{v_2} and \\vec{v_1} as the major, medium and minor eigenvectors.

        "},{"location":"VTKBook/06Chapter6/#tensor-ellipsoids","title":"Tensor Ellipsoids","text":"

        This leads us to the tensor ellipsoid technique for the visualization of real, symmetric matrices. The first step is to extract eigenvalues and eigenvectors as described in the previous section. Since eigenvectors are known to be orthogonal, the eigenvectors form a local coordinate system. These axes can be taken as the minor, medium and major axes of an ellipsoid. Thus, the shape and orientation of the ellipsoid represent the relative size of the eigenvalues and the orientation of the eigenvectors.

        To form the ellipsoid we begin by positioning a sphere at the tensor location. The sphere is then rotated around its origin using the eigenvectors, which in the form of Equation6-8 are direction cosines. The eigenvalues are used to scale the sphere. Using 4 x 4 transformation matrices and referring to Equation3-6, Equation3-9 and Equation3-13, we form the ellipsoid by transforming the sphere centered at the origin using the matrix T

        T = T_T \\cdot T_R \\cdot T_S \\bf\\tag{6-10}

        (remember to read right to left). The eigenvectors can be directly plugged in to create the rotation matrix, while the point coordinates x-y-z and eigenvalues \\lambda{_1} \\geq \\lambda{_2} \\geq \\lambda{_3} are inserted into the translation and scaling matrices. A concatenation of these matrices forms the final transformation matrix T.

        Figure 6-21. Tensor ellipsoids. (a) Ellipsoid oriented along eigenvalues (i.e., principle axes) of tensor; (b) Pictorial description of Boussinesq's problem; (c) Analytic results according to Saada.

        Figure 6-21 (a) depicts the tensor ellipsoid technique. In Figure 6-21 (b) we show this technique to visualize material stress near a point load on the surface of a semi-infinite domain. (This is the so-called Boussinesq's problem.) From Saada [Saada74] we have the analytic expression for the stress components in Cartesian coordinates shown in Figure 6-21 (c). Note that the z-direction is defined as the axis originating at the point of application of the force P. The variable \\rho is the distance from the point of load application to a point x-y-z. The orientation of the x and y axes are in the plane perpendicular to the z axis. (The rotation in the plane of these axes is unimportant since the solution is symmetric around the z axis.) (The parameter \\nu is Poisson's ratio which is a property of the material. Poisson's ratio relates the lateral contraction of a material to axial elongation under a uniaxial stress condition. See [Saada74] or [Timoshenko70] for more information.) (a) Tensor axes (b) Tensor ellipsoids Figure 6-22. Tensor visualization techniques; (a) Tensor axes. See TensorAxes.cxx and TensorAxes.py (b) Tensor ellipsoids. See TensorEllipsoids.cxx and TensorEllipsoids.py

        In Figure 6-22 we visualize the analytical results of Boussinesq's problem from Saada. The top portion of the figure shows the results by displaying the scaled and oriented principal axes of the stress tensor. (These are called tensor axes.) In the bottom portion we use tensor ellipsoids to show the same result. Tensor ellipsoids and tensor axes are a form of glyph (see \"Glyphs\") specialized to tensor visualization.

        A certain amount of care must be taken to visualize this result since there is a stress singularity at the point of contact of the load. In a real application loads are applied over a small area and not at a single point. Also, plastic behavior prevents stress levels from exceeding a certain point. The results of the visualization, as with any computer process, are only as good as the underlying model.

        "},{"location":"VTKBook/06Chapter6/#65-modelling-algorithms","title":"6.5 Modelling Algorithms","text":"

        Modelling algorithms are the catchall category for our taxonomy of visualization techniques. Modelling algorithms have one thing in common: They create or change dataset geometry or topology.

        "},{"location":"VTKBook/06Chapter6/#source-objects","title":"Source Objects","text":"

        As we have seen in previous examples, source objects begin the visualization pipeline. Source objects are used to create geometry such as spheres, cones, or cubes to support visualization context or are used to read in data files. Source objects also may be used to create dataset attributes. Some examples of source objects and their use are as follows.

        Modelling Simple Geometry.

        Spheres, cones, cubes, and other simple geometric objects can be used alone or in combination to model geometry. Often we visualize real-world applications such as air flow in a room and need to show real-world objects such as furniture, windows, or doors.

        Real-world objects often can be represented using these simple geometric representations. These source objects generate their data procedurally. Alternatively, we may use reader objects to access geometric data defined in data files. These data files may contain more complex geometry such as that produced by a 3D CAD (ComputerAided Design) system.

        Supporting Geometry.

        During the visualization process we may use source objects to create supporting geometry. This may be as simple as three lines to represent a coordinate axis or as complex as tubes wrapped around line segments to thicken and enhance their appearance. Another common use is as supplemental input to objects such as streamlines or probe filters. These filters take a second input that defines a set of points. For streamlines, the points determine the initial positions for generating the streamlines. The probe filter uses the points as the position to compute attribute values such as scalars, vectors, or tensors.

        Data Attribute Creation.

        Source objects can be used as procedures to create data attributes. For example, we can procedurally create textures and texture coordinates. Another use is to create scalar values over a uniform grid. If the scalar values are generated from a mathematical function, then we can use the visualization techniques described here to visualize the function. In fact, this leads us to a very important class of source objects: implicit functions.

        "},{"location":"VTKBook/06Chapter6/#implicit-functions","title":"Implicit Functions","text":"

        Implicit functions are functions of the form

        F(x,y,z) = c \\bf\\tag{6-11}

        where c is an arbitrary constant. Implicit functions have three important properties.

        • Simple geometric description. Implicit functions are convenient tools to describe common geometric shapes. This includes planes, spheres, cylinders, cones, ellipsoids, and quadrics.

        • Region separation. Implicit functions separate 3D Euclidean space into three distinct regions. These regions are inside, on, and outside the implicit function. These regions are defined as F(x,y,z) < 0, F(x,y,z) = 0 and F(x,y,z) > 0, respectively.

        • Scalar generation. Implicit functions convert a position in space into a scalar value. That is, given an implicit function we can sample it at a point (x_i,y_i,z_i) to generate a scalar value c_i.

        An example of an implicit function is the equation for a sphere of radius R.

        F(x,y,z) = x^2 + y^2 + z^2 - R^2 \\bf\\tag{6-12}

        This simple relationship defines the three regions (on F(x,y,z = 0)s onthe sphere), F(x,y,z) < 0 (inside the sphere), and F(x,y,z) (outside the sphere). Any point may be classified inside, on, or outside the sphere simply by evaluating Equation6-12.

        Figure 6-23a. (a) Sphere sampling (b) Isosurface of Sphere (c) BooleanCombinations Figure 6-23. Sampling functions. (b) Isosurface of sampled sphere; See ImplicitSphere.cxx and ImplicitSphere.py; (c) Boolean combination of two spheres, a cone, and two planes. (One sphere intersects the other, the planes clip the cone. See IceCream.cxx and IceCream.py.

        Modelling Objects.

        Implicit functions can be used alone or in combination to model geometric objects. For example, to model a surface described by an implicit function, we sample F on a dataset and generate an isosurface at a contour value c_i. The result is a polygonal representation of the function. *Figure 6-23b shows an isosurface for a sphere of radius=1 sampled on a volume. Note that we can choose nonzero contour values to generate a family of offset surfaces. This is useful for creating blending functions and other special effects.

        Implicit functions can be combined to create complex objects using the boolean operators union, intersection, and difference. The union operation between F\\cup G between two functions F(x,y,z) and G(x,y,z) is the minimum value

        \\begin{equation*} F \\cup G = \\lbrace \\max\\left(F\\left(\\vec{x}\\right), G\\left(\\vec{x}\\right)\\right)\\, \\vert \\, \\vec{x} \\in \\mathbb{R}^n \\rbrace \\end{equation*} \\bf\\tag{6-13}

        The intersection between two implicit functions is given by

        \\begin{equation*} F \\cap G = \\lbrace \\min\\left(F\\left(\\vec{x}\\right), G\\left(\\vec{x}\\right)\\right)\\, \\vert \\, \\vec{x} \\in \\mathbb{R}^n \\rbrace \\end{equation*} \\bf\\tag{6-14}

        The difference of two implicit functions is given by

        \\begin{equation*} F - G = \\lbrace \\min\\left(F\\left(\\vec{x}\\right), -G\\left(\\vec{x}\\right)\\right)\\, \\vert \\, \\vec{x} \\in \\mathbb{R}^n \\rbrace \\end{equation*} \\bf\\tag{6-15}

        Figure 6-23c shows a combination of simple implicit functions to create an ice-cream cone. The cone is created by clipping the (infinite) cone function with two planes. The ice cream is constructed by performing a difference operation on a larger sphere with a smaller offset sphere to create the \"bite.\" The resulting surface was extracted using surface contouring with isosurface value 0.0.

        (a) Selecting data with implicit function (b) Selecting data with boolean combination

        Figure 6-24. Implicit functions used to select data: (a) 2D cells lying in ellipse are selected; (b) Two ellipsoids combined using the union operation used to select voxels from a volume. Voxels shrunk 50 percent. See ExtractData.cxx and ExtractData.py.

        Selecting Data.

        We can take advantage of the properties of implicit functions to select and cut data. In particular we will use the region separation property to select data. (We defer the discussion on cutting to \"Cutting\".)

        Selecting or extracting data with an implicit function means choosing cells and points (and associated attribute data) that lie within a particular region of the function. To determine whether a point xyz lies within a region, we simply evaluate the point and examine the sign of the result. A cell lies in a region if all its points lie in the region.

        Figure 6-24 (a) shows a 2D implicit function, here an ellipse, used to select the data (i.e., points, cells, and data attributes) contained within it. Boolean combinations also can be used to create complex selection regions as illustrated in Figure 6-24 (b). Here, two ellipses are used in combination to select voxels within a volume dataset. Note that extracting data often changes the structure of the dataset. In Figure 6-24 the input type is a image data dataset, while the output type is an unstructured grid dataset.

        Visualizing Mathematical Descriptions.

        Some functions, often discrete or probabilistic in nature, cannot be cast into the form of Equation6-11. However, by applying some creative thinking we can often generate scalar values that can be visualized. An interesting example of this is the so-called strange attractor.

        Strange attractors arise in the study of nonlinear dynamics and chaotic systems. In these systems, the usual types of dynamic motion --- equilibrium, periodic motion, or quasi-periodic motion --- are not present. Instead, the system exhibits chaotic motion. The resulting behavior of the system can change radically as a result of small perturbations in its initial conditions.

        Figure 6-25. Visualizing a Lorenz strange attractor by integrating the Lorenz equations in a volume. The number of visits in each voxel is recorded as a scalar function. The surface is extracted via marching cubes using a visit value of 50. The number of integration steps is 10 million, in a volume of dimensions 200^3. The surface roughness is caused by the discrete nature of the evaluation function. See Lorenz.cxx and Lorenz.py.

        A classical strange attractor was developed by Lorenz in 1963 [Lorenz63]. Lorenz developed a simple model for thermally induced fluid convection in the atmosphere. Convection causes rings of rotating fluid and can be developed from the general NavierStokes partial differential equations for fluid flow. The Lorenz equations can be expressed in nondimensional form as

        \\begin{eqnarray*} \\frac{\\text{d}x}{\\text{d}t} &=& \\sigma (y - z) \\\\ \\frac{\\text{d}y}{\\text{d}t} &=& \\rho x - y - x z \\\\ \\frac{\\text{d}z}{\\text{d}t} &=& x y - \\beta z \\end{eqnarray*} \\bf\\tag{6-16}

        where x is proportional to the fluid velocity in the fluid ring, y and zz measure the fluid temperature in the plane of the ring, the parameters \\sigma and \\rho are related to the Prandtl number and Raleigh number, respectively, and \\beta is a geometric factor.

        Certainly these equations are not in the implicit form of Equation6-11, so how do we visualize them? Our solution is to treat the variables x, y, and z as the coordinates of a three-dimensional space, and integrate Equation6-16 to generate the system \"trajectory\", that is, the state of the system through time. The integration is carried out within a volume and scalars are created by counting the number of times each voxel is visited. By integrating long enough, we can create a volume representing the \"surface\" of the strange attractor, Figure 6-25. The surface of the strange attractor is extracted by using marching cubes and a scalar value specifying the number of visits in a voxel. Figure 6-26. Distance functions to a point, line, and triangle."},{"location":"VTKBook/06Chapter6/#implicit-modelling","title":"Implicit Modelling","text":"

        In the previous section we saw how implicit functions, or boolean combinations of implicit functions, could be used to model geometric objects. The basic approach is to evaluate these functions on a regular array of points, or volume, and then to generate scalar values at each point in the volume. Then either volume rendering (\"Volume Rendering\"), or isosurface generation in combination with surface rendering, is used to display the model.

        An extension of this approach, called implicit modeling, is similar to modeling with implicit functions. The difference lies in the fact that scalars are generated using a distance function instead of the usual implicit function. The distance function is computed as a Euclidean distance to a set of generating primitives such as points, lines, or polygons. For example, Figure 6-26 shows the distance functions to a point, line, and triangle. Because distance functions are well-behaved monotonic functions, we can define a series of offset surfaces by specifying different isosurface values, where the value is the distance to the generating primitive. The isosurfaces form approximations to the true offset surfaces, but using high volume resolution we can achieve satisfactory results.

        Used alone the generating primitives are limited in their ability to model complex geometry. By using boolean combinations of the primitives, however, complex geometry can be easily modeled. The boolean operations union, intersection, and difference (Equation6-13, Equation6-14, and Equation6-15, respectively) are illustrated in Figure 6-27. Figure 6-28 shows the application of implicit modeling to \"thicken\" the line segments in the text symbol \"HELLO\". The isosurface is generated on a volume 110 \\times 40 \\times 20 at a distance offset of 0.25 units. The generating primitives were combined using the boolean union operator. Although Euclidean distance is always a nonnegative value, it is possible to use a signed distance function for objects that have an outside and an inside. A negative distance is the negated distance of a point inside the object to the surface of the object. Using a signed distance function allows us to create offset surfaces that are contained within the actual surface. Another interesting feature of implicit modeling is that when isosurfaces are generated, more than one connected surface can result. These situations occur when the generating primitives form concave features. Figure 6-29 illustrates this situation. If desired, multiple surfaces can be separated by using the connectivity algorithm described in \"Connectivity\" in Chapter 9. Figure 6-27. Boolean operations using points and lines as generating primitives. Figure 6-28. Implicit modelling used to thicken a stroked font. Original lines can be seen within the translucent implicit surface. See Hello.cxx and Hello.py. Figure 6-29. Concave features can result in multiple contour lines/surfaces."},{"location":"VTKBook/06Chapter6/#glyphs","title":"Glyphs","text":"

        Glyphs, sometimes referred to as icons, are a versatile technique to visualize data of every type. A glyph is an \"object\" that is affected by its input data. This object may be geometry, a dataset, or a graphical image. The glyph may orient, scale, translate, deform, or somehow alter the appearance of the object in response to data. We have already seen a simple form of glyph: hedgehogs are lines that are oriented, translated and scaled according to the position and vector value of a point. A variation of this is to use oriented cones or arrows. (See \"Hedgehogs and Oriented Glyphs\" in this Chapter for more information.)

        More elaborate glyphs are possible. In one creative visualization technique Chernoff [Chernoff73] tied data values to an iconic representation of the human face. Eyebrows, nose, mouth, and other features were modified according to financial data values. This interesting technique built on the human capability to recognize facial expression. By tying appropriate data values to facial characteristics, rapid identification of important data points is possible.

        Figure 6-30 Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected. See SpikeFran.cxx and SpikeFran.py.

        In a sense, glyphs represent the fundamental result of the visualization process. Moreover, all the visualization techniques we present can be treated as concrete representations of an abstract glyph class. For example, while hedgehogs are an obvious manifestation of a vector glyph, isosurfaces can be considered a topologically two-dimensional glyph for scalar data. Delmarcelle and Hesselink [Delmarcelle95] have developed a unified framework for flow visualization based on types of glyphs. They classify glyphs according to one of three categories.

        • Elementary icons represent their data across the extent of their spatial domain. For example, an oriented arrow can be used to represent surface normal.

        • Local icons represent elementary information plus a local distribution of the values around the spatial domain. A surface normal vector colored by local curvature is one example of a local icon, since local data beyond the elementary information is encoded.

        • Global icons show the structure of the complete dataset. An isosurface is an example of a global icon.

        This classification scheme can be extended to other visualization techniques such as vector and tensor data, or even to non-visual forms such as sound or tactile feedback. We have found this classification scheme to be helpful when designing visualizations or creating visualization techniques. Often it gives insight into ways of representing data that can be overlooked.

        Figure 6-30 is an example of glyphing. Small 3D cones are oriented on a surface to indicate the direction of the surface normal. A similar approach could be used to show other surface properties such as curvature or anatomical keypoints."},{"location":"VTKBook/06Chapter6/#cutting","title":"Cutting","text":"

        Often we want to cut through a dataset with a surface and then display the interpolated data values on the surface. We refer to this technique as data cutting or simply cutting. The data cutting operation requires two pieces of information: a definition for the surface and a dataset to cut. We will assume that the cutting surface is defined by an implicit function. A typical application of cutting is to slice through a dataset with a plane, and color map the scalar data and/or warp the plane according to vector value.

        Figure 6-31. Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. See CutStructuredGrid.cxx and CutStructuredGrid.py.

        A property of implicit functions is to convert a position into a scalar value (see \"Implicit Functions\" in this Chapter). We can use this property in combination with a contouring algorithm (e.g., marching cubes) to generate cut surfaces. The basic idea is to generate scalars for each point of each cell of a dataset (using the implicit cut function), and then contour the surface value F(x,y,z) = 0.

        The cutting algorithm proceeds as follows. For each cell, function values are generated by evaluating F(x,y,z) for each cell point. If all the points evaluate positive or negative, then the surface does not cut the cell. However, if the points evaluate positive and negative, then the surface passes through the cell. We can use the cell contouring operation to generate the isosurface F(x,y,z) = 0. Data attribute values can then be computed by interpolating along cut edges.

        Figure 6-31 illustrates a plane cut through a structured grid dataset. The plane passes through the center of the dataset with normal (--0.287, 0, 0.9579). For comparison purposes a portion of the grid geometry is also shown. The grid geometry is the grid surface k=9 (shown in wireframe). A benefit of cut surfaces is that we can view data on (nearly) arbitrary surfaces. Thus, the structure of the dataset does not constrain how we view the data.

        We can easily make multiple planar cuts through a structured grid dataset by specifying multiple isovalues for the cutting algorithm. Figure 6-32 shows 100 cut planes generated perpendicular to the camera's view plane normal. Rendering the planes from back to front with an opacity of 0.05 produces a simulation of volume rendering (see \"Volume Rendering\" in Chapter 7). Figure 6-32. 100 cut planes with opacity of 0.05. Rendered back-to-front to simulate volume rendering. See PseudoVolumeRendering.cxx and PseudoVolumeRendering.py.

        This example illustrates that cutting the volumetric data in a structured grid dataset produced polygonal cells. Similarly, cutting polygonal data produces lines. Using a single plane equation, we can extract \"contour lines\" from a surface model defined with polygons. Figure 6-33 shows contours extracted from a surface model of the skin. At each vertex in the surface model we evaluate the equation of the plane and F(x.y.z) = c and store the value c of the function as a scalar value. Cutting the data with 46 isovalues from 1.5 to 136.5 produces contour lines that are 3 units apart. Figure 6-33. Cutting a surface model of the skin with a series of planes produces contour lines. Lines are wrapped with tubes for clarity. See CutWithScalars.cxx and CutWithScalars.py."},{"location":"VTKBook/06Chapter6/#66-putting-it-all-together","title":"6.6 Putting It All Together","text":""},{"location":"VTKBook/06Chapter6/#process-object-design","title":"Process Object Design","text":"

        Algorithms are implemented in the Visualization Toolkit as process objects. These objects may be either sources, filters, or mappers (see \"The Visualization Pipeline\" in Chapter 4). In this section we will describe how these objects are implemented.

        Source Design.

        (a) Functional Model (b) Object Models Figure 6-34. Source object design. Example shown is a source object that creates a polygonal representation of a sphere.

        Source objects have no visualization data for input and one or more outputs, Figure 6-34. To create a source object, inheritance is used to specify the type of dataset that the process object creates for output. vtkSphereSource. This class inherits from vtkPolyDataAlgorithm, indicating that it creates polygonal data on output.

        Filter Design

        Filter objects have one or more inputs and one or more outputs as shown in Figure 6-35. (You may also refer to \"Pipeline Design and Implementation\" in Chapter 4.) To create Figure 6-35 a filter object, inheritance is used to specify the type of input and output data objects. illustrates this for the concrete source object vtkContourFilter (which implements marching cubes and other contouring techniques). It is worth examining this object diagram in detail since it is the basis for the architecture of the visualization pipeline. (a) Functional Model (b) Object Models Figure 6-35. Filter object design. The example shown is for an object that receives a general dataset as input and creates polygonal data on output.

        The superclasses of vtkContourFilter are vtkAlgorithm and vtkPolyDataAlgorithm. The class vtkPolyDataAlgorithm specifies the type of data vtkContourFilter produces on output (i.e., a vtkPolyData). Because this filter should take any subclass of vtkDataSet as input, it must override its superclasses implementation of the FillInputPortInformation() method to specify this. Note that inheritance from vtkPolyDataAlgorithm is optional---this functionality could be implemented directly in vtkContourFilter. This optional superclass is simply a convenience object to make class derivation a little easier.

        What is left for vtkContourFilter to implement is its RequestData() method (as well as constructor, print method, and any other methods special to this class). Thus the primary difference between classes with equivalent inheritance hierarchies is the implementation of the RequestData() method.

        Subclasses of vtkAlgorithm enforce filter input and output type by use of the FillInputPortInformation() and FillOutputPortInformation() methods. By default, its subclass [vtkDataSet](https://www.vtk.org/doc/nightly/html/classvtkDataSet.html#details)Algorithm accepts input type vtkDataSet (or subclasses) and produces a vtkDataSet on output. (The type of the output is determined by the type of the input.) Since vtkDataSet is a base class for all data types, subclasses of [vtkDataSet](https://www.vtk.org/doc/nightly/html/classvtkDataSet.html#details)Algorithm will accept any type as input. Specialized filters are derived from other classes. For example, filters that accept polygonal data might be derived from vtkPolyDataAlgorithm, and filters that accept unstructured grid datasets might be derived from vtkUnstructuredGridAlgorithm.

        We encourage you to examine the source code carefully for a few filter and source objects.

        The architecture is simple enough that you can grasp it quickly.

        "},{"location":"VTKBook/06Chapter6/#mapper-design","title":"Mapper Design","text":"(a) Functional Models (b) Object Models Figure 6-36. Mapper object design. Graphics mapper shown (e.g., vtkPolyDataMapper) maps polygonal data through graphics library primitives. Writer shown (e.g., vtkSTLWriter) writes polygonal data to stereo lithography format.

        Mapper objects have one or more inputs and no visualization data output, Figure 6-36. Two different types of mappers are available in the Visualization Toolkit : graphics mappers and writers. Graphics mappers interface geometric structure and data attributes to the graphics library; writers write datasets to disk or other I/O devices.

        Since mappers take datasets as input, type enforcement is required. Each mapper implements this functionality directly. For example, both classes [vtkPolyData](https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details)Mapper and vtkSTLWriter implement a SetInput() method to enforce the input to be of type vtkPolyData. Other mappers and writers enforce input type as appropriate.

        Although writers and mappers do not create visualization data, they both have methods similar to the RequestData() method of the sources and filters. Each subclass of vtkMapper must implement the Render() method. This method is exchanged by the graphics system actors and its associated mappers during the rendering process. The effect of the method is to map its input dataset to the appropriate rendering library/system. Subclasses of the class vtkWriter must implement the WriteData() method. This method causes the writer to write its input dataset to disk (or other I/O device).

        "},{"location":"VTKBook/06Chapter6/#color-maps","title":"Color Maps","text":"

        Color maps are created in the Visualization Toolkit using instances of the class vtkLookupTable. This class allows you to create a lookup table using HSVA (e.g., hue, saturation, value, and alpha opacity value) specification. Although we discussed the HSV color system in Chapter 3 - Computer Graphics Primer, we haven't yet defined alpha opacity. We shall do so in Chapter 7 - Advanced Computer Graphics, but until then consider the alpha value to be the opacity of an object. Alpha values of one indicate that the object is opaque, while alpha values of zero indicate that the object is transparent.

        The procedure for generating lookup table entries is to define pairs of values for HSVA. These pairs define a linear ramp for hue, saturation, value, and opacity. When the Build() method is invoked, these linear ramps are used to generate a table with the number of table entries requested. Alternatively, vtkLookupTable also enables you to load colors directly into the table. Thus, you build custom tables that cannot be simply expressed as linear ramps of HSVA values. To demonstrate this procedure, we specify a starting and ending value for each of the components of HSVA, then we will create a rainbow lookup table from blue to red by using the following C++ code.

        vtkLookupTable *lut = vtkLookupTable::New();\n  lut->SetHueRange(0.6667, 0.0);\n  lut->SetSaturationRange(1.0, 1.0);\n  lut->SetValueRange(1.0, 1.0);\n  lut->SetAlphaRange(1.0, 1.0);\n  lut->SetNumberOfColors(256);\n  lut->Build();\n

        Since the default values for SaturationRange, ValueRange, AlphaRange, and the number of lookup table colors are (1,1), (1,1), (1,1), and 256, respectively, we can simplify this process to the following

        vtkLookupTable *lut = vtkLookupTable::New();\n  lut->SetHueRange(0.6667, 0.0);\n  lut->Build();\n

        (The default values for HueRange are (0.0, 0.6667) --- a red to blue color table.)

        To build a black and white lookup table of 256 entries we use

        vtkLookupTable *lut = vtkLookupTable::New();\n  lut->SetHueRange(0.0, 0.0);\n  lut->SetSaturationRange(0.0, 0.0);\n  lut->SetValueRange(0.0, 1.0)\n

        In some cases you may want to specify colors directly. You can do this by specifying the number of colors, building the table, and then inserting new colors. When you insert colors, the RGBA color description system is used. For example, to create a lookup table of the three colors red, green, and blue, use the following C++ code.

        vtkLookupTable *lut = vtkLookupTable::New();\n  lut->SetNumberOfColors(3);\n  lut->Build();\n  lut->SetTableValue(0, 1.0, 0.0, 0.0, 1.0);\n  lut->SetTableValue(0, 0.0, 1.0, 0.0, 1.0);\n  lut->SetTableValue(0, 0.0, 0.0, 1.0, 1.0);\n

        Lookup tables in the Visualization Toolkit are associated with the graphics mappers. Mappers will automatically create a red to blue lookup table if no table is specified, but if you want to create your own, use the mapper->SetLookupTable(lut) operation where mapper is an instance of vtkMapper or its subclasses.

        A few final notes on using lookup tables.

        • Mappers use their lookup table to map scalar values to colors. If no scalars are present, the mappers and their lookup tables do not control the color of the object. Instead the vtkProperty object associated with the vtkActor class does. Use vtkProperty's method actor->GetProperty()->SetColor(r,g,b) where r, g, and b are floating point values specifying color.

        • If you want to prevent scalars from coloring your object, use vtkMapper's method mapper->ScalarVisibilityOff() to turn off color mapping. Then the actor's color will control the color of the object.

        • The scalar range (i.e., the range into which the colors are mapped) is specified with the mapper. Use the method mapper->SetScalarRange(min, max).

        You can also derive your own lookup table types. Look at vtkLogLookupTable for an example. This particular lookup table inherits from vtkLookupTable. It performs logarithmic mapping of scalar value to table entry, a useful capability when scalar values span many orders of magnitude.

        "},{"location":"VTKBook/06Chapter6/#implicit-functions_1","title":"Implicit Functions","text":"Figure 6-37. Inheritance hierarchy of vtkImplicitFunction and subclasses.

        As we have seen, implicit functions can be used for visualizing functions, creating geometry, and cutting or selecting datasets. VTK includes several implicit functions including a single plane (vtkPlane), multiple convex planes (vtkPlanes), spheres (vtkSphere), cones (vtkCone), cylinders (vtkCylinder), and the general quadric (vtkQuadric). The class vtkImplicitBoolean allows you to create boolean combinations of these implicit function primitives. Other implicit functions can be added to VTK by deriving from the abstract base class vtkImplicitFunction.

        The existing inheritance hierarchy for implicit functions is shown in Figure 6-37. Subclasses of vtkImplicitFunction must implement the two methods Evaluate() and Gradient(x). The method Evaluate() returns the value of the function at point (x,y,z), while the method Gradient() returns the gradient vector to the function at point (x,y,z)."},{"location":"VTKBook/06Chapter6/#contouring_1","title":"Contouring","text":"

        Scalar contouring is implemented in the Visualization Toolkit with vtkContourFilter. This filter object accepts as input any dataset type. Thus, vtkContourFilter treats every cell type and each cell type must provide a method for contouring itself.

        Contouring in VTK is implemented using variations of the marching cubes algorithm presented earlier. That is, a contour case table is associated with each cell type, so each cell will generate contouring primitives as appropriate. For example, the tetrahedron cell type implements \"marching tetrahedron\" and creates triangle primitives, while the triangle cell type implements \"marching triangles\" and generates lines segments.

        The implication of this arrangement is that vtkContourFilter will generate point, line, and surface contouring primitives depending on the combination of input cell types. Thus vtkContourFilter is completely general. We have created another contour filter, vtkMarchingCubes, that is specific to the dataset type image data (in particular, 3D volumes). These two filters allow us to compare (at least for this one algorithm) the cost of generality.

        Recall from \"Generality Versus Efficiency\" the issues regarding the trade-offs between general and specific algorithms. Figure 6-38 shows a comparison of CPU times for a volume dataset at, 64 \\times 64 \\times 93, and resolution 128 \\times 128 \\times 93. The volume is a CT dataset of a human head. Three cases were run. In the first case the vtkMarchingCubes object was used. The output of this filter is triangles plus point normals. In the second case, vtkContourFilter was run. The output of this filter is just triangles. In the last case, vtkContourFilter was combined with vtkPolyDataNormals (to generate point normals). The output of the combined filters is also triangles plus point normals.

        The execution times are normalized to the smallest dataset using the vtkMarchingCubes object. The results are clear: The specific object outperforms the general object by a factor of 1.4 to 7, depending on data size and whether normals are computed. The larger differences occur on the smaller datasets. This is because the ratio of voxel cells containing the isosurface to the total number of voxels is larger for smaller datasets. (Generally the total number of voxels increases as the resolution cubed, while the voxels containing the isosurface increase as the resolution squared.) As a result, more voxels are processed in the smaller datasets relative to the total number of voxels than in the larger datasets. When the datasets become larger, more voxels are \"empty\" and are not processed.

        Although these results do not represent all implementations or the behavior of other algorithms, they do point to the cost of generality. Of course, there is a cost to specialization as well. This cost is typically in programmer time, since the programmer must rewrite code to adapt to new circumstances and data. Like all trade-offs, resolution of this issue requires knowledge of the application.

        Figure 6-38. The cost of generality. Isosurface generation of three volumes of different sizes are compared. The results show normalized execution times for two different implementations of the marching cubes isosurface algorithm. The specialized filter is vtkMarchingCubes. The general algorithms are first vtkContourFilter and then in combination with vtkPolyDataNormals.

        An example use of vtkContourFilter is shown in Figure 6-39. This example is taken from Figure4-1, which is a visualization of a quadric function. The class vtkSampleFunction samples the implicit quadric function using the vtkQuadric class. Although vtkQuadric does not participate in the pipeline in terms of data flow, it is used to define and evaluate the quadric function. It is possible to generate one or more isolines/isosurfaces simultaneously using vtkContourFilter. As Figure 6-39 shows, we use the GenerateValues() method to specify a scalar range, and the number of contours within this range (including the initial and final scalar values). vtkContourFilter generates duplicate vertices, so we can use vtkCleanPolyData to remove them. To improve the rendered appearance of the isosurface, we use vtkPolyDataNormals to create surface normals. (We describe normal generation in Chapter 9 - Advanced Algorithms.)

        // Define implicit function\nvtkQuadric *quadric = vtkQuadric::New();\n  quadric->SetCoefficients(.5,1,.2,0,.1,0,0,.2,0,0);\nvtkSampleFunction *sample = vtkSampleFunction::New();\n  sample->SetSampleDimensions(50,50,50);\n  sample->SetImplicitFunction(quadric);\nvtkContourFilter *contour = vtkContourFilter::New();\n  contour->SetInputConnection(sample->GetOutputPort());\n  contour->GenerateValues(5,0,1.2);\nvtkPolyDataMapper *contourMapper = vtkPolyDataMapper::New();\n  contourMapper->SetInputConnection( contour->GetOutputPort());\n  contourMapper->SetScalarRange(0,1.2);\nvtkActor *contourActor = vtkActor::New();\n  contourActor->SetMapper(contourMapper);\n// Create outline\nvtkOutlineFilter *outline = vtkOutlineFilter::New();\n  outline->SetInputConnection(sample->GetOutputPort());\nvtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();\n  outlineMapper->SetInputConnection(outline->GetOutputPort());\nvtkActor *outlineActor = vtkActor::New();\n  outlineActor->SetMapper(outlineMapper);\n  outlineActor->GetProperty()->SetColor(0,0,0);\n
        Figure 6-39. Contouring quadric function. Pipeline topology, C++ code, and resulting image are shown. See ContourQuadric.cxx and ContourQuadric.py. Figure 6-40. Data flow into and out of the vtkGlyph3D class."},{"location":"VTKBook/06Chapter6/#cutting_1","title":"Cutting","text":"

        vtkCutter performs cutting of all VTK cell types. The SetValue() and GenerateValues() methods permit the user to specify which multiple scalar values to use for the cutting. vtkCutter requires an implicit function that will be evaluated at each point in the dataset. Then each cell is cut using the cell's Contour method. Any point attributes are interpolated to the resulting cut vertices. The sorting order for the generated polygonal data can be controlled with the SortBy method. The default sorting order, SortByValue(), processes cells in the inner loop for each contour value. SortByCell() processes the cutting value in the inner loop and produces polygonal data that is suitable for back to front rendering (see Figure 6-32). (The sorting order is useful when rendering with opacity as discussed in Chapter 7 - Advanced Computer Graphics.) Notice the similarity of this filter to the vtkContourFilter. Both of these objects contour datasets with multiple isovalues. vtkCutter uses an implicit function to calculate scalar values while vtkContourFilter uses the scalar data associated with the dataset's point data."},{"location":"VTKBook/06Chapter6/#glyphs_1","title":"Glyphs","text":"

        The vtkGlyph3D class provides a simple, yet powerful glyph capability in the Visualization Toolkit. vtkGlyph3D is an example of an object that takes multiple inputs (Figure 6-40). One input, specified with the SetInputConnection() method, defines a set of points and possible attribute data at those points. The second input, specified with the SetSourceConnection() method, defines a geometry to be copied to every point in the input dataset. The source is of type vtkPolyData. Hence, any filter, sequence of filters creating polygonal data, or a polygonal dataset may be used to describe the glyph's geometry.

        The behavior of an instance of vtkGlyph3D depends on the nature of the input data and the value of its instance variables. Generally, the input Source geometry will be copied to each point of the Input dataset. The geometry will be aligned along the input vector data and scaled according to the magnitude of the vector or the scalar value. In some cases, the point normal is used rather than the vector. Also, scaling can be turned on or off.

        We saw how to use vtkGlyph3D in the example given in Figure4--20. Cones were used as the glyph and were located at each point on the sphere, oriented along the sphere's surface normal.

        Figure 6-41. Inheritance hierarchy for vtkStreamer and subclasses."},{"location":"VTKBook/06Chapter6/#streamlines_1","title":"Streamlines","text":"

        Streamlines and particle motion require numerical integration to guide a point through the vector field. Vector visualization algorithms that we will see in later chapters also require numerical integration. As a result, we designed an object hierarchy that isolates the numerical integration process into a single base class. The base class is vtkStreamer and it is responsible for generating a particle path through a vector field of specified length (expressed as elapsed time). Each derived class of vtkStreamer takes advantage of this capability to move through the vector field but implements its own particular representational technique to depict particle motion. Streamlines (vtkStreamLine) draw connected lines while particle motion is shown by combining the output of vtkStreamPoints with the vtkGlyph3D object. Using vtkGlyph3D we can place spheres or oriented objects such as cones or arrows at points on the particle path created by vtkStreamPoints. The inheritance hierarchy for vtkStreamer and subclasses is shown in Figure 6-41.

        The integration method in vtkStreamer is implemented as a virtual function. Thus it can be overloaded as necessary. Possible reasons for overloading include implementing an integration technique of higher or lower accuracy, or creating a technique specialized to a particular dataset type. For example, the search process in a volume is much faster than it is for other dataset types, therefore, highly efficient vector integration techniques can be constructed.

        The vector integration technique in VTK will accommodate any cell type. Thus, integration through cells of any topological dimension is possible. If the cells are of topological dimension 2 or less, the integration process constrains particle motion to the surface (2D) or line (1D). The particle may only leave a cell by passing through the cell boundary, and traveling to a neighboring cell, or exiting the dataset.

        "},{"location":"VTKBook/06Chapter6/#abstract-filters","title":"Abstract Filters","text":"

        Attribute transformations create or modify data attributes without changing the topology or geometry of a dataset. Hence filters that implement attribute transformation (e.g., vtkElevationFilter) can accept any dataset type as input, and may generate any dataset type on output. Unfortunately, because filters must specialize the particular type of data they output, at first glance it appears that filters that create general dataset types on output are not feasible. This is because the type vtkDataSet is an abstract type and must be specialized to allow instantiation.

        Fortunately, there is a a solution to this dilemma. The solution is to use the \"virtual constructor\" NewInstance(). Although C++ does not allow virtual constructors, we can simulate it by creating a special virtual function that constructs a copy of the object that it is invoked on. For example, if this function is applied to a dataset instance of type vtkPolyData, the result will be a copy of that instance (Figure 6-42). (Note that we use reference counting to make copies and avoid duplicating memory.) The virtual constructor function NewInstance() is implemented in a number of VTK classes including datasets and cells. Figure 6-42. Depiction of data flow for abstract filter output. The output object type is the same as the input type.

        Using the virtual constructor we can construct filters that output abstract data types like vtkDataSet. We simply apply NewInstance() to the input of the filter. This will then return a pointer to a concrete object that is the output of the filter. The result is a general filter object that can accept any dataset type for input and creates the general vtkDataSet type as output. In VTK, this functionality has been implemented in the abstract class vtkDataSetAlgorithm.

        There are other filters that implement variations of this delegation technique. The class vtkPointSetAlgorithm is similar to vtkDataSetAlgorithm. This class takes as input any dataset whose geometry is explicitly defined via an instance of vtkPoints (or subclass), and generates on output an object of the same type (i.e., vtkPointSet). The class vtkMergeFilter combines dataset structure and point attributes from one or more input datasets. For example, you can read multiple files and combine the geometry/topology from one file with different scalars, vectors, and normals from other files.

        One difficulty using abstract filter types is that the output type may not match with the input type of a downstream filter. For example, the output of vtkElevationFilter is specified as vtkDataSet even though the input may be of type vtkPolyData, and we know from the previous discussion that the actual output type will be vtkPolyData. This difficulty is removed by using the filter vtkCastToConcrete, which allows you to runtime cast to the appropriate output type. In this case we would use the GetPolyDataOutput() from vtkCastToConcrete. After checking the validity of the cast, this method returns a dataset cast to vtkPolyData. Of course, this process requires that the input to vtkCastToConcrete be set before the output is requested.

        "},{"location":"VTKBook/06Chapter6/#visualizing-blood-flow","title":"Visualizing Blood Flow","text":"

        In this example we'll combine a few different techniques to visualize blood flow in the human carotid arteries. Our data contains both vectors that represent the velocity of blood and scalars that are proportional to the magnitude of the velocity (i.e., speed).

        We can provide context for the visualization by creating an isosurface of speed. This isosurface shows regions of fastest blood flow, and is similar to, but not the same as, the actual surface of the arteries. However, it provides us with a visual cue to the structure of the arteries. The first vector visualization technique we'll use is to generate vector glyphs (Unfortunately, we cannot just create glyphs at each point because of the number of points (over 167,000 points). To do so would result in a confusing mess, and the interactive speed would be poor. Instead, we'll use two filters to select a subset of the available points. These filters are vtkThresholdPoints and vtkMaskPoints.

        vtkThresholdPoints allows us to extract points that satisfy a certain threshold criterion. In our example, we choose points whose speed is greater than a specified value. This eliminates a large number of points, since most points lie outside the arteries and have a small speed value.

        The filter vtkMaskPoints allows us to select a subset of the available points. We specify the subset with the OnRatio instance variable. This instance variable indicates that every OnRatio point is to be selected. Thus, if the OnRatio is equal to one, all points will be selected, and if the OnRatio is equal to ten, every tenth point will be selected. This selection can be either uniform or random. Random point selection is set using the RandomModeOn() and RandomModeOff() methods.

        After selecting a subset of the original points, we can use the vtkGlyph3D filter in the usual way. A cone's orientation indicates blood flow direction, and its size and color correspond to the velocity magnitude. Figure 6-43 shows the pipeline, sample code, and a resulting image from this visualization. Note that we've implemented the example using the interpreted language Tcl. See Chapter 11 - Visualization on the Web if you want more information about Tcl.

        In the next part of this example we'll generate streamtubes of blood velocity. Again we use an isosurface of speed to provide us with context. The starting positions for the streamtubes were determined by experimenting with the data. Because of the way the data was measured and the resolution of the velocity field, many streamers travel outside the artery. This is because the boundary layer of the blood flow is not captured due to limitations in data resolution. Consequently, as the blood flows around curves, there is a component of the velocity field that directs the streamtube outside the artery. As a result it is hard to find starting positions for the streamtubes that yield interesting results. We use the source object vtkPointSource in combination with vtkThresholdPoints to work around this problem. vtkPointSource generates random points centered around a sphere of a specified radius. We need only find an approximate position for the starting points of the streamtubes and then generate a cloud of random seed points. vtkThresholdPoints is used to cull points that may be generated outside the regions of high flow velocity.

        Figure 6-44 shows the pipeline, sample Tcl code, and a resulting image from the visualization. Notice that the isosurface is shown in wireframe. This provides context, yet allows us to see the streamtubes within the isosurface.

        vtkStructuredPointsReader reader\n reader SetFileName \"$env(VTK_TEXTBOOK_DATA)/carotid.vtk\"\nvtkThresholdPoints threshold\n  threshold SetInputConnection [reader GetOutputPort]\n  threshold ThresholdByUpper 200\nvtkMaskPoints mask\n  mask SetInputConnection [Threshold GetOutputPort]\n  mask SetOnRatio 10\nvtkConeSource cone\n  cone SetResolution 3\n  cone SetHeight 1\n  cone SetRadius 0.25\nvtkGlyph3D cones\n  cones SetInputConnection [mask GetOutputPort]\n  cones SetSourceConnection [cone GetOutputPort]\n  cones SetScaleFactor 0.5\n  cones SetScaleModeToScaleByVector\nvtkLookupTable lut\n  lut SetHueRange.667 0.0\n  lut Build\nvtkPolyDataMapper vecMapper\n  vecMapper SetInputConnection [cones GetOutputPort]\n  vecMapper SetScalarRange 2 10\n  vecMapaper SetLookupTable lut\n
        Figure 6-43. Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude. See CarotidFlowGlyphs.cxx and CarotidFlowGlyphs.py. Figure 6-44. Visualizing blood flow in the human carotid arteries. Streamtubes of flow vectors (streamV.tcl). See CarotidFlow.cxx and CarotidFlow.py."},{"location":"VTKBook/06Chapter6/#67-chapter-summary","title":"6.7 Chapter Summary","text":"

        Visualization algorithms transform data from one form to another. These transformations can change or create new structure and/or attributes of a dataset. Structural transformations change either the topology or geometry of a dataset. Attribute transformations change dataset attributes such as scalars, vectors, normals, or texture coordinates.

        Algorithms are classified according to the type of data they operate on. Scalar, vector, and tensor algorithms operate on scalar, vector, and tensor data, respectively. Modelling algorithms operate on dataset geometry or topology, texture coordinates, or normals. Modelling algorithms also may include complex techniques that may represent combinations of different data types.

        Algorithms can be designed and implemented for general types of data or specialized for a specific type. General algorithms are typically less efficient than their specialized counterparts. Conversely, general algorithms are more flexible and do not require rewriting as new dataset types are introduced.

        Important scalar algorithms include color mapping and contouring. Color maps are used to map scalar values to color values. Contouring algorithms create isosurfaces or isolines to indicate areas of constant scalar value.

        Glyphs such as hedgehogs are useful for visualizing vector data. These techniques are limited by the number of glyphs that can be displayed at one time. Particle traces or streamlines are another important algorithm for vector field visualization. Collections of particle traces can convey something of the structure of a vector field.

        Real, symmetric tensors 3 \\times 3 can be characterized by their eigenvalues and eigenvectors.

        Tensors can be visualized using tensor ellipsoids or oriented axes.

        Implicit functions and sampling techniques can be used to make geometry, cut data, and visualize complex mathematical descriptions. Glyphs are objects whose appearance is associated with a particular data value. Glyphs are flexible and can be created to visualize a variety of data.

        "},{"location":"VTKBook/06Chapter6/#68-bibliographic-notes","title":"6.8 Bibliographic Notes","text":"

        Color mapping is a widely studied topic in imaging, computer graphics, visualization, and human factors. References [Durrett87] [Ware88] [Rheingans92] provide samples of the available literature. You also may want to learn about the physiological and psychological effects of color on perception. The text by Wyszecki and Stiles [Wyszecki82] serves as an introductory reference.

        Contouring is a widely studied technique in visualization because of its importance and popularity. Early techniques were developed for 2D data [Watson92]. Three-dimensional techniques were developed initially as contour connecting methods [Fuchs77] --- that is, given a series of 2D contours on evenly spaced planes, connect the contours to create a closed surface. Since the introduction of marching cubes [Lorensen87], many other techniques have been implemented. (A few of these include [Nielson91] [Montani94] and [Durst88]). A particularly interesting reference is given by Livnat et al. [Livnat96]. They show a contouring method with the addition of a preprocessing step that generates isocontours in near optimal time.

        Although we barely touched the topic, the study of chaos and chaotic vibrations is a delightfully interesting topic. Besides the original paper by Lorenz [Lorenz63], the book by Moon [Moon87] is a good place to start.

        Two- and three-dimensional vector plots have been used by computer analysts for many years [Fuller80]. Streamlines and streamribbons also have been applied to the visualization of complex flows [Volpe89]. Good general references on vector visualization techniques are given in [Helman90] and [Richter90].

        Tensor visualization techniques are relatively few in number. Most techniques are glyph oriented [Haber90] [deLeeuw93]. We will see a few more techniques in Chapter 9 - Advanced Algorithms.

        Blinn [Blinn82], Bloomental [Bloomenthal88] [Bloomenthal97] and Wyvill [Wyvill86] have been important contributors to implicit modeling. Implicit modeling is currently popular in computer graphics for modeling \"soft\" or \"blobby\" objects. These techniques are simple, powerful, and are becoming widely used for advanced computer graphics modeling.

        "},{"location":"VTKBook/06Chapter6/#69-references","title":"6.9 References","text":"

        [Abraham85] R. H. Abraham and Christopher D. Shaw. Dynamics The Geometry of Behavior. Aerial Press, Santa Cruz, CA, 1985.

        [Blinn82] J. F. Blinn. \"A Generalization of Algebraic Surface Drawing.\" ACM Transactions on Graphics. 1(3):235--256, July 1982.

        [Bloomenthal88] J. Bloomenthal. \"Polygonization of Implicit Surfaces.\" Computer Aided Geometric Design . 5(4):341--355, November 1982.

        [Bloomenthal97] J. Bloomenthal, editor. Introduction to Implicit Surfaces. Morgan Kaufmann Publishers, Inc., San Francisco, CA., 1997.

        [Chernoff73] H. Chernoff. \"Using Faces to Represent Points in K-Dimensional Space Graphically.\" J. American Statistical Association. 68:361--368, 1973.

        [Cline93] H. Cline, W. Lorensen, and W. Schroeder. \"3D Phase Contrast MRI of Cerebral Blood Flow and Surface Anatomy.\" Journal of Computer Assisted Tomography. 17(2):173--177, March/April 1993.

        [Conte72] S. D. Conte and C. de Boor. Elementary Numerical Analysis. McGrawHill Book Company, 1972.

        [deLeeuw93]. W. C. de Leeuw and J. J. van Wijk. \"A Probe for Local Flow Field Visualization.\" In Proceedings of Visualization '93. pp. 39--45, IEEE Computer Society Press, Los Alamitos, CA, 1993.

        [Delmarcelle95] T. Delmarcelle and L. Hesselink. \"A Unified Framework for Flow Visualization.\" In Computer Visualization Graphics Techniques for Scientific and Engineering Analysis*. R. S. Gallagher, ed. CRC Press, Boca Raton, FL, 1995.

        [Durrett87] H. J. Durrett, ed. Color and the Computer. Academic Press, Boston, MA, 1987.

        [Durst88] M. J. Durst. \"Additional Reference to Marching Cubes.\" Computer Graphics. 22(2):72--73, 1988.

        [Fuchs77] H. Fuchs, Z. M. Kedem, and S. P. Uselton. \"Optimal Surface Reconstruction from Planar Contours.\" Communications of the ACM. 20(10):693--702, 1977.

        [Fuller80]cA. J. Fuller and M.L.X. dosSantos. \"Computer Generated Display of 3D Vector Fields.\" Computer Aided Design. 12(2):61--66, 1980.

        [Haber90] R. B. Haber and D. A. McNabb. \"Visualization Idioms: A Conceptual Model to Scientific Visualization Systems.\" Visualization in Scientific Computing, G. M. Nielson, B. Shriver, L. J. Rosenblum, ed. IEEE Computer Society Press, pp. 61--73, 1990.

        [Helman90] J. Helman and L. Hesselink. \"Representation and Display of Vector Field Topology in Fluid Flow Data Sets.\" Visualization in Scientific Computing. G. M. Nielson, B. Shriver, L. J. Rosenblum, eds. IEEE Computer Society Press, pp. 61--73, 1990.

        [Livnat96] Y. Livnat, H. W. Shen, C. R. Johnson. \"A Near Optimal Isosurface Extraction Algorithm for Structured and Unstructured Grids.\" IEEE Transactions on Visualization and Computer Graphics. Vol. 2, No. 1, March 1996.

        [Lorensen87] W. E. Lorensen and H. E. Cline. \"Marching Cubes: A High Resolution 3D Surface Construction Algorithm.\" Computer Graphics. 21(3):163--169, July 1987.

        [Lorenz63] E. N. Lorenz. \"Deterministic NonPeriodic Flow.\" Journal of Atmospheric Science. 20:130--141, 1963.

        [Montani94]cC. Montani, R. Scateni, and R. Scopigno. \"A Modified LookUp Table for Implicit Disambiguation of Marching Cubes.\" Visual Computer . (10):353--355, 1994.

        [Moon87] F. C. Moon. Chaotic Vibrations . WileyInterscience, New York, NY, 1987.

        [Nielson91] G. M. Nielson and B. Hamann. \"The Asymptotic Decider: Resolving the Ambiguity in Marching Cubes.\" In Proceedings of Visualization '91. pp. 83--91, IEEE Computer Society Press, Los Alamitos, CA, 1991.

        [Rheingans92] P. Rheingans. \"Color, Change, and Control for Quantitative Data Display.\" In Proceedings of Visualization '92. pp. 252--259, IEEE Computer Society Press, Los Alamitos, CA, 1992.

        [Richter90] R. Richter, J. B. Vos, A. Bottaro, and S. Gavrilakis. \"Visualization of Flow Simulations.\" Scientific Visualization and Graphics Simulation. D. Thalmann editor, pp. 161--171, John Wiley and Sons, 1990.

        [Saada74] A. S. Saada. Elasticity Theory and Applications. Pergamon Press, Inc., New York, NY, 1974.

        [Timoshenko70] S. P. Timoshenko and J. N. Goodier. Theory of Elasticity, 3d Edition. McGrawHill Book Company, New York, NY, 1970.

        [Tufte83] E. R. Tufte. The Visual Display of Quantitative Information. Graphics Press, Cheshire, CT, 1990.

        [Volpe89] G. Volpe. \"Streamlines and Streamribbons in Aerodynamics.\" Technical Report AIAA-89-0140, 27th Aerospace Sciences Meeting, 1989.

        [Ware88] C. Ware. \"Color Sequences for Univariate Maps: Theory, Experiments and Principles.\" IEEE Computer Graphics and Applications. 8(5):41--49, 1988.

        [Watson92] D. F. Watson. Contouring: A Guide to the Analysis and Display of Spatial Data. Pergamon Press, 1992.

        [Wyszecki82] G. Wyszecki and W. Stiles. Color Science: Concepts and Methods, Quantitative Data and Formulae. John Wiley and Sons, 1982.

        [Wyvill86] G. Wyvill, C. McPheeters, B. Wyvill. \"Data Structure for Soft Objects.\" Visual Computer. 2(4):227--234, 1986.

        "},{"location":"VTKBook/06Chapter6/#610-exercises","title":"6.10 Exercises","text":"

        6.1 Sketch contour cases for marching triangles. How many cases are there?

        6.2 Sketch contour cases for marching tetrahedron. How many cases are there?

        6.3 A common visualization technique is to animate isosurface value. The procedure is to smoothly vary isosurface value over a specified range.

        a) Create an animation sequence for the quadric example (Figure4--1).

        b) Create an animation sequence for the head sequence (Figure 6-11 (b)).

        6.4 Marching Cubes visits each cell during algorithm execution. Many of these cells do not contain the isosurface. Describe a technique to improve the performance of isosurface extraction by eliminating visits to cells not containing isosurface. (Hint: use a preprocessing step to analyze data. Assume that many isosurfaces will be extracted and that the preprocessing step will not count against execution time.)

        6.5 Scanline rasterization proceeds along horizontal spans in graphics hardware (see \"Rasterization\" in Chapter 3). Interpolation of color occurs along horizontal spans as well.

        a) Show how the orientation of a polygon affects interpolated color.

        b) Discuss potential problems caused by orientation dependent viewing of visualizations.

        6.6 Write a program to simulate beam vibration. Use the code associated with Figure 6-14 (a) as your starting point.

        6.7 Using the filters vtkStreamLine, vtkMaskPoints, and vtkGlyph3D, create a visualization consisting of oriented glyphs along a streamline.

        6.8 Visualize the following functions.

        a) Scalar S(x,y,z)=sin(xy) for x,y, between 0 and \\pi.

        b) The effective stress field (a scalar field) from Figure 6-21.

        c) The vector field described in the combustor data (i.e., combq.bin and combxyz.bin).

        6.9 Tensor ellipsoids are based on an ellipsoidal glyph. Describe two other glyphs that you might use.

        6.10 Write a source object to generate a polygonal representation of a torus.

        6.11 Design a glyph to convey airplane heading, speed, and altitude, and proximity (i.e., distance) to other planes.

        6.12 Morphing is a process to smoothly blend images (2D) or geometry (3D) between two known images or geometry. Using an implicit modeling approach, how would you morph a torus into a cube?

        6.13 Describe a technique to visualize vector information by animating a color map. ( Hint: By choosing a map carefully, you can give the illusion of motion across a surface.)

        6.14 Isoline contours of different values are typically shown together in one image.

        a) Describe the advantages and disadvantages of displaying isosurfaces simultaneously.

        b) What two graphics properties might you adjust to improve the display of multiple isosurefaces?

        6.15 Describe a parallel algorithm for marching cubes. Use a parallel architecture of your choice.

        6.16 Decomposition can greatly increase the speed of an operation.

        a) Prove that 3D Gaussian smoothing can be decomposed into three 1D operations.

        b) Give the complexity of the decomposed filter and the same filter implemented as a 3D convolution.

        c) Under what conditions can constant smoothing be decomposed into 1D operations.

        LocalWords: TensorAxes TensorEllipsoids catchall tkMarchingCubes dosSantos LocalWords: tkContourFilter

        "},{"location":"VTKBook/07Chapter7/","title":"Chapter 7 - Advanced Computer Graphics","text":"

        Chapter 3 introduced fundamental concepts of computer graphics. A major topic in that chapter was how to represent and render geometry using surface primitives such as points, lines, and polygons. In this chapter our primary focus is on volume graphics. Compared to surface graphics, volume graphics has a greater expressive range in its ability to render inhomogeneous materials, and is a dominant technique for visualizing 3D image (volume) datasets.

        We begin the chapter by describing two techniques that are important to both surface and volume graphics. These are simulating object transparency using simple blending functions, and using texture maps to add realism without excessive computational cost. We also describe various problems and challenges inherent to these techniques. We then follow with a focused discussion on volume graphics, including both object-order and image-order techniques, illumination models, approaches to mixing surface and volume graphics, and methods to improve performance. Finally, the chapter concludes with an assortment of important techniques for creating more realistic visualizations. These techniques include stereo viewing, anti-aliasing, and advanced camera techniques such as motion blur, focal blur, and camera motion.

        "},{"location":"VTKBook/07Chapter7/#71-transparency-and-alpha-values","title":"7.1 Transparency and Alpha Values","text":"

        Up to this point in the text we have focused on rendering opaque objects --- that is, we have assumed that objects reflect, scatter, or absorb light at their surface, and no light is transmitted through to their interior. Although rendering opaque objects is certainly useful, there are many applications that can benefit from the ability to render objects that transmit light. One important application of transparency is volume rendering, which we will explore in greater detail later in the chapter. Another simple example makes objects translucent so that we can see inside of the region bounded by the surface, as shown in Figure 12-4). As demonstrated in this example, by making the skin semi-transparent, it becomes possible to see the internal organs.

        Transparency and its complement, opacity, are often referred to as alpha in computer graphics. For example, a polygon that is 50 percent opaque will have an alpha value of 0.5 on a scale from zero to one. An alpha value of one represents an opaque object and zero represents a completely transparent object. Frequently, alpha is specified as a property for the entire actor, but it also can be done on a vertex basis just like colors. In such cases, the RGB specification of a color is extended to RGBA where A represents the alpha component. On many graphics cards the frame buffer can store the alpha value along with the RGB values. More typically, an application will request storage for only red, green, and blue on the graphics card and use back-to-front blending to avoid the need for storing alpha.

        Unfortunately, having transparent actors introduces some complications into the rendering process. If you think back to the process of ray tracing, viewing rays are projected from the camera out into the world, where they intersect the first actor they come to. With an opaque actor, the lighting equations are applied and the resulting color is drawn to the screen. With a semi-transparent actor we must solve the lighting equations for this actor, and then continue projecting the ray farther to see if it intersects any other actors. The resulting color is a composite of all the actors it has intersected. For each surface intersection this can be expressed as Equation7-1.

        \\begin{eqnarray*} R &=& (1 - A_s) R_b + A_s R_s \\\\ G &=& (1 - A_s) G_b + A_s G_s \\\\ B &=& (1 - A_s) B_b + A_s B_s \\\\ A &=& (1 - A_s) A_b + A_s \\end{eqnarray*} \\bf\\tag{7-1}

        In this equation subscript s refers to the surface of the actor, while subscript b refers to what is behind the actor. The term is called-- the transmissivity, and represents the amount of light that is transmitted through the actor. As an example, consider starting with three polygons colored red, green, and blue each with a transparency of 0.5. If the red polygon is in the front and the background is black, the resulting RGBA color will be (0.4, 0.2, 0.1, 0.875) on a scale from zero to one (Figure 7-1).

        It is important to note that if we switch the ordering of the polygons, the resulting color will change. This underlies a major technical problem in using transparency. If we ray-trace a scene, we will intersect the surfaces in a well-defined manner --- from front to back. Using this knowledge we can trace a ray back to the last surface it intersects, and then composite the color by applying Equation7-1 to all the surfaces in reverse order (i.e., from back to front). In object order rendering methods, this compositing is commonly supported in hardware, but unfortunately we are not guaranteed to render the polygons in any specific order. Even though our polygons are situated as in Figure 7-1, the order in which the polygons are rendered might be the blue polygon, followed by the red, and finally the green polygon. Consequently, the resulting color is incorrect.

        If we look at the RGBA value for one pixel we can see the problem. When the blue polygon is rendered, the frame buffer and z-buffer are empty, so the RGBA quad (0,0,0.8,0.5) is stored along with the its z-buffer value. When the red polygon is rendered, a comparison of its z-value and the current z-buffer indicates that it is in front of the previous pixel entry. So Equation 7-1 is applied using the frame buffer's RGBA value. This results in the RGBA value (0.4,0,0.2,0.75) being written to the buffer. Now, the green polygon is rendered and the z comparison indicates that it is behind the current pixel's value. Again this equation is applied, this time using the frame buffer's RGBA value for the surface and the polygon's values from behind. This results in a final pixel color of (0.3,0.2, 0.175,0.875), which is different from what we previously calculated. Once the red and blue polygons have been composited and written to the frame buffer, there is no way to insert the final green polygon into the middle where it belongs.

        Figure7-1. Physical generation of an image.

        One solution to this problem is to sort the polygons from back to front and then render them in this order. Typically, this must be done in software requiring additional computational overhead. Sorting also interferes with actor properties (such as specular power), which are typically sent to the graphics engine just before rendering the actor's polygons. Once we start mixing up the polygons of different actors, we must make sure that the correct actor properties are set for each polygon rendered.

        Another solution is to store more than one set of RGBAZ values in the frame buffer. This is costly because of the additional memory requirements, and is still limited by the number of RGBAZ values you can store. Some new techniques use a combination of multiple RGBAZ value storage and multi-pass rendering to yield correct results with a minimum performance hit [Hodges92].

        The second technical problem with rendering transparent objects occurs less frequently, but can still have disastrous effects. In certain applications, such as volume rendering, it is desirable to have thousands of polygons with small alpha values. If the RGBA quad is stored in the frame buffer as four eight-bit values, then the round-off can accumulate over many polygons, resulting in gross errors in the output image. This may be less of a problem in the future if graphics hardware begins to store 16 or more bits per component for texture and the frame buffer.

        "},{"location":"VTKBook/07Chapter7/#72-texture-mapping","title":"7.2 Texture Mapping","text":"

        Texture mapping is a technique to add detail to an image without requiring modelling detail. Texture mapping can be thought of as pasting a picture to the surface of an object. The use of texture mapping requires two pieces of information: a texture map and texture coordinates. The texture map is the picture we paste, and the texture coordinates specify the location where the picture is pasted. More generally, texture mapping is a table lookup for color, intensity, and/or transparency that is applied to an object as it is rendered. Textures maps and coordinates are most often two-dimensional, but three-dimensional texture maps and coordinates are supported by most new graphics hardware.

        The value of texture mapping can be shown through the simple example of rendering a wooden table. The basic geometry of a table can be easily created, but achieving the wood grain details is difficult. Coloring the table brown is a good start, but the image is still unrealistic. To simulate the wood grain we need to have many small color changes across the surface of the table. Using vertex colors would require us to have millions of extra vertices just to get the small color changes. The solution to this is to apply a wood grain texture map to the original polygons. This is like applying an oak veneer onto inexpensive particle board, and this is the strategy used by video games to provide realistic scenes with low numbers of polygons for interactivity.

        There are several ways in which we can apply texture data. For each pixel in the texture map (commonly called a texel for texture element), there may be one to four components that affect how the texture map is pasted onto the surface of the underlying geometry. A texture map with one component is called an intensity map. Applying an intensity map results in changes to the intensity (or value in HSV) of the resulting pixels. If we took a gray scale image of wood grain, and then texture-mapped it onto a brown polygon, we would have a reasonable looking table. The hue and saturation of the polygon would still be determined by the brown color, but the intensity would be determined from the texture map. A better looking table could be obtained by using a color image of the wood. This is a three component texture map, where each texel is represented as a RGB trip-let. Using an RGB map allows us to obtain more realistic images, since we would have more than just the intensity changes of the wood.

        By adding alpha values to an intensity map we get two components. We can do the same to an RGB texture map to get a four component RGBA texture map. In these cases, the alpha value can be used to make parts of the underlying geometry transparent. A common trick in computer graphics is to use RGBA textures to render trees. Instead of trying to model the complex geometry of a tree, we just render a rectangle with an RGBA texture map applied to it. Where there are leaves or branches, the alpha is one, where there are gaps and open space, the alpha is zero. As a result, we can see through portions of the rectangle, giving the illusion of viewing through the branches and leaves of a tree.

        Besides the different ways in which a texture map can be defined, there are options in how it interacts with the original color of the object. A common option for RGB and RGBA maps is to ignore the original color; that is, just apply the texture color as specified. Another option is to modulate the original color by the texture map color (or intensity) to produce the final color.

        While we have been focusing on 2D texture maps, they can be of any dimension, though the most common are 2D and 3D. Three-dimensional texture maps are used for textures that are a function of 3D space, such as wood grain, stone, or X-ray intensity (i.e., CT scan). In fact, a volumetric dataset is essentially a 3D texture. We can perform high-speed volume rendering by passing planes through a 3D texture and compositing them using translucent alpha values in the correct order.

        Figure7-2. Vertex texture coordinates.

        Techniques for performing volume rendering using texture mapping hardware will be discussed later in this chapter.

        A fundamental step in the texture mapping process is determining how to map the texture onto the geometry. To accomplish this, each vertex has an associated texture coordinate in addition to its position, surface normal, color, and other point attributes. The texture coordinate maps the vertex into the texture map as shown in Figure 7-2. The texture coordinate system uses the parameters (u,v) and (u,v,t) or equivalently (r,s) or (r,s,t) for specifying 2D and 3D texture values. Points between the vertices are linearly interpolated to determine texture map values.

        Another approach to texture mapping uses procedural texture definitions instead of a texture map. In this approach, as geometry is rendered, a procedure is called for each pixel to calculate a texel value. Instead of using the (u,v,t) texture coordinates to index into an image, they are passed as arguments to the procedural texture that uses them to calculate its result. This method provides almost limitless flexibility in the design of a texture; therefore, it is almost impossible to implement in dedicated hardware. Most commonly, procedural textures are used with software rendering systems that do not make heavy use of existing graphics hardware.

        While texture maps are generally used to add detail to rendered images, there are important visualization applications.

        • Texture maps can be generated procedurally as a function of data. One example is to change the appearance of a surface based on local data value.

        • Texture coordinates can be generated procedurally as a function of data. For example, we can threshold geometry by creating a special texture map and then setting texture coordinates based on local data value. The texture map consists of two entries: fully transparent (\\alpha = 0 ) and fully opaque (\\alpha = 1). The texture coordinate is then set to index into the transparent portion of the map if the scalar value is less than some threshold, or into the opaque portion otherwise.

        • Texture maps can be animated as a function of time. By choosing a texture map whose intensity varies monotonically from dark to light, and then \"moving\" the texture along an object, the object appears to crawl in the direction of the texture map motion. We can use this technique to add apparent motion to things like hedgehogs to show vector magnitude. Figure 7-3 is an example of a texture map animation used to simulate vector field motion. Figure 7-3. One frame from a vector field animation using texture. See AnimateVectors.cxx and AnimateVectors.py.

          These techniques will be covered in greater detail in Chapter 9. (See \"Texture Algorithms\" for more information.)

          "},{"location":"VTKBook/07Chapter7/#73-volume-rendering","title":"7.3 Volume Rendering","text":"

          Until now we have concentrated on the visualization of data through the use of geometric primitives such as points, lines, and polygons. For many applications such as architectural walk-throughs or terrain visualization, this is obviously the most efficient and effective representation for the data. In contrast, some applications require us to visualize data that is inherently volumetric (which we refer to as 3D image or volume datasets). For example, in biomedical imaging we may need to visualize data obtained from an MR or CT scanner, a confocal microscope, or an ultrasound study. Weather analysis and other simulations also produce large quantities of volumetric data in three or more dimensions that require effective visualization techniques. As a result of the popularity and usefulness of volume data over the last several decades, a broad class of rendering techniques known as volume rendering has emerged. The purpose of volume rendering is to effectively convey information within volumetric data.

          In the past, researchers have attempted to define volume rendering as a process that operates directly on the dataset to produce an image without generating an intermediate geometric representation. With recent advances in graphics hardware and clever implementations, developers have been able to use geometric primitives to produce images that are identical to those generated by direct volume rendering techniques. Due to these new techniques, it is nearly impossible to define volume rendering in a manner that is clearly distinct from geometric rendering. Therefore, we choose a broad definition of volume rendering as any method that operates on volumetric data to produce an image.

          The next several sections cover a variety of volume rendering methods that use direct rendering techniques, geometric primitive rendering techniques, or a combination of these two methods, to produce an image. Some of the direct volume rendering techniques discussed in this chapter generate images that are nearly identical to those produced by geometric rendering techniques discussed in earlier chapters. For example, using a ray casting method to produce an isosurface image is similar, though not truly equivalent, to rendering geometric primitives that were extracted with the marching cubes contouring technique described in Chapter 6.

          The two basic surface rendering approaches described in Chapter 3, image-order and object-order, apply to volume rendering techniques as well. In an image-order method, rays are cast for each pixel in the image plane through the volume to compute pixel values, while in an object-order method the volume is traversed, typically in a front-to-back or back-to-front order, with each voxel processed to determine its contribution to the image. In addition, there are other volume rendering techniques that cannot easily be classified as image-order or object-order. For example, a volume rendering technique may traverse both the image and the volume simultaneously, or the image may be computed in the frequency domain rather than the spatial domain.

          Since volume rendering is typically used to generate images that represent an entire 3D dataset in a 2D image, several new challenges are introduced. Classification must be performed to assign color and opacity to regions within the volume, and volumetric illumination models must be defined to support shading. Furthermore, efficiency and compactness are of great importance due to the complexity of volume rendering methods and the size of typical volumetric datasets. A geometric model that consists of one million primitives is generally considered large, while a volumetric dataset with one million voxels is quite small. Typical volumes contain between ten and several hundred million voxels, with datasets of a billion or more voxels becoming more common. Clearly care must be taken when deciding to store auxiliary information at each voxel or to increase the time required to process each voxel.

          "},{"location":"VTKBook/07Chapter7/#74-image-order-volume-rendering","title":"7.4 Image-Order Volume Rendering","text":"

          Image-order volume rendering is often referred to as ray casting or ray tracing. The basic idea is that we determine the value of each pixel in the image by sending a ray through the pixel into the scene according to the current camera parameters. We then evaluate the data encountered along the ray using some specified function in order to compute the pixel value. As we will demonstrate throughout this chapter, ray casting is a flexible technique that can be used to render any 3D image dataset, and can produce a variety images. Also, it is relatively easy to extend a basic ray casting technique designed for volumetric data sets that have uniform voxels to work on rectilinear or structured grids. Unfortunately, basic ray casting is also fairly slow; therefore, later in this chapter we will discuss a number of acceleration methods that can be used to improve performance, though often with some additional memory requirements or loss in flexibility.

          The ray casting process is illustrated in Figure 7-4. This example uses a standard orthographic camera projection; consequently, all rays are parallel to each other and perpendicular to the view plane. The data values along each ray are processed according to the ray function, which in this case determines the maximum value along the ray and converts it to a gray scale pixel value where the minimum scalar value in the volume maps to transparent black, and the maximum scalar value maps to opaque white.

          The two main steps of ray casting are determining the values encountered along the ray, and then processing these values according to a ray function. Although in implementation these two steps are typically combined, we will treat them independently for the moment. Since the specific ray function often determines the method used to extract values along the ray, we will begin by considering some of the basic ray function types.

          Figure 7-4 Image-order volume rendering. High potential iron protein data courtesy of Scripps Clinic, La Jolla, CA..

          Figure 7-5 shows the data value profile of a ray as it passes through 8 bit volumetric data where the data values can range between 0 and 255. The x-axis of the profile indicates distance from the view plane while the y-axis represents data value. The results obtained from four different simple ray functions are shown below the profile. For display purposes we convert the raw result values to gray scale values using a method similar to the one in the previous example.

          The first two ray functions, maximum value and average value, are basic operations on the scalar values themselves. The third ray function computes the distance along the ray at which a scalar value at or above 30 is first encountered, while the fourth uses an alpha compositing technique, treating the values along the ray as samples of opacity accumulated per unit distance. Unlike the first three ray functions, the result of the compositing technique is not a scalar value or distance that can be represented on the ray profile.

          The maximum intensity projection, or MIP, is probably the simplest way to visualize volumetric data. This technique is fairly forgiving when it comes to noisy data, and produces images that provide an intuitive understanding of the underlying data. One problem with this method is that it is not possible to tell from a still image where the maximum value occurred along the ray. For example, consider the image of a carotid artery shown in Figure 7-6. We are unable to fully understand the structure of the blood vessels from this still image since we cannot determine whether some vessel is in front of or behind some other vessel. This problem can be solved by generating a small sequence of images showing the data rotating, although for parallel camera projections even this animation will be ambiguous. This is due to the fact that two images generated from cameras that view the data from opposite directions will be identical except for a reflection about the Y axis of the image. Figure 7-5. A ray profile and four example ray functions. MRI head data courtesy of Siemens Medical Systems, Inc., Iselin, NJ. Figure 7-6. A maximum intensity projection created with a ray casting technique. Intensity values are mapped through the color lookup table shown at the bottom of the image before display.

          Later in this chapter, during the classification and illumination discussions, we will consider more complex ray functions. Although the colorful, shaded images produced by the new methods may contain more information, they may also be more difficult to interpret, and often easier to misinterpret, than the simple images of the previous examples. For that reason, it is beneficial to use multiple techniques to visualize your volumetric data.

          A volume is represented as a 3D image dataset where scalar values are defined at the points of the regular grid, yet in ray casting we often need to sample the volume at arbitrary locations. To do this we must define an interpolation function that can return a scalar value for any location between grid points. The simplest interpolation function, which is called zero-order, constant, or nearest neighbor interpolation, returns the value of the closest grid point. This function defines a grid of identical rectangular boxes of uniform value centered on grid points, as illustrated in 2D on the left side of Figure 7-7. In the image on the right we see an example of trilinear interpolation where the value at some location is defined by using linear interpolation based on distance along each of the three axes. In general, we refer to the region defined by eight neighboring grid points as a voxel. In the special case where a discrete algorithm is used in conjunction with nearest neighbor interpolation, we may instead refer to the constant-valued regions as voxels.

          To traverse the data along a ray, we could sample the volume at uniform intervals or we could traverse a discrete representation of the ray through the volume, examining each voxel encountered, as illustrated in Figure 7-8. The selection of a method depends upon factors such as the interpolation technique, the ray function, and the desired trade-off between image accuracy and speed.

          The ray is typically represented in parametric form as

          \\begin{equation*} \\left(x, y, z\\right) = \\left(x_0, y_0, z_0\\right) + \\left(a, b, c\\right) t \\end{equation*} \\bf\\tag{7-2}

          where x_0,y_0,z_0) is the origin of the ray (either the camera position for perspective viewing transformations or a pixel on the view plane for parallel viewing transformations), and (a, b, c) is the normalized ray direction vector. If t1 and t2 represent the distances where the ray enters and exits the volume respectively, and delta_t indicates the step size, then we can use the following code fragment to perform uniform distance sampling:

          t = t1;\nv = undefined;\nwhile ( t < t2 )\n  {\n  x = x0 + a * t;\n  y = y0 + b * t;\n  z = z0 + c * t;\n  v = EvaluateRayFunction( v, t );\n  t = t + delta_t;\n}\n
          Figure 7-7. A 2D example of nearest neighbor interpolation (left) and a 3D example of trilinear interpolation (right). Figure 7-8. Two basic ray traversal methods for volume rendering. Figure 7-9. Images generated using a ray casting method with three different step sizes.Vase data courtesy of SUNY Stony Brook.

          One difficulty with the uniform distance sampling method is selecting the step size. If the step size is too large, then our sampling might miss features in the data, yet if we select a small step size, we will significantly increase the amount of time required to render the image. This problem is illustrated in Figure 7-9 using a volumetric dataset with grid points that are one unit apart along the X, Y, and Z axes. The images were generated using step sizes of 2.0, 1.0, and 0.1 units, where the 0.1 step-size image took nearly 10 times as long to generate as the 1.0 step-size image, which in turn took twice as long to render as the 2.0 step-size image. A compositing method was used to generate the images, where the scalar values within the dataset transition sharply from transparent black to opaque white. If the step size is too large, a banding effect appears in the image highlighting regions of the volume equidistant from the ray origin along the viewing rays. To reduce this effect when a larger step size is desired for performance reasons, the origin of each ray can be bumped forward along the viewing direction by some small random offset, which will produce a more pleasing image by eliminating the regular pattern of the aliasing.

          In some cases it may make more sense to examine each voxel along the ray rather than taking samples. For example, if we are visualizing our data using a nearest neighbor interpolation method, then we may be able to implement a more efficient algorithm using discrete ray traversal and integer arithmetic. Another reason for examining voxels may be to obtain better accuracy on certain ray functions. We can compute the exact maximum value encountered along a ray within each voxel when using trilinear interpolation by taking the first derivative of the interpolation function along the ray and solving the resulting equation to compute the extrema. Similarly, we can find the exact location along the ray where a selected value is first encountered to produce better images of isovalue surfaces within the volume.

          Figure 7-10. Discrete ray classification. Figure 7-11. Ray casting with templated discrete rays. If the rays originate from the image plane (left) then voxels are missed in the volume. If instead the rays originate from a base plane of the volume (right), each voxel is visited exactly once.

          A 3D scan conversion technique, such as a modified Bresenham method, can be used to transform the continuous ray into a discrete representation. The discrete ray is an ordered sequence of voxels v_1, v_2,... v_n and can be classified as 6-connected, 18-connected, or 26-connected as shown in Figure 7-10. Each voxel contains 6 faces, 12 edges, and 8 vertices. If each pair of voxels v_i, v_{i+1} along the ray share a face then the ray is 6-connected, if they share a face or an edge the ray is 18-connected, and if they share a face, an edge, or a vertex the ray is 26-connected. Scan converting and traversing a 26-connected ray requires less time than a 6-connected ray but is more likely to miss small features in the volume dataset.

          If we are using a parallel viewing transformation and our ray function can be efficiently computed using a voxel by voxel traversal method, then we can employ a templated ray casting technique [Yagel92b] with 26-connected rays to generate the image. All rays are identical in direction; therefore, we only need to scan convert once, using this \"template\" for every ray. When these rays are cast from pixels on the image plane, as shown in the left image of Figure 7-11, then some voxels in the dataset will not contribute to the image. If instead we cast the rays from the voxels in the base plane of the volume that is most parallel to the image plane, as shown in the right image, then the rays fit together snugly such that every voxel in the dataset is visited exactly once. The image will appear warped because it is generated from the base plane, so a final resampling step is required to project this image back onto the image plane."},{"location":"VTKBook/07Chapter7/#75-object-order-volume-rendering","title":"7.5 Object-Order Volume Rendering","text":"

          Object-order volume rendering methods process samples in the volume based on the organization of the voxels in the dataset and the current camera parameters. When an alpha compositing method is used, the voxels must be traversed in either a front-to-back or back-to-front order to obtain correct results. This process is analogous to sorting translucent polygons before each projection in order to ensure correct blending. When graphics hardware is employed for compositing, a back-to-front ordering is typically preferred since it is then possible to perform alpha blending without the need for alpha bit planes in the frame buffer. If a software compositing method is used, a front-to-back ordering is more common since partial image results are more visually meaningful, and can be used to avoid additional processing when a pixel reaches full opacity. Voxel ordering based on distance to the view plane is not always necessary since some volume rendering operations, such as MIP or average, can be processed in any order and still yield correct results.

          Figure 7-12. Object-order, back-to-front volume rendering.

          Figure 7-12 illustrates a simple object-order, back-to-front approach to projecting the voxels in a volume for an orthographic projection. Voxel traversal starts at the voxel that is furthest from the view plane and then continues progressively to closer voxels until all voxels have been visited. This is done within a triple nested loop where, from the outer to the inner loop, the planes in the volume are traversed, the rows in a plane are processed, and finally the voxels along a row are visited. Figure 7-12 shows an ordered labeling of the first seven voxels as the volume is projected. Processing voxels in this manner does not yield a strict ordering from the furthest to the closest voxel. However, it is sufficient for orthographic projections since it does ensure that the voxels that project to a single pixel are processed in the correct order. Figure7-13. A Gaussian kernel is projected onto the view plane to produce a splat footprint.

          When a voxel is processed, its projected position on the view plane is determined and an operation is performed at that pixel location using the voxel and image information. This operator is similar to the ray function used in image-order ray casting techniques. Although this approach to projecting voxels is both fast and efficient, it often yields image artifacts due to the discrete selection of the projected image pixel. For instance, as we move the camera closer to the volume in a perspective projection, neighboring voxels will project to increasingly distant pixels on the view plane, resulting in distracting \"holes\" in the image.

          A volume rendering technique, called splatting, addresses this problem by distributing the energy of a voxel across many pixels. Splatting is an object-order volume rendering technique proposed by Westover [Westover90] and, as its name implies, it projects the energy of a voxel onto the image plane one splat, or footprint, at a time. A kernel with finite extent is placed around each data sample. The footprint is the projected contribution of this sample onto the image plane, and is computed by integrating the kernel along the viewing direction and storing the results in a 2D footprint table. Figure 7-13 illustrates the projection of a Gaussian kernel onto the image plane that may then be used as a splatting footprint. For a parallel viewing transform and a spherically symmetric kernel, the footprint of every voxel is identical except for an image space offset. Therefore, the evaluation of the footprint table and the image space extent of a sample can be performed once as a preprocessing step to volume rendering. Splatting is more difficult for perspective volume rendering since the image space extent is not identical for all samples. Accurately correcting for perspective effects in a splatting approach would make the algorithm far less efficient. However, with a small loss of accuracy we can still use the generic footprint table if we approximate the image plane extent of an ellipsoid with an ellipse.

          There are several important considerations when utilizing a splatting approach for volume rendering. The type of kernel, the radius of the kernel, and the resolution of the footprint table will all impact the appearance of the final image. For example, a kernel radius that is smaller than the distance between neighboring samples may lead to gaps in the image, while a larger radius will lead to a blurry image. Also, a low resolution footprint table is faster to precompute, but a high resolution table allows us to use nearest neighbor sampling for faster rendering times without a significant loss in image accuracy.

          Figure 7-14. Volume rendering using a 2D (left) and 3D (right) texture mapping technique.

          Texture mapping as described earlier in this chapter was originally developed to provide the appearance of high surface complexity when rendering geometric surfaces. As texture mapping methods matured and found their way into standard graphics hardware, researchers began utilizing these new capabilities to perform volume rendering [Cabral94]. There are two main texture-mapped volume rendering techniques based on the two main types of texture hardware currently available. Two-dimensional texture-mapped volume rendering makes use of 2D texture mapping hardware whereas 3D texture-mapped volume rendering makes use less commonly available 3D texture mapping graphics hardware.

          We can decompose texture-mapped volume rendering into two basic steps. The first is a sampling step where the data samples are extracted from the volume using some form of interpolation. Depending on the type of texture hardware available, this may be nearest neighbor, bilinear, or tri-linear interpolation and may be performed exclusively in hardware or through a combination of both software and hardware techniques. The second step is a blending step where the sampled values are combined with the current image in the frame buffer. This may be a simple maximum operator or it may be a more complex alpha compositing operator.

          Texture-mapped volume renderers sample and blend a volume to produce an image by projecting a set of texture-mapped polygons that span the entire volume. In 2D texture-mapped volume rendering the dataset is decomposed into a set of orthographic slices along the axis of the volume most parallel to the viewing direction. The basic rendering algorithm consists of a loop over the orthogonal slices in a back-to-front order, where for each slice, a 2D texture is downloaded into texture memory. Each slice, which is a rectangular polygon, is projected to show the entire 2D texture. If neighboring slices are far apart relative to the image size, then it may be necessary to use a software bilinear interpolation method to extract additional slices from the volume in order to achieve a desired image accuracy. The image on the left side of Figure 7-14 illustrates the orthogonal slices that are rendered using a 2D texture mapping approach. Several example images generated using 2D texture-mapped volume rendering are shown in Figure 7-15. Figure 7-15. 2D texture-mapped volume rendering. The images were generated using three different mappings of scalar value to opacity. CT data (256x256x225) courtesy of North Carolina Memorial Hospital.

          The performance of this algorithm can be decomposed into the software sampling rate, the texture download rate, and the texture-mapped polygon scan conversion rate. The software sampling step is required to create the texture image, and is typically dependent on view direction due to cache locality when accessing volumetric data stored in a linear array. Some implementations minimize the software sampling cost at the expense of memory by precomputing and saving images for the three major volume orientations. The texture download rate is the rate at which this image can be transferred from main memory to texture mapping memory. The scan conversion of the polygon is usually limited by the rate at which the graphics hardware can process pixels in the image, or the pixel fill rate. For a given hardware implementation, the download time for a volume is fixed and will not change based on viewing parameters. However, reducing the relative size of the projected volume will reduce the number of samples processed by the graphics hardware that, in turn, will increase volume rendering rates at the expense of image quality.

          Unlike 2D hardware, 3D texture hardware is capable of loading and interpolating between multiple slices in a volume by utilizing 3D interpolation techniques such as trilinear interpolation. If the texture memory is large enough to hold the entire volume, then the rendering algorithm is simple. The entire volume is downloaded into texture memory once as a preprocessing step. To render an image, a set of equally spaced planes along the viewing direction and parallel to the image plane is clipped against the volume. The resulting polygons, illustrated in the image on the right side of Figure 7-14, are then projected in back-to-front order with the appropriate 3D texture coordinates.

          For large volumes it may not be possible to load the entire volume into 3D texture memory. The solution to this problem is to break the dataset into small enough subvolumes, or bricks, so that each brick will fit in texture memory. The bricks must then be processed in back-to-front order while computing the appropriately clipped polygon vertices inside the bricks. Special care must be taken to ensure that boundaries between bricks do not result in image artifacts.

          Figure 7-16. On the left, orthographic rays are cast from the base plane of the volume. In the right image the volume is sheared such that these rays become perpendicular to the base plane.

          Similar to a 2D texture mapping method, the 3D algorithm is limited by both the texture download and pixel fill rates of the machine. However, 3D texture mapping is superior to the 2D version in its ability to sample the volume, generally yielding higher quality images with fewer artifacts. Since it is capable of performing trilinear interpolation, we are able to sample at any location within the volume. For instance, a 3D texture mapping algorithm can sample along polygons representing concentric spheres rather than the more common view-aligned planes.

          In theory, a 3D texture-mapped volume renderer and a ray casting volume renderer perform the same computations, have the same complexity O^{n_3}, and produce identical images. Both sample the entire volume using either nearest neighbor or trilinear interpolation, and combine the samples to form a pixel value using, for example, a maximum value or compositing function. Therefore, we can view 3D texture mapping and standard ray casting methods as functionally equivalent. The main advantage to using a texture mapping approach is the ability to utilize relatively fast graphics hardware to perform the sampling and blending operations. However, there are currently several drawbacks to using graphics hardware for volume rendering. Hardware texture-mapped volume renderings tend to have more artifacts than software ray casting techniques due to limited precision within the frame buffer for storing partial results at each pixel during blending. In addition, only a few ray functions are supported by the hardware, and advanced techniques such as shading are more difficult to achieve. However, these limitations are beginning to disappear as texture mapping hardware evolves. Through the use of extensions to the OpenGL standard, per pixel vectors can be defined allowing for hardware shaded volume texture mapping. Other extensions have allowed for maximum intensity projections, and deeper frame buffers eliminate artifacts.

          "},{"location":"VTKBook/07Chapter7/#76-other-volume-rendering-methods","title":"7.6 Other Volume Rendering Methods","text":"

          Not all volume rendering methods fall cleanly into the image-order or object-order categories. For example, the shear-warp method [Lacroute94] of volume rendering traverses both image and object space at the same time. The basic idea behind this method is similar to that of templated ray casting. If we cast rays from the base plane of the volume for an orthographic projection, then it is possible to shear the volume such that the rays become perpendicular to the base plane, as shown in Figure 7-16. Looking at the problem this way, it is clear to see that if all rays originate from the same place within the voxels on the base plane, then these rays intersect the voxels on each subsequent plane of the volume at consistent locations. Using bilinear interpolation on the 2D planes of the dataset, we can precompute one set of interpolation weights for each plane. Instead of traversing the volume by evaluating samples along each ray, an object-order traversal method can be used to visit voxels along each row in each plane in a front-to-back order through the volume. There is a one-to-one correspondence between samples in a plane of the volume and pixels on the image plane, making it possible to traverse both the samples and the pixels simultaneously. As in templated ray casting, a final resampling (warping) operation must be performed to transform the image from sheared space on the base plane to Cartesian space on the image plane.

          Shear-warp volume rendering is essentially an efficient variant of ray casting. The correspondence between samples and pixels allows us to take advantage of a standard ray casting technique known as early ray termination. When we have determined that a pixel has reached full opacity during compositing, we no longer need to consider the remaining samples that project onto this pixel since they do not contribute to the final pixel value. The biggest efficiency improvement in shear-warp volume rendering comes from run-length encoding the volume. This compression method removes all empty voxels from the dataset, leaving only voxels that can potentially contribute to the image. Depending on the classification of the data, it is possible to achieve a greater than 10:1 reduction in voxels. As we step through the compressed volume, the number of voxels skipped due to run-length encoding also indicates the number of pixels to skip in the image. One drawback to this method is that it requires three copies of the compressed volume to allow for front-to-back traversal from all view directions. In addition, if we wish to use a perspective viewing transformation then we may need to traverse all three compressed copies of the volume in order to achieve the correct traversal order.

          Volume rendering can also be performed using the Fourier slice projection theorem [Totsuka92] that states that if we extract a slice of the volume in the frequency domain that contains the center and is parallel to the image plane, then the 2D spectrum of that slice is equivalent to the 2D image obtained by taking line integrals through the volume from the pixels on the image plane. Therefore we can volume render the dataset by extracting the appropriate slice from the 3D Fourier volume, then computing the 2D inverse Fourier transform of this slice. This allows us to render the image in O(n^2 \\log n) time as opposed to the O(n^3) complexity required by most other volume rendering algorithms.

          Two problems that must be addressed when implementing a frequency domain volume renderer are the high cost of interpolation when extracting a slice from the Fourier volume, and the high memory requirements (usually two double precision floating-point values per sample) required to store the Fourier volume. Although some shading and depth cues can be provided with this method, occlusion is not possible.

          "},{"location":"VTKBook/07Chapter7/#77-volume-classification","title":"7.7 Volume Classification","text":"

          Classifying the relevant objects of interest within a dataset is a critical step in producing a volume rendered image. This information is used to determine the contribution of an object to the image as well as the object's material properties and appearance. For example, a simple binary classification of whether a data sample corresponds to bone within a CT dataset is often performed by specifying a density threshold. When the scalar value at a voxel is greater than this threshold, it is classified as bone, otherwise it is considered air. This essentially specifies an isosurface in the volume at the transition between air and bone. If we plot this operation over all possible scalar values we will get the binary step function shown on the left in Figure 7-17. In volume rendering we refer to this function as a transfer function. A transfer function is responsible for mapping the information at a voxel location into different values such as material, color, or opacity. The strength of volume rendering is that it can handle transfer functions of much greater complexity than a binary step function. This is often necessary since datasets contain multiple materials and classification methods cannot always assign a single material to a sample with 100 percent probability. Using advanced image segmentation and classification techniques, the single component volume can be processed into multiple material percentage volumes [Drebin88]. Referring back to our CT example, we can now specify a material percentage transfer function that defines a gradual transition from air to muscle, then from muscle to bone, as shown on the right in Figure 7-17. Figure 7-17. Transfer functions that classify CT densities into material percentages. A simple binary classification used to define a bone isosurface (left) and a gradual transition from air to muscle to bone (right) is shown.

          In addition to material percentage transfer functions, we can define four independent transfer functions that map scalar values into red, green, blue, and opacity values for each material in the dataset. For simplicity, these sets of transfer functions are typically pre-processed into one function each for red, green, blue and opacity at the end of the classification phase. During rendering we must decide how to perform interpolation to compute the opacity and color at an arbitrary location in the volume. We could interpolate scalar value then evaluate the transfer functions, or we could evaluate the transfer functions at the grid points then interpolate the resulting opacities and colors. These two methods will produce different image results. It is generally considered more accurate to classify at the grid points then interpolate to obtain color and opacity; although if we interpolate then classify, the image often appears more pleasing since high frequencies may be removed by the interpolation.

          Classifying a volume based on scalar value alone is often not capable of isolating an object of interest. A technique introduced by Levoy [Levoy88] adds a gradient magnitude dimension to the specification of a transfer function. With this technique we can specify an object in the volume based on a combination of scalar value and the gradient magnitude. This allows us to define an opacity transfer function that can target voxels with scalar values in a range of densities and gradients within a range of gradient magnitudes. This is useful for avoiding the selection of homogeneous regions in a volume and highlighting fast-changing regions. Figure 7-18 shows a CT scan of a human foot. The sharp changes in the volume, such as the transition from air to skin and flesh to bone, are shown. However, the homogeneous regions, such as the internal muscle, are mostly transparent. Figure 7-18. Volume rendering using a gradient magnitude opacity transfer function. Rendering performed with Kitware's VolView volume rendering system. The Visible Man CT data is courtesy of The National Library of Medicine.

          If we are using a higher-order interpolation function such as tri-cubic interpolation then we can analytically compute the gradient vector at any location in the dataset by evaluating the first derivative of the interpolation function. Although we can use this approach for trilinear interpolation, it may produce undesirable artifacts since trilinear interpolation is not continuous in its first derivative across voxel boundaries. An alternative approach is to employ a finite differences technique to approximate the gradient vector:

          \\begin{eqnarray*} g_x &=& \\frac{f(x + \\Delta x, y, z) - f(x - \\Delta x, y, z)}{2 \\Delta x} \\\\ g_y &=& \\frac{f(x, y + \\Delta y, z) - f(x, y - \\Delta y, z)}{2 \\Delta y} \\\\ g_z &=& \\frac{f(x, y, z + \\Delta z) - f(x, y, z - \\Delta z)}{2 \\Delta z} \\end{eqnarray*} \\bf\\tag{7-3}

          where f(x,y,z) represents the scalar value at (x,y,z) location in the dataset according to the interpolation function, and g_x, g_y and g_z are the partial derivatives of this function along the x, y, and z axes respectively. The magnitude of the gradient at (x,y,z) is the length of the resulting vector (g_x, g_y, g_z). This vector can also be normalized to produce a unit normal vector. The $\\Delta x, \\Delta y, $ and \\Delta z are critical as shown in Figure 7-19. If these values are too small, then the gradient vector field derived from Equation7-3 may contain high frequencies, yet if these values are too large we will lose small features in the dataset.

          It is often the case that transfer functions based on scalar value and even gradient magnitude are not capable of fully classifying a volume. Ultrasound data is an example of particularly difficult data that does not perform well with simple segmentation techniques. While no one technique exists that is universally applicable, there exists a wide variety of techniques that produce classification information at each sample. For instance, [Kikinis96] provides techniques for classifying the human brain. In order to properly handle this information a volume renderer must access the original volume and a classification volume. The classification volume usually contains material percentages for each sample, with a set of color and opacity transfer functions for each material used to define appearance.

          Figure 7-19. A comparison of shaded images with two different step sizes used during normal estimation. Confocal microscopy data courtesy of Howard Hughes Medical Institute, SUNY Stony Brook."},{"location":"VTKBook/07Chapter7/#78-volumetric-illumination","title":"7.8 Volumetric Illumination","text":"

          The volume rendered images that we have shown so far in this chapter do not include any lighting effects. Scientist sometimes prefer to visualize their volumes using these simpler methods because they fear that adding lighting effects to the image will interfere with their interpretation. For example, in a maximum intensity projection, a dark region in the image clearly indicates the lack of high opacity values in the corresponding region of the volume, while a dark feature in a shaded image may indicate either low opacity values or values with gradient directions that point away from the light source.

          There are several advantages to lighting that can often justify the additional complexity in the image. First, consider the fact that volume rendering is a process of creating a 2D image from 3D data. The person viewing that data would like to be able to understand the 3D structure of the volume from that image. Of course, if you were to look at a photograph of a skeleton it would be easy to understand its structure from the 2D representation. The two main clues that you received from the picture are occlusion and lighting effects. If you were to view a video of the skeleton, you would receive the additional clue of motion parallax. A static image showing a maximum intensity projection does not include occlusion or lighting effects, making it difficult to understand structure. An image generated with a compositing technique does include occlusion, and the compositing ray function can be modified to include shading as well. A comparison of these three methods is shown in Figure 7-20 for a CT scan of a human foot. Figure 7-20. A comparison of three volume rendering techniques. A maximum intensity projection does not include occlusion or shading. A composite image includes occlusion and can include shading.

          To accurately capture lighting effects, we could use a transport theory illumination model [Krueger91] that describes the intensity of light I arriving at a pixel by the path integral along the ray:

          \\begin{equation*} I\\left(t_0, \\vec{\\omega}\\right) = \\int_{t_0}^{\\infty} Q\\left(\\tau\\right) e^{\\left(-\\int_{t_0}^{t} \\sigma_\\text{a}\\left(\\tau\\right) + \\sigma_\\text{sc}\\left(\\tau\\right) \\, \\text{d} \\tau\\right)} \\, \\text{d}\\tau \\end{equation*} \\bf\\tag{7-4}

          If we are using camera clipping planes, then t_0 and \\infty would be replaced by the distance to the near clip plane t_{near} and the distance to the far clip plane t_{far} respectively. The contribution Q(t) from each sample at a distance t along the ray is attenuated according to how much intensity is lost on the way from t to t_0 due to absorption \\sigma_a(t') and scattering \\sigma_{sc}(t'). The contributions at t can be defined as:

          \\begin{equation*} Q(t) = E(t) + \\sigma_\\text{sc}(t) \\int_{\\Omega} \\rho_{sc}(\\omega' \\to \\omega) I(t, \\omega') \\, \\text{d}\\omega' \\end{equation*} \\bf\\tag{7-5}

          The contribution consists of the amount of light directly emitted by the sample E(t), plus the amount of light coming from all directions that is scattered by this sample back along the ray. The fraction of light arriving from the \\vec{\\omega'} direction that is scattered into the direction \\vec{\\omega} is defined by the scattering function \\rho_{sc}(\\vec{\\omega'}\\rightarrow \\vec{\\omega}). To compute the light arriving from all directions due to multiple bounce scattering, we must recursively compute the illumination function.

          If scattering is accurately modelled, then basing the ray function on the transport theory illumination model will produce images with realistic lighting effects. Unfortunately, this illumination model is too complex to evaluate, therefore approximations are necessary for a practical implementation. One of the simplest approximations is to ignore scattering completely, yielding the following intensity equation:

          \\begin{equation*} I\\left(t_0, \\vec{\\omega}\\right) = \\int_{t_0}^{\\infty} E\\left(\\tau\\right) e^\\left(-\\int_{t_0}^{t} \\sigma_\\text{a}\\left(\\tau\\right) \\, \\text{d} \\tau \\right) \\, \\text{d}\\tau \\end{equation*} \\bf\\tag{7-6}

          We can further simplify this equation by allowing $\\alpha (t) to represent both the amount of light emitted per unit length and the amount of light absorbed per unit length along the ray. The outer integral can be replaced by a summation over samples along the ray within some clipping range, while the inner integral can be approximated using an over operator:

          \\begin{equation*} I(t_\\text{near}, \\vec{\\omega}) = \\sum_{t = t_\\text{near}}^{t \\leq t_\\text{far}} \\alpha(t) \\prod_{t' = t_\\text{near}}^{t' < t_\\text{far}}\\left(1 - a(t') \\right) \\end{equation*} \\bf\\tag{7-7}

          This equation is typically expressed in its recursive form:

          \\begin{equation*} I(t_n, \\vec{\\omega}) = \\alpha(t_n) + \\left(1 - \\alpha(t_n) \\right) I(t_{n + 1}, \\vec{\\omega}) \\end{equation*} \\bf\\tag{7-8}

          which is equivalent to the simple compositing method using the over operator that was described previously. Clearly in this case we have simplified the illumination model to the point that this ray function does not produce images that appear to be realistic.

          If we are visualizing an isosurface within the volumetric data, then we can employ the surface illumination model described in Chapter 3 to capture ambient and diffuse lighting as well as specular highlights. There are a variety of techniques for estimating the surface normal needed to evaluate the shading equation. If the image that is produced as a result of volume rendering contains the distance from the view plane to the surface for every pixel, then we can post-process the image with a 2D gradient estimator to obtain surface normals. The gradient at some pixel x_p, y_p can be estimated with a central difference technique by:

          \\begin{eqnarray*} \\frac{\\partial Z}{\\partial x} &\\simeq& \\frac{Z\\left(x_p + \\Delta x, y_p\\right) - Z\\left(x_p - \\Delta x, y_p\\right)}{2 \\Delta x} \\\\ \\frac{\\partial Z}{\\partial y} &\\simeq& \\frac{Z\\left(x_p, y_p + \\Delta y\\right) - Z\\left(x_p, y_p - \\Delta y\\right)}{2 \\Delta y} \\\\ \\frac{\\partial Z}{\\partial z} &\\simeq& 1 \\end{eqnarray*} \\bf\\tag{7-9} Disjoint volumetric objects Corresponding depth image Figure 7-21. A scene (left) and the corresponding depth image (right) used in 2D gradient estimation.

          The results are normalized to produce a unit normal vector. As with the 3D finite differences gradient estimator given in Equation7-3 care must be taken when selecting $\\delta x and \\delta y Typically, these values are simply the pixel spacing in x and y so that neighboring pixel values are used to estimate the gradient, although larger values can be used to smooth the image.

          One problem with the 2D gradient estimation technique described above is that normals are computed from depth values that may represent disjoint regions in the volume, as shown in Figure 7-21. This may lead to a blurring of sharp features on the edges of objects. To reduce this effect, we can locate regions of continuous curvature in the depth image, then estimate the normal for a pixel using only other pixel values that fall within the same curvature region [Yagel92a]. This may require reducing our \\Delta x and \\Delta y values, or using an off-centered differences technique to estimate the components of the gradient. For example, the x component of the gradient could be computed with a forward difference: \\begin{equation*} \\frac{\\partial Z}{\\partial x} \\simeq \\frac{Z(x_p + \\Delta x, y_p) - Z(x_p, y_p)}{\\Delta x} \\end{equation*} \\bf\\tag{7-10}

          or a backward difference

          \\begin{equation*} \\frac{\\partial Z}{\\partial x} \\simeq \\frac{Z(x_p, y_p) - Z(x_p - \\Delta x, y_p)}{\\Delta x} \\end{equation*} \\bf\\tag{7-11}

          Although 2D gradient estimation is not as accurate as the 3D version, it is generally faster and allows for quick lighting and surface property changes without requiring us to recompute the depth image. However, if we wish to include shading effects in an image computed with a compositing technique, we need to estimate gradients at many locations within the volume for each pixel. A 3D gradient estimation technique is more suitable for this purpose. An illumination equation for compositing could be written as:

          \\begin{equation*} I(t_\\text{near}, \\vec{\\omega}) = \\sum_{t = t_\\text{near}}^{t \\leq t_\\text{far}} \\alpha(t)\\left(I_\\text{a} + I_\\text{d} + I_\\text{s}\\right) \\prod_{t' = t_\\text{near}}^{t' < t_\\text{far}}\\left(1 - a(t') \\right) \\end{equation*} \\bf\\tag{7-12}

          where the ambient illumination I_a, the diffuse illumination I_d, and the specular illumination I_s are computed as in surface shading using the estimated volume gradient in place of the surface normal. In this equation, \\alpha(t) represents the amount of light reflected per unit length along the ray, with 1 - \\alpha*(t) indicating the fraction of light transmitted per unit length.

          As in classification, we have to make a decision about whether to directly compute illumination at an arbitrary location in the volume, or to compute illumination at the grid points and then interpolate. This is not a difficult decision to make on the basis of accuracy since it is clearly better to estimate the gradient at the desired location rather than interpolate from neighboring estimations. On the other hand, if we do interpolate from the grid points then we can precompute the gradients for the entire dataset once, and use this to increase rendering performance for both classification and illumination. The main problem is the amount of memory required to store the precomputed gradients. A naive implementation would store a floating-point value (typically four bytes) per component of the gradient per scalar value. For a dataset with one 256^3 one-byte scalars, this would increase the storage requirement from 16 Mbytes to 218 Mbytes.

          In order to reduce the storage requirements, we could quantize the precomputed gradients by using some number of bits to represent the magnitude of the vector, and some other number of bits to encode the direction of the vector. Quantization works well for storing the magnitude of the gradient, but does not provide a good distribution of directions if we simply divide the bits among the three components of the vector. A better solution is to use the uniform fractal subdivision of an octahedron into a sphere as the basis of the direction encoding, as shown in Figure 7-22. The top left image shows the results obtained after the recursive replacement of each triangle with four new triangles, with a recursion depth of two. The vector directions encoded in this representation are all directions formed by creating a ray originating at the sphere's center and passing through a vertex of the sphere. The remaining images in this figure illustrate how these directions are mapped into an index. First we push all vertices back onto the original faces of the octahedron, then we flatten this sphere onto the plane z=0. Finally, we rotate the resulting grid by 45^\\circ. We label the vertices in the grid with indices starting at 0 at the top left vertex and continue across the rows then down the columns to index 40 at the lower right vertex. These indices represent only half of the encoded normals because when we flattened the octahedron, we placed two vertices on top of each other on all but the edge locations. Thus, we can use indices 41 through 81 to represent vectors with a negative z component. Vertices on the edges represent vectors with out a z component, and although we could represent them with a single index, using two keeps the indexing scheme more consistent and, therefore, easier to implement.

          The simple example above requires only 82 values to encode the 66 unique vector directions. If we use an unsigned short to store the encoded direction, then we can use a recursion depth of 6 when generating the vertices. This leads to 16,642 indices representing 16,386 unique directions.

          Once the gradients have been encoded for our volume, we need only compute the illumination once for each possible index and store the results in a table. Since data samples with the same encoded gradient direction may have different colors, this illumination value represents the portion of the shading equation that is independent of color. Each scalar value may have separate colors defined for ambient, diffuse, and specular illumination; therefore, the precomputed illumination is typically an array of values.

          Although using a shading table leads to faster rendering times, there are some limitations to this method. Only infinite light sources can be supported accurately since positional light sources would result in different light vectors for data samples with the same gradient due to their different positions in the volume. In addition, specular highlights are only captured accurately for orthographic viewing directions where the view vector does not vary based on sample position. In practice, positional light sources are often approximated by infinite light sources, and a single view direction is used for computing specular highlights since the need for fast rendering often outweighs the need for accurate illumination.

          Figure 7-22. Gradient direction encoding."},{"location":"VTKBook/07Chapter7/#79-regions-of-interest","title":"7.9 Regions of Interest","text":"

          One difficulty in visualizing volumetric data with the methods presented thus far is that in order to study some feature in the center of the volume we must look through other features in the dataset. For example, if we are visualizing a tomato dataset, then we will be unable to see the seeds within the tomato using a maximum intensity projection because the seeds have lower intensity than the surrounding pulp. Even using a compositing technique, it is difficult to visualize the seeds since full opacity may be obtained before reaching this area of the dataset.

          We can solve the problem of visualizing internal features by defining a region of interest within our volume, and rendering only this portion of the dataset as shown in Figure 7-23. There are many techniques for defining a region of interest. We could use the near and far clipping planes of the camera to exclude portions of the volume. Alternatively, we could use six orthographic clipping planes that would define a rectangular subvolume; we could use a set of arbitrarily oriented half-space clipping planes; or we could define the region of interest as the portion of the volume contained within some set of closed geometric objects. Another approach would be to create an auxiliary volume with binary scalar values that define a mask indicating which values in the volume should be considered during rendering. Figure 7-24. Two volumes rendered with both geometric and volumetric techniques. The Visible Woman CT data is courtesy of The National Library of Medicine.

          All of these region of interest methods are fairly simple to implement using an image-order ray casting approach. As a preprocessing step to ray casting, the ray is clipped against all geometric region definitions. The ray function is then evaluated only along segments of the ray that are within the region of interest. The mask values are consulted at each sample to determine if its contribution should be included or excluded.

          For object-order methods we must determine for each sample whether or not it is within the region of interest before incorporating its contribution into the image. If the underlying graphics hardware is being utilized for the object-order volume rendering as is the case with a texture mapping approach, hardware clipping planes may be available to help support regions of interest.

          "},{"location":"VTKBook/07Chapter7/#710-intermixing-volumes-and-geometry","title":"7.10 Intermixing Volumes and Geometry","text":"

          Although the volume is typically the focus of the image in volume visualization, it is often helpful to add geometric objects to the scene. For example, showing the bounding box of the dataset or the position and orientation of cut planes can improve the viewer's understanding of the volumetric data. Also, it can be useful to visualize volumetric data using both geometric and volumetric methods within the same image. The left image in Figure 7-24 shows a CT scan of a human knee where a contouring method is used to extract the skin isosurface. This isosurface is rendered as triangles using standard graphics hardware. The upper-right portion of the skin is cut to reveal the bone beneath, which is rendered using a software ray casting technique with a compositing ray function. In the right image, the wave function values of an iron protein are visualized using both geometric isosurface and volume rendering techniques.

          When using graphics hardware to perform volume rendering, as is the case with a texture mapping approach, intermixing opaque geometry in the scene is trivial. All opaque geometry is rendered first, then the semi-transparent texture-mapped polygons are blended in a back-to-front order into the image. If we wish to include semi-transparent geometry in the scene, then this geometry and the texture-mapped polygons must be sorted before rendering. Similar to a purely geometric scene, this may involve splitting polygons to obtain a sorted order.

          If a software volume rendering approach is used, such as an object-order splatting method or an image-order ray casting method, opaque geometry can be incorporated into the image by rendering the geometry, capturing the results stored in the hardware depth buffer, and then using these results during the volume rendering phase. For ray casting, we would simply convert the depth value for a pixel into a distance along the view ray and use this to bound the segment of the ray that we consider during volume rendering. The final color computed for a pixel during volume rendering is then blended with the color produced by geometric rendering using the over operator. In an object-order method, we must consider the depth of every sample and compare this to the value stored in the depth buffer at each pixel within the image extent of this sample. We accumulate this sample's contribution to the volume rendered image at each pixel only if the sample is in front of the geometry for that pixel. Finally, the volume rendered image is blended over the geometric image.

          "},{"location":"VTKBook/07Chapter7/#711-efficient-volume-rendering","title":"7.11 Efficient Volume Rendering","text":"

          Rendering a volumetric dataset is a computationally intensive task. If n is the size of the volume on all three dimensions and we visit every voxel once during a projection, the complexity of volume rendering is O(n^3). Even a highly optimized software algorithm will have great difficulty projecting a moderately sized volume of or 512 \\times 512 \\times 512 approximately 134 million voxels at interactive rates. If every voxel in the volume contributes in some way to the final image and we are unwilling to compromise image quality, our options for efficiency improvements are limited. However, it has been observed that many volumetric datasets contain large regions of empty or uninteresting data that are assigned opacity values of during 0 classification. In addition, those areas that contain interesting data may be occupied by coherent or nearly homogeneous regions. There have been many techniques developed that take advantage of these observations.

          Space leaping refers to a general class of efficiency improvement techniques that attempt to avoid processing regions of a volume that will not contribute to the final image. One technique often used is to build an octree data structure which hierarchically contains all of the important regions in the volume. The root node of the octree contains the entire volume and has eight child nodes, each of which represents 1/8 of the volume. These eight subregions are created by dividing the volume in half along the x, y, and z axes. This subdivision continues recursively until a node in the octree represents a homogeneous region of the volume. With an object-order rendering technique, only the nonempty leaf nodes of the octree would be traversed during rendering thereby avoiding all empty regions while efficiently processing all contributing homogeneous regions. Similarly, an image-order ray casting technique would cast rays through the leaf nodes, with the regular structure of the octree allowing us to quickly step over empty nodes.

          A hybrid space leaping technique [Sobierajski95] makes use of graphics hardware to skip some of the empty regions of the volume during software ray casting. First, a polygonal representation is created that completely contains or encloses all important regions in the volume. This polygonal representation is then projected twice -- first using the usual less than operator on the depth buffer and the second time using a greater than operator on the depth buffer. This produces two depth images that contain the closest and farthest distance to relevant data for every pixel in the image. These distances are then used to clip the rays during ray casting.

          An alternate space-leaping technique for ray casting involves the use of an auxiliary distance volume [Zuiderveld92], with each value indicating the closest distance to a non-transparent sample in the dataset. These distance values are used to take larger steps in empty regions of the volume while ensuring that we do not step over any non-transparent features in the volume. Unfortunately, the distance volume is computationally expensive to compute accurately, requires additional storage, and must be recomputed every time the classification of the volume is modified.

          One difficulty with these space-leaping techniques is that they are highly data dependent. On a largely empty volume with a small amount of coherent data we can speed up volume rendering by a substantial amount. However, when a dataset is encountered that is entirely made up of high-frequency information such as a typical ultrasound dataset, these techniques break down and will usually cause rendering times to increase rather than decrease.

          "},{"location":"VTKBook/07Chapter7/#712-interactive-volume-rendering","title":"7.12 Interactive Volume Rendering","text":"

          Generating a volume rendered image may take anywhere from a fraction of a second to tens of minutes depending on a variety of factors including the hardware platform, image size, data size, and rendering technique. If we are generating the image for the purpose of medical diagnostics we clearly would like to produce a high quality image. On the other hand, if the image is produced during an interactive session then it may be more important to achieve a desired rendering update rate. Therefore, it is clear that we need to be able to tradevoff quality for speed as necessary based on application. As opposed to our discussion on efficiency improvements, the techniques described here do not preserve image quality. Instead, they allow a controlled degradation in quality in order to achieve speed.

          Since the time required for image-order ray casting depends mostly on the size of the image in pixels and the number of samples taken along the ray, we can adjust these two values to achieve a desired update rate. The full-size image can be generated from the reduced resolution image using either a nearest neighbor or bilinear interpolation method. If bilinear interpolation is used, the number of rays cast can often be reduced by a factor of two along each image dimension during interaction, resulting in a four-times speed-up, without a noticeable decrease in image quality. Further speed-ups can be achieved with larger reductions, but at the cost of blurry, less detailed images.

          We can implement a progressive refinement method for ray casting if we do not reduce the number of samples taken along each ray. During interaction we can compute only every ray n^{th} along each image dimension and use interpolation to fill in the remaining pixels. When the user stops interacting with the scene the interpolated pixels are progressively filled in with their actual values.

          There are several object-order techniques available for achieving interactive rendering rates at the expense of image quality. If a splatting algorithm is used, then the rendering speed is dependent on the number of voxels in the dataset. Reduced resolution versions of the data can be precomputed, and a level of resolution can be selected during interaction based on the desired frame rate. If we use a splatting method based on an octree representation, then we can include an approximate scalar value and an error value in each parent node where the error value indicates how much the scalar values in the child nodes deviate from the approximate value in the parent node. Hierarchical splatting [Laur91] can be performed by descending the octree only until a node with less than a given error tolerance is encountered. The contribution of this region of the volume on the image can be approximated by rendering geometric primitives for the splat [Shirley90], [Wilhelms91]. Increasing the allowed error will decrease the time required to render the data by allowing larger regions to be approximated at a higher level in the octree.

          When using a texture mapping approach for volume rendering, faster rendering speeds can be achieved by reducing the number of texture-mapped polygons used to represent the volume. This is essentially equivalent to reducing the number of samples taken along the ray in an image-order ray casting method. Also, if texture download rates are a bottleneck, then a reduced resolution version of the volume can be loaded into texture memory for interaction. This is similar to reducing both the number of rays cast and the number of samples taken along a ray in an image-order method.

          "},{"location":"VTKBook/07Chapter7/#713-volume-rendering-future","title":"7.13 Volume Rendering Future","text":"

          In the past two decades, volume rendering has evolved from a research topic with algorithms that required many minutes to generate an image on a high-end workstation to an area of active development with commercial software available for home computers. Yet as the demand for volume rendering increases, so do the challenges. The number of voxels in a typical dataset is growing, both due to advances in acquisition hardware and increased popularity of volume rendering in areas such as simulation and volume graphics [Kaufman93]. New methods are needed in order to satisfy the conflicting needs of high quality images and interactivity on these large datasets. In addition, time dependent datasets that contain volumetric data sampled at discrete time intervals present new challenges for interpolation, image accuracy, and interactivity while providing new opportunities in classification and interpolation methods.

          Most of the volume rendering discussion in this chapter focused on regular volumetric datasets. Although it is clearly possible to extend most ray casting and object-order methods to visualize rectilinear grid, structured grid, and even irregular data, in practice it is difficult to provide both high quality images and interactivity with these methods. Rendering techniques for these data types continues to be an area of active research in volume visualization [Cignoni96], [Silva96], [Wilhelms96].

          "},{"location":"VTKBook/07Chapter7/#714-stereo-rendering","title":"7.14 Stereo Rendering","text":"

          In our practice of computer graphics so far, we have used a number of techniques to simulate 3D graphics on a 2D display device. These techniques include the use of perspective and scale, shading to confer depth, and motion/animation to see all sides of an object. However, one of the most effective techniques to simulate 3D viewing is binocular parallax.

          Binocular parallax is a result of viewing 3D objects with our two eyes. Since each eye sees a slightly different picture, our mind interprets these differences to determine the depth of objects in our view. There have been a number of \"3D\" movies produced that take advantage of our binocular parallax. Typically, these involve wearing a set of special glasses while watching the movie.

          This effect can be valuable in our efforts to visualize complex datasets and CAD models. The additional depth cues provided by stereo viewing aid us in determining the relative positions of scene geometry as well as forming a mental image of the scene. There are several different methods for introducing binocular parallax into renderings. We will refer to the overall process as stereo rendering, since at some point in the process a stereo pair of images is involved.

          Figure 7-25. Stereo rendering and binocular parallax.

          To generate correct left and right eye images, we need information beyond the camera parameters that we introduced in Chapter 3. The first piece of information we need is the separation distance between the eyes. The amount of parallax generated can be controlled by adjusting this distance. We also need to know if the resulting images will be viewed on one or two displays. For systems that use two displays (and hence two view planes), the parallax can be correctly produced by performing camera azimuths to reach the left and right eye positions. Head mounted displays and booms are examples of two display systems. Unfortunately, this doesn't work as well for systems that have only one view plane. If you try to display both the left and right views on a single display, they are forced to share the same view plane as in Figure 7-25. Our earlier camera model assumed that the view plane was perpendicular to the direction of projection. To handle this non-perpendicular case, we must translate and shear the camera's viewing frustum. Hodges provides some of the details of this operation as well as a good overview on stereo rendering [Hodges92].

          Now let's look at some of the different methods for presenting stereoscopic images to the user. Most methods are based on one of two main categories: time multiplexed and time parallel techniques. Time multiplexed methods work by alternating between the left and right eye images. Time parallel methods display both images at once in combination with a process to extract left and right eye views. Some methods can be implemented as either a time multiplexed or a time parallel technique.

          Time multiplexed techniques are most commonly found in single display systems, since they rely on alternating images. Typically this is combined with a method for also alternating which eye views the image. One cost-effective time multiplexed technique takes advantage of existing television standards such as NTSC and PAL. Both of these standards use interlacing, which means that first the even lines are drawn on the screen and then the odd. By rendering the left eye image to the even lines of the screen and the right eye image to the odd, we can generate a stereo video stream that is suitable for display on a standard television. When this is viewed with both eyes, it appears as one image that keeps jumping from left to right. A special set of glasses must be worn so that when the left eye image is being displayed, the user's left eye can see and similarly for the right eye. The glasses are designed so that each lens consists of a liquid crystal shutter that can either be transparent or opaque, depending on what voltage is applied to it. By shuttering the glasses at the same rate as the television is interlacing, we can assure that the correct eye is viewing the correct image.

          There are a couple of disadvantages to this system. The resolutions of NTSC and PAL are both low compared to a computer monitor. The refresh rate of NTSC (60 Hz) and PAL (50 Hz) produces a fair amount of flicker, especially when you consider that each eye is updated at half this rate. Also, this method requires viewing your images on a television, not the monitor connected to your computer.

          To overcome these difficulties, some computer manufacturers offer stereo ready graphics cards. These systems use liquid crystal shuttered glasses to directly view the computer monitor. To obtain the alternating stereo images, the left eye image is rendered to the top half of the screen and the right eye image to the bottom. Then the graphics card enters a special stereo mode where it doubles the refresh rate of the monitor. So a monitor that initially displays both images at 60Hz begins to alternate between the left and right eye at a rate of 120Hz. This results in each eye getting updated at 60Hz, with its original horizontal resolution and half of its original vertical resolution. For this process to work, your application must take up the entire screen while rendering.

          Some more recent graphics cards have a left image buffer and a right image buffer for stereo rendering. While this requires either more memory or a lower resolution, it does provide for stereo rendering without having to take over the entire screen. For such a card, double buffering combined with stereo rendering results in quad buffering, which can result in a large number of bits per pixel. For example: 24 bits for an RGB color, another 24 bits for the back buffer's color, plus 24 bits for the z-buffer results in 72 bits per pixel. Now double that for the two different views and you have 144 bits per pixel or 18 megabytes for a 1K by 1K display.

          Time parallel techniques display both images at the same time. Head-mounted displays and booms have two separate screens, one for each eye. To generate the two video streams requires either two graphics cards or one that can generate two separate outputs. The rendering process then involves just rendering each eye to the correct graphics card or output. Currently, the biggest disadvantage to this approach is the cost of the hardware required.

          In contrast, SIRDS (Single Image Random Dot Stereograms) require no special hardware. Both views are displayed in a single image, as in Figure 7-26. To view such an image the user must focus either in front of, or behind, the image. When the user's focal point is correct, the two triangular cutouts in the top of the image will appear as one and the image should appear focused. This works because dot patterns repeat at certain intervals. Here, only the depth information is present in the resulting image. This is incorporated by changing the interval between patterns just as our ocular disparity changes with depth.

          The next two techniques for stereo rendering can be implemented using either the time parallel or time multiplexed methods. The distinction is slightly blurred because most of the time parallel methods can be multiplexed, though typically there is no advantage to it. Both of these methods have been used by the movie industry to produce \"3D\" movies. The first is commonly called red-blue (or red-green or red-cyan) stereo and requires the user to wear a pair of glasses that filter entering light. The left eye can only see the image through a red filter, the right through a blue filter. The rendering process typically involves generating images for the two views, converting their RGB values into intensity, and then creating a resulting image. This image's red values are taken from the left eye image intensities. Likewise the blue values (a mixture of blue and green) are taken from the right eye image intensities. The resulting image has none of the original hue or saturation, but it does contain both original images' intensities. (An additional note: red-green methods are also used because the human eye is more sensitive to green than blue.) The benefits of this technique are that the resulting images can be displayed on a monitor, paper, or film, and all one needs to view them is an inexpensive pair of glasses.

          Figure 7-26. Single image random dot stereogram of a tetrahedron.

          The second technique is similar to the first but it preserves all the color information from the original images. It separates the different views by using polarized light. Normally, the light we see has a mixture of polarization angles, but there are lenses that can filter out a subset of these angles. If we project a color image through a vertical polarizing filter, and then view it through another vertical filter, we will see the original image, just slightly dimmer because we've filtered out all the horizontally polarized light. If we place a horizontal filter and a vertical filter together, all the light is blocked. Polarized stereo rendering typically projects one eye's image through a vertical filter and the other through a horizontal filter. The user wears a pair of glasses containing a vertical filter over one eye and a horizontal filter over the other. This way each eye views the correct image.

          Figure 7-27. Wireframe image and anti-aliased equivalent.

          All the methods we have discussed for stereo rendering have their advantages and disadvantages, typically revolving around cost and image quality. At the end of this chapter we will look at an example program that renders stereo images using the red-blue technique.

          "},{"location":"VTKBook/07Chapter7/#715-aliasing","title":"7.15 Aliasing","text":"

          At one point or another most computer users have run into aliasing problems. This \"stair-stepping\" occurs because we represent continuous surface geometry with discrete pixels. In computer graphics the most common aliasing problem is jagged edges when rendering lines or surface boundaries, as in Figure 7-27.

          The aliasing problem stems from the rasterization process as the graphics system converts primitives, such as line segments, into pixels on the screen. For example, the quickest way to rasterize a line is to use an all or nothing strategy. If the line passes through the pixel, then the pixel is set to the line's color; otherwise, it is not altered. As can be seen in Figure 7-28, this results in the stair-stepped appearance.

          There are several techniques for handling aliasing problems, and they are collectively known as anti-aliasing techniques. One approach to anti-aliasing is to change how the graphics system rasterizes primitives. Instead of rasterizing a line using an all or nothing approach, we look at how much of the pixel the line occupies. The resulting color for that pixel is a mixture of its original color and the line's color. The ratio of these two colors is determined by the line's occupancy. This works especially well when working primarily with wireframe models. A similar approach breaks each pixel down into smaller sub-pixels. Primitives are rendered using an all or nothing strategy, but at sub-pixel resolutions. Then the sub-pixels are averaged to determine the resulting pixel's color. This tends to require much more memory.

          A good result can be obtained by breaking each pixel into 10 sub-pixels, which requires about 10 times the memory and rendering time. If you don't have access to hardware sub-pixel rendering, you can approximate it by rendering a large image and then scaling it down. Using a program such as pnmscale, which does bilinear interpolation, you can take a 1000 by 1000 pixel image and scale it down to a 500 by 500 anti-aliased image. If you have a graphics library that can render into memory instead of the screen, large images such as 6000 by 6000 pixels can be scaled down into high quality results, still at high resolutions such as 2000 by 2000. This may seem like overkill, but on a standard 600dpi color printer this would result in a picture just over three inches on a side.

          Figure 7-28. A one pixel wide line (outlined in gray) draw using a winner take all approach (left) and a coverage approach (right).

          The last method of anti-aliasing we will look at uses an accumulation buffer to average a few possibly aliased images together to produce one anti-aliased result. An accumulation buffer is just a segment of memory that is set aside for performing image operations and storage. The following fragment of C++ code illustrates this process.

          for (imageNum = 0; imageNum < imageTotal; imageNum++)\n  {\n  //   Jitter the camera and focal point by less than one pixel\n  //   Render an image\n  //   add the image to the accumulation buffer\n  }\n//   Divide the accumulation buffer by imageTotal\n//   Display the resulting anti-aliased image\n

          Instead of using one image with eight sub-pixels per pixel, we can use eight images without sub-pixels. The anti-aliasing is achieved by slightly translating the camera's position and focal point between each image. The amount of translation should be within one pixel of magnitude and perpendicular to the direction of projection. Of course, the camera's position is specified in world coordinates not pixels, but Equation7-13 will do the trick. We calculate the new camera position and focal point (i.e., p~new~ and f~new~) from the offset to avoid difficulties surrounding the transformation matrix at the camera's position.

          \\begin{eqnarray*} \\vec{f}_\\text{new} &=& \\left(\\vec{f}\\cdot \\textbf{M}_\\text{WD} + \\vec{O}_\\text{p}\\right)\\cdot \\textbf{M}_\\text{DW} \\\\ \\vec{O}_\\text{w} &=& \\vec{f}_\\text{new} - \\vec{f} \\\\ \\vec{p}_\\text{new} &=& \\vec{p} + \\vec{O}_\\text{w} \\end{eqnarray*} \\bf\\tag{7-13} Figure 7-29. Three images showing focal depth. The first has no focal depth, the second is focused on the center object, the third image is focused on the farthest object.

          In this equation is O_p the offset in pixel coordinates, O_w is the offset in world coordinates, f camera focal point, p is the camera position, and the transformation matrices M_{WD} and $M_(DW} transform from world coordinates to display coordinates and from display coordinates to world coordinates, respectively.

          "},{"location":"VTKBook/07Chapter7/#716-camera-tricks","title":"7.16 Camera Tricks","text":"

          In the previous section we saw how to combine an accumulation buffer and small camera translations to produce an anti-aliased image. In this section we will cover a few other camera techniques of interest. You may have noticed that with computer generated images all actors are in focus. With a real camera you have to set the focal depth to match the distance of the object you are photographing. Anything that is closer or farther than your focal depth will appear out of focus. This is because a real camera has a lens that lets light pass through a finite area. The camera model we have introduced has a point lens, where all the light travels through at exactly the same point. (See Figure 7-29 for a comparison.)

          We can simulate a finite camera lens by rendering many images, each with a slightly different camera position but the same focal point. Then we accumulate these images and take the average. The resulting image simulates a camera lens with focal depth. The different camera positions are determined by selecting random points from the lens you are trying to simulate. Larger diameter lenses will produce more distortion and vice versa. Increasing the number of random points will improve the precision of your result. Typically 10 to 30 samples is desirable. The images in Figure 7-29 were created using 30 sample points.

          Another difference between a real camera and a computer camera is in the shutter speed. Our model generates an image for a single moment in time; in contrast, a photograph captures what the camera views while its shutter is open. Fast moving objects appear blurred because of changes in their position during the small time that the shutter is open. This effect, known as motion blur, can also be simulated with our camera model ( Figure 7-30 ). Instead of rendering one image and displaying it, we render a few sub-frames that are accumulated, averaged, and finally displayed. This is similar to the anti-aliasing and focal depth techniques that we just discussed. In both of those techniques, the camera is jittered while the actors remain fixed in time. To implement motion blur we don't jitter the camera; we increment the scene's time between each sub-frame. Moving objects or camera movements will result in differences between each sub-frame. The resulting image approximates the effects of photographing moving objects over a finite time. Figure7-30. Motion blur. Rapidly moving objects appear blurry when recorded on film or videotape. To simulate motion blur with a computer camera, multiple images (or sub-frames) can be accumulated and averaged. This figure was generated by accumulating 21 sub-frames."},{"location":"VTKBook/07Chapter7/#717-mouse-based-interaction","title":"7.17 Mouse-Based Interaction","text":"

          There's no doubt that being able to interactively view an object aids in understanding and recognizing its important features. Using a pointing device (e.g., a mouse or trackball) is certainly the most common method for controlling such movements. The software that accompanies this book contains the vtkRenderWindowInteractor object that translates mouse and keyboard events into modifications to the camera and actors. For example, while the user holds the left mouse button down, the vtkRenderWindowInteractor rotates the camera towards the current pointer position. The farther the pointer is from the center of the window, the faster the camera rotates.

          Most of these interactions are straightforward, but there are a few issues associated with rotations. When rotating around an object, one must decide what to do with the view-up vector. We can keep it perpendicular to the direction of projection as we rotate, or we can leave it unchanged. This results in two different types of rotations. If we keep our view-up vector orthogonal to the direction of projection, we will rotate all around the object much like a plane flying around the globe. This is shown in the left half of Figure 7-31. If we leave the view-up vector unchanged, our plane will start flying backwards at the north and south poles, as shown in the right half of Figure 7-31.

          The advantage of a constant view-up vector is that some objects have a natural sense of up and down (e.g., terrain). Elevation and azimuth operations remain consistent as we move around the object. On the other hand, there are singular points where the view-up vector and direction of projection become parallel. In these cases the camera viewing transformation matrix is undefined. Then we have to modify the view-up vector or use the perpendicular view-up / direction of projection method to handle this situation. If the data you are working with has a well-defined up and down, then it probably makes sense to leave the view-up constant during rotations; otherwise, it makes sense to keep it orthogonal to the direction of projection.

          Figure 7-31. Rotations using an orthogonalized view-up vector (left) and a constant view-up vector (right)."},{"location":"VTKBook/07Chapter7/#718-3d-widgets-and-user-interaction","title":"7.18 3D Widgets and User Interaction","text":"

          Chapter 3 provided an introduction to interaction techniques for graphics (see \"RenderWindowInteractor\"). In the context of visualization, interaction is an essential feature of systems that provide methods for data exploration and query. The classes vtkRenderWindowInteractor and vtkInteractorStyle are core constructs used in VTK to capture windowing-system specific events in the render window, translate them into VTK events, and then take action as appropriate to that event invocation. In Chapter 3 we saw how these classes could be used to manipulate the camera and actors to interactively produce a desired view. This functionality, however, is relatively limited in its ability to interact with data. For example, users often wish to interactively control the positioning of streamline starting points, control the orientation of a clipping plane, or transform an actor. While using interpreted languages (see \"Interpreted Code\") can go a long way to provide this interaction, in some situations the ability to see what you are doing when placing objects is essential. Therefore, it is apparent that a variety of user interaction techniques is required by the visualization system if it is to successfully support real-world applications.

          3D widgets are a logical extension of the pervasive 2D widgets found on most computer systems, providing interactive capabilities similar to their 2D counterparts except that they function in the richer 3D space. 3D widgets are capable of providing the variety of user interaction techniques required by a visualization system. Unlike 2D widgets, however, 3D widgets are relatively new technology, and because their application is in the context of a richer space, there is no consensus as to what widgets might constitute a complete set of functionality. Several popular 3D widget sets, and the University of Utah's SCIRUN 3D widgets [Purciful95], have distinctly different components in their widget toolbox. The widget sets vary according to the perceived purpose of the graphical environment in which they exist for example Open Inventor [Wernecke94], the Brown University 3D Widgets Library [Zeleznik93],

          3D widgets are a recent addition (see Figure 7-32 ) to VTK. In principal, the core functionality is simple: events captured by the vtkRenderWindow are in turn translated into VTK events. Observers which have registered themselves with the vtkRenderWindow receive these VTK events, take the appropriate action, and then may either pass the event along to the next observer in the list, or abort further processing of the event. (Note: observers can be prioritized according to the order in which they wish to receive events.)

          It is the implementation of 3D widgets, that is, what they can do with the events, that makes them so powerful. As Figure 7-32 shows, widgets typically provide a representation in the scene that can be selected and manipulated. For example, a vtkLineWidget can be used to position a rake of streamline seed points and represents itself with a thick line (tube) and two spherical end points. Widgets also may directly manipulate an underlying class---the vtkScalarBarWidget enables the user to interactively size, orient (horizontal or vertical), and position a vtkScalarBar. Widgets also provide additional functionality such as managing an internal implicit function or transformation matrix (e.g., vtkBoxWidget). The following is a list of widgets currently found in VTK and a brief description of their capabilities.

          • vtkScalarBarWidget --- manage a vtkScalarBar including positioning, scaling, and orienting it.

          • vtkPointWidget --- position a point x-y-z location in 3D space. The widget produces a polygonal output.

          • vtkLineWidget --- place a straight line with a specified subdivision resolution. The widget produces a polygonal output.

          • vtkPlaneWidget --- orient and position a finite plane. The plane resolution is variable and the widget produces an implicit function and a polygonal output.

          • vtkImplicitPlaneWidget --- orient and position an unbounded plane. The widget produces an implicit function and a polygonal output. The polygonal output is created by clipping the plane with a bounding box.

          • vtkBoxWidget --- orient and position a bounding box. The widget produces an implicit function and a transformation matrix.

          • vtkImagePlaneWidget --- manipulate three orthogonal planes within a 3D volumetric data set. Probing of the planes to obtain data position, pixel value, and window-level is possible.

          • vtkSphereWidget --- manipulate a sphere of variable resolution. The widget produces an implicit function, a transformation matrix, and enables the control of focal point and position to support such classes as vtkCamera and vtkLight.

          • vtkSplineWidget --- manipulate an interpolating 3D spline. The widget produces a polygonal data represented by a series of line segments of specified resolution. The widget also directly manages underlying splines for each of the x-y-z coordinate values.

          The key to widget design is careful implementation of intuitive, simple user interaction techniques. For example, the end points on the vtkLineWidget (represented as small spheres) can be selected and dragged to a new position. The vtkLineWidget supports the modifier \"Shift\" key to lock motion of the end points along the coordinate x-y-z axes. The initial direction of motion is used to determine which of the axes the user is moving the end point along. Such attention to detail is essential to successful widget design and will continue to change as the technology evolves in the future.

          vtkScalarBarWidget vtkPointWidget vtkLineWidget vtkPlaneWidget vtkImplicitPlaneWidget vtkBoxWidget vtkImagePlaneWidget vtkSphereWidget vtkSplineWidget Figure 7-32. Application of some 3D widgets found in VTK."},{"location":"VTKBook/07Chapter7/#719-putting-it-all-together","title":"7.19 Putting It All Together","text":"

          This chapter has covered a wide variety of topics. In this section we demonstrate applications of each topic to some simple problems.

          "},{"location":"VTKBook/07Chapter7/#texture-mapping","title":"Texture Mapping","text":"

          Figure 7-33 shows the complete source code for a simple texture mapping example. You will notice that most of the code is similar to what we used in the preceding examples. The key step here is the creation of a vtkTexture object. This object interfaces between its data input and the texture mapping functions of the graphics library. The vtkTexture instance is associated with an actor. More than one texture instance may be shared between multiple actors. For texture mapping to function properly, texture coordinates must be defined by the actor's modeller.

          One interesting note regarding the vtkTexture object. Instances of this class are mappers that have an Input instance variable that is updated during each render. The input type is a vtkImageData dataset type. Thus, a visualization pipeline can be constructed to read, process, and/or generate the texture map. This includes using the object vtkRendererSource , which converts the renderer's image into an image data dataset. The input texture map can be either 2D (a pixmap) or 3D (a volume).

          A few words of warning when using textures. Some renderers only support 2D texture, or may not support alpha textures. Also, many rendering systems require that each dimension of the image dataset is an exact power of two. In VTK, non-power of two textures are automatically converted to power of two at the expense of extra computation.

          "},{"location":"VTKBook/07Chapter7/#volume-rendering","title":"Volume Rendering","text":"

          This example focuses on volume rendering. The source code shown in example Figure 7-34 begins by creating the usual objects. Then we use a vtkStructuredPointsReader to read in a volume dataset for a high potential iron protein. We create a vtkPiecewiseFunction object to map the scalar values in the volume dataset to opacity, and a vtkColorTransferFunction object to map the scalar values to color. These two transfer functions are referenced from the [vtkVolume](https://www.vtk.org/doc/nightly/html/classvtkVolume.html#details)Property object. In addition, we use the ShadeOn() method of [vtkVolume](https://www.vtk.org/doc/nightly/html/classvtkVolume.html#details)Property to enable shading for this volume, and the SetInterpolationTypeToLinear() method to request trilinear interpolation. Since we are using a ray casting approach, we need to create a ray function. In this example we use a vtkVolumeRayCastCompositeFunction object for this purpose. The output of the reader is given to the vtkVolumeRayCastMapper as the scalar input, and the SetVolumeRayCastFunction() method is used to assign the ray function. The vtkVolume object is quite similar to a vtkActor, and the SetVolumeMapper() and SetVolumeProperty() methods are used just like the SetMapper() and SetProperty() methods of vtkActor. Finally, we add this volume to the renderer, adjust the camera, set the desired image update rate and start the interactor.

          To produce a maximum intensity projection in Figure 7-34, we would simply change the type of the ray function to a vtkVolumeRayCastMIPFunction. We could also produce a surface image using a vtkVolumeRayCastIsosurfaceFunction where the IsoValue instance variable would be set to define the surface.

          vtkBMPReader bmpReader\n  bmpReader SetFileName \"$VTK_DATA_ROOT/Data/masonry.bmp\"\nvtkTexture atext\n atext SetInputConnection [bmpReader GetOutputPort]\n atext InterpolateOn\n\nvtkPlaneSource plane\nvtkPolyDataMapper planeMapper\n  planeMapper SetInputConnection [plane GetOutputPort]\nvtkActor planeActor\n  planeActor SetMapper planeMapper\n  planeActor SetTexture atext\n\nvtkRenderer ren1\nvtkRenderWindow renWin\n renWin AddRenderer ren1\nvtkRenderWindowInteractor iren\n  iren SetRenderWindow renWin\n\n#   Add the actors to the renderer ]\nren1 AddActor planeActor\n
          Figure 7-33. Example of texture mapping. See TexturePlane.cxx and TexturePlane.py."},{"location":"VTKBook/07Chapter7/#red-blue-stereo","title":"Red-Blue Stereo","text":"

          In our first example, we will be looking at using red-blue stereo rendering. We start off with the example shown in Figure 7-35, which renders something akin to a mace. Then, in Figure 7-35 we add in red-blue stereo rendering by adding two lines near the bottom that invoke the StereoRenderOn() and SetStereoType() methods. Once these two methods have been invoked, further rendering will be done in stereo. The picture in the upper right corner displays a grayscale version of the resulting image."},{"location":"VTKBook/07Chapter7/#motion-blur","title":"Motion Blur","text":"

          In our second example, we show how to simulate motion blur using the Visualization Toolkit. As shown in Figure 7-36, we begin with our previous example. We then remove the two lines controlling stereo rendering and add a few lines to create another mace. We position the first mace in the top of the rendering window and the second mace at the bottom. We then use the SetSubFrames() method to start performing subframe accumulation. Here, we will perform 21 renders to produce the final image. For motion blur to be noticeable, something must be moving, so we set up a loop to rotate the bottom mace by two degrees between each subframe. Over the 21 sub frames it will rotate 40 degrees from its initial position. It is important to remember that the resulting image is not displayed until the required number of sub frames have been rendered.

          #  Create the standard renderer, render window and interactor\nvtkRenderer ren1\nvtkRenderWindow renWin\n  renWin AddRenderer ren1\nvtkRenderWindowInteractor iren\n   iren SetRenderWindow renWin\n\n#  Create the reader for the data\nvtkStructuredPointsReader reader\n  reader SetFileName \"$VTK_DATA_ROOT/Data/ironProt.vtk\"\n\n#  Create transfer mapping scalar value to opacity\nvtkPiecewiseFunction opacityTransferFunction\n  opacityTransferFunction AddPoint 20 0.0\n  opacityTransferFunction AddPoint 255 0.2\n\n# Create transfer mapping scalar value to color\nvtkColorTransferFunction colorTransferFunction\n  colorTransferFunction AddRGBPoint 0.0 0.0 0.0 0.0\n  colorTransferFunction AddRGBPoint 64.0 1.0 0.0 0.0\n  colorTransferFunction AddRGBPoint 128.0 0.0 0.0 1.0\n  colorTransferFunction AddRGBPoint 192.0 0.0 1.0 0.0\n  colorTransferFunction AddRGBPoint 255.0 0.0 0.2 0.0\n\n#   The property describes how the data will look\nvtkVolumeProperty volumeProperty\n  volumeProperty SetColor colorTransferFunction\n  volumeProperty SetScalarOpacity opacityTransferFunction\n  volumeProperty ShadeOn\n  volumeProperty SetInterpolationTypeToLinear\n\n#  The mapper / ray cast function know how to render the data\nvtkVolumeRayCastCompositeFunction compositeFunction\nvtkVolumeRayCastMapper volumeMapper\n  volumeMapper SetVolumeRayCastFunction compositeFunction\n  volumeMapper SetInputConnection [reader GetOutputPort]\n\n# Set the mapper and the property and\nvtkVolume volume\n  volume SetMapper volumeMapper\n  volume SetProperty volumeProperty\n\nren1 AddVolume volume\nrenWin Render\n
          Figure 7-34. Volume rendering of a high potential iron protein. See SimpleRayCast.cxx and SimpleRayCast.py.
          vtkRenderer *ren1 = vtkRenderer::New();\nvtkRenderWindow *renWin =\n      vtkRenderWindow::New();\n  renWin->AddRenderer(ren1);\nvtkRenderWindowInteractor *iren =\n       vtkRenderWindowInteractor::New();\n  iren->SetRenderWindow(renWin);\n\n//   create the pipline, ball and spikes\nvtkSphereSource *sphere =\n      vtkSphereSource::New();\n  sphere->SetThetaResolution(7);\n  sphere->SetPhiResolution(7);\nvtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();\n  sphereMapper->SetInputConnection(sphere->GetOutputPort());\nvtkActor*sphereActor = vtkActor::New();\n  sphereActor->SetMapper(sphereMapper);\n\nvtkConeSource *cone = vtkConeSource::New();\n  cone->SetResolution(5);\nvtkGlyph3D *glyph = vtkGlyph3D::New();\n  glyph->SetInputConnection(sphere->GetOutputPort());\n  glyph->SetSourceConnection(cone->GetOutputPort());\n  glyph->SetVectorModeToUseNormal();\n  glyph->SetScaleModeToScaleByVector(); glyph->SetScaleFactor(0.25);\nvtkPolyDataMapper *spikeMapper = vtkPolyDataMapper::New();\n  spikeMapper->SetInputConnection(glyph->GetOutputPort());\nvtkActor *spikeActor = vtkActor::New();\n  spikeActor->SetMapper(spikeMapper);\n\nren1->AddActor(sphereActor);\nren1->AddActor(spikeActor);\nren1->SetBackground(0.2,0.3,0.4);\nrenWin->SetSize(300,300);\n\nrenWin->Render();\nren1->GetActiveCamera()->Zoom(1.4);\nrenWin->StereoRenderOn();\nrenWin->SetStereoTypeToRedBlue();\nrenWin->Render();\n
          Figure 7-35. An example of red-blue stereo rendering.
          //changes and additions to the\n// preceding example's source\nvtkActor *spikeActor2 = vtkActor::New();\n  spikeActor2->SetMapper(spikeMapper);\n\nspikeActor2->SetPosition(0,-0.7,0);\nsphereActor2->SetPosition(0,-0.7,0);\n\nren1->AddActor(sphereActor2);\nren1->AddActor(spikeActor2);\n\n// zoom in a little ren1->GetActiveCamera()->Zoom(1.5);\nrenWin->SetSubFrames(21);\n\nfor (i = 0; i <= 1.0; i = i + 0.05)\n  {\n  spikeActor2->RotateY(2);\n  sphereActor2->RotateY(2);\n  renWin->Render();\n}\n\niren->Start();\n
          Figure 7-36. Example of motion blur. See MotionBlur.cxx and MotionBlur.py."},{"location":"VTKBook/07Chapter7/#focal-depth","title":"Focal Depth","text":"

          Now we will change the previous example to illustrate focal depth. First, we change the position of the bottom mace, moving it farther away from us. Since it is farther away it will appear smaller, so we scale it by a factor of two to maintain reasonable image size. We then remove the code for rendering the sub frames and instead set the number of frames for focal depth rendering. We also set the camera's focal point and focal disk to appropriate values. The resulting image and the required changes to the source code are shown in Figure 7-37. Figure 7-37. Contouring examples. See CameraBlur.cxx and CameraBlur.py."},{"location":"VTKBook/07Chapter7/#vtklinewidget","title":"vtkLineWidget","text":"

          There are a variety of 3D widgets in VTK all of which function in a similar fashion. 3D widgets are a subclass of vtkInteractorObserver meaning that they are associated with a vtkRenderWindow and observe events in the render window (). (Note: vtkInteractorStyle---see \"RenderWindowInteractor\") ---is also a subclass of vtkInteractorObserver. The interactor style differs from a 3D widget in that it does not have a representation in the scene.) The following example shows the general approach to using a 3D widget using vtkLineWidget as an example (Figure 7-39). First the widget is instantiated and then placed. Placing means positioning, scaling, and orienting the widget consistent with the object on which they operate. By default, widgets are enabled with a \"keypress-i\" event, but the specific event to enable the widget can be modified.

          Figure 7-38. Partial class hierarchy for 3D widgets. Each 3D widget observes a particular vtkRenderWindow similar to vtkInteractorStyle. Unlike the vtkInteractorStyle which is used to manipulate the camera, 3D widgets have a representation in the scene that can be directly manipulated. More than one vtkInteractorObserver can watch a vtkRenderWindow at a given time, so classes like vtkInteractorEventRecorder can record an event and pass them on to the next vtkInteractorObserver observing the vtkRenderWindow.

          The widget interfaces with the application through the command/observer event handling mechanism (see \"Events and Observers\". 3D widgets invoke several events, the most important being the StartInteractionEvent, InteractionEvent, and EndInteractionEvent. These events are typically invoked, for example, on mouse down, mouse move, and mouse up, respectively. In the example shown here, Tcl procedures are tied to the StartInteractionEvent and InteractionEvent using the AddObserver() method to produce streamlines as the widget is manipulated. Note that the streamline is seeded with a polygonal dataset each time an InteractionEvent is invoked using the GetPolyData() method. The pipeline update mechanism then automatically executes on the next render since the input to the streamline is modified.

          Figure 7-39 Using the vtkLineWidget to produce streamtubes in the combustor dataset. The StartInteractionEvent turns the visibility of the streamlines on; the InteractionEvent causes the streamlines to regenerate themselves ( LineWidget.tcl ).

          "},{"location":"VTKBook/07Chapter7/#720-chapter-summary","title":"7.20 Chapter Summary","text":"

          Alpha opacity is a graphics method to simulate transparent objects. Compositing is the process of blending translucent samples in order. Alpha compositing requires the data to be ordered properly.

          Texture mapping is a powerful technique to introduce additional detail into an image without extensive geometric modelling. Applying 2D texture maps to the surface of an object is analogous to pasting a picture. The location of the texture map is specified via texture coordinates.

          Volume rendering is a powerful rendering technique to view the interior of inhomogeneous objects. Most volume rendering techniques can be classified as image-order or object-order, although some are a combination of the two while others do not fall into either category. Object-order techniques generally composite voxels in front-to-back or back-to-front order. Image-order techniques cast rays through pixels in the image plane to sample the volume. Other methods may traverse both the image and the volume at the same time or may operate in the frequency domain. For effective visualization of volumetric data, classification and shading are important considerations. Regions of interest may be used to reduce the amount of data visible in an image. Due to the complexity of volume rendering algorithms, efficiency and methods that allow for interactivity are critical.

          Stereo rendering techniques create two separate views for the right and left eyes. This simulates binocular parallax and allows us to see depth in the image. Time multiplexed techniques alternate left and right eye views in rapid succession. Time parallel techniques display both images at the same time.

          Raster devices often suffer from aliasing effects. Anti-aliasing techniques are used to minimize the effects of aliasing. These techniques create blended images that soften the boundary of hard edges.

          By using an accumulation buffer we can create interesting effects, including motion blur and focal blur. In motion blurring we accumulate multiple renders as the actors move. To simulate focal blur, we jitter the camera position and hold its focal point constant.

          Effective visualizations are inherently interactive. Not only are camera manipulation models required for different types of data, but methods to interact, query, and modify data are essential. 3D widgets are important contributions to this end. They provide intuitive graphical interface to the data through a representation in the scene that can be easily manipulated. 3D widgets also generate supplemental information such as implicit functions, output polygonal data, and transformation matrices that may be applied to objects in the scene.

          "},{"location":"VTKBook/07Chapter7/#721-bibliographic-notes","title":"7.21 Bibliographic Notes","text":"

          An overview of volume rendering and volume visualization techniques can be found in a tutorial by Kaufman [Kaufman91]. Many of the volume rendering techniques discussed in this chapter are also accessible from research institutions as source code. The shear-warp algorithm is provided within the VolPack rendering library and is available on the Web at graphics.stanford.edu/software/volpack/. SUNY Stony Brook offers a turnkey volume visualization system called VolVis to nonprofit and government organizations. Source code and executable versions are available at http://www.cs.sunysb.edu/\\~volvis. In addition, an application called Vis5D is available that applies volume visualization techniques to time varying atmospheric weather data. Vis5D may be obtained from the Web location http://vis5d.sourceforge.net. A commercial volume rendering application, VolView, developed on top of The Visualization Toolkit, is available from Kitware for a 30-day trial at http://www.kitware.com/products/volview.html

          "},{"location":"VTKBook/07Chapter7/#722-references","title":"7.22 References","text":"

          [Cabral94] B. Cabral, N. Cam, J. Foran. \"Accelerated Volume Rendering and Tomographic Reconstruction Using Texture Mapping Hardware.\" In Proceedings of 1994 Symposium on Volume Visualization. pp. 91--98, October 1994.

          [Cignoni96] P. Cignoni, C. Montani, E. Puppo, R. Scopigno. \"Optimal Isosurface Extraction from Irregular Volume Data.\" In Proceedings of 1996 Symposium on Volume Visualization. pp. 31--38, IEEE Computer Society Press, Los Alamitos, CA, October 1996.

          [Drebin88] R. A. Drebin, L. Carpenter, P. Hanrahan. \"Volume Rendering.\" Computer Graphics. 22(4):64--75 (Siggraph 1988).

          [Hodges92] L. F. Hodges. \"Tutorial: Time-Multiplexed Stereoscopic Computer Graphics.\" IEEE Computer Graphics & Applications. March 1992.

          [Kaufman91] A. Kaufman (ed.). Volume Visualization. IEEE Computer Society Press, Los Alamitos, CA, 1991.

          [Kaufman93] A. Kaufman, R. Yagel, D. Cohen. \"Volume Graphics.\" IEEE Computer. 26(7):51--64, July 1993.

          [Kelly94] M. Kelly, K. Gould, S. Winner, A. Yen. \"Hardware Accelerated Rendering of CSG and Transparency.\" Computer Graphics (SIGGRAPH '94 ). pp. 177-184.

          [Kikinis96] R. Kikinis, M. Shenton, D. Iosifescu, R. McCarley, P. Saiviroonporn, H. Hokama, A. Robatino, D. Metcalf, C. Wible, C. Portas, R. Donnino, F. Jolesz. \"A Digital Brain Atlas for Surgical Planning, Model Driven Segmentation and Teaching.\" IEEE Transactions on Visualization and Computer Graphics. 2(3), September 1996.

          [Krueger91] W. Krueger. \"The Application of Transport Theory to Visualization of 3D Scalar Data Fields.\" Computers in Physics. pp. 397-406, July/August 1994.

          [Lacroute94] P. Lacroute and M. Levoy. \"Fast Volume Rendering Using a Shear-Warp Factorization of the Viewing Transformation.\" In Proceedings of SIGGRAPH '94. pp. 451-458, Addison-Wesley, Reading, MA, 1994.

          [Laur91] D. Laur and P. Hanrahan. \"Hierarchical Splatting: A Progressive Refinement Algorithm for Vol-ume Rendering.\" In Proceedings of SIGGRAPH '91. 25:285--288, 1991.

          [Levoy88] M. Levoy. \"Display of Surfaces from Volumetric Data.\" IEEE Computer Graphics & Applica-lions. 8(3), pp. 29--37, May 1988.

          [Purciful95] J.T. Purciful. \\\"Three-Dimensional Widgets for Scientific Visualization and Animation.\\\" Masters Thesis, Dept. of Computer Science, UN iv. of Utah, 1995.

          [Shirley90] P. Shirley and A. Tuchman. \"A Polygonal Approximation to Direct Volume Rendering.\" Comput-er Graphics. 24(5):63--70, 1990.

          [Silva96] C. Silva, J. S. B. Mitchell, A. E. Kaufman. \"Fast Rendering of Irregular Grids.\" In Proceedings of 1996 Symposium on Volume Visualization. pp. 15--22, IEEE Computer Society Press, Los Alamitos, CA, October 1996.

          [Sobierajski95] L. Sobierajski and R. Avila. \"A Hardware Acceleration Method for Volumetric Ray Tracing.\" In Proceedings of Visualization '95. pp. 27-34, IEEE Computer Society Press, Los Alamitos, CA, October 1995.

          [Totsuka92] T. Totsuka and M. Levoy. \"Frequency Domain Volume Rendering.\" Computer Graphics (SIG-GRAPH '93). pp. 271--278, August 1993.

          [Wernecke94] J. Wernecke. The Inventor Mentor. Addison-Wesley, Reading MA,1994.

          [Westover90] L. Westover. \"Footprint Evaluation for Volume Rendering.\" Computer Graphics (SIGGRAPH '90). 24(4):36, 1990.

          [Wilhelms91] J. Wilhelms and A. Van Gelder. \"A Coherent Projection Approach for Direct Volume Rendering.\" Computer Graphics (SIGGRAPH '91). 25(4):275--284, 1991.

          [Wilhelms96] J. P. Wilhelms, A. Van Gelder, P. Tarantino, J. Gibbs. \"Hierarchical and Parallelizable Direct Vol-ume Rendering for Irregular and Multiple Grids.\" In Proceedings of Visualization '96. pp. 73-80, IEEE Computer Society Press, Los Alamitos, CA, October 1996.

          [Yagel92a] R. Yagel, D. Cohen, and A. Kaufman. \"Normal Estimation in 3D Discrete Space.\" The Visual Computer. pp. 278--291, 1992.

          [Yagel92b] R. Yagel and A. Kaufman. \"Template-based Volume Viewing.\" In Proceedings of Eurographics '92. pp. 153--167, September 1992.

          [Zeleznik93] R. C. Zeleznik, K. P. Herndon, D. C. Robbins, N. Huang, T. Meyer, N. Parker, J. F. Hughes. \"An Interactive Toolkit for Constructing 3D Interfaces.\" Computer Graphics (Proceedings of Siggraph '93). 27(4):81--84. July 1993.

          [Zuiderveld92] K. J. Zuiderveld, A. h. j. Koning, and M. A. Viergever. \"Acceleration of Ray-Casting Using 3D Distance Transforms.\" In Proceedings of Visualization and Biomedical Computing, pp. 324--335, October 1992.

          "},{"location":"VTKBook/07Chapter7/#723-exercises","title":"7.23 Exercises","text":"

          7.1 In astronomy, photographs can be taken that show the movements of the stars over a period of time by keeping the camera's shutter open. Without accounting for the rotation of the earth, these photographs display a swirl of circular arcs all centered about a common point. Such time lapse photography is essentially capturing motion blur. If we tried to simulate these images using the motion blur technique described in this chapter, they would look different from the photographs. Why is this? How could you change the simple motion blur algorithm to correct this?

          7.2 In Figure 7-25 we show the difference between stereo rendering with two or one view planes. If you were viewing a rectangle head-on (its surface normal parallel to your direction), what artifacts would be introduced by rendering onto one view plane while using the equations for two planes?

          7.3 On some graphics systems transparent objects are rendered using a technique called screen door transparency. Basically, every pixel is either completely opaque or completely transparent. Any value in between is approximated using dithering. So a polygon that was 50 percent opaque would be rendered by drawing only half of the pixels. What visual artifacts does this introduce? What blending problems can arise in using such a technique?

          7.4 In this chapter we describe a few different techniques for anti-aliased rendering. One technique involved rendering a large image and then scaling it down to the desired size using bilinear interpolation. Another technique involved rendering multiple images at the desired size using small camera movements and then accumulating them into a final image. When rendering a model with a surface representation, these two techniques will produce roughly the same result. When rendering a model with a wireframe representation there will be significant differences. Why is this?

          7.5 You need to create a small image of a volume dataset to include on your web page. The dataset contains voxels,512 and the desired image size is pixels.You100can use a software object-order method that projects each voxel onto the image, or a software ray casting method that casts one ray for each pixel. Assuming that identical images are created, which method would you select, and why? 7.6 Two software developers implement volume rendering methods. The first developer uses a software ray casting approach, while the second uses a graphics hardware texture mapping approach. The grayscale images are generated and displayed on a workstation with an 8 bit frame buffer (256 levels of gray). They both use the same interpolation method and the same compositing scheme, yet the two methods produce different images even though the same number of samples from identical locations were used to generate the images. Why is this?

          7.7 In the classification of some medical dataset, scalar values from 100 to 200 represent skin, 200 to 300 represent muscle and 300 to 400 represent bone. The color transfer functions define skin as tan, muscle as red, and bone as white. If we interpolate scalar value and then perform classification, what classification artifacts may appear in the image?

          7.8 The normal encoding example illustrated in Figure 7-22 produced 82 indices at a recursion depth of two, which would require seven bits of storage. If we instead use a recursion depth of three, how many indices are there? How many unique vector directions does this represent? How many bits of storage does this require?

          7.9 Writing an object-order back-to-front projection algorithm is more difficult for a perspective viewing transformation than a parallel viewing transformation. Explain why this is and draw a 2D diagram of the volume and the viewing frustum that illustrates the issues.

          "},{"location":"VTKBook/08Chapter8/","title":"Chapter 8 - Advanced Data Representation","text":"

          This chapter examines advanced topics in data representation. Topics include topological and geometric relationships and computational methods for cells and datasets.

          "},{"location":"VTKBook/08Chapter8/#81-coordinate-systems","title":"8.1 Coordinate Systems","text":"

          We will examine three different coordinate systems: the global, dataset, and structured coordinate systems. Figure 8-1 shows the relationship between the global and dataset coordinate systems, and depicts the structured coordinate system. Figure 8-1. Local and global coordinate systems."},{"location":"VTKBook/08Chapter8/#global-coordinate-system","title":"Global Coordinate System","text":"

          The global coordinate system is a Cartesian, three-dimensional space. Each point is expressed as a triplet of values (x,y,z) along the x, y, and z axes. This is the same system that was described in \"Coordinate Systems\" in Chapter 3 - Computer Graphics Primer).

          The global coordinate system is always used to specify dataset geometry (i.e., the point coordinates), and data attributes such as normals and vectors. We will use the word \"position\" to indicate that we are using global coordinates.

          "},{"location":"VTKBook/08Chapter8/#dataset-coordinate-system","title":"Dataset Coordinate System","text":"

          The dataset, or local, coordinate system is based on combined topological and geometric coordinates. The topological coordinate is used to identify a particular cell (or possibly a subcell), and the geometric coordinate is used to identify a particular location within the cell. Together they uniquely specify a location in the dataset. Here we will use the word \"location\" to refer to local or dataset coordinates.

          The topological coordinate is an \"id\": a unique, nonnegative integer number referring to either a dataset point or cell. For a composite cell, we use an additional \"sub-id\" to refer to a particular primary cell that composes the composite cell. The sub-id is also unique and nonnegative. The id and sub-id together select a particular primary cell.

          To specify a location within the primary cell, we use geometric coordinates. These geometric coordinates, or parametric coordinates, are coordinates \"natural\" or canonical to the particular topology and dimension of a cell.

          We can best explain local coordinates by referring to an example. If we consider the polyline cell type shown in Figure 8-2, we can specify the position of a point by indicating 1) the polyline cell id, 2) the primary cell (i.e., line) sub-id and 3) the parametric coordinate of the line. Because the line is one-dimensional, the natural or parametric coordinate is based on the one-dimensional parameter r. Then any point along the line is given by a linear combination of the two end points of the line x_i and x_{i+1} \\begin{equation*} x(r) = (1 - r) x_i + r x_{i + 1} \\end{equation*} \\bf\\tag{8-1}

          where the parametric coordinate r is constrained between (0,1). In this equation we are assuming that the sub-id is equal to i.

          The number of parametric coordinates corresponds to the topological dimension of the cell. Three-dimensional cells will be characterized by the three parametric coordinates (r, s, t). For cells of topological order less than three, we will ignore the last (3 - n) parametric coordinates, where n is the topological order of the cell. For convenience and consistency, we also will constrain each parametric coordinate to range between (0,1).

          Every cell type will have its own parametric coordinate system. Later in this chapter we will describe the parametric coordinate systems in detail. But first we will examine another coordinate system, the structured coordinate system.

          "},{"location":"VTKBook/08Chapter8/#structured-coordinate-system","title":"Structured Coordinate System","text":"

          Many dataset types are structured. This includes image data and structured grids. Because of their inherent structure, they have their own natural coordinate system. This coordinate system is based on the i-j-k indexing scheme that we touched on in \"Image Data\" in Chapter 5.

          The structured coordinate system is a natural way to describe components of a structured dataset. By fixing some indices, and allowing the others to vary within a limited range, we can specify points, lines, surfaces, and volumes. For example, by fixing the i index i = i_0, and allowing the j and k indices to range between their minimum and maximum values, we specify a surface. If we fix three indices, we specify a point, if we fix two indices, we specify a line, and if we allow three indices to vary, we specify a volume (or sub-volume). The structured coordinate system is generally used to specify a region of interest (or ROI). The region of interest is an area that we want to visualize, or to operate on.

          There is a simple relationship between the point and cell id of the dataset coordinate system and the structured coordinate system. To obtain a point id pid given the indices (i_p, j_p, k_p) and dimensions (n_x, n_y, n_z) we use

          \\begin{equation*} \\frac{\\partial}{\\partial r_i} = \\sum_{j} J_{ij} \\frac{\\partial}{\\partial x_j} \\end{equation*} \\bf\\tag{8-2}

          with 0 \\leq i_p \\leq n_x, 0 \\leq j_p \\leq n_y, 0 \\leq k_p \\leq n_z. (We can use this id to index into an array of points or point attribute data.) This equation implicitly assumes an ordering of the points in topological space. Points along the i axis vary fastest, followed by the j and then the $$k axes. A similar relationship exists for cell id's

          \\begin{equation*} \\text{cell}_\\text{id} = i_p + j_p (n_x - 1) + k_p (n_x - 1)(n_y - 1) \\end{equation*} \\bf\\tag{8-2}

          Here we have taken into account that there are one fewer cells along each topological axes than there are points.

          "},{"location":"VTKBook/08Chapter8/#82-interpolation-functions","title":"8.2 Interpolation Functions","text":"

          Computer visualization deals with discrete data. The data is either supplied at a finite number of points or created by sampling continuous data at a finite number of points. But we often need information at positions other than these discrete point locations. This may be for rendering or for sub-sampling the data during algorithm execution. We need to interpolate data from known points to some intermediate point using interpolation functions.

          Interpolation functions relate the values at cell points to the interior of the cell. Thus, we assume that information is defined at cell points, and that we must interpolate from these points. We can express the result as a weighted average of the data values at each cell point.

          Figure 8-2. Interpolation is a linear combination of local interpolation functions. Interpolation functions are scaled by data values at cell points."},{"location":"VTKBook/08Chapter8/#general-form","title":"General Form","text":"

          To interpolate data from the cell points p_i to a point p that is inside the cell, we need three pieces of information:

          1. the data values at each cell point,

          2. the parametric coordinates of the point p within the cell, and

          3. the cell type including interpolation functions.

          Given this information, the interpolation functions are a linear combination of the data values at the cell points

          \\begin{equation*} d = \\sum_{i = 0}^{n - 1}W_i\\, d_i \\end{equation*} \\bf\\tag{8-4}

          where d is the data value at the interior cell location (r,s,t), d_i is the data value at the i^{th} cell point, and W_i is a weight at the i^{th} cell point. The interpolation weights are functions of the parametric coordinates W_i = W(r,s,t). In addition, because we want d = d_i when the interior point coincides with a cell point, we can place additional constraints on the weights

          \\begin{equation*} W_i = 1, W_{j \\neq i} = 0 \\quad \\text{when} \\quad p = p_i \\end{equation*} \\bf\\tag{8-5}

          We also desire the interpolated data value d to be no smaller than the minimum d_i and no larger than the maximum d_i. Thus the weights should also satisfy

          \\begin{equation*} \\sum W_i = 1, \\quad 0 \\leq W_i \\leq 1 \\end{equation*} \\bf\\tag{8-6}

          The interpolation functions are of a characteristic shape. They reach their maximum value W_i = 1 at cell point p_i, and are zero at all other points. Examining Equation 8-1, we draw Figure 8-2 and see that each interpolation function has the shape of a peaked \"hat,\" and that interpolation is a linear combination of these hat functions, scaled by the data value at each point.

          Equation 8-4 is the general form for cell interpolation. It is used to interpolate any data value defined at the cell points to any other point within the cell. We have only to define the specific interpolation functions W_i for each cell type.

          "},{"location":"VTKBook/08Chapter8/#specific-forms","title":"Specific Forms","text":"

          Each cell type has its own interpolation functions. The weights W_i are functions of the parametric coordinates r, s, and t. In this section we will define the parametric coordinate system and interpolation function for each primary cell type. Composite cells use the interpolation functions and parametric coordinates of their composing primary cells. The only difference in coordinate system specification between primary and composite cells is that composite cells use the additional sub-id to specify a particular primary cell.

          Vertex. Vertex cells do not require parametric coordinates or interpolation functions since they are zero-dimensional. The single weighting function is W_0 = 1.

          Line. Figure 8-3 shows the parametric coordinate system and interpolation functions for a line.The line is described using the single parametric coordinate r. Figure 8-3. Parametric coordinate system and interpolation functions for a line.

          Pixel. Figure 8-4 shows the parametric coordinate system and interpolation functions for a pixel cell type. The pixel is described using the two parametric coordinates (r,s). Note that the pixel edges are constrained to lie parallel to the global coordinate axes. These are often referred to as bilinear interpolation functions. Figure 8-4. Parametric coordinate system and interpolation functions for a pixel.

          Quadrilateral. Figure 8-5 shows the parametric coordinate system and interpolation functions for a quadrilateral cell type. The quadrilateral is described using the two parametric coordinates (r,s). Figure 8-5. Parametric coordinate system and interpolation functions for a quadrilateral

          Triangle. Figure 8-6 shows the parametric coordinate system and interpolation functions for a triangle cell type. The triangle is characterized using the two parametric coordinates (r,s). Figure 8-6. Parametric coordinate system and interpolation functions for a triangle.

          Polygon. Figure 8-7 shows the parametric coordinate system and interpolation functions for a polygon cell type. The polygon is characterized using the two parametric coordinates (r,s). The parametric coordinate system is defined by creating a rectangle oriented along the first edge of the polygon. The rectangle also must bound the polygon.

          The polygon poses a special problem since we do not know how many vertices define the polygon. As a result, it is not possible to create general interpolation functions in the fashion of the previous functions we have seen. Instead, we use a function based on weighted distance squared from each polygon vertex.

          The weighted distance squared interpolation functions work well in practice. However, there are certain rare cases where points topologically distant from the interior of a polygon have an undue effect on the polygon interior (Figure 8-8). These situations occur only if the polygon is concave and wraps around on itself. Figure 8-7. Parametric coordinate system and interpolation functions for a polygon. Figure 8-8. Potential problem with distance-based interpolation functions.

          Tetrahedron. Figure 8-9 shows the parametric coordinate system and interpolation functions for a tetrahedron cell type. The tetrahedron is described using the three parametric coordinates (r,s,t). Figure 8-9. Parametric coordinate system and interpolation functions for a tetrahedron.

          Voxel. Figure 8-10 shows the parametric coordinate system and interpolation functions for a voxel cell type. The voxel is described using the three parametric coordinates (r,s,t). Note that the voxel edges are constrained to lie parallel to the global coordinate axes. These are often referred to as tri-linear interpolation functions. Figure 8-10. Parametric coordinate system and interpolation functions for a voxel.

          ** Hexahedron. Figure 8-11** shows the parametric coordinate system and interpolation functions for a hexahedron cell type. The hexahedron is described using the three parametric coordinates (r,s,t).

          Figure 8-11. Parametric coordinate system and interpolation functions for a hexahedron.

          Wedge. Figure 8-12 shows the parametric coordinate system and interpolation functions for a wedge cell type. The wedge is described using the three parametric coordinates (r,s,t). Figure 8-12. Parametric coordinate system and interpolation functions for a wedge.

          Pyramid. Figure 8-13 shows the parametric coordinate system and interpolation functions for a pyramid cell type. The pyramid is described using the three parametric coordinates (r,s,t). Figure 8-13. Parametric coordinate system and interpolation functions for a pyramid.

          Pentagonal Prism. Figure 8-14 shows the parametric coordinate system and interpolation functions for a pentagonal prism cell type. The pentagonal prism is described using the three parametric coordinates (r,s,t). Figure 8-14 Parametric coordinate system and interpolation functions for a pentagonal prism.

          Hexagonal Prism. Figure 8-15 shows the parametric coordinate system and interpolation functions for a hexagonal prism cell type. The hexagonal prism is described using the three parametric coordinates (r,s,t). Figure 8-15. Parametric coordinate system and interpolation functions for a hexagonal prism.

          Quadratic Edge. Figure 8-16 shows the parametric coordinate system and interpolation functions for a quadratic edge cell type. The quadratic edge is described using the single parametric coordinate r. Figure 8-16. Parametric coordinate system and interpolation functions for a quadratic edge.

          Quadratic Triangle. Figure 8-17 shows the parametric coordinate system and interpolation functions for a quadratic triangle cell type. The quadratic triangle is described using the two parametric coordinates (r,s). Figure 8-17 Parametric coordinate system and interpolation functions for a quadratic triangle.

          Quadratic Quadrilateral. Figure 8-18 shows the parametric coordinate system and interpolation functions for a quadratic quadrilateral cell type. The quadratic quadrilateral is described using the two parametric coordinates (r,s). Note that because the interpolation functions are most easily expressed in the interval (-1,1), a coordinate shift is performed to the $(\\xi, \\eta) coordinates defined in this range. Also, the notation \\xi_i and \\eta_i is introduced. These are the parametric coordinates at the i^{th} point. Figure 8-18. Parametric coordinate system and interpolation functions for a quadratic quadrilateral. In VTK parametric coordinates (r,s) run between (0,1), hence the coordinate system shift into the (\u03be, \u03b7) parametric system ranging from (-1,1). Note that \u03bei, \u03b7i and \u03b6i refer to the parametric coordinates of the ith point.

          Quadratic Tetrahedron. Figure 8-19 shows the parametric coordinate system and interpolation functions for a quadratic tetrahedron cell type. The quadratic tetrahedron is described using the three parametric coordinates (r,s,t). Figure 8-19. Parametric coordinate system and interpolation functions for a quadratic tetrahedron. In VTK parametric coordinates (r,s,t) run between (0,1), hence the coordinate system shift into the (\u03be, \u03b7 and \u03b6) parametric system ranging from (-1,1).

          Quadratic Hexahedron. Figure 8-20 shows the parametric coordinate system and interpolation functions for a quadratic hexahedron cell type. The quadratic hexahedron is described using the three parametric coordinates (r,s,t). Note that because the interpolation functions are most easily expressed in the interval (-1,1), a coordinate shift is performed to the (\\xi, \\eta, \\zeta) coordinates defined in this range. Also, the notation \\xi_i, \\eta_i and \\zeta_i is introduced. These are the parametric coordinates at the i^{th} point. Figure 8-20. Parametric coordinate system and interpolation functions for a quadratic hexahedron. In VTK parametric coordinates (r,s,t) run between (0,1), hence the coordinate system shift into the (\u03be, \u03b7 and \u03b6) parametric system ranging from (-1,1). Note that \u03bei, \u03b7i amd \u03b6i refer to the parametric coordinates of the ith x point.

          Quadratic Wedge. Figure 8-21 shows the parametric coordinate system and interpolation functions for a quadratic wedge cell type. The quadratic wedge is described using the three parametric coordinate (r,s,t). Figure 8-21. Parametric coordinate system and interpolation functions for a quadratic wedge.

          Quadratic Pyramid. Figure 8-22 shows the parametric coordinate system and interpolation functions for a quadratic pyramid cell type. The quadratic pyramid is described using the three parametric coordinates (r,s,t). Note that because the interpolation functions are most easily expressed in the interval (-1,1), a coordinate shift is performed to the (\\xi, \\eta, \\zeta) coordinates system defined in this range. Also, the notation \\xi_i, \\eta_i$ and \\zeta_i is introduced, these are the parametric coordinate at the i^{th} point. (The shape functions and derivatives were implemented thanks to the Center For Aerospace Structures http://www.colorado.edu/engineering/CAS.) Figure 8-22. Parametric coordinate system and interpolation functions for a quadratic pyramid. In VTK parametric coordinates (r,s,t) run between (0,1), hence the coordinate system shift into the (\u03be,\u03b7,\u03b6) parametric system ranging from (-1,1). Note that \u03bei, \u03b7i and \u03b6i refer to the parametric coordinates of the ith x point.."},{"location":"VTKBook/08Chapter8/#83-cell-tessellation","title":"8.3 Cell Tessellation","text":"

          As briefly introduced in Chapter 5 - Data Representation, nonlinear cells are often used in various numerical techniques such as the finite element method. While some visualization systems support nonlinear cells directly, typically only quadratic and occasionally cubic formulations are supported (for example, VTK supports quadratic cells). This represents only a small subset of the formulations currently available in numerical packages, and ignores the unlimited potential cell formulations. To address this important problem, visualization systems may provide an adaptor framework (see Figure 8-23) that enables users to interface their own simulation system to the visualization system [Schroeder06]. Such a framework requires writing adaptor classes that are derived from visualization dataset and cell base classes (in the figure these are labeled GenericDataSet and GenericAdaptorCell). These adaptors act like translators, converting data and method invocations to and from the forms expected by the visualization system and the numerical system. Like any other data objects, such adaptor cells and datasets can be processed directly by visualization algorithms. However, processing such general data objects is a difficult problem, since most visualization algorithms described in the scientific literature to date adopt the fundamental assumptions that cell geometry is linear. Removing this assumption may require introducing significant complexity into the algorithm, or may even require a new algorithm. For example, the marching cubes isocontouring algorithm assumes that the cells are ortho-rectilinear hexahedra; without this assumption elaborate transformations to and from parametric and global coordinate systems are required, and even then in highly curved nonlinear cells, degenerate or self-intersection isocontours may be generated without extensive topological and geometric checks. Thus the adaptor framework typically includes methods for tessellating nonlinear cells into the familiar linear cells, which can then be readily processed by conventional visualization algorithms. In the following section, we briefly described a simple method for tessellating higher order, nonlinear cells to produce linear cells. Figure 8-23. Cell adaptor framework."},{"location":"VTKBook/08Chapter8/#basic-approach","title":"Basic Approach","text":"

          The basic approach is to dynamically tessellate the cells of the GenericDataSet, and then operate on the resulting linear tessellation. As expressed in pseudo-code, a typical algorithm looks like this:

          for each cell c to be processed\n  {\n  if cell c meets selection criteria\n    {\n    linearDataSet = TessellateCell(c)\n    for each linear cell cl in linearDataSet\n      {\n      OperateOn(cl)\n      }\n    }\n }\n

          It is important not to tessellate the entire dataset all at once, since this may produce excessive demands on memory resources, and many algorithms visit only a subset of a dataset's cells. Thus the pseudo-code above refers to a selection criterion, which varies depending on the nature of the algorithm. For example, an isocontouring algorithm may check to see whether the cell's scalar values span the current isocontour value.

          While many tessellation algorithms are possible, those based on edge subdivision are particularly simple. The idea behind the algorithm is simple: each cell edge e is evaluated via an error metric E and may be marked for subdivision if any error measure \\epsilon_i exceeds a corresponding error threshold $\\epsilon epsilon{^i}

          \\begin{equation*} \\text{split edge if} (\\epsilon_i > \\epsilon_i^{\\text{T}}), \\quad \\text{for all} \\quad \\epsilon_i \\in E \\end{equation*} \\bf\\tag{8-6}

          Based on the cell topology, and the particular edges requiring subdivision, templates are used to subdivide the cell. This process continues recursively until the error metric is satisfied on all edges. One advantage of this algorithm is that cells can be tessellated independently. This is because edge subdivision is a function of one or more error measures that consider only information along the edge, and does not need to take into account cell information. Therefore no communication across cell boundaries is required, and the algorithm is well suited for parallel processing and on the fly tessellation as cells are visited during traversal.

          Some templates for cell subdivision are shown in Figure 8-24. Note that in some cases a choice must be made in terms of which diagonal to select for tessellation (for example, the dashed line in Figure 8-24(b)). In 2D, this choice can be made arbitrarily, however in 3D the choice must be consistent with the cell's face neighbor. In order to preserve the simplicity of the algorithm, including avoiding inter-cell communication, simple tie-breaking rules for selecting the diagonal on the faces of 3D cells are adopted. These rules include using the shortest diagonal (measured in the global coordinate system), or using a topological decider based on selecting the diagonal with the smallest point id. (A topological decider is necessary when the geometric distance measure is inconclusive.) Figure 8-24. Three cases from the subdivision table for a triangle. Filled circles indicate that the edge is marked for subdivision."},{"location":"VTKBook/08Chapter8/#error-measures","title":"Error Measures","text":"

          The algorithm described above is adaptive because edge splitting is controlled by local mesh properties and/or its relation to the view position. Since the goal is to insure that the quality of the tessellation is consistent with the particular requirements of the visualization, we expect the adapted tessellation to be of better quality as compared to a fixed subdivision with the same number of simplices, or have fewer simplices for tessellations of equal quality.

          Our design allows for the definition of multiple error measures. As indicated in Equation 8-7, the error metric consists of several error measures, each of which evaluates local properties of the edge against the linear approximation, and compares the measure against a user-specified threshold. If any measure exceeds the threshold, then the edge is subdivided. These error measures may evaluate geometric properties, approximation to solution attributes, or error related to the current view, among other possibilities. Error measures based on geometry or attributes are independent of view and the mesh requires only one initial tessellation.

          The following paragraphs describes several error measures that have been found to be useful in practice. Since the tessellator is designed to process a list of error measures, it is straightforward to add new ones (by deriving from the GenericSubdivisionErrorMetric class) and/or combine it with existing error measures.

          Figure 8-25. Definition of the geometric and attribute error measures.
          • Object-Based Geometric Error Measure. Referring to Figure8-25(left), this error measure is the perpendicular distance, d, from the edge center point C to the straight line passing through the cell edge vertices (A and B). Note that d is computed in world coordinates, but C is computed by evaluation at the parametric center of the edge. The perpendicular distance is used rather than the distance between C and D4 because if C lies on (AB) but is not coincident with D the error is non-zero, resulting in many useless edge subdivisions.

          • Object-Based Flatness Error Measure. This error measure is the angle \\alpha between the chords (AC) and (CB) passing through the real mid-point C. As the angle approaches 180\\circ the edge becomes flat. The threshold is the angle over which the edge is viewed as flat.

          • Attribute-Based Error Measure. Referring to Figure 8-25(right), this error measure is the distance between a^i the linearly interpolated value of an attribute at the midpoint and the actual value of this attribute at the edge midpoint a^m.

          • Image-Based Geometric Error Measure. This error measure is the distance, in pixels, between the line (AB) projected in image space to the midpoint C also projected in image space. Because the computation involves projection through the current camera matrix, this error measure is view-dependent. As a result, the tessellation may be crude in portions of the mesh away from the camera. Note that one of the disadvantages of this approach is that tessellation may be required each time the camera is repositioned relative to the mesh.

          • "},{"location":"VTKBook/08Chapter8/#advanced-methods","title":"Advanced Methods","text":"

            Attentive readers will have noticed that the subdivision scheme described previously may fail to capture all the features of the higher-order basis. For example, imagine a scalar function across a triangle where the peak value of the function occurs in the center of the triangle, and the variation across the edges is zero. The edge subdivision algorithm described previously will not capture the peak, hence an algorithm such as isocontouring will produce inaccurate results. Linear isocontouring algorithms require that the following conditions are met in order to produce topologically correct results.

            • each mesh edge intersects an isocontour of a particular value at most once,

            • no isocontour intersects a mesh face without intersecting at least two edges of the face, and

            • no isocontour is completely contained within a single element.

            By definition, these conditions are directly related to critical points, since an extremum of a differentiable function over an open domain is necessarily a critical point. Linear meshes assume that all extrema of the scalar field occur at element vertices, but in general when using a higher-order basis this is not the case, and extrema can be found interior to a cell.

            To address this problem, a pre-triangulation of the basis must be performed. The pre-triangulation must identify all critical points in the interior, on the faces, or on the edge of a cell, and then insert these points into the triangulation. For example, an initial triangulation based on the vertices of the higher-order cell can be performed first, followed by insertion into the triangulation using a method such as Delaunay triangulation or equivalent (see \"Triangulation Techniques\" in Chapter 9). The pre-triangulation can then be followed by the standard edge-based algorithm presented previously.

            "},{"location":"VTKBook/08Chapter8/#84-coordinate-transformation","title":"8.4 Coordinate Transformation","text":"

            Coordinate transformation is a common visualization operation. This may be either transformation from dataset coordinates to global coordinates, or global coordinates to dataset coordinates.

            "},{"location":"VTKBook/08Chapter8/#dataset-to-global-coordinates","title":"Dataset to Global Coordinates","text":"

            Transforming between dataset coordinates and global coordinates is straightforward. We start by identifying a primary cell using the cell id and sub-id. Then the global coordinates are generated from the parametric coordinates by using the interpolation functions of Equation 8-4. Given cell points p_i = p_i(x_i, y_i, z_i) the global coordinate p is simply

            \\begin{equation*} p = \\sum_{i = 0}^{n - 1} W_i(r_0, s_0, t_0)\\, p_i \\end{equation*} \\bf\\tag{8-8}

            where the interpolation weights W_ii are evaluated at the parametric coordinate (r_0, s_0, t_0).

            In the formulation presented here, we have used the same order interpolation functions for both data and cell geometry. (By order we mean the polynomial degree of the interpolating polynomials.) This is termed iso-parametric interpolation. It is possible to use different interpolation functions for geometry and data. Super-parametric interpolation is used when the order of the interpolation functions for geometry is greater than those used for data. Sub-parametric interpolation is used when the order of the interpolation functions for geometry is less than those used for data. Using different interpolation functions is commonly used in numerical analysis techniques such as the finite element method. We will always use the iso-parametric interpolation for visualization applications.

            "},{"location":"VTKBook/08Chapter8/#global-to-dataset-coordinates","title":"Global to Dataset Coordinates","text":"

            Global to dataset coordinate transformations are expensive compared to dataset to global transformations. There are two reasons for this. First, we must identify the particular cell C_i that contains the global point p. Second, we must solve Equation 8-4 for the parametric coordinates of p.

            To identify the cell C_i means doing some form of searching. A simple but inefficient approach is to visit every cell in a dataset and determine whether p lies inside any cell. If so, then we have found the correct cell and stop the search. Otherwise, we check the next cell in the list.

            This simple technique is not fast enough for large data. Instead, we use accelerated search techniques. These are based on spatially organizing structures such as an octree or three-dimensional hash table. The idea is as follows: we create a number of \"buckets,\" or data place holders, that are accessed by their location in global space. Inside each bucket we tag all the points or cells that are partially or completely inside the bucket. Then, to find a particular cell that contains point p, we find the bucket that contains p, and obtain all the cells associated with the bucket. We then evaluate inside/outside for this abbreviated cell list to find the single cell containing p. (See \"Searching\" in Chapter 8 for a more detailed description.)

            The second reason that global to dataset coordinate transformation is expensive is because we must solve the interpolation function for the parametric coordinates of p. Sometimes we can do this analytically, but in other cases we must solve for the parametric coordinates using numerical techniques.

            Consider the interpolation functions for a line (Figure 8-2). We can solve this equation exactly and find that \\begin{equation*} r = \\frac{x - x_0}{x_1 - x_0} = \\frac{y - y_0}{y_1 - y_0} = \\frac{z - z_0}{z_1 - z_0} \\bf\\tag{8-9} \\end{equation*}

            Similar relations exist for any cell whose interpolation functions are linear combinations of parametric coordinates. This includes vertices, lines, triangles, and tetrahedra. The quadrilateral and hexahedron interpolation functions are nonlinear because they are products of linear expressions for the parametric coordinates. As a result, we must resort to numerical techniques to compute global to dataset coordinate transformations. The interpolation functions for pixels and voxels are nonlinear as well, but because of their special orientation with respect to the x, y, and z coordinate axes, we can solve them exactly. (We will treat pixel and voxel types in greater depth in \"Special Techniques for Image Data\" in Chapter 8.)

            To solve the interpolation functions for parametric coordinates we must use nonlinear techniques for the solution of a system of equations. A simple and effective technique is Newton's method [Conte72].

            To use Newton's method we begin by defining three functions for the known global coordinate p = p(x,y,z) in terms of the interpolation functions W_i = W_i(r,s,t)

            \\begin{eqnarray*} f(r, s, t) &=& x - \\sum W_i \\, x_i = 0 \\\\ g(r, s, t) &=& y - \\sum W_i \\, y_i = 0 \\\\ h(r, s, t) &=& z - \\sum W_i \\, z_i = 0 \\end{eqnarray*} \\bf\\tag{8-10}

            and then, expanding the functions using a Taylor's series approximation,

            \\begin{eqnarray*} f(r, s, t) &\\simeq& f_0 + \\frac{\\partial f}{\\partial r}(r - r_0) + \\frac{\\partial f}{\\partial s}(s - s_0) + \\frac{\\partial f}{\\partial t}(t - t_0) + \\ldots \\\\ g(r, s, t) &\\simeq& g_0 + \\frac{\\partial g}{\\partial r}(r - r_0) + \\frac{\\partial g}{\\partial s}(s - s_0) + \\frac{\\partial g}{\\partial t}(t - t_0) + \\ldots \\\\ h(r, s, t) &\\simeq& h_0 + \\frac{\\partial h}{\\partial r}(r - r_0) + \\frac{\\partial h}{\\partial s}(s - s_0) + \\frac{\\partial h}{\\partial t}(t - t_0) + \\ldots \\\\ \\end{eqnarray*} \\bf\\tag{8-11}

            we can develop an iterative procedure to solve for the parametric coordinates. This yields the general form

            \\begin{equation*} \\left( \\begin{array}{c} r_{i + 1} \\\\ s_{i + 1} \\\\ t_{i + 1} \\end{array} \\right) = \\left( \\begin{array}{c} r_i \\\\ s_i \\\\ t_i \\end{array} \\right) - \\left( \\begin{array}{c c c} \\frac{\\partial f}{\\partial r} & \\frac{\\partial f}{\\partial s} & \\frac{\\partial f}{\\partial t} \\\\ \\frac{\\partial g}{\\partial r} & \\frac{\\partial g}{\\partial s} & \\frac{\\partial g}{\\partial t} \\\\ \\frac{\\partial h}{\\partial r} & \\frac{\\partial h}{\\partial s} & \\frac{\\partial h}{\\partial t} \\end{array} \\right)^{-1} \\left( \\begin{array}{c} f_i \\\\ g_i \\\\ h_i \\end{array} \\right) \\end{equation*} \\bf\\tag{8-10}

            Fortunately, Newton's method converges quadratically (if it converges) and the interpolation functions that we have presented here are well behaved. In practice, Equation 8-12 converges in just a few iterations.

            "},{"location":"VTKBook/08Chapter8/#85-computing-derivatives","title":"8.5 Computing Derivatives","text":"

            Interpolation functions enable us to compute data values at arbitrary locations within a cell. They also allow us to compute the rate of change, or derivatives, of data values. For example, given displacements at cell points we can compute cell strains and stresses or, given pressure values, we can compute the pressure gradient at a specified location.

            Figure 8-26. Computing derivatives in an 1D line cell.

            To introduce this process, we will begin by examining the simplest case: computing derivatives in a 1D line (Figure 8-26). Using geometric arguments, we can compute the derivatives in the r parametric space according to \\begin{equation*} \\frac{d s}{d r} = \\frac{s_1 - s_0}{1} = (s_1 - s_0) \\end{equation*} \\bf\\tag{8-13}

            where s_i is the data value at point i. In the local coordinate system x', which is parallel to the r coordinate system (that is, it lies along the \\vec{t} or \\vec{x_1} - \\vec{x_0}), the derivative is

            \\begin{equation*} \\frac{d s}{d x'} = \\frac{s_1 - s_0}{l} \\bf\\tag{8-14} \\end{equation*}

            where l is the length of the line.

            Another way to derive Equation 8-14 is to use the interpolation functions of Figure 8-3 and the chain rule for derivatives. The chain rule \\begin{equation*} \\frac{d}{d r} = \\frac{d}{dx'} \\frac{dx'}{dr} \\end{equation*} \\bf\\tag{8-15}

            allows us to compute the derivative \\frac{d}{d x'} using

            \\begin{equation*} \\frac{d}{d x'} = \\frac{d}{dr}/ \\frac{dx'}{dr} \\bf\\tag{8-16} \\end{equation*}

            With the interpolation functions we can compute the x' derivatives with respect to r as

            \\begin{equation*} \\frac{d x'}{d r} = \\frac{d}{dr} \\left(\\sum_{i}W_i \\, x_i' \\right) = -x_0' + x_1' = 1 \\end{equation*} \\bf\\tag{8-17}

            which, when combined with Equation 8-16 and Equation 8-13 for the s derivatives, yields Equation 8-14.

            One final step remains. The derivatives in the \\vec{x} coordinate system must be converted to the global x-y-z system. We can do this by creating a unit vector \\vec{v} as

            \\begin{equation*} \\vec{v} = \\frac{\\vec{x}_1 - \\vec{x}_0}{\\vert\\vec{x}_1 - \\vec{x}_0 \\vert} \\end{equation*} \\bf\\tag{8-18}

            where \\vec{x_0} and \\vec{x_1} are the locations of the two end points of the line. Then the derivatives in the x, y, and z directions can be computed by taking the dot products along the axes.

            \\begin{eqnarray*} \\frac{ds}{dx} &=& \\left(\\frac{s_1 - s_0}{1}\\right) \\vec{v} \\cdot (1, 0, 0) \\\\ \\frac{ds}{dy} &=& \\left(\\frac{s_1 - s_0}{1}\\right) \\vec{v} \\cdot (0, 1, 0) \\\\ \\frac{ds}{dz} &=& \\left(\\frac{s_1 - s_0}{1}\\right) \\vec{v} \\cdot (0, 0, 1) \\end{eqnarray*} \\bf\\tag{8-19}

            To summarize this process, derivatives are computed in the local r-s-t parametric space using cell interpolation. These are then transformed into a local x'-y'-z' Cartesian system. Then, if the x'-y'-z' system is not aligned with the global x-y-z coordinate system, another transformation is required to generate the result.

            We can generalize this process to three dimensions. From the chain rule for partial derivatives

            \\begin{eqnarray*} \\frac{\\partial}{\\partial x} &=& \\frac{\\partial}{\\partial r} \\frac{\\partial r}{\\partial x} \\ + \\frac{\\partial}{\\partial s} \\frac{\\partial s}{\\partial x} \\ + \\frac{\\partial}{\\partial t} \\frac{\\partial t}{\\partial x} \\\\ \\frac{\\partial}{\\partial y} &=& \\frac{\\partial}{\\partial r} \\frac{\\partial r}{\\partial y} \\ + \\frac{\\partial}{\\partial s} \\frac{\\partial s}{\\partial y} \\ + \\frac{\\partial}{\\partial t} \\frac{\\partial t}{\\partial y} \\\\ \\frac{\\partial}{\\partial z} &=& \\frac{\\partial}{\\partial r} \\frac{\\partial r}{\\partial z} \\ + \\frac{\\partial}{\\partial s} \\frac{\\partial s}{\\partial z} \\ + \\frac{\\partial}{\\partial t} \\frac{\\partial t}{\\partial z} \\end{eqnarray*} \\bf\\tag{8-20}

            or after rearranging

            \\begin{equation*} \\left( \\begin{array}{c} \\frac{\\partial}{\\partial r} \\\\ \\frac{\\partial}{\\partial s} \\\\ \\frac{\\partial}{\\partial t} \\end{array} \\right) = \\left( \\begin{array}{c c c} \\frac{\\partial x}{\\partial r} & \\frac{\\partial y}{\\partial r} & \\frac{\\partial z}{\\partial r} \\\\ \\frac{\\partial x}{\\partial s} & \\frac{\\partial y}{\\partial s} & \\frac{\\partial z}{\\partial s} \\\\ \\frac{\\partial x}{\\partial t} & \\frac{\\partial y}{\\partial t} & \\frac{\\partial z}{\\partial t} \\end{array} \\right) \\left( \\begin{array}{c} \\frac{\\partial}{\\partial x} \\\\ \\frac{\\partial}{\\partial y} \\\\ \\frac{\\partial}{\\partial z} \\end{array} \\right) = \\mathbf{J}\\left( \\begin{array}{c} \\frac{\\partial}{\\partial x} \\\\ \\frac{\\partial}{\\partial y} \\\\ \\frac{\\partial}{\\partial z} \\end{array} \\right) \\end{equation*} \\bf\\tag{8-21}

            The 3 \\times 3 matrix J is called the Jacobian matrix, and it relates the parametric coordinate derivatives to the global coordinate derivatives. We can rewrite Equation 8-21 into more compact form

            \\begin{equation*} \\frac{\\partial}{\\partial r_i} = \\sum_{j} J_{ij} \\frac{\\partial}{\\partial x_j} \\end{equation*} \\bf\\tag{8-21}

            and solve for the global derivatives by taking the inverse of the Jacobian matrix

            \\begin{equation*} \\frac{\\partial}{\\partial x_i} = \\sum_{j} J_{ij}^{-1} \\frac{\\partial}{\\partial r_j} \\end{equation*} \\bf\\tag{8-22}

            The inverse of the Jacobian always exists as long as there is a one-to-one correspondence between the parametric and global coordinate systems. This means that for any (r, s, t) coordinate, there corresponds only one (x, y, z) coordinate. This holds true for any of the parametric coordinate systems presented here, as long as pathological conditions such as cell self-intersection or a cell folding in on itself are avoided. (An example of cell folding is when a quadrilateral becomes non-convex.)

            In our one-dimensional example, the derivatives along the line were constant. However, other interpolation functions (e.g., Figure 8-5) may yield non-constant derivatives. Here, the Jacobian is a function of position in the cell and must be evaluated at a particular (r, s, t) coordinate value."},{"location":"VTKBook/08Chapter8/#86-topological-operations","title":"8.6 Topological Operations","text":"

            Many visualization algorithms require information about the topology of a cell or dataset. Operations that provide such information are called topological operations. Examples of these operations include obtaining the topological dimension of a cell, or accessing neighboring cells that share common edges or faces. We might use these operations to decide whether to render a cell (e.g., render only one-dimensional lines) or to propagate particles through a flow field (e.g., traversing cells across common boundaries).

            Before proceeding we need to define some terms from topology. Manifold topology describes a region surrounding a point that is topologically connected. That is, a region around the point is topologically equivalent to a small \"disk\" (in two-dimensions) or \"ball\" (in three-dimensions). Topology that is not manifold is termed non-manifold. Examples of manifold and non-manifold geometry are shown in Figure 8-27.

            There are some simple rules we can use to decide whether a surface or region approximated with cells is manifold or non-manifold. In two dimensions, if every edge of a two-dimensional cell is used by exactly one other cell, than the surface is locally manifold. In three dimensions, if every face of a three-dimensional cell is used by exactly one other cell, than the region is locally manifold.

            We also will use the term simplex on some occasions. A simplex of dimension n is the convex region defined by a set of n+1 independent points. A vertex, line, triangle, and tetrahedron are simplices of dimension 0, 1, 2, and 3, respectively as shown in Figure 8-28. \\begin{equation*} \\frac{\\partial}{\\partial x_i} = \\sum_{j} J_{ij}^{-1} \\frac{\\partial}{\\partial r_j} \\end{equation*} \\bf\\tag{8-23} Figure 8-27. Manifold and non-manifold surface topology. If the local neighborhood around a vertex is topologically a 2D disk (i.e., a small disk can be placed on the surface without tearing or overlapping), then the surface is manifold at that vertex. Figure 8-28. Simplices of dimension three and lower."},{"location":"VTKBook/08Chapter8/#cell-operation","title":"Cell Operation","text":"

            Cell operations return information about the topology of a cell. Typically, we want to know the topological order of the cell or the topology of the cell boundary.

            Given a cell C_i of topological dimension d, the cell is (implicitly) composed of boundary cells of topological order d-1 and lower. For example, a tetrahedron is composed of four two-dimensional triangles, six one-dimensional edges, and four zero-dimensional vertices. Cell operations return information about the number of boundary cells of a particular topological dimension, as well as the ordered list of points that define each bounding cell.

            Another useful cell operation returns the closest boundary cell of dimension d-1 given the parametric coordinates of the cell. This operation ties the geometry to the topology of the cell, as compared to the parametric coordinate system, which ties the topology to the geometry. The closest boundary cell operation is implemented by partitioning each cell into various regions, as illustrated in Figure 8-29. To determine the closest boundary cell we need only to identify the parametric region that the point lies in, and then return the appropriate boundary cell.

            Another useful cell operation is cell decomposition into simplices. Every cell can be decomposed into a collection of simplices. By doing so, and by operating on the simplex decomposition rather than the cell itself, we can create algorithms that are independent of cell type. For example, if we want to intersect two datasets of varied cell type, without simplex decomposition we would have to create methods to intersect every possible combination of cells. With simplex decomposition, we can create a single intersection operation that operates on only the limited set of simplices. The significant advantage of this approach is that as new cells are added to the visualization system, only the cell object (including its method for simplex decomposition) must be implemented, and no other objects need be modified.

            Figure 8-29. Closest boundary cell operation for quadrilateral cell."},{"location":"VTKBook/08Chapter8/#dataset-operations","title":"Dataset Operations","text":"

            Dataset operations return information about the topology of a dataset or topological information about the adjacency of cells. Typical operations include determining the neighbors of a cell or returning a list of all cells that use a particular point.

            We can formalize the adjacency operations by continuing the discussion of \"Cell Types\" in Chapter 5. Adjacency methods are used to obtain information about the neighbors of a cell. A neighbor of a particular cell C_i is simply a cell that shares one or more points in common with C_i. A vertex neighbor is a neighbor that shares one or more vertices. An edge neighbor is a neighbor that shares one or more edges. A face neighbor is a cell that shares vertices that define one of the faces of the cell. Note that a face neighbor is also an edge neighbor, and an edge neighbor is also a vertex neighbor.

            The adjacency operators are simple set operations. For a particular cell C_i defined by points and a point list \\vec{P} = (\\vec{p_1}, \\vec{p_2}, ..., \\vec{p_n}) with P \\subset P, where P typically corresponds to the points defining a boundary cell of C_i; the neighbors of C_i are the adjacency set A(C, P).

            The adjacency set is simply the intersection of the use sets for each point, excluding the cell C_i.

            \\begin{equation*} C_i = \\lbrace p_1, p_2, \\ldots, p_n \\rbrace = P \\end{equation*} \\bf\\tag{8-24}

            and a point list \\vec{P} = (\\vec{p}_1, \\vec{p}_2, ..., \\vec{p}_n) with \\vec{P}\\subset P , where P typically corresponds to the points defining a boundary cell of C_i; the neighbors of C_i are the adjacency set A(\\vec{C}, \\vec{P}) . The adjacency set is simply the intersection of the use sets for each point, excluding the cell C_ii.

            The adjacency set represents a variety of useful information. In a manifold object represented by a polyhedra, for example, each polygon must have exactly one edge neighbor for each of its edges. Edges that have no neighbors are boundary edges; edges that have more than one edge neighbor represent non-manifold topology. Datasets that consist of three-dimensional cells (e.g., unstructured grids) are topologically consistent only if, for each cell, there is exactly one face neighbor for each face. Faces that have no neighbors are on the boundary of the dataset. More than one face neighbor implies that the neighbors are self-intersecting (in 3D space).

            \\begin{equation*} A(C_i, \\overline{P}) = \\left(\\bigcap_{i} U(\\overline{p}_i)\\right) - C_i \\end{equation*} \\bf\\tag{8-25}"},{"location":"VTKBook/08Chapter8/#87-searching","title":"8.7 Searching","text":"

            Searching is an operation to find the cell containing a specified point p, or to locate cells or points in a region surrounding p. Algorithms requiring this operation include streamline generation, where we need to find the starting location within a cell; probing, where the data values at a point are interpolated from the containing cell; or collision detection, where cells in a certain region must be evaluated for intersection. Sometimes (e.g., image datasets), searching is a simple operation because of the regularity of data. However, in less structured data, the searching operation is more complex.

            To find the cell containing p, we can use the following naive search procedure. Traverse all cells in the dataset, finding the one (if any) that contains p. To determine whether a cell contains a point, the cell interpolation functions are evaluated for the parametric coordinates (r,s,t). If these coordinates lie within the cell, then p lies in the cell. The basic assumption here is that cells do not overlap, so that at most a single cell contains the given point p. To determine cells or points lying in the region surrounding p, we can traverse cells or points to see whether they lie within the region around p. For example, we can choose to define the region as a sphere centered at p. Then, if a point or the points composing a cell lie in the sphere, the point or cell is considered to be in the region surrounding p.

            These naive procedures are unacceptable for all but the smallest datasets, since they are of order O(n), where n is the number of cells or points. To improve the performance of searching, we need to introduce supplemental data structures to support spatial searching. Such structures are well-known and include MIP maps, octrees, kd-trees, and binary sphere trees (see \"Bibliographic Notes\" at the end of this chapter).

            The basic idea behind these spatial search structures is that the search space is subdivided into smaller parts, or buckets. Each bucket contains a list of the points or cells that lie within it. Buckets are organized in structured fashion so that constant or logarithmic time access to any bucket is possible. For example, if we assign a portion of 2D Euclidean space into a grid of n by m buckets, the location of p in a particular bucket can be determined with two subtractions and two divisions: a constant time access. Similarly, the location of p in a non-uniformly subdivided octree is determined in logarithmic time, since recursive insertion into octant children is required. Once the bucket is found, the search is then limited to the points or cells contained within it. In a properly designed spatial search structure, the number of points or cells in a bucket is a small portion of the total number of cells and less than a fixed value. Thus, the time to search within a bucket can be bounded by a fixed constant. The result is that introducing spatial search structures reduces search times to a maximum O(log n), or better yet O(n).

            We have two options when applying spatial search structures. We may insert points into the search structure, or we may insert cells, depending on the application. There are advantages and disadvantages to both approaches. Inserting cells into buckets is not a trivial operation. In general, cells are arbitrarily oriented and shaped, and will not fit completely into a single bucket. As a result, cells often span multiple buckets. To reliably determine whether a cell is in a bucket requires geometric intersection tests, a costly operation. Another approach is to use the bounding box of a cell to decide which bucket(s) a cell belongs in. We only need to intersect the bounding box with a bucket to determine whether the cell may belong in the bucket. Unfortunately, even though this operation is generally fast, often cells are associated with buckets even though they may not actually lie inside them, wasting (in large models) memory resources and extra processing time.

            Figure 8-30. Using search structure (containing points) to find cells. (a) Points are associated with appropriate bucket. Point $p$ is used to index into bucket, and closest point(s) pi is found. Cells using pi are evaluated for the cell containing p. (b) Sometimes closest points pi are not used by cells containing p.

            Inserting points into a search structure is easier because points can be uniquely placed into a bucket. Inserting points also allows us to search for both points and cells. Cells can be found by using p to index into the appropriate bucket. The closest point(s) p_i to p are then located. Using the topological adjacency operator to retrieve the cells using points pi, we can then search these cells for the cell containing p. This procedure must be used with caution, however, since the closest points may not be used by the cells containing p (Figure 8-30)."},{"location":"VTKBook/08Chapter8/#88-cell-line-intersection","title":"8.8 Cell / Line Intersection","text":"

            An important geometric operation is intersection of a line with a cell. This operation can be used to interactively select a cell from the rendering window, to perform ray-casting for rendering, or to geometrically query data.

            In the Visualization Toolkit each cell must be capable of intersecting itself against a line. Figure 8-31 summarizes these operations for the nine linear primary cell types supported by VTK. (Intersections on composite cells are implemented by intersecting each primitive cell in turn.) Note that the procedure for intersecting higher order cells is the same.

            Line/cell intersection for 0D, 1D, and 2D cells follows standard approaches. Intersection against 3D cells is difficult. This is because the surfaces of these cells are described parametrically and are not necessarily planar. For example, to intersect a line with a tetrahedron, we can intersect the line against the four triangular faces of the tetrahedron. Hexahedron, however, may have non-planar faces. Thus, we cannot intersect the line against six quadrilateral, planar faces. Instead, we use line/face intersection as an initial guess, and project the intersection point onto the surface of the cell. This produces an approximate result, but is accurate enough for most applications.

            Figure 8-31. Summary of line/cell intersection operations for nine primitive cell types. Line is assumed normalized in parametric coordinate t with $0 \\leq t \\leq 1$."},{"location":"VTKBook/08Chapter8/#89-scalars-and-colors","title":"8.9 Scalars and Colors","text":"

            There is a close correspondence between scalar data and colors. We touched on this in \"Color Mapping\" in Chapter 6, where we saw how to use a color table to map scalar values into a color specification (i.e., red, green, blue, and alpha, or RGBA). There are cases, however, when we want to circumvent this mapping process. Such cases occur when color data is supplied instead of scalar data.

            A common example occurs in imaging. Recall that an image is a regular, two-dimensional array of points. The points define pixels, which in turn form a two-dimensional image dataset. Images are frequently stored as a pair of dimensions along with data values. The data values may be one of black and white (e.g., a bitmap), grayscale, or color (e.g., a pixmap). Bitmaps and gray-scale images can be directly cast into the form of single-values scalar data, and we can use our earlier approach. Pixmaps, however, consist of (at a minimum) three values per pixel of red, green, and blue. (Sometimes, a fourth alpha opacity value may also be included.) Thus, pixmaps cannot be directly cast into scalar form.

            To accommodate color data, conversions between multicomponent color data and single-valued scalars must be defined. Each class must act as if it were a scalar: that is, a request for data at a particular point must return a single scalar value. This allows us to use standard scalar visualization techniques such as contouring or warping. Thus a mapping from RGB or RGBA color coordinates to a single scalar value is required.

            The simplest conversion is to select one of n components in a color tuple and use that as the scalar value. Another common mapping returns the luminance Y of a color. Given three components, RGB, the luminance is

            \\begin{equation*} Y = 0.30 R + 0.59 G + 0.11 B \\end{equation*} \\bf\\tag{8-26}

            If the color includes transparency, RGBA, the luminance is

            \\begin{equation*} Y = A(0.30 R + 0.59 G + 0.11 B) \\end{equation*} \\bf\\tag{8-27}

            Using this abstraction allows us to treat single-valued scalars and scalars consisting of multi-valued colors the same. The end result is that we can mix both types of scalar data into our visualization networks.

            "},{"location":"VTKBook/08Chapter8/#810-special-techniques-for-image-data","title":"8.10 Special Techniques for Image Data","text":"

            A significant attraction of using 2and 3-dimensional image data is the speed and simplicity of computation. In this section, we will explore specific techniques that exploit the special regular topology and geometry of image data.

            "},{"location":"VTKBook/08Chapter8/#coordinate-transformation","title":"Coordinate Transformation","text":"

            Given a point p we can find the structured coordinates by performing three division operations (Figure 8-32). Taking the integer floor function yields the structured coordinates. Taking the fractional part of the result yields the parametric coordinates of the cell. We can then use Equation 8-3 to convert to dataset coordinates. Figure 8-32. Image data coordinate transformation."},{"location":"VTKBook/08Chapter8/#derivative-computation","title":"Derivative Computation","text":"

            Because the image dataset is oriented parallel to the coordinate x, y, and z axes, and because the spacing of points in each of these directions is regular, finite difference schemes can be used to compute partial derivatives at the cell points. Referring to Figure 8-33, we see that central differences can be used in each of the three directions according to the equation: \\begin{eqnarray*} g_x &=& \\frac{d(x_0 + \\Delta x_0, y_0, z_0) - d(x_0 - \\Delta x_0, y_0, z_0)}{2 \\Delta x_0} \\\\ g_y &=& \\frac{d(x_0, y_0 + \\Delta y_0, z_0) - d(x_0, y_0 - \\Delta y_0, z_0)}{2 \\Delta y_0} \\\\ g_z &=& \\frac{d(x_0, y_0, z_0 + \\Delta z_0) - d(x_0, y_0, z_0 - \\Delta z_0)}{2 \\Delta z_0} \\end{eqnarray*} \\bf\\tag{8-28}

            (Note that at the boundary of the dataset, one-sided differences may be used.) We can use these equations to compute derivatives within the cell as well. We simply compute the derivatives at each cell point from Equation 8-28, and then use the cell interpolation functions to compute the derivative at the point inside the cell.

            Figure 8-33. Using finite differences to compute derivatives on image data."},{"location":"VTKBook/08Chapter8/#topology","title":"Topology","text":"

            Structured datasets lend themselves to efficient topological operations (i.e., both image data and structured grids). Given a cell id, it is possible to determine vertex, edge, or face neighbors using simple constant time operations. First, given the cell id in a three-dimensional structured dataset, we use a combination of division and modulo arithmetic to compute the structured coordinates

            \\begin{eqnarray*} i &=& \\text{id} \\mod (n_x - 1) \\\\ j &=& \\frac{\\text{id}}{n_x - 1} \\mod (n_y - 1) \\\\ k &=& \\frac{\\text{id}}{(n_x - 1)(n_y - 1)} \\end{eqnarray*} \\bf\\tag{8-29}

            Face neighbors are determined by incrementing one of the i, j, or k indices. Edge neighbors are determined by incrementing any two indices, while vertex neighbors are found by incrementing all three indices. Care must be taken while incrementing to insure that the indices fall in the range

            \\begin{eqnarray*} 0 \\leq i < n_x - 1 \\\\ 0 \\leq j < n_y - 1 \\\\ 0 \\leq k < n_z - 1 \\bf\\tag{8-30} \\end{eqnarray*}

            An attempt to index outside these ranges indicates that the neighbor in question does not exist.

            "},{"location":"VTKBook/08Chapter8/#searching","title":"Searching","text":"

            Given a point p = (x, y, z) we can determine the cell containing p by using the equations given in Figure 8-32. These equations generate the structured coordinates (i, j, k), which can then be converted to cell id (i.e., dataset coordinates) using Equation 8-3.

            To find the closest point to p, we compute the structured coordinates by rounding to the nearest integer value (instead of using the floor function). Thus,

            \\begin{eqnarray*} i = \\text{int}\\left( \\frac{x-x_0}{x_1 - x_0} \\right) \\\\ j = \\text{int}\\left( \\frac{y-y_0}{y_1 - y_0} \\right) \\\\ k = \\text{int}\\left( \\frac{z-z_0}{z_1 - z_0} \\right) \\end{eqnarray*} \\bf\\tag{8-30}"},{"location":"VTKBook/08Chapter8/#811-putting-it-all-together","title":"8.11 Putting It All Together","text":"

            In this section we will finish our earlier description of an implementation for unstructured data. We also define a high-level, abstract interface for cells and datasets. This interface allows us to implement the general (i.e., dataset specific) algorithms in the Visualization Toolkit. We also describe implementations for color scalars, searching and picking, and conclude with a series of examples to demonstrate some of these concepts.

            "},{"location":"VTKBook/08Chapter8/#unstructured-topology","title":"Unstructured Topology","text":"

            In Chapter 5 - Data Representation we described data representations for the unstructured dataset types vtkPolyData and vtkUnstructuredGrid. Close examination of this data structure reveals that operations to retrieve topological adjacency are inefficient. In fact, to implement any operation to retrieve vertex, edge, or face neighbors requires a search of the cell array, resulting in O(n) time complexity. This is unacceptable for all but the smallest applications, since any algorithm traversing the cell array and retrieving adjacency information is at a minimum O(n2).

            The reason for this inefficiency is that the data representation is a \"downward\" hierarchy (Figure 8-34(b)). That is, given a cell we can quickly determine the topological features lower in the topological hierarchy such as faces, edges, and points. However, given a face, edge, or point we must search the cell array to determine the owning cells. To improve the efficiency of this data representation, we must introduce additional information into the hierarchy that allows \"upward\" hierarchy traversal (similar to that shown in Figure 8-34(a)). Figure 8-34. Enhancing hierarchical unstructured data representation. (a) Conventional topological hierarchy for geometric model. (b) Basic unstructured data hierarchy. (c) Full unstructured data hierarchy. By introducing upward references from points to cells, the unstructured data hierarchy may be efficiently traversed in both directions, and is more compact than conventional topological hierarchies. Figure 8-35. Complete unstructured data representation including link lists. There are m cells and n points. The n structures in the link list are lists of cells that use each vertex. Each link list is variable in length.

            The solution to this problem is to extend the unstructured data structure with cell links. The cell links array is a list of lists of cells that use each point and corresponds to the upward links of Figure 8-34(c). The cell links array transforms the hierarchical structure of Figure 5-13 into a ring structure. Cells reference their composing points, and points in turn reference the cells that use them. The full unstructured data structure is shown in Figure 8-35.The cell links array is in fact an implementation of the use sets of Equation 5-1. We can use this equation to compute adjacency operation in constant time, if the maximum number of cells using a point is much smaller than the number of points in a dataset. To see this, we refer to Equation 8-25 and see that the adjacency operations consist of a finite number of set intersections. Each operation is an intersection of the link lists for each point. If the number of cells in each link list is \"small,\" then the intersection operation can be bounded by a fixed constant in time, and the total operation can be considered a constant time operation.

            There are several important characteristics of this data representation.

            • The cell links array is an extension of the basic unstructured data representation. As a result, we can defer the construction of the cell links until they are required. Often the cell links are never needed and require no computer resources to compute or store.

            • Building the cell links is a linear O(n) operation. Each cell is traversed and for every point that the cell uses, the list of using cells for that point is extended to include the current cell. Building the cell links is only needed once as an initialization step.

            • The data representation is compact relative to other topology representation schemes (e.g., the winged-edge structure and the radial-edge structures [Baumgart74] [Weiler88]). These other data structures contain explicit representation of intermediate topology such as edges, loops, faces, or special adjacency information such as adjacent edges (winged-edge structure) or extensive \"use\" descriptions (radial-edge structure). The compactness of representation is particularly important for visualization, since the data size is typically large.

            The unstructured data structure in the Visualization Toolkit is implemented using the four classes vtkPoints (and subclasses), vtkCellArray, vtkCellTypes, and vtkCellLinks. The building of this data structure is incremental. At a minimum, the points and cells are represented using vtkPoints and vtkCellArray. If random access or extra type information is required, then the object vtkCellTypes is used. If adjacency information is required, an instance of the class vtkCellLinks is created. These operations are carried out behind the scenes, and generally do not require extra knowledge by the application programmer.

            "},{"location":"VTKBook/08Chapter8/#abstract-interfaces","title":"Abstract Interfaces","text":"

            With the completion of Chapters 5 and 8, we can summarize the abstract interface for cells, datasets, and the point data attributes. These pseudo-code descriptions encapsulate the core functionality of the classes vtkDataSet, vtkCell, and vtkPointData, and their subclasses. All algorithms presented in this text can be implemented using combinations of these methods.

            Dataset Abstraction. The dataset is the central data representation in VTK. Datasets are composed of one or more cells and points. Associated with the points are attribute data consisting of scalars, vectors, normals, texture coordinates, and tensors.

                 type = GetDataObjectType()\n          Return the type of dataset (e.g., vtkPolyData, vtkImageData, vtkStructuredGrid, vtkRectilinearGrid, or vtkUnstructuredGrid).\n\n     numPoints = GetNumberOfPoints()\n          Return the number of points in the dataset.\n\n     numCells = GetNumberOfCells()\n          Return the number of cells in the dataset.\n\n     GetPoint(ptId,x)\n          Given a point id, return the (x,y,z) coordinates of the point.\n\n     cell = GetCell(cellId)\n          Given a cell id, return a pointer to a cell object.\n\n     type = GetCellType(cellId)\n          Return the type of the cell given by cell id.\n\n     GetCellTypes(types)\n          Return a list of types of cells that compose the dataset.\n\n     cells = GetPointCells(ptId)\n          Given a point id, return the cells that use this point.\n\n     GetCellPoints(cellId, ptIds)\n          Given a cell id, return the point ids (e.g., connectivity list) defining the cell.\n\n     GetCellNeighbors(cellId, ptIds, neighbors)\n          Given a cell id and a list of points composing a boundary face of the cell, return the neighbors of that cell sharing the points.\n\n     cellId = FindCell(x, cell, cellId, tol2, subId, pcoords, weights)\n          Given a coordinate value x, an initial search cell defined by cell and cellId, and a tolerance measure (squared), return the cell id and sub-id of the cell containing the  point and its interpolation function weights. The initial search cell is used to speed up the search process when the position x is known to be near the cell. If no cell is found, cellId < 0 is returned.\n\n     pointData = GetPointData()\n         Return a pointer to the object maintaining point attribute data. This includes scalars, vectors, normals, tensors, and texture coordinates, as well as any other data arrays that the field carries.\n\n     cellData = GetCellData()\n          Return a pointer to the object maintaining cell attribute data. This includes scalars,a vectors, normals, tensors, and texture coordinates, as well as any other data arrays that the field carries.\n\n     bounds = GetBounds()\n          Get the bounding box of the dataset.\n\n     length = GetLength()\n          Return the length of the diagonal of the bounding box of the dataset.\n\n     center = GetCenter()\n          Get the center of the bounding box of the dataset.\n\n     range = GetScalarRange()\n          A convenience method to return the (minimum, maximum) range of the scalar attribute data associated with the dataset.\n\n     dataSet = NewInstance()\n          Make a copy of the current dataset. A \"virtual\" constructor. (Typically, reference counting methods are used to copy data.)\n\n     CopyStructure(dataSet)\n          Update the current structure definition (i.e., geometry and topology) with the supplied dataset.\n

            Cell Abstraction. Cells are the atomic structures of VTK. Cells consist of a topology, defined by a sequence of ordered point ids, and a geometry, defined by point coordinates. The cell coordinate consists of a cell id, a subcell id, and a parametric coordinate. The subid specifies a primary cell that lies within a composite cell such as a triangle strip. Cell edges and faces are defined implicitly from the topology of the cell.

                type = GetCellType()\n          Return the type of the cell. Must be one of the twelve VTK cell types (or the empty cell\n          type).\n\n     dim = GetCellDimension()\n          Return the topological definition of the cell.\n\n     order = GetInterpolationOrder()\n          Return the degree of the interpolating polynomial of the cell. (The twelve cell types are\n          all degree 1; cells added in the future may be of higher-order.)\n\n     numberPoints = GetNumberOfPoints()\n          Return the number of points that define the cell.\n\n     points = GetPoints()\n          Return a list of point ids defining the cell.\n\n     numberEdges = GetNumberOfEdges()\n          Return the number of edges in the cell.\n\n     edge = GetEdge(i)\n          Given an edge id ( $0 \\leq i < numberEdges$ ) return a pointer to a cell that represents an\n          edge of the cell.\n\n     numberFaces = GetNumberOfFaces()\n          Return the number of faces in a cell.\n\n     face = GetFace(i)\n          Given an face id ( $0 \\leq i < numberFaces$ ) return a pointer to a cell that represents a face\n          of the cell.\n\n     inOutStatus = CellBoundary(subId, pcoords, poindIds)\n          Given a cell subid and parametric coordinates, return a list of point ids that define the closest boundary face of the cell. Also return whether the point is actually in the cell.\n\n     inOutStatus = EvaluatePosition(x, closestPoint, subId, pcoords, weights, dist2)\n          Given a point coordinate x, return the sub-id, parametric coordinates, and interpolation\n          weights of the cell if x lies inside the cell. The position closestPoint is the closest point\n          on the cell to x (may be the same) and dist2 is the squared distance between them. The\n          method returns an inOutStatus indicating whether x is topologically inside or outside\n          the cell. That is, the point may satisfy parametric coordinate conditions but may lie off\n          the surface of the cell (e.g., point lies above polygon). Use both inOutStatus and dist2\n          to determine whether point is both topologically and geometrically in the cell.\n\n     EvaluateLocation(subId, pcoords, x, weights)\n          Given a point location (i.e., sub-id and parametric coordinates), return the position x of\n          the point and the interpolation weights.\n\n     Contour(value, cellScalars, locator, verts, lines, polys, inputPointData, outputPointData)\n          Given a contour value and scalar values at the cell points, generate contour primitives\n          (vertices, lines, or polygons with associated points and attribute data values). The\n          points are placed in a locator object (see [\"Searching\"](/VTKBook/08Chapter8/#searching_1) in this Chapter) which merges\n          coincident points, and the attribute data values are interpolated (along the cell edge) from\n          the inputPointData to the outputPointData.\n\n     Clip(value, cellScalars, locator, cells, inputPointData, outputPointData, insideOut)\n          Given a contour value and scalar values at the cell points, clip the cell to generate new\n          cells of the same topological dimension as the original cell. The points are placed in a\n          locator object (see [\"Searching\"](/VTKBook/08Chapter8/#87-searching) in [Chapter 8](/VTKBook/08Chapter8)) which merges coincident points, and the\n          attribute data values are interpolated (or copied) from the inputPointData to the\n          outputPointData. The clipped cells are placed in the cells list.\n\n     Derivatives(subId, pcoords, values, dim, derivs)\n          Given a cell location (i.e., subid and parametric coordinates) and data values at the cell\n          points, return dim*3 derivatives (i.e., corresponds to the x, y, and z directions times\n          dimension of data).\n\n     inOutStatus = IntersectWithLine(p1, p2, tol, t, x, pcoords, subId)\n          Given a finite line defined by the two points p1 and p2 and an intersection tolerance,\n          return the point of intersection x. The parametric coordinate t along the line and cell\n          location at the point of intersection is also returned. Returns a nonzero if intersection\n           occurs.\n\n     Triangulate(index, ptIds, points)\n          Decompose the cell into simplices of dimension equal to the topological cell dimension.\n          The index is an integer that controls the triangulation if more than one triangulation\n          is possible. The simplices are defined by an ordered list of point ids and their\n          corresponding coordinates.\n\n     bounds = GetBounds()\n          Return the bounding box of the cell.\n

            Point and Cell Attribute Abstraction. Point and cell attribute data is information associated with the points and cells of a dataset. This information consists of scalars, vectors, normals, tensors, and texture coordinates. There is a one-to-one relationship between the points and cells in a dataset and its corresponding point and cell attribute data. For example, a point scalar value at location 100 is associated with point id 100.

            Many of the methods described below deal with moving data from the input to the output of a filter. Since the possibility exists that new types of attribute data could be added in the future, the details of moving data is hidden as much as possible (i.e., minimize the knowledge that the filter has about specific attribute types). Thus, generic functions like CopyData() allow for copying data from the input to the output without knowing what this data is.

                 CopyScalarsOn() / CopyScalarsOff()\n          Turn on/off boolean flag controlling copying of scalar data from input to output of\n          filter.\n     CopyVectorsOn() / CopyVectorsOff()\n          Turn on/off boolean flag controlling copying of vector data from input to output of\n          filter.\n\n     CopyNormalsOn() / CopyNormalsOff()\n          Turn on/off boolean flag controlling copying of normal data from input to output of\n          filter.\n\n     CopyTensorsOn() / CopyTensorsOff()\n          Turn on/off boolean flag controlling copying of tensor data from input to output of\n          filter.\n\n     CopyTextureCoordsOn() / CopyTextureCoordsOff()\n          Turn on/off boolean flag controlling copying of texture coordinates data from input to\n          output of filter.\n\n     CopyAllOn() / CopyAllOff()\n           Turn on/off all boolean flags controlling copying of all attribute data from input to\n            output of filter.\n\n     PassData(pointData)\n          Transfer all point attribute data (pointData) to the output according to the copy flags\n          listed previously.\n\n     CopyAllocate(pointData)\n          Initialize and allocate storage for point-by-point copy process.\n\n     CopyData(pointData, fromId, toId)\n          Given point data and a specific point id, copy the point attribute data (pointData) to the\n          output point.\n\n     InterpolateAllocate(pointData)\n          Initialize and allocate storage for point-by-point interpolation process.\n\n     InterpolatePoint(pointData, toId, ptIds, weights)\n          Given input point data (pointData) and a list of points and their interpolation weights,\n          interpolate data to the specified output point.\n\n     InterpolateEdge(pointData, toId, p1, p2, t)\n          From an edge defined by the two points p1 and p2, interpolate the pointData at the edge\n          parametric coordinate t and copy the interpolated attribute data to the output point ptId.\n\n     NullPoint(int ptId)\n          Set the data value(s) of the specified output point id to a null value.\n\n     SetScalars() / GetScalars()\n          Set / return scalar data. The GetScalars() method may return a NULL value, in which\n          case the scalars are not defined.\n\n     SetVectors() / GetVectors()\n          Set / return vector data. The GetVectors() method may return a NULL value, in which\n          case the vectors are not defined.\n\n     SetNormals() / GetNormals()\n          Set / return normal data. The GetNormals() method may return a NULL value, in which\n          case the normals are not defined.\n\n     SetTensors() / GetTensors()\n          Set / return tensor data. The GetTensors() method may return a NULL value, in which\n          case the tensors are not defined.\n\n     SetTextureCoords() / GetTextureCoords()\n          Set / return texture coordinate data. The GetTextureCoords() method may return a\n          NULL value, in which case the texture coordinates are not defined.\n
            "},{"location":"VTKBook/08Chapter8/#traversing-intermediate-topology","title":"Traversing Intermediate Topology","text":"

            The dataset abstraction implemented by VTK provides simple techniques to traverse points and cells. Sometimes we want to traverse intermediate topology such as edges or faces. For example, to identify boundary edges in a triangular mesh we must traverse each edge, counting the number of triangles that use each edge. (Recall that boundary edges are used by just one triangle.) Unfortunately, there is no obvious way to traverse edges. The same problem holds true if we want to traverse the faces of a dataset containing 3D cells.

            A simple solution is to traverse each cell and then obtain the edges (or faces) that compose the cell. The problem with this approach is that edges and faces are generally used by more than one cell, resulting in multiple visits to the same face or edge. This may be acceptable in some algorithms, but usually we count on visiting each edge or face only once.

            A better solution to this problem is to traverse each cell as before, but only process intermediate topology if the current cell has the smallest cell id. (The current cell is the cell being visited in the traversal process.) To determine whether the current cell has the smallest cell id, we obtain all cells using the intermediate topology. This information can be obtained using the topological adjacency operators described earlier (e.g., Equation 8-25).

            To illustrate this process consider visiting the edges of a triangle mesh. We begin by visiting the first triangle, t, and then its edges. For each edge we determine the adjacent triangle(s) (if any) that use the edge. If the id of the adjacent triangle(s) is greater than triangle t's id, or there are no adjacent triangles, then we know to process the current edge. (Of course the first triangle will always have the smallest id but this will change as the traversal proceeds.) We then continue traversing the triangle list for new t's. In this way all the edges of the mesh will be visited.

            "},{"location":"VTKBook/08Chapter8/#color-scalar-data","title":"Color Scalar Data","text":"

            Multi-valued scalar data, or scalars represented by various color representations, are treated specially by the Visualization Toolkit. These data arise, for example, when using a color specification to directly control the color of objects rather than mapping a scalar value through a lookup table. (See \"Color Mapping\" in Chapter 6 for more information.)

            By default, the mapping of scalars into colors proceeds as follows (vtkMapper and subclasses are responsible for implementing this behavior):

            • If the scalar type is unsigned char with the tuple size ranging between one and four components, the data is considered to be color data.

            • Four component data is assumed to be a RGBA (red-green-blue-alpha transparency) color specification. Three component data is assumed to be a RGB color specification. Two component data is assumed to be a IA (intensity-alpha) representation. Single component data is assumed to be a I (intensity) value.

            • Any other data type, or data with more than four components, is assumed to represent a scalar value. In that case the scalars are mapped through a lookup table to produce colors during the rendering process.

            It is possible to force unsigned char data to be mapped through a lookup table. The vtkMapper method SetColorModeToMapScalars() forces all data regardless of type to be mapped through the lookup table.

            "},{"location":"VTKBook/08Chapter8/#searching_1","title":"Searching","text":"

            The Visualization Toolkit provides two classes to perform searches for dataset points and cells. These are vtkPointLocator and vtkCellLocator. (Both of these classes are subclasses of vtkLocator, which is an abstract base class for spatial search objects.) vtkPointLocator is used to search for points and, if used with the topological dataset operator GetPointCells(), to search for cells as well. vtkCellLocator is used to search for cells.

            vtkPointLocator is implemented as a regular grid of buckets (i.e., same topology and geometry as an image dataset). The number of buckets can be user-specified, or more conveniently, automatically computed based on the number of dataset points. On average, vtkPointLocator provides constant time access to points. However, in cases where the point distribution is not uniform, the number of points in a bucket may vary widely, giving O(n) worst-case behavior. In practice this is rarely a problem, but adaptive spatial search structures (e.g., an octree) may sometimes be a better choice.

            Determining closest point to a point p using vtkPointLocator (as well as other spatial search structures) is a three-step process. In the first step, the bucket containing p is found using the appropriate insertion scheme. (For vtkPointLocator this is three divisions to determine bucket indices (i, j, k).) Next, the list of points in this bucket is searched to determine the closest point. However, as Figure 8-36 shows, this may not be the true closest point, since points in neighboring buckets may be closer. Consequently, a final search of neighboring buckets is necessary. The search distance is a function of the distance to the current closest point. Once all neighbors within this distance are searched, the closest point is returned. Figure 8-36. Determining closest point to $p$ in vtkPointLocator. Initial search in bucket results in point a. Search must extend beyond local bucket as a function of search radius R, resulting in point b. Figure 8-37. Structure of spatial search structure vtkCellLocator. The data structure represents a uniformly subdivided octree.

            vtkCellLocator is implemented as a uniformly subdivided octree with some peculiar characteristics (Figure 8-37). Conventional octree representations use upward parent and downward children pointers to track parent and children octants. Besides the required list of entities (i.e., points or cells) in each octant, additional information about octant level, center, and size may also be maintained. This results in a flexible structure with significant overhead. The overhead is the memory resources to maintain pointers, plus the cost to allocate and delete memory.

            In contrast, vtkCellLocator uses a single array to represent the octree. The array is divided into two parts. The first part contains a list of parent octants, ordered according to level and octant child number. In the second part are the terminal, or leaf octants. The terminal octants are ordered on a regular array of buckets, just the same as vtkLocator. The terminal octants contain a list of the entities inside the octant. The parent octants maintain a value indicating whether the octant is empty, or whether something is inside it. (Both types of information are represented in the same portion of the octant structure.) Because the octree is uniformly subdivided, parent-child relationships, as well as octant locations, can be computed quickly using simple division operations.

            Figure 8-38. The picking hierarchy in VTK. All subclasses of vtkAbstractPropPicker return the picked instance of vtkProp. The information is returned as a vtkAssemblyPath. The assembly path is necessary because some props may exist in an assembly hierarchy. The classes vtkWorldPointPicker and vtkPropPicker are hardware accelerated picking classes. All others use software ray casting.

            The advantage of this structure is that memory can be allocated and deleted quickly. In addition, insertion into the octree is exactly the same as with vtkLocator, and is simpler than conventional octrees. The parent octants provide quick culling capability, since their status (empty or nonempty) allows us to stop certain types of search operations. On the downside, because the octree is uniformly subdivided, this structure is wasteful of memory resources if the data is non-uniformly distributed.

            Our experience with the search structures described here is that they work well for many types of visualization data. However, if your data is non-uniform, you may want to implement your own special search classes.

            "},{"location":"VTKBook/08Chapter8/#picking","title":"Picking","text":"

            The Visualization Toolkit provides a variety of classes to perform actor (or vtkProp), point, cell, and world point picking (Figure 8-38). Depending on which picker is used, either software-based geometric intersection or hardware picking is used. The following describes each of the picker types in detail.

            All pickers are subclasses of vtkAbstractPicker which defines the basic pick interface. The user must specify a selection point in display coordinates for a specified instance of vtkRenderWindow and invoke the Pick() method. At a minimum, the class must return an x-y-z pick position in world coordinates. It is possible to limit the pick candidates to a list of vtkProps (the PickList). The class also invokes the StartPickEvent, PickEvent, and EndPickEvent events that are invoked prior to picking, during picking, and after picking, respectively.

            Classes that can return information indicating which vtkProp they have picked are subclasses of vtkAbstractPropPicker. After the pick operation, vtkAbstractPropPicker returns a vtkAssemblyPath. The assembly path is an ordered list of instances of vtkProp and possibly associated 4x4 transformation matrices. The path represents a concatenated hierarchy of assembly nodes if an assembly has been defined (see \"Assemblies and Other Types of [vtkProp](https://www.vtk.org/doc/nightly/html/classvtkProp.html#details)\" in Chapter 3) for more information about props and assemblies).

            The object vtkPicker intersects a ray defined from camera position to a screen (i.e., pixel) coordinate against the bounding box of all pickable and nontransparent vtkProp3D's. (A vtkProp is pickable if its Pickable instance variable is true.) The result of the vtkPicker pick operation is to return a list of the vtkProp3D's whose bounding box is intersected. The prop closest to the camera position is also returned.

            The object vtkPointPicker intersects the ray against the points defining each vtkProp3D, and returns the point coordinate closest to the camera position, as well as the vtkProp3D that the point belongs to. Since screen resolution prevents precise selection of a point, a tolerance around the ray must be specified. The tolerance is expressed as a fraction of the rendering window size. (Rendering window size is measured across the window diagonal.) Points must lie within this tolerance to be picked.

            The object vtkCellPicker intersects the ray with the cells defining each vtkProp3D, and returns the point of intersection, as well as the vtkProp3D that the cell belongs to. If you are trying to select a cell belonging to a particular vtkProp3D, vtkCellPicker is the object to use because it performs surface (or cell) intersection. Unfortunately, vtkCellPicker is the slowest of the pickers because of greater computational requirements.

            The class vtkWorldPointPicker returns the (x,y,z) coordinate value of a pick in the rendering window. To determine this information, it combines the display (x,y) values with the z-buffer depth values. Of all the pickers this is the fastest, but it cannot determine the actual cell, point or vtkProp that is selected since it is not a subclass of vtkAbstractPropPicker. (Note: on some systems z-buffer operations are inoperative and this object will not function properly.)

            By default picking is performed with the class vtkPropPicker. This class uses hardware-accelerated picking so it is generally faster than software based picking. Unlike the other hardware accelerated class (vtkWorldPointPicker), it returns the instance of vtkProp that was picked as well as the (x,y,z) world coordinate value

            Figure8-39 summarizes the five concrete picking classes. Picking is built into the vtkRenderWindowInteractor class using the \"p\" key (see \"RenderWindowInteractor\" in Chapter 3). By default a vtkPropPicker is created and used, but you are free to specify your own picker type.

            "},{"location":"VTKBook/08Chapter8/#examples","title":"Examples","text":"

            To conclude this section, we will examine how some of the dataset, cell, and point attribute operations are used. These operations tend to be used by class developers. You will not need to use them if you build applications by constructing visualization pipelines with existing filters.

            Find Free Edges. In our first example we will take a peek inside the filter vtkLinearExtrusionFilter. This filter implements the following modelling operation. Given a polygonal mesh, extrude the mesh in a given direction, constructing a \"skirt\" or \"walls\" from the free edges. If the polygonal example is a single square, the result of this operation is a cube. Or, if the polygonal data consists of a single line, the result of the operation is a quadrilateral. A point will generate a line as shown in Figure 8-40(a). Figure 8-39. Summary of picking operations. The top three pick classes (a)-(c) use software ray casting. The bottom two pick classes (d)-(e) use hardware acceleration. Figure 8-40. Depiction of linear and rotational extrusion.

            Recall that free edges are edges used by only one polygon. We can determine this information using the dataset topology operation GetCellEdgeNeigbors(). We use Equation 8-25 and the two points defining the edge of the polygon to determine the adjacency set (i.e., the polygons sharing this edge). If no other polygon uses this edge, then the edge is extruded to generate a triangle strip. The C++ pseudo code is as follows.

            for (cellId=0; cellId < numCells; cellId++) {\n  cell = mesh->GetCell(cellId);\n  if ((dim=cell->GetCellDimension()) == 0)\n  //create lines from points\n  else if ( dim == 1 )\n  // create strips from lines\n  else if ( dim == 2 ) // create strips from boundary edges\n    {\n    numEdges = cell->GetNumberOfEdges(); for (i=0; i<numEdges; i++)\n    {\n  edge = cell->GetEdge(i);\n  for (j=0; j<(edge->GetNumberOfPoints()-1); j++)\n    {\n    p1 = edge->PointIds->GetId(j);\n    p2 = edge->PointIds->GetId(j+1);\n    mesh.GetCellEdgeNeighbors(cellId, p1, p2, cellIds);\n    if ( cellIds->GetNumberOfIds() < 1 )\n      {\n      //generate triangle strip\n      }\n    } //for each subedge\n  } //for each edge\n} //for each polygon or triangle strip } //for each cell\n

            This same approach is used in the vtkRotationalExtrusionFilter (Figure 8-40(b)). The difference between these two functions is that the type of motion is rotational as compared to linear (vtkLinearExtrusionFilter). These two filters can be used to perform some nifty modelling operations. Linear extrusion can be used to create bar charts with arbitrary cross sections, or to sweep out three-dimensional fonts. The rotational extrusion filter can be used to create rotationally symmetric objects such as bottles or wine glasses. Examples of these techniques are shown in Figure 8-41.

            Find Cells. In this example we combine picking and a topological operation to select cells sharing a common point. Specifically, we use vtkPointPicker and the topological dataset operation GetPointCells(). Figure 8-42 depicts this operation. We have also included a fragment of C++ code implementing this procedure. Note that this procedure will work for any dataset type, even if the geometry is implicitly defined (e.g., vtkImageData).

            The most difficult part of this procedure is the picking process. The selection point must be specified in pixel coordinates. The vtkPointPicker converts these coordinates into world and then dataset coordinates using the renderer in which the pick occurred. (The renderer uses the transformation matrix of its active camera to perform coordinate transformation.)

            The picking process is conveniently managed in vtkRenderWindowInteractor. This object allows the specification of functions to execute just before picking and just after picking (i.e., \"AddObserver StartPickEvent\" and \"AddObserver EndPickEvent\"). Using this facility we can define a post-picking function to retrieve the point id and then execute the GetPointCells() operation. This process is shown in Figure 8-42. (a) Linearly extruded fonts to show letter frequency in text. (b) Rotationally symmetric objects. (c) Rotation in combination with linear displacement and radius variation. Figure 8-41. Models created using linear and rotational extrusion. (a) See AlphaFrequency.cxx and AlphaFrequency.py.; (b). See Bottle.cxx and Bottle.py.; (c) See Spring.cxx and Spring.py.

            Point Probe. In this example we will show how to build a point probe using the dataset and cell operations described in this chapter. A point probe is defined as follows. Given a (x,y,z) point coordinate, find the cell coordinates (i.e., cell id, subcell id, and parametric coordinates) and the interpolation weights. Once the interpolation weights are found, we can then compute local data values at (x,y,z).

            The point probe is implemented using the dataset operation FindCell(). This method requires a point specified in global coordinates (our (x,y,z) value) and a tolerance. The tolerance is often necessary because of numerical precision or when picking near the surface of 3D cells, or on 0D, 1D, and 2D cells. The FindCell() operation returns the information we require, plus the interpolation weights of the cell containing our point probe. To determine the data value at our probe point, we need to retrieve the data values on the cell points. We can then use the interpolation functions of Equation 8-4 to determine the probe scalar value.

            Figure 8-42. Selecting group of cells sharing a common point. (a) Original data. (b) Selected cells sharing point on corner. Cells shrunk for clarity. The small sphere indicates the selected point. (c) C++ code fragment in pick routine.

            Figure 8-43 depicts this process and includes C++ code. In the example we use the combustor dataset with the objects vtkCursor3D, vtkProbeFilter, and vtkGlyph3D. The purpose of the cursor is to control the position of the probe point. The class vtkProbeFilter performs the probing operation just described. (This filter has been generalized so that it can handle more than one input point.) vtkGlyph3D is used to place an oriented, scaled cone at the cursor focal point. This gives us visual feedback about the scalar and vector quantities at the probe. Of course, we can extract numeric values and display them to the user if this is important. Figure 8-43. Creating a point probe. Visualization network shown in diagram above. C++ code shows inner loop of vtkProbeFilter and resulting image for combustor data (probe.cxx)."},{"location":"VTKBook/08Chapter8/#812-chapter-summary","title":"8.12 Chapter Summary","text":"

            Three important visualization coordinate systems are the world, dataset, and structured coordinate systems. The world coordinate system is an x-y-z Cartesian three-dimensional space. The dataset coordinate system consists of a cell id, subcell id, and parametric coordinates. The structured coordinate system consists of (i,j,k) integer indices into a rectangular topological domain.

            Visualization data is generally in discrete form. Interpolation functions are used to obtain data at points between the known data values. Interpolation functions vary depending on the particular cell type. The form of the interpolation functions are weighting values located at each of the cells points. The interpolations functions form the basis for conversion from dataset to global coordinates and vice versa. The interpolation functions also are used to compute data derivatives.

            Topological operators provide information about the topology of a cell or dataset. Obtaining neighboring cells to a particular cell is an important visualization operation. This operation can be used to determine whether cell boundaries are on the boundary of a dataset or to traverse datasets on a cell-by-cell basis.

            Because of the inherent regularity of image datasets, operations can be efficiently implemented compared to other dataset types. These operations include coordinate transformation, derivative computation, topological query, and searching.

            "},{"location":"VTKBook/08Chapter8/#813-bibliographic-notes","title":"8.13 Bibliographic Notes","text":"

            Interpolation functions are employed in a number of numerical techniques. The finite element method, in particular, depends on interpolation functions. If you want more information about interpolation functions refer to the finite element references suggested below [Cook89] [Gallagher75] [Zienkiewicz87]. These texts also discuss derivative computation in the context of interpolation functions.

            Visualizing higher-order datasets is an open research issue. While [Schroeder06] describes one approach, methods based on GPU programs are emerging. Other approaches include tailored algorithms for a particular cell type.

            Basic topology references are available from a number of sources. Two good descriptions of topological data structures are available from Weiler [Weiler86] [Weiler88] and Baumgart [Baumgart74]. Weiler describes the radial-edge structure. This data structure can represent manifold and non-manifold geometry. The winged-edge structure described by Baumgart is widely known. It is used to represent manifold geometry. Shephard [Shephard88] describes general finite element data structures these are similar to visualization structures but with extra information related to analysis and geometric modelling.

            There are extensive references regarding spatial search structures. Samet [Samet90] provides a general overview of some. Octrees were originally developed by Meagher [Meagher82] for 3D imaging. See [Williams83], [Bentley75], and [Quinlan94] for information about MIP maps, kd-trees, and binary sphere trees, respectively.

            "},{"location":"VTKBook/08Chapter8/#814-references","title":"8.14 References","text":"

            [Baumgart74] B. G. Baumgart. \"Geometric Modeling for Computer Vision.\" Ph.D. thesis, Stanford University, Palo Alto, CA, 1974.

            [Bentley75] J. L. Bentley. \"Multidimensional Binary Search Trees Used for Associative Search.\" Communications of the ACM. 18(9):509-516, 1975.

            [Conte72] S. D. Conte and C. de Boor. Elementary Numerical Analysis. McGraw-Hill Book Company, 1972.

            [Cook89] R. D. Cook, D. S. Malkus, and M. E. Plesha. Concepts and Applications of Finite Element Analysis. John Wiley and Sons, New York, 1989.

            [Gallagher75]R. H. Gallagher. Finite Element Analysis: Fundamentals. Prentice Hall, Upper Saddle River, NJ, 1975.

            [Meagher82] D. J. Meagher. \"Efficient Synthetic Image Generation of Arbitrary 3D Objects.\" In Proceedings of the IEEE Conference on Pattern Recognition and Image Processing. pp. 473-478, 1982.

            [Quinlan94] S. Quinlan. \"Efficient Distance Computation Between Non-Convex Objects.\" In Proceedings of IEEE International Conference on Robotics and Automation. 1994.

            [Samet90] H. Samet. Design and Analysis of Spatial Data Structures. Addison-Wesley, Reading, MA, 1990.

            [Schroeder06] W. J. Schroeder, F. Bertel, M. Malaterre, D. Thompson, P. P. Pe\u0301bay, R. O'Bara and S. Tendulkar. \"Methods and Framework for Visualizing Higher-Order Finite Elements.\" IEEE Transactions on Visualization and Computer Graphics, 12(4):446-460, July/August 2006.

            [Shephard88] M. S. Shephard and P. M. Finnigan. \"Toward Automatic Model Generation.\" State-of-the-Art Surveys on Computational Mechanics. A. K. Noor and J. T. Oden, eds., ASME, pp. 335-366, 1989.

            [Weiler86] K. J. Weiler. Topological Structures for Geometric Modeling. Ph.D. thesis, Rensselaer Polytechnic Institute, Troy, NY, May 1986.

            [Weiler88] K. J. Weiler. \"The Radial-Edge Structure: A Topological Representation for Non-Manifold Geometric Boundary Representations.\" In M. J. Wozny, H. W. McLaughlin, and J. L. Encarnacao, eds., Geometric Modeling for CAD Applications. pp. 3-36, North Holland, 1988.

            [Williams83] L. Williams. \"Pyramidal Parametrics.\" Computer Graphics (SIGGRAPH 83). 17(3):1-11, 1983.

            [Zienkiewicz87] O. C. Zienkiewicz and R. L. Taylor. The Finite Element Method Vol. 1. McGraw Hill Book Co., NY, 4th ed., 1987.

            "},{"location":"VTKBook/08Chapter8/#815-exercises","title":"8.15 Exercises","text":"Figure 8-44. Exercise figures.

            8.1 Given a volume of dimensions 5 \\times 10 \\times 15 with origin (1.0, 2.0,3.0) and voxel spacing (0.5, 0.5, 1.0).

            a) Compute minimum point position.

            b) Compute maximum point position.

            c) For cell id 342, compute cell minimum point position and maximum point

            d) What points (list ids) define cell id 342?

            e) Given point specified in structured coordinates as i, j, k = (3, 6, 4) ;r, s, t = (0.1, 0.2, 0.5), compute global coordinates.

            f) Given point id 342; compute global coordinates.

            8.2 Compute global coordinates and interpolation weights for the points specified in dataset coordinates (refer to Figure 8-44(a-d)).

            a) Line with r = 0.5.

            b) Triangle with r, s = (0.25, 0.33).

            c) Voxel with r, s, t = (0.25, 0.33, 0.5).

            8.3 Compute parametric coordinates for cells shown in Figure 8-44(a-d).

            a) Line with x, y, z = (0.3, 0.6, 0.9).

            b) Triangle with x, y, z = (0.5, 0.25, 0.0). c) Voxel with x, y, z = (0.5, 0.4, 2.0).

            8.4 Given the line shown in Figure 8-44(a), if scalar data values are (s0, s1) = (0.0, 0.25), what are the derivatives in the x, y, z directions?

            8.5 Refer to Figure 8-44(d) and let the numbers indicate cell ids and the letters indicate point ids. a) List the cells using point A.

            b) List the cells using point B.

            c) List cells using edge (A, B). How does this list correspond to your answers in parts a) and b) above?

            8.6 Refer to Figure 8-44(e).

            a) How many boundary faces are there?

            b) How many \"internal\" faces?

            8.7 Describe a procedure to intersect two finite lines. How does tolerance value come into play?

            8.8 Describe a procedure to intersect a line and triangle. Are there special characteristics of a triangle that can be used to speed this operation?

            8.9 Compare memory requirements for the three unstructured grid data structures shown in Figure 8-34. Assume that two cells use each face, four faces use each edge, and six edges use each vertex (i.e., a structured dataset).

            8.10 Using the abstract cell and dataset interface, write a program to compute

            a) number of points in a dataset,

            b) number of cells in a dataset,

            c) number of edges in a dataset,

            d) number of faces in a dataset.

            8.11 Given a volume of dimensions 5 \\times 10 \\times 15.

            a) How many internal faces are there (i.e. used by two voxels)?

            b) How many boundary faces are there (i.e., used by one voxel)?

            8.12 Write a general extrusion filter that sweeps an object along a path to construct a new surface. Assume that the path is defined by a sequence of transformation matrices. Can you think of a way to prevent self-intersection?

            "},{"location":"VTKBook/09Chapter9/","title":"Chapter 9 - Advanced Algorithms","text":"

            We return again to visualization algorithms. This chapter describes algorithms that are either more complex to implement, or less widely used for 3D visualization applications. We retain the classification of algorithms as either scalar, vector, tensor, or modelling algorithms.

            "},{"location":"VTKBook/09Chapter9/#91-scalar-algorithms","title":"9.1 Scalar Algorithms","text":"

            As we have seen, scalar algorithms often involve mapping scalar values through a lookup table, or creating contour lines or surfaces. In this section, we examine another contouring algorithm, dividing cubes, which generates contour surfaces using dense point clouds. We also describe carpet plots. Carpet plots are not true 3D visualization techniques, but are widely used to visualize many types of scalar data. Finally, clipping is another important algorithm related to contouring, where cells are cut into pieces as a function of scalar value.

            "},{"location":"VTKBook/09Chapter9/#dividing-cubes","title":"Dividing Cubes","text":"

            Dividing cubes is a contouring algorithm similar to marching cubes [Cline88]. Unlike marching cubes, dividing cubes generates point primitives as compared to triangles (3D) or lines (2D). If the number of points on the contour surface is large, the rendered appearance of the contour surface appears \"solid.\"q To achieve this solid appearance, the density of the points must be at or greater than screen resolution. (Also, the points must be rendered using the standard lighting and shading equations used in surface rendering.)

            The motivation for dividing cubes is that rendering points is much faster than rendering polygons. This varies depending upon rendering hardware/software. Special purpose hardware has been developed to render shaded points at high speed. In other systems, greater attention has been placed on polygon rendering, and the rendering speed differences are not so great. Also, certain geometric operations such as clipping and merging data are simple operations with points. Comparable operations with polygons are much more difficult to implement.

            One disadvantage of creating contours with dense point clouds is that magnification of the surface (via camera zooming, for example) reveals the disconnected nature of the surface. Thus, the point set must be constructed for maximum zoom, or constructed dynamically based on the relative relationship between the camera and contour.

            Although dividing cubes was originally developed for volume datasets, it is possible to adapt the algorithm to other dataset types by subdividing in parametric coordinates. Our presentation assumes that we are working with volumes.

            Figure 9-1 provides an overview of the dividing cubes algorithm. Like other contouring algorithms, we first choose a contour value. We begin by visiting each voxel and select those through which the isosurface passes. (The isosurface passes through a voxel when there are scalar values both above and below the contour value.) We also compute the gradient at each voxel point for use in computing point normals. Figure 9-1. Overview of the dividing cubes algorithm. Voxels through which the contour passes are subdivided into subvoxels at less than screen resolution. If the contour passes through a subvoxel, a center point is generated. Figure 9-2. Recursive dividing cubes algorithm. Top half of figure shows algorithm depicted in two dimensions. Lower half depicts algorithm in three dimensions.

            After selecting a voxel that the isosurface passes through, the voxel is subdivided into a regular grid of n1 \\times n2 \\times n3 subvoxels. The number of divisions is controlled by the width of a voxel w_i in combination with screen resolution R. The screen resolution is defined as the distance between adjacent pixels in world coordinates. We can express the number of divisions ni along the coordinate axes x_i as w_i

            \\begin{equation*} n_i = \\frac{w_i}{R} \\end{equation*} \\bf\\tag{9-1}

            where the quotient is rounded up to the nearest integer. The scalar values at the subpoints are generated using the interpolation functions for a voxel (see Figure 8-10). Then we determine whether the contour passes through each subvoxel. If it does, we simply generate a point at the center of the subvoxel and compute its normal using the standard interpolation functions.

            An interesting variation on this algorithm is a recursive implementation as shown in Figure 9-2. Instead of subdividing the voxel directly (i.e., procedurally) into a regular grid we recursively divide the voxel (similar to octree decomposition). The voxel is subdivided regularly creating eight subvoxels and 19 new points (12 midedge points, 6 midface points, and 1 midvoxel point). The scalar values at the new points are interpolated from the original voxel using the trilinear interpolation functions. The process repeats for each subvoxel if the isosurface passes through it. This process continues until the size of the subvoxel is less than or equal to screen resolution. In this case, a point is generated at the center of the subvoxel. The collection of all such points composes the dividing cubes isosurface.

            The advantage of the recursive implementation is that the subdivision process terminates prematurely in those regions of the voxel where the contour cannot pass. On the other hand, the recursive subdivision requires that the voxel subdivision occurs in powers of two. This can generate far more points than the procedural implementation.

            Figure 9-3 shows two examples of dividing cubes isosurfaces. The contour surface on the left consists of 50,078 points. Because the points are not generated at display resolution, it is possible to see through the contour surface. The second contour surface on the right is composed of 2,506,989 points. The points are generated at display resolution, and as a result the contour surface appears solid.

            As Figure 9-1 and Figure 9-2 show, the points generated by dividing cubes do not lie exactly on the contour surface. We can determine the maximum error by examining the size of the terminal subvoxels. Assume that a terminal subvoxel is a cube, and that the length of the side of the cube is given by l. Then the maximum error is half the length of the cube diagonal, or l 3 / 2. Figure 9-3. Examples of dividing cubes isosurface. The left image consists of 50,078 points, and the right image consists of 2,506,989 points."},{"location":"VTKBook/09Chapter9/#carpet-plots","title":"Carpet Plots","text":"

            A common data form is a 2D image dataset with associated scalar data. Carpet plots can visualize data in this form. A carpet plot is created by warping a 2D surface in the direction of the surface normal (or possibly some user-defined direction). The amount of warping is controlled by the scalar value, possibly in combination with a scale factor. Carpet plots are similar to the vector displacement plots (see \"Displacement Plots\" in Chapter 4).

            Although carpet plots are typically applied to image data, they can be used to visualize datasets composed of 2D structured grids or 2D unstructured grids. In their basic form carpet plots can be used to visualize only three variables: two surface position coordinates and a scalar value. However, it is common to introduce another variable by using color mapping on the surface.

            (a) Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values. (b) Carpet plot of combustor flow energy in a structured grid. Colors and plane displacement represent energy values Figure 9-4. Contouring examples. (a) See ExponentialCosine.cxx and ExponentialCosine.py.; (b). See WarpCombustor.cxx and WarpCombustor.py. \\begin{equation*} F(r) = e^{-r}\\cos(10\\, r) \\end{equation*} \\bf\\tag{9-2}

            The function values are used to warp the surface while the function derivatives are used to color it. Figure 9-4(b) shows a carpet plot that visualizes flow energy in a structured grid. Both displacement and color are used to show the energy values. Although this figure is similar to Figure 6-14(b) there are some important differences. Figure 6-14(b) displays vector data whereas Figure 9-4(b) displays scalar data. Figure 9-4(b) deforms the surface in the direction of surface normal (or possibly a user-defined direction). The vector data (i.e., vector orientation) controls the direction of deformation in Figure 6-14(b)."},{"location":"VTKBook/09Chapter9/#clipping-with-scalar-fields","title":"Clipping With Scalar Fields","text":"

            Clipping is a common graphics operation that limits the extent of a polygon so that it does not lie outside the view frustrum (see \"Cameras\" in Chapter 3). Figure 9-5 shows a triangle before and after clipping with an infinite plane. The clip operation transforms a polygon into a polygon. Clipping can also be a powerful modeling tool. Clipping part of a structure can reveal internal details of the surface or other parts contained within the surface. Objects can be split into pieces and the pieces can be individually moved and controlled.

            We can do clipping with arbitrary implicit functions using a variation of the \"marching\" primitives discussed in \"Contouring\" in Chapter 6. We illustrate the technique for triangles.

            Recall that marching triangles transforms triangles into lines that approximate a scalar value called the isovalue. This is accomplished using the inside/outside relationship that each vertex has with respect to some scalar value. For our purposes here, we use a scalar value that represents the signed distance of the triangle vertex to a plane. This infinite plane, described by an implicit function of the form F(x, y, z) = n_{xx} + n_{yy} + n_{zz} - d = 0, partitions space into two infinite half spaces. All points with negative scalar values lie on one side of the plane and all with positive values lie on the other side. Figure 9-6 shows a finite plane represented by a grid of triangles. The thick line shows the infinite plane defined by F(x,y,z) = x + y + z - c = 0. The cut algorithm described in \"Cutting\" in Chapter 6 creates a set of lines using the contour operations specific to each cell primitive. In this example, the triangle's contour operator extracts lines that lie on the intersection of the infinite plane and the triangles that comprise the finite plane. The contour operation for a triangle uses the eight cases shown in Figure 9-7 to contour or \"cut\" each triangle appropriately. ` Figure 9-5. Clipping a triangle produces a polygon. The dark line represents an infinite plane. Figure 9-6. Cutting polygons produces lines (cutPlane.tcl).

            Clipping transforms polygons into polygons. We do clipping with a modified case table for the triangle that outputs polygons shown in Figure 9-8. In VTK, each polygonal data cell has a different case table to define the clip operation. Applying the clip algorithm to the polygonal data in Figure 9-9 using the same scalar field generated with a plane equation produces a new set of triangles.

            Formulating clipping using scalar fields permits more sophisticated operations. Clipping can use scalar data that is computed or scalar data that is part of a polygonal dataset's point attributes.

            Figure 9-7. The eight cases for cutting (contouring) a triangle. Black dots show triangle vertices that are \"inside\" the scalar cutting region. Solid lines show the output of the cutting operation. Figure 9-8. The eight cases for clipping a triangle. Black dots show triangle vertices that are \"inside\" the scalar clipping region. Shaded regions show the output of the clip operation. Figure 9-9. A plane of triangles clipped with a plane function (clipPlane.tcl).

            Figure 9-10 shows a scanned image that is first converted to a quadrilateral mesh with vertex scalar values set to the scanned image intensity. Clipping this quadrilateral mesh with a value equal to 1/2 the maximum intensity of the scanned image produces a polygonal model show in Figure 9-10. Figure 9-10. A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles. See CreateBFont.cxx and CreateBFont.py."},{"location":"VTKBook/09Chapter9/#92-vector-algorithms","title":"9.2 Vector Algorithms","text":"

            In Chapter 6 - Fundamental Algorithms we showed how to create simple vector glyphs and how to integrate particles through a vector field to create streamlines. In this section we extend these concepts to create streamribbons and streampolygons. In addition, we introduce the concept of vector field topology, and show how to characterize a vector field using topological constructs.

            "},{"location":"VTKBook/09Chapter9/#streamribbons-and-streamsurfaces","title":"Streamribbons and Streamsurfaces","text":"

            Streamlines depict particle paths in a vector field. By coloring these lines, or creating local glyphs (such as dashed lines or oriented cones), we can represent additional scalar and temporal information. However, these techniques can convey only elementary information about the vector field. Local information (e.g., flow rotation or derivatives) and global information (e.g., structure of a field such as vortex tubes) is not represented. Streamribbons and streamsurfaces are two techniques used to represent local and global information.

            A natural extension of the streamline technique widens the line to create a ribbon. The ribbon can be constructed by generating two adjacent streamlines and then bridging the lines with a polygonal mesh. This technique works well as long as the streamlines remain relatively close to one another. If separation occurs, so that the streamlines diverge, the resulting ribbon will not accurately represent the flow, because we expect the surface of the ribbon to be everywhere tangent to the vector field (i.e., definition of streamline). The ruled surface connecting two widely separated streamlines does not generally satisfy this requirement.

            The streamribbon provides information about important flow parameters: the vector vorticity and flow divergence. Vorticity \\Omega is the measure of rotation of the vector field, expressed as a vector quantity: a direction (axis of rotation) and magnitude (amount of rotation). Streamwise vorticity \\Omega is the projection of \\vec{\\omega} along the instantaneous velocity vector, \\vec{v}. Said another way, streamwise vorticity is the rotation of the vector field around the streamline defined as follows.

            \\begin{equation*} \\Omega = \\frac{\\vec{v} \\cdot \\vec{\\omega}}{\\vert \\vec{v} \\vert \\vert \\vec{\\omega} \\vert} \\end{equation*} \\bf\\tag{9-3}

            The amount of twisting of the streamribbon approximates the streamwise vorticity. Flow divergence is a measure of the \"spread\" of the flow. The changing width of the streamribbon is proportional to the cross-flow divergence of the flow.

            A streamsurface is a collection of an infinite number of streamlines passing through a base curve. The base curve, or rake, defines the starting points for the streamlines. If the base curve is closed (e.g., a circle) the surface is closed and a streamtube results. Thus, streamribbons are specialized types of streamsurfaces with a narrow width compared to length.

            Compared to vector icons or streamlines, streamsurfaces provide additional information about the structure of the vector field. Any point on the streamsurface is tangent to the velocity vector. Consequently, taking an example from fluid flow, no fluid can pass through the surface. Streamtubes are then representations of constant mass flux. Streamsurfaces show vector field structure better than streamlines or vector glyphs because they do not require visual interpolation across icons.

            Streamsurfaces can be computed by generating a set of streamlines from a user-specified rake. A polygonal mesh is then constructed by connecting adjacent streamlines. One difficulty with this approach is that local vector field divergence can cause streamlines to separate. Separation can introduce large errors into the surface, or possibly cause self-intersection, which is not physically possible.

            Another approach to computing streamsurfaces has been taken by Hultquist [Hultquist92]. The streamsurface is a collection of streamribbons connected along their edges. In this approach, the computation of the streamlines and tiling of the streamsurface is carried out concurrently. This allows streamlines to be added or removed as the flow separates or converges. The tiling can also be controlled to prevent the generation of long, skinny triangles. The surface may also be \"torn\", i.e., ribbons separated, if the divergence of the flow becomes too high.

            "},{"location":"VTKBook/09Chapter9/#stream-polygon","title":"Stream Polygon","text":"

            The techniques described so far provide approximate measures of vector field quantities such as streamwise vorticity and divergence. However, vector fields contain more information than these techniques can convey. As a result, other techniques have been devised to visualize this information. One such technique is the stream polygon [Schroeder91], which serves as the basis for a number of advanced vector and tensor visualization methods. The stream polygon is used to visualize local properties of strain, displacement, and rotation. We begin by describing the effects of a vector field on the local state of strain.

            Nonuniform vector fields give rise to local deformation in the region where they occur. If the vector field is displacement in a physical medium such as a fluid or a solid, the deformation consists of local strain (i.e., local distortion) and rigid body motion. To mathematically describe the deformation, we examine a 3D vector \\vec{v} = (u, v, w) at a specified point x = (x, y, z). Using a first order Taylor's series expansion about x, we can express the local deformation eij as

            \\begin{equation*} e_{ij} = \\epsilon_{ij} + \\omega_{ij} \\end{equation*} \\bf\\tag{9-4}

            where \\epsilon_{ij} is the local strain and \\omega_{ij} is the local rotation. Note that these variables are expressed as 3 \\times 3 tensors. (Compare this equation to that given in Figure 6-20. Note that this equation and the following Equation 9-5 differ in their off-diagonal terms by a factor of 1/2. This is because Figure6-20 expresses engineering shear strain which is used in the study of elasticity. Equation 9-5 expresses a tensor quantity and is mathematically consistent.)

            The local strain is expressed as a combination of the partial derivatives at x as follows.

            \\begin{equation*} \\epsilon = \\left( \\begin{array}{c c c} \\frac{\\partial u}{\\partial x} & \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial y} + \\frac{\\partial v}{\\partial x}\\right) & \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial z} + \\frac{\\partial w}{\\partial x}\\right) \\\\ \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial y} + \\frac{\\partial v}{\\partial x}\\right) & \\frac{\\partial v}{\\partial y} & \\frac{1}{2}\\left(\\frac{\\partial v}{\\partial z} + \\frac{\\partial w}{\\partial y}\\right) \\\\ \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial z} + \\frac{\\partial w}{\\partial x}\\right) & \\frac{1}{2}\\left(\\frac{\\partial v}{\\partial z} + \\frac{\\partial w}{\\partial y}\\right) & \\frac{\\partial w}{\\partial z} \\end{array}\\right) \\end{equation*} \\bf\\tag{9-5}

            The terms on the diagonal of \\epsilon_{ij} are the normal components of strain. The off-diagonal terms are the shear strain. The local rigid-body rotation is given by Equation 9-6 can also be represented using tensor notation as

            \\begin{equation*} \\omega = \\left( \\begin{array}{c c c} 0 & \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial y} - \\frac{\\partial v}{\\partial x}\\right) & \\frac{1}{2}\\left(\\frac{\\partial u}{\\partial z} - \\frac{\\partial w}{\\partial x}\\right) \\\\ \\frac{1}{2}\\left(\\frac{\\partial v}{\\partial x} - \\frac{\\partial u}{\\partial y}\\right) & 0 & \\frac{1}{2}\\left(\\frac{\\partial v}{\\partial z} - \\frac{\\partial w}{\\partial y}\\right) \\\\ \\frac{1}{2}\\left(\\frac{\\partial w}{\\partial x} - \\frac{\\partial u}{\\partial z}\\right) & \\frac{1}{2}\\left(\\frac{\\partial w}{\\partial y} - \\frac{\\partial v}{\\partial z}\\right) & 0 \\end{array}\\right) \\end{equation*} \\bf\\tag{9-6}

            where \\omega is the vorticity vector referred to in the previous section. The vorticity, or local rigid body rotation is then

            \\begin{equation*} \\omega_{ij} = -\\frac{1}{2}\\sum_{k} \\epsilon_{ijk}\\, \\omega_{k} \\end{equation*} \\bf\\tag{9-7} \\begin{equation*} \\vec{\\omega} = \\left( \\begin{array}{c} \\frac{\\partial w}{\\partial y} - \\frac{\\partial v}{\\partial z} \\\\ \\frac{\\partial u}{\\partial z} - \\frac{\\partial w}{\\partial x} \\\\ \\frac{\\partial v}{\\partial x} - \\frac{\\partial u}{\\partial y} \\end{array} \\right) \\end{equation*} \\bf\\tag{9-8}

            For the reader unfamiliar with tensor notation, this presentation is certainly less than complete. However, the matrices in Equation 9-5 and Equation 9-6 directly translate into visual form, which will help clarify the concepts presented here. Referring to Figure 9-11, the normal strain, shear strain, and rigid body motion create distinct deformation modes. These modes combine to produce the total deformation. Modes of normal strain cause compression or extension in the direction perpendicular to a surface, while shear strains cause angular distortions. These strains combined with rigid body rotation around an axis yield the total strain at a point. Figure 9-11. Components of local deformation due to vector field. Dotted line shows initially undeformed object.

            The essence of the stream polygon technique is to show these modes of deformation. A regular n-sided polygon (Figure 9-12) is placed into a vector field at a specified point and then deformed according to the local strain. The components of strain may be shown separately or in combination. The orientation of the normal of the polygon is arbitrary. However, it is convenient to align the normal with the local vector. Then the rigid body rotation about the vector is the streamwise vorticity, and the effects of normal and shear strain are in the plane perpendicular to a streamline passing through the point.

            The stream polygon offers other interesting possibilities. The stream polygon may be swept along a trajectory, typically a streamline, to generate tubes. The radius of the tube r can be modified according to some scalar function. One application is to visualize fluid flow. In incompressible flow with no shear, the radius of the tube can vary according to the scalar function vector magnitude. Then the equation

            \\begin{equation*} r(\\vec{v}) = r_\\text{max} \\sqrt{\\frac{\\vert\\vec{v}_\\text{min}\\vert}{\\vert\\vec{v}\\vert}} \\end{equation*} \\bf\\tag{9-9}

            represents an area of constant mass flow. As a result, the tube will thicken as the flow slows and narrow as the velocity increases. Each of the n sides of the tube can be colored with a different scalar function, although for visual clarity, at most, one or two functions should be used.

            Figure 9-12. The stream polygon. (a) Planar view. (b) Aligned with vector. (c) Aligned along streamline. (d) Sweeping polygon to form tube. See OfficeTube.cxx and OfficeTube.py.

            The streamtubes generated by the streampolygon and the streamtubes we described in the previous section are not the same. The streampolygon does not necessarily lie along a streamline. If it does, the streampolygon represents information at a point, while the streamtube is an approximation constructed from multiple streamlines. Also, the radial variation in the tubes constructed from streampolygon sweeps do not necessarily relate to mass flow since the radius in a streampolygon can be tied to an arbitrary scalar variable.

            "},{"location":"VTKBook/09Chapter9/#vector-field-topology","title":"Vector Field Topology","text":"

            Vector fields have a complex structure characterized by special features called critical points [Globus91] [Helman91]. Critical points are locations in the vector field where the local vector magnitude goes to zero and the vector direction becomes undefined. At these points the vector field either converges or diverges, and/or local circulation around the point occurs.

            Critical points lie in dataset cells where the u, v, and w components of the vector field each pass through zero. These points are located using an iterative search procedure such as the bi-section technique. Each iteration evaluates the cell interpolation function until the zero vector is found. Once a critical point is found, its local behavior is determined from the matrix of partial derivatives.

            This is because at the critical point the velocity is zero, and the vector field can be approximated by a first-order expansion of partial derivatives [Helman91]

            \\begin{eqnarray*} u &\\simeq& \\frac{\\partial u}{\\partial x}\\text{d}x + \\frac{\\partial u}{\\partial y}\\text{d}y + \\frac{\\partial u}{\\partial z}\\text{d}z \\\\ v &\\simeq& \\frac{\\partial v}{\\partial x}\\text{d}x + \\frac{\\partial v}{\\partial y}\\text{d}y + \\frac{\\partial v}{\\partial z}\\text{d}z \\\\ w &\\simeq& \\frac{\\partial w}{\\partial x}\\text{d}x + \\frac{\\partial w}{\\partial y}\\text{d}y + \\frac{\\partial w}{\\partial z}\\text{d}z \\end{eqnarray*} \\bf\\tag{9-10}

            The matrix of partial derivatives J can be written in vector notation as \\partial u \\partial v \\partial w

            \\begin{equation*} \\vec{u} = J\\cdot\\text{d}\\vec{x},\\quad \\text{where} \\quad J = \\left( \\begin{array}{c c c} \\frac{\\partial u}{\\partial x} & \\frac{\\partial u}{\\partial y} & \\frac{\\partial u}{\\partial z} \\\\ \\frac{\\partial v}{\\partial x} & \\frac{\\partial v}{\\partial y} & \\frac{\\partial v}{\\partial z} \\\\ \\frac{\\partial w}{\\partial x} & \\frac{\\partial w}{\\partial y} & \\frac{\\partial w}{\\partial z} \\end{array} \\right) \\end{equation*} \\bf\\tag{9-11}

            and is referred to as the Jacobian. The behavior of the vector field in the vicinity of a critical point is characterized by the eigenvalues of J. The eigenvalues consist of an imaginary and real component. The imaginary component describes the rotation of the vector field around the critical point, while the real part describes the relative attraction or repulsion of the vector field to the critical point. In two dimensions the critical points are as shown in Figure 9-13.

            A number of visualization techniques have been developed to construct vector field topology from an analysis of critical points. These techniques provide a global understanding of the field, including points of attachment and detachment and field vortices. Using a fluid flow analogy, points of attachment and detachment occur on the surface of an object where the tangential component of the vector field goes to zero, and the flow is perpendicular to the surface. Thus, streamlines will begin or end at these points. There is no common definition for a vortex, but generally speaking, vortices are regions of relatively concentrated vorticity (e.g., flow rotation). The study of vortices is important because they represent areas of energy loss, or can have significant impact on downstream flow conditions (e.g., trailing vortices behind large aircraft).

            One useful visualization technique creates vector field skeletons that divide the vector field into separate regions. Within each region, the vector field is topologically equivalent to uniform flow. These skeletons are created by locating critical points, and then connecting the critical points with streamlines. In 3D vector field analysis this technique can be applied to the surface of objects to locate lines of flow separation and attachment and other important flow features. Also, in general 3D flow, the regions of uniform flow are separated by surfaces, and creation of 3D flow skeletons is a current research topic.

            Vortex visualization is another area of current research. One technique computes the helicitydensity

            Figure 9-13. Critical points in two dimensions. The real part of the eigenvalues (R1, R2) of the matrix of first derivatives control the attraction or repulsion of the vector field. The imaginary part of the eigenvalues (I1, I2) controls the rotation. \\begin{equation*} H_d = \\vec{v} \\cdot \\vec{w} = \\vert \\vec{v} \\vert \\vert \\vec{w} \\vert \\cos(\\phi) \\end{equation*} \\bf\\tag{9-12}

            This is a scalar function of the vector dot product between the vorticity and the local vector. Large positive values of H_d result in right-handed vortices, while large negative values indicate lefthanded vortices. Helicity-density can be conveniently shown using isosurfaces, which gives an indication for the location and structure of a vortex.

            "},{"location":"VTKBook/09Chapter9/#93-tensor-algorithms","title":"9.3 Tensor Algorithms","text":"

            In Chapter 6 - Fundamental Algorithms we saw that 3 \\times 3 real symmetric tensors can be characterized by the eigenvalues and eigenvectors of the tensor. Recall that we can express the eigenvectors of the system as

            \\begin{equation*} \\vec{v} = \\sum_i \\lambda_i \\vec{e}_i \\end{equation*} \\bf\\tag{9-13}

            where \\vec{e}_i is a unit vector in the direction of the eigenvalue, and \\lambda_i are the eigenvalues. Thus, we can decompose a 3 \\times 3 real symmetric tensor field into three vector fields, each field defined by one of the three eigenvectors described in Equation 9-13. We call these vector fields eigenfields, since they are derived from the eigenvectors of the tensor field.

            Figure 9-14. Creation of hyperstreamlines. An ellipse is swept along a streamline of the eigenfield. Major/minor axes of the ellipse are controlled by the other two eigenvectors.

            Decomposition of the tensor field in this fashion provides additional insight into visualizing 3 \\times 3 real symmetric tensors. We can directly use the vector field visualization techniques presented previously or use variations of them. One such technique is a novel extension of the streampolygon technique, the method of hyperstreamlines.

            "},{"location":"VTKBook/09Chapter9/#hyperstreamlines","title":"Hyperstreamlines","text":"

            Hyperstreamlines are constructed by creating a streamline through one of the three eigenfields, and then sweeping a geometric primitive along the streamline [Delmarcelle93]. Typically, an ellipse is used as the geometric primitive, where the remaining two eigenvectors define the major and minor axes of the ellipse (Figure 9-14). Sweeping the ellipse along the eigenfield streamline results in a tubular shape. Another useful generating geometric primitive is a cross. The length and orientation of the arms of the cross are controlled by two of the eigenvectors. Sweeping the cross results in a helical shape since the eigenvectors (and therefore cross arms) will rotate in some tensor fields.

            Figure 9-15 shows an example of hyperstreamlines. The data is from a point load applied to a semi-infinite domain. Compare this figure to Figure 6-22 that used tensor ellipsoids tov visualize the same data. Notice that there is less clutter and more information available from the hyperstreamline visualization. Figure 9-15. The four hyperstreamlines shown are integrated along the minor principle stress axis. A plane (colored with a different lookup table) is also shown. See HyperStreamline.cxx and HyperStreamline.py."},{"location":"VTKBook/09Chapter9/#94-modelling-algorithms","title":"9.4 Modelling Algorithms","text":""},{"location":"VTKBook/09Chapter9/#visualizing-geometry","title":"Visualizing Geometry","text":"

            One of the most common applications of visualization is to view geometry. We may have a geometric representation of a part or complex assembly (perhaps designed on a CAD system) and want to view the part or assembly before it is manufactured. While viewing geometry is better addressed in text on computer graphics, often there is dataset structure we wish to view in the same way. For example, we may want to see data mapped on a particular portion of the dataset, or view the structure of the dataset itself (e.g., view a finite element mesh).

            Three-dimensional datasets have a surface and interior. Typically we want to visualize the surface of the dataset or perhaps a portion of the interior. (Note: volume rendering is a different matter - see \"Volume Rendering\" in Chapter 7. To visualize the dataset we must extract a portion of the dataset topology/geometry (and associated data) as some form of surface primitives such as polygons. If the surface of the dataset is opaque, we may also wish to eliminate occluded interior detail.

            We have already seen how structured datasets, such as image data or structured grids, have a natural i-j-k coordinate system that allow extraction of points, lines, and planes from the interior of the dataset (see \"Structured Coordinate System\" in Chapter 8). For example, to extract the fifth -iplane from a structured grid of dimensions (i_m, j_m, k_m), we specify the data extents using (4, 4, 0, (j_m - 1), 0, (k_m 1)) (assuming zero-offset addressing).

            More generally, we can extract boundary edges and faces from a dataset. A boundary edge isan 1D cell type (e.g., line or polyline), or the edge of a 2D cell used by only that single cell. Similarly, a boundary face is a 2D cell type (e.g., polygon, triangle strip) or the face of a 3D cell used by only that single cell (Figure 9-16). We can obtain this information using the topological operators of the previous chapter. Cells of dimensions two or less are extracted as is, while boundary edges and faces are determined by counting the number of cell neighbors for a particular topological boundary (i.e., edge or face neighbors). If there are no neighbors, the edge or face is a boundary edge or face, and is extracted.

            Using these techniques we can view the structure of our dataset. However, there are also situations where we want more control in the selection of the data. We call this data extraction.

            "},{"location":"VTKBook/09Chapter9/#data-extraction","title":"Data Extraction","text":"

            Often we want to extract portions of data from a dataset. This may be because we want to reduce the size of the data, or because we are interested in visualizing only a portion of it.

            Figure 9-16. Boundary edges and faces. (a) Subsampling structured data (b) Subsampling unstructured data. Figure 9-17. Subsampling data. (a) Structured data can be subsampled by choosing every nth point. (b) Subsampling unstructured data requires local retriangulation.

            Reducing dataset size is an important practical capability, because visualization data size can be huge. By reducing data size, reductions in computation and memory requirements can be realized. This results in better interactive response.

            We also may need to reduce data size in order to visualize the important features of a large dataset. This can be used to reduce image clutter and improve the effectiveness of the visualization. Smaller data size also enables the visualization user to navigate through and inspect data more quickly relative to larger datasets. Next we describe two techniques to extract data. One is based on geometry extraction, and the other is based on data thresholding, or thresholding.

            Geometry Extraction. Geometry extraction selects data based on geometric or topological characteristics. A common extraction technique selects a set of points and cells that lie within a specified range of ids. A typical example is selecting all cells having ids between 0-100, or all cells using point ids 250-500. Finite element analysts use this method frequently to isolate the visualization to just a few key regions.

            Another useful technique called spatial extraction, selects dataset structure and associated data attributes lying within a specified region in space. For example, a point and radius can be used to select (or deselect) data within an enclosing sphere. Implicit functions are particularly useful tools for describing these regions. Points that evaluate negative are inside the region, while points outside the region evaluate positive; thus, cells whose points are all positive are outside the region, and cells whose points are all negative are inside the region.

            Subsampling (Figure 9-17) is a method that reduces data size by selecting a subset of the original data. The subset is specified by choosing a parameter n, specifying that every nth data point is to be extracted. For example, in structured datasets such as image data and structured grids, selecting every nth point produces the results shown in Figure 9-17(a).

            Subsampling modifies the topology of a dataset. When points or cells are not selected, this leaves a topological \"hole.\" Dataset topology must be modified to fill the hole. In structured data, this is simply a uniform selection across the structured i-j-k coordinates. In unstructured data (Figure 9-17(b)), the hole must be filled in by using triangulation or other complex tessellation schemes. Subsampling is not typically performed on unstructured data because of its inherent complexity.

            A related technique is data masking. In data masking we select every nth cell that at a minimum leaves one or more topological \"holes\" in the dataset. Masking also may change the topology of the dataset, since partial selections of cells from structured datasets can only be represented using unstructured grids. Masking is typically used to improve interactive performance or to quickly process portions of data.

            Thresholding. Thresholding extracts portions of a dataset data based on attribute values. For example, we may select all cells having a point with scalar value between (0,1) or all points having a velocity magnitude greater than 1.0.

            Scalar thresholding is easily implemented. The threshold is either a single value that scalar values are greater than or less than, or a range of values. Cells or points whose associated scalar values satisfy the threshold criteria can be extracted. Other dataset attribute types such as vectors, normals, or tensors can be extracted in similar fashion by converting the type to a single scalar value. For example, vectors can be extracted using vector magnitude, and tensors using matrix determinate.

            A problem with both geometry extraction and thresholding is that the approaches presented thus far extract \"atomic\" pieces of data, that is, a complete cell. Sometimes the cell may lie across the boundary of the threshold. In this case the cell must be clipped (see \"Clipping With Scalar Fields\" in this Chapter) and only a portion of the cell is extracted.

            "},{"location":"VTKBook/09Chapter9/#probing","title":"Probing","text":"

            Probing obtains dataset attributes by sampling one dataset (the input) with a set of points (the probe) as shown in Figure 9-18(a). Probing is also called \"resampling.\" Examples include probing an input dataset with a sequence of points along a line, on a plane, or in a volume. The result of the probing is a new dataset (the output) with the topological and geometric structure of the probe dataset, and point attributes interpolated from the input dataset. Once the probing operation is completed, the output dataset can be visualized with any of the appropriate techniques described in this text.

            Figure 9-18(b) illustrates the details of the probing process. For every point in the probe dataset, the location in the input dataset (i.e., cell, subcell, and parametric coordinates) and interpolation weights are determined. Then the data values from the cell are interpolated to the probe point. Probe points that are outside the input dataset are assigned a nil (or appropriate) value. This process repeats for all points in the probe dataset. Figure 9-18. Probing. The geometry of one dataset (Probe is used to extract dataset attributes from anther dataset (Input). Figure 9-19. Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. See ProbeCombustor.cxx and ProbeCombustor.py.

            Probing can be used to reduce data or to view data in a particular fashion.

            • Data is reduced when the probe operation is limited to a subregion of the input dataset, or the number of probe points is less than the number of input points.

            • Data can be viewed in a particular fashion by sampling on specially selected datasets. Using a probe dataset consisting of a line enables x-y plotting along a line, or using a plane allows surface color mapping or line contouring.

            Probing must be used carefully or errors may be introduced. Under-sampling data in a region can miss important high-frequency information or localized data variations. Oversampling data, while not creating error, can give false confidence in the accuracy of the data. Thus the sampling frequency should have a similar density as the input dataset, or if higher density, the visualization should be carefully annotated as to the original data frequency.

            One important application of probing converts irregular or unstructured data to structured form using a volume of appropriate resolution as a probe to sample the unstructured data. This is useful if we use volume rendering or other volume visualization techniques to view our data.

            Figure 9-19 shows an example of three probes. The probes sample flow density in a structured grid. The output of the probes is passed through a contour filter to generate contour lines. As this figure illustrates, we can be selective with the location and extent of the probe, allowing us to focus on important regions in the data."},{"location":"VTKBook/09Chapter9/#triangle-strip-generation","title":"Triangle Strip Generation","text":"

            Triangle strips are compact representations of triangle polygons as described in \"Triangle Strip\" in Chapter 5. Many rendering libraries include triangle strips as graphics primitives because they are a high-performance alternative to general polygon rendering.

            Visualization and graphics data is often represented with triangles. Marching cubes, for example, generates thousands and potentially millions of triangles to represent an isosurface. To achieve greater performance in our visualizations, we can convert triangle polygons into triangle strips. Or, if data is represented using polygons, we can first triangulate the polygons and then create triangle strips.

            A simple method to generate triangle strips uses greedy gathering of triangles into a strip (Figure 9-20). The method proceeds as follows. An \"unmarked\" triangle is found to initialize the strip - unmarked triangles are triangles that have not yet been gathered into a triangle strip. Starting with the initial triangle, the strip may grow in one of three directions, corresponding to the three edges of the triangle. We choose to grow the strip in the direction of the first unmarked neighbor triangle we encounter. If there are no unmarked neighbors the triangle strip is complete; otherwise, the strip is extended by adding triangles to the list that satisfy triangle strip topology. The strip is grown until no unmarked neighbor can be found. Additional strips are then created using the same procedure until every triangle is marked.

            The length of the triangle strips varies greatly depending on the structure of the triangle mesh.

            Figure 9-21(a) shows triangle strips each of 390 triangles in length from a dataset that was originally structured. Such a case is an exception: unstructured triangle meshes typically average about 5-6 triangles per strip (Figure 9-21(b)). Even so, the memory savings are impressive. A triangle strip of length 6 requires 8 points to represent, while 8 triangles require 24 points, for a memory savings of 66.7 percent. Rendering speed may be greatly affected, too, depending upon the capabilities of the rendering system. Figure 9-20. Creating triangle strips."},{"location":"VTKBook/09Chapter9/#connectivity","title":"Connectivity","text":"

            Intercell connectivity is a topological property of datasets. Cells are topologically connected when they share boundary features such as points, edges, or faces (Figure 9-22). Connectivity is useful in a number of modeling applications, particularly when we want to separate out \"parts\" of a dataset.

            One application of connectivity extracts a meaningful portion of an isosurface. If the isosurface is generated from measured data such as an MRI or CT scan, it likely contains \"noise\" or unimportant anatomical structure. Using connectivity algorithms, we can separate out the part of the isosurface that we desire, either by eliminating noise or undesirable anatomical structure. Figure 9-23 is an example where a 2D surface of interest (e.g., an isocontour) is extracted from a noisy signal. Figure 9-21. Triangle strip examples. (a) Structured triangle mesh consisting of 134 strips each of 390 triangles. (b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip. See StripFran.cxx and StripFran.py. Figure 9-22. Connected cells. Figure 9-23. Extracting portion of isosurface of interest using connectivity.

            Connectivity algorithms can be implemented using a recursive visit method. We begin by choosing an arbitrary cell and mark it \"visited\". Then, depending upon the type of connectivity desired (i.e., point, edge, face), we gather the appropriate neighbors and mark them visited. This process repeats recursively until all connected cells are visited. We generally refer to such a set of connected cells as a connected \"surface\" even though the cells may be of a topological dimension other than two.

            To identify additional connected surfaces we locate another unvisited cell and repeat the processes described previously. We continue to identify connected surfaces until every cell in the dataset is visited. As each connected surface is identified, it is assigned a surface number. We can use this number to specify the surfaces to extract or we can specify \"seed\" points or cells and extract the surfaces connected to them.

            In some cases the recursion depth of the connectivity algorithm becomes larger than the computer system can manage. In this case, we can specify a maximum recursion depth. When this depth is exceeded, recursion is terminated and the current cells in the recursion are used as seeds to restart the recursion.

            Polygon Normal Generation

            Gouraud and Phong shading (see Chapter 3 - Computer Graphics Primer) can improve the appearance of rendered polygons. Both techniques require point normals. Unfortunately polygonal meshes do not always contain point normals, or data file formats may not support point normals. Examples include the marching cubes algorithm for general datasets (which typically will not generate surface normals) and the stereo lithography file format (does not support point normals). Figure 9-24(a) shows a model defined from stereo-lithography format. The faceting of the model is clearly evident.

            To address this situation we can compute surface normals from the polygonal mesh. A simple approach follows. First, polygon normals are computed around a common point. These normals are then averaged at the point, and the normal is renormalized (i.e., n = 1 ) and associated with the point. This approach works well under two conditions.

            1. The orientation of all polygons surrounding the point are consistent as shown in Figure 9-24(b). A polygon is oriented consistently if the order of defining polygon points is consistent with its edge neighbors. That is, if polygon p is defined by points (1,2,3), then the polygon edge neighbor p23 must use the edge (2,3) in the direction (3,2). If not consistent, then the average point normal may be zero or not accurately represent the orientation of the surface. This is because the polygon normal is computed from a cross product of the edges formed by its defining points.

            2. The angular difference in surface normals between adjacent polygons is small. Otherwise, sharp corners or edges will have a washed out appearance when rendered, resulting in an unsatisfactory image (Figure 9-24(c)).

              To avoid these problems we adopt a more complex polygon normal generation algorithm. This approach includes steps to insure that polygons are oriented consistently, and an edge-splitting scheme that duplicates points across sharp edges.

              To orient edges consistently we use a recursive neighbor traversal. An initial polygon is selected and marked \"consistent.\" For each edge neighbor of the initial polygon, the ordering of the neighbor polygon points is checked - if not consistent, the ordering is reversed. The neighbor polygon is then marked \"consistent.\" This process repeats recursively for each edge neighbor until all neighbors are marked \"consistent\". In some cases there may be more than one connected surface, so that the process may have to be repeated until all polygons are visited.

              A similar traversal method splits sharp edges. A sharp edge is an edge shared by two polygons whose normals vary by a user-specified feature angle. The feature angle between two polygons is the angle between their normals (Figure 9-25(a)). When sharp edges are encountered during the recursive traversal, the points along the edge are duplicated, effectively disconnecting the mesh along that edge (Figure 9-25(b)). Then, when shared polygon normals are computed later in the process, contributions to the average normal across sharp edges is prevented.

              On some computers limitations on recursion depth may become a problem. Polygonal surfaces can consist of millions of polygons, resulting in large recursion depth. As a result, the depth of recursion can be specified by the user. If recursion depth exceeds the specified value, the recursion halts and the polygons on the boundary of the recursion become seeds to begin the process again.

              Figure 9-24(d) shows the result of the advanced normal generation technique with a feature angle of 60 degrees. Sharp edges are well defined and curved areas lack the faceting evident in the original model. The figure is shown with Gouraud shading. Figure 9-24. Surface normal generation. (a) Faceted model without normals. (b) Polygons must be consistently oriented to accurately compute normals. (c) Sharp edges are poorly represented using shared normals as shown on the corners of this model. (d) Normal generation with sharp edges split (Normals.cxx). See NormalsDemo.cxx and NormalsDemo.py."},{"location":"VTKBook/09Chapter9/#decimation","title":"Decimation","text":"

              Various data compression techniques have been developed in response to large data size. The UNIX utilities compress/uncompress and the PC utility zip compress data files. The MPEG compression algorithm compresses video sequences. These techniques may be loss-less, meaning that no data is lost between the compression/decompression steps, or lossy, meaning that data is lost during compression. The utilities compress/uncompress and zip are loss-less, while MPEG is lossy.

              Figure 9-25. Computing feature angles (a) and splitting edges (b).

              In graphics, data compression techniques have been developed as well. The subsampling methods we saw earlier in this chapter are an example of simple data compression techniques for visualization data. Another emerging area of graphics data compression is polygon reduction techniques.

              Polygon reduction techniques reduce the number of polygons required to model an object. The size of models, in terms of polygon count, has grown tremendously over the last few years. This is because many models are created using digital measuring devices such as laser scanners or satellites. These devices can generate data at tremendous rates. For example, a laser digitizer can generate on the order of 500,000 triangles in a 15-second scan. Visualization algorithms such as marching cubes also generate large numbers of polygons: one to three million triangles from a 5123 volume is typical.

              One polygon reduction technique is the decimation algorithm [Schroeder92a]. The goal of the decimation algorithm is to reduce the total number of triangles in a triangle mesh, preserving the original topology and forming a good approximation to the original geometry. A triangle mesh is a special form of a polygonal mesh, where each polygon is a triangle. If need be, a polygon mesh can be converted to a triangle mesh using standard polygon triangulation methods.

              Decimation is related to the subsampling technique for unstructured meshes described in Figure 9-17(b). The differences are that

              • decimation treats only triangle meshes not arbitrary unstructured grids;

              • the choice of which points to delete is a function of a decimation criterion, a measure of the local error introduced by deleting a point; and

              • the triangulation of the hole created by deleting the point is carried out in a way as to preserve edges or other important features.

              Decimation proceeds by iteratively visiting each point in a triangle mesh. For each point, three basic steps are carried out (Figure 9-26). The first step classifies the local geometry and topology in the neighborhood of the point. The classification yields one of the five categories shown in the figure: simple, boundary, complex, edge, and corner point. Based on this classification, the second step uses a local error measure (i.e., the decimation criterion) to determine whether the point can be deleted. If the criterion is satisfied, the third step deletes the point (along with associated triangles), and triangulates the resulting hole. A more detailed description of each of these steps and example applications follow. Figure 9-26. Overview of decimation algorithm.

              Point Classification. The first step of the decimation algorithm characterizes the local geometry and topology for a given point. The outcome of classification determines whether the vertex is a potential candidate for deletion, and if it is, which criteria to use.

              Each point may be assigned one of five possible classifications: simple, complex, boundary, interior edge, or corner vertex. Examples of each type are shown in Figure 9-26.

              A simple point is surrounded by a complete cycle of triangles, and each edge that uses the point is used by exactly two triangles. If the edge is not used by two triangles, or if the point is used by a triangle not in the cycle of triangles, then the point is complex. These are nonmanifold cases.

              A point that is on the boundary of a mesh, that is, within a semicycle of triangles, is a boundary point.

              A simple point can be further classified as an interior edge or corner point. These classifications are based on the local mesh geometry. If the surface normal angle between two adjacent triangles is greater than a specified feature angle, then a feature edge exists (see Figure 9-25(a)). When a point is used by two feature edges, the point is an interior edge point. If one, three, or more feature edges use the point, the point is a corner point.

              Complex and corner vertices are not deleted from the triangle mesh; all other vertices become candidates for deletion.

              Decimation Criterion. Once we have a candidate point for deletion, we estimate the error that would result by deleting the point and then replacing it (and its associated triangles) with another triangulation. There are a number of possible error measures; but the simplest are based on distance measures of local planarity or local colinearity (Figure 9-26).

              In the local region surrounding a simple point, the mesh is considered nearly \"flat,\" since there are by definition no feature edges. Hence, simple points use an error measure based on distance to plane. The plane passing through the local region can be computed either using a leastsquares plane or by computing an area-averaged plane.

              Points classified as boundary or interior edge are considered to lay on an edge, and use a distance to edge error measure. That is, we compute the distance that the candidate point is from the new edge formed during the triangulation process.

              A point satisfies the decimation criterion d if its distance measure is less than d. The point can then be deleted. All triangles using the point are deleted as well, leaving a \"hole\" in the mesh. This hole is patched using a local triangulation process.

              Triangulation. After deleting a point, the resulting hole must be retriangulated. Although the hole, defined by a loop of edges, is topologically two dimensional, it is generally non-planar, and therefore general purpose 2D triangulation techniques cannot be used. Instead, we use a special recursive 3D divide-and-conquer technique to triangulate the loop.

              Triangulation proceeds as follows. An initial split plane is chosen to divide the loop in half and create two subloops. If all the points in each subloop lie on opposite sides of the plane, then the split is a valid one. In addition, an aspect ratio check insures that the loop is not too long and skinny, thereby resulting in needle-like triangles. The aspect ratio is the ratio between the length of the split line to the minimum distance of a point in the subloop to the split plane. If the candidate split plane is not valid or does not satisfy the aspect ratio criterion, then another candidate split plane is evaluated. Once a split plane is found, then the subdivision of each subloop continues recursively until a subloop consists of three edges. In this case, the subloop generates a triangle and halts the recursion.

              Occasionally, triangulation fails because no split plane can be found. In this case, the candidate point is not deleted and the mesh is left in its original state. This poses no problem to the algorithm and decimation continues by visiting the next point in the dataset.

              Results. Typical compression rates for the decimation algorithm range from 2:1 to 100:1, with 10:1 a nominal figure for \"large\" (i.e., 105 triangles) datasets. The results vary greatly depending upon the type of data. CAD models typically reduce the least because these models have many sharp edges and other detailed features, and the CAD modellers usually produce minimal triangulations. Terrain data, especially if relatively flat regions are present, may reduce at rates of 100:1.

              (a) (b) Figure 9-27. Examples of decimation algorithm. Triangle meshes are shown in wireframe. See DecimateFran.cxx and DecimateFran.py.; (b). See DecimateHawaii.cxx and DecimateHawaii.py.

              Figure 9-27 shows two applications of decimation to laser digitized data and to a terrain model of Honolulu, Hawaii. In both cases the reduction was on the order of 90 percent for a 10:1 compression ratio. Wireframe images are shown to accentuate the density of the polygonal meshes. The left-hand image in each pair is the original data; the right-hand image is the decimated mesh.

              Notice the gradations in the decimated mesh around features of high curvature. The advantage of decimation, as compared to subsampling techniques, is that the mesh is adaptively modified to retain more details in areas of high curvature.

              Advanced Techniques. Polygon reduction is an active field of research. Many powerful algorithms beyond the decimation algorithm have been presented (see \"Bibliographic Notes\" in this Chapter). Although we cannot cover the field in its entirety in this section, there are two notable trends worth addressing. First, progressive schemes [Hoppe96] allow incremental transmission and reconstruction of triangle meshes - this is especially important for Web-based geometry visualization. Second, recent algorithms modify the topology of the mesh [He96] [Popovic97] [Schroeder97]. This feature is essential towards obtaining arbitrary levels of mesh reduction.

              A progressive mesh is a series of triangle meshes M_ii related by the operations

              \\begin{equation*} \\left(\\hat{M} = M^n \\right) \\to M^{n - 1} \\to \\ldots \\to M^1 \\to M^0 \\end{equation*} \\bf\\tag{9-14}

              where \\vec{M} and M^n represent the mesh at full resolution, and M^0 is a simplified base mesh. The critical characteristic of progressive meshes is that is possible to choose the mesh operations in such a way to make them invertible. Then the operations can be applied in reverse order (starting with the base mesh M^0)

              \\begin{equation*} M^0 \\to M^1 \\to \\ldots \\to M^{n - 1} \\to M^n \\end{equation*} \\bf\\tag{9-15}

              to obtain a mesh of desired reduction level (assuming that the reduction level is less than the base mesh M^0).

              One such invertible operator is an edge collapse and its inverse is the edge split shown in Figure 9-28(a). Each collapse of an interior mesh edge results in the elimination of two triangles (or one triangle if the collapsed vertex is on a boundary). The operation is represented by five values \\begin{equation*} \\text{Edge Collapse/Split}(v_s, v_t, v_\\ell, v_r, A) ``\\end{equation*} \\bf\\tag{9-16}

              where v_s is the vertex to collapse/split, v_t is the vertex being collapsed to / split from, and v_l and v_r are two additional vertices to the left and right of the split edge. These two vertices in conjunction with v_s and v_t define the two triangles deleted or added. A represents vertex attribute information, which at a minimum contains the coordinates x of the collapsed / split vertex v_s. (Note: in the context of the decimation algorithm, the edge collapse operator replaces the recursive triangulation process.)

              While progressive meshes allow us to compactly store and transmit triangle meshes, the problem remains that the size of the base mesh is often larger than desired reduction level. Since in some applications we wish to realize any given level, we want the base mesh to contain no triangles

              \\begin{equation*} \\left(\\hat{M} = M^n \\right) \\to M^{n - 1} \\to \\ldots \\to M^1 \\to \\left(M^0 = M(V, \\varnothing)\\right) \\end{equation*} \\bf\\tag{9-17}

              (some vertices are necessary to initiate the edge split operations). To address this problem, the invertible edge collapse/split operator - which is topology preserving - is extended with a vertex split/merge operator. The vertex split/merge operator modifies the topology of the mesh and allows arbitrary levels of reduction.

              Figure 9-28. Progressive mesh operators edge collapse/split and vertex split/merge.

              A mesh split occurs when we replace vertex vs with vertex vt in the connectivity list of one or more triangles that originally used vertex vs (Figure 9-28(b)). The new vertex vt is given exactly the same coordinate value as vs. Splits introduce a \"crack\" or \"hole\" into the mesh. We prefer not to split the mesh, but at high decimation rates this relieves topological constraint and enables further decimation. Splitting is only invoked when a valid edge collapse is not available, or when a vertex cannot be triangulated (e.g., a nonmanifold vertex). Once the split operation occurs, the vertices vs and vt are re-inserted into the priority queue.

              Different splitting strategies are used depending on the classification of the vertex (Figure 9-28(c)). Interior edge vertices are split along the feature edges, as are corner vertices.

              Nonmanifold vertices are split into separate manifold pieces. In any other type of vertex splitting occurs by arbitrarily separating the loop into two pieces. For example, if a simple vertex cannot be deleted because a valid edge collapse is not available, the loop of triangles will be arbitrarily divided in half (possibly in a recursive process).

              Like the edge collapse/split, the vertex split/merge can also be represented as a compact operation. A vertex split/merge operation can be represented with four values

              \\begin{equation*} \\text{vertex split/merge}(v_s, v_t, v_l, v_r) \\end{equation*} \\bf\\tag{9-18}

              The vertices v_l and v_r define a sweep of triangles (from v_r to v_l ) that are to be separated from the original vertex vs (we adopt a counter-clockwise ordering convention to uniquely define the sweep of triangles).

              Figure 9-29. Results of topology modifying progressive mesh algorithm.

              Figure 9-29 shows the results of applying the topology modifying progressive mesh algorithm to two sets of data. In Figure 9-29(a-c), a thin plate with holes is decimated (the darker lines show split edges). The middle image in the sequence shows the limits of topology on the algorithm. It is only when the topology of the mesh is allowed to be modified that the final level of reduction is possible. Figure 9-29(d-f) shows the same algorithm applied to CAD data."},{"location":"VTKBook/09Chapter9/#mesh-smoothing","title":"Mesh Smoothing","text":"

              Mesh smoothing is a technique that adjusts the point coordinates of a dataset. The purpose of mesh smoothing is to improve the appearance of a mesh, and/or improve the shape of dataset cells. During smoothing the topology of the dataset is not modified, only the geometry. Applications of mesh smoothing include improving the appearance of isosurfaces, or as a modelling tool to remove surface noise. The appearance of models can be dramatically improved by applying mesh smoothing. Figure 9-30 is an example of smoothing applied to analytic surface (a semicylinder) with a random surface distortion (smoothCyl.tcl). Figure 9-30. Mesh smoothing. (a) Motion of point. (b) Smoothing a point on an edge. Bold lines indicate connectivity. Figure 9-31. Mesh smoothing. (a) Motion of point. (b) Smoothing a point on an edge. Bold lines indicate connectivity.

              A simple, yet effective technique is Laplacian smoothing. The Laplacian smoothing equation for a point p_i at position x_i is given by

              \\begin{equation*} \\vec{x}_{i+1} = \\vec{x}_i + \\lambda \\vec{V}(i, j) = \\vec{x}_i + \\lambda \\sum_{j = 0}^{n}\\vec{x}_j - \\vec{x}_i \\end{equation*} \\bf\\tag{9-19}

              where x_i + 1 is the new coordinate position, and x_j are the positions of points p_j \"connected\" to p_i, and \\lambda is a user-specified weight. Geometrically this relation is depicted in Figure 9-31(a). Here the vertex p_i is connected to the surrounding points p_j via edges. The equation expresses that the new position x_i + 1 is offset from the original position x_i plus the average vector \\vec{V}_{ij} multiplied by \\lambda. Typically, the factor \\lambda is a small number (e.g., 0.01), and the process is executed repeatedly (e.g., 50-100 iterations). Notice that the overall effect of smoothing is to reduce the high frequency surface information. The algorithm will reduce surface curvature and tend to flatten thesurface.

              Besides adjusting the number of iterations and smoothing factor, smoothing can be controlled by modifying the connections between p_i and its surrounding points pj. For example, if p_i lies along a fold or sharp edge in the mesh, we may want to only use the two edge end points to compute the smoothing vector \\vec{V}_ij, limiting the motion of p_i along the edge (Figure 9-31(b)). We can also anchor p_i to prevent any motion. Anchoring is useful for points that are located on \"corners\" or other special features such as nonmanifold attachments. One benefit of anchoring and controlling point connectivity is that we can limit the amount of shrinkage in the mesh. It also tends to produce better overall results. (In Figure 9-30 the boundary points of the surface are constrained to move along the boundary, while the points at sharp corners are anchored.)

              Although Laplacian smoothing works well in most cases, there are applications of Laplacian smoothing that can badly damage the mesh. Large numbers of smoothing iterations, or large smoothing factors, can cause excessive shrinkage and surface distortion. Some objects, like spheres or the cylinder shown in Figure 9-30, will lose volume with each iteration, and can even shrink to a point. In rare cases it is possible for the mesh to pull itself \"inside-out.\" Situations like this occur when the average vector moves pi across a mesh boundary, causing some of the attached triangles to overlap or intersect.

              Mesh smoothing is particularly useful when creating models that do not require high accuracy. As we have seen, smoothing modifies point coordinates and, therefore, surface geometry. Use smoothing to improve the appearance of models, but characterize error carefully if you are going to measure from a smoothed surface. Alternatively, you may want to design your own smoothing algorithms that better fit the underlying data.

              "},{"location":"VTKBook/09Chapter9/#swept-volumes-and-surfaces","title":"Swept Volumes and Surfaces","text":"

              Consider moving an object (e.g., your hand) over some path (e.g., raise your hand). How can we visualize this motion? The obvious answer is to form a time-animation sequence as the hand is moved. But what if we wish to statically represent the motion as well as the space that is traversed by the hand? Then we can use swept surfaces and swept volumes.

              A swept volume is the volume of space occupied by an object as it moves through space along an arbitrary trajectory. A swept surface is the surface of the swept volume. Together, swept volumes and swept surfaces can statically represent the motion of objects.

              Past efforts at creating swept surfaces and volumes have focused on analytical techniques. The mathematical representation of various 3D geometric primitives (e.g., lines, polygons, splines) was extended to include a fourth dimension of time (the path). Unfortunately, these approaches have never been practically successful, partly due to mathematical complexity and partly due to problem degeneracies.

              Degeneracies occur when an n-dimensional object moves in such a way that its representation becomes (n-1)-dimensional. For example, moving a plane in the direction of its normal, sweeps out a 3D \"cubical\" volume. Sweeping the plane in a direction perpendicular to its normal, however, results in a degenerate condition, since the plane sweeps out a 2D \"rectangle.\"

              Instead of creating swept surfaces analytically, numerical approximation techniques can be used [Schroeder94]. Implicit modeling provides the basis for an effective technique to visualize object motion via swept surfaces and volumes. The technique is immune to degeneracies and can treat any geometric representation for which a distance function can be computed, such as the VTK cell types.

              The technique to generate swept surfaces and volumes using an implicit modeling approach proceeds as follows. The geometric model, or part, and a path describing the parts motion, or sweep trajectory ST, must be defined. Then we use the following steps as depicted in Figure 9-32.

              1. Generate an implicit model from the part. This results in an implicit representation in the form of a volume. We call this the implicit model V_I.

              2. Construct another volume, the workspace volume V_W, that strictly bounds V_I as it moves along the path ST. Then sweep V_I through V_W by moving in small steps, \\delta x, along ST. At each step, s, sample V_I with the workspace volume V_W. We use a boolean union operation to perform the sampling.

              3. Extract isosurface, or offset surface(s) from V_W using a contouring algorithm such as marching cubes.

              4. Step3 may create multiple connected surfaces. If a single surface is desired, use connectivity to extract the single \"largest\" surface (in terms of number of triangles). This surface is an approximation to the swept surface, and the volume it encloses is an approximation to the swept volume.

              Figure 9-32. Overview of swept surface technique. Figure 9-33. Generating workspace volume by sampling implicit volume.

              There are a few points that require additional explanation. This algorithm uses two volumes, the implicit model and the workspace volume. Both are implicit models, but the workspace volume is used to accumulate the part as it moves along the sweep trajectory. In theory, the part could be sampled directly into the workspace volume to create the implicit model of the swept surface. Performance issues dictate that the implicit model is sampled into the workspace volume. This is because it is much faster to sample the implicit model of the part rather than the part itself, since computing the distance function from a part that may consist of tens of thousands of cells is relatively timeconsuming, compared to sampling the implicit model V_I.

              Sampling V_I is depicted in Figure 9-33. The sweep trajectory is defined by a series of transformation matrices ST = {t_1, t_2,..., t_m}. As the part moves along ST, interpolation is used to compute an inbetween transformation matrix t. Sampling is achieved by inverse transforming VW into the local space of V_I using t. Then, similar to the probe operation described in \"Probing\" in this Chapter, the points of V_W are transformed by the inverse of the transformation matrix t-1, and used to interpolate the distance values from the implicit model V_I. Figure 9-34. Computing sampling and stepping error.

              Because we are dealing with an implicit modeling technique, parts with concave features can generate multiple surfaces. As discussed in \"Connectivity\" in this Chapter, the connectivity algorithm is used to separate out the swept surface. This final surface is an approximation to the actual swept surface, since we are sampling the actual geometric representation on an array of points (i.e., the implicit model), and then sampling the implicit model on another volume (i.e., the workspace volume). Also, stepping along the sweep trajectory generates errors proportional to the step size \\deltax.

              These errors can be characterized as follows (Figure 9-34). Given a voxel size L/D, where L is the edge length of the volume, and D is the dimension of the volume (assumed uniform for convenience), the maximum sampling error is \\begin{equation*} e \\leq \\frac{\\sqrt{3}}{2} \\frac{L}{D} \\end{equation*} \\bf\\tag{9-20}

              The error due to stepping, which includes both translation and rotational components, is bounded by \\delta x / 2, where \\delta x is the maximum displacement of any point on the implicit model at any given translational step. Combining these terms for sampling both volumes and the error due to stepping, the total error is

              \\begin{equation*} e_\\text{tot} \\leq \\frac{\\sqrt{3}}{2}\\left( \\frac{L_\\text{I}}{D_\\text{I}} + \\frac{L_\\text{W}}{D_\\text{W}}\\right) + \\frac{\\Delta x}{2} \\end{equation*} \\bf\\tag{9-21}

              where the subscripts I and W refer to the implicit model and workspace volume, respectively.

              Figure 9-35. Swept surfaces. (a) Swept mace sampled at 25 locations. (b) Swept vtk sampled at 21 locations.

              To show the application of this algorithm, we have generated swept surfaces for the letters \"VTK\" and the \"mace\" model as shown in Figure 9-35.

              We have purposely chosen a step size to exaggerate the stepping error. Using more steps would smooth out the surface \"bumps\" due to stepping. Also, the appearance of the surface varies greatly with the selected isosurface value. Larger values give rounder, smoother surfaces. If you use small values near zero (assuming positive distance function) the surface may break up. To correct this you need to use a higher resolution work-space or compute negative distances. Negative distances are computed during the implicit modeling step by negating all points inside the original geometry. Negative distances allow us to use a zero isosurface value or to generate internal offset surfaces. Negative distances can only be computed for closed (i.e., manifold) objects.

              "},{"location":"VTKBook/09Chapter9/#visualizing-unstructured-points","title":"Visualizing Unstructured Points","text":"

              Unstructured point datasets consist of points at irregular positions in 3D space. The relationship between points is arbitrary. Examples of unstructured point datasets are visualizing temperature distribution from an array of (arbitrarily) placed thermocouples, or rainfall level measured at scattered positions over a geographic region.

              Unlike image data and structured grids, or even unstructured grids, unstructured point dataset have no topological component relating one point to another. For these reasons unstructured points are simple to represent but difficult to visualize. They are difficult to visualize because there is no inherent \"structure\" to which we can apply our library of visualization techniques. Beyond just displaying points (possibly colored with scalar value, or using oriented vector glyphs) none of the techniques discussed thus far can be used. Thus, to visualize unstructured points we have to build structure to which we can apply our visualization techniques.

              There are several approaches available to build topological structure given a random set of points. One common approach samples unstructured points into an image dataset, and then visualizes the data using standard volume or surface-based rendering techniques. Another approach creates n-dimensional triangulations from the unstructured points, thereby creating topological structure. These and other common techniques are described in the following sections.

              Splatting Techniques. Splatting techniques build topological structure by sampling unstructured points into a image dataset (Figure 9-36). The sampling is performed by creating special influence, or splatting, functions SF(x,y,z) that distribute the data value of each unstructured point over the surrounding region. To sample the unstructured points, each point is inserted into a image dataset SP, and the data values are distributed through SP using the splatting functions SF(x,y,z). Once the topological structure is built, any image-based visualization technique can be used (including volume rendering).

              A common splatting function is a uniform Gaussian distribution centered at a point pi. The function is conveniently cast into the form

              \\begin{equation*} \\text{SF}(x, y, z) = s\\, \\exp\\left( -f(r/R)^2 \\right) \\end{equation*} \\bf\\tag{9-22}

              where s is a scale factor that multiplies the exponential, ff is the exponent scale factor f \\geq 0, r is the distance between any point and the Gaussian center point (i.e., the splat point) r = \\|p - p_ii|, and R is the radius of influence of the Gaussian, where r \\leq R.

              The Gaussian function (Figure 9-37(a)) becomes a circle in cross section in two dimensions (Figure 9-37(b)) and a sphere in three dimensions. Since the value of the function is maximum when r = 0, the maximum value is given by the scale factor s. The parameter f controls the rate of decay of the splat. Scalar values can be used to set the value of s, so that relatively large scalar values create bigger splats than smaller values.

              Splats may be accumulated using the standard implicit modeling boolean operations (Equation 6-13, Equation 6-14, and Equation 6-15). That is, we may choose to form a union, intersection, or difference of the splats. The union and intersection operators are used most frequently.

              Another interesting variation modifies the shape of the splat according to a vector quantity such as surface normal or vector data. Figure 9-37(c) shows an example where the splat shape is elongated in the direction parallel to a vector. Thus, if we have a set of points and normals, we can create a polygonal surface by combining splatting with isosurface extraction. Figure 9-36. Splatting techniques depicted in 2D. (a) Injecting points into the image dataset (circular splats). (b) Visualizing the image dataset via contouring. Any image-based visualization technique could be used. Figure 9-37. Gaussian splatting functions. (a) one-dimensional, (b) 2D spherical, and (c) 2D elliptical.

              To generate oriented splats, we modify Equation 9-22 by introducing an eccentricity factor E and the vector \\vec{v}.

              \\begin{equation*} \\text{SF}(x, y, z) = s\\, \\exp\\left( -f\\left(\\frac{(r_{xy}/E)^2 + z^2}{R^2}\\right) \\right) \\end{equation*}` \\bf\\tag{9-23}

              where z and r_{xy} are computed from

              \\begin{eqnarray*} z &=& \\vec{v}\\cdot(\\vec{p} - \\vec{p}_i), \\quad \\text{where} \\quad \\vert \\vec{v} \\vert = 1 \\\\ r_{xy} &=& r^2 - z^2 \\end{eqnarray*} \\bf\\tag{9-24}

              The parameter z is the distance along the vector \\vec{v}, and the parameter r_{xy} is the distance perpendicular to \\vec{v} to the point p. The eccentricity factor controls the shape of the splat. A value E = 1 results in spherical splats, whereas E > 1 yields flattened splats and E < 1 yields elongated splats in the direction of the vector \\vec{v}.

              Figure 9-38(a) shows an elliptical splat with E = 10. (The splat surface is created by using isosurface extraction.) As expected, the splat is an ellipsoid. Figure 9-38(b) is an application of elliptical splatting used to reconstruct a surface from an unstructured set of points. The advantage of using an elliptical splat is that we can flatten the splat in the plane perpendicular to the point normal. This tends to bridge the space between the point samples. The surface itself is extracted using a standard isosurface extraction algorithm.

              Interpolation Techniques. Interpolation techniques construct a function to smoothly interpolate a set of unstructured points. That is, given a set of n points p_i = (x_i, y_i, z_i) and function values F_i(p_i), a new function F(p) is created that interpolates the points p_i. Once the interpolation function is constructed, we can build topological structure from the unstructured points by sampling F(p) over an image dataset. We can then visualize the image data using any of the various techniques presented throughout the text.

              (a) Single elliptical splat (b) Surface Reconstruction Figure 9-38. Elliptical splatting. (a) Single elliptical splat with eccentricity E=10. Cone shows orientation of vector. (b) Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction. Points regularly subsampled and overlayed on original mesh. See SingleSplat.cxx and SingleSplat.py.; (b). See SplatFace.cxx and SplatFace.py.

              Shepard's method is an inverse distance weighted interpolation technique [Wixom78]. The interpolation functions can be written

              \\begin{equation*} F(p) = \\frac{\\sum_i^n \\frac{F_i}{\\vert p - p_i\\vert^2}}{\\sum_i^n \\frac{1}{\\vert p - p_i \\vert^2}} \\end{equation*} \\bf\\tag{9-25}

              where F(p_i) = F_i. Shepard's method is easy to implement, but has the undesirable property that limits its usefulness for most practical applications. The interpolation functions generate a local \"flat spot\" at each point pi since the derivatives are zero

              \\begin{equation*} \\frac{\\partial F}{\\partial x} = \\frac{\\partial F}{\\partial y} = \\frac{\\partial F}{\\partial z} = 0 \\end{equation*} \\bf\\tag{9-26}

              As a result, Shepard's method is overly constrained in the region around each point.

              Shepard's method is an example of a basis function method. That is, the interpolation function F(p) consists of a sum of functions centered at each data point, pi. Other basis function methods have been developed as described by Nielson [Nielson91]. They vary in localization of the basis functions and the sophistication of the interpolation function. Localization of basis functions means that their effect is isolated to a small region. Examples of more sophisticated basis functions include quadratic polynomials and cubic splines. Please see the references for more information.

              Triangulation techniques build topology directly from unstructured points. The points are triangulated to create a topological structure consisting of n-dimensional simplices that completely bound the points and linear combinations of the points (the so-called convex hull). The result of triangulation is a set of triangles (2D) or tetrahedra (3D), depending upon the dimension of the input data [Lawson86].

              Figure 9-39. The Delaunay triangulation (a) and Dirichlet tessellation (b). The circumcircle of each triangle in a Delaunay triangulation contains no other points but the three vertices of the triangle. The region surrounding each point pi in a Dirichlet tessellation is the set of points closest to p_i.

              An n-dimensional triangulation of a point set P = (p_1, p_2, p_3, ..., p_n) is a collection of n-dimensional simplices whose defining points lie in P. The simplices do not intersect one another and share only boundary features such as edges or faces. The Delaunay triangulation is a particularly important form [Bowyer81] [Watson81]. It has the property that the circumsphere of any n-dimensional simplex contains no other points of P except the n+1 defining points of the simplex (Figure 9-39(a)).

              The Delaunay triangulation has many interesting properties. In two dimensions, the Delaunay triangulation has been shown to be the optimal triangulation. That is, the minimum interior angle of a triangle in a Delaunay triangulation is greater than or equal to the minimum interior angle of any other possible triangulation. The Delaunay triangulation is the dual of the Dirichlet tessellation (Figure 9-39(b)), another important construction in computational geometry. The Dirichlet tessellation, also known as the Voronoi tessellation, is a tiling of space where each tile represents the space closest to a point pi. (The tiles are called Voronoi cells.) An n-dimensional Delaunay triangulation can be constructed from the Dirichlet tessellation by creating edges between Voronoi cells that share common n-1 boundaries (e.g., faces in 3D and edges in 2D). Conversely, the vertices of the Dirichlet tessellation are located at the circumcenters of the Delaunay circumcircles. Figure 9-40. Computing the Delaunay triangulation using technique of Watson and Boyer. Points are injected into triangulation forming new Delaunay triangulations. In the final step, the initial bounding points are removed to reveal final triangulation.

              The Delaunay triangulation can be computed using a variety of techniques. We describe a particularly elegant technique introduced independently by Watson [Watson81] and Bowyer [Bowyer81] (Figure 9-40). The algorithm begins by constructing an initial Delaunay triangulation that strictly bounds the point set P, the so-called bounding triangulation. This bounding triangulation can be as simple as a single triangle (2D) or tetrahedron (3D). Then, each point of P is injected one by one into the current triangulation. If the injected point lies within the circumcircle of any simplex, then the simplex is deleted, leaving a \"hole\" in the triangulation. After deleting all simplices, the n-1 dimensional faces on the boundary of the hole, along with the injected point, are used to construct a modified triangulation. This is a Delaunay triangulation, and the process continues until all points are injected into the triangulation. The last step removes the simplices connecting the points forming the initial bounding triangulation to reveal the completed Delaunay triangulation.

              This simplistic presentation of triangulation techniques has shown how to create topological structure from a set of unstructured points. We have ignored some difficult issues such as degeneracies and numerical problems. Degeneracies occur when points in a Delaunay triangulation lie in such a way that the triangulation is not unique. For example, the points lying at the vertices of a square, rectangle, or hexagon are degenerate because they can be triangulated in more than one way, where each triangulation is equivalent (in terms of Delaunay criterion) to the other. Numerical problems occur when we attempt to compute circumcenters, especially in higher-dimensional triangulations, or when simplices of poor aspect ratio are present.

              Despite these problems, triangulation methods are a powerful tool for visualizing unstructured points. Once we convert the data into a triangulation (or in our terminology, an unstructured grid), we can directly visualize our data using standard unstructured grid techniques.

              Hybrid Techniques. Recent work has focused on combining triangulation and basis function techniques for interpolating 2D bivariate data. The basic idea is as follows. A triangulation of P is constructed. Then an interpolating network of curves is defined over the edges of the triangulation. These curves are constructed with certain minimization properties of interpolating splines. Finally, the curve network is used to construct a series of triangular basis functions, or surface patches, that exhibit continuity in function value, and possibly higher order derivatives. (See [Nielson91] for more information.)

              "},{"location":"VTKBook/09Chapter9/#multidimensional-visualization","title":"Multidimensional Visualization","text":"

              The treatment of multidimensional datasets is an important data visualization issue. Each point in a dataset is described by an n-dimensional coordinate, where $n geq 3. Here we assume that each coordinate is an independent variable, and that we wish to visualize a single dependent variable. (Multi- dimensional visualization of vectors and tensors is an open research area.) An application of multidimensional data is financial visualization, where we might want to visualize return on investment as a function of interest rate, initial investment, investment period, and income, to name just a few possibilities.

              There are two fundamental problems that we must address when applying multidimensional visualization. These are the problems of projection and understanding.

              The problem of projection is that in using computer graphics we have two dimensions in which to present our data, or possibly three or four if we use specialized methods. Using 3D graphics we can give the illusion of three dimensions, or we can use stereo viewing techniques to achieve three dimensions. We can also use time as a fourth dimension by animating images. However, except for these limited situations, general n-dimensional data cannot be represented on a 2D computer screen.

              The problem of understanding is that humans do not easily comprehend more than three dimensions, or possibly three dimensions plus time. Thus, even if we could create a technique to display data of many dimensions, the difficulty in understanding the data would impair the usefulness of the technique.

              Most multidimensional visualization techniques work with some form of dimension mapping, where n dimensions are mapped to three dimensions and then displayed with 3D computer graphics techniques. The mapping is achieved by fixing all variables except three, and then applying the visualization techniques described throughout the text to the resulting data. For maximum benefit, the process of fixing independent variables, mapping to three dimensions, and then generating visualization must be interactive. This improves the effectiveness of the visualization process, allowing the user to build an internal model of the data by manipulating different parts of the data.

              One novel approach to multidimensional visualization has been proposed by Inselberg and Dimsdale [Inselberg87]. This approach uses parallel coordinate systems. Instead of plotting points on orthogonal axes, the ith dimensional coordinate of each point is plotted along separate, parallel axes. This is shown in Figure 9-41 for a five-dimensional point. In parallel coordinate plots, points appear as lines. As a result, plots of n-dimensional points appear as sequences of line segments that may intersect or group to form complex fan patterns. In so doing, the human pattern recognition capability is engaged. Unfortunately, if the number of points becomes large, and the data is not strongly correlated, the resulting plots can become a solid mass of black, and any data trends are drowned in the visual display.

              Another useful multivariable technique uses glyphs. This technique associates a portion of the glyph with each variable. Although glyphs cannot generally be designed for arbitrary n-dimensional data, in many applications we can create glyphs to convey the information we are interested in. Refer to \"Glyphs\" in Chapter 6 for more information about glyphs.

              Figure 9-41. Plotting a five-dimensional point using parallel coordinates. (a) plot of single point, (b) plot of many points."},{"location":"VTKBook/09Chapter9/#texture-algorithms","title":"Texture Algorithms","text":"

              Texturing is a common tool in computer graphics used to introduce detail without the high cost of graphics primitives. As we suggested in Chapter 7 - Advanced Computer Graphics, texture mapping can also be used to visualize data. We explore a few techniques in the following sections.

              Texture Thresholding. We saw earlier how to threshold data based on scalar values (see \"Thresholding\" in this Chapter). We refer to this approach as geometric thresholding because structural components of a dataset (e.g., points and cells) are extracted based on data value. In contrast, we can use texture mapping techniques to achieve similar results. We call this technique texture thresholding.

              Texture thresholding conceals features we do not want to see and accentuates features that we want to see. There are many variations on this theme. A feature can be concealed by making it transparent or translucent, by reducing its intensity, or using muted colors. A feature can be accentuated by making it opaque, increasing its intensity, or adding bright color. In the following paragraphs we describe a technique that combines intensity and transparency.

              Texture thresholding requires two pieces of information: a texture map and an index into the map, or texture coordinate. In the simplest case we can devise a texture map that consists of two distinct regions as shown in Figure 9-42(a). The first region is alternatively referred to as \"conceal,\" \"off,\" or \"outside.\" The second region is referred to as \"accentuate,\" \"on,\" or \"inside.\" (These different labels are used depending upon the particular application.) With this texture map in hand we can texture threshold by computing an appropriate texture coordinate. Areas that we wish to accentuate are assigned a coordinate to map into the \"accentuate\" portion of the texture map. Areas that we want to conceal are assigned a coordinate to map into the \"conceal\" portion of the texture map.

              One texture threshold technique uses transparency. We can conceal a region by setting its alpha opacity value to zero (transparent), and accentuate it by setting the alpha value to one (opaque). Thus, the texture map consists of two regions: a concealed region with \\alpha = 0 and an accentuated region with \\alpha = 1. Of course, the effect can be softened by using intermediate alpha values to create translucent images.

              An extension of this technique introduces a third region into the texture map: a transition region (Figure 9-42(b)). The transition region is the region between the concealed and accentuated regions. We can use the transition region to draw a border around the accentuated region, further highlighting the region. Figure 9-42. 1D texture map. (a) In/out map. (b) Addition of transition region to in/out map.

              To construct the texture map we use intensity-alpha, or I\\alpha values. The intensity modulates the underlying color, while the alpha value controls transparency (as described previously). In the accentuated region, the intensity and opacity values are set high. In the concealed region, the intensity value can be set to any value (if \\alpha = 0) or to a lower value (if \\alpha \\ne 0).The transition reg ion can use various combinations of \\alpha and intensity. A nice combination produces a black, opaque transition region (i.e., I = 0 and \\alpha = 1 ).

              To visualize information with the thresholding technique, we must map data to texture coordinates. As we saw previously, we can use scalar values in combination with a threshold specification to map data into the concealed, transition, and accentuated regions of the texture map. Figure 9-43a shows an example of texture thresholding applied to scalar data from a simulation of fluid flow. A scalar threshold sT is set to show only data with scalar value greater than or equal to sT.

              Another useful texture thresholding application uses implicit functions to map point position to texture coordinate. This is similar in effect to geometric clipping (see \"Clipping With Scalar Fields\" in this Chapter). As we saw in \"Implicit Functions\" in Chapter 6, implicit functions naturally map a (x, y, z) coordinate value into three regions: F(x, y, z) < 0, F(x, y, z) = 0, and F(x, y, z) > 0 ; or equivalently, the concealed, transition, and accentuated regions of the texture map. Using boolean combinations of implicit functions, we can create complex cuts of our data as illustrated in Figure 9-43b. This figure shows two nested spheres. The outer sphere is cut by a boolean combination of two planes to show the inner sphere.

              Boolean Textures. Texture thresholding can be extended into higher dimensions. That is, 2D or 3D texture coordinates can be used to map two or three data variables into a texture map. One such technique is boolean textures, a method to clip geometry using a 2D texture map and two implicit functions [Lorensen93].

              Boolean textures extend texture thresholding for geometric clipping from 1D to 2D. Instead of using a single implicit function to label regions \"in\" or \"out\", two implicit functions are used. This results in four different regions corresponding to all possible combinations of \"in\" and \"out.\"

              (a) Thresholding data with texture (b) Sphere cut with transparent texture Figure 9-43. Examples of texture thresholding. (a) Using scalar threshold to show values of flow density on plane above value of 1.5. (b) Boolean combination of two planes to cut nested spheres. See TextureThreshold.cxx and TextureThreshold.py.; (b). See TextureCutSphere.cxx and TextureCutSphere.py. Figure 9-44. 2D Boolean texture.

              The boolean texture map is modified to reflect this as shown in Figure 9-44. As with 1D texture thresholding, transition regions can be created to separate the four regions.

              The boolean texture map can be created with combinations of intensity and transparency values to achieve a variety of effects. By combining the four combinations of in/out (i.e., four regions of Figure 9-44) with the two combinations of \"conceal\" and \"accentuate,\" sixteen different boolean textures are possible. Figure 9-45a illustrates these combinations expressed as boolean combinations of two implicit functions A and B. The \"inside\" of the implicit functions is indicated with subscript i, while the outside is indicated with subscript o. The boolean expressions indicate the regions that we wish to conceal, as shown by open circles. The darkened circles are the regions that are accentuated. We can see in Figure 9-45b the effects of applying these different boolean textures to a sphere. The implicit functions in this figure are two elliptical cylinders sharing a common axis, and rotated 90 degrees from one another. In addition, transition regions have been defined with I = 0 to generate the dark cut edges shown. All 16 spheres share the same texture coordinates; only the texture map changes. (a) Combination of 2D in/out textures (b) Sixteen boolean textures (from above) applied to sphere Figure 9-45. Sixteen boolean textures. (a) Sixteen combinations of in/out. (b) Textures applied to sphere using two elliptical cylinder implicit functions. See TextureCutQuadric.cxx and TextureCutQuadric.py.

              Texture Animation. Time-based animation techniques can illustrate motion or temporal data variations. This process often requires relatively large amounts of computer resource to read, process, and display the data. Thus, techniques to reduce computer resources are desirable when animating data.

              Texture mapping can be used to animate certain types of data. In these techniques, the data is not regenerated frame by frame, instead a time-varying texture map is used to change the visual appearance of the data. An example of this approach is texture animation of vector fields [Yamrom95].

              Figure 9-46. Texture maps for vector animation. Sixteen textures applied in succession create effect of motion along a vector. (a) Simple map. (b) Varying intensity \"feathers\" effect of motion.

              As we saw in \"Hedgehogs and Oriented Glyphs\" in Chapter 6, vector fields can be represented as oriented and scaled lines. Texture animation can transform this static representational scheme into a dynamic representation. The key is to construct a series of 1D texture maps that when applied rapidly in sequence create the illusion of motion. Figure 9-46(a) shows a series of sixteen such texture maps. The maps consist of intensity-alpha (I \\alpha ) values, A portion of the texture map is set fully opaque with full intensity (I = 1, \\alpha = 1 ). This is shown as the \"dark\" pattern in Figure 9-46(a). The remainder of the map is set fully transparent with arbitrary intensity ( I = 1, \\alpha = 0 ) shown as the \"white\" portion. As is evidenced by the figure, the sequence of 16 texture maps scanned top to bottom generate the appearance of motion from left to right. Notice also how the texture maps are designed to wrap around to form a continuous pattern.

              Along with the 1D texture map, the texture coordinate s must also be generated - on a line this is straightforward. The line origin receives texture coordinate s = 0, while the line terminus receives texture coordinate value s = 1. Any intermediate points (if the vector is a polyline) are parameterized in monotonic fashion in the interval (0,1). Texture coordinates need only be generated once. Only the texture map is varied to generate the vector animation.

              Other effects are possible by modifying the texture map. Figure 9-46(b) shows a texture map with a repeating sequence of opaque/transparent regions. In each opaque region the intensity is gradually reduced from left to right. The result is that this tends to \"feather\" the appearance of the vector motion. The resulting image is more pleasing to the eye."},{"location":"VTKBook/09Chapter9/#95-putting-it-all-together","title":"9.5 Putting It All Together","text":"

              With the conclusion of this chapter we have provided an overview of the basics of data visualization. In this section we show you how to use some of the advanced algorithms as implemented in the Visualization Toolkit.

              "},{"location":"VTKBook/09Chapter9/#dividing-cubes-point-generation","title":"Dividing Cubes / Point Generation","text":"

              Dividing cubes is implemented in VTK with the class vtkDividingCubes. It has been specialized to operate with image datasets. Besides specifying the contour value, you must specify a separation distance between points (using the method SetDistance()). If you desire a solid appearance, pick a distance that is less than or equal to display resolution.

              The separation distance controls the accuracy of point generation. It is possible to generate points that appear to form a solid surface when rendered, but are not accurately located on the contour surface. Although this usually is not an issue when viewing contour surfaces, if the accuracy of the point positions is important, the distance value must be set smaller. However, this can result in huge numbers of points. To reduce the number of points, you can use the SetIncrement() method, which specifies that every nth point is to be generated. Using this approach, you can obtain good accuracy and control the total number of points. An example where point positions are important is when the points are used to locate glyphs or as seed points for streamline generation.

              The Visualization Toolkit provides other point generation techniques. The source object vtkPointSource generates a user-specified number of points within a spherical region. The point positions are random within the sphere. (Note that there is a natural tendency for higher point density near the center of the sphere because the points are randomly generated along the radius and spherical angles \\phi and \\theta.)

              Figure 9-47 is an example use of vtkPointSource to generate streamlines. The dataset is a structured grid of dimensions 21 \\times 20 \\times 20 with flow velocity and a scalar pressure field. The dataset is a CFD simulation of flow in a small office. As this picture shows, there are a couple of bookcases, desks, a window, and an inlet and outlet for the ventilation system. On one of the desks is a small, intense heat source (e.g., a cigarette). In the left image 25 streamlines are started near the inlet using a vtkPointSource point generator. The second image shows what happens when we move the point source slightly to the left. By adjusting a single parameter (e.g., the center of the point source) it is possible to quickly explore our simulation data. Figure 9-47. Using random point seeds to create streamlines. See OfficeA.cxx and OfficeA.py.; (b). See Office.cxx and Office.py.

              Another convenient object for point generation is the class vtkEdgePoints. vtkEdgePoints generates points on an isosurface. The points are generated by locating cell edges whose points are both above and below the isosurface value. Linear interpolation is used to generate the point. Since vtkEdgePoints operates on any cell type, this filter's input type is any dataset type (e.g.,vtkDataSet). Unlike vtkDividingCubes this filter will not typically generate dense point clouds that appear solid.

              "},{"location":"VTKBook/09Chapter9/#clipping-with-scalar-fields_1","title":"Clipping with Scalar Fields","text":"

              Clipping is implemented in vtkClipPolyData. Each polygonal data primitive implements the operation in its Clip() method using cases tables derived in a manner similar to that of triangles described here.. vtkClipPolyData has methods to control whether an implicit function provides the scalar data or whether the dataset's scalar data will be used. ComputeScalarDataOn() uses the implicit function and ComputeScalarDataOff() uses the dataset's scalar data. Two output polygonal datasets are produced. These are accessed with GetOutput() and GetClippedOutput() methods. GetOutput() returns the polygonal data that is \"inside' the clipping region while GetClippedOutput() returns polygonal data that is \"outside\" the region. (Note that GenerateClippedOutputOn() must be enabled if you are to get the clipped output.) The meaning of inside and outside can be reversed using the InsideOutOn() method. Figure 9-48 shows a plane of quadrilaterals clipped with a boolean implicit function. (b) Figure 9-48. A plane clipped with a sphere and an ellipse. The two transforms place each implicit function into the appropriate position. Two outputs are generated by the clipper. See ClipSphereCylinder.cxx and ClipSphereCylinder.py.

              Until recently, VTK supported clipping only for polygonal data cell types (vertices, polyvertices, line, polylines, polygons and triangle strips). Recent additions since VTK version 4.0 support clipping of 3D cells using an ordered Delaunay triangulation approach.

              "},{"location":"VTKBook/09Chapter9/#swept-volumes-and-surfaces_1","title":"Swept Volumes and Surfaces","text":"

              Swept surfaces can be applied in two interesting ways. First, they can be used as a modelling tool to create unusual shapes and forms. In this sense, swept surfaces are an advanced implicit modelling technique. Second, swept surfaces can be used to statically represent object motion. This is an important visualization technique in itself and has many important applications. One of these applications is design for maintainability.

              When a complex mechanical system like a car engine is designed, it is important to design proper access to critical engine components. These components, like spark plugs, require higher levels of service and maintenance. It is important that these components can be easily reached by a mechanic. We've read horror stories of how it is necessary to remove an engine to change a spark plug. Insuring ready access to critical engine parts prevents situations like this from occurring.

              Swept surface can assist in the design of part access. We simply define a path to remove the part (early in the design process), and then generate a swept surface. This surface (sometimes referred to as a maintenance access solid or MAS) is then placed back into the CAD system. From this point on, the design of surrounding components such as fuel lines or wiring harnesses must avoid the MAS. As long as the MAS is not violated, the part can be removed. If the MAS is violated, a reevaluation of the removal path or redesign of the part or surrounding components is necessary.

              Figure 9-49 shows how to create a swept surface from a simple geometric representation. The geometry is simply a line-stroked VTK. The next step is to define a motion path. This path is defined by creating a list of transformation matrices. Linear interpolation is used to generate intermediate points along the path if necessary.

              In Figure 9-49 we also see the basic procedure to construct the swept surface. First, we must construct an implicit representation of the part by using vtkImplictModeller. This is then provided as input to vtkSweptSurface. It is important that the resolution of the implicit model is greater than or equal to that of vtkSweptSurface. This will minimize errors when we construct the surface. A bounding box surrounding the part and its motion can be defined, or it will be computed automatically. For proper results, this box must strictly contain the part as its moves. We also can set the number of interpolation steps, or allow this to be computed automatically as well. In the figure, we have chosen a small number to better illustrate the stepping of the algorithm.

              Once vtkSweptSurface executes, we extract the swept surface using an isosurfacing algorithm. The isosurface value is an offset distance; thus we can create surfaces that take into account geometry tolerance. (This is particularly important if we are designing mechanical systems.) The implementation of the implicit modeller in VTK uses a positive distance function; so the isosurface value should always be positive. To create swept surfaces of zero and negative value requires a modification to the implicit modeller.

              Figure 9-49. Generating swept surface from line-stroked \"vtk\". The class vtkSweptSurface was in the Patented directory in VTK 4.4. This directory was removed in VTK 5.0, and this class is not available in that release."},{"location":"VTKBook/09Chapter9/#multidimensional-visualization_1","title":"Multidimensional Visualization","text":"

              An important characteristic of multidimensional datasets is that they cannot be categorized according to any of the types defined in the Visualization Toolkit. This implies that source objects interfacing with multidimensional data are responsible for converting the data they interface with into one of the types defined in VTK. This can be a difficult process, requiring you to write interface code.

              Other visualization systems treat this problem differently. In these systems a dataset type is defined that can represent multidimensional data. This dataset type is essentially an n-dimensional matrix. Additional filters are defined that allow the user to extract pieces of the dataset and assemble them into a more conventional dataset type, such as a volume or structured grid. After mapping the data from multidimensional form to conventional form, standard visualization techniques can be applied. (Future implementations of VTK may include this functionality. At the current time you must map multidimensional data into a known VTK form.)

              To demonstrate these ideas we will refer to Figure 9-50. This is an example of multidimensional financial data. The data reflects parameters associated with monetary loans. In the file financial.txt there are six different variables: TIME_LATE, MONTHLY_PAYMENT, UNPAID_PRINCIPLE, LOAN_AMOUNT, INTEREST_RATE, and MONTHLY_INCOME. (Note: this is simulated data, don't make financial decisions based upon this!)

              We will use Gaussian splatting to visualize this data (see \"Splatting Techniques\" in this Chapter).

              (a) Visualization network Figure 9-50. Visualization of multidimensional financial data. Visualization network, output image, and sample C++ code are shown (finance.cxx). The gray/wireframe surface represents the total data population. The dark surface represents data points delinquent on loan payment. See Finance.cxx and Finance.py.

              Our first step is to choose dependent and independent variables. This choice is essentially a mapping from multidimensional data into an unstructured point dataset. In this example we will choose MONTHLY_PAYMENT, INTEREST_RATE, and LOAN_AMOUNT as our (x, y, z) point coordinates, and TIME_LATE as a scalar value. This maps four of six variables. For now we will ignore the other two variables.

              We use vtkGaussianSplatter to perform the splatting operation (i.e., conversion from unstructured points to volume dataset). This is followed by an isosurface extraction. We splat the data two times. The first time we splat the entire population. This is to show context and appears as gray/ wireframe in the figure. The second time we splat the data and scale it by the value of TIME_LATE. As a result, only payments that are late contribute to the second isosurface.

              The results of this visualization are interesting. First, we see that there is a strong correlation between the two independent variables MONTHLY_PAYMENT and LOAN_AMOUNT. (This is more evident when viewing the data interactively.) We see that the data falls roughly on a plane at a 45 degree angle between these two axes. With a little reflection this is evident: the monthly payment is strongly a function of loan amount (as well as interest rate and payment period). Second, we see that there is a clustering of delinquent accounts within the total population. The cluster tends to grow with larger interest rates and shrink with smaller monthly payments and loan amounts. Although the relationship with interest rate is expected, the clustering towards smaller monthly payments is not. Thus our visualization has provided a clue into the data. Further exploration may reveal the reason(s), or we may perform additional data analysis and acquisition to understand the phenomena.

              One important note about multidimensional visualization. Because we tend to combine variables in odd ways (e.g., the use of MONTHLY_PAYMENT, INTEREST_RATE, and LOAN_AMOUNT as (x, y, z) coordinates), normalization of the data is usually required. To normalize data we simply adjust data values to lie between (0,1). Otherwise our data can be badly skewed and result in poor visualizations.

              "},{"location":"VTKBook/09Chapter9/#connectivity_1","title":"Connectivity","text":"

              Many useful visualization algorithms often borrow from other fields. Topological connectivity analysis is one such technique. This technique is best categorized as a method in computational geometry, but serves many useful purposes in computer graphics and visualization.

              To illustrate the application of connectivity analysis, we will use an MRI dataset generated by Janet MacFall at the Center for In Vivo Microscopy at Duke University. The dataset is a volume of dimensions 2563 and is included on the CD-ROM. The data is of the root system of a small pine tree. Using the class vtkSliceCubes, an implementation of marching cubes for large volumes, we generate an initial isosurface represented by 351,118 triangles. (We have placed the file pine_root.tri on CD-ROM. This is a faster way of manipulating this data. If you have a large enough computer you can process the volume directly with vtkVolume16Reader and vtkMarchingCubes.)

              (a) isosurface (b) largest connected surface Figure 9-51.Applying connectivity filter to remove noisy isosurface. Data is from 256^3 volume data of the root system of a pine tree. See PineRootConnectivityA.cxx and PineRootConnectivityA.py.; (b). See PineRootConnectivity.cxx and PineRootConnectivity.py.

              The vtkConnectivityFilter is a general filter taking datasets as input, and generating an unstructured grid as output. It functions by extracting cells that are connected at points (i.e., share common points). In this example the single largest surface is extracted. It is also possible to specify cell ids and point ids and extract surfaces connected to these.

              "},{"location":"VTKBook/09Chapter9/#decimation_1","title":"Decimation","text":"

              Decimation is a 3D data compression technique for surfaces represented as triangle meshes. We use it most often to improve rendering interactive response for large models.

              Figure 9-52 shows the application of decimation to the data from the pine root example. The original model of 351,118 triangles is reduced to 81,111 triangles using a combination of decimation and connectivity. The decimation parameters are fairly conservative. Here we see a reduction of approximately 55 percent. (a) Connected isosurface (b)Decimated connected isosurface Figure 9-52. Applying connectivity and decimation filters to remove noisy isosurfaces and reduce data size). Data is from 2563 volume data of the root system of a pine tree. See PineRootConnectivity.cxx and PineRootConnectivity.py.; (b). See PineRootDecimation.cxx and PineRootDecimation.py.

              The most common parameters to adjust in the vtkDecimate filter are the TargetReduction, InitialError, ErrorIncrement, MaximumIterations, and InitialFeatureAngle. TargetReduction specifies the compression factor (numbers closer to one represent higher compression). Because of topological, decimation criterion, aspect ratio, and feature angle constraints this reduction may not be realized (i.e., TargetReduction is a desired goal, not a guaranteed output). The InitialError and ErrorIncrement control the decimation criterion. As the filter starts, the decimation criterion is set to InitialError. Then, for each iteration the decimation criterion is incremented by ErrorIncrement. The algorithm terminates when either the target reduction is achieved, or the number of iterations reaches MaximumIterations. The InitialFeatureAngle is used to compute feature edges. Smaller angles force the algorithm to retain more surface detail.

              Other important parameters are the AspectRatio and MaximumSubIterations. AspectRatio controls the triangulation process. All triangles must satisfy this criterion or the vertex will not be deleted during decimation. A sub-iteration is an iteration where the decimation criterion is not incremented. This can be used to coalesce triangles during rapid rates of decimation. MaximumSubIterations controls the number of sub-iterations. This parameter is typically set to two.

              "},{"location":"VTKBook/09Chapter9/#texture-clipping","title":"Texture Clipping","text":"

              Texture mapping is a powerful visualization technique. Besides adding detail to images with minimal effort, we can perform important viewing and modelling operations. One of these operations is clipping data to view internal structure.

              Figure 9-53 is an example of texture clipping using a transparent texture map. The motor show consists of five complex parts, some of which are hidden by the outer casing. To see the inside of the motor, we define an implicit clipping function. This function is simply the intersection of two planes to form a clipping \"corner.\" The object vtkImplicitTextureCoords is used in combination with this implicit function to generate texture coordinates. These objects are then rendered with the appropriate texture map and the internal parts of the motor can be seen.

              The texture map consists of three regions (as described previously in the chapter). The concealed region is transparent. The transition region is opaque but with a black (zero intensity) color. The highlighted region is full intensity and opaque. As can be seen from Figure 9-53, the boundaries appear as black borders giving a nice visual effect. Figure 9-53. Texture cut used to reveal internal structure of a motor. Two cut planes are used in combination with transparent texture. See Motor.cxx and Motor.py.

              The importance of texture techniques is that we can change the appearance of objects and even perform modelling operations like clipping with little effort. We need only change the texture map. This process is much faster relative to the alternative approach of geometric modelling. Also, hardware support of texture is becoming common. Thus the rendering rate remains high despite the apparent increase in visual complexity.

              "},{"location":"VTKBook/09Chapter9/#delaunay-triangulation","title":"Delaunay Triangulation","text":"

              Delaunay triangulation is used to construct topology from unstructured point data. In two dimensions we generate triangles (i.e., an unstructured grid or polygonal dataset) while in three dimensions we generate tetrahedra (i.e., an unstructured grid). Typical examples of image data include points measured in space, or a dimensional subset of multidimensional data.

              In the example of Figure 9-54 we show how to create a 2D Delaunay triangulation from a field of points. The points are created by generating random x and y coordinate values in the interval [0, 1], and setting the z-value to a constant value (i.e., the points lie in an x-y plane). The points are then triangulated, and tubes and sphere glyphs are used to highlight the resulting points and edges of the triangulation. Figure 9-54.Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes. Only the pipeline to generate triangulation is shown. See DelaunayMesh.cxx and DelaunayMesh.py.

              One important concern regarding Delaunay triangulations is that the process is numerically sensitive. Creating triangles with poor aspect ratio (e.g., slivers) can cause the algorithm to break down. If you have a large number of points to triangulate, you may want to consider randomizing the point order. This approach tends to generate triangles with better aspect ratio and give better results. You may also want to consider other implementations of Delaunay triangulation that are more numerically robust. See [Edelsbrunner94] for an example.

              "},{"location":"VTKBook/09Chapter9/#96-chapter-summary","title":"9.6 Chapter Summary","text":"

              Dividing cubes is a scalar contouring operation that generates points rather than surface primitives such as lines or polygons. Dense point clouds appear solid because of the limited resolution of computer images.

              Vector fields have a complex structure. This structure can be visualized using streamribbons, streamsurfaces, and streampolygons. The topology of a vector field can be characterized by connecting critical points with streamlines.

              Tensor fields consist of three orthogonal vector fields. The vector fields are the major, medium, and minor eigenvectors of the tensor field. Hyperstreamlines can be used to visualize tensor fields.

              Dataset topology operations generate triangle strips, extract connected surfaces, and compute surface normals. Decimation is a polygon reduction algorithm that reduces the number of triangles in a triangle mesh. Implicit modelling techniques can be used to construct swept surfaces and volumes. Unstructured points are easy to represent but difficult to visualize. Splatting, interpolation, and triangulation techniques are available to construct structure for unstructured points. Multivariate visualization is required for data of dimension four and higher. Data must be mapped to three dimensions before standard visualization techniques can be used. Parallel coordinates techniques are also available to visualize multivariate data.

              Modelling algorithms extract geometric structure from data, reduce the complexity of the data or create geometry. Spatial extraction selects dataset structure and associated data attributes lying within a specified region in space. Subsampling reduces data by selecting every nth data point. A related technique, data masking, selects every nth cell. Subsets of a dataset can also be selected using thresholding, which selects cells or points that lie within a range of scalar values. Probing resamples data at a set of points. The probe produces a dataset that has the topology of the probe with data values from the probed dataset. Generating triangle strips can reduce storage requirements and improve rendering speeds on some systems. If a dataset has multiple disjoint structures, a connectivity algorithm can uniquely identify the separate structures. For polygonal data that does not have vertex normals defined, normal generation algorithms can compute these values that are suitable for interpolation by Gouraud or Phong shading. Decimation, another data reduction technique, removes triangles in \"flat\" regions and fills the resulting gaps with new triangles. Unstructured points present a challenge because the data does not have topology. Splatting represents each point in the data with a uniform sampling and accumulates these splats using implicit modelling techniques. Triangulation techniques build topology directly from the unstructured points.

              Multidimensional visualization techniques focus on data that has many scalar data values for each point. Parallel coordinates is an interesting approach that plots the scalar values for a data point along a parallel axis. The observer looks for trends and relationships between the lines that represent each point's data.

              Texture algorithms use texture coordinates and texture maps to select or highlight portions of a dataset. Texture thresholding assigns texture coordinates based on a scalar value. The scalar value and texture map determine how a cell or portion of a cell is rendered. Boolean textures extend this concept to 2D and 3D. Careful design of a boolean texture map permits the \"clipping\" of geometry with combinations of implicit surfaces. Texture can also be used to animate vector fields.

              "},{"location":"VTKBook/09Chapter9/#97-bibliographic-notes","title":"9.7 Bibliographic Notes","text":"

              Dividing cubes is an interesting algorithm because of the possibilities it suggests [Cline88]. Point primitives are extremely simple to render and manipulate. This simplicity can be used to advantage to build accelerated graphics boards, perform 3D editing, or build parallel visualization algorithms.

              Many plotting and visualization systems use carpet plots extensively. Carpet plots are relatively easy to represent and render. Often 2D plotting techniques are used (i.e., lighting and perspective effects ignored). Check [Wang90] for additional information on rendering carpet plots.

              In recent years a number of powerful vector visualization techniques have emerged. These techniques include streamsurfaces [Hultquist92], streampolygons [Schroeder91], vector field topology [Helman91] [Globus91], streamballs [Brill94], and vorticity visualization [Banks94]. The streamballs technique is a recent technique that combines techniques from implicit modeling. You may also wish to see references [Crawfis92] [vanWijk93] and [Max94]. These describe volume rendering and other advanced techniques for vector visualization, topics not well covered in this text.

              Some abstract yet beautiful visualization images are due to Delmarcelle and Hesselink [Delmarcelle93]. Their rendering of hyperstreamlines reflect the underlying beauty and complexity of tensor fields.

              Polygon reduction is a relatively new field of study. SIGGRAPH '92 marked a flurry of interest with the publication of two papers on this topic [Schroeder92a] [Turk92]. Since then a number of valuable techniques have been published. One of the best techniques, in terms of quality of results, is given by [Hoppe93], although it is limited in time and space because it is based on formal optimization techniques. Other interesting methods include [Hinker93] and [Rossignac93]. A promising area of research is multiresolution analysis, where wavelet decomposition is used to build multiple levels of detail in a model [Eck95]. The most recent work in this field stresses progressive transmission of 3D triangle meshes [Hoppe96], improved error measures [Garland97], and algorithms that modify mesh topology [Popovic97] [Schroeder97]. Most recently an extensive book on the technology is available including specialized methods for terrain simplification [Luebke02].

              Triangle strip generation is an effective technique for achieving dramatic improvements in rendering speed and reductions in data handling. The reference by [Evans96] describes other triangle strip generation algorithms as well as presenting some of the most effective tvechniques to date.

              The use of texture for visualization is relatively unexploited. This has been due in part to lack of texture support in most graphics software and hardware. This is now changing, as more vendors support texture and software systems (such as OpenGL) that provide an API for texture. Important references here include the boolean textures [Lorensen93] and surface convolution techniques [Cabral93] [Stalling95].

              Unstructured or unorganized point visualization is likely to play a prominent role in visualization as the field matures and more complex data is encountered. Nielson et al. have presented important work in this field [Nielson91].

              Multidimensional visualization is another important focus of visualization research [Bergeron89] [Mihalisin90]. Much real-world data is both unstructured and multidimensional. This includes financial databases, marketing statistics, and multidimensional optimization. Addressing this type of data is important to achieve future advances in understanding and application. Feiner [Feiner90] has presented a simple projection method combined with virtual reality techniques. [Inselberg87] has introduced parallel coordinates. These techniques have been shown to be powerful for many types of visual analysis.

              "},{"location":"VTKBook/09Chapter9/#98-references","title":"9.8 References","text":"

              [Banks94] D. C. Banks and B. A. Singer. \"Vortex Tubes in Turbulent Flows: Identification, Representation, Reconstruction.\" In Proceedings of Visualization '94. pp. 132-139, IEEE Computer Society Press, Los Alamitos, CA, 1994.

              [Bergeron89] R. D. Bergeron and G. Grinstein. \"A Reference Model for the Visualization of Multidimensional Data.' In Proceedings Eurographics \"89. pp. 393-399, North Holland, Amsterdam, 1989.

              [Bowyer81] A. Bowyer. \"Computing Dirichlet Tessellations.' The Computer Journal. 24(2):162-166, 1981.

              [Brill94] M. Brill, H. Hagen, H-C. Rodrian, W. Djatschin, S. V. Klimenko. \"Streamball Techniques for Flow Visualization.\" In Proceedings of Visualization '94. pp. 225-231, IEEE Computer Society Press, Los Alamitos, CA, 1994.

              [Cabral93] B. Cabral and L. Leedom. \"Imaging Vector Fields Using Line Integral Convolution.\" In Proceedings of SIGGRAPH '93, pp. 263-270, Addison-Wesley, Reading, MA, 1993.

              [Cline88] H. E. Cline, W. E. Lorensen, S. Ludke, C. R. Crawford, and B. C. Teeter, \"Two Algorithms for the Three-Dimensional Construction of Tomograms.\" Medical Physics. 15(3):320-327, June 1988.

              [Crawfis92] R, Crawfis and N. Max. \"Direct Volume Visualization of Three Dimensional Vector Fields.\" In Proceedings 1992 Workshop on Volume Visualization. pp. 55-60, ACM Siggraph, New York, 1992.

              [Delmarcelle93] T. Delmarcelle and L. Hesselink. \"Visualizing Second-Order Tensor Fields with Hyperstreamlines.\" IEEE Computer Graphics and Applications. 13(4):25-33, 1993.

              [Eck95] M. Eck, T. DeRose, T. Duchamp, H. Hoppe, M. Lounsbery, W. Stuetzle. \"Multiresolution Analysis of Arbitrary Meshes.\" In Proceedings SIGGRAPH '95. pp. 173-182, Addison-Wesley, Reading, MA, August 1995.

              [Edelsbrunner94] H. Edelsbrunner and E. P. Mucke. \"Three-dimensional alpha shapes.\" ACM Transactions on Graphics. 13:43-72, 1994.

              [Evans96] F. Evans, S. Skiena, A. Varshney. \"Optimizing Triangle Strips for Fast Rendering.\" In Proceedings of Visualization '96. pp. 319-326, IEEE Computer Society Press, Los Alamitos, CA, 1996.

              [Feiner90] S. Feiner and C. Beshers. \"Worlds within Worlds: Metaphors for Exploring n-Dimensional Virtual Worlds.\" In Proceedings UIST '90 (ACM Symp. on User Interface Software). pp. 76-83, October, 1990.

              [Garland97] M. Garland and P. Heckbert. \"Surface Simplification Using Quadric Error Metrics.\" In Proceedings SIGGRAPH '97. pp. 209-216, The Association for Computing Machinery, New York, August 1997.

              [Globus91] A. Globus, C. Levit, and T. Lasinski. \"A Tool for Visualizing the Topology of Three-Dimensional Vector Fields.\" In Proceedings of Visualization '91. pp. 33-40, IEEE Computer Society Press, Los Alamitos, CA, 1991.

              [He96] T. He, L. Hong, A. Varshney, S. Wang. \"Controlled Topology Simplification.\" IEEE Transactions on Visualization and Computer Graphics. 2(2):171-184, June 1996.

              [Helman91] J. L. Helman and L. Hesselink. \"Visualization of Vector Field Topology in Fluid Flows.' IEEE Computer Graphics and Applications. 11(3):36-46, 1991.

              [Hinker93] P. Hinker and C. Hansen. \"Geometric Optimization.\" In Proceedings of Visualization '93. pp. 189-195, IEEE Computer Society Press, Los Alamitos, CA, October 1993.

              [Hoppe93] H. Hoppe, T. DeRose, T. Duchamp, J. McDonald, W. Stuetzle. \"Mesh Optimization.\" In Proceedings of SIGGRAPH '93. pp. 19-26, August 1993.

              [Hoppe96] H. Hoppe. \"Progressive Meshes.\" In Proceedings SIGGRAPH '96. pp. 96-108, The Association for Computing Machinery, New York, August 1996.

              [Hultquist92] J. P. M. Hultquist. \"Constructing Stream Surfaces in Steady 3-D Vector Fields.\" In Proceedings of Visualization '92. pp. 171-178, IEEE Computer Society Press, Los Alamitos, CA, 1992.

              [Inselberg87] A. Inselberg and B. Dimsdale. \"Parallel Coordinates for Visualizing Multi-Dimensional Geometry.\" In Computer Graphics 1987 (Proceedings of CG International '87). pp. 25-44, SpringerVerlag, 1987.

              [Lawson86] C. L. Lawson. \"Properties of n-Dimensional Triangulations.\" Computer-Aided Geometric Design. 3:231-246, 1986.

              [Lorensen93] W. Lorensen. \"Geometric Clipping with Boolean Textures.\" in Proceedings of Visualization '93. pp. 268-274, IEEE Computer Society Press, Los Alamitos, CA, Press, October 1993.

              [Luebke02] D. Luebke, M. Reddy, J. Cohen, A. Varshney, B. Watson, R. Huebner. Level of Detail for 3D Graphics. Morgan Kaufmann 2002. ISBN 1-55860-838-9.

              [Max94] N. Max, R. Crawfis, C. Grant. \"Visualizing 3D Vector Fields Near Contour Surfaces.\" In Proceedings of Visualization '94. pp. 248-255, IEEE Computer Society Press, Los Alamitos, CA, 1994.

              [Mihalisin90] T. Mihalisin, E. Gawlinski, J. Timlin, and J. Schwegler. \"Visualizing a Scalar Field on an n-Dimensional Lattice.\" In Proceedings of Visualization '90. pp. 255-262, IEEE Computer Society Press, Los Alamitos, CA, October 1990.

              [Nielson91] G. M. Nielson, T. A. Foley, B. Hamann, D. Lane. \"Visualizing and Modeling Scattered Multivariate Data.\" IEEE Computer Graphics and Applications. 11(3):47-55, 1991.

              [Popovic97] J. Popovic and H. Hoppe. \"Progressive Simplicial Complexes.\" In Proceedings SIGGRAPH '97. pp. 217-224, The Association. for Computing Machinery, New York, August 1997.

              [Rossignac93] J. Rossignac and P. Borrel. \"Multi-Resolution 3D Approximations for Rendering Complex Scenes.\" In Modeling in Computer Graphics: Methods and Applications. B. Falcidieno and T. Kunii, eds., pp. 455-465, Springer-Verlag Berlin, 1993.

              [Schroeder91] W. Schroeder, C. Volpe, and W. Lorensen. \"The Stream Polygon: A Technique for 3D Vector Field Visualization.\" In Proceedings of Visualization '91. pp. 126-132, IEEE Computer Society Press, Los Alamitos, CA, October 1991.

              [Schroeder92a] W. Schroeder, J. Zarge, and W. Lorensen. \"Decimation of Triangle Meshes.\" Computer Graphics (SIGGRAPH \"92). 26(2):65-70, August 1992.

              [Schroeder92b] W. Schroeder, W. Lorensen, G. Montanaro, and C. Volpe. \"Visage: An Object-Oriented Scientific Visualization System.' In Proceedings of Visualization \"92. pp. 219-226, IEEE Computer Society Press, Los Alamitos, CA, October 1992.

              [Schroeder94] W. Schroeder, W. Lorensen, and S. Linthicum, \"Implicit Modeling of Swept Surfaces and Volumes.\" In Proceedings of Visualization '94. pp. 40-45, IEEE Computer Society Press, Los Alamitos, CA, October 1994.

              [Schroeder97] W. Schroeder. \"A Topology Modifying Progressive Decimation Algorithm.\" In Proceedings of Visualization '97. IEEE Computer Society Press, Los Alamitos, CA, October 1997.

              [Stalling95] D. Stalling and H-C. Hege. \"Fast and Independent Line Integral Convolution.\" In Proceedings of SIGGRAPH '95. pp. 249-256, Addison-Wesley, Reading, MA, 1995.

              [Turk92] G. Turk. \"Re-Tiling of Polygonal Surfaces.\" Computer Graphics (SIGGRAPH '92). 26(2):55-64, July 1992.

              [vanWijk93] J. J. van Wijk. \"Flow Visualization with Surface Particles.\" IEEE Computer Graphics and Applications. 13(4):18-24, 1993.

              [Wang90] S-L C. Wang and J. Staudhammer. \"Visibility Determination on Projected Grid Surfaces.\" IEEE Computer Graphics and Applications. 10(4):36-43, 1990.

              [Watson81] D. F. Watson. \"Computing the n-Dimensional Delaunay Tessellation with Application to Voronoi Polytopes.\" The Computer Journal. 24(2):167-172, 1981.

              [Wixom78] J. Wixom and W. J. Gordon. \"On Shepard's Method of Metric Interpolation to Scattered Bivariate and Multivariate Data.\" Math. Comp. 32:253-264, 1978.

              [Yamrom95] B. Yamrom and K. M. Martin. \"Vector Field Animation with Texture Maps.\" IEEE Computer Graphics and Applications. 15(2):22-24, 1995.

              "},{"location":"VTKBook/09Chapter9/#99-exercises","title":"9.9 Exercises","text":"

              9.1 Describe an approach to adapt dividing cubes to other 3D cell types. Can your method be adapted to 1D and 2D cells?

              9.2 Discuss the advantages and disadvantages of representing surfaces with points versus polygons.

              9.3 Streamribbons can be constructed by either i) connecting two adjacent streamlines with a surface, or ii) placing a ribbon on the streamline and orienting the surface according to streamwise vorticity vector. Discuss the differences in the resulting visualization.

              9.4 Write the following programs to visualize velocity flow in the combustor. a) Use vtkProbeFilter and vtkHedgeHog.

              b) Use vtkProbeFilter and vtkStreamLine.

              c) Use vtkProbeFilter and vtkWarpVector.

              d) Use vtkProbeFilter and vtkVectorNorm.

              e) Use vtkProbeFilter and vtkVectorDot.

              9.5 Describe a method to extract geometry using an arbitrary dataset. (That is, extract geometry that lies within the culling dataset.) (Hint: how would you evaluate in/out of points?)

              9.6 The filter vtkPolyDataNormals is often used in combination with the filters vtkSmoothPolyData and vtkContourFilter to generate smooth isosurfaces.

              a) Write a class to combine these three filters into one filter. Can you eliminate intermediate storage?

              b) How much error does vtkSmoothPolyData introduce into the isosurface? Can you think of a way to limit the error?

              c) What is the difference between the surface normals created by vtkMarchingCubes and vtkPolyDataNormals?

              9.7 Assume that we have a database consisting of interest rate R, monthly payment P, monthly income I, and days payment is late L.

              a) If R, P, I are all sampled regularly, how would you visualize this data?

              b) If all data is irregularly sampled, list three methods to visualize it.

              9.8 Why do you think triangle strips are often faster to render than general polygons?

              9.9 The normal generation technique described in this chapter creates consistently oriented surface normals.

              a) Do the normals point inside or outside of a closed surface?

              b) Describe a technique to orient normals so that they point out of a closed surface. c) Can surface normals be used to eliminate visible triangles prior to rendering? (Hint: what is the relationship between camera view and surface normal?)

              9.10 Describe a technique to partially threshold a cell (i.e., to cut a cell as necessary to satisfy threshold criterion). Can an approach similar to marching cubes be used?

              9.11 The class vtkRendererSource allows us to use the rendered image as a texture map (or image data dataset). Write a program to construct iterated textures, that is textures that consist of repeated images. Can the same image be generated using texture coordinates?

              9.12 Describe how you would modify the decimation algorithm to treat general polygons.

              9.13 Several examples in the text (e.g., deciFran.tcl and deciHawa.tcl) use the class vtkDecimate. Modify these examples to use the topology modifying progressive decimation algorithm (implemented in vtkDecimatePro). How much greater reduction can you achieve?

              "},{"location":"VTKBook/10Chapter10/","title":"Chapter 10 - Image Processing","text":"

              In this chapter we describe the image processing components of the Visualization Toolkit. The focus is on key representational ideas, pipeline issues such as data streaming, and useful algorithms for improving the appearance and effectiveness of image data visualizations.

              "},{"location":"VTKBook/10Chapter10/#101-introduction","title":"10.1 Introduction","text":"

              Image processing has been a mainstay of computing since the advent of the digital computer. Early efforts focused on improving image content for human interpretation. More recently image processing has been utilized by practitioners of computer vision, the goal being the processing of image data for autonomous machine perception [Gonzalez92]. From the perspective of data visualization, image processing is used to manipulate image content to improve the results of subsequent processing and interpretation. For example, a CT or MRI scan may generate spurious signal noise or require image segmentation. Using the techniques of image processing, noise can be removed and automatic and semi-automatic segmentation can be performed on a slice by slice (i.e., image by image basis). As a result, isosurface generation, volume rendering, and other 3D techniques can be improved in appearance, accuracy, and effectiveness by applying techniques from image processing.

              Since the focus of this text is on 3D graphics and visualization, this chapter treats image processing in a limited way. However, we would like to emphasize the interrelationship of image processing, computer graphics, and visualization. Often texts and courses treat these as distinctly separate disciplines, when in fact they are closely related (see \"Imaging, Computer Graphics, and Visualization\" in Chapter 1).

              The material presented here was selected to demonstrate a number of important points. First, the data flow or pipeline approach presented earlier is directly applicable to image processing, with the added benefit that we can easily implement data streaming and caching due to the regular nature of image data. Second, image processing algorithms can improve the results of visualization. We will show this through a number of useful examples. And finally, from a practical point of view, we wanted to demonstrate a system architecture that includes imaging, graphics, and visualization.

              "},{"location":"VTKBook/10Chapter10/#102-data-representation","title":"10.2 Data Representation","text":"

              In this section we will briefly describe the data representation behind the imaging pipeline. As we saw earlier (in \"The Dataset\" in Chapter 5), a dataset consists of both a structure (topology and geometry) and data attributes. Although in principle an image can be represented as a image data dataset, the special nature of image processing suggests a more complex representation, as we will soon see.

              An image is typically used to refer to a 2D structured point dataset. More generally, in this chapter we will define an image as consisting of up to four dimensions: three spatial dimensions x, y, and z, and time t. The reason we add the time dimension is that images are frequently generated as a time series, and we often wish to access the data along the time axis. For example, we may plot the value at a point as a function of time.

              As described in \"Image Data\" in Chapter 5, an image has both regular topology and geometry. The regularity of the data lends itself to many special operations. In particular, we can support data caching and streaming, and operating on regions of interest in the data.

              "},{"location":"VTKBook/10Chapter10/#regions-of-interest","title":"Regions of Interest","text":"

              When data has a regular spatial organization, it is possible to request the data in pieces or regions of interest. For example, a mapper may need only a region of the data for its display, so loading or processing the whole dataset would be inefficient. An example of this is a two-dimensional viewer that displays only one slice of a large structured volume. By loading slices only as they are needed, disk access can be reduced, and memory conserved.

              Although regions of interest can have arbitrary shapes, the regular structure of the data samples determines optimal region configurations. An image stored in a Cartesian coordinate system easily divides into smaller rectangular regions, while data sampled on a polar coordinate grid is best divided into pie-shaped regions (Figure 10-1). Therefore, operating on regions of data means that we process \"windows\" of data specified by (min,max) ranges of each dimension, or axis. For example, a region in a 2D image of dimensions 100 x 100 might be specified as (25,49, 0,49), meaning that we would operate on a (25 x 50) window. Figure 10-1. Axis aligned matrices naturally lend themselves to rectangular regions, and polar coordinate grids to pie-shaped regions."},{"location":"VTKBook/10Chapter10/#streaming-and-caching","title":"Streaming and Caching","text":"

              The disadvantage of processing regions of interest is that the same data may be read and processed multiple times. If the viewer described above needs to cine (i.e., loop) through the slices, or interactively pan around a large image, it would be beneficial to have all the data loaded at once.

              A compromise between the two extreme approaches of maintaining all data in memory or operating on small pieces is to update regions larger than requested, but not as large as the whole image. This is referred to as a data cache. Data caching anticipates future requests and works well in most cases. However, it breaks down when there is little or no coherence between subsequent requests.

              With the region-processing model, the data objects can be thought of as caches that hold any number of regions. There are numerous caching strategies for saving and releasing regions that can be quite complex. The simplest strategy saves only a single region at any one time. If subsequent requests are completely contained in the cached region, no further processing is required. An alternative strategy might divide an image into tiled regions of all the same size. When a region larger than the tile is requested, multiple tiles are updated to cover the region. When designing a caching strategy, it is important to consider the overhead of copying data to change its format. Some of the advantages of complex strategies are lost when all the factors are considered.

              Given the ability to operate on regions of data, it is a small step to stream operations on a whole dataset. Streaming is the process of pulling regions of data in a continual flow through the pipeline. For instance, a pixel histogram mapper could request single pixels as it accumulates values in its bins. Large datasets can be processed in this manner without ever having to load more than a few pixels at a time. If multiple processors are available, region processing can also be used to split a task into multiple pieces for load balancing and faster execution.

              "},{"location":"VTKBook/10Chapter10/#attribute-data-and-components","title":"Attribute Data and Components","text":"

              Unlike visualization algorithms that may generate normals, vectors, tensors, and texture coordinates, image processing algorithms generally process attribute data consisting of scalar data. Often the data is a single component (e.g., a gray-scale image), but frequently color images (three components of RGB, for example) may also be processed.

              In the Visualization Toolkit imaging pipeline, attribute data is represented as n-dimensional component data. Refer to \"Putting It All Together\" to see the implementation details for component data, regions of interest, streaming, and caching.

              "},{"location":"VTKBook/10Chapter10/#103-algorithms","title":"10.3 Algorithms","text":"

              This section provides an overview and examples for important image processing algorithms. The importance of the algorithms is measured on their relevance to 3D data visualization. Topics include: removing noise, smoothing, reducing sampling artifacts, image enhancement, segmentation, and morphological operators such as erosion and dilation.

              "},{"location":"VTKBook/10Chapter10/#image-restoration","title":"Image Restoration","text":"

              Noise and other artifacts are inherent in all methods of data acquisition. Since artifacts can degrade the visual appearance and analysis of images, the first step of image processing is often restoration. Knowledge of the statistical properties of artifacts allows filters to selectively remove them with minimal impact on the underlying data. For example, most of the power of typical images lie in low frequencies, while white noise is evenly distributed across the frequency spectrum. In this situation, low-pass filters eliminate much of the noise, but leave most of the image intact.

              A simple implementation of a low-pass smoothing filter is convolution with a kernel with all positive values. The typical kernels used for smoothing are either constant across a circular neighborhood, or have a Gaussian profile (see Figure 10-2). Gaussian smoothing results in better-looking images than smoothing with constant kernels, but can be more computationally expensive because of the large kernel size necessary to capture the Gaussian profile. Smoothing becomes even more expensive when it is generalized to three-dimensional datasets, and three-dimensional kernels.

              One way to speed Gaussian smoothing is to decompose the filter into two 1D convolutions. Since the 2D Gaussian function is separable,

              \\begin{equation*} g(i, j) = \\frac{1}{2\\pi \\sigma^2} \\exp\\left(-\\frac{i^2 + j^2}{2\\sigma^2} \\right) = \\frac{1}{\\sqrt{2\\pi}\\sigma} \\exp\\left(-\\frac{i^2}{2\\sigma^2} \\right) \\frac{1}{\\sqrt{2\\pi}\\sigma} \\exp\\left(-\\frac{j^2}{2\\sigma^2} \\right) \\end{equation*} \\bf\\tag{10-1}

              smoothing along the x axis and then along the y axis with 1D Gaussian kernels is equivalent to convolving with a 2D Gaussian kernel. It is also possible to approximate Gaussian smoothing by convolving with a constant binary kernel multiple times.

              Figure 10-2. Low-pass filters can be implemented as convolution with a Gaussian kernel. The Gaussian kernel displayed on top has been magnified for this figure. See GaussianSmooth.cxx and GaussianSmooth.py."},{"location":"VTKBook/10Chapter10/#nonlinear-smoothing","title":"Nonlinear Smoothing","text":"

              One problem with simple smoothing to remove noise is that edges are blurred. Although high frequencies make up a small part of images, the human visual system is acutely sensitive to high frequencies in the spatial form of edges. In fact, most of the low frequencies in an image are discarded by the visual system before it even leaves the retina. One approach to smoothing that preserves edges is anisotropic diffusion. This filter smoothes relatively flat regions of an image, but does not diffuse across abrupt transitions. The diffusion is iterated until the desired level of noise reduction is reached. Two possible diffusion criteria are: Diffuse only when the gradient magnitude is below a specified value, or diffuse two pixels only when the difference between the pixels is lower than a specified constant. A median filter also smoothes while preserving edges. This filter replaces each pixel with the median value of the scalar values in a neighborhood centered on the pixel. Median filters are most effective on high amplitude noise that has a low probability of occurring (see Figure 10-3). There are two ways to control the amount and scale of noise removed: The size of the neighborhood can be varied, or the filter can be applied multiple times. This median filter preserves edges; however, it does round corners and remove thin lines. The hybrid median filter was developed to address this behavior. It operates on a 5 x 5 neighborhood around each pixel. The algorithm consists of two steps: first the median values of an \"x\"-shaped and \"+\"-shaped neighborhoods are computed, then the median of these two values and the center-pixel value is computed to give the final result. The hybrid median has a fixed size neighborhood, but can be applied multiple times to further reduce noise (Figure 10-4). Figure 10-3. Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise. See MedianComparison.cxx and MedianComparison.py."},{"location":"VTKBook/10Chapter10/#low-frequency-artifacts","title":"Low Frequency Artifacts","text":"

              An artifact called aliasing occurs when sub-sampling and is often associated with stair-stepping edges. Sampling theory proves that discrete sampled signals with spacing S, completely describe continuous functions composed of frequencies less than S/2. When a signal is subsamples, its capacity to hold high frequency information is reduced. However, the high frequency energy does not disappear. It wraps around the frequency spectrum appearing as a low frequency alias artifact (Figure 10-5). The solution, which eliminates this artifact, is to low-pass filter before sub-sampling. Low-pass smoothing reduces the high frequency range of an image that would cause aliasing.

              The same aliasing phenomena occurs when acquiring data. If a signal from an analog source contains high frequencies, saving the analog data in a discrete form requires sub-sampling that will introduce alias artifacts. For this reason, it is common practice to acquire data at high resolutions, then smooth and subsample to reduce the image to a manageable size.

              Figure 10-4. Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter. The lower patterns represent the three neighborhoods used to compute the hybrid median. See HybridMedianComparison.cxx and HybridMedianComparison.py.

              Low-frequency artifacts, other than aliasing, can also occur when acquiring data. One example is base-line drift. As data is acquired over time, the average value (base line) of the signal can slowly change. This drift can be removed with a high-pass filter after data acquisition. It is also possible to acquire a second dataset that isolates the baseline. Subtracting the baseline from the primary signal removes the drift artifact. In general, it is better to measure the artifact than risk making wrong assumptions that might adversely affect the actual data.

              Figure 10-5. This figure demonstrates aliasing that occurs when a high-frequency signal is subsamples. High frequencies appear as low frequency artifacts. The lower left image is an isosurface of a skull after sub-sampling. The right image used a low-pass filter before sub-sampling to reduce aliasing. See IsoSubsample.cxx and IsoSubsample.py.

              Another gradual change across an image is caused by sensor position. The amplitude of a measured signal usually attenuates as the source moves away from the sensor. An example of this attenuation artifact is seen in surface-coil-MRI images as shown in Figure 10-6. If the attenuation profile is known, then the artifact can be removed by dividing the original data with the profile. Since this artifact can be characterized by a small set of parameters like sensor position and range, it is possible to automatically determine the attenuation profile from the data. Like most artifacts, nonuniform attenuation tends to hide the information in an image. Given a function that measures the amount of information in an image, gradient descent and other search strategies can find the optimal attenuation parameters."},{"location":"VTKBook/10Chapter10/#image-enhancement","title":"Image Enhancement","text":"

              Often datasets contain information or have dynamic range that cannot be completely displayed in a single image. X-Ray Computed Tomography (CT) datasets, for example, can have 10 times the scalar resolution of the typical computer monitor capable of displaying 256 shades of gray. One method used for conveying information buried in the large dynamic range of these medical datasets is to allow a user to interactively set the color map with a window-level transfer function. The user can then choose to display the range of data they find most important as shown in Figure 10-7. The slope of the transfer function determines the amount of contrast in the final image. Slopes greater than one increase contrast, and slopes less than one decrease contrast. All contrast and information is lost in the scalar ranges where the transfer function is constant and has zero slope. Figure 10-6. This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually. This histograms shows how the artifact hides information in the form of scalar value clusters. See Attenuation.cxx and Attenuation.py.

              The short fall of simple window-level transfer functions are their limited shape. More general nonlinear transfer functions can be more appropriate for certain datasets. One example is the logarithmic transfer function, f(x) = K log ( 1 + x ) , which can be used to display image power spectrums (Figure 10-10). Most of the pixels in the power spectrum represent high frequencies, and have small values. However the smaller population of low-frequency pixels often have large values. The logarithmic function has the largest slope near zero, and therefore leaves the most contrast for pixels with small values. However, when the constant K is chosen correctly, none of the large pixel values become completely saturated.

              To take advantage of all the available display contrast, images should have a uniform distribution of intensities. For continuous images, this intensity distribution is called the probability density function (PDF). For discretely-sampled images with discrete scalar values, the image histogram has the same information as the PDF (Figure 10-7). A histogram breaks the scalar range of an image into discrete non-overlapping bins. Each bin has a pixel count that represents the number of pixels whose scalar value falls in that bin's range.

              To achieve the goal of a uniform scalar histogram, transfer functions can be used to spread out clusters in the histogram and compress scalar ranges that are under-represented in the image. To maintain the general appearance of the image, the transfer function should be monotonically increasing so that the brightness relation is maintained. To spread out clusters in the histogram, the slope of the transfer function should be large where the scalar densities are the highest, and the slope should be small in empty regions of the histogram.

              Figure 10-7. The top charts show two window-level transfer functions. The resulting images are displayed in the middle row. The bottom row shows image histograms of the images.

              Histogram equalization is an algorithm that automatically generates a tailored transfer function to increase contrast in an image. For continuous images, the transfer function is simply the cumulative distribution function (CDF) which is defined as the integral of the PDF. By definition, the CDF function has a large slope where the PDF has the largest value, and therefore gives the greatest contrast to scalar ranges that occur most frequently in an image. The result of using the CDF as a transfer function is an image with an ideal constant scalar distribution. For discrete images and image histograms, a discrete version of the CDF function can be used. However, because of the discrete approximation, the resulting image is not guaranteed to have a constant histogram (Figure 10-8). Figure 10-8. Histogram equalization automatically computes a transfer function that produces an image with a nearly constant scalar histogram.

              High-pass filters can also be used to compress the range of an image. Since low frequencies account for much of the dynamic range of an image but carry little information, a high-pass filter can significantly decrease an image's scalar range and emphasize hidden details. The Laplacian filter, which is a second derivative operation, is one implementation of a high-pass filter. It eliminates constant and low frequencies leaving only high-frequency edges. The output of the Laplacian can be subtracted from the original image to produce edge enhancement or sharpening of an image (Figure 10-9)."},{"location":"VTKBook/10Chapter10/#frequency-domain","title":"Frequency Domain","text":"

              The Fourier transform belongs to a class of filters that fundamentally change the representation of an image without changing its information. The output of the Fourier transform is in the frequency domain. Each pixel is a complex number describing the contribution of a sinusoidal function to the original image. The magnitude of the pixel encodes the amplitude of the sinusoid, and the orientation of the complex pixel encodes the sinusoid's phase. Each pixel represents a sinusoid with different orientation and frequency. The reverse Fourier transform converts a frequency domain image back to the original spatial domain (Figure 10-10).

              Low-pass and high-pass filtering become trivial in the frequency domain. A portion of the pixels are simply masked or attenuated. Figure 10-11 shows a high pass Butterworth filter that attenuates the frequency domain image with the function H \\begin{equation*} H(u, v) = \\frac{1}{1 + \\left(\\frac{C^2}{u^2 + v^2}\\right)^n} \\end{equation*} \\bf\\tag{10-2} Figure 10-9. High-pass filters can extract and enhance edges in an image. Subtraction of the Laplacian (middle) from the original image (left) results in edge enhancement or a sharpening operation (right). See EnhanceEdges.cxx and EnhanceEdges.py.

              The gradual attenuation of the filter is important. The ideal high-pass filter, shown in the same figure, simply masks a set of pixels in the frequency domain. The abrupt transition causes a ringing effect in the spatial domain (as the figure illustrates).

              Although any filter that operates in the frequency domain can also be implemented in the spatial domain, some operations are less computationally expensive and easier to implement in the frequency domain. To perform similar filtering of Figure 10-11 in the spatial domain would require convolution with a large kernel and would be slow. In general, convolution with large kernels is more efficient when performed in the frequency domain. Multiplication, \\alpha \\beta, in the frequency domain, is equivalent to convolution, a * b , in the spatial domain (and vice versa). In these equations, \\alpha is the Fourier transform of a, and \\beta is the Fourier transform of b. Figure 10-10. The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This figure show an image and its power spectrum displayed using a logarithmic transfer function. See VTKSpectrum.cxx and VTKSpectrum.py.

              In order to make frequency-domain processing feasible, it is first necessary to minimize the cost of transforming from the spatial to frequency domain and back. There exist fast algorithms that implement the Fourier transform and its inverse. First, the Fourier transform is decomposable, so a 2D transform can be implemented by first taking the 1D Fourier transform of all the rows, and then taking the Fourier transform of all the columns of an image. Second, the complexity of one-dimensional Fourier transforms can be reduced with an algorithm called the fast Fourier transform (FFT). It works by recursively factoring the number samples, N, into its prime components. If N is prime and not factorable, then the transform is completed in one step that is order O(N^2) complexity. If N is divisible by two, the array of numbers is divided into two parts that are transformed separately and then combined. If N is a power of two, then the algorithm executes in order O(N \\log N) time.

              Figure 10-11. This figure shows two high-pass filters in the frequency domain. The Butterworth high-pass filter has a gradual attenuation that avoids ringing produced by the ideal high-pass filter with an abrupt transition. See IdealHighPass.cxx and IdealHighPass.py.

              For this reason, it is more efficient to process images with sizes that are powers of two (e.g., 512 x 512) than other sized images. For non-power of two images it may be faster to pad the image to a size that is a power of two size before processing.

              An important point about the discrete Fourier transform is that it treats the image as a periodic function. This means the pixels on the right border are adjacent to pixels on the left border. Since there is usually no physical relationship between these pixels, the artificial horizontal and vertical edges can distort the frequency spectrum and subsequent processing. To reduce these artifacts, the original image can be multiplied by a window function that becomes zero at the borders. Another approach removes these artificial edges by smoothing only along the borders.

              In both of these approaches, a portion of the original image is lost, so only the central portion of an image can be processed. If this is unacceptable, another solution is to double the dimensions of the original image with a mirror-padding filter. The intermediate image is periodic and continuous (Figure 10-12)."},{"location":"VTKBook/10Chapter10/#image-segmentation","title":"Image Segmentation","text":"

              Segmentation is the process of classifying pixels in an image or volume. It can be one of the most difficult tasks in the visualization process. One form of segmentation takes an image as input, and outputs a map that contains a classification for each pixel. The output of such a segmentation filter usually has binary or discrete values for each pixel; however, it is also possible to output a fuzzy classification where the pixel's scalar value represents a measure of confidence in the classification.

              A simple example of a one-parameter segmentation is a threshold filter used to mark bone in a CT dataset. Since bone has the largest scalar value, it is easy to select a threshold that separates bone from the rest of the image.

              Figure 10-12. Convolution in frequency space treats the image as a periodic function. A large kernel can pick up features from both sides of the image. The lower-left image has been padded with zeros to eliminate wraparound during convolution. On the right, mirror padding has been used to remove artificial edges introduced by borders. See Pad.cxx and Pad.py.

              For other tissues and other imaging modalities, segmentation is usually more difficult. Noise in the image and overlapping scalar values of tissues can decrease the effectiveness of simple threshold segmentation. By using two parameters, the threshold can segment pixels with a range of scalar values. The extra parameter allows more control over the resulting segmentation, but also doubles the complexity of selecting the parameters.

              Images can be pre-processed to segment images based on more complex features such as textures. Sometimes textures in tissues add information useful for segmentation. Texture sensitive filters like Laplacian and gradient magnitude can discriminate between different textures. Additional filters that can be used for texture segmentation are the range, variance, and correlation filters. The range filter simply reports the difference between the maximum and minimum values in a neighborhood around each pixel, and the variance filter computes the variance of the neighborhood pixels relative to the **center pixel.

              Figure 10-13 shows an example of how a correlation filter can be used for segmentation. A correlation filter is similar to convolution. The kernel is shifted across the image, and for each location the dot product between the image and the kernel gives a measure of correlation between the two. The output of the correlation filter is large everywhere the pattern occurs in the image, but small at other locations. Because the resulting map is sparse, additional post-processing is required to find a uniform, segmented region. In this example, dilation followed by erosion was used to close the gaps between the patterns. (Dilations and erosion are discussed in the next section.)"},{"location":"VTKBook/10Chapter10/#post-processing","title":"Post-processing","text":"

              Although preprocessing can do a lot to improve segmentation results, post-processing can also be useful. Morphological filters, which operate on binary or discrete images, can be useful for manipulating the shape of the segmented regions. In this brief discussion we will only consider operations that use circular footprints, even though these morphological filters can be defined much more generally. Erosion is implemented by removing pixels within a specified distance of a border. For each pixel not in the segmented region, all the neighbors in a circular region around the pixels are turned off. This erosion filter shrinks the segmented region and small isolated regions disappear.

              Figure 10-13. A pipeline containing correlation, thresholding, dilation, and erosion is used here to segment a region composed of \"C\"s. The left image shows the original image. The right image shows the segmented region superimposed on the original image. Figure 10-14. This figure demonstrates various binary filters that can alter the shape of segmented regions. See MorphologyComparison.cxx and MorphologyComparison.py.

              The opposite of erosion is dilation. This filter grows the area of segmented regions. Small holes in the segmented region are completely closed. Any pixel not in the segmented region but near the region is turned on. Dilation and erosion are dual filters with nearly identical implementations. Dilating the \"on\" pixels is equivalent to eroding \"off\" pixels in a binary image (see Figure 10-14).

              Closing is the serial application of first dilation and then erosion. When an image is dilated small holes in the map disappear. However, dilation alone also grows the boundaries of the segmented regions. When dilation is followed by erosion in a closing operation, small holes are removed; however, the boundary of the segmented regions remain in the same general location. Opening is the dual of closing. Opening removes small islands of pixels. It is implemented with an initial erosion, followed by a dilation.

              Connectivity filters can also remove small regions without affecting the remaining boundaries of segmented regions. This set of filters separate the segmented pixels into equivalence classes based on a neighbor relation. Two pixels belong to the same class if they are touching. There are two common neighbor relations in two-dimensional images: four connectivity considers pixels neighbors if they are edge neighbors, and eight connectivity considers pixels neighbors if pixels share any vertex.

              After the pixels have been assigned an equivalence class, various methods are used to determine which groups of pixels will pass through the filter, and which classes will be eliminated. The island-removal filter is a connectivity filter that removes groups that have too few pixels. Seed connectivity allows the user to explicitly specify which groups will pass through the filter. The user or application specifies a set of seeds. Any group that includes a seed makes it through the filter. Groups that do not contain seeds are removed. This filter is similar to the seed-connectivity filter; however, the seeds are supplied in a second image. First the intersection between the segmented image and the seed image is taken. Each remaining pixel is then added to a set of seeds.

              "},{"location":"VTKBook/10Chapter10/#multispectral-segmentation","title":"Multispectral Segmentation","text":"

              From everyday experience we know that it is easier to see structure and information in color images than in gray-scale images. This is because each pixel contains more information in the red, blue, and green components than a single component gray-scale pixel. One way to segment multispectral images is to separate the components and threshold them individually and then combine the resulting binary images with logic filters. This allows selection of rectangular patched areas in the color/ component space of the pixels.

              By using multiple thresholds combined with multiple levels of logic filters, it is possible to specify arbitrary areas in the component's space for segmentation. However, it can be easier and more efficient to transform the components into a different coordinate system before the threshold operation. The simplest example of this is to threshold a projection of the components. This is equivalent to a threshold after performing a dot product between the components of a pixel and a constant-direction vector. This divides the component space into two areas separated by a hyperplane.

              Another example of a coordinate transformation is conversion from red, green, blue (RGB) color component to hue, saturation, value (HSV) representation (see \"Color\" in Chapter 3. Segmentation of images based on hue and color saturation is difficult in RGB space, but trivial in HSV space.

              Color is not the only multispectral information that can be used for segmentation. It is possible to take advantage of multispectral segmentation even if the original dataset has only one component. Additional images can be created from spatial information of the images using spatial filters. These multiple images can then be combined into one multicomponent image, then multicomponent segmentation can proceed.

              Typically, the number of free parameters in a filter is directly correlated to the dimensionality of the pixels; and although additional parameters make a filter more powerful, it also makes it more difficult to find an appropriate set of parameter values. There are supervised and unsupervised algorithms that can be used to automatically select the best set of segmentation parameters, but discussion of these is outside the scope of this book.

              "},{"location":"VTKBook/10Chapter10/#104-putting-it-all-together","title":"10.4 Putting It All Together","text":"

              We suggest that you review the code accompanying the images in this chapter to see how to use the VTK imaging pipeline. In this section we will explain some of the implementation details of image data. We will also show how to mix the imaging and visualization pipelines, and how to use imaging filters to perform regression testing.

              "},{"location":"VTKBook/10Chapter10/#data-representation","title":"Data Representation","text":"

              In the imaging pipeline, the class for representing and manipulating data is vtkImageData (\"Types of Datasets\" in Chapter 5 for more information). In addition, the data extent (topological extent specification) plays a vital role in controlling how images are processed.

              vtkImageData actually represents the image data. Internally, it refers to an instance of vtkDataArray. Therefore, its native representation data type may be any one of unsigned char, char, unsigned short, short, int, float, or any concrete type of vtkDataArray. Please remember that vtkImageData can represent 1D, 2D (image), and 3D (volume) data.

              There are three types of data extents in the imaging pipeline. In general, any rectangular piece of image data can be described by the extent six-vector (imin,imax, jmin,jmax, kmin,kmax). The WholeExtent refers to the original data size of an image and is derived from the image dimensions. The UpdateExtent is the extent that is processed by a particular filter during execution.

              Extents are used to manage the streaming of data through the visualization pipeline, as well as to coordinate the multi-threaded parallel processing that the imaging pipeline uses throughout. By controlling the extents, it is possible to greatly reduce the amount of memory used by the pipeline. For more information, see The VTK User's Guide sold by Kitware.

              In the VTK imaging pipeline, point attribute data is represented differently than in the visualization pipeline. In the imaging pipeline point attribute data is represented as n components per data point. Typically n is one for gray-scale data, or three for color data but, in general, can be any positive number.

              "},{"location":"VTKBook/10Chapter10/#create-an-image","title":"Create an Image","text":"

              This example demonstrates how to directly create an image using C++ code. Typically, you will use an image reader or procedurally create an image from a source object. The example shown here creates an vtkImageData and then fills it with an image of interfering sinusoidal grids

              \\begin{equation*} F(x, y) = \\sin\\left(\\frac{x}{10}\\right) + \\sin\\left(\\frac{y}{10}\\right) \\end{equation*} \\bf\\tag{10-3}
              Image Processing\n         int x, y;\n vtkImageData *image;\nimage = vtkImageData::New(); image->SetDimensions(256, 256, 1); image->SetScalarTypeToFloat(); image->AllocateScalars();\nfloat *ptr = static_cast<float*>(image->GetScalarPointer());\nfor (y = 0; y < 256; ++y) {\nfor (x = 0; x < 256; ++x) {\n*ptr++ = 10.0 * sin(0.1 * x) * sin(0.1 * y);\n} }\nvtkImageViewer *viewer = vtkImageViewer::New(); viewer->SetInput(image); viewer->SetColorWindow(20.0); viewer->SetColorLevel(0.0);\nviewer->Render();\n
              Figure 10-15. Creating an image of two interfering sinusoidal gratings in an image dataset. The resulting image has dimensions 256^2.

              Note that direct pointer access is used to fill the image. The AllocateScalars() method allocates enough memory for the dimensions provided.

              "},{"location":"VTKBook/10Chapter10/#gradient-magnitude","title":"Gradient Magnitude","text":"

              In this example we demonstrate a lengthy imaging pipeline. The basic purpose of the pipeline is to visualize information about the image gradient. The gradient direction and magnitude are mapped into the hue and saturation components of the color HSV space, respectively. The pipeline, resulting image, and a portion of the code are shown in Figure 10-16.

              The pipeline demonstrates some interesting tricks. The first three filters read CT data of the human head (i.e., using vtkImageReader), magnify the image by a factor of four (vtkImageMagnify), and then smooth the data (since magnification uses linear interpolation, introducing some sharp edges). The next filter actually computes the 2D gradient (vtkImageGradient), placing the x-y gradient components into its output.

              The next series of filters is where the fun begins. First, the data is converted to polar coordinates (vtkImageEuclideanToPolar). We use this filter because we want to operate in color HSV space (see \"Color\" in Chapter 3). The image magnitude is to be mapped into saturation value, while the gradient direction is mapped into hue value (remember hue is represented as an angle on the HSV color wheel). The filter vtkImageConstantPad is used to add a third component to the data, since the gradient filter only generated two components, and we need three components to represent color. The vtkImageExtractComponents is used to rearrange the components into HSV order. Finally, the data is converted back into RGB color space with vtkImageHSVToRGB. (This is necessary because the image viewer expects RGB values.)

              "},{"location":"VTKBook/10Chapter10/#image-warping","title":"Image Warping","text":"

              In this example we combine the imaging and visualization pipelines. Imaging filters are used to read in an image (vtkBMPReader) and then convert it to grayscale (vtkImageLuminance). The data, which is a image data dataset, is then passed down the visualization pipeline as polygons using vtkImageDataGeometryFilter. Next we warp the data in the direction perpendicular to the image plane using the visualization filter vtkWarpScalar. The vtkMergeFilter is used to combine the warped geometry (now vtkPolyData) with the original image data from the reader. (Note that in this example the vtkMergeFilter takes two inputs.) The pipeline, example output, and sample code are shown in Figure 10-17."},{"location":"VTKBook/10Chapter10/#regression-testing","title":"Regression Testing","text":"

              In our work with VTK, we often need to perform software testing. The testing may be necessary because we have added new classes or features to the system, modified old code, or are simply testing a graphics library or new piece of hardware. We use a powerful testing procedure based on processing the output of the system, which is typically an image. We refer to the testing process as regression testing.

              Regression testing is based on the following procedure. A test program (typically a Tcl/Tk script) is written that exercises a portion of the code. In our example, we will assume that we are testing a feature of implicit modelling. The output of the script is an image with a fixed view, as shown in Figure 10-18(a). To perform the test, we compare the output of the test program with a previously stored image, or \"valid\" image (Figure 10-18(b)). The valid image was generated when we initially created the object or objects to be tested, and is assumed to be the correct output. Then, we use a the filter vtkImageDifference to compare the test image with the valid image. This filter takes into account dithering and anti-aliasing effects, and creates an output image representing the difference between the test image and valid image (Figure 10-18(c)). It also reports the difference in the images in terms of a pixel count. To determine whether the test is passed, we compare the pixel count with a threshold value (for example, 10 pixels).

              Our regression testing procedure cannot test the original implementation of an object or objects. The developer must verify that the valid image is indeed correct. However, the process is invaluable for finding and correcting problems due to incremental code changes (e.g., bug fixes, enhancements, etc.) Furthermore, the test can be run as a batch process, with a simple pass/fail output, and an image to show the differences.

              Figure 10-16. An imaging pipeline to visualize gradient information. The gradient direction is mapped into color hue value while the gradient magnitude is mapped into the color saturation. See ImageGradient.cxx and ImageGradient.py. Figure 10-17. Combining the imaging and visualization pipelines to deform an image in the z-direction. The vtkMergeFilter is used to combine the warped surface with the original color data. See ImageWarp.cxx and ImageWarp.py. Figure 10-18. Software regression testing using image processing. A test image is taken from the renderer and compared with a valid image stored on disk. (a) shows the valid image. (b) shows the test image (artificially modified by slight camera rotation). (c) shows the image difference. The code fragment above is extracted from the regression testing procedure."},{"location":"VTKBook/10Chapter10/#105-chapter-summary","title":"10.5 Chapter Summary","text":"

              Image processing can be used to improve 3D visualizations of structured point datasets (images and volumes). Important techniques include smoothing, filtering, morphological operators such as erosion and dilation, and segmentation.

              Because of the regular topology and geometry of images, it is possible to design caching and streaming pipelines to reduce memory requirements. In the Visualization Toolkit, the imaging pipeline is integrated with the visualization pipeline. This capability enables the creation of applications that combine computer graphics, imaging, and visualization.

              "},{"location":"VTKBook/10Chapter10/#106-bibliographic-notes","title":"10.6 Bibliographic Notes","text":"

              Many books are available describing imaging algorithms. Several are listed below including [Gonzalez92] and [Russ95]. The texts [Pavlidis82] and [Wolberg90] are imaging books with somewhat of a computer graphics and/or visualization slant. The text [Robb95] is an outstanding reference for medical imaging and visualization.

              If image processing, segmentation, and/or registration are important to you, we highly recommend the Insight Segmentation and Registration Toolkit (ITK). Like VTK, ITK is open source and includes extensive documentation resources and examples. Visit www.itk.org for more information. Also, [Ibanez03] is a good reference.

              Technical references describing VTK's unique streaming visualization pipeline are available [Law99] [Martin01]. Using this approach, data sizes of approximately a petabyte in size have been processed.

              "},{"location":"VTKBook/10Chapter10/#107-references","title":"10.7 References","text":"

              [Ballard82] D. H. Ballard, C. M. Brown. Compute Vision. Prentice Hall, Inc., Englewood Cliffs, NJ, 1982.

              [Davies97] E. R. Davies. Machine Vision Theory Algorithms Practicalities 2d ed. Academic Press, San Diego, CA, 1997.

              [Gonzalez92] R. C. Gonzalez, R. E. Woods. Digital Imaging Processing. Addison-Wesley Publishing Co., Reading, MA, 1992.

              [Ibanez03] L. Ibanez, W. Schroeder, L. Ng, J. Cates. The ITK Software Guide. Kitware, Inc. ISBN 1-93093410-6.

              [Law99] C. Charles Law, K. M. Martin, W. J. Schroeder, J. E. Temkin. A Multi-Threaded Streaming Pipeline Architecture for Large Structured Data Sets. In Proceedings. of Visualization '99, IEEE, October 1999.

              [Martin01] K. M. Martin, B. Geveci, J. Ahrens, C. Law. Large Scale Data Visualization Using Parallel Data Streaming. IEEE Computer Graphics & Applications, July 2001.

              Figure 10-19. Sample image for segmentation exercise

              [Niblack86] W. Niblack. An Introduction to Digital Image Processing. Prentice Hall, Inc., London, 1986.

              [Pavlidis82] T. Pavlidis. Algorithms for Graphics and Image Processing. Computer Science Press, Rockville, MD, 1982.

              [Robb95] R. Robb. Three-Dimensional Biomedical Imaging Principles and Practice. VCH Publishers, New York, NY, 1995.

              [Russ95] J. C. Russ. The Image Processing Handbook 2d ed. CRC Press, Inc, Boca Raton, FL, 1995.

              [Wolberg90] G. Wolberg. Digital Image Warping. IEEE Computer Society Press, Los Alamitos, CA, 1990.

              "},{"location":"VTKBook/10Chapter10/#108-exercises","title":"10.8 Exercises","text":"

              10.1 Create an image pipeline that will segment the area with vertical lines in Figure 10-19.

              10.2 Decomposition can increase the speed of an operation.

              a) Prove that 3D Gaussian smoothing can be decomposed into three 1D operations.

              b) Determine the complexity of the decomposed filter and the same filter implemented as a 3D convolution.

              c) Under what conditions can constant smoothing be decomposed into 1D operations?10.3 Create an image pipeline that shows the spectrum of a Gaussian image. What effect does increasing or decreasing the standard deviation have on the spectrum?

              "},{"location":"VTKBook/11Chapter11/","title":"Chapter 11 - Visualization on the Web","text":"

              The early 1990s established the widespread use and accessibility of the World Wide Web. Once a network used primarily by researchers and universities, the Web has become something that is used by people throughout the world. The effects of this transformation have been significant, ranging from personal home pages with static images and text, to professional Web pages embedding animation and virtual reality. This chapter discusses some of those changes and describes how the World Wide Web can be used to make visualization more accessible, interactive, and powerful. Topics covered include the advantages and disadvantages of client-side versus server-side visualization, VRML, and Java3D, interwoven with demonstration examples.

              "},{"location":"VTKBook/11Chapter11/#111-motivation","title":"11.1 Motivation","text":"

              Before describing in detail how to perform visualization over the Web, it is important to understand what we expect to gain. Clearly people have been visualizing data prior to the invention of the Web, but what the Web adds is the ability for people throughout the world to share information quickly and efficiently. Like all successful communication systems, the Web enables people to interact and share information more efficiently compared to other methods. In many ways the Web shares the characteristic of computer visualization in its ability to communicate large amounts of data. For that reason, computer graphics and visualization are now vital parts of the Web, and are becoming widespread in their application.

              To demonstrate these concepts we provide a simple example that illustrates the usefulness of the Web, and leads us into our first important topic: client-side versus server-side visualization.

              One common problem for researchers has been how to share or publish results. Typically, this involved having one site perform the research, interact with the data, form conclusions, and then publish the results as a report. The report might include a few pictures and possibly even a short animation. Obtaining access to the report might be through a journal or conference. Subsequently, co-workers at other sites would read the report and respond via verbal communication or formal articles.

              While certainly a viable means of sharing information, there are two important shortcomings in such a scenario. First, the report does not allow another researcher to interact with the visualizations. They are static pictures or pre-recorded animations. There is no opportunity to look from a different angle or change the parameters of the visualization. Second, access to the report may be limited or untimely. For example, some journals require as much as two years to accept, review, and publish an article. This time delay is too long for many technology-driven fields such as medicine, computers, or business. Such delays in receiving information can result in fruitless research or a failed business.

              Using the Web this scenario changes significantly. It is now possible to create reports so that other researchers can interact directly with the data, including visualizing the results in an alternative form. The Web also provides the opportunity to publish results immediately so that anyone with Web access can view them. Additionally, results can be modified as your work progresses so that they are always up to date.

              Another motivation for visualization over the Web is collaboration. If a researcher is performing a visualization of a dataset at one site, there are a number of hurdles preventing someone at another site from doing the same. For starters, the data, which could be sizable, must be copied, or sent from one site to the other. Then the software being used must be available at both sites which may not even be possible depending on the hardware available. The popularity of cross-platform systems such as AVS, IBM's Data Explorer, and VTK have helped this situation, but even then the software and data reside at both locations. This is frequently referred to as client-side visualization because all steps of the visualization are performed at the collaboration (or client) sites. In contrast, server-side visualization occurs when all of the visualization is done at one centralized location called the server. The results of the server-side visualization are then sent to collaboration sites.

              The Web opens up the opportunity to perform mixed client/server visualization that has a number of benefits. First, let's consider the drawbacks to client-side only visualization. As mentioned in the preceding discussion, client-side visualization requires both the data and the software at the client. If the datasets are very large it may be impractical to transfer the data over the Web. Since the server doesn't know what the client is going to do with the data, all of the data must be sent. Additionally, the client may not have sufficient memory or performance to perform the visualization. The advantages of client-side visualization are that the user has complete control over the visualization and can interact with or modify it at will.

              With server-side visualization the most significant loss is in interaction. A server-side only visualization is much like publishing a report. The clients have very little control over the images and animations it produces. The advantage is that the results are easily viewed from any client without requiring special hardware or software. As we will see in the remaining sections, the advantage of using recently developed Web technology is that we can mix server-, and client-side visualization much more readily than before, providing the benefits of both.

              "},{"location":"VTKBook/11Chapter11/#112-early-web-visualization","title":"11.2 Early Web Visualization","text":"

              While the World Wide Web received most of its attention in the early 1990s, its foundations date back decades earlier to the Internet and ARPAnet. What made the 1990s so significant was the development of some standardized visual tools for exchanging information. The most common of these are the Web browsers such as Mosaic, Netscape Navigator, and Microsoft Internet Explorer. These browsers provide a unified interface supporting many data (or content) types. The first content type to gain wide acceptance was HyperText Markup Language or HTML. HTML provides a way to format text and images in a document that can be shared across the Web. HTML also includes the ability to provide active links in one document that point to other documents on the Web. This helps to solve the problem of sharing results but it still limits the user to static images.

              This problem was quickly solved as Web browsers started to support other content types including animation formats such as MPEG, AVI, and QuickTime. Now a link in a HTML document can load an animation sequence for the user to view and interact with. The next step was to allow the client to control the generation of the animation sequence on the server. To facilitate this process, a mechanism for the client to send general information to the server was introduced. The Common Gateway Interface (CGI) along with HTML forms serves this purpose. In this two-pronged approach, an HTML form collects information from the client, passes it to the server that executes a CGI-BIN script, and then finally produces a result for the client to view.

              Figure 11-1. MPEG visualization example.

              For example, consider a situation where you would like to perform an isosurface extraction from volume data and then generate a short animation rotating the camera around the isosurface. There are a number of ways to generate such an animation and create an MPEG file, which can then be linked into an HTML document. Figure 11-1 shows one example generated from the following HTML code:

              <HEAD><TITLE>Sample MPEG Animation Page</TITLE></HEAD>\n\nIn this page we show an MPEG animation of a visualization of the visible woman dataset. The MPEG is stored in a file tissue.mpg. We also have taken one frame from the animation and stored it as a static JPEG image tissue.jpg. We display the JPEG image so that someone visiting the site will have an idea of what the mpeg animation will contain.\n\n<br>\n<A HREF=\"issue.mpg\"><IMG SRC=\"tissue.jpg\"> <br>Click here for an MPEG Animation</A>\n

              The title and text description are followed by <A HREF=\"tissue.mpg\"> which associates the MPEG file, tissue.mpg, with whatever comes between the first <A> and the closing </A>. In this example there is a JPEG image and a line of text. Clicking on either of these will play the MPEG animation. Now let's use CGI and an HTML form to enable the client to change the isosurface value. The first step is to obtain the desired isosurface value from the client using an HTML form such as Figure 11-2. The form was generated by the following HTML code: Figure 11-2. Example HTML form.

              <HEAD><TITLE>Sample MPEG Animation Page</TITLE></HEAD>\n<FORM METHOD=\"POST\" ACTION=\"/cgi-bin/makempg.csh\">\n\nIn this page we show the use of HTML forms to allow the client (or viewer) to send information to the server. In this example the user can select to show the bones, make them transparent and select the isosurface value to use. These parameters then get passed to the CGI-BIN script _makempg.csh_\n\n<P>Bone Isosurface:\n  <SELECT NAME=iso>\n    <OPTION SELECTED>Off\n    <OPTION>On\n    <OPTION>Transparent\n  </SELECT><BR>\n  Isosurface Value:\n  <SELECT NAME=isoval>\n    <OPTION>1400\n    <OPTION>1200\n    <OPTION SELECTED>1100 <OPTION>1000 <OPTION>900\n   </SELECT><BR>\n<P><INPUT TYPE=\"submit\"\nVALUE=\"Generate an MPEG Animation\"></FORM></P>\n

              The FORM keyword starts the definition of the HTML form. The ACTION keyword indicates what should happen when the form is submitted. In this example the server will run a CGI-BIN script called makempg.csh when a client submits this form. Next the two pull-down menus are declared with the SELECT keyword. The NAME keyword sets up an association between a string name and the value for this menu. This will be used by the script makempg.csh to access the values from the form. The OPTION and SELECTED keywords provide a mechanism to specify the values for the menu and what value the default should be. Finally, the last two lines create the button that will submit the form when pressed.

              Once the client has submitted the form, the server will execute the CGI-BIN script and pass it the arguments from the form. The script will then generate a new MPEG animation based on the client's request and return it to the client.

              While these examples demonstrate a closed loop of interaction between the client and server, there are two remaining problems. First, this approach places the entire computational load on the server. While this may be viable for some applications, some servers literally receive millions of client requests a day, severely straining server resources. Second, while the process is interactive, the lag time between making a change and seeing the result can be considerable, depending on the length of the animation and the communication bandwidth. Better solutions are now available to improve interactivity.

              Figure 11-3. A simple scene graph."},{"location":"VTKBook/11Chapter11/#113-virtual-reality-modeling-language-vrml","title":"11.3 Virtual Reality Modeling Language (VRML)","text":"

              HTML is a powerful tool for creating hypertext documents; however, it does not directly support 3D content. This limitation can be severe if we are interested in exploring 3D data, and do not know exactly what we wish to see, or what we wish to present to a user. As a result, an important development has been to create 3D worlds that the user can freely navigate. One application of this technology is Web content that allows customers to preview a hotel, resort, or vacation area by moving through a model representing the site. Such an application allows customers to preview a prospective business and directly experience what is available without relying on preconstructed views of the site.

              As a result of this need for greater interactivity, a new content type appeared referred to as the Virtual Reality Modeling Language (VRML). The idea behind VRML was to create a standard definition for transmitting 3D content over the Web. Having its origins in an early system called Labyrinth, which is in turn based on Reality Lab from Rendermorphics, it quickly evolved to the VRML 1.0 specification based on Open Inventor from Silicon Graphics.

              A VRML 1.0 file (typically with a .wrl extension, abbreviated from world) contains a scene graph representation of a 3D world (e.g., a scene). Consider Figure 11-3 which shows a simple scene. It is a directed graph that is traversed depth first from top to bottom with the content of the graph in its nodes (the circles). In this figure the top node is a group node that collects child nodes together. The light is a directional light node and the second group node represents an isosurface. The isosurface group node is represented by three children nodes: one to control the material properties, a general transformation, and finally the 3D geometry. VRML and Open Inventor support Geometry (e.g., isosurface) many different types of nodes including some support for animation. (See also \"Alternative Visual Programming Models\" in Chapter 4 for more information.)

              The basic idea behind VRML 1.0 is that the 3D content can be downloaded from the server and then interacted with the client. There are many Web browsers that support VRML and most take advantage of client-side graphics hardware if available. This helps address both the server-load problem and the interaction lag time associated with the earlier approach of server-generated MPEG animations. Like HTML, VRML supports active links so that navigating through a door in one VRML world can send you to new VRML (or HTML) sites.

              To address many of the limitations in VRML 1.0, significant changes were made resulting in the VRML 2.0 standard. Where VRML 1.0 was primarily a static scene description with some very limited behaviors, VRML 2.0 adds audio, video, and integration with Web scripting languages and more. It is still essentially a data file, but with the capabilities of simulating much more realistic and immersive environments. Many visualization systems, including VTK, support exporting scenes as VRML files. Consider the following example:

              vtkRenderer ren1\nvtkRenderWindow renWin\n  renWin AddRenderer ren1\n\n# create pipeline\n#\nvtkPLOT3DReader pl3d\n  pl3d SetXYZFileName \"$VTK_DATA_ROOT/Data/combxyz.bin\"\n  pl3d SetQFileName \"$VTK_DATA_ROOT/Data/combq.bin\"\n  pl3d SetScalarFunctionNumber 100\n  pl3d SetVectorFunctionNumber 202\nvtkContourFilter iso\n  iso SetInputConnection [pl3d GetOutputPort]\n  iso SetValue 0 .38\nvtkPolyDataNormals normals\n  normals SetInputConnection [iso GetOutputPort]\n  normals SetFeatureAngle 45\nvtkPolyDataMapper isoMapper\n  isoMapper SetInputConnection [normals GetOutputPort]\n   isoMapper ScalarVisibilityOff\nvtkActor isoActor\n  isoActor SetMapper isoMapper\n  eval [isoActor GetProperty] SetColor 0.3 0.4 0.5\n\nvtkStructuredGridOutlineFilter outline\n  outline SetInputConnection [pl3d GetOutputPort]\nvtkPolyDataMapper outlineMapper\n  outlineMapper SetInputConnection [outline GetOutputPort]\nvtkActor outlineActor\n  outlineActor SetMapper outlineMapper\n\n# Add the actors to the renderer, set the background and size #\nren1 AddActor outlineActor ren1 AddActor isoActor\nrenWin SetSize 500 500\nren1 SetBackground 0.1 0.2 0.4\n

              This is a typical program within VTK that extracts an isosurface and bounding outline from a structured grid dataset. To export this result to a VRML data file we can use the vtkVRMLExporter as shown below:

              vtkVRMLExporter exp\n  exp SetRenderWindow renWin\n  exp SetFileName Combustor.wrl\n  exp Write\n

              These four lines create an instance of vtkVRMLExporter, set its input to renWin (an instance of vtkRenderWindow), set a file name, and finally write out the result. This is different from previous examples where data was written out using vtkPolyDataWriter or other subclasses of vtkWriter. vtkVRMLExporter is a subclass of vtkExporter, not vtkWriter. The significant difference is that a writer takes a vtkDataSet as input and is responsible for writing out a single dataset. An exporter takes a vtkRenderWindow as input and is responsible for writing out an entire scene, possibly containing multiple actors, lights, textures, and material properties, in addition to any datasets.

              If you consider a continuum from a static data file to a fully interactive visualization program, vtkWriter would be at one end, vtkExporter in the middle, and a VTK program at the other. VRML 1.0 would fall at the same place as vtkExporter and VRML 2.0 would fall between vtkExporter and an actual program due to its added support for behavior and script interaction. What VRML lacks from a visualization perspective is algorithms. VRML is a 3D multimedia content format and lacks direct support for applying visualization techniques or algorithms.

              "},{"location":"VTKBook/11Chapter11/#114-a-vrml-visualization-server","title":"11.4 A VRML Visualization Server","text":"

              We can improve on the earlier MPEG visualization server example by creating a VRML visualization server. The primary limitations of the MPEG approach were that the processing burden was on the server, and the client-side interaction was limited to requesting that a different MPEG animation be generated. In our improved example, the basic idea is the same as before. That is, we use a HTML form to define parameters for a visualization, which then spawns off a CGI-BIN script. The difference is that in this example the server will generate a VRML data file that is returned to the client. The client can then control the viewpoint and rendering of the VRML result. The data and visualization software still reside on the server, so the client is only required to have a VRML compatible Web browser.

              The HTML form is essentially the same as the one used to generate Figure 11-2. What changes is that the CGI-BIN script now needs to produce a VRML file instead of an MPEG. So instead of the form invoking makempg.csh, it will invoke a C++ executable named VRMLServer. This executable will parse the inputs from the form and then write out a VRML file to its standard output. The first part of the program parses the arguments from the form. The server passes these arguments as a single string to the program's standard input. At the same time an environment variable named CONTENT_LENGTH is set to the length of this input. In this example there are two values passed from the form: iso and isoval. According to convention they are separated by a \"&\" when passed to the CGI-BIN script. The following C++ code extracts these values from the input string and performs some quick error checking.

              // first get the form data\nenv = getenv(\"CONTENT_LENGTH\");\nif (!env) return -1;\nint inputLength = atoi(env);\n// a quick sanity check on the input\nif ((inputLength > 40)||(inputLength < 17)) return -1;\ncin >> arg1;\n\nif (strncmp(arg1,\"isoval=\",7) == 0)\n  {\n  isoval = atof(arg1 + 7);\n  strcpy(isoType,arg1 + 11);\n  }\nelse\n  {\n  isoval = atof(arg1 + inputLength - 4);\n  strncpy(isoType,arg1 + 4,inputLength - 16);\n  isoType[inputLength - 16] = '\\0';\n  }\n

              This code is specific to the parameters in this example, but generic argument extraction routines such as cgic (see http://www.boutell.com/cgic/) can be used. Once the form data has been obtained, it can be used to set up the visualization pipeline as usual. In the following code, an isosurface is added to the renderer based on the isoType input from the form. Likewise if isoType is set to \"Transparent\" then that actor's opacity is set to 0.5.

              // should we do the isosurface\nif (strcmp(isoType,\"Off\"))\n  {\n  ren1->AddActor( isoActor );\n  }\nif (strcmp(isoType,\"Transparent\") == 0)\n  {\n  isoActor->GetProperty()->SetOpacity( 0.5 );\n  }\n

              Once the pipeline is set up, the last step is to generate the proper headers and VRML output. The header is the keyword Content-type: followed by the keyword x-world/x-vrml that is the specification for VRML content. This is often followed by a pragma indicating that the client browser should not cache the data, typically because of the memory it would consume.

              // Send out vrml header stuff\nfprintf(stdout,\"Content-type: x-world/x-vrml\\n\");\n fprintf(stdout,\"Pragma: no-cache\\n\\n\");\n// write out VRML 2.0 file\nvtkVRMLExporter *writer = vtkVRMLExporter::New();\n  writer->SetInput( renWin );\n  writer->SetFilePointer( stdout );\n  writer->Write();\n

              Finally an instance of vtkVRMLExporter is created, assigned an instance of vtkRenderWindow as input, and set to write to standard output. When the Write() method is applied, the exporter updates the visualization pipeline and produces the VRML output. The vtkRenderWindow is never rendered and no windows appear on the server. There is no need for an interactor because the interaction will be handled by the client's VRML browser. This program simply reads in a string of input (the parameters from the form) and then produces a string of output (the VRML data). It is also important to remember that CGI-BIN scripts are typically run from a different user id and environment than your own; file names and paths should be fully specified.

              "},{"location":"VTKBook/11Chapter11/#115-visualization-with-java","title":"11.5 Visualization with Java","text":"

              The examples discussed so far have addressed Web-based visualization in a number of ways. We have seen how to present preconstructed content such as images and animations using HTML, as well as creating interactive worlds with VRML. Each technique has its benefits but lacks the flexibility found in a custom-developed program. This is where Java stands out. Java's origins trace back to an embedded control language for small appliances and personal digital assistants. As such it was designed to work on a wide variety of hardware without recompilation and with high reliability. These same qualities are valuable to Web programming where a single program must run on many different machines without fail.

              Since Java is a full programming language, any visualization application written in Java will run on any Java-compliant system. In addition, Java provides the flexibility to perform the visualization on the server, on the client, or even a mixture of both. A number of early Java programs (a.k.a., applets) have emerged that render simple geometry or play back image sequences. Unfortunately Java provides no direct support for using accelerated 3D hardware and this limits the types of visualizations that can be done.

              There are two common approaches to utilizing graphics hardware from Java. The first approach is to access an existing toolkits capabilities from within Java. Fortunately, the Visualization Toolkit has been interfaced with Java so that it can be used from Java in a manner similar to its use in Tcl/Tk. The second is to use Java3D which is a native 3D extension to Java that supports hardware rendering and a rich scene graph based API.

              While Java is a portable byte-compiled language, its designers realized it was important to have a mechanism for developers to make calls to C or C++ routines. This mechanism is called the Java Native Interface, or JNI for short. The JNI provides a clean, well-defined way for native code such as C and C++ to work with Java. This allows a visualization system such as VTK to be used, which in turn provides a mechanism to access 3D graphics hardware (if available). Native code also allows performance critical functions to be handled in optimized C or C++ code instead of Java.

              The downside to using Java3D or native code is that it sacrifices Java's portability somewhat. Where a pure Java program can be byte-compiled and run on any machine that supports Java, a program that relies on Java3D or native code requires that the compiled Java3D or native code support be installed on the client. For each type of machine you want to support, you will need a compiled version of the native code. For a toolkit like VTK this means that the client would have to download the native VTK support (e.g., an object library) before being able to run VTK-Java applications. Once that is done, most applications described in this book can be made into a Web-based visualization. Depending on the needs of the application, the data can be left on the server and the results sent to the client, or the data could be sent to the client for both processing and viewing.

              The following example outlines how to use Java and VTK to display vibrational modes of a rectangular plate. In the preceding examples an HTML form was used to obtain input from the client. With Java we can construct a customized client-side user interface to obtain the required information.

              The first step in this example creates the HTML code that in turn launches the Java applet.

              <title>Vibrational Modes of a Rectangular Plate</title>\n  <h2>Vibrational Modes of a Rectangular Plate</h2>\n\nThis Java applet downloads a VTK data file into a Java String. It then uses the InputString method of the VTK data reader to use this string as its data. Then it creates a filter pipeline that takes the original geometry and warps it according to the vector data. There are four sets of vector data in this example. They correspond to the first, second, fourth and eighth vibrational modes. The geometry is color based on the amount of displacement.\n\n``` html\n<hr>\n<applet code=App2.class width=400 height=500>\n<param name=model value=plate.vtk>\n</applet>\n<hr>\n

              The key lines are near the end where the applet keyword is used to start the App2 Java applet with a default window size of 400 by 500. Parameters are passed to the applet using the param keyword followed by key-value pairs. When the client encounters the applet keyword, it then requests that Java applet from the server and starts executing it. We will consider the Java code in App2 from a visualization perspective. A more complete introduction to Java programming can be found in numerous books (see \"Bibliographic Notes\" in his Chapter).

              The applet will have a standard structure starting by importing other classes that this application will use.

              import vtk.*;\nimport java.awt.*;\nimport java.applet.*;\netc...\n

              Next comes the class definition for App2. As with most Java applets, this class extends the Applet class. It has a number of instance variables including many VTK objects that will be used to set up the visualization pipeline.

              public class App2 extends Applet\n  {\n  [vtkPolyDataReader](https://www.vtk.org/doc/nightly/html/classvtkPolyDataReader.html#details) pr = null;\n  [vtkWarpVector](https://www.vtk.org/doc/nightly/html/classvtkWarpVector.html#details) warp = null;\n  [vtkGeometryFilter](https://www.vtk.org/doc/nightly/html/classvtkGeometryFilter.html#details) ds2poly = null;\n  [vtkCleanPolyData](https://www.vtk.org/doc/nightly/html/classvtkCleanPolyData.html#details) clean = null;\n  [vtkPolyDataNormals](https://www.vtk.org/doc/nightly/html/classvtkPolyDataNormals.html#details) normals = null;\n  [vtkVectorDot](https://www.vtk.org/doc/nightly/html/classvtkVectorDot.html#details) color = null;\n  [vtkDataSetMapper](https://www.vtk.org/doc/nightly/html/classvtkDataSetMapper.html#details) plateMapper = null;\n  vtkPanel panel = null;\n  etc...\n

              The init() method handles applet initialization. This is where parameters from the HTML page will be processed and the visualization pipeline and user interface will be set up. To place the rendering window within the user interface, we use the vtkPanel class that is a subclass of the Java Canvas class. This way the rendering window can be treated as if it were just another piece of the user interface.

              public void init()\n  {\n  GridBagLayout grid = new GridBagLayout();\n\n  this.setLayout(grid);\n  panel = new vtkPanel();\n  panel.resize(400,400);\n  constrain(this,panel,0,0,8,8);\n

              Next, this method checks to see if the model parameter is set, and opens a stream connection to the server that is used to download the data file into a Java string. This is then passed to a vtkPolyDataReader at which point the data is now available to the native VTK code on the client. The rest of the pipeline is set up as usual with the exception that a Java syntax is used instead of C++ or Tcl. (Due to VTK's object-oriented design the variations from one language to another are minor.) At this point in the init() method the rest of the pipeline is set up along with some check boxes and event handlers for the user interface. The vtkPanel has a method that returns the RenderWindow that can then be acted on as usual. For example:

              panel.GetRenderer().AddActor(a);\n

              The resulting applet is shown in Figure 11-4.

              This demonstrates one of the advantages of using Java for Web visualization. VRML would require that the geometry of each vibrational mode be sent to the client for viewing. With Java and VTK the geometry can be sent once along with a set of scalar displacements for each vibrational mode. Then as the client switches between modes, the geometry can be modified quickly by the client without any additional network traffic. In fact the client could mix vibrational modes or perform an animation showing the vibration of the plate all without having to go back to the server, and without requiring much more data than a single VRML model of the plate. If the client decided to examine another geometry, say the vibrational modes of a disc, then it would likely return to the server for the new data. This is the flexibility that Java provides.

              Figure 11-4. Two images from a Java (JNI) applet."},{"location":"VTKBook/11Chapter11/#116-java3d","title":"11.6 Java3D","text":"

              Similar to a native code implementation (such as a VTK implementation) Java3D provides access to hardware accelerated 3D graphics. Java3D provides both scene graph rendering similar to VRML, and high-level immediate mode rendering. The immediate mode rendering support is not as complete as libraries like OpenGL or DirectX, but it does provide a good subset of its functionality. Java3D does share some of the limitations of native code implementations in that the client must have a version of Java3D for their operating system installed for it to work. There are also some limitations in how both Java3D and native interfaces interact with lightweight GUI components such as swing.

              To better understand the Java3D API, we'll walk through an example applet distributed with the original 1.0 specification. In this example, a colored cube is rendered as it rotates at a fixed rate.

              First, let's consider the definition of the cube. Some of the details have been left out for brevity. The complete description of the cube is stored in a Java class we'll call ColorCube. It contains two class variables (verts and colors) that store the vertex positions and RGB colors. It has an instance of the Shape3D class that will be used by Java3D and a method, getShape(), to access it.

              Finally, ColorCube has a constructor that creates a QuadArray, inserts the verts and colors into it, and assigns it to the Shape3D instance variable.

              public class ColorCube extends Object\n  {\n  private static final float[] verts =\n    {\n    // front face\n    1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f,\n    -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.\n...\n    // bottom face\n    -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f,\n    1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f,\n    };\n  private static final float[] colors =\n    { // front face (red)\n    1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n    1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n...\n    // bottom face (cyan)\n    0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n    0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n    };\n    private Shape3D shape;\n    public ColorCube() {\n      QuadArray cube = new QuadArray(24,\n                          QuadArray.COORDINATES | QuadArray.COLOR_3);\n      cube.setCoordinates(0, verts);\n      cube.setColors(0, colors);\n      shape = new Shape3D(cube, new Appearance());\n      }\n    public Shape3D getShape() {\n      return shape;\n      }\n  }\n

              Having defined the geometry, the entry point for a Java3D application is the applet. The HelloUniverse class extends the Applet class and provides the initialization code for this application. The constructor for this applet creates a Canvas3D object that is where the 3D information will be rendered. It then calls the createSceneGraph() method that performs the detailed setup of the scene graph including creating an instance of ColorCube. Then the constructor creates an instance of a UniverseBuilder given the Canvas3D and attaches the scene graph to the Universe. The UniverseBuilder is mostly boiler-plate code that handles setting up the view location (or platform) and attaching it to the Canvas3D.

              public class HelloUniverse extends Applet\n  {\n  public HelloUniverse()\n    {\n    setLayout(new BorderLayout());\n    Canvas3D c = new Canvas3D(graphicsConfig);\n    add(\"Center\", c);\n    // Create a simple scene and attach it to the virtual universe\n    BranchGroup scene = createSceneGraph();\n    UniverseBuilder u = new UniverseBuilder(c);\n    u.addBranchGraph(scene);\n    }\n}\n

              It is worth noting that in the createSceneGraph() method, the use of the previously defined ColorCube class and its insertion into the scene graph via the BranchGroup class. The setCapability() method is used to enable the cube's transform to be modified and underlies an important concept. To achieve the highest rendering rate, Java3D performs a number of optimizations on the scene graph. Many of these optimizations only work if certain properties of the nodes are guaranteed to not change. So by default most properties of a node are set to be \"read only.\" To modify them after creation requires the specific call shown below.

              public BranchGroup createSceneGraph()\n  {\n  // Create the root of the branch graph\n  BranchGroup objRoot = new BranchGroup();\n  // Create the transform group node and initialize it to the\n  // identity. Enable the TRANSFORM_WRITE capability so that\n  // our behavior code can\n  // root of the subgraph.\n  TransformGroup objTran = new TransformGroup;\n  objTran.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);\n   objRoot.addChild(objTran);\n  // Create a simple shape leaf node, add it to the scene graph.\n  objTran.addChild(new ColorCube().getShape());\n  // Create a new Behavior object that will perform the desired\n  // operation on the specified transform object and add it into\n  // the scene graph.\n  Transform3D yAxis = new Transform3D;\n  Alpha rotationAlpha = new Alpha (\n    -1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0);\n  RotationInterpolator rotator =\n  new RotationInterpolator(rotationAlpha, objTran, yAxis,\n      0.0f, (float) Math.PI*2.0f);\n  BoundingSphere bounds =\n    new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);\n  rotator.setSchedulingBounds(bounds); objTran.addChild(rotator);\n  objTran.addChild(rotator);\n  return objRoot;\n}\n\npublic void addBranchGraph(BranchGroup bg) {\n  locale.addBranchGraph(bg);\n   }\n
              "},{"location":"VTKBook/11Chapter11/#117-vrml-java-and-the-eai","title":"11.7 VRML, Java, and the EAI","text":"

              The External Authoring Interface (EAI) provides VRML with the same combination of power and flexibility that Java3D has. The EAI provides a communication interface that allows Java and VRML to interact with each other. This is particularly powerful in that a Java applet can create a VRML world, add and delete nodes from the scene graph, and a VRML scene graph can invoke Java code or Java Script in response to an event. In many ways this is similar to the Java3D solution with the exception that VRML is being used for the rendering instead of the Java3D rendering engine. Both solutions have the benefit of Java as a general purpose language for handling programmatic and user-interface issues.

              There are a number of ways to organize a visualization that uses the EAI. We will consider the most general method that starts with an HTML page that loads both a VRML world file and a Java applet in the traditional way. This example is loosely derived from work by David Brown. The Java applet starts by importing a number of classes including some VRML specific ones and then defining the instance variables that it will be using.

              import java.awt.*;\nimport java.applet.*;\nimport java.lang.*;\nimport vrml.external.field.*;\nimport vrml.external.Node;\nimport vrml.external.Browser;\nimport vrml.external.exception.*;\n\npublic class visApplet extends Applet\n    {\n    // The Browser\n    Browser browser = null;\n    // Various UI widgets\n    Button grow_button, shrink_button;\n\n    // Various stuff in the VRML scene we hang on to\n    Node root_node, sphere_node;\n    EventInSFVec3f setScale = null;\n    float currentScale = (float)1.0;\n

              Next, the applet defines the init() method that will request a reference to the browser, invoke initScene() to build the VRML interface, and create the user interface. In this case the user interface is just two buttons on a white background.

              /** Initialize the Applet */\npublic void init()\n  {\n  // Connect to the browser\n  browser = Browser.getBrowser(this);\n  if (browser == null) {\n    die(\"init: NULL browser!\");\n  }\n  System.out.println(\"Got the browser: \"+browser);\n\n  // Initialize some VRML stuff\n  initScene();\n\n  // Build a simple UI\n  grow_button = new Button(\"Grow Sphere\");\n   add(grow_button);\n  shrink_button = new Button(\"Shrink Sphere\");\n   add(shrink_button);\n  // Misc other UI setup\n  Color c = Color.white;\n  System.out.println(\"Setting bg color to: \" + c);\n   setBackground(c);\n}\n

              There is a simple error handling routine defined.

              /** Handle a fatal error condition */\npublic void die(String s)\n   {\n   System.out.println(\"visApplet: FATAL ERROR!\");\n   System.out.println(\"--> \" + s);\n   System.out.println(\"visApplet: Aborting...\\n\");\n}\n

              The initScene() method sets up the VRML scene and relies heavily on the EAI. For synchronization reasons, this method starts off by waiting a few seconds to assure that the VRML browser has time to initialize and read the VRML file specified by the HTML. Then it uses the browser.getNode(\"aName\") method to obtain nodes from the scene graph. These nodes must be named using the DEF keyword in the VRML file. The first node it gets is the SPHERE node that happens to be a VRML transform. It uses the getEventIn() method to obtain a handle to the scale instance variable of this transform which will be used later.

              /** Set up some stuff in the VRML scene */\n    public void initScene()\n      {\n      System.out.println(\"initScene()...\");\n\n     // wait a couple seconds\n     try {\n       Thread.currentThread().sleep(5000);\n       }\n     catch(InterruptedException e) {}\n     // Get the \"SPHERE\" node\n      try {\n       sphere_node = browser.getNode(\"SPHERE\");\n       }\n      catch(InvalidNodeException e) {\n        System.out.println(\"InvalidNodeException: \" + e);\n        die(\"initScene: SPHERE node not found!\");\n        return;\n        }\n      System.out.println(\"- Got the SPHERE node: \" + sphere_node);\n      try {\n        setScale = (EventInSFVec3f)\n        sphere_node.getEventIn(\"set_scale\");\n        }\n      catch (InvalidEventInException e) {\n        die(\"initScene: InvalidEventInException \" + e);\n        return;\n        }\n

              Then the same techniques are used to obtain the ROOT node of the scene graph. If you scan the VRML file that follows this example, you will see that the ROOT node is just an empty Group. After obtaining the node we request handles to its addChildren() and removeChildren() methods.

                  // Get the \"ROOT\" node (a Group which we add to)\n    try {\n      root_node = browser.getNode(\"ROOT\");\n      }\n    catch(InvalidNodeException e) {\n      System.out.println(\"InvalidNodeException: \" + e);\n      die(\"initScene: ROOT node not found!\");\n    return;\n    }\n  System.out.println(\"- Got the ROOT node: \" + root_node);\n\n  // Get the ROOT node's add/removeChildren\n  EventIns EventInMFNode addChildren;\n  EventInMFNode removeChildren;\n  try {\n    addChildren = (EventInMFNode)\n    root_node.getEventIn(\"addChildren\");\n    removeChildren = (EventInMFNode)\n    root_node.getEventIn(\"removeChildren\");\n    }\n  catch (InvalidEventInException e) {\n    die(\"initScene: InvalidEventInException \" + e);\n    return;\n    }\n

              Using the EAI, VRML can be created from a Java string as shown in the following code. This allows us to create geometry on the fly and add it to the scene graph using the addChildren() handle obtained above. The handles support matching setValue() and getValue() methods that modify and interrogate the scene graph respectively.

              // Create the VRML for a purple sphere\nNode[] shape;\nString purple_sphere =\n  \"#VRML V2.0 utf8\\n\" +\n  \"Transform {\\n\" +\n  \"  children Shape {\\n\" +\n  \"     appearance Appearance {\\n\" +\n  \"       material Material {\\n\" +\n  \"         diffuseColor 0.8 0.2 0.8\\n\" +\n  \"     }\\n\" +\n  \"   }\\n\" +\n  \"   geometry Sphere {}\\n\" +\n  \" }\\n\n  \" translation 0 3 0\" +\n  \"}\\n\";\n  try {\n    shape = browser.createVrmlFromString(purple_sphere);\n    }\n  catch (InvalidVrmlException e) {\n    die(\"initScene: InvalidVrmlException: \" + e);\n    return;\n    }\n  // Add the sphere to the ROOT group\n  addChildren.setValue(shape);\n  System.out.println(\"initScene: done.\");\n  }\n

              The events for the two buttons are processed in the action() method. One increases the scale of the sphere and the other decreases it. This is done using the handle to the SPHERE node's scale that was obtained in the initScene() method, and invoking the setValue() method with the appropriate arguments.

              /** Handle actions from AWT widgets */\n    public boolean action(Event event, Object what)\n      {\n      if (event.target instanceof Button) {\n      Button b = (Button) event.target;\n      if (b == grow_button) {\n        currentScale = currentScale * (float)1.2;\n        float ascale[] = new float[3];\n        ascale[0] = currentScale;\n        ascale[1] = currentScale;\n        ascale[2] = currentScale;\n        setScale.setValue(ascale);\n        }\n      else if (b == shrink_button) {\n        currentScale = currentScale / (float)1.2;\n        float ascale[] = new float[3];\n        ascale[0] = currentScale;\n        ascale[1] = currentScale;\n        ascale[2] = currentScale;\n        setScale.setValue(ascale);\n        }\n      } // event.target instanceof Button\n      return true;\n}\n

              The last method in the applet draws a border around the two buttons when the applet needs to be repainted.

              /** Override paint() to get more control over how we're drawn */\n public void paint(Graphics g)\n   {\n   int w = size().width;\n   int h = size().height;\n\n   // Draw a simple border\n   g.drawRect(0, 0, w-1, h-1);\n   g.drawRect(1, 1, w-3, h-3);\n   super.paint(g);\n   }\n}\n

              An excerpt from the VRML file has been included below. Note the use of the DEF keyword to name nodes that can then be accessed from Java. The resulting Java/VRML example can be seen in Figure 11-5.

              Figure 11-5. Java and VRML combined using the EAI.
              #VRML V2.0 utf8\n#\nGroup {\n  children [\n    #\n    # Some objects\n    #\n    DEF ROOT Group {}\n    DEF SPHERE Transform {\n      childrenShape {\n        appearanceAppearance {\n          materialMaterial {\n            ambientIntensity 0.283774\n            diffuseColor 0.0846193 0.56383 0.0595097\n            specularColor 0.13092 0.87234 0.0920716\n            emissiveColor 0 0 0\n            shininess 0.2\n            transparency 0\n          }\n       }\n       geometrySphere {}\n     }\n     translation-4 0 0\n   }\n  ]\n}\n
              "},{"location":"VTKBook/11Chapter11/#118-the-future-of-web-visualization","title":"11.8 The Future of Web Visualization","text":"

              In the previous sections we provided an overview of some of the technologies important to applying visualization on the World Wide Web. Since Web-based technologies, computer graphics, and visualization are all rapidly growing fields, the likelihood of new development and change is high. However, we are confident that these technologies will remain important to the future. Eventually we expect 3D graphics and data visualization to become as pervasive as 2D graphical user interfaces and presentations are today. The main barriers to this development is the limited bandwidth of the Web, lack of familiarity (and difficulty of use) of 3D graphics and visualization, and limitations in computer hardware and software. We believe that technological advances will eventually minimize bandwidth and computer hardware limitations, while systems like VTK will make 3D graphics and visualizations easier to use.

              One of the benefits of systems like VTK is that they are driven by their algorithmic content. The systems we have seen earlier such as OpenGL, HTML, VRML and Java, are implementations of a system or information protocol. Algorithmic systems, on the other hand, implement mathematical, logical, and design relationships that change much more slowly than system implementations. As a result, systems like VTK will remain vital for years to come, although the underlying implementation language and interface may change. To track future changes to VTK visit our Web pages at http://www.vtk.org.

              "},{"location":"VTKBook/11Chapter11/#119-chapter-summary","title":"11.9 Chapter Summary","text":"

              Visualization over the Web opens up many forms of collaborative development, entertainment, and publishing that were previously restricted to a few individuals with access to custom software. There are many ways to perform visualization over the Web ranging from simple HTML pages with pictures, to complete Java-based applications. Deciding on the correct solution for Web visualization depends on three key factors: 1) the amount of interaction and control you want to provide to the user or client, 2) performance issues related to data size and client/server load balancing, 3) how much complexity you are willing to deal with. While the Java-based solutions can provide interaction, control, and load balancing, this involves added complexity. It may be that producing a static VRML file for your Web page is sufficient. Either way there are a host of tools available and more are on the way. The greatest challenge will likely be to create a future standard for the Web that includes not just 3D viewing but also visualization.

              "},{"location":"VTKBook/11Chapter11/#1110-bibliographic-notes","title":"11.10 Bibliographic Notes","text":"

              For a general introduction to HTML and CGI consider [Morris95] or [Graham95]. Both books provide a good introduction and include coverage for both UNIX and MS Windows-based systems. For more detailed coverage of CGI programming consider [Gundavaram96]. Mark Pesce [Pesce95] provides a n excellent introduction to VRML including its early genesis. [Ames96] is also a great VRML resource. The Inventor Mentor by Josie Wernecke [Wernecke94] is an excellent book for learning about Open Inventor and scene graphs. Java in a Nutshell [Flanagan96] is a good reference for Java and for someone who already knows how to program in another language For documentation on the Java Native Interface or Java3D, visit Sun's Web site at http://java.sun.com.

              "},{"location":"VTKBook/11Chapter11/#1111-references","title":"11.11 References","text":"

              [Ames96] A. Ames, D. Nadeau, and J. Moreland. The VRML Sourcebook. John Wiley & Sons, Inc., New York, NY, 1996.

              [Flanagan96] David Flanagan. Java in a Nutshell. O'Reilly & Associates, Inc., Sebastopol, CA, 1996.

              [Graham95] I. S. Graham. The HTML Sourcebook. John Wiley & Sons, Inc., New York, NY, 1995.

              [Gundavaram96] S. Gundavaram. CGI Programming on the World Wide Web. O'Reilly & Associates, Inc., Sebastopol, CA, 1996.

              [Morris95] M. E. S. Morris. HTML for Fun and Profit. SunSoft Press, Prentice Hall PTR, Englewood Cliffs, NJ, 1995.

              [Pesce95] M. Pesce. VRML - Browsing and Building Cyberspace. New Riders Publishing, Indianapolis, IN, 1995.

              [Wernecke94] J. Wernecke. The Inventor Mentor. Addison-Wesley, Reading MA,1994.

              "},{"location":"VTKBook/12Chapter12/","title":"Chapter 12 - Applications","text":"

              We have described the design and implementation of an extensive toolkit of visualization techniques. In this chapter we examine several case studies to show how to use these tools to gain insight into important application areas. These areas are medical imaging, financial visualization, modelling, computational fluid dynamics, finite element analysis, and algorithm visualization. For each case, we briefly describe the problem domain and what information we expect to obtain through visualization. Then we craft an approach to show the results. Many times we will extend the functionality of the Visualization Toolkit with application-specific tools. Finally, we present a sample program and show resulting images.

              The visualization design process we go through is similar in each case. First, we read or generate application-specific data and transform it into one of the data representation types in the Visualization Toolkit. Often this first step is the most difficult one because we have to write custom computer code, and decide what form of visualization data to use. In the next step, we choose visualizations for the relevant data within the application. Sometimes this means choosing or creating models corresponding to the physical structure. Examples include spheres for atoms, polygonal surfaces to model physical objects, or computational surfaces to model flow boundaries. Other times we generate more abstract models, such as isosurfaces or glyphs, corresponding to important application data. In the last step we combine the physical components with the abstract components to create a visualization that aids the user in understanding the data.

              "},{"location":"VTKBook/12Chapter12/#121-3d-medical-imaging","title":"12.1 3D Medical Imaging","text":"

              Radiology is a medical discipline that deals with images of human anatomy. These images come from a variety of medical imaging devices, including X-ray, X-ray Computed Tomography (CT), Magnetic Resonance Imaging (MRI), and ultrasound. Each imaging technique, called an imaging modality, has particular diagnostic strengths. The choice of modality is the job of the radiologist and the referring physician. For the most part, radiologists deal with two-dimensional images, but there are situations when three-dimensional models can assist the radiologist's diagnosis. Radiologists have special training to interpret the two dimensional images and understand the complex anatomical relationships in these two-dimensional representations. However, in dealing with referring physicians and surgeons, the radiologist sometimes has difficulty communicating these relationships. After all, a surgeon works in three-dimensions during the planning and execution of an operation; moreover, they are much more comfortable looking at and working with three-dimensional models.

              Figure 12-1. A CT slice through a human head.

              This case study deals with CT data. Computed tomography measures the attenuation of X-rays as they pass through the body. A CT image consists of levels of gray that vary from black (for air), to gray (for soft tissue), to white (for bone). Figure 12-1 shows a CT cross section through a head. This slice is taken perpendicular to the spine approximately through the middle of the ears. The gray boundary around the head clearly shows the ears and bridge of the nose. The dark regions on the interior of the slice are the nasal passages and ear canals. The bright areas are bone. This study contains 93 such slices, spaced 1.5 mm apart. Each slice has 256*^2 pixels spaced 0.8 mm apart with 12 bits of gray level.

              Our challenge is to take this gray scale data (over 12 megabytes) and convert it into information that will aid the surgeon. Fortunately, our visualization toolkit has just the right techniques. We will use isocontouring techniques to extract the skin and bone surfaces and display orthogonal cross-sections to put the isosurface in context. From experience we know that a density value of 500 will define the air/skin boundary, and a value of 1150 will define the soft tissue/bone boundary. In VTK terminology, medical imaging slice data is image data. Recall from Chapter 5 that for image data, the topology and geometry of the data is implicitly known, requiring only dimensions, an origin, and the data spacing.

              The steps we follow in this case study are common to many three-dimensional medical studies.

              1. Read the input.

              2. For each anatomical feature of interest, create an isosurface.

              3. Transform the models from patient space to world space.

              4. Render the models.

              This case study describes in detail how to read input data and extract anatomical features using iso-contouring. Orthogonal planes will be shown using a texture-based technique. Along the way we will also show you how to render the data. We finish with a brief discussion of medical data transformations. This complete source code for the examples shown in this section are available from Medical1.cxx, Medical2.cxx, and Medical3.cxx.

              Read the Input

              Medical images come in many flavors of file formats. This study is stored as flat files without header information. Each 16-bit pixel is stored with little-endian byte order. Also, as is often the case, each slice is stored in a separate file with the file suffix being the slice number of the form prefix.1, prefix.2 , and so on. Medical imaging files often have a header of a certain size before the image data starts. The size of the header varies from file format to file format. Finally, another complication is that sometimes one or more bits in each 16-bit pixel is used to mark connectivity between voxels. It is important to be able to mask out bits as they are read.

              VTK provides several image readers including one that can read raw formats of the type described above [vtkVolume16Reader](https://www.vtk.org/doc/nightly/html/classvtkVolume16Reader.html#details). To read this data we instantiate the class and set the appropriate instance variables as follows.

              vtkVolume16Reader *v16 = vtkVolume16Reader::New();\n  v16->SetDataDimensions (64,64); v16->SetImageRange (1,93);\n  v16->SetDataByteOrderToLittleEndian();\n  v16->SetFilePrefix (\"headsq/quarter\");\n  v16->SetDataSpacing (3.2, 3.2, 1.5);\n

              The FilePrefix and FilePattern instance variable work together to produce the name of files in a series of slices. The FilePattern which by default is %s.%d generates the filename to read by performing a C-language sprintf() of the FilePrefix and the current file number into the FilePattern format specifier.

              Create an Isosurface

              We can choose from three techniques for isosurface visualization: volume rendering, marching cubes, and dividing cubes. We assume that we want to interact with our data at the highest possible speed, so we will not use volume rendering. We prefer marching cubes if we have polygonal rendering hardware available, or if we need to move up close to or inside the extracted surfaces. Even with hardware assisted rendering, we may have to reduce the polygon count to get reasonable rendering speeds. Dividing cubes is appropriate for software rendering. For this application we'll use marching cubes.

              For medical volumes, marching cubes generates a large number of triangles. To be practical, we'll do this case study with a reduced resolution dataset. We took the original 256^2 data and reduced it to 64^2 slices by averaging neighboring pixels twice in the slice plane. We call the resulting dataset quarter since it has 1/4 the resolution of the original data. We adjust the DataSpacing for the reduced resolution dataset to 3.2 mm per pixel. Our first program will generate an isosurface for the skin.

              The flow in the program is similar to most VTK applications.

              1. Generate some data.

              2. Process it with filters.

              3. Create a mapper to generate rendering primitives.

              4. Create actors for all mappers.

              5. Render the results.

              The filter we have chosen to use is vtkMarchingCubes. We could also use vtkContourFilter since it will automatically create an instance of vtkMarchingCubes as it delegates to the fastest subclass for a particular dataset type. The class vtkPolyDataNormals is used to generate nice surface normals for the data. vtkMarchingCubes can also generate normals, but sometimes better results are achieved when the normals are directly from the surface (vtkPolyDataNormals ) versus from the data (vtkMarchingCubes ). To complete this example, we take the output from the isosurface generator vtkMarchingCubes and connect it to a mapper and actor via vtkPolyDataMapper and vtkActor. The C++ code follows.

              vtkContourFilter *skinExtractor = vtkContourFilter::New();\n  skinExtractor->SetInputConnection(v16->GetOutputPort());\n  skinExtractor->SetValue(0, 500);\n\nvtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();\n  skinNormals->SetInputConnection(skinExtractor->GetOutputPort());\n  skinNormals->SetFeatureAngle(60.0);\n\nvtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();\n  skinMapper->SetInputConnection(skinNormals->GetOutputPort());\n  skinMapper->ScalarVisibilityOff();\n\nvtkActor *skin = vtkActor::New();\n  skin->SetMapper(skinMapper);\n\nvtkOutlineFilter *outlineData = vtkOutlineFilter::New();\n  outlineData->SetInputConnection(v16->GetOutputPort());\nvtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();\n  mapOutline->SetInputConnection(outlineData->GetOutputPort());\n\nvtkActor *outline = vtkActor::New();\n  outline->SetMapper(mapOutline);\n  outline->GetProperty()->SetColor(0,0,0);\n\nvtkCamera *aCamera = vtkCamera::New();\n  aCamera->SetViewUp (0, 0, -1);\n  aCamera->SetPosition (0, 1, 0);\n  aCamera->SetFocalPoint (0, 0, 0);\n  aCamera->ComputeViewPlaneNormal();\n\naRenderer->AddActor(outline);\naRenderer->AddActor(skin);\naRenderer->SetActiveCamera(aCamera);\naRenderer->ResetCamera ();\n\naCamera->Dolly(1.5);\n\naRenderer->SetBackground(1,1,1);\n\nrenWin->SetSize(640, 480);\n\naRenderer->ResetCameraClippingRange ();\n\n// Initialize the event loop and then start it.\niren->Initialize();\niren->Start();\n
              Figure 12-2. The skin extracted from a CT dataset of the head. See MedicalDemo1.cxx and MedicalDemo1.py.

              To provide context for the isosurface an outline is created around the data. An initial view is set up in a window size of 640 \\times 480 pixels. Since the dolly command moves the camera towards the data, the clipping planes are reset to insure that the isosurface is completely visible. Figure 12-2 shows the resulting image of the patient's skin.

              We can improve this visualization in a number of ways. First, we can choose a more appropriate color (and other surface properties) for the skin. We use the vtkProperty method SetDiffuseColor() to set the skin color to a fleshy tone. We also add a specular component to the skin surface. Next, we can add additional isosurfaces corresponding to various anatomical features. Here we choose to extract the bone surface by adding an additional pipeline segment. This consists of the filters vtkMarchingCubes, vtkPolyDataMapper, and vtkActor, just as we did with the skin. Finally, to improve rendering performance on our system, we create triangle strips from the output of the contouring process. This requires adding vtkStripper.

              Figure 12-3. Skin and bone isosurfaces. See MedicalDemo2.cxx and MedicalDemo2.py.

              Figure 12-3 shows the resulting image, and the following is the C++ code for the pipeline.

              vtkActor *skin = vtkActor::New();\n  skin->SetMapper(skinMapper);\n  skin->GetProperty()->SetDiffuseColor(1, .49, .25);\n  skin->GetProperty()->SetSpecular(.3);\n  skin->GetProperty()->SetSpecularPower(20);\n  skin->GetProperty()->SetOpacity(1.0);\n\nvtkContourFilter *boneExtractor = vtkContourFilter::New();\n  boneExtractor->SetInputConnection(v16->GetOutputPort());\n  boneExtractor->SetValue(0, 1150);\n\nvtkPolyDataNormals *boneNormals = vtkPolyDataNormals::New();\n  boneNormals->SetInputConnection(boneExtractor->GetOutputPort());\n  boneNormals->SetFeatureAngle(60.0);\n\nvtkStripper *boneStripper = vtkStripper::New();\n  boneStripper->SetInputConnection(boneNormals->GetOutputPort());\n\nvtkPolyDataMapper *boneMapper = vtkPolyDataMapper::New();\n  boneMapper->SetInputConnection(boneStripper->GetOutputPort());\n  boneMapper->ScalarVisibilityOff();\n\nvtkActor *bone = vtkActor::New(); bone->SetMapper(boneMapper);\n  bone->GetProperty()->SetDiffuseColor(1, 1, .9412);\n

              The Visualization Toolkit provides other useful techniques besides isocontouring for exploring volume data. One popular technique used in medical imaging is to view orthogonal slices, or planes, through the data. Because computer graphics hardware supports texture mapping, an approach using texture mapping gives the best result in terms or interactive performance.

              We will extract three orthogonal planes corresponding to the axial, sagittal, and coronal cross sections that are familiar to radiologists. The axial plane is perpendicular to the patient's neck, sagittal passes from left to right, and coronal passes from front to back. For illustrative purposes, we render each of these planes with a different color lookup table. For the sagittal plane, we use a gray scale. The coronal and axial planes vary the saturation and hue table, respectively. We combine this with a translucent rendering of the skin (we turn off the bone with the C++ statement bone->VisibilityOff() ). The following VTK code creates the three lookup tables that is used in the texture mapping process.

              vtkLookupTable *bwLut = vtkLookupTable::New();\n  bwLut->SetTableRange (0, 2000);\n  bwLut->SetSaturationRange (0, 0);\n  bwLut->SetHueRange (0, 0);\n  bwLut->SetValueRange (0, 1);\n\nvtkLookupTable *hueLut = vtkLookupTable::New();\n  hueLut->SetTableRange (0, 2000);\n  hueLut->SetHueRange (0, 1);\n  hueLut->SetSaturationRange (1, 1);\n  hueLut->SetValueRange (1, 1);\n\nvtkLookupTable *satLut = vtkLookupTable::New();\n  satLut->SetTableRange (0, 2000);\n  satLut->SetHueRange (.6, .6);\n  satLut->SetSaturationRange (0, 1);\n  satLut->SetValueRange (1, 1);\n
              Figure 12-4. Composite image of three planes and translucent skin. See MedicalDemo3.cxx and MedicalDemo3.py.

              The image data is mapped to colors using the filter vtkImageMapToColors in combination with the lookup tables created above. The actual display of the slice is performed with vtkImageActor (see \"Assemblies and Other Types of vtkProp\" in Chapter 3 for more information). This class conveniently combines a quadrilateral, polygon plane with a texture map. vtkImageActor requires image data of type unsigned char, which the class vtkImageMapToColors conveniently provides. To avoid copying the data and to specify the 2D texture to use, the DisplayExtent of each vtkImageActor is set appropriately. The C++ code is as follows:

              // saggital\nvtkImageMapToColors *saggitalColors = vtkImageMapToColors::New();\n  saggitalColors->SetInputConnection(v16->GetOutputPort());\n  saggitalColors->SetLookupTable(bwLut);\n\nvtkImageActor *saggital = vtkImageActor::New();\n  saggital->SetInputConnection(saggitalColors->GetOutputPort());\n  saggital->SetDisplayExtent(32,32, 0,63, 0,92);\n\n// axial\nvtkImageMapToColors *axialColors = vtkImageMapToColors::New();\n  axialColors->SetInputConnection(v16->GetOutputPort());\n  axialColors->SetLookupTable(hueLut);\n\nvtkImageActor *axial = vtkImageActor::New();\n  axial->SetInputConnection(axialColors->GetOutputPort());\n  axial->SetDisplayExtent(0,63, 0,63, 46,46);\n\n// coronal\nvtkImageMapToColors *coronalColors = vtkImageMapToColors::New();\n  coronalColors->SetInputConnection(v16->GetOutputPort());\n  coronalColors->SetLookupTable(satLut);\n\nvtkImageActor *coronal = vtkImageActor::New();\n  coronal->SetInputConnection(coronalColors->GetOutputPort());\n  coronal->SetDisplayExtent(0,63, 32,32, 0,92);\n\naRenderer->AddActor(outline);\naRenderer->AddActor(saggital);\naRenderer->AddActor(axial);\naRenderer->AddActor(coronal);\naRenderer->AddActor(bone);\naRenderer->AddActor(skin);\n

              Figure 12-4 shows the resulting composite image.

              In this example, the actor named skin is rendered last because we are using a translucent surface. Recall from \"Transparency and Alpha Values\" in Chapter 7 that we must order the polygons composing transparent surfaces for proper results. We render the skin last by adding it to aRenderer's actor list last.

              We need to make one last point about processing medical imaging data. Medical images can be acquired in a variety of orders that refer to the relationship of consecutive slices to the patient. Radiologists view an image as though they were looking at the patient's feet. This means that on the display, the patient's left appears on the right. For CT there are two standard orders: top to bottom or bottom to top. In a top to bottom acquisition, slice i is farther from the patient's feet than slice i - 1. Why do we worry about this order? It is imperative in medical applications that we retain the left / right relationship. Ignoring the slice acquisition order can result in a flipping of left and right. To correct this, we need to transform either the original dataset or the geometry we have extracted. (See \"Exercises\" in this Chapter for more information.) Also, you may wish to examine the implementation of the classes vtkVolume16Reader and vtkVolumeReader (the superclass of vtkVolume16Reader). These classes have special methods that deal with transforming image data.

              "},{"location":"VTKBook/12Chapter12/#122-creating-models-from-segmented-volume-data","title":"12.2 Creating Models from Segmented Volume Data","text":"

              The previous example described how to create models from gray-scale medical imaging data. The techniques for extracting bone and skin models is straightforward compared to the task of generating models of other soft tissue. The reason is that magnetic resonance and, to some extent, computed tomography, generates similar gray-scale values for different tissue types. For example, the liver and kidney in a medical computed tomography volume often have overlapping intensities. Likewise, many different tissues in the brain have overlapping intensities when viewed with magnetic resonance imaging. To deal with these problems researchers apply a process called segmentation to identify different tissues. These processes vary in sophistication from almost completely automatic methods to manual tracing of images. Segmentation continues to be a hot research area. Although the segmentation process itself is beyond the scope of this text, in this case study we show how to process segmented medical data.

              For our purposes we assume that someone (or many graduate students) have laboriously labeled each pixel in each slice of a volume of data with a tissue identifier. This identifier is an integer number that describes which tissue class each pixel belongs to. For example, we may be given a series of MRI slices of the knee with tissue numbers defining the meniscus, femur, muscles, and so forth. Figure 12-5 shows two representations of a slice from a volume acquired from a patient's knee. The image on the left is the original MRI slice; the image on the right contains tissue labels for a number of important organs. The bottom image is a composite of the two images. Figure 12-5. Magnetic Resonance Image of a knee(left); segmented tissue(right); composite (bottom).(Data and segmentation courtesy of Brigham and Women's Hospital Surgical Planning Lab.)

              Notice the difference in the information presented by each representation. The original slice shows gradual changes at organ borders, while the segmented slice has abrupt changes. The images we processed in the previous CT example used marching cubes isocontouring algorithm and an intensity threshold to extract the isosurfaces. The segmented study we present has integer labels that have a somewhat arbitrary numeric value. Our goal in this example is to somehow take the tissue labels and create grayscale slices that we can process with the same techniques we used previously. Another goal is to show how image processing and visualization can work together in an application.

              The Virtual Frog

              To demonstrate the processing of segmented data we will use a dataset derived from a frog. This data was prepared at Lawrence Berkeley National Laboratories and is included with their permission on the CD-ROM accompanying this book. The data was acquired by physically slicing the frog and photographing the slices. The original segmented data is in the form of tissue masks with one file per tissue. There are 136 slices per tissue and 15 different tissues. Each slice is 470 by 500 pixels. (To accommodate the volume readers we have in VTK, we processed the mask files and combined them all in one file for each slice.) We used integer numbers 1-15 to represent the 15 tissues. Figure 12-6 shows an original slice, a labeled slice, and a composite of the two representations. Figure 12-6. Photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow. See FrogSlice.py.

              Before we describe the process to go from binary labeled tissues to gray-scale data suitable for isosurface extraction, compare the two images of the frog's brain shown in Figure 12-7. On the left is a surface extracted using a binary labeling of the brain. The right image was created using the visualization pipeline that we will develop in this example.

              Developing a Strategy

              In the last example, we used C++ and created a program that was tailored to extract two surfaces: one of the skin and one of the bone. All the parameters for the surface extraction were hard-coded in the source. Since our frog has 15 different tissues; we seek a more general solution to this problem. We may have to experiment with a number of different parameters for a number of visualization and imaging filters. Our goal is to develop a general pipeline that will work not only our 15 tissues but on other medical datasets as well. We'll design the program to work with a set of user-specified parameters to control the elements of the pipeline. A reasonable description might look like:

              STUDY = 'frogTissue'\nSLICE_ORDER = 'hfsi'\nROWS = 470\nCOLUMNS = 500\nPIXEL_SIZE = 1\nSPACING = 1.5\n

              plus possibly many more parameters to control decimation, smoothing, and so forth. Working in C++, we would have to design the format of the file and write code to interpret the statements.

              We make the job easier here by using Python. Another decision is to separate the modelling from the rendering. However, in order to simplify things we will be using one Python script, FrogReconstruction.py.

              In the real world, our script would be modified to generate models in a \"batch\" mode. If this is done, we would run run one VTK Python script for each tissue. That script will create a .vtk output file containing the polygonal representation of each tissue. Later, we would render the models with a separate script.

              Overview of the Pipeline

              Figure 12-8 shows the design of the pipeline. This generic pipeline has been developed over the years in our laboratory and in the Brigham and Women's Hospital Surgical Planning Lab. We find that it produces reasonable models from segmented datasets. Do not be intimidated by the number of filters (twelve in all). Before we developed VTK, we did similar processing with a hodgepodge of programs all written with different interfaces. We used intermediate files to pass data from one filter to the next. The new pipeline, implemented in VTK, is more efficient in time and computing resources.

              We use the convention that user-specified variables are in capital letters. First we show the elements of the pipeline and subsequently show sample functions that extract 3D models of the frog's tissues.

              Figure 12-7. The frog's brain. Model extracted without smoothing (left) and with smoothing (right). See FrogBrain.py.

              Read the Segmented Volume Data

              We assume here that all the data to be processed was acquired with a constant center landmark. In VTK, the origin of the data applies to the lower left of an image volume. In this pipeline, we calculate the origin such that the x,y center of the volume will be (0,0). The DataSpacing describes the size of each pixel and the distance between slices. DataVOI selects a volume of interest (VOI). A VOI lets us select areas of interest, sometimes eliminating extraneous structures like the CT table bed. For the frog, we have written a small C program that reads the tissue label file and finds the volume of interest for each tissue.

              The SetTransform() method defines how to arrange the data in memory. Medical images can be acquired in a variety of orders. For example, in CT, the data can be gathered from top to bottom (superior to inferior), or bottom to top (inferior to superior). In addition, MRI data can be acquired from left to right, right to left, front-to-back (anterior to posterior) or back-to-front. This filter transforms triangle vertices such that the resulting models will all \"face\" the viewer with a view up of (0,-1,0), looking down the positive z axis. Also, proper left-right correspondence will be maintained. That means the patient's left will always be left on the generated models. Look in SliceOrder.tcl to see the permutations and rotations for each order.

              In the example, we have created a class called \\texttt{SliceOrder} which handles the permutations and rotations for each order.

              We will be using a [vtkMetaImageReader](https://www.vtk.org/doc/nightly/html/classvtkMetaImageReader.html#details)() instead of the [vtkPNMReader](https://www.vtk.org/doc/nightly/html/classvtkPNMReader.html#details)() since the data has been collected into metaa-image files. This means that we will apply the transform later in the pipeline.

              All the other parameters are self-explanatory.

              Figure 12-8. The segmented volume to triangle pipeline. Volume passes through image pipeline before isosurface extraction..
                  reader = vtk.vtkMetaImageReader()\n    reader.SetFileName(str(fn))\n    reader.SetDataSpacing(data_spacing)\n    reader.SetDataOrigin(data_origin)\n    reader.SetDataExtent(voi)\n    reader.Update()\n

              Remove Islands

              Some segmentation techniques, especially those that are automatic, may generate islands of misclassified voxels. This filter looks for connected pixels with the ISLAND_REPLACE label, and if the number of connected pixels is less than ISLAND_AREA, it replaces them with the label TISSUE. Note that this filter is only executed if ISLAND_REPLACE is positive.

                  last_connection = reader\n    if tissue['ISLAND_REPLACE'] >= 0:\n        island_remover = vtk.vtkImageIslandRemoval2D()\n        island_remover.SetAreaThreshold(tissue['ISLAND_AREA'])\n        island_remover.SetIslandValue(tissue['ISLAND_REPLACE'])\n        island_remover.SetReplaceValue(tissue['TISSUE'])\n        island_remover.SetInput(last_connection.GetOutput())\n        island_remover.Update()\n        last_connection = island_remover\n

              Select a Tissue

              The rest of the pipeline requires gray-scale data. To convert the volume that now contains integer tissue labels to a gray-scale volume containing only one tissue, we use the threshold filter to set all pixels with the value TISSUE (the tissue of choice for this pipeline) to 255 and all other pixels to 0. The choice of 255 is somewhat arbitrary.

                  select_tissue = vtk.vtkImageThreshold()\n    select_tissue.ThresholdBetween(tissue['TISSUE'], tissue['TISSUE'])\n    select_tissue.SetInValue(255)\n    select_tissue.SetOutValue(0)\n    select_tissue.SetInputConnection(last_connection.GetOutputPort())\n

              Resample the Volume

              Lower resolution volumes produce fewer polygons. For experimentation we often reduce the resolution of the data with this filter. However, details can be lost during this process. Averaging creates new pixels in the resampled volume by averaging neighboring pixels. If averaging is turned off, every SAMPLE_RATE pixel will be passed through to the output.

                  shrinker = vtk.vtkImageShrink3D()\n    shrinker.SetInputConnection(select_tissue.GetOutputPort())\n    shrinker.SetShrinkFactors(tissue['SAMPLE_RATE'])\n    shrinker.AveragingOn()\n    last_connection = shrinker\n

              Smooth the Volume Data

              To this point, unless we have resampled the data, the volume is labeled with a value of 255 in pixels of the selected tissue and 0 elsewhere. This \"binary\" volume would produce stepped surfaces if we did not blur it. The Gaussian kernel specified in this filter accomplishes the smoothing we require to extract surfaces. The amount of smoothing is controlled by GAUSSIAN_STANDARD_DEVIATION that can be independently specified for each axis of the volume data. We only run this filter if some smoothing is requested,

                  if not all(v == 0 for v in tissue['GAUSSIAN_STANDARD_DEVIATION']):\n        gaussian = vtk.vtkImageGaussianSmooth()\n        gaussian.SetStandardDeviation(*tissue['GAUSSIAN_STANDARD_DEVIATION'])\n        gaussian.SetRadiusFactors(*tissue['GAUSSIAN_RADIUS_FACTORS'])\n        gaussian.SetInputConnection(shrinker.GetOutputPort())\n        last_connection = gaussian\n

              Generate Triangles

              Now we can process the volume with an iso-surface generator just as though we had obtained gray-scale data from a scanner. We added a few more bells and whistles to the pipeline. The filter runs faster if we turn off gradient and normal calculations. The generator normally calculates vertex normals from the gradient of the volume data. In our pipeline, we have concocted a gray-scale representation and will subsequently decimate the triangle mesh and smooth the resulting vertices. This processing invalidates the normals that are calculated by the generator.

                  if flying_edges:\n        iso_surface = vtk.vtkFlyingEdges3D()\n        iso_surface.SetInputConnection(last_connection.GetOutputPort())\n        iso_surface.ComputeScalarsOff()\n        iso_surface.ComputeGradientsOff()\n        iso_surface.ComputeNormalsOff()\n        iso_surface.SetValue(0, iso_value)\n

              Transform the Data We need to transform the data so the appropriate orientation is displayed.

                  so = SliceOrder()\n    transform = so.get('hfap')\n    transform.Scale(1, -1, 1)\n    tf = vtk.vtkTransformPolyDataFilter()\n    tf.SetTransform(transform)\n    tf.SetInputConnection(iso_surface.GetOutputPort())\n

              Reduce the Number of Triangles

              There are often many more triangles generated by the isosurfacing algorithm than we need for rendering. Here we reduce the triangle count by eliminating triangle vertices that lie within a user-specified distance to the plane formed by neighboring vertices. We preserve any edges of triangles that are considered \"features.\"

                  decimator = vtk.vtkDecimatePro()\n    decimator.SetInputConnection(tf.GetOutputPort())\n    decimator.SetFeatureAngle(tissue['DECIMATE_ANGLE'])\n    decimator.MaximumIterations = tissue['DECIMATE_ITERATIONS']\n    decimator.PreserveTopologyOn()\n    decimator.SetErrorIsAbsolute(1)\n    decimator.SetAbsoluteError(tissue['DECIMATE_ERROR'])\n    decimator.SetTargetReduction(tissue['DECIMATE_REDUCTION'])\n

              Smooth the Triangle Vertices

              This filter uses Laplacian smoothing described in \"Mesh Smoothing\" in Chapter 9 to adjust triangle vertices as an \"average\" of neighboring vertices. Typically, the movement will be less than a voxel.

              Of course we have already smoothed the image data with a Gaussian kernel so this step may not give much improvement; however, models that are heavily decimated can sometimes be improved with additional polygonal smoothing.

                  smoother = vtk.vtkSmoothPolyDataFilter()\n    smoother.SetInputConnection(decimator.GetOutputPort())\n    smoother.SetNumberOfIterations(tissue['SMOOTH_ITERATIONS'])\n    smoother.SetRelaxationFactor(tissue['SMOOTH_FACTOR'])\n    smoother.SetFeatureAngle(tissue['SMOOTH_ANGLE'])\n    smoother.FeatureEdgeSmoothingOff()\n    smoother.BoundarySmoothingOff()\n    smoother.SetConvergence(0)\n

              Generate Normals

              To generate smooth shaded models during rendering, we need normals at each vertex. As in decimation, sharp edges can be retained by setting the feature angle.

                  normals = vtk.vtkPolyDataNormals()\n    normals.SetInputConnection(smoother.GetOutputPort())\n    normals.SetFeatureAngle(tissue['FEATURE_ANGLE'])\n

              Generate Triangle Strips

              Triangle strips are a compact representation of large numbers of triangles. This filter processes our independent triangles before we write them to a file.

                  stripper = vtk.vtkStripper()\n    stripper.SetInputConnection(normals.GetOutputPort())\n

              Write the Triangles to a File

              Finally, if we were writing the triangle strips to a file, the last component of the pipeline would be:

                  writer = vtk.vtkPolyDataWriter()\n    writer.SetInputConnection(stripper.GetOutputPort())\n    writer.SetFileName(NAME + '.vtk')\n

              Execute the Pipeline

              If you have gotten this far in the book, you know that the Visualization Toolkit uses a demand-driven pipeline architecture and so far we have not demanded anything. We have just specified the pipeline topology and the parameters for each pipeline element. So we need to trigger the updating of the pipeline.

              If you are displaying the image then:

                  render_window.Render()\n

              If you are just writing to a file:

                  writer.Update()\n

              causes the pipeline to execute. In practice we do a bit more than just Update the last element of the pipeline. We explicitly Update each element so that we can time the individual steps.

              Specifying Parameters for the Pipeline

              All of the variables mentioned above must be defined for each tissue to be processed. The parameters fall into two general categories. Some are specific to the particular study while some are specific to each tissue. For the frog, we collected the study-specific parameters in a function that contains:

              def frog():\n    p = default_parameters()\n    p['ROWS'] = 470\n    p['COLUMNS'] = 500\n    p['STUDY'] = 'frogTissue'\n    p['SLICE_ORDER'] = 'si'\n    p['PIXEL_SIZE'] = 1\n    p['SPACING'] = 1.5\n    p['VALUE'] = 127.5\n    p['SAMPLE_RATE'] = [1, 1, 1]\n    p['GAUSSIAN_STANDARD_DEVIATION'] = [2, 2, 2]\n    p['DECIMATE_REDUCTION'] = 0.95\n    p['DECIMATE_ITERATIONS'] = 5\n    p['DECIMATE_ERROR'] = 0.0002\n    p['DECIMATE_ERROR_INCREMENT'] = 0.0002\n    p['SMOOTH_ITERATIONS'] = 0\n    p['SMOOTH_FACTOR'] = 0.1\n    return p\n

              There is a specific function for each tissue type. This tissue-specific function reads in the frog-specific parameters, sets the tissue-specific parameters. For example, liver()) contains:

              def liver():\n    p = frog()\n    p['NAME'] = 'liver'\n    p['TISSUE'] = 10\n    p['START_SLICE'] = 25\n    p['END_SLICE'] = 126\n    p['VOI'] = [167, 297, 154, 304, p['START_SLICE'], p['END_SLICE']]\n    return p\n

              Parameters in the function frog() can also be overridden. For example, skeleton() overrides the standard deviation for the Gaussian filter.

              def skeleton():\n    p = frog()\n    p['STUDY'] = 'frogTissue'\n    p['NAME'] = 'skeleton'\n    p['TISSUE'] = 13\n    p['VALUE'] = 64.5\n    p['START_SLICE'] = 1\n    p['END_SLICE'] = 136\n    p['VOI'] = [23, 479, 8, 469, p['START_SLICE'], p['END_SLICE']]\n    p['GAUSSIAN_STANDARD_DEVIATION'] = [1.5, 1.5, 1]\n    return p\n

              Note that both of these examples specify a volume of interest. This improves performance of the imaging and visualization algorithms by eliminating empty space.

              Another function, skin(), uses similar parameters, it is used to extract the skin. Island removal or threshold pipeline elements are not needed since the data is already has gray-scale information.

              After the usual code to create required rendering objects, a single statement for each part creates an actor that we can add to the renderer:

                      t, actor = create_frog_actor(frog_fn, frog_tissue_fn, tissue, flying_edges, lut)\n        ict[name] = t\n        renderer.AddActor(actor)\n

              The rest of the script defines a standard view.

                  # Initial view (looking down on the dorsal surface).\n    renderer.GetActiveCamera().Roll(-90)\n    renderer.ResetCamera()\n

              Conclusion

              This lengthy example shows the power of a comprehensive visualization system like VTK.

              • We mixed image processing and computer graphics algorithms to process data created by an external segmentation process.
              • We developed a generic approach that allows users to control the elements of the pipeline with a familiar scripting language, Python.
              • We can easily separate this script into a \"batch\" portion and an \"interactive\" portion.

              If .vtk files have been created we can use an alternative Python script called Frog.py. This takes the vtk models corresponding to the .vtk file and renders them.

              These programs:

              • FrogReconstruction.py
              • Frog.py

              allow the user specify what tissues to display and also provide some pre-defined views.

              Figure12-9 shows four views of the frog.

              (a) All frog parts and translucent skin. (b) The complete frog without skin. (c) No skin or skeleton. (d) A view from the top. How good is your biology? Figure 12-9. Various frog images. See Frog.py.

              Other Frog-Related Information

              The folks at Lawrence Berkeley National Laboratory have an impressive Web site that features the frog used in this example. The site describes how the frog data was obtained and also permits users to create mpeg movies of the frog. There are also other datasets available. Further details on \"The Whole Frog Project\" can be found at http://www-itg.lbl.gov/Frog. Also, the Stanford University Medical Media and Information Technologies (SUMMIT) group has on-going work using the Berkeley frog. They are early VTK users.

              "},{"location":"VTKBook/12Chapter12/#123-financial-visualization","title":"12.3 Financial Visualization","text":"

              The application of 3D visualization techniques to financial data is relatively new. Historically, financial data has been represented using 2D plotting techniques such as line, scatter plots, bar charts, and pie charts. These techniques are especially well suited for the display of price and volume information for stocks, bonds, and mutual funds. Three-dimensional techniques are becoming more important due to the increased volume of information in recent years, and 3D graphics and visualization techniques are becoming interactive. Interactive rates mean that visualization can be applied to the day-to-day processing of data. Our belief is that this will allow deeper understanding of today's complex financial data and other more timely decisions.

              In this example we go through the process of obtaining data, converting it to a form that we can use, and then using visualization techniques to view it. Some of the external software tools used in this example may be unfamiliar to you. This should not be a large concern. We have simply chosen the tools with which we are familiar. Where we have used an Awk script, you might choose to write a small C program to do the same thing. The value of the example lies in illustrating the high-level process of solving a visualization problem.

              The first step is to obtain the data. We obtained our data from a public site on the World Wide Web (WWW) that archives stock prices and volumes for many publicly traded stocks. (This Web site has closed down since publication of the first edition. The data for this example are available on the CD-ROM.)

              Once we have obtained the data, we convert it to a format that can be read into VTK. While VTK can read in a variety of data formats, frequently your data will not be in one of those. The data files we obtained are stored in the following format:

              930830 49.375 48.812 49.250 1139.2 56.1056 930831 49.375 48.938 49.125\n1360.4 66.8297 930902 49.188 48.688 48.750 1247.2 60.801 ...\n

              Each line stores the data for one day of trading. The first number is the date, stored as the last two digits of the year, followed by a two-digit month and finally the day of the month. The next three values represent the high, low, and closing price of the stock for that day. The next value is the volume of trading in thousands of shares. The final value is the volume of trading in millions of dollars.

              We used an Awk script to convert the original data format into a VTK data file. (See the VTK User's Guide for information on VTK file formats; or see VTK File Formats.) This conversion could be done using many other approaches, such as writing a C program or a Tcl script.

              BEGIN {print \"# vtk DataFile Version 2.0\\n\nData values for stocknASCII\\\\n\\\\nDATASET POLYDATA\"}\n{count += 1}\n{ d = $1%100}\n{ m = int(($1%10000)/100)}\n{ if (m == 2) d += 31}\n{ if (m == 3) d += 59}\n{ if (m == 4) d += 90}\n{ if (m == 5) d += 120}\n{ if (m == 6) d += 151}\n{ if (m == 7) d += 181}\n{ if (m == 8) d += 212}\n{ if (m == 9) d += 243}\n{ if (m == 10) d += 273}\n{ if (m == 11) d+= 304}\n{ if (m == 12) d += 334}\n{ d = d + (int($1/10000) - 93)*365}\n{dates[count] = d; prices[count] = $4; volumes[count] = $5}\nEND {\n    print \"POINTS \" count \" float\";\n    for (i = 1; i <= count; i++) print dates[i] \" \" prices[i] \" 0 \";\n    print \"\\nLINES 1 \" (count + 1) \" \" count;\n    for (i = 0; i \\< count; i++) print i;\n    print \"\\nPOINT_DATA \" count \"\\nSCALARS volume float\";\n    print \"LOOKUP\\_TABLE default\";\n    for (i = 1; i \\<= count; i++) print volumes\\[i\\];\n}\n

              The above Awk script performs the conversion. Its first line outputs the required header information indicating that the file is a VTK data file containing polygonal data. It also includes a comment indicating that the data represents stock values. There are a few different VTK data formats that we could have selected. It is up to you to decide which format best suits the data you are visualizing. We have judged the polygonal format ( vtkPolyData ) as best suited for this particular stock visualization.

              The next line of the Awk script creates a variable named count that keeps track of how many days worth of information is in the file. This is equivalent to the number of lines in the original data file.

              The next fourteen lines convert the six digit date into a more useful format, since the original format has a number of problems. If we were to blindly use the original format and plot the data using the date as the independent variable, there would be large gaps in our plot. For example, 931231 is the last day of 1993 and 940101 is the first day of 1994. Chronologically, these two dates are sequential, but mathematically there are (940101-931231=8870 values between them. A simple solution would be to use the line number as our independent variable. This would work as long as we knew that every trading day was recorded in the data file. It would not properly handle the situation where the market was open, but for some reason data was not recorded. A better solution is to convert the dates into numerically ordered days. The preceding Awk script sets January 1, 1993, as day number one, and then numbers all the following days from there. At the end of these 14 lines the variable, d, will contain the resulting value.

              The next line in our Awk script stores the converted date, closing price, and dollar volume into arrays indexed by the line number stored in the variable count. Once all the lines have been read and stored into the arrays, we write out the rest of the VTK data file. We have selected the date as our independent variable and x coordinate. The closing price we store as the y coordinate, and the z coordinate we set to zero. After indicating the number and type of points to be stored, the Awk script loops through all the points and writes them out to the VTK data file. It then writes out the line connectivity list. In this case we just connect one point to the next to form a polyline for each stock. Finally, we write out the volume information as scalar data associated with the points. Portions of the resulting VTK data file are shown below.

              # vtk DataFile Version 2.0\nData values for stock\nASCII\n\nDATASET POLYDATA\nPOINTS 348 float\n242 49.250 0\n243 49.125 0\n245 48.750 0\n246 48.625 0\n...\n\nLINES 1 349 348\n0\n1\n2\n3\n...\n\nPOINT_DATA 348\nSCALARS volume float\nLOOKUP_TABLE default\n1139.2\n1360.4\n1247.2\n1745.4\n

              Now that we have generated the VTK data file, we can start the process of creating a visualization for the stock data. To do this, we wrote a Tcl script to be used with the Tcl-based VTK executable. At a high level the script reads in the stock data, sends it through a tube filter, creates a label for it, and then creates an outline around the resulting dataset. Ideally, we would like to display multiple stocks in the same window. To facilitate this, we designed the Tcl script to use a procedure to perform operations on a per stock basis. The resulting script is listed below.

              #!/usr/bin/env python\nimport os\nimport vtk\n\ndef main():\n    colors = vtk.vtkNamedColors()\n    fileNames = ['GE.vtk', 'GM.vtk', 'IBM.vtk', 'DEC.vtk']\n    # Set up the stocks\n    renderers = list()\n    topRenderer = vtk.vtkRenderer()\n    bottomRenderer = vtk.vtkRenderer()\n    renderers.append(topRenderer)\n    renderers.append(bottomRenderer)\n\n    # create the outline\n    apf = vtk.vtkAppendPolyData()$\\index{vtkAppendPolyData!application}$\n    olf = vtk.vtkOutlineFilter()$\\index{vtkOutlineFilter!application}$\n    olf.SetInputConnection(apf.GetOutputPort())\n    outlineMapper = vtk.vtkPolyDataMapper()\n    outlineMapper.SetInputConnection(olf.GetOutputPort())\n    outlineActor = vtk.vtkActor()\n    outlineActor.SetMapper(outlineMapper)\n\n    zPosition = 0.0\n    for fn in fileNames:\n        zPosition = AddStock(renderers, apf, fn,\n            os.path.basename((os.path.splitext(fn)[0])), zPosition)\n\n    # Setup the render window and interactor.\n    renderWindow = vtk.vtkRenderWindow()\n    renderWindow.AddRenderer(renderers[0])\n    renderWindow.AddRenderer(renderers[1])\n    renderWindowInteractor = vtk.vtkRenderWindowInteractor()\n    renderWindowInteractor.SetRenderWindow(renderWindow)\n\n    renderers[0].SetViewport(0.0, 0.4, 1.0, 1.0)\n    renderers[1].SetViewport(0.0, 0.0, 1.0, 0.4)\n    renderers[0].GetActiveCamera().SetViewAngle(5.0)\n    renderers[0].ResetCamera()\n    renderers[0].GetActiveCamera().Zoom(1.4)\n    renderers[0].ResetCameraClippingRange()\n    renderers[0].SetBackground(colors.GetColor3d(\"SteelBlue\"))\n    renderers[1].GetActiveCamera().SetViewUp(0, 0, -1)\n    renderers[1].GetActiveCamera().SetPosition(0, 1, 0)\n    renderers[1].GetActiveCamera().SetViewAngle(5.0)\n    renderers[1].ResetCamera()\n    renderers[1].GetActiveCamera().Zoom(2.2)\n    renderers[1].ResetCameraClippingRange()\n    renderers[1].SetBackground(colors.GetColor3d(\"LightSteelBlue\"))\n    renderers[0].AddActor(outlineActor)\n    renderers[1].AddActor(outlineActor)\n\n    renderWindow.SetSize(500, 800)\n    renderWindow.Render()\n\n    renderWindowInteractor.Start()\n\n\ndef AddStock(renderers, apf, filename, name, zPosition):\n    # Read the data\n    PolyDataRead = vtk.vtkPolyDataReader()\n    PolyDataRead.SetFileName(filename)\n    PolyDataRead.Update()\n    TubeFilter = vtk.vtkTubeFilter()$\\index{vtkTubeFilter!application}$\n    TubeFilter.SetInputConnection(PolyDataRead.GetOutputPort())\n    TubeFilter.SetNumberOfSides(8)\n    TubeFilter.SetRadius(0.5)\n    TubeFilter.SetRadiusFactor(10000)\n    Transform = vtk.vtkTransform()$\\index{vtkTransform!application}$\n    Transform.Translate(0, 0, zPosition)\n    Transform.Scale(0.15, 1, 1)\n    TransformFilter = vtk.vtkTransformPolyDataFilter()\n    TransformFilter.SetInputConnection(TubeFilter.GetOutputPort())\n    TransformFilter.SetTransform(Transform)\n    # Create the labels.\n    TextSrc = vtk.vtkVectorText()$\\index{vtkVectorText!application}$\n    TextSrc.SetText(name)\n    numberOfPoints = PolyDataRead.GetOutput().GetNumberOfPoints()\n    nameIndex = int((numberOfPoints - 1) * 0.8)\n    nameLocation = PolyDataRead.GetOutput().GetPoint(nameIndex)\n    x = nameLocation[0] * 0.15\n    y = nameLocation[1] + 5.0\n    z = zPosition\n    apf.AddInputData(TransformFilter.GetOutput())\n    for r in range(0, len(renderers)):\n        LabelMapper = vtk.vtkPolyDataMapper()\n        LabelMapper.SetInputConnection(TextSrc.GetOutputPort())\n        LabelActor = vtk.vtkFollower()$\\index{vtkFollower!example}$\n        LabelActor.SetMapper(LabelMapper)\n        LabelActor.SetPosition(x, y, z)\n        LabelActor.SetScale(2, 2, 2)\n        LabelActor.SetOrigin(TextSrc.GetOutput().GetCenter())\n        # Increment zPosition.\n        zPosition += 8.0\n        StockMapper = vtk.vtkPolyDataMapper()\n        StockMapper.SetInputConnection(TransformFilter.GetOutputPort())\n        StockMapper.SetScalarRange(0, 8000)\n        StockActor = vtk.vtkActor()\n        StockActor.SetMapper(StockMapper)\n        renderers[r].AddActor(StockActor)\n        renderers[r].AddActor(LabelActor)\n        LabelActor.SetCamera(renderers[r].GetActiveCamera())\n    return zPosition\n\nif __name__ == '__main__':\n    main()\n

              The first part of this script consists of the standard procedure for renderer and interactor creation that can be found in almost all of the VTK Tcl scripts. The next section creates the objects necessary for drawing an outline around all of the stock data. A vtkAppendPolyData filter is used to append all of the stock data together. This is then sent through a vtkOutlineFilter to create a bounding box around the data. A mapper and actor are created to display the rIn the next part of this script, we define the procedure to add stock data to this visualization. The procedure takes five arguments: the name of the stock, the label we want displayed, and the x, y, z coordinates defining where to position the label. The first line of the procedure indicates that the variable ren1 should be visible to this procedure. By default the procedure can only access its own local variables. Next, we create the label using a vtkTextSource, vtkPolyDataMapper, and vtkFollower. The names of these objects are all prepended with the variable \" $prefix. \" so that the instance names will be unique. An instance of vtkFollower is used instead of the usual vtkActor, because we always want the text to be right-side up and facing the camera. The vtkFollower class provides this functionality. The remaining lines position and scale the label appropriately. We set the origin of the label to the center of its data. This insures that the follower will rotate about its center point.

              The next group of lines creates the required objects to read in the data, pass it through a tube filter and a transform filter, and finally display the result. The tube filter uses the scalar data (stock volume in this example) to determine the radius of the tube. The mapper also uses the scalar data to determine the coloring of the tube. The transform filter uses a transform object to set the stock's position based on the value of the variable zpos. For each stock, we will increment zpos by 10, effectively shifting the next stock over 10 units from the current stock. This prevents the stocks from being stacked on top of each other. We also use the transform to compress the x-axis to make the data easier to view. Next, we add this stock as an input to the append filter and add the actors and followers to the renderer. The last line of the procedure sets the follower's camera to be the active camera of the renderer.

              Back in the main body of the Tcl script, we invoke the AddStock procedure four times with four different stocks. Finally, we add the outline actor and customize the renderer and camera to four different stocks. Finally, we add the outline actor and customize the renderer and camera to produce a nice initial view. Two different views of the result are displayed in Figure 12-10. The top image shows a history of stock closing prices for our four stocks. The color and width of these lines correspond to the volume of the stock on that day. The lower image more clearly illustrates the changes in stock volume by looking at the data from above.

              Figure 12-10 Two views from the stock visualization script. The top shows closing price over time; the bottom shows volume over time ( stocks.tcl ).

              A legitimate complaint with Figure 12-10 is that the changing width of the tube makes it more difficult to see the true shape of the price verses the time curve. We can solve this problem by using a ribbon filter followed by a linear extrusion filter, instead of the tube filter. The ribbon filter will create a ribbon whose width will vary in proportion to the scalar value of the data. We then use the linear extrusion filter to extrude this ribbon along the y-axis so that it has a constant thickness. The resulting views are shown in Figure 12-11. Figure 12-11. Two more views of the stock case study. Here the tube filter has been replaced by a ribbon filter followed with a linear extrusion filter. See Stocks.cxx and Stocks.py."},{"location":"VTKBook/12Chapter12/#124-implicit-modelling","title":"12.4 Implicit Modelling","text":"

              The Visualization Toolkit has some useful geometric modelling capabilities. One of the most powerful features is implicit modelling. In this example we show how to use polygonal descriptions of objects and create \"blobby\" models of them using the implicit modelling objects in VTK. This example generates a logo for the Visualization Toolkit from polygonal representations of the letters v, t, and k.

              Figure 12-12. The visualization pipeline for the VTK blobby logo.

              We create three separate visualization pipelines, one for each letter. Figure 12-12 shows the visualization pipeline. As is common in VTK applications, we design a pipeline and fill in the details of the instance variables just before we render. We pass the letters through a vtkTransformPolyDataFilter to position them relative to each other. Then we combine all of the polygons from the transformed letters into one polygon dataset using the vtkAppendPolyData filter. The vtkImplicitModeller creates a volume dataset of dimension 643 with each voxel containing a scalar value that is the distance to the nearest polygon. Recall from \"Implicit Modelling\" in Chapter 6 that the implicit modelling algorithm lets us specify the region of influence of each polygon. Here we specify this using the SetMaximumDistance() method of the vtkImplicitModeller. By restricting the region of influence, we can significantly improve performance of the implicit modelling algorithm. Then we use vtkContourFilter to extract an isosurface that approximates a distance of 1.0 from each polygon. We create two actors: one for the blobby logo and one for the original polygon letters. Notice that both actors share the polygon data created by vtkAppendPolyData. Because of the nature of the VTK visualization pipeline (see \"Implicit Execution\" in Chapter 4), the appended data will only be created once by the portion of the pipeline that is executed first. As a final touch, we move the polygonal logo in front of the blobby logo. Now we will go through the example in detail.

              First, we read the geometry files that contain polygonal models of each letter in the logo. The data is in VTK polygonal format, so we use vtkPolyDataReader .

              vtkPolyDataReader *letterV = vtkPolyDataReader::New();\n  letterV->SetFileName (\"v.vtk\");\n\nvtkPolyDataReader *letterT = vtkPolyDataReader::New();\n  letterT->SetFileName (\"t.vtk\");\n\nvtkPolyDataReader *letterK = vtkPolyDataReader::New();\n  letterK->SetFileName (\"k.vtk\");\n

              We want to transform each letter into its appropriate location and orientation within the logo. We create the transform filters here, but defer specifying the location and orientation until later in the program.

              vtkTransform *VTransform = vtkTransform::New();\nvtkTransformPolyDataFilter *VTransformFilter =\n    vtkTransformPolyDataFilter::New();\n  VTransformFilter->SetInputConnection (letterV->GetOutputPort());\n  VTransformFilter->SetTransform (VTransform);\n\nvtkTransform *TTransform = vtkTransform::New();\nvtkTransformPolyDataFilter *TTransformFilter =\n    vtkTransformPolyDataFilter::New();\n  TTransformFilter->SetInputConnection (letterT->GetOutputPort());\n  TTransformFilter->SetTransform (TTransform);\n\nvtkTransform *KTransform = vtkTransform::New();\n  vtkTransformPolyDataFilter *KTransformFilter =\n    vtkTransformPolyDataFilter::New();\n  KTransformFilter->SetInputConnection (letterK->GetOutputPort());\n  KTransformFilter->SetTransform (KTransform);\n

              We collect all of the transformed letters into one set of polygons by using an instance of the class vtkAppendPolyData.

              vtkAppendPolyData *appendAll = vtkAppendPolyData::New();\n  appendAll->AddInputConnection (VTransformFilter->GetOutputPort());\n  appendAll->AddInputConnection (TTransformFilter->GetOutputPort());\n  appendAll->AddInputConnection (KTransformFilter->GetOutputPort());\n

              Since the geometry for each letter did not have surface normals, we add them here. We use vtkPolyDataNormals. Then we complete this portion of the pipeline by creating a mapper and an actor.

              // create normals\nvtkPolyDataNormals *logoNormals = vtkPolyDataNormals::New();\n  logoNormals->SetInputConnection (appendAll->GetOutputPort());\n  logoNormals->SetFeatureAngle (60);\n\n// map to rendering primitives\nvtkPolyDataMapper *logoMapper = vtkPolyDataMapper::New();\n  logoMapper->SetInputConnection (logoNormals->GetOutputPort());\n\n// now an actor\nvtkActor *logo = vtkActor::New();\n  logo->SetMapper (logoMapper);\n

              We create the blobby logo with the implicit modeller, and then extract the logo with vtkContourFilter. The pipeline is completed by creating a mapper and an actor.

              //  now create an implicit model of the letters vtkImplicitModeller\n*blobbyLogoImp = vtkImplicitModeller::New();\n  blobbyLogoImp->SetInputConnection (appendAll->GetOutputPort());\n  blobbyLogoImp->SetMaximumDistance (.075);\n  blobbyLogoImp->SetSampleDimensions (64,64,64);\n  blobbyLogoImp->SetAdjustDistance (0.05);\n\n//  extract an iso surface\nvtkContourFilter *blobbyLogoIso = vtkContourFilter::New();\n  blobbyLogoIso->SetInputConnection (blobbyLogoImp->GetOutputPort());\n  blobbyLogoIso->SetValue (1, 1.5);\n\n// map to rendering primitives\nvtkPolyDataMapper *blobbyLogoMapper = vtkPolyDataMapper::New();\n  blobbyLogoMapper->SetInputConnection (\n  blobbyLogoIso->GetOutputPort());\n  blobbyLogoMapper->ScalarVisibilityOff ();\n\n// now an actor\n\nvtkActor *blobbyLogo = vtkActor::New();\nblobbyLogo->SetMapper(blobbyLogoMapper);\nblobbyLogo->SetProperty (banana);\n

              To improve the look of our resulting visualization, we define a couple of organic colors. Softer colors show up better on some electronic media (e.g., VHS video tape) and are pleasing to the eye.

              vtkProperty *tomato = vtkProperty::New();\n tomato->SetDiffuseColor(1,.3882, .2784);\n tomato->SetSpecular(.3);\n tomato->SetSpecularPower(20);\n\nvtkProperty *banana = vtkProperty::New();\n banana->SetDiffuseColor(.89, .81, .34);\n banana->SetDiffuse (.7);\n banana->SetSpecular(.4);\n banana->SetSpecularPower(20);\n

              These colors are then assigned to the appropriate actors.

              Figure 12-13. A logo created with vtkImplicitModeller. See BlobbyLogo.cxx and BlobbyLogo.py.
              logo->SetProperty(tomato);\nblobbyLogo->SetProperty(banana);\n

              And finally, we position the letters in the logo and move the polygonal logo out in front of the blobby logo by modifying the actor's position.

              VTransform->Translate (-16,0,12.5);\nVTransform->RotateY (40);\n\nKTransform->Translate (14, 0, 0);\nKTransform->RotateY (-40);\n\n// move the polygonal letters to the front\nlogo->SetPosition(0,0,6);\n

              An image made from the techniques described in this section is shown in Figure 12-13 Note that the image on the left has been augmented with a texture map."},{"location":"VTKBook/12Chapter12/#125-computational-fluid-dynamics","title":"12.5 Computational Fluid Dynamics","text":"

              Computational Fluid Dynamics (CFD) visualization poses a challenge to any visualization toolkit. CFD studies the flow of fluids in and around complex structures. Often, large amounts of super-computer time is used to derive scalar and vector data in the flow field. Since CFD computations produce multiple scalar and vector data types, we will apply many of the tools described in this book. The challenge is to combine multiple representations into meaningful visualizations that extract information without overwhelming the user.

              There are a number of techniques we can use when we first look at the complex data presented by CFD applications. Since we need to apply several algorithms to the data, and since there will be many parameter changes for these algorithms, we suggest using the Tcl interpreter rather than C++ code. Our strategy for visualizing this CFD data includes the following:

              1. Display the computational grid. The analyst carefully constructed the finite difference grid to have a higher density in regions where rapid changes occur in the flow variables. We will display the grid in wireframe so we can see the computational cells.

              2. Display the scalar fields on the computational grid. This will give us an overview of where the scalar data is changing. We will experiment with the extents of the grid extraction to focus on interesting areas.

              3. Explore the vector field by seeding streamlines with a spherical cloud of points. Move the sphere through areas of rapidly changing velocity.

              4. Try using the computational grid itself as seeds for the streamlines. Of course we will have to restrict the extent of the grid you use for this purpose. Using the grid, we will be able to place more seeds in regions where the analyst expected more action.

              For this case study, we use a dataset from NASA called the LOx Post. It simulates the flow of liquid oxygen across a flat plate with a cylindrical post perpendicular to the flow [Rogers86]. This analysis models the flow in a rocket engine. The post promotes mixing of the liquid oxygen.

              We start by exploring the scalar and vector fields in the data. By calculating the magnitude of the velocity vectors, we derive a scalar field. This study has a particularly interesting vector field around the post. We seed the field with multiple starting points (using points arranged along a curve, referred to as a rake) and experiment with parameters for the streamlines. Streampolygons are particularly appropriate here and do a nice job of showing the flow downstream from the post. We animate the streamline creation by moving the seeding line or rake back and forth behind the post.

              Following our own advice, we first display the computational grid. The following Tcl code produced the right image of Figure 12-14.

              # read data\nvtkPLOT3DReader pl3d\n  pl3d SetXYZFileName \"$env(VTK_TEXTBOOK_DATA)/postxyz.bin\"\n  pl3d SetQFileName \"$env(VTK_TEXTBOOK_DATA)/postq.bin\"\n  pl3d IBlankingOn\n  pl3d Update\n# computational planes: the floor\nvtkStructuredGridGeometryFilter floorComp\n  floorComp SetExtent 0 37 0 75 0 0\n  floorComp SetInputConnection [pl3d GetOutputPort]\nvtkPolyDataMapper floorMapper\n  floorMapper SetInputConnection [floorComp GetOutputPort]\n  floorMapper ScalarVisibilityOff\nvtkActor floorActor\n  floorActor SetMapper floorMapper\n  [floorActor GetProperty] SetColor 0 0 0\n  [floorActor GetProperty] SetRepresentationToWireframe\n\n##   the post\nvtkStructuredGridGeometryFilter postComp\n  postComp SetExtent 10 10 0 75 0 37\n  postComp SetInputConnection [pl3d GetOutputPort]\nvtkPolyDataMapper postMapper\n  postMapper SetInputConnection [postComp GetOutputPort]\n  postMapper ScalarVisibilityOff\nvtkActor postActor\n  postActor SetMapper postMapper\n  [postActor GetProperty] SetColor 0 0 0\n  [postActor GetProperty] SetRepresentationToWireframe\n\n#   plane upstream of the flow\nvtkStructuredGridGeometryFilter fanComp\n  fanComp SetExtent 0 37 38 38 0 37\n  fanComp SetInputConnection [pl3d GetOutputPort]\nvtkPolyDataMapper fanMapper\n  fanMapper SetInputConnection [fanComp GetOutputPort]\n  fanMapper ScalarVisibilityOff\nvtkActor fanActor\n  fanActor SetMapper fanMapper\n  [fanActor GetProperty] SetColor 0 0 0\n  [fanActor GetProperty] SetRepresentationToWireframe\n\n#   outline\nvtkStructuredGridOutlineFilter outline\n  outline SetInputConnection [pl3d GetOutputPor]\nvtkPolyDataMapper outlineMapper\n  outlineMapper SetInputConnection [outline GetOutputPort]\nvtkActor outlineActor\n  outlineActor SetMapper outlineMapper\n  [outlineActor GetProperty] SetColor 0 0 0\n\n#   Create graphics stuff\nvtkRenderer ren1\nvtkRenderWindow renWin\n  renWin AddRenderer ren1\nvtkRenderWindowInteractor iren\n  iren SetRenderWindow renWin\n\n#   Add the actors to the renderer, set the background and size\n#\nren1 AddActor outlineActor\nren1 AddActor floorActor\nren1 AddActor postActor\nren1 AddActor fanActor\n
              Figure 12-14. Portion of computational grid for the LOx post. See LOxGrid.cxx and LOxGrid.py.

              To display the scalar field using color mapping, we must change the actor's representation from wireframe to surface, turn on scalar visibility for each vtkPolyDataMapper, set each mapper's scalar range, and render again, producing the right image of Figure 12-14.

              postActor SetRepresentationToSurface\nfanActor SetRepresentationToSurface\nfloorActor SetRepresentationToSurface\n\npostMapper ScalarVisibilityOn\npostMapper SetScalarRange [[pl3d GetOutput] GetScalarRange]\nfanMapper ScalarVisibilityOn\nfanMapper SetScalarRange [[pl3d GetOutput] GetScalarRange]\nfloorMapper ScalarVisibilityOn\nfloorMapper SetScalarRange [[pl3d GetOutput] GetScalarRange]\n

              Now, we explore the vector field using vtkPointSource. Recall that this object generates a random cloud of points around a spherical center point. We will use this cloud of points to generate stream-lines. We place the center of the cloud near the post since this is where the velocity seems to be changing most rapidly. During this exploration, we use streamlines rather than streamtubes for reasons of efficiency. The Tcl code is as follows.

              #   spherical seed points\nvtkPointSource rake\n  rake SetCenter -0.74 0 0.3\n  rake SetNumberOfPoints 10\nvtkStreamLine streamers\n  streamers SetInputConnection [pl3d GetOutputPort]\n  streamers SetSourceConnection [rake GetOutputPort]\n  streamers SetMaximumPropagationTime 250\n  streamers SpeedScalarsOn\n  streamers SetIntegrationStepLength .2\n  streamers SetStepLength .25\nvtkPolyDataMapper mapTubes\n  mapTubes SetInputConnection [streamers GetOutputPort]\n  eval mapTubes SetScalarRange [[pl3d GetOutput] GetScalarRange]\nvtkActor tubesActor\n  tubesActor SetMapper mapTubes\n
              Figure 12-15. Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown. See LOxSeeds.cxx and LOxSeeds.py.

              Figure 12-15 shows streamlines seeded from four locations along the post. Notice how the structure of the flow begins to emerge as the starting positions for the streamlines are moved up and down in front of the post. This is particularly true if we do this interactively; the mind assembles the behavior of the streamlines into a global understanding of the flow field. Figure 12-16. Streamtubes created by using the computational grid just in front of the post as a source for seeds. See LOx.cxx and LOx.py.

              For a final example, we use the computational grid to seed streamlines and then generate streamtubes as is shown in Figure 12-16. A nice feature of this approach is that we generate more streamlines in regions where the analyst constructed a denser grid. The only change we need to make is to replace the rake from the sphere source with a portion of the grid geometry.

              vtkStructuredGridGeometryFilter seedsComp\n  seedsComp SetExtent 10 10 37 39 1 35\n  seedsComp SetInput [pl3d GetOutput]\nstreamers SetSourceConnection [seedsComp GetOutputPort]\n\n#   create tubes\nvtkTubeFilter tubes\n  tubes SetInputConnection [streamers GetOutputPort]\n  tubes SetNumberOfSides 8\n  tubes SetRadius .08\n  tubes SetVaryRadiusOff\n#   change input to streamtubes\nmapTubes SetInputConnection [tubes GetOutputPort]\n

              There are a number of other methods we could use to visualize this data. A 3D widget such as the vtkLineWidget could be used to seed the streamlines interactively (see \"3D Widgets and User Interaction\" in Chapter 7). As we saw in \"Point Probe\" in Chapter 8, probing the data for numerical values is a valuable technique. In particular, if the probe is a line we can use it in combination with vtkXYPlotActor to graph the variation of data value along the line. Another useful visualization would be to identify regions of vorticity. We could use Equation9-12 in conjunction with an isocontouring algorithm (e.g., vtkContourFilter ) to creates isosurfaces of large helical-density.

              "},{"location":"VTKBook/12Chapter12/#126-finite-element-analysis","title":"12.6 Finite Element Analysis","text":"

              Finite element analysis is a widely used numerical technique for finding solutions of partial differential equations. Applications of finite element analysis include linear and nonlinear structural, thermal, dynamic, electromagnetic, and flow analysis. In this application we will visualize the results of a blow molding process.

              In the extrusion blow molding process, a material is extruded through an annular die to form a hollow cylinder. This cylinder is called a parison. Two mold halves are then closed on the parison, while at the same time the parison is inflated with air. Some of the parison material remains within the mold while some becomes waste material. The material is typically a polymer plastic softened with heat, but blow molding has been used to form metal parts. Plastic bottles are often manufactured using a blow molding process.

              Designing the parison die and molds is not easy. Improper design results in large variations in the wall thickness. In some cases the part may fail in thin-walled regions. As a result, analysis tools based on finite element techniques have been developed to assist in the design of molds and dies.

              The results of one such analysis are shown in Figure 12-17. The polymer was molded using an isothermal, nonlinear-elastic, incompressible (rubber-like) material. Triangular membrane finite elements were used to model the parison, while a combination of triangular and quadrilateral finite elements were used to model the mold. The mold surface is assumed to be rigid, and the parison is assumed to attach to the mold upon contact. Thus the thinning of the parison is controlled by its stretching during inflation and the sequence in which it contacts the mold.

              Figure 12-17 illustrates 10 steps of one analysis. The color of the parison indicates its thickness. Using a rainbow scale, red areas are thinnest while blue regions are thickest. Our visualization shows clearly one problem with the analysis technique we are using. Note that while the nodes (i.e., points) of the finite element mesh are prevented from passing through the mold, the interior of the triangular elements are not. This is apparent from the occlusion of the mold wireframe by the parison mesh. Figure 12-17. Ten frames from a blow molding finite element analysis. Mold halves (shown in wireframe) are closed around a parison as the parison is inflated. Coloring indicates thickness-red areas are thinner than blue. See Blow.cxx and Blow.py.

              To generate these images, we used a Tcl script shown in Figure 12-18 and Figure 12-19. The input data is in VTK format, so a vtkUnstructuredGridReader was used as a source object. The mesh displacement is accomplished using an instance of vtkWarpVector. At this point the pipeline splits. We wish to treat the mold and parison differently (different properties such as wireframe versus surface), but the data for both mold and parison is combined. Fortunately, we can easily separate the data using two instances of class vtkConnectivityFilter. One filter extracts the parison, while the other extracts both parts of the mold. Finally, to achieve a smooth surface appearance on the parison, we use a vtkPolyDataNormals filter. In order to use this filter, we have to convert the data type from vtkUnstructuredGrid (output of vtkConnectivityFilter ) to type vtkPolyData. The filter vtkGeometryFilter does this nicely."},{"location":"VTKBook/12Chapter12/#127-algorithm-visualization","title":"12.7 Algorithm Visualization","text":"

              Visualization can be used to display algorithms and data structures. Representing this information often requires creative work on the part of the application programmer. For example, Robertson et al. [Robertson91] have shown 3D techniques for visualizing directory structures and navigating through them. Their approach involves building three dimensional models (the so-called \"cone trees\") to represent files, directories, and associations between files and directories. Similar approaches can be used to visualize stacks, queues, linked lists, trees, and other data structures.

              Figure 12-18. Tcl script to generate blow molding image. Network topology and initial portion of script are shown (Part one of two)

              In this example we will visualize the operation of the recursive Towers of Hanoi puzzle. In this puzzle there are three pegs ( Figure 12-20 ). In the initial position there are one or more disks (or pucks) of varying diameter on the pegs. The disks are sorted according to disk diameter, so that the largest disk is on the bottom, followed by the next largest, and so on. The goal of the puzzle is to extract mold from mesh using connectivity vtkConnectivityFilter move the disks from one peg to another, moving the disks one at a time, and never placing a larger disk on top of a smaller disk. Figure 12-19. Tcl script to generate blow molding image (Part two of two). (a) Initial (b) Intermediate (c) Final Figure 12-20. Towers of Hanoi. (a) Initial configuration. (b) Intermediate configuration. (c) Final configuration. (a) See HanoiInitial.cxx and HanoiInitial.py.; (b). See HanoiIntermediate.cxx and HanoiIntermediate.py.; (c) See Hanoi.cxx and Hanoi.py. Figure 12-21. C++ code for recursive solution of Towers of Hanoi. Figure 12-22. Function to move disks from one peg to another in the Towers of Hanoi example. The resulting motion is in small steps with an additional flip of the disk.

              The classical solution to this puzzle is based on a divide-and-conquer approach [AhoHopUll83]. The problem of moving n disks from the initial peg to the second peg can be thought of as solving two subproblems of size n--1. First move n--1 disks from the initial peg to the third peg. Then move the nth disk to the second peg. Finally, move the n--1 disks on the third peg back to the second peg.

              The solution to this problem can be elegantly implemented using recursion. We have shown portions of the C++ code in Figure 12-21 and Figure 12-22. In the first part of the solution (which is not shown in Figure 12-21 ) the table top, pegs, and disks are created using the two classes vtkPlaneSource and vtkCylinderSource. The function Hanoi() is then called to begin the recursion. The routine MovePuck() is responsible for moving a disk from one peg to another. It has been jazzed up to move the disk in small, user-specified increments, and to flip the disc over as it moves from one peg to the next. This gives a pleasing visual effect and adds the element of fun to the visualization.

              Because of the clear relationship between algorithm and physical reality, the Towers of Hanoi puzzle is relatively easy to visualize. A major challenge facing visualization researchers is to visualize more abstract information, such as information on the Internet, the structure of documents, or the effectiveness of advertising/entertainment in large market segments. This type of visualization, known as information visualization, is likely to emerge in the future as an important research challenge.

              "},{"location":"VTKBook/12Chapter12/#128-chapter-summary","title":"12.8 Chapter Summary","text":"

              This chapter presented several case studies covering a variety of visualization techniques. The examples used different data representations including polygonal data, volumes, structured grids, and unstructured grids. Both C++ and Tcl code was used to implement the case studies.

              Medical imaging is a demanding application area due to the size of the input data. Three-dimensional visualization of anatomy is generally regarded by radiologists as a communication tool for referring physicians and surgeons. Medical datasets are typically image data---volumes or layered stacks of 2D images that form volumes. Common visualization tools for medical imaging include isosurfaces, cut planes, and image display on volume slices.

              Next, we presented an example that applied 3D visualization techniques to financial data. In this case study, we began by showing how to import data from an external source. We applied tube filters to the data and varied the width of the tube to show the volume of stock trading. We saw how different views can be used to present different pieces of information. In this case, we saw that by viewing the visualization from the front, we saw a conventional price display. Then, by viewing the visualization from above, we saw trade volume.

              In the modelling case study we showed how to use polygonal models and the implicit modelling facilities in VTK to create a stylistic logo. The final model was created by extracting an isosurface at a user-selected offset.

              Computational fluid dynamics analysts frequently employ structured grid data. We examined some strategies for exploring the scalar and vector fields. The computational grid created by the analyst serves as a starting point for analyzing the data. We displayed geometry extracted from the finite difference grid, scalar color mapping, and streamlines and streamtubes to investigate the data.

              In the finite element case study, we looked at unstructured grids used in a simulation of a blow molding process. We displayed the deformation of the geometry using displacement plots, and represented the material thickness using color mapping. We saw how we can create simple animations by generating a sequence of images.

              We concluded the case studies by visualizing the Towers of Hanoi algorithm. Here we showed how to combine the procedural power of C++ with the visualization capabilities in VTK. We saw how visualization often requires our creative resources to cast data structures and information into visual form.

              "},{"location":"VTKBook/12Chapter12/#129-bibliographic-notes","title":"12.9 Bibliographic Notes","text":"

              The case studies presented in the chapter rely on having interesting data to visualize. Sometimes the hardest part of practicing visualizing is finding relevant data. The Internet is a tremendous resource for this task. Paul Gilster [Gilster94] has written an excellent introduction to many of the tools for accessing information on the Internet. There are many more books available on this subject in the local bookstore.

              In the stock case study we used a programming tool called AWK to convert our data into a form suitable for VTK. More information on AWK can be found in The AWK Programming Language [Aho88]. Another popular text processing languages is Perl [Perl95].

              If you would like to know more about information visualization you can start with the references listed here [Becker95] [Ding90] [Eick93] [Feiner88] [Johnson91] [Robertson91]. This is a relatively new field but will certainly grow in the near future.

              "},{"location":"VTKBook/12Chapter12/#1210-references","title":"12.10 References","text":"

              [Aho88] A. V. Aho, B. W. Kernighan, and P. J. Weinberger. The AWK Programming Language. AddisonWesley, Reading, MA, 1988.

              [AhoHopUll83] A. V. Aho, J. E. Hopcroft, and J. D. Ullman. Data Structures and Algorithm s. AddisonWesley, Reading, MA, 1983.

              [Becker95] R. A. Becker, S. G. Eick, and A. R. Wilks. \"Visualizing Network Data.\" IEEE Transactions on Visualization and Graphics. 1(1):16-28,1995.

              [deLorenzi93] H. G. deLorenzi and C. A. Taylor. \"The Role of Process Parameters in Blow Molding and Correlation of 3-D Finite Element Analysis with Experiment.\" International Polymer Processing. 3(4):365-374, 1993.

              [Ding90] C. Ding and P. Mateti. \"A Framework for the Automated Drawing of Data Structure Diagrams.\" IEEE Transactions on Software Engineering. 16(5):543-557, May 1990.

              [Eick93] S. G. Eick and G. J. Wills. \"Navigating Large Networks with Hierarchies.\" In Proceedings of Visualization '93. pp. 204-210, IEEE Computer Society Press, Los Alamitos, CA, October 1993.

              [Feiner88] S. Feiner. \"Seeing the Forest for the Trees: Hierarchical Displays of Hypertext Structures.\" In Conference on Office Information Systems. Palo Alto, CA, 1988.

              [Gilster94] P. Gilster. Finding It on the Internet: The Essential Guide to Archie, Veronica, Gopher, WAIS, WWW (including Mosaic), and Other Search and Browsing Tools. John Wiley & Sons, Inc., 1994.

              [Johnson91] B. Johnson and B. Shneiderman. \"Tree-Maps: A Space-Filling Approach to the Visualization of Hierarchical Information Structure s.\" In Proceedings of Visualization '91. pp. 284-291, IEEE Computer Society Press, Los Alamitos, CA, October 1991.

              [Perl95] D. Till. Teach Yourself Perl in 21 Days. Sams Publishing, Indianapolis, Indiana, 1995.

              [Robertson91] G. G. Robertson, J. D. Mackinlay, and S. K. Card. \"Cone Trees: Animated 3D Visualizations of Hierarchical Information.\" In Proceedings of ACM CHI '91 Conference on Human Factors in Computing Systems. pp. 189-194, 1991.

              [Rogers86] S. E. Rogers, D. Kwak, and U. K. Kaul, \"A Numerical Study of Three-Dimensional Incompressible Flow Around Multiple Post.\" in Proceedings of AIAA Aerospace Sciences Conference. vol. AIAA Paper 86-0353. Reno, Nevada, 1986.

              "},{"location":"VTKBook/12Chapter12/#1211-exercises","title":"12.11 Exercises","text":"

              12.1 The medical example did nothing to transform the original data into a standard coordinate system. Many medical systems use RAS coordinates. R is right/left, A is anterior/posterior and S is Superior/Inferior. This is the patient coordinate system. Discuss and compare the following alternatives for transforming volume data into RAS coordinates.

              a) vtkActor transformation methods.

              b) vtkTransformFilter.

              c) Reader transformations.

              12.2 Modify the last example found in the medical application ( Medical3.cxx ) to use vtkImageDataGeometryFilter instead of vtkImageActor. Compare the performance of using geometry with using texture. How does the performance change as the resolution of the volume data changes?

              12.3 Modify the last medical example ( Medical3.cxx ) to use v tkTexture and vtkPlaneSource instead of vtkImageActor.

              12.4 Change the medical case study to use dividing cubes for the skin surface.

              12.5 Combine the two scripts frogSegmentation.tcl and marchingFrog.tcl into one script that will handle either segmented or grayscale files. What other parameters and pipeline components might be useful in general for this application?

              12.6 Create polygonal / line stroked models of your initials and build your own logo. Experiment with different transformations.

              12.7 Enhance the appearance of Towers of Hanoi visualization.

              a) Texture map the disks, base plane, and pegs.

              b) Create disks with central holes.

              12.8 Use the blow molding example as a starting point for the following.

              a) Create an animation of the blow molding sequence. Is it possible to interpolate between time steps? How would you do this?

              b) Create the second half of the parison using symmetry. What transformation matrix do you need to use?

              12.9 Start with the stock visualization example presented in this chapter.

              a) Modify the example code to use a ribbon filter and linear extrusion filter as described in the text. Be careful of the width of the generated ribbons.

              b) Can you think of a way to present high/low trade values for each day?

              "},{"location":"VTKBook/13Glossary/","title":"Glossary","text":"

              3D Widget. An interaction paradigm enabling manipulation of scene objects (e.g., lights, camera, actors, and so on). The 3D widget typically provides a visible representation that can be intuitively and interactively manipulated.

              API. An acronym for application programmer's interface.

              Abstract Class. A class that provides methods and data members for the express purpose of deriving subclasses. Such objects are used to define a common interface and attributes for their subclasses.

              Abstraction. A mental process that extracts the essential form or unifying properties of a concept.

              Alpha. A specification of opacity (or transparency). An alpha value of one indicates that the object is opaque. An alpha value of zero indicates that the object is completely transparent.

              Ambient Lighting. The background lighting of unlit surfaces.

              Animation. A sequence of images displayed in rapid succession. The images may vary due to changes in geometry, color, lighting, camera position, or other graphics parameters. Animations are used to display the variation of one or more variables.

              Antialiasing. The process of reducing aliasing artifacts. These artifacts typically result from undersampling the data. A common use of antialiasing is to draw straight lines that don't have the jagged edges found in many systems without antialiasing.

              Azimuth. A rotation of a camera about the vertical (or view up) axis.

              Attribute. A named member of a class that captures some characteristic of the class. Attributes have a name, a data type, and a data value. This is the same as a data member or instance variable.

              Base Class. A superclass in C++.

              Binocular Parallax. The effect of viewing the same object with two slightly different viewpoints to develop depth information.

              Boolean Texture. A texture map consisting of distinct regions used to \"cut\" or accentuate features of data. For example, a texture map may consist of regions of zero opacity. When such a texture is mapped onto the surface of an object, portions of its interior becomes visible. Generally used in conjunction with a quadric (or other implicit function) to generate texture coordinates.

              C++. A compiled programming language with roots in the C programming language. C++ is an extension of C that incorporates objectoriented principles.

              CT (Computed Tomography). A data acquisition technique based on Xrays. Data is acquired in a 3D volume as a series of slice planes (i.e., a stack of n^2^ points).

              Cell. The atoms of visualization datasets. Cells define a topology (e.g., polygon, triangle) in terms of a list of point coordinates.

              Cell Attributes. Dataset attributes associated with a cell. See also point attributes .

              Class. An object that defines the characteristics of a subset of objects. Typically, it defines methods and data members. All objects instantiated from a class share that class's methods and data members.

              Clipping Plane. A plane that restricts the rendering or processing of data. Front and back clipping planes are commonly used to restrict the rendering of primitives to those lying between the two planes.

              Color Mapping. A scalar visualization technique that maps scalar values into color. Generally used to display the variation of data on a surface or through a volume.

              Compiled System. A compiled system requires that a program be compiled (or translated into a lower level language) before it is executed. Contrast with interpreted systems .

              Composite Cell. A cell consisting of one or more primary cells.

              Concrete Class. A class that can be instantiated. Typically, abstract classes are not instantiated but concrete classes are.

              Connectivity. A technique to extract connected cells. Cells are connected when they share common features such as points, edges, or faces.

              Contouring. A scalar visualization technique that creates lines (in 2D) or surfaces (in 3D) representing a constant scalar value across a scalar field. Contour lines are called isovalue lines or iso-lines. Contour surfaces are called isovalue surfaces or isosurfaces.

              Constructor. A class method that is invoked when an instance of that class is created. Typically the constructor sets any default values and allocates any memory that the instance needs. See also destructor .

              Critical Points. Locations in a vector field where the local vector magnitude goes to zero and the direction becomes undefined.

              Cutting. A visualization technique to slice through or cut data. The cutting surface is typically described with an implicit function, and data attributes are mapped onto the cut surface. See also boolean texture .

              Dataset. The general term used to describe visualization data. Datasets consist of structure (geometry and topology) and dataset attributes (scalars, vectors, tensors, etc.). Dataset Attributes. The information associated with the structure of a dataset. This can be scalars, vectors, tensors, normals, and texture coordinates, or arbitrary data arrays that may be contained in the field.

              Data Extraction. The process of selecting a portion of data based on characteristics of the data. These characteristics may be based on geometric or topological constraints or constraints on data attribute values.

              Data Flow Diagram. A diagram that shows the information flow and operations on that information as it moves throughout a program or process.

              Data Object. An object that is an abstraction of data. For example, a patient's file in a hospital could be a data object. Typical visualization objects include structured grids and volumes. See also process object .

              Data Member. A named member of a class that captures some characteristic of the class. Data members have a name, a data type, and a data value. This is the same as an attribute or instance variable.

              Data Visualization. The process of transforming data into sensory stimuli, usually visual images. Data visualization is a general term, encompassing data from engineering and science, as well as information from business, finance, sociology, geography, information management, and other fields. Data visualization also includes elements of data analysis, such as statistical analysis. Contrast with scientific visualization and information visualization .

              Decimation. A type of polygon reduction technique that deletes points in a polygonal mesh that satisfies a co-planar or co-linear condition and replaces the resulting hole with a new triangulation.

              Delaunay Triangulation. A triangulation that satisfies the Delaunay circumsphere criterion. This criterion states that a circumsphere of each simplex in the triangulation contains only the points defining the simplex.

              Delegation. The process of assigning an object to handle the execution of another object's methods. Sometimes it is said that one object forwards certain methods to another object for execution.

              Demand-driven. A method of visualization pipeline update where the update occurs only when data is requested and occurs only in the portion of the network required to generate the data.

              Derived Class. A class that is more specific or complete than its superclass. The derived class, which is also known as the subclass, inherits all the members of its superclass. Usually a derived class adds new functionality or fills in what was defined by its superclass. See also subclass .

              Destructor. A class method that is invoked when an instance of that class is deleted. Typically the destructor frees memory that the instance was using. See also constructor .

              Device Mapper. A mapper that interfaces data to a graphics library or subsystem.

              Diffuse Lighting. Reflected light from a matte surface. Diffuse lighting is a function of the relative angle between the incoming light and surface normal of the object.

              Displacement Plots. A vector visualization technique that shows the displacement of the surface of an object. The method generates scalar values by computing the dot product between the surface normal and vector displacement of the surface. The scalars are visualized using color mapping.

              Display Coordinate System. A coordinate system that is the result of mapping the view coordinate system onto the display hardware.

              Divergence. In numerical computation: the tendency of computation to move away from the solution. In fluid flow: the rapid motion of fluid particles away from one another.

              Dividing Cubes. A contour algorithm that represents isosurfaces as a dense cloud of points.

              Dolly. A camera operation that moves the camera position towards (

              from the camera focal point.

              dolly in ) or away (

              dolly out )

              Double Buffering. A display technique that is used to display animations more smoothly. It consists of using two buffers in the rendering process. While one buffer is being displayed, the next frame in the animation is being drawn on the other buffer. Once the drawing is complete the two buffers are swapped and the new image is displayed.

              Dynamic Memory Model. A data flow network that does not retain intermediate results as it executes. Each time the network executes, it must recompute any data required as input to another process object. A dynamic memory model reduces system memory requirements but places greater demands on computational requirements.

              Dynamic Model. A description of a system concerned with synchronizing events and objects.

              Effective Stress. A mathematical combination of the normal and shear stress components that provide a measure of the stress at a point. Effective stress is a scalar value, while stress is represented with a tensor value. See stress .

              Eigenfields. Vector fields defined by the eigenvectors of a tensor.

              Eigenvalue. A characteristic value of a matrix. Eigenvalues often correspond to physical phenomena, such as frequency of vibration or magnitude of principal components of stress.

              Eigenvector. A vector associated with each eigenvalue. The eigenvector spans the space of the matrix. Eigenvectors are orthogonal to one another. Eigenvectors often correspond to physical phenomena such as mode shapes of vibration.

              Elevation. A rotation of a camera about the horizontal axis.

              Entity. Something within a system that has identity. Chairs, airplanes, and cameras are things that correspond to physical entities in the real world. A database and isosurface algorithm are examples of nonphysical entities.

              Event-driven. A method of visualization pipeline update where updates occur when an event

              affects the pipeline, e.g., when an object instance variable is set or modified. See also demand-driven.

              Execution. The process of updating a visualization network.

              Explicit Execution. Controlling network updates by performing explicit dependency analysis.

              Exporter. An object that saves a VTK scene definition to a file or other program. (A scene consists of lights, cameras, actors, geometry, properties, texture, and other pertinent data.) See also importer .

              Fan-in. The flow of multiple pieces of data into a single filter.

              Fan-out. The flow of data from a filter's output to other objects.

              Feature Angle. The angle between surface normal vectors, e.g., the angle between the normal vectors on two adjacent polygons.

              Filter. A process object that takes at least one input and generates at least one output.

              Finite Element Method (FEM). A numerical technique for the solution of partial differential equations. FEM is based on discretizing a domain into elements (and nodes) and constructing basis (or interpolation) functions across the elements. From these functions a system of linear equations is generated and solved on the computer. Typical applications include stress, heat transfer, and vibration analysis.

              Finite Difference Method. A numerical technique for the solution of partial differential equations (PDEs). Finite difference methods replace the PDEs with truncated Taylor series approximations. This results in a system of equations that is solved on a computer. Typical applications include fluid flow, combustion, and heat transfer.

              Flat Shading. A shading technique where the lighting equation for a geometric primitive is calculated once, and then used to fill in the entire area of the primitive. This is also known as faceted shading. See also gouraud shading and phong shading .

              Functional Model. The description of a system based on what it does.

              Generalization. The abstraction of a subset of classes to a common superclass. Generalization extracts the common members or methods from a group of classes to create a common superclass. See also specialization and inheritance .

              Geometry. Used generally to mean the characteristic position, shape, and topology of an object.

              Used specifically (in tandem with topology) to mean the position and shape of an object.

              Glyph. A general visualization technique used to represent data using a meaningful shape or pictorial representation. Each glyph is generally a function of its input data and may change size, orientation, and shape; or modify graphics properties in response to changes in input.

              Gouraud Shading. A shading technique that applies the lighting equations for a geometric primitive at each vertex. The resulting colors are then interpolated over the areas between the vertices. See also flat shading and Phong shading .

              Hedgehog. A vector visualization technique that represents vector direction and magnitude with oriented lines.

              Height Field. A set of altitude or height samples in a rectangular grid. Height fields are typically used to represent terrain.

              Hexahedron. A type of primary 3D cell. The hexahedron looks like a \"brick.\" It has six faces, 12 edges, and eight vertices. The faces of the hexahedron are not necessarily planar.

              Homogeneous Coordinates. An alternate coordinate representation that provides more flexibility than traditional Cartesian coordinates. This includes perspective transformation and combined translation, scaling, and rotation.

              Hyperstreamline. A tensor visualization technique. Hyperstreamlines are created by treating the eigenvectors as three separate vectors. The maximum eigenvalue/eigenvector is used as a vector field in which particle integration is performed (like streamlines). The other two vectors control the cross-sectional shape of an ellipse that is swept along the integration path. See also streampolygon .

              Image Data. A dataset whose structure is both geometrically and topologically regular. Both geometry and topology are implicit. A 3D image dataset is known as a volume. A 2D image dataset is known as a pixmap.

              Image-Order Techniques. Rendering techniques that determine for each pixel in the image plane which data samples contribute to it. Image-order techniques are implemented using ray casting. Contrast with object-order techniques .

              Implicit Execution. Controlling network updates by distributing network dependency throughout the visualization process objects. Each process object requests that its input be updated before it executes. This results in a recursive update/execution process throughout the network.

              Implicit Function. A mathematical function of the form , whereFxyz(),, c is a constant=.

              Implicit Modelling. A modelling technique that represents geometry as a scalar field. Usually the scalar is a distance function or implicit function distributed through a volume.

              Importer. An object that interfaces to external data or programs to define a complete scene in VTK. (The scene consists of lights, cameras, actors, geometry, properties, texture, and other pertinent data.) See also exporter .

              Information Visualization. The process of transforming information into sensory stimuli, usually visual images. Information visualization is used to describe the process of visualizing data without structure, such as information on the World Wide Web; or abstract data structures, like computer file systems or documents. Contrast with scientific visualization and data visualization .

              Inheritance. A process where the attributes and methods of a superclass are bestowed upon all sub-classes derived from that superclass. It is said that the subclasses inherit their superclasses' methods and attributes.

              Instance. An object that is defined by a class and used by a program or application. There may be many instances of a specific class.

              Instance Variable. A named member of a class that captures a characteristic of the class. Instance variables have a name, a data type, and a data value. The phrase, instance variable, is often abbreviated as ivar. This is the same as an attribute or data member.

              Intensity. The light energy transferred per unit time across a unit plane perpendicular to the light rays.

              Interpolate.

              that bracket

              Estimate a value of a function at a point p.

              p, given known function values and points

              Interpolation Functions. Functions continuous in value and derivatives used to interpolate data from known points and function values. Cells use interpolation functions to compute data values interior to or on the boundary of the cell.

              Interpreted System. An interpreted system can execute programs without going through a separate compilation stage. Interpreted systems often allow the user to interact and modify the program as it is running. Contrast with compiled systems .

              Irregular Data. Data in which the relationship of one data item to the other data items in the dataset is arbitrary. Irregular data is also known as unstructured data.

              Iso-parametric. A form of interpolation in which interpolation for data values is the same as for the local geometry. Compare with sub-parametric and super-parametric .

              Isosurface. A surface representing a constant valued scalar function. See contouring .

              Isovalue. The scalar value used to generate an isosurface.

              Jacobian. A matrix that relates one coordinate system to another.

              Line. A cell defined by two points.

              MRI (Magnetic Resonance Imaging). A data acquisition technique based on measuring variation in magnetic field in response to radio-wave pulses. The data is acquired in a 3D region as a series of slice planes (i.e., a stack of n^2 points).

              Mapper. A process object that terminates the visualization network. It maps input data into graphics libraries (or other devices) or writes data to disk (or a communication device).

              Manifold Topology. A domain is manifold at a point p in a topological space of dimension n if the

              neighborhood around p is homeomorphic to an n-dimensional sphere. Homeomorphic means that the mapping is one to one without tearing (i.e., like mapping a rubber sheet from a square to a disk). We generally refer to an object's topology as manifold if every point in the object is manifold. Contrast with nonmanifold topology .

              Marching Cubes. A contouring algorithm to create surfaces of constant scalar value in 3D. Marching cubes is described for volume datasets, but has been extended to datasets consisting of other cell types.

              Member Function. A member function is a function or transformation that can be applied to an object. It is the functional equivalent to a data member. Member functions define the behavior of an object. Methods, operations, and member functions are essentially the same.

              Method. A function or transformation that can be applied to an object. Methods define the behavior of an object. Methods, operations, and member functions are essentially the same.

              Modal Lines. Lines on the surface of a vibrating object that separate regions of positive and negative displacement.

              Mode Shape. The motion of an object vibrating at a natural frequency. See also eigenvalues and

              eigenvectors .

              Model Coordinate System. The coordinate system that a model or geometric entity is defined in.

              There may be many different model coordinate systems defined for one scene.

              Motion Blur. An artifact of the shutter speed of a camera. Since the camera's shutter stays open for a finite amount of time, changes in the scene that occur during that time can result in blurring of the resulting image.

              Morph. A progressive transformation of one object into another. Generally used to transform images (2D morphing) and in some cases geometry (3D morphing).

              Multiple Input. Process objects that accept more than one input.

              Multiple Output. Process objects that generate more than one output.

              Multidimensional Visualization. Visualizing data of four or more variables. Generally requires a mapping of many dimensions into three or fewer dimensions so that standard visualization techniques can be applied.

              Nonmanifold Topology. Topology that is not manifold. Examples include polygonal meshes, where an edge is used by more than two polygons, or polygons connected to each other at their vertices (i.e., do not share an edge). Contrast with manifold topology .

              Normal. A unit vector that indicates perpendicular direction to a surface. Normals are a common type of data attribute.

              Object. An abstraction that models the state and behavior of entities in a system. Instances and classes are both objects.

              Object Model. The description of a system in terms of the components that make up the system, including the relationship of the components one to another.

              Object-Order Techniques. Rendering techniques that project object data (e.g., polygons or voxels) onto the image plane. Example techniques include ordered compositing and splatting.

              Object-Oriented. A software development technique that uses objects to represent the state and behavior of entities in a system.

              Octree Decomposition. A technique to decompose a cubical region of three-dimensional space into smaller cubes. The cubes, or octants, are related in tree fashion. The root octant is the cubical region. Each octant may have eight children created by dividing the parent in half in the x, y, and z directions.

              Object Factory. An object used to construct or instantiate other objects. In VTK, object factories are implemented using the class method New().

              OMT. Object Modelling Technique . An object-oriented design technique that models software systems with object, dynamic, and functional diagrams.

              Operation. A function or transformation that can be applied to an object. Operations define the behavior of an object. Methods and member functions implement operations.

              Overloading. Having multiple methods with the same name. Some methods are overloaded because there are different versions of the same method. These differences are based on argument types, while the underlying algorithm remains the same. Contrast with polymorphic .

              Painter's Algorithm. An object-order rendering technique that sorts rendering primitives from back to front and then draws them.

              Parametric Coordinates. A coordinate system natural to the geometry of a geometric object. For example, a line may be described by the single coordinate s even though the line may lie in three or higher dimensions.

              Parallel Projection. A mapping of world coordinates into view coordinates that preserves all parallel lines. In a parallel projection an object will appear the same size regardless of how far away it is from the viewer. This is equivalent to having a center of projection that is infinitely far away. Contrast with perspective projection .

              Particle Trace. The trajectory that particles trace over time in fluid flow. Particle traces are everywhere tangent to the velocity field. Unlike streamlines, particle lines are time-dependent.

              Pathline. The trajectory that a particle follows in fluid flow.

              Perspective Projection. A mapping of world coordinates into view coordinates that roughly approximates a camera lens. Specifically, the center of projection must be a finite distance from the

              view plane. As a result closer, objects will appear larger than distant objects. Contrast with parallel projection .

              Phong Shading. A shading technique that applies the lighting equations for a geometric primitive at each pixel. See also flat shading and Gouraud shading .

              Pitch. A rotation of a camera's position about the horizontal axis, centered at its viewpoint. See also yaw and roll. Contrast with elevation .

              Pixel. Short for picture element. Constant valued elements in an image. In VTK, a two-dimensional cell defined by an ordered list of four points.

              Point. A geometric specification of position in 3D space.

              Point Attributes. Data attributes associates with the points of a dataset.

              Polygon. A cell consisting of three or more co-planar points defining a polygon. The polygon can be concave but without imbedded loops.

              Polygonal Data. A dataset type consisting of arbitrary combinations of vertices, polyvertices, lines, polylines, polygons, and triangle strips. Polygonal data is an intermediate data form that can be easily rendered by graphics libraries, and yet can represent many types of visualization data.

              Polygon Reduction. A family of techniques to reduce the size of large polygonal meshes. The goal is to reduce the number of polygons, while preserving a \"good\" approximation to the original geometry. In most techniques topology is preserved as well.

              Polyline.

              A composite cell consisting of one or more lines.

              Polymorphic. Having many forms. Some methods are polymorphic because the same method in

              different classes may implement a different algorithm. The semantics of the method are typically

              the same, even though the implementation may differ. Contrast with overloading .

              Polyvertex.

              A composite cell consisting of one or more vertices.

              Primary Cell.

              A cell that is not defined in terms of other cells.

              Probing. Also known as sampling or resampling. A data selection technique that selects data at a

              set of points.

              Process Object. A visualization object that is an abstraction of a process or algorithm. For example, the isosurfacing algorithm marching cubes is implemented as a process object. See also data object.

              Progressive Mesh. A representation of a triangle mesh that enables incremental refinement and

              derefinement. The data representation is compact and is useful for transmission of 3D triangle

              meshes across a network. See also polygon reduction .

              Properties. A general term used to describe the rendered properties of an actor. This includes lighting terms such as ambient, diffuse, and specular coefficients; color and opacity; shading techniques such as flat and Gouraud; and the actor's geometric representation (wireframe, points, or surface).

              Pyramid. A type of primary 3D cell. The pyramid has a quadrilateral base connected to a single apex point. It has five faces, eight edges, and five vertices. The base face of the pyramid is not necessarily planar.

              Quadric. A function of the form

              f(x,y,z) = a_0x^2 + a_1y^2 + a_2z^2 + a_3xy + a_4yz + a_5xz + a_6 x + a_7 y + a_8 z + a_9

              The quadric equation can represent many useful 3D objects such as spheres, ellipsoids, cylinders, and cones.

              Quadratic Edge. A type of primary 1D cell with a quadratic interpolation function. The quadratic edge is defined by three points: two end points and a mid-edge node.

              Quadratic Triangle. A type of primary 2D cell with quadratic interpolation functions. The quadratic triangle is defined by six points: three corner points and three mid-edge nodes.

              Quadratic Quadrilateral. A type of primary 2D cell with quadratic interpolation functions. The quadratic quadrilateral is defined by eight points: four corner points and four mid-edge nodes.

              Quadratic Tetrahedron. A type of primary 3D cell with quadratic interpolation functions. The quadratic tetrahedron is defined by ten points: four corner points and six mid-edge nodes.

              Quadratic Hexahedron. A type of primary 3D cell with quadratic interpolation functions. The quadratic edge is defined by twenty points: eight corner points and twelve mid-edge nodes.

              Quadrilateral (Quad). A type of primary 2D cell. The quadrilateral is four sided with four vertices. The quadrilateral must be convex.

              Reader. A source object that reads a file or files and produces a data object.

              Reference Counting. A memory management technique used to reduce memory requirements. Portions of memory (in this case objects) may be referenced by more than one other object. The referenced object keeps a count of references to it. If the count returns to zero, the object deletes itself, returning memory back to the system. This technique avoids making copies of memory.

              Region of Interest. A portion of a dataset that the user is interested in visualizing. Sometimes abbreviated ROI.

              Regular Data. Data in which one data item is related (either geometrically or topologically) to other data items. Also referred to as structured data.

              Rendering. The process of converting object geometry (i.e., geometric primitives), object properties, and a specification of lights and camera into an image. The primitives may take many forms including surface primitives (points, lines, polygons, splines), implicit functions, or volumes.

              Resonant Frequency. A frequency at which an object vibrates.

              Roll. A rotation of a camera about its direction of projection. See also azimuth , elevation , pitch, and yaw.

              Sampling. Selective acquisition or sampling of data, usually at a regular interval. See also probing .

              Scalar. A single value or function value. May also be used to represent a field of such values.

              Scalar Range. The minimum and maximum scalar values of a scalar field.

              Scalar Generation. Creating scalar values from other data such as vectors or tensors. One example is computing vector norm.

              Scene. A complete representation of the components required to generate an image or animation including lights, cameras, actors. properties, transformations, geometry, texture, and other pertinent information.

              Scene Graph. A hierarchical, acyclic, directed tree representation of a scene. The graph order (depth first) controls when objects are processed by the graphics system.

              Scientific Visualization. The process of transforming data into sensory stimuli, usually visual images. Generally used to denote the application of visualization to the sciences and engineering. Contrast with data visualization and information visualization .

              Searching. The process of locating data. Usually the search is based on spatial criteria such as position or being inside a cell.

              Segmentation. Identification and demarcation of tissue types. Segmentation is generally applied to CT and MRI data to associate soft tissue with a particular body organ or anatomical structure.

              Simplex. The convex combination of n independent vectors in n-space forms an n-dimensional simplex. Points, lines, triangles, and tetrahedra are examples of simplices in 0D, 1D, 2D, and 3D.

              Source. A process object that produces at least one output. Contrast with filter .

              Specialization. The creation of subclasses that are more refined or specialized than their super-class. See also generalization and inheritance .

              Specular Lighting. Reflected lighting from a shiny surface. Specular lighting is a function of the relative angle between the incoming light, the surface normal of the object, and the view angle of the observer.

              Splatting. A method to distribute data values across a region. The distribution functions are often based on Gaussian functions.

              State Diagram. A diagram that relates states and events. Used to describe behavior in a software system.

              Static Memory Model. A data flow network that retains intermediate results as it executes. A static memory model minimizes computational requirements, but places greater demands on memory requirements.

              Strain. A nondimensional quantity expressed as the ratio of the displacement of an object to its length (normal strain), or angular displacement (shear strain). Strain is a tensor quantity. See also stress .

              Stress. A measure of force per unit area. Normal stress is stress normal to a given surface, and is either compressive (a negative value) or tensile (a positive value). Shear stress acts tangentially to a given surface. Stress is related to strain through the linear proportionality constants (theE modulus of elasticity), (Poisson's ratio), and (modulusG of elasticity in shear). Stress is a tensor quantity. See also strain .

              Streakline. The set of particles that have previously passed through a particular point.

              Streamline. Curves that are everywhere tangent to the velocity field. A streamline satisfies the integral curve \\frac{\\text{d}\\overrightarrow{x}}{\\text{d}s} = \\overrightarrow{v}(x,t') at sonme time t'.

              Streampolygon. A vector and tensor visualization technique that represents flow with tubes that have polygonal cross sections. The method is based on integrating through the vector field and then sweeping a regular polygon along the streamline. The radius, number of sides, shape, and rotation of the polygon are allowed to change in response to data values. See also hyperstreamline .

              Streamribbon. A vector visualization technique that represents vectors with ribbons that are everywhere tangent to the vector field

              Streamsurface . A surface that is everywhere tangent to a vector field. Can be approximated by generating a series of streamlines along a curve and connecting the lines with a surface.

              Streamwise Vorticity. A measure of the rotation of flow around a streamline.

              Structured Data. Data in which one data item is related (either geometrically or topologically) to other data items. Also referred to as regular data.

              Structured Grid. A dataset whose structure is topologically regular but whose geometry is irregular. Geometry is explicit and topology is implicit. Typically, structured grids consist of hexahedral cells.

              Structured Points. Preferred term is Image Data . A dataset whose structure is both geometrically and topologically regular. Both geometry and topology are implicit. A 3D structured point dataset is known as a volume. A 2D structured point dataset is known as a pixmap.

              Subclass. A class that is more specific or complete than its superclass. The subclass, which is also known as the derived class, inherits all the members of its superclass. Usually a subclass will add some new functionality or fill in what was defined by its superclass. See also derived class .

              Sub-parametric. A form of interpolation in which interpolation for data values is of higher order than that for the local geometry. Compare with iso-parametric and super-parametric .

              Subsampling. Sampling data at a resolution at less than final display resolution.

              Superclass. A class from which other classes are derived. See also base class .

              Super-parametric. A form of interpolation in which interpolation for data values is of lower order than that for the local geometry. Compare with iso-parametric and sub-parametric .

              Surface Rendering. Rendering techniques based on geometric surface primitives such as points, lines, polygons, and splines. Contrast with volume rendering .

              Swept Surface.

              The surface that an object creates as it is swept through space.

              Swept Volume.

              The volume enclosed by a swept surface.

              Tcl.

              An interpreted language developed by John Ousterhout in the early 1980s.

              Tk.

              A graphical user-interface toolkit based on Tcl.

              Tensor. A mathematical generalization of vectors and matrices. A tensor of rank k can be considered a k-dimensional table. Tensor visualization algorithms treat 3 x 3 real symmetric matrix tensors (rank 2 tensors).

              Tensor Ellipsoid. A type of glyph used to visualize tensors. The major, medium, and minor eigenvalues of a tensor define an ellipsoid. The eigenvalues are used to scale along the axes.

              Tetrahedron. A 3D primary cell that is a simplex with four triangular faces, six edges, and four vertices.

              Texture Animation. Rapid application of texture maps to visualize data. A useful example maps a 1D texture map of varying intensity along a set of lines to simulate particle flow.

              Texture Coordinate. Specification of position within texture map. Texture coordinates are used to map data from Cartesian system into 2D or 3D texture map.

              Texture Map. A specification of object properties in a canonical region. These properties are most often intensity, color, and alpha, or combinations of these. The region is typically a structured array of data in a pixmap (2D) or in a volume (3D).

              Texture Mapping. A rendering technique to add detail to objects without requiring extensive geometric modelling. One common example is to paste a picture on the surface of an object.

              Texture Thresholding. Using texture mapping to display selected data. Often makes use of alpha opacity to conceal regions of minimal interest.

              Thresholding. A data selection technique that selects data that lies within a range of data. Typically scalar thresholding selects data whose scalar values meet a scalar criterion.

              Topology. A subset of the information about the structure of a dataset. Topology is a set of properties invariant under certain geometric transformation such as scaling, rotation, and translation.

              Topological Dimension. The dimension or number of parametric coordinates required to address the domain of an object. For example, a line in 3D space is of topological dimension one because the line can be parametrized with a single parameter.

              Transformation Matrix. A matrix of values used to control the position, orientation, and scale of objects.

              Triangle Strip. A composite 2D cell consisting of triangles. The triangle strip is an efficient representation scheme for triangles where points n + 2 can represent n triangles.

              Triangle. A primary 2D cell. The triangle is a simplex with three edges and three vertices.

              Triangular Irregular Network (TIN). An unstructured triangulation consisting of triangles. Often used to represent terrain data.

              Triangulation. A set of nonintersecting simplices sharing common vertices, edges, and/or faces.

              Type Converter . A type of filter used to convert from one dataset type to another.

              Type Checking. The process of enforcing compatibility between objects.

              Uniform Grid. A synonym for image data.

              Unstructured Data. Data in which one data item is unrelated (either geometrically or topologically) to other data items. Also referred to as irregular data.

              Unstructured Grid. A general dataset form consisting of arbitrary combinations of cells and points. Both the geometry and topology are explicitly defined.

              Unstructured Points. A dataset consisting of vertex cells that are positioned irregularly in space, with no implicit or explicit topology.

              Visualization. The process of converting data to images (or other sensory stimuli). Alternatively, the end result of the visualization process.

              Vector. A specification of direction and magnitude. Vectors can be used to describe fluid velocity, structural displacement, or object motion.

              Vector Field Topology. Vector fields are characterized by regions flow diverges, converges, and/or rotates. The relationship of these regions one to another is the topology of the flow.

              Vertex. A primary 0D cell. Is sometimes used synonymously with point or node.

              View Coordinate System. The projection of the world coordinate system into the camera's viewing frustrum.

              View Frustrum. The viewing region of a camera defined by six planes: the front and back clipping planes, and the four sides of a pyramid defined by the camera position, focal point, and view angle (or image viewport if viewing in parallel projection).

              Visual Programming. A programming model that enables the construction and manipulation of visualization applications. A typical implementation is the construction of a visualization pipeline by connecting execution modules into a network.

              Visualization Network. A series of process objects and data objects joined together into a dataflow network.

              Volume. A regular array of points in 3D space. Volumes are often defined as a series of 2D images arranged along the z-axis.

              Volume Rendering. The process of directly viewing volume data without converting the data to intermediate surface primitives. Contrast with surface rendering .

              Vorticity. A measure of the rotation of fluid flow.

              Voxel. Short for volume element. In VTK, a primary three-dimensional cell with six faces. Each face is perpendicular to one of the coordinate axes.

              Warping. A scalar and vector visualization technique that distorts an object to magnify the effects of data value. Warping may be used on vector data to display displacement or velocity, or on scalar data to show relative scalar values.

              Wedge. A type of primary 3D cell. The wedge has two triangular faces connected with three quadrilateral faces. It has five faces, nine edges, and six vertices. The quadrilateral faces of the wedge are not necessarily planar.

              World Coordinate System. A three-dimensional Cartesian coordinate system in which the main elements of a rendering scene are positioned.

              Writer. A type of mapper object that writes data to disk or other I/O device.

              Yaw. A rotation of a camera's position about the vertical axis, centered at its viewpoint. See also pitch and roll. Contrast with azimuth .

              Z-Buffer. Memory that contains the depth (along the view plane normal) of a corresponding element in a frame buffer.

              Z-Buffering. A technique for performing hidden line (point, surface) removal by keeping track of the current depth, or z value for each pixel. These values are stored in the z-buffer.

              Zoom. A camera operation that changes the field of view of the camera. Contrast with dolly.

              "},{"location":"VTKBookLaTeX/VTKTextBook/","title":"VTK Textbook - PDF Version","text":"

              Note

              For Developers: The files for the LaTeX version have been moved to the VTK repository textbook, if you wish to contribute, please fork a branch from textbook.

              "},{"location":"VTKBookLaTeX/VTKTextBook/#introduction","title":"Introduction","text":"

              This is a PDF version of the VTK Textbook. It has updated equations and figures and is fully cross-referenced and indexed. As further development occurs this text book will be updated on a rolling basis.

              You can view/download it from here: VTKTextBook

              "},{"location":"WASM/1_WASM/","title":"Interactive examples (only available for Cxx examples)","text":""},{"location":"WASM/1_WASM/#what-is-webassembly","title":"What is WebAssembly ?","text":"

              WebAssembly (WASM for short) is a technology which allows a C/C++ code to be executed by the web browser as if it was a JS script.

              It allows integration of small bits of code inside a web page, and even full size web apps that are derived from a desktop app.

              For more examples of what WASM is able to do, take a look at Made with WebAssembly.

              "},{"location":"WASM/1_WASM/#vtk-wasm","title":"VTK-WASM","text":"

              By making VTK able to use WebGL instead of the usual OpenGL, we have been able to build VTK for WebAssembly. Not all modules are available but we keep on improving VTK-WASM, and this website is a display of what is working, and what is not.

              If you want to build your own VTK project in WebAssembly, take a look here.

              If your browser is having issues loading or running WASM examples, ensure Hardware Acceleration is enabled, and if you have a GPU, that it's in use. Be aware that some examples can be highly resource intensive and therefore not run well in small hardware configurations (thus provoke instability for your browser). VTK-WASM is still experimental so it could have issues. Feel free to report these to VTK Gitlab so we can keep on improving stability and support for VTK-Examples-WASM.

              "},{"location":"WASM/2_NoWASMIntegration/","title":"Examples excluded from WASM","text":"

              Some examples do not implement a live preview feature in WebAssembly. There are the reasons:

              "},{"location":"WASM/2_NoWASMIntegration/#no-render","title":"No render","text":"

              A lot of examples are here to show pipelines, algorithms, or utils that does not always have a render (or whose render is not important), so we chose not to display a live preview of those that would only show you text.

              "},{"location":"WASM/2_NoWASMIntegration/#incompatible-dependencies","title":"Incompatible dependencies","text":"

              Some examples use external dependencies that either could not be built in WebAssembly (Qt) or are not Open Source (RenderMan).

              Some VTK modules aren't WASM-compatible or not fully working, like RenderingContextOpenGL2 or RenderingGL2PSOpenGL2. Those can break some examples that are then removed from VTK-Examples-WASM:

              • Images/CombineImages

              • Plotting/ChartMatrix, ChartOn3DScene, Diagram, MultiplePlots, ScatterPlot, SurfacePlot

              "},{"location":"WASM/2_NoWASMIntegration/#irrelevant-features","title":"Irrelevant features","text":"

              A few examples use features that aren't relevant with WebAssembly usage (FullScreen, OpenVR).

              There are examples which are just here to show different arguments for the same code (Rotations{A,B,C,D}, WalkCow{A,B}...). Those are also removed for practical reasons.

              "},{"location":"WASM/2_NoWASMIntegration/#technical-considerations","title":"Technical considerations","text":"

              In order to improve build times, stability and bandwidth, vtk-examples-wasm does not use Boost Library features even though it is provided by Emscripten Ports. This forces us to remove a few examples:

              • Graphs/AdjacentVertexIterator, BoostBreadthFirstSearchTree

              • InfoVis/MutableGraphHelper

              Second issue: VTK is initially writen for OpenGL2. As VTK-WASM uses WebGL2 (OpenGL ES3), a lot of features need to be rewritten to comply with WebGL standards. It takes a lot of time, and a few examples will have to wait to be fully integrated:

              • Shaders/BozoShader, BozoShaderDemo, CubeMap, MarbleShader, MarbleShaderDemo, SpatterShader

              • Visualization/CorrectlyRenderTranslucentGeometry

              • VolumeRendering/RayCastIsosurface

              At last, the fact that WebAssembly runs within the browser implies that resources are limited for the programs. We cannot give too much memory or workload to a single-threaded program running inside a browser tab.

              • Meshes/SubdivisionDemo requires ~1GB of memory to run a sufficient number of passes

              • Visualization/FroggieSurface needs to allocate a single array of 2GB.

              "},{"location":"WASM/2_NoWASMIntegration/#full-list-of-excludedunstable-examples","title":"Full list of excluded/unstable examples:","text":""},{"location":"WASM/2_NoWASMIntegration/#animation","title":"Animation","text":"
              • AnimateActors: No animation
              "},{"location":"WASM/2_NoWASMIntegration/#datastructures","title":"DataStructures","text":"
              • VisualizeKDTree: Works but error: Built-in Dual Depth Peeling is not supported on ES3
              "},{"location":"WASM/2_NoWASMIntegration/#explicitstructuredgrid","title":"ExplicitStructuredGrid","text":"
              • CreateESGrid: ESGrid isn't rendered
              "},{"location":"WASM/2_NoWASMIntegration/#io","title":"IO:","text":"
              • ReadCML: vtkShaderProgram: Links failed: Varying vertexVCGSOutput has static-use in the frag shader, but is undeclared in the vert shader
              "},{"location":"WASM/2_NoWASMIntegration/#imagedata","title":"ImageData:","text":"
              • ImageDataGeometryFilter, ImageNormalize, ImageWeightedSum: no error but render inaccurate with the screenshot
              "},{"location":"WASM/2_NoWASMIntegration/#images","title":"Images:","text":"
              • BackgroundImage: Background render broken

              • CombineImages: Error: GLctx is undefined

              • CombiningRGBChannels, ImageContinuousDilate3D, ImageContinuousErode3D, ImageCorrelation, ImageDifference, ImageMapper, ImageSobel2D, ImageText, ResizeImage: no error but render inaccurate with the screenshot

              • RGBToYIQ: error YIQ color space requires negative numbers

              "},{"location":"WASM/2_NoWASMIntegration/#infovis","title":"InfoVis:","text":"
              • DelimitedTextReader: uncaught exception
              "},{"location":"WASM/2_NoWASMIntegration/#interaction","title":"Interaction:","text":"
              • UserEvent: does not compile: vtkTestFilter.h file not found
              "},{"location":"WASM/2_NoWASMIntegration/#lighting","title":"Lighting:","text":"
              • Light, LightActor: No render of lights
              "},{"location":"WASM/2_NoWASMIntegration/#medical","title":"Medical:","text":"
              • MedicalDemo4: vtkTextureObject: failed to determine texture parameters
              "},{"location":"WASM/2_NoWASMIntegration/#meshes","title":"Meshes:","text":"
              • PointInterpolator: uncaught exception 1584136
              "},{"location":"WASM/2_NoWASMIntegration/#modelling","title":"Modelling:","text":"
              • Delaunay3DDemo: no slider

              • MarchingCubes: no error but render inaccurate with the screenshot

              "},{"location":"WASM/2_NoWASMIntegration/#picking","title":"Picking:","text":"
              • HighlightSelectedPoints: selection is \"all or nothing\", unable to select a portion of the points
              "},{"location":"WASM/2_NoWASMIntegration/#plotting","title":"Plotting:","text":"
              • ChartMatrix, ChartOn3DScene, MultiplePlots, ScatterPlot: points size too small

              • Diagram: default view shows only half the image, full tab images works well

              • PlotLine3D, SurfacePlot: Shader does not compile: Uniform numClipPlanes is not linkable between attached shaders

              "},{"location":"WASM/2_NoWASMIntegration/#points","title":"Points:","text":"
              • CompareExtractSurface, PoissonExtractSurface: does not compile: vtkPoissonReconstruction.h file not found

              • ExtractEnclosedPoints: works but error in console: vtkMultiThreader unable to create a thread

              • PowercrustExtractSurface: does not compile: vtkPowerCrustSurfaceReconstruction.h file not found

              "},{"location":"WASM/2_NoWASMIntegration/#polydata","title":"PolyData:","text":"
              • ExternalContour: no render of the left element

              • HighlightBadCells: doesn't highlight

              "},{"location":"WASM/2_NoWASMIntegration/#rendering","title":"Rendering:","text":"
              • OutlineGlowPass: No outline

              • PBR_HDR_Environment: No mipmap generation

              "},{"location":"WASM/2_NoWASMIntegration/#shaders","title":"Shaders:","text":"
              • BozoShader, BozoShaderDemo, CubeMap, MarbleShader, MarbleShaderDemo, SpatterShader: could not compile vtkShaderProgram
              "},{"location":"WASM/2_NoWASMIntegration/#structuredgrid","title":"StructuredGrid:","text":"
              • BlankPoint: result unaccurate with screenshot
              "},{"location":"WASM/2_NoWASMIntegration/#texture","title":"Texture:","text":"
              • AnimateVectors: Animation not working
              "},{"location":"WASM/2_NoWASMIntegration/#utilities","title":"Utilities:","text":"
              • RenderScalarToFloatBuffer: warning: readPixels: Format and type RED/FLOAT incompatible with this RGBA32F attachment
              "},{"location":"WASM/2_NoWASMIntegration/#visualization","title":"Visualization:","text":"
              • ChooseTextColorDemo: no text shown

              • CorrectlyRenderTranslucentGeometry: works but Error: Built in Dual Depth Peeling is not supported on ES3

              • EdgePoints: doesn't show the model

              • ExtrudePolyDataAlongLine: does not compile: vtkFrenetSerretFrame.h not found

              • FroggieSurface: WebGL2RenderingContext.bufferData: Argument 2 can't be an ArrayBuffer or an ArrayBufferView larger than 2 GB

              • RandomProbe: Error: indirect call to null

              • LabeledMesh: Labels display at random positions

              • TextureMapImageData: no texture

              "},{"location":"WASM/2_NoWASMIntegration/#volumerendering","title":"VolumeRendering:","text":"
              • FixedPointVolumeRayCastMapperCT, MinIntensityRendering, SimpleRayCast: Failed to determine texture parameters

              • RayCastIsosurface: shader failed to compile

              "},{"location":"WASM/2_NoWASMIntegration/#widgets","title":"Widgets:","text":"
              • CameraOrientationWidget: Widget not showing

              • SeedWidgetImage: image rendering broken

              "},{"location":"WASM/3_BuildingWASM/","title":"Building an example in WASM","text":"

              To build an example you downloaded from VTK Examples in WebAssembly, you are going to need to download the tarball of the example and extract it.

              tar xf example.tar.gz\ncd example\n

              Then, remove the CMakeLists.txt file from the extracted tarball. Now follow the instructions from the contribution guidelines to create the new CMakeLists.txt and index.html.

              "},{"location":"WASM/3_BuildingWASM/#building-vtk","title":"Building VTK","text":"

              To build an example using WebAssembly, you can use the kitware/vtk-wasm docker image but some modules are disabled in that version that may be needed for many examples.

              To build VTK by yourself, you will need to download VTK source code and then follow the instructions in this documentation article, except that at the first step of the build, you will have to change the configuration command to:

              emcmake cmake \\\n        -S /work/src \\\n        -B /work/build-vtk-wasm \\\n        -GNinja \\\n        -DBUILD_SHARED_LIBS:BOOL=OFF \\\n        -DCMAKE_BUILD_TYPE:STRING=Release \\\n        -DVTK_ENABLE_LOGGING:BOOL=OFF \\\n        -DVTK_ENABLE_WRAPPING:BOOL=OFF \\\n        -DVTK_MODULE_ENABLE_VTK_cli11:STRING=YES \\\n        -DVTK_MODULE_ENABLE_VTK_RenderingLICOpenGL2:STRING=DONT_WANT \\\n        -DVTK_BUILD_TESTING=ON \\\n        -DCMAKE_INSTALL_PREFIX=/install\n
              "},{"location":"WASM/3_BuildingWASM/#building-the-example","title":"Building the example","text":"

              To build your example, simply run:

              emcmake cmake -DVTK_DIR=/work/build-vtk-wasm -S path_to_source -B path_to_build\ncmake --build path_to_build\n

              Then the only thing you have to do is to run the example:

              cd path_to_build\npython3 -m http.server 8000\n

              Open your browser to http://localhost:8000 and enjoy !

              "},{"location":"WASM/4_ContributingWASM/","title":"Adding WASM preview to an example","text":""},{"location":"WASM/4_ContributingWASM/#configure-your-example-if-it-needs-to-be-executed-with-arguments","title":"Configure your example if it needs to be executed with arguments","text":"

              First, if it requires files, you will need to ensure those files are stored in vtk-examples/src/Testing/Data or vtk-examples/src/SupplementaryData/Cxx.

              If you have to add a file for your example to work you will also have to add instructions about the file package that will need to be linked to the WASM file by editing vtk-examples/src/Admin/WASM/packaged_files.json

              Then, you will need to edit vtk-examples/src/Admin/WASM/ArgsNeeded.json. Remember everything under the package name in packaged_files.json will be mapped to \"/\" in the WebAssembly virtual filesystem (e.g. DicomTestImage/brain_001.dcm will become /DicomTestImage/brain_001.dcm). ArgsNeeded.json needs two variables for each example: the args in the same order you would put them when running your example from bash and the names of the file packages your are going to need. Leave the list empty if there's none.

              "},{"location":"WASM/4_ContributingWASM/#test-your-example","title":"test your example","text":"

              You will need to download VTK source code.

              Run the script to generate the CMakeLists and the index.html you need:

              cd vtk-examples/src/Admin\npython3 ./GenerateHtmlCMake.py path/to/example path/to/vtk/source\ncd path/to/example\n

              Then build and run your example as explained here. If it works well, then you are finished here. If it doesn't because of an error in VTK pipeline, then revert the changes you made to ArgsNeeded.json and add the example to the exclusion list. You are welcome to add an issue to VTK Gitlab if you think it's relevant.

              "}]} \ No newline at end of file diff --git a/site/sitemap.xml b/site/sitemap.xml index 73df0ecf3ef..d0bf2553aa7 100644 --- a/site/sitemap.xml +++ b/site/sitemap.xml @@ -2,9557 +2,9557 @@ https://examples.vtk.org/site/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharpHowTo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CxxHowTo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/JavaHowTo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/JavaScript/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/PythonHowTo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/PythonicAPI/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Trame/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBookFigures/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKFileFormats/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Coverage/CSharpVTKClassesNotUsed/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Coverage/CSharpVTKClassesUsed/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Axes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Cone/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Cube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Disk/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Line/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Plane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Planes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/PlanesIntersection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Point/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/PolygonIntersection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Quad/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ConvertFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/DEMReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/FindAllArrayNames/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/JPEGReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/JPEGWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/MetaImageReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/MetaImageWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/PNGReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ParticleReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadBMP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadOBJ/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadPDB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadPLY/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadPNM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadPlainText/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadSTL/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadTIFF/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/SimplePointsReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/VRML/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/WriteBMP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/WritePNG/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/WritePNM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/WriteTIFF/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/WriteVTI/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/WriteVTP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/WriteVTU/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/InfoVis/XGMLReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/CapClip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/CellEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/Decimate/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/FillHoles/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/OBBDicer/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/SolidClip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/Subdivision/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/Triangulate/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/AlignFrames/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/ClosedSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/Curvature/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/MultiBlockMergeFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/NullPoint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/PolyDataGetPoint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/WarpVector/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/SimpleOperations/DistanceBetweenPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/SimpleOperations/DistancePointToLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/SimpleOperations/GaussianRandomNumber/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/SimpleOperations/PerspectiveTransform/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/SimpleOperations/ProjectPointPlane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/SimpleOperations/RandomSequence/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/SimpleOperations/UniformRandomNumber/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Animation/AnimateActors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Animation/RotatingSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Annotation/MultiLineText/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Annotation/TextOrigin/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Annotation/XYPlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/CMakeTechniques/CheckForModule/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Coverage/CxxVTKClassesNotUsed/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Coverage/CxxVTKClassesUsed/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/BuildLocatorFromKClosestPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/BuildOctree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/ClosestNPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadius/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/KdTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/KdTreePointLocatorClosestPoint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeIntersectWithLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/OctreeClosestPoint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadius/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/OctreeKClosestPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/AlgorithmFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/AlgorithmSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/FilterProgress/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/ImageAlgorithmFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/MultipleInputPorts/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/PolyDataAlgorithmReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/PolyDataFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/ProgressReport/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Developers/Warnings/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/AppendFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/GenericClip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/Glyph2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/Glyph3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/SelectionSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Filtering/WarpTo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Axes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Circle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Cone/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Cube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Disk/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Line/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Plane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Planes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/PlanesIntersection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Point/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/PolygonIntersection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Quad/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/ColorEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/ConstructTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/CreateTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/DirectedGraphToMutableDirectedGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/EdgeListIterator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/InEdgeIterator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/MutableDirectedGraphToDirectedGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/OutEdgeIterator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/RemoveIsolatedVertices/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/ShortestPath/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/TreeBFSIterator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/TreeToMutableDirectedGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/VertexSize/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/3DSImporter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ConvertFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/DEMReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/DumpXMLFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/GLTFExporter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/GLTFImporter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/HDRReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ImageWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ImportToExport/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/IndividualVRML/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/JPEGReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/JPEGWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/MetaImageReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/MetaImageWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/OBJImporter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/PNGReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/PNGWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ParticleReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadBMP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadCML/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadDICOM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadExodusData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadOBJ/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadPDB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadPLY/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadPNM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadSLC/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadSTL/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadTIFF/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadTextFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/SimplePointsReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/SimplePointsWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/StructuredGridReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/TransientHDFReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/VRMLImporter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/WriteBMP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/WritePLY/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/WritePNM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/WriteSTL/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/WriteTIFF/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/WriteVTI/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/WriteVTP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/WriteVTU/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/XMLPImageDataWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/XMLPUnstructuredGridWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/IO/XMLStructuredGridWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/CellIdFromGridCoordinates/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/ClipVolume/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/GetCellCenter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/ImageIterator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/ImageReslice/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/IntersectLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/IterateImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/Pad/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/RescaleAnImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/Actor2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/BackgroundImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/BorderPixelSize/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/Cast/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/CenterAnImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/CombineImages/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/DotProduct/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/DrawShapes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ExtractComponents/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/FillWindow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/Flip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/Gradient/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageAccumulate/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageConvolve/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageCorrelation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageDifference/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageDivergence/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageExport/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageFFT/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageGridSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageHistogram/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageImport/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageLaplacian/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageLuminance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageMagnify/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageMagnitude/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageMapToColors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageMapper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageMask/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageMathematics/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageMedian3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageOrder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageOrientation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImagePermute/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageRFFT/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageRange3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageRotate/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageShiftScale/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageShrink3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageSlice/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageSobel2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageStack/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageStencil/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageText/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageThreshold/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageTransparency/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageValueRange/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageVariance3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ImageWarp/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/InteractWithImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/Interpolation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/MarkKeypoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/NegativeIndices/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/PickPixel/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/PickPixel2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/RGBToHSI/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/RGBToHSV/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/RGBToYIQ/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ResizeImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/StaticImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Images/Transparency/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitDataSet/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/PassThrough/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/WordCloud/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/Assembly/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/CallBack/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/CallData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/ClientData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/DoubleClick/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/Game/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/ImageClip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/ImageRegion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/MouseEvents/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/PickableOff/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/Picking/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/PointPicker/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/TrackballActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/UserEvent/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Lighting/Light/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Lighting/LightActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Lighting/SpotLights/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/1DTupleInterpolation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/EigenSymmetric/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/HomogeneousLeastSquares/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/LUFactorization/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/LeastSquares/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/MatrixInverse/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/MatrixTranspose/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/NormalizeVector/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/PerpendicularVector/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/VectorDot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Math/VectorNorm/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Matlab/MatlabEngineFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Medical/TissueLens/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/AddCell/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/CapClip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/CellEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/Decimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/FillHoles/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/OBBDicer/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/SolidClip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/Subdivision/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/Triangulate/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/Bottle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/CappedSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/Finance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Modelling/Spring/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Parallel/ExodusIIWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Picking/AreaPicking/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Picking/CellPicking/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Picking/HighlightSelection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/AreaPlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/BarChart/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/BoxChart/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/Diagram/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/Histogram2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/LinePlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/PieChart/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/PieChartActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/StackedBar/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/StackedPlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/DensifyPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/ExtractClusters/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/ExtractSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/NormalEstimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/PointOccupancy/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/SignedDistance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Points/UnsignedDistance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/AlignFrames/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/AttachAttributes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/Casting/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CellCenters/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CellLocator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CellTreeLocator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CenterOfMass/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CleanPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ColorCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ConvexHull/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/Curvatures/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/DataBounds/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/DeleteCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/DeletePoint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/DetermineArrayDataTypes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ExternalContour/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/FieldData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/GradientFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/MaskPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/MergePoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/MergeSelections/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/MeshQuality/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/MiscCellData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/MiscPointData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/MultiBlockMergeFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/NullPoint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/Outline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PointCellIds/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PointLocator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PointLocatorRadius/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PointSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataGetPoint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/Reflection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ReverseSense/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/Silhouette/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/Stripper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/TransformFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/TriangleArea/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/TubeFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/WarpScalar/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/WarpSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/WarpVector/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/BarChartQt/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/ImageDataToQImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/QImageToImageSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/ShowEvent/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/CameraBlur/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/Cone3/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/Cone4/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/GradientBackground/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/LayeredActors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/Mace/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/Model/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/MotionBlur/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/Rainbow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/Rotations/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/RotationsA/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/RotationsB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/RotationsC/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/RotationsD/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/Shadows/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/StippledLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/StripFran/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/TransformSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/WalkCow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/WalkCowA/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Rendering/WalkCowB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Shaders/BozoShader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Shaders/CubeMap/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Shaders/MarbleShader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Shaders/SpatterShader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Shaders/SphereMap/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/SimpleOperations/DistanceBetweenPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/SimpleOperations/DistancePointToLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/SimpleOperations/FloatingPointExceptions/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/SimpleOperations/GaussianRandomNumber/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/SimpleOperations/PerspectiveTransform/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/SimpleOperations/ProjectPointPlane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/SimpleOperations/RandomSequence/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/SimpleOperations/UniformRandomNumber/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/CameraPosition/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/CheckVTKVersion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/ChooseContrastingColor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/PointToGlyph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/ReadPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/RestoreSceneFromFieldData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/RestoreSceneFromFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/SaveSceneToFieldData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/SaveSceneToFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/ViewportBorders/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Snippets/WriteImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/StructuredGrid/GetLinearPointId/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/StructuredPoints/Vol/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Texture/AnimateVectors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Texture/TexturePlane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Texture/TextureThreshold/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Texture/TexturedSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/2DArray/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/3DArray/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/Animation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/AnimationScene/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ArrayLookup/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ArrayRange/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/BoundingBox/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/BoundingBoxIntersection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/Box/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/CardinalSpline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/CheckVTKVersion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ColorLookupTable/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ColorTransferFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ConstructTable/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/Coordinate/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/CustomDenseArray/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/DataAnimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/DeepCopy/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/DenseArrayRange/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/DiscretizableColorTransferFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/FileOutputWindow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/FilenameFunctions/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ForLoop/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/FrameRate/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/FullScreen/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/FunctionParser/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/GetClassName/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/GetDataRoot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/KnownLengthArray/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/MassProperties/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ObserveError/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/PCADemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/PiecewiseFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/PointInPolygon/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/Screenshot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ShallowCopy/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ShareCamera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/SortDataArray/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/SparseArray/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/TimeStamp/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/Timer/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/TimerLog/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/UnknownLengthArray/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/Variant/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/Vector/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/VectorArrayKnownLength/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/VectorArrayUnknownLength/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Utilities/ZBuffer/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Video/FFMPEG/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Video/MPEG2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Video/OggTheora/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Views/RenderView/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/AxisActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Blow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Camera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CameraActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CameraModel1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CameraModel2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ClipArt/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CloseWindow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ColorSeriesPatches/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ComplexV/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Cursor2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Cursor3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CursorShape/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/DrawText/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/EdgePoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/FastSplatter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/FlatShading/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Follower/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/FontFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/FrogBrain/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/FrogSlice/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/FroggieView/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Hanoi/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Hawaii/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/HedgeHog/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/HideActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/HideAllActors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Kitchen/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/LODProp3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/LabelContours/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Legend/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/LineWidth/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/LoopShrink/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Lorenz/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Morph3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/MovableAxes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/MoveActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/MoveCamera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/MultipleActors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/NamedColorPatches/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/NamedColors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/NoShading/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Opacity/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/PointSize/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/RandomProbe/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/RotateActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/SceneBounds/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/StreamLines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/TextSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/TransformActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/VectorField/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/VectorText/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/WindowSize/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/WindowTitle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Visualization/Wireframe/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/AffineWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/AngleWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/BorderWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/BoxWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/CompassWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/ContourWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/HoverWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/LineWidget2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/LogoWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/SeedWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/Slider/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/Slider2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/SphereWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/SplineWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/TextWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Documentation/Frog_mhd_format/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Documentation/Frog_vtk_format/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Documentation/PBR_JSON_format/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Instructions/ConvertingFiguresToExamples/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Instructions/ForAdministrators/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Instructions/ForDevelopers/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Instructions/ForUsers/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Instructions/Guidelines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Instructions/WebSiteMaintenance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Snippets/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Annotation/MultiLineText/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Annotation/TextOrigin/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Coverage/JavaVTKClassesNotUsed/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Coverage/JavaVTKClassesUsed/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/DataStructures/BuildOctree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Filtering/Delaunay2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Filtering/Glyph2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Filtering/Glyph3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Filtering/PerlinNoise/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Filtering/TransformPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Filtering/WarpTo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Arrow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Circle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Cone/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Disk/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Frustum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Line/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/LongLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/PlanesIntersection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Polygon/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Pyramid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Quad/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/TextActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Triangle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/GeometricObjects/Vertex/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Geovis/CompassWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Geovis/EarthSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Graphs/RandomGraphSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Graphs/VisualizeGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ConvertFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/DEMReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/JPEGReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/JPEGWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/PNGReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ParticleReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadBMP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadCML/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadDICOM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadOBJ/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadPLOT3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadPLY/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadPNM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadSLC/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadSTL/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadStructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadTIFF/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ReadVTP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/SimplePointsReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/SimplePointsWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/StructuredPointsReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/ThreeDSImporter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/VRMLImporter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/WritePLY/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/WritePNM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/WriteSTL/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/WriteTIFF/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/WriteVTP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/WriteVTU/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/XMLPImageDataWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/XMLPUnstructuredGridWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/IO/XMLStructuredGridWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/ImageData/ImageNormalize/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/ImageProcessing/ShotNoise/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Images/Actor2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Images/Cast/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Images/Flip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Images/ImageFFT/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Images/ImageSinusoidSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Images/RTAnalyticSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Images/StaticImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Imaging/ImageTest/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitDataSet/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/InfoVis/GraphPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/InfoVis/PassThrough/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Interaction/Assembly/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Interaction/PickableOff/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Interaction/RubberBandPick/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Interaction/RubberBandZoom/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Interaction/StyleSwitch/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Interaction/TrackballActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Interaction/TrackballCamera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Lighting/LightActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Lighting/SpotLight/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Math/MatrixInverse/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Math/MatrixTranspose/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Math/NormalizeVector/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Medical/MedicalDemo1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Medical/MedicalDemo2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Medical/MedicalDemo3/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Medical/MedicalDemo4/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Meshes/AddCell/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Meshes/BoundaryEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Modelling/Bottle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Modelling/DelaunayMesh/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Modelling/Spring/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Parallel/ExodusIIWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Points/FitImplicitFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/CellCenters/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/CenterOfMass/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/ColorCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/ColoredPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/KochanekSpline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/MeshQuality/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/Outline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/Reflection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/RibbonFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/RotationAroundLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/Stripper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/TransformFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/TransformPipeline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/PolyData/TubeFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGridToTetrahedra/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Rendering/AmbientSpheres/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Rendering/ColoredSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Rendering/Cone6/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Rendering/Mace/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Rendering/SpecularSpheres/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/SimpleOperations/DistanceBetweenPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/SimpleOperations/PerspectiveTransform/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/SimpleOperations/ProjectPointPlane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/SimpleOperations/RandomSequence/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Snippets/WriteImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/StructuredPoints/StructuredPointsToUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/StructuredPoints/Vol/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Texture/TexturePlane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Texture/TexturedSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/BrownianPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/ColorLookupTable/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/DiscretizableColorTransferFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/FullScreen/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/FunctionParser/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/GetDataRoot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/KnownLengthArray/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/PiecewiseFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/Screenshot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/TimerLog/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Utilities/UnknownLengthArray/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Video/OggTheora/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Views/RenderView/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/AnimDataCone/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/Animation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/BackfaceCulling/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/BackgroundColor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/BackgroundGradient/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/BlobbyLogo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/Camera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/CameraActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/ColorActorEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/ColorAnActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/ComplexV/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/CornerAnnotation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/CubeAxesActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/Cursor2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/Cursor3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/CursorShape/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/DistanceToCamera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/DrawText/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/Follower/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/ImageOrientation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/Legend/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/LegendScaleActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/LineWidth/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/LoopShrink/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/MoveActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/MoveCamera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/MultipleActors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/MultipleViewports/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/NoShading/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/Opacity/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/ProjectSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/ProteinRibbons/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/RandomProbe/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/ScalarBarActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/ScalarVisibility/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/SideBySideViewports/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/VectorFieldExample/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/VisualizeImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/VisualizeVTP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/WindowSize/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Visualization/WireframeSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/AngleWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/AngleWidget2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/BalloonWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/CaptionWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/DistanceWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/LogoWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/PlaneWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/SeedWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/SplineWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Java/Widgets/TextWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Snippets/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Annotation/MultiLineText/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Annotation/TextOrigin/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Arrays/GetValues/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Arrays/RenameArray/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Coverage/PythonVTKClassesNotUsed/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Coverage/PythonVTKClassesUsed/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/AppendFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/CombinePolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/Delaunay2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/GaussianSplat/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/Glyph2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/Glyph3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/PerlinNoise/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/TransformPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Filtering/WarpTo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Arrow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Axes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Circle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Cone/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Cube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Cube1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Cylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Disk/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/EarthSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Frustum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Line/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/LongLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Plane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Planes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/PlanesIntersection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Point/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/PolyLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Polygon/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/PolygonIntersection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Pyramid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Quad/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Sphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/TextActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Triangle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/GeometricObjects/Vertex/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/ColorEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/ConstructGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/ConstructTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/CreateTree/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/EdgeWeights/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/GraphToPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/NOVCAGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/RandomGraphSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/ScaleVertices/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/SelectedVerticesAndEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Graphs/VisualizeGraph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/3DSImporter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/CSVReadEdit/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/CSVReadEdit1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/HDRReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ImageWriter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadDICOM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadDICOMSeries/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadExodusData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadPLOT3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadSLC/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadSTL/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/ReadVTP/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/TransientHDFReader/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/WritePLY/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/WriteSTL/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/WriteTriangleToFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageData/ImageNormalize/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageData/SumVTKImages/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageProcessing/Attenuation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageProcessing/Pad/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Images/Actor2D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Images/BackgroundImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Images/Cast/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Images/ImageWarp/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Interaction/CallBack/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Interaction/MouseEvents/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Medical/MedicalDemo1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Medical/MedicalDemo2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Medical/MedicalDemo3/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Medical/MedicalDemo4/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Medical/TissueLens/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Meshes/BoundaryEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Meshes/CapClip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Meshes/Decimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Meshes/DeformPointSet/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Meshes/PointInterpolator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Meshes/SolidClip/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/Bottle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/CappedSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/ContourTriangulator/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/DelaunayMesh/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/Finance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/FinanceFieldData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/MarchingCubes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Modelling/Spring/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Picking/CellPicking/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Picking/HighlightPickedActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Plotting/MultiplePlots/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Plotting/ScatterPlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Plotting/SpiderPlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Plotting/SurfacePlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/CellsInsideObject/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/ClosedSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/ColoredTriangle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/Curvatures/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/ExtractSelection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/FilledPolygon/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/IterateOverLines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/Outline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/PointSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/RotationAroundLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/TriangleCornerVertices/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/TriangleCorners/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/TubeFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/PolyData/WarpVector/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/RectilinearGrid/RGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/AmbientSpheres/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/CameraBlur/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/ColoredSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/Cone3/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/Cone4/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/GradientBackground/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/LayeredActors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/Mace/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/Model/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/MotionBlur/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/PBR_Mapping/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/PBR_Materials/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/PBR_Skybox/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/Rainbow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/Rotations/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/RotationsA/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/RotationsB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/RotationsC/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/RotationsD/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/Shadows/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/SpecularSpheres/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/StippledLine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/StripFran/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/TransformSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/TransparentBackground/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/WalkCow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/WalkCowA/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Rendering/WalkCowB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/SimpleOperations/DistanceBetweenPoints/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Snippets/CameraPosition/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Snippets/CheckVTKVersion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Snippets/GetProgramParameters/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Snippets/PointToGlyph/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Snippets/ReadPolyData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Snippets/WriteImage/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/StructuredGrid/SGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/StructuredPoints/Vol/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Texture/AnimateVectors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Texture/TextureCutQuadric/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Texture/TextureCutSphere/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Texture/TexturePlane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Texture/TextureThreshold/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/Animation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/CheckVTKVersion/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/LUTUtilities/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/Screenshot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/SelectExamples/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/ShareCamera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/VTKImportsForPython/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/VTKModulesForCxx/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Utilities/Variant/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/AlphaFrequency/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/BlobbyLogo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/Blow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/Camera/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/CameraModel1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/CameraModel2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/CollisionDetection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/ColorAnActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/ColorSeriesPatches/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/ComplexV/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/CubeAxesActor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/FrogBrain/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/FrogSlice/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/FroggieSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/FroggieView/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/GlyphTable/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/Hanoi/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/HanoiInitial/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/HanoiIntermediate/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/HardwareSelector/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/Hawaii/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/Kitchen/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/KochSnowflake/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/LoopShrink/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/Lorenz/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/MultipleViewports/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/NamedColorPatches/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/NamedColors/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/NormalsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/PointSize/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/QuadricVisualization/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/SphereTexture/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/StreamLines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/TextSource/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/VectorText/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Visualization/WindowTitle/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCasesA/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCasesB/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCasesC/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCasesD/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeA/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivityA/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/BalloonWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/BoxWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/CompassWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/ContourWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/SphereWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/SplineWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Python/Widgets/TextWidget/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/PythonicAPI/Coverage/PythonicAPIVTKClassesNotUsed/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/PythonicAPI/Coverage/PythonicAPIVTKClassesUsed/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Trame/Applications/FiniteElementAnalysis/FiniteElementAnalysis/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Trame/Applications/MultiFilter/MultiFilter/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Trame/Applications/RemoteSelection/RemoteSelection/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/Trame/MiniApps/SimpleCone/SimpleCone/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/00Preface/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/01Chapter1/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/02Chapter2/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/03Chapter3/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/04Chapter4/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/05Chapter5/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/06Chapter6/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/07Chapter7/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/08Chapter8/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/09Chapter9/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/10Chapter10/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/11Chapter11/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/12Chapter12/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBook/13Glossary/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/VTKBookLaTeX/VTKTextBook/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/WASM/1_WASM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/WASM/2_NoWASMIntegration/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/WASM/3_BuildingWASM/ - 2024-04-20 + 2024-04-21 daily https://examples.vtk.org/site/WASM/4_ContributingWASM/ - 2024-04-20 + 2024-04-21 daily \ No newline at end of file diff --git a/site/sitemap.xml.gz b/site/sitemap.xml.gz index 031e3867132db760d7e00d0d13fd03c7262466c3..bdd217e6d573f3977b0982a17325ddac1da27874 100644 GIT binary patch delta 15178 zcmXw=V{}+e8?M8~c4Mcp?KCzT+qSi1HMY&hXl&cIZ8ko6zjMy7y=Lv7v)0UgU(Yoi zJ{>*);csZ@g9$QIuumroXA>I(dwO>pYmkjBEjLn*_@k{Or12S9e)j$ZTLFnjeLunSAK#aa@3^aj0$znkloQ{;sga=}c5ji<(aOG^V7h|<_0`2aaRr+gOaJV?`_@s=xB)) zr@+6;8H+jcclmXq(RL2Pl8EMpd>L0eExN9Us1@>Pj`)n#cY@_e_%)q9ayPfZ0{B7iW4y+z&4@9Kr2I8Ve4U9vf@1qjBh3SJ;;}6 z8#>5a_xH{vJjCZ+U!q6|w@>8XzhqdeZCB~VP5W^%JLDEK)%ZshK}{;B9-w6Xj`A2> zP=(cr{Cb~Xm`CQc_K-!C_@uw4OZ6FGNX@fzG5{#xIj0=E%&IPC~4<2A3BK#4vB{KABKj!UAS_L z*}3RCluGA!DMD9w4xLzuEdUEkL0k!ouc((x1CO9DZ=xuMmwq55{ka1_d>z+Ig79VN zd4n%PhViT(VG2aOWPcz{5CpVf{Q3<=%>Jm?GmQpYLx1waIU1B356N^cvf}45DK=*n zv!A{nrrY8t3b-@>d7z)1=~%T0`Xb=x$1f)&m=x{pGHo3>%^RMD_f#%TfOXW=d z{;X}Nf0NFVsP^X?Z-Da?zl-;~q3Z0$o3}ugAU3bEqn0CwkMf!Da-UAE(043b%;I0JRMjzwx_RM~#U6a>9m&p=X=f9>LtLc8nIN_(R6F(;h1H z^|EW#&fsb-vf9*#SCO=WX-Ao?q-Vi}Dp?ZIUfaLgFNX@hH-Kh;qQ5$kM}xI2b)GuI z9nOsTGyRhbu%=VK$*qjlD#l7j8%YQuf*B;(c@?Lt_}(Pe%e_9FxUH+5Vf*0D^5Chk z8Fqbeld~@N^D6>Y1_?*}y5f(C>&J1B&rMy8!ee$Xw+nL)R6VW<$WwADC+&zPFEk>7 zq*oD^gDtJGa>Z-F@5cC-0zX6DTHUmmvpj)Z9lIFZ0-(uxv4D7%pPH?KBPSN3v4T@Z zBu}(sM|oPAF*}ejP=(^={R^g_y^&cV-%&dQ(aYr zDFnV6B(RQM@l1ZHEfkL&G0=`HNGgc)UQdzLHzQy%q6FRmt2(kr%E?l*k{P&6%8!ep*P;~XJwCIxCR=RsD^5PWwuEO%?k>X9`rVI+ArgtlQ9%`(>ffO`Hn8k89-wKmW&}yG&(@VBSK$`IWZyWZ*&otO*yq)BGp1OcTNp|N|16#{Bk-KBI~NVM-H7{#gQzS%T6q7 zPCB`H6u9XQmM=xSQgo2qkhxh;mqo^gg3OBZ1O<9dPB>ceoa$}}~x0y{DcOA+y16rS)A( z8>!;)47vikT}_N%2dPlMqkcD|w1zbtejn(_mlmkLGDJqp`>nK$kNucg5&tqX+yFj2 z<@el8GpZEyjy$5mcOfo@{z|bPGcM8|c>%+(QyN-;ZmxG`#f`h?O~KNjuyOA=+u8WK0}WBS z;sU`A6JD2yGxldr5?-j^Vsmh_i|ioU#Z%bT^oM0XgBr@gec`KM5IG+LZ^fs*JbyRp z?~c@8&786IfC4=v{6XM8z;4rJj_?*+7uW#**UbrO4LdrJ3=3x(ybg2LHa8iEM;XRey&GvSiDrGgBpc<4xTc18#ofu~ z{+n&58OF&1*k$vgVF5mgrgeWumyq~6KkjW>QXwCPJO8A#ul|lC(B-&Cxh?HTe=b2H z18lW}X7l(36Kb3viJ#qQ$$p>A<=QDA;FTjCK8>*E?cyedyZ5J!3dR$i9heXxw?*ea zwB`}qHOqaTp|?NpTSVJGj@f{2A?JVQE=RoP(h=5iEUJVPC|+nRn~ zzyLY+4szoWdk1S4aDd9x&2~?_eVS*I1f@0o6FAx12OH5YDJ}6m?KgW%hVISpVacP= zGUzuuX(u&n^N|xX&g;&!3ko6D8K;X&~~0vPO{b8If{ zg8HEb#b1@?qDzxO}betQ}9BS_qz0HTA23bR+*A z-g~$pSSDjKMJsd5X~)_Z_b?#t$#9|)?X~9977_j`k7md9e@WXYgNo8@q8_xxW!)h* zQbqz^pgvalB?!|vZa=8Nm6mGvuuoBnZ<0;IpMIPI`fVRH_Vw%jlt^#(+xo{uGqthL z18w&A{cZL*AJI;sNllprjgPlF_@Eo^m} z&ZqtByp<&?Q<@I$=q9U=rrRAkwBi%AlnjlLu=(|?+?%uw6GePMy6)KYM4U!?MIraD zWSpA7p`YNJbrDpm7HiZRGJ|ZvfKuo}@cI}Dc1!tyb3EsH%w3xobZ~bra=De1Zl(nT zx@K5Q)&l@hi+C7=Jw|OW{5CcP`6`Jqm~S|2FL>;#US)m;5~m!~D_|h-S5Zg@oI4Tc zO8y8WF>t>UyBIGTs{RM88D?}eGOFj3X~Zf}L|{MLD<<+S$VC`8j<5;?3&g#q2ZZXV zk00#7xKXA}V+G}&5IQji8n;^;ri=@wVoXkW849@D~p@*lqK6@umzv;~=II zTuyVrO;EM*U*{Fpjt4lhWtnMq{Zskp1mMCC1S|@!t6|)9~lnEeeyC=c)5Zq}xOnaa`00_#UKQ z%!UVCZd723v$YZuoRsWrJ^5+-xSzR|mzLc;#{d(!glZ1^ z2_J^jYvJPxR*H-EcdOgbKJHA@VigF_syfOFXLV*4dWq7|-2S6pA()BfvPlmlUe}UHD+JkD{Gx z>W!t0KLg5z*82qDQ!^0b3DUF6q306!Uj$(>mk{LEXgyuRicg0 z6{>vpGHKRuQ%g|-0;yMGS_z7=uE#7>s{F3;N|JmDUZ0+PF* zv!H7l8YX{QEoFhUjHZ z(N;c$kNDwecMzLw@P9htKu8x3hL+QfeFmDi>&d z8@zH@+kBa5PHa6FBl>1(pLJpV-6W)vcMQ(uz^B`HNUi;Pd+8p(f;VP&_42N7Mu^WA zg33kjn`0gx$f3oB$HhRJFVQap=s`S(KS#Z=MG{#_L%Nclz<{8eZOh-{O=}eUdLf&q z#9!18)VXw5v#5IT1rmKuv0MJkE})PZZ%iGKAJ4wrLN&DMaL|n`UXzL~s!-^gLJEEF z^Q4ef?g<^^TI3^bPt6etge&=F0z`hM0a)AC)G1F;mg!0 zTfgZ}i|r1J08gvS%-Gs>Y!zO#4*YQEkj^^|YYT3+@7+Un0# z?2W0He23Rpj#22RsmtEX{mznukcSp;!3iHba4np3%+(plXHcJlMYg~1qi5E9K5Sx& z$5&UnB$W6nj1>;m1N24~H_4ytfgX7wI(zdfel{^Bc%Tx47A0h$;(@X!G@}x7;n1I5 z8>JS;K>JW~6xNH3-~)4rSdq<0#jK#IG8Yu+jCH_buhL5$lgD?_oU%6z5!ze|4)5Aq zn*?Mudc>?v3E7j9G^Zae+NBw<2{LE|0N9`x+~6xl$y-h=ChjE*yrRhx*=&%=w8 zB^$Oa1vagJHh-)R^}VYQRdf;`)X8k&%=B~yp@}=gQf9}kfe{9S?kvwBbMOf$0_e<5 zuilKXK?@8M;I&w|A{>!$v$~yl3KakL9g&8-l_2e$$|$=Uj-xnYb!ZsV4HvJFOc4FQ zyG15AV?!J^I)aN8ACa>p%En24aBYfZ;gG|{k`hoBdgca-t5(Ccq#*tbkZ&Mr)2Z;B z!P>!&^5T5oU|J`E4=7KxjkinM1ZMfAbyC%+nai9q>w0cbf8KoCX~5cdW8Gu~Y9qSM%5plh95$mNv{?rhwVtNod#wFqZ_ zE+cRWxDJAHj>X&;-1As|?RqN@V=1UftB4qM2#+vF)}TL|q-xRS^RcBC09j-fu^KgW zf|YhwN9mOeAxL2oI{efx*u1W06LIJc`t_G1)BtgcOgfd7ZC_o9(nh-KP>}L!YwM>;d6GN z5Ci@ND)nHm$J-k>2g-iRIFhMmew3rxmALg!IHJ(H!xd20NnuJfuU{lb)YuX2?8?~f zRmx{K-AFgMI(Qv{ASZ7*B1!T*JAzzSu?Ag0G~JjB_PcS%;NY6G02}Sn?-392IA+f} zV1eVe5-(?);vn|=MWsNrsiyr4X0teJU2vTRj1R&=Sp;{1HF3P%j>+)sR4;*{i zyxBIuku3@30@tn=fKitVq2ia;dK$Uw3kT@H>n?dd$L(P$DFlfUVBB*mqm$TYa9pw~ zCNrjmU66&3$>X$kg7BuQu)M_=+mFxZ8zF}?FV0SrWdE-a0Ba-k0x7{Nu zVlz>GPaCIj^a2i(L~RlpQwnJKEqut>j@j>5enhq*Hrz@hAl7j1WlX4VZ&^;Z2p1ys zC9e6aRPEI!ChgUh>66ly_W9KZbJcY{Nl1PDSqi=)9?* z-`i_e!$DuSId0(V5B7BH;`~a%_PoBNgAT>~!-t*AIJC^9x+yPriZDG>Ym&2&-H{*> zT4RKl#%+J@T+xSg@OHLKLsZ8l5I9(?UNvH-YHK_Vuo}T9Au59JMJ_u1;+2(VDdo~2 zqDuWU$cPabJmAxdC>S!z_gv=8#UO@_Vv)9|8xC$GN-XI`wo>zRz(8_mos>=NVwUu^ z)?H8!os&lvtAE{7q1n$c7&UXQmP6E1@MnAAC4nF$h3mC=pRpl)h}TC25f@f=#)%gV z9P6zrz_hF1CME^4@xzF4t$5?LETOSWw=6Y^(B3!y<8a&nBtUlAq+b+x9Q zK0mnI#MU5xX;%^R_8}Ym;1wHSS3(u&-WKI~+|BYZN=x$nSEPe(PW1k$-b6f!+`uxH z4M}Yn34+CZuyzJ!{Kse!Kg_59m-})br4vyBP}SlOpKc3}DlqFx4hH85i2M8wj7mgx zKwRIy=r!0YdSk65m$h*s$~rn+d_x5vF#xk|!>Xvt(1b($-3GIf@@fxjKHhO<(-cUN zOz6X?A==^{r(+4WYHvu0&GJPz^$}4vem`OoIQ&{q7~+y~W*D5@{-@c7C96rD8^($Y zSidy~gNgs5l)fv>YI2z@1A!cWN9$U)hdgB8uKIP_uB7B1@7XY+BwgkG4U`!HO9k{{dgsX$fgF7@1UjScLP0byixegbA$XfEDbDOUz>(W@ zC(R0dZe~zUizTIwr%jZDdRIjyexoSh6s{}}IsN#aAmHl!K2m~cxm@R-JPKc z=;H`OK((%l*qHk9puDMp_-b7@1Uz=DH22eK%3=L8#x?xKLxd!a-zy=L+9>|B(Gb~@~i zyLo?7mKTO$qx`+#1BGu_#E+%a1*?zh71}@}Fy?z7bIlXjf4CO_q-VA-hiY@}gZZ*L zNN)W%Bz1r}Y^Wf}l2v-~#_zu(S+H%YL8Ki=?NqlJzXG%lwq+cR_zUTK;sM6;=0|Vd zb+--Tmwml(=NBA?oM@ta2HDfYcb<&Ev}>8LS&zM&t5t!B3H`qjvtpYPuT;nE@bZKDtRsJuPgsNO2p^UmnG(#bAw1~f|Dl7p4uJUSP{^Wx z6jek^DZ5^akzaXWH(iqD=>##=-l&P~R#P<%T{q!zCck(Mi=w zemRFKw@dMs-K078x|J;{FJ2G?4azRcE_0lKQ^tAZ=mGUC*S;aF&(!~fGR z6Lt{v*u_Av&ZQhYKZS*M?*RzHI9hjv$nwvWH{^K$@N1E6_356XEuUjN0+ZxQj|C-= z{)Md6jN#a_ABJkv`)5a4fonuF!bMxdZ;?2Z#Ru@|M(XJoc0U#){7OsmHPc7tP@!93 zB*=LFu*F6Yq}HLg4xhSIp)zPWB5n|X=k>4t{ClM6ZgnKfwZCa8NGTMJ0>*=&OJr2p zN36&ONVJm-aM@6f2~t)NLl$(wyDHI!HS(%Zt++kdVVIMUfss{}-vNrC6V9<{&QLI$KyeG6k-xPB` z>g7gP+vIx&&5()_V%85cB6c(qbd9xJZ9jzpPNKHJvOp>1$L4UMcP)_jTG%j}c*G5| zD+7y{=d%7%H3`+Hq=-@GP&)|PPeFCemxF3|n`+OFd87qO+-fVyRnMXdx)iTNq0DboqJ+F>zt`|4=%b0KVm;T9tN~3en35(3wxAgfr4V`r)5Wd}loe3eDD6DyqD3)aS%LuT zWQiELgZb>iz>xi01kSMPNe0K{H$bf(+6F`dGM^qQwv+UoRJZ2+Bb8SC6prkH4%LM= zijaIC)4bloQt*x+##B?szl4C+8Imy3ZOW5un{nl2s6(UUep{_# zhCQ53=(nnwMycZHh5eagZc-XxWFmN~$=*fDO}s|7WBlGhd+Wzrg#ZI!HpW{t~CvHK)@!P z>+5|mJ)RmQwi8wY>3J;T_`ol{auT2N|jRP+(y!Y{$FSybZZfL%JMbd zGyRF@V;RxWV)`vdghqE|DL`a=$dt9|BP-v>8?t<{pX2WzWHb!J0!Zv>TvD`u+pT z>jxY266H*WQ@_-s$Sq<_IYd1pelZBnlLf=>8_1CFs8p!hUkVBNHq&56NTkf@vNP7wn zKI9+k6T%gCr!azf1jppcOFO7Vc0U)7f{>-g4vBg-1B7r(brND84i{wiP0xBJM{Nc! zu!og#AWf@`>vBK*yTDqvnC&DJz1e~xH!!buoCKO$AOiH_U2R5rQSURRWNhN(>}($X zmX+oUMJL(22ISD>5u0TpWn)GXnUj0UW&DFKa~haEf|to(6y1sS{3j+K_@x}OH} z$30SL#QBJPC})s^oHqqM@yathOcl%KGf2gZk(u8VQ^E>vLJ&DMxUQ~XLM=HSC{My9 zxdiyk){g`n3Oa1P*q5kGgdL4#*uG}QKlE$y9@+}lWLumGx)hk8vk5K~9AGI}2~`vn z00QzOrhns)2A^d3FqRo`MSoDcA6s!cxCU@UmddKVTx8qWX}`hOT|5SfeHpz9-$_HF z20WSd$E9(ji7>G}@vI91Rxx0>0>le693h~6{sVkz6(Z`yCDJhP+VxDFzi-EzGho|9 zW+`)W0U>>;H9Jf^;$9AJ5*bHG2wz%Y1};cOg=m&SZ~K+cF~RM!{RfnA+23I|P)&U#=5H+U(EY(>1=zW}#eqs@(#7SJW^2=&RO%V%c;3T~g>*!dLKr z8DE#ix4G&fYSWgcpAySMFRNQ2WAif^5xscY9RCAB zC#~F7enu!-w5!!r4Ni4EQl6}{d0|(zI$}+Ie)iS9IKMYRRxflNoS6G&$q>FuHJP0W zzm}7hzS~?q`-YMwAt_Sf1cpBorMAPl@-ANo8(rH-U~QAjwAK+kfcd7-ijV0aV|%}@ zPx1hEPk0w&ec`QRC?rpoE|!Mf(NkdCt5^!MPQ~Lq{)-E1-Tvqe29rM&tmV$KP5*6Y zyv9F}A0jOd64QCKgH(V*ce+@$w~-{?wR%2AJl3W!+=fG{rp6()#8Y9Srt}J zroZsN;Tl|rLtY^;*`7jFCU(^A*84&iGHJAaU3rwbe(cZG7^~?nwH{v=fLlxV#glNh zh-6&Bvryc~qV3!vNAZlRVwzZPd}jM=v3c}}2VTgqu0Z;YdCv^P#FWTmxZ5-6B?^7* z;d2EhuPz-Vaw_jn5+(_Sik<1zXQ+E~O-8@$8b7X7Ib?t_bg#!c0)+eQGt7@GXFNGv zZ18h)jbW$&1?|1!mHnix&1=6FNTXHbedzO)jMddhhf{!JY z`g#h=Bg2)W%A1oClAo4tXyBNrQ&JX+%2oM3lUz#S;$#h(H*4k%K?W0rRW0&xy(Wf% z9qRuV%HthIqPg7_N=xHA82ye^CytL_LXaf~h7~KI zb-PkALSY^5#rH1#x3l1mlC`W(C)gb}^+$h;A$tA~dt+~3{;f?DD9wea#8B$no-*k~ zvl9K{&e(^d9l8k@a5{{9M2`Tja<9I4?WAteltTkFR{3USu+qs;01&p}oGX#;1@uOP zHoouvzCU^%&iFMr#38vS7rb?gMYA=Chn&_-xd+do`l}Qk?0Sa0DS!XKO$yQs*=;LS zC7r>%`|CW=oACoA@Rn^>wlvVem0&^t+F9yAdo|OrhnG;x$f6u3ax{0|@ZW4dqgks7 zM;zfoaFr`vZsQnmacKWg;&8Jo21+;F;q7%6xmCqx^>}`x4%zkzYZM_+9o83su$-Tp zP~*WeHIW>7gzOz8!+qg2j z_)mvbws$bb)Rp;v;dfl`py2MRUYRR8)4xe_ZM=w=tO`I+sj|b?>L&TdfY1b(Xyf?^ z@Nh#okHY8Z13GH-)dN*WCo%abDgH%H$h<52IEZ}}aaGlzg0i+-I=^pob-JXbv1hEj zg$?an272k_9yE+S-Yd3ZK1zB9>a+yC?xwg)07-{Y3=%;=yb3GZ--2ZpjuT>_VMDv^>f}mNtsC0) z8I5qEeLoD|O7|~1^xzT(2c%AT01Z&_v#0Q5?$mCQU8{+0tMPEZr6nd4I>MEDP zo3nlcTyY;K+G7ii+rxP8g65}X5)TBQ2|QeJ<(>mO^Xzz7v`Iy>-X<%_K@{hoNu-?{6_N!)%*DcSoD53d5=i zHcv7YQT&%zcKh3f` zOnXL_^+#r)GAZR(8!A2#=WE3C;kWSj83^#2Zb#5b>bR2ZBzIA~CMW941%F(VUB4#9 zLXbR$t7bmQ4P!bIS$DLj@7GHba}$_}H9iJ2?4#1x$B5&@Ql)4nEFsr2gUFy{9jX5l z1tOZ=*bk<~;#C}$-Vjl}Q?^|!O+cV?JPVSg&jE^5O6iW40k#GNfDeyiI?^wD6`SV0 z(U~J~)r*XB8s~+x#GhPIxYsOceP%eKKTBO~L5Dz4rt|lR1e}9JXVg$VEqkWN{2s)^ zA;NdN-6mdq2R$m2$ZzR;{-y40U?^^Cq=Lh;BII%=LV<@Qt9ZKOF$4%p!ZW?X+fK-+ z(|~o3&VfwuhKmzoPc+2}j-r1Mt`!m}=-q|gYV%#-R-IAa*oYkN9W4R1F3EL~?kLCk zRc#u(d9!S5hc>sVTwK_Q8cm+1BX;wS0;=4mWQkitH(rAIKOwC@^*&1r`RNgfR((F4 zAHN1OVT(<3{A+`+vbe{l8$4gNIT259EAe7kOwqwP`^P5Q+>5E&e%fy2wPBOV zX)32$#C8}<_D^EHj;|H;n20ElR%Rn-e?NN&8`D~rFcA&Q8ztA zrjGzvBf*Rq)Bjh7K^#sAdxw}FCYRHs?D6;oA~%#!jsy<)y}N(`TEjriVH^(6K+ZFr zN!mh=;z02Yvmc!(kSo;^A!8Q|IV$USPSW23-RjAM`G{l(lNenv7mQ^s zSK%%eZqgr7DDDM;fj^d zP@R1rWtg$!-Yr1--U~lJHdy|FJD!*|Y?N#a=O^4QHqjcjuMDBDvH;4BQhl1;_MH1F zqym3|ZoE?==Y8dI28T>u%y%fKvt5Xh!t#6{SOO!8o6A0)OIqHF>Fo@Ksrj?b^J81iYx* zxlq|;dgms27>n!sa$YaEFAo}>z76m||7FhJ@WwaYiChgz`|BB4S)$*HOX&>RZ$!CcFyE*SVWpdM`e0ZWd$#{whVDQQ^oK9X7I?{@ zz#|5E@jpXB{|NF7E8JjPnT;$YK|anYK_fch1HPLMsa^OGijCCMe0=FB$KpM`wzfE> z!|_v1y#7#&U&@Df4C%gu{~+J`mHs4Itxq5u7Z;Y5pr?GR7}ZZFS>KYTb#Cw;G~X!S ziYvA6drkV+NTDu_RV6Axp!T4q21S8r*$zU&d=PwGSctNogOkP&tHg1DMG zz#>&WS2vcbl3YkjOQa_Te5HovyBcln-8-AS!zzynz+l;8?+%vefOmGU+y1@>zFna}oZt=3Q zK18B!^j@#*V?@4H{LmX@LMA8A5%=JaEi1#{xcKod^^l`5wHSTQ@3F*|Q{j|ndnsAp zBbG^jBDR=_98S1&udEDV&iVGpW9I4GBhon_@(~gG1`d6z#H}_LmA<$iaL_)=@1Jrroi=|ENLWNhO~UP)-1luf z-vtxj?b1kX8gyv-l9p({xmF;C=DshZ{_;ke;n<`Ec3gY$?O%7mdez*&*)(wcbTN*yp_EkN?82)9&K& zD*pQK_&rPqZQ)40x&;~-ue(K2JSorgmja-zUQt5hOfnIBU(6E&+V|4!*qdyua5X)> zU0w%g@>dObfmB&i%8t=ncb=eG3$(KJGatMoIUM8eAgqw!Wjkj_4Kna>`=EX?kmsit zTIMX^H_X8qO+w)o`4=vJb6zwM^hkAH^qYZePA)F+U81E6&DG{9pdJ^Wz@hqIkt;zD z$0sPS;K3rPix=4?_1O@Q3bNk&19tjw+I`kgjw5N|IsQ&xNLgvOxwU=JW&V9D)K2L+ zC>}MXFJT|PsaG9zM-~vXUcXv?{~Cqokb#RIWT|8}Jn?&y)K&o%ek*Dlp6{;EsZ2qv zhLJz}hbNPOAsE^9Z%zD4$BG1nz1w{rbU#!A%2W4@aF2>(cdfTl8hnEG1!JL6Pha7f zK%MHI23RxwO6YEm&h3Q22uOka4=oV$9=CC|tJ>q30p*#H9$CQ6NHo-OA}Kw67zrwH z!z7?Kk))$Svej#^Oq#}K1a*K}o+~&}LczgB9%xCYhgm$} z3V-9qp_8hY^F|XF0FA zNcEg`;=y;YV>erASM0T#XKbrM{UujZLRCd2WglHO(x3_7P}~Z7mftr&y9v z(&4s%XS&s;0@~%iVD8uC!8L>ME{ds-|-uk1) z{ivwa53Y}&kp}?h-XZo*S!uHAZ9{+I$A=NX?gb(G>A~$!jMQGjK{XBM*rL#o>!Y3; zM7HOj>Ae@3r4da$s1%mAtel(>eG$ntdgB9@+T4uoexAQpPZ<#h%NBy0e3R7)cP@*a7+eOF z7gQsAKXWOv2y3SQ9wJjyH#<`chmX^EAMI19qD2ha%wbV_NS`^v`;^VELTl9!a(tk9 z;~OFfraincGT{b>yu(7m*B${ucnK4oxdB^-{^i#**w}F+dI?RI)yq*z@jmJzx5y6{ zn>)B`bM9^C5K~lm4;$M5ynj=&Yg+@`y@{Z>Ai%9nFr-a*#*gfuP`Q}L3((8^KBQ31 z`fXqpK6!9Mq3xwNwaFI>ty1BAWo}HLT13&gQDYXrM-32mmbnl#;(N>N=9+{pIZtIq zGPg@P;u%lVfiT2r;`ex-s^KDanu-%&nFR0|awa&RwT2Cp8!<#|d^NP>_{N5HbPnd{D7F9~rz zyO=xNL9R%`O47Q2*b;Jl=@h0O&zwsD2)#<7;naoH=dO01SUHtL^yQ~VBK`*pX#X7mTMrN zEw~)lPhgLogu;*iGqUhF23~df?itz=_%#CIisubU&>3Z!1%BmoAy`)v2X|%Bvu$9Qo4)&>}W4+ zqXP6+N&vS<0>5w*;Eko)CW)OC>v{7jh`XsR(fbiN>RURToe7>>fPK^-8j6aMLnH0# zGpaD8AB8w%Zp~xI?A1pO#c%iRC9+hIFIP5rqNyhu8(JI)W4ix<4m|!u`Ns5*6y7k5 z8yXxl*lUpA%cJLSDegZ4)^}9e*IR3lJ9|`h>^&$kt4V=PKpOZ5j!*=}pS+k9dX|(! zQ^ilegz1UASaISW2+bWvYdsTDCj~R_WTrZTU#G`E`40UwoavEpg-83wL>*EM!&P;m zfr%@u11~*0sowB*;|AWWETuXrp&r^D(VGLEEVfLlOJ@B9XI6t$N8H7r zD#tJ?&%&}1Kn}GJlhYw(vz*(w4^|p9ho?48uyK0cYx{+Ci))clKYSL|o)VFT)lk zU%Ul!4&(PFf+{FHHjhVU#mC&xm%($}kK2@%qQt%O=v=*TT8fY@AMv~=HqxFMyeCUQ z^1anzqnAN&86pX1v@!=;9m&@sY`Kqe#D`ZC(5Gt>%sU|nM$=KPpJ=wNxO}5RG_4K=+SNpooAF%i5yVg1# zUL9TlNjMzbn+Js{#D}BB9}{asJ7!mFE3oxUJr|0m*oVspwY@!Wim8bB^|KLERDH=% zV%37>FZ+9@C`)?ehIzgyK82FNGi>0+K{}=!N@e-Z=4q7Mq5as6yoKOFF-`#ZpU48&hLmy8sU2heQqp=?nkJZi}Z$lLi|A6(i z_V)JI5jmy5#cSCS>ub%P1RKri_uCUL!1F1|$Ga^6_i;^P{&V2tz3|(+%R2+}E1o-+ z$=~5Oi%XY@Z1^tk+a`kd@uw=dLwU8=w_BI&u8)Vy&X0$w&A{mTsY&4^+rW+Ky1xMM z)`6x<^zQ6pkAt-b zgqeQfWk3RjEpyTHC?f++FAU~^h5;yXrz{(OSxH}Mjpf>3EACTv1qZ*h8Qi8|PZlnh zmlCH@^pYv0v^5dd{rKjll_B(d0+A5Jz{h#ut1_s{7Kf+DwiX<1TT%^U(`0;(JY)reiS;n0vQUC92xQ0c90h~`KVdLQ zDGp5tr3;Gsz5?Rk!kB@u7)njS=&sJ0CekAiC>yfp*E#>d?ah8&Am{k-EKUCgp*d5v z|9diG+DgHxFG;Mfm^LnK@!q)( z{_OV>-7m`p83s4aL5G68>;Z5mN~ak$`i%I2Z8E}@AJ4A!Ll`MafVg&B}Dl9Z0dDV!d%@8n}MJw}GX`N!=qEI;9H!6<>v| z2F8Sr8jU6sEQ>!G!&;z*riv6uprSd(hIC9A1Y+}=t?v4{!j7w0#Z3>WpSsR?h0O&w zV|v1FrZUSxL_ zKfNrVBqfNatx~V=Y0Uh*Dosa-aU)h`mXGzk^G~|x?NZ>!g#(o}kw1ve5}InR69oDR zU~P;pUO9zRV%K>Cw2ohNqDt!6Ns3n*(4;n^DaqG*``HJ$)`Lz|;(H ztzCPxTT!C;Uo@GlZq|lQhqK}cglfTZeP#B1*_q3g;Yx(XZc~5L>ekCNZ#rsk9jif@Gj45)3y7-BN??qhh z0GJoP>i%})LU?y!%_>J2J=AvA#a;=y819o>7&On-K?I6ARt)vN%yBUEjSRCg2vA_{ z!Bf7TOLjDW-I*P;>1kXs9(Mg&M z5b$U~TDPW4PI}_pNU~M$fAm&iLNPxYz>t68={|Hn^n8HEm*u4y^tkrs zK16SDv9^G1dp)3yqVjR$qVWQ5(j|O<0F!mzBw8st?#5)6!9H|?GX;>}i;xA|zk`1F z`Fx>S>a+JpZI5Yt;i0^9vsrv&#ugiVzsDm!(?=53!q*!=XB5u*D_@r`FCglWQ!fVLO;{=PH6P3~()c zCyMxWszTX;h{~(zvBMRyQ4}1PsEET{jNk_W@kUvWB2!o}@O-Po$$Ma?rA)W;pntLQ2kgA zpxo{0@WE~zFUaqusvmfH%)Qh_x)K8upaO=o-FZPeZkQ|Elrx zKwOM@vgy%I_h5Koa*^uG?Hy#ZTo-CK^gO$f8GR2j;-g`^Lty&TJjc!kGGD;)E;CMI9DwfQNyKeBfy z!x}ckv;5f4nUDX_n~%R-#pWJ?`?e(6&MjDrXe(-!2t>nsg1n+*m16HCw*?DIokZ^zllZCWd4VqiN*3*z{^oM&QQC|F?eJ19lx?- z`F=QA*n}f9@x39zZt&EtQ-)A?G80^NvQ0iPh4$LY%<^Z)0@Y94cjBHzZ+NbY$6vq% z2FL1L1->jvSJM1aKnT-5*rOgiJ3)|&uc!LeoNla*rx0r9lU1x&zV>C40^HxcwJ-_? z?kuJ>e0^`82s4_4virTY?`aIP1**<(TRp2n(C_V zPR#)x3`U4KE#P!7ql81-xS`LWr% zT$4MQ*t6C>@l1E)PVb63GNER*Ec>5h)k~(1ubk7oo8S-1$4-ilp$w#L^|d7hnxvEB z6*E)Pi|!Imv>8xP^S-TaAho;1?-!@;?+qlWi2c#f9ZC;uY^e{PMttalhB7-Vn~(7( zhL1|(14z+Cw2#3LuoZT>`{n1%Yvv7|$R29pq%SPlGAU7B`d;r*#K~A``%lv1aLiT^ z1F?VEn7xsRmis?J4%Q-Mpncpp_IRrX))eEi6QZ>eB{8hnHX@x%xUSp;NJt#V8m9eV53jf z(V~2*Omj9G&QNc#5c`n5Fsz#5mWmLkwee{8-~rWr*iJonxa#E~_&n9R5innePy-lK z^Os`>L3}a;m_TT|^x@)Y_o9jL0}0YWEOSU?6L`}&V1YBt|7s)yQo^;J84GWakR%rH zg`(g_-eb>s=tGBM-K6(*?U_;mZx2;rDY%RePl^24QlH)+6D3J6bn=56|8}Z6!Z_ zDU7qdd@^2RZ!uname@_D!P!`b=~5}sWdKw&Q`iOtdhOfoLvo^6#((8#bN*!_U zcn<1B0qAlL0Y6eTRc#7i3Ks%p1;6{194_qbWz46iXQ7T&D|SxKbKO^LI4lFbd#A`h z95+Mx+tK(LBIN{ZKhj>`t5J$l>9BmW%Ff^!h?2%55HU`KX|G%Cl*Kumsmm6bp9+r` z*M@u9xf)mSO}Jsdy}PYgvsBvqla2keb?1Kv3-xSxP5a(6TnlEJ+ZLKQC4ver`$E2H z&8Vx6OWyN6*ILY(*`FBu1(HJ`+6QmlgZ8HXWlVZ1L2 zmi{Sf?}r4bsY(eP_UK1JMV7VnSVPA?xJsM^Y`zfBekLonb;~&-R63FN5$WvP(!o# zQ*Qh`6jTcWao-^OR43PQ8G)BiMzUq=-OzmF$H`w75@qlM#Ru1j5H z7i{K1dC44%b_Z}N1g?Ail?cpRBsRw^bXHnJVGa%{&mQx{i64s55`pYyzIc{*%#O5I z)}$@|!2JmEX+5*ZMfrKa3i}Mr_k@^hWolNBCY8OWFlcj6XyR>ucKdbY$FoX>W8-gL zniX0McMW^J?5n+Vnj9c#PAD|fL#>M90sS?)fwp{{ZM)7=J}G8d#J5MFFO}JF7fQEG z`_=qG*uweEN@I2%RE`z=SNo>p3&dqi0%Kp_QYK7}Tc5`gSYV*;nE*p6laGGQz#BjE zOD93`O5oGJI3L*f+{*1rIER-~X)js?-;VlJAlBDdeun6dI1u3Hd$H#5TcKl_e9P2- z<$|tE{p7o-?#5rLPF(5Opd!*PNRtx?1nwszcf{AZ^*??F+MGCOR%Z7Z`3@B*wC(;m zK`$jT2tTf=_3^DRE+pIEbxEpX) zs}%nrx93Fm#|8rz4K=AEv^sGO;(42>Lf;pfH@SLh~|evPVkg(=hR0yB3dcpMj&vu+!7nAET3!;PCaIkqdH!A~G*L%i6a^`opoI}2du#H^Y}~!` z09s?42RGXw9=}+)gKThd3OYQ6bG}`T>=Q>l6(DRJs496|%n;a;wrLn}4wP?_ zj1od{UEtCjv%-yA@54lVo02!BO(&0kb!?C1=lF_EDkG>UdnXDTUH%itfrTgpD%)Jl zxlQXXkENFl|H1A#-RLob6|PdXRj%{9J0Sl;>16n`c(`EFeiUX%9&LcYb<;K5xgitTMGHGq|n zMQ6!FT%>PYIhJ*%jRBULKt#TY3AydyZ$Hrap3+vyt+ z&e0LsBQ#+$~blUm2!jc3hFFl#xBjs z=I8K1MiNYL=jUCvUVi^IP7f-x2?qg8Af7;BK$$<=-9Q@g75AF};U4#1V-dvda2UIN z@)-2x&A=a2(PA%NWSc%sfMKx#HudCmvXZx_X^0G|_e1z@*q4HVj*B$&o$Zv#_BjZI z$3fE~Y$trM0yY8a-zyp7?iy-~t2}r%1iJ^}d9F=g8wb3c8w5pE+#KII#SzwW)jRd$7 zZO{l$WOf{wxFW|!wKidP^J0d|xtln(zA9fH-*svrAn~l~l(;BypFcC2ZT-tFQlHYX z2a7#ixqxTBs{2R@3OWbRDmV7c|O zl@n~3Q}|xNTr>Ftoc$94BuuDSA(aH9*)Eg1_Bi+F=R~P~8RLgPiU|EXTc{vFrKl6( z&ev)x(|r~l%%t76V@@tUc(9NjChB^>j(S!XNeOj|?+tu<35|xd+(h_GctmA}lDsrL z?iI<2dZX-(Pr7U7YEVQHZmYtpe1;ER;qZrkwNPh&q5&~rE`m*+UlKWjLucyyH7CN`CeSf@9=Ab0 z`fO+i+)HKaj8hNI@lp`fH%)@FY7%{3U^P*r3$Nd8 zM4UCRNB$%9qx*Gds+iM3m@nNa_H^7(jv+@s>zl4Z%66gzCk^vF*qmX87FRmVXH~(a z3YGzb-65tgyrulwX)@>S6^@F~v<4U1j{`vrtWDr96{?4cVY5SbeKq}DteWI9+7Ju< z4l;YcMiMa?T6c$Z%vpe3MC5>6P8?9gmnU4rujmFjR*;?KrzVQDc{2g)52ay$dUDT1 z?K_A(aZ-^WIu57(BI+T*lTNwBMNToRuV( zDq<>I(hD5QO9qc5ocbdpQNSU;vD=y~^|Bcx>y{i6Vl0_5Yvr!j)lk8;Q#ElR(0+Rk zK`J)q#2V?$ z<757A31Z1)WFk=bd>d%1Y&UpwRUN_4)f zU3%_uoP2%P|B;=9dp3oFL*uSJ)Y8g2UO|ciotXF99Wl}ZMg~g#WaW}R-e5F)7CXe# z9IBNu0e+*tGQ8MQ>EAqy#>WJ&4%w4tTfJfKR5}`g^Ndd#qnASXdNBH+cD?n!C!pJ;t(CN`JPjifP>a z2VBYG0W?%&csFzzK-giA0`DPeKVUI=%g?0^+y=lRcaq7(I{26Dn#M!=$ZcK&kJD;;wwH za5T6UkWKmX&rv}8U(Y5T?|n2XLQ|t3j25Pla5(HrLOi!28#cxNtxqx^97@tKicD|; zTSgN;i=C(nG;1axQ22a4ox+v+9{Fz8VB!&)ci6a!vO^she5Pia6=M}yzM_3P>piQT zHxtqFYTNsL^HXdy)|Ow7s{#gr6vTM(mT z)^9qCsMYk;U3inDl;_K~y>&;0Lv&YJX&87YzK=^L`5s{1Yu+UD??XCYG!C?;k2gE@ z*=R0J+IEBhjTFdVFvIyj7Q{;Aa-&!}O|nXrT!*u-W4gA;fau^?Gr_&Cf{53_JwjS- zJrU11@AOxcTYzB1tTP=%FAVQzT-%f2*(Z#^t=5k*NROA_aZ$M3lBQvU4Af@JWfGgOY;bZNdECEeX#({z&a5L5&4@zZK#=j`Qx=*EIJ52 z&8?V@n0V}5QfCNho^S1rb_A3<#UO&zY_{G0`V28gB>B2GrU4yvv^#Zmc@DQ95M(^y zp~f-|Fsd_6SUHc?*$QT&)eyO*L0DOD2Lg^4T^dYjmw>Q zDN6yEP|X6~qH|-sqX4b~15k30Vi@#HQZPcGZtGfHa#wW_%m&Ho#%1J7Uqa#xtFv>s zFh;10vJkps{a*R~_w)4G72bJ%!a@EX>C`hLLc1$Ju%T!ncyk#i=P;>LEW~sgw4nDN*%b$PJ5(!-2;|(C1I==z{~q)&3ngRqcRj zQX3qY+v79_o(QSTbv;jd`)Z!n^0EdkmO6X{#a($5Ap-07UTn1+T}TYZl)y;p4WzA% zw%V``SkZ2IZBdOaZ%>W>Fc+MV zB3>BgAIC3H5&bV_&%u|8jKgaY(sRJmx!!Zewnv8P%e!t$UZdO(;o$I(WoNbTUDeHa;>5Mh=%31VXV?vzc zuWKwWTt1q|-Ti@O*COE=Fb%4q`cNIvwkvRy`ngvWSCy!Y>Qru1Ny^wN|HTL(E3ub zLUUlF1mvQ*E|uDl<&C*oW-O4nchGyN%gdI#)B6%6IYr{3M~1Ge(3ok%s$gzCy>T+_ zI$$K7S?W0Z9`#Lb1A;FdHp#C#yF!<>E>Lf;D&XLuy*r3~GGC1(`Vo=Pz7Y#cOzaZ6 z&FfhlC#np$cbVA`N}Vy}Ma|b*R-*JZNdgP~`RPZlye8e`@x`b^wGI%_XZt(EtielB zXyOGKu!3#jG=HDU#bP=8-9vU@#F3`^p)n)e>G%Eghj%V>@mz$E35fcxvM8AX7dnX1 z9Pbi-xSt5xz~&y&sX~N30|J6;Li%Oi(XTS3Vi{BsgOA9k#txglA6c+K?z=k}#u?$U zlWce+bhYs}E38y}))jaVCx8zUSeSKOh32$mc9#zP*1k2x^&B1}3n9M!!_L;Hyud>{ zXMjq^_^IYrPwn5Xubp5}wKtts%Fy$=}P;h=?ED8n{JYD@h^H z_;L2EYcaRQ*_4iCr(rHyPkklyzGw}9eymzRqGU-5xsvqLHj_r>5F|Kt?s~%=f0Wr& zVuj`v zZmX^>BUW(Ef6RMWNP4GPBw4%0NH1hlnI=XI$*ivz{+Qg%zUQU;+GlX1E}aBv$DnFYp4jp3F0TI zWFeErRJnQ*gXpCdDnx8;@)`kGlwnOEc7ekfZ}>hs0_q{arHk9VTxfjBgaucW31 zu+Z)~AgtBQUl{Sw%<^FKARsqXJ1N?@d$C353(Er>WxLtfabTNIZz3c-ZSQ4YWRM8L z?~J=slDP@R7+FEQOVZE{3>XejsM2+NaA?o}0X`1x;A(NjWDMM9QzJX<{ZxA%Ea%_? zC1KHzfNqq=O-5ev0NX#3DSHTTuUbGJ4qR%nXn{g!_k->p_2rtI8cKlb@7PPy$HZ^# ze}<^&f;?*IA|UFoCS67H!8b4HuEU&YETNqcd!&$R%%4zN^gXg$>uk(#S_L(v2(;^- zG;G3cf0(F~iUns&h)unO+lm<11^4F;S<6a}Cz0TG(479=h}ffsYt~I$y>9|YA7uvb z!&EKtvO*JnxBOH?wNM&W50H30QZ~3eF_@qtT5$1wkvwG-%s?2K5k3=F!g_(N!Qn|w z`Yv^hFNI!P)NpOK{(YG%*JR?etYfpT# zny~g=SD0G)BVW=HEf~YC2{o8uH&BBb`T$y~Kchw++*lB^&Ex>Iu0HD;t$wza8At!n zdBo|iDUsTSTc=QHp;&W#lV2d1=vH`{TnM}TvuQTX{U3IHnYT1rkAw(&lV#_A*TEcp zFeuMx#?shY({v9}p4qNq={oSMVX`Y7s+%NYjmR{O>!jPizF#`l6$u;{W|A1_(($sP z$MYkiGBAP$1LFYx+n;^~_?eKK2&YZB{L%J(O<9f(`LKga;+ETV_VS|$HvNtN(^USf z%gBGE*J61)x3Op)BU*$vCi@@cFo%Afc?NztjsMXOi57od9!`cYmne90<=jdd``p9k z^ZuFI^pSbh&K4>017NAMEe29$aQ;bjpZW&kz<^&2=q8MUt)qiDD*u3lIPhfGrS_%+ zDBobA4j=G`tPV0c+D7 zdrIL44wdFc1hIiF3Gl(ff#F52a>HQ`-ZMqsG)>fup|NB**=Z$89$h7=B-clMwTa2J zjEr!T?54q@>@c*Fbp<3XSwV)sQVK0$_k4%4RK&5<4uiJ&GZ;Z!@vR5KOmNAe$oIdN z=fsKH$L&)%6xSx=nVCM1TqgEkfwEtJ@^B^sq%sXQ@%wEwYy|Pj$LSan23OjzRu96~ zuAh{hkiLJ0B(e?G&xJWd*QTO`XSLtWpN<8e?}$%kUx&!Rr)_c2^gYK9qh3Q6*J11o-3Szvv z?y$s;wtp=w;}9<@S(lmd;#qV_;@BbIi8Z1`YnuAm%KoUWTJVc;C6$vt!@s?C5p5O2 z7=Y__$YK$M*ll2{wktDv2!ci0(muC0brG8i^JzQ}{81GNQ=IQgZZpRJzzC2iQuD^C zFrZL|G3~`32qZNXE1M_lj!fVQanV0%?S2X9?32QXQ6tjUMvp4I7;OT>|2F0xnIm2~ zcNH^x&ovm4z%p=o%KP?=an@j`+s`Vc$nElto@w9h{ zUVbdT(Rx#?{T~FVVm|5R{n`NQn3#>FSe+&(bAn?-7jIcm!#Ol@;W`kx1L)R1HEqzEGpwCs|V}Y zEjGWKu^5`|^VTZl8{2r}+FKl%&MCZxfP#dCn^C{2&dkq8{hC@U2nMD6!Ss9g#uD`)8Q4SRgV0geAG-yhRXwL=U4~JAO z^eV%_Hm7d3R5RNnd;4|fr^q(24*H`3|HM+i$=bd)npN=n7)(*^gUE?|nfjpZnUV*Y z-Qu;e_WyU6BjEBI_^R;;a zZ>S10*qZQeq9&)vWF%ewCUR%vSNI+mh|AH6PyxE>Lsq2b5Tldjh6olH>4aJfC)^WL zf6q%Yxm3|LH-A|Iw|%;nK3&%mwxXxC;<@w-|8{E}*91k(Fw%bSX`ZN~xU?;oL3n z?RtC0?N-Nt&(=)i{Occ|tuuy$bOOqISWKjDh%sp1GRZ7=jU6oewaJoZHCUU3P{-2wLEH23SBU5Y3NguA6t zIcRlu9m(=CHbd0xXg32UNfI7D`@4e-1p|i5FTC$AZeVOr%+wT2{bWzv#7ebGb_Xia znDgm8=Ix=IH-GxQaue9_&7)xRcK*RhuIWXBk?|lW@+Lwfr-hq4y0VG5v;IJoLPYeP z5|b4L>b#s2Ik21;C-|TQ(u~a{p)qXAg`l9uo4PD^CsDn}q5_#|1gyvFT#H>pyOZ7N zHmkb^OjmNYxsUH1j#K!g$f@-!0!l{=w}K?(c-?3+H)bFlzvXSiT9-`T>uH8t(yLY? zKV0DMgq;QJZ%}PKoasF;e@1)p#3=P0$K-ARNOa7JBkke8VPIhYIShb5>Nz`*)jZ)G zR>=+g&`INeMgtE-$juHywc^8IGYaM;R>;;m8!O;h#=NWhrsk}Z9FSx5NqYK2ApE-M zqH*O11ChVtSR~7PLK6LX=PzG08jvBp(Bja$_$$(_z^8ePZnzL$$sp4zJkA6183tVP zoD~s>6vujZl^u&wXBjyzaR@hRq8oPZIhCokbcD~vd2Fu^d-#)|dxrlIbaxmEW7$cs z+N9x6TG2RXniU;4M!8CKk)IxOF)LSh+{i6iT3`%yP^iTvoI387CLn09Uzim13P4eFlwZU)K2uFq1838c43Sg)9B#>7l3?I}Z4>_e9b|t=7b?lnyug2Lll|i>tFydR#z(@-)f<3c7lLd_X0~>O zyi@MNR~NI9fOf?_QJF-d3^K20&K?kl+5}^sfFaOn3m`MdGCd47 zK&B)idW3ly(h+69-3KhAPG4Nj;6jpi?Qv`9IJt#(URgqne5}eI*}NVV-X#0wCrmqi zm3A#~M4v+3*P#K-4zP`n7TRyutoj&QSpH%T)B21!v^$|7mv(ko!K1Fu(S zeT;?cr&T7LO7n{lNlo5Zb&=gg`SVLw2{sKy+T$0X@x;o#Qq(sUy?`L?<%li-+mqCZ-h!zC< zy(I{rzuENw^>C_ar-6dn@MN`uC4JWh+|c3*ZH4btSLbDPmaqnUP3U6vpw+_Gg;~HwMB9@*tD18PSd%Rv{70k zIT)7h*{A0n&J{?SKkIOpYWNBL?v3QtuZ1K(#rkXDD!fbgc`zcJ{x)9y%*Oovd^^3Dy>P9I z7Yz9GaF&>SvMvHFvmx+VdZR^0vVtlY9LcS!pFV~9e;N4h@QbWvl%d!zk(?^D-<=E8 zP{Jj(Fq}uE>G!knWbTU}2W`zCP)8SBFlPF9>$2OOhlUyo`dEPA=nUkB%x)1}ykukL{0jLCpc@X(EJ?O3Bv!}!X`L(ci#Tk!Y zNG>VoBjg}wK-gi*vTF8{$D!Za<_}t_TqYS03x9O8m>jDohaU%MJbv=8I9^Zhqif;O zz-tJ6OgD?AQ~hX-qIl$3{G~G3SJ#Z>-@?;u2&lI&~&Fy;6f@iU5WOSdYXa8s*Zov?LcHL~@Q_p4My_ z5VLXq7J{4ZXsMu|W8M{l$5qVc8tT+!l;^$61* zPJDK4X*Xn)^UWiRL+ew{<(Zg4&Z8_ngI^}NfzuW^?qogSY`W|4?^cwcC@(=`AbPG3iU*evg3Bq7-ff*eiey2Pg@S=5$F46*=~}0j`I5!Ata)- zQ`h|>R$I4VzXeUTY620(*28W0D#XKe*h_E^ocIO}=5wX>wr`aSRk998&dvz(q$YoV z#O>V&@zp2(8%98uAbcUQvtdoC;&IUI{pCIkWPOSvpKnn~O~Ei3&j*=u@5^lco9llJ zy}fQ&B=O0O$>zk=;$6qVH7dYBI(NhZ-0mIiya;-Qek@1~j z;sJMyi+Qpq>MR-49N`}_2TOzCxzF~_%NwOt0UJ_eJv)yDh=LfayCHj5cB;RGZvT!ecsngNr{KL zw?|-hHtvALmLxvjpH-Xj$I2{1CF&CL@zWAaH9N`|^gYe(k`7sZX*v(KuWstakZg*_ zbUZWofp@w-ymVhAdZwl}zwPhqb@dzuHCYrC-1A755;JRoeLL z%R4OB@vBc@C0DSrO3z<4^smN0w*_c;YSNTBZPGh=M|5?PjgI91E=Vu=y)|EFZ;he- z1{*D33=Un!H9O%M`1(L!3VLC zp?d|V)y{J`9G~R(GRohw1l|mHoZBww9k`X|jK*TZ1+=Klxfm+CjAw4I&wrNWPbQ4R zN4ZnL=T|!AI|FsnQm;2_Ork|0L}0=;vGqnW+{|7Vs%NCR`5^-6ITj)%bxGRdY};U zt~JKvc$)BBVGiL5aY1nfFkMaZj0snTRH1$48T6rgswld+`8-5dcGxg4ki&{N(j~i@ zt&zjlbTO#JDe~lPvVMnL2q!No1TptX81itxsJb&M=_y%9Bzo&Q+=pKkCbTH?`fid$ z{;fJOp!!rJ)7TfwtT4U!EaB){^|LP&-F0}AL%GKPtPK4nVu~SvF=qji5W2+%MEv_b z_y8igGw@&)yzM@*e%Y}1VS_-S?C6|(&BSj8Lp_>X+pEP3d{-NbD3piPwykXCc0Jpf+5I%Lmqw_e(=G|II$qpkjYk z1C?g8v${jGAK|UOmtu1)J+&-TFs!IFzJYAs2K5K8yFdphcymVCeapx~&#n3AQ_IfD zu7hmj6i-Nw|8OsM1#MY^sE~_k;u_h@{_a||UG#V=&(ma2FG>Ed$F!K;l`P{L zviX5(%JT@RF%p2oNB6Jsenfy1TsiG)sDVX*(2jO5Opg$}ZjY6n^gpUhu30B_oP%e& z1>CekQvlH(F8FAkOEsT+T|uALBqC@!Psa2XVc?~ZoDI8!j$xY+*Ac18|5qo|qI$&L z>lFp*wHewT+hJsIrm%B?IdNW2_HlGcwLov&1?rKA@7AXv_44I9R+#3&trh2+cN)&P z@CReO-S8xA9Q0z9=Egz&oOJ%8`@=%GA4kRA014bE?Zt4yUd6cCX*QkN++T$m^RbsA z{vfKRjgI5*?U{{C88WKD*=wb^=l_AUjMpQ&$>LwuA>6x9uUwOG*y{M3*mQ9<+K>A$ z1v2c&JDAeDD}8r9`P5TCsYi)H%9|XIkE zYnG$xlJ`1sE>Rk>Rm<*Nqub4>4(^wu`6VZEO(1M11Cn&hc3%b^%r!kSne5+ikO zL6oQ08+njlCfmO0l!~7y+^D_0;qi3(RXgateAqT$r&D}9e8A>$c%6)?LWBJui;k3U diff --git a/src/Coverage/vtk_vtk-examples_xref.json b/src/Coverage/vtk_vtk-examples_xref.json index dc0ff3b9a24..3e8b9d3a4db 100644 --- a/src/Coverage/vtk_vtk-examples_xref.json +++ b/src/Coverage/vtk_vtk-examples_xref.json @@ -1 +1 @@ -{"vtkActor": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath", "ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData", "Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "ReadRectilinearGrid": "https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "ReadPolyData": "https://examples.vtk.org/site/CSharp/IO/ReadPolyData", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "ReadOBJ": "https://examples.vtk.org/site/CSharp/IO/ReadOBJ", "ReadSTL": "https://examples.vtk.org/site/CSharp/IO/ReadSTL", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "SimplePointsReader": "https://examples.vtk.org/site/CSharp/IO/SimplePointsReader", "ParticleReader": "https://examples.vtk.org/site/CSharp/IO/ParticleReader", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI", "ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D", "ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "ReadUnstructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid", "ReadImageData": "https://examples.vtk.org/site/CSharp/IO/ReadImageData", "ReadPLY": "https://examples.vtk.org/site/CSharp/IO/ReadPLY", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow", "PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid", "Cone": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cone", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Disk": "https://examples.vtk.org/site/CSharp/GeometricObjects/Disk", "Cube": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cube", "Cylinder": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "Sphere": "https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere", "ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Plane": "https://examples.vtk.org/site/CSharp/GeometricObjects/Plane", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "RegularPolygonSource": "https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Line": "https://examples.vtk.org/site/CSharp/GeometricObjects/Line", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface", "MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkActor": "https://www.vtk.org/doc/nightly/html/classvtkActor.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent", "JFrameRenderer": "https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "RenderView": "https://examples.vtk.org/site/Java/Views/RenderView", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Java/GeometricObjects/Line", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "EmbedInPyQt": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "EmbedInPyQt2": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "SelectExamples": "https://examples.vtk.org/site/Python/Utilities/SelectExamples", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkActor2D": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkActor2D": "https://www.vtk.org/doc/nightly/html/classvtkActor2D.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkAppendPolyData": {"CSharp": {"PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours"}, "VTKLink": {"vtkAppendPolyData": "https://www.vtk.org/doc/nightly/html/classvtkAppendPolyData.html#details"}, "Cxx": {"PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters"}, "Java": {"ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone"}, "Python": {"CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2"}}, "vtkArrowSource": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Arrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow"}, "VTKLink": {"vtkArrowSource": "https://www.vtk.org/doc/nightly/html/classvtkArrowSource.html#details"}, "Cxx": {"RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass"}, "Java": {"TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow"}, "Python": {"RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass"}}, "vtkAxesActor": {"CSharp": {"Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes"}, "VTKLink": {"vtkAxesActor": "https://www.vtk.org/doc/nightly/html/classvtkAxesActor.html#details"}, "Cxx": {"TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "CheckVTKVersion": "https://examples.vtk.org/site/Cxx/Utilities/CheckVTKVersion", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors"}, "Java": {"DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors"}}, "vtkBandedPolyDataContourFilter": {"CSharp": {"BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter"}, "VTKLink": {"vtkBandedPolyDataContourFilter": "https://www.vtk.org/doc/nightly/html/classvtkBandedPolyDataContourFilter.html#details"}, "Cxx": {"PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube"}, "Python": {"ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube"}}, "vtkBMPReader": {"CSharp": {"WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP", "ReadBMP": "https://examples.vtk.org/site/CSharp/IO/ReadBMP"}, "VTKLink": {"vtkBMPReader": "https://www.vtk.org/doc/nightly/html/classvtkBMPReader.html#details"}, "Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "ReadBMP": "https://examples.vtk.org/site/Java/IO/ReadBMP"}, "Python": {"ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp"}}, "vtkBMPWriter": {"CSharp": {"WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP"}, "VTKLink": {"vtkBMPWriter": "https://www.vtk.org/doc/nightly/html/classvtkBMPWriter.html#details"}, "Cxx": {"ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter"}, "Python": {"ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi"}}, "vtkButterflySubdivisionFilter": {"CSharp": {"Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkButterflySubdivisionFilter": "https://www.vtk.org/doc/nightly/html/classvtkButterflySubdivisionFilter.html#details"}, "Cxx": {"PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "Python": {"SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision"}}, "vtkCamera": {"CSharp": {"Planes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum"}, "VTKLink": {"vtkCamera": "https://www.vtk.org/doc/nightly/html/classvtkCamera.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "Java": {"ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkCell": {"CSharp": {"CellEdges": "https://examples.vtk.org/site/CSharp/Meshes/CellEdges"}, "VTKLink": {"vtkCell": "https://www.vtk.org/doc/nightly/html/classvtkCell.html#details"}, "Cxx": {"TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "GetCellCenter": "https://examples.vtk.org/site/Cxx/ImageData/GetCellCenter", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "CellEdges": "https://examples.vtk.org/site/Cxx/Meshes/CellEdges"}, "Python": {"CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource"}}, "vtkCellArray": {"CSharp": {"IterateOverLines": "https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges"}, "VTKLink": {"vtkCellArray": "https://www.vtk.org/doc/nightly/html/classvtkCellArray.html#details"}, "Cxx": {"DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "RemoveVertices": "https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "WriteVTP": "https://examples.vtk.org/site/Cxx/IO/WriteVTP", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "AddCell": "https://examples.vtk.org/site/Cxx/Meshes/AddCell"}, "Java": {"TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "AddCell": "https://examples.vtk.org/site/Java/Meshes/AddCell"}, "Python": {"TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "TriangleCornerVertices": "https://examples.vtk.org/site/Python/PolyData/TriangleCornerVertices", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "IterateOverLines": "https://examples.vtk.org/site/Python/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "IterativeClosestPoints": "https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "WriteTriangleToFile": "https://examples.vtk.org/site/Python/IO/WriteTriangleToFile", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet"}}, "vtkCleanPolyData": {"CSharp": {"FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours"}, "VTKLink": {"vtkCleanPolyData": "https://www.vtk.org/doc/nightly/html/classvtkCleanPolyData.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "CleanPolyData": "https://examples.vtk.org/site/Cxx/PolyData/CleanPolyData", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkClipPolyData": {"CSharp": {"SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip"}, "VTKLink": {"vtkClipPolyData": "https://www.vtk.org/doc/nightly/html/classvtkClipPolyData.html#details"}, "Cxx": {"SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum"}, "Python": {"ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip"}}, "vtkConeSource": {"CSharp": {"Cone": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cone", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo"}, "VTKLink": {"vtkConeSource": "https://www.vtk.org/doc/nightly/html/classvtkConeSource.html#details"}, "Cxx": {"Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkContourFilter": {"CSharp": {"ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours"}, "VTKLink": {"vtkContourFilter": "https://www.vtk.org/doc/nightly/html/classvtkContourFilter.html#details"}, "Cxx": {"ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud"}, "Java": {"SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol"}, "Python": {"ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud"}}, "vtkContourWidget": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator"}, "VTKLink": {"vtkContourWidget": "https://www.vtk.org/doc/nightly/html/classvtkContourWidget.html#details"}, "Cxx": {"PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget"}, "Python": {"ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget"}}, "vtkCubeSource": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Cube": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cube"}, "VTKLink": {"vtkCubeSource": "https://www.vtk.org/doc/nightly/html/classvtkCubeSource.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "CleanPolyData": "https://examples.vtk.org/site/Cxx/PolyData/CleanPolyData", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt"}, "Java": {"Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors"}}, "vtkCurvatures": {"CSharp": {"Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature"}, "VTKLink": {"vtkCurvatures": "https://www.vtk.org/doc/nightly/html/classvtkCurvatures.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkCutter": {"CSharp": {"ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData"}, "VTKLink": {"vtkCutter": "https://www.vtk.org/doc/nightly/html/classvtkCutter.html#details"}, "Cxx": {"ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering"}, "Java": {"Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter"}, "Python": {"FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering"}}, "vtkCylinderSource": {"CSharp": {"Cylinder": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo"}, "VTKLink": {"vtkCylinderSource": "https://www.vtk.org/doc/nightly/html/classvtkCylinderSource.html#details"}, "Cxx": {"TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud"}, "Java": {"TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample"}, "Python": {"SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkDataObject": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction"}, "VTKLink": {"vtkDataObject": "https://www.vtk.org/doc/nightly/html/classvtkDataObject.html#details"}, "Cxx": {"CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTest1": "https://examples.vtk.org/site/Cxx/Developers/vtkTest1", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "Warnings": "https://examples.vtk.org/site/Cxx/Developers/Warnings", "vtkTest": "https://examples.vtk.org/site/Cxx/Developers/vtkTest", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels"}}, "vtkDataSet": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells"}, "VTKLink": {"vtkDataSet": "https://www.vtk.org/doc/nightly/html/classvtkDataSet.html#details"}, "Cxx": {"MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance"}}, "vtkDataSetAttributes": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction"}, "VTKLink": {"vtkDataSetAttributes": "https://www.vtk.org/doc/nightly/html/classvtkDataSetAttributes.html#details"}, "Cxx": {"WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels"}, "Python": {"GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels"}}, "vtkDataSetMapper": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "ReadRectilinearGrid": "https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "ReadPolyData": "https://examples.vtk.org/site/CSharp/IO/ReadPolyData", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI", "ReadUnstructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid", "ReadImageData": "https://examples.vtk.org/site/CSharp/IO/ReadImageData", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip"}, "VTKLink": {"vtkDataSetMapper": "https://www.vtk.org/doc/nightly/html/classvtkDataSetMapper.html#details"}, "Cxx": {"ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "Java": {"Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkDataSetSurfaceFilter": {"CSharp": {"MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkDataSetSurfaceFilter": "https://www.vtk.org/doc/nightly/html/classvtkDataSetSurfaceFilter.html#details"}, "Cxx": {"DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "Python": {"DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface"}}, "vtkDecimatePro": {"CSharp": {"Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate"}, "VTKLink": {"vtkDecimatePro": "https://www.vtk.org/doc/nightly/html/classvtkDecimatePro.html#details"}, "Cxx": {"PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation"}, "Python": {"PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkDelaunay2D": {"CSharp": {"SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap"}, "VTKLink": {"vtkDelaunay2D": "https://www.vtk.org/doc/nightly/html/classvtkDelaunay2D.html#details"}, "Cxx": {"SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter"}, "Java": {"Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkDEMReader": {"CSharp": {"DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader"}, "VTKLink": {"vtkDEMReader": "https://www.vtk.org/doc/nightly/html/classvtkDEMReader.html#details"}, "Cxx": {"DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "Java": {"DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader"}}, "vtkDICOMImageReader": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries"}, "VTKLink": {"vtkDICOMImageReader": "https://www.vtk.org/doc/nightly/html/classvtkDICOMImageReader.html#details"}, "Cxx": {"FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes"}, "Java": {"ReadDICOM": "https://examples.vtk.org/site/Java/IO/ReadDICOM"}, "Python": {"ReadDICOM": "https://examples.vtk.org/site/Python/IO/ReadDICOM", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes"}}, "vtkDijkstraGraphGeodesicPath": {"CSharp": {"DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath"}, "VTKLink": {"vtkDijkstraGraphGeodesicPath": "https://www.vtk.org/doc/nightly/html/classvtkDijkstraGraphGeodesicPath.html#details"}, "Cxx": {"DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath"}}, "vtkDiskSource": {"CSharp": {"Disk": "https://examples.vtk.org/site/CSharp/GeometricObjects/Disk", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges"}, "VTKLink": {"vtkDiskSource": "https://www.vtk.org/doc/nightly/html/classvtkDiskSource.html#details"}, "Cxx": {"ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges"}, "Java": {"Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges"}}, "vtkDoubleArray": {"CSharp": {"WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells"}, "VTKLink": {"vtkDoubleArray": "https://www.vtk.org/doc/nightly/html/classvtkDoubleArray.html#details"}, "Cxx": {"CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "GetMiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "AttachAttributes": "https://examples.vtk.org/site/Cxx/PolyData/AttachAttributes", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageValueRange": "https://examples.vtk.org/site/Cxx/Images/ImageValueRange", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator", "PCAStatistics": "https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "SortDataArray": "https://examples.vtk.org/site/Cxx/Utilities/SortDataArray", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "Java": {"MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGridToTetrahedra"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges", "EdgeWeights": "https://examples.vtk.org/site/Python/Graphs/EdgeWeights", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine"}}, "vtkEarthSource": {"CSharp": {"GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo"}, "VTKLink": {"vtkEarthSource": "https://www.vtk.org/doc/nightly/html/classvtkEarthSource.html#details"}, "Cxx": {"EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource"}, "Java": {"EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource"}, "Python": {"EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource"}}, "vtkElevationFilter": {"CSharp": {"ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter"}, "VTKLink": {"vtkElevationFilter": "https://www.vtk.org/doc/nightly/html/classvtkElevationFilter.html#details"}, "Cxx": {"RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter"}, "Java": {"ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet"}}, "vtkExtractEdges": {"CSharp": {"ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges"}, "VTKLink": {"vtkExtractEdges": "https://www.vtk.org/doc/nightly/html/classvtkExtractEdges.html#details"}, "Cxx": {"VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges"}, "Java": {"DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh"}, "Python": {"MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh"}}, "vtkExtractSelection": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkExtractSelection": "https://www.vtk.org/doc/nightly/html/classvtkExtractSelection.html#details"}, "Cxx": {"ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking"}}, "vtkFeatureEdges": {"CSharp": {"ClosedSurface": "https://examples.vtk.org/site/CSharp/PolyData/ClosedSurface", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges"}, "VTKLink": {"vtkFeatureEdges": "https://www.vtk.org/doc/nightly/html/classvtkFeatureEdges.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges"}, "Java": {"BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges"}}, "vtkFieldData": {"CSharp": {"WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter"}, "VTKLink": {"vtkFieldData": "https://www.vtk.org/doc/nightly/html/classvtkFieldData.html#details"}, "Cxx": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart"}}, "vtkFillHolesFilter": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkFillHolesFilter": "https://www.vtk.org/doc/nightly/html/classvtkFillHolesFilter.html#details"}, "Cxx": {"MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}}, "vtkFloatArray": {"CSharp": {"WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "NullPoint": "https://examples.vtk.org/site/CSharp/PolyData/NullPoint", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter"}, "VTKLink": {"vtkFloatArray": "https://www.vtk.org/doc/nightly/html/classvtkFloatArray.html#details"}, "Cxx": {"CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "ReverseSense": "https://examples.vtk.org/site/Cxx/PolyData/ReverseSense", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "GetMiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "VectorArrayKnownLength": "https://examples.vtk.org/site/Cxx/Utilities/VectorArrayKnownLength", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ArrayRange": "https://examples.vtk.org/site/Cxx/Utilities/ArrayRange", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "VectorArrayUnknownLength": "https://examples.vtk.org/site/Cxx/Utilities/VectorArrayUnknownLength", "UnknownLengthArray": "https://examples.vtk.org/site/Cxx/Utilities/UnknownLengthArray", "KnownLengthArray": "https://examples.vtk.org/site/Cxx/Utilities/KnownLengthArray", "CardinalSpline": "https://examples.vtk.org/site/Cxx/Utilities/CardinalSpline", "ArrayLookup": "https://examples.vtk.org/site/Cxx/Utilities/ArrayLookup", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "Java": {"ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "UnknownLengthArray": "https://examples.vtk.org/site/Java/Utilities/UnknownLengthArray", "KnownLengthArray": "https://examples.vtk.org/site/Java/Utilities/KnownLengthArray", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkFrustumSource": {"CSharp": {"Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum"}, "VTKLink": {"vtkFrustumSource": "https://www.vtk.org/doc/nightly/html/classvtkFrustumSource.html#details"}, "Cxx": {"OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum"}, "Java": {"Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum"}, "Python": {"Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum"}}, "vtkGlyph3D": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB"}, "VTKLink": {"vtkGlyph3D": "https://www.vtk.org/doc/nightly/html/classvtkGlyph3D.html#details"}, "Cxx": {"ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace"}, "Java": {"ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace"}, "Python": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace"}}, "vtkGraphLayoutView": {"CSharp": {"XGMLReader": "https://examples.vtk.org/site/CSharp/InfoVis/XGMLReader"}, "VTKLink": {"vtkGraphLayoutView": "https://www.vtk.org/doc/nightly/html/classvtkGraphLayoutView.html#details"}, "Cxx": {"MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices"}, "Java": {"GraphPoints": "https://examples.vtk.org/site/Java/InfoVis/GraphPoints", "VisualizeGraph": "https://examples.vtk.org/site/Java/Graphs/VisualizeGraph", "SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices", "RandomGraphSource": "https://examples.vtk.org/site/Java/Graphs/RandomGraphSource"}, "Python": {"SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/SelectedVerticesAndEdges", "EdgeWeights": "https://examples.vtk.org/site/Python/Graphs/EdgeWeights", "RandomGraphSource": "https://examples.vtk.org/site/Python/Graphs/RandomGraphSource", "ConstructTree": "https://examples.vtk.org/site/Python/Graphs/ConstructTree", "CreateTree": "https://examples.vtk.org/site/Python/Graphs/CreateTree", "ColorVertexLabels": "https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels", "ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "ConstructGraph": "https://examples.vtk.org/site/Python/Graphs/ConstructGraph", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "VisualizeGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges"}}, "vtkGreedyTerrainDecimation": {"CSharp": {"GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation"}, "VTKLink": {"vtkGreedyTerrainDecimation": "https://www.vtk.org/doc/nightly/html/classvtkGreedyTerrainDecimation.html#details"}, "Cxx": {"GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation"}}, "vtkHexahedron": {"CSharp": {"Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron"}, "VTKLink": {"vtkHexahedron": "https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details"}, "Cxx": {"DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration"}, "Python": {"DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration"}}, "vtkIdList": {"CSharp": {"IterateOverLines": "https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines", "CellEdges": "https://examples.vtk.org/site/CSharp/Meshes/CellEdges"}, "VTKLink": {"vtkIdList": "https://www.vtk.org/doc/nightly/html/classvtkIdList.html#details"}, "Cxx": {"ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "PointLocatorRadius": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorRadius", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "ArrayLookup": "https://examples.vtk.org/site/Cxx/Utilities/ArrayLookup", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "KDTreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadius", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OctreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadius", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "ClosestNPoints": "https://examples.vtk.org/site/Cxx/DataStructures/ClosestNPoints", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "OctreeKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeKClosestPoints", "BuildLocatorFromKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/BuildLocatorFromKClosestPoints", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "CellEdges": "https://examples.vtk.org/site/Cxx/Meshes/CellEdges"}, "Python": {"ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "IterateOverLines": "https://examples.vtk.org/site/Python/PolyData/IterateOverLines", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration"}}, "vtkIdTypeArray": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkIdTypeArray": "https://www.vtk.org/doc/nightly/html/classvtkIdTypeArray.html#details"}, "Cxx": {"PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "Java": {"SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking"}}, "vtkImageActor": {"CSharp": {"ImageReader2Factory": "https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory", "MetaImageReader": "https://examples.vtk.org/site/CSharp/IO/MetaImageReader", "MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter", "DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader"}, "VTKLink": {"vtkImageActor": "https://www.vtk.org/doc/nightly/html/classvtkImageActor.html#details"}, "Cxx": {"TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "Java": {"ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkImageCanvasSource2D": {"CSharp": {"WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM", "WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF", "WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter", "WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP"}, "VTKLink": {"vtkImageCanvasSource2D": "https://www.vtk.org/doc/nightly/html/classvtkImageCanvasSource2D.html#details"}, "Cxx": {"ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "FFMPEG": "https://examples.vtk.org/site/Cxx/Video/FFMPEG", "OggTheora": "https://examples.vtk.org/site/Cxx/Video/OggTheora", "MPEG2": "https://examples.vtk.org/site/Cxx/Video/MPEG2", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "PNGWriter": "https://examples.vtk.org/site/Cxx/IO/PNGWriter", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "XMLPImageDataWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPImageDataWriter", "JPEGWriter": "https://examples.vtk.org/site/Cxx/IO/JPEGWriter", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "Java": {"OggTheora": "https://examples.vtk.org/site/Java/Video/OggTheora", "ShotNoise": "https://examples.vtk.org/site/Java/ImageProcessing/ShotNoise", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "JPEGWriter": "https://examples.vtk.org/site/Java/IO/JPEGWriter", "XMLPImageDataWriter": "https://examples.vtk.org/site/Java/IO/XMLPImageDataWriter"}, "Python": {"ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage"}}, "vtkImageCast": {"CSharp": {"WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter", "MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter"}, "VTKLink": {"vtkImageCast": "https://www.vtk.org/doc/nightly/html/classvtkImageCast.html#details"}, "Cxx": {"TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "PNGWriter": "https://examples.vtk.org/site/Cxx/IO/PNGWriter", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter"}, "Java": {"ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "Cast": "https://examples.vtk.org/site/Java/Images/Cast"}, "Python": {"ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient"}}, "vtkImageData": {"CSharp": {"GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI"}, "VTKLink": {"vtkImageData": "https://www.vtk.org/doc/nightly/html/classvtkImageData.html#details"}, "Cxx": {"GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "IterateImageData": "https://examples.vtk.org/site/Cxx/ImageData/IterateImageData", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "GetCellCenter": "https://examples.vtk.org/site/Cxx/ImageData/GetCellCenter", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "CellIdFromGridCoordinates": "https://examples.vtk.org/site/Cxx/ImageData/CellIdFromGridCoordinates", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ImageDataToPointSet": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageIterator": "https://examples.vtk.org/site/Cxx/ImageData/ImageIterator", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "RescaleAnImage": "https://examples.vtk.org/site/Cxx/ImageProcessing/RescaleAnImage", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImplicitDataSet": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitDataSet", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "ImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/ImageAlgorithmFilter", "ImageAccumulate": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulate", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "ImageExport": "https://examples.vtk.org/site/Cxx/Images/ImageExport", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "NegativeIndices": "https://examples.vtk.org/site/Cxx/Images/NegativeIndices", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageValueRange": "https://examples.vtk.org/site/Cxx/Images/ImageValueRange", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "ObserveError": "https://examples.vtk.org/site/Cxx/Utilities/ObserveError", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "ImageDataToQImage": "https://examples.vtk.org/site/Cxx/Qt/ImageDataToQImage", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "Java": {"CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkImageDataGeometryFilter": {"CSharp": {"WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI"}, "VTKLink": {"vtkImageDataGeometryFilter": "https://www.vtk.org/doc/nightly/html/classvtkImageDataGeometryFilter.html#details"}, "Cxx": {"ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "Java": {"StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader"}, "Python": {"ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids"}}, "vtkImageMagnitude": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction"}, "VTKLink": {"vtkImageMagnitude": "https://www.vtk.org/doc/nightly/html/classvtkImageMagnitude.html#details"}, "Cxx": {"VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum"}}, "vtkImageMandelbrotSource": {"CSharp": {"MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter"}, "VTKLink": {"vtkImageMandelbrotSource": "https://www.vtk.org/doc/nightly/html/classvtkImageMandelbrotSource.html#details"}, "Cxx": {"TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter"}, "Java": {"ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "Cast": "https://examples.vtk.org/site/Java/Images/Cast"}, "Python": {"ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "Cast": "https://examples.vtk.org/site/Python/Images/Cast"}}, "vtkImageMapToColors": {"CSharp": {"DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader"}, "VTKLink": {"vtkImageMapToColors": "https://www.vtk.org/doc/nightly/html/classvtkImageMapToColors.html#details"}, "Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkImageReader2": {"CSharp": {"ImageReader2Factory": "https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory"}, "VTKLink": {"vtkImageReader2": "https://www.vtk.org/doc/nightly/html/classvtkImageReader2.html#details"}, "Cxx": {"EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "Java": {"ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "StaticImage": "https://examples.vtk.org/site/Java/Images/StaticImage", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere"}}, "vtkImageReader2Factory": {"CSharp": {"ImageReader2Factory": "https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory"}, "VTKLink": {"vtkImageReader2Factory": "https://www.vtk.org/doc/nightly/html/classvtkImageReader2Factory.html#details"}, "Cxx": {"EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "Java": {"ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "StaticImage": "https://examples.vtk.org/site/Java/Images/StaticImage", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere"}, "Python": {"EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}}, "vtkImageViewer2": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM", "ReadBMP": "https://examples.vtk.org/site/CSharp/IO/ReadBMP", "ReadTIFF": "https://examples.vtk.org/site/CSharp/IO/ReadTIFF", "WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF", "ReadPNM": "https://examples.vtk.org/site/CSharp/IO/ReadPNM", "JPEGReader": "https://examples.vtk.org/site/CSharp/IO/JPEGReader", "WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter", "WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP", "PNGReader": "https://examples.vtk.org/site/CSharp/IO/PNGReader"}, "VTKLink": {"vtkImageViewer2": "https://www.vtk.org/doc/nightly/html/classvtkImageViewer2.html#details"}, "Cxx": {"ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "Java": {"StaticImage": "https://examples.vtk.org/site/Java/Images/StaticImage", "ImageSinusoidSource": "https://examples.vtk.org/site/Java/Images/ImageSinusoidSource", "ReadTIFF": "https://examples.vtk.org/site/Java/IO/ReadTIFF", "ReadBMP": "https://examples.vtk.org/site/Java/IO/ReadBMP", "ReadPNM": "https://examples.vtk.org/site/Java/IO/ReadPNM", "JPEGReader": "https://examples.vtk.org/site/Java/IO/JPEGReader", "ReadDICOM": "https://examples.vtk.org/site/Java/IO/ReadDICOM", "PNGReader": "https://examples.vtk.org/site/Java/IO/PNGReader"}, "Python": {"ReadDICOM": "https://examples.vtk.org/site/Python/IO/ReadDICOM", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries"}}, "vtkImplicitBoolean": {"CSharp": {"ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean"}, "VTKLink": {"vtkImplicitBoolean": "https://www.vtk.org/doc/nightly/html/classvtkImplicitBoolean.html#details"}, "Cxx": {"BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder"}, "Java": {"IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream"}, "Python": {"BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder"}}, "vtkIntArray": {"CSharp": {"NullPoint": "https://examples.vtk.org/site/CSharp/PolyData/NullPoint"}, "VTKLink": {"vtkIntArray": "https://www.vtk.org/doc/nightly/html/classvtkIntArray.html#details"}, "Cxx": {"CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "IterateImageData": "https://examples.vtk.org/site/Cxx/ImageData/IterateImageData", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents", "ArrayRange": "https://examples.vtk.org/site/Cxx/Utilities/ArrayRange", "SortDataArray": "https://examples.vtk.org/site/Cxx/Utilities/SortDataArray", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "Python": {"NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "ColorVertexLabels": "https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels", "ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource"}}, "vtkInteractorStyleImage": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries"}, "VTKLink": {"vtkInteractorStyleImage": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleImage.html#details"}, "Cxx": {"ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion"}, "Java": {"ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation"}, "Python": {"EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries"}}, "vtkJPEGReader": {"CSharp": {"JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter", "JPEGReader": "https://examples.vtk.org/site/CSharp/IO/JPEGReader"}, "VTKLink": {"vtkJPEGReader": "https://www.vtk.org/doc/nightly/html/classvtkJPEGReader.html#details"}, "Cxx": {"CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap"}, "Java": {"JPEGReader": "https://examples.vtk.org/site/Java/IO/JPEGReader"}, "Python": {"BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture"}}, "vtkJPEGWriter": {"CSharp": {"JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter"}, "VTKLink": {"vtkJPEGWriter": "https://www.vtk.org/doc/nightly/html/classvtkJPEGWriter.html#details"}, "Cxx": {"JPEGWriter": "https://examples.vtk.org/site/Cxx/IO/JPEGWriter", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Java": {"JPEGWriter": "https://examples.vtk.org/site/Java/IO/JPEGWriter"}, "Python": {"ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkLandmarkTransform": {"CSharp": {"AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames"}, "VTKLink": {"vtkLandmarkTransform": "https://www.vtk.org/doc/nightly/html/classvtkLandmarkTransform.html#details"}, "Cxx": {"AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas"}}, "vtkLine": {"CSharp": {"IterateOverLines": "https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "DistancePointToLine": "https://examples.vtk.org/site/CSharp/SimpleOperations/DistancePointToLine", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges"}, "VTKLink": {"vtkLine": "https://www.vtk.org/doc/nightly/html/classvtkLine.html#details"}, "Cxx": {"DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "DistancePointToLine": "https://examples.vtk.org/site/Cxx/SimpleOperations/DistancePointToLine", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges"}, "Java": {"RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine"}, "Python": {"IterateOverLines": "https://examples.vtk.org/site/Python/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere"}}, "vtkLinearSubdivisionFilter": {"CSharp": {"Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkLinearSubdivisionFilter": "https://www.vtk.org/doc/nightly/html/classvtkLinearSubdivisionFilter.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkLineSource": {"CSharp": {"GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Line": "https://examples.vtk.org/site/CSharp/GeometricObjects/Line"}, "VTKLink": {"vtkLineSource": "https://www.vtk.org/doc/nightly/html/classvtkLineSource.html#details"}, "Cxx": {"OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine"}, "Java": {"TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "Line": "https://examples.vtk.org/site/Java/GeometricObjects/Line"}, "Python": {"TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine"}}, "vtkLODActor": {"CSharp": {"SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB"}, "VTKLink": {"vtkLODActor": "https://www.vtk.org/doc/nightly/html/classvtkLODActor.html#details"}, "Cxx": {"SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1"}, "Java": {"CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D"}, "Python": {"CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor"}}, "vtkLookupTable": {"CSharp": {"FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader", "PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap"}, "VTKLink": {"vtkLookupTable": "https://www.vtk.org/doc/nightly/html/classvtkLookupTable.html#details"}, "Cxx": {"MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "LUTUtilities": "https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities", "ColorLookupTable": "https://examples.vtk.org/site/Cxx/Utilities/ColorLookupTable", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "Java": {"ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "ColorLookupTable": "https://examples.vtk.org/site/Java/Utilities/ColorLookupTable", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "LUTUtilities": "https://examples.vtk.org/site/Python/Utilities/LUTUtilities", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkLoopSubdivisionFilter": {"CSharp": {"Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkLoopSubdivisionFilter": "https://www.vtk.org/doc/nightly/html/classvtkLoopSubdivisionFilter.html#details"}, "Cxx": {"Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "Python": {"SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh"}}, "vtkMarchingCubes": {"CSharp": {"ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes"}, "VTKLink": {"vtkMarchingCubes": "https://www.vtk.org/doc/nightly/html/classvtkMarchingCubes.html#details"}, "Cxx": {"HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "Java": {"MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkMarchingSquares": {"CSharp": {"MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares"}, "VTKLink": {"vtkMarchingSquares": "https://www.vtk.org/doc/nightly/html/classvtkMarchingSquares.html#details"}, "Cxx": {"ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares"}, "Python": {"ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator"}}, "vtkMath": {"CSharp": {"GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "UniformRandomNumber": "https://examples.vtk.org/site/CSharp/SimpleOperations/UniformRandomNumber", "DistanceBetweenPoints": "https://examples.vtk.org/site/CSharp/SimpleOperations/DistanceBetweenPoints", "GaussianRandomNumber": "https://examples.vtk.org/site/CSharp/SimpleOperations/GaussianRandomNumber", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap"}, "VTKLink": {"vtkMath": "https://www.vtk.org/doc/nightly/html/classvtkMath.html#details"}, "Cxx": {"DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "DistanceBetweenPoints": "https://examples.vtk.org/site/Cxx/SimpleOperations/DistanceBetweenPoints", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "IncrementalOctreePointLocator": "https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "NormalizeVector": "https://examples.vtk.org/site/Cxx/Math/NormalizeVector", "PerpendicularVector": "https://examples.vtk.org/site/Cxx/Math/PerpendicularVector", "LeastSquares": "https://examples.vtk.org/site/Cxx/Math/LeastSquares", "LUFactorization": "https://examples.vtk.org/site/Cxx/Math/LUFactorization", "HomogeneousLeastSquares": "https://examples.vtk.org/site/Cxx/Math/HomogeneousLeastSquares", "EigenSymmetric": "https://examples.vtk.org/site/Cxx/Math/EigenSymmetric"}, "Java": {"ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "DistanceBetweenPoints": "https://examples.vtk.org/site/Java/SimpleOperations/DistanceBetweenPoints", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "NormalizeVector": "https://examples.vtk.org/site/Java/Math/NormalizeVector"}, "Python": {"DistanceBetweenPoints": "https://examples.vtk.org/site/Python/SimpleOperations/DistanceBetweenPoints", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder"}}, "vtkMatrix4x4": {"CSharp": {"AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "PerspectiveTransform": "https://examples.vtk.org/site/CSharp/SimpleOperations/PerspectiveTransform", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow"}, "VTKLink": {"vtkMatrix4x4": "https://www.vtk.org/doc/nightly/html/classvtkMatrix4x4.html#details"}, "Cxx": {"AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "PerspectiveTransform": "https://examples.vtk.org/site/Cxx/SimpleOperations/PerspectiveTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder"}, "Java": {"PerspectiveTransform": "https://examples.vtk.org/site/Java/SimpleOperations/PerspectiveTransform", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder"}, "Python": {"FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo"}}, "vtkMatrixMathFilter": {"CSharp": {"MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkMatrixMathFilter": "https://www.vtk.org/doc/nightly/html/classvtkMatrixMathFilter.html#details"}, "Cxx": {"MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}}, "vtkMergePoints": {"CSharp": {"MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares"}, "VTKLink": {"vtkMergePoints": "https://www.vtk.org/doc/nightly/html/classvtkMergePoints.html#details"}, "Cxx": {"MergePoints": "https://examples.vtk.org/site/Cxx/PolyData/MergePoints", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone"}, "Python": {"HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone"}}, "vtkMeshQuality": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells"}, "VTKLink": {"vtkMeshQuality": "https://www.vtk.org/doc/nightly/html/classvtkMeshQuality.html#details"}, "Cxx": {"MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells"}, "Java": {"MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality"}}, "vtkMetaImageReader": {"CSharp": {"MetaImageReader": "https://examples.vtk.org/site/CSharp/IO/MetaImageReader", "MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter"}, "VTKLink": {"vtkMetaImageReader": "https://www.vtk.org/doc/nightly/html/classvtkMetaImageReader.html#details"}, "Cxx": {"VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "Java": {"MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkMetaImageWriter": {"CSharp": {"MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter"}, "VTKLink": {"vtkMetaImageWriter": "https://www.vtk.org/doc/nightly/html/classvtkMetaImageWriter.html#details"}, "Cxx": {"PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData"}}, "vtkMinimalStandardRandomSequence": {"CSharp": {"RandomSequence": "https://examples.vtk.org/site/CSharp/SimpleOperations/RandomSequence"}, "VTKLink": {"vtkMinimalStandardRandomSequence": "https://www.vtk.org/doc/nightly/html/classvtkMinimalStandardRandomSequence.html#details"}, "Cxx": {"MergePoints": "https://examples.vtk.org/site/Cxx/PolyData/MergePoints", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "RescaleAnImage": "https://examples.vtk.org/site/Cxx/ImageProcessing/RescaleAnImage", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "RandomSequence": "https://examples.vtk.org/site/Cxx/SimpleOperations/RandomSequence", "UniformRandomNumber": "https://examples.vtk.org/site/Cxx/SimpleOperations/UniformRandomNumber", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap"}, "Java": {"RandomSequence": "https://examples.vtk.org/site/Java/SimpleOperations/RandomSequence", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh"}, "Python": {"SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkMultiBlockDataSet": {"CSharp": {"MultiBlockMergeFilter": "https://examples.vtk.org/site/CSharp/PolyData/MultiBlockMergeFilter"}, "VTKLink": {"vtkMultiBlockDataSet": "https://www.vtk.org/doc/nightly/html/classvtkMultiBlockDataSet.html#details"}, "Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "MultiBlockMergeFilter": "https://examples.vtk.org/site/Cxx/PolyData/MultiBlockMergeFilter", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "Java": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper"}}, "vtkMultiBlockMergeFilter": {"CSharp": {"MultiBlockMergeFilter": "https://examples.vtk.org/site/CSharp/PolyData/MultiBlockMergeFilter"}, "VTKLink": {"vtkMultiBlockMergeFilter": "https://www.vtk.org/doc/nightly/html/classvtkMultiBlockMergeFilter.html#details"}, "Cxx": {"MultiBlockMergeFilter": "https://examples.vtk.org/site/Cxx/PolyData/MultiBlockMergeFilter"}}, "vtkMultiBlockPLOT3DReader": {"CSharp": {"ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D"}, "VTKLink": {"vtkMultiBlockPLOT3DReader": "https://www.vtk.org/doc/nightly/html/classvtkMultiBlockPLOT3DReader.html#details"}, "Cxx": {"XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow"}, "Java": {"ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D"}, "Python": {"ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow"}}, "vtkOBBDicer": {"CSharp": {"OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer"}, "VTKLink": {"vtkOBBDicer": "https://www.vtk.org/doc/nightly/html/classvtkOBBDicer.html#details"}, "Cxx": {"OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData"}}, "vtkObject": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries"}, "VTKLink": {"vtkObject": "https://www.vtk.org/doc/nightly/html/classvtkObject.html#details"}, "Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "ObserveError": "https://examples.vtk.org/site/Cxx/Utilities/ObserveError", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect"}, "Java": {"VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample"}}, "vtkOBJReader": {"CSharp": {"ReadOBJ": "https://examples.vtk.org/site/CSharp/IO/ReadOBJ"}, "VTKLink": {"vtkOBJReader": "https://www.vtk.org/doc/nightly/html/classvtkOBJReader.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision"}, "Java": {"ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkOrientedGlyphContourRepresentation": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator"}, "VTKLink": {"vtkOrientedGlyphContourRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkOrientedGlyphContourRepresentation.html#details"}, "Cxx": {"PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget"}, "Python": {"ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget"}}, "vtkOutlineCornerFilter": {"CSharp": {"OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer"}, "VTKLink": {"vtkOutlineCornerFilter": "https://www.vtk.org/doc/nightly/html/classvtkOutlineCornerFilter.html#details"}, "Cxx": {"OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer"}}, "vtkOutlineFilter": {"CSharp": {"IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares"}, "VTKLink": {"vtkOutlineFilter": "https://www.vtk.org/doc/nightly/html/classvtkOutlineFilter.html#details"}, "Cxx": {"Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "Java": {"Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkParametricBoy": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricBoy": "https://www.vtk.org/doc/nightly/html/classvtkParametricBoy.html#details"}, "Cxx": {"PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Python": {"PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParametricConicSpiral": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricConicSpiral": "https://www.vtk.org/doc/nightly/html/classvtkParametricConicSpiral.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricCrossCap": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricCrossCap": "https://www.vtk.org/doc/nightly/html/classvtkParametricCrossCap.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricDini": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricDini": "https://www.vtk.org/doc/nightly/html/classvtkParametricDini.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricEllipsoid": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricEllipsoid": "https://www.vtk.org/doc/nightly/html/classvtkParametricEllipsoid.html#details"}, "Cxx": {"PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricEnneper": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricEnneper": "https://www.vtk.org/doc/nightly/html/classvtkParametricEnneper.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricFigure8Klein": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricFigure8Klein": "https://www.vtk.org/doc/nightly/html/classvtkParametricFigure8Klein.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Java": {"ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricFunction": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricFunction": "https://www.vtk.org/doc/nightly/html/classvtkParametricFunction.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricFunctionSource": {"CSharp": {"ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricFunctionSource": "https://www.vtk.org/doc/nightly/html/classvtkParametricFunctionSource.html#details"}, "Cxx": {"KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParametricKlein": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricKlein": "https://www.vtk.org/doc/nightly/html/classvtkParametricKlein.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricMobius": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricMobius": "https://www.vtk.org/doc/nightly/html/classvtkParametricMobius.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParametricRandomHills": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricRandomHills": "https://www.vtk.org/doc/nightly/html/classvtkParametricRandomHills.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParametricRoman": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricRoman": "https://www.vtk.org/doc/nightly/html/classvtkParametricRoman.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricSpline": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricSpline": "https://www.vtk.org/doc/nightly/html/classvtkParametricSpline.html#details"}, "Cxx": {"KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh"}}, "vtkParametricSuperEllipsoid": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricSuperEllipsoid": "https://www.vtk.org/doc/nightly/html/classvtkParametricSuperEllipsoid.html#details"}, "Cxx": {"ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo"}, "Java": {"ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo"}}, "vtkParametricSuperToroid": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricSuperToroid": "https://www.vtk.org/doc/nightly/html/classvtkParametricSuperToroid.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo"}}, "vtkParametricTorus": {"CSharp": {"ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricTorus": "https://www.vtk.org/doc/nightly/html/classvtkParametricTorus.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParticleReader": {"CSharp": {"ParticleReader": "https://examples.vtk.org/site/CSharp/IO/ParticleReader"}, "VTKLink": {"vtkParticleReader": "https://www.vtk.org/doc/nightly/html/classvtkParticleReader.html#details"}, "Cxx": {"ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader"}, "Java": {"ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader"}}, "vtkPDBReader": {"CSharp": {"ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB"}, "VTKLink": {"vtkPDBReader": "https://www.vtk.org/doc/nightly/html/classvtkPDBReader.html#details"}, "Cxx": {"ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons"}, "Java": {"ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons"}}, "vtkPerspectiveTransform": {"CSharp": {"PerspectiveTransform": "https://examples.vtk.org/site/CSharp/SimpleOperations/PerspectiveTransform"}, "VTKLink": {"vtkPerspectiveTransform": "https://www.vtk.org/doc/nightly/html/classvtkPerspectiveTransform.html#details"}, "Cxx": {"PerspectiveTransform": "https://examples.vtk.org/site/Cxx/SimpleOperations/PerspectiveTransform"}, "Java": {"PerspectiveTransform": "https://examples.vtk.org/site/Java/SimpleOperations/PerspectiveTransform"}}, "vtkPlane": {"CSharp": {"ProjectPointPlane": "https://examples.vtk.org/site/CSharp/SimpleOperations/ProjectPointPlane", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip"}, "VTKLink": {"vtkPlane": "https://www.vtk.org/doc/nightly/html/classvtkPlane.html#details"}, "Cxx": {"ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ProjectPointPlane": "https://examples.vtk.org/site/Cxx/SimpleOperations/ProjectPointPlane", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface"}, "Java": {"ProjectPointPlane": "https://examples.vtk.org/site/Java/SimpleOperations/ProjectPointPlane", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter"}, "Python": {"FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip"}}, "vtkPlanes": {"CSharp": {"Planes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum"}, "VTKLink": {"vtkPlanes": "https://www.vtk.org/doc/nightly/html/classvtkPlanes.html#details"}, "Cxx": {"ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum"}, "Java": {"Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum"}, "Python": {"Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere"}}, "vtkPlanesIntersection": {"CSharp": {"PlanesIntersection": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlanesIntersection"}, "VTKLink": {"vtkPlanesIntersection": "https://www.vtk.org/doc/nightly/html/classvtkPlanesIntersection.html#details"}, "Cxx": {"PlanesIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlanesIntersection"}, "Java": {"PlanesIntersection": "https://examples.vtk.org/site/Java/GeometricObjects/PlanesIntersection"}, "Python": {"PlanesIntersection": "https://examples.vtk.org/site/Python/GeometricObjects/PlanesIntersection"}}, "vtkPlaneSource": {"CSharp": {"Plane": "https://examples.vtk.org/site/CSharp/GeometricObjects/Plane"}, "VTKLink": {"vtkPlaneSource": "https://www.vtk.org/doc/nightly/html/classvtkPlaneSource.html#details"}, "Cxx": {"ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "Java": {"ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight"}, "Python": {"CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane"}}, "vtkPlatonicSolidSource": {"CSharp": {"PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid"}, "VTKLink": {"vtkPlatonicSolidSource": "https://www.vtk.org/doc/nightly/html/classvtkPlatonicSolidSource.html#details"}, "Cxx": {"ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile"}, "Java": {"CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D"}, "Python": {"PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids"}}, "vtkPLYReader": {"CSharp": {"ReadPLY": "https://examples.vtk.org/site/CSharp/IO/ReadPLY"}, "VTKLink": {"vtkPLYReader": "https://www.vtk.org/doc/nightly/html/classvtkPLYReader.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision"}, "Java": {"ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkPLYWriter": {"CSharp": {"ConvertFile": "https://examples.vtk.org/site/CSharp/IO/ConvertFile"}, "VTKLink": {"vtkPLYWriter": "https://www.vtk.org/doc/nightly/html/classvtkPLYWriter.html#details"}, "Cxx": {"WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ConvertFile": "https://examples.vtk.org/site/Cxx/IO/ConvertFile"}, "Java": {"WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "ConvertFile": "https://examples.vtk.org/site/Java/IO/ConvertFile"}, "Python": {"WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY"}}, "vtkPNGReader": {"CSharp": {"WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "PNGReader": "https://examples.vtk.org/site/CSharp/IO/PNGReader"}, "VTKLink": {"vtkPNGReader": "https://www.vtk.org/doc/nightly/html/classvtkPNGReader.html#details"}, "Cxx": {"ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat"}, "Java": {"PNGReader": "https://examples.vtk.org/site/Java/IO/PNGReader"}, "Python": {"PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat"}}, "vtkPNGWriter": {"CSharp": {"WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG"}, "VTKLink": {"vtkPNGWriter": "https://www.vtk.org/doc/nightly/html/classvtkPNGWriter.html#details"}, "Cxx": {"Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "PNGWriter": "https://examples.vtk.org/site/Cxx/IO/PNGWriter", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA"}, "Java": {"ShotNoise": "https://examples.vtk.org/site/Java/ImageProcessing/ShotNoise", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkPNMReader": {"CSharp": {"WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM", "ReadPNM": "https://examples.vtk.org/site/CSharp/IO/ReadPNM"}, "VTKLink": {"vtkPNMReader": "https://www.vtk.org/doc/nightly/html/classvtkPNMReader.html#details"}, "Cxx": {"CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM"}, "Java": {"ReadPNM": "https://examples.vtk.org/site/Java/IO/ReadPNM", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM"}, "Python": {"CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont"}}, "vtkPNMWriter": {"CSharp": {"WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM"}, "VTKLink": {"vtkPNMWriter": "https://www.vtk.org/doc/nightly/html/classvtkPNMWriter.html#details"}, "Cxx": {"WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter"}, "Java": {"WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM"}, "Python": {"ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi"}}, "vtkPoints": {"CSharp": {"AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "NullPoint": "https://examples.vtk.org/site/CSharp/PolyData/NullPoint", "SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "IterateOverLines": "https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "PolygonIntersection": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolygonIntersection", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "PlanesIntersection": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlanesIntersection", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap"}, "VTKLink": {"vtkPoints": "https://www.vtk.org/doc/nightly/html/classvtkPoints.html#details"}, "Cxx": {"DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "CenterOfMass": "https://examples.vtk.org/site/Cxx/PolyData/CenterOfMass", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "DeletePoint": "https://examples.vtk.org/site/Cxx/PolyData/DeletePoint", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "ImageDataToPointSet": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "PolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/PolyDataFilter", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "DirectedGraphToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/DirectedGraphToMutableDirectedGraph", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "MutableDirectedGraphToDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/MutableDirectedGraphToDirectedGraph", "TreeToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/TreeToMutableDirectedGraph", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "GetClassName": "https://examples.vtk.org/site/Cxx/Utilities/GetClassName", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "PointInPolygon": "https://examples.vtk.org/site/Cxx/Utilities/PointInPolygon", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLStructuredGridWriter", "WriteVTP": "https://examples.vtk.org/site/Cxx/IO/WriteVTP", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "PolygonIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolygonIntersection", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "PlanesIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlanesIntersection", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "KdTree": "https://examples.vtk.org/site/Cxx/DataStructures/KdTree", "OBBTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeIntersectWithLine", "IncrementalOctreePointLocator": "https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator", "KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints", "BuildOctree": "https://examples.vtk.org/site/Cxx/DataStructures/BuildOctree", "KdTreePointLocatorClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/KdTreePointLocatorClosestPoint", "OctreeClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeClosestPoint", "BuildLocatorFromKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/BuildLocatorFromKClosestPoints", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "AddCell": "https://examples.vtk.org/site/Cxx/Meshes/AddCell", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "CellEdges": "https://examples.vtk.org/site/Cxx/Meshes/CellEdges", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "CenterOfMass": "https://examples.vtk.org/site/Java/PolyData/CenterOfMass", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "GraphPoints": "https://examples.vtk.org/site/Java/InfoVis/GraphPoints", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLStructuredGridWriter", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "WriteVTP": "https://examples.vtk.org/site/Java/IO/WriteVTP", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine", "PlanesIntersection": "https://examples.vtk.org/site/Java/GeometricObjects/PlanesIntersection", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Java/StructuredPoints/StructuredPointsToUnstructuredGrid", "BuildOctree": "https://examples.vtk.org/site/Java/DataStructures/BuildOctree", "AddCell": "https://examples.vtk.org/site/Java/Meshes/AddCell"}, "Python": {"TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "TriangleCornerVertices": "https://examples.vtk.org/site/Python/PolyData/TriangleCornerVertices", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "TriangleCorners": "https://examples.vtk.org/site/Python/PolyData/TriangleCorners", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "IterateOverLines": "https://examples.vtk.org/site/Python/PolyData/IterateOverLines", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "IterativeClosestPoints": "https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteTriangleToFile": "https://examples.vtk.org/site/Python/IO/WriteTriangleToFile", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "PolygonIntersection": "https://examples.vtk.org/site/Python/GeometricObjects/PolygonIntersection", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "PlanesIntersection": "https://examples.vtk.org/site/Python/GeometricObjects/PlanesIntersection", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkPolyData": {"CSharp": {"AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "NullPoint": "https://examples.vtk.org/site/CSharp/PolyData/NullPoint", "PolyDataGetPoint": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataGetPoint", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "IterateOverLines": "https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "FindAllArrayNames": "https://examples.vtk.org/site/CSharp/IO/FindAllArrayNames", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkPolyData": "https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "MergePoints": "https://examples.vtk.org/site/Cxx/PolyData/MergePoints", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "GetMiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "DataBounds": "https://examples.vtk.org/site/Cxx/PolyData/DataBounds", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "DetermineArrayDataTypes": "https://examples.vtk.org/site/Cxx/PolyData/DetermineArrayDataTypes", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "CenterOfMass": "https://examples.vtk.org/site/Cxx/PolyData/CenterOfMass", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "RemoveVertices": "https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "GetMiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData", "PolyDataGetPoint": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataGetPoint", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "PassThrough": "https://examples.vtk.org/site/Cxx/InfoVis/PassThrough", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "PolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/PolyDataFilter", "PolyDataAlgorithmReader": "https://examples.vtk.org/site/Cxx/Developers/PolyDataAlgorithmReader", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "ShallowCopy": "https://examples.vtk.org/site/Cxx/Utilities/ShallowCopy", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "DeepCopy": "https://examples.vtk.org/site/Cxx/Utilities/DeepCopy", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "GenericDataObjectReader": "https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader", "WriteVTP": "https://examples.vtk.org/site/Cxx/IO/WriteVTP", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExodusIIWriter": "https://examples.vtk.org/site/Cxx/Parallel/ExodusIIWriter", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "BuildOctree": "https://examples.vtk.org/site/Cxx/DataStructures/BuildOctree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "IncrementalOctreePointLocator": "https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator", "ModifiedBSPTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine", "KdTreePointLocatorClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/KdTreePointLocatorClosestPoint", "KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeClosestPoint", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "AddCell": "https://examples.vtk.org/site/Cxx/Meshes/AddCell", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "CenterOfMass": "https://examples.vtk.org/site/Java/PolyData/CenterOfMass", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WriteVTP": "https://examples.vtk.org/site/Java/IO/WriteVTP", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "BuildOctree": "https://examples.vtk.org/site/Java/DataStructures/BuildOctree", "AddCell": "https://examples.vtk.org/site/Java/Meshes/AddCell"}, "Python": {"TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "TriangleCornerVertices": "https://examples.vtk.org/site/Python/PolyData/TriangleCornerVertices", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "TriangleCorners": "https://examples.vtk.org/site/Python/PolyData/TriangleCorners", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "IterateOverLines": "https://examples.vtk.org/site/Python/PolyData/IterateOverLines", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "RenameArray": "https://examples.vtk.org/site/Python/Arrays/RenameArray", "GetValues": "https://examples.vtk.org/site/Python/Arrays/GetValues", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "IterativeClosestPoints": "https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "WriteTriangleToFile": "https://examples.vtk.org/site/Python/IO/WriteTriangleToFile", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkPolyDataAlgorithm": {"CSharp": {"GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkPolyDataAlgorithm": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataAlgorithm.html#details"}, "Cxx": {"vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}}, "vtkPolyDataConnectivityFilter": {"CSharp": {"PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface"}, "VTKLink": {"vtkPolyDataConnectivityFilter": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataConnectivityFilter.html#details"}, "Cxx": {"PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface"}, "Java": {"ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions"}, "Python": {"PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface"}}, "vtkPolyDataMapper": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath", "ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData", "Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "ReadOBJ": "https://examples.vtk.org/site/CSharp/IO/ReadOBJ", "ReadSTL": "https://examples.vtk.org/site/CSharp/IO/ReadSTL", "SimplePointsReader": "https://examples.vtk.org/site/CSharp/IO/SimplePointsReader", "ParticleReader": "https://examples.vtk.org/site/CSharp/IO/ParticleReader", "ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "ReadPLY": "https://examples.vtk.org/site/CSharp/IO/ReadPLY", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow", "PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cone", "Disk": "https://examples.vtk.org/site/CSharp/GeometricObjects/Disk", "Cube": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cube", "Cylinder": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "Sphere": "https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere", "ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Plane": "https://examples.vtk.org/site/CSharp/GeometricObjects/Plane", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum", "RegularPolygonSource": "https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Line": "https://examples.vtk.org/site/CSharp/GeometricObjects/Line", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface", "MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkPolyDataMapper": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataMapper.html#details"}, "Cxx": {"DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent", "JFrameRenderer": "https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "RenderView": "https://examples.vtk.org/site/Java/Views/RenderView", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Java/GeometricObjects/Line", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "EmbedInPyQt": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "EmbedInPyQt2": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkPolygon": {"CSharp": {"Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "PolygonIntersection": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolygonIntersection"}, "VTKLink": {"vtkPolygon": "https://www.vtk.org/doc/nightly/html/classvtkPolygon.html#details"}, "Cxx": {"ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "PointInPolygon": "https://examples.vtk.org/site/Cxx/Utilities/PointInPolygon", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "PolygonIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolygonIntersection"}, "Java": {"Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon"}, "Python": {"ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "PolygonIntersection": "https://examples.vtk.org/site/Python/GeometricObjects/PolygonIntersection"}}, "vtkPolygonalSurfaceContourLineInterpolator": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator"}, "VTKLink": {"vtkPolygonalSurfaceContourLineInterpolator": "https://www.vtk.org/doc/nightly/html/classvtkPolygonalSurfaceContourLineInterpolator.html#details"}, "Cxx": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator"}}, "vtkPolygonalSurfacePointPlacer": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator"}, "VTKLink": {"vtkPolygonalSurfacePointPlacer": "https://www.vtk.org/doc/nightly/html/classvtkPolygonalSurfacePointPlacer.html#details"}, "Cxx": {"PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator"}}, "vtkPolyLine": {"CSharp": {"PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine"}, "VTKLink": {"vtkPolyLine": "https://www.vtk.org/doc/nightly/html/classvtkPolyLine.html#details"}, "Cxx": {"PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "Java": {"EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder"}, "Python": {"CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkProperty": {"CSharp": {"SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip"}, "VTKLink": {"vtkProperty": "https://www.vtk.org/doc/nightly/html/classvtkProperty.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "Java": {"BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder"}, "Python": {"FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkPyramid": {"CSharp": {"Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid"}, "VTKLink": {"vtkPyramid": "https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details"}, "Cxx": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid"}, "Java": {"Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid"}}, "vtkQuad": {"CSharp": {"Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad"}, "VTKLink": {"vtkQuad": "https://www.vtk.org/doc/nightly/html/classvtkQuad.html#details"}, "Cxx": {"OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "Java": {"Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad"}}, "vtkQuadricClustering": {"CSharp": {"QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering"}, "VTKLink": {"vtkQuadricClustering": "https://www.vtk.org/doc/nightly/html/classvtkQuadricClustering.html#details"}, "Cxx": {"QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering"}}, "vtkQuadricDecimation": {"CSharp": {"QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkQuadricDecimation": "https://www.vtk.org/doc/nightly/html/classvtkQuadricDecimation.html#details"}, "Cxx": {"QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation"}}, "vtkRegularPolygonSource": {"CSharp": {"GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "RegularPolygonSource": "https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate"}, "VTKLink": {"vtkRegularPolygonSource": "https://www.vtk.org/doc/nightly/html/classvtkRegularPolygonSource.html#details"}, "Cxx": {"BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate"}, "Java": {"BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource"}, "Python": {"BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle"}}, "vtkRenderer": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath", "ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData", "Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "ReadRectilinearGrid": "https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid", "ReadPolyData": "https://examples.vtk.org/site/CSharp/IO/ReadPolyData", "ReadBMP": "https://examples.vtk.org/site/CSharp/IO/ReadBMP", "ImageReader2Factory": "https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory", "JPEGReader": "https://examples.vtk.org/site/CSharp/IO/JPEGReader", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "SimplePointsReader": "https://examples.vtk.org/site/CSharp/IO/SimplePointsReader", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "ReadImageData": "https://examples.vtk.org/site/CSharp/IO/ReadImageData", "ReadPLY": "https://examples.vtk.org/site/CSharp/IO/ReadPLY", "MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter", "PNGReader": "https://examples.vtk.org/site/CSharp/IO/PNGReader", "ReadPNM": "https://examples.vtk.org/site/CSharp/IO/ReadPNM", "ReadSTL": "https://examples.vtk.org/site/CSharp/IO/ReadSTL", "WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "ReadUnstructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid", "ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB", "WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF", "ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D", "ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "MetaImageReader": "https://examples.vtk.org/site/CSharp/IO/MetaImageReader", "ReadTIFF": "https://examples.vtk.org/site/CSharp/IO/ReadTIFF", "DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader", "ReadOBJ": "https://examples.vtk.org/site/CSharp/IO/ReadOBJ", "ParticleReader": "https://examples.vtk.org/site/CSharp/IO/ParticleReader", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter", "WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow", "PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid", "Cone": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cone", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Disk": "https://examples.vtk.org/site/CSharp/GeometricObjects/Disk", "Cube": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cube", "Cylinder": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "Sphere": "https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere", "ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Plane": "https://examples.vtk.org/site/CSharp/GeometricObjects/Plane", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Planes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "RegularPolygonSource": "https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Line": "https://examples.vtk.org/site/CSharp/GeometricObjects/Line", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface", "MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkRenderer": "https://www.vtk.org/doc/nightly/html/classvtkRenderer.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "Coordinate": "https://examples.vtk.org/site/Cxx/Utilities/Coordinate", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "SplineWidget": "https://examples.vtk.org/site/Java/Widgets/SplineWidget", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "AngleWidget": "https://examples.vtk.org/site/Java/Widgets/AngleWidget", "PlaneWidget": "https://examples.vtk.org/site/Java/Widgets/PlaneWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "DistanceWidget": "https://examples.vtk.org/site/Java/Widgets/DistanceWidget", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "TextActor": "https://examples.vtk.org/site/Java/GeometricObjects/TextActor", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "EmbedInPyQt": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "SphereWidget": "https://examples.vtk.org/site/Python/Widgets/SphereWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "EmbedInPyQt2": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "AnnotatedCubeActor": "https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TextActor": "https://examples.vtk.org/site/Python/GeometricObjects/TextActor", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkRenderWindow": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath", "ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData", "Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "ReadRectilinearGrid": "https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid", "ReadPolyData": "https://examples.vtk.org/site/CSharp/IO/ReadPolyData", "ReadBMP": "https://examples.vtk.org/site/CSharp/IO/ReadBMP", "ImageReader2Factory": "https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory", "JPEGReader": "https://examples.vtk.org/site/CSharp/IO/JPEGReader", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "SimplePointsReader": "https://examples.vtk.org/site/CSharp/IO/SimplePointsReader", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "ReadImageData": "https://examples.vtk.org/site/CSharp/IO/ReadImageData", "ReadPLY": "https://examples.vtk.org/site/CSharp/IO/ReadPLY", "MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter", "PNGReader": "https://examples.vtk.org/site/CSharp/IO/PNGReader", "ReadPNM": "https://examples.vtk.org/site/CSharp/IO/ReadPNM", "ReadSTL": "https://examples.vtk.org/site/CSharp/IO/ReadSTL", "WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "ReadUnstructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid", "ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB", "WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF", "ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D", "ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "VRML": "https://examples.vtk.org/site/CSharp/IO/VRML", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "MetaImageReader": "https://examples.vtk.org/site/CSharp/IO/MetaImageReader", "ReadTIFF": "https://examples.vtk.org/site/CSharp/IO/ReadTIFF", "DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader", "ReadOBJ": "https://examples.vtk.org/site/CSharp/IO/ReadOBJ", "ParticleReader": "https://examples.vtk.org/site/CSharp/IO/ParticleReader", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter", "WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow", "PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid", "Cone": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cone", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Disk": "https://examples.vtk.org/site/CSharp/GeometricObjects/Disk", "Cube": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cube", "Cylinder": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "Sphere": "https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere", "ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Plane": "https://examples.vtk.org/site/CSharp/GeometricObjects/Plane", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Planes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "RegularPolygonSource": "https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Line": "https://examples.vtk.org/site/CSharp/GeometricObjects/Line", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface", "MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkRenderWindow": "https://www.vtk.org/doc/nightly/html/classvtkRenderWindow.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "Coordinate": "https://examples.vtk.org/site/Cxx/Utilities/Coordinate", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "SplineWidget": "https://examples.vtk.org/site/Java/Widgets/SplineWidget", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "AngleWidget": "https://examples.vtk.org/site/Java/Widgets/AngleWidget", "PlaneWidget": "https://examples.vtk.org/site/Java/Widgets/PlaneWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "DistanceWidget": "https://examples.vtk.org/site/Java/Widgets/DistanceWidget", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "TextActor": "https://examples.vtk.org/site/Java/GeometricObjects/TextActor", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "SphereWidget": "https://examples.vtk.org/site/Python/Widgets/SphereWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "AnnotatedCubeActor": "https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TextActor": "https://examples.vtk.org/site/Python/GeometricObjects/TextActor", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkSampleFunction": {"CSharp": {"ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction"}, "VTKLink": {"vtkSampleFunction": "https://www.vtk.org/doc/nightly/html/classvtkSampleFunction.html#details"}, "Cxx": {"Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud"}, "Java": {"SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe"}, "Python": {"Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud"}}, "vtkSelection": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkSelection": "https://www.vtk.org/doc/nightly/html/classvtkSelection.html#details"}, "Cxx": {"ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "Java": {"SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking"}}, "vtkSelectionNode": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkSelectionNode": "https://www.vtk.org/doc/nightly/html/classvtkSelectionNode.html#details"}, "Cxx": {"ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "Java": {"SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking"}}, "vtkSelectPolyData": {"CSharp": {"SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData"}, "VTKLink": {"vtkSelectPolyData": "https://www.vtk.org/doc/nightly/html/classvtkSelectPolyData.html#details"}, "Cxx": {"SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData"}}, "vtkShrinkPolyData": {"CSharp": {"ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData"}, "VTKLink": {"vtkShrinkPolyData": "https://www.vtk.org/doc/nightly/html/classvtkShrinkPolyData.html#details"}, "Cxx": {"ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum"}, "Java": {"RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource"}, "Python": {"MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum"}}, "vtkSimpleElevationFilter": {"CSharp": {"SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter"}, "VTKLink": {"vtkSimpleElevationFilter": "https://www.vtk.org/doc/nightly/html/classvtkSimpleElevationFilter.html#details"}, "Cxx": {"SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter"}}, "vtkSimplePointsReader": {"CSharp": {"SimplePointsReader": "https://examples.vtk.org/site/CSharp/IO/SimplePointsReader"}, "VTKLink": {"vtkSimplePointsReader": "https://www.vtk.org/doc/nightly/html/classvtkSimplePointsReader.html#details"}, "Cxx": {"SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader"}, "Java": {"SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader"}}, "vtkSphere": {"CSharp": {"ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction"}, "VTKLink": {"vtkSphere": "https://www.vtk.org/doc/nightly/html/classvtkSphere.html#details"}, "Cxx": {"Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens"}, "Java": {"IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction"}, "Python": {"Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens"}}, "vtkSphereSource": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "PolyDataGetPoint": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataGetPoint", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath", "ClosedSurface": "https://examples.vtk.org/site/CSharp/PolyData/ClosedSurface", "MultiBlockMergeFilter": "https://examples.vtk.org/site/CSharp/PolyData/MultiBlockMergeFilter", "ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB", "FindAllArrayNames": "https://examples.vtk.org/site/CSharp/IO/FindAllArrayNames", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Sphere": "https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere", "PlanesIntersection": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlanesIntersection", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Planes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Planes", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkSphereSource": "https://www.vtk.org/doc/nightly/html/classvtkSphereSource.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "ReverseSense": "https://examples.vtk.org/site/Cxx/PolyData/ReverseSense", "Stripper": "https://examples.vtk.org/site/Cxx/PolyData/Stripper", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "PolyDataGetPoint": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataGetPoint", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "CellTreeLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellTreeLocator", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "DataBounds": "https://examples.vtk.org/site/Cxx/PolyData/DataBounds", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "PolyDataToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "MultiBlockMergeFilter": "https://examples.vtk.org/site/Cxx/PolyData/MultiBlockMergeFilter", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "CellLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellLocator", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "PassThrough": "https://examples.vtk.org/site/Cxx/InfoVis/PassThrough", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "MultipleInputPorts": "https://examples.vtk.org/site/Cxx/Developers/MultipleInputPorts", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "SimplePointsWriter": "https://examples.vtk.org/site/Cxx/IO/SimplePointsWriter", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPUnstructuredGridWriter", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "PlanesIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlanesIntersection", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OBBTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeIntersectWithLine", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "ModifiedBSPTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "Stripper": "https://examples.vtk.org/site/Java/PolyData/Stripper", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent", "JFrameRenderer": "https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer", "PassThrough": "https://examples.vtk.org/site/Java/InfoVis/PassThrough", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "RenderView": "https://examples.vtk.org/site/Java/Views/RenderView", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "SimplePointsWriter": "https://examples.vtk.org/site/Java/IO/SimplePointsWriter", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLPUnstructuredGridWriter", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "PlanesIntersection": "https://examples.vtk.org/site/Java/GeometricObjects/PlanesIntersection", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace"}, "Python": {"ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "RenameArray": "https://examples.vtk.org/site/Python/Arrays/RenameArray", "GetValues": "https://examples.vtk.org/site/Python/Arrays/GetValues", "EmbedInPyQt": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "EmbedInPyQt2": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt2", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "PlanesIntersection": "https://examples.vtk.org/site/Python/GeometricObjects/PlanesIntersection", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkSTLReader": {"CSharp": {"ReadSTL": "https://examples.vtk.org/site/CSharp/IO/ReadSTL"}, "VTKLink": {"vtkSTLReader": "https://www.vtk.org/doc/nightly/html/classvtkSTLReader.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision"}, "Java": {"ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkStripper": {"CSharp": {"CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip"}, "VTKLink": {"vtkStripper": "https://www.vtk.org/doc/nightly/html/classvtkStripper.html#details"}, "Cxx": {"Stripper": "https://examples.vtk.org/site/Cxx/PolyData/Stripper", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip"}, "Java": {"Stripper": "https://examples.vtk.org/site/Java/PolyData/Stripper", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip"}}, "vtkStructuredGrid": {"CSharp": {"XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter"}, "VTKLink": {"vtkStructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkStructuredGrid.html#details"}, "Cxx": {"XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "GetLinearPointId": "https://examples.vtk.org/site/Cxx/StructuredGrid/GetLinearPointId", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLStructuredGridWriter", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "GenericDataObjectReader": "https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow"}, "Java": {"StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLStructuredGridWriter"}, "Python": {"SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint"}}, "vtkStructuredGridGeometryFilter": {"CSharp": {"XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D"}, "VTKLink": {"vtkStructuredGridGeometryFilter": "https://www.vtk.org/doc/nightly/html/classvtkStructuredGridGeometryFilter.html#details"}, "Cxx": {"VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow"}, "Java": {"ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D"}, "Python": {"BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow"}}, "vtkStructuredPointsReader": {"CSharp": {"ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface"}, "VTKLink": {"vtkStructuredPointsReader": "https://www.vtk.org/doc/nightly/html/classvtkStructuredPointsReader.html#details"}, "Cxx": {"IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface"}, "Java": {"SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV"}, "Python": {"IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface"}}, "vtkSuperquadricSource": {"CSharp": {"SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip"}, "VTKLink": {"vtkSuperquadricSource": "https://www.vtk.org/doc/nightly/html/classvtkSuperquadricSource.html#details"}, "Cxx": {"CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip"}, "Java": {"OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip"}}, "vtkTetra": {"CSharp": {"WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron"}, "VTKLink": {"vtkTetra": "https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details"}, "Cxx": {"WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource"}, "Java": {"WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource"}}, "vtkTextMapper": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkTextMapper": "https://www.vtk.org/doc/nightly/html/classvtkTextMapper.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "Java": {"MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkTextProperty": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkTextProperty": "https://www.vtk.org/doc/nightly/html/classvtkTextProperty.html#details"}, "Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "Java": {"MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkThreshold": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells"}, "VTKLink": {"vtkThreshold": "https://www.vtk.org/doc/nightly/html/classvtkThreshold.html#details"}, "Cxx": {"ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData"}, "Java": {"RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe"}, "Python": {"GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels"}}, "vtkThresholdPoints": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction"}, "VTKLink": {"vtkThresholdPoints": "https://www.vtk.org/doc/nightly/html/classvtkThresholdPoints.html#details"}, "Cxx": {"ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors"}, "Java": {"RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample"}, "Python": {"CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors"}}, "vtkTIFFReader": {"CSharp": {"WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF", "ReadTIFF": "https://examples.vtk.org/site/CSharp/IO/ReadTIFF"}, "VTKLink": {"vtkTIFFReader": "https://www.vtk.org/doc/nightly/html/classvtkTIFFReader.html#details"}, "Cxx": {"PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF"}, "Java": {"WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "ReadTIFF": "https://examples.vtk.org/site/Java/IO/ReadTIFF"}}, "vtkTIFFWriter": {"CSharp": {"WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF"}, "VTKLink": {"vtkTIFFWriter": "https://www.vtk.org/doc/nightly/html/classvtkTIFFWriter.html#details"}, "Cxx": {"WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter"}, "Java": {"WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF"}, "Python": {"ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi"}}, "vtkTransform": {"CSharp": {"WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "PerspectiveTransform": "https://examples.vtk.org/site/CSharp/SimpleOperations/PerspectiveTransform", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes"}, "VTKLink": {"vtkTransform": "https://www.vtk.org/doc/nightly/html/classvtkTransform.html#details"}, "Cxx": {"RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "PerspectiveTransform": "https://examples.vtk.org/site/Cxx/SimpleOperations/PerspectiveTransform", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "PerspectiveTransform": "https://examples.vtk.org/site/Java/SimpleOperations/PerspectiveTransform", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors"}}, "vtkTransformFilter": {"CSharp": {"WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames"}, "VTKLink": {"vtkTransformFilter": "https://www.vtk.org/doc/nightly/html/classvtkTransformFilter.html#details"}, "Cxx": {"WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere"}, "Java": {"TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere"}}, "vtkTransformPolyDataFilter": {"CSharp": {"OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow"}, "VTKLink": {"vtkTransformPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkTransformPolyDataFilter.html#details"}, "Cxx": {"RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "IterativeClosestPoints": "https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkTriangle": {"CSharp": {"WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "CellEdges": "https://examples.vtk.org/site/CSharp/Meshes/CellEdges"}, "VTKLink": {"vtkTriangle": "https://www.vtk.org/doc/nightly/html/classvtkTriangle.html#details"}, "Cxx": {"TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "AddCell": "https://examples.vtk.org/site/Cxx/Meshes/AddCell", "CellEdges": "https://examples.vtk.org/site/Cxx/Meshes/CellEdges"}, "Java": {"TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "AddCell": "https://examples.vtk.org/site/Java/Meshes/AddCell"}, "Python": {"SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteTriangleToFile": "https://examples.vtk.org/site/Python/IO/WriteTriangleToFile", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh"}}, "vtkTriangleFilter": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate"}, "VTKLink": {"vtkTriangleFilter": "https://www.vtk.org/doc/nightly/html/classvtkTriangleFilter.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation"}, "Java": {"MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkTriangleStrip": {"CSharp": {"TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip"}, "VTKLink": {"vtkTriangleStrip": "https://www.vtk.org/doc/nightly/html/classvtkTriangleStrip.html#details"}, "Cxx": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip"}, "Java": {"TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip"}}, "vtkTubeFilter": {"CSharp": {"ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB"}, "VTKLink": {"vtkTubeFilter": "https://www.vtk.org/doc/nightly/html/classvtkTubeFilter.html#details"}, "Cxx": {"PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "Java": {"TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle"}, "Python": {"TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkUndirectedGraph": {"CSharp": {"XGMLReader": "https://examples.vtk.org/site/CSharp/InfoVis/XGMLReader"}, "VTKLink": {"vtkUndirectedGraph": "https://www.vtk.org/doc/nightly/html/classvtkUndirectedGraph.html#details"}, "Cxx": {"XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource"}}, "vtkUnsignedCharArray": {"CSharp": {"ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap"}, "VTKLink": {"vtkUnsignedCharArray": "https://www.vtk.org/doc/nightly/html/classvtkUnsignedCharArray.html#details"}, "Cxx": {"TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter"}, "Java": {"ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB"}, "Python": {"SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkUnstructuredGrid": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid"}, "VTKLink": {"vtkUnstructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details"}, "Cxx": {"ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "PolyDataToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "GenericDataObjectReader": "https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "Java": {"WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Java/StructuredPoints/StructuredPointsToUnstructuredGrid"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance"}}, "vtkUnstructuredGridReader": {"CSharp": {"MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkUnstructuredGridReader": "https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGridReader.html#details"}, "Cxx": {"DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "Python": {"ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane"}}, "vtkVertex": {"CSharp": {"Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex"}, "VTKLink": {"vtkVertex": "https://www.vtk.org/doc/nightly/html/classvtkVertex.html#details"}, "Cxx": {"DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex"}, "Java": {"Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex"}}, "vtkVertexGlyphFilter": {"CSharp": {"AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText"}, "VTKLink": {"vtkVertexGlyphFilter": "https://www.vtk.org/doc/nightly/html/classvtkVertexGlyphFilter.html#details"}, "Cxx": {"AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints"}, "Java": {"ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D"}, "Python": {"ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap"}}, "vtkVolume16Reader": {"CSharp": {"MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares"}, "VTKLink": {"vtkVolume16Reader": "https://www.vtk.org/doc/nightly/html/classvtkVolume16Reader.html#details"}}, "vtkVoxelModeller": {"CSharp": {"MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes"}, "VTKLink": {"vtkVoxelModeller": "https://www.vtk.org/doc/nightly/html/classvtkVoxelModeller.html#details"}, "Cxx": {"MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes"}, "Python": {"MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes"}}, "vtkVRMLImporter": {"CSharp": {"VRML": "https://examples.vtk.org/site/CSharp/IO/VRML"}, "VTKLink": {"vtkVRMLImporter": "https://www.vtk.org/doc/nightly/html/classvtkVRMLImporter.html#details"}, "Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "Java": {"VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter"}}, "vtkWarpVector": {"CSharp": {"WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector"}, "VTKLink": {"vtkWarpVector": "https://www.vtk.org/doc/nightly/html/classvtkWarpVector.html#details"}, "Cxx": {"WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow"}, "Python": {"WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow"}}, "vtkWeightedTransformFilter": {"CSharp": {"WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter"}, "VTKLink": {"vtkWeightedTransformFilter": "https://www.vtk.org/doc/nightly/html/classvtkWeightedTransformFilter.html#details"}, "Cxx": {"WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter"}}, "vtkWindowedSincPolyDataFilter": {"CSharp": {"WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter"}, "VTKLink": {"vtkWindowedSincPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkWindowedSincPolyDataFilter.html#details"}, "Cxx": {"FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter"}, "Python": {"FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkXGMLReader": {"CSharp": {"XGMLReader": "https://examples.vtk.org/site/CSharp/InfoVis/XGMLReader"}, "VTKLink": {"vtkXGMLReader": "https://www.vtk.org/doc/nightly/html/classvtkXGMLReader.html#details"}, "Cxx": {"XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader"}}, "vtkXMLGenericDataObjectReader": {"CSharp": {"ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile"}, "VTKLink": {"vtkXMLGenericDataObjectReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLGenericDataObjectReader.html#details"}, "Cxx": {"ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile"}}, "vtkXMLImageDataReader": {"CSharp": {"ReadImageData": "https://examples.vtk.org/site/CSharp/IO/ReadImageData", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI"}, "VTKLink": {"vtkXMLImageDataReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLImageDataReader.html#details"}, "Cxx": {"FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI"}, "Python": {"WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData"}}, "vtkXMLImageDataWriter": {"CSharp": {"IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI"}, "VTKLink": {"vtkXMLImageDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLImageDataWriter.html#details"}, "Cxx": {"IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes"}, "Python": {"WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData"}}, "vtkXMLPolyDataReader": {"CSharp": {"Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "ReadPolyData": "https://examples.vtk.org/site/CSharp/IO/ReadPolyData", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "FindAllArrayNames": "https://examples.vtk.org/site/CSharp/IO/FindAllArrayNames", "ConvertFile": "https://examples.vtk.org/site/CSharp/IO/ConvertFile", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkXMLPolyDataReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLPolyDataReader.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "GetMiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "GetMiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "DataBounds": "https://examples.vtk.org/site/Cxx/PolyData/DataBounds", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "DetermineArrayDataTypes": "https://examples.vtk.org/site/Cxx/PolyData/DetermineArrayDataTypes", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "RemoveVertices": "https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "FileOutputWindow": "https://examples.vtk.org/site/Cxx/Utilities/FileOutputWindow", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ConvertFile": "https://examples.vtk.org/site/Cxx/IO/ConvertFile", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "ConvertFile": "https://examples.vtk.org/site/Java/IO/ConvertFile", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkXMLPolyDataWriter": {"CSharp": {"AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "FindAllArrayNames": "https://examples.vtk.org/site/CSharp/IO/FindAllArrayNames", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkXMLPolyDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLPolyDataWriter.html#details"}, "Cxx": {"AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "RemoveVertices": "https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "WriteVTP": "https://examples.vtk.org/site/Cxx/IO/WriteVTP", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "WriteVTP": "https://examples.vtk.org/site/Java/IO/WriteVTP"}, "Python": {"TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "TriangleCornerVertices": "https://examples.vtk.org/site/Python/PolyData/TriangleCornerVertices", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "TriangleCorners": "https://examples.vtk.org/site/Python/PolyData/TriangleCorners", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "RenameArray": "https://examples.vtk.org/site/Python/Arrays/RenameArray", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "WriteTriangleToFile": "https://examples.vtk.org/site/Python/IO/WriteTriangleToFile", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkXMLRectilinearGridReader": {"CSharp": {"ReadRectilinearGrid": "https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid"}, "VTKLink": {"vtkXMLRectilinearGridReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLRectilinearGridReader.html#details"}, "Cxx": {"ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile"}, "Java": {"ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid"}}, "vtkXMLStructuredGridReader": {"CSharp": {"XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid"}, "VTKLink": {"vtkXMLStructuredGridReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLStructuredGridReader.html#details"}, "Cxx": {"ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile"}, "Java": {"ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid"}}, "vtkXMLStructuredGridWriter": {"CSharp": {"XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter"}, "VTKLink": {"vtkXMLStructuredGridWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLStructuredGridWriter.html#details"}, "Cxx": {"ImageDataToPointSet": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLStructuredGridWriter", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes"}, "Java": {"XMLStructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLStructuredGridWriter"}}, "vtkXMLUnstructuredGridReader": {"CSharp": {"ReadUnstructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU"}, "VTKLink": {"vtkXMLUnstructuredGridReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLUnstructuredGridReader.html#details"}, "Cxx": {"FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid"}, "Java": {"WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample"}, "Python": {"ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid"}}, "vtkXMLUnstructuredGridWriter": {"CSharp": {"WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU"}, "VTKLink": {"vtkXMLUnstructuredGridWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLUnstructuredGridWriter.html#details"}, "Cxx": {"PolyDataToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra"}, "Java": {"WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Java/StructuredPoints/StructuredPointsToUnstructuredGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGridToTetrahedra"}, "Python": {"NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron"}}, "vtk3DSImporter": {"Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtk3DSImporter": "https://www.vtk.org/doc/nightly/html/classvtk3DSImporter.html#details"}, "Java": {"ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter"}, "Python": {"3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter"}}, "vtkAbstractPicker": {"Cxx": {"MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D"}, "VTKLink": {"vtkAbstractPicker": "https://www.vtk.org/doc/nightly/html/classvtkAbstractPicker.html#details"}}, "vtkAbstractWidget": {"Cxx": {"BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkAbstractWidget": "https://www.vtk.org/doc/nightly/html/classvtkAbstractWidget.html#details"}}, "vtkActorCollection": {"Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection"}, "VTKLink": {"vtkActorCollection": "https://www.vtk.org/doc/nightly/html/classvtkActorCollection.html#details"}, "Java": {"VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter", "ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter"}}, "vtkAdjacencyMatrixToEdgeTable": {"Cxx": {"AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable"}, "VTKLink": {"vtkAdjacencyMatrixToEdgeTable": "https://www.vtk.org/doc/nightly/html/classvtkAdjacencyMatrixToEdgeTable.html#details"}}, "vtkAdjacentVertexIterator": {"Cxx": {"AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator"}, "VTKLink": {"vtkAdjacentVertexIterator": "https://www.vtk.org/doc/nightly/html/classvtkAdjacentVertexIterator.html#details"}}, "vtkAffineRepresentation2D": {"Cxx": {"AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget"}, "VTKLink": {"vtkAffineRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkAffineRepresentation2D.html#details"}}, "vtkAffineWidget": {"Cxx": {"AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget"}, "VTKLink": {"vtkAffineWidget": "https://www.vtk.org/doc/nightly/html/classvtkAffineWidget.html#details"}}, "vtkAlgorithm": {"Cxx": {"vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton"}, "VTKLink": {"vtkAlgorithm": "https://www.vtk.org/doc/nightly/html/classvtkAlgorithm.html#details"}, "Python": {"TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource"}}, "vtkAlgorithmOutput": {"Cxx": {"ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess"}, "VTKLink": {"vtkAlgorithmOutput": "https://www.vtk.org/doc/nightly/html/classvtkAlgorithmOutput.html#details"}}, "vtkAMRBox": {"Cxx": {"Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR"}, "VTKLink": {"vtkAMRBox": "https://www.vtk.org/doc/nightly/html/classvtkAMRBox.html#details"}, "Python": {"OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR"}}, "vtkAMRUtilities": {"Cxx": {"Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR"}, "VTKLink": {"vtkAMRUtilities": "https://www.vtk.org/doc/nightly/html/classvtkAMRUtilities.html#details"}}, "vtkAngleRepresentation2D": {"Cxx": {"AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D"}, "VTKLink": {"vtkAngleRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkAngleRepresentation2D.html#details"}, "Java": {"AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D"}}, "vtkAngleWidget": {"Cxx": {"AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget"}, "VTKLink": {"vtkAngleWidget": "https://www.vtk.org/doc/nightly/html/classvtkAngleWidget.html#details"}, "Java": {"AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D", "AngleWidget": "https://examples.vtk.org/site/Java/Widgets/AngleWidget"}}, "vtkAnimationCue": {"Cxx": {"AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors"}, "VTKLink": {"vtkAnimationCue": "https://www.vtk.org/doc/nightly/html/classvtkAnimationCue.html#details"}}, "vtkAnimationScene": {"Cxx": {"AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors"}, "VTKLink": {"vtkAnimationScene": "https://www.vtk.org/doc/nightly/html/classvtkAnimationScene.html#details"}}, "vtkAnnotatedCubeActor": {"Cxx": {"CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor"}, "VTKLink": {"vtkAnnotatedCubeActor": "https://www.vtk.org/doc/nightly/html/classvtkAnnotatedCubeActor.html#details"}, "Java": {"AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor"}, "Python": {"CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "AnnotatedCubeActor": "https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor"}}, "vtkAnnotationLink": {"Cxx": {"SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver"}, "VTKLink": {"vtkAnnotationLink": "https://www.vtk.org/doc/nightly/html/classvtkAnnotationLink.html#details"}, "Java": {"SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "Python": {"SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction"}}, "vtkAppendFilter": {"Cxx": {"PolyDataToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization"}, "VTKLink": {"vtkAppendFilter": "https://www.vtk.org/doc/nightly/html/classvtkAppendFilter.html#details"}, "Python": {"ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization"}}, "vtkAreaPicker": {"Cxx": {"AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints"}, "VTKLink": {"vtkAreaPicker": "https://www.vtk.org/doc/nightly/html/classvtkAreaPicker.html#details"}}, "vtkArrayCalculator": {"Cxx": {"ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator"}, "VTKLink": {"vtkArrayCalculator": "https://www.vtk.org/doc/nightly/html/classvtkArrayCalculator.html#details"}}, "vtkArrayData": {"Cxx": {"ArrayToTable": "https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable", "AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable", "ArrayWriter": "https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter"}, "VTKLink": {"vtkArrayData": "https://www.vtk.org/doc/nightly/html/classvtkArrayData.html#details"}}, "vtkArrayDispatch": {"Cxx": {"ForLoop": "https://examples.vtk.org/site/Cxx/Utilities/ForLoop"}, "VTKLink": {"vtkArrayDispatch": "https://www.vtk.org/doc/nightly/html/classvtkArrayDispatch.html#details"}}, "vtkArrayPrint": {"Cxx": {"AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable"}, "VTKLink": {"vtkArrayPrint": "https://www.vtk.org/doc/nightly/html/classvtkArrayPrint.html#details"}}, "vtkArrayToTable": {"Cxx": {"ArrayToTable": "https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable"}, "VTKLink": {"vtkArrayToTable": "https://www.vtk.org/doc/nightly/html/classvtkArrayToTable.html#details"}}, "vtkArrayWriter": {"Cxx": {"ArrayWriter": "https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter"}, "VTKLink": {"vtkArrayWriter": "https://www.vtk.org/doc/nightly/html/classvtkArrayWriter.html#details"}}, "vtkAssembly": {"Cxx": {"MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly"}, "VTKLink": {"vtkAssembly": "https://www.vtk.org/doc/nightly/html/classvtkAssembly.html#details"}, "Java": {"Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly"}}, "vtkAssemblyNode": {"Cxx": {"ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion"}, "VTKLink": {"vtkAssemblyNode": "https://www.vtk.org/doc/nightly/html/classvtkAssemblyNode.html#details"}}, "vtkAssemblyPath": {"Cxx": {"PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion"}, "VTKLink": {"vtkAssemblyPath": "https://www.vtk.org/doc/nightly/html/classvtkAssemblyPath.html#details"}}, "vtkAssignAttribute": {"Cxx": {"GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter"}, "VTKLink": {"vtkAssignAttribute": "https://www.vtk.org/doc/nightly/html/classvtkAssignAttribute.html#details"}}, "vtkAxes": {"Cxx": {"TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD"}, "VTKLink": {"vtkAxes": "https://www.vtk.org/doc/nightly/html/classvtkAxes.html#details"}, "Java": {"TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin"}, "Python": {"TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations"}}, "vtkAxis": {"Cxx": {"MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkAxis": "https://www.vtk.org/doc/nightly/html/classvtkAxis.html#details"}, "Python": {"MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkAxisActor": {"Cxx": {"AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor"}, "VTKLink": {"vtkAxisActor": "https://www.vtk.org/doc/nightly/html/classvtkAxisActor.html#details"}}, "vtkBalloonRepresentation": {"Cxx": {"BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget"}, "VTKLink": {"vtkBalloonRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkBalloonRepresentation.html#details"}, "Java": {"BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget"}, "Python": {"BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget"}}, "vtkBalloonWidget": {"Cxx": {"BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget"}, "VTKLink": {"vtkBalloonWidget": "https://www.vtk.org/doc/nightly/html/classvtkBalloonWidget.html#details"}, "Java": {"BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget"}, "Python": {"BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget"}}, "vtkBarChartActor": {"Cxx": {"ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart"}, "VTKLink": {"vtkBarChartActor": "https://www.vtk.org/doc/nightly/html/classvtkBarChartActor.html#details"}}, "vtkBiDimensionalRepresentation2D": {"Cxx": {"BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget"}, "VTKLink": {"vtkBiDimensionalRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkBiDimensionalRepresentation2D.html#details"}}, "vtkBiDimensionalWidget": {"Cxx": {"BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget"}, "VTKLink": {"vtkBiDimensionalWidget": "https://www.vtk.org/doc/nightly/html/classvtkBiDimensionalWidget.html#details"}}, "vtkBillboardTextActor3D": {"Cxx": {"BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D"}, "VTKLink": {"vtkBillboardTextActor3D": "https://www.vtk.org/doc/nightly/html/classvtkBillboardTextActor3D.html#details"}, "Python": {"BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D"}}, "vtkBiQuadraticQuad": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkBiQuadraticQuad": "https://www.vtk.org/doc/nightly/html/classvtkBiQuadraticQuad.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkBiQuadraticQuadraticHexahedron": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkBiQuadraticQuadraticHexahedron": "https://www.vtk.org/doc/nightly/html/classvtkBiQuadraticQuadraticHexahedron.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkBiQuadraticQuadraticWedge": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkBiQuadraticQuadraticWedge": "https://www.vtk.org/doc/nightly/html/classvtkBiQuadraticQuadraticWedge.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkBiQuadraticTriangle": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkBiQuadraticTriangle": "https://www.vtk.org/doc/nightly/html/classvtkBiQuadraticTriangle.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkBooleanOperationPolyDataFilter": {"Cxx": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter"}, "VTKLink": {"vtkBooleanOperationPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkBooleanOperationPolyDataFilter.html#details"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter"}}, "vtkBooleanTexture": {"Cxx": {"TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric"}, "VTKLink": {"vtkBooleanTexture": "https://www.vtk.org/doc/nightly/html/classvtkBooleanTexture.html#details"}, "Python": {"TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric"}}, "vtkBoostBreadthFirstSearch": {"Cxx": {"DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance"}, "VTKLink": {"vtkBoostBreadthFirstSearch": "https://www.vtk.org/doc/nightly/html/classvtkBoostBreadthFirstSearch.html#details"}}, "vtkBoostBreadthFirstSearchTree": {"Cxx": {"BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree"}, "VTKLink": {"vtkBoostBreadthFirstSearchTree": "https://www.vtk.org/doc/nightly/html/classvtkBoostBreadthFirstSearchTree.html#details"}}, "vtkBoostConnectedComponents": {"Cxx": {"ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents"}, "VTKLink": {"vtkBoostConnectedComponents": "https://www.vtk.org/doc/nightly/html/classvtkBoostConnectedComponents.html#details"}}, "vtkBoostPrimMinimumSpanningTree": {"Cxx": {"DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree"}, "VTKLink": {"vtkBoostPrimMinimumSpanningTree": "https://www.vtk.org/doc/nightly/html/classvtkBoostPrimMinimumSpanningTree.html#details"}}, "vtkBorderRepresentation": {"Cxx": {"CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkBorderRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkBorderRepresentation.html#details"}}, "vtkBorderWidget": {"Cxx": {"CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkBorderWidget": "https://www.vtk.org/doc/nightly/html/classvtkBorderWidget.html#details"}}, "vtkBoundedPointSource": {"Cxx": {"MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction"}, "VTKLink": {"vtkBoundedPointSource": "https://www.vtk.org/doc/nightly/html/classvtkBoundedPointSource.html#details"}, "Java": {"FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction"}}, "vtkBoundingBox": {"Cxx": {"BoundingBoxIntersection": "https://examples.vtk.org/site/Cxx/Utilities/BoundingBoxIntersection", "BoundingBox": "https://examples.vtk.org/site/Cxx/Utilities/BoundingBox"}, "VTKLink": {"vtkBoundingBox": "https://www.vtk.org/doc/nightly/html/classvtkBoundingBox.html#details"}}, "vtkBox": {"Cxx": {"ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "Box": "https://examples.vtk.org/site/Cxx/Utilities/Box", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo"}, "VTKLink": {"vtkBox": "https://www.vtk.org/doc/nightly/html/classvtkBox.html#details"}, "Python": {"BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions"}}, "vtkBoxClipDataSet": {"Cxx": {"BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid"}, "VTKLink": {"vtkBoxClipDataSet": "https://www.vtk.org/doc/nightly/html/classvtkBoxClipDataSet.html#details"}}, "vtkBoxMuellerRandomSequence": {"Cxx": {"GaussianRandomNumber": "https://examples.vtk.org/site/Cxx/SimpleOperations/GaussianRandomNumber", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo"}, "VTKLink": {"vtkBoxMuellerRandomSequence": "https://www.vtk.org/doc/nightly/html/classvtkBoxMuellerRandomSequence.html#details"}}, "vtkBoxRepresentation": {"Cxx": {"BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2"}, "VTKLink": {"vtkBoxRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkBoxRepresentation.html#details"}}, "vtkBoxWidget": {"Cxx": {"Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget"}, "VTKLink": {"vtkBoxWidget": "https://www.vtk.org/doc/nightly/html/classvtkBoxWidget.html#details"}, "Java": {"Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget"}}, "vtkBoxWidget2": {"Cxx": {"BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2"}, "VTKLink": {"vtkBoxWidget2": "https://www.vtk.org/doc/nightly/html/classvtkBoxWidget2.html#details"}}, "vtkBrownianPoints": {"Cxx": {"BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints"}, "VTKLink": {"vtkBrownianPoints": "https://www.vtk.org/doc/nightly/html/classvtkBrownianPoints.html#details"}, "Java": {"BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView"}}, "vtkBrush": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot"}, "VTKLink": {"vtkBrush": "https://www.vtk.org/doc/nightly/html/classvtkBrush.html#details"}}, "vtkButtonWidget": {"Cxx": {"TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton"}, "VTKLink": {"vtkButtonWidget": "https://www.vtk.org/doc/nightly/html/classvtkButtonWidget.html#details"}}, "vtkBYUReader": {"Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision"}, "VTKLink": {"vtkBYUReader": "https://www.vtk.org/doc/nightly/html/classvtkBYUReader.html#details"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkCallbackCommand": {"Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA"}, "VTKLink": {"vtkCallbackCommand": "https://www.vtk.org/doc/nightly/html/classvtkCallbackCommand.html#details"}}, "vtkCameraActor": {"Cxx": {"CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor"}, "VTKLink": {"vtkCameraActor": "https://www.vtk.org/doc/nightly/html/classvtkCameraActor.html#details"}, "Java": {"CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor"}}, "vtkCameraInterpolator": {"Cxx": {"InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera"}, "VTKLink": {"vtkCameraInterpolator": "https://www.vtk.org/doc/nightly/html/classvtkCameraInterpolator.html#details"}}, "vtkCameraOrientationWidget": {"Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "CheckVTKVersion": "https://examples.vtk.org/site/Cxx/Utilities/CheckVTKVersion", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkCameraOrientationWidget": "https://www.vtk.org/doc/nightly/html/classvtkCameraOrientationWidget.html#details"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkCameraPass": {"Cxx": {"RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkCameraPass": "https://www.vtk.org/doc/nightly/html/classvtkCameraPass.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkCaptionActor2D": {"Cxx": {"CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes"}, "VTKLink": {"vtkCaptionActor2D": "https://www.vtk.org/doc/nightly/html/classvtkCaptionActor2D.html#details"}}, "vtkCaptionRepresentation": {"Cxx": {"CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget"}, "VTKLink": {"vtkCaptionRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkCaptionRepresentation.html#details"}, "Java": {"CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget"}}, "vtkCaptionWidget": {"Cxx": {"CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget"}, "VTKLink": {"vtkCaptionWidget": "https://www.vtk.org/doc/nightly/html/classvtkCaptionWidget.html#details"}, "Java": {"CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget"}}, "vtkCardinalSpline": {"Cxx": {"ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "CardinalSpline": "https://examples.vtk.org/site/Cxx/Utilities/CardinalSpline", "1DTupleInterpolation": "https://examples.vtk.org/site/Cxx/Math/1DTupleInterpolation"}, "VTKLink": {"vtkCardinalSpline": "https://www.vtk.org/doc/nightly/html/classvtkCardinalSpline.html#details"}}, "vtkCategoryLegend": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid"}, "VTKLink": {"vtkCategoryLegend": "https://www.vtk.org/doc/nightly/html/classvtkCategoryLegend.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid"}}, "vtkCellArrayIterator": {"Cxx": {"ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours"}, "VTKLink": {"vtkCellArrayIterator": "https://www.vtk.org/doc/nightly/html/classvtkCellArrayIterator.html#details"}}, "vtkCellCenters": {"Cxx": {"CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh"}, "VTKLink": {"vtkCellCenters": "https://www.vtk.org/doc/nightly/html/classvtkCellCenters.html#details"}, "Java": {"CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters"}}, "vtkCellData": {"Cxx": {"PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "GetMiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}, "VTKLink": {"vtkCellData": "https://www.vtk.org/doc/nightly/html/classvtkCellData.html#details"}}, "vtkCellIterator": {"Cxx": {"RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}, "VTKLink": {"vtkCellIterator": "https://www.vtk.org/doc/nightly/html/classvtkCellIterator.html#details"}}, "vtkCellLocator": {"Cxx": {"CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "CellLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellLocator", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections"}, "VTKLink": {"vtkCellLocator": "https://www.vtk.org/doc/nightly/html/classvtkCellLocator.html#details"}, "Python": {"LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh"}}, "vtkCellPicker": {"Cxx": {"CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph"}, "VTKLink": {"vtkCellPicker": "https://www.vtk.org/doc/nightly/html/classvtkCellPicker.html#details"}, "Java": {"SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent"}, "Python": {"CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking"}}, "vtkCellTreeLocator": {"Cxx": {"CellTreeLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellTreeLocator"}, "VTKLink": {"vtkCellTreeLocator": "https://www.vtk.org/doc/nightly/html/classvtkCellTreeLocator.html#details"}}, "vtkCellType": {"Cxx": {"UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid"}, "VTKLink": {"vtkCellType": "https://www.vtk.org/doc/nightly/html/classvtkCellType.html#details"}}, "vtkCellTypes": {"Cxx": {"ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "VTKLink": {"vtkCellTypes": "https://www.vtk.org/doc/nightly/html/classvtkCellTypes.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData"}}, "vtkCellTypeSource": {"Cxx": {"CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource"}, "VTKLink": {"vtkCellTypeSource": "https://www.vtk.org/doc/nightly/html/classvtkCellTypeSource.html#details"}, "Python": {"CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource"}}, "vtkCenterOfMass": {"Cxx": {"CenterOfMass": "https://examples.vtk.org/site/Cxx/PolyData/CenterOfMass"}, "VTKLink": {"vtkCenterOfMass": "https://www.vtk.org/doc/nightly/html/classvtkCenterOfMass.html#details"}, "Java": {"CenterOfMass": "https://examples.vtk.org/site/Java/PolyData/CenterOfMass"}}, "vtkCharArray": {"Cxx": {"AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot"}, "VTKLink": {"vtkCharArray": "https://www.vtk.org/doc/nightly/html/classvtkCharArray.html#details"}}, "vtkChart": {"Cxx": {"MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkChart": "https://www.vtk.org/doc/nightly/html/classvtkChart.html#details"}, "Python": {"ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkChartBox": {"Cxx": {"BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart"}, "VTKLink": {"vtkChartBox": "https://www.vtk.org/doc/nightly/html/classvtkChartBox.html#details"}}, "vtkChartHistogram2D": {"Cxx": {"Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D"}, "VTKLink": {"vtkChartHistogram2D": "https://www.vtk.org/doc/nightly/html/classvtkChartHistogram2D.html#details"}}, "vtkChartLegend": {"Cxx": {"FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar"}, "VTKLink": {"vtkChartLegend": "https://www.vtk.org/doc/nightly/html/classvtkChartLegend.html#details"}}, "vtkChartMatrix": {"Cxx": {"ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix"}, "VTKLink": {"vtkChartMatrix": "https://www.vtk.org/doc/nightly/html/classvtkChartMatrix.html#details"}}, "vtkChartParallelCoordinates": {"Cxx": {"ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates"}, "VTKLink": {"vtkChartParallelCoordinates": "https://www.vtk.org/doc/nightly/html/classvtkChartParallelCoordinates.html#details"}}, "vtkChartPie": {"Cxx": {"PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart"}, "VTKLink": {"vtkChartPie": "https://www.vtk.org/doc/nightly/html/classvtkChartPie.html#details"}}, "vtkChartXY": {"Cxx": {"FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkChartXY": "https://www.vtk.org/doc/nightly/html/classvtkChartXY.html#details"}, "Python": {"ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkChartXYZ": {"Cxx": {"SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D"}, "VTKLink": {"vtkChartXYZ": "https://www.vtk.org/doc/nightly/html/classvtkChartXYZ.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkCheckerboardRepresentation": {"Cxx": {"CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget"}, "VTKLink": {"vtkCheckerboardRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkCheckerboardRepresentation.html#details"}}, "vtkCheckerboardWidget": {"Cxx": {"CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget"}, "VTKLink": {"vtkCheckerboardWidget": "https://www.vtk.org/doc/nightly/html/classvtkCheckerboardWidget.html#details"}}, "vtkCircularLayoutStrategy": {"Cxx": {"LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges"}, "VTKLink": {"vtkCircularLayoutStrategy": "https://www.vtk.org/doc/nightly/html/classvtkCircularLayoutStrategy.html#details"}, "Python": {"LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges"}}, "vtkClipClosedSurface": {"Cxx": {"ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface"}, "VTKLink": {"vtkClipClosedSurface": "https://www.vtk.org/doc/nightly/html/classvtkClipClosedSurface.html#details"}}, "vtkClipDataSet": {"Cxx": {"ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData"}, "VTKLink": {"vtkClipDataSet": "https://www.vtk.org/doc/nightly/html/classvtkClipDataSet.html#details"}, "Python": {"ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkClipVolume": {"Cxx": {"ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume"}, "VTKLink": {"vtkClipVolume": "https://www.vtk.org/doc/nightly/html/classvtkClipVolume.html#details"}}, "vtkCMLMoleculeReader": {"Cxx": {"ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML"}, "VTKLink": {"vtkCMLMoleculeReader": "https://www.vtk.org/doc/nightly/html/classvtkCMLMoleculeReader.html#details"}, "Java": {"ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML"}}, "vtkCollisionDetectionFilter": {"Cxx": {"CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection"}, "VTKLink": {"vtkCollisionDetectionFilter": "https://www.vtk.org/doc/nightly/html/classvtkCollisionDetectionFilter.html#details"}, "Python": {"CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection"}}, "vtkColor": {"Cxx": {"GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "VTKLink": {"vtkColor": "https://www.vtk.org/doc/nightly/html/classvtkColor.html#details"}}, "vtkColor3d": {"Cxx": {"OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "VTKLink": {"vtkColor3d": "https://www.vtk.org/doc/nightly/html/classvtkColor3d.html#details"}}, "vtkColor3ub": {"Cxx": {"Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "ColorSeriesPatches": "https://examples.vtk.org/site/Cxx/Visualization/ColorSeriesPatches", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "NamedColorPatches": "https://examples.vtk.org/site/Cxx/Visualization/NamedColorPatches", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData"}, "VTKLink": {"vtkColor3ub": "https://www.vtk.org/doc/nightly/html/classvtkColor3ub.html#details"}, "Python": {"PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision"}}, "vtkColor4ub": {"Cxx": {"Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D"}, "VTKLink": {"vtkColor4ub": "https://www.vtk.org/doc/nightly/html/classvtkColor4ub.html#details"}}, "vtkColorLegend": {"Cxx": {"Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D"}, "VTKLink": {"vtkColorLegend": "https://www.vtk.org/doc/nightly/html/classvtkColorLegend.html#details"}}, "vtkColorSeries": {"Cxx": {"MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "LUTUtilities": "https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ColorSeriesPatches": "https://examples.vtk.org/site/Cxx/Visualization/ColorSeriesPatches", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData"}, "VTKLink": {"vtkColorSeries": "https://www.vtk.org/doc/nightly/html/classvtkColorSeries.html#details"}, "Java": {"ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries"}, "Python": {"Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "LUTUtilities": "https://examples.vtk.org/site/Python/Utilities/LUTUtilities", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ColorSeriesPatches": "https://examples.vtk.org/site/Python/Visualization/ColorSeriesPatches", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource"}}, "vtkColorTransferFunction": {"Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ColorTransferFunction": "https://examples.vtk.org/site/Cxx/Utilities/ColorTransferFunction", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "VTKLink": {"vtkColorTransferFunction": "https://www.vtk.org/doc/nightly/html/classvtkColorTransferFunction.html#details"}, "Java": {"SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkCommand": {"Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "ObserveError": "https://examples.vtk.org/site/Cxx/Utilities/ObserveError", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkCommand": "https://www.vtk.org/doc/nightly/html/classvtkCommand.html#details"}, "Python": {"SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkCompassRepresentation": {"Cxx": {"CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget"}, "VTKLink": {"vtkCompassRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkCompassRepresentation.html#details"}, "Java": {"CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget"}, "Python": {"CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget"}}, "vtkCompassWidget": {"Cxx": {"CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget"}, "VTKLink": {"vtkCompassWidget": "https://www.vtk.org/doc/nightly/html/classvtkCompassWidget.html#details"}, "Java": {"CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget"}, "Python": {"CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget"}}, "vtkCompositeDataDisplayAttributes": {"Cxx": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper"}, "VTKLink": {"vtkCompositeDataDisplayAttributes": "https://www.vtk.org/doc/nightly/html/classvtkCompositeDataDisplayAttributes.html#details"}, "Java": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper"}, "Python": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper"}}, "vtkCompositeDataGeometryFilter": {"Cxx": {"MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "VTKLink": {"vtkCompositeDataGeometryFilter": "https://www.vtk.org/doc/nightly/html/classvtkCompositeDataGeometryFilter.html#details"}, "Python": {"MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData"}}, "vtkCompositeDataSet": {"Cxx": {"ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene"}, "VTKLink": {"vtkCompositeDataSet": "https://www.vtk.org/doc/nightly/html/classvtkCompositeDataSet.html#details"}}, "vtkCompositeDataWriter": {"Cxx": {"Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse"}, "VTKLink": {"vtkCompositeDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkCompositeDataWriter.html#details"}}, "vtkCompositePolyDataMapper": {"Cxx": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper"}, "VTKLink": {"vtkCompositePolyDataMapper": "https://www.vtk.org/doc/nightly/html/classvtkCompositePolyDataMapper.html#details"}, "Python": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper"}}, "vtkCompositePolyDataMapper2": {"Cxx": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper"}, "VTKLink": {"vtkCompositePolyDataMapper2": "https://www.vtk.org/doc/nightly/html/classvtkCompositePolyDataMapper2.html#details"}, "Java": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper"}}, "vtkComputeQuartiles": {"Cxx": {"BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart"}, "VTKLink": {"vtkComputeQuartiles": "https://www.vtk.org/doc/nightly/html/classvtkComputeQuartiles.html#details"}}, "vtkCone": {"Cxx": {"IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkCone": "https://www.vtk.org/doc/nightly/html/classvtkCone.html#details"}, "Java": {"IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe"}, "Python": {"IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream"}}, "vtkConnectivityFilter": {"Cxx": {"RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}, "VTKLink": {"vtkConnectivityFilter": "https://www.vtk.org/doc/nightly/html/classvtkConnectivityFilter.html#details"}, "Python": {"ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow"}}, "vtkContext2D": {"Cxx": {"Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram"}, "VTKLink": {"vtkContext2D": "https://www.vtk.org/doc/nightly/html/classvtkContext2D.html#details"}}, "vtkContext3D": {"Cxx": {"PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D"}, "VTKLink": {"vtkContext3D": "https://www.vtk.org/doc/nightly/html/classvtkContext3D.html#details"}}, "vtkContextActor": {"Cxx": {"Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene"}, "VTKLink": {"vtkContextActor": "https://www.vtk.org/doc/nightly/html/classvtkContextActor.html#details"}, "Python": {"MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkContextItem": {"Cxx": {"Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram"}, "VTKLink": {"vtkContextItem": "https://www.vtk.org/doc/nightly/html/classvtkContextItem.html#details"}}, "vtkContextMouseEvent": {"Cxx": {"SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkContextMouseEvent": "https://www.vtk.org/doc/nightly/html/classvtkContextMouseEvent.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkContextScene": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D"}, "VTKLink": {"vtkContextScene": "https://www.vtk.org/doc/nightly/html/classvtkContextScene.html#details"}, "Python": {"MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkContextTransform": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid"}, "VTKLink": {"vtkContextTransform": "https://www.vtk.org/doc/nightly/html/classvtkContextTransform.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid"}}, "vtkContextView": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkContextView": "https://www.vtk.org/doc/nightly/html/classvtkContextView.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkContourRepresentation": {"Cxx": {"PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer"}, "VTKLink": {"vtkContourRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkContourRepresentation.html#details"}}, "vtkContourTriangulator": {"Cxx": {"ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator"}, "VTKLink": {"vtkContourTriangulator": "https://www.vtk.org/doc/nightly/html/classvtkContourTriangulator.html#details"}, "Python": {"ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator"}}, "vtkContourValues": {"Cxx": {"RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface"}, "VTKLink": {"vtkContourValues": "https://www.vtk.org/doc/nightly/html/classvtkContourValues.html#details"}}, "vtkConvexPointSet": {"Cxx": {"ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet"}, "VTKLink": {"vtkConvexPointSet": "https://www.vtk.org/doc/nightly/html/classvtkConvexPointSet.html#details"}, "Java": {"ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet"}, "Python": {"ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet"}}, "vtkCoordinate": {"Cxx": {"MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "Coordinate": "https://examples.vtk.org/site/Cxx/Utilities/Coordinate", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "VTKLink": {"vtkCoordinate": "https://www.vtk.org/doc/nightly/html/classvtkCoordinate.html#details"}, "Java": {"MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText"}, "Python": {"MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkCornerAnnotation": {"Cxx": {"PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation"}, "VTKLink": {"vtkCornerAnnotation": "https://www.vtk.org/doc/nightly/html/classvtkCornerAnnotation.html#details"}, "Java": {"CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation"}}, "vtkCubeAxesActor": {"Cxx": {"DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor"}, "VTKLink": {"vtkCubeAxesActor": "https://www.vtk.org/doc/nightly/html/classvtkCubeAxesActor.html#details"}, "Java": {"CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor"}, "Python": {"CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor"}}, "vtkCubeAxesActor2D": {"Cxx": {"CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D"}, "VTKLink": {"vtkCubeAxesActor2D": "https://www.vtk.org/doc/nightly/html/classvtkCubeAxesActor2D.html#details"}, "Java": {"CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D"}}, "vtkCubicLine": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkCubicLine": "https://www.vtk.org/doc/nightly/html/classvtkCubicLine.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkCullerCollection": {"Cxx": {"LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink"}, "VTKLink": {"vtkCullerCollection": "https://www.vtk.org/doc/nightly/html/classvtkCullerCollection.html#details"}}, "vtkCursor2D": {"Cxx": {"Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D"}, "VTKLink": {"vtkCursor2D": "https://www.vtk.org/doc/nightly/html/classvtkCursor2D.html#details"}, "Java": {"Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D"}}, "vtkCursor3D": {"Cxx": {"Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D"}, "VTKLink": {"vtkCursor3D": "https://www.vtk.org/doc/nightly/html/classvtkCursor3D.html#details"}, "Java": {"Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D"}}, "vtkCylinder": {"Cxx": {"ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkCylinder": "https://www.vtk.org/doc/nightly/html/classvtkCylinder.html#details"}, "Python": {"ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling"}}, "vtkDataArray": {"Cxx": {"PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents", "ForLoop": "https://examples.vtk.org/site/Cxx/Utilities/ForLoop", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game"}, "VTKLink": {"vtkDataArray": "https://www.vtk.org/doc/nightly/html/classvtkDataArray.html#details"}}, "vtkDataObjectReader": {"Cxx": {"FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkDataObjectReader": "https://www.vtk.org/doc/nightly/html/classvtkDataObjectReader.html#details"}, "Python": {"FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkDataObjectToDataSetFilter": {"Cxx": {"FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkDataObjectToDataSetFilter": "https://www.vtk.org/doc/nightly/html/classvtkDataObjectToDataSetFilter.html#details"}, "Python": {"FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkDataObjectTree": {"Cxx": {"ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene"}, "VTKLink": {"vtkDataObjectTree": "https://www.vtk.org/doc/nightly/html/classvtkDataObjectTree.html#details"}}, "vtkDataObjectTreeIterator": {"Cxx": {"ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene"}, "VTKLink": {"vtkDataObjectTreeIterator": "https://www.vtk.org/doc/nightly/html/classvtkDataObjectTreeIterator.html#details"}}, "vtkDataSetCollection": {"Cxx": {"KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints", "KdTree": "https://examples.vtk.org/site/Cxx/DataStructures/KdTree"}, "VTKLink": {"vtkDataSetCollection": "https://www.vtk.org/doc/nightly/html/classvtkDataSetCollection.html#details"}}, "vtkDataSetReader": {"Cxx": {"RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow"}, "VTKLink": {"vtkDataSetReader": "https://www.vtk.org/doc/nightly/html/classvtkDataSetReader.html#details"}, "Python": {"Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow"}}, "vtkDataSetTriangleFilter": {"Cxx": {"IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid"}, "VTKLink": {"vtkDataSetTriangleFilter": "https://www.vtk.org/doc/nightly/html/classvtkDataSetTriangleFilter.html#details"}}, "vtkDataSetWriter": {"Cxx": {"ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping"}, "VTKLink": {"vtkDataSetWriter": "https://www.vtk.org/doc/nightly/html/classvtkDataSetWriter.html#details"}}, "vtkDecimatePolylineFilter": {"Cxx": {"DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline"}, "VTKLink": {"vtkDecimatePolylineFilter": "https://www.vtk.org/doc/nightly/html/classvtkDecimatePolylineFilter.html#details"}}, "vtkDeformPointSet": {"Cxx": {"DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet"}, "VTKLink": {"vtkDeformPointSet": "https://www.vtk.org/doc/nightly/html/classvtkDeformPointSet.html#details"}, "Python": {"DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet"}}, "vtkDelaunay3D": {"Cxx": {"PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPUnstructuredGridWriter", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D"}, "VTKLink": {"vtkDelaunay3D": "https://www.vtk.org/doc/nightly/html/classvtkDelaunay3D.html#details"}, "Java": {"XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLPUnstructuredGridWriter"}, "Python": {"ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter"}}, "vtkDelimitedTextReader": {"Cxx": {"DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator"}, "VTKLink": {"vtkDelimitedTextReader": "https://www.vtk.org/doc/nightly/html/classvtkDelimitedTextReader.html#details"}, "Python": {"CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkDelimitedTextWriter": {"Cxx": {"DelimitedTextWriter": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter"}, "VTKLink": {"vtkDelimitedTextWriter": "https://www.vtk.org/doc/nightly/html/classvtkDelimitedTextWriter.html#details"}}, "vtkDemandDrivenPipeline": {"Cxx": {"vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter"}, "VTKLink": {"vtkDemandDrivenPipeline": "https://www.vtk.org/doc/nightly/html/classvtkDemandDrivenPipeline.html#details"}}, "vtkDenseArray": {"Cxx": {"ArrayToTable": "https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable", "AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable", "3DArray": "https://examples.vtk.org/site/Cxx/Utilities/3DArray", "ArrayWriter": "https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter", "CustomDenseArray": "https://examples.vtk.org/site/Cxx/Utilities/CustomDenseArray", "2DArray": "https://examples.vtk.org/site/Cxx/Utilities/2DArray", "DenseArrayRange": "https://examples.vtk.org/site/Cxx/Utilities/DenseArrayRange"}, "VTKLink": {"vtkDenseArray": "https://www.vtk.org/doc/nightly/html/classvtkDenseArray.html#details"}}, "vtkDensifyPointCloudFilter": {"Cxx": {"DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints"}, "VTKLink": {"vtkDensifyPointCloudFilter": "https://www.vtk.org/doc/nightly/html/classvtkDensifyPointCloudFilter.html#details"}}, "vtkDepthSortPolyData": {"Cxx": {"DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry"}, "VTKLink": {"vtkDepthSortPolyData": "https://www.vtk.org/doc/nightly/html/classvtkDepthSortPolyData.html#details"}}, "vtkDirectedGraph": {"Cxx": {"MutableDirectedGraphToDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/MutableDirectedGraphToDirectedGraph", "DirectedGraphToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/DirectedGraphToMutableDirectedGraph"}, "VTKLink": {"vtkDirectedGraph": "https://www.vtk.org/doc/nightly/html/classvtkDirectedGraph.html#details"}}, "vtkDirectory": {"Cxx": {"FilenameFunctions": "https://examples.vtk.org/site/Cxx/Utilities/FilenameFunctions"}, "VTKLink": {"vtkDirectory": "https://www.vtk.org/doc/nightly/html/classvtkDirectory.html#details"}}, "vtkDiscreteFlyingEdges3D": {"Cxx": {"DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels"}, "VTKLink": {"vtkDiscreteFlyingEdges3D": "https://www.vtk.org/doc/nightly/html/classvtkDiscreteFlyingEdges3D.html#details"}, "Python": {"MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkDiscreteMarchingCubes": {"Cxx": {"SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels"}, "VTKLink": {"vtkDiscreteMarchingCubes": "https://www.vtk.org/doc/nightly/html/classvtkDiscreteMarchingCubes.html#details"}, "Python": {"MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkDiscretizableColorTransferFunction": {"Cxx": {"DiscretizableColorTransferFunction": "https://examples.vtk.org/site/Cxx/Utilities/DiscretizableColorTransferFunction", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader"}, "VTKLink": {"vtkDiscretizableColorTransferFunction": "https://www.vtk.org/doc/nightly/html/classvtkDiscretizableColorTransferFunction.html#details"}, "Java": {"DiscretizableColorTransferFunction": "https://examples.vtk.org/site/Java/Utilities/DiscretizableColorTransferFunction"}, "Python": {"ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader"}}, "vtkDistancePolyDataFilter": {"Cxx": {"DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter"}, "VTKLink": {"vtkDistancePolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkDistancePolyDataFilter.html#details"}}, "vtkDistanceRepresentation": {"Cxx": {"DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget"}, "VTKLink": {"vtkDistanceRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkDistanceRepresentation.html#details"}}, "vtkDistanceToCamera": {"Cxx": {"DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera"}, "VTKLink": {"vtkDistanceToCamera": "https://www.vtk.org/doc/nightly/html/classvtkDistanceToCamera.html#details"}, "Java": {"DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera"}}, "vtkDistanceWidget": {"Cxx": {"DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget"}, "VTKLink": {"vtkDistanceWidget": "https://www.vtk.org/doc/nightly/html/classvtkDistanceWidget.html#details"}, "Java": {"DistanceWidget": "https://examples.vtk.org/site/Java/Widgets/DistanceWidget"}}, "vtkEdgeListIterator": {"Cxx": {"EdgeListIterator": "https://examples.vtk.org/site/Cxx/Graphs/EdgeListIterator"}, "VTKLink": {"vtkEdgeListIterator": "https://www.vtk.org/doc/nightly/html/classvtkEdgeListIterator.html#details"}}, "vtkEdgePoints": {"Cxx": {"EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints"}, "VTKLink": {"vtkEdgePoints": "https://www.vtk.org/doc/nightly/html/classvtkEdgePoints.html#details"}}, "vtkEllipticalButtonSource": {"Cxx": {"EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton"}, "VTKLink": {"vtkEllipticalButtonSource": "https://www.vtk.org/doc/nightly/html/classvtkEllipticalButtonSource.html#details"}}, "vtkEuclideanClusterExtraction": {"Cxx": {"ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters"}, "VTKLink": {"vtkEuclideanClusterExtraction": "https://www.vtk.org/doc/nightly/html/classvtkEuclideanClusterExtraction.html#details"}}, "vtkEventQtSlotConnect": {"Cxx": {"EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect"}, "VTKLink": {"vtkEventQtSlotConnect": "https://www.vtk.org/doc/nightly/html/classvtkEventQtSlotConnect.html#details"}}, "vtkExecutive": {"Cxx": {"ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "VTKLink": {"vtkExecutive": "https://www.vtk.org/doc/nightly/html/classvtkExecutive.html#details"}}, "vtkExodusIIReader": {"Cxx": {"ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "VTKLink": {"vtkExodusIIReader": "https://www.vtk.org/doc/nightly/html/classvtkExodusIIReader.html#details"}, "Python": {"ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData"}}, "vtkExodusIIWriter": {"Cxx": {"ExodusIIWriter": "https://examples.vtk.org/site/Cxx/Parallel/ExodusIIWriter"}, "VTKLink": {"vtkExodusIIWriter": "https://www.vtk.org/doc/nightly/html/classvtkExodusIIWriter.html#details"}, "Java": {"ExodusIIWriter": "https://examples.vtk.org/site/Java/Parallel/ExodusIIWriter"}}, "vtkExplicitStructuredGrid": {"Cxx": {"CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid"}, "VTKLink": {"vtkExplicitStructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkExplicitStructuredGrid.html#details"}, "Python": {"CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid"}}, "vtkExplicitStructuredGridToUnstructuredGrid": {"Cxx": {"CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid"}, "VTKLink": {"vtkExplicitStructuredGridToUnstructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkExplicitStructuredGridToUnstructuredGrid.html#details"}, "Python": {"CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid"}}, "vtkExtractCells": {"Cxx": {"ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells"}, "VTKLink": {"vtkExtractCells": "https://www.vtk.org/doc/nightly/html/classvtkExtractCells.html#details"}}, "vtkExtractEnclosedPoints": {"Cxx": {"OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints"}, "VTKLink": {"vtkExtractEnclosedPoints": "https://www.vtk.org/doc/nightly/html/classvtkExtractEnclosedPoints.html#details"}}, "vtkExtractGeometry": {"Cxx": {"HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData"}, "VTKLink": {"vtkExtractGeometry": "https://www.vtk.org/doc/nightly/html/classvtkExtractGeometry.html#details"}, "Python": {"ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData"}}, "vtkExtractGrid": {"Cxx": {"PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering"}, "VTKLink": {"vtkExtractGrid": "https://www.vtk.org/doc/nightly/html/classvtkExtractGrid.html#details"}, "Python": {"PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering"}}, "vtkExtractPoints": {"Cxx": {"ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkExtractPoints": "https://www.vtk.org/doc/nightly/html/classvtkExtractPoints.html#details"}}, "vtkExtractPolyDataGeometry": {"Cxx": {"HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection"}, "VTKLink": {"vtkExtractPolyDataGeometry": "https://www.vtk.org/doc/nightly/html/classvtkExtractPolyDataGeometry.html#details"}}, "vtkExtractSurface": {"Cxx": {"ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface"}, "VTKLink": {"vtkExtractSurface": "https://www.vtk.org/doc/nightly/html/classvtkExtractSurface.html#details"}}, "vtkExtractVOI": {"Cxx": {"ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization"}, "VTKLink": {"vtkExtractVOI": "https://www.vtk.org/doc/nightly/html/classvtkExtractVOI.html#details"}, "Java": {"ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC"}, "Python": {"HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor"}}, "vtkFastSplatter": {"Cxx": {"FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter"}, "VTKLink": {"vtkFastSplatter": "https://www.vtk.org/doc/nightly/html/classvtkFastSplatter.html#details"}}, "vtkFFMPEGWriter": {"Cxx": {"FFMPEG": "https://examples.vtk.org/site/Cxx/Video/FFMPEG"}, "VTKLink": {"vtkFFMPEGWriter": "https://www.vtk.org/doc/nightly/html/classvtkFFMPEGWriter.html#details"}}, "vtkFieldDataToAttributeDataFilter": {"Cxx": {"Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkFieldDataToAttributeDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkFieldDataToAttributeDataFilter.html#details"}, "Python": {"FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkFileOutputWindow": {"Cxx": {"FileOutputWindow": "https://examples.vtk.org/site/Cxx/Utilities/FileOutputWindow"}, "VTKLink": {"vtkFileOutputWindow": "https://www.vtk.org/doc/nightly/html/classvtkFileOutputWindow.html#details"}}, "vtkFitImplicitFunction": {"Cxx": {"FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction"}, "VTKLink": {"vtkFitImplicitFunction": "https://www.vtk.org/doc/nightly/html/classvtkFitImplicitFunction.html#details"}, "Java": {"FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction"}}, "vtkFitToHeightMapFilter": {"Cxx": {"FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "VTKLink": {"vtkFitToHeightMapFilter": "https://www.vtk.org/doc/nightly/html/classvtkFitToHeightMapFilter.html#details"}}, "vtkFixedPointVolumeRayCastMapper": {"Cxx": {"FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "VTKLink": {"vtkFixedPointVolumeRayCastMapper": "https://www.vtk.org/doc/nightly/html/classvtkFixedPointVolumeRayCastMapper.html#details"}, "Java": {"SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkFloatingPointExceptions": {"Cxx": {"FloatingPointExceptions": "https://examples.vtk.org/site/Cxx/SimpleOperations/FloatingPointExceptions"}, "VTKLink": {"vtkFloatingPointExceptions": "https://www.vtk.org/doc/nightly/html/classvtkFloatingPointExceptions.html#details"}}, "vtkFlyingEdges2D": {"Cxx": {"FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice"}, "VTKLink": {"vtkFlyingEdges2D": "https://www.vtk.org/doc/nightly/html/classvtkFlyingEdges2D.html#details"}, "Python": {"FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice"}}, "vtkFlyingEdges3D": {"Cxx": {"HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "VTKLink": {"vtkFlyingEdges3D": "https://www.vtk.org/doc/nightly/html/classvtkFlyingEdges3D.html#details"}, "Python": {"HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkFollower": {"Cxx": {"TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkFollower": "https://www.vtk.org/doc/nightly/html/classvtkFollower.html#details"}, "Java": {"TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower"}, "Python": {"TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkForceDirectedLayoutStrategy": {"Cxx": {"EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices"}, "VTKLink": {"vtkForceDirectedLayoutStrategy": "https://www.vtk.org/doc/nightly/html/classvtkForceDirectedLayoutStrategy.html#details"}, "Python": {"ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "RandomGraphSource": "https://examples.vtk.org/site/Python/Graphs/RandomGraphSource", "EdgeWeights": "https://examples.vtk.org/site/Python/Graphs/EdgeWeights", "ConstructGraph": "https://examples.vtk.org/site/Python/Graphs/ConstructGraph"}}, "vtkFreeTypeTools": {"Cxx": {"WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "VTKLink": {"vtkFreeTypeTools": "https://www.vtk.org/doc/nightly/html/classvtkFreeTypeTools.html#details"}}, "vtkFunctionParser": {"Cxx": {"FunctionParser": "https://examples.vtk.org/site/Cxx/Utilities/FunctionParser"}, "VTKLink": {"vtkFunctionParser": "https://www.vtk.org/doc/nightly/html/classvtkFunctionParser.html#details"}, "Java": {"FunctionParser": "https://examples.vtk.org/site/Java/Utilities/FunctionParser"}}, "vtkGaussianKernel": {"Cxx": {"InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator"}, "VTKLink": {"vtkGaussianKernel": "https://www.vtk.org/doc/nightly/html/classvtkGaussianKernel.html#details"}, "Python": {"PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkGaussianSplatter": {"Cxx": {"EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkGaussianSplatter": "https://www.vtk.org/doc/nightly/html/classvtkGaussianSplatter.html#details"}, "Python": {"GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkGenericCell": {"Cxx": {"RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "CellTreeLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellTreeLocator", "ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}, "VTKLink": {"vtkGenericCell": "https://www.vtk.org/doc/nightly/html/classvtkGenericCell.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo"}}, "vtkGenericClip": {"Cxx": {"GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip"}, "VTKLink": {"vtkGenericClip": "https://www.vtk.org/doc/nightly/html/classvtkGenericClip.html#details"}}, "vtkGenericDataArray": {"Cxx": {"ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter"}, "VTKLink": {"vtkGenericDataArray": "https://www.vtk.org/doc/nightly/html/classvtkGenericDataArray.html#details"}}, "vtkGenericDataObjectReader": {"Cxx": {"GenericDataObjectReader": "https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader"}, "VTKLink": {"vtkGenericDataObjectReader": "https://www.vtk.org/doc/nightly/html/classvtkGenericDataObjectReader.html#details"}}, "vtkGenericOpenGLRenderWindow": {"Cxx": {"ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect"}, "VTKLink": {"vtkGenericOpenGLRenderWindow": "https://www.vtk.org/doc/nightly/html/classvtkGenericOpenGLRenderWindow.html#details"}}, "vtkGenericOutlineFilter": {"Cxx": {"FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow"}, "VTKLink": {"vtkGenericOutlineFilter": "https://www.vtk.org/doc/nightly/html/classvtkGenericOutlineFilter.html#details"}}, "vtkGeometryFilter": {"Cxx": {"GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData"}, "VTKLink": {"vtkGeometryFilter": "https://www.vtk.org/doc/nightly/html/classvtkGeometryFilter.html#details"}, "Python": {"Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels"}}, "vtkGLTFExporter": {"Cxx": {"GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtkGLTFExporter": "https://www.vtk.org/doc/nightly/html/classvtkGLTFExporter.html#details"}}, "vtkGLTFImporter": {"Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtkGLTFImporter": "https://www.vtk.org/doc/nightly/html/classvtkGLTFImporter.html#details"}}, "vtkGlyph2D": {"Cxx": {"Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField"}, "VTKLink": {"vtkGlyph2D": "https://www.vtk.org/doc/nightly/html/classvtkGlyph2D.html#details"}, "Java": {"Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D"}, "Python": {"Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D"}}, "vtkGlyph3DMapper": {"Cxx": {"PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints"}, "VTKLink": {"vtkGlyph3DMapper": "https://www.vtk.org/doc/nightly/html/classvtkGlyph3DMapper.html#details"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet"}, "Python": {"AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera"}}, "vtkGlyphSource2D": {"Cxx": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph"}, "VTKLink": {"vtkGlyphSource2D": "https://www.vtk.org/doc/nightly/html/classvtkGlyphSource2D.html#details"}, "Python": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph"}}, "vtkGradientFilter": {"Cxx": {"GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter"}, "VTKLink": {"vtkGradientFilter": "https://www.vtk.org/doc/nightly/html/classvtkGradientFilter.html#details"}}, "vtkGraph": {"Cxx": {"GraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmSource", "GraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents"}, "VTKLink": {"vtkGraph": "https://www.vtk.org/doc/nightly/html/classvtkGraph.html#details"}}, "vtkGraphAlgorithm": {"Cxx": {"vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter"}, "VTKLink": {"vtkGraphAlgorithm": "https://www.vtk.org/doc/nightly/html/classvtkGraphAlgorithm.html#details"}}, "vtkGraphicsFactory": {"Cxx": {"OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering"}, "VTKLink": {"vtkGraphicsFactory": "https://www.vtk.org/doc/nightly/html/classvtkGraphicsFactory.html#details"}}, "vtkGraphLayout": {"Cxx": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph"}, "VTKLink": {"vtkGraphLayout": "https://www.vtk.org/doc/nightly/html/classvtkGraphLayout.html#details"}, "Python": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph"}}, "vtkGraphLayoutStrategy": {"Cxx": {"XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader"}, "VTKLink": {"vtkGraphLayoutStrategy": "https://www.vtk.org/doc/nightly/html/classvtkGraphLayoutStrategy.html#details"}}, "vtkGraphToGlyphs": {"Cxx": {"ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize"}, "VTKLink": {"vtkGraphToGlyphs": "https://www.vtk.org/doc/nightly/html/classvtkGraphToGlyphs.html#details"}, "Python": {"ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices"}}, "vtkGraphToPolyData": {"Cxx": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath"}, "VTKLink": {"vtkGraphToPolyData": "https://www.vtk.org/doc/nightly/html/classvtkGraphToPolyData.html#details"}, "Python": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData"}}, "vtkHardwareSelector": {"Cxx": {"ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells"}, "VTKLink": {"vtkHardwareSelector": "https://www.vtk.org/doc/nightly/html/classvtkHardwareSelector.html#details"}, "Python": {"HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector"}}, "vtkHausdorffDistancePointSetFilter": {"Cxx": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas"}, "VTKLink": {"vtkHausdorffDistancePointSetFilter": "https://www.vtk.org/doc/nightly/html/classvtkHausdorffDistancePointSetFilter.html#details"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas"}}, "vtkHDFReader": {"Cxx": {"TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader"}, "VTKLink": {"vtkHDFReader": "https://www.vtk.org/doc/nightly/html/classvtkHDFReader.html#details"}, "Python": {"TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader"}}, "vtkHDRReader": {"Cxx": {"HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkHDRReader": "https://www.vtk.org/doc/nightly/html/classvtkHDRReader.html#details"}, "Python": {"HDRReader": "https://examples.vtk.org/site/Python/IO/HDRReader", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}}, "vtkHedgeHog": {"Cxx": {"SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV"}, "VTKLink": {"vtkHedgeHog": "https://www.vtk.org/doc/nightly/html/classvtkHedgeHog.html#details"}, "Java": {"ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV"}, "Python": {"SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV"}}, "vtkHexagonalPrism": {"Cxx": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration"}, "VTKLink": {"vtkHexagonalPrism": "https://www.vtk.org/doc/nightly/html/classvtkHexagonalPrism.html#details"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration"}}, "vtkHoverWidget": {"Cxx": {"HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget"}, "VTKLink": {"vtkHoverWidget": "https://www.vtk.org/doc/nightly/html/classvtkHoverWidget.html#details"}}, "vtkHull": {"Cxx": {"ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes"}, "VTKLink": {"vtkHull": "https://www.vtk.org/doc/nightly/html/classvtkHull.html#details"}, "Python": {"Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes"}}, "vtkHyperStreamline": {"Cxx": {"HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline"}, "VTKLink": {"vtkHyperStreamline": "https://www.vtk.org/doc/nightly/html/classvtkHyperStreamline.html#details"}, "Python": {"HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline"}}, "vtkHyperTreeGridSource": {"Cxx": {"HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource"}, "VTKLink": {"vtkHyperTreeGridSource": "https://www.vtk.org/doc/nightly/html/classvtkHyperTreeGridSource.html#details"}, "Java": {"HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource"}, "Python": {"HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource"}}, "vtkHyperTreeGridToUnstructuredGrid": {"Cxx": {"HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource"}, "VTKLink": {"vtkHyperTreeGridToUnstructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkHyperTreeGridToUnstructuredGrid.html#details"}, "Python": {"HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource"}}, "vtkIdFilter": {"Cxx": {"PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh"}, "VTKLink": {"vtkIdFilter": "https://www.vtk.org/doc/nightly/html/classvtkIdFilter.html#details"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkImageAccumulate": {"Cxx": {"ImageAccumulate": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulate", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels"}, "VTKLink": {"vtkImageAccumulate": "https://www.vtk.org/doc/nightly/html/classvtkImageAccumulate.html#details"}, "Python": {"GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkImageAlgorithm": {"Cxx": {"vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter"}, "VTKLink": {"vtkImageAlgorithm": "https://www.vtk.org/doc/nightly/html/classvtkImageAlgorithm.html#details"}}, "vtkImageAnisotropicDiffusion2D": {"Cxx": {"ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D"}, "VTKLink": {"vtkImageAnisotropicDiffusion2D": "https://www.vtk.org/doc/nightly/html/classvtkImageAnisotropicDiffusion2D.html#details"}}, "vtkImageAppendComponents": {"Cxx": {"WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels"}, "VTKLink": {"vtkImageAppendComponents": "https://www.vtk.org/doc/nightly/html/classvtkImageAppendComponents.html#details"}}, "vtkImageBlend": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "VTKLink": {"vtkImageBlend": "https://www.vtk.org/doc/nightly/html/classvtkImageBlend.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform"}}, "vtkImageButterworthHighPass": {"Cxx": {"IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass"}, "VTKLink": {"vtkImageButterworthHighPass": "https://www.vtk.org/doc/nightly/html/classvtkImageButterworthHighPass.html#details"}, "Python": {"IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass"}}, "vtkImageChangeInformation": {"Cxx": {"CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify"}, "VTKLink": {"vtkImageChangeInformation": "https://www.vtk.org/doc/nightly/html/classvtkImageChangeInformation.html#details"}}, "vtkImageCheckerboard": {"Cxx": {"ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget"}, "VTKLink": {"vtkImageCheckerboard": "https://www.vtk.org/doc/nightly/html/classvtkImageCheckerboard.html#details"}}, "vtkImageCityBlockDistance": {"Cxx": {"ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance"}, "VTKLink": {"vtkImageCityBlockDistance": "https://www.vtk.org/doc/nightly/html/classvtkImageCityBlockDistance.html#details"}}, "vtkImageClip": {"Cxx": {"MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip"}, "VTKLink": {"vtkImageClip": "https://www.vtk.org/doc/nightly/html/classvtkImageClip.html#details"}}, "vtkImageConstantPad": {"Cxx": {"Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice"}, "VTKLink": {"vtkImageConstantPad": "https://www.vtk.org/doc/nightly/html/classvtkImageConstantPad.html#details"}, "Python": {"Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice"}}, "vtkImageContinuousDilate3D": {"Cxx": {"ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D"}, "VTKLink": {"vtkImageContinuousDilate3D": "https://www.vtk.org/doc/nightly/html/classvtkImageContinuousDilate3D.html#details"}}, "vtkImageContinuousErode3D": {"Cxx": {"ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D"}, "VTKLink": {"vtkImageContinuousErode3D": "https://www.vtk.org/doc/nightly/html/classvtkImageContinuousErode3D.html#details"}}, "vtkImageConvolve": {"Cxx": {"ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve"}, "VTKLink": {"vtkImageConvolve": "https://www.vtk.org/doc/nightly/html/classvtkImageConvolve.html#details"}}, "vtkImageCorrelation": {"Cxx": {"ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation"}, "VTKLink": {"vtkImageCorrelation": "https://www.vtk.org/doc/nightly/html/classvtkImageCorrelation.html#details"}}, "vtkImageDataToPointSet": {"Cxx": {"ImageDataToPointSet": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary"}, "VTKLink": {"vtkImageDataToPointSet": "https://www.vtk.org/doc/nightly/html/classvtkImageDataToPointSet.html#details"}}, "vtkImageDifference": {"Cxx": {"ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference"}, "VTKLink": {"vtkImageDifference": "https://www.vtk.org/doc/nightly/html/classvtkImageDifference.html#details"}}, "vtkImageDilateErode3D": {"Cxx": {"MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D"}, "VTKLink": {"vtkImageDilateErode3D": "https://www.vtk.org/doc/nightly/html/classvtkImageDilateErode3D.html#details"}, "Python": {"MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison"}}, "vtkImageDivergence": {"Cxx": {"ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence"}, "VTKLink": {"vtkImageDivergence": "https://www.vtk.org/doc/nightly/html/classvtkImageDivergence.html#details"}}, "vtkImageDotProduct": {"Cxx": {"DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct"}, "VTKLink": {"vtkImageDotProduct": "https://www.vtk.org/doc/nightly/html/classvtkImageDotProduct.html#details"}}, "vtkImageEllipsoidSource": {"Cxx": {"ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D"}, "VTKLink": {"vtkImageEllipsoidSource": "https://www.vtk.org/doc/nightly/html/classvtkImageEllipsoidSource.html#details"}, "Java": {"ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation"}}, "vtkImageEuclideanToPolar": {"Cxx": {"ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient"}, "VTKLink": {"vtkImageEuclideanToPolar": "https://www.vtk.org/doc/nightly/html/classvtkImageEuclideanToPolar.html#details"}, "Python": {"ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient"}}, "vtkImageExport": {"Cxx": {"ImageExport": "https://examples.vtk.org/site/Cxx/Images/ImageExport"}, "VTKLink": {"vtkImageExport": "https://www.vtk.org/doc/nightly/html/classvtkImageExport.html#details"}}, "vtkImageExtractComponents": {"Cxx": {"IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt"}, "VTKLink": {"vtkImageExtractComponents": "https://www.vtk.org/doc/nightly/html/classvtkImageExtractComponents.html#details"}, "Python": {"IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient"}}, "vtkImageFFT": {"Cxx": {"VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass"}, "VTKLink": {"vtkImageFFT": "https://www.vtk.org/doc/nightly/html/classvtkImageFFT.html#details"}, "Java": {"ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass"}}, "vtkImageFlip": {"Cxx": {"Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkImageFlip": "https://www.vtk.org/doc/nightly/html/classvtkImageFlip.html#details"}, "Java": {"Flip": "https://examples.vtk.org/site/Java/Images/Flip"}, "Python": {"PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}}, "vtkImageFourierCenter": {"Cxx": {"VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum"}, "VTKLink": {"vtkImageFourierCenter": "https://www.vtk.org/doc/nightly/html/classvtkImageFourierCenter.html#details"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum"}}, "vtkImageGaussianSmooth": {"Cxx": {"Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt"}, "VTKLink": {"vtkImageGaussianSmooth": "https://www.vtk.org/doc/nightly/html/classvtkImageGaussianSmooth.html#details"}, "Python": {"Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain"}}, "vtkImageGradient": {"Cxx": {"CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient"}, "VTKLink": {"vtkImageGradient": "https://www.vtk.org/doc/nightly/html/classvtkImageGradient.html#details"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes"}}, "vtkImageGradientMagnitude": {"Cxx": {"ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression"}, "VTKLink": {"vtkImageGradientMagnitude": "https://www.vtk.org/doc/nightly/html/classvtkImageGradientMagnitude.html#details"}}, "vtkImageGridSource": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource"}, "VTKLink": {"vtkImageGridSource": "https://www.vtk.org/doc/nightly/html/classvtkImageGridSource.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform"}}, "vtkImageHistogram": {"Cxx": {"ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram"}, "VTKLink": {"vtkImageHistogram": "https://www.vtk.org/doc/nightly/html/classvtkImageHistogram.html#details"}}, "vtkImageHSVToRGB": {"Cxx": {"ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient"}, "VTKLink": {"vtkImageHSVToRGB": "https://www.vtk.org/doc/nightly/html/classvtkImageHSVToRGB.html#details"}, "Python": {"ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient"}}, "vtkImageHybridMedian2D": {"Cxx": {"HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D"}, "VTKLink": {"vtkImageHybridMedian2D": "https://www.vtk.org/doc/nightly/html/classvtkImageHybridMedian2D.html#details"}, "Python": {"HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison"}}, "vtkImageIdealHighPass": {"Cxx": {"IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass"}, "VTKLink": {"vtkImageIdealHighPass": "https://www.vtk.org/doc/nightly/html/classvtkImageIdealHighPass.html#details"}, "Python": {"IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass"}}, "vtkImageImport": {"Cxx": {"ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport"}, "VTKLink": {"vtkImageImport": "https://www.vtk.org/doc/nightly/html/classvtkImageImport.html#details"}, "Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy"}}, "vtkImageIslandRemoval2D": {"Cxx": {"ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface"}, "VTKLink": {"vtkImageIslandRemoval2D": "https://www.vtk.org/doc/nightly/html/classvtkImageIslandRemoval2D.html#details"}, "Python": {"FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface"}}, "vtkImageIterator": {"Cxx": {"ImageIterator": "https://examples.vtk.org/site/Cxx/ImageData/ImageIterator", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "VTKLink": {"vtkImageIterator": "https://www.vtk.org/doc/nightly/html/classvtkImageIterator.html#details"}}, "vtkImageLaplacian": {"Cxx": {"EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian"}, "VTKLink": {"vtkImageLaplacian": "https://www.vtk.org/doc/nightly/html/classvtkImageLaplacian.html#details"}, "Python": {"EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges"}}, "vtkImageLogarithmicScale": {"Cxx": {"VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum"}, "VTKLink": {"vtkImageLogarithmicScale": "https://www.vtk.org/doc/nightly/html/classvtkImageLogarithmicScale.html#details"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum"}}, "vtkImageLuminance": {"Cxx": {"CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance"}, "VTKLink": {"vtkImageLuminance": "https://www.vtk.org/doc/nightly/html/classvtkImageLuminance.html#details"}, "Python": {"ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp"}}, "vtkImageMagnify": {"Cxx": {"ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient"}, "VTKLink": {"vtkImageMagnify": "https://www.vtk.org/doc/nightly/html/classvtkImageMagnify.html#details"}, "Python": {"ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient"}}, "vtkImageMapper": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper"}, "VTKLink": {"vtkImageMapper": "https://www.vtk.org/doc/nightly/html/classvtkImageMapper.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform"}}, "vtkImageMapper3D": {"Cxx": {"TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "VTKLink": {"vtkImageMapper3D": "https://www.vtk.org/doc/nightly/html/classvtkImageMapper3D.html#details"}}, "vtkImageMapToWindowLevelColors": {"Cxx": {"Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges"}, "VTKLink": {"vtkImageMapToWindowLevelColors": "https://www.vtk.org/doc/nightly/html/classvtkImageMapToWindowLevelColors.html#details"}, "Python": {"Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges"}}, "vtkImageMarchingCubes": {"Cxx": {"IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample"}, "VTKLink": {"vtkImageMarchingCubes": "https://www.vtk.org/doc/nightly/html/classvtkImageMarchingCubes.html#details"}, "Python": {"IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample"}}, "vtkImageMask": {"Cxx": {"ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask"}, "VTKLink": {"vtkImageMask": "https://www.vtk.org/doc/nightly/html/classvtkImageMask.html#details"}}, "vtkImageMathematics": {"Cxx": {"Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes"}, "VTKLink": {"vtkImageMathematics": "https://www.vtk.org/doc/nightly/html/classvtkImageMathematics.html#details"}, "Python": {"Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes"}}, "vtkImageMedian3D": {"Cxx": {"HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D"}, "VTKLink": {"vtkImageMedian3D": "https://www.vtk.org/doc/nightly/html/classvtkImageMedian3D.html#details"}, "Python": {"MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison"}}, "vtkImageMirrorPad": {"Cxx": {"Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad"}, "VTKLink": {"vtkImageMirrorPad": "https://www.vtk.org/doc/nightly/html/classvtkImageMirrorPad.html#details"}, "Python": {"Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad"}}, "vtkImageNoiseSource": {"Cxx": {"HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2"}, "VTKLink": {"vtkImageNoiseSource": "https://www.vtk.org/doc/nightly/html/classvtkImageNoiseSource.html#details"}, "Python": {"MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison"}}, "vtkImageNonMaximumSuppression": {"Cxx": {"CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression"}, "VTKLink": {"vtkImageNonMaximumSuppression": "https://www.vtk.org/doc/nightly/html/classvtkImageNonMaximumSuppression.html#details"}}, "vtkImageNormalize": {"Cxx": {"ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize"}, "VTKLink": {"vtkImageNormalize": "https://www.vtk.org/doc/nightly/html/classvtkImageNormalize.html#details"}, "Java": {"ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize"}, "Python": {"ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize"}}, "vtkImageOpenClose3D": {"Cxx": {"ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D"}, "VTKLink": {"vtkImageOpenClose3D": "https://www.vtk.org/doc/nightly/html/classvtkImageOpenClose3D.html#details"}}, "vtkImagePermute": {"Cxx": {"ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute"}, "VTKLink": {"vtkImagePermute": "https://www.vtk.org/doc/nightly/html/classvtkImagePermute.html#details"}, "Java": {"ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation"}}, "vtkImagePlaneWidget": {"Cxx": {"ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget"}, "VTKLink": {"vtkImagePlaneWidget": "https://www.vtk.org/doc/nightly/html/classvtkImagePlaneWidget.html#details"}, "Java": {"ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget"}}, "vtkImageProperty": {"Cxx": {"EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize"}, "VTKLink": {"vtkImageProperty": "https://www.vtk.org/doc/nightly/html/classvtkImageProperty.html#details"}}, "vtkImageQuantizeRGBToIndex": {"Cxx": {"ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter"}, "VTKLink": {"vtkImageQuantizeRGBToIndex": "https://www.vtk.org/doc/nightly/html/classvtkImageQuantizeRGBToIndex.html#details"}}, "vtkImageRange3D": {"Cxx": {"ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D"}, "VTKLink": {"vtkImageRange3D": "https://www.vtk.org/doc/nightly/html/classvtkImageRange3D.html#details"}}, "vtkImageReader": {"Cxx": {"TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere"}, "VTKLink": {"vtkImageReader": "https://www.vtk.org/doc/nightly/html/classvtkImageReader.html#details"}}, "vtkImageRectilinearWipe": {"Cxx": {"RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget"}, "VTKLink": {"vtkImageRectilinearWipe": "https://www.vtk.org/doc/nightly/html/classvtkImageRectilinearWipe.html#details"}}, "vtkImageResample": {"Cxx": {"FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT"}, "VTKLink": {"vtkImageResample": "https://www.vtk.org/doc/nightly/html/classvtkImageResample.html#details"}}, "vtkImageResize": {"Cxx": {"WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage"}, "VTKLink": {"vtkImageResize": "https://www.vtk.org/doc/nightly/html/classvtkImageResize.html#details"}}, "vtkImageReslice": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate"}, "VTKLink": {"vtkImageReslice": "https://www.vtk.org/doc/nightly/html/classvtkImageReslice.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform"}}, "vtkImageResliceMapper": {"Cxx": {"Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice"}, "VTKLink": {"vtkImageResliceMapper": "https://www.vtk.org/doc/nightly/html/classvtkImageResliceMapper.html#details"}}, "vtkImageRFFT": {"Cxx": {"IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass"}, "VTKLink": {"vtkImageRFFT": "https://www.vtk.org/doc/nightly/html/classvtkImageRFFT.html#details"}, "Python": {"IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass"}}, "vtkImageRGBToHSI": {"Cxx": {"RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI"}, "VTKLink": {"vtkImageRGBToHSI": "https://www.vtk.org/doc/nightly/html/classvtkImageRGBToHSI.html#details"}}, "vtkImageRGBToHSV": {"Cxx": {"RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt"}, "VTKLink": {"vtkImageRGBToHSV": "https://www.vtk.org/doc/nightly/html/classvtkImageRGBToHSV.html#details"}}, "vtkImageRGBToYIQ": {"Cxx": {"RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ"}, "VTKLink": {"vtkImageRGBToYIQ": "https://www.vtk.org/doc/nightly/html/classvtkImageRGBToYIQ.html#details"}}, "vtkImageSeedConnectivity": {"Cxx": {"MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt"}, "VTKLink": {"vtkImageSeedConnectivity": "https://www.vtk.org/doc/nightly/html/classvtkImageSeedConnectivity.html#details"}, "Python": {"MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison"}}, "vtkImageSeparableConvolution": {"Cxx": {"ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution"}, "VTKLink": {"vtkImageSeparableConvolution": "https://www.vtk.org/doc/nightly/html/classvtkImageSeparableConvolution.html#details"}}, "vtkImageShiftScale": {"Cxx": {"Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "RescaleAnImage": "https://examples.vtk.org/site/Cxx/ImageProcessing/RescaleAnImage", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter"}, "VTKLink": {"vtkImageShiftScale": "https://www.vtk.org/doc/nightly/html/classvtkImageShiftScale.html#details"}, "Python": {"Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation"}}, "vtkImageShrink3D": {"Cxx": {"VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt"}, "VTKLink": {"vtkImageShrink3D": "https://www.vtk.org/doc/nightly/html/classvtkImageShrink3D.html#details"}, "Python": {"IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface"}}, "vtkImageSincInterpolator": {"Cxx": {"ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage"}, "VTKLink": {"vtkImageSincInterpolator": "https://www.vtk.org/doc/nightly/html/classvtkImageSincInterpolator.html#details"}}, "vtkImageSinusoidSource": {"Cxx": {"ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource"}, "VTKLink": {"vtkImageSinusoidSource": "https://www.vtk.org/doc/nightly/html/classvtkImageSinusoidSource.html#details"}, "Java": {"ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageSinusoidSource": "https://examples.vtk.org/site/Java/Images/ImageSinusoidSource"}, "Python": {"ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize"}}, "vtkImageSlice": {"Cxx": {"ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField"}, "VTKLink": {"vtkImageSlice": "https://www.vtk.org/doc/nightly/html/classvtkImageSlice.html#details"}}, "vtkImageSliceMapper": {"Cxx": {"ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField"}, "VTKLink": {"vtkImageSliceMapper": "https://www.vtk.org/doc/nightly/html/classvtkImageSliceMapper.html#details"}}, "vtkImageSobel2D": {"Cxx": {"ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D"}, "VTKLink": {"vtkImageSobel2D": "https://www.vtk.org/doc/nightly/html/classvtkImageSobel2D.html#details"}}, "vtkImageStack": {"Cxx": {"ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack"}, "VTKLink": {"vtkImageStack": "https://www.vtk.org/doc/nightly/html/classvtkImageStack.html#details"}}, "vtkImageStencil": {"Cxx": {"PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil"}, "VTKLink": {"vtkImageStencil": "https://www.vtk.org/doc/nightly/html/classvtkImageStencil.html#details"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil"}}, "vtkImageStencilToImage": {"Cxx": {"ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour"}, "VTKLink": {"vtkImageStencilToImage": "https://www.vtk.org/doc/nightly/html/classvtkImageStencilToImage.html#details"}}, "vtkImageThreshold": {"Cxx": {"HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter"}, "VTKLink": {"vtkImageThreshold": "https://www.vtk.org/doc/nightly/html/classvtkImageThreshold.html#details"}, "Python": {"MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes"}}, "vtkImageToImageStencil": {"Cxx": {"ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil"}, "VTKLink": {"vtkImageToImageStencil": "https://www.vtk.org/doc/nightly/html/classvtkImageToImageStencil.html#details"}}, "vtkImageToPolyDataFilter": {"Cxx": {"ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter"}, "VTKLink": {"vtkImageToPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkImageToPolyDataFilter.html#details"}}, "vtkImageToStructuredPoints": {"Cxx": {"CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints"}, "VTKLink": {"vtkImageToStructuredPoints": "https://www.vtk.org/doc/nightly/html/classvtkImageToStructuredPoints.html#details"}}, "vtkImageTracerWidget": {"Cxx": {"ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar"}, "VTKLink": {"vtkImageTracerWidget": "https://www.vtk.org/doc/nightly/html/classvtkImageTracerWidget.html#details"}, "Java": {"ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar"}}, "vtkImageTranslateExtent": {"Cxx": {"ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent"}, "VTKLink": {"vtkImageTranslateExtent": "https://www.vtk.org/doc/nightly/html/classvtkImageTranslateExtent.html#details"}}, "vtkImageVariance3D": {"Cxx": {"ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D"}, "VTKLink": {"vtkImageVariance3D": "https://www.vtk.org/doc/nightly/html/classvtkImageVariance3D.html#details"}}, "vtkImageViewer": {"Cxx": {"ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader"}, "VTKLink": {"vtkImageViewer": "https://www.vtk.org/doc/nightly/html/classvtkImageViewer.html#details"}, "Python": {"PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "HDRReader": "https://examples.vtk.org/site/Python/IO/HDRReader"}}, "vtkImageWeightedSum": {"Cxx": {"ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum"}, "VTKLink": {"vtkImageWeightedSum": "https://www.vtk.org/doc/nightly/html/classvtkImageWeightedSum.html#details"}, "Java": {"ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum"}, "Python": {"ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "SumVTKImages": "https://examples.vtk.org/site/Python/ImageData/SumVTKImages"}}, "vtkImageWrapPad": {"Cxx": {"GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels"}, "VTKLink": {"vtkImageWrapPad": "https://www.vtk.org/doc/nightly/html/classvtkImageWrapPad.html#details"}, "Python": {"GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels"}}, "vtkImageWriter": {"Cxx": {"ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkImageWriter": "https://www.vtk.org/doc/nightly/html/classvtkImageWriter.html#details"}}, "vtkImplicitDataSet": {"Cxx": {"ImplicitDataSet": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitDataSet"}, "VTKLink": {"vtkImplicitDataSet": "https://www.vtk.org/doc/nightly/html/classvtkImplicitDataSet.html#details"}, "Java": {"ImplicitDataSet": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitDataSet"}}, "vtkImplicitFunction": {"Cxx": {"ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkImplicitFunction": "https://www.vtk.org/doc/nightly/html/classvtkImplicitFunction.html#details"}}, "vtkImplicitModeller": {"Cxx": {"ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1"}, "VTKLink": {"vtkImplicitModeller": "https://www.vtk.org/doc/nightly/html/classvtkImplicitModeller.html#details"}, "Java": {"BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo"}, "Python": {"Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1"}}, "vtkImplicitPlaneRepresentation": {"Cxx": {"ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2"}, "VTKLink": {"vtkImplicitPlaneRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkImplicitPlaneRepresentation.html#details"}, "Python": {"ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2"}}, "vtkImplicitPlaneWidget2": {"Cxx": {"ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2"}, "VTKLink": {"vtkImplicitPlaneWidget2": "https://www.vtk.org/doc/nightly/html/classvtkImplicitPlaneWidget2.html#details"}, "Python": {"ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2"}}, "vtkImplicitPolyDataDistance": {"Cxx": {"ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "VTKLink": {"vtkImplicitPolyDataDistance": "https://www.vtk.org/doc/nightly/html/classvtkImplicitPolyDataDistance.html#details"}, "Python": {"ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkImplicitSelectionLoop": {"Cxx": {"ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop"}, "VTKLink": {"vtkImplicitSelectionLoop": "https://www.vtk.org/doc/nightly/html/classvtkImplicitSelectionLoop.html#details"}}, "vtkImplicitTextureCoords": {"Cxx": {"Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere"}, "VTKLink": {"vtkImplicitTextureCoords": "https://www.vtk.org/doc/nightly/html/classvtkImplicitTextureCoords.html#details"}, "Python": {"Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere"}}, "vtkIncrementalOctreePointLocator": {"Cxx": {"IncrementalOctreePointLocator": "https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator"}, "VTKLink": {"vtkIncrementalOctreePointLocator": "https://www.vtk.org/doc/nightly/html/classvtkIncrementalOctreePointLocator.html#details"}}, "vtkIndent": {"Cxx": {"vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTest1": "https://examples.vtk.org/site/Cxx/Developers/vtkTest1", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTest": "https://examples.vtk.org/site/Cxx/Developers/vtkTest", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader"}, "VTKLink": {"vtkIndent": "https://www.vtk.org/doc/nightly/html/classvtkIndent.html#details"}}, "vtkInEdgeIterator": {"Cxx": {"InEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/InEdgeIterator"}, "VTKLink": {"vtkInEdgeIterator": "https://www.vtk.org/doc/nightly/html/classvtkInEdgeIterator.html#details"}}, "vtkInformation": {"Cxx": {"ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "AttachAttributes": "https://examples.vtk.org/site/Cxx/PolyData/AttachAttributes", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "VTKLink": {"vtkInformation": "https://www.vtk.org/doc/nightly/html/classvtkInformation.html#details"}}, "vtkInformationDoubleVectorKey": {"Cxx": {"AttachAttributes": "https://examples.vtk.org/site/Cxx/PolyData/AttachAttributes"}, "VTKLink": {"vtkInformationDoubleVectorKey": "https://www.vtk.org/doc/nightly/html/classvtkInformationDoubleVectorKey.html#details"}}, "vtkInformationVector": {"Cxx": {"vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData"}, "VTKLink": {"vtkInformationVector": "https://www.vtk.org/doc/nightly/html/classvtkInformationVector.html#details"}}, "vtkInteractorObserver": {"Cxx": {"FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground"}, "VTKLink": {"vtkInteractorObserver": "https://www.vtk.org/doc/nightly/html/classvtkInteractorObserver.html#details"}, "Java": {"ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest"}}, "vtkInteractorStyle": {"Cxx": {"ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower"}, "VTKLink": {"vtkInteractorStyle": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyle.html#details"}, "Java": {"Follower": "https://examples.vtk.org/site/Java/Visualization/Follower"}}, "vtkInteractorStyleRubberBand2D": {"Cxx": {"SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D"}, "VTKLink": {"vtkInteractorStyleRubberBand2D": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleRubberBand2D.html#details"}}, "vtkInteractorStyleRubberBand3D": {"Cxx": {"RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D"}, "VTKLink": {"vtkInteractorStyleRubberBand3D": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleRubberBand3D.html#details"}}, "vtkInteractorStyleRubberBandPick": {"Cxx": {"AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick"}, "VTKLink": {"vtkInteractorStyleRubberBandPick": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleRubberBandPick.html#details"}, "Java": {"RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick"}, "Python": {"CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid"}}, "vtkInteractorStyleRubberBandZoom": {"Cxx": {"RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom"}, "VTKLink": {"vtkInteractorStyleRubberBandZoom": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleRubberBandZoom.html#details"}, "Java": {"RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom"}}, "vtkInteractorStyleSwitch": {"Cxx": {"ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "VTKLink": {"vtkInteractorStyleSwitch": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleSwitch.html#details"}, "Java": {"ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch"}}, "vtkInteractorStyleTerrain": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain"}, "VTKLink": {"vtkInteractorStyleTerrain": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleTerrain.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain"}}, "vtkInteractorStyleTrackball": {"Cxx": {"AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking"}, "VTKLink": {"vtkInteractorStyleTrackball": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleTrackball.html#details"}, "Java": {"ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar"}}, "vtkInteractorStyleTrackballActor": {"Cxx": {"MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game"}, "VTKLink": {"vtkInteractorStyleTrackballActor": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleTrackballActor.html#details"}, "Java": {"MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor"}, "Python": {"InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor"}}, "vtkInteractorStyleTrackballCamera": {"Cxx": {"PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkInteractorStyleTrackballCamera": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleTrackballCamera.html#details"}, "Java": {"SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent", "JFrameRenderer": "https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}}, "vtkInteractorStyleUser": {"Cxx": {"IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser"}, "VTKLink": {"vtkInteractorStyleUser": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleUser.html#details"}}, "vtkInterpolateDataSetAttributes": {"Cxx": {"Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "VTKLink": {"vtkInterpolateDataSetAttributes": "https://www.vtk.org/doc/nightly/html/classvtkInterpolateDataSetAttributes.html#details"}}, "vtkIntersectionPolyDataFilter": {"Cxx": {"IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter"}, "VTKLink": {"vtkIntersectionPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkIntersectionPolyDataFilter.html#details"}}, "vtkIterativeClosestPointTransform": {"Cxx": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform"}, "VTKLink": {"vtkIterativeClosestPointTransform": "https://www.vtk.org/doc/nightly/html/classvtkIterativeClosestPointTransform.html#details"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "IterativeClosestPoints": "https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints"}}, "vtkKdTree": {"Cxx": {"BuildLocatorFromKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/BuildLocatorFromKClosestPoints", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints", "KdTree": "https://examples.vtk.org/site/Cxx/DataStructures/KdTree"}, "VTKLink": {"vtkKdTree": "https://www.vtk.org/doc/nightly/html/classvtkKdTree.html#details"}}, "vtkKdTreePointLocator": {"Cxx": {"KDTreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadius", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "KdTreePointLocatorClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/KdTreePointLocatorClosestPoint", "ClosestNPoints": "https://examples.vtk.org/site/Cxx/DataStructures/ClosestNPoints", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo"}, "VTKLink": {"vtkKdTreePointLocator": "https://www.vtk.org/doc/nightly/html/classvtkKdTreePointLocator.html#details"}, "Java": {"VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree"}}, "vtkKMeansStatistics": {"Cxx": {"KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering"}, "VTKLink": {"vtkKMeansStatistics": "https://www.vtk.org/doc/nightly/html/classvtkKMeansStatistics.html#details"}}, "vtkKochanekSpline": {"Cxx": {"KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "1DTupleInterpolation": "https://examples.vtk.org/site/Cxx/Math/1DTupleInterpolation"}, "VTKLink": {"vtkKochanekSpline": "https://www.vtk.org/doc/nightly/html/classvtkKochanekSpline.html#details"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline"}}, "vtkLabeledDataMapper": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkLabeledDataMapper": "https://www.vtk.org/doc/nightly/html/classvtkLabeledDataMapper.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkLabelPlacementMapper": {"Cxx": {"LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper"}, "VTKLink": {"vtkLabelPlacementMapper": "https://www.vtk.org/doc/nightly/html/classvtkLabelPlacementMapper.html#details"}}, "vtkLegendBoxActor": {"Cxx": {"ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "VTKLink": {"vtkLegendBoxActor": "https://www.vtk.org/doc/nightly/html/classvtkLegendBoxActor.html#details"}, "Java": {"Legend": "https://examples.vtk.org/site/Java/Visualization/Legend"}}, "vtkLegendScaleActor": {"Cxx": {"LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor"}, "VTKLink": {"vtkLegendScaleActor": "https://www.vtk.org/doc/nightly/html/classvtkLegendScaleActor.html#details"}, "Java": {"LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor"}}, "vtkLight": {"Cxx": {"GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights"}, "VTKLink": {"vtkLight": "https://www.vtk.org/doc/nightly/html/classvtkLight.html#details"}, "Java": {"AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "LightActor": "https://examples.vtk.org/site/Java/Lighting/LightActor"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres"}}, "vtkLightActor": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor"}, "VTKLink": {"vtkLightActor": "https://www.vtk.org/doc/nightly/html/classvtkLightActor.html#details"}, "Java": {"LightActor": "https://examples.vtk.org/site/Java/Lighting/LightActor"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo"}}, "vtkLightCollection": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light"}, "VTKLink": {"vtkLightCollection": "https://www.vtk.org/doc/nightly/html/classvtkLightCollection.html#details"}}, "vtkLightsPass": {"Cxx": {"PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkLightsPass": "https://www.vtk.org/doc/nightly/html/classvtkLightsPass.html#details"}, "Python": {"PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkLinearExtrusionFilter": {"Cxx": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder"}, "VTKLink": {"vtkLinearExtrusionFilter": "https://www.vtk.org/doc/nightly/html/classvtkLinearExtrusionFilter.html#details"}, "Java": {"EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder"}}, "vtkLinearTransform": {"Cxx": {"ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene"}, "VTKLink": {"vtkLinearTransform": "https://www.vtk.org/doc/nightly/html/classvtkLinearTransform.html#details"}}, "vtkLineRepresentation": {"Cxx": {"LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2"}, "VTKLink": {"vtkLineRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkLineRepresentation.html#details"}}, "vtkLineWidget": {"Cxx": {"StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget"}, "VTKLink": {"vtkLineWidget": "https://www.vtk.org/doc/nightly/html/classvtkLineWidget.html#details"}, "Python": {"StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget"}}, "vtkLineWidget2": {"Cxx": {"LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2"}, "VTKLink": {"vtkLineWidget2": "https://www.vtk.org/doc/nightly/html/classvtkLineWidget2.html#details"}}, "vtkLinkEdgels": {"Cxx": {"CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector"}, "VTKLink": {"vtkLinkEdgels": "https://www.vtk.org/doc/nightly/html/classvtkLinkEdgels.html#details"}}, "vtkLocator": {"Cxx": {"DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison"}, "VTKLink": {"vtkLocator": "https://www.vtk.org/doc/nightly/html/classvtkLocator.html#details"}}, "vtkLODProp3D": {"Cxx": {"LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D"}, "VTKLink": {"vtkLODProp3D": "https://www.vtk.org/doc/nightly/html/classvtkLODProp3D.html#details"}}, "vtkLogger": {"Cxx": {"AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors"}, "VTKLink": {"vtkLogger": "https://www.vtk.org/doc/nightly/html/classvtkLogger.html#details"}}, "vtkLogLookupTable": {"Cxx": {"HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline"}, "VTKLink": {"vtkLogLookupTable": "https://www.vtk.org/doc/nightly/html/classvtkLogLookupTable.html#details"}, "Python": {"HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline"}}, "vtkLogoRepresentation": {"Cxx": {"LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget"}, "VTKLink": {"vtkLogoRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkLogoRepresentation.html#details"}, "Java": {"LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget"}}, "vtkLogoWidget": {"Cxx": {"LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget"}, "VTKLink": {"vtkLogoWidget": "https://www.vtk.org/doc/nightly/html/classvtkLogoWidget.html#details"}, "Java": {"LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget"}}, "vtkLoopBooleanPolyDataFilter": {"Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter"}, "VTKLink": {"vtkLoopBooleanPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkLoopBooleanPolyDataFilter.html#details"}}, "vtkMapper": {"Cxx": {"ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "VTKLink": {"vtkMapper": "https://www.vtk.org/doc/nightly/html/classvtkMapper.html#details"}}, "vtkMarchingContourFilter": {"Cxx": {"FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkMarchingContourFilter": "https://www.vtk.org/doc/nightly/html/classvtkMarchingContourFilter.html#details"}, "Python": {"FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkMaskFields": {"Cxx": {"GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels"}, "VTKLink": {"vtkMaskFields": "https://www.vtk.org/doc/nightly/html/classvtkMaskFields.html#details"}, "Python": {"GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkMaskPoints": {"Cxx": {"MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo"}, "VTKLink": {"vtkMaskPoints": "https://www.vtk.org/doc/nightly/html/classvtkMaskPoints.html#details"}, "Java": {"SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran"}, "Python": {"SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkMaskPointsFilter": {"Cxx": {"MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter"}, "VTKLink": {"vtkMaskPointsFilter": "https://www.vtk.org/doc/nightly/html/classvtkMaskPointsFilter.html#details"}}, "vtkMaskPolyData": {"Cxx": {"StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran"}, "VTKLink": {"vtkMaskPolyData": "https://www.vtk.org/doc/nightly/html/classvtkMaskPolyData.html#details"}, "Python": {"StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran"}}, "vtkMassProperties": {"Cxx": {"MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties"}, "VTKLink": {"vtkMassProperties": "https://www.vtk.org/doc/nightly/html/classvtkMassProperties.html#details"}}, "vtkMatrix3x3": {"Cxx": {"MatrixTranspose": "https://examples.vtk.org/site/Cxx/Math/MatrixTranspose", "MatrixInverse": "https://examples.vtk.org/site/Cxx/Math/MatrixInverse"}, "VTKLink": {"vtkMatrix3x3": "https://www.vtk.org/doc/nightly/html/classvtkMatrix3x3.html#details"}, "Java": {"MatrixTranspose": "https://examples.vtk.org/site/Java/Math/MatrixTranspose", "MatrixInverse": "https://examples.vtk.org/site/Java/Math/MatrixInverse"}}, "vtkMCubesReader": {"Cxx": {"PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity"}, "VTKLink": {"vtkMCubesReader": "https://www.vtk.org/doc/nightly/html/classvtkMCubesReader.html#details"}, "Python": {"PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity"}}, "vtkMergeFilter": {"Cxx": {"ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp"}, "VTKLink": {"vtkMergeFilter": "https://www.vtk.org/doc/nightly/html/classvtkMergeFilter.html#details"}, "Python": {"ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp"}}, "vtkModifiedBSPTree": {"Cxx": {"ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "ModifiedBSPTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo"}, "VTKLink": {"vtkModifiedBSPTree": "https://www.vtk.org/doc/nightly/html/classvtkModifiedBSPTree.html#details"}}, "vtkMoleculeMapper": {"Cxx": {"ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML"}, "VTKLink": {"vtkMoleculeMapper": "https://www.vtk.org/doc/nightly/html/classvtkMoleculeMapper.html#details"}, "Java": {"ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML"}}, "vtkMultiBlockDataGroupFilter": {"Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter"}, "VTKLink": {"vtkMultiBlockDataGroupFilter": "https://www.vtk.org/doc/nightly/html/classvtkMultiBlockDataGroupFilter.html#details"}}, "vtkMultiThreshold": {"Cxx": {"CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary"}, "VTKLink": {"vtkMultiThreshold": "https://www.vtk.org/doc/nightly/html/classvtkMultiThreshold.html#details"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject"}}, "vtkMutableDirectedGraph": {"Cxx": {"MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "GraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmFilter", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "DirectedGraphToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/DirectedGraphToMutableDirectedGraph", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "MutableDirectedGraphToDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/MutableDirectedGraphToDirectedGraph", "OutEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/OutEdgeIterator", "TreeToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/TreeToMutableDirectedGraph", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "TreeBFSIterator": "https://examples.vtk.org/site/Cxx/Graphs/TreeBFSIterator", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "InEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/InEdgeIterator"}, "VTKLink": {"vtkMutableDirectedGraph": "https://www.vtk.org/doc/nightly/html/classvtkMutableDirectedGraph.html#details"}, "Java": {"GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates"}, "Python": {"EdgeWeights": "https://examples.vtk.org/site/Python/Graphs/EdgeWeights", "ConstructTree": "https://examples.vtk.org/site/Python/Graphs/ConstructTree", "CreateTree": "https://examples.vtk.org/site/Python/Graphs/CreateTree", "ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "ColorVertexLabels": "https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "VisualizeGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeGraph"}}, "vtkMutableGraphHelper": {"Cxx": {"MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter"}, "VTKLink": {"vtkMutableGraphHelper": "https://www.vtk.org/doc/nightly/html/classvtkMutableGraphHelper.html#details"}}, "vtkMutableUndirectedGraph": {"Cxx": {"MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "GraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmSource", "GraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "RemoveIsolatedVertices": "https://examples.vtk.org/site/Cxx/Graphs/RemoveIsolatedVertices", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "InEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/InEdgeIterator", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "EdgeListIterator": "https://examples.vtk.org/site/Cxx/Graphs/EdgeListIterator", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "OutEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/OutEdgeIterator", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices"}, "VTKLink": {"vtkMutableUndirectedGraph": "https://www.vtk.org/doc/nightly/html/classvtkMutableUndirectedGraph.html#details"}, "Java": {"GraphPoints": "https://examples.vtk.org/site/Java/InfoVis/GraphPoints", "VisualizeGraph": "https://examples.vtk.org/site/Java/Graphs/VisualizeGraph"}, "Python": {"GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "ConstructGraph": "https://examples.vtk.org/site/Python/Graphs/ConstructGraph", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges"}}, "vtkNamedColors": {"Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "XMLPImageDataWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPImageDataWriter", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "PNGWriter": "https://examples.vtk.org/site/Cxx/IO/PNGWriter", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "JPEGWriter": "https://examples.vtk.org/site/Cxx/IO/JPEGWriter", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ColorSeriesPatches": "https://examples.vtk.org/site/Cxx/Visualization/ColorSeriesPatches", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "NamedColorPatches": "https://examples.vtk.org/site/Cxx/Visualization/NamedColorPatches", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkNamedColors": "https://www.vtk.org/doc/nightly/html/classvtkNamedColors.html#details"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "OggTheora": "https://examples.vtk.org/site/Java/Video/OggTheora", "SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent", "JFrameRenderer": "https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "RenderView": "https://examples.vtk.org/site/Java/Views/RenderView", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "SplineWidget": "https://examples.vtk.org/site/Java/Widgets/SplineWidget", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "AngleWidget": "https://examples.vtk.org/site/Java/Widgets/AngleWidget", "PlaneWidget": "https://examples.vtk.org/site/Java/Widgets/PlaneWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "DistanceWidget": "https://examples.vtk.org/site/Java/Widgets/DistanceWidget", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "JPEGWriter": "https://examples.vtk.org/site/Java/IO/JPEGWriter", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "TextActor": "https://examples.vtk.org/site/Java/GeometricObjects/TextActor", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "SphereWidget": "https://examples.vtk.org/site/Python/Widgets/SphereWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "EdgeWeights": "https://examples.vtk.org/site/Python/Graphs/EdgeWeights", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "RandomGraphSource": "https://examples.vtk.org/site/Python/Graphs/RandomGraphSource", "ColorVertexLabels": "https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels", "ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "ConstructGraph": "https://examples.vtk.org/site/Python/Graphs/ConstructGraph", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "ReadDICOM": "https://examples.vtk.org/site/Python/IO/ReadDICOM", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "ColorSeriesPatches": "https://examples.vtk.org/site/Python/Visualization/ColorSeriesPatches", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "NamedColorPatches": "https://examples.vtk.org/site/Python/Visualization/NamedColorPatches", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "AnnotatedCubeActor": "https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TextActor": "https://examples.vtk.org/site/Python/GeometricObjects/TextActor", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkNew": {"Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ReverseSense": "https://examples.vtk.org/site/Cxx/PolyData/ReverseSense", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "MergePoints": "https://examples.vtk.org/site/Cxx/PolyData/MergePoints", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "CellTreeLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellTreeLocator", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "GetMiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "DataBounds": "https://examples.vtk.org/site/Cxx/PolyData/DataBounds", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "MultiBlockMergeFilter": "https://examples.vtk.org/site/Cxx/PolyData/MultiBlockMergeFilter", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "CellLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellLocator", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "PointLocatorRadius": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorRadius", "DeletePoint": "https://examples.vtk.org/site/Cxx/PolyData/DeletePoint", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "DetermineArrayDataTypes": "https://examples.vtk.org/site/Cxx/PolyData/DetermineArrayDataTypes", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "CleanPolyData": "https://examples.vtk.org/site/Cxx/PolyData/CleanPolyData", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "CenterOfMass": "https://examples.vtk.org/site/Cxx/PolyData/CenterOfMass", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "Stripper": "https://examples.vtk.org/site/Cxx/PolyData/Stripper", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "AttachAttributes": "https://examples.vtk.org/site/Cxx/PolyData/AttachAttributes", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "RemoveVertices": "https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "GetMiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData", "PolyDataGetPoint": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataGetPoint", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "PolyDataToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "IterateImageData": "https://examples.vtk.org/site/Cxx/ImageData/IterateImageData", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "GetCellCenter": "https://examples.vtk.org/site/Cxx/ImageData/GetCellCenter", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "CellIdFromGridCoordinates": "https://examples.vtk.org/site/Cxx/ImageData/CellIdFromGridCoordinates", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ImageDataToPointSet": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ImageIterator": "https://examples.vtk.org/site/Cxx/ImageData/ImageIterator", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "FFMPEG": "https://examples.vtk.org/site/Cxx/Video/FFMPEG", "OggTheora": "https://examples.vtk.org/site/Cxx/Video/OggTheora", "MPEG2": "https://examples.vtk.org/site/Cxx/Video/MPEG2", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "RescaleAnImage": "https://examples.vtk.org/site/Cxx/ImageProcessing/RescaleAnImage", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "ArrayToTable": "https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable", "PassThrough": "https://examples.vtk.org/site/Cxx/InfoVis/PassThrough", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "DelimitedTextWriter": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "ImplicitDataSet": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitDataSet", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/ImageAlgorithmFilter", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "AlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/AlgorithmFilter", "MultipleInputPorts": "https://examples.vtk.org/site/Cxx/Developers/MultipleInputPorts", "GraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmSource", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "GraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmFilter", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "ImageAccumulate": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulate", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ImageExport": "https://examples.vtk.org/site/Cxx/Images/ImageExport", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "NegativeIndices": "https://examples.vtk.org/site/Cxx/Images/NegativeIndices", "ImageValueRange": "https://examples.vtk.org/site/Cxx/Images/ImageValueRange", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "RandomSequence": "https://examples.vtk.org/site/Cxx/SimpleOperations/RandomSequence", "GaussianRandomNumber": "https://examples.vtk.org/site/Cxx/SimpleOperations/GaussianRandomNumber", "DistancePointToLine": "https://examples.vtk.org/site/Cxx/SimpleOperations/DistancePointToLine", "ProjectPointPlane": "https://examples.vtk.org/site/Cxx/SimpleOperations/ProjectPointPlane", "PerspectiveTransform": "https://examples.vtk.org/site/Cxx/SimpleOperations/PerspectiveTransform", "UniformRandomNumber": "https://examples.vtk.org/site/Cxx/SimpleOperations/UniformRandomNumber", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "GetLinearPointId": "https://examples.vtk.org/site/Cxx/StructuredGrid/GetLinearPointId", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "RemoveIsolatedVertices": "https://examples.vtk.org/site/Cxx/Graphs/RemoveIsolatedVertices", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "InEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/InEdgeIterator", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "EdgeListIterator": "https://examples.vtk.org/site/Cxx/Graphs/EdgeListIterator", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "TreeToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/TreeToMutableDirectedGraph", "OutEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/OutEdgeIterator", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "TreeBFSIterator": "https://examples.vtk.org/site/Cxx/Graphs/TreeBFSIterator", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents", "DirectedGraphToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/DirectedGraphToMutableDirectedGraph", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "MutableDirectedGraphToDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/MutableDirectedGraphToDirectedGraph", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "ObserveError": "https://examples.vtk.org/site/Cxx/Utilities/ObserveError", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ConstructTable": "https://examples.vtk.org/site/Cxx/Utilities/ConstructTable", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "ArrayRange": "https://examples.vtk.org/site/Cxx/Utilities/ArrayRange", "LUTUtilities": "https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "UnknownLengthArray": "https://examples.vtk.org/site/Cxx/Utilities/UnknownLengthArray", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "FilenameFunctions": "https://examples.vtk.org/site/Cxx/Utilities/FilenameFunctions", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "DenseArrayRange": "https://examples.vtk.org/site/Cxx/Utilities/DenseArrayRange", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "CheckVTKVersion": "https://examples.vtk.org/site/Cxx/Utilities/CheckVTKVersion", "ArrayLookup": "https://examples.vtk.org/site/Cxx/Utilities/ArrayLookup", "3DArray": "https://examples.vtk.org/site/Cxx/Utilities/3DArray", "VectorArrayKnownLength": "https://examples.vtk.org/site/Cxx/Utilities/VectorArrayKnownLength", "ShallowCopy": "https://examples.vtk.org/site/Cxx/Utilities/ShallowCopy", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "PCAStatistics": "https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics", "TimerLog": "https://examples.vtk.org/site/Cxx/Utilities/TimerLog", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "VectorArrayUnknownLength": "https://examples.vtk.org/site/Cxx/Utilities/VectorArrayUnknownLength", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "ForLoop": "https://examples.vtk.org/site/Cxx/Utilities/ForLoop", "PiecewiseFunction": "https://examples.vtk.org/site/Cxx/Utilities/PiecewiseFunction", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "CardinalSpline": "https://examples.vtk.org/site/Cxx/Utilities/CardinalSpline", "FunctionParser": "https://examples.vtk.org/site/Cxx/Utilities/FunctionParser", "SortDataArray": "https://examples.vtk.org/site/Cxx/Utilities/SortDataArray", "ArrayWriter": "https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "CustomDenseArray": "https://examples.vtk.org/site/Cxx/Utilities/CustomDenseArray", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "SparseArray": "https://examples.vtk.org/site/Cxx/Utilities/SparseArray", "Coordinate": "https://examples.vtk.org/site/Cxx/Utilities/Coordinate", "ColorTransferFunction": "https://examples.vtk.org/site/Cxx/Utilities/ColorTransferFunction", "GetClassName": "https://examples.vtk.org/site/Cxx/Utilities/GetClassName", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "KnownLengthArray": "https://examples.vtk.org/site/Cxx/Utilities/KnownLengthArray", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "2DArray": "https://examples.vtk.org/site/Cxx/Utilities/2DArray", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "DeepCopy": "https://examples.vtk.org/site/Cxx/Utilities/DeepCopy", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator", "FileOutputWindow": "https://examples.vtk.org/site/Cxx/Utilities/FileOutputWindow", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "PointInPolygon": "https://examples.vtk.org/site/Cxx/Utilities/PointInPolygon", "ColorLookupTable": "https://examples.vtk.org/site/Cxx/Utilities/ColorLookupTable", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "DiscretizableColorTransferFunction": "https://examples.vtk.org/site/Cxx/Utilities/DiscretizableColorTransferFunction", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "GetDataRoot": "https://examples.vtk.org/site/Cxx/Utilities/GetDataRoot", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "XMLPImageDataWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPImageDataWriter", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "PNGWriter": "https://examples.vtk.org/site/Cxx/IO/PNGWriter", "ConvertFile": "https://examples.vtk.org/site/Cxx/IO/ConvertFile", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPUnstructuredGridWriter", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "GenericDataObjectReader": "https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "SimplePointsWriter": "https://examples.vtk.org/site/Cxx/IO/SimplePointsWriter", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "JPEGWriter": "https://examples.vtk.org/site/Cxx/IO/JPEGWriter", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "WriteVTP": "https://examples.vtk.org/site/Cxx/IO/WriteVTP", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLStructuredGridWriter", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ColorSeriesPatches": "https://examples.vtk.org/site/Cxx/Visualization/ColorSeriesPatches", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "NamedColorPatches": "https://examples.vtk.org/site/Cxx/Visualization/NamedColorPatches", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "PolygonIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolygonIntersection", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "PlanesIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlanesIntersection", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "ExodusIIWriter": "https://examples.vtk.org/site/Cxx/Parallel/ExodusIIWriter", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra", "KDTreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadius", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "OBBTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeIntersectWithLine", "BuildOctree": "https://examples.vtk.org/site/Cxx/DataStructures/BuildOctree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "BuildLocatorFromKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/BuildLocatorFromKClosestPoints", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "IncrementalOctreePointLocator": "https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator", "ModifiedBSPTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine", "KdTreePointLocatorClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/KdTreePointLocatorClosestPoint", "OctreeKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeKClosestPoints", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "KdTree": "https://examples.vtk.org/site/Cxx/DataStructures/KdTree", "KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeClosestPoint", "ClosestNPoints": "https://examples.vtk.org/site/Cxx/DataStructures/ClosestNPoints", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OctreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadius", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "ImageDataToQImage": "https://examples.vtk.org/site/Cxx/Qt/ImageDataToQImage", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "QImageToImageSource": "https://examples.vtk.org/site/Cxx/Qt/QImageToImageSource", "MatlabEngineFilter": "https://examples.vtk.org/site/Cxx/Matlab/MatlabEngineFilter", "1DTupleInterpolation": "https://examples.vtk.org/site/Cxx/Math/1DTupleInterpolation", "MatrixInverse": "https://examples.vtk.org/site/Cxx/Math/MatrixInverse", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "MatrixTranspose": "https://examples.vtk.org/site/Cxx/Math/MatrixTranspose", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter", "CellEdges": "https://examples.vtk.org/site/Cxx/Meshes/CellEdges", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "AddCell": "https://examples.vtk.org/site/Cxx/Meshes/AddCell", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkNew": "https://www.vtk.org/doc/nightly/html/classvtkNew.html#details"}, "Python": {"ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON"}}, "vtkOBBTree": {"Cxx": {"OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OBBTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeIntersectWithLine", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo"}, "VTKLink": {"vtkOBBTree": "https://www.vtk.org/doc/nightly/html/classvtkOBBTree.html#details"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas"}}, "vtkObjectBase": {"Cxx": {"TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader"}, "VTKLink": {"vtkObjectBase": "https://www.vtk.org/doc/nightly/html/classvtkObjectBase.html#details"}}, "vtkObjectFactory": {"Cxx": {"vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTest1": "https://examples.vtk.org/site/Cxx/Developers/vtkTest1", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "Warnings": "https://examples.vtk.org/site/Cxx/Developers/Warnings", "vtkTest": "https://examples.vtk.org/site/Cxx/Developers/vtkTest", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D"}, "VTKLink": {"vtkObjectFactory": "https://www.vtk.org/doc/nightly/html/classvtkObjectFactory.html#details"}}, "vtkOBJExporter": {"Cxx": {"ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtkOBJExporter": "https://www.vtk.org/doc/nightly/html/classvtkOBJExporter.html#details"}}, "vtkOBJImporter": {"Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtkOBJImporter": "https://www.vtk.org/doc/nightly/html/classvtkOBJImporter.html#details"}}, "vtkOctreePointLocator": {"Cxx": {"OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "OctreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadius", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "BuildOctree": "https://examples.vtk.org/site/Cxx/DataStructures/BuildOctree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "OctreeClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeClosestPoint", "OctreeKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeKClosestPoints"}, "VTKLink": {"vtkOctreePointLocator": "https://www.vtk.org/doc/nightly/html/classvtkOctreePointLocator.html#details"}, "Java": {"BuildOctree": "https://examples.vtk.org/site/Java/DataStructures/BuildOctree"}}, "vtkOggTheoraWriter": {"Cxx": {"OggTheora": "https://examples.vtk.org/site/Cxx/Video/OggTheora"}, "VTKLink": {"vtkOggTheoraWriter": "https://www.vtk.org/doc/nightly/html/classvtkOggTheoraWriter.html#details"}, "Java": {"OggTheora": "https://examples.vtk.org/site/Java/Video/OggTheora"}}, "vtkOpaquePass": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkOpaquePass": "https://www.vtk.org/doc/nightly/html/classvtkOpaquePass.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkOpenGLGPUVolumeRayCastMapper": {"Cxx": {"RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface"}, "VTKLink": {"vtkOpenGLGPUVolumeRayCastMapper": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLGPUVolumeRayCastMapper.html#details"}}, "vtkOpenGLPolyDataMapper": {"Cxx": {"BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal"}, "VTKLink": {"vtkOpenGLPolyDataMapper": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLPolyDataMapper.html#details"}}, "vtkOpenGLRenderer": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkOpenGLRenderer": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLRenderer.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}}, "vtkOpenGLRenderWindow": {"Cxx": {"PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox"}, "VTKLink": {"vtkOpenGLRenderWindow": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLRenderWindow.html#details"}}, "vtkOpenGLTexture": {"Cxx": {"PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkOpenGLTexture": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLTexture.html#details"}}, "vtkOpenVRRenderer": {"Cxx": {"OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder"}, "VTKLink": {"vtkOpenVRRenderer": "https://www.vtk.org/doc/nightly/html/classvtkOpenVRRenderer.html#details"}}, "vtkOpenVRRenderWindow": {"Cxx": {"OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder"}, "VTKLink": {"vtkOpenVRRenderWindow": "https://www.vtk.org/doc/nightly/html/classvtkOpenVRRenderWindow.html#details"}}, "vtkOpenVRRenderWindowInteractor": {"Cxx": {"OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder"}, "VTKLink": {"vtkOpenVRRenderWindowInteractor": "https://www.vtk.org/doc/nightly/html/classvtkOpenVRRenderWindowInteractor.html#details"}}, "vtkOrientationMarkerWidget": {"Cxx": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkOrientationMarkerWidget": "https://www.vtk.org/doc/nightly/html/classvtkOrientationMarkerWidget.html#details"}, "Java": {"OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkOutEdgeIterator": {"Cxx": {"OutEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/OutEdgeIterator"}, "VTKLink": {"vtkOutEdgeIterator": "https://www.vtk.org/doc/nightly/html/classvtkOutEdgeIterator.html#details"}}, "vtkOutlineGlowPass": {"Cxx": {"OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass"}, "VTKLink": {"vtkOutlineGlowPass": "https://www.vtk.org/doc/nightly/html/classvtkOutlineGlowPass.html#details"}, "Python": {"OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass"}}, "vtkOutputWindow": {"Cxx": {"FileOutputWindow": "https://examples.vtk.org/site/Cxx/Utilities/FileOutputWindow"}, "VTKLink": {"vtkOutputWindow": "https://www.vtk.org/doc/nightly/html/classvtkOutputWindow.html#details"}}, "vtkOverlappingAMR": {"Cxx": {"Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR"}, "VTKLink": {"vtkOverlappingAMR": "https://www.vtk.org/doc/nightly/html/classvtkOverlappingAMR.html#details"}, "Python": {"OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR"}}, "vtkOverlayPass": {"Cxx": {"PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkOverlayPass": "https://www.vtk.org/doc/nightly/html/classvtkOverlayPass.html#details"}, "Python": {"PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParallelCoordinatesRepresentation": {"Cxx": {"ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView"}, "VTKLink": {"vtkParallelCoordinatesRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkParallelCoordinatesRepresentation.html#details"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView"}}, "vtkParallelCoordinatesView": {"Cxx": {"ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView"}, "VTKLink": {"vtkParallelCoordinatesView": "https://www.vtk.org/doc/nightly/html/classvtkParallelCoordinatesView.html#details"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView"}}, "vtkParametricBohemianDome": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricBohemianDome": "https://www.vtk.org/doc/nightly/html/classvtkParametricBohemianDome.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricBour": {"Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricBour": "https://www.vtk.org/doc/nightly/html/classvtkParametricBour.html#details"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricCatalanMinimal": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricCatalanMinimal": "https://www.vtk.org/doc/nightly/html/classvtkParametricCatalanMinimal.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricHenneberg": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricHenneberg": "https://www.vtk.org/doc/nightly/html/classvtkParametricHenneberg.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricKuen": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo"}, "VTKLink": {"vtkParametricKuen": "https://www.vtk.org/doc/nightly/html/classvtkParametricKuen.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo"}}, "vtkParametricPluckerConoid": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricPluckerConoid": "https://www.vtk.org/doc/nightly/html/classvtkParametricPluckerConoid.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricPseudosphere": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricPseudosphere": "https://www.vtk.org/doc/nightly/html/classvtkParametricPseudosphere.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkPassThrough": {"Cxx": {"PassThrough": "https://examples.vtk.org/site/Cxx/InfoVis/PassThrough"}, "VTKLink": {"vtkPassThrough": "https://www.vtk.org/doc/nightly/html/classvtkPassThrough.html#details"}, "Java": {"PassThrough": "https://examples.vtk.org/site/Java/InfoVis/PassThrough"}}, "vtkPath": {"Cxx": {"FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView"}, "VTKLink": {"vtkPath": "https://www.vtk.org/doc/nightly/html/classvtkPath.html#details"}}, "vtkPBRIrradianceTexture": {"Cxx": {"PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkPBRIrradianceTexture": "https://www.vtk.org/doc/nightly/html/classvtkPBRIrradianceTexture.html#details"}}, "vtkPCANormalEstimation": {"Cxx": {"SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface"}, "VTKLink": {"vtkPCANormalEstimation": "https://www.vtk.org/doc/nightly/html/classvtkPCANormalEstimation.html#details"}}, "vtkPCAStatistics": {"Cxx": {"PCAStatistics": "https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo"}, "VTKLink": {"vtkPCAStatistics": "https://www.vtk.org/doc/nightly/html/classvtkPCAStatistics.html#details"}}, "vtkPen": {"Cxx": {"Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D"}, "VTKLink": {"vtkPen": "https://www.vtk.org/doc/nightly/html/classvtkPen.html#details"}}, "vtkPentagonalPrism": {"Cxx": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration"}, "VTKLink": {"vtkPentagonalPrism": "https://www.vtk.org/doc/nightly/html/classvtkPentagonalPrism.html#details"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration"}}, "vtkPerlinNoise": {"Cxx": {"PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise"}, "VTKLink": {"vtkPerlinNoise": "https://www.vtk.org/doc/nightly/html/classvtkPerlinNoise.html#details"}, "Java": {"PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise"}, "Python": {"PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise"}}, "vtkPiecewiseFunction": {"Cxx": {"PiecewiseFunction": "https://examples.vtk.org/site/Cxx/Utilities/PiecewiseFunction", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "VTKLink": {"vtkPiecewiseFunction": "https://www.vtk.org/doc/nightly/html/classvtkPiecewiseFunction.html#details"}, "Java": {"PiecewiseFunction": "https://examples.vtk.org/site/Java/Utilities/PiecewiseFunction", "SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkPieChartActor": {"Cxx": {"PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor"}, "VTKLink": {"vtkPieChartActor": "https://www.vtk.org/doc/nightly/html/classvtkPieChartActor.html#details"}}, "vtkPixel": {"Cxx": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "VTKLink": {"vtkPixel": "https://www.vtk.org/doc/nightly/html/classvtkPixel.html#details"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkPKMeansStatistics": {"Cxx": {"PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering"}, "VTKLink": {"vtkPKMeansStatistics": "https://www.vtk.org/doc/nightly/html/classvtkPKMeansStatistics.html#details"}}, "vtkPlaneCollection": {"Cxx": {"ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface"}, "VTKLink": {"vtkPlaneCollection": "https://www.vtk.org/doc/nightly/html/classvtkPlaneCollection.html#details"}}, "vtkPlaneWidget": {"Cxx": {"PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget"}, "VTKLink": {"vtkPlaneWidget": "https://www.vtk.org/doc/nightly/html/classvtkPlaneWidget.html#details"}, "Java": {"PlaneWidget": "https://examples.vtk.org/site/Java/Widgets/PlaneWidget"}}, "vtkPlot": {"Cxx": {"BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkPlot": "https://www.vtk.org/doc/nightly/html/classvtkPlot.html#details"}}, "vtkPlotArea": {"Cxx": {"AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot"}, "VTKLink": {"vtkPlotArea": "https://www.vtk.org/doc/nightly/html/classvtkPlotArea.html#details"}}, "vtkPlotBar": {"Cxx": {"StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar"}, "VTKLink": {"vtkPlotBar": "https://www.vtk.org/doc/nightly/html/classvtkPlotBar.html#details"}}, "vtkPlotBox": {"Cxx": {"BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart"}, "VTKLink": {"vtkPlotBox": "https://www.vtk.org/doc/nightly/html/classvtkPlotBox.html#details"}}, "vtkPlotFunctionalBag": {"Cxx": {"FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot"}, "VTKLink": {"vtkPlotFunctionalBag": "https://www.vtk.org/doc/nightly/html/classvtkPlotFunctionalBag.html#details"}}, "vtkPlotLine3D": {"Cxx": {"PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D"}, "VTKLink": {"vtkPlotLine3D": "https://www.vtk.org/doc/nightly/html/classvtkPlotLine3D.html#details"}}, "vtkPlotPie": {"Cxx": {"PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart"}, "VTKLink": {"vtkPlotPie": "https://www.vtk.org/doc/nightly/html/classvtkPlotPie.html#details"}}, "vtkPlotPoints": {"Cxx": {"ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene"}, "VTKLink": {"vtkPlotPoints": "https://www.vtk.org/doc/nightly/html/classvtkPlotPoints.html#details"}, "Python": {"ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkPlotStacked": {"Cxx": {"StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot"}, "VTKLink": {"vtkPlotStacked": "https://www.vtk.org/doc/nightly/html/classvtkPlotStacked.html#details"}}, "vtkPlotSurface": {"Cxx": {"SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkPlotSurface": "https://www.vtk.org/doc/nightly/html/classvtkPlotSurface.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkPointData": {"Cxx": {"TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ReverseSense": "https://examples.vtk.org/site/Cxx/PolyData/ReverseSense", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "GetMiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "DetermineArrayDataTypes": "https://examples.vtk.org/site/Cxx/PolyData/DetermineArrayDataTypes", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "IterateImageData": "https://examples.vtk.org/site/Cxx/ImageData/IterateImageData", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageValueRange": "https://examples.vtk.org/site/Cxx/Images/ImageValueRange", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkPointData": "https://www.vtk.org/doc/nightly/html/classvtkPointData.html#details"}}, "vtkPointGaussianMapper": {"Cxx": {"PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator"}, "VTKLink": {"vtkPointGaussianMapper": "https://www.vtk.org/doc/nightly/html/classvtkPointGaussianMapper.html#details"}, "Python": {"PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkPointHandleRepresentation2D": {"Cxx": {"SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback"}, "VTKLink": {"vtkPointHandleRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkPointHandleRepresentation2D.html#details"}, "Java": {"SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget"}}, "vtkPointInterpolator": {"Cxx": {"InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator"}, "VTKLink": {"vtkPointInterpolator": "https://www.vtk.org/doc/nightly/html/classvtkPointInterpolator.html#details"}, "Python": {"PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkPointLoad": {"Cxx": {"HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids"}, "VTKLink": {"vtkPointLoad": "https://www.vtk.org/doc/nightly/html/classvtkPointLoad.html#details"}, "Python": {"HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids"}}, "vtkPointLocator": {"Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "PointLocatorRadius": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorRadius", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo"}, "VTKLink": {"vtkPointLocator": "https://www.vtk.org/doc/nightly/html/classvtkPointLocator.html#details"}}, "vtkPointOccupancyFilter": {"Cxx": {"PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy"}, "VTKLink": {"vtkPointOccupancyFilter": "https://www.vtk.org/doc/nightly/html/classvtkPointOccupancyFilter.html#details"}}, "vtkPointPicker": {"Cxx": {"PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex"}, "VTKLink": {"vtkPointPicker": "https://www.vtk.org/doc/nightly/html/classvtkPointPicker.html#details"}}, "vtkPointSet": {"Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces"}, "VTKLink": {"vtkPointSet": "https://www.vtk.org/doc/nightly/html/classvtkPointSet.html#details"}}, "vtkPointSetToLabelHierarchy": {"Cxx": {"LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper"}, "VTKLink": {"vtkPointSetToLabelHierarchy": "https://www.vtk.org/doc/nightly/html/classvtkPointSetToLabelHierarchy.html#details"}}, "vtkPointSource": {"Cxx": {"PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "MergePoints": "https://examples.vtk.org/site/Cxx/PolyData/MergePoints", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "PointLocatorRadius": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorRadius", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "KDTreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadius", "OctreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadius", "OctreeKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeKClosestPoints", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "ClosestNPoints": "https://examples.vtk.org/site/Cxx/DataStructures/ClosestNPoints"}, "VTKLink": {"vtkPointSource": "https://www.vtk.org/doc/nightly/html/classvtkPointSource.html#details"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree"}, "Python": {"PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera"}}, "vtkPointsProjectedHull": {"Cxx": {"PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull"}, "VTKLink": {"vtkPointsProjectedHull": "https://www.vtk.org/doc/nightly/html/classvtkPointsProjectedHull.html#details"}}, "vtkPointWidget": {"Cxx": {"Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor"}, "VTKLink": {"vtkPointWidget": "https://www.vtk.org/doc/nightly/html/classvtkPointWidget.html#details"}}, "vtkPolyDataCollection": {"Cxx": {"PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator"}, "VTKLink": {"vtkPolyDataCollection": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataCollection.html#details"}}, "vtkPolyDataMapper2D": {"Cxx": {"MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "VTKLink": {"vtkPolyDataMapper2D": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataMapper2D.html#details"}, "Java": {"MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D"}, "Python": {"MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkPolyDataNormals": {"Cxx": {"PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}, "VTKLink": {"vtkPolyDataNormals": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataNormals.html#details"}, "Java": {"SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkPolyDataPointSampler": {"Cxx": {"PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler"}, "VTKLink": {"vtkPolyDataPointSampler": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataPointSampler.html#details"}}, "vtkPolyDataReader": {"Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision"}, "VTKLink": {"vtkPolyDataReader": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataReader.html#details"}, "Java": {"SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkPolyDataSilhouette": {"Cxx": {"Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette"}, "VTKLink": {"vtkPolyDataSilhouette": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataSilhouette.html#details"}, "Python": {"HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette"}}, "vtkPolyDataTangents": {"Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkPolyDataTangents": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataTangents.html#details"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}}, "vtkPolyDataToImageStencil": {"Cxx": {"PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour"}, "VTKLink": {"vtkPolyDataToImageStencil": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataToImageStencil.html#details"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil"}}, "vtkPolyhedron": {"Cxx": {"Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron"}, "VTKLink": {"vtkPolyhedron": "https://www.vtk.org/doc/nightly/html/classvtkPolyhedron.html#details"}, "Python": {"Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron"}}, "vtkPolyVertex": {"Cxx": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "VTKLink": {"vtkPolyVertex": "https://www.vtk.org/doc/nightly/html/classvtkPolyVertex.html#details"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkPostScriptWriter": {"Cxx": {"ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter"}, "VTKLink": {"vtkPostScriptWriter": "https://www.vtk.org/doc/nightly/html/classvtkPostScriptWriter.html#details"}, "Python": {"ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi"}}, "vtkProbeFilter": {"Cxx": {"InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "VTKLink": {"vtkProbeFilter": "https://www.vtk.org/doc/nightly/html/classvtkProbeFilter.html#details"}, "Java": {"RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe"}, "Python": {"ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens"}}, "vtkProcrustesAlignmentFilter": {"Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter"}, "VTKLink": {"vtkProcrustesAlignmentFilter": "https://www.vtk.org/doc/nightly/html/classvtkProcrustesAlignmentFilter.html#details"}}, "vtkProgrammableFilter": {"Cxx": {"DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter"}, "VTKLink": {"vtkProgrammableFilter": "https://www.vtk.org/doc/nightly/html/classvtkProgrammableFilter.html#details"}}, "vtkProgrammableGlyphFilter": {"Cxx": {"ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter"}, "VTKLink": {"vtkProgrammableGlyphFilter": "https://www.vtk.org/doc/nightly/html/classvtkProgrammableGlyphFilter.html#details"}, "Python": {"ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs"}}, "vtkProgrammableSource": {"Cxx": {"ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource"}, "VTKLink": {"vtkProgrammableSource": "https://www.vtk.org/doc/nightly/html/classvtkProgrammableSource.html#details"}}, "vtkProjectedTexture": {"Cxx": {"ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture"}, "VTKLink": {"vtkProjectedTexture": "https://www.vtk.org/doc/nightly/html/classvtkProjectedTexture.html#details"}}, "vtkProjectSphereFilter": {"Cxx": {"ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere"}, "VTKLink": {"vtkProjectSphereFilter": "https://www.vtk.org/doc/nightly/html/classvtkProjectSphereFilter.html#details"}, "Java": {"ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere"}}, "vtkProp": {"Cxx": {"ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion"}, "VTKLink": {"vtkProp": "https://www.vtk.org/doc/nightly/html/classvtkProp.html#details"}}, "vtkProp3D": {"Cxx": {"AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView"}, "VTKLink": {"vtkProp3D": "https://www.vtk.org/doc/nightly/html/classvtkProp3D.html#details"}, "Python": {"OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder"}}, "vtkProp3DButtonRepresentation": {"Cxx": {"EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton"}, "VTKLink": {"vtkProp3DButtonRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkProp3DButtonRepresentation.html#details"}}, "vtkProp3DCollection": {"Cxx": {"AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking"}, "VTKLink": {"vtkProp3DCollection": "https://www.vtk.org/doc/nightly/html/classvtkProp3DCollection.html#details"}}, "vtkPropAssembly": {"Cxx": {"AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView"}, "VTKLink": {"vtkPropAssembly": "https://www.vtk.org/doc/nightly/html/classvtkPropAssembly.html#details"}, "Python": {"AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView"}}, "vtkPropCollection": {"Cxx": {"MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game"}, "VTKLink": {"vtkPropCollection": "https://www.vtk.org/doc/nightly/html/classvtkPropCollection.html#details"}, "Java": {"Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly"}}, "vtkProperty2D": {"Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkProperty2D": "https://www.vtk.org/doc/nightly/html/classvtkProperty2D.html#details"}}, "vtkPropPicker": {"Cxx": {"PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking"}, "VTKLink": {"vtkPropPicker": "https://www.vtk.org/doc/nightly/html/classvtkPropPicker.html#details"}, "Python": {"HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor"}}, "vtkProteinRibbonFilter": {"Cxx": {"ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons"}, "VTKLink": {"vtkProteinRibbonFilter": "https://www.vtk.org/doc/nightly/html/classvtkProteinRibbonFilter.html#details"}, "Java": {"ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons"}}, "vtkQImageToImageSource": {"Cxx": {"QImageToImageSource": "https://examples.vtk.org/site/Cxx/Qt/QImageToImageSource"}, "VTKLink": {"vtkQImageToImageSource": "https://www.vtk.org/doc/nightly/html/classvtkQImageToImageSource.html#details"}}, "vtkQuadraticEdge": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticEdge": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticEdge.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticHexahedron": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo"}, "VTKLink": {"vtkQuadraticHexahedron": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticHexahedron.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo"}}, "vtkQuadraticLinearQuad": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticLinearQuad": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticLinearQuad.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticLinearWedge": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticLinearWedge": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticLinearWedge.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticPolygon": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticPolygon": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticPolygon.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticPyramid": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticPyramid": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticPyramid.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticQuad": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticQuad": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticQuad.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticTetra": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra"}, "VTKLink": {"vtkQuadraticTetra": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticTetra.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra"}}, "vtkQuadraticTriangle": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticTriangle": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticTriangle.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticWedge": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticWedge": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticWedge.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadric": {"Cxx": {"ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud"}, "VTKLink": {"vtkQuadric": "https://www.vtk.org/doc/nightly/html/classvtkQuadric.html#details"}, "Python": {"ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud"}}, "vtkQuadricLODActor": {"Cxx": {"QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor"}, "VTKLink": {"vtkQuadricLODActor": "https://www.vtk.org/doc/nightly/html/classvtkQuadricLODActor.html#details"}}, "vtkQuantizePolyDataPoints": {"Cxx": {"QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints"}, "VTKLink": {"vtkQuantizePolyDataPoints": "https://www.vtk.org/doc/nightly/html/classvtkQuantizePolyDataPoints.html#details"}}, "vtkRadiusOutlierRemoval": {"Cxx": {"RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval"}, "VTKLink": {"vtkRadiusOutlierRemoval": "https://www.vtk.org/doc/nightly/html/classvtkRadiusOutlierRemoval.html#details"}}, "vtkRandomGraphSource": {"Cxx": {"RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource"}, "VTKLink": {"vtkRandomGraphSource": "https://www.vtk.org/doc/nightly/html/classvtkRandomGraphSource.html#details"}, "Java": {"RandomGraphSource": "https://examples.vtk.org/site/Java/Graphs/RandomGraphSource", "SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "Python": {"SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/SelectedVerticesAndEdges", "RandomGraphSource": "https://examples.vtk.org/site/Python/Graphs/RandomGraphSource"}}, "vtkRectf": {"Cxx": {"SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene"}, "VTKLink": {"vtkRectf": "https://www.vtk.org/doc/nightly/html/classvtkRectf.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkRectilinearGrid": {"Cxx": {"DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "VTKLink": {"vtkRectilinearGrid": "https://www.vtk.org/doc/nightly/html/classvtkRectilinearGrid.html#details"}, "Java": {"VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGridToTetrahedra"}, "Python": {"RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkRectilinearGridGeometryFilter": {"Cxx": {"RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "VTKLink": {"vtkRectilinearGridGeometryFilter": "https://www.vtk.org/doc/nightly/html/classvtkRectilinearGridGeometryFilter.html#details"}, "Python": {"RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkRectilinearGridToTetrahedra": {"Cxx": {"RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra"}, "VTKLink": {"vtkRectilinearGridToTetrahedra": "https://www.vtk.org/doc/nightly/html/classvtkRectilinearGridToTetrahedra.html#details"}, "Java": {"RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGridToTetrahedra"}}, "vtkRectilinearWipeRepresentation": {"Cxx": {"RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget"}, "VTKLink": {"vtkRectilinearWipeRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkRectilinearWipeRepresentation.html#details"}}, "vtkRectilinearWipeWidget": {"Cxx": {"RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget"}, "VTKLink": {"vtkRectilinearWipeWidget": "https://www.vtk.org/doc/nightly/html/classvtkRectilinearWipeWidget.html#details"}}, "vtkReflectionFilter": {"Cxx": {"Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection"}, "VTKLink": {"vtkReflectionFilter": "https://www.vtk.org/doc/nightly/html/classvtkReflectionFilter.html#details"}, "Java": {"Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection"}}, "vtkRemoveIsolatedVertices": {"Cxx": {"RemoveIsolatedVertices": "https://examples.vtk.org/site/Cxx/Graphs/RemoveIsolatedVertices"}, "VTKLink": {"vtkRemoveIsolatedVertices": "https://www.vtk.org/doc/nightly/html/classvtkRemoveIsolatedVertices.html#details"}}, "vtkRenderedGraphRepresentation": {"Cxx": {"SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges"}, "VTKLink": {"vtkRenderedGraphRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkRenderedGraphRepresentation.html#details"}, "Python": {"ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "ColorVertexLabels": "https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels"}}, "vtkRendererCollection": {"Cxx": {"CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground"}, "VTKLink": {"vtkRendererCollection": "https://www.vtk.org/doc/nightly/html/classvtkRendererCollection.html#details"}}, "vtkRenderLargeImage": {"Cxx": {"PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage"}, "VTKLink": {"vtkRenderLargeImage": "https://www.vtk.org/doc/nightly/html/classvtkRenderLargeImage.html#details"}, "Python": {"PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision"}}, "vtkRenderPassCollection": {"Cxx": {"RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkRenderPassCollection": "https://www.vtk.org/doc/nightly/html/classvtkRenderPassCollection.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkRenderStepsPass": {"Cxx": {"OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows"}, "VTKLink": {"vtkRenderStepsPass": "https://www.vtk.org/doc/nightly/html/classvtkRenderStepsPass.html#details"}, "Python": {"OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur"}}, "vtkRenderView": {"Cxx": {"RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView"}, "VTKLink": {"vtkRenderView": "https://www.vtk.org/doc/nightly/html/classvtkRenderView.html#details"}, "Java": {"RenderView": "https://examples.vtk.org/site/Java/Views/RenderView"}}, "vtkRenderWidget": {"Cxx": {"MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp"}, "VTKLink": {"vtkRenderWidget": "https://www.vtk.org/doc/nightly/html/classvtkRenderWidget.html#details"}}, "vtkRenderWindowInteractor": {"Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkRenderWindowInteractor": "https://www.vtk.org/doc/nightly/html/classvtkRenderWindowInteractor.html#details"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "ImageSinusoidSource": "https://examples.vtk.org/site/Java/Images/ImageSinusoidSource", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "StaticImage": "https://examples.vtk.org/site/Java/Images/StaticImage", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "SplineWidget": "https://examples.vtk.org/site/Java/Widgets/SplineWidget", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "AngleWidget": "https://examples.vtk.org/site/Java/Widgets/AngleWidget", "PlaneWidget": "https://examples.vtk.org/site/Java/Widgets/PlaneWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "DistanceWidget": "https://examples.vtk.org/site/Java/Widgets/DistanceWidget", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "ReadBMP": "https://examples.vtk.org/site/Java/IO/ReadBMP", "JPEGReader": "https://examples.vtk.org/site/Java/IO/JPEGReader", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "PNGReader": "https://examples.vtk.org/site/Java/IO/PNGReader", "ReadPNM": "https://examples.vtk.org/site/Java/IO/ReadPNM", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "ReadDICOM": "https://examples.vtk.org/site/Java/IO/ReadDICOM", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "ReadTIFF": "https://examples.vtk.org/site/Java/IO/ReadTIFF", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "TextActor": "https://examples.vtk.org/site/Java/GeometricObjects/TextActor", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "SphereWidget": "https://examples.vtk.org/site/Python/Widgets/SphereWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "HDRReader": "https://examples.vtk.org/site/Python/IO/HDRReader", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "ReadDICOM": "https://examples.vtk.org/site/Python/IO/ReadDICOM", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "AnnotatedCubeActor": "https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TextActor": "https://examples.vtk.org/site/Python/GeometricObjects/TextActor", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkReverseSense": {"Cxx": {"ReverseSense": "https://examples.vtk.org/site/Cxx/PolyData/ReverseSense", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs"}, "VTKLink": {"vtkReverseSense": "https://www.vtk.org/doc/nightly/html/classvtkReverseSense.html#details"}, "Python": {"ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkRibbonFilter": {"Cxx": {"RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget"}, "VTKLink": {"vtkRibbonFilter": "https://www.vtk.org/doc/nightly/html/classvtkRibbonFilter.html#details"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter"}, "Python": {"Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget"}}, "vtkRIBExporter": {"Cxx": {"PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB"}, "VTKLink": {"vtkRIBExporter": "https://www.vtk.org/doc/nightly/html/classvtkRIBExporter.html#details"}}, "vtkRIBProperty": {"Cxx": {"PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB"}, "VTKLink": {"vtkRIBProperty": "https://www.vtk.org/doc/nightly/html/classvtkRIBProperty.html#details"}}, "vtkRotationalExtrusionFilter": {"Cxx": {"CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere"}, "VTKLink": {"vtkRotationalExtrusionFilter": "https://www.vtk.org/doc/nightly/html/classvtkRotationalExtrusionFilter.html#details"}, "Java": {"Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring"}, "Python": {"CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere"}}, "vtkRTAnalyticSource": {"Cxx": {"ImplicitDataSet": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitDataSet", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource"}, "VTKLink": {"vtkRTAnalyticSource": "https://www.vtk.org/doc/nightly/html/classvtkRTAnalyticSource.html#details"}, "Java": {"ImplicitDataSet": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitDataSet", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes"}}, "vtkRuledSurfaceFilter": {"Cxx": {"RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine"}, "VTKLink": {"vtkRuledSurfaceFilter": "https://www.vtk.org/doc/nightly/html/classvtkRuledSurfaceFilter.html#details"}, "Java": {"RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter"}, "Python": {"RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter"}}, "vtkRungeKutta4": {"Cxx": {"StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube"}, "VTKLink": {"vtkRungeKutta4": "https://www.vtk.org/doc/nightly/html/classvtkRungeKutta4.html#details"}, "Python": {"StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube"}}, "vtkSampleImplicitFunctionFilter": {"Cxx": {"MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter"}, "VTKLink": {"vtkSampleImplicitFunctionFilter": "https://www.vtk.org/doc/nightly/html/classvtkSampleImplicitFunctionFilter.html#details"}}, "vtkScalarBarActor": {"Cxx": {"CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance"}, "VTKLink": {"vtkScalarBarActor": "https://www.vtk.org/doc/nightly/html/classvtkScalarBarActor.html#details"}, "Java": {"ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkScalarBarWidget": {"Cxx": {"ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget"}, "VTKLink": {"vtkScalarBarWidget": "https://www.vtk.org/doc/nightly/html/classvtkScalarBarWidget.html#details"}, "Python": {"ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget"}}, "vtkScalarsToColors": {"Cxx": {"ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene"}, "VTKLink": {"vtkScalarsToColors": "https://www.vtk.org/doc/nightly/html/classvtkScalarsToColors.html#details"}}, "vtkSCurveSpline": {"Cxx": {"SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline"}, "VTKLink": {"vtkSCurveSpline": "https://www.vtk.org/doc/nightly/html/classvtkSCurveSpline.html#details"}}, "vtkSeedRepresentation": {"Cxx": {"SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback"}, "VTKLink": {"vtkSeedRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkSeedRepresentation.html#details"}, "Java": {"SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget"}}, "vtkSeedWidget": {"Cxx": {"SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback"}, "VTKLink": {"vtkSeedWidget": "https://www.vtk.org/doc/nightly/html/classvtkSeedWidget.html#details"}, "Java": {"SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget"}}, "vtkSelectEnclosedPoints": {"Cxx": {"CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game"}, "VTKLink": {"vtkSelectEnclosedPoints": "https://www.vtk.org/doc/nightly/html/classvtkSelectEnclosedPoints.html#details"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject"}}, "vtkSelectionSource": {"Cxx": {"SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource"}, "VTKLink": {"vtkSelectionSource": "https://www.vtk.org/doc/nightly/html/classvtkSelectionSource.html#details"}}, "vtkSelectVisiblePoints": {"Cxx": {"SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh"}, "VTKLink": {"vtkSelectVisiblePoints": "https://www.vtk.org/doc/nightly/html/classvtkSelectVisiblePoints.html#details"}}, "vtkSequencePass": {"Cxx": {"RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkSequencePass": "https://www.vtk.org/doc/nightly/html/classvtkSequencePass.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkShader": {"Cxx": {"BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal"}, "VTKLink": {"vtkShader": "https://www.vtk.org/doc/nightly/html/classvtkShader.html#details"}}, "vtkShaderProgram": {"Cxx": {"BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader"}, "VTKLink": {"vtkShaderProgram": "https://www.vtk.org/doc/nightly/html/classvtkShaderProgram.html#details"}}, "vtkShaderProperty": {"Cxx": {"BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal"}, "VTKLink": {"vtkShaderProperty": "https://www.vtk.org/doc/nightly/html/classvtkShaderProperty.html#details"}}, "vtkShadowMapBakerPass": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows"}, "VTKLink": {"vtkShadowMapBakerPass": "https://www.vtk.org/doc/nightly/html/classvtkShadowMapBakerPass.html#details"}}, "vtkShadowMapPass": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows"}, "VTKLink": {"vtkShadowMapPass": "https://www.vtk.org/doc/nightly/html/classvtkShadowMapPass.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows"}}, "vtkShepardMethod": {"Cxx": {"ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation"}, "VTKLink": {"vtkShepardMethod": "https://www.vtk.org/doc/nightly/html/classvtkShepardMethod.html#details"}}, "vtkShortArray": {"Cxx": {"Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz"}, "VTKLink": {"vtkShortArray": "https://www.vtk.org/doc/nightly/html/classvtkShortArray.html#details"}, "Python": {"Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz"}}, "vtkShrinkFilter": {"Cxx": {"IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid"}, "VTKLink": {"vtkShrinkFilter": "https://www.vtk.org/doc/nightly/html/classvtkShrinkFilter.html#details"}, "Java": {"HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid"}, "Python": {"HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid"}}, "vtkSignedDistance": {"Cxx": {"ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface"}, "VTKLink": {"vtkSignedDistance": "https://www.vtk.org/doc/nightly/html/classvtkSignedDistance.html#details"}}, "vtkSimple2DLayoutStrategy": {"Cxx": {"XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph"}, "VTKLink": {"vtkSimple2DLayoutStrategy": "https://www.vtk.org/doc/nightly/html/classvtkSimple2DLayoutStrategy.html#details"}, "Java": {"VisualizeGraph": "https://examples.vtk.org/site/Java/Graphs/VisualizeGraph"}, "Python": {"SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph"}}, "vtkSimpleMotionBlurPass": {"Cxx": {"MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur"}, "VTKLink": {"vtkSimpleMotionBlurPass": "https://www.vtk.org/doc/nightly/html/classvtkSimpleMotionBlurPass.html#details"}, "Python": {"MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur"}}, "vtkSimplePointsWriter": {"Cxx": {"SimplePointsWriter": "https://examples.vtk.org/site/Cxx/IO/SimplePointsWriter"}, "VTKLink": {"vtkSimplePointsWriter": "https://www.vtk.org/doc/nightly/html/classvtkSimplePointsWriter.html#details"}, "Java": {"SimplePointsWriter": "https://examples.vtk.org/site/Java/IO/SimplePointsWriter"}}, "vtkSkybox": {"Cxx": {"SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkSkybox": "https://www.vtk.org/doc/nightly/html/classvtkSkybox.html#details"}, "Python": {"PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}}, "vtkSLCReader": {"Cxx": {"IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC"}, "VTKLink": {"vtkSLCReader": "https://www.vtk.org/doc/nightly/html/classvtkSLCReader.html#details"}, "Java": {"ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC"}, "Python": {"ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC"}}, "vtkSliderRepresentation": {"Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree"}, "VTKLink": {"vtkSliderRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkSliderRepresentation.html#details"}, "Java": {"VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree"}}, "vtkSliderRepresentation2D": {"Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkSliderRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkSliderRepresentation2D.html#details"}, "Java": {"VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree"}, "Python": {"FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkSliderRepresentation3D": {"Cxx": {"IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider"}, "VTKLink": {"vtkSliderRepresentation3D": "https://www.vtk.org/doc/nightly/html/classvtkSliderRepresentation3D.html#details"}}, "vtkSliderWidget": {"Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkSliderWidget": "https://www.vtk.org/doc/nightly/html/classvtkSliderWidget.html#details"}, "Java": {"VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree"}, "Python": {"FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkSmartPointer": {"Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "DeletePoint": "https://examples.vtk.org/site/Cxx/PolyData/DeletePoint", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "DataBounds": "https://examples.vtk.org/site/Cxx/PolyData/DataBounds", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "PolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/PolyDataFilter", "PolyDataAlgorithmReader": "https://examples.vtk.org/site/Cxx/Developers/PolyDataAlgorithmReader", "Warnings": "https://examples.vtk.org/site/Cxx/Developers/Warnings", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "ImageAccumulate": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulate", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "ImageDataToQImage": "https://examples.vtk.org/site/Cxx/Qt/ImageDataToQImage", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation"}, "VTKLink": {"vtkSmartPointer": "https://www.vtk.org/doc/nightly/html/classvtkSmartPointer.html#details"}}, "vtkSmartVolumeMapper": {"Cxx": {"OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume"}, "VTKLink": {"vtkSmartVolumeMapper": "https://www.vtk.org/doc/nightly/html/classvtkSmartVolumeMapper.html#details"}}, "vtkSmoothPolyDataFilter": {"Cxx": {"SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap"}, "VTKLink": {"vtkSmoothPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkSmoothPolyDataFilter.html#details"}, "Java": {"ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap"}}, "vtkSortDataArray": {"Cxx": {"SortDataArray": "https://examples.vtk.org/site/Cxx/Utilities/SortDataArray"}, "VTKLink": {"vtkSortDataArray": "https://www.vtk.org/doc/nightly/html/classvtkSortDataArray.html#details"}}, "vtkSparseArray": {"Cxx": {"SparseArray": "https://examples.vtk.org/site/Cxx/Utilities/SparseArray"}, "VTKLink": {"vtkSparseArray": "https://www.vtk.org/doc/nightly/html/classvtkSparseArray.html#details"}}, "vtkSphereRepresentation": {"Cxx": {"SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2"}, "VTKLink": {"vtkSphereRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkSphereRepresentation.html#details"}}, "vtkSphereWidget": {"Cxx": {"SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget"}, "VTKLink": {"vtkSphereWidget": "https://www.vtk.org/doc/nightly/html/classvtkSphereWidget.html#details"}, "Python": {"SphereWidget": "https://examples.vtk.org/site/Python/Widgets/SphereWidget"}}, "vtkSphereWidget2": {"Cxx": {"SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2"}, "VTKLink": {"vtkSphereWidget2": "https://www.vtk.org/doc/nightly/html/classvtkSphereWidget2.html#details"}}, "vtkSpiderPlotActor": {"Cxx": {"SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot"}, "VTKLink": {"vtkSpiderPlotActor": "https://www.vtk.org/doc/nightly/html/classvtkSpiderPlotActor.html#details"}, "Python": {"SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot"}}, "vtkSplineFilter": {"Cxx": {"ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation"}, "VTKLink": {"vtkSplineFilter": "https://www.vtk.org/doc/nightly/html/classvtkSplineFilter.html#details"}}, "vtkSplineWidget2": {"Cxx": {"SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget"}, "VTKLink": {"vtkSplineWidget2": "https://www.vtk.org/doc/nightly/html/classvtkSplineWidget2.html#details"}, "Java": {"SplineWidget": "https://examples.vtk.org/site/Java/Widgets/SplineWidget"}}, "vtkStaticPointLocator": {"Cxx": {"StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "VTKLink": {"vtkStaticPointLocator": "https://www.vtk.org/doc/nightly/html/classvtkStaticPointLocator.html#details"}}, "vtkStatisticsAlgorithm": {"Cxx": {"KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "PCAStatistics": "https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart"}, "VTKLink": {"vtkStatisticsAlgorithm": "https://www.vtk.org/doc/nightly/html/classvtkStatisticsAlgorithm.html#details"}}, "vtkStdString": {"Cxx": {"ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "ArrayWriter": "https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "VTKLink": {"vtkStdString": "https://www.vtk.org/doc/nightly/html/classvtkStdString.html#details"}}, "vtkSTLWriter": {"Cxx": {"WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL"}, "VTKLink": {"vtkSTLWriter": "https://www.vtk.org/doc/nightly/html/classvtkSTLWriter.html#details"}, "Java": {"WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL"}, "Python": {"WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL"}}, "vtkStreamingDemandDrivenPipeline": {"Cxx": {"vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip"}, "VTKLink": {"vtkStreamingDemandDrivenPipeline": "https://www.vtk.org/doc/nightly/html/classvtkStreamingDemandDrivenPipeline.html#details"}}, "vtkStreamTracer": {"Cxx": {"FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines"}, "VTKLink": {"vtkStreamTracer": "https://www.vtk.org/doc/nightly/html/classvtkStreamTracer.html#details"}, "Python": {"OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines"}}, "vtkStringArray": {"Cxx": {"ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper"}, "VTKLink": {"vtkStringArray": "https://www.vtk.org/doc/nightly/html/classvtkStringArray.html#details"}, "Python": {"CreateTree": "https://examples.vtk.org/site/Python/Graphs/CreateTree", "Variant": "https://examples.vtk.org/site/Python/Utilities/Variant", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData"}}, "vtkStructuredData": {"Cxx": {"IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "CellIdFromGridCoordinates": "https://examples.vtk.org/site/Cxx/ImageData/CellIdFromGridCoordinates", "GetLinearPointId": "https://examples.vtk.org/site/Cxx/StructuredGrid/GetLinearPointId"}, "VTKLink": {"vtkStructuredData": "https://www.vtk.org/doc/nightly/html/classvtkStructuredData.html#details"}}, "vtkStructuredGridOutlineFilter": {"Cxx": {"XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow"}, "VTKLink": {"vtkStructuredGridOutlineFilter": "https://www.vtk.org/doc/nightly/html/classvtkStructuredGridOutlineFilter.html#details"}, "Java": {"StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline"}, "Python": {"ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow"}}, "vtkStructuredGridReader": {"Cxx": {"Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen"}, "VTKLink": {"vtkStructuredGridReader": "https://www.vtk.org/doc/nightly/html/classvtkStructuredGridReader.html#details"}, "Python": {"Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen"}}, "vtkStructuredPoints": {"Cxx": {"CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid"}, "VTKLink": {"vtkStructuredPoints": "https://www.vtk.org/doc/nightly/html/classvtkStructuredPoints.html#details"}, "Java": {"Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Java/StructuredPoints/StructuredPointsToUnstructuredGrid"}, "Python": {"Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol"}}, "vtkSubPixelPositionEdgels": {"Cxx": {"CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector"}, "VTKLink": {"vtkSubPixelPositionEdgels": "https://www.vtk.org/doc/nightly/html/classvtkSubPixelPositionEdgels.html#details"}}, "vtkSuperquadric": {"Cxx": {"SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkSuperquadric": "https://www.vtk.org/doc/nightly/html/classvtkSuperquadric.html#details"}, "Java": {"SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction"}, "Python": {"SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction"}}, "vtkSurfaceReconstructionFilter": {"Cxx": {"SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints"}, "VTKLink": {"vtkSurfaceReconstructionFilter": "https://www.vtk.org/doc/nightly/html/classvtkSurfaceReconstructionFilter.html#details"}}, "vtkTable": {"Cxx": {"DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "ArrayToTable": "https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable", "DelimitedTextWriter": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable", "PCAStatistics": "https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics", "ConstructTable": "https://examples.vtk.org/site/Cxx/Utilities/ConstructTable", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkTable": "https://www.vtk.org/doc/nightly/html/classvtkTable.html#details"}, "Python": {"ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkTableBasedClipDataSet": {"Cxx": {"ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "VTKLink": {"vtkTableBasedClipDataSet": "https://www.vtk.org/doc/nightly/html/classvtkTableBasedClipDataSet.html#details"}, "Python": {"ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane"}}, "vtkTableToPolyData": {"Cxx": {"PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator"}, "VTKLink": {"vtkTableToPolyData": "https://www.vtk.org/doc/nightly/html/classvtkTableToPolyData.html#details"}, "Python": {"CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkTensorGlyph": {"Cxx": {"TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph"}, "VTKLink": {"vtkTensorGlyph": "https://www.vtk.org/doc/nightly/html/classvtkTensorGlyph.html#details"}, "Python": {"TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids"}}, "vtkTessellatedBoxSource": {"Cxx": {"OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource"}, "VTKLink": {"vtkTessellatedBoxSource": "https://www.vtk.org/doc/nightly/html/classvtkTessellatedBoxSource.html#details"}, "Python": {"TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource"}}, "vtkTessellatorFilter": {"Cxx": {"QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource"}, "VTKLink": {"vtkTessellatorFilter": "https://www.vtk.org/doc/nightly/html/classvtkTessellatorFilter.html#details"}, "Python": {"QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource"}}, "vtkTextActor": {"Cxx": {"TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids"}, "VTKLink": {"vtkTextActor": "https://www.vtk.org/doc/nightly/html/classvtkTextActor.html#details"}, "Java": {"TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "TextActor": "https://examples.vtk.org/site/Java/GeometricObjects/TextActor"}, "Python": {"TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "TextActor": "https://examples.vtk.org/site/Python/GeometricObjects/TextActor"}}, "vtkTextRepresentation": {"Cxx": {"TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget"}, "VTKLink": {"vtkTextRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkTextRepresentation.html#details"}, "Java": {"TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget"}, "Python": {"TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget"}}, "vtkTextSource": {"Cxx": {"TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo"}, "VTKLink": {"vtkTextSource": "https://www.vtk.org/doc/nightly/html/classvtkTextSource.html#details"}, "Python": {"TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo"}}, "vtkTexture": {"Cxx": {"DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkTexture": "https://www.vtk.org/doc/nightly/html/classvtkTexture.html#details"}, "Java": {"TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere"}, "Python": {"DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}}, "vtkTexturedButtonRepresentation2D": {"Cxx": {"TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget"}, "VTKLink": {"vtkTexturedButtonRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkTexturedButtonRepresentation2D.html#details"}}, "vtkTexturedSphereSource": {"Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkTexturedSphereSource": "https://www.vtk.org/doc/nightly/html/classvtkTexturedSphereSource.html#details"}, "Java": {"TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkTextureMapToPlane": {"Cxx": {"TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt"}, "VTKLink": {"vtkTextureMapToPlane": "https://www.vtk.org/doc/nightly/html/classvtkTextureMapToPlane.html#details"}}, "vtkTextureMapToSphere": {"Cxx": {"TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkTextureMapToSphere": "https://www.vtk.org/doc/nightly/html/classvtkTextureMapToSphere.html#details"}, "Python": {"SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}}, "vtkTextWidget": {"Cxx": {"TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget"}, "VTKLink": {"vtkTextWidget": "https://www.vtk.org/doc/nightly/html/classvtkTextWidget.html#details"}, "Java": {"TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget"}, "Python": {"TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget"}}, "vtkThinPlateSplineTransform": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform"}, "VTKLink": {"vtkThinPlateSplineTransform": "https://www.vtk.org/doc/nightly/html/classvtkThinPlateSplineTransform.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform"}}, "vtkThresholdTextureCoords": {"Cxx": {"TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold"}, "VTKLink": {"vtkThresholdTextureCoords": "https://www.vtk.org/doc/nightly/html/classvtkThresholdTextureCoords.html#details"}, "Python": {"TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold"}}, "vtkTimerLog": {"Cxx": {"TimerLog": "https://examples.vtk.org/site/Cxx/Utilities/TimerLog", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo"}, "VTKLink": {"vtkTimerLog": "https://www.vtk.org/doc/nightly/html/classvtkTimerLog.html#details"}, "Java": {"TimerLog": "https://examples.vtk.org/site/Java/Utilities/TimerLog"}}, "vtkTimeSourceExample": {"Cxx": {"ExodusIIWriter": "https://examples.vtk.org/site/Cxx/Parallel/ExodusIIWriter"}, "VTKLink": {"vtkTimeSourceExample": "https://www.vtk.org/doc/nightly/html/classvtkTimeSourceExample.html#details"}, "Java": {"ExodusIIWriter": "https://examples.vtk.org/site/Java/Parallel/ExodusIIWriter"}}, "vtkTimeStamp": {"Cxx": {"TimeStamp": "https://examples.vtk.org/site/Cxx/Utilities/TimeStamp"}, "VTKLink": {"vtkTimeStamp": "https://www.vtk.org/doc/nightly/html/classvtkTimeStamp.html#details"}}, "vtkToneMappingPass": {"Cxx": {"PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkToneMappingPass": "https://www.vtk.org/doc/nightly/html/classvtkToneMappingPass.html#details"}, "Python": {"PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkTransformTextureCoords": {"Cxx": {"TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere"}, "VTKLink": {"vtkTransformTextureCoords": "https://www.vtk.org/doc/nightly/html/classvtkTransformTextureCoords.html#details"}, "Java": {"TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere"}}, "vtkTree": {"Cxx": {"BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "TreeToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/TreeToMutableDirectedGraph", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "TreeBFSIterator": "https://examples.vtk.org/site/Cxx/Graphs/TreeBFSIterator", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator"}, "VTKLink": {"vtkTree": "https://www.vtk.org/doc/nightly/html/classvtkTree.html#details"}, "Python": {"ConstructTree": "https://examples.vtk.org/site/Python/Graphs/ConstructTree", "CreateTree": "https://examples.vtk.org/site/Python/Graphs/CreateTree"}}, "vtkTreeBFSIterator": {"Cxx": {"TreeBFSIterator": "https://examples.vtk.org/site/Cxx/Graphs/TreeBFSIterator"}, "VTKLink": {"vtkTreeBFSIterator": "https://www.vtk.org/doc/nightly/html/classvtkTreeBFSIterator.html#details"}}, "vtkTreeDFSIterator": {"Cxx": {"DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator"}, "VTKLink": {"vtkTreeDFSIterator": "https://www.vtk.org/doc/nightly/html/classvtkTreeDFSIterator.html#details"}}, "vtkTreeMapView": {"Cxx": {"TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView"}, "VTKLink": {"vtkTreeMapView": "https://www.vtk.org/doc/nightly/html/classvtkTreeMapView.html#details"}}, "vtkTriangleMeshPointNormals": {"Cxx": {"BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal"}, "VTKLink": {"vtkTriangleMeshPointNormals": "https://www.vtk.org/doc/nightly/html/classvtkTriangleMeshPointNormals.html#details"}}, "vtkTriQuadraticHexahedron": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkTriQuadraticHexahedron": "https://www.vtk.org/doc/nightly/html/classvtkTriQuadraticHexahedron.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkTupleInterpolator": {"Cxx": {"TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "1DTupleInterpolation": "https://examples.vtk.org/site/Cxx/Math/1DTupleInterpolation"}, "VTKLink": {"vtkTupleInterpolator": "https://www.vtk.org/doc/nightly/html/classvtkTupleInterpolator.html#details"}}, "vtkUniformGrid": {"Cxx": {"Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR"}, "VTKLink": {"vtkUniformGrid": "https://www.vtk.org/doc/nightly/html/classvtkUniformGrid.html#details"}, "Python": {"OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR"}}, "vtkUnsignedDistance": {"Cxx": {"UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance"}, "VTKLink": {"vtkUnsignedDistance": "https://www.vtk.org/doc/nightly/html/classvtkUnsignedDistance.html#details"}}, "vtkUnstructuredGridToExplicitStructuredGrid": {"Cxx": {"CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid"}, "VTKLink": {"vtkUnstructuredGridToExplicitStructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGridToExplicitStructuredGrid.html#details"}, "Python": {"CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid"}}, "vtkUnstructuredGridVolumeRayCastMapper": {"Cxx": {"IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid"}, "VTKLink": {"vtkUnstructuredGridVolumeRayCastMapper": "https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGridVolumeRayCastMapper.html#details"}}, "vtkUnstructuredGridWriter": {"Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells"}, "VTKLink": {"vtkUnstructuredGridWriter": "https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGridWriter.html#details"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells"}}, "vtkValuePass": {"Cxx": {"RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer"}, "VTKLink": {"vtkValuePass": "https://www.vtk.org/doc/nightly/html/classvtkValuePass.html#details"}}, "vtkVariant": {"Cxx": {"DelimitedTextWriter": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ConstructTable": "https://examples.vtk.org/site/Cxx/Utilities/ConstructTable", "CustomDenseArray": "https://examples.vtk.org/site/Cxx/Utilities/CustomDenseArray", "Variant": "https://examples.vtk.org/site/Cxx/Utilities/Variant", "LUTUtilities": "https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs"}, "VTKLink": {"vtkVariant": "https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details"}, "Python": {"Variant": "https://examples.vtk.org/site/Python/Utilities/Variant", "LUTUtilities": "https://examples.vtk.org/site/Python/Utilities/LUTUtilities", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkVariantArray": {"Cxx": {"DelimitedTextWriter": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter", "ConstructTable": "https://examples.vtk.org/site/Cxx/Utilities/ConstructTable", "LUTUtilities": "https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs"}, "VTKLink": {"vtkVariantArray": "https://www.vtk.org/doc/nightly/html/classvtkVariantArray.html#details"}, "Python": {"Variant": "https://examples.vtk.org/site/Python/Utilities/Variant", "LUTUtilities": "https://examples.vtk.org/site/Python/Utilities/LUTUtilities", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkVector": {"Cxx": {"Vector": "https://examples.vtk.org/site/Cxx/Utilities/Vector", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet"}, "VTKLink": {"vtkVector": "https://www.vtk.org/doc/nightly/html/classvtkVector.html#details"}}, "vtkVector2d": {"Cxx": {"SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkVector2d": "https://www.vtk.org/doc/nightly/html/classvtkVector2d.html#details"}}, "vtkVector2f": {"Cxx": {"ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix"}, "VTKLink": {"vtkVector2f": "https://www.vtk.org/doc/nightly/html/classvtkVector2f.html#details"}}, "vtkVector2i": {"Cxx": {"ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkVector2i": "https://www.vtk.org/doc/nightly/html/classvtkVector2i.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkVector3d": {"Cxx": {"Vector": "https://examples.vtk.org/site/Cxx/Utilities/Vector", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors"}, "VTKLink": {"vtkVector3d": "https://www.vtk.org/doc/nightly/html/classvtkVector3d.html#details"}}, "vtkVectorDot": {"Cxx": {"PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot"}, "VTKLink": {"vtkVectorDot": "https://www.vtk.org/doc/nightly/html/classvtkVectorDot.html#details"}, "Python": {"PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot"}}, "vtkVectorNorm": {"Cxx": {"VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm"}, "VTKLink": {"vtkVectorNorm": "https://www.vtk.org/doc/nightly/html/classvtkVectorNorm.html#details"}}, "vtkVectorText": {"Cxx": {"LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkVectorText": "https://www.vtk.org/doc/nightly/html/classvtkVectorText.html#details"}, "Java": {"TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower"}, "Python": {"TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkVersion": {"Cxx": {"PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "CheckVTKVersion": "https://examples.vtk.org/site/Cxx/Utilities/CheckVTKVersion", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect"}, "VTKLink": {"vtkVersion": "https://www.vtk.org/doc/nightly/html/classvtkVersion.html#details"}, "Python": {"Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "VTKImportsForPython": "https://examples.vtk.org/site/Python/Utilities/VTKImportsForPython", "CheckVTKVersion": "https://examples.vtk.org/site/Python/Utilities/CheckVTKVersion", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkViewport": {"Cxx": {"GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "VTKLink": {"vtkViewport": "https://www.vtk.org/doc/nightly/html/classvtkViewport.html#details"}, "Python": {"GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkViewTheme": {"Cxx": {"XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices"}, "VTKLink": {"vtkViewTheme": "https://www.vtk.org/doc/nightly/html/classvtkViewTheme.html#details"}, "Python": {"SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "CreateTree": "https://examples.vtk.org/site/Python/Graphs/CreateTree"}}, "vtkVolume": {"Cxx": {"OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "VTKLink": {"vtkVolume": "https://www.vtk.org/doc/nightly/html/classvtkVolume.html#details"}, "Java": {"SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkVolumeProperty": {"Cxx": {"OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "VTKLink": {"vtkVolumeProperty": "https://www.vtk.org/doc/nightly/html/classvtkVolumeProperty.html#details"}, "Java": {"SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkVoxel": {"Cxx": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration"}, "VTKLink": {"vtkVoxel": "https://www.vtk.org/doc/nightly/html/classvtkVoxel.html#details"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration"}}, "vtkVoxelContoursToSurfaceFilter": {"Cxx": {"ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface"}, "VTKLink": {"vtkVoxelContoursToSurfaceFilter": "https://www.vtk.org/doc/nightly/html/classvtkVoxelContoursToSurfaceFilter.html#details"}}, "vtkVRMLExporter": {"Cxx": {"ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtkVRMLExporter": "https://www.vtk.org/doc/nightly/html/classvtkVRMLExporter.html#details"}}, "vtkWarpScalar": {"Cxx": {"InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "VTKLink": {"vtkWarpScalar": "https://www.vtk.org/doc/nightly/html/classvtkWarpScalar.html#details"}, "Python": {"ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor"}}, "vtkWarpTo": {"Cxx": {"WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1"}, "VTKLink": {"vtkWarpTo": "https://www.vtk.org/doc/nightly/html/classvtkWarpTo.html#details"}, "Java": {"WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo"}, "Python": {"WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1"}}, "vtkWedge": {"Cxx": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration"}, "VTKLink": {"vtkWedge": "https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration"}}, "vtkWidgetCallbackMapper": {"Cxx": {"BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkWidgetCallbackMapper": "https://www.vtk.org/doc/nightly/html/classvtkWidgetCallbackMapper.html#details"}}, "vtkWidgetEvent": {"Cxx": {"BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkWidgetEvent": "https://www.vtk.org/doc/nightly/html/classvtkWidgetEvent.html#details"}, "Python": {"ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget"}}, "vtkWindow": {"Cxx": {"AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors"}, "VTKLink": {"vtkWindow": "https://www.vtk.org/doc/nightly/html/classvtkWindow.html#details"}}, "vtkWindowLevelLookupTable": {"Cxx": {"VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation"}, "VTKLink": {"vtkWindowLevelLookupTable": "https://www.vtk.org/doc/nightly/html/classvtkWindowLevelLookupTable.html#details"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice"}}, "vtkWindowToImageFilter": {"Cxx": {"ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA"}, "VTKLink": {"vtkWindowToImageFilter": "https://www.vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html#details"}, "Java": {"Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkWordCloud": {"Cxx": {"WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo"}, "VTKLink": {"vtkWordCloud": "https://www.vtk.org/doc/nightly/html/classvtkWordCloud.html#details"}}, "vtkWorldPointPicker": {"Cxx": {"WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker"}, "VTKLink": {"vtkWorldPointPicker": "https://www.vtk.org/doc/nightly/html/classvtkWorldPointPicker.html#details"}}, "vtkX3DExporter": {"Cxx": {"ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtkX3DExporter": "https://www.vtk.org/doc/nightly/html/classvtkX3DExporter.html#details"}}, "vtkXMLCompositeDataReader": {"Cxx": {"DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile"}, "VTKLink": {"vtkXMLCompositeDataReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLCompositeDataReader.html#details"}}, "vtkXMLDataSetWriter": {"Cxx": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells"}, "VTKLink": {"vtkXMLDataSetWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLDataSetWriter.html#details"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells"}}, "vtkXMLMultiBlockDataReader": {"Cxx": {"ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene"}, "VTKLink": {"vtkXMLMultiBlockDataReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLMultiBlockDataReader.html#details"}}, "vtkXMLMultiBlockDataWriter": {"Cxx": {"Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene"}, "VTKLink": {"vtkXMLMultiBlockDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLMultiBlockDataWriter.html#details"}}, "vtkXMLPImageDataWriter": {"Cxx": {"XMLPImageDataWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPImageDataWriter"}, "VTKLink": {"vtkXMLPImageDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLPImageDataWriter.html#details"}, "Java": {"XMLPImageDataWriter": "https://examples.vtk.org/site/Java/IO/XMLPImageDataWriter"}}, "vtkXMLPUnstructuredGridWriter": {"Cxx": {"XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPUnstructuredGridWriter"}, "VTKLink": {"vtkXMLPUnstructuredGridWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLPUnstructuredGridWriter.html#details"}, "Java": {"XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLPUnstructuredGridWriter"}}, "vtkXMLReader": {"Cxx": {"DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile"}, "VTKLink": {"vtkXMLReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLReader.html#details"}}, "vtkXMLRectilinearGridWriter": {"Cxx": {"StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes"}, "VTKLink": {"vtkXMLRectilinearGridWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLRectilinearGridWriter.html#details"}}, "vtkXMLTreeReader": {"Cxx": {"TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView"}, "VTKLink": {"vtkXMLTreeReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLTreeReader.html#details"}}, "vtkXMLUniformGridAMRReader": {"Cxx": {"Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse"}, "VTKLink": {"vtkXMLUniformGridAMRReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLUniformGridAMRReader.html#details"}}, "vtkXYPlotActor": {"Cxx": {"XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot"}, "VTKLink": {"vtkXYPlotActor": "https://www.vtk.org/doc/nightly/html/classvtkXYPlotActor.html#details"}}, "vtkDataRepresentation": {"Java": {"SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "VTKLink": {"vtkDataRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkDataRepresentation.html#details"}}, "vtkGraphMapper": {"Java": {"GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates"}, "VTKLink": {"vtkGraphMapper": "https://www.vtk.org/doc/nightly/html/classvtkGraphMapper.html#details"}}, "vtkImageAppend": {"Python": {"PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil"}, "VTKLink": {"vtkImageAppend": "https://www.vtk.org/doc/nightly/html/classvtkImageAppend.html#details"}}, "vtkOpenGLRayCastImageDisplayHelper": {"Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast"}, "VTKLink": {"vtkOpenGLRayCastImageDisplayHelper": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLRayCastImageDisplayHelper.html#details"}}, "vtkOpenGLSkybox": {"Python": {"PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkOpenGLSkybox": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLSkybox.html#details"}}, "vtkPolyDataWriter": {"Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas"}, "VTKLink": {"vtkPolyDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataWriter.html#details"}}, "vtkResampleWithDataSet": {"Python": {"PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}, "VTKLink": {"vtkResampleWithDataSet": "https://www.vtk.org/doc/nightly/html/classvtkResampleWithDataSet.html#details"}}, "vtkSplineWidget": {"Python": {"SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget"}, "VTKLink": {"vtkSplineWidget": "https://www.vtk.org/doc/nightly/html/classvtkSplineWidget.html#details"}}, "vtkVariantCast": {"Python": {"Variant": "https://examples.vtk.org/site/Python/Utilities/Variant"}, "VTKLink": {"vtkVariantCast": "https://www.vtk.org/doc/nightly/html/classvtkVariantCast.html#details"}}, "vtkVariantCreate": {"Python": {"Variant": "https://examples.vtk.org/site/Python/Utilities/Variant"}, "VTKLink": {"vtkVariantCreate": "https://www.vtk.org/doc/nightly/html/classvtkVariantCreate.html#details"}}, "vtkVariantExtract": {"Python": {"Variant": "https://examples.vtk.org/site/Python/Utilities/Variant"}, "VTKLink": {"vtkVariantExtract": "https://www.vtk.org/doc/nightly/html/classvtkVariantExtract.html#details"}}, "vtkViewUpdater": {"Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction"}, "VTKLink": {"vtkViewUpdater": "https://www.vtk.org/doc/nightly/html/classvtkViewUpdater.html#details"}}} \ No newline at end of file +{"vtkActor": {"CSharp": {"WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "SimplePointsReader": "https://examples.vtk.org/site/CSharp/IO/SimplePointsReader", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "ReadPolyData": "https://examples.vtk.org/site/CSharp/IO/ReadPolyData", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "ReadImageData": "https://examples.vtk.org/site/CSharp/IO/ReadImageData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI", "ReadPLY": "https://examples.vtk.org/site/CSharp/IO/ReadPLY", "ParticleReader": "https://examples.vtk.org/site/CSharp/IO/ParticleReader", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "ReadRectilinearGrid": "https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "ReadOBJ": "https://examples.vtk.org/site/CSharp/IO/ReadOBJ", "ReadSTL": "https://examples.vtk.org/site/CSharp/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/CSharp/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder", "Plane": "https://examples.vtk.org/site/CSharp/GeometricObjects/Plane", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "RegularPolygonSource": "https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource", "Line": "https://examples.vtk.org/site/CSharp/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cone", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Arrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cube", "Sphere": "https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface", "MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkActor": "https://www.vtk.org/doc/nightly/html/classvtkActor.html#details"}, "Cxx": {"WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent", "JFrameRenderer": "https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "RenderView": "https://examples.vtk.org/site/Java/Views/RenderView", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource", "Line": "https://examples.vtk.org/site/Java/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "EmbedInPyQt2": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt2", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "EmbedInPyQt": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "SelectExamples": "https://examples.vtk.org/site/Python/Utilities/SelectExamples", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkActor2D": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkActor2D": "https://www.vtk.org/doc/nightly/html/classvtkActor2D.html#details"}, "Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkAppendPolyData": {"CSharp": {"PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours"}, "VTKLink": {"vtkAppendPolyData": "https://www.vtk.org/doc/nightly/html/classvtkAppendPolyData.html#details"}, "Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters"}, "Java": {"ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo"}, "Python": {"CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2"}}, "vtkArrowSource": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Arrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo"}, "VTKLink": {"vtkArrowSource": "https://www.vtk.org/doc/nightly/html/classvtkArrowSource.html#details"}, "Cxx": {"TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass"}, "Java": {"TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow"}, "Python": {"RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass"}}, "vtkAxesActor": {"CSharp": {"Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes"}, "VTKLink": {"vtkAxesActor": "https://www.vtk.org/doc/nightly/html/classvtkAxesActor.html#details"}, "Cxx": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "CheckVTKVersion": "https://examples.vtk.org/site/Cxx/Utilities/CheckVTKVersion", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors"}, "Java": {"DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkBandedPolyDataContourFilter": {"CSharp": {"BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter"}, "VTKLink": {"vtkBandedPolyDataContourFilter": "https://www.vtk.org/doc/nightly/html/classvtkBandedPolyDataContourFilter.html#details"}, "Cxx": {"PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube"}, "Python": {"ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube"}}, "vtkBMPReader": {"CSharp": {"ReadBMP": "https://examples.vtk.org/site/CSharp/IO/ReadBMP", "WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP"}, "VTKLink": {"vtkBMPReader": "https://www.vtk.org/doc/nightly/html/classvtkBMPReader.html#details"}, "Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "ReadBMP": "https://examples.vtk.org/site/Java/IO/ReadBMP"}, "Python": {"ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp"}}, "vtkBMPWriter": {"CSharp": {"WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP"}, "VTKLink": {"vtkBMPWriter": "https://www.vtk.org/doc/nightly/html/classvtkBMPWriter.html#details"}, "Cxx": {"ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter"}, "Python": {"ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi"}}, "vtkButterflySubdivisionFilter": {"CSharp": {"Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkButterflySubdivisionFilter": "https://www.vtk.org/doc/nightly/html/classvtkButterflySubdivisionFilter.html#details"}, "Cxx": {"PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision"}, "Python": {"SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision"}}, "vtkCamera": {"CSharp": {"Planes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum"}, "VTKLink": {"vtkCamera": "https://www.vtk.org/doc/nightly/html/classvtkCamera.html#details"}, "Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "Java": {"ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkCell": {"CSharp": {"CellEdges": "https://examples.vtk.org/site/CSharp/Meshes/CellEdges"}, "VTKLink": {"vtkCell": "https://www.vtk.org/doc/nightly/html/classvtkCell.html#details"}, "Cxx": {"TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "GetCellCenter": "https://examples.vtk.org/site/Cxx/ImageData/GetCellCenter", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "CellEdges": "https://examples.vtk.org/site/Cxx/Meshes/CellEdges"}, "Python": {"CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource"}}, "vtkCellArray": {"CSharp": {"IterateOverLines": "https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges"}, "VTKLink": {"vtkCellArray": "https://www.vtk.org/doc/nightly/html/classvtkCellArray.html#details"}, "Cxx": {"TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "RemoveVertices": "https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices", "IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTP": "https://examples.vtk.org/site/Cxx/IO/WriteVTP", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "AddCell": "https://examples.vtk.org/site/Cxx/Meshes/AddCell", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "AddCell": "https://examples.vtk.org/site/Java/Meshes/AddCell"}, "Python": {"IterateOverLines": "https://examples.vtk.org/site/Python/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "TriangleCornerVertices": "https://examples.vtk.org/site/Python/PolyData/TriangleCornerVertices", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "IterativeClosestPoints": "https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "WriteTriangleToFile": "https://examples.vtk.org/site/Python/IO/WriteTriangleToFile", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet"}}, "vtkCleanPolyData": {"CSharp": {"FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours"}, "VTKLink": {"vtkCleanPolyData": "https://www.vtk.org/doc/nightly/html/classvtkCleanPolyData.html#details"}, "Cxx": {"DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "CleanPolyData": "https://examples.vtk.org/site/Cxx/PolyData/CleanPolyData", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkClipPolyData": {"CSharp": {"SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip"}, "VTKLink": {"vtkClipPolyData": "https://www.vtk.org/doc/nightly/html/classvtkClipPolyData.html#details"}, "Cxx": {"ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum"}, "Python": {"ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip"}}, "vtkConeSource": {"CSharp": {"Cone": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cone", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo"}, "VTKLink": {"vtkConeSource": "https://www.vtk.org/doc/nightly/html/classvtkConeSource.html#details"}, "Cxx": {"Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace"}, "Python": {"Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkContourFilter": {"CSharp": {"ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours"}, "VTKLink": {"vtkContourFilter": "https://www.vtk.org/doc/nightly/html/classvtkContourFilter.html#details"}, "Cxx": {"ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud"}, "Java": {"SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol"}, "Python": {"ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud"}}, "vtkContourWidget": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator"}, "VTKLink": {"vtkContourWidget": "https://www.vtk.org/doc/nightly/html/classvtkContourWidget.html#details"}, "Cxx": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget"}, "Python": {"ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget"}}, "vtkCubeSource": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Cube": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cube"}, "VTKLink": {"vtkCubeSource": "https://www.vtk.org/doc/nightly/html/classvtkCubeSource.html#details"}, "Cxx": {"PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "CleanPolyData": "https://examples.vtk.org/site/Cxx/PolyData/CleanPolyData", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt"}, "Java": {"Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows"}}, "vtkCurvatures": {"CSharp": {"Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature"}, "VTKLink": {"vtkCurvatures": "https://www.vtk.org/doc/nightly/html/classvtkCurvatures.html#details"}, "Cxx": {"Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkCutter": {"CSharp": {"ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData"}, "VTKLink": {"vtkCutter": "https://www.vtk.org/doc/nightly/html/classvtkCutter.html#details"}, "Cxx": {"FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering"}, "Java": {"Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering"}}, "vtkCylinderSource": {"CSharp": {"Cylinder": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo"}, "VTKLink": {"vtkCylinderSource": "https://www.vtk.org/doc/nightly/html/classvtkCylinderSource.html#details"}, "Cxx": {"TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud"}, "Java": {"TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample"}, "Python": {"SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkDataObject": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction"}, "VTKLink": {"vtkDataObject": "https://www.vtk.org/doc/nightly/html/classvtkDataObject.html#details"}, "Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "Warnings": "https://examples.vtk.org/site/Cxx/Developers/Warnings", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTest": "https://examples.vtk.org/site/Cxx/Developers/vtkTest", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTest1": "https://examples.vtk.org/site/Cxx/Developers/vtkTest1", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels"}}, "vtkDataSet": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells"}, "VTKLink": {"vtkDataSet": "https://www.vtk.org/doc/nightly/html/classvtkDataSet.html#details"}, "Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance"}}, "vtkDataSetAttributes": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction"}, "VTKLink": {"vtkDataSetAttributes": "https://www.vtk.org/doc/nightly/html/classvtkDataSetAttributes.html#details"}, "Cxx": {"GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels"}, "Python": {"GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels"}}, "vtkDataSetMapper": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "ReadPolyData": "https://examples.vtk.org/site/CSharp/IO/ReadPolyData", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "ReadImageData": "https://examples.vtk.org/site/CSharp/IO/ReadImageData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "ReadRectilinearGrid": "https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip"}, "VTKLink": {"vtkDataSetMapper": "https://www.vtk.org/doc/nightly/html/classvtkDataSetMapper.html#details"}, "Cxx": {"ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "Java": {"CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData"}}, "vtkDataSetSurfaceFilter": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkDataSetSurfaceFilter": "https://www.vtk.org/doc/nightly/html/classvtkDataSetSurfaceFilter.html#details"}, "Cxx": {"DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "Python": {"DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface"}}, "vtkDecimatePro": {"CSharp": {"Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate"}, "VTKLink": {"vtkDecimatePro": "https://www.vtk.org/doc/nightly/html/classvtkDecimatePro.html#details"}, "Cxx": {"DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation"}, "Python": {"DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkDelaunay2D": {"CSharp": {"ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter"}, "VTKLink": {"vtkDelaunay2D": "https://www.vtk.org/doc/nightly/html/classvtkDelaunay2D.html#details"}, "Cxx": {"SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter"}, "Java": {"Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkDEMReader": {"CSharp": {"DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader"}, "VTKLink": {"vtkDEMReader": "https://www.vtk.org/doc/nightly/html/classvtkDEMReader.html#details"}, "Cxx": {"DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "Java": {"DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader"}}, "vtkDICOMImageReader": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries"}, "VTKLink": {"vtkDICOMImageReader": "https://www.vtk.org/doc/nightly/html/classvtkDICOMImageReader.html#details"}, "Cxx": {"FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes"}, "Java": {"ReadDICOM": "https://examples.vtk.org/site/Java/IO/ReadDICOM"}, "Python": {"ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "ReadDICOM": "https://examples.vtk.org/site/Python/IO/ReadDICOM", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes"}}, "vtkDijkstraGraphGeodesicPath": {"CSharp": {"DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath"}, "VTKLink": {"vtkDijkstraGraphGeodesicPath": "https://www.vtk.org/doc/nightly/html/classvtkDijkstraGraphGeodesicPath.html#details"}, "Cxx": {"DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath"}}, "vtkDiskSource": {"CSharp": {"Disk": "https://examples.vtk.org/site/CSharp/GeometricObjects/Disk", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges"}, "VTKLink": {"vtkDiskSource": "https://www.vtk.org/doc/nightly/html/classvtkDiskSource.html#details"}, "Cxx": {"ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges"}, "Java": {"Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges"}}, "vtkDoubleArray": {"CSharp": {"WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells"}, "VTKLink": {"vtkDoubleArray": "https://www.vtk.org/doc/nightly/html/classvtkDoubleArray.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "GetMiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "AttachAttributes": "https://examples.vtk.org/site/Cxx/PolyData/AttachAttributes", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ImageValueRange": "https://examples.vtk.org/site/Cxx/Images/ImageValueRange", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator", "SortDataArray": "https://examples.vtk.org/site/Cxx/Utilities/SortDataArray", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "PCAStatistics": "https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "Java": {"MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGridToTetrahedra", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid"}, "Python": {"WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges", "EdgeWeights": "https://examples.vtk.org/site/Python/Graphs/EdgeWeights", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine"}}, "vtkEarthSource": {"CSharp": {"GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo"}, "VTKLink": {"vtkEarthSource": "https://www.vtk.org/doc/nightly/html/classvtkEarthSource.html#details"}, "Cxx": {"EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource"}, "Java": {"EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource"}, "Python": {"EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource"}}, "vtkElevationFilter": {"CSharp": {"ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter"}, "VTKLink": {"vtkElevationFilter": "https://www.vtk.org/doc/nightly/html/classvtkElevationFilter.html#details"}, "Cxx": {"RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter"}, "Java": {"ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet"}}, "vtkExtractEdges": {"CSharp": {"ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges"}, "VTKLink": {"vtkExtractEdges": "https://www.vtk.org/doc/nightly/html/classvtkExtractEdges.html#details"}, "Cxx": {"GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges"}, "Java": {"DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh"}, "Python": {"MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh"}}, "vtkExtractSelection": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkExtractSelection": "https://www.vtk.org/doc/nightly/html/classvtkExtractSelection.html#details"}, "Cxx": {"ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking"}}, "vtkFeatureEdges": {"CSharp": {"ClosedSurface": "https://examples.vtk.org/site/CSharp/PolyData/ClosedSurface", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges"}, "VTKLink": {"vtkFeatureEdges": "https://www.vtk.org/doc/nightly/html/classvtkFeatureEdges.html#details"}, "Cxx": {"ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges"}, "Java": {"BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges"}}, "vtkFieldData": {"CSharp": {"WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter"}, "VTKLink": {"vtkFieldData": "https://www.vtk.org/doc/nightly/html/classvtkFieldData.html#details"}, "Cxx": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor"}}, "vtkFillHolesFilter": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkFillHolesFilter": "https://www.vtk.org/doc/nightly/html/classvtkFillHolesFilter.html#details"}, "Cxx": {"MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}}, "vtkFloatArray": {"CSharp": {"WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "NullPoint": "https://examples.vtk.org/site/CSharp/PolyData/NullPoint", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter"}, "VTKLink": {"vtkFloatArray": "https://www.vtk.org/doc/nightly/html/classvtkFloatArray.html#details"}, "Cxx": {"InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "ReverseSense": "https://examples.vtk.org/site/Cxx/PolyData/ReverseSense", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "GetMiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ArrayLookup": "https://examples.vtk.org/site/Cxx/Utilities/ArrayLookup", "VectorArrayKnownLength": "https://examples.vtk.org/site/Cxx/Utilities/VectorArrayKnownLength", "UnknownLengthArray": "https://examples.vtk.org/site/Cxx/Utilities/UnknownLengthArray", "CardinalSpline": "https://examples.vtk.org/site/Cxx/Utilities/CardinalSpline", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ArrayRange": "https://examples.vtk.org/site/Cxx/Utilities/ArrayRange", "VectorArrayUnknownLength": "https://examples.vtk.org/site/Cxx/Utilities/VectorArrayUnknownLength", "KnownLengthArray": "https://examples.vtk.org/site/Cxx/Utilities/KnownLengthArray", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter"}, "Java": {"ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "UnknownLengthArray": "https://examples.vtk.org/site/Java/Utilities/UnknownLengthArray", "KnownLengthArray": "https://examples.vtk.org/site/Java/Utilities/KnownLengthArray", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries"}, "Python": {"ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot", "ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkFrustumSource": {"CSharp": {"Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum"}, "VTKLink": {"vtkFrustumSource": "https://www.vtk.org/doc/nightly/html/classvtkFrustumSource.html#details"}, "Cxx": {"Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum"}, "Java": {"Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum"}, "Python": {"Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum"}}, "vtkGlyph3D": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB"}, "VTKLink": {"vtkGlyph3D": "https://www.vtk.org/doc/nightly/html/classvtkGlyph3D.html#details"}, "Cxx": {"GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace"}, "Java": {"ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace"}, "Python": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace"}}, "vtkGraphLayoutView": {"CSharp": {"XGMLReader": "https://examples.vtk.org/site/CSharp/InfoVis/XGMLReader"}, "VTKLink": {"vtkGraphLayoutView": "https://www.vtk.org/doc/nightly/html/classvtkGraphLayoutView.html#details"}, "Cxx": {"XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels"}, "Java": {"GraphPoints": "https://examples.vtk.org/site/Java/InfoVis/GraphPoints", "RandomGraphSource": "https://examples.vtk.org/site/Java/Graphs/RandomGraphSource", "SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices", "VisualizeGraph": "https://examples.vtk.org/site/Java/Graphs/VisualizeGraph"}, "Python": {"SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "ConstructGraph": "https://examples.vtk.org/site/Python/Graphs/ConstructGraph", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/SelectedVerticesAndEdges", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "VisualizeGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeGraph", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "CreateTree": "https://examples.vtk.org/site/Python/Graphs/CreateTree", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges", "ConstructTree": "https://examples.vtk.org/site/Python/Graphs/ConstructTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "RandomGraphSource": "https://examples.vtk.org/site/Python/Graphs/RandomGraphSource", "ColorVertexLabels": "https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels", "EdgeWeights": "https://examples.vtk.org/site/Python/Graphs/EdgeWeights"}}, "vtkGreedyTerrainDecimation": {"CSharp": {"GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation"}, "VTKLink": {"vtkGreedyTerrainDecimation": "https://www.vtk.org/doc/nightly/html/classvtkGreedyTerrainDecimation.html#details"}, "Cxx": {"GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation"}}, "vtkHexahedron": {"CSharp": {"Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron"}, "VTKLink": {"vtkHexahedron": "https://www.vtk.org/doc/nightly/html/classvtkHexahedron.html#details"}, "Cxx": {"DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron"}, "Python": {"DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron"}}, "vtkIdList": {"CSharp": {"IterateOverLines": "https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines", "CellEdges": "https://examples.vtk.org/site/CSharp/Meshes/CellEdges"}, "VTKLink": {"vtkIdList": "https://www.vtk.org/doc/nightly/html/classvtkIdList.html#details"}, "Cxx": {"IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "PointLocatorRadius": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorRadius", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "ArrayLookup": "https://examples.vtk.org/site/Cxx/Utilities/ArrayLookup", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "KDTreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadius", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "BuildLocatorFromKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/BuildLocatorFromKClosestPoints", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "OctreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadius", "ClosestNPoints": "https://examples.vtk.org/site/Cxx/DataStructures/ClosestNPoints", "OctreeKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeKClosestPoints", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "CellEdges": "https://examples.vtk.org/site/Cxx/Meshes/CellEdges"}, "Python": {"IterateOverLines": "https://examples.vtk.org/site/Python/PolyData/IterateOverLines", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube"}}, "vtkIdTypeArray": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkIdTypeArray": "https://www.vtk.org/doc/nightly/html/classvtkIdTypeArray.html#details"}, "Cxx": {"ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "Java": {"SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking"}}, "vtkImageActor": {"CSharp": {"MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter", "ImageReader2Factory": "https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory", "DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader", "MetaImageReader": "https://examples.vtk.org/site/CSharp/IO/MetaImageReader"}, "VTKLink": {"vtkImageActor": "https://www.vtk.org/doc/nightly/html/classvtkImageActor.html#details"}, "Cxx": {"TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "Java": {"ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkImageCanvasSource2D": {"CSharp": {"WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM", "WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP", "WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter"}, "VTKLink": {"vtkImageCanvasSource2D": "https://www.vtk.org/doc/nightly/html/classvtkImageCanvasSource2D.html#details"}, "Cxx": {"ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "MPEG2": "https://examples.vtk.org/site/Cxx/Video/MPEG2", "OggTheora": "https://examples.vtk.org/site/Cxx/Video/OggTheora", "FFMPEG": "https://examples.vtk.org/site/Cxx/Video/FFMPEG", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "PNGWriter": "https://examples.vtk.org/site/Cxx/IO/PNGWriter", "XMLPImageDataWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPImageDataWriter", "JPEGWriter": "https://examples.vtk.org/site/Cxx/IO/JPEGWriter", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "Java": {"OggTheora": "https://examples.vtk.org/site/Java/Video/OggTheora", "ShotNoise": "https://examples.vtk.org/site/Java/ImageProcessing/ShotNoise", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "XMLPImageDataWriter": "https://examples.vtk.org/site/Java/IO/XMLPImageDataWriter", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "JPEGWriter": "https://examples.vtk.org/site/Java/IO/JPEGWriter"}, "Python": {"ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage"}}, "vtkImageCast": {"CSharp": {"MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter", "WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter"}, "VTKLink": {"vtkImageCast": "https://www.vtk.org/doc/nightly/html/classvtkImageCast.html#details"}, "Cxx": {"TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "PNGWriter": "https://examples.vtk.org/site/Cxx/IO/PNGWriter"}, "Java": {"ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT"}, "Python": {"ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient"}}, "vtkImageData": {"CSharp": {"GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI"}, "VTKLink": {"vtkImageData": "https://www.vtk.org/doc/nightly/html/classvtkImageData.html#details"}, "Cxx": {"PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "ImageDataToPointSet": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet", "ImageIterator": "https://examples.vtk.org/site/Cxx/ImageData/ImageIterator", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "IterateImageData": "https://examples.vtk.org/site/Cxx/ImageData/IterateImageData", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "CellIdFromGridCoordinates": "https://examples.vtk.org/site/Cxx/ImageData/CellIdFromGridCoordinates", "GetCellCenter": "https://examples.vtk.org/site/Cxx/ImageData/GetCellCenter", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "RescaleAnImage": "https://examples.vtk.org/site/Cxx/ImageProcessing/RescaleAnImage", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImplicitDataSet": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitDataSet", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "ImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/ImageAlgorithmFilter", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageAccumulate": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulate", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "NegativeIndices": "https://examples.vtk.org/site/Cxx/Images/NegativeIndices", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageExport": "https://examples.vtk.org/site/Cxx/Images/ImageExport", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageValueRange": "https://examples.vtk.org/site/Cxx/Images/ImageValueRange", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ObserveError": "https://examples.vtk.org/site/Cxx/Utilities/ObserveError", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "ImageDataToQImage": "https://examples.vtk.org/site/Cxx/Qt/ImageDataToQImage", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "Java": {"CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkImageDataGeometryFilter": {"CSharp": {"WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI"}, "VTKLink": {"vtkImageDataGeometryFilter": "https://www.vtk.org/doc/nightly/html/classvtkImageDataGeometryFilter.html#details"}, "Cxx": {"ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "Java": {"StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader"}, "Python": {"WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline"}}, "vtkImageMagnitude": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction"}, "VTKLink": {"vtkImageMagnitude": "https://www.vtk.org/doc/nightly/html/classvtkImageMagnitude.html#details"}, "Cxx": {"VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum"}}, "vtkImageMandelbrotSource": {"CSharp": {"MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter"}, "VTKLink": {"vtkImageMandelbrotSource": "https://www.vtk.org/doc/nightly/html/classvtkImageMandelbrotSource.html#details"}, "Cxx": {"TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter"}, "Java": {"ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "Cast": "https://examples.vtk.org/site/Java/Images/Cast"}, "Python": {"ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "Cast": "https://examples.vtk.org/site/Python/Images/Cast"}}, "vtkImageMapToColors": {"CSharp": {"DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader"}, "VTKLink": {"vtkImageMapToColors": "https://www.vtk.org/doc/nightly/html/classvtkImageMapToColors.html#details"}, "Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkImageReader2": {"CSharp": {"ImageReader2Factory": "https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory"}, "VTKLink": {"vtkImageReader2": "https://www.vtk.org/doc/nightly/html/classvtkImageReader2.html#details"}, "Cxx": {"MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint"}, "Java": {"ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "StaticImage": "https://examples.vtk.org/site/Java/Images/StaticImage", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane"}}, "vtkImageReader2Factory": {"CSharp": {"ImageReader2Factory": "https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory"}, "VTKLink": {"vtkImageReader2Factory": "https://www.vtk.org/doc/nightly/html/classvtkImageReader2Factory.html#details"}, "Cxx": {"MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint"}, "Java": {"ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "StaticImage": "https://examples.vtk.org/site/Java/Images/StaticImage", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane"}, "Python": {"MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint"}}, "vtkImageViewer2": {"CSharp": {"ReadBMP": "https://examples.vtk.org/site/CSharp/IO/ReadBMP", "ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "ReadTIFF": "https://examples.vtk.org/site/CSharp/IO/ReadTIFF", "WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM", "WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP", "WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF", "JPEGReader": "https://examples.vtk.org/site/CSharp/IO/JPEGReader", "PNGReader": "https://examples.vtk.org/site/CSharp/IO/PNGReader", "WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "ReadPNM": "https://examples.vtk.org/site/CSharp/IO/ReadPNM", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter"}, "VTKLink": {"vtkImageViewer2": "https://www.vtk.org/doc/nightly/html/classvtkImageViewer2.html#details"}, "Cxx": {"ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "Java": {"ImageSinusoidSource": "https://examples.vtk.org/site/Java/Images/ImageSinusoidSource", "StaticImage": "https://examples.vtk.org/site/Java/Images/StaticImage", "ReadBMP": "https://examples.vtk.org/site/Java/IO/ReadBMP", "ReadTIFF": "https://examples.vtk.org/site/Java/IO/ReadTIFF", "JPEGReader": "https://examples.vtk.org/site/Java/IO/JPEGReader", "ReadDICOM": "https://examples.vtk.org/site/Java/IO/ReadDICOM", "PNGReader": "https://examples.vtk.org/site/Java/IO/PNGReader", "ReadPNM": "https://examples.vtk.org/site/Java/IO/ReadPNM"}, "Python": {"ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "ReadDICOM": "https://examples.vtk.org/site/Python/IO/ReadDICOM"}}, "vtkImplicitBoolean": {"CSharp": {"ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean"}, "VTKLink": {"vtkImplicitBoolean": "https://www.vtk.org/doc/nightly/html/classvtkImplicitBoolean.html#details"}, "Cxx": {"BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder"}, "Java": {"IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream"}, "Python": {"BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder"}}, "vtkIntArray": {"CSharp": {"NullPoint": "https://examples.vtk.org/site/CSharp/PolyData/NullPoint"}, "VTKLink": {"vtkIntArray": "https://www.vtk.org/doc/nightly/html/classvtkIntArray.html#details"}, "Cxx": {"NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "IterateImageData": "https://examples.vtk.org/site/Cxx/ImageData/IterateImageData", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "ArrayRange": "https://examples.vtk.org/site/Cxx/Utilities/ArrayRange", "SortDataArray": "https://examples.vtk.org/site/Cxx/Utilities/SortDataArray", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "Python": {"ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges", "NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "ColorVertexLabels": "https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource"}}, "vtkInteractorStyleImage": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries"}, "VTKLink": {"vtkInteractorStyleImage": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleImage.html#details"}, "Cxx": {"ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion"}, "Java": {"ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation"}, "Python": {"MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries"}}, "vtkJPEGReader": {"CSharp": {"JPEGReader": "https://examples.vtk.org/site/CSharp/IO/JPEGReader", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter"}, "VTKLink": {"vtkJPEGReader": "https://www.vtk.org/doc/nightly/html/classvtkJPEGReader.html#details"}, "Cxx": {"CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap"}, "Java": {"JPEGReader": "https://examples.vtk.org/site/Java/IO/JPEGReader"}, "Python": {"BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture"}}, "vtkJPEGWriter": {"CSharp": {"JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter"}, "VTKLink": {"vtkJPEGWriter": "https://www.vtk.org/doc/nightly/html/classvtkJPEGWriter.html#details"}, "Cxx": {"ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "JPEGWriter": "https://examples.vtk.org/site/Cxx/IO/JPEGWriter", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Java": {"JPEGWriter": "https://examples.vtk.org/site/Java/IO/JPEGWriter"}, "Python": {"ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkLandmarkTransform": {"CSharp": {"AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames"}, "VTKLink": {"vtkLandmarkTransform": "https://www.vtk.org/doc/nightly/html/classvtkLandmarkTransform.html#details"}, "Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas"}}, "vtkLine": {"CSharp": {"IterateOverLines": "https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "DistancePointToLine": "https://examples.vtk.org/site/CSharp/SimpleOperations/DistancePointToLine", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges"}, "VTKLink": {"vtkLine": "https://www.vtk.org/doc/nightly/html/classvtkLine.html#details"}, "Cxx": {"IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "DistancePointToLine": "https://examples.vtk.org/site/Cxx/SimpleOperations/DistancePointToLine", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges"}, "Java": {"RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine"}, "Python": {"IterateOverLines": "https://examples.vtk.org/site/Python/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere"}}, "vtkLinearSubdivisionFilter": {"CSharp": {"Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkLinearSubdivisionFilter": "https://www.vtk.org/doc/nightly/html/classvtkLinearSubdivisionFilter.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkLineSource": {"CSharp": {"Line": "https://examples.vtk.org/site/CSharp/GeometricObjects/Line", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo"}, "VTKLink": {"vtkLineSource": "https://www.vtk.org/doc/nightly/html/classvtkLineSource.html#details"}, "Cxx": {"TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine"}, "Java": {"TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "Line": "https://examples.vtk.org/site/Java/GeometricObjects/Line"}, "Python": {"TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine"}}, "vtkLODActor": {"CSharp": {"SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB"}, "VTKLink": {"vtkLODActor": "https://www.vtk.org/doc/nightly/html/classvtkLODActor.html#details"}, "Cxx": {"ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2"}, "Java": {"CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D"}, "Python": {"CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor"}}, "vtkLookupTable": {"CSharp": {"FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader", "PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter"}, "VTKLink": {"vtkLookupTable": "https://www.vtk.org/doc/nightly/html/classvtkLookupTable.html#details"}, "Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "LUTUtilities": "https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ColorLookupTable": "https://examples.vtk.org/site/Cxx/Utilities/ColorLookupTable", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "ColorLookupTable": "https://examples.vtk.org/site/Java/Utilities/ColorLookupTable", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "LUTUtilities": "https://examples.vtk.org/site/Python/Utilities/LUTUtilities", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkLoopSubdivisionFilter": {"CSharp": {"Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkLoopSubdivisionFilter": "https://www.vtk.org/doc/nightly/html/classvtkLoopSubdivisionFilter.html#details"}, "Cxx": {"SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision"}, "Python": {"SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh"}}, "vtkMarchingCubes": {"CSharp": {"MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface"}, "VTKLink": {"vtkMarchingCubes": "https://www.vtk.org/doc/nightly/html/classvtkMarchingCubes.html#details"}, "Cxx": {"HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "Java": {"MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkMarchingSquares": {"CSharp": {"MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares"}, "VTKLink": {"vtkMarchingSquares": "https://www.vtk.org/doc/nightly/html/classvtkMarchingSquares.html#details"}, "Cxx": {"MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator"}, "Python": {"ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator"}}, "vtkMath": {"CSharp": {"GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "GaussianRandomNumber": "https://examples.vtk.org/site/CSharp/SimpleOperations/GaussianRandomNumber", "UniformRandomNumber": "https://examples.vtk.org/site/CSharp/SimpleOperations/UniformRandomNumber", "DistanceBetweenPoints": "https://examples.vtk.org/site/CSharp/SimpleOperations/DistanceBetweenPoints", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap"}, "VTKLink": {"vtkMath": "https://www.vtk.org/doc/nightly/html/classvtkMath.html#details"}, "Cxx": {"RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "DistanceBetweenPoints": "https://examples.vtk.org/site/Cxx/SimpleOperations/DistanceBetweenPoints", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "IncrementalOctreePointLocator": "https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "EigenSymmetric": "https://examples.vtk.org/site/Cxx/Math/EigenSymmetric", "LeastSquares": "https://examples.vtk.org/site/Cxx/Math/LeastSquares", "HomogeneousLeastSquares": "https://examples.vtk.org/site/Cxx/Math/HomogeneousLeastSquares", "PerpendicularVector": "https://examples.vtk.org/site/Cxx/Math/PerpendicularVector", "NormalizeVector": "https://examples.vtk.org/site/Cxx/Math/NormalizeVector", "LUFactorization": "https://examples.vtk.org/site/Cxx/Math/LUFactorization"}, "Java": {"ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "DistanceBetweenPoints": "https://examples.vtk.org/site/Java/SimpleOperations/DistanceBetweenPoints", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "NormalizeVector": "https://examples.vtk.org/site/Java/Math/NormalizeVector"}, "Python": {"DistanceBetweenPoints": "https://examples.vtk.org/site/Python/SimpleOperations/DistanceBetweenPoints", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo"}}, "vtkMatrix4x4": {"CSharp": {"AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "PerspectiveTransform": "https://examples.vtk.org/site/CSharp/SimpleOperations/PerspectiveTransform", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow"}, "VTKLink": {"vtkMatrix4x4": "https://www.vtk.org/doc/nightly/html/classvtkMatrix4x4.html#details"}, "Cxx": {"AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "PerspectiveTransform": "https://examples.vtk.org/site/Cxx/SimpleOperations/PerspectiveTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder"}, "Java": {"PerspectiveTransform": "https://examples.vtk.org/site/Java/SimpleOperations/PerspectiveTransform", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow"}, "Python": {"FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo"}}, "vtkMatrixMathFilter": {"CSharp": {"MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkMatrixMathFilter": "https://www.vtk.org/doc/nightly/html/classvtkMatrixMathFilter.html#details"}, "Cxx": {"MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}}, "vtkMergePoints": {"CSharp": {"MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares"}, "VTKLink": {"vtkMergePoints": "https://www.vtk.org/doc/nightly/html/classvtkMergePoints.html#details"}, "Cxx": {"MergePoints": "https://examples.vtk.org/site/Cxx/PolyData/MergePoints", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone"}, "Python": {"HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone"}}, "vtkMeshQuality": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells"}, "VTKLink": {"vtkMeshQuality": "https://www.vtk.org/doc/nightly/html/classvtkMeshQuality.html#details"}, "Cxx": {"HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality"}, "Java": {"MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality"}}, "vtkMetaImageReader": {"CSharp": {"MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter", "MetaImageReader": "https://examples.vtk.org/site/CSharp/IO/MetaImageReader"}, "VTKLink": {"vtkMetaImageReader": "https://www.vtk.org/doc/nightly/html/classvtkMetaImageReader.html#details"}, "Cxx": {"VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "Java": {"MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkMetaImageWriter": {"CSharp": {"MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter"}, "VTKLink": {"vtkMetaImageWriter": "https://www.vtk.org/doc/nightly/html/classvtkMetaImageWriter.html#details"}, "Cxx": {"PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData"}}, "vtkMinimalStandardRandomSequence": {"CSharp": {"RandomSequence": "https://examples.vtk.org/site/CSharp/SimpleOperations/RandomSequence"}, "VTKLink": {"vtkMinimalStandardRandomSequence": "https://www.vtk.org/doc/nightly/html/classvtkMinimalStandardRandomSequence.html#details"}, "Cxx": {"WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "MergePoints": "https://examples.vtk.org/site/Cxx/PolyData/MergePoints", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "RescaleAnImage": "https://examples.vtk.org/site/Cxx/ImageProcessing/RescaleAnImage", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "UniformRandomNumber": "https://examples.vtk.org/site/Cxx/SimpleOperations/UniformRandomNumber", "RandomSequence": "https://examples.vtk.org/site/Cxx/SimpleOperations/RandomSequence", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap"}, "Java": {"RandomSequence": "https://examples.vtk.org/site/Java/SimpleOperations/RandomSequence", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh"}, "Python": {"SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkMultiBlockDataSet": {"CSharp": {"MultiBlockMergeFilter": "https://examples.vtk.org/site/CSharp/PolyData/MultiBlockMergeFilter"}, "VTKLink": {"vtkMultiBlockDataSet": "https://www.vtk.org/doc/nightly/html/classvtkMultiBlockDataSet.html#details"}, "Cxx": {"MultiBlockMergeFilter": "https://examples.vtk.org/site/Cxx/PolyData/MultiBlockMergeFilter", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "Java": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper"}}, "vtkMultiBlockMergeFilter": {"CSharp": {"MultiBlockMergeFilter": "https://examples.vtk.org/site/CSharp/PolyData/MultiBlockMergeFilter"}, "VTKLink": {"vtkMultiBlockMergeFilter": "https://www.vtk.org/doc/nightly/html/classvtkMultiBlockMergeFilter.html#details"}, "Cxx": {"MultiBlockMergeFilter": "https://examples.vtk.org/site/Cxx/PolyData/MultiBlockMergeFilter"}}, "vtkMultiBlockPLOT3DReader": {"CSharp": {"ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D"}, "VTKLink": {"vtkMultiBlockPLOT3DReader": "https://www.vtk.org/doc/nightly/html/classvtkMultiBlockPLOT3DReader.html#details"}, "Cxx": {"XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow"}, "Java": {"ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D"}, "Python": {"LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow"}}, "vtkOBBDicer": {"CSharp": {"OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer"}, "VTKLink": {"vtkOBBDicer": "https://www.vtk.org/doc/nightly/html/classvtkOBBDicer.html#details"}, "Cxx": {"OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData"}}, "vtkObject": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries"}, "VTKLink": {"vtkObject": "https://www.vtk.org/doc/nightly/html/classvtkObject.html#details"}, "Cxx": {"KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "ObserveError": "https://examples.vtk.org/site/Cxx/Utilities/ObserveError", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect"}, "Java": {"VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample"}}, "vtkOBJReader": {"CSharp": {"ReadOBJ": "https://examples.vtk.org/site/CSharp/IO/ReadOBJ"}, "VTKLink": {"vtkOBJReader": "https://www.vtk.org/doc/nightly/html/classvtkOBJReader.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "Java": {"ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ"}, "Python": {"ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkOrientedGlyphContourRepresentation": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator"}, "VTKLink": {"vtkOrientedGlyphContourRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkOrientedGlyphContourRepresentation.html#details"}, "Cxx": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget"}, "Python": {"ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget"}}, "vtkOutlineCornerFilter": {"CSharp": {"OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer"}, "VTKLink": {"vtkOutlineCornerFilter": "https://www.vtk.org/doc/nightly/html/classvtkOutlineCornerFilter.html#details"}, "Cxx": {"OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer"}}, "vtkOutlineFilter": {"CSharp": {"SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares"}, "VTKLink": {"vtkOutlineFilter": "https://www.vtk.org/doc/nightly/html/classvtkOutlineFilter.html#details"}, "Cxx": {"Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "Java": {"Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkParametricBoy": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricBoy": "https://www.vtk.org/doc/nightly/html/classvtkParametricBoy.html#details"}, "Cxx": {"PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Python": {"PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParametricConicSpiral": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricConicSpiral": "https://www.vtk.org/doc/nightly/html/classvtkParametricConicSpiral.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricCrossCap": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricCrossCap": "https://www.vtk.org/doc/nightly/html/classvtkParametricCrossCap.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricDini": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricDini": "https://www.vtk.org/doc/nightly/html/classvtkParametricDini.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricEllipsoid": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricEllipsoid": "https://www.vtk.org/doc/nightly/html/classvtkParametricEllipsoid.html#details"}, "Cxx": {"PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricEnneper": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricEnneper": "https://www.vtk.org/doc/nightly/html/classvtkParametricEnneper.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricFigure8Klein": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricFigure8Klein": "https://www.vtk.org/doc/nightly/html/classvtkParametricFigure8Klein.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Java": {"ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricFunction": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricFunction": "https://www.vtk.org/doc/nightly/html/classvtkParametricFunction.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricFunctionSource": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects"}, "VTKLink": {"vtkParametricFunctionSource": "https://www.vtk.org/doc/nightly/html/classvtkParametricFunctionSource.html#details"}, "Cxx": {"CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParametricKlein": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricKlein": "https://www.vtk.org/doc/nightly/html/classvtkParametricKlein.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricMobius": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricMobius": "https://www.vtk.org/doc/nightly/html/classvtkParametricMobius.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParametricRandomHills": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricRandomHills": "https://www.vtk.org/doc/nightly/html/classvtkParametricRandomHills.html#details"}, "Cxx": {"CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParametricRoman": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricRoman": "https://www.vtk.org/doc/nightly/html/classvtkParametricRoman.html#details"}, "Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricSpline": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricSpline": "https://www.vtk.org/doc/nightly/html/classvtkParametricSpline.html#details"}, "Cxx": {"KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh"}}, "vtkParametricSuperEllipsoid": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricSuperEllipsoid": "https://www.vtk.org/doc/nightly/html/classvtkParametricSuperEllipsoid.html#details"}, "Cxx": {"ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Java": {"ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere"}, "Python": {"ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricSuperToroid": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricSuperToroid": "https://www.vtk.org/doc/nightly/html/classvtkParametricSuperToroid.html#details"}, "Cxx": {"ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "Python": {"ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricTorus": {"CSharp": {"ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects"}, "VTKLink": {"vtkParametricTorus": "https://www.vtk.org/doc/nightly/html/classvtkParametricTorus.html#details"}, "Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParticleReader": {"CSharp": {"ParticleReader": "https://examples.vtk.org/site/CSharp/IO/ParticleReader"}, "VTKLink": {"vtkParticleReader": "https://www.vtk.org/doc/nightly/html/classvtkParticleReader.html#details"}, "Cxx": {"ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader"}, "Java": {"ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader"}}, "vtkPDBReader": {"CSharp": {"ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB"}, "VTKLink": {"vtkPDBReader": "https://www.vtk.org/doc/nightly/html/classvtkPDBReader.html#details"}, "Cxx": {"ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons"}, "Java": {"ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons"}}, "vtkPerspectiveTransform": {"CSharp": {"PerspectiveTransform": "https://examples.vtk.org/site/CSharp/SimpleOperations/PerspectiveTransform"}, "VTKLink": {"vtkPerspectiveTransform": "https://www.vtk.org/doc/nightly/html/classvtkPerspectiveTransform.html#details"}, "Cxx": {"PerspectiveTransform": "https://examples.vtk.org/site/Cxx/SimpleOperations/PerspectiveTransform"}, "Java": {"PerspectiveTransform": "https://examples.vtk.org/site/Java/SimpleOperations/PerspectiveTransform"}}, "vtkPlane": {"CSharp": {"ProjectPointPlane": "https://examples.vtk.org/site/CSharp/SimpleOperations/ProjectPointPlane", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip"}, "VTKLink": {"vtkPlane": "https://www.vtk.org/doc/nightly/html/classvtkPlane.html#details"}, "Cxx": {"FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ProjectPointPlane": "https://examples.vtk.org/site/Cxx/SimpleOperations/ProjectPointPlane", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface"}, "Java": {"ProjectPointPlane": "https://examples.vtk.org/site/Java/SimpleOperations/ProjectPointPlane", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip"}}, "vtkPlanes": {"CSharp": {"Planes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum"}, "VTKLink": {"vtkPlanes": "https://www.vtk.org/doc/nightly/html/classvtkPlanes.html#details"}, "Cxx": {"ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum"}, "Java": {"Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum"}, "Python": {"Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere"}}, "vtkPlanesIntersection": {"CSharp": {"PlanesIntersection": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlanesIntersection"}, "VTKLink": {"vtkPlanesIntersection": "https://www.vtk.org/doc/nightly/html/classvtkPlanesIntersection.html#details"}, "Cxx": {"PlanesIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlanesIntersection"}, "Java": {"PlanesIntersection": "https://examples.vtk.org/site/Java/GeometricObjects/PlanesIntersection"}, "Python": {"PlanesIntersection": "https://examples.vtk.org/site/Python/GeometricObjects/PlanesIntersection"}}, "vtkPlaneSource": {"CSharp": {"Plane": "https://examples.vtk.org/site/CSharp/GeometricObjects/Plane"}, "VTKLink": {"vtkPlaneSource": "https://www.vtk.org/doc/nightly/html/classvtkPlaneSource.html#details"}, "Cxx": {"ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "Java": {"ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight"}, "Python": {"CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane"}}, "vtkPlatonicSolidSource": {"CSharp": {"PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid"}, "VTKLink": {"vtkPlatonicSolidSource": "https://www.vtk.org/doc/nightly/html/classvtkPlatonicSolidSource.html#details"}, "Cxx": {"ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect"}, "Java": {"CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D"}, "Python": {"PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids"}}, "vtkPLYReader": {"CSharp": {"ReadPLY": "https://examples.vtk.org/site/CSharp/IO/ReadPLY"}, "VTKLink": {"vtkPLYReader": "https://www.vtk.org/doc/nightly/html/classvtkPLYReader.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "Java": {"ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY"}, "Python": {"ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkPLYWriter": {"CSharp": {"ConvertFile": "https://examples.vtk.org/site/CSharp/IO/ConvertFile"}, "VTKLink": {"vtkPLYWriter": "https://www.vtk.org/doc/nightly/html/classvtkPLYWriter.html#details"}, "Cxx": {"ConvertFile": "https://examples.vtk.org/site/Cxx/IO/ConvertFile", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY"}, "Java": {"ConvertFile": "https://examples.vtk.org/site/Java/IO/ConvertFile", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY"}, "Python": {"WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY"}}, "vtkPNGReader": {"CSharp": {"PNGReader": "https://examples.vtk.org/site/CSharp/IO/PNGReader", "WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG"}, "VTKLink": {"vtkPNGReader": "https://www.vtk.org/doc/nightly/html/classvtkPNGReader.html#details"}, "Cxx": {"ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping"}, "Java": {"PNGReader": "https://examples.vtk.org/site/Java/IO/PNGReader"}, "Python": {"PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping"}}, "vtkPNGWriter": {"CSharp": {"WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG"}, "VTKLink": {"vtkPNGWriter": "https://www.vtk.org/doc/nightly/html/classvtkPNGWriter.html#details"}, "Cxx": {"OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "PNGWriter": "https://examples.vtk.org/site/Cxx/IO/PNGWriter", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Java": {"ShotNoise": "https://examples.vtk.org/site/Java/ImageProcessing/ShotNoise", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow"}}, "vtkPNMReader": {"CSharp": {"WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM", "ReadPNM": "https://examples.vtk.org/site/CSharp/IO/ReadPNM"}, "VTKLink": {"vtkPNMReader": "https://www.vtk.org/doc/nightly/html/classvtkPNMReader.html#details"}, "Cxx": {"CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM"}, "Java": {"WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "ReadPNM": "https://examples.vtk.org/site/Java/IO/ReadPNM"}, "Python": {"CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont"}}, "vtkPNMWriter": {"CSharp": {"WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM"}, "VTKLink": {"vtkPNMWriter": "https://www.vtk.org/doc/nightly/html/classvtkPNMWriter.html#details"}, "Cxx": {"WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter"}, "Java": {"WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM"}, "Python": {"ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi"}}, "vtkPoints": {"CSharp": {"IterateOverLines": "https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "NullPoint": "https://examples.vtk.org/site/CSharp/PolyData/NullPoint", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "PolygonIntersection": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolygonIntersection", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "PlanesIntersection": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlanesIntersection", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges"}, "VTKLink": {"vtkPoints": "https://www.vtk.org/doc/nightly/html/classvtkPoints.html#details"}, "Cxx": {"SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "CenterOfMass": "https://examples.vtk.org/site/Cxx/PolyData/CenterOfMass", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "DeletePoint": "https://examples.vtk.org/site/Cxx/PolyData/DeletePoint", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "ImageDataToPointSet": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "PolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/PolyDataFilter", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "MutableDirectedGraphToDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/MutableDirectedGraphToDirectedGraph", "DirectedGraphToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/DirectedGraphToMutableDirectedGraph", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "TreeToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/TreeToMutableDirectedGraph", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "GetClassName": "https://examples.vtk.org/site/Cxx/Utilities/GetClassName", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "PointInPolygon": "https://examples.vtk.org/site/Cxx/Utilities/PointInPolygon", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "WriteVTP": "https://examples.vtk.org/site/Cxx/IO/WriteVTP", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLStructuredGridWriter", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "PlanesIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlanesIntersection", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "PolygonIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolygonIntersection", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "BuildLocatorFromKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/BuildLocatorFromKClosestPoints", "KdTreePointLocatorClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/KdTreePointLocatorClosestPoint", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "IncrementalOctreePointLocator": "https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator", "OctreeClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeClosestPoint", "BuildOctree": "https://examples.vtk.org/site/Cxx/DataStructures/BuildOctree", "OBBTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeIntersectWithLine", "KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints", "KdTree": "https://examples.vtk.org/site/Cxx/DataStructures/KdTree", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "CellEdges": "https://examples.vtk.org/site/Cxx/Meshes/CellEdges", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "AddCell": "https://examples.vtk.org/site/Cxx/Meshes/AddCell"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "CenterOfMass": "https://examples.vtk.org/site/Java/PolyData/CenterOfMass", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "GraphPoints": "https://examples.vtk.org/site/Java/InfoVis/GraphPoints", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "WriteVTP": "https://examples.vtk.org/site/Java/IO/WriteVTP", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLStructuredGridWriter", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "PlanesIntersection": "https://examples.vtk.org/site/Java/GeometricObjects/PlanesIntersection", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Java/StructuredPoints/StructuredPointsToUnstructuredGrid", "BuildOctree": "https://examples.vtk.org/site/Java/DataStructures/BuildOctree", "AddCell": "https://examples.vtk.org/site/Java/Meshes/AddCell"}, "Python": {"IterateOverLines": "https://examples.vtk.org/site/Python/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "TriangleCornerVertices": "https://examples.vtk.org/site/Python/PolyData/TriangleCornerVertices", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "TriangleCorners": "https://examples.vtk.org/site/Python/PolyData/TriangleCorners", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "IterativeClosestPoints": "https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "WriteTriangleToFile": "https://examples.vtk.org/site/Python/IO/WriteTriangleToFile", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "PlanesIntersection": "https://examples.vtk.org/site/Python/GeometricObjects/PlanesIntersection", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "PolygonIntersection": "https://examples.vtk.org/site/Python/GeometricObjects/PolygonIntersection", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkPolyData": {"CSharp": {"IterateOverLines": "https://examples.vtk.org/site/CSharp/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "NullPoint": "https://examples.vtk.org/site/CSharp/PolyData/NullPoint", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "PolyDataGetPoint": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataGetPoint", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "FindAllArrayNames": "https://examples.vtk.org/site/CSharp/IO/FindAllArrayNames", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkPolyData": "https://www.vtk.org/doc/nightly/html/classvtkPolyData.html#details"}, "Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "MergePoints": "https://examples.vtk.org/site/Cxx/PolyData/MergePoints", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "DataBounds": "https://examples.vtk.org/site/Cxx/PolyData/DataBounds", "GetMiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "DetermineArrayDataTypes": "https://examples.vtk.org/site/Cxx/PolyData/DetermineArrayDataTypes", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "GetMiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "CenterOfMass": "https://examples.vtk.org/site/Cxx/PolyData/CenterOfMass", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "RemoveVertices": "https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "PolyDataGetPoint": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataGetPoint", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PassThrough": "https://examples.vtk.org/site/Cxx/InfoVis/PassThrough", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "PolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/PolyDataFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "PolyDataAlgorithmReader": "https://examples.vtk.org/site/Cxx/Developers/PolyDataAlgorithmReader", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "ShallowCopy": "https://examples.vtk.org/site/Cxx/Utilities/ShallowCopy", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "DeepCopy": "https://examples.vtk.org/site/Cxx/Utilities/DeepCopy", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "WriteVTP": "https://examples.vtk.org/site/Cxx/IO/WriteVTP", "GenericDataObjectReader": "https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "ExodusIIWriter": "https://examples.vtk.org/site/Cxx/Parallel/ExodusIIWriter", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "KdTreePointLocatorClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/KdTreePointLocatorClosestPoint", "IncrementalOctreePointLocator": "https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "ModifiedBSPTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OctreeClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeClosestPoint", "BuildOctree": "https://examples.vtk.org/site/Cxx/DataStructures/BuildOctree", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "AddCell": "https://examples.vtk.org/site/Cxx/Meshes/AddCell"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "CenterOfMass": "https://examples.vtk.org/site/Java/PolyData/CenterOfMass", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "WriteVTP": "https://examples.vtk.org/site/Java/IO/WriteVTP", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "BuildOctree": "https://examples.vtk.org/site/Java/DataStructures/BuildOctree", "AddCell": "https://examples.vtk.org/site/Java/Meshes/AddCell"}, "Python": {"IterateOverLines": "https://examples.vtk.org/site/Python/PolyData/IterateOverLines", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "TriangleCornerVertices": "https://examples.vtk.org/site/Python/PolyData/TriangleCornerVertices", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "TriangleCorners": "https://examples.vtk.org/site/Python/PolyData/TriangleCorners", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "RenameArray": "https://examples.vtk.org/site/Python/Arrays/RenameArray", "GetValues": "https://examples.vtk.org/site/Python/Arrays/GetValues", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "IterativeClosestPoints": "https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "WriteTriangleToFile": "https://examples.vtk.org/site/Python/IO/WriteTriangleToFile", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkPolyDataAlgorithm": {"CSharp": {"GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkPolyDataAlgorithm": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataAlgorithm.html#details"}, "Cxx": {"vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision"}}, "vtkPolyDataConnectivityFilter": {"CSharp": {"PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface"}, "VTKLink": {"vtkPolyDataConnectivityFilter": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataConnectivityFilter.html#details"}, "Cxx": {"PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface"}, "Java": {"ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions"}, "Python": {"PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface"}}, "vtkPolyDataMapper": {"CSharp": {"WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "SimplePointsReader": "https://examples.vtk.org/site/CSharp/IO/SimplePointsReader", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB", "ReadPLY": "https://examples.vtk.org/site/CSharp/IO/ReadPLY", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "ParticleReader": "https://examples.vtk.org/site/CSharp/IO/ParticleReader", "ReadOBJ": "https://examples.vtk.org/site/CSharp/IO/ReadOBJ", "ReadSTL": "https://examples.vtk.org/site/CSharp/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Disk": "https://examples.vtk.org/site/CSharp/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder", "Plane": "https://examples.vtk.org/site/CSharp/GeometricObjects/Plane", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "RegularPolygonSource": "https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource", "Line": "https://examples.vtk.org/site/CSharp/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cone", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Arrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cube", "Sphere": "https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface", "MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkPolyDataMapper": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataMapper.html#details"}, "Cxx": {"MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent", "JFrameRenderer": "https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "RenderView": "https://examples.vtk.org/site/Java/Views/RenderView", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "LongLine": "https://examples.vtk.org/site/Java/GeometricObjects/LongLine", "RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource", "Line": "https://examples.vtk.org/site/Java/GeometricObjects/Line", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "EmbedInPyQt2": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt2", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "EmbedInPyQt": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkPolygon": {"CSharp": {"PolygonIntersection": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolygonIntersection", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon"}, "VTKLink": {"vtkPolygon": "https://www.vtk.org/doc/nightly/html/classvtkPolygon.html#details"}, "Cxx": {"ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "PointInPolygon": "https://examples.vtk.org/site/Cxx/Utilities/PointInPolygon", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "PolygonIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolygonIntersection", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon"}, "Java": {"Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon"}, "Python": {"ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "PolygonIntersection": "https://examples.vtk.org/site/Python/GeometricObjects/PolygonIntersection"}}, "vtkPolygonalSurfaceContourLineInterpolator": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator"}, "VTKLink": {"vtkPolygonalSurfaceContourLineInterpolator": "https://www.vtk.org/doc/nightly/html/classvtkPolygonalSurfaceContourLineInterpolator.html#details"}, "Cxx": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator"}}, "vtkPolygonalSurfacePointPlacer": {"CSharp": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator"}, "VTKLink": {"vtkPolygonalSurfacePointPlacer": "https://www.vtk.org/doc/nightly/html/classvtkPolygonalSurfacePointPlacer.html#details"}, "Cxx": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer"}}, "vtkPolyLine": {"CSharp": {"PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine"}, "VTKLink": {"vtkPolyLine": "https://www.vtk.org/doc/nightly/html/classvtkPolyLine.html#details"}, "Cxx": {"PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "Java": {"EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder"}, "Python": {"CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkProperty": {"CSharp": {"SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip"}, "VTKLink": {"vtkProperty": "https://www.vtk.org/doc/nightly/html/classvtkProperty.html#details"}, "Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter"}, "Java": {"BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects"}, "Python": {"FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip"}}, "vtkPyramid": {"CSharp": {"Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid"}, "VTKLink": {"vtkPyramid": "https://www.vtk.org/doc/nightly/html/classvtkPyramid.html#details"}, "Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid"}, "Java": {"Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid"}}, "vtkQuad": {"CSharp": {"Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad"}, "VTKLink": {"vtkQuad": "https://www.vtk.org/doc/nightly/html/classvtkQuad.html#details"}, "Cxx": {"OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad"}, "Java": {"Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad"}}, "vtkQuadricClustering": {"CSharp": {"QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering"}, "VTKLink": {"vtkQuadricClustering": "https://www.vtk.org/doc/nightly/html/classvtkQuadricClustering.html#details"}, "Cxx": {"QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering"}}, "vtkQuadricDecimation": {"CSharp": {"QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkQuadricDecimation": "https://www.vtk.org/doc/nightly/html/classvtkQuadricDecimation.html#details"}, "Cxx": {"QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation"}}, "vtkRegularPolygonSource": {"CSharp": {"RegularPolygonSource": "https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate"}, "VTKLink": {"vtkRegularPolygonSource": "https://www.vtk.org/doc/nightly/html/classvtkRegularPolygonSource.html#details"}, "Cxx": {"BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate"}, "Java": {"BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle"}, "Python": {"BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle"}}, "vtkRenderer": {"CSharp": {"WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "ReadBMP": "https://examples.vtk.org/site/CSharp/IO/ReadBMP", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM", "ReadPolyData": "https://examples.vtk.org/site/CSharp/IO/ReadPolyData", "MetaImageReader": "https://examples.vtk.org/site/CSharp/IO/MetaImageReader", "ReadUnstructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid", "ReadPLY": "https://examples.vtk.org/site/CSharp/IO/ReadPLY", "JPEGReader": "https://examples.vtk.org/site/CSharp/IO/JPEGReader", "ParticleReader": "https://examples.vtk.org/site/CSharp/IO/ParticleReader", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "ReadSTL": "https://examples.vtk.org/site/CSharp/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D", "MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter", "SimplePointsReader": "https://examples.vtk.org/site/CSharp/IO/SimplePointsReader", "ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "ReadTIFF": "https://examples.vtk.org/site/CSharp/IO/ReadTIFF", "ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP", "ReadImageData": "https://examples.vtk.org/site/CSharp/IO/ReadImageData", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB", "WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "ReadRectilinearGrid": "https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid", "DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader", "PNGReader": "https://examples.vtk.org/site/CSharp/IO/PNGReader", "ImageReader2Factory": "https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory", "ReadOBJ": "https://examples.vtk.org/site/CSharp/IO/ReadOBJ", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "ReadPNM": "https://examples.vtk.org/site/CSharp/IO/ReadPNM", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/CSharp/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder", "Plane": "https://examples.vtk.org/site/CSharp/GeometricObjects/Plane", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Planes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "RegularPolygonSource": "https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource", "Line": "https://examples.vtk.org/site/CSharp/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cone", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Arrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cube", "Sphere": "https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface", "MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkRenderer": "https://www.vtk.org/doc/nightly/html/classvtkRenderer.html#details"}, "Cxx": {"WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "Coordinate": "https://examples.vtk.org/site/Cxx/Utilities/Coordinate", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "PlaneWidget": "https://examples.vtk.org/site/Java/Widgets/PlaneWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "DistanceWidget": "https://examples.vtk.org/site/Java/Widgets/DistanceWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "SplineWidget": "https://examples.vtk.org/site/Java/Widgets/SplineWidget", "AngleWidget": "https://examples.vtk.org/site/Java/Widgets/AngleWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "TextActor": "https://examples.vtk.org/site/Java/GeometricObjects/TextActor", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "EmbedInPyQt2": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt2", "SphereWidget": "https://examples.vtk.org/site/Python/Widgets/SphereWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "EmbedInPyQt": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "AnnotatedCubeActor": "https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "TextActor": "https://examples.vtk.org/site/Python/GeometricObjects/TextActor", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkRenderWindow": {"CSharp": {"WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "GreedyTerrainDecimation": "https://examples.vtk.org/site/CSharp/PolyData/GreedyTerrainDecimation", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction", "ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/BandedPolyDataContourFilter", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "ReadBMP": "https://examples.vtk.org/site/CSharp/IO/ReadBMP", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText", "WritePNM": "https://examples.vtk.org/site/CSharp/IO/WritePNM", "ReadPolyData": "https://examples.vtk.org/site/CSharp/IO/ReadPolyData", "MetaImageReader": "https://examples.vtk.org/site/CSharp/IO/MetaImageReader", "ReadUnstructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid", "ReadPLY": "https://examples.vtk.org/site/CSharp/IO/ReadPLY", "JPEGReader": "https://examples.vtk.org/site/CSharp/IO/JPEGReader", "ParticleReader": "https://examples.vtk.org/site/CSharp/IO/ParticleReader", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "ReadSTL": "https://examples.vtk.org/site/CSharp/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D", "MetaImageWriter": "https://examples.vtk.org/site/CSharp/IO/MetaImageWriter", "SimplePointsReader": "https://examples.vtk.org/site/CSharp/IO/SimplePointsReader", "ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "ReadTIFF": "https://examples.vtk.org/site/CSharp/IO/ReadTIFF", "VRML": "https://examples.vtk.org/site/CSharp/IO/VRML", "ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "WriteBMP": "https://examples.vtk.org/site/CSharp/IO/WriteBMP", "ReadImageData": "https://examples.vtk.org/site/CSharp/IO/ReadImageData", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB", "WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "ReadRectilinearGrid": "https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid", "DEMReader": "https://examples.vtk.org/site/CSharp/IO/DEMReader", "PNGReader": "https://examples.vtk.org/site/CSharp/IO/PNGReader", "ImageReader2Factory": "https://examples.vtk.org/site/CSharp/IO/ImageReader2Factory", "ReadOBJ": "https://examples.vtk.org/site/CSharp/IO/ReadOBJ", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "WritePNG": "https://examples.vtk.org/site/CSharp/IO/WritePNG", "ReadPNM": "https://examples.vtk.org/site/CSharp/IO/ReadPNM", "JPEGWriter": "https://examples.vtk.org/site/CSharp/IO/JPEGWriter", "PolyLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/PolyLine", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/CSharp/GeometricObjects/Disk", "Cylinder": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cylinder", "Plane": "https://examples.vtk.org/site/CSharp/GeometricObjects/Plane", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/CSharp/GeometricObjects/Point", "Planes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/CSharp/GeometricObjects/LongLine", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "Frustum": "https://examples.vtk.org/site/CSharp/GeometricObjects/Frustum", "Quad": "https://examples.vtk.org/site/CSharp/GeometricObjects/Quad", "RegularPolygonSource": "https://examples.vtk.org/site/CSharp/GeometricObjects/RegularPolygonSource", "Line": "https://examples.vtk.org/site/CSharp/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cone", "ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "Arrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/CSharp/GeometricObjects/Cube", "Sphere": "https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex", "PlatonicSolid": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlatonicSolid", "Polygon": "https://examples.vtk.org/site/CSharp/GeometricObjects/Polygon", "ParametricObjects": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjects", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface", "MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "BoundaryEdges": "https://examples.vtk.org/site/CSharp/Meshes/BoundaryEdges", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkRenderWindow": "https://www.vtk.org/doc/nightly/html/classvtkRenderWindow.html#details"}, "Cxx": {"WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "Coordinate": "https://examples.vtk.org/site/Cxx/Utilities/Coordinate", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "PlaneWidget": "https://examples.vtk.org/site/Java/Widgets/PlaneWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "DistanceWidget": "https://examples.vtk.org/site/Java/Widgets/DistanceWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "SplineWidget": "https://examples.vtk.org/site/Java/Widgets/SplineWidget", "AngleWidget": "https://examples.vtk.org/site/Java/Widgets/AngleWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Java/Utilities/ReportRenderWindowCapabilities", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "TextActor": "https://examples.vtk.org/site/Java/GeometricObjects/TextActor", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "SphereWidget": "https://examples.vtk.org/site/Python/Widgets/SphereWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "AnnotatedCubeActor": "https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "TextActor": "https://examples.vtk.org/site/Python/GeometricObjects/TextActor", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkSampleFunction": {"CSharp": {"ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction"}, "VTKLink": {"vtkSampleFunction": "https://www.vtk.org/doc/nightly/html/classvtkSampleFunction.html#details"}, "Cxx": {"Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud"}, "Java": {"SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe"}, "Python": {"Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud"}}, "vtkSelection": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkSelection": "https://www.vtk.org/doc/nightly/html/classvtkSelection.html#details"}, "Cxx": {"ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "Java": {"SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking"}}, "vtkSelectionNode": {"CSharp": {"FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles"}, "VTKLink": {"vtkSelectionNode": "https://www.vtk.org/doc/nightly/html/classvtkSelectionNode.html#details"}, "Cxx": {"ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "Java": {"SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking"}}, "vtkSelectPolyData": {"CSharp": {"SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData"}, "VTKLink": {"vtkSelectPolyData": "https://www.vtk.org/doc/nightly/html/classvtkSelectPolyData.html#details"}, "Cxx": {"SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData"}}, "vtkShrinkPolyData": {"CSharp": {"ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData"}, "VTKLink": {"vtkShrinkPolyData": "https://www.vtk.org/doc/nightly/html/classvtkShrinkPolyData.html#details"}, "Cxx": {"ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum"}, "Java": {"RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource"}, "Python": {"MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum"}}, "vtkSimpleElevationFilter": {"CSharp": {"SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter"}, "VTKLink": {"vtkSimpleElevationFilter": "https://www.vtk.org/doc/nightly/html/classvtkSimpleElevationFilter.html#details"}, "Cxx": {"SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter"}}, "vtkSimplePointsReader": {"CSharp": {"SimplePointsReader": "https://examples.vtk.org/site/CSharp/IO/SimplePointsReader"}, "VTKLink": {"vtkSimplePointsReader": "https://www.vtk.org/doc/nightly/html/classvtkSimplePointsReader.html#details"}, "Cxx": {"SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader"}, "Java": {"SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader"}}, "vtkSphere": {"CSharp": {"ImplicitBoolean": "https://examples.vtk.org/site/CSharp/Filters/ImplicitBoolean", "ImplicitSphere": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/ImplicitSphere", "SampleFunction": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/SampleFunction"}, "VTKLink": {"vtkSphere": "https://www.vtk.org/doc/nightly/html/classvtkSphere.html#details"}, "Cxx": {"Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens"}, "Java": {"IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction"}, "Python": {"Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens"}}, "vtkSphereSource": {"CSharp": {"PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_LargestRegion", "SelectPolyData": "https://examples.vtk.org/site/CSharp/PolyData/SelectPolyData", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/CSharp/PolyData/DijkstraGraphGeodesicPath", "MultiBlockMergeFilter": "https://examples.vtk.org/site/CSharp/PolyData/MultiBlockMergeFilter", "ClosedSurface": "https://examples.vtk.org/site/CSharp/PolyData/ClosedSurface", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "ShrinkPolyData": "https://examples.vtk.org/site/CSharp/PolyData/ShrinkPolyData", "WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "ColorDisconnectedRegions": "https://examples.vtk.org/site/CSharp/PolyData/ColorDisconnectedRegions", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "PolyDataGetPoint": "https://examples.vtk.org/site/CSharp/PolyData/PolyDataGetPoint", "HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB", "FindAllArrayNames": "https://examples.vtk.org/site/CSharp/IO/FindAllArrayNames", "Planes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Planes", "PlanesIntersection": "https://examples.vtk.org/site/CSharp/GeometricObjects/PlanesIntersection", "Sphere": "https://examples.vtk.org/site/CSharp/GeometricObjects/Sphere", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "Decimate": "https://examples.vtk.org/site/CSharp/Meshes/Decimate", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "ExtractEdges": "https://examples.vtk.org/site/CSharp/Meshes/ExtractEdges", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "QuadricClustering": "https://examples.vtk.org/site/CSharp/Meshes/QuadricClustering", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter", "QuadricDecimation": "https://examples.vtk.org/site/CSharp/Meshes/QuadricDecimation"}, "VTKLink": {"vtkSphereSource": "https://www.vtk.org/doc/nightly/html/classvtkSphereSource.html#details"}, "Cxx": {"WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "Stripper": "https://examples.vtk.org/site/Cxx/PolyData/Stripper", "CellLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellLocator", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "PolyDataToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "ReverseSense": "https://examples.vtk.org/site/Cxx/PolyData/ReverseSense", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "DataBounds": "https://examples.vtk.org/site/Cxx/PolyData/DataBounds", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "MultiBlockMergeFilter": "https://examples.vtk.org/site/Cxx/PolyData/MultiBlockMergeFilter", "PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "PolyDataGetPoint": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataGetPoint", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "CellTreeLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellTreeLocator", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "PassThrough": "https://examples.vtk.org/site/Cxx/InfoVis/PassThrough", "MultipleInputPorts": "https://examples.vtk.org/site/Cxx/Developers/MultipleInputPorts", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPUnstructuredGridWriter", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "SimplePointsWriter": "https://examples.vtk.org/site/Cxx/IO/SimplePointsWriter", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "PlanesIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlanesIntersection", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "OBBTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeIntersectWithLine", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "ModifiedBSPTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "Java": {"ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "Stripper": "https://examples.vtk.org/site/Java/PolyData/Stripper", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent", "JFrameRenderer": "https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer", "PassThrough": "https://examples.vtk.org/site/Java/InfoVis/PassThrough", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "RenderView": "https://examples.vtk.org/site/Java/Views/RenderView", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "SimplePointsWriter": "https://examples.vtk.org/site/Java/IO/SimplePointsWriter", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLPUnstructuredGridWriter", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "PlanesIntersection": "https://examples.vtk.org/site/Java/GeometricObjects/PlanesIntersection", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere"}, "Python": {"ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "RenameArray": "https://examples.vtk.org/site/Python/Arrays/RenameArray", "GetValues": "https://examples.vtk.org/site/Python/Arrays/GetValues", "EmbedInPyQt2": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt2", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "EmbedInPyQt": "https://examples.vtk.org/site/Python/Widgets/EmbedInPyQt", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "PlanesIntersection": "https://examples.vtk.org/site/Python/GeometricObjects/PlanesIntersection", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkSTLReader": {"CSharp": {"ReadSTL": "https://examples.vtk.org/site/CSharp/IO/ReadSTL"}, "VTKLink": {"vtkSTLReader": "https://www.vtk.org/doc/nightly/html/classvtkSTLReader.html#details"}, "Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "Java": {"WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL"}, "Python": {"ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkStripper": {"CSharp": {"CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip"}, "VTKLink": {"vtkStripper": "https://www.vtk.org/doc/nightly/html/classvtkStripper.html#details"}, "Cxx": {"FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "Stripper": "https://examples.vtk.org/site/Cxx/PolyData/Stripper", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip"}, "Java": {"Stripper": "https://examples.vtk.org/site/Java/PolyData/Stripper", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip"}}, "vtkStructuredGrid": {"CSharp": {"XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter"}, "VTKLink": {"vtkStructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkStructuredGrid.html#details"}, "Cxx": {"XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "GetLinearPointId": "https://examples.vtk.org/site/Cxx/StructuredGrid/GetLinearPointId", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "GenericDataObjectReader": "https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLStructuredGridWriter", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow"}, "Java": {"BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLStructuredGridWriter"}, "Python": {"SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint"}}, "vtkStructuredGridGeometryFilter": {"CSharp": {"ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter", "ReadPLOT3D": "https://examples.vtk.org/site/CSharp/IO/ReadPLOT3D"}, "VTKLink": {"vtkStructuredGridGeometryFilter": "https://www.vtk.org/doc/nightly/html/classvtkStructuredGridGeometryFilter.html#details"}, "Cxx": {"VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow"}, "Java": {"ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D"}, "Python": {"BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow"}}, "vtkStructuredPointsReader": {"CSharp": {"ExtractLargestIsosurface": "https://examples.vtk.org/site/CSharp/Modelling/ExtractLargestIsosurface"}, "VTKLink": {"vtkStructuredPointsReader": "https://www.vtk.org/doc/nightly/html/classvtkStructuredPointsReader.html#details"}, "Cxx": {"Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface"}, "Java": {"SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV"}, "Python": {"CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface"}}, "vtkSuperquadricSource": {"CSharp": {"SolidClip": "https://examples.vtk.org/site/CSharp/Meshes/SolidClip"}, "VTKLink": {"vtkSuperquadricSource": "https://www.vtk.org/doc/nightly/html/classvtkSuperquadricSource.html#details"}, "Cxx": {"CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip"}, "Java": {"OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip"}}, "vtkTetra": {"CSharp": {"WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron"}, "VTKLink": {"vtkTetra": "https://www.vtk.org/doc/nightly/html/classvtkTetra.html#details"}, "Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "Java": {"WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkTextMapper": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkTextMapper": "https://www.vtk.org/doc/nightly/html/classvtkTextMapper.html#details"}, "Cxx": {"CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "Java": {"MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkTextProperty": {"CSharp": {"ReadDICOMSeries": "https://examples.vtk.org/site/CSharp/IO/ReadDICOMSeries", "ParametricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/ParametricObjectsDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/CSharp/GeometricObjects/GeometricObjectsDemo", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkTextProperty": "https://www.vtk.org/doc/nightly/html/classvtkTextProperty.html#details"}, "Cxx": {"CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "Java": {"MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkThreshold": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells"}, "VTKLink": {"vtkThreshold": "https://www.vtk.org/doc/nightly/html/classvtkThreshold.html#details"}, "Cxx": {"HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData"}, "Java": {"RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe"}, "Python": {"GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels"}}, "vtkThresholdPoints": {"CSharp": {"VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/CSharp/PolyData/VectorFieldNonZeroExtraction"}, "VTKLink": {"vtkThresholdPoints": "https://www.vtk.org/doc/nightly/html/classvtkThresholdPoints.html#details"}, "Cxx": {"ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors"}, "Java": {"RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample"}, "Python": {"CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors"}}, "vtkTIFFReader": {"CSharp": {"ReadTIFF": "https://examples.vtk.org/site/CSharp/IO/ReadTIFF", "WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF"}, "VTKLink": {"vtkTIFFReader": "https://www.vtk.org/doc/nightly/html/classvtkTIFFReader.html#details"}, "Cxx": {"PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF"}, "Java": {"ReadTIFF": "https://examples.vtk.org/site/Java/IO/ReadTIFF", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF"}}, "vtkTIFFWriter": {"CSharp": {"WriteTIFF": "https://examples.vtk.org/site/CSharp/IO/WriteTIFF"}, "VTKLink": {"vtkTIFFWriter": "https://www.vtk.org/doc/nightly/html/classvtkTIFFWriter.html#details"}, "Cxx": {"ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF"}, "Java": {"WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF"}, "Python": {"ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi"}}, "vtkTransform": {"CSharp": {"WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "PerspectiveTransform": "https://examples.vtk.org/site/CSharp/SimpleOperations/PerspectiveTransform", "Axes": "https://examples.vtk.org/site/CSharp/GeometricObjects/Axes", "OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow"}, "VTKLink": {"vtkTransform": "https://www.vtk.org/doc/nightly/html/classvtkTransform.html#details"}, "Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "PerspectiveTransform": "https://examples.vtk.org/site/Cxx/SimpleOperations/PerspectiveTransform", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors"}, "Java": {"TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "PerspectiveTransform": "https://examples.vtk.org/site/Java/SimpleOperations/PerspectiveTransform", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors"}}, "vtkTransformFilter": {"CSharp": {"WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter", "AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames"}, "VTKLink": {"vtkTransformFilter": "https://www.vtk.org/doc/nightly/html/classvtkTransformFilter.html#details"}, "Cxx": {"WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere"}, "Java": {"TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere"}}, "vtkTransformPolyDataFilter": {"CSharp": {"OrientedArrow": "https://examples.vtk.org/site/CSharp/GeometricObjects/OrientedArrow"}, "VTKLink": {"vtkTransformPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkTransformPolyDataFilter.html#details"}, "Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "IterativeClosestPoints": "https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkTriangle": {"CSharp": {"WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "Triangle": "https://examples.vtk.org/site/CSharp/GeometricObjects/Triangle", "CellEdges": "https://examples.vtk.org/site/CSharp/Meshes/CellEdges"}, "VTKLink": {"vtkTriangle": "https://www.vtk.org/doc/nightly/html/classvtkTriangle.html#details"}, "Cxx": {"TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "CellEdges": "https://examples.vtk.org/site/Cxx/Meshes/CellEdges", "AddCell": "https://examples.vtk.org/site/Cxx/Meshes/AddCell"}, "Java": {"TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "AddCell": "https://examples.vtk.org/site/Java/Meshes/AddCell"}, "Python": {"SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "WriteTriangleToFile": "https://examples.vtk.org/site/Python/IO/WriteTriangleToFile", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh"}}, "vtkTriangleFilter": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/CSharp/PolyData/PolygonalSurfaceContourLineInterpolator", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision", "Triangulate": "https://examples.vtk.org/site/CSharp/Meshes/Triangulate"}, "VTKLink": {"vtkTriangleFilter": "https://www.vtk.org/doc/nightly/html/classvtkTriangleFilter.html#details"}, "Cxx": {"CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation"}, "Java": {"MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkTriangleStrip": {"CSharp": {"TriangleStrip": "https://examples.vtk.org/site/CSharp/GeometricObjects/TriangleStrip"}, "VTKLink": {"vtkTriangleStrip": "https://www.vtk.org/doc/nightly/html/classvtkTriangleStrip.html#details"}, "Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip"}, "Java": {"TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip"}}, "vtkTubeFilter": {"CSharp": {"ReadPDB": "https://examples.vtk.org/site/CSharp/IO/ReadPDB"}, "VTKLink": {"vtkTubeFilter": "https://www.vtk.org/doc/nightly/html/classvtkTubeFilter.html#details"}, "Cxx": {"GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle"}, "Java": {"TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "ImplicitSphere": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitSphere", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle"}, "Python": {"TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle"}}, "vtkUndirectedGraph": {"CSharp": {"XGMLReader": "https://examples.vtk.org/site/CSharp/InfoVis/XGMLReader"}, "VTKLink": {"vtkUndirectedGraph": "https://www.vtk.org/doc/nightly/html/classvtkUndirectedGraph.html#details"}, "Cxx": {"XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource"}}, "vtkUnsignedCharArray": {"CSharp": {"ColoredLines": "https://examples.vtk.org/site/CSharp/GeometricObjects/ColoredLines", "ElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/CSharp/Meshes/ColoredElevationMap", "SimpleElevationFilter": "https://examples.vtk.org/site/CSharp/Meshes/SimpleElevationFilter"}, "VTKLink": {"vtkUnsignedCharArray": "https://www.vtk.org/doc/nightly/html/classvtkUnsignedCharArray.html#details"}, "Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter"}, "Java": {"ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints"}, "Python": {"SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}}, "vtkUnstructuredGrid": {"CSharp": {"HighlightBadCells": "https://examples.vtk.org/site/CSharp/PolyData/HighlightBadCells", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile", "WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "Tetrahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Tetrahedron", "Pyramid": "https://examples.vtk.org/site/CSharp/GeometricObjects/Pyramid", "Hexahedron": "https://examples.vtk.org/site/CSharp/GeometricObjects/Hexahedron"}, "VTKLink": {"vtkUnstructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGrid.html#details"}, "Cxx": {"DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "PolyDataToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "GenericDataObjectReader": "https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "Java": {"WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Java/StructuredPoints/StructuredPointsToUnstructuredGrid"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance"}}, "vtkUnstructuredGridReader": {"CSharp": {"MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkUnstructuredGridReader": "https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGridReader.html#details"}, "Cxx": {"DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "Python": {"ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2"}}, "vtkVertex": {"CSharp": {"Vertex": "https://examples.vtk.org/site/CSharp/GeometricObjects/Vertex"}, "VTKLink": {"vtkVertex": "https://www.vtk.org/doc/nightly/html/classvtkVertex.html#details"}, "Cxx": {"DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "Java": {"Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkVertexGlyphFilter": {"CSharp": {"AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "ReadPlainText": "https://examples.vtk.org/site/CSharp/IO/ReadPlainText"}, "VTKLink": {"vtkVertexGlyphFilter": "https://www.vtk.org/doc/nightly/html/classvtkVertexGlyphFilter.html#details"}, "Cxx": {"MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints"}, "Java": {"ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter"}, "Python": {"ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter"}}, "vtkVolume16Reader": {"CSharp": {"MarchingSquares": "https://examples.vtk.org/site/CSharp/Modelling/MarchingSquares"}, "VTKLink": {"vtkVolume16Reader": "https://www.vtk.org/doc/nightly/html/classvtkVolume16Reader.html#details"}}, "vtkVoxelModeller": {"CSharp": {"MarchingCubes": "https://examples.vtk.org/site/CSharp/Modelling/MarchingCubes"}, "VTKLink": {"vtkVoxelModeller": "https://www.vtk.org/doc/nightly/html/classvtkVoxelModeller.html#details"}, "Cxx": {"MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes"}, "Python": {"MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes"}}, "vtkVRMLImporter": {"CSharp": {"VRML": "https://examples.vtk.org/site/CSharp/IO/VRML"}, "VTKLink": {"vtkVRMLImporter": "https://www.vtk.org/doc/nightly/html/classvtkVRMLImporter.html#details"}, "Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "Java": {"VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter"}}, "vtkWarpVector": {"CSharp": {"WarpVector": "https://examples.vtk.org/site/CSharp/PolyData/WarpVector"}, "VTKLink": {"vtkWarpVector": "https://www.vtk.org/doc/nightly/html/classvtkWarpVector.html#details"}, "Cxx": {"WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow"}, "Python": {"WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow"}}, "vtkWeightedTransformFilter": {"CSharp": {"WeightedTransformFilter": "https://examples.vtk.org/site/CSharp/PolyData/WeightedTransformFilter"}, "VTKLink": {"vtkWeightedTransformFilter": "https://www.vtk.org/doc/nightly/html/classvtkWeightedTransformFilter.html#details"}, "Cxx": {"WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter"}}, "vtkWindowedSincPolyDataFilter": {"CSharp": {"WindowedSincPolyDataFilter": "https://examples.vtk.org/site/CSharp/Meshes/WindowedSincPolyDataFilter"}, "VTKLink": {"vtkWindowedSincPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkWindowedSincPolyDataFilter.html#details"}, "Cxx": {"FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter"}, "Python": {"FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkXGMLReader": {"CSharp": {"XGMLReader": "https://examples.vtk.org/site/CSharp/InfoVis/XGMLReader"}, "VTKLink": {"vtkXGMLReader": "https://www.vtk.org/doc/nightly/html/classvtkXGMLReader.html#details"}, "Cxx": {"XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader"}}, "vtkXMLGenericDataObjectReader": {"CSharp": {"ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/CSharp/IO/ReadUnknownTypeXMLFile"}, "VTKLink": {"vtkXMLGenericDataObjectReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLGenericDataObjectReader.html#details"}, "Cxx": {"ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile"}}, "vtkXMLImageDataReader": {"CSharp": {"WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI", "ReadImageData": "https://examples.vtk.org/site/CSharp/IO/ReadImageData"}, "VTKLink": {"vtkXMLImageDataReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLImageDataReader.html#details"}, "Cxx": {"FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData"}, "Python": {"WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData"}}, "vtkXMLImageDataWriter": {"CSharp": {"IsoContours": "https://examples.vtk.org/site/CSharp/ImplicitFunctions/IsoContours", "WriteVTI": "https://examples.vtk.org/site/CSharp/IO/WriteVTI"}, "VTKLink": {"vtkXMLImageDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLImageDataWriter.html#details"}, "Cxx": {"IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes"}, "Python": {"WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData"}}, "vtkXMLPolyDataReader": {"CSharp": {"Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "ContoursFromPolyData": "https://examples.vtk.org/site/CSharp/Filtering/ContoursFromPolyData", "FilledContours": "https://examples.vtk.org/site/CSharp/VisualizationAlgorithms/FilledContours", "ConvertFile": "https://examples.vtk.org/site/CSharp/IO/ConvertFile", "ReadPolyData": "https://examples.vtk.org/site/CSharp/IO/ReadPolyData", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "FindAllArrayNames": "https://examples.vtk.org/site/CSharp/IO/FindAllArrayNames", "FillHoles": "https://examples.vtk.org/site/CSharp/Meshes/FillHoles", "CapClip": "https://examples.vtk.org/site/CSharp/Meshes/CapClip", "OBBDicer": "https://examples.vtk.org/site/CSharp/Meshes/OBBDicer", "Subdivision": "https://examples.vtk.org/site/CSharp/Meshes/Subdivision"}, "VTKLink": {"vtkXMLPolyDataReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLPolyDataReader.html#details"}, "Cxx": {"EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "DetermineArrayDataTypes": "https://examples.vtk.org/site/Cxx/PolyData/DetermineArrayDataTypes", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "GetMiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "DataBounds": "https://examples.vtk.org/site/Cxx/PolyData/DataBounds", "GetMiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData", "RemoveVertices": "https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "FileOutputWindow": "https://examples.vtk.org/site/Cxx/Utilities/FileOutputWindow", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "ConvertFile": "https://examples.vtk.org/site/Cxx/IO/ConvertFile", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "ConvertFile": "https://examples.vtk.org/site/Java/IO/ConvertFile", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP"}, "Python": {"ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkXMLPolyDataWriter": {"CSharp": {"Curvature": "https://examples.vtk.org/site/CSharp/PolyData/Curvature", "AlignFrames": "https://examples.vtk.org/site/CSharp/PolyData/AlignFrames", "WriteVTP": "https://examples.vtk.org/site/CSharp/IO/WriteVTP", "FindAllArrayNames": "https://examples.vtk.org/site/CSharp/IO/FindAllArrayNames", "MatrixMathFilter": "https://examples.vtk.org/site/CSharp/Meshes/MatrixMathFilter"}, "VTKLink": {"vtkXMLPolyDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLPolyDataWriter.html#details"}, "Cxx": {"PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "RemoveVertices": "https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "WriteVTP": "https://examples.vtk.org/site/Cxx/IO/WriteVTP", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter"}, "Java": {"RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "WriteVTP": "https://examples.vtk.org/site/Java/IO/WriteVTP"}, "Python": {"TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "TriangleCornerVertices": "https://examples.vtk.org/site/Python/PolyData/TriangleCornerVertices", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "TriangleCorners": "https://examples.vtk.org/site/Python/PolyData/TriangleCorners", "PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "RenameArray": "https://examples.vtk.org/site/Python/Arrays/RenameArray", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "WriteTriangleToFile": "https://examples.vtk.org/site/Python/IO/WriteTriangleToFile", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkXMLRectilinearGridReader": {"CSharp": {"ReadRectilinearGrid": "https://examples.vtk.org/site/CSharp/IO/ReadRectilinearGrid"}, "VTKLink": {"vtkXMLRectilinearGridReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLRectilinearGridReader.html#details"}, "Cxx": {"ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile"}, "Java": {"ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid"}}, "vtkXMLStructuredGridReader": {"CSharp": {"ReadStructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadStructuredGrid", "XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter"}, "VTKLink": {"vtkXMLStructuredGridReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLStructuredGridReader.html#details"}, "Cxx": {"ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile"}, "Java": {"ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid"}}, "vtkXMLStructuredGridWriter": {"CSharp": {"XMLStructuredGridWriter": "https://examples.vtk.org/site/CSharp/IO/XMLStructuredGridWriter"}, "VTKLink": {"vtkXMLStructuredGridWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLStructuredGridWriter.html#details"}, "Cxx": {"ImageDataToPointSet": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLStructuredGridWriter", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes"}, "Java": {"XMLStructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLStructuredGridWriter"}}, "vtkXMLUnstructuredGridReader": {"CSharp": {"WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU", "ReadUnstructuredGrid": "https://examples.vtk.org/site/CSharp/IO/ReadUnstructuredGrid"}, "VTKLink": {"vtkXMLUnstructuredGridReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLUnstructuredGridReader.html#details"}, "Cxx": {"FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid"}, "Java": {"WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "VectorFieldExample": "https://examples.vtk.org/site/Java/Visualization/VectorFieldExample"}, "Python": {"ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid"}}, "vtkXMLUnstructuredGridWriter": {"CSharp": {"WriteVTU": "https://examples.vtk.org/site/CSharp/IO/WriteVTU"}, "VTKLink": {"vtkXMLUnstructuredGridWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLUnstructuredGridWriter.html#details"}, "Cxx": {"PolyDataToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra"}, "Java": {"WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Java/StructuredPoints/StructuredPointsToUnstructuredGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGridToTetrahedra"}, "Python": {"NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron"}}, "vtk3DSImporter": {"Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtk3DSImporter": "https://www.vtk.org/doc/nightly/html/classvtk3DSImporter.html#details"}, "Java": {"ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter"}, "Python": {"3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter"}}, "vtkAbstractPicker": {"Cxx": {"MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D"}, "VTKLink": {"vtkAbstractPicker": "https://www.vtk.org/doc/nightly/html/classvtkAbstractPicker.html#details"}}, "vtkAbstractWidget": {"Cxx": {"BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkAbstractWidget": "https://www.vtk.org/doc/nightly/html/classvtkAbstractWidget.html#details"}}, "vtkActorCollection": {"Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection"}, "VTKLink": {"vtkActorCollection": "https://www.vtk.org/doc/nightly/html/classvtkActorCollection.html#details"}, "Java": {"VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter", "ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter"}}, "vtkAdjacencyMatrixToEdgeTable": {"Cxx": {"AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable"}, "VTKLink": {"vtkAdjacencyMatrixToEdgeTable": "https://www.vtk.org/doc/nightly/html/classvtkAdjacencyMatrixToEdgeTable.html#details"}}, "vtkAdjacentVertexIterator": {"Cxx": {"AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator"}, "VTKLink": {"vtkAdjacentVertexIterator": "https://www.vtk.org/doc/nightly/html/classvtkAdjacentVertexIterator.html#details"}}, "vtkAffineRepresentation2D": {"Cxx": {"AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget"}, "VTKLink": {"vtkAffineRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkAffineRepresentation2D.html#details"}}, "vtkAffineWidget": {"Cxx": {"AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget"}, "VTKLink": {"vtkAffineWidget": "https://www.vtk.org/doc/nightly/html/classvtkAffineWidget.html#details"}}, "vtkAlgorithm": {"Cxx": {"vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton"}, "VTKLink": {"vtkAlgorithm": "https://www.vtk.org/doc/nightly/html/classvtkAlgorithm.html#details"}, "Python": {"TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource"}}, "vtkAlgorithmOutput": {"Cxx": {"ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess"}, "VTKLink": {"vtkAlgorithmOutput": "https://www.vtk.org/doc/nightly/html/classvtkAlgorithmOutput.html#details"}}, "vtkAMRBox": {"Cxx": {"OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse"}, "VTKLink": {"vtkAMRBox": "https://www.vtk.org/doc/nightly/html/classvtkAMRBox.html#details"}, "Python": {"OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR"}}, "vtkAMRUtilities": {"Cxx": {"OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse"}, "VTKLink": {"vtkAMRUtilities": "https://www.vtk.org/doc/nightly/html/classvtkAMRUtilities.html#details"}}, "vtkAngleRepresentation2D": {"Cxx": {"AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D"}, "VTKLink": {"vtkAngleRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkAngleRepresentation2D.html#details"}, "Java": {"AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D"}}, "vtkAngleWidget": {"Cxx": {"AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D"}, "VTKLink": {"vtkAngleWidget": "https://www.vtk.org/doc/nightly/html/classvtkAngleWidget.html#details"}, "Java": {"AngleWidget": "https://examples.vtk.org/site/Java/Widgets/AngleWidget", "AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D"}}, "vtkAnimationCue": {"Cxx": {"AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors"}, "VTKLink": {"vtkAnimationCue": "https://www.vtk.org/doc/nightly/html/classvtkAnimationCue.html#details"}}, "vtkAnimationScene": {"Cxx": {"AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors"}, "VTKLink": {"vtkAnimationScene": "https://www.vtk.org/doc/nightly/html/classvtkAnimationScene.html#details"}}, "vtkAnnotatedCubeActor": {"Cxx": {"OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube"}, "VTKLink": {"vtkAnnotatedCubeActor": "https://www.vtk.org/doc/nightly/html/classvtkAnnotatedCubeActor.html#details"}, "Java": {"AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor"}, "Python": {"OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "AnnotatedCubeActor": "https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube"}}, "vtkAnnotationLink": {"Cxx": {"SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges"}, "VTKLink": {"vtkAnnotationLink": "https://www.vtk.org/doc/nightly/html/classvtkAnnotationLink.html#details"}, "Java": {"SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs"}}, "vtkAppendFilter": {"Cxx": {"PolyDataToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization"}, "VTKLink": {"vtkAppendFilter": "https://www.vtk.org/doc/nightly/html/classvtkAppendFilter.html#details"}, "Python": {"AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization"}}, "vtkAreaPicker": {"Cxx": {"HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection"}, "VTKLink": {"vtkAreaPicker": "https://www.vtk.org/doc/nightly/html/classvtkAreaPicker.html#details"}}, "vtkArrayCalculator": {"Cxx": {"ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator"}, "VTKLink": {"vtkArrayCalculator": "https://www.vtk.org/doc/nightly/html/classvtkArrayCalculator.html#details"}}, "vtkArrayData": {"Cxx": {"ArrayToTable": "https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable", "AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable", "ArrayWriter": "https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter"}, "VTKLink": {"vtkArrayData": "https://www.vtk.org/doc/nightly/html/classvtkArrayData.html#details"}}, "vtkArrayDispatch": {"Cxx": {"ForLoop": "https://examples.vtk.org/site/Cxx/Utilities/ForLoop"}, "VTKLink": {"vtkArrayDispatch": "https://www.vtk.org/doc/nightly/html/classvtkArrayDispatch.html#details"}}, "vtkArrayPrint": {"Cxx": {"AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable"}, "VTKLink": {"vtkArrayPrint": "https://www.vtk.org/doc/nightly/html/classvtkArrayPrint.html#details"}}, "vtkArrayToTable": {"Cxx": {"ArrayToTable": "https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable"}, "VTKLink": {"vtkArrayToTable": "https://www.vtk.org/doc/nightly/html/classvtkArrayToTable.html#details"}}, "vtkArrayWriter": {"Cxx": {"ArrayWriter": "https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter"}, "VTKLink": {"vtkArrayWriter": "https://www.vtk.org/doc/nightly/html/classvtkArrayWriter.html#details"}}, "vtkAssembly": {"Cxx": {"MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly"}, "VTKLink": {"vtkAssembly": "https://www.vtk.org/doc/nightly/html/classvtkAssembly.html#details"}, "Java": {"Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly"}}, "vtkAssemblyNode": {"Cxx": {"ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion"}, "VTKLink": {"vtkAssemblyNode": "https://www.vtk.org/doc/nightly/html/classvtkAssemblyNode.html#details"}}, "vtkAssemblyPath": {"Cxx": {"PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion"}, "VTKLink": {"vtkAssemblyPath": "https://www.vtk.org/doc/nightly/html/classvtkAssemblyPath.html#details"}}, "vtkAssignAttribute": {"Cxx": {"GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter"}, "VTKLink": {"vtkAssignAttribute": "https://www.vtk.org/doc/nightly/html/classvtkAssignAttribute.html#details"}}, "vtkAxes": {"Cxx": {"TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB"}, "VTKLink": {"vtkAxes": "https://www.vtk.org/doc/nightly/html/classvtkAxes.html#details"}, "Java": {"TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin"}, "Python": {"TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow"}}, "vtkAxis": {"Cxx": {"MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkAxis": "https://www.vtk.org/doc/nightly/html/classvtkAxis.html#details"}, "Python": {"MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkAxisActor": {"Cxx": {"AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor"}, "VTKLink": {"vtkAxisActor": "https://www.vtk.org/doc/nightly/html/classvtkAxisActor.html#details"}}, "vtkBalloonRepresentation": {"Cxx": {"BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget"}, "VTKLink": {"vtkBalloonRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkBalloonRepresentation.html#details"}, "Java": {"BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget"}, "Python": {"BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget"}}, "vtkBalloonWidget": {"Cxx": {"BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget"}, "VTKLink": {"vtkBalloonWidget": "https://www.vtk.org/doc/nightly/html/classvtkBalloonWidget.html#details"}, "Java": {"BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget"}, "Python": {"BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget"}}, "vtkBarChartActor": {"Cxx": {"ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx"}, "VTKLink": {"vtkBarChartActor": "https://www.vtk.org/doc/nightly/html/classvtkBarChartActor.html#details"}}, "vtkBiDimensionalRepresentation2D": {"Cxx": {"BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget"}, "VTKLink": {"vtkBiDimensionalRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkBiDimensionalRepresentation2D.html#details"}}, "vtkBiDimensionalWidget": {"Cxx": {"BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget"}, "VTKLink": {"vtkBiDimensionalWidget": "https://www.vtk.org/doc/nightly/html/classvtkBiDimensionalWidget.html#details"}}, "vtkBillboardTextActor3D": {"Cxx": {"BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D"}, "VTKLink": {"vtkBillboardTextActor3D": "https://www.vtk.org/doc/nightly/html/classvtkBillboardTextActor3D.html#details"}, "Python": {"BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D"}}, "vtkBiQuadraticQuad": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkBiQuadraticQuad": "https://www.vtk.org/doc/nightly/html/classvtkBiQuadraticQuad.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkBiQuadraticQuadraticHexahedron": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkBiQuadraticQuadraticHexahedron": "https://www.vtk.org/doc/nightly/html/classvtkBiQuadraticQuadraticHexahedron.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkBiQuadraticQuadraticWedge": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkBiQuadraticQuadraticWedge": "https://www.vtk.org/doc/nightly/html/classvtkBiQuadraticQuadraticWedge.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkBiQuadraticTriangle": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkBiQuadraticTriangle": "https://www.vtk.org/doc/nightly/html/classvtkBiQuadraticTriangle.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkBooleanOperationPolyDataFilter": {"Cxx": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter"}, "VTKLink": {"vtkBooleanOperationPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkBooleanOperationPolyDataFilter.html#details"}, "Python": {"BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter"}}, "vtkBooleanTexture": {"Cxx": {"TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric"}, "VTKLink": {"vtkBooleanTexture": "https://www.vtk.org/doc/nightly/html/classvtkBooleanTexture.html#details"}, "Python": {"TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric"}}, "vtkBoostBreadthFirstSearch": {"Cxx": {"DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance"}, "VTKLink": {"vtkBoostBreadthFirstSearch": "https://www.vtk.org/doc/nightly/html/classvtkBoostBreadthFirstSearch.html#details"}}, "vtkBoostBreadthFirstSearchTree": {"Cxx": {"BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree"}, "VTKLink": {"vtkBoostBreadthFirstSearchTree": "https://www.vtk.org/doc/nightly/html/classvtkBoostBreadthFirstSearchTree.html#details"}}, "vtkBoostConnectedComponents": {"Cxx": {"ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents"}, "VTKLink": {"vtkBoostConnectedComponents": "https://www.vtk.org/doc/nightly/html/classvtkBoostConnectedComponents.html#details"}}, "vtkBoostPrimMinimumSpanningTree": {"Cxx": {"DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree"}, "VTKLink": {"vtkBoostPrimMinimumSpanningTree": "https://www.vtk.org/doc/nightly/html/classvtkBoostPrimMinimumSpanningTree.html#details"}}, "vtkBorderRepresentation": {"Cxx": {"CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkBorderRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkBorderRepresentation.html#details"}}, "vtkBorderWidget": {"Cxx": {"CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkBorderWidget": "https://www.vtk.org/doc/nightly/html/classvtkBorderWidget.html#details"}}, "vtkBoundedPointSource": {"Cxx": {"MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkBoundedPointSource": "https://www.vtk.org/doc/nightly/html/classvtkBoundedPointSource.html#details"}, "Java": {"FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction"}}, "vtkBoundingBox": {"Cxx": {"BoundingBox": "https://examples.vtk.org/site/Cxx/Utilities/BoundingBox", "BoundingBoxIntersection": "https://examples.vtk.org/site/Cxx/Utilities/BoundingBoxIntersection"}, "VTKLink": {"vtkBoundingBox": "https://www.vtk.org/doc/nightly/html/classvtkBoundingBox.html#details"}}, "vtkBox": {"Cxx": {"ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "Box": "https://examples.vtk.org/site/Cxx/Utilities/Box", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo"}, "VTKLink": {"vtkBox": "https://www.vtk.org/doc/nightly/html/classvtkBox.html#details"}, "Python": {"BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions"}}, "vtkBoxClipDataSet": {"Cxx": {"BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid"}, "VTKLink": {"vtkBoxClipDataSet": "https://www.vtk.org/doc/nightly/html/classvtkBoxClipDataSet.html#details"}}, "vtkBoxMuellerRandomSequence": {"Cxx": {"GaussianRandomNumber": "https://examples.vtk.org/site/Cxx/SimpleOperations/GaussianRandomNumber", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo"}, "VTKLink": {"vtkBoxMuellerRandomSequence": "https://www.vtk.org/doc/nightly/html/classvtkBoxMuellerRandomSequence.html#details"}}, "vtkBoxRepresentation": {"Cxx": {"BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2"}, "VTKLink": {"vtkBoxRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkBoxRepresentation.html#details"}}, "vtkBoxWidget": {"Cxx": {"Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget"}, "VTKLink": {"vtkBoxWidget": "https://www.vtk.org/doc/nightly/html/classvtkBoxWidget.html#details"}, "Java": {"Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget"}}, "vtkBoxWidget2": {"Cxx": {"BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2"}, "VTKLink": {"vtkBoxWidget2": "https://www.vtk.org/doc/nightly/html/classvtkBoxWidget2.html#details"}}, "vtkBrownianPoints": {"Cxx": {"BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints"}, "VTKLink": {"vtkBrownianPoints": "https://www.vtk.org/doc/nightly/html/classvtkBrownianPoints.html#details"}, "Java": {"BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView"}}, "vtkBrush": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots"}, "VTKLink": {"vtkBrush": "https://www.vtk.org/doc/nightly/html/classvtkBrush.html#details"}}, "vtkButtonWidget": {"Cxx": {"TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton"}, "VTKLink": {"vtkButtonWidget": "https://www.vtk.org/doc/nightly/html/classvtkButtonWidget.html#details"}}, "vtkBYUReader": {"Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "VTKLink": {"vtkBYUReader": "https://www.vtk.org/doc/nightly/html/classvtkBYUReader.html#details"}, "Python": {"ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkCallbackCommand": {"Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors"}, "VTKLink": {"vtkCallbackCommand": "https://www.vtk.org/doc/nightly/html/classvtkCallbackCommand.html#details"}}, "vtkCameraActor": {"Cxx": {"CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor"}, "VTKLink": {"vtkCameraActor": "https://www.vtk.org/doc/nightly/html/classvtkCameraActor.html#details"}, "Java": {"CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor"}}, "vtkCameraInterpolator": {"Cxx": {"InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera"}, "VTKLink": {"vtkCameraInterpolator": "https://www.vtk.org/doc/nightly/html/classvtkCameraInterpolator.html#details"}}, "vtkCameraOrientationWidget": {"Cxx": {"Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "CheckVTKVersion": "https://examples.vtk.org/site/Cxx/Utilities/CheckVTKVersion", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkCameraOrientationWidget": "https://www.vtk.org/doc/nightly/html/classvtkCameraOrientationWidget.html#details"}, "Python": {"Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkCameraPass": {"Cxx": {"RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows"}, "VTKLink": {"vtkCameraPass": "https://www.vtk.org/doc/nightly/html/classvtkCameraPass.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows"}}, "vtkCaptionActor2D": {"Cxx": {"CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes"}, "VTKLink": {"vtkCaptionActor2D": "https://www.vtk.org/doc/nightly/html/classvtkCaptionActor2D.html#details"}}, "vtkCaptionRepresentation": {"Cxx": {"CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget"}, "VTKLink": {"vtkCaptionRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkCaptionRepresentation.html#details"}, "Java": {"CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget"}}, "vtkCaptionWidget": {"Cxx": {"CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget"}, "VTKLink": {"vtkCaptionWidget": "https://www.vtk.org/doc/nightly/html/classvtkCaptionWidget.html#details"}, "Java": {"CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget"}}, "vtkCardinalSpline": {"Cxx": {"ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "CardinalSpline": "https://examples.vtk.org/site/Cxx/Utilities/CardinalSpline", "1DTupleInterpolation": "https://examples.vtk.org/site/Cxx/Math/1DTupleInterpolation"}, "VTKLink": {"vtkCardinalSpline": "https://www.vtk.org/doc/nightly/html/classvtkCardinalSpline.html#details"}}, "vtkCategoryLegend": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid"}, "VTKLink": {"vtkCategoryLegend": "https://www.vtk.org/doc/nightly/html/classvtkCategoryLegend.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid"}}, "vtkCellArrayIterator": {"Cxx": {"FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours"}, "VTKLink": {"vtkCellArrayIterator": "https://www.vtk.org/doc/nightly/html/classvtkCellArrayIterator.html#details"}}, "vtkCellCenters": {"Cxx": {"CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh"}, "VTKLink": {"vtkCellCenters": "https://www.vtk.org/doc/nightly/html/classvtkCellCenters.html#details"}, "Java": {"CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters"}}, "vtkCellData": {"Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "GetMiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData", "PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}, "VTKLink": {"vtkCellData": "https://www.vtk.org/doc/nightly/html/classvtkCellData.html#details"}}, "vtkCellIterator": {"Cxx": {"RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}, "VTKLink": {"vtkCellIterator": "https://www.vtk.org/doc/nightly/html/classvtkCellIterator.html#details"}}, "vtkCellLocator": {"Cxx": {"ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "CellLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellLocator", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections"}, "VTKLink": {"vtkCellLocator": "https://www.vtk.org/doc/nightly/html/classvtkCellLocator.html#details"}, "Python": {"LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh"}}, "vtkCellPicker": {"Cxx": {"CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph"}, "VTKLink": {"vtkCellPicker": "https://www.vtk.org/doc/nightly/html/classvtkCellPicker.html#details"}, "Java": {"SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent"}, "Python": {"CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking"}}, "vtkCellTreeLocator": {"Cxx": {"CellTreeLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellTreeLocator"}, "VTKLink": {"vtkCellTreeLocator": "https://www.vtk.org/doc/nightly/html/classvtkCellTreeLocator.html#details"}}, "vtkCellType": {"Cxx": {"UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid"}, "VTKLink": {"vtkCellType": "https://www.vtk.org/doc/nightly/html/classvtkCellType.html#details"}}, "vtkCellTypes": {"Cxx": {"ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "VTKLink": {"vtkCellTypes": "https://www.vtk.org/doc/nightly/html/classvtkCellTypes.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData"}}, "vtkCellTypeSource": {"Cxx": {"CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource"}, "VTKLink": {"vtkCellTypeSource": "https://www.vtk.org/doc/nightly/html/classvtkCellTypeSource.html#details"}, "Python": {"CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource"}}, "vtkCenterOfMass": {"Cxx": {"CenterOfMass": "https://examples.vtk.org/site/Cxx/PolyData/CenterOfMass"}, "VTKLink": {"vtkCenterOfMass": "https://www.vtk.org/doc/nightly/html/classvtkCenterOfMass.html#details"}, "Java": {"CenterOfMass": "https://examples.vtk.org/site/Java/PolyData/CenterOfMass"}}, "vtkCharArray": {"Cxx": {"AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot"}, "VTKLink": {"vtkCharArray": "https://www.vtk.org/doc/nightly/html/classvtkCharArray.html#details"}}, "vtkChart": {"Cxx": {"ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkChart": "https://www.vtk.org/doc/nightly/html/classvtkChart.html#details"}, "Python": {"ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkChartBox": {"Cxx": {"BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart"}, "VTKLink": {"vtkChartBox": "https://www.vtk.org/doc/nightly/html/classvtkChartBox.html#details"}}, "vtkChartHistogram2D": {"Cxx": {"Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D"}, "VTKLink": {"vtkChartHistogram2D": "https://www.vtk.org/doc/nightly/html/classvtkChartHistogram2D.html#details"}}, "vtkChartLegend": {"Cxx": {"FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar"}, "VTKLink": {"vtkChartLegend": "https://www.vtk.org/doc/nightly/html/classvtkChartLegend.html#details"}}, "vtkChartMatrix": {"Cxx": {"ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix"}, "VTKLink": {"vtkChartMatrix": "https://www.vtk.org/doc/nightly/html/classvtkChartMatrix.html#details"}}, "vtkChartParallelCoordinates": {"Cxx": {"ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates"}, "VTKLink": {"vtkChartParallelCoordinates": "https://www.vtk.org/doc/nightly/html/classvtkChartParallelCoordinates.html#details"}}, "vtkChartPie": {"Cxx": {"PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart"}, "VTKLink": {"vtkChartPie": "https://www.vtk.org/doc/nightly/html/classvtkChartPie.html#details"}}, "vtkChartXY": {"Cxx": {"FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkChartXY": "https://www.vtk.org/doc/nightly/html/classvtkChartXY.html#details"}, "Python": {"ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkChartXYZ": {"Cxx": {"PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkChartXYZ": "https://www.vtk.org/doc/nightly/html/classvtkChartXYZ.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkCheckerboardRepresentation": {"Cxx": {"CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget"}, "VTKLink": {"vtkCheckerboardRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkCheckerboardRepresentation.html#details"}}, "vtkCheckerboardWidget": {"Cxx": {"CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget"}, "VTKLink": {"vtkCheckerboardWidget": "https://www.vtk.org/doc/nightly/html/classvtkCheckerboardWidget.html#details"}}, "vtkCircularLayoutStrategy": {"Cxx": {"LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges"}, "VTKLink": {"vtkCircularLayoutStrategy": "https://www.vtk.org/doc/nightly/html/classvtkCircularLayoutStrategy.html#details"}, "Python": {"LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges"}}, "vtkClipClosedSurface": {"Cxx": {"ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface"}, "VTKLink": {"vtkClipClosedSurface": "https://www.vtk.org/doc/nightly/html/classvtkClipClosedSurface.html#details"}}, "vtkClipDataSet": {"Cxx": {"ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData"}, "VTKLink": {"vtkClipDataSet": "https://www.vtk.org/doc/nightly/html/classvtkClipDataSet.html#details"}, "Python": {"ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkClipVolume": {"Cxx": {"ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume"}, "VTKLink": {"vtkClipVolume": "https://www.vtk.org/doc/nightly/html/classvtkClipVolume.html#details"}}, "vtkCMLMoleculeReader": {"Cxx": {"ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML"}, "VTKLink": {"vtkCMLMoleculeReader": "https://www.vtk.org/doc/nightly/html/classvtkCMLMoleculeReader.html#details"}, "Java": {"ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML"}}, "vtkCollisionDetectionFilter": {"Cxx": {"CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection"}, "VTKLink": {"vtkCollisionDetectionFilter": "https://www.vtk.org/doc/nightly/html/classvtkCollisionDetectionFilter.html#details"}, "Python": {"CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection"}}, "vtkColor": {"Cxx": {"GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "VTKLink": {"vtkColor": "https://www.vtk.org/doc/nightly/html/classvtkColor.html#details"}}, "vtkColor3d": {"Cxx": {"OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "VTKLink": {"vtkColor3d": "https://www.vtk.org/doc/nightly/html/classvtkColor3d.html#details"}}, "vtkColor3ub": {"Cxx": {"Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "NamedColorPatches": "https://examples.vtk.org/site/Cxx/Visualization/NamedColorPatches", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ColorSeriesPatches": "https://examples.vtk.org/site/Cxx/Visualization/ColorSeriesPatches", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData"}, "VTKLink": {"vtkColor3ub": "https://www.vtk.org/doc/nightly/html/classvtkColor3ub.html#details"}, "Python": {"PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision"}}, "vtkColor4ub": {"Cxx": {"Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D"}, "VTKLink": {"vtkColor4ub": "https://www.vtk.org/doc/nightly/html/classvtkColor4ub.html#details"}}, "vtkColorLegend": {"Cxx": {"Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D"}, "VTKLink": {"vtkColorLegend": "https://www.vtk.org/doc/nightly/html/classvtkColorLegend.html#details"}}, "vtkColorSeries": {"Cxx": {"Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "LUTUtilities": "https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "ColorSeriesPatches": "https://examples.vtk.org/site/Cxx/Visualization/ColorSeriesPatches", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData"}, "VTKLink": {"vtkColorSeries": "https://www.vtk.org/doc/nightly/html/classvtkColorSeries.html#details"}, "Java": {"ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries"}, "Python": {"Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "LUTUtilities": "https://examples.vtk.org/site/Python/Utilities/LUTUtilities", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "ColorSeriesPatches": "https://examples.vtk.org/site/Python/Visualization/ColorSeriesPatches", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource"}}, "vtkColorTransferFunction": {"Cxx": {"Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ColorTransferFunction": "https://examples.vtk.org/site/Cxx/Utilities/ColorTransferFunction", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "VTKLink": {"vtkColorTransferFunction": "https://www.vtk.org/doc/nightly/html/classvtkColorTransferFunction.html#details"}, "Java": {"SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkCommand": {"Cxx": {"KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "ObserveError": "https://examples.vtk.org/site/Cxx/Utilities/ObserveError", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect"}, "VTKLink": {"vtkCommand": "https://www.vtk.org/doc/nightly/html/classvtkCommand.html#details"}, "Python": {"SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkCompassRepresentation": {"Cxx": {"CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget"}, "VTKLink": {"vtkCompassRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkCompassRepresentation.html#details"}, "Java": {"CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget"}, "Python": {"CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget"}}, "vtkCompassWidget": {"Cxx": {"CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget"}, "VTKLink": {"vtkCompassWidget": "https://www.vtk.org/doc/nightly/html/classvtkCompassWidget.html#details"}, "Java": {"CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget"}, "Python": {"CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget"}}, "vtkCompositeDataDisplayAttributes": {"Cxx": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper"}, "VTKLink": {"vtkCompositeDataDisplayAttributes": "https://www.vtk.org/doc/nightly/html/classvtkCompositeDataDisplayAttributes.html#details"}, "Java": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper"}, "Python": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper"}}, "vtkCompositeDataGeometryFilter": {"Cxx": {"OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "VTKLink": {"vtkCompositeDataGeometryFilter": "https://www.vtk.org/doc/nightly/html/classvtkCompositeDataGeometryFilter.html#details"}, "Python": {"OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData"}}, "vtkCompositeDataSet": {"Cxx": {"ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene"}, "VTKLink": {"vtkCompositeDataSet": "https://www.vtk.org/doc/nightly/html/classvtkCompositeDataSet.html#details"}}, "vtkCompositeDataWriter": {"Cxx": {"Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse"}, "VTKLink": {"vtkCompositeDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkCompositeDataWriter.html#details"}}, "vtkCompositePolyDataMapper": {"Cxx": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper"}, "VTKLink": {"vtkCompositePolyDataMapper": "https://www.vtk.org/doc/nightly/html/classvtkCompositePolyDataMapper.html#details"}, "Python": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper"}}, "vtkCompositePolyDataMapper2": {"Cxx": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper"}, "VTKLink": {"vtkCompositePolyDataMapper2": "https://www.vtk.org/doc/nightly/html/classvtkCompositePolyDataMapper2.html#details"}, "Java": {"CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper"}}, "vtkComputeQuartiles": {"Cxx": {"BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart"}, "VTKLink": {"vtkComputeQuartiles": "https://www.vtk.org/doc/nightly/html/classvtkComputeQuartiles.html#details"}}, "vtkCone": {"Cxx": {"IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkCone": "https://www.vtk.org/doc/nightly/html/classvtkCone.html#details"}, "Java": {"IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe"}, "Python": {"IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream"}}, "vtkConnectivityFilter": {"Cxx": {"RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}, "VTKLink": {"vtkConnectivityFilter": "https://www.vtk.org/doc/nightly/html/classvtkConnectivityFilter.html#details"}, "Python": {"ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow"}}, "vtkContext2D": {"Cxx": {"Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram"}, "VTKLink": {"vtkContext2D": "https://www.vtk.org/doc/nightly/html/classvtkContext2D.html#details"}}, "vtkContext3D": {"Cxx": {"PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D"}, "VTKLink": {"vtkContext3D": "https://www.vtk.org/doc/nightly/html/classvtkContext3D.html#details"}}, "vtkContextActor": {"Cxx": {"ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots"}, "VTKLink": {"vtkContextActor": "https://www.vtk.org/doc/nightly/html/classvtkContextActor.html#details"}, "Python": {"MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkContextItem": {"Cxx": {"Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram"}, "VTKLink": {"vtkContextItem": "https://www.vtk.org/doc/nightly/html/classvtkContextItem.html#details"}}, "vtkContextMouseEvent": {"Cxx": {"SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkContextMouseEvent": "https://www.vtk.org/doc/nightly/html/classvtkContextMouseEvent.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkContextScene": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram"}, "VTKLink": {"vtkContextScene": "https://www.vtk.org/doc/nightly/html/classvtkContextScene.html#details"}, "Python": {"MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkContextTransform": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid"}, "VTKLink": {"vtkContextTransform": "https://www.vtk.org/doc/nightly/html/classvtkContextTransform.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid"}}, "vtkContextView": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkContextView": "https://www.vtk.org/doc/nightly/html/classvtkContextView.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkContourRepresentation": {"Cxx": {"PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer"}, "VTKLink": {"vtkContourRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkContourRepresentation.html#details"}}, "vtkContourTriangulator": {"Cxx": {"ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator"}, "VTKLink": {"vtkContourTriangulator": "https://www.vtk.org/doc/nightly/html/classvtkContourTriangulator.html#details"}, "Python": {"ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator"}}, "vtkContourValues": {"Cxx": {"RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface"}, "VTKLink": {"vtkContourValues": "https://www.vtk.org/doc/nightly/html/classvtkContourValues.html#details"}}, "vtkConvexPointSet": {"Cxx": {"ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet"}, "VTKLink": {"vtkConvexPointSet": "https://www.vtk.org/doc/nightly/html/classvtkConvexPointSet.html#details"}, "Java": {"ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet"}, "Python": {"ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet"}}, "vtkCoordinate": {"Cxx": {"MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "Coordinate": "https://examples.vtk.org/site/Cxx/Utilities/Coordinate", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "VTKLink": {"vtkCoordinate": "https://www.vtk.org/doc/nightly/html/classvtkCoordinate.html#details"}, "Java": {"MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText"}, "Python": {"MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkCornerAnnotation": {"Cxx": {"PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation"}, "VTKLink": {"vtkCornerAnnotation": "https://www.vtk.org/doc/nightly/html/classvtkCornerAnnotation.html#details"}, "Java": {"CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation"}}, "vtkCubeAxesActor": {"Cxx": {"DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor"}, "VTKLink": {"vtkCubeAxesActor": "https://www.vtk.org/doc/nightly/html/classvtkCubeAxesActor.html#details"}, "Java": {"CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor"}, "Python": {"CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor"}}, "vtkCubeAxesActor2D": {"Cxx": {"CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D"}, "VTKLink": {"vtkCubeAxesActor2D": "https://www.vtk.org/doc/nightly/html/classvtkCubeAxesActor2D.html#details"}, "Java": {"CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D"}}, "vtkCubicLine": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkCubicLine": "https://www.vtk.org/doc/nightly/html/classvtkCubicLine.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkCullerCollection": {"Cxx": {"LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink"}, "VTKLink": {"vtkCullerCollection": "https://www.vtk.org/doc/nightly/html/classvtkCullerCollection.html#details"}}, "vtkCursor2D": {"Cxx": {"Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D"}, "VTKLink": {"vtkCursor2D": "https://www.vtk.org/doc/nightly/html/classvtkCursor2D.html#details"}, "Java": {"Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D"}}, "vtkCursor3D": {"Cxx": {"Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D"}, "VTKLink": {"vtkCursor3D": "https://www.vtk.org/doc/nightly/html/classvtkCursor3D.html#details"}, "Java": {"Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D"}}, "vtkCylinder": {"Cxx": {"ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkCylinder": "https://www.vtk.org/doc/nightly/html/classvtkCylinder.html#details"}, "Python": {"ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling"}}, "vtkDataArray": {"Cxx": {"PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents", "ForLoop": "https://examples.vtk.org/site/Cxx/Utilities/ForLoop", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game"}, "VTKLink": {"vtkDataArray": "https://www.vtk.org/doc/nightly/html/classvtkDataArray.html#details"}}, "vtkDataObjectReader": {"Cxx": {"FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkDataObjectReader": "https://www.vtk.org/doc/nightly/html/classvtkDataObjectReader.html#details"}, "Python": {"FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkDataObjectToDataSetFilter": {"Cxx": {"FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkDataObjectToDataSetFilter": "https://www.vtk.org/doc/nightly/html/classvtkDataObjectToDataSetFilter.html#details"}, "Python": {"FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkDataObjectTree": {"Cxx": {"ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene"}, "VTKLink": {"vtkDataObjectTree": "https://www.vtk.org/doc/nightly/html/classvtkDataObjectTree.html#details"}}, "vtkDataObjectTreeIterator": {"Cxx": {"ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene"}, "VTKLink": {"vtkDataObjectTreeIterator": "https://www.vtk.org/doc/nightly/html/classvtkDataObjectTreeIterator.html#details"}}, "vtkDataSetCollection": {"Cxx": {"KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints", "KdTree": "https://examples.vtk.org/site/Cxx/DataStructures/KdTree"}, "VTKLink": {"vtkDataSetCollection": "https://www.vtk.org/doc/nightly/html/classvtkDataSetCollection.html#details"}}, "vtkDataSetReader": {"Cxx": {"RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow"}, "VTKLink": {"vtkDataSetReader": "https://www.vtk.org/doc/nightly/html/classvtkDataSetReader.html#details"}, "Python": {"Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow"}}, "vtkDataSetTriangleFilter": {"Cxx": {"IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid"}, "VTKLink": {"vtkDataSetTriangleFilter": "https://www.vtk.org/doc/nightly/html/classvtkDataSetTriangleFilter.html#details"}}, "vtkDataSetWriter": {"Cxx": {"ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping"}, "VTKLink": {"vtkDataSetWriter": "https://www.vtk.org/doc/nightly/html/classvtkDataSetWriter.html#details"}}, "vtkDecimatePolylineFilter": {"Cxx": {"DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline"}, "VTKLink": {"vtkDecimatePolylineFilter": "https://www.vtk.org/doc/nightly/html/classvtkDecimatePolylineFilter.html#details"}}, "vtkDeformPointSet": {"Cxx": {"DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet"}, "VTKLink": {"vtkDeformPointSet": "https://www.vtk.org/doc/nightly/html/classvtkDeformPointSet.html#details"}, "Python": {"DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet"}}, "vtkDelaunay3D": {"Cxx": {"PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPUnstructuredGridWriter", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D"}, "VTKLink": {"vtkDelaunay3D": "https://www.vtk.org/doc/nightly/html/classvtkDelaunay3D.html#details"}, "Java": {"XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLPUnstructuredGridWriter"}, "Python": {"ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter"}}, "vtkDelimitedTextReader": {"Cxx": {"ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator"}, "VTKLink": {"vtkDelimitedTextReader": "https://www.vtk.org/doc/nightly/html/classvtkDelimitedTextReader.html#details"}, "Python": {"CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkDelimitedTextWriter": {"Cxx": {"DelimitedTextWriter": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter"}, "VTKLink": {"vtkDelimitedTextWriter": "https://www.vtk.org/doc/nightly/html/classvtkDelimitedTextWriter.html#details"}}, "vtkDemandDrivenPipeline": {"Cxx": {"vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter"}, "VTKLink": {"vtkDemandDrivenPipeline": "https://www.vtk.org/doc/nightly/html/classvtkDemandDrivenPipeline.html#details"}}, "vtkDenseArray": {"Cxx": {"ArrayToTable": "https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable", "AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable", "2DArray": "https://examples.vtk.org/site/Cxx/Utilities/2DArray", "CustomDenseArray": "https://examples.vtk.org/site/Cxx/Utilities/CustomDenseArray", "DenseArrayRange": "https://examples.vtk.org/site/Cxx/Utilities/DenseArrayRange", "3DArray": "https://examples.vtk.org/site/Cxx/Utilities/3DArray", "ArrayWriter": "https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter"}, "VTKLink": {"vtkDenseArray": "https://www.vtk.org/doc/nightly/html/classvtkDenseArray.html#details"}}, "vtkDensifyPointCloudFilter": {"Cxx": {"DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints"}, "VTKLink": {"vtkDensifyPointCloudFilter": "https://www.vtk.org/doc/nightly/html/classvtkDensifyPointCloudFilter.html#details"}}, "vtkDepthSortPolyData": {"Cxx": {"CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData"}, "VTKLink": {"vtkDepthSortPolyData": "https://www.vtk.org/doc/nightly/html/classvtkDepthSortPolyData.html#details"}}, "vtkDirectedGraph": {"Cxx": {"MutableDirectedGraphToDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/MutableDirectedGraphToDirectedGraph", "DirectedGraphToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/DirectedGraphToMutableDirectedGraph"}, "VTKLink": {"vtkDirectedGraph": "https://www.vtk.org/doc/nightly/html/classvtkDirectedGraph.html#details"}}, "vtkDirectory": {"Cxx": {"FilenameFunctions": "https://examples.vtk.org/site/Cxx/Utilities/FilenameFunctions"}, "VTKLink": {"vtkDirectory": "https://www.vtk.org/doc/nightly/html/classvtkDirectory.html#details"}}, "vtkDiscreteFlyingEdges3D": {"Cxx": {"DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels"}, "VTKLink": {"vtkDiscreteFlyingEdges3D": "https://www.vtk.org/doc/nightly/html/classvtkDiscreteFlyingEdges3D.html#details"}, "Python": {"MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkDiscreteMarchingCubes": {"Cxx": {"SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels"}, "VTKLink": {"vtkDiscreteMarchingCubes": "https://www.vtk.org/doc/nightly/html/classvtkDiscreteMarchingCubes.html#details"}, "Python": {"MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkDiscretizableColorTransferFunction": {"Cxx": {"RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "DiscretizableColorTransferFunction": "https://examples.vtk.org/site/Cxx/Utilities/DiscretizableColorTransferFunction", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader"}, "VTKLink": {"vtkDiscretizableColorTransferFunction": "https://www.vtk.org/doc/nightly/html/classvtkDiscretizableColorTransferFunction.html#details"}, "Java": {"DiscretizableColorTransferFunction": "https://examples.vtk.org/site/Java/Utilities/DiscretizableColorTransferFunction"}, "Python": {"ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader"}}, "vtkDistancePolyDataFilter": {"Cxx": {"DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter"}, "VTKLink": {"vtkDistancePolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkDistancePolyDataFilter.html#details"}}, "vtkDistanceRepresentation": {"Cxx": {"DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget"}, "VTKLink": {"vtkDistanceRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkDistanceRepresentation.html#details"}}, "vtkDistanceToCamera": {"Cxx": {"DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera"}, "VTKLink": {"vtkDistanceToCamera": "https://www.vtk.org/doc/nightly/html/classvtkDistanceToCamera.html#details"}, "Java": {"DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera"}}, "vtkDistanceWidget": {"Cxx": {"DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget"}, "VTKLink": {"vtkDistanceWidget": "https://www.vtk.org/doc/nightly/html/classvtkDistanceWidget.html#details"}, "Java": {"DistanceWidget": "https://examples.vtk.org/site/Java/Widgets/DistanceWidget"}}, "vtkEdgeListIterator": {"Cxx": {"EdgeListIterator": "https://examples.vtk.org/site/Cxx/Graphs/EdgeListIterator"}, "VTKLink": {"vtkEdgeListIterator": "https://www.vtk.org/doc/nightly/html/classvtkEdgeListIterator.html#details"}}, "vtkEdgePoints": {"Cxx": {"EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints"}, "VTKLink": {"vtkEdgePoints": "https://www.vtk.org/doc/nightly/html/classvtkEdgePoints.html#details"}}, "vtkEllipticalButtonSource": {"Cxx": {"EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton"}, "VTKLink": {"vtkEllipticalButtonSource": "https://www.vtk.org/doc/nightly/html/classvtkEllipticalButtonSource.html#details"}}, "vtkEuclideanClusterExtraction": {"Cxx": {"ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters"}, "VTKLink": {"vtkEuclideanClusterExtraction": "https://www.vtk.org/doc/nightly/html/classvtkEuclideanClusterExtraction.html#details"}}, "vtkEventQtSlotConnect": {"Cxx": {"EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect"}, "VTKLink": {"vtkEventQtSlotConnect": "https://www.vtk.org/doc/nightly/html/classvtkEventQtSlotConnect.html#details"}}, "vtkExecutive": {"Cxx": {"ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "VTKLink": {"vtkExecutive": "https://www.vtk.org/doc/nightly/html/classvtkExecutive.html#details"}}, "vtkExodusIIReader": {"Cxx": {"ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "VTKLink": {"vtkExodusIIReader": "https://www.vtk.org/doc/nightly/html/classvtkExodusIIReader.html#details"}, "Python": {"ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData"}}, "vtkExodusIIWriter": {"Cxx": {"ExodusIIWriter": "https://examples.vtk.org/site/Cxx/Parallel/ExodusIIWriter"}, "VTKLink": {"vtkExodusIIWriter": "https://www.vtk.org/doc/nightly/html/classvtkExodusIIWriter.html#details"}, "Java": {"ExodusIIWriter": "https://examples.vtk.org/site/Java/Parallel/ExodusIIWriter"}}, "vtkExplicitStructuredGrid": {"Cxx": {"CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid"}, "VTKLink": {"vtkExplicitStructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkExplicitStructuredGrid.html#details"}, "Python": {"CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid"}}, "vtkExplicitStructuredGridToUnstructuredGrid": {"Cxx": {"CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid"}, "VTKLink": {"vtkExplicitStructuredGridToUnstructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkExplicitStructuredGridToUnstructuredGrid.html#details"}, "Python": {"CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid"}}, "vtkExtractCells": {"Cxx": {"OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells"}, "VTKLink": {"vtkExtractCells": "https://www.vtk.org/doc/nightly/html/classvtkExtractCells.html#details"}}, "vtkExtractEnclosedPoints": {"Cxx": {"OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints"}, "VTKLink": {"vtkExtractEnclosedPoints": "https://www.vtk.org/doc/nightly/html/classvtkExtractEnclosedPoints.html#details"}}, "vtkExtractGeometry": {"Cxx": {"HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData"}, "VTKLink": {"vtkExtractGeometry": "https://www.vtk.org/doc/nightly/html/classvtkExtractGeometry.html#details"}, "Python": {"ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData"}}, "vtkExtractGrid": {"Cxx": {"PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering"}, "VTKLink": {"vtkExtractGrid": "https://www.vtk.org/doc/nightly/html/classvtkExtractGrid.html#details"}, "Python": {"PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering"}}, "vtkExtractPoints": {"Cxx": {"ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkExtractPoints": "https://www.vtk.org/doc/nightly/html/classvtkExtractPoints.html#details"}}, "vtkExtractPolyDataGeometry": {"Cxx": {"HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection"}, "VTKLink": {"vtkExtractPolyDataGeometry": "https://www.vtk.org/doc/nightly/html/classvtkExtractPolyDataGeometry.html#details"}}, "vtkExtractSurface": {"Cxx": {"ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface"}, "VTKLink": {"vtkExtractSurface": "https://www.vtk.org/doc/nightly/html/classvtkExtractSurface.html#details"}}, "vtkExtractVOI": {"Cxx": {"ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization"}, "VTKLink": {"vtkExtractVOI": "https://www.vtk.org/doc/nightly/html/classvtkExtractVOI.html#details"}, "Java": {"ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC"}, "Python": {"FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor"}}, "vtkFastSplatter": {"Cxx": {"FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter"}, "VTKLink": {"vtkFastSplatter": "https://www.vtk.org/doc/nightly/html/classvtkFastSplatter.html#details"}}, "vtkFFMPEGWriter": {"Cxx": {"FFMPEG": "https://examples.vtk.org/site/Cxx/Video/FFMPEG"}, "VTKLink": {"vtkFFMPEGWriter": "https://www.vtk.org/doc/nightly/html/classvtkFFMPEGWriter.html#details"}}, "vtkFieldDataToAttributeDataFilter": {"Cxx": {"Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkFieldDataToAttributeDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkFieldDataToAttributeDataFilter.html#details"}, "Python": {"FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkFileOutputWindow": {"Cxx": {"FileOutputWindow": "https://examples.vtk.org/site/Cxx/Utilities/FileOutputWindow"}, "VTKLink": {"vtkFileOutputWindow": "https://www.vtk.org/doc/nightly/html/classvtkFileOutputWindow.html#details"}}, "vtkFitImplicitFunction": {"Cxx": {"FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction"}, "VTKLink": {"vtkFitImplicitFunction": "https://www.vtk.org/doc/nightly/html/classvtkFitImplicitFunction.html#details"}, "Java": {"FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction"}}, "vtkFitToHeightMapFilter": {"Cxx": {"FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "VTKLink": {"vtkFitToHeightMapFilter": "https://www.vtk.org/doc/nightly/html/classvtkFitToHeightMapFilter.html#details"}}, "vtkFixedPointVolumeRayCastMapper": {"Cxx": {"SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "VTKLink": {"vtkFixedPointVolumeRayCastMapper": "https://www.vtk.org/doc/nightly/html/classvtkFixedPointVolumeRayCastMapper.html#details"}, "Java": {"SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkFloatingPointExceptions": {"Cxx": {"FloatingPointExceptions": "https://examples.vtk.org/site/Cxx/SimpleOperations/FloatingPointExceptions"}, "VTKLink": {"vtkFloatingPointExceptions": "https://www.vtk.org/doc/nightly/html/classvtkFloatingPointExceptions.html#details"}}, "vtkFlyingEdges2D": {"Cxx": {"FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice"}, "VTKLink": {"vtkFlyingEdges2D": "https://www.vtk.org/doc/nightly/html/classvtkFlyingEdges2D.html#details"}, "Python": {"FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice"}}, "vtkFlyingEdges3D": {"Cxx": {"HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "VTKLink": {"vtkFlyingEdges3D": "https://www.vtk.org/doc/nightly/html/classvtkFlyingEdges3D.html#details"}, "Python": {"HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3"}}, "vtkFollower": {"Cxx": {"TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkFollower": "https://www.vtk.org/doc/nightly/html/classvtkFollower.html#details"}, "Java": {"TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower"}, "Python": {"TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkForceDirectedLayoutStrategy": {"Cxx": {"ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights"}, "VTKLink": {"vtkForceDirectedLayoutStrategy": "https://www.vtk.org/doc/nightly/html/classvtkForceDirectedLayoutStrategy.html#details"}, "Python": {"RandomGraphSource": "https://examples.vtk.org/site/Python/Graphs/RandomGraphSource", "ConstructGraph": "https://examples.vtk.org/site/Python/Graphs/ConstructGraph", "EdgeWeights": "https://examples.vtk.org/site/Python/Graphs/EdgeWeights", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices"}}, "vtkFreeTypeTools": {"Cxx": {"WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "VTKLink": {"vtkFreeTypeTools": "https://www.vtk.org/doc/nightly/html/classvtkFreeTypeTools.html#details"}}, "vtkFunctionParser": {"Cxx": {"FunctionParser": "https://examples.vtk.org/site/Cxx/Utilities/FunctionParser"}, "VTKLink": {"vtkFunctionParser": "https://www.vtk.org/doc/nightly/html/classvtkFunctionParser.html#details"}, "Java": {"FunctionParser": "https://examples.vtk.org/site/Java/Utilities/FunctionParser"}}, "vtkGaussianKernel": {"Cxx": {"PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "VTKLink": {"vtkGaussianKernel": "https://www.vtk.org/doc/nightly/html/classvtkGaussianKernel.html#details"}, "Python": {"PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkGaussianSplatter": {"Cxx": {"EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance"}, "VTKLink": {"vtkGaussianSplatter": "https://www.vtk.org/doc/nightly/html/classvtkGaussianSplatter.html#details"}, "Python": {"GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance"}}, "vtkGenericCell": {"Cxx": {"RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "CellTreeLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellTreeLocator", "ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}, "VTKLink": {"vtkGenericCell": "https://www.vtk.org/doc/nightly/html/classvtkGenericCell.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo"}}, "vtkGenericClip": {"Cxx": {"GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip"}, "VTKLink": {"vtkGenericClip": "https://www.vtk.org/doc/nightly/html/classvtkGenericClip.html#details"}}, "vtkGenericDataArray": {"Cxx": {"TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter"}, "VTKLink": {"vtkGenericDataArray": "https://www.vtk.org/doc/nightly/html/classvtkGenericDataArray.html#details"}}, "vtkGenericDataObjectReader": {"Cxx": {"GenericDataObjectReader": "https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader"}, "VTKLink": {"vtkGenericDataObjectReader": "https://www.vtk.org/doc/nightly/html/classvtkGenericDataObjectReader.html#details"}}, "vtkGenericOpenGLRenderWindow": {"Cxx": {"BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkGenericOpenGLRenderWindow": "https://www.vtk.org/doc/nightly/html/classvtkGenericOpenGLRenderWindow.html#details"}}, "vtkGenericOutlineFilter": {"Cxx": {"FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow"}, "VTKLink": {"vtkGenericOutlineFilter": "https://www.vtk.org/doc/nightly/html/classvtkGenericOutlineFilter.html#details"}}, "vtkGeometryFilter": {"Cxx": {"GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData"}, "VTKLink": {"vtkGeometryFilter": "https://www.vtk.org/doc/nightly/html/classvtkGeometryFilter.html#details"}, "Python": {"Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels"}}, "vtkGLTFExporter": {"Cxx": {"ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter"}, "VTKLink": {"vtkGLTFExporter": "https://www.vtk.org/doc/nightly/html/classvtkGLTFExporter.html#details"}}, "vtkGLTFImporter": {"Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtkGLTFImporter": "https://www.vtk.org/doc/nightly/html/classvtkGLTFImporter.html#details"}}, "vtkGlyph2D": {"Cxx": {"Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField"}, "VTKLink": {"vtkGlyph2D": "https://www.vtk.org/doc/nightly/html/classvtkGlyph2D.html#details"}, "Java": {"Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D"}, "Python": {"Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D"}}, "vtkGlyph3DMapper": {"Cxx": {"QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkGlyph3DMapper": "https://www.vtk.org/doc/nightly/html/classvtkGlyph3DMapper.html#details"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet"}, "Python": {"AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera"}}, "vtkGlyphSource2D": {"Cxx": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph"}, "VTKLink": {"vtkGlyphSource2D": "https://www.vtk.org/doc/nightly/html/classvtkGlyphSource2D.html#details"}, "Python": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph"}}, "vtkGradientFilter": {"Cxx": {"GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter"}, "VTKLink": {"vtkGradientFilter": "https://www.vtk.org/doc/nightly/html/classvtkGradientFilter.html#details"}}, "vtkGraph": {"Cxx": {"GraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmFilter", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "GraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmSource", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents"}, "VTKLink": {"vtkGraph": "https://www.vtk.org/doc/nightly/html/classvtkGraph.html#details"}}, "vtkGraphAlgorithm": {"Cxx": {"vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter"}, "VTKLink": {"vtkGraphAlgorithm": "https://www.vtk.org/doc/nightly/html/classvtkGraphAlgorithm.html#details"}}, "vtkGraphicsFactory": {"Cxx": {"OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering"}, "VTKLink": {"vtkGraphicsFactory": "https://www.vtk.org/doc/nightly/html/classvtkGraphicsFactory.html#details"}}, "vtkGraphLayout": {"Cxx": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph"}, "VTKLink": {"vtkGraphLayout": "https://www.vtk.org/doc/nightly/html/classvtkGraphLayout.html#details"}, "Python": {"VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph"}}, "vtkGraphLayoutStrategy": {"Cxx": {"XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader"}, "VTKLink": {"vtkGraphLayoutStrategy": "https://www.vtk.org/doc/nightly/html/classvtkGraphLayoutStrategy.html#details"}}, "vtkGraphToGlyphs": {"Cxx": {"ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize"}, "VTKLink": {"vtkGraphToGlyphs": "https://www.vtk.org/doc/nightly/html/classvtkGraphToGlyphs.html#details"}, "Python": {"ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices"}}, "vtkGraphToPolyData": {"Cxx": {"SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph"}, "VTKLink": {"vtkGraphToPolyData": "https://www.vtk.org/doc/nightly/html/classvtkGraphToPolyData.html#details"}, "Python": {"GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph"}}, "vtkHardwareSelector": {"Cxx": {"ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells"}, "VTKLink": {"vtkHardwareSelector": "https://www.vtk.org/doc/nightly/html/classvtkHardwareSelector.html#details"}, "Python": {"HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector"}}, "vtkHausdorffDistancePointSetFilter": {"Cxx": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas"}, "VTKLink": {"vtkHausdorffDistancePointSetFilter": "https://www.vtk.org/doc/nightly/html/classvtkHausdorffDistancePointSetFilter.html#details"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas"}}, "vtkHDFReader": {"Cxx": {"TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader"}, "VTKLink": {"vtkHDFReader": "https://www.vtk.org/doc/nightly/html/classvtkHDFReader.html#details"}, "Python": {"TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader"}}, "vtkHDRReader": {"Cxx": {"HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint"}, "VTKLink": {"vtkHDRReader": "https://www.vtk.org/doc/nightly/html/classvtkHDRReader.html#details"}, "Python": {"HDRReader": "https://examples.vtk.org/site/Python/IO/HDRReader", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint"}}, "vtkHedgeHog": {"Cxx": {"SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV"}, "VTKLink": {"vtkHedgeHog": "https://www.vtk.org/doc/nightly/html/classvtkHedgeHog.html#details"}, "Java": {"ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV"}, "Python": {"SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV"}}, "vtkHexagonalPrism": {"Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "VTKLink": {"vtkHexagonalPrism": "https://www.vtk.org/doc/nightly/html/classvtkHexagonalPrism.html#details"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkHoverWidget": {"Cxx": {"HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget"}, "VTKLink": {"vtkHoverWidget": "https://www.vtk.org/doc/nightly/html/classvtkHoverWidget.html#details"}}, "vtkHull": {"Cxx": {"ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes"}, "VTKLink": {"vtkHull": "https://www.vtk.org/doc/nightly/html/classvtkHull.html#details"}, "Python": {"Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes"}}, "vtkHyperStreamline": {"Cxx": {"HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline"}, "VTKLink": {"vtkHyperStreamline": "https://www.vtk.org/doc/nightly/html/classvtkHyperStreamline.html#details"}, "Python": {"HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline"}}, "vtkHyperTreeGridSource": {"Cxx": {"HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource"}, "VTKLink": {"vtkHyperTreeGridSource": "https://www.vtk.org/doc/nightly/html/classvtkHyperTreeGridSource.html#details"}, "Java": {"HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource"}, "Python": {"HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource"}}, "vtkHyperTreeGridToUnstructuredGrid": {"Cxx": {"HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource"}, "VTKLink": {"vtkHyperTreeGridToUnstructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkHyperTreeGridToUnstructuredGrid.html#details"}, "Python": {"HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource"}}, "vtkIdFilter": {"Cxx": {"CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs"}, "VTKLink": {"vtkIdFilter": "https://www.vtk.org/doc/nightly/html/classvtkIdFilter.html#details"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkImageAccumulate": {"Cxx": {"ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ImageAccumulate": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulate", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels"}, "VTKLink": {"vtkImageAccumulate": "https://www.vtk.org/doc/nightly/html/classvtkImageAccumulate.html#details"}, "Python": {"GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkImageAlgorithm": {"Cxx": {"vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter"}, "VTKLink": {"vtkImageAlgorithm": "https://www.vtk.org/doc/nightly/html/classvtkImageAlgorithm.html#details"}}, "vtkImageAnisotropicDiffusion2D": {"Cxx": {"ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D"}, "VTKLink": {"vtkImageAnisotropicDiffusion2D": "https://www.vtk.org/doc/nightly/html/classvtkImageAnisotropicDiffusion2D.html#details"}}, "vtkImageAppendComponents": {"Cxx": {"WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels"}, "VTKLink": {"vtkImageAppendComponents": "https://www.vtk.org/doc/nightly/html/classvtkImageAppendComponents.html#details"}}, "vtkImageBlend": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "VTKLink": {"vtkImageBlend": "https://www.vtk.org/doc/nightly/html/classvtkImageBlend.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform"}}, "vtkImageButterworthHighPass": {"Cxx": {"IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass"}, "VTKLink": {"vtkImageButterworthHighPass": "https://www.vtk.org/doc/nightly/html/classvtkImageButterworthHighPass.html#details"}, "Python": {"IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass"}}, "vtkImageChangeInformation": {"Cxx": {"ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage"}, "VTKLink": {"vtkImageChangeInformation": "https://www.vtk.org/doc/nightly/html/classvtkImageChangeInformation.html#details"}}, "vtkImageCheckerboard": {"Cxx": {"ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget"}, "VTKLink": {"vtkImageCheckerboard": "https://www.vtk.org/doc/nightly/html/classvtkImageCheckerboard.html#details"}}, "vtkImageCityBlockDistance": {"Cxx": {"ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance"}, "VTKLink": {"vtkImageCityBlockDistance": "https://www.vtk.org/doc/nightly/html/classvtkImageCityBlockDistance.html#details"}}, "vtkImageClip": {"Cxx": {"MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip"}, "VTKLink": {"vtkImageClip": "https://www.vtk.org/doc/nightly/html/classvtkImageClip.html#details"}}, "vtkImageConstantPad": {"Cxx": {"Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice"}, "VTKLink": {"vtkImageConstantPad": "https://www.vtk.org/doc/nightly/html/classvtkImageConstantPad.html#details"}, "Python": {"Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice"}}, "vtkImageContinuousDilate3D": {"Cxx": {"ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D"}, "VTKLink": {"vtkImageContinuousDilate3D": "https://www.vtk.org/doc/nightly/html/classvtkImageContinuousDilate3D.html#details"}}, "vtkImageContinuousErode3D": {"Cxx": {"ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D"}, "VTKLink": {"vtkImageContinuousErode3D": "https://www.vtk.org/doc/nightly/html/classvtkImageContinuousErode3D.html#details"}}, "vtkImageConvolve": {"Cxx": {"ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve"}, "VTKLink": {"vtkImageConvolve": "https://www.vtk.org/doc/nightly/html/classvtkImageConvolve.html#details"}}, "vtkImageCorrelation": {"Cxx": {"ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation"}, "VTKLink": {"vtkImageCorrelation": "https://www.vtk.org/doc/nightly/html/classvtkImageCorrelation.html#details"}}, "vtkImageDataToPointSet": {"Cxx": {"VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ImageDataToPointSet": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet"}, "VTKLink": {"vtkImageDataToPointSet": "https://www.vtk.org/doc/nightly/html/classvtkImageDataToPointSet.html#details"}}, "vtkImageDifference": {"Cxx": {"ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference"}, "VTKLink": {"vtkImageDifference": "https://www.vtk.org/doc/nightly/html/classvtkImageDifference.html#details"}}, "vtkImageDilateErode3D": {"Cxx": {"MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D"}, "VTKLink": {"vtkImageDilateErode3D": "https://www.vtk.org/doc/nightly/html/classvtkImageDilateErode3D.html#details"}, "Python": {"MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison"}}, "vtkImageDivergence": {"Cxx": {"ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence"}, "VTKLink": {"vtkImageDivergence": "https://www.vtk.org/doc/nightly/html/classvtkImageDivergence.html#details"}}, "vtkImageDotProduct": {"Cxx": {"DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct"}, "VTKLink": {"vtkImageDotProduct": "https://www.vtk.org/doc/nightly/html/classvtkImageDotProduct.html#details"}}, "vtkImageEllipsoidSource": {"Cxx": {"ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D"}, "VTKLink": {"vtkImageEllipsoidSource": "https://www.vtk.org/doc/nightly/html/classvtkImageEllipsoidSource.html#details"}, "Java": {"ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation"}}, "vtkImageEuclideanToPolar": {"Cxx": {"ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient"}, "VTKLink": {"vtkImageEuclideanToPolar": "https://www.vtk.org/doc/nightly/html/classvtkImageEuclideanToPolar.html#details"}, "Python": {"ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient"}}, "vtkImageExport": {"Cxx": {"ImageExport": "https://examples.vtk.org/site/Cxx/Images/ImageExport"}, "VTKLink": {"vtkImageExport": "https://www.vtk.org/doc/nightly/html/classvtkImageExport.html#details"}}, "vtkImageExtractComponents": {"Cxx": {"IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt"}, "VTKLink": {"vtkImageExtractComponents": "https://www.vtk.org/doc/nightly/html/classvtkImageExtractComponents.html#details"}, "Python": {"IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient"}}, "vtkImageFFT": {"Cxx": {"IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT"}, "VTKLink": {"vtkImageFFT": "https://www.vtk.org/doc/nightly/html/classvtkImageFFT.html#details"}, "Java": {"ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT"}, "Python": {"IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum"}}, "vtkImageFlip": {"Cxx": {"Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint"}, "VTKLink": {"vtkImageFlip": "https://www.vtk.org/doc/nightly/html/classvtkImageFlip.html#details"}, "Java": {"Flip": "https://examples.vtk.org/site/Java/Images/Flip"}, "Python": {"PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint"}}, "vtkImageFourierCenter": {"Cxx": {"VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum"}, "VTKLink": {"vtkImageFourierCenter": "https://www.vtk.org/doc/nightly/html/classvtkImageFourierCenter.html#details"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum"}}, "vtkImageGaussianSmooth": {"Cxx": {"IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface"}, "VTKLink": {"vtkImageGaussianSmooth": "https://www.vtk.org/doc/nightly/html/classvtkImageGaussianSmooth.html#details"}, "Python": {"GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface"}}, "vtkImageGradient": {"Cxx": {"ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient"}, "VTKLink": {"vtkImageGradient": "https://www.vtk.org/doc/nightly/html/classvtkImageGradient.html#details"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable"}}, "vtkImageGradientMagnitude": {"Cxx": {"ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude"}, "VTKLink": {"vtkImageGradientMagnitude": "https://www.vtk.org/doc/nightly/html/classvtkImageGradientMagnitude.html#details"}}, "vtkImageGridSource": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource"}, "VTKLink": {"vtkImageGridSource": "https://www.vtk.org/doc/nightly/html/classvtkImageGridSource.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform"}}, "vtkImageHistogram": {"Cxx": {"ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram"}, "VTKLink": {"vtkImageHistogram": "https://www.vtk.org/doc/nightly/html/classvtkImageHistogram.html#details"}}, "vtkImageHSVToRGB": {"Cxx": {"ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient"}, "VTKLink": {"vtkImageHSVToRGB": "https://www.vtk.org/doc/nightly/html/classvtkImageHSVToRGB.html#details"}, "Python": {"ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient"}}, "vtkImageHybridMedian2D": {"Cxx": {"HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D"}, "VTKLink": {"vtkImageHybridMedian2D": "https://www.vtk.org/doc/nightly/html/classvtkImageHybridMedian2D.html#details"}, "Python": {"HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison"}}, "vtkImageIdealHighPass": {"Cxx": {"IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass"}, "VTKLink": {"vtkImageIdealHighPass": "https://www.vtk.org/doc/nightly/html/classvtkImageIdealHighPass.html#details"}, "Python": {"IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass"}}, "vtkImageImport": {"Cxx": {"ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport"}, "VTKLink": {"vtkImageImport": "https://www.vtk.org/doc/nightly/html/classvtkImageImport.html#details"}, "Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy"}}, "vtkImageIslandRemoval2D": {"Cxx": {"ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface"}, "VTKLink": {"vtkImageIslandRemoval2D": "https://www.vtk.org/doc/nightly/html/classvtkImageIslandRemoval2D.html#details"}, "Python": {"FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface"}}, "vtkImageIterator": {"Cxx": {"ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "ImageIterator": "https://examples.vtk.org/site/Cxx/ImageData/ImageIterator", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "VTKLink": {"vtkImageIterator": "https://www.vtk.org/doc/nightly/html/classvtkImageIterator.html#details"}}, "vtkImageLaplacian": {"Cxx": {"EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian"}, "VTKLink": {"vtkImageLaplacian": "https://www.vtk.org/doc/nightly/html/classvtkImageLaplacian.html#details"}, "Python": {"EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges"}}, "vtkImageLogarithmicScale": {"Cxx": {"VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum"}, "VTKLink": {"vtkImageLogarithmicScale": "https://www.vtk.org/doc/nightly/html/classvtkImageLogarithmicScale.html#details"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum"}}, "vtkImageLuminance": {"Cxx": {"ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector"}, "VTKLink": {"vtkImageLuminance": "https://www.vtk.org/doc/nightly/html/classvtkImageLuminance.html#details"}, "Python": {"ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp"}}, "vtkImageMagnify": {"Cxx": {"ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient"}, "VTKLink": {"vtkImageMagnify": "https://www.vtk.org/doc/nightly/html/classvtkImageMagnify.html#details"}, "Python": {"ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient"}}, "vtkImageMapper": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice"}, "VTKLink": {"vtkImageMapper": "https://www.vtk.org/doc/nightly/html/classvtkImageMapper.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform"}}, "vtkImageMapper3D": {"Cxx": {"TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3"}, "VTKLink": {"vtkImageMapper3D": "https://www.vtk.org/doc/nightly/html/classvtkImageMapper3D.html#details"}}, "vtkImageMapToWindowLevelColors": {"Cxx": {"Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass"}, "VTKLink": {"vtkImageMapToWindowLevelColors": "https://www.vtk.org/doc/nightly/html/classvtkImageMapToWindowLevelColors.html#details"}, "Python": {"Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass"}}, "vtkImageMarchingCubes": {"Cxx": {"IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample"}, "VTKLink": {"vtkImageMarchingCubes": "https://www.vtk.org/doc/nightly/html/classvtkImageMarchingCubes.html#details"}, "Python": {"IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample"}}, "vtkImageMask": {"Cxx": {"ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask"}, "VTKLink": {"vtkImageMask": "https://www.vtk.org/doc/nightly/html/classvtkImageMask.html#details"}}, "vtkImageMathematics": {"Cxx": {"MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes"}, "VTKLink": {"vtkImageMathematics": "https://www.vtk.org/doc/nightly/html/classvtkImageMathematics.html#details"}, "Python": {"HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes"}}, "vtkImageMedian3D": {"Cxx": {"MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D"}, "VTKLink": {"vtkImageMedian3D": "https://www.vtk.org/doc/nightly/html/classvtkImageMedian3D.html#details"}, "Python": {"MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison"}}, "vtkImageMirrorPad": {"Cxx": {"Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad"}, "VTKLink": {"vtkImageMirrorPad": "https://www.vtk.org/doc/nightly/html/classvtkImageMirrorPad.html#details"}, "Python": {"Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad"}}, "vtkImageNoiseSource": {"Cxx": {"MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource"}, "VTKLink": {"vtkImageNoiseSource": "https://www.vtk.org/doc/nightly/html/classvtkImageNoiseSource.html#details"}, "Python": {"MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison"}}, "vtkImageNonMaximumSuppression": {"Cxx": {"ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector"}, "VTKLink": {"vtkImageNonMaximumSuppression": "https://www.vtk.org/doc/nightly/html/classvtkImageNonMaximumSuppression.html#details"}}, "vtkImageNormalize": {"Cxx": {"ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize"}, "VTKLink": {"vtkImageNormalize": "https://www.vtk.org/doc/nightly/html/classvtkImageNormalize.html#details"}, "Java": {"ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize"}, "Python": {"ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize"}}, "vtkImageOpenClose3D": {"Cxx": {"ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D"}, "VTKLink": {"vtkImageOpenClose3D": "https://www.vtk.org/doc/nightly/html/classvtkImageOpenClose3D.html#details"}}, "vtkImagePermute": {"Cxx": {"ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation"}, "VTKLink": {"vtkImagePermute": "https://www.vtk.org/doc/nightly/html/classvtkImagePermute.html#details"}, "Java": {"ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation"}}, "vtkImagePlaneWidget": {"Cxx": {"ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget"}, "VTKLink": {"vtkImagePlaneWidget": "https://www.vtk.org/doc/nightly/html/classvtkImagePlaneWidget.html#details"}, "Java": {"ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget"}}, "vtkImageProperty": {"Cxx": {"MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation"}, "VTKLink": {"vtkImageProperty": "https://www.vtk.org/doc/nightly/html/classvtkImageProperty.html#details"}}, "vtkImageQuantizeRGBToIndex": {"Cxx": {"ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter"}, "VTKLink": {"vtkImageQuantizeRGBToIndex": "https://www.vtk.org/doc/nightly/html/classvtkImageQuantizeRGBToIndex.html#details"}}, "vtkImageRange3D": {"Cxx": {"ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D"}, "VTKLink": {"vtkImageRange3D": "https://www.vtk.org/doc/nightly/html/classvtkImageRange3D.html#details"}}, "vtkImageReader": {"Cxx": {"TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere"}, "VTKLink": {"vtkImageReader": "https://www.vtk.org/doc/nightly/html/classvtkImageReader.html#details"}}, "vtkImageRectilinearWipe": {"Cxx": {"RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget"}, "VTKLink": {"vtkImageRectilinearWipe": "https://www.vtk.org/doc/nightly/html/classvtkImageRectilinearWipe.html#details"}}, "vtkImageResample": {"Cxx": {"FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT"}, "VTKLink": {"vtkImageResample": "https://www.vtk.org/doc/nightly/html/classvtkImageResample.html#details"}}, "vtkImageResize": {"Cxx": {"WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage"}, "VTKLink": {"vtkImageResize": "https://www.vtk.org/doc/nightly/html/classvtkImageResize.html#details"}}, "vtkImageReslice": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate"}, "VTKLink": {"vtkImageReslice": "https://www.vtk.org/doc/nightly/html/classvtkImageReslice.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform"}}, "vtkImageResliceMapper": {"Cxx": {"Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice"}, "VTKLink": {"vtkImageResliceMapper": "https://www.vtk.org/doc/nightly/html/classvtkImageResliceMapper.html#details"}}, "vtkImageRFFT": {"Cxx": {"IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass"}, "VTKLink": {"vtkImageRFFT": "https://www.vtk.org/doc/nightly/html/classvtkImageRFFT.html#details"}, "Python": {"IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass"}}, "vtkImageRGBToHSI": {"Cxx": {"RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI"}, "VTKLink": {"vtkImageRGBToHSI": "https://www.vtk.org/doc/nightly/html/classvtkImageRGBToHSI.html#details"}}, "vtkImageRGBToHSV": {"Cxx": {"Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt"}, "VTKLink": {"vtkImageRGBToHSV": "https://www.vtk.org/doc/nightly/html/classvtkImageRGBToHSV.html#details"}}, "vtkImageRGBToYIQ": {"Cxx": {"RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ"}, "VTKLink": {"vtkImageRGBToYIQ": "https://www.vtk.org/doc/nightly/html/classvtkImageRGBToYIQ.html#details"}}, "vtkImageSeedConnectivity": {"Cxx": {"MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt"}, "VTKLink": {"vtkImageSeedConnectivity": "https://www.vtk.org/doc/nightly/html/classvtkImageSeedConnectivity.html#details"}, "Python": {"MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison"}}, "vtkImageSeparableConvolution": {"Cxx": {"ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution"}, "VTKLink": {"vtkImageSeparableConvolution": "https://www.vtk.org/doc/nightly/html/classvtkImageSeparableConvolution.html#details"}}, "vtkImageShiftScale": {"Cxx": {"RescaleAnImage": "https://examples.vtk.org/site/Cxx/ImageProcessing/RescaleAnImage", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter"}, "VTKLink": {"vtkImageShiftScale": "https://www.vtk.org/doc/nightly/html/classvtkImageShiftScale.html#details"}, "Python": {"Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation"}}, "vtkImageShrink3D": {"Cxx": {"VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt"}, "VTKLink": {"vtkImageShrink3D": "https://www.vtk.org/doc/nightly/html/classvtkImageShrink3D.html#details"}, "Python": {"IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface"}}, "vtkImageSincInterpolator": {"Cxx": {"ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage"}, "VTKLink": {"vtkImageSincInterpolator": "https://www.vtk.org/doc/nightly/html/classvtkImageSincInterpolator.html#details"}}, "vtkImageSinusoidSource": {"Cxx": {"ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression"}, "VTKLink": {"vtkImageSinusoidSource": "https://www.vtk.org/doc/nightly/html/classvtkImageSinusoidSource.html#details"}, "Java": {"ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageSinusoidSource": "https://examples.vtk.org/site/Java/Images/ImageSinusoidSource"}, "Python": {"ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum"}}, "vtkImageSlice": {"Cxx": {"ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField"}, "VTKLink": {"vtkImageSlice": "https://www.vtk.org/doc/nightly/html/classvtkImageSlice.html#details"}}, "vtkImageSliceMapper": {"Cxx": {"ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField"}, "VTKLink": {"vtkImageSliceMapper": "https://www.vtk.org/doc/nightly/html/classvtkImageSliceMapper.html#details"}}, "vtkImageSobel2D": {"Cxx": {"ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D"}, "VTKLink": {"vtkImageSobel2D": "https://www.vtk.org/doc/nightly/html/classvtkImageSobel2D.html#details"}}, "vtkImageStack": {"Cxx": {"ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack"}, "VTKLink": {"vtkImageStack": "https://www.vtk.org/doc/nightly/html/classvtkImageStack.html#details"}}, "vtkImageStencil": {"Cxx": {"PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil"}, "VTKLink": {"vtkImageStencil": "https://www.vtk.org/doc/nightly/html/classvtkImageStencil.html#details"}, "Python": {"PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData"}}, "vtkImageStencilToImage": {"Cxx": {"ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour"}, "VTKLink": {"vtkImageStencilToImage": "https://www.vtk.org/doc/nightly/html/classvtkImageStencilToImage.html#details"}}, "vtkImageThreshold": {"Cxx": {"MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter"}, "VTKLink": {"vtkImageThreshold": "https://www.vtk.org/doc/nightly/html/classvtkImageThreshold.html#details"}, "Python": {"MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes"}}, "vtkImageToImageStencil": {"Cxx": {"ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil"}, "VTKLink": {"vtkImageToImageStencil": "https://www.vtk.org/doc/nightly/html/classvtkImageToImageStencil.html#details"}}, "vtkImageToPolyDataFilter": {"Cxx": {"ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter"}, "VTKLink": {"vtkImageToPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkImageToPolyDataFilter.html#details"}}, "vtkImageToStructuredPoints": {"Cxx": {"ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector"}, "VTKLink": {"vtkImageToStructuredPoints": "https://www.vtk.org/doc/nightly/html/classvtkImageToStructuredPoints.html#details"}}, "vtkImageTracerWidget": {"Cxx": {"ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar"}, "VTKLink": {"vtkImageTracerWidget": "https://www.vtk.org/doc/nightly/html/classvtkImageTracerWidget.html#details"}, "Java": {"ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar"}}, "vtkImageTranslateExtent": {"Cxx": {"ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent"}, "VTKLink": {"vtkImageTranslateExtent": "https://www.vtk.org/doc/nightly/html/classvtkImageTranslateExtent.html#details"}}, "vtkImageVariance3D": {"Cxx": {"ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D"}, "VTKLink": {"vtkImageVariance3D": "https://www.vtk.org/doc/nightly/html/classvtkImageVariance3D.html#details"}}, "vtkImageViewer": {"Cxx": {"ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader"}, "VTKLink": {"vtkImageViewer": "https://www.vtk.org/doc/nightly/html/classvtkImageViewer.html#details"}, "Python": {"PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "HDRReader": "https://examples.vtk.org/site/Python/IO/HDRReader"}}, "vtkImageWeightedSum": {"Cxx": {"ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum"}, "VTKLink": {"vtkImageWeightedSum": "https://www.vtk.org/doc/nightly/html/classvtkImageWeightedSum.html#details"}, "Java": {"ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum"}, "Python": {"ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "SumVTKImages": "https://examples.vtk.org/site/Python/ImageData/SumVTKImages"}}, "vtkImageWrapPad": {"Cxx": {"GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels"}, "VTKLink": {"vtkImageWrapPad": "https://www.vtk.org/doc/nightly/html/classvtkImageWrapPad.html#details"}, "Python": {"GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels"}}, "vtkImageWriter": {"Cxx": {"ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkImageWriter": "https://www.vtk.org/doc/nightly/html/classvtkImageWriter.html#details"}}, "vtkImplicitDataSet": {"Cxx": {"ImplicitDataSet": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitDataSet"}, "VTKLink": {"vtkImplicitDataSet": "https://www.vtk.org/doc/nightly/html/classvtkImplicitDataSet.html#details"}, "Java": {"ImplicitDataSet": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitDataSet"}}, "vtkImplicitFunction": {"Cxx": {"ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkImplicitFunction": "https://www.vtk.org/doc/nightly/html/classvtkImplicitFunction.html#details"}}, "vtkImplicitModeller": {"Cxx": {"ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2"}, "VTKLink": {"vtkImplicitModeller": "https://www.vtk.org/doc/nightly/html/classvtkImplicitModeller.html#details"}, "Java": {"BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo"}, "Python": {"Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2"}}, "vtkImplicitPlaneRepresentation": {"Cxx": {"ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2"}, "VTKLink": {"vtkImplicitPlaneRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkImplicitPlaneRepresentation.html#details"}, "Python": {"ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2"}}, "vtkImplicitPlaneWidget2": {"Cxx": {"ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2"}, "VTKLink": {"vtkImplicitPlaneWidget2": "https://www.vtk.org/doc/nightly/html/classvtkImplicitPlaneWidget2.html#details"}, "Python": {"ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2"}}, "vtkImplicitPolyDataDistance": {"Cxx": {"ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "VTKLink": {"vtkImplicitPolyDataDistance": "https://www.vtk.org/doc/nightly/html/classvtkImplicitPolyDataDistance.html#details"}, "Python": {"ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkImplicitSelectionLoop": {"Cxx": {"ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop"}, "VTKLink": {"vtkImplicitSelectionLoop": "https://www.vtk.org/doc/nightly/html/classvtkImplicitSelectionLoop.html#details"}}, "vtkImplicitTextureCoords": {"Cxx": {"Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric"}, "VTKLink": {"vtkImplicitTextureCoords": "https://www.vtk.org/doc/nightly/html/classvtkImplicitTextureCoords.html#details"}, "Python": {"Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric"}}, "vtkIncrementalOctreePointLocator": {"Cxx": {"IncrementalOctreePointLocator": "https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator"}, "VTKLink": {"vtkIncrementalOctreePointLocator": "https://www.vtk.org/doc/nightly/html/classvtkIncrementalOctreePointLocator.html#details"}}, "vtkIndent": {"Cxx": {"vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTest": "https://examples.vtk.org/site/Cxx/Developers/vtkTest", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTest1": "https://examples.vtk.org/site/Cxx/Developers/vtkTest1"}, "VTKLink": {"vtkIndent": "https://www.vtk.org/doc/nightly/html/classvtkIndent.html#details"}}, "vtkInEdgeIterator": {"Cxx": {"InEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/InEdgeIterator"}, "VTKLink": {"vtkInEdgeIterator": "https://www.vtk.org/doc/nightly/html/classvtkInEdgeIterator.html#details"}}, "vtkInformation": {"Cxx": {"ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "AttachAttributes": "https://examples.vtk.org/site/Cxx/PolyData/AttachAttributes", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles"}, "VTKLink": {"vtkInformation": "https://www.vtk.org/doc/nightly/html/classvtkInformation.html#details"}}, "vtkInformationDoubleVectorKey": {"Cxx": {"AttachAttributes": "https://examples.vtk.org/site/Cxx/PolyData/AttachAttributes"}, "VTKLink": {"vtkInformationDoubleVectorKey": "https://www.vtk.org/doc/nightly/html/classvtkInformationDoubleVectorKey.html#details"}}, "vtkInformationVector": {"Cxx": {"vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData"}, "VTKLink": {"vtkInformationVector": "https://www.vtk.org/doc/nightly/html/classvtkInformationVector.html#details"}}, "vtkInteractorObserver": {"Cxx": {"FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors"}, "VTKLink": {"vtkInteractorObserver": "https://www.vtk.org/doc/nightly/html/classvtkInteractorObserver.html#details"}, "Java": {"ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest"}}, "vtkInteractorStyle": {"Cxx": {"PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower"}, "VTKLink": {"vtkInteractorStyle": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyle.html#details"}, "Java": {"Follower": "https://examples.vtk.org/site/Java/Visualization/Follower"}}, "vtkInteractorStyleRubberBand2D": {"Cxx": {"SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D"}, "VTKLink": {"vtkInteractorStyleRubberBand2D": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleRubberBand2D.html#details"}}, "vtkInteractorStyleRubberBand3D": {"Cxx": {"RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D"}, "VTKLink": {"vtkInteractorStyleRubberBand3D": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleRubberBand3D.html#details"}}, "vtkInteractorStyleRubberBandPick": {"Cxx": {"HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick"}, "VTKLink": {"vtkInteractorStyleRubberBandPick": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleRubberBandPick.html#details"}, "Java": {"RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick"}, "Python": {"CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid"}}, "vtkInteractorStyleRubberBandZoom": {"Cxx": {"RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom"}, "VTKLink": {"vtkInteractorStyleRubberBandZoom": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleRubberBandZoom.html#details"}, "Java": {"RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom"}}, "vtkInteractorStyleSwitch": {"Cxx": {"ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "VTKLink": {"vtkInteractorStyleSwitch": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleSwitch.html#details"}, "Java": {"ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch"}}, "vtkInteractorStyleTerrain": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain"}, "VTKLink": {"vtkInteractorStyleTerrain": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleTerrain.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain"}}, "vtkInteractorStyleTrackball": {"Cxx": {"AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking"}, "VTKLink": {"vtkInteractorStyleTrackball": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleTrackball.html#details"}, "Java": {"ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar"}}, "vtkInteractorStyleTrackballActor": {"Cxx": {"MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game"}, "VTKLink": {"vtkInteractorStyleTrackballActor": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleTrackballActor.html#details"}, "Java": {"MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor"}, "Python": {"InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor"}}, "vtkInteractorStyleTrackballCamera": {"Cxx": {"InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors"}, "VTKLink": {"vtkInteractorStyleTrackballCamera": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleTrackballCamera.html#details"}, "Java": {"SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent", "JFrameRenderer": "https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors"}}, "vtkInteractorStyleUser": {"Cxx": {"IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser"}, "VTKLink": {"vtkInteractorStyleUser": "https://www.vtk.org/doc/nightly/html/classvtkInteractorStyleUser.html#details"}}, "vtkInterpolateDataSetAttributes": {"Cxx": {"Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "VTKLink": {"vtkInterpolateDataSetAttributes": "https://www.vtk.org/doc/nightly/html/classvtkInterpolateDataSetAttributes.html#details"}}, "vtkIntersectionPolyDataFilter": {"Cxx": {"IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter"}, "VTKLink": {"vtkIntersectionPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkIntersectionPolyDataFilter.html#details"}}, "vtkIterativeClosestPointTransform": {"Cxx": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform"}, "VTKLink": {"vtkIterativeClosestPointTransform": "https://www.vtk.org/doc/nightly/html/classvtkIterativeClosestPointTransform.html#details"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "IterativeClosestPoints": "https://examples.vtk.org/site/Python/Filtering/IterativeClosestPoints"}}, "vtkKdTree": {"Cxx": {"VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints", "BuildLocatorFromKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/BuildLocatorFromKClosestPoints", "KdTree": "https://examples.vtk.org/site/Cxx/DataStructures/KdTree"}, "VTKLink": {"vtkKdTree": "https://www.vtk.org/doc/nightly/html/classvtkKdTree.html#details"}}, "vtkKdTreePointLocator": {"Cxx": {"KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "KDTreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadius", "KdTreePointLocatorClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/KdTreePointLocatorClosestPoint", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "ClosestNPoints": "https://examples.vtk.org/site/Cxx/DataStructures/ClosestNPoints"}, "VTKLink": {"vtkKdTreePointLocator": "https://www.vtk.org/doc/nightly/html/classvtkKdTreePointLocator.html#details"}, "Java": {"VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree"}}, "vtkKMeansStatistics": {"Cxx": {"KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering"}, "VTKLink": {"vtkKMeansStatistics": "https://www.vtk.org/doc/nightly/html/classvtkKMeansStatistics.html#details"}}, "vtkKochanekSpline": {"Cxx": {"KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "1DTupleInterpolation": "https://examples.vtk.org/site/Cxx/Math/1DTupleInterpolation"}, "VTKLink": {"vtkKochanekSpline": "https://www.vtk.org/doc/nightly/html/classvtkKochanekSpline.html#details"}, "Java": {"KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline"}}, "vtkLabeledDataMapper": {"Cxx": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "VTKLink": {"vtkLabeledDataMapper": "https://www.vtk.org/doc/nightly/html/classvtkLabeledDataMapper.html#details"}, "Python": {"ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkLabelPlacementMapper": {"Cxx": {"LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper"}, "VTKLink": {"vtkLabelPlacementMapper": "https://www.vtk.org/doc/nightly/html/classvtkLabelPlacementMapper.html#details"}}, "vtkLegendBoxActor": {"Cxx": {"ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "VTKLink": {"vtkLegendBoxActor": "https://www.vtk.org/doc/nightly/html/classvtkLegendBoxActor.html#details"}, "Java": {"Legend": "https://examples.vtk.org/site/Java/Visualization/Legend"}}, "vtkLegendScaleActor": {"Cxx": {"LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor"}, "VTKLink": {"vtkLegendScaleActor": "https://www.vtk.org/doc/nightly/html/classvtkLegendScaleActor.html#details"}, "Java": {"LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor"}}, "vtkLight": {"Cxx": {"GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light"}, "VTKLink": {"vtkLight": "https://www.vtk.org/doc/nightly/html/classvtkLight.html#details"}, "Java": {"AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "LightActor": "https://examples.vtk.org/site/Java/Lighting/LightActor", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows"}}, "vtkLightActor": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light"}, "VTKLink": {"vtkLightActor": "https://www.vtk.org/doc/nightly/html/classvtkLightActor.html#details"}, "Java": {"LightActor": "https://examples.vtk.org/site/Java/Lighting/LightActor"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo"}}, "vtkLightCollection": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light"}, "VTKLink": {"vtkLightCollection": "https://www.vtk.org/doc/nightly/html/classvtkLightCollection.html#details"}}, "vtkLightsPass": {"Cxx": {"PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkLightsPass": "https://www.vtk.org/doc/nightly/html/classvtkLightsPass.html#details"}, "Python": {"PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkLinearExtrusionFilter": {"Cxx": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo"}, "VTKLink": {"vtkLinearExtrusionFilter": "https://www.vtk.org/doc/nightly/html/classvtkLinearExtrusionFilter.html#details"}, "Java": {"EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder"}, "Python": {"PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo"}}, "vtkLinearTransform": {"Cxx": {"ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene"}, "VTKLink": {"vtkLinearTransform": "https://www.vtk.org/doc/nightly/html/classvtkLinearTransform.html#details"}}, "vtkLineRepresentation": {"Cxx": {"LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2"}, "VTKLink": {"vtkLineRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkLineRepresentation.html#details"}}, "vtkLineWidget": {"Cxx": {"StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget"}, "VTKLink": {"vtkLineWidget": "https://www.vtk.org/doc/nightly/html/classvtkLineWidget.html#details"}, "Python": {"StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget"}}, "vtkLineWidget2": {"Cxx": {"LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2"}, "VTKLink": {"vtkLineWidget2": "https://www.vtk.org/doc/nightly/html/classvtkLineWidget2.html#details"}}, "vtkLinkEdgels": {"Cxx": {"CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector"}, "VTKLink": {"vtkLinkEdgels": "https://www.vtk.org/doc/nightly/html/classvtkLinkEdgels.html#details"}}, "vtkLocator": {"Cxx": {"DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison"}, "VTKLink": {"vtkLocator": "https://www.vtk.org/doc/nightly/html/classvtkLocator.html#details"}}, "vtkLODProp3D": {"Cxx": {"LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D"}, "VTKLink": {"vtkLODProp3D": "https://www.vtk.org/doc/nightly/html/classvtkLODProp3D.html#details"}}, "vtkLogger": {"Cxx": {"AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors"}, "VTKLink": {"vtkLogger": "https://www.vtk.org/doc/nightly/html/classvtkLogger.html#details"}}, "vtkLogLookupTable": {"Cxx": {"HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline"}, "VTKLink": {"vtkLogLookupTable": "https://www.vtk.org/doc/nightly/html/classvtkLogLookupTable.html#details"}, "Python": {"HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline"}}, "vtkLogoRepresentation": {"Cxx": {"LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget"}, "VTKLink": {"vtkLogoRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkLogoRepresentation.html#details"}, "Java": {"LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget"}}, "vtkLogoWidget": {"Cxx": {"LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget"}, "VTKLink": {"vtkLogoWidget": "https://www.vtk.org/doc/nightly/html/classvtkLogoWidget.html#details"}, "Java": {"LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget"}}, "vtkLoopBooleanPolyDataFilter": {"Cxx": {"LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter"}, "VTKLink": {"vtkLoopBooleanPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkLoopBooleanPolyDataFilter.html#details"}}, "vtkMapper": {"Cxx": {"ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "VTKLink": {"vtkMapper": "https://www.vtk.org/doc/nightly/html/classvtkMapper.html#details"}}, "vtkMarchingContourFilter": {"Cxx": {"FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkMarchingContourFilter": "https://www.vtk.org/doc/nightly/html/classvtkMarchingContourFilter.html#details"}, "Python": {"FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkMaskFields": {"Cxx": {"GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels"}, "VTKLink": {"vtkMaskFields": "https://www.vtk.org/doc/nightly/html/classvtkMaskFields.html#details"}, "Python": {"GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels"}}, "vtkMaskPoints": {"Cxx": {"MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo"}, "VTKLink": {"vtkMaskPoints": "https://www.vtk.org/doc/nightly/html/classvtkMaskPoints.html#details"}, "Java": {"SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran"}, "Python": {"SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkMaskPointsFilter": {"Cxx": {"MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter"}, "VTKLink": {"vtkMaskPointsFilter": "https://www.vtk.org/doc/nightly/html/classvtkMaskPointsFilter.html#details"}}, "vtkMaskPolyData": {"Cxx": {"StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran"}, "VTKLink": {"vtkMaskPolyData": "https://www.vtk.org/doc/nightly/html/classvtkMaskPolyData.html#details"}, "Python": {"StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran"}}, "vtkMassProperties": {"Cxx": {"MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties"}, "VTKLink": {"vtkMassProperties": "https://www.vtk.org/doc/nightly/html/classvtkMassProperties.html#details"}}, "vtkMatrix3x3": {"Cxx": {"MatrixTranspose": "https://examples.vtk.org/site/Cxx/Math/MatrixTranspose", "MatrixInverse": "https://examples.vtk.org/site/Cxx/Math/MatrixInverse"}, "VTKLink": {"vtkMatrix3x3": "https://www.vtk.org/doc/nightly/html/classvtkMatrix3x3.html#details"}, "Java": {"MatrixTranspose": "https://examples.vtk.org/site/Java/Math/MatrixTranspose", "MatrixInverse": "https://examples.vtk.org/site/Java/Math/MatrixInverse"}}, "vtkMCubesReader": {"Cxx": {"PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation"}, "VTKLink": {"vtkMCubesReader": "https://www.vtk.org/doc/nightly/html/classvtkMCubesReader.html#details"}, "Python": {"PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation"}}, "vtkMergeFilter": {"Cxx": {"ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp"}, "VTKLink": {"vtkMergeFilter": "https://www.vtk.org/doc/nightly/html/classvtkMergeFilter.html#details"}, "Python": {"ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp"}}, "vtkModifiedBSPTree": {"Cxx": {"ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "ModifiedBSPTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine"}, "VTKLink": {"vtkModifiedBSPTree": "https://www.vtk.org/doc/nightly/html/classvtkModifiedBSPTree.html#details"}}, "vtkMoleculeMapper": {"Cxx": {"ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML"}, "VTKLink": {"vtkMoleculeMapper": "https://www.vtk.org/doc/nightly/html/classvtkMoleculeMapper.html#details"}, "Java": {"ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML"}}, "vtkMultiBlockDataGroupFilter": {"Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter"}, "VTKLink": {"vtkMultiBlockDataGroupFilter": "https://www.vtk.org/doc/nightly/html/classvtkMultiBlockDataGroupFilter.html#details"}}, "vtkMultiThreshold": {"Cxx": {"CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary"}, "VTKLink": {"vtkMultiThreshold": "https://www.vtk.org/doc/nightly/html/classvtkMultiThreshold.html#details"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject"}}, "vtkMutableDirectedGraph": {"Cxx": {"MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "GraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmFilter", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "TreeBFSIterator": "https://examples.vtk.org/site/Cxx/Graphs/TreeBFSIterator", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "MutableDirectedGraphToDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/MutableDirectedGraphToDirectedGraph", "DirectedGraphToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/DirectedGraphToMutableDirectedGraph", "OutEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/OutEdgeIterator", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "InEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/InEdgeIterator", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "TreeToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/TreeToMutableDirectedGraph"}, "VTKLink": {"vtkMutableDirectedGraph": "https://www.vtk.org/doc/nightly/html/classvtkMutableDirectedGraph.html#details"}, "Java": {"GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates"}, "Python": {"ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "VisualizeGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeGraph", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph", "CreateTree": "https://examples.vtk.org/site/Python/Graphs/CreateTree", "ConstructTree": "https://examples.vtk.org/site/Python/Graphs/ConstructTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "ColorVertexLabels": "https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels", "EdgeWeights": "https://examples.vtk.org/site/Python/Graphs/EdgeWeights"}}, "vtkMutableGraphHelper": {"Cxx": {"MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter"}, "VTKLink": {"vtkMutableGraphHelper": "https://www.vtk.org/doc/nightly/html/classvtkMutableGraphHelper.html#details"}}, "vtkMutableUndirectedGraph": {"Cxx": {"GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "GraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmFilter", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "GraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmSource", "OutEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/OutEdgeIterator", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "RemoveIsolatedVertices": "https://examples.vtk.org/site/Cxx/Graphs/RemoveIsolatedVertices", "EdgeListIterator": "https://examples.vtk.org/site/Cxx/Graphs/EdgeListIterator", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "InEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/InEdgeIterator", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator"}, "VTKLink": {"vtkMutableUndirectedGraph": "https://www.vtk.org/doc/nightly/html/classvtkMutableUndirectedGraph.html#details"}, "Java": {"GraphPoints": "https://examples.vtk.org/site/Java/InfoVis/GraphPoints", "VisualizeGraph": "https://examples.vtk.org/site/Java/Graphs/VisualizeGraph"}, "Python": {"ConstructGraph": "https://examples.vtk.org/site/Python/Graphs/ConstructGraph", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges"}}, "vtkNamedColors": {"Cxx": {"WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "XMLPImageDataWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPImageDataWriter", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "PNGWriter": "https://examples.vtk.org/site/Cxx/IO/PNGWriter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "JPEGWriter": "https://examples.vtk.org/site/Cxx/IO/JPEGWriter", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "NamedColorPatches": "https://examples.vtk.org/site/Cxx/Visualization/NamedColorPatches", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "ColorSeriesPatches": "https://examples.vtk.org/site/Cxx/Visualization/ColorSeriesPatches", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter"}, "VTKLink": {"vtkNamedColors": "https://www.vtk.org/doc/nightly/html/classvtkNamedColors.html#details"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "OggTheora": "https://examples.vtk.org/site/Java/Video/OggTheora", "SwingHandleMouseEvent": "https://examples.vtk.org/site/Java/SwingIntegration/SwingHandleMouseEvent", "JFrameRenderer": "https://examples.vtk.org/site/Java/SwingIntegration/JFrameRenderer", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "RenderView": "https://examples.vtk.org/site/Java/Views/RenderView", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "PlaneWidget": "https://examples.vtk.org/site/Java/Widgets/PlaneWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "DistanceWidget": "https://examples.vtk.org/site/Java/Widgets/DistanceWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "SplineWidget": "https://examples.vtk.org/site/Java/Widgets/SplineWidget", "AngleWidget": "https://examples.vtk.org/site/Java/Widgets/AngleWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "JPEGWriter": "https://examples.vtk.org/site/Java/IO/JPEGWriter", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "OrientedArrow": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "TextActor": "https://examples.vtk.org/site/Java/GeometricObjects/TextActor", "RegularPolygonSource": "https://examples.vtk.org/site/Java/GeometricObjects/RegularPolygonSource", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "OrientedCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/OrientedCylinder", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"ColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/ColoredTriangle", "SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "TriangleColoredPoints": "https://examples.vtk.org/site/Python/PolyData/TriangleColoredPoints", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "SolidColoredTriangle": "https://examples.vtk.org/site/Python/PolyData/SolidColoredTriangle", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "Tutorial_Step3": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "SphereWidget": "https://examples.vtk.org/site/Python/Widgets/SphereWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "ConstructGraph": "https://examples.vtk.org/site/Python/Graphs/ConstructGraph", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/LabelVerticesAndEdges", "RandomGraphSource": "https://examples.vtk.org/site/Python/Graphs/RandomGraphSource", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "ColorVertexLabels": "https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels", "EdgeWeights": "https://examples.vtk.org/site/Python/Graphs/EdgeWeights", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ReadDICOM": "https://examples.vtk.org/site/Python/IO/ReadDICOM", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot", "ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "ColorSeriesPatches": "https://examples.vtk.org/site/Python/Visualization/ColorSeriesPatches", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "AnnotatedCubeActor": "https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "NamedColorPatches": "https://examples.vtk.org/site/Python/Visualization/NamedColorPatches", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "TextActor": "https://examples.vtk.org/site/Python/GeometricObjects/TextActor", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkNew": {"Cxx": {"WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "CleanPolyData": "https://examples.vtk.org/site/Cxx/PolyData/CleanPolyData", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "AlignFrames": "https://examples.vtk.org/site/Cxx/PolyData/AlignFrames", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "DeletePoint": "https://examples.vtk.org/site/Cxx/PolyData/DeletePoint", "MergePoints": "https://examples.vtk.org/site/Cxx/PolyData/MergePoints", "AttachAttributes": "https://examples.vtk.org/site/Cxx/PolyData/AttachAttributes", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "CellTreeLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellTreeLocator", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "CellLocator": "https://examples.vtk.org/site/Cxx/PolyData/CellLocator", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "Stripper": "https://examples.vtk.org/site/Cxx/PolyData/Stripper", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "IterateOverLines": "https://examples.vtk.org/site/Cxx/PolyData/IterateOverLines", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "TriangleArea": "https://examples.vtk.org/site/Cxx/PolyData/TriangleArea", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "PolyDataToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToUnstructuredGrid", "DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "PointLocatorRadius": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorRadius", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "ReverseSense": "https://examples.vtk.org/site/Cxx/PolyData/ReverseSense", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "DataBounds": "https://examples.vtk.org/site/Cxx/PolyData/DataBounds", "GetMiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscCellData", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "ThresholdCells": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdCells", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "DetermineArrayDataTypes": "https://examples.vtk.org/site/Cxx/PolyData/DetermineArrayDataTypes", "MiscCellData": "https://examples.vtk.org/site/Cxx/PolyData/MiscCellData", "GetMiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "CenterOfMass": "https://examples.vtk.org/site/Cxx/PolyData/CenterOfMass", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "RemoveVertices": "https://examples.vtk.org/site/Cxx/PolyData/RemoveVertices", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "MultiBlockMergeFilter": "https://examples.vtk.org/site/Cxx/PolyData/MultiBlockMergeFilter", "PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "PolyDataGetPoint": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataGetPoint", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageDataToPointSet": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataToPointSet", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ImageIterator": "https://examples.vtk.org/site/Cxx/ImageData/ImageIterator", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "IterateImageData": "https://examples.vtk.org/site/Cxx/ImageData/IterateImageData", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "CellIdFromGridCoordinates": "https://examples.vtk.org/site/Cxx/ImageData/CellIdFromGridCoordinates", "GetCellCenter": "https://examples.vtk.org/site/Cxx/ImageData/GetCellCenter", "MPEG2": "https://examples.vtk.org/site/Cxx/Video/MPEG2", "OggTheora": "https://examples.vtk.org/site/Cxx/Video/OggTheora", "FFMPEG": "https://examples.vtk.org/site/Cxx/Video/FFMPEG", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "RescaleAnImage": "https://examples.vtk.org/site/Cxx/ImageProcessing/RescaleAnImage", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "ArrayToTable": "https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView", "DelimitedTextWriter": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "PassThrough": "https://examples.vtk.org/site/Cxx/InfoVis/PassThrough", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ImplicitDataSet": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitDataSet", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "MultipleInputPorts": "https://examples.vtk.org/site/Cxx/Developers/MultipleInputPorts", "FilterSelfProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterSelfProgress", "vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "ProgressReport": "https://examples.vtk.org/site/Cxx/Developers/ProgressReport", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "GraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmFilter", "GraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/GraphAlgorithmSource", "ImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/ImageAlgorithmFilter", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "AlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/AlgorithmFilter", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageAccumulate": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulate", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageExport": "https://examples.vtk.org/site/Cxx/Images/ImageExport", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "NegativeIndices": "https://examples.vtk.org/site/Cxx/Images/NegativeIndices", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "ImageValueRange": "https://examples.vtk.org/site/Cxx/Images/ImageValueRange", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "UniformRandomNumber": "https://examples.vtk.org/site/Cxx/SimpleOperations/UniformRandomNumber", "RandomSequence": "https://examples.vtk.org/site/Cxx/SimpleOperations/RandomSequence", "PerspectiveTransform": "https://examples.vtk.org/site/Cxx/SimpleOperations/PerspectiveTransform", "ProjectPointPlane": "https://examples.vtk.org/site/Cxx/SimpleOperations/ProjectPointPlane", "GaussianRandomNumber": "https://examples.vtk.org/site/Cxx/SimpleOperations/GaussianRandomNumber", "DistancePointToLine": "https://examples.vtk.org/site/Cxx/SimpleOperations/DistancePointToLine", "Tutorial_Step3": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step3", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "Tutorial_Step4": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step4", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step1": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step1", "Tutorial_Step2": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step2", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "GetLinearPointId": "https://examples.vtk.org/site/Cxx/StructuredGrid/GetLinearPointId", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "TreeBFSIterator": "https://examples.vtk.org/site/Cxx/Graphs/TreeBFSIterator", "OutEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/OutEdgeIterator", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "RemoveIsolatedVertices": "https://examples.vtk.org/site/Cxx/Graphs/RemoveIsolatedVertices", "EdgeListIterator": "https://examples.vtk.org/site/Cxx/Graphs/EdgeListIterator", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "MutableDirectedGraphToDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/MutableDirectedGraphToDirectedGraph", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "ConnectedComponents": "https://examples.vtk.org/site/Cxx/Graphs/ConnectedComponents", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "InEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/InEdgeIterator", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "TreeToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/TreeToMutableDirectedGraph", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "NOVCAGraph": "https://examples.vtk.org/site/Cxx/Graphs/NOVCAGraph", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "DirectedGraphToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/DirectedGraphToMutableDirectedGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "FilenameFunctions": "https://examples.vtk.org/site/Cxx/Utilities/FilenameFunctions", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "ShallowCopy": "https://examples.vtk.org/site/Cxx/Utilities/ShallowCopy", "CustomDenseArray": "https://examples.vtk.org/site/Cxx/Utilities/CustomDenseArray", "DeepCopy": "https://examples.vtk.org/site/Cxx/Utilities/DeepCopy", "ArrayRange": "https://examples.vtk.org/site/Cxx/Utilities/ArrayRange", "VectorArrayUnknownLength": "https://examples.vtk.org/site/Cxx/Utilities/VectorArrayUnknownLength", "KnownLengthArray": "https://examples.vtk.org/site/Cxx/Utilities/KnownLengthArray", "LUTUtilities": "https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities", "2DArray": "https://examples.vtk.org/site/Cxx/Utilities/2DArray", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "PiecewiseFunction": "https://examples.vtk.org/site/Cxx/Utilities/PiecewiseFunction", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "CardinalSpline": "https://examples.vtk.org/site/Cxx/Utilities/CardinalSpline", "DiscretizableColorTransferFunction": "https://examples.vtk.org/site/Cxx/Utilities/DiscretizableColorTransferFunction", "GetClassName": "https://examples.vtk.org/site/Cxx/Utilities/GetClassName", "Coordinate": "https://examples.vtk.org/site/Cxx/Utilities/Coordinate", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ConstructTable": "https://examples.vtk.org/site/Cxx/Utilities/ConstructTable", "FileOutputWindow": "https://examples.vtk.org/site/Cxx/Utilities/FileOutputWindow", "GetDataRoot": "https://examples.vtk.org/site/Cxx/Utilities/GetDataRoot", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ColorTransferFunction": "https://examples.vtk.org/site/Cxx/Utilities/ColorTransferFunction", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "SortDataArray": "https://examples.vtk.org/site/Cxx/Utilities/SortDataArray", "TimerLog": "https://examples.vtk.org/site/Cxx/Utilities/TimerLog", "ObserveError": "https://examples.vtk.org/site/Cxx/Utilities/ObserveError", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "ReportRenderWindowCapabilities": "https://examples.vtk.org/site/Cxx/Utilities/ReportRenderWindowCapabilities", "DenseArrayRange": "https://examples.vtk.org/site/Cxx/Utilities/DenseArrayRange", "ArrayLookup": "https://examples.vtk.org/site/Cxx/Utilities/ArrayLookup", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "ColorLookupTable": "https://examples.vtk.org/site/Cxx/Utilities/ColorLookupTable", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "ForLoop": "https://examples.vtk.org/site/Cxx/Utilities/ForLoop", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "CheckVTKVersion": "https://examples.vtk.org/site/Cxx/Utilities/CheckVTKVersion", "SparseArray": "https://examples.vtk.org/site/Cxx/Utilities/SparseArray", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "VectorArrayKnownLength": "https://examples.vtk.org/site/Cxx/Utilities/VectorArrayKnownLength", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "UnknownLengthArray": "https://examples.vtk.org/site/Cxx/Utilities/UnknownLengthArray", "3DArray": "https://examples.vtk.org/site/Cxx/Utilities/3DArray", "FunctionParser": "https://examples.vtk.org/site/Cxx/Utilities/FunctionParser", "ArrayWriter": "https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter", "PointInPolygon": "https://examples.vtk.org/site/Cxx/Utilities/PointInPolygon", "PCAStatistics": "https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ConvertFile": "https://examples.vtk.org/site/Cxx/IO/ConvertFile", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "XMLStructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLStructuredGridWriter", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "WriteVTP": "https://examples.vtk.org/site/Cxx/IO/WriteVTP", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "XMLPImageDataWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPImageDataWriter", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "GenericDataObjectReader": "https://examples.vtk.org/site/Cxx/IO/GenericDataObjectReader", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPUnstructuredGridWriter", "SimplePointsWriter": "https://examples.vtk.org/site/Cxx/IO/SimplePointsWriter", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "PNGWriter": "https://examples.vtk.org/site/Cxx/IO/PNGWriter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "JPEGWriter": "https://examples.vtk.org/site/Cxx/IO/JPEGWriter", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "NamedColorPatches": "https://examples.vtk.org/site/Cxx/Visualization/NamedColorPatches", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "ColorSeriesPatches": "https://examples.vtk.org/site/Cxx/Visualization/ColorSeriesPatches", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "PlanesIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlanesIntersection", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "PolygonIntersection": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolygonIntersection", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "ExodusIIWriter": "https://examples.vtk.org/site/Cxx/Parallel/ExodusIIWriter", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "KDTreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadius", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "KDTreeAccessPoints": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeAccessPoints", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "BuildLocatorFromKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/BuildLocatorFromKClosestPoints", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "KdTreePointLocatorClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/KdTreePointLocatorClosestPoint", "IncrementalOctreePointLocator": "https://examples.vtk.org/site/Cxx/DataStructures/IncrementalOctreePointLocator", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "ModifiedBSPTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeIntersectWithLine", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "OctreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadius", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "KdTree": "https://examples.vtk.org/site/Cxx/DataStructures/KdTree", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "ClosestNPoints": "https://examples.vtk.org/site/Cxx/DataStructures/ClosestNPoints", "OctreeClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeClosestPoint", "OctreeKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeKClosestPoints", "BuildOctree": "https://examples.vtk.org/site/Cxx/DataStructures/BuildOctree", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OBBTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeIntersectWithLine", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "ImageDataToQImage": "https://examples.vtk.org/site/Cxx/Qt/ImageDataToQImage", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "QImageToImageSource": "https://examples.vtk.org/site/Cxx/Qt/QImageToImageSource", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "MatlabEngineFilter": "https://examples.vtk.org/site/Cxx/Matlab/MatlabEngineFilter", "MatrixTranspose": "https://examples.vtk.org/site/Cxx/Math/MatrixTranspose", "1DTupleInterpolation": "https://examples.vtk.org/site/Cxx/Math/1DTupleInterpolation", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "MatrixInverse": "https://examples.vtk.org/site/Cxx/Math/MatrixInverse", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "CellEdges": "https://examples.vtk.org/site/Cxx/Meshes/CellEdges", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "AddCell": "https://examples.vtk.org/site/Cxx/Meshes/AddCell", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter"}, "VTKLink": {"vtkNew": "https://www.vtk.org/doc/nightly/html/classvtkNew.html#details"}, "Python": {"ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON"}}, "vtkOBBTree": {"Cxx": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "OBBTreeIntersectWithLine": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeIntersectWithLine"}, "VTKLink": {"vtkOBBTree": "https://www.vtk.org/doc/nightly/html/classvtkOBBTree.html#details"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas"}}, "vtkObjectBase": {"Cxx": {"TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader"}, "VTKLink": {"vtkObjectBase": "https://www.vtk.org/doc/nightly/html/classvtkObjectBase.html#details"}}, "vtkObjectFactory": {"Cxx": {"vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "Warnings": "https://examples.vtk.org/site/Cxx/Developers/Warnings", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTest": "https://examples.vtk.org/site/Cxx/Developers/vtkTest", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTest1": "https://examples.vtk.org/site/Cxx/Developers/vtkTest1", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows"}, "VTKLink": {"vtkObjectFactory": "https://www.vtk.org/doc/nightly/html/classvtkObjectFactory.html#details"}}, "vtkOBJExporter": {"Cxx": {"ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtkOBJExporter": "https://www.vtk.org/doc/nightly/html/classvtkOBJExporter.html#details"}}, "vtkOBJImporter": {"Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter"}, "VTKLink": {"vtkOBJImporter": "https://www.vtk.org/doc/nightly/html/classvtkOBJImporter.html#details"}}, "vtkOctreePointLocator": {"Cxx": {"OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadius", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OctreeKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeKClosestPoints", "OctreeClosestPoint": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeClosestPoint", "BuildOctree": "https://examples.vtk.org/site/Cxx/DataStructures/BuildOctree"}, "VTKLink": {"vtkOctreePointLocator": "https://www.vtk.org/doc/nightly/html/classvtkOctreePointLocator.html#details"}, "Java": {"BuildOctree": "https://examples.vtk.org/site/Java/DataStructures/BuildOctree"}}, "vtkOggTheoraWriter": {"Cxx": {"OggTheora": "https://examples.vtk.org/site/Cxx/Video/OggTheora"}, "VTKLink": {"vtkOggTheoraWriter": "https://www.vtk.org/doc/nightly/html/classvtkOggTheoraWriter.html#details"}, "Java": {"OggTheora": "https://examples.vtk.org/site/Java/Video/OggTheora"}}, "vtkOpaquePass": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkOpaquePass": "https://www.vtk.org/doc/nightly/html/classvtkOpaquePass.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkOpenGLGPUVolumeRayCastMapper": {"Cxx": {"RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface"}, "VTKLink": {"vtkOpenGLGPUVolumeRayCastMapper": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLGPUVolumeRayCastMapper.html#details"}}, "vtkOpenGLPolyDataMapper": {"Cxx": {"MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal"}, "VTKLink": {"vtkOpenGLPolyDataMapper": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLPolyDataMapper.html#details"}}, "vtkOpenGLRenderer": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows"}, "VTKLink": {"vtkOpenGLRenderer": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLRenderer.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint"}}, "vtkOpenGLRenderWindow": {"Cxx": {"PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox"}, "VTKLink": {"vtkOpenGLRenderWindow": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLRenderWindow.html#details"}}, "vtkOpenGLTexture": {"Cxx": {"PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint"}, "VTKLink": {"vtkOpenGLTexture": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLTexture.html#details"}}, "vtkOpenVRRenderer": {"Cxx": {"OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder"}, "VTKLink": {"vtkOpenVRRenderer": "https://www.vtk.org/doc/nightly/html/classvtkOpenVRRenderer.html#details"}}, "vtkOpenVRRenderWindow": {"Cxx": {"OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder"}, "VTKLink": {"vtkOpenVRRenderWindow": "https://www.vtk.org/doc/nightly/html/classvtkOpenVRRenderWindow.html#details"}}, "vtkOpenVRRenderWindowInteractor": {"Cxx": {"OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "OpenVRCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCube", "OpenVRSphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRSphere", "OpenVRFrustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRFrustum", "OpenVROrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedArrow", "OpenVRCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCylinder", "OpenVRCone": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRCone", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "OpenVROrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVROrientedCylinder"}, "VTKLink": {"vtkOpenVRRenderWindowInteractor": "https://www.vtk.org/doc/nightly/html/classvtkOpenVRRenderWindowInteractor.html#details"}}, "vtkOrientationMarkerWidget": {"Cxx": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkOrientationMarkerWidget": "https://www.vtk.org/doc/nightly/html/classvtkOrientationMarkerWidget.html#details"}, "Java": {"OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes"}, "Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkOutEdgeIterator": {"Cxx": {"OutEdgeIterator": "https://examples.vtk.org/site/Cxx/Graphs/OutEdgeIterator"}, "VTKLink": {"vtkOutEdgeIterator": "https://www.vtk.org/doc/nightly/html/classvtkOutEdgeIterator.html#details"}}, "vtkOutlineGlowPass": {"Cxx": {"OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass"}, "VTKLink": {"vtkOutlineGlowPass": "https://www.vtk.org/doc/nightly/html/classvtkOutlineGlowPass.html#details"}, "Python": {"OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass"}}, "vtkOutputWindow": {"Cxx": {"FileOutputWindow": "https://examples.vtk.org/site/Cxx/Utilities/FileOutputWindow"}, "VTKLink": {"vtkOutputWindow": "https://www.vtk.org/doc/nightly/html/classvtkOutputWindow.html#details"}}, "vtkOverlappingAMR": {"Cxx": {"OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse"}, "VTKLink": {"vtkOverlappingAMR": "https://www.vtk.org/doc/nightly/html/classvtkOverlappingAMR.html#details"}, "Python": {"OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR"}}, "vtkOverlayPass": {"Cxx": {"PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkOverlayPass": "https://www.vtk.org/doc/nightly/html/classvtkOverlayPass.html#details"}, "Python": {"PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkParallelCoordinatesRepresentation": {"Cxx": {"ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView"}, "VTKLink": {"vtkParallelCoordinatesRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkParallelCoordinatesRepresentation.html#details"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView"}}, "vtkParallelCoordinatesView": {"Cxx": {"ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView"}, "VTKLink": {"vtkParallelCoordinatesView": "https://www.vtk.org/doc/nightly/html/classvtkParallelCoordinatesView.html#details"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView"}}, "vtkParametricBohemianDome": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricBohemianDome": "https://www.vtk.org/doc/nightly/html/classvtkParametricBohemianDome.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricBour": {"Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricBour": "https://www.vtk.org/doc/nightly/html/classvtkParametricBour.html#details"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricCatalanMinimal": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricCatalanMinimal": "https://www.vtk.org/doc/nightly/html/classvtkParametricCatalanMinimal.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricHenneberg": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricHenneberg": "https://www.vtk.org/doc/nightly/html/classvtkParametricHenneberg.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricKuen": {"Cxx": {"ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricKuen": "https://www.vtk.org/doc/nightly/html/classvtkParametricKuen.html#details"}, "Python": {"ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricPluckerConoid": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricPluckerConoid": "https://www.vtk.org/doc/nightly/html/classvtkParametricPluckerConoid.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkParametricPseudosphere": {"Cxx": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo"}, "VTKLink": {"vtkParametricPseudosphere": "https://www.vtk.org/doc/nightly/html/classvtkParametricPseudosphere.html#details"}, "Python": {"ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo"}}, "vtkPassThrough": {"Cxx": {"PassThrough": "https://examples.vtk.org/site/Cxx/InfoVis/PassThrough"}, "VTKLink": {"vtkPassThrough": "https://www.vtk.org/doc/nightly/html/classvtkPassThrough.html#details"}, "Java": {"PassThrough": "https://examples.vtk.org/site/Java/InfoVis/PassThrough"}}, "vtkPath": {"Cxx": {"FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView"}, "VTKLink": {"vtkPath": "https://www.vtk.org/doc/nightly/html/classvtkPath.html#details"}}, "vtkPBRIrradianceTexture": {"Cxx": {"PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint"}, "VTKLink": {"vtkPBRIrradianceTexture": "https://www.vtk.org/doc/nightly/html/classvtkPBRIrradianceTexture.html#details"}}, "vtkPCANormalEstimation": {"Cxx": {"ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface"}, "VTKLink": {"vtkPCANormalEstimation": "https://www.vtk.org/doc/nightly/html/classvtkPCANormalEstimation.html#details"}}, "vtkPCAStatistics": {"Cxx": {"PCAStatistics": "https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo"}, "VTKLink": {"vtkPCAStatistics": "https://www.vtk.org/doc/nightly/html/classvtkPCAStatistics.html#details"}}, "vtkPen": {"Cxx": {"PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkPen": "https://www.vtk.org/doc/nightly/html/classvtkPen.html#details"}}, "vtkPentagonalPrism": {"Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "VTKLink": {"vtkPentagonalPrism": "https://www.vtk.org/doc/nightly/html/classvtkPentagonalPrism.html#details"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkPerlinNoise": {"Cxx": {"PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise"}, "VTKLink": {"vtkPerlinNoise": "https://www.vtk.org/doc/nightly/html/classvtkPerlinNoise.html#details"}, "Java": {"PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise"}, "Python": {"PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise"}}, "vtkPiecewiseFunction": {"Cxx": {"PiecewiseFunction": "https://examples.vtk.org/site/Cxx/Utilities/PiecewiseFunction", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "VTKLink": {"vtkPiecewiseFunction": "https://www.vtk.org/doc/nightly/html/classvtkPiecewiseFunction.html#details"}, "Java": {"PiecewiseFunction": "https://examples.vtk.org/site/Java/Utilities/PiecewiseFunction", "SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkPieChartActor": {"Cxx": {"PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor"}, "VTKLink": {"vtkPieChartActor": "https://www.vtk.org/doc/nightly/html/classvtkPieChartActor.html#details"}}, "vtkPixel": {"Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "VTKLink": {"vtkPixel": "https://www.vtk.org/doc/nightly/html/classvtkPixel.html#details"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkPKMeansStatistics": {"Cxx": {"PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering"}, "VTKLink": {"vtkPKMeansStatistics": "https://www.vtk.org/doc/nightly/html/classvtkPKMeansStatistics.html#details"}}, "vtkPlaneCollection": {"Cxx": {"ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface"}, "VTKLink": {"vtkPlaneCollection": "https://www.vtk.org/doc/nightly/html/classvtkPlaneCollection.html#details"}}, "vtkPlaneWidget": {"Cxx": {"PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget"}, "VTKLink": {"vtkPlaneWidget": "https://www.vtk.org/doc/nightly/html/classvtkPlaneWidget.html#details"}, "Java": {"PlaneWidget": "https://examples.vtk.org/site/Java/Widgets/PlaneWidget"}}, "vtkPlot": {"Cxx": {"ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkPlot": "https://www.vtk.org/doc/nightly/html/classvtkPlot.html#details"}}, "vtkPlotArea": {"Cxx": {"AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot"}, "VTKLink": {"vtkPlotArea": "https://www.vtk.org/doc/nightly/html/classvtkPlotArea.html#details"}}, "vtkPlotBar": {"Cxx": {"StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar"}, "VTKLink": {"vtkPlotBar": "https://www.vtk.org/doc/nightly/html/classvtkPlotBar.html#details"}}, "vtkPlotBox": {"Cxx": {"BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart"}, "VTKLink": {"vtkPlotBox": "https://www.vtk.org/doc/nightly/html/classvtkPlotBox.html#details"}}, "vtkPlotFunctionalBag": {"Cxx": {"FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot"}, "VTKLink": {"vtkPlotFunctionalBag": "https://www.vtk.org/doc/nightly/html/classvtkPlotFunctionalBag.html#details"}}, "vtkPlotLine3D": {"Cxx": {"PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D"}, "VTKLink": {"vtkPlotLine3D": "https://www.vtk.org/doc/nightly/html/classvtkPlotLine3D.html#details"}}, "vtkPlotPie": {"Cxx": {"PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart"}, "VTKLink": {"vtkPlotPie": "https://www.vtk.org/doc/nightly/html/classvtkPlotPie.html#details"}}, "vtkPlotPoints": {"Cxx": {"ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots"}, "VTKLink": {"vtkPlotPoints": "https://www.vtk.org/doc/nightly/html/classvtkPlotPoints.html#details"}, "Python": {"ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkPlotStacked": {"Cxx": {"StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot"}, "VTKLink": {"vtkPlotStacked": "https://www.vtk.org/doc/nightly/html/classvtkPlotStacked.html#details"}}, "vtkPlotSurface": {"Cxx": {"SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkPlotSurface": "https://www.vtk.org/doc/nightly/html/classvtkPlotSurface.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkPointData": {"Cxx": {"WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "DetermineArrayDataTypes": "https://examples.vtk.org/site/Cxx/PolyData/DetermineArrayDataTypes", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "GetMiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/GetMiscPointData", "PolyDataPointNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointNormals", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "MiscPointData": "https://examples.vtk.org/site/Cxx/PolyData/MiscPointData", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "PolyDataCellNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataCellNormals", "CopyAllArrays": "https://examples.vtk.org/site/Cxx/PolyData/CopyAllArrays", "PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "ReverseSense": "https://examples.vtk.org/site/Cxx/PolyData/ReverseSense", "FieldData": "https://examples.vtk.org/site/Cxx/PolyData/FieldData", "Casting": "https://examples.vtk.org/site/Cxx/PolyData/Casting", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "ThresholdPoints": "https://examples.vtk.org/site/Cxx/PolyData/ThresholdPoints", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "IterateImageData": "https://examples.vtk.org/site/Cxx/ImageData/IterateImageData", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "ImageValueRange": "https://examples.vtk.org/site/Cxx/Images/ImageValueRange", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ArrayCalculator": "https://examples.vtk.org/site/Cxx/Utilities/ArrayCalculator", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "VectorFieldNonZeroExtraction": "https://examples.vtk.org/site/Cxx/Filtering/VectorFieldNonZeroExtraction", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap"}, "VTKLink": {"vtkPointData": "https://www.vtk.org/doc/nightly/html/classvtkPointData.html#details"}}, "vtkPointGaussianMapper": {"Cxx": {"PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator"}, "VTKLink": {"vtkPointGaussianMapper": "https://www.vtk.org/doc/nightly/html/classvtkPointGaussianMapper.html#details"}, "Python": {"PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkPointHandleRepresentation2D": {"Cxx": {"SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget"}, "VTKLink": {"vtkPointHandleRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkPointHandleRepresentation2D.html#details"}, "Java": {"SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget"}}, "vtkPointInterpolator": {"Cxx": {"PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "VTKLink": {"vtkPointInterpolator": "https://www.vtk.org/doc/nightly/html/classvtkPointInterpolator.html#details"}, "Python": {"PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkPointLoad": {"Cxx": {"TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline"}, "VTKLink": {"vtkPointLoad": "https://www.vtk.org/doc/nightly/html/classvtkPointLoad.html#details"}, "Python": {"TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline"}}, "vtkPointLocator": {"Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "PointLocatorRadius": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorRadius", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo"}, "VTKLink": {"vtkPointLocator": "https://www.vtk.org/doc/nightly/html/classvtkPointLocator.html#details"}}, "vtkPointOccupancyFilter": {"Cxx": {"PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy"}, "VTKLink": {"vtkPointOccupancyFilter": "https://www.vtk.org/doc/nightly/html/classvtkPointOccupancyFilter.html#details"}}, "vtkPointPicker": {"Cxx": {"PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid"}, "VTKLink": {"vtkPointPicker": "https://www.vtk.org/doc/nightly/html/classvtkPointPicker.html#details"}}, "vtkPointSet": {"Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces"}, "VTKLink": {"vtkPointSet": "https://www.vtk.org/doc/nightly/html/classvtkPointSet.html#details"}}, "vtkPointSetToLabelHierarchy": {"Cxx": {"LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper"}, "VTKLink": {"vtkPointSetToLabelHierarchy": "https://www.vtk.org/doc/nightly/html/classvtkPointSetToLabelHierarchy.html#details"}}, "vtkPointSource": {"Cxx": {"MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "PointLocatorRadius": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorRadius", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "MergePoints": "https://examples.vtk.org/site/Cxx/PolyData/MergePoints", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "KDTreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadius", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "OctreeFindPointsWithinRadius": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadius", "ClosestNPoints": "https://examples.vtk.org/site/Cxx/DataStructures/ClosestNPoints", "OctreeKClosestPoints": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeKClosestPoints"}, "VTKLink": {"vtkPointSource": "https://www.vtk.org/doc/nightly/html/classvtkPointSource.html#details"}, "Java": {"ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree"}, "Python": {"ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "NOVCAGraph": "https://examples.vtk.org/site/Python/Graphs/NOVCAGraph", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera"}}, "vtkPointsProjectedHull": {"Cxx": {"PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull"}, "VTKLink": {"vtkPointsProjectedHull": "https://www.vtk.org/doc/nightly/html/classvtkPointsProjectedHull.html#details"}}, "vtkPointWidget": {"Cxx": {"Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor"}, "VTKLink": {"vtkPointWidget": "https://www.vtk.org/doc/nightly/html/classvtkPointWidget.html#details"}}, "vtkPolyDataCollection": {"Cxx": {"PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer"}, "VTKLink": {"vtkPolyDataCollection": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataCollection.html#details"}}, "vtkPolyDataMapper2D": {"Cxx": {"MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "VTKLink": {"vtkPolyDataMapper2D": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataMapper2D.html#details"}, "Java": {"MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D"}, "Python": {"MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkPolyDataNormals": {"Cxx": {"WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "PolyDataExtractNormals": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataExtractNormals", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles"}, "VTKLink": {"vtkPolyDataNormals": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataNormals.html#details"}, "Java": {"SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkPolyDataPointSampler": {"Cxx": {"PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler"}, "VTKLink": {"vtkPolyDataPointSampler": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataPointSampler.html#details"}}, "vtkPolyDataReader": {"Cxx": {"DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "VTKLink": {"vtkPolyDataReader": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataReader.html#details"}, "Java": {"SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo"}, "Python": {"ClosedSurface": "https://examples.vtk.org/site/Python/PolyData/ClosedSurface", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation"}}, "vtkPolyDataSilhouette": {"Cxx": {"Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette"}, "VTKLink": {"vtkPolyDataSilhouette": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataSilhouette.html#details"}, "Python": {"HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette"}}, "vtkPolyDataTangents": {"Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment"}, "VTKLink": {"vtkPolyDataTangents": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataTangents.html#details"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkPolyDataToImageStencil": {"Cxx": {"PolyDataToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataToImageData", "PolyDataContourToImageData": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataContourToImageData", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour"}, "VTKLink": {"vtkPolyDataToImageStencil": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataToImageStencil.html#details"}, "Python": {"PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "PolyDataContourToImageData": "https://examples.vtk.org/site/Python/PolyData/PolyDataContourToImageData"}}, "vtkPolyhedron": {"Cxx": {"Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron"}, "VTKLink": {"vtkPolyhedron": "https://www.vtk.org/doc/nightly/html/classvtkPolyhedron.html#details"}, "Python": {"Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron"}}, "vtkPolyVertex": {"Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "VTKLink": {"vtkPolyVertex": "https://www.vtk.org/doc/nightly/html/classvtkPolyVertex.html#details"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkPostScriptWriter": {"Cxx": {"ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter"}, "VTKLink": {"vtkPostScriptWriter": "https://www.vtk.org/doc/nightly/html/classvtkPostScriptWriter.html#details"}, "Python": {"ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi"}}, "vtkProbeFilter": {"Cxx": {"InterpolateTerrain": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateTerrain", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "VTKLink": {"vtkProbeFilter": "https://www.vtk.org/doc/nightly/html/classvtkProbeFilter.html#details"}, "Java": {"RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe"}, "Python": {"ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens"}}, "vtkProcrustesAlignmentFilter": {"Cxx": {"ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter"}, "VTKLink": {"vtkProcrustesAlignmentFilter": "https://www.vtk.org/doc/nightly/html/classvtkProcrustesAlignmentFilter.html#details"}}, "vtkProgrammableFilter": {"Cxx": {"DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter"}, "VTKLink": {"vtkProgrammableFilter": "https://www.vtk.org/doc/nightly/html/classvtkProgrammableFilter.html#details"}}, "vtkProgrammableGlyphFilter": {"Cxx": {"ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter"}, "VTKLink": {"vtkProgrammableGlyphFilter": "https://www.vtk.org/doc/nightly/html/classvtkProgrammableGlyphFilter.html#details"}, "Python": {"ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter"}}, "vtkProgrammableSource": {"Cxx": {"ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource"}, "VTKLink": {"vtkProgrammableSource": "https://www.vtk.org/doc/nightly/html/classvtkProgrammableSource.html#details"}}, "vtkProjectedTexture": {"Cxx": {"ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture"}, "VTKLink": {"vtkProjectedTexture": "https://www.vtk.org/doc/nightly/html/classvtkProjectedTexture.html#details"}}, "vtkProjectSphereFilter": {"Cxx": {"ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere"}, "VTKLink": {"vtkProjectSphereFilter": "https://www.vtk.org/doc/nightly/html/classvtkProjectSphereFilter.html#details"}, "Java": {"ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere"}}, "vtkProp": {"Cxx": {"ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion"}, "VTKLink": {"vtkProp": "https://www.vtk.org/doc/nightly/html/classvtkProp.html#details"}}, "vtkProp3D": {"Cxx": {"AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface"}, "VTKLink": {"vtkProp3D": "https://www.vtk.org/doc/nightly/html/classvtkProp3D.html#details"}, "Python": {"OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow"}}, "vtkProp3DButtonRepresentation": {"Cxx": {"EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton"}, "VTKLink": {"vtkProp3DButtonRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkProp3DButtonRepresentation.html#details"}}, "vtkProp3DCollection": {"Cxx": {"AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking"}, "VTKLink": {"vtkProp3DCollection": "https://www.vtk.org/doc/nightly/html/classvtkProp3DCollection.html#details"}}, "vtkPropAssembly": {"Cxx": {"AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube"}, "VTKLink": {"vtkPropAssembly": "https://www.vtk.org/doc/nightly/html/classvtkPropAssembly.html#details"}, "Python": {"AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube"}}, "vtkPropCollection": {"Cxx": {"MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly"}, "VTKLink": {"vtkPropCollection": "https://www.vtk.org/doc/nightly/html/classvtkPropCollection.html#details"}, "Java": {"Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly"}}, "vtkProperty2D": {"Cxx": {"KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkProperty2D": "https://www.vtk.org/doc/nightly/html/classvtkProperty2D.html#details"}}, "vtkPropPicker": {"Cxx": {"PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion"}, "VTKLink": {"vtkPropPicker": "https://www.vtk.org/doc/nightly/html/classvtkPropPicker.html#details"}, "Python": {"HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor"}}, "vtkProteinRibbonFilter": {"Cxx": {"ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons"}, "VTKLink": {"vtkProteinRibbonFilter": "https://www.vtk.org/doc/nightly/html/classvtkProteinRibbonFilter.html#details"}, "Java": {"ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons"}}, "vtkQImageToImageSource": {"Cxx": {"QImageToImageSource": "https://examples.vtk.org/site/Cxx/Qt/QImageToImageSource"}, "VTKLink": {"vtkQImageToImageSource": "https://www.vtk.org/doc/nightly/html/classvtkQImageToImageSource.html#details"}}, "vtkQuadraticEdge": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticEdge": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticEdge.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticHexahedron": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron"}, "VTKLink": {"vtkQuadraticHexahedron": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticHexahedron.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron"}}, "vtkQuadraticLinearQuad": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticLinearQuad": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticLinearQuad.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticLinearWedge": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticLinearWedge": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticLinearWedge.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticPolygon": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticPolygon": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticPolygon.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticPyramid": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticPyramid": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticPyramid.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticQuad": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticQuad": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticQuad.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticTetra": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo"}, "VTKLink": {"vtkQuadraticTetra": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticTetra.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo"}}, "vtkQuadraticTriangle": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticTriangle": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticTriangle.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadraticWedge": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkQuadraticWedge": "https://www.vtk.org/doc/nightly/html/classvtkQuadraticWedge.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkQuadric": {"Cxx": {"ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud"}, "VTKLink": {"vtkQuadric": "https://www.vtk.org/doc/nightly/html/classvtkQuadric.html#details"}, "Python": {"ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud"}}, "vtkQuadricLODActor": {"Cxx": {"QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor"}, "VTKLink": {"vtkQuadricLODActor": "https://www.vtk.org/doc/nightly/html/classvtkQuadricLODActor.html#details"}}, "vtkQuantizePolyDataPoints": {"Cxx": {"QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints"}, "VTKLink": {"vtkQuantizePolyDataPoints": "https://www.vtk.org/doc/nightly/html/classvtkQuantizePolyDataPoints.html#details"}}, "vtkRadiusOutlierRemoval": {"Cxx": {"RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval"}, "VTKLink": {"vtkRadiusOutlierRemoval": "https://www.vtk.org/doc/nightly/html/classvtkRadiusOutlierRemoval.html#details"}}, "vtkRandomGraphSource": {"Cxx": {"RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource"}, "VTKLink": {"vtkRandomGraphSource": "https://www.vtk.org/doc/nightly/html/classvtkRandomGraphSource.html#details"}, "Java": {"RandomGraphSource": "https://examples.vtk.org/site/Java/Graphs/RandomGraphSource", "SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "Python": {"SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "RandomGraphSource": "https://examples.vtk.org/site/Python/Graphs/RandomGraphSource", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Python/Graphs/SelectedVerticesAndEdges"}}, "vtkRectf": {"Cxx": {"ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkRectf": "https://www.vtk.org/doc/nightly/html/classvtkRectf.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkRectilinearGrid": {"Cxx": {"DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "VTKLink": {"vtkRectilinearGrid": "https://www.vtk.org/doc/nightly/html/classvtkRectilinearGrid.html#details"}, "Java": {"VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGridToTetrahedra", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid"}, "Python": {"VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkRectilinearGridGeometryFilter": {"Cxx": {"RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData"}, "VTKLink": {"vtkRectilinearGridGeometryFilter": "https://www.vtk.org/doc/nightly/html/classvtkRectilinearGridGeometryFilter.html#details"}, "Python": {"RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1"}}, "vtkRectilinearGridToTetrahedra": {"Cxx": {"RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGridToTetrahedra"}, "VTKLink": {"vtkRectilinearGridToTetrahedra": "https://www.vtk.org/doc/nightly/html/classvtkRectilinearGridToTetrahedra.html#details"}, "Java": {"RectilinearGridToTetrahedra": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGridToTetrahedra"}}, "vtkRectilinearWipeRepresentation": {"Cxx": {"RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget"}, "VTKLink": {"vtkRectilinearWipeRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkRectilinearWipeRepresentation.html#details"}}, "vtkRectilinearWipeWidget": {"Cxx": {"RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget"}, "VTKLink": {"vtkRectilinearWipeWidget": "https://www.vtk.org/doc/nightly/html/classvtkRectilinearWipeWidget.html#details"}}, "vtkReflectionFilter": {"Cxx": {"Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection"}, "VTKLink": {"vtkReflectionFilter": "https://www.vtk.org/doc/nightly/html/classvtkReflectionFilter.html#details"}, "Java": {"Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection"}}, "vtkRemoveIsolatedVertices": {"Cxx": {"RemoveIsolatedVertices": "https://examples.vtk.org/site/Cxx/Graphs/RemoveIsolatedVertices"}, "VTKLink": {"vtkRemoveIsolatedVertices": "https://www.vtk.org/doc/nightly/html/classvtkRemoveIsolatedVertices.html#details"}}, "vtkRenderedGraphRepresentation": {"Cxx": {"VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels"}, "VTKLink": {"vtkRenderedGraphRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkRenderedGraphRepresentation.html#details"}, "Python": {"ColorVertexLabels": "https://examples.vtk.org/site/Python/Graphs/ColorVertexLabels", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices"}}, "vtkRendererCollection": {"Cxx": {"HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors"}, "VTKLink": {"vtkRendererCollection": "https://www.vtk.org/doc/nightly/html/classvtkRendererCollection.html#details"}}, "vtkRenderLargeImage": {"Cxx": {"RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision"}, "VTKLink": {"vtkRenderLargeImage": "https://www.vtk.org/doc/nightly/html/classvtkRenderLargeImage.html#details"}, "Python": {"PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision"}}, "vtkRenderPassCollection": {"Cxx": {"RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows"}, "VTKLink": {"vtkRenderPassCollection": "https://www.vtk.org/doc/nightly/html/classvtkRenderPassCollection.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows"}}, "vtkRenderStepsPass": {"Cxx": {"MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows"}, "VTKLink": {"vtkRenderStepsPass": "https://www.vtk.org/doc/nightly/html/classvtkRenderStepsPass.html#details"}, "Python": {"MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass"}}, "vtkRenderView": {"Cxx": {"RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView"}, "VTKLink": {"vtkRenderView": "https://www.vtk.org/doc/nightly/html/classvtkRenderView.html#details"}, "Java": {"RenderView": "https://examples.vtk.org/site/Java/Views/RenderView"}}, "vtkRenderWidget": {"Cxx": {"MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp"}, "VTKLink": {"vtkRenderWidget": "https://www.vtk.org/doc/nightly/html/classvtkRenderWidget.html#details"}}, "vtkRenderWindowInteractor": {"Cxx": {"WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "ProcrustesAlignmentFilter": "https://examples.vtk.org/site/Cxx/PolyData/ProcrustesAlignmentFilter", "ParametricSpline": "https://examples.vtk.org/site/Cxx/PolyData/ParametricSpline", "LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "MeshQuality": "https://examples.vtk.org/site/Cxx/PolyData/MeshQuality", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform", "Outline": "https://examples.vtk.org/site/Cxx/PolyData/Outline", "TriangleColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/TriangleColoredPoints", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "RotationAroundLine": "https://examples.vtk.org/site/Cxx/PolyData/RotationAroundLine", "ResampleAppendedPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ResampleAppendedPolyData", "TransformPipeline": "https://examples.vtk.org/site/Cxx/PolyData/TransformPipeline", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "TriangleSolidColor": "https://examples.vtk.org/site/Cxx/PolyData/TriangleSolidColor", "PolyDataIsoLines": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataIsoLines", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitPolyDataDistance", "HighlightBadCells": "https://examples.vtk.org/site/Cxx/PolyData/HighlightBadCells", "GradientFilter": "https://examples.vtk.org/site/Cxx/PolyData/GradientFilter", "DecimatePolyline": "https://examples.vtk.org/site/Cxx/PolyData/DecimatePolyline", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "PointsProjectedHull": "https://examples.vtk.org/site/Cxx/PolyData/PointsProjectedHull", "MaskPoints": "https://examples.vtk.org/site/Cxx/PolyData/MaskPoints", "CellCenters": "https://examples.vtk.org/site/Cxx/PolyData/CellCenters", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "TransformOrderDemo": "https://examples.vtk.org/site/Cxx/PolyData/TransformOrderDemo", "WeightedTransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/WeightedTransformFilter", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "KochanekSpline": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSpline", "QuantizePolyDataPoints": "https://examples.vtk.org/site/Cxx/PolyData/QuantizePolyDataPoints", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ConvexHull": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHull", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ExtractPolyLinesFromPolyData", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2", "DijkstraGraphGeodesicPath": "https://examples.vtk.org/site/Cxx/PolyData/DijkstraGraphGeodesicPath", "ColoredPoints": "https://examples.vtk.org/site/Cxx/PolyData/ColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Cxx/PolyData/TubeFilter", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "DeleteCells": "https://examples.vtk.org/site/Cxx/PolyData/DeleteCells", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "IntersectionPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/IntersectionPolyDataFilter", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "CellPointNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellPointNeighbors", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "ColorCellsWithRGB": "https://examples.vtk.org/site/Cxx/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Cxx/PolyData/ColorCells", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "TransformFilter": "https://examples.vtk.org/site/Cxx/PolyData/TransformFilter", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "PointSource": "https://examples.vtk.org/site/Cxx/PolyData/PointSource", "RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "ExtractSelectionCells": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionCells", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PolyDataConnectivityFilter_SpecifiedRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_SpecifiedRegion", "GreedyTerrainDecimation": "https://examples.vtk.org/site/Cxx/PolyData/GreedyTerrainDecimation", "PolyDataConnectivityFilter_LargestRegion": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataConnectivityFilter_LargestRegion", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "EmbedPointsIntoVolume": "https://examples.vtk.org/site/Cxx/PolyData/EmbedPointsIntoVolume", "ExtractSelectionOriginalId": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelectionOriginalId", "SelectPolyData": "https://examples.vtk.org/site/Cxx/PolyData/SelectPolyData", "Reflection": "https://examples.vtk.org/site/Cxx/PolyData/Reflection", "ImplicitSelectionLoop": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitSelectionLoop", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ExtractSelection": "https://examples.vtk.org/site/Cxx/PolyData/ExtractSelection", "CellEdgeNeighbors": "https://examples.vtk.org/site/Cxx/PolyData/CellEdgeNeighbors", "WarpVector": "https://examples.vtk.org/site/Cxx/PolyData/WarpVector", "ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface", "DownsamplePointCloud": "https://examples.vtk.org/site/Cxx/PolyData/DownsamplePointCloud", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegions", "PointLocator": "https://examples.vtk.org/site/Cxx/PolyData/PointLocator", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "MergeSelections": "https://examples.vtk.org/site/Cxx/PolyData/MergeSelections", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "ExtractCellsUsingPoints": "https://examples.vtk.org/site/Cxx/PolyData/ExtractCellsUsingPoints", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "MultiLineText": "https://examples.vtk.org/site/Cxx/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Cxx/ImageData/ImageDataGeometryFilter", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "ImageReslice": "https://examples.vtk.org/site/Cxx/ImageData/ImageReslice", "ImageTranslateExtent": "https://examples.vtk.org/site/Cxx/ImageData/ImageTranslateExtent", "IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "VoxelsOnBoundary": "https://examples.vtk.org/site/Cxx/ImageData/VoxelsOnBoundary", "ExtractVOI": "https://examples.vtk.org/site/Cxx/ImageData/ExtractVOI", "ImageWeightedSum": "https://examples.vtk.org/site/Cxx/ImageData/ImageWeightedSum", "ImageNormalize": "https://examples.vtk.org/site/Cxx/ImageData/ImageNormalize", "ImageIteratorDemo": "https://examples.vtk.org/site/Cxx/ImageData/ImageIteratorDemo", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "GraphPoints": "https://examples.vtk.org/site/Cxx/InfoVis/GraphPoints", "MutableGraphHelper": "https://examples.vtk.org/site/Cxx/InfoVis/MutableGraphHelper", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "ImplicitQuadric": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "ImageEllipsoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageEllipsoidSource", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "Flip": "https://examples.vtk.org/site/Cxx/Images/Flip", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageMagnitude", "ImageMirrorPad": "https://examples.vtk.org/site/Cxx/Images/ImageMirrorPad", "ImageTransparency": "https://examples.vtk.org/site/Cxx/Images/ImageTransparency", "ImageStencil": "https://examples.vtk.org/site/Cxx/Images/ImageStencil", "ImageCorrelation": "https://examples.vtk.org/site/Cxx/Images/ImageCorrelation", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "ImageRFFT": "https://examples.vtk.org/site/Cxx/Images/ImageRFFT", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "ImageContinuousErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousErode3D", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "ImageHybridMedian2D": "https://examples.vtk.org/site/Cxx/Images/ImageHybridMedian2D", "ImageGradientMagnitude": "https://examples.vtk.org/site/Cxx/Images/ImageGradientMagnitude", "ImageMapToColors": "https://examples.vtk.org/site/Cxx/Images/ImageMapToColors", "ImageSeparableConvolution": "https://examples.vtk.org/site/Cxx/Images/ImageSeparableConvolution", "ImageThreshold": "https://examples.vtk.org/site/Cxx/Images/ImageThreshold", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "ImageIslandRemoval2D": "https://examples.vtk.org/site/Cxx/Images/ImageIslandRemoval2D", "ImageGridSource": "https://examples.vtk.org/site/Cxx/Images/ImageGridSource", "ImageShiftScale": "https://examples.vtk.org/site/Cxx/Images/ImageShiftScale", "ImageNoiseSource": "https://examples.vtk.org/site/Cxx/Images/ImageNoiseSource", "DrawShapes": "https://examples.vtk.org/site/Cxx/Images/DrawShapes", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageDilateErode3D": "https://examples.vtk.org/site/Cxx/Images/ImageDilateErode3D", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "Actor2D": "https://examples.vtk.org/site/Cxx/Images/Actor2D", "ImageNonMaximumSuppression": "https://examples.vtk.org/site/Cxx/Images/ImageNonMaximumSuppression", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ImageGaussianSmooth": "https://examples.vtk.org/site/Cxx/Images/ImageGaussianSmooth", "ImageToStructuredPoints": "https://examples.vtk.org/site/Cxx/Images/ImageToStructuredPoints", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "ImageMagnify": "https://examples.vtk.org/site/Cxx/Images/ImageMagnify", "ImagePermute": "https://examples.vtk.org/site/Cxx/Images/ImagePermute", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ImageDivergence": "https://examples.vtk.org/site/Cxx/Images/ImageDivergence", "ImageOrientation": "https://examples.vtk.org/site/Cxx/Images/ImageOrientation", "ImageSliceMapper": "https://examples.vtk.org/site/Cxx/Images/ImageSliceMapper", "ImageConvolve": "https://examples.vtk.org/site/Cxx/Images/ImageConvolve", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageFFT": "https://examples.vtk.org/site/Cxx/Images/ImageFFT", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "BorderPixelSize": "https://examples.vtk.org/site/Cxx/Images/BorderPixelSize", "ImageShrink3D": "https://examples.vtk.org/site/Cxx/Images/ImageShrink3D", "CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector", "ImageImport": "https://examples.vtk.org/site/Cxx/Images/ImageImport", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "ImageMandelbrotSource": "https://examples.vtk.org/site/Cxx/Images/ImageMandelbrotSource", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageMask": "https://examples.vtk.org/site/Cxx/Images/ImageMask", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "FillWindow": "https://examples.vtk.org/site/Cxx/Images/FillWindow", "ImageMapper": "https://examples.vtk.org/site/Cxx/Images/ImageMapper", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "ImageSobel2D": "https://examples.vtk.org/site/Cxx/Images/ImageSobel2D", "ImageVariance3D": "https://examples.vtk.org/site/Cxx/Images/ImageVariance3D", "ImageSinusoidSource": "https://examples.vtk.org/site/Cxx/Images/ImageSinusoidSource", "ImageSlice": "https://examples.vtk.org/site/Cxx/Images/ImageSlice", "CombiningRGBChannels": "https://examples.vtk.org/site/Cxx/Images/CombiningRGBChannels", "ImageMathematics": "https://examples.vtk.org/site/Cxx/Images/ImageMathematics", "ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "DotProduct": "https://examples.vtk.org/site/Cxx/Images/DotProduct", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ImageOrder": "https://examples.vtk.org/site/Cxx/Images/ImageOrder", "ImageMedian3D": "https://examples.vtk.org/site/Cxx/Images/ImageMedian3D", "ImageOpenClose3D": "https://examples.vtk.org/site/Cxx/Images/ImageOpenClose3D", "ImageLaplacian": "https://examples.vtk.org/site/Cxx/Images/ImageLaplacian", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource", "Interpolation": "https://examples.vtk.org/site/Cxx/Images/Interpolation", "Cast": "https://examples.vtk.org/site/Cxx/Images/Cast", "ImageContinuousDilate3D": "https://examples.vtk.org/site/Cxx/Images/ImageContinuousDilate3D", "ImageToPolyDataFilter": "https://examples.vtk.org/site/Cxx/Images/ImageToPolyDataFilter", "ImageIdealHighPass": "https://examples.vtk.org/site/Cxx/Images/ImageIdealHighPass", "ImageStack": "https://examples.vtk.org/site/Cxx/Images/ImageStack", "ImageDifference": "https://examples.vtk.org/site/Cxx/Images/ImageDifference", "RenderView": "https://examples.vtk.org/site/Cxx/Views/RenderView", "Tutorial_Step5": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step5", "Tutorial_Step6": "https://examples.vtk.org/site/Cxx/Tutorial/Tutorial_Step6", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImagePlaneWidget", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "ImageTracerWidget": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidget", "PlaneWidget": "https://examples.vtk.org/site/Cxx/Widgets/PlaneWidget", "LineWidget2": "https://examples.vtk.org/site/Cxx/Widgets/LineWidget2", "SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget", "ImageTracerWidgetInsideContour": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetInsideContour", "SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2", "CheckerboardWidget": "https://examples.vtk.org/site/Cxx/Widgets/CheckerboardWidget", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "CompassWidget": "https://examples.vtk.org/site/Cxx/Widgets/CompassWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Cxx/Widgets/ImageTracerWidgetNonPlanar", "CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Cxx/Widgets/ImplicitPlaneWidget2", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "DistanceWidget": "https://examples.vtk.org/site/Cxx/Widgets/DistanceWidget", "ContourWidget": "https://examples.vtk.org/site/Cxx/Widgets/ContourWidget", "AffineWidget": "https://examples.vtk.org/site/Cxx/Widgets/AffineWidget", "AngleWidget": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "BalloonWidget": "https://examples.vtk.org/site/Cxx/Widgets/BalloonWidget", "HoverWidget": "https://examples.vtk.org/site/Cxx/Widgets/HoverWidget", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Cxx/Widgets/LogoWidget", "AngleWidget2D": "https://examples.vtk.org/site/Cxx/Widgets/AngleWidget2D", "CameraOrientationWidget": "https://examples.vtk.org/site/Cxx/Widgets/CameraOrientationWidget", "BiDimensionalWidget": "https://examples.vtk.org/site/Cxx/Widgets/BiDimensionalWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Cxx/Widgets/OrientationMarkerWidget", "BoxWidget": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Cxx/StructuredGrid/BlankPoint", "StructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGrid", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "VertexSize": "https://examples.vtk.org/site/Cxx/Graphs/VertexSize", "GraphToPolyData": "https://examples.vtk.org/site/Cxx/Graphs/GraphToPolyData", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph", "EdgeWeights": "https://examples.vtk.org/site/Cxx/Graphs/EdgeWeights", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "ConstructGraph": "https://examples.vtk.org/site/Cxx/Graphs/ConstructGraph", "SelectedVerticesAndEdgesObserver": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdgesObserver", "SideBySideGraphs": "https://examples.vtk.org/site/Cxx/Graphs/SideBySideGraphs", "ShortestPath": "https://examples.vtk.org/site/Cxx/Graphs/ShortestPath", "SelectedVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/SelectedVerticesAndEdges", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "LabelVerticesAndEdges": "https://examples.vtk.org/site/Cxx/Graphs/LabelVerticesAndEdges", "RandomGraphSource": "https://examples.vtk.org/site/Cxx/Graphs/RandomGraphSource", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable", "ColorVertexLabels": "https://examples.vtk.org/site/Cxx/Graphs/ColorVertexLabels", "BrownianPoints": "https://examples.vtk.org/site/Cxx/Utilities/BrownianPoints", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "ViewportBorders": "https://examples.vtk.org/site/Cxx/Utilities/ViewportBorders", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "Timer": "https://examples.vtk.org/site/Cxx/Utilities/Timer", "ResetCameraOrientation": "https://examples.vtk.org/site/Cxx/Utilities/ResetCameraOrientation", "FullScreen": "https://examples.vtk.org/site/Cxx/Utilities/FullScreen", "DataAnimation": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimation", "ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "FrameRate": "https://examples.vtk.org/site/Cxx/Utilities/FrameRate", "ColorMapToLUT": "https://examples.vtk.org/site/Cxx/Utilities/ColorMapToLUT", "CommandSubclass": "https://examples.vtk.org/site/Cxx/Utilities/CommandSubclass", "DetermineActorType": "https://examples.vtk.org/site/Cxx/Utilities/DetermineActorType", "CameraModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/CameraModifiedEvent", "WindowModifiedEvent": "https://examples.vtk.org/site/Cxx/Utilities/WindowModifiedEvent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "AnimationScene": "https://examples.vtk.org/site/Cxx/Utilities/AnimationScene", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Cxx/Utilities/Animation", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "AreaPicking": "https://examples.vtk.org/site/Cxx/Picking/AreaPicking", "HighlightWithSilhouette": "https://examples.vtk.org/site/Cxx/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Cxx/Picking/HighlightPickedActor", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "ImplicitBooleanDemo": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBooleanDemo", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "ConnectivityFilter": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilter", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "Glyph2D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph2D", "Glyph3D": "https://examples.vtk.org/site/Cxx/Filtering/Glyph3D", "ProgrammableFilter": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableFilter", "Delaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/Delaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Cxx/Filtering/GaussianSplat", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "TransformPolyData": "https://examples.vtk.org/site/Cxx/Filtering/TransformPolyData", "ExtractVisibleCells": "https://examples.vtk.org/site/Cxx/Filtering/ExtractVisibleCells", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Cxx/Filtering/ConstrainedDelaunay2D", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "PerlinNoise": "https://examples.vtk.org/site/Cxx/Filtering/PerlinNoise", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ProgrammableSource": "https://examples.vtk.org/site/Cxx/Filtering/ProgrammableSource", "CombinePolyData": "https://examples.vtk.org/site/Cxx/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Cxx/Filtering/VertexGlyphFilter", "WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "ImplicitBoolean": "https://examples.vtk.org/site/Cxx/Filtering/ImplicitBoolean", "GenericClip": "https://examples.vtk.org/site/Cxx/Filtering/GenericClip", "TriangulateTerrainMap": "https://examples.vtk.org/site/Cxx/Filtering/TriangulateTerrainMap", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "DataSetSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "BandedPolyDataContourFilter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BandedPolyDataContourFilter", "TubesWithVaryingRadiusAndColors": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesWithVaryingRadiusAndColors", "SplatFace": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SpikeFran", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "ImageGradient": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ImageGradient", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "SingleSplat": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "DecimateHawaii": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateHawaii", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CreateBFont", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FlyingHeadSlice", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutWithScalars", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "IronIsoSurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/IronIsoSurface", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ClipSphereCylinder", "IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "ReadBMP": "https://examples.vtk.org/site/Cxx/IO/ReadBMP", "ReadPolyData": "https://examples.vtk.org/site/Cxx/IO/ReadPolyData", "WritePNM": "https://examples.vtk.org/site/Cxx/IO/WritePNM", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "MetaImageReader": "https://examples.vtk.org/site/Cxx/IO/MetaImageReader", "ReadPNM": "https://examples.vtk.org/site/Cxx/IO/ReadPNM", "ReadExodusData": "https://examples.vtk.org/site/Cxx/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadUnstructuredGrid", "ReadPLY": "https://examples.vtk.org/site/Cxx/IO/ReadPLY", "JPEGReader": "https://examples.vtk.org/site/Cxx/IO/JPEGReader", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Cxx/IO/ParticleReader", "ReadSTL": "https://examples.vtk.org/site/Cxx/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Cxx/IO/ReadPLOT3D", "MetaImageWriter": "https://examples.vtk.org/site/Cxx/IO/MetaImageWriter", "SimplePointsReader": "https://examples.vtk.org/site/Cxx/IO/SimplePointsReader", "ReadDICOMSeries": "https://examples.vtk.org/site/Cxx/IO/ReadDICOMSeries", "ReadTIFF": "https://examples.vtk.org/site/Cxx/IO/ReadTIFF", "ReadStructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadStructuredGrid", "WriteBMP": "https://examples.vtk.org/site/Cxx/IO/WriteBMP", "ReadImageData": "https://examples.vtk.org/site/Cxx/IO/ReadImageData", "TransientHDFReader": "https://examples.vtk.org/site/Cxx/IO/TransientHDFReader", "ReadPDB": "https://examples.vtk.org/site/Cxx/IO/ReadPDB", "GLTFImporter": "https://examples.vtk.org/site/Cxx/IO/GLTFImporter", "ReadTextFile": "https://examples.vtk.org/site/Cxx/IO/ReadTextFile", "ReadDICOM": "https://examples.vtk.org/site/Cxx/IO/ReadDICOM", "ReadUnknownTypeXMLFile": "https://examples.vtk.org/site/Cxx/IO/ReadUnknownTypeXMLFile", "IndividualVRML": "https://examples.vtk.org/site/Cxx/IO/IndividualVRML", "ReadRectilinearGrid": "https://examples.vtk.org/site/Cxx/IO/ReadRectilinearGrid", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "VRMLImporterDemo": "https://examples.vtk.org/site/Cxx/IO/VRMLImporterDemo", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL", "DEMReader": "https://examples.vtk.org/site/Cxx/IO/DEMReader", "ReadCML": "https://examples.vtk.org/site/Cxx/IO/ReadCML", "PNGReader": "https://examples.vtk.org/site/Cxx/IO/PNGReader", "HDRReader": "https://examples.vtk.org/site/Cxx/IO/HDRReader", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "ReadOBJ": "https://examples.vtk.org/site/Cxx/IO/ReadOBJ", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteVTI": "https://examples.vtk.org/site/Cxx/IO/WriteVTI", "3DSImporter": "https://examples.vtk.org/site/Cxx/IO/3DSImporter", "StructuredPointsReader": "https://examples.vtk.org/site/Cxx/IO/StructuredPointsReader", "GLTFExporter": "https://examples.vtk.org/site/Cxx/IO/GLTFExporter", "WritePLY": "https://examples.vtk.org/site/Cxx/IO/WritePLY", "VRMLImporter": "https://examples.vtk.org/site/Cxx/IO/VRMLImporter", "WriteVTU": "https://examples.vtk.org/site/Cxx/IO/WriteVTU", "WriteTIFF": "https://examples.vtk.org/site/Cxx/IO/WriteTIFF", "UGrid": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "PieChartActor": "https://examples.vtk.org/site/Cxx/Plotting/PieChartActor", "Histogram2D": "https://examples.vtk.org/site/Cxx/Plotting/Histogram2D", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "BillboardTextActor3D": "https://examples.vtk.org/site/Cxx/Visualization/BillboardTextActor3D", "WindowSize": "https://examples.vtk.org/site/Cxx/Visualization/WindowSize", "TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "CubeAxesActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor2D", "HideActor": "https://examples.vtk.org/site/Cxx/Visualization/HideActor", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Cxx/Visualization/DisplayCoordinateAxes", "WindowTitle": "https://examples.vtk.org/site/Cxx/Visualization/WindowTitle", "OrientedGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/OrientedGlyphs", "StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "ProjectSphere": "https://examples.vtk.org/site/Cxx/Visualization/ProjectSphere", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "SelectWindowRegion": "https://examples.vtk.org/site/Cxx/Visualization/SelectWindowRegion", "LineWidth": "https://examples.vtk.org/site/Cxx/Visualization/LineWidth", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "ScaleGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ScaleGlyphs", "TransformActorCollection": "https://examples.vtk.org/site/Cxx/Visualization/TransformActorCollection", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "BackgroundGradient": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundGradient", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "NoShading": "https://examples.vtk.org/site/Cxx/Visualization/NoShading", "RenderLargeImage": "https://examples.vtk.org/site/Cxx/Visualization/RenderLargeImage", "CornerAnnotation": "https://examples.vtk.org/site/Cxx/Visualization/CornerAnnotation", "DistanceToCamera": "https://examples.vtk.org/site/Cxx/Visualization/DistanceToCamera", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Cxx/Visualization/AssignCellColorsFromLUT", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "VectorField": "https://examples.vtk.org/site/Cxx/Visualization/VectorField", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "PointSize": "https://examples.vtk.org/site/Cxx/Visualization/PointSize", "TransformActor": "https://examples.vtk.org/site/Cxx/Visualization/TransformActor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "VisualizeVTP": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeVTP", "Glyph3DMapper": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DMapper", "Legend": "https://examples.vtk.org/site/Cxx/Visualization/Legend", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "CubeAxesActor": "https://examples.vtk.org/site/Cxx/Visualization/CubeAxesActor", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Cxx/Visualization/ProgrammableGlyphFilter", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture", "VisualizeImageData": "https://examples.vtk.org/site/Cxx/Visualization/VisualizeImageData", "LegendScaleActor": "https://examples.vtk.org/site/Cxx/Visualization/LegendScaleActor", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "Cursor2D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor2D", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "ColorAnActor": "https://examples.vtk.org/site/Cxx/Visualization/ColorAnActor", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "ProteinRibbons": "https://examples.vtk.org/site/Cxx/Visualization/ProteinRibbons", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "DepthSortPolyData": "https://examples.vtk.org/site/Cxx/Visualization/DepthSortPolyData", "Camera": "https://examples.vtk.org/site/Cxx/Visualization/Camera", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "SceneBounds": "https://examples.vtk.org/site/Cxx/Visualization/SceneBounds", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "HedgeHog": "https://examples.vtk.org/site/Cxx/Visualization/HedgeHog", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph", "Cursor3D": "https://examples.vtk.org/site/Cxx/Visualization/Cursor3D", "Opacity": "https://examples.vtk.org/site/Cxx/Visualization/Opacity", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "Visualize2DPoints": "https://examples.vtk.org/site/Cxx/Visualization/Visualize2DPoints", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "CloseWindow": "https://examples.vtk.org/site/Cxx/Visualization/CloseWindow", "Wireframe": "https://examples.vtk.org/site/Cxx/Visualization/Wireframe", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Cxx/Visualization/CreateColorSeriesDemo", "CameraActor": "https://examples.vtk.org/site/Cxx/Visualization/CameraActor", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "BackfaceCulling": "https://examples.vtk.org/site/Cxx/Visualization/BackfaceCulling", "AnnotatedCubeActor": "https://examples.vtk.org/site/Cxx/Visualization/AnnotatedCubeActor", "CaptionActor2D": "https://examples.vtk.org/site/Cxx/Visualization/CaptionActor2D", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor", "NamedColors": "https://examples.vtk.org/site/Cxx/Visualization/NamedColors", "FastSplatter": "https://examples.vtk.org/site/Cxx/Visualization/FastSplatter", "BoxClipUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipUnstructuredGrid", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "SideBySideViewports": "https://examples.vtk.org/site/Cxx/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Cxx/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Cxx/Visualization/CursorShape", "MultipleActors": "https://examples.vtk.org/site/Cxx/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "FontFile": "https://examples.vtk.org/site/Cxx/Visualization/FontFile", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "LODProp3D": "https://examples.vtk.org/site/Cxx/Visualization/LODProp3D", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "QuadraticSurface": "https://examples.vtk.org/site/Cxx/Visualization/QuadraticSurface", "BackgroundColor": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundColor", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "EdgePoints": "https://examples.vtk.org/site/Cxx/Visualization/EdgePoints", "MoveActor": "https://examples.vtk.org/site/Cxx/Visualization/MoveActor", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Cxx/Visualization/DisplayQuadricSurfaces", "ColorGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ColorGlyphs", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ComplexV": "https://examples.vtk.org/site/Cxx/Visualization/ComplexV", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "FlatShading": "https://examples.vtk.org/site/Cxx/Visualization/FlatShading", "Hawaii": "https://examples.vtk.org/site/Cxx/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Cxx/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Cxx/Visualization/ScalarVisibility", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Cxx/Visualization/RandomProbe", "QuadricVisualization": "https://examples.vtk.org/site/Cxx/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "QuadricLODActor": "https://examples.vtk.org/site/Cxx/Visualization/QuadricLODActor", "BoxClipStructuredPoints": "https://examples.vtk.org/site/Cxx/Visualization/BoxClipStructuredPoints", "HideAllActors": "https://examples.vtk.org/site/Cxx/Visualization/HideAllActors", "CylinderExample": "https://examples.vtk.org/site/Cxx/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Cxx/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Cxx/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Cxx/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Cxx/GeometricObjects/Point", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "LongLine": "https://examples.vtk.org/site/Cxx/GeometricObjects/LongLine", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "Triangle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Cxx/GeometricObjects/TriangleStrip", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Tetrahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Tetrahedron", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "ConeDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConeDemo", "Frustum": "https://examples.vtk.org/site/Cxx/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Cxx/GeometricObjects/PolyLine1", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "Quad": "https://examples.vtk.org/site/Cxx/GeometricObjects/Quad", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinderDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/RegularPolygonSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "Line": "https://examples.vtk.org/site/Cxx/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Cxx/GeometricObjects/ConvexPointSet", "OrientedCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/OrientedCylinder", "ColoredLines": "https://examples.vtk.org/site/Cxx/GeometricObjects/ColoredLines", "Polyhedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Cxx/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Cxx/GeometricObjects/Circle", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Cxx/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Hexahedron", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "Cube1": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cube1", "Vertex": "https://examples.vtk.org/site/Cxx/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Cxx/GeometricObjects/Polygon", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Cxx/Interaction/MouseEventsObserver", "TrackballCamera": "https://examples.vtk.org/site/Cxx/Interaction/TrackballCamera", "RubberBand2D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2D", "RubberBand3D": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand3D", "KeypressObserver": "https://examples.vtk.org/site/Cxx/Interaction/KeypressObserver", "KeypressEvents": "https://examples.vtk.org/site/Cxx/Interaction/KeypressEvents", "RubberBandZoom": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandZoom", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "CallData": "https://examples.vtk.org/site/Cxx/Interaction/CallData", "InteractorStyleUser": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleUser", "RubberBand2DObserver": "https://examples.vtk.org/site/Cxx/Interaction/RubberBand2DObserver", "SelectAnActor": "https://examples.vtk.org/site/Cxx/Interaction/SelectAnActor", "RubberBandPick": "https://examples.vtk.org/site/Cxx/Interaction/RubberBandPick", "Assembly": "https://examples.vtk.org/site/Cxx/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Cxx/Interaction/InteractorStyleTerrain", "PointPicker": "https://examples.vtk.org/site/Cxx/Interaction/PointPicker", "Picking": "https://examples.vtk.org/site/Cxx/Interaction/Picking", "ClientData": "https://examples.vtk.org/site/Cxx/Interaction/ClientData", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker", "CallBack": "https://examples.vtk.org/site/Cxx/Interaction/CallBack", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game", "DoubleClick": "https://examples.vtk.org/site/Cxx/Interaction/DoubleClick", "StyleSwitch": "https://examples.vtk.org/site/Cxx/Interaction/StyleSwitch", "PickableOff": "https://examples.vtk.org/site/Cxx/Interaction/PickableOff", "MouseEvents": "https://examples.vtk.org/site/Cxx/Interaction/MouseEvents", "UserEvent": "https://examples.vtk.org/site/Cxx/Interaction/UserEvent", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "TrackballActor": "https://examples.vtk.org/site/Cxx/Interaction/TrackballActor", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "ShiftAndControl": "https://examples.vtk.org/site/Cxx/Interaction/ShiftAndControl", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Cxx/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring", "Delaunay3D": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3D", "MarchingSquares": "https://examples.vtk.org/site/Cxx/Modelling/MarchingSquares", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "DelaunayMesh": "https://examples.vtk.org/site/Cxx/Modelling/DelaunayMesh", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "ExtractClusters": "https://examples.vtk.org/site/Cxx/Points/ExtractClusters", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "NormalEstimation": "https://examples.vtk.org/site/Cxx/Points/NormalEstimation", "FitImplicitFunction": "https://examples.vtk.org/site/Cxx/Points/FitImplicitFunction", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/RGrid", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "ModifiedBSPTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeExtractCells", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "OBBTreeExtractCells": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeExtractCells", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "RotatingSphere": "https://examples.vtk.org/site/Cxx/Animation/RotatingSphere", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Cxx/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Cxx/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "StripFran": "https://examples.vtk.org/site/Cxx/Rendering/StripFran", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "TransformSphere": "https://examples.vtk.org/site/Cxx/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Cxx/Rendering/TransparentBackground", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo", "CameraBlur": "https://examples.vtk.org/site/Cxx/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "ColoredSphere": "https://examples.vtk.org/site/Cxx/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Cxx/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Cxx/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Cxx/Rendering/SpecularSpheres", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Cxx/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Cxx/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Cxx/Rendering/LayeredActors", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "SpotLights": "https://examples.vtk.org/site/Cxx/Lighting/SpotLights", "LightActor": "https://examples.vtk.org/site/Cxx/Lighting/LightActor", "Light": "https://examples.vtk.org/site/Cxx/Lighting/Light", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "IdentifyHoles": "https://examples.vtk.org/site/Cxx/Meshes/IdentifyHoles", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/ClipDataSetWithPolyData", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "ColoredElevationMap": "https://examples.vtk.org/site/Cxx/Meshes/ColoredElevationMap", "PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator", "SolidClip": "https://examples.vtk.org/site/Cxx/Meshes/SolidClip", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "Triangulate": "https://examples.vtk.org/site/Cxx/Meshes/Triangulate", "BoundaryEdges": "https://examples.vtk.org/site/Cxx/Meshes/BoundaryEdges", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "ExtractEdges": "https://examples.vtk.org/site/Cxx/Meshes/ExtractEdges", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "DeformPointSet": "https://examples.vtk.org/site/Cxx/Meshes/DeformPointSet", "MatrixMathFilter": "https://examples.vtk.org/site/Cxx/Meshes/MatrixMathFilter", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap", "ElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/ElevationFilter", "SimpleElevationFilter": "https://examples.vtk.org/site/Cxx/Meshes/SimpleElevationFilter", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "WindowedSincPolyDataFilter": "https://examples.vtk.org/site/Cxx/Meshes/WindowedSincPolyDataFilter"}, "VTKLink": {"vtkRenderWindowInteractor": "https://www.vtk.org/doc/nightly/html/classvtkRenderWindowInteractor.html#details"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter", "ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform", "TransformFilter": "https://examples.vtk.org/site/Java/PolyData/TransformFilter", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap", "Outline": "https://examples.vtk.org/site/Java/PolyData/Outline", "ColoredPoints": "https://examples.vtk.org/site/Java/PolyData/ColoredPoints", "TriangleColoredPoints": "https://examples.vtk.org/site/Java/PolyData/TriangleColoredPoints", "TubeFilter": "https://examples.vtk.org/site/Java/PolyData/TubeFilter", "CellCenters": "https://examples.vtk.org/site/Java/PolyData/CellCenters", "RotationAroundLine": "https://examples.vtk.org/site/Java/PolyData/RotationAroundLine", "ColorDisconnectedRegions": "https://examples.vtk.org/site/Java/PolyData/ColorDisconnectedRegions", "TransformPipeline": "https://examples.vtk.org/site/Java/PolyData/TransformPipeline", "RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter", "MeshQuality": "https://examples.vtk.org/site/Java/PolyData/MeshQuality", "ColorCellsWithRGB": "https://examples.vtk.org/site/Java/PolyData/ColorCellsWithRGB", "ColorCells": "https://examples.vtk.org/site/Java/PolyData/ColorCells", "KochanekSpline": "https://examples.vtk.org/site/Java/PolyData/KochanekSpline", "Reflection": "https://examples.vtk.org/site/Java/PolyData/Reflection", "MultiLineText": "https://examples.vtk.org/site/Java/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "ImageNormalize": "https://examples.vtk.org/site/Java/ImageData/ImageNormalize", "ImageWeightedSum": "https://examples.vtk.org/site/Java/ImageData/ImageWeightedSum", "ImageTest": "https://examples.vtk.org/site/Java/Imaging/ImageTest", "SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction", "Cast": "https://examples.vtk.org/site/Java/Images/Cast", "Actor2D": "https://examples.vtk.org/site/Java/Images/Actor2D", "Flip": "https://examples.vtk.org/site/Java/Images/Flip", "ImageFFT": "https://examples.vtk.org/site/Java/Images/ImageFFT", "StaticImage": "https://examples.vtk.org/site/Java/Images/StaticImage", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource", "ImageSinusoidSource": "https://examples.vtk.org/site/Java/Images/ImageSinusoidSource", "HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "ImagePlaneWidget": "https://examples.vtk.org/site/Java/Widgets/ImagePlaneWidget", "PlaneWidget": "https://examples.vtk.org/site/Java/Widgets/PlaneWidget", "SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget", "LogoWidget": "https://examples.vtk.org/site/Java/Widgets/LogoWidget", "AngleWidget2D": "https://examples.vtk.org/site/Java/Widgets/AngleWidget2D", "TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "DistanceWidget": "https://examples.vtk.org/site/Java/Widgets/DistanceWidget", "CaptionWidget": "https://examples.vtk.org/site/Java/Widgets/CaptionWidget", "ImageTracerWidgetNonPlanar": "https://examples.vtk.org/site/Java/Widgets/ImageTracerWidgetNonPlanar", "OrientationMarkerWidget": "https://examples.vtk.org/site/Java/Widgets/OrientationMarkerWidget", "SplineWidget": "https://examples.vtk.org/site/Java/Widgets/SplineWidget", "AngleWidget": "https://examples.vtk.org/site/Java/Widgets/AngleWidget", "BalloonWidget": "https://examples.vtk.org/site/Java/Widgets/BalloonWidget", "BlankPoint": "https://examples.vtk.org/site/Java/StructuredGrid/BlankPoint", "StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline", "BrownianPoints": "https://examples.vtk.org/site/Java/Utilities/BrownianPoints", "FullScreen": "https://examples.vtk.org/site/Java/Utilities/FullScreen", "Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Java/Filtering/Delaunay2D", "Glyph2D": "https://examples.vtk.org/site/Java/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Java/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Java/Filtering/Glyph3D", "TransformPolyData": "https://examples.vtk.org/site/Java/Filtering/TransformPolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Java/Filtering/VertexGlyphFilter", "SpikeFran": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/SpikeFran", "IceCream": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/IceCream", "Cutter": "https://examples.vtk.org/site/Java/VisualizationAlgorithms/Cutter", "SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "CompositePolyDataMapper": "https://examples.vtk.org/site/Java/CompositeData/CompositePolyDataMapper", "ReadBMP": "https://examples.vtk.org/site/Java/IO/ReadBMP", "ReadPolyData": "https://examples.vtk.org/site/Java/IO/ReadPolyData", "WritePNM": "https://examples.vtk.org/site/Java/IO/WritePNM", "ReadPNM": "https://examples.vtk.org/site/Java/IO/ReadPNM", "ReadPLY": "https://examples.vtk.org/site/Java/IO/ReadPLY", "JPEGReader": "https://examples.vtk.org/site/Java/IO/JPEGReader", "ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC", "ParticleReader": "https://examples.vtk.org/site/Java/IO/ParticleReader", "ReadVTP": "https://examples.vtk.org/site/Java/IO/ReadVTP", "ReadSTL": "https://examples.vtk.org/site/Java/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Java/IO/ReadPLOT3D", "SimplePointsReader": "https://examples.vtk.org/site/Java/IO/SimplePointsReader", "ReadTIFF": "https://examples.vtk.org/site/Java/IO/ReadTIFF", "ReadStructuredGrid": "https://examples.vtk.org/site/Java/IO/ReadStructuredGrid", "ReadDICOM": "https://examples.vtk.org/site/Java/IO/ReadDICOM", "ReadRectilinearGrid": "https://examples.vtk.org/site/Java/IO/ReadRectilinearGrid", "WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL", "DEMReader": "https://examples.vtk.org/site/Java/IO/DEMReader", "ReadCML": "https://examples.vtk.org/site/Java/IO/ReadCML", "PNGReader": "https://examples.vtk.org/site/Java/IO/PNGReader", "ReadOBJ": "https://examples.vtk.org/site/Java/IO/ReadOBJ", "ThreeDSImporter": "https://examples.vtk.org/site/Java/IO/ThreeDSImporter", "StructuredPointsReader": "https://examples.vtk.org/site/Java/IO/StructuredPointsReader", "WritePLY": "https://examples.vtk.org/site/Java/IO/WritePLY", "VRMLImporter": "https://examples.vtk.org/site/Java/IO/VRMLImporter", "WriteVTU": "https://examples.vtk.org/site/Java/IO/WriteVTU", "WriteTIFF": "https://examples.vtk.org/site/Java/IO/WriteTIFF", "BackgroundGradient": "https://examples.vtk.org/site/Java/Visualization/BackgroundGradient", "MultipleActors": "https://examples.vtk.org/site/Java/Visualization/MultipleActors", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries", "ColorAnActor": "https://examples.vtk.org/site/Java/Visualization/ColorAnActor", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "NoShading": "https://examples.vtk.org/site/Java/Visualization/NoShading", "MultipleViewports": "https://examples.vtk.org/site/Java/Visualization/MultipleViewports", "MoveCamera": "https://examples.vtk.org/site/Java/Visualization/MoveCamera", "WireframeSphere": "https://examples.vtk.org/site/Java/Visualization/WireframeSphere", "ProteinRibbons": "https://examples.vtk.org/site/Java/Visualization/ProteinRibbons", "DistanceToCamera": "https://examples.vtk.org/site/Java/Visualization/DistanceToCamera", "CornerAnnotation": "https://examples.vtk.org/site/Java/Visualization/CornerAnnotation", "Camera": "https://examples.vtk.org/site/Java/Visualization/Camera", "WindowSize": "https://examples.vtk.org/site/Java/Visualization/WindowSize", "CubeAxesActor2D": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor2D", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Java/Visualization/DisplayCoordinateAxes", "Cursor3D": "https://examples.vtk.org/site/Java/Visualization/Cursor3D", "OrientedGlyphs": "https://examples.vtk.org/site/Java/Visualization/OrientedGlyphs", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower", "Opacity": "https://examples.vtk.org/site/Java/Visualization/Opacity", "ProjectSphere": "https://examples.vtk.org/site/Java/Visualization/ProjectSphere", "BackgroundColor": "https://examples.vtk.org/site/Java/Visualization/BackgroundColor", "VisualizeVTP": "https://examples.vtk.org/site/Java/Visualization/VisualizeVTP", "MoveActor": "https://examples.vtk.org/site/Java/Visualization/MoveActor", "Legend": "https://examples.vtk.org/site/Java/Visualization/Legend", "CubeAxesActor": "https://examples.vtk.org/site/Java/Visualization/CubeAxesActor", "CameraActor": "https://examples.vtk.org/site/Java/Visualization/CameraActor", "ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "VisualizeImageData": "https://examples.vtk.org/site/Java/Visualization/VisualizeImageData", "LineWidth": "https://examples.vtk.org/site/Java/Visualization/LineWidth", "BackfaceCulling": "https://examples.vtk.org/site/Java/Visualization/BackfaceCulling", "LegendScaleActor": "https://examples.vtk.org/site/Java/Visualization/LegendScaleActor", "AnnotatedCubeActor": "https://examples.vtk.org/site/Java/Visualization/AnnotatedCubeActor", "ComplexV": "https://examples.vtk.org/site/Java/Visualization/ComplexV", "BlobbyLogo": "https://examples.vtk.org/site/Java/Visualization/BlobbyLogo", "ScalarVisibility": "https://examples.vtk.org/site/Java/Visualization/ScalarVisibility", "Animation": "https://examples.vtk.org/site/Java/Visualization/Animation", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "RandomProbe": "https://examples.vtk.org/site/Java/Visualization/RandomProbe", "AnimDataCone": "https://examples.vtk.org/site/Java/Visualization/AnimDataCone", "Cursor2D": "https://examples.vtk.org/site/Java/Visualization/Cursor2D", "ImageOrientation": "https://examples.vtk.org/site/Java/Visualization/ImageOrientation", "SideBySideViewports": "https://examples.vtk.org/site/Java/Visualization/SideBySideViewports", "ColorActorEdges": "https://examples.vtk.org/site/Java/Visualization/ColorActorEdges", "CursorShape": "https://examples.vtk.org/site/Java/Visualization/CursorShape", "CylinderExample": "https://examples.vtk.org/site/Java/GeometricObjects/CylinderExample", "Triangle": "https://examples.vtk.org/site/Java/GeometricObjects/Triangle", "TriangleStrip": "https://examples.vtk.org/site/Java/GeometricObjects/TriangleStrip", "Cone": "https://examples.vtk.org/site/Java/GeometricObjects/Cone", "ConvexPointSet": "https://examples.vtk.org/site/Java/GeometricObjects/ConvexPointSet", "ParametricObjects": "https://examples.vtk.org/site/Java/GeometricObjects/ParametricObjects", "EllipticalCylinder": "https://examples.vtk.org/site/Java/GeometricObjects/EllipticalCylinder", "Pyramid": "https://examples.vtk.org/site/Java/GeometricObjects/Pyramid", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "Vertex": "https://examples.vtk.org/site/Java/GeometricObjects/Vertex", "Disk": "https://examples.vtk.org/site/Java/GeometricObjects/Disk", "Quad": "https://examples.vtk.org/site/Java/GeometricObjects/Quad", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "TextActor": "https://examples.vtk.org/site/Java/GeometricObjects/TextActor", "Arrow": "https://examples.vtk.org/site/Java/GeometricObjects/Arrow", "Polygon": "https://examples.vtk.org/site/Java/GeometricObjects/Polygon", "Circle": "https://examples.vtk.org/site/Java/GeometricObjects/Circle", "TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane", "EarthSource": "https://examples.vtk.org/site/Java/Geovis/EarthSource", "CompassWidget": "https://examples.vtk.org/site/Java/Geovis/CompassWidget", "GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates", "PickableOff": "https://examples.vtk.org/site/Java/Interaction/PickableOff", "StyleSwitch": "https://examples.vtk.org/site/Java/Interaction/StyleSwitch", "TrackballCamera": "https://examples.vtk.org/site/Java/Interaction/TrackballCamera", "RubberBandPick": "https://examples.vtk.org/site/Java/Interaction/RubberBandPick", "RubberBandZoom": "https://examples.vtk.org/site/Java/Interaction/RubberBandZoom", "Assembly": "https://examples.vtk.org/site/Java/Interaction/Assembly", "InteractorStyleTerrain": "https://examples.vtk.org/site/Java/Interaction/InteractorStyleTerrain", "TrackballActor": "https://examples.vtk.org/site/Java/Interaction/TrackballActor", "DelaunayMesh": "https://examples.vtk.org/site/Java/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol", "FitImplicitFunction": "https://examples.vtk.org/site/Java/Points/FitImplicitFunction", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/RectilinearGrid", "VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree", "MedicalDemo2": "https://examples.vtk.org/site/Java/Medical/MedicalDemo2", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4", "MedicalDemo1": "https://examples.vtk.org/site/Java/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Java/Medical/MedicalDemo3", "SpecularSpheres": "https://examples.vtk.org/site/Java/Rendering/SpecularSpheres", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6", "AmbientSpheres": "https://examples.vtk.org/site/Java/Rendering/AmbientSpheres", "ColoredSphere": "https://examples.vtk.org/site/Java/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Java/Rendering/Mace", "SpotLight": "https://examples.vtk.org/site/Java/Lighting/SpotLight", "BoundaryEdges": "https://examples.vtk.org/site/Java/Meshes/BoundaryEdges"}, "Python": {"SmoothMeshGrid": "https://examples.vtk.org/site/Python/PolyData/SmoothMeshGrid", "FilledPolygon": "https://examples.vtk.org/site/Python/PolyData/FilledPolygon", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Python/PolyData/BooleanOperationPolyDataFilter", "CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject", "CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Outline": "https://examples.vtk.org/site/Python/PolyData/Outline", "ExtractSelection": "https://examples.vtk.org/site/Python/PolyData/ExtractSelection", "ExtractPolyLinesFromPolyData": "https://examples.vtk.org/site/Python/PolyData/ExtractPolyLinesFromPolyData", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "RotationAroundLine": "https://examples.vtk.org/site/Python/PolyData/RotationAroundLine", "PointSource": "https://examples.vtk.org/site/Python/PolyData/PointSource", "WarpVector": "https://examples.vtk.org/site/Python/PolyData/WarpVector", "ExtractSelectionCells": "https://examples.vtk.org/site/Python/PolyData/ExtractSelectionCells", "TubeFilter": "https://examples.vtk.org/site/Python/PolyData/TubeFilter", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil", "ImplicitPolyDataDistance": "https://examples.vtk.org/site/Python/PolyData/ImplicitPolyDataDistance", "RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "MultiLineText": "https://examples.vtk.org/site/Python/Annotation/MultiLineText", "TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "WriteReadVtkImageData": "https://examples.vtk.org/site/Python/ImageData/WriteReadVtkImageData", "ImageNormalize": "https://examples.vtk.org/site/Python/ImageData/ImageNormalize", "ImageDataGeometryFilter": "https://examples.vtk.org/site/Python/ImageData/ImageDataGeometryFilter", "ImageWeightedSum": "https://examples.vtk.org/site/Python/ImageData/ImageWeightedSum", "MorphologyComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Python/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Python/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Python/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Python/ImageProcessing/IsoSubsample", "HybridMedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/HybridMedianComparison", "EnhanceEdges": "https://examples.vtk.org/site/Python/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Python/ImageProcessing/GaussianSmooth", "MedianComparison": "https://examples.vtk.org/site/Python/ImageProcessing/MedianComparison", "ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ImplicitQuadric": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitQuadric", "ImplicitSphere1": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere1", "SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction", "BooleanOperationImplicitFunctions": "https://examples.vtk.org/site/Python/ImplicitFunctions/BooleanOperationImplicitFunctions", "ImplicitSphere": "https://examples.vtk.org/site/Python/ImplicitFunctions/ImplicitSphere", "ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "BackgroundImage": "https://examples.vtk.org/site/Python/Images/BackgroundImage", "Actor2D": "https://examples.vtk.org/site/Python/Images/Actor2D", "Cast": "https://examples.vtk.org/site/Python/Images/Cast", "Tutorial_Step5": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step5", "Tutorial_Step6": "https://examples.vtk.org/site/Python/Tutorial/Tutorial_Step6", "HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "SphereWidget": "https://examples.vtk.org/site/Python/Widgets/SphereWidget", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "CameraOrientationWidget": "https://examples.vtk.org/site/Python/Widgets/CameraOrientationWidget", "OrientationMarkerWidget1": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget1", "TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "OrientationMarkerWidget": "https://examples.vtk.org/site/Python/Widgets/OrientationMarkerWidget", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget", "BoxWidget": "https://examples.vtk.org/site/Python/Widgets/BoxWidget", "BalloonWidget": "https://examples.vtk.org/site/Python/Widgets/BalloonWidget", "ImplicitPlaneWidget2": "https://examples.vtk.org/site/Python/Widgets/ImplicitPlaneWidget2", "SGrid": "https://examples.vtk.org/site/Python/StructuredGrid/SGrid", "BlankPoint": "https://examples.vtk.org/site/Python/StructuredGrid/BlankPoint", "SideBySideGraphs": "https://examples.vtk.org/site/Python/Graphs/SideBySideGraphs", "GraphToPolyData": "https://examples.vtk.org/site/Python/Graphs/GraphToPolyData", "SaveSceneToFile": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFile", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "Animation": "https://examples.vtk.org/site/Python/Utilities/Animation", "ColorMapToLUT_XML": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_XML", "ResetCameraOrientation": "https://examples.vtk.org/site/Python/Utilities/ResetCameraOrientation", "ColorMapToLUT": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT", "VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "ColorMapToLUT_JSON": "https://examples.vtk.org/site/Python/Utilities/ColorMapToLUT_JSON", "ShareCamera": "https://examples.vtk.org/site/Python/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData", "HighlightWithSilhouette": "https://examples.vtk.org/site/Python/Picking/HighlightWithSilhouette", "HighlightPickedActor": "https://examples.vtk.org/site/Python/Picking/HighlightPickedActor", "CellPicking": "https://examples.vtk.org/site/Python/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Python/Filtering/AppendFilter", "WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "Delaunay2D": "https://examples.vtk.org/site/Python/Filtering/Delaunay2D", "ConstrainedDelaunay2D": "https://examples.vtk.org/site/Python/Filtering/ConstrainedDelaunay2D", "GaussianSplat": "https://examples.vtk.org/site/Python/Filtering/GaussianSplat", "ConnectivityFilter": "https://examples.vtk.org/site/Python/Filtering/ConnectivityFilter", "Glyph2D": "https://examples.vtk.org/site/Python/Filtering/Glyph2D", "PerlinNoise": "https://examples.vtk.org/site/Python/Filtering/PerlinNoise", "Glyph3D": "https://examples.vtk.org/site/Python/Filtering/Glyph3D", "TriangulateTerrainMap": "https://examples.vtk.org/site/Python/Filtering/TriangulateTerrainMap", "TransformPolyData": "https://examples.vtk.org/site/Python/Filtering/TransformPolyData", "CombinePolyData": "https://examples.vtk.org/site/Python/Filtering/CombinePolyData", "VertexGlyphFilter": "https://examples.vtk.org/site/Python/Filtering/VertexGlyphFilter", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "DataSetSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DataSetSurface", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "SplatFace": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SplatFace", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "PineRootConnectivity": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootConnectivity", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "IceCream": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IceCream", "SpikeFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SpikeFran", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlowGlyphs", "DecimateHawaii": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateHawaii", "SingleSplat": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/SingleSplat", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine", "ImageGradient": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ImageGradient", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes", "CreateBFont": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CreateBFont", "TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "Hello": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Hello", "HeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadSlice", "CutWithCutFunction": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithCutFunction", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "PineRootDecimation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PineRootDecimation", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration", "LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "FlyingHeadSlice": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/FlyingHeadSlice", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "CutWithScalars": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutWithScalars", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "IronIsoSurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/IronIsoSurface", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "HyperStreamline": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HyperStreamline", "ContourQuadric": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ContourQuadric", "Cutter": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Cutter", "ClipSphereCylinder": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ClipSphereCylinder", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR", "MultiBlockDataSet": "https://examples.vtk.org/site/Python/CompositeData/MultiBlockDataSet", "CompositePolyDataMapper": "https://examples.vtk.org/site/Python/CompositeData/CompositePolyDataMapper", "ReadPolyData": "https://examples.vtk.org/site/Python/IO/ReadPolyData", "ReadExodusData": "https://examples.vtk.org/site/Python/IO/ReadExodusData", "ReadUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadUnstructuredGrid", "ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC", "ReadVTP": "https://examples.vtk.org/site/Python/IO/ReadVTP", "ReadSTL": "https://examples.vtk.org/site/Python/IO/ReadSTL", "ReadPLOT3D": "https://examples.vtk.org/site/Python/IO/ReadPLOT3D", "ReadDICOMSeries": "https://examples.vtk.org/site/Python/IO/ReadDICOMSeries", "TransientHDFReader": "https://examples.vtk.org/site/Python/IO/TransientHDFReader", "ReadImageData": "https://examples.vtk.org/site/Python/IO/ReadImageData", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "ReadDICOM": "https://examples.vtk.org/site/Python/IO/ReadDICOM", "WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "HDRReader": "https://examples.vtk.org/site/Python/IO/HDRReader", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "3DSImporter": "https://examples.vtk.org/site/Python/IO/3DSImporter", "WritePLY": "https://examples.vtk.org/site/Python/IO/WritePLY", "UGrid": "https://examples.vtk.org/site/Python/UnstructuredGrid/UGrid", "ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane", "ClipUnstructuredGridWithPlane2": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane2", "SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "ColorAnActor": "https://examples.vtk.org/site/Python/Visualization/ColorAnActor", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable", "MultipleViewports": "https://examples.vtk.org/site/Python/Visualization/MultipleViewports", "BillboardTextActor3D": "https://examples.vtk.org/site/Python/Visualization/BillboardTextActor3D", "FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "Camera": "https://examples.vtk.org/site/Python/Visualization/Camera", "HardwareSelector": "https://examples.vtk.org/site/Python/Visualization/HardwareSelector", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "Blow": "https://examples.vtk.org/site/Python/Visualization/Blow", "WindowTitle": "https://examples.vtk.org/site/Python/Visualization/WindowTitle", "DisplayCoordinateAxes": "https://examples.vtk.org/site/Python/Visualization/DisplayCoordinateAxes", "OrientedGlyphs": "https://examples.vtk.org/site/Python/Visualization/OrientedGlyphs", "Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "KochSnowflake": "https://examples.vtk.org/site/Python/Visualization/KochSnowflake", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "FroggieSurface": "https://examples.vtk.org/site/Python/Visualization/FroggieSurface", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "PointSize": "https://examples.vtk.org/site/Python/Visualization/PointSize", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "MultipleRenderWindows": "https://examples.vtk.org/site/Python/Visualization/MultipleRenderWindows", "DisplayQuadricSurfaces": "https://examples.vtk.org/site/Python/Visualization/DisplayQuadricSurfaces", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "CubeAxesActor": "https://examples.vtk.org/site/Python/Visualization/CubeAxesActor", "CreateColorSeriesDemo": "https://examples.vtk.org/site/Python/Visualization/CreateColorSeriesDemo", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "NormalsDemo": "https://examples.vtk.org/site/Python/Visualization/NormalsDemo", "ProgrammableGlyphFilter": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphFilter", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "ProgrammableGlyphs": "https://examples.vtk.org/site/Python/Visualization/ProgrammableGlyphs", "ComplexV": "https://examples.vtk.org/site/Python/Visualization/ComplexV", "AnnotatedCubeActor": "https://examples.vtk.org/site/Python/Visualization/AnnotatedCubeActor", "Hawaii": "https://examples.vtk.org/site/Python/Visualization/Hawaii", "BlobbyLogo": "https://examples.vtk.org/site/Python/Visualization/BlobbyLogo", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Python/Visualization/ColoredAnnotatedCube", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "QuadricVisualization": "https://examples.vtk.org/site/Python/Visualization/QuadricVisualization", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "NamedColors": "https://examples.vtk.org/site/Python/Visualization/NamedColors", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "CylinderExample": "https://examples.vtk.org/site/Python/GeometricObjects/CylinderExample", "PolyLine": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "OrientedArrow": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedArrow", "Pyramid": "https://examples.vtk.org/site/Python/GeometricObjects/Pyramid", "Disk": "https://examples.vtk.org/site/Python/GeometricObjects/Disk", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "Plane": "https://examples.vtk.org/site/Python/GeometricObjects/Plane", "Cylinder": "https://examples.vtk.org/site/Python/GeometricObjects/Cylinder", "Axes": "https://examples.vtk.org/site/Python/GeometricObjects/Axes", "Point": "https://examples.vtk.org/site/Python/GeometricObjects/Point", "LongLine": "https://examples.vtk.org/site/Python/GeometricObjects/LongLine", "Planes": "https://examples.vtk.org/site/Python/GeometricObjects/Planes", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "Triangle": "https://examples.vtk.org/site/Python/GeometricObjects/Triangle", "Tetrahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Tetrahedron", "TriangleStrip": "https://examples.vtk.org/site/Python/GeometricObjects/TriangleStrip", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo", "Frustum": "https://examples.vtk.org/site/Python/GeometricObjects/Frustum", "PolyLine1": "https://examples.vtk.org/site/Python/GeometricObjects/PolyLine1", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Python/GeometricObjects/PlatonicSolids", "Quad": "https://examples.vtk.org/site/Python/GeometricObjects/Quad", "TextActor": "https://examples.vtk.org/site/Python/GeometricObjects/TextActor", "EllipticalCylinderDemo": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinderDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "RegularPolygonSource": "https://examples.vtk.org/site/Python/GeometricObjects/RegularPolygonSource", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "Line": "https://examples.vtk.org/site/Python/GeometricObjects/Line", "Cone": "https://examples.vtk.org/site/Python/GeometricObjects/Cone", "EarthSource": "https://examples.vtk.org/site/Python/GeometricObjects/EarthSource", "ConvexPointSet": "https://examples.vtk.org/site/Python/GeometricObjects/ConvexPointSet", "ColoredLines": "https://examples.vtk.org/site/Python/GeometricObjects/ColoredLines", "OrientedCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/OrientedCylinder", "Polyhedron": "https://examples.vtk.org/site/Python/GeometricObjects/Polyhedron", "Arrow": "https://examples.vtk.org/site/Python/GeometricObjects/Arrow", "Cube": "https://examples.vtk.org/site/Python/GeometricObjects/Cube", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "Circle": "https://examples.vtk.org/site/Python/GeometricObjects/Circle", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "Sphere": "https://examples.vtk.org/site/Python/GeometricObjects/Sphere", "EllipticalCylinder": "https://examples.vtk.org/site/Python/GeometricObjects/EllipticalCylinder", "Hexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Hexahedron", "Cube1": "https://examples.vtk.org/site/Python/GeometricObjects/Cube1", "GeometricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/GeometricObjectsDemo", "Vertex": "https://examples.vtk.org/site/Python/GeometricObjects/Vertex", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "Dodecahedron": "https://examples.vtk.org/site/Python/GeometricObjects/Dodecahedron", "Polygon": "https://examples.vtk.org/site/Python/GeometricObjects/Polygon", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "LineOnMesh": "https://examples.vtk.org/site/Python/DataManipulation/LineOnMesh", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid", "MouseEventsObserver": "https://examples.vtk.org/site/Python/Interaction/MouseEventsObserver", "MouseEvents": "https://examples.vtk.org/site/Python/Interaction/MouseEvents", "InteractorStyleTrackballActor": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballActor", "CallBack": "https://examples.vtk.org/site/Python/Interaction/CallBack", "InteractorStyleTrackballCamera": "https://examples.vtk.org/site/Python/Interaction/InteractorStyleTrackballCamera", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "ContourTriangulator": "https://examples.vtk.org/site/Python/Modelling/ContourTriangulator", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/SmoothDiscreteMarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring", "DelaunayMesh": "https://examples.vtk.org/site/Python/Modelling/DelaunayMesh", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "Finance": "https://examples.vtk.org/site/Python/Modelling/Finance", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid", "RectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RectilinearGrid", "RGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/RGrid", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "GenerateCubesFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateCubesFromLabels", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "Model": "https://examples.vtk.org/site/Python/Rendering/Model", "FlatVersusGouraud": "https://examples.vtk.org/site/Python/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "AmbientSpheres": "https://examples.vtk.org/site/Python/Rendering/AmbientSpheres", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "StripFran": "https://examples.vtk.org/site/Python/Rendering/StripFran", "TransformSphere": "https://examples.vtk.org/site/Python/Rendering/TransformSphere", "TransparentBackground": "https://examples.vtk.org/site/Python/Rendering/TransparentBackground", "CameraBlur": "https://examples.vtk.org/site/Python/Rendering/CameraBlur", "Rotations": "https://examples.vtk.org/site/Python/Rendering/Rotations", "ColoredSphere": "https://examples.vtk.org/site/Python/Rendering/ColoredSphere", "Mace": "https://examples.vtk.org/site/Python/Rendering/Mace", "Cone3": "https://examples.vtk.org/site/Python/Rendering/Cone3", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground", "SpecularSpheres": "https://examples.vtk.org/site/Python/Rendering/SpecularSpheres", "MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "Cone4": "https://examples.vtk.org/site/Python/Rendering/Cone4", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint", "DiffuseSpheres": "https://examples.vtk.org/site/Python/Rendering/DiffuseSpheres", "LayeredActors": "https://examples.vtk.org/site/Python/Rendering/LayeredActors", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator", "BoundaryEdges": "https://examples.vtk.org/site/Python/Meshes/BoundaryEdges", "ClipDataSetWithPolyData1": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData1", "DeformPointSet": "https://examples.vtk.org/site/Python/Meshes/DeformPointSet", "CapClip": "https://examples.vtk.org/site/Python/Meshes/CapClip", "Decimation": "https://examples.vtk.org/site/Python/Meshes/Decimation", "SolidClip": "https://examples.vtk.org/site/Python/Meshes/SolidClip", "ClipDataSetWithPolyData": "https://examples.vtk.org/site/Python/Meshes/ClipDataSetWithPolyData", "ColoredElevationMap": "https://examples.vtk.org/site/Python/Meshes/ColoredElevationMap"}, "PythonicAPI": {"CylinderExample": "https://examples.vtk.org/site/PythonicAPI/GeometricObjects/CylinderExample"}}, "vtkReverseSense": {"Cxx": {"ReverseSense": "https://examples.vtk.org/site/Cxx/PolyData/ReverseSense", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs"}, "VTKLink": {"vtkReverseSense": "https://www.vtk.org/doc/nightly/html/classvtkReverseSense.html#details"}, "Python": {"ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkRibbonFilter": {"Cxx": {"RibbonFilter": "https://examples.vtk.org/site/Cxx/PolyData/RibbonFilter", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget"}, "VTKLink": {"vtkRibbonFilter": "https://www.vtk.org/doc/nightly/html/classvtkRibbonFilter.html#details"}, "Java": {"RibbonFilter": "https://examples.vtk.org/site/Java/PolyData/RibbonFilter"}, "Python": {"Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget"}}, "vtkRIBExporter": {"Cxx": {"PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB"}, "VTKLink": {"vtkRIBExporter": "https://www.vtk.org/doc/nightly/html/classvtkRIBExporter.html#details"}}, "vtkRIBProperty": {"Cxx": {"PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB"}, "VTKLink": {"vtkRIBProperty": "https://www.vtk.org/doc/nightly/html/classvtkRIBProperty.html#details"}}, "vtkRotationalExtrusionFilter": {"Cxx": {"CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "CappedSphere": "https://examples.vtk.org/site/Cxx/Modelling/CappedSphere", "Bottle": "https://examples.vtk.org/site/Cxx/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Cxx/Modelling/Spring"}, "VTKLink": {"vtkRotationalExtrusionFilter": "https://www.vtk.org/doc/nightly/html/classvtkRotationalExtrusionFilter.html#details"}, "Java": {"Bottle": "https://examples.vtk.org/site/Java/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Java/Modelling/Spring"}, "Python": {"CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "CappedSphere": "https://examples.vtk.org/site/Python/Modelling/CappedSphere", "Bottle": "https://examples.vtk.org/site/Python/Modelling/Bottle", "Spring": "https://examples.vtk.org/site/Python/Modelling/Spring"}}, "vtkRTAnalyticSource": {"Cxx": {"ImplicitDataSet": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitDataSet", "RTAnalyticSource": "https://examples.vtk.org/site/Cxx/Images/RTAnalyticSource"}, "VTKLink": {"vtkRTAnalyticSource": "https://www.vtk.org/doc/nightly/html/classvtkRTAnalyticSource.html#details"}, "Java": {"ImplicitDataSet": "https://examples.vtk.org/site/Java/ImplicitFunctions/ImplicitDataSet", "RTAnalyticSource": "https://examples.vtk.org/site/Java/Images/RTAnalyticSource"}, "Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction", "ParallelCoordinatesView": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesView", "ClampGlyphSizes": "https://examples.vtk.org/site/Python/Visualization/ClampGlyphSizes", "GlyphTable": "https://examples.vtk.org/site/Python/Visualization/GlyphTable"}}, "vtkRuledSurfaceFilter": {"Cxx": {"RuledSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/RuledSurfaceFilter", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine"}, "VTKLink": {"vtkRuledSurfaceFilter": "https://www.vtk.org/doc/nightly/html/classvtkRuledSurfaceFilter.html#details"}, "Java": {"RuledSurfaceFilter": "https://examples.vtk.org/site/Java/PolyData/RuledSurfaceFilter"}, "Python": {"RuledSurfaceFilter": "https://examples.vtk.org/site/Python/PolyData/RuledSurfaceFilter"}}, "vtkRungeKutta4": {"Cxx": {"OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget"}, "VTKLink": {"vtkRungeKutta4": "https://www.vtk.org/doc/nightly/html/classvtkRungeKutta4.html#details"}, "Python": {"OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget"}}, "vtkSampleImplicitFunctionFilter": {"Cxx": {"MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter"}, "VTKLink": {"vtkSampleImplicitFunctionFilter": "https://www.vtk.org/doc/nightly/html/classvtkSampleImplicitFunctionFilter.html#details"}}, "vtkScalarBarActor": {"Cxx": {"DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "ScalarBarActor": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActor", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Cxx/Visualization/ScalarBarActorColorSeries", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance"}, "VTKLink": {"vtkScalarBarActor": "https://www.vtk.org/doc/nightly/html/classvtkScalarBarActor.html#details"}, "Java": {"ScalarBarActor": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActor", "ScalarBarActorColorSeries": "https://examples.vtk.org/site/Java/Visualization/ScalarBarActorColorSeries"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget", "RescaleReverseLUT": "https://examples.vtk.org/site/Python/Utilities/RescaleReverseLUT", "CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "CSVReadEdit": "https://examples.vtk.org/site/Python/IO/CSVReadEdit", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkScalarBarWidget": {"Cxx": {"ScalarBarWidget": "https://examples.vtk.org/site/Cxx/Widgets/ScalarBarWidget"}, "VTKLink": {"vtkScalarBarWidget": "https://www.vtk.org/doc/nightly/html/classvtkScalarBarWidget.html#details"}, "Python": {"ScalarBarWidget": "https://examples.vtk.org/site/Python/Widgets/ScalarBarWidget"}}, "vtkScalarsToColors": {"Cxx": {"ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene"}, "VTKLink": {"vtkScalarsToColors": "https://www.vtk.org/doc/nightly/html/classvtkScalarsToColors.html#details"}}, "vtkSCurveSpline": {"Cxx": {"SCurveSpline": "https://examples.vtk.org/site/Cxx/InfoVis/SCurveSpline"}, "VTKLink": {"vtkSCurveSpline": "https://www.vtk.org/doc/nightly/html/classvtkSCurveSpline.html#details"}}, "vtkSeedRepresentation": {"Cxx": {"SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget"}, "VTKLink": {"vtkSeedRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkSeedRepresentation.html#details"}, "Java": {"SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget"}}, "vtkSeedWidget": {"Cxx": {"SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "SeedWidgetWithCustomCallback": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetWithCustomCallback", "SeedWidget": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidget"}, "VTKLink": {"vtkSeedWidget": "https://www.vtk.org/doc/nightly/html/classvtkSeedWidget.html#details"}, "Java": {"SeedWidget": "https://examples.vtk.org/site/Java/Widgets/SeedWidget"}}, "vtkSelectEnclosedPoints": {"Cxx": {"PointInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "Game": "https://examples.vtk.org/site/Cxx/Interaction/Game"}, "VTKLink": {"vtkSelectEnclosedPoints": "https://www.vtk.org/doc/nightly/html/classvtkSelectEnclosedPoints.html#details"}, "Python": {"CellsInsideObject": "https://examples.vtk.org/site/Python/PolyData/CellsInsideObject"}}, "vtkSelectionSource": {"Cxx": {"SelectionSource": "https://examples.vtk.org/site/Cxx/Filtering/SelectionSource"}, "VTKLink": {"vtkSelectionSource": "https://www.vtk.org/doc/nightly/html/classvtkSelectionSource.html#details"}}, "vtkSelectVisiblePoints": {"Cxx": {"SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh"}, "VTKLink": {"vtkSelectVisiblePoints": "https://www.vtk.org/doc/nightly/html/classvtkSelectVisiblePoints.html#details"}}, "vtkSequencePass": {"Cxx": {"RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows"}, "VTKLink": {"vtkSequencePass": "https://www.vtk.org/doc/nightly/html/classvtkSequencePass.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows"}}, "vtkShader": {"Cxx": {"MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal"}, "VTKLink": {"vtkShader": "https://www.vtk.org/doc/nightly/html/classvtkShader.html#details"}}, "vtkShaderProgram": {"Cxx": {"MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader"}, "VTKLink": {"vtkShaderProgram": "https://www.vtk.org/doc/nightly/html/classvtkShaderProgram.html#details"}}, "vtkShaderProperty": {"Cxx": {"MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal"}, "VTKLink": {"vtkShaderProperty": "https://www.vtk.org/doc/nightly/html/classvtkShaderProperty.html#details"}}, "vtkShadowMapBakerPass": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows"}, "VTKLink": {"vtkShadowMapBakerPass": "https://www.vtk.org/doc/nightly/html/classvtkShadowMapBakerPass.html#details"}}, "vtkShadowMapPass": {"Cxx": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Cxx/Visualization/ShadowsLightsDemo", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows"}, "VTKLink": {"vtkShadowMapPass": "https://www.vtk.org/doc/nightly/html/classvtkShadowMapPass.html#details"}, "Python": {"ShadowsLightsDemo": "https://examples.vtk.org/site/Python/Visualization/ShadowsLightsDemo", "Shadows": "https://examples.vtk.org/site/Python/Rendering/Shadows"}}, "vtkShepardMethod": {"Cxx": {"ShepardMethod": "https://examples.vtk.org/site/Cxx/Utilities/ShepardMethod", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "BackgroundTexture": "https://examples.vtk.org/site/Cxx/Visualization/BackgroundTexture"}, "VTKLink": {"vtkShepardMethod": "https://www.vtk.org/doc/nightly/html/classvtkShepardMethod.html#details"}}, "vtkShortArray": {"Cxx": {"Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz"}, "VTKLink": {"vtkShortArray": "https://www.vtk.org/doc/nightly/html/classvtkShortArray.html#details"}, "Python": {"Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz"}}, "vtkShrinkFilter": {"Cxx": {"IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "VisualizeStructuredGridCells": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGridCells", "FindCellIntersections": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FindCellIntersections", "ExtractData": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExtractData", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "LoopShrink": "https://examples.vtk.org/site/Cxx/Visualization/LoopShrink", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "ShrinkCube": "https://examples.vtk.org/site/Cxx/GeometricObjects/ShrinkCube", "OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Cxx/RectilinearGrid/VisualizeRectilinearGrid"}, "VTKLink": {"vtkShrinkFilter": "https://www.vtk.org/doc/nightly/html/classvtkShrinkFilter.html#details"}, "Java": {"HyperTreeGridSource": "https://examples.vtk.org/site/Java/HyperTreeGrid/HyperTreeGridSource", "LoopShrink": "https://examples.vtk.org/site/Java/Visualization/LoopShrink", "Frustum": "https://examples.vtk.org/site/Java/GeometricObjects/Frustum", "ShrinkCube": "https://examples.vtk.org/site/Java/GeometricObjects/ShrinkCube", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Java/RectilinearGrid/VisualizeRectilinearGrid"}, "Python": {"HyperTreeGridSource": "https://examples.vtk.org/site/Python/HyperTreeGrid/HyperTreeGridSource", "ExtractData": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExtractData", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "LoopShrink": "https://examples.vtk.org/site/Python/Visualization/LoopShrink", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "ShrinkCube": "https://examples.vtk.org/site/Python/GeometricObjects/ShrinkCube", "TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource", "VisualizeRectilinearGrid": "https://examples.vtk.org/site/Python/RectilinearGrid/VisualizeRectilinearGrid"}}, "vtkSignedDistance": {"Cxx": {"SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface"}, "VTKLink": {"vtkSignedDistance": "https://www.vtk.org/doc/nightly/html/classvtkSignedDistance.html#details"}}, "vtkSimple2DLayoutStrategy": {"Cxx": {"XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "VisualizeGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeGraph", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/VisualizeDirectedGraph"}, "VTKLink": {"vtkSimple2DLayoutStrategy": "https://www.vtk.org/doc/nightly/html/classvtkSimple2DLayoutStrategy.html#details"}, "Java": {"VisualizeGraph": "https://examples.vtk.org/site/Java/Graphs/VisualizeGraph"}, "Python": {"SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "VisualizeDirectedGraph": "https://examples.vtk.org/site/Python/Graphs/VisualizeDirectedGraph"}}, "vtkSimpleMotionBlurPass": {"Cxx": {"MotionBlur": "https://examples.vtk.org/site/Cxx/Rendering/MotionBlur"}, "VTKLink": {"vtkSimpleMotionBlurPass": "https://www.vtk.org/doc/nightly/html/classvtkSimpleMotionBlurPass.html#details"}, "Python": {"MotionBlur": "https://examples.vtk.org/site/Python/Rendering/MotionBlur"}}, "vtkSimplePointsWriter": {"Cxx": {"SimplePointsWriter": "https://examples.vtk.org/site/Cxx/IO/SimplePointsWriter"}, "VTKLink": {"vtkSimplePointsWriter": "https://www.vtk.org/doc/nightly/html/classvtkSimplePointsWriter.html#details"}, "Java": {"SimplePointsWriter": "https://examples.vtk.org/site/Java/IO/SimplePointsWriter"}}, "vtkSkybox": {"Cxx": {"SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint"}, "VTKLink": {"vtkSkybox": "https://www.vtk.org/doc/nightly/html/classvtkSkybox.html#details"}, "Python": {"PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint"}}, "vtkSLCReader": {"Cxx": {"IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "ReadSLC": "https://examples.vtk.org/site/Cxx/IO/ReadSLC"}, "VTKLink": {"vtkSLCReader": "https://www.vtk.org/doc/nightly/html/classvtkSLCReader.html#details"}, "Java": {"ReadSLC": "https://examples.vtk.org/site/Java/IO/ReadSLC"}, "Python": {"ReadSLC": "https://examples.vtk.org/site/Python/IO/ReadSLC"}}, "vtkSliderRepresentation": {"Cxx": {"PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree"}, "VTKLink": {"vtkSliderRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkSliderRepresentation.html#details"}, "Java": {"VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree"}}, "vtkSliderRepresentation2D": {"Cxx": {"KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkSliderRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkSliderRepresentation2D.html#details"}, "Java": {"VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree"}, "Python": {"FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkSliderRepresentation3D": {"Cxx": {"IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider"}, "VTKLink": {"vtkSliderRepresentation3D": "https://www.vtk.org/doc/nightly/html/classvtkSliderRepresentation3D.html#details"}}, "vtkSliderWidget": {"Cxx": {"KochanekSplineDemo": "https://examples.vtk.org/site/Cxx/PolyData/KochanekSplineDemo", "PointLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/PointLocatorVisualization", "CellLocatorVisualization": "https://examples.vtk.org/site/Cxx/PolyData/CellLocatorVisualization", "IsoContours": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/IsoContours", "Slider": "https://examples.vtk.org/site/Cxx/Widgets/Slider", "Slider2D": "https://examples.vtk.org/site/Cxx/Widgets/Slider2D", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperToroidDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricKuenDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "OctreeVisualize": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeVisualize", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkSliderWidget": "https://www.vtk.org/doc/nightly/html/classvtkSliderWidget.html#details"}, "Java": {"VisualizeKDTree": "https://examples.vtk.org/site/Java/DataStructures/VisualizeKDTree"}, "Python": {"FroggieView": "https://examples.vtk.org/site/Python/Visualization/FroggieView", "QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "ParametricSuperToroidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperToroidDemo", "ParametricSuperEllipsoidDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricSuperEllipsoidDemo", "ParametricKuenDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricKuenDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkSmartPointer": {"Cxx": {"CombineImportedActors": "https://examples.vtk.org/site/Cxx/PolyData/CombineImportedActors", "ImplicitModeller": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitModeller", "BooleanOperationPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/BooleanOperationPolyDataFilter", "VertexConnectivity": "https://examples.vtk.org/site/Cxx/PolyData/VertexConnectivity", "CellsInsideObject": "https://examples.vtk.org/site/Cxx/PolyData/CellsInsideObject", "DataSetSurfaceFilter": "https://examples.vtk.org/site/Cxx/PolyData/DataSetSurfaceFilter", "DistancePolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/DistancePolyDataFilter", "PolygonalSurfacePointPlacer": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfacePointPlacer", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "ColorDisconnectedRegionsDemo": "https://examples.vtk.org/site/Cxx/PolyData/ColorDisconnectedRegionsDemo", "CellCentersDemo": "https://examples.vtk.org/site/Cxx/PolyData/CellCentersDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "WarpSurface": "https://examples.vtk.org/site/Cxx/PolyData/WarpSurface", "SelectVisiblePoints": "https://examples.vtk.org/site/Cxx/PolyData/SelectVisiblePoints", "FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "GeometryFilter": "https://examples.vtk.org/site/Cxx/PolyData/GeometryFilter", "DataBounds": "https://examples.vtk.org/site/Cxx/PolyData/DataBounds", "OrientedBoundingCylinder": "https://examples.vtk.org/site/Cxx/PolyData/OrientedBoundingCylinder", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "LoopBooleanPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/LoopBooleanPolyDataFilter", "ExtractOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/ExtractOutsideSurface", "ClosedSurface": "https://examples.vtk.org/site/Cxx/PolyData/ClosedSurface", "PolygonalSurfaceContourLineInterpolator": "https://examples.vtk.org/site/Cxx/PolyData/PolygonalSurfaceContourLineInterpolator", "ShrinkPolyData": "https://examples.vtk.org/site/Cxx/PolyData/ShrinkPolyData", "RemoveOutsideSurface": "https://examples.vtk.org/site/Cxx/PolyData/RemoveOutsideSurface", "DeletePoint": "https://examples.vtk.org/site/Cxx/PolyData/DeletePoint", "Silhouette": "https://examples.vtk.org/site/Cxx/PolyData/Silhouette", "PolyDataPointSampler": "https://examples.vtk.org/site/Cxx/PolyData/PolyDataPointSampler", "ClipVolume": "https://examples.vtk.org/site/Cxx/ImageData/ClipVolume", "MedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MedianComparison", "MorphologyComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/MorphologyComparison", "Attenuation": "https://examples.vtk.org/site/Cxx/ImageProcessing/Attenuation", "IdealHighPass": "https://examples.vtk.org/site/Cxx/ImageProcessing/IdealHighPass", "Pad": "https://examples.vtk.org/site/Cxx/ImageProcessing/Pad", "VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "IsoSubsample": "https://examples.vtk.org/site/Cxx/ImageProcessing/IsoSubsample", "EnhanceEdges": "https://examples.vtk.org/site/Cxx/ImageProcessing/EnhanceEdges", "GaussianSmooth": "https://examples.vtk.org/site/Cxx/ImageProcessing/GaussianSmooth", "HybridMedianComparison": "https://examples.vtk.org/site/Cxx/ImageProcessing/HybridMedianComparison", "ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "WordCloud": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloud", "WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo", "ImplicitSphere1": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/ImplicitSphere1", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "Warnings": "https://examples.vtk.org/site/Cxx/Developers/Warnings", "FilterProgress": "https://examples.vtk.org/site/Cxx/Developers/FilterProgress", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "PolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/PolyDataFilter", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "PolyDataAlgorithmReader": "https://examples.vtk.org/site/Cxx/Developers/PolyDataAlgorithmReader", "ImageRange3D": "https://examples.vtk.org/site/Cxx/Images/ImageRange3D", "CombineImages": "https://examples.vtk.org/site/Cxx/Images/CombineImages", "ImageHistogram": "https://examples.vtk.org/site/Cxx/Images/ImageHistogram", "ImageAnisotropicDiffusion2D": "https://examples.vtk.org/site/Cxx/Images/ImageAnisotropicDiffusion2D", "RGBToHSV": "https://examples.vtk.org/site/Cxx/Images/RGBToHSV", "ImageCheckerboard": "https://examples.vtk.org/site/Cxx/Images/ImageCheckerboard", "ImageAccumulate": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulate", "ImageRotate": "https://examples.vtk.org/site/Cxx/Images/ImageRotate", "ImageCityBlockDistance": "https://examples.vtk.org/site/Cxx/Images/ImageCityBlockDistance", "InteractWithImage": "https://examples.vtk.org/site/Cxx/Images/InteractWithImage", "BackgroundImage": "https://examples.vtk.org/site/Cxx/Images/BackgroundImage", "Transparency": "https://examples.vtk.org/site/Cxx/Images/Transparency", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "ImageLuminance": "https://examples.vtk.org/site/Cxx/Images/ImageLuminance", "ResizeImageDemo": "https://examples.vtk.org/site/Cxx/Images/ResizeImageDemo", "Gradient": "https://examples.vtk.org/site/Cxx/Images/Gradient", "CenterAnImage": "https://examples.vtk.org/site/Cxx/Images/CenterAnImage", "RGBToHSI": "https://examples.vtk.org/site/Cxx/Images/RGBToHSI", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "Colored2DImageFusion": "https://examples.vtk.org/site/Cxx/Images/Colored2DImageFusion", "ExtractComponents": "https://examples.vtk.org/site/Cxx/Images/ExtractComponents", "ImageAccumulateGreyscale": "https://examples.vtk.org/site/Cxx/Images/ImageAccumulateGreyscale", "RGBToYIQ": "https://examples.vtk.org/site/Cxx/Images/RGBToYIQ", "DrawOnAnImage": "https://examples.vtk.org/site/Cxx/Images/DrawOnAnImage", "StaticImage": "https://examples.vtk.org/site/Cxx/Images/StaticImage", "ResizeImage": "https://examples.vtk.org/site/Cxx/Images/ResizeImage", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget", "BoxWidget2": "https://examples.vtk.org/site/Cxx/Widgets/BoxWidget2", "SeedWidgetImage": "https://examples.vtk.org/site/Cxx/Widgets/SeedWidgetImage", "SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "RectilinearWipeWidget": "https://examples.vtk.org/site/Cxx/Widgets/RectilinearWipeWidget", "VisualizeStructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredGrid/VisualizeStructuredGrid", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "RescaleReverseLUT": "https://examples.vtk.org/site/Cxx/Utilities/RescaleReverseLUT", "MassProperties": "https://examples.vtk.org/site/Cxx/Utilities/MassProperties", "DataAnimationSubclass": "https://examples.vtk.org/site/Cxx/Utilities/DataAnimationSubclass", "ExtractArrayComponent": "https://examples.vtk.org/site/Cxx/Utilities/ExtractArrayComponent", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "ShareCamera": "https://examples.vtk.org/site/Cxx/Utilities/ShareCamera", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "ExtractFaces": "https://examples.vtk.org/site/Cxx/Utilities/ExtractFaces", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "CellPicking": "https://examples.vtk.org/site/Cxx/Picking/CellPicking", "AppendFilter": "https://examples.vtk.org/site/Cxx/Filtering/AppendFilter", "SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "IterativeClosestPointsTransform": "https://examples.vtk.org/site/Cxx/Filtering/IterativeClosestPointsTransform", "ContoursFromPolyData": "https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData", "LandmarkTransform": "https://examples.vtk.org/site/Cxx/Filtering/LandmarkTransform", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints", "ConnectivityFilterDemo": "https://examples.vtk.org/site/Cxx/Filtering/ConnectivityFilterDemo", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "FilledContours": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FilledContours", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport", "ReadAllUnstructuredGridTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllUnstructuredGridTypes", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "ReadAllPolyDataTypes": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypes", "ReadAllPolyDataTypesDemo": "https://examples.vtk.org/site/Cxx/IO/ReadAllPolyDataTypesDemo", "WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "FindAllArrayNames": "https://examples.vtk.org/site/Cxx/IO/FindAllArrayNames", "ReadPlainTextTriangles": "https://examples.vtk.org/site/Cxx/IO/ReadPlainTextTriangles", "DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "ImageReader2Factory": "https://examples.vtk.org/site/Cxx/IO/ImageReader2Factory", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "CompareRandomGeneratorsCxx": "https://examples.vtk.org/site/Cxx/Plotting/CompareRandomGeneratorsCxx", "Diagram": "https://examples.vtk.org/site/Cxx/Plotting/Diagram", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "RotateActor": "https://examples.vtk.org/site/Cxx/Visualization/RotateActor", "MoveCamera": "https://examples.vtk.org/site/Cxx/Visualization/MoveCamera", "MultipleViewports": "https://examples.vtk.org/site/Cxx/Visualization/MultipleViewports", "VectorOfActors": "https://examples.vtk.org/site/Cxx/Visualization/VectorOfActors", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "FroggieView": "https://examples.vtk.org/site/Cxx/Visualization/FroggieView", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "Blow": "https://examples.vtk.org/site/Cxx/Visualization/Blow", "KochSnowflake": "https://examples.vtk.org/site/Cxx/Visualization/KochSnowflake", "ShepardInterpolation": "https://examples.vtk.org/site/Cxx/Visualization/ShepardInterpolation", "FroggieSurface": "https://examples.vtk.org/site/Cxx/Visualization/FroggieSurface", "ReverseAccess": "https://examples.vtk.org/site/Cxx/Visualization/ReverseAccess", "LabelContours": "https://examples.vtk.org/site/Cxx/Visualization/LabelContours", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "MultipleRenderWindows": "https://examples.vtk.org/site/Cxx/Visualization/MultipleRenderWindows", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "NormalsDemo": "https://examples.vtk.org/site/Cxx/Visualization/NormalsDemo", "LabeledMesh": "https://examples.vtk.org/site/Cxx/Visualization/LabeledMesh", "LabeledDataMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabeledDataMapper", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "ExtrudePolyDataAlongLine": "https://examples.vtk.org/site/Cxx/Visualization/ExtrudePolyDataAlongLine", "ColoredAnnotatedCube": "https://examples.vtk.org/site/Cxx/Visualization/ColoredAnnotatedCube", "Glyph3DImage": "https://examples.vtk.org/site/Cxx/Visualization/Glyph3DImage", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "PlaneSourceDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlaneSourceDemo", "Planes": "https://examples.vtk.org/site/Cxx/GeometricObjects/Planes", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "Sphere": "https://examples.vtk.org/site/Cxx/GeometricObjects/Sphere", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo", "GeometricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/GeometricObjectsDemo", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra", "Dodecahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/Dodecahedron", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "ImageRegion": "https://examples.vtk.org/site/Cxx/Interaction/ImageRegion", "ObserverMemberFunction": "https://examples.vtk.org/site/Cxx/Interaction/ObserverMemberFunction", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "MoveAVertexUnstructuredGrid": "https://examples.vtk.org/site/Cxx/Interaction/MoveAVertexUnstructuredGrid", "MoveAGlyph": "https://examples.vtk.org/site/Cxx/Interaction/MoveAGlyph", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip", "SelectAVertex": "https://examples.vtk.org/site/Cxx/Interaction/SelectAVertex", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "SmoothDiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/SmoothDiscreteMarchingCubes", "Delaunay3DDemo": "https://examples.vtk.org/site/Cxx/Modelling/Delaunay3DDemo", "Finance": "https://examples.vtk.org/site/Cxx/Modelling/Finance", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "PolyDataRIB": "https://examples.vtk.org/site/Cxx/RenderMan/PolyDataRIB", "ExtractEnclosedPoints": "https://examples.vtk.org/site/Cxx/Points/ExtractEnclosedPoints", "ExtractSurface": "https://examples.vtk.org/site/Cxx/Points/ExtractSurface", "PointOccupancy": "https://examples.vtk.org/site/Cxx/Points/PointOccupancy", "MaskPointsFilter": "https://examples.vtk.org/site/Cxx/Points/MaskPointsFilter", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "PowercrustExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PowercrustExtractSurface", "PoissonExtractSurface": "https://examples.vtk.org/site/Cxx/Points/PoissonExtractSurface", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo", "UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance", "SignedDistance": "https://examples.vtk.org/site/Cxx/Points/SignedDistance", "ExtractSurfaceDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractSurfaceDemo", "DensifyPoints": "https://examples.vtk.org/site/Cxx/Points/DensifyPoints", "RadiusOutlierRemoval": "https://examples.vtk.org/site/Cxx/Points/RadiusOutlierRemoval", "KDTreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeFindPointsWithinRadiusDemo", "StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "VisualizeModifiedBSPTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeModifiedBSPTree", "VisualizeKDTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeKDTree", "OctreeFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeFindPointsWithinRadiusDemo", "DataStructureComparison": "https://examples.vtk.org/site/Cxx/DataStructures/DataStructureComparison", "VisualizeOBBTree": "https://examples.vtk.org/site/Cxx/DataStructures/VisualizeOBBTree", "PointLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/PointLocatorFindPointsWithinRadiusDemo", "FlatVersusGouraud": "https://examples.vtk.org/site/Cxx/Rendering/FlatVersusGouraud", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "Shadows": "https://examples.vtk.org/site/Cxx/Rendering/Shadows", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "RotationsA": "https://examples.vtk.org/site/Cxx/Rendering/RotationsA", "RotationsD": "https://examples.vtk.org/site/Cxx/Rendering/RotationsD", "InterpolateCamera": "https://examples.vtk.org/site/Cxx/Rendering/InterpolateCamera", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "Rotations": "https://examples.vtk.org/site/Cxx/Rendering/Rotations", "RotationsB": "https://examples.vtk.org/site/Cxx/Rendering/RotationsB", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "RotationsC": "https://examples.vtk.org/site/Cxx/Rendering/RotationsC", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "HiddenLineRemoval": "https://examples.vtk.org/site/Cxx/Rendering/HiddenLineRemoval", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "ImageDataToQImage": "https://examples.vtk.org/site/Cxx/Qt/ImageDataToQImage", "MinimalQtVTKApp": "https://examples.vtk.org/site/Cxx/Qt/MinimalQtVTKApp", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2", "OBBDicer": "https://examples.vtk.org/site/Cxx/Meshes/OBBDicer", "QuadricDecimation": "https://examples.vtk.org/site/Cxx/Meshes/QuadricDecimation", "ClipClosedSurface": "https://examples.vtk.org/site/Cxx/Meshes/ClipClosedSurface", "SplitPolyData": "https://examples.vtk.org/site/Cxx/Meshes/SplitPolyData", "Subdivision": "https://examples.vtk.org/site/Cxx/Meshes/Subdivision", "FillHoles": "https://examples.vtk.org/site/Cxx/Meshes/FillHoles", "Decimation": "https://examples.vtk.org/site/Cxx/Meshes/Decimation", "CapClip": "https://examples.vtk.org/site/Cxx/Meshes/CapClip", "QuadricClustering": "https://examples.vtk.org/site/Cxx/Meshes/QuadricClustering", "ClipFrustum": "https://examples.vtk.org/site/Cxx/Meshes/ClipFrustum", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo", "SubdivisionDemo": "https://examples.vtk.org/site/Cxx/Meshes/SubdivisionDemo"}, "VTKLink": {"vtkSmartPointer": "https://www.vtk.org/doc/nightly/html/classvtkSmartPointer.html#details"}}, "vtkSmartVolumeMapper": {"Cxx": {"OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume"}, "VTKLink": {"vtkSmartVolumeMapper": "https://www.vtk.org/doc/nightly/html/classvtkSmartVolumeMapper.html#details"}}, "vtkSmoothPolyDataFilter": {"Cxx": {"SmoothPolyDataFilter": "https://examples.vtk.org/site/Cxx/PolyData/SmoothPolyDataFilter", "ConvexHullShrinkWrap": "https://examples.vtk.org/site/Cxx/PolyData/ConvexHullShrinkWrap", "PointInsideObject2": "https://examples.vtk.org/site/Cxx/PolyData/PointInsideObject2"}, "VTKLink": {"vtkSmoothPolyDataFilter": "https://www.vtk.org/doc/nightly/html/classvtkSmoothPolyDataFilter.html#details"}, "Java": {"ConvexHullShrinkWrap": "https://examples.vtk.org/site/Java/PolyData/ConvexHullShrinkWrap"}}, "vtkSortDataArray": {"Cxx": {"SortDataArray": "https://examples.vtk.org/site/Cxx/Utilities/SortDataArray"}, "VTKLink": {"vtkSortDataArray": "https://www.vtk.org/doc/nightly/html/classvtkSortDataArray.html#details"}}, "vtkSparseArray": {"Cxx": {"SparseArray": "https://examples.vtk.org/site/Cxx/Utilities/SparseArray"}, "VTKLink": {"vtkSparseArray": "https://www.vtk.org/doc/nightly/html/classvtkSparseArray.html#details"}}, "vtkSphereRepresentation": {"Cxx": {"SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2"}, "VTKLink": {"vtkSphereRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkSphereRepresentation.html#details"}}, "vtkSphereWidget": {"Cxx": {"SphereWidgetEvents": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidgetEvents", "SphereWidget": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget"}, "VTKLink": {"vtkSphereWidget": "https://www.vtk.org/doc/nightly/html/classvtkSphereWidget.html#details"}, "Python": {"SphereWidget": "https://examples.vtk.org/site/Python/Widgets/SphereWidget"}}, "vtkSphereWidget2": {"Cxx": {"SphereWidget2": "https://examples.vtk.org/site/Cxx/Widgets/SphereWidget2"}, "VTKLink": {"vtkSphereWidget2": "https://www.vtk.org/doc/nightly/html/classvtkSphereWidget2.html#details"}}, "vtkSpiderPlotActor": {"Cxx": {"SpiderPlot": "https://examples.vtk.org/site/Cxx/Plotting/SpiderPlot"}, "VTKLink": {"vtkSpiderPlotActor": "https://www.vtk.org/doc/nightly/html/classvtkSpiderPlotActor.html#details"}, "Python": {"SpiderPlot": "https://examples.vtk.org/site/Python/Plotting/SpiderPlot"}}, "vtkSplineFilter": {"Cxx": {"FitSplineToCutterOutput": "https://examples.vtk.org/site/Cxx/PolyData/FitSplineToCutterOutput", "ResamplePolyLine": "https://examples.vtk.org/site/Cxx/PolyData/ResamplePolyLine", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation"}, "VTKLink": {"vtkSplineFilter": "https://www.vtk.org/doc/nightly/html/classvtkSplineFilter.html#details"}}, "vtkSplineWidget2": {"Cxx": {"SplineWidget": "https://examples.vtk.org/site/Cxx/Widgets/SplineWidget"}, "VTKLink": {"vtkSplineWidget2": "https://www.vtk.org/doc/nightly/html/classvtkSplineWidget2.html#details"}, "Java": {"SplineWidget": "https://examples.vtk.org/site/Java/Widgets/SplineWidget"}}, "vtkStaticPointLocator": {"Cxx": {"StaticLocatorFindPointsWithinRadiusDemo": "https://examples.vtk.org/site/Cxx/DataStructures/StaticLocatorFindPointsWithinRadiusDemo", "InterpolateFieldDataDemo": "https://examples.vtk.org/site/Cxx/Meshes/InterpolateFieldDataDemo"}, "VTKLink": {"vtkStaticPointLocator": "https://www.vtk.org/doc/nightly/html/classvtkStaticPointLocator.html#details"}}, "vtkStatisticsAlgorithm": {"Cxx": {"PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PCAStatistics": "https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart"}, "VTKLink": {"vtkStatisticsAlgorithm": "https://www.vtk.org/doc/nightly/html/classvtkStatisticsAlgorithm.html#details"}}, "vtkStdString": {"Cxx": {"ImageText": "https://examples.vtk.org/site/Cxx/Images/ImageText", "ArrayWriter": "https://examples.vtk.org/site/Cxx/Utilities/ArrayWriter", "HistogramBarChart": "https://examples.vtk.org/site/Cxx/Plotting/HistogramBarChart", "StringToImageDemo": "https://examples.vtk.org/site/Cxx/Rendering/StringToImageDemo"}, "VTKLink": {"vtkStdString": "https://www.vtk.org/doc/nightly/html/classvtkStdString.html#details"}}, "vtkSTLWriter": {"Cxx": {"WriteSTL": "https://examples.vtk.org/site/Cxx/IO/WriteSTL"}, "VTKLink": {"vtkSTLWriter": "https://www.vtk.org/doc/nightly/html/classvtkSTLWriter.html#details"}, "Java": {"WriteSTL": "https://examples.vtk.org/site/Java/IO/WriteSTL"}, "Python": {"WriteSTL": "https://examples.vtk.org/site/Python/IO/WriteSTL"}}, "vtkStreamingDemandDrivenPipeline": {"Cxx": {"vtkTestFilterSelfProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterSelfProgressFilter", "vtkTestAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmFilter", "vtkTestMultipleInputPortsFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestMultipleInputPortsFilter", "vtkTestGraphAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmSource", "vtkTestGraphAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestGraphAlgorithmFilter", "vtkTestReader": "https://examples.vtk.org/site/Cxx/Developers/vtkTestReader", "vtkImageAlgorithmFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkImageAlgorithmFilter", "vtkTestPolyDataFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestPolyDataFilter", "vtkTestFilterProgressFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestFilterProgressFilter", "vtkTestAlgorithmSource": "https://examples.vtk.org/site/Cxx/Developers/vtkTestAlgorithmSource", "vtkTestProgressReportFilter": "https://examples.vtk.org/site/Cxx/Developers/vtkTestProgressReportFilter", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "ImageClip": "https://examples.vtk.org/site/Cxx/Interaction/ImageClip"}, "VTKLink": {"vtkStreamingDemandDrivenPipeline": "https://www.vtk.org/doc/nightly/html/classvtkStreamingDemandDrivenPipeline.html#details"}}, "vtkStreamTracer": {"Cxx": {"LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlow", "FireFlow": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlow", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "FireFlowDemo": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/FireFlowDemo", "LOxSeeds": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxSeeds", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines"}, "VTKLink": {"vtkStreamTracer": "https://www.vtk.org/doc/nightly/html/classvtkStreamTracer.html#details"}, "Python": {"LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "CarotidFlow": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CarotidFlow", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "LOxSeeds": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxSeeds", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines"}}, "vtkStringArray": {"Cxx": {"ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "SaveSceneToFieldData": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFieldData", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "LabelPlacementMapper": "https://examples.vtk.org/site/Cxx/Visualization/LabelPlacementMapper", "AxisActor": "https://examples.vtk.org/site/Cxx/Visualization/AxisActor"}, "VTKLink": {"vtkStringArray": "https://www.vtk.org/doc/nightly/html/classvtkStringArray.html#details"}, "Python": {"CreateTree": "https://examples.vtk.org/site/Python/Graphs/CreateTree", "Variant": "https://examples.vtk.org/site/Python/Utilities/Variant", "SaveSceneToFieldData": "https://examples.vtk.org/site/Python/Utilities/SaveSceneToFieldData"}}, "vtkStructuredData": {"Cxx": {"IntersectLine": "https://examples.vtk.org/site/Cxx/ImageData/IntersectLine", "CellIdFromGridCoordinates": "https://examples.vtk.org/site/Cxx/ImageData/CellIdFromGridCoordinates", "GetLinearPointId": "https://examples.vtk.org/site/Cxx/StructuredGrid/GetLinearPointId"}, "VTKLink": {"vtkStructuredData": "https://www.vtk.org/doc/nightly/html/classvtkStructuredData.html#details"}}, "vtkStructuredGridOutlineFilter": {"Cxx": {"XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot", "StructuredGridOutline": "https://examples.vtk.org/site/Cxx/StructuredGrid/StructuredGridOutline", "LOx": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOx", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "CutStructuredGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/VelocityProfile", "Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "LOxGrid": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/LOxGrid", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/StreamlinesWithLineWidget", "BluntStreamlines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CombustorIsosurface", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "ProbeCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ProbeCombustor", "ColorIsosurface": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ColorIsosurface", "PseudoVolumeRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/PseudoVolumeRendering", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen", "StreamLines": "https://examples.vtk.org/site/Cxx/Visualization/StreamLines", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Cxx/Rendering/Rainbow"}, "VTKLink": {"vtkStructuredGridOutlineFilter": "https://www.vtk.org/doc/nightly/html/classvtkStructuredGridOutlineFilter.html#details"}, "Java": {"StructuredGridOutline": "https://examples.vtk.org/site/Java/StructuredGrid/StructuredGridOutline"}, "Python": {"LOx": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOx", "CutStructuredGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CutStructuredGrid", "VelocityProfile": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/VelocityProfile", "Office": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Office", "LOxGrid": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/LOxGrid", "StreamlinesWithLineWidget": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/StreamlinesWithLineWidget", "BluntStreamlines": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/BluntStreamlines", "CombustorIsosurface": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/CombustorIsosurface", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "OfficeTube": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/OfficeTube", "ProbeCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ProbeCombustor", "PseudoVolumeRendering": "https://examples.vtk.org/site/Python/VolumeRendering/PseudoVolumeRendering", "Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen", "StreamLines": "https://examples.vtk.org/site/Python/Visualization/StreamLines", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "Rainbow": "https://examples.vtk.org/site/Python/Rendering/Rainbow"}}, "vtkStructuredGridReader": {"Cxx": {"Office": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Office", "OfficeA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeA", "PineRootConnectivityA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PineRootConnectivityA", "OfficeTube": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/OfficeTube", "StructuredGridReader": "https://examples.vtk.org/site/Cxx/IO/StructuredGridReader", "Kitchen": "https://examples.vtk.org/site/Cxx/Visualization/Kitchen"}, "VTKLink": {"vtkStructuredGridReader": "https://www.vtk.org/doc/nightly/html/classvtkStructuredGridReader.html#details"}, "Python": {"Kitchen": "https://examples.vtk.org/site/Python/Visualization/Kitchen"}}, "vtkStructuredPoints": {"Cxx": {"CarotidFlowGlyphs": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/CarotidFlowGlyphs", "Lorenz": "https://examples.vtk.org/site/Cxx/Visualization/Lorenz", "StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Cxx/StructuredPoints/StructuredPointsToUnstructuredGrid", "Vol": "https://examples.vtk.org/site/Cxx/StructuredPoints/Vol"}, "VTKLink": {"vtkStructuredPoints": "https://www.vtk.org/doc/nightly/html/classvtkStructuredPoints.html#details"}, "Java": {"StructuredPointsToUnstructuredGrid": "https://examples.vtk.org/site/Java/StructuredPoints/StructuredPointsToUnstructuredGrid", "Vol": "https://examples.vtk.org/site/Java/StructuredPoints/Vol"}, "Python": {"Lorenz": "https://examples.vtk.org/site/Python/Visualization/Lorenz", "Vol": "https://examples.vtk.org/site/Python/StructuredPoints/Vol"}}, "vtkSubPixelPositionEdgels": {"Cxx": {"CannyEdgeDetector": "https://examples.vtk.org/site/Cxx/Images/CannyEdgeDetector"}, "VTKLink": {"vtkSubPixelPositionEdgels": "https://www.vtk.org/doc/nightly/html/classvtkSubPixelPositionEdgels.html#details"}}, "vtkSuperquadric": {"Cxx": {"SampleFunction": "https://examples.vtk.org/site/Cxx/ImplicitFunctions/SampleFunction", "ExtractPointsDemo": "https://examples.vtk.org/site/Cxx/Points/ExtractPointsDemo"}, "VTKLink": {"vtkSuperquadric": "https://www.vtk.org/doc/nightly/html/classvtkSuperquadric.html#details"}, "Java": {"SampleFunction": "https://examples.vtk.org/site/Java/ImplicitFunctions/SampleFunction"}, "Python": {"SampleFunction": "https://examples.vtk.org/site/Python/ImplicitFunctions/SampleFunction"}}, "vtkSurfaceReconstructionFilter": {"Cxx": {"SurfaceFromUnorganizedPointsWithPostProc": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPointsWithPostProc", "SurfaceFromUnorganizedPoints": "https://examples.vtk.org/site/Cxx/Filtering/SurfaceFromUnorganizedPoints"}, "VTKLink": {"vtkSurfaceReconstructionFilter": "https://www.vtk.org/doc/nightly/html/classvtkSurfaceReconstructionFilter.html#details"}}, "vtkTable": {"Cxx": {"ParallelCoordinatesView": "https://examples.vtk.org/site/Cxx/InfoVis/ParallelCoordinatesView", "PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "DelimitedTextReader": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextReader", "ArrayToTable": "https://examples.vtk.org/site/Cxx/InfoVis/ArrayToTable", "DelimitedTextWriter": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "AdjacencyMatrixToEdgeTable": "https://examples.vtk.org/site/Cxx/Graphs/AdjacencyMatrixToEdgeTable", "PCAStatistics": "https://examples.vtk.org/site/Cxx/Utilities/PCAStatistics", "ConstructTable": "https://examples.vtk.org/site/Cxx/Utilities/ConstructTable", "PCADemo": "https://examples.vtk.org/site/Cxx/Utilities/PCADemo", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ParallelCoordinates": "https://examples.vtk.org/site/Cxx/Plotting/ParallelCoordinates", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "PieChart": "https://examples.vtk.org/site/Cxx/Plotting/PieChart", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "BoxChart": "https://examples.vtk.org/site/Cxx/Plotting/BoxChart", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "StackedBar": "https://examples.vtk.org/site/Cxx/Plotting/StackedBar", "StackedPlot": "https://examples.vtk.org/site/Cxx/Plotting/StackedPlot", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "ScatterPlot": "https://examples.vtk.org/site/Cxx/Plotting/ScatterPlot", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "LinePlot": "https://examples.vtk.org/site/Cxx/Plotting/LinePlot", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkTable": "https://www.vtk.org/doc/nightly/html/classvtkTable.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot", "ScatterPlot": "https://examples.vtk.org/site/Python/Plotting/ScatterPlot", "MultiplePlots": "https://examples.vtk.org/site/Python/Plotting/MultiplePlots"}}, "vtkTableBasedClipDataSet": {"Cxx": {"ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Cxx/UnstructuredGrid/ClipUnstructuredGridWithPlane", "TableBasedClipDataSetWithPolyData": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData", "TableBasedClipDataSetWithPolyData2": "https://examples.vtk.org/site/Cxx/Meshes/TableBasedClipDataSetWithPolyData2"}, "VTKLink": {"vtkTableBasedClipDataSet": "https://www.vtk.org/doc/nightly/html/classvtkTableBasedClipDataSet.html#details"}, "Python": {"ClipUnstructuredGridWithPlane": "https://examples.vtk.org/site/Python/UnstructuredGrid/ClipUnstructuredGridWithPlane"}}, "vtkTableToPolyData": {"Cxx": {"PointInterpolator": "https://examples.vtk.org/site/Cxx/Meshes/PointInterpolator"}, "VTKLink": {"vtkTableToPolyData": "https://www.vtk.org/doc/nightly/html/classvtkTableToPolyData.html#details"}, "Python": {"CSVReadEdit1": "https://examples.vtk.org/site/Python/IO/CSVReadEdit1", "PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}}, "vtkTensorGlyph": {"Cxx": {"TensorEllipsoids": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorEllipsoids", "TensorAxes": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TensorAxes", "TensorGlyph": "https://examples.vtk.org/site/Cxx/Visualization/TensorGlyph"}, "VTKLink": {"vtkTensorGlyph": "https://www.vtk.org/doc/nightly/html/classvtkTensorGlyph.html#details"}, "Python": {"TensorEllipsoids": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorEllipsoids", "TensorAxes": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/TensorAxes"}}, "vtkTessellatedBoxSource": {"Cxx": {"OpenVRTessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/OpenVRTessellatedBoxSource", "TessellatedBoxSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/TessellatedBoxSource"}, "VTKLink": {"vtkTessellatedBoxSource": "https://www.vtk.org/doc/nightly/html/classvtkTessellatedBoxSource.html#details"}, "Python": {"TessellatedBoxSource": "https://examples.vtk.org/site/Python/GeometricObjects/TessellatedBoxSource"}}, "vtkTessellatorFilter": {"Cxx": {"QuadraticTetraDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedron", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Cxx/GeometricObjects/QuadraticTetra"}, "VTKLink": {"vtkTessellatorFilter": "https://www.vtk.org/doc/nightly/html/classvtkTessellatorFilter.html#details"}, "Python": {"QuadraticTetraDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetraDemo", "QuadraticHexahedron": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedron", "QuadraticHexahedronDemo": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticHexahedronDemo", "CellTypeSource": "https://examples.vtk.org/site/Python/GeometricObjects/CellTypeSource", "QuadraticTetra": "https://examples.vtk.org/site/Python/GeometricObjects/QuadraticTetra"}}, "vtkTextActor": {"Cxx": {"CaptionWidget": "https://examples.vtk.org/site/Cxx/Widgets/CaptionWidget", "TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget", "DrawText": "https://examples.vtk.org/site/Cxx/Visualization/DrawText", "CollisionDetection": "https://examples.vtk.org/site/Cxx/Visualization/CollisionDetection", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "Arbitrary3DCursor": "https://examples.vtk.org/site/Cxx/Visualization/Arbitrary3DCursor", "PointDataSubdivision": "https://examples.vtk.org/site/Cxx/Visualization/PointDataSubdivision", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2", "ChooseTextColor": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColor", "ChooseTextColorDemo": "https://examples.vtk.org/site/Cxx/Visualization/ChooseTextColorDemo", "PlatonicSolids": "https://examples.vtk.org/site/Cxx/GeometricObjects/PlatonicSolids", "TextActor": "https://examples.vtk.org/site/Cxx/GeometricObjects/TextActor"}, "VTKLink": {"vtkTextActor": "https://www.vtk.org/doc/nightly/html/classvtkTextActor.html#details"}, "Java": {"TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget", "DrawText": "https://examples.vtk.org/site/Java/Visualization/DrawText", "TextActor": "https://examples.vtk.org/site/Java/GeometricObjects/TextActor"}, "Python": {"TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CollisionDetection": "https://examples.vtk.org/site/Python/Visualization/CollisionDetection", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2", "TextActor": "https://examples.vtk.org/site/Python/GeometricObjects/TextActor"}}, "vtkTextRepresentation": {"Cxx": {"TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget"}, "VTKLink": {"vtkTextRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkTextRepresentation.html#details"}, "Java": {"TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget"}, "Python": {"TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget"}}, "vtkTextSource": {"Cxx": {"TextSource": "https://examples.vtk.org/site/Cxx/Visualization/TextSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/SourceObjectsDemo"}, "VTKLink": {"vtkTextSource": "https://www.vtk.org/doc/nightly/html/classvtkTextSource.html#details"}, "Python": {"TextSource": "https://examples.vtk.org/site/Python/Visualization/TextSource", "SourceObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/SourceObjectsDemo"}}, "vtkTexture": {"Cxx": {"DecimateFran": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DecimateFran", "Motor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Motor", "OBJImporter": "https://examples.vtk.org/site/Cxx/IO/OBJImporter", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane", "ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "TextureMapImageData": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapImageData", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "TextureMapQuad": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapQuad", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "ProjectedTexture": "https://examples.vtk.org/site/Cxx/Texture/ProjectedTexture", "TexturePlane": "https://examples.vtk.org/site/Cxx/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Cxx/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Cxx/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Cxx/Texture/TextureCutSphere", "EllipticalButton": "https://examples.vtk.org/site/Cxx/Interaction/EllipticalButton", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Cxx/Rendering/PBR_HDR_Environment", "StippledLine": "https://examples.vtk.org/site/Cxx/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Edge_Tint"}, "VTKLink": {"vtkTexture": "https://www.vtk.org/doc/nightly/html/classvtkTexture.html#details"}, "Java": {"TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere", "TexturePlane": "https://examples.vtk.org/site/Java/Texture/TexturePlane"}, "Python": {"DecimateFran": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DecimateFran", "Motor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Motor", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice", "SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "TexturePlane": "https://examples.vtk.org/site/Python/Texture/TexturePlane", "AnimateVectors": "https://examples.vtk.org/site/Python/Texture/AnimateVectors", "TextureCutQuadric": "https://examples.vtk.org/site/Python/Texture/TextureCutQuadric", "TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold", "TextureCutSphere": "https://examples.vtk.org/site/Python/Texture/TextureCutSphere", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "PBR_HDR_Environment": "https://examples.vtk.org/site/Python/Rendering/PBR_HDR_Environment", "StippledLine": "https://examples.vtk.org/site/Python/Rendering/StippledLine", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Clear_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Clear_Coat", "PBR_Mapping": "https://examples.vtk.org/site/Python/Rendering/PBR_Mapping", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Edge_Tint": "https://examples.vtk.org/site/Python/Rendering/PBR_Edge_Tint"}}, "vtkTexturedButtonRepresentation2D": {"Cxx": {"TexturedButtonWidget": "https://examples.vtk.org/site/Cxx/Widgets/TexturedButtonWidget"}, "VTKLink": {"vtkTexturedButtonRepresentation2D": "https://www.vtk.org/doc/nightly/html/classvtkTexturedButtonRepresentation2D.html#details"}}, "vtkTexturedSphereSource": {"Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkTexturedSphereSource": "https://www.vtk.org/doc/nightly/html/classvtkTexturedSphereSource.html#details"}, "Java": {"TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere"}, "Python": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkTextureMapToPlane": {"Cxx": {"ClipArt": "https://examples.vtk.org/site/Cxx/Visualization/ClipArt", "TextureMapPlane": "https://examples.vtk.org/site/Cxx/Visualization/TextureMapPlane"}, "VTKLink": {"vtkTextureMapToPlane": "https://www.vtk.org/doc/nightly/html/classvtkTextureMapToPlane.html#details"}}, "vtkTextureMapToSphere": {"Cxx": {"TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere", "PBR_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Anisotropy"}, "VTKLink": {"vtkTextureMapToSphere": "https://www.vtk.org/doc/nightly/html/classvtkTextureMapToSphere.html#details"}, "Python": {"SphereTexture": "https://examples.vtk.org/site/Python/Visualization/SphereTexture", "PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy"}}, "vtkTextWidget": {"Cxx": {"TextWidget": "https://examples.vtk.org/site/Cxx/Widgets/TextWidget"}, "VTKLink": {"vtkTextWidget": "https://www.vtk.org/doc/nightly/html/classvtkTextWidget.html#details"}, "Java": {"TextWidget": "https://examples.vtk.org/site/Java/Widgets/TextWidget"}, "Python": {"TextWidget": "https://examples.vtk.org/site/Python/Widgets/TextWidget"}}, "vtkThinPlateSplineTransform": {"Cxx": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Cxx/PolyData/ThinPlateSplineTransform"}, "VTKLink": {"vtkThinPlateSplineTransform": "https://www.vtk.org/doc/nightly/html/classvtkThinPlateSplineTransform.html#details"}, "Java": {"ThinPlateSplineTransform": "https://examples.vtk.org/site/Java/PolyData/ThinPlateSplineTransform"}}, "vtkThresholdTextureCoords": {"Cxx": {"TextureThreshold": "https://examples.vtk.org/site/Cxx/Texture/TextureThreshold"}, "VTKLink": {"vtkThresholdTextureCoords": "https://www.vtk.org/doc/nightly/html/classvtkThresholdTextureCoords.html#details"}, "Python": {"TextureThreshold": "https://examples.vtk.org/site/Python/Texture/TextureThreshold"}}, "vtkTimerLog": {"Cxx": {"SaveSceneToFile": "https://examples.vtk.org/site/Cxx/Utilities/SaveSceneToFile", "TimerLog": "https://examples.vtk.org/site/Cxx/Utilities/TimerLog", "CorrectlyRenderTranslucentGeometry": "https://examples.vtk.org/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry", "CompareExtractSurface": "https://examples.vtk.org/site/Cxx/Points/CompareExtractSurface", "OBBTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OBBTreeTimingDemo", "ModifiedBSPTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/ModifiedBSPTreeTimingDemo", "OctreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/OctreeTimingDemo", "KDTreeTimingDemo": "https://examples.vtk.org/site/Cxx/DataStructures/KDTreeTimingDemo"}, "VTKLink": {"vtkTimerLog": "https://www.vtk.org/doc/nightly/html/classvtkTimerLog.html#details"}, "Java": {"TimerLog": "https://examples.vtk.org/site/Java/Utilities/TimerLog"}}, "vtkTimeSourceExample": {"Cxx": {"ExodusIIWriter": "https://examples.vtk.org/site/Cxx/Parallel/ExodusIIWriter"}, "VTKLink": {"vtkTimeSourceExample": "https://www.vtk.org/doc/nightly/html/classvtkTimeSourceExample.html#details"}, "Java": {"ExodusIIWriter": "https://examples.vtk.org/site/Java/Parallel/ExodusIIWriter"}}, "vtkTimeStamp": {"Cxx": {"TimeStamp": "https://examples.vtk.org/site/Cxx/Utilities/TimeStamp"}, "VTKLink": {"vtkTimeStamp": "https://www.vtk.org/doc/nightly/html/classvtkTimeStamp.html#details"}}, "vtkToneMappingPass": {"Cxx": {"PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkToneMappingPass": "https://www.vtk.org/doc/nightly/html/classvtkToneMappingPass.html#details"}, "Python": {"PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing"}}, "vtkTransformTextureCoords": {"Cxx": {"TexturedSphere": "https://examples.vtk.org/site/Cxx/Texture/TexturedSphere"}, "VTKLink": {"vtkTransformTextureCoords": "https://www.vtk.org/doc/nightly/html/classvtkTransformTextureCoords.html#details"}, "Java": {"TexturedSphere": "https://examples.vtk.org/site/Java/Texture/TexturedSphere"}}, "vtkTree": {"Cxx": {"TreeBFSIterator": "https://examples.vtk.org/site/Cxx/Graphs/TreeBFSIterator", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "ConstructTree": "https://examples.vtk.org/site/Cxx/Graphs/ConstructTree", "MinimumSpanningTree": "https://examples.vtk.org/site/Cxx/Graphs/MinimumSpanningTree", "BreadthFirstDistance": "https://examples.vtk.org/site/Cxx/Graphs/BreadthFirstDistance", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator", "BoostBreadthFirstSearchTree": "https://examples.vtk.org/site/Cxx/Graphs/BoostBreadthFirstSearchTree", "TreeToMutableDirectedGraph": "https://examples.vtk.org/site/Cxx/Graphs/TreeToMutableDirectedGraph"}, "VTKLink": {"vtkTree": "https://www.vtk.org/doc/nightly/html/classvtkTree.html#details"}, "Python": {"CreateTree": "https://examples.vtk.org/site/Python/Graphs/CreateTree", "ConstructTree": "https://examples.vtk.org/site/Python/Graphs/ConstructTree"}}, "vtkTreeBFSIterator": {"Cxx": {"TreeBFSIterator": "https://examples.vtk.org/site/Cxx/Graphs/TreeBFSIterator"}, "VTKLink": {"vtkTreeBFSIterator": "https://www.vtk.org/doc/nightly/html/classvtkTreeBFSIterator.html#details"}}, "vtkTreeDFSIterator": {"Cxx": {"DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "DepthFirstSearchIterator": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchIterator"}, "VTKLink": {"vtkTreeDFSIterator": "https://www.vtk.org/doc/nightly/html/classvtkTreeDFSIterator.html#details"}}, "vtkTreeMapView": {"Cxx": {"TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView"}, "VTKLink": {"vtkTreeMapView": "https://www.vtk.org/doc/nightly/html/classvtkTreeMapView.html#details"}}, "vtkTriangleMeshPointNormals": {"Cxx": {"MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal"}, "VTKLink": {"vtkTriangleMeshPointNormals": "https://www.vtk.org/doc/nightly/html/classvtkTriangleMeshPointNormals.html#details"}}, "vtkTriQuadraticHexahedron": {"Cxx": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/IsoparametricCellsDemo"}, "VTKLink": {"vtkTriQuadraticHexahedron": "https://www.vtk.org/doc/nightly/html/classvtkTriQuadraticHexahedron.html#details"}, "Python": {"IsoparametricCellsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/IsoparametricCellsDemo"}}, "vtkTupleInterpolator": {"Cxx": {"TubesFromSplines": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/TubesFromSplines", "1DTupleInterpolation": "https://examples.vtk.org/site/Cxx/Math/1DTupleInterpolation"}, "VTKLink": {"vtkTupleInterpolator": "https://www.vtk.org/doc/nightly/html/classvtkTupleInterpolator.html#details"}}, "vtkUniformGrid": {"Cxx": {"OverlappingAMR": "https://examples.vtk.org/site/Cxx/CompositeData/OverlappingAMR", "Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse"}, "VTKLink": {"vtkUniformGrid": "https://www.vtk.org/doc/nightly/html/classvtkUniformGrid.html#details"}, "Python": {"OverlappingAMR": "https://examples.vtk.org/site/Python/CompositeData/OverlappingAMR"}}, "vtkUnsignedDistance": {"Cxx": {"UnsignedDistance": "https://examples.vtk.org/site/Cxx/Points/UnsignedDistance"}, "VTKLink": {"vtkUnsignedDistance": "https://www.vtk.org/doc/nightly/html/classvtkUnsignedDistance.html#details"}}, "vtkUnstructuredGridToExplicitStructuredGrid": {"Cxx": {"CreateESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Cxx/ExplicitStructuredGrid/LoadESGrid"}, "VTKLink": {"vtkUnstructuredGridToExplicitStructuredGrid": "https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGridToExplicitStructuredGrid.html#details"}, "Python": {"CreateESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/CreateESGrid", "LoadESGrid": "https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid"}}, "vtkUnstructuredGridVolumeRayCastMapper": {"Cxx": {"IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid"}, "VTKLink": {"vtkUnstructuredGridVolumeRayCastMapper": "https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGridVolumeRayCastMapper.html#details"}}, "vtkUnstructuredGridWriter": {"Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells"}, "VTKLink": {"vtkUnstructuredGridWriter": "https://www.vtk.org/doc/nightly/html/classvtkUnstructuredGridWriter.html#details"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells"}}, "vtkValuePass": {"Cxx": {"RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer"}, "VTKLink": {"vtkValuePass": "https://www.vtk.org/doc/nightly/html/classvtkValuePass.html#details"}}, "vtkVariant": {"Cxx": {"PKMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/PKMeansClustering", "DelimitedTextWriter": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter", "KMeansClustering": "https://examples.vtk.org/site/Cxx/InfoVis/KMeansClustering", "PickPixel": "https://examples.vtk.org/site/Cxx/Images/PickPixel", "PickPixel2": "https://examples.vtk.org/site/Cxx/Images/PickPixel2", "CustomDenseArray": "https://examples.vtk.org/site/Cxx/Utilities/CustomDenseArray", "LUTUtilities": "https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities", "ConstructTable": "https://examples.vtk.org/site/Cxx/Utilities/ConstructTable", "Variant": "https://examples.vtk.org/site/Cxx/Utilities/Variant", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs"}, "VTKLink": {"vtkVariant": "https://www.vtk.org/doc/nightly/html/classvtkVariant.html#details"}, "Python": {"LUTUtilities": "https://examples.vtk.org/site/Python/Utilities/LUTUtilities", "Variant": "https://examples.vtk.org/site/Python/Utilities/Variant", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkVariantArray": {"Cxx": {"DelimitedTextWriter": "https://examples.vtk.org/site/Cxx/InfoVis/DelimitedTextWriter", "LUTUtilities": "https://examples.vtk.org/site/Cxx/Utilities/LUTUtilities", "ConstructTable": "https://examples.vtk.org/site/Cxx/Utilities/ConstructTable", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Cxx/IO/ReadLegacyUnstructuredGrid", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs"}, "VTKLink": {"vtkVariantArray": "https://www.vtk.org/doc/nightly/html/classvtkVariantArray.html#details"}, "Python": {"LUTUtilities": "https://examples.vtk.org/site/Python/Utilities/LUTUtilities", "Variant": "https://examples.vtk.org/site/Python/Utilities/Variant", "ReadLegacyUnstructuredGrid": "https://examples.vtk.org/site/Python/IO/ReadLegacyUnstructuredGrid", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs"}}, "vtkVector": {"Cxx": {"Vector": "https://examples.vtk.org/site/Cxx/Utilities/Vector", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet"}, "VTKLink": {"vtkVector": "https://www.vtk.org/doc/nightly/html/classvtkVector.html#details"}}, "vtkVector2d": {"Cxx": {"SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkVector2d": "https://www.vtk.org/doc/nightly/html/classvtkVector2d.html#details"}}, "vtkVector2f": {"Cxx": {"ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix"}, "VTKLink": {"vtkVector2f": "https://www.vtk.org/doc/nightly/html/classvtkVector2f.html#details"}}, "vtkVector2i": {"Cxx": {"ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot"}, "VTKLink": {"vtkVector2i": "https://www.vtk.org/doc/nightly/html/classvtkVector2i.html#details"}, "Python": {"SurfacePlot": "https://examples.vtk.org/site/Python/Plotting/SurfacePlot"}}, "vtkVector3d": {"Cxx": {"Vector": "https://examples.vtk.org/site/Cxx/Utilities/Vector", "MultiBlockDataSet": "https://examples.vtk.org/site/Cxx/CompositeData/MultiBlockDataSet", "AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors"}, "VTKLink": {"vtkVector3d": "https://www.vtk.org/doc/nightly/html/classvtkVector3d.html#details"}}, "vtkVectorDot": {"Cxx": {"DisplacementPlot": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/PlateVibration", "VectorDot": "https://examples.vtk.org/site/Cxx/Math/VectorDot"}, "VTKLink": {"vtkVectorDot": "https://www.vtk.org/doc/nightly/html/classvtkVectorDot.html#details"}, "Python": {"DisplacementPlot": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/DisplacementPlot", "PlateVibration": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/PlateVibration"}}, "vtkVectorNorm": {"Cxx": {"VectorNorm": "https://examples.vtk.org/site/Cxx/Math/VectorNorm"}, "VTKLink": {"vtkVectorNorm": "https://www.vtk.org/doc/nightly/html/classvtkVectorNorm.html#details"}}, "vtkVectorText": {"Cxx": {"LinearExtrusion": "https://examples.vtk.org/site/Cxx/PolyData/LinearExtrusion", "TextOrigin": "https://examples.vtk.org/site/Cxx/Annotation/TextOrigin", "MarkKeypoints": "https://examples.vtk.org/site/Cxx/Images/MarkKeypoints", "MarchingCasesA": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesA", "MarchingCasesC": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesC", "MarchingCasesD": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesD", "MarchingCasesB": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCasesB", "AnatomicalOrientation": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/AnatomicalOrientation", "MarchingCases": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/MarchingCases", "Stocks": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/Stocks", "AlphaFrequency": "https://examples.vtk.org/site/Cxx/Visualization/AlphaFrequency", "Follower": "https://examples.vtk.org/site/Cxx/Visualization/Follower", "Morph3D": "https://examples.vtk.org/site/Cxx/Visualization/Morph3D", "MovableAxes": "https://examples.vtk.org/site/Cxx/Visualization/MovableAxes", "VectorText": "https://examples.vtk.org/site/Cxx/Visualization/VectorText", "FinanceFieldData": "https://examples.vtk.org/site/Cxx/Modelling/FinanceFieldData"}, "VTKLink": {"vtkVectorText": "https://www.vtk.org/doc/nightly/html/classvtkVectorText.html#details"}, "Java": {"TextOrigin": "https://examples.vtk.org/site/Java/Annotation/TextOrigin", "Follower": "https://examples.vtk.org/site/Java/Visualization/Follower"}, "Python": {"TextOrigin": "https://examples.vtk.org/site/Python/Annotation/TextOrigin", "AnatomicalOrientation": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/AnatomicalOrientation", "Stocks": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/Stocks", "MarchingCases": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/MarchingCases", "AlphaFrequency": "https://examples.vtk.org/site/Python/Visualization/AlphaFrequency", "VectorText": "https://examples.vtk.org/site/Python/Visualization/VectorText", "FinanceFieldData": "https://examples.vtk.org/site/Python/Modelling/FinanceFieldData"}}, "vtkVersion": {"Cxx": {"CurvaturesAdjustEdges": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesAdjustEdges", "CurvaturesDemo": "https://examples.vtk.org/site/Cxx/PolyData/CurvaturesDemo", "NullPoint": "https://examples.vtk.org/site/Cxx/PolyData/NullPoint", "Curvatures": "https://examples.vtk.org/site/Cxx/PolyData/Curvatures", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Cxx/PolyData/AlignTwoPolyDatas", "ImplicitDataSetClipping": "https://examples.vtk.org/site/Cxx/PolyData/ImplicitDataSetClipping", "ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "PointCellIds": "https://examples.vtk.org/site/Cxx/PolyData/PointCellIds", "HyperTreeGridSource": "https://examples.vtk.org/site/Cxx/HyperTreeGrid/HyperTreeGridSource", "CheckVTKVersion": "https://examples.vtk.org/site/Cxx/Utilities/CheckVTKVersion", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "HighlightSelectedPoints": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelectedPoints", "HighlightSelection": "https://examples.vtk.org/site/Cxx/Picking/HighlightSelection", "HeadBone": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/HeadBone", "CompositePolyDataMapper": "https://examples.vtk.org/site/Cxx/CompositeData/CompositePolyDataMapper", "ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene", "PlotLine3D": "https://examples.vtk.org/site/Cxx/Plotting/PlotLine3D", "FunctionalBagPlot": "https://examples.vtk.org/site/Cxx/Plotting/FunctionalBagPlot", "ChartsOn3DScene": "https://examples.vtk.org/site/Cxx/Plotting/ChartsOn3DScene", "MultiplePlots": "https://examples.vtk.org/site/Cxx/Plotting/MultiplePlots", "SurfacePlot": "https://examples.vtk.org/site/Cxx/Plotting/SurfacePlot", "ChartMatrix": "https://examples.vtk.org/site/Cxx/Plotting/ChartMatrix", "AreaPlot": "https://examples.vtk.org/site/Cxx/Plotting/AreaPlot", "BarChart": "https://examples.vtk.org/site/Cxx/Plotting/BarChart", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/ElevationBandsWithGlyphs", "FrogBrain": "https://examples.vtk.org/site/Cxx/Visualization/FrogBrain", "IsosurfaceSampling": "https://examples.vtk.org/site/Cxx/Visualization/IsosurfaceSampling", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Cxx/Visualization/CurvatureBandsWithGlyphs", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "MarbleShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShaderDemo", "BozoShaderDemo": "https://examples.vtk.org/site/Cxx/Shaders/BozoShaderDemo", "SphereMap": "https://examples.vtk.org/site/Cxx/Shaders/SphereMap", "CubeMap": "https://examples.vtk.org/site/Cxx/Shaders/CubeMap", "SpatterShader": "https://examples.vtk.org/site/Cxx/Shaders/SpatterShader", "MarbleShader": "https://examples.vtk.org/site/Cxx/Shaders/MarbleShader", "BozoShader": "https://examples.vtk.org/site/Cxx/Shaders/BozoShader", "ColorByNormal": "https://examples.vtk.org/site/Cxx/Shaders/ColorByNormal", "MarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/MarchingCubes", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Cxx/Modelling/ExtractLargestIsosurface", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Cxx/Modelling/DiscreteMarchingCubes", "TissueLens": "https://examples.vtk.org/site/Cxx/Medical/TissueLens", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Cxx/Medical/GenerateModelsFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo3", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Cxx/Rendering/OutlineGlowPass", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt", "SideBySideRenderWindowsQt": "https://examples.vtk.org/site/Cxx/Qt/SideBySideRenderWindowsQt", "RenderWindowNoUiFile": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowNoUiFile", "RenderWindowUISingleInheritance": "https://examples.vtk.org/site/Cxx/Qt/RenderWindowUISingleInheritance", "EventQtSlotConnect": "https://examples.vtk.org/site/Cxx/Qt/EventQtSlotConnect", "ShareCameraQt": "https://examples.vtk.org/site/Cxx/Qt/ShareCameraQt", "BarChartQt": "https://examples.vtk.org/site/Cxx/Qt/BarChartQt"}, "VTKLink": {"vtkVersion": "https://www.vtk.org/doc/nightly/html/classvtkVersion.html#details"}, "Python": {"CurvaturesDemo": "https://examples.vtk.org/site/Python/PolyData/CurvaturesDemo", "AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas", "Curvatures": "https://examples.vtk.org/site/Python/PolyData/Curvatures", "CurvaturesAdjustEdges": "https://examples.vtk.org/site/Python/PolyData/CurvaturesAdjustEdges", "CompassWidget": "https://examples.vtk.org/site/Python/Widgets/CompassWidget", "SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget", "VTKImportsForPython": "https://examples.vtk.org/site/Python/Utilities/VTKImportsForPython", "CheckVTKVersion": "https://examples.vtk.org/site/Python/Utilities/CheckVTKVersion", "HeadBone": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/HeadBone", "ElevationBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/ElevationBandsWithGlyphs", "FrogBrain": "https://examples.vtk.org/site/Python/Visualization/FrogBrain", "IsosurfaceSampling": "https://examples.vtk.org/site/Python/Visualization/IsosurfaceSampling", "AssignCellColorsFromLUT": "https://examples.vtk.org/site/Python/Visualization/AssignCellColorsFromLUT", "PointDataSubdivision": "https://examples.vtk.org/site/Python/Visualization/PointDataSubdivision", "CurvatureBandsWithGlyphs": "https://examples.vtk.org/site/Python/Visualization/CurvatureBandsWithGlyphs", "MeshLabelImageColor": "https://examples.vtk.org/site/Python/DataManipulation/MeshLabelImageColor", "ExtractLargestIsosurface": "https://examples.vtk.org/site/Python/Modelling/ExtractLargestIsosurface", "MarchingCubes": "https://examples.vtk.org/site/Python/Modelling/MarchingCubes", "DiscreteMarchingCubes": "https://examples.vtk.org/site/Python/Modelling/DiscreteMarchingCubes", "TissueLens": "https://examples.vtk.org/site/Python/Medical/TissueLens", "GenerateModelsFromLabels": "https://examples.vtk.org/site/Python/Medical/GenerateModelsFromLabels", "MedicalDemo2": "https://examples.vtk.org/site/Python/Medical/MedicalDemo2", "MedicalDemo1": "https://examples.vtk.org/site/Python/Medical/MedicalDemo1", "MedicalDemo3": "https://examples.vtk.org/site/Python/Medical/MedicalDemo3", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "OutlineGlowPass": "https://examples.vtk.org/site/Python/Rendering/OutlineGlowPass"}}, "vtkViewport": {"Cxx": {"GradientBackground": "https://examples.vtk.org/site/Cxx/Rendering/GradientBackground"}, "VTKLink": {"vtkViewport": "https://www.vtk.org/doc/nightly/html/classvtkViewport.html#details"}, "Python": {"GradientBackground": "https://examples.vtk.org/site/Python/Rendering/GradientBackground"}}, "vtkViewTheme": {"Cxx": {"TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView", "XGMLReader": "https://examples.vtk.org/site/Cxx/InfoVis/XGMLReader", "ColorEdges": "https://examples.vtk.org/site/Cxx/Graphs/ColorEdges", "DepthFirstSearchAnimation": "https://examples.vtk.org/site/Cxx/Graphs/DepthFirstSearchAnimation", "ScaleVertices": "https://examples.vtk.org/site/Cxx/Graphs/ScaleVertices", "CreateTree": "https://examples.vtk.org/site/Cxx/Graphs/CreateTree", "AdjacentVertexIterator": "https://examples.vtk.org/site/Cxx/Graphs/AdjacentVertexIterator", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Cxx/Graphs/ColorVerticesLookupTable"}, "VTKLink": {"vtkViewTheme": "https://www.vtk.org/doc/nightly/html/classvtkViewTheme.html#details"}, "Python": {"SelectedGraphIDs": "https://examples.vtk.org/site/Python/InfoVis/SelectedGraphIDs", "ColorEdges": "https://examples.vtk.org/site/Python/Graphs/ColorEdges", "CreateTree": "https://examples.vtk.org/site/Python/Graphs/CreateTree", "ColorVerticesLookupTable": "https://examples.vtk.org/site/Python/Graphs/ColorVerticesLookupTable", "ScaleVertices": "https://examples.vtk.org/site/Python/Graphs/ScaleVertices"}}, "vtkVolume": {"Cxx": {"IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "VTKLink": {"vtkVolume": "https://www.vtk.org/doc/nightly/html/classvtkVolume.html#details"}, "Java": {"SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkVolumeProperty": {"Cxx": {"IntermixedUnstructuredGrid": "https://examples.vtk.org/site/Cxx/VolumeRendering/IntermixedUnstructuredGrid", "RayCastIsosurface": "https://examples.vtk.org/site/Cxx/VolumeRendering/RayCastIsosurface", "FixedPointVolumeRayCastMapperCT": "https://examples.vtk.org/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT", "MinIntensityRendering": "https://examples.vtk.org/site/Cxx/VolumeRendering/MinIntensityRendering", "OpenVRVolume": "https://examples.vtk.org/site/Cxx/VolumeRendering/OpenVRVolume", "SimpleRayCast": "https://examples.vtk.org/site/Cxx/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Cxx/Medical/MedicalDemo4"}, "VTKLink": {"vtkVolumeProperty": "https://www.vtk.org/doc/nightly/html/classvtkVolumeProperty.html#details"}, "Java": {"SimpleRayCast": "https://examples.vtk.org/site/Java/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Java/Medical/MedicalDemo4"}, "Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast", "MedicalDemo4": "https://examples.vtk.org/site/Python/Medical/MedicalDemo4"}}, "vtkVoxel": {"Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "VTKLink": {"vtkVoxel": "https://www.vtk.org/doc/nightly/html/classvtkVoxel.html#details"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkVoxelContoursToSurfaceFilter": {"Cxx": {"ContoursToSurface": "https://examples.vtk.org/site/Cxx/PolyData/ContoursToSurface"}, "VTKLink": {"vtkVoxelContoursToSurfaceFilter": "https://www.vtk.org/doc/nightly/html/classvtkVoxelContoursToSurfaceFilter.html#details"}}, "vtkVRMLExporter": {"Cxx": {"ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtkVRMLExporter": "https://www.vtk.org/doc/nightly/html/classvtkVRMLExporter.html#details"}}, "vtkWarpScalar": {"Cxx": {"WarpScalar": "https://examples.vtk.org/site/Cxx/PolyData/WarpScalar", "InterpolateMeshOnGrid": "https://examples.vtk.org/site/Cxx/PolyData/InterpolateMeshOnGrid", "ImageWarp": "https://examples.vtk.org/site/Cxx/Images/ImageWarp", "WarpCombustor": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/WarpCombustor", "ExponentialCosine": "https://examples.vtk.org/site/Cxx/VisualizationAlgorithms/ExponentialCosine", "FitToHeightMap": "https://examples.vtk.org/site/Cxx/Meshes/FitToHeightMap"}, "VTKLink": {"vtkWarpScalar": "https://www.vtk.org/doc/nightly/html/classvtkWarpScalar.html#details"}, "Python": {"ImageWarp": "https://examples.vtk.org/site/Python/Images/ImageWarp", "WarpCombustor": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/WarpCombustor", "ExponentialCosine": "https://examples.vtk.org/site/Python/VisualizationAlgorithms/ExponentialCosine"}}, "vtkWarpTo": {"Cxx": {"WarpTo": "https://examples.vtk.org/site/Cxx/Filtering/WarpTo", "CameraModel1": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Cxx/Visualization/CameraModel2"}, "VTKLink": {"vtkWarpTo": "https://www.vtk.org/doc/nightly/html/classvtkWarpTo.html#details"}, "Java": {"WarpTo": "https://examples.vtk.org/site/Java/Filtering/WarpTo"}, "Python": {"WarpTo": "https://examples.vtk.org/site/Python/Filtering/WarpTo", "CameraModel1": "https://examples.vtk.org/site/Python/Visualization/CameraModel1", "CameraModel2": "https://examples.vtk.org/site/Python/Visualization/CameraModel2"}}, "vtkWedge": {"Cxx": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Cxx/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/LinearCellDemo"}, "VTKLink": {"vtkWedge": "https://www.vtk.org/doc/nightly/html/classvtkWedge.html#details"}, "Python": {"WriteLegacyLinearCells": "https://examples.vtk.org/site/Python/IO/WriteLegacyLinearCells", "WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "LinearCellDemo": "https://examples.vtk.org/site/Python/GeometricObjects/LinearCellDemo"}}, "vtkWidgetCallbackMapper": {"Cxx": {"BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkWidgetCallbackMapper": "https://www.vtk.org/doc/nightly/html/classvtkWidgetCallbackMapper.html#details"}}, "vtkWidgetEvent": {"Cxx": {"BorderWidget": "https://examples.vtk.org/site/Cxx/Widgets/BorderWidget", "BorderWidgetQt": "https://examples.vtk.org/site/Cxx/Qt/BorderWidgetQt"}, "VTKLink": {"vtkWidgetEvent": "https://www.vtk.org/doc/nightly/html/classvtkWidgetEvent.html#details"}, "Python": {"ContourWidget": "https://examples.vtk.org/site/Python/Widgets/ContourWidget"}}, "vtkWindow": {"Cxx": {"AnimateActors": "https://examples.vtk.org/site/Cxx/Animation/AnimateActors"}, "VTKLink": {"vtkWindow": "https://www.vtk.org/doc/nightly/html/classvtkWindow.html#details"}}, "vtkWindowLevelLookupTable": {"Cxx": {"VTKSpectrum": "https://examples.vtk.org/site/Cxx/ImageProcessing/VTKSpectrum", "FrogSlice": "https://examples.vtk.org/site/Cxx/Visualization/FrogSlice", "CurvedReformation": "https://examples.vtk.org/site/Cxx/Visualization/CurvedReformation"}, "VTKLink": {"vtkWindowLevelLookupTable": "https://www.vtk.org/doc/nightly/html/classvtkWindowLevelLookupTable.html#details"}, "Python": {"VTKSpectrum": "https://examples.vtk.org/site/Python/ImageProcessing/VTKSpectrum", "FrogSlice": "https://examples.vtk.org/site/Python/Visualization/FrogSlice"}}, "vtkWindowToImageFilter": {"Cxx": {"ExternalContour": "https://examples.vtk.org/site/Cxx/PolyData/ExternalContour", "OffScreenRendering": "https://examples.vtk.org/site/Cxx/Utilities/OffScreenRendering", "RenderScalarToFloatBuffer": "https://examples.vtk.org/site/Cxx/Utilities/RenderScalarToFloatBuffer", "ZBuffer": "https://examples.vtk.org/site/Cxx/Utilities/ZBuffer", "Screenshot": "https://examples.vtk.org/site/Cxx/Utilities/Screenshot", "ImageWriter": "https://examples.vtk.org/site/Cxx/IO/ImageWriter", "HanoiIntermediate": "https://examples.vtk.org/site/Cxx/Visualization/HanoiIntermediate", "HanoiInitial": "https://examples.vtk.org/site/Cxx/Visualization/HanoiInitial", "Hanoi": "https://examples.vtk.org/site/Cxx/Visualization/Hanoi", "EarthSource": "https://examples.vtk.org/site/Cxx/GeometricObjects/EarthSource", "ParametricObjectsDemo": "https://examples.vtk.org/site/Cxx/GeometricObjects/ParametricObjectsDemo", "WalkCowB": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowB", "WalkCowA": "https://examples.vtk.org/site/Cxx/Rendering/WalkCowA", "PBR_Skybox": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Anisotropy", "WalkCow": "https://examples.vtk.org/site/Cxx/Rendering/WalkCow", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Cxx/Rendering/PBR_Skybox_Texturing"}, "VTKLink": {"vtkWindowToImageFilter": "https://www.vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html#details"}, "Java": {"Screenshot": "https://examples.vtk.org/site/Java/Utilities/Screenshot", "Cone6": "https://examples.vtk.org/site/Java/Rendering/Cone6"}, "Python": {"Screenshot": "https://examples.vtk.org/site/Python/Utilities/Screenshot", "ImageWriter": "https://examples.vtk.org/site/Python/IO/ImageWriter", "Hanoi": "https://examples.vtk.org/site/Python/Visualization/Hanoi", "Cell3DDemonstration": "https://examples.vtk.org/site/Python/GeometricObjects/Cell3DDemonstration", "ParametricObjectsDemo": "https://examples.vtk.org/site/Python/GeometricObjects/ParametricObjectsDemo", "PBR_Skybox_Texturing": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Texturing", "PBR_Skybox_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox_Anisotropy", "PBR_Skybox": "https://examples.vtk.org/site/Python/Rendering/PBR_Skybox", "WalkCow": "https://examples.vtk.org/site/Python/Rendering/WalkCow"}}, "vtkWordCloud": {"Cxx": {"WordCloudDemo": "https://examples.vtk.org/site/Cxx/InfoVis/WordCloudDemo"}, "VTKLink": {"vtkWordCloud": "https://www.vtk.org/doc/nightly/html/classvtkWordCloud.html#details"}}, "vtkWorldPointPicker": {"Cxx": {"WorldPointPicker": "https://examples.vtk.org/site/Cxx/Interaction/WorldPointPicker"}, "VTKLink": {"vtkWorldPointPicker": "https://www.vtk.org/doc/nightly/html/classvtkWorldPointPicker.html#details"}}, "vtkX3DExporter": {"Cxx": {"ImportToExport": "https://examples.vtk.org/site/Cxx/IO/ImportToExport"}, "VTKLink": {"vtkX3DExporter": "https://www.vtk.org/doc/nightly/html/classvtkX3DExporter.html#details"}}, "vtkXMLCompositeDataReader": {"Cxx": {"DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile"}, "VTKLink": {"vtkXMLCompositeDataReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLCompositeDataReader.html#details"}}, "vtkXMLDataSetWriter": {"Cxx": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Cxx/IO/WriteXMLLinearCells"}, "VTKLink": {"vtkXMLDataSetWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLDataSetWriter.html#details"}, "Python": {"WriteXMLLinearCells": "https://examples.vtk.org/site/Python/IO/WriteXMLLinearCells"}}, "vtkXMLMultiBlockDataReader": {"Cxx": {"ImportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ImportPolyDataScene"}, "VTKLink": {"vtkXMLMultiBlockDataReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLMultiBlockDataReader.html#details"}}, "vtkXMLMultiBlockDataWriter": {"Cxx": {"Generate2DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate2DAMRDataSetWithPulse", "Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse", "ExportPolyDataScene": "https://examples.vtk.org/site/Cxx/IO/ExportPolyDataScene"}, "VTKLink": {"vtkXMLMultiBlockDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLMultiBlockDataWriter.html#details"}}, "vtkXMLPImageDataWriter": {"Cxx": {"XMLPImageDataWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPImageDataWriter"}, "VTKLink": {"vtkXMLPImageDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLPImageDataWriter.html#details"}, "Java": {"XMLPImageDataWriter": "https://examples.vtk.org/site/Java/IO/XMLPImageDataWriter"}}, "vtkXMLPUnstructuredGridWriter": {"Cxx": {"XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Cxx/IO/XMLPUnstructuredGridWriter"}, "VTKLink": {"vtkXMLPUnstructuredGridWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLPUnstructuredGridWriter.html#details"}, "Java": {"XMLPUnstructuredGridWriter": "https://examples.vtk.org/site/Java/IO/XMLPUnstructuredGridWriter"}}, "vtkXMLReader": {"Cxx": {"DumpXMLFile": "https://examples.vtk.org/site/Cxx/IO/DumpXMLFile"}, "VTKLink": {"vtkXMLReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLReader.html#details"}}, "vtkXMLRectilinearGridWriter": {"Cxx": {"StructuredDataTypes": "https://examples.vtk.org/site/Cxx/Visualization/StructuredDataTypes"}, "VTKLink": {"vtkXMLRectilinearGridWriter": "https://www.vtk.org/doc/nightly/html/classvtkXMLRectilinearGridWriter.html#details"}}, "vtkXMLTreeReader": {"Cxx": {"TreeMapView": "https://examples.vtk.org/site/Cxx/InfoVis/TreeMapView"}, "VTKLink": {"vtkXMLTreeReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLTreeReader.html#details"}}, "vtkXMLUniformGridAMRReader": {"Cxx": {"Generate3DAMRDataSetWithPulse": "https://examples.vtk.org/site/Cxx/CompositeData/Generate3DAMRDataSetWithPulse"}, "VTKLink": {"vtkXMLUniformGridAMRReader": "https://www.vtk.org/doc/nightly/html/classvtkXMLUniformGridAMRReader.html#details"}}, "vtkXYPlotActor": {"Cxx": {"XYPlot": "https://examples.vtk.org/site/Cxx/Annotation/XYPlot"}, "VTKLink": {"vtkXYPlotActor": "https://www.vtk.org/doc/nightly/html/classvtkXYPlotActor.html#details"}}, "vtkDataRepresentation": {"Java": {"SelectGraphVertices": "https://examples.vtk.org/site/Java/Graphs/SelectGraphVertices"}, "VTKLink": {"vtkDataRepresentation": "https://www.vtk.org/doc/nightly/html/classvtkDataRepresentation.html#details"}}, "vtkGraphMapper": {"Java": {"GeoAssignCoordinates": "https://examples.vtk.org/site/Java/Geovis/GeoAssignCoordinates"}, "VTKLink": {"vtkGraphMapper": "https://www.vtk.org/doc/nightly/html/classvtkGraphMapper.html#details"}}, "vtkImageAppend": {"Python": {"PolyDataToImageDataStencil": "https://examples.vtk.org/site/Python/PolyData/PolyDataToImageDataStencil"}, "VTKLink": {"vtkImageAppend": "https://www.vtk.org/doc/nightly/html/classvtkImageAppend.html#details"}}, "vtkOpenGLRayCastImageDisplayHelper": {"Python": {"VTKWithNumpy": "https://examples.vtk.org/site/Python/Utilities/VTKWithNumpy", "SimpleRayCast": "https://examples.vtk.org/site/Python/VolumeRendering/SimpleRayCast"}, "VTKLink": {"vtkOpenGLRayCastImageDisplayHelper": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLRayCastImageDisplayHelper.html#details"}}, "vtkOpenGLSkybox": {"Python": {"PBR_Anisotropy": "https://examples.vtk.org/site/Python/Rendering/PBR_Anisotropy", "PBR_Materials_Coat": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials_Coat", "PBR_Materials": "https://examples.vtk.org/site/Python/Rendering/PBR_Materials"}, "VTKLink": {"vtkOpenGLSkybox": "https://www.vtk.org/doc/nightly/html/classvtkOpenGLSkybox.html#details"}}, "vtkPolyDataWriter": {"Python": {"AlignTwoPolyDatas": "https://examples.vtk.org/site/Python/PolyData/AlignTwoPolyDatas"}, "VTKLink": {"vtkPolyDataWriter": "https://www.vtk.org/doc/nightly/html/classvtkPolyDataWriter.html#details"}}, "vtkResampleWithDataSet": {"Python": {"PointInterpolator": "https://examples.vtk.org/site/Python/Meshes/PointInterpolator"}, "VTKLink": {"vtkResampleWithDataSet": "https://www.vtk.org/doc/nightly/html/classvtkResampleWithDataSet.html#details"}}, "vtkSplineWidget": {"Python": {"SplineWidget": "https://examples.vtk.org/site/Python/Widgets/SplineWidget"}, "VTKLink": {"vtkSplineWidget": "https://www.vtk.org/doc/nightly/html/classvtkSplineWidget.html#details"}}, "vtkVariantCast": {"Python": {"Variant": "https://examples.vtk.org/site/Python/Utilities/Variant"}, "VTKLink": {"vtkVariantCast": "https://www.vtk.org/doc/nightly/html/classvtkVariantCast.html#details"}}, "vtkVariantCreate": {"Python": {"Variant": "https://examples.vtk.org/site/Python/Utilities/Variant"}, "VTKLink": {"vtkVariantCreate": "https://www.vtk.org/doc/nightly/html/classvtkVariantCreate.html#details"}}, "vtkVariantExtract": {"Python": {"Variant": "https://examples.vtk.org/site/Python/Utilities/Variant"}, "VTKLink": {"vtkVariantExtract": "https://www.vtk.org/doc/nightly/html/classvtkVariantExtract.html#details"}}, "vtkViewUpdater": {"Python": {"ParallelCoordinatesExtraction": "https://examples.vtk.org/site/Python/InfoVis/ParallelCoordinatesExtraction"}, "VTKLink": {"vtkViewUpdater": "https://www.vtk.org/doc/nightly/html/classvtkViewUpdater.html#details"}}} \ No newline at end of file